From: Andrea Amorese Date: Mon, 6 Dec 2021 08:49:34 +0000 (+0100) Subject: Built motion from commit 68b273a6.|2.5.40 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22%7B%7Blicense.chat?a=commitdiff_plain;h=c3fb8ae1b1b0e3d47d354bf43f7e3af0fd2520fa;p=motion2.git Built motion from commit 68b273a6.|2.5.40 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 1af460e..3cc5597 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-12-03T14:56:23.120Z", + "time": "2021-12-06T08:25:14.319Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 19bcca6..c48158c 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-12-03T14:56:23.120Z", + "time": "2021-12-06T08:25:14.319Z", "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 b7c53d4..8e692d8 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 _0x0f6e=['VIRTUAL','getDataValue','action','contactManager','motionbar','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports'];(function(_0xbaf218,_0x416453){var _0x2a0e23=function(_0x310039){while(--_0x310039){_0xbaf218['push'](_0xbaf218['shift']());}};_0x2a0e23(++_0x416453);}(_0x0f6e,0x70));var _0xe0f6=function(_0x4ebe2e,_0xf37ee5){_0x4ebe2e=_0x4ebe2e-0x0;var _0x8d48fd=_0x0f6e[_0x4ebe2e];return _0x8d48fd;};'use strict';var Sequelize=require(_0xe0f6('0x0'));module[_0xe0f6('0x1')]={'name':{'type':Sequelize[_0xe0f6('0x2')],'get':function(_0x35d1d6){return this[_0xe0f6('0x3')](_0xe0f6('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xe0f6('0x5'),'integration',_0xe0f6('0x6'),_0xe0f6('0x7'),_0xe0f6('0x8'),'browser',_0xe0f6('0x9'),_0xe0f6('0xa')]],'msg':_0xe0f6('0xb')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xe0f6('0xc')](0x1000),'comment':_0xe0f6('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xe0f6('0xc')](0x1000),'comment':_0xe0f6('0xe')},'data4':{'type':Sequelize[_0xe0f6('0xc')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0xe0f6('0xc')](0x1000),'comments':_0xe0f6('0xf')},'data6':{'type':Sequelize[_0xe0f6('0xc')],'comments':_0xe0f6('0x10')},'data7':{'type':Sequelize[_0xe0f6('0x11')],'comments':_0xe0f6('0x12')}}; \ No newline at end of file +var _0x6bcd=['motionbar','jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration'];(function(_0x3eabc0,_0x4883cc){var _0x507e24=function(_0x8bbcf7){while(--_0x8bbcf7){_0x3eabc0['push'](_0x3eabc0['shift']());}};_0x507e24(++_0x4883cc);}(_0x6bcd,0x111));var _0xd6bc=function(_0x151b44,_0x1d3a2e){_0x151b44=_0x151b44-0x0;var _0x1764d5=_0x6bcd[_0x151b44];return _0x1764d5;};'use strict';var Sequelize=require('sequelize');module[_0xd6bc('0x0')]={'name':{'type':Sequelize[_0xd6bc('0x1')],'get':function(_0x5bca78){return this[_0xd6bc('0x2')](_0xd6bc('0x3'));}},'action':{'type':Sequelize[_0xd6bc('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xd6bc('0x5'),_0xd6bc('0x6'),_0xd6bc('0x7'),_0xd6bc('0x8'),_0xd6bc('0x9'),_0xd6bc('0xa'),'bot',_0xd6bc('0xb')]],'msg':_0xd6bc('0xc')}},'comment':_0xd6bc('0xc')},'data1':{'type':Sequelize[_0xd6bc('0x4')](0x1000),'comment':_0xd6bc('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xd6bc('0xe')},'data3':{'type':Sequelize[_0xd6bc('0x4')](0x1000),'comment':_0xd6bc('0xf')},'data4':{'type':Sequelize[_0xd6bc('0x4')](0x1000),'comments':_0xd6bc('0x10')},'data5':{'type':Sequelize[_0xd6bc('0x4')](0x1000),'comments':_0xd6bc('0x11')},'data6':{'type':Sequelize[_0xd6bc('0x4')],'comments':_0xd6bc('0x12')},'data7':{'type':Sequelize['TEXT'],'comments':_0xd6bc('0x13')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index cb1fdbc..765664b 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 _0xa008=['catch','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','apply','reject','save','update','destroy','then','stack','name','send','body','Action','find','params'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xa008,0x1b1));var _0x8a00=function(_0x2d3604,_0x29fd06){_0x2d3604=_0x2d3604-0x0;var _0xfda7ef=_0xa008[_0x2d3604];return _0xfda7ef;};'use strict';var emlformat=require(_0x8a00('0x0'));var rimraf=require(_0x8a00('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8a00('0x2'));var rp=require(_0x8a00('0x3'));var moment=require(_0x8a00('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8a00('0x5'));var util=require(_0x8a00('0x6'));var path=require(_0x8a00('0x7'));var sox=require('sox');var csv=require(_0x8a00('0x8'));var ejs=require(_0x8a00('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8a00('0xa'));var squel=require(_0x8a00('0xb'));var crypto=require(_0x8a00('0xc'));var jsforce=require(_0x8a00('0xd'));var deskjs=require(_0x8a00('0xe'));var toCsv=require(_0x8a00('0x8'));var querystring=require(_0x8a00('0xf'));var Papa=require(_0x8a00('0x10'));var Redis=require(_0x8a00('0x11'));var authService=require(_0x8a00('0x12'));var qs=require(_0x8a00('0x13'));var as=require(_0x8a00('0x14'));var hardwareService=require(_0x8a00('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x8a00('0x16'));var config=require(_0x8a00('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8a00('0x18'))['db'];function respondWithStatusCode(_0x176f13,_0x19c45a){_0x19c45a=_0x19c45a||0xcc;return function(_0x1e6d36){if(_0x1e6d36){return _0x176f13[_0x8a00('0x19')](_0x19c45a);}return _0x176f13['status'](_0x19c45a)[_0x8a00('0x1a')]();};}function respondWithResult(_0x2f4c92,_0x300cba){_0x300cba=_0x300cba||0xc8;return function(_0x358da9){if(_0x358da9){return _0x2f4c92[_0x8a00('0x1b')](_0x300cba)[_0x8a00('0x1c')](_0x358da9);}};}function respondWithFilteredResult(_0x48a8f9,_0xba74fe){return function(_0x22a05a){if(_0x22a05a){var _0x42b73c=typeof _0xba74fe['offset']===_0x8a00('0x1d')&&typeof _0xba74fe['limit']===_0x8a00('0x1d');var _0x4a20d8=_0x22a05a[_0x8a00('0x1e')];var _0x41f4e2=_0x42b73c?0x0:_0xba74fe[_0x8a00('0x1f')];var _0x253845=_0x42b73c?_0x22a05a[_0x8a00('0x1e')]:_0xba74fe['offset']+_0xba74fe[_0x8a00('0x20')];var _0x15da6c;if(_0x253845>=_0x4a20d8){_0x253845=_0x4a20d8;_0x15da6c=0xc8;}else{_0x15da6c=0xce;}_0x48a8f9[_0x8a00('0x1b')](_0x15da6c);return _0x48a8f9[_0x8a00('0x21')]('Content-Range',_0x41f4e2+'-'+_0x253845+'/'+_0x4a20d8)['json'](_0x22a05a);}return null;};}function patchUpdates(_0x9bfbf7){return function(_0x160dbe){try{jsonpatch[_0x8a00('0x22')](_0x160dbe,_0x9bfbf7,!![]);}catch(_0x4c3e23){return BPromise[_0x8a00('0x23')](_0x4c3e23);}return _0x160dbe[_0x8a00('0x24')]();};}function saveUpdates(_0x39158d,_0x368807){return function(_0xf7b2e3){if(_0xf7b2e3){return _0xf7b2e3[_0x8a00('0x25')](_0x39158d)['then'](function(_0x5c63df){return _0x5c63df;});}return null;};}function removeEntity(_0x2383fc,_0x5056f9){return function(_0x1905b5){if(_0x1905b5){return _0x1905b5[_0x8a00('0x26')]()[_0x8a00('0x27')](function(){_0x2383fc[_0x8a00('0x1b')](0xcc)[_0x8a00('0x1a')]();});}};}function handleEntityNotFound(_0x1f7c8f,_0x16d741){return function(_0x379c2f){if(!_0x379c2f){_0x1f7c8f[_0x8a00('0x19')](0x194);}return _0x379c2f;};}function handleError(_0x1b5ae4,_0x5f327e){_0x5f327e=_0x5f327e||0x1f4;return function(_0x14118f){logger['error'](_0x14118f[_0x8a00('0x28')]);if(_0x14118f[_0x8a00('0x29')]){delete _0x14118f['name'];}_0x1b5ae4[_0x8a00('0x1b')](_0x5f327e)[_0x8a00('0x2a')](_0x14118f);};}exports[_0x8a00('0x25')]=function(_0x46b970,_0x5ad8de){if(_0x46b970[_0x8a00('0x2b')]['id']){delete _0x46b970[_0x8a00('0x2b')]['id'];}return db[_0x8a00('0x2c')][_0x8a00('0x2d')]({'where':{'id':_0x46b970[_0x8a00('0x2e')]['id']}})[_0x8a00('0x27')](handleEntityNotFound(_0x5ad8de,null))[_0x8a00('0x27')](saveUpdates(_0x46b970[_0x8a00('0x2b')],null))[_0x8a00('0x27')](respondWithResult(_0x5ad8de,null))[_0x8a00('0x2f')](handleError(_0x5ad8de,null));};exports[_0x8a00('0x26')]=function(_0x3db513,_0x490c65){return db['Action'][_0x8a00('0x2d')]({'where':{'id':_0x3db513['params']['id']}})['then'](handleEntityNotFound(_0x490c65,null))[_0x8a00('0x27')](removeEntity(_0x490c65,null))[_0x8a00('0x2f')](handleError(_0x490c65,null));}; \ No newline at end of file +var _0x8dd9=['fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','update','body','Action','find','params','catch','eml-format','rimraf','zip-dir'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x8dd9,0xe3));var _0x98dd=function(_0x335d63,_0x5d8378){_0x335d63=_0x335d63-0x0;var _0x49bcda=_0x8dd9[_0x335d63];return _0x49bcda;};'use strict';var emlformat=require(_0x98dd('0x0'));var rimraf=require(_0x98dd('0x1'));var zipdir=require(_0x98dd('0x2'));var jsonpatch=require(_0x98dd('0x3'));var rp=require('request-promise');var moment=require(_0x98dd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x98dd('0x5'));var util=require(_0x98dd('0x6'));var path=require('path');var sox=require(_0x98dd('0x7'));var csv=require(_0x98dd('0x8'));var ejs=require(_0x98dd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x98dd('0xa'));var squel=require('squel');var crypto=require(_0x98dd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x98dd('0xc'));var toCsv=require(_0x98dd('0x8'));var querystring=require(_0x98dd('0xd'));var Papa=require('papaparse');var Redis=require(_0x98dd('0xe'));var authService=require(_0x98dd('0xf'));var qs=require(_0x98dd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98dd('0x11'));var logger=require(_0x98dd('0x12'))(_0x98dd('0x13'));var utils=require(_0x98dd('0x14'));var config=require(_0x98dd('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x98dd('0x16'))['db'];function respondWithStatusCode(_0x2ed23a,_0x13fa44){_0x13fa44=_0x13fa44||0xcc;return function(_0x24ba7e){if(_0x24ba7e){return _0x2ed23a['sendStatus'](_0x13fa44);}return _0x2ed23a['status'](_0x13fa44)[_0x98dd('0x17')]();};}function respondWithResult(_0x2932bd,_0x272127){_0x272127=_0x272127||0xc8;return function(_0x21ef0b){if(_0x21ef0b){return _0x2932bd['status'](_0x272127)['json'](_0x21ef0b);}};}function respondWithFilteredResult(_0x548d23,_0x52bfc6){return function(_0x5bfce9){if(_0x5bfce9){var _0x3ed8bc=typeof _0x52bfc6[_0x98dd('0x18')]==='undefined'&&typeof _0x52bfc6[_0x98dd('0x19')]===_0x98dd('0x1a');var _0x58f1b0=_0x5bfce9[_0x98dd('0x1b')];var _0x5318df=_0x3ed8bc?0x0:_0x52bfc6[_0x98dd('0x18')];var _0xd0a98a=_0x3ed8bc?_0x5bfce9[_0x98dd('0x1b')]:_0x52bfc6['offset']+_0x52bfc6[_0x98dd('0x19')];var _0x4edfde;if(_0xd0a98a>=_0x58f1b0){_0xd0a98a=_0x58f1b0;_0x4edfde=0xc8;}else{_0x4edfde=0xce;}_0x548d23[_0x98dd('0x1c')](_0x4edfde);return _0x548d23[_0x98dd('0x1d')](_0x98dd('0x1e'),_0x5318df+'-'+_0xd0a98a+'/'+_0x58f1b0)['json'](_0x5bfce9);}return null;};}function patchUpdates(_0x31dd88){return function(_0x1d7aba){try{jsonpatch[_0x98dd('0x1f')](_0x1d7aba,_0x31dd88,!![]);}catch(_0x390e7e){return BPromise[_0x98dd('0x20')](_0x390e7e);}return _0x1d7aba[_0x98dd('0x21')]();};}function saveUpdates(_0x202d95,_0x5103fe){return function(_0x49f5ef){if(_0x49f5ef){return _0x49f5ef['update'](_0x202d95)[_0x98dd('0x22')](function(_0xf04448){return _0xf04448;});}return null;};}function removeEntity(_0x317fc8,_0x39d91){return function(_0x5af528){if(_0x5af528){return _0x5af528['destroy']()[_0x98dd('0x22')](function(){_0x317fc8[_0x98dd('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x240ee0,_0xeb6f75){return function(_0x1ab322){if(!_0x1ab322){_0x240ee0[_0x98dd('0x23')](0x194);}return _0x1ab322;};}function handleError(_0x191c6d,_0x7f79e){_0x7f79e=_0x7f79e||0x1f4;return function(_0x1817c9){logger[_0x98dd('0x24')](_0x1817c9[_0x98dd('0x25')]);if(_0x1817c9['name']){delete _0x1817c9[_0x98dd('0x26')];}_0x191c6d[_0x98dd('0x1c')](_0x7f79e)[_0x98dd('0x27')](_0x1817c9);};}exports[_0x98dd('0x28')]=function(_0x1ad88,_0x4a83b2){if(_0x1ad88['body']['id']){delete _0x1ad88[_0x98dd('0x29')]['id'];}return db[_0x98dd('0x2a')][_0x98dd('0x2b')]({'where':{'id':_0x1ad88[_0x98dd('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4a83b2,null))['then'](saveUpdates(_0x1ad88[_0x98dd('0x29')],null))[_0x98dd('0x22')](respondWithResult(_0x4a83b2,null))[_0x98dd('0x2d')](handleError(_0x4a83b2,null));};exports['destroy']=function(_0x5c5456,_0x44a8e8){return db['Action']['find']({'where':{'id':_0x5c5456['params']['id']}})[_0x98dd('0x22')](handleEntityNotFound(_0x44a8e8,null))[_0x98dd('0x22')](removeEntity(_0x44a8e8,null))[_0x98dd('0x2d')](handleError(_0x44a8e8,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 9454255..bf0a0f7 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 _0x052c=['Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define'];(function(_0x39d4c6,_0xb0f4f9){var _0x2ee25c=function(_0x43a73b){while(--_0x43a73b){_0x39d4c6['push'](_0x39d4c6['shift']());}};_0x2ee25c(++_0xb0f4f9);}(_0x052c,0xe6));var _0xc052=function(_0x21039e,_0x2170c9){_0x21039e=_0x21039e-0x0;var _0x143612=_0x052c[_0x21039e];return _0x143612;};'use strict';var _=require(_0xc052('0x0'));var util=require(_0xc052('0x1'));var logger=require(_0xc052('0x2'))(_0xc052('0x3'));var moment=require(_0xc052('0x4'));var BPromise=require(_0xc052('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc052('0x6'));var config=require(_0xc052('0x7'));var attributes=require('./action.attributes');module[_0xc052('0x8')]=function(_0x22a664,_0x1a96e7){return _0x22a664[_0xc052('0x9')](_0xc052('0xa'),attributes,{'tableName':_0xc052('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1278=['api','moment','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','Action','tools_actions','lodash','util'];(function(_0x11c692,_0x449779){var _0x48708a=function(_0x33319d){while(--_0x33319d){_0x11c692['push'](_0x11c692['shift']());}};_0x48708a(++_0x449779);}(_0x1278,0xbe));var _0x8127=function(_0x53e35e,_0x114a69){_0x53e35e=_0x53e35e-0x0;var _0xaaaa6a=_0x1278[_0x53e35e];return _0xaaaa6a;};'use strict';var _=require(_0x8127('0x0'));var util=require(_0x8127('0x1'));var logger=require('../../config/logger')(_0x8127('0x2'));var moment=require(_0x8127('0x3'));var BPromise=require('bluebird');var rp=require(_0x8127('0x4'));var fs=require('fs');var path=require(_0x8127('0x5'));var rimraf=require(_0x8127('0x6'));var config=require(_0x8127('0x7'));var attributes=require(_0x8127('0x8'));module[_0x8127('0x9')]=function(_0x284526,_0x47f343){return _0x284526['define'](_0x8127('0xa'),attributes,{'tableName':_0x8127('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index ebfdf26..dc89e72 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 _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','Action,\x20%s,\x20%s','Action,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x2bdde9,_0x532246){var _0x4dda93=function(_0x4385e9){while(--_0x4385e9){_0x2bdde9['push'](_0x2bdde9['shift']());}};_0x4dda93(++_0x532246);}(_0xe14b,0x93));var _0xbe14=function(_0x373453,_0x5c41ea){_0x373453=_0x373453-0x0;var _0x233a00=_0xe14b[_0x373453];return _0x233a00;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0x814b=['info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x814b,0x1a2));var _0xb814=function(_0x46cf00,_0x457a43){_0x46cf00=_0x46cf00-0x0;var _0x3974dc=_0x814b[_0x46cf00];return _0x3974dc;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Action,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 6789bbd..66b7783 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 _0xa7bf=['./action.controller','put','/:id','isAuthenticated','update','delete','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xa7bf,0x17b));var _0xfa7b=function(_0x499607,_0x2094ce){_0x499607=_0x499607-0x0;var _0x1c5279=_0xa7bf[_0x499607];return _0x1c5279;};'use strict';var multer=require(_0xfa7b('0x0'));var util=require(_0xfa7b('0x1'));var path=require('path');var timeout=require(_0xfa7b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfa7b('0x3'));var config=require(_0xfa7b('0x4'));var controller=require(_0xfa7b('0x5'));router[_0xfa7b('0x6')](_0xfa7b('0x7'),auth[_0xfa7b('0x8')](),controller[_0xfa7b('0x9')]);router[_0xfa7b('0xa')](_0xfa7b('0x7'),auth[_0xfa7b('0x8')](),controller['destroy']);module[_0xfa7b('0xb')]=router; \ No newline at end of file +var _0x4d95=['delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update'];(function(_0x23cfaf,_0x1d8545){var _0xf8af44=function(_0x163779){while(--_0x163779){_0x23cfaf['push'](_0x23cfaf['shift']());}};_0xf8af44(++_0x1d8545);}(_0x4d95,0x143));var _0x54d9=function(_0x2f43e9,_0x430e2b){_0x2f43e9=_0x2f43e9-0x0;var _0x111f57=_0x4d95[_0x2f43e9];return _0x111f57;};'use strict';var multer=require(_0x54d9('0x0'));var util=require(_0x54d9('0x1'));var path=require(_0x54d9('0x2'));var timeout=require('connect-timeout');var express=require(_0x54d9('0x3'));var router=express['Router']();var fs_extra=require(_0x54d9('0x4'));var auth=require(_0x54d9('0x5'));var interaction=require(_0x54d9('0x6'));var config=require(_0x54d9('0x7'));var controller=require(_0x54d9('0x8'));router[_0x54d9('0x9')](_0x54d9('0xa'),auth[_0x54d9('0xb')](),controller[_0x54d9('0xc')]);router[_0x54d9('0xd')](_0x54d9('0xa'),auth['isAuthenticated'](),controller[_0x54d9('0xe')]);module[_0x54d9('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 2bda1e9..65d65bd 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 _0x53ec=['STRING','TEXT','sequelize','exports'];(function(_0x5d8d98,_0x2b9798){var _0x1ea554=function(_0x4dfb99){while(--_0x4dfb99){_0x5d8d98['push'](_0x5d8d98['shift']());}};_0x1ea554(++_0x2b9798);}(_0x53ec,0x192));var _0xc53e=function(_0x81fee8,_0x32f097){_0x81fee8=_0x81fee8-0x0;var _0x2b2c4e=_0x53ec[_0x81fee8];return _0x2b2c4e;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'name':{'type':Sequelize[_0xc53e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc53e('0x2')]},'parent':{'type':Sequelize[_0xc53e('0x2')]},'table':{'type':Sequelize[_0xc53e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xc53e('0x3')]}}; \ No newline at end of file +var _0x2bd8=['TEXT','sequelize','STRING'];(function(_0x1bfe04,_0x31c376){var _0x40cc69=function(_0x4e78ca){while(--_0x4e78ca){_0x1bfe04['push'](_0x1bfe04['shift']());}};_0x40cc69(++_0x31c376);}(_0x2bd8,0x130));var _0x82bd=function(_0x519ac4,_0x4c4152){_0x519ac4=_0x519ac4-0x0;var _0xc8d4f0=_0x2bd8[_0x519ac4];return _0xc8d4f0;};'use strict';var Sequelize=require(_0x82bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x82bd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x82bd('0x1')]},'parent':{'type':Sequelize[_0x82bd('0x1')]},'table':{'type':Sequelize[_0x82bd('0x1')]},'conditions':{'type':Sequelize[_0x82bd('0x2')]},'joins':{'type':Sequelize[_0x82bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 7564fa1..a83e422 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 _0x42f1=['save','update','then','destroy','get','UserProfileResource','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_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)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','condition','merge','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SUM(%s)','SEC_TO_TIME(%s)','IS\x20NOT\x20EMPTY','operator','value','%s.%s\x20=\x20%s.%s','fullPath','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','fork','../../components/export/','output','savename','countTable','COUNT(*)','SELECT','run','runReport','Sequelize','from','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0x42f1,0x82));var _0x142f=function(_0x3c4812,_0x77c2ff){_0x3c4812=_0x3c4812-0x0;var _0x2030c1=_0x42f1[_0x3c4812];return _0x2030c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x142f('0x0'));var zipdir=require(_0x142f('0x1'));var jsonpatch=require(_0x142f('0x2'));var rp=require(_0x142f('0x3'));var moment=require(_0x142f('0x4'));var BPromise=require(_0x142f('0x5'));var Mustache=require('mustache');var util=require(_0x142f('0x6'));var path=require(_0x142f('0x7'));var sox=require('sox');var csv=require(_0x142f('0x8'));var ejs=require(_0x142f('0x9'));var fs=require('fs');var fs_extra=require(_0x142f('0xa'));var _=require(_0x142f('0xb'));var squel=require('squel');var crypto=require(_0x142f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x142f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x142f('0xe'));var Redis=require(_0x142f('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x142f('0x10'));var hardwareService=require(_0x142f('0x11'));var logger=require(_0x142f('0x12'))(_0x142f('0x13'));var utils=require('../../config/utils');var config=require(_0x142f('0x14'));var licenseUtil=require(_0x142f('0x15'));var db=require(_0x142f('0x16'))['db'];var dbH=require(_0x142f('0x16'))[_0x142f('0x17')];function respondWithStatusCode(_0x54f5f3,_0x26b504){_0x26b504=_0x26b504||0xcc;return function(_0x4f7fe9){if(_0x4f7fe9){return _0x54f5f3[_0x142f('0x18')](_0x26b504);}return _0x54f5f3[_0x142f('0x19')](_0x26b504)[_0x142f('0x1a')]();};}function respondWithResult(_0x3796e8,_0x4014cb){_0x4014cb=_0x4014cb||0xc8;return function(_0x51c68a){if(_0x51c68a){return _0x3796e8[_0x142f('0x19')](_0x4014cb)[_0x142f('0x1b')](_0x51c68a);}};}function respondWithFilteredResult(_0x7a201e,_0x7d9195){return function(_0x3f1107){if(_0x3f1107){var _0x28a48e=typeof _0x7d9195['offset']===_0x142f('0x1c')&&typeof _0x7d9195[_0x142f('0x1d')]===_0x142f('0x1c');var _0x127c0f=_0x3f1107[_0x142f('0x1e')];var _0x5625a9=_0x28a48e?0x0:_0x7d9195[_0x142f('0x1f')];var _0x3b925d=_0x28a48e?_0x3f1107[_0x142f('0x1e')]:_0x7d9195[_0x142f('0x1f')]+_0x7d9195[_0x142f('0x1d')];var _0x492722;if(_0x3b925d>=_0x127c0f){_0x3b925d=_0x127c0f;_0x492722=0xc8;}else{_0x492722=0xce;}_0x7a201e[_0x142f('0x19')](_0x492722);return _0x7a201e[_0x142f('0x20')](_0x142f('0x21'),_0x5625a9+'-'+_0x3b925d+'/'+_0x127c0f)[_0x142f('0x1b')](_0x3f1107);}return null;};}function patchUpdates(_0x5a3477){return function(_0x2c4bb0){try{jsonpatch['apply'](_0x2c4bb0,_0x5a3477,!![]);}catch(_0x17dd8d){return BPromise[_0x142f('0x22')](_0x17dd8d);}return _0x2c4bb0[_0x142f('0x23')]();};}function saveUpdates(_0x4ced74,_0x3b481c){return function(_0x4e66f5){if(_0x4e66f5){return _0x4e66f5[_0x142f('0x24')](_0x4ced74)[_0x142f('0x25')](function(_0x492b94){return _0x492b94;});}return null;};}function removeEntity(_0x218ae7,_0x234562){return function(_0x5c4eae){if(_0x5c4eae){return _0x5c4eae[_0x142f('0x26')]()[_0x142f('0x25')](function(){var _0x1058fc=_0x5c4eae[_0x142f('0x27')]({'plain':!![]});var _0x214322='CustomReports';return db[_0x142f('0x28')][_0x142f('0x26')]({'where':{'type':_0x214322,'resourceId':_0x1058fc['id']}})[_0x142f('0x25')](function(){return _0x5c4eae;});})['then'](function(){_0x218ae7[_0x142f('0x19')](0xcc)[_0x142f('0x1a')]();});}};}function handleEntityNotFound(_0x312b8b,_0x3ab1c3){return function(_0x41dc41){if(!_0x41dc41){_0x312b8b[_0x142f('0x18')](0x194);}return _0x41dc41;};}function handleError(_0x52df61,_0x49f8b0){_0x49f8b0=_0x49f8b0||0x1f4;return function(_0x37f851){logger['error'](_0x37f851['stack']);if(_0x37f851[_0x142f('0x29')]){delete _0x37f851['name'];}_0x52df61['status'](_0x49f8b0)[_0x142f('0x2a')](_0x37f851);};}exports[_0x142f('0x2b')]=function(_0x40aad8,_0x21ea83){var _0xefe384={},_0x3bb4f8={},_0x3759b4={'count':0x0,'rows':[]};var _0x31ab4d=_[_0x142f('0x2c')](db[_0x142f('0x2d')][_0x142f('0x2e')],function(_0x598b62){return{'name':_0x598b62[_0x142f('0x2f')],'type':_0x598b62['type'][_0x142f('0x30')]};});_0x3bb4f8[_0x142f('0x31')]=_[_0x142f('0x2c')](_0x31ab4d,'name');_0x3bb4f8[_0x142f('0x32')]=_[_0x142f('0x33')](_0x40aad8[_0x142f('0x32')]);_0x3bb4f8['filters']=_[_0x142f('0x34')](_0x3bb4f8[_0x142f('0x31')],_0x3bb4f8['query']);_0xefe384[_0x142f('0x35')]=_['intersection'](_0x3bb4f8[_0x142f('0x31')],qs['fields'](_0x40aad8['query'][_0x142f('0x36')]));_0xefe384['attributes']=_0xefe384[_0x142f('0x35')][_0x142f('0x37')]?_0xefe384[_0x142f('0x35')]:_0x3bb4f8[_0x142f('0x31')];if(!_0x40aad8[_0x142f('0x32')][_0x142f('0x38')](_0x142f('0x39'))){_0xefe384['limit']=qs[_0x142f('0x1d')](_0x40aad8[_0x142f('0x32')][_0x142f('0x1d')]);_0xefe384['offset']=qs['offset'](_0x40aad8[_0x142f('0x32')][_0x142f('0x1f')]);}_0xefe384[_0x142f('0x3a')]=qs[_0x142f('0x3b')](_0x40aad8[_0x142f('0x32')][_0x142f('0x3b')]);_0xefe384[_0x142f('0x3c')]=qs[_0x142f('0x3d')](_['pick'](_0x40aad8[_0x142f('0x32')],_0x3bb4f8[_0x142f('0x3d')]),_0x31ab4d);if(_0x40aad8[_0x142f('0x32')][_0x142f('0x3e')]){_0xefe384['where']=_['merge'](_0xefe384[_0x142f('0x3c')],{'$or':_[_0x142f('0x2c')](_0x31ab4d,function(_0x1707ef){if(_0x1707ef[_0x142f('0x3f')]!==_0x142f('0x40')){var _0x1a5490={};_0x1a5490[_0x1707ef[_0x142f('0x29')]]={'$like':'%'+_0x40aad8[_0x142f('0x32')]['filter']+'%'};return _0x1a5490;}})});}_0xefe384=_['merge']({},_0xefe384,_0x40aad8[_0x142f('0x41')]);var _0x109d5f={'where':_0xefe384[_0x142f('0x3c')]};return db[_0x142f('0x2d')]['count'](_0x109d5f)['then'](function(_0x2ac2ba){_0x3759b4[_0x142f('0x1e')]=_0x2ac2ba;if(_0x40aad8['query'][_0x142f('0x42')]){_0xefe384[_0x142f('0x43')]=[{'all':!![]}];}return db[_0x142f('0x2d')][_0x142f('0x44')](_0xefe384);})[_0x142f('0x25')](function(_0x48769d){_0x3759b4[_0x142f('0x45')]=_0x48769d;return _0x3759b4;})[_0x142f('0x25')](respondWithFilteredResult(_0x21ea83,_0xefe384))[_0x142f('0x46')](handleError(_0x21ea83,null));};exports[_0x142f('0x47')]=function(_0x3dad69,_0x4aaae9){var _0x534efb={'raw':![],'where':{'id':_0x3dad69[_0x142f('0x48')]['id']}},_0x390cd5={};_0x390cd5['model']=_[_0x142f('0x33')](db[_0x142f('0x2d')]['rawAttributes']);_0x390cd5[_0x142f('0x32')]=_['keys'](_0x3dad69[_0x142f('0x32')]);_0x390cd5[_0x142f('0x3d')]=_['intersection'](_0x390cd5[_0x142f('0x31')],_0x390cd5[_0x142f('0x32')]);_0x534efb[_0x142f('0x35')]=_['intersection'](_0x390cd5[_0x142f('0x31')],qs['fields'](_0x3dad69[_0x142f('0x32')][_0x142f('0x36')]));_0x534efb[_0x142f('0x35')]=_0x534efb[_0x142f('0x35')][_0x142f('0x37')]?_0x534efb[_0x142f('0x35')]:_0x390cd5['model'];if(_0x3dad69[_0x142f('0x32')][_0x142f('0x42')]){_0x534efb[_0x142f('0x43')]=[{'all':!![]}];}_0x534efb=_['merge']({},_0x534efb,_0x3dad69[_0x142f('0x41')]);return db['AnalyticCustomReport'][_0x142f('0x49')](_0x534efb)['then'](handleEntityNotFound(_0x4aaae9,null))[_0x142f('0x25')](respondWithResult(_0x4aaae9,null))['catch'](handleError(_0x4aaae9,null));};exports['create']=function(_0x4ad71b,_0x385769){return db[_0x142f('0x2d')][_0x142f('0x4a')](_0x4ad71b[_0x142f('0x4b')],{})[_0x142f('0x25')](function(_0x206ddc){var _0x306c08=_0x4ad71b[_0x142f('0x4c')][_0x142f('0x27')]({'plain':!![]});if(!_0x306c08)throw new Error(_0x142f('0x4d'));if(_0x306c08[_0x142f('0x4e')]===_0x142f('0x4c')){var _0x383241=_0x206ddc[_0x142f('0x27')]({'plain':!![]});var _0x5321d7=_0x142f('0x4f');return db['UserProfileSection'][_0x142f('0x49')]({'where':{'name':_0x5321d7,'userProfileId':_0x306c08[_0x142f('0x50')]},'raw':!![]})[_0x142f('0x25')](function(_0x3839c9){if(_0x3839c9&&_0x3839c9[_0x142f('0x51')]===0x0){return db['UserProfileResource'][_0x142f('0x4a')]({'name':_0x383241[_0x142f('0x29')],'resourceId':_0x383241['id'],'type':_0x142f('0x52'),'sectionId':_0x3839c9['id']},{})[_0x142f('0x25')](function(){return _0x206ddc;});}else{return _0x206ddc;}})['catch'](function(_0x502acd){logger['error'](_0x142f('0x53'),_0x502acd);throw _0x502acd;});}return _0x206ddc;})[_0x142f('0x25')](respondWithResult(_0x385769,0xc9))[_0x142f('0x46')](handleError(_0x385769,null));};exports[_0x142f('0x24')]=function(_0x9c7d78,_0x3d1a34){if(_0x9c7d78[_0x142f('0x4b')]['id']){delete _0x9c7d78[_0x142f('0x4b')]['id'];}return db[_0x142f('0x2d')][_0x142f('0x49')]({'where':{'id':_0x9c7d78[_0x142f('0x48')]['id']}})[_0x142f('0x25')](handleEntityNotFound(_0x3d1a34,null))[_0x142f('0x25')](saveUpdates(_0x9c7d78['body'],null))[_0x142f('0x25')](respondWithResult(_0x3d1a34,null))[_0x142f('0x46')](handleError(_0x3d1a34,null));};exports[_0x142f('0x26')]=function(_0x2ec0d0,_0x3d3790){return db[_0x142f('0x2d')][_0x142f('0x49')]({'where':{'id':_0x2ec0d0[_0x142f('0x48')]['id']}})[_0x142f('0x25')](handleEntityNotFound(_0x3d3790,null))['then'](removeEntity(_0x3d3790,null))['catch'](handleError(_0x3d3790,null));};exports[_0x142f('0x54')]=function(_0x233dac,_0x2fc34d){var _0x27b247=0xa;var _0x46e639=[_0x142f('0x55'),_0x142f('0x56'),_0x142f('0x57'),'cross_join'];var _0x35c9c3={'SUM':'SUM(%s)','COUNT':_0x142f('0x58'),'COUNT DISTINCT':_0x142f('0x59'),'MAX':_0x142f('0x5a'),'MIN':_0x142f('0x5b'),'AVG':_0x142f('0x5c'),'GROUP_CONCAT':_0x142f('0x5d'),'GROUP_CONCAT ASC':_0x142f('0x5e'),'GROUP_CONCAT DESC':_0x142f('0x5f')};var _0x34c079={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x142f('0x60'),'HOUR':_0x142f('0x61'),'ROUND':_0x142f('0x62'),'UNIX_TIMESTAMP':_0x142f('0x63')};var _0xb0d03a=function(_0x235b9b){return!_[_0x142f('0x64')]([_0x142f('0x65'),_0x142f('0x66'),_0x142f('0x67'),'IS\x20NOT\x20EMPTY'],_0x235b9b);};var _0x1bfc54=function(_0x3e60e3){if(!_0x3e60e3||!_0x3e60e3[_0x142f('0x68')][_0x142f('0x37')]){return'';}for(var _0x23a46b='(',_0x27e2a9=0x0;_0x27e2a9<_0x3e60e3['rules'][_0x142f('0x37')];_0x27e2a9+=0x1){_0x27e2a9>0x0&&(_0x23a46b+='\x20'+_0x3e60e3['operator']+'\x20');_0x23a46b+=_0x3e60e3[_0x142f('0x68')][_0x27e2a9][_0x142f('0x69')]?_0x1bfc54(_0x3e60e3[_0x142f('0x68')][_0x27e2a9]['group']):_0x3e60e3[_0x142f('0x68')][_0x27e2a9][_0x142f('0x6a')]+'\x20'+_0x3e60e3[_0x142f('0x68')][_0x27e2a9][_0x142f('0x6b')]+(_0xb0d03a(_0x3e60e3[_0x142f('0x68')][_0x27e2a9][_0x142f('0x6b')])?'\x20'+_0x3e60e3['rules'][_0x27e2a9]['value']:'');}return _0x23a46b+')';};var _0x1c60d6={'where':{'id':_0x233dac[_0x142f('0x48')]['id']}},_0x41c34e,_0x29c13b,_0xc015f7,_0xb81438,_0x5e069f;_0x1c60d6=_[_0x142f('0x6c')]({},_0x1c60d6,_0x233dac[_0x142f('0x41')]);return db[_0x142f('0x2d')][_0x142f('0x49')](_0x1c60d6)[_0x142f('0x25')](function(_0xfa5033){if(_0xfa5033){_0x41c34e=_0xfa5033;return _0xfa5033[_0x142f('0x6d')]();}return null;})[_0x142f('0x25')](function(_0xb36087){if(_0xb36087){if(!_0xb36087['length']){throw new db['Sequelize'][(_0x142f('0x6e'))](_0x142f('0x6f'),0x193);}_0x29c13b=_0xb36087;return db[_0x142f('0x70')][_0x142f('0x44')]({'raw':!![]});}return null;})[_0x142f('0x25')](function(_0x359e84){if(_0x359e84){_0xc015f7=_[_0x142f('0x71')](_0x359e84,'id');var _0x4cb8ce;var _0x5df1f9=squel[_0x142f('0x72')]();_0x5df1f9['from'](_0x41c34e[_0x142f('0x73')]);for(var _0x46ab08=0x0;_0x46ab08<_0x29c13b[_0x142f('0x37')];_0x46ab08+=0x1){_0x4cb8ce=_0x29c13b[_0x46ab08][_0x142f('0x74')]?_0xc015f7[_0x29c13b[_0x46ab08][_0x142f('0x74')]][_0x142f('0x75')]:_0x29c13b[_0x46ab08][_0x142f('0x6a')];_0x4cb8ce=_0x29c13b[_0x46ab08][_0x142f('0x76')]?_[_0x142f('0x77')](_0x35c9c3[_0x29c13b[_0x46ab08][_0x142f('0x76')]],'%s',_0x4cb8ce):_0x4cb8ce;_0x4cb8ce=_0x29c13b[_0x46ab08]['format']?_[_0x142f('0x77')](_0x34c079[_0x29c13b[_0x46ab08][_0x142f('0x78')]],'%s',_0x4cb8ce):_0x4cb8ce;if(_0x29c13b[_0x46ab08][_0x142f('0x79')]){_0x5df1f9[_0x142f('0x69')](_0x4cb8ce);}_0x29c13b[_0x46ab08]['orderBy']&&_0x5df1f9['order'](_0x4cb8ce,_0x29c13b[_0x46ab08][_0x142f('0x7a')]===_0x142f('0x7b')?![]:!![]);_0x5df1f9[_0x142f('0x6a')](_0x4cb8ce,_0x29c13b[_0x46ab08][_0x142f('0x7c')]||_0x4cb8ce);}if(_0x41c34e[_0x142f('0x7d')]){_0x41c34e[_0x142f('0x7d')]=JSON[_0x142f('0x7e')](_0x41c34e['joins']);for(var _0x116f31=0x0;_0x116f31<_0x41c34e['joins'][_0x142f('0x37')];_0x116f31+=0x1){if(_0x41c34e[_0x142f('0x7d')][_0x116f31]['type']&&_['includes'](_0x46e639,_0x41c34e[_0x142f('0x7d')][_0x116f31][_0x142f('0x3f')])&&_0x41c34e[_0x142f('0x7d')][_0x116f31][_0x142f('0x7f')]&&_0x41c34e[_0x142f('0x7d')][_0x116f31][_0x142f('0x80')]&&_0x41c34e[_0x142f('0x7d')][_0x116f31][_0x142f('0x81')]){_0x5df1f9[_0x41c34e[_0x142f('0x7d')][_0x116f31][_0x142f('0x3f')]](_0x41c34e['joins'][_0x116f31][_0x142f('0x80')],null,util[_0x142f('0x78')]('%s.%s\x20=\x20%s.%s',_0x41c34e[_0x142f('0x73')],_0x41c34e[_0x142f('0x7d')][_0x116f31]['parentKey'],_0x41c34e[_0x142f('0x7d')][_0x116f31]['foreignTable'],_0x41c34e[_0x142f('0x7d')][_0x116f31]['foreignKey']));}}}if(_0x41c34e['conditions']){_0x41c34e[_0x142f('0x82')]=JSON['parse'](_0x41c34e[_0x142f('0x82')]);_0x5df1f9[_0x142f('0x3c')](_0x1bfc54(_0x41c34e[_0x142f('0x82')]['group']));}_0x5e069f=_0x5df1f9[_0x142f('0x83')]();_0x5df1f9['limit'](_0x27b247);_0x5df1f9['offset'](0x0);logger[_0x142f('0x84')](_0x142f('0x85'),_0x5df1f9[_0x142f('0x86')]());return dbH[_0x142f('0x87')][_0x142f('0x32')](_0x5df1f9['toString'](),{'type':dbH['sequelize'][_0x142f('0x88')]['SELECT']});}})[_0x142f('0x25')](respondWithResult(_0x2fc34d,null))[_0x142f('0x46')](handleError(_0x2fc34d,null));};function runReport(_0x244065,_0x33e0b4,_0x3392a8){var _0x5cfef5=_0x33e0b4[_0x142f('0x29')];var _0x35ed1e=0xa;var _0x18e95a=[_0x142f('0x55'),_0x142f('0x56'),_0x142f('0x57'),'cross_join'];var _0x22e2a8={'SUM':_0x142f('0x89'),'COUNT':_0x142f('0x58'),'COUNT DISTINCT':_0x142f('0x59'),'MAX':_0x142f('0x5a'),'MIN':'MIN(%s)','AVG':_0x142f('0x5c'),'GROUP_CONCAT':_0x142f('0x5d'),'GROUP_CONCAT ASC':_0x142f('0x5e'),'GROUP_CONCAT DESC':_0x142f('0x5f')};var _0x9f369a={'SEC_TO_TIME':_0x142f('0x8a'),'DATE':_0x142f('0x60'),'HOUR':_0x142f('0x61'),'ROUND':_0x142f('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1e5402=function(_0x13b448){return!_[_0x142f('0x64')]([_0x142f('0x65'),_0x142f('0x66'),_0x142f('0x67'),_0x142f('0x8b')],_0x13b448);};var _0x3ecfe9=function(_0x1d52ce){if(!_0x1d52ce||!_0x1d52ce['rules'][_0x142f('0x37')]){return'';}for(var _0x519fa2='(',_0x1ae881=0x0;_0x1ae881<_0x1d52ce[_0x142f('0x68')][_0x142f('0x37')];_0x1ae881+=0x1){_0x1ae881>0x0&&(_0x519fa2+='\x20'+_0x1d52ce[_0x142f('0x8c')]+'\x20');_0x519fa2+=_0x1d52ce[_0x142f('0x68')][_0x1ae881]['group']?_0x3ecfe9(_0x1d52ce[_0x142f('0x68')][_0x1ae881][_0x142f('0x69')]):_0x1d52ce[_0x142f('0x68')][_0x1ae881][_0x142f('0x6a')]+'\x20'+_0x1d52ce[_0x142f('0x68')][_0x1ae881][_0x142f('0x6b')]+(_0x1e5402(_0x1d52ce[_0x142f('0x68')][_0x1ae881][_0x142f('0x6b')])?'\x20'+_0x1d52ce[_0x142f('0x68')][_0x1ae881][_0x142f('0x8d')]:'');}return _0x519fa2+')';};var _0xfd78e9={'where':{'id':_0x244065['id']}},_0x2de3f7,_0x1a8986,_0x24806e,_0x5bedbc,_0xaa1576;_0xfd78e9=_[_0x142f('0x6c')]({},_0xfd78e9,_0x3392a8);return db[_0x142f('0x2d')][_0x142f('0x49')](_0xfd78e9)['then'](function(_0x25fc0b){if(_0x25fc0b){_0x2de3f7=_0x25fc0b;return _0x25fc0b[_0x142f('0x6d')]();}return null;})[_0x142f('0x25')](function(_0x168eed){if(_0x168eed){if(!_0x168eed['length']){throw new db['Sequelize'][(_0x142f('0x6e'))](_0x142f('0x6f'),0x193);}_0x1a8986=_0x168eed;return db[_0x142f('0x70')][_0x142f('0x44')]({'raw':!![]});}return null;})['then'](function(_0x5b32ed){if(_0x5b32ed){_0x24806e=_['keyBy'](_0x5b32ed,'id');var _0x58ddf6;var _0xd163db=squel[_0x142f('0x72')]();_0xd163db['from'](_0x2de3f7[_0x142f('0x73')]);for(var _0x3041cf=0x0;_0x3041cf<_0x1a8986[_0x142f('0x37')];_0x3041cf+=0x1){_0x58ddf6=_0x1a8986[_0x3041cf][_0x142f('0x74')]?_0x24806e[_0x1a8986[_0x3041cf][_0x142f('0x74')]][_0x142f('0x75')]:_0x1a8986[_0x3041cf][_0x142f('0x6a')];_0x58ddf6=_0x1a8986[_0x3041cf][_0x142f('0x76')]?_[_0x142f('0x77')](_0x22e2a8[_0x1a8986[_0x3041cf][_0x142f('0x76')]],'%s',_0x58ddf6):_0x58ddf6;_0x58ddf6=_0x1a8986[_0x3041cf][_0x142f('0x78')]?_['replace'](_0x9f369a[_0x1a8986[_0x3041cf]['format']],'%s',_0x58ddf6):_0x58ddf6;if(_0x1a8986[_0x3041cf][_0x142f('0x79')]){_0xd163db[_0x142f('0x69')](_0x58ddf6);}_0x1a8986[_0x3041cf][_0x142f('0x7a')]&&_0xd163db['order'](_0x58ddf6,_0x1a8986[_0x3041cf][_0x142f('0x7a')]===_0x142f('0x7b')?![]:!![]);_0xd163db[_0x142f('0x6a')](_0x58ddf6,_0x1a8986[_0x3041cf][_0x142f('0x7c')]||_0x58ddf6);}if(_0x2de3f7[_0x142f('0x7d')]){_0x2de3f7[_0x142f('0x7d')]=JSON[_0x142f('0x7e')](_0x2de3f7[_0x142f('0x7d')]);for(var _0x3fb723=0x0;_0x3fb723<_0x2de3f7[_0x142f('0x7d')]['length'];_0x3fb723+=0x1){if(_0x2de3f7[_0x142f('0x7d')][_0x3fb723][_0x142f('0x3f')]&&_[_0x142f('0x64')](_0x18e95a,_0x2de3f7[_0x142f('0x7d')][_0x3fb723]['type'])&&_0x2de3f7[_0x142f('0x7d')][_0x3fb723][_0x142f('0x7f')]&&_0x2de3f7['joins'][_0x3fb723][_0x142f('0x80')]&&_0x2de3f7[_0x142f('0x7d')][_0x3fb723][_0x142f('0x81')]){_0xd163db[_0x2de3f7[_0x142f('0x7d')][_0x3fb723]['type']](_0x2de3f7[_0x142f('0x7d')][_0x3fb723]['foreignTable'],null,util[_0x142f('0x78')](_0x142f('0x8e'),_0x2de3f7[_0x142f('0x73')],_0x2de3f7[_0x142f('0x7d')][_0x3fb723][_0x142f('0x7f')],_0x2de3f7['joins'][_0x3fb723][_0x142f('0x80')],_0x2de3f7[_0x142f('0x7d')][_0x3fb723][_0x142f('0x81')]));}}}if(_0x2de3f7[_0x142f('0x82')]){_0x2de3f7['conditions']=JSON[_0x142f('0x7e')](_0x2de3f7[_0x142f('0x82')]);_0xd163db[_0x142f('0x3c')](_0x3ecfe9(_0x2de3f7[_0x142f('0x82')]['group']));}_0xaa1576=_0xd163db['clone']();_0xd163db['limit'](_0x35ed1e);_0xd163db[_0x142f('0x1f')](0x0);return;}})['then'](function(){if(_0x33e0b4['output']==='web'){return null;}var _0x2850ba=_['merge'](_0x33e0b4,{'name':_0x33e0b4[_0x142f('0x8f')]||_0x33e0b4[_0x142f('0x29')]||_0x2de3f7['name'],'basename':_0x5cfef5,'savename':util[_0x142f('0x78')]('%s-%s.%s',_0x33e0b4['name']||_0x2de3f7[_0x142f('0x29')],require('randomstring')[_0x142f('0x90')](0x4),_0x33e0b4['output']||_0x142f('0x91')),'reportId':_0x2de3f7['id'],'reportType':_0x142f('0x92')});return db[_0x142f('0x93')][_0x142f('0x4a')](_0x2850ba,{'raw':!![]});})[_0x142f('0x25')](function(_0x785f5){if(_0x2de3f7[_0x142f('0x73')]==='cdr'){_0xaa1576['where'](_0x2de3f7[_0x142f('0x73')]+_0x142f('0x94'),_0x33e0b4[_0x142f('0x95')],_0x33e0b4[_0x142f('0x96')]);}else{_0xaa1576[_0x142f('0x3c')](_0x2de3f7['table']+_0x142f('0x97'),_0x33e0b4[_0x142f('0x95')],_0x33e0b4[_0x142f('0x96')]);}if(_0x785f5){logger[_0x142f('0x98')](_0x142f('0x99'),_0xaa1576[_0x142f('0x86')]());require('child_process')[_0x142f('0x9a')](path[_0x142f('0x55')](__dirname,_0x142f('0x9b'),_0x785f5[_0x142f('0x9c')]),[_0x785f5['id'],_0xaa1576[_0x142f('0x86')](),path['join'](__dirname,'../../files/reports',_0x785f5[_0x142f('0x9d')]),_0x5cfef5]);return _0x785f5;}else{var _0x5346d3=squel[_0x142f('0x72')]();_0x5346d3['from']('('+_0xaa1576[_0x142f('0x86')]()+')',_0x142f('0x9e'));_0x5346d3['field'](_0x142f('0x9f'),_0x142f('0x1e'));_0xaa1576[_0x142f('0x1d')](_0x33e0b4[_0x142f('0x1d')]||_0x35ed1e);_0xaa1576[_0x142f('0x1f')](_0x33e0b4[_0x142f('0x1f')]||0x0);return dbH[_0x142f('0x87')]['query'](_0x5346d3[_0x142f('0x86')](),{'type':dbH[_0x142f('0x87')][_0x142f('0x88')]['SELECT']})['then'](function(_0x1e1683){if(!_0x1e1683[_0x142f('0x37')]){_0x5bedbc=0x0;}else{_0x5bedbc=_0x1e1683[0x0][_0x142f('0x1e')]||0x0;}return dbH[_0x142f('0x87')][_0x142f('0x32')](_0xaa1576[_0x142f('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x142f('0xa0')]});})[_0x142f('0x25')](function(_0x5ebf66){return{'rows':_0x5ebf66||[],'count':_0x5bedbc};});}});}exports[_0x142f('0xa1')]=function(_0x3c909f,_0x180170){return runReport(_0x3c909f['params'],_0x3c909f[_0x142f('0x32')],_0x3c909f[_0x142f('0x41')])[_0x142f('0x25')](respondWithResult(_0x180170,null))['catch'](handleError(_0x180170,null));};exports[_0x142f('0xa2')]=runReport;exports[_0x142f('0x32')]=function(_0x13354e,_0x36879e){var _0x12ede6=0xa;var _0x2e6e07=['join',_0x142f('0x56'),_0x142f('0x57'),'cross_join'];var _0x4266d1={'SUM':'SUM(%s)','COUNT':_0x142f('0x58'),'COUNT DISTINCT':_0x142f('0x59'),'MAX':_0x142f('0x5a'),'MIN':_0x142f('0x5b'),'AVG':_0x142f('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x142f('0x5e'),'GROUP_CONCAT DESC':_0x142f('0x5f')};var _0x5bbb06={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x142f('0x60'),'HOUR':_0x142f('0x61'),'ROUND':_0x142f('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x31aee6=function(_0x2a9887){return!_[_0x142f('0x64')]([_0x142f('0x65'),_0x142f('0x66'),_0x142f('0x67'),_0x142f('0x8b')],_0x2a9887);};var _0x321533=function(_0x275d66){if(!_0x275d66||!_0x275d66[_0x142f('0x68')][_0x142f('0x37')]){return'';}for(var _0x476f86='(',_0x9d34f1=0x0;_0x9d34f1<_0x275d66[_0x142f('0x68')]['length'];_0x9d34f1+=0x1){_0x9d34f1>0x0&&(_0x476f86+='\x20'+_0x275d66['operator']+'\x20');_0x476f86+=_0x275d66['rules'][_0x9d34f1][_0x142f('0x69')]?_0x321533(_0x275d66[_0x142f('0x68')][_0x9d34f1][_0x142f('0x69')]):_0x275d66['rules'][_0x9d34f1][_0x142f('0x6a')]+'\x20'+_0x275d66[_0x142f('0x68')][_0x9d34f1][_0x142f('0x6b')]+(_0x31aee6(_0x275d66['rules'][_0x9d34f1]['condition'])?'\x20'+_0x275d66[_0x142f('0x68')][_0x9d34f1][_0x142f('0x8d')]:'');}return _0x476f86+')';};var _0x114fca={'where':{'id':_0x13354e[_0x142f('0x48')]['id']}},_0x5ec65e,_0x4341c9,_0x57256f,_0x37295c,_0xb19b96;_0x114fca=_[_0x142f('0x6c')]({},_0x114fca,_0x13354e['options']);return db[_0x142f('0x2d')][_0x142f('0x49')](_0x114fca)[_0x142f('0x25')](function(_0x583e3e){if(_0x583e3e){_0x5ec65e=_0x583e3e;return _0x583e3e[_0x142f('0x6d')]();}return null;})[_0x142f('0x25')](function(_0x35e15f){if(_0x35e15f){if(!_0x35e15f['length']){throw new db[(_0x142f('0xa3'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4341c9=_0x35e15f;return db[_0x142f('0x70')][_0x142f('0x44')]({'raw':!![]});}return null;})[_0x142f('0x25')](function(_0x4e9029){if(_0x4e9029){_0x57256f=_[_0x142f('0x71')](_0x4e9029,'id');var _0x11cd9a;var _0x2c2233=squel[_0x142f('0x72')]();_0x2c2233[_0x142f('0xa4')](_0x5ec65e['table']);for(var _0x3684da=0x0;_0x3684da<_0x4341c9['length'];_0x3684da+=0x1){_0x11cd9a=_0x4341c9[_0x3684da][_0x142f('0x74')]?_0x57256f[_0x4341c9[_0x3684da][_0x142f('0x74')]]['metric']:_0x4341c9[_0x3684da][_0x142f('0x6a')];_0x11cd9a=_0x4341c9[_0x3684da]['function']?_[_0x142f('0x77')](_0x4266d1[_0x4341c9[_0x3684da]['function']],'%s',_0x11cd9a):_0x11cd9a;_0x11cd9a=_0x4341c9[_0x3684da]['format']?_[_0x142f('0x77')](_0x5bbb06[_0x4341c9[_0x3684da][_0x142f('0x78')]],'%s',_0x11cd9a):_0x11cd9a;if(_0x4341c9[_0x3684da]['groupBy']){_0x2c2233['group'](_0x11cd9a);}_0x4341c9[_0x3684da][_0x142f('0x7a')]&&_0x2c2233[_0x142f('0x3a')](_0x11cd9a,_0x4341c9[_0x3684da][_0x142f('0x7a')]==='DESC'?![]:!![]);_0x2c2233['field'](_0x11cd9a,_0x4341c9[_0x3684da]['alias']||_0x11cd9a);}if(_0x5ec65e[_0x142f('0x7d')]){_0x5ec65e[_0x142f('0x7d')]=JSON[_0x142f('0x7e')](_0x5ec65e[_0x142f('0x7d')]);for(var _0x59d6f4=0x0;_0x59d6f4<_0x5ec65e[_0x142f('0x7d')]['length'];_0x59d6f4+=0x1){if(_0x5ec65e[_0x142f('0x7d')][_0x59d6f4]['type']&&_[_0x142f('0x64')](_0x2e6e07,_0x5ec65e[_0x142f('0x7d')][_0x59d6f4][_0x142f('0x3f')])&&_0x5ec65e['joins'][_0x59d6f4]['parentKey']&&_0x5ec65e[_0x142f('0x7d')][_0x59d6f4]['foreignTable']&&_0x5ec65e[_0x142f('0x7d')][_0x59d6f4][_0x142f('0x81')]){_0x2c2233[_0x5ec65e[_0x142f('0x7d')][_0x59d6f4][_0x142f('0x3f')]](_0x5ec65e[_0x142f('0x7d')][_0x59d6f4][_0x142f('0x80')],null,util[_0x142f('0x78')](_0x142f('0x8e'),_0x5ec65e[_0x142f('0x73')],_0x5ec65e[_0x142f('0x7d')][_0x59d6f4]['parentKey'],_0x5ec65e[_0x142f('0x7d')][_0x59d6f4][_0x142f('0x80')],_0x5ec65e['joins'][_0x59d6f4][_0x142f('0x81')]));}}}if(_0x5ec65e[_0x142f('0x82')]){_0x5ec65e[_0x142f('0x82')]=JSON[_0x142f('0x7e')](_0x5ec65e['conditions']);_0x2c2233['where'](_0x321533(_0x5ec65e[_0x142f('0x82')][_0x142f('0x69')]));}_0xb19b96=_0x2c2233[_0x142f('0x83')]();_0x2c2233[_0x142f('0x1d')](_0x12ede6);_0x2c2233['offset'](0x0);logger[_0x142f('0x84')]('Limited\x20Query:',_0x2c2233['toString']());return dbH[_0x142f('0x87')][_0x142f('0x32')](_0x2c2233[_0x142f('0x86')](),{'type':dbH['sequelize'][_0x142f('0x88')][_0x142f('0xa0')]});}})[_0x142f('0x25')](function(){return{'sql':_0xb19b96[_0x142f('0x86')]()};})[_0x142f('0x25')](respondWithResult(_0x36879e,null))[_0x142f('0x46')](handleError(_0x36879e,null));}; \ No newline at end of file +var _0x9d6c=['mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','UserProfileResource','error','stack','name','index','map','AnalyticCustomReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','rows','catch','show','params','include','find','create','body','user','get','Reports','UserProfileSection','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','MAX(%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)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','rules','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','field','function','format','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','foreignKey','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','MIN(%s)','IS\x20NOT\x20NULL','clone','output','web','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','Run\x20Query:','child_process','fork','../../files/reports','countTable','COUNT(*)','run','runReport','cross_join','COUNT(%s)','UNIX_TIMESTAMP(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x2aab79,_0x525e45){var _0x24cc72=function(_0xc51247){while(--_0xc51247){_0x2aab79['push'](_0x2aab79['shift']());}};_0x24cc72(++_0x525e45);}(_0x9d6c,0x1ef));var _0xc9d6=function(_0x393e05,_0x40d0b2){_0x393e05=_0x393e05-0x0;var _0xab6ce8=_0x9d6c[_0x393e05];return _0xab6ce8;};'use strict';var emlformat=require(_0xc9d6('0x0'));var rimraf=require(_0xc9d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc9d6('0x2'));var rp=require(_0xc9d6('0x3'));var moment=require(_0xc9d6('0x4'));var BPromise=require(_0xc9d6('0x5'));var Mustache=require(_0xc9d6('0x6'));var util=require(_0xc9d6('0x7'));var path=require(_0xc9d6('0x8'));var sox=require(_0xc9d6('0x9'));var csv=require('to-csv');var ejs=require(_0xc9d6('0xa'));var fs=require('fs');var fs_extra=require(_0xc9d6('0xb'));var _=require(_0xc9d6('0xc'));var squel=require('squel');var crypto=require(_0xc9d6('0xd'));var jsforce=require(_0xc9d6('0xe'));var deskjs=require(_0xc9d6('0xf'));var toCsv=require(_0xc9d6('0x10'));var querystring=require(_0xc9d6('0x11'));var Papa=require(_0xc9d6('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc9d6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc9d6('0x14'))(_0xc9d6('0x15'));var utils=require(_0xc9d6('0x16'));var config=require(_0xc9d6('0x17'));var licenseUtil=require(_0xc9d6('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0xc9d6('0x19'))[_0xc9d6('0x1a')];function respondWithStatusCode(_0x1eda6b,_0x118241){_0x118241=_0x118241||0xcc;return function(_0x527465){if(_0x527465){return _0x1eda6b[_0xc9d6('0x1b')](_0x118241);}return _0x1eda6b['status'](_0x118241)[_0xc9d6('0x1c')]();};}function respondWithResult(_0x590b21,_0x164485){_0x164485=_0x164485||0xc8;return function(_0x14922e){if(_0x14922e){return _0x590b21[_0xc9d6('0x1d')](_0x164485)[_0xc9d6('0x1e')](_0x14922e);}};}function respondWithFilteredResult(_0x427742,_0x11b722){return function(_0x30304e){if(_0x30304e){var _0x5021f3=typeof _0x11b722[_0xc9d6('0x1f')]==='undefined'&&typeof _0x11b722[_0xc9d6('0x20')]===_0xc9d6('0x21');var _0x226058=_0x30304e[_0xc9d6('0x22')];var _0x3c2103=_0x5021f3?0x0:_0x11b722[_0xc9d6('0x1f')];var _0x133aab=_0x5021f3?_0x30304e['count']:_0x11b722['offset']+_0x11b722[_0xc9d6('0x20')];var _0x190c1e;if(_0x133aab>=_0x226058){_0x133aab=_0x226058;_0x190c1e=0xc8;}else{_0x190c1e=0xce;}_0x427742[_0xc9d6('0x1d')](_0x190c1e);return _0x427742[_0xc9d6('0x23')](_0xc9d6('0x24'),_0x3c2103+'-'+_0x133aab+'/'+_0x226058)[_0xc9d6('0x1e')](_0x30304e);}return null;};}function patchUpdates(_0x15c57c){return function(_0x539ee1){try{jsonpatch['apply'](_0x539ee1,_0x15c57c,!![]);}catch(_0x13e98e){return BPromise[_0xc9d6('0x25')](_0x13e98e);}return _0x539ee1['save']();};}function saveUpdates(_0x575482,_0x436f81){return function(_0x21b1b6){if(_0x21b1b6){return _0x21b1b6[_0xc9d6('0x26')](_0x575482)[_0xc9d6('0x27')](function(_0xec1714){return _0xec1714;});}return null;};}function removeEntity(_0x251515,_0x595d61){return function(_0x24112b){if(_0x24112b){return _0x24112b[_0xc9d6('0x28')]()[_0xc9d6('0x27')](function(){var _0x149ead=_0x24112b['get']({'plain':!![]});var _0x10de43='CustomReports';return db[_0xc9d6('0x29')][_0xc9d6('0x28')]({'where':{'type':_0x10de43,'resourceId':_0x149ead['id']}})[_0xc9d6('0x27')](function(){return _0x24112b;});})[_0xc9d6('0x27')](function(){_0x251515[_0xc9d6('0x1d')](0xcc)[_0xc9d6('0x1c')]();});}};}function handleEntityNotFound(_0x19eb8c,_0x12df0b){return function(_0x416689){if(!_0x416689){_0x19eb8c[_0xc9d6('0x1b')](0x194);}return _0x416689;};}function handleError(_0x535a48,_0x402996){_0x402996=_0x402996||0x1f4;return function(_0x5d101d){logger[_0xc9d6('0x2a')](_0x5d101d[_0xc9d6('0x2b')]);if(_0x5d101d[_0xc9d6('0x2c')]){delete _0x5d101d[_0xc9d6('0x2c')];}_0x535a48[_0xc9d6('0x1d')](_0x402996)['send'](_0x5d101d);};}exports[_0xc9d6('0x2d')]=function(_0x4bec3a,_0x4fc4a4){var _0x4635e5={},_0xc93ca0={},_0x4801d4={'count':0x0,'rows':[]};var _0x120dfd=_[_0xc9d6('0x2e')](db[_0xc9d6('0x2f')][_0xc9d6('0x30')],function(_0x3d3077){return{'name':_0x3d3077['fieldName'],'type':_0x3d3077[_0xc9d6('0x31')][_0xc9d6('0x32')]};});_0xc93ca0[_0xc9d6('0x33')]=_['map'](_0x120dfd,_0xc9d6('0x2c'));_0xc93ca0[_0xc9d6('0x34')]=_[_0xc9d6('0x35')](_0x4bec3a[_0xc9d6('0x34')]);_0xc93ca0[_0xc9d6('0x36')]=_['intersection'](_0xc93ca0[_0xc9d6('0x33')],_0xc93ca0['query']);_0x4635e5['attributes']=_[_0xc9d6('0x37')](_0xc93ca0[_0xc9d6('0x33')],qs[_0xc9d6('0x38')](_0x4bec3a[_0xc9d6('0x34')][_0xc9d6('0x38')]));_0x4635e5[_0xc9d6('0x39')]=_0x4635e5[_0xc9d6('0x39')][_0xc9d6('0x3a')]?_0x4635e5[_0xc9d6('0x39')]:_0xc93ca0[_0xc9d6('0x33')];if(!_0x4bec3a['query'][_0xc9d6('0x3b')](_0xc9d6('0x3c'))){_0x4635e5[_0xc9d6('0x20')]=qs['limit'](_0x4bec3a[_0xc9d6('0x34')]['limit']);_0x4635e5[_0xc9d6('0x1f')]=qs['offset'](_0x4bec3a[_0xc9d6('0x34')][_0xc9d6('0x1f')]);}_0x4635e5[_0xc9d6('0x3d')]=qs[_0xc9d6('0x3e')](_0x4bec3a['query'][_0xc9d6('0x3e')]);_0x4635e5[_0xc9d6('0x3f')]=qs[_0xc9d6('0x36')](_[_0xc9d6('0x40')](_0x4bec3a['query'],_0xc93ca0['filters']),_0x120dfd);if(_0x4bec3a[_0xc9d6('0x34')][_0xc9d6('0x41')]){_0x4635e5['where']=_['merge'](_0x4635e5['where'],{'$or':_[_0xc9d6('0x2e')](_0x120dfd,function(_0x2a6018){if(_0x2a6018['type']!=='VIRTUAL'){var _0x50d84f={};_0x50d84f[_0x2a6018[_0xc9d6('0x2c')]]={'$like':'%'+_0x4bec3a['query'][_0xc9d6('0x41')]+'%'};return _0x50d84f;}})});}_0x4635e5=_[_0xc9d6('0x42')]({},_0x4635e5,_0x4bec3a[_0xc9d6('0x43')]);var _0x2d069a={'where':_0x4635e5['where']};return db['AnalyticCustomReport']['count'](_0x2d069a)[_0xc9d6('0x27')](function(_0x34e54e){_0x4801d4['count']=_0x34e54e;if(_0x4bec3a[_0xc9d6('0x34')]['includeAll']){_0x4635e5['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xc9d6('0x44')](_0x4635e5);})[_0xc9d6('0x27')](function(_0x59638b){_0x4801d4[_0xc9d6('0x45')]=_0x59638b;return _0x4801d4;})[_0xc9d6('0x27')](respondWithFilteredResult(_0x4fc4a4,_0x4635e5))[_0xc9d6('0x46')](handleError(_0x4fc4a4,null));};exports[_0xc9d6('0x47')]=function(_0x18c79d,_0x258cca){var _0x138832={'raw':![],'where':{'id':_0x18c79d[_0xc9d6('0x48')]['id']}},_0x31dcc7={};_0x31dcc7[_0xc9d6('0x33')]=_[_0xc9d6('0x35')](db[_0xc9d6('0x2f')][_0xc9d6('0x30')]);_0x31dcc7[_0xc9d6('0x34')]=_['keys'](_0x18c79d[_0xc9d6('0x34')]);_0x31dcc7[_0xc9d6('0x36')]=_[_0xc9d6('0x37')](_0x31dcc7[_0xc9d6('0x33')],_0x31dcc7['query']);_0x138832[_0xc9d6('0x39')]=_[_0xc9d6('0x37')](_0x31dcc7[_0xc9d6('0x33')],qs[_0xc9d6('0x38')](_0x18c79d['query'][_0xc9d6('0x38')]));_0x138832[_0xc9d6('0x39')]=_0x138832[_0xc9d6('0x39')]['length']?_0x138832['attributes']:_0x31dcc7[_0xc9d6('0x33')];if(_0x18c79d[_0xc9d6('0x34')]['includeAll']){_0x138832[_0xc9d6('0x49')]=[{'all':!![]}];}_0x138832=_[_0xc9d6('0x42')]({},_0x138832,_0x18c79d['options']);return db[_0xc9d6('0x2f')][_0xc9d6('0x4a')](_0x138832)[_0xc9d6('0x27')](handleEntityNotFound(_0x258cca,null))[_0xc9d6('0x27')](respondWithResult(_0x258cca,null))[_0xc9d6('0x46')](handleError(_0x258cca,null));};exports['create']=function(_0x18ca7c,_0x1ce024){return db[_0xc9d6('0x2f')][_0xc9d6('0x4b')](_0x18ca7c[_0xc9d6('0x4c')],{})['then'](function(_0x4b88e4){var _0x38d0d0=_0x18ca7c[_0xc9d6('0x4d')][_0xc9d6('0x4e')]({'plain':!![]});if(!_0x38d0d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38d0d0['role']==='user'){var _0x2da72f=_0x4b88e4[_0xc9d6('0x4e')]({'plain':!![]});var _0x1ceebd=_0xc9d6('0x4f');return db[_0xc9d6('0x50')]['find']({'where':{'name':_0x1ceebd,'userProfileId':_0x38d0d0[_0xc9d6('0x51')]},'raw':!![]})[_0xc9d6('0x27')](function(_0x12dec6){if(_0x12dec6&&_0x12dec6[_0xc9d6('0x52')]===0x0){return db[_0xc9d6('0x29')][_0xc9d6('0x4b')]({'name':_0x2da72f['name'],'resourceId':_0x2da72f['id'],'type':_0xc9d6('0x53'),'sectionId':_0x12dec6['id']},{})[_0xc9d6('0x27')](function(){return _0x4b88e4;});}else{return _0x4b88e4;}})['catch'](function(_0x3b0c30){logger[_0xc9d6('0x2a')](_0xc9d6('0x54'),_0x3b0c30);throw _0x3b0c30;});}return _0x4b88e4;})['then'](respondWithResult(_0x1ce024,0xc9))[_0xc9d6('0x46')](handleError(_0x1ce024,null));};exports[_0xc9d6('0x26')]=function(_0x5c9403,_0x52c15e){if(_0x5c9403[_0xc9d6('0x4c')]['id']){delete _0x5c9403[_0xc9d6('0x4c')]['id'];}return db[_0xc9d6('0x2f')]['find']({'where':{'id':_0x5c9403['params']['id']}})['then'](handleEntityNotFound(_0x52c15e,null))[_0xc9d6('0x27')](saveUpdates(_0x5c9403[_0xc9d6('0x4c')],null))['then'](respondWithResult(_0x52c15e,null))[_0xc9d6('0x46')](handleError(_0x52c15e,null));};exports[_0xc9d6('0x28')]=function(_0x531791,_0x4815cd){return db['AnalyticCustomReport'][_0xc9d6('0x4a')]({'where':{'id':_0x531791[_0xc9d6('0x48')]['id']}})[_0xc9d6('0x27')](handleEntityNotFound(_0x4815cd,null))[_0xc9d6('0x27')](removeEntity(_0x4815cd,null))[_0xc9d6('0x46')](handleError(_0x4815cd,null));};exports[_0xc9d6('0x55')]=function(_0xd11868,_0x4d09cd){var _0x5bc66b=0xa;var _0x3d5935=[_0xc9d6('0x56'),_0xc9d6('0x57'),_0xc9d6('0x58'),'cross_join'];var _0x4bdf60={'SUM':_0xc9d6('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc9d6('0x5a'),'MIN':'MIN(%s)','AVG':_0xc9d6('0x5b'),'GROUP_CONCAT':_0xc9d6('0x5c'),'GROUP_CONCAT ASC':_0xc9d6('0x5d'),'GROUP_CONCAT DESC':_0xc9d6('0x5e')};var _0x36262d={'SEC_TO_TIME':_0xc9d6('0x5f'),'DATE':_0xc9d6('0x60'),'HOUR':_0xc9d6('0x61'),'ROUND':_0xc9d6('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x442e82=function(_0x344e68){return!_[_0xc9d6('0x63')]([_0xc9d6('0x64'),'IS\x20NOT\x20NULL',_0xc9d6('0x65'),_0xc9d6('0x66')],_0x344e68);};var _0x533791=function(_0x194e5b){if(!_0x194e5b||!_0x194e5b['rules'][_0xc9d6('0x3a')]){return'';}for(var _0x46d10c='(',_0x2742f7=0x0;_0x2742f7<_0x194e5b['rules']['length'];_0x2742f7+=0x1){_0x2742f7>0x0&&(_0x46d10c+='\x20'+_0x194e5b[_0xc9d6('0x67')]+'\x20');_0x46d10c+=_0x194e5b[_0xc9d6('0x68')][_0x2742f7][_0xc9d6('0x69')]?_0x533791(_0x194e5b['rules'][_0x2742f7]['group']):_0x194e5b[_0xc9d6('0x68')][_0x2742f7]['field']+'\x20'+_0x194e5b[_0xc9d6('0x68')][_0x2742f7][_0xc9d6('0x6a')]+(_0x442e82(_0x194e5b[_0xc9d6('0x68')][_0x2742f7][_0xc9d6('0x6a')])?'\x20'+_0x194e5b['rules'][_0x2742f7][_0xc9d6('0x6b')]:'');}return _0x46d10c+')';};var _0x1305d0={'where':{'id':_0xd11868['params']['id']}},_0x9152ff,_0x2fc434,_0x5b01f5,_0x179ebd,_0x4a19de;_0x1305d0=_[_0xc9d6('0x42')]({},_0x1305d0,_0xd11868[_0xc9d6('0x43')]);return db[_0xc9d6('0x2f')][_0xc9d6('0x4a')](_0x1305d0)[_0xc9d6('0x27')](function(_0x328fb6){if(_0x328fb6){_0x9152ff=_0x328fb6;return _0x328fb6[_0xc9d6('0x6c')]();}return null;})[_0xc9d6('0x27')](function(_0x1f504e){if(_0x1f504e){if(!_0x1f504e[_0xc9d6('0x3a')]){throw new db[(_0xc9d6('0x6d'))][(_0xc9d6('0x6e'))](_0xc9d6('0x6f'),0x193);}_0x2fc434=_0x1f504e;return db[_0xc9d6('0x70')][_0xc9d6('0x44')]({'raw':!![]});}return null;})[_0xc9d6('0x27')](function(_0x294670){if(_0x294670){_0x5b01f5=_[_0xc9d6('0x71')](_0x294670,'id');var _0x2d67fe;var _0x46cdac=squel[_0xc9d6('0x72')]();_0x46cdac[_0xc9d6('0x73')](_0x9152ff['table']);for(var _0x1584ba=0x0;_0x1584ba<_0x2fc434[_0xc9d6('0x3a')];_0x1584ba+=0x1){_0x2d67fe=_0x2fc434[_0x1584ba][_0xc9d6('0x74')]?_0x5b01f5[_0x2fc434[_0x1584ba][_0xc9d6('0x74')]][_0xc9d6('0x75')]:_0x2fc434[_0x1584ba][_0xc9d6('0x76')];_0x2d67fe=_0x2fc434[_0x1584ba][_0xc9d6('0x77')]?_['replace'](_0x4bdf60[_0x2fc434[_0x1584ba][_0xc9d6('0x77')]],'%s',_0x2d67fe):_0x2d67fe;_0x2d67fe=_0x2fc434[_0x1584ba][_0xc9d6('0x78')]?_[_0xc9d6('0x79')](_0x36262d[_0x2fc434[_0x1584ba][_0xc9d6('0x78')]],'%s',_0x2d67fe):_0x2d67fe;if(_0x2fc434[_0x1584ba][_0xc9d6('0x7a')]){_0x46cdac['group'](_0x2d67fe);}_0x2fc434[_0x1584ba]['orderBy']&&_0x46cdac[_0xc9d6('0x3d')](_0x2d67fe,_0x2fc434[_0x1584ba][_0xc9d6('0x7b')]===_0xc9d6('0x7c')?![]:!![]);_0x46cdac[_0xc9d6('0x76')](_0x2d67fe,_0x2fc434[_0x1584ba][_0xc9d6('0x7d')]||_0x2d67fe);}if(_0x9152ff['joins']){_0x9152ff[_0xc9d6('0x7e')]=JSON[_0xc9d6('0x7f')](_0x9152ff['joins']);for(var _0x322f24=0x0;_0x322f24<_0x9152ff[_0xc9d6('0x7e')][_0xc9d6('0x3a')];_0x322f24+=0x1){if(_0x9152ff['joins'][_0x322f24]['type']&&_[_0xc9d6('0x63')](_0x3d5935,_0x9152ff[_0xc9d6('0x7e')][_0x322f24][_0xc9d6('0x31')])&&_0x9152ff[_0xc9d6('0x7e')][_0x322f24][_0xc9d6('0x80')]&&_0x9152ff[_0xc9d6('0x7e')][_0x322f24][_0xc9d6('0x81')]&&_0x9152ff[_0xc9d6('0x7e')][_0x322f24]['foreignKey']){_0x46cdac[_0x9152ff[_0xc9d6('0x7e')][_0x322f24]['type']](_0x9152ff['joins'][_0x322f24]['foreignTable'],null,util['format'](_0xc9d6('0x82'),_0x9152ff[_0xc9d6('0x83')],_0x9152ff[_0xc9d6('0x7e')][_0x322f24][_0xc9d6('0x80')],_0x9152ff[_0xc9d6('0x7e')][_0x322f24][_0xc9d6('0x81')],_0x9152ff[_0xc9d6('0x7e')][_0x322f24][_0xc9d6('0x84')]));}}}if(_0x9152ff[_0xc9d6('0x85')]){_0x9152ff[_0xc9d6('0x85')]=JSON['parse'](_0x9152ff['conditions']);_0x46cdac['where'](_0x533791(_0x9152ff[_0xc9d6('0x85')][_0xc9d6('0x69')]));}_0x4a19de=_0x46cdac['clone']();_0x46cdac[_0xc9d6('0x20')](_0x5bc66b);_0x46cdac[_0xc9d6('0x1f')](0x0);logger[_0xc9d6('0x86')](_0xc9d6('0x87'),_0x46cdac[_0xc9d6('0x88')]());return dbH[_0xc9d6('0x89')][_0xc9d6('0x34')](_0x46cdac[_0xc9d6('0x88')](),{'type':dbH[_0xc9d6('0x89')][_0xc9d6('0x8a')][_0xc9d6('0x8b')]});}})[_0xc9d6('0x27')](respondWithResult(_0x4d09cd,null))[_0xc9d6('0x46')](handleError(_0x4d09cd,null));};function runReport(_0x4a3f36,_0x18a6b9,_0x37f7e6){var _0x4ca8c6=_0x18a6b9[_0xc9d6('0x2c')];var _0x15c70f=0xa;var _0x4c0365=['join','left_join',_0xc9d6('0x58'),'cross_join'];var _0x696d91={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc9d6('0x8c'),'MAX':_0xc9d6('0x5a'),'MIN':_0xc9d6('0x8d'),'AVG':_0xc9d6('0x5b'),'GROUP_CONCAT':_0xc9d6('0x5c'),'GROUP_CONCAT ASC':_0xc9d6('0x5d'),'GROUP_CONCAT DESC':_0xc9d6('0x5e')};var _0x3e8817={'SEC_TO_TIME':_0xc9d6('0x5f'),'DATE':_0xc9d6('0x60'),'HOUR':_0xc9d6('0x61'),'ROUND':_0xc9d6('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x50a4f0=function(_0x586432){return!_[_0xc9d6('0x63')]([_0xc9d6('0x64'),_0xc9d6('0x8e'),_0xc9d6('0x65'),_0xc9d6('0x66')],_0x586432);};var _0x4e5770=function(_0x2fc5b2){if(!_0x2fc5b2||!_0x2fc5b2['rules'][_0xc9d6('0x3a')]){return'';}for(var _0x2f4ab1='(',_0x5c2841=0x0;_0x5c2841<_0x2fc5b2[_0xc9d6('0x68')][_0xc9d6('0x3a')];_0x5c2841+=0x1){_0x5c2841>0x0&&(_0x2f4ab1+='\x20'+_0x2fc5b2[_0xc9d6('0x67')]+'\x20');_0x2f4ab1+=_0x2fc5b2[_0xc9d6('0x68')][_0x5c2841][_0xc9d6('0x69')]?_0x4e5770(_0x2fc5b2['rules'][_0x5c2841][_0xc9d6('0x69')]):_0x2fc5b2[_0xc9d6('0x68')][_0x5c2841][_0xc9d6('0x76')]+'\x20'+_0x2fc5b2[_0xc9d6('0x68')][_0x5c2841]['condition']+(_0x50a4f0(_0x2fc5b2[_0xc9d6('0x68')][_0x5c2841]['condition'])?'\x20'+_0x2fc5b2[_0xc9d6('0x68')][_0x5c2841][_0xc9d6('0x6b')]:'');}return _0x2f4ab1+')';};var _0x38a0e2={'where':{'id':_0x4a3f36['id']}},_0x246b89,_0x544f02,_0x5b99db,_0x373b79,_0x1d443b;_0x38a0e2=_[_0xc9d6('0x42')]({},_0x38a0e2,_0x37f7e6);return db['AnalyticCustomReport'][_0xc9d6('0x4a')](_0x38a0e2)[_0xc9d6('0x27')](function(_0x3cfafe){if(_0x3cfafe){_0x246b89=_0x3cfafe;return _0x3cfafe[_0xc9d6('0x6c')]();}return null;})['then'](function(_0x19a9c4){if(_0x19a9c4){if(!_0x19a9c4[_0xc9d6('0x3a')]){throw new db[(_0xc9d6('0x6d'))][(_0xc9d6('0x6e'))](_0xc9d6('0x6f'),0x193);}_0x544f02=_0x19a9c4;return db[_0xc9d6('0x70')][_0xc9d6('0x44')]({'raw':!![]});}return null;})[_0xc9d6('0x27')](function(_0xcb0df){if(_0xcb0df){_0x5b99db=_[_0xc9d6('0x71')](_0xcb0df,'id');var _0x2eca9c;var _0x325062=squel[_0xc9d6('0x72')]();_0x325062['from'](_0x246b89['table']);for(var _0x558500=0x0;_0x558500<_0x544f02[_0xc9d6('0x3a')];_0x558500+=0x1){_0x2eca9c=_0x544f02[_0x558500][_0xc9d6('0x74')]?_0x5b99db[_0x544f02[_0x558500][_0xc9d6('0x74')]]['metric']:_0x544f02[_0x558500][_0xc9d6('0x76')];_0x2eca9c=_0x544f02[_0x558500][_0xc9d6('0x77')]?_[_0xc9d6('0x79')](_0x696d91[_0x544f02[_0x558500]['function']],'%s',_0x2eca9c):_0x2eca9c;_0x2eca9c=_0x544f02[_0x558500]['format']?_[_0xc9d6('0x79')](_0x3e8817[_0x544f02[_0x558500][_0xc9d6('0x78')]],'%s',_0x2eca9c):_0x2eca9c;if(_0x544f02[_0x558500]['groupBy']){_0x325062[_0xc9d6('0x69')](_0x2eca9c);}_0x544f02[_0x558500][_0xc9d6('0x7b')]&&_0x325062['order'](_0x2eca9c,_0x544f02[_0x558500][_0xc9d6('0x7b')]===_0xc9d6('0x7c')?![]:!![]);_0x325062['field'](_0x2eca9c,_0x544f02[_0x558500][_0xc9d6('0x7d')]||_0x2eca9c);}if(_0x246b89[_0xc9d6('0x7e')]){_0x246b89['joins']=JSON['parse'](_0x246b89[_0xc9d6('0x7e')]);for(var _0x1af373=0x0;_0x1af373<_0x246b89[_0xc9d6('0x7e')][_0xc9d6('0x3a')];_0x1af373+=0x1){if(_0x246b89[_0xc9d6('0x7e')][_0x1af373][_0xc9d6('0x31')]&&_[_0xc9d6('0x63')](_0x4c0365,_0x246b89[_0xc9d6('0x7e')][_0x1af373][_0xc9d6('0x31')])&&_0x246b89[_0xc9d6('0x7e')][_0x1af373][_0xc9d6('0x80')]&&_0x246b89[_0xc9d6('0x7e')][_0x1af373][_0xc9d6('0x81')]&&_0x246b89[_0xc9d6('0x7e')][_0x1af373][_0xc9d6('0x84')]){_0x325062[_0x246b89[_0xc9d6('0x7e')][_0x1af373][_0xc9d6('0x31')]](_0x246b89['joins'][_0x1af373][_0xc9d6('0x81')],null,util[_0xc9d6('0x78')](_0xc9d6('0x82'),_0x246b89[_0xc9d6('0x83')],_0x246b89[_0xc9d6('0x7e')][_0x1af373][_0xc9d6('0x80')],_0x246b89[_0xc9d6('0x7e')][_0x1af373][_0xc9d6('0x81')],_0x246b89['joins'][_0x1af373][_0xc9d6('0x84')]));}}}if(_0x246b89[_0xc9d6('0x85')]){_0x246b89[_0xc9d6('0x85')]=JSON[_0xc9d6('0x7f')](_0x246b89[_0xc9d6('0x85')]);_0x325062[_0xc9d6('0x3f')](_0x4e5770(_0x246b89[_0xc9d6('0x85')][_0xc9d6('0x69')]));}_0x1d443b=_0x325062[_0xc9d6('0x8f')]();_0x325062['limit'](_0x15c70f);_0x325062[_0xc9d6('0x1f')](0x0);return;}})['then'](function(){if(_0x18a6b9[_0xc9d6('0x90')]===_0xc9d6('0x91')){return null;}var _0x33d19d=_['merge'](_0x18a6b9,{'name':_0x18a6b9['fullPath']||_0x18a6b9[_0xc9d6('0x2c')]||_0x246b89['name'],'basename':_0x4ca8c6,'savename':util[_0xc9d6('0x78')](_0xc9d6('0x92'),_0x18a6b9[_0xc9d6('0x2c')]||_0x246b89[_0xc9d6('0x2c')],require(_0xc9d6('0x93'))[_0xc9d6('0x94')](0x4),_0x18a6b9[_0xc9d6('0x90')]||_0xc9d6('0x95')),'reportId':_0x246b89['id'],'reportType':_0xc9d6('0x96')});return db[_0xc9d6('0x97')][_0xc9d6('0x4b')](_0x33d19d,{'raw':!![]});})[_0xc9d6('0x27')](function(_0xc1b8f3){if(_0x246b89[_0xc9d6('0x83')]===_0xc9d6('0x98')){_0x1d443b[_0xc9d6('0x3f')](_0x246b89['table']+_0xc9d6('0x99'),_0x18a6b9['startDate'],_0x18a6b9[_0xc9d6('0x9a')]);}else{_0x1d443b['where'](_0x246b89[_0xc9d6('0x83')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x18a6b9[_0xc9d6('0x9b')],_0x18a6b9[_0xc9d6('0x9a')]);}if(_0xc1b8f3){logger['info'](_0xc9d6('0x9c'),_0x1d443b[_0xc9d6('0x88')]());require(_0xc9d6('0x9d'))[_0xc9d6('0x9e')](path[_0xc9d6('0x56')](__dirname,'../../components/export/',_0xc1b8f3[_0xc9d6('0x90')]),[_0xc1b8f3['id'],_0x1d443b[_0xc9d6('0x88')](),path['join'](__dirname,_0xc9d6('0x9f'),_0xc1b8f3['savename']),_0x4ca8c6]);return _0xc1b8f3;}else{var _0x302e87=squel[_0xc9d6('0x72')]();_0x302e87['from']('('+_0x1d443b['toString']()+')',_0xc9d6('0xa0'));_0x302e87['field'](_0xc9d6('0xa1'),_0xc9d6('0x22'));_0x1d443b['limit'](_0x18a6b9['limit']||_0x15c70f);_0x1d443b['offset'](_0x18a6b9[_0xc9d6('0x1f')]||0x0);return dbH[_0xc9d6('0x89')]['query'](_0x302e87['toString'](),{'type':dbH[_0xc9d6('0x89')][_0xc9d6('0x8a')]['SELECT']})[_0xc9d6('0x27')](function(_0x567236){if(!_0x567236[_0xc9d6('0x3a')]){_0x373b79=0x0;}else{_0x373b79=_0x567236[0x0][_0xc9d6('0x22')]||0x0;}return dbH[_0xc9d6('0x89')][_0xc9d6('0x34')](_0x1d443b[_0xc9d6('0x88')](),{'type':dbH[_0xc9d6('0x89')][_0xc9d6('0x8a')]['SELECT']});})[_0xc9d6('0x27')](function(_0x16059b){return{'rows':_0x16059b||[],'count':_0x373b79};});}});}exports[_0xc9d6('0xa2')]=function(_0x15c1fc,_0x134fbe){return runReport(_0x15c1fc[_0xc9d6('0x48')],_0x15c1fc[_0xc9d6('0x34')],_0x15c1fc[_0xc9d6('0x43')])[_0xc9d6('0x27')](respondWithResult(_0x134fbe,null))[_0xc9d6('0x46')](handleError(_0x134fbe,null));};exports[_0xc9d6('0xa3')]=runReport;exports[_0xc9d6('0x34')]=function(_0x570d7a,_0x1ffecc){var _0x989493=0xa;var _0x1b238c=[_0xc9d6('0x56'),'left_join',_0xc9d6('0x58'),_0xc9d6('0xa4')];var _0x556312={'SUM':_0xc9d6('0x59'),'COUNT':_0xc9d6('0xa5'),'COUNT DISTINCT':_0xc9d6('0x8c'),'MAX':_0xc9d6('0x5a'),'MIN':_0xc9d6('0x8d'),'AVG':_0xc9d6('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc9d6('0x5d'),'GROUP_CONCAT DESC':_0xc9d6('0x5e')};var _0x24eae8={'SEC_TO_TIME':_0xc9d6('0x5f'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xc9d6('0x62'),'UNIX_TIMESTAMP':_0xc9d6('0xa6')};var _0x1861a7=function(_0x48cb7b){return!_[_0xc9d6('0x63')]([_0xc9d6('0x64'),_0xc9d6('0x8e'),_0xc9d6('0x65'),'IS\x20NOT\x20EMPTY'],_0x48cb7b);};var _0x3a2549=function(_0x240902){if(!_0x240902||!_0x240902[_0xc9d6('0x68')]['length']){return'';}for(var _0x5c84c6='(',_0x86338=0x0;_0x86338<_0x240902[_0xc9d6('0x68')][_0xc9d6('0x3a')];_0x86338+=0x1){_0x86338>0x0&&(_0x5c84c6+='\x20'+_0x240902['operator']+'\x20');_0x5c84c6+=_0x240902[_0xc9d6('0x68')][_0x86338]['group']?_0x3a2549(_0x240902[_0xc9d6('0x68')][_0x86338][_0xc9d6('0x69')]):_0x240902['rules'][_0x86338]['field']+'\x20'+_0x240902[_0xc9d6('0x68')][_0x86338][_0xc9d6('0x6a')]+(_0x1861a7(_0x240902[_0xc9d6('0x68')][_0x86338][_0xc9d6('0x6a')])?'\x20'+_0x240902[_0xc9d6('0x68')][_0x86338][_0xc9d6('0x6b')]:'');}return _0x5c84c6+')';};var _0x2432f1={'where':{'id':_0x570d7a[_0xc9d6('0x48')]['id']}},_0x2ebb2,_0x5434d4,_0x319867,_0x242525,_0x95a029;_0x2432f1=_['merge']({},_0x2432f1,_0x570d7a[_0xc9d6('0x43')]);return db[_0xc9d6('0x2f')]['find'](_0x2432f1)[_0xc9d6('0x27')](function(_0x44bc59){if(_0x44bc59){_0x2ebb2=_0x44bc59;return _0x44bc59[_0xc9d6('0x6c')]();}return null;})[_0xc9d6('0x27')](function(_0x4b4c98){if(_0x4b4c98){if(!_0x4b4c98[_0xc9d6('0x3a')]){throw new db[(_0xc9d6('0x6d'))]['ValidationErrorItem'](_0xc9d6('0x6f'),0x193);}_0x5434d4=_0x4b4c98;return db['AnalyticMetric'][_0xc9d6('0x44')]({'raw':!![]});}return null;})[_0xc9d6('0x27')](function(_0x108f08){if(_0x108f08){_0x319867=_[_0xc9d6('0x71')](_0x108f08,'id');var _0x1f6f18;var _0x3c0225=squel[_0xc9d6('0x72')]();_0x3c0225['from'](_0x2ebb2[_0xc9d6('0x83')]);for(var _0x1111a2=0x0;_0x1111a2<_0x5434d4['length'];_0x1111a2+=0x1){_0x1f6f18=_0x5434d4[_0x1111a2][_0xc9d6('0x74')]?_0x319867[_0x5434d4[_0x1111a2][_0xc9d6('0x74')]]['metric']:_0x5434d4[_0x1111a2]['field'];_0x1f6f18=_0x5434d4[_0x1111a2][_0xc9d6('0x77')]?_[_0xc9d6('0x79')](_0x556312[_0x5434d4[_0x1111a2][_0xc9d6('0x77')]],'%s',_0x1f6f18):_0x1f6f18;_0x1f6f18=_0x5434d4[_0x1111a2][_0xc9d6('0x78')]?_[_0xc9d6('0x79')](_0x24eae8[_0x5434d4[_0x1111a2][_0xc9d6('0x78')]],'%s',_0x1f6f18):_0x1f6f18;if(_0x5434d4[_0x1111a2][_0xc9d6('0x7a')]){_0x3c0225['group'](_0x1f6f18);}_0x5434d4[_0x1111a2][_0xc9d6('0x7b')]&&_0x3c0225[_0xc9d6('0x3d')](_0x1f6f18,_0x5434d4[_0x1111a2][_0xc9d6('0x7b')]===_0xc9d6('0x7c')?![]:!![]);_0x3c0225[_0xc9d6('0x76')](_0x1f6f18,_0x5434d4[_0x1111a2][_0xc9d6('0x7d')]||_0x1f6f18);}if(_0x2ebb2[_0xc9d6('0x7e')]){_0x2ebb2['joins']=JSON['parse'](_0x2ebb2[_0xc9d6('0x7e')]);for(var _0x2192e0=0x0;_0x2192e0<_0x2ebb2[_0xc9d6('0x7e')][_0xc9d6('0x3a')];_0x2192e0+=0x1){if(_0x2ebb2[_0xc9d6('0x7e')][_0x2192e0][_0xc9d6('0x31')]&&_[_0xc9d6('0x63')](_0x1b238c,_0x2ebb2['joins'][_0x2192e0][_0xc9d6('0x31')])&&_0x2ebb2['joins'][_0x2192e0]['parentKey']&&_0x2ebb2['joins'][_0x2192e0]['foreignTable']&&_0x2ebb2[_0xc9d6('0x7e')][_0x2192e0][_0xc9d6('0x84')]){_0x3c0225[_0x2ebb2[_0xc9d6('0x7e')][_0x2192e0][_0xc9d6('0x31')]](_0x2ebb2['joins'][_0x2192e0]['foreignTable'],null,util[_0xc9d6('0x78')](_0xc9d6('0x82'),_0x2ebb2[_0xc9d6('0x83')],_0x2ebb2['joins'][_0x2192e0]['parentKey'],_0x2ebb2[_0xc9d6('0x7e')][_0x2192e0]['foreignTable'],_0x2ebb2['joins'][_0x2192e0][_0xc9d6('0x84')]));}}}if(_0x2ebb2[_0xc9d6('0x85')]){_0x2ebb2[_0xc9d6('0x85')]=JSON['parse'](_0x2ebb2[_0xc9d6('0x85')]);_0x3c0225[_0xc9d6('0x3f')](_0x3a2549(_0x2ebb2[_0xc9d6('0x85')][_0xc9d6('0x69')]));}_0x95a029=_0x3c0225[_0xc9d6('0x8f')]();_0x3c0225['limit'](_0x989493);_0x3c0225['offset'](0x0);logger['debug'](_0xc9d6('0x87'),_0x3c0225[_0xc9d6('0x88')]());return dbH['sequelize'][_0xc9d6('0x34')](_0x3c0225[_0xc9d6('0x88')](),{'type':dbH[_0xc9d6('0x89')][_0xc9d6('0x8a')][_0xc9d6('0x8b')]});}})[_0xc9d6('0x27')](function(){return{'sql':_0x95a029[_0xc9d6('0x88')]()};})[_0xc9d6('0x27')](respondWithResult(_0x1ffecc,null))['catch'](handleError(_0x1ffecc,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 15b73d3..0651540 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 _0xbdd4=['lodash','util','../../config/logger','api','request-promise','path','rimraf','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport'];(function(_0x5f1bff,_0x3f20c8){var _0x1a7f2f=function(_0x501bb5){while(--_0x501bb5){_0x5f1bff['push'](_0x5f1bff['shift']());}};_0x1a7f2f(++_0x3f20c8);}(_0xbdd4,0xfd));var _0x4bdd=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xbdd4[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x4bdd('0x0'));var util=require(_0x4bdd('0x1'));var logger=require(_0x4bdd('0x2'))(_0x4bdd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4bdd('0x4'));var fs=require('fs');var path=require(_0x4bdd('0x5'));var rimraf=require(_0x4bdd('0x6'));var config=require('../../config/environment');var attributes=require(_0x4bdd('0x7'));module[_0x4bdd('0x8')]=function(_0x4c9a29,_0x4940df){return _0x4c9a29[_0x4bdd('0x9')](_0x4bdd('0xa'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6192=['bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','define','lodash','util','../../config/logger','api'];(function(_0x3a70a5,_0x41e3cc){var _0xba8fea=function(_0x1bac48){while(--_0x1bac48){_0x3a70a5['push'](_0x3a70a5['shift']());}};_0xba8fea(++_0x41e3cc);}(_0x6192,0x10a));var _0x2619=function(_0x20eaec,_0x10eec4){_0x20eaec=_0x20eaec-0x0;var _0x23624a=_0x6192[_0x20eaec];return _0x23624a;};'use strict';var _=require(_0x2619('0x0'));var util=require(_0x2619('0x1'));var logger=require(_0x2619('0x2'))(_0x2619('0x3'));var moment=require('moment');var BPromise=require(_0x2619('0x4'));var rp=require(_0x2619('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2619('0x6'));var config=require(_0x2619('0x7'));var attributes=require(_0x2619('0x8'));module['exports']=function(_0x5a0ccd,_0x239338){return _0x5a0ccd[_0x2619('0x9')]('AnalyticCustomReport',attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 0eab53b..da093f1 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 _0x2678=['request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x1838da,_0x39b4ff){var _0x26a0c9=function(_0xf7294b){while(--_0xf7294b){_0x1838da['push'](_0x1838da['shift']());}};_0x26a0c9(++_0x39b4ff);}(_0x2678,0x142));var _0x8267=function(_0x1d375c,_0x2ba963){_0x1d375c=_0x1d375c-0x0;var _0x24b3ee=_0x2678[_0x1d375c];return _0x24b3ee;};'use strict';var _=require(_0x8267('0x0'));var util=require(_0x8267('0x1'));var moment=require(_0x8267('0x2'));var BPromise=require(_0x8267('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8267('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8267('0x5'));var logger=require(_0x8267('0x6'))(_0x8267('0x7'));var config=require(_0x8267('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8267('0x9')][_0x8267('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a1e8d,_0x3c5638,_0x303483){return new BPromise(function(_0x2af25f,_0x1d8572){return client[_0x8267('0xb')](_0x4a1e8d,_0x303483)[_0x8267('0xc')](function(_0x519113){logger['info'](_0x8267('0xd'),_0x3c5638,'request\x20sent');logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x3c5638,_0x8267('0xe'),JSON['stringify'](_0x519113));if(_0x519113[_0x8267('0xf')]){if(_0x519113[_0x8267('0xf')][_0x8267('0x10')]===0x1f4){logger[_0x8267('0xf')](_0x8267('0xd'),_0x3c5638,_0x519113[_0x8267('0xf')][_0x8267('0x11')]);return _0x1d8572(_0x519113['error'][_0x8267('0x11')]);}logger[_0x8267('0xf')](_0x8267('0xd'),_0x3c5638,_0x519113[_0x8267('0xf')][_0x8267('0x11')]);return _0x2af25f(_0x519113[_0x8267('0xf')]['message']);}else{logger[_0x8267('0x12')](_0x8267('0xd'),_0x3c5638,_0x8267('0xe'));_0x2af25f(_0x519113[_0x8267('0x13')][_0x8267('0x11')]);}})[_0x8267('0x14')](function(_0x2b2ab8){logger[_0x8267('0xf')](_0x8267('0xd'),_0x3c5638,_0x2b2ab8);_0x1d8572(_0x2b2ab8);});});} \ No newline at end of file +var _0x2b23=['info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b23,0x1ae));var _0x32b2=function(_0x187ff2,_0x5e46c6){_0x187ff2=_0x187ff2-0x0;var _0x4fe229=_0x2b23[_0x187ff2];return _0x4fe229;};'use strict';var _=require('lodash');var util=require(_0x32b2('0x0'));var moment=require(_0x32b2('0x1'));var BPromise=require(_0x32b2('0x2'));var rs=require(_0x32b2('0x3'));var fs=require('fs');var Redis=require(_0x32b2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x32b2('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x32b2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x32b2('0x7')][_0x32b2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a81e8,_0x8f8755,_0x573b27){return new BPromise(function(_0x57ab5b,_0x4ae169){return client['request'](_0x2a81e8,_0x573b27)[_0x32b2('0x9')](function(_0x497a7c){logger[_0x32b2('0xa')](_0x32b2('0xb'),_0x8f8755,_0x32b2('0xc'));logger[_0x32b2('0xd')](_0x32b2('0xe'),_0x8f8755,_0x32b2('0xc'),JSON[_0x32b2('0xf')](_0x497a7c));if(_0x497a7c[_0x32b2('0x10')]){if(_0x497a7c[_0x32b2('0x10')][_0x32b2('0x11')]===0x1f4){logger[_0x32b2('0x10')](_0x32b2('0xb'),_0x8f8755,_0x497a7c[_0x32b2('0x10')][_0x32b2('0x12')]);return _0x4ae169(_0x497a7c[_0x32b2('0x10')][_0x32b2('0x12')]);}logger[_0x32b2('0x10')](_0x32b2('0xb'),_0x8f8755,_0x497a7c[_0x32b2('0x10')]['message']);return _0x57ab5b(_0x497a7c[_0x32b2('0x10')][_0x32b2('0x12')]);}else{logger['info'](_0x32b2('0xb'),_0x8f8755,'request\x20sent');_0x57ab5b(_0x497a7c['result'][_0x32b2('0x12')]);}})[_0x32b2('0x13')](function(_0x669b1f){logger[_0x32b2('0x10')](_0x32b2('0xb'),_0x8f8755,_0x669b1f);_0x4ae169(_0x669b1f);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 430fa16..244e6e8 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 _0x9c34=['destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','/:id','show','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete'];(function(_0xc1be49,_0xb8b977){var _0x249540=function(_0x4814c2){while(--_0x4814c2){_0xc1be49['push'](_0xc1be49['shift']());}};_0x249540(++_0xb8b977);}(_0x9c34,0x1dd));var _0x49c3=function(_0x51ead2,_0x2ce525){_0x51ead2=_0x51ead2-0x0;var _0x3147c6=_0x9c34[_0x51ead2];return _0x3147c6;};'use strict';var multer=require('multer');var util=require(_0x49c3('0x0'));var path=require('path');var timeout=require(_0x49c3('0x1'));var express=require(_0x49c3('0x2'));var router=express[_0x49c3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x49c3('0x4'));var interaction=require(_0x49c3('0x5'));var config=require(_0x49c3('0x6'));var controller=require(_0x49c3('0x7'));router['get']('/',auth[_0x49c3('0x8')](),controller[_0x49c3('0x9')]);router[_0x49c3('0xa')](_0x49c3('0xb'),auth[_0x49c3('0x8')](),controller[_0x49c3('0xc')]);router[_0x49c3('0xa')]('/:id/preview',auth[_0x49c3('0x8')](),controller[_0x49c3('0xd')]);router[_0x49c3('0xa')](_0x49c3('0xe'),auth[_0x49c3('0x8')](),controller[_0x49c3('0xf')]);router[_0x49c3('0xa')](_0x49c3('0x10'),auth[_0x49c3('0x8')](),controller[_0x49c3('0x11')]);router[_0x49c3('0x12')]('/',auth['isAuthenticated'](),controller[_0x49c3('0x13')]);router[_0x49c3('0x14')](_0x49c3('0xb'),auth['isAuthenticated'](),controller[_0x49c3('0x15')]);router[_0x49c3('0x16')]('/:id',auth[_0x49c3('0x8')](),controller[_0x49c3('0x17')]);module[_0x49c3('0x18')]=router; \ No newline at end of file +var _0x1881=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','show','preview','/:id/run','run','query','post','create','put','/:id','update','delete','multer','util','connect-timeout'];(function(_0x565876,_0x20b1ee){var _0x5b418d=function(_0x40156f){while(--_0x40156f){_0x565876['push'](_0x565876['shift']());}};_0x5b418d(++_0x20b1ee);}(_0x1881,0xcc));var _0x1188=function(_0x449158,_0x44e1b0){_0x449158=_0x449158-0x0;var _0x1f3c3a=_0x1881[_0x449158];return _0x1f3c3a;};'use strict';var multer=require(_0x1188('0x0'));var util=require(_0x1188('0x1'));var path=require('path');var timeout=require(_0x1188('0x2'));var express=require(_0x1188('0x3'));var router=express[_0x1188('0x4')]();var fs_extra=require(_0x1188('0x5'));var auth=require(_0x1188('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1188('0x7'));var controller=require(_0x1188('0x8'));router[_0x1188('0x9')]('/',auth[_0x1188('0xa')](),controller[_0x1188('0xb')]);router[_0x1188('0x9')]('/:id',auth[_0x1188('0xa')](),controller[_0x1188('0xc')]);router[_0x1188('0x9')]('/:id/preview',auth[_0x1188('0xa')](),controller[_0x1188('0xd')]);router[_0x1188('0x9')](_0x1188('0xe'),auth[_0x1188('0xa')](),controller[_0x1188('0xf')]);router['get']('/:id/query',auth['isAuthenticated'](),controller[_0x1188('0x10')]);router[_0x1188('0x11')]('/',auth['isAuthenticated'](),controller[_0x1188('0x12')]);router[_0x1188('0x13')](_0x1188('0x14'),auth[_0x1188('0xa')](),controller[_0x1188('0x15')]);router[_0x1188('0x16')](_0x1188('0x14'),auth[_0x1188('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 9381600..2e932b4 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 _0xf2ca=['STRING','TEXT','sequelize','exports'];(function(_0x21fc68,_0x459828){var _0x3561e1=function(_0x3dea77){while(--_0x3dea77){_0x21fc68['push'](_0x21fc68['shift']());}};_0x3561e1(++_0x459828);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xf2ca[_0x263a74];return _0x2aa86c;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'name':{'type':Sequelize[_0xaf2c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xaf2c('0x2')]},'table':{'type':Sequelize[_0xaf2c('0x2')]},'conditions':{'type':Sequelize[_0xaf2c('0x3')]},'joins':{'type':Sequelize[_0xaf2c('0x3')]}}; \ No newline at end of file +var _0xb138=['TEXT','sequelize','exports','STRING'];(function(_0x46d8f0,_0x209ce4){var _0x555acc=function(_0x43956){while(--_0x43956){_0x46d8f0['push'](_0x46d8f0['shift']());}};_0x555acc(++_0x209ce4);}(_0xb138,0x1dd));var _0x8b13=function(_0x13049d,_0x2e5330){_0x13049d=_0x13049d-0x0;var _0x5f5ae6=_0xb138[_0x13049d];return _0x5f5ae6;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'name':{'type':Sequelize[_0x8b13('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8b13('0x2')]},'parent':{'type':Sequelize[_0x8b13('0x2')]},'table':{'type':Sequelize[_0x8b13('0x2')]},'conditions':{'type':Sequelize[_0x8b13('0x3')]},'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 28d8d90..a3e700e 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 _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(_0x444ca4,_0x2aeb58){var _0x59e378=function(_0x2203fb){while(--_0x2203fb){_0x444ca4['push'](_0x444ca4['shift']());}};_0x59e378(++_0x2aeb58);}(_0x187d,0x93));var _0xd187=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x187d[_0x6131cd];return _0x47e916;};'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 +var _0x4975=['set','Content-Range','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','index','AnalyticDefaultReport','rawAttributes','type','key','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','body','role','user','Reports','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','SUM(%s)','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','joins','includes','parentKey','foreignKey','foreignTable','conditions','parse','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','HOUR(%s)','operator','Please\x20insert\x20at\x20least\x20one\x20field','alias','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','toString','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','cross_join','getFields','replace','clone','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x109ab8,_0x15bc16){var _0x3e5800=function(_0x54b55b){while(--_0x54b55b){_0x109ab8['push'](_0x109ab8['shift']());}};_0x3e5800(++_0x15bc16);}(_0x4975,0x86));var _0x5497=function(_0x1f0a0c,_0x255b53){_0x1f0a0c=_0x1f0a0c-0x0;var _0x2d482f=_0x4975[_0x1f0a0c];return _0x2d482f;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];var dbH=require(_0x5497('0x17'))[_0x5497('0x18')];function respondWithStatusCode(_0x984990,_0x747dc7){_0x747dc7=_0x747dc7||0xcc;return function(_0x365144){if(_0x365144){return _0x984990[_0x5497('0x19')](_0x747dc7);}return _0x984990[_0x5497('0x1a')](_0x747dc7)[_0x5497('0x1b')]();};}function respondWithResult(_0x1a4c74,_0x55f590){_0x55f590=_0x55f590||0xc8;return function(_0x11b0a9){if(_0x11b0a9){return _0x1a4c74['status'](_0x55f590)[_0x5497('0x1c')](_0x11b0a9);}};}function respondWithFilteredResult(_0x2bfd8a,_0x19e5f3){return function(_0x3ce50b){if(_0x3ce50b){var _0x37c18e=typeof _0x19e5f3[_0x5497('0x1d')]===_0x5497('0x1e')&&typeof _0x19e5f3['limit']==='undefined';var _0x3f4d20=_0x3ce50b[_0x5497('0x1f')];var _0x3a47fd=_0x37c18e?0x0:_0x19e5f3['offset'];var _0xbf1ba7=_0x37c18e?_0x3ce50b[_0x5497('0x1f')]:_0x19e5f3[_0x5497('0x1d')]+_0x19e5f3[_0x5497('0x20')];var _0x1b1b43;if(_0xbf1ba7>=_0x3f4d20){_0xbf1ba7=_0x3f4d20;_0x1b1b43=0xc8;}else{_0x1b1b43=0xce;}_0x2bfd8a[_0x5497('0x1a')](_0x1b1b43);return _0x2bfd8a[_0x5497('0x21')](_0x5497('0x22'),_0x3a47fd+'-'+_0xbf1ba7+'/'+_0x3f4d20)[_0x5497('0x1c')](_0x3ce50b);}return null;};}function patchUpdates(_0x3f54ef){return function(_0x186065){try{jsonpatch['apply'](_0x186065,_0x3f54ef,!![]);}catch(_0x720767){return BPromise['reject'](_0x720767);}return _0x186065[_0x5497('0x23')]();};}function saveUpdates(_0xd0868d,_0x44265c){return function(_0x2f587d){if(_0x2f587d){return _0x2f587d[_0x5497('0x24')](_0xd0868d)[_0x5497('0x25')](function(_0x5018fa){return _0x5018fa;});}return null;};}function removeEntity(_0x54043a,_0x1eefce){return function(_0x34b97f){if(_0x34b97f){return _0x34b97f[_0x5497('0x26')]()[_0x5497('0x25')](function(){var _0x5223b5=_0x34b97f[_0x5497('0x27')]({'plain':!![]});var _0x57268c=_0x5497('0x28');return db[_0x5497('0x29')][_0x5497('0x26')]({'where':{'type':_0x57268c,'resourceId':_0x5223b5['id']}})[_0x5497('0x25')](function(){return _0x34b97f;});})[_0x5497('0x25')](function(){_0x54043a[_0x5497('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4af5f4,_0x5406e2){return function(_0x583d06){if(!_0x583d06){_0x4af5f4['sendStatus'](0x194);}return _0x583d06;};}function handleError(_0x39a2b7,_0x48d146){_0x48d146=_0x48d146||0x1f4;return function(_0x5e9356){logger[_0x5497('0x2a')](_0x5e9356[_0x5497('0x2b')]);if(_0x5e9356[_0x5497('0x2c')]){delete _0x5e9356['name'];}_0x39a2b7['status'](_0x48d146)['send'](_0x5e9356);};}exports[_0x5497('0x2d')]=function(_0x471e0b,_0xf4c117){var _0x5b8f79={},_0x489f71={},_0x594866={'count':0x0,'rows':[]};var _0xa28dd8=_['map'](db[_0x5497('0x2e')][_0x5497('0x2f')],function(_0x77c575){return{'name':_0x77c575['fieldName'],'type':_0x77c575[_0x5497('0x30')][_0x5497('0x31')]};});_0x489f71['model']=_[_0x5497('0x32')](_0xa28dd8,_0x5497('0x2c'));_0x489f71[_0x5497('0x33')]=_['keys'](_0x471e0b[_0x5497('0x33')]);_0x489f71[_0x5497('0x34')]=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],_0x489f71[_0x5497('0x33')]);_0x5b8f79['attributes']=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],qs['fields'](_0x471e0b[_0x5497('0x33')][_0x5497('0x37')]));_0x5b8f79[_0x5497('0x38')]=_0x5b8f79[_0x5497('0x38')][_0x5497('0x39')]?_0x5b8f79[_0x5497('0x38')]:_0x489f71['model'];if(!_0x471e0b[_0x5497('0x33')]['hasOwnProperty'](_0x5497('0x3a'))){_0x5b8f79[_0x5497('0x20')]=qs[_0x5497('0x20')](_0x471e0b['query']['limit']);_0x5b8f79[_0x5497('0x1d')]=qs[_0x5497('0x1d')](_0x471e0b[_0x5497('0x33')][_0x5497('0x1d')]);}_0x5b8f79[_0x5497('0x3b')]=qs[_0x5497('0x3c')](_0x471e0b['query'][_0x5497('0x3c')]);_0x5b8f79[_0x5497('0x3d')]=qs[_0x5497('0x34')](_[_0x5497('0x3e')](_0x471e0b[_0x5497('0x33')],_0x489f71[_0x5497('0x34')]),_0xa28dd8);if(_0x471e0b[_0x5497('0x33')][_0x5497('0x3f')]){_0x5b8f79[_0x5497('0x3d')]=_['merge'](_0x5b8f79[_0x5497('0x3d')],{'$or':_[_0x5497('0x32')](_0xa28dd8,function(_0x1e9616){if(_0x1e9616[_0x5497('0x30')]!==_0x5497('0x40')){var _0xa5ebe6={};_0xa5ebe6[_0x1e9616[_0x5497('0x2c')]]={'$like':'%'+_0x471e0b['query'][_0x5497('0x3f')]+'%'};return _0xa5ebe6;}})});}_0x5b8f79=_[_0x5497('0x41')]({},_0x5b8f79,_0x471e0b[_0x5497('0x42')]);var _0x35993c={'where':_0x5b8f79[_0x5497('0x3d')]};return db[_0x5497('0x2e')][_0x5497('0x1f')](_0x35993c)['then'](function(_0x2137bd){_0x594866[_0x5497('0x1f')]=_0x2137bd;if(_0x471e0b[_0x5497('0x33')][_0x5497('0x43')]){_0x5b8f79[_0x5497('0x44')]=[{'all':!![]}];}return db[_0x5497('0x2e')][_0x5497('0x45')](_0x5b8f79);})[_0x5497('0x25')](function(_0x2021ae){_0x594866[_0x5497('0x46')]=_0x2021ae;return _0x594866;})['then'](respondWithFilteredResult(_0xf4c117,_0x5b8f79))[_0x5497('0x47')](handleError(_0xf4c117,null));};exports['show']=function(_0x40822a,_0x9fc24){var _0x26ef01={'raw':!![],'where':{'id':_0x40822a[_0x5497('0x48')]['id']}},_0x3602ec={};_0x3602ec['model']=_[_0x5497('0x49')](db[_0x5497('0x2e')]['rawAttributes']);_0x3602ec[_0x5497('0x33')]=_['keys'](_0x40822a[_0x5497('0x33')]);_0x3602ec['filters']=_[_0x5497('0x35')](_0x3602ec[_0x5497('0x36')],_0x3602ec[_0x5497('0x33')]);_0x26ef01[_0x5497('0x38')]=_[_0x5497('0x35')](_0x3602ec['model'],qs['fields'](_0x40822a['query']['fields']));_0x26ef01[_0x5497('0x38')]=_0x26ef01[_0x5497('0x38')][_0x5497('0x39')]?_0x26ef01[_0x5497('0x38')]:_0x3602ec[_0x5497('0x36')];if(_0x40822a[_0x5497('0x33')][_0x5497('0x43')]){_0x26ef01[_0x5497('0x44')]=[{'all':!![]}];}_0x26ef01=_[_0x5497('0x41')]({},_0x26ef01,_0x40822a['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x26ef01)[_0x5497('0x25')](handleEntityNotFound(_0x9fc24,null))['then'](respondWithResult(_0x9fc24,null))[_0x5497('0x47')](handleError(_0x9fc24,null));};exports['create']=function(_0x12ffbc,_0x31f1ba){return db[_0x5497('0x2e')]['create'](_0x12ffbc[_0x5497('0x4b')],{})[_0x5497('0x25')](function(_0x515c3e){var _0x3abc92=_0x12ffbc['user'][_0x5497('0x27')]({'plain':!![]});if(!_0x3abc92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3abc92[_0x5497('0x4c')]===_0x5497('0x4d')){var _0x26fd9f=_0x515c3e[_0x5497('0x27')]({'plain':!![]});var _0x25e80c=_0x5497('0x4e');return db[_0x5497('0x4f')][_0x5497('0x4a')]({'where':{'name':_0x25e80c,'userProfileId':_0x3abc92['userProfileId']},'raw':!![]})[_0x5497('0x25')](function(_0x5b2c22){if(_0x5b2c22&&_0x5b2c22['autoAssociation']===0x0){return db[_0x5497('0x29')][_0x5497('0x50')]({'name':_0x26fd9f['name'],'resourceId':_0x26fd9f['id'],'type':_0x5497('0x28'),'sectionId':_0x5b2c22['id']},{})[_0x5497('0x25')](function(){return _0x515c3e;});}else{return _0x515c3e;}})[_0x5497('0x47')](function(_0x3094c7){logger['error'](_0x5497('0x51'),_0x3094c7);throw _0x3094c7;});}return _0x515c3e;})['then'](respondWithResult(_0x31f1ba,0xc9))['catch'](handleError(_0x31f1ba,null));};exports[_0x5497('0x24')]=function(_0x33dd07,_0x2f7ec8){if(_0x33dd07['body']['id']){delete _0x33dd07['body']['id'];}return db[_0x5497('0x2e')]['find']({'where':{'id':_0x33dd07[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f7ec8,null))[_0x5497('0x25')](saveUpdates(_0x33dd07['body'],null))[_0x5497('0x25')](respondWithResult(_0x2f7ec8,null))[_0x5497('0x47')](handleError(_0x2f7ec8,null));};exports['destroy']=function(_0x418f17,_0x5dccfb){return db['AnalyticDefaultReport'][_0x5497('0x4a')]({'where':{'id':_0x418f17[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x5dccfb,null))[_0x5497('0x25')](removeEntity(_0x5dccfb,null))[_0x5497('0x47')](handleError(_0x5dccfb,null));};exports[_0x5497('0x52')]=function(_0x28b2a3,_0x3fca40){var _0x25c75e=0xa;var _0x590be7=[_0x5497('0x53'),'left_join','right_join','cross_join'];var _0x1f3965={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5497('0x56'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x25f349={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x425995=function(_0xc783ce){return!_['includes']([_0x5497('0x5e'),_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0xc783ce);};var _0x5823f6=function(_0x31271c){if(!_0x31271c||!_0x31271c[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x542bcf='(',_0x1ab48f=0x0;_0x1ab48f<_0x31271c['rules']['length'];_0x1ab48f+=0x1){_0x1ab48f>0x0&&(_0x542bcf+='\x20'+_0x31271c['operator']+'\x20');_0x542bcf+=_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x63')]?_0x5823f6(_0x31271c[_0x5497('0x62')][_0x1ab48f]['group']):_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x64')]+'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x65')]+(_0x425995(_0x31271c['rules'][_0x1ab48f][_0x5497('0x65')])?'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x66')]:'');}return _0x542bcf+')';};var _0x49617c={'where':{'id':_0x28b2a3[_0x5497('0x48')]['id']}},_0x164de1,_0x465bed,_0xb3eec2,_0x4368e3,_0x1467c4;_0x49617c=_[_0x5497('0x41')]({},_0x49617c,_0x28b2a3['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x49617c)[_0x5497('0x25')](function(_0x20efea){if(_0x20efea){_0x164de1=_0x20efea;return _0x20efea['getFields']();}return null;})['then'](function(_0x4a7360){if(_0x4a7360){if(!_0x4a7360[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x465bed=_0x4a7360;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x464df3){if(_0x464df3){_0xb3eec2=_[_0x5497('0x6a')](_0x464df3,'id');var _0x4338d4;var _0x3f38bf=squel[_0x5497('0x6b')]();_0x3f38bf[_0x5497('0x6c')](_0x164de1[_0x5497('0x6d')]);for(var _0x1fc6ad=0x0;_0x1fc6ad<_0x465bed['length'];_0x1fc6ad+=0x1){_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x6e')]?_0xb3eec2[_0x465bed[_0x1fc6ad][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x465bed[_0x1fc6ad]['field'];_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x70')]?_['replace'](_0x1f3965[_0x465bed[_0x1fc6ad][_0x5497('0x70')]],'%s',_0x4338d4):_0x4338d4;_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x71')]?_['replace'](_0x25f349[_0x465bed[_0x1fc6ad][_0x5497('0x71')]],'%s',_0x4338d4):_0x4338d4;if(_0x465bed[_0x1fc6ad][_0x5497('0x72')]){_0x3f38bf[_0x5497('0x63')](_0x4338d4);}_0x465bed[_0x1fc6ad][_0x5497('0x73')]&&_0x3f38bf['order'](_0x4338d4,_0x465bed[_0x1fc6ad][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x3f38bf[_0x5497('0x64')](_0x4338d4,_0x465bed[_0x1fc6ad]['alias']||_0x4338d4);}if(_0x164de1[_0x5497('0x75')]){_0x164de1[_0x5497('0x75')]=JSON['parse'](_0x164de1[_0x5497('0x75')]);for(var _0xebe694=0x0;_0xebe694<_0x164de1[_0x5497('0x75')]['length'];_0xebe694+=0x1){if(_0x164de1['joins'][_0xebe694][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x590be7,_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x30')])&&_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x77')]&&_0x164de1[_0x5497('0x75')][_0xebe694]['foreignTable']&&_0x164de1['joins'][_0xebe694][_0x5497('0x78')]){_0x3f38bf[_0x164de1[_0x5497('0x75')][_0xebe694]['type']](_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],null,util[_0x5497('0x71')]('%s.%s\x20=\x20%s.%s',_0x164de1[_0x5497('0x6d')],_0x164de1[_0x5497('0x75')][_0xebe694]['parentKey'],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x78')]));}}}if(_0x164de1[_0x5497('0x7a')]){_0x164de1['conditions']=JSON[_0x5497('0x7b')](_0x164de1[_0x5497('0x7a')]);_0x3f38bf[_0x5497('0x3d')](_0x5823f6(_0x164de1[_0x5497('0x7a')][_0x5497('0x63')]));}_0x1467c4=_0x3f38bf['clone']();_0x3f38bf[_0x5497('0x20')](_0x25c75e);_0x3f38bf[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')](_0x5497('0x7d'),_0x3f38bf['toString']());return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x3f38bf['toString'](),{'type':dbH[_0x5497('0x7e')][_0x5497('0x7f')][_0x5497('0x80')]});}})[_0x5497('0x25')](respondWithResult(_0x3fca40,null))['catch'](handleError(_0x3fca40,null));};function runReport(_0x547de7,_0x4ff64f,_0x5343d5){var _0x594761=_0x4ff64f[_0x5497('0x2c')];var _0x2375cc=0xa;var _0x15d0da=[_0x5497('0x53'),_0x5497('0x81'),'right_join','cross_join'];var _0x392987={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x4c41c4={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x22b019=function(_0x4aa4ba){return!_[_0x5497('0x76')](['IS\x20NULL',_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0x4aa4ba);};var _0x5b0f9d=function(_0x59960b){if(!_0x59960b||!_0x59960b[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x953b31='(',_0xeb52c9=0x0;_0xeb52c9<_0x59960b[_0x5497('0x62')][_0x5497('0x39')];_0xeb52c9+=0x1){_0xeb52c9>0x0&&(_0x953b31+='\x20'+_0x59960b[_0x5497('0x86')]+'\x20');_0x953b31+=_0x59960b[_0x5497('0x62')][_0xeb52c9]['group']?_0x5b0f9d(_0x59960b['rules'][_0xeb52c9]['group']):_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x64')]+'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x65')]+(_0x22b019(_0x59960b['rules'][_0xeb52c9]['condition'])?'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x66')]:'');}return _0x953b31+')';};var _0x5dd9bc={'where':{'id':_0x547de7['id']}},_0x83b240,_0x2fc11a,_0x3ce2ee,_0x36c09f,_0x51e9fb;_0x5dd9bc=_['merge']({},_0x5dd9bc,_0x5343d5);return db['AnalyticDefaultReport']['find'](_0x5dd9bc)['then'](function(_0x497295){if(_0x497295){_0x83b240=_0x497295;return _0x497295['getFields']();}return null;})[_0x5497('0x25')](function(_0x5aa5e1){if(_0x5aa5e1){if(!_0x5aa5e1[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))](_0x5497('0x87'),0x193);}_0x2fc11a=_0x5aa5e1;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})['then'](function(_0x77d52c){if(_0x77d52c){_0x3ce2ee=_['keyBy'](_0x77d52c,'id');var _0x15a67d;var _0x2721b2=squel[_0x5497('0x6b')]();_0x2721b2[_0x5497('0x6c')](_0x83b240[_0x5497('0x6d')]);for(var _0x38fa59=0x0;_0x38fa59<_0x2fc11a[_0x5497('0x39')];_0x38fa59+=0x1){_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x6e')]?_0x3ce2ee[_0x2fc11a[_0x38fa59][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x2fc11a[_0x38fa59]['field'];_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x70')]?_['replace'](_0x392987[_0x2fc11a[_0x38fa59][_0x5497('0x70')]],'%s',_0x15a67d):_0x15a67d;_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x71')]?_['replace'](_0x4c41c4[_0x2fc11a[_0x38fa59][_0x5497('0x71')]],'%s',_0x15a67d):_0x15a67d;if(_0x2fc11a[_0x38fa59][_0x5497('0x72')]){_0x2721b2[_0x5497('0x63')](_0x15a67d);}_0x2fc11a[_0x38fa59][_0x5497('0x73')]&&_0x2721b2[_0x5497('0x3b')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x2721b2[_0x5497('0x64')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x88')]||_0x15a67d);}if(_0x83b240[_0x5497('0x75')]){_0x83b240[_0x5497('0x75')]=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x75')]);for(var _0x22426e=0x0;_0x22426e<_0x83b240['joins'][_0x5497('0x39')];_0x22426e+=0x1){if(_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x15d0da,_0x83b240[_0x5497('0x75')][_0x22426e]['type'])&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')]&&_0x83b240['joins'][_0x22426e]['foreignTable']&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]){_0x2721b2[_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]](_0x83b240[_0x5497('0x75')][_0x22426e]['foreignTable'],null,util['format'](_0x5497('0x89'),_0x83b240['table'],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x79')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]));}}}if(_0x83b240['conditions']){_0x83b240['conditions']=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x7a')]);_0x2721b2[_0x5497('0x3d')](_0x5b0f9d(_0x83b240['conditions'][_0x5497('0x63')]));}_0x51e9fb=_0x2721b2['clone']();_0x2721b2[_0x5497('0x20')](_0x2375cc);_0x2721b2['offset'](0x0);return;}})['then'](function(){if(_0x4ff64f[_0x5497('0x8a')]===_0x5497('0x8b')){return null;}var _0x4ce768=_[_0x5497('0x41')](_0x4ff64f,{'name':_0x4ff64f[_0x5497('0x8c')]||_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],'basename':_0x594761,'savename':util['format'](_0x5497('0x8d'),_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],require(_0x5497('0x8e'))[_0x5497('0x8f')](0x4),_0x4ff64f['output']||_0x5497('0x90')),'reportId':_0x83b240['id'],'reportType':'default'});return db[_0x5497('0x91')][_0x5497('0x50')](_0x4ce768,{'raw':!![]});})[_0x5497('0x25')](function(_0x314db4){if(_0x83b240[_0x5497('0x6d')]===_0x5497('0x92')){_0x51e9fb[_0x5497('0x3d')](_0x83b240[_0x5497('0x6d')]+_0x5497('0x93'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}else{_0x51e9fb['where'](_0x83b240[_0x5497('0x6d')]+_0x5497('0x96'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}if(_0x314db4){logger[_0x5497('0x97')](_0x5497('0x98'),_0x51e9fb[_0x5497('0x99')]());require(_0x5497('0x9a'))[_0x5497('0x9b')](path[_0x5497('0x53')](__dirname,_0x5497('0x9c'),_0x314db4['output']),[_0x314db4['id'],_0x51e9fb[_0x5497('0x99')](),path[_0x5497('0x53')](__dirname,_0x5497('0x9d'),_0x314db4[_0x5497('0x9e')]),_0x594761]);return _0x314db4;}else{var _0x46be08=squel[_0x5497('0x6b')]();_0x46be08[_0x5497('0x6c')]('('+_0x51e9fb[_0x5497('0x99')]()+')',_0x5497('0x9f'));_0x46be08[_0x5497('0x64')](_0x5497('0xa0'),_0x5497('0x1f'));_0x51e9fb[_0x5497('0x20')](_0x4ff64f[_0x5497('0x20')]||_0x2375cc);_0x51e9fb['offset'](_0x4ff64f['offset']||0x0);return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x46be08[_0x5497('0x99')](),{'type':dbH['sequelize'][_0x5497('0x7f')][_0x5497('0x80')]})[_0x5497('0x25')](function(_0x2bd48c){if(!_0x2bd48c[_0x5497('0x39')]){_0x36c09f=0x0;}else{_0x36c09f=_0x2bd48c[0x0][_0x5497('0x1f')]||0x0;}return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x51e9fb['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5497('0x80')]});})[_0x5497('0x25')](function(_0x4dab6a){return{'rows':_0x4dab6a||[],'count':_0x36c09f};});}});}exports[_0x5497('0xa1')]=function(_0x27f42b,_0x1bef85){return runReport(_0x27f42b['params'],_0x27f42b[_0x5497('0x33')],_0x27f42b['options'])[_0x5497('0x25')](respondWithResult(_0x1bef85,null))[_0x5497('0x47')](handleError(_0x1bef85,null));};exports[_0x5497('0xa2')]=runReport;exports['query']=function(_0x1c3dad,_0xfba062){var _0x494cc3=0xa;var _0x401f04=[_0x5497('0x53'),_0x5497('0x81'),'right_join',_0x5497('0xa3')];var _0x1a5c32={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x1dfb76={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x5c2517=function(_0x367929){return!_[_0x5497('0x76')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5497('0x60'),_0x5497('0x61')],_0x367929);};var _0x2fd2e3=function(_0x2fe770){if(!_0x2fe770||!_0x2fe770['rules'][_0x5497('0x39')]){return'';}for(var _0x1299cd='(',_0x4c2b14=0x0;_0x4c2b14<_0x2fe770['rules'][_0x5497('0x39')];_0x4c2b14+=0x1){_0x4c2b14>0x0&&(_0x1299cd+='\x20'+_0x2fe770[_0x5497('0x86')]+'\x20');_0x1299cd+=_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x63')]?_0x2fd2e3(_0x2fe770[_0x5497('0x62')][_0x4c2b14]['group']):_0x2fe770['rules'][_0x4c2b14][_0x5497('0x64')]+'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14]['condition']+(_0x5c2517(_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x65')])?'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x66')]:'');}return _0x1299cd+')';};var _0x358ec5={'where':{'id':_0x1c3dad['params']['id']}},_0x5cddbc,_0x188d21,_0xf92129,_0x2d5cc1,_0x4f9228;_0x358ec5=_[_0x5497('0x41')]({},_0x358ec5,_0x1c3dad[_0x5497('0x42')]);return db[_0x5497('0x2e')]['find'](_0x358ec5)[_0x5497('0x25')](function(_0x30a248){if(_0x30a248){_0x5cddbc=_0x30a248;return _0x30a248[_0x5497('0xa4')]();}return null;})['then'](function(_0x1d4c76){if(_0x1d4c76){if(!_0x1d4c76[_0x5497('0x39')]){throw new db['Sequelize']['ValidationErrorItem'](_0x5497('0x87'),0x193);}_0x188d21=_0x1d4c76;return db[_0x5497('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x5001d5){if(_0x5001d5){_0xf92129=_[_0x5497('0x6a')](_0x5001d5,'id');var _0x2c58e6;var _0x300f3e=squel[_0x5497('0x6b')]();_0x300f3e[_0x5497('0x6c')](_0x5cddbc[_0x5497('0x6d')]);for(var _0x23732d=0x0;_0x23732d<_0x188d21['length'];_0x23732d+=0x1){_0x2c58e6=_0x188d21[_0x23732d]['MetricId']?_0xf92129[_0x188d21[_0x23732d][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x188d21[_0x23732d]['field'];_0x2c58e6=_0x188d21[_0x23732d]['function']?_[_0x5497('0xa5')](_0x1a5c32[_0x188d21[_0x23732d][_0x5497('0x70')]],'%s',_0x2c58e6):_0x2c58e6;_0x2c58e6=_0x188d21[_0x23732d][_0x5497('0x71')]?_[_0x5497('0xa5')](_0x1dfb76[_0x188d21[_0x23732d][_0x5497('0x71')]],'%s',_0x2c58e6):_0x2c58e6;if(_0x188d21[_0x23732d][_0x5497('0x72')]){_0x300f3e['group'](_0x2c58e6);}_0x188d21[_0x23732d][_0x5497('0x73')]&&_0x300f3e[_0x5497('0x3b')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x300f3e[_0x5497('0x64')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x88')]||_0x2c58e6);}if(_0x5cddbc['joins']){_0x5cddbc[_0x5497('0x75')]=JSON['parse'](_0x5cddbc[_0x5497('0x75')]);for(var _0x261804=0x0;_0x261804<_0x5cddbc[_0x5497('0x75')]['length'];_0x261804+=0x1){if(_0x5cddbc[_0x5497('0x75')][_0x261804]['type']&&_['includes'](_0x401f04,_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')])&&_0x5cddbc['joins'][_0x261804][_0x5497('0x77')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]){_0x300f3e[_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')]](_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],null,util['format'](_0x5497('0x89'),_0x5cddbc[_0x5497('0x6d')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x77')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]));}}}if(_0x5cddbc[_0x5497('0x7a')]){_0x5cddbc[_0x5497('0x7a')]=JSON[_0x5497('0x7b')](_0x5cddbc[_0x5497('0x7a')]);_0x300f3e[_0x5497('0x3d')](_0x2fd2e3(_0x5cddbc[_0x5497('0x7a')][_0x5497('0x63')]));}_0x4f9228=_0x300f3e[_0x5497('0xa6')]();_0x300f3e[_0x5497('0x20')](_0x494cc3);_0x300f3e[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')]('Limited\x20Query:',_0x300f3e[_0x5497('0x99')]());return dbH[_0x5497('0x7e')]['query'](_0x300f3e['toString'](),{'type':dbH[_0x5497('0x7e')]['QueryTypes'][_0x5497('0x80')]});}})[_0x5497('0x25')](function(){return{'sql':_0x4f9228[_0x5497('0x99')]()};})[_0x5497('0x25')](respondWithResult(_0xfba062,null))[_0x5497('0x47')](handleError(_0xfba062,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 8a1f1bd..9620066 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 _0x50e2=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x50e2,0xa6));var _0x250e=function(_0x3446af,_0x3b2f92){_0x3446af=_0x3446af-0x0;var _0x252b14=_0x50e2[_0x3446af];return _0x252b14;};'use strict';var _=require(_0x250e('0x0'));var util=require(_0x250e('0x1'));var logger=require(_0x250e('0x2'))(_0x250e('0x3'));var moment=require(_0x250e('0x4'));var BPromise=require(_0x250e('0x5'));var rp=require(_0x250e('0x6'));var fs=require('fs');var path=require(_0x250e('0x7'));var rimraf=require(_0x250e('0x8'));var config=require(_0x250e('0x9'));var attributes=require('./analyticDefaultReport.attributes');module[_0x250e('0xa')]=function(_0x3e5b61,_0x29c6df){return _0x3e5b61[_0x250e('0xb')](_0x250e('0xc'),attributes,{'tableName':_0x250e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9781=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9781,0x1ea));var _0x1978=function(_0x30c649,_0x2ebbac){_0x30c649=_0x30c649-0x0;var _0x3edfb9=_0x9781[_0x30c649];return _0x3edfb9;};'use strict';var _=require(_0x1978('0x0'));var util=require(_0x1978('0x1'));var logger=require(_0x1978('0x2'))(_0x1978('0x3'));var moment=require(_0x1978('0x4'));var BPromise=require(_0x1978('0x5'));var rp=require(_0x1978('0x6'));var fs=require('fs');var path=require(_0x1978('0x7'));var rimraf=require(_0x1978('0x8'));var config=require(_0x1978('0x9'));var attributes=require(_0x1978('0xa'));module[_0x1978('0xb')]=function(_0x4495e6,_0x508651){return _0x4495e6[_0x1978('0xc')](_0x1978('0xd'),attributes,{'tableName':_0x1978('0xe'),'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 eb748e6..91c835b 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 _0x6d72=['AnalyticDefaultReport,\x20%s,\x20%s','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x3ed6a0,_0x2ae908){var _0x44b55e=function(_0x3bc866){while(--_0x3bc866){_0x3ed6a0['push'](_0x3ed6a0['shift']());}};_0x44b55e(++_0x2ae908);}(_0x6d72,0x10f));var _0x26d7=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x6d72[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x26d7('0x0'));var util=require(_0x26d7('0x1'));var moment=require(_0x26d7('0x2'));var BPromise=require(_0x26d7('0x3'));var rs=require(_0x26d7('0x4'));var fs=require('fs');var Redis=require(_0x26d7('0x5'));var db=require(_0x26d7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x26d7('0x7'))(_0x26d7('0x8'));var config=require(_0x26d7('0x9'));var jayson=require(_0x26d7('0xa'));var client=jayson['client'][_0x26d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb9584f,_0x30f6b3,_0x36211f){return new BPromise(function(_0x4c4962,_0x3aa340){return client[_0x26d7('0xc')](_0xb9584f,_0x36211f)[_0x26d7('0xd')](function(_0x53c5cb){logger[_0x26d7('0xe')](_0x26d7('0xf'),_0x30f6b3,'request\x20sent');logger[_0x26d7('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x30f6b3,'request\x20sent',JSON[_0x26d7('0x11')](_0x53c5cb));if(_0x53c5cb[_0x26d7('0x12')]){if(_0x53c5cb[_0x26d7('0x12')][_0x26d7('0x13')]===0x1f4){logger[_0x26d7('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x30f6b3,_0x53c5cb['error'][_0x26d7('0x14')]);return _0x3aa340(_0x53c5cb['error']['message']);}logger[_0x26d7('0x12')](_0x26d7('0xf'),_0x30f6b3,_0x53c5cb[_0x26d7('0x12')][_0x26d7('0x14')]);return _0x4c4962(_0x53c5cb[_0x26d7('0x12')][_0x26d7('0x14')]);}else{logger[_0x26d7('0xe')](_0x26d7('0xf'),_0x30f6b3,'request\x20sent');_0x4c4962(_0x53c5cb[_0x26d7('0x15')][_0x26d7('0x14')]);}})['catch'](function(_0x4b1937){logger[_0x26d7('0x12')](_0x26d7('0xf'),_0x30f6b3,_0x4b1937);_0x3aa340(_0x4b1937);});});} \ No newline at end of file +var _0x9e88=['../../config/utils','../../config/logger','../../config/environment','http','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','message','AnalyticDefaultReport,\x20%s,\x20%s','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x2f6e8e,_0x25ef69){var _0x3b4332=function(_0x144100){while(--_0x144100){_0x2f6e8e['push'](_0x2f6e8e['shift']());}};_0x3b4332(++_0x25ef69);}(_0x9e88,0x15b));var _0x89e8=function(_0x124d23,_0x3351d9){_0x124d23=_0x124d23-0x0;var _0x15b24d=_0x9e88[_0x124d23];return _0x15b24d;};'use strict';var _=require(_0x89e8('0x0'));var util=require('util');var moment=require(_0x89e8('0x1'));var BPromise=require('bluebird');var rs=require(_0x89e8('0x2'));var fs=require('fs');var Redis=require(_0x89e8('0x3'));var db=require(_0x89e8('0x4'))['db'];var utils=require(_0x89e8('0x5'));var logger=require(_0x89e8('0x6'))('rpc');var config=require(_0x89e8('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x89e8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11cc7a,_0x5d056e,_0x177c4d){return new BPromise(function(_0x5d7039,_0x5e77df){return client['request'](_0x11cc7a,_0x177c4d)['then'](function(_0x2a8e1d){logger[_0x89e8('0x9')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5d056e,_0x89e8('0xa'));logger[_0x89e8('0xb')](_0x89e8('0xc'),_0x5d056e,_0x89e8('0xa'),JSON['stringify'](_0x2a8e1d));if(_0x2a8e1d['error']){if(_0x2a8e1d[_0x89e8('0xd')]['code']===0x1f4){logger[_0x89e8('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5d056e,_0x2a8e1d[_0x89e8('0xd')][_0x89e8('0xe')]);return _0x5e77df(_0x2a8e1d[_0x89e8('0xd')][_0x89e8('0xe')]);}logger[_0x89e8('0xd')](_0x89e8('0xf'),_0x5d056e,_0x2a8e1d[_0x89e8('0xd')][_0x89e8('0xe')]);return _0x5d7039(_0x2a8e1d[_0x89e8('0xd')][_0x89e8('0xe')]);}else{logger[_0x89e8('0x9')](_0x89e8('0xf'),_0x5d056e,_0x89e8('0xa'));_0x5d7039(_0x2a8e1d['result']['message']);}})['catch'](function(_0x89fb20){logger[_0x89e8('0xd')](_0x89e8('0xf'),_0x5d056e,_0x89fb20);_0x5e77df(_0x89fb20);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 094fc27..74b163b 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 _0xcf3e=['post','create','update','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','./analyticDefaultReport.controller','isAuthenticated','get','show','/:id/preview','/:id/run','run','/:id/query','query'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xcf3e,0x1b9));var _0xecf3=function(_0x386407,_0x5e860f){_0x386407=_0x386407-0x0;var _0x3dde1b=_0xcf3e[_0x386407];return _0x3dde1b;};'use strict';var multer=require(_0xecf3('0x0'));var util=require(_0xecf3('0x1'));var path=require(_0xecf3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xecf3('0x3')]();var fs_extra=require(_0xecf3('0x4'));var auth=require(_0xecf3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xecf3('0x6'));router['get']('/',auth[_0xecf3('0x7')](),controller['index']);router[_0xecf3('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xecf3('0x9')]);router[_0xecf3('0x8')](_0xecf3('0xa'),auth[_0xecf3('0x7')](),controller['preview']);router[_0xecf3('0x8')](_0xecf3('0xb'),auth[_0xecf3('0x7')](),controller[_0xecf3('0xc')]);router[_0xecf3('0x8')](_0xecf3('0xd'),auth[_0xecf3('0x7')](),controller[_0xecf3('0xe')]);router[_0xecf3('0xf')]('/',auth[_0xecf3('0x7')](),controller[_0xecf3('0x10')]);router['put']('/:id',auth[_0xecf3('0x7')](),controller[_0xecf3('0x11')]);router['delete']('/:id',auth[_0xecf3('0x7')](),controller[_0xecf3('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9bfb=['/:id/preview','preview','/:id/run','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','/:id','isAuthenticated','show','get'];(function(_0x278f1c,_0x19f7c8){var _0x2b285d=function(_0xd00642){while(--_0xd00642){_0x278f1c['push'](_0x278f1c['shift']());}};_0x2b285d(++_0x19f7c8);}(_0x9bfb,0x1c0));var _0xb9bf=function(_0x833417,_0x2ea2f9){_0x833417=_0x833417-0x0;var _0x388395=_0x9bfb[_0x833417];return _0x388395;};'use strict';var multer=require(_0xb9bf('0x0'));var util=require(_0xb9bf('0x1'));var path=require(_0xb9bf('0x2'));var timeout=require(_0xb9bf('0x3'));var express=require(_0xb9bf('0x4'));var router=express[_0xb9bf('0x5')]();var fs_extra=require(_0xb9bf('0x6'));var auth=require(_0xb9bf('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb9bf('0x8'));var controller=require('./analyticDefaultReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb9bf('0x9')]);router['get'](_0xb9bf('0xa'),auth[_0xb9bf('0xb')](),controller[_0xb9bf('0xc')]);router[_0xb9bf('0xd')](_0xb9bf('0xe'),auth['isAuthenticated'](),controller[_0xb9bf('0xf')]);router[_0xb9bf('0xd')](_0xb9bf('0x10'),auth[_0xb9bf('0xb')](),controller['run']);router[_0xb9bf('0xd')]('/:id/query',auth[_0xb9bf('0xb')](),controller['query']);router['post']('/',auth['isAuthenticated'](),controller[_0xb9bf('0x11')]);router['put'](_0xb9bf('0xa'),auth[_0xb9bf('0xb')](),controller[_0xb9bf('0x12')]);router[_0xb9bf('0x13')](_0xb9bf('0xa'),auth[_0xb9bf('0xb')](),controller[_0xb9bf('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index e4edb47..079bc34 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 _0xfb11=['ENUM','csv','xlsx','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','moment','exports','STRING'];(function(_0x21e4bb,_0x10691d){var _0x2a7639=function(_0x2820de){while(--_0x2820de){_0x21e4bb['push'](_0x21e4bb['shift']());}};_0x2a7639(++_0x10691d);}(_0xfb11,0x159));var _0x1fb1=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xfb11[_0x20c9b2];return _0x2c6030;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1fb1('0x0'));module[_0x1fb1('0x1')]={'name':{'type':Sequelize[_0x1fb1('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x1fb1('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x1fb1('0x3')](_0x1fb1('0x4'),'pdf',_0x1fb1('0x5')),'allowNull':![],'defaultValue':_0x1fb1('0x4')},'savename':{'type':Sequelize[_0x1fb1('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x1fb1('0x6')]},'endDate':{'type':Sequelize[_0x1fb1('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x1fb1('0x7')},'type':{'type':Sequelize['ENUM'](_0x1fb1('0x8'),_0x1fb1('0x9')),'allowNull':![],'defaultValue':_0x1fb1('0x8')},'reportId':{'type':Sequelize[_0x1fb1('0xa')](0xb)[_0x1fb1('0xb')]},'reportType':{'type':Sequelize[_0x1fb1('0x2')]}}; \ No newline at end of file +var _0x5100=['STRING','ENUM','pdf','xlsx','csv','DATE','Loading','scheduled','manual','UNSIGNED','sequelize','exports'];(function(_0x358530,_0x5db36f){var _0xbe9e9a=function(_0x4a9b7c){while(--_0x4a9b7c){_0x358530['push'](_0x358530['shift']());}};_0xbe9e9a(++_0x5db36f);}(_0x5100,0x18a));var _0x0510=function(_0x4a0cae,_0x23ca05){_0x4a0cae=_0x4a0cae-0x0;var _0x2034de=_0x5100[_0x4a0cae];return _0x2034de;};'use strict';var Sequelize=require(_0x0510('0x0'));var moment=require('moment');module[_0x0510('0x1')]={'name':{'type':Sequelize[_0x0510('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x0510('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x0510('0x3')]('csv',_0x0510('0x4'),_0x0510('0x5')),'allowNull':![],'defaultValue':_0x0510('0x6')},'savename':{'type':Sequelize[_0x0510('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x0510('0x7')]},'endDate':{'type':Sequelize[_0x0510('0x7')]},'status':{'type':Sequelize[_0x0510('0x2')],'defaultValue':_0x0510('0x8')},'type':{'type':Sequelize[_0x0510('0x3')]('manual',_0x0510('0x9')),'allowNull':![],'defaultValue':_0x0510('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x0510('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 354e2d8..bb617aa 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 _0x2673=['filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','savename','existsSync','Report\x20not\x20found\x20or\x20empty','root','server/files/reports','format','%s.%s','toLowerCase','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x36b611,_0x1e42e7){var _0x2d6dd8=function(_0x370d48){while(--_0x370d48){_0x36b611['push'](_0x36b611['shift']());}};_0x2d6dd8(++_0x1e42e7);}(_0x2673,0x1f0));var _0x3267=function(_0x2ff8e3,_0x15553b){_0x2ff8e3=_0x2ff8e3-0x0;var _0x2f60b5=_0x2673[_0x2ff8e3];return _0x2f60b5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3267('0x0'));var zipdir=require(_0x3267('0x1'));var jsonpatch=require(_0x3267('0x2'));var rp=require(_0x3267('0x3'));var moment=require(_0x3267('0x4'));var BPromise=require(_0x3267('0x5'));var Mustache=require(_0x3267('0x6'));var util=require(_0x3267('0x7'));var path=require(_0x3267('0x8'));var sox=require(_0x3267('0x9'));var csv=require('to-csv');var ejs=require(_0x3267('0xa'));var fs=require('fs');var fs_extra=require(_0x3267('0xb'));var _=require(_0x3267('0xc'));var squel=require(_0x3267('0xd'));var crypto=require(_0x3267('0xe'));var jsforce=require(_0x3267('0xf'));var deskjs=require(_0x3267('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3267('0x11'));var Redis=require('ioredis');var authService=require(_0x3267('0x12'));var qs=require(_0x3267('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3267('0x14'));var utils=require(_0x3267('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3267('0x16'))['db'];function respondWithStatusCode(_0x30fd87,_0x47299d){_0x47299d=_0x47299d||0xcc;return function(_0x5ddf9d){if(_0x5ddf9d){return _0x30fd87[_0x3267('0x17')](_0x47299d);}return _0x30fd87[_0x3267('0x18')](_0x47299d)[_0x3267('0x19')]();};}function respondWithResult(_0xfebcd3,_0x363db5){_0x363db5=_0x363db5||0xc8;return function(_0x35752d){if(_0x35752d){return _0xfebcd3[_0x3267('0x18')](_0x363db5)[_0x3267('0x1a')](_0x35752d);}};}function respondWithFilteredResult(_0x150e6a,_0x49e22a){return function(_0x4e341b){if(_0x4e341b){var _0x3dea8e=typeof _0x49e22a[_0x3267('0x1b')]===_0x3267('0x1c')&&typeof _0x49e22a[_0x3267('0x1d')]===_0x3267('0x1c');var _0x2ff571=_0x4e341b['count'];var _0x1516ce=_0x3dea8e?0x0:_0x49e22a[_0x3267('0x1b')];var _0x1240ec=_0x3dea8e?_0x4e341b[_0x3267('0x1e')]:_0x49e22a[_0x3267('0x1b')]+_0x49e22a[_0x3267('0x1d')];var _0x132acc;if(_0x1240ec>=_0x2ff571){_0x1240ec=_0x2ff571;_0x132acc=0xc8;}else{_0x132acc=0xce;}_0x150e6a[_0x3267('0x18')](_0x132acc);return _0x150e6a[_0x3267('0x1f')](_0x3267('0x20'),_0x1516ce+'-'+_0x1240ec+'/'+_0x2ff571)[_0x3267('0x1a')](_0x4e341b);}return null;};}function patchUpdates(_0x5a0c4b){return function(_0x4bc27d){try{jsonpatch[_0x3267('0x21')](_0x4bc27d,_0x5a0c4b,!![]);}catch(_0x37c814){return BPromise['reject'](_0x37c814);}return _0x4bc27d[_0x3267('0x22')]();};}function saveUpdates(_0x42b12e,_0xf34383){return function(_0x1c1cc8){if(_0x1c1cc8){return _0x1c1cc8[_0x3267('0x23')](_0x42b12e)[_0x3267('0x24')](function(_0x434017){return _0x434017;});}return null;};}function removeEntity(_0x216198,_0x3da35a){return function(_0xd61f90){if(_0xd61f90){return _0xd61f90[_0x3267('0x25')]()[_0x3267('0x24')](function(){var _0x205d6f=_0xd61f90[_0x3267('0x26')]({'plain':!![]});var _0x5d3876=_0x3267('0x27');return db[_0x3267('0x28')][_0x3267('0x25')]({'where':{'type':_0x5d3876,'resourceId':_0x205d6f['id']}})[_0x3267('0x24')](function(){return _0xd61f90;});})['then'](function(){_0x216198[_0x3267('0x18')](0xcc)[_0x3267('0x19')]();});}};}function handleEntityNotFound(_0x4e69fe,_0x40f631){return function(_0x15175f){if(!_0x15175f){_0x4e69fe['sendStatus'](0x194);}return _0x15175f;};}function handleError(_0x11abf5,_0x46ed8e){_0x46ed8e=_0x46ed8e||0x1f4;return function(_0x57e33c){logger[_0x3267('0x29')](_0x57e33c[_0x3267('0x2a')]);if(_0x57e33c[_0x3267('0x2b')]){delete _0x57e33c[_0x3267('0x2b')];}_0x11abf5[_0x3267('0x18')](_0x46ed8e)[_0x3267('0x2c')](_0x57e33c);};}exports[_0x3267('0x2d')]=function(_0x3fceab,_0x2b535e){var _0x7036d5={},_0x844b5c={},_0x586066={'count':0x0,'rows':[]};var _0x8df22d=_[_0x3267('0x2e')](db[_0x3267('0x2f')][_0x3267('0x30')],function(_0x1a40ed){return{'name':_0x1a40ed['fieldName'],'type':_0x1a40ed[_0x3267('0x31')]['key']};});_0x844b5c[_0x3267('0x32')]=_[_0x3267('0x2e')](_0x8df22d,_0x3267('0x2b'));_0x844b5c[_0x3267('0x33')]=_[_0x3267('0x34')](_0x3fceab[_0x3267('0x33')]);_0x844b5c[_0x3267('0x35')]=_[_0x3267('0x36')](_0x844b5c[_0x3267('0x32')],_0x844b5c[_0x3267('0x33')]);_0x7036d5[_0x3267('0x37')]=_['intersection'](_0x844b5c[_0x3267('0x32')],qs['fields'](_0x3fceab['query'][_0x3267('0x38')]));_0x7036d5[_0x3267('0x37')]=_0x7036d5['attributes']['length']?_0x7036d5[_0x3267('0x37')]:_0x844b5c['model'];if(!_0x3fceab[_0x3267('0x33')][_0x3267('0x39')](_0x3267('0x3a'))){_0x7036d5[_0x3267('0x1d')]=qs['limit'](_0x3fceab[_0x3267('0x33')][_0x3267('0x1d')]);_0x7036d5[_0x3267('0x1b')]=qs['offset'](_0x3fceab[_0x3267('0x33')][_0x3267('0x1b')]);}_0x7036d5[_0x3267('0x3b')]=qs['sort'](_0x3fceab[_0x3267('0x33')][_0x3267('0x3c')]);_0x7036d5[_0x3267('0x3d')]=qs[_0x3267('0x35')](_['pick'](_0x3fceab[_0x3267('0x33')],_0x844b5c[_0x3267('0x35')]),_0x8df22d);if(_0x3fceab[_0x3267('0x33')][_0x3267('0x3e')]){_0x7036d5['where']=_[_0x3267('0x3f')](_0x7036d5[_0x3267('0x3d')],{'$or':_[_0x3267('0x2e')](_0x8df22d,function(_0xe27e1f){if(_0xe27e1f[_0x3267('0x31')]!==_0x3267('0x40')){var _0x12af73={};_0x12af73[_0xe27e1f[_0x3267('0x2b')]]={'$like':'%'+_0x3fceab[_0x3267('0x33')][_0x3267('0x3e')]+'%'};return _0x12af73;}})});}_0x7036d5=_['merge']({},_0x7036d5,_0x3fceab[_0x3267('0x41')]);var _0x1eb9e2={'where':_0x7036d5[_0x3267('0x3d')]};return db['AnalyticExtractedReport']['count'](_0x1eb9e2)[_0x3267('0x24')](function(_0x14743d){_0x586066[_0x3267('0x1e')]=_0x14743d;if(_0x3fceab[_0x3267('0x33')][_0x3267('0x42')]){_0x7036d5['include']=[{'all':!![]}];}return db[_0x3267('0x2f')][_0x3267('0x43')](_0x7036d5);})[_0x3267('0x24')](function(_0x2f6f28){_0x586066[_0x3267('0x44')]=_0x2f6f28;return _0x586066;})[_0x3267('0x24')](respondWithFilteredResult(_0x2b535e,_0x7036d5))[_0x3267('0x45')](handleError(_0x2b535e,null));};exports[_0x3267('0x46')]=function(_0x3462a6,_0x56929f){var _0x5eb63c={'raw':!![],'where':{'id':_0x3462a6[_0x3267('0x47')]['id']}},_0x1d6214={};_0x1d6214['model']=_['keys'](db[_0x3267('0x2f')]['rawAttributes']);_0x1d6214['query']=_[_0x3267('0x34')](_0x3462a6[_0x3267('0x33')]);_0x1d6214[_0x3267('0x35')]=_['intersection'](_0x1d6214['model'],_0x1d6214[_0x3267('0x33')]);_0x5eb63c[_0x3267('0x37')]=_[_0x3267('0x36')](_0x1d6214[_0x3267('0x32')],qs['fields'](_0x3462a6['query'][_0x3267('0x38')]));_0x5eb63c[_0x3267('0x37')]=_0x5eb63c[_0x3267('0x37')][_0x3267('0x48')]?_0x5eb63c[_0x3267('0x37')]:_0x1d6214[_0x3267('0x32')];if(_0x3462a6['query'][_0x3267('0x42')]){_0x5eb63c[_0x3267('0x49')]=[{'all':!![]}];}_0x5eb63c=_['merge']({},_0x5eb63c,_0x3462a6[_0x3267('0x41')]);return db['AnalyticExtractedReport'][_0x3267('0x4a')](_0x5eb63c)[_0x3267('0x24')](handleEntityNotFound(_0x56929f,null))[_0x3267('0x24')](respondWithResult(_0x56929f,null))[_0x3267('0x45')](handleError(_0x56929f,null));};exports[_0x3267('0x4b')]=function(_0x215451,_0x297012){return db['AnalyticExtractedReport'][_0x3267('0x4b')](_0x215451['body'],{})['then'](function(_0x5557a0){var _0xb48408=_0x215451['user'][_0x3267('0x26')]({'plain':!![]});if(!_0xb48408)throw new Error(_0x3267('0x4c'));if(_0xb48408[_0x3267('0x4d')]==='user'){var _0x20a50b=_0x5557a0[_0x3267('0x26')]({'plain':!![]});var _0x270ec2='ExtractedReports';return db[_0x3267('0x4e')]['find']({'where':{'name':_0x270ec2,'userProfileId':_0xb48408[_0x3267('0x4f')]},'raw':!![]})[_0x3267('0x24')](function(_0x16b91c){if(_0x16b91c&&_0x16b91c[_0x3267('0x50')]===0x0){return db[_0x3267('0x28')][_0x3267('0x4b')]({'name':_0x20a50b['name'],'resourceId':_0x20a50b['id'],'type':_0x16b91c[_0x3267('0x2b')],'sectionId':_0x16b91c['id']},{})[_0x3267('0x24')](function(){return _0x5557a0;});}else{return _0x5557a0;}})[_0x3267('0x45')](function(_0x368fb4){logger[_0x3267('0x29')](_0x3267('0x51'),_0x368fb4);throw _0x368fb4;});}return _0x5557a0;})[_0x3267('0x24')](respondWithResult(_0x297012,0xc9))[_0x3267('0x45')](handleError(_0x297012,null));};exports[_0x3267('0x23')]=function(_0x177bb0,_0x7d09ae){if(_0x177bb0[_0x3267('0x52')]['id']){delete _0x177bb0[_0x3267('0x52')]['id'];}return db[_0x3267('0x2f')][_0x3267('0x4a')]({'where':{'id':_0x177bb0[_0x3267('0x47')]['id']}})[_0x3267('0x24')](handleEntityNotFound(_0x7d09ae,null))[_0x3267('0x24')](saveUpdates(_0x177bb0['body'],null))['then'](respondWithResult(_0x7d09ae,null))[_0x3267('0x45')](handleError(_0x7d09ae,null));};exports[_0x3267('0x25')]=function(_0x26fb81,_0x895fba){return db[_0x3267('0x2f')][_0x3267('0x4a')]({'where':{'id':_0x26fb81['params']['id']}})['then'](handleEntityNotFound(_0x895fba,null))[_0x3267('0x24')](removeEntity(_0x895fba,null))[_0x3267('0x45')](handleError(_0x895fba,null));};exports[_0x3267('0x53')]=function(_0x1e2bba,_0x4fbfb3,_0xe57fd7){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x1e2bba['params']['id']},'attributes':['name',_0x3267('0x54'),_0x3267('0x55'),'output'],'raw':!![]})[_0x3267('0x24')](handleEntityNotFound(_0x4fbfb3,null))[_0x3267('0x24')](function(_0x4bd266){if(_0x4bd266){if(!fs[_0x3267('0x56')](path['join'](config['root'],'server/files/reports',_0x4bd266[_0x3267('0x55')]))){throw new db['Sequelize']['ValidationError'](_0x3267('0x57'));}if(_0x1e2bba[_0x3267('0x33')]['exists']){return _0x4fbfb3[_0x3267('0x17')](0xc8);}return _0x4fbfb3[_0x3267('0x53')](path['join'](config[_0x3267('0x58')],_0x3267('0x59'),_0x4bd266[_0x3267('0x55')]),util[_0x3267('0x5a')](_0x3267('0x5b'),_0x4bd266[_0x3267('0x54')]||_0x4bd266['name'],_0x4bd266['output'][_0x3267('0x5c')]()));}})[_0x3267('0x45')](handleError(_0x4fbfb3,null));}; \ No newline at end of file +var _0xede4=['intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','AnalyticExtractedReport','findAll','rows','catch','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','download','basename','savename','output','join','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','destroy','then','get','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','fieldName','key','query','keys','filters'];(function(_0x127c6c,_0x4a3f4e){var _0x33a308=function(_0x4de5c3){while(--_0x4de5c3){_0x127c6c['push'](_0x127c6c['shift']());}};_0x33a308(++_0x4a3f4e);}(_0xede4,0x1a4));var _0x4ede=function(_0x230648,_0x3fe561){_0x230648=_0x230648-0x0;var _0xf06ad0=_0xede4[_0x230648];return _0xf06ad0;};'use strict';var emlformat=require(_0x4ede('0x0'));var rimraf=require(_0x4ede('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4ede('0x2'));var rp=require(_0x4ede('0x3'));var moment=require(_0x4ede('0x4'));var BPromise=require(_0x4ede('0x5'));var Mustache=require('mustache');var util=require(_0x4ede('0x6'));var path=require(_0x4ede('0x7'));var sox=require(_0x4ede('0x8'));var csv=require(_0x4ede('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4ede('0xa'));var crypto=require(_0x4ede('0xb'));var jsforce=require(_0x4ede('0xc'));var deskjs=require(_0x4ede('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ede('0xe'));var Redis=require(_0x4ede('0xf'));var authService=require(_0x4ede('0x10'));var qs=require(_0x4ede('0x11'));var as=require(_0x4ede('0x12'));var hardwareService=require(_0x4ede('0x13'));var logger=require(_0x4ede('0x14'))(_0x4ede('0x15'));var utils=require('../../config/utils');var config=require(_0x4ede('0x16'));var licenseUtil=require(_0x4ede('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fbaf9,_0x5bc3a9){_0x5bc3a9=_0x5bc3a9||0xcc;return function(_0x36c4fc){if(_0x36c4fc){return _0x1fbaf9[_0x4ede('0x18')](_0x5bc3a9);}return _0x1fbaf9['status'](_0x5bc3a9)[_0x4ede('0x19')]();};}function respondWithResult(_0xdf708,_0x47b269){_0x47b269=_0x47b269||0xc8;return function(_0x5f502f){if(_0x5f502f){return _0xdf708[_0x4ede('0x1a')](_0x47b269)[_0x4ede('0x1b')](_0x5f502f);}};}function respondWithFilteredResult(_0x599b4f,_0x1f604a){return function(_0x15a0db){if(_0x15a0db){var _0x25f851=typeof _0x1f604a[_0x4ede('0x1c')]===_0x4ede('0x1d')&&typeof _0x1f604a[_0x4ede('0x1e')]===_0x4ede('0x1d');var _0x4cbb9b=_0x15a0db[_0x4ede('0x1f')];var _0x55173f=_0x25f851?0x0:_0x1f604a[_0x4ede('0x1c')];var _0x56ea05=_0x25f851?_0x15a0db['count']:_0x1f604a[_0x4ede('0x1c')]+_0x1f604a[_0x4ede('0x1e')];var _0x2a7cf1;if(_0x56ea05>=_0x4cbb9b){_0x56ea05=_0x4cbb9b;_0x2a7cf1=0xc8;}else{_0x2a7cf1=0xce;}_0x599b4f['status'](_0x2a7cf1);return _0x599b4f['set'](_0x4ede('0x20'),_0x55173f+'-'+_0x56ea05+'/'+_0x4cbb9b)[_0x4ede('0x1b')](_0x15a0db);}return null;};}function patchUpdates(_0x4e49b3){return function(_0x523e4c){try{jsonpatch['apply'](_0x523e4c,_0x4e49b3,!![]);}catch(_0x4299b1){return BPromise[_0x4ede('0x21')](_0x4299b1);}return _0x523e4c['save']();};}function saveUpdates(_0x1bd56c,_0x367d5b){return function(_0x1aa8e2){if(_0x1aa8e2){return _0x1aa8e2['update'](_0x1bd56c)['then'](function(_0xb40886){return _0xb40886;});}return null;};}function removeEntity(_0x506ac0,_0x5964b9){return function(_0xd370c6){if(_0xd370c6){return _0xd370c6[_0x4ede('0x22')]()[_0x4ede('0x23')](function(){var _0x5d1923=_0xd370c6[_0x4ede('0x24')]({'plain':!![]});var _0x1d27de=_0x4ede('0x25');return db[_0x4ede('0x26')][_0x4ede('0x22')]({'where':{'type':_0x1d27de,'resourceId':_0x5d1923['id']}})[_0x4ede('0x23')](function(){return _0xd370c6;});})[_0x4ede('0x23')](function(){_0x506ac0[_0x4ede('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x487f08,_0x465a77){return function(_0x2108d2){if(!_0x2108d2){_0x487f08[_0x4ede('0x18')](0x194);}return _0x2108d2;};}function handleError(_0x3cf5ba,_0x47b0c2){_0x47b0c2=_0x47b0c2||0x1f4;return function(_0x481f68){logger[_0x4ede('0x27')](_0x481f68[_0x4ede('0x28')]);if(_0x481f68[_0x4ede('0x29')]){delete _0x481f68[_0x4ede('0x29')];}_0x3cf5ba[_0x4ede('0x1a')](_0x47b0c2)[_0x4ede('0x2a')](_0x481f68);};}exports[_0x4ede('0x2b')]=function(_0x49d0b5,_0x110d3d){var _0x519961={},_0x2545e5={},_0x17f6c5={'count':0x0,'rows':[]};var _0x54dcaa=_[_0x4ede('0x2c')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x317923){return{'name':_0x317923[_0x4ede('0x2d')],'type':_0x317923['type'][_0x4ede('0x2e')]};});_0x2545e5['model']=_['map'](_0x54dcaa,_0x4ede('0x29'));_0x2545e5[_0x4ede('0x2f')]=_[_0x4ede('0x30')](_0x49d0b5[_0x4ede('0x2f')]);_0x2545e5[_0x4ede('0x31')]=_[_0x4ede('0x32')](_0x2545e5[_0x4ede('0x33')],_0x2545e5['query']);_0x519961[_0x4ede('0x34')]=_[_0x4ede('0x32')](_0x2545e5[_0x4ede('0x33')],qs[_0x4ede('0x35')](_0x49d0b5[_0x4ede('0x2f')][_0x4ede('0x35')]));_0x519961[_0x4ede('0x34')]=_0x519961['attributes'][_0x4ede('0x36')]?_0x519961[_0x4ede('0x34')]:_0x2545e5[_0x4ede('0x33')];if(!_0x49d0b5[_0x4ede('0x2f')][_0x4ede('0x37')]('nolimit')){_0x519961['limit']=qs['limit'](_0x49d0b5[_0x4ede('0x2f')][_0x4ede('0x1e')]);_0x519961[_0x4ede('0x1c')]=qs[_0x4ede('0x1c')](_0x49d0b5[_0x4ede('0x2f')][_0x4ede('0x1c')]);}_0x519961[_0x4ede('0x38')]=qs[_0x4ede('0x39')](_0x49d0b5[_0x4ede('0x2f')]['sort']);_0x519961[_0x4ede('0x3a')]=qs[_0x4ede('0x31')](_[_0x4ede('0x3b')](_0x49d0b5[_0x4ede('0x2f')],_0x2545e5[_0x4ede('0x31')]),_0x54dcaa);if(_0x49d0b5[_0x4ede('0x2f')][_0x4ede('0x3c')]){_0x519961[_0x4ede('0x3a')]=_['merge'](_0x519961[_0x4ede('0x3a')],{'$or':_['map'](_0x54dcaa,function(_0x492d96){if(_0x492d96[_0x4ede('0x3d')]!==_0x4ede('0x3e')){var _0x36e728={};_0x36e728[_0x492d96[_0x4ede('0x29')]]={'$like':'%'+_0x49d0b5[_0x4ede('0x2f')]['filter']+'%'};return _0x36e728;}})});}_0x519961=_[_0x4ede('0x3f')]({},_0x519961,_0x49d0b5['options']);var _0x5c90d2={'where':_0x519961['where']};return db['AnalyticExtractedReport']['count'](_0x5c90d2)[_0x4ede('0x23')](function(_0x2535df){_0x17f6c5[_0x4ede('0x1f')]=_0x2535df;if(_0x49d0b5[_0x4ede('0x2f')][_0x4ede('0x40')]){_0x519961[_0x4ede('0x41')]=[{'all':!![]}];}return db[_0x4ede('0x42')][_0x4ede('0x43')](_0x519961);})['then'](function(_0x2ff8c0){_0x17f6c5[_0x4ede('0x44')]=_0x2ff8c0;return _0x17f6c5;})[_0x4ede('0x23')](respondWithFilteredResult(_0x110d3d,_0x519961))[_0x4ede('0x45')](handleError(_0x110d3d,null));};exports['show']=function(_0x4cb4c4,_0x415927){var _0x51d32d={'raw':!![],'where':{'id':_0x4cb4c4[_0x4ede('0x46')]['id']}},_0x44f84d={};_0x44f84d[_0x4ede('0x33')]=_['keys'](db[_0x4ede('0x42')]['rawAttributes']);_0x44f84d[_0x4ede('0x2f')]=_[_0x4ede('0x30')](_0x4cb4c4[_0x4ede('0x2f')]);_0x44f84d[_0x4ede('0x31')]=_['intersection'](_0x44f84d[_0x4ede('0x33')],_0x44f84d[_0x4ede('0x2f')]);_0x51d32d[_0x4ede('0x34')]=_[_0x4ede('0x32')](_0x44f84d[_0x4ede('0x33')],qs[_0x4ede('0x35')](_0x4cb4c4['query']['fields']));_0x51d32d['attributes']=_0x51d32d['attributes'][_0x4ede('0x36')]?_0x51d32d['attributes']:_0x44f84d['model'];if(_0x4cb4c4[_0x4ede('0x2f')][_0x4ede('0x40')]){_0x51d32d[_0x4ede('0x41')]=[{'all':!![]}];}_0x51d32d=_[_0x4ede('0x3f')]({},_0x51d32d,_0x4cb4c4['options']);return db[_0x4ede('0x42')][_0x4ede('0x47')](_0x51d32d)[_0x4ede('0x23')](handleEntityNotFound(_0x415927,null))['then'](respondWithResult(_0x415927,null))['catch'](handleError(_0x415927,null));};exports['create']=function(_0x449aea,_0xd1978){return db[_0x4ede('0x42')][_0x4ede('0x48')](_0x449aea[_0x4ede('0x49')],{})[_0x4ede('0x23')](function(_0x435aea){var _0x49dd97=_0x449aea[_0x4ede('0x4a')]['get']({'plain':!![]});if(!_0x49dd97)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49dd97[_0x4ede('0x4b')]===_0x4ede('0x4a')){var _0x454371=_0x435aea[_0x4ede('0x24')]({'plain':!![]});var _0x4056c8=_0x4ede('0x25');return db[_0x4ede('0x4c')][_0x4ede('0x47')]({'where':{'name':_0x4056c8,'userProfileId':_0x49dd97[_0x4ede('0x4d')]},'raw':!![]})['then'](function(_0x5307ec){if(_0x5307ec&&_0x5307ec[_0x4ede('0x4e')]===0x0){return db['UserProfileResource'][_0x4ede('0x48')]({'name':_0x454371['name'],'resourceId':_0x454371['id'],'type':_0x5307ec['name'],'sectionId':_0x5307ec['id']},{})['then'](function(){return _0x435aea;});}else{return _0x435aea;}})[_0x4ede('0x45')](function(_0x35cef9){logger[_0x4ede('0x27')](_0x4ede('0x4f'),_0x35cef9);throw _0x35cef9;});}return _0x435aea;})['then'](respondWithResult(_0xd1978,0xc9))[_0x4ede('0x45')](handleError(_0xd1978,null));};exports[_0x4ede('0x50')]=function(_0x10776e,_0x382113){if(_0x10776e[_0x4ede('0x49')]['id']){delete _0x10776e[_0x4ede('0x49')]['id'];}return db[_0x4ede('0x42')][_0x4ede('0x47')]({'where':{'id':_0x10776e[_0x4ede('0x46')]['id']}})['then'](handleEntityNotFound(_0x382113,null))[_0x4ede('0x23')](saveUpdates(_0x10776e[_0x4ede('0x49')],null))[_0x4ede('0x23')](respondWithResult(_0x382113,null))[_0x4ede('0x45')](handleError(_0x382113,null));};exports[_0x4ede('0x22')]=function(_0x4bbe57,_0x46946d){return db['AnalyticExtractedReport'][_0x4ede('0x47')]({'where':{'id':_0x4bbe57['params']['id']}})['then'](handleEntityNotFound(_0x46946d,null))['then'](removeEntity(_0x46946d,null))['catch'](handleError(_0x46946d,null));};exports[_0x4ede('0x51')]=function(_0x59dc39,_0x2e4817,_0x3a0870){return db[_0x4ede('0x42')][_0x4ede('0x47')]({'where':{'id':_0x59dc39[_0x4ede('0x46')]['id']},'attributes':[_0x4ede('0x29'),_0x4ede('0x52'),_0x4ede('0x53'),_0x4ede('0x54')],'raw':!![]})[_0x4ede('0x23')](handleEntityNotFound(_0x2e4817,null))[_0x4ede('0x23')](function(_0x347a1f){if(_0x347a1f){if(!fs['existsSync'](path[_0x4ede('0x55')](config[_0x4ede('0x56')],_0x4ede('0x57'),_0x347a1f[_0x4ede('0x53')]))){throw new db['Sequelize'][(_0x4ede('0x58'))](_0x4ede('0x59'));}if(_0x59dc39[_0x4ede('0x2f')][_0x4ede('0x5a')]){return _0x2e4817['sendStatus'](0xc8);}return _0x2e4817[_0x4ede('0x51')](path[_0x4ede('0x55')](config['root'],'server/files/reports',_0x347a1f[_0x4ede('0x53')]),util[_0x4ede('0x5b')](_0x4ede('0x5c'),_0x347a1f[_0x4ede('0x52')]||_0x347a1f['name'],_0x347a1f[_0x4ede('0x54')][_0x4ede('0x5d')]()));}})[_0x4ede('0x45')](handleError(_0x2e4817,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index ef4aaf7..e25da4c 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 _0x3168=['rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x1dbaf7,_0x3d05b3){var _0x593f05=function(_0x381936){while(--_0x381936){_0x1dbaf7['push'](_0x1dbaf7['shift']());}};_0x593f05(++_0x3d05b3);}(_0x3168,0xd7));var _0x8316=function(_0x576d0a,_0x55858e){_0x576d0a=_0x576d0a-0x0;var _0x302b8c=_0x3168[_0x576d0a];return _0x302b8c;};'use strict';var _=require(_0x8316('0x0'));var util=require(_0x8316('0x1'));var logger=require(_0x8316('0x2'))('api');var moment=require(_0x8316('0x3'));var BPromise=require(_0x8316('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8316('0x5'));var rimraf=require(_0x8316('0x6'));var config=require(_0x8316('0x7'));var attributes=require(_0x8316('0x8'));module[_0x8316('0x9')]=function(_0x1f0d2b,_0x3f4739){return _0x1f0d2b[_0x8316('0xa')](_0x8316('0xb'),attributes,{'tableName':_0x8316('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4a1=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xa4a1,0x113));var _0x1a4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa4a1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1a4a('0x0'));var util=require(_0x1a4a('0x1'));var logger=require(_0x1a4a('0x2'))(_0x1a4a('0x3'));var moment=require('moment');var BPromise=require(_0x1a4a('0x4'));var rp=require(_0x1a4a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1a4a('0x6'));var config=require(_0x1a4a('0x7'));var attributes=require(_0x1a4a('0x8'));module[_0x1a4a('0x9')]=function(_0xa299e6,_0x146f84){return _0xa299e6['define'](_0x1a4a('0xa'),attributes,{'tableName':_0x1a4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 6dbaf4d..30d246f 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 _0xa6ac=['http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x1ef6c6,_0x5cb021){var _0x3a1a7a=function(_0x137a57){while(--_0x137a57){_0x1ef6c6['push'](_0x1ef6c6['shift']());}};_0x3a1a7a(++_0x5cb021);}(_0xa6ac,0x1c5));var _0xca6a=function(_0x27acce,_0x13a285){_0x27acce=_0x27acce-0x0;var _0x349785=_0xa6ac[_0x27acce];return _0x349785;};'use strict';var _=require('lodash');var util=require(_0xca6a('0x0'));var moment=require('moment');var BPromise=require(_0xca6a('0x1'));var rs=require(_0xca6a('0x2'));var fs=require('fs');var Redis=require(_0xca6a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xca6a('0x4'));var logger=require(_0xca6a('0x5'))('rpc');var config=require(_0xca6a('0x6'));var jayson=require(_0xca6a('0x7'));var client=jayson[_0xca6a('0x8')][_0xca6a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb68e29,_0x521d96,_0x3c61c2){return new BPromise(function(_0x4742c2,_0x119396){return client[_0xca6a('0xa')](_0xb68e29,_0x3c61c2)['then'](function(_0x2e23e4){logger[_0xca6a('0xb')](_0xca6a('0xc'),_0x521d96,_0xca6a('0xd'));logger[_0xca6a('0xe')](_0xca6a('0xf'),_0x521d96,_0xca6a('0xd'),JSON['stringify'](_0x2e23e4));if(_0x2e23e4[_0xca6a('0x10')]){if(_0x2e23e4[_0xca6a('0x10')][_0xca6a('0x11')]===0x1f4){logger[_0xca6a('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x521d96,_0x2e23e4[_0xca6a('0x10')][_0xca6a('0x12')]);return _0x119396(_0x2e23e4[_0xca6a('0x10')][_0xca6a('0x12')]);}logger[_0xca6a('0x10')](_0xca6a('0xc'),_0x521d96,_0x2e23e4['error'][_0xca6a('0x12')]);return _0x4742c2(_0x2e23e4[_0xca6a('0x10')][_0xca6a('0x12')]);}else{logger[_0xca6a('0xb')](_0xca6a('0xc'),_0x521d96,_0xca6a('0xd'));_0x4742c2(_0x2e23e4[_0xca6a('0x13')][_0xca6a('0x12')]);}})[_0xca6a('0x14')](function(_0x587c97){logger[_0xca6a('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x521d96,_0x587c97);_0x119396(_0x587c97);});});} \ No newline at end of file +var _0xd3e7=['stringify','error','code','message','result','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd3e7,0xb9));var _0x7d3e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd3e7[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7d3e('0x0'));var util=require('util');var moment=require(_0x7d3e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d3e('0x2'));var db=require(_0x7d3e('0x3'))['db'];var utils=require(_0x7d3e('0x4'));var logger=require(_0x7d3e('0x5'))('rpc');var config=require(_0x7d3e('0x6'));var jayson=require(_0x7d3e('0x7'));var client=jayson['client'][_0x7d3e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x356df3,_0x588503,_0x459d90){return new BPromise(function(_0x9513dd,_0x322e34){return client['request'](_0x356df3,_0x459d90)[_0x7d3e('0x9')](function(_0x5d9d6c){logger[_0x7d3e('0xa')](_0x7d3e('0xb'),_0x588503,_0x7d3e('0xc'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x588503,'request\x20sent',JSON[_0x7d3e('0xd')](_0x5d9d6c));if(_0x5d9d6c[_0x7d3e('0xe')]){if(_0x5d9d6c['error'][_0x7d3e('0xf')]===0x1f4){logger[_0x7d3e('0xe')](_0x7d3e('0xb'),_0x588503,_0x5d9d6c[_0x7d3e('0xe')]['message']);return _0x322e34(_0x5d9d6c[_0x7d3e('0xe')]['message']);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x588503,_0x5d9d6c['error'][_0x7d3e('0x10')]);return _0x9513dd(_0x5d9d6c['error'][_0x7d3e('0x10')]);}else{logger[_0x7d3e('0xa')](_0x7d3e('0xb'),_0x588503,_0x7d3e('0xc'));_0x9513dd(_0x5d9d6c[_0x7d3e('0x11')]['message']);}})['catch'](function(_0x3bf9a8){logger[_0x7d3e('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x588503,_0x3bf9a8);_0x322e34(_0x3bf9a8);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 2d2c5f0..8a7363f 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 _0x2d17=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d17,0xcf));var _0x72d1=function(_0x5f418d,_0x587aba){_0x5f418d=_0x5f418d-0x0;var _0x17882c=_0x2d17[_0x5f418d];return _0x17882c;};'use strict';var multer=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var path=require('path');var timeout=require(_0x72d1('0x2'));var express=require('express');var router=express[_0x72d1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x72d1('0x4'));var interaction=require(_0x72d1('0x5'));var config=require(_0x72d1('0x6'));var controller=require(_0x72d1('0x7'));router['get']('/',auth[_0x72d1('0x8')](),controller[_0x72d1('0x9')]);router[_0x72d1('0xa')](_0x72d1('0xb'),auth[_0x72d1('0x8')](),controller[_0x72d1('0xc')]);router[_0x72d1('0xa')]('/:id/download',auth[_0x72d1('0x8')](),controller['download']);router[_0x72d1('0xd')]('/',auth['isAuthenticated'](),controller[_0x72d1('0xe')]);router[_0x72d1('0xf')](_0x72d1('0xb'),auth[_0x72d1('0x8')](),controller[_0x72d1('0x10')]);router[_0x72d1('0x11')](_0x72d1('0xb'),auth['isAuthenticated'](),controller[_0x72d1('0x12')]);module['exports']=router; \ No newline at end of file +var _0x8104=['put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/download','post','create'];(function(_0xf3e355,_0xc7b1b6){var _0x20614a=function(_0x2be025){while(--_0x2be025){_0xf3e355['push'](_0xf3e355['shift']());}};_0x20614a(++_0xc7b1b6);}(_0x8104,0x141));var _0x4810=function(_0xe1f011,_0x4030b3){_0xe1f011=_0xe1f011-0x0;var _0xfa9442=_0x8104[_0xe1f011];return _0xfa9442;};'use strict';var multer=require(_0x4810('0x0'));var util=require(_0x4810('0x1'));var path=require(_0x4810('0x2'));var timeout=require(_0x4810('0x3'));var express=require(_0x4810('0x4'));var router=express['Router']();var fs_extra=require(_0x4810('0x5'));var auth=require(_0x4810('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4810('0x7'));var controller=require('./analyticExtractedReport.controller');router[_0x4810('0x8')]('/',auth[_0x4810('0x9')](),controller[_0x4810('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4810('0xb')]);router['get'](_0x4810('0xc'),auth[_0x4810('0x9')](),controller['download']);router[_0x4810('0xd')]('/',auth[_0x4810('0x9')](),controller[_0x4810('0xe')]);router[_0x4810('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x4810('0x10')]);router[_0x4810('0x11')](_0x4810('0x12'),auth[_0x4810('0x9')](),controller[_0x4810('0x13')]);module[_0x4810('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 269509f..4d1e2fd 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 _0xd454=['TEXT','STRING','BOOLEAN','exports'];(function(_0x119eb4,_0x190338){var _0x5ce077=function(_0x1e0af0){while(--_0x1e0af0){_0x119eb4['push'](_0x119eb4['shift']());}};_0x5ce077(++_0x190338);}(_0xd454,0xf3));var _0x4d45=function(_0x2fd10b,_0x52d5a6){_0x2fd10b=_0x2fd10b-0x0;var _0x397ac9=_0xd454[_0x2fd10b];return _0x397ac9;};'use strict';var Sequelize=require('sequelize');module[_0x4d45('0x0')]={'field':{'type':Sequelize[_0x4d45('0x1')]},'alias':{'type':Sequelize[_0x4d45('0x2')]},'function':{'type':Sequelize[_0x4d45('0x2')]},'format':{'type':Sequelize[_0x4d45('0x2')]},'groupBy':{'type':Sequelize[_0x4d45('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x4d45('0x2')]},'custom':{'type':Sequelize[_0x4d45('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe1bf=['STRING','BOOLEAN','exports'];(function(_0x2e0afd,_0x1a71f7){var _0x4cefad=function(_0x8f4720){while(--_0x8f4720){_0x2e0afd['push'](_0x2e0afd['shift']());}};_0x4cefad(++_0x1a71f7);}(_0xe1bf,0x146));var _0xfe1b=function(_0x1d53cb,_0x479716){_0x1d53cb=_0x1d53cb-0x0;var _0x3baec2=_0xe1bf[_0x1d53cb];return _0x3baec2;};'use strict';var Sequelize=require('sequelize');module[_0xfe1b('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xfe1b('0x1')]},'function':{'type':Sequelize[_0xfe1b('0x1')]},'format':{'type':Sequelize[_0xfe1b('0x1')]},'groupBy':{'type':Sequelize[_0xfe1b('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xfe1b('0x1')]},'custom':{'type':Sequelize[_0xfe1b('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 9d93059..1474512 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 _0x65db=['then','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticFieldReport','includeAll','include','rows','show','params','rawAttributes','fields','find','catch','create','body','bulkCreate','destroy','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update'];(function(_0x3bf1cc,_0x163963){var _0x217637=function(_0x4730cb){while(--_0x4730cb){_0x3bf1cc['push'](_0x3bf1cc['shift']());}};_0x217637(++_0x163963);}(_0x65db,0x7f));var _0xb65d=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x65db[_0x47a7d0];return _0xb9bd08;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb65d('0x0'));var zipdir=require(_0xb65d('0x1'));var jsonpatch=require(_0xb65d('0x2'));var rp=require(_0xb65d('0x3'));var moment=require(_0xb65d('0x4'));var BPromise=require(_0xb65d('0x5'));var Mustache=require(_0xb65d('0x6'));var util=require(_0xb65d('0x7'));var path=require(_0xb65d('0x8'));var sox=require(_0xb65d('0x9'));var csv=require(_0xb65d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb65d('0xb'));var _=require(_0xb65d('0xc'));var squel=require(_0xb65d('0xd'));var crypto=require('crypto');var jsforce=require(_0xb65d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb65d('0xa'));var querystring=require(_0xb65d('0xf'));var Papa=require(_0xb65d('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb65d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb65d('0x12'))(_0xb65d('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb65d('0x14'))['db'];function respondWithStatusCode(_0x3653f9,_0x4fef5a){_0x4fef5a=_0x4fef5a||0xcc;return function(_0x82838f){if(_0x82838f){return _0x3653f9[_0xb65d('0x15')](_0x4fef5a);}return _0x3653f9[_0xb65d('0x16')](_0x4fef5a)[_0xb65d('0x17')]();};}function respondWithResult(_0x220e99,_0x5d7f39){_0x5d7f39=_0x5d7f39||0xc8;return function(_0x532412){if(_0x532412){return _0x220e99['status'](_0x5d7f39)[_0xb65d('0x18')](_0x532412);}};}function respondWithFilteredResult(_0x4a4a1c,_0x4dec45){return function(_0x1d876e){if(_0x1d876e){var _0x3ff0d7=typeof _0x4dec45['offset']==='undefined'&&typeof _0x4dec45[_0xb65d('0x19')]===_0xb65d('0x1a');var _0x5476cc=_0x1d876e['count'];var _0x50c2fd=_0x3ff0d7?0x0:_0x4dec45[_0xb65d('0x1b')];var _0x13ee94=_0x3ff0d7?_0x1d876e[_0xb65d('0x1c')]:_0x4dec45['offset']+_0x4dec45['limit'];var _0x109842;if(_0x13ee94>=_0x5476cc){_0x13ee94=_0x5476cc;_0x109842=0xc8;}else{_0x109842=0xce;}_0x4a4a1c[_0xb65d('0x16')](_0x109842);return _0x4a4a1c[_0xb65d('0x1d')](_0xb65d('0x1e'),_0x50c2fd+'-'+_0x13ee94+'/'+_0x5476cc)[_0xb65d('0x18')](_0x1d876e);}return null;};}function patchUpdates(_0x5164da){return function(_0x39b8cb){try{jsonpatch[_0xb65d('0x1f')](_0x39b8cb,_0x5164da,!![]);}catch(_0x463cb6){return BPromise[_0xb65d('0x20')](_0x463cb6);}return _0x39b8cb[_0xb65d('0x21')]();};}function saveUpdates(_0x3118cd,_0x5eb1a3){return function(_0x2fd91b){if(_0x2fd91b){return _0x2fd91b[_0xb65d('0x22')](_0x3118cd)[_0xb65d('0x23')](function(_0x17e3dd){return _0x17e3dd;});}return null;};}function removeEntity(_0x131eb2,_0x3e7ccd){return function(_0x573507){if(_0x573507){return _0x573507['destroy']()['then'](function(){_0x131eb2[_0xb65d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d5009,_0x2b458b){return function(_0xbccc72){if(!_0xbccc72){_0x1d5009[_0xb65d('0x15')](0x194);}return _0xbccc72;};}function handleError(_0x541ba8,_0x48ae26){_0x48ae26=_0x48ae26||0x1f4;return function(_0x284740){logger[_0xb65d('0x24')](_0x284740[_0xb65d('0x25')]);if(_0x284740[_0xb65d('0x26')]){delete _0x284740[_0xb65d('0x26')];}_0x541ba8['status'](_0x48ae26)[_0xb65d('0x27')](_0x284740);};}exports[_0xb65d('0x28')]=function(_0xec1743,_0x2a46b4){var _0x566e66={},_0x5524f3={},_0x3d0cc2={'count':0x0,'rows':[]};var _0x2dbc40=_[_0xb65d('0x29')](db['AnalyticFieldReport']['rawAttributes'],function(_0x54941e){return{'name':_0x54941e['fieldName'],'type':_0x54941e[_0xb65d('0x2a')][_0xb65d('0x2b')]};});_0x5524f3[_0xb65d('0x2c')]=_[_0xb65d('0x29')](_0x2dbc40,_0xb65d('0x26'));_0x5524f3[_0xb65d('0x2d')]=_[_0xb65d('0x2e')](_0xec1743[_0xb65d('0x2d')]);_0x5524f3[_0xb65d('0x2f')]=_[_0xb65d('0x30')](_0x5524f3[_0xb65d('0x2c')],_0x5524f3['query']);_0x566e66[_0xb65d('0x31')]=_[_0xb65d('0x30')](_0x5524f3[_0xb65d('0x2c')],qs['fields'](_0xec1743[_0xb65d('0x2d')]['fields']));_0x566e66[_0xb65d('0x31')]=_0x566e66['attributes'][_0xb65d('0x32')]?_0x566e66['attributes']:_0x5524f3['model'];if(!_0xec1743['query']['hasOwnProperty']('nolimit')){_0x566e66[_0xb65d('0x19')]=qs[_0xb65d('0x19')](_0xec1743[_0xb65d('0x2d')]['limit']);_0x566e66[_0xb65d('0x1b')]=qs[_0xb65d('0x1b')](_0xec1743['query']['offset']);}_0x566e66[_0xb65d('0x33')]=qs[_0xb65d('0x34')](_0xec1743[_0xb65d('0x2d')][_0xb65d('0x34')]);_0x566e66[_0xb65d('0x35')]=qs[_0xb65d('0x2f')](_[_0xb65d('0x36')](_0xec1743[_0xb65d('0x2d')],_0x5524f3[_0xb65d('0x2f')]),_0x2dbc40);if(_0xec1743[_0xb65d('0x2d')][_0xb65d('0x37')]){_0x566e66['where']=_[_0xb65d('0x38')](_0x566e66['where'],{'$or':_[_0xb65d('0x29')](_0x2dbc40,function(_0x55a808){if(_0x55a808['type']!==_0xb65d('0x39')){var _0x342efc={};_0x342efc[_0x55a808['name']]={'$like':'%'+_0xec1743['query'][_0xb65d('0x37')]+'%'};return _0x342efc;}})});}_0x566e66=_[_0xb65d('0x38')]({},_0x566e66,_0xec1743[_0xb65d('0x3a')]);var _0x5661d8={'where':_0x566e66[_0xb65d('0x35')]};return db[_0xb65d('0x3b')][_0xb65d('0x1c')](_0x5661d8)[_0xb65d('0x23')](function(_0x4590b6){_0x3d0cc2[_0xb65d('0x1c')]=_0x4590b6;if(_0xec1743[_0xb65d('0x2d')][_0xb65d('0x3c')]){_0x566e66[_0xb65d('0x3d')]=[{'all':!![]}];}return db[_0xb65d('0x3b')]['findAll'](_0x566e66);})['then'](function(_0x3ff392){_0x3d0cc2[_0xb65d('0x3e')]=_0x3ff392;return _0x3d0cc2;})[_0xb65d('0x23')](respondWithFilteredResult(_0x2a46b4,_0x566e66))['catch'](handleError(_0x2a46b4,null));};exports[_0xb65d('0x3f')]=function(_0x35b1b2,_0x2aaf44){var _0x4bc031={'raw':![],'where':{'id':_0x35b1b2[_0xb65d('0x40')]['id']}},_0x83b2fd={};_0x83b2fd[_0xb65d('0x2c')]=_['keys'](db[_0xb65d('0x3b')][_0xb65d('0x41')]);_0x83b2fd['query']=_[_0xb65d('0x2e')](_0x35b1b2['query']);_0x83b2fd[_0xb65d('0x2f')]=_['intersection'](_0x83b2fd['model'],_0x83b2fd[_0xb65d('0x2d')]);_0x4bc031[_0xb65d('0x31')]=_[_0xb65d('0x30')](_0x83b2fd['model'],qs[_0xb65d('0x42')](_0x35b1b2[_0xb65d('0x2d')]['fields']));_0x4bc031[_0xb65d('0x31')]=_0x4bc031[_0xb65d('0x31')]['length']?_0x4bc031[_0xb65d('0x31')]:_0x83b2fd[_0xb65d('0x2c')];if(_0x35b1b2[_0xb65d('0x2d')][_0xb65d('0x3c')]){_0x4bc031[_0xb65d('0x3d')]=[{'all':!![]}];}_0x4bc031=_[_0xb65d('0x38')]({},_0x4bc031,_0x35b1b2['options']);return db[_0xb65d('0x3b')][_0xb65d('0x43')](_0x4bc031)[_0xb65d('0x23')](handleEntityNotFound(_0x2aaf44,null))['then'](respondWithResult(_0x2aaf44,null))[_0xb65d('0x44')](handleError(_0x2aaf44,null));};exports[_0xb65d('0x45')]=function(_0x403567,_0x526d7c){return db['AnalyticFieldReport']['create'](_0x403567[_0xb65d('0x46')],{})[_0xb65d('0x23')](respondWithResult(_0x526d7c,0xc9))[_0xb65d('0x44')](handleError(_0x526d7c,null));};exports[_0xb65d('0x47')]=function(_0x43c2e0,_0x25d0f5){return db[_0xb65d('0x3b')]['bulkCreate'](_0x43c2e0[_0xb65d('0x46')],{'raw':![],'individualHooks':!![]})[_0xb65d('0x23')](respondWithResult(_0x25d0f5,0xc9))[_0xb65d('0x44')](handleError(_0x25d0f5,null));};exports['update']=function(_0x2199c6,_0x52a1db){if(_0x2199c6[_0xb65d('0x46')]['id']){delete _0x2199c6['body']['id'];}return db[_0xb65d('0x3b')][_0xb65d('0x43')]({'where':{'id':_0x2199c6['params']['id']}})[_0xb65d('0x23')](handleEntityNotFound(_0x52a1db,null))[_0xb65d('0x23')](saveUpdates(_0x2199c6['body'],null))[_0xb65d('0x23')](respondWithResult(_0x52a1db,null))[_0xb65d('0x44')](handleError(_0x52a1db,null));};exports[_0xb65d('0x48')]=function(_0x531b94,_0x5382af){return db[_0xb65d('0x3b')][_0xb65d('0x43')]({'where':{'id':_0x531b94[_0xb65d('0x40')]['id']}})[_0xb65d('0x23')](handleEntityNotFound(_0x5382af,null))[_0xb65d('0x23')](removeEntity(_0x5382af,null))[_0xb65d('0x44')](handleError(_0x5382af,null));};exports[_0xb65d('0x49')]=function(_0x4f5702,_0x25c6b0){return db[_0xb65d('0x3b')][_0xb65d('0x48')]({'where':{'id':_0x4f5702[_0xb65d('0x2d')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xb65d('0x23')](respondWithResult(_0x25c6b0,0xcc))[_0xb65d('0x44')](handleError(_0x25c6b0,null));};exports[_0xb65d('0x4a')]=function(_0x1ff9e8,_0x2eaec2,_0x1ad01b){return db[_0xb65d('0x4b')][_0xb65d('0x4c')]({'where':{'id':_0x1ff9e8[_0xb65d('0x40')]['id']}})[_0xb65d('0x23')](handleEntityNotFound(_0x2eaec2,null))[_0xb65d('0x23')](function(_0x1b117e){if(_0x1b117e){return db[_0xb65d('0x4d')][_0xb65d('0x4e')](function(_0x523483){return db[_0xb65d('0x3b')][_0xb65d('0x48')]({'where':{'CustomReportId':_0x1ff9e8[_0xb65d('0x40')]['id']},'transaction':_0x523483})[_0xb65d('0x23')](function(_0x3308b2){var _0x1c5ca0=_[_0xb65d('0x29')](_0x1ff9e8[_0xb65d('0x46')],function(_0x8a8a5){delete _0x8a8a5['id'];_0x8a8a5[_0xb65d('0x4f')]=_0x1ff9e8[_0xb65d('0x40')]['id'];return _0x8a8a5;});return db[_0xb65d('0x3b')][_0xb65d('0x47')](_0x1c5ca0,{'transaction':_0x523483});});})[_0xb65d('0x23')](function(){return db[_0xb65d('0x3b')][_0xb65d('0x50')]({'where':{'CustomReportId':_0x1ff9e8[_0xb65d('0x40')]['id']}});});}})[_0xb65d('0x23')](respondWithResult(_0x2eaec2,null))['catch'](handleError(_0x2eaec2,null));}; \ No newline at end of file +var _0xffc1=['AnalyticFieldReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','length','find','create','bulkCreate','body','bulkDestroy','ids','addFields','findOne','sequelize','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','limit','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x52a4a9,_0x4f4e11){var _0x298229=function(_0x15cbeb){while(--_0x15cbeb){_0x52a4a9['push'](_0x52a4a9['shift']());}};_0x298229(++_0x4f4e11);}(_0xffc1,0x1b4));var _0x1ffc=function(_0x3ac4f3,_0x2de061){_0x3ac4f3=_0x3ac4f3-0x0;var _0x1315ac=_0xffc1[_0x3ac4f3];return _0x1315ac;};'use strict';var emlformat=require(_0x1ffc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1ffc('0x1'));var jsonpatch=require(_0x1ffc('0x2'));var rp=require(_0x1ffc('0x3'));var moment=require(_0x1ffc('0x4'));var BPromise=require(_0x1ffc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1ffc('0x6'));var sox=require(_0x1ffc('0x7'));var csv=require('to-csv');var ejs=require(_0x1ffc('0x8'));var fs=require('fs');var fs_extra=require(_0x1ffc('0x9'));var _=require(_0x1ffc('0xa'));var squel=require(_0x1ffc('0xb'));var crypto=require('crypto');var jsforce=require(_0x1ffc('0xc'));var deskjs=require(_0x1ffc('0xd'));var toCsv=require(_0x1ffc('0xe'));var querystring=require(_0x1ffc('0xf'));var Papa=require('papaparse');var Redis=require(_0x1ffc('0x10'));var authService=require(_0x1ffc('0x11'));var qs=require(_0x1ffc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ffc('0x13'));var logger=require(_0x1ffc('0x14'))(_0x1ffc('0x15'));var utils=require(_0x1ffc('0x16'));var config=require(_0x1ffc('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1ffc('0x18'))['db'];function respondWithStatusCode(_0x28c119,_0x21b64c){_0x21b64c=_0x21b64c||0xcc;return function(_0xce3f60){if(_0xce3f60){return _0x28c119[_0x1ffc('0x19')](_0x21b64c);}return _0x28c119['status'](_0x21b64c)[_0x1ffc('0x1a')]();};}function respondWithResult(_0x2b176b,_0xd65a02){_0xd65a02=_0xd65a02||0xc8;return function(_0x598a33){if(_0x598a33){return _0x2b176b[_0x1ffc('0x1b')](_0xd65a02)[_0x1ffc('0x1c')](_0x598a33);}};}function respondWithFilteredResult(_0x36eb1d,_0x82e415){return function(_0x44bcb5){if(_0x44bcb5){var _0x20bf21=typeof _0x82e415['offset']==='undefined'&&typeof _0x82e415[_0x1ffc('0x1d')]==='undefined';var _0xd34c9d=_0x44bcb5[_0x1ffc('0x1e')];var _0x53257c=_0x20bf21?0x0:_0x82e415[_0x1ffc('0x1f')];var _0x15c581=_0x20bf21?_0x44bcb5[_0x1ffc('0x1e')]:_0x82e415[_0x1ffc('0x1f')]+_0x82e415[_0x1ffc('0x1d')];var _0x415ebe;if(_0x15c581>=_0xd34c9d){_0x15c581=_0xd34c9d;_0x415ebe=0xc8;}else{_0x415ebe=0xce;}_0x36eb1d[_0x1ffc('0x1b')](_0x415ebe);return _0x36eb1d['set']('Content-Range',_0x53257c+'-'+_0x15c581+'/'+_0xd34c9d)[_0x1ffc('0x1c')](_0x44bcb5);}return null;};}function patchUpdates(_0x5ec1a8){return function(_0x404a46){try{jsonpatch[_0x1ffc('0x20')](_0x404a46,_0x5ec1a8,!![]);}catch(_0x4c22ce){return BPromise[_0x1ffc('0x21')](_0x4c22ce);}return _0x404a46[_0x1ffc('0x22')]();};}function saveUpdates(_0x3cb419,_0x3b31c7){return function(_0x43f461){if(_0x43f461){return _0x43f461[_0x1ffc('0x23')](_0x3cb419)[_0x1ffc('0x24')](function(_0x2b8d1f){return _0x2b8d1f;});}return null;};}function removeEntity(_0x5b0953,_0x536cec){return function(_0x423911){if(_0x423911){return _0x423911[_0x1ffc('0x25')]()[_0x1ffc('0x24')](function(){_0x5b0953[_0x1ffc('0x1b')](0xcc)[_0x1ffc('0x1a')]();});}};}function handleEntityNotFound(_0x40309a,_0x34164d){return function(_0x355650){if(!_0x355650){_0x40309a['sendStatus'](0x194);}return _0x355650;};}function handleError(_0x5d2ebd,_0x25ed4b){_0x25ed4b=_0x25ed4b||0x1f4;return function(_0x50314d){logger[_0x1ffc('0x26')](_0x50314d[_0x1ffc('0x27')]);if(_0x50314d[_0x1ffc('0x28')]){delete _0x50314d['name'];}_0x5d2ebd['status'](_0x25ed4b)[_0x1ffc('0x29')](_0x50314d);};}exports[_0x1ffc('0x2a')]=function(_0x3cb458,_0x155fc0){var _0x469783={},_0xab3fb9={},_0x3f1243={'count':0x0,'rows':[]};var _0xe2eb32=_[_0x1ffc('0x2b')](db[_0x1ffc('0x2c')][_0x1ffc('0x2d')],function(_0x1bd605){return{'name':_0x1bd605[_0x1ffc('0x2e')],'type':_0x1bd605['type'][_0x1ffc('0x2f')]};});_0xab3fb9[_0x1ffc('0x30')]=_[_0x1ffc('0x2b')](_0xe2eb32,_0x1ffc('0x28'));_0xab3fb9[_0x1ffc('0x31')]=_[_0x1ffc('0x32')](_0x3cb458['query']);_0xab3fb9[_0x1ffc('0x33')]=_[_0x1ffc('0x34')](_0xab3fb9[_0x1ffc('0x30')],_0xab3fb9[_0x1ffc('0x31')]);_0x469783[_0x1ffc('0x35')]=_['intersection'](_0xab3fb9[_0x1ffc('0x30')],qs[_0x1ffc('0x36')](_0x3cb458['query'][_0x1ffc('0x36')]));_0x469783[_0x1ffc('0x35')]=_0x469783[_0x1ffc('0x35')]['length']?_0x469783[_0x1ffc('0x35')]:_0xab3fb9['model'];if(!_0x3cb458[_0x1ffc('0x31')][_0x1ffc('0x37')](_0x1ffc('0x38'))){_0x469783[_0x1ffc('0x1d')]=qs[_0x1ffc('0x1d')](_0x3cb458['query']['limit']);_0x469783[_0x1ffc('0x1f')]=qs[_0x1ffc('0x1f')](_0x3cb458[_0x1ffc('0x31')]['offset']);}_0x469783[_0x1ffc('0x39')]=qs[_0x1ffc('0x3a')](_0x3cb458[_0x1ffc('0x31')][_0x1ffc('0x3a')]);_0x469783[_0x1ffc('0x3b')]=qs[_0x1ffc('0x33')](_[_0x1ffc('0x3c')](_0x3cb458[_0x1ffc('0x31')],_0xab3fb9['filters']),_0xe2eb32);if(_0x3cb458[_0x1ffc('0x31')][_0x1ffc('0x3d')]){_0x469783[_0x1ffc('0x3b')]=_[_0x1ffc('0x3e')](_0x469783[_0x1ffc('0x3b')],{'$or':_[_0x1ffc('0x2b')](_0xe2eb32,function(_0x5316da){if(_0x5316da['type']!==_0x1ffc('0x3f')){var _0x11ba90={};_0x11ba90[_0x5316da['name']]={'$like':'%'+_0x3cb458[_0x1ffc('0x31')][_0x1ffc('0x3d')]+'%'};return _0x11ba90;}})});}_0x469783=_[_0x1ffc('0x3e')]({},_0x469783,_0x3cb458[_0x1ffc('0x40')]);var _0x250c74={'where':_0x469783[_0x1ffc('0x3b')]};return db[_0x1ffc('0x2c')]['count'](_0x250c74)['then'](function(_0x4c724e){_0x3f1243[_0x1ffc('0x1e')]=_0x4c724e;if(_0x3cb458[_0x1ffc('0x31')][_0x1ffc('0x41')]){_0x469783['include']=[{'all':!![]}];}return db[_0x1ffc('0x2c')][_0x1ffc('0x42')](_0x469783);})[_0x1ffc('0x24')](function(_0x975f4d){_0x3f1243['rows']=_0x975f4d;return _0x3f1243;})[_0x1ffc('0x24')](respondWithFilteredResult(_0x155fc0,_0x469783))[_0x1ffc('0x43')](handleError(_0x155fc0,null));};exports[_0x1ffc('0x44')]=function(_0x132b1a,_0x254a4){var _0x4eb0db={'raw':![],'where':{'id':_0x132b1a[_0x1ffc('0x45')]['id']}},_0x1a87c8={};_0x1a87c8[_0x1ffc('0x30')]=_['keys'](db['AnalyticFieldReport'][_0x1ffc('0x2d')]);_0x1a87c8[_0x1ffc('0x31')]=_['keys'](_0x132b1a['query']);_0x1a87c8[_0x1ffc('0x33')]=_[_0x1ffc('0x34')](_0x1a87c8['model'],_0x1a87c8[_0x1ffc('0x31')]);_0x4eb0db[_0x1ffc('0x35')]=_[_0x1ffc('0x34')](_0x1a87c8[_0x1ffc('0x30')],qs[_0x1ffc('0x36')](_0x132b1a[_0x1ffc('0x31')][_0x1ffc('0x36')]));_0x4eb0db['attributes']=_0x4eb0db['attributes'][_0x1ffc('0x46')]?_0x4eb0db[_0x1ffc('0x35')]:_0x1a87c8[_0x1ffc('0x30')];if(_0x132b1a[_0x1ffc('0x31')]['includeAll']){_0x4eb0db['include']=[{'all':!![]}];}_0x4eb0db=_[_0x1ffc('0x3e')]({},_0x4eb0db,_0x132b1a[_0x1ffc('0x40')]);return db[_0x1ffc('0x2c')][_0x1ffc('0x47')](_0x4eb0db)[_0x1ffc('0x24')](handleEntityNotFound(_0x254a4,null))[_0x1ffc('0x24')](respondWithResult(_0x254a4,null))[_0x1ffc('0x43')](handleError(_0x254a4,null));};exports[_0x1ffc('0x48')]=function(_0x467a33,_0x1e1db9){return db[_0x1ffc('0x2c')]['create'](_0x467a33['body'],{})['then'](respondWithResult(_0x1e1db9,0xc9))[_0x1ffc('0x43')](handleError(_0x1e1db9,null));};exports[_0x1ffc('0x49')]=function(_0x55d96f,_0x2457c1){return db[_0x1ffc('0x2c')][_0x1ffc('0x49')](_0x55d96f['body'],{'raw':![],'individualHooks':!![]})[_0x1ffc('0x24')](respondWithResult(_0x2457c1,0xc9))[_0x1ffc('0x43')](handleError(_0x2457c1,null));};exports[_0x1ffc('0x23')]=function(_0x280777,_0x559b27){if(_0x280777['body']['id']){delete _0x280777[_0x1ffc('0x4a')]['id'];}return db['AnalyticFieldReport'][_0x1ffc('0x47')]({'where':{'id':_0x280777[_0x1ffc('0x45')]['id']}})['then'](handleEntityNotFound(_0x559b27,null))[_0x1ffc('0x24')](saveUpdates(_0x280777[_0x1ffc('0x4a')],null))[_0x1ffc('0x24')](respondWithResult(_0x559b27,null))[_0x1ffc('0x43')](handleError(_0x559b27,null));};exports['destroy']=function(_0x2f20db,_0x19108e){return db['AnalyticFieldReport'][_0x1ffc('0x47')]({'where':{'id':_0x2f20db[_0x1ffc('0x45')]['id']}})[_0x1ffc('0x24')](handleEntityNotFound(_0x19108e,null))[_0x1ffc('0x24')](removeEntity(_0x19108e,null))[_0x1ffc('0x43')](handleError(_0x19108e,null));};exports[_0x1ffc('0x4b')]=function(_0x28ab49,_0x2c42be){return db[_0x1ffc('0x2c')][_0x1ffc('0x25')]({'where':{'id':_0x28ab49[_0x1ffc('0x31')][_0x1ffc('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x1ffc('0x24')](respondWithResult(_0x2c42be,0xcc))[_0x1ffc('0x43')](handleError(_0x2c42be,null));};exports[_0x1ffc('0x4d')]=function(_0x178472,_0x3c420d,_0x160abe){return db['AnalyticCustomReport'][_0x1ffc('0x4e')]({'where':{'id':_0x178472[_0x1ffc('0x45')]['id']}})[_0x1ffc('0x24')](handleEntityNotFound(_0x3c420d,null))[_0x1ffc('0x24')](function(_0x31d252){if(_0x31d252){return db[_0x1ffc('0x4f')]['transaction'](function(_0x279e59){return db[_0x1ffc('0x2c')][_0x1ffc('0x25')]({'where':{'CustomReportId':_0x178472[_0x1ffc('0x45')]['id']},'transaction':_0x279e59})[_0x1ffc('0x24')](function(_0x32079b){var _0x5e66f0=_[_0x1ffc('0x2b')](_0x178472[_0x1ffc('0x4a')],function(_0x49bb5e){delete _0x49bb5e['id'];_0x49bb5e['CustomReportId']=_0x178472[_0x1ffc('0x45')]['id'];return _0x49bb5e;});return db[_0x1ffc('0x2c')][_0x1ffc('0x49')](_0x5e66f0,{'transaction':_0x279e59});});})[_0x1ffc('0x24')](function(){return db[_0x1ffc('0x2c')][_0x1ffc('0x42')]({'where':{'CustomReportId':_0x178472['params']['id']}});});}})[_0x1ffc('0x24')](respondWithResult(_0x3c420d,null))['catch'](handleError(_0x3c420d,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index c5b8f0b..3af2a55 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 _0xb4e4=['lodash','../../config/logger','moment','bluebird','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields'];(function(_0x57cf75,_0x307265){var _0x536cb6=function(_0x484d23){while(--_0x484d23){_0x57cf75['push'](_0x57cf75['shift']());}};_0x536cb6(++_0x307265);}(_0xb4e4,0x1a7));var _0x4b4e=function(_0x571cab,_0x7345a1){_0x571cab=_0x571cab-0x0;var _0xa03837=_0xb4e4[_0x571cab];return _0xa03837;};'use strict';var _=require(_0x4b4e('0x0'));var util=require('util');var logger=require(_0x4b4e('0x1'))('api');var moment=require(_0x4b4e('0x2'));var BPromise=require(_0x4b4e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4b4e('0x4'));var attributes=require(_0x4b4e('0x5'));module[_0x4b4e('0x6')]=function(_0x4d502e,_0x1e519a){return _0x4d502e['define'](_0x4b4e('0x7'),attributes,{'tableName':_0x4b4e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bad=['../../config/environment','exports','define','analytics_report_fields','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x0bad,0x185));var _0xd0ba=function(_0x4cfb1d,_0xd4707e){_0x4cfb1d=_0x4cfb1d-0x0;var _0x57a0a1=_0x0bad[_0x4cfb1d];return _0x57a0a1;};'use strict';var _=require(_0xd0ba('0x0'));var util=require(_0xd0ba('0x1'));var logger=require('../../config/logger')(_0xd0ba('0x2'));var moment=require(_0xd0ba('0x3'));var BPromise=require(_0xd0ba('0x4'));var rp=require(_0xd0ba('0x5'));var fs=require('fs');var path=require(_0xd0ba('0x6'));var rimraf=require('rimraf');var config=require(_0xd0ba('0x7'));var attributes=require('./analyticFieldReport.attributes');module[_0xd0ba('0x8')]=function(_0x18b58b,_0x35e41a){return _0x18b58b[_0xd0ba('0x9')]('AnalyticFieldReport',attributes,{'tableName':_0xd0ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 4b5d65e..274ac8d 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 _0x41af=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','AnalyticFieldReport,\x20%s,\x20%s','debug','stringify','error','message','info','request\x20sent','result','lodash','util','moment','bluebird','randomstring'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x41af,0x1c3));var _0xf41a=function(_0x4a08e5,_0x37bf9d){_0x4a08e5=_0x4a08e5-0x0;var _0x49b14b=_0x41af[_0x4a08e5];return _0x49b14b;};'use strict';var _=require(_0xf41a('0x0'));var util=require(_0xf41a('0x1'));var moment=require(_0xf41a('0x2'));var BPromise=require(_0xf41a('0x3'));var rs=require(_0xf41a('0x4'));var fs=require('fs');var Redis=require(_0xf41a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf41a('0x6'));var logger=require(_0xf41a('0x7'))(_0xf41a('0x8'));var config=require(_0xf41a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf41a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ef8ca,_0x45f623,_0x56b0d3){return new BPromise(function(_0x20f46b,_0x4dbf59){return client['request'](_0x4ef8ca,_0x56b0d3)['then'](function(_0x437be6){logger['info'](_0xf41a('0xb'),_0x45f623,'request\x20sent');logger[_0xf41a('0xc')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x45f623,'request\x20sent',JSON[_0xf41a('0xd')](_0x437be6));if(_0x437be6[_0xf41a('0xe')]){if(_0x437be6[_0xf41a('0xe')]['code']===0x1f4){logger['error'](_0xf41a('0xb'),_0x45f623,_0x437be6[_0xf41a('0xe')][_0xf41a('0xf')]);return _0x4dbf59(_0x437be6[_0xf41a('0xe')][_0xf41a('0xf')]);}logger[_0xf41a('0xe')](_0xf41a('0xb'),_0x45f623,_0x437be6[_0xf41a('0xe')]['message']);return _0x20f46b(_0x437be6[_0xf41a('0xe')][_0xf41a('0xf')]);}else{logger[_0xf41a('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x45f623,_0xf41a('0x11'));_0x20f46b(_0x437be6[_0xf41a('0x12')]['message']);}})['catch'](function(_0x1c0321){logger['error'](_0xf41a('0xb'),_0x45f623,_0x1c0321);_0x4dbf59(_0x1c0321);});});} \ No newline at end of file +var _0x791c=['message','AnalyticFieldReport,\x20%s,\x20%s','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','request','info','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x6b9103,_0x49119a){var _0x2f23aa=function(_0x4947ea){while(--_0x4947ea){_0x6b9103['push'](_0x6b9103['shift']());}};_0x2f23aa(++_0x49119a);}(_0x791c,0x157));var _0xc791=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x791c[_0x158f01];return _0x5ef74e;};'use strict';var _=require(_0xc791('0x0'));var util=require(_0xc791('0x1'));var moment=require(_0xc791('0x2'));var BPromise=require(_0xc791('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc791('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc791('0x5'))(_0xc791('0x6'));var config=require(_0xc791('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49367d,_0x30bd0c,_0xf93461){return new BPromise(function(_0x3364b2,_0x5accad){return client[_0xc791('0x8')](_0x49367d,_0xf93461)['then'](function(_0x104b19){logger[_0xc791('0x9')]('AnalyticFieldReport,\x20%s,\x20%s',_0x30bd0c,_0xc791('0xa'));logger['debug'](_0xc791('0xb'),_0x30bd0c,'request\x20sent',JSON['stringify'](_0x104b19));if(_0x104b19['error']){if(_0x104b19[_0xc791('0xc')][_0xc791('0xd')]===0x1f4){logger[_0xc791('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x30bd0c,_0x104b19[_0xc791('0xc')][_0xc791('0xe')]);return _0x5accad(_0x104b19[_0xc791('0xc')]['message']);}logger[_0xc791('0xc')](_0xc791('0xf'),_0x30bd0c,_0x104b19[_0xc791('0xc')][_0xc791('0xe')]);return _0x3364b2(_0x104b19['error']['message']);}else{logger[_0xc791('0x9')](_0xc791('0xf'),_0x30bd0c,'request\x20sent');_0x3364b2(_0x104b19[_0xc791('0x10')][_0xc791('0xe')]);}})['catch'](function(_0x2d8cdd){logger[_0xc791('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x30bd0c,_0x2d8cdd);_0x5accad(_0x2d8cdd);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 67678fb..afd0283 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(_0x3372f0,_0x51f3dd){var _0xb3a6aa=function(_0x3d3a65){while(--_0x3d3a65){_0x3372f0['push'](_0x3372f0['shift']());}};_0xb3a6aa(++_0x51f3dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x42cbe2,_0x2458ff){var _0x117590=function(_0x1efa44){while(--_0x1efa44){_0x42cbe2['push'](_0x42cbe2['shift']());}};_0x117590(++_0x2458ff);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 3acfab8..17b8b27 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 _0xfb5d=['name','TEXT','sequelize','exports','STRING'];(function(_0x1ffff2,_0x3fb9b2){var _0x4ce615=function(_0xc0dbde){while(--_0xc0dbde){_0x1ffff2['push'](_0x1ffff2['shift']());}};_0x4ce615(++_0x3fb9b2);}(_0xfb5d,0x11a));var _0xdfb5=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfb5d[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xdfb5('0x0'));module[_0xdfb5('0x1')]={'name':{'type':Sequelize[_0xdfb5('0x2')],'allowNull':![],'unique':_0xdfb5('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xdfb5('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6599=['exports','STRING','name','TEXT'];(function(_0x4f6ea8,_0x191395){var _0x39f538=function(_0x8aa4c9){while(--_0x8aa4c9){_0x4f6ea8['push'](_0x4f6ea8['shift']());}};_0x39f538(++_0x191395);}(_0x6599,0xb0));var _0x9659=function(_0x55fa03,_0xcb96c2){_0x55fa03=_0x55fa03-0x0;var _0x2cd7cd=_0x6599[_0x55fa03];return _0x2cd7cd;};'use strict';var Sequelize=require('sequelize');module[_0x9659('0x0')]={'name':{'type':Sequelize[_0x9659('0x1')],'allowNull':![],'unique':_0x9659('0x2')},'table':{'type':Sequelize[_0x9659('0x1')]},'metric':{'type':Sequelize[_0x9659('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index f1e1cfa..b572d26 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 _0xe5b3=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x48ccfd,_0x5894c0){var _0x54b21a=function(_0x48766d){while(--_0x48766d){_0x48ccfd['push'](_0x48ccfd['shift']());}};_0x54b21a(++_0x5894c0);}(_0xe5b3,0x133));var _0x3e5b=function(_0x31f8cf,_0x25555f){_0x31f8cf=_0x31f8cf-0x0;var _0xdb54bb=_0xe5b3[_0x31f8cf];return _0xdb54bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){var _0x36d960=_0x1eb80f['get']({'plain':!![]});var _0x41b684=_0x3e5b('0x28');return db[_0x3e5b('0x29')][_0x3e5b('0x2a')]({'where':{'type':_0x41b684,'resourceId':_0x36d960['id']}})[_0x3e5b('0x27')](function(){return _0x1eb80f;});})[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4c4b89,_0x1c7278){return function(_0x505f40){if(!_0x505f40){_0x4c4b89[_0x3e5b('0x19')](0x194);}return _0x505f40;};}function handleError(_0x4fd64b,_0x101653){_0x101653=_0x101653||0x1f4;return function(_0x1f6473){logger[_0x3e5b('0x2b')](_0x1f6473[_0x3e5b('0x2c')]);if(_0x1f6473[_0x3e5b('0x2d')]){delete _0x1f6473[_0x3e5b('0x2d')];}_0x4fd64b[_0x3e5b('0x1b')](_0x101653)[_0x3e5b('0x2e')](_0x1f6473);};}exports[_0x3e5b('0x2f')]=function(_0x112dc0,_0x1e1565){var _0x489221={},_0x21bc10={},_0x1882aa={'count':0x0,'rows':[]};var _0xa8760b=_[_0x3e5b('0x30')](db[_0x3e5b('0x31')][_0x3e5b('0x32')],function(_0x345927){return{'name':_0x345927['fieldName'],'type':_0x345927[_0x3e5b('0x33')]['key']};});_0x21bc10['model']=_[_0x3e5b('0x30')](_0xa8760b,_0x3e5b('0x2d'));_0x21bc10['query']=_[_0x3e5b('0x34')](_0x112dc0[_0x3e5b('0x35')]);_0x21bc10[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],_0x21bc10[_0x3e5b('0x35')]);_0x489221[_0x3e5b('0x39')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],qs[_0x3e5b('0x3a')](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x489221['attributes']=_0x489221[_0x3e5b('0x39')][_0x3e5b('0x3b')]?_0x489221['attributes']:_0x21bc10['model'];if(!_0x112dc0[_0x3e5b('0x35')]['hasOwnProperty'](_0x3e5b('0x3c'))){_0x489221[_0x3e5b('0x1e')]=qs[_0x3e5b('0x1e')](_0x112dc0[_0x3e5b('0x35')]['limit']);_0x489221[_0x3e5b('0x20')]=qs['offset'](_0x112dc0[_0x3e5b('0x35')]['offset']);}_0x489221['order']=qs['sort'](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3d')]);_0x489221[_0x3e5b('0x3e')]=qs[_0x3e5b('0x36')](_[_0x3e5b('0x3f')](_0x112dc0[_0x3e5b('0x35')],_0x21bc10['filters']),_0xa8760b);if(_0x112dc0['query']['filter']){_0x489221['where']=_['merge'](_0x489221['where'],{'$or':_['map'](_0xa8760b,function(_0x182bc4){if(_0x182bc4[_0x3e5b('0x33')]!==_0x3e5b('0x40')){var _0x1aafd5={};_0x1aafd5[_0x182bc4[_0x3e5b('0x2d')]]={'$like':'%'+_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x41')]+'%'};return _0x1aafd5;}})});}_0x489221=_[_0x3e5b('0x42')]({},_0x489221,_0x112dc0[_0x3e5b('0x43')]);var _0xbbc6b={'where':_0x489221[_0x3e5b('0x3e')]};return db['AnalyticMetric'][_0x3e5b('0x1f')](_0xbbc6b)[_0x3e5b('0x27')](function(_0x1e8075){_0x1882aa[_0x3e5b('0x1f')]=_0x1e8075;if(_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x44')]){_0x489221[_0x3e5b('0x45')]=[{'all':!![]}];}return db[_0x3e5b('0x31')][_0x3e5b('0x46')](_0x489221);})[_0x3e5b('0x27')](function(_0x13c8d5){_0x1882aa['rows']=_0x13c8d5;return _0x1882aa;})['then'](respondWithFilteredResult(_0x1e1565,_0x489221))['catch'](handleError(_0x1e1565,null));};exports['show']=function(_0xa99d75,_0x21ee8a){var _0x9fc025={'raw':!![],'where':{'id':_0xa99d75[_0x3e5b('0x47')]['id']}},_0x24c416={};_0x24c416[_0x3e5b('0x38')]=_[_0x3e5b('0x34')](db[_0x3e5b('0x31')][_0x3e5b('0x32')]);_0x24c416[_0x3e5b('0x35')]=_['keys'](_0xa99d75[_0x3e5b('0x35')]);_0x24c416[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x24c416[_0x3e5b('0x38')],_0x24c416[_0x3e5b('0x35')]);_0x9fc025['attributes']=_['intersection'](_0x24c416['model'],qs[_0x3e5b('0x3a')](_0xa99d75[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x9fc025['attributes']=_0x9fc025['attributes'][_0x3e5b('0x3b')]?_0x9fc025[_0x3e5b('0x39')]:_0x24c416[_0x3e5b('0x38')];if(_0xa99d75['query']['includeAll']){_0x9fc025[_0x3e5b('0x45')]=[{'all':!![]}];}_0x9fc025=_['merge']({},_0x9fc025,_0xa99d75[_0x3e5b('0x43')]);return db[_0x3e5b('0x31')][_0x3e5b('0x48')](_0x9fc025)[_0x3e5b('0x27')](handleEntityNotFound(_0x21ee8a,null))[_0x3e5b('0x27')](respondWithResult(_0x21ee8a,null))[_0x3e5b('0x49')](handleError(_0x21ee8a,null));};exports[_0x3e5b('0x4a')]=function(_0x3ea5aa,_0x339852){return db['AnalyticMetric'][_0x3e5b('0x4a')](_0x3ea5aa['body'],{})[_0x3e5b('0x27')](function(_0x2e7047){var _0x26e11e=_0x3ea5aa[_0x3e5b('0x4b')][_0x3e5b('0x4c')]({'plain':!![]});if(!_0x26e11e)throw new Error(_0x3e5b('0x4d'));if(_0x26e11e[_0x3e5b('0x4e')]===_0x3e5b('0x4b')){var _0x2b5d3d=_0x2e7047[_0x3e5b('0x4c')]({'plain':!![]});var _0xf6ca5b=_0x3e5b('0x28');return db[_0x3e5b('0x4f')]['find']({'where':{'name':_0xf6ca5b,'userProfileId':_0x26e11e[_0x3e5b('0x50')]},'raw':!![]})[_0x3e5b('0x27')](function(_0x2ca33b){if(_0x2ca33b&&_0x2ca33b[_0x3e5b('0x51')]===0x0){return db[_0x3e5b('0x29')][_0x3e5b('0x4a')]({'name':_0x2b5d3d['name'],'resourceId':_0x2b5d3d['id'],'type':_0x2ca33b[_0x3e5b('0x2d')],'sectionId':_0x2ca33b['id']},{})[_0x3e5b('0x27')](function(){return _0x2e7047;});}else{return _0x2e7047;}})[_0x3e5b('0x49')](function(_0x314d42){logger[_0x3e5b('0x2b')](_0x3e5b('0x52'),_0x314d42);throw _0x314d42;});}return _0x2e7047;})[_0x3e5b('0x27')](respondWithResult(_0x339852,0xc9))[_0x3e5b('0x49')](handleError(_0x339852,null));};exports['update']=function(_0x1e6403,_0x5e702f){if(_0x1e6403['body']['id']){delete _0x1e6403[_0x3e5b('0x53')]['id'];}return db['AnalyticMetric'][_0x3e5b('0x48')]({'where':{'id':_0x1e6403[_0x3e5b('0x47')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x5e702f,null))[_0x3e5b('0x27')](saveUpdates(_0x1e6403['body'],null))['then'](respondWithResult(_0x5e702f,null))['catch'](handleError(_0x5e702f,null));};exports['destroy']=function(_0x2ab5f3,_0x999518){return db[_0x3e5b('0x31')][_0x3e5b('0x48')]({'where':{'id':_0x2ab5f3[_0x3e5b('0x47')]['id']}})['then'](handleEntityNotFound(_0x999518,null))['then'](removeEntity(_0x999518,null))[_0x3e5b('0x49')](handleError(_0x999518,null));}; \ No newline at end of file +var _0xd6d6=['includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','include','AnalyticMetric','rows','show'];(function(_0x3fc1be,_0x1b0360){var _0x1fa3dc=function(_0x5103d8){while(--_0x5103d8){_0x3fc1be['push'](_0x3fc1be['shift']());}};_0x1fa3dc(++_0x1b0360);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x18854a,_0x29c560){_0x18854a=_0x18854a-0x0;var _0x28c1f8=_0xd6d6[_0x18854a];return _0x28c1f8;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];function respondWithStatusCode(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xcc;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0x19')](_0xe61c36);}return _0x32146d[_0x6d6d('0x1a')](_0xe61c36)[_0x6d6d('0x1b')]();};}function respondWithResult(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0xc8;return function(_0xd09ea7){if(_0xd09ea7){return _0x2cb2dd[_0x6d6d('0x1a')](_0x5f4154)[_0x6d6d('0x1c')](_0xd09ea7);}};}function respondWithFilteredResult(_0xa3b05d,_0x29cbd8){return function(_0x5d80c0){if(_0x5d80c0){var _0x2e6fdb=typeof _0x29cbd8['offset']===_0x6d6d('0x1d')&&typeof _0x29cbd8[_0x6d6d('0x1e')]===_0x6d6d('0x1d');var _0x4bb3d1=_0x5d80c0['count'];var _0x9e1e18=_0x2e6fdb?0x0:_0x29cbd8[_0x6d6d('0x1f')];var _0x2b59d4=_0x2e6fdb?_0x5d80c0[_0x6d6d('0x20')]:_0x29cbd8['offset']+_0x29cbd8['limit'];var _0x474873;if(_0x2b59d4>=_0x4bb3d1){_0x2b59d4=_0x4bb3d1;_0x474873=0xc8;}else{_0x474873=0xce;}_0xa3b05d['status'](_0x474873);return _0xa3b05d[_0x6d6d('0x21')](_0x6d6d('0x22'),_0x9e1e18+'-'+_0x2b59d4+'/'+_0x4bb3d1)[_0x6d6d('0x1c')](_0x5d80c0);}return null;};}function patchUpdates(_0x450352){return function(_0x40d35b){try{jsonpatch[_0x6d6d('0x23')](_0x40d35b,_0x450352,!![]);}catch(_0x164c67){return BPromise[_0x6d6d('0x24')](_0x164c67);}return _0x40d35b[_0x6d6d('0x25')]();};}function saveUpdates(_0x6f64e3,_0x24b10d){return function(_0x6e58e3){if(_0x6e58e3){return _0x6e58e3[_0x6d6d('0x26')](_0x6f64e3)[_0x6d6d('0x27')](function(_0x1f7f88){return _0x1f7f88;});}return null;};}function removeEntity(_0x25a02e,_0xced622){return function(_0x583b10){if(_0x583b10){return _0x583b10[_0x6d6d('0x28')]()[_0x6d6d('0x27')](function(){var _0x99f7d6=_0x583b10[_0x6d6d('0x29')]({'plain':!![]});var _0xf0df7f=_0x6d6d('0x2a');return db['UserProfileResource'][_0x6d6d('0x28')]({'where':{'type':_0xf0df7f,'resourceId':_0x99f7d6['id']}})[_0x6d6d('0x27')](function(){return _0x583b10;});})[_0x6d6d('0x27')](function(){_0x25a02e[_0x6d6d('0x1a')](0xcc)[_0x6d6d('0x1b')]();});}};}function handleEntityNotFound(_0x408f98,_0x3641fc){return function(_0x4a57a1){if(!_0x4a57a1){_0x408f98[_0x6d6d('0x19')](0x194);}return _0x4a57a1;};}function handleError(_0x9595d8,_0x51bd68){_0x51bd68=_0x51bd68||0x1f4;return function(_0x553645){logger[_0x6d6d('0x2b')](_0x553645[_0x6d6d('0x2c')]);if(_0x553645[_0x6d6d('0x2d')]){delete _0x553645['name'];}_0x9595d8[_0x6d6d('0x1a')](_0x51bd68)[_0x6d6d('0x2e')](_0x553645);};}exports[_0x6d6d('0x2f')]=function(_0x1c8340,_0x64d1f7){var _0x428c17={},_0xdda3f2={},_0x359cfd={'count':0x0,'rows':[]};var _0x6c4741=_[_0x6d6d('0x30')](db['AnalyticMetric'][_0x6d6d('0x31')],function(_0x4f1fc5){return{'name':_0x4f1fc5[_0x6d6d('0x32')],'type':_0x4f1fc5[_0x6d6d('0x33')][_0x6d6d('0x34')]};});_0xdda3f2[_0x6d6d('0x35')]=_['map'](_0x6c4741,_0x6d6d('0x2d'));_0xdda3f2['query']=_[_0x6d6d('0x36')](_0x1c8340[_0x6d6d('0x37')]);_0xdda3f2['filters']=_[_0x6d6d('0x38')](_0xdda3f2[_0x6d6d('0x35')],_0xdda3f2[_0x6d6d('0x37')]);_0x428c17[_0x6d6d('0x39')]=_[_0x6d6d('0x38')](_0xdda3f2[_0x6d6d('0x35')],qs[_0x6d6d('0x3a')](_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x3a')]));_0x428c17[_0x6d6d('0x39')]=_0x428c17[_0x6d6d('0x39')][_0x6d6d('0x3b')]?_0x428c17[_0x6d6d('0x39')]:_0xdda3f2[_0x6d6d('0x35')];if(!_0x1c8340['query'][_0x6d6d('0x3c')](_0x6d6d('0x3d'))){_0x428c17[_0x6d6d('0x1e')]=qs[_0x6d6d('0x1e')](_0x1c8340['query']['limit']);_0x428c17[_0x6d6d('0x1f')]=qs[_0x6d6d('0x1f')](_0x1c8340[_0x6d6d('0x37')]['offset']);}_0x428c17[_0x6d6d('0x3e')]=qs[_0x6d6d('0x3f')](_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x3f')]);_0x428c17['where']=qs['filters'](_['pick'](_0x1c8340[_0x6d6d('0x37')],_0xdda3f2[_0x6d6d('0x40')]),_0x6c4741);if(_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x41')]){_0x428c17['where']=_[_0x6d6d('0x42')](_0x428c17[_0x6d6d('0x43')],{'$or':_[_0x6d6d('0x30')](_0x6c4741,function(_0x3c6d23){if(_0x3c6d23[_0x6d6d('0x33')]!==_0x6d6d('0x44')){var _0x4b457d={};_0x4b457d[_0x3c6d23[_0x6d6d('0x2d')]]={'$like':'%'+_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x41')]+'%'};return _0x4b457d;}})});}_0x428c17=_[_0x6d6d('0x42')]({},_0x428c17,_0x1c8340[_0x6d6d('0x45')]);var _0x3e27b7={'where':_0x428c17[_0x6d6d('0x43')]};return db['AnalyticMetric'][_0x6d6d('0x20')](_0x3e27b7)[_0x6d6d('0x27')](function(_0x16e177){_0x359cfd[_0x6d6d('0x20')]=_0x16e177;if(_0x1c8340[_0x6d6d('0x37')]['includeAll']){_0x428c17[_0x6d6d('0x46')]=[{'all':!![]}];}return db[_0x6d6d('0x47')]['findAll'](_0x428c17);})[_0x6d6d('0x27')](function(_0x50dc17){_0x359cfd[_0x6d6d('0x48')]=_0x50dc17;return _0x359cfd;})[_0x6d6d('0x27')](respondWithFilteredResult(_0x64d1f7,_0x428c17))['catch'](handleError(_0x64d1f7,null));};exports[_0x6d6d('0x49')]=function(_0x3324ec,_0x252cbe){var _0x4041f3={'raw':!![],'where':{'id':_0x3324ec['params']['id']}},_0xf7ea0d={};_0xf7ea0d['model']=_[_0x6d6d('0x36')](db['AnalyticMetric']['rawAttributes']);_0xf7ea0d[_0x6d6d('0x37')]=_[_0x6d6d('0x36')](_0x3324ec[_0x6d6d('0x37')]);_0xf7ea0d['filters']=_[_0x6d6d('0x38')](_0xf7ea0d['model'],_0xf7ea0d[_0x6d6d('0x37')]);_0x4041f3[_0x6d6d('0x39')]=_[_0x6d6d('0x38')](_0xf7ea0d[_0x6d6d('0x35')],qs[_0x6d6d('0x3a')](_0x3324ec[_0x6d6d('0x37')][_0x6d6d('0x3a')]));_0x4041f3['attributes']=_0x4041f3[_0x6d6d('0x39')][_0x6d6d('0x3b')]?_0x4041f3[_0x6d6d('0x39')]:_0xf7ea0d[_0x6d6d('0x35')];if(_0x3324ec[_0x6d6d('0x37')][_0x6d6d('0x4a')]){_0x4041f3[_0x6d6d('0x46')]=[{'all':!![]}];}_0x4041f3=_[_0x6d6d('0x42')]({},_0x4041f3,_0x3324ec[_0x6d6d('0x45')]);return db['AnalyticMetric']['find'](_0x4041f3)[_0x6d6d('0x27')](handleEntityNotFound(_0x252cbe,null))[_0x6d6d('0x27')](respondWithResult(_0x252cbe,null))[_0x6d6d('0x4b')](handleError(_0x252cbe,null));};exports[_0x6d6d('0x4c')]=function(_0xe2a20e,_0x492834){return db[_0x6d6d('0x47')][_0x6d6d('0x4c')](_0xe2a20e[_0x6d6d('0x4d')],{})[_0x6d6d('0x27')](function(_0x2ee917){var _0x23c2db=_0xe2a20e[_0x6d6d('0x4e')][_0x6d6d('0x29')]({'plain':!![]});if(!_0x23c2db)throw new Error(_0x6d6d('0x4f'));if(_0x23c2db[_0x6d6d('0x50')]===_0x6d6d('0x4e')){var _0x175e26=_0x2ee917['get']({'plain':!![]});var _0x190786=_0x6d6d('0x2a');return db[_0x6d6d('0x51')][_0x6d6d('0x52')]({'where':{'name':_0x190786,'userProfileId':_0x23c2db[_0x6d6d('0x53')]},'raw':!![]})['then'](function(_0x38c307){if(_0x38c307&&_0x38c307[_0x6d6d('0x54')]===0x0){return db[_0x6d6d('0x55')]['create']({'name':_0x175e26['name'],'resourceId':_0x175e26['id'],'type':_0x38c307[_0x6d6d('0x2d')],'sectionId':_0x38c307['id']},{})['then'](function(){return _0x2ee917;});}else{return _0x2ee917;}})[_0x6d6d('0x4b')](function(_0x995fe2){logger[_0x6d6d('0x2b')](_0x6d6d('0x56'),_0x995fe2);throw _0x995fe2;});}return _0x2ee917;})[_0x6d6d('0x27')](respondWithResult(_0x492834,0xc9))[_0x6d6d('0x4b')](handleError(_0x492834,null));};exports[_0x6d6d('0x26')]=function(_0x26c23a,_0x1a8f33){if(_0x26c23a[_0x6d6d('0x4d')]['id']){delete _0x26c23a['body']['id'];}return db[_0x6d6d('0x47')][_0x6d6d('0x52')]({'where':{'id':_0x26c23a[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x1a8f33,null))[_0x6d6d('0x27')](saveUpdates(_0x26c23a[_0x6d6d('0x4d')],null))[_0x6d6d('0x27')](respondWithResult(_0x1a8f33,null))['catch'](handleError(_0x1a8f33,null));};exports['destroy']=function(_0x3ad9b0,_0x122865){return db['AnalyticMetric'][_0x6d6d('0x52')]({'where':{'id':_0x3ad9b0[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x122865,null))[_0x6d6d('0x27')](removeEntity(_0x122865,null))[_0x6d6d('0x4b')](handleError(_0x122865,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 79d303f..ca7e502 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 _0xe944=['define','AnalyticMetric','analytics_metrics','lodash','api','request-promise','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x3eeeec,_0x12531a){var _0x1d0215=function(_0x2ef193){while(--_0x2ef193){_0x3eeeec['push'](_0x3eeeec['shift']());}};_0x1d0215(++_0x12531a);}(_0xe944,0x174));var _0x4e94=function(_0x26dd44,_0x2b4feb){_0x26dd44=_0x26dd44-0x0;var _0x568064=_0xe944[_0x26dd44];return _0x568064;};'use strict';var _=require(_0x4e94('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4e94('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4e94('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4e94('0x3'));var attributes=require(_0x4e94('0x4'));module[_0x4e94('0x5')]=function(_0xbb43ae,_0x4d00e5){return _0xbb43ae[_0x4e94('0x6')](_0x4e94('0x7'),attributes,{'tableName':_0x4e94('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed54=['../../config/logger','api','moment','request-promise','path','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','util'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0xed54,0xfc));var _0x4ed5=function(_0x50d17b,_0x17cc5e){_0x50d17b=_0x50d17b-0x0;var _0x35038b=_0xed54[_0x50d17b];return _0x35038b;};'use strict';var _=require('lodash');var util=require(_0x4ed5('0x0'));var logger=require(_0x4ed5('0x1'))(_0x4ed5('0x2'));var moment=require(_0x4ed5('0x3'));var BPromise=require('bluebird');var rp=require(_0x4ed5('0x4'));var fs=require('fs');var path=require(_0x4ed5('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4ed5('0x6'));module[_0x4ed5('0x7')]=function(_0x402687,_0x157c61){return _0x402687[_0x4ed5('0x8')](_0x4ed5('0x9'),attributes,{'tableName':_0x4ed5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index cf0cf32..762bd0d 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 _0x6570=['message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6570,0x178));var _0x0657=function(_0x47792b,_0x7bec64){_0x47792b=_0x47792b-0x0;var _0x9bd201=_0x6570[_0x47792b];return _0x9bd201;};'use strict';var _=require(_0x0657('0x0'));var util=require(_0x0657('0x1'));var moment=require(_0x0657('0x2'));var BPromise=require(_0x0657('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0657('0x4'))['db'];var utils=require(_0x0657('0x5'));var logger=require('../../config/logger')(_0x0657('0x6'));var config=require(_0x0657('0x7'));var jayson=require(_0x0657('0x8'));var client=jayson[_0x0657('0x9')][_0x0657('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd584d2,_0x1dc920,_0xcafe45){return new BPromise(function(_0x56fb80,_0x4e849a){return client[_0x0657('0xb')](_0xd584d2,_0xcafe45)['then'](function(_0x395466){logger[_0x0657('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x1dc920,_0x0657('0xd'));logger[_0x0657('0xe')](_0x0657('0xf'),_0x1dc920,_0x0657('0xd'),JSON[_0x0657('0x10')](_0x395466));if(_0x395466[_0x0657('0x11')]){if(_0x395466[_0x0657('0x11')][_0x0657('0x12')]===0x1f4){logger[_0x0657('0x11')](_0x0657('0x13'),_0x1dc920,_0x395466['error'][_0x0657('0x14')]);return _0x4e849a(_0x395466['error'][_0x0657('0x14')]);}logger[_0x0657('0x11')](_0x0657('0x13'),_0x1dc920,_0x395466[_0x0657('0x11')][_0x0657('0x14')]);return _0x56fb80(_0x395466['error'][_0x0657('0x14')]);}else{logger[_0x0657('0xc')](_0x0657('0x13'),_0x1dc920,_0x0657('0xd'));_0x56fb80(_0x395466[_0x0657('0x15')]['message']);}})['catch'](function(_0x37e70d){logger[_0x0657('0x11')](_0x0657('0x13'),_0x1dc920,_0x37e70d);_0x4e849a(_0x37e70d);});});} \ No newline at end of file +var _0x6c8f=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3e079f,_0x189e15){var _0x296a34=function(_0xa31a0a){while(--_0xa31a0a){_0x3e079f['push'](_0x3e079f['shift']());}};_0x296a34(++_0x189e15);}(_0x6c8f,0x17a));var _0xf6c8=function(_0x1e17cf,_0x1737a6){_0x1e17cf=_0x1e17cf-0x0;var _0x3de7d9=_0x6c8f[_0x1e17cf];return _0x3de7d9;};'use strict';var _=require(_0xf6c8('0x0'));var util=require(_0xf6c8('0x1'));var moment=require(_0xf6c8('0x2'));var BPromise=require(_0xf6c8('0x3'));var rs=require(_0xf6c8('0x4'));var fs=require('fs');var Redis=require(_0xf6c8('0x5'));var db=require(_0xf6c8('0x6'))['db'];var utils=require(_0xf6c8('0x7'));var logger=require(_0xf6c8('0x8'))('rpc');var config=require(_0xf6c8('0x9'));var jayson=require(_0xf6c8('0xa'));var client=jayson[_0xf6c8('0xb')][_0xf6c8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x176f81,_0x4fda9f,_0x540584){return new BPromise(function(_0x2e3dd5,_0x1d64e8){return client['request'](_0x176f81,_0x540584)[_0xf6c8('0xd')](function(_0x53a216){logger[_0xf6c8('0xe')](_0xf6c8('0xf'),_0x4fda9f,_0xf6c8('0x10'));logger[_0xf6c8('0x11')](_0xf6c8('0x12'),_0x4fda9f,_0xf6c8('0x10'),JSON['stringify'](_0x53a216));if(_0x53a216[_0xf6c8('0x13')]){if(_0x53a216[_0xf6c8('0x13')][_0xf6c8('0x14')]===0x1f4){logger['error'](_0xf6c8('0xf'),_0x4fda9f,_0x53a216['error'][_0xf6c8('0x15')]);return _0x1d64e8(_0x53a216[_0xf6c8('0x13')]['message']);}logger[_0xf6c8('0x13')](_0xf6c8('0xf'),_0x4fda9f,_0x53a216[_0xf6c8('0x13')]['message']);return _0x2e3dd5(_0x53a216[_0xf6c8('0x13')][_0xf6c8('0x15')]);}else{logger['info'](_0xf6c8('0xf'),_0x4fda9f,_0xf6c8('0x10'));_0x2e3dd5(_0x53a216[_0xf6c8('0x16')][_0xf6c8('0x15')]);}})[_0xf6c8('0x17')](function(_0x255c4c){logger['error'](_0xf6c8('0xf'),_0x4fda9f,_0x255c4c);_0x1d64e8(_0x255c4c);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 482d771..711eccd 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 _0xb2ac=['/:id','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated'];(function(_0x31f8db,_0x18e0f2){var _0x1209ed=function(_0x1731b4){while(--_0x1731b4){_0x31f8db['push'](_0x31f8db['shift']());}};_0x1209ed(++_0x18e0f2);}(_0xb2ac,0x16a));var _0xcb2a=function(_0x11d60b,_0x25bfb9){_0x11d60b=_0x11d60b-0x0;var _0xbaf23f=_0xb2ac[_0x11d60b];return _0xbaf23f;};'use strict';var multer=require(_0xcb2a('0x0'));var util=require(_0xcb2a('0x1'));var path=require(_0xcb2a('0x2'));var timeout=require(_0xcb2a('0x3'));var express=require(_0xcb2a('0x4'));var router=express[_0xcb2a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcb2a('0x6'));var interaction=require(_0xcb2a('0x7'));var config=require(_0xcb2a('0x8'));var controller=require(_0xcb2a('0x9'));router[_0xcb2a('0xa')]('/',auth[_0xcb2a('0xb')](),controller['index']);router[_0xcb2a('0xa')](_0xcb2a('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xcb2a('0xb')](),controller['create']);router[_0xcb2a('0xd')](_0xcb2a('0xc'),auth[_0xcb2a('0xb')](),controller[_0xcb2a('0xe')]);router[_0xcb2a('0xf')]('/:id',auth[_0xcb2a('0xb')](),controller[_0xcb2a('0x10')]);module['exports']=router; \ No newline at end of file +var _0x26d1=['connect-timeout','express','Router','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','multer','path'];(function(_0x152554,_0x2a3513){var _0x112dff=function(_0x138440){while(--_0x138440){_0x152554['push'](_0x152554['shift']());}};_0x112dff(++_0x2a3513);}(_0x26d1,0x8e));var _0x126d=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x26d1[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0x126d('0x0'));var util=require('util');var path=require(_0x126d('0x1'));var timeout=require(_0x126d('0x2'));var express=require(_0x126d('0x3'));var router=express[_0x126d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x126d('0x5'));var config=require('../../config/environment');var controller=require(_0x126d('0x6'));router[_0x126d('0x7')]('/',auth[_0x126d('0x8')](),controller[_0x126d('0x9')]);router[_0x126d('0x7')]('/:id',auth[_0x126d('0x8')](),controller[_0x126d('0xa')]);router[_0x126d('0xb')]('/',auth[_0x126d('0x8')](),controller[_0x126d('0xc')]);router[_0x126d('0xd')](_0x126d('0xe'),auth['isAuthenticated'](),controller[_0x126d('0xf')]);router[_0x126d('0x10')](_0x126d('0xe'),auth[_0x126d('0x8')](),controller[_0x126d('0x11')]);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 44ec4b3..e9ef761 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 _0xdedd=['exports','TEXT','sequelize'];(function(_0x9fb085,_0x2251a3){var _0x400c75=function(_0x1455ed){while(--_0x1455ed){_0x9fb085['push'](_0x9fb085['shift']());}};_0x400c75(++_0x2251a3);}(_0xdedd,0x155));var _0xdded=function(_0x4db29f,_0x3277d0){_0x4db29f=_0x4db29f-0x0;var _0x5aebdf=_0xdedd[_0x4db29f];return _0x5aebdf;};'use strict';var Sequelize=require(_0xdded('0x0'));module[_0xdded('0x1')]={'tree':{'type':Sequelize[_0xdded('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x147b=['sequelize','exports'];(function(_0x22c3eb,_0x3f814f){var _0x38ebe1=function(_0x375496){while(--_0x375496){_0x22c3eb['push'](_0x22c3eb['shift']());}};_0x38ebe1(++_0x3f814f);}(_0x147b,0x1ac));var _0xb147=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x147b[_0x57d13b];return _0x467696;};'use strict';var Sequelize=require(_0xb147('0x0'));module[_0xb147('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 234c246..9d50c6b 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 _0xfcbf=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x3b1b31,_0x37b158){var _0x19855d=function(_0x1a68fa){while(--_0x1a68fa){_0x3b1b31['push'](_0x3b1b31['shift']());}};_0x19855d(++_0x37b158);}(_0xfcbf,0x127));var _0xffcb=function(_0x2a75bb,_0x2fb7e4){_0x2a75bb=_0x2a75bb-0x0;var _0x394afa=_0xfcbf[_0x2a75bb];return _0x394afa;};'use strict';var emlformat=require(_0xffcb('0x0'));var rimraf=require(_0xffcb('0x1'));var zipdir=require(_0xffcb('0x2'));var jsonpatch=require(_0xffcb('0x3'));var rp=require('request-promise');var moment=require(_0xffcb('0x4'));var BPromise=require(_0xffcb('0x5'));var Mustache=require('mustache');var util=require(_0xffcb('0x6'));var path=require(_0xffcb('0x7'));var sox=require(_0xffcb('0x8'));var csv=require(_0xffcb('0x9'));var ejs=require(_0xffcb('0xa'));var fs=require('fs');var fs_extra=require(_0xffcb('0xb'));var _=require(_0xffcb('0xc'));var squel=require(_0xffcb('0xd'));var crypto=require(_0xffcb('0xe'));var jsforce=require(_0xffcb('0xf'));var deskjs=require(_0xffcb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xffcb('0x11'));var Papa=require(_0xffcb('0x12'));var Redis=require(_0xffcb('0x13'));var authService=require(_0xffcb('0x14'));var qs=require(_0xffcb('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xffcb('0x16'));var logger=require(_0xffcb('0x17'))(_0xffcb('0x18'));var utils=require(_0xffcb('0x19'));var config=require(_0xffcb('0x1a'));var licenseUtil=require(_0xffcb('0x1b'));var db=require(_0xffcb('0x1c'))['db'];function respondWithStatusCode(_0x5cd13a,_0x57ddda){_0x57ddda=_0x57ddda||0xcc;return function(_0xbb8b25){if(_0xbb8b25){return _0x5cd13a['sendStatus'](_0x57ddda);}return _0x5cd13a[_0xffcb('0x1d')](_0x57ddda)[_0xffcb('0x1e')]();};}function respondWithResult(_0x4d1f69,_0x7adb61){_0x7adb61=_0x7adb61||0xc8;return function(_0x328470){if(_0x328470){return _0x4d1f69[_0xffcb('0x1d')](_0x7adb61)[_0xffcb('0x1f')](_0x328470);}};}function respondWithFilteredResult(_0x4ceb51,_0x46a019){return function(_0x1e4c9e){if(_0x1e4c9e){var _0x1c680d=typeof _0x46a019['offset']==='undefined'&&typeof _0x46a019[_0xffcb('0x20')]===_0xffcb('0x21');var _0x24b283=_0x1e4c9e[_0xffcb('0x22')];var _0x5dbd0c=_0x1c680d?0x0:_0x46a019['offset'];var _0x2ff3a9=_0x1c680d?_0x1e4c9e[_0xffcb('0x22')]:_0x46a019[_0xffcb('0x23')]+_0x46a019[_0xffcb('0x20')];var _0x577aaf;if(_0x2ff3a9>=_0x24b283){_0x2ff3a9=_0x24b283;_0x577aaf=0xc8;}else{_0x577aaf=0xce;}_0x4ceb51[_0xffcb('0x1d')](_0x577aaf);return _0x4ceb51[_0xffcb('0x24')](_0xffcb('0x25'),_0x5dbd0c+'-'+_0x2ff3a9+'/'+_0x24b283)[_0xffcb('0x1f')](_0x1e4c9e);}return null;};}function patchUpdates(_0x20ebbe){return function(_0x20d15e){try{jsonpatch['apply'](_0x20d15e,_0x20ebbe,!![]);}catch(_0x548c8b){return BPromise[_0xffcb('0x26')](_0x548c8b);}return _0x20d15e['save']();};}function saveUpdates(_0x46c736,_0x2b015d){return function(_0x10d3c5){if(_0x10d3c5){return _0x10d3c5[_0xffcb('0x27')](_0x46c736)[_0xffcb('0x28')](function(_0x3338ff){return _0x3338ff;});}return null;};}function removeEntity(_0x7d4945,_0x20e4d1){return function(_0x49be61){if(_0x49be61){return _0x49be61[_0xffcb('0x29')]()[_0xffcb('0x28')](function(){_0x7d4945[_0xffcb('0x1d')](0xcc)[_0xffcb('0x1e')]();});}};}function handleEntityNotFound(_0x4e292f,_0xc46226){return function(_0x43e3c7){if(!_0x43e3c7){_0x4e292f['sendStatus'](0x194);}return _0x43e3c7;};}function handleError(_0x54deb0,_0x406a6f){_0x406a6f=_0x406a6f||0x1f4;return function(_0x43bf59){logger[_0xffcb('0x2a')](_0x43bf59[_0xffcb('0x2b')]);if(_0x43bf59[_0xffcb('0x2c')]){delete _0x43bf59['name'];}_0x54deb0['status'](_0x406a6f)[_0xffcb('0x2d')](_0x43bf59);};}exports[_0xffcb('0x2e')]=function(_0x3ff4e8,_0x446c8e){var _0x2d5210={},_0x4705f4={},_0x5f2886={'count':0x0,'rows':[]};var _0x329eb0=_[_0xffcb('0x2f')](db[_0xffcb('0x30')][_0xffcb('0x31')],function(_0xe383e9){return{'name':_0xe383e9[_0xffcb('0x32')],'type':_0xe383e9[_0xffcb('0x33')][_0xffcb('0x34')]};});_0x4705f4[_0xffcb('0x35')]=_[_0xffcb('0x2f')](_0x329eb0,_0xffcb('0x2c'));_0x4705f4['query']=_[_0xffcb('0x36')](_0x3ff4e8[_0xffcb('0x37')]);_0x4705f4[_0xffcb('0x38')]=_[_0xffcb('0x39')](_0x4705f4[_0xffcb('0x35')],_0x4705f4[_0xffcb('0x37')]);_0x2d5210['attributes']=_['intersection'](_0x4705f4[_0xffcb('0x35')],qs[_0xffcb('0x3a')](_0x3ff4e8[_0xffcb('0x37')][_0xffcb('0x3a')]));_0x2d5210[_0xffcb('0x3b')]=_0x2d5210[_0xffcb('0x3b')][_0xffcb('0x3c')]?_0x2d5210['attributes']:_0x4705f4[_0xffcb('0x35')];if(!_0x3ff4e8['query'][_0xffcb('0x3d')]('nolimit')){_0x2d5210[_0xffcb('0x20')]=qs[_0xffcb('0x20')](_0x3ff4e8[_0xffcb('0x37')][_0xffcb('0x20')]);_0x2d5210['offset']=qs[_0xffcb('0x23')](_0x3ff4e8[_0xffcb('0x37')][_0xffcb('0x23')]);}_0x2d5210['order']=qs[_0xffcb('0x3e')](_0x3ff4e8[_0xffcb('0x37')][_0xffcb('0x3e')]);_0x2d5210[_0xffcb('0x3f')]=qs[_0xffcb('0x38')](_['pick'](_0x3ff4e8[_0xffcb('0x37')],_0x4705f4['filters']),_0x329eb0);if(_0x3ff4e8[_0xffcb('0x37')][_0xffcb('0x40')]){_0x2d5210['where']=_[_0xffcb('0x41')](_0x2d5210[_0xffcb('0x3f')],{'$or':_[_0xffcb('0x2f')](_0x329eb0,function(_0x458afb){if(_0x458afb['type']!==_0xffcb('0x42')){var _0x5c9134={};_0x5c9134[_0x458afb[_0xffcb('0x2c')]]={'$like':'%'+_0x3ff4e8[_0xffcb('0x37')][_0xffcb('0x40')]+'%'};return _0x5c9134;}})});}_0x2d5210=_[_0xffcb('0x41')]({},_0x2d5210,_0x3ff4e8['options']);var _0x1e4376={'where':_0x2d5210[_0xffcb('0x3f')]};return db[_0xffcb('0x30')][_0xffcb('0x22')](_0x1e4376)[_0xffcb('0x28')](function(_0x2b60a0){_0x5f2886[_0xffcb('0x22')]=_0x2b60a0;if(_0x3ff4e8[_0xffcb('0x37')][_0xffcb('0x43')]){_0x2d5210[_0xffcb('0x44')]=[{'all':!![]}];}return db[_0xffcb('0x30')][_0xffcb('0x45')](_0x2d5210);})[_0xffcb('0x28')](function(_0x2d659e){_0x5f2886[_0xffcb('0x46')]=_0x2d659e;return _0x5f2886;})['then'](respondWithFilteredResult(_0x446c8e,_0x2d5210))[_0xffcb('0x47')](handleError(_0x446c8e,null));};exports[_0xffcb('0x48')]=function(_0x7e8683,_0x19eca7){var _0x3e41d9={'raw':!![],'where':{'id':_0x7e8683['params']['id']}},_0x33f34f={};_0x33f34f[_0xffcb('0x35')]=_[_0xffcb('0x36')](db[_0xffcb('0x30')][_0xffcb('0x31')]);_0x33f34f['query']=_['keys'](_0x7e8683[_0xffcb('0x37')]);_0x33f34f[_0xffcb('0x38')]=_[_0xffcb('0x39')](_0x33f34f[_0xffcb('0x35')],_0x33f34f[_0xffcb('0x37')]);_0x3e41d9['attributes']=_[_0xffcb('0x39')](_0x33f34f[_0xffcb('0x35')],qs[_0xffcb('0x3a')](_0x7e8683['query'][_0xffcb('0x3a')]));_0x3e41d9['attributes']=_0x3e41d9['attributes'][_0xffcb('0x3c')]?_0x3e41d9[_0xffcb('0x3b')]:_0x33f34f[_0xffcb('0x35')];if(_0x7e8683['query'][_0xffcb('0x43')]){_0x3e41d9[_0xffcb('0x44')]=[{'all':!![]}];}_0x3e41d9=_[_0xffcb('0x41')]({},_0x3e41d9,_0x7e8683[_0xffcb('0x49')]);return db[_0xffcb('0x30')]['find'](_0x3e41d9)[_0xffcb('0x28')](handleEntityNotFound(_0x19eca7,null))['then'](respondWithResult(_0x19eca7,null))[_0xffcb('0x47')](handleError(_0x19eca7,null));};exports['create']=function(_0x4f2081,_0x35857f){return db[_0xffcb('0x30')][_0xffcb('0x4a')](_0x4f2081[_0xffcb('0x4b')],{})[_0xffcb('0x28')](respondWithResult(_0x35857f,0xc9))['catch'](handleError(_0x35857f,null));};exports[_0xffcb('0x27')]=function(_0x5caf67,_0x56f1c1){if(_0x5caf67[_0xffcb('0x4b')]['id']){delete _0x5caf67[_0xffcb('0x4b')]['id'];}return db[_0xffcb('0x30')]['find']({'where':{'id':_0x5caf67[_0xffcb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x56f1c1,null))['then'](saveUpdates(_0x5caf67[_0xffcb('0x4b')],null))[_0xffcb('0x28')](respondWithResult(_0x56f1c1,null))[_0xffcb('0x47')](handleError(_0x56f1c1,null));};exports[_0xffcb('0x29')]=function(_0x57c404,_0x2185a8){return db[_0xffcb('0x30')]['find']({'where':{'id':_0x57c404[_0xffcb('0x4c')]['id']}})[_0xffcb('0x28')](handleEntityNotFound(_0x2185a8,null))[_0xffcb('0x28')](removeEntity(_0x2185a8,null))[_0xffcb('0x47')](handleError(_0x2185a8,null));}; \ No newline at end of file +var _0x20f0=['filter','merge','includeAll','findAll','rows','params','include','options','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','destroy','then','error','stack','name','send','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick'];(function(_0xbf87c8,_0x5b8a16){var _0x586888=function(_0x5753c0){while(--_0x5753c0){_0xbf87c8['push'](_0xbf87c8['shift']());}};_0x586888(++_0x5b8a16);}(_0x20f0,0x139));var _0x020f=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x20f0[_0x40a825];return _0x273a54;};'use strict';var emlformat=require(_0x020f('0x0'));var rimraf=require(_0x020f('0x1'));var zipdir=require(_0x020f('0x2'));var jsonpatch=require(_0x020f('0x3'));var rp=require(_0x020f('0x4'));var moment=require(_0x020f('0x5'));var BPromise=require(_0x020f('0x6'));var Mustache=require('mustache');var util=require(_0x020f('0x7'));var path=require(_0x020f('0x8'));var sox=require(_0x020f('0x9'));var csv=require(_0x020f('0xa'));var ejs=require(_0x020f('0xb'));var fs=require('fs');var fs_extra=require(_0x020f('0xc'));var _=require(_0x020f('0xd'));var squel=require(_0x020f('0xe'));var crypto=require(_0x020f('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x020f('0x10'));var Papa=require('papaparse');var Redis=require(_0x020f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x020f('0x12'));var as=require(_0x020f('0x13'));var hardwareService=require(_0x020f('0x14'));var logger=require(_0x020f('0x15'))(_0x020f('0x16'));var utils=require(_0x020f('0x17'));var config=require(_0x020f('0x18'));var licenseUtil=require(_0x020f('0x19'));var db=require(_0x020f('0x1a'))['db'];function respondWithStatusCode(_0x5f55ef,_0x441ea3){_0x441ea3=_0x441ea3||0xcc;return function(_0x25c3fe){if(_0x25c3fe){return _0x5f55ef[_0x020f('0x1b')](_0x441ea3);}return _0x5f55ef[_0x020f('0x1c')](_0x441ea3)[_0x020f('0x1d')]();};}function respondWithResult(_0x2d4d74,_0x43ceab){_0x43ceab=_0x43ceab||0xc8;return function(_0x4d1c0e){if(_0x4d1c0e){return _0x2d4d74[_0x020f('0x1c')](_0x43ceab)[_0x020f('0x1e')](_0x4d1c0e);}};}function respondWithFilteredResult(_0x5367f6,_0x4f6b2f){return function(_0x52d73b){if(_0x52d73b){var _0x53eb5f=typeof _0x4f6b2f['offset']===_0x020f('0x1f')&&typeof _0x4f6b2f[_0x020f('0x20')]==='undefined';var _0x4aa2bf=_0x52d73b[_0x020f('0x21')];var _0x261beb=_0x53eb5f?0x0:_0x4f6b2f[_0x020f('0x22')];var _0x22f47d=_0x53eb5f?_0x52d73b[_0x020f('0x21')]:_0x4f6b2f['offset']+_0x4f6b2f[_0x020f('0x20')];var _0x34c597;if(_0x22f47d>=_0x4aa2bf){_0x22f47d=_0x4aa2bf;_0x34c597=0xc8;}else{_0x34c597=0xce;}_0x5367f6[_0x020f('0x1c')](_0x34c597);return _0x5367f6['set']('Content-Range',_0x261beb+'-'+_0x22f47d+'/'+_0x4aa2bf)[_0x020f('0x1e')](_0x52d73b);}return null;};}function patchUpdates(_0x51813d){return function(_0x12e8e5){try{jsonpatch[_0x020f('0x23')](_0x12e8e5,_0x51813d,!![]);}catch(_0x2e590f){return BPromise[_0x020f('0x24')](_0x2e590f);}return _0x12e8e5[_0x020f('0x25')]();};}function saveUpdates(_0x30aca1,_0x3f3d21){return function(_0x1c76cd){if(_0x1c76cd){return _0x1c76cd['update'](_0x30aca1)['then'](function(_0x436d85){return _0x436d85;});}return null;};}function removeEntity(_0x505104,_0x5a0eea){return function(_0x5a2063){if(_0x5a2063){return _0x5a2063[_0x020f('0x26')]()[_0x020f('0x27')](function(){_0x505104[_0x020f('0x1c')](0xcc)[_0x020f('0x1d')]();});}};}function handleEntityNotFound(_0x3ab375,_0x4d953e){return function(_0x4b95a7){if(!_0x4b95a7){_0x3ab375['sendStatus'](0x194);}return _0x4b95a7;};}function handleError(_0x16309d,_0x361daa){_0x361daa=_0x361daa||0x1f4;return function(_0x3a46ff){logger[_0x020f('0x28')](_0x3a46ff[_0x020f('0x29')]);if(_0x3a46ff['name']){delete _0x3a46ff[_0x020f('0x2a')];}_0x16309d[_0x020f('0x1c')](_0x361daa)[_0x020f('0x2b')](_0x3a46ff);};}exports['index']=function(_0x450870,_0x346b03){var _0x3b9c92={},_0x2e0edb={},_0x1d1f64={'count':0x0,'rows':[]};var _0x1b835b=_['map'](db[_0x020f('0x2c')][_0x020f('0x2d')],function(_0x564dee){return{'name':_0x564dee[_0x020f('0x2e')],'type':_0x564dee[_0x020f('0x2f')][_0x020f('0x30')]};});_0x2e0edb[_0x020f('0x31')]=_[_0x020f('0x32')](_0x1b835b,_0x020f('0x2a'));_0x2e0edb[_0x020f('0x33')]=_[_0x020f('0x34')](_0x450870[_0x020f('0x33')]);_0x2e0edb[_0x020f('0x35')]=_['intersection'](_0x2e0edb[_0x020f('0x31')],_0x2e0edb[_0x020f('0x33')]);_0x3b9c92[_0x020f('0x36')]=_[_0x020f('0x37')](_0x2e0edb[_0x020f('0x31')],qs[_0x020f('0x38')](_0x450870[_0x020f('0x33')][_0x020f('0x38')]));_0x3b9c92['attributes']=_0x3b9c92[_0x020f('0x36')]['length']?_0x3b9c92[_0x020f('0x36')]:_0x2e0edb[_0x020f('0x31')];if(!_0x450870['query'][_0x020f('0x39')]('nolimit')){_0x3b9c92[_0x020f('0x20')]=qs['limit'](_0x450870[_0x020f('0x33')][_0x020f('0x20')]);_0x3b9c92[_0x020f('0x22')]=qs[_0x020f('0x22')](_0x450870['query'][_0x020f('0x22')]);}_0x3b9c92[_0x020f('0x3a')]=qs[_0x020f('0x3b')](_0x450870[_0x020f('0x33')][_0x020f('0x3b')]);_0x3b9c92[_0x020f('0x3c')]=qs[_0x020f('0x35')](_[_0x020f('0x3d')](_0x450870[_0x020f('0x33')],_0x2e0edb[_0x020f('0x35')]),_0x1b835b);if(_0x450870[_0x020f('0x33')][_0x020f('0x3e')]){_0x3b9c92['where']=_[_0x020f('0x3f')](_0x3b9c92['where'],{'$or':_[_0x020f('0x32')](_0x1b835b,function(_0x51389c){if(_0x51389c[_0x020f('0x2f')]!=='VIRTUAL'){var _0x24807c={};_0x24807c[_0x51389c[_0x020f('0x2a')]]={'$like':'%'+_0x450870[_0x020f('0x33')][_0x020f('0x3e')]+'%'};return _0x24807c;}})});}_0x3b9c92=_[_0x020f('0x3f')]({},_0x3b9c92,_0x450870['options']);var _0x27bcb5={'where':_0x3b9c92[_0x020f('0x3c')]};return db[_0x020f('0x2c')]['count'](_0x27bcb5)[_0x020f('0x27')](function(_0x5db097){_0x1d1f64[_0x020f('0x21')]=_0x5db097;if(_0x450870['query'][_0x020f('0x40')]){_0x3b9c92['include']=[{'all':!![]}];}return db[_0x020f('0x2c')][_0x020f('0x41')](_0x3b9c92);})[_0x020f('0x27')](function(_0x1d6f6b){_0x1d1f64[_0x020f('0x42')]=_0x1d6f6b;return _0x1d1f64;})[_0x020f('0x27')](respondWithFilteredResult(_0x346b03,_0x3b9c92))['catch'](handleError(_0x346b03,null));};exports['show']=function(_0xb23e9b,_0x18f942){var _0x2da2ad={'raw':!![],'where':{'id':_0xb23e9b[_0x020f('0x43')]['id']}},_0x79c998={};_0x79c998[_0x020f('0x31')]=_[_0x020f('0x34')](db[_0x020f('0x2c')][_0x020f('0x2d')]);_0x79c998['query']=_[_0x020f('0x34')](_0xb23e9b['query']);_0x79c998[_0x020f('0x35')]=_['intersection'](_0x79c998['model'],_0x79c998[_0x020f('0x33')]);_0x2da2ad[_0x020f('0x36')]=_[_0x020f('0x37')](_0x79c998[_0x020f('0x31')],qs['fields'](_0xb23e9b[_0x020f('0x33')][_0x020f('0x38')]));_0x2da2ad[_0x020f('0x36')]=_0x2da2ad['attributes']['length']?_0x2da2ad['attributes']:_0x79c998[_0x020f('0x31')];if(_0xb23e9b['query']['includeAll']){_0x2da2ad[_0x020f('0x44')]=[{'all':!![]}];}_0x2da2ad=_['merge']({},_0x2da2ad,_0xb23e9b[_0x020f('0x45')]);return db[_0x020f('0x2c')][_0x020f('0x46')](_0x2da2ad)[_0x020f('0x27')](handleEntityNotFound(_0x18f942,null))[_0x020f('0x27')](respondWithResult(_0x18f942,null))[_0x020f('0x47')](handleError(_0x18f942,null));};exports['create']=function(_0x569599,_0x383e88){return db[_0x020f('0x2c')][_0x020f('0x48')](_0x569599[_0x020f('0x49')],{})[_0x020f('0x27')](respondWithResult(_0x383e88,0xc9))[_0x020f('0x47')](handleError(_0x383e88,null));};exports[_0x020f('0x4a')]=function(_0x1e9a3d,_0x5ec6e7){if(_0x1e9a3d[_0x020f('0x49')]['id']){delete _0x1e9a3d[_0x020f('0x49')]['id'];}return db[_0x020f('0x2c')][_0x020f('0x46')]({'where':{'id':_0x1e9a3d['params']['id']}})[_0x020f('0x27')](handleEntityNotFound(_0x5ec6e7,null))[_0x020f('0x27')](saveUpdates(_0x1e9a3d['body'],null))[_0x020f('0x27')](respondWithResult(_0x5ec6e7,null))['catch'](handleError(_0x5ec6e7,null));};exports[_0x020f('0x26')]=function(_0xdc1c0f,_0x3a2502){return db['AnalyticTreeReport'][_0x020f('0x46')]({'where':{'id':_0xdc1c0f[_0x020f('0x43')]['id']}})[_0x020f('0x27')](handleEntityNotFound(_0x3a2502,null))[_0x020f('0x27')](removeEntity(_0x3a2502,null))[_0x020f('0x47')](handleError(_0x3a2502,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index ecd2c3d..b37c39a 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 _0x9e77=['bluebird','request-promise','path','rimraf','../../config/environment','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x9e77,0x8b));var _0x79e7=function(_0xb0e109,_0x224a24){_0xb0e109=_0xb0e109-0x0;var _0x226bb1=_0x9e77[_0xb0e109];return _0x226bb1;};'use strict';var _=require(_0x79e7('0x0'));var util=require(_0x79e7('0x1'));var logger=require(_0x79e7('0x2'))(_0x79e7('0x3'));var moment=require(_0x79e7('0x4'));var BPromise=require(_0x79e7('0x5'));var rp=require(_0x79e7('0x6'));var fs=require('fs');var path=require(_0x79e7('0x7'));var rimraf=require(_0x79e7('0x8'));var config=require(_0x79e7('0x9'));var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x134528,_0x2c071e){return _0x134528['define'](_0x79e7('0xa'),attributes,{'tableName':_0x79e7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33c7=['rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x355adc,_0xac51ab){var _0x4df04f=function(_0x4a787d){while(--_0x4a787d){_0x355adc['push'](_0x355adc['shift']());}};_0x4df04f(++_0xac51ab);}(_0x33c7,0x89));var _0x733c=function(_0x2e8b77,_0x5d473c){_0x2e8b77=_0x2e8b77-0x0;var _0xe01d2b=_0x33c7[_0x2e8b77];return _0xe01d2b;};'use strict';var _=require(_0x733c('0x0'));var util=require(_0x733c('0x1'));var logger=require(_0x733c('0x2'))(_0x733c('0x3'));var moment=require(_0x733c('0x4'));var BPromise=require(_0x733c('0x5'));var rp=require(_0x733c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x733c('0x7'));var config=require(_0x733c('0x8'));var attributes=require(_0x733c('0x9'));module[_0x733c('0xa')]=function(_0x349359,_0x375fd4){return _0x349359['define'](_0x733c('0xb'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index cda214e..de7a992 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xc5e02a,_0xd9da3c){var _0xbeca77=function(_0x2a7d11){while(--_0x2a7d11){_0xc5e02a['push'](_0xc5e02a['shift']());}};_0xbeca77(++_0xd9da3c);}(_0xadb5,0xad));var _0x5adb=function(_0x563b51,_0x353585){_0x563b51=_0x563b51-0x0;var _0x2493b7=_0xadb5[_0x563b51];return _0x2493b7;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x7a54=['info','AnalyticTreeReport,\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(_0x1e007f,_0x3fb459){_0x1e007f=_0x1e007f-0x0;var _0x99934e=_0x7a54[_0x1e007f];return _0x99934e;};'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')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 3a86845..6ca7498 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 _0x7e49=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','show','post','put','update','destroy','exports','util','express','Router','fs-extra'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x7e49,0x9e));var _0x97e4=function(_0x516114,_0x31201b){_0x516114=_0x516114-0x0;var _0x772fe4=_0x7e49[_0x516114];return _0x772fe4;};'use strict';var multer=require('multer');var util=require(_0x97e4('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x97e4('0x1'));var router=express[_0x97e4('0x2')]();var fs_extra=require(_0x97e4('0x3'));var auth=require(_0x97e4('0x4'));var interaction=require(_0x97e4('0x5'));var config=require(_0x97e4('0x6'));var controller=require(_0x97e4('0x7'));router['get']('/',auth[_0x97e4('0x8')](),controller[_0x97e4('0x9')]);router[_0x97e4('0xa')](_0x97e4('0xb'),auth[_0x97e4('0x8')](),controller[_0x97e4('0xc')]);router[_0x97e4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x97e4('0xe')](_0x97e4('0xb'),auth[_0x97e4('0x8')](),controller[_0x97e4('0xf')]);router['delete'](_0x97e4('0xb'),auth[_0x97e4('0x8')](),controller[_0x97e4('0x10')]);module[_0x97e4('0x11')]=router; \ No newline at end of file +var _0x7483=['../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','show','post','put','/:id','update','destroy','exports','util','fs-extra'];(function(_0x540b6c,_0x21b580){var _0xa9cb76=function(_0x46e031){while(--_0x46e031){_0x540b6c['push'](_0x540b6c['shift']());}};_0xa9cb76(++_0x21b580);}(_0x7483,0x148));var _0x3748=function(_0x389bb2,_0x11ba20){_0x389bb2=_0x389bb2-0x0;var _0x37cc1e=_0x7483[_0x389bb2];return _0x37cc1e;};'use strict';var multer=require('multer');var util=require(_0x3748('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x3748('0x1'));var auth=require(_0x3748('0x2'));var interaction=require(_0x3748('0x3'));var config=require('../../config/environment');var controller=require(_0x3748('0x4'));router[_0x3748('0x5')]('/',auth[_0x3748('0x6')](),controller[_0x3748('0x7')]);router[_0x3748('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x3748('0x8')]);router[_0x3748('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3748('0xa')](_0x3748('0xb'),auth[_0x3748('0x6')](),controller[_0x3748('0xc')]);router['delete'](_0x3748('0xb'),auth[_0x3748('0x6')](),controller[_0x3748('0xd')]);module[_0x3748('0xe')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index df146f1..75a5ef5 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 _0x8d9b=['exports','STRING','sequelize'];(function(_0x42ffc1,_0x840bd){var _0x571f3d=function(_0xd62fe5){while(--_0xd62fe5){_0x42ffc1['push'](_0x42ffc1['shift']());}};_0x571f3d(++_0x840bd);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb8d9('0x0'));module[_0xb8d9('0x1')]={'name':{'type':Sequelize[_0xb8d9('0x2')]},'basename':{'type':Sequelize[_0xb8d9('0x2')]},'type':{'type':Sequelize[_0xb8d9('0x2')]}}; \ No newline at end of file +var _0x0851=['sequelize','exports','STRING'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0x0851,0x8a));var _0x1085=function(_0x403484,_0x33b8ba){_0x403484=_0x403484-0x0;var _0x55b2bc=_0x0851[_0x403484];return _0x55b2bc;};'use strict';var Sequelize=require(_0x1085('0x0'));module[_0x1085('0x1')]={'name':{'type':Sequelize[_0x1085('0x2')]},'basename':{'type':Sequelize[_0x1085('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 5f5b360..43c71a9 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 _0xeae0=['findAll','rows','catch','show','keys','rawAttributes','include','find','params','get','createdAt','updatedAt','body','omit','create','file','originalname','basename','mimetype','download','findOne','root','offline-chat/','join','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','end','error','stack','name','send','index','map','Attachment','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','then','includeAll'];(function(_0x3f477c,_0x52b7ff){var _0x4c36b3=function(_0x3b47bb){while(--_0x3b47bb){_0x3f477c['push'](_0x3f477c['shift']());}};_0x4c36b3(++_0x52b7ff);}(_0xeae0,0xc6));var _0x0eae=function(_0x2ab365,_0xa3812e){_0x2ab365=_0x2ab365-0x0;var _0x49fef3=_0xeae0[_0x2ab365];return _0x49fef3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0eae('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0eae('0x1'));var rp=require(_0x0eae('0x2'));var moment=require('moment');var BPromise=require(_0x0eae('0x3'));var Mustache=require(_0x0eae('0x4'));var util=require('util');var path=require(_0x0eae('0x5'));var sox=require(_0x0eae('0x6'));var csv=require(_0x0eae('0x7'));var ejs=require(_0x0eae('0x8'));var fs=require('fs');var fs_extra=require(_0x0eae('0x9'));var _=require(_0x0eae('0xa'));var squel=require('squel');var crypto=require(_0x0eae('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0eae('0xc'));var Papa=require('papaparse');var Redis=require(_0x0eae('0xd'));var authService=require(_0x0eae('0xe'));var qs=require(_0x0eae('0xf'));var as=require(_0x0eae('0x10'));var hardwareService=require(_0x0eae('0x11'));var logger=require(_0x0eae('0x12'))(_0x0eae('0x13'));var utils=require(_0x0eae('0x14'));var config=require(_0x0eae('0x15'));var licenseUtil=require(_0x0eae('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x201b09,_0x1fba5c){_0x1fba5c=_0x1fba5c||0xcc;return function(_0x1b0726){if(_0x1b0726){return _0x201b09[_0x0eae('0x17')](_0x1fba5c);}return _0x201b09[_0x0eae('0x18')](_0x1fba5c)['end']();};}function respondWithResult(_0x18cae6,_0x2a1eb0){_0x2a1eb0=_0x2a1eb0||0xc8;return function(_0x2e5d6e){if(_0x2e5d6e){return _0x18cae6[_0x0eae('0x18')](_0x2a1eb0)[_0x0eae('0x19')](_0x2e5d6e);}};}function respondWithFilteredResult(_0x524cfc,_0x256426){return function(_0x41fc17){if(_0x41fc17){var _0x148a2e=typeof _0x256426[_0x0eae('0x1a')]===_0x0eae('0x1b')&&typeof _0x256426[_0x0eae('0x1c')]===_0x0eae('0x1b');var _0x13f632=_0x41fc17[_0x0eae('0x1d')];var _0x38463d=_0x148a2e?0x0:_0x256426[_0x0eae('0x1a')];var _0x23ba48=_0x148a2e?_0x41fc17['count']:_0x256426[_0x0eae('0x1a')]+_0x256426[_0x0eae('0x1c')];var _0x1e1184;if(_0x23ba48>=_0x13f632){_0x23ba48=_0x13f632;_0x1e1184=0xc8;}else{_0x1e1184=0xce;}_0x524cfc[_0x0eae('0x18')](_0x1e1184);return _0x524cfc[_0x0eae('0x1e')](_0x0eae('0x1f'),_0x38463d+'-'+_0x23ba48+'/'+_0x13f632)[_0x0eae('0x19')](_0x41fc17);}return null;};}function patchUpdates(_0x4f7ceb){return function(_0x2d02f3){try{jsonpatch['apply'](_0x2d02f3,_0x4f7ceb,!![]);}catch(_0x22b646){return BPromise[_0x0eae('0x20')](_0x22b646);}return _0x2d02f3['save']();};}function saveUpdates(_0x3191d7,_0x35da32){return function(_0x2018e2){if(_0x2018e2){return _0x2018e2[_0x0eae('0x21')](_0x3191d7)['then'](function(_0x494590){return _0x494590;});}return null;};}function removeEntity(_0x3309b5,_0x5a1ef0){return function(_0x17a47e){if(_0x17a47e){return _0x17a47e[_0x0eae('0x22')]()['then'](function(){_0x3309b5[_0x0eae('0x18')](0xcc)[_0x0eae('0x23')]();});}};}function handleEntityNotFound(_0x348765,_0x2407cc){return function(_0x2db4ca){if(!_0x2db4ca){_0x348765[_0x0eae('0x17')](0x194);}return _0x2db4ca;};}function handleError(_0x591cf0,_0x81ea3e){_0x81ea3e=_0x81ea3e||0x1f4;return function(_0x29b6bc){logger[_0x0eae('0x24')](_0x29b6bc[_0x0eae('0x25')]);if(_0x29b6bc['name']){delete _0x29b6bc[_0x0eae('0x26')];}_0x591cf0[_0x0eae('0x18')](_0x81ea3e)[_0x0eae('0x27')](_0x29b6bc);};}exports[_0x0eae('0x28')]=function(_0x340dc0,_0x3bb759){var _0x372c4b={},_0x40c8af={},_0x561493={'count':0x0,'rows':[]};var _0x2b2bd3=_[_0x0eae('0x29')](db[_0x0eae('0x2a')]['rawAttributes'],function(_0x3e89dc){return{'name':_0x3e89dc[_0x0eae('0x2b')],'type':_0x3e89dc[_0x0eae('0x2c')][_0x0eae('0x2d')]};});_0x40c8af[_0x0eae('0x2e')]=_[_0x0eae('0x29')](_0x2b2bd3,_0x0eae('0x26'));_0x40c8af['query']=_['keys'](_0x340dc0[_0x0eae('0x2f')]);_0x40c8af[_0x0eae('0x30')]=_[_0x0eae('0x31')](_0x40c8af[_0x0eae('0x2e')],_0x40c8af[_0x0eae('0x2f')]);_0x372c4b['attributes']=_[_0x0eae('0x31')](_0x40c8af[_0x0eae('0x2e')],qs['fields'](_0x340dc0[_0x0eae('0x2f')][_0x0eae('0x32')]));_0x372c4b[_0x0eae('0x33')]=_0x372c4b[_0x0eae('0x33')][_0x0eae('0x34')]?_0x372c4b[_0x0eae('0x33')]:_0x40c8af[_0x0eae('0x2e')];if(!_0x340dc0['query']['hasOwnProperty'](_0x0eae('0x35'))){_0x372c4b[_0x0eae('0x1c')]=qs[_0x0eae('0x1c')](_0x340dc0[_0x0eae('0x2f')]['limit']);_0x372c4b['offset']=qs[_0x0eae('0x1a')](_0x340dc0[_0x0eae('0x2f')][_0x0eae('0x1a')]);}_0x372c4b[_0x0eae('0x36')]=qs[_0x0eae('0x37')](_0x340dc0[_0x0eae('0x2f')]['sort']);_0x372c4b[_0x0eae('0x38')]=qs[_0x0eae('0x30')](_[_0x0eae('0x39')](_0x340dc0['query'],_0x40c8af['filters']),_0x2b2bd3);if(_0x340dc0['query'][_0x0eae('0x3a')]){_0x372c4b[_0x0eae('0x38')]=_[_0x0eae('0x3b')](_0x372c4b[_0x0eae('0x38')],{'$or':_[_0x0eae('0x29')](_0x2b2bd3,function(_0x4358cb){if(_0x4358cb[_0x0eae('0x2c')]!=='VIRTUAL'){var _0x367fe9={};_0x367fe9[_0x4358cb['name']]={'$like':'%'+_0x340dc0[_0x0eae('0x2f')][_0x0eae('0x3a')]+'%'};return _0x367fe9;}})});}_0x372c4b=_[_0x0eae('0x3b')]({},_0x372c4b,_0x340dc0[_0x0eae('0x3c')]);var _0x57459d={'where':_0x372c4b['where']};return db[_0x0eae('0x2a')][_0x0eae('0x1d')](_0x57459d)[_0x0eae('0x3d')](function(_0x2df49e){_0x561493[_0x0eae('0x1d')]=_0x2df49e;if(_0x340dc0[_0x0eae('0x2f')][_0x0eae('0x3e')]){_0x372c4b['include']=[{'all':!![]}];}return db[_0x0eae('0x2a')][_0x0eae('0x3f')](_0x372c4b);})[_0x0eae('0x3d')](function(_0x500dac){_0x561493[_0x0eae('0x40')]=_0x500dac;return _0x561493;})[_0x0eae('0x3d')](respondWithFilteredResult(_0x3bb759,_0x372c4b))[_0x0eae('0x41')](handleError(_0x3bb759,null));};exports[_0x0eae('0x42')]=function(_0x59b218,_0x3ad05e){var _0x3e9a1a={'raw':!![],'where':{'id':_0x59b218['params']['id']}},_0x10a41a={};_0x10a41a[_0x0eae('0x2e')]=_[_0x0eae('0x43')](db[_0x0eae('0x2a')][_0x0eae('0x44')]);_0x10a41a[_0x0eae('0x2f')]=_['keys'](_0x59b218['query']);_0x10a41a[_0x0eae('0x30')]=_['intersection'](_0x10a41a[_0x0eae('0x2e')],_0x10a41a[_0x0eae('0x2f')]);_0x3e9a1a[_0x0eae('0x33')]=_[_0x0eae('0x31')](_0x10a41a[_0x0eae('0x2e')],qs[_0x0eae('0x32')](_0x59b218[_0x0eae('0x2f')]['fields']));_0x3e9a1a['attributes']=_0x3e9a1a[_0x0eae('0x33')][_0x0eae('0x34')]?_0x3e9a1a[_0x0eae('0x33')]:_0x10a41a[_0x0eae('0x2e')];if(_0x59b218[_0x0eae('0x2f')][_0x0eae('0x3e')]){_0x3e9a1a[_0x0eae('0x45')]=[{'all':!![]}];}_0x3e9a1a=_['merge']({},_0x3e9a1a,_0x59b218['options']);return db[_0x0eae('0x2a')][_0x0eae('0x46')](_0x3e9a1a)[_0x0eae('0x3d')](handleEntityNotFound(_0x3ad05e,null))[_0x0eae('0x3d')](respondWithResult(_0x3ad05e,null))[_0x0eae('0x41')](handleError(_0x3ad05e,null));};exports['clone']=function(_0xe994f5,_0x4f077e){var _0x4051c4={'where':{'id':_0xe994f5[_0x0eae('0x47')]['id']}},_0x27a403={};_0x27a403[_0x0eae('0x2e')]=_[_0x0eae('0x43')](db[_0x0eae('0x2a')][_0x0eae('0x44')]);_0x4051c4['attributes']=_[_0x0eae('0x31')](_0x27a403[_0x0eae('0x2e')],qs['fields'](_0xe994f5[_0x0eae('0x2f')][_0x0eae('0x32')]));_0x4051c4[_0x0eae('0x33')]=_0x4051c4[_0x0eae('0x33')][_0x0eae('0x34')]?_0x4051c4[_0x0eae('0x33')]:_0x27a403[_0x0eae('0x2e')];if(_0xe994f5[_0x0eae('0x2f')][_0x0eae('0x3e')]){_0x4051c4['include']=[{'all':!![]}];}_0x4051c4=_[_0x0eae('0x3b')]({},_0x4051c4,_0xe994f5[_0x0eae('0x3c')]);return db[_0x0eae('0x2a')][_0x0eae('0x46')](_0x4051c4)[_0x0eae('0x3d')](handleEntityNotFound(_0x4f077e,null))[_0x0eae('0x3d')](function(_0x3b9885){if(_0x3b9885){var _0xafe137=_0x3b9885[_0x0eae('0x48')]({'plain':!![]});_0xafe137=qs['omit'](_0xafe137,['id',_0x0eae('0x49'),_0x0eae('0x4a')]);_0xe994f5[_0x0eae('0x4b')]=_[_0x0eae('0x4c')](_0xe994f5[_0x0eae('0x4b')],['id',_0x0eae('0x49'),_0x0eae('0x4a')]);return db[_0x0eae('0x2a')][_0x0eae('0x4d')](_[_0x0eae('0x3b')](_0xafe137,_0xe994f5[_0x0eae('0x4b')]),{'include':_0xe994f5['query'][_0x0eae('0x3e')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x4f077e,0xc9))[_0x0eae('0x41')](handleError(_0x4f077e,null));};exports[_0x0eae('0x21')]=function(_0x114fb7,_0x2ac469){if(_0x114fb7[_0x0eae('0x4b')]['id']){delete _0x114fb7[_0x0eae('0x4b')]['id'];}return db[_0x0eae('0x2a')][_0x0eae('0x46')]({'where':{'id':_0x114fb7[_0x0eae('0x47')]['id']}})[_0x0eae('0x3d')](handleEntityNotFound(_0x2ac469,null))[_0x0eae('0x3d')](saveUpdates(_0x114fb7[_0x0eae('0x4b')],null))[_0x0eae('0x3d')](respondWithResult(_0x2ac469,null))[_0x0eae('0x41')](handleError(_0x2ac469,null));};exports[_0x0eae('0x22')]=function(_0x38241a,_0x2268d2){return db['Attachment'][_0x0eae('0x46')]({'where':{'id':_0x38241a['params']['id']}})['then'](handleEntityNotFound(_0x2268d2,null))['then'](removeEntity(_0x2268d2,null))[_0x0eae('0x41')](handleError(_0x2268d2,null));};exports[_0x0eae('0x4d')]=function(_0x252646,_0x535626,_0x423ce6){_0x252646[_0x0eae('0x4b')][_0x0eae('0x26')]=_0x252646[_0x0eae('0x4e')][_0x0eae('0x4f')];_0x252646[_0x0eae('0x4b')][_0x0eae('0x50')]=_0x252646[_0x0eae('0x4e')]['filename'];_0x252646[_0x0eae('0x4b')][_0x0eae('0x2c')]=_0x252646[_0x0eae('0x4e')][_0x0eae('0x51')];return db[_0x0eae('0x2a')][_0x0eae('0x4d')](_0x252646[_0x0eae('0x4b')])[_0x0eae('0x3d')](respondWithResult(_0x535626,0xc9))[_0x0eae('0x41')](handleError(_0x535626,null));};exports[_0x0eae('0x52')]=function(_0x1e4ed5,_0x125619,_0x4461a5){return db[_0x0eae('0x2a')][_0x0eae('0x53')]({'where':{'id':_0x1e4ed5['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x125619,null))['then'](function(_0x25ab19){if(_0x25ab19){var _0x445d73=_0x25ab19['ChatOfflineMessageId']!==null;var _0x12c92a=path['join'](config[_0x0eae('0x54')],'server/files/attachments/');if(_0x445d73){_0x12c92a=path['join'](_0x12c92a,_0x0eae('0x55'));}var _0x3dc01e=path[_0x0eae('0x56')](_0x12c92a,_0x25ab19[_0x0eae('0x50')]);return _0x125619['download'](_0x3dc01e);}})[_0x0eae('0x41')](handleError(_0x125619,null));}; \ No newline at end of file +var _0x1d57=['mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','then','destroy','name','send','index','map','rawAttributes','type','key','model','query','filters','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Attachment','findAll','rows','catch','params','keys','intersection','includeAll','find','clone','include','omit','createdAt','body','updatedAt','update','create','basename','file','filename'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x1d57,0x16c));var _0x71d5=function(_0x23840e,_0x2fb0cb){_0x23840e=_0x23840e-0x0;var _0x277300=_0x1d57[_0x23840e];return _0x277300;};'use strict';var emlformat=require(_0x71d5('0x0'));var rimraf=require(_0x71d5('0x1'));var zipdir=require(_0x71d5('0x2'));var jsonpatch=require(_0x71d5('0x3'));var rp=require(_0x71d5('0x4'));var moment=require(_0x71d5('0x5'));var BPromise=require(_0x71d5('0x6'));var Mustache=require(_0x71d5('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x71d5('0x8'));var ejs=require(_0x71d5('0x9'));var fs=require('fs');var fs_extra=require(_0x71d5('0xa'));var _=require('lodash');var squel=require(_0x71d5('0xb'));var crypto=require('crypto');var jsforce=require(_0x71d5('0xc'));var deskjs=require(_0x71d5('0xd'));var toCsv=require(_0x71d5('0x8'));var querystring=require(_0x71d5('0xe'));var Papa=require(_0x71d5('0xf'));var Redis=require(_0x71d5('0x10'));var authService=require(_0x71d5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x71d5('0x12'));var hardwareService=require(_0x71d5('0x13'));var logger=require(_0x71d5('0x14'))(_0x71d5('0x15'));var utils=require(_0x71d5('0x16'));var config=require(_0x71d5('0x17'));var licenseUtil=require(_0x71d5('0x18'));var db=require(_0x71d5('0x19'))['db'];function respondWithStatusCode(_0x1935a8,_0x8cf17c){_0x8cf17c=_0x8cf17c||0xcc;return function(_0x904e1e){if(_0x904e1e){return _0x1935a8[_0x71d5('0x1a')](_0x8cf17c);}return _0x1935a8['status'](_0x8cf17c)[_0x71d5('0x1b')]();};}function respondWithResult(_0x37ba33,_0x4f9879){_0x4f9879=_0x4f9879||0xc8;return function(_0x33fba7){if(_0x33fba7){return _0x37ba33['status'](_0x4f9879)[_0x71d5('0x1c')](_0x33fba7);}};}function respondWithFilteredResult(_0x300449,_0x2de080){return function(_0x57e070){if(_0x57e070){var _0x30b229=typeof _0x2de080[_0x71d5('0x1d')]===_0x71d5('0x1e')&&typeof _0x2de080[_0x71d5('0x1f')]===_0x71d5('0x1e');var _0xdc9540=_0x57e070[_0x71d5('0x20')];var _0x4c7d68=_0x30b229?0x0:_0x2de080[_0x71d5('0x1d')];var _0x128cc0=_0x30b229?_0x57e070[_0x71d5('0x20')]:_0x2de080[_0x71d5('0x1d')]+_0x2de080[_0x71d5('0x1f')];var _0x2d5f82;if(_0x128cc0>=_0xdc9540){_0x128cc0=_0xdc9540;_0x2d5f82=0xc8;}else{_0x2d5f82=0xce;}_0x300449[_0x71d5('0x21')](_0x2d5f82);return _0x300449[_0x71d5('0x22')](_0x71d5('0x23'),_0x4c7d68+'-'+_0x128cc0+'/'+_0xdc9540)['json'](_0x57e070);}return null;};}function patchUpdates(_0x1fb645){return function(_0x164978){try{jsonpatch[_0x71d5('0x24')](_0x164978,_0x1fb645,!![]);}catch(_0x4a6235){return BPromise['reject'](_0x4a6235);}return _0x164978[_0x71d5('0x25')]();};}function saveUpdates(_0x11248a,_0x13c9a8){return function(_0x441203){if(_0x441203){return _0x441203['update'](_0x11248a)[_0x71d5('0x26')](function(_0x59d7ee){return _0x59d7ee;});}return null;};}function removeEntity(_0x4314d6,_0x5933a4){return function(_0x423579){if(_0x423579){return _0x423579[_0x71d5('0x27')]()['then'](function(){_0x4314d6[_0x71d5('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58653f,_0xaa85f7){return function(_0x1769a5){if(!_0x1769a5){_0x58653f[_0x71d5('0x1a')](0x194);}return _0x1769a5;};}function handleError(_0x13a826,_0x1ed25f){_0x1ed25f=_0x1ed25f||0x1f4;return function(_0x591cf5){logger['error'](_0x591cf5['stack']);if(_0x591cf5[_0x71d5('0x28')]){delete _0x591cf5['name'];}_0x13a826[_0x71d5('0x21')](_0x1ed25f)[_0x71d5('0x29')](_0x591cf5);};}exports[_0x71d5('0x2a')]=function(_0x42d936,_0x221041){var _0x2c0fbc={},_0x171f58={},_0x67bb6e={'count':0x0,'rows':[]};var _0x58e063=_[_0x71d5('0x2b')](db['Attachment'][_0x71d5('0x2c')],function(_0x1727e7){return{'name':_0x1727e7['fieldName'],'type':_0x1727e7[_0x71d5('0x2d')][_0x71d5('0x2e')]};});_0x171f58[_0x71d5('0x2f')]=_[_0x71d5('0x2b')](_0x58e063,_0x71d5('0x28'));_0x171f58['query']=_['keys'](_0x42d936[_0x71d5('0x30')]);_0x171f58[_0x71d5('0x31')]=_['intersection'](_0x171f58[_0x71d5('0x2f')],_0x171f58[_0x71d5('0x30')]);_0x2c0fbc[_0x71d5('0x32')]=_['intersection'](_0x171f58[_0x71d5('0x2f')],qs[_0x71d5('0x33')](_0x42d936[_0x71d5('0x30')]['fields']));_0x2c0fbc[_0x71d5('0x32')]=_0x2c0fbc[_0x71d5('0x32')][_0x71d5('0x34')]?_0x2c0fbc[_0x71d5('0x32')]:_0x171f58[_0x71d5('0x2f')];if(!_0x42d936[_0x71d5('0x30')]['hasOwnProperty'](_0x71d5('0x35'))){_0x2c0fbc['limit']=qs[_0x71d5('0x1f')](_0x42d936[_0x71d5('0x30')][_0x71d5('0x1f')]);_0x2c0fbc[_0x71d5('0x1d')]=qs[_0x71d5('0x1d')](_0x42d936[_0x71d5('0x30')][_0x71d5('0x1d')]);}_0x2c0fbc[_0x71d5('0x36')]=qs[_0x71d5('0x37')](_0x42d936['query'][_0x71d5('0x37')]);_0x2c0fbc[_0x71d5('0x38')]=qs['filters'](_['pick'](_0x42d936[_0x71d5('0x30')],_0x171f58[_0x71d5('0x31')]),_0x58e063);if(_0x42d936[_0x71d5('0x30')][_0x71d5('0x39')]){_0x2c0fbc['where']=_[_0x71d5('0x3a')](_0x2c0fbc['where'],{'$or':_[_0x71d5('0x2b')](_0x58e063,function(_0x54b37e){if(_0x54b37e[_0x71d5('0x2d')]!==_0x71d5('0x3b')){var _0x2c9a68={};_0x2c9a68[_0x54b37e['name']]={'$like':'%'+_0x42d936[_0x71d5('0x30')][_0x71d5('0x39')]+'%'};return _0x2c9a68;}})});}_0x2c0fbc=_[_0x71d5('0x3a')]({},_0x2c0fbc,_0x42d936[_0x71d5('0x3c')]);var _0x322b98={'where':_0x2c0fbc[_0x71d5('0x38')]};return db[_0x71d5('0x3d')][_0x71d5('0x20')](_0x322b98)[_0x71d5('0x26')](function(_0xea71ac){_0x67bb6e[_0x71d5('0x20')]=_0xea71ac;if(_0x42d936[_0x71d5('0x30')]['includeAll']){_0x2c0fbc['include']=[{'all':!![]}];}return db[_0x71d5('0x3d')][_0x71d5('0x3e')](_0x2c0fbc);})[_0x71d5('0x26')](function(_0x156614){_0x67bb6e[_0x71d5('0x3f')]=_0x156614;return _0x67bb6e;})[_0x71d5('0x26')](respondWithFilteredResult(_0x221041,_0x2c0fbc))[_0x71d5('0x40')](handleError(_0x221041,null));};exports['show']=function(_0x577259,_0x19afdb){var _0x51b4b4={'raw':!![],'where':{'id':_0x577259[_0x71d5('0x41')]['id']}},_0x3c5791={};_0x3c5791['model']=_['keys'](db['Attachment'][_0x71d5('0x2c')]);_0x3c5791[_0x71d5('0x30')]=_[_0x71d5('0x42')](_0x577259[_0x71d5('0x30')]);_0x3c5791['filters']=_[_0x71d5('0x43')](_0x3c5791[_0x71d5('0x2f')],_0x3c5791['query']);_0x51b4b4[_0x71d5('0x32')]=_[_0x71d5('0x43')](_0x3c5791[_0x71d5('0x2f')],qs[_0x71d5('0x33')](_0x577259[_0x71d5('0x30')][_0x71d5('0x33')]));_0x51b4b4['attributes']=_0x51b4b4[_0x71d5('0x32')]['length']?_0x51b4b4['attributes']:_0x3c5791[_0x71d5('0x2f')];if(_0x577259[_0x71d5('0x30')][_0x71d5('0x44')]){_0x51b4b4['include']=[{'all':!![]}];}_0x51b4b4=_[_0x71d5('0x3a')]({},_0x51b4b4,_0x577259[_0x71d5('0x3c')]);return db['Attachment'][_0x71d5('0x45')](_0x51b4b4)[_0x71d5('0x26')](handleEntityNotFound(_0x19afdb,null))[_0x71d5('0x26')](respondWithResult(_0x19afdb,null))[_0x71d5('0x40')](handleError(_0x19afdb,null));};exports[_0x71d5('0x46')]=function(_0x316c4a,_0x3bb340){var _0x27a139={'where':{'id':_0x316c4a['params']['id']}},_0x4c3f93={};_0x4c3f93[_0x71d5('0x2f')]=_[_0x71d5('0x42')](db[_0x71d5('0x3d')][_0x71d5('0x2c')]);_0x27a139[_0x71d5('0x32')]=_['intersection'](_0x4c3f93[_0x71d5('0x2f')],qs[_0x71d5('0x33')](_0x316c4a[_0x71d5('0x30')]['fields']));_0x27a139[_0x71d5('0x32')]=_0x27a139['attributes'][_0x71d5('0x34')]?_0x27a139[_0x71d5('0x32')]:_0x4c3f93[_0x71d5('0x2f')];if(_0x316c4a[_0x71d5('0x30')][_0x71d5('0x44')]){_0x27a139[_0x71d5('0x47')]=[{'all':!![]}];}_0x27a139=_['merge']({},_0x27a139,_0x316c4a[_0x71d5('0x3c')]);return db[_0x71d5('0x3d')]['find'](_0x27a139)[_0x71d5('0x26')](handleEntityNotFound(_0x3bb340,null))['then'](function(_0x272ab6){if(_0x272ab6){var _0x3fe41c=_0x272ab6['get']({'plain':!![]});_0x3fe41c=qs[_0x71d5('0x48')](_0x3fe41c,['id',_0x71d5('0x49'),'updatedAt']);_0x316c4a[_0x71d5('0x4a')]=_[_0x71d5('0x48')](_0x316c4a[_0x71d5('0x4a')],['id','createdAt',_0x71d5('0x4b')]);return db[_0x71d5('0x3d')]['create'](_[_0x71d5('0x3a')](_0x3fe41c,_0x316c4a[_0x71d5('0x4a')]),{'include':_0x316c4a[_0x71d5('0x30')]['includeAll']?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x3bb340,0xc9))[_0x71d5('0x40')](handleError(_0x3bb340,null));};exports[_0x71d5('0x4c')]=function(_0x4451b4,_0x5a396e){if(_0x4451b4['body']['id']){delete _0x4451b4['body']['id'];}return db[_0x71d5('0x3d')][_0x71d5('0x45')]({'where':{'id':_0x4451b4['params']['id']}})[_0x71d5('0x26')](handleEntityNotFound(_0x5a396e,null))[_0x71d5('0x26')](saveUpdates(_0x4451b4[_0x71d5('0x4a')],null))['then'](respondWithResult(_0x5a396e,null))[_0x71d5('0x40')](handleError(_0x5a396e,null));};exports[_0x71d5('0x27')]=function(_0x169e00,_0x4a212c){return db[_0x71d5('0x3d')][_0x71d5('0x45')]({'where':{'id':_0x169e00[_0x71d5('0x41')]['id']}})['then'](handleEntityNotFound(_0x4a212c,null))['then'](removeEntity(_0x4a212c,null))[_0x71d5('0x40')](handleError(_0x4a212c,null));};exports[_0x71d5('0x4d')]=function(_0x441f7c,_0x1813f5,_0x51b6de){_0x441f7c[_0x71d5('0x4a')][_0x71d5('0x28')]=_0x441f7c['file']['originalname'];_0x441f7c[_0x71d5('0x4a')][_0x71d5('0x4e')]=_0x441f7c[_0x71d5('0x4f')][_0x71d5('0x50')];_0x441f7c['body'][_0x71d5('0x2d')]=_0x441f7c[_0x71d5('0x4f')][_0x71d5('0x51')];return db[_0x71d5('0x3d')][_0x71d5('0x4d')](_0x441f7c['body'])['then'](respondWithResult(_0x1813f5,0xc9))[_0x71d5('0x40')](handleError(_0x1813f5,null));};exports[_0x71d5('0x52')]=function(_0x1c569d,_0x2da2cd,_0x3e9f14){return db[_0x71d5('0x3d')][_0x71d5('0x53')]({'where':{'id':_0x1c569d['params']['id']},'raw':!![]})[_0x71d5('0x26')](handleEntityNotFound(_0x2da2cd,null))['then'](function(_0x562769){if(_0x562769){var _0x53a263=_0x562769[_0x71d5('0x54')]!==null;var _0x142683=path[_0x71d5('0x55')](config[_0x71d5('0x56')],_0x71d5('0x57'));if(_0x53a263){_0x142683=path[_0x71d5('0x55')](_0x142683,_0x71d5('0x58'));}var _0x5cde0f=path[_0x71d5('0x55')](_0x142683,_0x562769[_0x71d5('0x4e')]);return _0x2da2cd[_0x71d5('0x52')](_0x5cde0f);}})[_0x71d5('0x40')](handleError(_0x2da2cd,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 838211a..7c42557 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 _0x925b=['path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4be692,_0x42debd){var _0x2cb30b=function(_0x5ab7b0){while(--_0x5ab7b0){_0x4be692['push'](_0x4be692['shift']());}};_0x2cb30b(++_0x42debd);}(_0x925b,0x125));var _0xb925=function(_0x17e771,_0x55fd17){_0x17e771=_0x17e771-0x0;var _0x1f3a6d=_0x925b[_0x17e771];return _0x1f3a6d;};'use strict';var _=require(_0xb925('0x0'));var util=require(_0xb925('0x1'));var logger=require(_0xb925('0x2'))(_0xb925('0x3'));var moment=require(_0xb925('0x4'));var BPromise=require(_0xb925('0x5'));var rp=require(_0xb925('0x6'));var fs=require('fs');var path=require(_0xb925('0x7'));var rimraf=require(_0xb925('0x8'));var config=require(_0xb925('0x9'));var attributes=require(_0xb925('0xa'));module[_0xb925('0xb')]=function(_0x21f4c5,_0xdaf4f9){return _0x21f4c5[_0xb925('0xc')](_0xb925('0xd'),attributes,{'tableName':_0xb925('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5bc9=['./attachment.attributes','exports','attachments','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x5bc9,0xa8));var _0x95bc=function(_0x57f9f4,_0x264bb4){_0x57f9f4=_0x57f9f4-0x0;var _0x3cf8ba=_0x5bc9[_0x57f9f4];return _0x3cf8ba;};'use strict';var _=require(_0x95bc('0x0'));var util=require(_0x95bc('0x1'));var logger=require(_0x95bc('0x2'))('api');var moment=require(_0x95bc('0x3'));var BPromise=require(_0x95bc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x95bc('0x5'));var rimraf=require(_0x95bc('0x6'));var config=require(_0x95bc('0x7'));var attributes=require(_0x95bc('0x8'));module[_0x95bc('0x9')]=function(_0x50ee95,_0x5c5c56){return _0x50ee95['define']('Attachment',attributes,{'tableName':_0x95bc('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 11abeb8..e2add9a 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 _0x0f69=['../../config/logger','../../config/environment','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Attachment','create','body','options','raw','CreateAttachment','moment','randomstring','ioredis','../../config/utils'];(function(_0xaf29da,_0x117f5a){var _0x295c51=function(_0x3feaf4){while(--_0x3feaf4){_0xaf29da['push'](_0xaf29da['shift']());}};_0x295c51(++_0x117f5a);}(_0x0f69,0x173));var _0x90f6=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x0f69[_0x231e16];return _0x570a7c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x90f6('0x0'));var BPromise=require('bluebird');var rs=require(_0x90f6('0x1'));var fs=require('fs');var Redis=require(_0x90f6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x90f6('0x3'));var logger=require(_0x90f6('0x4'))('rpc');var config=require(_0x90f6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x90f6('0x6')][_0x90f6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x45657d,_0x3b35a0,_0x3bc2eb){return new BPromise(function(_0x42044f,_0x488b53){return client[_0x90f6('0x8')](_0x45657d,_0x3bc2eb)[_0x90f6('0x9')](function(_0x3c8148){logger[_0x90f6('0xa')](_0x90f6('0xb'),_0x3b35a0,_0x90f6('0xc'));logger['debug'](_0x90f6('0xd'),_0x3b35a0,_0x90f6('0xc'),JSON['stringify'](_0x3c8148));if(_0x3c8148[_0x90f6('0xe')]){if(_0x3c8148['error'][_0x90f6('0xf')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x3b35a0,_0x3c8148[_0x90f6('0xe')]['message']);return _0x488b53(_0x3c8148[_0x90f6('0xe')][_0x90f6('0x10')]);}logger[_0x90f6('0xe')](_0x90f6('0xb'),_0x3b35a0,_0x3c8148['error'][_0x90f6('0x10')]);return _0x42044f(_0x3c8148['error']['message']);}else{logger[_0x90f6('0xa')]('Attachment,\x20%s,\x20%s',_0x3b35a0,_0x90f6('0xc'));_0x42044f(_0x3c8148[_0x90f6('0x11')][_0x90f6('0x10')]);}})[_0x90f6('0x12')](function(_0x3b4d5d){logger[_0x90f6('0xe')](_0x90f6('0xb'),_0x3b35a0,_0x3b4d5d);_0x488b53(_0x3b4d5d);});});}exports['CreateAttachment']=function(_0x36682a){var _0x2898a8=this;return new Promise(function(_0x5ac9be,_0x4209b8){return db[_0x90f6('0x13')][_0x90f6('0x14')](_0x36682a[_0x90f6('0x15')],{'raw':_0x36682a[_0x90f6('0x16')]?_0x36682a[_0x90f6('0x16')][_0x90f6('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x1beb61){logger[_0x90f6('0xa')]('CreateAttachment',_0x36682a);logger['debug'](_0x90f6('0x18'),_0x36682a,JSON['stringify'](_0x1beb61));_0x5ac9be(_0x1beb61);})['catch'](function(_0x763a9b){logger['error'](_0x90f6('0x18'),_0x763a9b[_0x90f6('0x10')],_0x36682a);_0x4209b8(_0x2898a8[_0x90f6('0xe')](0x1f4,_0x763a9b[_0x90f6('0x10')]));});});}; \ No newline at end of file +var _0x2504=['catch','CreateAttachment','create','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','Attachment,\x20%s,\x20%s','message','result'];(function(_0x5cabfd,_0x5dea47){var _0x4bc06c=function(_0x4a2fea){while(--_0x4a2fea){_0x5cabfd['push'](_0x5cabfd['shift']());}};_0x4bc06c(++_0x5dea47);}(_0x2504,0xee));var _0x4250=function(_0x3d02dc,_0x703f5b){_0x3d02dc=_0x3d02dc-0x0;var _0x4f8a91=_0x2504[_0x3d02dc];return _0x4f8a91;};'use strict';var _=require(_0x4250('0x0'));var util=require(_0x4250('0x1'));var moment=require(_0x4250('0x2'));var BPromise=require(_0x4250('0x3'));var rs=require(_0x4250('0x4'));var fs=require('fs');var Redis=require(_0x4250('0x5'));var db=require(_0x4250('0x6'))['db'];var utils=require(_0x4250('0x7'));var logger=require(_0x4250('0x8'))(_0x4250('0x9'));var config=require(_0x4250('0xa'));var jayson=require(_0x4250('0xb'));var client=jayson['client'][_0x4250('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e177e,_0x5a5286,_0x370998){return new BPromise(function(_0x477312,_0x1a3b57){return client[_0x4250('0xd')](_0x4e177e,_0x370998)[_0x4250('0xe')](function(_0x51ea6f){logger[_0x4250('0xf')]('Attachment,\x20%s,\x20%s',_0x5a5286,_0x4250('0x10'));logger[_0x4250('0x11')]('Attachment,\x20%s,\x20%s,\x20%s',_0x5a5286,_0x4250('0x10'),JSON['stringify'](_0x51ea6f));if(_0x51ea6f['error']){if(_0x51ea6f[_0x4250('0x12')][_0x4250('0x13')]===0x1f4){logger[_0x4250('0x12')](_0x4250('0x14'),_0x5a5286,_0x51ea6f[_0x4250('0x12')]['message']);return _0x1a3b57(_0x51ea6f[_0x4250('0x12')][_0x4250('0x15')]);}logger[_0x4250('0x12')](_0x4250('0x14'),_0x5a5286,_0x51ea6f[_0x4250('0x12')][_0x4250('0x15')]);return _0x477312(_0x51ea6f['error'][_0x4250('0x15')]);}else{logger[_0x4250('0xf')](_0x4250('0x14'),_0x5a5286,_0x4250('0x10'));_0x477312(_0x51ea6f[_0x4250('0x16')][_0x4250('0x15')]);}})[_0x4250('0x17')](function(_0x4e70fc){logger[_0x4250('0x12')](_0x4250('0x14'),_0x5a5286,_0x4e70fc);_0x1a3b57(_0x4e70fc);});});}exports[_0x4250('0x18')]=function(_0x17a8a9){var _0x369010=this;return new Promise(function(_0x30e48c,_0x14d590){return db['Attachment'][_0x4250('0x19')](_0x17a8a9['body'],{'raw':_0x17a8a9['options']?_0x17a8a9[_0x4250('0x1a')][_0x4250('0x1b')]===undefined?!![]:![]:!![]})[_0x4250('0xe')](function(_0x42c331){logger[_0x4250('0xf')](_0x4250('0x18'),_0x17a8a9);logger[_0x4250('0x11')](_0x4250('0x18'),_0x17a8a9,JSON[_0x4250('0x1c')](_0x42c331));_0x30e48c(_0x42c331);})[_0x4250('0x17')](function(_0x728862){logger[_0x4250('0x12')]('CreateAttachment',_0x728862[_0x4250('0x15')],_0x17a8a9);_0x14d590(_0x369010[_0x4250('0x12')](0x1f4,_0x728862[_0x4250('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index ec12aa7..0876462 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 _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x240500,_0xd9837f){var _0x20ea95=function(_0x5dc7a5){while(--_0x5dc7a5){_0x240500['push'](_0x240500['shift']());}};_0x20ea95(++_0xd9837f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1020d7,_0x15401e){_0x1020d7=_0x1020d7-0x0;var _0xde7c49=_0x5f2f[_0x1020d7];return _0xde7c49;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file +var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x2e90c2,_0x10f918){var _0x3a81ee=function(_0x2a4438){while(--_0x2a4438){_0x2e90c2['push'](_0x2e90c2['shift']());}};_0x3a81ee(++_0x10f918);}(_0x2032,0xd9));var _0x2203=function(_0x3a33d7,_0xd871a2){_0x3a33d7=_0x3a33d7-0x0;var _0x40a302=_0x2032[_0x3a33d7];return _0x40a302;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 97e3f95..58f67ee 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 _0x25a6=['passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../config/utils','../../config/environment','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','role','disabled','blockedAt','online','admin','user','agent','name','add','clearBlockUser','getLicense','catch','status','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','ad-login','User'];(function(_0x557fd2,_0x2c0a7a){var _0x1b54a2=function(_0x2e439b){while(--_0x2e439b){_0x557fd2['push'](_0x557fd2['shift']());}};_0x1b54a2(++_0x2c0a7a);}(_0x25a6,0x1cb));var _0x625a=function(_0x35e882,_0x2aef74){_0x35e882=_0x35e882-0x0;var _0x1e8696=_0x25a6[_0x35e882];return _0x1e8696;};'use strict';var passport=require(_0x625a('0x0'));var LocalStrategy=require(_0x625a('0x1'))[_0x625a('0x2')];var moment=require(_0x625a('0x3'));var ActiveDirectory=require(_0x625a('0x4'));var BPromise=require(_0x625a('0x5'));var util=require(_0x625a('0x6'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0x625a('0x7'));var config=require(_0x625a('0x8'));var logger=require('../../config/logger')(_0x625a('0x9'));function isActiveDirectoryConfigured(_0x5cc5b4){var _0x3a9fcb=![];if(typeof _0x5cc5b4[_0x625a('0xa')]!==_0x625a('0xb')){_0x3a9fcb=_0x5cc5b4[_0x625a('0xa')][_0x625a('0xc')]&&_0x5cc5b4[_0x625a('0xa')][_0x625a('0xd')]&&_0x5cc5b4[_0x625a('0xa')][_0x625a('0xe')];}return _0x3a9fcb;}function adAuthenticate(_0x33bb56,_0x1527f2,_0x4d691c){return new BPromise(function(_0x269a48,_0x59dea1){try{var _0x2cd16e=new ActiveDirectory(_0x33bb56);_0x2cd16e[_0x625a('0xf')](_0x1527f2,_0x4d691c,function(_0x1c6b71,_0x497467){if(_0x1c6b71){logger[_0x625a('0x10')](_0x625a('0x11'),_0x1527f2,util[_0x625a('0x12')](_0x1c6b71,{'showHidden':![],'depth':null}));_0x59dea1(_0x625a('0x13'));}else if(!_0x497467){logger['error'](_0x625a('0x14'),_0x1527f2);_0x59dea1(_0x625a('0x13'));}else{_0x269a48(_0x497467);}});}catch(_0x125863){_0x59dea1(_0x125863);}});}function ActiveDirectoryAuthenticate(_0xfa1f2d,_0x37c34b,_0x17a1a8,_0x3edf95){var _0x1b702f,_0x13f6f9;if(!isActiveDirectoryConfigured(config)){logger[_0x625a('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x37c34b);return _0x3edf95(null,![],{'message':_0x625a('0x13')});}return db[_0x625a('0x15')][_0x625a('0x16')]({'where':{'id':0x1},'attributes':[_0x625a('0x17'),_0x625a('0x18')],'raw':!![]})[_0x625a('0x19')](function(_0x217323){_0x1b702f=_0x217323;if(!_0x1b702f['adSsoEnabled']){logger[_0x625a('0x10')](_0x625a('0x1a'),_0x37c34b);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0xfa1f2d[_0x625a('0x16')]({'logging':!![],'attributes':['id','name',_0x625a('0x1b'),_0x625a('0x1c'),_0x625a('0x1d'),_0x625a('0x1e'),'blocked',_0x625a('0x1f'),_0x625a('0x20')],'where':{'name':_0x37c34b,'role':{'$or':[_0x625a('0x21'),_0x625a('0x22'),_0x625a('0x23')]},'adSsoEnabled':!![]}});})[_0x625a('0x19')](function(_0x49bbd2){if(!_0x49bbd2||_0x49bbd2&&_0x49bbd2[_0x625a('0x24')]!==_0x37c34b){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x13f6f9=_0x49bbd2;var _0x353bfd=_0x13f6f9[_0x625a('0x24')]+'@'+config['activedirectory']['domain'];return adAuthenticate(config[_0x625a('0xa')],_0x353bfd,_0x17a1a8);})[_0x625a('0x19')](function(_0x14aeb4){if(_0x13f6f9[_0x625a('0x1e')]){throw new Error(_0x625a('0x13'));}if(_0x1b702f[_0x625a('0x18')]>0x0){if(_0x13f6f9['blocked']){if(moment(_0x13f6f9['blockedAt'])[_0x625a('0x25')](_0x1b702f['blockDuration'],'minutes')>moment()){throw new Error(_0x625a('0x13'));}return utils[_0x625a('0x26')](_0x13f6f9,0x0,![],null)[_0x625a('0x19')](function(){return utils[_0x625a('0x27')](_0x13f6f9);})[_0x625a('0x19')](function(){return _0x3edf95(null,_0x13f6f9);});}else{return utils[_0x625a('0x27')](_0x13f6f9)[_0x625a('0x19')](function(){return _0x3edf95(null,_0x13f6f9);});}}else{return utils['getLicense'](_0x13f6f9)[_0x625a('0x19')](function(){return _0x3edf95(null,_0x13f6f9);});}})[_0x625a('0x28')](function(_0x5a030c){return _0x3edf95(null,![],_0x5a030c);});}function handleError(_0xe761c1,_0xd77a79,_0x1150e4){return _0xe761c1[_0x625a('0x29')](_0xd77a79||0x1f4)[_0x625a('0x2a')]({'message':_0x1150e4?_0x1150e4[_0x625a('0x2b')]||_0x1150e4:''});}exports[_0x625a('0x2c')]=function(_0x420963,_0x1b8d25,_0x4318ca){passport['authenticate']('ad-login',function(_0xcb8a44,_0x36c5f2,_0x422ed6){var _0x402363=_0xcb8a44||_0x422ed6;if(_0x402363){return handleError(_0x1b8d25,0x191,_0x402363);}if(!_0x36c5f2){return handleError(_0x1b8d25,0x194,{'message':_0x625a('0x2d')});}else{var _0x39afeb={'payload':{'id':_0x36c5f2['id'],'role':_0x36c5f2[_0x625a('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0x625a('0x2e')](_0x39afeb)[_0x625a('0x19')](function(_0x5064bd){_0x1b8d25[_0x625a('0x2f')]({'id':_0x36c5f2['id'],'token':_0x5064bd,'statusCall':'','isAlreadyLogged':_0x36c5f2[_0x625a('0x20')]});});}})(_0x420963,_0x1b8d25,_0x4318ca);};passport[_0x625a('0x30')](_0x625a('0x31'),new LocalStrategy({'usernameField':_0x625a('0x24'),'passwordField':_0x625a('0x1b')},function(_0x2cadd2,_0x87595e,_0x338f62){return ActiveDirectoryAuthenticate(db[_0x625a('0x32')],_0x2cadd2,_0x87595e,_0x338f62);})); \ No newline at end of file +var _0x3cce=['then','blockedAt','add','minutes','catch','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','Strategy','moment','activedirectory2','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','api','activedirectory','undefined','url','domain','authenticate','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','blockDuration','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','role','blocked','online','admin','user','agent'];(function(_0x631577,_0x38e35d){var _0x517397=function(_0x4f9228){while(--_0x4f9228){_0x631577['push'](_0x631577['shift']());}};_0x517397(++_0x38e35d);}(_0x3cce,0x1c4));var _0xe3cc=function(_0x5a14cb,_0x4caeff){_0x5a14cb=_0x5a14cb-0x0;var _0x4b1f3e=_0x3cce[_0x5a14cb];return _0x4b1f3e;};'use strict';var passport=require('passport');var LocalStrategy=require('passport-local')[_0xe3cc('0x0')];var moment=require(_0xe3cc('0x1'));var ActiveDirectory=require(_0xe3cc('0x2'));var BPromise=require(_0xe3cc('0x3'));var util=require('util');var db=require(_0xe3cc('0x4'))['db'];var authService=require(_0xe3cc('0x5'));var utils=require(_0xe3cc('0x6'));var config=require(_0xe3cc('0x7'));var logger=require('../../config/logger')(_0xe3cc('0x8'));function isActiveDirectoryConfigured(_0x4ffed6){var _0x21913f=![];if(typeof _0x4ffed6[_0xe3cc('0x9')]!==_0xe3cc('0xa')){_0x21913f=_0x4ffed6['activedirectory']['baseDN']&&_0x4ffed6['activedirectory'][_0xe3cc('0xb')]&&_0x4ffed6['activedirectory'][_0xe3cc('0xc')];}return _0x21913f;}function adAuthenticate(_0x36635c,_0x6695db,_0x14e751){return new BPromise(function(_0x56a44b,_0x552d09){try{var _0x31f614=new ActiveDirectory(_0x36635c);_0x31f614[_0xe3cc('0xd')](_0x6695db,_0x14e751,function(_0x412073,_0x56ea71){if(_0x412073){logger['error'](_0xe3cc('0xe'),_0x6695db,util[_0xe3cc('0xf')](_0x412073,{'showHidden':![],'depth':null}));_0x552d09(_0xe3cc('0x10'));}else if(!_0x56ea71){logger[_0xe3cc('0x11')](_0xe3cc('0x12'),_0x6695db);_0x552d09('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x56a44b(_0x56ea71);}});}catch(_0x37fc2e){_0x552d09(_0x37fc2e);}});}function ActiveDirectoryAuthenticate(_0x3e3f76,_0xfe8df1,_0x5d4a58,_0x36e2d3){var _0x3449ac,_0x2952a9;if(!isActiveDirectoryConfigured(config)){logger[_0xe3cc('0x11')](_0xe3cc('0x13'),_0xfe8df1);return _0x36e2d3(null,![],{'message':_0xe3cc('0x10')});}return db['Setting'][_0xe3cc('0x14')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0xe3cc('0x15')],'raw':!![]})['then'](function(_0x2859c8){_0x3449ac=_0x2859c8;if(!_0x3449ac[_0xe3cc('0x16')]){logger['error'](_0xe3cc('0x17'),_0xfe8df1);throw new Error(_0xe3cc('0x10'));}return _0x3e3f76[_0xe3cc('0x14')]({'logging':!![],'attributes':['id',_0xe3cc('0x18'),_0xe3cc('0x19'),'salt',_0xe3cc('0x1a'),'disabled',_0xe3cc('0x1b'),'blockedAt',_0xe3cc('0x1c')],'where':{'name':_0xfe8df1,'role':{'$or':[_0xe3cc('0x1d'),_0xe3cc('0x1e'),_0xe3cc('0x1f')]},'adSsoEnabled':!![]}});})[_0xe3cc('0x20')](function(_0x3eff15){if(!_0x3eff15||_0x3eff15&&_0x3eff15[_0xe3cc('0x18')]!==_0xfe8df1){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x2952a9=_0x3eff15;var _0x574406=_0x2952a9[_0xe3cc('0x18')]+'@'+config[_0xe3cc('0x9')][_0xe3cc('0xc')];return adAuthenticate(config['activedirectory'],_0x574406,_0x5d4a58);})['then'](function(_0x3e68e8){if(_0x2952a9['disabled']){throw new Error(_0xe3cc('0x10'));}if(_0x3449ac[_0xe3cc('0x15')]>0x0){if(_0x2952a9[_0xe3cc('0x1b')]){if(moment(_0x2952a9[_0xe3cc('0x21')])[_0xe3cc('0x22')](_0x3449ac[_0xe3cc('0x15')],_0xe3cc('0x23'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0x2952a9,0x0,![],null)['then'](function(){return utils['getLicense'](_0x2952a9);})[_0xe3cc('0x20')](function(){return _0x36e2d3(null,_0x2952a9);});}else{return utils['getLicense'](_0x2952a9)[_0xe3cc('0x20')](function(){return _0x36e2d3(null,_0x2952a9);});}}else{return utils['getLicense'](_0x2952a9)[_0xe3cc('0x20')](function(){return _0x36e2d3(null,_0x2952a9);});}})[_0xe3cc('0x24')](function(_0x4662a8){return _0x36e2d3(null,![],_0x4662a8);});}function handleError(_0x4b0f72,_0x3ae4e5,_0x16edfa){return _0x4b0f72['status'](_0x3ae4e5||0x1f4)[_0xe3cc('0x25')]({'message':_0x16edfa?_0x16edfa[_0xe3cc('0x26')]||_0x16edfa:''});}exports[_0xe3cc('0x27')]=function(_0x3d081b,_0xfa4507,_0x4fe5e8){passport[_0xe3cc('0xd')]('ad-login',function(_0x46869e,_0x4f0191,_0x280206){var _0x446668=_0x46869e||_0x280206;if(_0x446668){return handleError(_0xfa4507,0x191,_0x446668);}if(!_0x4f0191){return handleError(_0xfa4507,0x194,{'message':_0xe3cc('0x28')});}else{var _0x132568={'payload':{'id':_0x4f0191['id'],'role':_0x4f0191[_0xe3cc('0x1a')]},'options':{'expiresIn':0x15180}};return authService[_0xe3cc('0x29')](_0x132568)[_0xe3cc('0x20')](function(_0x3a0633){_0xfa4507[_0xe3cc('0x2a')]({'id':_0x4f0191['id'],'token':_0x3a0633,'statusCall':'','isAlreadyLogged':_0x4f0191[_0xe3cc('0x1c')]});});}})(_0x3d081b,_0xfa4507,_0x4fe5e8);};passport[_0xe3cc('0x2b')]('ad-login',new LocalStrategy({'usernameField':_0xe3cc('0x18'),'passwordField':_0xe3cc('0x19')},function(_0x3698b8,_0x36b1f9,_0x1aea35){return ActiveDirectoryAuthenticate(db['User'],_0x3698b8,_0x36b1f9,_0x1aea35);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 9a7f015..b04a4e1 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 _0x91c6=['./authActiveDirectory.controller','login','exports'];(function(_0x7365f2,_0x184980){var _0x1f5293=function(_0x5ad85f){while(--_0x5ad85f){_0x7365f2['push'](_0x7365f2['shift']());}};_0x1f5293(++_0x184980);}(_0x91c6,0x1b9));var _0x691c=function(_0x516281,_0x12077c){_0x516281=_0x516281-0x0;var _0x2614c9=_0x91c6[_0x516281];return _0x2614c9;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0x691c('0x0'));router['post']('/',controller[_0x691c('0x1')]);module[_0x691c('0x2')]=router; \ No newline at end of file +var _0x56e5=['post','express','./authActiveDirectory.controller'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x56e5,0x67));var _0x556e=function(_0x24e1ce,_0x4a7103){_0x24e1ce=_0x24e1ce-0x0;var _0x12b011=_0x56e5[_0x24e1ce];return _0x12b011;};'use strict';var express=require(_0x556e('0x0'));var router=express['Router']();var controller=require(_0x556e('0x1'));router[_0x556e('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 654b378..4a4ad4f 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x267a1a,_0x58627e){var _0x3e7d19=function(_0x13d2bd){while(--_0x13d2bd){_0x267a1a['push'](_0x267a1a['shift']());}};_0x3e7d19(++_0x58627e);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x7a54,0x106));var _0x47a5=function(_0x24b0bb,_0x48df9a){_0x24b0bb=_0x24b0bb-0x0;var _0x31cc9c=_0x7a54[_0x24b0bb];return _0x31cc9c;};'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 e6ae3e1..0cb4dd1 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 _0xaea0=['./authGoogle.controller','../user/user.controller.js','get','login','callback','setTokenCookie','exports','express','passport','Router'];(function(_0x571aa1,_0x2679b4){var _0x1efae1=function(_0x451339){while(--_0x451339){_0x571aa1['push'](_0x571aa1['shift']());}};_0x1efae1(++_0x2679b4);}(_0xaea0,0x165));var _0x0aea=function(_0x523adf,_0x3e1620){_0x523adf=_0x523adf-0x0;var _0x283870=_0xaea0[_0x523adf];return _0x283870;};'use strict';var express=require(_0x0aea('0x0'));var passport=require(_0x0aea('0x1'));var router=express[_0x0aea('0x2')]();var controller=require(_0x0aea('0x3'));var userController=require(_0x0aea('0x4'));var authService=require('../../components/auth/service');router[_0x0aea('0x5')]('/',controller[_0x0aea('0x6')]);router[_0x0aea('0x5')]('/callback',controller[_0x0aea('0x7')],authService['isMiddleware'],userController[_0x0aea('0x6')],authService[_0x0aea('0x8')]);module[_0x0aea('0x9')]=router; \ No newline at end of file +var _0x1c34=['setTokenCookie','exports','express','passport','./authGoogle.controller','get','login','/callback','callback'];(function(_0x3c268f,_0x358d2a){var _0x31fbd4=function(_0x13afdb){while(--_0x13afdb){_0x3c268f['push'](_0x3c268f['shift']());}};_0x31fbd4(++_0x358d2a);}(_0x1c34,0x65));var _0x41c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c34[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x41c3('0x0'));var passport=require(_0x41c3('0x1'));var router=express['Router']();var controller=require(_0x41c3('0x2'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0x41c3('0x3')]('/',controller[_0x41c3('0x4')]);router[_0x41c3('0x3')](_0x41c3('0x5'),controller[_0x41c3('0x6')],authService['isMiddleware'],userController[_0x41c3('0x4')],authService[_0x41c3('0x7')]);module[_0x41c3('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 859eb56..3afc149 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 _0x5215=['resetPasswordToken','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','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','catch','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','Password\x20reset!','use','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../config/utils','http','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','MailAccount','find','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','pass','merge','format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','send','message','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.'];(function(_0x2a9546,_0x1a0e9c){var _0x400007=function(_0x26d2e0){while(--_0x26d2e0){_0x2a9546['push'](_0x2a9546['shift']());}};_0x400007(++_0x1a0e9c);}(_0x5215,0x16c));var _0x5521=function(_0x1091eb,_0x2971b1){_0x1091eb=_0x1091eb-0x0;var _0x205b43=_0x5215[_0x1091eb];return _0x205b43;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require(_0x5521('0x0'))[_0x5521('0x1')];var jayson=require(_0x5521('0x2'));var _=require(_0x5521('0x3'));var rs=require(_0x5521('0x4'));var moment=require(_0x5521('0x5'));var db=require(_0x5521('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x5521('0x7'));var client=jayson['client'][_0x5521('0x8')]({'port':0x232b});function localAuthenticate(_0x5f4836,_0x39307d,_0x3453fc,_0x4b9a88){var _0x3e0574,_0xf2d584;return db['Setting'][_0x5521('0x9')]({'where':{'id':0x1},'attributes':[_0x5521('0xa'),_0x5521('0xb')],'raw':!![]})[_0x5521('0xc')](function(_0x2f401a){_0x3e0574=_0x2f401a;return _0x5f4836[_0x5521('0x9')]({'attributes':['id',_0x5521('0xd'),_0x5521('0xe'),_0x5521('0xf'),_0x5521('0x10'),_0x5521('0x11'),_0x5521('0x12'),_0x5521('0x13'),_0x5521('0x14')],'where':{'name':_0x39307d,'role':{'$or':[_0x5521('0x15'),_0x5521('0x16'),_0x5521('0x17')]}}});})[_0x5521('0xc')](function(_0x29f4d0){if(!_0x29f4d0||_0x29f4d0&&_0x29f4d0[_0x5521('0xd')]!==_0x39307d){throw new Error(_0x5521('0x18'));}else{_0xf2d584=_0x29f4d0;return _0xf2d584;}})['then'](function(){_0xf2d584['authenticate'](_0x3453fc,function(_0x24e379,_0x1926e9){var _0x3809e4=_0xf2d584[_0x5521('0x14')]+0x1;if(_0x24e379){return _0x4b9a88(_0x24e379);}else if(!_0x1926e9){if(_0xf2d584[_0x5521('0x11')]){return _0x4b9a88(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3e0574[_0x5521('0xa')]>0x0){if(_0xf2d584[_0x5521('0x12')]){if(_0x3e0574[_0x5521('0xb')]>0x0){if(moment(_0xf2d584[_0x5521('0x13')])[_0x5521('0x19')](_0x3e0574[_0x5521('0xb')],_0x5521('0x1a'))>moment()){return _0x4b9a88(null,![],{'message':_0x5521('0x18')});}else{return utils['clearBlockUser'](_0xf2d584,_0x3809e4,![],null)[_0x5521('0xc')](function(){return _0x4b9a88(null,![],{'message':_0x5521('0x18')});});}}else{return _0x4b9a88(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x3809e4>=_0x3e0574[_0x5521('0xa')]){return utils['clearBlockUser'](_0xf2d584,0x0,!![],moment())[_0x5521('0xc')](function(){return _0x4b9a88(null,![],{'message':_0x5521('0x18')});});}else{return utils['clearBlockUser'](_0xf2d584,_0x3809e4,![],null)[_0x5521('0xc')](function(){return _0x4b9a88(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x4b9a88(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0xf2d584[_0x5521('0x11')]){return _0x4b9a88(null,![],{'message':_0x5521('0x18')});}else if(_0x3e0574[_0x5521('0xa')]>0x0){if(_0xf2d584[_0x5521('0x12')]){if(_0x3e0574[_0x5521('0xb')]>0x0){if(moment(_0xf2d584[_0x5521('0x13')])['add'](_0x3e0574[_0x5521('0xb')],_0x5521('0x1a'))>moment()){return _0x4b9a88(null,![],{'message':_0x5521('0x18')});}else{return utils[_0x5521('0x1b')](_0xf2d584,0x0,![],null)[_0x5521('0xc')](function(){return utils['getLicense'](_0xf2d584);})[_0x5521('0xc')](function(){return _0x4b9a88(null,_0xf2d584);});}}else{return _0x4b9a88(null,![],{'message':_0x5521('0x18')});}}else{return utils[_0x5521('0x1b')](_0xf2d584,0x0,![],null)[_0x5521('0xc')](function(){return utils[_0x5521('0x1c')](_0xf2d584);})[_0x5521('0xc')](function(){return _0x4b9a88(null,_0xf2d584);})['catch'](function(_0x472e9c){return _0x4b9a88(null,![],_0x472e9c);});}}else{if(_0xf2d584[_0x5521('0x12')]){return _0x4b9a88(null,![],{'message':_0x5521('0x18')});}else{return utils[_0x5521('0x1c')](_0xf2d584)[_0x5521('0xc')](function(){return _0x4b9a88(null,_0xf2d584);});}}}});})['catch'](function(_0x469491){return _0x4b9a88(null,![],_0x469491);});}function sendServiceMail(_0x407666){return db[_0x5521('0x1d')][_0x5521('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x5521('0xd'),_0x5521('0x1f')],'include':[{'model':db[_0x5521('0x20')],'as':'Smtp'}]})['then'](function(_0xfb9df8){if(!_0xfb9df8){throw new Error(_0x5521('0x21'));}var _0x590195={'tls':{'rejectUnauthorized':![]}};if(_0xfb9df8[_0x5521('0x22')][_0x5521('0x23')]){_0x590195['service']=_0xfb9df8[_0x5521('0x22')]['service'];}else{_0x590195[_0x5521('0x24')]=_0xfb9df8[_0x5521('0x22')][_0x5521('0x24')];_0x590195[_0x5521('0x25')]=_0xfb9df8['Smtp'][_0x5521('0x25')];_0x590195[_0x5521('0x26')]=_0xfb9df8[_0x5521('0x22')][_0x5521('0x26')];}if(_0xfb9df8[_0x5521('0x22')]['authentication']){_0x590195['auth']={'user':_0xfb9df8[_0x5521('0x22')]['user'],'pass':_0xfb9df8[_0x5521('0x22')][_0x5521('0x27')]};}var _0x52037e={'account':_0x590195,'message':_[_0x5521('0x28')]({'from':util[_0x5521('0x29')](_0x5521('0x2a'),_0xfb9df8[_0x5521('0xd')],_0xfb9df8[_0x5521('0x1f')]||_0xfb9df8[_0x5521('0x22')][_0x5521('0x16')])},_0x407666)};return client['request'](_0x5521('0x2b'),_0x52037e);})['then'](function(_0x5bfe50){if(_0x5bfe50[_0x5521('0x2c')]){throw new Error(util[_0x5521('0x29')](_0x5521('0x2d'),_0x5bfe50['error']['message']||JSON[_0x5521('0x2e')](_0x5bfe50[_0x5521('0x2c')])));}return!![];});}function handleError(_0x106f5c,_0x51a720,_0x1ef811){return _0x106f5c['status'](_0x51a720||0x1f4)[_0x5521('0x2f')]({'message':_0x1ef811?_0x1ef811[_0x5521('0x30')]||_0x1ef811:''});}exports[_0x5521('0x31')]=function(_0x1cc39e,_0x30c0cd,_0x435217){passport[_0x5521('0x32')](_0x5521('0x33'),function(_0x46e12d,_0x485d00,_0x3515fd){var _0x4e183c=_0x46e12d||_0x3515fd;if(_0x4e183c){return handleError(_0x30c0cd,0x191,_0x4e183c);}if(!_0x485d00){return handleError(_0x30c0cd,0x194,{'message':_0x5521('0x34')});}else{var _0x1a83be={'payload':{'id':_0x485d00['id'],'role':_0x485d00[_0x5521('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x5521('0x35')](_0x1a83be)[_0x5521('0xc')](function(_0x10373d){_0x30c0cd[_0x5521('0x36')]({'id':_0x485d00['id'],'token':_0x10373d,'statusCall':'','isAlreadyLogged':_0x485d00[_0x5521('0x37')]});});}})(_0x1cc39e,_0x30c0cd,_0x435217);};exports[_0x5521('0x38')]=function(_0x5e4e2e,_0x54f5ef,_0x3b9e30){if(!_0x5e4e2e[_0x5521('0x39')][_0x5521('0x1f')]){return handleError(_0x54f5ef,0x1f4,{'message':_0x5521('0x3a')});}var _0x101441=rs[_0x5521('0x3b')]();_0x5e4e2e['body'][_0x5521('0x1f')]=_0x5e4e2e[_0x5521('0x39')][_0x5521('0x1f')][_0x5521('0x3c')]()[_0x5521('0x3d')]();var _0x301e76;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x5521('0xa'),_0x5521('0xb')],'raw':!![]})[_0x5521('0xc')](function(_0x136f95){_0x301e76=_0x136f95;return db[_0x5521('0x3e')][_0x5521('0x1e')]({'where':{'email':_0x5e4e2e[_0x5521('0x39')]['email']}});})['then'](function(_0x39df9c){if(!_0x39df9c){throw new Error(_0x5521('0x3f'));}if(_0x39df9c[_0x5521('0x11')]){throw new Error(_0x5521('0x40'));}if(_0x39df9c[_0x5521('0x12')]){if(moment(_0x39df9c['blockedAt'])[_0x5521('0x19')](_0x301e76['blockDuration'],'minutes')>moment()){throw new Error(_0x5521('0x41'));}else{_0x39df9c[_0x5521('0x12')]=![];_0x39df9c[_0x5521('0x13')]=null;}}_0x39df9c[_0x5521('0x42')]=_0x101441;_0x39df9c[_0x5521('0x43')]=Date[_0x5521('0x44')]()+0x36ee80;return _0x39df9c['save']();})[_0x5521('0xc')](function(){return sendServiceMail({'to':_0x5e4e2e[_0x5521('0x39')][_0x5521('0x1f')],'subject':_0x5521('0x45'),'text':_0x5521('0x46')+_0x5521('0x47')+_0x5521('0x48')+_0x5e4e2e[_0x5521('0x49')][_0x5521('0x24')]+_0x5521('0x4a')+_0x101441+'\x0a\x0a'+_0x5521('0x4b')});})[_0x5521('0xc')](function(){_0x54f5ef['status'](0xc8)[_0x5521('0x2f')]({'message':'Reset\x20Email\x20sent!'});})[_0x5521('0x4c')](function(_0x59aee){return handleError(_0x54f5ef,0x1f4,_0x59aee);});};exports[_0x5521('0x4d')]=function(_0x1c8e72,_0x3cb235,_0x7bd94d){return db['User'][_0x5521('0x1e')]({'where':{'resetPasswordToken':_0x1c8e72[_0x5521('0x4e')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x15cc6f){if(!_0x15cc6f){throw new Error(_0x5521('0x4f'));}return db['Setting']['findOne']({'attributes':['id',_0x5521('0x50'),_0x5521('0x51'),_0x5521('0x52')]})[_0x5521('0xc')](function(_0x55f532){if(_0x55f532[_0x5521('0x50')])authService['validatePasswordPattern'](_0x1c8e72[_0x5521('0x39')][_0x5521('0xe')]);if(!_0x55f532[_0x5521('0x51')]||!_0x15cc6f['previousPasswords'])return _0x15cc6f;authService['validatePasswordHistory'](_0x1c8e72[_0x5521('0x39')][_0x5521('0xe')],_0x15cc6f[_0x5521('0x53')],_0x55f532['passwordHistoryLimit']);return _0x15cc6f;})[_0x5521('0xc')](function(){_0x15cc6f[_0x5521('0xe')]=_0x1c8e72[_0x5521('0x39')][_0x5521('0xe')];_0x15cc6f[_0x5521('0x42')]=null;_0x15cc6f['resetPasswordExpires']=null;return _0x15cc6f['save']();});})[_0x5521('0xc')](function(){_0x3cb235['status'](0xc8)[_0x5521('0x2f')]({'message':_0x5521('0x54')});})[_0x5521('0x4c')](function(_0x59030e){return handleError(_0x3cb235,0x1f4,_0x59030e);});};passport[_0x5521('0x55')](_0x5521('0x33'),new LocalStrategy({'usernameField':_0x5521('0xd'),'passwordField':_0x5521('0xe')},function(_0x96da96,_0x331662,_0x4f561c){return localAuthenticate(db['User'],_0x96da96,_0x331662,_0x4f561c);})); \ No newline at end of file +var _0x57df=['securePassword','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','save','status','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','moment','../../components/auth/service','../../config/utils','client','Setting','findOne','blockDuration','then','name','password','salt','role','blocked','loginAttempts','admin','user','agent','authenticate','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','minutes','allowedLoginAttempts','clearBlockUser','getLicense','catch','MailAccount','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','pass','format','\x22%s\x22\x20<%s>','email','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','send','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','generate','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','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.'];(function(_0x289842,_0x2d9db4){var _0x16155a=function(_0x1d0510){while(--_0x1d0510){_0x289842['push'](_0x289842['shift']());}};_0x16155a(++_0x2d9db4);}(_0x57df,0x10b));var _0xf57d=function(_0x1ac53b,_0x57def8){_0x1ac53b=_0x1ac53b-0x0;var _0x9d9920=_0x57df[_0x1ac53b];return _0x9d9920;};'use strict';var util=require(_0xf57d('0x0'));var passport=require(_0xf57d('0x1'));var LocalStrategy=require(_0xf57d('0x2'))[_0xf57d('0x3')];var jayson=require(_0xf57d('0x4'));var _=require(_0xf57d('0x5'));var rs=require('randomstring');var moment=require(_0xf57d('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0xf57d('0x7'));var utils=require(_0xf57d('0x8'));var client=jayson[_0xf57d('0x9')]['http']({'port':0x232b});function localAuthenticate(_0x4f2094,_0x3f6ad7,_0x217e10,_0x5d8a21){var _0x4768f2,_0x23c632;return db[_0xf57d('0xa')][_0xf57d('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xf57d('0xc')],'raw':!![]})[_0xf57d('0xd')](function(_0x5d7b9a){_0x4768f2=_0x5d7b9a;return _0x4f2094[_0xf57d('0xb')]({'attributes':['id',_0xf57d('0xe'),_0xf57d('0xf'),_0xf57d('0x10'),_0xf57d('0x11'),'disabled',_0xf57d('0x12'),'blockedAt',_0xf57d('0x13')],'where':{'name':_0x3f6ad7,'role':{'$or':[_0xf57d('0x14'),_0xf57d('0x15'),_0xf57d('0x16')]}}});})[_0xf57d('0xd')](function(_0x367972){if(!_0x367972||_0x367972&&_0x367972['name']!==_0x3f6ad7){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x23c632=_0x367972;return _0x23c632;}})[_0xf57d('0xd')](function(){_0x23c632[_0xf57d('0x17')](_0x217e10,function(_0x384aff,_0x3f5a40){var _0x1b1d01=_0x23c632['loginAttempts']+0x1;if(_0x384aff){return _0x5d8a21(_0x384aff);}else if(!_0x3f5a40){if(_0x23c632[_0xf57d('0x18')]){return _0x5d8a21(null,![],{'message':_0xf57d('0x19')});}else if(_0x4768f2['allowedLoginAttempts']>0x0){if(_0x23c632[_0xf57d('0x12')]){if(_0x4768f2['blockDuration']>0x0){if(moment(_0x23c632[_0xf57d('0x1a')])[_0xf57d('0x1b')](_0x4768f2[_0xf57d('0xc')],_0xf57d('0x1c'))>moment()){return _0x5d8a21(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x23c632,_0x1b1d01,![],null)[_0xf57d('0xd')](function(){return _0x5d8a21(null,![],{'message':_0xf57d('0x19')});});}}else{return _0x5d8a21(null,![],{'message':_0xf57d('0x19')});}}else{if(_0x1b1d01>=_0x4768f2[_0xf57d('0x1d')]){return utils[_0xf57d('0x1e')](_0x23c632,0x0,!![],moment())[_0xf57d('0xd')](function(){return _0x5d8a21(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x23c632,_0x1b1d01,![],null)[_0xf57d('0xd')](function(){return _0x5d8a21(null,![],{'message':_0xf57d('0x19')});});}}}else{return _0x5d8a21(null,![],{'message':_0xf57d('0x19')});}}else{if(_0x23c632[_0xf57d('0x18')]){return _0x5d8a21(null,![],{'message':_0xf57d('0x19')});}else if(_0x4768f2[_0xf57d('0x1d')]>0x0){if(_0x23c632[_0xf57d('0x12')]){if(_0x4768f2[_0xf57d('0xc')]>0x0){if(moment(_0x23c632[_0xf57d('0x1a')])[_0xf57d('0x1b')](_0x4768f2[_0xf57d('0xc')],_0xf57d('0x1c'))>moment()){return _0x5d8a21(null,![],{'message':_0xf57d('0x19')});}else{return utils['clearBlockUser'](_0x23c632,0x0,![],null)[_0xf57d('0xd')](function(){return utils[_0xf57d('0x1f')](_0x23c632);})['then'](function(){return _0x5d8a21(null,_0x23c632);});}}else{return _0x5d8a21(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x23c632,0x0,![],null)[_0xf57d('0xd')](function(){return utils['getLicense'](_0x23c632);})[_0xf57d('0xd')](function(){return _0x5d8a21(null,_0x23c632);})['catch'](function(_0x2350b0){return _0x5d8a21(null,![],_0x2350b0);});}}else{if(_0x23c632[_0xf57d('0x12')]){return _0x5d8a21(null,![],{'message':_0xf57d('0x19')});}else{return utils[_0xf57d('0x1f')](_0x23c632)[_0xf57d('0xd')](function(){return _0x5d8a21(null,_0x23c632);});}}}});})[_0xf57d('0x20')](function(_0x4acead){return _0x5d8a21(null,![],_0x4acead);});}function sendServiceMail(_0x1f72fb){return db[_0xf57d('0x21')][_0xf57d('0x22')]({'where':{'service':!![]},'attributes':['id',_0xf57d('0xe'),'email'],'include':[{'model':db[_0xf57d('0x23')],'as':_0xf57d('0x24')}]})['then'](function(_0x462940){if(!_0x462940){throw new Error(_0xf57d('0x25'));}var _0x484c0a={'tls':{'rejectUnauthorized':![]}};if(_0x462940['Smtp']['service']){_0x484c0a[_0xf57d('0x26')]=_0x462940[_0xf57d('0x24')][_0xf57d('0x26')];}else{_0x484c0a[_0xf57d('0x27')]=_0x462940[_0xf57d('0x24')][_0xf57d('0x27')];_0x484c0a[_0xf57d('0x28')]=_0x462940['Smtp'][_0xf57d('0x28')];_0x484c0a[_0xf57d('0x29')]=_0x462940[_0xf57d('0x24')][_0xf57d('0x29')];}if(_0x462940['Smtp'][_0xf57d('0x2a')]){_0x484c0a['auth']={'user':_0x462940[_0xf57d('0x24')][_0xf57d('0x15')],'pass':_0x462940[_0xf57d('0x24')][_0xf57d('0x2b')]};}var _0x29cb49={'account':_0x484c0a,'message':_['merge']({'from':util[_0xf57d('0x2c')](_0xf57d('0x2d'),_0x462940[_0xf57d('0xe')],_0x462940[_0xf57d('0x2e')]||_0x462940[_0xf57d('0x24')][_0xf57d('0x15')])},_0x1f72fb)};return client['request'](_0xf57d('0x2f'),_0x29cb49);})[_0xf57d('0xd')](function(_0x1f1912){if(_0x1f1912[_0xf57d('0x30')]){throw new Error(util[_0xf57d('0x2c')](_0xf57d('0x31'),_0x1f1912['error']['message']||JSON['stringify'](_0x1f1912[_0xf57d('0x30')])));}return!![];});}function handleError(_0x16fd99,_0x5db7d3,_0x2223a0){return _0x16fd99['status'](_0x5db7d3||0x1f4)[_0xf57d('0x32')]({'message':_0x2223a0?_0x2223a0[_0xf57d('0x33')]||_0x2223a0:''});}exports[_0xf57d('0x34')]=function(_0x2ace6d,_0x378f9c,_0x274159){passport['authenticate'](_0xf57d('0x35'),function(_0x55c9a6,_0xe6e258,_0x2acc7f){var _0x488e0d=_0x55c9a6||_0x2acc7f;if(_0x488e0d){return handleError(_0x378f9c,0x191,_0x488e0d);}if(!_0xe6e258){return handleError(_0x378f9c,0x194,{'message':_0xf57d('0x36')});}else{var _0x55355a={'payload':{'id':_0xe6e258['id'],'role':_0xe6e258[_0xf57d('0x11')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x55355a)['then'](function(_0x562729){_0x378f9c[_0xf57d('0x37')]({'id':_0xe6e258['id'],'token':_0x562729,'statusCall':'','isAlreadyLogged':_0xe6e258[_0xf57d('0x38')]});});}})(_0x2ace6d,_0x378f9c,_0x274159);};exports[_0xf57d('0x39')]=function(_0x4a40cc,_0x38a971,_0x2de7a7){if(!_0x4a40cc[_0xf57d('0x3a')]['email']){return handleError(_0x38a971,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x2eb75d=rs[_0xf57d('0x3b')]();_0x4a40cc['body']['email']=_0x4a40cc[_0xf57d('0x3a')][_0xf57d('0x2e')][_0xf57d('0x3c')]()[_0xf57d('0x3d')]();var _0x2bfef1;return db[_0xf57d('0xa')][_0xf57d('0xb')]({'where':{'id':0x1},'attributes':[_0xf57d('0x1d'),_0xf57d('0xc')],'raw':!![]})['then'](function(_0x449f61){_0x2bfef1=_0x449f61;return db[_0xf57d('0x3e')]['find']({'where':{'email':_0x4a40cc[_0xf57d('0x3a')][_0xf57d('0x2e')]}});})['then'](function(_0x5a51fb){if(!_0x5a51fb){throw new Error(_0xf57d('0x3f'));}if(_0x5a51fb[_0xf57d('0x18')]){throw new Error(_0xf57d('0x40'));}if(_0x5a51fb[_0xf57d('0x12')]){if(moment(_0x5a51fb[_0xf57d('0x1a')])[_0xf57d('0x1b')](_0x2bfef1[_0xf57d('0xc')],_0xf57d('0x1c'))>moment()){throw new Error(_0xf57d('0x41'));}else{_0x5a51fb[_0xf57d('0x12')]=![];_0x5a51fb[_0xf57d('0x1a')]=null;}}_0x5a51fb[_0xf57d('0x42')]=_0x2eb75d;_0x5a51fb[_0xf57d('0x43')]=Date['now']()+0x36ee80;return _0x5a51fb['save']();})[_0xf57d('0xd')](function(){return sendServiceMail({'to':_0x4a40cc[_0xf57d('0x3a')][_0xf57d('0x2e')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xf57d('0x44')+_0xf57d('0x45')+'https://'+_0x4a40cc[_0xf57d('0x46')][_0xf57d('0x27')]+'/reset/'+_0x2eb75d+'\x0a\x0a'+_0xf57d('0x47')});})[_0xf57d('0xd')](function(){_0x38a971['status'](0xc8)[_0xf57d('0x32')]({'message':'Reset\x20Email\x20sent!'});})[_0xf57d('0x20')](function(_0x551892){return handleError(_0x38a971,0x1f4,_0x551892);});};exports[_0xf57d('0x48')]=function(_0x4d2dba,_0x3e649f,_0x109ce5){return db[_0xf57d('0x3e')]['find']({'where':{'resetPasswordToken':_0x4d2dba[_0xf57d('0x49')][_0xf57d('0x4a')],'resetPasswordExpires':{'$gt':Date[_0xf57d('0x4b')]()}}})['then'](function(_0x418632){if(!_0x418632){throw new Error(_0xf57d('0x4c'));}return db[_0xf57d('0xa')][_0xf57d('0xb')]({'attributes':['id',_0xf57d('0x4d'),'enforcePasswordHistory',_0xf57d('0x4e')]})[_0xf57d('0xd')](function(_0x2f6d89){if(_0x2f6d89[_0xf57d('0x4d')])authService[_0xf57d('0x4f')](_0x4d2dba['body'][_0xf57d('0xf')]);if(!_0x2f6d89['enforcePasswordHistory']||!_0x418632[_0xf57d('0x50')])return _0x418632;authService[_0xf57d('0x51')](_0x4d2dba[_0xf57d('0x3a')][_0xf57d('0xf')],_0x418632[_0xf57d('0x50')],_0x2f6d89[_0xf57d('0x4e')]);return _0x418632;})[_0xf57d('0xd')](function(){_0x418632[_0xf57d('0xf')]=_0x4d2dba[_0xf57d('0x3a')]['password'];_0x418632[_0xf57d('0x42')]=null;_0x418632[_0xf57d('0x43')]=null;return _0x418632[_0xf57d('0x52')]();});})['then'](function(){_0x3e649f[_0xf57d('0x53')](0xc8)[_0xf57d('0x32')]({'message':_0xf57d('0x54')});})['catch'](function(_0x4b6ee5){return handleError(_0x3e649f,0x1f4,_0x4b6ee5);});};passport[_0xf57d('0x55')](_0xf57d('0x35'),new LocalStrategy({'usernameField':_0xf57d('0xe'),'passwordField':_0xf57d('0xf')},function(_0x4810df,_0x2d1022,_0x4920a9){return localAuthenticate(db[_0xf57d('0x3e')],_0x4810df,_0x2d1022,_0x4920a9);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index bae2652..12c83f8 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 _0x7e38=['exports','express','post','login','/forgot','/reset/:token','reset'];(function(_0x1504bc,_0x38f669){var _0x9f7b75=function(_0x576b78){while(--_0x576b78){_0x1504bc['push'](_0x1504bc['shift']());}};_0x9f7b75(++_0x38f669);}(_0x7e38,0x1d6));var _0x87e3=function(_0x545f6e,_0x499964){_0x545f6e=_0x545f6e-0x0;var _0x4efbf0=_0x7e38[_0x545f6e];return _0x4efbf0;};'use strict';var express=require(_0x87e3('0x0'));var router=express['Router']();var controller=require('./authLocal.controller');router[_0x87e3('0x1')]('/',controller[_0x87e3('0x2')]);router[_0x87e3('0x1')](_0x87e3('0x3'),controller['forgot']);router[_0x87e3('0x1')](_0x87e3('0x4'),controller[_0x87e3('0x5')]);module[_0x87e3('0x6')]=router; \ No newline at end of file +var _0x2e0c=['reset','express','Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token'];(function(_0x5a9e51,_0x3153db){var _0x3b8c67=function(_0x4e7d00){while(--_0x4e7d00){_0x5a9e51['push'](_0x5a9e51['shift']());}};_0x3b8c67(++_0x3153db);}(_0x2e0c,0x1a8));var _0xc2e0=function(_0x42681b,_0x502bed){_0x42681b=_0x42681b-0x0;var _0x583f3b=_0x2e0c[_0x42681b];return _0x583f3b;};'use strict';var express=require(_0xc2e0('0x0'));var router=express[_0xc2e0('0x1')]();var controller=require(_0xc2e0('0x2'));router[_0xc2e0('0x3')]('/',controller[_0xc2e0('0x4')]);router[_0xc2e0('0x3')](_0xc2e0('0x5'),controller[_0xc2e0('0x6')]);router['post'](_0xc2e0('0x7'),controller[_0xc2e0('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 898b826..3b15f54 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 _0xe957=['exports','STRING','BOOLEAN','sequelize'];(function(_0x4a2b3c,_0xc69f59){var _0x4b081b=function(_0x3dfcb1){while(--_0x3dfcb1){_0x4a2b3c['push'](_0x4a2b3c['shift']());}};_0x4b081b(++_0xc69f59);}(_0xe957,0xf7));var _0x7e95=function(_0x2c0dd1,_0x421f81){_0x2c0dd1=_0x2c0dd1-0x0;var _0x21b50a=_0xe957[_0x2c0dd1];return _0x21b50a;};'use strict';var Sequelize=require(_0x7e95('0x0'));module[_0x7e95('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x7e95('0x2')]},'description':{'type':Sequelize[_0x7e95('0x2')]},'status':{'type':Sequelize[_0x7e95('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x7e01=['STRING','INTEGER','exports'];(function(_0x2c938f,_0xdcfc90){var _0x22c7c9=function(_0xb78fc3){while(--_0xb78fc3){_0x2c938f['push'](_0x2c938f['shift']());}};_0x22c7c9(++_0xdcfc90);}(_0x7e01,0xbf));var _0x17e0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7e01[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0x17e0('0x0')]={'name':{'type':Sequelize[_0x17e0('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x17e0('0x1')]},'description':{'type':Sequelize[_0x17e0('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x17e0('0x2')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 29d11e5..0ebf09f 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 _0x701e=['attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','Automation','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','addConditions','Condition','ids','omit','getConditions','findOne','sort','Action','addActions','getActions','eml-format','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','end','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model'];(function(_0x2f872d,_0x126fd0){var _0x54888a=function(_0x127aa8){while(--_0x127aa8){_0x2f872d['push'](_0x2f872d['shift']());}};_0x54888a(++_0x126fd0);}(_0x701e,0x12b));var _0xe701=function(_0x28a55b,_0x4f15c3){_0x28a55b=_0x28a55b-0x0;var _0xefa6d6=_0x701e[_0x28a55b];return _0xefa6d6;};'use strict';var emlformat=require(_0xe701('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe701('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe701('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe701('0x3'));var util=require('util');var path=require(_0xe701('0x4'));var sox=require(_0xe701('0x5'));var csv=require(_0xe701('0x6'));var ejs=require(_0xe701('0x7'));var fs=require('fs');var fs_extra=require(_0xe701('0x8'));var _=require(_0xe701('0x9'));var squel=require(_0xe701('0xa'));var crypto=require(_0xe701('0xb'));var jsforce=require(_0xe701('0xc'));var deskjs=require(_0xe701('0xd'));var toCsv=require(_0xe701('0x6'));var querystring=require(_0xe701('0xe'));var Papa=require(_0xe701('0xf'));var Redis=require(_0xe701('0x10'));var authService=require(_0xe701('0x11'));var qs=require(_0xe701('0x12'));var as=require(_0xe701('0x13'));var hardwareService=require(_0xe701('0x14'));var logger=require(_0xe701('0x15'))(_0xe701('0x16'));var utils=require('../../config/utils');var config=require(_0xe701('0x17'));var licenseUtil=require(_0xe701('0x18'));var db=require(_0xe701('0x19'))['db'];function respondWithStatusCode(_0x2c53f2,_0x7e018a){_0x7e018a=_0x7e018a||0xcc;return function(_0x2e5a15){if(_0x2e5a15){return _0x2c53f2[_0xe701('0x1a')](_0x7e018a);}return _0x2c53f2[_0xe701('0x1b')](_0x7e018a)['end']();};}function respondWithResult(_0x57f6b0,_0x49ee0f){_0x49ee0f=_0x49ee0f||0xc8;return function(_0x3a0db1){if(_0x3a0db1){return _0x57f6b0[_0xe701('0x1b')](_0x49ee0f)[_0xe701('0x1c')](_0x3a0db1);}};}function respondWithFilteredResult(_0x55050b,_0x36f599){return function(_0x40c111){if(_0x40c111){var _0x3de514=typeof _0x36f599[_0xe701('0x1d')]===_0xe701('0x1e')&&typeof _0x36f599['limit']===_0xe701('0x1e');var _0x360b5c=_0x40c111[_0xe701('0x1f')];var _0x345db0=_0x3de514?0x0:_0x36f599[_0xe701('0x1d')];var _0x16c2ad=_0x3de514?_0x40c111[_0xe701('0x1f')]:_0x36f599[_0xe701('0x1d')]+_0x36f599[_0xe701('0x20')];var _0x26b753;if(_0x16c2ad>=_0x360b5c){_0x16c2ad=_0x360b5c;_0x26b753=0xc8;}else{_0x26b753=0xce;}_0x55050b[_0xe701('0x1b')](_0x26b753);return _0x55050b['set'](_0xe701('0x21'),_0x345db0+'-'+_0x16c2ad+'/'+_0x360b5c)[_0xe701('0x1c')](_0x40c111);}return null;};}function patchUpdates(_0x355976){return function(_0x48c652){try{jsonpatch[_0xe701('0x22')](_0x48c652,_0x355976,!![]);}catch(_0x4138ae){return BPromise[_0xe701('0x23')](_0x4138ae);}return _0x48c652[_0xe701('0x24')]();};}function saveUpdates(_0x4c9d68,_0x47a391){return function(_0x5d9758){if(_0x5d9758){return _0x5d9758[_0xe701('0x25')](_0x4c9d68)['then'](function(_0x269042){return _0x269042;});}return null;};}function removeEntity(_0x4ac04f,_0x41cb49){return function(_0xd2f7a3){if(_0xd2f7a3){return _0xd2f7a3['destroy']()['then'](function(){_0x4ac04f[_0xe701('0x1b')](0xcc)[_0xe701('0x26')]();});}};}function handleEntityNotFound(_0x2fec38,_0x55ba4f){return function(_0x4424c9){if(!_0x4424c9){_0x2fec38[_0xe701('0x1a')](0x194);}return _0x4424c9;};}function handleError(_0x5261eb,_0x40d083){_0x40d083=_0x40d083||0x1f4;return function(_0x35a3bc){logger[_0xe701('0x27')](_0x35a3bc['stack']);if(_0x35a3bc['name']){delete _0x35a3bc[_0xe701('0x28')];}_0x5261eb[_0xe701('0x1b')](_0x40d083)[_0xe701('0x29')](_0x35a3bc);};}exports[_0xe701('0x2a')]=function(_0xb1358c,_0x35d019){var _0x1fc1ad={},_0x2d7b94={},_0x594c8a={'count':0x0,'rows':[]};var _0x83d431=_[_0xe701('0x2b')](db['Automation'][_0xe701('0x2c')],function(_0x1eaf87){return{'name':_0x1eaf87[_0xe701('0x2d')],'type':_0x1eaf87[_0xe701('0x2e')][_0xe701('0x2f')]};});_0x2d7b94['model']=_[_0xe701('0x2b')](_0x83d431,_0xe701('0x28'));_0x2d7b94[_0xe701('0x30')]=_[_0xe701('0x31')](_0xb1358c[_0xe701('0x30')]);_0x2d7b94[_0xe701('0x32')]=_[_0xe701('0x33')](_0x2d7b94[_0xe701('0x34')],_0x2d7b94['query']);_0x1fc1ad[_0xe701('0x35')]=_[_0xe701('0x33')](_0x2d7b94['model'],qs[_0xe701('0x36')](_0xb1358c['query'][_0xe701('0x36')]));_0x1fc1ad['attributes']=_0x1fc1ad[_0xe701('0x35')][_0xe701('0x37')]?_0x1fc1ad[_0xe701('0x35')]:_0x2d7b94['model'];if(!_0xb1358c[_0xe701('0x30')][_0xe701('0x38')](_0xe701('0x39'))){_0x1fc1ad['limit']=qs[_0xe701('0x20')](_0xb1358c[_0xe701('0x30')][_0xe701('0x20')]);_0x1fc1ad[_0xe701('0x1d')]=qs[_0xe701('0x1d')](_0xb1358c[_0xe701('0x30')][_0xe701('0x1d')]);}_0x1fc1ad[_0xe701('0x3a')]=qs['sort'](_0xb1358c[_0xe701('0x30')]['sort']);_0x1fc1ad[_0xe701('0x3b')]=qs['filters'](_[_0xe701('0x3c')](_0xb1358c[_0xe701('0x30')],_0x2d7b94['filters']),_0x83d431);if(_0xb1358c[_0xe701('0x30')][_0xe701('0x3d')]){_0x1fc1ad['where']=_['merge'](_0x1fc1ad[_0xe701('0x3b')],{'$or':_[_0xe701('0x2b')](_0x83d431,function(_0x20c484){if(_0x20c484['type']!==_0xe701('0x3e')){var _0x5aecec={};_0x5aecec[_0x20c484[_0xe701('0x28')]]={'$like':'%'+_0xb1358c[_0xe701('0x30')][_0xe701('0x3d')]+'%'};return _0x5aecec;}})});}_0x1fc1ad=_[_0xe701('0x3f')]({},_0x1fc1ad,_0xb1358c[_0xe701('0x40')]);var _0xd85cbb={'where':_0x1fc1ad[_0xe701('0x3b')]};return db[_0xe701('0x41')][_0xe701('0x1f')](_0xd85cbb)[_0xe701('0x42')](function(_0xe5218a){_0x594c8a[_0xe701('0x1f')]=_0xe5218a;if(_0xb1358c[_0xe701('0x30')][_0xe701('0x43')]){_0x1fc1ad[_0xe701('0x44')]=[{'all':!![]}];}return db[_0xe701('0x41')][_0xe701('0x45')](_0x1fc1ad);})[_0xe701('0x42')](function(_0x28769b){_0x594c8a[_0xe701('0x46')]=_0x28769b;return _0x594c8a;})['then'](respondWithFilteredResult(_0x35d019,_0x1fc1ad))[_0xe701('0x47')](handleError(_0x35d019,null));};exports[_0xe701('0x48')]=function(_0x503c4a,_0x3e15b8){var _0x4a4e05={'raw':![],'where':{'id':_0x503c4a[_0xe701('0x49')]['id']}},_0x16fc19={};_0x16fc19[_0xe701('0x34')]=_[_0xe701('0x31')](db[_0xe701('0x41')]['rawAttributes']);_0x16fc19[_0xe701('0x30')]=_[_0xe701('0x31')](_0x503c4a[_0xe701('0x30')]);_0x16fc19[_0xe701('0x32')]=_['intersection'](_0x16fc19[_0xe701('0x34')],_0x16fc19[_0xe701('0x30')]);_0x4a4e05[_0xe701('0x35')]=_[_0xe701('0x33')](_0x16fc19[_0xe701('0x34')],qs[_0xe701('0x36')](_0x503c4a[_0xe701('0x30')][_0xe701('0x36')]));_0x4a4e05[_0xe701('0x35')]=_0x4a4e05[_0xe701('0x35')][_0xe701('0x37')]?_0x4a4e05[_0xe701('0x35')]:_0x16fc19[_0xe701('0x34')];if(_0x503c4a[_0xe701('0x30')][_0xe701('0x43')]){_0x4a4e05['include']=[{'all':!![]}];}_0x4a4e05=_[_0xe701('0x3f')]({},_0x4a4e05,_0x503c4a[_0xe701('0x40')]);return db['Automation'][_0xe701('0x4a')](_0x4a4e05)[_0xe701('0x42')](handleEntityNotFound(_0x3e15b8,null))[_0xe701('0x42')](respondWithResult(_0x3e15b8,null))['catch'](handleError(_0x3e15b8,null));};exports[_0xe701('0x4b')]=function(_0x559155,_0x449026){return db['Automation'][_0xe701('0x4b')](_0x559155['body'],{})['then'](respondWithResult(_0x449026,0xc9))['catch'](handleError(_0x449026,null));};exports['update']=function(_0x360434,_0x37ca11){if(_0x360434[_0xe701('0x4c')]['id']){delete _0x360434['body']['id'];}return db[_0xe701('0x41')][_0xe701('0x4a')]({'where':{'id':_0x360434[_0xe701('0x49')]['id']}})[_0xe701('0x42')](handleEntityNotFound(_0x37ca11,null))[_0xe701('0x42')](saveUpdates(_0x360434[_0xe701('0x4c')],null))[_0xe701('0x42')](respondWithResult(_0x37ca11,null))['catch'](handleError(_0x37ca11,null));};exports[_0xe701('0x4d')]=function(_0x37d3cb,_0x455fe8){return db[_0xe701('0x41')][_0xe701('0x4a')]({'where':{'id':_0x37d3cb[_0xe701('0x49')]['id']}})[_0xe701('0x42')](handleEntityNotFound(_0x455fe8,null))['then'](removeEntity(_0x455fe8,null))['catch'](handleError(_0x455fe8,null));};exports[_0xe701('0x4e')]=function(_0x583e48,_0x561ed2,_0x48d7fb){return db[_0xe701('0x4f')][_0xe701('0x4a')]({'where':{'id':_0x583e48['params']['id']}})[_0xe701('0x42')](handleEntityNotFound(_0x561ed2,null))[_0xe701('0x42')](function(_0x554271){if(_0x554271){return _0x554271[_0xe701('0x4e')](_0x583e48[_0xe701('0x4c')][_0xe701('0x50')],_[_0xe701('0x51')](_0x583e48[_0xe701('0x4c')],[_0xe701('0x50'),'id'])||{});}})[_0xe701('0x42')](respondWithResult(_0x561ed2,null))[_0xe701('0x47')](handleError(_0x561ed2,null));};exports[_0xe701('0x52')]=function(_0xefd414,_0x1b4858,_0x140182){var _0x33fd32={};var _0x1dd813={};var _0x389cc8;var _0x12ec31;return db[_0xe701('0x41')][_0xe701('0x53')]({'where':{'id':_0xefd414['params']['id']}})['then'](handleEntityNotFound(_0x1b4858,null))[_0xe701('0x42')](function(_0x534dee){if(_0x534dee){_0x389cc8=_0x534dee;_0x1dd813[_0xe701('0x34')]=_['keys'](db['Condition'][_0xe701('0x2c')]);_0x1dd813[_0xe701('0x30')]=_['keys'](_0xefd414[_0xe701('0x30')]);_0x1dd813[_0xe701('0x32')]=_[_0xe701('0x33')](_0x1dd813[_0xe701('0x34')],_0x1dd813[_0xe701('0x30')]);_0x33fd32[_0xe701('0x35')]=_[_0xe701('0x33')](_0x1dd813[_0xe701('0x34')],qs['fields'](_0xefd414[_0xe701('0x30')][_0xe701('0x36')]));_0x33fd32['attributes']=_0x33fd32[_0xe701('0x35')][_0xe701('0x37')]?_0x33fd32[_0xe701('0x35')]:_0x1dd813[_0xe701('0x34')];_0x33fd32['order']=qs[_0xe701('0x54')](_0xefd414[_0xe701('0x30')]['sort']);_0x33fd32[_0xe701('0x3b')]=qs[_0xe701('0x32')](_[_0xe701('0x3c')](_0xefd414['query'],_0x1dd813[_0xe701('0x32')]));if(_0xefd414[_0xe701('0x30')][_0xe701('0x3d')]){_0x33fd32[_0xe701('0x3b')]=_[_0xe701('0x3f')](_0x33fd32['where'],{'$or':_[_0xe701('0x2b')](_0x33fd32[_0xe701('0x35')],function(_0x1d8711){var _0x2a64d8={};_0x2a64d8[_0x1d8711]={'$like':'%'+_0xefd414[_0xe701('0x30')]['filter']+'%'};return _0x2a64d8;})});}_0x33fd32=_[_0xe701('0x3f')]({},_0x33fd32,_0xefd414[_0xe701('0x40')]);return _0x389cc8[_0xe701('0x52')](_0x33fd32);}})['then'](function(_0x34eed3){if(_0x34eed3){_0x12ec31=_0x34eed3['length'];if(!_0xefd414[_0xe701('0x30')][_0xe701('0x38')]('nolimit')){_0x33fd32[_0xe701('0x20')]=qs[_0xe701('0x20')](_0xefd414[_0xe701('0x30')][_0xe701('0x20')]);_0x33fd32[_0xe701('0x1d')]=qs[_0xe701('0x1d')](_0xefd414[_0xe701('0x30')][_0xe701('0x1d')]);}return _0x389cc8['getConditions'](_0x33fd32);}})[_0xe701('0x42')](function(_0x425130){if(_0x425130){return _0x425130?{'count':_0x12ec31,'rows':_0x425130}:null;}})[_0xe701('0x42')](respondWithResult(_0x1b4858,null))[_0xe701('0x47')](handleError(_0x1b4858,null));};exports['addActions']=function(_0x21a653,_0x500ebb,_0x2b3c86){return db[_0xe701('0x55')][_0xe701('0x4a')]({'where':{'id':_0x21a653[_0xe701('0x49')]['id']}})[_0xe701('0x42')](handleEntityNotFound(_0x500ebb,null))[_0xe701('0x42')](function(_0x1aae68){if(_0x1aae68){return _0x1aae68[_0xe701('0x56')](_0x21a653['body']['ids'],_[_0xe701('0x51')](_0x21a653[_0xe701('0x4c')],[_0xe701('0x50'),'id'])||{});}})[_0xe701('0x42')](respondWithResult(_0x500ebb,null))[_0xe701('0x47')](handleError(_0x500ebb,null));};exports[_0xe701('0x57')]=function(_0x200dce,_0x111dc2,_0x2054e7){var _0x4cdee8={};var _0x262f4a={};var _0x282394;var _0x5c3686;return db[_0xe701('0x41')][_0xe701('0x53')]({'where':{'id':_0x200dce[_0xe701('0x49')]['id']}})[_0xe701('0x42')](handleEntityNotFound(_0x111dc2,null))[_0xe701('0x42')](function(_0x4fbfe2){if(_0x4fbfe2){_0x282394=_0x4fbfe2;_0x262f4a['model']=_[_0xe701('0x31')](db[_0xe701('0x55')][_0xe701('0x2c')]);_0x262f4a[_0xe701('0x30')]=_['keys'](_0x200dce[_0xe701('0x30')]);_0x262f4a['filters']=_[_0xe701('0x33')](_0x262f4a[_0xe701('0x34')],_0x262f4a['query']);_0x4cdee8[_0xe701('0x35')]=_[_0xe701('0x33')](_0x262f4a[_0xe701('0x34')],qs[_0xe701('0x36')](_0x200dce[_0xe701('0x30')][_0xe701('0x36')]));_0x4cdee8[_0xe701('0x35')]=_0x4cdee8[_0xe701('0x35')][_0xe701('0x37')]?_0x4cdee8[_0xe701('0x35')]:_0x262f4a[_0xe701('0x34')];_0x4cdee8[_0xe701('0x3a')]=qs[_0xe701('0x54')](_0x200dce[_0xe701('0x30')]['sort']);_0x4cdee8[_0xe701('0x3b')]=qs[_0xe701('0x32')](_['pick'](_0x200dce[_0xe701('0x30')],_0x262f4a[_0xe701('0x32')]));if(_0x200dce[_0xe701('0x30')]['filter']){_0x4cdee8[_0xe701('0x3b')]=_['merge'](_0x4cdee8['where'],{'$or':_['map'](_0x4cdee8[_0xe701('0x35')],function(_0x19d55a){var _0x229ba8={};_0x229ba8[_0x19d55a]={'$like':'%'+_0x200dce[_0xe701('0x30')][_0xe701('0x3d')]+'%'};return _0x229ba8;})});}_0x4cdee8=_[_0xe701('0x3f')]({},_0x4cdee8,_0x200dce[_0xe701('0x40')]);return _0x282394[_0xe701('0x57')](_0x4cdee8);}})['then'](function(_0x757e32){if(_0x757e32){_0x5c3686=_0x757e32[_0xe701('0x37')];if(!_0x200dce['query'][_0xe701('0x38')](_0xe701('0x39'))){_0x4cdee8[_0xe701('0x20')]=qs[_0xe701('0x20')](_0x200dce[_0xe701('0x30')]['limit']);_0x4cdee8[_0xe701('0x1d')]=qs[_0xe701('0x1d')](_0x200dce[_0xe701('0x30')][_0xe701('0x1d')]);}return _0x282394['getActions'](_0x4cdee8);}})[_0xe701('0x42')](function(_0x1dec37){if(_0x1dec37){return _0x1dec37?{'count':_0x5c3686,'rows':_0x1dec37}:null;}})[_0xe701('0x42')](respondWithResult(_0x111dc2,null))['catch'](handleError(_0x111dc2,null));}; \ No newline at end of file +var _0xd92b=['status','end','json','offset','limit','undefined','count','set','apply','save','then','destroy','error','stack','name','send','index','map','Automation','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','rawAttributes','include','merge','find','create','body','update','params','Condition','addConditions','ids','omit','getConditions','findOne','order','addActions','Action','getActions','hasOwnProperty','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus'];(function(_0x3bbc6f,_0x43ad7c){var _0xb2b8de=function(_0x4575ec){while(--_0x4575ec){_0x3bbc6f['push'](_0x3bbc6f['shift']());}};_0xb2b8de(++_0x43ad7c);}(_0xd92b,0x13f));var _0xbd92=function(_0x512123,_0x42a5f7){_0x512123=_0x512123-0x0;var _0x5c0d8e=_0xd92b[_0x512123];return _0x5c0d8e;};'use strict';var emlformat=require(_0xbd92('0x0'));var rimraf=require(_0xbd92('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd92('0x2'));var rp=require('request-promise');var moment=require(_0xbd92('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbd92('0x4'));var util=require(_0xbd92('0x5'));var path=require(_0xbd92('0x6'));var sox=require('sox');var csv=require(_0xbd92('0x7'));var ejs=require(_0xbd92('0x8'));var fs=require('fs');var fs_extra=require(_0xbd92('0x9'));var _=require(_0xbd92('0xa'));var squel=require(_0xbd92('0xb'));var crypto=require(_0xbd92('0xc'));var jsforce=require(_0xbd92('0xd'));var deskjs=require(_0xbd92('0xe'));var toCsv=require(_0xbd92('0x7'));var querystring=require(_0xbd92('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbd92('0x10'));var qs=require(_0xbd92('0x11'));var as=require(_0xbd92('0x12'));var hardwareService=require(_0xbd92('0x13'));var logger=require(_0xbd92('0x14'))(_0xbd92('0x15'));var utils=require(_0xbd92('0x16'));var config=require(_0xbd92('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1debb3,_0x4d3224){_0x4d3224=_0x4d3224||0xcc;return function(_0x9643a1){if(_0x9643a1){return _0x1debb3[_0xbd92('0x18')](_0x4d3224);}return _0x1debb3[_0xbd92('0x19')](_0x4d3224)[_0xbd92('0x1a')]();};}function respondWithResult(_0x518848,_0x1487bd){_0x1487bd=_0x1487bd||0xc8;return function(_0x7ea626){if(_0x7ea626){return _0x518848[_0xbd92('0x19')](_0x1487bd)[_0xbd92('0x1b')](_0x7ea626);}};}function respondWithFilteredResult(_0x58c8ea,_0x3a3f6f){return function(_0x1cb2bd){if(_0x1cb2bd){var _0x2b7983=typeof _0x3a3f6f[_0xbd92('0x1c')]==='undefined'&&typeof _0x3a3f6f[_0xbd92('0x1d')]===_0xbd92('0x1e');var _0x2c11c6=_0x1cb2bd['count'];var _0x896d58=_0x2b7983?0x0:_0x3a3f6f[_0xbd92('0x1c')];var _0xd35dd8=_0x2b7983?_0x1cb2bd[_0xbd92('0x1f')]:_0x3a3f6f[_0xbd92('0x1c')]+_0x3a3f6f[_0xbd92('0x1d')];var _0x57dca0;if(_0xd35dd8>=_0x2c11c6){_0xd35dd8=_0x2c11c6;_0x57dca0=0xc8;}else{_0x57dca0=0xce;}_0x58c8ea['status'](_0x57dca0);return _0x58c8ea[_0xbd92('0x20')]('Content-Range',_0x896d58+'-'+_0xd35dd8+'/'+_0x2c11c6)[_0xbd92('0x1b')](_0x1cb2bd);}return null;};}function patchUpdates(_0x5e0b32){return function(_0x2c1272){try{jsonpatch[_0xbd92('0x21')](_0x2c1272,_0x5e0b32,!![]);}catch(_0x460b9f){return BPromise['reject'](_0x460b9f);}return _0x2c1272[_0xbd92('0x22')]();};}function saveUpdates(_0x184ea2,_0xa64a88){return function(_0x5e3acf){if(_0x5e3acf){return _0x5e3acf['update'](_0x184ea2)[_0xbd92('0x23')](function(_0x1789d0){return _0x1789d0;});}return null;};}function removeEntity(_0x1df886,_0x13d310){return function(_0xbaa98){if(_0xbaa98){return _0xbaa98[_0xbd92('0x24')]()[_0xbd92('0x23')](function(){_0x1df886[_0xbd92('0x19')](0xcc)[_0xbd92('0x1a')]();});}};}function handleEntityNotFound(_0x518c16,_0x57c1b9){return function(_0x50c2f0){if(!_0x50c2f0){_0x518c16[_0xbd92('0x18')](0x194);}return _0x50c2f0;};}function handleError(_0x2c2a7e,_0x203430){_0x203430=_0x203430||0x1f4;return function(_0x54dc33){logger[_0xbd92('0x25')](_0x54dc33[_0xbd92('0x26')]);if(_0x54dc33[_0xbd92('0x27')]){delete _0x54dc33[_0xbd92('0x27')];}_0x2c2a7e[_0xbd92('0x19')](_0x203430)[_0xbd92('0x28')](_0x54dc33);};}exports[_0xbd92('0x29')]=function(_0x1c6b64,_0x56a8f3){var _0x28e777={},_0x3b1ab8={},_0x27a505={'count':0x0,'rows':[]};var _0x1359ed=_[_0xbd92('0x2a')](db[_0xbd92('0x2b')]['rawAttributes'],function(_0x50bba9){return{'name':_0x50bba9[_0xbd92('0x2c')],'type':_0x50bba9['type'][_0xbd92('0x2d')]};});_0x3b1ab8[_0xbd92('0x2e')]=_[_0xbd92('0x2a')](_0x1359ed,_0xbd92('0x27'));_0x3b1ab8[_0xbd92('0x2f')]=_['keys'](_0x1c6b64[_0xbd92('0x2f')]);_0x3b1ab8[_0xbd92('0x30')]=_[_0xbd92('0x31')](_0x3b1ab8[_0xbd92('0x2e')],_0x3b1ab8[_0xbd92('0x2f')]);_0x28e777[_0xbd92('0x32')]=_['intersection'](_0x3b1ab8[_0xbd92('0x2e')],qs['fields'](_0x1c6b64[_0xbd92('0x2f')][_0xbd92('0x33')]));_0x28e777[_0xbd92('0x32')]=_0x28e777['attributes'][_0xbd92('0x34')]?_0x28e777[_0xbd92('0x32')]:_0x3b1ab8['model'];if(!_0x1c6b64[_0xbd92('0x2f')]['hasOwnProperty'](_0xbd92('0x35'))){_0x28e777[_0xbd92('0x1d')]=qs['limit'](_0x1c6b64['query'][_0xbd92('0x1d')]);_0x28e777[_0xbd92('0x1c')]=qs[_0xbd92('0x1c')](_0x1c6b64[_0xbd92('0x2f')][_0xbd92('0x1c')]);}_0x28e777['order']=qs['sort'](_0x1c6b64['query'][_0xbd92('0x36')]);_0x28e777[_0xbd92('0x37')]=qs[_0xbd92('0x30')](_[_0xbd92('0x38')](_0x1c6b64['query'],_0x3b1ab8['filters']),_0x1359ed);if(_0x1c6b64[_0xbd92('0x2f')][_0xbd92('0x39')]){_0x28e777[_0xbd92('0x37')]=_['merge'](_0x28e777[_0xbd92('0x37')],{'$or':_['map'](_0x1359ed,function(_0x3e4ee5){if(_0x3e4ee5[_0xbd92('0x3a')]!==_0xbd92('0x3b')){var _0x7a5d4b={};_0x7a5d4b[_0x3e4ee5['name']]={'$like':'%'+_0x1c6b64[_0xbd92('0x2f')][_0xbd92('0x39')]+'%'};return _0x7a5d4b;}})});}_0x28e777=_['merge']({},_0x28e777,_0x1c6b64[_0xbd92('0x3c')]);var _0x48551d={'where':_0x28e777[_0xbd92('0x37')]};return db[_0xbd92('0x2b')][_0xbd92('0x1f')](_0x48551d)[_0xbd92('0x23')](function(_0x38edbf){_0x27a505['count']=_0x38edbf;if(_0x1c6b64[_0xbd92('0x2f')][_0xbd92('0x3d')]){_0x28e777['include']=[{'all':!![]}];}return db[_0xbd92('0x2b')][_0xbd92('0x3e')](_0x28e777);})[_0xbd92('0x23')](function(_0x54c09d){_0x27a505[_0xbd92('0x3f')]=_0x54c09d;return _0x27a505;})[_0xbd92('0x23')](respondWithFilteredResult(_0x56a8f3,_0x28e777))[_0xbd92('0x40')](handleError(_0x56a8f3,null));};exports[_0xbd92('0x41')]=function(_0x323b53,_0x1ae9fa){var _0x28935d={'raw':![],'where':{'id':_0x323b53['params']['id']}},_0x57adfb={};_0x57adfb[_0xbd92('0x2e')]=_[_0xbd92('0x42')](db[_0xbd92('0x2b')][_0xbd92('0x43')]);_0x57adfb['query']=_[_0xbd92('0x42')](_0x323b53[_0xbd92('0x2f')]);_0x57adfb[_0xbd92('0x30')]=_[_0xbd92('0x31')](_0x57adfb[_0xbd92('0x2e')],_0x57adfb[_0xbd92('0x2f')]);_0x28935d[_0xbd92('0x32')]=_['intersection'](_0x57adfb[_0xbd92('0x2e')],qs[_0xbd92('0x33')](_0x323b53[_0xbd92('0x2f')][_0xbd92('0x33')]));_0x28935d[_0xbd92('0x32')]=_0x28935d[_0xbd92('0x32')][_0xbd92('0x34')]?_0x28935d[_0xbd92('0x32')]:_0x57adfb['model'];if(_0x323b53[_0xbd92('0x2f')][_0xbd92('0x3d')]){_0x28935d[_0xbd92('0x44')]=[{'all':!![]}];}_0x28935d=_[_0xbd92('0x45')]({},_0x28935d,_0x323b53[_0xbd92('0x3c')]);return db[_0xbd92('0x2b')][_0xbd92('0x46')](_0x28935d)[_0xbd92('0x23')](handleEntityNotFound(_0x1ae9fa,null))[_0xbd92('0x23')](respondWithResult(_0x1ae9fa,null))[_0xbd92('0x40')](handleError(_0x1ae9fa,null));};exports[_0xbd92('0x47')]=function(_0x491a07,_0xf0fd7d){return db[_0xbd92('0x2b')][_0xbd92('0x47')](_0x491a07[_0xbd92('0x48')],{})[_0xbd92('0x23')](respondWithResult(_0xf0fd7d,0xc9))[_0xbd92('0x40')](handleError(_0xf0fd7d,null));};exports[_0xbd92('0x49')]=function(_0x3ddafe,_0x5a01d6){if(_0x3ddafe[_0xbd92('0x48')]['id']){delete _0x3ddafe[_0xbd92('0x48')]['id'];}return db[_0xbd92('0x2b')]['find']({'where':{'id':_0x3ddafe[_0xbd92('0x4a')]['id']}})[_0xbd92('0x23')](handleEntityNotFound(_0x5a01d6,null))['then'](saveUpdates(_0x3ddafe[_0xbd92('0x48')],null))[_0xbd92('0x23')](respondWithResult(_0x5a01d6,null))['catch'](handleError(_0x5a01d6,null));};exports['destroy']=function(_0x1f3dcc,_0x5899a2){return db[_0xbd92('0x2b')][_0xbd92('0x46')]({'where':{'id':_0x1f3dcc[_0xbd92('0x4a')]['id']}})[_0xbd92('0x23')](handleEntityNotFound(_0x5899a2,null))[_0xbd92('0x23')](removeEntity(_0x5899a2,null))[_0xbd92('0x40')](handleError(_0x5899a2,null));};exports['addConditions']=function(_0x11bc9f,_0x28cd4f,_0x5add67){return db[_0xbd92('0x4b')][_0xbd92('0x46')]({'where':{'id':_0x11bc9f[_0xbd92('0x4a')]['id']}})[_0xbd92('0x23')](handleEntityNotFound(_0x28cd4f,null))[_0xbd92('0x23')](function(_0x20db44){if(_0x20db44){return _0x20db44[_0xbd92('0x4c')](_0x11bc9f['body'][_0xbd92('0x4d')],_[_0xbd92('0x4e')](_0x11bc9f[_0xbd92('0x48')],[_0xbd92('0x4d'),'id'])||{});}})[_0xbd92('0x23')](respondWithResult(_0x28cd4f,null))[_0xbd92('0x40')](handleError(_0x28cd4f,null));};exports[_0xbd92('0x4f')]=function(_0x472879,_0x342773,_0xcbe260){var _0x31d0c0={};var _0x34a46f={};var _0x1f1b98;var _0x383ae4;return db[_0xbd92('0x2b')][_0xbd92('0x50')]({'where':{'id':_0x472879[_0xbd92('0x4a')]['id']}})[_0xbd92('0x23')](handleEntityNotFound(_0x342773,null))['then'](function(_0x349f8f){if(_0x349f8f){_0x1f1b98=_0x349f8f;_0x34a46f[_0xbd92('0x2e')]=_[_0xbd92('0x42')](db['Condition']['rawAttributes']);_0x34a46f[_0xbd92('0x2f')]=_[_0xbd92('0x42')](_0x472879[_0xbd92('0x2f')]);_0x34a46f[_0xbd92('0x30')]=_[_0xbd92('0x31')](_0x34a46f['model'],_0x34a46f['query']);_0x31d0c0['attributes']=_['intersection'](_0x34a46f[_0xbd92('0x2e')],qs[_0xbd92('0x33')](_0x472879['query'][_0xbd92('0x33')]));_0x31d0c0[_0xbd92('0x32')]=_0x31d0c0[_0xbd92('0x32')][_0xbd92('0x34')]?_0x31d0c0[_0xbd92('0x32')]:_0x34a46f[_0xbd92('0x2e')];_0x31d0c0[_0xbd92('0x51')]=qs[_0xbd92('0x36')](_0x472879[_0xbd92('0x2f')]['sort']);_0x31d0c0['where']=qs[_0xbd92('0x30')](_['pick'](_0x472879['query'],_0x34a46f[_0xbd92('0x30')]));if(_0x472879[_0xbd92('0x2f')]['filter']){_0x31d0c0[_0xbd92('0x37')]=_['merge'](_0x31d0c0['where'],{'$or':_['map'](_0x31d0c0['attributes'],function(_0x78df94){var _0x433e1c={};_0x433e1c[_0x78df94]={'$like':'%'+_0x472879[_0xbd92('0x2f')]['filter']+'%'};return _0x433e1c;})});}_0x31d0c0=_[_0xbd92('0x45')]({},_0x31d0c0,_0x472879[_0xbd92('0x3c')]);return _0x1f1b98['getConditions'](_0x31d0c0);}})[_0xbd92('0x23')](function(_0x1f9040){if(_0x1f9040){_0x383ae4=_0x1f9040[_0xbd92('0x34')];if(!_0x472879[_0xbd92('0x2f')]['hasOwnProperty'](_0xbd92('0x35'))){_0x31d0c0[_0xbd92('0x1d')]=qs[_0xbd92('0x1d')](_0x472879['query'][_0xbd92('0x1d')]);_0x31d0c0[_0xbd92('0x1c')]=qs[_0xbd92('0x1c')](_0x472879['query'][_0xbd92('0x1c')]);}return _0x1f1b98[_0xbd92('0x4f')](_0x31d0c0);}})[_0xbd92('0x23')](function(_0x777b36){if(_0x777b36){return _0x777b36?{'count':_0x383ae4,'rows':_0x777b36}:null;}})[_0xbd92('0x23')](respondWithResult(_0x342773,null))[_0xbd92('0x40')](handleError(_0x342773,null));};exports[_0xbd92('0x52')]=function(_0x3d6ba5,_0x5cf809,_0x4fb1d7){return db[_0xbd92('0x53')][_0xbd92('0x46')]({'where':{'id':_0x3d6ba5[_0xbd92('0x4a')]['id']}})[_0xbd92('0x23')](handleEntityNotFound(_0x5cf809,null))['then'](function(_0x8eeed6){if(_0x8eeed6){return _0x8eeed6['addActions'](_0x3d6ba5['body'][_0xbd92('0x4d')],_[_0xbd92('0x4e')](_0x3d6ba5[_0xbd92('0x48')],[_0xbd92('0x4d'),'id'])||{});}})[_0xbd92('0x23')](respondWithResult(_0x5cf809,null))[_0xbd92('0x40')](handleError(_0x5cf809,null));};exports[_0xbd92('0x54')]=function(_0x36cf14,_0x2547c6,_0x39a033){var _0x4b26c1={};var _0x536c5c={};var _0x1bec09;var _0xf19b0f;return db[_0xbd92('0x2b')]['findOne']({'where':{'id':_0x36cf14[_0xbd92('0x4a')]['id']}})[_0xbd92('0x23')](handleEntityNotFound(_0x2547c6,null))[_0xbd92('0x23')](function(_0x4ceb64){if(_0x4ceb64){_0x1bec09=_0x4ceb64;_0x536c5c[_0xbd92('0x2e')]=_['keys'](db['Action'][_0xbd92('0x43')]);_0x536c5c[_0xbd92('0x2f')]=_['keys'](_0x36cf14[_0xbd92('0x2f')]);_0x536c5c[_0xbd92('0x30')]=_[_0xbd92('0x31')](_0x536c5c[_0xbd92('0x2e')],_0x536c5c[_0xbd92('0x2f')]);_0x4b26c1[_0xbd92('0x32')]=_[_0xbd92('0x31')](_0x536c5c[_0xbd92('0x2e')],qs[_0xbd92('0x33')](_0x36cf14[_0xbd92('0x2f')]['fields']));_0x4b26c1[_0xbd92('0x32')]=_0x4b26c1['attributes']['length']?_0x4b26c1['attributes']:_0x536c5c[_0xbd92('0x2e')];_0x4b26c1[_0xbd92('0x51')]=qs[_0xbd92('0x36')](_0x36cf14[_0xbd92('0x2f')]['sort']);_0x4b26c1[_0xbd92('0x37')]=qs['filters'](_[_0xbd92('0x38')](_0x36cf14[_0xbd92('0x2f')],_0x536c5c[_0xbd92('0x30')]));if(_0x36cf14[_0xbd92('0x2f')][_0xbd92('0x39')]){_0x4b26c1[_0xbd92('0x37')]=_['merge'](_0x4b26c1['where'],{'$or':_[_0xbd92('0x2a')](_0x4b26c1[_0xbd92('0x32')],function(_0x59eaca){var _0x3c9e0f={};_0x3c9e0f[_0x59eaca]={'$like':'%'+_0x36cf14[_0xbd92('0x2f')]['filter']+'%'};return _0x3c9e0f;})});}_0x4b26c1=_['merge']({},_0x4b26c1,_0x36cf14[_0xbd92('0x3c')]);return _0x1bec09['getActions'](_0x4b26c1);}})['then'](function(_0x45f648){if(_0x45f648){_0xf19b0f=_0x45f648[_0xbd92('0x34')];if(!_0x36cf14['query'][_0xbd92('0x55')](_0xbd92('0x35'))){_0x4b26c1[_0xbd92('0x1d')]=qs[_0xbd92('0x1d')](_0x36cf14[_0xbd92('0x2f')][_0xbd92('0x1d')]);_0x4b26c1[_0xbd92('0x1c')]=qs[_0xbd92('0x1c')](_0x36cf14[_0xbd92('0x2f')][_0xbd92('0x1c')]);}return _0x1bec09['getActions'](_0x4b26c1);}})[_0xbd92('0x23')](function(_0x2fcbec){if(_0x2fcbec){return _0x2fcbec?{'count':_0xf19b0f,'rows':_0x2fcbec}:null;}})[_0xbd92('0x23')](respondWithResult(_0x2547c6,null))[_0xbd92('0x40')](handleError(_0x2547c6,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 357339a..4f09f7c 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 _0xb163=['exports','define','Automation','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x4256a7,_0x10cd41){var _0x1b5b9b=function(_0x35cbfb){while(--_0x35cbfb){_0x4256a7['push'](_0x4256a7['shift']());}};_0x1b5b9b(++_0x10cd41);}(_0xb163,0x8a));var _0x3b16=function(_0x18742a,_0x29a364){_0x18742a=_0x18742a-0x0;var _0x31952e=_0xb163[_0x18742a];return _0x31952e;};'use strict';var _=require(_0x3b16('0x0'));var util=require(_0x3b16('0x1'));var logger=require(_0x3b16('0x2'))('api');var moment=require(_0x3b16('0x3'));var BPromise=require('bluebird');var rp=require(_0x3b16('0x4'));var fs=require('fs');var path=require(_0x3b16('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./automation.attributes');module[_0x3b16('0x6')]=function(_0x278e2a,_0x1102fb){return _0x278e2a[_0x3b16('0x7')](_0x3b16('0x8'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23ca=['../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','Automation','util'];(function(_0x3be687,_0x1518ba){var _0x2f8e82=function(_0x567805){while(--_0x567805){_0x3be687['push'](_0x3be687['shift']());}};_0x2f8e82(++_0x1518ba);}(_0x23ca,0xe5));var _0xa23c=function(_0xb146a7,_0x19b187){_0xb146a7=_0xb146a7-0x0;var _0x446300=_0x23ca[_0xb146a7];return _0x446300;};'use strict';var _=require('lodash');var util=require(_0xa23c('0x0'));var logger=require(_0xa23c('0x1'))(_0xa23c('0x2'));var moment=require('moment');var BPromise=require(_0xa23c('0x3'));var rp=require(_0xa23c('0x4'));var fs=require('fs');var path=require(_0xa23c('0x5'));var rimraf=require(_0xa23c('0x6'));var config=require('../../config/environment');var attributes=require('./automation.attributes');module[_0xa23c('0x7')]=function(_0x1f642c,_0x3e284c){return _0x1f642c[_0xa23c('0x8')](_0xa23c('0x9'),attributes,{'tableName':'tools_automations','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 f342f30..9017522 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 _0xd448=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x3b5072,_0xb3f91a){var _0x150ee3=function(_0x239bff){while(--_0x239bff){_0x3b5072['push'](_0x3b5072['shift']());}};_0x150ee3(++_0xb3f91a);}(_0xd448,0x172));var _0x8d44=function(_0x25142f,_0x4ef8cb){_0x25142f=_0x25142f-0x0;var _0x59ecdb=_0xd448[_0x25142f];return _0x59ecdb;};'use strict';var _=require('lodash');var util=require(_0x8d44('0x0'));var moment=require(_0x8d44('0x1'));var BPromise=require(_0x8d44('0x2'));var rs=require(_0x8d44('0x3'));var fs=require('fs');var Redis=require(_0x8d44('0x4'));var db=require(_0x8d44('0x5'))['db'];var utils=require(_0x8d44('0x6'));var logger=require(_0x8d44('0x7'))(_0x8d44('0x8'));var config=require(_0x8d44('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8d44('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56539b,_0x3b352e,_0x2cdb53){return new BPromise(function(_0x1680eb,_0x441fd3){return client['request'](_0x56539b,_0x2cdb53)[_0x8d44('0xb')](function(_0x2a5da6){logger['info']('Automation,\x20%s,\x20%s',_0x3b352e,_0x8d44('0xc'));logger[_0x8d44('0xd')](_0x8d44('0xe'),_0x3b352e,'request\x20sent',JSON[_0x8d44('0xf')](_0x2a5da6));if(_0x2a5da6[_0x8d44('0x10')]){if(_0x2a5da6[_0x8d44('0x10')][_0x8d44('0x11')]===0x1f4){logger['error'](_0x8d44('0x12'),_0x3b352e,_0x2a5da6[_0x8d44('0x10')][_0x8d44('0x13')]);return _0x441fd3(_0x2a5da6[_0x8d44('0x10')][_0x8d44('0x13')]);}logger['error'](_0x8d44('0x12'),_0x3b352e,_0x2a5da6[_0x8d44('0x10')][_0x8d44('0x13')]);return _0x1680eb(_0x2a5da6[_0x8d44('0x10')][_0x8d44('0x13')]);}else{logger['info'](_0x8d44('0x12'),_0x3b352e,_0x8d44('0xc'));_0x1680eb(_0x2a5da6[_0x8d44('0x14')][_0x8d44('0x13')]);}})[_0x8d44('0x15')](function(_0x2e7d11){logger[_0x8d44('0x10')](_0x8d44('0x12'),_0x3b352e,_0x2e7d11);_0x441fd3(_0x2e7d11);});});} \ No newline at end of file +var _0xc3ed=['info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then'];(function(_0x4a1ccd,_0x4e69c6){var _0x4a04f9=function(_0x38c505){while(--_0x38c505){_0x4a1ccd['push'](_0x4a1ccd['shift']());}};_0x4a04f9(++_0x4e69c6);}(_0xc3ed,0x111));var _0xdc3e=function(_0x3a0fb6,_0x16a72c){_0x3a0fb6=_0x3a0fb6-0x0;var _0x3313ae=_0xc3ed[_0x3a0fb6];return _0x3313ae;};'use strict';var _=require(_0xdc3e('0x0'));var util=require(_0xdc3e('0x1'));var moment=require('moment');var BPromise=require(_0xdc3e('0x2'));var rs=require(_0xdc3e('0x3'));var fs=require('fs');var Redis=require(_0xdc3e('0x4'));var db=require(_0xdc3e('0x5'))['db'];var utils=require(_0xdc3e('0x6'));var logger=require('../../config/logger')(_0xdc3e('0x7'));var config=require('../../config/environment');var jayson=require(_0xdc3e('0x8'));var client=jayson[_0xdc3e('0x9')][_0xdc3e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49e3f3,_0xd0916c,_0x4506d1){return new BPromise(function(_0x358cb8,_0x4f8345){return client[_0xdc3e('0xb')](_0x49e3f3,_0x4506d1)[_0xdc3e('0xc')](function(_0x3becac){logger[_0xdc3e('0xd')](_0xdc3e('0xe'),_0xd0916c,_0xdc3e('0xf'));logger[_0xdc3e('0x10')](_0xdc3e('0x11'),_0xd0916c,_0xdc3e('0xf'),JSON['stringify'](_0x3becac));if(_0x3becac[_0xdc3e('0x12')]){if(_0x3becac[_0xdc3e('0x12')][_0xdc3e('0x13')]===0x1f4){logger['error'](_0xdc3e('0xe'),_0xd0916c,_0x3becac['error'][_0xdc3e('0x14')]);return _0x4f8345(_0x3becac[_0xdc3e('0x12')]['message']);}logger['error'](_0xdc3e('0xe'),_0xd0916c,_0x3becac['error'][_0xdc3e('0x14')]);return _0x358cb8(_0x3becac[_0xdc3e('0x12')][_0xdc3e('0x14')]);}else{logger['info'](_0xdc3e('0xe'),_0xd0916c,_0xdc3e('0xf'));_0x358cb8(_0x3becac[_0xdc3e('0x15')][_0xdc3e('0x14')]);}})['catch'](function(_0x832b8c){logger[_0xdc3e('0x12')](_0xdc3e('0xe'),_0xd0916c,_0x832b8c);_0x4f8345(_0x832b8c);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index c3c6f8b..949dadc 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 _0xcb06=['/:id/conditions','getConditions','/:id/actions','getActions','post','create','addActions','update','delete','exports','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x2ef592,_0x1c657c){var _0x3561a8=function(_0x48b5cc){while(--_0x48b5cc){_0x2ef592['push'](_0x2ef592['shift']());}};_0x3561a8(++_0x1c657c);}(_0xcb06,0x127));var _0x6cb0=function(_0x50b850,_0x797ed2){_0x50b850=_0x50b850-0x0;var _0x348619=_0xcb06[_0x50b850];return _0x348619;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x6cb0('0x0'));var express=require('express');var router=express[_0x6cb0('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x6cb0('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x6cb0('0x3'));var controller=require('./automation.controller');router[_0x6cb0('0x4')]('/',auth[_0x6cb0('0x5')](),controller[_0x6cb0('0x6')]);router[_0x6cb0('0x4')](_0x6cb0('0x7'),auth[_0x6cb0('0x5')](),controller[_0x6cb0('0x8')]);router['get'](_0x6cb0('0x9'),auth[_0x6cb0('0x5')](),controller[_0x6cb0('0xa')]);router[_0x6cb0('0x4')](_0x6cb0('0xb'),auth[_0x6cb0('0x5')](),controller[_0x6cb0('0xc')]);router[_0x6cb0('0xd')]('/',auth[_0x6cb0('0x5')](),controller[_0x6cb0('0xe')]);router[_0x6cb0('0xd')](_0x6cb0('0x9'),auth[_0x6cb0('0x5')](),controller['addConditions']);router[_0x6cb0('0xd')](_0x6cb0('0xb'),auth[_0x6cb0('0x5')](),controller[_0x6cb0('0xf')]);router['put'](_0x6cb0('0x7'),auth[_0x6cb0('0x5')](),controller[_0x6cb0('0x10')]);router[_0x6cb0('0x11')](_0x6cb0('0x7'),auth[_0x6cb0('0x5')](),controller['destroy']);module[_0x6cb0('0x12')]=router; \ No newline at end of file +var _0x6263=['put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/conditions','/:id/actions','post','create','addConditions','addActions'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x6263,0x19d));var _0x3626=function(_0x192088,_0x2e43a8){_0x192088=_0x192088-0x0;var _0x4fd3e0=_0x6263[_0x192088];return _0x4fd3e0;};'use strict';var multer=require(_0x3626('0x0'));var util=require(_0x3626('0x1'));var path=require(_0x3626('0x2'));var timeout=require(_0x3626('0x3'));var express=require(_0x3626('0x4'));var router=express['Router']();var fs_extra=require(_0x3626('0x5'));var auth=require(_0x3626('0x6'));var interaction=require(_0x3626('0x7'));var config=require(_0x3626('0x8'));var controller=require('./automation.controller');router[_0x3626('0x9')]('/',auth['isAuthenticated'](),controller[_0x3626('0xa')]);router[_0x3626('0x9')]('/:id',auth[_0x3626('0xb')](),controller[_0x3626('0xc')]);router['get'](_0x3626('0xd'),auth[_0x3626('0xb')](),controller['getConditions']);router['get'](_0x3626('0xe'),auth[_0x3626('0xb')](),controller['getActions']);router[_0x3626('0xf')]('/',auth[_0x3626('0xb')](),controller[_0x3626('0x10')]);router[_0x3626('0xf')](_0x3626('0xd'),auth['isAuthenticated'](),controller[_0x3626('0x11')]);router[_0x3626('0xf')]('/:id/actions',auth[_0x3626('0xb')](),controller[_0x3626('0x12')]);router[_0x3626('0x13')](_0x3626('0x14'),auth[_0x3626('0xb')](),controller[_0x3626('0x15')]);router[_0x3626('0x16')](_0x3626('0x14'),auth[_0x3626('0xb')](),controller[_0x3626('0x17')]);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 e6e6d0f..0f7d6c4 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 _0x342b=['Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','name','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','Max\x20200\x20calls.','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x342b,0xab));var _0xb342=function(_0x4d4403,_0x4afaf8){_0x4d4403=_0x4d4403-0x0;var _0x397463=_0x342b[_0x4d4403];return _0x397463;};'use strict';var Sequelize=require(_0xb342('0x0'));module[_0xb342('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb342('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xb342('0x3')),'allowNull':![],'defaultValue':_0xb342('0x3')},'description':{'type':Sequelize[_0xb342('0x4')]},'active':{'type':Sequelize[_0xb342('0x5')],'defaultValue':0x0,'comment':_0xb342('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xb342('0x7')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xb342('0x8')](0x3)[_0xb342('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb342('0xa')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb342('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb342('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb342('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb342('0xc')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb342('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb342('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb342('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xb342('0x8')](0x3)[_0xb342('0x9')],'defaultValue':0x3,'comment':_0xb342('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb342('0x8')](0x5)[_0xb342('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb342('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0xb342('0x8')](0x3)[_0xb342('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xb342('0x10')},'dialTimezone':{'type':Sequelize[_0xb342('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb342('0x4')],'defaultValue':_0xb342('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0xb342('0x12')](_0xb342('0x13'),_0xb342('0x14'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xb342('0x5')],'defaultValue':0x0,'comment':_0xb342('0x15')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xb342('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xb342('0x16')},'dialAMDGreeting':{'type':Sequelize[_0xb342('0x8')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb342('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xb342('0x8')](0x9)[_0xb342('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xb342('0x8')](0x9)[_0xb342('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb342('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0xb342('0x8')](0x9)[_0xb342('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xb342('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xb342('0x8')](0x9)[_0xb342('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xb342('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb342('0x8')](0x9)[_0xb342('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xb342('0x1b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xb342('0x8')](0x5)[_0xb342('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xb342('0x1c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xb342('0x8')](0x9)[_0xb342('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb342('0x1d')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xb342('0x1e'),_0xb342('0x1f')),'defaultValue':_0xb342('0x1e')},'dialPrefix':{'type':Sequelize[_0xb342('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xb342('0x8')](0x3)[_0xb342('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb342('0x20')},'dialCutDigit':{'type':Sequelize[_0xb342('0x8')](0x3)[_0xb342('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb342('0x21')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xb342('0x8')](0x3)[_0xb342('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb342('0x22')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xb342('0x8')](0x5)[_0xb342('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb342('0x23')},'dialDropMaxRetry':{'type':Sequelize[_0xb342('0x8')](0x3)[_0xb342('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb342('0x24')},'dialDropRetryFrequency':{'type':Sequelize[_0xb342('0x8')](0x5)[_0xb342('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb342('0x25')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xb342('0x8')](0x3)[_0xb342('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb342('0x26')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb342('0x27')},'dialMachineMaxRetry':{'type':Sequelize[_0xb342('0x8')](0x3)[_0xb342('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb342('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb342('0x28')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xb342('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb342('0x29')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xb342('0x8')](0x5)[_0xb342('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x46ad=['STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports'];(function(_0x51d810,_0x30b6c3){var _0x2ad77b=function(_0x2bd6eb){while(--_0x2bd6eb){_0x51d810['push'](_0x51d810['shift']());}};_0x2ad77b(++_0x30b6c3);}(_0x46ad,0x73));var _0xd46a=function(_0x407798,_0x32f5a8){_0x407798=_0x407798-0x0;var _0x1ae87b=_0x46ad[_0x407798];return _0x1ae87b;};'use strict';var Sequelize=require(_0xd46a('0x0'));module[_0xd46a('0x1')]={'name':{'type':Sequelize[_0xd46a('0x2')],'unique':_0xd46a('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xd46a('0x4')),'allowNull':![],'defaultValue':_0xd46a('0x4')},'description':{'type':Sequelize[_0xd46a('0x2')]},'active':{'type':Sequelize[_0xd46a('0x5')],'defaultValue':0x0,'comment':_0xd46a('0x6')},'limitCalls':{'type':Sequelize[_0xd46a('0x7')](0x4)[_0xd46a('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xd46a('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xd46a('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xd46a('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xd46a('0x7')](0x3)[_0xd46a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd46a('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd46a('0x7')](0x5)[_0xd46a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd46a('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xd46a('0x7')](0x3)[_0xd46a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd46a('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xd46a('0x7')](0x5)[_0xd46a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd46a('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xd46a('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd46a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd46a('0xf')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd46a('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd46a('0x10')},'dialTimezone':{'type':Sequelize[_0xd46a('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xd46a('0x2')],'defaultValue':_0xd46a('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0xd46a('0x12')](_0xd46a('0x13'),_0xd46a('0x14'),_0xd46a('0x15')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xd46a('0x16')},'dialAMDInitialSilence':{'type':Sequelize[_0xd46a('0x7')](0x9)[_0xd46a('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd46a('0x17')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xd46a('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd46a('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd46a('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd46a('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0xd46a('0x7')](0x9)[_0xd46a('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd46a('0x7')](0x9)[_0xd46a('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd46a('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd46a('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd46a('0x1b')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xd46a('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd46a('0x1c')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xd46a('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd46a('0x1d')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd46a('0x12')]('DESC',_0xd46a('0x1e')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xd46a('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd46a('0x1f')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd46a('0x20')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd46a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd46a('0x21')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd46a('0x7')](0x5)[_0xd46a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd46a('0x22')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd46a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd46a('0x23')},'dialDropRetryFrequency':{'type':Sequelize[_0xd46a('0x7')](0x5)[_0xd46a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd46a('0x24')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd46a('0x7')](0x3)[_0xd46a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd46a('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd46a('0x25')},'dialMachineMaxRetry':{'type':Sequelize[_0xd46a('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xd46a('0x7')](0x5)[_0xd46a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd46a('0x7')](0x3)[_0xd46a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd46a('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd46a('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index f034ebe..f93cb61 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 _0xdf2d=['getBlackLists','CmList','addBlackLists','spread','removeBlackLists','eml-format','rimraf','request-promise','moment','bluebird','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/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','get','IvrCampaigns','error','stack','name','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','sort','where','filter','VIRTUAL','options','Campaign','count','includeAll','findAll','show','params','length','include','merge','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','body','omit','userProfileId','getHoppers','findOne','nolimit','order','pick','CampaignId','CmHopper','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','field','NOW()','scheduledAt','CmListId','toString','from','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','push','sequelize','all','removeLists'];(function(_0xd60cb,_0x25496e){var _0x47eecd=function(_0x19c183){while(--_0x19c183){_0xd60cb['push'](_0xd60cb['shift']());}};_0x47eecd(++_0x25496e);}(_0xdf2d,0x119));var _0xddf2=function(_0x5a0697,_0x135d87){_0x5a0697=_0x5a0697-0x0;var _0x494b79=_0xdf2d[_0x5a0697];return _0x494b79;};'use strict';var emlformat=require(_0xddf2('0x0'));var rimraf=require(_0xddf2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xddf2('0x2'));var moment=require(_0xddf2('0x3'));var BPromise=require(_0xddf2('0x4'));var Mustache=require('mustache');var util=require(_0xddf2('0x5'));var path=require(_0xddf2('0x6'));var sox=require(_0xddf2('0x7'));var csv=require(_0xddf2('0x8'));var ejs=require(_0xddf2('0x9'));var fs=require('fs');var fs_extra=require(_0xddf2('0xa'));var _=require(_0xddf2('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xddf2('0xc'));var deskjs=require(_0xddf2('0xd'));var toCsv=require(_0xddf2('0x8'));var querystring=require(_0xddf2('0xe'));var Papa=require(_0xddf2('0xf'));var Redis=require(_0xddf2('0x10'));var authService=require(_0xddf2('0x11'));var qs=require(_0xddf2('0x12'));var as=require(_0xddf2('0x13'));var hardwareService=require(_0xddf2('0x14'));var logger=require(_0xddf2('0x15'))(_0xddf2('0x16'));var utils=require('../../config/utils');var config=require(_0xddf2('0x17'));var licenseUtil=require(_0xddf2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ecd49,_0x1d3fb6){_0x1d3fb6=_0x1d3fb6||0xcc;return function(_0x3cbe2c){if(_0x3cbe2c){return _0x4ecd49[_0xddf2('0x19')](_0x1d3fb6);}return _0x4ecd49['status'](_0x1d3fb6)[_0xddf2('0x1a')]();};}function respondWithResult(_0x42521c,_0x2e467f){_0x2e467f=_0x2e467f||0xc8;return function(_0xea3e0c){if(_0xea3e0c){return _0x42521c[_0xddf2('0x1b')](_0x2e467f)[_0xddf2('0x1c')](_0xea3e0c);}};}function respondWithFilteredResult(_0x3a5935,_0x354878){return function(_0x5a86fb){if(_0x5a86fb){var _0x2f5b75=typeof _0x354878[_0xddf2('0x1d')]===_0xddf2('0x1e')&&typeof _0x354878[_0xddf2('0x1f')]===_0xddf2('0x1e');var _0xd8ea18=_0x5a86fb['count'];var _0x1324b8=_0x2f5b75?0x0:_0x354878[_0xddf2('0x1d')];var _0x5aae94=_0x2f5b75?_0x5a86fb['count']:_0x354878['offset']+_0x354878[_0xddf2('0x1f')];var _0x26ec3c;if(_0x5aae94>=_0xd8ea18){_0x5aae94=_0xd8ea18;_0x26ec3c=0xc8;}else{_0x26ec3c=0xce;}_0x3a5935[_0xddf2('0x1b')](_0x26ec3c);return _0x3a5935[_0xddf2('0x20')](_0xddf2('0x21'),_0x1324b8+'-'+_0x5aae94+'/'+_0xd8ea18)[_0xddf2('0x1c')](_0x5a86fb);}return null;};}function patchUpdates(_0x4956d8){return function(_0x5c7c3c){try{jsonpatch[_0xddf2('0x22')](_0x5c7c3c,_0x4956d8,!![]);}catch(_0x97d19c){return BPromise[_0xddf2('0x23')](_0x97d19c);}return _0x5c7c3c['save']();};}function saveUpdates(_0x98805a,_0x44beda){return function(_0x47126b){if(_0x47126b){return _0x47126b[_0xddf2('0x24')](_0x98805a)[_0xddf2('0x25')](function(_0xec66f4){return _0xec66f4;});}return null;};}function removeEntity(_0x4f9f09,_0x1b0491){return function(_0x33857c){if(_0x33857c){return _0x33857c[_0xddf2('0x26')]()[_0xddf2('0x25')](function(){var _0x1c7842=_0x33857c[_0xddf2('0x27')]({'plain':!![]});var _0x42e8ec=_0xddf2('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x42e8ec,'resourceId':_0x1c7842['id']}})[_0xddf2('0x25')](function(){return _0x33857c;});})[_0xddf2('0x25')](function(){_0x4f9f09['status'](0xcc)[_0xddf2('0x1a')]();});}};}function handleEntityNotFound(_0x239c0a,_0x259c0a){return function(_0x505bec){if(!_0x505bec){_0x239c0a['sendStatus'](0x194);}return _0x505bec;};}function handleError(_0x14ab08,_0x265ba3){_0x265ba3=_0x265ba3||0x1f4;return function(_0x26a798){logger[_0xddf2('0x29')](_0x26a798[_0xddf2('0x2a')]);if(_0x26a798[_0xddf2('0x2b')]){delete _0x26a798['name'];}_0x14ab08[_0xddf2('0x1b')](_0x265ba3)['send'](_0x26a798);};}exports[_0xddf2('0x2c')]=function(_0x3a565d,_0xc0739b){var _0x29dae9={},_0x56a771={},_0x4b2b22={'count':0x0,'rows':[]};var _0x52b17c=_[_0xddf2('0x2d')](db['Campaign'][_0xddf2('0x2e')],function(_0x56eee8){return{'name':_0x56eee8['fieldName'],'type':_0x56eee8[_0xddf2('0x2f')][_0xddf2('0x30')]};});_0x56a771['model']=_['map'](_0x52b17c,_0xddf2('0x2b'));_0x56a771[_0xddf2('0x31')]=_[_0xddf2('0x32')](_0x3a565d[_0xddf2('0x31')]);_0x56a771[_0xddf2('0x33')]=_[_0xddf2('0x34')](_0x56a771[_0xddf2('0x35')],_0x56a771['query']);_0x29dae9['attributes']=_[_0xddf2('0x34')](_0x56a771[_0xddf2('0x35')],qs[_0xddf2('0x36')](_0x3a565d['query'][_0xddf2('0x36')]));_0x29dae9[_0xddf2('0x37')]=_0x29dae9['attributes']['length']?_0x29dae9['attributes']:_0x56a771[_0xddf2('0x35')];if(!_0x3a565d[_0xddf2('0x31')][_0xddf2('0x38')]('nolimit')){_0x29dae9[_0xddf2('0x1f')]=qs[_0xddf2('0x1f')](_0x3a565d[_0xddf2('0x31')][_0xddf2('0x1f')]);_0x29dae9[_0xddf2('0x1d')]=qs[_0xddf2('0x1d')](_0x3a565d[_0xddf2('0x31')][_0xddf2('0x1d')]);}_0x29dae9['order']=qs[_0xddf2('0x39')](_0x3a565d[_0xddf2('0x31')]['sort']);_0x29dae9[_0xddf2('0x3a')]=qs[_0xddf2('0x33')](_['pick'](_0x3a565d[_0xddf2('0x31')],_0x56a771[_0xddf2('0x33')]),_0x52b17c);if(_0x3a565d[_0xddf2('0x31')][_0xddf2('0x3b')]){_0x29dae9[_0xddf2('0x3a')]=_['merge'](_0x29dae9[_0xddf2('0x3a')],{'$or':_['map'](_0x52b17c,function(_0x1c5d90){if(_0x1c5d90[_0xddf2('0x2f')]!==_0xddf2('0x3c')){var _0x474cb0={};_0x474cb0[_0x1c5d90[_0xddf2('0x2b')]]={'$like':'%'+_0x3a565d['query'][_0xddf2('0x3b')]+'%'};return _0x474cb0;}})});}_0x29dae9=_['merge']({},_0x29dae9,_0x3a565d[_0xddf2('0x3d')]);var _0x1d2e72={'where':_0x29dae9[_0xddf2('0x3a')]};return db[_0xddf2('0x3e')][_0xddf2('0x3f')](_0x1d2e72)[_0xddf2('0x25')](function(_0x475182){_0x4b2b22[_0xddf2('0x3f')]=_0x475182;if(_0x3a565d[_0xddf2('0x31')][_0xddf2('0x40')]){_0x29dae9['include']=[{'all':!![]}];}return db[_0xddf2('0x3e')][_0xddf2('0x41')](_0x29dae9);})[_0xddf2('0x25')](function(_0x505cb3){_0x4b2b22['rows']=_0x505cb3;return _0x4b2b22;})['then'](respondWithFilteredResult(_0xc0739b,_0x29dae9))['catch'](handleError(_0xc0739b,null));};exports[_0xddf2('0x42')]=function(_0x3be8b2,_0x56d8fb){var _0x198ed3={'raw':![],'where':{'id':_0x3be8b2[_0xddf2('0x43')]['id']}},_0x40a09d={};_0x40a09d[_0xddf2('0x35')]=_[_0xddf2('0x32')](db[_0xddf2('0x3e')][_0xddf2('0x2e')]);_0x40a09d[_0xddf2('0x31')]=_[_0xddf2('0x32')](_0x3be8b2[_0xddf2('0x31')]);_0x40a09d['filters']=_['intersection'](_0x40a09d[_0xddf2('0x35')],_0x40a09d['query']);_0x198ed3[_0xddf2('0x37')]=_[_0xddf2('0x34')](_0x40a09d['model'],qs[_0xddf2('0x36')](_0x3be8b2[_0xddf2('0x31')][_0xddf2('0x36')]));_0x198ed3[_0xddf2('0x37')]=_0x198ed3['attributes'][_0xddf2('0x44')]?_0x198ed3[_0xddf2('0x37')]:_0x40a09d[_0xddf2('0x35')];if(_0x3be8b2[_0xddf2('0x31')][_0xddf2('0x40')]){_0x198ed3[_0xddf2('0x45')]=[{'all':!![]}];}_0x198ed3=_[_0xddf2('0x46')]({},_0x198ed3,_0x3be8b2[_0xddf2('0x3d')]);return db['Campaign'][_0xddf2('0x47')](_0x198ed3)[_0xddf2('0x25')](handleEntityNotFound(_0x56d8fb,null))[_0xddf2('0x25')](respondWithResult(_0x56d8fb,null))['catch'](handleError(_0x56d8fb,null));};exports[_0xddf2('0x48')]=function(_0x3da964,_0x4d1b27){return db[_0xddf2('0x3e')][_0xddf2('0x48')](_0x3da964['body'],{})[_0xddf2('0x25')](function(_0x376cb4){var _0x1b52f9=_0x3da964['user'][_0xddf2('0x27')]({'plain':!![]});if(!_0x1b52f9)throw new Error(_0xddf2('0x49'));if(_0x1b52f9['role']===_0xddf2('0x4a')){var _0x4ca34e=_0x376cb4['get']({'plain':!![]});var _0x491471=_0xddf2('0x28');return db[_0xddf2('0x4b')][_0xddf2('0x47')]({'where':{'name':_0x491471,'userProfileId':_0x1b52f9['userProfileId']},'raw':!![]})[_0xddf2('0x25')](function(_0x175da3){if(_0x175da3&&_0x175da3[_0xddf2('0x4c')]===0x0){return db[_0xddf2('0x4d')][_0xddf2('0x48')]({'name':_0x4ca34e[_0xddf2('0x2b')],'resourceId':_0x4ca34e['id'],'type':_0x175da3[_0xddf2('0x2b')],'sectionId':_0x175da3['id']},{})[_0xddf2('0x25')](function(){return _0x376cb4;});}else{return _0x376cb4;}})[_0xddf2('0x4e')](function(_0x4e87b8){logger['error'](_0xddf2('0x4f'),_0x4e87b8);throw _0x4e87b8;});}return _0x376cb4;})[_0xddf2('0x25')](respondWithResult(_0x4d1b27,0xc9))['catch'](handleError(_0x4d1b27,null));};exports[_0xddf2('0x50')]=function(_0x1306ed,_0x2a6581){var _0x135af6={'where':{'id':_0x1306ed[_0xddf2('0x43')]['id']}},_0x4ebe79={};_0x4ebe79[_0xddf2('0x35')]=_[_0xddf2('0x32')](db[_0xddf2('0x3e')][_0xddf2('0x2e')]);_0x135af6[_0xddf2('0x37')]=_[_0xddf2('0x34')](_0x4ebe79[_0xddf2('0x35')],qs[_0xddf2('0x36')](_0x1306ed[_0xddf2('0x31')][_0xddf2('0x36')]));_0x135af6['attributes']=_0x135af6[_0xddf2('0x37')][_0xddf2('0x44')]?_0x135af6[_0xddf2('0x37')]:_0x4ebe79[_0xddf2('0x35')];if(_0x1306ed[_0xddf2('0x31')][_0xddf2('0x40')]){_0x135af6[_0xddf2('0x45')]=[{'all':!![]}];}_0x135af6=_[_0xddf2('0x46')]({},_0x135af6,_0x1306ed[_0xddf2('0x3d')]);return db['Campaign'][_0xddf2('0x47')](_0x135af6)['then'](handleEntityNotFound(_0x2a6581,null))['then'](function(_0x95eeb5){if(_0x95eeb5){var _0x316385=_0x95eeb5[_0xddf2('0x27')]({'plain':!![]});_0x316385=qs['omit'](_0x316385,['id',_0xddf2('0x51'),_0xddf2('0x52')]);_0x1306ed[_0xddf2('0x53')]=_[_0xddf2('0x54')](_0x1306ed[_0xddf2('0x53')],['id',_0xddf2('0x51'),_0xddf2('0x52')]);return db[_0xddf2('0x3e')][_0xddf2('0x48')](_[_0xddf2('0x46')](_0x316385,_0x1306ed[_0xddf2('0x53')]),{'include':_0x1306ed['query'][_0xddf2('0x40')]?[{'all':!![]}]:undefined})[_0xddf2('0x25')](function(_0x331659){var _0x286c64=_0x1306ed[_0xddf2('0x4a')]['get']({'plain':!![]});if(!_0x286c64)throw new Error(_0xddf2('0x49'));if(_0x286c64['role']===_0xddf2('0x4a')){var _0x172ef0=_0x331659[_0xddf2('0x27')]({'plain':!![]});var _0x11fbfc='IvrCampaigns';return db[_0xddf2('0x4b')][_0xddf2('0x47')]({'where':{'name':_0x11fbfc,'userProfileId':_0x286c64[_0xddf2('0x55')]},'raw':!![]})[_0xddf2('0x25')](function(_0x16031f){if(_0x16031f&&_0x16031f['autoAssociation']===0x0){return db[_0xddf2('0x4d')][_0xddf2('0x48')]({'name':_0x172ef0[_0xddf2('0x2b')],'resourceId':_0x172ef0['id'],'type':_0x16031f[_0xddf2('0x2b')],'sectionId':_0x16031f['id']},{})[_0xddf2('0x25')](function(){return _0x331659;});}else{return _0x331659;}})[_0xddf2('0x4e')](function(_0x9bedca){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9bedca);throw _0x9bedca;});}return _0x331659;});}})[_0xddf2('0x25')](respondWithResult(_0x2a6581,0xc9))[_0xddf2('0x4e')](handleError(_0x2a6581,null));};exports[_0xddf2('0x24')]=function(_0xefe5e0,_0x1c7bd0){if(_0xefe5e0[_0xddf2('0x53')]['id']){delete _0xefe5e0[_0xddf2('0x53')]['id'];}return db[_0xddf2('0x3e')][_0xddf2('0x47')]({'where':{'id':_0xefe5e0['params']['id']}})[_0xddf2('0x25')](handleEntityNotFound(_0x1c7bd0,null))['then'](saveUpdates(_0xefe5e0[_0xddf2('0x53')],null))[_0xddf2('0x25')](respondWithResult(_0x1c7bd0,null))[_0xddf2('0x4e')](handleError(_0x1c7bd0,null));};exports['destroy']=function(_0x2269ea,_0x542c1d){return db['Campaign'][_0xddf2('0x47')]({'where':{'id':_0x2269ea['params']['id']}})[_0xddf2('0x25')](handleEntityNotFound(_0x542c1d,null))[_0xddf2('0x25')](removeEntity(_0x542c1d,null))[_0xddf2('0x4e')](handleError(_0x542c1d,null));};exports[_0xddf2('0x56')]=function(_0x4f41fa,_0x5e0595,_0x323cd7){var _0x3a6faa={'raw':!![],'where':{}};var _0x30fb52={};var _0x25d253={'count':0x0,'rows':[]};return db[_0xddf2('0x3e')][_0xddf2('0x57')]({'where':{'id':_0x4f41fa['params']['id']}})[_0xddf2('0x25')](handleEntityNotFound(_0x5e0595,null))[_0xddf2('0x25')](function(_0x4e5c3b){if(_0x4e5c3b){_0x30fb52[_0xddf2('0x35')]=_['keys'](db['CmHopper'][_0xddf2('0x2e')]);_0x30fb52[_0xddf2('0x31')]=_[_0xddf2('0x32')](_0x4f41fa[_0xddf2('0x31')]);_0x30fb52[_0xddf2('0x33')]=_['intersection'](_0x30fb52[_0xddf2('0x35')],_0x30fb52[_0xddf2('0x31')]);_0x3a6faa['attributes']=_[_0xddf2('0x34')](_0x30fb52['model'],qs['fields'](_0x4f41fa['query'][_0xddf2('0x36')]));_0x3a6faa[_0xddf2('0x37')]=_0x3a6faa['attributes'][_0xddf2('0x44')]?_0x3a6faa['attributes']:_0x30fb52[_0xddf2('0x35')];if(!_0x4f41fa[_0xddf2('0x31')]['hasOwnProperty'](_0xddf2('0x58'))){_0x3a6faa[_0xddf2('0x1f')]=qs['limit'](_0x4f41fa[_0xddf2('0x31')]['limit']);_0x3a6faa[_0xddf2('0x1d')]=qs[_0xddf2('0x1d')](_0x4f41fa[_0xddf2('0x31')][_0xddf2('0x1d')]);}_0x3a6faa[_0xddf2('0x59')]=qs['sort'](_0x4f41fa[_0xddf2('0x31')][_0xddf2('0x39')]);_0x3a6faa[_0xddf2('0x3a')]=qs[_0xddf2('0x33')](_[_0xddf2('0x5a')](_0x4f41fa[_0xddf2('0x31')],_0x30fb52['filters']));_0x3a6faa[_0xddf2('0x3a')][_0xddf2('0x5b')]=_0x4e5c3b['id'];if(_0x4f41fa[_0xddf2('0x31')][_0xddf2('0x3b')]){_0x3a6faa[_0xddf2('0x3a')]=_[_0xddf2('0x46')](_0x3a6faa['where'],{'$or':_[_0xddf2('0x2d')](_0x3a6faa[_0xddf2('0x37')],function(_0x1523eb){var _0x5b149c={};_0x5b149c[_0x1523eb]={'$like':'%'+_0x4f41fa[_0xddf2('0x31')][_0xddf2('0x3b')]+'%'};return _0x5b149c;})});}_0x3a6faa=_[_0xddf2('0x46')]({},_0x3a6faa,_0x4f41fa['options']);return db[_0xddf2('0x5c')]['count']({'where':_0x3a6faa[_0xddf2('0x3a')]})[_0xddf2('0x25')](function(_0xbdee02){_0x25d253[_0xddf2('0x3f')]=_0xbdee02;if(_0x4f41fa['query'][_0xddf2('0x40')]){_0x3a6faa[_0xddf2('0x45')]=[{'all':!![]}];}return db[_0xddf2('0x5c')][_0xddf2('0x41')](_0x3a6faa);})[_0xddf2('0x25')](function(_0x3ddbfe){_0x25d253[_0xddf2('0x5d')]=_0x3ddbfe;return _0x25d253;});}})['then'](respondWithFilteredResult(_0x5e0595,_0x3a6faa))[_0xddf2('0x4e')](handleError(_0x5e0595,null));};exports[_0xddf2('0x5e')]=function(_0x36a7ee,_0x8cddc2,_0x517133){var _0x4388cb={'raw':!![],'where':{}};var _0xc4d0b9={};var _0x59354c={'count':0x0,'rows':[]};return db[_0xddf2('0x3e')][_0xddf2('0x57')]({'where':{'id':_0x36a7ee[_0xddf2('0x43')]['id']}})[_0xddf2('0x25')](handleEntityNotFound(_0x8cddc2,null))[_0xddf2('0x25')](function(_0x374f72){if(_0x374f72){_0xc4d0b9[_0xddf2('0x35')]=_[_0xddf2('0x32')](db['CmHopperHistory'][_0xddf2('0x2e')]);_0xc4d0b9[_0xddf2('0x31')]=_[_0xddf2('0x32')](_0x36a7ee[_0xddf2('0x31')]);_0xc4d0b9[_0xddf2('0x33')]=_['intersection'](_0xc4d0b9[_0xddf2('0x35')],_0xc4d0b9[_0xddf2('0x31')]);_0x4388cb[_0xddf2('0x37')]=_[_0xddf2('0x34')](_0xc4d0b9[_0xddf2('0x35')],qs[_0xddf2('0x36')](_0x36a7ee['query'][_0xddf2('0x36')]));_0x4388cb[_0xddf2('0x37')]=_0x4388cb['attributes'][_0xddf2('0x44')]?_0x4388cb[_0xddf2('0x37')]:_0xc4d0b9[_0xddf2('0x35')];if(!_0x36a7ee[_0xddf2('0x31')][_0xddf2('0x38')](_0xddf2('0x58'))){_0x4388cb[_0xddf2('0x1f')]=qs['limit'](_0x36a7ee[_0xddf2('0x31')][_0xddf2('0x1f')]);_0x4388cb[_0xddf2('0x1d')]=qs[_0xddf2('0x1d')](_0x36a7ee[_0xddf2('0x31')][_0xddf2('0x1d')]);}_0x4388cb[_0xddf2('0x59')]=qs[_0xddf2('0x39')](_0x36a7ee['query'][_0xddf2('0x39')]);_0x4388cb[_0xddf2('0x3a')]=qs[_0xddf2('0x33')](_[_0xddf2('0x5a')](_0x36a7ee['query'],_0xc4d0b9[_0xddf2('0x33')]));_0x4388cb[_0xddf2('0x3a')][_0xddf2('0x5b')]=_0x374f72['id'];if(_0x36a7ee[_0xddf2('0x31')][_0xddf2('0x3b')]){_0x4388cb[_0xddf2('0x3a')]=_['merge'](_0x4388cb[_0xddf2('0x3a')],{'$or':_[_0xddf2('0x2d')](_0x4388cb['attributes'],function(_0x577997){var _0x29a8dd={};_0x29a8dd[_0x577997]={'$like':'%'+_0x36a7ee[_0xddf2('0x31')][_0xddf2('0x3b')]+'%'};return _0x29a8dd;})});}_0x4388cb=_[_0xddf2('0x46')]({},_0x4388cb,_0x36a7ee[_0xddf2('0x3d')]);return db['CmHopperHistory'][_0xddf2('0x3f')]({'where':_0x4388cb[_0xddf2('0x3a')]})['then'](function(_0x209aca){_0x59354c[_0xddf2('0x3f')]=_0x209aca;if(_0x36a7ee['query'][_0xddf2('0x40')]){_0x4388cb[_0xddf2('0x45')]=[{'all':!![]}];}return db[_0xddf2('0x5f')]['findAll'](_0x4388cb);})[_0xddf2('0x25')](function(_0xf1e724){_0x59354c['rows']=_0xf1e724;return _0x59354c;});}})[_0xddf2('0x25')](respondWithFilteredResult(_0x8cddc2,_0x4388cb))[_0xddf2('0x4e')](handleError(_0x8cddc2,null));};exports[_0xddf2('0x60')]=function(_0x5c2be2,_0xcdb8a8,_0x2923ab){var _0x331b2e={'raw':!![],'where':{}};var _0x4edf50={};var _0x40ddb0={'count':0x0,'rows':[]};return db['Campaign'][_0xddf2('0x57')]({'where':{'id':_0x5c2be2['params']['id']}})[_0xddf2('0x25')](handleEntityNotFound(_0xcdb8a8,null))['then'](function(_0xfad678){if(_0xfad678){_0x4edf50[_0xddf2('0x35')]=_['keys'](db[_0xddf2('0x61')]['rawAttributes']);_0x4edf50[_0xddf2('0x31')]=_[_0xddf2('0x32')](_0x5c2be2[_0xddf2('0x31')]);_0x4edf50[_0xddf2('0x33')]=_['intersection'](_0x4edf50[_0xddf2('0x35')],_0x4edf50['query']);_0x331b2e[_0xddf2('0x37')]=_['intersection'](_0x4edf50[_0xddf2('0x35')],qs['fields'](_0x5c2be2[_0xddf2('0x31')][_0xddf2('0x36')]));_0x331b2e['attributes']=_0x331b2e[_0xddf2('0x37')][_0xddf2('0x44')]?_0x331b2e[_0xddf2('0x37')]:_0x4edf50[_0xddf2('0x35')];if(!_0x5c2be2[_0xddf2('0x31')][_0xddf2('0x38')]('nolimit')){_0x331b2e['limit']=qs[_0xddf2('0x1f')](_0x5c2be2[_0xddf2('0x31')][_0xddf2('0x1f')]);_0x331b2e[_0xddf2('0x1d')]=qs['offset'](_0x5c2be2['query']['offset']);}_0x331b2e[_0xddf2('0x59')]=qs['sort'](_0x5c2be2[_0xddf2('0x31')][_0xddf2('0x39')]);_0x331b2e[_0xddf2('0x3a')]=qs[_0xddf2('0x33')](_[_0xddf2('0x5a')](_0x5c2be2['query'],_0x4edf50[_0xddf2('0x33')]));_0x331b2e[_0xddf2('0x3a')][_0xddf2('0x5b')]=_0xfad678['id'];if(_0x5c2be2[_0xddf2('0x31')][_0xddf2('0x3b')]){_0x331b2e[_0xddf2('0x3a')]=_[_0xddf2('0x46')](_0x331b2e[_0xddf2('0x3a')],{'$or':_[_0xddf2('0x2d')](_0x331b2e[_0xddf2('0x37')],function(_0x4f87fc){var _0x23d5a3={};_0x23d5a3[_0x4f87fc]={'$like':'%'+_0x5c2be2[_0xddf2('0x31')]['filter']+'%'};return _0x23d5a3;})});}_0x331b2e=_['merge']({},_0x331b2e,_0x5c2be2['options']);return db['CmHopperFinal'][_0xddf2('0x3f')]({'where':_0x331b2e[_0xddf2('0x3a')]})[_0xddf2('0x25')](function(_0xcb107e){_0x40ddb0['count']=_0xcb107e;if(_0x5c2be2['query'][_0xddf2('0x40')]){_0x331b2e[_0xddf2('0x45')]=[{'all':!![]}];}return db[_0xddf2('0x61')][_0xddf2('0x41')](_0x331b2e);})[_0xddf2('0x25')](function(_0x43a9aa){_0x40ddb0[_0xddf2('0x5d')]=_0x43a9aa;return _0x40ddb0;});}})[_0xddf2('0x25')](respondWithFilteredResult(_0xcdb8a8,_0x331b2e))['catch'](handleError(_0xcdb8a8,null));};exports[_0xddf2('0x62')]=function(_0x5bb0ed,_0xd6228e,_0x1ccf9f){var _0x12ce8a={'raw':!![],'where':{}};var _0x76e20f={};var _0x56d9fd={'count':0x0,'rows':[]};return db[_0xddf2('0x3e')][_0xddf2('0x57')]({'where':{'id':_0x5bb0ed[_0xddf2('0x43')]['id']}})['then'](handleEntityNotFound(_0xd6228e,null))[_0xddf2('0x25')](function(_0x4f49aa){if(_0x4f49aa){_0x76e20f[_0xddf2('0x35')]=_[_0xddf2('0x32')](db[_0xddf2('0x63')]['rawAttributes']);_0x76e20f['query']=_[_0xddf2('0x32')](_0x5bb0ed[_0xddf2('0x31')]);_0x76e20f[_0xddf2('0x33')]=_[_0xddf2('0x34')](_0x76e20f[_0xddf2('0x35')],_0x76e20f[_0xddf2('0x31')]);_0x12ce8a['attributes']=_['intersection'](_0x76e20f[_0xddf2('0x35')],qs[_0xddf2('0x36')](_0x5bb0ed['query'][_0xddf2('0x36')]));_0x12ce8a['attributes']=_0x12ce8a[_0xddf2('0x37')][_0xddf2('0x44')]?_0x12ce8a[_0xddf2('0x37')]:_0x76e20f[_0xddf2('0x35')];if(!_0x5bb0ed['query']['hasOwnProperty'](_0xddf2('0x58'))){_0x12ce8a[_0xddf2('0x1f')]=qs['limit'](_0x5bb0ed['query']['limit']);_0x12ce8a['offset']=qs[_0xddf2('0x1d')](_0x5bb0ed[_0xddf2('0x31')][_0xddf2('0x1d')]);}_0x12ce8a[_0xddf2('0x59')]=qs[_0xddf2('0x39')](_0x5bb0ed[_0xddf2('0x31')][_0xddf2('0x39')]);_0x12ce8a[_0xddf2('0x3a')]=qs['filters'](_['pick'](_0x5bb0ed[_0xddf2('0x31')],_0x76e20f[_0xddf2('0x33')]));_0x12ce8a[_0xddf2('0x3a')][_0xddf2('0x5b')]=_0x4f49aa['id'];if(_0x5bb0ed[_0xddf2('0x31')][_0xddf2('0x3b')]){_0x12ce8a[_0xddf2('0x3a')]=_[_0xddf2('0x46')](_0x12ce8a[_0xddf2('0x3a')],{'$or':_[_0xddf2('0x2d')](_0x12ce8a['attributes'],function(_0x262ecf){var _0x2e3164={};_0x2e3164[_0x262ecf]={'$like':'%'+_0x5bb0ed[_0xddf2('0x31')][_0xddf2('0x3b')]+'%'};return _0x2e3164;})});}_0x12ce8a=_[_0xddf2('0x46')]({},_0x12ce8a,_0x5bb0ed['options']);return db[_0xddf2('0x63')][_0xddf2('0x3f')]({'where':_0x12ce8a['where']})[_0xddf2('0x25')](function(_0x10da02){_0x56d9fd[_0xddf2('0x3f')]=_0x10da02;if(_0x5bb0ed[_0xddf2('0x31')][_0xddf2('0x40')]){_0x12ce8a[_0xddf2('0x45')]=[{'all':!![]}];}return db[_0xddf2('0x63')][_0xddf2('0x41')](_0x12ce8a);})[_0xddf2('0x25')](function(_0x33db87){_0x56d9fd[_0xddf2('0x5d')]=_0x33db87;return _0x56d9fd;});}})[_0xddf2('0x25')](respondWithFilteredResult(_0xd6228e,_0x12ce8a))[_0xddf2('0x4e')](handleError(_0xd6228e,null));};exports[_0xddf2('0x64')]=function(_0xee501d,_0x3ed4f6,_0x46f313){var _0x2585eb={};var _0x5d7904={};var _0x3e4f13;var _0x241cce;return db[_0xddf2('0x3e')]['findOne']({'where':{'id':_0xee501d[_0xddf2('0x43')]['id']}})[_0xddf2('0x25')](handleEntityNotFound(_0x3ed4f6,null))['then'](function(_0x192f93){if(_0x192f93){_0x3e4f13=_0x192f93;_0x5d7904['model']=_['keys'](db['CmList'][_0xddf2('0x2e')]);_0x5d7904['query']=_[_0xddf2('0x32')](_0xee501d['query']);_0x5d7904[_0xddf2('0x33')]=_['intersection'](_0x5d7904['model'],_0x5d7904[_0xddf2('0x31')]);_0x2585eb[_0xddf2('0x37')]=_[_0xddf2('0x34')](_0x5d7904[_0xddf2('0x35')],qs[_0xddf2('0x36')](_0xee501d[_0xddf2('0x31')][_0xddf2('0x36')]));_0x2585eb[_0xddf2('0x37')]=_0x2585eb['attributes'][_0xddf2('0x44')]?_0x2585eb[_0xddf2('0x37')]:_0x5d7904[_0xddf2('0x35')];_0x2585eb[_0xddf2('0x59')]=qs[_0xddf2('0x39')](_0xee501d[_0xddf2('0x31')][_0xddf2('0x39')]);_0x2585eb[_0xddf2('0x3a')]=qs['filters'](_[_0xddf2('0x5a')](_0xee501d[_0xddf2('0x31')],_0x5d7904[_0xddf2('0x33')]));if(_0xee501d[_0xddf2('0x31')][_0xddf2('0x3b')]){_0x2585eb[_0xddf2('0x3a')]=_[_0xddf2('0x46')](_0x2585eb['where'],{'$or':_[_0xddf2('0x2d')](_0x2585eb[_0xddf2('0x37')],function(_0x31a7c1){var _0x4e7268={};_0x4e7268[_0x31a7c1]={'$like':'%'+_0xee501d[_0xddf2('0x31')][_0xddf2('0x3b')]+'%'};return _0x4e7268;})});}_0x2585eb=_[_0xddf2('0x46')]({},_0x2585eb,_0xee501d['options']);return _0x3e4f13[_0xddf2('0x64')](_0x2585eb);}})[_0xddf2('0x25')](function(_0x3c8dcf){if(_0x3c8dcf){_0x241cce=_0x3c8dcf[_0xddf2('0x44')];if(!_0xee501d['query'][_0xddf2('0x38')](_0xddf2('0x58'))){_0x2585eb['limit']=qs[_0xddf2('0x1f')](_0xee501d[_0xddf2('0x31')][_0xddf2('0x1f')]);_0x2585eb[_0xddf2('0x1d')]=qs[_0xddf2('0x1d')](_0xee501d[_0xddf2('0x31')][_0xddf2('0x1d')]);}return _0x3e4f13[_0xddf2('0x64')](_0x2585eb);}})[_0xddf2('0x25')](function(_0x5c1f51){if(_0x5c1f51){return _0x5c1f51?{'count':_0x241cce,'rows':_0x5c1f51}:null;}})[_0xddf2('0x25')](respondWithResult(_0x3ed4f6,null))[_0xddf2('0x4e')](handleError(_0x3ed4f6,null));};exports[_0xddf2('0x65')]=function(_0x534c69,_0xc5a834,_0x3e94a5){var _0x25d5bf,_0x574821;return db[_0xddf2('0x3e')][_0xddf2('0x47')]({'where':{'id':_0x534c69[_0xddf2('0x43')]['id']}})['then'](handleEntityNotFound(_0xc5a834,null))[_0xddf2('0x25')](function(_0x5aa91a){if(_0x5aa91a){_0x574821=_0x5aa91a;return _0x5aa91a['addLists'](_0x534c69[_0xddf2('0x53')][_0xddf2('0x66')],_['omit'](_0x534c69[_0xddf2('0x53')],[_0xddf2('0x66'),'id'])||{});}return null;})['spread'](function(_0x4c6f2f){var _0x433ff6;_0x25d5bf=_0x4c6f2f||[];var _0xfbf8c1=[];if(_0x4c6f2f){for(var _0x263e6e=0x0;_0x263e6e<_0x4c6f2f[_0xddf2('0x44')];_0x263e6e+=0x1){var _0x2b4ff8=_0x4c6f2f[_0x263e6e]['get']({'plain':!![]});_0x574821[_0xddf2('0x67')]=_0x534c69[_0xddf2('0x53')][_0xddf2('0x67')]?_0x534c69[_0xddf2('0x53')]['dialCheckDuplicateType']:_0x574821[_0xddf2('0x67')];switch(_0x574821[_0xddf2('0x67')]){case _0xddf2('0x68'):_0x433ff6=squel['insert']()[_0xddf2('0x69')](_0xddf2('0x6a'))[_0xddf2('0x6b')]([_0xddf2('0x6c'),'scheduledAt',_0xddf2('0x6d'),_0xddf2('0x6e'),_0xddf2('0x5b'),_0xddf2('0x51'),_0xddf2('0x52')],squel[_0xddf2('0x6f')]()[_0xddf2('0x70')]('phone',_0xddf2('0x6c'))['field'](_0xddf2('0x71'),_0xddf2('0x72'))[_0xddf2('0x70')]('id',_0xddf2('0x6d'))[_0xddf2('0x70')](_0x2b4ff8[_0xddf2('0x73')][_0xddf2('0x74')](),_0xddf2('0x6e'))['field'](_0x534c69[_0xddf2('0x43')]['id'][_0xddf2('0x74')](),_0xddf2('0x5b'))[_0xddf2('0x70')](_0xddf2('0x71'),_0xddf2('0x51'))[_0xddf2('0x70')]('NOW()','updatedAt')[_0xddf2('0x75')](_0xddf2('0x76'))[_0xddf2('0x3a')]('deletedAt\x20IS\x20NULL')[_0xddf2('0x3a')]('ListId\x20=\x20?',_0x2b4ff8['CmListId']['toString']())[_0xddf2('0x3a')](_0xddf2('0x77'))[_0xddf2('0x3a')](_0xddf2('0x78'),squel[_0xddf2('0x6f')]()[_0xddf2('0x70')](_0xddf2('0x79'))[_0xddf2('0x75')](_0xddf2('0x7a'))[_0xddf2('0x3a')](_0xddf2('0x7b'),_0x534c69[_0xddf2('0x43')]['id'][_0xddf2('0x74')]()))[_0xddf2('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xddf2('0x70')](_0xddf2('0x7c'))[_0xddf2('0x75')](_0xddf2('0x6a'))['where']('CampaignId\x20=\x20?',_0x534c69['params']['id'][_0xddf2('0x74')]())))[_0xddf2('0x74')]();break;case _0xddf2('0x7d'):_0x433ff6=squel[_0xddf2('0x7e')]()[_0xddf2('0x69')](_0xddf2('0x6a'))[_0xddf2('0x6b')]([_0xddf2('0x6c'),_0xddf2('0x72'),'ContactId',_0xddf2('0x6e'),'CampaignId','createdAt',_0xddf2('0x52')],squel[_0xddf2('0x6f')]()[_0xddf2('0x70')](_0xddf2('0x6c'),_0xddf2('0x6c'))[_0xddf2('0x70')]('NOW()',_0xddf2('0x72'))['field']('id',_0xddf2('0x6d'))[_0xddf2('0x70')](_0x2b4ff8[_0xddf2('0x73')][_0xddf2('0x74')](),_0xddf2('0x6e'))[_0xddf2('0x70')](_0x534c69['params']['id'][_0xddf2('0x74')](),_0xddf2('0x5b'))[_0xddf2('0x70')](_0xddf2('0x71'),_0xddf2('0x51'))[_0xddf2('0x70')](_0xddf2('0x71'),_0xddf2('0x52'))[_0xddf2('0x75')]('cm_contacts')['where'](_0xddf2('0x7f'))[_0xddf2('0x3a')](_0xddf2('0x80'),_0x2b4ff8[_0xddf2('0x73')][_0xddf2('0x74')]())[_0xddf2('0x3a')](_0xddf2('0x77'))['where'](_0xddf2('0x78'),squel[_0xddf2('0x6f')]()[_0xddf2('0x70')]('COALESCE(phone,\x27\x27)')[_0xddf2('0x75')](_0xddf2('0x6a'))[_0xddf2('0x3a')](_0xddf2('0x7b'),_0x534c69[_0xddf2('0x43')]['id'][_0xddf2('0x74')]())))[_0xddf2('0x74')]();break;default:_0x433ff6=squel[_0xddf2('0x7e')]()[_0xddf2('0x69')](_0xddf2('0x6a'))['fromQuery']([_0xddf2('0x6c'),_0xddf2('0x72'),_0xddf2('0x6d'),_0xddf2('0x6e'),_0xddf2('0x5b'),'createdAt','updatedAt'],squel[_0xddf2('0x6f')]()[_0xddf2('0x70')]('phone',_0xddf2('0x6c'))['field'](_0xddf2('0x71'),_0xddf2('0x72'))[_0xddf2('0x70')]('id',_0xddf2('0x6d'))[_0xddf2('0x70')](_0x2b4ff8[_0xddf2('0x73')]['toString'](),'ListId')[_0xddf2('0x70')](_0x534c69[_0xddf2('0x43')]['id'][_0xddf2('0x74')](),'CampaignId')[_0xddf2('0x70')](_0xddf2('0x71'),'createdAt')[_0xddf2('0x70')](_0xddf2('0x71'),'updatedAt')[_0xddf2('0x75')](_0xddf2('0x76'))[_0xddf2('0x3a')](_0xddf2('0x7f'))[_0xddf2('0x3a')](_0xddf2('0x80'),_0x2b4ff8[_0xddf2('0x73')][_0xddf2('0x74')]())[_0xddf2('0x3a')]('phone\x20IS\x20NOT\x20NULL'))[_0xddf2('0x74')]();}_0xfbf8c1[_0xddf2('0x81')](db[_0xddf2('0x82')][_0xddf2('0x31')](_0x433ff6));}return BPromise[_0xddf2('0x83')](_0xfbf8c1);}})['then'](function(){return _0x25d5bf;})[_0xddf2('0x25')](respondWithResult(_0xc5a834,null))[_0xddf2('0x4e')](handleError(_0xc5a834,null));};exports[_0xddf2('0x84')]=function(_0xa55af8,_0x2d61c3,_0x2c7cf2){return db[_0xddf2('0x3e')][_0xddf2('0x47')]({'where':{'id':_0xa55af8[_0xddf2('0x43')]['id']}})[_0xddf2('0x25')](handleEntityNotFound(_0x2d61c3,null))[_0xddf2('0x25')](function(_0x3bc7ab){if(_0x3bc7ab){return _0x3bc7ab[_0xddf2('0x84')](_0xa55af8[_0xddf2('0x31')][_0xddf2('0x66')]);}})[_0xddf2('0x25')](function(_0x3ab1f8){if(_0x3ab1f8){return db[_0xddf2('0x5c')][_0xddf2('0x26')]({'where':{'ListId':_0xa55af8[_0xddf2('0x31')][_0xddf2('0x66')],'CampaignId':_0xa55af8[_0xddf2('0x43')]['id']}})[_0xddf2('0x25')](function(){return _0x3ab1f8;});}})[_0xddf2('0x25')](respondWithStatusCode(_0x2d61c3,null))[_0xddf2('0x4e')](handleError(_0x2d61c3,null));};exports[_0xddf2('0x85')]=function(_0x517d9b,_0x14617e,_0x1da891){var _0x7e53da={};var _0x516833={};var _0x235ab8;var _0x582701;return db[_0xddf2('0x3e')][_0xddf2('0x57')]({'where':{'id':_0x517d9b[_0xddf2('0x43')]['id']}})[_0xddf2('0x25')](handleEntityNotFound(_0x14617e,null))[_0xddf2('0x25')](function(_0x460c9e){if(_0x460c9e){_0x235ab8=_0x460c9e;_0x516833['model']=_[_0xddf2('0x32')](db[_0xddf2('0x86')]['rawAttributes']);_0x516833[_0xddf2('0x31')]=_['keys'](_0x517d9b[_0xddf2('0x31')]);_0x516833[_0xddf2('0x33')]=_['intersection'](_0x516833[_0xddf2('0x35')],_0x516833[_0xddf2('0x31')]);_0x7e53da[_0xddf2('0x37')]=_['intersection'](_0x516833[_0xddf2('0x35')],qs['fields'](_0x517d9b['query'][_0xddf2('0x36')]));_0x7e53da['attributes']=_0x7e53da[_0xddf2('0x37')][_0xddf2('0x44')]?_0x7e53da[_0xddf2('0x37')]:_0x516833[_0xddf2('0x35')];_0x7e53da[_0xddf2('0x59')]=qs[_0xddf2('0x39')](_0x517d9b[_0xddf2('0x31')][_0xddf2('0x39')]);_0x7e53da[_0xddf2('0x3a')]=qs[_0xddf2('0x33')](_['pick'](_0x517d9b[_0xddf2('0x31')],_0x516833[_0xddf2('0x33')]));if(_0x517d9b['query'][_0xddf2('0x3b')]){_0x7e53da['where']=_[_0xddf2('0x46')](_0x7e53da[_0xddf2('0x3a')],{'$or':_['map'](_0x7e53da[_0xddf2('0x37')],function(_0x3db358){var _0x34885e={};_0x34885e[_0x3db358]={'$like':'%'+_0x517d9b['query'][_0xddf2('0x3b')]+'%'};return _0x34885e;})});}_0x7e53da=_['merge']({},_0x7e53da,_0x517d9b[_0xddf2('0x3d')]);return _0x235ab8[_0xddf2('0x85')](_0x7e53da);}})[_0xddf2('0x25')](function(_0x27d192){if(_0x27d192){_0x582701=_0x27d192['length'];if(!_0x517d9b['query'][_0xddf2('0x38')](_0xddf2('0x58'))){_0x7e53da[_0xddf2('0x1f')]=qs[_0xddf2('0x1f')](_0x517d9b[_0xddf2('0x31')][_0xddf2('0x1f')]);_0x7e53da['offset']=qs[_0xddf2('0x1d')](_0x517d9b[_0xddf2('0x31')][_0xddf2('0x1d')]);}return _0x235ab8[_0xddf2('0x85')](_0x7e53da);}})['then'](function(_0x42c350){if(_0x42c350){return _0x42c350?{'count':_0x582701,'rows':_0x42c350}:null;}})[_0xddf2('0x25')](respondWithResult(_0x14617e,null))[_0xddf2('0x4e')](handleError(_0x14617e,null));};exports[_0xddf2('0x87')]=function(_0x4dfcff,_0x4f50de,_0x19084d){var _0x479eb6,_0x2c9897;return db[_0xddf2('0x3e')][_0xddf2('0x47')]({'where':{'id':_0x4dfcff[_0xddf2('0x43')]['id']}})[_0xddf2('0x25')](handleEntityNotFound(_0x4f50de,null))[_0xddf2('0x25')](function(_0x818234){if(_0x818234){_0x2c9897=_0x818234;return _0x818234['addBlackLists'](_0x4dfcff[_0xddf2('0x53')][_0xddf2('0x66')],_[_0xddf2('0x54')](_0x4dfcff['body'],['ids','id'])||{});}return null;})[_0xddf2('0x88')](function(_0x29d77b){var _0x1e3b27;_0x479eb6=_0x29d77b||[];var _0x1a47e2=[];if(_0x29d77b){for(var _0x15809c=0x0;_0x15809c<_0x29d77b[_0xddf2('0x44')];_0x15809c+=0x1){var _0x3ae133=_0x29d77b[_0x15809c][_0xddf2('0x27')]({'plain':!![]});_0x1e3b27=squel[_0xddf2('0x7e')]()[_0xddf2('0x69')]('cm_hopper_black')['fromQuery']([_0xddf2('0x6c'),_0xddf2('0x6d'),'ListId','CampaignId',_0xddf2('0x51'),_0xddf2('0x52')],squel[_0xddf2('0x6f')]()[_0xddf2('0x70')](_0xddf2('0x6c'),_0xddf2('0x6c'))[_0xddf2('0x70')]('id',_0xddf2('0x6d'))[_0xddf2('0x70')](_0x3ae133[_0xddf2('0x73')][_0xddf2('0x74')](),_0xddf2('0x6e'))[_0xddf2('0x70')](_0x4dfcff[_0xddf2('0x43')]['id'][_0xddf2('0x74')](),'CampaignId')[_0xddf2('0x70')](_0xddf2('0x71'),'createdAt')[_0xddf2('0x70')](_0xddf2('0x71'),_0xddf2('0x52'))[_0xddf2('0x75')](_0xddf2('0x76'))[_0xddf2('0x3a')](_0xddf2('0x7f'))[_0xddf2('0x3a')](_0xddf2('0x80'),_0x3ae133[_0xddf2('0x73')][_0xddf2('0x74')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xddf2('0x74')]();_0x1a47e2[_0xddf2('0x81')](db[_0xddf2('0x82')][_0xddf2('0x31')](_0x1e3b27));}return BPromise[_0xddf2('0x83')](_0x1a47e2);}})[_0xddf2('0x25')](function(){return _0x479eb6;})['then'](respondWithResult(_0x4f50de,null))[_0xddf2('0x4e')](handleError(_0x4f50de,null));};exports[_0xddf2('0x89')]=function(_0x3db241,_0x72858,_0x117962){return db[_0xddf2('0x3e')][_0xddf2('0x47')]({'where':{'id':_0x3db241[_0xddf2('0x43')]['id']}})[_0xddf2('0x25')](handleEntityNotFound(_0x72858,null))[_0xddf2('0x25')](function(_0x1de652){if(_0x1de652){return _0x1de652[_0xddf2('0x89')](_0x3db241[_0xddf2('0x31')][_0xddf2('0x66')]);}})[_0xddf2('0x25')](function(_0x1dd8bd){if(_0x1dd8bd){return db[_0xddf2('0x63')]['destroy']({'where':{'ListId':_0x3db241['query'][_0xddf2('0x66')],'CampaignId':_0x3db241['params']['id']}})[_0xddf2('0x25')](function(){return _0x1dd8bd;});}})[_0xddf2('0x25')](respondWithStatusCode(_0x72858,null))[_0xddf2('0x4e')](handleError(_0x72858,null));}; \ No newline at end of file +var _0x652c=['offset','undefined','limit','count','set','apply','save','update','then','stack','send','map','rawAttributes','key','model','name','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','Campaign','includeAll','findAll','rows','catch','show','keys','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','get','omit','createdAt','updatedAt','destroy','getHoppers','findOne','hasOwnProperty','CmHopper','CmHopperHistory','CampaignId','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','ids','dialCheckDuplicateType','always','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','field','CmListId','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','onlyIfOpen','insert','into','select','CampaignId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x3252e8,_0x51bf8e){var _0x45b65a=function(_0x142c1d){while(--_0x142c1d){_0x3252e8['push'](_0x3252e8['shift']());}};_0x45b65a(++_0x51bf8e);}(_0x652c,0x168));var _0xc652=function(_0x47a1c4,_0x2f3fce){_0x47a1c4=_0x47a1c4-0x0;var _0xfb1f51=_0x652c[_0x47a1c4];return _0xfb1f51;};'use strict';var emlformat=require(_0xc652('0x0'));var rimraf=require(_0xc652('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc652('0x2'));var rp=require(_0xc652('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc652('0x4'));var path=require(_0xc652('0x5'));var sox=require(_0xc652('0x6'));var csv=require(_0xc652('0x7'));var ejs=require(_0xc652('0x8'));var fs=require('fs');var fs_extra=require(_0xc652('0x9'));var _=require(_0xc652('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc652('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc652('0xc'));var Papa=require(_0xc652('0xd'));var Redis=require(_0xc652('0xe'));var authService=require(_0xc652('0xf'));var qs=require(_0xc652('0x10'));var as=require(_0xc652('0x11'));var hardwareService=require(_0xc652('0x12'));var logger=require('../../config/logger')(_0xc652('0x13'));var utils=require('../../config/utils');var config=require(_0xc652('0x14'));var licenseUtil=require(_0xc652('0x15'));var db=require(_0xc652('0x16'))['db'];function respondWithStatusCode(_0x43013a,_0x596215){_0x596215=_0x596215||0xcc;return function(_0x5be9da){if(_0x5be9da){return _0x43013a[_0xc652('0x17')](_0x596215);}return _0x43013a[_0xc652('0x18')](_0x596215)[_0xc652('0x19')]();};}function respondWithResult(_0x2f1a44,_0x16971e){_0x16971e=_0x16971e||0xc8;return function(_0x2f3f59){if(_0x2f3f59){return _0x2f1a44[_0xc652('0x18')](_0x16971e)[_0xc652('0x1a')](_0x2f3f59);}};}function respondWithFilteredResult(_0x56855f,_0x1f43ae){return function(_0x263365){if(_0x263365){var _0xe40d54=typeof _0x1f43ae[_0xc652('0x1b')]===_0xc652('0x1c')&&typeof _0x1f43ae[_0xc652('0x1d')]===_0xc652('0x1c');var _0x53abff=_0x263365[_0xc652('0x1e')];var _0x3f65cd=_0xe40d54?0x0:_0x1f43ae[_0xc652('0x1b')];var _0x18ea8c=_0xe40d54?_0x263365[_0xc652('0x1e')]:_0x1f43ae['offset']+_0x1f43ae[_0xc652('0x1d')];var _0x2ef874;if(_0x18ea8c>=_0x53abff){_0x18ea8c=_0x53abff;_0x2ef874=0xc8;}else{_0x2ef874=0xce;}_0x56855f['status'](_0x2ef874);return _0x56855f[_0xc652('0x1f')]('Content-Range',_0x3f65cd+'-'+_0x18ea8c+'/'+_0x53abff)[_0xc652('0x1a')](_0x263365);}return null;};}function patchUpdates(_0x421b42){return function(_0x364f4b){try{jsonpatch[_0xc652('0x20')](_0x364f4b,_0x421b42,!![]);}catch(_0x3d3e4e){return BPromise['reject'](_0x3d3e4e);}return _0x364f4b[_0xc652('0x21')]();};}function saveUpdates(_0x1a6129,_0x4afe2c){return function(_0x5b4433){if(_0x5b4433){return _0x5b4433[_0xc652('0x22')](_0x1a6129)[_0xc652('0x23')](function(_0x573fb5){return _0x573fb5;});}return null;};}function removeEntity(_0x52674a,_0x5d9266){return function(_0x34851c){if(_0x34851c){return _0x34851c['destroy']()[_0xc652('0x23')](function(){var _0x425a35=_0x34851c['get']({'plain':!![]});var _0x3e1fde='IvrCampaigns';return db['UserProfileResource']['destroy']({'where':{'type':_0x3e1fde,'resourceId':_0x425a35['id']}})['then'](function(){return _0x34851c;});})[_0xc652('0x23')](function(){_0x52674a[_0xc652('0x18')](0xcc)[_0xc652('0x19')]();});}};}function handleEntityNotFound(_0x836dce,_0x3fb470){return function(_0x368cd1){if(!_0x368cd1){_0x836dce[_0xc652('0x17')](0x194);}return _0x368cd1;};}function handleError(_0x56bf00,_0x2e0b61){_0x2e0b61=_0x2e0b61||0x1f4;return function(_0x440cea){logger['error'](_0x440cea[_0xc652('0x24')]);if(_0x440cea['name']){delete _0x440cea['name'];}_0x56bf00[_0xc652('0x18')](_0x2e0b61)[_0xc652('0x25')](_0x440cea);};}exports['index']=function(_0x3674f4,_0x410eb8){var _0x19264a={},_0x299d61={},_0x47bd58={'count':0x0,'rows':[]};var _0xd700b8=_[_0xc652('0x26')](db['Campaign'][_0xc652('0x27')],function(_0x4d29d4){return{'name':_0x4d29d4['fieldName'],'type':_0x4d29d4['type'][_0xc652('0x28')]};});_0x299d61[_0xc652('0x29')]=_['map'](_0xd700b8,_0xc652('0x2a'));_0x299d61['query']=_['keys'](_0x3674f4[_0xc652('0x2b')]);_0x299d61[_0xc652('0x2c')]=_[_0xc652('0x2d')](_0x299d61['model'],_0x299d61[_0xc652('0x2b')]);_0x19264a[_0xc652('0x2e')]=_[_0xc652('0x2d')](_0x299d61['model'],qs[_0xc652('0x2f')](_0x3674f4['query']['fields']));_0x19264a[_0xc652('0x2e')]=_0x19264a['attributes'][_0xc652('0x30')]?_0x19264a[_0xc652('0x2e')]:_0x299d61[_0xc652('0x29')];if(!_0x3674f4[_0xc652('0x2b')]['hasOwnProperty'](_0xc652('0x31'))){_0x19264a[_0xc652('0x1d')]=qs[_0xc652('0x1d')](_0x3674f4[_0xc652('0x2b')][_0xc652('0x1d')]);_0x19264a[_0xc652('0x1b')]=qs[_0xc652('0x1b')](_0x3674f4[_0xc652('0x2b')]['offset']);}_0x19264a[_0xc652('0x32')]=qs['sort'](_0x3674f4[_0xc652('0x2b')][_0xc652('0x33')]);_0x19264a[_0xc652('0x34')]=qs[_0xc652('0x2c')](_[_0xc652('0x35')](_0x3674f4['query'],_0x299d61[_0xc652('0x2c')]),_0xd700b8);if(_0x3674f4['query'][_0xc652('0x36')]){_0x19264a[_0xc652('0x34')]=_['merge'](_0x19264a[_0xc652('0x34')],{'$or':_[_0xc652('0x26')](_0xd700b8,function(_0x4dc5a2){if(_0x4dc5a2[_0xc652('0x37')]!==_0xc652('0x38')){var _0x355123={};_0x355123[_0x4dc5a2['name']]={'$like':'%'+_0x3674f4[_0xc652('0x2b')][_0xc652('0x36')]+'%'};return _0x355123;}})});}_0x19264a=_[_0xc652('0x39')]({},_0x19264a,_0x3674f4['options']);var _0x1dc338={'where':_0x19264a[_0xc652('0x34')]};return db[_0xc652('0x3a')][_0xc652('0x1e')](_0x1dc338)[_0xc652('0x23')](function(_0x5c1399){_0x47bd58[_0xc652('0x1e')]=_0x5c1399;if(_0x3674f4['query'][_0xc652('0x3b')]){_0x19264a['include']=[{'all':!![]}];}return db[_0xc652('0x3a')][_0xc652('0x3c')](_0x19264a);})[_0xc652('0x23')](function(_0x52d351){_0x47bd58[_0xc652('0x3d')]=_0x52d351;return _0x47bd58;})[_0xc652('0x23')](respondWithFilteredResult(_0x410eb8,_0x19264a))[_0xc652('0x3e')](handleError(_0x410eb8,null));};exports[_0xc652('0x3f')]=function(_0x58e15a,_0x17c163){var _0x242aca={'raw':![],'where':{'id':_0x58e15a['params']['id']}},_0x13c0aa={};_0x13c0aa[_0xc652('0x29')]=_[_0xc652('0x40')](db['Campaign'][_0xc652('0x27')]);_0x13c0aa['query']=_[_0xc652('0x40')](_0x58e15a[_0xc652('0x2b')]);_0x13c0aa[_0xc652('0x2c')]=_['intersection'](_0x13c0aa[_0xc652('0x29')],_0x13c0aa['query']);_0x242aca[_0xc652('0x2e')]=_['intersection'](_0x13c0aa[_0xc652('0x29')],qs['fields'](_0x58e15a['query'][_0xc652('0x2f')]));_0x242aca[_0xc652('0x2e')]=_0x242aca[_0xc652('0x2e')]['length']?_0x242aca[_0xc652('0x2e')]:_0x13c0aa[_0xc652('0x29')];if(_0x58e15a['query'][_0xc652('0x3b')]){_0x242aca[_0xc652('0x41')]=[{'all':!![]}];}_0x242aca=_[_0xc652('0x39')]({},_0x242aca,_0x58e15a[_0xc652('0x42')]);return db['Campaign'][_0xc652('0x43')](_0x242aca)[_0xc652('0x23')](handleEntityNotFound(_0x17c163,null))[_0xc652('0x23')](respondWithResult(_0x17c163,null))[_0xc652('0x3e')](handleError(_0x17c163,null));};exports[_0xc652('0x44')]=function(_0x5bf3dd,_0x4deca7){return db[_0xc652('0x3a')][_0xc652('0x44')](_0x5bf3dd[_0xc652('0x45')],{})[_0xc652('0x23')](function(_0x3ca55e){var _0x1e44bd=_0x5bf3dd['user']['get']({'plain':!![]});if(!_0x1e44bd)throw new Error(_0xc652('0x46'));if(_0x1e44bd[_0xc652('0x47')]===_0xc652('0x48')){var _0x579493=_0x3ca55e['get']({'plain':!![]});var _0x182452=_0xc652('0x49');return db[_0xc652('0x4a')][_0xc652('0x43')]({'where':{'name':_0x182452,'userProfileId':_0x1e44bd[_0xc652('0x4b')]},'raw':!![]})[_0xc652('0x23')](function(_0x5cca15){if(_0x5cca15&&_0x5cca15[_0xc652('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x579493[_0xc652('0x2a')],'resourceId':_0x579493['id'],'type':_0x5cca15[_0xc652('0x2a')],'sectionId':_0x5cca15['id']},{})[_0xc652('0x23')](function(){return _0x3ca55e;});}else{return _0x3ca55e;}})[_0xc652('0x3e')](function(_0x4abf64){logger[_0xc652('0x4d')](_0xc652('0x4e'),_0x4abf64);throw _0x4abf64;});}return _0x3ca55e;})['then'](respondWithResult(_0x4deca7,0xc9))[_0xc652('0x3e')](handleError(_0x4deca7,null));};exports[_0xc652('0x4f')]=function(_0x3ca984,_0x1376ac){var _0x58e61e={'where':{'id':_0x3ca984[_0xc652('0x50')]['id']}},_0xfbede7={};_0xfbede7[_0xc652('0x29')]=_['keys'](db[_0xc652('0x3a')][_0xc652('0x27')]);_0x58e61e['attributes']=_[_0xc652('0x2d')](_0xfbede7[_0xc652('0x29')],qs['fields'](_0x3ca984['query'][_0xc652('0x2f')]));_0x58e61e[_0xc652('0x2e')]=_0x58e61e[_0xc652('0x2e')][_0xc652('0x30')]?_0x58e61e[_0xc652('0x2e')]:_0xfbede7[_0xc652('0x29')];if(_0x3ca984[_0xc652('0x2b')]['includeAll']){_0x58e61e[_0xc652('0x41')]=[{'all':!![]}];}_0x58e61e=_[_0xc652('0x39')]({},_0x58e61e,_0x3ca984['options']);return db['Campaign'][_0xc652('0x43')](_0x58e61e)[_0xc652('0x23')](handleEntityNotFound(_0x1376ac,null))['then'](function(_0x4f90f1){if(_0x4f90f1){var _0x526e18=_0x4f90f1[_0xc652('0x51')]({'plain':!![]});_0x526e18=qs[_0xc652('0x52')](_0x526e18,['id',_0xc652('0x53'),_0xc652('0x54')]);_0x3ca984[_0xc652('0x45')]=_[_0xc652('0x52')](_0x3ca984[_0xc652('0x45')],['id',_0xc652('0x53'),'updatedAt']);return db[_0xc652('0x3a')][_0xc652('0x44')](_[_0xc652('0x39')](_0x526e18,_0x3ca984[_0xc652('0x45')]),{'include':_0x3ca984[_0xc652('0x2b')][_0xc652('0x3b')]?[{'all':!![]}]:undefined})[_0xc652('0x23')](function(_0xc30504){var _0x59a0a5=_0x3ca984['user'][_0xc652('0x51')]({'plain':!![]});if(!_0x59a0a5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59a0a5[_0xc652('0x47')]==='user'){var _0x4317d4=_0xc30504[_0xc652('0x51')]({'plain':!![]});var _0x580d12=_0xc652('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x580d12,'userProfileId':_0x59a0a5[_0xc652('0x4b')]},'raw':!![]})[_0xc652('0x23')](function(_0x48e910){if(_0x48e910&&_0x48e910['autoAssociation']===0x0){return db['UserProfileResource'][_0xc652('0x44')]({'name':_0x4317d4[_0xc652('0x2a')],'resourceId':_0x4317d4['id'],'type':_0x48e910[_0xc652('0x2a')],'sectionId':_0x48e910['id']},{})[_0xc652('0x23')](function(){return _0xc30504;});}else{return _0xc30504;}})['catch'](function(_0x41d347){logger[_0xc652('0x4d')](_0xc652('0x4e'),_0x41d347);throw _0x41d347;});}return _0xc30504;});}})[_0xc652('0x23')](respondWithResult(_0x1376ac,0xc9))['catch'](handleError(_0x1376ac,null));};exports[_0xc652('0x22')]=function(_0x32f224,_0xfe7ab7){if(_0x32f224[_0xc652('0x45')]['id']){delete _0x32f224['body']['id'];}return db[_0xc652('0x3a')][_0xc652('0x43')]({'where':{'id':_0x32f224[_0xc652('0x50')]['id']}})['then'](handleEntityNotFound(_0xfe7ab7,null))[_0xc652('0x23')](saveUpdates(_0x32f224[_0xc652('0x45')],null))[_0xc652('0x23')](respondWithResult(_0xfe7ab7,null))[_0xc652('0x3e')](handleError(_0xfe7ab7,null));};exports[_0xc652('0x55')]=function(_0x554906,_0x3e33e4){return db[_0xc652('0x3a')][_0xc652('0x43')]({'where':{'id':_0x554906[_0xc652('0x50')]['id']}})[_0xc652('0x23')](handleEntityNotFound(_0x3e33e4,null))[_0xc652('0x23')](removeEntity(_0x3e33e4,null))[_0xc652('0x3e')](handleError(_0x3e33e4,null));};exports[_0xc652('0x56')]=function(_0x40dd32,_0x10ef19,_0xa51526){var _0x101b1a={'raw':!![],'where':{}};var _0x5490d2={};var _0x22668f={'count':0x0,'rows':[]};return db[_0xc652('0x3a')][_0xc652('0x57')]({'where':{'id':_0x40dd32[_0xc652('0x50')]['id']}})[_0xc652('0x23')](handleEntityNotFound(_0x10ef19,null))['then'](function(_0x189beb){if(_0x189beb){_0x5490d2[_0xc652('0x29')]=_[_0xc652('0x40')](db['CmHopper'][_0xc652('0x27')]);_0x5490d2[_0xc652('0x2b')]=_[_0xc652('0x40')](_0x40dd32[_0xc652('0x2b')]);_0x5490d2[_0xc652('0x2c')]=_[_0xc652('0x2d')](_0x5490d2['model'],_0x5490d2['query']);_0x101b1a[_0xc652('0x2e')]=_[_0xc652('0x2d')](_0x5490d2[_0xc652('0x29')],qs['fields'](_0x40dd32['query'][_0xc652('0x2f')]));_0x101b1a[_0xc652('0x2e')]=_0x101b1a[_0xc652('0x2e')][_0xc652('0x30')]?_0x101b1a[_0xc652('0x2e')]:_0x5490d2[_0xc652('0x29')];if(!_0x40dd32[_0xc652('0x2b')][_0xc652('0x58')](_0xc652('0x31'))){_0x101b1a[_0xc652('0x1d')]=qs[_0xc652('0x1d')](_0x40dd32[_0xc652('0x2b')]['limit']);_0x101b1a['offset']=qs['offset'](_0x40dd32[_0xc652('0x2b')][_0xc652('0x1b')]);}_0x101b1a[_0xc652('0x32')]=qs['sort'](_0x40dd32[_0xc652('0x2b')]['sort']);_0x101b1a[_0xc652('0x34')]=qs[_0xc652('0x2c')](_[_0xc652('0x35')](_0x40dd32[_0xc652('0x2b')],_0x5490d2[_0xc652('0x2c')]));_0x101b1a[_0xc652('0x34')]['CampaignId']=_0x189beb['id'];if(_0x40dd32[_0xc652('0x2b')][_0xc652('0x36')]){_0x101b1a[_0xc652('0x34')]=_['merge'](_0x101b1a[_0xc652('0x34')],{'$or':_[_0xc652('0x26')](_0x101b1a[_0xc652('0x2e')],function(_0x2905d1){var _0x43418d={};_0x43418d[_0x2905d1]={'$like':'%'+_0x40dd32[_0xc652('0x2b')][_0xc652('0x36')]+'%'};return _0x43418d;})});}_0x101b1a=_[_0xc652('0x39')]({},_0x101b1a,_0x40dd32[_0xc652('0x42')]);return db[_0xc652('0x59')]['count']({'where':_0x101b1a[_0xc652('0x34')]})[_0xc652('0x23')](function(_0x45a6aa){_0x22668f[_0xc652('0x1e')]=_0x45a6aa;if(_0x40dd32['query'][_0xc652('0x3b')]){_0x101b1a[_0xc652('0x41')]=[{'all':!![]}];}return db['CmHopper'][_0xc652('0x3c')](_0x101b1a);})[_0xc652('0x23')](function(_0xcf1c7e){_0x22668f['rows']=_0xcf1c7e;return _0x22668f;});}})['then'](respondWithFilteredResult(_0x10ef19,_0x101b1a))[_0xc652('0x3e')](handleError(_0x10ef19,null));};exports['getHopperHistories']=function(_0x5883f3,_0xdfffa8,_0x41c871){var _0x57f39c={'raw':!![],'where':{}};var _0x155e7c={};var _0xe4207a={'count':0x0,'rows':[]};return db['Campaign'][_0xc652('0x57')]({'where':{'id':_0x5883f3[_0xc652('0x50')]['id']}})[_0xc652('0x23')](handleEntityNotFound(_0xdfffa8,null))['then'](function(_0x23f17f){if(_0x23f17f){_0x155e7c[_0xc652('0x29')]=_[_0xc652('0x40')](db[_0xc652('0x5a')][_0xc652('0x27')]);_0x155e7c[_0xc652('0x2b')]=_[_0xc652('0x40')](_0x5883f3['query']);_0x155e7c[_0xc652('0x2c')]=_[_0xc652('0x2d')](_0x155e7c[_0xc652('0x29')],_0x155e7c[_0xc652('0x2b')]);_0x57f39c['attributes']=_[_0xc652('0x2d')](_0x155e7c[_0xc652('0x29')],qs[_0xc652('0x2f')](_0x5883f3['query']['fields']));_0x57f39c[_0xc652('0x2e')]=_0x57f39c[_0xc652('0x2e')]['length']?_0x57f39c[_0xc652('0x2e')]:_0x155e7c[_0xc652('0x29')];if(!_0x5883f3[_0xc652('0x2b')][_0xc652('0x58')]('nolimit')){_0x57f39c['limit']=qs[_0xc652('0x1d')](_0x5883f3[_0xc652('0x2b')]['limit']);_0x57f39c[_0xc652('0x1b')]=qs[_0xc652('0x1b')](_0x5883f3['query']['offset']);}_0x57f39c['order']=qs[_0xc652('0x33')](_0x5883f3[_0xc652('0x2b')]['sort']);_0x57f39c[_0xc652('0x34')]=qs[_0xc652('0x2c')](_[_0xc652('0x35')](_0x5883f3[_0xc652('0x2b')],_0x155e7c[_0xc652('0x2c')]));_0x57f39c['where'][_0xc652('0x5b')]=_0x23f17f['id'];if(_0x5883f3[_0xc652('0x2b')][_0xc652('0x36')]){_0x57f39c[_0xc652('0x34')]=_[_0xc652('0x39')](_0x57f39c[_0xc652('0x34')],{'$or':_[_0xc652('0x26')](_0x57f39c[_0xc652('0x2e')],function(_0x3cd4d3){var _0x2dc5df={};_0x2dc5df[_0x3cd4d3]={'$like':'%'+_0x5883f3[_0xc652('0x2b')][_0xc652('0x36')]+'%'};return _0x2dc5df;})});}_0x57f39c=_['merge']({},_0x57f39c,_0x5883f3[_0xc652('0x42')]);return db['CmHopperHistory']['count']({'where':_0x57f39c[_0xc652('0x34')]})[_0xc652('0x23')](function(_0x3636bb){_0xe4207a[_0xc652('0x1e')]=_0x3636bb;if(_0x5883f3[_0xc652('0x2b')][_0xc652('0x3b')]){_0x57f39c[_0xc652('0x41')]=[{'all':!![]}];}return db[_0xc652('0x5a')][_0xc652('0x3c')](_0x57f39c);})[_0xc652('0x23')](function(_0x466e69){_0xe4207a[_0xc652('0x3d')]=_0x466e69;return _0xe4207a;});}})[_0xc652('0x23')](respondWithFilteredResult(_0xdfffa8,_0x57f39c))[_0xc652('0x3e')](handleError(_0xdfffa8,null));};exports['getHopperFinals']=function(_0x5811c9,_0x5805e9,_0x17413e){var _0x4b9a51={'raw':!![],'where':{}};var _0x5405c0={};var _0x3d6e4={'count':0x0,'rows':[]};return db[_0xc652('0x3a')][_0xc652('0x57')]({'where':{'id':_0x5811c9[_0xc652('0x50')]['id']}})[_0xc652('0x23')](handleEntityNotFound(_0x5805e9,null))[_0xc652('0x23')](function(_0x1a368d){if(_0x1a368d){_0x5405c0[_0xc652('0x29')]=_['keys'](db[_0xc652('0x5c')][_0xc652('0x27')]);_0x5405c0['query']=_[_0xc652('0x40')](_0x5811c9['query']);_0x5405c0[_0xc652('0x2c')]=_['intersection'](_0x5405c0['model'],_0x5405c0[_0xc652('0x2b')]);_0x4b9a51[_0xc652('0x2e')]=_['intersection'](_0x5405c0['model'],qs[_0xc652('0x2f')](_0x5811c9[_0xc652('0x2b')][_0xc652('0x2f')]));_0x4b9a51[_0xc652('0x2e')]=_0x4b9a51[_0xc652('0x2e')][_0xc652('0x30')]?_0x4b9a51[_0xc652('0x2e')]:_0x5405c0[_0xc652('0x29')];if(!_0x5811c9['query'][_0xc652('0x58')]('nolimit')){_0x4b9a51[_0xc652('0x1d')]=qs[_0xc652('0x1d')](_0x5811c9[_0xc652('0x2b')][_0xc652('0x1d')]);_0x4b9a51[_0xc652('0x1b')]=qs[_0xc652('0x1b')](_0x5811c9[_0xc652('0x2b')][_0xc652('0x1b')]);}_0x4b9a51[_0xc652('0x32')]=qs[_0xc652('0x33')](_0x5811c9[_0xc652('0x2b')][_0xc652('0x33')]);_0x4b9a51[_0xc652('0x34')]=qs[_0xc652('0x2c')](_[_0xc652('0x35')](_0x5811c9['query'],_0x5405c0['filters']));_0x4b9a51[_0xc652('0x34')]['CampaignId']=_0x1a368d['id'];if(_0x5811c9[_0xc652('0x2b')]['filter']){_0x4b9a51[_0xc652('0x34')]=_['merge'](_0x4b9a51['where'],{'$or':_[_0xc652('0x26')](_0x4b9a51['attributes'],function(_0x3e7cbb){var _0xbd9e16={};_0xbd9e16[_0x3e7cbb]={'$like':'%'+_0x5811c9[_0xc652('0x2b')]['filter']+'%'};return _0xbd9e16;})});}_0x4b9a51=_[_0xc652('0x39')]({},_0x4b9a51,_0x5811c9[_0xc652('0x42')]);return db['CmHopperFinal'][_0xc652('0x1e')]({'where':_0x4b9a51[_0xc652('0x34')]})[_0xc652('0x23')](function(_0x390acb){_0x3d6e4[_0xc652('0x1e')]=_0x390acb;if(_0x5811c9['query'][_0xc652('0x3b')]){_0x4b9a51[_0xc652('0x41')]=[{'all':!![]}];}return db[_0xc652('0x5c')][_0xc652('0x3c')](_0x4b9a51);})[_0xc652('0x23')](function(_0x3c70b2){_0x3d6e4[_0xc652('0x3d')]=_0x3c70b2;return _0x3d6e4;});}})[_0xc652('0x23')](respondWithFilteredResult(_0x5805e9,_0x4b9a51))['catch'](handleError(_0x5805e9,null));};exports[_0xc652('0x5d')]=function(_0x5d8564,_0x1f9477,_0x34bcda){var _0x5f4a87={'raw':!![],'where':{}};var _0x393488={};var _0xdf55a9={'count':0x0,'rows':[]};return db[_0xc652('0x3a')][_0xc652('0x57')]({'where':{'id':_0x5d8564[_0xc652('0x50')]['id']}})[_0xc652('0x23')](handleEntityNotFound(_0x1f9477,null))[_0xc652('0x23')](function(_0x1cebc6){if(_0x1cebc6){_0x393488['model']=_[_0xc652('0x40')](db[_0xc652('0x5e')][_0xc652('0x27')]);_0x393488[_0xc652('0x2b')]=_[_0xc652('0x40')](_0x5d8564['query']);_0x393488[_0xc652('0x2c')]=_[_0xc652('0x2d')](_0x393488[_0xc652('0x29')],_0x393488[_0xc652('0x2b')]);_0x5f4a87['attributes']=_[_0xc652('0x2d')](_0x393488[_0xc652('0x29')],qs[_0xc652('0x2f')](_0x5d8564[_0xc652('0x2b')][_0xc652('0x2f')]));_0x5f4a87[_0xc652('0x2e')]=_0x5f4a87[_0xc652('0x2e')]['length']?_0x5f4a87[_0xc652('0x2e')]:_0x393488[_0xc652('0x29')];if(!_0x5d8564[_0xc652('0x2b')][_0xc652('0x58')]('nolimit')){_0x5f4a87['limit']=qs[_0xc652('0x1d')](_0x5d8564['query']['limit']);_0x5f4a87['offset']=qs[_0xc652('0x1b')](_0x5d8564['query'][_0xc652('0x1b')]);}_0x5f4a87[_0xc652('0x32')]=qs['sort'](_0x5d8564[_0xc652('0x2b')][_0xc652('0x33')]);_0x5f4a87[_0xc652('0x34')]=qs[_0xc652('0x2c')](_[_0xc652('0x35')](_0x5d8564['query'],_0x393488['filters']));_0x5f4a87[_0xc652('0x34')][_0xc652('0x5b')]=_0x1cebc6['id'];if(_0x5d8564[_0xc652('0x2b')]['filter']){_0x5f4a87[_0xc652('0x34')]=_['merge'](_0x5f4a87['where'],{'$or':_['map'](_0x5f4a87['attributes'],function(_0x2403cc){var _0x3fabca={};_0x3fabca[_0x2403cc]={'$like':'%'+_0x5d8564['query'][_0xc652('0x36')]+'%'};return _0x3fabca;})});}_0x5f4a87=_['merge']({},_0x5f4a87,_0x5d8564[_0xc652('0x42')]);return db[_0xc652('0x5e')][_0xc652('0x1e')]({'where':_0x5f4a87[_0xc652('0x34')]})[_0xc652('0x23')](function(_0x2fb386){_0xdf55a9[_0xc652('0x1e')]=_0x2fb386;if(_0x5d8564[_0xc652('0x2b')]['includeAll']){_0x5f4a87[_0xc652('0x41')]=[{'all':!![]}];}return db[_0xc652('0x5e')][_0xc652('0x3c')](_0x5f4a87);})['then'](function(_0x382307){_0xdf55a9[_0xc652('0x3d')]=_0x382307;return _0xdf55a9;});}})[_0xc652('0x23')](respondWithFilteredResult(_0x1f9477,_0x5f4a87))[_0xc652('0x3e')](handleError(_0x1f9477,null));};exports['getLists']=function(_0x2899d7,_0x5dd524,_0x47c5ac){var _0x11b840={};var _0x3c559f={};var _0x5932be;var _0x4f2c0c;return db['Campaign'][_0xc652('0x57')]({'where':{'id':_0x2899d7[_0xc652('0x50')]['id']}})[_0xc652('0x23')](handleEntityNotFound(_0x5dd524,null))[_0xc652('0x23')](function(_0x166462){if(_0x166462){_0x5932be=_0x166462;_0x3c559f[_0xc652('0x29')]=_[_0xc652('0x40')](db[_0xc652('0x5f')][_0xc652('0x27')]);_0x3c559f[_0xc652('0x2b')]=_[_0xc652('0x40')](_0x2899d7['query']);_0x3c559f[_0xc652('0x2c')]=_[_0xc652('0x2d')](_0x3c559f[_0xc652('0x29')],_0x3c559f[_0xc652('0x2b')]);_0x11b840[_0xc652('0x2e')]=_[_0xc652('0x2d')](_0x3c559f[_0xc652('0x29')],qs[_0xc652('0x2f')](_0x2899d7[_0xc652('0x2b')][_0xc652('0x2f')]));_0x11b840[_0xc652('0x2e')]=_0x11b840[_0xc652('0x2e')][_0xc652('0x30')]?_0x11b840['attributes']:_0x3c559f[_0xc652('0x29')];_0x11b840[_0xc652('0x32')]=qs[_0xc652('0x33')](_0x2899d7['query']['sort']);_0x11b840[_0xc652('0x34')]=qs['filters'](_['pick'](_0x2899d7['query'],_0x3c559f[_0xc652('0x2c')]));if(_0x2899d7[_0xc652('0x2b')][_0xc652('0x36')]){_0x11b840[_0xc652('0x34')]=_['merge'](_0x11b840[_0xc652('0x34')],{'$or':_[_0xc652('0x26')](_0x11b840[_0xc652('0x2e')],function(_0x2e7d5c){var _0x4fd882={};_0x4fd882[_0x2e7d5c]={'$like':'%'+_0x2899d7[_0xc652('0x2b')][_0xc652('0x36')]+'%'};return _0x4fd882;})});}_0x11b840=_['merge']({},_0x11b840,_0x2899d7[_0xc652('0x42')]);return _0x5932be[_0xc652('0x60')](_0x11b840);}})[_0xc652('0x23')](function(_0x2808d7){if(_0x2808d7){_0x4f2c0c=_0x2808d7[_0xc652('0x30')];if(!_0x2899d7['query'][_0xc652('0x58')](_0xc652('0x31'))){_0x11b840[_0xc652('0x1d')]=qs['limit'](_0x2899d7[_0xc652('0x2b')][_0xc652('0x1d')]);_0x11b840[_0xc652('0x1b')]=qs['offset'](_0x2899d7[_0xc652('0x2b')][_0xc652('0x1b')]);}return _0x5932be[_0xc652('0x60')](_0x11b840);}})[_0xc652('0x23')](function(_0x351327){if(_0x351327){return _0x351327?{'count':_0x4f2c0c,'rows':_0x351327}:null;}})[_0xc652('0x23')](respondWithResult(_0x5dd524,null))['catch'](handleError(_0x5dd524,null));};exports['addLists']=function(_0x50f399,_0x2b63ec,_0x1e3622){var _0x344530,_0x11d099;return db[_0xc652('0x3a')][_0xc652('0x43')]({'where':{'id':_0x50f399['params']['id']}})[_0xc652('0x23')](handleEntityNotFound(_0x2b63ec,null))[_0xc652('0x23')](function(_0x1e0bae){if(_0x1e0bae){_0x11d099=_0x1e0bae;return _0x1e0bae['addLists'](_0x50f399['body']['ids'],_['omit'](_0x50f399[_0xc652('0x45')],[_0xc652('0x61'),'id'])||{});}return null;})['spread'](function(_0x3b7092){var _0x54d6da;_0x344530=_0x3b7092||[];var _0x1a119a=[];if(_0x3b7092){for(var _0x443a03=0x0;_0x443a03<_0x3b7092[_0xc652('0x30')];_0x443a03+=0x1){var _0x1789c3=_0x3b7092[_0x443a03][_0xc652('0x51')]({'plain':!![]});_0x11d099['dialCheckDuplicateType']=_0x50f399[_0xc652('0x45')]['dialCheckDuplicateType']?_0x50f399[_0xc652('0x45')][_0xc652('0x62')]:_0x11d099[_0xc652('0x62')];switch(_0x11d099[_0xc652('0x62')]){case _0xc652('0x63'):_0x54d6da=squel['insert']()['into'](_0xc652('0x64'))[_0xc652('0x65')](['phone',_0xc652('0x66'),_0xc652('0x67'),_0xc652('0x68'),'CampaignId',_0xc652('0x53'),_0xc652('0x54')],squel['select']()['field'](_0xc652('0x69'),_0xc652('0x69'))['field']('NOW()',_0xc652('0x66'))[_0xc652('0x6a')]('id',_0xc652('0x67'))['field'](_0x1789c3[_0xc652('0x6b')][_0xc652('0x6c')](),_0xc652('0x68'))[_0xc652('0x6a')](_0x50f399['params']['id'][_0xc652('0x6c')](),'CampaignId')['field']('NOW()',_0xc652('0x53'))[_0xc652('0x6a')](_0xc652('0x6d'),_0xc652('0x54'))[_0xc652('0x6e')](_0xc652('0x6f'))['where'](_0xc652('0x70'))['where'](_0xc652('0x71'),_0x1789c3[_0xc652('0x6b')]['toString']())[_0xc652('0x34')](_0xc652('0x72'))['where'](_0xc652('0x73'),squel['select']()[_0xc652('0x6a')]('COALESCE(calleridnum,\x27\x27)')[_0xc652('0x6e')](_0xc652('0x74'))[_0xc652('0x34')]('CampaignId\x20=\x20?',_0x50f399['params']['id'][_0xc652('0x6c')]()))[_0xc652('0x34')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xc652('0x6e')](_0xc652('0x64'))[_0xc652('0x34')]('CampaignId\x20=\x20?',_0x50f399['params']['id'][_0xc652('0x6c')]())))[_0xc652('0x6c')]();break;case _0xc652('0x75'):_0x54d6da=squel[_0xc652('0x76')]()[_0xc652('0x77')]('cm_hopper')['fromQuery']([_0xc652('0x69'),_0xc652('0x66'),_0xc652('0x67'),_0xc652('0x68'),_0xc652('0x5b'),_0xc652('0x53'),'updatedAt'],squel[_0xc652('0x78')]()[_0xc652('0x6a')](_0xc652('0x69'),_0xc652('0x69'))[_0xc652('0x6a')](_0xc652('0x6d'),'scheduledAt')[_0xc652('0x6a')]('id',_0xc652('0x67'))[_0xc652('0x6a')](_0x1789c3[_0xc652('0x6b')]['toString'](),_0xc652('0x68'))['field'](_0x50f399[_0xc652('0x50')]['id'][_0xc652('0x6c')](),_0xc652('0x5b'))[_0xc652('0x6a')](_0xc652('0x6d'),_0xc652('0x53'))['field'](_0xc652('0x6d'),_0xc652('0x54'))[_0xc652('0x6e')](_0xc652('0x6f'))[_0xc652('0x34')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x1789c3[_0xc652('0x6b')]['toString']())[_0xc652('0x34')](_0xc652('0x72'))[_0xc652('0x34')](_0xc652('0x73'),squel[_0xc652('0x78')]()[_0xc652('0x6a')]('COALESCE(phone,\x27\x27)')[_0xc652('0x6e')]('cm_hopper')[_0xc652('0x34')](_0xc652('0x79'),_0x50f399[_0xc652('0x50')]['id']['toString']())))['toString']();break;default:_0x54d6da=squel[_0xc652('0x76')]()[_0xc652('0x77')](_0xc652('0x64'))[_0xc652('0x65')](['phone',_0xc652('0x66'),'ContactId',_0xc652('0x68'),_0xc652('0x5b'),_0xc652('0x53'),_0xc652('0x54')],squel['select']()[_0xc652('0x6a')](_0xc652('0x69'),_0xc652('0x69'))[_0xc652('0x6a')](_0xc652('0x6d'),'scheduledAt')['field']('id',_0xc652('0x67'))['field'](_0x1789c3[_0xc652('0x6b')]['toString'](),_0xc652('0x68'))[_0xc652('0x6a')](_0x50f399['params']['id'][_0xc652('0x6c')](),_0xc652('0x5b'))[_0xc652('0x6a')](_0xc652('0x6d'),'createdAt')[_0xc652('0x6a')](_0xc652('0x6d'),'updatedAt')[_0xc652('0x6e')]('cm_contacts')[_0xc652('0x34')](_0xc652('0x70'))['where'](_0xc652('0x71'),_0x1789c3['CmListId']['toString']())[_0xc652('0x34')]('phone\x20IS\x20NOT\x20NULL'))[_0xc652('0x6c')]();}_0x1a119a[_0xc652('0x7a')](db[_0xc652('0x7b')][_0xc652('0x2b')](_0x54d6da));}return BPromise[_0xc652('0x7c')](_0x1a119a);}})[_0xc652('0x23')](function(){return _0x344530;})[_0xc652('0x23')](respondWithResult(_0x2b63ec,null))['catch'](handleError(_0x2b63ec,null));};exports[_0xc652('0x7d')]=function(_0x5bf785,_0x404a18,_0x5c818d){return db[_0xc652('0x3a')][_0xc652('0x43')]({'where':{'id':_0x5bf785[_0xc652('0x50')]['id']}})[_0xc652('0x23')](handleEntityNotFound(_0x404a18,null))[_0xc652('0x23')](function(_0x2c353d){if(_0x2c353d){return _0x2c353d['removeLists'](_0x5bf785['query']['ids']);}})[_0xc652('0x23')](function(_0x22894f){if(_0x22894f){return db[_0xc652('0x59')][_0xc652('0x55')]({'where':{'ListId':_0x5bf785['query'][_0xc652('0x61')],'CampaignId':_0x5bf785['params']['id']}})[_0xc652('0x23')](function(){return _0x22894f;});}})['then'](respondWithStatusCode(_0x404a18,null))[_0xc652('0x3e')](handleError(_0x404a18,null));};exports[_0xc652('0x7e')]=function(_0x2de5d0,_0x13cbaa,_0x16021d){var _0x54d82c={};var _0x4cff60={};var _0x44c1e0;var _0x844e4c;return db[_0xc652('0x3a')]['findOne']({'where':{'id':_0x2de5d0[_0xc652('0x50')]['id']}})['then'](handleEntityNotFound(_0x13cbaa,null))[_0xc652('0x23')](function(_0x2de91c){if(_0x2de91c){_0x44c1e0=_0x2de91c;_0x4cff60[_0xc652('0x29')]=_[_0xc652('0x40')](db[_0xc652('0x5f')][_0xc652('0x27')]);_0x4cff60[_0xc652('0x2b')]=_[_0xc652('0x40')](_0x2de5d0[_0xc652('0x2b')]);_0x4cff60[_0xc652('0x2c')]=_['intersection'](_0x4cff60[_0xc652('0x29')],_0x4cff60['query']);_0x54d82c[_0xc652('0x2e')]=_['intersection'](_0x4cff60[_0xc652('0x29')],qs[_0xc652('0x2f')](_0x2de5d0[_0xc652('0x2b')][_0xc652('0x2f')]));_0x54d82c['attributes']=_0x54d82c['attributes'][_0xc652('0x30')]?_0x54d82c['attributes']:_0x4cff60[_0xc652('0x29')];_0x54d82c[_0xc652('0x32')]=qs[_0xc652('0x33')](_0x2de5d0[_0xc652('0x2b')]['sort']);_0x54d82c[_0xc652('0x34')]=qs[_0xc652('0x2c')](_[_0xc652('0x35')](_0x2de5d0['query'],_0x4cff60['filters']));if(_0x2de5d0[_0xc652('0x2b')]['filter']){_0x54d82c[_0xc652('0x34')]=_[_0xc652('0x39')](_0x54d82c[_0xc652('0x34')],{'$or':_[_0xc652('0x26')](_0x54d82c['attributes'],function(_0x4d5dee){var _0x5cd41c={};_0x5cd41c[_0x4d5dee]={'$like':'%'+_0x2de5d0[_0xc652('0x2b')][_0xc652('0x36')]+'%'};return _0x5cd41c;})});}_0x54d82c=_[_0xc652('0x39')]({},_0x54d82c,_0x2de5d0[_0xc652('0x42')]);return _0x44c1e0[_0xc652('0x7e')](_0x54d82c);}})[_0xc652('0x23')](function(_0x1e403c){if(_0x1e403c){_0x844e4c=_0x1e403c['length'];if(!_0x2de5d0[_0xc652('0x2b')]['hasOwnProperty']('nolimit')){_0x54d82c[_0xc652('0x1d')]=qs['limit'](_0x2de5d0['query'][_0xc652('0x1d')]);_0x54d82c[_0xc652('0x1b')]=qs[_0xc652('0x1b')](_0x2de5d0[_0xc652('0x2b')]['offset']);}return _0x44c1e0[_0xc652('0x7e')](_0x54d82c);}})[_0xc652('0x23')](function(_0x1fdf5d){if(_0x1fdf5d){return _0x1fdf5d?{'count':_0x844e4c,'rows':_0x1fdf5d}:null;}})[_0xc652('0x23')](respondWithResult(_0x13cbaa,null))['catch'](handleError(_0x13cbaa,null));};exports[_0xc652('0x7f')]=function(_0x41b865,_0x349b25,_0x44a396){var _0xc38b40,_0x38c82a;return db['Campaign'][_0xc652('0x43')]({'where':{'id':_0x41b865[_0xc652('0x50')]['id']}})[_0xc652('0x23')](handleEntityNotFound(_0x349b25,null))['then'](function(_0x3f70c5){if(_0x3f70c5){_0x38c82a=_0x3f70c5;return _0x3f70c5[_0xc652('0x7f')](_0x41b865[_0xc652('0x45')][_0xc652('0x61')],_[_0xc652('0x52')](_0x41b865[_0xc652('0x45')],[_0xc652('0x61'),'id'])||{});}return null;})['spread'](function(_0xfa6719){var _0x42ea69;_0xc38b40=_0xfa6719||[];var _0x1cf82a=[];if(_0xfa6719){for(var _0x1f22f9=0x0;_0x1f22f9<_0xfa6719[_0xc652('0x30')];_0x1f22f9+=0x1){var _0x54b55c=_0xfa6719[_0x1f22f9]['get']({'plain':!![]});_0x42ea69=squel[_0xc652('0x76')]()[_0xc652('0x77')]('cm_hopper_black')[_0xc652('0x65')]([_0xc652('0x69'),'ContactId',_0xc652('0x68'),_0xc652('0x5b'),_0xc652('0x53'),_0xc652('0x54')],squel['select']()[_0xc652('0x6a')](_0xc652('0x69'),'phone')['field']('id',_0xc652('0x67'))[_0xc652('0x6a')](_0x54b55c[_0xc652('0x6b')][_0xc652('0x6c')](),_0xc652('0x68'))[_0xc652('0x6a')](_0x41b865['params']['id'][_0xc652('0x6c')](),_0xc652('0x5b'))['field'](_0xc652('0x6d'),'createdAt')['field'](_0xc652('0x6d'),_0xc652('0x54'))[_0xc652('0x6e')](_0xc652('0x6f'))['where'](_0xc652('0x70'))[_0xc652('0x34')](_0xc652('0x71'),_0x54b55c[_0xc652('0x6b')][_0xc652('0x6c')]())[_0xc652('0x34')](_0xc652('0x72')))[_0xc652('0x6c')]();_0x1cf82a[_0xc652('0x7a')](db[_0xc652('0x7b')]['query'](_0x42ea69));}return BPromise[_0xc652('0x7c')](_0x1cf82a);}})['then'](function(){return _0xc38b40;})['then'](respondWithResult(_0x349b25,null))[_0xc652('0x3e')](handleError(_0x349b25,null));};exports['removeBlackLists']=function(_0x461bcf,_0x4abc09,_0x1e1e58){return db[_0xc652('0x3a')][_0xc652('0x43')]({'where':{'id':_0x461bcf[_0xc652('0x50')]['id']}})[_0xc652('0x23')](handleEntityNotFound(_0x4abc09,null))[_0xc652('0x23')](function(_0x275a74){if(_0x275a74){return _0x275a74[_0xc652('0x80')](_0x461bcf['query'][_0xc652('0x61')]);}})[_0xc652('0x23')](function(_0xf2b848){if(_0xf2b848){return db[_0xc652('0x5e')][_0xc652('0x55')]({'where':{'ListId':_0x461bcf[_0xc652('0x2b')][_0xc652('0x61')],'CampaignId':_0x461bcf['params']['id']}})[_0xc652('0x23')](function(){return _0xf2b848;});}})[_0xc652('0x23')](respondWithStatusCode(_0x4abc09,null))[_0xc652('0x3e')](handleError(_0x4abc09,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 0f81d95..b2df83c 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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x28c4db,_0x2ccd05){var _0x5907ed=function(_0x1d83c2){while(--_0x1d83c2){_0x28c4db['push'](_0x28c4db['shift']());}};_0x5907ed(++_0x2ccd05);}(_0x7a54,0x106));var _0x47a5=function(_0x5a4e65,_0x247189){_0x5a4e65=_0x5a4e65-0x0;var _0x48ff6e=_0x7a54[_0x5a4e65];return _0x48ff6e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_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 logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 1dcacca..9fa334a 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 _0x342e=['result','catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x11d8bf,_0x266e51){var _0x26009c=function(_0x2b8f80){while(--_0x2b8f80){_0x11d8bf['push'](_0x11d8bf['shift']());}};_0x26009c(++_0x266e51);}(_0x342e,0xde));var _0xe342=function(_0x30f5bb,_0x4db4bd){_0x30f5bb=_0x30f5bb-0x0;var _0x1cfc00=_0x342e[_0x30f5bb];return _0x1cfc00;};'use strict';var _=require(_0xe342('0x0'));var util=require(_0xe342('0x1'));var moment=require(_0xe342('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe342('0x3'));var db=require(_0xe342('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe342('0x5'));var config=require(_0xe342('0x6'));var jayson=require(_0xe342('0x7'));var client=jayson[_0xe342('0x8')][_0xe342('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e643a,_0x57895b,_0x3457ac){return new BPromise(function(_0x36bb18,_0x54868d){return client['request'](_0x5e643a,_0x3457ac)[_0xe342('0xa')](function(_0x2b2e82){logger[_0xe342('0xb')](_0xe342('0xc'),_0x57895b,_0xe342('0xd'));logger[_0xe342('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0x57895b,_0xe342('0xd'),JSON[_0xe342('0xf')](_0x2b2e82));if(_0x2b2e82[_0xe342('0x10')]){if(_0x2b2e82[_0xe342('0x10')]['code']===0x1f4){logger[_0xe342('0x10')]('Campaign,\x20%s,\x20%s',_0x57895b,_0x2b2e82[_0xe342('0x10')][_0xe342('0x11')]);return _0x54868d(_0x2b2e82[_0xe342('0x10')][_0xe342('0x11')]);}logger['error'](_0xe342('0xc'),_0x57895b,_0x2b2e82[_0xe342('0x10')]['message']);return _0x36bb18(_0x2b2e82[_0xe342('0x10')][_0xe342('0x11')]);}else{logger[_0xe342('0xb')](_0xe342('0xc'),_0x57895b,_0xe342('0xd'));_0x36bb18(_0x2b2e82[_0xe342('0x12')][_0xe342('0x11')]);}})[_0xe342('0x13')](function(_0x190a90){logger[_0xe342('0x10')](_0xe342('0xc'),_0x57895b,_0x190a90);_0x54868d(_0x190a90);});});}exports['GetCampaign']=function(_0xf70e61){var _0x51eb22=this;return new Promise(function(_0x5df492,_0x394062){return db[_0xe342('0x14')][_0xe342('0x15')]({'raw':_0xf70e61[_0xe342('0x16')]?_0xf70e61[_0xe342('0x16')][_0xe342('0x17')]===undefined?!![]:![]:!![],'where':_0xf70e61[_0xe342('0x16')]?_0xf70e61[_0xe342('0x16')][_0xe342('0x18')]||null:null,'attributes':_0xf70e61['options']?_0xf70e61[_0xe342('0x16')][_0xe342('0x19')]||null:null,'limit':_0xf70e61['options']?_0xf70e61[_0xe342('0x16')]['limit']||null:null,'include':_0xf70e61[_0xe342('0x16')]?_0xf70e61[_0xe342('0x16')][_0xe342('0x1a')]?_[_0xe342('0x1b')](_0xf70e61['options'][_0xe342('0x1a')],function(_0x415aaf){return{'model':db[_0x415aaf[_0xe342('0x1c')]],'as':_0x415aaf['as'],'attributes':_0x415aaf['attributes'],'include':_0x415aaf['include']?_[_0xe342('0x1b')](_0x415aaf[_0xe342('0x1a')],function(_0x5e6e3f){return{'model':db[_0x5e6e3f[_0xe342('0x1c')]],'as':_0x5e6e3f['as'],'attributes':_0x5e6e3f[_0xe342('0x19')],'include':_0x5e6e3f[_0xe342('0x1a')]?_[_0xe342('0x1b')](_0x5e6e3f[_0xe342('0x1a')],function(_0x20f9cc){return{'model':db[_0x20f9cc['model']],'as':_0x20f9cc['as'],'attributes':_0x20f9cc[_0xe342('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2625a7){logger[_0xe342('0xb')]('GetCampaign',_0xf70e61);logger['debug'](_0xe342('0x1d'),_0xf70e61,JSON[_0xe342('0xf')](_0x2625a7));_0x5df492(_0x2625a7);})[_0xe342('0x13')](function(_0x2e4df6){logger[_0xe342('0x10')](_0xe342('0x1d'),_0x2e4df6[_0xe342('0x11')],_0xf70e61);_0x394062(_0x51eb22[_0xe342('0x10')](0x1f4,_0x2e4df6[_0xe342('0x11')]));});});}; \ No newline at end of file +var _0x8ccb=['GetCampaign','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info','debug','Campaign,\x20%s,\x20%s,\x20%s','error','Campaign,\x20%s,\x20%s','message','request\x20sent','result','Campaign','options','raw','where','attributes','limit','include','map','model'];(function(_0x6acc85,_0x295a90){var _0x230ea8=function(_0x3e9a6e){while(--_0x3e9a6e){_0x6acc85['push'](_0x6acc85['shift']());}};_0x230ea8(++_0x295a90);}(_0x8ccb,0x1c4));var _0xb8cc=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0x8ccb[_0x59e821];return _0x5333f6;};'use strict';var _=require(_0xb8cc('0x0'));var util=require(_0xb8cc('0x1'));var moment=require('moment');var BPromise=require(_0xb8cc('0x2'));var rs=require(_0xb8cc('0x3'));var fs=require('fs');var Redis=require(_0xb8cc('0x4'));var db=require(_0xb8cc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb8cc('0x6'));var config=require(_0xb8cc('0x7'));var jayson=require(_0xb8cc('0x8'));var client=jayson['client'][_0xb8cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x349552,_0x139945,_0x56951f){return new BPromise(function(_0x35c86d,_0x2c338f){return client[_0xb8cc('0xa')](_0x349552,_0x56951f)['then'](function(_0x175473){logger[_0xb8cc('0xb')]('Campaign,\x20%s,\x20%s',_0x139945,'request\x20sent');logger[_0xb8cc('0xc')](_0xb8cc('0xd'),_0x139945,'request\x20sent',JSON['stringify'](_0x175473));if(_0x175473[_0xb8cc('0xe')]){if(_0x175473[_0xb8cc('0xe')]['code']===0x1f4){logger[_0xb8cc('0xe')](_0xb8cc('0xf'),_0x139945,_0x175473[_0xb8cc('0xe')][_0xb8cc('0x10')]);return _0x2c338f(_0x175473[_0xb8cc('0xe')][_0xb8cc('0x10')]);}logger[_0xb8cc('0xe')]('Campaign,\x20%s,\x20%s',_0x139945,_0x175473[_0xb8cc('0xe')]['message']);return _0x35c86d(_0x175473[_0xb8cc('0xe')][_0xb8cc('0x10')]);}else{logger[_0xb8cc('0xb')]('Campaign,\x20%s,\x20%s',_0x139945,_0xb8cc('0x11'));_0x35c86d(_0x175473[_0xb8cc('0x12')][_0xb8cc('0x10')]);}})['catch'](function(_0x2ba498){logger['error'](_0xb8cc('0xf'),_0x139945,_0x2ba498);_0x2c338f(_0x2ba498);});});}exports['GetCampaign']=function(_0x2ac4cc){var _0x259708=this;return new Promise(function(_0x2b7130,_0x3e1ba7){return db[_0xb8cc('0x13')]['findAll']({'raw':_0x2ac4cc[_0xb8cc('0x14')]?_0x2ac4cc[_0xb8cc('0x14')][_0xb8cc('0x15')]===undefined?!![]:![]:!![],'where':_0x2ac4cc['options']?_0x2ac4cc[_0xb8cc('0x14')][_0xb8cc('0x16')]||null:null,'attributes':_0x2ac4cc['options']?_0x2ac4cc[_0xb8cc('0x14')][_0xb8cc('0x17')]||null:null,'limit':_0x2ac4cc['options']?_0x2ac4cc[_0xb8cc('0x14')][_0xb8cc('0x18')]||null:null,'include':_0x2ac4cc[_0xb8cc('0x14')]?_0x2ac4cc[_0xb8cc('0x14')][_0xb8cc('0x19')]?_[_0xb8cc('0x1a')](_0x2ac4cc[_0xb8cc('0x14')]['include'],function(_0x50aa38){return{'model':db[_0x50aa38[_0xb8cc('0x1b')]],'as':_0x50aa38['as'],'attributes':_0x50aa38['attributes'],'include':_0x50aa38[_0xb8cc('0x19')]?_['map'](_0x50aa38[_0xb8cc('0x19')],function(_0xbb1918){return{'model':db[_0xbb1918[_0xb8cc('0x1b')]],'as':_0xbb1918['as'],'attributes':_0xbb1918[_0xb8cc('0x17')],'include':_0xbb1918['include']?_[_0xb8cc('0x1a')](_0xbb1918[_0xb8cc('0x19')],function(_0x400de6){return{'model':db[_0x400de6[_0xb8cc('0x1b')]],'as':_0x400de6['as'],'attributes':_0x400de6[_0xb8cc('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50ed6f){logger[_0xb8cc('0xb')](_0xb8cc('0x1c'),_0x2ac4cc);logger['debug'](_0xb8cc('0x1c'),_0x2ac4cc,JSON['stringify'](_0x50ed6f));_0x2b7130(_0x50ed6f);})[_0xb8cc('0x1d')](function(_0x2634a4){logger[_0xb8cc('0xe')](_0xb8cc('0x1c'),_0x2634a4['message'],_0x2ac4cc);_0x3e1ba7(_0x259708[_0xb8cc('0xe')](0x1f4,_0x2634a4[_0xb8cc('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 855d68c..4bb312d 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 _0xc7ff=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','clone','addLists','addBlackLists','update','delete','destroy','exports','util'];(function(_0x57cc54,_0x6862b1){var _0xa93acc=function(_0x350992){while(--_0x350992){_0x57cc54['push'](_0x57cc54['shift']());}};_0xa93acc(++_0x6862b1);}(_0xc7ff,0x95));var _0xfc7f=function(_0x42a44a,_0x15ca12){_0x42a44a=_0x42a44a-0x0;var _0x1e6ab6=_0xc7ff[_0x42a44a];return _0x1e6ab6;};'use strict';var multer=require('multer');var util=require(_0xfc7f('0x0'));var path=require(_0xfc7f('0x1'));var timeout=require('connect-timeout');var express=require(_0xfc7f('0x2'));var router=express[_0xfc7f('0x3')]();var fs_extra=require(_0xfc7f('0x4'));var auth=require(_0xfc7f('0x5'));var interaction=require(_0xfc7f('0x6'));var config=require(_0xfc7f('0x7'));var controller=require(_0xfc7f('0x8'));router[_0xfc7f('0x9')]('/',auth[_0xfc7f('0xa')](),controller[_0xfc7f('0xb')]);router[_0xfc7f('0x9')](_0xfc7f('0xc'),auth['isAuthenticated'](),controller[_0xfc7f('0xd')]);router[_0xfc7f('0x9')](_0xfc7f('0xe'),auth[_0xfc7f('0xa')](),controller['getHoppers']);router[_0xfc7f('0x9')](_0xfc7f('0xf'),auth[_0xfc7f('0xa')](),controller['getHopperHistories']);router[_0xfc7f('0x9')](_0xfc7f('0x10'),auth[_0xfc7f('0xa')](),controller[_0xfc7f('0x11')]);router[_0xfc7f('0x9')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0xfc7f('0x12')]);router[_0xfc7f('0x9')](_0xfc7f('0x13'),auth[_0xfc7f('0xa')](),controller[_0xfc7f('0x14')]);router[_0xfc7f('0x9')](_0xfc7f('0x15'),auth['isAuthenticated'](),controller['getBlackLists']);router['post']('/',auth[_0xfc7f('0xa')](),controller['create']);router[_0xfc7f('0x16')]('/:id/clone',auth[_0xfc7f('0xa')](),controller[_0xfc7f('0x17')]);router[_0xfc7f('0x16')](_0xfc7f('0x13'),auth[_0xfc7f('0xa')](),controller[_0xfc7f('0x18')]);router['post'](_0xfc7f('0x15'),auth[_0xfc7f('0xa')](),controller[_0xfc7f('0x19')]);router['put']('/:id',auth[_0xfc7f('0xa')](),controller[_0xfc7f('0x1a')]);router[_0xfc7f('0x1b')](_0xfc7f('0xc'),auth[_0xfc7f('0xa')](),controller[_0xfc7f('0x1c')]);router[_0xfc7f('0x1b')]('/:id/lists',auth[_0xfc7f('0xa')](),controller['removeLists']);router[_0xfc7f('0x1b')](_0xfc7f('0x15'),auth[_0xfc7f('0xa')](),controller['removeBlackLists']);module[_0xfc7f('0x1d')]=router; \ No newline at end of file +var _0x370d=['fs-extra','../../components/interaction/service','index','get','/:id','isAuthenticated','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/lists','getLists','/:id/blacklists','post','create','clone','addLists','addBlackLists','put','update','delete','removeBlackLists','multer','util','connect-timeout','express','Router'];(function(_0x146ca3,_0x29a10e){var _0x30dd24=function(_0x4b4f36){while(--_0x4b4f36){_0x146ca3['push'](_0x146ca3['shift']());}};_0x30dd24(++_0x29a10e);}(_0x370d,0xc6));var _0xd370=function(_0x4f6059,_0x16db03){_0x4f6059=_0x4f6059-0x0;var _0x383c3b=_0x370d[_0x4f6059];return _0x383c3b;};'use strict';var multer=require(_0xd370('0x0'));var util=require(_0xd370('0x1'));var path=require('path');var timeout=require(_0xd370('0x2'));var express=require(_0xd370('0x3'));var router=express[_0xd370('0x4')]();var fs_extra=require(_0xd370('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd370('0x6'));var config=require('../../config/environment');var controller=require('./campaign.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd370('0x7')]);router[_0xd370('0x8')](_0xd370('0x9'),auth[_0xd370('0xa')](),controller[_0xd370('0xb')]);router[_0xd370('0x8')](_0xd370('0xc'),auth[_0xd370('0xa')](),controller['getHoppers']);router[_0xd370('0x8')](_0xd370('0xd'),auth[_0xd370('0xa')](),controller[_0xd370('0xe')]);router[_0xd370('0x8')](_0xd370('0xf'),auth['isAuthenticated'](),controller[_0xd370('0x10')]);router[_0xd370('0x8')]('/:id/hopper_black',auth[_0xd370('0xa')](),controller['getHopperBlacks']);router[_0xd370('0x8')](_0xd370('0x11'),auth[_0xd370('0xa')](),controller[_0xd370('0x12')]);router[_0xd370('0x8')](_0xd370('0x13'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0xd370('0x14')]('/',auth[_0xd370('0xa')](),controller[_0xd370('0x15')]);router['post']('/:id/clone',auth[_0xd370('0xa')](),controller[_0xd370('0x16')]);router[_0xd370('0x14')](_0xd370('0x11'),auth[_0xd370('0xa')](),controller[_0xd370('0x17')]);router['post']('/:id/blacklists',auth[_0xd370('0xa')](),controller[_0xd370('0x18')]);router[_0xd370('0x19')](_0xd370('0x9'),auth[_0xd370('0xa')](),controller[_0xd370('0x1a')]);router[_0xd370('0x1b')](_0xd370('0x9'),auth[_0xd370('0xa')](),controller['destroy']);router[_0xd370('0x1b')](_0xd370('0x11'),auth['isAuthenticated'](),controller['removeLists']);router[_0xd370('0x1b')](_0xd370('0x13'),auth['isAuthenticated'](),controller[_0xd370('0x1c')]);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 00ed56b..eb000db 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 _0xca6c=['VIRTUAL','getDataValue','key','sequelize','exports','TEXT','STRING'];(function(_0xf4e030,_0x131199){var _0x30f392=function(_0x584802){while(--_0x584802){_0xf4e030['push'](_0xf4e030['shift']());}};_0x30f392(++_0x131199);}(_0xca6c,0x106));var _0xcca6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xca6c[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xcca6('0x0'));module[_0xcca6('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xcca6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xcca6('0x3')]},'name':{'type':Sequelize[_0xcca6('0x4')],'get':function(){return this[_0xcca6('0x5')](_0xcca6('0x6'));}}}; \ No newline at end of file +var _0x0e66=['key','sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x0e66,0x1d5));var _0x60e6=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x0e66[_0x2d34d6];return _0x1d3d12;};'use strict';var Sequelize=require(_0x60e6('0x0'));module[_0x60e6('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x60e6('0x2')]},'name':{'type':Sequelize[_0x60e6('0x3')],'get':function(){return this[_0x60e6('0x4')](_0x60e6('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index f99e69a..1dd708b 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 _0x5b39=['error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','includeAll','include','findAll','catch','params','length','options','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','get','CannedAnswers','UserProfileResource','destroy'];(function(_0x193109,_0x50a9ca){var _0x4af109=function(_0x21c390){while(--_0x21c390){_0x193109['push'](_0x193109['shift']());}};_0x4af109(++_0x50a9ca);}(_0x5b39,0x81));var _0x95b3=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x5b39[_0xd09668];return _0x68726;};'use strict';var emlformat=require(_0x95b3('0x0'));var rimraf=require(_0x95b3('0x1'));var zipdir=require(_0x95b3('0x2'));var jsonpatch=require(_0x95b3('0x3'));var rp=require('request-promise');var moment=require(_0x95b3('0x4'));var BPromise=require(_0x95b3('0x5'));var Mustache=require(_0x95b3('0x6'));var util=require(_0x95b3('0x7'));var path=require(_0x95b3('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x95b3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x95b3('0xa'));var squel=require('squel');var crypto=require(_0x95b3('0xb'));var jsforce=require(_0x95b3('0xc'));var deskjs=require(_0x95b3('0xd'));var toCsv=require('to-csv');var querystring=require(_0x95b3('0xe'));var Papa=require('papaparse');var Redis=require(_0x95b3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x95b3('0x10'));var as=require(_0x95b3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x95b3('0x12'))(_0x95b3('0x13'));var utils=require(_0x95b3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x95b3('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd2b225,_0x5ae23f){_0x5ae23f=_0x5ae23f||0xcc;return function(_0xb9f881){if(_0xb9f881){return _0xd2b225[_0x95b3('0x16')](_0x5ae23f);}return _0xd2b225[_0x95b3('0x17')](_0x5ae23f)[_0x95b3('0x18')]();};}function respondWithResult(_0x32e40c,_0x353073){_0x353073=_0x353073||0xc8;return function(_0x3afd67){if(_0x3afd67){return _0x32e40c[_0x95b3('0x17')](_0x353073)['json'](_0x3afd67);}};}function respondWithFilteredResult(_0x413e7c,_0x154deb){return function(_0x4d9230){if(_0x4d9230){var _0x5bc240=typeof _0x154deb[_0x95b3('0x19')]===_0x95b3('0x1a')&&typeof _0x154deb[_0x95b3('0x1b')]==='undefined';var _0x2820ee=_0x4d9230['count'];var _0x39d828=_0x5bc240?0x0:_0x154deb[_0x95b3('0x19')];var _0x43388e=_0x5bc240?_0x4d9230[_0x95b3('0x1c')]:_0x154deb[_0x95b3('0x19')]+_0x154deb[_0x95b3('0x1b')];var _0x241d42;if(_0x43388e>=_0x2820ee){_0x43388e=_0x2820ee;_0x241d42=0xc8;}else{_0x241d42=0xce;}_0x413e7c['status'](_0x241d42);return _0x413e7c['set'](_0x95b3('0x1d'),_0x39d828+'-'+_0x43388e+'/'+_0x2820ee)[_0x95b3('0x1e')](_0x4d9230);}return null;};}function patchUpdates(_0x232ad6){return function(_0x14aa39){try{jsonpatch[_0x95b3('0x1f')](_0x14aa39,_0x232ad6,!![]);}catch(_0x4af194){return BPromise[_0x95b3('0x20')](_0x4af194);}return _0x14aa39['save']();};}function saveUpdates(_0x165cca,_0x1f4549){return function(_0x3133bb){if(_0x3133bb){return _0x3133bb[_0x95b3('0x21')](_0x165cca)[_0x95b3('0x22')](function(_0x4ee29d){return _0x4ee29d;});}return null;};}function removeEntity(_0x56986e,_0x599338){return function(_0x6ca149){if(_0x6ca149){return _0x6ca149['destroy']()[_0x95b3('0x22')](function(){var _0x225fbb=_0x6ca149[_0x95b3('0x23')]({'plain':!![]});var _0x592a58=_0x95b3('0x24');return db[_0x95b3('0x25')][_0x95b3('0x26')]({'where':{'type':_0x592a58,'resourceId':_0x225fbb['id']}})[_0x95b3('0x22')](function(){return _0x6ca149;});})[_0x95b3('0x22')](function(){_0x56986e[_0x95b3('0x17')](0xcc)[_0x95b3('0x18')]();});}};}function handleEntityNotFound(_0x729e40,_0x3d1fa3){return function(_0x77889c){if(!_0x77889c){_0x729e40[_0x95b3('0x16')](0x194);}return _0x77889c;};}function handleError(_0xb7600d,_0x1011b3){_0x1011b3=_0x1011b3||0x1f4;return function(_0x2853dd){logger[_0x95b3('0x27')](_0x2853dd[_0x95b3('0x28')]);if(_0x2853dd[_0x95b3('0x29')]){delete _0x2853dd['name'];}_0xb7600d['status'](_0x1011b3)[_0x95b3('0x2a')](_0x2853dd);};}exports[_0x95b3('0x2b')]=function(_0x50a16b,_0x1054bc){var _0x5df470={},_0x525ea9={},_0x26da08={'count':0x0,'rows':[]};var _0x159782=_[_0x95b3('0x2c')](db[_0x95b3('0x2d')][_0x95b3('0x2e')],function(_0x23157e){return{'name':_0x23157e[_0x95b3('0x2f')],'type':_0x23157e['type'][_0x95b3('0x30')]};});_0x525ea9[_0x95b3('0x31')]=_[_0x95b3('0x2c')](_0x159782,_0x95b3('0x29'));_0x525ea9[_0x95b3('0x32')]=_[_0x95b3('0x33')](_0x50a16b[_0x95b3('0x32')]);_0x525ea9[_0x95b3('0x34')]=_[_0x95b3('0x35')](_0x525ea9['model'],_0x525ea9['query']);_0x5df470[_0x95b3('0x36')]=_[_0x95b3('0x35')](_0x525ea9[_0x95b3('0x31')],qs[_0x95b3('0x37')](_0x50a16b['query'][_0x95b3('0x37')]));_0x5df470[_0x95b3('0x36')]=_0x5df470[_0x95b3('0x36')]['length']?_0x5df470['attributes']:_0x525ea9[_0x95b3('0x31')];if(!_0x50a16b['query'][_0x95b3('0x38')]('nolimit')){_0x5df470[_0x95b3('0x1b')]=qs[_0x95b3('0x1b')](_0x50a16b['query'][_0x95b3('0x1b')]);_0x5df470[_0x95b3('0x19')]=qs[_0x95b3('0x19')](_0x50a16b[_0x95b3('0x32')]['offset']);}_0x5df470[_0x95b3('0x39')]=qs[_0x95b3('0x3a')](_0x50a16b[_0x95b3('0x32')][_0x95b3('0x3a')]);_0x5df470[_0x95b3('0x3b')]=qs[_0x95b3('0x34')](_['pick'](_0x50a16b[_0x95b3('0x32')],_0x525ea9['filters']),_0x159782);if(_0x50a16b[_0x95b3('0x32')][_0x95b3('0x3c')]){_0x5df470[_0x95b3('0x3b')]=_[_0x95b3('0x3d')](_0x5df470[_0x95b3('0x3b')],{'$or':[{'key':{'$like':'%'+_0x50a16b[_0x95b3('0x32')]['filter']+'%'}},{'value':{'$like':'%'+_0x50a16b['query'][_0x95b3('0x3c')]+'%'}}]});}_0x5df470=_[_0x95b3('0x3d')]({},_0x5df470,_0x50a16b['options']);var _0x16d9a3={'where':_0x5df470[_0x95b3('0x3b')]};return db[_0x95b3('0x2d')][_0x95b3('0x1c')](_0x16d9a3)['then'](function(_0x29baad){_0x26da08[_0x95b3('0x1c')]=_0x29baad;if(_0x50a16b['query'][_0x95b3('0x3e')]){_0x5df470[_0x95b3('0x3f')]=[{'all':!![]}];}return db[_0x95b3('0x2d')][_0x95b3('0x40')](_0x5df470);})['then'](function(_0x22f537){_0x26da08['rows']=_0x22f537;return _0x26da08;})[_0x95b3('0x22')](respondWithFilteredResult(_0x1054bc,_0x5df470))[_0x95b3('0x41')](handleError(_0x1054bc,null));};exports['show']=function(_0x16fad4,_0x485fbb){var _0x535503={'raw':!![],'where':{'id':_0x16fad4[_0x95b3('0x42')]['id']}},_0x416cda={};_0x416cda['model']=_[_0x95b3('0x33')](db[_0x95b3('0x2d')][_0x95b3('0x2e')]);_0x416cda['query']=_['keys'](_0x16fad4['query']);_0x416cda[_0x95b3('0x34')]=_[_0x95b3('0x35')](_0x416cda[_0x95b3('0x31')],_0x416cda[_0x95b3('0x32')]);_0x535503[_0x95b3('0x36')]=_[_0x95b3('0x35')](_0x416cda[_0x95b3('0x31')],qs['fields'](_0x16fad4[_0x95b3('0x32')]['fields']));_0x535503[_0x95b3('0x36')]=_0x535503[_0x95b3('0x36')][_0x95b3('0x43')]?_0x535503[_0x95b3('0x36')]:_0x416cda[_0x95b3('0x31')];if(_0x16fad4[_0x95b3('0x32')][_0x95b3('0x3e')]){_0x535503['include']=[{'all':!![]}];}_0x535503=_[_0x95b3('0x3d')]({},_0x535503,_0x16fad4[_0x95b3('0x44')]);return db[_0x95b3('0x2d')][_0x95b3('0x45')](_0x535503)[_0x95b3('0x22')](handleEntityNotFound(_0x485fbb,null))['then'](respondWithResult(_0x485fbb,null))[_0x95b3('0x41')](handleError(_0x485fbb,null));};exports['update']=function(_0x39cb92,_0x2692bb){if(_0x39cb92['body']['id']){delete _0x39cb92[_0x95b3('0x46')]['id'];}return db[_0x95b3('0x2d')][_0x95b3('0x45')]({'where':{'id':_0x39cb92[_0x95b3('0x42')]['id']}})[_0x95b3('0x22')](handleEntityNotFound(_0x2692bb,null))[_0x95b3('0x22')](saveUpdates(_0x39cb92[_0x95b3('0x46')],null))[_0x95b3('0x22')](respondWithResult(_0x2692bb,null))[_0x95b3('0x41')](handleError(_0x2692bb,null));};exports[_0x95b3('0x26')]=function(_0x29aebc,_0x1be388){return db['CannedAnswer']['find']({'where':{'id':_0x29aebc[_0x95b3('0x42')]['id']}})[_0x95b3('0x22')](handleEntityNotFound(_0x1be388,null))[_0x95b3('0x22')](removeEntity(_0x1be388,null))['catch'](handleError(_0x1be388,null));};exports[_0x95b3('0x47')]=function(_0xd90415,_0x3ef2ef){var _0x4421a4={'key':_0xd90415[_0x95b3('0x46')][_0x95b3('0x30')]};if(_0xd90415['body'][_0x95b3('0x48')]){_0x4421a4['MailAccountId']=_0xd90415['body']['MailAccountId'];}else if(_0xd90415[_0x95b3('0x46')][_0x95b3('0x49')]){_0x4421a4[_0x95b3('0x49')]=_0xd90415['body'][_0x95b3('0x49')];}else if(_0xd90415[_0x95b3('0x46')][_0x95b3('0x4a')]){_0x4421a4[_0x95b3('0x4a')]=_0xd90415[_0x95b3('0x46')]['OpenchannelAccountId'];}else if(_0xd90415[_0x95b3('0x46')][_0x95b3('0x4b')]){_0x4421a4[_0x95b3('0x4b')]=_0xd90415[_0x95b3('0x46')][_0x95b3('0x4b')];}return db[_0x95b3('0x2d')][_0x95b3('0x45')]({'where':_0x4421a4})['then'](function(_0x8d5cc9){if(_0x8d5cc9){throw new db[(_0x95b3('0x4c'))][(_0x95b3('0x4d'))](_0x95b3('0x4e'));}return db[_0x95b3('0x2d')][_0x95b3('0x47')](_0xd90415[_0x95b3('0x46')]);})[_0x95b3('0x22')](function(_0x346172){var _0x5785cc=_0xd90415[_0x95b3('0x4f')]['get']({'plain':!![]});if(!_0x5785cc)throw new Error(_0x95b3('0x50'));if(_0x5785cc['role']===_0x95b3('0x4f')){var _0x48f79e=_0x346172[_0x95b3('0x23')]({'plain':!![]});return db[_0x95b3('0x51')][_0x95b3('0x45')]({'where':{'name':_0x95b3('0x24'),'userProfileId':_0x5785cc[_0x95b3('0x52')]},'raw':!![]})[_0x95b3('0x22')](function(_0x32cdfc){if(_0x32cdfc&&_0x32cdfc['autoAssociation']===0x0){return db[_0x95b3('0x25')]['create']({'name':_0x48f79e[_0x95b3('0x29')],'resourceId':_0x48f79e['id'],'type':_0x32cdfc['name'],'sectionId':_0x32cdfc['id']},{})['then'](function(){return _0x346172;});}else{return _0x346172;}})[_0x95b3('0x41')](function(_0x5bc695){logger[_0x95b3('0x27')](_0x95b3('0x53'),_0x5bc695);throw _0x5bc695;});}return _0x346172;})['then'](respondWithResult(_0x3ef2ef,0xc9))['catch'](handleError(_0x3ef2ef,null));}; \ No newline at end of file +var _0x6d3a=['eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','name','send','index','map','CannedAnswer','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','options','includeAll','findAll','catch','params','keys','include','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation'];(function(_0x5d335a,_0x21ca36){var _0x5f322d=function(_0x2aa397){while(--_0x2aa397){_0x5d335a['push'](_0x5d335a['shift']());}};_0x5f322d(++_0x21ca36);}(_0x6d3a,0x108));var _0xa6d3=function(_0x382aa0,_0x1c4903){_0x382aa0=_0x382aa0-0x0;var _0x3e67ea=_0x6d3a[_0x382aa0];return _0x3e67ea;};'use strict';var emlformat=require(_0xa6d3('0x0'));var rimraf=require(_0xa6d3('0x1'));var zipdir=require(_0xa6d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa6d3('0x3'));var moment=require('moment');var BPromise=require(_0xa6d3('0x4'));var Mustache=require(_0xa6d3('0x5'));var util=require(_0xa6d3('0x6'));var path=require(_0xa6d3('0x7'));var sox=require(_0xa6d3('0x8'));var csv=require(_0xa6d3('0x9'));var ejs=require(_0xa6d3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa6d3('0xb'));var squel=require(_0xa6d3('0xc'));var crypto=require(_0xa6d3('0xd'));var jsforce=require(_0xa6d3('0xe'));var deskjs=require(_0xa6d3('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa6d3('0x10'));var Papa=require('papaparse');var Redis=require(_0xa6d3('0x11'));var authService=require(_0xa6d3('0x12'));var qs=require(_0xa6d3('0x13'));var as=require(_0xa6d3('0x14'));var hardwareService=require(_0xa6d3('0x15'));var logger=require(_0xa6d3('0x16'))(_0xa6d3('0x17'));var utils=require('../../config/utils');var config=require(_0xa6d3('0x18'));var licenseUtil=require(_0xa6d3('0x19'));var db=require(_0xa6d3('0x1a'))['db'];function respondWithStatusCode(_0x371105,_0x322b4b){_0x322b4b=_0x322b4b||0xcc;return function(_0x5a92e8){if(_0x5a92e8){return _0x371105[_0xa6d3('0x1b')](_0x322b4b);}return _0x371105[_0xa6d3('0x1c')](_0x322b4b)[_0xa6d3('0x1d')]();};}function respondWithResult(_0x5c9cbf,_0x5b7868){_0x5b7868=_0x5b7868||0xc8;return function(_0x1c4efe){if(_0x1c4efe){return _0x5c9cbf[_0xa6d3('0x1c')](_0x5b7868)[_0xa6d3('0x1e')](_0x1c4efe);}};}function respondWithFilteredResult(_0x53313d,_0x2883ee){return function(_0x3e54ff){if(_0x3e54ff){var _0x5973a3=typeof _0x2883ee[_0xa6d3('0x1f')]==='undefined'&&typeof _0x2883ee[_0xa6d3('0x20')]===_0xa6d3('0x21');var _0x2c7461=_0x3e54ff[_0xa6d3('0x22')];var _0x91a07a=_0x5973a3?0x0:_0x2883ee['offset'];var _0x4ab69e=_0x5973a3?_0x3e54ff['count']:_0x2883ee[_0xa6d3('0x1f')]+_0x2883ee[_0xa6d3('0x20')];var _0x4c812d;if(_0x4ab69e>=_0x2c7461){_0x4ab69e=_0x2c7461;_0x4c812d=0xc8;}else{_0x4c812d=0xce;}_0x53313d[_0xa6d3('0x1c')](_0x4c812d);return _0x53313d[_0xa6d3('0x23')]('Content-Range',_0x91a07a+'-'+_0x4ab69e+'/'+_0x2c7461)['json'](_0x3e54ff);}return null;};}function patchUpdates(_0xd7deb5){return function(_0x13a42d){try{jsonpatch[_0xa6d3('0x24')](_0x13a42d,_0xd7deb5,!![]);}catch(_0x5d73e3){return BPromise['reject'](_0x5d73e3);}return _0x13a42d[_0xa6d3('0x25')]();};}function saveUpdates(_0x3aa5ca,_0x3256a8){return function(_0x23161c){if(_0x23161c){return _0x23161c[_0xa6d3('0x26')](_0x3aa5ca)[_0xa6d3('0x27')](function(_0x48ae22){return _0x48ae22;});}return null;};}function removeEntity(_0x3d37a6,_0x244eb8){return function(_0x45db63){if(_0x45db63){return _0x45db63[_0xa6d3('0x28')]()['then'](function(){var _0x5c6abf=_0x45db63[_0xa6d3('0x29')]({'plain':!![]});var _0x3a5198=_0xa6d3('0x2a');return db[_0xa6d3('0x2b')][_0xa6d3('0x28')]({'where':{'type':_0x3a5198,'resourceId':_0x5c6abf['id']}})[_0xa6d3('0x27')](function(){return _0x45db63;});})['then'](function(){_0x3d37a6[_0xa6d3('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x183138,_0x23d400){return function(_0x569a96){if(!_0x569a96){_0x183138[_0xa6d3('0x1b')](0x194);}return _0x569a96;};}function handleError(_0x3832fa,_0x3886e1){_0x3886e1=_0x3886e1||0x1f4;return function(_0x52ea77){logger[_0xa6d3('0x2c')](_0x52ea77['stack']);if(_0x52ea77[_0xa6d3('0x2d')]){delete _0x52ea77[_0xa6d3('0x2d')];}_0x3832fa[_0xa6d3('0x1c')](_0x3886e1)[_0xa6d3('0x2e')](_0x52ea77);};}exports[_0xa6d3('0x2f')]=function(_0x362164,_0x2946df){var _0x168126={},_0x1bc1f6={},_0x29c214={'count':0x0,'rows':[]};var _0x3c4097=_[_0xa6d3('0x30')](db[_0xa6d3('0x31')][_0xa6d3('0x32')],function(_0x1acb5b){return{'name':_0x1acb5b['fieldName'],'type':_0x1acb5b[_0xa6d3('0x33')][_0xa6d3('0x34')]};});_0x1bc1f6[_0xa6d3('0x35')]=_[_0xa6d3('0x30')](_0x3c4097,'name');_0x1bc1f6['query']=_['keys'](_0x362164[_0xa6d3('0x36')]);_0x1bc1f6['filters']=_[_0xa6d3('0x37')](_0x1bc1f6[_0xa6d3('0x35')],_0x1bc1f6[_0xa6d3('0x36')]);_0x168126['attributes']=_[_0xa6d3('0x37')](_0x1bc1f6[_0xa6d3('0x35')],qs['fields'](_0x362164[_0xa6d3('0x36')][_0xa6d3('0x38')]));_0x168126[_0xa6d3('0x39')]=_0x168126[_0xa6d3('0x39')][_0xa6d3('0x3a')]?_0x168126['attributes']:_0x1bc1f6['model'];if(!_0x362164['query'][_0xa6d3('0x3b')](_0xa6d3('0x3c'))){_0x168126['limit']=qs[_0xa6d3('0x20')](_0x362164[_0xa6d3('0x36')][_0xa6d3('0x20')]);_0x168126[_0xa6d3('0x1f')]=qs['offset'](_0x362164['query'][_0xa6d3('0x1f')]);}_0x168126[_0xa6d3('0x3d')]=qs['sort'](_0x362164[_0xa6d3('0x36')]['sort']);_0x168126[_0xa6d3('0x3e')]=qs['filters'](_[_0xa6d3('0x3f')](_0x362164[_0xa6d3('0x36')],_0x1bc1f6[_0xa6d3('0x40')]),_0x3c4097);if(_0x362164[_0xa6d3('0x36')][_0xa6d3('0x41')]){_0x168126[_0xa6d3('0x3e')]=_['merge'](_0x168126['where'],{'$or':[{'key':{'$like':'%'+_0x362164[_0xa6d3('0x36')]['filter']+'%'}},{'value':{'$like':'%'+_0x362164[_0xa6d3('0x36')][_0xa6d3('0x41')]+'%'}}]});}_0x168126=_[_0xa6d3('0x42')]({},_0x168126,_0x362164[_0xa6d3('0x43')]);var _0x286142={'where':_0x168126['where']};return db[_0xa6d3('0x31')][_0xa6d3('0x22')](_0x286142)['then'](function(_0x4a66c1){_0x29c214[_0xa6d3('0x22')]=_0x4a66c1;if(_0x362164[_0xa6d3('0x36')][_0xa6d3('0x44')]){_0x168126['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xa6d3('0x45')](_0x168126);})[_0xa6d3('0x27')](function(_0x42afb4){_0x29c214['rows']=_0x42afb4;return _0x29c214;})['then'](respondWithFilteredResult(_0x2946df,_0x168126))[_0xa6d3('0x46')](handleError(_0x2946df,null));};exports['show']=function(_0xeb0c26,_0x540b0c){var _0x5ea7fd={'raw':!![],'where':{'id':_0xeb0c26[_0xa6d3('0x47')]['id']}},_0x21f8bf={};_0x21f8bf[_0xa6d3('0x35')]=_[_0xa6d3('0x48')](db[_0xa6d3('0x31')]['rawAttributes']);_0x21f8bf[_0xa6d3('0x36')]=_[_0xa6d3('0x48')](_0xeb0c26['query']);_0x21f8bf['filters']=_[_0xa6d3('0x37')](_0x21f8bf[_0xa6d3('0x35')],_0x21f8bf['query']);_0x5ea7fd[_0xa6d3('0x39')]=_[_0xa6d3('0x37')](_0x21f8bf[_0xa6d3('0x35')],qs[_0xa6d3('0x38')](_0xeb0c26['query'][_0xa6d3('0x38')]));_0x5ea7fd[_0xa6d3('0x39')]=_0x5ea7fd[_0xa6d3('0x39')]['length']?_0x5ea7fd[_0xa6d3('0x39')]:_0x21f8bf[_0xa6d3('0x35')];if(_0xeb0c26[_0xa6d3('0x36')]['includeAll']){_0x5ea7fd[_0xa6d3('0x49')]=[{'all':!![]}];}_0x5ea7fd=_[_0xa6d3('0x42')]({},_0x5ea7fd,_0xeb0c26[_0xa6d3('0x43')]);return db['CannedAnswer'][_0xa6d3('0x4a')](_0x5ea7fd)[_0xa6d3('0x27')](handleEntityNotFound(_0x540b0c,null))[_0xa6d3('0x27')](respondWithResult(_0x540b0c,null))[_0xa6d3('0x46')](handleError(_0x540b0c,null));};exports[_0xa6d3('0x26')]=function(_0x282a99,_0x6d6eb4){if(_0x282a99[_0xa6d3('0x4b')]['id']){delete _0x282a99[_0xa6d3('0x4b')]['id'];}return db['CannedAnswer'][_0xa6d3('0x4a')]({'where':{'id':_0x282a99[_0xa6d3('0x47')]['id']}})[_0xa6d3('0x27')](handleEntityNotFound(_0x6d6eb4,null))[_0xa6d3('0x27')](saveUpdates(_0x282a99[_0xa6d3('0x4b')],null))[_0xa6d3('0x27')](respondWithResult(_0x6d6eb4,null))[_0xa6d3('0x46')](handleError(_0x6d6eb4,null));};exports[_0xa6d3('0x28')]=function(_0x55f4f8,_0x52452a){return db['CannedAnswer'][_0xa6d3('0x4a')]({'where':{'id':_0x55f4f8[_0xa6d3('0x47')]['id']}})[_0xa6d3('0x27')](handleEntityNotFound(_0x52452a,null))[_0xa6d3('0x27')](removeEntity(_0x52452a,null))['catch'](handleError(_0x52452a,null));};exports[_0xa6d3('0x4c')]=function(_0x3bd15c,_0x1c49c5){var _0x24b227={'key':_0x3bd15c[_0xa6d3('0x4b')]['key']};if(_0x3bd15c[_0xa6d3('0x4b')]['MailAccountId']){_0x24b227[_0xa6d3('0x4d')]=_0x3bd15c[_0xa6d3('0x4b')][_0xa6d3('0x4d')];}else if(_0x3bd15c['body']['SmsAccountId']){_0x24b227[_0xa6d3('0x4e')]=_0x3bd15c['body'][_0xa6d3('0x4e')];}else if(_0x3bd15c[_0xa6d3('0x4b')][_0xa6d3('0x4f')]){_0x24b227['OpenchannelAccountId']=_0x3bd15c[_0xa6d3('0x4b')]['OpenchannelAccountId'];}else if(_0x3bd15c[_0xa6d3('0x4b')][_0xa6d3('0x50')]){_0x24b227[_0xa6d3('0x50')]=_0x3bd15c[_0xa6d3('0x4b')][_0xa6d3('0x50')];}return db['CannedAnswer']['find']({'where':_0x24b227})['then'](function(_0x34ba84){if(_0x34ba84){throw new db[(_0xa6d3('0x51'))][(_0xa6d3('0x52'))](_0xa6d3('0x53'));}return db['CannedAnswer'][_0xa6d3('0x4c')](_0x3bd15c[_0xa6d3('0x4b')]);})['then'](function(_0x1e2798){var _0x227a67=_0x3bd15c[_0xa6d3('0x54')][_0xa6d3('0x29')]({'plain':!![]});if(!_0x227a67)throw new Error(_0xa6d3('0x55'));if(_0x227a67['role']===_0xa6d3('0x54')){var _0x1099ac=_0x1e2798[_0xa6d3('0x29')]({'plain':!![]});return db['UserProfileSection'][_0xa6d3('0x4a')]({'where':{'name':_0xa6d3('0x2a'),'userProfileId':_0x227a67[_0xa6d3('0x56')]},'raw':!![]})[_0xa6d3('0x27')](function(_0x21ca05){if(_0x21ca05&&_0x21ca05[_0xa6d3('0x57')]===0x0){return db[_0xa6d3('0x2b')][_0xa6d3('0x4c')]({'name':_0x1099ac[_0xa6d3('0x2d')],'resourceId':_0x1099ac['id'],'type':_0x21ca05[_0xa6d3('0x2d')],'sectionId':_0x21ca05['id']},{})['then'](function(){return _0x1e2798;});}else{return _0x1e2798;}})[_0xa6d3('0x46')](function(_0x108dc9){logger[_0xa6d3('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x108dc9);throw _0x108dc9;});}return _0x1e2798;})[_0xa6d3('0x27')](respondWithResult(_0x1c49c5,0xc9))['catch'](handleError(_0x1c49c5,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 93c85a2..ee2df5c 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 _0x8bc6=['exports','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8bc6,0xc4));var _0x68bc=function(_0x5e32f3,_0x3386c1){_0x5e32f3=_0x5e32f3-0x0;var _0x4d4e03=_0x8bc6[_0x5e32f3];return _0x4d4e03;};'use strict';var _=require(_0x68bc('0x0'));var util=require(_0x68bc('0x1'));var logger=require('../../config/logger')(_0x68bc('0x2'));var moment=require(_0x68bc('0x3'));var BPromise=require('bluebird');var rp=require(_0x68bc('0x4'));var fs=require('fs');var path=require(_0x68bc('0x5'));var rimraf=require(_0x68bc('0x6'));var config=require(_0x68bc('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0x68bc('0x8')]=function(_0x2c74d6,_0x4afc7a){return _0x2c74d6['define'](_0x68bc('0x9'),attributes,{'tableName':_0x68bc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x68bc('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x46b2=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4aba15,_0x4e90aa){var _0x1c8122=function(_0x568dba){while(--_0x568dba){_0x4aba15['push'](_0x4aba15['shift']());}};_0x1c8122(++_0x4e90aa);}(_0x46b2,0x114));var _0x246b=function(_0x4fc202,_0x5cc5db){_0x4fc202=_0x4fc202-0x0;var _0x1b2de3=_0x46b2[_0x4fc202];return _0x1b2de3;};'use strict';var _=require('lodash');var util=require(_0x246b('0x0'));var logger=require(_0x246b('0x1'))('api');var moment=require('moment');var BPromise=require(_0x246b('0x2'));var rp=require(_0x246b('0x3'));var fs=require('fs');var path=require(_0x246b('0x4'));var rimraf=require(_0x246b('0x5'));var config=require(_0x246b('0x6'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x4ef4dd,_0xacadd7){return _0x4ef4dd[_0x246b('0x7')](_0x246b('0x8'),attributes,{'tableName':_0x246b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x246b('0xa'),'collate':_0x246b('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 331dc1e..4e4c5c6 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(_0x261f90,_0x11aed1){var _0x4a22f2=function(_0x4dac87){while(--_0x4dac87){_0x261f90['push'](_0x261f90['shift']());}};_0x4a22f2(++_0x11aed1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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(_0x19027d,_0x2fcde2){var _0x52e59f=function(_0x28039c){while(--_0x28039c){_0x19027d['push'](_0x19027d['shift']());}};_0x52e59f(++_0x2fcde2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 508e6d8..d7253a8 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 _0xbdf3=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','create','put','/:id','update'];(function(_0x1282f4,_0x26f69d){var _0x245c68=function(_0x1d600a){while(--_0x1d600a){_0x1282f4['push'](_0x1282f4['shift']());}};_0x245c68(++_0x26f69d);}(_0xbdf3,0x75));var _0x3bdf=function(_0x1ad926,_0x3e1fed){_0x1ad926=_0x1ad926-0x0;var _0x1b81dc=_0xbdf3[_0x1ad926];return _0x1b81dc;};'use strict';var multer=require(_0x3bdf('0x0'));var util=require(_0x3bdf('0x1'));var path=require(_0x3bdf('0x2'));var timeout=require(_0x3bdf('0x3'));var express=require(_0x3bdf('0x4'));var router=express['Router']();var fs_extra=require(_0x3bdf('0x5'));var auth=require(_0x3bdf('0x6'));var interaction=require(_0x3bdf('0x7'));var config=require(_0x3bdf('0x8'));var controller=require('./cannedAnswer.controller');router[_0x3bdf('0x9')]('/',auth['isAuthenticated'](),controller[_0x3bdf('0xa')]);router[_0x3bdf('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x3bdf('0xb')](),controller[_0x3bdf('0xc')]);router[_0x3bdf('0xd')](_0x3bdf('0xe'),auth['isAuthenticated'](),controller[_0x3bdf('0xf')]);router[_0x3bdf('0x10')]('/:id',auth[_0x3bdf('0xb')](),controller[_0x3bdf('0x11')]);module[_0x3bdf('0x12')]=router; \ No newline at end of file +var _0x2cbd=['./cannedAnswer.controller','get','isAuthenticated','show','post','put','/:id','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment'];(function(_0x5b5eb4,_0x117c87){var _0x42af53=function(_0xdf6fcb){while(--_0xdf6fcb){_0x5b5eb4['push'](_0x5b5eb4['shift']());}};_0x42af53(++_0x117c87);}(_0x2cbd,0x1e9));var _0xd2cb=function(_0x148879,_0x5b4c11){_0x148879=_0x148879-0x0;var _0x4f7027=_0x2cbd[_0x148879];return _0x4f7027;};'use strict';var multer=require(_0xd2cb('0x0'));var util=require('util');var path=require(_0xd2cb('0x1'));var timeout=require(_0xd2cb('0x2'));var express=require('express');var router=express[_0xd2cb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd2cb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd2cb('0x5'));var controller=require(_0xd2cb('0x6'));router[_0xd2cb('0x7')]('/',auth[_0xd2cb('0x8')](),controller['index']);router[_0xd2cb('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xd2cb('0x9')]);router[_0xd2cb('0xa')]('/',auth[_0xd2cb('0x8')](),controller['create']);router[_0xd2cb('0xb')](_0xd2cb('0xc'),auth[_0xd2cb('0x8')](),controller['update']);router['delete']('/:id',auth[_0xd2cb('0x8')](),controller[_0xd2cb('0xd')]);module[_0xd2cb('0xe')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 52da903..1bcd20f 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 _0x2e3d=['STRING','INTEGER','sequelize','1970-01-01\x2000:00:01'];(function(_0xf93678,_0x515528){var _0x20153b=function(_0x2c0a36){while(--_0x2c0a36){_0xf93678['push'](_0xf93678['shift']());}};_0x20153b(++_0x515528);}(_0x2e3d,0x1be));var _0xd2e3=function(_0x2a330f,_0x2deeec){_0x2a330f=_0x2a330f-0x0;var _0x338f99=_0x2e3d[_0x2a330f];return _0x338f99;};'use strict';var Sequelize=require(_0xd2e3('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xd2e3('0x1')},'clid':{'type':Sequelize[_0xd2e3('0x2')]},'src':{'type':Sequelize[_0xd2e3('0x2')]},'dst':{'type':Sequelize[_0xd2e3('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xd2e3('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xd2e3('0x2')]},'duration':{'type':Sequelize[_0xd2e3('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xd2e3('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd2e3('0x2')]},'amaflags':{'type':Sequelize[_0xd2e3('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xd2e3('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd2e3('0x2')]},'linkedid':{'type':Sequelize[_0xd2e3('0x2')]},'sequence':{'type':Sequelize[_0xd2e3('0x2')]},'peeraccount':{'type':Sequelize[_0xd2e3('0x2')]},'type':{'type':Sequelize[_0xd2e3('0x2')]},'tag':{'type':Sequelize[_0xd2e3('0x2')]}}; \ No newline at end of file +var _0x8801=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x3974dd,_0x3b2c04){var _0x1c4983=function(_0x2a1b26){while(--_0x2a1b26){_0x3974dd['push'](_0x3974dd['shift']());}};_0x1c4983(++_0x3b2c04);}(_0x8801,0x116));var _0x1880=function(_0x3d379f,_0x4d70da){_0x3d379f=_0x3d379f-0x0;var _0x4fb412=_0x8801[_0x3d379f];return _0x4fb412;};'use strict';var Sequelize=require(_0x1880('0x0'));module[_0x1880('0x1')]={'calldate':{'type':Sequelize[_0x1880('0x2')],'allowNull':![],'defaultValue':_0x1880('0x3')},'clid':{'type':Sequelize[_0x1880('0x4')]},'src':{'type':Sequelize[_0x1880('0x4')]},'dst':{'type':Sequelize[_0x1880('0x4')]},'dcontext':{'type':Sequelize[_0x1880('0x4')]},'channel':{'type':Sequelize[_0x1880('0x4')]},'dstchannel':{'type':Sequelize[_0x1880('0x4')]},'lastapp':{'type':Sequelize[_0x1880('0x4')]},'lastdata':{'type':Sequelize[_0x1880('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x1880('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x1880('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x1880('0x4')]},'userfield':{'type':Sequelize[_0x1880('0x4')]},'uniqueid':{'type':Sequelize[_0x1880('0x4')]},'linkedid':{'type':Sequelize[_0x1880('0x4')]},'sequence':{'type':Sequelize[_0x1880('0x4')]},'peeraccount':{'type':Sequelize[_0x1880('0x4')]},'type':{'type':Sequelize[_0x1880('0x4')]},'tag':{'type':Sequelize[_0x1880('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 78d3cae..87c28f4 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 _0xbeea=['stack','name','index','map','Cdr','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','length','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','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','json','offset','undefined','limit','count','apply','save','update','destroy','then','sendStatus'];(function(_0x1ca122,_0x5cab7c){var _0x50d1ba=function(_0x562ae9){while(--_0x562ae9){_0x1ca122['push'](_0x1ca122['shift']());}};_0x50d1ba(++_0x5cab7c);}(_0xbeea,0xb1));var _0xabee=function(_0x14562a,_0x4d3bed){_0x14562a=_0x14562a-0x0;var _0x1d1f9a=_0xbeea[_0x14562a];return _0x1d1f9a;};'use strict';var emlformat=require(_0xabee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xabee('0x1'));var jsonpatch=require(_0xabee('0x2'));var rp=require(_0xabee('0x3'));var moment=require('moment');var BPromise=require(_0xabee('0x4'));var Mustache=require('mustache');var util=require(_0xabee('0x5'));var path=require(_0xabee('0x6'));var sox=require(_0xabee('0x7'));var csv=require(_0xabee('0x8'));var ejs=require(_0xabee('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xabee('0xa'));var crypto=require(_0xabee('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xabee('0xc'));var toCsv=require('to-csv');var querystring=require(_0xabee('0xd'));var Papa=require(_0xabee('0xe'));var Redis=require(_0xabee('0xf'));var authService=require(_0xabee('0x10'));var qs=require(_0xabee('0x11'));var as=require(_0xabee('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xabee('0x13'))(_0xabee('0x14'));var utils=require(_0xabee('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xabee('0x16'));var db=require(_0xabee('0x17'))['db'];function respondWithStatusCode(_0x16d6a5,_0x49fb73){_0x49fb73=_0x49fb73||0xcc;return function(_0x5915a1){if(_0x5915a1){return _0x16d6a5['sendStatus'](_0x49fb73);}return _0x16d6a5['status'](_0x49fb73)['end']();};}function respondWithResult(_0x113c5c,_0x370a4e){_0x370a4e=_0x370a4e||0xc8;return function(_0x38ba29){if(_0x38ba29){return _0x113c5c[_0xabee('0x18')](_0x370a4e)[_0xabee('0x19')](_0x38ba29);}};}function respondWithFilteredResult(_0x5e94ff,_0x177670){return function(_0x2d85a4){if(_0x2d85a4){var _0x2f1107=typeof _0x177670[_0xabee('0x1a')]===_0xabee('0x1b')&&typeof _0x177670[_0xabee('0x1c')]===_0xabee('0x1b');var _0x5a9562=_0x2d85a4[_0xabee('0x1d')];var _0x112bb9=_0x2f1107?0x0:_0x177670[_0xabee('0x1a')];var _0x471b24=_0x2f1107?_0x2d85a4[_0xabee('0x1d')]:_0x177670[_0xabee('0x1a')]+_0x177670['limit'];var _0x47fa3f;if(_0x471b24>=_0x5a9562){_0x471b24=_0x5a9562;_0x47fa3f=0xc8;}else{_0x47fa3f=0xce;}_0x5e94ff[_0xabee('0x18')](_0x47fa3f);return _0x5e94ff['set']('Content-Range',_0x112bb9+'-'+_0x471b24+'/'+_0x5a9562)[_0xabee('0x19')](_0x2d85a4);}return null;};}function patchUpdates(_0x443301){return function(_0x3dd1ff){try{jsonpatch[_0xabee('0x1e')](_0x3dd1ff,_0x443301,!![]);}catch(_0x2b66f5){return BPromise['reject'](_0x2b66f5);}return _0x3dd1ff[_0xabee('0x1f')]();};}function saveUpdates(_0x54014d,_0x4f5501){return function(_0x4926d7){if(_0x4926d7){return _0x4926d7[_0xabee('0x20')](_0x54014d)['then'](function(_0x870569){return _0x870569;});}return null;};}function removeEntity(_0x2834e3,_0x520bc){return function(_0x15a36c){if(_0x15a36c){return _0x15a36c[_0xabee('0x21')]()[_0xabee('0x22')](function(){_0x2834e3[_0xabee('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdbbf57,_0xfc419d){return function(_0x42277e){if(!_0x42277e){_0xdbbf57[_0xabee('0x23')](0x194);}return _0x42277e;};}function handleError(_0x4ae65e,_0x2aa470){_0x2aa470=_0x2aa470||0x1f4;return function(_0x123d58){logger['error'](_0x123d58[_0xabee('0x24')]);if(_0x123d58[_0xabee('0x25')]){delete _0x123d58[_0xabee('0x25')];}_0x4ae65e[_0xabee('0x18')](_0x2aa470)['send'](_0x123d58);};}exports[_0xabee('0x26')]=function(_0x2b7464,_0x1b5aee){var _0x37e780={},_0x1c4f51={},_0x116e41={'count':0x0,'rows':[]};var _0x3df00d=_[_0xabee('0x27')](db[_0xabee('0x28')]['rawAttributes'],function(_0x2a2441){return{'name':_0x2a2441['fieldName'],'type':_0x2a2441[_0xabee('0x29')][_0xabee('0x2a')]};});_0x1c4f51[_0xabee('0x2b')]=_[_0xabee('0x27')](_0x3df00d,'name');_0x1c4f51[_0xabee('0x2c')]=_['keys'](_0x2b7464[_0xabee('0x2c')]);_0x1c4f51['filters']=_[_0xabee('0x2d')](_0x1c4f51['model'],_0x1c4f51['query']);_0x37e780[_0xabee('0x2e')]=_[_0xabee('0x2d')](_0x1c4f51[_0xabee('0x2b')],qs[_0xabee('0x2f')](_0x2b7464[_0xabee('0x2c')][_0xabee('0x2f')]));_0x37e780[_0xabee('0x2e')]=_0x37e780[_0xabee('0x2e')]['length']?_0x37e780[_0xabee('0x2e')]:_0x1c4f51[_0xabee('0x2b')];if(!_0x2b7464[_0xabee('0x2c')][_0xabee('0x30')](_0xabee('0x31'))){_0x37e780[_0xabee('0x1c')]=qs[_0xabee('0x1c')](_0x2b7464[_0xabee('0x2c')][_0xabee('0x1c')]);_0x37e780[_0xabee('0x1a')]=qs[_0xabee('0x1a')](_0x2b7464[_0xabee('0x2c')][_0xabee('0x1a')]);}_0x37e780[_0xabee('0x32')]=qs[_0xabee('0x33')](_0x2b7464[_0xabee('0x2c')][_0xabee('0x33')]);_0x37e780['where']=qs['filters'](_[_0xabee('0x34')](_0x2b7464[_0xabee('0x2c')],_0x1c4f51[_0xabee('0x35')]),_0x3df00d);if(_0x2b7464[_0xabee('0x2c')]['filter']){_0x37e780[_0xabee('0x36')]=_[_0xabee('0x37')](_0x37e780[_0xabee('0x36')],{'$or':_['map'](_0x3df00d,function(_0x1a48d5){if(_0x1a48d5['type']!==_0xabee('0x38')){var _0x879d31={};_0x879d31[_0x1a48d5[_0xabee('0x25')]]={'$like':'%'+_0x2b7464[_0xabee('0x2c')]['filter']+'%'};return _0x879d31;}})});}_0x37e780=_['merge']({},_0x37e780,_0x2b7464[_0xabee('0x39')]);var _0xb76b1d={'where':_0x37e780[_0xabee('0x36')]};return db[_0xabee('0x28')][_0xabee('0x1d')](_0xb76b1d)['then'](function(_0x229b00){_0x116e41[_0xabee('0x1d')]=_0x229b00;if(_0x2b7464['query'][_0xabee('0x3a')]){_0x37e780[_0xabee('0x3b')]=[{'all':!![]}];}return db['Cdr'][_0xabee('0x3c')](_0x37e780);})[_0xabee('0x22')](function(_0x3f05ee){_0x116e41[_0xabee('0x3d')]=_0x3f05ee;return _0x116e41;})[_0xabee('0x22')](respondWithFilteredResult(_0x1b5aee,_0x37e780))[_0xabee('0x3e')](handleError(_0x1b5aee,null));};exports[_0xabee('0x3f')]=function(_0x4ee7e6,_0x36fc07){var _0x22fc91={'raw':!![],'where':{'id':_0x4ee7e6['params']['id']}},_0x206350={};_0x206350[_0xabee('0x2b')]=_[_0xabee('0x40')](db['Cdr'][_0xabee('0x41')]);_0x206350[_0xabee('0x2c')]=_['keys'](_0x4ee7e6[_0xabee('0x2c')]);_0x206350[_0xabee('0x35')]=_[_0xabee('0x2d')](_0x206350[_0xabee('0x2b')],_0x206350[_0xabee('0x2c')]);_0x22fc91[_0xabee('0x2e')]=_[_0xabee('0x2d')](_0x206350['model'],qs[_0xabee('0x2f')](_0x4ee7e6[_0xabee('0x2c')][_0xabee('0x2f')]));_0x22fc91['attributes']=_0x22fc91[_0xabee('0x2e')][_0xabee('0x42')]?_0x22fc91['attributes']:_0x206350['model'];if(_0x4ee7e6['query'][_0xabee('0x3a')]){_0x22fc91[_0xabee('0x3b')]=[{'all':!![]}];}_0x22fc91=_['merge']({},_0x22fc91,_0x4ee7e6['options']);return db[_0xabee('0x28')][_0xabee('0x43')](_0x22fc91)[_0xabee('0x22')](handleEntityNotFound(_0x36fc07,null))[_0xabee('0x22')](respondWithResult(_0x36fc07,null))[_0xabee('0x3e')](handleError(_0x36fc07,null));};exports[_0xabee('0x44')]=function(_0x430b08,_0x307d34){return db[_0xabee('0x28')][_0xabee('0x44')](_0x430b08[_0xabee('0x45')],{})[_0xabee('0x22')](respondWithResult(_0x307d34,0xc9))[_0xabee('0x3e')](handleError(_0x307d34,null));};exports[_0xabee('0x20')]=function(_0x3e277d,_0x252f60){if(_0x3e277d[_0xabee('0x45')]['id']){delete _0x3e277d[_0xabee('0x45')]['id'];}return db['Cdr'][_0xabee('0x43')]({'where':{'id':_0x3e277d[_0xabee('0x46')]['id']}})['then'](handleEntityNotFound(_0x252f60,null))['then'](saveUpdates(_0x3e277d[_0xabee('0x45')],null))[_0xabee('0x22')](respondWithResult(_0x252f60,null))[_0xabee('0x3e')](handleError(_0x252f60,null));};exports[_0xabee('0x21')]=function(_0xe2433f,_0x3d819a){return db[_0xabee('0x28')]['find']({'where':{'id':_0xe2433f[_0xabee('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d819a,null))[_0xabee('0x22')](removeEntity(_0x3d819a,null))[_0xabee('0x3e')](handleError(_0x3d819a,null));};exports['describe']=function(_0x3ebd50,_0x3aaf14){return db[_0xabee('0x28')]['describe']()[_0xabee('0x22')](respondWithResult(_0x3aaf14,null))['catch'](handleError(_0x3aaf14,null));}; \ No newline at end of file +var _0x29d4=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','set','Content-Range','apply','reject','update','then','end','stack','name','send','index','Cdr','rawAttributes','fieldName','type','model','map','query','keys','fields','attributes','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','intersection','find','create','body','destroy','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x52eb27,_0x1a8943){var _0x175a7e=function(_0x16c712){while(--_0x16c712){_0x52eb27['push'](_0x52eb27['shift']());}};_0x175a7e(++_0x1a8943);}(_0x29d4,0x1a1));var _0x429d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x29d4[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x429d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x429d('0x1'));var jsonpatch=require(_0x429d('0x2'));var rp=require(_0x429d('0x3'));var moment=require(_0x429d('0x4'));var BPromise=require(_0x429d('0x5'));var Mustache=require('mustache');var util=require(_0x429d('0x6'));var path=require(_0x429d('0x7'));var sox=require(_0x429d('0x8'));var csv=require(_0x429d('0x9'));var ejs=require(_0x429d('0xa'));var fs=require('fs');var fs_extra=require(_0x429d('0xb'));var _=require(_0x429d('0xc'));var squel=require(_0x429d('0xd'));var crypto=require('crypto');var jsforce=require(_0x429d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x429d('0x9'));var querystring=require(_0x429d('0xf'));var Papa=require(_0x429d('0x10'));var Redis=require('ioredis');var authService=require(_0x429d('0x11'));var qs=require(_0x429d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x429d('0x13'));var logger=require(_0x429d('0x14'))(_0x429d('0x15'));var utils=require('../../config/utils');var config=require(_0x429d('0x16'));var licenseUtil=require(_0x429d('0x17'));var db=require(_0x429d('0x18'))['db'];function respondWithStatusCode(_0x1cb1cf,_0x4843af){_0x4843af=_0x4843af||0xcc;return function(_0x1c542c){if(_0x1c542c){return _0x1cb1cf[_0x429d('0x19')](_0x4843af);}return _0x1cb1cf[_0x429d('0x1a')](_0x4843af)['end']();};}function respondWithResult(_0x315d8d,_0x5dc247){_0x5dc247=_0x5dc247||0xc8;return function(_0x5c32ab){if(_0x5c32ab){return _0x315d8d[_0x429d('0x1a')](_0x5dc247)[_0x429d('0x1b')](_0x5c32ab);}};}function respondWithFilteredResult(_0x1bfbdb,_0x2ee97b){return function(_0x8c8a15){if(_0x8c8a15){var _0x2363a0=typeof _0x2ee97b['offset']===_0x429d('0x1c')&&typeof _0x2ee97b['limit']===_0x429d('0x1c');var _0x35830e=_0x8c8a15[_0x429d('0x1d')];var _0x2dc57a=_0x2363a0?0x0:_0x2ee97b['offset'];var _0x240a7d=_0x2363a0?_0x8c8a15[_0x429d('0x1d')]:_0x2ee97b[_0x429d('0x1e')]+_0x2ee97b['limit'];var _0x329d67;if(_0x240a7d>=_0x35830e){_0x240a7d=_0x35830e;_0x329d67=0xc8;}else{_0x329d67=0xce;}_0x1bfbdb[_0x429d('0x1a')](_0x329d67);return _0x1bfbdb[_0x429d('0x1f')](_0x429d('0x20'),_0x2dc57a+'-'+_0x240a7d+'/'+_0x35830e)[_0x429d('0x1b')](_0x8c8a15);}return null;};}function patchUpdates(_0x4534bd){return function(_0x5a4093){try{jsonpatch[_0x429d('0x21')](_0x5a4093,_0x4534bd,!![]);}catch(_0x165e4d){return BPromise[_0x429d('0x22')](_0x165e4d);}return _0x5a4093['save']();};}function saveUpdates(_0x1492f1,_0x13fc71){return function(_0x452572){if(_0x452572){return _0x452572[_0x429d('0x23')](_0x1492f1)[_0x429d('0x24')](function(_0x1023e6){return _0x1023e6;});}return null;};}function removeEntity(_0x4c6d89,_0x28f84e){return function(_0x3a9a75){if(_0x3a9a75){return _0x3a9a75['destroy']()[_0x429d('0x24')](function(){_0x4c6d89[_0x429d('0x1a')](0xcc)[_0x429d('0x25')]();});}};}function handleEntityNotFound(_0x11c423,_0x5d2e06){return function(_0x3b12f6){if(!_0x3b12f6){_0x11c423[_0x429d('0x19')](0x194);}return _0x3b12f6;};}function handleError(_0x387639,_0x3896ee){_0x3896ee=_0x3896ee||0x1f4;return function(_0x3e4e73){logger['error'](_0x3e4e73[_0x429d('0x26')]);if(_0x3e4e73[_0x429d('0x27')]){delete _0x3e4e73[_0x429d('0x27')];}_0x387639[_0x429d('0x1a')](_0x3896ee)[_0x429d('0x28')](_0x3e4e73);};}exports[_0x429d('0x29')]=function(_0x2351c9,_0xdc7bf9){var _0x2ceb54={},_0x50ef02={},_0x31cae6={'count':0x0,'rows':[]};var _0x3ca640=_['map'](db[_0x429d('0x2a')][_0x429d('0x2b')],function(_0x2e95b5){return{'name':_0x2e95b5[_0x429d('0x2c')],'type':_0x2e95b5[_0x429d('0x2d')]['key']};});_0x50ef02[_0x429d('0x2e')]=_[_0x429d('0x2f')](_0x3ca640,_0x429d('0x27'));_0x50ef02[_0x429d('0x30')]=_[_0x429d('0x31')](_0x2351c9[_0x429d('0x30')]);_0x50ef02['filters']=_['intersection'](_0x50ef02[_0x429d('0x2e')],_0x50ef02[_0x429d('0x30')]);_0x2ceb54['attributes']=_['intersection'](_0x50ef02[_0x429d('0x2e')],qs['fields'](_0x2351c9[_0x429d('0x30')][_0x429d('0x32')]));_0x2ceb54[_0x429d('0x33')]=_0x2ceb54[_0x429d('0x33')]['length']?_0x2ceb54[_0x429d('0x33')]:_0x50ef02[_0x429d('0x2e')];if(!_0x2351c9['query']['hasOwnProperty']('nolimit')){_0x2ceb54['limit']=qs['limit'](_0x2351c9[_0x429d('0x30')]['limit']);_0x2ceb54['offset']=qs[_0x429d('0x1e')](_0x2351c9[_0x429d('0x30')][_0x429d('0x1e')]);}_0x2ceb54[_0x429d('0x34')]=qs[_0x429d('0x35')](_0x2351c9[_0x429d('0x30')]['sort']);_0x2ceb54[_0x429d('0x36')]=qs[_0x429d('0x37')](_[_0x429d('0x38')](_0x2351c9[_0x429d('0x30')],_0x50ef02[_0x429d('0x37')]),_0x3ca640);if(_0x2351c9[_0x429d('0x30')][_0x429d('0x39')]){_0x2ceb54[_0x429d('0x36')]=_[_0x429d('0x3a')](_0x2ceb54[_0x429d('0x36')],{'$or':_[_0x429d('0x2f')](_0x3ca640,function(_0x1e3924){if(_0x1e3924[_0x429d('0x2d')]!==_0x429d('0x3b')){var _0x1a80bc={};_0x1a80bc[_0x1e3924[_0x429d('0x27')]]={'$like':'%'+_0x2351c9['query']['filter']+'%'};return _0x1a80bc;}})});}_0x2ceb54=_[_0x429d('0x3a')]({},_0x2ceb54,_0x2351c9[_0x429d('0x3c')]);var _0x569811={'where':_0x2ceb54[_0x429d('0x36')]};return db[_0x429d('0x2a')][_0x429d('0x1d')](_0x569811)['then'](function(_0x50a907){_0x31cae6[_0x429d('0x1d')]=_0x50a907;if(_0x2351c9[_0x429d('0x30')]['includeAll']){_0x2ceb54[_0x429d('0x3d')]=[{'all':!![]}];}return db[_0x429d('0x2a')]['findAll'](_0x2ceb54);})[_0x429d('0x24')](function(_0x5182d3){_0x31cae6[_0x429d('0x3e')]=_0x5182d3;return _0x31cae6;})[_0x429d('0x24')](respondWithFilteredResult(_0xdc7bf9,_0x2ceb54))[_0x429d('0x3f')](handleError(_0xdc7bf9,null));};exports[_0x429d('0x40')]=function(_0x4da740,_0x34a79c){var _0x38b40c={'raw':!![],'where':{'id':_0x4da740['params']['id']}},_0x2a97c1={};_0x2a97c1['model']=_[_0x429d('0x31')](db[_0x429d('0x2a')][_0x429d('0x2b')]);_0x2a97c1[_0x429d('0x30')]=_['keys'](_0x4da740[_0x429d('0x30')]);_0x2a97c1[_0x429d('0x37')]=_[_0x429d('0x41')](_0x2a97c1[_0x429d('0x2e')],_0x2a97c1[_0x429d('0x30')]);_0x38b40c[_0x429d('0x33')]=_[_0x429d('0x41')](_0x2a97c1[_0x429d('0x2e')],qs[_0x429d('0x32')](_0x4da740[_0x429d('0x30')]['fields']));_0x38b40c[_0x429d('0x33')]=_0x38b40c['attributes']['length']?_0x38b40c['attributes']:_0x2a97c1[_0x429d('0x2e')];if(_0x4da740[_0x429d('0x30')]['includeAll']){_0x38b40c[_0x429d('0x3d')]=[{'all':!![]}];}_0x38b40c=_[_0x429d('0x3a')]({},_0x38b40c,_0x4da740['options']);return db[_0x429d('0x2a')][_0x429d('0x42')](_0x38b40c)[_0x429d('0x24')](handleEntityNotFound(_0x34a79c,null))[_0x429d('0x24')](respondWithResult(_0x34a79c,null))[_0x429d('0x3f')](handleError(_0x34a79c,null));};exports['create']=function(_0x29c7a2,_0xd9451b){return db[_0x429d('0x2a')][_0x429d('0x43')](_0x29c7a2['body'],{})[_0x429d('0x24')](respondWithResult(_0xd9451b,0xc9))[_0x429d('0x3f')](handleError(_0xd9451b,null));};exports[_0x429d('0x23')]=function(_0x58b6c7,_0x471ba5){if(_0x58b6c7['body']['id']){delete _0x58b6c7[_0x429d('0x44')]['id'];}return db[_0x429d('0x2a')][_0x429d('0x42')]({'where':{'id':_0x58b6c7['params']['id']}})['then'](handleEntityNotFound(_0x471ba5,null))[_0x429d('0x24')](saveUpdates(_0x58b6c7['body'],null))[_0x429d('0x24')](respondWithResult(_0x471ba5,null))[_0x429d('0x3f')](handleError(_0x471ba5,null));};exports[_0x429d('0x45')]=function(_0x25121e,_0x31d1e7){return db[_0x429d('0x2a')][_0x429d('0x42')]({'where':{'id':_0x25121e[_0x429d('0x46')]['id']}})['then'](handleEntityNotFound(_0x31d1e7,null))['then'](removeEntity(_0x31d1e7,null))[_0x429d('0x3f')](handleError(_0x31d1e7,null));};exports[_0x429d('0x47')]=function(_0x18f172,_0x3a15d1){return db['Cdr'][_0x429d('0x47')]()[_0x429d('0x24')](respondWithResult(_0x3a15d1,null))[_0x429d('0x3f')](handleError(_0x3a15d1,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index b6489b6..8eca46c 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x5eacf6,_0x174135){var _0x1f68a1=function(_0x5277bb){while(--_0x5277bb){_0x5eacf6['push'](_0x5eacf6['shift']());}};_0x1f68a1(++_0x174135);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x156a8c,_0x5a0f60){var _0x3e8d88=function(_0x31a905){while(--_0x31a905){_0x156a8c['push'](_0x156a8c['shift']());}};_0x3e8d88(++_0x5a0f60);}(_0x7a54,0x106));var _0x47a5=function(_0x57fd2a,_0x20709b){_0x57fd2a=_0x57fd2a-0x0;var _0x54b29f=_0x7a54[_0x57fd2a];return _0x54b29f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 0c41969..7846826 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 _0xb1c9=['request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s'];(function(_0x64c6e3,_0x3b5371){var _0x69c52f=function(_0x573d04){while(--_0x573d04){_0x64c6e3['push'](_0x64c6e3['shift']());}};_0x69c52f(++_0x3b5371);}(_0xb1c9,0x153));var _0x9b1c=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb1c9[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x9b1c('0x0'));var moment=require(_0x9b1c('0x1'));var BPromise=require('bluebird');var rs=require(_0x9b1c('0x2'));var fs=require('fs');var Redis=require(_0x9b1c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b1c('0x4'));var logger=require(_0x9b1c('0x5'))(_0x9b1c('0x6'));var config=require('../../config/environment');var jayson=require(_0x9b1c('0x7'));var client=jayson[_0x9b1c('0x8')][_0x9b1c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3675ed,_0x1d523e,_0x1f268b){return new BPromise(function(_0x13f597,_0x3d66a5){return client['request'](_0x3675ed,_0x1f268b)[_0x9b1c('0xa')](function(_0x19e3cc){logger[_0x9b1c('0xb')](_0x9b1c('0xc'),_0x1d523e,_0x9b1c('0xd'));logger[_0x9b1c('0xe')](_0x9b1c('0xf'),_0x1d523e,_0x9b1c('0xd'),JSON[_0x9b1c('0x10')](_0x19e3cc));if(_0x19e3cc[_0x9b1c('0x11')]){if(_0x19e3cc['error'][_0x9b1c('0x12')]===0x1f4){logger[_0x9b1c('0x11')](_0x9b1c('0xc'),_0x1d523e,_0x19e3cc['error'][_0x9b1c('0x13')]);return _0x3d66a5(_0x19e3cc[_0x9b1c('0x11')]['message']);}logger[_0x9b1c('0x11')](_0x9b1c('0xc'),_0x1d523e,_0x19e3cc['error'][_0x9b1c('0x13')]);return _0x13f597(_0x19e3cc['error'][_0x9b1c('0x13')]);}else{logger[_0x9b1c('0xb')]('Cdr,\x20%s,\x20%s',_0x1d523e,_0x9b1c('0xd'));_0x13f597(_0x19e3cc[_0x9b1c('0x14')]['message']);}})[_0x9b1c('0x15')](function(_0x15f7e3){logger[_0x9b1c('0x11')](_0x9b1c('0xc'),_0x1d523e,_0x15f7e3);_0x3d66a5(_0x15f7e3);});});} \ No newline at end of file +var _0x91da=['then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','lodash','util','moment','randomstring','jayson/promise','http','request'];(function(_0x592539,_0x377bbf){var _0x4ce0bf=function(_0x1c33b7){while(--_0x1c33b7){_0x592539['push'](_0x592539['shift']());}};_0x4ce0bf(++_0x377bbf);}(_0x91da,0x129));var _0xa91d=function(_0x53e614,_0x6b7064){_0x53e614=_0x53e614-0x0;var _0x37b787=_0x91da[_0x53e614];return _0x37b787;};'use strict';var _=require(_0xa91d('0x0'));var util=require(_0xa91d('0x1'));var moment=require(_0xa91d('0x2'));var BPromise=require('bluebird');var rs=require(_0xa91d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa91d('0x4'));var client=jayson['client'][_0xa91d('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x36c89f,_0x4bfcec,_0x312f87){return new BPromise(function(_0x5e2397,_0xe3d591){return client[_0xa91d('0x6')](_0x36c89f,_0x312f87)[_0xa91d('0x7')](function(_0x5be12d){logger['info'](_0xa91d('0x8'),_0x4bfcec,_0xa91d('0x9'));logger[_0xa91d('0xa')](_0xa91d('0xb'),_0x4bfcec,_0xa91d('0x9'),JSON[_0xa91d('0xc')](_0x5be12d));if(_0x5be12d['error']){if(_0x5be12d['error'][_0xa91d('0xd')]===0x1f4){logger['error'](_0xa91d('0x8'),_0x4bfcec,_0x5be12d[_0xa91d('0xe')]['message']);return _0xe3d591(_0x5be12d['error'][_0xa91d('0xf')]);}logger[_0xa91d('0xe')]('Cdr,\x20%s,\x20%s',_0x4bfcec,_0x5be12d[_0xa91d('0xe')][_0xa91d('0xf')]);return _0x5e2397(_0x5be12d[_0xa91d('0xe')][_0xa91d('0xf')]);}else{logger[_0xa91d('0x10')](_0xa91d('0x8'),_0x4bfcec,'request\x20sent');_0x5e2397(_0x5be12d[_0xa91d('0x11')][_0xa91d('0xf')]);}})[_0xa91d('0x12')](function(_0x115b8f){logger[_0xa91d('0xe')](_0xa91d('0x8'),_0x4bfcec,_0x115b8f);_0xe3d591(_0x115b8f);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index ce8db5f..a325943 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(_0x248635,_0x30086d){var _0x1d8ac2=function(_0x23ec2b){while(--_0x23ec2b){_0x248635['push'](_0x248635['shift']());}};_0x1d8ac2(++_0x30086d);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f4d7f,_0x62f4b7){_0x2f4d7f=_0x2f4d7f-0x0;var _0x147ba1=_0xb10b[_0x2f4d7f];return _0x147ba1;};'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 _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x1d8a15,_0x4acbca){var _0x17b14b=function(_0x52c9e9){while(--_0x52c9e9){_0x1d8a15['push'](_0x1d8a15['shift']());}};_0x17b14b(++_0x4acbca);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index a9169a3..59cf394 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 _0xbcda=['TEXT','sequelize','INTEGER','STRING','noop'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xbcda,0xec));var _0xabcd=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xbcda[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require(_0xabcd('0x0'));module['exports']={'priority':{'type':Sequelize[_0xabcd('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xabcd('0x2')],'allowNull':![],'defaultValue':_0xabcd('0x3')},'appdata':{'type':Sequelize[_0xabcd('0x4')]()},'description':{'type':Sequelize[_0xabcd('0x2')]},'interval':{'type':Sequelize[_0xabcd('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x0414=['exports','noop','STRING','*,*,*,*','sequelize'];(function(_0x144cea,_0x3dd602){var _0x127f33=function(_0x276f11){while(--_0x276f11){_0x144cea['push'](_0x144cea['shift']());}};_0x127f33(++_0x3dd602);}(_0x0414,0x1bc));var _0x4041=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x0414[_0x45bf86];return _0x1f02b7;};'use strict';var Sequelize=require(_0x4041('0x0'));module[_0x4041('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4041('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4041('0x3')],'defaultValue':_0x4041('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 2b363d9..cfe77b7 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 _0x9e0d=['sox','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/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','show','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','ChatApplication','find','catch','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0xe423d4,_0x58de89){var _0x3fe2ff=function(_0x43d96c){while(--_0x43d96c){_0xe423d4['push'](_0xe423d4['shift']());}};_0x3fe2ff(++_0x58de89);}(_0x9e0d,0xf7));var _0xd9e0=function(_0x46fa5e,_0x3973d7){_0x46fa5e=_0x46fa5e-0x0;var _0x2a9360=_0x9e0d[_0x46fa5e];return _0x2a9360;};'use strict';var emlformat=require(_0xd9e0('0x0'));var rimraf=require(_0xd9e0('0x1'));var zipdir=require(_0xd9e0('0x2'));var jsonpatch=require(_0xd9e0('0x3'));var rp=require('request-promise');var moment=require(_0xd9e0('0x4'));var BPromise=require(_0xd9e0('0x5'));var Mustache=require(_0xd9e0('0x6'));var util=require(_0xd9e0('0x7'));var path=require(_0xd9e0('0x8'));var sox=require(_0xd9e0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd9e0('0xa'));var _=require(_0xd9e0('0xb'));var squel=require(_0xd9e0('0xc'));var crypto=require(_0xd9e0('0xd'));var jsforce=require(_0xd9e0('0xe'));var deskjs=require(_0xd9e0('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd9e0('0x10'));var Papa=require(_0xd9e0('0x11'));var Redis=require(_0xd9e0('0x12'));var authService=require(_0xd9e0('0x13'));var qs=require(_0xd9e0('0x14'));var as=require(_0xd9e0('0x15'));var hardwareService=require(_0xd9e0('0x16'));var logger=require('../../config/logger')(_0xd9e0('0x17'));var utils=require(_0xd9e0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd9e0('0x19'));var db=require(_0xd9e0('0x1a'))['db'];function respondWithStatusCode(_0x418d84,_0x1fb454){_0x1fb454=_0x1fb454||0xcc;return function(_0x18fdf2){if(_0x18fdf2){return _0x418d84['sendStatus'](_0x1fb454);}return _0x418d84[_0xd9e0('0x1b')](_0x1fb454)['end']();};}function respondWithResult(_0x2f311c,_0x55c704){_0x55c704=_0x55c704||0xc8;return function(_0x24d361){if(_0x24d361){return _0x2f311c[_0xd9e0('0x1b')](_0x55c704)[_0xd9e0('0x1c')](_0x24d361);}};}function respondWithFilteredResult(_0x18301b,_0x3e4c5d){return function(_0x4da900){if(_0x4da900){var _0x58d44c=typeof _0x3e4c5d['offset']===_0xd9e0('0x1d')&&typeof _0x3e4c5d[_0xd9e0('0x1e')]===_0xd9e0('0x1d');var _0x1cdcb6=_0x4da900['count'];var _0x209c04=_0x58d44c?0x0:_0x3e4c5d['offset'];var _0x483b74=_0x58d44c?_0x4da900[_0xd9e0('0x1f')]:_0x3e4c5d[_0xd9e0('0x20')]+_0x3e4c5d['limit'];var _0x5ac8f5;if(_0x483b74>=_0x1cdcb6){_0x483b74=_0x1cdcb6;_0x5ac8f5=0xc8;}else{_0x5ac8f5=0xce;}_0x18301b[_0xd9e0('0x1b')](_0x5ac8f5);return _0x18301b[_0xd9e0('0x21')]('Content-Range',_0x209c04+'-'+_0x483b74+'/'+_0x1cdcb6)[_0xd9e0('0x1c')](_0x4da900);}return null;};}function patchUpdates(_0x4cc3c9){return function(_0xd3d455){try{jsonpatch[_0xd9e0('0x22')](_0xd3d455,_0x4cc3c9,!![]);}catch(_0x67f69f){return BPromise[_0xd9e0('0x23')](_0x67f69f);}return _0xd3d455[_0xd9e0('0x24')]();};}function saveUpdates(_0x5711a1,_0x19534a){return function(_0x333233){if(_0x333233){return _0x333233['update'](_0x5711a1)[_0xd9e0('0x25')](function(_0x124ca7){return _0x124ca7;});}return null;};}function removeEntity(_0x5d4549,_0x357bd9){return function(_0x5e17d4){if(_0x5e17d4){return _0x5e17d4[_0xd9e0('0x26')]()[_0xd9e0('0x25')](function(){_0x5d4549['status'](0xcc)[_0xd9e0('0x27')]();});}};}function handleEntityNotFound(_0x53cf67,_0x554aeb){return function(_0x50f57d){if(!_0x50f57d){_0x53cf67[_0xd9e0('0x28')](0x194);}return _0x50f57d;};}function handleError(_0x21c796,_0x7065c6){_0x7065c6=_0x7065c6||0x1f4;return function(_0x1c36df){logger[_0xd9e0('0x29')](_0x1c36df[_0xd9e0('0x2a')]);if(_0x1c36df[_0xd9e0('0x2b')]){delete _0x1c36df['name'];}_0x21c796[_0xd9e0('0x1b')](_0x7065c6)[_0xd9e0('0x2c')](_0x1c36df);};}exports[_0xd9e0('0x2d')]=function(_0x17a899,_0x2738e9){var _0x4f5367={'raw':!![],'where':{'id':_0x17a899['params']['id']}},_0x4b4f7d={};_0x4b4f7d[_0xd9e0('0x2e')]=_[_0xd9e0('0x2f')](db['ChatApplication'][_0xd9e0('0x30')]);_0x4b4f7d[_0xd9e0('0x31')]=_[_0xd9e0('0x2f')](_0x17a899[_0xd9e0('0x31')]);_0x4b4f7d[_0xd9e0('0x32')]=_[_0xd9e0('0x33')](_0x4b4f7d[_0xd9e0('0x2e')],_0x4b4f7d['query']);_0x4f5367[_0xd9e0('0x34')]=_[_0xd9e0('0x33')](_0x4b4f7d[_0xd9e0('0x2e')],qs[_0xd9e0('0x35')](_0x17a899[_0xd9e0('0x31')][_0xd9e0('0x35')]));_0x4f5367[_0xd9e0('0x34')]=_0x4f5367[_0xd9e0('0x34')][_0xd9e0('0x36')]?_0x4f5367[_0xd9e0('0x34')]:_0x4b4f7d[_0xd9e0('0x2e')];if(_0x17a899[_0xd9e0('0x31')]['includeAll']){_0x4f5367[_0xd9e0('0x37')]=[{'all':!![]}];}_0x4f5367=_[_0xd9e0('0x38')]({},_0x4f5367,_0x17a899[_0xd9e0('0x39')]);return db[_0xd9e0('0x3a')][_0xd9e0('0x3b')](_0x4f5367)['then'](handleEntityNotFound(_0x2738e9,null))[_0xd9e0('0x25')](respondWithResult(_0x2738e9,null))[_0xd9e0('0x3c')](handleError(_0x2738e9,null));};exports[_0xd9e0('0x3d')]=function(_0x23901a,_0x588f8c){if(_0x23901a[_0xd9e0('0x3e')]['id']){delete _0x23901a['body']['id'];}return db[_0xd9e0('0x3a')][_0xd9e0('0x3b')]({'where':{'id':_0x23901a[_0xd9e0('0x3f')]['id']}})[_0xd9e0('0x25')](handleEntityNotFound(_0x588f8c,null))[_0xd9e0('0x25')](saveUpdates(_0x23901a[_0xd9e0('0x3e')],null))[_0xd9e0('0x25')](respondWithResult(_0x588f8c,null))[_0xd9e0('0x3c')](handleError(_0x588f8c,null));};exports[_0xd9e0('0x26')]=function(_0x5065f7,_0x318679){return db[_0xd9e0('0x3a')][_0xd9e0('0x3b')]({'where':{'id':_0x5065f7[_0xd9e0('0x3f')]['id']}})['then'](handleEntityNotFound(_0x318679,null))[_0xd9e0('0x25')](removeEntity(_0x318679,null))[_0xd9e0('0x3c')](handleError(_0x318679,null));}; \ No newline at end of file +var _0xef38=['../../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','then','destroy','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','attributes','length','include','merge','options','find','body','catch','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x437e46,_0x37ff2e){var _0x27c0d5=function(_0x788a02){while(--_0x788a02){_0x437e46['push'](_0x437e46['shift']());}};_0x27c0d5(++_0x37ff2e);}(_0xef38,0x122));var _0x8ef3=function(_0x508df1,_0x5ab76b){_0x508df1=_0x508df1-0x0;var _0x175dc7=_0xef38[_0x508df1];return _0x175dc7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ef3('0x0'));var zipdir=require(_0x8ef3('0x1'));var jsonpatch=require(_0x8ef3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8ef3('0x3'));var Mustache=require(_0x8ef3('0x4'));var util=require(_0x8ef3('0x5'));var path=require(_0x8ef3('0x6'));var sox=require(_0x8ef3('0x7'));var csv=require('to-csv');var ejs=require(_0x8ef3('0x8'));var fs=require('fs');var fs_extra=require(_0x8ef3('0x9'));var _=require('lodash');var squel=require(_0x8ef3('0xa'));var crypto=require(_0x8ef3('0xb'));var jsforce=require(_0x8ef3('0xc'));var deskjs=require(_0x8ef3('0xd'));var toCsv=require(_0x8ef3('0xe'));var querystring=require(_0x8ef3('0xf'));var Papa=require(_0x8ef3('0x10'));var Redis=require('ioredis');var authService=require(_0x8ef3('0x11'));var qs=require(_0x8ef3('0x12'));var as=require(_0x8ef3('0x13'));var hardwareService=require(_0x8ef3('0x14'));var logger=require(_0x8ef3('0x15'))(_0x8ef3('0x16'));var utils=require(_0x8ef3('0x17'));var config=require(_0x8ef3('0x18'));var licenseUtil=require(_0x8ef3('0x19'));var db=require(_0x8ef3('0x1a'))['db'];function respondWithStatusCode(_0x1cf33a,_0x451cfe){_0x451cfe=_0x451cfe||0xcc;return function(_0x6fea77){if(_0x6fea77){return _0x1cf33a[_0x8ef3('0x1b')](_0x451cfe);}return _0x1cf33a[_0x8ef3('0x1c')](_0x451cfe)[_0x8ef3('0x1d')]();};}function respondWithResult(_0x3d5b1a,_0x20be3d){_0x20be3d=_0x20be3d||0xc8;return function(_0x398c30){if(_0x398c30){return _0x3d5b1a['status'](_0x20be3d)[_0x8ef3('0x1e')](_0x398c30);}};}function respondWithFilteredResult(_0x53af4a,_0x472741){return function(_0x5b0ef6){if(_0x5b0ef6){var _0x22feec=typeof _0x472741[_0x8ef3('0x1f')]==='undefined'&&typeof _0x472741['limit']===_0x8ef3('0x20');var _0x2bc37a=_0x5b0ef6[_0x8ef3('0x21')];var _0x434aa9=_0x22feec?0x0:_0x472741['offset'];var _0x5cbed2=_0x22feec?_0x5b0ef6[_0x8ef3('0x21')]:_0x472741[_0x8ef3('0x1f')]+_0x472741[_0x8ef3('0x22')];var _0x4163a4;if(_0x5cbed2>=_0x2bc37a){_0x5cbed2=_0x2bc37a;_0x4163a4=0xc8;}else{_0x4163a4=0xce;}_0x53af4a['status'](_0x4163a4);return _0x53af4a[_0x8ef3('0x23')](_0x8ef3('0x24'),_0x434aa9+'-'+_0x5cbed2+'/'+_0x2bc37a)[_0x8ef3('0x1e')](_0x5b0ef6);}return null;};}function patchUpdates(_0x5856a0){return function(_0x59375c){try{jsonpatch[_0x8ef3('0x25')](_0x59375c,_0x5856a0,!![]);}catch(_0xbe957b){return BPromise[_0x8ef3('0x26')](_0xbe957b);}return _0x59375c[_0x8ef3('0x27')]();};}function saveUpdates(_0x15825e,_0x8fc5cd){return function(_0x1231e8){if(_0x1231e8){return _0x1231e8['update'](_0x15825e)[_0x8ef3('0x28')](function(_0x1b3357){return _0x1b3357;});}return null;};}function removeEntity(_0x513860,_0xa9829e){return function(_0x431e8c){if(_0x431e8c){return _0x431e8c[_0x8ef3('0x29')]()[_0x8ef3('0x28')](function(){_0x513860[_0x8ef3('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18ef45,_0x3c4581){return function(_0x33f885){if(!_0x33f885){_0x18ef45[_0x8ef3('0x1b')](0x194);}return _0x33f885;};}function handleError(_0x59b673,_0x3441ce){_0x3441ce=_0x3441ce||0x1f4;return function(_0x28637a){logger[_0x8ef3('0x2a')](_0x28637a[_0x8ef3('0x2b')]);if(_0x28637a[_0x8ef3('0x2c')]){delete _0x28637a[_0x8ef3('0x2c')];}_0x59b673[_0x8ef3('0x1c')](_0x3441ce)[_0x8ef3('0x2d')](_0x28637a);};}exports[_0x8ef3('0x2e')]=function(_0xe4e2ba,_0x23dacc){var _0x594a25={'raw':!![],'where':{'id':_0xe4e2ba[_0x8ef3('0x2f')]['id']}},_0x4408f9={};_0x4408f9[_0x8ef3('0x30')]=_[_0x8ef3('0x31')](db[_0x8ef3('0x32')][_0x8ef3('0x33')]);_0x4408f9[_0x8ef3('0x34')]=_['keys'](_0xe4e2ba['query']);_0x4408f9[_0x8ef3('0x35')]=_['intersection'](_0x4408f9[_0x8ef3('0x30')],_0x4408f9[_0x8ef3('0x34')]);_0x594a25[_0x8ef3('0x36')]=_['intersection'](_0x4408f9['model'],qs['fields'](_0xe4e2ba['query']['fields']));_0x594a25[_0x8ef3('0x36')]=_0x594a25[_0x8ef3('0x36')][_0x8ef3('0x37')]?_0x594a25['attributes']:_0x4408f9[_0x8ef3('0x30')];if(_0xe4e2ba[_0x8ef3('0x34')]['includeAll']){_0x594a25[_0x8ef3('0x38')]=[{'all':!![]}];}_0x594a25=_[_0x8ef3('0x39')]({},_0x594a25,_0xe4e2ba[_0x8ef3('0x3a')]);return db['ChatApplication'][_0x8ef3('0x3b')](_0x594a25)['then'](handleEntityNotFound(_0x23dacc,null))[_0x8ef3('0x28')](respondWithResult(_0x23dacc,null))['catch'](handleError(_0x23dacc,null));};exports['update']=function(_0x5e864d,_0x574d87){if(_0x5e864d['body']['id']){delete _0x5e864d[_0x8ef3('0x3c')]['id'];}return db['ChatApplication'][_0x8ef3('0x3b')]({'where':{'id':_0x5e864d['params']['id']}})[_0x8ef3('0x28')](handleEntityNotFound(_0x574d87,null))[_0x8ef3('0x28')](saveUpdates(_0x5e864d[_0x8ef3('0x3c')],null))['then'](respondWithResult(_0x574d87,null))['catch'](handleError(_0x574d87,null));};exports[_0x8ef3('0x29')]=function(_0x1bf3b0,_0x2436d5){return db[_0x8ef3('0x32')][_0x8ef3('0x3b')]({'where':{'id':_0x1bf3b0['params']['id']}})[_0x8ef3('0x28')](handleEntityNotFound(_0x2436d5,null))[_0x8ef3('0x28')](removeEntity(_0x2436d5,null))[_0x8ef3('0x3d')](handleError(_0x2436d5,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 6770a5e..296ce4e 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 _0xa2ab=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','define','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x57052c,_0x434562){var _0x389166=function(_0x1c3e56){while(--_0x1c3e56){_0x57052c['push'](_0x57052c['shift']());}};_0x389166(++_0x434562);}(_0xa2ab,0xa7));var _0xba2a=function(_0x10d8ad,_0x4c10fa){_0x10d8ad=_0x10d8ad-0x0;var _0x212cfc=_0xa2ab[_0x10d8ad];return _0x212cfc;};'use strict';var _=require(_0xba2a('0x0'));var util=require(_0xba2a('0x1'));var logger=require(_0xba2a('0x2'))('api');var moment=require(_0xba2a('0x3'));var BPromise=require(_0xba2a('0x4'));var rp=require(_0xba2a('0x5'));var fs=require('fs');var path=require(_0xba2a('0x6'));var rimraf=require(_0xba2a('0x7'));var config=require(_0xba2a('0x8'));var attributes=require(_0xba2a('0x9'));module['exports']=function(_0x12f994,_0x42e864){return _0x12f994[_0xba2a('0xa')]('ChatApplication',attributes,{'tableName':_0xba2a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xba2a('0xc'),'collate':_0xba2a('0xd')});}; \ No newline at end of file +var _0xaee2=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications'];(function(_0x1639be,_0x4ac980){var _0x4af3e1=function(_0x1a24cb){while(--_0x1a24cb){_0x1639be['push'](_0x1639be['shift']());}};_0x4af3e1(++_0x4ac980);}(_0xaee2,0xf2));var _0x2aee=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0xaee2[_0x47e549];return _0x251374;};'use strict';var _=require(_0x2aee('0x0'));var util=require(_0x2aee('0x1'));var logger=require(_0x2aee('0x2'))(_0x2aee('0x3'));var moment=require(_0x2aee('0x4'));var BPromise=require(_0x2aee('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2aee('0x6'));var config=require(_0x2aee('0x7'));var attributes=require(_0x2aee('0x8'));module[_0x2aee('0x9')]=function(_0x4a652a,_0x2e3b3d){return _0x4a652a[_0x2aee('0xa')](_0x2aee('0xb'),attributes,{'tableName':_0x2aee('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2aee('0xd'),'collate':_0x2aee('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index b96cd0b..2911caf 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 _0x3d0d=['request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3d0d,0xc8));var _0xd3d0=function(_0xf9ae3c,_0x5f5351){_0xf9ae3c=_0xf9ae3c-0x0;var _0x46e1f=_0x3d0d[_0xf9ae3c];return _0x46e1f;};'use strict';var _=require(_0xd3d0('0x0'));var util=require(_0xd3d0('0x1'));var moment=require(_0xd3d0('0x2'));var BPromise=require(_0xd3d0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd3d0('0x4'));var db=require(_0xd3d0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd3d0('0x6'))(_0xd3d0('0x7'));var config=require(_0xd3d0('0x8'));var jayson=require(_0xd3d0('0x9'));var client=jayson[_0xd3d0('0xa')][_0xd3d0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52304f,_0x5b3e0a,_0x523533){return new BPromise(function(_0x16fef1,_0x599bf8){return client[_0xd3d0('0xc')](_0x52304f,_0x523533)[_0xd3d0('0xd')](function(_0x26b1a7){logger[_0xd3d0('0xe')](_0xd3d0('0xf'),_0x5b3e0a,_0xd3d0('0x10'));logger[_0xd3d0('0x11')](_0xd3d0('0x12'),_0x5b3e0a,_0xd3d0('0x10'),JSON[_0xd3d0('0x13')](_0x26b1a7));if(_0x26b1a7[_0xd3d0('0x14')]){if(_0x26b1a7[_0xd3d0('0x14')][_0xd3d0('0x15')]===0x1f4){logger[_0xd3d0('0x14')](_0xd3d0('0xf'),_0x5b3e0a,_0x26b1a7['error'][_0xd3d0('0x16')]);return _0x599bf8(_0x26b1a7['error'][_0xd3d0('0x16')]);}logger['error'](_0xd3d0('0xf'),_0x5b3e0a,_0x26b1a7[_0xd3d0('0x14')][_0xd3d0('0x16')]);return _0x16fef1(_0x26b1a7[_0xd3d0('0x14')][_0xd3d0('0x16')]);}else{logger[_0xd3d0('0xe')](_0xd3d0('0xf'),_0x5b3e0a,_0xd3d0('0x10'));_0x16fef1(_0x26b1a7[_0xd3d0('0x17')][_0xd3d0('0x16')]);}})['catch'](function(_0x20258e){logger[_0xd3d0('0x14')]('ChatApplication,\x20%s,\x20%s',_0x5b3e0a,_0x20258e);_0x599bf8(_0x20258e);});});} \ No newline at end of file +var _0x98ef=['randomstring','ioredis','../../config/utils','../../config/environment','client','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird'];(function(_0x162f1f,_0xdc0681){var _0x2d1aa7=function(_0x486cf8){while(--_0x486cf8){_0x162f1f['push'](_0x162f1f['shift']());}};_0x2d1aa7(++_0xdc0681);}(_0x98ef,0x90));var _0xf98e=function(_0xe919cf,_0x2d624d){_0xe919cf=_0xe919cf-0x0;var _0x1f3667=_0x98ef[_0xe919cf];return _0x1f3667;};'use strict';var _=require(_0xf98e('0x0'));var util=require(_0xf98e('0x1'));var moment=require('moment');var BPromise=require(_0xf98e('0x2'));var rs=require(_0xf98e('0x3'));var fs=require('fs');var Redis=require(_0xf98e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf98e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf98e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf98e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x170d67,_0x140895,_0x4c2f23){return new BPromise(function(_0x568f8c,_0x27efac){return client[_0xf98e('0x8')](_0x170d67,_0x4c2f23)[_0xf98e('0x9')](function(_0x2a6d88){logger[_0xf98e('0xa')]('ChatApplication,\x20%s,\x20%s',_0x140895,_0xf98e('0xb'));logger[_0xf98e('0xc')](_0xf98e('0xd'),_0x140895,_0xf98e('0xb'),JSON[_0xf98e('0xe')](_0x2a6d88));if(_0x2a6d88[_0xf98e('0xf')]){if(_0x2a6d88['error'][_0xf98e('0x10')]===0x1f4){logger['error'](_0xf98e('0x11'),_0x140895,_0x2a6d88[_0xf98e('0xf')][_0xf98e('0x12')]);return _0x27efac(_0x2a6d88[_0xf98e('0xf')][_0xf98e('0x12')]);}logger[_0xf98e('0xf')](_0xf98e('0x11'),_0x140895,_0x2a6d88[_0xf98e('0xf')][_0xf98e('0x12')]);return _0x568f8c(_0x2a6d88[_0xf98e('0xf')][_0xf98e('0x12')]);}else{logger[_0xf98e('0xa')](_0xf98e('0x11'),_0x140895,_0xf98e('0xb'));_0x568f8c(_0x2a6d88[_0xf98e('0x13')][_0xf98e('0x12')]);}})[_0xf98e('0x14')](function(_0x164f58){logger[_0xf98e('0xf')]('ChatApplication,\x20%s,\x20%s',_0x140895,_0x164f58);_0x27efac(_0x164f58);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 791d6dc..8a666d5 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 _0xfb09=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xfb09,0x17a));var _0x9fb0=function(_0x11d32b,_0x2d2388){_0x11d32b=_0x11d32b-0x0;var _0x43fbec=_0xfb09[_0x11d32b];return _0x43fbec;};'use strict';var multer=require(_0x9fb0('0x0'));var util=require(_0x9fb0('0x1'));var path=require(_0x9fb0('0x2'));var timeout=require(_0x9fb0('0x3'));var express=require(_0x9fb0('0x4'));var router=express[_0x9fb0('0x5')]();var fs_extra=require(_0x9fb0('0x6'));var auth=require(_0x9fb0('0x7'));var interaction=require(_0x9fb0('0x8'));var config=require('../../config/environment');var controller=require(_0x9fb0('0x9'));router[_0x9fb0('0xa')](_0x9fb0('0xb'),auth['isAuthenticated'](),controller['show']);router['put']('/:id',auth[_0x9fb0('0xc')](),controller[_0x9fb0('0xd')]);router[_0x9fb0('0xe')](_0x9fb0('0xb'),auth[_0x9fb0('0xc')](),controller[_0x9fb0('0xf')]);module[_0x9fb0('0x10')]=router; \ No newline at end of file +var _0xee2e=['put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show'];(function(_0xd488ef,_0x1aca85){var _0x116e93=function(_0xc2a0c6){while(--_0xc2a0c6){_0xd488ef['push'](_0xd488ef['shift']());}};_0x116e93(++_0x1aca85);}(_0xee2e,0xbf));var _0xeee2=function(_0x491b2d,_0x306fdf){_0x491b2d=_0x491b2d-0x0;var _0x55006b=_0xee2e[_0x491b2d];return _0x55006b;};'use strict';var multer=require(_0xeee2('0x0'));var util=require(_0xeee2('0x1'));var path=require('path');var timeout=require(_0xeee2('0x2'));var express=require(_0xeee2('0x3'));var router=express[_0xeee2('0x4')]();var fs_extra=require(_0xeee2('0x5'));var auth=require(_0xeee2('0x6'));var interaction=require(_0xeee2('0x7'));var config=require(_0xeee2('0x8'));var controller=require(_0xeee2('0x9'));router['get'](_0xeee2('0xa'),auth[_0xeee2('0xb')](),controller[_0xeee2('0xc')]);router[_0xeee2('0xd')](_0xeee2('0xa'),auth['isAuthenticated'](),controller[_0xeee2('0xe')]);router['delete'](_0xeee2('0xa'),auth[_0xeee2('0xb')](),controller[_0xeee2('0xf')]);module[_0xeee2('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index aaa2379..78e4b8b 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 _0x49b9=['exports','STRING'];(function(_0x54e3a5,_0x4113ef){var _0x4a23b6=function(_0x5d240a){while(--_0x5d240a){_0x54e3a5['push'](_0x54e3a5['shift']());}};_0x4a23b6(++_0x4113ef);}(_0x49b9,0xaa));var _0x949b=function(_0x5ada29,_0x5aba7c){_0x5ada29=_0x5ada29-0x0;var _0x46cdad=_0x49b9[_0x5ada29];return _0x46cdad;};'use strict';var Sequelize=require('sequelize');module[_0x949b('0x0')]={'name':{'type':Sequelize[_0x949b('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x949b('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x0355=['exports','STRING','sequelize'];(function(_0x19e422,_0x1be017){var _0x4cb65a=function(_0x50f7e1){while(--_0x50f7e1){_0x19e422['push'](_0x19e422['shift']());}};_0x4cb65a(++_0x1be017);}(_0x0355,0xb6));var _0x5035=function(_0x2356e6,_0x130b1f){_0x2356e6=_0x2356e6-0x0;var _0x31094e=_0x0355[_0x2356e6];return _0x31094e;};'use strict';var Sequelize=require(_0x5035('0x0'));module[_0x5035('0x1')]={'name':{'type':Sequelize[_0x5035('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5035('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 94e49f2..39b7dc9 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 _0x6588=['hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','ChatGroup','include','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body','params','describe','getUnread','user','toInteger','addMembers','omit','ids','getMembers','User','removeMembers','addMessage','ChatGroupId','findOne','ChatInternalMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0x3a57c5,_0x2a91be){var _0xf33de0=function(_0x55b13b){while(--_0x55b13b){_0x3a57c5['push'](_0x3a57c5['shift']());}};_0xf33de0(++_0x2a91be);}(_0x6588,0xf0));var _0x8658=function(_0x1a58d1,_0xa90685){_0x1a58d1=_0x1a58d1-0x0;var _0x101adc=_0x6588[_0x1a58d1];return _0x101adc;};'use strict';var emlformat=require(_0x8658('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8658('0x1'));var jsonpatch=require(_0x8658('0x2'));var rp=require('request-promise');var moment=require(_0x8658('0x3'));var BPromise=require(_0x8658('0x4'));var Mustache=require(_0x8658('0x5'));var util=require(_0x8658('0x6'));var path=require('path');var sox=require(_0x8658('0x7'));var csv=require(_0x8658('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8658('0x9'));var squel=require(_0x8658('0xa'));var crypto=require(_0x8658('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8658('0xc'));var toCsv=require(_0x8658('0x8'));var querystring=require(_0x8658('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8658('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8658('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8658('0x10'))(_0x8658('0x11'));var utils=require(_0x8658('0x12'));var config=require(_0x8658('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x8658('0x14'))['db'];config[_0x8658('0x15')]=_[_0x8658('0x16')](config['redis'],{'host':_0x8658('0x17'),'port':0x18eb});var socket=require(_0x8658('0x18'))(new Redis(config[_0x8658('0x15')]));require(_0x8658('0x19'))[_0x8658('0x1a')](socket);function respondWithStatusCode(_0x845b94,_0x2873bf){_0x2873bf=_0x2873bf||0xcc;return function(_0x375948){if(_0x375948){return _0x845b94[_0x8658('0x1b')](_0x2873bf);}return _0x845b94[_0x8658('0x1c')](_0x2873bf)['end']();};}function respondWithResult(_0x59ce04,_0x343270){_0x343270=_0x343270||0xc8;return function(_0x2baf17){if(_0x2baf17){return _0x59ce04[_0x8658('0x1c')](_0x343270)[_0x8658('0x1d')](_0x2baf17);}};}function respondWithFilteredResult(_0x3089c0,_0x72b4c8){return function(_0x4d1fa4){if(_0x4d1fa4){var _0x3a738e=typeof _0x72b4c8[_0x8658('0x1e')]==='undefined'&&typeof _0x72b4c8['limit']===_0x8658('0x1f');var _0xf0280a=_0x4d1fa4[_0x8658('0x20')];var _0x3dd3b2=_0x3a738e?0x0:_0x72b4c8['offset'];var _0x4842ab=_0x3a738e?_0x4d1fa4['count']:_0x72b4c8[_0x8658('0x1e')]+_0x72b4c8['limit'];var _0x3463cb;if(_0x4842ab>=_0xf0280a){_0x4842ab=_0xf0280a;_0x3463cb=0xc8;}else{_0x3463cb=0xce;}_0x3089c0['status'](_0x3463cb);return _0x3089c0['set'](_0x8658('0x21'),_0x3dd3b2+'-'+_0x4842ab+'/'+_0xf0280a)[_0x8658('0x1d')](_0x4d1fa4);}return null;};}function patchUpdates(_0x2281ae){return function(_0x1bc250){try{jsonpatch[_0x8658('0x22')](_0x1bc250,_0x2281ae,!![]);}catch(_0x15efa3){return BPromise[_0x8658('0x23')](_0x15efa3);}return _0x1bc250[_0x8658('0x24')]();};}function saveUpdates(_0x5438d0,_0x372c05){return function(_0x3e6419){if(_0x3e6419){return _0x3e6419[_0x8658('0x25')](_0x5438d0)[_0x8658('0x26')](function(_0x1f5b6f){return _0x1f5b6f;});}return null;};}function removeEntity(_0x3623f3,_0xa09595){return function(_0x2f351f){if(_0x2f351f){return _0x2f351f[_0x8658('0x27')]()[_0x8658('0x26')](function(){_0x3623f3[_0x8658('0x1c')](0xcc)[_0x8658('0x28')]();});}};}function handleEntityNotFound(_0x2d0844,_0xe8ccee){return function(_0x1d9b6a){if(!_0x1d9b6a){_0x2d0844[_0x8658('0x1b')](0x194);}return _0x1d9b6a;};}function handleError(_0x19c91c,_0xf0ee96){_0xf0ee96=_0xf0ee96||0x1f4;return function(_0x40f231){logger['error'](_0x40f231[_0x8658('0x29')]);if(_0x40f231[_0x8658('0x2a')]){delete _0x40f231[_0x8658('0x2a')];}_0x19c91c['status'](_0xf0ee96)[_0x8658('0x2b')](_0x40f231);};}exports[_0x8658('0x2c')]=function(_0x223a2e,_0x1a833d){var _0x16069b={},_0x135d34={},_0x1b57b6={'count':0x0,'rows':[]};var _0x7094e6=_[_0x8658('0x2d')](db['ChatGroup']['rawAttributes'],function(_0x382284){return{'name':_0x382284[_0x8658('0x2e')],'type':_0x382284[_0x8658('0x2f')][_0x8658('0x30')]};});_0x135d34['model']=_[_0x8658('0x2d')](_0x7094e6,_0x8658('0x2a'));_0x135d34[_0x8658('0x31')]=_[_0x8658('0x32')](_0x223a2e[_0x8658('0x31')]);_0x135d34[_0x8658('0x33')]=_[_0x8658('0x34')](_0x135d34[_0x8658('0x35')],_0x135d34['query']);_0x16069b[_0x8658('0x36')]=_['intersection'](_0x135d34[_0x8658('0x35')],qs[_0x8658('0x37')](_0x223a2e[_0x8658('0x31')]['fields']));_0x16069b[_0x8658('0x36')]=_0x16069b[_0x8658('0x36')][_0x8658('0x38')]?_0x16069b[_0x8658('0x36')]:_0x135d34['model'];if(!_0x223a2e[_0x8658('0x31')][_0x8658('0x39')](_0x8658('0x3a'))){_0x16069b[_0x8658('0x3b')]=qs[_0x8658('0x3b')](_0x223a2e[_0x8658('0x31')]['limit']);_0x16069b[_0x8658('0x1e')]=qs[_0x8658('0x1e')](_0x223a2e[_0x8658('0x31')][_0x8658('0x1e')]);}_0x16069b[_0x8658('0x3c')]=qs[_0x8658('0x3d')](_0x223a2e[_0x8658('0x31')][_0x8658('0x3d')]);_0x16069b[_0x8658('0x3e')]=qs[_0x8658('0x33')](_[_0x8658('0x3f')](_0x223a2e[_0x8658('0x31')],_0x135d34[_0x8658('0x33')]),_0x7094e6);if(_0x223a2e[_0x8658('0x31')]['filter']){_0x16069b['where']=_[_0x8658('0x40')](_0x16069b[_0x8658('0x3e')],{'$or':_[_0x8658('0x2d')](_0x7094e6,function(_0x357811){if(_0x357811[_0x8658('0x2f')]!==_0x8658('0x41')){var _0x1c2143={};_0x1c2143[_0x357811[_0x8658('0x2a')]]={'$like':'%'+_0x223a2e[_0x8658('0x31')][_0x8658('0x42')]+'%'};return _0x1c2143;}})});}_0x16069b=_[_0x8658('0x40')]({},_0x16069b,_0x223a2e[_0x8658('0x43')]);var _0x129df6={'where':_0x16069b[_0x8658('0x3e')]};return db[_0x8658('0x44')][_0x8658('0x20')](_0x129df6)['then'](function(_0x96e79f){_0x1b57b6[_0x8658('0x20')]=_0x96e79f;if(_0x223a2e[_0x8658('0x31')]['includeAll']){_0x16069b[_0x8658('0x45')]=[{'all':!![]}];}return db[_0x8658('0x44')][_0x8658('0x46')](_0x16069b);})['then'](function(_0x1ccdf1){_0x1b57b6[_0x8658('0x47')]=_0x1ccdf1;return _0x1b57b6;})['then'](respondWithFilteredResult(_0x1a833d,_0x16069b))[_0x8658('0x48')](handleError(_0x1a833d,null));};exports[_0x8658('0x49')]=function(_0x294ae9,_0x3ce5da){var _0x739082={'raw':!![],'where':{'id':_0x294ae9['params']['id']}},_0x13a58e={};_0x13a58e[_0x8658('0x35')]=_[_0x8658('0x32')](db[_0x8658('0x44')][_0x8658('0x4a')]);_0x13a58e[_0x8658('0x31')]=_['keys'](_0x294ae9[_0x8658('0x31')]);_0x13a58e[_0x8658('0x33')]=_[_0x8658('0x34')](_0x13a58e[_0x8658('0x35')],_0x13a58e['query']);_0x739082[_0x8658('0x36')]=_['intersection'](_0x13a58e[_0x8658('0x35')],qs[_0x8658('0x37')](_0x294ae9[_0x8658('0x31')][_0x8658('0x37')]));_0x739082[_0x8658('0x36')]=_0x739082[_0x8658('0x36')][_0x8658('0x38')]?_0x739082[_0x8658('0x36')]:_0x13a58e[_0x8658('0x35')];if(_0x294ae9[_0x8658('0x31')][_0x8658('0x4b')]){_0x739082[_0x8658('0x45')]=[{'all':!![]}];}_0x739082=_[_0x8658('0x40')]({},_0x739082,_0x294ae9['options']);return db[_0x8658('0x44')][_0x8658('0x4c')](_0x739082)['then'](handleEntityNotFound(_0x3ce5da,null))[_0x8658('0x26')](respondWithResult(_0x3ce5da,null))['catch'](handleError(_0x3ce5da,null));};exports[_0x8658('0x4d')]=function(_0x4c0f5c,_0xf22b70){return db[_0x8658('0x44')]['create'](_0x4c0f5c[_0x8658('0x4e')],{})[_0x8658('0x26')](respondWithResult(_0xf22b70,0xc9))[_0x8658('0x48')](handleError(_0xf22b70,null));};exports['update']=function(_0x1d3ee1,_0xd67b19){if(_0x1d3ee1[_0x8658('0x4e')]['id']){delete _0x1d3ee1[_0x8658('0x4e')]['id'];}return db[_0x8658('0x44')][_0x8658('0x4c')]({'where':{'id':_0x1d3ee1[_0x8658('0x4f')]['id']}})[_0x8658('0x26')](handleEntityNotFound(_0xd67b19,null))['then'](saveUpdates(_0x1d3ee1[_0x8658('0x4e')],null))[_0x8658('0x26')](respondWithResult(_0xd67b19,null))[_0x8658('0x48')](handleError(_0xd67b19,null));};exports[_0x8658('0x27')]=function(_0x8a8bbb,_0x16a574){return db[_0x8658('0x44')][_0x8658('0x4c')]({'where':{'id':_0x8a8bbb['params']['id']}})[_0x8658('0x26')](handleEntityNotFound(_0x16a574,null))[_0x8658('0x26')](removeEntity(_0x16a574,null))[_0x8658('0x48')](handleError(_0x16a574,null));};exports[_0x8658('0x50')]=function(_0x1edf95,_0x4ff8c4){return db['ChatGroup'][_0x8658('0x50')]()[_0x8658('0x26')](respondWithResult(_0x4ff8c4,null))[_0x8658('0x48')](handleError(_0x4ff8c4,null));};exports[_0x8658('0x51')]=function(_0x5a81dc,_0x1b62d3,_0x1c4e2b){return db['ChatInternalMessage'][_0x8658('0x20')]({'where':{'ChatGroupId':_0x5a81dc['params']['id'],'ToId':_0x5a81dc[_0x8658('0x52')]['id'],'read':![]}})[_0x8658('0x26')](function(_0x55dfb6){return{'id':_[_0x8658('0x53')](_0x5a81dc[_0x8658('0x4f')]['id']),'count':_0x55dfb6};})[_0x8658('0x26')](respondWithResult(_0x1b62d3,null))[_0x8658('0x48')](handleError(_0x1b62d3,null));};exports[_0x8658('0x54')]=function(_0x42e8f5,_0x5900b7,_0x38b278){return db['ChatGroup'][_0x8658('0x4c')]({'where':{'id':_0x42e8f5[_0x8658('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5900b7,null))[_0x8658('0x26')](function(_0x537129){if(_0x537129){return _0x537129[_0x8658('0x54')](_0x42e8f5['body']['ids'],_[_0x8658('0x55')](_0x42e8f5[_0x8658('0x4e')],[_0x8658('0x56'),'id'])||{});}})[_0x8658('0x26')](respondWithResult(_0x5900b7,null))[_0x8658('0x48')](handleError(_0x5900b7,null));};exports[_0x8658('0x57')]=function(_0x403227,_0x413b98,_0x5ae7cc){var _0x37da78={};var _0x16b382={};var _0x27d723;var _0x4975f3;return db[_0x8658('0x44')]['findOne']({'where':{'id':_0x403227[_0x8658('0x4f')]['id']}})[_0x8658('0x26')](handleEntityNotFound(_0x413b98,null))['then'](function(_0x916178){if(_0x916178){_0x27d723=_0x916178;_0x16b382[_0x8658('0x35')]=_[_0x8658('0x32')](db[_0x8658('0x58')][_0x8658('0x4a')]);_0x16b382[_0x8658('0x31')]=_[_0x8658('0x32')](_0x403227[_0x8658('0x31')]);_0x16b382[_0x8658('0x33')]=_[_0x8658('0x34')](_0x16b382[_0x8658('0x35')],_0x16b382[_0x8658('0x31')]);_0x37da78[_0x8658('0x36')]=_[_0x8658('0x34')](_0x16b382[_0x8658('0x35')],qs['fields'](_0x403227[_0x8658('0x31')][_0x8658('0x37')]));_0x37da78['attributes']=_0x37da78['attributes']['length']?_0x37da78[_0x8658('0x36')]:_0x16b382[_0x8658('0x35')];_0x37da78['order']=qs[_0x8658('0x3d')](_0x403227[_0x8658('0x31')][_0x8658('0x3d')]);_0x37da78['where']=qs[_0x8658('0x33')](_['pick'](_0x403227[_0x8658('0x31')],_0x16b382[_0x8658('0x33')]));if(_0x403227['query']['filter']){_0x37da78[_0x8658('0x3e')]=_[_0x8658('0x40')](_0x37da78[_0x8658('0x3e')],{'$or':_[_0x8658('0x2d')](_0x37da78[_0x8658('0x36')],function(_0x39ac52){var _0x40eb63={};_0x40eb63[_0x39ac52]={'$like':'%'+_0x403227['query'][_0x8658('0x42')]+'%'};return _0x40eb63;})});}_0x37da78=_['merge']({},_0x37da78,_0x403227[_0x8658('0x43')]);return _0x27d723[_0x8658('0x57')](_0x37da78);}})['then'](function(_0x587d27){if(_0x587d27){_0x4975f3=_0x587d27[_0x8658('0x38')];if(!_0x403227[_0x8658('0x31')][_0x8658('0x39')]('nolimit')){_0x37da78[_0x8658('0x3b')]=qs['limit'](_0x403227[_0x8658('0x31')][_0x8658('0x3b')]);_0x37da78[_0x8658('0x1e')]=qs['offset'](_0x403227['query'][_0x8658('0x1e')]);}return _0x27d723[_0x8658('0x57')](_0x37da78);}})[_0x8658('0x26')](function(_0x213f93){if(_0x213f93){return _0x213f93?{'count':_0x4975f3,'rows':_0x213f93}:null;}})['then'](respondWithResult(_0x413b98,null))['catch'](handleError(_0x413b98,null));};exports['removeMembers']=function(_0x94b69b,_0x1519f6,_0x539f2b){return db['ChatGroup']['find']({'where':{'id':_0x94b69b[_0x8658('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1519f6,null))[_0x8658('0x26')](function(_0x94a0a4){if(_0x94a0a4){return _0x94a0a4[_0x8658('0x59')](_0x94b69b[_0x8658('0x31')][_0x8658('0x56')]);}})[_0x8658('0x26')](respondWithStatusCode(_0x1519f6,null))[_0x8658('0x48')](handleError(_0x1519f6,null));};exports[_0x8658('0x5a')]=function(_0x19aec8,_0x4bb839,_0x53e510){if(_0x19aec8[_0x8658('0x4e')]['id']){delete _0x19aec8[_0x8658('0x4e')]['id'];}return db[_0x8658('0x44')]['find']({'where':{'id':_0x19aec8[_0x8658('0x4f')]['id']}})[_0x8658('0x26')](handleEntityNotFound(_0x4bb839,null))[_0x8658('0x26')](function(_0x14343f){if(_0x14343f){_0x19aec8[_0x8658('0x4e')][_0x8658('0x5b')]=_0x14343f['id'];return db['ChatInternalMessage']['create'](_0x19aec8[_0x8658('0x4e')]);}})[_0x8658('0x26')](respondWithResult(_0x4bb839,null))[_0x8658('0x48')](handleError(_0x4bb839,null));};exports['getMessages']=function(_0x32101c,_0x1ebb2b,_0x147138){var _0x13c664={};var _0x4c14d2={};var _0x221ae7;var _0x1eddef;return db[_0x8658('0x44')][_0x8658('0x5c')]({'where':{'id':_0x32101c[_0x8658('0x4f')]['id']}})[_0x8658('0x26')](handleEntityNotFound(_0x1ebb2b,null))['then'](function(_0x5b6209){if(_0x5b6209){_0x221ae7=_0x5b6209;_0x4c14d2[_0x8658('0x35')]=_[_0x8658('0x32')](db[_0x8658('0x5d')][_0x8658('0x4a')]);_0x4c14d2[_0x8658('0x31')]=_[_0x8658('0x32')](_0x32101c[_0x8658('0x31')]);_0x4c14d2[_0x8658('0x33')]=_[_0x8658('0x34')](_0x4c14d2[_0x8658('0x35')],_0x4c14d2[_0x8658('0x31')]);_0x13c664[_0x8658('0x36')]=_[_0x8658('0x34')](_0x4c14d2['model'],qs[_0x8658('0x37')](_0x32101c[_0x8658('0x31')][_0x8658('0x37')]));_0x13c664[_0x8658('0x36')]=_0x13c664[_0x8658('0x36')][_0x8658('0x38')]?_0x13c664[_0x8658('0x36')]:_0x4c14d2[_0x8658('0x35')];_0x13c664[_0x8658('0x3c')]=qs['sort'](_0x32101c['query'][_0x8658('0x3d')]);_0x13c664[_0x8658('0x3e')]=qs['filters'](_[_0x8658('0x3f')](_0x32101c[_0x8658('0x31')],_0x4c14d2[_0x8658('0x33')]));if(_0x32101c[_0x8658('0x31')][_0x8658('0x42')]){_0x13c664[_0x8658('0x3e')]=_[_0x8658('0x40')](_0x13c664[_0x8658('0x3e')],{'$or':_[_0x8658('0x2d')](_0x13c664[_0x8658('0x36')],function(_0x24f4f8){var _0x1ae112={};_0x1ae112[_0x24f4f8]={'$like':'%'+_0x32101c[_0x8658('0x31')]['filter']+'%'};return _0x1ae112;})});}if(_0x32101c[_0x8658('0x31')][_0x8658('0x5e')]){var _0x5bf77e=_0x32101c[_0x8658('0x31')][_0x8658('0x5e')][_0x8658('0x5f')](',');var _0x3d7efa={};_0x3d7efa[_0x5bf77e[0x0]]={'$gte':moment(_0x5bf77e[0x1])[_0x8658('0x60')](_0x8658('0x61'))};_0x13c664[_0x8658('0x3e')]=_[_0x8658('0x40')](_0x13c664[_0x8658('0x3e')],_0x3d7efa);}_0x13c664=_[_0x8658('0x40')]({},_0x13c664,_0x32101c[_0x8658('0x43')]);return _0x221ae7['getMessages'](_0x13c664);}})['then'](function(_0x4abe90){if(_0x4abe90){_0x1eddef=_0x4abe90[_0x8658('0x38')];if(!_0x32101c[_0x8658('0x31')][_0x8658('0x39')](_0x8658('0x3a'))){_0x13c664[_0x8658('0x3b')]=qs[_0x8658('0x3b')](_0x32101c['query'][_0x8658('0x3b')]);_0x13c664['offset']=qs[_0x8658('0x1e')](_0x32101c[_0x8658('0x31')]['offset']);}return _0x221ae7[_0x8658('0x62')](_0x13c664);}})[_0x8658('0x26')](function(_0x2dccc6){if(_0x2dccc6){return _0x2dccc6?{'count':_0x1eddef,'rows':_0x2dccc6}:null;}})['then'](respondWithResult(_0x1ebb2b,null))[_0x8658('0x48')](handleError(_0x1ebb2b,null));}; \ No newline at end of file +var _0x0677=['offset','undefined','count','set','json','apply','reject','save','update','then','sendStatus','stack','send','index','ChatGroup','rawAttributes','fieldName','type','model','map','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','catch','create','body','find','destroy','describe','ChatInternalMessage','toInteger','addMembers','omit','ids','findOne','User','getMembers','removeMembers','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','end','status'];(function(_0x3f0743,_0xb3efb1){var _0x335a76=function(_0x36e48b){while(--_0x36e48b){_0x3f0743['push'](_0x3f0743['shift']());}};_0x335a76(++_0xb3efb1);}(_0x0677,0xff));var _0x7067=function(_0x1fb94f,_0x2812e7){_0x1fb94f=_0x1fb94f-0x0;var _0x2a1bd0=_0x0677[_0x1fb94f];return _0x2a1bd0;};'use strict';var emlformat=require(_0x7067('0x0'));var rimraf=require(_0x7067('0x1'));var zipdir=require(_0x7067('0x2'));var jsonpatch=require(_0x7067('0x3'));var rp=require(_0x7067('0x4'));var moment=require(_0x7067('0x5'));var BPromise=require(_0x7067('0x6'));var Mustache=require(_0x7067('0x7'));var util=require('util');var path=require(_0x7067('0x8'));var sox=require(_0x7067('0x9'));var csv=require('to-csv');var ejs=require(_0x7067('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7067('0xb'));var squel=require('squel');var crypto=require(_0x7067('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7067('0xd'));var toCsv=require(_0x7067('0xe'));var querystring=require('querystring');var Papa=require(_0x7067('0xf'));var Redis=require('ioredis');var authService=require(_0x7067('0x10'));var qs=require(_0x7067('0x11'));var as=require(_0x7067('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7067('0x13'))(_0x7067('0x14'));var utils=require(_0x7067('0x15'));var config=require(_0x7067('0x16'));var licenseUtil=require(_0x7067('0x17'));var db=require(_0x7067('0x18'))['db'];config[_0x7067('0x19')]=_[_0x7067('0x1a')](config[_0x7067('0x19')],{'host':_0x7067('0x1b'),'port':0x18eb});var socket=require(_0x7067('0x1c'))(new Redis(config[_0x7067('0x19')]));require(_0x7067('0x1d'))[_0x7067('0x1e')](socket);function respondWithStatusCode(_0x2ea0be,_0x58f18f){_0x58f18f=_0x58f18f||0xcc;return function(_0x360cef){if(_0x360cef){return _0x2ea0be['sendStatus'](_0x58f18f);}return _0x2ea0be['status'](_0x58f18f)[_0x7067('0x1f')]();};}function respondWithResult(_0x44ccb8,_0x5525dd){_0x5525dd=_0x5525dd||0xc8;return function(_0x4c0a31){if(_0x4c0a31){return _0x44ccb8[_0x7067('0x20')](_0x5525dd)['json'](_0x4c0a31);}};}function respondWithFilteredResult(_0x2d05b,_0x1e24fe){return function(_0x539dad){if(_0x539dad){var _0x543911=typeof _0x1e24fe[_0x7067('0x21')]===_0x7067('0x22')&&typeof _0x1e24fe['limit']==='undefined';var _0x4fc5ec=_0x539dad['count'];var _0xb06438=_0x543911?0x0:_0x1e24fe[_0x7067('0x21')];var _0x22239b=_0x543911?_0x539dad[_0x7067('0x23')]:_0x1e24fe[_0x7067('0x21')]+_0x1e24fe['limit'];var _0x3f16c9;if(_0x22239b>=_0x4fc5ec){_0x22239b=_0x4fc5ec;_0x3f16c9=0xc8;}else{_0x3f16c9=0xce;}_0x2d05b[_0x7067('0x20')](_0x3f16c9);return _0x2d05b[_0x7067('0x24')]('Content-Range',_0xb06438+'-'+_0x22239b+'/'+_0x4fc5ec)[_0x7067('0x25')](_0x539dad);}return null;};}function patchUpdates(_0x59c978){return function(_0x253f0d){try{jsonpatch[_0x7067('0x26')](_0x253f0d,_0x59c978,!![]);}catch(_0x1f0a73){return BPromise[_0x7067('0x27')](_0x1f0a73);}return _0x253f0d[_0x7067('0x28')]();};}function saveUpdates(_0x446663,_0x14d3ca){return function(_0x2eacf6){if(_0x2eacf6){return _0x2eacf6[_0x7067('0x29')](_0x446663)['then'](function(_0x2ae0e2){return _0x2ae0e2;});}return null;};}function removeEntity(_0x2b5a65,_0x2e5e20){return function(_0x19894d){if(_0x19894d){return _0x19894d['destroy']()[_0x7067('0x2a')](function(){_0x2b5a65['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3006a0,_0x241165){return function(_0x124423){if(!_0x124423){_0x3006a0[_0x7067('0x2b')](0x194);}return _0x124423;};}function handleError(_0x509f58,_0xb8a42e){_0xb8a42e=_0xb8a42e||0x1f4;return function(_0x349fd6){logger['error'](_0x349fd6[_0x7067('0x2c')]);if(_0x349fd6['name']){delete _0x349fd6['name'];}_0x509f58['status'](_0xb8a42e)[_0x7067('0x2d')](_0x349fd6);};}exports[_0x7067('0x2e')]=function(_0x3c78dc,_0x5d032f){var _0x391907={},_0x4f2061={},_0x443ebe={'count':0x0,'rows':[]};var _0x11e822=_['map'](db[_0x7067('0x2f')][_0x7067('0x30')],function(_0x54badd){return{'name':_0x54badd[_0x7067('0x31')],'type':_0x54badd[_0x7067('0x32')]['key']};});_0x4f2061[_0x7067('0x33')]=_[_0x7067('0x34')](_0x11e822,_0x7067('0x35'));_0x4f2061[_0x7067('0x36')]=_[_0x7067('0x37')](_0x3c78dc[_0x7067('0x36')]);_0x4f2061[_0x7067('0x38')]=_['intersection'](_0x4f2061['model'],_0x4f2061['query']);_0x391907[_0x7067('0x39')]=_[_0x7067('0x3a')](_0x4f2061[_0x7067('0x33')],qs[_0x7067('0x3b')](_0x3c78dc['query']['fields']));_0x391907[_0x7067('0x39')]=_0x391907[_0x7067('0x39')][_0x7067('0x3c')]?_0x391907['attributes']:_0x4f2061[_0x7067('0x33')];if(!_0x3c78dc[_0x7067('0x36')][_0x7067('0x3d')](_0x7067('0x3e'))){_0x391907[_0x7067('0x3f')]=qs[_0x7067('0x3f')](_0x3c78dc[_0x7067('0x36')][_0x7067('0x3f')]);_0x391907[_0x7067('0x21')]=qs[_0x7067('0x21')](_0x3c78dc[_0x7067('0x36')]['offset']);}_0x391907['order']=qs[_0x7067('0x40')](_0x3c78dc['query']['sort']);_0x391907[_0x7067('0x41')]=qs[_0x7067('0x38')](_[_0x7067('0x42')](_0x3c78dc[_0x7067('0x36')],_0x4f2061[_0x7067('0x38')]),_0x11e822);if(_0x3c78dc[_0x7067('0x36')][_0x7067('0x43')]){_0x391907['where']=_[_0x7067('0x44')](_0x391907[_0x7067('0x41')],{'$or':_[_0x7067('0x34')](_0x11e822,function(_0x5a4243){if(_0x5a4243['type']!==_0x7067('0x45')){var _0x518875={};_0x518875[_0x5a4243[_0x7067('0x35')]]={'$like':'%'+_0x3c78dc['query'][_0x7067('0x43')]+'%'};return _0x518875;}})});}_0x391907=_[_0x7067('0x44')]({},_0x391907,_0x3c78dc[_0x7067('0x46')]);var _0x1a202e={'where':_0x391907['where']};return db[_0x7067('0x2f')][_0x7067('0x23')](_0x1a202e)[_0x7067('0x2a')](function(_0x3d817d){_0x443ebe[_0x7067('0x23')]=_0x3d817d;if(_0x3c78dc[_0x7067('0x36')][_0x7067('0x47')]){_0x391907[_0x7067('0x48')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x391907);})['then'](function(_0x5c41e5){_0x443ebe[_0x7067('0x49')]=_0x5c41e5;return _0x443ebe;})[_0x7067('0x2a')](respondWithFilteredResult(_0x5d032f,_0x391907))['catch'](handleError(_0x5d032f,null));};exports[_0x7067('0x4a')]=function(_0x49af8b,_0x3ccdc1){var _0x5a401c={'raw':!![],'where':{'id':_0x49af8b[_0x7067('0x4b')]['id']}},_0x4404e4={};_0x4404e4[_0x7067('0x33')]=_[_0x7067('0x37')](db['ChatGroup'][_0x7067('0x30')]);_0x4404e4['query']=_['keys'](_0x49af8b['query']);_0x4404e4['filters']=_['intersection'](_0x4404e4[_0x7067('0x33')],_0x4404e4[_0x7067('0x36')]);_0x5a401c['attributes']=_[_0x7067('0x3a')](_0x4404e4[_0x7067('0x33')],qs['fields'](_0x49af8b['query'][_0x7067('0x3b')]));_0x5a401c[_0x7067('0x39')]=_0x5a401c[_0x7067('0x39')][_0x7067('0x3c')]?_0x5a401c['attributes']:_0x4404e4[_0x7067('0x33')];if(_0x49af8b['query'][_0x7067('0x47')]){_0x5a401c['include']=[{'all':!![]}];}_0x5a401c=_['merge']({},_0x5a401c,_0x49af8b[_0x7067('0x46')]);return db['ChatGroup']['find'](_0x5a401c)[_0x7067('0x2a')](handleEntityNotFound(_0x3ccdc1,null))[_0x7067('0x2a')](respondWithResult(_0x3ccdc1,null))[_0x7067('0x4c')](handleError(_0x3ccdc1,null));};exports[_0x7067('0x4d')]=function(_0x20d9d9,_0x37bf31){return db[_0x7067('0x2f')][_0x7067('0x4d')](_0x20d9d9[_0x7067('0x4e')],{})['then'](respondWithResult(_0x37bf31,0xc9))[_0x7067('0x4c')](handleError(_0x37bf31,null));};exports['update']=function(_0x33de1f,_0x433051){if(_0x33de1f['body']['id']){delete _0x33de1f[_0x7067('0x4e')]['id'];}return db[_0x7067('0x2f')][_0x7067('0x4f')]({'where':{'id':_0x33de1f[_0x7067('0x4b')]['id']}})['then'](handleEntityNotFound(_0x433051,null))[_0x7067('0x2a')](saveUpdates(_0x33de1f['body'],null))[_0x7067('0x2a')](respondWithResult(_0x433051,null))['catch'](handleError(_0x433051,null));};exports[_0x7067('0x50')]=function(_0x204090,_0x114ebd){return db[_0x7067('0x2f')][_0x7067('0x4f')]({'where':{'id':_0x204090[_0x7067('0x4b')]['id']}})[_0x7067('0x2a')](handleEntityNotFound(_0x114ebd,null))[_0x7067('0x2a')](removeEntity(_0x114ebd,null))[_0x7067('0x4c')](handleError(_0x114ebd,null));};exports[_0x7067('0x51')]=function(_0xf47c79,_0x5920b0){return db[_0x7067('0x2f')][_0x7067('0x51')]()[_0x7067('0x2a')](respondWithResult(_0x5920b0,null))['catch'](handleError(_0x5920b0,null));};exports['getUnread']=function(_0x3d962d,_0x412a52,_0x20e295){return db[_0x7067('0x52')][_0x7067('0x23')]({'where':{'ChatGroupId':_0x3d962d[_0x7067('0x4b')]['id'],'ToId':_0x3d962d['user']['id'],'read':![]}})[_0x7067('0x2a')](function(_0x463e11){return{'id':_[_0x7067('0x53')](_0x3d962d[_0x7067('0x4b')]['id']),'count':_0x463e11};})[_0x7067('0x2a')](respondWithResult(_0x412a52,null))[_0x7067('0x4c')](handleError(_0x412a52,null));};exports['addMembers']=function(_0x8f82a0,_0x4a26da,_0x14cc87){return db[_0x7067('0x2f')][_0x7067('0x4f')]({'where':{'id':_0x8f82a0[_0x7067('0x4b')]['id']}})[_0x7067('0x2a')](handleEntityNotFound(_0x4a26da,null))['then'](function(_0x6190f3){if(_0x6190f3){return _0x6190f3[_0x7067('0x54')](_0x8f82a0[_0x7067('0x4e')]['ids'],_[_0x7067('0x55')](_0x8f82a0[_0x7067('0x4e')],[_0x7067('0x56'),'id'])||{});}})[_0x7067('0x2a')](respondWithResult(_0x4a26da,null))['catch'](handleError(_0x4a26da,null));};exports['getMembers']=function(_0x41abd1,_0x5f051b,_0x389d54){var _0x2fd09e={};var _0x31b66f={};var _0x404474;var _0x13e9ac;return db[_0x7067('0x2f')][_0x7067('0x57')]({'where':{'id':_0x41abd1[_0x7067('0x4b')]['id']}})[_0x7067('0x2a')](handleEntityNotFound(_0x5f051b,null))['then'](function(_0x31a579){if(_0x31a579){_0x404474=_0x31a579;_0x31b66f[_0x7067('0x33')]=_[_0x7067('0x37')](db[_0x7067('0x58')][_0x7067('0x30')]);_0x31b66f[_0x7067('0x36')]=_[_0x7067('0x37')](_0x41abd1[_0x7067('0x36')]);_0x31b66f[_0x7067('0x38')]=_[_0x7067('0x3a')](_0x31b66f['model'],_0x31b66f[_0x7067('0x36')]);_0x2fd09e[_0x7067('0x39')]=_[_0x7067('0x3a')](_0x31b66f[_0x7067('0x33')],qs[_0x7067('0x3b')](_0x41abd1[_0x7067('0x36')][_0x7067('0x3b')]));_0x2fd09e[_0x7067('0x39')]=_0x2fd09e[_0x7067('0x39')][_0x7067('0x3c')]?_0x2fd09e['attributes']:_0x31b66f[_0x7067('0x33')];_0x2fd09e['order']=qs[_0x7067('0x40')](_0x41abd1[_0x7067('0x36')]['sort']);_0x2fd09e['where']=qs[_0x7067('0x38')](_['pick'](_0x41abd1['query'],_0x31b66f[_0x7067('0x38')]));if(_0x41abd1[_0x7067('0x36')]['filter']){_0x2fd09e[_0x7067('0x41')]=_['merge'](_0x2fd09e[_0x7067('0x41')],{'$or':_[_0x7067('0x34')](_0x2fd09e[_0x7067('0x39')],function(_0x6ed58c){var _0x1fb8ea={};_0x1fb8ea[_0x6ed58c]={'$like':'%'+_0x41abd1[_0x7067('0x36')][_0x7067('0x43')]+'%'};return _0x1fb8ea;})});}_0x2fd09e=_[_0x7067('0x44')]({},_0x2fd09e,_0x41abd1[_0x7067('0x46')]);return _0x404474[_0x7067('0x59')](_0x2fd09e);}})[_0x7067('0x2a')](function(_0x93919c){if(_0x93919c){_0x13e9ac=_0x93919c[_0x7067('0x3c')];if(!_0x41abd1[_0x7067('0x36')]['hasOwnProperty'](_0x7067('0x3e'))){_0x2fd09e[_0x7067('0x3f')]=qs['limit'](_0x41abd1[_0x7067('0x36')][_0x7067('0x3f')]);_0x2fd09e[_0x7067('0x21')]=qs[_0x7067('0x21')](_0x41abd1['query'][_0x7067('0x21')]);}return _0x404474[_0x7067('0x59')](_0x2fd09e);}})[_0x7067('0x2a')](function(_0x8c7123){if(_0x8c7123){return _0x8c7123?{'count':_0x13e9ac,'rows':_0x8c7123}:null;}})[_0x7067('0x2a')](respondWithResult(_0x5f051b,null))[_0x7067('0x4c')](handleError(_0x5f051b,null));};exports[_0x7067('0x5a')]=function(_0x151e68,_0xf990b5,_0x143dbb){return db[_0x7067('0x2f')][_0x7067('0x4f')]({'where':{'id':_0x151e68[_0x7067('0x4b')]['id']}})['then'](handleEntityNotFound(_0xf990b5,null))[_0x7067('0x2a')](function(_0x17e6f6){if(_0x17e6f6){return _0x17e6f6[_0x7067('0x5a')](_0x151e68[_0x7067('0x36')][_0x7067('0x56')]);}})[_0x7067('0x2a')](respondWithStatusCode(_0xf990b5,null))['catch'](handleError(_0xf990b5,null));};exports['addMessage']=function(_0x4eb8c4,_0x428a5e,_0x27294b){if(_0x4eb8c4[_0x7067('0x4e')]['id']){delete _0x4eb8c4[_0x7067('0x4e')]['id'];}return db[_0x7067('0x2f')][_0x7067('0x4f')]({'where':{'id':_0x4eb8c4[_0x7067('0x4b')]['id']}})[_0x7067('0x2a')](handleEntityNotFound(_0x428a5e,null))[_0x7067('0x2a')](function(_0x2ff59c){if(_0x2ff59c){_0x4eb8c4[_0x7067('0x4e')]['ChatGroupId']=_0x2ff59c['id'];return db[_0x7067('0x52')][_0x7067('0x4d')](_0x4eb8c4[_0x7067('0x4e')]);}})[_0x7067('0x2a')](respondWithResult(_0x428a5e,null))['catch'](handleError(_0x428a5e,null));};exports[_0x7067('0x5b')]=function(_0x5683ca,_0x2ddb35,_0x212702){var _0x3ebf33={};var _0x5e8026={};var _0x40de1a;var _0x5d5740;return db['ChatGroup'][_0x7067('0x57')]({'where':{'id':_0x5683ca[_0x7067('0x4b')]['id']}})[_0x7067('0x2a')](handleEntityNotFound(_0x2ddb35,null))['then'](function(_0x1f1433){if(_0x1f1433){_0x40de1a=_0x1f1433;_0x5e8026['model']=_[_0x7067('0x37')](db[_0x7067('0x52')][_0x7067('0x30')]);_0x5e8026['query']=_['keys'](_0x5683ca[_0x7067('0x36')]);_0x5e8026[_0x7067('0x38')]=_['intersection'](_0x5e8026[_0x7067('0x33')],_0x5e8026['query']);_0x3ebf33['attributes']=_['intersection'](_0x5e8026[_0x7067('0x33')],qs[_0x7067('0x3b')](_0x5683ca[_0x7067('0x36')][_0x7067('0x3b')]));_0x3ebf33[_0x7067('0x39')]=_0x3ebf33[_0x7067('0x39')][_0x7067('0x3c')]?_0x3ebf33[_0x7067('0x39')]:_0x5e8026[_0x7067('0x33')];_0x3ebf33['order']=qs[_0x7067('0x40')](_0x5683ca[_0x7067('0x36')][_0x7067('0x40')]);_0x3ebf33['where']=qs[_0x7067('0x38')](_[_0x7067('0x42')](_0x5683ca[_0x7067('0x36')],_0x5e8026[_0x7067('0x38')]));if(_0x5683ca['query']['filter']){_0x3ebf33[_0x7067('0x41')]=_[_0x7067('0x44')](_0x3ebf33[_0x7067('0x41')],{'$or':_[_0x7067('0x34')](_0x3ebf33['attributes'],function(_0x56b0ab){var _0x3bcb6d={};_0x3bcb6d[_0x56b0ab]={'$like':'%'+_0x5683ca[_0x7067('0x36')]['filter']+'%'};return _0x3bcb6d;})});}if(_0x5683ca[_0x7067('0x36')][_0x7067('0x5c')]){var _0x10aaaf=_0x5683ca[_0x7067('0x36')][_0x7067('0x5c')][_0x7067('0x5d')](',');var _0x1ea200={};_0x1ea200[_0x10aaaf[0x0]]={'$gte':moment(_0x10aaaf[0x1])[_0x7067('0x5e')](_0x7067('0x5f'))};_0x3ebf33[_0x7067('0x41')]=_[_0x7067('0x44')](_0x3ebf33[_0x7067('0x41')],_0x1ea200);}_0x3ebf33=_[_0x7067('0x44')]({},_0x3ebf33,_0x5683ca[_0x7067('0x46')]);return _0x40de1a[_0x7067('0x5b')](_0x3ebf33);}})['then'](function(_0x3555ea){if(_0x3555ea){_0x5d5740=_0x3555ea['length'];if(!_0x5683ca[_0x7067('0x36')]['hasOwnProperty'](_0x7067('0x3e'))){_0x3ebf33['limit']=qs['limit'](_0x5683ca[_0x7067('0x36')][_0x7067('0x3f')]);_0x3ebf33[_0x7067('0x21')]=qs['offset'](_0x5683ca[_0x7067('0x36')][_0x7067('0x21')]);}return _0x40de1a[_0x7067('0x5b')](_0x3ebf33);}})[_0x7067('0x2a')](function(_0x505f5c){if(_0x505f5c){return _0x505f5c?{'count':_0x5d5740,'rows':_0x505f5c}:null;}})[_0x7067('0x2a')](respondWithResult(_0x2ddb35,null))['catch'](handleError(_0x2ddb35,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index f9187eb..d1d7b6f 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 _0x4b0f=['setMaxListeners','save','remove','emit','hook','exports','events','../../mysqldb','ChatGroup'];(function(_0x5217e4,_0x406ca1){var _0x572720=function(_0x53b3fb){while(--_0x53b3fb){_0x5217e4['push'](_0x5217e4['shift']());}};_0x572720(++_0x406ca1);}(_0x4b0f,0xba));var _0xf4b0=function(_0x130209,_0x2cc129){_0x130209=_0x130209-0x0;var _0x155fb7=_0x4b0f[_0x130209];return _0x155fb7;};'use strict';var EventEmitter=require(_0xf4b0('0x0'));var ChatGroup=require(_0xf4b0('0x1'))['db'][_0xf4b0('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf4b0('0x3')](0x0);var events={'afterCreate':_0xf4b0('0x4'),'afterUpdate':'update','afterDestroy':_0xf4b0('0x5')};function emitEvent(_0x4b7d8c){return function(_0x4cbfad,_0x3ed0cb,_0x1a446f){ChatGroupEvents[_0xf4b0('0x6')](_0x4b7d8c+':'+_0x4cbfad['id'],_0x4cbfad);ChatGroupEvents['emit'](_0x4b7d8c,_0x4cbfad);_0x1a446f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xf4b0('0x7')](e,emitEvent(event));}}module[_0xf4b0('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0xbaa4=['ChatGroup','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5c6c64,_0x12d4cb){var _0x172174=function(_0x3f49c3){while(--_0x3f49c3){_0x5c6c64['push'](_0x5c6c64['shift']());}};_0x172174(++_0x12d4cb);}(_0xbaa4,0x73));var _0x4baa=function(_0x5222e9,_0x4aee48){_0x5222e9=_0x5222e9-0x0;var _0x2bc5e8=_0xbaa4[_0x5222e9];return _0x2bc5e8;};'use strict';var EventEmitter=require(_0x4baa('0x0'));var ChatGroup=require(_0x4baa('0x1'))['db'][_0x4baa('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x4baa('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4baa('0x4')};function emitEvent(_0x46461e){return function(_0x4e1017,_0x4f4e3c,_0x36e357){ChatGroupEvents[_0x4baa('0x5')](_0x46461e+':'+_0x4e1017['id'],_0x4e1017);ChatGroupEvents['emit'](_0x46461e,_0x4e1017);_0x36e357(null);};}for(var e in events){if(events[_0x4baa('0x6')](e)){var event=events[e];ChatGroup[_0x4baa('0x7')](e,emitEvent(event));}}module[_0x4baa('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 22bc9dc..50aee1a 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 _0xee77=['exports','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./chatGroup.attributes'];(function(_0x38f78c,_0x5d3e49){var _0x10e22f=function(_0x38024d){while(--_0x38024d){_0x38f78c['push'](_0x38f78c['shift']());}};_0x10e22f(++_0x5d3e49);}(_0xee77,0x117));var _0x7ee7=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0xee77[_0x468b0f];return _0x3e74d9;};'use strict';var _=require(_0x7ee7('0x0'));var util=require(_0x7ee7('0x1'));var logger=require(_0x7ee7('0x2'))(_0x7ee7('0x3'));var moment=require(_0x7ee7('0x4'));var BPromise=require(_0x7ee7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ee7('0x6'));var rimraf=require(_0x7ee7('0x7'));var config=require('../../config/environment');var attributes=require(_0x7ee7('0x8'));module[_0x7ee7('0x9')]=function(_0x39d6a7,_0x21fcf9){return _0x39d6a7['define'](_0x7ee7('0xa'),attributes,{'tableName':_0x7ee7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa129=['define','ChatGroup','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatGroup.attributes','exports'];(function(_0x57ea3e,_0x3b4afc){var _0x4bee28=function(_0x41a8bc){while(--_0x41a8bc){_0x57ea3e['push'](_0x57ea3e['shift']());}};_0x4bee28(++_0x3b4afc);}(_0xa129,0xab));var _0x9a12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa129[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9a12('0x0'));var util=require(_0x9a12('0x1'));var logger=require(_0x9a12('0x2'))(_0x9a12('0x3'));var moment=require(_0x9a12('0x4'));var BPromise=require(_0x9a12('0x5'));var rp=require(_0x9a12('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a12('0x7'));var config=require(_0x9a12('0x8'));var attributes=require(_0x9a12('0x9'));module[_0x9a12('0xa')]=function(_0x1aeca5,_0x223fff){return _0x1aeca5[_0x9a12('0xb')](_0x9a12('0xc'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 9bfc319..4d813d7 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 _0xcb99=['rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','then','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','ChatGroup,\x20%s,\x20%s','message','info','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x5ee99b,_0x80c401){var _0x330cef=function(_0x298d23){while(--_0x298d23){_0x5ee99b['push'](_0x5ee99b['shift']());}};_0x330cef(++_0x80c401);}(_0xcb99,0x8b));var _0x9cb9=function(_0x38a6c6,_0x4062ca){_0x38a6c6=_0x38a6c6-0x0;var _0x142f0a=_0xcb99[_0x38a6c6];return _0x142f0a;};'use strict';var _=require(_0x9cb9('0x0'));var util=require('util');var moment=require(_0x9cb9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9cb9('0x2'));var db=require(_0x9cb9('0x3'))['db'];var utils=require(_0x9cb9('0x4'));var logger=require('../../config/logger')(_0x9cb9('0x5'));var config=require(_0x9cb9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9cb9('0x7')]['http']({'port':0x232a});config[_0x9cb9('0x8')]=_[_0x9cb9('0x9')](config[_0x9cb9('0x8')],{'host':_0x9cb9('0xa'),'port':0x18eb});var socket=require(_0x9cb9('0xb'))(new Redis(config[_0x9cb9('0x8')]));require(_0x9cb9('0xc'))[_0x9cb9('0xd')](socket);function respondWithRpcPromise(_0x48d99a,_0x5264c9,_0xe6d275){return new BPromise(function(_0x392f93,_0x1b4fa6){return client['request'](_0x48d99a,_0xe6d275)[_0x9cb9('0xe')](function(_0x3d38f1){logger['info']('ChatGroup,\x20%s,\x20%s',_0x5264c9,_0x9cb9('0xf'));logger[_0x9cb9('0x10')](_0x9cb9('0x11'),_0x5264c9,_0x9cb9('0xf'),JSON['stringify'](_0x3d38f1));if(_0x3d38f1[_0x9cb9('0x12')]){if(_0x3d38f1[_0x9cb9('0x12')][_0x9cb9('0x13')]===0x1f4){logger[_0x9cb9('0x12')](_0x9cb9('0x14'),_0x5264c9,_0x3d38f1[_0x9cb9('0x12')][_0x9cb9('0x15')]);return _0x1b4fa6(_0x3d38f1[_0x9cb9('0x12')][_0x9cb9('0x15')]);}logger[_0x9cb9('0x12')](_0x9cb9('0x14'),_0x5264c9,_0x3d38f1[_0x9cb9('0x12')][_0x9cb9('0x15')]);return _0x392f93(_0x3d38f1[_0x9cb9('0x12')][_0x9cb9('0x15')]);}else{logger[_0x9cb9('0x16')](_0x9cb9('0x14'),_0x5264c9,_0x9cb9('0xf'));_0x392f93(_0x3d38f1['result']['message']);}})[_0x9cb9('0x17')](function(_0x50169f){logger['error']('ChatGroup,\x20%s,\x20%s',_0x5264c9,_0x50169f);_0x1b4fa6(_0x50169f);});});} \ No newline at end of file +var _0x5096=['../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x2c00d9,_0x2ad7c8){var _0x359c2b=function(_0x560e41){while(--_0x560e41){_0x2c00d9['push'](_0x2c00d9['shift']());}};_0x359c2b(++_0x2ad7c8);}(_0x5096,0x6c));var _0x6509=function(_0x51ed46,_0x4b7ad2){_0x51ed46=_0x51ed46-0x0;var _0xc2b1e7=_0x5096[_0x51ed46];return _0xc2b1e7;};'use strict';var _=require(_0x6509('0x0'));var util=require(_0x6509('0x1'));var moment=require(_0x6509('0x2'));var BPromise=require(_0x6509('0x3'));var rs=require(_0x6509('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6509('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6509('0x6'))(_0x6509('0x7'));var config=require(_0x6509('0x8'));var jayson=require(_0x6509('0x9'));var client=jayson[_0x6509('0xa')][_0x6509('0xb')]({'port':0x232a});config['redis']=_[_0x6509('0xc')](config[_0x6509('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x6509('0xe'))(new Redis(config[_0x6509('0xd')]));require(_0x6509('0xf'))[_0x6509('0x10')](socket);function respondWithRpcPromise(_0x284e8a,_0x5ce668,_0x208920){return new BPromise(function(_0x3e9667,_0x59620c){return client['request'](_0x284e8a,_0x208920)[_0x6509('0x11')](function(_0xcc6706){logger[_0x6509('0x12')](_0x6509('0x13'),_0x5ce668,_0x6509('0x14'));logger[_0x6509('0x15')](_0x6509('0x16'),_0x5ce668,_0x6509('0x14'),JSON[_0x6509('0x17')](_0xcc6706));if(_0xcc6706[_0x6509('0x18')]){if(_0xcc6706['error'][_0x6509('0x19')]===0x1f4){logger[_0x6509('0x18')](_0x6509('0x13'),_0x5ce668,_0xcc6706['error'][_0x6509('0x1a')]);return _0x59620c(_0xcc6706[_0x6509('0x18')][_0x6509('0x1a')]);}logger[_0x6509('0x18')](_0x6509('0x13'),_0x5ce668,_0xcc6706[_0x6509('0x18')]['message']);return _0x3e9667(_0xcc6706[_0x6509('0x18')][_0x6509('0x1a')]);}else{logger[_0x6509('0x12')]('ChatGroup,\x20%s,\x20%s',_0x5ce668,'request\x20sent');_0x3e9667(_0xcc6706[_0x6509('0x1b')][_0x6509('0x1a')]);}})[_0x6509('0x1c')](function(_0x550ace){logger[_0x6509('0x18')](_0x6509('0x13'),_0x5ce668,_0x550ace);_0x59620c(_0x550ace);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index b061cf1..3fe2b4b 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 _0x045c=['remove','update','register','length','chatGroup:','./chatGroup.events','save'];(function(_0x6899c7,_0x363413){var _0x5186ee=function(_0x2f83a9){while(--_0x2f83a9){_0x6899c7['push'](_0x6899c7['shift']());}};_0x5186ee(++_0x363413);}(_0x045c,0x171));var _0xc045=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x045c[_0x1facfa];return _0x9ec701;};'use strict';var ChatGroupEvents=require(_0xc045('0x0'));var events=[_0xc045('0x1'),_0xc045('0x2'),_0xc045('0x3')];function createListener(_0x138b63,_0x2e1362){return function(_0x334b01){_0x2e1362['emit'](_0x138b63,_0x334b01);};}function removeListener(_0x1a0a3c,_0xf892dd){return function(){ChatGroupEvents['removeListener'](_0x1a0a3c,_0xf892dd);};}exports[_0xc045('0x4')]=function(_0x4b22f1){for(var _0x1b9dcc=0x0,_0x590add=events[_0xc045('0x5')];_0x1b9dcc<_0x590add;_0x1b9dcc++){var _0xf52f18=events[_0x1b9dcc];var _0x308dad=createListener(_0xc045('0x6')+_0xf52f18,_0x4b22f1);ChatGroupEvents['on'](_0xf52f18,_0x308dad);}}; \ No newline at end of file +var _0xd72c=['update','emit','register','length','./chatGroup.events','save'];(function(_0x1a7a4,_0x128fcc){var _0x331f25=function(_0x277394){while(--_0x277394){_0x1a7a4['push'](_0x1a7a4['shift']());}};_0x331f25(++_0x128fcc);}(_0xd72c,0x82));var _0xcd72=function(_0x396d8c,_0x2d0313){_0x396d8c=_0x396d8c-0x0;var _0x4575ca=_0xd72c[_0x396d8c];return _0x4575ca;};'use strict';var ChatGroupEvents=require(_0xcd72('0x0'));var events=[_0xcd72('0x1'),'remove',_0xcd72('0x2')];function createListener(_0x1636ff,_0x108a79){return function(_0x1321ba){_0x108a79[_0xcd72('0x3')](_0x1636ff,_0x1321ba);};}function removeListener(_0xb48d43,_0x315c0c){return function(){ChatGroupEvents['removeListener'](_0xb48d43,_0x315c0c);};}exports[_0xcd72('0x4')]=function(_0x19b3d3){for(var _0x1d1f01=0x0,_0x28cb56=events[_0xcd72('0x5')];_0x1d1f01<_0x28cb56;_0x1d1f01++){var _0x52be5e=events[_0x1d1f01];var _0x11f4ae=createListener('chatGroup:'+_0x52be5e,_0x19b3d3);ChatGroupEvents['on'](_0x52be5e,_0x11f4ae);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index eba321f..10e48c9 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 _0x9a13=['getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','put','/:id','delete','exports','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/:id/unread'];(function(_0x15a082,_0x1d7185){var _0x504c63=function(_0x401d5c){while(--_0x401d5c){_0x15a082['push'](_0x15a082['shift']());}};_0x504c63(++_0x1d7185);}(_0x9a13,0x16c));var _0x39a1=function(_0x3b7dd4,_0x44878b){_0x3b7dd4=_0x3b7dd4-0x0;var _0x360a20=_0x9a13[_0x3b7dd4];return _0x360a20;};'use strict';var multer=require('multer');var util=require(_0x39a1('0x0'));var path=require(_0x39a1('0x1'));var timeout=require('connect-timeout');var express=require(_0x39a1('0x2'));var router=express['Router']();var fs_extra=require(_0x39a1('0x3'));var auth=require(_0x39a1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x39a1('0x5'));var controller=require(_0x39a1('0x6'));router[_0x39a1('0x7')]('/',auth[_0x39a1('0x8')](),controller['index']);router[_0x39a1('0x7')]('/describe',auth[_0x39a1('0x8')](),controller['describe']);router['get']('/:id',auth[_0x39a1('0x8')](),controller['show']);router[_0x39a1('0x7')](_0x39a1('0x9'),auth[_0x39a1('0x8')](),controller[_0x39a1('0xa')]);router[_0x39a1('0x7')](_0x39a1('0xb'),auth[_0x39a1('0x8')](),controller[_0x39a1('0xc')]);router[_0x39a1('0x7')](_0x39a1('0xd'),auth['isAuthenticated'](),controller[_0x39a1('0xe')]);router[_0x39a1('0xf')]('/',auth[_0x39a1('0x8')](),controller[_0x39a1('0x10')]);router[_0x39a1('0xf')](_0x39a1('0xb'),auth[_0x39a1('0x8')](),controller[_0x39a1('0x11')]);router[_0x39a1('0xf')](_0x39a1('0xd'),auth['isAuthenticated'](),controller['addMessage']);router[_0x39a1('0x12')](_0x39a1('0x13'),auth[_0x39a1('0x8')](),controller['update']);router[_0x39a1('0x14')](_0x39a1('0x13'),auth[_0x39a1('0x8')](),controller['destroy']);router[_0x39a1('0x14')](_0x39a1('0xb'),auth[_0x39a1('0x8')](),controller['removeMembers']);module[_0x39a1('0x15')]=router; \ No newline at end of file +var _0x7203=['/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','addMessage','put','update','delete','destroy','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x81a736,_0x1e437d){var _0x208d8c=function(_0x652e65){while(--_0x652e65){_0x81a736['push'](_0x81a736['shift']());}};_0x208d8c(++_0x1e437d);}(_0x7203,0x1c8));var _0x3720=function(_0x4ce3eb,_0x5a5701){_0x4ce3eb=_0x4ce3eb-0x0;var _0x892cb0=_0x7203[_0x4ce3eb];return _0x892cb0;};'use strict';var multer=require('multer');var util=require(_0x3720('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3720('0x1'));var router=express['Router']();var fs_extra=require(_0x3720('0x2'));var auth=require(_0x3720('0x3'));var interaction=require(_0x3720('0x4'));var config=require('../../config/environment');var controller=require('./chatGroup.controller');router[_0x3720('0x5')]('/',auth[_0x3720('0x6')](),controller[_0x3720('0x7')]);router[_0x3720('0x5')](_0x3720('0x8'),auth[_0x3720('0x6')](),controller[_0x3720('0x9')]);router[_0x3720('0x5')](_0x3720('0xa'),auth[_0x3720('0x6')](),controller[_0x3720('0xb')]);router['get'](_0x3720('0xc'),auth[_0x3720('0x6')](),controller[_0x3720('0xd')]);router[_0x3720('0x5')](_0x3720('0xe'),auth[_0x3720('0x6')](),controller[_0x3720('0xf')]);router[_0x3720('0x5')](_0x3720('0x10'),auth[_0x3720('0x6')](),controller['getMessages']);router[_0x3720('0x11')]('/',auth['isAuthenticated'](),controller[_0x3720('0x12')]);router[_0x3720('0x11')](_0x3720('0xe'),auth[_0x3720('0x6')](),controller[_0x3720('0x13')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0x3720('0x14')]);router[_0x3720('0x15')](_0x3720('0xa'),auth[_0x3720('0x6')](),controller[_0x3720('0x16')]);router[_0x3720('0x17')](_0x3720('0xa'),auth[_0x3720('0x6')](),controller[_0x3720('0x18')]);router[_0x3720('0x17')](_0x3720('0xe'),auth[_0x3720('0x6')](),controller['removeMembers']);module[_0x3720('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index c7de6e1..51339cf 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 _0x6017=['STRING','DATE','out','sequelize','exports','BOOLEAN','ENUM','star','TEXT'];(function(_0x49a15e,_0x39863c){var _0x23af4c=function(_0x3f7771){while(--_0x3f7771){_0x49a15e['push'](_0x49a15e['shift']());}};_0x23af4c(++_0x39863c);}(_0x6017,0xae));var _0x7601=function(_0x449053,_0x39c938){_0x449053=_0x449053-0x0;var _0x2f9f4f=_0x6017[_0x449053];return _0x2f9f4f;};'use strict';var Sequelize=require(_0x7601('0x0'));module[_0x7601('0x1')]={'closed':{'type':Sequelize[_0x7601('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x7601('0x3')](_0x7601('0x4'),'thumb'),'defaultValue':_0x7601('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x7601('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7601('0x6')]},'secondDisposition':{'type':Sequelize[_0x7601('0x6')]},'thirdDisposition':{'type':Sequelize[_0x7601('0x6')]},'note':{'type':Sequelize[_0x7601('0x6')]},'browserName':{'type':Sequelize[_0x7601('0x6')]},'browserVersion':{'type':Sequelize[_0x7601('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x7601('0x6')]},'deviceModel':{'type':Sequelize[_0x7601('0x6')]},'deviceVendor':{'type':Sequelize[_0x7601('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x7601('0x5')]},'customerIp':{'type':Sequelize[_0x7601('0x6')]},'formData':{'type':Sequelize[_0x7601('0x5')]('long')},'read1stAt':{'type':Sequelize[_0x7601('0x7')]},'lastMsgAt':{'type':Sequelize[_0x7601('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x7601('0x3')]('in',_0x7601('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x7601('0x6')]},'customerPort':{'type':Sequelize[_0x7601('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x7601('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x7601('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x9158=['ENUM','thumb','TEXT','STRING','DATE','out','sequelize','exports','BOOLEAN'];(function(_0x18496a,_0x523477){var _0xae656a=function(_0xc99e49){while(--_0xc99e49){_0x18496a['push'](_0x18496a['shift']());}};_0xae656a(++_0x523477);}(_0x9158,0x16e));var _0x8915=function(_0x44073a,_0x1a0ab9){_0x44073a=_0x44073a-0x0;var _0x39adcf=_0x9158[_0x44073a];return _0x39adcf;};'use strict';var Sequelize=require(_0x8915('0x0'));module[_0x8915('0x1')]={'closed':{'type':Sequelize[_0x8915('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x8915('0x3')]('star',_0x8915('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x8915('0x5')]},'mailTranscript':{'type':Sequelize[_0x8915('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x8915('0x7')]},'disposition':{'type':Sequelize[_0x8915('0x6')]},'secondDisposition':{'type':Sequelize[_0x8915('0x6')]},'thirdDisposition':{'type':Sequelize[_0x8915('0x6')]},'note':{'type':Sequelize[_0x8915('0x6')]},'browserName':{'type':Sequelize[_0x8915('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x8915('0x6')]},'osVersion':{'type':Sequelize[_0x8915('0x6')]},'deviceModel':{'type':Sequelize[_0x8915('0x6')]},'deviceVendor':{'type':Sequelize[_0x8915('0x6')]},'deviceType':{'type':Sequelize[_0x8915('0x6')]},'referer':{'type':Sequelize[_0x8915('0x5')]},'customerIp':{'type':Sequelize[_0x8915('0x6')]},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize[_0x8915('0x7')]},'lastMsgAt':{'type':Sequelize[_0x8915('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x8915('0x3')]('in',_0x8915('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x8915('0x6')]},'customerPort':{'type':Sequelize[_0x8915('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x8915('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index e8db80d..054a15e 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 _0xa939=['ChatMessage','create','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','Interaction\x20already\x20assigned','attachmentUpload','file','originalname','basename','filename','mimetype','attachmentDownload','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','agentAlias','System','%s%d','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','addMessage','ids','omit','nolimit','pick','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','includeAgent','findAll','addTags','setTags','spread','emit','removeTags','unix','files','attachments','transcript-%d-%s.zip','firstName','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','server','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./chatInteraction.socket','register','http','client','request','then','request\x20sent','debug','stringify','error','code','message','info','ChatInteraction,\x20%s,\x20%s','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','end','stack','name','send','render','merge','body','contact','interaction','account','Users','map','fullname','TagIds','split','forEach','Tags','push','waiting','talking','answered','unmanaged','abandoned','total','closed','UserId','disposition','index','ChatInteraction','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','order','sort','where','filters','select','field','color','from','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','tools_tags','expr','search','conditions','value','`\x20=\x200','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','type','text','start','Tag','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','keys','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','unreadMessages','a.key','Account.key','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','all','show','params','includeAll','include','options','describe','createVidaooSession','findOne','ChatWebsite','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa939,0x6d));var _0x9a93=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa939[_0xf50820];return _0x2a9b10;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a93('0x0'));var zipdir=require(_0x9a93('0x1'));var jsonpatch=require(_0x9a93('0x2'));var rp=require('request-promise');var moment=require(_0x9a93('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9a93('0x4'));var util=require(_0x9a93('0x5'));var path=require('path');var sox=require(_0x9a93('0x6'));var csv=require(_0x9a93('0x7'));var ejs=require(_0x9a93('0x8'));var fs=require('fs');var fs_extra=require(_0x9a93('0x9'));var _=require(_0x9a93('0xa'));var squel=require(_0x9a93('0xb'));var crypto=require(_0x9a93('0xc'));var jsforce=require(_0x9a93('0xd'));var deskjs=require(_0x9a93('0xe'));var toCsv=require(_0x9a93('0x7'));var querystring=require(_0x9a93('0xf'));var Papa=require(_0x9a93('0x10'));var Redis=require(_0x9a93('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9a93('0x12'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x9a93('0x13'));var hardwareService=require(_0x9a93('0x14'));var logger=require(_0x9a93('0x15'))(_0x9a93('0x16'));var utils=require(_0x9a93('0x17'));var config=require(_0x9a93('0x18'));var licenseUtil=require(_0x9a93('0x19'));var db=require('../../mysqldb')['db'];config[_0x9a93('0x1a')]=_['defaults'](config['redis'],{'host':_0x9a93('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9a93('0x1a')]));require(_0x9a93('0x1c'))[_0x9a93('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x9a93('0x1e')]({'port':0x232b});var client9004=jayson[_0x9a93('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3b47d7,_0x589e7d,_0x5a74ce,_0x475ec1){return new BPromise(function(_0x3a2c70,_0x9bf520){var _0x234e1c=_0x475ec1||client;return _0x234e1c[_0x9a93('0x20')](_0x3b47d7,_0x5a74ce)[_0x9a93('0x21')](function(_0x1632bc){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x589e7d,_0x9a93('0x22'));logger[_0x9a93('0x23')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x589e7d,_0x9a93('0x22'),JSON[_0x9a93('0x24')](_0x1632bc));if(_0x1632bc[_0x9a93('0x25')]){if(_0x1632bc[_0x9a93('0x25')][_0x9a93('0x26')]===0x1f4){logger[_0x9a93('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x589e7d,_0x1632bc['error']['message']);return _0x9bf520(_0x1632bc[_0x9a93('0x25')]['message']);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x589e7d,_0x1632bc[_0x9a93('0x25')][_0x9a93('0x27')]);return _0x3a2c70(_0x1632bc[_0x9a93('0x25')][_0x9a93('0x27')]);}else{logger[_0x9a93('0x28')](_0x9a93('0x29'),_0x589e7d,_0x9a93('0x22'));_0x3a2c70(_0x1632bc[_0x9a93('0x2a')][_0x9a93('0x27')]);}})[_0x9a93('0x2b')](function(_0x4995ee){logger[_0x9a93('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x589e7d,_0x4995ee);_0x9bf520(_0x4995ee);});});}function respondWithStatusCode(_0x21568a,_0x30779e){_0x30779e=_0x30779e||0xcc;return function(_0x1ad96f){if(_0x1ad96f){return _0x21568a[_0x9a93('0x2c')](_0x30779e);}return _0x21568a['status'](_0x30779e)['end']();};}function respondWithResult(_0x5a9b79,_0x4ac772){_0x4ac772=_0x4ac772||0xc8;return function(_0x3de00a){if(_0x3de00a){return _0x5a9b79[_0x9a93('0x2d')](_0x4ac772)[_0x9a93('0x2e')](_0x3de00a);}};}function respondWithFilteredResult(_0x2357ae,_0x2a2279){return function(_0x27d8cd){if(_0x27d8cd){var _0x169c62=typeof _0x2a2279[_0x9a93('0x2f')]===_0x9a93('0x30')&&typeof _0x2a2279[_0x9a93('0x31')]===_0x9a93('0x30');var _0x17bcf9=_0x27d8cd[_0x9a93('0x32')];var _0x170424=_0x169c62?0x0:_0x2a2279[_0x9a93('0x2f')];var _0x591dda=_0x169c62?_0x27d8cd[_0x9a93('0x32')]:_0x2a2279[_0x9a93('0x2f')]+_0x2a2279[_0x9a93('0x31')];var _0x3873cb;if(_0x591dda>=_0x17bcf9){_0x591dda=_0x17bcf9;_0x3873cb=0xc8;}else{_0x3873cb=0xce;}_0x2357ae['status'](_0x3873cb);return _0x2357ae['set'](_0x9a93('0x33'),_0x170424+'-'+_0x591dda+'/'+_0x17bcf9)[_0x9a93('0x2e')](_0x27d8cd);}return null;};}function patchUpdates(_0xb32b6){return function(_0x42cfcc){try{jsonpatch['apply'](_0x42cfcc,_0xb32b6,!![]);}catch(_0x138f66){return BPromise[_0x9a93('0x34')](_0x138f66);}return _0x42cfcc[_0x9a93('0x35')]();};}function saveUpdates(_0xca1743,_0x49ef3f){return function(_0x188f51){if(_0x188f51){return _0x188f51[_0x9a93('0x36')](_0xca1743)[_0x9a93('0x21')](function(_0x5d5422){return _0x5d5422;});}return null;};}function removeEntity(_0x4e485a,_0x5f5a28){return function(_0x57144f){if(_0x57144f){return _0x57144f[_0x9a93('0x37')]()[_0x9a93('0x21')](function(){_0x4e485a[_0x9a93('0x2d')](0xcc)[_0x9a93('0x38')]();});}};}function handleEntityNotFound(_0xe5c054,_0x70a99e){return function(_0x1d1d90){if(!_0x1d1d90){_0xe5c054[_0x9a93('0x2c')](0x194);}return _0x1d1d90;};}function handleError(_0xcf4df0,_0x514eba){_0x514eba=_0x514eba||0x1f4;return function(_0x31ce00){logger[_0x9a93('0x25')](_0x31ce00[_0x9a93('0x39')]);if(_0x31ce00[_0x9a93('0x3a')]){delete _0x31ce00[_0x9a93('0x3a')];}_0xcf4df0[_0x9a93('0x2d')](_0x514eba)[_0x9a93('0x3b')](_0x31ce00);};}function getMustacheRender(_0x2332f4,_0x56c2fe){return Mustache[_0x9a93('0x3c')](_0x2332f4,_[_0x9a93('0x3d')](_0x56c2fe[_0x9a93('0x3e')],{'contact':_0x56c2fe[_0x9a93('0x3f')],'message':_0x56c2fe[_0x9a93('0x27')],'agent':_0x56c2fe['agent'],'interaction':_0x56c2fe[_0x9a93('0x40')],'account':_0x56c2fe[_0x9a93('0x41')]}))||'';}function getInteractionUsers(_0x1fe8fe,_0x584462){return new BPromise(function(_0x755ca2,_0x173491){try{if(_0x584462[_0x1fe8fe['id']]){_0x1fe8fe[_0x9a93('0x42')]=_[_0x9a93('0x43')](_0x584462[_0x1fe8fe['id']],function(_0x26cac8){return{'id':_0x26cac8['id'],'fullname':_0x26cac8[_0x9a93('0x44')]};});}}catch(_0x373166){_0x173491(_0x373166);}_0x755ca2(_0x1fe8fe);});}function getInteractionTags(_0x3a2599,_0x67a30c){return new BPromise(function(_0xb464d4,_0x4bc35d){try{if(_0x3a2599[_0x9a93('0x45')]){_0x3a2599['Tags']=[];_0x3a2599[_0x9a93('0x45')][_0x9a93('0x46')](',')[_0x9a93('0x47')](function(_0x424ffa){_0x3a2599[_0x9a93('0x48')][_0x9a93('0x49')](_0x67a30c[_0x424ffa]);});}delete _0x3a2599['TagIds'];}catch(_0x169945){_0x4bc35d(_0x169945);}_0xb464d4(_0x3a2599);});}function updateChatInteraction(_0x28fde3,_0x2951d9,_0x5d0ad9){return new BPromise(function(_0x5d2fac,_0x10e469){return getInteractionUsers(_0x28fde3,_0x5d0ad9)[_0x9a93('0x21')](function(_0x18bfc5){return getInteractionTags(_0x18bfc5,_0x2951d9);})[_0x9a93('0x21')](function(_0x3ea9f6){return getStateInteraction(_0x3ea9f6);})[_0x9a93('0x21')](function(_0x275369){_0x5d2fac(_0x275369);})['catch'](function(_0x36adc3){_0x10e469(_0x36adc3);});});}function getStateInteraction(_0x5fc840){return new BPromise(function(_0x24b89e){_0x5fc840[_0x9a93('0x4a')]=0x0;_0x5fc840[_0x9a93('0x4b')]=0x0;_0x5fc840[_0x9a93('0x4c')]=0x0;_0x5fc840[_0x9a93('0x4d')]=0x0;_0x5fc840[_0x9a93('0x4e')]=0x0;_0x5fc840[_0x9a93('0x4f')]=0x0;if(!_0x5fc840[_0x9a93('0x50')]&&!_0x5fc840[_0x9a93('0x51')]){_0x5fc840['waiting']+=0x1;}if(!_0x5fc840[_0x9a93('0x50')]&&_0x5fc840[_0x9a93('0x51')]){_0x5fc840[_0x9a93('0x4b')]+=0x1;if(_0x5fc840[_0x9a93('0x4a')]){_0x5fc840[_0x9a93('0x4a')]-=0x1;}}if(_0x5fc840[_0x9a93('0x50')]&&_0x5fc840[_0x9a93('0x52')]==='abandoned'){_0x5fc840[_0x9a93('0x4e')]+=0x1;if(_0x5fc840[_0x9a93('0x4a')]){_0x5fc840[_0x9a93('0x4a')]-=0x1;}}else if(_0x5fc840[_0x9a93('0x50')]&&!_0x5fc840[_0x9a93('0x51')]&&_0x5fc840[_0x9a93('0x52')]){_0x5fc840[_0x9a93('0x4d')]+=0x1;if(_0x5fc840['waiting']){_0x5fc840[_0x9a93('0x4a')]-=0x1;}}else if(_0x5fc840['closed']&&_0x5fc840[_0x9a93('0x51')]){_0x5fc840[_0x9a93('0x4c')]+=0x1;if(_0x5fc840[_0x9a93('0x4b')]){_0x5fc840[_0x9a93('0x4b')]-=0x1;}}_0x5fc840[_0x9a93('0x4f')]+=0x1;_0x24b89e(_0x5fc840);});}exports[_0x9a93('0x53')]=function(_0x2499ea,_0x3d8128){var _0x532fb9={},_0x591346={},_0x1bddc5={'count':0x0,'rows':[]};var _0x301798=_[_0x9a93('0x43')](db[_0x9a93('0x54')][_0x9a93('0x55')],function(_0x4f1c35){return{'name':_0x4f1c35[_0x9a93('0x56')],'type':_0x4f1c35['type'][_0x9a93('0x57')]};});_0x591346[_0x9a93('0x58')]=_['map'](_0x301798,'name');_0x591346['query']=_['keys'](_0x2499ea[_0x9a93('0x59')]);_0x591346['filters']=_[_0x9a93('0x5a')](_0x591346[_0x9a93('0x58')],_0x591346[_0x9a93('0x59')]);_0x532fb9[_0x9a93('0x5b')]=_[_0x9a93('0x5a')](_0x591346[_0x9a93('0x58')],qs['fields'](_0x2499ea[_0x9a93('0x59')][_0x9a93('0x5c')]));_0x532fb9[_0x9a93('0x5b')]=_0x532fb9[_0x9a93('0x5b')][_0x9a93('0x5d')]?_0x532fb9['attributes']:_0x591346[_0x9a93('0x58')];if(!_0x2499ea[_0x9a93('0x59')]['hasOwnProperty']('nolimit')){_0x532fb9[_0x9a93('0x31')]=qs[_0x9a93('0x31')](_0x2499ea['query'][_0x9a93('0x31')]);_0x532fb9[_0x9a93('0x2f')]=qs[_0x9a93('0x2f')](_0x2499ea['query'][_0x9a93('0x2f')]);}_0x532fb9[_0x9a93('0x5e')]=qs[_0x9a93('0x5f')](_0x2499ea['query']['sort']);_0x532fb9[_0x9a93('0x60')]=qs[_0x9a93('0x61')](_['pick'](_0x2499ea[_0x9a93('0x59')],_0x591346[_0x9a93('0x61')]),_0x301798);var _0x41072f=[];var _0x51d5ac=squel[_0x9a93('0x62')]()[_0x9a93('0x63')]('id')[_0x9a93('0x63')]('name')[_0x9a93('0x63')](_0x9a93('0x64'))[_0x9a93('0x65')]('tools_tags');var _0x5464cc=squel[_0x9a93('0x62')]()[_0x9a93('0x63')]('u.id')[_0x9a93('0x63')](_0x9a93('0x66'))['field']('ui.ChatInteractionId')[_0x9a93('0x65')]('user_has_chat_interactions','ui')[_0x9a93('0x67')](_0x9a93('0x68'),'u',_0x9a93('0x69'));var _0x5f037f=squel['select']()[_0x9a93('0x65')](_0x9a93('0x6a'),'i')[_0x9a93('0x67')](_0x9a93('0x6b'),'c',_0x9a93('0x6c'))['left_join'](_0x9a93('0x68'),'o',_0x9a93('0x6d'))['left_join'](_0x9a93('0x6e'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0x9a93('0x67')](_0x9a93('0x6f'),'me',_0x9a93('0x70'))['left_join']('chat_interaction_has_tags','it',_0x9a93('0x71'))[_0x9a93('0x67')](_0x9a93('0x72'),'t','t.id\x20=\x20it.TagId');var _0x51ab9d=squel[_0x9a93('0x73')]();var _0x54009f=[];var _0x2bd2f9=squel[_0x9a93('0x73')]();var _0x195c97;if(_0x2499ea[_0x9a93('0x59')][_0x9a93('0x74')]){_0x195c97=as['parseSearch'](_0x2499ea[_0x9a93('0x59')]['search']);var _0x26b0c1=_0x195c97['sqlOperator'];for(var _0x4cf7be=0x0;_0x4cf7be<_0x195c97[_0x9a93('0x75')][_0x9a93('0x5d')];_0x4cf7be++){var _0x398c9f=_0x195c97[_0x9a93('0x75')][_0x4cf7be];var _0x5d3d68='i';var _0x2ec407=_['find'](_0x301798,[_0x9a93('0x3a'),_0x398c9f[_0x9a93('0x63')]]);if(!_0x2ec407){switch(_0x398c9f['field']){case'unreadMessages':if(_0x398c9f[_0x9a93('0x76')]==0x1){_0x5f037f['having']('`'+_0x398c9f[_0x9a93('0x63')]+_0x9a93('0x77'));}else{_0x5f037f['having']('`'+_0x398c9f[_0x9a93('0x63')]+'`\x20>\x200');}break;case'Contact':if(_0x398c9f['operator']===_0x9a93('0x78')){if(_0x398c9f[_0x9a93('0x76')][_0x9a93('0x46')]('\x20')[_0x9a93('0x5d')]>0x1){_0x51ab9d[_0x26b0c1](_0x9a93('0x79'),qs['getFullTextValue'](_0x398c9f['value']),null);}else{var _0x5bf715='%'+_0x398c9f[_0x9a93('0x76')]+'%';_0x51ab9d[_0x26b0c1](_0x9a93('0x7a'),_0x5bf715,_0x5bf715,_0x5bf715);}}else{_0x2ec407=_[_0x9a93('0x7b')](_0x301798,[_0x9a93('0x3a'),_0x9a93('0x7c')]);_0x398c9f['field']=_0x9a93('0x7c');_0x56aad5=as['buildExpression'](_0x5d3d68,_0x2ec407[_0x9a93('0x7d')],_0x398c9f);_0x51ab9d[_0x26b0c1](_0x56aad5[_0x9a93('0x7e')],_0x56aad5[_0x9a93('0x76')][_0x9a93('0x7f')],_0x56aad5[_0x9a93('0x76')][_0x9a93('0x38')]);}break;case _0x9a93('0x80'):var _0x41f1c3=_0x398c9f[_0x9a93('0x76')][_0x9a93('0x46')](',')[_0x9a93('0x43')](function(_0x5ab341){return Number(_0x5ab341);});_0x41f1c3[_0x9a93('0x47')](function(_0x196ff3){_0x2bd2f9['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x196ff3+',%');});_0x54009f=_[_0x9a93('0x81')](_0x54009f,_0x41f1c3);break;case _0x9a93('0x82'):if(_0x398c9f[_0x9a93('0x83')]===_0x9a93('0x78')){_0x51ab9d[_0x26b0c1](_0x9a93('0x84'),'%'+_0x398c9f[_0x9a93('0x76')]+'%',null);}else{_0x2ec407=_[_0x9a93('0x7b')](_0x301798,['name',_0x9a93('0x51')]);_0x398c9f[_0x9a93('0x63')]='UserId';_0x56aad5=as[_0x9a93('0x85')](_0x5d3d68,_0x2ec407[_0x9a93('0x7d')],_0x398c9f);_0x51ab9d[_0x26b0c1](_0x56aad5[_0x9a93('0x7e')],_0x56aad5[_0x9a93('0x76')][_0x9a93('0x7f')],_0x56aad5[_0x9a93('0x76')][_0x9a93('0x38')]);}break;case _0x9a93('0x3e'):_0x56aad5=as[_0x9a93('0x85')]('me',null,_0x398c9f);_0x51ab9d[_0x26b0c1](_0x56aad5[_0x9a93('0x7e')],_0x56aad5[_0x9a93('0x76')][_0x9a93('0x7f')],_0x56aad5[_0x9a93('0x76')]['end']);break;}}else{var _0x56aad5=as[_0x9a93('0x85')](_0x5d3d68,_0x2ec407[_0x9a93('0x7d')],_0x398c9f);_0x51ab9d[_0x26b0c1](_0x56aad5[_0x9a93('0x7e')],_0x56aad5[_0x9a93('0x76')][_0x9a93('0x7f')],_0x56aad5[_0x9a93('0x76')][_0x9a93('0x38')]);}}}else{var _0x11508a=_(_0x2499ea[_0x9a93('0x59')])[_0x9a93('0x86')]()[_0x9a93('0x43')](function(_0xd5d92f){return _[_0x9a93('0x87')](_0x301798,[_0x9a93('0x3a'),_0xd5d92f])?_0xd5d92f:undefined;})[_0x9a93('0x88')]()[_0x9a93('0x76')]();if(!_[_0x9a93('0x89')](_0x11508a)){_0x11508a[_0x9a93('0x47')](function(_0x7ea7a7){if(_0x7ea7a7===_0x9a93('0x8a')){_0x5f037f[_0x9a93('0x60')](_0x9a93('0x8b'),[]['concat'](_0x2499ea[_0x9a93('0x59')][_0x7ea7a7]));}else if(_0x7ea7a7===_0x9a93('0x8c')){var _0x4d0985=JSON['parse'](_0x2499ea[_0x9a93('0x59')][_0x7ea7a7])[_0x9a93('0x8d')];var _0x5aebf1=JSON['parse'](_0x2499ea[_0x9a93('0x59')][_0x7ea7a7])[_0x9a93('0x8e')];_0x5f037f[_0x9a93('0x60')](_0x9a93('0x8f'),_0x4d0985,_0x5aebf1);}else{if(_0x2499ea[_0x9a93('0x59')][_0x7ea7a7]===_0x9a93('0x90')){_0x5f037f[_0x9a93('0x60')]('i.'+_0x7ea7a7+_0x9a93('0x91'));}else{_0x5f037f[_0x9a93('0x60')]('i.'+_0x7ea7a7+_0x9a93('0x92'),_0x2499ea[_0x9a93('0x59')][_0x7ea7a7]);}}});}if(_0x2499ea['query'][_0x9a93('0x93')]){if(_0x2499ea[_0x9a93('0x59')]['read']==0x1){_0x5f037f[_0x9a93('0x94')](_0x9a93('0x95'));}else{_0x5f037f['having'](_0x9a93('0x96'));}}if(_0x2499ea[_0x9a93('0x59')][_0x9a93('0x97')]){_0x54009f=_[_0x9a93('0x98')](_0x2499ea[_0x9a93('0x59')][_0x9a93('0x97')])?_0x2499ea[_0x9a93('0x59')][_0x9a93('0x97')]:new Array(_0x2499ea[_0x9a93('0x59')][_0x9a93('0x97')]);_0x54009f[_0x9a93('0x47')](function(_0x540a58){_0x2bd2f9['or'](_0x9a93('0x99'),'%,'+_0x540a58+',%');});}if(_0x2499ea[_0x9a93('0x59')][_0x9a93('0x9a')]){var _0x24a13a=_0x2499ea['query'][_0x9a93('0x9a')][_0x9a93('0x9b')]('\x5c','\x5c\x5c')[_0x9a93('0x9b')](/'/g,'\x27\x27');if(qs[_0x9a93('0x9c')](_0x24a13a)){_0x51ab9d['or'](_0x9a93('0x9d'),_0x24a13a+'%');}else{_0x51ab9d['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x24a13a))['or'](_0x9a93('0x9e'),_0x24a13a+'%');}}}_0x5f037f[_0x9a93('0x60')](_0x51ab9d);_0x5f037f['group'](_0x9a93('0x9f'));var _0x269e87={'type':db[_0x9a93('0xa0')][_0x9a93('0xa1')][_0x9a93('0xa2')],'raw':!![]};var _0x47cd60=_0x5f037f['clone']();_0x47cd60[_0x9a93('0x63')](_0x9a93('0x9f'));_0x47cd60[_0x9a93('0x63')](_0x9a93('0xa3'),'unreadMessages');if(_0x532fb9[_0x9a93('0x5e')]){_0x532fb9[_0x9a93('0x5e')][_0x9a93('0x47')](function(_0x4fbcdd){var _0x16b9dc=_0x4fbcdd[0x0]===_0x9a93('0xa4')?_0x4fbcdd[0x0]:'i.'+_0x4fbcdd[0x0];_0x5f037f[_0x9a93('0x5e')](_0x16b9dc,_0x4fbcdd[0x1]==='DESC'?![]:!![]);});}if(!_[_0x9a93('0x89')](_0x54009f)){_0x5f037f[_0x9a93('0x94')](_0x2bd2f9);_0x47cd60[_0x9a93('0x60')](_0x9a93('0xa5'),_0x54009f);}BPromise[_0x9a93('0xa6')]()[_0x9a93('0x21')](function(){if(!_0x195c97){if(_0x2499ea[_0x9a93('0x59')][_0x9a93('0x8a')])return;_0x47cd60['where'](_0x9a93('0xa7'));_0x5f037f[_0x9a93('0x60')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x2499ea[_0x9a93('0xa8')][_0x9a93('0xa9')]!==_0x9a93('0xaa'))return;return _0x2499ea['user'][_0x9a93('0xab')]({'attributes':['id'],'raw':!![]})[_0x9a93('0x21')](function(_0x137b13){if(_[_0x9a93('0x89')](_0x137b13)){_0x47cd60[_0x9a93('0x60')](_0x9a93('0xac'));_0x5f037f[_0x9a93('0x60')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x47cd60[_0x9a93('0x60')](_0x9a93('0x8b'),_[_0x9a93('0x43')](_0x137b13,'id'));_0x5f037f[_0x9a93('0x60')](_0x9a93('0x8b'),_[_0x9a93('0x43')](_0x137b13,'id'));}});})[_0x9a93('0x21')](function(){if(_0x2499ea[_0x9a93('0xa8')][_0x9a93('0xa9')]===_0x9a93('0xaa')&&!_0x195c97&&!_0x2499ea[_0x9a93('0x59')][_0x9a93('0x8a')])return[];return db[_0x9a93('0xad')][_0x9a93('0x59')](_0x47cd60[_0x9a93('0xae')](),_0x269e87);})[_0x9a93('0x21')](function(_0xc820c5){_0x1bddc5[_0x9a93('0x32')]=_0xc820c5[_0x9a93('0x5d')];if(_0x1bddc5[_0x9a93('0x32')]===0x0)return[];return db[_0x9a93('0xad')]['query'](_0x51d5ac[_0x9a93('0xae')](),_0x269e87)[_0x9a93('0x21')](function(_0x90c486){_0x41072f=_[_0x9a93('0xaf')](_0x90c486,'id');_0x269e87=_[_0x9a93('0x3d')](_0x269e87,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2499ea[_0x9a93('0x59')]['fields']){_0x532fb9[_0x9a93('0x5b')][_0x9a93('0x47')](function(_0x3bcc90){_0x5f037f[_0x9a93('0x63')]('i.'+_0x3bcc90);});}else{_0x5f037f[_0x9a93('0x63')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x9a93('0xb0'));_0x5f037f[_0x9a93('0x63')](_0x9a93('0xb1'),_0x9a93('0xb2'));_0x5f037f[_0x9a93('0x63')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x5f037f[_0x9a93('0x63')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x5f037f[_0x9a93('0x63')](_0x9a93('0xb3'));_0x5f037f[_0x9a93('0x63')](_0x9a93('0xb4'),'Contact.firstName');_0x5f037f[_0x9a93('0x63')](_0x9a93('0xb5'),_0x9a93('0xb6'));_0x5f037f[_0x9a93('0x63')](_0x9a93('0xb7'),_0x9a93('0xb8'));_0x5f037f['field']('c.phone',_0x9a93('0xb9'));_0x5f037f[_0x9a93('0x63')](_0x9a93('0xba'),_0x9a93('0xbb'));_0x5f037f['field']('c.fax','Contact.fax');_0x5f037f[_0x9a93('0x63')](_0x9a93('0xbc'),'Owner.fullname');_0x5f037f[_0x9a93('0x63')](_0x9a93('0xbd'),'Owner.internal');_0x5f037f[_0x9a93('0x63')](_0x9a93('0xbe'),'TagIds');}if(_0x532fb9[_0x9a93('0x31')])_0x5f037f[_0x9a93('0x31')](_0x532fb9['limit']);if(_0x532fb9['offset'])_0x5f037f[_0x9a93('0x2f')](_0x532fb9['offset']);return db[_0x9a93('0xad')]['query'](_0x5f037f['toString'](),_0x269e87);})[_0x9a93('0x21')](function(_0x4aba15){if(_0x4aba15[_0x9a93('0x5d')]>0x0)_0x5464cc[_0x9a93('0x60')](_0x9a93('0xbf'),_[_0x9a93('0x43')](_0x4aba15,'id'));return db[_0x9a93('0xad')][_0x9a93('0x59')](_0x5464cc['toString'](),_0x269e87)[_0x9a93('0x21')](function(_0x7ec560){var _0x3d8b9a=_[_0x9a93('0xc0')](_0x7ec560,'ChatInteractionId');var _0x1b16e7=[];_0x4aba15['forEach'](function(_0x179a23){_0x1b16e7['push'](updateChatInteraction(_0x179a23,_0x41072f,_0x3d8b9a));});return BPromise[_0x9a93('0xc1')](_0x1b16e7);});});})[_0x9a93('0x21')](function(_0x561123){_0x1bddc5['rows']=_0x561123;return _0x1bddc5;})[_0x9a93('0x21')](respondWithFilteredResult(_0x3d8128,_0x532fb9))['catch'](handleError(_0x3d8128,null));};exports[_0x9a93('0xc2')]=function(_0x3e5e29,_0x23089d){var _0x50b153={'raw':![],'where':{'id':_0x3e5e29[_0x9a93('0xc3')]['id']}},_0x50b0e7={};_0x50b0e7[_0x9a93('0x58')]=_[_0x9a93('0x86')](db[_0x9a93('0x54')]['rawAttributes']);_0x50b0e7['query']=_[_0x9a93('0x86')](_0x3e5e29[_0x9a93('0x59')]);_0x50b0e7['filters']=_['intersection'](_0x50b0e7[_0x9a93('0x58')],_0x50b0e7[_0x9a93('0x59')]);_0x50b153[_0x9a93('0x5b')]=_[_0x9a93('0x5a')](_0x50b0e7[_0x9a93('0x58')],qs['fields'](_0x3e5e29[_0x9a93('0x59')]['fields']));_0x50b153[_0x9a93('0x5b')]=_0x50b153[_0x9a93('0x5b')][_0x9a93('0x5d')]?_0x50b153['attributes']:_0x50b0e7['model'];if(_0x3e5e29[_0x9a93('0x59')][_0x9a93('0xc4')]){_0x50b153[_0x9a93('0xc5')]=[{'all':!![]}];}_0x50b153=_[_0x9a93('0x3d')]({},_0x50b153,_0x3e5e29[_0x9a93('0xc6')]);return db[_0x9a93('0x54')][_0x9a93('0x7b')](_0x50b153)[_0x9a93('0x21')](handleEntityNotFound(_0x23089d,null))[_0x9a93('0x21')](respondWithResult(_0x23089d,null))[_0x9a93('0x2b')](handleError(_0x23089d,null));};exports['create']=function(_0x4477a6,_0xa1690d){return db['ChatInteraction']['create'](_0x4477a6[_0x9a93('0x3e')],{})[_0x9a93('0x21')](respondWithResult(_0xa1690d,0xc9))[_0x9a93('0x2b')](handleError(_0xa1690d,null));};exports['update']=function(_0x5098bb,_0x37f008){if(_0x5098bb[_0x9a93('0x3e')]['id']){delete _0x5098bb[_0x9a93('0x3e')]['id'];}return db[_0x9a93('0x54')][_0x9a93('0x7b')]({'where':{'id':_0x5098bb[_0x9a93('0xc3')]['id']}})[_0x9a93('0x21')](handleEntityNotFound(_0x37f008,null))['then'](saveUpdates(_0x5098bb[_0x9a93('0x3e')],null))['then'](respondWithResult(_0x37f008,null))[_0x9a93('0x2b')](handleError(_0x37f008,null));};exports[_0x9a93('0x37')]=function(_0x525a81,_0x9949d2){return db[_0x9a93('0x54')]['find']({'where':{'id':_0x525a81[_0x9a93('0xc3')]['id']}})[_0x9a93('0x21')](handleEntityNotFound(_0x9949d2,null))[_0x9a93('0x21')](removeEntity(_0x9949d2,null))['catch'](handleError(_0x9949d2,null));};exports[_0x9a93('0xc7')]=function(_0xfe94bf,_0x5f43be){return db[_0x9a93('0x54')][_0x9a93('0xc7')]()[_0x9a93('0x21')](respondWithResult(_0x5f43be,null))['catch'](handleError(_0x5f43be,null));};exports[_0x9a93('0xc8')]=function(_0x3ab357,_0x46b1d4){var _0x1ec599=_0x3ab357[_0x9a93('0xc3')]['id'];var _0x21b3de;var _0x5b4c5a;var _0xf98427;return db['ChatInteraction'][_0x9a93('0xc9')]({'where':{'id':_0x1ec599}})['then'](function(_0x11b7ec){_0x21b3de=_0x11b7ec;return db[_0x9a93('0xca')][_0x9a93('0xc9')]({'where':{'id':_0x11b7ec['ChatWebsiteId']},'attributes':['id','vidaooApiKey',_0x9a93('0xcb'),_0x9a93('0xcc'),_0x9a93('0xcd'),_0x9a93('0xce')],'raw':!![]});})[_0x9a93('0x21')](function(_0x56daee){if(_0x56daee&&_0x56daee[_0x9a93('0xcf')]&&_0x56daee[_0x9a93('0xcb')]){_0x5b4c5a=_0x56daee;var _0x54bec6={'interaction':{'id':_0x1ec599},'agent':{'id':_0x3ab357['user']['id'],'name':_0x3ab357[_0x9a93('0xa8')]['name'],'fullname':_0x3ab357[_0x9a93('0xa8')][_0x9a93('0x44')],'email':_0x3ab357['user']['email']},'contact':_0x3ab357[_0x9a93('0x3e')]['contact'],'account':_0x3ab357['body'][_0x9a93('0x41')]};var _0x10a9f0={'rejectUnauthorized':![],'method':'POST','url':_0x9a93('0xd0'),'headers':{'X-APIKEY':_0x56daee['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3ab357['user']['email']],'buttons':null,'topic':_0x5b4c5a[_0x9a93('0xcc')],'note':_[_0x9a93('0xd1')](_0x5b4c5a[_0x9a93('0xcd')])?null:getMustacheRender(_0x5b4c5a['vidaooNote'],_0x54bec6),'metadata':null},'redirect':_0x9a93('0xd2'),'json':!![]};try{if(!_['isNull'](_0x5b4c5a['vidaooMetadata'])){var _0x2b4f7a=getMustacheRender(_0x5b4c5a['vidaooMetadata'],_0x54bec6);var _0x216f4f=JSON[_0x9a93('0xd3')](_0x2b4f7a);_0x10a9f0[_0x9a93('0x3e')]['metadata']=_0x216f4f;}}catch(_0x8b80dc){throw new db[(_0x9a93('0xa0'))][(_0x9a93('0xd4'))](_0x9a93('0xd5'));}return rp(_0x10a9f0);}else{throw new db[(_0x9a93('0xa0'))][(_0x9a93('0xd4'))](_0x9a93('0xd6'));}})['then'](function(_0x318256){_0xf98427=_0x318256;if(_0xf98427['id']){var _0x4a8ead={'body':_0xf98427[_0x9a93('0xd7')],'ChatWebsiteId':_0x5b4c5a['id'],'ChatInteractionId':_0x21b3de['id'],'direction':'out','UserId':_0x3ab357[_0x9a93('0xa8')]['id']};return db[_0x9a93('0xd8')][_0x9a93('0xd9')](_0x4a8ead,{});}else{throw new db[(_0x9a93('0xa0'))]['ValidationError'](_0x9a93('0xda'));}})[_0x9a93('0x21')](function(){return _0x21b3de[_0x9a93('0xdb')]({'vidaooSessionId':_0xf98427['id']});})[_0x9a93('0x21')](respondWithResult(_0x46b1d4,null))[_0x9a93('0x2b')](handleError(_0x46b1d4,null));};exports[_0x9a93('0xdc')]=function(_0x49e268,_0x5b99f3){if(_0x49e268['body']['id']){delete _0x49e268['body']['id'];}return db[_0x9a93('0x54')]['find']({'where':{'id':_0x49e268[_0x9a93('0xc3')]['id']},'include':[{'model':db['CmContact'],'as':_0x9a93('0xdd')}]})[_0x9a93('0x21')](handleEntityNotFound(_0x5b99f3,null))['then'](saveUpdates(_0x49e268[_0x9a93('0x3e')],null))[_0x9a93('0x21')](respondWithResult(_0x5b99f3,null))[_0x9a93('0x2b')](handleError(_0x5b99f3,null));};exports['abandon']=function(_0x322228,_0xe91712,_0x5d1fcf){if(_0x322228['body']['id']){delete _0x322228[_0x9a93('0x3e')]['id'];}return db[_0x9a93('0x54')][_0x9a93('0x7b')]({'where':{'id':_0x322228['params']['id']}})[_0x9a93('0x21')](function(_0x3c3103){if(!_0x3c3103){logger[_0x9a93('0x25')](_0x9a93('0xde'),_0x9a93('0xdf'),0x194,'entity\x20not\x20found');_0xe91712[_0x9a93('0x2c')](0x194);}else{if(_0x3c3103[_0x9a93('0x51')]){throw new db['Sequelize'][(_0x9a93('0xd4'))](_0x9a93('0xe0'));}}return _0x3c3103;})['then'](function(_0x2b6979){if(_0x2b6979){return _0x2b6979[_0x9a93('0x36')]({'closed':_0x322228[_0x9a93('0x3e')][_0x9a93('0x50')],'disposition':_0x322228[_0x9a93('0x3e')][_0x9a93('0x52')]})['then'](function(_0xf43e2f){return _0xf43e2f;});}})[_0x9a93('0x21')](function(_0x51c69d){return respondWithRpcPromise('AbandonInteraction',_0x9a93('0xdf'),_0x322228[_0x9a93('0x3e')],client9004);})[_0x9a93('0x21')](respondWithResult(_0xe91712,null))[_0x9a93('0x2b')](handleError(_0xe91712,null));};exports[_0x9a93('0xe1')]=function(_0x14b573,_0x41313d,_0x3bc479){_0x14b573[_0x9a93('0x3e')][_0x9a93('0x3a')]=_0x14b573[_0x9a93('0xe2')][_0x9a93('0xe3')];_0x14b573['body'][_0x9a93('0xe4')]=_0x14b573[_0x9a93('0xe2')][_0x9a93('0xe5')];_0x14b573[_0x9a93('0x3e')][_0x9a93('0x7d')]=_0x14b573[_0x9a93('0xe2')][_0x9a93('0xe6')];return db['Attachment'][_0x9a93('0xd9')](_0x14b573[_0x9a93('0x3e')])[_0x9a93('0x21')](respondWithResult(_0x41313d,0xc9))[_0x9a93('0x2b')](handleError(_0x41313d,null));};exports[_0x9a93('0xe7')]=function(_0x323c1f,_0x5785f5,_0x96e6b3){return db[_0x9a93('0x54')][_0x9a93('0xc9')]({'where':{'id':_0x323c1f[_0x9a93('0xc3')]['id']},'raw':!![]})[_0x9a93('0x21')](handleEntityNotFound(_0x5785f5,null))[_0x9a93('0x21')](function(_0x219143){if(_0x219143){if(_0x219143[_0x9a93('0x50')]){return _0x5785f5[_0x9a93('0x2d')](0x193)[_0x9a93('0x2e')]({'status':0x193,'message':_0x9a93('0xe8')});}return db[_0x9a93('0xe9')][_0x9a93('0xc9')]({'where':{'id':_0x323c1f[_0x9a93('0x59')][_0x9a93('0xea')]},'raw':!![]})[_0x9a93('0x21')](handleEntityNotFound(_0x5785f5,null));}})[_0x9a93('0x21')](function(_0x1bafb7){if(_0x1bafb7){var _0xf55e36=_0x1bafb7[_0x9a93('0xeb')]!==null;var _0x268e96=path[_0x9a93('0xec')](config[_0x9a93('0xed')],_0x9a93('0xee'));if(_0xf55e36){_0x268e96=path[_0x9a93('0xec')](_0x268e96,_0x9a93('0xef'));}var _0x797c2e=path[_0x9a93('0xec')](_0x268e96,_0x1bafb7['basename']);return _0x5785f5[_0x9a93('0xf0')](_0x797c2e);}})[_0x9a93('0x2b')](handleError(_0x5785f5,null));};exports[_0x9a93('0xf1')]=function(_0x10e17f,_0x328ffb){var _0x3fd6fc=null;var _0x179879=null;var _0x5b3e38=null;var _0x2b86a5=null;if(_0x10e17f[_0x9a93('0x3e')]['id']){delete _0x10e17f[_0x9a93('0x3e')]['id'];}if(_0x10e17f[_0x9a93('0x3e')][_0x9a93('0xf2')]){_0x2b86a5=path[_0x9a93('0xec')](config[_0x9a93('0xed')],_0x9a93('0xf3'),util[_0x9a93('0xf4')](_0x9a93('0xf5'),Date[_0x9a93('0xf6')]()));_0x10e17f['body'][_0x9a93('0xf7')]=_0x2b86a5;}return db[_0x9a93('0x54')][_0x9a93('0x7b')]({'where':{'id':_0x10e17f['params']['id']},'include':[{'model':db[_0x9a93('0xd8')],'as':'Messages','include':[{'model':db[_0x9a93('0x82')],'as':_0x9a93('0x82')}]}]})[_0x9a93('0x21')](handleEntityNotFound(_0x328ffb,null))['then'](saveUpdates(_0x10e17f['body'],null))[_0x9a93('0x21')](function(_0x595241){if(_0x595241){_0x3fd6fc=_0x595241;return db[_0x9a93('0xca')][_0x9a93('0x7b')]({'where':{'id':_0x3fd6fc[_0x9a93('0x8a')]}});}})[_0x9a93('0x21')](function(_0x42f834){if(_0x42f834){_0x5b3e38=_0x42f834;return db['CmContact']['find']({'where':{'id':_0x3fd6fc[_0x9a93('0x7c')]}});}})[_0x9a93('0x21')](function(_0x4980cd){if(_0x4980cd){_0x179879=_0x4980cd;if(_0x2b86a5){var _0x2385a9=null;for(var _0x56f8be=0x1;_0x56f8be<_0x3fd6fc[_0x9a93('0xf8')][_0x9a93('0x5d')];++_0x56f8be){_0x2385a9=_0x3fd6fc['Messages'][_0x56f8be];var _0x2a8102=_0x2385a9[_0x9a93('0x51')]?util[_0x9a93('0xf4')]('%s%d',_0x5b3e38[_0x9a93('0xf9')],_0x2385a9['UserId']):_0x9a93('0xfa');var _0x4fa721=_0x10e17f[_0x9a93('0x3e')]['customer']||util[_0x9a93('0xf4')](_0x9a93('0xfb'),_0x9a93('0xfc'),_0x2385a9[_0x9a93('0x7c')]);switch(_0x5b3e38[_0x9a93('0xfd')]){case _0x9a93('0xfe'):_0x2a8102=_0x2385a9[_0x9a93('0x51')]?util[_0x9a93('0xf4')](_0x9a93('0xfb'),_0x5b3e38[_0x9a93('0xf9')],_0x2385a9[_0x9a93('0x51')]):'System';break;case _0x9a93('0xff'):_0x2a8102=_0x2385a9[_0x9a93('0x51')]?_0x2385a9[_0x9a93('0x82')][_0x9a93('0x100')]||_0x2385a9[_0x9a93('0x82')]['fullname']:_0x9a93('0xfa');break;case _0x9a93('0x101'):_0x2a8102=_0x2385a9[_0x9a93('0x51')]?_0x2385a9['User']['fullname']:'System';break;default:_0x2a8102=_0x2385a9['UserId']?util['format'](_0x9a93('0xfb'),_0x5b3e38['agentAlias'],_0x2385a9['UserId']):'System';}var _0x438b56=util['format'](_0x9a93('0x102'),moment(_0x2385a9[_0x9a93('0x8c')])[_0x9a93('0xf4')](_0x9a93('0x103')),_0x2385a9[_0x9a93('0x104')]==='in'?_0x4fa721:_0x2a8102,_0x2385a9[_0x9a93('0x3e')]);if(!_0x2385a9[_0x9a93('0x105')]){fs['appendFileSync'](_0x2b86a5,_0x438b56);}}return db[_0x9a93('0x106')][_0x9a93('0xc9')]({'where':{'service':!![]},'include':[{'model':db[_0x9a93('0x107')],'as':'Smtp','raw':!![]}]});}}})[_0x9a93('0x21')](function(_0x430f7e){if(_0x430f7e&&_0x430f7e[_0x9a93('0x108')]&&_0x10e17f[_0x9a93('0x3e')]){var _0x357e51={'tls':{'rejectUnauthorized':![]}};if(_0x430f7e[_0x9a93('0x108')][_0x9a93('0x109')]){_0x357e51[_0x9a93('0x109')]=_0x430f7e[_0x9a93('0x108')][_0x9a93('0x109')];}else{_0x357e51[_0x9a93('0x10a')]=_0x430f7e[_0x9a93('0x108')][_0x9a93('0x10a')];_0x357e51[_0x9a93('0x10b')]=_0x430f7e['Smtp'][_0x9a93('0x10b')];_0x357e51[_0x9a93('0x10c')]=_0x430f7e[_0x9a93('0x108')][_0x9a93('0x10c')];}if(_0x430f7e[_0x9a93('0x108')]['authentication']){_0x357e51['auth']={'user':_0x430f7e[_0x9a93('0x108')]['user'],'pass':_0x430f7e[_0x9a93('0x108')][_0x9a93('0x10d')]};}return respondWithRpcPromise(_0x9a93('0x10e'),_0x9a93('0x10f'),{'account':_0x357e51,'message':{'from':util['format'](_0x9a93('0x110'),_0x430f7e[_0x9a93('0x3a')],_0x430f7e[_0x9a93('0x111')]||_0x430f7e[_0x9a93('0x108')][_0x9a93('0xa8')]),'to':_0x10e17f[_0x9a93('0x3e')][_0x9a93('0xf2')],'subject':_0x9a93('0x112'),'text':util[_0x9a93('0xf4')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x10e17f['body']['mailTranscript']),'attachments':[{'path':_0x2b86a5}]}})['then'](function(){return _0x3fd6fc;})[_0x9a93('0x2b')](function(_0x36374a){console[_0x9a93('0x25')](_0x36374a);});}else{return _0x3fd6fc;}})[_0x9a93('0x21')](respondWithStatusCode(_0x328ffb,0xc8))[_0x9a93('0x2b')](handleError(_0x328ffb,null));};exports['addMessage']=function(_0x48cca6,_0x38cfad,_0x20e54b){return db[_0x9a93('0xd8')][_0x9a93('0x7b')]({'where':{'id':_0x48cca6[_0x9a93('0xc3')]['id']}})['then'](handleEntityNotFound(_0x38cfad,null))[_0x9a93('0x21')](function(_0x25c310){if(_0x25c310){return _0x25c310[_0x9a93('0x113')](_0x48cca6['body'][_0x9a93('0x114')],_[_0x9a93('0x115')](_0x48cca6[_0x9a93('0x3e')],[_0x9a93('0x114'),'id'])||{});}})['then'](respondWithResult(_0x38cfad,null))[_0x9a93('0x2b')](handleError(_0x38cfad,null));};exports['getMessages']=function(_0xdee151,_0x33802b,_0x238dbd){var _0x1d3a24={'raw':![],'where':{}};var _0x5c80b1={};var _0x31aa53={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x9a93('0xc9')]({'where':{'id':_0xdee151['params']['id']}})[_0x9a93('0x21')](handleEntityNotFound(_0x33802b,null))[_0x9a93('0x21')](function(_0x1c6b66){if(_0x1c6b66){_0x5c80b1[_0x9a93('0x58')]=_['keys'](db[_0x9a93('0xd8')][_0x9a93('0x55')]);_0x5c80b1[_0x9a93('0x59')]=_[_0x9a93('0x86')](_0xdee151[_0x9a93('0x59')]);_0x5c80b1['filters']=_[_0x9a93('0x5a')](_0x5c80b1[_0x9a93('0x58')],_0x5c80b1['query']);_0x1d3a24[_0x9a93('0x5b')]=_['intersection'](_0x5c80b1[_0x9a93('0x58')],qs[_0x9a93('0x5c')](_0xdee151['query'][_0x9a93('0x5c')]));_0x1d3a24[_0x9a93('0x5b')]=_0x1d3a24[_0x9a93('0x5b')][_0x9a93('0x5d')]?_0x1d3a24[_0x9a93('0x5b')]:_0x5c80b1[_0x9a93('0x58')];if(!_0xdee151[_0x9a93('0x59')]['hasOwnProperty'](_0x9a93('0x116'))){_0x1d3a24['limit']=qs[_0x9a93('0x31')](_0xdee151[_0x9a93('0x59')][_0x9a93('0x31')]);_0x1d3a24[_0x9a93('0x2f')]=qs[_0x9a93('0x2f')](_0xdee151[_0x9a93('0x59')][_0x9a93('0x2f')]);}_0x1d3a24[_0x9a93('0x5e')]=qs['sort'](_0xdee151[_0x9a93('0x59')][_0x9a93('0x5f')]);_0x1d3a24['where']=qs[_0x9a93('0x61')](_[_0x9a93('0x117')](_0xdee151[_0x9a93('0x59')],_0x5c80b1[_0x9a93('0x61')]));_0x1d3a24[_0x9a93('0x60')][_0x9a93('0x118')]=_0x1c6b66['id'];if(_0xdee151[_0x9a93('0x59')][_0x9a93('0x9a')]){_0x1d3a24[_0x9a93('0x60')]=_[_0x9a93('0x3d')](_0x1d3a24[_0x9a93('0x60')],{'$or':_[_0x9a93('0x43')](_0x1d3a24['attributes'],function(_0x3259c0){var _0x4ff943={};_0x4ff943[_0x3259c0]={'$like':'%'+_0xdee151['query'][_0x9a93('0x9a')]+'%'};return _0x4ff943;})});}if(_0xdee151[_0x9a93('0x59')][_0x9a93('0x8d')]){var _0x1eb0cd=_0xdee151[_0x9a93('0x59')][_0x9a93('0x8d')][_0x9a93('0x46')](',');var _0x3ec5cd={};_0x3ec5cd[_0x1eb0cd[0x0]]={'$gte':moment(_0x1eb0cd[0x1])['format'](_0x9a93('0x119'))};_0x1d3a24[_0x9a93('0x60')]=_[_0x9a93('0x3d')](_0x1d3a24[_0x9a93('0x60')],_0x3ec5cd);}_0x1d3a24=_[_0x9a93('0x3d')]({},_0x1d3a24,_0xdee151[_0x9a93('0xc6')]);return db[_0x9a93('0xd8')][_0x9a93('0x32')]({'where':_0x1d3a24[_0x9a93('0x60')]})['then'](function(_0x38db52){_0x31aa53[_0x9a93('0x32')]=_0x38db52;if(_0xdee151['query']['includeAll']){_0x1d3a24[_0x9a93('0xc5')]=[{'all':!![]}];}return db[_0x9a93('0xd8')]['findAll'](_0x1d3a24);})[_0x9a93('0x21')](function(_0x1b81a0){_0x31aa53[_0x9a93('0x11a')]=_0x1b81a0;return _0x31aa53;});}})['then'](respondWithFilteredResult(_0x33802b,_0x1d3a24))['catch'](handleError(_0x33802b,null));};exports[_0x9a93('0x11b')]=function(_0x417663,_0x22b02d,_0x53a33a){var _0x3dbd97={'where':{}},_0x2ef224={},_0x449e45={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x9a93('0xc9')]({'where':{'id':_0x417663[_0x9a93('0xc3')]['id']}})[_0x9a93('0x21')](handleEntityNotFound(_0x22b02d,null))[_0x9a93('0x21')](function(_0x11dfa6){if(_0x11dfa6){_0x2ef224[_0x9a93('0x58')]=_[_0x9a93('0x86')](db[_0x9a93('0xd8')][_0x9a93('0x55')]);_0x2ef224['query']=_['keys'](_0x417663[_0x9a93('0x59')]);_0x2ef224[_0x9a93('0x61')]=_[_0x9a93('0x5a')](_0x2ef224[_0x9a93('0x58')],_0x2ef224[_0x9a93('0x59')]);_0x3dbd97[_0x9a93('0x5b')]=_[_0x9a93('0x5a')](_0x2ef224[_0x9a93('0x58')],qs[_0x9a93('0x5c')](_0x417663['query'][_0x9a93('0x5c')]));_0x3dbd97[_0x9a93('0x5b')]=_0x3dbd97[_0x9a93('0x5b')][_0x9a93('0x5d')]?_0x3dbd97['attributes']:_0x2ef224[_0x9a93('0x58')];if(!_0x417663[_0x9a93('0x59')]['hasOwnProperty']('nolimit')){_0x3dbd97[_0x9a93('0x31')]=qs[_0x9a93('0x31')](_0x417663[_0x9a93('0x59')]['limit']);_0x3dbd97[_0x9a93('0x2f')]=qs[_0x9a93('0x2f')](_0x417663[_0x9a93('0x59')]['offset']);}_0x3dbd97[_0x9a93('0x5e')]=qs[_0x9a93('0x5f')](_0x417663[_0x9a93('0x59')]['sort']);_0x3dbd97[_0x9a93('0x60')]=qs[_0x9a93('0x61')](_[_0x9a93('0x117')](_0x417663[_0x9a93('0x59')],_0x2ef224['filters']));_0x3dbd97['where'][_0x9a93('0x118')]=_0x11dfa6['id'];if(_0x417663[_0x9a93('0x59')][_0x9a93('0x9a')]){_0x3dbd97[_0x9a93('0x60')]=_['merge'](_0x3dbd97[_0x9a93('0x60')],{'$or':_[_0x9a93('0x43')](_0x3dbd97['attributes'],function(_0x5b12ac){var _0x1c1d8a={};_0x1c1d8a[_0x5b12ac]={'$like':'%'+_0x417663[_0x9a93('0x59')][_0x9a93('0x9a')]+'%'};return _0x1c1d8a;})});}_0x3dbd97[_0x9a93('0x60')][_0x9a93('0x105')]=![];if(_0x417663['query']['id']){_0x3dbd97[_0x9a93('0x60')]['id']={'$gt':_0x417663[_0x9a93('0x59')]['id']};}_0x3dbd97=_['merge']({},_0x3dbd97,_0x417663[_0x9a93('0xc6')]);return db['ChatMessage'][_0x9a93('0x32')]({'where':_0x3dbd97[_0x9a93('0x60')]})[_0x9a93('0x21')](function(_0x3461ca){_0x449e45[_0x9a93('0x32')]=_0x3461ca;_0x3dbd97[_0x9a93('0xc5')]=[];if(_0x417663[_0x9a93('0x59')][_0x9a93('0x11c')]){_0x3dbd97['include'][_0x9a93('0x49')]({'model':db[_0x9a93('0x82')],'as':_0x9a93('0x82'),'attributes':['id','fullname','alias']});}if(_0x417663[_0x9a93('0x59')][_0x9a93('0xc4')]){_0x3dbd97['include']=[{'all':!![]}];}return db[_0x9a93('0xd8')][_0x9a93('0x11d')](_0x3dbd97);})[_0x9a93('0x21')](function(_0x1c2f9c){_0x449e45[_0x9a93('0x11a')]=_0x1c2f9c;return _0x449e45;});}})[_0x9a93('0x21')](respondWithFilteredResult(_0x22b02d,_0x3dbd97))[_0x9a93('0x2b')](handleError(_0x22b02d,null));};exports[_0x9a93('0x11e')]=function(_0x1744d3,_0x2e3fc1,_0x1140ad){return db[_0x9a93('0x54')]['find']({'where':{'id':_0x1744d3['params']['id']}})[_0x9a93('0x21')](handleEntityNotFound(_0x2e3fc1,null))[_0x9a93('0x21')](function(_0x6175bd){if(_0x6175bd){return _0x6175bd[_0x9a93('0x11f')](_0x1744d3[_0x9a93('0x3e')][_0x9a93('0x114')],_[_0x9a93('0x115')](_0x1744d3[_0x9a93('0x3e')],['ids','id'])||{})[_0x9a93('0x120')](function(){return db[_0x9a93('0x80')][_0x9a93('0x11d')]({'attributes':['id','name',_0x9a93('0x64')],'where':{'id':_0x1744d3[_0x9a93('0x3e')][_0x9a93('0x114')]}});})[_0x9a93('0x21')](function(_0x5e88e9){socket[_0x9a93('0x121')]('chatInteractionTags:save',{'id':Number(_0x1744d3[_0x9a93('0xc3')]['id']),'tags':_0x5e88e9||[]});return{'id':Number(_0x1744d3['params']['id']),'tags':_0x5e88e9||[]};});}})[_0x9a93('0x21')](respondWithResult(_0x2e3fc1,null))[_0x9a93('0x2b')](handleError(_0x2e3fc1,null));};exports['removeTags']=function(_0x42c5e8,_0x271de1,_0x15028d){return db['ChatInteraction'][_0x9a93('0x7b')]({'where':{'id':_0x42c5e8['params']['id']}})[_0x9a93('0x21')](handleEntityNotFound(_0x271de1,null))[_0x9a93('0x21')](function(_0x176634){if(_0x176634){return _0x176634[_0x9a93('0x122')](_0x42c5e8[_0x9a93('0x59')]['ids']);}})[_0x9a93('0x21')](respondWithStatusCode(_0x271de1,null))[_0x9a93('0x2b')](handleError(_0x271de1,null));};exports[_0x9a93('0xf0')]=function(_0x3fac4e,_0x12192e){var _0x124158=moment()[_0x9a93('0x123')]()[_0x9a93('0xae')]();var _0x5eeb05=path[_0x9a93('0xec')](config[_0x9a93('0xed')],'server',_0x9a93('0x124'),'tmp');var _0x192699=path[_0x9a93('0xec')](config[_0x9a93('0xed')],'server',_0x9a93('0x124'),_0x9a93('0x125'));var _0x5c5c43=path[_0x9a93('0xec')](_0x5eeb05,_0x124158);var _0x454f6f=util[_0x9a93('0xf4')](_0x9a93('0x126'),_0x3fac4e[_0x9a93('0xc3')]['id'],_0x124158);var _0x43cd87=path[_0x9a93('0xec')](_0x5eeb05,_0x454f6f);var _0x4b1d52=[];_0x4b1d52[_0x9a93('0x49')]({'model':db['User'],'as':_0x9a93('0x82'),'attributes':['id',_0x9a93('0x44')],'raw':!![]});_0x4b1d52['push']({'model':db['CmContact'],'as':_0x9a93('0xdd'),'attributes':['id',_0x9a93('0x127'),_0x9a93('0x128')],'raw':!![]});if(_0x3fac4e[_0x9a93('0x59')]['attachments']){_0x4b1d52['push']({'model':db[_0x9a93('0xe9')],'as':'Attachment','raw':!![]});}var _0x1f76d0=[{'model':db[_0x9a93('0xd8')],'as':_0x9a93('0xf8'),'attributes':['id',_0x9a93('0x3e'),'createdAt',_0x9a93('0x104'),_0x9a93('0x105'),_0x9a93('0x93')],'include':_0x4b1d52}];_0x1f76d0['push']({'model':db[_0x9a93('0xca')],'as':_0x9a93('0x129'),'attributes':['id',_0x9a93('0x3a')]});_0x1f76d0[_0x9a93('0x49')]({'model':db['User'],'as':_0x9a93('0x12a'),'attributes':['id',_0x9a93('0x44')]});return db[_0x9a93('0x54')]['find']({'where':{'id':_0x3fac4e[_0x9a93('0xc3')]['id']},'include':_0x1f76d0})[_0x9a93('0x21')](handleEntityNotFound(_0x12192e,null))[_0x9a93('0x21')](function(_0x1a7bdd){if(_0x1a7bdd){var _0x10472e=_0x1a7bdd[_0x9a93('0x12b')]({'plain':!![]});fs[_0x9a93('0x12c')](_0x5c5c43);var _0x629a77={'channel':_0x9a93('0x12d'),'account':_0x10472e[_0x9a93('0x129')][_0x9a93('0x3a')],'agent':_0x10472e[_0x9a93('0x12a')]?_0x10472e['Owner'][_0x9a93('0x44')]:_0x9a93('0x12e'),'createdAt':moment(_0x10472e[_0x9a93('0x8c')])[_0x9a93('0xf4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9a93('0xae')](),'closedAt':_0x10472e[_0x9a93('0x50')]?moment(_0x10472e[_0x9a93('0x12f')])[_0x9a93('0xf4')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x10472e[_0x9a93('0x52')],'chatInfo':{'browser':_0x10472e[_0x9a93('0x130')],'os':_0x10472e[_0x9a93('0x131')],'referer':_0x10472e[_0x9a93('0x132')],'customerIp':_0x10472e[_0x9a93('0x133')],'customerPort':_0x10472e[_0x9a93('0x134')]?_0x10472e['customerPort']:_0x9a93('0x12e')},'messages':_(_0x10472e[_0x9a93('0xf8')])[_0x9a93('0x135')]()[_0x9a93('0x9a')]({'secret':![]})['map'](function(_0x41497f){if(_0x41497f[_0x9a93('0xe9')]){var _0x34040b=path['join'](_0x192699,_0x41497f['Attachment'][_0x9a93('0xe4')]);if(fs[_0x9a93('0x136')](_0x34040b)){fs[_0x9a93('0x137')](_0x34040b)[_0x9a93('0x138')](fs[_0x9a93('0x139')](path[_0x9a93('0xec')](_0x5c5c43,_0x41497f[_0x9a93('0xe9')][_0x9a93('0xe4')])));}}return{'date':moment(_0x41497f[_0x9a93('0x8c')])[_0x9a93('0xf4')](_0x9a93('0x119'))[_0x9a93('0xae')](),'sender':_0x41497f['direction']===_0x9a93('0x13a')?_0x41497f[_0x9a93('0x82')]?_0x41497f[_0x9a93('0x82')][_0x9a93('0x44')]:_0x9a93('0xfa'):_0x41497f[_0x9a93('0xdd')][_0x9a93('0x127')]+(_0x41497f[_0x9a93('0xdd')][_0x9a93('0x128')]?'\x20'+_0x41497f[_0x9a93('0xdd')][_0x9a93('0x128')]:''),'body':_0x41497f[_0x9a93('0xe9')]?_0x41497f[_0x9a93('0xe9')][_0x9a93('0xe4')]:_0x41497f[_0x9a93('0x3e')],'direction':_0x41497f[_0x9a93('0x104')]===_0x9a93('0x13a')?'A':'C','secret':_0x41497f[_0x9a93('0x105')],'read':_0x41497f[_0x9a93('0x93')],'attachment':_0x41497f[_0x9a93('0xe9')]};})['value']()};return ejs[_0x9a93('0x13b')](path[_0x9a93('0xec')](config[_0x9a93('0xed')],_0x9a93('0x13c'),_0x9a93('0x13d'),_0x9a93('0x13e')),{'interaction':_0x629a77})[_0x9a93('0x21')](function(_0x1d2feb){var _0x1eec36=path[_0x9a93('0xec')](_0x5c5c43,_0x9a93('0x13f')+_0x10472e['id']+'-'+_0x124158+_0x9a93('0x140'));var _0x6b98ad={'path':_0x1eec36,'channel':_0x9a93('0x12d'),'interactionId':_0x10472e['id']};return pdf[_0x9a93('0x141')](_0x1d2feb,_0x6b98ad);})[_0x9a93('0x21')](function(){return new BPromise(function(_0x4d1946,_0x28199e){zipdir(_0x5c5c43,{'saveTo':_0x43cd87},function(_0x16b25b,_0x3a98f5){if(_0x16b25b)return _0x28199e(_0x16b25b);return _0x4d1946(_0x3a98f5);});})[_0x9a93('0x21')](function(){return new BPromise(function(_0x402f49,_0x2060c6){rimraf(_0x5c5c43,function(_0x10e200){if(_0x10e200)_0x2060c6(_0x10e200);return _0x402f49();});});})[_0x9a93('0x21')](function(){return _0x12192e[_0x9a93('0xf0')](_0x43cd87,_0x454f6f,function(_0xa77aa0){if(_0xa77aa0){console[_0x9a93('0x142')](_0x9a93('0x143'),_0xa77aa0);}else{fs[_0x9a93('0x144')](_0x43cd87);}});});});}else{return _0x12192e['sendStatus'](0xc8);}})[_0x9a93('0x2b')](handleError(_0x12192e,null));}; \ No newline at end of file +var _0x6c6a=['then','destroy','stack','name','send','render','merge','body','contact','agent','interaction','Users','map','TagIds','Tags','forEach','push','talking','answered','unmanaged','abandoned','total','UserId','waiting','closed','disposition','index','ChatInteraction','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','select','field','from','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_websites','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','role','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','params','keys','include','options','create','update','describe','createVidaooSession','findOne','vidaooApiKey','vidaooMetadata','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','vidaooNote','follow','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','originalname','basename','mimetype','Attachment','Unauthorized','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','System','customer','%s%d','Visitor','website_alias','agentAlias','alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','ids','getMessages','rawAttributes','nolimit','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','secret','includeAgent','setTags','color','emit','chatInteractionTags:save','removeTags','unix','server','tmp','files','transcript-%d-%s.zip','firstName','lastName','attachments','ChatWebsite','Account','Owner','get','mkdirSync','Chat','N.A.','browserName','osName','referer','customerIp','customerPort','tail','createReadStream','pipe','createWriteStream','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','count','offset','limit','set','reject','save'];(function(_0x2c4a8b,_0x415d2c){var _0x14a08a=function(_0x46a4eb){while(--_0x46a4eb){_0x2c4a8b['push'](_0x2c4a8b['shift']());}};_0x14a08a(++_0x415d2c);}(_0x6c6a,0x10d));var _0xa6c6=function(_0x1b6f6e,_0x516f27){_0x1b6f6e=_0x1b6f6e-0x0;var _0x1f7393=_0x6c6a[_0x1b6f6e];return _0x1f7393;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa6c6('0x0'));var zipdir=require(_0xa6c6('0x1'));var jsonpatch=require(_0xa6c6('0x2'));var rp=require(_0xa6c6('0x3'));var moment=require(_0xa6c6('0x4'));var BPromise=require(_0xa6c6('0x5'));var Mustache=require(_0xa6c6('0x6'));var util=require(_0xa6c6('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa6c6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa6c6('0x9'));var squel=require(_0xa6c6('0xa'));var crypto=require(_0xa6c6('0xb'));var jsforce=require(_0xa6c6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa6c6('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa6c6('0xe'));var authService=require(_0xa6c6('0xf'));var qs=require(_0xa6c6('0x10'));var as=require(_0xa6c6('0x11'));var pdf=require(_0xa6c6('0x12'));var hardwareService=require(_0xa6c6('0x13'));var logger=require('../../config/logger')(_0xa6c6('0x14'));var utils=require('../../config/utils');var config=require(_0xa6c6('0x15'));var licenseUtil=require(_0xa6c6('0x16'));var db=require(_0xa6c6('0x17'))['db'];config[_0xa6c6('0x18')]=_[_0xa6c6('0x19')](config[_0xa6c6('0x18')],{'host':_0xa6c6('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa6c6('0x18')]));require(_0xa6c6('0x1b'))[_0xa6c6('0x1c')](socket);var jayson=require(_0xa6c6('0x1d'));var client=jayson[_0xa6c6('0x1e')][_0xa6c6('0x1f')]({'port':0x232b});var client9004=jayson[_0xa6c6('0x1e')][_0xa6c6('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x363eb2,_0x29e171,_0x48b1ac,_0x3147b9){return new BPromise(function(_0x4b71aa,_0x5ccaa6){var _0x4e4c1a=_0x3147b9||client;return _0x4e4c1a[_0xa6c6('0x20')](_0x363eb2,_0x48b1ac)['then'](function(_0x5a64b2){logger[_0xa6c6('0x21')](_0xa6c6('0x22'),_0x29e171,_0xa6c6('0x23'));logger[_0xa6c6('0x24')](_0xa6c6('0x25'),_0x29e171,_0xa6c6('0x23'),JSON['stringify'](_0x5a64b2));if(_0x5a64b2[_0xa6c6('0x26')]){if(_0x5a64b2[_0xa6c6('0x26')]['code']===0x1f4){logger[_0xa6c6('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x29e171,_0x5a64b2[_0xa6c6('0x26')][_0xa6c6('0x27')]);return _0x5ccaa6(_0x5a64b2[_0xa6c6('0x26')]['message']);}logger['error'](_0xa6c6('0x22'),_0x29e171,_0x5a64b2[_0xa6c6('0x26')][_0xa6c6('0x27')]);return _0x4b71aa(_0x5a64b2[_0xa6c6('0x26')][_0xa6c6('0x27')]);}else{logger[_0xa6c6('0x21')](_0xa6c6('0x22'),_0x29e171,_0xa6c6('0x23'));_0x4b71aa(_0x5a64b2[_0xa6c6('0x28')][_0xa6c6('0x27')]);}})[_0xa6c6('0x29')](function(_0x503131){logger[_0xa6c6('0x26')](_0xa6c6('0x22'),_0x29e171,_0x503131);_0x5ccaa6(_0x503131);});});}function respondWithStatusCode(_0xbefdee,_0x1a572d){_0x1a572d=_0x1a572d||0xcc;return function(_0x46c291){if(_0x46c291){return _0xbefdee['sendStatus'](_0x1a572d);}return _0xbefdee[_0xa6c6('0x2a')](_0x1a572d)[_0xa6c6('0x2b')]();};}function respondWithResult(_0x20220e,_0xe9c926){_0xe9c926=_0xe9c926||0xc8;return function(_0xc10c58){if(_0xc10c58){return _0x20220e[_0xa6c6('0x2a')](_0xe9c926)[_0xa6c6('0x2c')](_0xc10c58);}};}function respondWithFilteredResult(_0x4c0114,_0x3548a9){return function(_0x2792f5){if(_0x2792f5){var _0x48a937=typeof _0x3548a9['offset']==='undefined'&&typeof _0x3548a9['limit']==='undefined';var _0x38589a=_0x2792f5[_0xa6c6('0x2d')];var _0x74728=_0x48a937?0x0:_0x3548a9[_0xa6c6('0x2e')];var _0x32edae=_0x48a937?_0x2792f5[_0xa6c6('0x2d')]:_0x3548a9[_0xa6c6('0x2e')]+_0x3548a9[_0xa6c6('0x2f')];var _0x5d2aec;if(_0x32edae>=_0x38589a){_0x32edae=_0x38589a;_0x5d2aec=0xc8;}else{_0x5d2aec=0xce;}_0x4c0114[_0xa6c6('0x2a')](_0x5d2aec);return _0x4c0114[_0xa6c6('0x30')]('Content-Range',_0x74728+'-'+_0x32edae+'/'+_0x38589a)[_0xa6c6('0x2c')](_0x2792f5);}return null;};}function patchUpdates(_0x18883c){return function(_0x3b2374){try{jsonpatch['apply'](_0x3b2374,_0x18883c,!![]);}catch(_0x1e5a1c){return BPromise[_0xa6c6('0x31')](_0x1e5a1c);}return _0x3b2374[_0xa6c6('0x32')]();};}function saveUpdates(_0x46345c,_0x139b37){return function(_0x3dbc7b){if(_0x3dbc7b){return _0x3dbc7b['update'](_0x46345c)[_0xa6c6('0x33')](function(_0x627761){return _0x627761;});}return null;};}function removeEntity(_0x548cff,_0x1655be){return function(_0xf62e0f){if(_0xf62e0f){return _0xf62e0f[_0xa6c6('0x34')]()[_0xa6c6('0x33')](function(){_0x548cff[_0xa6c6('0x2a')](0xcc)[_0xa6c6('0x2b')]();});}};}function handleEntityNotFound(_0x4940f1,_0x2479c0){return function(_0x5368ad){if(!_0x5368ad){_0x4940f1['sendStatus'](0x194);}return _0x5368ad;};}function handleError(_0x263ac8,_0x49ce27){_0x49ce27=_0x49ce27||0x1f4;return function(_0x311f28){logger['error'](_0x311f28[_0xa6c6('0x35')]);if(_0x311f28[_0xa6c6('0x36')]){delete _0x311f28[_0xa6c6('0x36')];}_0x263ac8[_0xa6c6('0x2a')](_0x49ce27)[_0xa6c6('0x37')](_0x311f28);};}function getMustacheRender(_0x42d87b,_0x3e6304){return Mustache[_0xa6c6('0x38')](_0x42d87b,_[_0xa6c6('0x39')](_0x3e6304[_0xa6c6('0x3a')],{'contact':_0x3e6304[_0xa6c6('0x3b')],'message':_0x3e6304[_0xa6c6('0x27')],'agent':_0x3e6304[_0xa6c6('0x3c')],'interaction':_0x3e6304[_0xa6c6('0x3d')],'account':_0x3e6304['account']}))||'';}function getInteractionUsers(_0x201c5d,_0x40829b){return new BPromise(function(_0x99ec35,_0x5b3410){try{if(_0x40829b[_0x201c5d['id']]){_0x201c5d[_0xa6c6('0x3e')]=_[_0xa6c6('0x3f')](_0x40829b[_0x201c5d['id']],function(_0xae704e){return{'id':_0xae704e['id'],'fullname':_0xae704e['fullname']};});}}catch(_0x50e789){_0x5b3410(_0x50e789);}_0x99ec35(_0x201c5d);});}function getInteractionTags(_0x3991fa,_0x1f3114){return new BPromise(function(_0x4c6d34,_0x21c450){try{if(_0x3991fa[_0xa6c6('0x40')]){_0x3991fa[_0xa6c6('0x41')]=[];_0x3991fa['TagIds']['split'](',')[_0xa6c6('0x42')](function(_0x46292a){_0x3991fa[_0xa6c6('0x41')][_0xa6c6('0x43')](_0x1f3114[_0x46292a]);});}delete _0x3991fa[_0xa6c6('0x40')];}catch(_0x5ccbc6){_0x21c450(_0x5ccbc6);}_0x4c6d34(_0x3991fa);});}function updateChatInteraction(_0x148111,_0xd3e893,_0x43c8ad){return new BPromise(function(_0x716cdb,_0x207bff){return getInteractionUsers(_0x148111,_0x43c8ad)['then'](function(_0x5a170e){return getInteractionTags(_0x5a170e,_0xd3e893);})[_0xa6c6('0x33')](function(_0x27dbfb){return getStateInteraction(_0x27dbfb);})[_0xa6c6('0x33')](function(_0x7219bf){_0x716cdb(_0x7219bf);})[_0xa6c6('0x29')](function(_0x13effa){_0x207bff(_0x13effa);});});}function getStateInteraction(_0x4fbeab){return new BPromise(function(_0x84cbf8){_0x4fbeab['waiting']=0x0;_0x4fbeab[_0xa6c6('0x44')]=0x0;_0x4fbeab[_0xa6c6('0x45')]=0x0;_0x4fbeab[_0xa6c6('0x46')]=0x0;_0x4fbeab[_0xa6c6('0x47')]=0x0;_0x4fbeab[_0xa6c6('0x48')]=0x0;if(!_0x4fbeab['closed']&&!_0x4fbeab[_0xa6c6('0x49')]){_0x4fbeab[_0xa6c6('0x4a')]+=0x1;}if(!_0x4fbeab['closed']&&_0x4fbeab['UserId']){_0x4fbeab[_0xa6c6('0x44')]+=0x1;if(_0x4fbeab[_0xa6c6('0x4a')]){_0x4fbeab[_0xa6c6('0x4a')]-=0x1;}}if(_0x4fbeab[_0xa6c6('0x4b')]&&_0x4fbeab[_0xa6c6('0x4c')]===_0xa6c6('0x47')){_0x4fbeab[_0xa6c6('0x47')]+=0x1;if(_0x4fbeab[_0xa6c6('0x4a')]){_0x4fbeab[_0xa6c6('0x4a')]-=0x1;}}else if(_0x4fbeab[_0xa6c6('0x4b')]&&!_0x4fbeab['UserId']&&_0x4fbeab[_0xa6c6('0x4c')]){_0x4fbeab[_0xa6c6('0x46')]+=0x1;if(_0x4fbeab[_0xa6c6('0x4a')]){_0x4fbeab[_0xa6c6('0x4a')]-=0x1;}}else if(_0x4fbeab[_0xa6c6('0x4b')]&&_0x4fbeab[_0xa6c6('0x49')]){_0x4fbeab[_0xa6c6('0x45')]+=0x1;if(_0x4fbeab['talking']){_0x4fbeab['talking']-=0x1;}}_0x4fbeab['total']+=0x1;_0x84cbf8(_0x4fbeab);});}exports[_0xa6c6('0x4d')]=function(_0x4421b3,_0x273d6e){var _0x565cff={},_0x5c45da={},_0x42b66d={'count':0x0,'rows':[]};var _0x1fc2e8=_[_0xa6c6('0x3f')](db[_0xa6c6('0x4e')]['rawAttributes'],function(_0x23c61b){return{'name':_0x23c61b[_0xa6c6('0x4f')],'type':_0x23c61b[_0xa6c6('0x50')]['key']};});_0x5c45da[_0xa6c6('0x51')]=_[_0xa6c6('0x3f')](_0x1fc2e8,_0xa6c6('0x36'));_0x5c45da[_0xa6c6('0x52')]=_['keys'](_0x4421b3[_0xa6c6('0x52')]);_0x5c45da[_0xa6c6('0x53')]=_[_0xa6c6('0x54')](_0x5c45da[_0xa6c6('0x51')],_0x5c45da['query']);_0x565cff['attributes']=_['intersection'](_0x5c45da[_0xa6c6('0x51')],qs[_0xa6c6('0x55')](_0x4421b3[_0xa6c6('0x52')]['fields']));_0x565cff[_0xa6c6('0x56')]=_0x565cff[_0xa6c6('0x56')][_0xa6c6('0x57')]?_0x565cff['attributes']:_0x5c45da['model'];if(!_0x4421b3[_0xa6c6('0x52')][_0xa6c6('0x58')]('nolimit')){_0x565cff['limit']=qs['limit'](_0x4421b3[_0xa6c6('0x52')][_0xa6c6('0x2f')]);_0x565cff[_0xa6c6('0x2e')]=qs[_0xa6c6('0x2e')](_0x4421b3[_0xa6c6('0x52')][_0xa6c6('0x2e')]);}_0x565cff[_0xa6c6('0x59')]=qs['sort'](_0x4421b3[_0xa6c6('0x52')][_0xa6c6('0x5a')]);_0x565cff[_0xa6c6('0x5b')]=qs[_0xa6c6('0x53')](_[_0xa6c6('0x5c')](_0x4421b3[_0xa6c6('0x52')],_0x5c45da[_0xa6c6('0x53')]),_0x1fc2e8);var _0xb078f6=[];var _0x5b748a=squel[_0xa6c6('0x5d')]()[_0xa6c6('0x5e')]('id')['field'](_0xa6c6('0x36'))[_0xa6c6('0x5e')]('color')[_0xa6c6('0x5f')]('tools_tags');var _0x1792a9=squel['select']()[_0xa6c6('0x5e')](_0xa6c6('0x60'))[_0xa6c6('0x5e')](_0xa6c6('0x61'))[_0xa6c6('0x5e')](_0xa6c6('0x62'))[_0xa6c6('0x5f')](_0xa6c6('0x63'),'ui')[_0xa6c6('0x64')](_0xa6c6('0x65'),'u',_0xa6c6('0x66'));var _0x4b54e5=squel[_0xa6c6('0x5d')]()[_0xa6c6('0x5f')](_0xa6c6('0x67'),'i')[_0xa6c6('0x64')]('cm_contacts','c',_0xa6c6('0x68'))[_0xa6c6('0x64')](_0xa6c6('0x65'),'o','o.id\x20=\x20i.UserId')[_0xa6c6('0x64')](_0xa6c6('0x69'),'a','a.id\x20=\x20i.ChatWebsiteId')['left_join'](_0xa6c6('0x6a'),'me',_0xa6c6('0x6b'))[_0xa6c6('0x64')](_0xa6c6('0x6c'),'it','it.ChatInteractionId\x20=\x20i.id')[_0xa6c6('0x64')](_0xa6c6('0x6d'),'t',_0xa6c6('0x6e'));var _0xe2c5a2=squel[_0xa6c6('0x6f')]();var _0x4c4dc4=[];var _0x216e0d=squel['expr']();var _0x531b99;if(_0x4421b3[_0xa6c6('0x52')][_0xa6c6('0x70')]){_0x531b99=as[_0xa6c6('0x71')](_0x4421b3[_0xa6c6('0x52')]['search']);var _0x419a60=_0x531b99[_0xa6c6('0x72')];for(var _0x10aa07=0x0;_0x10aa07<_0x531b99[_0xa6c6('0x73')][_0xa6c6('0x57')];_0x10aa07++){var _0x5f20f5=_0x531b99[_0xa6c6('0x73')][_0x10aa07];var _0x22f871='i';var _0x1d2254=_['find'](_0x1fc2e8,['name',_0x5f20f5[_0xa6c6('0x5e')]]);if(!_0x1d2254){switch(_0x5f20f5[_0xa6c6('0x5e')]){case _0xa6c6('0x74'):if(_0x5f20f5[_0xa6c6('0x75')]==0x1){_0x4b54e5['having']('`'+_0x5f20f5[_0xa6c6('0x5e')]+'`\x20=\x200');}else{_0x4b54e5[_0xa6c6('0x76')]('`'+_0x5f20f5['field']+_0xa6c6('0x77'));}break;case _0xa6c6('0x78'):if(_0x5f20f5[_0xa6c6('0x79')]===_0xa6c6('0x7a')){if(_0x5f20f5[_0xa6c6('0x75')][_0xa6c6('0x7b')]('\x20')['length']>0x1){_0xe2c5a2[_0x419a60](_0xa6c6('0x7c'),qs['getFullTextValue'](_0x5f20f5[_0xa6c6('0x75')]),null);}else{var _0x45f8e0='%'+_0x5f20f5[_0xa6c6('0x75')]+'%';_0xe2c5a2[_0x419a60]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x45f8e0,_0x45f8e0,_0x45f8e0);}}else{_0x1d2254=_[_0xa6c6('0x7d')](_0x1fc2e8,[_0xa6c6('0x36'),_0xa6c6('0x7e')]);_0x5f20f5[_0xa6c6('0x5e')]=_0xa6c6('0x7e');_0x40222d=as[_0xa6c6('0x7f')](_0x22f871,_0x1d2254['type'],_0x5f20f5);_0xe2c5a2[_0x419a60](_0x40222d[_0xa6c6('0x80')],_0x40222d[_0xa6c6('0x75')][_0xa6c6('0x81')],_0x40222d[_0xa6c6('0x75')]['end']);}break;case _0xa6c6('0x82'):var _0xefa17f=_0x5f20f5[_0xa6c6('0x75')][_0xa6c6('0x7b')](',')['map'](function(_0x333471){return Number(_0x333471);});_0xefa17f[_0xa6c6('0x42')](function(_0x74ee29){_0x216e0d['or'](_0xa6c6('0x83'),'%,'+_0x74ee29+',%');});_0x4c4dc4=_[_0xa6c6('0x84')](_0x4c4dc4,_0xefa17f);break;case _0xa6c6('0x85'):if(_0x5f20f5[_0xa6c6('0x79')]===_0xa6c6('0x7a')){_0xe2c5a2[_0x419a60](_0xa6c6('0x86'),'%'+_0x5f20f5[_0xa6c6('0x75')]+'%',null);}else{_0x1d2254=_[_0xa6c6('0x7d')](_0x1fc2e8,[_0xa6c6('0x36'),'UserId']);_0x5f20f5[_0xa6c6('0x5e')]=_0xa6c6('0x49');_0x40222d=as[_0xa6c6('0x7f')](_0x22f871,_0x1d2254['type'],_0x5f20f5);_0xe2c5a2[_0x419a60](_0x40222d[_0xa6c6('0x80')],_0x40222d[_0xa6c6('0x75')][_0xa6c6('0x81')],_0x40222d['value'][_0xa6c6('0x2b')]);}break;case'body':_0x40222d=as[_0xa6c6('0x7f')]('me',null,_0x5f20f5);_0xe2c5a2[_0x419a60](_0x40222d[_0xa6c6('0x80')],_0x40222d[_0xa6c6('0x75')][_0xa6c6('0x81')],_0x40222d[_0xa6c6('0x75')][_0xa6c6('0x2b')]);break;}}else{var _0x40222d=as['buildExpression'](_0x22f871,_0x1d2254[_0xa6c6('0x50')],_0x5f20f5);_0xe2c5a2[_0x419a60](_0x40222d[_0xa6c6('0x80')],_0x40222d['value'][_0xa6c6('0x81')],_0x40222d[_0xa6c6('0x75')]['end']);}}}else{var _0x420689=_(_0x4421b3['query'])['keys']()[_0xa6c6('0x3f')](function(_0x3b5d9c){return _[_0xa6c6('0x87')](_0x1fc2e8,[_0xa6c6('0x36'),_0x3b5d9c])?_0x3b5d9c:undefined;})[_0xa6c6('0x88')]()[_0xa6c6('0x75')]();if(!_[_0xa6c6('0x89')](_0x420689)){_0x420689[_0xa6c6('0x42')](function(_0x27989f){if(_0x27989f===_0xa6c6('0x8a')){_0x4b54e5['where'](_0xa6c6('0x8b'),[][_0xa6c6('0x8c')](_0x4421b3[_0xa6c6('0x52')][_0x27989f]));}else if(_0x27989f===_0xa6c6('0x8d')){var _0x364697=JSON[_0xa6c6('0x8e')](_0x4421b3[_0xa6c6('0x52')][_0x27989f])[_0xa6c6('0x8f')];var _0x19bbc3=JSON[_0xa6c6('0x8e')](_0x4421b3[_0xa6c6('0x52')][_0x27989f])[_0xa6c6('0x90')];_0x4b54e5[_0xa6c6('0x5b')](_0xa6c6('0x91'),_0x364697,_0x19bbc3);}else{if(_0x4421b3[_0xa6c6('0x52')][_0x27989f]==='null'){_0x4b54e5['where']('i.'+_0x27989f+_0xa6c6('0x92'));}else{_0x4b54e5[_0xa6c6('0x5b')]('i.'+_0x27989f+_0xa6c6('0x93'),_0x4421b3[_0xa6c6('0x52')][_0x27989f]);}}});}if(_0x4421b3[_0xa6c6('0x52')][_0xa6c6('0x94')]){if(_0x4421b3['query'][_0xa6c6('0x94')]==0x1){_0x4b54e5[_0xa6c6('0x76')](_0xa6c6('0x95'));}else{_0x4b54e5[_0xa6c6('0x76')](_0xa6c6('0x96'));}}if(_0x4421b3[_0xa6c6('0x52')][_0xa6c6('0x97')]){_0x4c4dc4=_[_0xa6c6('0x98')](_0x4421b3[_0xa6c6('0x52')]['tag'])?_0x4421b3[_0xa6c6('0x52')][_0xa6c6('0x97')]:new Array(_0x4421b3[_0xa6c6('0x52')][_0xa6c6('0x97')]);_0x4c4dc4[_0xa6c6('0x42')](function(_0x521bd9){_0x216e0d['or'](_0xa6c6('0x83'),'%,'+_0x521bd9+',%');});}if(_0x4421b3[_0xa6c6('0x52')]['filter']){var _0x355087=_0x4421b3[_0xa6c6('0x52')][_0xa6c6('0x99')][_0xa6c6('0x9a')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xa6c6('0x9b')](_0x355087)){_0xe2c5a2['or']('i.id\x20LIKE\x20?',_0x355087+'%');}else{_0xe2c5a2['or'](_0xa6c6('0x9c'),qs[_0xa6c6('0x9d')](_0x355087))['or'](_0xa6c6('0x9e'),_0x355087+'%');}}}_0x4b54e5[_0xa6c6('0x5b')](_0xe2c5a2);_0x4b54e5[_0xa6c6('0x9f')](_0xa6c6('0xa0'));var _0x547fb1={'type':db[_0xa6c6('0xa1')][_0xa6c6('0xa2')][_0xa6c6('0xa3')],'raw':!![]};var _0x2fc8b1=_0x4b54e5['clone']();_0x2fc8b1[_0xa6c6('0x5e')]('i.id');_0x2fc8b1['field'](_0xa6c6('0xa4'),_0xa6c6('0x74'));if(_0x565cff[_0xa6c6('0x59')]){_0x565cff[_0xa6c6('0x59')][_0xa6c6('0x42')](function(_0x1c5903){var _0x10c282=_0x1c5903[0x0]===_0xa6c6('0xa5')?_0x1c5903[0x0]:'i.'+_0x1c5903[0x0];_0x4b54e5['order'](_0x10c282,_0x1c5903[0x1]===_0xa6c6('0xa6')?![]:!![]);});}if(!_[_0xa6c6('0x89')](_0x4c4dc4)){_0x4b54e5[_0xa6c6('0x76')](_0x216e0d);_0x2fc8b1['where']('t.id\x20IN\x20?',_0x4c4dc4);}BPromise[_0xa6c6('0xa7')]()[_0xa6c6('0x33')](function(){if(!_0x531b99){if(_0x4421b3[_0xa6c6('0x52')][_0xa6c6('0x8a')])return;_0x2fc8b1[_0xa6c6('0x5b')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x4b54e5[_0xa6c6('0x5b')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x4421b3['user'][_0xa6c6('0xa8')]!==_0xa6c6('0x3c'))return;return _0x4421b3[_0xa6c6('0xa9')][_0xa6c6('0xaa')]({'attributes':['id'],'raw':!![]})['then'](function(_0x437dfb){if(_[_0xa6c6('0x89')](_0x437dfb)){_0x2fc8b1[_0xa6c6('0x5b')](_0xa6c6('0xab'));_0x4b54e5[_0xa6c6('0x5b')](_0xa6c6('0xab'));}else{_0x2fc8b1[_0xa6c6('0x5b')](_0xa6c6('0x8b'),_[_0xa6c6('0x3f')](_0x437dfb,'id'));_0x4b54e5[_0xa6c6('0x5b')]('i.ChatWebsiteId\x20IN\x20?',_[_0xa6c6('0x3f')](_0x437dfb,'id'));}});})[_0xa6c6('0x33')](function(){if(_0x4421b3[_0xa6c6('0xa9')][_0xa6c6('0xa8')]===_0xa6c6('0x3c')&&!_0x531b99&&!_0x4421b3[_0xa6c6('0x52')]['ChatWebsiteId'])return[];return db[_0xa6c6('0xac')]['query'](_0x2fc8b1[_0xa6c6('0xad')](),_0x547fb1);})[_0xa6c6('0x33')](function(_0x399f1e){_0x42b66d['count']=_0x399f1e['length'];if(_0x42b66d[_0xa6c6('0x2d')]===0x0)return[];return db[_0xa6c6('0xac')]['query'](_0x5b748a[_0xa6c6('0xad')](),_0x547fb1)[_0xa6c6('0x33')](function(_0x521811){_0xb078f6=_[_0xa6c6('0xae')](_0x521811,'id');_0x547fb1=_[_0xa6c6('0x39')](_0x547fb1,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4421b3[_0xa6c6('0x52')][_0xa6c6('0x55')]){_0x565cff[_0xa6c6('0x56')][_0xa6c6('0x42')](function(_0x48c01a){_0x4b54e5[_0xa6c6('0x5e')]('i.'+_0x48c01a);});}else{_0x4b54e5[_0xa6c6('0x5e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa6c6('0x74'));_0x4b54e5[_0xa6c6('0x5e')](_0xa6c6('0xaf'),'Account.key');_0x4b54e5['field'](_0xa6c6('0xb0'),'Account.mandatoryDisposition');_0x4b54e5[_0xa6c6('0x5e')](_0xa6c6('0xb1'),'contactName');_0x4b54e5[_0xa6c6('0x5e')](_0xa6c6('0xb2'));_0x4b54e5[_0xa6c6('0x5e')](_0xa6c6('0xb3'),_0xa6c6('0xb4'));_0x4b54e5[_0xa6c6('0x5e')](_0xa6c6('0xb5'),_0xa6c6('0xb6'));_0x4b54e5[_0xa6c6('0x5e')]('c.email','Contact.email');_0x4b54e5['field'](_0xa6c6('0xb7'),_0xa6c6('0xb8'));_0x4b54e5[_0xa6c6('0x5e')](_0xa6c6('0xb9'),_0xa6c6('0xba'));_0x4b54e5['field']('c.fax',_0xa6c6('0xbb'));_0x4b54e5[_0xa6c6('0x5e')](_0xa6c6('0xbc'),_0xa6c6('0xbd'));_0x4b54e5['field']('o.internal',_0xa6c6('0xbe'));_0x4b54e5[_0xa6c6('0x5e')](_0xa6c6('0xbf'),_0xa6c6('0x40'));}if(_0x565cff['limit'])_0x4b54e5['limit'](_0x565cff['limit']);if(_0x565cff[_0xa6c6('0x2e')])_0x4b54e5[_0xa6c6('0x2e')](_0x565cff['offset']);return db[_0xa6c6('0xac')]['query'](_0x4b54e5[_0xa6c6('0xad')](),_0x547fb1);})[_0xa6c6('0x33')](function(_0x3182d9){if(_0x3182d9[_0xa6c6('0x57')]>0x0)_0x1792a9[_0xa6c6('0x5b')](_0xa6c6('0xc0'),_[_0xa6c6('0x3f')](_0x3182d9,'id'));return db['sequelize'][_0xa6c6('0x52')](_0x1792a9[_0xa6c6('0xad')](),_0x547fb1)['then'](function(_0x19f5b6){var _0x4aa32e=_[_0xa6c6('0xc1')](_0x19f5b6,_0xa6c6('0xc2'));var _0x170165=[];_0x3182d9['forEach'](function(_0x5dcf95){_0x170165[_0xa6c6('0x43')](updateChatInteraction(_0x5dcf95,_0xb078f6,_0x4aa32e));});return BPromise[_0xa6c6('0xc3')](_0x170165);});});})[_0xa6c6('0x33')](function(_0x4187af){_0x42b66d[_0xa6c6('0xc4')]=_0x4187af;return _0x42b66d;})[_0xa6c6('0x33')](respondWithFilteredResult(_0x273d6e,_0x565cff))[_0xa6c6('0x29')](handleError(_0x273d6e,null));};exports[_0xa6c6('0xc5')]=function(_0x3ecb5,_0x3f71e5){var _0x23f3fa={'raw':![],'where':{'id':_0x3ecb5[_0xa6c6('0xc6')]['id']}},_0x388d30={};_0x388d30['model']=_['keys'](db[_0xa6c6('0x4e')]['rawAttributes']);_0x388d30[_0xa6c6('0x52')]=_[_0xa6c6('0xc7')](_0x3ecb5[_0xa6c6('0x52')]);_0x388d30[_0xa6c6('0x53')]=_[_0xa6c6('0x54')](_0x388d30['model'],_0x388d30[_0xa6c6('0x52')]);_0x23f3fa[_0xa6c6('0x56')]=_['intersection'](_0x388d30[_0xa6c6('0x51')],qs[_0xa6c6('0x55')](_0x3ecb5[_0xa6c6('0x52')]['fields']));_0x23f3fa['attributes']=_0x23f3fa['attributes'][_0xa6c6('0x57')]?_0x23f3fa['attributes']:_0x388d30[_0xa6c6('0x51')];if(_0x3ecb5['query']['includeAll']){_0x23f3fa[_0xa6c6('0xc8')]=[{'all':!![]}];}_0x23f3fa=_[_0xa6c6('0x39')]({},_0x23f3fa,_0x3ecb5[_0xa6c6('0xc9')]);return db['ChatInteraction'][_0xa6c6('0x7d')](_0x23f3fa)['then'](handleEntityNotFound(_0x3f71e5,null))[_0xa6c6('0x33')](respondWithResult(_0x3f71e5,null))[_0xa6c6('0x29')](handleError(_0x3f71e5,null));};exports['create']=function(_0x40a5e0,_0x42e82e){return db[_0xa6c6('0x4e')][_0xa6c6('0xca')](_0x40a5e0[_0xa6c6('0x3a')],{})['then'](respondWithResult(_0x42e82e,0xc9))[_0xa6c6('0x29')](handleError(_0x42e82e,null));};exports[_0xa6c6('0xcb')]=function(_0x5c5a9a,_0x56425c){if(_0x5c5a9a[_0xa6c6('0x3a')]['id']){delete _0x5c5a9a[_0xa6c6('0x3a')]['id'];}return db[_0xa6c6('0x4e')]['find']({'where':{'id':_0x5c5a9a[_0xa6c6('0xc6')]['id']}})[_0xa6c6('0x33')](handleEntityNotFound(_0x56425c,null))[_0xa6c6('0x33')](saveUpdates(_0x5c5a9a[_0xa6c6('0x3a')],null))[_0xa6c6('0x33')](respondWithResult(_0x56425c,null))[_0xa6c6('0x29')](handleError(_0x56425c,null));};exports[_0xa6c6('0x34')]=function(_0x3e2f7e,_0x24cc0f){return db['ChatInteraction']['find']({'where':{'id':_0x3e2f7e['params']['id']}})[_0xa6c6('0x33')](handleEntityNotFound(_0x24cc0f,null))[_0xa6c6('0x33')](removeEntity(_0x24cc0f,null))[_0xa6c6('0x29')](handleError(_0x24cc0f,null));};exports['describe']=function(_0x5918e1,_0xa4feb8){return db[_0xa6c6('0x4e')][_0xa6c6('0xcc')]()[_0xa6c6('0x33')](respondWithResult(_0xa4feb8,null))[_0xa6c6('0x29')](handleError(_0xa4feb8,null));};exports[_0xa6c6('0xcd')]=function(_0x134a8a,_0x31141d){var _0x58c27f=_0x134a8a['params']['id'];var _0x1862c5;var _0x264aa1;var _0x5441af;return db[_0xa6c6('0x4e')][_0xa6c6('0xce')]({'where':{'id':_0x58c27f}})[_0xa6c6('0x33')](function(_0x5800dc){_0x1862c5=_0x5800dc;return db['ChatWebsite']['findOne']({'where':{'id':_0x5800dc[_0xa6c6('0x8a')]},'attributes':['id',_0xa6c6('0xcf'),'vidaooEscalation','vidaooTopic','vidaooNote',_0xa6c6('0xd0')],'raw':!![]});})[_0xa6c6('0x33')](function(_0x2091ab){if(_0x2091ab&&_0x2091ab[_0xa6c6('0xcf')]&&_0x2091ab['vidaooEscalation']){_0x264aa1=_0x2091ab;var _0x26ec0b={'interaction':{'id':_0x58c27f},'agent':{'id':_0x134a8a[_0xa6c6('0xa9')]['id'],'name':_0x134a8a[_0xa6c6('0xa9')][_0xa6c6('0x36')],'fullname':_0x134a8a[_0xa6c6('0xa9')][_0xa6c6('0xd1')],'email':_0x134a8a[_0xa6c6('0xa9')][_0xa6c6('0xd2')]},'contact':_0x134a8a[_0xa6c6('0x3a')][_0xa6c6('0x3b')],'account':_0x134a8a['body']['account']};var _0x287820={'rejectUnauthorized':![],'method':_0xa6c6('0xd3'),'url':_0xa6c6('0xd4'),'headers':{'X-APIKEY':_0x2091ab[_0xa6c6('0xcf')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x134a8a['user']['email']],'buttons':null,'topic':_0x264aa1[_0xa6c6('0xd5')],'note':_[_0xa6c6('0xd6')](_0x264aa1['vidaooNote'])?null:getMustacheRender(_0x264aa1[_0xa6c6('0xd7')],_0x26ec0b),'metadata':null},'redirect':_0xa6c6('0xd8'),'json':!![]};try{if(!_[_0xa6c6('0xd6')](_0x264aa1['vidaooMetadata'])){var _0x352694=getMustacheRender(_0x264aa1[_0xa6c6('0xd0')],_0x26ec0b);var _0x27eecf=JSON['parse'](_0x352694);_0x287820[_0xa6c6('0x3a')][_0xa6c6('0xd9')]=_0x27eecf;}}catch(_0x4e6a3e){throw new db[(_0xa6c6('0xa1'))][(_0xa6c6('0xda'))](_0xa6c6('0xdb'));}return rp(_0x287820);}else{throw new db[(_0xa6c6('0xa1'))][(_0xa6c6('0xda'))](_0xa6c6('0xdc'));}})['then'](function(_0x2abfa6){_0x5441af=_0x2abfa6;if(_0x5441af['id']){var _0x54a084={'body':_0x5441af[_0xa6c6('0xdd')],'ChatWebsiteId':_0x264aa1['id'],'ChatInteractionId':_0x1862c5['id'],'direction':_0xa6c6('0xde'),'UserId':_0x134a8a['user']['id']};return db[_0xa6c6('0xdf')]['create'](_0x54a084,{});}else{throw new db[(_0xa6c6('0xa1'))][(_0xa6c6('0xda'))](_0xa6c6('0xe0'));}})[_0xa6c6('0x33')](function(){return _0x1862c5['updateAttributes']({'vidaooSessionId':_0x5441af['id']});})['then'](respondWithResult(_0x31141d,null))['catch'](handleError(_0x31141d,null));};exports[_0xa6c6('0xe1')]=function(_0x1190d1,_0xb169c0){if(_0x1190d1[_0xa6c6('0x3a')]['id']){delete _0x1190d1[_0xa6c6('0x3a')]['id'];}return db[_0xa6c6('0x4e')][_0xa6c6('0x7d')]({'where':{'id':_0x1190d1[_0xa6c6('0xc6')]['id']},'include':[{'model':db[_0xa6c6('0xe2')],'as':_0xa6c6('0x78')}]})[_0xa6c6('0x33')](handleEntityNotFound(_0xb169c0,null))[_0xa6c6('0x33')](saveUpdates(_0x1190d1[_0xa6c6('0x3a')],null))['then'](respondWithResult(_0xb169c0,null))[_0xa6c6('0x29')](handleError(_0xb169c0,null));};exports[_0xa6c6('0xe3')]=function(_0x4cd379,_0x56c683,_0x2ae075){if(_0x4cd379['body']['id']){delete _0x4cd379[_0xa6c6('0x3a')]['id'];}return db[_0xa6c6('0x4e')][_0xa6c6('0x7d')]({'where':{'id':_0x4cd379['params']['id']}})['then'](function(_0x449666){if(!_0x449666){logger['error'](_0xa6c6('0xe4'),_0xa6c6('0xe3'),0x194,_0xa6c6('0xe5'));_0x56c683['sendStatus'](0x194);}else{if(_0x449666[_0xa6c6('0x49')]){throw new db['Sequelize'][(_0xa6c6('0xda'))](_0xa6c6('0xe6'));}}return _0x449666;})[_0xa6c6('0x33')](function(_0x4663bf){if(_0x4663bf){return _0x4663bf[_0xa6c6('0xcb')]({'closed':_0x4cd379[_0xa6c6('0x3a')]['closed'],'disposition':_0x4cd379[_0xa6c6('0x3a')]['disposition']})[_0xa6c6('0x33')](function(_0x327a11){return _0x327a11;});}})['then'](function(_0x4c7a14){return respondWithRpcPromise(_0xa6c6('0xe7'),_0xa6c6('0xe3'),_0x4cd379[_0xa6c6('0x3a')],client9004);})[_0xa6c6('0x33')](respondWithResult(_0x56c683,null))[_0xa6c6('0x29')](handleError(_0x56c683,null));};exports[_0xa6c6('0xe8')]=function(_0x25db11,_0x54cda2,_0x13812f){_0x25db11['body'][_0xa6c6('0x36')]=_0x25db11[_0xa6c6('0xe9')][_0xa6c6('0xea')];_0x25db11[_0xa6c6('0x3a')][_0xa6c6('0xeb')]=_0x25db11[_0xa6c6('0xe9')]['filename'];_0x25db11[_0xa6c6('0x3a')][_0xa6c6('0x50')]=_0x25db11['file'][_0xa6c6('0xec')];return db[_0xa6c6('0xed')][_0xa6c6('0xca')](_0x25db11[_0xa6c6('0x3a')])[_0xa6c6('0x33')](respondWithResult(_0x54cda2,0xc9))[_0xa6c6('0x29')](handleError(_0x54cda2,null));};exports['attachmentDownload']=function(_0x15e9d0,_0x1a5e0b,_0x2fdcb7){return db['ChatInteraction'][_0xa6c6('0xce')]({'where':{'id':_0x15e9d0[_0xa6c6('0xc6')]['id']},'raw':!![]})[_0xa6c6('0x33')](handleEntityNotFound(_0x1a5e0b,null))[_0xa6c6('0x33')](function(_0x53372a){if(_0x53372a){if(_0x53372a[_0xa6c6('0x4b')]){return _0x1a5e0b[_0xa6c6('0x2a')](0x193)[_0xa6c6('0x2c')]({'status':0x193,'message':_0xa6c6('0xee')});}return db[_0xa6c6('0xed')]['findOne']({'where':{'id':_0x15e9d0[_0xa6c6('0x52')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x1a5e0b,null));}})[_0xa6c6('0x33')](function(_0x2df26a){if(_0x2df26a){var _0x443f72=_0x2df26a['ChatOfflineMessageId']!==null;var _0x23dbc5=path[_0xa6c6('0xef')](config[_0xa6c6('0xf0')],_0xa6c6('0xf1'));if(_0x443f72){_0x23dbc5=path[_0xa6c6('0xef')](_0x23dbc5,_0xa6c6('0xf2'));}var _0x2eee50=path['join'](_0x23dbc5,_0x2df26a[_0xa6c6('0xeb')]);return _0x1a5e0b[_0xa6c6('0xf3')](_0x2eee50);}})[_0xa6c6('0x29')](handleError(_0x1a5e0b,null));};exports[_0xa6c6('0xf4')]=function(_0x5415ef,_0x33ee4a){var _0x4d6a22=null;var _0x590603=null;var _0x5f0a53=null;var _0x52bcc9=null;if(_0x5415ef['body']['id']){delete _0x5415ef[_0xa6c6('0x3a')]['id'];}if(_0x5415ef[_0xa6c6('0x3a')][_0xa6c6('0xf5')]){_0x52bcc9=path['join'](config[_0xa6c6('0xf0')],_0xa6c6('0xf6'),util[_0xa6c6('0xf7')](_0xa6c6('0xf8'),Date['now']()));_0x5415ef[_0xa6c6('0x3a')][_0xa6c6('0xf9')]=_0x52bcc9;}return db[_0xa6c6('0x4e')]['find']({'where':{'id':_0x5415ef['params']['id']},'include':[{'model':db[_0xa6c6('0xdf')],'as':_0xa6c6('0xfa'),'include':[{'model':db[_0xa6c6('0x85')],'as':_0xa6c6('0x85')}]}]})[_0xa6c6('0x33')](handleEntityNotFound(_0x33ee4a,null))[_0xa6c6('0x33')](saveUpdates(_0x5415ef[_0xa6c6('0x3a')],null))[_0xa6c6('0x33')](function(_0x492952){if(_0x492952){_0x4d6a22=_0x492952;return db['ChatWebsite']['find']({'where':{'id':_0x4d6a22[_0xa6c6('0x8a')]}});}})['then'](function(_0x6196d5){if(_0x6196d5){_0x5f0a53=_0x6196d5;return db[_0xa6c6('0xe2')][_0xa6c6('0x7d')]({'where':{'id':_0x4d6a22[_0xa6c6('0x7e')]}});}})[_0xa6c6('0x33')](function(_0x211c23){if(_0x211c23){_0x590603=_0x211c23;if(_0x52bcc9){var _0xa9135b=null;for(var _0x1982ed=0x1;_0x1982ed<_0x4d6a22[_0xa6c6('0xfa')][_0xa6c6('0x57')];++_0x1982ed){_0xa9135b=_0x4d6a22[_0xa6c6('0xfa')][_0x1982ed];var _0x701bd8=_0xa9135b['UserId']?util[_0xa6c6('0xf7')]('%s%d',_0x5f0a53['agentAlias'],_0xa9135b[_0xa6c6('0x49')]):_0xa6c6('0xfb');var _0x5cf37a=_0x5415ef[_0xa6c6('0x3a')][_0xa6c6('0xfc')]||util[_0xa6c6('0xf7')](_0xa6c6('0xfd'),_0xa6c6('0xfe'),_0xa9135b[_0xa6c6('0x7e')]);switch(_0x5f0a53['agentIdentifier']){case _0xa6c6('0xff'):_0x701bd8=_0xa9135b[_0xa6c6('0x49')]?util['format'](_0xa6c6('0xfd'),_0x5f0a53[_0xa6c6('0x100')],_0xa9135b[_0xa6c6('0x49')]):_0xa6c6('0xfb');break;case'agent_alias':_0x701bd8=_0xa9135b[_0xa6c6('0x49')]?_0xa9135b[_0xa6c6('0x85')][_0xa6c6('0x101')]||_0xa9135b[_0xa6c6('0x85')][_0xa6c6('0xd1')]:'System';break;case _0xa6c6('0x102'):_0x701bd8=_0xa9135b[_0xa6c6('0x49')]?_0xa9135b[_0xa6c6('0x85')][_0xa6c6('0xd1')]:'System';break;default:_0x701bd8=_0xa9135b[_0xa6c6('0x49')]?util['format']('%s%d',_0x5f0a53[_0xa6c6('0x100')],_0xa9135b[_0xa6c6('0x49')]):'System';}var _0x346193=util[_0xa6c6('0xf7')]('[%s]\x20%s:\x20%s\x0a',moment(_0xa9135b[_0xa6c6('0x8d')])[_0xa6c6('0xf7')](_0xa6c6('0x103')),_0xa9135b[_0xa6c6('0x104')]==='in'?_0x5cf37a:_0x701bd8,_0xa9135b[_0xa6c6('0x3a')]);if(!_0xa9135b['secret']){fs[_0xa6c6('0x105')](_0x52bcc9,_0x346193);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xa6c6('0x106')],'as':_0xa6c6('0x107'),'raw':!![]}]});}}})['then'](function(_0x88b904){if(_0x88b904&&_0x88b904[_0xa6c6('0x107')]&&_0x5415ef['body']){var _0x340ed3={'tls':{'rejectUnauthorized':![]}};if(_0x88b904['Smtp'][_0xa6c6('0x108')]){_0x340ed3['service']=_0x88b904[_0xa6c6('0x107')][_0xa6c6('0x108')];}else{_0x340ed3['host']=_0x88b904[_0xa6c6('0x107')][_0xa6c6('0x109')];_0x340ed3[_0xa6c6('0x10a')]=_0x88b904[_0xa6c6('0x107')][_0xa6c6('0x10a')];_0x340ed3[_0xa6c6('0x10b')]=_0x88b904['Smtp']['secure'];}if(_0x88b904[_0xa6c6('0x107')][_0xa6c6('0x10c')]){_0x340ed3[_0xa6c6('0x10d')]={'user':_0x88b904[_0xa6c6('0x107')][_0xa6c6('0xa9')],'pass':_0x88b904[_0xa6c6('0x107')][_0xa6c6('0x10e')]};}return respondWithRpcPromise(_0xa6c6('0x10f'),_0xa6c6('0x110'),{'account':_0x340ed3,'message':{'from':util[_0xa6c6('0xf7')](_0xa6c6('0x111'),_0x88b904[_0xa6c6('0x36')],_0x88b904['email']||_0x88b904[_0xa6c6('0x107')][_0xa6c6('0xa9')]),'to':_0x5415ef[_0xa6c6('0x3a')][_0xa6c6('0xf5')],'subject':_0xa6c6('0x112'),'text':util[_0xa6c6('0xf7')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x5415ef[_0xa6c6('0x3a')][_0xa6c6('0xf5')]),'attachments':[{'path':_0x52bcc9}]}})[_0xa6c6('0x33')](function(){return _0x4d6a22;})[_0xa6c6('0x29')](function(_0x261342){console[_0xa6c6('0x26')](_0x261342);});}else{return _0x4d6a22;}})['then'](respondWithStatusCode(_0x33ee4a,0xc8))[_0xa6c6('0x29')](handleError(_0x33ee4a,null));};exports['addMessage']=function(_0x12e6c4,_0xd4ce81,_0x4d02d4){return db[_0xa6c6('0xdf')][_0xa6c6('0x7d')]({'where':{'id':_0x12e6c4[_0xa6c6('0xc6')]['id']}})[_0xa6c6('0x33')](handleEntityNotFound(_0xd4ce81,null))['then'](function(_0x2bb2e5){if(_0x2bb2e5){return _0x2bb2e5['addMessage'](_0x12e6c4['body'][_0xa6c6('0x113')],_['omit'](_0x12e6c4['body'],[_0xa6c6('0x113'),'id'])||{});}})[_0xa6c6('0x33')](respondWithResult(_0xd4ce81,null))[_0xa6c6('0x29')](handleError(_0xd4ce81,null));};exports[_0xa6c6('0x114')]=function(_0x42685e,_0x5c2625,_0x29c44){var _0x4531d9={'raw':![],'where':{}};var _0x3becf3={};var _0x1680b0={'count':0x0,'rows':[]};return db[_0xa6c6('0x4e')][_0xa6c6('0xce')]({'where':{'id':_0x42685e[_0xa6c6('0xc6')]['id']}})[_0xa6c6('0x33')](handleEntityNotFound(_0x5c2625,null))[_0xa6c6('0x33')](function(_0x4a1089){if(_0x4a1089){_0x3becf3[_0xa6c6('0x51')]=_[_0xa6c6('0xc7')](db[_0xa6c6('0xdf')][_0xa6c6('0x115')]);_0x3becf3['query']=_[_0xa6c6('0xc7')](_0x42685e[_0xa6c6('0x52')]);_0x3becf3[_0xa6c6('0x53')]=_[_0xa6c6('0x54')](_0x3becf3[_0xa6c6('0x51')],_0x3becf3['query']);_0x4531d9[_0xa6c6('0x56')]=_[_0xa6c6('0x54')](_0x3becf3[_0xa6c6('0x51')],qs[_0xa6c6('0x55')](_0x42685e[_0xa6c6('0x52')]['fields']));_0x4531d9[_0xa6c6('0x56')]=_0x4531d9['attributes'][_0xa6c6('0x57')]?_0x4531d9[_0xa6c6('0x56')]:_0x3becf3['model'];if(!_0x42685e['query']['hasOwnProperty'](_0xa6c6('0x116'))){_0x4531d9['limit']=qs['limit'](_0x42685e[_0xa6c6('0x52')]['limit']);_0x4531d9['offset']=qs[_0xa6c6('0x2e')](_0x42685e[_0xa6c6('0x52')][_0xa6c6('0x2e')]);}_0x4531d9[_0xa6c6('0x59')]=qs[_0xa6c6('0x5a')](_0x42685e[_0xa6c6('0x52')][_0xa6c6('0x5a')]);_0x4531d9[_0xa6c6('0x5b')]=qs['filters'](_[_0xa6c6('0x5c')](_0x42685e[_0xa6c6('0x52')],_0x3becf3[_0xa6c6('0x53')]));_0x4531d9[_0xa6c6('0x5b')]['ChatInteractionId']=_0x4a1089['id'];if(_0x42685e[_0xa6c6('0x52')][_0xa6c6('0x99')]){_0x4531d9[_0xa6c6('0x5b')]=_[_0xa6c6('0x39')](_0x4531d9['where'],{'$or':_[_0xa6c6('0x3f')](_0x4531d9[_0xa6c6('0x56')],function(_0x37c4cf){var _0x8a2005={};_0x8a2005[_0x37c4cf]={'$like':'%'+_0x42685e[_0xa6c6('0x52')][_0xa6c6('0x99')]+'%'};return _0x8a2005;})});}if(_0x42685e[_0xa6c6('0x52')]['$gte']){var _0x3862fc=_0x42685e[_0xa6c6('0x52')][_0xa6c6('0x8f')][_0xa6c6('0x7b')](',');var _0x331d6c={};_0x331d6c[_0x3862fc[0x0]]={'$gte':moment(_0x3862fc[0x1])[_0xa6c6('0xf7')](_0xa6c6('0x117'))};_0x4531d9[_0xa6c6('0x5b')]=_[_0xa6c6('0x39')](_0x4531d9['where'],_0x331d6c);}_0x4531d9=_[_0xa6c6('0x39')]({},_0x4531d9,_0x42685e[_0xa6c6('0xc9')]);return db[_0xa6c6('0xdf')][_0xa6c6('0x2d')]({'where':_0x4531d9['where']})[_0xa6c6('0x33')](function(_0x124fff){_0x1680b0[_0xa6c6('0x2d')]=_0x124fff;if(_0x42685e[_0xa6c6('0x52')][_0xa6c6('0x118')]){_0x4531d9[_0xa6c6('0xc8')]=[{'all':!![]}];}return db[_0xa6c6('0xdf')][_0xa6c6('0x119')](_0x4531d9);})[_0xa6c6('0x33')](function(_0x3728f2){_0x1680b0[_0xa6c6('0xc4')]=_0x3728f2;return _0x1680b0;});}})[_0xa6c6('0x33')](respondWithFilteredResult(_0x5c2625,_0x4531d9))[_0xa6c6('0x29')](handleError(_0x5c2625,null));};exports['getMyMessages']=function(_0x5740cf,_0x57bcde,_0x13ad02){var _0x4cb464={'where':{}},_0x1c6691={},_0x1e3048={'count':0x0,'rows':[]};return db[_0xa6c6('0x4e')]['findOne']({'where':{'id':_0x5740cf[_0xa6c6('0xc6')]['id']}})[_0xa6c6('0x33')](handleEntityNotFound(_0x57bcde,null))[_0xa6c6('0x33')](function(_0x2b5422){if(_0x2b5422){_0x1c6691[_0xa6c6('0x51')]=_[_0xa6c6('0xc7')](db[_0xa6c6('0xdf')][_0xa6c6('0x115')]);_0x1c6691[_0xa6c6('0x52')]=_[_0xa6c6('0xc7')](_0x5740cf[_0xa6c6('0x52')]);_0x1c6691[_0xa6c6('0x53')]=_['intersection'](_0x1c6691[_0xa6c6('0x51')],_0x1c6691[_0xa6c6('0x52')]);_0x4cb464[_0xa6c6('0x56')]=_['intersection'](_0x1c6691[_0xa6c6('0x51')],qs['fields'](_0x5740cf[_0xa6c6('0x52')][_0xa6c6('0x55')]));_0x4cb464[_0xa6c6('0x56')]=_0x4cb464[_0xa6c6('0x56')][_0xa6c6('0x57')]?_0x4cb464['attributes']:_0x1c6691['model'];if(!_0x5740cf[_0xa6c6('0x52')]['hasOwnProperty'](_0xa6c6('0x116'))){_0x4cb464[_0xa6c6('0x2f')]=qs[_0xa6c6('0x2f')](_0x5740cf['query'][_0xa6c6('0x2f')]);_0x4cb464[_0xa6c6('0x2e')]=qs['offset'](_0x5740cf['query'][_0xa6c6('0x2e')]);}_0x4cb464[_0xa6c6('0x59')]=qs[_0xa6c6('0x5a')](_0x5740cf[_0xa6c6('0x52')][_0xa6c6('0x5a')]);_0x4cb464[_0xa6c6('0x5b')]=qs[_0xa6c6('0x53')](_[_0xa6c6('0x5c')](_0x5740cf[_0xa6c6('0x52')],_0x1c6691[_0xa6c6('0x53')]));_0x4cb464[_0xa6c6('0x5b')]['ChatInteractionId']=_0x2b5422['id'];if(_0x5740cf['query'][_0xa6c6('0x99')]){_0x4cb464[_0xa6c6('0x5b')]=_[_0xa6c6('0x39')](_0x4cb464[_0xa6c6('0x5b')],{'$or':_[_0xa6c6('0x3f')](_0x4cb464['attributes'],function(_0x7ebc82){var _0x28576b={};_0x28576b[_0x7ebc82]={'$like':'%'+_0x5740cf['query'][_0xa6c6('0x99')]+'%'};return _0x28576b;})});}_0x4cb464['where'][_0xa6c6('0x11a')]=![];if(_0x5740cf['query']['id']){_0x4cb464[_0xa6c6('0x5b')]['id']={'$gt':_0x5740cf[_0xa6c6('0x52')]['id']};}_0x4cb464=_[_0xa6c6('0x39')]({},_0x4cb464,_0x5740cf[_0xa6c6('0xc9')]);return db[_0xa6c6('0xdf')][_0xa6c6('0x2d')]({'where':_0x4cb464['where']})[_0xa6c6('0x33')](function(_0x76dde8){_0x1e3048[_0xa6c6('0x2d')]=_0x76dde8;_0x4cb464[_0xa6c6('0xc8')]=[];if(_0x5740cf[_0xa6c6('0x52')][_0xa6c6('0x11b')]){_0x4cb464[_0xa6c6('0xc8')]['push']({'model':db['User'],'as':_0xa6c6('0x85'),'attributes':['id',_0xa6c6('0xd1'),_0xa6c6('0x101')]});}if(_0x5740cf[_0xa6c6('0x52')][_0xa6c6('0x118')]){_0x4cb464[_0xa6c6('0xc8')]=[{'all':!![]}];}return db['ChatMessage'][_0xa6c6('0x119')](_0x4cb464);})[_0xa6c6('0x33')](function(_0x419fae){_0x1e3048[_0xa6c6('0xc4')]=_0x419fae;return _0x1e3048;});}})['then'](respondWithFilteredResult(_0x57bcde,_0x4cb464))['catch'](handleError(_0x57bcde,null));};exports['addTags']=function(_0x51cdf8,_0x44ba45,_0x4a5046){return db[_0xa6c6('0x4e')]['find']({'where':{'id':_0x51cdf8['params']['id']}})[_0xa6c6('0x33')](handleEntityNotFound(_0x44ba45,null))['then'](function(_0x20464c){if(_0x20464c){return _0x20464c[_0xa6c6('0x11c')](_0x51cdf8[_0xa6c6('0x3a')][_0xa6c6('0x113')],_['omit'](_0x51cdf8[_0xa6c6('0x3a')],[_0xa6c6('0x113'),'id'])||{})['spread'](function(){return db[_0xa6c6('0x82')]['findAll']({'attributes':['id',_0xa6c6('0x36'),_0xa6c6('0x11d')],'where':{'id':_0x51cdf8[_0xa6c6('0x3a')][_0xa6c6('0x113')]}});})['then'](function(_0x50db01){socket[_0xa6c6('0x11e')](_0xa6c6('0x11f'),{'id':Number(_0x51cdf8[_0xa6c6('0xc6')]['id']),'tags':_0x50db01||[]});return{'id':Number(_0x51cdf8['params']['id']),'tags':_0x50db01||[]};});}})[_0xa6c6('0x33')](respondWithResult(_0x44ba45,null))[_0xa6c6('0x29')](handleError(_0x44ba45,null));};exports[_0xa6c6('0x120')]=function(_0x3f73c1,_0x5d84fa,_0xab073f){return db[_0xa6c6('0x4e')][_0xa6c6('0x7d')]({'where':{'id':_0x3f73c1[_0xa6c6('0xc6')]['id']}})['then'](handleEntityNotFound(_0x5d84fa,null))[_0xa6c6('0x33')](function(_0x380ee1){if(_0x380ee1){return _0x380ee1['removeTags'](_0x3f73c1[_0xa6c6('0x52')][_0xa6c6('0x113')]);}})['then'](respondWithStatusCode(_0x5d84fa,null))[_0xa6c6('0x29')](handleError(_0x5d84fa,null));};exports['download']=function(_0x14dd4c,_0x574493){var _0x55e6d8=moment()[_0xa6c6('0x121')]()[_0xa6c6('0xad')]();var _0x102242=path[_0xa6c6('0xef')](config[_0xa6c6('0xf0')],_0xa6c6('0x122'),'files',_0xa6c6('0x123'));var _0x37be1e=path[_0xa6c6('0xef')](config[_0xa6c6('0xf0')],'server',_0xa6c6('0x124'),'attachments');var _0x3cb6fa=path['join'](_0x102242,_0x55e6d8);var _0x364dae=util['format'](_0xa6c6('0x125'),_0x14dd4c[_0xa6c6('0xc6')]['id'],_0x55e6d8);var _0x297db6=path['join'](_0x102242,_0x364dae);var _0x226e31=[];_0x226e31['push']({'model':db[_0xa6c6('0x85')],'as':_0xa6c6('0x85'),'attributes':['id',_0xa6c6('0xd1')],'raw':!![]});_0x226e31[_0xa6c6('0x43')]({'model':db['CmContact'],'as':_0xa6c6('0x78'),'attributes':['id',_0xa6c6('0x126'),_0xa6c6('0x127')],'raw':!![]});if(_0x14dd4c[_0xa6c6('0x52')][_0xa6c6('0x128')]){_0x226e31[_0xa6c6('0x43')]({'model':db[_0xa6c6('0xed')],'as':'Attachment','raw':!![]});}var _0x5b6848=[{'model':db[_0xa6c6('0xdf')],'as':_0xa6c6('0xfa'),'attributes':['id',_0xa6c6('0x3a'),_0xa6c6('0x8d'),_0xa6c6('0x104'),_0xa6c6('0x11a'),_0xa6c6('0x94')],'include':_0x226e31}];_0x5b6848[_0xa6c6('0x43')]({'model':db[_0xa6c6('0x129')],'as':_0xa6c6('0x12a'),'attributes':['id',_0xa6c6('0x36')]});_0x5b6848[_0xa6c6('0x43')]({'model':db[_0xa6c6('0x85')],'as':_0xa6c6('0x12b'),'attributes':['id',_0xa6c6('0xd1')]});return db[_0xa6c6('0x4e')]['find']({'where':{'id':_0x14dd4c[_0xa6c6('0xc6')]['id']},'include':_0x5b6848})['then'](handleEntityNotFound(_0x574493,null))[_0xa6c6('0x33')](function(_0x26d425){if(_0x26d425){var _0x1e09bc=_0x26d425[_0xa6c6('0x12c')]({'plain':!![]});fs[_0xa6c6('0x12d')](_0x3cb6fa);var _0x24ea61={'channel':_0xa6c6('0x12e'),'account':_0x1e09bc[_0xa6c6('0x12a')]['name'],'agent':_0x1e09bc[_0xa6c6('0x12b')]?_0x1e09bc[_0xa6c6('0x12b')]['fullname']:_0xa6c6('0x12f'),'createdAt':moment(_0x1e09bc['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x1e09bc[_0xa6c6('0x4b')]?moment(_0x1e09bc['closedAt'])[_0xa6c6('0xf7')](_0xa6c6('0x117'))['toString']():'','disposition':_0x1e09bc['disposition'],'chatInfo':{'browser':_0x1e09bc[_0xa6c6('0x130')],'os':_0x1e09bc[_0xa6c6('0x131')],'referer':_0x1e09bc[_0xa6c6('0x132')],'customerIp':_0x1e09bc[_0xa6c6('0x133')],'customerPort':_0x1e09bc[_0xa6c6('0x134')]?_0x1e09bc['customerPort']:_0xa6c6('0x12f')},'messages':_(_0x1e09bc[_0xa6c6('0xfa')])[_0xa6c6('0x135')]()[_0xa6c6('0x99')]({'secret':![]})[_0xa6c6('0x3f')](function(_0x483b76){if(_0x483b76[_0xa6c6('0xed')]){var _0x3efc2a=path['join'](_0x37be1e,_0x483b76['Attachment'][_0xa6c6('0xeb')]);if(fs['existsSync'](_0x3efc2a)){fs[_0xa6c6('0x136')](_0x3efc2a)[_0xa6c6('0x137')](fs[_0xa6c6('0x138')](path[_0xa6c6('0xef')](_0x3cb6fa,_0x483b76[_0xa6c6('0xed')][_0xa6c6('0xeb')])));}}return{'date':moment(_0x483b76[_0xa6c6('0x8d')])[_0xa6c6('0xf7')](_0xa6c6('0x117'))[_0xa6c6('0xad')](),'sender':_0x483b76[_0xa6c6('0x104')]===_0xa6c6('0xde')?_0x483b76['User']?_0x483b76[_0xa6c6('0x85')][_0xa6c6('0xd1')]:_0xa6c6('0xfb'):_0x483b76['Contact'][_0xa6c6('0x126')]+(_0x483b76['Contact'][_0xa6c6('0x127')]?'\x20'+_0x483b76[_0xa6c6('0x78')][_0xa6c6('0x127')]:''),'body':_0x483b76['Attachment']?_0x483b76['Attachment']['basename']:_0x483b76[_0xa6c6('0x3a')],'direction':_0x483b76['direction']===_0xa6c6('0xde')?'A':'C','secret':_0x483b76['secret'],'read':_0x483b76[_0xa6c6('0x94')],'attachment':_0x483b76[_0xa6c6('0xed')]};})[_0xa6c6('0x75')]()};return ejs[_0xa6c6('0x139')](path[_0xa6c6('0xef')](config[_0xa6c6('0xf0')],_0xa6c6('0x122'),_0xa6c6('0x13a'),_0xa6c6('0x13b')),{'interaction':_0x24ea61})[_0xa6c6('0x33')](function(_0x3de83f){var _0x7fe3c3=path['join'](_0x3cb6fa,_0xa6c6('0x13c')+_0x1e09bc['id']+'-'+_0x55e6d8+_0xa6c6('0x13d'));var _0x58ce03={'path':_0x7fe3c3,'channel':'Chat','interactionId':_0x1e09bc['id']};return pdf[_0xa6c6('0x13e')](_0x3de83f,_0x58ce03);})[_0xa6c6('0x33')](function(){return new BPromise(function(_0x3358ab,_0x47c26c){zipdir(_0x3cb6fa,{'saveTo':_0x297db6},function(_0x390ccd,_0x77feed){if(_0x390ccd)return _0x47c26c(_0x390ccd);return _0x3358ab(_0x77feed);});})[_0xa6c6('0x33')](function(){return new BPromise(function(_0xee8711,_0x19ee11){rimraf(_0x3cb6fa,function(_0x2cd50d){if(_0x2cd50d)_0x19ee11(_0x2cd50d);return _0xee8711();});});})['then'](function(){return _0x574493['download'](_0x297db6,_0x364dae,function(_0x4604f2){if(_0x4604f2){console['log'](_0xa6c6('0x13f'),_0x4604f2);}else{fs['unlinkSync'](_0x297db6);}});});});}else{return _0x574493['sendStatus'](0xc8);}})[_0xa6c6('0x29')](handleError(_0x574493,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 1d02102..4073452 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 _0xb6f5=['setMaxListeners','save','getUsers','setDataValue','map','findAll','then','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage'];(function(_0x54a75e,_0x5a9e9f){var _0x568983=function(_0x3deb22){while(--_0x3deb22){_0x54a75e['push'](_0x54a75e['shift']());}};_0x568983(++_0x5a9e9f);}(_0xb6f5,0x1cd));var _0x5b6f=function(_0x1a7244,_0x3d99d9){_0x1a7244=_0x1a7244-0x0;var _0x5c4e9f=_0xb6f5[_0x1a7244];return _0x5c4e9f;};'use strict';var EventEmitter=require(_0x5b6f('0x0'));var ChatInteraction=require(_0x5b6f('0x1'))['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0x5b6f('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x5b6f('0x3')](0x0);var events={'afterCreate':_0x5b6f('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5b2aea){return function(_0x47c0d2,_0x523235,_0x267443){_0x47c0d2[_0x5b6f('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4689e4){_0x47c0d2[_0x5b6f('0x6')]('Users',_0x4689e4[_0x5b6f('0x7')](function(_0x3ce0b0){return{'id':_0x3ce0b0['id']};}));return ChatMessage[_0x5b6f('0x8')]({'where':{'ChatInteractionId':_0x47c0d2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5b6f('0x9')](function(_0x55a5d4){_0x47c0d2[_0x5b6f('0x6')](_0x5b6f('0xa'),_0x55a5d4['length']);ChatInteractionEvents[_0x5b6f('0xb')](_0x5b2aea+':'+_0x47c0d2['id'],_0x47c0d2);ChatInteractionEvents[_0x5b6f('0xb')](_0x5b2aea,_0x47c0d2);_0x267443(null);})[_0x5b6f('0xc')](_0x267443(null));};}for(var e in events){if(events[_0x5b6f('0xd')](e)){var event=events[e];ChatInteraction[_0x5b6f('0xe')](e,emitEvent(event));}}module[_0x5b6f('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0xd561=['emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','findAll','then'];(function(_0xe5d99,_0x18d141){var _0x43c616=function(_0x479787){while(--_0x479787){_0xe5d99['push'](_0xe5d99['shift']());}};_0x43c616(++_0x18d141);}(_0xd561,0x94));var _0x1d56=function(_0x82843e,_0x496aee){_0x82843e=_0x82843e-0x0;var _0x2aa755=_0xd561[_0x82843e];return _0x2aa755;};'use strict';var EventEmitter=require(_0x1d56('0x0'));var ChatInteraction=require(_0x1d56('0x1'))['db'][_0x1d56('0x2')];var ChatMessage=require(_0x1d56('0x1'))['db'][_0x1d56('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x1d56('0x4')](0x0);var events={'afterCreate':_0x1d56('0x5'),'afterUpdate':_0x1d56('0x6'),'afterDestroy':_0x1d56('0x7')};function emitEvent(_0x4de310){return function(_0x3e03a9,_0x5a8d5a,_0x192ab5){_0x3e03a9[_0x1d56('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3822e8){_0x3e03a9[_0x1d56('0x9')](_0x1d56('0xa'),_0x3822e8[_0x1d56('0xb')](function(_0x136384){return{'id':_0x136384['id']};}));return ChatMessage[_0x1d56('0xc')]({'where':{'ChatInteractionId':_0x3e03a9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1d56('0xd')](function(_0x1178f9){_0x3e03a9['setDataValue']('unreadMessages',_0x1178f9['length']);ChatInteractionEvents[_0x1d56('0xe')](_0x4de310+':'+_0x3e03a9['id'],_0x3e03a9);ChatInteractionEvents[_0x1d56('0xe')](_0x4de310,_0x3e03a9);_0x192ab5(null);})[_0x1d56('0xf')](_0x192ab5(null));};}for(var e in events){if(events[_0x1d56('0x10')](e)){var event=events[e];ChatInteraction[_0x1d56('0x11')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index ca2ad3b..98a49f6 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 _0x519a=['../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','../../config/logger','moment','request-promise','rimraf'];(function(_0x51568a,_0x5ab76f){var _0x4dafad=function(_0x4ad449){while(--_0x4ad449){_0x51568a['push'](_0x51568a['shift']());}};_0x4dafad(++_0x5ab76f);}(_0x519a,0x71));var _0xa519=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x519a[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xa519('0x0'));var util=require(_0xa519('0x1'));var logger=require(_0xa519('0x2'))('api');var moment=require(_0xa519('0x3'));var BPromise=require('bluebird');var rp=require(_0xa519('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa519('0x5'));var config=require(_0xa519('0x6'));var attributes=require(_0xa519('0x7'));module[_0xa519('0x8')]=function(_0x6cc685,_0x120147){return _0x6cc685[_0xa519('0x9')](_0xa519('0xa'),attributes,{'tableName':_0xa519('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2361cb,_0x4d3c07,_0x4dfffa){if(_0x2361cb[_0xa519('0xc')](_0xa519('0xd'))){_0x2361cb[_0xa519('0xe')]=moment()['format'](_0xa519('0xf'));}_0x4dfffa(null,_0x2361cb);}},'charset':_0xa519('0x10'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x25da=['changed','format','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions'];(function(_0x1eef98,_0x58b4e6){var _0x20af3f=function(_0x563a60){while(--_0x563a60){_0x1eef98['push'](_0x1eef98['shift']());}};_0x20af3f(++_0x58b4e6);}(_0x25da,0x99));var _0xa25d=function(_0x114f6a,_0x388bd4){_0x114f6a=_0x114f6a-0x0;var _0x50729e=_0x25da[_0x114f6a];return _0x50729e;};'use strict';var _=require(_0xa25d('0x0'));var util=require(_0xa25d('0x1'));var logger=require(_0xa25d('0x2'))(_0xa25d('0x3'));var moment=require(_0xa25d('0x4'));var BPromise=require(_0xa25d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa25d('0x6'));var attributes=require(_0xa25d('0x7'));module[_0xa25d('0x8')]=function(_0x27259d,_0x382648){return _0x27259d[_0xa25d('0x9')](_0xa25d('0xa'),attributes,{'tableName':_0xa25d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1661c0,_0x2e2b36,_0x539d4a){if(_0x1661c0[_0xa25d('0xc')]('closed')){_0x1661c0['closedAt']=moment()[_0xa25d('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x539d4a(null,_0x1661c0);}},'charset':'utf8mb4','collate':_0xa25d('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index f7b1012..5ec85d9 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 _0x1666=['info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatInteraction','update','body','options','raw','where','attributes','limit','UpdateChatInteraction','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','request','then'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1666,0x183));var _0x6166=function(_0xf945d4,_0x377e79){_0xf945d4=_0xf945d4-0x0;var _0x5aa355=_0x1666[_0xf945d4];return _0x5aa355;};'use strict';var _=require(_0x6166('0x0'));var util=require(_0x6166('0x1'));var moment=require(_0x6166('0x2'));var BPromise=require(_0x6166('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6166('0x4'));var db=require(_0x6166('0x5'))['db'];var utils=require(_0x6166('0x6'));var logger=require('../../config/logger')(_0x6166('0x7'));var config=require(_0x6166('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6166('0x9')][_0x6166('0xa')]({'port':0x232a});config[_0x6166('0xb')]=_[_0x6166('0xc')](config[_0x6166('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6166('0xd'))(new Redis(config['redis']));require(_0x6166('0xe'))[_0x6166('0xf')](socket);function respondWithRpcPromise(_0x5d18c0,_0x381bc4,_0x1a8cb0){return new BPromise(function(_0x2f3878,_0x3ec744){return client[_0x6166('0x10')](_0x5d18c0,_0x1a8cb0)[_0x6166('0x11')](function(_0x5df8d5){logger[_0x6166('0x12')](_0x6166('0x13'),_0x381bc4,_0x6166('0x14'));logger[_0x6166('0x15')](_0x6166('0x16'),_0x381bc4,_0x6166('0x14'),JSON[_0x6166('0x17')](_0x5df8d5));if(_0x5df8d5[_0x6166('0x18')]){if(_0x5df8d5[_0x6166('0x18')][_0x6166('0x19')]===0x1f4){logger[_0x6166('0x18')](_0x6166('0x13'),_0x381bc4,_0x5df8d5[_0x6166('0x18')][_0x6166('0x1a')]);return _0x3ec744(_0x5df8d5[_0x6166('0x18')][_0x6166('0x1a')]);}logger[_0x6166('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x381bc4,_0x5df8d5[_0x6166('0x18')][_0x6166('0x1a')]);return _0x2f3878(_0x5df8d5[_0x6166('0x18')][_0x6166('0x1a')]);}else{logger[_0x6166('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x381bc4,_0x6166('0x14'));_0x2f3878(_0x5df8d5[_0x6166('0x1b')][_0x6166('0x1a')]);}})[_0x6166('0x1c')](function(_0xcc3d1a){logger['error'](_0x6166('0x13'),_0x381bc4,_0xcc3d1a);_0x3ec744(_0xcc3d1a);});});}exports['UpdateChatInteraction']=function(_0x26c03c){var _0x1c550b=this;return new Promise(function(_0x345cdd,_0x5bda1e){return db[_0x6166('0x1d')][_0x6166('0x1e')](_0x26c03c[_0x6166('0x1f')],{'raw':_0x26c03c['options']?_0x26c03c[_0x6166('0x20')][_0x6166('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26c03c[_0x6166('0x20')]?_0x26c03c['options'][_0x6166('0x22')]||null:null,'attributes':_0x26c03c[_0x6166('0x20')]?_0x26c03c[_0x6166('0x20')][_0x6166('0x23')]||null:null,'limit':_0x26c03c[_0x6166('0x20')]?_0x26c03c[_0x6166('0x20')][_0x6166('0x24')]||null:null})[_0x6166('0x11')](function(_0x45e805){logger[_0x6166('0x12')]('UpdateChatInteraction',_0x26c03c);logger[_0x6166('0x15')](_0x6166('0x25'),_0x26c03c,JSON['stringify'](_0x45e805));_0x345cdd(_0x45e805);})['catch'](function(_0x47cb05){logger['error'](_0x6166('0x25'),_0x47cb05['message'],_0x26c03c);_0x5bda1e(_0x1c550b[_0x6166('0x18')](0x1f4,_0x47cb05[_0x6166('0x1a')]));});});};exports[_0x6166('0x26')]=function(_0x4ec6ce){return new Promise(function(_0x40241a,_0x214dd2){return db[_0x6166('0x1d')][_0x6166('0x27')]({'where':_0x4ec6ce['options']?_0x4ec6ce['options'][_0x6166('0x22')]||null:null})[_0x6166('0x11')](function(_0x956cda){if(_0x956cda){return _0x956cda[_0x6166('0x28')](_0x4ec6ce[_0x6166('0x1f')][_0x6166('0x29')],_[_0x6166('0x2a')](_0x4ec6ce[_0x6166('0x1f')],['ids','id'])||{});}})[_0x6166('0x2b')](function(_0x1e7b0e){logger[_0x6166('0x12')](_0x6166('0x2c'),_0x4ec6ce);logger[_0x6166('0x15')](_0x6166('0x2c'),_0x4ec6ce,JSON[_0x6166('0x17')](_0x1e7b0e));_0x40241a(_0x1e7b0e);})[_0x6166('0x1c')](function(_0x49b724){logger[_0x6166('0x18')]('AddTags',_0x49b724[_0x6166('0x1a')],_0x4ec6ce);_0x214dd2(_this[_0x6166('0x18')](0x1f4,_0x49b724['message']));});});}; \ No newline at end of file +var _0xaba6=['AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where'];(function(_0x2979f2,_0x1498d1){var _0x39af67=function(_0x1ef645){while(--_0x1ef645){_0x2979f2['push'](_0x2979f2['shift']());}};_0x39af67(++_0x1498d1);}(_0xaba6,0x134));var _0x6aba=function(_0x2bdba7,_0x24f2c3){_0x2bdba7=_0x2bdba7-0x0;var _0x283dfe=_0xaba6[_0x2bdba7];return _0x283dfe;};'use strict';var _=require(_0x6aba('0x0'));var util=require(_0x6aba('0x1'));var moment=require('moment');var BPromise=require(_0x6aba('0x2'));var rs=require(_0x6aba('0x3'));var fs=require('fs');var Redis=require(_0x6aba('0x4'));var db=require(_0x6aba('0x5'))['db'];var utils=require(_0x6aba('0x6'));var logger=require(_0x6aba('0x7'))('rpc');var config=require(_0x6aba('0x8'));var jayson=require(_0x6aba('0x9'));var client=jayson[_0x6aba('0xa')][_0x6aba('0xb')]({'port':0x232a});config[_0x6aba('0xc')]=_[_0x6aba('0xd')](config[_0x6aba('0xc')],{'host':_0x6aba('0xe'),'port':0x18eb});var socket=require(_0x6aba('0xf'))(new Redis(config[_0x6aba('0xc')]));require(_0x6aba('0x10'))['register'](socket);function respondWithRpcPromise(_0x1e1b0f,_0x23f7d5,_0xf5d85c){return new BPromise(function(_0x44e2e4,_0x4e83ae){return client[_0x6aba('0x11')](_0x1e1b0f,_0xf5d85c)[_0x6aba('0x12')](function(_0x2403df){logger[_0x6aba('0x13')](_0x6aba('0x14'),_0x23f7d5,_0x6aba('0x15'));logger[_0x6aba('0x16')](_0x6aba('0x17'),_0x23f7d5,_0x6aba('0x15'),JSON[_0x6aba('0x18')](_0x2403df));if(_0x2403df[_0x6aba('0x19')]){if(_0x2403df[_0x6aba('0x19')]['code']===0x1f4){logger['error'](_0x6aba('0x14'),_0x23f7d5,_0x2403df[_0x6aba('0x19')]['message']);return _0x4e83ae(_0x2403df[_0x6aba('0x19')][_0x6aba('0x1a')]);}logger[_0x6aba('0x19')](_0x6aba('0x14'),_0x23f7d5,_0x2403df[_0x6aba('0x19')][_0x6aba('0x1a')]);return _0x44e2e4(_0x2403df[_0x6aba('0x19')][_0x6aba('0x1a')]);}else{logger[_0x6aba('0x13')](_0x6aba('0x14'),_0x23f7d5,_0x6aba('0x15'));_0x44e2e4(_0x2403df[_0x6aba('0x1b')]['message']);}})[_0x6aba('0x1c')](function(_0x2a87c1){logger['error'](_0x6aba('0x14'),_0x23f7d5,_0x2a87c1);_0x4e83ae(_0x2a87c1);});});}exports[_0x6aba('0x1d')]=function(_0x332fca){var _0x2a2a39=this;return new Promise(function(_0x55b3ae,_0x2d116f){return db[_0x6aba('0x1e')][_0x6aba('0x1f')](_0x332fca[_0x6aba('0x20')],{'raw':_0x332fca[_0x6aba('0x21')]?_0x332fca[_0x6aba('0x21')][_0x6aba('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x332fca[_0x6aba('0x21')]?_0x332fca[_0x6aba('0x21')][_0x6aba('0x23')]||null:null,'attributes':_0x332fca[_0x6aba('0x21')]?_0x332fca[_0x6aba('0x21')]['attributes']||null:null,'limit':_0x332fca[_0x6aba('0x21')]?_0x332fca[_0x6aba('0x21')]['limit']||null:null})['then'](function(_0x4531ec){logger[_0x6aba('0x13')]('UpdateChatInteraction',_0x332fca);logger['debug'](_0x6aba('0x1d'),_0x332fca,JSON[_0x6aba('0x18')](_0x4531ec));_0x55b3ae(_0x4531ec);})[_0x6aba('0x1c')](function(_0x1ecf4d){logger['error'](_0x6aba('0x1d'),_0x1ecf4d[_0x6aba('0x1a')],_0x332fca);_0x2d116f(_0x2a2a39['error'](0x1f4,_0x1ecf4d['message']));});});};exports[_0x6aba('0x24')]=function(_0x385c2b){return new Promise(function(_0x132480,_0x1f3098){return db['ChatInteraction'][_0x6aba('0x25')]({'where':_0x385c2b[_0x6aba('0x21')]?_0x385c2b['options'][_0x6aba('0x23')]||null:null})[_0x6aba('0x12')](function(_0x32af40){if(_0x32af40){return _0x32af40[_0x6aba('0x26')](_0x385c2b[_0x6aba('0x20')][_0x6aba('0x27')],_[_0x6aba('0x28')](_0x385c2b[_0x6aba('0x20')],[_0x6aba('0x27'),'id'])||{});}})[_0x6aba('0x29')](function(_0x5991cf){logger[_0x6aba('0x13')]('AddTags',_0x385c2b);logger[_0x6aba('0x16')](_0x6aba('0x2a'),_0x385c2b,JSON[_0x6aba('0x18')](_0x5991cf));_0x132480(_0x5991cf);})[_0x6aba('0x1c')](function(_0x432669){logger[_0x6aba('0x19')](_0x6aba('0x2a'),_0x432669['message'],_0x385c2b);_0x1f3098(_this['error'](0x1f4,_0x432669['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index d11022c..01f1166 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 _0x7497=['chatInteraction:','./chatInteraction.events','save','remove','update','register','length'];(function(_0x32b243,_0x56dd88){var _0x33a553=function(_0x540592){while(--_0x540592){_0x32b243['push'](_0x32b243['shift']());}};_0x33a553(++_0x56dd88);}(_0x7497,0xef));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInteractionEvents=require(_0x7749('0x0'));var events=[_0x7749('0x1'),_0x7749('0x2'),_0x7749('0x3')];function createListener(_0x1cbee9,_0x281ae6){return function(_0x231916){_0x281ae6['emit'](_0x1cbee9,_0x231916);};}function removeListener(_0x1258e9,_0xc4e59f){return function(){ChatInteractionEvents['removeListener'](_0x1258e9,_0xc4e59f);};}exports[_0x7749('0x4')]=function(_0x5a458e){for(var _0x59e560=0x0,_0x57fe27=events[_0x7749('0x5')];_0x59e560<_0x57fe27;_0x59e560++){var _0x5d9226=events[_0x59e560];var _0x960185=createListener(_0x7749('0x6')+_0x5d9226,_0x5a458e);ChatInteractionEvents['on'](_0x5d9226,_0x960185);}}; \ No newline at end of file +var _0x396b=['chatInteraction:','save','remove','update','emit','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x396b,0xd1));var _0xb396=function(_0x3480e9,_0x1ce980){_0x3480e9=_0x3480e9-0x0;var _0x389aad=_0x396b[_0x3480e9];return _0x389aad;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xb396('0x0'),_0xb396('0x1'),_0xb396('0x2')];function createListener(_0x2d986c,_0x372d15){return function(_0x509714){_0x372d15[_0xb396('0x3')](_0x2d986c,_0x509714);};}function removeListener(_0x1fd99c,_0x3902e3){return function(){ChatInteractionEvents[_0xb396('0x4')](_0x1fd99c,_0x3902e3);};}exports[_0xb396('0x5')]=function(_0x2d6624){for(var _0x3b1dc6=0x0,_0x46d25e=events[_0xb396('0x6')];_0x3b1dc6<_0x46d25e;_0x3b1dc6++){var _0x2819c6=events[_0x3b1dc6];var _0x4d78a3=createListener(_0xb396('0x7')+_0x2819c6,_0x2d6624);ChatInteractionEvents['on'](_0x2819c6,_0x4d78a3);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index a2eb626..66e5314 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 _0xc1db=['replace','/:id/attachment_upload','single','file','isChatInteractionAuthorized','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','update','customUpdate','/:id/abandon','close','delete','chatinteraction:destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','root','server/files/attachments/','format','%s-%s','originalname'];(function(_0x413f65,_0x5e9011){var _0x22ebaf=function(_0x134ca5){while(--_0x134ca5){_0x413f65['push'](_0x413f65['shift']());}};_0x22ebaf(++_0x5e9011);}(_0xc1db,0x76));var _0xbc1d=function(_0x341212,_0x52dacc){_0x341212=_0x341212-0x0;var _0x202c5d=_0xc1db[_0x341212];return _0x202c5d;};'use strict';var multer=require(_0xbc1d('0x0'));var util=require(_0xbc1d('0x1'));var path=require(_0xbc1d('0x2'));var timeout=require(_0xbc1d('0x3'));var express=require(_0xbc1d('0x4'));var router=express[_0xbc1d('0x5')]();var fs_extra=require(_0xbc1d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xbc1d('0x7'));var config=require(_0xbc1d('0x8'));var controller=require(_0xbc1d('0x9'));router[_0xbc1d('0xa')]('/',auth[_0xbc1d('0xb')](),controller[_0xbc1d('0xc')]);router[_0xbc1d('0xa')](_0xbc1d('0xd'),auth[_0xbc1d('0xb')](),controller[_0xbc1d('0xe')]);router[_0xbc1d('0xa')](_0xbc1d('0xf'),auth['isChatInteractionAuthorized'](),controller[_0xbc1d('0x10')]);router[_0xbc1d('0xa')](_0xbc1d('0x11'),auth['isChatInteractionAuthorized'](),controller[_0xbc1d('0x12')]);router[_0xbc1d('0xa')](_0xbc1d('0x13'),auth['isAuthenticated'](),controller['getMessages']);router[_0xbc1d('0xa')](_0xbc1d('0x14'),auth['isChatInteractionAuthorized'](),controller[_0xbc1d('0x15')]);router[_0xbc1d('0xa')](_0xbc1d('0x16'),auth['isAuthenticated'](),controller[_0xbc1d('0x17')]);router[_0xbc1d('0x18')]('/',auth[_0xbc1d('0xb')](),controller[_0xbc1d('0x19')]);router[_0xbc1d('0x18')](_0xbc1d('0x1a'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x571a5e,_0x5a7323,_0x4db01a){_0x4db01a(null,path['join'](config[_0xbc1d('0x1b')],_0xbc1d('0x1c')));},'filename':function(_0x3ff361,_0xc3548d,_0x2a6244){_0x2a6244(null,util[_0xbc1d('0x1d')](_0xbc1d('0x1e'),Date['now'](),_0xc3548d[_0xbc1d('0x1f')][_0xbc1d('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbc1d('0x18')](_0xbc1d('0x21'),upload[_0xbc1d('0x22')](_0xbc1d('0x23')),controller['attachmentUpload']);router[_0xbc1d('0x18')](_0xbc1d('0x13'),auth[_0xbc1d('0x24')](),controller['addMessage']);router['post'](_0xbc1d('0x25'),auth[_0xbc1d('0xb')](),interaction[_0xbc1d('0x26')](_0xbc1d('0x27'),_0xbc1d('0x28')),controller[_0xbc1d('0x29')]);router[_0xbc1d('0x2a')](_0xbc1d('0xf'),auth[_0xbc1d('0xb')](),interaction[_0xbc1d('0x26')](_0xbc1d('0x27'),'chatinteraction:update'),controller[_0xbc1d('0x2b')]);router[_0xbc1d('0x2a')]('/:id/custom_update',controller[_0xbc1d('0x2c')]);router[_0xbc1d('0x2a')](_0xbc1d('0x2d'),auth[_0xbc1d('0x24')](),controller['abandon']);router[_0xbc1d('0x2a')]('/:id/close',controller[_0xbc1d('0x2e')]);router[_0xbc1d('0x2f')](_0xbc1d('0xf'),auth[_0xbc1d('0xb')](),interaction[_0xbc1d('0x26')](_0xbc1d('0x27'),_0xbc1d('0x30')),controller['destroy']);router[_0xbc1d('0x2f')](_0xbc1d('0x25'),auth[_0xbc1d('0xb')](),controller[_0xbc1d('0x31')]);module['exports']=router; \ No newline at end of file +var _0x2eaf=['file','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','util','express','Router','fs-extra','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','createVidaooSession','diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname'];(function(_0x5a19cc,_0x459aad){var _0x39e223=function(_0x1ab9ca){while(--_0x1ab9ca){_0x5a19cc['push'](_0x5a19cc['shift']());}};_0x39e223(++_0x459aad);}(_0x2eaf,0xb2));var _0xf2ea=function(_0x6f4319,_0x3709e0){_0x6f4319=_0x6f4319-0x0;var _0x44b4c3=_0x2eaf[_0x6f4319];return _0x44b4c3;};'use strict';var multer=require('multer');var util=require(_0xf2ea('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf2ea('0x1'));var router=express[_0xf2ea('0x2')]();var fs_extra=require(_0xf2ea('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf2ea('0x4'));var config=require('../../config/environment');var controller=require(_0xf2ea('0x5'));router[_0xf2ea('0x6')]('/',auth[_0xf2ea('0x7')](),controller[_0xf2ea('0x8')]);router[_0xf2ea('0x6')](_0xf2ea('0x9'),auth[_0xf2ea('0x7')](),controller[_0xf2ea('0xa')]);router['get'](_0xf2ea('0xb'),auth[_0xf2ea('0xc')](),controller['show']);router[_0xf2ea('0x6')](_0xf2ea('0xd'),auth['isChatInteractionAuthorized'](),controller[_0xf2ea('0xe')]);router[_0xf2ea('0x6')]('/:id/messages',auth[_0xf2ea('0x7')](),controller[_0xf2ea('0xf')]);router['get'](_0xf2ea('0x10'),auth['isChatInteractionAuthorized'](),controller[_0xf2ea('0x11')]);router[_0xf2ea('0x6')](_0xf2ea('0x12'),auth['isAuthenticated'](),controller[_0xf2ea('0x13')]);router[_0xf2ea('0x14')]('/',auth['isAuthenticated'](),controller[_0xf2ea('0x15')]);router[_0xf2ea('0x14')]('/:id/vidaoo',auth['isAuthenticated'](),controller[_0xf2ea('0x16')]);var upload=multer({'storage':multer[_0xf2ea('0x17')]({'destination':function(_0x4aa0ce,_0x959faa,_0x6cdfee){_0x6cdfee(null,path[_0xf2ea('0x18')](config['root'],_0xf2ea('0x19')));},'filename':function(_0x4696cb,_0x23e454,_0x22d30b){_0x22d30b(null,util[_0xf2ea('0x1a')](_0xf2ea('0x1b'),Date[_0xf2ea('0x1c')](),_0x23e454[_0xf2ea('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf2ea('0x14')]('/:id/attachment_upload',upload['single'](_0xf2ea('0x1e')),controller[_0xf2ea('0x1f')]);router[_0xf2ea('0x14')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0xf2ea('0x20')]);router[_0xf2ea('0x14')]('/:id/tags',auth[_0xf2ea('0x7')](),interaction[_0xf2ea('0x21')](_0xf2ea('0x22'),_0xf2ea('0x23')),controller[_0xf2ea('0x24')]);router[_0xf2ea('0x25')](_0xf2ea('0xb'),auth[_0xf2ea('0x7')](),interaction[_0xf2ea('0x21')](_0xf2ea('0x22'),_0xf2ea('0x26')),controller[_0xf2ea('0x27')]);router[_0xf2ea('0x25')](_0xf2ea('0x28'),controller[_0xf2ea('0x29')]);router[_0xf2ea('0x25')](_0xf2ea('0x2a'),auth[_0xf2ea('0xc')](),controller[_0xf2ea('0x2b')]);router[_0xf2ea('0x25')](_0xf2ea('0x2c'),controller[_0xf2ea('0x2d')]);router[_0xf2ea('0x2e')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xf2ea('0x22'),_0xf2ea('0x2f')),controller[_0xf2ea('0x30')]);router[_0xf2ea('0x2e')](_0xf2ea('0x31'),auth['isAuthenticated'](),controller[_0xf2ea('0x32')]);module[_0xf2ea('0x33')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 250f30b..b611258 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 _0x8024=['exports','TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x514317,_0xee82c9){var _0x13805a=function(_0x38a89f){while(--_0x38a89f){_0x514317['push'](_0x514317['shift']());}};_0x13805a(++_0xee82c9);}(_0x8024,0x167));var _0x4802=function(_0xe12a38,_0x386d94){_0xe12a38=_0xe12a38-0x0;var _0x5ac852=_0x8024[_0xe12a38];return _0x5ac852;};'use strict';var Sequelize=require(_0x4802('0x0'));module[_0x4802('0x1')]={'body':{'type':Sequelize[_0x4802('0x2')](_0x4802('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4802('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x4802('0x5')]}}; \ No newline at end of file +var _0xec6f=['sequelize','exports','TEXT','INTEGER'];(function(_0x4f67c6,_0x3ce1d3){var _0x2faa13=function(_0x293026){while(--_0x293026){_0x4f67c6['push'](_0x4f67c6['shift']());}};_0x2faa13(++_0x3ce1d3);}(_0xec6f,0xfc));var _0xfec6=function(_0x3ccdb0,_0x4adc30){_0x3ccdb0=_0x3ccdb0-0x0;var _0x58aa5b=_0xec6f[_0x3ccdb0];return _0x58aa5b;};'use strict';var Sequelize=require(_0xfec6('0x0'));module[_0xfec6('0x1')]={'body':{'type':Sequelize[_0xfec6('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xfec6('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 3543081..e7782f2 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 _0x689e=['push','messages','createdAt','FromId','ToId','read','all','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','sendStatus','status','end','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','name','send','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','find','body','describe','get','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','agent','user','fullname','role','userpic','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource'];(function(_0x5b3e86,_0x1bdd3a){var _0x5170f6=function(_0xff5c99){while(--_0xff5c99){_0x5b3e86['push'](_0x5b3e86['shift']());}};_0x5170f6(++_0x1bdd3a);}(_0x689e,0x1b3));var _0xe689=function(_0x298a5f,_0x26e88d){_0x298a5f=_0x298a5f-0x0;var _0x266c0f=_0x689e[_0x298a5f];return _0x266c0f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe689('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe689('0x1'));var rp=require(_0xe689('0x2'));var moment=require(_0xe689('0x3'));var BPromise=require(_0xe689('0x4'));var Mustache=require(_0xe689('0x5'));var util=require(_0xe689('0x6'));var path=require(_0xe689('0x7'));var sox=require(_0xe689('0x8'));var csv=require(_0xe689('0x9'));var ejs=require(_0xe689('0xa'));var fs=require('fs');var fs_extra=require(_0xe689('0xb'));var _=require(_0xe689('0xc'));var squel=require('squel');var crypto=require(_0xe689('0xd'));var jsforce=require(_0xe689('0xe'));var deskjs=require(_0xe689('0xf'));var toCsv=require(_0xe689('0x9'));var querystring=require(_0xe689('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe689('0x11'));var qs=require(_0xe689('0x12'));var as=require(_0xe689('0x13'));var hardwareService=require(_0xe689('0x14'));var logger=require(_0xe689('0x15'))(_0xe689('0x16'));var utils=require(_0xe689('0x17'));var config=require(_0xe689('0x18'));var licenseUtil=require(_0xe689('0x19'));var db=require(_0xe689('0x1a'))['db'];config[_0xe689('0x1b')]=_[_0xe689('0x1c')](config['redis'],{'host':_0xe689('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe689('0x1b')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x11ec6a,_0x5bc883){_0x5bc883=_0x5bc883||0xcc;return function(_0x4345e1){if(_0x4345e1){return _0x11ec6a[_0xe689('0x1e')](_0x5bc883);}return _0x11ec6a[_0xe689('0x1f')](_0x5bc883)[_0xe689('0x20')]();};}function respondWithResult(_0x3aa404,_0x426925){_0x426925=_0x426925||0xc8;return function(_0x273d94){if(_0x273d94){return _0x3aa404[_0xe689('0x1f')](_0x426925)['json'](_0x273d94);}};}function respondWithFilteredResult(_0x3b2165,_0x5354a0){return function(_0x2be360){if(_0x2be360){var _0x4f639d=typeof _0x5354a0['offset']===_0xe689('0x21')&&typeof _0x5354a0[_0xe689('0x22')]==='undefined';var _0x575adc=_0x2be360[_0xe689('0x23')];var _0x2fc3af=_0x4f639d?0x0:_0x5354a0['offset'];var _0x3dedc6=_0x4f639d?_0x2be360[_0xe689('0x23')]:_0x5354a0['offset']+_0x5354a0['limit'];var _0x32b7ce;if(_0x3dedc6>=_0x575adc){_0x3dedc6=_0x575adc;_0x32b7ce=0xc8;}else{_0x32b7ce=0xce;}_0x3b2165[_0xe689('0x1f')](_0x32b7ce);return _0x3b2165[_0xe689('0x24')](_0xe689('0x25'),_0x2fc3af+'-'+_0x3dedc6+'/'+_0x575adc)[_0xe689('0x26')](_0x2be360);}return null;};}function patchUpdates(_0x43542c){return function(_0x117a51){try{jsonpatch[_0xe689('0x27')](_0x117a51,_0x43542c,!![]);}catch(_0x19cf31){return BPromise['reject'](_0x19cf31);}return _0x117a51[_0xe689('0x28')]();};}function saveUpdates(_0x34e65f,_0x252963){return function(_0x3fd7bf){if(_0x3fd7bf){return _0x3fd7bf[_0xe689('0x29')](_0x34e65f)[_0xe689('0x2a')](function(_0x45d054){return _0x45d054;});}return null;};}function removeEntity(_0x242e5b,_0x1abce0){return function(_0x478770){if(_0x478770){return _0x478770[_0xe689('0x2b')]()[_0xe689('0x2a')](function(){_0x242e5b[_0xe689('0x1f')](0xcc)[_0xe689('0x20')]();});}};}function handleEntityNotFound(_0xc55abc,_0x4de6c9){return function(_0x2597e3){if(!_0x2597e3){_0xc55abc['sendStatus'](0x194);}return _0x2597e3;};}function handleError(_0x4c09c9,_0x530030){_0x530030=_0x530030||0x1f4;return function(_0x2ae8c3){logger[_0xe689('0x2c')](_0x2ae8c3['stack']);if(_0x2ae8c3[_0xe689('0x2d')]){delete _0x2ae8c3[_0xe689('0x2d')];}_0x4c09c9[_0xe689('0x1f')](_0x530030)[_0xe689('0x2e')](_0x2ae8c3);};}exports['index']=function(_0x160e9e,_0x3a0ddb){var _0x143647={},_0x47ca2d={},_0x91a8f9={'count':0x0,'rows':[]};var _0x1c91b3=_[_0xe689('0x2f')](db[_0xe689('0x30')][_0xe689('0x31')],function(_0x52277b){return{'name':_0x52277b[_0xe689('0x32')],'type':_0x52277b[_0xe689('0x33')][_0xe689('0x34')]};});_0x47ca2d[_0xe689('0x35')]=_[_0xe689('0x2f')](_0x1c91b3,_0xe689('0x2d'));_0x47ca2d[_0xe689('0x36')]=_[_0xe689('0x37')](_0x160e9e[_0xe689('0x36')]);_0x47ca2d[_0xe689('0x38')]=_[_0xe689('0x39')](_0x47ca2d[_0xe689('0x35')],_0x47ca2d[_0xe689('0x36')]);_0x143647['attributes']=_[_0xe689('0x39')](_0x47ca2d[_0xe689('0x35')],qs[_0xe689('0x3a')](_0x160e9e[_0xe689('0x36')][_0xe689('0x3a')]));_0x143647[_0xe689('0x3b')]=_0x143647[_0xe689('0x3b')][_0xe689('0x3c')]?_0x143647[_0xe689('0x3b')]:_0x47ca2d[_0xe689('0x35')];if(!_0x160e9e[_0xe689('0x36')]['hasOwnProperty'](_0xe689('0x3d'))){_0x143647[_0xe689('0x22')]=qs[_0xe689('0x22')](_0x160e9e['query'][_0xe689('0x22')]);_0x143647[_0xe689('0x3e')]=qs[_0xe689('0x3e')](_0x160e9e[_0xe689('0x36')][_0xe689('0x3e')]);}_0x143647['order']=qs[_0xe689('0x3f')](_0x160e9e[_0xe689('0x36')][_0xe689('0x3f')]);_0x143647[_0xe689('0x40')]=qs[_0xe689('0x38')](_[_0xe689('0x41')](_0x160e9e['query'],_0x47ca2d[_0xe689('0x38')]),_0x1c91b3);if(_0x160e9e[_0xe689('0x36')][_0xe689('0x42')]){_0x143647[_0xe689('0x40')]=_[_0xe689('0x43')](_0x143647[_0xe689('0x40')],{'$or':_[_0xe689('0x2f')](_0x1c91b3,function(_0x45b12d){if(_0x45b12d[_0xe689('0x33')]!==_0xe689('0x44')){var _0x4d82fb={};_0x4d82fb[_0x45b12d[_0xe689('0x2d')]]={'$like':'%'+_0x160e9e[_0xe689('0x36')][_0xe689('0x42')]+'%'};return _0x4d82fb;}})});}_0x143647=_['merge']({},_0x143647,_0x160e9e[_0xe689('0x45')]);var _0x45b8cb={'where':_0x143647['where']};return db[_0xe689('0x30')][_0xe689('0x23')](_0x45b8cb)[_0xe689('0x2a')](function(_0x17725f){_0x91a8f9[_0xe689('0x23')]=_0x17725f;if(_0x160e9e[_0xe689('0x36')]['includeAll']){_0x143647[_0xe689('0x46')]=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x143647);})[_0xe689('0x2a')](function(_0xcda47c){_0x91a8f9[_0xe689('0x47')]=_0xcda47c;return _0x91a8f9;})[_0xe689('0x2a')](respondWithFilteredResult(_0x3a0ddb,_0x143647))[_0xe689('0x48')](handleError(_0x3a0ddb,null));};exports[_0xe689('0x49')]=function(_0x4647b9,_0x682f0){var _0xf02d32={'raw':!![],'where':{'id':_0x4647b9['params']['id']}},_0x1285e3={};_0x1285e3[_0xe689('0x35')]=_[_0xe689('0x37')](db[_0xe689('0x30')][_0xe689('0x31')]);_0x1285e3[_0xe689('0x36')]=_[_0xe689('0x37')](_0x4647b9['query']);_0x1285e3[_0xe689('0x38')]=_[_0xe689('0x39')](_0x1285e3['model'],_0x1285e3[_0xe689('0x36')]);_0xf02d32[_0xe689('0x3b')]=_['intersection'](_0x1285e3['model'],qs['fields'](_0x4647b9['query']['fields']));_0xf02d32['attributes']=_0xf02d32['attributes'][_0xe689('0x3c')]?_0xf02d32[_0xe689('0x3b')]:_0x1285e3['model'];if(_0x4647b9[_0xe689('0x36')]['includeAll']){_0xf02d32[_0xe689('0x46')]=[{'all':!![]}];}_0xf02d32=_[_0xe689('0x43')]({},_0xf02d32,_0x4647b9[_0xe689('0x45')]);return db[_0xe689('0x30')][_0xe689('0x4a')](_0xf02d32)[_0xe689('0x2a')](handleEntityNotFound(_0x682f0,null))[_0xe689('0x2a')](respondWithResult(_0x682f0,null))['catch'](handleError(_0x682f0,null));};exports['create']=function(_0x15954b,_0x498ff0){return db[_0xe689('0x30')]['create'](_0x15954b[_0xe689('0x4b')],{})[_0xe689('0x2a')](respondWithResult(_0x498ff0,0xc9))[_0xe689('0x48')](handleError(_0x498ff0,null));};exports[_0xe689('0x29')]=function(_0x127657,_0xdc47ab){if(_0x127657[_0xe689('0x4b')]['id']){delete _0x127657[_0xe689('0x4b')]['id'];}return db[_0xe689('0x30')][_0xe689('0x4a')]({'where':{'id':_0x127657['params']['id']}})[_0xe689('0x2a')](handleEntityNotFound(_0xdc47ab,null))['then'](saveUpdates(_0x127657[_0xe689('0x4b')],null))['then'](respondWithResult(_0xdc47ab,null))[_0xe689('0x48')](handleError(_0xdc47ab,null));};exports['destroy']=function(_0xc8fd00,_0x6cd9bc){return db[_0xe689('0x30')][_0xe689('0x4a')]({'where':{'id':_0xc8fd00['params']['id']}})['then'](handleEntityNotFound(_0x6cd9bc,null))[_0xe689('0x2a')](removeEntity(_0x6cd9bc,null))['catch'](handleError(_0x6cd9bc,null));};exports['describe']=function(_0x5c893e,_0x49c3df){return db[_0xe689('0x30')][_0xe689('0x4c')]()[_0xe689('0x2a')](respondWithResult(_0x49c3df,null))[_0xe689('0x48')](handleError(_0x49c3df,null));};function wrapUser(_0x139264){return function(_0x547463){var _0xe4702c=_0x139264[_0xe689('0x4d')]({'plain':!![]});_0xe4702c['messages']=[];if(_0x547463){_0xe4702c[_0xe689('0x4e')]=_0x547463['createdAt'];_0xe4702c[_0xe689('0x4f')]=_0x547463;}else{_0xe4702c[_0xe689('0x4e')]=moment(0x0)[_0xe689('0x50')](_0xe689('0x51'));_0xe4702c[_0xe689('0x4f')]={};}return _0xe4702c;};}exports[_0xe689('0x52')]=function(_0x2110b7,_0x299417,_0x3101b1){var _0x181aed=[];return db[_0xe689('0x53')][_0xe689('0x54')]({'where':{'role':[_0xe689('0x55'),'admin',_0xe689('0x56')]},'attributes':['id',_0xe689('0x57'),'name',_0xe689('0x58'),_0xe689('0x59'),'internal',_0xe689('0x5a'),_0xe689('0x5b'),_0xe689('0x5c'),_0xe689('0x5d')],'order':qs[_0xe689('0x3f')]('-online'),'include':[{'model':db[_0xe689('0x5e')],'as':'VoiceQueues','attributes':['id',_0xe689('0x2d'),'type'],'through':{'attributes':[]}}]})[_0xe689('0x2a')](function(_0x113eb6){if(_0x113eb6){var _0x399513=_0x2110b7[_0xe689('0x56')][_0xe689('0x4d')]({'plain':!![]});if(!_0x399513)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x399513[_0xe689('0x58')]===_0xe689('0x56')){return db[_0xe689('0x5f')]['find']({'where':{'name':_0xe689('0x60'),'userProfileId':_0x399513[_0xe689('0x61')]},'raw':!![]})[_0xe689('0x2a')](function(_0x2a2b40){if(_0x2a2b40){if(_0x2a2b40[_0xe689('0x62')]===0x0){return db[_0xe689('0x63')][_0xe689('0x54')]({'where':{'sectionId':_0x2a2b40['id']},'raw':!![]})[_0xe689('0x2a')](function(_0x923fc3){var _0x4e6de6=[];if(_['isEmpty'](_0x923fc3)){_0x4e6de6=_['filter'](_0x113eb6,function(_0x6fb425){if(_0x6fb425['role']!=='agent'){return _0x6fb425;}});return _0x4e6de6;}else{for(var _0x4e756b=0x0;_0x4e756b<_0x113eb6[_0xe689('0x3c')];_0x4e756b++){var _0x45c629=_0x113eb6[_0x4e756b];if(_0x45c629['role']===_0xe689('0x55')){var _0x53eaf4=_[_0xe689('0x4a')](_0x923fc3,function(_0x1b1245){return _0x1b1245['resourceId']===_0x45c629['id'];});if(_0x53eaf4)_0x4e6de6['push'](_0x45c629);}else{_0x4e6de6[_0xe689('0x64')](_0x45c629);}}return _0x4e6de6;}});}else{return _0x113eb6;}}else{var _0x2876f7=_['filter'](_0x113eb6,function(_0x80f429){if(_0x80f429[_0xe689('0x58')]!==_0xe689('0x55')){return _0x80f429;}});return _0x2876f7;}});}else{return _0x113eb6;}}})[_0xe689('0x2a')](function(_0x1d36a2){var _0x41c79b=[];if(_0x1d36a2){_0x181aed=_0x1d36a2;for(var _0x148e26=0x0;_0x148e26<_0x1d36a2[_0xe689('0x3c')];_0x148e26+=0x1){_0x181aed[_0x148e26][_0xe689('0x65')]=[];_0x41c79b[_0xe689('0x64')](db[_0xe689('0x30')][_0xe689('0x4a')]({'where':{'FromId':[_0x2110b7['user']['id'],_0x1d36a2[_0x148e26]['id']],'ToId':[_0x2110b7[_0xe689('0x56')]['id'],_0x1d36a2[_0x148e26]['id']],'ChatGroupId':null},'attributes':['id',_0xe689('0x66'),_0xe689('0x67'),_0xe689('0x68'),_0xe689('0x69'),_0xe689('0x4b')],'order':qs[_0xe689('0x3f')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe689('0x2a')](wrapUser(_0x1d36a2[_0x148e26])));}return BPromise[_0xe689('0x6a')](_0x41c79b);}return[];})['then'](function(_0x54292c){return{'rows':_0x54292c,'count':_0x54292c['length']};})[_0xe689('0x2a')](respondWithResult(_0x299417,null))[_0xe689('0x48')](handleError(_0x299417,null));}; \ No newline at end of file +var _0xcdf3=['where','pick','filter','VIRTUAL','merge','ChatInternalMessage','includeAll','include','findAll','rows','catch','show','params','length','options','body','find','destroy','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','agent','fullname','online','allowmessenger','showWebBar','-online','type','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','isEmpty','role','resourceId','createdAt','FromId','ToId','read','-createdAt','all','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','sendStatus','end','status','offset','limit','count','set','json','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort'];(function(_0x25a471,_0x33cb10){var _0x2e59a0=function(_0x16a7fe){while(--_0x16a7fe){_0x25a471['push'](_0x25a471['shift']());}};_0x2e59a0(++_0x33cb10);}(_0xcdf3,0x9a));var _0x3cdf=function(_0x24e299,_0x3e50c9){_0x24e299=_0x24e299-0x0;var _0x39554e=_0xcdf3[_0x24e299];return _0x39554e;};'use strict';var emlformat=require(_0x3cdf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3cdf('0x1'));var rp=require(_0x3cdf('0x2'));var moment=require(_0x3cdf('0x3'));var BPromise=require(_0x3cdf('0x4'));var Mustache=require(_0x3cdf('0x5'));var util=require(_0x3cdf('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3cdf('0x7'));var ejs=require(_0x3cdf('0x8'));var fs=require('fs');var fs_extra=require(_0x3cdf('0x9'));var _=require(_0x3cdf('0xa'));var squel=require(_0x3cdf('0xb'));var crypto=require(_0x3cdf('0xc'));var jsforce=require(_0x3cdf('0xd'));var deskjs=require(_0x3cdf('0xe'));var toCsv=require(_0x3cdf('0x7'));var querystring=require(_0x3cdf('0xf'));var Papa=require(_0x3cdf('0x10'));var Redis=require('ioredis');var authService=require(_0x3cdf('0x11'));var qs=require(_0x3cdf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3cdf('0x13'));var logger=require(_0x3cdf('0x14'))(_0x3cdf('0x15'));var utils=require('../../config/utils');var config=require(_0x3cdf('0x16'));var licenseUtil=require(_0x3cdf('0x17'));var db=require(_0x3cdf('0x18'))['db'];config[_0x3cdf('0x19')]=_[_0x3cdf('0x1a')](config[_0x3cdf('0x19')],{'host':_0x3cdf('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3cdf('0x19')]));require(_0x3cdf('0x1c'))[_0x3cdf('0x1d')](socket);function respondWithStatusCode(_0x527124,_0x145a1a){_0x145a1a=_0x145a1a||0xcc;return function(_0x198cea){if(_0x198cea){return _0x527124[_0x3cdf('0x1e')](_0x145a1a);}return _0x527124['status'](_0x145a1a)[_0x3cdf('0x1f')]();};}function respondWithResult(_0x341ecc,_0x5aeb47){_0x5aeb47=_0x5aeb47||0xc8;return function(_0x2d7f39){if(_0x2d7f39){return _0x341ecc[_0x3cdf('0x20')](_0x5aeb47)['json'](_0x2d7f39);}};}function respondWithFilteredResult(_0x5f2148,_0x5e1890){return function(_0x25d717){if(_0x25d717){var _0x2e8574=typeof _0x5e1890[_0x3cdf('0x21')]==='undefined'&&typeof _0x5e1890[_0x3cdf('0x22')]==='undefined';var _0x4dad97=_0x25d717[_0x3cdf('0x23')];var _0x5a7edd=_0x2e8574?0x0:_0x5e1890[_0x3cdf('0x21')];var _0x340cae=_0x2e8574?_0x25d717[_0x3cdf('0x23')]:_0x5e1890[_0x3cdf('0x21')]+_0x5e1890[_0x3cdf('0x22')];var _0x44b35c;if(_0x340cae>=_0x4dad97){_0x340cae=_0x4dad97;_0x44b35c=0xc8;}else{_0x44b35c=0xce;}_0x5f2148['status'](_0x44b35c);return _0x5f2148[_0x3cdf('0x24')]('Content-Range',_0x5a7edd+'-'+_0x340cae+'/'+_0x4dad97)[_0x3cdf('0x25')](_0x25d717);}return null;};}function patchUpdates(_0x39a400){return function(_0x477ddb){try{jsonpatch[_0x3cdf('0x26')](_0x477ddb,_0x39a400,!![]);}catch(_0x5af15e){return BPromise[_0x3cdf('0x27')](_0x5af15e);}return _0x477ddb[_0x3cdf('0x28')]();};}function saveUpdates(_0xf25e01,_0x16f504){return function(_0x1d702c){if(_0x1d702c){return _0x1d702c[_0x3cdf('0x29')](_0xf25e01)[_0x3cdf('0x2a')](function(_0xe0316c){return _0xe0316c;});}return null;};}function removeEntity(_0xa7fb02,_0x1b0ae1){return function(_0x5758b3){if(_0x5758b3){return _0x5758b3['destroy']()[_0x3cdf('0x2a')](function(){_0xa7fb02['status'](0xcc)[_0x3cdf('0x1f')]();});}};}function handleEntityNotFound(_0x1e1053,_0x146d11){return function(_0x2ca865){if(!_0x2ca865){_0x1e1053['sendStatus'](0x194);}return _0x2ca865;};}function handleError(_0x2a1b03,_0x96776a){_0x96776a=_0x96776a||0x1f4;return function(_0x44ca4c){logger[_0x3cdf('0x2b')](_0x44ca4c[_0x3cdf('0x2c')]);if(_0x44ca4c[_0x3cdf('0x2d')]){delete _0x44ca4c[_0x3cdf('0x2d')];}_0x2a1b03['status'](_0x96776a)[_0x3cdf('0x2e')](_0x44ca4c);};}exports[_0x3cdf('0x2f')]=function(_0x3c9eeb,_0x50c052){var _0x5ec186={},_0x6cecef={},_0x5d897f={'count':0x0,'rows':[]};var _0x247fb5=_[_0x3cdf('0x30')](db['ChatInternalMessage'][_0x3cdf('0x31')],function(_0x390d26){return{'name':_0x390d26['fieldName'],'type':_0x390d26['type']['key']};});_0x6cecef[_0x3cdf('0x32')]=_[_0x3cdf('0x30')](_0x247fb5,'name');_0x6cecef[_0x3cdf('0x33')]=_[_0x3cdf('0x34')](_0x3c9eeb[_0x3cdf('0x33')]);_0x6cecef[_0x3cdf('0x35')]=_[_0x3cdf('0x36')](_0x6cecef[_0x3cdf('0x32')],_0x6cecef[_0x3cdf('0x33')]);_0x5ec186[_0x3cdf('0x37')]=_[_0x3cdf('0x36')](_0x6cecef[_0x3cdf('0x32')],qs['fields'](_0x3c9eeb[_0x3cdf('0x33')][_0x3cdf('0x38')]));_0x5ec186[_0x3cdf('0x37')]=_0x5ec186[_0x3cdf('0x37')]['length']?_0x5ec186['attributes']:_0x6cecef[_0x3cdf('0x32')];if(!_0x3c9eeb[_0x3cdf('0x33')][_0x3cdf('0x39')]('nolimit')){_0x5ec186[_0x3cdf('0x22')]=qs['limit'](_0x3c9eeb[_0x3cdf('0x33')][_0x3cdf('0x22')]);_0x5ec186[_0x3cdf('0x21')]=qs[_0x3cdf('0x21')](_0x3c9eeb[_0x3cdf('0x33')][_0x3cdf('0x21')]);}_0x5ec186[_0x3cdf('0x3a')]=qs['sort'](_0x3c9eeb[_0x3cdf('0x33')][_0x3cdf('0x3b')]);_0x5ec186[_0x3cdf('0x3c')]=qs[_0x3cdf('0x35')](_[_0x3cdf('0x3d')](_0x3c9eeb['query'],_0x6cecef['filters']),_0x247fb5);if(_0x3c9eeb['query'][_0x3cdf('0x3e')]){_0x5ec186[_0x3cdf('0x3c')]=_['merge'](_0x5ec186[_0x3cdf('0x3c')],{'$or':_[_0x3cdf('0x30')](_0x247fb5,function(_0x192567){if(_0x192567['type']!==_0x3cdf('0x3f')){var _0x5f3c75={};_0x5f3c75[_0x192567[_0x3cdf('0x2d')]]={'$like':'%'+_0x3c9eeb['query'][_0x3cdf('0x3e')]+'%'};return _0x5f3c75;}})});}_0x5ec186=_[_0x3cdf('0x40')]({},_0x5ec186,_0x3c9eeb['options']);var _0x147e69={'where':_0x5ec186[_0x3cdf('0x3c')]};return db[_0x3cdf('0x41')]['count'](_0x147e69)[_0x3cdf('0x2a')](function(_0x358e3e){_0x5d897f[_0x3cdf('0x23')]=_0x358e3e;if(_0x3c9eeb[_0x3cdf('0x33')][_0x3cdf('0x42')]){_0x5ec186[_0x3cdf('0x43')]=[{'all':!![]}];}return db[_0x3cdf('0x41')][_0x3cdf('0x44')](_0x5ec186);})['then'](function(_0x1063b6){_0x5d897f[_0x3cdf('0x45')]=_0x1063b6;return _0x5d897f;})[_0x3cdf('0x2a')](respondWithFilteredResult(_0x50c052,_0x5ec186))[_0x3cdf('0x46')](handleError(_0x50c052,null));};exports[_0x3cdf('0x47')]=function(_0x52a7e4,_0x223f45){var _0x498bd5={'raw':!![],'where':{'id':_0x52a7e4[_0x3cdf('0x48')]['id']}},_0x20237e={};_0x20237e[_0x3cdf('0x32')]=_['keys'](db[_0x3cdf('0x41')]['rawAttributes']);_0x20237e[_0x3cdf('0x33')]=_[_0x3cdf('0x34')](_0x52a7e4[_0x3cdf('0x33')]);_0x20237e[_0x3cdf('0x35')]=_[_0x3cdf('0x36')](_0x20237e[_0x3cdf('0x32')],_0x20237e['query']);_0x498bd5['attributes']=_[_0x3cdf('0x36')](_0x20237e[_0x3cdf('0x32')],qs[_0x3cdf('0x38')](_0x52a7e4['query'][_0x3cdf('0x38')]));_0x498bd5['attributes']=_0x498bd5[_0x3cdf('0x37')][_0x3cdf('0x49')]?_0x498bd5[_0x3cdf('0x37')]:_0x20237e[_0x3cdf('0x32')];if(_0x52a7e4['query'][_0x3cdf('0x42')]){_0x498bd5[_0x3cdf('0x43')]=[{'all':!![]}];}_0x498bd5=_[_0x3cdf('0x40')]({},_0x498bd5,_0x52a7e4[_0x3cdf('0x4a')]);return db[_0x3cdf('0x41')]['find'](_0x498bd5)[_0x3cdf('0x2a')](handleEntityNotFound(_0x223f45,null))['then'](respondWithResult(_0x223f45,null))[_0x3cdf('0x46')](handleError(_0x223f45,null));};exports['create']=function(_0x53fc14,_0x7dc4b9){return db['ChatInternalMessage']['create'](_0x53fc14[_0x3cdf('0x4b')],{})[_0x3cdf('0x2a')](respondWithResult(_0x7dc4b9,0xc9))[_0x3cdf('0x46')](handleError(_0x7dc4b9,null));};exports['update']=function(_0x57e52f,_0x467047){if(_0x57e52f['body']['id']){delete _0x57e52f['body']['id'];}return db[_0x3cdf('0x41')][_0x3cdf('0x4c')]({'where':{'id':_0x57e52f[_0x3cdf('0x48')]['id']}})['then'](handleEntityNotFound(_0x467047,null))[_0x3cdf('0x2a')](saveUpdates(_0x57e52f[_0x3cdf('0x4b')],null))[_0x3cdf('0x2a')](respondWithResult(_0x467047,null))[_0x3cdf('0x46')](handleError(_0x467047,null));};exports[_0x3cdf('0x4d')]=function(_0x9047f1,_0x58d983){return db[_0x3cdf('0x41')]['find']({'where':{'id':_0x9047f1[_0x3cdf('0x48')]['id']}})['then'](handleEntityNotFound(_0x58d983,null))['then'](removeEntity(_0x58d983,null))[_0x3cdf('0x46')](handleError(_0x58d983,null));};exports['describe']=function(_0x4f1182,_0x4e4a27){return db[_0x3cdf('0x41')][_0x3cdf('0x4e')]()[_0x3cdf('0x2a')](respondWithResult(_0x4e4a27,null))[_0x3cdf('0x46')](handleError(_0x4e4a27,null));};function wrapUser(_0x95ac14){return function(_0x316e0f){var _0x1abebc=_0x95ac14[_0x3cdf('0x4f')]({'plain':!![]});_0x1abebc[_0x3cdf('0x50')]=[];if(_0x316e0f){_0x1abebc[_0x3cdf('0x51')]=_0x316e0f['createdAt'];_0x1abebc[_0x3cdf('0x52')]=_0x316e0f;}else{_0x1abebc['lastMessageAt']=moment(0x0)[_0x3cdf('0x53')](_0x3cdf('0x54'));_0x1abebc[_0x3cdf('0x52')]={};}return _0x1abebc;};}exports['getUsers']=function(_0x508ec2,_0x161437,_0x46a544){var _0x3795a4=[];return db[_0x3cdf('0x55')][_0x3cdf('0x44')]({'where':{'role':[_0x3cdf('0x56'),'admin','user']},'attributes':['id',_0x3cdf('0x57'),_0x3cdf('0x2d'),'role','userpic','internal',_0x3cdf('0x58'),'lastLoginAt',_0x3cdf('0x59'),_0x3cdf('0x5a')],'order':qs['sort'](_0x3cdf('0x5b')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0x3cdf('0x2d'),_0x3cdf('0x5c')],'through':{'attributes':[]}}]})[_0x3cdf('0x2a')](function(_0x5bb603){if(_0x5bb603){var _0xb494c3=_0x508ec2[_0x3cdf('0x5d')][_0x3cdf('0x4f')]({'plain':!![]});if(!_0xb494c3)throw new Error(_0x3cdf('0x5e'));if(_0xb494c3['role']==='user'){return db[_0x3cdf('0x5f')][_0x3cdf('0x4c')]({'where':{'name':_0x3cdf('0x60'),'userProfileId':_0xb494c3['userProfileId']},'raw':!![]})[_0x3cdf('0x2a')](function(_0x31e942){if(_0x31e942){if(_0x31e942[_0x3cdf('0x61')]===0x0){return db['UserProfileResource'][_0x3cdf('0x44')]({'where':{'sectionId':_0x31e942['id']},'raw':!![]})[_0x3cdf('0x2a')](function(_0x193876){var _0x166386=[];if(_[_0x3cdf('0x62')](_0x193876)){_0x166386=_['filter'](_0x5bb603,function(_0xcdf20f){if(_0xcdf20f[_0x3cdf('0x63')]!=='agent'){return _0xcdf20f;}});return _0x166386;}else{for(var _0xd187e=0x0;_0xd187e<_0x5bb603['length'];_0xd187e++){var _0x30634f=_0x5bb603[_0xd187e];if(_0x30634f[_0x3cdf('0x63')]===_0x3cdf('0x56')){var _0x542794=_[_0x3cdf('0x4c')](_0x193876,function(_0x2d0f40){return _0x2d0f40[_0x3cdf('0x64')]===_0x30634f['id'];});if(_0x542794)_0x166386['push'](_0x30634f);}else{_0x166386['push'](_0x30634f);}}return _0x166386;}});}else{return _0x5bb603;}}else{var _0x869b44=_['filter'](_0x5bb603,function(_0x4f02e2){if(_0x4f02e2['role']!==_0x3cdf('0x56')){return _0x4f02e2;}});return _0x869b44;}});}else{return _0x5bb603;}}})[_0x3cdf('0x2a')](function(_0x3c9828){var _0x29a85d=[];if(_0x3c9828){_0x3795a4=_0x3c9828;for(var _0x2197e9=0x0;_0x2197e9<_0x3c9828[_0x3cdf('0x49')];_0x2197e9+=0x1){_0x3795a4[_0x2197e9][_0x3cdf('0x50')]=[];_0x29a85d['push'](db[_0x3cdf('0x41')][_0x3cdf('0x4c')]({'where':{'FromId':[_0x508ec2[_0x3cdf('0x5d')]['id'],_0x3c9828[_0x2197e9]['id']],'ToId':[_0x508ec2[_0x3cdf('0x5d')]['id'],_0x3c9828[_0x2197e9]['id']],'ChatGroupId':null},'attributes':['id',_0x3cdf('0x65'),_0x3cdf('0x66'),_0x3cdf('0x67'),_0x3cdf('0x68'),_0x3cdf('0x4b')],'order':qs[_0x3cdf('0x3b')](_0x3cdf('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x3cdf('0x2a')](wrapUser(_0x3c9828[_0x2197e9])));}return BPromise[_0x3cdf('0x6a')](_0x29a85d);}return[];})[_0x3cdf('0x2a')](function(_0x590612){return{'rows':_0x590612,'count':_0x590612[_0x3cdf('0x49')]};})['then'](respondWithResult(_0x161437,null))['catch'](handleError(_0x161437,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index e9357c0..544c0bd 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 _0x9c15=['update','remove','emit','hook','events','../../mysqldb','ChatInternalMessage','save'];(function(_0x3163a3,_0x2f79c3){var _0x59b3cc=function(_0x103d66){while(--_0x103d66){_0x3163a3['push'](_0x3163a3['shift']());}};_0x59b3cc(++_0x2f79c3);}(_0x9c15,0x7c));var _0x59c1=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x9c15[_0x138adb];return _0x1b27f2;};'use strict';var EventEmitter=require(_0x59c1('0x0'));var ChatInternalMessage=require(_0x59c1('0x1'))['db'][_0x59c1('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x59c1('0x3'),'afterUpdate':_0x59c1('0x4'),'afterDestroy':_0x59c1('0x5')};function emitEvent(_0x4c256e){return function(_0x5e1c52,_0x3961ee,_0x2c25c8){ChatInternalMessageEvents[_0x59c1('0x6')](_0x4c256e+':'+_0x5e1c52['id'],_0x5e1c52);ChatInternalMessageEvents[_0x59c1('0x6')](_0x4c256e,_0x5e1c52);_0x2c25c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x59c1('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x694c=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','events'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0x694c,0x67));var _0xc694=function(_0x1162c0,_0x3263ff){_0x1162c0=_0x1162c0-0x0;var _0x44f3cc=_0x694c[_0x1162c0];return _0x44f3cc;};'use strict';var EventEmitter=require(_0xc694('0x0'));var ChatInternalMessage=require(_0xc694('0x1'))['db'][_0xc694('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xc694('0x3')](0x0);var events={'afterCreate':_0xc694('0x4'),'afterUpdate':_0xc694('0x5'),'afterDestroy':_0xc694('0x6')};function emitEvent(_0x366bb8){return function(_0x4d08a2,_0x42757d,_0x5c1312){ChatInternalMessageEvents[_0xc694('0x7')](_0x366bb8+':'+_0x4d08a2['id'],_0x4d08a2);ChatInternalMessageEvents[_0xc694('0x7')](_0x366bb8,_0x4d08a2);_0x5c1312(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index f8bb3d9..18c6eda 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 _0xb368=['bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb368,0x163));var _0x8b36=function(_0x301070,_0x19234d){_0x301070=_0x301070-0x0;var _0x448401=_0xb368[_0x301070];return _0x448401;};'use strict';var _=require(_0x8b36('0x0'));var util=require(_0x8b36('0x1'));var logger=require(_0x8b36('0x2'))(_0x8b36('0x3'));var moment=require(_0x8b36('0x4'));var BPromise=require(_0x8b36('0x5'));var rp=require(_0x8b36('0x6'));var fs=require('fs');var path=require(_0x8b36('0x7'));var rimraf=require(_0x8b36('0x8'));var config=require('../../config/environment');var attributes=require(_0x8b36('0x9'));module[_0x8b36('0xa')]=function(_0x399670,_0xd15327){return _0x399670[_0x8b36('0xb')](_0x8b36('0xc'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8b36('0xd'),'collate':_0x8b36('0xe')});}; \ No newline at end of file +var _0x25b6=['exports','define','chat_internal_messages','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path','../../config/environment'];(function(_0x39ff91,_0xf461d7){var _0x151d12=function(_0x55935f){while(--_0x55935f){_0x39ff91['push'](_0x39ff91['shift']());}};_0x151d12(++_0xf461d7);}(_0x25b6,0x68));var _0x625b=function(_0x407b07,_0x525c69){_0x407b07=_0x407b07-0x0;var _0x2c9b12=_0x25b6[_0x407b07];return _0x2c9b12;};'use strict';var _=require(_0x625b('0x0'));var util=require('util');var logger=require(_0x625b('0x1'))(_0x625b('0x2'));var moment=require(_0x625b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x625b('0x4'));var rimraf=require('rimraf');var config=require(_0x625b('0x5'));var attributes=require('./chatInternalMessage.attributes');module[_0x625b('0x6')]=function(_0x2bba8d,_0x5800bb){return _0x2bba8d[_0x625b('0x7')]('ChatInternalMessage',attributes,{'tableName':_0x625b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x625b('0x9')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index d699711..4d1cf86 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 _0x3003=['jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/environment'];(function(_0x545f50,_0x179fdb){var _0x5ea732=function(_0x1cbf15){while(--_0x1cbf15){_0x545f50['push'](_0x545f50['shift']());}};_0x5ea732(++_0x179fdb);}(_0x3003,0x14a));var _0x3300=function(_0x34e610,_0x3816f3){_0x34e610=_0x34e610-0x0;var _0x48952f=_0x3003[_0x34e610];return _0x48952f;};'use strict';var _=require(_0x3300('0x0'));var util=require('util');var moment=require(_0x3300('0x1'));var BPromise=require(_0x3300('0x2'));var rs=require(_0x3300('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3300('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x3300('0x5'));var jayson=require(_0x3300('0x6'));var client=jayson[_0x3300('0x7')][_0x3300('0x8')]({'port':0x232a});config[_0x3300('0x9')]=_[_0x3300('0xa')](config[_0x3300('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3300('0xb'))(new Redis(config[_0x3300('0x9')]));require(_0x3300('0xc'))['register'](socket);function respondWithRpcPromise(_0x597938,_0x4c0b35,_0x24bad3){return new BPromise(function(_0x2d36fc,_0x3297a3){return client['request'](_0x597938,_0x24bad3)[_0x3300('0xd')](function(_0x2b62ad){logger[_0x3300('0xe')](_0x3300('0xf'),_0x4c0b35,_0x3300('0x10'));logger[_0x3300('0x11')](_0x3300('0x12'),_0x4c0b35,'request\x20sent',JSON[_0x3300('0x13')](_0x2b62ad));if(_0x2b62ad[_0x3300('0x14')]){if(_0x2b62ad[_0x3300('0x14')][_0x3300('0x15')]===0x1f4){logger[_0x3300('0x14')](_0x3300('0xf'),_0x4c0b35,_0x2b62ad[_0x3300('0x14')][_0x3300('0x16')]);return _0x3297a3(_0x2b62ad[_0x3300('0x14')]['message']);}logger[_0x3300('0x14')](_0x3300('0xf'),_0x4c0b35,_0x2b62ad[_0x3300('0x14')]['message']);return _0x2d36fc(_0x2b62ad[_0x3300('0x14')][_0x3300('0x16')]);}else{logger[_0x3300('0xe')](_0x3300('0xf'),_0x4c0b35,'request\x20sent');_0x2d36fc(_0x2b62ad[_0x3300('0x17')][_0x3300('0x16')]);}})['catch'](function(_0x41fc03){logger['error'](_0x3300('0xf'),_0x4c0b35,_0x41fc03);_0x3297a3(_0x41fc03);});});} \ No newline at end of file +var _0x9d5d=['jayson/promise','client','redis','localhost','socket.io-emitter','request','info','request\x20sent','debug','stringify','error','code','message','ChatInternalMessage,\x20%s,\x20%s','result','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5e7ee9,_0x4dbc4b){var _0xadb900=function(_0x5eecb3){while(--_0x5eecb3){_0x5e7ee9['push'](_0x5e7ee9['shift']());}};_0xadb900(++_0x4dbc4b);}(_0x9d5d,0x1dd));var _0xd9d5=function(_0x2b4557,_0x1fb9a8){_0x2b4557=_0x2b4557-0x0;var _0xdd4472=_0x9d5d[_0x2b4557];return _0xdd4472;};'use strict';var _=require(_0xd9d5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9d5('0x1'));var db=require(_0xd9d5('0x2'))['db'];var utils=require(_0xd9d5('0x3'));var logger=require(_0xd9d5('0x4'))('rpc');var config=require(_0xd9d5('0x5'));var jayson=require(_0xd9d5('0x6'));var client=jayson[_0xd9d5('0x7')]['http']({'port':0x232a});config[_0xd9d5('0x8')]=_['defaults'](config[_0xd9d5('0x8')],{'host':_0xd9d5('0x9'),'port':0x18eb});var socket=require(_0xd9d5('0xa'))(new Redis(config[_0xd9d5('0x8')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x5481d0,_0x192f7d,_0x39a75f){return new BPromise(function(_0x205ea9,_0x378594){return client[_0xd9d5('0xb')](_0x5481d0,_0x39a75f)['then'](function(_0x5c3e67){logger[_0xd9d5('0xc')]('ChatInternalMessage,\x20%s,\x20%s',_0x192f7d,_0xd9d5('0xd'));logger[_0xd9d5('0xe')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x192f7d,_0xd9d5('0xd'),JSON[_0xd9d5('0xf')](_0x5c3e67));if(_0x5c3e67[_0xd9d5('0x10')]){if(_0x5c3e67[_0xd9d5('0x10')][_0xd9d5('0x11')]===0x1f4){logger[_0xd9d5('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x192f7d,_0x5c3e67[_0xd9d5('0x10')][_0xd9d5('0x12')]);return _0x378594(_0x5c3e67[_0xd9d5('0x10')][_0xd9d5('0x12')]);}logger['error'](_0xd9d5('0x13'),_0x192f7d,_0x5c3e67[_0xd9d5('0x10')]['message']);return _0x205ea9(_0x5c3e67[_0xd9d5('0x10')]['message']);}else{logger['info'](_0xd9d5('0x13'),_0x192f7d,_0xd9d5('0xd'));_0x205ea9(_0x5c3e67[_0xd9d5('0x14')][_0xd9d5('0x12')]);}})['catch'](function(_0x2cff32){logger[_0xd9d5('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x192f7d,_0x2cff32);_0x378594(_0x2cff32);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 621b3e6..d6353c3 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 _0x2c66=['update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2c66,0x189));var _0x62c6=function(_0x5e515c,_0x3319a7){_0x5e515c=_0x5e515c-0x0;var _0x4f3109=_0x2c66[_0x5e515c];return _0x4f3109;};'use strict';var ChatInternalMessageEvents=require(_0x62c6('0x0'));var events=[_0x62c6('0x1'),_0x62c6('0x2'),_0x62c6('0x3')];function createListener(_0x495682,_0x51fa58){return function(_0x34ccad){_0x51fa58[_0x62c6('0x4')](_0x495682,_0x34ccad);};}function removeListener(_0x3829c6,_0x3af484){return function(){ChatInternalMessageEvents[_0x62c6('0x5')](_0x3829c6,_0x3af484);};}exports[_0x62c6('0x6')]=function(_0x1d12e5){for(var _0x4483f5=0x0,_0x2d3396=events[_0x62c6('0x7')];_0x4483f5<_0x2d3396;_0x4483f5++){var _0x1e169d=events[_0x4483f5];var _0x4352d1=createListener(_0x62c6('0x8')+_0x1e169d,_0x1d12e5);ChatInternalMessageEvents['on'](_0x1e169d,_0x4352d1);}}; \ No newline at end of file +var _0x0e02=['length','chatInternalMessage:','save','update','emit','removeListener'];(function(_0x385877,_0x5282cc){var _0x1784f4=function(_0x42ec32){while(--_0x42ec32){_0x385877['push'](_0x385877['shift']());}};_0x1784f4(++_0x5282cc);}(_0x0e02,0x128));var _0x20e0=function(_0x3c0a26,_0x3ba561){_0x3c0a26=_0x3c0a26-0x0;var _0x49cb9a=_0x0e02[_0x3c0a26];return _0x49cb9a;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x20e0('0x0'),'remove',_0x20e0('0x1')];function createListener(_0x332e7f,_0x36576c){return function(_0x2da71d){_0x36576c[_0x20e0('0x2')](_0x332e7f,_0x2da71d);};}function removeListener(_0x360f24,_0x282d42){return function(){ChatInternalMessageEvents[_0x20e0('0x3')](_0x360f24,_0x282d42);};}exports['register']=function(_0x1c3707){for(var _0x96f20f=0x0,_0x2f35a8=events[_0x20e0('0x4')];_0x96f20f<_0x2f35a8;_0x96f20f++){var _0x18fa6d=events[_0x96f20f];var _0x52e009=createListener(_0x20e0('0x5')+_0x18fa6d,_0x1c3707);ChatInternalMessageEvents['on'](_0x18fa6d,_0x52e009);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 5949b7e..bb59dd1 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 _0xdde7=['/describe','describe','/users','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index'];(function(_0x21551e,_0x43a045){var _0x4f3cda=function(_0x58b22c){while(--_0x58b22c){_0x21551e['push'](_0x21551e['shift']());}};_0x4f3cda(++_0x43a045);}(_0xdde7,0x11e));var _0x7dde=function(_0x57e196,_0x428408){_0x57e196=_0x57e196-0x0;var _0x5941ab=_0xdde7[_0x57e196];return _0x5941ab;};'use strict';var multer=require(_0x7dde('0x0'));var util=require(_0x7dde('0x1'));var path=require(_0x7dde('0x2'));var timeout=require(_0x7dde('0x3'));var express=require(_0x7dde('0x4'));var router=express[_0x7dde('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7dde('0x6'));var interaction=require(_0x7dde('0x7'));var config=require(_0x7dde('0x8'));var controller=require(_0x7dde('0x9'));router[_0x7dde('0xa')]('/',auth[_0x7dde('0xb')](),controller[_0x7dde('0xc')]);router[_0x7dde('0xa')](_0x7dde('0xd'),auth[_0x7dde('0xb')](),controller[_0x7dde('0xe')]);router[_0x7dde('0xa')](_0x7dde('0xf'),auth[_0x7dde('0xb')](),controller['getUsers']);router[_0x7dde('0xa')](_0x7dde('0x10'),auth[_0x7dde('0xb')](),controller[_0x7dde('0x11')]);router[_0x7dde('0x12')]('/',auth[_0x7dde('0xb')](),controller[_0x7dde('0x13')]);router['put'](_0x7dde('0x10'),controller[_0x7dde('0x14')]);router['delete'](_0x7dde('0x10'),auth[_0x7dde('0xb')](),controller[_0x7dde('0x15')]);module[_0x7dde('0x16')]=router; \ No newline at end of file +var _0x730d=['describe','/users','getUsers','/:id','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index'];(function(_0xe8a6a,_0x389e7d){var _0x3bc3e0=function(_0x15a311){while(--_0x15a311){_0xe8a6a['push'](_0xe8a6a['shift']());}};_0x3bc3e0(++_0x389e7d);}(_0x730d,0x115));var _0xd730=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x730d[_0x1d9aa0];return _0x226868;};'use strict';var multer=require(_0xd730('0x0'));var util=require('util');var path=require(_0xd730('0x1'));var timeout=require(_0xd730('0x2'));var express=require(_0xd730('0x3'));var router=express[_0xd730('0x4')]();var fs_extra=require(_0xd730('0x5'));var auth=require(_0xd730('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd730('0x7'));var controller=require(_0xd730('0x8'));router[_0xd730('0x9')]('/',auth[_0xd730('0xa')](),controller[_0xd730('0xb')]);router[_0xd730('0x9')]('/describe',auth[_0xd730('0xa')](),controller[_0xd730('0xc')]);router[_0xd730('0x9')](_0xd730('0xd'),auth['isAuthenticated'](),controller[_0xd730('0xe')]);router[_0xd730('0x9')](_0xd730('0xf'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xd730('0xa')](),controller['create']);router['put'](_0xd730('0xf'),controller['update']);router[_0xd730('0x10')](_0xd730('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 486576b..c916e5a 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 _0xa5fa=['ENUM','out','DATE','STRING','exports','TEXT','medium','BOOLEAN'];(function(_0x3de4f8,_0x336c7d){var _0x3d81fc=function(_0x53b9f9){while(--_0x53b9f9){_0x3de4f8['push'](_0x3de4f8['shift']());}};_0x3d81fc(++_0x336c7d);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x1e8e81,_0x240af8){_0x1e8e81=_0x1e8e81-0x0;var _0x583bcd=_0xa5fa[_0x1e8e81];return _0x583bcd;};'use strict';var Sequelize=require('sequelize');module[_0xaa5f('0x0')]={'body':{'type':Sequelize[_0xaa5f('0x1')](_0xaa5f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xaa5f('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xaa5f('0x4')]('in',_0xaa5f('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xaa5f('0x6')]},'providerName':{'type':Sequelize[_0xaa5f('0x7')]},'providerResponse':{'type':Sequelize[_0xaa5f('0x1')]}}; \ No newline at end of file +var _0x720e=['BOOLEAN','out','DATE','STRING','sequelize','exports','TEXT'];(function(_0x8559d4,_0x4d4346){var _0x54c7d5=function(_0x439e2f){while(--_0x439e2f){_0x8559d4['push'](_0x8559d4['shift']());}};_0x54c7d5(++_0x4d4346);}(_0x720e,0x1cb));var _0xe720=function(_0x297dcf,_0x448cf5){_0x297dcf=_0x297dcf-0x0;var _0xe1699b=_0x720e[_0x297dcf];return _0xe1699b;};'use strict';var Sequelize=require(_0xe720('0x0'));module[_0xe720('0x1')]={'body':{'type':Sequelize[_0xe720('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xe720('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe720('0x4')),'defaultValue':_0xe720('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe720('0x5')]},'providerName':{'type':Sequelize[_0xe720('0x6')]},'providerResponse':{'type':Sequelize[_0xe720('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 78160dc..734c4d4 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 _0x7e26=['[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','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','agent','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','chat-interactions','get','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','options','includeAll','ChatMessage','rows','params','include','merge','find','create','body','destroy','describe','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','ChatInteraction','read1stAt','interaction'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7e26,0x1af));var _0x67e2=function(_0x59c9bc,_0x4552b6){_0x59c9bc=_0x59c9bc-0x0;var _0x571f74=_0x7e26[_0x59c9bc];return _0x571f74;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x67e2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x67e2('0x1'));var rp=require('request-promise');var moment=require(_0x67e2('0x2'));var BPromise=require(_0x67e2('0x3'));var Mustache=require('mustache');var util=require(_0x67e2('0x4'));var path=require('path');var sox=require(_0x67e2('0x5'));var csv=require(_0x67e2('0x6'));var ejs=require(_0x67e2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x67e2('0x8'));var squel=require(_0x67e2('0x9'));var crypto=require(_0x67e2('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x67e2('0xb'));var toCsv=require(_0x67e2('0x6'));var querystring=require(_0x67e2('0xc'));var Papa=require(_0x67e2('0xd'));var Redis=require(_0x67e2('0xe'));var authService=require(_0x67e2('0xf'));var qs=require(_0x67e2('0x10'));var as=require(_0x67e2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x67e2('0x12'))(_0x67e2('0x13'));var utils=require(_0x67e2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x67e2('0x15'));var db=require(_0x67e2('0x16'))['db'];config[_0x67e2('0x17')]=_[_0x67e2('0x18')](config[_0x67e2('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x67e2('0x19'))(new Redis(config['redis']));require(_0x67e2('0x1a'))[_0x67e2('0x1b')](socket);var jayson=require(_0x67e2('0x1c'));var client=jayson[_0x67e2('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x67e2('0x1d')][_0x67e2('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x502db6,_0x4e07b1,_0x1c0ea3,_0x25353e){return new BPromise(function(_0x3165b3,_0x15d877){var _0x1536be=_0x25353e||client;return _0x1536be[_0x67e2('0x1f')](_0x502db6,_0x1c0ea3)[_0x67e2('0x20')](function(_0x100606){logger['info'](_0x67e2('0x21'),_0x4e07b1,_0x67e2('0x22'));logger[_0x67e2('0x23')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x4e07b1,'request\x20sent',JSON[_0x67e2('0x24')](_0x100606));if(_0x100606[_0x67e2('0x25')]){if(_0x100606[_0x67e2('0x25')][_0x67e2('0x26')]===0x1f4){logger[_0x67e2('0x25')](_0x67e2('0x21'),_0x4e07b1,_0x100606[_0x67e2('0x25')][_0x67e2('0x27')]);return _0x15d877(_0x100606[_0x67e2('0x25')][_0x67e2('0x27')]);}logger[_0x67e2('0x25')](_0x67e2('0x21'),_0x4e07b1,_0x100606[_0x67e2('0x25')][_0x67e2('0x27')]);return _0x3165b3(_0x100606[_0x67e2('0x25')][_0x67e2('0x27')]);}else{logger[_0x67e2('0x28')](_0x67e2('0x21'),_0x4e07b1,_0x67e2('0x22'));_0x3165b3(_0x100606[_0x67e2('0x29')]['message']);}})[_0x67e2('0x2a')](function(_0x2d23bb){logger[_0x67e2('0x25')](_0x67e2('0x21'),_0x4e07b1,_0x2d23bb);_0x15d877(_0x2d23bb);});});}function respondWithStatusCode(_0x21998b,_0x48d6a4){_0x48d6a4=_0x48d6a4||0xcc;return function(_0x150886){if(_0x150886){return _0x21998b[_0x67e2('0x2b')](_0x48d6a4);}return _0x21998b[_0x67e2('0x2c')](_0x48d6a4)[_0x67e2('0x2d')]();};}function respondWithResult(_0x37a739,_0x1729b3){_0x1729b3=_0x1729b3||0xc8;return function(_0x7b25a){if(_0x7b25a){return _0x37a739[_0x67e2('0x2c')](_0x1729b3)[_0x67e2('0x2e')](_0x7b25a);}};}function respondWithFilteredResult(_0x117fa8,_0x3c4e86){return function(_0x5e4497){if(_0x5e4497){var _0x32e5f1=typeof _0x3c4e86[_0x67e2('0x2f')]===_0x67e2('0x30')&&typeof _0x3c4e86[_0x67e2('0x31')]==='undefined';var _0x4ae5e1=_0x5e4497[_0x67e2('0x32')];var _0x5e6109=_0x32e5f1?0x0:_0x3c4e86[_0x67e2('0x2f')];var _0x30ddad=_0x32e5f1?_0x5e4497[_0x67e2('0x32')]:_0x3c4e86['offset']+_0x3c4e86['limit'];var _0x2534f7;if(_0x30ddad>=_0x4ae5e1){_0x30ddad=_0x4ae5e1;_0x2534f7=0xc8;}else{_0x2534f7=0xce;}_0x117fa8[_0x67e2('0x2c')](_0x2534f7);return _0x117fa8[_0x67e2('0x33')](_0x67e2('0x34'),_0x5e6109+'-'+_0x30ddad+'/'+_0x4ae5e1)[_0x67e2('0x2e')](_0x5e4497);}return null;};}function patchUpdates(_0x231c64){return function(_0x19ee66){try{jsonpatch[_0x67e2('0x35')](_0x19ee66,_0x231c64,!![]);}catch(_0x45c34e){return BPromise[_0x67e2('0x36')](_0x45c34e);}return _0x19ee66[_0x67e2('0x37')]();};}function saveUpdates(_0x4012f4,_0x35a17f){return function(_0x3b5b46){if(_0x3b5b46){return _0x3b5b46[_0x67e2('0x38')](_0x4012f4)[_0x67e2('0x20')](function(_0x22bb73){return _0x22bb73;});}return null;};}function removeEntity(_0x2dd7f1,_0x1cd61b){return function(_0x22ef49){if(_0x22ef49){return _0x22ef49['destroy']()[_0x67e2('0x20')](function(){_0x2dd7f1[_0x67e2('0x2c')](0xcc)[_0x67e2('0x2d')]();});}};}function handleEntityNotFound(_0x5d76f8,_0x2d8a12){return function(_0x4ba9fd){if(!_0x4ba9fd){_0x5d76f8[_0x67e2('0x2b')](0x194);}return _0x4ba9fd;};}function handleError(_0xf211b0,_0x32a146){_0x32a146=_0x32a146||0x1f4;return function(_0x2d13cc){logger[_0x67e2('0x25')](_0x2d13cc['stack']);if(_0x2d13cc[_0x67e2('0x39')]){delete _0x2d13cc['name'];}_0xf211b0[_0x67e2('0x2c')](_0x32a146)[_0x67e2('0x3a')](_0x2d13cc);};}exports[_0x67e2('0x3b')]=function(_0x958823,_0x398a89){var _0x14f8a1={},_0x284367={},_0x34d0ee={'count':0x0,'rows':[]};var _0x3527f7=_[_0x67e2('0x3c')](db['ChatMessage'][_0x67e2('0x3d')],function(_0x47f275){return{'name':_0x47f275[_0x67e2('0x3e')],'type':_0x47f275[_0x67e2('0x3f')][_0x67e2('0x40')]};});_0x284367[_0x67e2('0x41')]=_[_0x67e2('0x3c')](_0x3527f7,_0x67e2('0x39'));_0x284367['query']=_[_0x67e2('0x42')](_0x958823['query']);_0x284367['filters']=_[_0x67e2('0x43')](_0x284367[_0x67e2('0x41')],_0x284367[_0x67e2('0x44')]);_0x14f8a1[_0x67e2('0x45')]=_[_0x67e2('0x43')](_0x284367[_0x67e2('0x41')],qs[_0x67e2('0x46')](_0x958823['query']['fields']));_0x14f8a1[_0x67e2('0x45')]=_0x14f8a1[_0x67e2('0x45')][_0x67e2('0x47')]?_0x14f8a1[_0x67e2('0x45')]:_0x284367['model'];if(!_0x958823[_0x67e2('0x44')][_0x67e2('0x48')](_0x67e2('0x49'))){_0x14f8a1[_0x67e2('0x31')]=qs[_0x67e2('0x31')](_0x958823[_0x67e2('0x44')][_0x67e2('0x31')]);_0x14f8a1['offset']=qs[_0x67e2('0x2f')](_0x958823['query'][_0x67e2('0x2f')]);}_0x14f8a1[_0x67e2('0x4a')]=qs[_0x67e2('0x4b')](_0x958823[_0x67e2('0x44')]['sort']);_0x14f8a1[_0x67e2('0x4c')]=qs[_0x67e2('0x4d')](_[_0x67e2('0x4e')](_0x958823[_0x67e2('0x44')],_0x284367['filters']),_0x3527f7);if(_0x958823[_0x67e2('0x44')][_0x67e2('0x4f')]){_0x14f8a1[_0x67e2('0x4c')]=_['merge'](_0x14f8a1[_0x67e2('0x4c')],{'$or':_[_0x67e2('0x3c')](_0x3527f7,function(_0x511918){if(_0x511918[_0x67e2('0x3f')]!=='VIRTUAL'){var _0x2f34e9={};_0x2f34e9[_0x511918[_0x67e2('0x39')]]={'$like':'%'+_0x958823[_0x67e2('0x44')][_0x67e2('0x4f')]+'%'};return _0x2f34e9;}})});}_0x14f8a1=_['merge']({},_0x14f8a1,_0x958823[_0x67e2('0x50')]);var _0x2ebe78={'where':_0x14f8a1[_0x67e2('0x4c')]};return db['ChatMessage'][_0x67e2('0x32')](_0x2ebe78)[_0x67e2('0x20')](function(_0x4302db){_0x34d0ee[_0x67e2('0x32')]=_0x4302db;if(_0x958823[_0x67e2('0x44')][_0x67e2('0x51')]){_0x14f8a1['include']=[{'all':!![]}];}return db[_0x67e2('0x52')]['findAll'](_0x14f8a1);})[_0x67e2('0x20')](function(_0xe75fb0){_0x34d0ee[_0x67e2('0x53')]=_0xe75fb0;return _0x34d0ee;})['then'](respondWithFilteredResult(_0x398a89,_0x14f8a1))[_0x67e2('0x2a')](handleError(_0x398a89,null));};exports['show']=function(_0x178f09,_0x25d242){var _0x22fb7e={'raw':!![],'where':{'id':_0x178f09[_0x67e2('0x54')]['id']}},_0x4109db={};_0x4109db[_0x67e2('0x41')]=_['keys'](db[_0x67e2('0x52')][_0x67e2('0x3d')]);_0x4109db[_0x67e2('0x44')]=_[_0x67e2('0x42')](_0x178f09[_0x67e2('0x44')]);_0x4109db[_0x67e2('0x4d')]=_['intersection'](_0x4109db['model'],_0x4109db['query']);_0x22fb7e[_0x67e2('0x45')]=_[_0x67e2('0x43')](_0x4109db[_0x67e2('0x41')],qs['fields'](_0x178f09['query'][_0x67e2('0x46')]));_0x22fb7e[_0x67e2('0x45')]=_0x22fb7e[_0x67e2('0x45')][_0x67e2('0x47')]?_0x22fb7e[_0x67e2('0x45')]:_0x4109db[_0x67e2('0x41')];if(_0x178f09[_0x67e2('0x44')][_0x67e2('0x51')]){_0x22fb7e[_0x67e2('0x55')]=[{'all':!![]}];}_0x22fb7e=_[_0x67e2('0x56')]({},_0x22fb7e,_0x178f09[_0x67e2('0x50')]);return db[_0x67e2('0x52')][_0x67e2('0x57')](_0x22fb7e)[_0x67e2('0x20')](handleEntityNotFound(_0x25d242,null))[_0x67e2('0x20')](respondWithResult(_0x25d242,null))[_0x67e2('0x2a')](handleError(_0x25d242,null));};exports[_0x67e2('0x58')]=function(_0x4d2caf,_0x5b592a){return db[_0x67e2('0x52')][_0x67e2('0x58')](_0x4d2caf[_0x67e2('0x59')],{})['then'](respondWithResult(_0x5b592a,0xc9))[_0x67e2('0x2a')](handleError(_0x5b592a,null));};exports[_0x67e2('0x38')]=function(_0x3eea37,_0x22b921){if(_0x3eea37[_0x67e2('0x59')]['id']){delete _0x3eea37[_0x67e2('0x59')]['id'];}return db[_0x67e2('0x52')]['find']({'where':{'id':_0x3eea37[_0x67e2('0x54')]['id']}})['then'](handleEntityNotFound(_0x22b921,null))[_0x67e2('0x20')](saveUpdates(_0x3eea37[_0x67e2('0x59')],null))['then'](respondWithResult(_0x22b921,null))[_0x67e2('0x2a')](handleError(_0x22b921,null));};exports[_0x67e2('0x5a')]=function(_0x4f3d19,_0x47d6f5){return db[_0x67e2('0x52')]['find']({'where':{'id':_0x4f3d19['params']['id']}})['then'](handleEntityNotFound(_0x47d6f5,null))['then'](removeEntity(_0x47d6f5,null))['catch'](handleError(_0x47d6f5,null));};exports['describe']=function(_0x2cd5fd,_0x531e1c){return db[_0x67e2('0x52')][_0x67e2('0x5b')]()[_0x67e2('0x20')](respondWithResult(_0x531e1c,null))[_0x67e2('0x2a')](handleError(_0x531e1c,null));};var interaction_log=require(_0x67e2('0x12'))('chat-interactions');exports[_0x67e2('0x5c')]=function(_0x598450,_0x4785f2,_0x4d6049){var _0x4c6842={'agent':{},'channel':_0x67e2('0x5d')};if(_0x598450['body']['id']){delete _0x598450[_0x67e2('0x59')]['id'];}_0x598450[_0x67e2('0x59')]['read']=!![];_0x598450[_0x67e2('0x59')][_0x67e2('0x5e')]=moment()[_0x67e2('0x5f')](_0x67e2('0x60'));_0x598450[_0x67e2('0x59')][_0x67e2('0x61')]=_0x598450['body']['UserId']||_0x598450['user']['id'];_0x4c6842['agent']['id']=_0x598450[_0x67e2('0x59')][_0x67e2('0x61')];return db[_0x67e2('0x52')]['find']({'where':{'id':_0x598450[_0x67e2('0x54')]['id'],'UserId':null}})[_0x67e2('0x20')](handleEntityNotFound(_0x4785f2,null))[_0x67e2('0x20')](saveUpdates(_0x598450[_0x67e2('0x59')],null))['then'](function(_0x568650){if(_0x568650){_0x4c6842[_0x67e2('0x27')]=_0x568650['get']({'plain':!![]});return db[_0x67e2('0x62')][_0x67e2('0x57')]({'where':{'id':_0x568650['ChatInteractionId']}});}return null;})[_0x67e2('0x20')](handleEntityNotFound(_0x4785f2,null))[_0x67e2('0x20')](function(_0x1c8ef4){if(_0x1c8ef4){return _0x1c8ef4[_0x67e2('0x38')]({'UserId':_0x598450[_0x67e2('0x59')]['UserId'],'read1stAt':_['isNil'](_0x1c8ef4[_0x67e2('0x63')])?moment()['format'](_0x67e2('0x60')):undefined});}return null;})['then'](function(_0x273ef4){if(_0x273ef4){_0x4c6842[_0x67e2('0x64')]=_0x273ef4['get']({'plain':!![]});interaction_log[_0x67e2('0x28')](_0x67e2('0x65'),_0x598450[_0x67e2('0x66')]['id'],_0x598450[_0x67e2('0x66')][_0x67e2('0x39')],_0x598450['user'][_0x67e2('0x67')],_0x4c6842[_0x67e2('0x64')]['id'],_0x598450['body']?JSON[_0x67e2('0x24')](_0x598450[_0x67e2('0x59')]):_0x67e2('0x68'));return respondWithRpcPromise(_0x67e2('0x69'),_0x67e2('0x6a'),_0x4c6842);}return null;})['then'](function(_0x390149){var _0x53eef8=_0x67e2('0x6b')+_0x390149[_0x67e2('0x27')][_0x67e2('0x6c')];return db['sequelize'][_0x67e2('0x44')](_0x53eef8,{'type':db[_0x67e2('0x6d')][_0x67e2('0x6e')][_0x67e2('0x6f')],'raw':!![]})[_0x67e2('0x20')](function(_0x2704ae){return _0x2704ae;});})[_0x67e2('0x20')](function(_0x37f928){if(_0x37f928){_0x4c6842['message'][_0x67e2('0x70')]=_0x37f928[0x0];if(!_0x598450[_0x67e2('0x59')]['UserId'])return;return db['User'][_0x67e2('0x57')]({'where':{'id':_0x598450[_0x67e2('0x59')]['UserId'],'role':'agent'},'attributes':['id',_0x67e2('0x39'),_0x67e2('0x71'),_0x67e2('0x72'),_0x67e2('0x73')],'raw':!![]});}return null;})['then'](function(_0xafd8af){if(!_0xafd8af)return null;_0x4c6842[_0x67e2('0x27')][_0x67e2('0x74')]=_0xafd8af;return _0x4c6842;})[_0x67e2('0x20')](function(_0x2ece21){if(_0x2ece21){if(_0x598450[_0x67e2('0x59')][_0x67e2('0x75')]){_0x4c6842[_0x67e2('0x27')][_0x67e2('0x76')]=util['format'](_0x67e2('0x77'),_0x598450['user']['name']);_0x4c6842[_0x67e2('0x27')][_0x67e2('0x78')]=_0x4c6842[_0x67e2('0x78')];_0x4c6842[_0x67e2('0x27')][_0x67e2('0x79')]=_0x4c6842[_0x67e2('0x78')];_0x4c6842[_0x67e2('0x27')][_0x67e2('0x7a')]='accept';return respondWithRpcPromise(_0x67e2('0x7b'),_0x67e2('0x7b'),{'event':_0x67e2('0x7c'),'message':_['merge'](_0x4c6842['message'],JSON[_0x67e2('0x7d')](_0x4c6842[_0x67e2('0x64')][_0x67e2('0x7e')]))},client9002)[_0x67e2('0x20')](function(){return _0x4c6842;});}return _0x4c6842;}return null;})[_0x67e2('0x20')](respondWithResult(_0x4785f2,null))[_0x67e2('0x2a')](handleError(_0x4785f2,null));};var interaction_log=require(_0x67e2('0x12'))(_0x67e2('0x7f'));exports['reject']=function(_0x4691d1,_0x266495,_0x31f115){var _0x48c9e={'agent':{},'channel':_0x67e2('0x5d')};if(_0x4691d1['body']['id']){delete _0x4691d1['body']['id'];}_0x4691d1['body'][_0x67e2('0x61')]=_0x4691d1[_0x67e2('0x59')][_0x67e2('0x61')]||_0x4691d1[_0x67e2('0x66')]['id'];_0x48c9e[_0x67e2('0x74')]['id']=_0x4691d1['body'][_0x67e2('0x61')];return db['ChatMessage'][_0x67e2('0x57')]({'where':{'id':_0x4691d1['params']['id'],'UserId':null}})[_0x67e2('0x20')](handleEntityNotFound(_0x266495,null))[_0x67e2('0x20')](function(_0x57d2ef){if(_0x57d2ef){_0x48c9e[_0x67e2('0x27')]=_0x57d2ef[_0x67e2('0x80')]({'plain':!![]});return db[_0x67e2('0x62')][_0x67e2('0x57')]({'where':{'id':_0x57d2ef[_0x67e2('0x81')]}});}return null;})['then'](handleEntityNotFound(_0x266495,null))[_0x67e2('0x20')](function(_0x3d12c2){if(_0x3d12c2){_0x48c9e[_0x67e2('0x64')]=_0x3d12c2[_0x67e2('0x80')]({'plain':!![]});interaction_log[_0x67e2('0x28')](_0x67e2('0x82'),_0x4691d1[_0x67e2('0x66')]['id'],_0x4691d1[_0x67e2('0x66')][_0x67e2('0x39')],_0x4691d1[_0x67e2('0x66')][_0x67e2('0x67')],_0x48c9e[_0x67e2('0x64')]['id'],_0x4691d1[_0x67e2('0x59')]?JSON[_0x67e2('0x24')](_0x4691d1[_0x67e2('0x59')]):_0x67e2('0x68'));return respondWithRpcPromise('RejectMessage',_0x67e2('0x83'),_0x48c9e);}return null;})[_0x67e2('0x20')](function(_0xc12d6d){var _0x5183ff=_0x67e2('0x6b')+_0xc12d6d[_0x67e2('0x27')][_0x67e2('0x6c')];return db[_0x67e2('0x84')][_0x67e2('0x44')](_0x5183ff,{'type':db[_0x67e2('0x6d')][_0x67e2('0x6e')][_0x67e2('0x6f')],'raw':!![]})[_0x67e2('0x20')](function(_0x4510d5){return _0x4510d5;});})[_0x67e2('0x20')](function(_0x4e35df){if(_0x4e35df){_0x48c9e[_0x67e2('0x27')]['contact']=_0x4e35df[0x0];if(!_0x4691d1[_0x67e2('0x59')][_0x67e2('0x61')])return;return db['User'][_0x67e2('0x57')]({'where':{'id':_0x4691d1[_0x67e2('0x59')][_0x67e2('0x61')],'role':_0x67e2('0x74')},'attributes':['id','name',_0x67e2('0x71'),'email',_0x67e2('0x73')],'raw':!![]});}return null;})[_0x67e2('0x20')](function(_0x380c07){if(!_0x380c07)return null;_0x48c9e['message'][_0x67e2('0x74')]=_0x380c07;return _0x48c9e;})[_0x67e2('0x20')](function(_0x48351f){if(_0x48351f){_0x48351f['message'][_0x67e2('0x76')]=util['format'](_0x67e2('0x77'),_0x4691d1[_0x67e2('0x66')][_0x67e2('0x39')]);_0x48351f[_0x67e2('0x27')][_0x67e2('0x78')]=_0x48c9e['channel'];_0x48351f['message'][_0x67e2('0x79')]=_0x48c9e[_0x67e2('0x78')];_0x48351f[_0x67e2('0x27')][_0x67e2('0x7a')]=_0x67e2('0x36');respondWithRpcPromise('EventManager',_0x67e2('0x7b'),{'event':'rejectmessage','message':_[_0x67e2('0x56')](_0x48c9e[_0x67e2('0x27')],JSON[_0x67e2('0x7d')](_0x48c9e[_0x67e2('0x64')][_0x67e2('0x7e')]))},client9002);return _0x48c9e;}return null;})[_0x67e2('0x20')](respondWithResult(_0x266495,null))[_0x67e2('0x2a')](handleError(_0x266495,null));}; \ No newline at end of file +var _0x69cf=['count','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','params','intersection','options','find','create','body','describe','chat-interactions','accept','chat','read','readAt','UserId','user','agent','get','ChatInteraction','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','info','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','email','manual','interface','channel','event','EventManager','acceptmessage','parse','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','fullname','SIP/%s','motionChannel','formData','rimraf','zip-dir','request-promise','moment','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','../../mysqldb','defaults','redis','localhost','./chatMessage.socket','register','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x5a19fc,_0x3e578d){var _0x48aaa9=function(_0x405887){while(--_0x405887){_0x5a19fc['push'](_0x5a19fc['shift']());}};_0x48aaa9(++_0x3e578d);}(_0x69cf,0x164));var _0xf69c=function(_0x5dc7bb,_0x3c2edc){_0x5dc7bb=_0x5dc7bb-0x0;var _0x3569c3=_0x69cf[_0x5dc7bb];return _0x3569c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf69c('0x0'));var zipdir=require(_0xf69c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf69c('0x2'));var moment=require(_0xf69c('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf69c('0x4'));var sox=require(_0xf69c('0x5'));var csv=require(_0xf69c('0x6'));var ejs=require(_0xf69c('0x7'));var fs=require('fs');var fs_extra=require(_0xf69c('0x8'));var _=require(_0xf69c('0x9'));var squel=require(_0xf69c('0xa'));var crypto=require(_0xf69c('0xb'));var jsforce=require(_0xf69c('0xc'));var deskjs=require(_0xf69c('0xd'));var toCsv=require(_0xf69c('0x6'));var querystring=require(_0xf69c('0xe'));var Papa=require(_0xf69c('0xf'));var Redis=require(_0xf69c('0x10'));var authService=require(_0xf69c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf69c('0x12'));var hardwareService=require(_0xf69c('0x13'));var logger=require(_0xf69c('0x14'))(_0xf69c('0x15'));var utils=require(_0xf69c('0x16'));var config=require(_0xf69c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf69c('0x18'))['db'];config['redis']=_[_0xf69c('0x19')](config[_0xf69c('0x1a')],{'host':_0xf69c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf69c('0x1a')]));require(_0xf69c('0x1c'))[_0xf69c('0x1d')](socket);var jayson=require(_0xf69c('0x1e'));var client=jayson[_0xf69c('0x1f')][_0xf69c('0x20')]({'port':0x232c});var client9002=jayson[_0xf69c('0x1f')][_0xf69c('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x357a26,_0x3811c1,_0x5e1126,_0x4e19f5){return new BPromise(function(_0x171a4e,_0x486b39){var _0xa10b90=_0x4e19f5||client;return _0xa10b90[_0xf69c('0x21')](_0x357a26,_0x5e1126)[_0xf69c('0x22')](function(_0xbbe86){logger['info'](_0xf69c('0x23'),_0x3811c1,_0xf69c('0x24'));logger[_0xf69c('0x25')](_0xf69c('0x26'),_0x3811c1,_0xf69c('0x24'),JSON[_0xf69c('0x27')](_0xbbe86));if(_0xbbe86[_0xf69c('0x28')]){if(_0xbbe86[_0xf69c('0x28')][_0xf69c('0x29')]===0x1f4){logger[_0xf69c('0x28')](_0xf69c('0x23'),_0x3811c1,_0xbbe86[_0xf69c('0x28')][_0xf69c('0x2a')]);return _0x486b39(_0xbbe86[_0xf69c('0x28')][_0xf69c('0x2a')]);}logger[_0xf69c('0x28')]('ChatMessage,\x20%s,\x20%s',_0x3811c1,_0xbbe86['error'][_0xf69c('0x2a')]);return _0x171a4e(_0xbbe86[_0xf69c('0x28')][_0xf69c('0x2a')]);}else{logger['info'](_0xf69c('0x23'),_0x3811c1,_0xf69c('0x24'));_0x171a4e(_0xbbe86[_0xf69c('0x2b')][_0xf69c('0x2a')]);}})[_0xf69c('0x2c')](function(_0x4c41c3){logger[_0xf69c('0x28')](_0xf69c('0x23'),_0x3811c1,_0x4c41c3);_0x486b39(_0x4c41c3);});});}function respondWithStatusCode(_0x50b7c0,_0x161123){_0x161123=_0x161123||0xcc;return function(_0xa90fc2){if(_0xa90fc2){return _0x50b7c0[_0xf69c('0x2d')](_0x161123);}return _0x50b7c0['status'](_0x161123)[_0xf69c('0x2e')]();};}function respondWithResult(_0x27ddc6,_0x19bc89){_0x19bc89=_0x19bc89||0xc8;return function(_0x435608){if(_0x435608){return _0x27ddc6[_0xf69c('0x2f')](_0x19bc89)[_0xf69c('0x30')](_0x435608);}};}function respondWithFilteredResult(_0x9467d9,_0x354ad0){return function(_0x11cde6){if(_0x11cde6){var _0x422d42=typeof _0x354ad0[_0xf69c('0x31')]===_0xf69c('0x32')&&typeof _0x354ad0[_0xf69c('0x33')]===_0xf69c('0x32');var _0x5a34c9=_0x11cde6[_0xf69c('0x34')];var _0x1d2a18=_0x422d42?0x0:_0x354ad0[_0xf69c('0x31')];var _0x5105b5=_0x422d42?_0x11cde6[_0xf69c('0x34')]:_0x354ad0[_0xf69c('0x31')]+_0x354ad0['limit'];var _0x42a310;if(_0x5105b5>=_0x5a34c9){_0x5105b5=_0x5a34c9;_0x42a310=0xc8;}else{_0x42a310=0xce;}_0x9467d9[_0xf69c('0x2f')](_0x42a310);return _0x9467d9[_0xf69c('0x35')](_0xf69c('0x36'),_0x1d2a18+'-'+_0x5105b5+'/'+_0x5a34c9)[_0xf69c('0x30')](_0x11cde6);}return null;};}function patchUpdates(_0x51a9a3){return function(_0x2ac793){try{jsonpatch[_0xf69c('0x37')](_0x2ac793,_0x51a9a3,!![]);}catch(_0x4c81a3){return BPromise[_0xf69c('0x38')](_0x4c81a3);}return _0x2ac793['save']();};}function saveUpdates(_0xf85dda,_0x38598d){return function(_0x1dc795){if(_0x1dc795){return _0x1dc795[_0xf69c('0x39')](_0xf85dda)[_0xf69c('0x22')](function(_0x5791fd){return _0x5791fd;});}return null;};}function removeEntity(_0x243fe0,_0x33aaf7){return function(_0x2020ab){if(_0x2020ab){return _0x2020ab[_0xf69c('0x3a')]()[_0xf69c('0x22')](function(){_0x243fe0[_0xf69c('0x2f')](0xcc)[_0xf69c('0x2e')]();});}};}function handleEntityNotFound(_0x1ce154,_0x5c6a41){return function(_0x580934){if(!_0x580934){_0x1ce154[_0xf69c('0x2d')](0x194);}return _0x580934;};}function handleError(_0x3c9c33,_0x1a3276){_0x1a3276=_0x1a3276||0x1f4;return function(_0x55aee7){logger[_0xf69c('0x28')](_0x55aee7[_0xf69c('0x3b')]);if(_0x55aee7['name']){delete _0x55aee7[_0xf69c('0x3c')];}_0x3c9c33['status'](_0x1a3276)[_0xf69c('0x3d')](_0x55aee7);};}exports[_0xf69c('0x3e')]=function(_0x18b9d5,_0x42d0a9){var _0x185034={},_0x141161={},_0x25342d={'count':0x0,'rows':[]};var _0x588482=_[_0xf69c('0x3f')](db[_0xf69c('0x40')][_0xf69c('0x41')],function(_0x3afac4){return{'name':_0x3afac4[_0xf69c('0x42')],'type':_0x3afac4[_0xf69c('0x43')][_0xf69c('0x44')]};});_0x141161[_0xf69c('0x45')]=_[_0xf69c('0x3f')](_0x588482,_0xf69c('0x3c'));_0x141161[_0xf69c('0x46')]=_[_0xf69c('0x47')](_0x18b9d5[_0xf69c('0x46')]);_0x141161[_0xf69c('0x48')]=_['intersection'](_0x141161[_0xf69c('0x45')],_0x141161[_0xf69c('0x46')]);_0x185034[_0xf69c('0x49')]=_['intersection'](_0x141161[_0xf69c('0x45')],qs[_0xf69c('0x4a')](_0x18b9d5[_0xf69c('0x46')][_0xf69c('0x4a')]));_0x185034[_0xf69c('0x49')]=_0x185034['attributes'][_0xf69c('0x4b')]?_0x185034['attributes']:_0x141161[_0xf69c('0x45')];if(!_0x18b9d5[_0xf69c('0x46')][_0xf69c('0x4c')]('nolimit')){_0x185034['limit']=qs[_0xf69c('0x33')](_0x18b9d5[_0xf69c('0x46')][_0xf69c('0x33')]);_0x185034['offset']=qs['offset'](_0x18b9d5['query'][_0xf69c('0x31')]);}_0x185034[_0xf69c('0x4d')]=qs[_0xf69c('0x4e')](_0x18b9d5[_0xf69c('0x46')][_0xf69c('0x4e')]);_0x185034[_0xf69c('0x4f')]=qs['filters'](_[_0xf69c('0x50')](_0x18b9d5[_0xf69c('0x46')],_0x141161[_0xf69c('0x48')]),_0x588482);if(_0x18b9d5[_0xf69c('0x46')]['filter']){_0x185034[_0xf69c('0x4f')]=_[_0xf69c('0x51')](_0x185034['where'],{'$or':_[_0xf69c('0x3f')](_0x588482,function(_0x179cee){if(_0x179cee['type']!==_0xf69c('0x52')){var _0x1c4b48={};_0x1c4b48[_0x179cee[_0xf69c('0x3c')]]={'$like':'%'+_0x18b9d5[_0xf69c('0x46')]['filter']+'%'};return _0x1c4b48;}})});}_0x185034=_[_0xf69c('0x51')]({},_0x185034,_0x18b9d5['options']);var _0x310f83={'where':_0x185034[_0xf69c('0x4f')]};return db[_0xf69c('0x40')][_0xf69c('0x34')](_0x310f83)[_0xf69c('0x22')](function(_0x42a89f){_0x25342d['count']=_0x42a89f;if(_0x18b9d5[_0xf69c('0x46')][_0xf69c('0x53')]){_0x185034[_0xf69c('0x54')]=[{'all':!![]}];}return db['ChatMessage'][_0xf69c('0x55')](_0x185034);})['then'](function(_0x5ca8bd){_0x25342d['rows']=_0x5ca8bd;return _0x25342d;})[_0xf69c('0x22')](respondWithFilteredResult(_0x42d0a9,_0x185034))['catch'](handleError(_0x42d0a9,null));};exports['show']=function(_0x2c7d99,_0x429417){var _0x22ccd0={'raw':!![],'where':{'id':_0x2c7d99[_0xf69c('0x56')]['id']}},_0x4a7a2a={};_0x4a7a2a['model']=_[_0xf69c('0x47')](db[_0xf69c('0x40')][_0xf69c('0x41')]);_0x4a7a2a[_0xf69c('0x46')]=_[_0xf69c('0x47')](_0x2c7d99[_0xf69c('0x46')]);_0x4a7a2a[_0xf69c('0x48')]=_[_0xf69c('0x57')](_0x4a7a2a['model'],_0x4a7a2a[_0xf69c('0x46')]);_0x22ccd0[_0xf69c('0x49')]=_[_0xf69c('0x57')](_0x4a7a2a[_0xf69c('0x45')],qs[_0xf69c('0x4a')](_0x2c7d99['query']['fields']));_0x22ccd0[_0xf69c('0x49')]=_0x22ccd0['attributes'][_0xf69c('0x4b')]?_0x22ccd0[_0xf69c('0x49')]:_0x4a7a2a['model'];if(_0x2c7d99[_0xf69c('0x46')][_0xf69c('0x53')]){_0x22ccd0['include']=[{'all':!![]}];}_0x22ccd0=_[_0xf69c('0x51')]({},_0x22ccd0,_0x2c7d99[_0xf69c('0x58')]);return db[_0xf69c('0x40')][_0xf69c('0x59')](_0x22ccd0)['then'](handleEntityNotFound(_0x429417,null))[_0xf69c('0x22')](respondWithResult(_0x429417,null))[_0xf69c('0x2c')](handleError(_0x429417,null));};exports[_0xf69c('0x5a')]=function(_0x2c9dc7,_0xdeb46e){return db['ChatMessage'][_0xf69c('0x5a')](_0x2c9dc7[_0xf69c('0x5b')],{})[_0xf69c('0x22')](respondWithResult(_0xdeb46e,0xc9))[_0xf69c('0x2c')](handleError(_0xdeb46e,null));};exports[_0xf69c('0x39')]=function(_0x2ef8dd,_0x3853c9){if(_0x2ef8dd[_0xf69c('0x5b')]['id']){delete _0x2ef8dd[_0xf69c('0x5b')]['id'];}return db[_0xf69c('0x40')][_0xf69c('0x59')]({'where':{'id':_0x2ef8dd[_0xf69c('0x56')]['id']}})[_0xf69c('0x22')](handleEntityNotFound(_0x3853c9,null))[_0xf69c('0x22')](saveUpdates(_0x2ef8dd[_0xf69c('0x5b')],null))[_0xf69c('0x22')](respondWithResult(_0x3853c9,null))['catch'](handleError(_0x3853c9,null));};exports[_0xf69c('0x3a')]=function(_0x3f64d2,_0x44cb9a){return db['ChatMessage']['find']({'where':{'id':_0x3f64d2[_0xf69c('0x56')]['id']}})[_0xf69c('0x22')](handleEntityNotFound(_0x44cb9a,null))[_0xf69c('0x22')](removeEntity(_0x44cb9a,null))[_0xf69c('0x2c')](handleError(_0x44cb9a,null));};exports[_0xf69c('0x5c')]=function(_0x1d6dba,_0xaaccd1){return db[_0xf69c('0x40')][_0xf69c('0x5c')]()[_0xf69c('0x22')](respondWithResult(_0xaaccd1,null))[_0xf69c('0x2c')](handleError(_0xaaccd1,null));};var interaction_log=require(_0xf69c('0x14'))(_0xf69c('0x5d'));exports[_0xf69c('0x5e')]=function(_0x3e9ff9,_0x105abc,_0x4c5d69){var _0x4045d8={'agent':{},'channel':_0xf69c('0x5f')};if(_0x3e9ff9[_0xf69c('0x5b')]['id']){delete _0x3e9ff9[_0xf69c('0x5b')]['id'];}_0x3e9ff9[_0xf69c('0x5b')][_0xf69c('0x60')]=!![];_0x3e9ff9[_0xf69c('0x5b')][_0xf69c('0x61')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3e9ff9[_0xf69c('0x5b')][_0xf69c('0x62')]=_0x3e9ff9['body'][_0xf69c('0x62')]||_0x3e9ff9[_0xf69c('0x63')]['id'];_0x4045d8[_0xf69c('0x64')]['id']=_0x3e9ff9[_0xf69c('0x5b')]['UserId'];return db[_0xf69c('0x40')][_0xf69c('0x59')]({'where':{'id':_0x3e9ff9[_0xf69c('0x56')]['id'],'UserId':null}})[_0xf69c('0x22')](handleEntityNotFound(_0x105abc,null))['then'](saveUpdates(_0x3e9ff9[_0xf69c('0x5b')],null))[_0xf69c('0x22')](function(_0x343ba5){if(_0x343ba5){_0x4045d8[_0xf69c('0x2a')]=_0x343ba5[_0xf69c('0x65')]({'plain':!![]});return db[_0xf69c('0x66')][_0xf69c('0x59')]({'where':{'id':_0x343ba5['ChatInteractionId']}});}return null;})[_0xf69c('0x22')](handleEntityNotFound(_0x105abc,null))[_0xf69c('0x22')](function(_0x5c82fc){if(_0x5c82fc){return _0x5c82fc[_0xf69c('0x39')]({'UserId':_0x3e9ff9['body'][_0xf69c('0x62')],'read1stAt':_[_0xf69c('0x67')](_0x5c82fc[_0xf69c('0x68')])?moment()[_0xf69c('0x69')](_0xf69c('0x6a')):undefined});}return null;})[_0xf69c('0x22')](function(_0x409af6){if(_0x409af6){_0x4045d8['interaction']=_0x409af6[_0xf69c('0x65')]({'plain':!![]});interaction_log[_0xf69c('0x6b')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3e9ff9[_0xf69c('0x63')]['id'],_0x3e9ff9[_0xf69c('0x63')]['name'],_0x3e9ff9[_0xf69c('0x63')][_0xf69c('0x6c')],_0x4045d8[_0xf69c('0x6d')]['id'],_0x3e9ff9[_0xf69c('0x5b')]?JSON['stringify'](_0x3e9ff9[_0xf69c('0x5b')]):_0xf69c('0x6e'));return respondWithRpcPromise(_0xf69c('0x6f'),_0xf69c('0x70'),_0x4045d8);}return null;})[_0xf69c('0x22')](function(_0x247155){var _0x287261=_0xf69c('0x71')+_0x247155[_0xf69c('0x2a')][_0xf69c('0x72')];return db[_0xf69c('0x73')][_0xf69c('0x46')](_0x287261,{'type':db['Sequelize'][_0xf69c('0x74')][_0xf69c('0x75')],'raw':!![]})[_0xf69c('0x22')](function(_0x381ff4){return _0x381ff4;});})[_0xf69c('0x22')](function(_0x44e957){if(_0x44e957){_0x4045d8['message'][_0xf69c('0x76')]=_0x44e957[0x0];if(!_0x3e9ff9[_0xf69c('0x5b')][_0xf69c('0x62')])return;return db['User']['find']({'where':{'id':_0x3e9ff9[_0xf69c('0x5b')][_0xf69c('0x62')],'role':_0xf69c('0x64')},'attributes':['id','name','fullname',_0xf69c('0x77'),'internal'],'raw':!![]});}return null;})[_0xf69c('0x22')](function(_0x5b4d15){if(!_0x5b4d15)return null;_0x4045d8[_0xf69c('0x2a')][_0xf69c('0x64')]=_0x5b4d15;return _0x4045d8;})[_0xf69c('0x22')](function(_0x57a32c){if(_0x57a32c){if(_0x3e9ff9[_0xf69c('0x5b')][_0xf69c('0x78')]){_0x4045d8[_0xf69c('0x2a')][_0xf69c('0x79')]=util[_0xf69c('0x69')]('SIP/%s',_0x3e9ff9[_0xf69c('0x63')][_0xf69c('0x3c')]);_0x4045d8['message'][_0xf69c('0x7a')]=_0x4045d8[_0xf69c('0x7a')];_0x4045d8['message']['motionChannel']=_0x4045d8[_0xf69c('0x7a')];_0x4045d8[_0xf69c('0x2a')][_0xf69c('0x7b')]=_0xf69c('0x5e');return respondWithRpcPromise(_0xf69c('0x7c'),'EventManager',{'event':_0xf69c('0x7d'),'message':_[_0xf69c('0x51')](_0x4045d8[_0xf69c('0x2a')],JSON[_0xf69c('0x7e')](_0x4045d8[_0xf69c('0x6d')]['formData']))},client9002)[_0xf69c('0x22')](function(){return _0x4045d8;});}return _0x4045d8;}return null;})[_0xf69c('0x22')](respondWithResult(_0x105abc,null))[_0xf69c('0x2c')](handleError(_0x105abc,null));};var interaction_log=require('../../config/logger')(_0xf69c('0x5d'));exports[_0xf69c('0x38')]=function(_0x905b0b,_0x598f38,_0x7a6d4f){var _0x549692={'agent':{},'channel':'chat'};if(_0x905b0b[_0xf69c('0x5b')]['id']){delete _0x905b0b[_0xf69c('0x5b')]['id'];}_0x905b0b['body']['UserId']=_0x905b0b[_0xf69c('0x5b')][_0xf69c('0x62')]||_0x905b0b[_0xf69c('0x63')]['id'];_0x549692[_0xf69c('0x64')]['id']=_0x905b0b[_0xf69c('0x5b')]['UserId'];return db[_0xf69c('0x40')][_0xf69c('0x59')]({'where':{'id':_0x905b0b['params']['id'],'UserId':null}})[_0xf69c('0x22')](handleEntityNotFound(_0x598f38,null))['then'](function(_0x25a92b){if(_0x25a92b){_0x549692[_0xf69c('0x2a')]=_0x25a92b['get']({'plain':!![]});return db[_0xf69c('0x66')][_0xf69c('0x59')]({'where':{'id':_0x25a92b[_0xf69c('0x7f')]}});}return null;})[_0xf69c('0x22')](handleEntityNotFound(_0x598f38,null))['then'](function(_0x1d7f53){if(_0x1d7f53){_0x549692[_0xf69c('0x6d')]=_0x1d7f53['get']({'plain':!![]});interaction_log[_0xf69c('0x6b')](_0xf69c('0x80'),_0x905b0b[_0xf69c('0x63')]['id'],_0x905b0b['user'][_0xf69c('0x3c')],_0x905b0b[_0xf69c('0x63')][_0xf69c('0x6c')],_0x549692['interaction']['id'],_0x905b0b[_0xf69c('0x5b')]?JSON[_0xf69c('0x27')](_0x905b0b[_0xf69c('0x5b')]):_0xf69c('0x6e'));return respondWithRpcPromise(_0xf69c('0x81'),_0xf69c('0x82'),_0x549692);}return null;})[_0xf69c('0x22')](function(_0x38ccb9){var _0x44070e=_0xf69c('0x71')+_0x38ccb9[_0xf69c('0x2a')][_0xf69c('0x72')];return db[_0xf69c('0x73')]['query'](_0x44070e,{'type':db['Sequelize'][_0xf69c('0x74')][_0xf69c('0x75')],'raw':!![]})[_0xf69c('0x22')](function(_0x49b38e){return _0x49b38e;});})[_0xf69c('0x22')](function(_0x59b6eb){if(_0x59b6eb){_0x549692[_0xf69c('0x2a')]['contact']=_0x59b6eb[0x0];if(!_0x905b0b[_0xf69c('0x5b')][_0xf69c('0x62')])return;return db[_0xf69c('0x83')][_0xf69c('0x59')]({'where':{'id':_0x905b0b['body'][_0xf69c('0x62')],'role':_0xf69c('0x64')},'attributes':['id','name',_0xf69c('0x84'),_0xf69c('0x77'),'internal'],'raw':!![]});}return null;})[_0xf69c('0x22')](function(_0x2f2756){if(!_0x2f2756)return null;_0x549692[_0xf69c('0x2a')][_0xf69c('0x64')]=_0x2f2756;return _0x549692;})[_0xf69c('0x22')](function(_0x50d3d0){if(_0x50d3d0){_0x50d3d0[_0xf69c('0x2a')][_0xf69c('0x79')]=util[_0xf69c('0x69')](_0xf69c('0x85'),_0x905b0b[_0xf69c('0x63')][_0xf69c('0x3c')]);_0x50d3d0[_0xf69c('0x2a')][_0xf69c('0x7a')]=_0x549692[_0xf69c('0x7a')];_0x50d3d0[_0xf69c('0x2a')][_0xf69c('0x86')]=_0x549692['channel'];_0x50d3d0[_0xf69c('0x2a')][_0xf69c('0x7b')]='reject';respondWithRpcPromise(_0xf69c('0x7c'),_0xf69c('0x7c'),{'event':'rejectmessage','message':_['merge'](_0x549692[_0xf69c('0x2a')],JSON[_0xf69c('0x7e')](_0x549692[_0xf69c('0x6d')][_0xf69c('0x87')]))},client9002);return _0x549692;}return null;})['then'](respondWithResult(_0x598f38,null))[_0xf69c('0x2c')](handleError(_0x598f38,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index d54e0b2..ea29126 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 _0xb961=['hasOwnProperty','exports','events','ChatMessage','setMaxListeners','save','update','remove','emit'];(function(_0x22b0cb,_0x5a764a){var _0x444178=function(_0x5aed3d){while(--_0x5aed3d){_0x22b0cb['push'](_0x22b0cb['shift']());}};_0x444178(++_0x5a764a);}(_0xb961,0x1f1));var _0x1b96=function(_0x55ee6f,_0x1cdc43){_0x55ee6f=_0x55ee6f-0x0;var _0x3c6aa9=_0xb961[_0x55ee6f];return _0x3c6aa9;};'use strict';var EventEmitter=require(_0x1b96('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x1b96('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x1b96('0x2')](0x0);var events={'afterCreate':_0x1b96('0x3'),'afterUpdate':_0x1b96('0x4'),'afterDestroy':_0x1b96('0x5')};function emitEvent(_0x3de60a){return function(_0x678cbd,_0x29b265,_0x311dd7){ChatMessageEvents['emit'](_0x3de60a+':'+_0x678cbd['id'],_0x678cbd);ChatMessageEvents[_0x1b96('0x6')](_0x3de60a,_0x678cbd);_0x311dd7(null);};}for(var e in events){if(events[_0x1b96('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x1b96('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x60b1=['events','save','update','remove','hasOwnProperty','hook','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x60b1,0x1ea));var _0x160b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x60b1[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0x160b('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x160b('0x1'),'afterUpdate':_0x160b('0x2'),'afterDestroy':_0x160b('0x3')};function emitEvent(_0x388a7e){return function(_0xc44556,_0x54f5c1,_0x45c78f){ChatMessageEvents['emit'](_0x388a7e+':'+_0xc44556['id'],_0xc44556);ChatMessageEvents['emit'](_0x388a7e,_0xc44556);_0x45c78f(null);};}for(var e in events){if(events[_0x160b('0x4')](e)){var event=events[e];ChatMessage[_0x160b('0x5')](e,emitEvent(event));}}module[_0x160b('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index dcf414c..7ec19ba 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 _0x3c2f=['rimraf','../../config/environment','exports','define','chat_messages','fti_chat_messages','FULLTEXT','get','direction','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','toLowerCase','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise'];(function(_0x38eb22,_0x458a8c){var _0x49553e=function(_0x2879fd){while(--_0x2879fd){_0x38eb22['push'](_0x38eb22['shift']());}};_0x49553e(++_0x458a8c);}(_0x3c2f,0x91));var _0xf3c2=function(_0x30a191,_0x38b23b){_0x30a191=_0x30a191-0x0;var _0xf6f720=_0x3c2f[_0x30a191];return _0xf6f720;};'use strict';var _=require(_0xf3c2('0x0'));var util=require('util');var logger=require(_0xf3c2('0x1'))(_0xf3c2('0x2'));var moment=require(_0xf3c2('0x3'));var BPromise=require('bluebird');var rp=require(_0xf3c2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf3c2('0x5'));var config=require(_0xf3c2('0x6'));var attributes=require('./chatMessage.attributes');module[_0xf3c2('0x7')]=function(_0x1aae36,_0x2f7b5a){return _0x1aae36[_0xf3c2('0x8')]('ChatMessage',attributes,{'tableName':_0xf3c2('0x9'),'paranoid':![],'indexes':[{'name':_0xf3c2('0xa'),'fields':['body'],'type':_0xf3c2('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x12372d,_0x5f4e81,_0x5b9ec5){var _0x3d7597=_0x1aae36['models'];var _0x5b3b7a=_0x12372d[_0xf3c2('0xc')]({'plain':!![]});if(_0x5b3b7a['direction']['toLowerCase']()==='in'||_0x5b3b7a[_0xf3c2('0xd')]['toLowerCase']()==='out'&&!_0x5b3b7a['secret']&&!_['isNil'](_0x5b3b7a[_0xf3c2('0xe')])){_0x3d7597[_0xf3c2('0xf')][_0xf3c2('0x10')]({'where':{'id':_0x5b3b7a[_0xf3c2('0x11')]}})[_0xf3c2('0x12')](function(_0x816a79){if(_0x816a79){_0x816a79[_0xf3c2('0x13')]({'lastMsgAt':_0x5b3b7a[_0xf3c2('0x14')],'lastMsgDirection':_0x5b3b7a[_0xf3c2('0xd')][_0xf3c2('0x15')]()});}})['catch'](function(_0x3688ad){console[_0xf3c2('0x16')](_0x3688ad);});}_0x5b9ec5();}},'charset':_0xf3c2('0x17'),'collate':_0xf3c2('0x18')});}; \ No newline at end of file +var _0x858a=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','ChatMessage','chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','error','utf8mb4','lodash','util'];(function(_0x5c989c,_0x325ddb){var _0x4ad1e9=function(_0x254873){while(--_0x254873){_0x5c989c['push'](_0x5c989c['shift']());}};_0x4ad1e9(++_0x325ddb);}(_0x858a,0x1a2));var _0xa858=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x858a[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0xa858('0x0'));var util=require(_0xa858('0x1'));var logger=require(_0xa858('0x2'))(_0xa858('0x3'));var moment=require(_0xa858('0x4'));var BPromise=require(_0xa858('0x5'));var rp=require(_0xa858('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa858('0x7'));var config=require(_0xa858('0x8'));var attributes=require(_0xa858('0x9'));module['exports']=function(_0x4e07e9,_0x348ee9){return _0x4e07e9['define'](_0xa858('0xa'),attributes,{'tableName':_0xa858('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xa858('0xc')],'type':_0xa858('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x55e57b,_0x1d7574,_0x34d72b){var _0x57d8dc=_0x4e07e9[_0xa858('0xe')];var _0x3b0ee6=_0x55e57b[_0xa858('0xf')]({'plain':!![]});if(_0x3b0ee6[_0xa858('0x10')]['toLowerCase']()==='in'||_0x3b0ee6[_0xa858('0x10')][_0xa858('0x11')]()==='out'&&!_0x3b0ee6['secret']&&!_[_0xa858('0x12')](_0x3b0ee6[_0xa858('0x13')])){_0x57d8dc[_0xa858('0x14')][_0xa858('0x15')]({'where':{'id':_0x3b0ee6[_0xa858('0x16')]}})[_0xa858('0x17')](function(_0x4df31b){if(_0x4df31b){_0x4df31b[_0xa858('0x18')]({'lastMsgAt':_0x3b0ee6[_0xa858('0x19')],'lastMsgDirection':_0x3b0ee6[_0xa858('0x10')]['toLowerCase']()});}})['catch'](function(_0x583f45){console[_0xa858('0x1a')](_0x583f45);});}_0x34d72b();}},'charset':_0xa858('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 90e876b..07b5520 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 _0x6d38=['moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatMessage.socket','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','ChatMessage','create','body','options','CreateChatMessage','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6d38,0x1ef));var _0x86d3=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x6d38[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});config[_0x86d3('0x9')]=_[_0x86d3('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x86d3('0xb'))(new Redis(config[_0x86d3('0x9')]));require(_0x86d3('0xc'))['register'](socket);function respondWithRpcPromise(_0x4a277e,_0x3ed317,_0x555e6d){return new BPromise(function(_0x49b436,_0x5606eb){return client[_0x86d3('0xd')](_0x4a277e,_0x555e6d)[_0x86d3('0xe')](function(_0x4f216c){logger[_0x86d3('0xf')]('ChatMessage,\x20%s,\x20%s',_0x3ed317,_0x86d3('0x10'));logger[_0x86d3('0x11')](_0x86d3('0x12'),_0x3ed317,_0x86d3('0x10'),JSON[_0x86d3('0x13')](_0x4f216c));if(_0x4f216c[_0x86d3('0x14')]){if(_0x4f216c[_0x86d3('0x14')][_0x86d3('0x15')]===0x1f4){logger['error'](_0x86d3('0x16'),_0x3ed317,_0x4f216c[_0x86d3('0x14')][_0x86d3('0x17')]);return _0x5606eb(_0x4f216c[_0x86d3('0x14')][_0x86d3('0x17')]);}logger[_0x86d3('0x14')](_0x86d3('0x16'),_0x3ed317,_0x4f216c[_0x86d3('0x14')]['message']);return _0x49b436(_0x4f216c[_0x86d3('0x14')][_0x86d3('0x17')]);}else{logger[_0x86d3('0xf')](_0x86d3('0x16'),_0x3ed317,_0x86d3('0x10'));_0x49b436(_0x4f216c[_0x86d3('0x18')][_0x86d3('0x17')]);}})[_0x86d3('0x19')](function(_0x9b76f2){logger['error'](_0x86d3('0x16'),_0x3ed317,_0x9b76f2);_0x5606eb(_0x9b76f2);});});}exports['CreateChatMessage']=function(_0x6ced9e){var _0x5c4d55=this;return new Promise(function(_0x52293e,_0x41486a){return db[_0x86d3('0x1a')][_0x86d3('0x1b')](_0x6ced9e[_0x86d3('0x1c')],{'raw':_0x6ced9e['options']?_0x6ced9e[_0x86d3('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x86d3('0xe')](function(_0x3fdf67){logger[_0x86d3('0xf')]('CreateChatMessage',_0x6ced9e);logger[_0x86d3('0x11')](_0x86d3('0x1e'),_0x6ced9e,JSON[_0x86d3('0x13')](_0x3fdf67));_0x52293e(_0x3fdf67);})['catch'](function(_0x58ba51){logger[_0x86d3('0x14')]('CreateChatMessage',_0x58ba51[_0x86d3('0x17')],_0x6ced9e);_0x41486a(_0x5c4d55[_0x86d3('0x14')](0x1f4,_0x58ba51[_0x86d3('0x17')]));});});}; \ No newline at end of file +var _0xe5e0=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','create','body','options','raw','CreateChatMessage','lodash','util'];(function(_0x54c23d,_0xf5da8e){var _0x5915ff=function(_0x6c835f){while(--_0x6c835f){_0x54c23d['push'](_0x54c23d['shift']());}};_0x5915ff(++_0xf5da8e);}(_0xe5e0,0x1be));var _0x0e5e=function(_0x34cdbe,_0x5c49a7){_0x34cdbe=_0x34cdbe-0x0;var _0x134592=_0xe5e0[_0x34cdbe];return _0x134592;};'use strict';var _=require(_0x0e5e('0x0'));var util=require(_0x0e5e('0x1'));var moment=require(_0x0e5e('0x2'));var BPromise=require(_0x0e5e('0x3'));var rs=require(_0x0e5e('0x4'));var fs=require('fs');var Redis=require(_0x0e5e('0x5'));var db=require(_0x0e5e('0x6'))['db'];var utils=require(_0x0e5e('0x7'));var logger=require(_0x0e5e('0x8'))('rpc');var config=require(_0x0e5e('0x9'));var jayson=require(_0x0e5e('0xa'));var client=jayson[_0x0e5e('0xb')]['http']({'port':0x232a});config[_0x0e5e('0xc')]=_[_0x0e5e('0xd')](config[_0x0e5e('0xc')],{'host':_0x0e5e('0xe'),'port':0x18eb});var socket=require(_0x0e5e('0xf'))(new Redis(config[_0x0e5e('0xc')]));require(_0x0e5e('0x10'))['register'](socket);function respondWithRpcPromise(_0x5d5366,_0x531bf8,_0x4241ea){return new BPromise(function(_0x17a208,_0x5a88de){return client['request'](_0x5d5366,_0x4241ea)[_0x0e5e('0x11')](function(_0x3ee826){logger[_0x0e5e('0x12')](_0x0e5e('0x13'),_0x531bf8,'request\x20sent');logger[_0x0e5e('0x14')](_0x0e5e('0x15'),_0x531bf8,'request\x20sent',JSON[_0x0e5e('0x16')](_0x3ee826));if(_0x3ee826[_0x0e5e('0x17')]){if(_0x3ee826[_0x0e5e('0x17')]['code']===0x1f4){logger[_0x0e5e('0x17')](_0x0e5e('0x13'),_0x531bf8,_0x3ee826[_0x0e5e('0x17')][_0x0e5e('0x18')]);return _0x5a88de(_0x3ee826[_0x0e5e('0x17')][_0x0e5e('0x18')]);}logger['error'](_0x0e5e('0x13'),_0x531bf8,_0x3ee826[_0x0e5e('0x17')][_0x0e5e('0x18')]);return _0x17a208(_0x3ee826[_0x0e5e('0x17')][_0x0e5e('0x18')]);}else{logger['info'](_0x0e5e('0x13'),_0x531bf8,_0x0e5e('0x19'));_0x17a208(_0x3ee826['result'][_0x0e5e('0x18')]);}})[_0x0e5e('0x1a')](function(_0x56cc12){logger[_0x0e5e('0x17')](_0x0e5e('0x13'),_0x531bf8,_0x56cc12);_0x5a88de(_0x56cc12);});});}exports['CreateChatMessage']=function(_0x422c08){var _0x485b97=this;return new Promise(function(_0x3659d9,_0x56dcc9){return db['ChatMessage'][_0x0e5e('0x1b')](_0x422c08[_0x0e5e('0x1c')],{'raw':_0x422c08[_0x0e5e('0x1d')]?_0x422c08[_0x0e5e('0x1d')][_0x0e5e('0x1e')]===undefined?!![]:![]:!![]})[_0x0e5e('0x11')](function(_0x2588fa){logger[_0x0e5e('0x12')](_0x0e5e('0x1f'),_0x422c08);logger[_0x0e5e('0x14')]('CreateChatMessage',_0x422c08,JSON[_0x0e5e('0x16')](_0x2588fa));_0x3659d9(_0x2588fa);})[_0x0e5e('0x1a')](function(_0xfff15b){logger[_0x0e5e('0x17')](_0x0e5e('0x1f'),_0xfff15b[_0x0e5e('0x18')],_0x422c08);_0x56dcc9(_0x485b97[_0x0e5e('0x17')](0x1f4,_0xfff15b['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 6040231..b8313dd 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 _0x9879=['remove','emit','removeListener','register','chatMessage:','./chatMessage.events','save'];(function(_0x3d38ae,_0x51102b){var _0x3757ee=function(_0x22bac8){while(--_0x22bac8){_0x3d38ae['push'](_0x3d38ae['shift']());}};_0x3757ee(++_0x51102b);}(_0x9879,0x98));var _0x9987=function(_0x25ac7e,_0x31d9ee){_0x25ac7e=_0x25ac7e-0x0;var _0x2c855f=_0x9879[_0x25ac7e];return _0x2c855f;};'use strict';var ChatMessageEvents=require(_0x9987('0x0'));var events=[_0x9987('0x1'),_0x9987('0x2'),'update'];function createListener(_0xadce9d,_0x525218){return function(_0x3a2473){_0x525218[_0x9987('0x3')](_0xadce9d,_0x3a2473);};}function removeListener(_0x1fd45d,_0xcc5722){return function(){ChatMessageEvents[_0x9987('0x4')](_0x1fd45d,_0xcc5722);};}exports[_0x9987('0x5')]=function(_0x4258df){for(var _0x4d479d=0x0,_0x34d2fd=events['length'];_0x4d479d<_0x34d2fd;_0x4d479d++){var _0x6cb988=events[_0x4d479d];var _0x3e5538=createListener(_0x9987('0x6')+_0x6cb988,_0x4258df);ChatMessageEvents['on'](_0x6cb988,_0x3e5538);}}; \ No newline at end of file +var _0x37a7=['chatMessage:','./chatMessage.events','save','removeListener','register'];(function(_0x44540d,_0x361ed2){var _0x3cb1e3=function(_0x6439ec){while(--_0x6439ec){_0x44540d['push'](_0x44540d['shift']());}};_0x3cb1e3(++_0x361ed2);}(_0x37a7,0x6f));var _0x737a=function(_0x114e01,_0x22bb25){_0x114e01=_0x114e01-0x0;var _0x19499f=_0x37a7[_0x114e01];return _0x19499f;};'use strict';var ChatMessageEvents=require(_0x737a('0x0'));var events=[_0x737a('0x1'),'remove','update'];function createListener(_0x5a259b,_0x2d4b54){return function(_0xc5eaef){_0x2d4b54['emit'](_0x5a259b,_0xc5eaef);};}function removeListener(_0x524516,_0x4af128){return function(){ChatMessageEvents[_0x737a('0x2')](_0x524516,_0x4af128);};}exports[_0x737a('0x3')]=function(_0x7f4eed){for(var _0x11109c=0x0,_0x2f6800=events['length'];_0x11109c<_0x2f6800;_0x11109c++){var _0x244850=events[_0x11109c];var _0x249898=createListener(_0x737a('0x4')+_0x244850,_0x7f4eed);ChatMessageEvents['on'](_0x244850,_0x249898);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 479aad7..11e440d 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 _0xb8fa=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked','chat','create','/:id','update','/:id/accept','accept','put','/:id/reject','reject','delete','destroy','exports','multer'];(function(_0x143515,_0x1121bb){var _0x116e2c=function(_0x44d265){while(--_0x44d265){_0x143515['push'](_0x143515['shift']());}};_0x116e2c(++_0x1121bb);}(_0xb8fa,0x178));var _0xab8f=function(_0x507ea9,_0x54f7da){_0x507ea9=_0x507ea9-0x0;var _0x52cdb4=_0xb8fa[_0x507ea9];return _0x52cdb4;};'use strict';var multer=require(_0xab8f('0x0'));var util=require(_0xab8f('0x1'));var path=require('path');var timeout=require(_0xab8f('0x2'));var express=require(_0xab8f('0x3'));var router=express['Router']();var fs_extra=require(_0xab8f('0x4'));var auth=require(_0xab8f('0x5'));var interaction=require(_0xab8f('0x6'));var config=require(_0xab8f('0x7'));var controller=require(_0xab8f('0x8'));router[_0xab8f('0x9')]('/',auth[_0xab8f('0xa')](),controller[_0xab8f('0xb')]);router[_0xab8f('0x9')](_0xab8f('0xc'),auth['isAuthenticated'](),controller[_0xab8f('0xd')]);router[_0xab8f('0x9')]('/:id',auth[_0xab8f('0xa')](),controller[_0xab8f('0xe')]);router[_0xab8f('0xf')]('/',auth['isAuthenticated'](),interaction[_0xab8f('0x10')](_0xab8f('0x11'),'chatmessage:create'),controller[_0xab8f('0x12')]);router['put'](_0xab8f('0x13'),controller[_0xab8f('0x14')]);router['put'](_0xab8f('0x15'),auth[_0xab8f('0xa')](),controller[_0xab8f('0x16')]);router[_0xab8f('0x17')](_0xab8f('0x18'),auth[_0xab8f('0xa')](),controller[_0xab8f('0x19')]);router[_0xab8f('0x1a')](_0xab8f('0x13'),auth[_0xab8f('0xa')](),controller[_0xab8f('0x1b')]);module[_0xab8f('0x1c')]=router; \ No newline at end of file +var _0x8187=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','/:id','show','post','tracked','chat','create','put','update','/:id/accept','accept','reject','delete','exports'];(function(_0x20c22f,_0x55756f){var _0x1fcd53=function(_0x258c0a){while(--_0x258c0a){_0x20c22f['push'](_0x20c22f['shift']());}};_0x1fcd53(++_0x55756f);}(_0x8187,0xa8));var _0x7818=function(_0x35acb6,_0x40d4e6){_0x35acb6=_0x35acb6-0x0;var _0x33b202=_0x8187[_0x35acb6];return _0x33b202;};'use strict';var multer=require(_0x7818('0x0'));var util=require('util');var path=require(_0x7818('0x1'));var timeout=require(_0x7818('0x2'));var express=require(_0x7818('0x3'));var router=express[_0x7818('0x4')]();var fs_extra=require(_0x7818('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7818('0x6'));var config=require('../../config/environment');var controller=require(_0x7818('0x7'));router[_0x7818('0x8')]('/',auth[_0x7818('0x9')](),controller[_0x7818('0xa')]);router[_0x7818('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x7818('0xb'),auth[_0x7818('0x9')](),controller[_0x7818('0xc')]);router[_0x7818('0xd')]('/',auth[_0x7818('0x9')](),interaction[_0x7818('0xe')](_0x7818('0xf'),'chatmessage:create'),controller[_0x7818('0x10')]);router[_0x7818('0x11')](_0x7818('0xb'),controller[_0x7818('0x12')]);router[_0x7818('0x11')](_0x7818('0x13'),auth['isAuthenticated'](),controller[_0x7818('0x14')]);router[_0x7818('0x11')]('/:id/reject',auth[_0x7818('0x9')](),controller[_0x7818('0x15')]);router[_0x7818('0x16')](_0x7818('0xb'),auth[_0x7818('0x9')](),controller['destroy']);module[_0x7818('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index f6858ca..6c56457 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 _0xb57d=['medium','sequelize','exports','TEXT'];(function(_0x2bfa01,_0x367d19){var _0x4a59b1=function(_0x1ba0c9){while(--_0x1ba0c9){_0x2bfa01['push'](_0x2bfa01['shift']());}};_0x4a59b1(++_0x367d19);}(_0xb57d,0x18d));var _0xdb57=function(_0x4e8447,_0x4c0e30){_0x4e8447=_0x4e8447-0x0;var _0x26dda5=_0xb57d[_0x4e8447];return _0x26dda5;};'use strict';var Sequelize=require(_0xdb57('0x0'));module[_0xdb57('0x1')]={'body':{'type':Sequelize[_0xdb57('0x2')](_0xdb57('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x5969=['exports','TEXT','medium','sequelize'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0x5969,0x1a3));var _0x9596=function(_0x1e86a1,_0x3bd5ae){_0x1e86a1=_0x1e86a1-0x0;var _0xc3cba9=_0x5969[_0x1e86a1];return _0xc3cba9;};'use strict';var Sequelize=require(_0x9596('0x0'));module[_0x9596('0x1')]={'body':{'type':Sequelize[_0x9596('0x2')](_0x9596('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 07a76d6..518f5c4 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x7a54,0x106));var _0x47a5=function(_0x1476c1,_0xda0777){_0x1476c1=_0x1476c1-0x0;var _0x3cbf17=_0x7a54[_0x1476c1];return _0x3cbf17;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x1eb9ff,_0x331d5e){var _0x318794=function(_0x2a2f96){while(--_0x2a2f96){_0x1eb9ff['push'](_0x1eb9ff['shift']());}};_0x318794(++_0x331d5e);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){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.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 3392cff..f727098 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 _0x9b54=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x19c9c6,_0x181391){var _0x94fdba=function(_0x260ae7){while(--_0x260ae7){_0x19c9c6['push'](_0x19c9c6['shift']());}};_0x94fdba(++_0x181391);}(_0x9b54,0x19f));var _0x49b5=function(_0x254f96,_0x39bacd){_0x254f96=_0x254f96-0x0;var _0x2826a2=_0x9b54[_0x254f96];return _0x2826a2;};'use strict';var _=require(_0x49b5('0x0'));var util=require(_0x49b5('0x1'));var logger=require(_0x49b5('0x2'))(_0x49b5('0x3'));var moment=require(_0x49b5('0x4'));var BPromise=require(_0x49b5('0x5'));var rp=require(_0x49b5('0x6'));var fs=require('fs');var path=require(_0x49b5('0x7'));var rimraf=require(_0x49b5('0x8'));var config=require('../../config/environment');var attributes=require('./chatOfflineMessage.attributes');module[_0x49b5('0x9')]=function(_0x199353,_0xd87c6e){return _0x199353[_0x49b5('0xa')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x49b5('0xb'),'collate':_0x49b5('0xc')});}; \ No newline at end of file +var _0x14c2=['chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define'];(function(_0x4f454c,_0x188cfa){var _0x3160f7=function(_0x1be015){while(--_0x1be015){_0x4f454c['push'](_0x4f454c['shift']());}};_0x3160f7(++_0x188cfa);}(_0x14c2,0x16f));var _0x214c=function(_0x38f1aa,_0x1ade9e){_0x38f1aa=_0x38f1aa-0x0;var _0x211d9b=_0x14c2[_0x38f1aa];return _0x211d9b;};'use strict';var _=require(_0x214c('0x0'));var util=require('util');var logger=require(_0x214c('0x1'))(_0x214c('0x2'));var moment=require(_0x214c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x214c('0x4'));var rimraf=require(_0x214c('0x5'));var config=require(_0x214c('0x6'));var attributes=require(_0x214c('0x7'));module[_0x214c('0x8')]=function(_0x16247b,_0x517f3c){return _0x16247b[_0x214c('0x9')]('ChatOfflineMessage',attributes,{'tableName':_0x214c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x214c('0xb'),'collate':_0x214c('0xc')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index eaa5564..942fdbc 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 _0xd2a3=['debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x59710f,_0x44c7f0){var _0xaae66a=function(_0x1c2397){while(--_0x1c2397){_0x59710f['push'](_0x59710f['shift']());}};_0xaae66a(++_0x44c7f0);}(_0xd2a3,0x12d));var _0x3d2a=function(_0x5b7627,_0x46727b){_0x5b7627=_0x5b7627-0x0;var _0xddd8f5=_0xd2a3[_0x5b7627];return _0xddd8f5;};'use strict';var _=require(_0x3d2a('0x0'));var util=require(_0x3d2a('0x1'));var moment=require('moment');var BPromise=require(_0x3d2a('0x2'));var rs=require(_0x3d2a('0x3'));var fs=require('fs');var Redis=require(_0x3d2a('0x4'));var db=require(_0x3d2a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3d2a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d2a('0x7')][_0x3d2a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x226dc1,_0x2b7028,_0x2da82b){return new BPromise(function(_0x1d95fa,_0x1f0da3){return client[_0x3d2a('0x9')](_0x226dc1,_0x2da82b)[_0x3d2a('0xa')](function(_0x5f0779){logger[_0x3d2a('0xb')](_0x3d2a('0xc'),_0x2b7028,_0x3d2a('0xd'));logger[_0x3d2a('0xe')](_0x3d2a('0xf'),_0x2b7028,_0x3d2a('0xd'),JSON[_0x3d2a('0x10')](_0x5f0779));if(_0x5f0779[_0x3d2a('0x11')]){if(_0x5f0779[_0x3d2a('0x11')][_0x3d2a('0x12')]===0x1f4){logger[_0x3d2a('0x11')](_0x3d2a('0xc'),_0x2b7028,_0x5f0779['error'][_0x3d2a('0x13')]);return _0x1f0da3(_0x5f0779[_0x3d2a('0x11')][_0x3d2a('0x13')]);}logger[_0x3d2a('0x11')](_0x3d2a('0xc'),_0x2b7028,_0x5f0779[_0x3d2a('0x11')][_0x3d2a('0x13')]);return _0x1d95fa(_0x5f0779[_0x3d2a('0x11')]['message']);}else{logger[_0x3d2a('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2b7028,'request\x20sent');_0x1d95fa(_0x5f0779[_0x3d2a('0x14')][_0x3d2a('0x13')]);}})['catch'](function(_0x13bfe4){logger['error'](_0x3d2a('0xc'),_0x2b7028,_0x13bfe4);_0x1f0da3(_0x13bfe4);});});} \ No newline at end of file +var _0x18ec=['info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x50c630,_0x38181c){var _0x578a03=function(_0x2bfad0){while(--_0x2bfad0){_0x50c630['push'](_0x50c630['shift']());}};_0x578a03(++_0x38181c);}(_0x18ec,0x1d1));var _0xc18e=function(_0x5095f0,_0x7f9c07){_0x5095f0=_0x5095f0-0x0;var _0x2b3f9b=_0x18ec[_0x5095f0];return _0x2b3f9b;};'use strict';var _=require(_0xc18e('0x0'));var util=require(_0xc18e('0x1'));var moment=require('moment');var BPromise=require(_0xc18e('0x2'));var rs=require(_0xc18e('0x3'));var fs=require('fs');var Redis=require(_0xc18e('0x4'));var db=require(_0xc18e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc18e('0x6'))(_0xc18e('0x7'));var config=require(_0xc18e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc18e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2efdb2,_0x593d8d,_0x49dec5){return new BPromise(function(_0x16e96b,_0x171c34){return client[_0xc18e('0xa')](_0x2efdb2,_0x49dec5)[_0xc18e('0xb')](function(_0x370702){logger['info'](_0xc18e('0xc'),_0x593d8d,'request\x20sent');logger[_0xc18e('0xd')](_0xc18e('0xe'),_0x593d8d,_0xc18e('0xf'),JSON['stringify'](_0x370702));if(_0x370702[_0xc18e('0x10')]){if(_0x370702[_0xc18e('0x10')]['code']===0x1f4){logger[_0xc18e('0x10')](_0xc18e('0xc'),_0x593d8d,_0x370702['error'][_0xc18e('0x11')]);return _0x171c34(_0x370702['error'][_0xc18e('0x11')]);}logger[_0xc18e('0x10')](_0xc18e('0xc'),_0x593d8d,_0x370702['error'][_0xc18e('0x11')]);return _0x16e96b(_0x370702['error']['message']);}else{logger[_0xc18e('0x12')](_0xc18e('0xc'),_0x593d8d,_0xc18e('0xf'));_0x16e96b(_0x370702[_0xc18e('0x13')][_0xc18e('0x11')]);}})[_0xc18e('0x14')](function(_0x1061b8){logger[_0xc18e('0x10')](_0xc18e('0xc'),_0x593d8d,_0x1061b8);_0x171c34(_0x1061b8);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index d472ad7..820107d 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 _0xcda0=['Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x8b631b,_0x386724){var _0x3e6832=function(_0x17a132){while(--_0x17a132){_0x8b631b['push'](_0x8b631b['shift']());}};_0x3e6832(++_0x386724);}(_0xcda0,0x94));var _0x0cda=function(_0x171e90,_0x478cab){_0x171e90=_0x171e90-0x0;var _0x3bca8e=_0xcda0[_0x171e90];return _0x3bca8e;};'use strict';var multer=require(_0x0cda('0x0'));var util=require(_0x0cda('0x1'));var path=require('path');var timeout=require(_0x0cda('0x2'));var express=require(_0x0cda('0x3'));var router=express[_0x0cda('0x4')]();var fs_extra=require(_0x0cda('0x5'));var auth=require(_0x0cda('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatOfflineMessage.controller');router[_0x0cda('0x7')]('/',auth[_0x0cda('0x8')](),controller[_0x0cda('0x9')]);router[_0x0cda('0x7')](_0x0cda('0xa'),auth[_0x0cda('0x8')](),controller[_0x0cda('0xb')]);router[_0x0cda('0x7')](_0x0cda('0xc'),auth['isAuthenticated'](),controller[_0x0cda('0xd')]);router['post']('/',auth[_0x0cda('0x8')](),controller[_0x0cda('0xe')]);router['put'](_0x0cda('0xc'),auth[_0x0cda('0x8')](),controller[_0x0cda('0xf')]);router[_0x0cda('0x10')](_0x0cda('0xc'),auth[_0x0cda('0x8')](),controller[_0x0cda('0x11')]);module[_0x0cda('0x12')]=router; \ No newline at end of file +var _0x65b1=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','delete','destroy','exports','multer','util','path'];(function(_0x529309,_0x83dbd){var _0x4f8108=function(_0x4f7505){while(--_0x4f7505){_0x529309['push'](_0x529309['shift']());}};_0x4f8108(++_0x83dbd);}(_0x65b1,0x111));var _0x165b=function(_0x40d765,_0xd52369){_0x40d765=_0x40d765-0x0;var _0x47f679=_0x65b1[_0x40d765];return _0x47f679;};'use strict';var multer=require(_0x165b('0x0'));var util=require(_0x165b('0x1'));var path=require(_0x165b('0x2'));var timeout=require(_0x165b('0x3'));var express=require(_0x165b('0x4'));var router=express[_0x165b('0x5')]();var fs_extra=require(_0x165b('0x6'));var auth=require(_0x165b('0x7'));var interaction=require(_0x165b('0x8'));var config=require(_0x165b('0x9'));var controller=require(_0x165b('0xa'));router[_0x165b('0xb')]('/',auth[_0x165b('0xc')](),controller[_0x165b('0xd')]);router['get'](_0x165b('0xe'),auth['isAuthenticated'](),controller[_0x165b('0xf')]);router[_0x165b('0xb')](_0x165b('0x10'),auth[_0x165b('0xc')](),controller[_0x165b('0x11')]);router[_0x165b('0x12')]('/',auth[_0x165b('0xc')](),controller[_0x165b('0x13')]);router['put'](_0x165b('0x10'),auth[_0x165b('0xc')](),controller['update']);router[_0x165b('0x14')](_0x165b('0x10'),auth[_0x165b('0xc')](),controller[_0x165b('0x15')]);module[_0x165b('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 255f0c9..36c21c8 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 _0xe510=['exports','STRING','ENUM','mouseOver','timeout','sequelize'];(function(_0x3e29df,_0x42fdf8){var _0x3e3ba9=function(_0x47ccb0){while(--_0x47ccb0){_0x3e29df['push'](_0x3e29df['shift']());}};_0x3e3ba9(++_0x42fdf8);}(_0xe510,0x107));var _0x0e51=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xe510[_0x599f41];return _0x2e4d58;};'use strict';var Sequelize=require(_0x0e51('0x0'));module[_0x0e51('0x1')]={'name':{'type':Sequelize[_0x0e51('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0e51('0x3')](_0x0e51('0x4'),_0x0e51('0x5')),'defaultValue':_0x0e51('0x4')},'selector':{'type':Sequelize[_0x0e51('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x5614=['STRING','ENUM','mouseOver','timeout','INTEGER','sequelize','exports'];(function(_0x324f21,_0x3f64b9){var _0x516c6b=function(_0x30739b){while(--_0x30739b){_0x324f21['push'](_0x324f21['shift']());}};_0x516c6b(++_0x3f64b9);}(_0x5614,0xb4));var _0x4561=function(_0x4482a5,_0x279488){_0x4482a5=_0x4482a5-0x0;var _0x5272c2=_0x5614[_0x4482a5];return _0x5272c2;};'use strict';var Sequelize=require(_0x4561('0x0'));module[_0x4561('0x1')]={'name':{'type':Sequelize[_0x4561('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4561('0x3')](_0x4561('0x4'),_0x4561('0x5')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x4561('0x2')]},'timeout':{'type':Sequelize[_0x4561('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 8c016e9..54106e1 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 _0x7c22=['lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','show','params','model','ChatProactiveAction','rawAttributes','query','keys','filters','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','ejs'];(function(_0x43db47,_0x58b29a){var _0x258596=function(_0x2db53f){while(--_0x2db53f){_0x43db47['push'](_0x43db47['shift']());}};_0x258596(++_0x58b29a);}(_0x7c22,0x6c));var _0x27c2=function(_0x164670,_0x4b10a3){_0x164670=_0x164670-0x0;var _0x6cce79=_0x7c22[_0x164670];return _0x6cce79;};'use strict';var emlformat=require(_0x27c2('0x0'));var rimraf=require(_0x27c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x27c2('0x2'));var rp=require(_0x27c2('0x3'));var moment=require('moment');var BPromise=require(_0x27c2('0x4'));var Mustache=require(_0x27c2('0x5'));var util=require('util');var path=require('path');var sox=require(_0x27c2('0x6'));var csv=require('to-csv');var ejs=require(_0x27c2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x27c2('0x8'));var squel=require(_0x27c2('0x9'));var crypto=require('crypto');var jsforce=require(_0x27c2('0xa'));var deskjs=require(_0x27c2('0xb'));var toCsv=require(_0x27c2('0xc'));var querystring=require(_0x27c2('0xd'));var Papa=require(_0x27c2('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x27c2('0xf'));var as=require(_0x27c2('0x10'));var hardwareService=require(_0x27c2('0x11'));var logger=require(_0x27c2('0x12'))('api');var utils=require(_0x27c2('0x13'));var config=require(_0x27c2('0x14'));var licenseUtil=require(_0x27c2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c654a,_0x23a6ed){_0x23a6ed=_0x23a6ed||0xcc;return function(_0x3a8d1f){if(_0x3a8d1f){return _0x4c654a[_0x27c2('0x16')](_0x23a6ed);}return _0x4c654a[_0x27c2('0x17')](_0x23a6ed)[_0x27c2('0x18')]();};}function respondWithResult(_0x599589,_0xa704c2){_0xa704c2=_0xa704c2||0xc8;return function(_0x4db64a){if(_0x4db64a){return _0x599589[_0x27c2('0x17')](_0xa704c2)[_0x27c2('0x19')](_0x4db64a);}};}function respondWithFilteredResult(_0x333db1,_0x2e2193){return function(_0x49241e){if(_0x49241e){var _0x272038=typeof _0x2e2193[_0x27c2('0x1a')]===_0x27c2('0x1b')&&typeof _0x2e2193[_0x27c2('0x1c')]===_0x27c2('0x1b');var _0x2db0b6=_0x49241e[_0x27c2('0x1d')];var _0x2daee4=_0x272038?0x0:_0x2e2193[_0x27c2('0x1a')];var _0x5f197c=_0x272038?_0x49241e[_0x27c2('0x1d')]:_0x2e2193[_0x27c2('0x1a')]+_0x2e2193[_0x27c2('0x1c')];var _0x824e60;if(_0x5f197c>=_0x2db0b6){_0x5f197c=_0x2db0b6;_0x824e60=0xc8;}else{_0x824e60=0xce;}_0x333db1['status'](_0x824e60);return _0x333db1['set'](_0x27c2('0x1e'),_0x2daee4+'-'+_0x5f197c+'/'+_0x2db0b6)[_0x27c2('0x19')](_0x49241e);}return null;};}function patchUpdates(_0x25136d){return function(_0x282cdb){try{jsonpatch[_0x27c2('0x1f')](_0x282cdb,_0x25136d,!![]);}catch(_0x9f380){return BPromise['reject'](_0x9f380);}return _0x282cdb[_0x27c2('0x20')]();};}function saveUpdates(_0x111287,_0x38e982){return function(_0x136a63){if(_0x136a63){return _0x136a63[_0x27c2('0x21')](_0x111287)[_0x27c2('0x22')](function(_0x311cd2){return _0x311cd2;});}return null;};}function removeEntity(_0xb9af7f,_0x52ecc5){return function(_0x58ffa6){if(_0x58ffa6){return _0x58ffa6[_0x27c2('0x23')]()[_0x27c2('0x22')](function(){_0xb9af7f['status'](0xcc)[_0x27c2('0x18')]();});}};}function handleEntityNotFound(_0x66bf45,_0x21ccb2){return function(_0x1cf775){if(!_0x1cf775){_0x66bf45['sendStatus'](0x194);}return _0x1cf775;};}function handleError(_0x3e7563,_0x2d9974){_0x2d9974=_0x2d9974||0x1f4;return function(_0x3d2338){logger[_0x27c2('0x24')](_0x3d2338[_0x27c2('0x25')]);if(_0x3d2338[_0x27c2('0x26')]){delete _0x3d2338[_0x27c2('0x26')];}_0x3e7563[_0x27c2('0x17')](_0x2d9974)['send'](_0x3d2338);};}exports[_0x27c2('0x27')]=function(_0x3c13a1,_0x54b061){var _0x48ef72={'raw':!![],'where':{'id':_0x3c13a1[_0x27c2('0x28')]['id']}},_0xeeba0b={};_0xeeba0b[_0x27c2('0x29')]=_['keys'](db[_0x27c2('0x2a')][_0x27c2('0x2b')]);_0xeeba0b[_0x27c2('0x2c')]=_[_0x27c2('0x2d')](_0x3c13a1[_0x27c2('0x2c')]);_0xeeba0b[_0x27c2('0x2e')]=_['intersection'](_0xeeba0b[_0x27c2('0x29')],_0xeeba0b[_0x27c2('0x2c')]);_0x48ef72[_0x27c2('0x2f')]=_['intersection'](_0xeeba0b[_0x27c2('0x29')],qs[_0x27c2('0x30')](_0x3c13a1[_0x27c2('0x2c')][_0x27c2('0x30')]));_0x48ef72['attributes']=_0x48ef72[_0x27c2('0x2f')][_0x27c2('0x31')]?_0x48ef72[_0x27c2('0x2f')]:_0xeeba0b[_0x27c2('0x29')];if(_0x3c13a1[_0x27c2('0x2c')][_0x27c2('0x32')]){_0x48ef72[_0x27c2('0x33')]=[{'all':!![]}];}_0x48ef72=_[_0x27c2('0x34')]({},_0x48ef72,_0x3c13a1[_0x27c2('0x35')]);return db['ChatProactiveAction'][_0x27c2('0x36')](_0x48ef72)[_0x27c2('0x22')](handleEntityNotFound(_0x54b061,null))[_0x27c2('0x22')](respondWithResult(_0x54b061,null))[_0x27c2('0x37')](handleError(_0x54b061,null));};exports[_0x27c2('0x38')]=function(_0x48ba14,_0x11e4a1){return db[_0x27c2('0x2a')][_0x27c2('0x38')](_0x48ba14[_0x27c2('0x39')],{})['then'](respondWithResult(_0x11e4a1,0xc9))[_0x27c2('0x37')](handleError(_0x11e4a1,null));};exports[_0x27c2('0x21')]=function(_0x97ef60,_0x2f0221){if(_0x97ef60[_0x27c2('0x39')]['id']){delete _0x97ef60[_0x27c2('0x39')]['id'];}return db[_0x27c2('0x2a')]['find']({'where':{'id':_0x97ef60[_0x27c2('0x28')]['id']}})[_0x27c2('0x22')](handleEntityNotFound(_0x2f0221,null))['then'](saveUpdates(_0x97ef60[_0x27c2('0x39')],null))[_0x27c2('0x22')](respondWithResult(_0x2f0221,null))[_0x27c2('0x37')](handleError(_0x2f0221,null));};exports['destroy']=function(_0x286ed5,_0x303ace){return db[_0x27c2('0x2a')][_0x27c2('0x36')]({'where':{'id':_0x286ed5[_0x27c2('0x28')]['id']}})['then'](handleEntityNotFound(_0x303ace,null))[_0x27c2('0x22')](removeEntity(_0x303ace,null))['catch'](handleError(_0x303ace,null));}; \ No newline at end of file +var _0x3c70=['util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','error','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','intersection','fields','attributes','include','merge','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x460358,_0x45d45e){var _0x2e6a60=function(_0xc3135a){while(--_0xc3135a){_0x460358['push'](_0x460358['shift']());}};_0x2e6a60(++_0x45d45e);}(_0x3c70,0x10c));var _0x03c7=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x3c70[_0x433a86];return _0x23000c;};'use strict';var emlformat=require(_0x03c7('0x0'));var rimraf=require(_0x03c7('0x1'));var zipdir=require(_0x03c7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x03c7('0x3'));var moment=require(_0x03c7('0x4'));var BPromise=require(_0x03c7('0x5'));var Mustache=require(_0x03c7('0x6'));var util=require(_0x03c7('0x7'));var path=require(_0x03c7('0x8'));var sox=require('sox');var csv=require(_0x03c7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x03c7('0xa'));var _=require(_0x03c7('0xb'));var squel=require(_0x03c7('0xc'));var crypto=require('crypto');var jsforce=require(_0x03c7('0xd'));var deskjs=require(_0x03c7('0xe'));var toCsv=require(_0x03c7('0x9'));var querystring=require('querystring');var Papa=require(_0x03c7('0xf'));var Redis=require('ioredis');var authService=require(_0x03c7('0x10'));var qs=require(_0x03c7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x03c7('0x12'));var logger=require(_0x03c7('0x13'))(_0x03c7('0x14'));var utils=require(_0x03c7('0x15'));var config=require(_0x03c7('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe78fd1,_0xb1b40a){_0xb1b40a=_0xb1b40a||0xcc;return function(_0x49697f){if(_0x49697f){return _0xe78fd1[_0x03c7('0x17')](_0xb1b40a);}return _0xe78fd1[_0x03c7('0x18')](_0xb1b40a)[_0x03c7('0x19')]();};}function respondWithResult(_0x2c57af,_0x1d9668){_0x1d9668=_0x1d9668||0xc8;return function(_0x5adce3){if(_0x5adce3){return _0x2c57af[_0x03c7('0x18')](_0x1d9668)['json'](_0x5adce3);}};}function respondWithFilteredResult(_0xdc48a7,_0x1ae657){return function(_0x4e3ff5){if(_0x4e3ff5){var _0x9a3264=typeof _0x1ae657[_0x03c7('0x1a')]===_0x03c7('0x1b')&&typeof _0x1ae657['limit']===_0x03c7('0x1b');var _0x6c852d=_0x4e3ff5[_0x03c7('0x1c')];var _0xdb40cc=_0x9a3264?0x0:_0x1ae657[_0x03c7('0x1a')];var _0x2946d7=_0x9a3264?_0x4e3ff5['count']:_0x1ae657['offset']+_0x1ae657[_0x03c7('0x1d')];var _0x2cd27c;if(_0x2946d7>=_0x6c852d){_0x2946d7=_0x6c852d;_0x2cd27c=0xc8;}else{_0x2cd27c=0xce;}_0xdc48a7[_0x03c7('0x18')](_0x2cd27c);return _0xdc48a7[_0x03c7('0x1e')](_0x03c7('0x1f'),_0xdb40cc+'-'+_0x2946d7+'/'+_0x6c852d)['json'](_0x4e3ff5);}return null;};}function patchUpdates(_0x1e3de1){return function(_0x1e6fae){try{jsonpatch['apply'](_0x1e6fae,_0x1e3de1,!![]);}catch(_0x4e8062){return BPromise['reject'](_0x4e8062);}return _0x1e6fae[_0x03c7('0x20')]();};}function saveUpdates(_0x734b3b,_0x3a5da2){return function(_0x50b316){if(_0x50b316){return _0x50b316[_0x03c7('0x21')](_0x734b3b)[_0x03c7('0x22')](function(_0x3c960a){return _0x3c960a;});}return null;};}function removeEntity(_0x4d6a9c,_0xfa2d9e){return function(_0x4795e7){if(_0x4795e7){return _0x4795e7[_0x03c7('0x23')]()['then'](function(){_0x4d6a9c[_0x03c7('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x270ee3,_0x304337){return function(_0x246f9d){if(!_0x246f9d){_0x270ee3['sendStatus'](0x194);}return _0x246f9d;};}function handleError(_0x3b1cbb,_0x2a4ac4){_0x2a4ac4=_0x2a4ac4||0x1f4;return function(_0x222912){logger[_0x03c7('0x24')](_0x222912['stack']);if(_0x222912['name']){delete _0x222912[_0x03c7('0x25')];}_0x3b1cbb['status'](_0x2a4ac4)[_0x03c7('0x26')](_0x222912);};}exports[_0x03c7('0x27')]=function(_0x51929b,_0x24a331){var _0x462f08={'raw':!![],'where':{'id':_0x51929b[_0x03c7('0x28')]['id']}},_0x153be5={};_0x153be5[_0x03c7('0x29')]=_[_0x03c7('0x2a')](db[_0x03c7('0x2b')][_0x03c7('0x2c')]);_0x153be5[_0x03c7('0x2d')]=_[_0x03c7('0x2a')](_0x51929b[_0x03c7('0x2d')]);_0x153be5['filters']=_[_0x03c7('0x2e')](_0x153be5[_0x03c7('0x29')],_0x153be5[_0x03c7('0x2d')]);_0x462f08['attributes']=_['intersection'](_0x153be5['model'],qs[_0x03c7('0x2f')](_0x51929b['query'][_0x03c7('0x2f')]));_0x462f08[_0x03c7('0x30')]=_0x462f08[_0x03c7('0x30')]['length']?_0x462f08[_0x03c7('0x30')]:_0x153be5[_0x03c7('0x29')];if(_0x51929b[_0x03c7('0x2d')]['includeAll']){_0x462f08[_0x03c7('0x31')]=[{'all':!![]}];}_0x462f08=_[_0x03c7('0x32')]({},_0x462f08,_0x51929b['options']);return db[_0x03c7('0x2b')][_0x03c7('0x33')](_0x462f08)['then'](handleEntityNotFound(_0x24a331,null))[_0x03c7('0x22')](respondWithResult(_0x24a331,null))[_0x03c7('0x34')](handleError(_0x24a331,null));};exports[_0x03c7('0x35')]=function(_0x48a30b,_0x2309de){return db[_0x03c7('0x2b')][_0x03c7('0x35')](_0x48a30b[_0x03c7('0x36')],{})['then'](respondWithResult(_0x2309de,0xc9))[_0x03c7('0x34')](handleError(_0x2309de,null));};exports['update']=function(_0x132c1b,_0xc29c21){if(_0x132c1b[_0x03c7('0x36')]['id']){delete _0x132c1b[_0x03c7('0x36')]['id'];}return db[_0x03c7('0x2b')][_0x03c7('0x33')]({'where':{'id':_0x132c1b['params']['id']}})['then'](handleEntityNotFound(_0xc29c21,null))[_0x03c7('0x22')](saveUpdates(_0x132c1b[_0x03c7('0x36')],null))['then'](respondWithResult(_0xc29c21,null))[_0x03c7('0x34')](handleError(_0xc29c21,null));};exports[_0x03c7('0x23')]=function(_0x346335,_0x7c8ba5){return db[_0x03c7('0x2b')][_0x03c7('0x33')]({'where':{'id':_0x346335[_0x03c7('0x28')]['id']}})['then'](handleEntityNotFound(_0x7c8ba5,null))['then'](removeEntity(_0x7c8ba5,null))[_0x03c7('0x34')](handleError(_0x7c8ba5,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 959c506..4b706ae 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 _0xc444=['api','moment','bluebird','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','../../config/logger'];(function(_0x378f33,_0x15f9b1){var _0x5e52d5=function(_0x4717e6){while(--_0x4717e6){_0x378f33['push'](_0x378f33['shift']());}};_0x5e52d5(++_0x15f9b1);}(_0xc444,0x107));var _0x4c44=function(_0x21e31e,_0x451faf){_0x21e31e=_0x21e31e-0x0;var _0x3e5b20=_0xc444[_0x21e31e];return _0x3e5b20;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4c44('0x0'))(_0x4c44('0x1'));var moment=require(_0x4c44('0x2'));var BPromise=require(_0x4c44('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c44('0x4'));var rimraf=require(_0x4c44('0x5'));var config=require(_0x4c44('0x6'));var attributes=require(_0x4c44('0x7'));module[_0x4c44('0x8')]=function(_0x24c194,_0x33c505){return _0x24c194[_0x4c44('0x9')](_0x4c44('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ce7=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x3ce7,0x144));var _0x73ce=function(_0x132d88,_0x53aa7f){_0x132d88=_0x132d88-0x0;var _0x39c4c0=_0x3ce7[_0x132d88];return _0x39c4c0;};'use strict';var _=require(_0x73ce('0x0'));var util=require(_0x73ce('0x1'));var logger=require(_0x73ce('0x2'))(_0x73ce('0x3'));var moment=require(_0x73ce('0x4'));var BPromise=require(_0x73ce('0x5'));var rp=require(_0x73ce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73ce('0x7'));var config=require(_0x73ce('0x8'));var attributes=require(_0x73ce('0x9'));module[_0x73ce('0xa')]=function(_0x28b695,_0x1a6147){return _0x28b695['define'](_0x73ce('0xb'),attributes,{'tableName':_0x73ce('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index c533279..0e15cc7 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 _0x30c4=['lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch'];(function(_0x3e3d0a,_0x4745dd){var _0x3fc765=function(_0x3b64c5){while(--_0x3b64c5){_0x3e3d0a['push'](_0x3e3d0a['shift']());}};_0x3fc765(++_0x4745dd);}(_0x30c4,0x1c8));var _0x430c=function(_0x3265c7,_0x5a8e3b){_0x3265c7=_0x3265c7-0x0;var _0x5de11c=_0x30c4[_0x3265c7];return _0x5de11c;};'use strict';var _=require(_0x430c('0x0'));var util=require(_0x430c('0x1'));var moment=require(_0x430c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x430c('0x3'));var db=require(_0x430c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x430c('0x5'))(_0x430c('0x6'));var config=require(_0x430c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x430c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54d061,_0x48fe64,_0x53f516){return new BPromise(function(_0x594272,_0x195e7a){return client[_0x430c('0x9')](_0x54d061,_0x53f516)[_0x430c('0xa')](function(_0x145bd9){logger['info'](_0x430c('0xb'),_0x48fe64,_0x430c('0xc'));logger[_0x430c('0xd')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x48fe64,_0x430c('0xc'),JSON[_0x430c('0xe')](_0x145bd9));if(_0x145bd9['error']){if(_0x145bd9[_0x430c('0xf')]['code']===0x1f4){logger[_0x430c('0xf')](_0x430c('0xb'),_0x48fe64,_0x145bd9[_0x430c('0xf')][_0x430c('0x10')]);return _0x195e7a(_0x145bd9['error'][_0x430c('0x10')]);}logger[_0x430c('0xf')](_0x430c('0xb'),_0x48fe64,_0x145bd9[_0x430c('0xf')]['message']);return _0x594272(_0x145bd9[_0x430c('0xf')][_0x430c('0x10')]);}else{logger[_0x430c('0x11')](_0x430c('0xb'),_0x48fe64,_0x430c('0xc'));_0x594272(_0x145bd9['result']['message']);}})[_0x430c('0x12')](function(_0x403ffc){logger[_0x430c('0xf')](_0x430c('0xb'),_0x48fe64,_0x403ffc);_0x195e7a(_0x403ffc);});});} \ No newline at end of file +var _0x0ac3=['error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s'];(function(_0x1efa50,_0x4308f8){var _0x10eca0=function(_0x2beeb9){while(--_0x2beeb9){_0x1efa50['push'](_0x1efa50['shift']());}};_0x10eca0(++_0x4308f8);}(_0x0ac3,0xd6));var _0x30ac=function(_0x35fd8c,_0x848015){_0x35fd8c=_0x35fd8c-0x0;var _0x30c33e=_0x0ac3[_0x35fd8c];return _0x30c33e;};'use strict';var _=require(_0x30ac('0x0'));var util=require('util');var moment=require(_0x30ac('0x1'));var BPromise=require(_0x30ac('0x2'));var rs=require(_0x30ac('0x3'));var fs=require('fs');var Redis=require(_0x30ac('0x4'));var db=require(_0x30ac('0x5'))['db'];var utils=require(_0x30ac('0x6'));var logger=require(_0x30ac('0x7'))(_0x30ac('0x8'));var config=require(_0x30ac('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x30ac('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c719e,_0xf5c1fe,_0x3b5132){return new BPromise(function(_0x5b38f6,_0x4e6425){return client['request'](_0x1c719e,_0x3b5132)[_0x30ac('0xb')](function(_0x1ef741){logger[_0x30ac('0xc')](_0x30ac('0xd'),_0xf5c1fe,_0x30ac('0xe'));logger[_0x30ac('0xf')](_0x30ac('0x10'),_0xf5c1fe,_0x30ac('0xe'),JSON['stringify'](_0x1ef741));if(_0x1ef741[_0x30ac('0x11')]){if(_0x1ef741['error'][_0x30ac('0x12')]===0x1f4){logger[_0x30ac('0x11')](_0x30ac('0xd'),_0xf5c1fe,_0x1ef741[_0x30ac('0x11')][_0x30ac('0x13')]);return _0x4e6425(_0x1ef741[_0x30ac('0x11')][_0x30ac('0x13')]);}logger[_0x30ac('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0xf5c1fe,_0x1ef741['error'][_0x30ac('0x13')]);return _0x5b38f6(_0x1ef741['error'][_0x30ac('0x13')]);}else{logger[_0x30ac('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0xf5c1fe,_0x30ac('0xe'));_0x5b38f6(_0x1ef741[_0x30ac('0x14')][_0x30ac('0x13')]);}})['catch'](function(_0x2cc047){logger['error'](_0x30ac('0xd'),_0xf5c1fe,_0x2cc047);_0x4e6425(_0x2cc047);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index bee1bb0..60a04dc 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 _0x5fd1=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put','update','multer','path','connect-timeout','express'];(function(_0x400977,_0x21a905){var _0x298bdd=function(_0x53de7c){while(--_0x53de7c){_0x400977['push'](_0x400977['shift']());}};_0x298bdd(++_0x21a905);}(_0x5fd1,0x155));var _0x15fd=function(_0x432666,_0x1987fd){_0x432666=_0x432666-0x0;var _0x411329=_0x5fd1[_0x432666];return _0x411329;};'use strict';var multer=require(_0x15fd('0x0'));var util=require('util');var path=require(_0x15fd('0x1'));var timeout=require(_0x15fd('0x2'));var express=require(_0x15fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x15fd('0x4'));var interaction=require(_0x15fd('0x5'));var config=require(_0x15fd('0x6'));var controller=require('./chatProactiveAction.controller');router[_0x15fd('0x7')](_0x15fd('0x8'),auth[_0x15fd('0x9')](),controller[_0x15fd('0xa')]);router[_0x15fd('0xb')]('/',auth['isAuthenticated'](),controller[_0x15fd('0xc')]);router[_0x15fd('0xd')](_0x15fd('0x8'),auth['isAuthenticated'](),controller[_0x15fd('0xe')]);router['delete'](_0x15fd('0x8'),auth[_0x15fd('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7dfd=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x41e6e0,_0x27b320){var _0x6601ad=function(_0xc21250){while(--_0xc21250){_0x41e6e0['push'](_0x41e6e0['shift']());}};_0x6601ad(++_0x27b320);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var path=require(_0xd7df('0x2'));var timeout=require(_0xd7df('0x3'));var express=require(_0xd7df('0x4'));var router=express[_0xd7df('0x5')]();var fs_extra=require(_0xd7df('0x6'));var auth=require(_0xd7df('0x7'));var interaction=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var controller=require(_0xd7df('0xa'));router[_0xd7df('0xb')](_0xd7df('0xc'),auth[_0xd7df('0xd')](),controller[_0xd7df('0xe')]);router[_0xd7df('0xf')]('/',auth[_0xd7df('0xd')](),controller['create']);router[_0xd7df('0x10')](_0xd7df('0xc'),auth[_0xd7df('0xd')](),controller[_0xd7df('0x11')]);router['delete'](_0xd7df('0xc'),auth['isAuthenticated'](),controller[_0xd7df('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index c5c3ba2..cfc24b2 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 _0xb198=['beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x337076,_0xa3ad5b){var _0x2a5f81=function(_0x22478d){while(--_0x22478d){_0x337076['push'](_0x337076['shift']());}};_0x2a5f81(++_0xa3ad5b);}(_0xb198,0xc6));var _0x8b19=function(_0x113503,_0x2317c3){_0x113503=_0x113503-0x0;var _0x55810d=_0xb198[_0x113503];return _0x55810d;};'use strict';var Sequelize=require(_0x8b19('0x0'));module[_0x8b19('0x1')]={'name':{'type':Sequelize[_0x8b19('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8b19('0x2')]},'timeout':{'type':Sequelize[_0x8b19('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8b19('0x4')]('rrmemory',_0x8b19('0x5'),_0x8b19('0x6'))}}; \ No newline at end of file +var _0x4349=['beepall','sequelize','exports','STRING','name','INTEGER','rrmemory'];(function(_0x349711,_0x3167bf){var _0x2fa78b=function(_0x2ffefc){while(--_0x2ffefc){_0x349711['push'](_0x349711['shift']());}};_0x2fa78b(++_0x3167bf);}(_0x4349,0xe1));var _0x9434=function(_0x49094a,_0x6816bb){_0x49094a=_0x49094a-0x0;var _0xd77c63=_0x4349[_0x49094a];return _0xd77c63;};'use strict';var Sequelize=require(_0x9434('0x0'));module[_0x9434('0x1')]={'name':{'type':Sequelize[_0x9434('0x2')],'unique':_0x9434('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9434('0x2')]},'timeout':{'type':Sequelize[_0x9434('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9434('0x5'),_0x9434('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index c377251..ee7e4ad 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 _0x873e=['findOrCreate','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','all','union','compact','value','ids','isEmpty','emit','userChatQueue:remove','addAgents','spread','userChatQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','jayson/promise','client','http','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','end','offset','undefined','limit','count','json','reject','save','then','get','ChatQueues','UserProfileResource','destroy','sendStatus','name','index','map','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','ChatQueue','findAll','rows','catch','params','rawAttributes','keys','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserChatQueue','ChatQueueId','User','UserId','agent','updatedAt','format','%s/%s','SIP','chatPause','getTeams','Team','addTeams','Agents','online','voicePause','interface','sequelize','transaction'];(function(_0x402e66,_0xee3649){var _0x5566e6=function(_0x423fa8){while(--_0x423fa8){_0x402e66['push'](_0x402e66['shift']());}};_0x5566e6(++_0xee3649);}(_0x873e,0x141));var _0xe873=function(_0x49af99,_0x322497){_0x49af99=_0x49af99-0x0;var _0x352f2f=_0x873e[_0x49af99];return _0x352f2f;};'use strict';var emlformat=require(_0xe873('0x0'));var rimraf=require(_0xe873('0x1'));var zipdir=require(_0xe873('0x2'));var jsonpatch=require(_0xe873('0x3'));var rp=require(_0xe873('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe873('0x5'));var sox=require(_0xe873('0x6'));var csv=require('to-csv');var ejs=require(_0xe873('0x7'));var fs=require('fs');var fs_extra=require(_0xe873('0x8'));var _=require('lodash');var squel=require(_0xe873('0x9'));var crypto=require(_0xe873('0xa'));var jsforce=require(_0xe873('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe873('0xc'));var querystring=require(_0xe873('0xd'));var Papa=require(_0xe873('0xe'));var Redis=require('ioredis');var authService=require(_0xe873('0xf'));var qs=require(_0xe873('0x10'));var as=require(_0xe873('0x11'));var hardwareService=require(_0xe873('0x12'));var logger=require(_0xe873('0x13'))(_0xe873('0x14'));var utils=require(_0xe873('0x15'));var config=require(_0xe873('0x16'));var licenseUtil=require(_0xe873('0x17'));var db=require(_0xe873('0x18'))['db'];config[_0xe873('0x19')]=_[_0xe873('0x1a')](config[_0xe873('0x19')],{'host':_0xe873('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe873('0x19')]));require(_0xe873('0x1c'))[_0xe873('0x1d')](socket);var jayson=require(_0xe873('0x1e'));var client=jayson[_0xe873('0x1f')][_0xe873('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5865aa,_0x15f954,_0x456e15,_0x2f34a9){return new BPromise(function(_0x30c29f,_0x39e918){var _0x27b5e8=_0x2f34a9||client;return _0x27b5e8[_0xe873('0x21')](_0x5865aa,_0x456e15)['then'](function(_0x2dd1bb){logger[_0xe873('0x22')](_0xe873('0x23'),_0x15f954,_0xe873('0x24'));logger[_0xe873('0x25')](_0xe873('0x26'),_0x15f954,_0xe873('0x24'),JSON[_0xe873('0x27')](_0x2dd1bb));if(_0x2dd1bb[_0xe873('0x28')]){if(_0x2dd1bb['error']['code']===0x1f4){logger[_0xe873('0x28')](_0xe873('0x23'),_0x15f954,_0x2dd1bb[_0xe873('0x28')][_0xe873('0x29')]);return _0x39e918(_0x2dd1bb[_0xe873('0x28')][_0xe873('0x29')]);}logger[_0xe873('0x28')](_0xe873('0x23'),_0x15f954,_0x2dd1bb[_0xe873('0x28')][_0xe873('0x29')]);return _0x30c29f(_0x2dd1bb[_0xe873('0x28')][_0xe873('0x29')]);}else{logger[_0xe873('0x22')](_0xe873('0x23'),_0x15f954,_0xe873('0x24'));_0x30c29f(_0x2dd1bb[_0xe873('0x2a')][_0xe873('0x29')]);}})['catch'](function(_0x1124c6){logger['error'](_0xe873('0x23'),_0x15f954,_0x1124c6);_0x39e918(_0x1124c6);});});}function respondWithStatusCode(_0x100288,_0x488d90){_0x488d90=_0x488d90||0xcc;return function(_0x246205){if(_0x246205){return _0x100288['sendStatus'](_0x488d90);}return _0x100288[_0xe873('0x2b')](_0x488d90)[_0xe873('0x2c')]();};}function respondWithResult(_0x364b3d,_0x1c1630){_0x1c1630=_0x1c1630||0xc8;return function(_0x36f585){if(_0x36f585){return _0x364b3d[_0xe873('0x2b')](_0x1c1630)['json'](_0x36f585);}};}function respondWithFilteredResult(_0x4476a7,_0x374b30){return function(_0x53593c){if(_0x53593c){var _0x3eb631=typeof _0x374b30[_0xe873('0x2d')]===_0xe873('0x2e')&&typeof _0x374b30[_0xe873('0x2f')]===_0xe873('0x2e');var _0x559dc9=_0x53593c[_0xe873('0x30')];var _0x5ac9df=_0x3eb631?0x0:_0x374b30['offset'];var _0x9ab5f8=_0x3eb631?_0x53593c[_0xe873('0x30')]:_0x374b30[_0xe873('0x2d')]+_0x374b30[_0xe873('0x2f')];var _0x1bf7df;if(_0x9ab5f8>=_0x559dc9){_0x9ab5f8=_0x559dc9;_0x1bf7df=0xc8;}else{_0x1bf7df=0xce;}_0x4476a7[_0xe873('0x2b')](_0x1bf7df);return _0x4476a7['set']('Content-Range',_0x5ac9df+'-'+_0x9ab5f8+'/'+_0x559dc9)[_0xe873('0x31')](_0x53593c);}return null;};}function patchUpdates(_0x421be5){return function(_0x442505){try{jsonpatch['apply'](_0x442505,_0x421be5,!![]);}catch(_0x4617d8){return BPromise[_0xe873('0x32')](_0x4617d8);}return _0x442505[_0xe873('0x33')]();};}function saveUpdates(_0x416ba0,_0x23fe50){return function(_0x28aa75){if(_0x28aa75){return _0x28aa75['update'](_0x416ba0)[_0xe873('0x34')](function(_0x2f7e7){return _0x2f7e7;});}return null;};}function removeEntity(_0x5d8c63,_0x5241e9){return function(_0x1ce4bb){if(_0x1ce4bb){return _0x1ce4bb['destroy']()[_0xe873('0x34')](function(){var _0x2a36d8=_0x1ce4bb[_0xe873('0x35')]({'plain':!![]});var _0x3d1fec=_0xe873('0x36');return db[_0xe873('0x37')][_0xe873('0x38')]({'where':{'type':_0x3d1fec,'resourceId':_0x2a36d8['id']}})[_0xe873('0x34')](function(){return _0x1ce4bb;});})['then'](function(){_0x5d8c63['status'](0xcc)[_0xe873('0x2c')]();});}};}function handleEntityNotFound(_0x1dea2b,_0x4e1d1b){return function(_0x497cd9){if(!_0x497cd9){_0x1dea2b[_0xe873('0x39')](0x194);}return _0x497cd9;};}function handleError(_0x48fd05,_0x3c560e){_0x3c560e=_0x3c560e||0x1f4;return function(_0x521e17){logger[_0xe873('0x28')](_0x521e17['stack']);if(_0x521e17['name']){delete _0x521e17[_0xe873('0x3a')];}_0x48fd05[_0xe873('0x2b')](_0x3c560e)['send'](_0x521e17);};}exports[_0xe873('0x3b')]=function(_0x2de07b,_0x278b64){var _0x42b6dc={},_0x3ef55e={},_0x2dc8df={'count':0x0,'rows':[]};var _0x5b6b28=_[_0xe873('0x3c')](db['ChatQueue']['rawAttributes'],function(_0x409003){return{'name':_0x409003[_0xe873('0x3d')],'type':_0x409003[_0xe873('0x3e')]['key']};});_0x3ef55e[_0xe873('0x3f')]=_[_0xe873('0x3c')](_0x5b6b28,_0xe873('0x3a'));_0x3ef55e[_0xe873('0x40')]=_['keys'](_0x2de07b[_0xe873('0x40')]);_0x3ef55e['filters']=_[_0xe873('0x41')](_0x3ef55e[_0xe873('0x3f')],_0x3ef55e['query']);_0x42b6dc['attributes']=_['intersection'](_0x3ef55e[_0xe873('0x3f')],qs[_0xe873('0x42')](_0x2de07b['query'][_0xe873('0x42')]));_0x42b6dc['attributes']=_0x42b6dc[_0xe873('0x43')][_0xe873('0x44')]?_0x42b6dc[_0xe873('0x43')]:_0x3ef55e[_0xe873('0x3f')];if(!_0x2de07b['query'][_0xe873('0x45')](_0xe873('0x46'))){_0x42b6dc[_0xe873('0x2f')]=qs[_0xe873('0x2f')](_0x2de07b['query']['limit']);_0x42b6dc[_0xe873('0x2d')]=qs[_0xe873('0x2d')](_0x2de07b['query'][_0xe873('0x2d')]);}_0x42b6dc[_0xe873('0x47')]=qs['sort'](_0x2de07b[_0xe873('0x40')][_0xe873('0x48')]);_0x42b6dc[_0xe873('0x49')]=qs['filters'](_[_0xe873('0x4a')](_0x2de07b[_0xe873('0x40')],_0x3ef55e[_0xe873('0x4b')]),_0x5b6b28);if(_0x2de07b[_0xe873('0x40')][_0xe873('0x4c')]){_0x42b6dc[_0xe873('0x49')]=_['merge'](_0x42b6dc[_0xe873('0x49')],{'$or':_[_0xe873('0x3c')](_0x5b6b28,function(_0x4ad188){if(_0x4ad188['type']!==_0xe873('0x4d')){var _0x491f51={};_0x491f51[_0x4ad188[_0xe873('0x3a')]]={'$like':'%'+_0x2de07b[_0xe873('0x40')][_0xe873('0x4c')]+'%'};return _0x491f51;}})});}_0x42b6dc=_[_0xe873('0x4e')]({},_0x42b6dc,_0x2de07b[_0xe873('0x4f')]);var _0x43dd7a={'where':_0x42b6dc[_0xe873('0x49')]};return db[_0xe873('0x50')][_0xe873('0x30')](_0x43dd7a)['then'](function(_0x165603){_0x2dc8df[_0xe873('0x30')]=_0x165603;if(_0x2de07b['query']['includeAll']){_0x42b6dc['include']=[{'all':!![]}];}return db[_0xe873('0x50')][_0xe873('0x51')](_0x42b6dc);})[_0xe873('0x34')](function(_0x47095b){_0x2dc8df[_0xe873('0x52')]=_0x47095b;return _0x2dc8df;})[_0xe873('0x34')](respondWithFilteredResult(_0x278b64,_0x42b6dc))[_0xe873('0x53')](handleError(_0x278b64,null));};exports['show']=function(_0x186dd4,_0x306cf5){var _0x15deca={'raw':!![],'where':{'id':_0x186dd4[_0xe873('0x54')]['id']}},_0x564fa4={};_0x564fa4[_0xe873('0x3f')]=_['keys'](db['ChatQueue'][_0xe873('0x55')]);_0x564fa4[_0xe873('0x40')]=_[_0xe873('0x56')](_0x186dd4[_0xe873('0x40')]);_0x564fa4[_0xe873('0x4b')]=_['intersection'](_0x564fa4[_0xe873('0x3f')],_0x564fa4['query']);_0x15deca[_0xe873('0x43')]=_[_0xe873('0x41')](_0x564fa4[_0xe873('0x3f')],qs[_0xe873('0x42')](_0x186dd4[_0xe873('0x40')][_0xe873('0x42')]));_0x15deca['attributes']=_0x15deca['attributes'][_0xe873('0x44')]?_0x15deca['attributes']:_0x564fa4[_0xe873('0x3f')];if(_0x186dd4[_0xe873('0x40')][_0xe873('0x57')]){_0x15deca[_0xe873('0x58')]=[{'all':!![]}];}_0x15deca=_[_0xe873('0x4e')]({},_0x15deca,_0x186dd4['options']);return db[_0xe873('0x50')][_0xe873('0x59')](_0x15deca)[_0xe873('0x34')](handleEntityNotFound(_0x306cf5,null))[_0xe873('0x34')](respondWithResult(_0x306cf5,null))[_0xe873('0x53')](handleError(_0x306cf5,null));};exports[_0xe873('0x5a')]=function(_0x1ba37c,_0x117007){return db[_0xe873('0x50')][_0xe873('0x5a')](_0x1ba37c[_0xe873('0x5b')],{})[_0xe873('0x34')](function(_0x283c7c){var _0x4ffd39=_0x1ba37c[_0xe873('0x5c')][_0xe873('0x35')]({'plain':!![]});if(!_0x4ffd39)throw new Error(_0xe873('0x5d'));if(_0x4ffd39[_0xe873('0x5e')]===_0xe873('0x5c')){var _0x38849a=_0x283c7c[_0xe873('0x35')]({'plain':!![]});var _0x4ba7b6=_0xe873('0x36');return db[_0xe873('0x5f')][_0xe873('0x59')]({'where':{'name':_0x4ba7b6,'userProfileId':_0x4ffd39['userProfileId']},'raw':!![]})[_0xe873('0x34')](function(_0x1b59c7){if(_0x1b59c7&&_0x1b59c7[_0xe873('0x60')]===0x0){return db[_0xe873('0x37')][_0xe873('0x5a')]({'name':_0x38849a[_0xe873('0x3a')],'resourceId':_0x38849a['id'],'type':_0x1b59c7[_0xe873('0x3a')],'sectionId':_0x1b59c7['id']},{})['then'](function(){return _0x283c7c;});}else{return _0x283c7c;}})['catch'](function(_0x3e1abb){logger[_0xe873('0x28')](_0xe873('0x61'),_0x3e1abb);throw _0x3e1abb;});}return _0x283c7c;})['then'](respondWithResult(_0x117007,0xc9))[_0xe873('0x53')](handleError(_0x117007,null));};exports[_0xe873('0x62')]=function(_0x211d4a,_0x405ecc){if(_0x211d4a['body']['id']){delete _0x211d4a[_0xe873('0x5b')]['id'];}return db[_0xe873('0x50')][_0xe873('0x59')]({'where':{'id':_0x211d4a[_0xe873('0x54')]['id']}})[_0xe873('0x34')](handleEntityNotFound(_0x405ecc,null))[_0xe873('0x34')](saveUpdates(_0x211d4a[_0xe873('0x5b')],null))[_0xe873('0x34')](respondWithResult(_0x405ecc,null))['catch'](handleError(_0x405ecc,null));};exports['destroy']=function(_0x520ef4,_0x2a5e85){return db[_0xe873('0x50')][_0xe873('0x59')]({'where':{'id':_0x520ef4['params']['id']}})['then'](handleEntityNotFound(_0x2a5e85,null))[_0xe873('0x34')](removeEntity(_0x2a5e85,null))[_0xe873('0x53')](handleError(_0x2a5e85,null));};exports[_0xe873('0x63')]=function(_0x1be4d4,_0x2ec460){return db[_0xe873('0x50')][_0xe873('0x63')]()[_0xe873('0x34')](respondWithResult(_0x2ec460,null))['catch'](handleError(_0x2ec460,null));};exports['getMembers']=function(_0x31dae7,_0x42d814,_0xb92a31){var _0x3e6490={'raw':!![],'where':{}},_0x1bb3d1={},_0x5b4b45;return db[_0xe873('0x50')][_0xe873('0x64')]({'where':{'id':_0x31dae7['params']['id']}})[_0xe873('0x34')](handleEntityNotFound(_0x42d814,null))[_0xe873('0x34')](function(_0x3de3ce){if(_0x3de3ce){_0x5b4b45=_0x3de3ce['get']({'plain':!![]});_0x1bb3d1[_0xe873('0x3f')]=_[_0xe873('0x56')](db[_0xe873('0x65')][_0xe873('0x55')]);_0x1bb3d1[_0xe873('0x40')]=_[_0xe873('0x56')](_0x31dae7[_0xe873('0x40')]);_0x1bb3d1[_0xe873('0x4b')]=_[_0xe873('0x41')](_0x1bb3d1['model'],_0x1bb3d1['query']);_0x3e6490['attributes']=_['intersection'](_0x1bb3d1[_0xe873('0x3f')],qs['fields'](_0x31dae7[_0xe873('0x40')]['fields']));_0x3e6490[_0xe873('0x43')]=_0x3e6490[_0xe873('0x43')][_0xe873('0x44')]?_0x3e6490[_0xe873('0x43')]:_0x1bb3d1[_0xe873('0x3f')];if(!_0x31dae7[_0xe873('0x40')][_0xe873('0x45')](_0xe873('0x46'))){_0x3e6490[_0xe873('0x2f')]=qs[_0xe873('0x2f')](_0x31dae7['query'][_0xe873('0x2f')]);_0x3e6490[_0xe873('0x2d')]=qs[_0xe873('0x2d')](_0x31dae7[_0xe873('0x40')][_0xe873('0x2d')]);}_0x3e6490[_0xe873('0x47')]=qs[_0xe873('0x48')](_0x31dae7[_0xe873('0x40')][_0xe873('0x48')]);_0x3e6490[_0xe873('0x49')]=qs[_0xe873('0x4b')](_[_0xe873('0x4a')](_0x31dae7['query'],_0x1bb3d1[_0xe873('0x4b')]));_0x3e6490[_0xe873('0x49')][_0xe873('0x66')]=_0x3de3ce['id'];if(_0x31dae7[_0xe873('0x40')]['filter']){_0x3e6490['where']=_['merge'](_0x3e6490[_0xe873('0x49')],{'$or':_[_0xe873('0x3c')](_0x3e6490[_0xe873('0x43')],function(_0x58a7da){var _0x383ee4={};_0x383ee4[_0x58a7da]={'$like':'%'+_0x31dae7[_0xe873('0x40')][_0xe873('0x4c')]+'%'};return _0x383ee4;})});}_0x3e6490=_['merge']({},_0x3e6490,_0x31dae7[_0xe873('0x4f')]);return db[_0xe873('0x65')]['findAll'](_0x3e6490);}})['then'](function(_0x4a2335){if(_0x4a2335){return db[_0xe873('0x67')]['findAndCountAll']({'where':{'id':_['map'](_0x4a2335,_0xe873('0x68')),'role':_0xe873('0x69')},'attributes':['id',_0xe873('0x3a'),'chatPause',_0xe873('0x6a'),'createdAt']});}})[_0xe873('0x34')](function(_0x529eb3){if(_0x529eb3){return{'count':_0x529eb3[_0xe873('0x30')],'rows':_['map'](_0x529eb3['rows'],function(_0x5e1213){return{'membername':_0x5e1213[_0xe873('0x3a')],'UserId':_0x5e1213['id'],'queue_name':_0x5b4b45['name'],'ChatQueueId':_0x5b4b45['id'],'interface':util[_0xe873('0x6b')](_0xe873('0x6c'),_0xe873('0x6d'),_0x5e1213['name']),'penalty':0x0,'paused':_0x5e1213[_0xe873('0x6e')],'createdAt':_0x5e1213['createdAt'],'updatedAt':_0x5e1213['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe873('0x34')](respondWithFilteredResult(_0x42d814,_0x3e6490))[_0xe873('0x53')](handleError(_0x42d814,null));};exports[_0xe873('0x6f')]=function(_0x5c414f,_0x4e8816,_0x2e9aa4){var _0x293aba={};var _0x1bad1a={};var _0x4cb319;var _0x46f53c;return db[_0xe873('0x50')][_0xe873('0x64')]({'where':{'id':_0x5c414f[_0xe873('0x54')]['id']}})[_0xe873('0x34')](handleEntityNotFound(_0x4e8816,null))['then'](function(_0x12ddbb){if(_0x12ddbb){_0x4cb319=_0x12ddbb;_0x1bad1a[_0xe873('0x3f')]=_['keys'](db[_0xe873('0x70')][_0xe873('0x55')]);_0x1bad1a[_0xe873('0x40')]=_[_0xe873('0x56')](_0x5c414f[_0xe873('0x40')]);_0x1bad1a[_0xe873('0x4b')]=_[_0xe873('0x41')](_0x1bad1a[_0xe873('0x3f')],_0x1bad1a[_0xe873('0x40')]);_0x293aba[_0xe873('0x43')]=_[_0xe873('0x41')](_0x1bad1a[_0xe873('0x3f')],qs['fields'](_0x5c414f[_0xe873('0x40')]['fields']));_0x293aba[_0xe873('0x43')]=_0x293aba['attributes'][_0xe873('0x44')]?_0x293aba[_0xe873('0x43')]:_0x1bad1a[_0xe873('0x3f')];_0x293aba[_0xe873('0x47')]=qs['sort'](_0x5c414f[_0xe873('0x40')][_0xe873('0x48')]);_0x293aba[_0xe873('0x49')]=qs[_0xe873('0x4b')](_[_0xe873('0x4a')](_0x5c414f['query'],_0x1bad1a[_0xe873('0x4b')]));if(_0x5c414f['query'][_0xe873('0x4c')]){_0x293aba[_0xe873('0x49')]=_[_0xe873('0x4e')](_0x293aba[_0xe873('0x49')],{'$or':_['map'](_0x293aba[_0xe873('0x43')],function(_0x4a683f){var _0x1a3872={};_0x1a3872[_0x4a683f]={'$like':'%'+_0x5c414f[_0xe873('0x40')][_0xe873('0x4c')]+'%'};return _0x1a3872;})});}_0x293aba=_[_0xe873('0x4e')]({},_0x293aba,_0x5c414f[_0xe873('0x4f')]);return _0x4cb319[_0xe873('0x6f')](_0x293aba);}})['then'](function(_0x27dec1){if(_0x27dec1){_0x46f53c=_0x27dec1[_0xe873('0x44')];if(!_0x5c414f[_0xe873('0x40')][_0xe873('0x45')]('nolimit')){_0x293aba[_0xe873('0x2f')]=qs['limit'](_0x5c414f['query'][_0xe873('0x2f')]);_0x293aba[_0xe873('0x2d')]=qs[_0xe873('0x2d')](_0x5c414f[_0xe873('0x40')][_0xe873('0x2d')]);}return _0x4cb319[_0xe873('0x6f')](_0x293aba);}})['then'](function(_0x121944){if(_0x121944){return _0x121944?{'count':_0x46f53c,'rows':_0x121944}:null;}})[_0xe873('0x34')](respondWithResult(_0x4e8816,null))[_0xe873('0x53')](handleError(_0x4e8816,null));};exports[_0xe873('0x71')]=function(_0x5ab3f0,_0x9ccedd,_0x2969ab){var _0x3e81c2=_0x5ab3f0['body']['ids'];return db['Team']['findAll']({'where':{'id':_0x3e81c2},'attributes':['id'],'include':[{'model':db[_0xe873('0x67')],'as':_0xe873('0x72'),'attributes':['id',_0xe873('0x3a'),_0xe873('0x73'),_0xe873('0x74'),_0xe873('0x75')],'raw':!![]}]})[_0xe873('0x34')](function(_0x3842f2){if(_0x3842f2){var _0x54df46=_['flatMap'](_0x3842f2,function(_0x478672){var _0x7e2584=_0x478672[_0xe873('0x35')]({'plain':!![]});return _0x7e2584['Agents'];});return db[_0xe873('0x50')][_0xe873('0x59')]({'where':{'id':_0x5ab3f0[_0xe873('0x54')]['id']}})['then'](function(_0x4bf62e){return db[_0xe873('0x76')][_0xe873('0x77')](function(_0x4c4646){return _0x4bf62e[_0xe873('0x71')](_0x3e81c2,{'transaction':_0x4c4646})[_0xe873('0x34')](function(){return BPromise['each'](_0x54df46,function(_0x4ce36c){return db['UserChatQueue'][_0xe873('0x78')]({'where':{'UserId':_0x4ce36c['id'],'ChatQueueId':_0x5ab3f0['params']['id']},'transaction':_0x4c4646});});})[_0xe873('0x34')](function(){_0x54df46['forEach'](function(_0x54987a){socket['emit']('userChatQueue:save',{'UserId':_0x54987a['id'],'ChatQueueId':_0x4bf62e['id']});});});});});}})['then'](respondWithStatusCode(_0x9ccedd,null))[_0xe873('0x53')](handleError(_0x9ccedd,null));};exports[_0xe873('0x79')]=function(_0x270664,_0x402467,_0x300c63){return db[_0xe873('0x70')][_0xe873('0x51')]({'where':{'id':_0x270664[_0xe873('0x40')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe873('0x67')],'as':_0xe873('0x72'),'attributes':['id'],'raw':!![]}]})[_0xe873('0x34')](handleEntityNotFound(_0x402467,null))[_0xe873('0x34')](function(_0x22c0f7){var _0x50af55=_[_0xe873('0x3c')](_0x22c0f7,'id');var _0x4cec5b=[];var _0x55208a=[];var _0x5557b0=squel['select']();_0x5557b0[_0xe873('0x7a')](_0xe873('0x7b'))[_0xe873('0x7c')](_0xe873('0x7d'),'tq')[_0xe873('0x7e')](_0xe873('0x7f'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe873('0x49')]('ChatQueueId\x20=\x20?',_0x270664[_0xe873('0x54')]['id']);for(var _0x43e831=0x0;_0x43e831<_0x22c0f7['length'];_0x43e831+=0x1){let _0x52d909=_0x22c0f7[_0x43e831];for(var _0x2ed74a=0x0;_0x2ed74a<_0x52d909[_0xe873('0x72')][_0xe873('0x44')];_0x2ed74a+=0x1){let _0x509dd5=_0x52d909[_0xe873('0x72')][_0x2ed74a];var _0x412d39=_0x5557b0[_0xe873('0x80')]();_0x412d39[_0xe873('0x49')](_0xe873('0x81'),_0x509dd5['id']);_0x55208a['push'](db[_0xe873('0x76')][_0xe873('0x40')](_0x412d39['toString'](),{'type':db[_0xe873('0x76')][_0xe873('0x82')][_0xe873('0x83')]})['then'](function(_0x25aa23){if(_0x25aa23['length']===0x1){return _0x509dd5['id'];}else{var _0x3c2839=_[_0xe873('0x84')](_['map'](_0x25aa23,_0xe873('0x85')),function(_0x3d50a4){return _['includes'](_0x50af55,_0x3d50a4);});if(_0x3c2839){return _0x509dd5['id'];}}}));}}return BPromise[_0xe873('0x86')](_0x55208a)[_0xe873('0x34')](function(_0x401fa9){_0x4cec5b=_(_0x4cec5b)[_0xe873('0x87')](_0x401fa9)[_0xe873('0x88')]()[_0xe873('0x89')]();return db[_0xe873('0x50')]['find']({'where':{'id':_0x270664[_0xe873('0x54')]['id']}})[_0xe873('0x34')](function(_0x45ea46){return db['sequelize'][_0xe873('0x77')](function(_0x29b4ce){return _0x45ea46['removeTeams'](_0x270664[_0xe873('0x40')][_0xe873('0x8a')],{'transaction':_0x29b4ce})[_0xe873('0x34')](function(){if(!_[_0xe873('0x8b')](_0x4cec5b)){return _0x45ea46['removeAgents'](_0x4cec5b,{'transaction':_0x29b4ce});}})[_0xe873('0x34')](function(){_0x4cec5b['forEach'](function(_0x1bc305){socket[_0xe873('0x8c')](_0xe873('0x8d'),{'UserId':_0x1bc305,'ChatQueueId':_0x45ea46['id']});});});});});});})[_0xe873('0x34')](respondWithStatusCode(_0x402467,null))[_0xe873('0x53')](handleError(_0x402467,null));};exports[_0xe873('0x8e')]=function(_0x1e5403,_0x3f129e,_0x5ccb6d){return db[_0xe873('0x50')][_0xe873('0x59')]({'where':{'id':_0x1e5403[_0xe873('0x54')]['id']}})['then'](handleEntityNotFound(_0x3f129e,null))['then'](function(_0x41483a){if(_0x41483a){return _0x41483a[_0xe873('0x8e')](_0x1e5403[_0xe873('0x5b')]['ids'],_['omit'](_0x1e5403[_0xe873('0x5b')],[_0xe873('0x8a'),'id'])||{})[_0xe873('0x8f')](function(_0x5669e2){for(var _0x1ab317=0x0;_0x1ab317<_0x1e5403[_0xe873('0x5b')]['ids']['length'];_0x1ab317+=0x1){socket[_0xe873('0x8c')](_0xe873('0x90'),{'UserId':Number(_0x1e5403[_0xe873('0x5b')][_0xe873('0x8a')][_0x1ab317]),'ChatQueueId':Number(_0x1e5403[_0xe873('0x54')]['id'])});}return _0x5669e2;});}})[_0xe873('0x34')](respondWithResult(_0x3f129e,null))[_0xe873('0x53')](handleError(_0x3f129e,null));};exports['removeAgents']=function(_0x46b9d9,_0x425bba,_0x164a97){return db['ChatQueue'][_0xe873('0x59')]({'where':{'id':_0x46b9d9[_0xe873('0x54')]['id']}})[_0xe873('0x34')](handleEntityNotFound(_0x425bba,null))[_0xe873('0x34')](function(_0x1e4b5e){if(_0x1e4b5e){return _0x1e4b5e['removeAgents'](_0x46b9d9[_0xe873('0x40')][_0xe873('0x8a')])['then'](function(){if(_[_0xe873('0x91')](_0x46b9d9['query'][_0xe873('0x8a')])){for(var _0x3136be=0x0;_0x3136be<_0x46b9d9[_0xe873('0x40')]['ids'][_0xe873('0x44')];_0x3136be+=0x1){socket[_0xe873('0x8c')](_0xe873('0x8d'),{'UserId':Number(_0x46b9d9[_0xe873('0x40')][_0xe873('0x8a')][_0x3136be]),'ChatQueueId':Number(_0x46b9d9['params']['id'])});}}else{socket[_0xe873('0x8c')](_0xe873('0x8d'),{'UserId':Number(_0x46b9d9[_0xe873('0x40')][_0xe873('0x8a')]),'ChatQueueId':Number(_0x46b9d9[_0xe873('0x54')]['id'])});}});}})[_0xe873('0x34')](respondWithStatusCode(_0x425bba,null))[_0xe873('0x53')](handleError(_0x425bba,null));};exports[_0xe873('0x92')]=function(_0x13043d,_0x2bf10d,_0x478b22){var _0x5781ce={};var _0x4fbf45={};var _0x4ee040;var _0xf8b345;return db['ChatQueue']['findOne']({'where':{'id':_0x13043d['params']['id']}})[_0xe873('0x34')](handleEntityNotFound(_0x2bf10d,null))['then'](function(_0x5748fa){if(_0x5748fa){_0x4ee040=_0x5748fa;_0x4fbf45[_0xe873('0x3f')]=_[_0xe873('0x56')](db['User'][_0xe873('0x55')]);_0x4fbf45['query']=_[_0xe873('0x56')](_0x13043d[_0xe873('0x40')]);_0x4fbf45[_0xe873('0x4b')]=_[_0xe873('0x41')](_0x4fbf45['model'],_0x4fbf45[_0xe873('0x40')]);_0x5781ce['attributes']=_[_0xe873('0x41')](_0x4fbf45[_0xe873('0x3f')],qs[_0xe873('0x42')](_0x13043d[_0xe873('0x40')][_0xe873('0x42')]));_0x5781ce[_0xe873('0x43')]=_0x5781ce[_0xe873('0x43')][_0xe873('0x44')]?_0x5781ce[_0xe873('0x43')]:_0x4fbf45[_0xe873('0x3f')];_0x5781ce[_0xe873('0x47')]=qs[_0xe873('0x48')](_0x13043d[_0xe873('0x40')]['sort']);_0x5781ce[_0xe873('0x49')]=qs[_0xe873('0x4b')](_[_0xe873('0x4a')](_0x13043d[_0xe873('0x40')],_0x4fbf45['filters']));if(_0x13043d[_0xe873('0x40')][_0xe873('0x4c')]){_0x5781ce['where']=_[_0xe873('0x4e')](_0x5781ce['where'],{'$or':_['map'](_0x5781ce[_0xe873('0x43')],function(_0x3e2633){var _0xe5b8ed={};_0xe5b8ed[_0x3e2633]={'$like':'%'+_0x13043d[_0xe873('0x40')][_0xe873('0x4c')]+'%'};return _0xe5b8ed;})});}_0x5781ce=_[_0xe873('0x4e')]({},_0x5781ce,_0x13043d[_0xe873('0x4f')]);return _0x4ee040[_0xe873('0x92')](_0x5781ce);}})[_0xe873('0x34')](function(_0x13e1ea){if(_0x13e1ea){_0xf8b345=_0x13e1ea[_0xe873('0x44')];if(!_0x13043d[_0xe873('0x40')][_0xe873('0x45')]('nolimit')){_0x5781ce[_0xe873('0x2f')]=qs[_0xe873('0x2f')](_0x13043d[_0xe873('0x40')]['limit']);_0x5781ce[_0xe873('0x2d')]=qs[_0xe873('0x2d')](_0x13043d[_0xe873('0x40')][_0xe873('0x2d')]);}return _0x4ee040[_0xe873('0x92')](_0x5781ce);}})[_0xe873('0x34')](function(_0x32eef5){if(_0x32eef5){return _0x32eef5?{'count':_0xf8b345,'rows':_0x32eef5}:null;}})[_0xe873('0x34')](respondWithResult(_0x2bf10d,null))[_0xe873('0x53')](handleError(_0x2bf10d,null));}; \ No newline at end of file +var _0xe2ac=['path','ejs','fs-extra','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','end','stack','name','send','index','ChatQueue','key','query','filters','intersection','model','attributes','fields','length','sort','where','filter','map','type','includeAll','include','rows','show','params','keys','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','rawAttributes','hasOwnProperty','nolimit','order','pick','ChatQueueId','User','findAndCountAll','UserId','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','findAll','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','ids','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','userChatQueue:save','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xe2ac,0x1c6));var _0xce2a=function(_0x16337a,_0x4789a1){_0x16337a=_0x16337a-0x0;var _0x422365=_0xe2ac[_0x16337a];return _0x422365;};'use strict';var emlformat=require(_0xce2a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce2a('0x1'));var jsonpatch=require(_0xce2a('0x2'));var rp=require(_0xce2a('0x3'));var moment=require(_0xce2a('0x4'));var BPromise=require(_0xce2a('0x5'));var Mustache=require(_0xce2a('0x6'));var util=require(_0xce2a('0x7'));var path=require(_0xce2a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xce2a('0x9'));var fs=require('fs');var fs_extra=require(_0xce2a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xce2a('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xce2a('0xc'));var querystring=require(_0xce2a('0xd'));var Papa=require('papaparse');var Redis=require(_0xce2a('0xe'));var authService=require(_0xce2a('0xf'));var qs=require(_0xce2a('0x10'));var as=require(_0xce2a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xce2a('0x12'));var utils=require(_0xce2a('0x13'));var config=require(_0xce2a('0x14'));var licenseUtil=require(_0xce2a('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xce2a('0x16')](config[_0xce2a('0x17')],{'host':_0xce2a('0x18'),'port':0x18eb});var socket=require(_0xce2a('0x19'))(new Redis(config['redis']));require(_0xce2a('0x1a'))[_0xce2a('0x1b')](socket);var jayson=require(_0xce2a('0x1c'));var client=jayson[_0xce2a('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2191f0,_0x52e2e6,_0x2d0e7f,_0x1b20db){return new BPromise(function(_0x16e7b2,_0x38ff92){var _0xbb3509=_0x1b20db||client;return _0xbb3509['request'](_0x2191f0,_0x2d0e7f)[_0xce2a('0x1e')](function(_0x1a5ed9){logger[_0xce2a('0x1f')](_0xce2a('0x20'),_0x52e2e6,'request\x20sent');logger[_0xce2a('0x21')](_0xce2a('0x22'),_0x52e2e6,_0xce2a('0x23'),JSON['stringify'](_0x1a5ed9));if(_0x1a5ed9['error']){if(_0x1a5ed9['error']['code']===0x1f4){logger[_0xce2a('0x24')]('ChatQueue,\x20%s,\x20%s',_0x52e2e6,_0x1a5ed9[_0xce2a('0x24')][_0xce2a('0x25')]);return _0x38ff92(_0x1a5ed9[_0xce2a('0x24')][_0xce2a('0x25')]);}logger[_0xce2a('0x24')](_0xce2a('0x20'),_0x52e2e6,_0x1a5ed9[_0xce2a('0x24')][_0xce2a('0x25')]);return _0x16e7b2(_0x1a5ed9[_0xce2a('0x24')][_0xce2a('0x25')]);}else{logger[_0xce2a('0x1f')](_0xce2a('0x20'),_0x52e2e6,_0xce2a('0x23'));_0x16e7b2(_0x1a5ed9['result'][_0xce2a('0x25')]);}})['catch'](function(_0x29728a){logger[_0xce2a('0x24')](_0xce2a('0x20'),_0x52e2e6,_0x29728a);_0x38ff92(_0x29728a);});});}function respondWithStatusCode(_0x5d5148,_0x251bae){_0x251bae=_0x251bae||0xcc;return function(_0x254a75){if(_0x254a75){return _0x5d5148[_0xce2a('0x26')](_0x251bae);}return _0x5d5148['status'](_0x251bae)['end']();};}function respondWithResult(_0x3da6d5,_0x574f3d){_0x574f3d=_0x574f3d||0xc8;return function(_0x45b9ad){if(_0x45b9ad){return _0x3da6d5[_0xce2a('0x27')](_0x574f3d)[_0xce2a('0x28')](_0x45b9ad);}};}function respondWithFilteredResult(_0x3feaec,_0x5a0a6c){return function(_0xf22392){if(_0xf22392){var _0x2943ea=typeof _0x5a0a6c['offset']===_0xce2a('0x29')&&typeof _0x5a0a6c['limit']==='undefined';var _0x51d5a6=_0xf22392[_0xce2a('0x2a')];var _0x28dfda=_0x2943ea?0x0:_0x5a0a6c[_0xce2a('0x2b')];var _0x199c00=_0x2943ea?_0xf22392[_0xce2a('0x2a')]:_0x5a0a6c['offset']+_0x5a0a6c[_0xce2a('0x2c')];var _0x58c36b;if(_0x199c00>=_0x51d5a6){_0x199c00=_0x51d5a6;_0x58c36b=0xc8;}else{_0x58c36b=0xce;}_0x3feaec[_0xce2a('0x27')](_0x58c36b);return _0x3feaec[_0xce2a('0x2d')](_0xce2a('0x2e'),_0x28dfda+'-'+_0x199c00+'/'+_0x51d5a6)[_0xce2a('0x28')](_0xf22392);}return null;};}function patchUpdates(_0x2b63b0){return function(_0x5bf14b){try{jsonpatch[_0xce2a('0x2f')](_0x5bf14b,_0x2b63b0,!![]);}catch(_0x62332c){return BPromise[_0xce2a('0x30')](_0x62332c);}return _0x5bf14b[_0xce2a('0x31')]();};}function saveUpdates(_0x26c9dd,_0x3b8ab9){return function(_0x5d9342){if(_0x5d9342){return _0x5d9342[_0xce2a('0x32')](_0x26c9dd)[_0xce2a('0x1e')](function(_0x58e8da){return _0x58e8da;});}return null;};}function removeEntity(_0x29b00e,_0x282a3d){return function(_0x317b45){if(_0x317b45){return _0x317b45[_0xce2a('0x33')]()[_0xce2a('0x1e')](function(){var _0x13627e=_0x317b45[_0xce2a('0x34')]({'plain':!![]});var _0x41ee11=_0xce2a('0x35');return db['UserProfileResource'][_0xce2a('0x33')]({'where':{'type':_0x41ee11,'resourceId':_0x13627e['id']}})[_0xce2a('0x1e')](function(){return _0x317b45;});})[_0xce2a('0x1e')](function(){_0x29b00e[_0xce2a('0x27')](0xcc)[_0xce2a('0x36')]();});}};}function handleEntityNotFound(_0x3eece1,_0x3a3c0b){return function(_0xbc0bb4){if(!_0xbc0bb4){_0x3eece1[_0xce2a('0x26')](0x194);}return _0xbc0bb4;};}function handleError(_0x5d98f9,_0x64f6ba){_0x64f6ba=_0x64f6ba||0x1f4;return function(_0x3737b9){logger[_0xce2a('0x24')](_0x3737b9[_0xce2a('0x37')]);if(_0x3737b9[_0xce2a('0x38')]){delete _0x3737b9[_0xce2a('0x38')];}_0x5d98f9[_0xce2a('0x27')](_0x64f6ba)[_0xce2a('0x39')](_0x3737b9);};}exports[_0xce2a('0x3a')]=function(_0x2d69b8,_0x4044d7){var _0x1a0adf={},_0x116f2d={},_0x2611bc={'count':0x0,'rows':[]};var _0x30b0d8=_['map'](db[_0xce2a('0x3b')]['rawAttributes'],function(_0x3dbb18){return{'name':_0x3dbb18['fieldName'],'type':_0x3dbb18['type'][_0xce2a('0x3c')]};});_0x116f2d['model']=_['map'](_0x30b0d8,_0xce2a('0x38'));_0x116f2d['query']=_['keys'](_0x2d69b8[_0xce2a('0x3d')]);_0x116f2d[_0xce2a('0x3e')]=_[_0xce2a('0x3f')](_0x116f2d[_0xce2a('0x40')],_0x116f2d[_0xce2a('0x3d')]);_0x1a0adf[_0xce2a('0x41')]=_[_0xce2a('0x3f')](_0x116f2d[_0xce2a('0x40')],qs[_0xce2a('0x42')](_0x2d69b8['query'][_0xce2a('0x42')]));_0x1a0adf[_0xce2a('0x41')]=_0x1a0adf[_0xce2a('0x41')][_0xce2a('0x43')]?_0x1a0adf['attributes']:_0x116f2d['model'];if(!_0x2d69b8[_0xce2a('0x3d')]['hasOwnProperty']('nolimit')){_0x1a0adf[_0xce2a('0x2c')]=qs[_0xce2a('0x2c')](_0x2d69b8['query']['limit']);_0x1a0adf[_0xce2a('0x2b')]=qs[_0xce2a('0x2b')](_0x2d69b8[_0xce2a('0x3d')][_0xce2a('0x2b')]);}_0x1a0adf['order']=qs[_0xce2a('0x44')](_0x2d69b8[_0xce2a('0x3d')][_0xce2a('0x44')]);_0x1a0adf[_0xce2a('0x45')]=qs[_0xce2a('0x3e')](_['pick'](_0x2d69b8[_0xce2a('0x3d')],_0x116f2d[_0xce2a('0x3e')]),_0x30b0d8);if(_0x2d69b8[_0xce2a('0x3d')][_0xce2a('0x46')]){_0x1a0adf[_0xce2a('0x45')]=_['merge'](_0x1a0adf['where'],{'$or':_[_0xce2a('0x47')](_0x30b0d8,function(_0x2d2ce1){if(_0x2d2ce1[_0xce2a('0x48')]!=='VIRTUAL'){var _0x479e58={};_0x479e58[_0x2d2ce1[_0xce2a('0x38')]]={'$like':'%'+_0x2d69b8[_0xce2a('0x3d')][_0xce2a('0x46')]+'%'};return _0x479e58;}})});}_0x1a0adf=_['merge']({},_0x1a0adf,_0x2d69b8['options']);var _0x2f2f84={'where':_0x1a0adf[_0xce2a('0x45')]};return db['ChatQueue'][_0xce2a('0x2a')](_0x2f2f84)['then'](function(_0x6436c0){_0x2611bc[_0xce2a('0x2a')]=_0x6436c0;if(_0x2d69b8[_0xce2a('0x3d')][_0xce2a('0x49')]){_0x1a0adf[_0xce2a('0x4a')]=[{'all':!![]}];}return db[_0xce2a('0x3b')]['findAll'](_0x1a0adf);})['then'](function(_0x5094fb){_0x2611bc[_0xce2a('0x4b')]=_0x5094fb;return _0x2611bc;})[_0xce2a('0x1e')](respondWithFilteredResult(_0x4044d7,_0x1a0adf))['catch'](handleError(_0x4044d7,null));};exports[_0xce2a('0x4c')]=function(_0x3da90b,_0x537d4e){var _0x4e8369={'raw':!![],'where':{'id':_0x3da90b[_0xce2a('0x4d')]['id']}},_0x511def={};_0x511def[_0xce2a('0x40')]=_[_0xce2a('0x4e')](db[_0xce2a('0x3b')]['rawAttributes']);_0x511def[_0xce2a('0x3d')]=_[_0xce2a('0x4e')](_0x3da90b['query']);_0x511def['filters']=_[_0xce2a('0x3f')](_0x511def[_0xce2a('0x40')],_0x511def['query']);_0x4e8369[_0xce2a('0x41')]=_[_0xce2a('0x3f')](_0x511def['model'],qs['fields'](_0x3da90b[_0xce2a('0x3d')][_0xce2a('0x42')]));_0x4e8369[_0xce2a('0x41')]=_0x4e8369['attributes'][_0xce2a('0x43')]?_0x4e8369[_0xce2a('0x41')]:_0x511def[_0xce2a('0x40')];if(_0x3da90b[_0xce2a('0x3d')][_0xce2a('0x49')]){_0x4e8369['include']=[{'all':!![]}];}_0x4e8369=_[_0xce2a('0x4f')]({},_0x4e8369,_0x3da90b[_0xce2a('0x50')]);return db[_0xce2a('0x3b')][_0xce2a('0x51')](_0x4e8369)[_0xce2a('0x1e')](handleEntityNotFound(_0x537d4e,null))[_0xce2a('0x1e')](respondWithResult(_0x537d4e,null))['catch'](handleError(_0x537d4e,null));};exports[_0xce2a('0x52')]=function(_0x3e744a,_0x464936){return db[_0xce2a('0x3b')][_0xce2a('0x52')](_0x3e744a[_0xce2a('0x53')],{})[_0xce2a('0x1e')](function(_0x2aaf80){var _0x4fb629=_0x3e744a[_0xce2a('0x54')]['get']({'plain':!![]});if(!_0x4fb629)throw new Error(_0xce2a('0x55'));if(_0x4fb629[_0xce2a('0x56')]===_0xce2a('0x54')){var _0x3f65ec=_0x2aaf80['get']({'plain':!![]});var _0x2c6d9e=_0xce2a('0x35');return db[_0xce2a('0x57')]['find']({'where':{'name':_0x2c6d9e,'userProfileId':_0x4fb629['userProfileId']},'raw':!![]})[_0xce2a('0x1e')](function(_0x487208){if(_0x487208&&_0x487208[_0xce2a('0x58')]===0x0){return db[_0xce2a('0x59')][_0xce2a('0x52')]({'name':_0x3f65ec[_0xce2a('0x38')],'resourceId':_0x3f65ec['id'],'type':_0x487208[_0xce2a('0x38')],'sectionId':_0x487208['id']},{})['then'](function(){return _0x2aaf80;});}else{return _0x2aaf80;}})[_0xce2a('0x5a')](function(_0x33c3fa){logger[_0xce2a('0x24')](_0xce2a('0x5b'),_0x33c3fa);throw _0x33c3fa;});}return _0x2aaf80;})['then'](respondWithResult(_0x464936,0xc9))['catch'](handleError(_0x464936,null));};exports[_0xce2a('0x32')]=function(_0x647111,_0x32bfd1){if(_0x647111[_0xce2a('0x53')]['id']){delete _0x647111[_0xce2a('0x53')]['id'];}return db['ChatQueue'][_0xce2a('0x51')]({'where':{'id':_0x647111[_0xce2a('0x4d')]['id']}})[_0xce2a('0x1e')](handleEntityNotFound(_0x32bfd1,null))[_0xce2a('0x1e')](saveUpdates(_0x647111[_0xce2a('0x53')],null))[_0xce2a('0x1e')](respondWithResult(_0x32bfd1,null))[_0xce2a('0x5a')](handleError(_0x32bfd1,null));};exports[_0xce2a('0x33')]=function(_0x2d1aed,_0x2b19f2){return db['ChatQueue'][_0xce2a('0x51')]({'where':{'id':_0x2d1aed[_0xce2a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2b19f2,null))[_0xce2a('0x1e')](removeEntity(_0x2b19f2,null))[_0xce2a('0x5a')](handleError(_0x2b19f2,null));};exports[_0xce2a('0x5c')]=function(_0x3e06b2,_0x31cd1b){return db[_0xce2a('0x3b')]['describe']()[_0xce2a('0x1e')](respondWithResult(_0x31cd1b,null))[_0xce2a('0x5a')](handleError(_0x31cd1b,null));};exports[_0xce2a('0x5d')]=function(_0xa26b82,_0x27636d,_0x535dcc){var _0x1e966c={'raw':!![],'where':{}},_0x3f2335={},_0x28710e;return db[_0xce2a('0x3b')][_0xce2a('0x5e')]({'where':{'id':_0xa26b82[_0xce2a('0x4d')]['id']}})[_0xce2a('0x1e')](handleEntityNotFound(_0x27636d,null))[_0xce2a('0x1e')](function(_0x3481f1){if(_0x3481f1){_0x28710e=_0x3481f1[_0xce2a('0x34')]({'plain':!![]});_0x3f2335[_0xce2a('0x40')]=_[_0xce2a('0x4e')](db[_0xce2a('0x5f')][_0xce2a('0x60')]);_0x3f2335[_0xce2a('0x3d')]=_[_0xce2a('0x4e')](_0xa26b82[_0xce2a('0x3d')]);_0x3f2335[_0xce2a('0x3e')]=_[_0xce2a('0x3f')](_0x3f2335[_0xce2a('0x40')],_0x3f2335[_0xce2a('0x3d')]);_0x1e966c[_0xce2a('0x41')]=_['intersection'](_0x3f2335[_0xce2a('0x40')],qs[_0xce2a('0x42')](_0xa26b82[_0xce2a('0x3d')]['fields']));_0x1e966c['attributes']=_0x1e966c[_0xce2a('0x41')][_0xce2a('0x43')]?_0x1e966c['attributes']:_0x3f2335[_0xce2a('0x40')];if(!_0xa26b82[_0xce2a('0x3d')][_0xce2a('0x61')](_0xce2a('0x62'))){_0x1e966c[_0xce2a('0x2c')]=qs['limit'](_0xa26b82['query'][_0xce2a('0x2c')]);_0x1e966c[_0xce2a('0x2b')]=qs[_0xce2a('0x2b')](_0xa26b82['query'][_0xce2a('0x2b')]);}_0x1e966c[_0xce2a('0x63')]=qs['sort'](_0xa26b82['query'][_0xce2a('0x44')]);_0x1e966c[_0xce2a('0x45')]=qs[_0xce2a('0x3e')](_[_0xce2a('0x64')](_0xa26b82[_0xce2a('0x3d')],_0x3f2335[_0xce2a('0x3e')]));_0x1e966c[_0xce2a('0x45')][_0xce2a('0x65')]=_0x3481f1['id'];if(_0xa26b82['query'][_0xce2a('0x46')]){_0x1e966c[_0xce2a('0x45')]=_[_0xce2a('0x4f')](_0x1e966c['where'],{'$or':_[_0xce2a('0x47')](_0x1e966c[_0xce2a('0x41')],function(_0x3f2f25){var _0x1331f5={};_0x1331f5[_0x3f2f25]={'$like':'%'+_0xa26b82[_0xce2a('0x3d')]['filter']+'%'};return _0x1331f5;})});}_0x1e966c=_['merge']({},_0x1e966c,_0xa26b82[_0xce2a('0x50')]);return db['UserChatQueue']['findAll'](_0x1e966c);}})['then'](function(_0x1b4dbc){if(_0x1b4dbc){return db[_0xce2a('0x66')][_0xce2a('0x67')]({'where':{'id':_['map'](_0x1b4dbc,_0xce2a('0x68')),'role':'agent'},'attributes':['id','name',_0xce2a('0x69'),_0xce2a('0x6a'),_0xce2a('0x6b')]});}})['then'](function(_0x55c509){if(_0x55c509){return{'count':_0x55c509[_0xce2a('0x2a')],'rows':_['map'](_0x55c509[_0xce2a('0x4b')],function(_0x3057d6){return{'membername':_0x3057d6[_0xce2a('0x38')],'UserId':_0x3057d6['id'],'queue_name':_0x28710e[_0xce2a('0x38')],'ChatQueueId':_0x28710e['id'],'interface':util[_0xce2a('0x6c')](_0xce2a('0x6d'),_0xce2a('0x6e'),_0x3057d6['name']),'penalty':0x0,'paused':_0x3057d6[_0xce2a('0x69')],'createdAt':_0x3057d6['createdAt'],'updatedAt':_0x3057d6[_0xce2a('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xce2a('0x1e')](respondWithFilteredResult(_0x27636d,_0x1e966c))[_0xce2a('0x5a')](handleError(_0x27636d,null));};exports[_0xce2a('0x6f')]=function(_0x5e6115,_0x22f62f,_0x59fc59){var _0x35f9a3={};var _0x237306={};var _0x1cd8c4;var _0x37e4d3;return db[_0xce2a('0x3b')]['findOne']({'where':{'id':_0x5e6115[_0xce2a('0x4d')]['id']}})[_0xce2a('0x1e')](handleEntityNotFound(_0x22f62f,null))['then'](function(_0x9d0693){if(_0x9d0693){_0x1cd8c4=_0x9d0693;_0x237306[_0xce2a('0x40')]=_['keys'](db[_0xce2a('0x70')][_0xce2a('0x60')]);_0x237306[_0xce2a('0x3d')]=_['keys'](_0x5e6115[_0xce2a('0x3d')]);_0x237306[_0xce2a('0x3e')]=_[_0xce2a('0x3f')](_0x237306[_0xce2a('0x40')],_0x237306['query']);_0x35f9a3[_0xce2a('0x41')]=_[_0xce2a('0x3f')](_0x237306[_0xce2a('0x40')],qs[_0xce2a('0x42')](_0x5e6115[_0xce2a('0x3d')]['fields']));_0x35f9a3[_0xce2a('0x41')]=_0x35f9a3['attributes']['length']?_0x35f9a3[_0xce2a('0x41')]:_0x237306[_0xce2a('0x40')];_0x35f9a3['order']=qs['sort'](_0x5e6115[_0xce2a('0x3d')]['sort']);_0x35f9a3[_0xce2a('0x45')]=qs['filters'](_[_0xce2a('0x64')](_0x5e6115[_0xce2a('0x3d')],_0x237306['filters']));if(_0x5e6115[_0xce2a('0x3d')]['filter']){_0x35f9a3[_0xce2a('0x45')]=_[_0xce2a('0x4f')](_0x35f9a3[_0xce2a('0x45')],{'$or':_[_0xce2a('0x47')](_0x35f9a3[_0xce2a('0x41')],function(_0x29f4de){var _0x56b30c={};_0x56b30c[_0x29f4de]={'$like':'%'+_0x5e6115['query'][_0xce2a('0x46')]+'%'};return _0x56b30c;})});}_0x35f9a3=_[_0xce2a('0x4f')]({},_0x35f9a3,_0x5e6115[_0xce2a('0x50')]);return _0x1cd8c4[_0xce2a('0x6f')](_0x35f9a3);}})[_0xce2a('0x1e')](function(_0x2b3896){if(_0x2b3896){_0x37e4d3=_0x2b3896[_0xce2a('0x43')];if(!_0x5e6115[_0xce2a('0x3d')][_0xce2a('0x61')](_0xce2a('0x62'))){_0x35f9a3[_0xce2a('0x2c')]=qs[_0xce2a('0x2c')](_0x5e6115[_0xce2a('0x3d')]['limit']);_0x35f9a3[_0xce2a('0x2b')]=qs[_0xce2a('0x2b')](_0x5e6115[_0xce2a('0x3d')]['offset']);}return _0x1cd8c4[_0xce2a('0x6f')](_0x35f9a3);}})[_0xce2a('0x1e')](function(_0x243181){if(_0x243181){return _0x243181?{'count':_0x37e4d3,'rows':_0x243181}:null;}})[_0xce2a('0x1e')](respondWithResult(_0x22f62f,null))[_0xce2a('0x5a')](handleError(_0x22f62f,null));};exports[_0xce2a('0x71')]=function(_0x517d5a,_0x471be7,_0x54a4d7){var _0x36e40b=_0x517d5a['body']['ids'];return db[_0xce2a('0x70')][_0xce2a('0x72')]({'where':{'id':_0x36e40b},'attributes':['id'],'include':[{'model':db['User'],'as':_0xce2a('0x73'),'attributes':['id',_0xce2a('0x38'),_0xce2a('0x74'),_0xce2a('0x75'),'interface'],'raw':!![]}]})[_0xce2a('0x1e')](function(_0x8f333a){if(_0x8f333a){var _0x219513=_[_0xce2a('0x76')](_0x8f333a,function(_0x2d3f15){var _0x1e06a8=_0x2d3f15[_0xce2a('0x34')]({'plain':!![]});return _0x1e06a8['Agents'];});return db['ChatQueue'][_0xce2a('0x51')]({'where':{'id':_0x517d5a['params']['id']}})[_0xce2a('0x1e')](function(_0x6ef311){return db[_0xce2a('0x77')][_0xce2a('0x78')](function(_0x1a1070){return _0x6ef311[_0xce2a('0x71')](_0x36e40b,{'transaction':_0x1a1070})[_0xce2a('0x1e')](function(){return BPromise[_0xce2a('0x79')](_0x219513,function(_0x2c4eec){return db[_0xce2a('0x5f')][_0xce2a('0x7a')]({'where':{'UserId':_0x2c4eec['id'],'ChatQueueId':_0x517d5a[_0xce2a('0x4d')]['id']},'transaction':_0x1a1070});});})[_0xce2a('0x1e')](function(){_0x219513[_0xce2a('0x7b')](function(_0x527c2c){socket[_0xce2a('0x7c')]('userChatQueue:save',{'UserId':_0x527c2c['id'],'ChatQueueId':_0x6ef311['id']});});});});});}})[_0xce2a('0x1e')](respondWithStatusCode(_0x471be7,null))[_0xce2a('0x5a')](handleError(_0x471be7,null));};exports[_0xce2a('0x7d')]=function(_0x146bf0,_0x3629a9,_0x5ab2d4){return db[_0xce2a('0x70')][_0xce2a('0x72')]({'where':{'id':_0x146bf0[_0xce2a('0x3d')][_0xce2a('0x7e')]},'attributes':['id'],'include':[{'model':db[_0xce2a('0x66')],'as':_0xce2a('0x73'),'attributes':['id'],'raw':!![]}]})[_0xce2a('0x1e')](handleEntityNotFound(_0x3629a9,null))['then'](function(_0x5589ca){var _0x203e05=_[_0xce2a('0x47')](_0x5589ca,'id');var _0x4da4e2=[];var _0x595abc=[];var _0x5e7bba=squel[_0xce2a('0x7f')]();_0x5e7bba[_0xce2a('0x80')](_0xce2a('0x81'))[_0xce2a('0x82')](_0xce2a('0x83'),'tq')[_0xce2a('0x84')](_0xce2a('0x85'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xce2a('0x45')]('ChatQueueId\x20=\x20?',_0x146bf0[_0xce2a('0x4d')]['id']);for(var _0x583650=0x0;_0x583650<_0x5589ca[_0xce2a('0x43')];_0x583650+=0x1){let _0x5269cc=_0x5589ca[_0x583650];for(var _0x325506=0x0;_0x325506<_0x5269cc[_0xce2a('0x73')][_0xce2a('0x43')];_0x325506+=0x1){let _0x2b008a=_0x5269cc['Agents'][_0x325506];var _0x4d0423=_0x5e7bba[_0xce2a('0x86')]();_0x4d0423['where'](_0xce2a('0x87'),_0x2b008a['id']);_0x595abc[_0xce2a('0x88')](db[_0xce2a('0x77')][_0xce2a('0x3d')](_0x4d0423[_0xce2a('0x89')](),{'type':db[_0xce2a('0x77')][_0xce2a('0x8a')][_0xce2a('0x8b')]})['then'](function(_0x10bf92){if(_0x10bf92['length']===0x1){return _0x2b008a['id'];}else{var _0x13f14f=_[_0xce2a('0x8c')](_[_0xce2a('0x47')](_0x10bf92,_0xce2a('0x8d')),function(_0x1b6743){return _[_0xce2a('0x8e')](_0x203e05,_0x1b6743);});if(_0x13f14f){return _0x2b008a['id'];}}}));}}return BPromise[_0xce2a('0x8f')](_0x595abc)[_0xce2a('0x1e')](function(_0x4bf569){_0x4da4e2=_(_0x4da4e2)[_0xce2a('0x90')](_0x4bf569)[_0xce2a('0x91')]()[_0xce2a('0x92')]();return db['ChatQueue'][_0xce2a('0x51')]({'where':{'id':_0x146bf0['params']['id']}})['then'](function(_0x334770){return db[_0xce2a('0x77')][_0xce2a('0x78')](function(_0x47baf6){return _0x334770[_0xce2a('0x7d')](_0x146bf0[_0xce2a('0x3d')][_0xce2a('0x7e')],{'transaction':_0x47baf6})[_0xce2a('0x1e')](function(){if(!_[_0xce2a('0x93')](_0x4da4e2)){return _0x334770[_0xce2a('0x94')](_0x4da4e2,{'transaction':_0x47baf6});}})[_0xce2a('0x1e')](function(){_0x4da4e2[_0xce2a('0x7b')](function(_0x4db2fb){socket[_0xce2a('0x7c')](_0xce2a('0x95'),{'UserId':_0x4db2fb,'ChatQueueId':_0x334770['id']});});});});});});})[_0xce2a('0x1e')](respondWithStatusCode(_0x3629a9,null))[_0xce2a('0x5a')](handleError(_0x3629a9,null));};exports['addAgents']=function(_0x5e56bb,_0x2c591f,_0x484f94){return db['ChatQueue'][_0xce2a('0x51')]({'where':{'id':_0x5e56bb[_0xce2a('0x4d')]['id']}})[_0xce2a('0x1e')](handleEntityNotFound(_0x2c591f,null))[_0xce2a('0x1e')](function(_0x39c77d){if(_0x39c77d){return _0x39c77d[_0xce2a('0x96')](_0x5e56bb['body'][_0xce2a('0x7e')],_[_0xce2a('0x97')](_0x5e56bb[_0xce2a('0x53')],[_0xce2a('0x7e'),'id'])||{})['spread'](function(_0x55de7a){for(var _0x2b96f3=0x0;_0x2b96f3<_0x5e56bb[_0xce2a('0x53')]['ids'][_0xce2a('0x43')];_0x2b96f3+=0x1){socket['emit'](_0xce2a('0x98'),{'UserId':Number(_0x5e56bb['body'][_0xce2a('0x7e')][_0x2b96f3]),'ChatQueueId':Number(_0x5e56bb['params']['id'])});}return _0x55de7a;});}})[_0xce2a('0x1e')](respondWithResult(_0x2c591f,null))[_0xce2a('0x5a')](handleError(_0x2c591f,null));};exports[_0xce2a('0x94')]=function(_0x46fb53,_0x512db7,_0x3afd1a){return db[_0xce2a('0x3b')][_0xce2a('0x51')]({'where':{'id':_0x46fb53[_0xce2a('0x4d')]['id']}})[_0xce2a('0x1e')](handleEntityNotFound(_0x512db7,null))[_0xce2a('0x1e')](function(_0x7b7c82){if(_0x7b7c82){return _0x7b7c82[_0xce2a('0x94')](_0x46fb53[_0xce2a('0x3d')][_0xce2a('0x7e')])[_0xce2a('0x1e')](function(){if(_['isArray'](_0x46fb53[_0xce2a('0x3d')][_0xce2a('0x7e')])){for(var _0x127990=0x0;_0x127990<_0x46fb53[_0xce2a('0x3d')][_0xce2a('0x7e')][_0xce2a('0x43')];_0x127990+=0x1){socket['emit'](_0xce2a('0x95'),{'UserId':Number(_0x46fb53['query'][_0xce2a('0x7e')][_0x127990]),'ChatQueueId':Number(_0x46fb53[_0xce2a('0x4d')]['id'])});}}else{socket[_0xce2a('0x7c')](_0xce2a('0x95'),{'UserId':Number(_0x46fb53[_0xce2a('0x3d')][_0xce2a('0x7e')]),'ChatQueueId':Number(_0x46fb53[_0xce2a('0x4d')]['id'])});}});}})[_0xce2a('0x1e')](respondWithStatusCode(_0x512db7,null))[_0xce2a('0x5a')](handleError(_0x512db7,null));};exports[_0xce2a('0x99')]=function(_0x3b894a,_0x1a7b9d,_0x1d1b91){var _0x4ee9a2={};var _0x3c1965={};var _0xda7d0e;var _0x1b506e;return db[_0xce2a('0x3b')]['findOne']({'where':{'id':_0x3b894a[_0xce2a('0x4d')]['id']}})[_0xce2a('0x1e')](handleEntityNotFound(_0x1a7b9d,null))['then'](function(_0x1b026c){if(_0x1b026c){_0xda7d0e=_0x1b026c;_0x3c1965[_0xce2a('0x40')]=_['keys'](db[_0xce2a('0x66')]['rawAttributes']);_0x3c1965[_0xce2a('0x3d')]=_[_0xce2a('0x4e')](_0x3b894a['query']);_0x3c1965['filters']=_['intersection'](_0x3c1965['model'],_0x3c1965[_0xce2a('0x3d')]);_0x4ee9a2[_0xce2a('0x41')]=_[_0xce2a('0x3f')](_0x3c1965[_0xce2a('0x40')],qs[_0xce2a('0x42')](_0x3b894a[_0xce2a('0x3d')][_0xce2a('0x42')]));_0x4ee9a2[_0xce2a('0x41')]=_0x4ee9a2['attributes'][_0xce2a('0x43')]?_0x4ee9a2['attributes']:_0x3c1965[_0xce2a('0x40')];_0x4ee9a2[_0xce2a('0x63')]=qs[_0xce2a('0x44')](_0x3b894a[_0xce2a('0x3d')][_0xce2a('0x44')]);_0x4ee9a2[_0xce2a('0x45')]=qs['filters'](_['pick'](_0x3b894a[_0xce2a('0x3d')],_0x3c1965[_0xce2a('0x3e')]));if(_0x3b894a['query'][_0xce2a('0x46')]){_0x4ee9a2['where']=_[_0xce2a('0x4f')](_0x4ee9a2[_0xce2a('0x45')],{'$or':_['map'](_0x4ee9a2[_0xce2a('0x41')],function(_0x398ee0){var _0x588f22={};_0x588f22[_0x398ee0]={'$like':'%'+_0x3b894a[_0xce2a('0x3d')][_0xce2a('0x46')]+'%'};return _0x588f22;})});}_0x4ee9a2=_['merge']({},_0x4ee9a2,_0x3b894a[_0xce2a('0x50')]);return _0xda7d0e[_0xce2a('0x99')](_0x4ee9a2);}})['then'](function(_0x264263){if(_0x264263){_0x1b506e=_0x264263[_0xce2a('0x43')];if(!_0x3b894a[_0xce2a('0x3d')][_0xce2a('0x61')](_0xce2a('0x62'))){_0x4ee9a2['limit']=qs['limit'](_0x3b894a[_0xce2a('0x3d')][_0xce2a('0x2c')]);_0x4ee9a2[_0xce2a('0x2b')]=qs[_0xce2a('0x2b')](_0x3b894a[_0xce2a('0x3d')][_0xce2a('0x2b')]);}return _0xda7d0e[_0xce2a('0x99')](_0x4ee9a2);}})[_0xce2a('0x1e')](function(_0x19a419){if(_0x19a419){return _0x19a419?{'count':_0x1b506e,'rows':_0x19a419}:null;}})[_0xce2a('0x1e')](respondWithResult(_0x1a7b9d,null))[_0xce2a('0x5a')](handleError(_0x1a7b9d,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index c30a9c3..a82c3f3 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 _0xff44=['hook','exports','events','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x7cd079,_0x3ad1ad){var _0x432725=function(_0x4618f2){while(--_0x4618f2){_0x7cd079['push'](_0x7cd079['shift']());}};_0x432725(++_0x3ad1ad);}(_0xff44,0xe3));var _0x4ff4=function(_0x28d1ea,_0x426311){_0x28d1ea=_0x28d1ea-0x0;var _0x1667b6=_0xff44[_0x28d1ea];return _0x1667b6;};'use strict';var EventEmitter=require(_0x4ff4('0x0'));var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4ff4('0x1')](0x0);var events={'afterCreate':_0x4ff4('0x2'),'afterUpdate':_0x4ff4('0x3'),'afterDestroy':_0x4ff4('0x4')};function emitEvent(_0x213927){return function(_0x3e4357,_0x574714,_0x3d9a38){ChatQueueEvents['emit'](_0x213927+':'+_0x3e4357['id'],_0x3e4357);ChatQueueEvents[_0x4ff4('0x5')](_0x213927,_0x3e4357);_0x3d9a38(null);};}for(var e in events){if(events[_0x4ff4('0x6')](e)){var event=events[e];ChatQueue[_0x4ff4('0x7')](e,emitEvent(event));}}module[_0x4ff4('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xbaa8=['setMaxListeners','remove','emit','hook','exports','events','../../mysqldb','ChatQueue'];(function(_0x3b97a4,_0xe8bc3){var _0x33ff5b=function(_0x5a3589){while(--_0x5a3589){_0x3b97a4['push'](_0x3b97a4['shift']());}};_0x33ff5b(++_0xe8bc3);}(_0xbaa8,0x1a5));var _0x8baa=function(_0x2d1a0b,_0x35e00e){_0x2d1a0b=_0x2d1a0b-0x0;var _0x207f65=_0xbaa8[_0x2d1a0b];return _0x207f65;};'use strict';var EventEmitter=require(_0x8baa('0x0'));var ChatQueue=require(_0x8baa('0x1'))['db'][_0x8baa('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x8baa('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8baa('0x4')};function emitEvent(_0x12ed3f){return function(_0x3fa162,_0x4510a3,_0x50dae1){ChatQueueEvents[_0x8baa('0x5')](_0x12ed3f+':'+_0x3fa162['id'],_0x3fa162);ChatQueueEvents[_0x8baa('0x5')](_0x12ed3f,_0x3fa162);_0x50dae1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x8baa('0x6')](e,emitEvent(event));}}module[_0x8baa('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 7cc456f..12c5a7c 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 _0x0259=['../../config/environment','exports','define','ChatQueue','chat_queues','util','../../config/logger','api','request-promise','rimraf'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0259,0x131));var _0x9025=function(_0x187a54,_0xf6a284){_0x187a54=_0x187a54-0x0;var _0x9eef7f=_0x0259[_0x187a54];return _0x9eef7f;};'use strict';var _=require('lodash');var util=require(_0x9025('0x0'));var logger=require(_0x9025('0x1'))(_0x9025('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9025('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9025('0x4'));var config=require(_0x9025('0x5'));var attributes=require('./chatQueue.attributes');module[_0x9025('0x6')]=function(_0x4e6fbb,_0x154e52){return _0x4e6fbb[_0x9025('0x7')](_0x9025('0x8'),attributes,{'tableName':_0x9025('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bd5=['../../config/environment','ChatQueue','chat_queues','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x2e40e4,_0xab6828){var _0x176ad6=function(_0x2d9541){while(--_0x2d9541){_0x2e40e4['push'](_0x2e40e4['shift']());}};_0x176ad6(++_0xab6828);}(_0x7bd5,0x13e));var _0x57bd=function(_0x599c2a,_0x3910c8){_0x599c2a=_0x599c2a-0x0;var _0x200edb=_0x7bd5[_0x599c2a];return _0x200edb;};'use strict';var _=require('lodash');var util=require(_0x57bd('0x0'));var logger=require(_0x57bd('0x1'))(_0x57bd('0x2'));var moment=require(_0x57bd('0x3'));var BPromise=require(_0x57bd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x57bd('0x5'));var config=require(_0x57bd('0x6'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x3cd7d4,_0x221f49){return _0x3cd7d4['define'](_0x57bd('0x7'),attributes,{'tableName':_0x57bd('0x8'),'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 9b05c9c..5971d23 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 _0xb2af=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatQueue,\x20%s,\x20%s','result','catch','options','raw','where','attributes','include','map','model','GetChatQueue','debug','ShowChatQueue','ChatQueue','find'];(function(_0x350fc2,_0x383bf2){var _0x3a9d2c=function(_0x5cc9b1){while(--_0x5cc9b1){_0x350fc2['push'](_0x350fc2['shift']());}};_0x3a9d2c(++_0x383bf2);}(_0xb2af,0xd2));var _0xfb2a=function(_0x11fe26,_0x2fc092){_0x11fe26=_0x11fe26-0x0;var _0x4f377d=_0xb2af[_0x11fe26];return _0x4f377d;};'use strict';var _=require(_0xfb2a('0x0'));var util=require(_0xfb2a('0x1'));var moment=require(_0xfb2a('0x2'));var BPromise=require(_0xfb2a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb2a('0x4'));var db=require(_0xfb2a('0x5'))['db'];var utils=require(_0xfb2a('0x6'));var logger=require(_0xfb2a('0x7'))(_0xfb2a('0x8'));var config=require('../../config/environment');var jayson=require(_0xfb2a('0x9'));var client=jayson[_0xfb2a('0xa')][_0xfb2a('0xb')]({'port':0x232a});config['redis']=_[_0xfb2a('0xc')](config[_0xfb2a('0xd')],{'host':_0xfb2a('0xe'),'port':0x18eb});var socket=require(_0xfb2a('0xf'))(new Redis(config[_0xfb2a('0xd')]));require(_0xfb2a('0x10'))[_0xfb2a('0x11')](socket);function respondWithRpcPromise(_0x9a7bf1,_0x46f390,_0x45bdff){return new BPromise(function(_0x2f4f0e,_0x3cf887){return client[_0xfb2a('0x12')](_0x9a7bf1,_0x45bdff)[_0xfb2a('0x13')](function(_0x39af6b){logger[_0xfb2a('0x14')]('ChatQueue,\x20%s,\x20%s',_0x46f390,'request\x20sent');logger['debug'](_0xfb2a('0x15'),_0x46f390,_0xfb2a('0x16'),JSON[_0xfb2a('0x17')](_0x39af6b));if(_0x39af6b[_0xfb2a('0x18')]){if(_0x39af6b['error'][_0xfb2a('0x19')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x46f390,_0x39af6b[_0xfb2a('0x18')]['message']);return _0x3cf887(_0x39af6b['error'][_0xfb2a('0x1a')]);}logger[_0xfb2a('0x18')](_0xfb2a('0x1b'),_0x46f390,_0x39af6b[_0xfb2a('0x18')][_0xfb2a('0x1a')]);return _0x2f4f0e(_0x39af6b[_0xfb2a('0x18')][_0xfb2a('0x1a')]);}else{logger[_0xfb2a('0x14')](_0xfb2a('0x1b'),_0x46f390,'request\x20sent');_0x2f4f0e(_0x39af6b[_0xfb2a('0x1c')][_0xfb2a('0x1a')]);}})[_0xfb2a('0x1d')](function(_0x2b072a){logger['error'](_0xfb2a('0x1b'),_0x46f390,_0x2b072a);_0x3cf887(_0x2b072a);});});}exports['GetChatQueue']=function(_0x39baee){var _0x2e2743=this;return new Promise(function(_0x1f230b,_0x593291){return db['ChatQueue']['findAll']({'raw':_0x39baee['options']?_0x39baee[_0xfb2a('0x1e')][_0xfb2a('0x1f')]===undefined?!![]:![]:!![],'where':_0x39baee[_0xfb2a('0x1e')]?_0x39baee[_0xfb2a('0x1e')][_0xfb2a('0x20')]||null:null,'attributes':_0x39baee[_0xfb2a('0x1e')]?_0x39baee[_0xfb2a('0x1e')][_0xfb2a('0x21')]||null:null,'limit':_0x39baee[_0xfb2a('0x1e')]?_0x39baee[_0xfb2a('0x1e')]['limit']||null:null,'include':_0x39baee[_0xfb2a('0x1e')]?_0x39baee['options'][_0xfb2a('0x22')]?_[_0xfb2a('0x23')](_0x39baee['options'][_0xfb2a('0x22')],function(_0x239446){return{'model':db[_0x239446['model']],'as':_0x239446['as'],'attributes':_0x239446[_0xfb2a('0x21')],'include':_0x239446[_0xfb2a('0x22')]?_['map'](_0x239446[_0xfb2a('0x22')],function(_0x25ec6c){return{'model':db[_0x25ec6c[_0xfb2a('0x24')]],'as':_0x25ec6c['as'],'attributes':_0x25ec6c[_0xfb2a('0x21')],'include':_0x25ec6c[_0xfb2a('0x22')]?_[_0xfb2a('0x23')](_0x25ec6c[_0xfb2a('0x22')],function(_0x3f3da3){return{'model':db[_0x3f3da3[_0xfb2a('0x24')]],'as':_0x3f3da3['as'],'attributes':_0x3f3da3[_0xfb2a('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xbbf3b4){logger[_0xfb2a('0x14')](_0xfb2a('0x25'),_0x39baee);logger[_0xfb2a('0x26')](_0xfb2a('0x25'),_0x39baee,JSON[_0xfb2a('0x17')](_0xbbf3b4));_0x1f230b(_0xbbf3b4);})[_0xfb2a('0x1d')](function(_0x3042fb){logger['error'](_0xfb2a('0x25'),_0x3042fb['message'],_0x39baee);_0x593291(_0x2e2743['error'](0x1f4,_0x3042fb[_0xfb2a('0x1a')]));});});};exports[_0xfb2a('0x27')]=function(_0x44fa1a){var _0x4a7146=this;return new Promise(function(_0x2ec1a2,_0x4ee3b9){return db[_0xfb2a('0x28')][_0xfb2a('0x29')]({'raw':_0x44fa1a[_0xfb2a('0x1e')]?_0x44fa1a[_0xfb2a('0x1e')][_0xfb2a('0x1f')]===undefined?!![]:![]:!![],'where':_0x44fa1a[_0xfb2a('0x1e')]?_0x44fa1a['options']['where']||null:null,'attributes':_0x44fa1a[_0xfb2a('0x1e')]?_0x44fa1a[_0xfb2a('0x1e')]['attributes']||null:null,'include':_0x44fa1a['options']?_0x44fa1a[_0xfb2a('0x1e')][_0xfb2a('0x22')]?_[_0xfb2a('0x23')](_0x44fa1a[_0xfb2a('0x1e')][_0xfb2a('0x22')],function(_0x2cd0cd){return{'model':db[_0x2cd0cd['model']],'as':_0x2cd0cd['as'],'attributes':_0x2cd0cd[_0xfb2a('0x21')],'include':_0x2cd0cd[_0xfb2a('0x22')]?_[_0xfb2a('0x23')](_0x2cd0cd[_0xfb2a('0x22')],function(_0x2a4588){return{'model':db[_0x2a4588[_0xfb2a('0x24')]],'as':_0x2a4588['as'],'attributes':_0x2a4588[_0xfb2a('0x21')],'include':_0x2a4588[_0xfb2a('0x22')]?_[_0xfb2a('0x23')](_0x2a4588[_0xfb2a('0x22')],function(_0xa22344){return{'model':db[_0xa22344[_0xfb2a('0x24')]],'as':_0xa22344['as'],'attributes':_0xa22344[_0xfb2a('0x21')]};}):[]};}):[]};}):[]:[]})[_0xfb2a('0x13')](function(_0xee9d74){logger[_0xfb2a('0x14')](_0xfb2a('0x27'),_0x44fa1a);logger[_0xfb2a('0x26')](_0xfb2a('0x27'),_0x44fa1a,JSON[_0xfb2a('0x17')](_0xee9d74));_0x2ec1a2(_0xee9d74);})[_0xfb2a('0x1d')](function(_0x1ca3c6){logger[_0xfb2a('0x18')](_0xfb2a('0x27'),_0x1ca3c6[_0xfb2a('0x1a')],_0x44fa1a);_0x4ee3b9(_0x4a7146[_0xfb2a('0x18')](0x1f4,_0x1ca3c6[_0xfb2a('0x1a')]));});});}; \ No newline at end of file +var _0x3870=['map','ShowChatQueue','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatQueue.socket','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','model'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x3870,0x146));var _0x0387=function(_0x36484d,_0x5ef8e8){_0x36484d=_0x36484d-0x0;var _0x1f2c38=_0x3870[_0x36484d];return _0x1f2c38;};'use strict';var _=require(_0x0387('0x0'));var util=require(_0x0387('0x1'));var moment=require(_0x0387('0x2'));var BPromise=require('bluebird');var rs=require(_0x0387('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0387('0x4'))['db'];var utils=require(_0x0387('0x5'));var logger=require('../../config/logger')(_0x0387('0x6'));var config=require(_0x0387('0x7'));var jayson=require(_0x0387('0x8'));var client=jayson['client'][_0x0387('0x9')]({'port':0x232a});config[_0x0387('0xa')]=_[_0x0387('0xb')](config[_0x0387('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0387('0xc'))(new Redis(config[_0x0387('0xa')]));require(_0x0387('0xd'))['register'](socket);function respondWithRpcPromise(_0x1b7e9b,_0x4cbb9b,_0x5e5029){return new BPromise(function(_0x4030d6,_0x2e018a){return client[_0x0387('0xe')](_0x1b7e9b,_0x5e5029)[_0x0387('0xf')](function(_0x1f18a6){logger['info'](_0x0387('0x10'),_0x4cbb9b,_0x0387('0x11'));logger[_0x0387('0x12')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x4cbb9b,'request\x20sent',JSON[_0x0387('0x13')](_0x1f18a6));if(_0x1f18a6[_0x0387('0x14')]){if(_0x1f18a6['error']['code']===0x1f4){logger[_0x0387('0x14')](_0x0387('0x10'),_0x4cbb9b,_0x1f18a6[_0x0387('0x14')]['message']);return _0x2e018a(_0x1f18a6['error'][_0x0387('0x15')]);}logger['error'](_0x0387('0x10'),_0x4cbb9b,_0x1f18a6['error'][_0x0387('0x15')]);return _0x4030d6(_0x1f18a6[_0x0387('0x14')][_0x0387('0x15')]);}else{logger[_0x0387('0x16')](_0x0387('0x10'),_0x4cbb9b,_0x0387('0x11'));_0x4030d6(_0x1f18a6['result'][_0x0387('0x15')]);}})[_0x0387('0x17')](function(_0x29d3b0){logger[_0x0387('0x14')]('ChatQueue,\x20%s,\x20%s',_0x4cbb9b,_0x29d3b0);_0x2e018a(_0x29d3b0);});});}exports[_0x0387('0x18')]=function(_0x231b4a){var _0x1791d8=this;return new Promise(function(_0x1ec522,_0x18484e){return db[_0x0387('0x19')][_0x0387('0x1a')]({'raw':_0x231b4a[_0x0387('0x1b')]?_0x231b4a[_0x0387('0x1b')][_0x0387('0x1c')]===undefined?!![]:![]:!![],'where':_0x231b4a[_0x0387('0x1b')]?_0x231b4a['options'][_0x0387('0x1d')]||null:null,'attributes':_0x231b4a[_0x0387('0x1b')]?_0x231b4a[_0x0387('0x1b')][_0x0387('0x1e')]||null:null,'limit':_0x231b4a[_0x0387('0x1b')]?_0x231b4a['options'][_0x0387('0x1f')]||null:null,'include':_0x231b4a[_0x0387('0x1b')]?_0x231b4a[_0x0387('0x1b')][_0x0387('0x20')]?_['map'](_0x231b4a[_0x0387('0x1b')][_0x0387('0x20')],function(_0x3c577a){return{'model':db[_0x3c577a[_0x0387('0x21')]],'as':_0x3c577a['as'],'attributes':_0x3c577a[_0x0387('0x1e')],'include':_0x3c577a[_0x0387('0x20')]?_['map'](_0x3c577a[_0x0387('0x20')],function(_0x493fac){return{'model':db[_0x493fac['model']],'as':_0x493fac['as'],'attributes':_0x493fac[_0x0387('0x1e')],'include':_0x493fac[_0x0387('0x20')]?_[_0x0387('0x22')](_0x493fac[_0x0387('0x20')],function(_0x941f78){return{'model':db[_0x941f78[_0x0387('0x21')]],'as':_0x941f78['as'],'attributes':_0x941f78[_0x0387('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d48cf){logger[_0x0387('0x16')](_0x0387('0x18'),_0x231b4a);logger[_0x0387('0x12')](_0x0387('0x18'),_0x231b4a,JSON['stringify'](_0x4d48cf));_0x1ec522(_0x4d48cf);})['catch'](function(_0x29aa9d){logger[_0x0387('0x14')](_0x0387('0x18'),_0x29aa9d[_0x0387('0x15')],_0x231b4a);_0x18484e(_0x1791d8[_0x0387('0x14')](0x1f4,_0x29aa9d[_0x0387('0x15')]));});});};exports['ShowChatQueue']=function(_0x11328f){var _0x547bcb=this;return new Promise(function(_0x4a7959,_0x4b2f54){return db['ChatQueue']['find']({'raw':_0x11328f[_0x0387('0x1b')]?_0x11328f['options'][_0x0387('0x1c')]===undefined?!![]:![]:!![],'where':_0x11328f['options']?_0x11328f[_0x0387('0x1b')]['where']||null:null,'attributes':_0x11328f['options']?_0x11328f[_0x0387('0x1b')]['attributes']||null:null,'include':_0x11328f['options']?_0x11328f[_0x0387('0x1b')]['include']?_[_0x0387('0x22')](_0x11328f[_0x0387('0x1b')]['include'],function(_0x9bb3f5){return{'model':db[_0x9bb3f5['model']],'as':_0x9bb3f5['as'],'attributes':_0x9bb3f5[_0x0387('0x1e')],'include':_0x9bb3f5[_0x0387('0x20')]?_[_0x0387('0x22')](_0x9bb3f5[_0x0387('0x20')],function(_0x5342f8){return{'model':db[_0x5342f8['model']],'as':_0x5342f8['as'],'attributes':_0x5342f8[_0x0387('0x1e')],'include':_0x5342f8[_0x0387('0x20')]?_[_0x0387('0x22')](_0x5342f8[_0x0387('0x20')],function(_0xbd9846){return{'model':db[_0xbd9846[_0x0387('0x21')]],'as':_0xbd9846['as'],'attributes':_0xbd9846['attributes']};}):[]};}):[]};}):[]:[]})[_0x0387('0xf')](function(_0x47c0af){logger[_0x0387('0x16')](_0x0387('0x23'),_0x11328f);logger[_0x0387('0x12')](_0x0387('0x23'),_0x11328f,JSON[_0x0387('0x13')](_0x47c0af));_0x4a7959(_0x47c0af);})[_0x0387('0x17')](function(_0x582740){logger['error'](_0x0387('0x23'),_0x582740[_0x0387('0x15')],_0x11328f);_0x4b2f54(_0x547bcb[_0x0387('0x14')](0x1f4,_0x582740['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 5d0b724..6ff8ab6 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 _0x0c02=['save','remove','emit','removeListener','register','chatQueue:'];(function(_0x2a5864,_0x2b9396){var _0x490ab6=function(_0x3bcd16){while(--_0x3bcd16){_0x2a5864['push'](_0x2a5864['shift']());}};_0x490ab6(++_0x2b9396);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x20c0('0x0'),_0x20c0('0x1'),'update'];function createListener(_0x1338cf,_0x5c8750){return function(_0x454922){_0x5c8750[_0x20c0('0x2')](_0x1338cf,_0x454922);};}function removeListener(_0x38022e,_0x2e9d65){return function(){ChatQueueEvents[_0x20c0('0x3')](_0x38022e,_0x2e9d65);};}exports[_0x20c0('0x4')]=function(_0x13312d){for(var _0xd25ee8=0x0,_0x5d6408=events['length'];_0xd25ee8<_0x5d6408;_0xd25ee8++){var _0x5da127=events[_0xd25ee8];var _0x4db532=createListener(_0x20c0('0x5')+_0x5da127,_0x13312d);ChatQueueEvents['on'](_0x5da127,_0x4db532);}}; \ No newline at end of file +var _0xb4e6=['removeListener','register','./chatQueue.events','remove','update','emit'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x2db667,_0x193cf5){_0x2db667=_0x2db667-0x0;var _0x83ff9=_0xb4e6[_0x2db667];return _0x83ff9;};'use strict';var ChatQueueEvents=require(_0x6b4e('0x0'));var events=['save',_0x6b4e('0x1'),_0x6b4e('0x2')];function createListener(_0x365912,_0x25ffcb){return function(_0x44e781){_0x25ffcb[_0x6b4e('0x3')](_0x365912,_0x44e781);};}function removeListener(_0x1929b8,_0x52313b){return function(){ChatQueueEvents[_0x6b4e('0x4')](_0x1929b8,_0x52313b);};}exports[_0x6b4e('0x5')]=function(_0x1f67a2){for(var _0x49de51=0x0,_0xd3138f=events['length'];_0x49de51<_0xd3138f;_0x49de51++){var _0x4f00be=events[_0x49de51];var _0x2311d9=createListener('chatQueue:'+_0x4f00be,_0x1f67a2);ChatQueueEvents['on'](_0x4f00be,_0x2311d9);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index ef8b302..6f7f8dd 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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3e74,0x175));var _0x43e7=function(_0x10394,_0x474489){_0x10394=_0x10394-0x0;var _0x4933f1=_0x3e74[_0x10394];return _0x4933f1;};'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 _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x5fc3,0xa8));var _0x35fc=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0x5fc3[_0x11a220];return _0x20d8fe;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 48a0797..d6e34fc 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 _0x31dc=['exports','STRING','DATE','sequelize'];(function(_0x595a71,_0x14d57f){var _0xfc9b22=function(_0x4699c7){while(--_0x4699c7){_0x595a71['push'](_0x595a71['shift']());}};_0xfc9b22(++_0x14d57f);}(_0x31dc,0xeb));var _0xc31d=function(_0x12aa96,_0x296e28){_0x12aa96=_0x12aa96-0x0;var _0x18b36b=_0x31dc[_0x12aa96];return _0x18b36b;};'use strict';var moment=require('moment');var Sequelize=require(_0xc31d('0x0'));module[_0xc31d('0x1')]={'uniqueid':{'type':Sequelize[_0xc31d('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc31d('0x2')]},'joinAt':{'type':Sequelize[_0xc31d('0x3')]},'leaveAt':{'type':Sequelize[_0xc31d('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc31d('0x3')]},'reason':{'type':Sequelize[_0xc31d('0x2')]}}; \ No newline at end of file +var _0xfc90=['sequelize','exports','STRING','DATE','moment'];(function(_0x11087e,_0xe859e8){var _0x4d3df5=function(_0x405560){while(--_0x405560){_0x11087e['push'](_0x11087e['shift']());}};_0x4d3df5(++_0xe859e8);}(_0xfc90,0x17b));var _0x0fc9=function(_0x3c322e,_0x1d1381){_0x3c322e=_0x3c322e-0x0;var _0x1f2825=_0xfc90[_0x3c322e];return _0x1f2825;};'use strict';var moment=require(_0x0fc9('0x0'));var Sequelize=require(_0x0fc9('0x1'));module[_0x0fc9('0x2')]={'uniqueid':{'type':Sequelize[_0x0fc9('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x0fc9('0x3')]},'joinAt':{'type':Sequelize[_0x0fc9('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x0fc9('0x4')]},'exitAt':{'type':Sequelize[_0x0fc9('0x4')]},'reason':{'type':Sequelize[_0x0fc9('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 13568be..c63951b 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 _0x4d68=['save','update','destroy','then','error','name','send','map','ChatQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','params','include','options','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply'];(function(_0x262f50,_0x7b3600){var _0x1942fd=function(_0x51317c){while(--_0x51317c){_0x262f50['push'](_0x262f50['shift']());}};_0x1942fd(++_0x7b3600);}(_0x4d68,0x1c3));var _0x84d6=function(_0x11b58d,_0x555c55){_0x11b58d=_0x11b58d-0x0;var _0xc2811b=_0x4d68[_0x11b58d];return _0xc2811b;};'use strict';var emlformat=require(_0x84d6('0x0'));var rimraf=require(_0x84d6('0x1'));var zipdir=require(_0x84d6('0x2'));var jsonpatch=require(_0x84d6('0x3'));var rp=require(_0x84d6('0x4'));var moment=require(_0x84d6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x84d6('0x6'));var util=require('util');var path=require(_0x84d6('0x7'));var sox=require('sox');var csv=require(_0x84d6('0x8'));var ejs=require(_0x84d6('0x9'));var fs=require('fs');var fs_extra=require(_0x84d6('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x84d6('0xb'));var jsforce=require(_0x84d6('0xc'));var deskjs=require(_0x84d6('0xd'));var toCsv=require(_0x84d6('0x8'));var querystring=require('querystring');var Papa=require(_0x84d6('0xe'));var Redis=require('ioredis');var authService=require(_0x84d6('0xf'));var qs=require(_0x84d6('0x10'));var as=require(_0x84d6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x84d6('0x12'));var utils=require('../../config/utils');var config=require(_0x84d6('0x13'));var licenseUtil=require(_0x84d6('0x14'));var db=require(_0x84d6('0x15'))['db'];function respondWithStatusCode(_0x19e7a9,_0x203c54){_0x203c54=_0x203c54||0xcc;return function(_0x506edc){if(_0x506edc){return _0x19e7a9[_0x84d6('0x16')](_0x203c54);}return _0x19e7a9['status'](_0x203c54)[_0x84d6('0x17')]();};}function respondWithResult(_0x2e6340,_0x1a5d62){_0x1a5d62=_0x1a5d62||0xc8;return function(_0x44b065){if(_0x44b065){return _0x2e6340[_0x84d6('0x18')](_0x1a5d62)[_0x84d6('0x19')](_0x44b065);}};}function respondWithFilteredResult(_0x957ae6,_0x4f39f0){return function(_0x10646e){if(_0x10646e){var _0x41e128=typeof _0x4f39f0[_0x84d6('0x1a')]===_0x84d6('0x1b')&&typeof _0x4f39f0[_0x84d6('0x1c')]==='undefined';var _0x1dd975=_0x10646e[_0x84d6('0x1d')];var _0x579aa8=_0x41e128?0x0:_0x4f39f0[_0x84d6('0x1a')];var _0x47a884=_0x41e128?_0x10646e[_0x84d6('0x1d')]:_0x4f39f0[_0x84d6('0x1a')]+_0x4f39f0[_0x84d6('0x1c')];var _0x2cbfb5;if(_0x47a884>=_0x1dd975){_0x47a884=_0x1dd975;_0x2cbfb5=0xc8;}else{_0x2cbfb5=0xce;}_0x957ae6[_0x84d6('0x18')](_0x2cbfb5);return _0x957ae6['set'](_0x84d6('0x1e'),_0x579aa8+'-'+_0x47a884+'/'+_0x1dd975)[_0x84d6('0x19')](_0x10646e);}return null;};}function patchUpdates(_0x50ec59){return function(_0x4e4634){try{jsonpatch[_0x84d6('0x1f')](_0x4e4634,_0x50ec59,!![]);}catch(_0x5ebfcb){return BPromise['reject'](_0x5ebfcb);}return _0x4e4634[_0x84d6('0x20')]();};}function saveUpdates(_0x256787,_0x24c8fb){return function(_0x576510){if(_0x576510){return _0x576510[_0x84d6('0x21')](_0x256787)['then'](function(_0x5deb1f){return _0x5deb1f;});}return null;};}function removeEntity(_0x26e753,_0x1b86f2){return function(_0x596b7d){if(_0x596b7d){return _0x596b7d[_0x84d6('0x22')]()[_0x84d6('0x23')](function(){_0x26e753[_0x84d6('0x18')](0xcc)[_0x84d6('0x17')]();});}};}function handleEntityNotFound(_0x5deaa5,_0x282fbb){return function(_0x5d9284){if(!_0x5d9284){_0x5deaa5[_0x84d6('0x16')](0x194);}return _0x5d9284;};}function handleError(_0x19b6aa,_0x548ba5){_0x548ba5=_0x548ba5||0x1f4;return function(_0x500a81){logger[_0x84d6('0x24')](_0x500a81['stack']);if(_0x500a81['name']){delete _0x500a81[_0x84d6('0x25')];}_0x19b6aa['status'](_0x548ba5)[_0x84d6('0x26')](_0x500a81);};}exports['index']=function(_0x773fd0,_0x2c76e2){var _0x329926={},_0x37adf9={},_0x7c0074={'count':0x0,'rows':[]};var _0x125a2a=_[_0x84d6('0x27')](db[_0x84d6('0x28')][_0x84d6('0x29')],function(_0x1ebff2){return{'name':_0x1ebff2[_0x84d6('0x2a')],'type':_0x1ebff2[_0x84d6('0x2b')]['key']};});_0x37adf9[_0x84d6('0x2c')]=_[_0x84d6('0x27')](_0x125a2a,_0x84d6('0x25'));_0x37adf9[_0x84d6('0x2d')]=_[_0x84d6('0x2e')](_0x773fd0[_0x84d6('0x2d')]);_0x37adf9[_0x84d6('0x2f')]=_[_0x84d6('0x30')](_0x37adf9['model'],_0x37adf9[_0x84d6('0x2d')]);_0x329926['attributes']=_[_0x84d6('0x30')](_0x37adf9[_0x84d6('0x2c')],qs['fields'](_0x773fd0[_0x84d6('0x2d')][_0x84d6('0x31')]));_0x329926['attributes']=_0x329926[_0x84d6('0x32')][_0x84d6('0x33')]?_0x329926[_0x84d6('0x32')]:_0x37adf9[_0x84d6('0x2c')];if(!_0x773fd0[_0x84d6('0x2d')]['hasOwnProperty'](_0x84d6('0x34'))){_0x329926[_0x84d6('0x1c')]=qs[_0x84d6('0x1c')](_0x773fd0['query'][_0x84d6('0x1c')]);_0x329926['offset']=qs[_0x84d6('0x1a')](_0x773fd0['query']['offset']);}_0x329926[_0x84d6('0x35')]=qs[_0x84d6('0x36')](_0x773fd0[_0x84d6('0x2d')]['sort']);_0x329926[_0x84d6('0x37')]=qs[_0x84d6('0x2f')](_[_0x84d6('0x38')](_0x773fd0['query'],_0x37adf9['filters']),_0x125a2a);if(_0x773fd0['query'][_0x84d6('0x39')]){_0x329926[_0x84d6('0x37')]=_[_0x84d6('0x3a')](_0x329926[_0x84d6('0x37')],{'$or':_[_0x84d6('0x27')](_0x125a2a,function(_0x3b1dd2){if(_0x3b1dd2['type']!=='VIRTUAL'){var _0x30836a={};_0x30836a[_0x3b1dd2[_0x84d6('0x25')]]={'$like':'%'+_0x773fd0[_0x84d6('0x2d')][_0x84d6('0x39')]+'%'};return _0x30836a;}})});}_0x329926=_[_0x84d6('0x3a')]({},_0x329926,_0x773fd0['options']);var _0x59ea9b={'where':_0x329926['where']};return db[_0x84d6('0x28')]['count'](_0x59ea9b)[_0x84d6('0x23')](function(_0x25dccd){_0x7c0074['count']=_0x25dccd;if(_0x773fd0[_0x84d6('0x2d')][_0x84d6('0x3b')]){_0x329926['include']=[{'all':!![]}];}return db[_0x84d6('0x28')][_0x84d6('0x3c')](_0x329926);})[_0x84d6('0x23')](function(_0x4596c6){_0x7c0074[_0x84d6('0x3d')]=_0x4596c6;return _0x7c0074;})['then'](respondWithFilteredResult(_0x2c76e2,_0x329926))[_0x84d6('0x3e')](handleError(_0x2c76e2,null));};exports['show']=function(_0x1165f9,_0x1930af){var _0x95c924={'raw':!![],'where':{'id':_0x1165f9[_0x84d6('0x3f')]['id']}},_0x56ff93={};_0x56ff93[_0x84d6('0x2c')]=_[_0x84d6('0x2e')](db[_0x84d6('0x28')][_0x84d6('0x29')]);_0x56ff93[_0x84d6('0x2d')]=_['keys'](_0x1165f9[_0x84d6('0x2d')]);_0x56ff93['filters']=_['intersection'](_0x56ff93['model'],_0x56ff93[_0x84d6('0x2d')]);_0x95c924['attributes']=_['intersection'](_0x56ff93[_0x84d6('0x2c')],qs[_0x84d6('0x31')](_0x1165f9['query'][_0x84d6('0x31')]));_0x95c924[_0x84d6('0x32')]=_0x95c924[_0x84d6('0x32')][_0x84d6('0x33')]?_0x95c924[_0x84d6('0x32')]:_0x56ff93[_0x84d6('0x2c')];if(_0x1165f9['query']['includeAll']){_0x95c924[_0x84d6('0x40')]=[{'all':!![]}];}_0x95c924=_[_0x84d6('0x3a')]({},_0x95c924,_0x1165f9[_0x84d6('0x41')]);return db[_0x84d6('0x28')][_0x84d6('0x42')](_0x95c924)[_0x84d6('0x23')](handleEntityNotFound(_0x1930af,null))[_0x84d6('0x23')](respondWithResult(_0x1930af,null))['catch'](handleError(_0x1930af,null));};exports['create']=function(_0x1adbdc,_0x5a42fb){return db[_0x84d6('0x28')]['create'](_0x1adbdc[_0x84d6('0x43')],{})[_0x84d6('0x23')](respondWithResult(_0x5a42fb,0xc9))[_0x84d6('0x3e')](handleError(_0x5a42fb,null));};exports[_0x84d6('0x21')]=function(_0x4e4d67,_0x1aae95){if(_0x4e4d67['body']['id']){delete _0x4e4d67[_0x84d6('0x43')]['id'];}return db[_0x84d6('0x28')][_0x84d6('0x42')]({'where':{'id':_0x4e4d67['params']['id']}})['then'](handleEntityNotFound(_0x1aae95,null))[_0x84d6('0x23')](saveUpdates(_0x4e4d67['body'],null))['then'](respondWithResult(_0x1aae95,null))['catch'](handleError(_0x1aae95,null));};exports['destroy']=function(_0x5704cb,_0x12ea8b){return db['ChatQueueReport'][_0x84d6('0x42')]({'where':{'id':_0x5704cb[_0x84d6('0x3f')]['id']}})[_0x84d6('0x23')](handleEntityNotFound(_0x12ea8b,null))[_0x84d6('0x23')](removeEntity(_0x12ea8b,null))[_0x84d6('0x3e')](handleError(_0x12ea8b,null));};exports[_0x84d6('0x44')]=function(_0x2ec57c,_0x3acb28){return db[_0x84d6('0x28')]['describe']()['then'](respondWithResult(_0x3acb28,null))[_0x84d6('0x3e')](handleError(_0x3acb28,null));}; \ No newline at end of file +var _0x1228=['reject','save','update','then','destroy','error','stack','name','send','index','ChatQueueReport','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','offset','sort','pick','filter','where','merge','type','options','includeAll','rows','catch','params','length','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','limit'];(function(_0x3b8c86,_0x1793bf){var _0x41a654=function(_0x3cd7d0){while(--_0x3cd7d0){_0x3b8c86['push'](_0x3b8c86['shift']());}};_0x41a654(++_0x1793bf);}(_0x1228,0x12f));var _0x8122=function(_0x42afab,_0x1e14b4){_0x42afab=_0x42afab-0x0;var _0x40f14=_0x1228[_0x42afab];return _0x40f14;};'use strict';var emlformat=require(_0x8122('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8122('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8122('0x2'));var moment=require(_0x8122('0x3'));var BPromise=require(_0x8122('0x4'));var Mustache=require('mustache');var util=require(_0x8122('0x5'));var path=require(_0x8122('0x6'));var sox=require('sox');var csv=require(_0x8122('0x7'));var ejs=require(_0x8122('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8122('0x9'));var squel=require(_0x8122('0xa'));var crypto=require('crypto');var jsforce=require(_0x8122('0xb'));var deskjs=require(_0x8122('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8122('0xd'));var Papa=require(_0x8122('0xe'));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(_0x8122('0xf'));var logger=require('../../config/logger')(_0x8122('0x10'));var utils=require(_0x8122('0x11'));var config=require(_0x8122('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x8122('0x13'))['db'];function respondWithStatusCode(_0x565f6e,_0x162ed4){_0x162ed4=_0x162ed4||0xcc;return function(_0x1ca828){if(_0x1ca828){return _0x565f6e[_0x8122('0x14')](_0x162ed4);}return _0x565f6e[_0x8122('0x15')](_0x162ed4)[_0x8122('0x16')]();};}function respondWithResult(_0x266feb,_0x1fa431){_0x1fa431=_0x1fa431||0xc8;return function(_0x1be8e2){if(_0x1be8e2){return _0x266feb[_0x8122('0x15')](_0x1fa431)[_0x8122('0x17')](_0x1be8e2);}};}function respondWithFilteredResult(_0xfa15a2,_0x6baf37){return function(_0x559256){if(_0x559256){var _0x3ed5d1=typeof _0x6baf37['offset']===_0x8122('0x18')&&typeof _0x6baf37['limit']===_0x8122('0x18');var _0x2acf8f=_0x559256[_0x8122('0x19')];var _0x4bfb9e=_0x3ed5d1?0x0:_0x6baf37['offset'];var _0x4f7277=_0x3ed5d1?_0x559256['count']:_0x6baf37['offset']+_0x6baf37[_0x8122('0x1a')];var _0x2511e9;if(_0x4f7277>=_0x2acf8f){_0x4f7277=_0x2acf8f;_0x2511e9=0xc8;}else{_0x2511e9=0xce;}_0xfa15a2[_0x8122('0x15')](_0x2511e9);return _0xfa15a2['set']('Content-Range',_0x4bfb9e+'-'+_0x4f7277+'/'+_0x2acf8f)[_0x8122('0x17')](_0x559256);}return null;};}function patchUpdates(_0x174321){return function(_0x68761a){try{jsonpatch['apply'](_0x68761a,_0x174321,!![]);}catch(_0x15e635){return BPromise[_0x8122('0x1b')](_0x15e635);}return _0x68761a[_0x8122('0x1c')]();};}function saveUpdates(_0x988c0c,_0x3c6226){return function(_0x130e1b){if(_0x130e1b){return _0x130e1b[_0x8122('0x1d')](_0x988c0c)[_0x8122('0x1e')](function(_0x4fc6af){return _0x4fc6af;});}return null;};}function removeEntity(_0x34c185,_0x5cfa77){return function(_0x732946){if(_0x732946){return _0x732946[_0x8122('0x1f')]()[_0x8122('0x1e')](function(){_0x34c185[_0x8122('0x15')](0xcc)[_0x8122('0x16')]();});}};}function handleEntityNotFound(_0x240a6d,_0x40e945){return function(_0x2708a5){if(!_0x2708a5){_0x240a6d[_0x8122('0x14')](0x194);}return _0x2708a5;};}function handleError(_0x4e67ab,_0x1258d7){_0x1258d7=_0x1258d7||0x1f4;return function(_0xa79602){logger[_0x8122('0x20')](_0xa79602[_0x8122('0x21')]);if(_0xa79602[_0x8122('0x22')]){delete _0xa79602[_0x8122('0x22')];}_0x4e67ab[_0x8122('0x15')](_0x1258d7)[_0x8122('0x23')](_0xa79602);};}exports[_0x8122('0x24')]=function(_0x4610b1,_0x4c70f4){var _0x49531a={},_0x2a0b63={},_0x264ccf={'count':0x0,'rows':[]};var _0x5263ca=_['map'](db[_0x8122('0x25')][_0x8122('0x26')],function(_0x367ada){return{'name':_0x367ada['fieldName'],'type':_0x367ada['type'][_0x8122('0x27')]};});_0x2a0b63[_0x8122('0x28')]=_[_0x8122('0x29')](_0x5263ca,_0x8122('0x22'));_0x2a0b63[_0x8122('0x2a')]=_[_0x8122('0x2b')](_0x4610b1[_0x8122('0x2a')]);_0x2a0b63[_0x8122('0x2c')]=_[_0x8122('0x2d')](_0x2a0b63[_0x8122('0x28')],_0x2a0b63['query']);_0x49531a[_0x8122('0x2e')]=_[_0x8122('0x2d')](_0x2a0b63[_0x8122('0x28')],qs[_0x8122('0x2f')](_0x4610b1[_0x8122('0x2a')][_0x8122('0x2f')]));_0x49531a[_0x8122('0x2e')]=_0x49531a[_0x8122('0x2e')]['length']?_0x49531a['attributes']:_0x2a0b63[_0x8122('0x28')];if(!_0x4610b1['query']['hasOwnProperty'](_0x8122('0x30'))){_0x49531a['limit']=qs['limit'](_0x4610b1[_0x8122('0x2a')][_0x8122('0x1a')]);_0x49531a['offset']=qs[_0x8122('0x31')](_0x4610b1['query'][_0x8122('0x31')]);}_0x49531a['order']=qs[_0x8122('0x32')](_0x4610b1[_0x8122('0x2a')]['sort']);_0x49531a['where']=qs['filters'](_[_0x8122('0x33')](_0x4610b1[_0x8122('0x2a')],_0x2a0b63['filters']),_0x5263ca);if(_0x4610b1[_0x8122('0x2a')][_0x8122('0x34')]){_0x49531a[_0x8122('0x35')]=_[_0x8122('0x36')](_0x49531a['where'],{'$or':_[_0x8122('0x29')](_0x5263ca,function(_0x1a1510){if(_0x1a1510[_0x8122('0x37')]!=='VIRTUAL'){var _0x3805ec={};_0x3805ec[_0x1a1510['name']]={'$like':'%'+_0x4610b1[_0x8122('0x2a')]['filter']+'%'};return _0x3805ec;}})});}_0x49531a=_[_0x8122('0x36')]({},_0x49531a,_0x4610b1[_0x8122('0x38')]);var _0x1e6c01={'where':_0x49531a[_0x8122('0x35')]};return db['ChatQueueReport'][_0x8122('0x19')](_0x1e6c01)[_0x8122('0x1e')](function(_0x565829){_0x264ccf[_0x8122('0x19')]=_0x565829;if(_0x4610b1[_0x8122('0x2a')][_0x8122('0x39')]){_0x49531a['include']=[{'all':!![]}];}return db[_0x8122('0x25')]['findAll'](_0x49531a);})[_0x8122('0x1e')](function(_0x3258e8){_0x264ccf[_0x8122('0x3a')]=_0x3258e8;return _0x264ccf;})[_0x8122('0x1e')](respondWithFilteredResult(_0x4c70f4,_0x49531a))[_0x8122('0x3b')](handleError(_0x4c70f4,null));};exports['show']=function(_0xbad19,_0x16ab8c){var _0x5bceb1={'raw':!![],'where':{'id':_0xbad19[_0x8122('0x3c')]['id']}},_0x3dbd77={};_0x3dbd77[_0x8122('0x28')]=_[_0x8122('0x2b')](db[_0x8122('0x25')][_0x8122('0x26')]);_0x3dbd77[_0x8122('0x2a')]=_['keys'](_0xbad19[_0x8122('0x2a')]);_0x3dbd77[_0x8122('0x2c')]=_[_0x8122('0x2d')](_0x3dbd77['model'],_0x3dbd77[_0x8122('0x2a')]);_0x5bceb1[_0x8122('0x2e')]=_[_0x8122('0x2d')](_0x3dbd77['model'],qs['fields'](_0xbad19[_0x8122('0x2a')]['fields']));_0x5bceb1['attributes']=_0x5bceb1[_0x8122('0x2e')][_0x8122('0x3d')]?_0x5bceb1[_0x8122('0x2e')]:_0x3dbd77['model'];if(_0xbad19[_0x8122('0x2a')][_0x8122('0x39')]){_0x5bceb1['include']=[{'all':!![]}];}_0x5bceb1=_[_0x8122('0x36')]({},_0x5bceb1,_0xbad19[_0x8122('0x38')]);return db[_0x8122('0x25')][_0x8122('0x3e')](_0x5bceb1)['then'](handleEntityNotFound(_0x16ab8c,null))[_0x8122('0x1e')](respondWithResult(_0x16ab8c,null))['catch'](handleError(_0x16ab8c,null));};exports[_0x8122('0x3f')]=function(_0x21860f,_0x5e6093){return db[_0x8122('0x25')][_0x8122('0x3f')](_0x21860f['body'],{})[_0x8122('0x1e')](respondWithResult(_0x5e6093,0xc9))[_0x8122('0x3b')](handleError(_0x5e6093,null));};exports[_0x8122('0x1d')]=function(_0x8c7e4f,_0x1d9ccf){if(_0x8c7e4f[_0x8122('0x40')]['id']){delete _0x8c7e4f[_0x8122('0x40')]['id'];}return db['ChatQueueReport'][_0x8122('0x3e')]({'where':{'id':_0x8c7e4f[_0x8122('0x3c')]['id']}})[_0x8122('0x1e')](handleEntityNotFound(_0x1d9ccf,null))[_0x8122('0x1e')](saveUpdates(_0x8c7e4f['body'],null))[_0x8122('0x1e')](respondWithResult(_0x1d9ccf,null))[_0x8122('0x3b')](handleError(_0x1d9ccf,null));};exports[_0x8122('0x1f')]=function(_0x4bac94,_0x3618cb){return db[_0x8122('0x25')][_0x8122('0x3e')]({'where':{'id':_0x4bac94[_0x8122('0x3c')]['id']}})[_0x8122('0x1e')](handleEntityNotFound(_0x3618cb,null))['then'](removeEntity(_0x3618cb,null))[_0x8122('0x3b')](handleError(_0x3618cb,null));};exports[_0x8122('0x41')]=function(_0x81f778,_0x3a1d62){return db[_0x8122('0x25')][_0x8122('0x41')]()[_0x8122('0x1e')](respondWithResult(_0x3a1d62,null))[_0x8122('0x3b')](handleError(_0x3a1d62,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 9557fca..8501515 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x1635fe,_0x5f1d9f){var _0x3c512a=function(_0x26b53d){while(--_0x26b53d){_0x1635fe['push'](_0x1635fe['shift']());}};_0x3c512a(++_0x5f1d9f);}(_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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x3a0334,_0x33dfa4){var _0x528423=function(_0x34ec6a){while(--_0x34ec6a){_0x3a0334['push'](_0x3a0334['shift']());}};_0x528423(++_0x33dfa4);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xb7e7[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 8e4c6c3..9455452 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 _0xc2a3=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','debug','stringify','UpdateChatQueueReport','update','attributes','limit','lodash'];(function(_0x550a74,_0x55ce67){var _0x4b9b91=function(_0x5ef835){while(--_0x5ef835){_0x550a74['push'](_0x550a74['shift']());}};_0x4b9b91(++_0x55ce67);}(_0xc2a3,0xb9));var _0x3c2a=function(_0x4ca333,_0x1218a3){_0x4ca333=_0x4ca333-0x0;var _0x13b2e1=_0xc2a3[_0x4ca333];return _0x13b2e1;};'use strict';var _=require(_0x3c2a('0x0'));var util=require(_0x3c2a('0x1'));var moment=require('moment');var BPromise=require(_0x3c2a('0x2'));var rs=require(_0x3c2a('0x3'));var fs=require('fs');var Redis=require(_0x3c2a('0x4'));var db=require(_0x3c2a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3c2a('0x6'))(_0x3c2a('0x7'));var config=require('../../config/environment');var jayson=require(_0x3c2a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b5333,_0x2bcf29,_0x5028c6){return new BPromise(function(_0x3938ee,_0xe949e){return client[_0x3c2a('0x9')](_0x2b5333,_0x5028c6)[_0x3c2a('0xa')](function(_0x31ee63){logger[_0x3c2a('0xb')](_0x3c2a('0xc'),_0x2bcf29,_0x3c2a('0xd'));logger['debug'](_0x3c2a('0xe'),_0x2bcf29,_0x3c2a('0xd'),JSON['stringify'](_0x31ee63));if(_0x31ee63[_0x3c2a('0xf')]){if(_0x31ee63[_0x3c2a('0xf')]['code']===0x1f4){logger[_0x3c2a('0xf')](_0x3c2a('0xc'),_0x2bcf29,_0x31ee63[_0x3c2a('0xf')][_0x3c2a('0x10')]);return _0xe949e(_0x31ee63[_0x3c2a('0xf')]['message']);}logger[_0x3c2a('0xf')](_0x3c2a('0xc'),_0x2bcf29,_0x31ee63['error'][_0x3c2a('0x10')]);return _0x3938ee(_0x31ee63['error'][_0x3c2a('0x10')]);}else{logger[_0x3c2a('0xb')](_0x3c2a('0xc'),_0x2bcf29,_0x3c2a('0xd'));_0x3938ee(_0x31ee63[_0x3c2a('0x11')][_0x3c2a('0x10')]);}})[_0x3c2a('0x12')](function(_0x5817b5){logger[_0x3c2a('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x2bcf29,_0x5817b5);_0xe949e(_0x5817b5);});});}exports[_0x3c2a('0x13')]=function(_0x324baa){var _0x5d0ac4=this;return new Promise(function(_0x408e70,_0x2f264b){return db[_0x3c2a('0x14')][_0x3c2a('0x15')](_0x324baa[_0x3c2a('0x16')],{'raw':_0x324baa[_0x3c2a('0x17')]?_0x324baa[_0x3c2a('0x17')][_0x3c2a('0x18')]===undefined?!![]:![]:!![]})[_0x3c2a('0xa')](function(_0x552e6b){logger[_0x3c2a('0xb')](_0x3c2a('0x13'),_0x324baa);logger[_0x3c2a('0x19')](_0x3c2a('0x13'),_0x324baa,JSON[_0x3c2a('0x1a')](_0x552e6b));_0x408e70(_0x552e6b);})[_0x3c2a('0x12')](function(_0x307c60){logger[_0x3c2a('0xf')](_0x3c2a('0x13'),_0x307c60[_0x3c2a('0x10')],_0x324baa);_0x2f264b(_0x5d0ac4[_0x3c2a('0xf')](0x1f4,_0x307c60[_0x3c2a('0x10')]));});});};exports[_0x3c2a('0x1b')]=function(_0x168b4a){var _0xfe7f51=this;return new Promise(function(_0x813c7e,_0x3f1e46){return db[_0x3c2a('0x14')][_0x3c2a('0x1c')](_0x168b4a['body'],{'raw':_0x168b4a['options']?_0x168b4a['options'][_0x3c2a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x168b4a[_0x3c2a('0x17')]?_0x168b4a[_0x3c2a('0x17')]['where']||null:null,'attributes':_0x168b4a[_0x3c2a('0x17')]?_0x168b4a['options'][_0x3c2a('0x1d')]||null:null,'limit':_0x168b4a[_0x3c2a('0x17')]?_0x168b4a[_0x3c2a('0x17')][_0x3c2a('0x1e')]||null:null})[_0x3c2a('0xa')](function(_0x4dcd39){logger['info'](_0x3c2a('0x1b'),_0x168b4a);logger[_0x3c2a('0x19')](_0x3c2a('0x1b'),_0x168b4a,JSON['stringify'](_0x4dcd39));_0x813c7e(_0x4dcd39);})[_0x3c2a('0x12')](function(_0x161e46){logger['error'](_0x3c2a('0x1b'),_0x161e46[_0x3c2a('0x10')],_0x168b4a);_0x3f1e46(_0xfe7f51[_0x3c2a('0xf')](0x1f4,_0x161e46['message']));});});}; \ No newline at end of file +var _0x5914=['result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueueReport,\x20%s,\x20%s'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x5914,0xd8));var _0x4591=function(_0x22130c,_0x3e52a7){_0x22130c=_0x22130c-0x0;var _0x448ad2=_0x5914[_0x22130c];return _0x448ad2;};'use strict';var _=require(_0x4591('0x0'));var util=require(_0x4591('0x1'));var moment=require(_0x4591('0x2'));var BPromise=require(_0x4591('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4591('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4591('0x5'));var logger=require(_0x4591('0x6'))('rpc');var config=require(_0x4591('0x7'));var jayson=require(_0x4591('0x8'));var client=jayson[_0x4591('0x9')][_0x4591('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3169b8,_0x1f1e1d,_0x131f6d){return new BPromise(function(_0x376df9,_0x8121c6){return client[_0x4591('0xb')](_0x3169b8,_0x131f6d)[_0x4591('0xc')](function(_0x456377){logger[_0x4591('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x1f1e1d,_0x4591('0xe'));logger[_0x4591('0xf')](_0x4591('0x10'),_0x1f1e1d,_0x4591('0xe'),JSON[_0x4591('0x11')](_0x456377));if(_0x456377[_0x4591('0x12')]){if(_0x456377[_0x4591('0x12')][_0x4591('0x13')]===0x1f4){logger[_0x4591('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x1f1e1d,_0x456377[_0x4591('0x12')]['message']);return _0x8121c6(_0x456377[_0x4591('0x12')][_0x4591('0x14')]);}logger[_0x4591('0x12')](_0x4591('0x15'),_0x1f1e1d,_0x456377[_0x4591('0x12')]['message']);return _0x376df9(_0x456377[_0x4591('0x12')][_0x4591('0x14')]);}else{logger[_0x4591('0xd')](_0x4591('0x15'),_0x1f1e1d,_0x4591('0xe'));_0x376df9(_0x456377[_0x4591('0x16')][_0x4591('0x14')]);}})[_0x4591('0x17')](function(_0x5b063c){logger['error'](_0x4591('0x15'),_0x1f1e1d,_0x5b063c);_0x8121c6(_0x5b063c);});});}exports[_0x4591('0x18')]=function(_0x5a60f5){var _0x4afddf=this;return new Promise(function(_0x4acc4f,_0x2af38f){return db[_0x4591('0x19')][_0x4591('0x1a')](_0x5a60f5[_0x4591('0x1b')],{'raw':_0x5a60f5[_0x4591('0x1c')]?_0x5a60f5['options'][_0x4591('0x1d')]===undefined?!![]:![]:!![]})[_0x4591('0xc')](function(_0x3437f0){logger['info']('CreateChatQueueReport',_0x5a60f5);logger[_0x4591('0xf')](_0x4591('0x18'),_0x5a60f5,JSON['stringify'](_0x3437f0));_0x4acc4f(_0x3437f0);})[_0x4591('0x17')](function(_0x37d396){logger['error'](_0x4591('0x18'),_0x37d396[_0x4591('0x14')],_0x5a60f5);_0x2af38f(_0x4afddf[_0x4591('0x12')](0x1f4,_0x37d396[_0x4591('0x14')]));});});};exports[_0x4591('0x1e')]=function(_0x3bda89){var _0x48f151=this;return new Promise(function(_0x2464f7,_0x298b73){return db[_0x4591('0x19')]['update'](_0x3bda89[_0x4591('0x1b')],{'raw':_0x3bda89[_0x4591('0x1c')]?_0x3bda89[_0x4591('0x1c')][_0x4591('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bda89[_0x4591('0x1c')]?_0x3bda89['options'][_0x4591('0x1f')]||null:null,'attributes':_0x3bda89[_0x4591('0x1c')]?_0x3bda89[_0x4591('0x1c')][_0x4591('0x20')]||null:null,'limit':_0x3bda89[_0x4591('0x1c')]?_0x3bda89['options'][_0x4591('0x21')]||null:null})[_0x4591('0xc')](function(_0x38f70b){logger[_0x4591('0xd')](_0x4591('0x1e'),_0x3bda89);logger['debug']('UpdateChatQueueReport',_0x3bda89,JSON['stringify'](_0x38f70b));_0x2464f7(_0x38f70b);})['catch'](function(_0x488e97){logger[_0x4591('0x12')]('UpdateChatQueueReport',_0x488e97[_0x4591('0x14')],_0x3bda89);_0x298b73(_0x48f151['error'](0x1f4,_0x488e97['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index e759e02..7445f2b 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 _0xe9a4=['index','describe','post','create','put','/:id','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xe9a4,0xc8));var _0x4e9a=function(_0x4fd75e,_0x219e4a){_0x4fd75e=_0x4fd75e-0x0;var _0x5b6338=_0xe9a4[_0x4fd75e];return _0x5b6338;};'use strict';var multer=require(_0x4e9a('0x0'));var util=require('util');var path=require(_0x4e9a('0x1'));var timeout=require('connect-timeout');var express=require(_0x4e9a('0x2'));var router=express['Router']();var fs_extra=require(_0x4e9a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4e9a('0x4'));var config=require(_0x4e9a('0x5'));var controller=require(_0x4e9a('0x6'));router[_0x4e9a('0x7')]('/',auth[_0x4e9a('0x8')](),controller[_0x4e9a('0x9')]);router[_0x4e9a('0x7')]('/describe',auth[_0x4e9a('0x8')](),controller[_0x4e9a('0xa')]);router[_0x4e9a('0x7')]('/:id',auth[_0x4e9a('0x8')](),controller['show']);router[_0x4e9a('0xb')]('/',auth[_0x4e9a('0x8')](),controller[_0x4e9a('0xc')]);router[_0x4e9a('0xd')](_0x4e9a('0xe'),auth[_0x4e9a('0x8')](),controller[_0x4e9a('0xf')]);router[_0x4e9a('0x10')](_0x4e9a('0xe'),auth[_0x4e9a('0x8')](),controller[_0x4e9a('0x11')]);module[_0x4e9a('0x12')]=router; \ No newline at end of file +var _0x744e=['get','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0x744e,0x128));var _0xe744=function(_0xf277f1,_0x4edf83){_0xf277f1=_0xf277f1-0x0;var _0x164c0a=_0x744e[_0xf277f1];return _0x164c0a;};'use strict';var multer=require(_0xe744('0x0'));var util=require(_0xe744('0x1'));var path=require('path');var timeout=require(_0xe744('0x2'));var express=require('express');var router=express[_0xe744('0x3')]();var fs_extra=require(_0xe744('0x4'));var auth=require(_0xe744('0x5'));var interaction=require(_0xe744('0x6'));var config=require(_0xe744('0x7'));var controller=require('./chatQueueReport.controller');router[_0xe744('0x8')]('/',auth[_0xe744('0x9')](),controller['index']);router[_0xe744('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xe744('0xa')]);router[_0xe744('0x8')](_0xe744('0xb'),auth[_0xe744('0x9')](),controller[_0xe744('0xc')]);router[_0xe744('0xd')]('/',auth['isAuthenticated'](),controller[_0xe744('0xe')]);router['put'](_0xe744('0xb'),auth[_0xe744('0x9')](),controller[_0xe744('0xf')]);router[_0xe744('0x10')](_0xe744('0xb'),auth[_0xe744('0x9')](),controller[_0xe744('0x11')]);module[_0xe744('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index d679bbe..d862caa 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x136290,_0x3e6b8f){var _0x290e92=function(_0x4095d6){while(--_0x4095d6){_0x136290['push'](_0x136290['shift']());}};_0x290e92(++_0x3e6b8f);}(_0x34e8,0x12c));var _0x834e=function(_0x2e4ca5,_0x5beafb){_0x2e4ca5=_0x2e4ca5-0x0;var _0x5e62cb=_0x34e8[_0x2e4ca5];return _0x5e62cb;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x49a16d,_0xeceac0){var _0xfb6993=function(_0x341962){while(--_0x341962){_0x49a16d['push'](_0x49a16d['shift']());}};_0xfb6993(++_0xeceac0);}(_0xedd9,0xfc));var _0x9edd=function(_0x1fed51,_0x6d7174){_0x1fed51=_0x1fed51-0x0;var _0x88b423=_0xedd9[_0x1fed51];return _0x88b423;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index dd4bdfe..41a987e 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 _0x4eaa=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','save','update','destroy','end','name','send','map','ChatTransferReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4eaa,0x168));var _0xa4ea=function(_0x238a23,_0x4fbfa2){_0x238a23=_0x238a23-0x0;var _0x25315e=_0x4eaa[_0x238a23];return _0x25315e;};'use strict';var emlformat=require(_0xa4ea('0x0'));var rimraf=require(_0xa4ea('0x1'));var zipdir=require(_0xa4ea('0x2'));var jsonpatch=require(_0xa4ea('0x3'));var rp=require(_0xa4ea('0x4'));var moment=require(_0xa4ea('0x5'));var BPromise=require(_0xa4ea('0x6'));var Mustache=require(_0xa4ea('0x7'));var util=require('util');var path=require(_0xa4ea('0x8'));var sox=require(_0xa4ea('0x9'));var csv=require(_0xa4ea('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa4ea('0xb'));var _=require(_0xa4ea('0xc'));var squel=require(_0xa4ea('0xd'));var crypto=require(_0xa4ea('0xe'));var jsforce=require(_0xa4ea('0xf'));var deskjs=require(_0xa4ea('0x10'));var toCsv=require(_0xa4ea('0xa'));var querystring=require(_0xa4ea('0x11'));var Papa=require(_0xa4ea('0x12'));var Redis=require(_0xa4ea('0x13'));var authService=require(_0xa4ea('0x14'));var qs=require(_0xa4ea('0x15'));var as=require(_0xa4ea('0x16'));var hardwareService=require(_0xa4ea('0x17'));var logger=require(_0xa4ea('0x18'))(_0xa4ea('0x19'));var utils=require(_0xa4ea('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xa4ea('0x1b'));var db=require(_0xa4ea('0x1c'))['db'];function respondWithStatusCode(_0x542028,_0x28dbee){_0x28dbee=_0x28dbee||0xcc;return function(_0x207c9e){if(_0x207c9e){return _0x542028[_0xa4ea('0x1d')](_0x28dbee);}return _0x542028['status'](_0x28dbee)['end']();};}function respondWithResult(_0x427d65,_0x508366){_0x508366=_0x508366||0xc8;return function(_0x20bf47){if(_0x20bf47){return _0x427d65[_0xa4ea('0x1e')](_0x508366)['json'](_0x20bf47);}};}function respondWithFilteredResult(_0x453879,_0x2abc4b){return function(_0x2b6702){if(_0x2b6702){var _0xd1dcea=typeof _0x2abc4b[_0xa4ea('0x1f')]===_0xa4ea('0x20')&&typeof _0x2abc4b[_0xa4ea('0x21')]===_0xa4ea('0x20');var _0x388a36=_0x2b6702['count'];var _0x7479f4=_0xd1dcea?0x0:_0x2abc4b[_0xa4ea('0x1f')];var _0x1120be=_0xd1dcea?_0x2b6702[_0xa4ea('0x22')]:_0x2abc4b[_0xa4ea('0x1f')]+_0x2abc4b['limit'];var _0x1be082;if(_0x1120be>=_0x388a36){_0x1120be=_0x388a36;_0x1be082=0xc8;}else{_0x1be082=0xce;}_0x453879['status'](_0x1be082);return _0x453879['set'](_0xa4ea('0x23'),_0x7479f4+'-'+_0x1120be+'/'+_0x388a36)['json'](_0x2b6702);}return null;};}function patchUpdates(_0x48757e){return function(_0x48ca42){try{jsonpatch['apply'](_0x48ca42,_0x48757e,!![]);}catch(_0x22cb22){return BPromise['reject'](_0x22cb22);}return _0x48ca42[_0xa4ea('0x24')]();};}function saveUpdates(_0x4898f4,_0x16c89f){return function(_0x5c81f5){if(_0x5c81f5){return _0x5c81f5[_0xa4ea('0x25')](_0x4898f4)['then'](function(_0x26563b){return _0x26563b;});}return null;};}function removeEntity(_0x476785,_0xf2845b){return function(_0x6b66fd){if(_0x6b66fd){return _0x6b66fd[_0xa4ea('0x26')]()['then'](function(){_0x476785[_0xa4ea('0x1e')](0xcc)[_0xa4ea('0x27')]();});}};}function handleEntityNotFound(_0x5773b6,_0x595a32){return function(_0x31c5ed){if(!_0x31c5ed){_0x5773b6[_0xa4ea('0x1d')](0x194);}return _0x31c5ed;};}function handleError(_0x225e96,_0x3c6564){_0x3c6564=_0x3c6564||0x1f4;return function(_0x398e33){logger['error'](_0x398e33['stack']);if(_0x398e33['name']){delete _0x398e33[_0xa4ea('0x28')];}_0x225e96['status'](_0x3c6564)[_0xa4ea('0x29')](_0x398e33);};}exports['index']=function(_0x32365a,_0x30021c){var _0x3cf89c={},_0x49600f={},_0x4a0128={'count':0x0,'rows':[]};var _0x1befeb=_[_0xa4ea('0x2a')](db[_0xa4ea('0x2b')][_0xa4ea('0x2c')],function(_0x196693){return{'name':_0x196693['fieldName'],'type':_0x196693['type'][_0xa4ea('0x2d')]};});_0x49600f[_0xa4ea('0x2e')]=_['map'](_0x1befeb,_0xa4ea('0x28'));_0x49600f['query']=_['keys'](_0x32365a[_0xa4ea('0x2f')]);_0x49600f[_0xa4ea('0x30')]=_[_0xa4ea('0x31')](_0x49600f[_0xa4ea('0x2e')],_0x49600f[_0xa4ea('0x2f')]);_0x3cf89c[_0xa4ea('0x32')]=_[_0xa4ea('0x31')](_0x49600f[_0xa4ea('0x2e')],qs[_0xa4ea('0x33')](_0x32365a[_0xa4ea('0x2f')][_0xa4ea('0x33')]));_0x3cf89c[_0xa4ea('0x32')]=_0x3cf89c[_0xa4ea('0x32')][_0xa4ea('0x34')]?_0x3cf89c['attributes']:_0x49600f['model'];if(!_0x32365a[_0xa4ea('0x2f')][_0xa4ea('0x35')]('nolimit')){_0x3cf89c[_0xa4ea('0x21')]=qs[_0xa4ea('0x21')](_0x32365a[_0xa4ea('0x2f')][_0xa4ea('0x21')]);_0x3cf89c[_0xa4ea('0x1f')]=qs[_0xa4ea('0x1f')](_0x32365a['query'][_0xa4ea('0x1f')]);}_0x3cf89c[_0xa4ea('0x36')]=qs['sort'](_0x32365a[_0xa4ea('0x2f')][_0xa4ea('0x37')]);_0x3cf89c[_0xa4ea('0x38')]=qs[_0xa4ea('0x30')](_[_0xa4ea('0x39')](_0x32365a[_0xa4ea('0x2f')],_0x49600f[_0xa4ea('0x30')]),_0x1befeb);if(_0x32365a[_0xa4ea('0x2f')][_0xa4ea('0x3a')]){_0x3cf89c[_0xa4ea('0x38')]=_[_0xa4ea('0x3b')](_0x3cf89c['where'],{'$or':_[_0xa4ea('0x2a')](_0x1befeb,function(_0x2f71ca){if(_0x2f71ca[_0xa4ea('0x3c')]!==_0xa4ea('0x3d')){var _0x1619a1={};_0x1619a1[_0x2f71ca[_0xa4ea('0x28')]]={'$like':'%'+_0x32365a[_0xa4ea('0x2f')]['filter']+'%'};return _0x1619a1;}})});}_0x3cf89c=_[_0xa4ea('0x3b')]({},_0x3cf89c,_0x32365a[_0xa4ea('0x3e')]);var _0x153ef6={'where':_0x3cf89c[_0xa4ea('0x38')]};return db[_0xa4ea('0x2b')][_0xa4ea('0x22')](_0x153ef6)[_0xa4ea('0x3f')](function(_0x4ff340){_0x4a0128['count']=_0x4ff340;if(_0x32365a[_0xa4ea('0x2f')][_0xa4ea('0x40')]){_0x3cf89c[_0xa4ea('0x41')]=[{'all':!![]}];}return db[_0xa4ea('0x2b')][_0xa4ea('0x42')](_0x3cf89c);})[_0xa4ea('0x3f')](function(_0x26c928){_0x4a0128[_0xa4ea('0x43')]=_0x26c928;return _0x4a0128;})['then'](respondWithFilteredResult(_0x30021c,_0x3cf89c))[_0xa4ea('0x44')](handleError(_0x30021c,null));};exports[_0xa4ea('0x45')]=function(_0x2d8c31,_0x533c79){var _0x3ba9a2={'raw':!![],'where':{'id':_0x2d8c31[_0xa4ea('0x46')]['id']}},_0xd98f30={};_0xd98f30['model']=_[_0xa4ea('0x47')](db[_0xa4ea('0x2b')][_0xa4ea('0x2c')]);_0xd98f30[_0xa4ea('0x2f')]=_['keys'](_0x2d8c31['query']);_0xd98f30[_0xa4ea('0x30')]=_[_0xa4ea('0x31')](_0xd98f30['model'],_0xd98f30['query']);_0x3ba9a2[_0xa4ea('0x32')]=_[_0xa4ea('0x31')](_0xd98f30[_0xa4ea('0x2e')],qs['fields'](_0x2d8c31[_0xa4ea('0x2f')][_0xa4ea('0x33')]));_0x3ba9a2[_0xa4ea('0x32')]=_0x3ba9a2[_0xa4ea('0x32')][_0xa4ea('0x34')]?_0x3ba9a2[_0xa4ea('0x32')]:_0xd98f30['model'];if(_0x2d8c31[_0xa4ea('0x2f')][_0xa4ea('0x40')]){_0x3ba9a2[_0xa4ea('0x41')]=[{'all':!![]}];}_0x3ba9a2=_['merge']({},_0x3ba9a2,_0x2d8c31[_0xa4ea('0x3e')]);return db[_0xa4ea('0x2b')][_0xa4ea('0x48')](_0x3ba9a2)['then'](handleEntityNotFound(_0x533c79,null))[_0xa4ea('0x3f')](respondWithResult(_0x533c79,null))['catch'](handleError(_0x533c79,null));};exports[_0xa4ea('0x49')]=function(_0x5916f0,_0x34abe2){return db['ChatTransferReport']['create'](_0x5916f0[_0xa4ea('0x4a')],{})[_0xa4ea('0x3f')](respondWithResult(_0x34abe2,0xc9))[_0xa4ea('0x44')](handleError(_0x34abe2,null));};exports[_0xa4ea('0x25')]=function(_0x168b54,_0x34a6f1){if(_0x168b54[_0xa4ea('0x4a')]['id']){delete _0x168b54[_0xa4ea('0x4a')]['id'];}return db[_0xa4ea('0x2b')][_0xa4ea('0x48')]({'where':{'id':_0x168b54[_0xa4ea('0x46')]['id']}})['then'](handleEntityNotFound(_0x34a6f1,null))['then'](saveUpdates(_0x168b54[_0xa4ea('0x4a')],null))[_0xa4ea('0x3f')](respondWithResult(_0x34a6f1,null))[_0xa4ea('0x44')](handleError(_0x34a6f1,null));};exports[_0xa4ea('0x26')]=function(_0x157c42,_0x4d2cfd){return db[_0xa4ea('0x2b')][_0xa4ea('0x48')]({'where':{'id':_0x157c42[_0xa4ea('0x46')]['id']}})[_0xa4ea('0x3f')](handleEntityNotFound(_0x4d2cfd,null))[_0xa4ea('0x3f')](removeEntity(_0x4d2cfd,null))['catch'](handleError(_0x4d2cfd,null));};exports[_0xa4ea('0x4b')]=function(_0x295a66,_0x41d669){return db[_0xa4ea('0x2b')]['describe']()[_0xa4ea('0x3f')](respondWithResult(_0x41d669,null))[_0xa4ea('0x44')](handleError(_0x41d669,null));}; \ No newline at end of file +var _0x9095=['lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','stack','name','index','map','ChatTransferReport','fieldName','type','key','model','query','filters','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','keys','intersection','includeAll','include','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv'];(function(_0x16d175,_0x397d10){var _0x5a461c=function(_0x228568){while(--_0x228568){_0x16d175['push'](_0x16d175['shift']());}};_0x5a461c(++_0x397d10);}(_0x9095,0x10b));var _0x5909=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x9095[_0x1d50f2];return _0x3769b8;};'use strict';var emlformat=require(_0x5909('0x0'));var rimraf=require(_0x5909('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5909('0x2'));var rp=require(_0x5909('0x3'));var moment=require('moment');var BPromise=require(_0x5909('0x4'));var Mustache=require(_0x5909('0x5'));var util=require(_0x5909('0x6'));var path=require(_0x5909('0x7'));var sox=require('sox');var csv=require(_0x5909('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5909('0x9'));var squel=require(_0x5909('0xa'));var crypto=require(_0x5909('0xb'));var jsforce=require(_0x5909('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5909('0xd'));var Papa=require(_0x5909('0xe'));var Redis=require(_0x5909('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5909('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5909('0x11'));var logger=require('../../config/logger')(_0x5909('0x12'));var utils=require('../../config/utils');var config=require(_0x5909('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5909('0x14'))['db'];function respondWithStatusCode(_0x482a29,_0x394f07){_0x394f07=_0x394f07||0xcc;return function(_0x18c844){if(_0x18c844){return _0x482a29[_0x5909('0x15')](_0x394f07);}return _0x482a29[_0x5909('0x16')](_0x394f07)[_0x5909('0x17')]();};}function respondWithResult(_0x3c1dc5,_0xfccf38){_0xfccf38=_0xfccf38||0xc8;return function(_0x4029c4){if(_0x4029c4){return _0x3c1dc5[_0x5909('0x16')](_0xfccf38)['json'](_0x4029c4);}};}function respondWithFilteredResult(_0x20d4c2,_0x306396){return function(_0x4a3f02){if(_0x4a3f02){var _0x27a35=typeof _0x306396[_0x5909('0x18')]===_0x5909('0x19')&&typeof _0x306396[_0x5909('0x1a')]===_0x5909('0x19');var _0x2a65d6=_0x4a3f02[_0x5909('0x1b')];var _0x45d07e=_0x27a35?0x0:_0x306396[_0x5909('0x18')];var _0x16f2ae=_0x27a35?_0x4a3f02[_0x5909('0x1b')]:_0x306396['offset']+_0x306396[_0x5909('0x1a')];var _0x1fddd2;if(_0x16f2ae>=_0x2a65d6){_0x16f2ae=_0x2a65d6;_0x1fddd2=0xc8;}else{_0x1fddd2=0xce;}_0x20d4c2[_0x5909('0x16')](_0x1fddd2);return _0x20d4c2['set'](_0x5909('0x1c'),_0x45d07e+'-'+_0x16f2ae+'/'+_0x2a65d6)[_0x5909('0x1d')](_0x4a3f02);}return null;};}function patchUpdates(_0x4a4fbf){return function(_0x45f4b1){try{jsonpatch[_0x5909('0x1e')](_0x45f4b1,_0x4a4fbf,!![]);}catch(_0x456e69){return BPromise[_0x5909('0x1f')](_0x456e69);}return _0x45f4b1['save']();};}function saveUpdates(_0x49d09c,_0x14eb2c){return function(_0xe65dc1){if(_0xe65dc1){return _0xe65dc1[_0x5909('0x20')](_0x49d09c)[_0x5909('0x21')](function(_0x193ff8){return _0x193ff8;});}return null;};}function removeEntity(_0x14f0b9,_0x1b8428){return function(_0x2c96fd){if(_0x2c96fd){return _0x2c96fd[_0x5909('0x22')]()['then'](function(){_0x14f0b9[_0x5909('0x16')](0xcc)[_0x5909('0x17')]();});}};}function handleEntityNotFound(_0x2db45d,_0x350b27){return function(_0x1b589e){if(!_0x1b589e){_0x2db45d['sendStatus'](0x194);}return _0x1b589e;};}function handleError(_0x2355da,_0x5d5d96){_0x5d5d96=_0x5d5d96||0x1f4;return function(_0x23c756){logger['error'](_0x23c756[_0x5909('0x23')]);if(_0x23c756['name']){delete _0x23c756[_0x5909('0x24')];}_0x2355da['status'](_0x5d5d96)['send'](_0x23c756);};}exports[_0x5909('0x25')]=function(_0x49a4c9,_0x5ec320){var _0x25a8ac={},_0x25abda={},_0x3578c6={'count':0x0,'rows':[]};var _0x46eceb=_[_0x5909('0x26')](db[_0x5909('0x27')]['rawAttributes'],function(_0x492703){return{'name':_0x492703[_0x5909('0x28')],'type':_0x492703[_0x5909('0x29')][_0x5909('0x2a')]};});_0x25abda[_0x5909('0x2b')]=_[_0x5909('0x26')](_0x46eceb,_0x5909('0x24'));_0x25abda['query']=_['keys'](_0x49a4c9[_0x5909('0x2c')]);_0x25abda[_0x5909('0x2d')]=_['intersection'](_0x25abda[_0x5909('0x2b')],_0x25abda[_0x5909('0x2c')]);_0x25a8ac[_0x5909('0x2e')]=_['intersection'](_0x25abda[_0x5909('0x2b')],qs[_0x5909('0x2f')](_0x49a4c9[_0x5909('0x2c')][_0x5909('0x2f')]));_0x25a8ac[_0x5909('0x2e')]=_0x25a8ac[_0x5909('0x2e')][_0x5909('0x30')]?_0x25a8ac['attributes']:_0x25abda[_0x5909('0x2b')];if(!_0x49a4c9[_0x5909('0x2c')]['hasOwnProperty'](_0x5909('0x31'))){_0x25a8ac[_0x5909('0x1a')]=qs[_0x5909('0x1a')](_0x49a4c9['query'][_0x5909('0x1a')]);_0x25a8ac['offset']=qs[_0x5909('0x18')](_0x49a4c9[_0x5909('0x2c')][_0x5909('0x18')]);}_0x25a8ac['order']=qs[_0x5909('0x32')](_0x49a4c9['query'][_0x5909('0x32')]);_0x25a8ac[_0x5909('0x33')]=qs['filters'](_[_0x5909('0x34')](_0x49a4c9['query'],_0x25abda[_0x5909('0x2d')]),_0x46eceb);if(_0x49a4c9['query'][_0x5909('0x35')]){_0x25a8ac[_0x5909('0x33')]=_[_0x5909('0x36')](_0x25a8ac['where'],{'$or':_[_0x5909('0x26')](_0x46eceb,function(_0x201c17){if(_0x201c17['type']!==_0x5909('0x37')){var _0x318cfc={};_0x318cfc[_0x201c17[_0x5909('0x24')]]={'$like':'%'+_0x49a4c9[_0x5909('0x2c')][_0x5909('0x35')]+'%'};return _0x318cfc;}})});}_0x25a8ac=_[_0x5909('0x36')]({},_0x25a8ac,_0x49a4c9[_0x5909('0x38')]);var _0x52f578={'where':_0x25a8ac[_0x5909('0x33')]};return db[_0x5909('0x27')][_0x5909('0x1b')](_0x52f578)[_0x5909('0x21')](function(_0x3f2d45){_0x3578c6['count']=_0x3f2d45;if(_0x49a4c9[_0x5909('0x2c')]['includeAll']){_0x25a8ac['include']=[{'all':!![]}];}return db[_0x5909('0x27')]['findAll'](_0x25a8ac);})[_0x5909('0x21')](function(_0x23759d){_0x3578c6[_0x5909('0x39')]=_0x23759d;return _0x3578c6;})[_0x5909('0x21')](respondWithFilteredResult(_0x5ec320,_0x25a8ac))[_0x5909('0x3a')](handleError(_0x5ec320,null));};exports[_0x5909('0x3b')]=function(_0x3998a5,_0x193031){var _0x2bec3a={'raw':!![],'where':{'id':_0x3998a5['params']['id']}},_0x30b0bb={};_0x30b0bb['model']=_[_0x5909('0x3c')](db[_0x5909('0x27')]['rawAttributes']);_0x30b0bb[_0x5909('0x2c')]=_[_0x5909('0x3c')](_0x3998a5[_0x5909('0x2c')]);_0x30b0bb[_0x5909('0x2d')]=_[_0x5909('0x3d')](_0x30b0bb[_0x5909('0x2b')],_0x30b0bb[_0x5909('0x2c')]);_0x2bec3a[_0x5909('0x2e')]=_['intersection'](_0x30b0bb[_0x5909('0x2b')],qs[_0x5909('0x2f')](_0x3998a5['query']['fields']));_0x2bec3a[_0x5909('0x2e')]=_0x2bec3a[_0x5909('0x2e')]['length']?_0x2bec3a[_0x5909('0x2e')]:_0x30b0bb[_0x5909('0x2b')];if(_0x3998a5[_0x5909('0x2c')][_0x5909('0x3e')]){_0x2bec3a[_0x5909('0x3f')]=[{'all':!![]}];}_0x2bec3a=_[_0x5909('0x36')]({},_0x2bec3a,_0x3998a5[_0x5909('0x38')]);return db[_0x5909('0x27')][_0x5909('0x40')](_0x2bec3a)['then'](handleEntityNotFound(_0x193031,null))[_0x5909('0x21')](respondWithResult(_0x193031,null))['catch'](handleError(_0x193031,null));};exports[_0x5909('0x41')]=function(_0xac4b50,_0x3bc6e6){return db[_0x5909('0x27')][_0x5909('0x41')](_0xac4b50['body'],{})[_0x5909('0x21')](respondWithResult(_0x3bc6e6,0xc9))[_0x5909('0x3a')](handleError(_0x3bc6e6,null));};exports[_0x5909('0x20')]=function(_0x1a1dd0,_0x407ece){if(_0x1a1dd0[_0x5909('0x42')]['id']){delete _0x1a1dd0[_0x5909('0x42')]['id'];}return db[_0x5909('0x27')][_0x5909('0x40')]({'where':{'id':_0x1a1dd0[_0x5909('0x43')]['id']}})[_0x5909('0x21')](handleEntityNotFound(_0x407ece,null))[_0x5909('0x21')](saveUpdates(_0x1a1dd0['body'],null))[_0x5909('0x21')](respondWithResult(_0x407ece,null))['catch'](handleError(_0x407ece,null));};exports[_0x5909('0x22')]=function(_0x250429,_0x837aa1){return db[_0x5909('0x27')][_0x5909('0x40')]({'where':{'id':_0x250429[_0x5909('0x43')]['id']}})['then'](handleEntityNotFound(_0x837aa1,null))[_0x5909('0x21')](removeEntity(_0x837aa1,null))[_0x5909('0x3a')](handleError(_0x837aa1,null));};exports[_0x5909('0x44')]=function(_0x245cce,_0x329b64){return db[_0x5909('0x27')][_0x5909('0x44')]()[_0x5909('0x21')](respondWithResult(_0x329b64,null))[_0x5909('0x3a')](handleError(_0x329b64,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 7f4e063..1ed9b7f 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 _0x6d87=['define','ChatTransferReport','report_chat_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports'];(function(_0x5c0332,_0x415224){var _0x47d80d=function(_0x7c3c86){while(--_0x7c3c86){_0x5c0332['push'](_0x5c0332['shift']());}};_0x47d80d(++_0x415224);}(_0x6d87,0xb7));var _0x76d8=function(_0x1c8517,_0x5b44a0){_0x1c8517=_0x1c8517-0x0;var _0x21d4d6=_0x6d87[_0x1c8517];return _0x21d4d6;};'use strict';var _=require(_0x76d8('0x0'));var util=require(_0x76d8('0x1'));var logger=require(_0x76d8('0x2'))(_0x76d8('0x3'));var moment=require(_0x76d8('0x4'));var BPromise=require(_0x76d8('0x5'));var rp=require(_0x76d8('0x6'));var fs=require('fs');var path=require(_0x76d8('0x7'));var rimraf=require(_0x76d8('0x8'));var config=require(_0x76d8('0x9'));var attributes=require(_0x76d8('0xa'));module[_0x76d8('0xb')]=function(_0x3a51b6,_0x4a2b53){return _0x3a51b6[_0x76d8('0xc')](_0x76d8('0xd'),attributes,{'tableName':_0x76d8('0xe'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x473c=['rimraf','./chatTransferReport.attributes','exports','define','uniqueid','lodash','util','api','moment','path'];(function(_0x5d93c7,_0x580b09){var _0x54a38b=function(_0x38c4c2){while(--_0x38c4c2){_0x5d93c7['push'](_0x5d93c7['shift']());}};_0x54a38b(++_0x580b09);}(_0x473c,0x195));var _0xc473=function(_0x2e8984,_0x33b773){_0x2e8984=_0x2e8984-0x0;var _0x2276f9=_0x473c[_0x2e8984];return _0x2276f9;};'use strict';var _=require(_0xc473('0x0'));var util=require(_0xc473('0x1'));var logger=require('../../config/logger')(_0xc473('0x2'));var moment=require(_0xc473('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc473('0x4'));var rimraf=require(_0xc473('0x5'));var config=require('../../config/environment');var attributes=require(_0xc473('0x6'));module[_0xc473('0x7')]=function(_0x460096,_0x63ccba){return _0x460096[_0xc473('0x8')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xc473('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 98100c4..715908b 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 _0xac1b=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2685b2,_0x513f32){var _0x54b54e=function(_0x57ff7e){while(--_0x57ff7e){_0x2685b2['push'](_0x2685b2['shift']());}};_0x54b54e(++_0x513f32);}(_0xac1b,0xf7));var _0xbac1=function(_0x451964,_0x136606){_0x451964=_0x451964-0x0;var _0x3d7ce3=_0xac1b[_0x451964];return _0x3d7ce3;};'use strict';var _=require(_0xbac1('0x0'));var util=require(_0xbac1('0x1'));var moment=require(_0xbac1('0x2'));var BPromise=require(_0xbac1('0x3'));var rs=require(_0xbac1('0x4'));var fs=require('fs');var Redis=require(_0xbac1('0x5'));var db=require(_0xbac1('0x6'))['db'];var utils=require(_0xbac1('0x7'));var logger=require('../../config/logger')(_0xbac1('0x8'));var config=require(_0xbac1('0x9'));var jayson=require(_0xbac1('0xa'));var client=jayson['client'][_0xbac1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cdce2,_0x509866,_0x2f4fa2){return new BPromise(function(_0x297b5f,_0x461567){return client[_0xbac1('0xc')](_0x1cdce2,_0x2f4fa2)['then'](function(_0x1e988c){logger[_0xbac1('0xd')](_0xbac1('0xe'),_0x509866,_0xbac1('0xf'));logger[_0xbac1('0x10')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x509866,_0xbac1('0xf'),JSON[_0xbac1('0x11')](_0x1e988c));if(_0x1e988c[_0xbac1('0x12')]){if(_0x1e988c[_0xbac1('0x12')][_0xbac1('0x13')]===0x1f4){logger[_0xbac1('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x509866,_0x1e988c[_0xbac1('0x12')][_0xbac1('0x14')]);return _0x461567(_0x1e988c[_0xbac1('0x12')][_0xbac1('0x14')]);}logger[_0xbac1('0x12')](_0xbac1('0xe'),_0x509866,_0x1e988c[_0xbac1('0x12')]['message']);return _0x297b5f(_0x1e988c['error']['message']);}else{logger[_0xbac1('0xd')](_0xbac1('0xe'),_0x509866,_0xbac1('0xf'));_0x297b5f(_0x1e988c['result'][_0xbac1('0x14')]);}})[_0xbac1('0x15')](function(_0x64d326){logger[_0xbac1('0x12')](_0xbac1('0xe'),_0x509866,_0x64d326);_0x461567(_0x64d326);});});} \ No newline at end of file +var _0x2678=['client','http','info','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','ChatTransferReport,\x20%s,\x20%s','message','result','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4231f1,_0x49b6d7){var _0x17c488=function(_0x4c7503){while(--_0x4c7503){_0x4231f1['push'](_0x4231f1['shift']());}};_0x17c488(++_0x49b6d7);}(_0x2678,0x184));var _0x8267=function(_0x56adf6,_0x75dd7f){_0x56adf6=_0x56adf6-0x0;var _0x446c40=_0x2678[_0x56adf6];return _0x446c40;};'use strict';var _=require('lodash');var util=require(_0x8267('0x0'));var moment=require(_0x8267('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8267('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8267('0x3'));var logger=require(_0x8267('0x4'))(_0x8267('0x5'));var config=require(_0x8267('0x6'));var jayson=require(_0x8267('0x7'));var client=jayson[_0x8267('0x8')][_0x8267('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf3b829,_0x2e6ce0,_0x30dc87){return new BPromise(function(_0x509a08,_0x572473){return client['request'](_0xf3b829,_0x30dc87)['then'](function(_0x1bb3e9){logger[_0x8267('0xa')]('ChatTransferReport,\x20%s,\x20%s',_0x2e6ce0,_0x8267('0xb'));logger['debug'](_0x8267('0xc'),_0x2e6ce0,'request\x20sent',JSON[_0x8267('0xd')](_0x1bb3e9));if(_0x1bb3e9[_0x8267('0xe')]){if(_0x1bb3e9[_0x8267('0xe')]['code']===0x1f4){logger['error'](_0x8267('0xf'),_0x2e6ce0,_0x1bb3e9['error'][_0x8267('0x10')]);return _0x572473(_0x1bb3e9[_0x8267('0xe')][_0x8267('0x10')]);}logger[_0x8267('0xe')](_0x8267('0xf'),_0x2e6ce0,_0x1bb3e9[_0x8267('0xe')][_0x8267('0x10')]);return _0x509a08(_0x1bb3e9[_0x8267('0xe')][_0x8267('0x10')]);}else{logger['info'](_0x8267('0xf'),_0x2e6ce0,_0x8267('0xb'));_0x509a08(_0x1bb3e9[_0x8267('0x11')]['message']);}})['catch'](function(_0x7c58d7){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x2e6ce0,_0x7c58d7);_0x572473(_0x7c58d7);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 7e83b1b..b2eaca3 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 _0xc641=['index','/describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated'];(function(_0x56c9cd,_0x23be19){var _0x18cff0=function(_0x35de34){while(--_0x35de34){_0x56c9cd['push'](_0x56c9cd['shift']());}};_0x18cff0(++_0x23be19);}(_0xc641,0x199));var _0x1c64=function(_0x5a3502,_0x21e27a){_0x5a3502=_0x5a3502-0x0;var _0x5a5be7=_0xc641[_0x5a3502];return _0x5a5be7;};'use strict';var multer=require(_0x1c64('0x0'));var util=require(_0x1c64('0x1'));var path=require(_0x1c64('0x2'));var timeout=require(_0x1c64('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1c64('0x4'));var interaction=require(_0x1c64('0x5'));var config=require('../../config/environment');var controller=require(_0x1c64('0x6'));router[_0x1c64('0x7')]('/',auth[_0x1c64('0x8')](),controller[_0x1c64('0x9')]);router[_0x1c64('0x7')](_0x1c64('0xa'),auth[_0x1c64('0x8')](),controller['describe']);router[_0x1c64('0x7')](_0x1c64('0xb'),auth[_0x1c64('0x8')](),controller[_0x1c64('0xc')]);router[_0x1c64('0xd')]('/',auth[_0x1c64('0x8')](),controller[_0x1c64('0xe')]);router[_0x1c64('0xf')](_0x1c64('0xb'),auth[_0x1c64('0x8')](),controller[_0x1c64('0x10')]);router[_0x1c64('0x11')](_0x1c64('0xb'),auth[_0x1c64('0x8')](),controller[_0x1c64('0x12')]);module['exports']=router; \ No newline at end of file +var _0x71a5=['get','/describe','isAuthenticated','describe','show','post','create','/:id','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x71a5,0x15d));var _0x571a=function(_0x3350f1,_0x29819e){_0x3350f1=_0x3350f1-0x0;var _0x10a8f7=_0x71a5[_0x3350f1];return _0x10a8f7;};'use strict';var multer=require(_0x571a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x571a('0x1'));var express=require(_0x571a('0x2'));var router=express['Router']();var fs_extra=require(_0x571a('0x3'));var auth=require(_0x571a('0x4'));var interaction=require(_0x571a('0x5'));var config=require(_0x571a('0x6'));var controller=require(_0x571a('0x7'));router[_0x571a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x571a('0x9'),auth[_0x571a('0xa')](),controller[_0x571a('0xb')]);router[_0x571a('0x8')]('/:id',auth[_0x571a('0xa')](),controller[_0x571a('0xc')]);router[_0x571a('0xd')]('/',auth[_0x571a('0xa')](),controller[_0x571a('0xe')]);router['put'](_0x571a('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x571a('0xf'),auth[_0x571a('0xa')](),controller[_0x571a('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 1f0fecf..38c4944 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 _0x3024=['Send','BOOLEAN','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','TEXT','stringify','name','text','input','email','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','Agent','#011F6A','INTEGER','ENUM','rounded','squared','We\x20are\x20here!'];(function(_0x40be1a,_0x13b843){var _0x4e6f36=function(_0x85771f){while(--_0x85771f){_0x40be1a['push'](_0x40be1a['shift']());}};_0x4e6f36(++_0x13b843);}(_0x3024,0x132));var _0x4302=function(_0x2699d2,_0x5f2b76){_0x2699d2=_0x2699d2-0x0;var _0x367b86=_0x3024[_0x2699d2];return _0x367b86;};'use strict';var Sequelize=require(_0x4302('0x0'));var rs=require(_0x4302('0x1'));module[_0x4302('0x2')]={'name':{'type':Sequelize[_0x4302('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4302('0x4')},'description':{'type':Sequelize[_0x4302('0x3')]},'mapKey':{'type':Sequelize[_0x4302('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x4302('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x4302('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x4302('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x4302('0x3')],'allowNull':![],'defaultValue':_0x4302('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x4302('0x3')],'allowNull':![],'defaultValue':_0x4302('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x4302('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x4302('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x4302('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x4302('0x8')](_0x4302('0x9'),_0x4302('0xa')),'defaultValue':_0x4302('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x4302('0xb')},'start_chat_button':{'type':Sequelize[_0x4302('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x4302('0xc')},'header_offline':{'type':Sequelize[_0x4302('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x4302('0xd')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x4302('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x4302('0x3')],'defaultValue':_0x4302('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x4302('0xd')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x4302('0x3')],'defaultValue':_0x4302('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x4302('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x4302('0x3')],'defaultValue':_0x4302('0x10')},'noteTitle':{'type':Sequelize[_0x4302('0x3')],'defaultValue':_0x4302('0x11')},'placeholderMessage':{'type':Sequelize[_0x4302('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4302('0x12')},'closingMessageButton':{'type':Sequelize[_0x4302('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x4302('0x3')],'defaultValue':_0x4302('0x13')},'conditionAgreement':{'type':Sequelize[_0x4302('0xd')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x4302('0xd')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x4302('0xd')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x4302('0xd')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x4302('0x3')],'defaultValue':_0x4302('0x14')},'ratingType':{'type':Sequelize[_0x4302('0x8')](_0x4302('0x15'),_0x4302('0x16')),'defaultValue':_0x4302('0x15')},'ratingStarsNumber':{'type':Sequelize[_0x4302('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x4302('0x17')],'defaultValue':function(){return JSON[_0x4302('0x18')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x4302('0x19'),'type':_0x4302('0x1a'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x4302('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x4302('0x1c'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x4302('0x1d'))?JSON[_0x4302('0x1e')](this[_0x4302('0x1f')]('onlineForm')):{};},'set':function(_0x4988bf){return this[_0x4302('0x20')](_0x4302('0x1d'),JSON[_0x4302('0x18')](_0x4988bf));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x4302('0x18')]({'items':[{'type':_0x4302('0x1b'),'props':{'title':_0x4302('0x1c'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x4302('0x1c')},'variable':null},{'type':_0x4302('0x21'),'config':{'placeholder':'Comments'},'props':{'title':_0x4302('0x22'),'helpText':_0x4302('0x23')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x4302('0x24'))?JSON[_0x4302('0x1e')](this['getDataValue'](_0x4302('0x24'))):{};},'set':function(_0x2fd688){return this['setDataValue'](_0x4302('0x24'),JSON[_0x4302('0x18')](_0x2fd688));}},'token':{'type':Sequelize[_0x4302('0x3')],'defaultValue':function(){return rs[_0x4302('0x25')]();}},'autoclose':{'type':Sequelize[_0x4302('0xd')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x4302('0xd')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x4302('0x3')]},'forwardOffline':{'type':Sequelize[_0x4302('0xd')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x4302('0x26')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x4302('0x3')],'defaultValue':_0x4302('0x27')},'offlineMessageBody':{'type':Sequelize[_0x4302('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x4302('0xd')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x4302('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x4302('0x3')],'defaultValue':_0x4302('0x13')},'sendUnmanaged':{'type':Sequelize[_0x4302('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x4302('0xd')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x4302('0xd')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x4302('0x3')]},'notificationTemplate':{'type':Sequelize[_0x4302('0x17')],'defaultValue':function(){return _0x4302('0x28');}},'notificationSound':{'type':Sequelize[_0x4302('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4302('0xd')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x4302('0xd')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x4302('0x29')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x4302('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x4302('0x3')],'defaultValue':_0x4302('0x2b')},'messagesAlignment':{'type':Sequelize[_0x4302('0x3')],'defaultValue':_0x4302('0x2c')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x4302('0xd')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x4302('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x4302('0x3')],'allowNull':![],'defaultValue':_0x4302('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x4302('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4302('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x4302('0x3')],'defaultValue':_0x4302('0x2e')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4302('0x7')],'comment':_0x4302('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0x4302('0xd')],'defaultValue':![],'comment':_0x4302('0x30'),'set':function(_0x286f87){if(!_0x286f87)this['setDataValue'](_0x4302('0x31'),null);this[_0x4302('0x20')](_0x4302('0x32'),_0x286f87);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x4302('0x3')]},'vidaooTopic':{'type':Sequelize[_0x4302('0x3')],'allowNull':![],'defaultValue':_0x4302('0x33')},'vidaooNote':{'type':Sequelize[_0x4302('0x3')],'defaultValue':function(){return _0x4302('0x34');}},'vidaooMetadata':{'type':Sequelize[_0x4302('0x17')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x4302('0xd')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x4302('0x17')]}}; \ No newline at end of file +var _0xba0c=['Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb','star','stringify','input','name','text','parse','getDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','STRING','address','email','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','TEXT'];(function(_0x3d717a,_0x275ddb){var _0xe821b5=function(_0x231451){while(--_0x231451){_0x3d717a['push'](_0x3d717a['shift']());}};_0xe821b5(++_0x275ddb);}(_0xba0c,0x124));var _0xcba0=function(_0x3054ad,_0x56047e){_0x3054ad=_0x3054ad-0x0;var _0x21e7fc=_0xba0c[_0x3054ad];return _0x21e7fc;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xcba0('0x0'));module['exports']={'name':{'type':Sequelize[_0xcba0('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0xcba0('0x1')],'allowNull':![],'unique':_0xcba0('0x2')},'description':{'type':Sequelize[_0xcba0('0x1')]},'mapKey':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':_0xcba0('0x3')},'mapKeyOffline':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':_0xcba0('0x3')},'key':{'type':Sequelize[_0xcba0('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xcba0('0x1')],'allowNull':![],'defaultValue':_0xcba0('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xcba0('0x1')],'allowNull':![],'defaultValue':_0xcba0('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xcba0('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xcba0('0x5')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xcba0('0x1')]},'animation':{'type':Sequelize[_0xcba0('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xcba0('0x7')](_0xcba0('0x8'),_0xcba0('0x9')),'defaultValue':_0xcba0('0x8')},'header_online':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':_0xcba0('0xa')},'start_chat_button':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':_0xcba0('0xb')},'offline_chat_button':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':_0xcba0('0xc')},'header_offline':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xcba0('0x6')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xcba0('0x5')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xcba0('0x6')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xcba0('0xd')]},'closingQuestion':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':_0xcba0('0xe')},'formSubmitFailureMessage':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':_0xcba0('0xf')},'noteTitle':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':_0xcba0('0x10')},'placeholderMessage':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':_0xcba0('0x11')},'closingMessage':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':_0xcba0('0x12')},'closingMessageButton':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':_0xcba0('0xc')},'skipMessageButton':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':_0xcba0('0x13')},'conditionAgreement':{'type':Sequelize[_0xcba0('0x6')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xcba0('0x6')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xcba0('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xcba0('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':_0xcba0('0x14')},'ratingType':{'type':Sequelize[_0xcba0('0x7')]('star',_0xcba0('0x15')),'defaultValue':_0xcba0('0x16')},'ratingStarsNumber':{'type':Sequelize[_0xcba0('0x5')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xcba0('0xd')],'defaultValue':function(){return JSON[_0xcba0('0x17')]({'items':[{'type':_0xcba0('0x18'),'variable':null,'config':{'placeholder':_0xcba0('0x19'),'type':_0xcba0('0x1a'),'required':!![]},'props':{'title':_0xcba0('0x19'),'helpText':''}},{'type':_0xcba0('0x18'),'props':{'title':_0xcba0('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xcba0('0x3'),'type':_0xcba0('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0xcba0('0x1b')](this[_0xcba0('0x1c')](_0xcba0('0x1d'))):{};},'set':function(_0x19e520){return this['setDataValue']('onlineForm',JSON[_0xcba0('0x17')](_0x19e520));}},'offlineForm':{'type':Sequelize[_0xcba0('0xd')],'defaultValue':function(){return JSON[_0xcba0('0x17')]({'items':[{'type':_0xcba0('0x18'),'props':{'title':_0xcba0('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xcba0('0x3'),'type':_0xcba0('0x3')},'variable':null},{'type':_0xcba0('0x1e'),'config':{'placeholder':_0xcba0('0x1f')},'props':{'title':'Comments','helpText':_0xcba0('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0xcba0('0x1c')](_0xcba0('0x21'))?JSON['parse'](this[_0xcba0('0x1c')](_0xcba0('0x21'))):{};},'set':function(_0x2b41ee){return this[_0xcba0('0x22')](_0xcba0('0x21'),JSON['stringify'](_0x2b41ee));}},'token':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xcba0('0x6')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xcba0('0x6')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xcba0('0x6')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xcba0('0x1')]},'forwardOffline':{'type':Sequelize[_0xcba0('0x6')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xcba0('0x1')]},'waitingTitle':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':_0xcba0('0x23')},'waitingMessage':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':_0xcba0('0x24')},'offlineMessageSubject':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':_0xcba0('0x25')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xcba0('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0xcba0('0x6')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':_0xcba0('0x27')},'skipUnmanaged':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':_0xcba0('0x13')},'sendUnmanaged':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':_0xcba0('0xc')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xcba0('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xcba0('0x6')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xcba0('0x1')]},'notificationTemplate':{'type':Sequelize[_0xcba0('0xd')],'defaultValue':function(){return _0xcba0('0x28');}},'notificationSound':{'type':Sequelize[_0xcba0('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcba0('0x6')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xcba0('0x6')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':_0xcba0('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xcba0('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':_0xcba0('0x2a')},'verticalAlignment':{'type':Sequelize[_0xcba0('0x5')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':_0xcba0('0x2b')},'defaultTitle':{'type':Sequelize[_0xcba0('0x1')]},'customerAvatar':{'type':Sequelize[_0xcba0('0xd')]},'showCustomerAvatar':{'type':Sequelize[_0xcba0('0x6')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xcba0('0x1')],'allowNull':![],'defaultValue':_0xcba0('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcba0('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcba0('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcba0('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':_0xcba0('0x2d')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcba0('0x5')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xcba0('0x6')],'defaultValue':![],'comment':_0xcba0('0x2e'),'set':function(_0x58fdc4){if(!_0x58fdc4)this[_0xcba0('0x22')](_0xcba0('0x2f'),null);this[_0xcba0('0x22')](_0xcba0('0x30'),_0x58fdc4);}},'vidaooEscalation':{'type':Sequelize[_0xcba0('0x6')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xcba0('0x1')]},'vidaooTopic':{'type':Sequelize[_0xcba0('0x1')],'allowNull':![],'defaultValue':_0xcba0('0x31')},'vidaooNote':{'type':Sequelize[_0xcba0('0x1')],'defaultValue':function(){return _0xcba0('0x32');}},'vidaooMetadata':{'type':Sequelize[_0xcba0('0xd')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xcba0('0x6')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xcba0('0xd')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index c25f135..bcbc49e 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 _0x727a=['agentAvatar','customerAvatar','file','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','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','Contacts','DESC','applications','list','orderBy','asc','account','Applications','defaults','contact','first','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','device','vendor','%s\x20%s\x20%s','type','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','*,*,*,*','ChatMessage','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','MailAccount','findOrCreate','readFileSync','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','mimetype','server','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','user','SendMail','\x22%s\x22\x20<%s>','MailAccountId','originalname','subjectOffline','mapValues','email','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','ONLINE','OFFLINE','inspect','Interval','Intervals','getProactiveActions','virtual','custom','License','increment','some','server/files/chat/iframe.ejs','remote','connection','remoteAddress','replace','alignment','verticalAlignment','textColor','color_button','backgroundColor','addApplications','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','stack','finally','getApplications','addProactiveActions','omit','ChatProactiveAction','getFields','online','onlineForm','items','fromKey','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','getAgents','bluebird','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','ChatWebsites','UserProfileResource','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','ChatWebsite','includeAll','include','findAll','rows','show','Pause','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','describe','addDisposition','nolimit','Disposition','removeDispositions','addAnswer','ChatWebsiteId','CannedAnswer','getAnswers','findOne','removeAnswers','ids','sitepic','filename','addAvatar'];(function(_0x49f769,_0x50eab7){var _0x30d6e8=function(_0x180aee){while(--_0x180aee){_0x49f769['push'](_0x49f769['shift']());}};_0x30d6e8(++_0x50eab7);}(_0x727a,0x1f0));var _0xa727=function(_0x270c08,_0x142c88){_0x270c08=_0x270c08-0x0;var _0x4a91bb=_0x727a[_0x270c08];return _0x4a91bb;};'use strict';var BPromise=require(_0xa727('0x0'));var Mustache=require('mustache');var util=require(_0xa727('0x1'));var path=require(_0xa727('0x2'));var ejs=require(_0xa727('0x3'));var fs=require('fs');var fs_extra=require(_0xa727('0x4'));var _=require(_0xa727('0x5'));var querystring=require(_0xa727('0x6'));var Redis=require(_0xa727('0x7'));var qs=require(_0xa727('0x8'));var logger=require('../../config/logger')(_0xa727('0x9'));var config=require(_0xa727('0xa'));var db=require(_0xa727('0xb'))['db'];config[_0xa727('0xc')]=_['defaults'](config['redis'],{'host':_0xa727('0xd'),'port':0x18eb});var socket=require(_0xa727('0xe'))(new Redis(config['redis']));require(_0xa727('0xf'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xa727('0x10')][_0xa727('0x11')]({'port':0x232c});var client9002=jayson[_0xa727('0x10')][_0xa727('0x11')]({'port':0x232a});var client9003=jayson['client'][_0xa727('0x11')]({'port':0x232b});var client9001=jayson[_0xa727('0x10')][_0xa727('0x11')]({'port':0x2329});function respondWithRpcPromise(_0x7d88a2,_0x58c70d,_0xed0efa,_0x112741){return new BPromise(function(_0x5670ed,_0x29140b){var _0x1af7a4=_0x112741||client;return _0x1af7a4[_0xa727('0x12')](_0x7d88a2,_0xed0efa)[_0xa727('0x13')](function(_0xfd59a0){logger[_0xa727('0x14')](_0xa727('0x15'),_0x58c70d,'request\x20sent');logger['debug'](_0xa727('0x16'),_0x58c70d,_0xa727('0x17'),JSON[_0xa727('0x18')](_0xfd59a0));if(_0xfd59a0[_0xa727('0x19')]){if(_0xfd59a0[_0xa727('0x19')][_0xa727('0x1a')]===0x1f4){logger[_0xa727('0x19')](_0xa727('0x15'),_0x58c70d,_0xfd59a0['error']['message']);return _0x29140b(_0xfd59a0[_0xa727('0x19')][_0xa727('0x1b')]);}logger['error'](_0xa727('0x15'),_0x58c70d,_0xfd59a0[_0xa727('0x19')][_0xa727('0x1b')]);return _0x5670ed(_0xfd59a0[_0xa727('0x19')][_0xa727('0x1b')]);}else{logger[_0xa727('0x14')](_0xa727('0x15'),_0x58c70d,_0xa727('0x17'));_0x5670ed(_0xfd59a0[_0xa727('0x1c')][_0xa727('0x1b')]);}})['catch'](function(_0x221d46){logger[_0xa727('0x19')](_0xa727('0x15'),_0x58c70d,_0x221d46);_0x29140b(_0x221d46);});});}function respondWithStatusCode(_0x344c09,_0x294dbb){_0x294dbb=_0x294dbb||0xcc;return function(_0x3c6afc){if(_0x3c6afc){return _0x344c09[_0xa727('0x1d')](_0x294dbb);}return _0x344c09[_0xa727('0x1e')](_0x294dbb)[_0xa727('0x1f')]();};}function respondWithResult(_0x40a536,_0x1ff755){_0x1ff755=_0x1ff755||0xc8;return function(_0xeaa649){if(_0xeaa649){return _0x40a536[_0xa727('0x1e')](_0x1ff755)[_0xa727('0x20')](_0xeaa649);}};}function respondWithFilteredResult(_0x2fbc6b,_0x29119a){return function(_0x1b143a){if(_0x1b143a){var _0x1d6d22=typeof _0x29119a[_0xa727('0x21')]===_0xa727('0x22')&&typeof _0x29119a[_0xa727('0x23')]===_0xa727('0x22');var _0x1d3f50=_0x1b143a[_0xa727('0x24')];var _0x168306=_0x1d6d22?0x0:_0x29119a[_0xa727('0x21')];var _0x8285c6=_0x1d6d22?_0x1b143a[_0xa727('0x24')]:_0x29119a[_0xa727('0x21')]+_0x29119a['limit'];var _0x32deef;if(_0x8285c6>=_0x1d3f50){_0x8285c6=_0x1d3f50;_0x32deef=0xc8;}else{_0x32deef=0xce;}_0x2fbc6b['status'](_0x32deef);return _0x2fbc6b[_0xa727('0x25')](_0xa727('0x26'),_0x168306+'-'+_0x8285c6+'/'+_0x1d3f50)[_0xa727('0x20')](_0x1b143a);}return null;};}function saveUpdates(_0x41124f){return function(_0x2e5c09){if(_0x2e5c09){return _0x2e5c09[_0xa727('0x27')](_0x41124f)[_0xa727('0x13')](function(_0x14c087){return _0x14c087;});}return null;};}function removeEntity(_0xe822c0){return function(_0x3f01b2){if(_0x3f01b2){return _0x3f01b2[_0xa727('0x28')]()[_0xa727('0x13')](function(){var _0x543685=_0x3f01b2['get']({'plain':!![]});var _0x202480=_0xa727('0x29');return db[_0xa727('0x2a')][_0xa727('0x28')]({'where':{'type':_0x202480,'resourceId':_0x543685['id']}})[_0xa727('0x13')](function(){return _0x3f01b2;});})[_0xa727('0x13')](function(){_0xe822c0['status'](0xcc)[_0xa727('0x1f')]();});}};}function handleEntityNotFound(_0x28ed6b){return function(_0x54e51b){if(!_0x54e51b){_0x28ed6b['sendStatus'](0x194);}return _0x54e51b;};}function handleError(_0x3096d5,_0x5d998e){_0x5d998e=_0x5d998e||0x1f4;return function(_0x5ec309){logger[_0xa727('0x19')](_0x5ec309['stack']);if(_0x5ec309[_0xa727('0x2b')]){delete _0x5ec309[_0xa727('0x2b')];}_0x3096d5['status'](_0x5d998e)[_0xa727('0x2c')](_0x5ec309);};}exports[_0xa727('0x2d')]=function(_0x33bdc9,_0x5e53ea){var _0x2e1f0c={'include':[{'model':db['Pause'],'as':_0xa727('0x2e')}]},_0x4a879f={},_0x54a9c1={'count':0x0,'rows':[]};var _0x5a69e6=_[_0xa727('0x2f')](db['ChatWebsite'][_0xa727('0x30')],function(_0x3fdef3){return{'name':_0x3fdef3[_0xa727('0x31')],'type':_0x3fdef3['type'][_0xa727('0x32')]};});_0x4a879f[_0xa727('0x33')]=_[_0xa727('0x2f')](_0x5a69e6,_0xa727('0x2b'));_0x4a879f[_0xa727('0x34')]=_[_0xa727('0x35')](_0x33bdc9['query']);_0x4a879f[_0xa727('0x36')]=_[_0xa727('0x37')](_0x4a879f['model'],_0x4a879f[_0xa727('0x34')]);_0x2e1f0c[_0xa727('0x38')]=_[_0xa727('0x37')](_0x4a879f['model'],qs[_0xa727('0x39')](_0x33bdc9[_0xa727('0x34')][_0xa727('0x39')]));_0x2e1f0c[_0xa727('0x38')]=_0x2e1f0c[_0xa727('0x38')][_0xa727('0x3a')]?_0x2e1f0c[_0xa727('0x38')]:_0x4a879f[_0xa727('0x33')];if(!_0x33bdc9[_0xa727('0x34')][_0xa727('0x3b')]('nolimit')){_0x2e1f0c[_0xa727('0x23')]=qs[_0xa727('0x23')](_0x33bdc9[_0xa727('0x34')][_0xa727('0x23')]);_0x2e1f0c[_0xa727('0x21')]=qs['offset'](_0x33bdc9[_0xa727('0x34')][_0xa727('0x21')]);}_0x2e1f0c[_0xa727('0x3c')]=qs[_0xa727('0x3d')](_0x33bdc9['query']['sort']);_0x2e1f0c[_0xa727('0x3e')]=qs[_0xa727('0x36')](_[_0xa727('0x3f')](_0x33bdc9['query'],_0x4a879f[_0xa727('0x36')]),_0x5a69e6);if(_0x33bdc9[_0xa727('0x34')][_0xa727('0x40')]){_0x2e1f0c[_0xa727('0x3e')]=_[_0xa727('0x41')](_0x2e1f0c[_0xa727('0x3e')],{'$or':_[_0xa727('0x2f')](_0x5a69e6,function(_0x5774b1){if(_0x5774b1['type']!=='VIRTUAL'){var _0x564ac7={};_0x564ac7[_0x5774b1['name']]={'$like':'%'+_0x33bdc9[_0xa727('0x34')][_0xa727('0x40')]+'%'};return _0x564ac7;}})});}_0x2e1f0c=_[_0xa727('0x41')]({},_0x2e1f0c,_0x33bdc9[_0xa727('0x42')]);var _0x501abd={'where':_0x2e1f0c[_0xa727('0x3e')]};return db[_0xa727('0x43')]['count'](_0x501abd)[_0xa727('0x13')](function(_0x512a92){_0x54a9c1['count']=_0x512a92;if(_0x33bdc9['query'][_0xa727('0x44')]){_0x2e1f0c[_0xa727('0x45')]=[{'all':!![]}];}return db['ChatWebsite'][_0xa727('0x46')](_0x2e1f0c);})['then'](function(_0x409fd5){_0x54a9c1[_0xa727('0x47')]=_0x409fd5;return _0x54a9c1;})[_0xa727('0x13')](respondWithFilteredResult(_0x5e53ea,_0x2e1f0c))['catch'](handleError(_0x5e53ea,null));};exports[_0xa727('0x48')]=function(_0x41324b,_0x50e87f){var _0x580a34={'raw':![],'where':{'id':_0x41324b['params']['id']},'include':[{'model':db[_0xa727('0x49')],'as':'mandatoryDispositionPause'}]},_0x2760fe={};_0x2760fe[_0xa727('0x33')]=_[_0xa727('0x35')](db[_0xa727('0x43')][_0xa727('0x30')]);_0x2760fe[_0xa727('0x34')]=_[_0xa727('0x35')](_0x41324b[_0xa727('0x34')]);_0x2760fe['filters']=_['intersection'](_0x2760fe[_0xa727('0x33')],_0x2760fe[_0xa727('0x34')]);_0x580a34['attributes']=_['intersection'](_0x2760fe[_0xa727('0x33')],qs[_0xa727('0x39')](_0x41324b[_0xa727('0x34')][_0xa727('0x39')]));_0x580a34[_0xa727('0x38')]=_0x580a34[_0xa727('0x38')][_0xa727('0x3a')]?_0x580a34[_0xa727('0x38')]:_0x2760fe['model'];if(_0x41324b['query'][_0xa727('0x44')]){_0x580a34[_0xa727('0x45')]=[{'all':!![]}];}_0x580a34=_['merge']({},_0x580a34,_0x41324b[_0xa727('0x42')]);return db[_0xa727('0x43')][_0xa727('0x4a')](_0x580a34)['then'](handleEntityNotFound(_0x50e87f,null))[_0xa727('0x13')](respondWithResult(_0x50e87f,null))[_0xa727('0x4b')](handleError(_0x50e87f,null));};exports[_0xa727('0x4c')]=function(_0x25faa4,_0xaad998){return db[_0xa727('0x43')]['create'](_0x25faa4[_0xa727('0x4d')],{})[_0xa727('0x13')](function(_0x3df1ef){var _0x4fccd9=_0x25faa4['user'][_0xa727('0x4e')]({'plain':!![]});if(!_0x4fccd9)throw new Error(_0xa727('0x4f'));if(_0x4fccd9[_0xa727('0x50')]==='user'){var _0x3e8b7a=_0x3df1ef[_0xa727('0x4e')]({'plain':!![]});var _0x2e5d29=_0xa727('0x29');return db[_0xa727('0x51')]['find']({'where':{'name':_0x2e5d29,'userProfileId':_0x4fccd9[_0xa727('0x52')]},'raw':!![]})[_0xa727('0x13')](function(_0x15b21d){if(_0x15b21d&&_0x15b21d[_0xa727('0x53')]===0x0){return db['UserProfileResource'][_0xa727('0x4c')]({'name':_0x3e8b7a['name'],'resourceId':_0x3e8b7a['id'],'type':_0x15b21d[_0xa727('0x2b')],'sectionId':_0x15b21d['id']},{})[_0xa727('0x13')](function(){return _0x3df1ef;});}else{return _0x3df1ef;}})[_0xa727('0x4b')](function(_0x1842e8){logger[_0xa727('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1842e8);throw _0x1842e8;});}return _0x3df1ef;})['then'](respondWithResult(_0xaad998,0xc9))['catch'](handleError(_0xaad998,null));};exports[_0xa727('0x27')]=function(_0x1b9e7b,_0x27b599){if(_0x1b9e7b['body']['id']){delete _0x1b9e7b[_0xa727('0x4d')]['id'];}return db[_0xa727('0x43')][_0xa727('0x4a')]({'where':{'id':_0x1b9e7b[_0xa727('0x54')]['id']},'include':[{'model':db[_0xa727('0x49')],'as':_0xa727('0x2e')}]})['then'](handleEntityNotFound(_0x27b599,null))[_0xa727('0x13')](saveUpdates(_0x1b9e7b[_0xa727('0x4d')],null))[_0xa727('0x13')](respondWithResult(_0x27b599,null))[_0xa727('0x4b')](handleError(_0x27b599,null));};exports['destroy']=function(_0x3d584d,_0x2d6102){return db['ChatWebsite'][_0xa727('0x4a')]({'where':{'id':_0x3d584d[_0xa727('0x54')]['id']}})[_0xa727('0x13')](handleEntityNotFound(_0x2d6102,null))['then'](removeEntity(_0x2d6102,null))[_0xa727('0x4b')](handleError(_0x2d6102,null));};exports[_0xa727('0x55')]=function(_0x1e74e7,_0x301c52){return db[_0xa727('0x43')][_0xa727('0x55')]()[_0xa727('0x13')](respondWithResult(_0x301c52,null))[_0xa727('0x4b')](handleError(_0x301c52,null));};exports[_0xa727('0x56')]=function(_0x16c39,_0x264998){if(_0x16c39[_0xa727('0x4d')]['id']){delete _0x16c39[_0xa727('0x4d')]['id'];}return db[_0xa727('0x43')][_0xa727('0x4a')]({'where':{'id':_0x16c39[_0xa727('0x54')]['id']}})['then'](handleEntityNotFound(_0x264998,null))[_0xa727('0x13')](function(_0x3fdee7){if(_0x3fdee7){_0x16c39[_0xa727('0x4d')]['ChatWebsiteId']=_0x3fdee7['id'];return db['Disposition'][_0xa727('0x4c')](_0x16c39[_0xa727('0x4d')]);}})[_0xa727('0x13')](respondWithResult(_0x264998,null))[_0xa727('0x4b')](handleError(_0x264998,null));};exports['getDispositions']=function(_0x3104e8,_0x1c68c9){var _0x247980={'raw':![],'where':{}};var _0x42c605={};var _0x1361ff={'count':0x0,'rows':[]};return db[_0xa727('0x43')]['findOne']({'where':{'id':_0x3104e8[_0xa727('0x54')]['id']}})[_0xa727('0x13')](handleEntityNotFound(_0x1c68c9,null))['then'](function(_0xec23ba){if(_0xec23ba){_0x42c605[_0xa727('0x33')]=_[_0xa727('0x35')](db['Disposition'][_0xa727('0x30')]);_0x42c605[_0xa727('0x34')]=_[_0xa727('0x35')](_0x3104e8[_0xa727('0x34')]);_0x42c605[_0xa727('0x36')]=_[_0xa727('0x37')](_0x42c605[_0xa727('0x33')],_0x42c605[_0xa727('0x34')]);_0x247980[_0xa727('0x38')]=_['intersection'](_0x42c605[_0xa727('0x33')],qs[_0xa727('0x39')](_0x3104e8[_0xa727('0x34')]['fields']));_0x247980[_0xa727('0x38')]=_0x247980['attributes'][_0xa727('0x3a')]?_0x247980['attributes']:_0x42c605[_0xa727('0x33')];if(!_0x3104e8[_0xa727('0x34')][_0xa727('0x3b')](_0xa727('0x57'))){_0x247980[_0xa727('0x23')]=qs[_0xa727('0x23')](_0x3104e8['query'][_0xa727('0x23')]);_0x247980['offset']=qs['offset'](_0x3104e8[_0xa727('0x34')][_0xa727('0x21')]);}_0x247980[_0xa727('0x3c')]=qs['sort'](_0x3104e8[_0xa727('0x34')]['sort']);_0x247980[_0xa727('0x3e')]=qs[_0xa727('0x36')](_[_0xa727('0x3f')](_0x3104e8[_0xa727('0x34')],_0x42c605[_0xa727('0x36')]));_0x247980[_0xa727('0x3e')]['ChatWebsiteId']=_0xec23ba['id'];if(_0x3104e8[_0xa727('0x34')]['filter']){_0x247980['where']=_[_0xa727('0x41')](_0x247980['where'],{'$or':_[_0xa727('0x2f')](_0x247980['attributes'],function(_0x122a3b){var _0x5535aa={};_0x5535aa[_0x122a3b]={'$like':'%'+_0x3104e8['query'][_0xa727('0x40')]+'%'};return _0x5535aa;})});}_0x247980=_[_0xa727('0x41')]({},_0x247980,_0x3104e8[_0xa727('0x42')]);return db[_0xa727('0x58')]['count']({'where':_0x247980[_0xa727('0x3e')]})[_0xa727('0x13')](function(_0x191f9a){_0x1361ff[_0xa727('0x24')]=_0x191f9a;if(_0x3104e8[_0xa727('0x34')][_0xa727('0x44')]){_0x247980[_0xa727('0x45')]=[{'all':!![]}];}return db[_0xa727('0x58')]['findAll'](_0x247980);})[_0xa727('0x13')](function(_0x17a669){_0x1361ff['rows']=_0x17a669;return _0x1361ff;});}})[_0xa727('0x13')](respondWithFilteredResult(_0x1c68c9,_0x247980))[_0xa727('0x4b')](handleError(_0x1c68c9,null));};exports[_0xa727('0x59')]=function(_0x1f9766,_0x1775fd){return db[_0xa727('0x43')]['find']({'where':{'id':_0x1f9766[_0xa727('0x54')]['id']}})[_0xa727('0x13')](handleEntityNotFound(_0x1775fd,null))['then'](function(_0x200d39){if(_0x200d39){return _0x200d39[_0xa727('0x59')](_0x1f9766[_0xa727('0x34')]['ids']);}})[_0xa727('0x13')](respondWithStatusCode(_0x1775fd,null))[_0xa727('0x4b')](handleError(_0x1775fd,null));};exports[_0xa727('0x5a')]=function(_0x349ed3,_0x52f7bd){if(_0x349ed3[_0xa727('0x4d')]['id']){delete _0x349ed3[_0xa727('0x4d')]['id'];}return db[_0xa727('0x43')][_0xa727('0x4a')]({'where':{'id':_0x349ed3[_0xa727('0x54')]['id']}})[_0xa727('0x13')](handleEntityNotFound(_0x52f7bd,null))[_0xa727('0x13')](function(_0x2380f7){if(_0x2380f7){_0x349ed3[_0xa727('0x4d')][_0xa727('0x5b')]=_0x2380f7['id'];return db[_0xa727('0x5c')]['create'](_0x349ed3[_0xa727('0x4d')]);}})['then'](respondWithResult(_0x52f7bd,null))[_0xa727('0x4b')](handleError(_0x52f7bd,null));};exports[_0xa727('0x5d')]=function(_0x2eea6d,_0x59ca56){var _0x483a8e={'raw':![],'where':{}};var _0x5ee78f={};var _0x2ccb64={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xa727('0x5e')]({'where':{'id':_0x2eea6d[_0xa727('0x54')]['id']}})[_0xa727('0x13')](handleEntityNotFound(_0x59ca56,null))[_0xa727('0x13')](function(_0x2761d1){if(_0x2761d1){_0x5ee78f[_0xa727('0x33')]=_[_0xa727('0x35')](db[_0xa727('0x5c')]['rawAttributes']);_0x5ee78f[_0xa727('0x34')]=_[_0xa727('0x35')](_0x2eea6d[_0xa727('0x34')]);_0x5ee78f[_0xa727('0x36')]=_[_0xa727('0x37')](_0x5ee78f[_0xa727('0x33')],_0x5ee78f[_0xa727('0x34')]);_0x483a8e[_0xa727('0x38')]=_[_0xa727('0x37')](_0x5ee78f[_0xa727('0x33')],qs['fields'](_0x2eea6d['query']['fields']));_0x483a8e[_0xa727('0x38')]=_0x483a8e[_0xa727('0x38')][_0xa727('0x3a')]?_0x483a8e[_0xa727('0x38')]:_0x5ee78f[_0xa727('0x33')];if(!_0x2eea6d['query'][_0xa727('0x3b')]('nolimit')){_0x483a8e[_0xa727('0x23')]=qs[_0xa727('0x23')](_0x2eea6d['query']['limit']);_0x483a8e[_0xa727('0x21')]=qs[_0xa727('0x21')](_0x2eea6d['query'][_0xa727('0x21')]);}_0x483a8e[_0xa727('0x3c')]=qs[_0xa727('0x3d')](_0x2eea6d[_0xa727('0x34')][_0xa727('0x3d')]);_0x483a8e['where']=qs['filters'](_[_0xa727('0x3f')](_0x2eea6d[_0xa727('0x34')],_0x5ee78f[_0xa727('0x36')]));_0x483a8e[_0xa727('0x3e')]['ChatWebsiteId']=_0x2761d1['id'];if(_0x2eea6d[_0xa727('0x34')][_0xa727('0x40')]){_0x483a8e[_0xa727('0x3e')]=_[_0xa727('0x41')](_0x483a8e[_0xa727('0x3e')],{'$or':_[_0xa727('0x2f')](_0x483a8e[_0xa727('0x38')],function(_0x57bcdc){var _0x28fd35={};_0x28fd35[_0x57bcdc]={'$like':'%'+_0x2eea6d[_0xa727('0x34')][_0xa727('0x40')]+'%'};return _0x28fd35;})});}_0x483a8e=_[_0xa727('0x41')]({},_0x483a8e,_0x2eea6d[_0xa727('0x42')]);return db[_0xa727('0x5c')][_0xa727('0x24')]({'where':_0x483a8e[_0xa727('0x3e')]})['then'](function(_0x1c21b9){_0x2ccb64[_0xa727('0x24')]=_0x1c21b9;if(_0x2eea6d[_0xa727('0x34')][_0xa727('0x44')]){_0x483a8e[_0xa727('0x45')]=[{'all':!![]}];}return db[_0xa727('0x5c')][_0xa727('0x46')](_0x483a8e);})[_0xa727('0x13')](function(_0x361393){_0x2ccb64['rows']=_0x361393;return _0x2ccb64;});}})[_0xa727('0x13')](respondWithFilteredResult(_0x59ca56,_0x483a8e))[_0xa727('0x4b')](handleError(_0x59ca56,null));};exports['removeAnswers']=function(_0x2f4afe,_0x325b3e){return db[_0xa727('0x43')][_0xa727('0x4a')]({'where':{'id':_0x2f4afe[_0xa727('0x54')]['id']}})['then'](handleEntityNotFound(_0x325b3e,null))[_0xa727('0x13')](function(_0x2a478c){if(_0x2a478c){return _0x2a478c[_0xa727('0x5f')](_0x2f4afe[_0xa727('0x34')][_0xa727('0x60')]);}})[_0xa727('0x13')](respondWithStatusCode(_0x325b3e,null))[_0xa727('0x4b')](handleError(_0x325b3e,null));};exports['addLogo']=function(_0x51a416,_0x17fe21){_0x51a416[_0xa727('0x4d')][_0xa727('0x61')]=_0x51a416['file'][_0xa727('0x62')];return db['ChatWebsite'][_0xa727('0x4a')]({'where':{'id':_0x51a416[_0xa727('0x54')]['id']}})[_0xa727('0x13')](handleEntityNotFound(_0x17fe21,null))[_0xa727('0x13')](saveUpdates(_0x51a416[_0xa727('0x4d')],null))['then'](respondWithResult(_0x17fe21,null))[_0xa727('0x4b')](handleError(_0x17fe21,null));};exports[_0xa727('0x63')]=function(_0x101419,_0x1e7a40){_0x101419['body'][_0xa727('0x64')]=_0x101419['file'][_0xa727('0x62')];return db[_0xa727('0x43')][_0xa727('0x4a')]({'where':{'id':_0x101419[_0xa727('0x54')]['id']}})[_0xa727('0x13')](handleEntityNotFound(_0x1e7a40,null))[_0xa727('0x13')](saveUpdates(_0x101419[_0xa727('0x4d')],null))[_0xa727('0x13')](respondWithResult(_0x1e7a40,null))[_0xa727('0x4b')](handleError(_0x1e7a40,null));};exports['addCustomerAvatar']=function(_0x3f42ab,_0x3270f5){_0x3f42ab[_0xa727('0x4d')][_0xa727('0x65')]=_0x3f42ab[_0xa727('0x66')][_0xa727('0x62')];return db[_0xa727('0x43')][_0xa727('0x4a')]({'where':{'id':_0x3f42ab[_0xa727('0x54')]['id']}})[_0xa727('0x13')](handleEntityNotFound(_0x3270f5,null))[_0xa727('0x13')](saveUpdates(_0x3f42ab['body'],null))['then'](respondWithResult(_0x3270f5,null))[_0xa727('0x4b')](handleError(_0x3270f5,null));};exports[_0xa727('0x67')]=function(_0x3647c4,_0x25c138){_0x3647c4[_0xa727('0x4d')][_0xa727('0x68')]=_0x3647c4['file'][_0xa727('0x62')];return db['ChatWebsite']['find']({'where':{'id':_0x3647c4[_0xa727('0x54')]['id']}})['then'](handleEntityNotFound(_0x25c138,null))[_0xa727('0x13')](saveUpdates(_0x3647c4[_0xa727('0x4d')],null))['then'](respondWithResult(_0x25c138,null))[_0xa727('0x4b')](handleError(_0x25c138,null));};exports[_0xa727('0x69')]=function(_0x5f4c22,_0x533512){var _0x2c5fed=path[_0xa727('0x6a')](config['root'],_0xa727('0x6b'));var _0x1d6216={'where':{'id':_0x5f4c22[_0xa727('0x54')]['id']},'attributes':['id',_0xa727('0x61')],'raw':!![]};var _0xa89b3b=![];return require(_0xa727('0x6c'))[_0xa727('0x6d')]()['then'](function(_0x13787d){if(_0x13787d){_0xa89b3b=_0x13787d['custom'];}})['then'](function(){return db[_0xa727('0x43')][_0xa727('0x4a')](_0x1d6216);})[_0xa727('0x13')](handleEntityNotFound(_0x533512,null))[_0xa727('0x13')](function(_0x3ddd62){if(_0x3ddd62){if(!_[_0xa727('0x6e')](_0x3ddd62[_0xa727('0x61')])){if(fs[_0xa727('0x6f')](path[_0xa727('0x6a')](config[_0xa727('0x70')],_0xa727('0x71'),_0x3ddd62[_0xa727('0x61')]))&&_0xa89b3b){_0x2c5fed=path[_0xa727('0x6a')](config['root'],'server/files/images/logos/',_0x3ddd62['sitepic']);}}return _0x533512[_0xa727('0x72')](_0x2c5fed);}})['catch'](handleError(_0x533512,null));};exports[_0xa727('0x73')]=function(_0x388b87,_0x43d669){var _0x4b16b1=path['join'](config['root'],_0xa727('0x74'));var _0x26dc16={'where':{'id':_0x388b87[_0xa727('0x54')]['id']},'attributes':['id',_0xa727('0x64')],'raw':!![]};return db[_0xa727('0x43')][_0xa727('0x4a')](_0x26dc16)[_0xa727('0x13')](handleEntityNotFound(_0x43d669,null))[_0xa727('0x13')](function(_0x3252d4){if(_0x3252d4){if(!_[_0xa727('0x6e')](_0x3252d4[_0xa727('0x64')])){if(fs[_0xa727('0x6f')](path['join'](config[_0xa727('0x70')],_0xa727('0x75'),_0x3252d4[_0xa727('0x64')]))){_0x4b16b1=path[_0xa727('0x6a')](config['root'],_0xa727('0x75'),_0x3252d4[_0xa727('0x64')]);}}return _0x43d669[_0xa727('0x72')](_0x4b16b1);}})[_0xa727('0x4b')](handleError(_0x43d669,null));};exports[_0xa727('0x76')]=function(_0x42f019,_0x576285){var _0x5276b1=path[_0xa727('0x6a')](config[_0xa727('0x70')],_0xa727('0x77'));var _0x6b9f07={'where':{'id':_0x42f019[_0xa727('0x54')]['id']},'attributes':['id','customerAvatar',_0xa727('0x78')],'raw':!![]};return db[_0xa727('0x43')][_0xa727('0x4a')](_0x6b9f07)[_0xa727('0x13')](handleEntityNotFound(_0x576285,null))['then'](function(_0x1cea3b){if(_0x1cea3b){if(!_[_0xa727('0x6e')](_0x1cea3b[_0xa727('0x65')])){if(fs[_0xa727('0x6f')](path[_0xa727('0x6a')](config[_0xa727('0x70')],_0xa727('0x75'),_0x1cea3b[_0xa727('0x65')]))&&_0x1cea3b[_0xa727('0x78')]){_0x5276b1=path[_0xa727('0x6a')](config[_0xa727('0x70')],_0xa727('0x75'),_0x1cea3b[_0xa727('0x65')]);}}return _0x576285[_0xa727('0x72')](_0x5276b1);}})['catch'](handleError(_0x576285,null));};exports[_0xa727('0x79')]=function(_0x43e2d3,_0x4ae092){var _0x94b956=path[_0xa727('0x6a')](config[_0xa727('0x70')],_0xa727('0x7a'));var _0xf83c1a={'where':{'id':_0x43e2d3['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xa727('0x43')]['find'](_0xf83c1a)[_0xa727('0x13')](handleEntityNotFound(_0x4ae092,null))[_0xa727('0x13')](function(_0x492a2f){if(_0x492a2f){if(!_[_0xa727('0x6e')](_0x492a2f[_0xa727('0x68')])){if(fs[_0xa727('0x6f')](path[_0xa727('0x6a')](config[_0xa727('0x70')],_0xa727('0x75'),_0x492a2f[_0xa727('0x68')]))){_0x94b956=path[_0xa727('0x6a')](config[_0xa727('0x70')],_0xa727('0x75'),_0x492a2f[_0xa727('0x68')]);}}return _0x4ae092[_0xa727('0x72')](_0x94b956);}})[_0xa727('0x4b')](handleError(_0x4ae092,null));};exports[_0xa727('0x7b')]=function(_0x2a8c83,_0x2a3998){var _0x27415d=require(_0xa727('0x7c'));var _0x488c32=new _0x27415d();var _0x2f52dd=_0x488c32[_0xa727('0x7d')](_0x2a8c83[_0xa727('0x7e')]['user-agent'])[_0xa727('0x7f')]();var _0x4b6a09={'body':_0x2a8c83[_0xa727('0x4d')],'channel':_0xa727('0x80')};var _0x335d60=[];var _0x1d05f5=[];var _0xbae85c={};var _0x1abc41=![];return db[_0xa727('0x81')][_0xa727('0x55')]()[_0xa727('0x13')](function(_0x425137){if(!_0x425137){throw new db[(_0xa727('0x82'))][(_0xa727('0x83'))](_0xa727('0x84'));}_0x335d60=_[_0xa727('0x85')](_[_0xa727('0x35')](_0x425137),[_0xa727('0x86'),_0xa727('0x87')]);_0x1d05f5=_[_0xa727('0x85')](_[_0xa727('0x35')](_0x425137),[_0xa727('0x86'),'updatedAt',_0xa727('0x88'),_0xa727('0x89')]);if(_0x2a8c83[_0xa727('0x4d')]['id']){delete _0x2a8c83[_0xa727('0x4d')]['id'];}if(_[_0xa727('0x6e')](_0x2a8c83[_0xa727('0x4d')][_0xa727('0x8a')])){throw new db[(_0xa727('0x82'))]['ValidationError'](_0xa727('0x8b'));}if(_[_0xa727('0x6e')](_0x2a8c83['body'][_0xa727('0x4d')])||_0x2a8c83[_0xa727('0x4d')][_0xa727('0x4d')]===''){throw new db[(_0xa727('0x82'))][(_0xa727('0x83'))](_0xa727('0x8c'));}if(_['isNil'](_0x2a8c83[_0xa727('0x4d')][_0xa727('0x8d')])){throw new db[(_0xa727('0x82'))]['ValidationError'](_0xa727('0x8e')+_0x1d05f5);}if(!_['includes'](_0x1d05f5,_0x2a8c83[_0xa727('0x4d')][_0xa727('0x8d')])){throw new db['Sequelize'][(_0xa727('0x83'))](_0xa727('0x8f')+_0x1d05f5);}_0xbae85c[_0x2a8c83[_0xa727('0x4d')][_0xa727('0x8d')]]=_0x2a8c83[_0xa727('0x4d')]['from'];})[_0xa727('0x13')](function(){return db[_0xa727('0x43')]['find']({'where':{'id':_0x2a8c83['params']['id']},'include':[{'model':db[_0xa727('0x90')],'as':_0xa727('0x91'),'include':[{'model':db[_0xa727('0x81')],'as':_0xa727('0x92'),'where':_0xbae85c,'limit':0x1,'order':[['updatedAt',_0xa727('0x93')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0xa727('0x13')](handleEntityNotFound(_0x2a3998,null))[_0xa727('0x13')](function(_0x1d85c6){if(_0x1d85c6&&_0x1d85c6[_0xa727('0x91')]){_0x4b6a09['account']=_0x1d85c6;_0x4b6a09[_0xa727('0x94')]=_0x1d85c6['Applications'];_0x4b6a09[_0xa727('0x95')]=_0x1d85c6[_0xa727('0x91')];_0x4b6a09[_0xa727('0x94')]=_[_0xa727('0x96')](_0x4b6a09[_0xa727('0x94')],['priority'],[_0xa727('0x97')]);if(_0x4b6a09[_0xa727('0x98')]['Applications']){delete _0x4b6a09[_0xa727('0x98')][_0xa727('0x99')];}if(_0x4b6a09[_0xa727('0x98')][_0xa727('0x91')]&&_0x4b6a09['account'][_0xa727('0x91')][_0xa727('0x92')]['length']){return _0x4b6a09[_0xa727('0x98')]['List'][_0xa727('0x92')][0x0];}var _0x5bc3e4=_[_0xa727('0x9a')](_0x2a8c83['body'],{'firstName':_0x2a8c83['body'][_0xa727('0x8a')],'ListId':_0x1d85c6['ListId']});_0x5bc3e4[_0x2a8c83[_0xa727('0x4d')][_0xa727('0x8d')]]=_0x2a8c83[_0xa727('0x4d')][_0xa727('0x8a')];return db[_0xa727('0x81')][_0xa727('0x4c')](_0x5bc3e4,{'fields':_0x335d60,'raw':!![]});}})[_0xa727('0x13')](handleEntityNotFound(_0x2a3998,null))[_0xa727('0x13')](function(_0x1ea367){_0x4b6a09[_0xa727('0x9b')]=_0x1ea367;var _0x4fa3b9=_0x2a8c83[_0xa727('0x4d')]['customerIp'];if(_0x2a8c83[_0xa727('0x7e')]['cf-connecting-ip']){_0x4fa3b9=_0x2a8c83['headers']['cf-connecting-ip'];}else if(_0x2a8c83[_0xa727('0x7e')]['x-forwarded-for']){_0x4fa3b9=_[_0xa727('0x9c')](_0x2a8c83[_0xa727('0x7e')][_0xa727('0x9d')][_0xa727('0x9e')](','));}if(_0x1ea367){var _0x3b05c={'ContactId':_0x1ea367['id'],'ChatWebsiteId':_0x2a8c83['params']['id'],'from':(_0x1ea367[_0xa727('0x9f')]||'')+'\x20'+(_0x1ea367[_0xa727('0xa0')]||''),'customerIp':_0x4fa3b9,'customerPort':_0x2a8c83[_0xa727('0x7e')][_0xa727('0xa1')]?_0x2a8c83[_0xa727('0x7e')][_0xa727('0xa1')]:null,'referer':_0x2a8c83[_0xa727('0x4d')][_0xa727('0xa2')],'browserName':_0x2f52dd[_0xa727('0xa3')][_0xa727('0x2b')]&&_0x2f52dd['browser']['version']?util[_0xa727('0xa4')](_0xa727('0xa5'),_0x2f52dd[_0xa727('0xa3')][_0xa727('0x2b')],_0x2f52dd['browser'][_0xa727('0xa6')]):_0xa727('0xa7'),'browserVersion':_0x2f52dd[_0xa727('0xa3')][_0xa727('0xa6')]||_0xa727('0xa7'),'osName':util[_0xa727('0xa4')](_0xa727('0xa5'),_0x2f52dd['os']['name'],_0x2f52dd['os'][_0xa727('0xa6')]),'osVersion':_0x2f52dd['os'][_0xa727('0xa6')],'deviceModel':_0x2f52dd[_0xa727('0xa8')]['model']&&_0x2f52dd[_0xa727('0xa8')][_0xa727('0xa9')]?util['format'](_0xa727('0xaa'),_0x2f52dd[_0xa727('0xa8')][_0xa727('0x33')],_0x2f52dd[_0xa727('0xa8')]['vendor'],_0x2f52dd[_0xa727('0xa8')][_0xa727('0xab')]):null,'deviceVendor':_0x2f52dd[_0xa727('0xa8')][_0xa727('0xa9')],'deviceType':_0x2f52dd[_0xa727('0xa8')][_0xa727('0xab')],'formData':JSON[_0xa727('0x18')](_0x2a8c83[_0xa727('0x4d')])};var _0x26caa2={'ChatWebsiteId':_0x2a8c83[_0xa727('0x54')]['id'],'closed':![]};if(_0x2a8c83[_0xa727('0x4d')][_0xa727('0xac')]){_0x26caa2[_0xa727('0xac')]=_0x2a8c83[_0xa727('0x4d')][_0xa727('0xac')];return db[_0xa727('0xad')]['find']({'where':_0x26caa2})['then'](function(_0x3029ec){if(_0x3029ec){return[_0x3029ec,![]];}_0x3b05c[_0xa727('0xac')]=_0x2a8c83['body'][_0xa727('0xac')];_0x3b05c[_0xa727('0xae')]=_0x2a8c83[_0xa727('0x4d')][_0xa727('0xae')];return db[_0xa727('0xad')][_0xa727('0x4c')](_0x3b05c)[_0xa727('0x13')](function(_0x3df6cd){return[_0x3df6cd,!![]];});});}_0x26caa2[_0xa727('0xaf')]=_0x1ea367['id'];if(_0x2a8c83[_0xa727('0x4d')][_0xa727('0xb0')]&&_0x2a8c83['body'][_0xa727('0xb0')]['id']){_0x26caa2['id']=_0x2a8c83['body'][_0xa727('0xb0')]['id'];return db[_0xa727('0xad')][_0xa727('0x4a')]({'where':_0x26caa2})[_0xa727('0x13')](function(_0x4dec24){if(_0x4dec24){return[_0x4dec24,![]];}return db['ChatInteraction']['create'](_0x3b05c)['then'](function(_0x207b9f){return[_0x207b9f,!![]];});});}return db['ChatInteraction'][_0xa727('0x4c')](_0x3b05c)[_0xa727('0x13')](function(_0x299486){return[_0x299486,!![]];});}})[_0xa727('0xb1')](function(_0x8a4bba,_0x1d38c2){if(_0x8a4bba){_0x1abc41=_0x1d38c2;if(!_0x1d38c2){var _0xaa89d={'from':(_0x4b6a09[_0xa727('0x9b')]['firstName']||'')+'\x20'+(_0x4b6a09[_0xa727('0x9b')]['lastName']||'')};if(_0x2a8c83[_0xa727('0x4d')][_0xa727('0xac')]&&_0x2a8c83[_0xa727('0x4d')][_0xa727('0xb2')]&&_0x2a8c83[_0xa727('0x4d')][_0xa727('0xac')]!=_0x2a8c83[_0xa727('0x4d')][_0xa727('0xb2')]){_0xaa89d['threadId']=_0x2a8c83[_0xa727('0x4d')][_0xa727('0xb2')];}return _0x8a4bba[_0xa727('0x27')](_0xaa89d);}else{return _0x8a4bba;}}})[_0xa727('0x13')](function(_0x5cb60b){_0x4b6a09[_0xa727('0xb0')]=_0x5cb60b[_0xa727('0x4e')]({'plain':!![]});_0x4b6a09[_0xa727('0xb0')][_0xa727('0xb3')]=_0x1abc41;if(_0x4b6a09[_0xa727('0xb0')][_0xa727('0xb3')]){if(_0x4b6a09[_0xa727('0x98')][_0xa727('0xb4')]){_0x4b6a09[_0xa727('0x94')][_0xa727('0xb5')]({'id':0x0,'priority':_0x4b6a09[_0xa727('0x94')][_0xa727('0x3a')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xa727('0xb6')});}}return db[_0xa727('0xb7')]['create']({'body':_0x2a8c83[_0xa727('0x4d')]['body'],'ChatWebsiteId':_0x2a8c83[_0xa727('0x54')]['id'],'ChatInteractionId':_0x5cb60b['id'],'direction':'in','ContactId':_0x4b6a09[_0xa727('0x9b')]['id'],'AttachmentId':_0x2a8c83[_0xa727('0x4d')]['AttachmentId']});})['then'](function(_0x2ed487){_0x4b6a09['message']=_0x2ed487;if(_0x4b6a09[_0xa727('0xb0')][_0xa727('0xb8')]){return db[_0xa727('0xb9')]['find']({'attributes':['id','name'],'where':{'id':_0x4b6a09[_0xa727('0xb0')][_0xa727('0xb8')]}})['then'](function(_0x2a809f){if(_0x2a809f){_0x4b6a09[_0xa727('0x94')]['unshift']({'id':0x0,'priority':0x0,'app':_0xa727('0xba'),'appdata':_0x2a809f['name']+','+(_0x4b6a09[_0xa727('0x98')][_0xa727('0xbb')]||0xa),'interval':'*,*,*,*'});_0x4b6a09[_0xa727('0xbc')]=!![];}return respondWithRpcPromise('Start',_0xa727('0xbd'),_0x4b6a09);});}return respondWithRpcPromise(_0xa727('0xbe'),_0xa727('0xbd'),_0x4b6a09);})[_0xa727('0x13')](function(_0x5bd366){respondWithRpcPromise('EventManager',_0xa727('0xbf'),{'event':'notify','message':_0x5bd366},client9002);return _0x5bd366;})[_0xa727('0x13')](respondWithResult(_0x2a3998,null))[_0xa727('0x4b')](handleError(_0x2a3998,null));};exports[_0xa727('0xc0')]=function(_0x1af11d,_0x3897fa){var _0x465110,_0x5de129,_0x2ceb6e;var _0x2b61e0=[];var _0x2af038={};var _0x110dbd=_0x1af11d[_0xa727('0xc1')]||[];var _0x197f47=[];var _0x5133ff;return db['CmContact'][_0xa727('0x55')]()['then'](function(_0x90b681){if(!_0x90b681){throw new db['Sequelize'][(_0xa727('0x83'))](_0xa727('0x84'));}_0x2b61e0=_[_0xa727('0x85')](_['keys'](_0x90b681),[_0xa727('0x86'),'updatedAt',_0xa727('0x88'),_0xa727('0x89')]);if(_0x1af11d['body']['id']){delete _0x1af11d['body']['id'];}if(_[_0xa727('0x6e')](_0x1af11d[_0xa727('0x4d')][_0xa727('0x8a')])){throw _0x3897fa[_0xa727('0x1e')](0x1f4)['send'](new db[(_0xa727('0x82'))]['ValidationError'](_0xa727('0x8b')));}if(_[_0xa727('0x6e')](_0x1af11d[_0xa727('0x4d')]['body'])||_0x1af11d[_0xa727('0x4d')][_0xa727('0x4d')]===''){throw _0x3897fa['status'](0x1f4)[_0xa727('0x2c')](new db[(_0xa727('0x82'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xa727('0x6e')](_0x1af11d['body'][_0xa727('0xc2')])){throw _0x3897fa[_0xa727('0x1e')](0x1f4)[_0xa727('0x2c')](new db['Sequelize'][(_0xa727('0x83'))](_0xa727('0xc3')+_0x2b61e0));}if(!_[_0xa727('0xc4')](_0x2b61e0,_0x1af11d[_0xa727('0x4d')][_0xa727('0xc2')])){throw _0x3897fa[_0xa727('0x1e')](0x1f4)['send'](new db[(_0xa727('0x82'))][(_0xa727('0x83'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2b61e0));}_0x2af038[_0x1af11d[_0xa727('0x4d')][_0xa727('0xc2')]]=_0x1af11d[_0xa727('0x4d')]['from'];})[_0xa727('0x13')](function(){return db[_0xa727('0x43')][_0xa727('0x4a')]({'where':{'id':_0x1af11d[_0xa727('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0xa727('0x91')},{'model':db[_0xa727('0xc5')],'as':_0xa727('0xc5')}]});})[_0xa727('0x13')](handleEntityNotFound(_0x3897fa,null))[_0xa727('0x13')](function(_0x4c5ecf){if(_0x4c5ecf&&_0x4c5ecf[_0xa727('0x91')]){_0x5de129=_0x4c5ecf;var _0x22aa59=_['defaults'](_0x1af11d[_0xa727('0x4d')],{'firstName':_0x1af11d['body']['from'],'phone':_0x1af11d[_0xa727('0x4d')][_0xa727('0x8a')],'ListId':_0x4c5ecf['ListId']});_0x22aa59[_0x1af11d[_0xa727('0x4d')][_0xa727('0xc2')]]=_0x1af11d['body'][_0xa727('0x8a')];return db['CmContact'][_0xa727('0xc6')]({'where':_0x2af038,'defaults':_0x22aa59});}})[_0xa727('0xb1')](function(_0x2e425b){if(_0x2e425b){_0x2ceb6e=_0x2e425b;var _0x1cedf1=fs[_0xa727('0xc7')](path[_0xa727('0x6a')](config[_0xa727('0x70')],'server/files/templates/chatOfflineMessage.ejs'),_0xa727('0xc8'));var _0x220883=ejs[_0xa727('0xc9')](_0x1cedf1,{'body':_[_0xa727('0xca')](_0x1af11d[_0xa727('0x4d')][_0xa727('0x4d')]),'bodyTitle':_0x5de129[_0xa727('0xcb')]});return db[_0xa727('0xcc')][_0xa727('0x4c')]({'body':_0x220883,'ContactId':_0x2e425b['id'],'ChatWebsiteId':_0x5de129['id']});}})['then'](function(_0x426426){_0x5133ff=_0x426426;if(_0x110dbd[_0xa727('0x3a')]){var _0x1e2d53=_0x110dbd[_0xa727('0x2f')](function(_0x47c01c){return{'name':_0x47c01c['originalname'],'basename':_0x47c01c[_0xa727('0x62')],'type':_0x47c01c[_0xa727('0xcd')],'ChatOfflineMessageId':_0x426426['id']};});_0x197f47=_0x1e2d53[_0xa727('0x2f')](_0x38f85e=>{var _0x4b5d1b={'filename':_0x38f85e[_0xa727('0x2b')],'path':path[_0xa727('0x6a')](config[_0xa727('0x70')],_0xa727('0xce'),_0xa727('0xc1'),'attachments',_0xa727('0xcf'),_0x38f85e[_0xa727('0xd0')])};return _0x4b5d1b;});if(!_0x5de129[_0xa727('0xd1')]){return db[_0xa727('0xd2')][_0xa727('0xd3')](function(_0x4ef144){return db[_0xa727('0xd4')][_0xa727('0xd5')](_0x1e2d53,{'transaction':_0x4ef144});});}}})[_0xa727('0x13')](function(){if(_0x5133ff){_0x465110=_0x5133ff;return db[_0xa727('0xc5')][_0xa727('0x5e')]({'where':{'active':!![]},'include':[{'model':db[_0xa727('0xd6')],'as':_0xa727('0xd7'),'raw':!![]}]});}})[_0xa727('0x13')](function(_0x3f0c07){if(_0x3f0c07&&_0x3f0c07['Smtp']&&_0x5de129['forwardOffline']&&_0x5de129[_0xa727('0xd8')]){var _0x27b3e0={'tls':{'rejectUnauthorized':![]}};if(_0x3f0c07[_0xa727('0xd7')][_0xa727('0xd9')]){_0x27b3e0[_0xa727('0xd9')]=_0x3f0c07['Smtp'][_0xa727('0xd9')];}else{_0x27b3e0['host']=_0x3f0c07['Smtp'][_0xa727('0xda')];_0x27b3e0[_0xa727('0xdb')]=_0x3f0c07['Smtp'][_0xa727('0xdb')];_0x27b3e0[_0xa727('0xdc')]=_0x3f0c07[_0xa727('0xd7')]['secure'];}if(_0x3f0c07[_0xa727('0xd7')][_0xa727('0xdd')]){_0x27b3e0[_0xa727('0xde')]={'user':_0x3f0c07[_0xa727('0xd7')][_0xa727('0xdf')],'pass':_0x3f0c07[_0xa727('0xd7')]['pass']};}return respondWithRpcPromise(_0xa727('0xe0'),'sendMail',{'account':_0x27b3e0,'message':{'from':util[_0xa727('0xa4')](_0xa727('0xe1'),_0x3f0c07['name'],_0x3f0c07['email']||_0x3f0c07[_0xa727('0xd7')]['user']),'to':_0x5de129[_0xa727('0xd8')],'subject':_0x5de129['offlineMessageSubject'],'html':_0x465110['body'],'attachments':_0x197f47}},client9003)[_0xa727('0x13')](function(){return _0x465110;})[_0xa727('0x4b')](function(_0x3e0255){console[_0xa727('0x19')](_0x3e0255);});}})[_0xa727('0x13')](function(){if(_0x5de129&&_0x5de129[_0xa727('0xd1')]&&_0x5de129[_0xa727('0xe2')]){var _0x3651f3=[];if(_0x110dbd[_0xa727('0x3a')]){_0x3651f3=_0x110dbd[_0xa727('0x2f')](function(_0x88b070){return{'name':_0x88b070[_0xa727('0xe3')],'basename':_0x88b070['filename'],'type':_0x88b070[_0xa727('0xcd')],'ChatOfflineMessageId':_0x5133ff['id']};});}var _0x3ea9;if(!_[_0xa727('0x6e')](_0x5de129[_0xa727('0xe4')])){var _0x2534c5=_[_0xa727('0x2f')](_0x1af11d[_0xa727('0x4d')],function(_0xa36286){return _0xa36286;});var _0x53b85e=_['toPairsIn'](_0x2534c5)[0x0];var _0x556dd1=_[_0xa727('0xe5')](_0x53b85e,function(_0x547954){return _0x547954;});_0x3ea9=_0x556dd1[0x1][_0x5de129[_0xa727('0xe4')]];}var _0x36eb58={'from':_0x2ceb6e[_0xa727('0xe6')],'firstName':_0x2ceb6e['firstName'],'lastName':_0x2ceb6e[_0xa727('0xa0')],'mapKey':'email','message':{'from':_0x2ceb6e['email'],'to':_0x5de129['MailAccount'][_0xa727('0xe6')],'cc':'','subject':_['isNil'](_0x3ea9)?_0x5de129[_0xa727('0xe7')]:_0x3ea9,'messageId':'','sentAt':new Date(),'attach':_0x3651f3[_0xa727('0x3a')],'attachments':_0x3651f3,'originChannel':_0xa727('0xe8'),'ChatWebsiteId':_0x5de129['id'],'ChatOfflineMessageId':_0x465110['id'],'originTo':_0x5de129[_0xa727('0xc5')][_0xa727('0xe6')]},'body':_0x465110[_0xa727('0x4d')]};var _0x3de061={'account':{'id':_0x5de129['MailAccountId']},'body':_0x36eb58,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xa727('0xe9'),_0xa727('0xea'),_0x3de061,client9001)[_0xa727('0x13')](function(){return _0x465110;})[_0xa727('0x4b')](function(_0x5e62a2){console['error'](_0x5e62a2);});}return;})[_0xa727('0x13')](function(){if(_0x465110){return _0x465110;}})[_0xa727('0x13')](respondWithResult(_0x3897fa,null))[_0xa727('0x4b')](function(_0xb7246c){console[_0xa727('0x19')](_0xa727('0x4b'),_0xb7246c);for(var _0x401554 of _0x110dbd){var _0x54b37b=path[_0xa727('0x6a')](config['root'],_0xa727('0xce'),_0xa727('0xc1'),_0xa727('0xeb'),_0xa727('0xcf'),_0x401554['filename']);fs_extra[_0xa727('0xec')](_0x54b37b)[_0xa727('0x4b')](function(_0x3a0338){console[_0xa727('0x19')](_0xa727('0xed'),_0x54b37b,_0x3a0338);});}});};exports[_0xa727('0xee')]=function(_0x29c857,_0x4b91fc){return db[_0xa727('0xad')]['find']({'where':{'id':_0x29c857[_0xa727('0x54')]['id']}})[_0xa727('0x13')](handleEntityNotFound(_0x4b91fc,null))[_0xa727('0x13')](function(_0x210fb1){if(_0x210fb1){return _0x210fb1['addInteraction'](_0x29c857[_0xa727('0x4d')][_0xa727('0x60')],_['omit'](_0x29c857[_0xa727('0x4d')],[_0xa727('0x60'),'id'])||{});}})[_0xa727('0x13')](respondWithResult(_0x4b91fc,null))['catch'](handleError(_0x4b91fc,null));};exports['getInteractions']=function(_0x1dd461,_0x43b42e){var _0x5674d7={'raw':![],'where':{}};var _0x1d1fb3={};var _0x45d1b1={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xa727('0x5e')]({'where':{'id':_0x1dd461['params']['id']}})[_0xa727('0x13')](handleEntityNotFound(_0x43b42e,null))['then'](function(_0x476f58){if(_0x476f58){_0x1d1fb3[_0xa727('0x33')]=_[_0xa727('0x35')](db['ChatInteraction'][_0xa727('0x30')]);_0x1d1fb3[_0xa727('0x34')]=_[_0xa727('0x35')](_0x1dd461['query']);_0x1d1fb3[_0xa727('0x36')]=_[_0xa727('0x37')](_0x1d1fb3[_0xa727('0x33')],_0x1d1fb3[_0xa727('0x34')]);_0x5674d7[_0xa727('0x38')]=_[_0xa727('0x37')](_0x1d1fb3[_0xa727('0x33')],qs['fields'](_0x1dd461['query'][_0xa727('0x39')]));_0x5674d7['attributes']=_0x5674d7[_0xa727('0x38')][_0xa727('0x3a')]?_0x5674d7[_0xa727('0x38')]:_0x1d1fb3[_0xa727('0x33')];if(!_0x1dd461[_0xa727('0x34')]['hasOwnProperty'](_0xa727('0x57'))){_0x5674d7[_0xa727('0x23')]=qs[_0xa727('0x23')](_0x1dd461[_0xa727('0x34')][_0xa727('0x23')]);_0x5674d7[_0xa727('0x21')]=qs[_0xa727('0x21')](_0x1dd461[_0xa727('0x34')][_0xa727('0x21')]);}_0x5674d7['order']=qs[_0xa727('0x3d')](_0x1dd461[_0xa727('0x34')][_0xa727('0x3d')]);_0x5674d7[_0xa727('0x3e')]=qs[_0xa727('0x36')](_[_0xa727('0x3f')](_0x1dd461[_0xa727('0x34')],_0x1d1fb3[_0xa727('0x36')]));_0x5674d7[_0xa727('0x3e')]['ChatWebsiteId']=_0x476f58['id'];if(_0x1dd461['query'][_0xa727('0x40')]){_0x5674d7['where']=_['merge'](_0x5674d7['where'],{'$or':_['map'](_0x5674d7[_0xa727('0x38')],function(_0x57d8fd){var _0x77c5de={};_0x77c5de[_0x57d8fd]={'$like':'%'+_0x1dd461[_0xa727('0x34')][_0xa727('0x40')]+'%'};return _0x77c5de;})});}_0x5674d7=_[_0xa727('0x41')]({},_0x5674d7,_0x1dd461[_0xa727('0x42')]);return db[_0xa727('0xad')][_0xa727('0x24')]({'where':_0x5674d7[_0xa727('0x3e')]})[_0xa727('0x13')](function(_0x2e807c){_0x45d1b1[_0xa727('0x24')]=_0x2e807c;if(_0x1dd461[_0xa727('0x34')][_0xa727('0x44')]){_0x5674d7['include']=[{'model':db['CmContact'],'as':_0xa727('0xef'),'required':![]},{'model':db['User'],'as':_0xa727('0xf0'),'attributes':[_0xa727('0x2b'),_0xa727('0xf1'),_0xa727('0xf2')],'required':![]},{'model':db[_0xa727('0xf3')],'as':_0xa727('0xf4'),'attributes':['id',_0xa727('0x2b'),_0xa727('0xf5')],'where':_0x1dd461[_0xa727('0x34')][_0xa727('0xf6')]?{'id':_0x1dd461['query'][_0xa727('0xf6')]}:undefined,'required':_0x1dd461['query'][_0xa727('0xf6')]?!![]:![]}];}return db['ChatInteraction'][_0xa727('0x46')](_0x5674d7);})[_0xa727('0x13')](function(_0x1ec567){_0x45d1b1[_0xa727('0x47')]=_0x1ec567;return _0x45d1b1;});}})[_0xa727('0x13')](respondWithFilteredResult(_0x43b42e,_0x5674d7))['catch'](handleError(_0x43b42e,null));};function iftimePromise(_0x4916ef,_0x38d43b){return respondWithRpcPromise(_0xa727('0xf7'),_0xa727('0xf8'),{'command':_0x38d43b[_0xa727('0xf9')]?util[_0xa727('0xa4')](_0xa727('0xfa'),_0x4916ef[_0xa727('0xfb')],_0x38d43b[_0xa727('0xf9')]):util['format'](_0xa727('0xfc'),_0x4916ef['interval'])},client9002)[_0xa727('0x13')](function(_0x2eadf6){var _0x3a7a9f=_0x2eadf6&&_0x2eadf6[_0xa727('0xfd')](_0xa727('0xfe'))>=0x0?!![]:![];logger[_0xa727('0x14')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x38d43b['id'],_0x4916ef['id'],_0x4916ef['interval'],_0x3a7a9f?_0xa727('0xff'):_0xa727('0x100'),_0x38d43b[_0xa727('0xf9')]?_0x38d43b[_0xa727('0xf9')]:'No\x20timezone');return _0x3a7a9f;})[_0xa727('0x4b')](function(_0xd9df04){logger['error']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x38d43b['id'],_0x4916ef['id'],_0x4916ef[_0xa727('0xfb')],util[_0xa727('0x101')](_0xd9df04,{'showHidden':![],'depth':null}),_0x38d43b['timezone']?_0x38d43b[_0xa727('0xf9')]:'No\x20timezone');return![];});}exports[_0xa727('0xf8')]=function(_0x467483,_0x24da67){var _0x249b43=0x0;var _0x309acc=0x0;var _0x37c9d7=![];var _0x1949a9;var _0x1e6192;return db[_0xa727('0x43')][_0xa727('0x4a')]({'where':{'id':_0x467483['params']['id']},'include':[{'model':db[_0xa727('0x102')],'as':'Interval','include':[{'model':db['Interval'],'as':_0xa727('0x103'),'attributes':['id',_0xa727('0xfb')],'raw':!![]}]}]})[_0xa727('0x13')](handleEntityNotFound(_0x24da67,null))[_0xa727('0x13')](function(_0x4a941d){if(_0x4a941d){_0x1949a9=_0x4a941d;return _0x4a941d[_0xa727('0x104')]({'raw':!![]});}})[_0xa727('0x13')](function(_0x519a9e){if(_0x1949a9){if(_0x519a9e){_0x1e6192=_0x519a9e;}}return require(_0xa727('0x6c'))[_0xa727('0x6d')]();})[_0xa727('0x13')](function(_0x2c50c2){if(_0x2c50c2){_0x309acc=_0x2c50c2[_0xa727('0x105')];_0x37c9d7=_0x2c50c2[_0xa727('0x106')];}})[_0xa727('0x13')](function(){return db['ChatInteraction'][_0xa727('0x24')]({'where':{'closed':![]}});})['then'](function(_0xfbf7ee){_0x249b43=_0xfbf7ee;if(_0x309acc&&_0xfbf7ee>_0x309acc){return db[_0xa727('0x107')][_0xa727('0x5e')]({'where':{'id':0x1}})[_0xa727('0x13')](function(_0x4b6eaa){if(_0x4b6eaa){_0x4b6eaa[_0xa727('0x108')]('chatLicenseExceeded');}});}})[_0xa727('0x13')](function(){if(_0x1949a9[_0xa727('0x102')]&&_0x1949a9[_0xa727('0x102')][_0xa727('0x103')]){var _0x28dc33=[];for(var _0x135936=0x0;_0x135936<_0x1949a9['Interval'][_0xa727('0x103')][_0xa727('0x3a')];_0x135936++){var _0x4da9ed=_0x1949a9[_0xa727('0x102')][_0xa727('0x103')][_0x135936]['get']({'plain':!![]});_0x28dc33[_0xa727('0xb5')](iftimePromise(_0x4da9ed,_0x1949a9));}return BPromise['all'](_0x28dc33)[_0xa727('0x13')](function(_0x3778cb){return _[_0xa727('0x109')](_0x3778cb);});}else{return!![];}})[_0xa727('0x13')](function(_0x30b69b){var _0x20e66e=fs['readFileSync'](path['join'](config[_0xa727('0x70')],_0xa727('0x10a')),'utf8');var _0x52ff73={'remote':_0x1949a9[_0xa727('0x10b')],'query':querystring['stringify'](_['merge'](_0x1949a9['get']({'plain':!![]}),{'customerIp':_0x467483[_0xa727('0x7e')][_0xa727('0x9d')]||_0x467483['headers']['x-real-ip']||_0x467483[_0xa727('0x10c')][_0xa727('0x10d')]||_0x467483['ip'],'referer':_0x467483[_0xa727('0x7e')][_0xa727('0xa2')],'openedInteractions':_0x249b43,'maxInteractions':_0x309acc,'virtual':_0x37c9d7[_0xa727('0x105')],'online':_0x30b69b,'custom':_0x37c9d7}))[_0xa727('0x10e')](/'/g,'\x5c\x27')};_0x24da67['send'](ejs[_0xa727('0xc9')](Mustache[_0xa727('0xc9')](_0x20e66e,_0x52ff73),{'proactiveActions':_0x1e6192,'alignment':_0x1949a9[_0xa727('0x10f')],'verticalAlignment':_0x1949a9[_0xa727('0x110')],'div_color':_0x1949a9['color'],'labelText':_0x1949a9['labelText'],'text_color':_0x1949a9[_0xa727('0x111')],'button_color':_0x1949a9[_0xa727('0x112')],'background_color':_0x1949a9[_0xa727('0x113')]}));})[_0xa727('0x4b')](handleError(_0x24da67,null));};exports[_0xa727('0x114')]=function(_0x2ade83,_0x2770e4){var _0x86eedf=_0x2ade83['params']['id'];var _0x4e59e7=_0x2ade83[_0xa727('0x4d')];var _0x5a2a4d=0xc8;var _0x2ca79d=null;return db['sequelize'][_0xa727('0xd3')]({'isolationLevel':db['sequelize']['Transaction'][_0xa727('0x115')][_0xa727('0x116')]},function(_0x5a5200){return db[_0xa727('0x43')][_0xa727('0x5e')]({'where':{'id':_0x86eedf},'transaction':_0x5a5200})[_0xa727('0x13')](function(_0x49ab3e){if(_0x49ab3e){return db[_0xa727('0x117')][_0xa727('0x28')]({'where':{'ChatWebsiteId':_0x86eedf},'transaction':_0x5a5200})[_0xa727('0x13')](function(){var _0x4cdee1=_[_0xa727('0x2f')](_0x4e59e7,function(_0x3573b4){_0x3573b4[_0xa727('0x5b')]=_0x86eedf;return _0x3573b4;});return db['ChatApplication'][_0xa727('0xd5')](_0x4cdee1,{'transaction':_0x5a5200});});}else{_0x5a2a4d=0x194;_0x2ca79d=[];}});})[_0xa727('0x13')](function(){if(_0x5a2a4d!==0x194){return db[_0xa727('0x117')][_0xa727('0x118')]({'where':{'ChatWebsiteId':_0x86eedf},'order':'priority'})[_0xa727('0x13')](function(_0x544beb){_0x2ca79d=_0x544beb;});}})[_0xa727('0x4b')](function(_0x7d5ad4){_0x5a2a4d=0x1f4;logger[_0xa727('0x19')](_0x7d5ad4[_0xa727('0x119')]);if(_0x7d5ad4[_0xa727('0x2b')]){delete _0x7d5ad4[_0xa727('0x2b')];}_0x2ca79d=_0x7d5ad4;})[_0xa727('0x11a')](function(){if(_0x2ca79d===null){_0x2770e4[_0xa727('0x1d')](_0x5a2a4d);}else{if(_0x5a2a4d===0x1f4){_0x2770e4[_0xa727('0x1e')](_0x5a2a4d)[_0xa727('0x2c')](_0x2ca79d);}else{_0x2770e4[_0xa727('0x1e')](_0x5a2a4d)[_0xa727('0x20')](_0x2ca79d);}}});};exports[_0xa727('0x11b')]=function(_0x51c187,_0x1eaab7){var _0x36b47d={};var _0x554c0b={};var _0x5a7ad7;var _0x4acfb1;return db[_0xa727('0x43')]['findOne']({'where':{'id':_0x51c187[_0xa727('0x54')]['id']}})[_0xa727('0x13')](handleEntityNotFound(_0x1eaab7,null))[_0xa727('0x13')](function(_0x53b608){if(_0x53b608){_0x5a7ad7=_0x53b608;_0x554c0b[_0xa727('0x33')]=_[_0xa727('0x35')](db[_0xa727('0x117')][_0xa727('0x30')]);_0x554c0b[_0xa727('0x34')]=_[_0xa727('0x35')](_0x51c187[_0xa727('0x34')]);_0x554c0b[_0xa727('0x36')]=_[_0xa727('0x37')](_0x554c0b[_0xa727('0x33')],_0x554c0b[_0xa727('0x34')]);_0x36b47d[_0xa727('0x38')]=_[_0xa727('0x37')](_0x554c0b['model'],qs['fields'](_0x51c187[_0xa727('0x34')][_0xa727('0x39')]));_0x36b47d[_0xa727('0x38')]=_0x36b47d[_0xa727('0x38')]['length']?_0x36b47d[_0xa727('0x38')]:_0x554c0b[_0xa727('0x33')];_0x36b47d[_0xa727('0x3c')]=qs[_0xa727('0x3d')](_0x51c187['query'][_0xa727('0x3d')]);_0x36b47d['where']=qs[_0xa727('0x36')](_[_0xa727('0x3f')](_0x51c187[_0xa727('0x34')],_0x554c0b[_0xa727('0x36')]));if(_0x51c187[_0xa727('0x34')][_0xa727('0x40')]){_0x36b47d[_0xa727('0x3e')]=_[_0xa727('0x41')](_0x36b47d[_0xa727('0x3e')],{'$or':_['map'](_0x36b47d[_0xa727('0x38')],function(_0x558925){var _0xd58c63={};_0xd58c63[_0x558925]={'$like':'%'+_0x51c187[_0xa727('0x34')]['filter']+'%'};return _0xd58c63;})});}_0x36b47d=_[_0xa727('0x41')]({},_0x36b47d,_0x51c187[_0xa727('0x42')]);return _0x5a7ad7['getApplications'](_0x36b47d);}})[_0xa727('0x13')](function(_0x58104f){if(_0x58104f){_0x4acfb1=_0x58104f[_0xa727('0x3a')];if(!_0x51c187[_0xa727('0x34')][_0xa727('0x3b')](_0xa727('0x57'))){_0x36b47d[_0xa727('0x23')]=qs['limit'](_0x51c187[_0xa727('0x34')][_0xa727('0x23')]);_0x36b47d[_0xa727('0x21')]=qs[_0xa727('0x21')](_0x51c187[_0xa727('0x34')][_0xa727('0x21')]);}return _0x5a7ad7[_0xa727('0x11b')](_0x36b47d);}})['then'](function(_0x10c963){if(_0x10c963){return _0x10c963?{'count':_0x4acfb1,'rows':_0x10c963}:null;}})['then'](respondWithResult(_0x1eaab7,null))['catch'](handleError(_0x1eaab7,null));};exports[_0xa727('0x11c')]=function(_0x215a4a,_0x2e1451){return db['chatProactiveAction'][_0xa727('0x4a')]({'where':{'id':_0x215a4a['params']['id']}})[_0xa727('0x13')](handleEntityNotFound(_0x2e1451,null))['then'](function(_0x393ad2){if(_0x393ad2){return _0x393ad2[_0xa727('0x11c')](_0x215a4a[_0xa727('0x4d')][_0xa727('0x60')],_[_0xa727('0x11d')](_0x215a4a[_0xa727('0x4d')],[_0xa727('0x60'),'id'])||{});}})[_0xa727('0x13')](respondWithResult(_0x2e1451,null))[_0xa727('0x4b')](handleError(_0x2e1451,null));};exports['getProactiveActions']=function(_0x1f97bc,_0x3d22c9){var _0x2256b4={};var _0x75db0={};var _0x4d561e;var _0x186ba4;return db[_0xa727('0x43')][_0xa727('0x5e')]({'where':{'id':_0x1f97bc['params']['id']}})[_0xa727('0x13')](handleEntityNotFound(_0x3d22c9,null))[_0xa727('0x13')](function(_0x36d353){if(_0x36d353){_0x4d561e=_0x36d353;_0x75db0[_0xa727('0x33')]=_[_0xa727('0x35')](db[_0xa727('0x11e')][_0xa727('0x30')]);_0x75db0[_0xa727('0x34')]=_[_0xa727('0x35')](_0x1f97bc[_0xa727('0x34')]);_0x75db0['filters']=_[_0xa727('0x37')](_0x75db0[_0xa727('0x33')],_0x75db0['query']);_0x2256b4[_0xa727('0x38')]=_[_0xa727('0x37')](_0x75db0[_0xa727('0x33')],qs[_0xa727('0x39')](_0x1f97bc[_0xa727('0x34')][_0xa727('0x39')]));_0x2256b4[_0xa727('0x38')]=_0x2256b4['attributes'][_0xa727('0x3a')]?_0x2256b4[_0xa727('0x38')]:_0x75db0[_0xa727('0x33')];_0x2256b4['order']=qs[_0xa727('0x3d')](_0x1f97bc['query'][_0xa727('0x3d')]);_0x2256b4[_0xa727('0x3e')]=qs[_0xa727('0x36')](_['pick'](_0x1f97bc[_0xa727('0x34')],_0x75db0[_0xa727('0x36')]));if(_0x1f97bc[_0xa727('0x34')][_0xa727('0x40')]){_0x2256b4['where']=_['merge'](_0x2256b4['where'],{'$or':_[_0xa727('0x2f')](_0x2256b4[_0xa727('0x38')],function(_0x5ab7ca){var _0x4dceb8={};_0x4dceb8[_0x5ab7ca]={'$like':'%'+_0x1f97bc[_0xa727('0x34')][_0xa727('0x40')]+'%'};return _0x4dceb8;})});}_0x2256b4=_[_0xa727('0x41')]({},_0x2256b4,_0x1f97bc[_0xa727('0x42')]);return _0x4d561e[_0xa727('0x104')](_0x2256b4);}})[_0xa727('0x13')](function(_0x31889e){if(_0x31889e){_0x186ba4=_0x31889e[_0xa727('0x3a')];if(!_0x1f97bc[_0xa727('0x34')]['hasOwnProperty'](_0xa727('0x57'))){_0x2256b4['limit']=qs[_0xa727('0x23')](_0x1f97bc[_0xa727('0x34')][_0xa727('0x23')]);_0x2256b4[_0xa727('0x21')]=qs['offset'](_0x1f97bc[_0xa727('0x34')][_0xa727('0x21')]);}return _0x4d561e[_0xa727('0x104')](_0x2256b4);}})['then'](function(_0x189183){if(_0x189183){return _0x189183?{'count':_0x186ba4,'rows':_0x189183}:null;}})['then'](respondWithResult(_0x3d22c9,null))[_0xa727('0x4b')](handleError(_0x3d22c9,null));};exports[_0xa727('0x11f')]=function(_0x5944c3,_0x31731d){var _0x2391fc=_0x5944c3[_0xa727('0x34')][_0xa727('0x120')]==='false'?'offlineForm':_0xa727('0x121');return db[_0xa727('0x43')][_0xa727('0x4a')]({'attributes':['id',_0x2391fc],'where':{'id':_0x5944c3[_0xa727('0x54')]['id']}})[_0xa727('0x13')](handleEntityNotFound(_0x31731d,null))[_0xa727('0x13')](function(_0x4c1a89){if(_0x4c1a89){var _0x51510a=_0x4c1a89[_0x2391fc];var _0x5c2f22=_0x51510a&&_0x51510a[_0xa727('0x122')]?_0x51510a[_0xa727('0x122')]:[];_0x31731d[_0xa727('0x2c')]({'fromKey':_[_0xa727('0x6e')](_0x51510a[_0xa727('0x123')])?undefined:_0x51510a[_0xa727('0x123')],'count':_0x5c2f22[_0xa727('0x3a')],'rows':_0x5c2f22});}})[_0xa727('0x4b')](handleError(_0x31731d,null));};exports['getOfflineMessages']=function(_0x48e687,_0x5df13b){var _0x621fb6={'raw':![],'where':{}};var _0x370528={};var _0x164855={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xa727('0x5e')]({'where':{'id':_0x48e687[_0xa727('0x54')]['id']}})['then'](handleEntityNotFound(_0x5df13b,null))['then'](function(_0x59d3f3){if(_0x59d3f3){_0x370528['model']=_[_0xa727('0x35')](db['ChatOfflineMessage'][_0xa727('0x30')]);_0x370528[_0xa727('0x34')]=_[_0xa727('0x35')](_0x48e687[_0xa727('0x34')]);_0x370528[_0xa727('0x36')]=_[_0xa727('0x37')](_0x370528['model'],_0x370528[_0xa727('0x34')]);_0x621fb6['attributes']=_[_0xa727('0x37')](_0x370528[_0xa727('0x33')],qs['fields'](_0x48e687[_0xa727('0x34')][_0xa727('0x39')]));_0x621fb6[_0xa727('0x38')]=_0x621fb6[_0xa727('0x38')]['length']?_0x621fb6[_0xa727('0x38')]:_0x370528[_0xa727('0x33')];if(!_0x48e687[_0xa727('0x34')][_0xa727('0x3b')](_0xa727('0x57'))){_0x621fb6[_0xa727('0x23')]=qs[_0xa727('0x23')](_0x48e687[_0xa727('0x34')][_0xa727('0x23')]);_0x621fb6[_0xa727('0x21')]=qs[_0xa727('0x21')](_0x48e687[_0xa727('0x34')][_0xa727('0x21')]);}_0x621fb6['order']=qs['sort'](_0x48e687['query'][_0xa727('0x3d')]);_0x621fb6[_0xa727('0x3e')]=qs[_0xa727('0x36')](_[_0xa727('0x3f')](_0x48e687[_0xa727('0x34')],_0x370528[_0xa727('0x36')]));_0x621fb6[_0xa727('0x3e')]['ChatWebsiteId']=_0x59d3f3['id'];if(_0x48e687[_0xa727('0x34')][_0xa727('0x40')]){_0x621fb6[_0xa727('0x3e')]=_[_0xa727('0x41')](_0x621fb6[_0xa727('0x3e')],{'$or':_[_0xa727('0x2f')](_0x621fb6['attributes'],function(_0x5bb817){var _0xfc2933={};_0xfc2933[_0x5bb817]={'$like':'%'+_0x48e687['query'][_0xa727('0x40')]+'%'};return _0xfc2933;})});}_0x621fb6=_['merge']({},_0x621fb6,_0x48e687[_0xa727('0x42')]);return db['ChatOfflineMessage']['count']({'where':_0x621fb6[_0xa727('0x3e')]})['then'](function(_0x272a1b){_0x164855[_0xa727('0x24')]=_0x272a1b;if(_0x48e687['query'][_0xa727('0x44')]){_0x621fb6['include']=[{'all':!![]}];}else{_0x621fb6[_0xa727('0x45')]=[{'model':db[_0xa727('0x81')],'as':'Contact','required':![]},{'model':db['Attachment'],'as':_0xa727('0x124'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x621fb6);})['then'](function(_0x10f8a7){_0x164855[_0xa727('0x47')]=_0x10f8a7;return _0x164855;});}})[_0xa727('0x13')](respondWithFilteredResult(_0x5df13b,_0x621fb6))[_0xa727('0x4b')](handleError(_0x5df13b,null));};exports[_0xa727('0x125')]=function(_0xb30194,_0x440053){return db[_0xa727('0x43')][_0xa727('0x4a')]({'where':{'id':_0xb30194[_0xa727('0x54')]['id']}})[_0xa727('0x13')](handleEntityNotFound(_0x440053,null))[_0xa727('0x13')](function(_0xb09e0){if(_0xb09e0){return _0xb09e0[_0xa727('0x125')](_0xb30194['body'][_0xa727('0x60')],_[_0xa727('0x11d')](_0xb30194['body'],[_0xa727('0x60'),'id'])||{})[_0xa727('0xb1')](function(_0x594e05){for(var _0x3dab15=0x0;_0x3dab15<_0xb30194[_0xa727('0x4d')][_0xa727('0x60')]['length'];_0x3dab15+=0x1){socket[_0xa727('0x126')](_0xa727('0x127'),{'UserId':Number(_0xb30194[_0xa727('0x4d')][_0xa727('0x60')][_0x3dab15]),'ChatWebsiteId':Number(_0xb30194[_0xa727('0x54')]['id'])});}return _0x594e05;});}})['then'](respondWithResult(_0x440053,null))['catch'](handleError(_0x440053,null));};exports[_0xa727('0x128')]=function(_0x42e7a9,_0x4b7a62){return db[_0xa727('0x43')][_0xa727('0x4a')]({'where':{'id':_0x42e7a9[_0xa727('0x54')]['id']}})[_0xa727('0x13')](handleEntityNotFound(_0x4b7a62,null))[_0xa727('0x13')](function(_0x5da49b){if(_0x5da49b){return _0x5da49b['removeAgents'](_0x42e7a9[_0xa727('0x34')][_0xa727('0x60')])['then'](function(){if(_['isArray'](_0x42e7a9[_0xa727('0x34')]['ids'])){for(var _0x506a60=0x0;_0x506a60<_0x42e7a9['query']['ids'][_0xa727('0x3a')];_0x506a60+=0x1){socket[_0xa727('0x126')]('userChatWebsite:remove',{'UserId':Number(_0x42e7a9[_0xa727('0x34')][_0xa727('0x60')][_0x506a60]),'ChatWebsiteId':Number(_0x42e7a9[_0xa727('0x54')]['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x42e7a9[_0xa727('0x34')][_0xa727('0x60')]),'ChatWebsiteId':Number(_0x42e7a9[_0xa727('0x54')]['id'])});}});}})[_0xa727('0x13')](respondWithStatusCode(_0x4b7a62,null))['catch'](handleError(_0x4b7a62,null));};exports['getAgents']=function(_0x29ce3d,_0x2bfb8b){var _0x540220={};var _0x2dc1f3={};var _0x24f597;var _0x4165b7;return db[_0xa727('0x43')][_0xa727('0x5e')]({'where':{'id':_0x29ce3d[_0xa727('0x54')]['id']}})[_0xa727('0x13')](handleEntityNotFound(_0x2bfb8b,null))[_0xa727('0x13')](function(_0x418305){if(_0x418305){_0x24f597=_0x418305;_0x2dc1f3['model']=_[_0xa727('0x35')](db[_0xa727('0xb9')][_0xa727('0x30')]);_0x2dc1f3[_0xa727('0x34')]=_[_0xa727('0x35')](_0x29ce3d['query']);_0x2dc1f3[_0xa727('0x36')]=_[_0xa727('0x37')](_0x2dc1f3[_0xa727('0x33')],_0x2dc1f3[_0xa727('0x34')]);_0x540220[_0xa727('0x38')]=_['intersection'](_0x2dc1f3[_0xa727('0x33')],qs[_0xa727('0x39')](_0x29ce3d[_0xa727('0x34')][_0xa727('0x39')]));_0x540220['attributes']=_0x540220[_0xa727('0x38')][_0xa727('0x3a')]?_0x540220[_0xa727('0x38')]:_0x2dc1f3[_0xa727('0x33')];_0x540220[_0xa727('0x3c')]=qs[_0xa727('0x3d')](_0x29ce3d[_0xa727('0x34')][_0xa727('0x3d')]);_0x540220[_0xa727('0x3e')]=qs[_0xa727('0x36')](_['pick'](_0x29ce3d[_0xa727('0x34')],_0x2dc1f3[_0xa727('0x36')]));if(_0x29ce3d[_0xa727('0x34')][_0xa727('0x40')]){_0x540220[_0xa727('0x3e')]=_[_0xa727('0x41')](_0x540220[_0xa727('0x3e')],{'$or':_[_0xa727('0x2f')](_0x540220['attributes'],function(_0x3f8851){var _0x41bc02={};_0x41bc02[_0x3f8851]={'$like':'%'+_0x29ce3d['query'][_0xa727('0x40')]+'%'};return _0x41bc02;})});}_0x540220=_['merge']({},_0x540220,_0x29ce3d[_0xa727('0x42')]);return _0x24f597[_0xa727('0x129')](_0x540220);}})[_0xa727('0x13')](function(_0x1b29da){if(_0x1b29da){_0x4165b7=_0x1b29da[_0xa727('0x3a')];if(!_0x29ce3d[_0xa727('0x34')][_0xa727('0x3b')](_0xa727('0x57'))){_0x540220[_0xa727('0x23')]=qs[_0xa727('0x23')](_0x29ce3d[_0xa727('0x34')][_0xa727('0x23')]);_0x540220[_0xa727('0x21')]=qs[_0xa727('0x21')](_0x29ce3d[_0xa727('0x34')][_0xa727('0x21')]);}return _0x24f597[_0xa727('0x129')](_0x540220);}})[_0xa727('0x13')](function(_0x245b34){if(_0x245b34){return _0x245b34?{'count':_0x4165b7,'rows':_0x245b34}:null;}})['then'](respondWithResult(_0x2bfb8b,null))[_0xa727('0x4b')](handleError(_0x2bfb8b,null));}; \ No newline at end of file +var _0xebe7=['\x22%s\x22\x20<%s>','email','MailAccountId','subjectOffline','toPairsIn','mapValues','lastName','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','internal','Tags','color','tag','Command','timezone','iftime\x20%s,%s','indexOf','true','interval','ONLINE','No\x20timezone','inspect','Interval','Intervals','virtual','License','push','all','some','remote','connection','remoteAddress','alignment','verticalAlignment','labelText','textColor','color_button','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','online','false','offlineForm','onlineForm','items','fromKey','ChatOfflineMessage','Attachments','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','bluebird','mustache','util','ejs','fs-extra','ioredis','api','../../mysqldb','redis','localhost','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','undefined','offset','limit','set','Content-Range','update','get','ChatWebsites','UserProfileResource','destroy','sendStatus','stack','name','send','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','params','Pause','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','Disposition','getDispositions','findOne','ChatWebsiteId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','sitepic','addAvatar','file','filename','addCustomerAvatar','customerAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','account','applications','Applications','orderBy','priority','asc','defaults','from','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','x-real-port','referer','browser','format','%s\x20%s','version','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','firstName','messageId','created','autoclose','close','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','files','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','originalname','mimetype','server','attachments','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail'];(function(_0x358fc9,_0x1d9ad9){var _0x177d66=function(_0x534968){while(--_0x534968){_0x358fc9['push'](_0x358fc9['shift']());}};_0x177d66(++_0x1d9ad9);}(_0xebe7,0x165));var _0x7ebe=function(_0x4bb5c9,_0x15d2e9){_0x4bb5c9=_0x4bb5c9-0x0;var _0x8e774d=_0xebe7[_0x4bb5c9];return _0x8e774d;};'use strict';var BPromise=require(_0x7ebe('0x0'));var Mustache=require(_0x7ebe('0x1'));var util=require(_0x7ebe('0x2'));var path=require('path');var ejs=require(_0x7ebe('0x3'));var fs=require('fs');var fs_extra=require(_0x7ebe('0x4'));var _=require('lodash');var querystring=require('querystring');var Redis=require(_0x7ebe('0x5'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x7ebe('0x6'));var config=require('../../config/environment');var db=require(_0x7ebe('0x7'))['db'];config[_0x7ebe('0x8')]=_['defaults'](config[_0x7ebe('0x8')],{'host':_0x7ebe('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ebe('0x8')]));require(_0x7ebe('0xa'))[_0x7ebe('0xb')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7ebe('0xc')]['http']({'port':0x232c});var client9002=jayson['client'][_0x7ebe('0xd')]({'port':0x232a});var client9003=jayson[_0x7ebe('0xc')]['http']({'port':0x232b});var client9001=jayson[_0x7ebe('0xc')][_0x7ebe('0xd')]({'port':0x2329});function respondWithRpcPromise(_0x37ce6f,_0x455719,_0xe35fdd,_0x3e87bc){return new BPromise(function(_0x407a67,_0x2c2906){var _0x2a8983=_0x3e87bc||client;return _0x2a8983[_0x7ebe('0xe')](_0x37ce6f,_0xe35fdd)[_0x7ebe('0xf')](function(_0x55ee34){logger[_0x7ebe('0x10')](_0x7ebe('0x11'),_0x455719,_0x7ebe('0x12'));logger[_0x7ebe('0x13')](_0x7ebe('0x14'),_0x455719,_0x7ebe('0x12'),JSON[_0x7ebe('0x15')](_0x55ee34));if(_0x55ee34[_0x7ebe('0x16')]){if(_0x55ee34[_0x7ebe('0x16')][_0x7ebe('0x17')]===0x1f4){logger[_0x7ebe('0x16')](_0x7ebe('0x11'),_0x455719,_0x55ee34[_0x7ebe('0x16')][_0x7ebe('0x18')]);return _0x2c2906(_0x55ee34[_0x7ebe('0x16')][_0x7ebe('0x18')]);}logger[_0x7ebe('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x455719,_0x55ee34['error'][_0x7ebe('0x18')]);return _0x407a67(_0x55ee34[_0x7ebe('0x16')]['message']);}else{logger['info'](_0x7ebe('0x11'),_0x455719,_0x7ebe('0x12'));_0x407a67(_0x55ee34['result'][_0x7ebe('0x18')]);}})[_0x7ebe('0x19')](function(_0x4f9d5d){logger[_0x7ebe('0x16')](_0x7ebe('0x11'),_0x455719,_0x4f9d5d);_0x2c2906(_0x4f9d5d);});});}function respondWithStatusCode(_0xdfe0bc,_0x40ac5c){_0x40ac5c=_0x40ac5c||0xcc;return function(_0x9ef2c1){if(_0x9ef2c1){return _0xdfe0bc['sendStatus'](_0x40ac5c);}return _0xdfe0bc[_0x7ebe('0x1a')](_0x40ac5c)[_0x7ebe('0x1b')]();};}function respondWithResult(_0x355f0a,_0x38f849){_0x38f849=_0x38f849||0xc8;return function(_0x494f71){if(_0x494f71){return _0x355f0a['status'](_0x38f849)[_0x7ebe('0x1c')](_0x494f71);}};}function respondWithFilteredResult(_0x2e3a1c,_0xdaeb6f){return function(_0x4a387a){if(_0x4a387a){var _0x586d19=typeof _0xdaeb6f['offset']===_0x7ebe('0x1d')&&typeof _0xdaeb6f['limit']===_0x7ebe('0x1d');var _0x217c1a=_0x4a387a['count'];var _0x5de94d=_0x586d19?0x0:_0xdaeb6f['offset'];var _0xce7213=_0x586d19?_0x4a387a['count']:_0xdaeb6f[_0x7ebe('0x1e')]+_0xdaeb6f[_0x7ebe('0x1f')];var _0x4aa17f;if(_0xce7213>=_0x217c1a){_0xce7213=_0x217c1a;_0x4aa17f=0xc8;}else{_0x4aa17f=0xce;}_0x2e3a1c[_0x7ebe('0x1a')](_0x4aa17f);return _0x2e3a1c[_0x7ebe('0x20')](_0x7ebe('0x21'),_0x5de94d+'-'+_0xce7213+'/'+_0x217c1a)['json'](_0x4a387a);}return null;};}function saveUpdates(_0x4520ff){return function(_0x3e1fb6){if(_0x3e1fb6){return _0x3e1fb6[_0x7ebe('0x22')](_0x4520ff)['then'](function(_0x31e3ff){return _0x31e3ff;});}return null;};}function removeEntity(_0x46cefc){return function(_0x5030e1){if(_0x5030e1){return _0x5030e1['destroy']()[_0x7ebe('0xf')](function(){var _0x197451=_0x5030e1[_0x7ebe('0x23')]({'plain':!![]});var _0x3ca8e8=_0x7ebe('0x24');return db[_0x7ebe('0x25')][_0x7ebe('0x26')]({'where':{'type':_0x3ca8e8,'resourceId':_0x197451['id']}})[_0x7ebe('0xf')](function(){return _0x5030e1;});})[_0x7ebe('0xf')](function(){_0x46cefc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43c2a9){return function(_0x3cd5eb){if(!_0x3cd5eb){_0x43c2a9[_0x7ebe('0x27')](0x194);}return _0x3cd5eb;};}function handleError(_0x57957a,_0x2701d3){_0x2701d3=_0x2701d3||0x1f4;return function(_0x15c76b){logger[_0x7ebe('0x16')](_0x15c76b[_0x7ebe('0x28')]);if(_0x15c76b[_0x7ebe('0x29')]){delete _0x15c76b[_0x7ebe('0x29')];}_0x57957a[_0x7ebe('0x1a')](_0x2701d3)[_0x7ebe('0x2a')](_0x15c76b);};}exports[_0x7ebe('0x2b')]=function(_0x4a32bd,_0x5ddd8c){var _0x34730f={'include':[{'model':db['Pause'],'as':_0x7ebe('0x2c')}]},_0x54c171={},_0x498fd2={'count':0x0,'rows':[]};var _0x41b015=_[_0x7ebe('0x2d')](db[_0x7ebe('0x2e')][_0x7ebe('0x2f')],function(_0x50b194){return{'name':_0x50b194[_0x7ebe('0x30')],'type':_0x50b194[_0x7ebe('0x31')][_0x7ebe('0x32')]};});_0x54c171[_0x7ebe('0x33')]=_[_0x7ebe('0x2d')](_0x41b015,_0x7ebe('0x29'));_0x54c171[_0x7ebe('0x34')]=_[_0x7ebe('0x35')](_0x4a32bd[_0x7ebe('0x34')]);_0x54c171[_0x7ebe('0x36')]=_[_0x7ebe('0x37')](_0x54c171[_0x7ebe('0x33')],_0x54c171['query']);_0x34730f[_0x7ebe('0x38')]=_[_0x7ebe('0x37')](_0x54c171[_0x7ebe('0x33')],qs[_0x7ebe('0x39')](_0x4a32bd[_0x7ebe('0x34')][_0x7ebe('0x39')]));_0x34730f[_0x7ebe('0x38')]=_0x34730f[_0x7ebe('0x38')][_0x7ebe('0x3a')]?_0x34730f[_0x7ebe('0x38')]:_0x54c171['model'];if(!_0x4a32bd[_0x7ebe('0x34')][_0x7ebe('0x3b')](_0x7ebe('0x3c'))){_0x34730f['limit']=qs[_0x7ebe('0x1f')](_0x4a32bd['query'][_0x7ebe('0x1f')]);_0x34730f[_0x7ebe('0x1e')]=qs[_0x7ebe('0x1e')](_0x4a32bd[_0x7ebe('0x34')][_0x7ebe('0x1e')]);}_0x34730f[_0x7ebe('0x3d')]=qs[_0x7ebe('0x3e')](_0x4a32bd[_0x7ebe('0x34')]['sort']);_0x34730f[_0x7ebe('0x3f')]=qs[_0x7ebe('0x36')](_[_0x7ebe('0x40')](_0x4a32bd[_0x7ebe('0x34')],_0x54c171['filters']),_0x41b015);if(_0x4a32bd[_0x7ebe('0x34')]['filter']){_0x34730f[_0x7ebe('0x3f')]=_[_0x7ebe('0x41')](_0x34730f[_0x7ebe('0x3f')],{'$or':_[_0x7ebe('0x2d')](_0x41b015,function(_0x59419c){if(_0x59419c[_0x7ebe('0x31')]!==_0x7ebe('0x42')){var _0x36d95a={};_0x36d95a[_0x59419c[_0x7ebe('0x29')]]={'$like':'%'+_0x4a32bd['query'][_0x7ebe('0x43')]+'%'};return _0x36d95a;}})});}_0x34730f=_['merge']({},_0x34730f,_0x4a32bd[_0x7ebe('0x44')]);var _0x23f79d={'where':_0x34730f['where']};return db[_0x7ebe('0x2e')][_0x7ebe('0x45')](_0x23f79d)[_0x7ebe('0xf')](function(_0x493c6d){_0x498fd2[_0x7ebe('0x45')]=_0x493c6d;if(_0x4a32bd[_0x7ebe('0x34')][_0x7ebe('0x46')]){_0x34730f[_0x7ebe('0x47')]=[{'all':!![]}];}return db[_0x7ebe('0x2e')][_0x7ebe('0x48')](_0x34730f);})[_0x7ebe('0xf')](function(_0x19b214){_0x498fd2[_0x7ebe('0x49')]=_0x19b214;return _0x498fd2;})[_0x7ebe('0xf')](respondWithFilteredResult(_0x5ddd8c,_0x34730f))[_0x7ebe('0x19')](handleError(_0x5ddd8c,null));};exports['show']=function(_0xd59b7d,_0x1af812){var _0x269750={'raw':![],'where':{'id':_0xd59b7d[_0x7ebe('0x4a')]['id']},'include':[{'model':db[_0x7ebe('0x4b')],'as':_0x7ebe('0x2c')}]},_0x16e35e={};_0x16e35e[_0x7ebe('0x33')]=_[_0x7ebe('0x35')](db[_0x7ebe('0x2e')][_0x7ebe('0x2f')]);_0x16e35e[_0x7ebe('0x34')]=_['keys'](_0xd59b7d[_0x7ebe('0x34')]);_0x16e35e[_0x7ebe('0x36')]=_[_0x7ebe('0x37')](_0x16e35e['model'],_0x16e35e['query']);_0x269750[_0x7ebe('0x38')]=_[_0x7ebe('0x37')](_0x16e35e[_0x7ebe('0x33')],qs['fields'](_0xd59b7d['query']['fields']));_0x269750['attributes']=_0x269750[_0x7ebe('0x38')][_0x7ebe('0x3a')]?_0x269750['attributes']:_0x16e35e[_0x7ebe('0x33')];if(_0xd59b7d[_0x7ebe('0x34')][_0x7ebe('0x46')]){_0x269750[_0x7ebe('0x47')]=[{'all':!![]}];}_0x269750=_[_0x7ebe('0x41')]({},_0x269750,_0xd59b7d['options']);return db[_0x7ebe('0x2e')][_0x7ebe('0x4c')](_0x269750)[_0x7ebe('0xf')](handleEntityNotFound(_0x1af812,null))[_0x7ebe('0xf')](respondWithResult(_0x1af812,null))[_0x7ebe('0x19')](handleError(_0x1af812,null));};exports[_0x7ebe('0x4d')]=function(_0x5e94fe,_0x1b65d4){return db['ChatWebsite'][_0x7ebe('0x4d')](_0x5e94fe['body'],{})[_0x7ebe('0xf')](function(_0x59c6b9){var _0x4c52ea=_0x5e94fe['user'][_0x7ebe('0x23')]({'plain':!![]});if(!_0x4c52ea)throw new Error(_0x7ebe('0x4e'));if(_0x4c52ea[_0x7ebe('0x4f')]===_0x7ebe('0x50')){var _0x11e544=_0x59c6b9['get']({'plain':!![]});var _0x41bf02='ChatWebsites';return db[_0x7ebe('0x51')][_0x7ebe('0x4c')]({'where':{'name':_0x41bf02,'userProfileId':_0x4c52ea['userProfileId']},'raw':!![]})[_0x7ebe('0xf')](function(_0x2f45c2){if(_0x2f45c2&&_0x2f45c2[_0x7ebe('0x52')]===0x0){return db[_0x7ebe('0x25')]['create']({'name':_0x11e544[_0x7ebe('0x29')],'resourceId':_0x11e544['id'],'type':_0x2f45c2[_0x7ebe('0x29')],'sectionId':_0x2f45c2['id']},{})[_0x7ebe('0xf')](function(){return _0x59c6b9;});}else{return _0x59c6b9;}})['catch'](function(_0x44f1c1){logger[_0x7ebe('0x16')](_0x7ebe('0x53'),_0x44f1c1);throw _0x44f1c1;});}return _0x59c6b9;})[_0x7ebe('0xf')](respondWithResult(_0x1b65d4,0xc9))[_0x7ebe('0x19')](handleError(_0x1b65d4,null));};exports[_0x7ebe('0x22')]=function(_0x3b65e8,_0x101b4f){if(_0x3b65e8[_0x7ebe('0x54')]['id']){delete _0x3b65e8[_0x7ebe('0x54')]['id'];}return db['ChatWebsite'][_0x7ebe('0x4c')]({'where':{'id':_0x3b65e8[_0x7ebe('0x4a')]['id']},'include':[{'model':db['Pause'],'as':_0x7ebe('0x2c')}]})[_0x7ebe('0xf')](handleEntityNotFound(_0x101b4f,null))[_0x7ebe('0xf')](saveUpdates(_0x3b65e8[_0x7ebe('0x54')],null))[_0x7ebe('0xf')](respondWithResult(_0x101b4f,null))[_0x7ebe('0x19')](handleError(_0x101b4f,null));};exports['destroy']=function(_0x4739fc,_0x7e57d3){return db[_0x7ebe('0x2e')][_0x7ebe('0x4c')]({'where':{'id':_0x4739fc[_0x7ebe('0x4a')]['id']}})['then'](handleEntityNotFound(_0x7e57d3,null))[_0x7ebe('0xf')](removeEntity(_0x7e57d3,null))['catch'](handleError(_0x7e57d3,null));};exports['describe']=function(_0x2a6f05,_0x2299c9){return db[_0x7ebe('0x2e')][_0x7ebe('0x55')]()[_0x7ebe('0xf')](respondWithResult(_0x2299c9,null))['catch'](handleError(_0x2299c9,null));};exports['addDisposition']=function(_0x591326,_0x2f5d1a){if(_0x591326['body']['id']){delete _0x591326[_0x7ebe('0x54')]['id'];}return db['ChatWebsite'][_0x7ebe('0x4c')]({'where':{'id':_0x591326[_0x7ebe('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2f5d1a,null))['then'](function(_0xa7e09a){if(_0xa7e09a){_0x591326[_0x7ebe('0x54')]['ChatWebsiteId']=_0xa7e09a['id'];return db[_0x7ebe('0x56')][_0x7ebe('0x4d')](_0x591326[_0x7ebe('0x54')]);}})[_0x7ebe('0xf')](respondWithResult(_0x2f5d1a,null))[_0x7ebe('0x19')](handleError(_0x2f5d1a,null));};exports[_0x7ebe('0x57')]=function(_0x132745,_0x141287){var _0x567e84={'raw':![],'where':{}};var _0x5281c2={};var _0x531be3={'count':0x0,'rows':[]};return db[_0x7ebe('0x2e')][_0x7ebe('0x58')]({'where':{'id':_0x132745[_0x7ebe('0x4a')]['id']}})['then'](handleEntityNotFound(_0x141287,null))[_0x7ebe('0xf')](function(_0x35b619){if(_0x35b619){_0x5281c2[_0x7ebe('0x33')]=_[_0x7ebe('0x35')](db[_0x7ebe('0x56')][_0x7ebe('0x2f')]);_0x5281c2[_0x7ebe('0x34')]=_[_0x7ebe('0x35')](_0x132745[_0x7ebe('0x34')]);_0x5281c2[_0x7ebe('0x36')]=_[_0x7ebe('0x37')](_0x5281c2['model'],_0x5281c2['query']);_0x567e84[_0x7ebe('0x38')]=_['intersection'](_0x5281c2[_0x7ebe('0x33')],qs[_0x7ebe('0x39')](_0x132745[_0x7ebe('0x34')][_0x7ebe('0x39')]));_0x567e84[_0x7ebe('0x38')]=_0x567e84[_0x7ebe('0x38')][_0x7ebe('0x3a')]?_0x567e84[_0x7ebe('0x38')]:_0x5281c2[_0x7ebe('0x33')];if(!_0x132745[_0x7ebe('0x34')][_0x7ebe('0x3b')]('nolimit')){_0x567e84[_0x7ebe('0x1f')]=qs[_0x7ebe('0x1f')](_0x132745[_0x7ebe('0x34')][_0x7ebe('0x1f')]);_0x567e84[_0x7ebe('0x1e')]=qs['offset'](_0x132745[_0x7ebe('0x34')]['offset']);}_0x567e84[_0x7ebe('0x3d')]=qs[_0x7ebe('0x3e')](_0x132745['query'][_0x7ebe('0x3e')]);_0x567e84[_0x7ebe('0x3f')]=qs['filters'](_[_0x7ebe('0x40')](_0x132745[_0x7ebe('0x34')],_0x5281c2['filters']));_0x567e84['where'][_0x7ebe('0x59')]=_0x35b619['id'];if(_0x132745['query'][_0x7ebe('0x43')]){_0x567e84[_0x7ebe('0x3f')]=_['merge'](_0x567e84[_0x7ebe('0x3f')],{'$or':_[_0x7ebe('0x2d')](_0x567e84[_0x7ebe('0x38')],function(_0x59bd05){var _0x29c49e={};_0x29c49e[_0x59bd05]={'$like':'%'+_0x132745[_0x7ebe('0x34')][_0x7ebe('0x43')]+'%'};return _0x29c49e;})});}_0x567e84=_[_0x7ebe('0x41')]({},_0x567e84,_0x132745[_0x7ebe('0x44')]);return db['Disposition'][_0x7ebe('0x45')]({'where':_0x567e84['where']})[_0x7ebe('0xf')](function(_0x1c8f00){_0x531be3[_0x7ebe('0x45')]=_0x1c8f00;if(_0x132745['query'][_0x7ebe('0x46')]){_0x567e84[_0x7ebe('0x47')]=[{'all':!![]}];}return db[_0x7ebe('0x56')][_0x7ebe('0x48')](_0x567e84);})['then'](function(_0x1e82ff){_0x531be3['rows']=_0x1e82ff;return _0x531be3;});}})[_0x7ebe('0xf')](respondWithFilteredResult(_0x141287,_0x567e84))[_0x7ebe('0x19')](handleError(_0x141287,null));};exports[_0x7ebe('0x5a')]=function(_0x5e385,_0x4d16cd){return db['ChatWebsite']['find']({'where':{'id':_0x5e385[_0x7ebe('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4d16cd,null))[_0x7ebe('0xf')](function(_0x19ac10){if(_0x19ac10){return _0x19ac10[_0x7ebe('0x5a')](_0x5e385['query'][_0x7ebe('0x5b')]);}})[_0x7ebe('0xf')](respondWithStatusCode(_0x4d16cd,null))[_0x7ebe('0x19')](handleError(_0x4d16cd,null));};exports[_0x7ebe('0x5c')]=function(_0x20e560,_0x40686a){if(_0x20e560[_0x7ebe('0x54')]['id']){delete _0x20e560[_0x7ebe('0x54')]['id'];}return db[_0x7ebe('0x2e')][_0x7ebe('0x4c')]({'where':{'id':_0x20e560[_0x7ebe('0x4a')]['id']}})[_0x7ebe('0xf')](handleEntityNotFound(_0x40686a,null))[_0x7ebe('0xf')](function(_0x13cf78){if(_0x13cf78){_0x20e560[_0x7ebe('0x54')][_0x7ebe('0x59')]=_0x13cf78['id'];return db[_0x7ebe('0x5d')][_0x7ebe('0x4d')](_0x20e560[_0x7ebe('0x54')]);}})[_0x7ebe('0xf')](respondWithResult(_0x40686a,null))[_0x7ebe('0x19')](handleError(_0x40686a,null));};exports[_0x7ebe('0x5e')]=function(_0x4a627b,_0x4fc5e3){var _0x407082={'raw':![],'where':{}};var _0x387f0b={};var _0x425618={'count':0x0,'rows':[]};return db[_0x7ebe('0x2e')][_0x7ebe('0x58')]({'where':{'id':_0x4a627b[_0x7ebe('0x4a')]['id']}})[_0x7ebe('0xf')](handleEntityNotFound(_0x4fc5e3,null))['then'](function(_0x1a81f8){if(_0x1a81f8){_0x387f0b[_0x7ebe('0x33')]=_[_0x7ebe('0x35')](db[_0x7ebe('0x5d')]['rawAttributes']);_0x387f0b[_0x7ebe('0x34')]=_[_0x7ebe('0x35')](_0x4a627b[_0x7ebe('0x34')]);_0x387f0b[_0x7ebe('0x36')]=_[_0x7ebe('0x37')](_0x387f0b['model'],_0x387f0b['query']);_0x407082[_0x7ebe('0x38')]=_['intersection'](_0x387f0b['model'],qs[_0x7ebe('0x39')](_0x4a627b[_0x7ebe('0x34')]['fields']));_0x407082[_0x7ebe('0x38')]=_0x407082[_0x7ebe('0x38')][_0x7ebe('0x3a')]?_0x407082[_0x7ebe('0x38')]:_0x387f0b[_0x7ebe('0x33')];if(!_0x4a627b['query'][_0x7ebe('0x3b')](_0x7ebe('0x3c'))){_0x407082[_0x7ebe('0x1f')]=qs['limit'](_0x4a627b[_0x7ebe('0x34')]['limit']);_0x407082[_0x7ebe('0x1e')]=qs['offset'](_0x4a627b[_0x7ebe('0x34')]['offset']);}_0x407082[_0x7ebe('0x3d')]=qs[_0x7ebe('0x3e')](_0x4a627b[_0x7ebe('0x34')][_0x7ebe('0x3e')]);_0x407082[_0x7ebe('0x3f')]=qs['filters'](_['pick'](_0x4a627b[_0x7ebe('0x34')],_0x387f0b[_0x7ebe('0x36')]));_0x407082[_0x7ebe('0x3f')][_0x7ebe('0x59')]=_0x1a81f8['id'];if(_0x4a627b[_0x7ebe('0x34')][_0x7ebe('0x43')]){_0x407082[_0x7ebe('0x3f')]=_[_0x7ebe('0x41')](_0x407082[_0x7ebe('0x3f')],{'$or':_[_0x7ebe('0x2d')](_0x407082['attributes'],function(_0xa2b81c){var _0x357eac={};_0x357eac[_0xa2b81c]={'$like':'%'+_0x4a627b[_0x7ebe('0x34')][_0x7ebe('0x43')]+'%'};return _0x357eac;})});}_0x407082=_[_0x7ebe('0x41')]({},_0x407082,_0x4a627b[_0x7ebe('0x44')]);return db[_0x7ebe('0x5d')][_0x7ebe('0x45')]({'where':_0x407082[_0x7ebe('0x3f')]})[_0x7ebe('0xf')](function(_0x1721bb){_0x425618[_0x7ebe('0x45')]=_0x1721bb;if(_0x4a627b[_0x7ebe('0x34')][_0x7ebe('0x46')]){_0x407082[_0x7ebe('0x47')]=[{'all':!![]}];}return db['CannedAnswer'][_0x7ebe('0x48')](_0x407082);})[_0x7ebe('0xf')](function(_0x49e896){_0x425618['rows']=_0x49e896;return _0x425618;});}})[_0x7ebe('0xf')](respondWithFilteredResult(_0x4fc5e3,_0x407082))['catch'](handleError(_0x4fc5e3,null));};exports[_0x7ebe('0x5f')]=function(_0x2c135c,_0x40ed0a){return db[_0x7ebe('0x2e')][_0x7ebe('0x4c')]({'where':{'id':_0x2c135c['params']['id']}})[_0x7ebe('0xf')](handleEntityNotFound(_0x40ed0a,null))[_0x7ebe('0xf')](function(_0x5e900b){if(_0x5e900b){return _0x5e900b[_0x7ebe('0x5f')](_0x2c135c['query']['ids']);}})['then'](respondWithStatusCode(_0x40ed0a,null))[_0x7ebe('0x19')](handleError(_0x40ed0a,null));};exports['addLogo']=function(_0x22023a,_0x36bf9d){_0x22023a[_0x7ebe('0x54')][_0x7ebe('0x60')]=_0x22023a['file']['filename'];return db[_0x7ebe('0x2e')]['find']({'where':{'id':_0x22023a['params']['id']}})[_0x7ebe('0xf')](handleEntityNotFound(_0x36bf9d,null))['then'](saveUpdates(_0x22023a[_0x7ebe('0x54')],null))[_0x7ebe('0xf')](respondWithResult(_0x36bf9d,null))[_0x7ebe('0x19')](handleError(_0x36bf9d,null));};exports[_0x7ebe('0x61')]=function(_0x415248,_0x3f086d){_0x415248['body']['agentAvatar']=_0x415248[_0x7ebe('0x62')][_0x7ebe('0x63')];return db[_0x7ebe('0x2e')][_0x7ebe('0x4c')]({'where':{'id':_0x415248[_0x7ebe('0x4a')]['id']}})[_0x7ebe('0xf')](handleEntityNotFound(_0x3f086d,null))['then'](saveUpdates(_0x415248['body'],null))['then'](respondWithResult(_0x3f086d,null))[_0x7ebe('0x19')](handleError(_0x3f086d,null));};exports[_0x7ebe('0x64')]=function(_0x44b418,_0x1fd4e4){_0x44b418['body'][_0x7ebe('0x65')]=_0x44b418['file']['filename'];return db[_0x7ebe('0x2e')]['find']({'where':{'id':_0x44b418[_0x7ebe('0x4a')]['id']}})[_0x7ebe('0xf')](handleEntityNotFound(_0x1fd4e4,null))[_0x7ebe('0xf')](saveUpdates(_0x44b418[_0x7ebe('0x54')],null))['then'](respondWithResult(_0x1fd4e4,null))[_0x7ebe('0x19')](handleError(_0x1fd4e4,null));};exports['addSystemAvatar']=function(_0x445c71,_0x48f3c0){_0x445c71[_0x7ebe('0x54')]['systemAvatar']=_0x445c71[_0x7ebe('0x62')][_0x7ebe('0x63')];return db['ChatWebsite'][_0x7ebe('0x4c')]({'where':{'id':_0x445c71['params']['id']}})['then'](handleEntityNotFound(_0x48f3c0,null))['then'](saveUpdates(_0x445c71['body'],null))[_0x7ebe('0xf')](respondWithResult(_0x48f3c0,null))['catch'](handleError(_0x48f3c0,null));};exports[_0x7ebe('0x66')]=function(_0x28c3a5,_0x89d290){var _0x1dd543=path['join'](config[_0x7ebe('0x67')],_0x7ebe('0x68'));var _0x2ac00e={'where':{'id':_0x28c3a5[_0x7ebe('0x4a')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x47dd2d=![];return require(_0x7ebe('0x69'))[_0x7ebe('0x6a')]()['then'](function(_0x18350f){if(_0x18350f){_0x47dd2d=_0x18350f[_0x7ebe('0x6b')];}})['then'](function(){return db[_0x7ebe('0x2e')]['find'](_0x2ac00e);})['then'](handleEntityNotFound(_0x89d290,null))[_0x7ebe('0xf')](function(_0x3cc84c){if(_0x3cc84c){if(!_[_0x7ebe('0x6c')](_0x3cc84c[_0x7ebe('0x60')])){if(fs[_0x7ebe('0x6d')](path[_0x7ebe('0x6e')](config[_0x7ebe('0x67')],_0x7ebe('0x6f'),_0x3cc84c[_0x7ebe('0x60')]))&&_0x47dd2d){_0x1dd543=path[_0x7ebe('0x6e')](config[_0x7ebe('0x67')],_0x7ebe('0x6f'),_0x3cc84c['sitepic']);}}return _0x89d290[_0x7ebe('0x70')](_0x1dd543);}})[_0x7ebe('0x19')](handleError(_0x89d290,null));};exports[_0x7ebe('0x71')]=function(_0x36bf2e,_0x147c10){var _0x51b7f2=path[_0x7ebe('0x6e')](config[_0x7ebe('0x67')],_0x7ebe('0x72'));var _0x4cfa73={'where':{'id':_0x36bf2e['params']['id']},'attributes':['id',_0x7ebe('0x73')],'raw':!![]};return db[_0x7ebe('0x2e')]['find'](_0x4cfa73)[_0x7ebe('0xf')](handleEntityNotFound(_0x147c10,null))[_0x7ebe('0xf')](function(_0x624fb2){if(_0x624fb2){if(!_['isNil'](_0x624fb2[_0x7ebe('0x73')])){if(fs['existsSync'](path[_0x7ebe('0x6e')](config['root'],'server/files/images/avatars/',_0x624fb2['agentAvatar']))){_0x51b7f2=path[_0x7ebe('0x6e')](config[_0x7ebe('0x67')],_0x7ebe('0x74'),_0x624fb2[_0x7ebe('0x73')]);}}return _0x147c10[_0x7ebe('0x70')](_0x51b7f2);}})[_0x7ebe('0x19')](handleError(_0x147c10,null));};exports[_0x7ebe('0x75')]=function(_0x48bc18,_0x59a2c9){var _0x28abde=path[_0x7ebe('0x6e')](config[_0x7ebe('0x67')],_0x7ebe('0x76'));var _0xb467b5={'where':{'id':_0x48bc18['params']['id']},'attributes':['id',_0x7ebe('0x65'),_0x7ebe('0x77')],'raw':!![]};return db['ChatWebsite'][_0x7ebe('0x4c')](_0xb467b5)[_0x7ebe('0xf')](handleEntityNotFound(_0x59a2c9,null))[_0x7ebe('0xf')](function(_0x447569){if(_0x447569){if(!_[_0x7ebe('0x6c')](_0x447569['customerAvatar'])){if(fs[_0x7ebe('0x6d')](path[_0x7ebe('0x6e')](config[_0x7ebe('0x67')],'server/files/images/avatars/',_0x447569[_0x7ebe('0x65')]))&&_0x447569['showCustomerAvatar']){_0x28abde=path[_0x7ebe('0x6e')](config[_0x7ebe('0x67')],'server/files/images/avatars/',_0x447569[_0x7ebe('0x65')]);}}return _0x59a2c9['download'](_0x28abde);}})['catch'](handleError(_0x59a2c9,null));};exports[_0x7ebe('0x78')]=function(_0x1d48a6,_0x7f2504){var _0x5edffd=path[_0x7ebe('0x6e')](config[_0x7ebe('0x67')],_0x7ebe('0x79'));var _0x1d2687={'where':{'id':_0x1d48a6[_0x7ebe('0x4a')]['id']},'attributes':['id',_0x7ebe('0x7a')],'raw':!![]};return db[_0x7ebe('0x2e')][_0x7ebe('0x4c')](_0x1d2687)[_0x7ebe('0xf')](handleEntityNotFound(_0x7f2504,null))[_0x7ebe('0xf')](function(_0x221c81){if(_0x221c81){if(!_['isNil'](_0x221c81[_0x7ebe('0x7a')])){if(fs[_0x7ebe('0x6d')](path['join'](config[_0x7ebe('0x67')],'server/files/images/avatars/',_0x221c81[_0x7ebe('0x7a')]))){_0x5edffd=path[_0x7ebe('0x6e')](config[_0x7ebe('0x67')],_0x7ebe('0x74'),_0x221c81[_0x7ebe('0x7a')]);}}return _0x7f2504[_0x7ebe('0x70')](_0x5edffd);}})[_0x7ebe('0x19')](handleError(_0x7f2504,null));};exports[_0x7ebe('0x7b')]=function(_0x17def2,_0x2eb982){var _0x13e65b=require(_0x7ebe('0x7c'));var _0x1a013d=new _0x13e65b();var _0x48ad12=_0x1a013d[_0x7ebe('0x7d')](_0x17def2[_0x7ebe('0x7e')][_0x7ebe('0x7f')])[_0x7ebe('0x80')]();var _0x29571a={'body':_0x17def2[_0x7ebe('0x54')],'channel':_0x7ebe('0x81')};var _0x18d157=[];var _0x271251=[];var _0x279e8a={};var _0x4a3df4=![];return db['CmContact'][_0x7ebe('0x55')]()[_0x7ebe('0xf')](function(_0x2becf9){if(!_0x2becf9){throw new db['Sequelize'][(_0x7ebe('0x82'))](_0x7ebe('0x83'));}_0x18d157=_[_0x7ebe('0x84')](_[_0x7ebe('0x35')](_0x2becf9),[_0x7ebe('0x85'),_0x7ebe('0x86')]);_0x271251=_[_0x7ebe('0x84')](_['keys'](_0x2becf9),[_0x7ebe('0x85'),_0x7ebe('0x86'),_0x7ebe('0x87'),_0x7ebe('0x88')]);if(_0x17def2['body']['id']){delete _0x17def2['body']['id'];}if(_['isNil'](_0x17def2['body']['from'])){throw new db[(_0x7ebe('0x89'))][(_0x7ebe('0x82'))](_0x7ebe('0x8a'));}if(_[_0x7ebe('0x6c')](_0x17def2['body'][_0x7ebe('0x54')])||_0x17def2['body'][_0x7ebe('0x54')]===''){throw new db[(_0x7ebe('0x89'))][(_0x7ebe('0x82'))](_0x7ebe('0x8b'));}if(_[_0x7ebe('0x6c')](_0x17def2['body']['mapKey'])){throw new db[(_0x7ebe('0x89'))][(_0x7ebe('0x82'))](_0x7ebe('0x8c')+_0x271251);}if(!_[_0x7ebe('0x8d')](_0x271251,_0x17def2[_0x7ebe('0x54')][_0x7ebe('0x8e')])){throw new db['Sequelize'][(_0x7ebe('0x82'))](_0x7ebe('0x8f')+_0x271251);}_0x279e8a[_0x17def2['body'][_0x7ebe('0x8e')]]=_0x17def2['body']['from'];})[_0x7ebe('0xf')](function(){return db[_0x7ebe('0x2e')][_0x7ebe('0x4c')]({'where':{'id':_0x17def2[_0x7ebe('0x4a')]['id']},'include':[{'model':db[_0x7ebe('0x90')],'as':_0x7ebe('0x91'),'include':[{'model':db[_0x7ebe('0x92')],'as':_0x7ebe('0x93'),'where':_0x279e8a,'limit':0x1,'order':[['updatedAt',_0x7ebe('0x94')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0x7ebe('0xf')](handleEntityNotFound(_0x2eb982,null))['then'](function(_0x935293){if(_0x935293&&_0x935293[_0x7ebe('0x91')]){_0x29571a[_0x7ebe('0x95')]=_0x935293;_0x29571a[_0x7ebe('0x96')]=_0x935293[_0x7ebe('0x97')];_0x29571a['list']=_0x935293[_0x7ebe('0x91')];_0x29571a[_0x7ebe('0x96')]=_[_0x7ebe('0x98')](_0x29571a[_0x7ebe('0x96')],[_0x7ebe('0x99')],[_0x7ebe('0x9a')]);if(_0x29571a[_0x7ebe('0x95')][_0x7ebe('0x97')]){delete _0x29571a[_0x7ebe('0x95')][_0x7ebe('0x97')];}if(_0x29571a[_0x7ebe('0x95')]['List']&&_0x29571a['account'][_0x7ebe('0x91')]['Contacts'][_0x7ebe('0x3a')]){return _0x29571a[_0x7ebe('0x95')][_0x7ebe('0x91')][_0x7ebe('0x93')][0x0];}var _0x5ba7c3=_[_0x7ebe('0x9b')](_0x17def2[_0x7ebe('0x54')],{'firstName':_0x17def2[_0x7ebe('0x54')][_0x7ebe('0x9c')],'ListId':_0x935293[_0x7ebe('0x88')]});_0x5ba7c3[_0x17def2['body'][_0x7ebe('0x8e')]]=_0x17def2[_0x7ebe('0x54')][_0x7ebe('0x9c')];return db[_0x7ebe('0x92')][_0x7ebe('0x4d')](_0x5ba7c3,{'fields':_0x18d157,'raw':!![]});}})['then'](handleEntityNotFound(_0x2eb982,null))['then'](function(_0x3d6519){_0x29571a[_0x7ebe('0x9d')]=_0x3d6519;var _0x19d847=_0x17def2[_0x7ebe('0x54')][_0x7ebe('0x9e')];if(_0x17def2[_0x7ebe('0x7e')][_0x7ebe('0x9f')]){_0x19d847=_0x17def2[_0x7ebe('0x7e')][_0x7ebe('0x9f')];}else if(_0x17def2[_0x7ebe('0x7e')]['x-forwarded-for']){_0x19d847=_['first'](_0x17def2[_0x7ebe('0x7e')][_0x7ebe('0xa0')][_0x7ebe('0xa1')](','));}if(_0x3d6519){var _0x4ac3ce={'ContactId':_0x3d6519['id'],'ChatWebsiteId':_0x17def2[_0x7ebe('0x4a')]['id'],'from':(_0x3d6519['firstName']||'')+'\x20'+(_0x3d6519['lastName']||''),'customerIp':_0x19d847,'customerPort':_0x17def2[_0x7ebe('0x7e')][_0x7ebe('0xa2')]?_0x17def2['headers']['x-real-port']:null,'referer':_0x17def2[_0x7ebe('0x54')][_0x7ebe('0xa3')],'browserName':_0x48ad12[_0x7ebe('0xa4')][_0x7ebe('0x29')]&&_0x48ad12[_0x7ebe('0xa4')]['version']?util[_0x7ebe('0xa5')](_0x7ebe('0xa6'),_0x48ad12['browser']['name'],_0x48ad12[_0x7ebe('0xa4')][_0x7ebe('0xa7')]):_0x7ebe('0xa8'),'browserVersion':_0x48ad12[_0x7ebe('0xa4')][_0x7ebe('0xa7')]||_0x7ebe('0xa8'),'osName':util[_0x7ebe('0xa5')](_0x7ebe('0xa6'),_0x48ad12['os'][_0x7ebe('0x29')],_0x48ad12['os'][_0x7ebe('0xa7')]),'osVersion':_0x48ad12['os']['version'],'deviceModel':_0x48ad12[_0x7ebe('0xa9')][_0x7ebe('0x33')]&&_0x48ad12[_0x7ebe('0xa9')][_0x7ebe('0xaa')]?util['format'](_0x7ebe('0xab'),_0x48ad12[_0x7ebe('0xa9')]['model'],_0x48ad12[_0x7ebe('0xa9')][_0x7ebe('0xaa')],_0x48ad12[_0x7ebe('0xa9')][_0x7ebe('0x31')]):null,'deviceVendor':_0x48ad12['device'][_0x7ebe('0xaa')],'deviceType':_0x48ad12[_0x7ebe('0xa9')][_0x7ebe('0x31')],'formData':JSON['stringify'](_0x17def2[_0x7ebe('0x54')])};var _0x220954={'ChatWebsiteId':_0x17def2[_0x7ebe('0x4a')]['id'],'closed':![]};if(_0x17def2[_0x7ebe('0x54')][_0x7ebe('0xac')]){_0x220954[_0x7ebe('0xac')]=_0x17def2[_0x7ebe('0x54')]['threadId'];return db[_0x7ebe('0xad')][_0x7ebe('0x4c')]({'where':_0x220954})[_0x7ebe('0xf')](function(_0x45d986){if(_0x45d986){return[_0x45d986,![]];}_0x4ac3ce[_0x7ebe('0xac')]=_0x17def2[_0x7ebe('0x54')]['threadId'];_0x4ac3ce['externalUrl']=_0x17def2[_0x7ebe('0x54')][_0x7ebe('0xae')];return db[_0x7ebe('0xad')]['create'](_0x4ac3ce)[_0x7ebe('0xf')](function(_0x100678){return[_0x100678,!![]];});});}_0x220954[_0x7ebe('0xaf')]=_0x3d6519['id'];if(_0x17def2[_0x7ebe('0x54')][_0x7ebe('0xb0')]&&_0x17def2[_0x7ebe('0x54')][_0x7ebe('0xb0')]['id']){_0x220954['id']=_0x17def2[_0x7ebe('0x54')][_0x7ebe('0xb0')]['id'];return db['ChatInteraction'][_0x7ebe('0x4c')]({'where':_0x220954})[_0x7ebe('0xf')](function(_0x17e0ee){if(_0x17e0ee){return[_0x17e0ee,![]];}return db['ChatInteraction']['create'](_0x4ac3ce)[_0x7ebe('0xf')](function(_0x36d705){return[_0x36d705,!![]];});});}return db[_0x7ebe('0xad')][_0x7ebe('0x4d')](_0x4ac3ce)['then'](function(_0x6d9bd){return[_0x6d9bd,!![]];});}})[_0x7ebe('0xb1')](function(_0x49d78c,_0x277765){if(_0x49d78c){_0x4a3df4=_0x277765;if(!_0x277765){var _0x57c741={'from':(_0x29571a['contact'][_0x7ebe('0xb2')]||'')+'\x20'+(_0x29571a[_0x7ebe('0x9d')]['lastName']||'')};if(_0x17def2['body'][_0x7ebe('0xac')]&&_0x17def2[_0x7ebe('0x54')][_0x7ebe('0xb3')]&&_0x17def2[_0x7ebe('0x54')][_0x7ebe('0xac')]!=_0x17def2[_0x7ebe('0x54')][_0x7ebe('0xb3')]){_0x57c741[_0x7ebe('0xac')]=_0x17def2['body'][_0x7ebe('0xb3')];}return _0x49d78c['update'](_0x57c741);}else{return _0x49d78c;}}})['then'](function(_0xa558a2){_0x29571a['interaction']=_0xa558a2[_0x7ebe('0x23')]({'plain':!![]});_0x29571a[_0x7ebe('0xb0')][_0x7ebe('0xb4')]=_0x4a3df4;if(_0x29571a[_0x7ebe('0xb0')]['created']){if(_0x29571a['account'][_0x7ebe('0xb5')]){_0x29571a[_0x7ebe('0x96')]['push']({'id':0x0,'priority':_0x29571a[_0x7ebe('0x96')]['length']+0x1,'app':_0x7ebe('0xb6'),'appdata':'unmanaged','interval':_0x7ebe('0xb7')});}}return db[_0x7ebe('0xb8')][_0x7ebe('0x4d')]({'body':_0x17def2['body'][_0x7ebe('0x54')],'ChatWebsiteId':_0x17def2[_0x7ebe('0x4a')]['id'],'ChatInteractionId':_0xa558a2['id'],'direction':'in','ContactId':_0x29571a[_0x7ebe('0x9d')]['id'],'AttachmentId':_0x17def2[_0x7ebe('0x54')][_0x7ebe('0xb9')]});})[_0x7ebe('0xf')](function(_0x3c1762){_0x29571a[_0x7ebe('0x18')]=_0x3c1762;if(_0x29571a[_0x7ebe('0xb0')][_0x7ebe('0xba')]){return db[_0x7ebe('0xbb')][_0x7ebe('0x4c')]({'attributes':['id',_0x7ebe('0x29')],'where':{'id':_0x29571a[_0x7ebe('0xb0')][_0x7ebe('0xba')]}})[_0x7ebe('0xf')](function(_0x4ade8d){if(_0x4ade8d){_0x29571a['applications'][_0x7ebe('0xbc')]({'id':0x0,'priority':0x0,'app':_0x7ebe('0xbd'),'appdata':_0x4ade8d[_0x7ebe('0x29')]+','+(_0x29571a[_0x7ebe('0x95')]['waitForTheAssignedAgent']||0xa),'interval':_0x7ebe('0xb7')});_0x29571a[_0x7ebe('0xbe')]=!![];}return respondWithRpcPromise(_0x7ebe('0xbf'),_0x7ebe('0xc0'),_0x29571a);});}return respondWithRpcPromise(_0x7ebe('0xbf'),_0x7ebe('0xc0'),_0x29571a);})['then'](function(_0x2246ce){respondWithRpcPromise(_0x7ebe('0xc1'),'EventManager',{'event':_0x7ebe('0x7b'),'message':_0x2246ce},client9002);return _0x2246ce;})[_0x7ebe('0xf')](respondWithResult(_0x2eb982,null))['catch'](handleError(_0x2eb982,null));};exports['offline']=function(_0x40bccd,_0x434d49){var _0x19fef1,_0x424b70,_0x58a75e;var _0x504354=[];var _0x360aa1={};var _0x57324b=_0x40bccd[_0x7ebe('0xc2')]||[];var _0x2a9693=[];var _0xb3eb81;return db[_0x7ebe('0x92')]['describe']()[_0x7ebe('0xf')](function(_0x100dbc){if(!_0x100dbc){throw new db[(_0x7ebe('0x89'))][(_0x7ebe('0x82'))](_0x7ebe('0x83'));}_0x504354=_[_0x7ebe('0x84')](_[_0x7ebe('0x35')](_0x100dbc),['createdAt','updatedAt',_0x7ebe('0x87'),'ListId']);if(_0x40bccd[_0x7ebe('0x54')]['id']){delete _0x40bccd['body']['id'];}if(_['isNil'](_0x40bccd[_0x7ebe('0x54')][_0x7ebe('0x9c')])){throw _0x434d49['status'](0x1f4)[_0x7ebe('0x2a')](new db['Sequelize'][(_0x7ebe('0x82'))](_0x7ebe('0x8a')));}if(_[_0x7ebe('0x6c')](_0x40bccd[_0x7ebe('0x54')][_0x7ebe('0x54')])||_0x40bccd[_0x7ebe('0x54')][_0x7ebe('0x54')]===''){throw _0x434d49[_0x7ebe('0x1a')](0x1f4)['send'](new db[(_0x7ebe('0x89'))][(_0x7ebe('0x82'))](_0x7ebe('0x8b')));}if(_[_0x7ebe('0x6c')](_0x40bccd[_0x7ebe('0x54')]['mapKeyOffline'])){throw _0x434d49[_0x7ebe('0x1a')](0x1f4)[_0x7ebe('0x2a')](new db[(_0x7ebe('0x89'))][(_0x7ebe('0x82'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x504354));}if(!_[_0x7ebe('0x8d')](_0x504354,_0x40bccd[_0x7ebe('0x54')][_0x7ebe('0xc3')])){throw _0x434d49[_0x7ebe('0x1a')](0x1f4)[_0x7ebe('0x2a')](new db[(_0x7ebe('0x89'))][(_0x7ebe('0x82'))](_0x7ebe('0xc4')+_0x504354));}_0x360aa1[_0x40bccd[_0x7ebe('0x54')]['mapKeyOffline']]=_0x40bccd[_0x7ebe('0x54')][_0x7ebe('0x9c')];})[_0x7ebe('0xf')](function(){return db[_0x7ebe('0x2e')]['find']({'where':{'id':_0x40bccd[_0x7ebe('0x4a')]['id']},'include':[{'model':db[_0x7ebe('0x90')],'as':'List'},{'model':db[_0x7ebe('0xc5')],'as':'MailAccount'}]});})[_0x7ebe('0xf')](handleEntityNotFound(_0x434d49,null))[_0x7ebe('0xf')](function(_0x581529){if(_0x581529&&_0x581529['List']){_0x424b70=_0x581529;var _0x530282=_[_0x7ebe('0x9b')](_0x40bccd[_0x7ebe('0x54')],{'firstName':_0x40bccd[_0x7ebe('0x54')][_0x7ebe('0x9c')],'phone':_0x40bccd[_0x7ebe('0x54')][_0x7ebe('0x9c')],'ListId':_0x581529[_0x7ebe('0x88')]});_0x530282[_0x40bccd[_0x7ebe('0x54')][_0x7ebe('0xc3')]]=_0x40bccd[_0x7ebe('0x54')][_0x7ebe('0x9c')];return db[_0x7ebe('0x92')][_0x7ebe('0xc6')]({'where':_0x360aa1,'defaults':_0x530282});}})[_0x7ebe('0xb1')](function(_0xe91047){if(_0xe91047){_0x58a75e=_0xe91047;var _0x497404=fs[_0x7ebe('0xc7')](path[_0x7ebe('0x6e')](config[_0x7ebe('0x67')],_0x7ebe('0xc8')),_0x7ebe('0xc9'));var _0x26cd19=ejs[_0x7ebe('0xca')](_0x497404,{'body':_[_0x7ebe('0xcb')](_0x40bccd[_0x7ebe('0x54')]['body']),'bodyTitle':_0x424b70['offlineMessageBody']});return db['ChatOfflineMessage']['create']({'body':_0x26cd19,'ContactId':_0xe91047['id'],'ChatWebsiteId':_0x424b70['id']});}})[_0x7ebe('0xf')](function(_0x336a89){_0xb3eb81=_0x336a89;if(_0x57324b[_0x7ebe('0x3a')]){var _0x3f91ed=_0x57324b['map'](function(_0x3f9f92){return{'name':_0x3f9f92[_0x7ebe('0xcc')],'basename':_0x3f9f92['filename'],'type':_0x3f9f92[_0x7ebe('0xcd')],'ChatOfflineMessageId':_0x336a89['id']};});_0x2a9693=_0x3f91ed[_0x7ebe('0x2d')](_0x2fe52d=>{var _0x3ba5d2={'filename':_0x2fe52d[_0x7ebe('0x29')],'path':path[_0x7ebe('0x6e')](config[_0x7ebe('0x67')],_0x7ebe('0xce'),'files',_0x7ebe('0xcf'),'offline-chat',_0x2fe52d[_0x7ebe('0xd0')])};return _0x3ba5d2;});if(!_0x424b70[_0x7ebe('0xd1')]){return db[_0x7ebe('0xd2')][_0x7ebe('0xd3')](function(_0x227230){return db[_0x7ebe('0xd4')][_0x7ebe('0xd5')](_0x3f91ed,{'transaction':_0x227230});});}}})['then'](function(){if(_0xb3eb81){_0x19fef1=_0xb3eb81;return db[_0x7ebe('0xc5')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0x7ebe('0xd6')],'as':'Smtp','raw':!![]}]});}})['then'](function(_0x22bc92){if(_0x22bc92&&_0x22bc92[_0x7ebe('0xd7')]&&_0x424b70[_0x7ebe('0xd8')]&&_0x424b70[_0x7ebe('0xd9')]){var _0x3218d6={'tls':{'rejectUnauthorized':![]}};if(_0x22bc92[_0x7ebe('0xd7')][_0x7ebe('0xda')]){_0x3218d6[_0x7ebe('0xda')]=_0x22bc92['Smtp']['service'];}else{_0x3218d6[_0x7ebe('0xdb')]=_0x22bc92[_0x7ebe('0xd7')][_0x7ebe('0xdb')];_0x3218d6['port']=_0x22bc92[_0x7ebe('0xd7')][_0x7ebe('0xdc')];_0x3218d6['secure']=_0x22bc92[_0x7ebe('0xd7')][_0x7ebe('0xdd')];}if(_0x22bc92['Smtp'][_0x7ebe('0xde')]){_0x3218d6[_0x7ebe('0xdf')]={'user':_0x22bc92['Smtp'][_0x7ebe('0x50')],'pass':_0x22bc92['Smtp'][_0x7ebe('0xe0')]};}return respondWithRpcPromise(_0x7ebe('0xe1'),_0x7ebe('0xe2'),{'account':_0x3218d6,'message':{'from':util[_0x7ebe('0xa5')](_0x7ebe('0xe3'),_0x22bc92['name'],_0x22bc92[_0x7ebe('0xe4')]||_0x22bc92['Smtp'][_0x7ebe('0x50')]),'to':_0x424b70[_0x7ebe('0xd9')],'subject':_0x424b70['offlineMessageSubject'],'html':_0x19fef1['body'],'attachments':_0x2a9693}},client9003)[_0x7ebe('0xf')](function(){return _0x19fef1;})[_0x7ebe('0x19')](function(_0x43c491){console['error'](_0x43c491);});}})['then'](function(){if(_0x424b70&&_0x424b70[_0x7ebe('0xd1')]&&_0x424b70[_0x7ebe('0xe5')]){var _0x32aaac=[];if(_0x57324b['length']){_0x32aaac=_0x57324b[_0x7ebe('0x2d')](function(_0x1c683c){return{'name':_0x1c683c['originalname'],'basename':_0x1c683c['filename'],'type':_0x1c683c['mimetype'],'ChatOfflineMessageId':_0xb3eb81['id']};});}var _0x539b2a;if(!_['isNil'](_0x424b70[_0x7ebe('0xe6')])){var _0x32b38a=_[_0x7ebe('0x2d')](_0x40bccd[_0x7ebe('0x54')],function(_0x1ab4cb){return _0x1ab4cb;});var _0x50aa01=_[_0x7ebe('0xe7')](_0x32b38a)[0x0];var _0x40027d=_[_0x7ebe('0xe8')](_0x50aa01,function(_0x1629b2){return _0x1629b2;});_0x539b2a=_0x40027d[0x1][_0x424b70['subjectOffline']];}var _0x463c7f={'from':_0x58a75e[_0x7ebe('0xe4')],'firstName':_0x58a75e[_0x7ebe('0xb2')],'lastName':_0x58a75e[_0x7ebe('0xe9')],'mapKey':_0x7ebe('0xe4'),'message':{'from':_0x58a75e[_0x7ebe('0xe4')],'to':_0x424b70[_0x7ebe('0xc5')][_0x7ebe('0xe4')],'cc':'','subject':_[_0x7ebe('0x6c')](_0x539b2a)?_0x424b70['offlineMessageSubject']:_0x539b2a,'messageId':'','sentAt':new Date(),'attach':_0x32aaac[_0x7ebe('0x3a')],'attachments':_0x32aaac,'originChannel':'Chat','ChatWebsiteId':_0x424b70['id'],'ChatOfflineMessageId':_0x19fef1['id'],'originTo':_0x424b70['MailAccount']['email']},'body':_0x19fef1[_0x7ebe('0x54')]};var _0x52ab6e={'account':{'id':_0x424b70[_0x7ebe('0xe5')]},'body':_0x463c7f,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x7ebe('0xea'),_0x7ebe('0xeb'),_0x52ab6e,client9001)[_0x7ebe('0xf')](function(){return _0x19fef1;})[_0x7ebe('0x19')](function(_0x1c5142){console[_0x7ebe('0x16')](_0x1c5142);});}return;})[_0x7ebe('0xf')](function(){if(_0x19fef1){return _0x19fef1;}})[_0x7ebe('0xf')](respondWithResult(_0x434d49,null))[_0x7ebe('0x19')](function(_0xa45161){console[_0x7ebe('0x16')](_0x7ebe('0x19'),_0xa45161);for(var _0x3902f9 of _0x57324b){var _0x482414=path[_0x7ebe('0x6e')](config[_0x7ebe('0x67')],_0x7ebe('0xce'),'files','attachments','offline-chat',_0x3902f9[_0x7ebe('0x63')]);fs_extra[_0x7ebe('0xec')](_0x482414)['catch'](function(_0xf6ce38){console[_0x7ebe('0x16')](_0x7ebe('0xed'),_0x482414,_0xf6ce38);});}});};exports[_0x7ebe('0xee')]=function(_0xcf3b0c,_0x52c1ed){return db[_0x7ebe('0xad')][_0x7ebe('0x4c')]({'where':{'id':_0xcf3b0c['params']['id']}})[_0x7ebe('0xf')](handleEntityNotFound(_0x52c1ed,null))['then'](function(_0xa78c18){if(_0xa78c18){return _0xa78c18['addInteraction'](_0xcf3b0c[_0x7ebe('0x54')][_0x7ebe('0x5b')],_[_0x7ebe('0xef')](_0xcf3b0c[_0x7ebe('0x54')],['ids','id'])||{});}})[_0x7ebe('0xf')](respondWithResult(_0x52c1ed,null))[_0x7ebe('0x19')](handleError(_0x52c1ed,null));};exports['getInteractions']=function(_0xaf42ed,_0x21f83a){var _0xe354fa={'raw':![],'where':{}};var _0x1f99f4={};var _0x4e37ee={'count':0x0,'rows':[]};return db[_0x7ebe('0x2e')][_0x7ebe('0x58')]({'where':{'id':_0xaf42ed[_0x7ebe('0x4a')]['id']}})[_0x7ebe('0xf')](handleEntityNotFound(_0x21f83a,null))['then'](function(_0x2d61ce){if(_0x2d61ce){_0x1f99f4[_0x7ebe('0x33')]=_[_0x7ebe('0x35')](db[_0x7ebe('0xad')][_0x7ebe('0x2f')]);_0x1f99f4['query']=_['keys'](_0xaf42ed[_0x7ebe('0x34')]);_0x1f99f4[_0x7ebe('0x36')]=_[_0x7ebe('0x37')](_0x1f99f4[_0x7ebe('0x33')],_0x1f99f4[_0x7ebe('0x34')]);_0xe354fa['attributes']=_['intersection'](_0x1f99f4[_0x7ebe('0x33')],qs[_0x7ebe('0x39')](_0xaf42ed['query'][_0x7ebe('0x39')]));_0xe354fa[_0x7ebe('0x38')]=_0xe354fa[_0x7ebe('0x38')]['length']?_0xe354fa[_0x7ebe('0x38')]:_0x1f99f4[_0x7ebe('0x33')];if(!_0xaf42ed[_0x7ebe('0x34')][_0x7ebe('0x3b')](_0x7ebe('0x3c'))){_0xe354fa[_0x7ebe('0x1f')]=qs[_0x7ebe('0x1f')](_0xaf42ed[_0x7ebe('0x34')]['limit']);_0xe354fa[_0x7ebe('0x1e')]=qs[_0x7ebe('0x1e')](_0xaf42ed[_0x7ebe('0x34')][_0x7ebe('0x1e')]);}_0xe354fa[_0x7ebe('0x3d')]=qs[_0x7ebe('0x3e')](_0xaf42ed['query'][_0x7ebe('0x3e')]);_0xe354fa[_0x7ebe('0x3f')]=qs[_0x7ebe('0x36')](_[_0x7ebe('0x40')](_0xaf42ed['query'],_0x1f99f4['filters']));_0xe354fa[_0x7ebe('0x3f')]['ChatWebsiteId']=_0x2d61ce['id'];if(_0xaf42ed[_0x7ebe('0x34')]['filter']){_0xe354fa[_0x7ebe('0x3f')]=_[_0x7ebe('0x41')](_0xe354fa[_0x7ebe('0x3f')],{'$or':_[_0x7ebe('0x2d')](_0xe354fa['attributes'],function(_0x1b2497){var _0x31fea2={};_0x31fea2[_0x1b2497]={'$like':'%'+_0xaf42ed[_0x7ebe('0x34')][_0x7ebe('0x43')]+'%'};return _0x31fea2;})});}_0xe354fa=_['merge']({},_0xe354fa,_0xaf42ed[_0x7ebe('0x44')]);return db[_0x7ebe('0xad')][_0x7ebe('0x45')]({'where':_0xe354fa[_0x7ebe('0x3f')]})[_0x7ebe('0xf')](function(_0x2c6cd6){_0x4e37ee[_0x7ebe('0x45')]=_0x2c6cd6;if(_0xaf42ed[_0x7ebe('0x34')][_0x7ebe('0x46')]){_0xe354fa['include']=[{'model':db[_0x7ebe('0x92')],'as':_0x7ebe('0xf0'),'required':![]},{'model':db[_0x7ebe('0xbb')],'as':'Owner','attributes':[_0x7ebe('0x29'),'fullname',_0x7ebe('0xf1')],'required':![]},{'model':db['Tag'],'as':_0x7ebe('0xf2'),'attributes':['id',_0x7ebe('0x29'),_0x7ebe('0xf3')],'where':_0xaf42ed['query']['tag']?{'id':_0xaf42ed['query'][_0x7ebe('0xf4')]}:undefined,'required':_0xaf42ed[_0x7ebe('0x34')][_0x7ebe('0xf4')]?!![]:![]}];}return db[_0x7ebe('0xad')]['findAll'](_0xe354fa);})[_0x7ebe('0xf')](function(_0x15a6a5){_0x4e37ee['rows']=_0x15a6a5;return _0x4e37ee;});}})[_0x7ebe('0xf')](respondWithFilteredResult(_0x21f83a,_0xe354fa))[_0x7ebe('0x19')](handleError(_0x21f83a,null));};function iftimePromise(_0x278280,_0x30a41e){return respondWithRpcPromise(_0x7ebe('0xf5'),'getSnippet',{'command':_0x30a41e[_0x7ebe('0xf6')]?util[_0x7ebe('0xa5')](_0x7ebe('0xf7'),_0x278280['interval'],_0x30a41e['timezone']):util['format']('iftime\x20%s',_0x278280['interval'])},client9002)[_0x7ebe('0xf')](function(_0x3c8c44){var _0x25f5a0=_0x3c8c44&&_0x3c8c44[_0x7ebe('0xf8')](_0x7ebe('0xf9'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x30a41e['id'],_0x278280['id'],_0x278280[_0x7ebe('0xfa')],_0x25f5a0?_0x7ebe('0xfb'):'OFFLINE',_0x30a41e[_0x7ebe('0xf6')]?_0x30a41e['timezone']:_0x7ebe('0xfc'));return _0x25f5a0;})['catch'](function(_0x2219db){logger[_0x7ebe('0x16')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x30a41e['id'],_0x278280['id'],_0x278280[_0x7ebe('0xfa')],util[_0x7ebe('0xfd')](_0x2219db,{'showHidden':![],'depth':null}),_0x30a41e[_0x7ebe('0xf6')]?_0x30a41e[_0x7ebe('0xf6')]:_0x7ebe('0xfc'));return![];});}exports['getSnippet']=function(_0x3dd274,_0x3f5c51){var _0x339cfc=0x0;var _0x38e9cc=0x0;var _0xdec6f9=![];var _0x5e8aea;var _0xd02c6f;return db[_0x7ebe('0x2e')][_0x7ebe('0x4c')]({'where':{'id':_0x3dd274[_0x7ebe('0x4a')]['id']},'include':[{'model':db['Interval'],'as':_0x7ebe('0xfe'),'include':[{'model':db[_0x7ebe('0xfe')],'as':_0x7ebe('0xff'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x7ebe('0xf')](handleEntityNotFound(_0x3f5c51,null))[_0x7ebe('0xf')](function(_0x26da3b){if(_0x26da3b){_0x5e8aea=_0x26da3b;return _0x26da3b['getProactiveActions']({'raw':!![]});}})['then'](function(_0x218210){if(_0x5e8aea){if(_0x218210){_0xd02c6f=_0x218210;}}return require(_0x7ebe('0x69'))[_0x7ebe('0x6a')]();})['then'](function(_0x3cef02){if(_0x3cef02){_0x38e9cc=_0x3cef02[_0x7ebe('0x100')];_0xdec6f9=_0x3cef02['custom'];}})['then'](function(){return db['ChatInteraction'][_0x7ebe('0x45')]({'where':{'closed':![]}});})[_0x7ebe('0xf')](function(_0x156364){_0x339cfc=_0x156364;if(_0x38e9cc&&_0x156364>_0x38e9cc){return db[_0x7ebe('0x101')]['findOne']({'where':{'id':0x1}})[_0x7ebe('0xf')](function(_0x482bfa){if(_0x482bfa){_0x482bfa['increment']('chatLicenseExceeded');}});}})['then'](function(){if(_0x5e8aea[_0x7ebe('0xfe')]&&_0x5e8aea[_0x7ebe('0xfe')][_0x7ebe('0xff')]){var _0x3a91dc=[];for(var _0x315d37=0x0;_0x315d37<_0x5e8aea['Interval'][_0x7ebe('0xff')][_0x7ebe('0x3a')];_0x315d37++){var _0x1a48e2=_0x5e8aea[_0x7ebe('0xfe')]['Intervals'][_0x315d37][_0x7ebe('0x23')]({'plain':!![]});_0x3a91dc[_0x7ebe('0x102')](iftimePromise(_0x1a48e2,_0x5e8aea));}return BPromise[_0x7ebe('0x103')](_0x3a91dc)['then'](function(_0x2d934){return _[_0x7ebe('0x104')](_0x2d934);});}else{return!![];}})[_0x7ebe('0xf')](function(_0x38cea3){var _0x4eff9d=fs[_0x7ebe('0xc7')](path[_0x7ebe('0x6e')](config[_0x7ebe('0x67')],'server/files/chat/iframe.ejs'),_0x7ebe('0xc9'));var _0x129291={'remote':_0x5e8aea[_0x7ebe('0x105')],'query':querystring[_0x7ebe('0x15')](_['merge'](_0x5e8aea[_0x7ebe('0x23')]({'plain':!![]}),{'customerIp':_0x3dd274[_0x7ebe('0x7e')][_0x7ebe('0xa0')]||_0x3dd274[_0x7ebe('0x7e')]['x-real-ip']||_0x3dd274[_0x7ebe('0x106')][_0x7ebe('0x107')]||_0x3dd274['ip'],'referer':_0x3dd274['headers'][_0x7ebe('0xa3')],'openedInteractions':_0x339cfc,'maxInteractions':_0x38e9cc,'virtual':_0xdec6f9[_0x7ebe('0x100')],'online':_0x38cea3,'custom':_0xdec6f9}))['replace'](/'/g,'\x5c\x27')};_0x3f5c51[_0x7ebe('0x2a')](ejs[_0x7ebe('0xca')](Mustache[_0x7ebe('0xca')](_0x4eff9d,_0x129291),{'proactiveActions':_0xd02c6f,'alignment':_0x5e8aea[_0x7ebe('0x108')],'verticalAlignment':_0x5e8aea[_0x7ebe('0x109')],'div_color':_0x5e8aea['color'],'labelText':_0x5e8aea[_0x7ebe('0x10a')],'text_color':_0x5e8aea[_0x7ebe('0x10b')],'button_color':_0x5e8aea[_0x7ebe('0x10c')],'background_color':_0x5e8aea['backgroundColor']}));})[_0x7ebe('0x19')](handleError(_0x3f5c51,null));};exports['addApplications']=function(_0x3e89f3,_0x301dba){var _0x8ad678=_0x3e89f3[_0x7ebe('0x4a')]['id'];var _0x42cb9a=_0x3e89f3[_0x7ebe('0x54')];var _0x56d178=0xc8;var _0x31c1b2=null;return db['sequelize'][_0x7ebe('0xd3')]({'isolationLevel':db['sequelize'][_0x7ebe('0x10d')][_0x7ebe('0x10e')][_0x7ebe('0x10f')]},function(_0x5dc687){return db[_0x7ebe('0x2e')][_0x7ebe('0x58')]({'where':{'id':_0x8ad678},'transaction':_0x5dc687})['then'](function(_0x3b19cb){if(_0x3b19cb){return db[_0x7ebe('0x110')]['destroy']({'where':{'ChatWebsiteId':_0x8ad678},'transaction':_0x5dc687})['then'](function(){var _0x15bdbe=_[_0x7ebe('0x2d')](_0x42cb9a,function(_0x43bea3){_0x43bea3['ChatWebsiteId']=_0x8ad678;return _0x43bea3;});return db[_0x7ebe('0x110')][_0x7ebe('0xd5')](_0x15bdbe,{'transaction':_0x5dc687});});}else{_0x56d178=0x194;_0x31c1b2=[];}});})[_0x7ebe('0xf')](function(){if(_0x56d178!==0x194){return db[_0x7ebe('0x110')][_0x7ebe('0x111')]({'where':{'ChatWebsiteId':_0x8ad678},'order':_0x7ebe('0x99')})['then'](function(_0x16e115){_0x31c1b2=_0x16e115;});}})[_0x7ebe('0x19')](function(_0x2a7a9e){_0x56d178=0x1f4;logger['error'](_0x2a7a9e[_0x7ebe('0x28')]);if(_0x2a7a9e['name']){delete _0x2a7a9e[_0x7ebe('0x29')];}_0x31c1b2=_0x2a7a9e;})['finally'](function(){if(_0x31c1b2===null){_0x301dba[_0x7ebe('0x27')](_0x56d178);}else{if(_0x56d178===0x1f4){_0x301dba[_0x7ebe('0x1a')](_0x56d178)['send'](_0x31c1b2);}else{_0x301dba[_0x7ebe('0x1a')](_0x56d178)[_0x7ebe('0x1c')](_0x31c1b2);}}});};exports[_0x7ebe('0x112')]=function(_0x33b189,_0x45de64){var _0x4b720={};var _0x42cdeb={};var _0x42336d;var _0x18897e;return db[_0x7ebe('0x2e')][_0x7ebe('0x58')]({'where':{'id':_0x33b189['params']['id']}})['then'](handleEntityNotFound(_0x45de64,null))[_0x7ebe('0xf')](function(_0x4ad2f8){if(_0x4ad2f8){_0x42336d=_0x4ad2f8;_0x42cdeb['model']=_[_0x7ebe('0x35')](db[_0x7ebe('0x110')]['rawAttributes']);_0x42cdeb[_0x7ebe('0x34')]=_['keys'](_0x33b189[_0x7ebe('0x34')]);_0x42cdeb[_0x7ebe('0x36')]=_[_0x7ebe('0x37')](_0x42cdeb[_0x7ebe('0x33')],_0x42cdeb[_0x7ebe('0x34')]);_0x4b720[_0x7ebe('0x38')]=_[_0x7ebe('0x37')](_0x42cdeb[_0x7ebe('0x33')],qs[_0x7ebe('0x39')](_0x33b189['query']['fields']));_0x4b720[_0x7ebe('0x38')]=_0x4b720['attributes']['length']?_0x4b720[_0x7ebe('0x38')]:_0x42cdeb['model'];_0x4b720[_0x7ebe('0x3d')]=qs['sort'](_0x33b189['query'][_0x7ebe('0x3e')]);_0x4b720['where']=qs['filters'](_[_0x7ebe('0x40')](_0x33b189[_0x7ebe('0x34')],_0x42cdeb[_0x7ebe('0x36')]));if(_0x33b189[_0x7ebe('0x34')]['filter']){_0x4b720['where']=_[_0x7ebe('0x41')](_0x4b720[_0x7ebe('0x3f')],{'$or':_[_0x7ebe('0x2d')](_0x4b720[_0x7ebe('0x38')],function(_0x1f2acf){var _0x5ba065={};_0x5ba065[_0x1f2acf]={'$like':'%'+_0x33b189[_0x7ebe('0x34')][_0x7ebe('0x43')]+'%'};return _0x5ba065;})});}_0x4b720=_[_0x7ebe('0x41')]({},_0x4b720,_0x33b189[_0x7ebe('0x44')]);return _0x42336d['getApplications'](_0x4b720);}})[_0x7ebe('0xf')](function(_0x89ad22){if(_0x89ad22){_0x18897e=_0x89ad22[_0x7ebe('0x3a')];if(!_0x33b189[_0x7ebe('0x34')][_0x7ebe('0x3b')](_0x7ebe('0x3c'))){_0x4b720[_0x7ebe('0x1f')]=qs[_0x7ebe('0x1f')](_0x33b189[_0x7ebe('0x34')][_0x7ebe('0x1f')]);_0x4b720[_0x7ebe('0x1e')]=qs['offset'](_0x33b189[_0x7ebe('0x34')][_0x7ebe('0x1e')]);}return _0x42336d[_0x7ebe('0x112')](_0x4b720);}})['then'](function(_0x2f3244){if(_0x2f3244){return _0x2f3244?{'count':_0x18897e,'rows':_0x2f3244}:null;}})['then'](respondWithResult(_0x45de64,null))[_0x7ebe('0x19')](handleError(_0x45de64,null));};exports[_0x7ebe('0x113')]=function(_0x29d903,_0x19987d){return db[_0x7ebe('0x114')][_0x7ebe('0x4c')]({'where':{'id':_0x29d903[_0x7ebe('0x4a')]['id']}})[_0x7ebe('0xf')](handleEntityNotFound(_0x19987d,null))[_0x7ebe('0xf')](function(_0x21a773){if(_0x21a773){return _0x21a773[_0x7ebe('0x113')](_0x29d903[_0x7ebe('0x54')]['ids'],_[_0x7ebe('0xef')](_0x29d903[_0x7ebe('0x54')],[_0x7ebe('0x5b'),'id'])||{});}})[_0x7ebe('0xf')](respondWithResult(_0x19987d,null))[_0x7ebe('0x19')](handleError(_0x19987d,null));};exports[_0x7ebe('0x115')]=function(_0x2ee21d,_0x15b62e){var _0x3ca538={};var _0x5de48c={};var _0x212af8;var _0x4bf67f;return db['ChatWebsite'][_0x7ebe('0x58')]({'where':{'id':_0x2ee21d[_0x7ebe('0x4a')]['id']}})[_0x7ebe('0xf')](handleEntityNotFound(_0x15b62e,null))[_0x7ebe('0xf')](function(_0xad70c0){if(_0xad70c0){_0x212af8=_0xad70c0;_0x5de48c[_0x7ebe('0x33')]=_[_0x7ebe('0x35')](db['ChatProactiveAction'][_0x7ebe('0x2f')]);_0x5de48c[_0x7ebe('0x34')]=_['keys'](_0x2ee21d[_0x7ebe('0x34')]);_0x5de48c[_0x7ebe('0x36')]=_[_0x7ebe('0x37')](_0x5de48c['model'],_0x5de48c[_0x7ebe('0x34')]);_0x3ca538[_0x7ebe('0x38')]=_['intersection'](_0x5de48c['model'],qs[_0x7ebe('0x39')](_0x2ee21d[_0x7ebe('0x34')][_0x7ebe('0x39')]));_0x3ca538[_0x7ebe('0x38')]=_0x3ca538['attributes'][_0x7ebe('0x3a')]?_0x3ca538[_0x7ebe('0x38')]:_0x5de48c[_0x7ebe('0x33')];_0x3ca538['order']=qs[_0x7ebe('0x3e')](_0x2ee21d[_0x7ebe('0x34')][_0x7ebe('0x3e')]);_0x3ca538[_0x7ebe('0x3f')]=qs[_0x7ebe('0x36')](_[_0x7ebe('0x40')](_0x2ee21d[_0x7ebe('0x34')],_0x5de48c[_0x7ebe('0x36')]));if(_0x2ee21d[_0x7ebe('0x34')][_0x7ebe('0x43')]){_0x3ca538['where']=_[_0x7ebe('0x41')](_0x3ca538[_0x7ebe('0x3f')],{'$or':_[_0x7ebe('0x2d')](_0x3ca538[_0x7ebe('0x38')],function(_0x38ee5b){var _0x1456bf={};_0x1456bf[_0x38ee5b]={'$like':'%'+_0x2ee21d[_0x7ebe('0x34')][_0x7ebe('0x43')]+'%'};return _0x1456bf;})});}_0x3ca538=_[_0x7ebe('0x41')]({},_0x3ca538,_0x2ee21d[_0x7ebe('0x44')]);return _0x212af8['getProactiveActions'](_0x3ca538);}})[_0x7ebe('0xf')](function(_0x4f37dc){if(_0x4f37dc){_0x4bf67f=_0x4f37dc[_0x7ebe('0x3a')];if(!_0x2ee21d[_0x7ebe('0x34')]['hasOwnProperty']('nolimit')){_0x3ca538[_0x7ebe('0x1f')]=qs[_0x7ebe('0x1f')](_0x2ee21d[_0x7ebe('0x34')]['limit']);_0x3ca538[_0x7ebe('0x1e')]=qs['offset'](_0x2ee21d[_0x7ebe('0x34')][_0x7ebe('0x1e')]);}return _0x212af8[_0x7ebe('0x115')](_0x3ca538);}})['then'](function(_0xc3aaaa){if(_0xc3aaaa){return _0xc3aaaa?{'count':_0x4bf67f,'rows':_0xc3aaaa}:null;}})[_0x7ebe('0xf')](respondWithResult(_0x15b62e,null))[_0x7ebe('0x19')](handleError(_0x15b62e,null));};exports[_0x7ebe('0x116')]=function(_0x375c44,_0x296afe){var _0x56c65e=_0x375c44[_0x7ebe('0x34')][_0x7ebe('0x117')]===_0x7ebe('0x118')?_0x7ebe('0x119'):_0x7ebe('0x11a');return db['ChatWebsite'][_0x7ebe('0x4c')]({'attributes':['id',_0x56c65e],'where':{'id':_0x375c44['params']['id']}})[_0x7ebe('0xf')](handleEntityNotFound(_0x296afe,null))[_0x7ebe('0xf')](function(_0x160c67){if(_0x160c67){var _0x590186=_0x160c67[_0x56c65e];var _0x3ec137=_0x590186&&_0x590186['items']?_0x590186[_0x7ebe('0x11b')]:[];_0x296afe[_0x7ebe('0x2a')]({'fromKey':_[_0x7ebe('0x6c')](_0x590186[_0x7ebe('0x11c')])?undefined:_0x590186['fromKey'],'count':_0x3ec137['length'],'rows':_0x3ec137});}})['catch'](handleError(_0x296afe,null));};exports['getOfflineMessages']=function(_0x1d67be,_0x49db96){var _0x331c75={'raw':![],'where':{}};var _0x3aa5cb={};var _0xe35ac8={'count':0x0,'rows':[]};return db[_0x7ebe('0x2e')][_0x7ebe('0x58')]({'where':{'id':_0x1d67be['params']['id']}})[_0x7ebe('0xf')](handleEntityNotFound(_0x49db96,null))[_0x7ebe('0xf')](function(_0x548528){if(_0x548528){_0x3aa5cb[_0x7ebe('0x33')]=_[_0x7ebe('0x35')](db[_0x7ebe('0x11d')][_0x7ebe('0x2f')]);_0x3aa5cb['query']=_['keys'](_0x1d67be['query']);_0x3aa5cb['filters']=_[_0x7ebe('0x37')](_0x3aa5cb[_0x7ebe('0x33')],_0x3aa5cb[_0x7ebe('0x34')]);_0x331c75[_0x7ebe('0x38')]=_[_0x7ebe('0x37')](_0x3aa5cb[_0x7ebe('0x33')],qs['fields'](_0x1d67be['query'][_0x7ebe('0x39')]));_0x331c75[_0x7ebe('0x38')]=_0x331c75[_0x7ebe('0x38')]['length']?_0x331c75[_0x7ebe('0x38')]:_0x3aa5cb[_0x7ebe('0x33')];if(!_0x1d67be[_0x7ebe('0x34')][_0x7ebe('0x3b')]('nolimit')){_0x331c75[_0x7ebe('0x1f')]=qs[_0x7ebe('0x1f')](_0x1d67be[_0x7ebe('0x34')][_0x7ebe('0x1f')]);_0x331c75[_0x7ebe('0x1e')]=qs[_0x7ebe('0x1e')](_0x1d67be[_0x7ebe('0x34')][_0x7ebe('0x1e')]);}_0x331c75[_0x7ebe('0x3d')]=qs[_0x7ebe('0x3e')](_0x1d67be[_0x7ebe('0x34')][_0x7ebe('0x3e')]);_0x331c75['where']=qs['filters'](_[_0x7ebe('0x40')](_0x1d67be['query'],_0x3aa5cb['filters']));_0x331c75[_0x7ebe('0x3f')][_0x7ebe('0x59')]=_0x548528['id'];if(_0x1d67be[_0x7ebe('0x34')][_0x7ebe('0x43')]){_0x331c75[_0x7ebe('0x3f')]=_[_0x7ebe('0x41')](_0x331c75['where'],{'$or':_[_0x7ebe('0x2d')](_0x331c75[_0x7ebe('0x38')],function(_0x3cd059){var _0x117f5a={};_0x117f5a[_0x3cd059]={'$like':'%'+_0x1d67be[_0x7ebe('0x34')][_0x7ebe('0x43')]+'%'};return _0x117f5a;})});}_0x331c75=_[_0x7ebe('0x41')]({},_0x331c75,_0x1d67be['options']);return db[_0x7ebe('0x11d')][_0x7ebe('0x45')]({'where':_0x331c75[_0x7ebe('0x3f')]})['then'](function(_0x3f1503){_0xe35ac8['count']=_0x3f1503;if(_0x1d67be[_0x7ebe('0x34')]['includeAll']){_0x331c75[_0x7ebe('0x47')]=[{'all':!![]}];}else{_0x331c75[_0x7ebe('0x47')]=[{'model':db['CmContact'],'as':_0x7ebe('0xf0'),'required':![]},{'model':db[_0x7ebe('0xd4')],'as':_0x7ebe('0x11e'),'required':![]}];}return db[_0x7ebe('0x11d')][_0x7ebe('0x48')](_0x331c75);})[_0x7ebe('0xf')](function(_0x3e6dd4){_0xe35ac8[_0x7ebe('0x49')]=_0x3e6dd4;return _0xe35ac8;});}})[_0x7ebe('0xf')](respondWithFilteredResult(_0x49db96,_0x331c75))[_0x7ebe('0x19')](handleError(_0x49db96,null));};exports[_0x7ebe('0x11f')]=function(_0x1a8f53,_0xd77040){return db[_0x7ebe('0x2e')][_0x7ebe('0x4c')]({'where':{'id':_0x1a8f53[_0x7ebe('0x4a')]['id']}})[_0x7ebe('0xf')](handleEntityNotFound(_0xd77040,null))[_0x7ebe('0xf')](function(_0x5134e5){if(_0x5134e5){return _0x5134e5['addAgents'](_0x1a8f53['body'][_0x7ebe('0x5b')],_['omit'](_0x1a8f53[_0x7ebe('0x54')],[_0x7ebe('0x5b'),'id'])||{})[_0x7ebe('0xb1')](function(_0x759fc8){for(var _0x4fc89d=0x0;_0x4fc89d<_0x1a8f53[_0x7ebe('0x54')][_0x7ebe('0x5b')][_0x7ebe('0x3a')];_0x4fc89d+=0x1){socket[_0x7ebe('0x120')]('userChatWebsite:save',{'UserId':Number(_0x1a8f53[_0x7ebe('0x54')]['ids'][_0x4fc89d]),'ChatWebsiteId':Number(_0x1a8f53['params']['id'])});}return _0x759fc8;});}})['then'](respondWithResult(_0xd77040,null))[_0x7ebe('0x19')](handleError(_0xd77040,null));};exports[_0x7ebe('0x121')]=function(_0x5a7c4a,_0x114685){return db['ChatWebsite'][_0x7ebe('0x4c')]({'where':{'id':_0x5a7c4a['params']['id']}})[_0x7ebe('0xf')](handleEntityNotFound(_0x114685,null))[_0x7ebe('0xf')](function(_0x5218ec){if(_0x5218ec){return _0x5218ec[_0x7ebe('0x121')](_0x5a7c4a[_0x7ebe('0x34')][_0x7ebe('0x5b')])[_0x7ebe('0xf')](function(){if(_[_0x7ebe('0x122')](_0x5a7c4a['query'][_0x7ebe('0x5b')])){for(var _0x357e4a=0x0;_0x357e4a<_0x5a7c4a[_0x7ebe('0x34')][_0x7ebe('0x5b')][_0x7ebe('0x3a')];_0x357e4a+=0x1){socket[_0x7ebe('0x120')](_0x7ebe('0x123'),{'UserId':Number(_0x5a7c4a[_0x7ebe('0x34')][_0x7ebe('0x5b')][_0x357e4a]),'ChatWebsiteId':Number(_0x5a7c4a[_0x7ebe('0x4a')]['id'])});}}else{socket[_0x7ebe('0x120')](_0x7ebe('0x123'),{'UserId':Number(_0x5a7c4a[_0x7ebe('0x34')]['ids']),'ChatWebsiteId':Number(_0x5a7c4a['params']['id'])});}});}})[_0x7ebe('0xf')](respondWithStatusCode(_0x114685,null))[_0x7ebe('0x19')](handleError(_0x114685,null));};exports['getAgents']=function(_0xc03fdb,_0x70ca05){var _0x354ce8={};var _0x28a0e5={};var _0x47ee7e;var _0x130008;return db[_0x7ebe('0x2e')][_0x7ebe('0x58')]({'where':{'id':_0xc03fdb[_0x7ebe('0x4a')]['id']}})['then'](handleEntityNotFound(_0x70ca05,null))[_0x7ebe('0xf')](function(_0x44d674){if(_0x44d674){_0x47ee7e=_0x44d674;_0x28a0e5[_0x7ebe('0x33')]=_[_0x7ebe('0x35')](db['User'][_0x7ebe('0x2f')]);_0x28a0e5[_0x7ebe('0x34')]=_['keys'](_0xc03fdb[_0x7ebe('0x34')]);_0x28a0e5[_0x7ebe('0x36')]=_[_0x7ebe('0x37')](_0x28a0e5[_0x7ebe('0x33')],_0x28a0e5[_0x7ebe('0x34')]);_0x354ce8[_0x7ebe('0x38')]=_[_0x7ebe('0x37')](_0x28a0e5[_0x7ebe('0x33')],qs[_0x7ebe('0x39')](_0xc03fdb[_0x7ebe('0x34')]['fields']));_0x354ce8[_0x7ebe('0x38')]=_0x354ce8[_0x7ebe('0x38')][_0x7ebe('0x3a')]?_0x354ce8[_0x7ebe('0x38')]:_0x28a0e5[_0x7ebe('0x33')];_0x354ce8[_0x7ebe('0x3d')]=qs[_0x7ebe('0x3e')](_0xc03fdb[_0x7ebe('0x34')][_0x7ebe('0x3e')]);_0x354ce8['where']=qs[_0x7ebe('0x36')](_['pick'](_0xc03fdb[_0x7ebe('0x34')],_0x28a0e5['filters']));if(_0xc03fdb[_0x7ebe('0x34')][_0x7ebe('0x43')]){_0x354ce8[_0x7ebe('0x3f')]=_[_0x7ebe('0x41')](_0x354ce8['where'],{'$or':_[_0x7ebe('0x2d')](_0x354ce8[_0x7ebe('0x38')],function(_0x292c71){var _0x5ddb7b={};_0x5ddb7b[_0x292c71]={'$like':'%'+_0xc03fdb[_0x7ebe('0x34')][_0x7ebe('0x43')]+'%'};return _0x5ddb7b;})});}_0x354ce8=_['merge']({},_0x354ce8,_0xc03fdb[_0x7ebe('0x44')]);return _0x47ee7e['getAgents'](_0x354ce8);}})[_0x7ebe('0xf')](function(_0x1fe224){if(_0x1fe224){_0x130008=_0x1fe224[_0x7ebe('0x3a')];if(!_0xc03fdb['query'][_0x7ebe('0x3b')](_0x7ebe('0x3c'))){_0x354ce8[_0x7ebe('0x1f')]=qs[_0x7ebe('0x1f')](_0xc03fdb[_0x7ebe('0x34')][_0x7ebe('0x1f')]);_0x354ce8[_0x7ebe('0x1e')]=qs[_0x7ebe('0x1e')](_0xc03fdb[_0x7ebe('0x34')][_0x7ebe('0x1e')]);}return _0x47ee7e['getAgents'](_0x354ce8);}})[_0x7ebe('0xf')](function(_0x790afe){if(_0x790afe){return _0x790afe?{'count':_0x130008,'rows':_0x790afe}:null;}})[_0x7ebe('0xf')](respondWithResult(_0x70ca05,null))[_0x7ebe('0x19')](handleError(_0x70ca05,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index f241cba..2a0a698 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 _0x0d4e=['../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','events'];(function(_0x4573bd,_0x19b9b5){var _0xc07bb9=function(_0x36a36a){while(--_0x36a36a){_0x4573bd['push'](_0x4573bd['shift']());}};_0xc07bb9(++_0x19b9b5);}(_0x0d4e,0x1ca));var _0xe0d4=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x0d4e[_0x178e48];return _0x440d7e;};'use strict';var EventEmitter=require(_0xe0d4('0x0'));var ChatWebsite=require(_0xe0d4('0x1'))['db'][_0xe0d4('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xe0d4('0x3')](0x0);var events={'afterCreate':_0xe0d4('0x4'),'afterUpdate':_0xe0d4('0x5'),'afterDestroy':_0xe0d4('0x6')};function emitEvent(_0x154d6d){return function(_0x251804,_0x56b43f,_0xdfee37){ChatWebsiteEvents[_0xe0d4('0x7')](_0x154d6d+':'+_0x251804['id'],_0x251804);ChatWebsiteEvents[_0xe0d4('0x7')](_0x154d6d,_0x251804);_0xdfee37(null);};}for(var e in events){if(events[_0xe0d4('0x8')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x8135=['exports','../../mysqldb','ChatWebsite','setMaxListeners','save','remove','hasOwnProperty','hook'];(function(_0x41794f,_0x1a993a){var _0x551c7c=function(_0x57d2e1){while(--_0x57d2e1){_0x41794f['push'](_0x41794f['shift']());}};_0x551c7c(++_0x1a993a);}(_0x8135,0x99));var _0x5813=function(_0x4b36c8,_0x354b97){_0x4b36c8=_0x4b36c8-0x0;var _0x6f7c14=_0x8135[_0x4b36c8];return _0x6f7c14;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x5813('0x0'))['db'][_0x5813('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x5813('0x2')](0x0);var events={'afterCreate':_0x5813('0x3'),'afterUpdate':'update','afterDestroy':_0x5813('0x4')};function emitEvent(_0x196ea8){return function(_0xf23c29,_0x701689,_0x1c9b08){ChatWebsiteEvents['emit'](_0x196ea8+':'+_0xf23c29['id'],_0xf23c29);ChatWebsiteEvents['emit'](_0x196ea8,_0xf23c29);_0x1c9b08(null);};}for(var e in events){if(events[_0x5813('0x5')](e)){var event=events[e];ChatWebsite[_0x5813('0x6')](e,emitEvent(event));}}module[_0x5813('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 3ea3803..fed1c3f 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 _0xba51=['define','ChatWebsite','chat_websites','util','moment','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xba51,0x1c6));var _0x1ba5=function(_0x430144,_0x3cc6ea){_0x430144=_0x430144-0x0;var _0x377f50=_0xba51[_0x430144];return _0x377f50;};'use strict';var _=require('lodash');var util=require(_0x1ba5('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x1ba5('0x1'));var BPromise=require('bluebird');var rp=require(_0x1ba5('0x2'));var fs=require('fs');var path=require(_0x1ba5('0x3'));var rimraf=require(_0x1ba5('0x4'));var config=require(_0x1ba5('0x5'));var attributes=require(_0x1ba5('0x6'));module[_0x1ba5('0x7')]=function(_0x5827ef,_0x459431){return _0x5827ef[_0x1ba5('0x8')](_0x1ba5('0x9'),attributes,{'tableName':_0x1ba5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68ad=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x68ad,0x1b1));var _0xd68a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x68ad[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd68a('0x0'));var util=require(_0xd68a('0x1'));var logger=require(_0xd68a('0x2'))(_0xd68a('0x3'));var moment=require('moment');var BPromise=require(_0xd68a('0x4'));var rp=require(_0xd68a('0x5'));var fs=require('fs');var path=require(_0xd68a('0x6'));var rimraf=require(_0xd68a('0x7'));var config=require(_0xd68a('0x8'));var attributes=require(_0xd68a('0x9'));module[_0xd68a('0xa')]=function(_0x1b94fd,_0x5c4e93){return _0x1b94fd[_0xd68a('0xb')](_0xd68a('0xc'),attributes,{'tableName':_0xd68a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 3452caa..a7b334b 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 _0xd2a0=['request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket'];(function(_0x27a125,_0x330c0e){var _0x36eac1=function(_0x49265f){while(--_0x49265f){_0x27a125['push'](_0x27a125['shift']());}};_0x36eac1(++_0x330c0e);}(_0xd2a0,0x1b4));var _0x0d2a=function(_0x52e97e,_0x419e42){_0x52e97e=_0x52e97e-0x0;var _0x4c955f=_0xd2a0[_0x52e97e];return _0x4c955f;};'use strict';var _=require(_0x0d2a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0d2a('0x1'));var rs=require(_0x0d2a('0x2'));var fs=require('fs');var Redis=require(_0x0d2a('0x3'));var db=require(_0x0d2a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d2a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0d2a('0x6'));var client=jayson[_0x0d2a('0x7')][_0x0d2a('0x8')]({'port':0x232a});config[_0x0d2a('0x9')]=_[_0x0d2a('0xa')](config[_0x0d2a('0x9')],{'host':_0x0d2a('0xb'),'port':0x18eb});var socket=require(_0x0d2a('0xc'))(new Redis(config[_0x0d2a('0x9')]));require(_0x0d2a('0xd'))['register'](socket);function respondWithRpcPromise(_0x4fd1d5,_0x44979e,_0x40037c){return new BPromise(function(_0x15a9bb,_0x12cbc2){return client[_0x0d2a('0xe')](_0x4fd1d5,_0x40037c)[_0x0d2a('0xf')](function(_0x4c1edc){logger[_0x0d2a('0x10')](_0x0d2a('0x11'),_0x44979e,_0x0d2a('0x12'));logger['debug'](_0x0d2a('0x13'),_0x44979e,_0x0d2a('0x12'),JSON[_0x0d2a('0x14')](_0x4c1edc));if(_0x4c1edc[_0x0d2a('0x15')]){if(_0x4c1edc[_0x0d2a('0x15')][_0x0d2a('0x16')]===0x1f4){logger[_0x0d2a('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x44979e,_0x4c1edc[_0x0d2a('0x15')]['message']);return _0x12cbc2(_0x4c1edc[_0x0d2a('0x15')][_0x0d2a('0x17')]);}logger[_0x0d2a('0x15')](_0x0d2a('0x11'),_0x44979e,_0x4c1edc[_0x0d2a('0x15')][_0x0d2a('0x17')]);return _0x15a9bb(_0x4c1edc[_0x0d2a('0x15')][_0x0d2a('0x17')]);}else{logger[_0x0d2a('0x10')](_0x0d2a('0x11'),_0x44979e,'request\x20sent');_0x15a9bb(_0x4c1edc['result'][_0x0d2a('0x17')]);}})[_0x0d2a('0x18')](function(_0x42e6a4){logger['error'](_0x0d2a('0x11'),_0x44979e,_0x42e6a4);_0x12cbc2(_0x42e6a4);});});} \ No newline at end of file +var _0x35db=['request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','info','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then'];(function(_0x3e0721,_0x48b83d){var _0x241625=function(_0xc8967){while(--_0xc8967){_0x3e0721['push'](_0x3e0721['shift']());}};_0x241625(++_0x48b83d);}(_0x35db,0x18e));var _0xb35d=function(_0x4e12b4,_0x4e8d81){_0x4e12b4=_0x4e12b4-0x0;var _0x1784ee=_0x35db[_0x4e12b4];return _0x1784ee;};'use strict';var _=require(_0xb35d('0x0'));var util=require('util');var moment=require(_0xb35d('0x1'));var BPromise=require('bluebird');var rs=require(_0xb35d('0x2'));var fs=require('fs');var Redis=require(_0xb35d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb35d('0x4'));var logger=require(_0xb35d('0x5'))(_0xb35d('0x6'));var config=require('../../config/environment');var jayson=require(_0xb35d('0x7'));var client=jayson[_0xb35d('0x8')]['http']({'port':0x232a});config[_0xb35d('0x9')]=_['defaults'](config[_0xb35d('0x9')],{'host':_0xb35d('0xa'),'port':0x18eb});var socket=require(_0xb35d('0xb'))(new Redis(config[_0xb35d('0x9')]));require(_0xb35d('0xc'))[_0xb35d('0xd')](socket);function respondWithRpcPromise(_0x334af5,_0x4f7b19,_0x48c4d8){return new BPromise(function(_0x105ee8,_0x41ecca){return client[_0xb35d('0xe')](_0x334af5,_0x48c4d8)[_0xb35d('0xf')](function(_0x4a664d){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x4f7b19,_0xb35d('0x10'));logger['debug'](_0xb35d('0x11'),_0x4f7b19,'request\x20sent',JSON['stringify'](_0x4a664d));if(_0x4a664d[_0xb35d('0x12')]){if(_0x4a664d['error'][_0xb35d('0x13')]===0x1f4){logger[_0xb35d('0x12')](_0xb35d('0x14'),_0x4f7b19,_0x4a664d['error'][_0xb35d('0x15')]);return _0x41ecca(_0x4a664d['error'][_0xb35d('0x15')]);}logger[_0xb35d('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x4f7b19,_0x4a664d[_0xb35d('0x12')][_0xb35d('0x15')]);return _0x105ee8(_0x4a664d[_0xb35d('0x12')][_0xb35d('0x15')]);}else{logger[_0xb35d('0x16')](_0xb35d('0x14'),_0x4f7b19,'request\x20sent');_0x105ee8(_0x4a664d['result'][_0xb35d('0x15')]);}})['catch'](function(_0x1bff0b){logger[_0xb35d('0x12')](_0xb35d('0x14'),_0x4f7b19,_0x1bff0b);_0x41ecca(_0x1bff0b);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index dc01656..07a6b3a 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 _0x9924=['length','chatWebsite:','./chatWebsite.events','remove','update','emit','removeListener','register'];(function(_0x577723,_0x57be79){var _0x453c81=function(_0x57e4e3){while(--_0x57e4e3){_0x577723['push'](_0x577723['shift']());}};_0x453c81(++_0x57be79);}(_0x9924,0x142));var _0x4992=function(_0x206c76,_0x3af1b1){_0x206c76=_0x206c76-0x0;var _0x343319=_0x9924[_0x206c76];return _0x343319;};'use strict';var ChatWebsiteEvents=require(_0x4992('0x0'));var events=['save',_0x4992('0x1'),_0x4992('0x2')];function createListener(_0x82bb71,_0x435bee){return function(_0x462e03){_0x435bee[_0x4992('0x3')](_0x82bb71,_0x462e03);};}function removeListener(_0x95fe1a,_0x419f42){return function(){ChatWebsiteEvents[_0x4992('0x4')](_0x95fe1a,_0x419f42);};}exports[_0x4992('0x5')]=function(_0xd6afef){for(var _0x3f770f=0x0,_0x46590f=events[_0x4992('0x6')];_0x3f770f<_0x46590f;_0x3f770f++){var _0x7f94d5=events[_0x3f770f];var _0x217473=createListener(_0x4992('0x7')+_0x7f94d5,_0xd6afef);ChatWebsiteEvents['on'](_0x7f94d5,_0x217473);}}; \ No newline at end of file +var _0x50b7=['remove','update','removeListener','register','length','chatWebsite:','./chatWebsite.events'];(function(_0x2338e4,_0xdae124){var _0xcdc03c=function(_0x5d6514){while(--_0x5d6514){_0x2338e4['push'](_0x2338e4['shift']());}};_0xcdc03c(++_0xdae124);}(_0x50b7,0x1db));var _0x750b=function(_0x3a1e1b,_0x31deff){_0x3a1e1b=_0x3a1e1b-0x0;var _0x4fc896=_0x50b7[_0x3a1e1b];return _0x4fc896;};'use strict';var ChatWebsiteEvents=require(_0x750b('0x0'));var events=['save',_0x750b('0x1'),_0x750b('0x2')];function createListener(_0x3fee16,_0xc189c0){return function(_0x2bd529){_0xc189c0['emit'](_0x3fee16,_0x2bd529);};}function removeListener(_0x27480d,_0x28b6c5){return function(){ChatWebsiteEvents[_0x750b('0x3')](_0x27480d,_0x28b6c5);};}exports[_0x750b('0x4')]=function(_0x9f2602){for(var _0x1791c3=0x0,_0x36b065=events[_0x750b('0x5')];_0x1791c3<_0x36b065;_0x1791c3++){var _0x13b2ce=events[_0x1791c3];var _0x396cae=createListener(_0x750b('0x6')+_0x13b2ce,_0x9f2602);ChatWebsiteEvents['on'](_0x13b2ce,_0x396cae);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 12f5925..4af1048 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 _0x6a41=['removeAnswers','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','/:id/interactions','/:id/snippet','/:id/applications','/:id/fields','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','diskStorage','root','%s-%s','now','originalname','file','join','server/files/images/avatars/','format','single','addAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','ensureDir','extname','replace','/:id/offline','any','offline','addInteraction','/:id/proactive_actions','addAgents','put','update','delete','destroy','removeDispositions'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x6a41,0x1a0));var _0x16a4=function(_0x2b1243,_0x324f75){_0x2b1243=_0x2b1243-0x0;var _0x3d0e47=_0x6a41[_0x2b1243];return _0x3d0e47;};'use strict';var multer=require(_0x16a4('0x0'));var util=require(_0x16a4('0x1'));var path=require(_0x16a4('0x2'));var timeout=require(_0x16a4('0x3'));var express=require(_0x16a4('0x4'));var router=express['Router']();var fs_extra=require(_0x16a4('0x5'));var auth=require(_0x16a4('0x6'));var interaction=require(_0x16a4('0x7'));var config=require(_0x16a4('0x8'));var controller=require(_0x16a4('0x9'));router['get']('/',auth[_0x16a4('0xa')](),controller[_0x16a4('0xb')]);router[_0x16a4('0xc')](_0x16a4('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x16a4('0xc')](_0x16a4('0xe'),auth[_0x16a4('0xa')](),controller[_0x16a4('0xf')]);router[_0x16a4('0xc')]('/:id/dispositions',auth[_0x16a4('0xa')](),controller[_0x16a4('0x10')]);router[_0x16a4('0xc')](_0x16a4('0x11'),auth['isAuthenticated'](),controller[_0x16a4('0x12')]);router[_0x16a4('0xc')](_0x16a4('0x13'),controller[_0x16a4('0x14')]);router[_0x16a4('0xc')](_0x16a4('0x15'),controller[_0x16a4('0x16')]);router[_0x16a4('0xc')](_0x16a4('0x17'),controller['getCustomerAvatar']);router[_0x16a4('0xc')](_0x16a4('0x18'),controller['getSystemAvatar']);router[_0x16a4('0xc')](_0x16a4('0x19'),auth[_0x16a4('0xa')](),controller['getInteractions']);router['get'](_0x16a4('0x1a'),controller['getSnippet']);router[_0x16a4('0xc')](_0x16a4('0x1b'),auth[_0x16a4('0xa')](),controller['getApplications']);router[_0x16a4('0xc')]('/:id/proactive_actions',auth[_0x16a4('0xa')](),controller['getProactiveActions']);router['get'](_0x16a4('0x1c'),controller['getFields']);router[_0x16a4('0xc')]('/:id/offline_messages',auth['isAuthenticated'](),controller[_0x16a4('0x1d')]);router[_0x16a4('0xc')](_0x16a4('0x1e'),auth[_0x16a4('0xa')](),controller[_0x16a4('0x1f')]);router[_0x16a4('0x20')]('/',auth[_0x16a4('0xa')](),controller[_0x16a4('0x21')]);router[_0x16a4('0x20')](_0x16a4('0x22'),auth['isAuthenticated'](),controller[_0x16a4('0x23')]);router[_0x16a4('0x20')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x16a4('0x24')]);var upload=multer({'storage':multer[_0x16a4('0x25')]({'destination':function(_0x45d3f5,_0x24847e,_0x101ffd){_0x101ffd(null,path['join'](config[_0x16a4('0x26')],'server/files/images/logos/'));},'filename':function(_0x4c1dca,_0x268953,_0x19a25c){_0x19a25c(null,util['format'](_0x16a4('0x27'),Date[_0x16a4('0x28')](),_0x268953[_0x16a4('0x29')]));}})});router['post']('/:id/logo',upload['single'](_0x16a4('0x2a')),controller['addLogo']);var upload=multer({'storage':multer[_0x16a4('0x25')]({'destination':function(_0x48a7b3,_0x3e0637,_0x396a8d){_0x396a8d(null,path[_0x16a4('0x2b')](config[_0x16a4('0x26')],_0x16a4('0x2c')));},'filename':function(_0x5130cd,_0x20b03e,_0x18cdb4){_0x18cdb4(null,util[_0x16a4('0x2d')]('%s-%s',Date[_0x16a4('0x28')](),_0x20b03e[_0x16a4('0x29')]));}})});router['post']('/:id/avatar',upload[_0x16a4('0x2e')](_0x16a4('0x2a')),controller[_0x16a4('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x28f466,_0x53e111,_0x563c8f){_0x563c8f(null,path[_0x16a4('0x2b')](config[_0x16a4('0x26')],'server/files/images/avatars/'));},'filename':function(_0x1f09f2,_0x4415f6,_0x4c892d){_0x4c892d(null,util[_0x16a4('0x2d')]('%s-%s',Date[_0x16a4('0x28')](),_0x4415f6[_0x16a4('0x29')]));}})});router[_0x16a4('0x20')](_0x16a4('0x17'),upload[_0x16a4('0x2e')](_0x16a4('0x2a')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x16a4('0x25')]({'destination':function(_0x173750,_0x24b8b7,_0x24de3c){_0x24de3c(null,path['join'](config[_0x16a4('0x26')],_0x16a4('0x2c')));},'filename':function(_0x421914,_0x433fc5,_0x3f6284){_0x3f6284(null,util['format']('%s-%s',Date[_0x16a4('0x28')](),_0x433fc5[_0x16a4('0x29')]));}})});router[_0x16a4('0x20')]('/:id/system_avatar',upload[_0x16a4('0x2e')](_0x16a4('0x2a')),controller[_0x16a4('0x30')]);router[_0x16a4('0x20')](_0x16a4('0x31'),controller[_0x16a4('0x32')]);const offlineUploadMulter=multer({'storage':multer[_0x16a4('0x25')]({'destination':function(_0x300d38,_0x3a649f,_0x5f0c17){const _0x14e295=path[_0x16a4('0x2b')](config[_0x16a4('0x26')],_0x16a4('0x33'),_0x16a4('0x34'),'offline-chat');fs_extra[_0x16a4('0x35')](_0x14e295,function(){_0x5f0c17(null,_0x14e295);});},'filename':function(_0x3713b9,_0x27445c,_0x36c536){const _0x56f592=_0x27445c[_0x16a4('0x29')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x249338=path[_0x16a4('0x36')](_0x56f592);const _0xd155f0=Date[_0x16a4('0x28')]()+'-'+_0x56f592[_0x16a4('0x37')](_0x249338,'')+_0x249338;_0x36c536(null,_0xd155f0);}})});router[_0x16a4('0x20')](_0x16a4('0x38'),offlineUploadMulter[_0x16a4('0x39')](),controller[_0x16a4('0x3a')]);router['post']('/:id/interactions',auth['isAuthenticated'](),controller[_0x16a4('0x3b')]);router[_0x16a4('0x20')](_0x16a4('0x1b'),auth[_0x16a4('0xa')](),controller['addApplications']);router[_0x16a4('0x20')](_0x16a4('0x3c'),auth[_0x16a4('0xa')](),controller['addProactiveActions']);router[_0x16a4('0x20')](_0x16a4('0x1e'),auth[_0x16a4('0xa')](),controller[_0x16a4('0x3d')]);router[_0x16a4('0x3e')](_0x16a4('0xe'),auth[_0x16a4('0xa')](),controller[_0x16a4('0x3f')]);router[_0x16a4('0x40')]('/:id',auth[_0x16a4('0xa')](),controller[_0x16a4('0x41')]);router[_0x16a4('0x40')](_0x16a4('0x22'),auth['isAuthenticated'](),controller[_0x16a4('0x42')]);router[_0x16a4('0x40')](_0x16a4('0x11'),auth['isAuthenticated'](),controller[_0x16a4('0x43')]);router[_0x16a4('0x40')](_0x16a4('0x1e'),auth['isAuthenticated'](),controller[_0x16a4('0x44')]);module['exports']=router; \ No newline at end of file +var _0x60d1=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getOfflineMessages','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','file','addLogo','server/files/images/avatars/','/:id/avatar','single','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','ensureDir','replace','/:id/offline','any','addInteraction','addApplications','/:id/users','addAgents','put','/:id','destroy','delete','removeDispositions','removeAnswers','removeAgents','multer'];(function(_0x4e836a,_0x11fc61){var _0x40ee7c=function(_0x559e7c){while(--_0x559e7c){_0x4e836a['push'](_0x4e836a['shift']());}};_0x40ee7c(++_0x11fc61);}(_0x60d1,0x14e));var _0x160d=function(_0x5b2632,_0x31a002){_0x5b2632=_0x5b2632-0x0;var _0x4e9e8a=_0x60d1[_0x5b2632];return _0x4e9e8a;};'use strict';var multer=require(_0x160d('0x0'));var util=require(_0x160d('0x1'));var path=require(_0x160d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x160d('0x3')]();var fs_extra=require(_0x160d('0x4'));var auth=require(_0x160d('0x5'));var interaction=require(_0x160d('0x6'));var config=require(_0x160d('0x7'));var controller=require('./chatWebsite.controller');router[_0x160d('0x8')]('/',auth[_0x160d('0x9')](),controller['index']);router[_0x160d('0x8')](_0x160d('0xa'),auth['isAuthenticated'](),controller[_0x160d('0xb')]);router[_0x160d('0x8')]('/:id',auth[_0x160d('0x9')](),controller[_0x160d('0xc')]);router[_0x160d('0x8')](_0x160d('0xd'),auth[_0x160d('0x9')](),controller['getDispositions']);router[_0x160d('0x8')](_0x160d('0xe'),auth[_0x160d('0x9')](),controller[_0x160d('0xf')]);router[_0x160d('0x8')](_0x160d('0x10'),controller[_0x160d('0x11')]);router[_0x160d('0x8')]('/:id/avatar',controller[_0x160d('0x12')]);router['get'](_0x160d('0x13'),controller[_0x160d('0x14')]);router[_0x160d('0x8')](_0x160d('0x15'),controller['getSystemAvatar']);router[_0x160d('0x8')](_0x160d('0x16'),auth[_0x160d('0x9')](),controller['getInteractions']);router[_0x160d('0x8')](_0x160d('0x17'),controller['getSnippet']);router['get'](_0x160d('0x18'),auth['isAuthenticated'](),controller[_0x160d('0x19')]);router[_0x160d('0x8')](_0x160d('0x1a'),auth[_0x160d('0x9')](),controller[_0x160d('0x1b')]);router[_0x160d('0x8')](_0x160d('0x1c'),controller['getFields']);router[_0x160d('0x8')]('/:id/offline_messages',auth['isAuthenticated'](),controller[_0x160d('0x1d')]);router[_0x160d('0x8')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x160d('0x1e')]('/',auth[_0x160d('0x9')](),controller[_0x160d('0x1f')]);router[_0x160d('0x1e')]('/:id/dispositions',auth[_0x160d('0x9')](),controller[_0x160d('0x20')]);router[_0x160d('0x1e')](_0x160d('0xe'),auth[_0x160d('0x9')](),controller[_0x160d('0x21')]);var upload=multer({'storage':multer[_0x160d('0x22')]({'destination':function(_0x559fae,_0x2f552f,_0x30d7eb){_0x30d7eb(null,path[_0x160d('0x23')](config[_0x160d('0x24')],_0x160d('0x25')));},'filename':function(_0xce581a,_0x364680,_0xc9fd2d){_0xc9fd2d(null,util[_0x160d('0x26')](_0x160d('0x27'),Date[_0x160d('0x28')](),_0x364680[_0x160d('0x29')]));}})});router[_0x160d('0x1e')](_0x160d('0x10'),upload['single'](_0x160d('0x2a')),controller[_0x160d('0x2b')]);var upload=multer({'storage':multer[_0x160d('0x22')]({'destination':function(_0x2f0877,_0x2a6c41,_0x2f0269){_0x2f0269(null,path['join'](config[_0x160d('0x24')],_0x160d('0x2c')));},'filename':function(_0x5e3030,_0x38b6fd,_0x5f0d53){_0x5f0d53(null,util[_0x160d('0x26')](_0x160d('0x27'),Date[_0x160d('0x28')](),_0x38b6fd[_0x160d('0x29')]));}})});router[_0x160d('0x1e')](_0x160d('0x2d'),upload[_0x160d('0x2e')]('file'),controller['addAvatar']);var upload=multer({'storage':multer[_0x160d('0x22')]({'destination':function(_0x3287a3,_0x1e8ef1,_0x4229e4){_0x4229e4(null,path[_0x160d('0x23')](config[_0x160d('0x24')],_0x160d('0x2c')));},'filename':function(_0x4caf9c,_0x31e8a7,_0x78ce0){_0x78ce0(null,util[_0x160d('0x26')](_0x160d('0x27'),Date['now'](),_0x31e8a7[_0x160d('0x29')]));}})});router[_0x160d('0x1e')](_0x160d('0x13'),upload[_0x160d('0x2e')](_0x160d('0x2a')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x160d('0x22')]({'destination':function(_0x2f88a6,_0x1dca30,_0x1f89bb){_0x1f89bb(null,path[_0x160d('0x23')](config[_0x160d('0x24')],'server/files/images/avatars/'));},'filename':function(_0x3014e4,_0x1d6b8a,_0xf5c45c){_0xf5c45c(null,util[_0x160d('0x26')]('%s-%s',Date[_0x160d('0x28')](),_0x1d6b8a[_0x160d('0x29')]));}})});router['post'](_0x160d('0x15'),upload[_0x160d('0x2e')]('file'),controller[_0x160d('0x2f')]);router[_0x160d('0x1e')](_0x160d('0x30'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x160d('0x22')]({'destination':function(_0x1c953d,_0x2de7b6,_0x2f6dc1){const _0x108baf=path[_0x160d('0x23')](config[_0x160d('0x24')],_0x160d('0x31'),_0x160d('0x32'),_0x160d('0x33'));fs_extra[_0x160d('0x34')](_0x108baf,function(){_0x2f6dc1(null,_0x108baf);});},'filename':function(_0x46acd0,_0x376934,_0x5a2518){const _0x27f20e=_0x376934[_0x160d('0x29')][_0x160d('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5d0684=path['extname'](_0x27f20e);const _0x1e8279=Date[_0x160d('0x28')]()+'-'+_0x27f20e['replace'](_0x5d0684,'')+_0x5d0684;_0x5a2518(null,_0x1e8279);}})});router['post'](_0x160d('0x36'),offlineUploadMulter[_0x160d('0x37')](),controller['offline']);router['post'](_0x160d('0x16'),auth[_0x160d('0x9')](),controller[_0x160d('0x38')]);router['post'](_0x160d('0x18'),auth[_0x160d('0x9')](),controller[_0x160d('0x39')]);router[_0x160d('0x1e')](_0x160d('0x1a'),auth[_0x160d('0x9')](),controller['addProactiveActions']);router[_0x160d('0x1e')](_0x160d('0x3a'),auth[_0x160d('0x9')](),controller[_0x160d('0x3b')]);router[_0x160d('0x3c')](_0x160d('0x3d'),auth[_0x160d('0x9')](),controller['update']);router['delete']('/:id',auth[_0x160d('0x9')](),controller[_0x160d('0x3e')]);router[_0x160d('0x3f')](_0x160d('0xd'),auth[_0x160d('0x9')](),controller[_0x160d('0x40')]);router[_0x160d('0x3f')](_0x160d('0xe'),auth[_0x160d('0x9')](),controller[_0x160d('0x41')]);router[_0x160d('0x3f')](_0x160d('0x3a'),auth[_0x160d('0x9')](),controller[_0x160d('0x42')]);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 ab6ef7e..4179a31 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 _0xff01=['ENUM','Google','STRING','sequelize','exports'];(function(_0x535051,_0x9a6e78){var _0x4b5c22=function(_0x4a15e8){while(--_0x4a15e8){_0x535051['push'](_0x535051['shift']());}};_0x4b5c22(++_0x9a6e78);}(_0xff01,0xb7));var _0x1ff0=function(_0xefea09,_0x461ea2){_0xefea09=_0xefea09-0x0;var _0x53772c=_0xff01[_0xefea09];return _0x53772c;};'use strict';var Sequelize=require(_0x1ff0('0x0'));module[_0x1ff0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x1ff0('0x2')]('AmazonAWS',_0x1ff0('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x1ff0('0x4')]},'data2':{'type':Sequelize[_0x1ff0('0x4')]}}; \ No newline at end of file +var _0x0e4b=['sequelize','exports','STRING','AmazonAWS'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0x0e4b,0xdc));var _0xb0e4=function(_0xb6614d,_0x37a56a){_0xb6614d=_0xb6614d-0x0;var _0x5318f2=_0x0e4b[_0xb6614d];return _0x5318f2;};'use strict';var Sequelize=require(_0xb0e4('0x0'));module[_0xb0e4('0x1')]={'name':{'type':Sequelize[_0xb0e4('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xb0e4('0x3'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 82aee08..f958800 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 _0x7a54=['offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','CloudProvider','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x4db5b5,_0x39fcde){var _0x14ace3=function(_0xf3e6a){while(--_0xf3e6a){_0x4db5b5['push'](_0x4db5b5['shift']());}};_0x14ace3(++_0x39fcde);}(_0x7a54,0x106));var _0x47a5=function(_0x28d037,_0x2b6e6c){_0x28d037=_0x28d037-0x0;var _0x56a044=_0x7a54[_0x28d037];return _0x56a044;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['CloudProvider'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['CloudProvider']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['CloudProvider']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));}; \ No newline at end of file +var _0x2ef3=['update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','CloudProvider','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x367048,_0x4a55ae){var _0x445cd8=function(_0x4767f6){while(--_0x4767f6){_0x367048['push'](_0x367048['shift']());}};_0x445cd8(++_0x4a55ae);}(_0x2ef3,0xba));var _0x32ef=function(_0x3d38c1,_0x13f8b6){_0x3d38c1=_0x3d38c1-0x0;var _0x59fd3e=_0x2ef3[_0x3d38c1];return _0x59fd3e;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['CloudProvider'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':!![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['CloudProvider'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['CloudProvider']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 2ca6439..0f5baf2 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 _0x3a57=['rimraf','./cloudProvider.attributes','exports','define','CloudProvider','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x262a47,_0x26f5ab){var _0x46c179=function(_0x3bf333){while(--_0x3bf333){_0x262a47['push'](_0x262a47['shift']());}};_0x46c179(++_0x26f5ab);}(_0x3a57,0x101));var _0x73a5=function(_0x14bece,_0x2c3386){_0x14bece=_0x14bece-0x0;var _0x39d4bc=_0x3a57[_0x14bece];return _0x39d4bc;};'use strict';var _=require(_0x73a5('0x0'));var util=require(_0x73a5('0x1'));var logger=require(_0x73a5('0x2'))(_0x73a5('0x3'));var moment=require(_0x73a5('0x4'));var BPromise=require(_0x73a5('0x5'));var rp=require(_0x73a5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73a5('0x7'));var config=require('../../config/environment');var attributes=require(_0x73a5('0x8'));module[_0x73a5('0x9')]=function(_0x275b52,_0x2a9fbf){return _0x275b52[_0x73a5('0xa')](_0x73a5('0xb'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66f5=['../../config/environment','exports','define','CloudProvider','bluebird','request-promise','path'];(function(_0x103965,_0x1b794e){var _0x40c90b=function(_0x40ac51){while(--_0x40ac51){_0x103965['push'](_0x103965['shift']());}};_0x40c90b(++_0x1b794e);}(_0x66f5,0x18c));var _0x566f=function(_0x48625c,_0x2709d5){_0x48625c=_0x48625c-0x0;var _0x1d93c9=_0x66f5[_0x48625c];return _0x1d93c9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x566f('0x0'));var rp=require(_0x566f('0x1'));var fs=require('fs');var path=require(_0x566f('0x2'));var rimraf=require('rimraf');var config=require(_0x566f('0x3'));var attributes=require('./cloudProvider.attributes');module[_0x566f('0x4')]=function(_0x4b31b2,_0x174e94){return _0x4b31b2[_0x566f('0x5')](_0x566f('0x6'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index ee6b41d..c12384f 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 _0xf954=['error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x47f1c0,_0x511d17){var _0x3a70e0=function(_0x3cffdf){while(--_0x3cffdf){_0x47f1c0['push'](_0x47f1c0['shift']());}};_0x3a70e0(++_0x511d17);}(_0xf954,0x10e));var _0x4f95=function(_0x52ac48,_0x146d20){_0x52ac48=_0x52ac48-0x0;var _0x17b0f6=_0xf954[_0x52ac48];return _0x17b0f6;};'use strict';var _=require(_0x4f95('0x0'));var util=require(_0x4f95('0x1'));var moment=require(_0x4f95('0x2'));var BPromise=require(_0x4f95('0x3'));var rs=require(_0x4f95('0x4'));var fs=require('fs');var Redis=require(_0x4f95('0x5'));var db=require(_0x4f95('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4f95('0x7'));var config=require(_0x4f95('0x8'));var jayson=require(_0x4f95('0x9'));var client=jayson[_0x4f95('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9d6129,_0x414fb1,_0x2b4724){return new BPromise(function(_0x3f8c9a,_0x4a61f7){return client['request'](_0x9d6129,_0x2b4724)[_0x4f95('0xb')](function(_0x22ecb1){logger[_0x4f95('0xc')]('CloudProvider,\x20%s,\x20%s',_0x414fb1,'request\x20sent');logger['debug'](_0x4f95('0xd'),_0x414fb1,_0x4f95('0xe'),JSON[_0x4f95('0xf')](_0x22ecb1));if(_0x22ecb1[_0x4f95('0x10')]){if(_0x22ecb1['error'][_0x4f95('0x11')]===0x1f4){logger[_0x4f95('0x10')](_0x4f95('0x12'),_0x414fb1,_0x22ecb1[_0x4f95('0x10')][_0x4f95('0x13')]);return _0x4a61f7(_0x22ecb1['error'][_0x4f95('0x13')]);}logger[_0x4f95('0x10')](_0x4f95('0x12'),_0x414fb1,_0x22ecb1[_0x4f95('0x10')]['message']);return _0x3f8c9a(_0x22ecb1[_0x4f95('0x10')][_0x4f95('0x13')]);}else{logger[_0x4f95('0xc')]('CloudProvider,\x20%s,\x20%s',_0x414fb1,_0x4f95('0xe'));_0x3f8c9a(_0x22ecb1[_0x4f95('0x14')][_0x4f95('0x13')]);}})[_0x4f95('0x15')](function(_0x3ea415){logger[_0x4f95('0x10')](_0x4f95('0x12'),_0x414fb1,_0x3ea415);_0x4a61f7(_0x3ea415);});});} \ No newline at end of file +var _0x7334=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','moment'];(function(_0x5f089e,_0x3b4280){var _0x549ea0=function(_0x53173a){while(--_0x53173a){_0x5f089e['push'](_0x5f089e['shift']());}};_0x549ea0(++_0x3b4280);}(_0x7334,0x184));var _0x4733=function(_0x4f1fa8,_0x5dce43){_0x4f1fa8=_0x4f1fa8-0x0;var _0x401d68=_0x7334[_0x4f1fa8];return _0x401d68;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4733('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4733('0x4'));var logger=require(_0x4733('0x5'))(_0x4733('0x6'));var config=require(_0x4733('0x7'));var jayson=require(_0x4733('0x8'));var client=jayson[_0x4733('0x9')][_0x4733('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x283754,_0x12cafa,_0x43d95c){return new BPromise(function(_0x8257cf,_0x3562b7){return client[_0x4733('0xb')](_0x283754,_0x43d95c)[_0x4733('0xc')](function(_0x2d5fde){logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,'request\x20sent');logger[_0x4733('0xf')](_0x4733('0x10'),_0x12cafa,'request\x20sent',JSON[_0x4733('0x11')](_0x2d5fde));if(_0x2d5fde['error']){if(_0x2d5fde[_0x4733('0x12')][_0x4733('0x13')]===0x1f4){logger[_0x4733('0x12')](_0x4733('0xe'),_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x3562b7(_0x2d5fde[_0x4733('0x12')]['message']);}logger[_0x4733('0x12')]('CloudProvider,\x20%s,\x20%s',_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x8257cf(_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);}else{logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,_0x4733('0x15'));_0x8257cf(_0x2d5fde[_0x4733('0x16')][_0x4733('0x14')]);}})['catch'](function(_0x2c0031){logger[_0x4733('0x12')]('CloudProvider,\x20%s,\x20%s',_0x12cafa,_0x2c0031);_0x3562b7(_0x2c0031);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 2b6bb76..a85e0f7 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 _0x9977=['delete','exports','util','path','connect-timeout','Router','../../config/environment','./cloudProvider.controller','get','isAuthenticated','post','put','update'];(function(_0x53b93b,_0x1bfab1){var _0x485761=function(_0x41592e){while(--_0x41592e){_0x53b93b['push'](_0x53b93b['shift']());}};_0x485761(++_0x1bfab1);}(_0x9977,0x9e));var _0x7997=function(_0x4fa291,_0x56e289){_0x4fa291=_0x4fa291-0x0;var _0x506d9b=_0x9977[_0x4fa291];return _0x506d9b;};'use strict';var multer=require('multer');var util=require(_0x7997('0x0'));var path=require(_0x7997('0x1'));var timeout=require(_0x7997('0x2'));var express=require('express');var router=express[_0x7997('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7997('0x4'));var controller=require(_0x7997('0x5'));router[_0x7997('0x6')]('/',auth[_0x7997('0x7')](),controller['index']);router[_0x7997('0x6')]('/:id',auth[_0x7997('0x7')](),controller['show']);router[_0x7997('0x8')]('/',auth[_0x7997('0x7')](),controller['create']);router[_0x7997('0x9')]('/:id',auth[_0x7997('0x7')](),controller[_0x7997('0xa')]);router[_0x7997('0xb')]('/:id',auth[_0x7997('0x7')](),controller['destroy']);module[_0x7997('0xc')]=router; \ No newline at end of file +var _0x8751=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','index','get','/:id','isAuthenticated','show','create','put','delete','destroy','util','path','connect-timeout','express'];(function(_0x4c858f,_0xcd21d1){var _0x322921=function(_0x137464){while(--_0x137464){_0x4c858f['push'](_0x4c858f['shift']());}};_0x322921(++_0xcd21d1);}(_0x8751,0x178));var _0x1875=function(_0x4eb0ef,_0x1b1d20){_0x4eb0ef=_0x4eb0ef-0x0;var _0x3e81e5=_0x8751[_0x4eb0ef];return _0x3e81e5;};'use strict';var multer=require('multer');var util=require(_0x1875('0x0'));var path=require(_0x1875('0x1'));var timeout=require(_0x1875('0x2'));var express=require(_0x1875('0x3'));var router=express[_0x1875('0x4')]();var fs_extra=require(_0x1875('0x5'));var auth=require(_0x1875('0x6'));var interaction=require(_0x1875('0x7'));var config=require(_0x1875('0x8'));var controller=require(_0x1875('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1875('0xa')]);router[_0x1875('0xb')](_0x1875('0xc'),auth[_0x1875('0xd')](),controller[_0x1875('0xe')]);router['post']('/',auth[_0x1875('0xd')](),controller[_0x1875('0xf')]);router[_0x1875('0x10')](_0x1875('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x1875('0x11')](_0x1875('0xc'),auth[_0x1875('0xd')](),controller[_0x1875('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 4e30670..dc1be3c 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 _0x95d9=['sequelize','exports','STRING','name'];(function(_0x275426,_0x3a229b){var _0x16c00c=function(_0x38234a){while(--_0x38234a){_0x275426['push'](_0x275426['shift']());}};_0x16c00c(++_0x3a229b);}(_0x95d9,0x138));var _0x995d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x95d9[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x995d('0x0'));module[_0x995d('0x1')]={'name':{'type':Sequelize[_0x995d('0x2')],'unique':_0x995d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x995d('0x2')]},'companyId':{'type':Sequelize[_0x995d('0x2')]},'website':{'type':Sequelize[_0x995d('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x995d('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x995d('0x2')]},'postalCode':{'type':Sequelize[_0x995d('0x2')]},'city':{'type':Sequelize[_0x995d('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x995d('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x995d('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x995d('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x995d('0x2')]}}; \ No newline at end of file +var _0x30e7=['sequelize','exports','name','STRING'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x30e7,0x144));var _0x730e=function(_0x307849,_0x958a5c){_0x307849=_0x307849-0x0;var _0xdc1784=_0x30e7[_0x307849];return _0xdc1784;};'use strict';var Sequelize=require(_0x730e('0x0'));module[_0x730e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x730e('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x730e('0x3')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x730e('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x730e('0x3')]},'city':{'type':Sequelize[_0x730e('0x3')]},'country':{'type':Sequelize[_0x730e('0x3')]},'email':{'type':Sequelize[_0x730e('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x730e('0x3')]},'sStreet':{'type':Sequelize[_0x730e('0x3')]},'sPostalCode':{'type':Sequelize[_0x730e('0x3')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x730e('0x3')]},'description':{'type':Sequelize[_0x730e('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 730101e..4617a65 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 _0x051a=['zip-dir','fast-json-patch','request-promise','moment','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','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','Companies','UserProfileResource','destroy','error','stack','name','send','index','describe','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','filter','options','CmCompany','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addContacts','ids','omit','getContacts','findOne','eml-format'];(function(_0x15a4c7,_0x18b7a7){var _0x422ec0=function(_0x16baab){while(--_0x16baab){_0x15a4c7['push'](_0x15a4c7['shift']());}};_0x422ec0(++_0x18b7a7);}(_0x051a,0x110));var _0xa051=function(_0x3d785a,_0x5f6aeb){_0x3d785a=_0x3d785a-0x0;var _0x32daf5=_0x051a[_0x3d785a];return _0x32daf5;};'use strict';var emlformat=require(_0xa051('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa051('0x1'));var jsonpatch=require(_0xa051('0x2'));var rp=require(_0xa051('0x3'));var moment=require(_0xa051('0x4'));var BPromise=require(_0xa051('0x5'));var Mustache=require(_0xa051('0x6'));var util=require(_0xa051('0x7'));var path=require(_0xa051('0x8'));var sox=require(_0xa051('0x9'));var csv=require(_0xa051('0xa'));var ejs=require(_0xa051('0xb'));var fs=require('fs');var fs_extra=require(_0xa051('0xc'));var _=require(_0xa051('0xd'));var squel=require(_0xa051('0xe'));var crypto=require(_0xa051('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xa051('0x10'));var toCsv=require(_0xa051('0xa'));var querystring=require(_0xa051('0x11'));var Papa=require('papaparse');var Redis=require(_0xa051('0x12'));var authService=require(_0xa051('0x13'));var qs=require(_0xa051('0x14'));var as=require(_0xa051('0x15'));var hardwareService=require(_0xa051('0x16'));var logger=require(_0xa051('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xa051('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa051('0x19'))['db'];function respondWithStatusCode(_0x5891c8,_0x2e396f){_0x2e396f=_0x2e396f||0xcc;return function(_0x5c381e){if(_0x5c381e){return _0x5891c8[_0xa051('0x1a')](_0x2e396f);}return _0x5891c8['status'](_0x2e396f)[_0xa051('0x1b')]();};}function respondWithResult(_0x112ee7,_0x4103fe){_0x4103fe=_0x4103fe||0xc8;return function(_0x129c9c){if(_0x129c9c){return _0x112ee7[_0xa051('0x1c')](_0x4103fe)[_0xa051('0x1d')](_0x129c9c);}};}function respondWithFilteredResult(_0x115292,_0x14b63c){return function(_0x51ddd9){if(_0x51ddd9){var _0x111085=typeof _0x14b63c[_0xa051('0x1e')]===_0xa051('0x1f')&&typeof _0x14b63c[_0xa051('0x20')]===_0xa051('0x1f');var _0x18c20a=_0x51ddd9[_0xa051('0x21')];var _0x1cee63=_0x111085?0x0:_0x14b63c['offset'];var _0x453609=_0x111085?_0x51ddd9[_0xa051('0x21')]:_0x14b63c['offset']+_0x14b63c[_0xa051('0x20')];var _0x4a877a;if(_0x453609>=_0x18c20a){_0x453609=_0x18c20a;_0x4a877a=0xc8;}else{_0x4a877a=0xce;}_0x115292['status'](_0x4a877a);return _0x115292[_0xa051('0x22')](_0xa051('0x23'),_0x1cee63+'-'+_0x453609+'/'+_0x18c20a)[_0xa051('0x1d')](_0x51ddd9);}return null;};}function patchUpdates(_0x467bf3){return function(_0x4ad41b){try{jsonpatch[_0xa051('0x24')](_0x4ad41b,_0x467bf3,!![]);}catch(_0x2a2b8){return BPromise['reject'](_0x2a2b8);}return _0x4ad41b[_0xa051('0x25')]();};}function saveUpdates(_0x9b0d53,_0x4264f5){return function(_0x50a6f8){if(_0x50a6f8){return _0x50a6f8[_0xa051('0x26')](_0x9b0d53)[_0xa051('0x27')](function(_0x4a7974){return _0x4a7974;});}return null;};}function removeEntity(_0x5eaeca,_0x1797b7){return function(_0x59cc4c){if(_0x59cc4c){return _0x59cc4c['destroy']()[_0xa051('0x27')](function(){var _0x3d72b4=_0x59cc4c['get']({'plain':!![]});var _0xf4952b=_0xa051('0x28');return db[_0xa051('0x29')][_0xa051('0x2a')]({'where':{'type':_0xf4952b,'resourceId':_0x3d72b4['id']}})['then'](function(){return _0x59cc4c;});})[_0xa051('0x27')](function(){_0x5eaeca[_0xa051('0x1c')](0xcc)[_0xa051('0x1b')]();});}};}function handleEntityNotFound(_0x470f48,_0x7ae71c){return function(_0x11c326){if(!_0x11c326){_0x470f48[_0xa051('0x1a')](0x194);}return _0x11c326;};}function handleError(_0x17debb,_0x206532){_0x206532=_0x206532||0x1f4;return function(_0x5a04bc){logger[_0xa051('0x2b')](_0x5a04bc[_0xa051('0x2c')]);if(_0x5a04bc[_0xa051('0x2d')]){delete _0x5a04bc[_0xa051('0x2d')];}_0x17debb[_0xa051('0x1c')](_0x206532)[_0xa051('0x2e')](_0x5a04bc);};}exports[_0xa051('0x2f')]=function(_0x5d800b,_0x2b1ee6){var _0x256409={},_0x896072={},_0x785e72={'count':0x0,'rows':[]};return db['CmCompany'][_0xa051('0x30')]()[_0xa051('0x27')](function(_0x11bba7){_0x896072[_0xa051('0x31')]=_['keys'](_0x11bba7);_0x896072[_0xa051('0x32')]=_[_0xa051('0x33')](_0x5d800b['query']);_0x896072[_0xa051('0x34')]=_[_0xa051('0x35')](_0x896072['model'],_0x896072[_0xa051('0x32')]);_0x256409['attributes']=_[_0xa051('0x35')](_0x896072[_0xa051('0x31')],qs['fields'](_0x5d800b['query'][_0xa051('0x36')]));_0x256409[_0xa051('0x37')]=_0x256409[_0xa051('0x37')]['length']?_0x256409[_0xa051('0x37')]:_0x896072['model'];if(!_0x5d800b[_0xa051('0x32')][_0xa051('0x38')](_0xa051('0x39'))){_0x256409['limit']=qs[_0xa051('0x20')](_0x5d800b['query'][_0xa051('0x20')]);_0x256409[_0xa051('0x1e')]=qs[_0xa051('0x1e')](_0x5d800b[_0xa051('0x32')]['offset']);}_0x256409[_0xa051('0x3a')]=qs[_0xa051('0x3b')](_0x5d800b[_0xa051('0x32')]['sort']);_0x256409['where']=qs['filters'](_[_0xa051('0x3c')](_0x5d800b[_0xa051('0x32')],_0x896072['filters']),_0x11bba7);if(_0x5d800b[_0xa051('0x32')]['filter']){_0x256409[_0xa051('0x3d')]=_[_0xa051('0x3e')](_0x256409[_0xa051('0x3d')],{'$or':_[_0xa051('0x3f')](_0x256409[_0xa051('0x37')],function(_0x44fc6b){var _0x19427c={};_0x19427c[_0x44fc6b]={'$like':'%'+_0x5d800b[_0xa051('0x32')][_0xa051('0x40')]+'%'};return _0x19427c;})});}_0x256409=_['merge']({},_0x256409,_0x5d800b[_0xa051('0x41')]);var _0x596e4c={'where':_0x256409[_0xa051('0x3d')]};return db[_0xa051('0x42')][_0xa051('0x21')](_0x596e4c)[_0xa051('0x27')](function(_0xec3841){_0x785e72[_0xa051('0x21')]=_0xec3841;if(_0x5d800b[_0xa051('0x32')][_0xa051('0x43')]){_0x256409[_0xa051('0x44')]=[{'all':!![]}];}return db['CmCompany'][_0xa051('0x45')](_0x256409);})['then'](function(_0x4f965a){_0x785e72[_0xa051('0x46')]=_0x4f965a;return _0x785e72;})[_0xa051('0x27')](respondWithFilteredResult(_0x2b1ee6,_0x256409))[_0xa051('0x47')](handleError(_0x2b1ee6,null));})['catch'](handleError(_0x2b1ee6,null));};exports[_0xa051('0x48')]=function(_0x41d8c8,_0x3ecf2b){var _0x949f2a={'raw':![],'where':{'id':_0x41d8c8[_0xa051('0x49')]['id']}},_0x401b32={};_0x401b32['model']=_[_0xa051('0x33')](db[_0xa051('0x42')][_0xa051('0x4a')]);_0x401b32['query']=_['keys'](_0x41d8c8[_0xa051('0x32')]);_0x401b32[_0xa051('0x34')]=_[_0xa051('0x35')](_0x401b32[_0xa051('0x31')],_0x401b32['query']);_0x949f2a[_0xa051('0x37')]=_[_0xa051('0x35')](_0x401b32[_0xa051('0x31')],qs['fields'](_0x41d8c8[_0xa051('0x32')]['fields']));_0x949f2a[_0xa051('0x37')]=_0x949f2a[_0xa051('0x37')][_0xa051('0x4b')]?_0x949f2a[_0xa051('0x37')]:_0x401b32[_0xa051('0x31')];if(_0x41d8c8['query'][_0xa051('0x43')]){_0x949f2a[_0xa051('0x44')]=[{'all':!![]}];}_0x949f2a=_['merge']({},_0x949f2a,_0x41d8c8['options']);return db[_0xa051('0x42')]['find'](_0x949f2a)[_0xa051('0x27')](handleEntityNotFound(_0x3ecf2b,null))[_0xa051('0x27')](respondWithResult(_0x3ecf2b,null))[_0xa051('0x47')](handleError(_0x3ecf2b,null));};exports['create']=function(_0x3bb207,_0xe230aa){return db['CmCompany'][_0xa051('0x4c')](_0x3bb207[_0xa051('0x4d')],{})[_0xa051('0x27')](function(_0x577fad){var _0x1b49bb=_0x3bb207[_0xa051('0x4e')][_0xa051('0x4f')]({'plain':!![]});if(!_0x1b49bb)throw new Error(_0xa051('0x50'));if(_0x1b49bb[_0xa051('0x51')]===_0xa051('0x4e')){var _0x4a807a=_0x577fad[_0xa051('0x4f')]({'plain':!![]});var _0x31b15a=_0xa051('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x31b15a,'userProfileId':_0x1b49bb[_0xa051('0x52')]},'raw':!![]})['then'](function(_0x14634e){if(_0x14634e&&_0x14634e[_0xa051('0x53')]===0x0){return db[_0xa051('0x29')][_0xa051('0x4c')]({'name':_0x4a807a[_0xa051('0x2d')],'resourceId':_0x4a807a['id'],'type':_0x14634e[_0xa051('0x2d')],'sectionId':_0x14634e['id']},{})['then'](function(){return _0x577fad;});}else{return _0x577fad;}})[_0xa051('0x47')](function(_0x5ec8ea){logger[_0xa051('0x2b')](_0xa051('0x54'),_0x5ec8ea);throw _0x5ec8ea;});}return _0x577fad;})[_0xa051('0x27')](respondWithResult(_0xe230aa,0xc9))['catch'](handleError(_0xe230aa,null));};exports[_0xa051('0x26')]=function(_0x466873,_0x16cec9){if(_0x466873[_0xa051('0x4d')]['id']){delete _0x466873['body']['id'];}return db[_0xa051('0x42')][_0xa051('0x55')]({'where':{'id':_0x466873[_0xa051('0x49')]['id']}})[_0xa051('0x27')](handleEntityNotFound(_0x16cec9,null))[_0xa051('0x27')](saveUpdates(_0x466873[_0xa051('0x4d')],null))[_0xa051('0x27')](respondWithResult(_0x16cec9,null))['catch'](handleError(_0x16cec9,null));};exports['destroy']=function(_0x31287e,_0x53998a){return db[_0xa051('0x42')][_0xa051('0x55')]({'where':{'id':_0x31287e[_0xa051('0x49')]['id']}})[_0xa051('0x27')](handleEntityNotFound(_0x53998a,null))[_0xa051('0x27')](removeEntity(_0x53998a,null))[_0xa051('0x47')](handleError(_0x53998a,null));};exports['describe']=function(_0x3cc80e,_0x3a9036){return db[_0xa051('0x42')][_0xa051('0x30')]()[_0xa051('0x27')](respondWithResult(_0x3a9036,null))['catch'](handleError(_0x3a9036,null));};exports[_0xa051('0x56')]=function(_0x9a0e1c,_0x502961,_0x3cd07a){return db['CmContact'][_0xa051('0x55')]({'where':{'id':_0x9a0e1c[_0xa051('0x49')]['id']}})[_0xa051('0x27')](handleEntityNotFound(_0x502961,null))[_0xa051('0x27')](function(_0x5f204c){if(_0x5f204c){return _0x5f204c[_0xa051('0x56')](_0x9a0e1c[_0xa051('0x4d')][_0xa051('0x57')],_[_0xa051('0x58')](_0x9a0e1c[_0xa051('0x4d')],[_0xa051('0x57'),'id'])||{});}})[_0xa051('0x27')](respondWithResult(_0x502961,null))[_0xa051('0x47')](handleError(_0x502961,null));};exports[_0xa051('0x59')]=function(_0x587380,_0x1143fd,_0x33e9ed){var _0x216d74={};var _0x4f3508={};var _0x42ed0b;var _0x16b9a5;return db['CmCompany'][_0xa051('0x5a')]({'where':{'id':_0x587380[_0xa051('0x49')]['id']}})[_0xa051('0x27')](handleEntityNotFound(_0x1143fd,null))[_0xa051('0x27')](function(_0x2a4e9d){if(_0x2a4e9d){_0x42ed0b=_0x2a4e9d;_0x4f3508[_0xa051('0x31')]=_['keys'](db['CmContact'][_0xa051('0x4a')]);_0x4f3508[_0xa051('0x32')]=_[_0xa051('0x33')](_0x587380['query']);_0x4f3508[_0xa051('0x34')]=_[_0xa051('0x35')](_0x4f3508[_0xa051('0x31')],_0x4f3508[_0xa051('0x32')]);_0x216d74[_0xa051('0x37')]=_[_0xa051('0x35')](_0x4f3508['model'],qs[_0xa051('0x36')](_0x587380[_0xa051('0x32')][_0xa051('0x36')]));_0x216d74[_0xa051('0x37')]=_0x216d74['attributes']['length']?_0x216d74[_0xa051('0x37')]:_0x4f3508[_0xa051('0x31')];_0x216d74[_0xa051('0x3a')]=qs[_0xa051('0x3b')](_0x587380['query'][_0xa051('0x3b')]);_0x216d74[_0xa051('0x3d')]=qs[_0xa051('0x34')](_[_0xa051('0x3c')](_0x587380[_0xa051('0x32')],_0x4f3508['filters']));if(_0x587380['query'][_0xa051('0x40')]){_0x216d74['where']=_['merge'](_0x216d74[_0xa051('0x3d')],{'$or':_[_0xa051('0x3f')](_0x216d74[_0xa051('0x37')],function(_0x1cf6f2){var _0x5a2959={};_0x5a2959[_0x1cf6f2]={'$like':'%'+_0x587380['query']['filter']+'%'};return _0x5a2959;})});}_0x216d74=_[_0xa051('0x3e')]({},_0x216d74,_0x587380[_0xa051('0x41')]);return _0x42ed0b[_0xa051('0x59')](_0x216d74);}})[_0xa051('0x27')](function(_0x58bd3a){if(_0x58bd3a){_0x16b9a5=_0x58bd3a[_0xa051('0x4b')];if(!_0x587380['query'][_0xa051('0x38')](_0xa051('0x39'))){_0x216d74[_0xa051('0x20')]=qs[_0xa051('0x20')](_0x587380[_0xa051('0x32')][_0xa051('0x20')]);_0x216d74['offset']=qs[_0xa051('0x1e')](_0x587380[_0xa051('0x32')]['offset']);}return _0x42ed0b['getContacts'](_0x216d74);}})['then'](function(_0x55bd1f){if(_0x55bd1f){return _0x55bd1f?{'count':_0x16b9a5,'rows':_0x55bd1f}:null;}})[_0xa051('0x27')](respondWithResult(_0x1143fd,null))['catch'](handleError(_0x1143fd,null));}; \ No newline at end of file +var _0x09f0=['path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','save','then','destroy','get','Companies','UserProfileResource','stack','name','send','index','CmCompany','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addContacts','CmContact','ids','omit','getContacts','findOne','hasOwnProperty','rimraf','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x5af901,_0x239939){var _0x24e1cd=function(_0x482d88){while(--_0x482d88){_0x5af901['push'](_0x5af901['shift']());}};_0x24e1cd(++_0x239939);}(_0x09f0,0x157));var _0x009f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x09f0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x009f('0x0'));var zipdir=require(_0x009f('0x1'));var jsonpatch=require(_0x009f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x009f('0x3'));var Mustache=require(_0x009f('0x4'));var util=require('util');var path=require(_0x009f('0x5'));var sox=require(_0x009f('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x009f('0x7'));var _=require(_0x009f('0x8'));var squel=require('squel');var crypto=require(_0x009f('0x9'));var jsforce=require(_0x009f('0xa'));var deskjs=require(_0x009f('0xb'));var toCsv=require(_0x009f('0xc'));var querystring=require('querystring');var Papa=require(_0x009f('0xd'));var Redis=require(_0x009f('0xe'));var authService=require(_0x009f('0xf'));var qs=require(_0x009f('0x10'));var as=require(_0x009f('0x11'));var hardwareService=require(_0x009f('0x12'));var logger=require(_0x009f('0x13'))(_0x009f('0x14'));var utils=require(_0x009f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x009f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xdd1660,_0x3753ca){_0x3753ca=_0x3753ca||0xcc;return function(_0x36f5d9){if(_0x36f5d9){return _0xdd1660[_0x009f('0x17')](_0x3753ca);}return _0xdd1660['status'](_0x3753ca)[_0x009f('0x18')]();};}function respondWithResult(_0x4f0d37,_0x168fe5){_0x168fe5=_0x168fe5||0xc8;return function(_0x31d548){if(_0x31d548){return _0x4f0d37[_0x009f('0x19')](_0x168fe5)['json'](_0x31d548);}};}function respondWithFilteredResult(_0x22bc77,_0x1ad389){return function(_0x26d554){if(_0x26d554){var _0x2589b2=typeof _0x1ad389[_0x009f('0x1a')]===_0x009f('0x1b')&&typeof _0x1ad389['limit']===_0x009f('0x1b');var _0x6bdc78=_0x26d554[_0x009f('0x1c')];var _0x5501c3=_0x2589b2?0x0:_0x1ad389[_0x009f('0x1a')];var _0x2a1be3=_0x2589b2?_0x26d554['count']:_0x1ad389[_0x009f('0x1a')]+_0x1ad389[_0x009f('0x1d')];var _0x2050eb;if(_0x2a1be3>=_0x6bdc78){_0x2a1be3=_0x6bdc78;_0x2050eb=0xc8;}else{_0x2050eb=0xce;}_0x22bc77[_0x009f('0x19')](_0x2050eb);return _0x22bc77[_0x009f('0x1e')](_0x009f('0x1f'),_0x5501c3+'-'+_0x2a1be3+'/'+_0x6bdc78)['json'](_0x26d554);}return null;};}function patchUpdates(_0x13e4c3){return function(_0x476e85){try{jsonpatch['apply'](_0x476e85,_0x13e4c3,!![]);}catch(_0x566aef){return BPromise['reject'](_0x566aef);}return _0x476e85[_0x009f('0x20')]();};}function saveUpdates(_0x5bd53c,_0x5113d0){return function(_0x364311){if(_0x364311){return _0x364311['update'](_0x5bd53c)[_0x009f('0x21')](function(_0xea24e2){return _0xea24e2;});}return null;};}function removeEntity(_0x2ba910,_0x40aa42){return function(_0x1ef62e){if(_0x1ef62e){return _0x1ef62e[_0x009f('0x22')]()['then'](function(){var _0x2ca167=_0x1ef62e[_0x009f('0x23')]({'plain':!![]});var _0x2ec9ac=_0x009f('0x24');return db[_0x009f('0x25')][_0x009f('0x22')]({'where':{'type':_0x2ec9ac,'resourceId':_0x2ca167['id']}})[_0x009f('0x21')](function(){return _0x1ef62e;});})[_0x009f('0x21')](function(){_0x2ba910[_0x009f('0x19')](0xcc)[_0x009f('0x18')]();});}};}function handleEntityNotFound(_0x44598a,_0x4790ae){return function(_0x172cda){if(!_0x172cda){_0x44598a[_0x009f('0x17')](0x194);}return _0x172cda;};}function handleError(_0x511f32,_0x3ed22f){_0x3ed22f=_0x3ed22f||0x1f4;return function(_0xeb28e5){logger['error'](_0xeb28e5[_0x009f('0x26')]);if(_0xeb28e5['name']){delete _0xeb28e5[_0x009f('0x27')];}_0x511f32[_0x009f('0x19')](_0x3ed22f)[_0x009f('0x28')](_0xeb28e5);};}exports[_0x009f('0x29')]=function(_0xfc511,_0xcd108){var _0x3841ea={},_0x4f7228={},_0x5e5656={'count':0x0,'rows':[]};return db[_0x009f('0x2a')]['describe']()[_0x009f('0x21')](function(_0x32797b){_0x4f7228[_0x009f('0x2b')]=_['keys'](_0x32797b);_0x4f7228[_0x009f('0x2c')]=_[_0x009f('0x2d')](_0xfc511[_0x009f('0x2c')]);_0x4f7228[_0x009f('0x2e')]=_['intersection'](_0x4f7228[_0x009f('0x2b')],_0x4f7228[_0x009f('0x2c')]);_0x3841ea[_0x009f('0x2f')]=_['intersection'](_0x4f7228['model'],qs[_0x009f('0x30')](_0xfc511['query'][_0x009f('0x30')]));_0x3841ea[_0x009f('0x2f')]=_0x3841ea['attributes'][_0x009f('0x31')]?_0x3841ea['attributes']:_0x4f7228[_0x009f('0x2b')];if(!_0xfc511[_0x009f('0x2c')]['hasOwnProperty'](_0x009f('0x32'))){_0x3841ea[_0x009f('0x1d')]=qs[_0x009f('0x1d')](_0xfc511[_0x009f('0x2c')][_0x009f('0x1d')]);_0x3841ea[_0x009f('0x1a')]=qs[_0x009f('0x1a')](_0xfc511['query'][_0x009f('0x1a')]);}_0x3841ea[_0x009f('0x33')]=qs[_0x009f('0x34')](_0xfc511[_0x009f('0x2c')]['sort']);_0x3841ea[_0x009f('0x35')]=qs['filters'](_[_0x009f('0x36')](_0xfc511[_0x009f('0x2c')],_0x4f7228['filters']),_0x32797b);if(_0xfc511[_0x009f('0x2c')][_0x009f('0x37')]){_0x3841ea[_0x009f('0x35')]=_[_0x009f('0x38')](_0x3841ea[_0x009f('0x35')],{'$or':_[_0x009f('0x39')](_0x3841ea[_0x009f('0x2f')],function(_0x124ae2){var _0x5f24ee={};_0x5f24ee[_0x124ae2]={'$like':'%'+_0xfc511[_0x009f('0x2c')]['filter']+'%'};return _0x5f24ee;})});}_0x3841ea=_[_0x009f('0x38')]({},_0x3841ea,_0xfc511[_0x009f('0x3a')]);var _0x22f27a={'where':_0x3841ea[_0x009f('0x35')]};return db[_0x009f('0x2a')][_0x009f('0x1c')](_0x22f27a)['then'](function(_0xf7bf6c){_0x5e5656['count']=_0xf7bf6c;if(_0xfc511[_0x009f('0x2c')][_0x009f('0x3b')]){_0x3841ea[_0x009f('0x3c')]=[{'all':!![]}];}return db['CmCompany'][_0x009f('0x3d')](_0x3841ea);})[_0x009f('0x21')](function(_0x54e742){_0x5e5656[_0x009f('0x3e')]=_0x54e742;return _0x5e5656;})[_0x009f('0x21')](respondWithFilteredResult(_0xcd108,_0x3841ea))[_0x009f('0x3f')](handleError(_0xcd108,null));})[_0x009f('0x3f')](handleError(_0xcd108,null));};exports['show']=function(_0x3e35f0,_0x19b94b){var _0x34e4b8={'raw':![],'where':{'id':_0x3e35f0[_0x009f('0x40')]['id']}},_0x347d41={};_0x347d41['model']=_['keys'](db[_0x009f('0x2a')][_0x009f('0x41')]);_0x347d41[_0x009f('0x2c')]=_[_0x009f('0x2d')](_0x3e35f0[_0x009f('0x2c')]);_0x347d41[_0x009f('0x2e')]=_[_0x009f('0x42')](_0x347d41['model'],_0x347d41[_0x009f('0x2c')]);_0x34e4b8[_0x009f('0x2f')]=_[_0x009f('0x42')](_0x347d41[_0x009f('0x2b')],qs[_0x009f('0x30')](_0x3e35f0[_0x009f('0x2c')][_0x009f('0x30')]));_0x34e4b8['attributes']=_0x34e4b8[_0x009f('0x2f')]['length']?_0x34e4b8['attributes']:_0x347d41[_0x009f('0x2b')];if(_0x3e35f0[_0x009f('0x2c')]['includeAll']){_0x34e4b8[_0x009f('0x3c')]=[{'all':!![]}];}_0x34e4b8=_[_0x009f('0x38')]({},_0x34e4b8,_0x3e35f0[_0x009f('0x3a')]);return db[_0x009f('0x2a')][_0x009f('0x43')](_0x34e4b8)[_0x009f('0x21')](handleEntityNotFound(_0x19b94b,null))[_0x009f('0x21')](respondWithResult(_0x19b94b,null))['catch'](handleError(_0x19b94b,null));};exports[_0x009f('0x44')]=function(_0x3a33fb,_0xbce0e6){return db[_0x009f('0x2a')][_0x009f('0x44')](_0x3a33fb[_0x009f('0x45')],{})[_0x009f('0x21')](function(_0x47e47b){var _0x179215=_0x3a33fb[_0x009f('0x46')]['get']({'plain':!![]});if(!_0x179215)throw new Error(_0x009f('0x47'));if(_0x179215[_0x009f('0x48')]===_0x009f('0x46')){var _0x28827a=_0x47e47b[_0x009f('0x23')]({'plain':!![]});var _0x2d4ef4=_0x009f('0x24');return db[_0x009f('0x49')]['find']({'where':{'name':_0x2d4ef4,'userProfileId':_0x179215[_0x009f('0x4a')]},'raw':!![]})[_0x009f('0x21')](function(_0x115e3d){if(_0x115e3d&&_0x115e3d[_0x009f('0x4b')]===0x0){return db[_0x009f('0x25')]['create']({'name':_0x28827a['name'],'resourceId':_0x28827a['id'],'type':_0x115e3d[_0x009f('0x27')],'sectionId':_0x115e3d['id']},{})['then'](function(){return _0x47e47b;});}else{return _0x47e47b;}})['catch'](function(_0x43d7cf){logger[_0x009f('0x4c')](_0x009f('0x4d'),_0x43d7cf);throw _0x43d7cf;});}return _0x47e47b;})['then'](respondWithResult(_0xbce0e6,0xc9))[_0x009f('0x3f')](handleError(_0xbce0e6,null));};exports[_0x009f('0x4e')]=function(_0x23a036,_0x5ed1b9){if(_0x23a036[_0x009f('0x45')]['id']){delete _0x23a036[_0x009f('0x45')]['id'];}return db['CmCompany'][_0x009f('0x43')]({'where':{'id':_0x23a036['params']['id']}})['then'](handleEntityNotFound(_0x5ed1b9,null))[_0x009f('0x21')](saveUpdates(_0x23a036['body'],null))['then'](respondWithResult(_0x5ed1b9,null))['catch'](handleError(_0x5ed1b9,null));};exports['destroy']=function(_0x13760b,_0x232485){return db['CmCompany'][_0x009f('0x43')]({'where':{'id':_0x13760b[_0x009f('0x40')]['id']}})['then'](handleEntityNotFound(_0x232485,null))[_0x009f('0x21')](removeEntity(_0x232485,null))[_0x009f('0x3f')](handleError(_0x232485,null));};exports[_0x009f('0x4f')]=function(_0x2c40b3,_0x1d3bc6){return db['CmCompany'][_0x009f('0x4f')]()[_0x009f('0x21')](respondWithResult(_0x1d3bc6,null))['catch'](handleError(_0x1d3bc6,null));};exports[_0x009f('0x50')]=function(_0xb8985a,_0x2f3b17,_0x5c7b24){return db[_0x009f('0x51')][_0x009f('0x43')]({'where':{'id':_0xb8985a['params']['id']}})[_0x009f('0x21')](handleEntityNotFound(_0x2f3b17,null))[_0x009f('0x21')](function(_0x452129){if(_0x452129){return _0x452129[_0x009f('0x50')](_0xb8985a[_0x009f('0x45')][_0x009f('0x52')],_[_0x009f('0x53')](_0xb8985a[_0x009f('0x45')],['ids','id'])||{});}})[_0x009f('0x21')](respondWithResult(_0x2f3b17,null))[_0x009f('0x3f')](handleError(_0x2f3b17,null));};exports[_0x009f('0x54')]=function(_0x1352d0,_0x230621,_0x87a8dd){var _0x173102={};var _0x2818aa={};var _0x5d1e7e;var _0x14589;return db[_0x009f('0x2a')][_0x009f('0x55')]({'where':{'id':_0x1352d0[_0x009f('0x40')]['id']}})[_0x009f('0x21')](handleEntityNotFound(_0x230621,null))['then'](function(_0x896fc3){if(_0x896fc3){_0x5d1e7e=_0x896fc3;_0x2818aa[_0x009f('0x2b')]=_[_0x009f('0x2d')](db['CmContact'][_0x009f('0x41')]);_0x2818aa[_0x009f('0x2c')]=_[_0x009f('0x2d')](_0x1352d0[_0x009f('0x2c')]);_0x2818aa[_0x009f('0x2e')]=_[_0x009f('0x42')](_0x2818aa['model'],_0x2818aa['query']);_0x173102['attributes']=_[_0x009f('0x42')](_0x2818aa[_0x009f('0x2b')],qs[_0x009f('0x30')](_0x1352d0[_0x009f('0x2c')][_0x009f('0x30')]));_0x173102[_0x009f('0x2f')]=_0x173102[_0x009f('0x2f')][_0x009f('0x31')]?_0x173102[_0x009f('0x2f')]:_0x2818aa[_0x009f('0x2b')];_0x173102[_0x009f('0x33')]=qs[_0x009f('0x34')](_0x1352d0['query'][_0x009f('0x34')]);_0x173102[_0x009f('0x35')]=qs[_0x009f('0x2e')](_[_0x009f('0x36')](_0x1352d0[_0x009f('0x2c')],_0x2818aa[_0x009f('0x2e')]));if(_0x1352d0[_0x009f('0x2c')]['filter']){_0x173102[_0x009f('0x35')]=_[_0x009f('0x38')](_0x173102['where'],{'$or':_[_0x009f('0x39')](_0x173102['attributes'],function(_0x3a2a5d){var _0x3dccef={};_0x3dccef[_0x3a2a5d]={'$like':'%'+_0x1352d0['query']['filter']+'%'};return _0x3dccef;})});}_0x173102=_['merge']({},_0x173102,_0x1352d0[_0x009f('0x3a')]);return _0x5d1e7e[_0x009f('0x54')](_0x173102);}})[_0x009f('0x21')](function(_0x4473e8){if(_0x4473e8){_0x14589=_0x4473e8[_0x009f('0x31')];if(!_0x1352d0[_0x009f('0x2c')][_0x009f('0x56')](_0x009f('0x32'))){_0x173102[_0x009f('0x1d')]=qs[_0x009f('0x1d')](_0x1352d0[_0x009f('0x2c')][_0x009f('0x1d')]);_0x173102['offset']=qs[_0x009f('0x1a')](_0x1352d0[_0x009f('0x2c')][_0x009f('0x1a')]);}return _0x5d1e7e[_0x009f('0x54')](_0x173102);}})[_0x009f('0x21')](function(_0x90c47b){if(_0x90c47b){return _0x90c47b?{'count':_0x14589,'rows':_0x90c47b}:null;}})[_0x009f('0x21')](respondWithResult(_0x230621,null))[_0x009f('0x3f')](handleError(_0x230621,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 3c44866..b07bf88 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 _0xca87=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','cm_companies','lodash'];(function(_0x2f6233,_0x90172){var _0x1c9c36=function(_0x3ac680){while(--_0x3ac680){_0x2f6233['push'](_0x2f6233['shift']());}};_0x1c9c36(++_0x90172);}(_0xca87,0x1bb));var _0x7ca8=function(_0x44cacb,_0x55e201){_0x44cacb=_0x44cacb-0x0;var _0x850fd9=_0xca87[_0x44cacb];return _0x850fd9;};'use strict';var _=require(_0x7ca8('0x0'));var util=require(_0x7ca8('0x1'));var logger=require(_0x7ca8('0x2'))(_0x7ca8('0x3'));var moment=require(_0x7ca8('0x4'));var BPromise=require(_0x7ca8('0x5'));var rp=require(_0x7ca8('0x6'));var fs=require('fs');var path=require(_0x7ca8('0x7'));var rimraf=require(_0x7ca8('0x8'));var config=require(_0x7ca8('0x9'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x3da66e,_0xbee3c6){return _0x3da66e[_0x7ca8('0xa')]('CmCompany',attributes,{'tableName':_0x7ca8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0415=['bluebird','path','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','moment'];(function(_0x3ba7c8,_0x404eab){var _0x539e5d=function(_0x36a77c){while(--_0x36a77c){_0x3ba7c8['push'](_0x3ba7c8['shift']());}};_0x539e5d(++_0x404eab);}(_0x0415,0x188));var _0x5041=function(_0x57a715,_0x301c68){_0x57a715=_0x57a715-0x0;var _0x6f8482=_0x0415[_0x57a715];return _0x6f8482;};'use strict';var _=require(_0x5041('0x0'));var util=require(_0x5041('0x1'));var logger=require(_0x5041('0x2'))('api');var moment=require(_0x5041('0x3'));var BPromise=require(_0x5041('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5041('0x5'));var rimraf=require('rimraf');var config=require(_0x5041('0x6'));var attributes=require(_0x5041('0x7'));module[_0x5041('0x8')]=function(_0xe52738,_0x25f61b){return _0xe52738[_0x5041('0x9')](_0x5041('0xa'),attributes,{'tableName':_0x5041('0xb'),'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 5cdc16f..45a5207 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 _0x1d1a=['CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/environment','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xbc7e86,_0x4b85ac){var _0x36d1d9=function(_0x3d5e74){while(--_0x3d5e74){_0xbc7e86['push'](_0xbc7e86['shift']());}};_0x36d1d9(++_0x4b85ac);}(_0x1d1a,0x9e));var _0xa1d1=function(_0x98e3e,_0x34abf2){_0x98e3e=_0x98e3e-0x0;var _0x54e1a6=_0x1d1a[_0x98e3e];return _0x54e1a6;};'use strict';var _=require(_0xa1d1('0x0'));var util=require(_0xa1d1('0x1'));var moment=require('moment');var BPromise=require(_0xa1d1('0x2'));var rs=require(_0xa1d1('0x3'));var fs=require('fs');var Redis=require(_0xa1d1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa1d1('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa1d1('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5f2a38,_0x12f3bd,_0x5c7b6c){return new BPromise(function(_0x7f519b,_0x51c2d9){return client[_0xa1d1('0x7')](_0x5f2a38,_0x5c7b6c)['then'](function(_0x51fec2){logger[_0xa1d1('0x8')](_0xa1d1('0x9'),_0x12f3bd,_0xa1d1('0xa'));logger[_0xa1d1('0xb')](_0xa1d1('0xc'),_0x12f3bd,_0xa1d1('0xa'),JSON['stringify'](_0x51fec2));if(_0x51fec2[_0xa1d1('0xd')]){if(_0x51fec2[_0xa1d1('0xd')][_0xa1d1('0xe')]===0x1f4){logger[_0xa1d1('0xd')]('CmCompany,\x20%s,\x20%s',_0x12f3bd,_0x51fec2[_0xa1d1('0xd')][_0xa1d1('0xf')]);return _0x51c2d9(_0x51fec2[_0xa1d1('0xd')][_0xa1d1('0xf')]);}logger['error'](_0xa1d1('0x9'),_0x12f3bd,_0x51fec2[_0xa1d1('0xd')]['message']);return _0x7f519b(_0x51fec2[_0xa1d1('0xd')][_0xa1d1('0xf')]);}else{logger[_0xa1d1('0x8')](_0xa1d1('0x9'),_0x12f3bd,_0xa1d1('0xa'));_0x7f519b(_0x51fec2['result'][_0xa1d1('0xf')]);}})[_0xa1d1('0x10')](function(_0x8dfd53){logger[_0xa1d1('0xd')]('CmCompany,\x20%s,\x20%s',_0x12f3bd,_0x8dfd53);_0x51c2d9(_0x8dfd53);});});} \ No newline at end of file +var _0xf5cc=['bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','message','CmCompany,\x20%s,\x20%s','result','catch','lodash','moment'];(function(_0x2984c5,_0x282398){var _0x2c09df=function(_0x3da267){while(--_0x3da267){_0x2984c5['push'](_0x2984c5['shift']());}};_0x2c09df(++_0x282398);}(_0xf5cc,0x91));var _0xcf5c=function(_0xa041de,_0x3600e2){_0xa041de=_0xa041de-0x0;var _0x1d654c=_0xf5cc[_0xa041de];return _0x1d654c;};'use strict';var _=require(_0xcf5c('0x0'));var util=require('util');var moment=require(_0xcf5c('0x1'));var BPromise=require(_0xcf5c('0x2'));var rs=require(_0xcf5c('0x3'));var fs=require('fs');var Redis=require(_0xcf5c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcf5c('0x5'));var logger=require('../../config/logger')(_0xcf5c('0x6'));var config=require('../../config/environment');var jayson=require(_0xcf5c('0x7'));var client=jayson[_0xcf5c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f0be0,_0x39d5dd,_0x294a31){return new BPromise(function(_0x23538a,_0x438970){return client[_0xcf5c('0x9')](_0x1f0be0,_0x294a31)[_0xcf5c('0xa')](function(_0x11e4d7){logger[_0xcf5c('0xb')]('CmCompany,\x20%s,\x20%s',_0x39d5dd,_0xcf5c('0xc'));logger[_0xcf5c('0xd')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x39d5dd,_0xcf5c('0xc'),JSON[_0xcf5c('0xe')](_0x11e4d7));if(_0x11e4d7[_0xcf5c('0xf')]){if(_0x11e4d7[_0xcf5c('0xf')][_0xcf5c('0x10')]===0x1f4){logger[_0xcf5c('0xf')]('CmCompany,\x20%s,\x20%s',_0x39d5dd,_0x11e4d7[_0xcf5c('0xf')][_0xcf5c('0x11')]);return _0x438970(_0x11e4d7[_0xcf5c('0xf')][_0xcf5c('0x11')]);}logger[_0xcf5c('0xf')](_0xcf5c('0x12'),_0x39d5dd,_0x11e4d7[_0xcf5c('0xf')][_0xcf5c('0x11')]);return _0x23538a(_0x11e4d7[_0xcf5c('0xf')][_0xcf5c('0x11')]);}else{logger[_0xcf5c('0xb')](_0xcf5c('0x12'),_0x39d5dd,'request\x20sent');_0x23538a(_0x11e4d7[_0xcf5c('0x13')][_0xcf5c('0x11')]);}})[_0xcf5c('0x14')](function(_0x10f958){logger['error']('CmCompany,\x20%s,\x20%s',_0x39d5dd,_0x10f958);_0x438970(_0x10f958);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index d148213..294e155 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 _0x5080=['exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','/describe','describe','get','show','/:id/contacts','getContacts','post','create','put','/:id','update','destroy'];(function(_0x919445,_0x5467dc){var _0x511b3e=function(_0xde10f3){while(--_0xde10f3){_0x919445['push'](_0x919445['shift']());}};_0x511b3e(++_0x5467dc);}(_0x5080,0x177));var _0x0508=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5080[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0x0508('0x0'));var path=require('path');var timeout=require(_0x0508('0x1'));var express=require(_0x0508('0x2'));var router=express[_0x0508('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0508('0x4'));var config=require(_0x0508('0x5'));var controller=require(_0x0508('0x6'));router['get']('/',auth[_0x0508('0x7')](),controller[_0x0508('0x8')]);router['get'](_0x0508('0x9'),auth['isAuthenticated'](),controller[_0x0508('0xa')]);router[_0x0508('0xb')]('/:id',auth[_0x0508('0x7')](),controller[_0x0508('0xc')]);router[_0x0508('0xb')](_0x0508('0xd'),auth[_0x0508('0x7')](),controller[_0x0508('0xe')]);router[_0x0508('0xf')]('/',auth['isAuthenticated'](),controller[_0x0508('0x10')]);router[_0x0508('0xf')](_0x0508('0xd'),auth[_0x0508('0x7')](),controller['addContacts']);router[_0x0508('0x11')](_0x0508('0x12'),auth[_0x0508('0x7')](),controller[_0x0508('0x13')]);router['delete'](_0x0508('0x12'),auth[_0x0508('0x7')](),controller[_0x0508('0x14')]);module[_0x0508('0x15')]=router; \ No newline at end of file +var _0x9ad7=['create','addContacts','put','update','delete','/:id','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/describe','isAuthenticated','show','/:id/contacts','getContacts','post'];(function(_0x49cf80,_0x18b684){var _0x22ab19=function(_0xf4e724){while(--_0xf4e724){_0x49cf80['push'](_0x49cf80['shift']());}};_0x22ab19(++_0x18b684);}(_0x9ad7,0x84));var _0x79ad=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x9ad7[_0x2faddb];return _0x273c05;};'use strict';var multer=require(_0x79ad('0x0'));var util=require(_0x79ad('0x1'));var path=require(_0x79ad('0x2'));var timeout=require('connect-timeout');var express=require(_0x79ad('0x3'));var router=express[_0x79ad('0x4')]();var fs_extra=require(_0x79ad('0x5'));var auth=require(_0x79ad('0x6'));var interaction=require(_0x79ad('0x7'));var config=require(_0x79ad('0x8'));var controller=require(_0x79ad('0x9'));router[_0x79ad('0xa')]('/',auth['isAuthenticated'](),controller[_0x79ad('0xb')]);router[_0x79ad('0xa')](_0x79ad('0xc'),auth[_0x79ad('0xd')](),controller['describe']);router[_0x79ad('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x79ad('0xe')]);router[_0x79ad('0xa')](_0x79ad('0xf'),auth['isAuthenticated'](),controller[_0x79ad('0x10')]);router[_0x79ad('0x11')]('/',auth[_0x79ad('0xd')](),controller[_0x79ad('0x12')]);router[_0x79ad('0x11')](_0x79ad('0xf'),auth[_0x79ad('0xd')](),controller[_0x79ad('0x13')]);router[_0x79ad('0x14')]('/:id',auth[_0x79ad('0xd')](),controller[_0x79ad('0x15')]);router[_0x79ad('0x16')](_0x79ad('0x17'),auth['isAuthenticated'](),controller['destroy']);module[_0x79ad('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 9291a9d..d156258 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 _0x77c5=['INTEGER','UNSIGNED','NOW','sequelize','exports','STRING','TEXT'];(function(_0x6aab80,_0x4d136b){var _0x5aa6ad=function(_0x5708e4){while(--_0x5708e4){_0x6aab80['push'](_0x6aab80['shift']());}};_0x5aa6ad(++_0x4d136b);}(_0x77c5,0xdc));var _0x577c=function(_0x57a8f1,_0x537ddd){_0x57a8f1=_0x57a8f1-0x0;var _0x1d077c=_0x77c5[_0x57a8f1];return _0x1d077c;};'use strict';var _=require('lodash');var Sequelize=require(_0x577c('0x0'));module[_0x577c('0x1')]={'firstName':{'type':Sequelize[_0x577c('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x577c('0x2')]},'street':{'type':Sequelize[_0x577c('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x577c('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x577c('0x2')]},'description':{'type':Sequelize[_0x577c('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x577c('0x2')]},'fax':{'type':Sequelize[_0x577c('0x2')]},'email':{'type':Sequelize[_0x577c('0x2')]},'url':{'type':Sequelize[_0x577c('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x577c('0x2')]},'twitter':{'type':Sequelize[_0x577c('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x577c('0x2')]},'wechat':{'type':Sequelize[_0x577c('0x2')]},'telegram':{'type':Sequelize[_0x577c('0x2')]},'UserId':{'type':Sequelize[_0x577c('0x4')]},'priority':{'type':Sequelize[_0x577c('0x4')](0x2)[_0x577c('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x577c('0x6')]}}; \ No newline at end of file +var _0xb889=['NOW','lodash','exports','STRING','TEXT','INTEGER','DATE'];(function(_0x5a2201,_0x494e47){var _0x15b753=function(_0x2ab144){while(--_0x2ab144){_0x5a2201['push'](_0x5a2201['shift']());}};_0x15b753(++_0x494e47);}(_0xb889,0x166));var _0x9b88=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xb889[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0x9b88('0x0'));var Sequelize=require('sequelize');module[_0x9b88('0x1')]={'firstName':{'type':Sequelize[_0x9b88('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x9b88('0x2')]},'street':{'type':Sequelize[_0x9b88('0x2')]},'postalCode':{'type':Sequelize[_0x9b88('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x9b88('0x2')]},'dateOfBirth':{'type':Sequelize[_0x9b88('0x2')]},'description':{'type':Sequelize[_0x9b88('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x9b88('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9b88('0x2')]},'url':{'type':Sequelize[_0x9b88('0x2')]},'facebook':{'type':Sequelize[_0x9b88('0x2')]},'fb_data':{'type':Sequelize[_0x9b88('0x2')]},'twitter':{'type':Sequelize[_0x9b88('0x2')]},'skype':{'type':Sequelize[_0x9b88('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x9b88('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x9b88('0x2')]},'telegram':{'type':Sequelize[_0x9b88('0x2')]},'UserId':{'type':Sequelize[_0x9b88('0x4')]},'priority':{'type':Sequelize[_0x9b88('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x9b88('0x5')],'defaultValue':Sequelize[_0x9b88('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 05795ba..0194b04 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 _0x2a36=['c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','tags','columnName','displayName','analytics','values','body','findAll','get','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','bulkCreate','each','duplicates','findOrCreate','spread','params','$and','omit','format','cf_%d','pickBy','table','cm_contacts','setFields','id\x20=\x20?','phone','rawAttributes','options','setTags','ContactId','include','getHopperHistories','CmHopperHistory','nolimit','includeAll','getHopperFinals','getJscriptySessions','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','filename','chmodSync','0777','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','file','meta','import','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','getJourney','sms','openchannel','fax','whatsapp','voice','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','createdAt','fullname','alias','VoiceCallReport','startCase','chat','Website','Account','note','disposition','secondDisposition','thirdDisposition','key','Owner','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','mail','Interaction','flatten','sortBy','reverse','slice','moment','bluebird','util','path','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','redis','./cmContact.socket','json','undefined','count','limit','status','Content-Range','update','then','destroy','end','stack','name','send','index','CmContact','describe','keys','length','startsWith','cf_','push','CmCustomField','findOne','trimStart','all','type','query','filters','intersection','model','fields','attributes','hasOwnProperty','offset','order','sort','where','pick','select','field','color','from','tools_tags','left_join','cm_user_has_contacts','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','search','parseSearch','sqlOperator','conditions','find','Tag','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','and','uc.UserId\x20=\x20?','value','dateOfBirth','datetime','castTo','buildExpression','text','start','filter','isNil','Contact','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','isArray','tag','replace','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.id','QueryTypes','SELECT','clone','DESC','isEmpty','having','t.id\x20IN\x20?','user','role','some','getLists','c.ListId\x20IS\x20NULL','agent','sequelize','toString','merge','c.lastName','c.mobile','c.fax','c.ListId','c.createdAt'];(function(_0x295a55,_0x56e0dc){var _0x3890cf=function(_0x284d42){while(--_0x284d42){_0x295a55['push'](_0x295a55['shift']());}};_0x3890cf(++_0x56e0dc);}(_0x2a36,0x95));var _0x62a3=function(_0x5da622,_0x4b415e){_0x5da622=_0x5da622-0x0;var _0x43b245=_0x2a36[_0x5da622];return _0x43b245;};'use strict';var moment=require(_0x62a3('0x0'));var BPromise=require(_0x62a3('0x1'));var util=require(_0x62a3('0x2'));var path=require(_0x62a3('0x3'));var fs=require('fs');var _=require(_0x62a3('0x4'));var squel=require(_0x62a3('0x5'));var Papa=require(_0x62a3('0x6'));var Redis=require(_0x62a3('0x7'));var qs=require(_0x62a3('0x8'));var as=require(_0x62a3('0x9'));var logger=require(_0x62a3('0xa'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x62a3('0xb')]=_['defaults'](config[_0x62a3('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x62a3('0xb')]));require(_0x62a3('0xc'))['register'](socket);function respondWithResult(_0x3f8699,_0x406f49){_0x406f49=_0x406f49||0xc8;return function(_0x16ccfd){if(_0x16ccfd){return _0x3f8699['status'](_0x406f49)[_0x62a3('0xd')](_0x16ccfd);}};}function respondWithFilteredResult(_0x474848,_0x343c04){return function(_0x3e20d9){if(_0x3e20d9){var _0x454b39=typeof _0x343c04['offset']===_0x62a3('0xe')&&typeof _0x343c04['limit']===_0x62a3('0xe');var _0x12a313=_0x3e20d9['count'];var _0x51cc2e=_0x454b39?0x0:_0x343c04['offset'];var _0x95e399=_0x454b39?_0x3e20d9[_0x62a3('0xf')]:_0x343c04['offset']+_0x343c04[_0x62a3('0x10')];var _0x25440e;if(_0x95e399>=_0x12a313){_0x95e399=_0x12a313;_0x25440e=0xc8;}else{_0x25440e=0xce;}_0x474848[_0x62a3('0x11')](_0x25440e);return _0x474848['set'](_0x62a3('0x12'),_0x51cc2e+'-'+_0x95e399+'/'+_0x12a313)[_0x62a3('0xd')](_0x3e20d9);}return null;};}function saveUpdates(_0x17f4e6){return function(_0x553c77){if(_0x553c77){return _0x553c77[_0x62a3('0x13')](_0x17f4e6)[_0x62a3('0x14')](function(_0x145f1b){return _0x145f1b;});}return null;};}function removeEntity(_0x56f2f0){return function(_0x442811){if(_0x442811){return _0x442811[_0x62a3('0x15')]()[_0x62a3('0x14')](function(){_0x56f2f0['status'](0xcc)[_0x62a3('0x16')]();});}};}function handleEntityNotFound(_0x669db5){return function(_0x4dda26){if(!_0x4dda26){_0x669db5['sendStatus'](0x194);}return _0x4dda26;};}function handleError(_0x123571,_0x298bde){_0x298bde=_0x298bde||0x1f4;return function(_0xd42e26){logger['error'](_0xd42e26[_0x62a3('0x17')]);if(_0xd42e26[_0x62a3('0x18')]){delete _0xd42e26['name'];}_0x123571['status'](_0x298bde)[_0x62a3('0x19')](_0xd42e26);};}exports[_0x62a3('0x1a')]=function(_0x1807ba,_0x5b89d9){var _0x21d16f={},_0x3ed274={},_0x5dd557={'count':0x0,'rows':[]};return db[_0x62a3('0x1b')][_0x62a3('0x1c')]()[_0x62a3('0x14')](function(_0x276ddc){var _0x2fd821=[];for(var _0x32f9b7=0x0;_0x32f9b70x1){_0x4b0961['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x882502),null);}else{if(qs[_0x62a3('0x5b')](_0x882502)){_0x4b0961['or'](_0x62a3('0x5c'),_0x882502+'%');_0x4b0961['or'](_0x62a3('0x5d'),_0x882502+'%');_0x4b0961['or'](_0x62a3('0x5e'),_0x882502+'%');_0x4b0961['or'](_0x62a3('0x5f'),_0x882502+'%');}else if(qs[_0x62a3('0x60')](_0x882502)){_0x4b0961['or']('c.email\x20LIKE\x20?',_0x882502+'%');}else{_0x4b0961['or'](_0x62a3('0x61'),'%'+_0x882502+'%');_0x4b0961['or']('c.lastName\x20LIKE\x20?','%'+_0x882502+'%');_0x4b0961['or']('c.email\x20LIKE\x20?','%'+_0x882502+'%');}}}}_0x238697[_0x62a3('0x31')](_0x4b0961);_0x238697['group'](_0x62a3('0x62'));var _0x2d0abc={'type':db['Sequelize'][_0x62a3('0x63')][_0x62a3('0x64')],'raw':!![]};var _0x5a4395=_0x238697[_0x62a3('0x65')]()[_0x62a3('0x34')](_0x62a3('0x62'));if(_0x21d16f[_0x62a3('0x2f')]){_0x21d16f['order'][_0x62a3('0x44')](function(_0x388a4c){_0x238697['order']('c.'+_0x388a4c[0x0],_0x388a4c[0x1]===_0x62a3('0x66')?![]:!![]);});}if(!_[_0x62a3('0x67')](_0x411274)){_0x238697[_0x62a3('0x68')](_0x1f18a6);_0x5a4395[_0x62a3('0x31')](_0x62a3('0x69'),_0x411274);}BPromise['resolve']()[_0x62a3('0x14')](function(){if(!_0x2595c1)return;if(_0x1807ba[_0x62a3('0x6a')][_0x62a3('0x6b')]!=='agent')return;if(!_[_0x62a3('0x6c')](_0x2595c1[_0x62a3('0x3f')],[_0x62a3('0x34'),_0x62a3('0x46')])){return _0x1807ba[_0x62a3('0x6a')][_0x62a3('0x6d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x85a1a1){if(_[_0x62a3('0x67')](_0x85a1a1)){_0x5a4395[_0x62a3('0x31')](_0x62a3('0x6e'));_0x238697['where'](_0x62a3('0x6e'));}else{_0x5a4395[_0x62a3('0x31')]('c.ListId\x20IN\x20?',_[_0x62a3('0x43')](_0x85a1a1,'id'));_0x238697[_0x62a3('0x31')]('c.ListId\x20IN\x20?',_['map'](_0x85a1a1,'id'));}});}})[_0x62a3('0x14')](function(){if(_0x1807ba['user'][_0x62a3('0x6b')]===_0x62a3('0x6f')&&!_0x2595c1&&!_0x1807ba[_0x62a3('0x27')][_0x62a3('0x53')])return[];return db[_0x62a3('0x70')][_0x62a3('0x27')](_0x5a4395[_0x62a3('0x71')](),_0x2d0abc);})[_0x62a3('0x14')](function(_0x40364e){_0x5dd557['count']=_0x40364e['length'];if(_0x5dd557[_0x62a3('0xf')]===0x0)return[];return db[_0x62a3('0x70')][_0x62a3('0x27')](_0x1a44b8[_0x62a3('0x71')](),_0x2d0abc)[_0x62a3('0x14')](function(_0x250f88){_0x110e20=_['keyBy'](_0x250f88,'id');_0x2d0abc=_[_0x62a3('0x72')](_0x2d0abc,{'model':db[_0x62a3('0x1b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1807ba[_0x62a3('0x27')][_0x62a3('0x2b')]){_0x21d16f[_0x62a3('0x2c')]['forEach'](function(_0x35bb7c){_0x238697[_0x62a3('0x34')]('c.'+_0x35bb7c);});}else{_0x238697[_0x62a3('0x34')]('c.id');_0x238697['field']('c.firstName');_0x238697[_0x62a3('0x34')](_0x62a3('0x73'));_0x238697['field']('c.phone');_0x238697['field'](_0x62a3('0x74'));_0x238697['field'](_0x62a3('0x75'));_0x238697[_0x62a3('0x34')]('c.email');_0x238697[_0x62a3('0x34')](_0x62a3('0x76'));_0x238697[_0x62a3('0x34')](_0x62a3('0x77'));_0x238697['field'](_0x62a3('0x78'));_0x238697['field'](_0x62a3('0x79'));_0x238697[_0x62a3('0x34')](_0x62a3('0x7a'),_0x62a3('0x7b'));}if(_0x21d16f[_0x62a3('0x10')])_0x238697[_0x62a3('0x10')](_0x21d16f[_0x62a3('0x10')]);if(_0x21d16f[_0x62a3('0x2e')])_0x238697[_0x62a3('0x2e')](_0x21d16f['offset']);return db['sequelize'][_0x62a3('0x27')](_0x238697[_0x62a3('0x71')](),_0x2d0abc);});})[_0x62a3('0x14')](function(_0x3d27b6){_0x3d27b6[_0x62a3('0x44')](function(_0x5706b8){if(_0x5706b8['TagIds']){_0x5706b8[_0x62a3('0x7c')]=[];_0x5706b8[_0x62a3('0x7b')][_0x62a3('0x42')](',')[_0x62a3('0x44')](function(_0x137bfd){_0x5706b8['Tags']['push'](_0x110e20[_0x137bfd]);});}delete _0x5706b8[_0x62a3('0x7b')];});_0x5dd557[_0x62a3('0x7d')]=_0x3d27b6;return _0x5dd557;})[_0x62a3('0x14')](respondWithFilteredResult(_0x5b89d9,_0x21d16f));})[_0x62a3('0x7e')](handleError(_0x5b89d9,null));};exports[_0x62a3('0x15')]=function(_0xb473fc,_0x18026c){return db[_0x62a3('0x1b')][_0x62a3('0x40')]({'where':{'id':_0xb473fc['params']['id']}})['then'](handleEntityNotFound(_0x18026c,null))[_0x62a3('0x14')](removeEntity(_0x18026c,null))['catch'](handleError(_0x18026c,null));};exports['describe']=function(_0x4052cb,_0x168b38){return db[_0x62a3('0x1b')][_0x62a3('0x1c')]()[_0x62a3('0x14')](function(_0x3a8dec){delete _0x3a8dec[_0x62a3('0x7f')];for(var _0x574288=0x0;_0x574288=_0x5378ae){_0x46c5bc=_0x5378ae;_0x413a82=0xc8;}else{_0x413a82=0xce;}_0x251d8f['status'](_0x413a82);return _0x251d8f[_0x26f0('0x17')](_0x26f0('0x18'),_0x89b998+'-'+_0x46c5bc+'/'+_0x5378ae)[_0x26f0('0x12')](_0x31a858);}return null;};}function saveUpdates(_0x504918){return function(_0x3e8602){if(_0x3e8602){return _0x3e8602['update'](_0x504918)[_0x26f0('0x19')](function(_0x3f6515){return _0x3f6515;});}return null;};}function removeEntity(_0x108f5e){return function(_0x69053a){if(_0x69053a){return _0x69053a[_0x26f0('0x1a')]()['then'](function(){_0x108f5e['status'](0xcc)[_0x26f0('0x1b')]();});}};}function handleEntityNotFound(_0x233b7b){return function(_0x368865){if(!_0x368865){_0x233b7b[_0x26f0('0x1c')](0x194);}return _0x368865;};}function handleError(_0xf84fbe,_0xe74a37){_0xe74a37=_0xe74a37||0x1f4;return function(_0xb1513c){logger[_0x26f0('0x1d')](_0xb1513c[_0x26f0('0x1e')]);if(_0xb1513c['name']){delete _0xb1513c['name'];}_0xf84fbe['status'](_0xe74a37)[_0x26f0('0x1f')](_0xb1513c);};}exports[_0x26f0('0x20')]=function(_0x552009,_0x3910ab){var _0x345878={},_0x2b80cc={},_0x9fb463={'count':0x0,'rows':[]};return db['CmContact'][_0x26f0('0x21')]()['then'](function(_0x48441d){var _0x283f5a=[];for(var _0x3549a3=0x0;_0x3549a30x1){_0x599884['or'](_0x26f0('0x62'),qs['getFullTextValue'](_0x1162df),null);}else{if(qs[_0x26f0('0x63')](_0x1162df)){_0x599884['or']('c.id\x20LIKE\x20?',_0x1162df+'%');_0x599884['or']('c.phone\x20LIKE\x20?',_0x1162df+'%');_0x599884['or'](_0x26f0('0x64'),_0x1162df+'%');_0x599884['or'](_0x26f0('0x65'),_0x1162df+'%');}else if(qs['isEmail'](_0x1162df)){_0x599884['or'](_0x26f0('0x66'),_0x1162df+'%');}else{_0x599884['or'](_0x26f0('0x67'),'%'+_0x1162df+'%');_0x599884['or']('c.lastName\x20LIKE\x20?','%'+_0x1162df+'%');_0x599884['or'](_0x26f0('0x66'),'%'+_0x1162df+'%');}}}}_0x2c2dcc[_0x26f0('0x33')](_0x599884);_0x2c2dcc[_0x26f0('0x68')](_0x26f0('0x69'));var _0x455d55={'type':db[_0x26f0('0x6a')][_0x26f0('0x6b')]['SELECT'],'raw':!![]};var _0x3f0ea8=_0x2c2dcc[_0x26f0('0x6c')]()[_0x26f0('0x37')](_0x26f0('0x69'));if(_0x345878[_0x26f0('0x31')]){_0x345878['order'][_0x26f0('0x5a')](function(_0x590617){_0x2c2dcc['order']('c.'+_0x590617[0x0],_0x590617[0x1]===_0x26f0('0x6d')?![]:!![]);});}if(!_['isEmpty'](_0xfd7249)){_0x2c2dcc[_0x26f0('0x6e')](_0x381dd1);_0x3f0ea8[_0x26f0('0x33')](_0x26f0('0x6f'),_0xfd7249);}BPromise[_0x26f0('0x70')]()['then'](function(){if(!_0x2eb49b)return;if(_0x552009['user'][_0x26f0('0x71')]!=='agent')return;if(!_[_0x26f0('0x72')](_0x2eb49b[_0x26f0('0x45')],[_0x26f0('0x37'),_0x26f0('0x4c')])){return _0x552009[_0x26f0('0x73')][_0x26f0('0x74')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5648e5){if(_['isEmpty'](_0x5648e5)){_0x3f0ea8[_0x26f0('0x33')](_0x26f0('0x75'));_0x2c2dcc[_0x26f0('0x33')]('c.ListId\x20IS\x20NULL');}else{_0x3f0ea8['where'](_0x26f0('0x5b'),_['map'](_0x5648e5,'id'));_0x2c2dcc[_0x26f0('0x33')]('c.ListId\x20IN\x20?',_['map'](_0x5648e5,'id'));}});}})[_0x26f0('0x19')](function(){if(_0x552009[_0x26f0('0x73')][_0x26f0('0x71')]===_0x26f0('0x76')&&!_0x2eb49b&&!_0x552009[_0x26f0('0x2b')][_0x26f0('0x77')])return[];return db[_0x26f0('0x78')][_0x26f0('0x2b')](_0x3f0ea8[_0x26f0('0x79')](),_0x455d55);})[_0x26f0('0x19')](function(_0x100292){_0x9fb463[_0x26f0('0x15')]=_0x100292[_0x26f0('0x23')];if(_0x9fb463['count']===0x0)return[];return db['sequelize'][_0x26f0('0x2b')](_0x21d5fa[_0x26f0('0x79')](),_0x455d55)['then'](function(_0x59ac49){_0x10de32=_[_0x26f0('0x7a')](_0x59ac49,'id');_0x455d55=_[_0x26f0('0x7b')](_0x455d55,{'model':db[_0x26f0('0x7c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x552009['query'][_0x26f0('0x2d')]){_0x345878[_0x26f0('0x2e')][_0x26f0('0x5a')](function(_0x5eeba6){_0x2c2dcc[_0x26f0('0x37')]('c.'+_0x5eeba6);});}else{_0x2c2dcc[_0x26f0('0x37')](_0x26f0('0x69'));_0x2c2dcc[_0x26f0('0x37')](_0x26f0('0x7d'));_0x2c2dcc[_0x26f0('0x37')](_0x26f0('0x7e'));_0x2c2dcc['field'](_0x26f0('0x7f'));_0x2c2dcc['field'](_0x26f0('0x80'));_0x2c2dcc[_0x26f0('0x37')]('c.fax');_0x2c2dcc[_0x26f0('0x37')]('c.email');_0x2c2dcc['field'](_0x26f0('0x81'));_0x2c2dcc[_0x26f0('0x37')]('c.createdAt');_0x2c2dcc['field'](_0x26f0('0x82'));_0x2c2dcc[_0x26f0('0x37')](_0x26f0('0x83'));_0x2c2dcc[_0x26f0('0x37')](_0x26f0('0x84'),_0x26f0('0x85'));}if(_0x345878[_0x26f0('0x14')])_0x2c2dcc[_0x26f0('0x14')](_0x345878['limit']);if(_0x345878[_0x26f0('0x16')])_0x2c2dcc[_0x26f0('0x16')](_0x345878[_0x26f0('0x16')]);return db[_0x26f0('0x78')][_0x26f0('0x2b')](_0x2c2dcc[_0x26f0('0x79')](),_0x455d55);});})[_0x26f0('0x19')](function(_0xf2276f){_0xf2276f['forEach'](function(_0x5c4691){if(_0x5c4691['TagIds']){_0x5c4691[_0x26f0('0x86')]=[];_0x5c4691[_0x26f0('0x85')][_0x26f0('0x48')](',')[_0x26f0('0x5a')](function(_0x52f5bd){_0x5c4691[_0x26f0('0x86')][_0x26f0('0x26')](_0x10de32[_0x52f5bd]);});}delete _0x5c4691[_0x26f0('0x85')];});_0x9fb463['rows']=_0xf2276f;return _0x9fb463;})[_0x26f0('0x19')](respondWithFilteredResult(_0x3910ab,_0x345878));})[_0x26f0('0x87')](handleError(_0x3910ab,null));};exports['destroy']=function(_0x56359d,_0x5beb13){return db[_0x26f0('0x7c')][_0x26f0('0x46')]({'where':{'id':_0x56359d[_0x26f0('0x88')]['id']}})[_0x26f0('0x19')](handleEntityNotFound(_0x5beb13,null))[_0x26f0('0x19')](removeEntity(_0x5beb13,null))[_0x26f0('0x87')](handleError(_0x5beb13,null));};exports[_0x26f0('0x21')]=function(_0x40cd1b,_0x5502af){return db[_0x26f0('0x7c')][_0x26f0('0x21')]()[_0x26f0('0x19')](function(_0x34445f){delete _0x34445f[_0x26f0('0x89')];for(var _0xa95441=0x0;_0xa95441{}\s\\|]/g,'-');_0x379c9d(null,util[_0x6cee('0x23')](_0x6cee('0x24'),path[_0x6cee('0x25')](_0x423cb2[_0x6cee('0x22')],path[_0x6cee('0x26')](_0x423cb2[_0x6cee('0x22')])),Date[_0x6cee('0x27')](),path[_0x6cee('0x26')](_0x423cb2[_0x6cee('0x22')])));}})});router['post'](_0x6cee('0x28'),upload[_0x6cee('0x29')](_0x6cee('0x2a')),controller[_0x6cee('0x2b')]);var upload=multer({'storage':multer[_0x6cee('0x1f')]({'destination':function(_0x1138c5,_0x294329,_0x4988ed){_0x4988ed(null,path[_0x6cee('0x20')](config[_0x6cee('0x2c')],'server/files/tmp'));},'filename':function(_0x368b2d,_0x39e424,_0x1d9f43){_0x39e424[_0x6cee('0x22')]=_0x39e424[_0x6cee('0x22')][_0x6cee('0x2d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1d9f43(null,util[_0x6cee('0x23')](_0x6cee('0x24'),path[_0x6cee('0x25')](_0x39e424[_0x6cee('0x22')],path[_0x6cee('0x26')](_0x39e424[_0x6cee('0x22')])),Date[_0x6cee('0x27')](),path[_0x6cee('0x26')](_0x39e424['originalname'])));}})});router[_0x6cee('0x1b')](_0x6cee('0x2e'),upload[_0x6cee('0x29')](_0x6cee('0x2a')),controller[_0x6cee('0x2f')]);router[_0x6cee('0x1b')]('/upload/:id',auth[_0x6cee('0xb')](),controller[_0x6cee('0x30')]);router[_0x6cee('0x31')]('/:id',auth[_0x6cee('0xb')](),controller[_0x6cee('0x32')]);router[_0x6cee('0x33')](_0x6cee('0xf'),auth[_0x6cee('0xb')](),controller[_0x6cee('0x34')]);module[_0x6cee('0x35')]=router; \ No newline at end of file +var _0x46e9=['root','server/files/tmp','originalname','format','basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','/upload','upload','/upload/:id','import','put','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/tags','/:id/hoppers','getHopperHistories','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','post','/merge','merge','create','/create_many','bulkCreate','diskStorage','join'];(function(_0x28dc4a,_0xa0bb3d){var _0xd8cd13=function(_0x43a81f){while(--_0x43a81f){_0x28dc4a['push'](_0x28dc4a['shift']());}};_0xd8cd13(++_0xa0bb3d);}(_0x46e9,0x1f3));var _0x946e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x46e9[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x946e('0x0'));var util=require(_0x946e('0x1'));var path=require(_0x946e('0x2'));var timeout=require('connect-timeout');var express=require(_0x946e('0x3'));var router=express[_0x946e('0x4')]();var fs_extra=require(_0x946e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x946e('0x6'));var config=require('../../config/environment');var controller=require('./cmContact.controller');router['get']('/',auth[_0x946e('0x7')](),controller[_0x946e('0x8')]);router[_0x946e('0x9')](_0x946e('0xa'),auth['isAuthenticated'](),controller[_0x946e('0xb')]);router[_0x946e('0x9')](_0x946e('0xc'),auth[_0x946e('0x7')](),controller[_0x946e('0xd')]);router[_0x946e('0x9')](_0x946e('0xe'),auth[_0x946e('0x7')](),controller['getTags']);router[_0x946e('0x9')](_0x946e('0xf'),auth[_0x946e('0x7')](),controller['getHoppers']);router[_0x946e('0x9')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x946e('0x10')]);router[_0x946e('0x9')]('/:id/hopper_finals',auth[_0x946e('0x7')](),controller[_0x946e('0x11')]);router[_0x946e('0x9')](_0x946e('0x12'),auth[_0x946e('0x7')](),controller[_0x946e('0x13')]);router['get'](_0x946e('0x14'),auth[_0x946e('0x7')](),controller['getJourney']);router[_0x946e('0x15')](_0x946e('0x16'),auth['isAuthenticated'](),controller[_0x946e('0x17')]);router[_0x946e('0x15')]('/',auth[_0x946e('0x7')](),controller[_0x946e('0x18')]);router[_0x946e('0x15')](_0x946e('0x19'),auth[_0x946e('0x7')](),controller[_0x946e('0x1a')]);router['post']('/:id/tags',auth[_0x946e('0x7')](),controller['setTags']);var upload=multer({'storage':multer[_0x946e('0x1b')]({'destination':function(_0x596a39,_0x29abcd,_0x1a6c6f){_0x1a6c6f(null,path[_0x946e('0x1c')](config[_0x946e('0x1d')],_0x946e('0x1e')));},'filename':function(_0x4319e9,_0x2ad741,_0x1ce07c){_0x2ad741['originalname']=_0x2ad741[_0x946e('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1ce07c(null,util[_0x946e('0x20')]('%s-%s%s',path[_0x946e('0x21')](_0x2ad741[_0x946e('0x1f')],path[_0x946e('0x22')](_0x2ad741[_0x946e('0x1f')])),Date[_0x946e('0x23')](),path[_0x946e('0x22')](_0x2ad741[_0x946e('0x1f')])));}})});router['post'](_0x946e('0x24'),upload[_0x946e('0x25')](_0x946e('0x26')),controller[_0x946e('0x27')]);var upload=multer({'storage':multer[_0x946e('0x1b')]({'destination':function(_0x8f4a2a,_0x94ce42,_0x2b787e){_0x2b787e(null,path[_0x946e('0x1c')](config['root'],_0x946e('0x1e')));},'filename':function(_0x519b48,_0x5999bb,_0x57ba13){_0x5999bb[_0x946e('0x1f')]=_0x5999bb[_0x946e('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57ba13(null,util['format'](_0x946e('0x28'),path[_0x946e('0x21')](_0x5999bb[_0x946e('0x1f')],path[_0x946e('0x22')](_0x5999bb[_0x946e('0x1f')])),Date['now'](),path['extname'](_0x5999bb['originalname'])));}})});router['post'](_0x946e('0x29'),upload[_0x946e('0x25')](_0x946e('0x26')),controller[_0x946e('0x2a')]);router['post'](_0x946e('0x2b'),auth[_0x946e('0x7')](),controller[_0x946e('0x2c')]);router[_0x946e('0x2d')](_0x946e('0xc'),auth[_0x946e('0x7')](),controller['update']);router[_0x946e('0x2e')](_0x946e('0xc'),auth[_0x946e('0x7')](),controller['destroy']);module[_0x946e('0x2f')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 33b6cfe..2b9ffc2 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 _0x0358=['getDataValue','alias','STRING','setDataValue','TEXT','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0358,0x1be));var _0x8035=function(_0x4a71c4,_0x2d691c){_0x4a71c4=_0x4a71c4-0x0;var _0x35c42b=_0x0358[_0x4a71c4];return _0x35c42b;};'use strict';var Sequelize=require(_0x8035('0x0'));var _=require(_0x8035('0x1'));module[_0x8035('0x2')]={'name':{'type':Sequelize[_0x8035('0x3')],'get':function(_0x569ca3){return this[_0x8035('0x4')](_0x8035('0x5'));}},'alias':{'type':Sequelize[_0x8035('0x6')],'allowNull':![],'set':function(_0x565ce6){this[_0x8035('0x7')]('alias',_0x565ce6?_0x565ce6:this[_0x8035('0x4')]('name'));}},'type':{'type':Sequelize[_0x8035('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x8035('0x8')]('long'),'get':function(){if(this[_0x8035('0x4')](_0x8035('0x9'))===_0x8035('0xa')){return JSON[_0x8035('0xb')](this[_0x8035('0x4')](_0x8035('0xc')));}else{return this[_0x8035('0x4')]('values');}},'set':function(_0x4185d8){if(Array[_0x8035('0xd')](_0x4185d8)){this['setDataValue'](_0x8035('0xc'),JSON[_0x8035('0xe')](_0x4185d8));}else{this[_0x8035('0x7')](_0x8035('0xc'),_0x4185d8);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x8035('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x8035('0x10')](_0x8035('0x11'))}}; \ No newline at end of file +var _0xf95b=['setDataValue','stringify','BOOLEAN','ENUM','sequelize','lodash','exports','VIRTUAL','getDataValue','STRING','alias','name','TEXT','long','type','select','values','isArray'];(function(_0x30f3b5,_0x6dcefc){var _0x3b0afb=function(_0x47b657){while(--_0x47b657){_0x30f3b5['push'](_0x30f3b5['shift']());}};_0x3b0afb(++_0x6dcefc);}(_0xf95b,0x136));var _0xbf95=function(_0x5352d0,_0x274093){_0x5352d0=_0x5352d0-0x0;var _0x2db0cd=_0xf95b[_0x5352d0];return _0x2db0cd;};'use strict';var Sequelize=require(_0xbf95('0x0'));var _=require(_0xbf95('0x1'));module[_0xbf95('0x2')]={'name':{'type':Sequelize[_0xbf95('0x3')],'get':function(_0x5eeee7){return this[_0xbf95('0x4')]('alias');}},'alias':{'type':Sequelize[_0xbf95('0x5')],'allowNull':![],'set':function(_0x5b3176){this['setDataValue'](_0xbf95('0x6'),_0x5b3176?_0x5b3176:this[_0xbf95('0x4')](_0xbf95('0x7')));}},'type':{'type':Sequelize[_0xbf95('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xbf95('0x8')](_0xbf95('0x9')),'get':function(){if(this['getDataValue'](_0xbf95('0xa'))===_0xbf95('0xb')){return JSON['parse'](this[_0xbf95('0x4')](_0xbf95('0xc')));}else{return this[_0xbf95('0x4')](_0xbf95('0xc'));}},'set':function(_0x46c082){if(Array[_0xbf95('0xd')](_0x46c082)){this[_0xbf95('0xe')](_0xbf95('0xc'),JSON[_0xbf95('0xf')](_0x46c082));}else{this[_0xbf95('0xe')](_0xbf95('0xc'),_0x46c082);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xbf95('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xbf95('0x11')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index bde62d9..013720a 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 _0xad3a=['status','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','CmCustomField','fieldName','key','model','differenceBy','map','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','includeAll','findAll','catch','show','params','rawAttributes','keys','find','update','body','create','sequelize','transaction','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','format','cf_%d','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count'];(function(_0x3074f1,_0x4901aa){var _0x149af8=function(_0x122725){while(--_0x122725){_0x3074f1['push'](_0x3074f1['shift']());}};_0x149af8(++_0x4901aa);}(_0xad3a,0x13d));var _0xaad3=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xad3a[_0x403c20];return _0x2b271a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaad3('0x0'));var jsonpatch=require(_0xaad3('0x1'));var rp=require(_0xaad3('0x2'));var moment=require(_0xaad3('0x3'));var BPromise=require(_0xaad3('0x4'));var Mustache=require(_0xaad3('0x5'));var util=require(_0xaad3('0x6'));var path=require(_0xaad3('0x7'));var sox=require(_0xaad3('0x8'));var csv=require(_0xaad3('0x9'));var ejs=require(_0xaad3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xaad3('0xb'));var crypto=require(_0xaad3('0xc'));var jsforce=require(_0xaad3('0xd'));var deskjs=require(_0xaad3('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaad3('0xf'));var Redis=require(_0xaad3('0x10'));var authService=require(_0xaad3('0x11'));var qs=require(_0xaad3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaad3('0x13'))(_0xaad3('0x14'));var utils=require('../../config/utils');var config=require(_0xaad3('0x15'));var licenseUtil=require(_0xaad3('0x16'));var db=require(_0xaad3('0x17'))['db'];function respondWithStatusCode(_0x580439,_0x2497dd){_0x2497dd=_0x2497dd||0xcc;return function(_0x3bd4b3){if(_0x3bd4b3){return _0x580439[_0xaad3('0x18')](_0x2497dd);}return _0x580439['status'](_0x2497dd)[_0xaad3('0x19')]();};}function respondWithResult(_0x7357a3,_0x21cd5d){_0x21cd5d=_0x21cd5d||0xc8;return function(_0x562b5f){if(_0x562b5f){return _0x7357a3['status'](_0x21cd5d)[_0xaad3('0x1a')](_0x562b5f);}};}function respondWithFilteredResult(_0x9633a8,_0x50837f){return function(_0x115173){if(_0x115173){var _0x22fa15=typeof _0x50837f[_0xaad3('0x1b')]===_0xaad3('0x1c')&&typeof _0x50837f[_0xaad3('0x1d')]===_0xaad3('0x1c');var _0x36f4f2=_0x115173[_0xaad3('0x1e')];var _0x2bb688=_0x22fa15?0x0:_0x50837f[_0xaad3('0x1b')];var _0x3c2a95=_0x22fa15?_0x115173[_0xaad3('0x1e')]:_0x50837f[_0xaad3('0x1b')]+_0x50837f['limit'];var _0x583a35;if(_0x3c2a95>=_0x36f4f2){_0x3c2a95=_0x36f4f2;_0x583a35=0xc8;}else{_0x583a35=0xce;}_0x9633a8[_0xaad3('0x1f')](_0x583a35);return _0x9633a8[_0xaad3('0x20')](_0xaad3('0x21'),_0x2bb688+'-'+_0x3c2a95+'/'+_0x36f4f2)[_0xaad3('0x1a')](_0x115173);}return null;};}function patchUpdates(_0xa669df){return function(_0x5cfa2c){try{jsonpatch[_0xaad3('0x22')](_0x5cfa2c,_0xa669df,!![]);}catch(_0x2fe14c){return BPromise[_0xaad3('0x23')](_0x2fe14c);}return _0x5cfa2c[_0xaad3('0x24')]();};}function saveUpdates(_0x26e33d,_0x2233ea){return function(_0x28b685){if(_0x28b685){return _0x28b685['update'](_0x26e33d)[_0xaad3('0x25')](function(_0xbcf297){return _0xbcf297;});}return null;};}function removeEntity(_0x46f4aa,_0x318bad){return function(_0x348df8){if(_0x348df8){return _0x348df8[_0xaad3('0x26')]()['then'](function(){_0x46f4aa[_0xaad3('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56255d,_0x463c1f){return function(_0x152f12){if(!_0x152f12){_0x56255d[_0xaad3('0x18')](0x194);}return _0x152f12;};}function handleError(_0x531424,_0x2dfeaa){_0x2dfeaa=_0x2dfeaa||0x1f4;return function(_0x1865d6){logger[_0xaad3('0x27')](_0x1865d6['stack']);if(_0x1865d6[_0xaad3('0x28')]){delete _0x1865d6[_0xaad3('0x28')];}_0x531424[_0xaad3('0x1f')](_0x2dfeaa)[_0xaad3('0x29')](_0x1865d6);};}exports[_0xaad3('0x2a')]=function(_0x49a968,_0x1ea29f){var _0x383f76={},_0xdb26f={},_0x1440b9={'count':0x0,'rows':[]};var _0x25b88b=_['map'](db[_0xaad3('0x2b')]['rawAttributes'],function(_0x476e67){return{'name':_0x476e67[_0xaad3('0x2c')],'type':_0x476e67['type'][_0xaad3('0x2d')]};});_0xdb26f[_0xaad3('0x2e')]=_[_0xaad3('0x2f')](_[_0xaad3('0x30')](_0x25b88b,_0xaad3('0x28')),[_0xaad3('0x28')]);_0xdb26f['query']=_['keys'](_0x49a968['query']);_0xdb26f[_0xaad3('0x31')]=_[_0xaad3('0x32')](_0xdb26f[_0xaad3('0x2e')],_0xdb26f[_0xaad3('0x33')]);_0x383f76[_0xaad3('0x34')]=_[_0xaad3('0x32')](_0xdb26f[_0xaad3('0x2e')],qs[_0xaad3('0x35')](_0x49a968[_0xaad3('0x33')][_0xaad3('0x35')]));_0x383f76[_0xaad3('0x34')]=_0x383f76['attributes'][_0xaad3('0x36')]?_0x383f76['attributes']:_0xdb26f[_0xaad3('0x2e')];if(!_0x49a968[_0xaad3('0x33')][_0xaad3('0x37')](_0xaad3('0x38'))){_0x383f76[_0xaad3('0x1d')]=qs[_0xaad3('0x1d')](_0x49a968[_0xaad3('0x33')][_0xaad3('0x1d')]);_0x383f76[_0xaad3('0x1b')]=qs[_0xaad3('0x1b')](_0x49a968[_0xaad3('0x33')][_0xaad3('0x1b')]);}_0x383f76[_0xaad3('0x39')]=qs['sort'](_0x49a968[_0xaad3('0x33')]['sort']);_0x383f76[_0xaad3('0x3a')]=qs[_0xaad3('0x31')](_[_0xaad3('0x3b')](_0x49a968[_0xaad3('0x33')],_0xdb26f['filters']),_0x25b88b);if(_0x49a968[_0xaad3('0x33')][_0xaad3('0x3c')]){_0x383f76[_0xaad3('0x3a')]=_[_0xaad3('0x3d')](_0x383f76[_0xaad3('0x3a')],{'$or':_[_0xaad3('0x30')](_0x25b88b,function(_0x265413){if(_0x265413[_0xaad3('0x3e')]!=='VIRTUAL'){var _0xfa6df1={};_0xfa6df1[_0x265413[_0xaad3('0x28')]]={'$like':'%'+_0x49a968[_0xaad3('0x33')][_0xaad3('0x3c')]+'%'};return _0xfa6df1;}})});}_0x383f76=_['merge']({},_0x383f76,_0x49a968['options']);var _0x355d3d={'where':_0x383f76[_0xaad3('0x3a')]};return db[_0xaad3('0x2b')][_0xaad3('0x1e')](_0x355d3d)['then'](function(_0x1a0d07){_0x1440b9['count']=_0x1a0d07;if(_0x49a968[_0xaad3('0x33')][_0xaad3('0x3f')]){_0x383f76['include']=[{'all':!![]}];}return db['CmCustomField'][_0xaad3('0x40')](_0x383f76);})[_0xaad3('0x25')](function(_0x175aeb){_0x1440b9['rows']=_0x175aeb;return _0x1440b9;})[_0xaad3('0x25')](respondWithFilteredResult(_0x1ea29f,_0x383f76))[_0xaad3('0x41')](handleError(_0x1ea29f,null));};exports[_0xaad3('0x42')]=function(_0x26a42a,_0x320148){var _0x37c049={'raw':!![],'where':{'id':_0x26a42a[_0xaad3('0x43')]['id']}},_0x128009={};_0x128009[_0xaad3('0x2e')]=_['keys'](db[_0xaad3('0x2b')][_0xaad3('0x44')]);_0x128009['query']=_[_0xaad3('0x45')](_0x26a42a[_0xaad3('0x33')]);_0x128009['filters']=_['intersection'](_0x128009[_0xaad3('0x2e')],_0x128009[_0xaad3('0x33')]);_0x37c049[_0xaad3('0x34')]=_[_0xaad3('0x32')](_0x128009['model'],qs['fields'](_0x26a42a['query']['fields']));_0x37c049[_0xaad3('0x34')]=_0x37c049[_0xaad3('0x34')][_0xaad3('0x36')]?_0x37c049['attributes']:_0x128009[_0xaad3('0x2e')];if(_0x26a42a[_0xaad3('0x33')][_0xaad3('0x3f')]){_0x37c049['include']=[{'all':!![]}];}_0x37c049=_[_0xaad3('0x3d')]({},_0x37c049,_0x26a42a['options']);return db[_0xaad3('0x2b')][_0xaad3('0x46')](_0x37c049)['then'](handleEntityNotFound(_0x320148,null))[_0xaad3('0x25')](respondWithResult(_0x320148,null))['catch'](handleError(_0x320148,null));};exports[_0xaad3('0x47')]=function(_0x2f156a,_0x2d0bb6){if(_0x2f156a['body']['id']){delete _0x2f156a[_0xaad3('0x48')]['id'];}return db[_0xaad3('0x2b')][_0xaad3('0x46')]({'where':{'id':_0x2f156a[_0xaad3('0x43')]['id']}})[_0xaad3('0x25')](handleEntityNotFound(_0x2d0bb6,null))[_0xaad3('0x25')](saveUpdates(_0x2f156a['body'],null))[_0xaad3('0x25')](respondWithResult(_0x2d0bb6,null))['catch'](handleError(_0x2d0bb6,null));};exports[_0xaad3('0x26')]=function(_0x5c5f62,_0x212c3a){return db[_0xaad3('0x2b')]['find']({'where':{'id':_0x5c5f62['params']['id']}})[_0xaad3('0x25')](handleEntityNotFound(_0x212c3a,null))[_0xaad3('0x25')](removeEntity(_0x212c3a,null))[_0xaad3('0x41')](handleError(_0x212c3a,null));};exports[_0xaad3('0x49')]=function(_0x5d20f,_0x2598b4){var _0x9996b1;return db[_0xaad3('0x4a')][_0xaad3('0x4b')](function(_0x5c0bd3){return db[_0xaad3('0x2b')][_0xaad3('0x49')](_0x5d20f['body'],{'transaction':_0x5c0bd3})['then'](function(_0x1761a1){_0x9996b1=_0x1761a1;var _0x2d92e2={'type':db[_0xaad3('0x4c')][_0xaad3('0x4d')],'transaction':_0x5c0bd3};switch(_0x5d20f['body']['type']){case _0xaad3('0x4e'):_0x2d92e2[_0xaad3('0x3e')]=db[_0xaad3('0x4c')][_0xaad3('0x4d')];break;case _0xaad3('0x4f'):_0x2d92e2['type']=db[_0xaad3('0x4c')]['INTEGER'];break;case _0xaad3('0x50'):_0x2d92e2[_0xaad3('0x3e')]=db[_0xaad3('0x4c')][_0xaad3('0x51')];_0x2d92e2[_0xaad3('0x52')]=![];break;default:}return db[_0xaad3('0x4a')][_0xaad3('0x53')]['addColumn'](_0xaad3('0x54'),util[_0xaad3('0x55')](_0xaad3('0x56'),_0x9996b1['id']),_0x2d92e2);})['then'](function(){return _0x9996b1;});})[_0xaad3('0x25')](respondWithResult(_0x2598b4,0xc9))['catch'](handleError(_0x2598b4,null));}; \ No newline at end of file +var _0x2439=['defaultValue','queryInterface','addColumn','cm_contacts','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','body','find','params','create','sequelize','Sequelize','TEXT','text','number','switch','BOOLEAN'];(function(_0x2bc0b8,_0x1f39c3){var _0x607478=function(_0x5c5188){while(--_0x5c5188){_0x2bc0b8['push'](_0x2bc0b8['shift']());}};_0x607478(++_0x1f39c3);}(_0x2439,0x155));var _0x9243=function(_0x3a42fa,_0x55e471){_0x3a42fa=_0x3a42fa-0x0;var _0x30dcba=_0x2439[_0x3a42fa];return _0x30dcba;};'use strict';var emlformat=require(_0x9243('0x0'));var rimraf=require(_0x9243('0x1'));var zipdir=require(_0x9243('0x2'));var jsonpatch=require(_0x9243('0x3'));var rp=require(_0x9243('0x4'));var moment=require(_0x9243('0x5'));var BPromise=require(_0x9243('0x6'));var Mustache=require('mustache');var util=require(_0x9243('0x7'));var path=require('path');var sox=require(_0x9243('0x8'));var csv=require(_0x9243('0x9'));var ejs=require(_0x9243('0xa'));var fs=require('fs');var fs_extra=require(_0x9243('0xb'));var _=require(_0x9243('0xc'));var squel=require(_0x9243('0xd'));var crypto=require(_0x9243('0xe'));var jsforce=require(_0x9243('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9243('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9243('0x10'));var as=require(_0x9243('0x11'));var hardwareService=require(_0x9243('0x12'));var logger=require(_0x9243('0x13'))('api');var utils=require(_0x9243('0x14'));var config=require(_0x9243('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9243('0x16'))['db'];function respondWithStatusCode(_0x2cb228,_0x1c0227){_0x1c0227=_0x1c0227||0xcc;return function(_0x5bd555){if(_0x5bd555){return _0x2cb228['sendStatus'](_0x1c0227);}return _0x2cb228['status'](_0x1c0227)[_0x9243('0x17')]();};}function respondWithResult(_0x33b531,_0x57e9a0){_0x57e9a0=_0x57e9a0||0xc8;return function(_0x3043ed){if(_0x3043ed){return _0x33b531[_0x9243('0x18')](_0x57e9a0)[_0x9243('0x19')](_0x3043ed);}};}function respondWithFilteredResult(_0xd7e6c0,_0x7d63d2){return function(_0x4413d7){if(_0x4413d7){var _0x293fbd=typeof _0x7d63d2[_0x9243('0x1a')]===_0x9243('0x1b')&&typeof _0x7d63d2[_0x9243('0x1c')]===_0x9243('0x1b');var _0x57c91f=_0x4413d7['count'];var _0x47c7ef=_0x293fbd?0x0:_0x7d63d2[_0x9243('0x1a')];var _0x4aceac=_0x293fbd?_0x4413d7[_0x9243('0x1d')]:_0x7d63d2['offset']+_0x7d63d2[_0x9243('0x1c')];var _0x1afa2e;if(_0x4aceac>=_0x57c91f){_0x4aceac=_0x57c91f;_0x1afa2e=0xc8;}else{_0x1afa2e=0xce;}_0xd7e6c0[_0x9243('0x18')](_0x1afa2e);return _0xd7e6c0[_0x9243('0x1e')]('Content-Range',_0x47c7ef+'-'+_0x4aceac+'/'+_0x57c91f)[_0x9243('0x19')](_0x4413d7);}return null;};}function patchUpdates(_0x343518){return function(_0xec7df3){try{jsonpatch[_0x9243('0x1f')](_0xec7df3,_0x343518,!![]);}catch(_0x55af0b){return BPromise[_0x9243('0x20')](_0x55af0b);}return _0xec7df3[_0x9243('0x21')]();};}function saveUpdates(_0x19b9ad,_0xeb6ce5){return function(_0x3504c7){if(_0x3504c7){return _0x3504c7[_0x9243('0x22')](_0x19b9ad)[_0x9243('0x23')](function(_0x1e7fb1){return _0x1e7fb1;});}return null;};}function removeEntity(_0x1d8f37,_0x2fc7df){return function(_0x3e67bc){if(_0x3e67bc){return _0x3e67bc[_0x9243('0x24')]()['then'](function(){_0x1d8f37['status'](0xcc)[_0x9243('0x17')]();});}};}function handleEntityNotFound(_0x237929,_0x30f7c1){return function(_0x5c242c){if(!_0x5c242c){_0x237929['sendStatus'](0x194);}return _0x5c242c;};}function handleError(_0x4b4b70,_0x396164){_0x396164=_0x396164||0x1f4;return function(_0x3b967d){logger[_0x9243('0x25')](_0x3b967d[_0x9243('0x26')]);if(_0x3b967d[_0x9243('0x27')]){delete _0x3b967d[_0x9243('0x27')];}_0x4b4b70[_0x9243('0x18')](_0x396164)[_0x9243('0x28')](_0x3b967d);};}exports[_0x9243('0x29')]=function(_0x1e7aa9,_0x4ca0ab){var _0x2c6c2c={},_0x2b59fd={},_0x189e9e={'count':0x0,'rows':[]};var _0x5d63d0=_[_0x9243('0x2a')](db[_0x9243('0x2b')][_0x9243('0x2c')],function(_0x3d7cd6){return{'name':_0x3d7cd6['fieldName'],'type':_0x3d7cd6['type'][_0x9243('0x2d')]};});_0x2b59fd[_0x9243('0x2e')]=_['differenceBy'](_['map'](_0x5d63d0,_0x9243('0x27')),['name']);_0x2b59fd[_0x9243('0x2f')]=_[_0x9243('0x30')](_0x1e7aa9['query']);_0x2b59fd[_0x9243('0x31')]=_['intersection'](_0x2b59fd[_0x9243('0x2e')],_0x2b59fd['query']);_0x2c6c2c['attributes']=_[_0x9243('0x32')](_0x2b59fd[_0x9243('0x2e')],qs[_0x9243('0x33')](_0x1e7aa9[_0x9243('0x2f')]['fields']));_0x2c6c2c[_0x9243('0x34')]=_0x2c6c2c[_0x9243('0x34')][_0x9243('0x35')]?_0x2c6c2c['attributes']:_0x2b59fd['model'];if(!_0x1e7aa9[_0x9243('0x2f')]['hasOwnProperty'](_0x9243('0x36'))){_0x2c6c2c[_0x9243('0x1c')]=qs['limit'](_0x1e7aa9['query'][_0x9243('0x1c')]);_0x2c6c2c[_0x9243('0x1a')]=qs[_0x9243('0x1a')](_0x1e7aa9[_0x9243('0x2f')][_0x9243('0x1a')]);}_0x2c6c2c['order']=qs['sort'](_0x1e7aa9[_0x9243('0x2f')][_0x9243('0x37')]);_0x2c6c2c[_0x9243('0x38')]=qs[_0x9243('0x31')](_[_0x9243('0x39')](_0x1e7aa9[_0x9243('0x2f')],_0x2b59fd[_0x9243('0x31')]),_0x5d63d0);if(_0x1e7aa9[_0x9243('0x2f')]['filter']){_0x2c6c2c[_0x9243('0x38')]=_[_0x9243('0x3a')](_0x2c6c2c['where'],{'$or':_[_0x9243('0x2a')](_0x5d63d0,function(_0x12285d){if(_0x12285d[_0x9243('0x3b')]!==_0x9243('0x3c')){var _0xe46a7a={};_0xe46a7a[_0x12285d[_0x9243('0x27')]]={'$like':'%'+_0x1e7aa9['query'][_0x9243('0x3d')]+'%'};return _0xe46a7a;}})});}_0x2c6c2c=_[_0x9243('0x3a')]({},_0x2c6c2c,_0x1e7aa9[_0x9243('0x3e')]);var _0x36ab7f={'where':_0x2c6c2c['where']};return db['CmCustomField']['count'](_0x36ab7f)[_0x9243('0x23')](function(_0x189df1){_0x189e9e['count']=_0x189df1;if(_0x1e7aa9[_0x9243('0x2f')][_0x9243('0x3f')]){_0x2c6c2c[_0x9243('0x40')]=[{'all':!![]}];}return db[_0x9243('0x2b')]['findAll'](_0x2c6c2c);})[_0x9243('0x23')](function(_0x5f19cb){_0x189e9e[_0x9243('0x41')]=_0x5f19cb;return _0x189e9e;})['then'](respondWithFilteredResult(_0x4ca0ab,_0x2c6c2c))[_0x9243('0x42')](handleError(_0x4ca0ab,null));};exports[_0x9243('0x43')]=function(_0x398bbc,_0x436cd0){var _0x3961d8={'raw':!![],'where':{'id':_0x398bbc['params']['id']}},_0xe4e956={};_0xe4e956['model']=_[_0x9243('0x30')](db[_0x9243('0x2b')]['rawAttributes']);_0xe4e956[_0x9243('0x2f')]=_['keys'](_0x398bbc['query']);_0xe4e956[_0x9243('0x31')]=_[_0x9243('0x32')](_0xe4e956['model'],_0xe4e956[_0x9243('0x2f')]);_0x3961d8[_0x9243('0x34')]=_[_0x9243('0x32')](_0xe4e956[_0x9243('0x2e')],qs[_0x9243('0x33')](_0x398bbc['query']['fields']));_0x3961d8['attributes']=_0x3961d8['attributes'][_0x9243('0x35')]?_0x3961d8[_0x9243('0x34')]:_0xe4e956[_0x9243('0x2e')];if(_0x398bbc[_0x9243('0x2f')]['includeAll']){_0x3961d8[_0x9243('0x40')]=[{'all':!![]}];}_0x3961d8=_[_0x9243('0x3a')]({},_0x3961d8,_0x398bbc[_0x9243('0x3e')]);return db[_0x9243('0x2b')]['find'](_0x3961d8)[_0x9243('0x23')](handleEntityNotFound(_0x436cd0,null))['then'](respondWithResult(_0x436cd0,null))['catch'](handleError(_0x436cd0,null));};exports[_0x9243('0x22')]=function(_0x2cfe2d,_0x25337b){if(_0x2cfe2d['body']['id']){delete _0x2cfe2d[_0x9243('0x44')]['id'];}return db[_0x9243('0x2b')][_0x9243('0x45')]({'where':{'id':_0x2cfe2d['params']['id']}})[_0x9243('0x23')](handleEntityNotFound(_0x25337b,null))[_0x9243('0x23')](saveUpdates(_0x2cfe2d[_0x9243('0x44')],null))[_0x9243('0x23')](respondWithResult(_0x25337b,null))[_0x9243('0x42')](handleError(_0x25337b,null));};exports[_0x9243('0x24')]=function(_0x357dbf,_0x3f746c){return db[_0x9243('0x2b')][_0x9243('0x45')]({'where':{'id':_0x357dbf[_0x9243('0x46')]['id']}})['then'](handleEntityNotFound(_0x3f746c,null))[_0x9243('0x23')](removeEntity(_0x3f746c,null))[_0x9243('0x42')](handleError(_0x3f746c,null));};exports[_0x9243('0x47')]=function(_0x44db03,_0x3233ff){var _0x124f9e;return db[_0x9243('0x48')]['transaction'](function(_0x3862c2){return db[_0x9243('0x2b')][_0x9243('0x47')](_0x44db03[_0x9243('0x44')],{'transaction':_0x3862c2})[_0x9243('0x23')](function(_0x318a89){_0x124f9e=_0x318a89;var _0x1fd9d8={'type':db[_0x9243('0x49')][_0x9243('0x4a')],'transaction':_0x3862c2};switch(_0x44db03['body']['type']){case _0x9243('0x4b'):_0x1fd9d8['type']=db[_0x9243('0x49')][_0x9243('0x4a')];break;case _0x9243('0x4c'):_0x1fd9d8[_0x9243('0x3b')]=db[_0x9243('0x49')]['INTEGER'];break;case _0x9243('0x4d'):_0x1fd9d8[_0x9243('0x3b')]=db[_0x9243('0x49')][_0x9243('0x4e')];_0x1fd9d8[_0x9243('0x4f')]=![];break;default:}return db[_0x9243('0x48')][_0x9243('0x50')][_0x9243('0x51')](_0x9243('0x52'),util['format'](_0x9243('0x53'),_0x124f9e['id']),_0x1fd9d8);})[_0x9243('0x23')](function(){return _0x124f9e;});})[_0x9243('0x23')](respondWithResult(_0x3233ff,0xc9))[_0x9243('0x42')](handleError(_0x3233ff,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 8f0651a..ae2d0c7 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 _0x8e15=['./cmCustomField.attributes','cm_custom_fields','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8e15,0x1ba));var _0x58e1=function(_0x28e4ec,_0x22f691){_0x28e4ec=_0x28e4ec-0x0;var _0x161a64=_0x8e15[_0x28e4ec];return _0x161a64;};'use strict';var _=require('lodash');var util=require(_0x58e1('0x0'));var logger=require(_0x58e1('0x1'))(_0x58e1('0x2'));var moment=require('moment');var BPromise=require(_0x58e1('0x3'));var rp=require(_0x58e1('0x4'));var fs=require('fs');var path=require(_0x58e1('0x5'));var rimraf=require(_0x58e1('0x6'));var config=require(_0x58e1('0x7'));var attributes=require(_0x58e1('0x8'));module['exports']=function(_0x3dfa1c,_0x2558f1){return _0x3dfa1c['define']('CmCustomField',attributes,{'tableName':_0x58e1('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa85=['CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define'];(function(_0x445970,_0x1098e1){var _0x5d01bf=function(_0x1f39f9){while(--_0x1f39f9){_0x445970['push'](_0x445970['shift']());}};_0x5d01bf(++_0x1098e1);}(_0xfa85,0x16e));var _0x5fa8=function(_0x100c7a,_0x4d5609){_0x100c7a=_0x100c7a-0x0;var _0x1dec1a=_0xfa85[_0x100c7a];return _0x1dec1a;};'use strict';var _=require(_0x5fa8('0x0'));var util=require('util');var logger=require(_0x5fa8('0x1'))(_0x5fa8('0x2'));var moment=require(_0x5fa8('0x3'));var BPromise=require(_0x5fa8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5fa8('0x5'));var rimraf=require(_0x5fa8('0x6'));var config=require(_0x5fa8('0x7'));var attributes=require(_0x5fa8('0x8'));module[_0x5fa8('0x9')]=function(_0x51b45d,_0x5278a6){return _0x51b45d[_0x5fa8('0xa')](_0x5fa8('0xb'),attributes,{'tableName':_0x5fa8('0xc'),'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 7e80b65..e39fa1e 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 _0xaae6=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','util','moment'];(function(_0xacbfa5,_0xfe352){var _0x5a8a3d=function(_0x28d101){while(--_0x28d101){_0xacbfa5['push'](_0xacbfa5['shift']());}};_0x5a8a3d(++_0xfe352);}(_0xaae6,0xfb));var _0x6aae=function(_0x384cee,_0x1add3c){_0x384cee=_0x384cee-0x0;var _0x26cbad=_0xaae6[_0x384cee];return _0x26cbad;};'use strict';var _=require('lodash');var util=require(_0x6aae('0x0'));var moment=require(_0x6aae('0x1'));var BPromise=require('bluebird');var rs=require(_0x6aae('0x2'));var fs=require('fs');var Redis=require(_0x6aae('0x3'));var db=require(_0x6aae('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6aae('0x5'))(_0x6aae('0x6'));var config=require(_0x6aae('0x7'));var jayson=require(_0x6aae('0x8'));var client=jayson[_0x6aae('0x9')][_0x6aae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf68118,_0x375078,_0x2ccf8b){return new BPromise(function(_0x13c338,_0x4a498f){return client[_0x6aae('0xb')](_0xf68118,_0x2ccf8b)[_0x6aae('0xc')](function(_0x555f3c){logger[_0x6aae('0xd')]('CmCustomField,\x20%s,\x20%s',_0x375078,'request\x20sent');logger[_0x6aae('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x375078,_0x6aae('0xf'),JSON[_0x6aae('0x10')](_0x555f3c));if(_0x555f3c[_0x6aae('0x11')]){if(_0x555f3c[_0x6aae('0x11')][_0x6aae('0x12')]===0x1f4){logger[_0x6aae('0x11')](_0x6aae('0x13'),_0x375078,_0x555f3c[_0x6aae('0x11')][_0x6aae('0x14')]);return _0x4a498f(_0x555f3c[_0x6aae('0x11')][_0x6aae('0x14')]);}logger[_0x6aae('0x11')](_0x6aae('0x13'),_0x375078,_0x555f3c[_0x6aae('0x11')][_0x6aae('0x14')]);return _0x13c338(_0x555f3c[_0x6aae('0x11')][_0x6aae('0x14')]);}else{logger[_0x6aae('0xd')](_0x6aae('0x13'),_0x375078,_0x6aae('0xf'));_0x13c338(_0x555f3c[_0x6aae('0x15')][_0x6aae('0x14')]);}})[_0x6aae('0x16')](function(_0x46dd21){logger[_0x6aae('0x11')](_0x6aae('0x13'),_0x375078,_0x46dd21);_0x4a498f(_0x46dd21);});});} \ No newline at end of file +var _0x1a9d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3b4ae,_0x434d90){var _0x1617bf=function(_0x5500cd){while(--_0x5500cd){_0x3b4ae['push'](_0x3b4ae['shift']());}};_0x1617bf(++_0x434d90);}(_0x1a9d,0xfe));var _0xd1a9=function(_0x36de17,_0x8e5b13){_0x36de17=_0x36de17-0x0;var _0x52ef47=_0x1a9d[_0x36de17];return _0x52ef47;};'use strict';var _=require(_0xd1a9('0x0'));var util=require(_0xd1a9('0x1'));var moment=require(_0xd1a9('0x2'));var BPromise=require(_0xd1a9('0x3'));var rs=require(_0xd1a9('0x4'));var fs=require('fs');var Redis=require(_0xd1a9('0x5'));var db=require(_0xd1a9('0x6'))['db'];var utils=require(_0xd1a9('0x7'));var logger=require(_0xd1a9('0x8'))(_0xd1a9('0x9'));var config=require(_0xd1a9('0xa'));var jayson=require(_0xd1a9('0xb'));var client=jayson[_0xd1a9('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38b3b1,_0x3c6f56,_0x1f19d4){return new BPromise(function(_0x26fc08,_0x443b5a){return client[_0xd1a9('0xd')](_0x38b3b1,_0x1f19d4)[_0xd1a9('0xe')](function(_0x54ad01){logger[_0xd1a9('0xf')](_0xd1a9('0x10'),_0x3c6f56,_0xd1a9('0x11'));logger[_0xd1a9('0x12')](_0xd1a9('0x13'),_0x3c6f56,'request\x20sent',JSON[_0xd1a9('0x14')](_0x54ad01));if(_0x54ad01[_0xd1a9('0x15')]){if(_0x54ad01[_0xd1a9('0x15')][_0xd1a9('0x16')]===0x1f4){logger[_0xd1a9('0x15')](_0xd1a9('0x10'),_0x3c6f56,_0x54ad01[_0xd1a9('0x15')][_0xd1a9('0x17')]);return _0x443b5a(_0x54ad01[_0xd1a9('0x15')][_0xd1a9('0x17')]);}logger[_0xd1a9('0x15')]('CmCustomField,\x20%s,\x20%s',_0x3c6f56,_0x54ad01[_0xd1a9('0x15')][_0xd1a9('0x17')]);return _0x26fc08(_0x54ad01[_0xd1a9('0x15')][_0xd1a9('0x17')]);}else{logger[_0xd1a9('0xf')](_0xd1a9('0x10'),_0x3c6f56,_0xd1a9('0x11'));_0x26fc08(_0x54ad01[_0xd1a9('0x18')]['message']);}})[_0xd1a9('0x19')](function(_0x3744d7){logger[_0xd1a9('0x15')](_0xd1a9('0x10'),_0x3c6f56,_0x3744d7);_0x443b5a(_0x3744d7);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 9d6754d..efebec1 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 _0x2fa9=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller','isAuthenticated','/:id','show','post','create','put','update','destroy'];(function(_0x14fe41,_0xe95df5){var _0x341c4b=function(_0x3d3db5){while(--_0x3d3db5){_0x14fe41['push'](_0x14fe41['shift']());}};_0x341c4b(++_0xe95df5);}(_0x2fa9,0x91));var _0x92fa=function(_0x2030a0,_0x2ef5dd){_0x2030a0=_0x2030a0-0x0;var _0x4860bc=_0x2fa9[_0x2030a0];return _0x4860bc;};'use strict';var multer=require(_0x92fa('0x0'));var util=require(_0x92fa('0x1'));var path=require('path');var timeout=require(_0x92fa('0x2'));var express=require(_0x92fa('0x3'));var router=express[_0x92fa('0x4')]();var fs_extra=require(_0x92fa('0x5'));var auth=require(_0x92fa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x92fa('0x7'));var controller=require(_0x92fa('0x8'));router['get']('/',auth[_0x92fa('0x9')](),controller['index']);router['get'](_0x92fa('0xa'),auth[_0x92fa('0x9')](),controller[_0x92fa('0xb')]);router[_0x92fa('0xc')]('/',auth['isAuthenticated'](),controller[_0x92fa('0xd')]);router[_0x92fa('0xe')](_0x92fa('0xa'),auth['isAuthenticated'](),controller[_0x92fa('0xf')]);router['delete'](_0x92fa('0xa'),auth[_0x92fa('0x9')](),controller[_0x92fa('0x10')]);module[_0x92fa('0x11')]=router; \ No newline at end of file +var _0xd90b=['delete','destroy','multer','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x3430f0,_0x528692){var _0xabeb3f=function(_0xdc752b){while(--_0xdc752b){_0x3430f0['push'](_0x3430f0['shift']());}};_0xabeb3f(++_0x528692);}(_0xd90b,0xbd));var _0xbd90=function(_0x3d75be,_0x434aae){_0x3d75be=_0x3d75be-0x0;var _0xf8afe7=_0xd90b[_0x3d75be];return _0xf8afe7;};'use strict';var multer=require(_0xbd90('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbd90('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbd90('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xbd90('0x3'));var config=require(_0xbd90('0x4'));var controller=require(_0xbd90('0x5'));router[_0xbd90('0x6')]('/',auth[_0xbd90('0x7')](),controller[_0xbd90('0x8')]);router['get'](_0xbd90('0x9'),auth[_0xbd90('0x7')](),controller[_0xbd90('0xa')]);router[_0xbd90('0xb')]('/',auth[_0xbd90('0x7')](),controller[_0xbd90('0xc')]);router[_0xbd90('0xd')](_0xbd90('0x9'),auth[_0xbd90('0x7')](),controller[_0xbd90('0xe')]);router[_0xbd90('0xf')]('/:id',auth[_0xbd90('0x7')](),controller[_0xbd90('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 29bc394..f1b42e2 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 _0x7b0f=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','exports','STRING','BOOLEAN','DATE','format'];(function(_0x2f05f8,_0x2cda12){var _0x102b8b=function(_0x14c476){while(--_0x14c476){_0x2f05f8['push'](_0x2f05f8['shift']());}};_0x102b8b(++_0x2cda12);}(_0x7b0f,0x143));var _0xf7b0=function(_0x4536e1,_0x2a0402){_0x4536e1=_0x4536e1-0x0;var _0x2cca07=_0x7b0f[_0x4536e1];return _0x2cca07;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xf7b0('0x0')]={'phone':{'type':Sequelize[_0xf7b0('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0xf7b0('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xf7b0('0x3')],'defaultValue':moment()[_0xf7b0('0x4')](_0xf7b0('0x5'))},'countbusyretry':{'type':Sequelize[_0xf7b0('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf7b0('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xf7b0('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf7b0('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf7b0('0x3')]},'priority':{'type':Sequelize[_0xf7b0('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xf7b0('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xf7b0('0x6')],'unique':_0xf7b0('0x7')},'ListId':{'type':Sequelize[_0xf7b0('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xf7b0('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xf7b0('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xf7b0('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf7b0('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf7b0('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf7b0('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf7b0('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6544=['moment','sequelize','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','STRING','UNSIGNED','contactListQueue'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x6544,0x1cc));var _0x4654=function(_0xa720e9,_0xf162db){_0xa720e9=_0xa720e9-0x0;var _0x902310=_0x6544[_0xa720e9];return _0x902310;};'use strict';var moment=require(_0x4654('0x0'));var Sequelize=require(_0x4654('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x4654('0x2')],'defaultValue':moment()[_0x4654('0x3')](_0x4654('0x4'))},'countbusyretry':{'type':Sequelize[_0x4654('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4654('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4654('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4654('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4654('0x2')]},'priority':{'type':Sequelize[_0x4654('0x5')](0x2)[_0x4654('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4654('0x6')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4654('0x5')],'unique':_0x4654('0x9')},'ListId':{'type':Sequelize[_0x4654('0x5')],'unique':_0x4654('0x9')},'UserId':{'type':Sequelize[_0x4654('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x4654('0x5')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x4654('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x4654('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4654('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4654('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4654('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4654('0x5')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 1a299d9..6602cf6 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 _0x49e9=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','index','CmHopper','rawAttributes','map','query','keys','filters','intersection','model','concat','$gt','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','options','includeAll','include','rows','catch','show','params','create','update','body','find','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','state','statedesc','deleted','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','CmContact','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','Contact','CmCompany','Company','CmList','Queue','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x1c9d34,_0x1d8b2c){var _0x2b26d0=function(_0x89ec9b){while(--_0x89ec9b){_0x1c9d34['push'](_0x1c9d34['shift']());}};_0x2b26d0(++_0x1d8b2c);}(_0x49e9,0x10f));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x949e('0x0'));var rimraf=require(_0x949e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x949e('0x2'));var rp=require(_0x949e('0x3'));var moment=require(_0x949e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x949e('0x5'));var path=require('path');var sox=require(_0x949e('0x6'));var csv=require(_0x949e('0x7'));var ejs=require(_0x949e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x949e('0x9'));var squel=require(_0x949e('0xa'));var crypto=require(_0x949e('0xb'));var jsforce=require(_0x949e('0xc'));var deskjs=require(_0x949e('0xd'));var toCsv=require(_0x949e('0x7'));var querystring=require(_0x949e('0xe'));var Papa=require('papaparse');var Redis=require(_0x949e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x949e('0x10'));var as=require(_0x949e('0x11'));var hardwareService=require(_0x949e('0x12'));var logger=require('../../config/logger')(_0x949e('0x13'));var utils=require(_0x949e('0x14'));var config=require(_0x949e('0x15'));var licenseUtil=require(_0x949e('0x16'));var db=require(_0x949e('0x17'))['db'];function respondWithStatusCode(_0x253d5e,_0x1871a5){_0x1871a5=_0x1871a5||0xcc;return function(_0x17d1f3){if(_0x17d1f3){return _0x253d5e[_0x949e('0x18')](_0x1871a5);}return _0x253d5e[_0x949e('0x19')](_0x1871a5)[_0x949e('0x1a')]();};}function respondWithResult(_0x7a8954,_0x3e0e54){_0x3e0e54=_0x3e0e54||0xc8;return function(_0x7f8be2){if(_0x7f8be2){return _0x7a8954[_0x949e('0x19')](_0x3e0e54)['json'](_0x7f8be2);}};}function respondWithFilteredResult(_0x257981,_0x3d81cd){return function(_0x587bff){if(_0x587bff){var _0xf1f41a=typeof _0x3d81cd['offset']===_0x949e('0x1b')&&typeof _0x3d81cd[_0x949e('0x1c')]==='undefined';var _0x37fd96=_0x587bff[_0x949e('0x1d')];var _0x43498d=_0xf1f41a?0x0:_0x3d81cd[_0x949e('0x1e')];var _0x20333c=_0xf1f41a?_0x587bff['count']:_0x3d81cd[_0x949e('0x1e')]+_0x3d81cd[_0x949e('0x1c')];var _0x476fa8;if(_0x20333c>=_0x37fd96){_0x20333c=_0x37fd96;_0x476fa8=0xc8;}else{_0x476fa8=0xce;}_0x257981[_0x949e('0x19')](_0x476fa8);return _0x257981[_0x949e('0x1f')](_0x949e('0x20'),_0x43498d+'-'+_0x20333c+'/'+_0x37fd96)[_0x949e('0x21')](_0x587bff);}return null;};}function patchUpdates(_0x2f21bd){return function(_0x104740){try{jsonpatch[_0x949e('0x22')](_0x104740,_0x2f21bd,!![]);}catch(_0x23fc20){return BPromise[_0x949e('0x23')](_0x23fc20);}return _0x104740[_0x949e('0x24')]();};}function saveUpdates(_0x1927ab,_0x199d53){return function(_0x2e81f2){if(_0x2e81f2){return _0x2e81f2['update'](_0x1927ab)[_0x949e('0x25')](function(_0x44ffb4){return _0x44ffb4;});}return null;};}function removeEntity(_0x5572ae,_0x48a1d1){return function(_0x23b38e){if(_0x23b38e){return _0x23b38e[_0x949e('0x26')]()[_0x949e('0x25')](function(){_0x5572ae[_0x949e('0x19')](0xcc)[_0x949e('0x1a')]();});}};}function handleEntityNotFound(_0x1185b3,_0x29e07b){return function(_0x255b11){if(!_0x255b11){_0x1185b3[_0x949e('0x18')](0x194);}return _0x255b11;};}function handleError(_0x20258c,_0x5dcc46){_0x5dcc46=_0x5dcc46||0x1f4;return function(_0x212224){logger[_0x949e('0x27')](_0x212224['stack']);if(_0x212224[_0x949e('0x28')]){delete _0x212224[_0x949e('0x28')];}_0x20258c['status'](_0x5dcc46)[_0x949e('0x29')](_0x212224);};}exports[_0x949e('0x2a')]=function(_0x5b9f28,_0x1867d9){var _0x5b2b0b={},_0x5e6e34={},_0x4e169d={'count':0x0,'rows':[]};var _0x54ad5d=_['map'](db[_0x949e('0x2b')][_0x949e('0x2c')],function(_0x3051ec){return{'name':_0x3051ec['fieldName'],'type':_0x3051ec['type']['key']};});_0x5e6e34['model']=_[_0x949e('0x2d')](_0x54ad5d,_0x949e('0x28'));_0x5e6e34[_0x949e('0x2e')]=_[_0x949e('0x2f')](_0x5b9f28['query']);_0x5e6e34[_0x949e('0x30')]=_[_0x949e('0x31')](_0x5e6e34[_0x949e('0x32')],_0x5e6e34['query']);_0x5e6e34[_0x949e('0x30')]=_[_0x949e('0x33')](_0x5e6e34[_0x949e('0x30')],['$and','$or',_0x949e('0x34'),_0x949e('0x35'),_0x949e('0x36'),_0x949e('0x37'),'$ne',_0x949e('0x38'),_0x949e('0x39'),_0x949e('0x3a'),_0x949e('0x3b'),_0x949e('0x3c'),_0x949e('0x3d'),_0x949e('0x3e'),_0x949e('0x3f'),'$iLike','$notILike',_0x949e('0x3e'),'$overlap','$contains',_0x949e('0x40'),_0x949e('0x41')]);_0x5b2b0b[_0x949e('0x42')]=_[_0x949e('0x31')](_0x5e6e34[_0x949e('0x32')],qs[_0x949e('0x43')](_0x5b9f28[_0x949e('0x2e')][_0x949e('0x43')]));_0x5b2b0b[_0x949e('0x42')]=_0x5b2b0b[_0x949e('0x42')][_0x949e('0x44')]?_0x5b2b0b[_0x949e('0x42')]:_0x5e6e34[_0x949e('0x32')];if(!_0x5b9f28[_0x949e('0x2e')][_0x949e('0x45')](_0x949e('0x46'))){_0x5b2b0b[_0x949e('0x1c')]=qs['limit'](_0x5b9f28[_0x949e('0x2e')]['limit']);_0x5b2b0b[_0x949e('0x1e')]=qs[_0x949e('0x1e')](_0x5b9f28['query']['offset']);}_0x5b2b0b['order']=qs[_0x949e('0x47')](_0x5b9f28[_0x949e('0x2e')]['sort']);_0x5b2b0b['where']=qs['filters'](_[_0x949e('0x48')](_0x5b9f28[_0x949e('0x2e')],_0x5e6e34['filters']),_0x54ad5d);if(_0x5b9f28[_0x949e('0x2e')][_0x949e('0x49')]){_0x5b2b0b['where']=_[_0x949e('0x4a')](_0x5b2b0b[_0x949e('0x4b')],{'$or':_[_0x949e('0x2d')](_0x54ad5d,function(_0xb384ed){if(_0xb384ed['type']!=='VIRTUAL'){var _0x2bca69={};_0x2bca69[_0xb384ed[_0x949e('0x28')]]={'$like':'%'+_0x5b9f28[_0x949e('0x2e')][_0x949e('0x49')]+'%'};return _0x2bca69;}})});}_0x5b2b0b=_[_0x949e('0x4a')]({},_0x5b2b0b,_0x5b9f28[_0x949e('0x4c')]);var _0x13c552={'where':_0x5b2b0b['where']};return db['CmHopper'][_0x949e('0x1d')](_0x13c552)['then'](function(_0x14d888){_0x4e169d[_0x949e('0x1d')]=_0x14d888;if(_0x5b9f28[_0x949e('0x2e')][_0x949e('0x4d')]){_0x5b2b0b[_0x949e('0x4e')]=[{'all':!![]}];}return db[_0x949e('0x2b')]['findAll'](_0x5b2b0b);})['then'](function(_0x206792){_0x4e169d[_0x949e('0x4f')]=_0x206792;return _0x4e169d;})[_0x949e('0x25')](respondWithFilteredResult(_0x1867d9,_0x5b2b0b))[_0x949e('0x50')](handleError(_0x1867d9,null));};exports[_0x949e('0x51')]=function(_0x51f9b0,_0xd64f46){var _0x3b95e0={'raw':!![],'where':{'id':_0x51f9b0[_0x949e('0x52')]['id']}},_0x5b3086={};_0x5b3086[_0x949e('0x32')]=_[_0x949e('0x2f')](db[_0x949e('0x2b')][_0x949e('0x2c')]);_0x5b3086[_0x949e('0x2e')]=_[_0x949e('0x2f')](_0x51f9b0[_0x949e('0x2e')]);_0x5b3086[_0x949e('0x30')]=_['intersection'](_0x5b3086[_0x949e('0x32')],_0x5b3086['query']);_0x3b95e0[_0x949e('0x42')]=_[_0x949e('0x31')](_0x5b3086['model'],qs[_0x949e('0x43')](_0x51f9b0[_0x949e('0x2e')][_0x949e('0x43')]));_0x3b95e0[_0x949e('0x42')]=_0x3b95e0[_0x949e('0x42')][_0x949e('0x44')]?_0x3b95e0[_0x949e('0x42')]:_0x5b3086[_0x949e('0x32')];if(_0x51f9b0['query'][_0x949e('0x4d')]){_0x3b95e0[_0x949e('0x4e')]=[{'all':!![]}];}_0x3b95e0=_[_0x949e('0x4a')]({},_0x3b95e0,_0x51f9b0[_0x949e('0x4c')]);return db[_0x949e('0x2b')]['find'](_0x3b95e0)['then'](handleEntityNotFound(_0xd64f46,null))[_0x949e('0x25')](respondWithResult(_0xd64f46,null))[_0x949e('0x50')](handleError(_0xd64f46,null));};exports['create']=function(_0x2eb0bc,_0xdeefe1){return db[_0x949e('0x2b')][_0x949e('0x53')](_0x2eb0bc['body'],{})['then'](respondWithResult(_0xdeefe1,0xc9))[_0x949e('0x50')](handleError(_0xdeefe1,null));};exports[_0x949e('0x54')]=function(_0x4428f1,_0x97d162){if(_0x4428f1[_0x949e('0x55')]['id']){delete _0x4428f1[_0x949e('0x55')]['id'];}return db[_0x949e('0x2b')][_0x949e('0x56')]({'where':{'id':_0x4428f1[_0x949e('0x52')]['id']}})['then'](handleEntityNotFound(_0x97d162,null))[_0x949e('0x25')](saveUpdates(_0x4428f1['body'],null))[_0x949e('0x25')](respondWithResult(_0x97d162,null))['catch'](handleError(_0x97d162,null));};exports[_0x949e('0x57')]=function(_0x5359c3,_0xf78ac2){return db[_0x949e('0x2b')]['describe']()[_0x949e('0x25')](respondWithResult(_0xf78ac2,null))[_0x949e('0x50')](handleError(_0xf78ac2,null));};exports[_0x949e('0x26')]=function(_0x2a5e99,_0x1c9e0b){var _0x4930f0;return db['CmHopper'][_0x949e('0x56')]({'where':{'id':_0x2a5e99[_0x949e('0x52')]['id']}})['then'](handleEntityNotFound(_0x1c9e0b,null))[_0x949e('0x25')](function(_0x1cb35e){if(_0x1cb35e){return _0x1cb35e['destroy']()[_0x949e('0x25')](function(_0x3c2178){return _0x3c2178;});}})[_0x949e('0x25')](function(_0x2d7397){_0x4930f0=_0x2d7397;if(_0x2d7397){if(_0x2d7397[_0x949e('0x58')]||_0x2d7397[_0x949e('0x59')]){return db[_0x2d7397[_0x949e('0x58')]?_0x949e('0x5a'):_0x949e('0x5b')][_0x949e('0x56')]({'where':{'id':_0x2d7397[_0x949e('0x58')]?_0x2d7397[_0x949e('0x58')]:_0x2d7397[_0x949e('0x59')]},'attributes':['id',_0x949e('0x28')],'raw':!![]});}}})[_0x949e('0x25')](function(_0x3106a5){var _0x88fa45={};if(_0x3106a5){_[_0x949e('0x4a')](_0x88fa45,_['omit'](_0x4930f0[_0x949e('0x5c')],['createdAt','updatedAt','id']));_0x88fa45[_0x949e('0x5d')]=0x15;_0x88fa45[_0x949e('0x5e')]=_0x949e('0x5f');_0x88fa45['campaign']=_0x3106a5[_0x949e('0x28')];_0x88fa45[_0x949e('0x60')]=_0x2a5e99[_0x949e('0x61')]['name'];_0x88fa45[_0x949e('0x62')]=_0x2a5e99[_0x949e('0x61')]['id'];_0x88fa45[_0x949e('0x5f')]=!![];_0x88fa45['deletedat']=moment()[_0x949e('0x63')](_0x949e('0x64'));_0x88fa45[_0x949e('0x65')]=_0x4930f0[_0x949e('0x66')];_0x88fa45[_0x949e('0x67')]=_0x4930f0[_0x949e('0x58')]?'queue':_0x949e('0x68');return db[_0x949e('0x69')][_0x949e('0x56')]({'where':{'id':_0x88fa45['ContactId']},'attributes':['firstName',_0x949e('0x6a')]})['then'](function(_0x2b112f){if(!_[_0x949e('0x6b')](_0x1c9e0b)&&!_[_0x949e('0x6b')](_0x2b112f[_0x949e('0x6c')])){_0x88fa45[_0x949e('0x6d')]=_0x2b112f[_0x949e('0x6c')];if(!_['isNil'](_0x2b112f[_0x949e('0x6a')])){_0x88fa45[_0x949e('0x6d')]+='\x20'+_0x2b112f[_0x949e('0x6a')];}}})[_0x949e('0x6e')](function(){return db[_0x949e('0x6f')][_0x949e('0x53')](_0x88fa45);});}})['then'](function(){return _0x1c9e0b[_0x949e('0x19')](0xcc)[_0x949e('0x1a')]();})['catch'](handleError(_0x1c9e0b,null));};exports['getPreview']=function(_0x6ecca9,_0x48cd58,_0x1e0998){var _0x5795d8=[];return db['CmContact'][_0x949e('0x57')]()[_0x949e('0x25')](function(_0x382d9a){_0x5795d8=_[_0x949e('0x2f')](_0x382d9a);return _0x6ecca9[_0x949e('0x61')][_0x949e('0x70')]({'where':{'type':_0x949e('0x71'),'dialActive':!![],'dialMethod':_0x949e('0x72')},'attributes':['id',_0x949e('0x73'),_0x949e('0x74')],'raw':!![]});})[_0x949e('0x25')](function(_0x43f01e){if(_0x43f01e&&_0x43f01e[_0x949e('0x44')]){return db[_0x949e('0x75')][_0x949e('0x76')](function(_0x4531e8){var _0x3a4e7b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x949e('0x63')](_0x949e('0x64'))},'VoiceQueueId':{'$in':_[_0x949e('0x2d')](_0x43f01e,'id')},'$or':[{'UserId':null},{'UserId':_0x6ecca9[_0x949e('0x61')]['id']}]};var _0x2ae769={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x43f01e)[_0x949e('0x49')]([_0x949e('0x74'),0x0])[_0x949e('0x2d')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x6ecca9['user']['id']}]};var _0x75903b={'$or':[_0x3a4e7b,_0x2ae769]};var _0x1725c7=[];if(_0x6ecca9['body'][_0x949e('0x77')]&&_0x6ecca9[_0x949e('0x55')][_0x949e('0x77')]===_0x949e('0x78')){if(!_[_0x949e('0x79')](_0x6ecca9[_0x949e('0x55')][_0x949e('0x7a')])){_0x75903b['id']={'$in':_0x6ecca9[_0x949e('0x55')][_0x949e('0x7a')]};}_0x1725c7=[[_0x949e('0x7b'),_0x949e('0x7c')],[_0x949e('0x7d'),_0x43f01e[0x0][_0x949e('0x73')]===_0x949e('0x7c')?'DESC':'ASC'],db['sequelize'][_0x949e('0x7e')](_0x949e('0x7f')),['id',_0x949e('0x80')]];}else{if(!_['isEmpty'](_0x6ecca9[_0x949e('0x55')][_0x949e('0x7a')])){_0x75903b['id']={'$notIn':_0x6ecca9[_0x949e('0x55')][_0x949e('0x7a')]};}_0x1725c7=[['priority',_0x949e('0x80')],[_0x949e('0x7d'),_0x43f01e[0x0][_0x949e('0x73')]],db[_0x949e('0x75')][_0x949e('0x7e')](_0x949e('0x81')),['id',_0x949e('0x7c')]];}return db[_0x949e('0x2b')][_0x949e('0x82')]({'attributes':['id',_0x949e('0x83'),_0x949e('0x84')],'where':_0x75903b,'order':_0x1725c7,'transaction':_0x4531e8,'lock':_0x4531e8[_0x949e('0x85')]['UPDATE'],'include':[{'model':db[_0x949e('0x69')],'as':_0x949e('0x86'),'attributes':_0x5795d8,'include':[{'model':db[_0x949e('0x87')],'as':_0x949e('0x88'),'attributes':['id',_0x949e('0x28')]}]},{'model':db[_0x949e('0x89')],'as':'List','attributes':['id',_0x949e('0x28')]},{'model':db[_0x949e('0x5a')],'as':_0x949e('0x8a'),'attributes':['id',_0x949e('0x28'),'dialActive']}]})[_0x949e('0x25')](function(_0x3f2c36){if(_0x3f2c36){return _0x3f2c36[_0x949e('0x54')]({'UserId':_0x6ecca9[_0x949e('0x61')]['id']},{'transaction':_0x4531e8});}});});}})['then'](handleEntityNotFound(_0x48cd58,null))['then'](respondWithResult(_0x48cd58,null))['catch'](handleError(_0x48cd58,null));};exports[_0x949e('0x8b')]=function(_0x2ab976,_0x1621b8,_0x3c38eb){return _0x2ab976[_0x949e('0x61')]['getVoiceQueues']({'where':{'type':_0x949e('0x71'),'dialActive':!![],'dialMethod':_0x949e('0x72')},'attributes':['id'],'raw':!![]})[_0x949e('0x25')](function(_0x217c8e){if(_0x217c8e&&_0x217c8e[_0x949e('0x44')]){return db[_0x949e('0x2b')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x949e('0x63')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x949e('0x2d')](_0x217c8e,'id')},'$or':[{'UserId':null},{'UserId':_0x2ab976['user']['id']}]}});}return 0x0;})[_0x949e('0x25')](function(_0x89cd19){if(!_['isNil'](_0x89cd19)&&_[_0x949e('0x8c')](_0x89cd19)){return _0x1621b8[_0x949e('0x19')](0xc8)[_0x949e('0x21')]({'contacts':_0x89cd19});}else{logger[_0x949e('0x27')](_0x949e('0x8d'),_0x949e('0x8b'),0x194,_0x949e('0x8e'));_0x1621b8['sendStatus'](0x194);}})[_0x949e('0x50')](handleError(_0x1621b8,null));}; \ No newline at end of file +var _0x2fc8=['create','update','body','params','describe','VoiceQueue','VoiceQueueId','CampaignId','omit','dataValues','createdAt','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','calleridnum','campaigntype','queue','ivr','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','YYYY-MM-DD\x20HH:mm:ss','value','direction','prev','isEmpty','hopperIds','priority','ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','CmList','dialActive','getOpenContacts','isNumber','entity\x20not\x20found','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','name','index','CmHopper','rawAttributes','key','query','keys','filters','concat','$and','$gt','$lt','$between','$notBetween','$in','$notIn','$like','$overlap','$contains','$contained','$any','attributes','model','fields','length','order','sort','where','pick','filter','merge','map','type','VIRTUAL','includeAll','include','rows','catch','show','intersection','options','find'];(function(_0x2f2036,_0x504f8e){var _0x2afec6=function(_0x394e51){while(--_0x394e51){_0x2f2036['push'](_0x2f2036['shift']());}};_0x2afec6(++_0x504f8e);}(_0x2fc8,0x14a));var _0x82fc=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2fc8[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x82fc('0x0'));var zipdir=require(_0x82fc('0x1'));var jsonpatch=require(_0x82fc('0x2'));var rp=require(_0x82fc('0x3'));var moment=require(_0x82fc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x82fc('0x5'));var sox=require(_0x82fc('0x6'));var csv=require('to-csv');var ejs=require(_0x82fc('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x82fc('0x8'));var squel=require(_0x82fc('0x9'));var crypto=require(_0x82fc('0xa'));var jsforce=require(_0x82fc('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x82fc('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x82fc('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x82fc('0xe'));var as=require(_0x82fc('0xf'));var hardwareService=require(_0x82fc('0x10'));var logger=require(_0x82fc('0x11'))(_0x82fc('0x12'));var utils=require('../../config/utils');var config=require(_0x82fc('0x13'));var licenseUtil=require(_0x82fc('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35c4f4,_0x334b2c){_0x334b2c=_0x334b2c||0xcc;return function(_0x2c03a2){if(_0x2c03a2){return _0x35c4f4[_0x82fc('0x15')](_0x334b2c);}return _0x35c4f4['status'](_0x334b2c)[_0x82fc('0x16')]();};}function respondWithResult(_0x41fa31,_0x1ace45){_0x1ace45=_0x1ace45||0xc8;return function(_0x1b248c){if(_0x1b248c){return _0x41fa31[_0x82fc('0x17')](_0x1ace45)[_0x82fc('0x18')](_0x1b248c);}};}function respondWithFilteredResult(_0x10cb1d,_0x5a004f){return function(_0x2fe11d){if(_0x2fe11d){var _0xf80411=typeof _0x5a004f[_0x82fc('0x19')]===_0x82fc('0x1a')&&typeof _0x5a004f[_0x82fc('0x1b')]===_0x82fc('0x1a');var _0x448552=_0x2fe11d[_0x82fc('0x1c')];var _0x38331e=_0xf80411?0x0:_0x5a004f[_0x82fc('0x19')];var _0x4fc9d2=_0xf80411?_0x2fe11d[_0x82fc('0x1c')]:_0x5a004f['offset']+_0x5a004f[_0x82fc('0x1b')];var _0x29357a;if(_0x4fc9d2>=_0x448552){_0x4fc9d2=_0x448552;_0x29357a=0xc8;}else{_0x29357a=0xce;}_0x10cb1d[_0x82fc('0x17')](_0x29357a);return _0x10cb1d['set'](_0x82fc('0x1d'),_0x38331e+'-'+_0x4fc9d2+'/'+_0x448552)['json'](_0x2fe11d);}return null;};}function patchUpdates(_0x4e8c5e){return function(_0x252407){try{jsonpatch[_0x82fc('0x1e')](_0x252407,_0x4e8c5e,!![]);}catch(_0xb2866){return BPromise[_0x82fc('0x1f')](_0xb2866);}return _0x252407[_0x82fc('0x20')]();};}function saveUpdates(_0x142211,_0x3e3a63){return function(_0x4c2ce7){if(_0x4c2ce7){return _0x4c2ce7['update'](_0x142211)[_0x82fc('0x21')](function(_0x40b36f){return _0x40b36f;});}return null;};}function removeEntity(_0x15e67b,_0x1330e2){return function(_0x4bd298){if(_0x4bd298){return _0x4bd298[_0x82fc('0x22')]()[_0x82fc('0x21')](function(){_0x15e67b['status'](0xcc)[_0x82fc('0x16')]();});}};}function handleEntityNotFound(_0x254092,_0x2f1226){return function(_0x5c4037){if(!_0x5c4037){_0x254092['sendStatus'](0x194);}return _0x5c4037;};}function handleError(_0x460cf9,_0x390273){_0x390273=_0x390273||0x1f4;return function(_0x5e5dcc){logger[_0x82fc('0x23')](_0x5e5dcc['stack']);if(_0x5e5dcc[_0x82fc('0x24')]){delete _0x5e5dcc[_0x82fc('0x24')];}_0x460cf9['status'](_0x390273)['send'](_0x5e5dcc);};}exports[_0x82fc('0x25')]=function(_0x7a9a6a,_0xbd61ce){var _0x2c44e7={},_0x5b0d61={},_0x4c931f={'count':0x0,'rows':[]};var _0x1e3e9b=_['map'](db[_0x82fc('0x26')][_0x82fc('0x27')],function(_0x2d1fea){return{'name':_0x2d1fea['fieldName'],'type':_0x2d1fea['type'][_0x82fc('0x28')]};});_0x5b0d61['model']=_['map'](_0x1e3e9b,_0x82fc('0x24'));_0x5b0d61[_0x82fc('0x29')]=_[_0x82fc('0x2a')](_0x7a9a6a[_0x82fc('0x29')]);_0x5b0d61[_0x82fc('0x2b')]=_['intersection'](_0x5b0d61['model'],_0x5b0d61['query']);_0x5b0d61[_0x82fc('0x2b')]=_[_0x82fc('0x2c')](_0x5b0d61[_0x82fc('0x2b')],[_0x82fc('0x2d'),'$or',_0x82fc('0x2e'),'$gte',_0x82fc('0x2f'),'$lte','$ne','$eq','$not',_0x82fc('0x30'),_0x82fc('0x31'),_0x82fc('0x32'),_0x82fc('0x33'),_0x82fc('0x34'),'$notLike','$iLike','$notILike',_0x82fc('0x34'),_0x82fc('0x35'),_0x82fc('0x36'),_0x82fc('0x37'),_0x82fc('0x38')]);_0x2c44e7[_0x82fc('0x39')]=_['intersection'](_0x5b0d61[_0x82fc('0x3a')],qs[_0x82fc('0x3b')](_0x7a9a6a[_0x82fc('0x29')]['fields']));_0x2c44e7[_0x82fc('0x39')]=_0x2c44e7[_0x82fc('0x39')][_0x82fc('0x3c')]?_0x2c44e7[_0x82fc('0x39')]:_0x5b0d61[_0x82fc('0x3a')];if(!_0x7a9a6a['query']['hasOwnProperty']('nolimit')){_0x2c44e7[_0x82fc('0x1b')]=qs['limit'](_0x7a9a6a[_0x82fc('0x29')]['limit']);_0x2c44e7['offset']=qs['offset'](_0x7a9a6a[_0x82fc('0x29')][_0x82fc('0x19')]);}_0x2c44e7[_0x82fc('0x3d')]=qs[_0x82fc('0x3e')](_0x7a9a6a[_0x82fc('0x29')]['sort']);_0x2c44e7[_0x82fc('0x3f')]=qs[_0x82fc('0x2b')](_[_0x82fc('0x40')](_0x7a9a6a[_0x82fc('0x29')],_0x5b0d61['filters']),_0x1e3e9b);if(_0x7a9a6a['query'][_0x82fc('0x41')]){_0x2c44e7[_0x82fc('0x3f')]=_[_0x82fc('0x42')](_0x2c44e7['where'],{'$or':_[_0x82fc('0x43')](_0x1e3e9b,function(_0x2e5dc6){if(_0x2e5dc6[_0x82fc('0x44')]!==_0x82fc('0x45')){var _0x4d0fd4={};_0x4d0fd4[_0x2e5dc6['name']]={'$like':'%'+_0x7a9a6a['query'][_0x82fc('0x41')]+'%'};return _0x4d0fd4;}})});}_0x2c44e7=_[_0x82fc('0x42')]({},_0x2c44e7,_0x7a9a6a['options']);var _0x3a4b74={'where':_0x2c44e7[_0x82fc('0x3f')]};return db['CmHopper'][_0x82fc('0x1c')](_0x3a4b74)['then'](function(_0x4154fd){_0x4c931f[_0x82fc('0x1c')]=_0x4154fd;if(_0x7a9a6a['query'][_0x82fc('0x46')]){_0x2c44e7[_0x82fc('0x47')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x2c44e7);})[_0x82fc('0x21')](function(_0x172b9f){_0x4c931f[_0x82fc('0x48')]=_0x172b9f;return _0x4c931f;})[_0x82fc('0x21')](respondWithFilteredResult(_0xbd61ce,_0x2c44e7))[_0x82fc('0x49')](handleError(_0xbd61ce,null));};exports[_0x82fc('0x4a')]=function(_0x140799,_0x5d52d0){var _0xfb7904={'raw':!![],'where':{'id':_0x140799['params']['id']}},_0x18397c={};_0x18397c['model']=_[_0x82fc('0x2a')](db[_0x82fc('0x26')][_0x82fc('0x27')]);_0x18397c[_0x82fc('0x29')]=_[_0x82fc('0x2a')](_0x140799[_0x82fc('0x29')]);_0x18397c[_0x82fc('0x2b')]=_[_0x82fc('0x4b')](_0x18397c[_0x82fc('0x3a')],_0x18397c[_0x82fc('0x29')]);_0xfb7904[_0x82fc('0x39')]=_['intersection'](_0x18397c['model'],qs[_0x82fc('0x3b')](_0x140799['query'][_0x82fc('0x3b')]));_0xfb7904[_0x82fc('0x39')]=_0xfb7904['attributes'][_0x82fc('0x3c')]?_0xfb7904['attributes']:_0x18397c[_0x82fc('0x3a')];if(_0x140799[_0x82fc('0x29')][_0x82fc('0x46')]){_0xfb7904['include']=[{'all':!![]}];}_0xfb7904=_[_0x82fc('0x42')]({},_0xfb7904,_0x140799[_0x82fc('0x4c')]);return db['CmHopper'][_0x82fc('0x4d')](_0xfb7904)['then'](handleEntityNotFound(_0x5d52d0,null))[_0x82fc('0x21')](respondWithResult(_0x5d52d0,null))[_0x82fc('0x49')](handleError(_0x5d52d0,null));};exports[_0x82fc('0x4e')]=function(_0x52e250,_0x2d49ed){return db[_0x82fc('0x26')][_0x82fc('0x4e')](_0x52e250['body'],{})[_0x82fc('0x21')](respondWithResult(_0x2d49ed,0xc9))[_0x82fc('0x49')](handleError(_0x2d49ed,null));};exports[_0x82fc('0x4f')]=function(_0x2827c1,_0x4773b9){if(_0x2827c1[_0x82fc('0x50')]['id']){delete _0x2827c1[_0x82fc('0x50')]['id'];}return db[_0x82fc('0x26')][_0x82fc('0x4d')]({'where':{'id':_0x2827c1[_0x82fc('0x51')]['id']}})[_0x82fc('0x21')](handleEntityNotFound(_0x4773b9,null))[_0x82fc('0x21')](saveUpdates(_0x2827c1[_0x82fc('0x50')],null))[_0x82fc('0x21')](respondWithResult(_0x4773b9,null))['catch'](handleError(_0x4773b9,null));};exports[_0x82fc('0x52')]=function(_0x43cb01,_0x34b221){return db[_0x82fc('0x26')][_0x82fc('0x52')]()[_0x82fc('0x21')](respondWithResult(_0x34b221,null))['catch'](handleError(_0x34b221,null));};exports[_0x82fc('0x22')]=function(_0x4cb291,_0x145b5b){var _0x1d60fc;return db[_0x82fc('0x26')][_0x82fc('0x4d')]({'where':{'id':_0x4cb291[_0x82fc('0x51')]['id']}})[_0x82fc('0x21')](handleEntityNotFound(_0x145b5b,null))[_0x82fc('0x21')](function(_0xaae68e){if(_0xaae68e){return _0xaae68e[_0x82fc('0x22')]()[_0x82fc('0x21')](function(_0x169a9b){return _0x169a9b;});}})[_0x82fc('0x21')](function(_0x167ba3){_0x1d60fc=_0x167ba3;if(_0x167ba3){if(_0x167ba3['VoiceQueueId']||_0x167ba3['CampaignId']){return db[_0x167ba3['VoiceQueueId']?_0x82fc('0x53'):'Campaign']['find']({'where':{'id':_0x167ba3[_0x82fc('0x54')]?_0x167ba3['VoiceQueueId']:_0x167ba3[_0x82fc('0x55')]},'attributes':['id',_0x82fc('0x24')],'raw':!![]});}}})[_0x82fc('0x21')](function(_0x3145c3){var _0x368653={};if(_0x3145c3){_['merge'](_0x368653,_[_0x82fc('0x56')](_0x1d60fc[_0x82fc('0x57')],[_0x82fc('0x58'),'updatedAt','id']));_0x368653['state']=0x15;_0x368653[_0x82fc('0x59')]=_0x82fc('0x5a');_0x368653[_0x82fc('0x5b')]=_0x3145c3[_0x82fc('0x24')];_0x368653[_0x82fc('0x5c')]=_0x4cb291[_0x82fc('0x5d')][_0x82fc('0x24')];_0x368653[_0x82fc('0x5e')]=_0x4cb291[_0x82fc('0x5d')]['id'];_0x368653['deleted']=!![];_0x368653[_0x82fc('0x5f')]=moment()[_0x82fc('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x368653[_0x82fc('0x61')]=_0x1d60fc['phone'];_0x368653[_0x82fc('0x62')]=_0x1d60fc[_0x82fc('0x54')]?_0x82fc('0x63'):_0x82fc('0x64');return db[_0x82fc('0x65')][_0x82fc('0x4d')]({'where':{'id':_0x368653['ContactId']},'attributes':[_0x82fc('0x66'),_0x82fc('0x67')]})[_0x82fc('0x21')](function(_0x452c27){if(!_['isNil'](_0x145b5b)&&!_[_0x82fc('0x68')](_0x452c27['firstName'])){_0x368653['calleridname']=_0x452c27['firstName'];if(!_[_0x82fc('0x68')](_0x452c27[_0x82fc('0x67')])){_0x368653[_0x82fc('0x69')]+='\x20'+_0x452c27[_0x82fc('0x67')];}}})[_0x82fc('0x6a')](function(){return db[_0x82fc('0x6b')]['create'](_0x368653);});}})['then'](function(){return _0x145b5b['status'](0xcc)[_0x82fc('0x16')]();})['catch'](handleError(_0x145b5b,null));};exports['getPreview']=function(_0x4f1148,_0x2703fc,_0x520a88){var _0x3df941=[];return db[_0x82fc('0x65')]['describe']()[_0x82fc('0x21')](function(_0x38916a){_0x3df941=_[_0x82fc('0x2a')](_0x38916a);return _0x4f1148[_0x82fc('0x5d')][_0x82fc('0x6c')]({'where':{'type':_0x82fc('0x6d'),'dialActive':!![],'dialMethod':_0x82fc('0x6e')},'attributes':['id',_0x82fc('0x6f'),_0x82fc('0x70')],'raw':!![]});})[_0x82fc('0x21')](function(_0x122aa6){if(_0x122aa6&&_0x122aa6[_0x82fc('0x3c')]){return db['sequelize']['transaction'](function(_0x2294e5){var _0x18ea08={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x82fc('0x60')](_0x82fc('0x71'))},'VoiceQueueId':{'$in':_[_0x82fc('0x43')](_0x122aa6,'id')},'$or':[{'UserId':null},{'UserId':_0x4f1148[_0x82fc('0x5d')]['id']}]};var _0x2e7ccb={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x122aa6)['filter'](['dialPreviewAutoRecallMe',0x0])[_0x82fc('0x43')]('id')[_0x82fc('0x72')]()},'$or':[{'UserId':null},{'UserId':_0x4f1148[_0x82fc('0x5d')]['id']}]};var _0x2520f6={'$or':[_0x18ea08,_0x2e7ccb]};var _0x490bf6=[];if(_0x4f1148[_0x82fc('0x50')][_0x82fc('0x73')]&&_0x4f1148[_0x82fc('0x50')]['direction']===_0x82fc('0x74')){if(!_[_0x82fc('0x75')](_0x4f1148[_0x82fc('0x50')][_0x82fc('0x76')])){_0x2520f6['id']={'$in':_0x4f1148['body'][_0x82fc('0x76')]};}_0x490bf6=[[_0x82fc('0x77'),_0x82fc('0x78')],['scheduledAt',_0x122aa6[0x0][_0x82fc('0x6f')]===_0x82fc('0x78')?'DESC':_0x82fc('0x78')],db['sequelize'][_0x82fc('0x79')](_0x82fc('0x7a')),['id',_0x82fc('0x7b')]];}else{if(!_[_0x82fc('0x75')](_0x4f1148[_0x82fc('0x50')]['hopperIds'])){_0x2520f6['id']={'$notIn':_0x4f1148[_0x82fc('0x50')][_0x82fc('0x76')]};}_0x490bf6=[[_0x82fc('0x77'),_0x82fc('0x7b')],['scheduledAt',_0x122aa6[0x0][_0x82fc('0x6f')]],db['sequelize']['literal'](_0x82fc('0x7c')),['id',_0x82fc('0x78')]];}return db['CmHopper']['findOne']({'attributes':['id',_0x82fc('0x7d'),_0x82fc('0x7e')],'where':_0x2520f6,'order':_0x490bf6,'transaction':_0x2294e5,'lock':_0x2294e5[_0x82fc('0x7f')][_0x82fc('0x80')],'include':[{'model':db[_0x82fc('0x65')],'as':_0x82fc('0x81'),'attributes':_0x3df941,'include':[{'model':db[_0x82fc('0x82')],'as':'Company','attributes':['id','name']}]},{'model':db[_0x82fc('0x83')],'as':'List','attributes':['id','name']},{'model':db[_0x82fc('0x53')],'as':'Queue','attributes':['id',_0x82fc('0x24'),_0x82fc('0x84')]}]})[_0x82fc('0x21')](function(_0x33ce56){if(_0x33ce56){return _0x33ce56[_0x82fc('0x4f')]({'UserId':_0x4f1148[_0x82fc('0x5d')]['id']},{'transaction':_0x2294e5});}});});}})[_0x82fc('0x21')](handleEntityNotFound(_0x2703fc,null))[_0x82fc('0x21')](respondWithResult(_0x2703fc,null))[_0x82fc('0x49')](handleError(_0x2703fc,null));};exports[_0x82fc('0x85')]=function(_0x5129fd,_0x246fae,_0x28e217){return _0x5129fd[_0x82fc('0x5d')][_0x82fc('0x6c')]({'where':{'type':_0x82fc('0x6d'),'dialActive':!![],'dialMethod':_0x82fc('0x6e')},'attributes':['id'],'raw':!![]})['then'](function(_0x25219b){if(_0x25219b&&_0x25219b[_0x82fc('0x3c')]){return db[_0x82fc('0x26')][_0x82fc('0x1c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x82fc('0x60')](_0x82fc('0x71'))},'VoiceQueueId':{'$in':_['map'](_0x25219b,'id')},'$or':[{'UserId':null},{'UserId':_0x5129fd[_0x82fc('0x5d')]['id']}]}});}return 0x0;})[_0x82fc('0x21')](function(_0x5e90f9){if(!_[_0x82fc('0x68')](_0x5e90f9)&&_[_0x82fc('0x86')](_0x5e90f9)){return _0x246fae[_0x82fc('0x17')](0xc8)[_0x82fc('0x18')]({'contacts':_0x5e90f9});}else{logger[_0x82fc('0x23')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x82fc('0x85'),0x194,_0x82fc('0x87'));_0x246fae[_0x82fc('0x15')](0x194);}})[_0x82fc('0x49')](handleError(_0x246fae,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 9998df0..869b5ba 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 _0x1883=['../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x27f07d,_0x5037c9){var _0xd47be6=function(_0x13ef5f){while(--_0x13ef5f){_0x27f07d['push'](_0x27f07d['shift']());}};_0xd47be6(++_0x5037c9);}(_0x1883,0xab));var _0x3188=function(_0xc7f8c1,_0x12576f){_0xc7f8c1=_0xc7f8c1-0x0;var _0x137f57=_0x1883[_0xc7f8c1];return _0x137f57;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));module[_0x3188('0xb')]=function(_0x408ae0,_0x33b62d){return _0x408ae0[_0x3188('0xc')](_0x3188('0xd'),attributes,{'tableName':_0x3188('0xe'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x3188('0xf')]},{'name':_0x3188('0x10'),'fields':['phone']},{'name':_0x3188('0x11'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7c09=['scheduledat','phone','priority','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper'];(function(_0x3c193a,_0x4814e6){var _0x2eb0a2=function(_0x4fbafe){while(--_0x4fbafe){_0x3c193a['push'](_0x3c193a['shift']());}};_0x2eb0a2(++_0x4814e6);}(_0x7c09,0x102));var _0x97c0=function(_0x1466f6,_0x1872de){_0x1466f6=_0x1466f6-0x0;var _0x12f26b=_0x7c09[_0x1466f6];return _0x12f26b;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var logger=require(_0x97c0('0x1'))('api');var moment=require(_0x97c0('0x2'));var BPromise=require(_0x97c0('0x3'));var rp=require(_0x97c0('0x4'));var fs=require('fs');var path=require(_0x97c0('0x5'));var rimraf=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var attributes=require(_0x97c0('0x8'));module['exports']=function(_0x4b2f81,_0x590368){return _0x4b2f81[_0x97c0('0x9')](_0x97c0('0xa'),attributes,{'tableName':_0x97c0('0xb'),'paranoid':![],'indexes':[{'name':_0x97c0('0xc'),'fields':[_0x97c0('0xc')]},{'name':'phone','fields':[_0x97c0('0xd')]},{'name':'priority','fields':[_0x97c0('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 2122c6c..1f75589 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 _0x2b69=['raw','where','attributes','limit','include','model','map','GetCmHopper','ShowCmHopper','find','create','body','CreateCmHopper','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','findAll','LOCK','Contact','User','Agent','voicePause','length','UserId','update','includes','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','ContactId','dataValues','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','order','GetCmHopperPreview','keys','ResetActiveCalls','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','CmHopper','options'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x2b69,0x1bf));var _0x92b6=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x2b69[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x92b6('0x0'));var util=require(_0x92b6('0x1'));var moment=require(_0x92b6('0x2'));var BPromise=require(_0x92b6('0x3'));var rs=require(_0x92b6('0x4'));var fs=require('fs');var Redis=require(_0x92b6('0x5'));var db=require(_0x92b6('0x6'))['db'];var utils=require(_0x92b6('0x7'));var logger=require(_0x92b6('0x8'))('rpc');var config=require(_0x92b6('0x9'));var jayson=require(_0x92b6('0xa'));var client=jayson[_0x92b6('0xb')][_0x92b6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x372ed2,_0x3f9c20,_0x25860a){return new BPromise(function(_0x486c4d,_0x3c748e){return client[_0x92b6('0xd')](_0x372ed2,_0x25860a)[_0x92b6('0xe')](function(_0x591d37){logger[_0x92b6('0xf')]('CmHopper,\x20%s,\x20%s',_0x3f9c20,_0x92b6('0x10'));logger[_0x92b6('0x11')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x3f9c20,'request\x20sent',JSON[_0x92b6('0x12')](_0x591d37));if(_0x591d37[_0x92b6('0x13')]){if(_0x591d37[_0x92b6('0x13')][_0x92b6('0x14')]===0x1f4){logger[_0x92b6('0x13')](_0x92b6('0x15'),_0x3f9c20,_0x591d37['error'][_0x92b6('0x16')]);return _0x3c748e(_0x591d37[_0x92b6('0x13')][_0x92b6('0x16')]);}logger['error'](_0x92b6('0x15'),_0x3f9c20,_0x591d37[_0x92b6('0x13')][_0x92b6('0x16')]);return _0x486c4d(_0x591d37[_0x92b6('0x13')][_0x92b6('0x16')]);}else{logger[_0x92b6('0xf')]('CmHopper,\x20%s,\x20%s',_0x3f9c20,'request\x20sent');_0x486c4d(_0x591d37[_0x92b6('0x17')][_0x92b6('0x16')]);}})[_0x92b6('0x18')](function(_0x3b8552){logger[_0x92b6('0x13')](_0x92b6('0x15'),_0x3f9c20,_0x3b8552);_0x3c748e(_0x3b8552);});});}exports['GetCmHopper']=function(_0x19f848){var _0x32640e=this;return new Promise(function(_0x5d4f9a,_0x44036c){return db[_0x92b6('0x19')]['findAll']({'raw':_0x19f848['options']?_0x19f848[_0x92b6('0x1a')][_0x92b6('0x1b')]===undefined?!![]:![]:!![],'where':_0x19f848[_0x92b6('0x1a')]?_0x19f848[_0x92b6('0x1a')][_0x92b6('0x1c')]||null:null,'attributes':_0x19f848['options']?_0x19f848['options'][_0x92b6('0x1d')]||null:null,'limit':_0x19f848[_0x92b6('0x1a')]?_0x19f848[_0x92b6('0x1a')][_0x92b6('0x1e')]||null:null,'include':_0x19f848[_0x92b6('0x1a')]?_0x19f848[_0x92b6('0x1a')][_0x92b6('0x1f')]?_['map'](_0x19f848[_0x92b6('0x1a')][_0x92b6('0x1f')],function(_0x1a1f35){return{'model':db[_0x1a1f35[_0x92b6('0x20')]],'as':_0x1a1f35['as'],'attributes':_0x1a1f35['attributes'],'include':_0x1a1f35[_0x92b6('0x1f')]?_[_0x92b6('0x21')](_0x1a1f35[_0x92b6('0x1f')],function(_0x5bed81){return{'model':db[_0x5bed81[_0x92b6('0x20')]],'as':_0x5bed81['as'],'attributes':_0x5bed81[_0x92b6('0x1d')],'include':_0x5bed81[_0x92b6('0x1f')]?_[_0x92b6('0x21')](_0x5bed81[_0x92b6('0x1f')],function(_0x594c6c){return{'model':db[_0x594c6c[_0x92b6('0x20')]],'as':_0x594c6c['as'],'attributes':_0x594c6c[_0x92b6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x92b6('0xe')](function(_0x1d59fb){logger['info'](_0x92b6('0x22'),_0x19f848);logger[_0x92b6('0x11')](_0x92b6('0x22'),_0x19f848,JSON[_0x92b6('0x12')](_0x1d59fb));_0x5d4f9a(_0x1d59fb);})[_0x92b6('0x18')](function(_0x14889a){logger[_0x92b6('0x13')](_0x92b6('0x22'),_0x14889a['message'],_0x19f848);_0x44036c(_0x32640e['error'](0x1f4,_0x14889a['message']));});});};exports[_0x92b6('0x23')]=function(_0x355001){var _0xb498a0=this;return new Promise(function(_0x2e899e,_0x1d0364){return db[_0x92b6('0x19')][_0x92b6('0x24')]({'raw':_0x355001[_0x92b6('0x1a')]?_0x355001[_0x92b6('0x1a')][_0x92b6('0x1b')]===undefined?!![]:![]:!![],'where':_0x355001[_0x92b6('0x1a')]?_0x355001[_0x92b6('0x1a')]['where']||null:null,'attributes':_0x355001[_0x92b6('0x1a')]?_0x355001[_0x92b6('0x1a')][_0x92b6('0x1d')]||null:null,'include':_0x355001[_0x92b6('0x1a')]?_0x355001['options']['include']?_[_0x92b6('0x21')](_0x355001[_0x92b6('0x1a')][_0x92b6('0x1f')],function(_0x2dc4af){return{'model':db[_0x2dc4af['model']],'as':_0x2dc4af['as'],'attributes':_0x2dc4af[_0x92b6('0x1d')],'include':_0x2dc4af[_0x92b6('0x1f')]?_[_0x92b6('0x21')](_0x2dc4af[_0x92b6('0x1f')],function(_0x367c72){return{'model':db[_0x367c72[_0x92b6('0x20')]],'as':_0x367c72['as'],'attributes':_0x367c72[_0x92b6('0x1d')],'include':_0x367c72[_0x92b6('0x1f')]?_[_0x92b6('0x21')](_0x367c72[_0x92b6('0x1f')],function(_0x557da7){return{'model':db[_0x557da7['model']],'as':_0x557da7['as'],'attributes':_0x557da7['attributes']};}):[]};}):[]};}):[]:[]})[_0x92b6('0xe')](function(_0x42d11d){logger[_0x92b6('0xf')](_0x92b6('0x23'),_0x355001);logger[_0x92b6('0x11')](_0x92b6('0x23'),_0x355001,JSON['stringify'](_0x42d11d));_0x2e899e(_0x42d11d);})[_0x92b6('0x18')](function(_0x1cffa){logger[_0x92b6('0x13')](_0x92b6('0x23'),_0x1cffa[_0x92b6('0x16')],_0x355001);_0x1d0364(_0xb498a0[_0x92b6('0x13')](0x1f4,_0x1cffa[_0x92b6('0x16')]));});});};exports['CreateCmHopper']=function(_0x25364f){var _0x4c4454=this;return new Promise(function(_0x4d6992,_0x2feb36){return db[_0x92b6('0x19')][_0x92b6('0x25')](_0x25364f[_0x92b6('0x26')],{'raw':_0x25364f[_0x92b6('0x1a')]?_0x25364f[_0x92b6('0x1a')][_0x92b6('0x1b')]===undefined?!![]:![]:!![]})[_0x92b6('0xe')](function(_0x211bfa){logger[_0x92b6('0xf')](_0x92b6('0x27'),_0x25364f);logger[_0x92b6('0x11')](_0x92b6('0x27'),_0x25364f,JSON[_0x92b6('0x12')](_0x211bfa));_0x4d6992(_0x211bfa);})['catch'](function(_0x5e6126){logger[_0x92b6('0x13')](_0x92b6('0x27'),_0x5e6126[_0x92b6('0x16')],_0x25364f);_0x2feb36(_0x4c4454[_0x92b6('0x13')](0x1f4,_0x5e6126[_0x92b6('0x16')]));});});};exports[_0x92b6('0x28')]=function(_0x49e285){var _0x32b7df=this;return new Promise(function(_0x29a3c1,_0x593233){return db[_0x92b6('0x19')]['update'](_0x49e285[_0x92b6('0x26')],{'raw':_0x49e285[_0x92b6('0x1a')]?_0x49e285[_0x92b6('0x1a')][_0x92b6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49e285[_0x92b6('0x1a')]?_0x49e285['options'][_0x92b6('0x1c')]||null:null,'attributes':_0x49e285[_0x92b6('0x1a')]?_0x49e285[_0x92b6('0x1a')]['attributes']||null:null,'limit':_0x49e285[_0x92b6('0x1a')]?_0x49e285[_0x92b6('0x1a')]['limit']||null:null})[_0x92b6('0xe')](function(_0x38f6f1){logger[_0x92b6('0xf')](_0x92b6('0x28'),_0x49e285);logger[_0x92b6('0xf')](_0x92b6('0x29'),JSON[_0x92b6('0x12')](_0x49e285[_0x92b6('0x1a')][_0x92b6('0x1c')]),_0x49e285[_0x92b6('0x26')][_0x92b6('0x2a')]);logger['debug'](_0x92b6('0x28'),_0x49e285,JSON[_0x92b6('0x12')](_0x38f6f1));_0x29a3c1(_0x38f6f1);})['catch'](function(_0x2e14af){logger['error'](_0x92b6('0x28'),_0x2e14af['message'],_0x49e285);_0x593233(_0x32b7df[_0x92b6('0x13')](0x1f4,_0x2e14af[_0x92b6('0x16')]));});});};exports['DestroyCmHopper']=function(_0x46b013){var _0x2cafe5=this;return new Promise(function(_0x21f860,_0x48867c){return db[_0x92b6('0x19')][_0x92b6('0x2b')]({'where':_0x46b013['options']?_0x46b013['options'][_0x92b6('0x1c')]||null:null})['then'](function(_0x3ebc33){logger[_0x92b6('0xf')](_0x92b6('0x2c'),_0x46b013);logger['debug'](_0x92b6('0x2c'),_0x46b013,JSON['stringify'](_0x3ebc33));_0x21f860(_0x3ebc33);})[_0x92b6('0x18')](function(_0x3f11e8){logger[_0x92b6('0x13')](_0x92b6('0x2c'),_0x3f11e8[_0x92b6('0x16')],_0x46b013);_0x48867c(_0x2cafe5['error'](0x1f4,_0x3f11e8[_0x92b6('0x16')]));});});};exports[_0x92b6('0x2d')]=function(_0x285767){var _0x238497=this;return new Promise(function(_0x563450,_0x5dc6d2){return db[_0x92b6('0x2e')][_0x92b6('0x2f')]()[_0x92b6('0xe')](function(_0x3c75af){return db[_0x92b6('0x30')][_0x92b6('0x31')](function(_0x3c1446){return db[_0x92b6('0x19')][_0x92b6('0x32')]({'where':_0x285767[_0x92b6('0x1a')]?_0x285767[_0x92b6('0x1a')][_0x92b6('0x1c')]||null:null,'attributes':_0x285767[_0x92b6('0x1a')]?_0x285767[_0x92b6('0x1a')]['attributes']||null:null,'limit':_0x285767['options']?_0x285767[_0x92b6('0x1a')][_0x92b6('0x1e')]||null:null,'order':_0x285767[_0x92b6('0x1a')]?_0x285767[_0x92b6('0x1a')]['order']||null:null,'transaction':_0x3c1446,'lock':_0x3c1446[_0x92b6('0x33')]['UPDATE'],'include':[{'model':db[_0x92b6('0x2e')],'as':_0x92b6('0x34'),'attributes':_['keys'](_0x3c75af)},{'model':db[_0x92b6('0x35')],'as':_0x92b6('0x36'),'attributes':['id','name',_0x92b6('0x37')]}]})['then'](function(_0x1d444b){var _0xfde9c6=[];var _0x237dd2=[];for(var _0x381d97=0x0;_0x381d97<_0x1d444b[_0x92b6('0x38')];_0x381d97+=0x1){var _0x267759=_0x1d444b[_0x381d97][_0x92b6('0x39')];if(_0x267759===null){_0xfde9c6['push'](_0x1d444b[_0x381d97][_0x92b6('0x3a')](_0x285767[_0x92b6('0x26')],{'transaction':_0x3c1446}));}else if(!_0x237dd2[_0x92b6('0x3b')](_0x267759)){_0x237dd2[_0x92b6('0x3c')](_0x267759);_0xfde9c6[_0x92b6('0x3c')](_0x1d444b[_0x381d97]['update'](_0x285767[_0x92b6('0x26')],{'transaction':_0x3c1446}));}}return BPromise[_0x92b6('0x3d')](_0xfde9c6);});})[_0x92b6('0xe')](function(_0x383613){logger[_0x92b6('0xf')]('GetContactDialer',_0x285767);if(_0x383613['length']>0x0){logger[_0x92b6('0xf')](_0x92b6('0x3e'),_0x383613[0x0]['dataValues']['id'],_0x383613[0x0]['dataValues'][_0x92b6('0x3f')],_0x383613[0x0][_0x92b6('0x40')]['active']);}logger[_0x92b6('0x11')](_0x92b6('0x2d'),_0x285767,JSON[_0x92b6('0x12')](_0x383613));_0x563450(_0x383613);})[_0x92b6('0x18')](function(_0x1ddd7c){logger[_0x92b6('0x13')](_0x92b6('0x2d'),_0x1ddd7c['message'],_0x285767);_0x5dc6d2(_0x238497[_0x92b6('0x13')](0x1f4,_0x1ddd7c[_0x92b6('0x16')]));});});});};exports['MoveContactManagedDialer']=function(_0x55f121){var _0x10e503=this;return new Promise(function(_0x9da1ed,_0x3867ef){return db[_0x92b6('0x30')][_0x92b6('0x31')](function(_0x861e6b){return db[_0x92b6('0x41')]['create'](_0x55f121['body'],{'raw':_0x55f121[_0x92b6('0x1a')]?_0x55f121[_0x92b6('0x1a')][_0x92b6('0x1b')]===undefined?!![]:![]:!![],'transaction':_0x861e6b})[_0x92b6('0xe')](function(){logger[_0x92b6('0xf')](_0x92b6('0x42'),JSON['stringify'](_0x55f121['options'][_0x92b6('0x1c')]),_0x55f121[_0x92b6('0x1a')][_0x92b6('0x1c')]['active']);return db[_0x92b6('0x19')][_0x92b6('0x2b')]({'where':_0x55f121[_0x92b6('0x1a')]?_0x55f121[_0x92b6('0x1a')][_0x92b6('0x1c')]||null:null,'transaction':_0x861e6b});});})[_0x92b6('0xe')](function(_0x6d75c2){logger[_0x92b6('0xf')](_0x92b6('0x43'),_0x55f121);logger[_0x92b6('0x11')](_0x92b6('0x43'),_0x55f121,JSON['stringify'](_0x6d75c2));_0x9da1ed(_0x6d75c2);})[_0x92b6('0x18')](function(_0xb75cdb){logger[_0x92b6('0x13')](_0x92b6('0x43'),_0xb75cdb[_0x92b6('0x16')],_0x55f121);_0x3867ef(_0x10e503[_0x92b6('0x13')](0x1f4,_0xb75cdb[_0x92b6('0x16')]));});});};exports['CountReScheduled']=function(_0x2f8125){var _0x4e9897=this;return new Promise(function(_0x54ee54,_0x1dd179){return db[_0x92b6('0x19')][_0x92b6('0x32')]({'raw':_0x2f8125[_0x92b6('0x1a')]?_0x2f8125[_0x92b6('0x1a')][_0x92b6('0x1b')]===undefined?!![]:![]:!![],'where':_0x2f8125['options']?_0x2f8125[_0x92b6('0x1a')][_0x92b6('0x1c')]||null:null,'attributes':[[db[_0x92b6('0x30')]['fn']('COUNT',db[_0x92b6('0x30')]['fn']('IF',db['sequelize'][_0x92b6('0x44')](_0x92b6('0x45')+util[_0x92b6('0x46')](_0x92b6('0x47'),moment()[_0x92b6('0x46')](_0x92b6('0x48')))+_0x92b6('0x49')))),'contactsRescheduled']]})[_0x92b6('0xe')](function(_0x24c67b){logger['info']('CountReScheduled',_0x2f8125);logger[_0x92b6('0x11')]('CountReScheduled',_0x2f8125,JSON[_0x92b6('0x12')](_0x24c67b));_0x54ee54(_0x24c67b);})['catch'](function(_0x4efe5a){logger[_0x92b6('0x13')]('CountReScheduled',_0x4efe5a[_0x92b6('0x16')],_0x2f8125);_0x1dd179(_0x4e9897['error'](0x1f4,_0x4efe5a[_0x92b6('0x16')]));});});};exports[_0x92b6('0x4a')]=function(_0x330bd8){var _0x314e92=this;return new Promise(function(_0x1510fc,_0x5c5eb2){return db[_0x92b6('0x2e')][_0x92b6('0x2f')]()[_0x92b6('0xe')](function(_0x4730e8){return db[_0x92b6('0x30')][_0x92b6('0x31')](function(_0x23a220){return db[_0x92b6('0x19')][_0x92b6('0x32')]({'where':_0x330bd8[_0x92b6('0x1a')]?_0x330bd8['options'][_0x92b6('0x1c')]||null:null,'attributes':_0x330bd8[_0x92b6('0x1a')]?_0x330bd8['options'][_0x92b6('0x1d')]||null:null,'limit':0x1,'order':_0x330bd8[_0x92b6('0x1a')]?_0x330bd8[_0x92b6('0x1a')][_0x92b6('0x4b')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x23a220,'lock':_0x23a220[_0x92b6('0x33')]['UPDATE'],'include':_0x330bd8[_0x92b6('0x1a')]?_0x330bd8[_0x92b6('0x1a')][_0x92b6('0x1f')]?_[_0x92b6('0x21')](_0x330bd8['options'][_0x92b6('0x1f')],function(_0x1473b2){return{'model':db[_0x1473b2[_0x92b6('0x20')]],'as':_0x1473b2['as'],'attributes':_0x1473b2[_0x92b6('0x1d')],'include':_0x1473b2[_0x92b6('0x1f')]?_[_0x92b6('0x21')](_0x1473b2[_0x92b6('0x1f')],function(_0x342a42){return{'model':db[_0x342a42[_0x92b6('0x20')]],'as':_0x342a42['as'],'attributes':_0x342a42['attributes'],'include':_0x342a42[_0x92b6('0x1f')]?_[_0x92b6('0x21')](_0x342a42[_0x92b6('0x1f')],function(_0x2598a5){return{'model':db[_0x2598a5[_0x92b6('0x20')]],'as':_0x2598a5['as'],'attributes':_0x2598a5[_0x92b6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x92b6('0xe')](function(_0x10fee7){var _0x1246a4=[];for(var _0x379bff=0x0;_0x379bff<_0x10fee7[_0x92b6('0x38')];_0x379bff+=0x1){_0x1246a4[_0x92b6('0x3c')](_0x10fee7[_0x379bff][_0x92b6('0x3a')](_0x330bd8[_0x92b6('0x26')],{'transaction':_0x23a220}));}return BPromise['all'](_0x1246a4);});})[_0x92b6('0xe')](function(_0x21787c){logger[_0x92b6('0xf')]('GetContactRecallMe',_0x330bd8);logger[_0x92b6('0x11')](_0x92b6('0x4a'),_0x330bd8,JSON[_0x92b6('0x12')](_0x21787c));_0x1510fc(_0x21787c);})['catch'](function(_0x311bbd){logger[_0x92b6('0x13')](_0x92b6('0x4a'),_0x311bbd[_0x92b6('0x16')],_0x330bd8);_0x5c5eb2(_0x314e92[_0x92b6('0x13')](0x1f4,_0x311bbd[_0x92b6('0x16')]));});});});};exports[_0x92b6('0x4c')]=function(_0x1f0bca){var _0x32af8f=this;return new Promise(function(_0x1ed5cb,_0x5b619b){db[_0x92b6('0x2e')][_0x92b6('0x2f')]()[_0x92b6('0xe')](function(_0x2ed8ad){return db[_0x92b6('0x19')][_0x92b6('0x32')]({'raw':_0x1f0bca[_0x92b6('0x1a')]?_0x1f0bca['options'][_0x92b6('0x1b')]===undefined?!![]:![]:!![],'where':_0x1f0bca[_0x92b6('0x1a')]?_0x1f0bca[_0x92b6('0x1a')]['where']||null:null,'attributes':_0x1f0bca[_0x92b6('0x1a')]?_0x1f0bca[_0x92b6('0x1a')][_0x92b6('0x1d')]||null:null,'limit':_0x1f0bca[_0x92b6('0x1a')]?_0x1f0bca[_0x92b6('0x1a')]['limit']||null:null,'include':_0x1f0bca['options']?_0x1f0bca['options']['include']?_[_0x92b6('0x21')](_0x1f0bca['options']['include'],function(_0x3367e7){return{'model':db[_0x3367e7['model']],'as':_0x3367e7['as'],'attributes':_0x3367e7['as']===_0x92b6('0x34')?_[_0x92b6('0x4d')](_0x2ed8ad):_0x3367e7[_0x92b6('0x1d')],'include':_0x3367e7[_0x92b6('0x1f')]?_[_0x92b6('0x21')](_0x3367e7[_0x92b6('0x1f')],function(_0x244277){return{'model':db[_0x244277[_0x92b6('0x20')]],'as':_0x244277['as'],'attributes':_0x244277[_0x92b6('0x1d')],'include':_0x244277[_0x92b6('0x1f')]?_['map'](_0x244277['include'],function(_0x4dda0b){return{'model':db[_0x4dda0b[_0x92b6('0x20')]],'as':_0x4dda0b['as'],'attributes':_0x4dda0b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a3f69){logger['info'](_0x92b6('0x22'),_0x1f0bca);logger[_0x92b6('0x11')](_0x92b6('0x22'),_0x1f0bca,JSON[_0x92b6('0x12')](_0x5a3f69));_0x1ed5cb(_0x5a3f69);})['catch'](function(_0x5acc1f){logger[_0x92b6('0x13')](_0x92b6('0x22'),_0x5acc1f['message'],_0x1f0bca);_0x5b619b(_0x32af8f['error'](0x1f4,_0x5acc1f[_0x92b6('0x16')]));});});});};exports[_0x92b6('0x4e')]=function(_0x10c5c0){var _0x223f2e=this;return new Promise(function(_0x2a625c,_0xf1495e){return db[_0x92b6('0x30')]['transaction'](function(_0x577936){return db[_0x92b6('0x19')][_0x92b6('0x3a')]({'active':![]},{'where':{},'transaction':_0x577936})[_0x92b6('0xe')](function(_0x3da985){logger[_0x92b6('0xf')](_0x92b6('0x4e'),_0x10c5c0);logger['debug'](_0x92b6('0x4e'),_0x10c5c0,JSON[_0x92b6('0x12')](_0x3da985));_0x2a625c(_0x3da985);})[_0x92b6('0x18')](function(_0x158792){logger[_0x92b6('0x13')](_0x92b6('0x4e'),_0x158792[_0x92b6('0x16')],_0x10c5c0);_0xf1495e(_0x223f2e[_0x92b6('0x13')](0x1f4,_0x158792['message']));});});});}; \ No newline at end of file +var _0xc91a=['LOCK','UPDATE','Contact','User','name','voicePause','UserId','push','update','includes','length','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','sequelize','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','order','all','GetCmHopperPreview','keys','ResetActiveCalls','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','GetCmHopper','findAll','options','raw','where','attributes','include','model','map','ShowCmHopper','CmHopper','find','create','CreateCmHopper','UpdateCmHopper','body','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','GetContactDialer','CmContact','transaction'];(function(_0x1ddf02,_0xab705b){var _0xdd618a=function(_0x464787){while(--_0x464787){_0x1ddf02['push'](_0x1ddf02['shift']());}};_0xdd618a(++_0xab705b);}(_0xc91a,0x1b7));var _0xac91=function(_0x213f65,_0x2683d2){_0x213f65=_0x213f65-0x0;var _0x55cc16=_0xc91a[_0x213f65];return _0x55cc16;};'use strict';var _=require(_0xac91('0x0'));var util=require(_0xac91('0x1'));var moment=require('moment');var BPromise=require(_0xac91('0x2'));var rs=require(_0xac91('0x3'));var fs=require('fs');var Redis=require(_0xac91('0x4'));var db=require(_0xac91('0x5'))['db'];var utils=require(_0xac91('0x6'));var logger=require(_0xac91('0x7'))(_0xac91('0x8'));var config=require('../../config/environment');var jayson=require(_0xac91('0x9'));var client=jayson[_0xac91('0xa')][_0xac91('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x547ae4,_0x10bb92,_0x36c464){return new BPromise(function(_0x3e158e,_0x321d94){return client[_0xac91('0xc')](_0x547ae4,_0x36c464)[_0xac91('0xd')](function(_0x3c6b68){logger[_0xac91('0xe')]('CmHopper,\x20%s,\x20%s',_0x10bb92,_0xac91('0xf'));logger[_0xac91('0x10')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x10bb92,_0xac91('0xf'),JSON[_0xac91('0x11')](_0x3c6b68));if(_0x3c6b68[_0xac91('0x12')]){if(_0x3c6b68['error'][_0xac91('0x13')]===0x1f4){logger[_0xac91('0x12')](_0xac91('0x14'),_0x10bb92,_0x3c6b68[_0xac91('0x12')][_0xac91('0x15')]);return _0x321d94(_0x3c6b68['error'][_0xac91('0x15')]);}logger[_0xac91('0x12')](_0xac91('0x14'),_0x10bb92,_0x3c6b68[_0xac91('0x12')][_0xac91('0x15')]);return _0x3e158e(_0x3c6b68['error'][_0xac91('0x15')]);}else{logger['info']('CmHopper,\x20%s,\x20%s',_0x10bb92,_0xac91('0xf'));_0x3e158e(_0x3c6b68[_0xac91('0x16')]['message']);}})[_0xac91('0x17')](function(_0x2884fd){logger[_0xac91('0x12')]('CmHopper,\x20%s,\x20%s',_0x10bb92,_0x2884fd);_0x321d94(_0x2884fd);});});}exports[_0xac91('0x18')]=function(_0x15bc8b){var _0x25ca46=this;return new Promise(function(_0x34149c,_0x5d8ab2){return db['CmHopper'][_0xac91('0x19')]({'raw':_0x15bc8b[_0xac91('0x1a')]?_0x15bc8b[_0xac91('0x1a')][_0xac91('0x1b')]===undefined?!![]:![]:!![],'where':_0x15bc8b[_0xac91('0x1a')]?_0x15bc8b[_0xac91('0x1a')][_0xac91('0x1c')]||null:null,'attributes':_0x15bc8b[_0xac91('0x1a')]?_0x15bc8b['options'][_0xac91('0x1d')]||null:null,'limit':_0x15bc8b[_0xac91('0x1a')]?_0x15bc8b[_0xac91('0x1a')]['limit']||null:null,'include':_0x15bc8b[_0xac91('0x1a')]?_0x15bc8b['options'][_0xac91('0x1e')]?_['map'](_0x15bc8b[_0xac91('0x1a')][_0xac91('0x1e')],function(_0xbd8690){return{'model':db[_0xbd8690['model']],'as':_0xbd8690['as'],'attributes':_0xbd8690['attributes'],'include':_0xbd8690[_0xac91('0x1e')]?_['map'](_0xbd8690['include'],function(_0x27f7b7){return{'model':db[_0x27f7b7[_0xac91('0x1f')]],'as':_0x27f7b7['as'],'attributes':_0x27f7b7[_0xac91('0x1d')],'include':_0x27f7b7[_0xac91('0x1e')]?_[_0xac91('0x20')](_0x27f7b7[_0xac91('0x1e')],function(_0x3d38ca){return{'model':db[_0x3d38ca['model']],'as':_0x3d38ca['as'],'attributes':_0x3d38ca[_0xac91('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ac795){logger[_0xac91('0xe')](_0xac91('0x18'),_0x15bc8b);logger[_0xac91('0x10')](_0xac91('0x18'),_0x15bc8b,JSON[_0xac91('0x11')](_0x3ac795));_0x34149c(_0x3ac795);})[_0xac91('0x17')](function(_0xb12463){logger['error']('GetCmHopper',_0xb12463[_0xac91('0x15')],_0x15bc8b);_0x5d8ab2(_0x25ca46['error'](0x1f4,_0xb12463['message']));});});};exports[_0xac91('0x21')]=function(_0x294c17){var _0x498c53=this;return new Promise(function(_0x3959c4,_0x556a96){return db[_0xac91('0x22')][_0xac91('0x23')]({'raw':_0x294c17[_0xac91('0x1a')]?_0x294c17[_0xac91('0x1a')][_0xac91('0x1b')]===undefined?!![]:![]:!![],'where':_0x294c17[_0xac91('0x1a')]?_0x294c17[_0xac91('0x1a')]['where']||null:null,'attributes':_0x294c17['options']?_0x294c17[_0xac91('0x1a')][_0xac91('0x1d')]||null:null,'include':_0x294c17['options']?_0x294c17[_0xac91('0x1a')][_0xac91('0x1e')]?_[_0xac91('0x20')](_0x294c17[_0xac91('0x1a')][_0xac91('0x1e')],function(_0x3e1ad1){return{'model':db[_0x3e1ad1[_0xac91('0x1f')]],'as':_0x3e1ad1['as'],'attributes':_0x3e1ad1['attributes'],'include':_0x3e1ad1['include']?_['map'](_0x3e1ad1['include'],function(_0x11d0f7){return{'model':db[_0x11d0f7['model']],'as':_0x11d0f7['as'],'attributes':_0x11d0f7[_0xac91('0x1d')],'include':_0x11d0f7['include']?_[_0xac91('0x20')](_0x11d0f7['include'],function(_0x146897){return{'model':db[_0x146897[_0xac91('0x1f')]],'as':_0x146897['as'],'attributes':_0x146897['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1eb6c0){logger[_0xac91('0xe')](_0xac91('0x21'),_0x294c17);logger['debug']('ShowCmHopper',_0x294c17,JSON['stringify'](_0x1eb6c0));_0x3959c4(_0x1eb6c0);})[_0xac91('0x17')](function(_0x46755b){logger[_0xac91('0x12')](_0xac91('0x21'),_0x46755b[_0xac91('0x15')],_0x294c17);_0x556a96(_0x498c53[_0xac91('0x12')](0x1f4,_0x46755b[_0xac91('0x15')]));});});};exports['CreateCmHopper']=function(_0x250ed8){var _0x390d6f=this;return new Promise(function(_0x2e01dd,_0x53a230){return db['CmHopper'][_0xac91('0x24')](_0x250ed8['body'],{'raw':_0x250ed8[_0xac91('0x1a')]?_0x250ed8[_0xac91('0x1a')][_0xac91('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x447079){logger['info'](_0xac91('0x25'),_0x250ed8);logger[_0xac91('0x10')](_0xac91('0x25'),_0x250ed8,JSON[_0xac91('0x11')](_0x447079));_0x2e01dd(_0x447079);})[_0xac91('0x17')](function(_0x3c278a){logger[_0xac91('0x12')](_0xac91('0x25'),_0x3c278a[_0xac91('0x15')],_0x250ed8);_0x53a230(_0x390d6f[_0xac91('0x12')](0x1f4,_0x3c278a[_0xac91('0x15')]));});});};exports[_0xac91('0x26')]=function(_0x3b89b4){var _0x33ff74=this;return new Promise(function(_0x4cc27f,_0x4d7b3c){return db[_0xac91('0x22')]['update'](_0x3b89b4[_0xac91('0x27')],{'raw':_0x3b89b4[_0xac91('0x1a')]?_0x3b89b4[_0xac91('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b89b4[_0xac91('0x1a')]?_0x3b89b4['options']['where']||null:null,'attributes':_0x3b89b4[_0xac91('0x1a')]?_0x3b89b4[_0xac91('0x1a')][_0xac91('0x1d')]||null:null,'limit':_0x3b89b4[_0xac91('0x1a')]?_0x3b89b4[_0xac91('0x1a')][_0xac91('0x28')]||null:null})[_0xac91('0xd')](function(_0x3e4209){logger[_0xac91('0xe')](_0xac91('0x26'),_0x3b89b4);logger[_0xac91('0xe')](_0xac91('0x29'),JSON[_0xac91('0x11')](_0x3b89b4[_0xac91('0x1a')]['where']),_0x3b89b4['body']['active']);logger[_0xac91('0x10')](_0xac91('0x26'),_0x3b89b4,JSON[_0xac91('0x11')](_0x3e4209));_0x4cc27f(_0x3e4209);})['catch'](function(_0x2fc659){logger[_0xac91('0x12')]('UpdateCmHopper',_0x2fc659[_0xac91('0x15')],_0x3b89b4);_0x4d7b3c(_0x33ff74[_0xac91('0x12')](0x1f4,_0x2fc659[_0xac91('0x15')]));});});};exports[_0xac91('0x2a')]=function(_0x3e6d5b){var _0x1a5fa9=this;return new Promise(function(_0x19e9ae,_0x5426b0){return db[_0xac91('0x22')][_0xac91('0x2b')]({'where':_0x3e6d5b[_0xac91('0x1a')]?_0x3e6d5b[_0xac91('0x1a')][_0xac91('0x1c')]||null:null})[_0xac91('0xd')](function(_0x2c792a){logger[_0xac91('0xe')](_0xac91('0x2a'),_0x3e6d5b);logger[_0xac91('0x10')]('DestroyCmHopper',_0x3e6d5b,JSON[_0xac91('0x11')](_0x2c792a));_0x19e9ae(_0x2c792a);})['catch'](function(_0x16aa11){logger[_0xac91('0x12')](_0xac91('0x2a'),_0x16aa11[_0xac91('0x15')],_0x3e6d5b);_0x5426b0(_0x1a5fa9[_0xac91('0x12')](0x1f4,_0x16aa11[_0xac91('0x15')]));});});};exports[_0xac91('0x2c')]=function(_0x31100e){var _0x43f310=this;return new Promise(function(_0x393c0c,_0x26965d){return db[_0xac91('0x2d')]['describe']()['then'](function(_0x1d9054){return db['sequelize'][_0xac91('0x2e')](function(_0xa571d5){return db['CmHopper'][_0xac91('0x19')]({'where':_0x31100e[_0xac91('0x1a')]?_0x31100e['options'][_0xac91('0x1c')]||null:null,'attributes':_0x31100e[_0xac91('0x1a')]?_0x31100e[_0xac91('0x1a')]['attributes']||null:null,'limit':_0x31100e[_0xac91('0x1a')]?_0x31100e[_0xac91('0x1a')][_0xac91('0x28')]||null:null,'order':_0x31100e[_0xac91('0x1a')]?_0x31100e[_0xac91('0x1a')]['order']||null:null,'transaction':_0xa571d5,'lock':_0xa571d5[_0xac91('0x2f')][_0xac91('0x30')],'include':[{'model':db[_0xac91('0x2d')],'as':_0xac91('0x31'),'attributes':_['keys'](_0x1d9054)},{'model':db[_0xac91('0x32')],'as':'Agent','attributes':['id',_0xac91('0x33'),_0xac91('0x34')]}]})['then'](function(_0x4d73d7){var _0x4ff324=[];var _0x3f9b00=[];for(var _0x17980f=0x0;_0x17980f<_0x4d73d7['length'];_0x17980f+=0x1){var _0x28306b=_0x4d73d7[_0x17980f][_0xac91('0x35')];if(_0x28306b===null){_0x4ff324[_0xac91('0x36')](_0x4d73d7[_0x17980f][_0xac91('0x37')](_0x31100e[_0xac91('0x27')],{'transaction':_0xa571d5}));}else if(!_0x3f9b00[_0xac91('0x38')](_0x28306b)){_0x3f9b00[_0xac91('0x36')](_0x28306b);_0x4ff324[_0xac91('0x36')](_0x4d73d7[_0x17980f][_0xac91('0x37')](_0x31100e[_0xac91('0x27')],{'transaction':_0xa571d5}));}}return BPromise['all'](_0x4ff324);});})[_0xac91('0xd')](function(_0x46ecb1){logger[_0xac91('0xe')]('GetContactDialer',_0x31100e);if(_0x46ecb1[_0xac91('0x39')]>0x0){logger[_0xac91('0xe')](_0xac91('0x3a'),_0x46ecb1[0x0][_0xac91('0x3b')]['id'],_0x46ecb1[0x0]['dataValues'][_0xac91('0x3c')],_0x46ecb1[0x0][_0xac91('0x3b')][_0xac91('0x3d')]);}logger[_0xac91('0x10')](_0xac91('0x2c'),_0x31100e,JSON['stringify'](_0x46ecb1));_0x393c0c(_0x46ecb1);})['catch'](function(_0x48d1f8){logger[_0xac91('0x12')](_0xac91('0x2c'),_0x48d1f8[_0xac91('0x15')],_0x31100e);_0x26965d(_0x43f310['error'](0x1f4,_0x48d1f8[_0xac91('0x15')]));});});});};exports['MoveContactManagedDialer']=function(_0x5d9162){var _0x18d158=this;return new Promise(function(_0x19f74c,_0x38120d){return db['sequelize']['transaction'](function(_0x15c9a2){return db[_0xac91('0x3e')][_0xac91('0x24')](_0x5d9162[_0xac91('0x27')],{'raw':_0x5d9162[_0xac91('0x1a')]?_0x5d9162['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x15c9a2})[_0xac91('0xd')](function(){logger['info'](_0xac91('0x3f'),JSON[_0xac91('0x11')](_0x5d9162[_0xac91('0x1a')][_0xac91('0x1c')]),_0x5d9162['options'][_0xac91('0x1c')][_0xac91('0x3d')]);return db['CmHopper']['destroy']({'where':_0x5d9162['options']?_0x5d9162['options'][_0xac91('0x1c')]||null:null,'transaction':_0x15c9a2});});})[_0xac91('0xd')](function(_0x28ff57){logger[_0xac91('0xe')](_0xac91('0x40'),_0x5d9162);logger['debug']('MoveContactManagedDialer',_0x5d9162,JSON['stringify'](_0x28ff57));_0x19f74c(_0x28ff57);})[_0xac91('0x17')](function(_0x5badf7){logger['error'](_0xac91('0x40'),_0x5badf7['message'],_0x5d9162);_0x38120d(_0x18d158[_0xac91('0x12')](0x1f4,_0x5badf7['message']));});});};exports[_0xac91('0x41')]=function(_0x3f505c){var _0x10e5c6=this;return new Promise(function(_0x20f566,_0x39a9b0){return db[_0xac91('0x22')][_0xac91('0x19')]({'raw':_0x3f505c['options']?_0x3f505c[_0xac91('0x1a')][_0xac91('0x1b')]===undefined?!![]:![]:!![],'where':_0x3f505c['options']?_0x3f505c[_0xac91('0x1a')][_0xac91('0x1c')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xac91('0x42')]['fn']('IF',db['sequelize'][_0xac91('0x43')](_0xac91('0x44')+util[_0xac91('0x45')](_0xac91('0x46'),moment()[_0xac91('0x45')](_0xac91('0x47')))+_0xac91('0x48')))),_0xac91('0x49')]]})['then'](function(_0x1d8c5a){logger[_0xac91('0xe')](_0xac91('0x41'),_0x3f505c);logger[_0xac91('0x10')]('CountReScheduled',_0x3f505c,JSON[_0xac91('0x11')](_0x1d8c5a));_0x20f566(_0x1d8c5a);})[_0xac91('0x17')](function(_0x13146c){logger[_0xac91('0x12')](_0xac91('0x41'),_0x13146c[_0xac91('0x15')],_0x3f505c);_0x39a9b0(_0x10e5c6[_0xac91('0x12')](0x1f4,_0x13146c[_0xac91('0x15')]));});});};exports[_0xac91('0x4a')]=function(_0x40ff13){var _0x5a900b=this;return new Promise(function(_0x492f9e,_0xb92ca4){return db[_0xac91('0x2d')][_0xac91('0x4b')]()['then'](function(_0x1bf26f){return db[_0xac91('0x42')][_0xac91('0x2e')](function(_0x586c04){return db[_0xac91('0x22')][_0xac91('0x19')]({'where':_0x40ff13[_0xac91('0x1a')]?_0x40ff13[_0xac91('0x1a')][_0xac91('0x1c')]||null:null,'attributes':_0x40ff13[_0xac91('0x1a')]?_0x40ff13[_0xac91('0x1a')][_0xac91('0x1d')]||null:null,'limit':0x1,'order':_0x40ff13[_0xac91('0x1a')]?_0x40ff13[_0xac91('0x1a')][_0xac91('0x4c')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x586c04,'lock':_0x586c04['LOCK'][_0xac91('0x30')],'include':_0x40ff13['options']?_0x40ff13['options'][_0xac91('0x1e')]?_[_0xac91('0x20')](_0x40ff13[_0xac91('0x1a')][_0xac91('0x1e')],function(_0x54d1f1){return{'model':db[_0x54d1f1[_0xac91('0x1f')]],'as':_0x54d1f1['as'],'attributes':_0x54d1f1[_0xac91('0x1d')],'include':_0x54d1f1[_0xac91('0x1e')]?_[_0xac91('0x20')](_0x54d1f1[_0xac91('0x1e')],function(_0x243ed9){return{'model':db[_0x243ed9[_0xac91('0x1f')]],'as':_0x243ed9['as'],'attributes':_0x243ed9[_0xac91('0x1d')],'include':_0x243ed9[_0xac91('0x1e')]?_['map'](_0x243ed9[_0xac91('0x1e')],function(_0x34d13a){return{'model':db[_0x34d13a[_0xac91('0x1f')]],'as':_0x34d13a['as'],'attributes':_0x34d13a[_0xac91('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xac91('0xd')](function(_0x10f895){var _0x2cc4fc=[];for(var _0x5a3a9a=0x0;_0x5a3a9a<_0x10f895[_0xac91('0x39')];_0x5a3a9a+=0x1){_0x2cc4fc[_0xac91('0x36')](_0x10f895[_0x5a3a9a][_0xac91('0x37')](_0x40ff13['body'],{'transaction':_0x586c04}));}return BPromise[_0xac91('0x4d')](_0x2cc4fc);});})[_0xac91('0xd')](function(_0x10c6fd){logger[_0xac91('0xe')](_0xac91('0x4a'),_0x40ff13);logger[_0xac91('0x10')](_0xac91('0x4a'),_0x40ff13,JSON[_0xac91('0x11')](_0x10c6fd));_0x492f9e(_0x10c6fd);})[_0xac91('0x17')](function(_0xefaddd){logger['error']('GetContactRecallMe',_0xefaddd['message'],_0x40ff13);_0xb92ca4(_0x5a900b[_0xac91('0x12')](0x1f4,_0xefaddd[_0xac91('0x15')]));});});});};exports[_0xac91('0x4e')]=function(_0x34b3ed){var _0x1c07fc=this;return new Promise(function(_0x1d51ef,_0x4354c6){db[_0xac91('0x2d')][_0xac91('0x4b')]()[_0xac91('0xd')](function(_0x20c6f1){return db[_0xac91('0x22')][_0xac91('0x19')]({'raw':_0x34b3ed[_0xac91('0x1a')]?_0x34b3ed[_0xac91('0x1a')][_0xac91('0x1b')]===undefined?!![]:![]:!![],'where':_0x34b3ed[_0xac91('0x1a')]?_0x34b3ed[_0xac91('0x1a')][_0xac91('0x1c')]||null:null,'attributes':_0x34b3ed['options']?_0x34b3ed[_0xac91('0x1a')][_0xac91('0x1d')]||null:null,'limit':_0x34b3ed[_0xac91('0x1a')]?_0x34b3ed['options'][_0xac91('0x28')]||null:null,'include':_0x34b3ed['options']?_0x34b3ed[_0xac91('0x1a')][_0xac91('0x1e')]?_[_0xac91('0x20')](_0x34b3ed['options']['include'],function(_0x29c02b){return{'model':db[_0x29c02b[_0xac91('0x1f')]],'as':_0x29c02b['as'],'attributes':_0x29c02b['as']===_0xac91('0x31')?_[_0xac91('0x4f')](_0x20c6f1):_0x29c02b['attributes'],'include':_0x29c02b[_0xac91('0x1e')]?_[_0xac91('0x20')](_0x29c02b[_0xac91('0x1e')],function(_0x343a2c){return{'model':db[_0x343a2c[_0xac91('0x1f')]],'as':_0x343a2c['as'],'attributes':_0x343a2c[_0xac91('0x1d')],'include':_0x343a2c[_0xac91('0x1e')]?_[_0xac91('0x20')](_0x343a2c['include'],function(_0x1dbf0d){return{'model':db[_0x1dbf0d[_0xac91('0x1f')]],'as':_0x1dbf0d['as'],'attributes':_0x1dbf0d['attributes']};}):[]};}):[]};}):[]:[]})[_0xac91('0xd')](function(_0x2958fd){logger['info'](_0xac91('0x18'),_0x34b3ed);logger[_0xac91('0x10')](_0xac91('0x18'),_0x34b3ed,JSON['stringify'](_0x2958fd));_0x1d51ef(_0x2958fd);})[_0xac91('0x17')](function(_0x4ff498){logger[_0xac91('0x12')](_0xac91('0x18'),_0x4ff498[_0xac91('0x15')],_0x34b3ed);_0x4354c6(_0x1c07fc[_0xac91('0x12')](0x1f4,_0x4ff498[_0xac91('0x15')]));});});});};exports[_0xac91('0x50')]=function(_0x4a9c91){var _0x305824=this;return new Promise(function(_0x5ad82f,_0x272e38){return db[_0xac91('0x42')][_0xac91('0x2e')](function(_0x50eeca){return db['CmHopper'][_0xac91('0x37')]({'active':![]},{'where':{},'transaction':_0x50eeca})['then'](function(_0x1e11fd){logger[_0xac91('0xe')](_0xac91('0x50'),_0x4a9c91);logger[_0xac91('0x10')](_0xac91('0x50'),_0x4a9c91,JSON[_0xac91('0x11')](_0x1e11fd));_0x5ad82f(_0x1e11fd);})[_0xac91('0x17')](function(_0x4db8e9){logger[_0xac91('0x12')](_0xac91('0x50'),_0x4db8e9[_0xac91('0x15')],_0x4a9c91);_0x272e38(_0x305824[_0xac91('0x12')](0x1f4,_0x4db8e9[_0xac91('0x15')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 88f0323..e803ac0 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 _0x175a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','index','get','/describe','describe','getOpenContacts','/:id','show','post','create','/preview','getPreview','update','destroy','util','path'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x175a,0xbe));var _0xa175=function(_0x10051f,_0x38ff78){_0x10051f=_0x10051f-0x0;var _0x1afbdd=_0x175a[_0x10051f];return _0x1afbdd;};'use strict';var multer=require('multer');var util=require(_0xa175('0x0'));var path=require(_0xa175('0x1'));var timeout=require(_0xa175('0x2'));var express=require(_0xa175('0x3'));var router=express[_0xa175('0x4')]();var fs_extra=require(_0xa175('0x5'));var auth=require(_0xa175('0x6'));var interaction=require(_0xa175('0x7'));var config=require(_0xa175('0x8'));var controller=require(_0xa175('0x9'));router['get']('/',auth[_0xa175('0xa')](),controller[_0xa175('0xb')]);router[_0xa175('0xc')](_0xa175('0xd'),auth['isAuthenticated'](),controller[_0xa175('0xe')]);router[_0xa175('0xc')]('/opencontacts',auth[_0xa175('0xa')](),controller[_0xa175('0xf')]);router[_0xa175('0xc')](_0xa175('0x10'),auth[_0xa175('0xa')](),controller[_0xa175('0x11')]);router[_0xa175('0x12')]('/',auth[_0xa175('0xa')](),controller[_0xa175('0x13')]);router[_0xa175('0x12')](_0xa175('0x14'),auth[_0xa175('0xa')](),controller[_0xa175('0x15')]);router['put'](_0xa175('0x10'),auth['isAuthenticated'](),controller[_0xa175('0x16')]);router['delete'](_0xa175('0x10'),auth[_0xa175('0xa')](),controller[_0xa175('0x17')]);module['exports']=router; \ No newline at end of file +var _0x3144=['describe','/opencontacts','getOpenContacts','show','create','post','/preview','put','/:id','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','get','isAuthenticated','index'];(function(_0x270dd2,_0x33eadb){var _0x634a60=function(_0x21002c){while(--_0x21002c){_0x270dd2['push'](_0x270dd2['shift']());}};_0x634a60(++_0x33eadb);}(_0x3144,0x17c));var _0x4314=function(_0x3b63d9,_0x581a7d){_0x3b63d9=_0x3b63d9-0x0;var _0x4b7ad4=_0x3144[_0x3b63d9];return _0x4b7ad4;};'use strict';var multer=require('multer');var util=require(_0x4314('0x0'));var path=require(_0x4314('0x1'));var timeout=require(_0x4314('0x2'));var express=require('express');var router=express[_0x4314('0x3')]();var fs_extra=require(_0x4314('0x4'));var auth=require(_0x4314('0x5'));var interaction=require(_0x4314('0x6'));var config=require('../../config/environment');var controller=require(_0x4314('0x7'));router[_0x4314('0x8')]('/',auth[_0x4314('0x9')](),controller[_0x4314('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x4314('0xb')]);router[_0x4314('0x8')](_0x4314('0xc'),auth[_0x4314('0x9')](),controller[_0x4314('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4314('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4314('0xf')]);router[_0x4314('0x10')](_0x4314('0x11'),auth[_0x4314('0x9')](),controller['getPreview']);router[_0x4314('0x12')](_0x4314('0x13'),auth[_0x4314('0x9')](),controller['update']);router[_0x4314('0x14')](_0x4314('0x13'),auth['isAuthenticated'](),controller[_0x4314('0x15')]);module[_0x4314('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 66796aa..6f12e90 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 _0x58dc=['sequelize','STRING','INTEGER','contactListQueue','moment'];(function(_0x54ece6,_0x11a6c6){var _0x2cfd35=function(_0x8163c6){while(--_0x8163c6){_0x54ece6['push'](_0x54ece6['shift']());}};_0x2cfd35(++_0x11a6c6);}(_0x58dc,0x199));var _0xc58d=function(_0x5011c3,_0x54e0bb){_0x5011c3=_0x5011c3-0x0;var _0x405774=_0x58dc[_0x5011c3];return _0x405774;};'use strict';var moment=require(_0xc58d('0x0'));var Sequelize=require(_0xc58d('0x1'));module['exports']={'phone':{'type':Sequelize[_0xc58d('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xc58d('0x3')],'unique':_0xc58d('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xc58d('0x4')},'VoiceQueueId':{'type':Sequelize[_0xc58d('0x3')],'unique':_0xc58d('0x4')}}; \ No newline at end of file +var _0x5e9c=['contactListQueue','INTEGER','moment','sequelize','exports','STRING'];(function(_0x402e11,_0x151b7c){var _0x3f2cef=function(_0x43be04){while(--_0x43be04){_0x402e11['push'](_0x402e11['shift']());}};_0x3f2cef(++_0x151b7c);}(_0x5e9c,0x17c));var _0xc5e9=function(_0x53be99,_0x573c8b){_0x53be99=_0x53be99-0x0;var _0x4442e8=_0x5e9c[_0x53be99];return _0x4442e8;};'use strict';var moment=require(_0xc5e9('0x0'));var Sequelize=require(_0xc5e9('0x1'));module[_0xc5e9('0x2')]={'phone':{'type':Sequelize[_0xc5e9('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xc5e9('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xc5e9('0x4')},'VoiceQueueId':{'type':Sequelize[_0xc5e9('0x5')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 08a417f..d83d449 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 _0xc7c3=['count','offset','set','Content-Range','reject','update','then','error','stack','name','send','map','CmHopperBlack','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','body','find','params','destroy','describe','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc7c3,0x143));var _0x3c7c=function(_0x28625f,_0x214ee9){_0x28625f=_0x28625f-0x0;var _0x594950=_0xc7c3[_0x28625f];return _0x594950;};'use strict';var emlformat=require(_0x3c7c('0x0'));var rimraf=require(_0x3c7c('0x1'));var zipdir=require(_0x3c7c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3c7c('0x3'));var Mustache=require(_0x3c7c('0x4'));var util=require('util');var path=require(_0x3c7c('0x5'));var sox=require(_0x3c7c('0x6'));var csv=require('to-csv');var ejs=require(_0x3c7c('0x7'));var fs=require('fs');var fs_extra=require(_0x3c7c('0x8'));var _=require('lodash');var squel=require(_0x3c7c('0x9'));var crypto=require(_0x3c7c('0xa'));var jsforce=require(_0x3c7c('0xb'));var deskjs=require(_0x3c7c('0xc'));var toCsv=require(_0x3c7c('0xd'));var querystring=require(_0x3c7c('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3c7c('0xf'));var qs=require(_0x3c7c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c7c('0x11'));var logger=require('../../config/logger')(_0x3c7c('0x12'));var utils=require(_0x3c7c('0x13'));var config=require(_0x3c7c('0x14'));var licenseUtil=require(_0x3c7c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2068ee,_0x127395){_0x127395=_0x127395||0xcc;return function(_0x23d2ad){if(_0x23d2ad){return _0x2068ee['sendStatus'](_0x127395);}return _0x2068ee[_0x3c7c('0x16')](_0x127395)[_0x3c7c('0x17')]();};}function respondWithResult(_0x406110,_0x1c3b20){_0x1c3b20=_0x1c3b20||0xc8;return function(_0x2b412b){if(_0x2b412b){return _0x406110[_0x3c7c('0x16')](_0x1c3b20)[_0x3c7c('0x18')](_0x2b412b);}};}function respondWithFilteredResult(_0x513f33,_0x5d71df){return function(_0x5a3f8b){if(_0x5a3f8b){var _0x5a700a=typeof _0x5d71df['offset']===_0x3c7c('0x19')&&typeof _0x5d71df[_0x3c7c('0x1a')]==='undefined';var _0x2cc1bf=_0x5a3f8b[_0x3c7c('0x1b')];var _0x841dad=_0x5a700a?0x0:_0x5d71df[_0x3c7c('0x1c')];var _0x432af8=_0x5a700a?_0x5a3f8b[_0x3c7c('0x1b')]:_0x5d71df[_0x3c7c('0x1c')]+_0x5d71df[_0x3c7c('0x1a')];var _0x2c77cf;if(_0x432af8>=_0x2cc1bf){_0x432af8=_0x2cc1bf;_0x2c77cf=0xc8;}else{_0x2c77cf=0xce;}_0x513f33[_0x3c7c('0x16')](_0x2c77cf);return _0x513f33[_0x3c7c('0x1d')](_0x3c7c('0x1e'),_0x841dad+'-'+_0x432af8+'/'+_0x2cc1bf)[_0x3c7c('0x18')](_0x5a3f8b);}return null;};}function patchUpdates(_0x4a1abf){return function(_0x5e6a44){try{jsonpatch['apply'](_0x5e6a44,_0x4a1abf,!![]);}catch(_0x19d0ec){return BPromise[_0x3c7c('0x1f')](_0x19d0ec);}return _0x5e6a44['save']();};}function saveUpdates(_0x575d73,_0x2d0d8a){return function(_0x3ffc4a){if(_0x3ffc4a){return _0x3ffc4a[_0x3c7c('0x20')](_0x575d73)[_0x3c7c('0x21')](function(_0x3e2703){return _0x3e2703;});}return null;};}function removeEntity(_0x2c19a1,_0x1cb073){return function(_0x583309){if(_0x583309){return _0x583309['destroy']()[_0x3c7c('0x21')](function(){_0x2c19a1[_0x3c7c('0x16')](0xcc)[_0x3c7c('0x17')]();});}};}function handleEntityNotFound(_0x493fd3,_0x4cbe81){return function(_0x236d04){if(!_0x236d04){_0x493fd3['sendStatus'](0x194);}return _0x236d04;};}function handleError(_0x26d346,_0x47b279){_0x47b279=_0x47b279||0x1f4;return function(_0x53eb4b){logger[_0x3c7c('0x22')](_0x53eb4b[_0x3c7c('0x23')]);if(_0x53eb4b[_0x3c7c('0x24')]){delete _0x53eb4b['name'];}_0x26d346[_0x3c7c('0x16')](_0x47b279)[_0x3c7c('0x25')](_0x53eb4b);};}exports['index']=function(_0x3ce777,_0x2f6243){var _0x26f597={},_0x146ffa={},_0x23e323={'count':0x0,'rows':[]};var _0x764e35=_[_0x3c7c('0x26')](db[_0x3c7c('0x27')][_0x3c7c('0x28')],function(_0x14c627){return{'name':_0x14c627[_0x3c7c('0x29')],'type':_0x14c627[_0x3c7c('0x2a')]['key']};});_0x146ffa[_0x3c7c('0x2b')]=_[_0x3c7c('0x26')](_0x764e35,_0x3c7c('0x24'));_0x146ffa[_0x3c7c('0x2c')]=_[_0x3c7c('0x2d')](_0x3ce777[_0x3c7c('0x2c')]);_0x146ffa[_0x3c7c('0x2e')]=_[_0x3c7c('0x2f')](_0x146ffa[_0x3c7c('0x2b')],_0x146ffa['query']);_0x26f597['attributes']=_[_0x3c7c('0x2f')](_0x146ffa[_0x3c7c('0x2b')],qs['fields'](_0x3ce777[_0x3c7c('0x2c')][_0x3c7c('0x30')]));_0x26f597[_0x3c7c('0x31')]=_0x26f597['attributes'][_0x3c7c('0x32')]?_0x26f597[_0x3c7c('0x31')]:_0x146ffa['model'];if(!_0x3ce777['query']['hasOwnProperty'](_0x3c7c('0x33'))){_0x26f597[_0x3c7c('0x1a')]=qs[_0x3c7c('0x1a')](_0x3ce777[_0x3c7c('0x2c')]['limit']);_0x26f597[_0x3c7c('0x1c')]=qs[_0x3c7c('0x1c')](_0x3ce777['query'][_0x3c7c('0x1c')]);}_0x26f597[_0x3c7c('0x34')]=qs[_0x3c7c('0x35')](_0x3ce777[_0x3c7c('0x2c')][_0x3c7c('0x35')]);_0x26f597[_0x3c7c('0x36')]=qs[_0x3c7c('0x2e')](_[_0x3c7c('0x37')](_0x3ce777[_0x3c7c('0x2c')],_0x146ffa[_0x3c7c('0x2e')]),_0x764e35);if(_0x3ce777[_0x3c7c('0x2c')]['filter']){_0x26f597[_0x3c7c('0x36')]=_[_0x3c7c('0x38')](_0x26f597[_0x3c7c('0x36')],{'$or':_[_0x3c7c('0x26')](_0x764e35,function(_0x465ed6){if(_0x465ed6[_0x3c7c('0x2a')]!==_0x3c7c('0x39')){var _0x309b05={};_0x309b05[_0x465ed6[_0x3c7c('0x24')]]={'$like':'%'+_0x3ce777[_0x3c7c('0x2c')]['filter']+'%'};return _0x309b05;}})});}_0x26f597=_[_0x3c7c('0x38')]({},_0x26f597,_0x3ce777['options']);var _0x590dbc={'where':_0x26f597['where']};return db[_0x3c7c('0x27')][_0x3c7c('0x1b')](_0x590dbc)['then'](function(_0x417d87){_0x23e323['count']=_0x417d87;if(_0x3ce777[_0x3c7c('0x2c')][_0x3c7c('0x3a')]){_0x26f597[_0x3c7c('0x3b')]=[{'all':!![]}];}return db[_0x3c7c('0x27')][_0x3c7c('0x3c')](_0x26f597);})[_0x3c7c('0x21')](function(_0x2baf48){_0x23e323[_0x3c7c('0x3d')]=_0x2baf48;return _0x23e323;})[_0x3c7c('0x21')](respondWithFilteredResult(_0x2f6243,_0x26f597))[_0x3c7c('0x3e')](handleError(_0x2f6243,null));};exports[_0x3c7c('0x3f')]=function(_0x20d974,_0xa7194f){var _0x810998={'raw':!![],'where':{'id':_0x20d974['params']['id']}},_0x3f638e={};_0x3f638e[_0x3c7c('0x2b')]=_[_0x3c7c('0x2d')](db[_0x3c7c('0x27')]['rawAttributes']);_0x3f638e[_0x3c7c('0x2c')]=_[_0x3c7c('0x2d')](_0x20d974['query']);_0x3f638e[_0x3c7c('0x2e')]=_[_0x3c7c('0x2f')](_0x3f638e[_0x3c7c('0x2b')],_0x3f638e[_0x3c7c('0x2c')]);_0x810998['attributes']=_['intersection'](_0x3f638e[_0x3c7c('0x2b')],qs['fields'](_0x20d974[_0x3c7c('0x2c')]['fields']));_0x810998[_0x3c7c('0x31')]=_0x810998[_0x3c7c('0x31')][_0x3c7c('0x32')]?_0x810998[_0x3c7c('0x31')]:_0x3f638e[_0x3c7c('0x2b')];if(_0x20d974['query'][_0x3c7c('0x3a')]){_0x810998[_0x3c7c('0x3b')]=[{'all':!![]}];}_0x810998=_['merge']({},_0x810998,_0x20d974[_0x3c7c('0x40')]);return db[_0x3c7c('0x27')]['find'](_0x810998)[_0x3c7c('0x21')](handleEntityNotFound(_0xa7194f,null))['then'](respondWithResult(_0xa7194f,null))['catch'](handleError(_0xa7194f,null));};exports[_0x3c7c('0x20')]=function(_0x47406a,_0x2c5087){if(_0x47406a[_0x3c7c('0x41')]['id']){delete _0x47406a[_0x3c7c('0x41')]['id'];}return db[_0x3c7c('0x27')][_0x3c7c('0x42')]({'where':{'id':_0x47406a[_0x3c7c('0x43')]['id']}})[_0x3c7c('0x21')](handleEntityNotFound(_0x2c5087,null))['then'](saveUpdates(_0x47406a['body'],null))[_0x3c7c('0x21')](respondWithResult(_0x2c5087,null))[_0x3c7c('0x3e')](handleError(_0x2c5087,null));};exports[_0x3c7c('0x44')]=function(_0x2def75,_0x17d709){return db[_0x3c7c('0x27')][_0x3c7c('0x42')]({'where':{'id':_0x2def75[_0x3c7c('0x43')]['id']}})[_0x3c7c('0x21')](handleEntityNotFound(_0x17d709,null))['then'](removeEntity(_0x17d709,null))[_0x3c7c('0x3e')](handleError(_0x17d709,null));};exports[_0x3c7c('0x45')]=function(_0x492765,_0x13ba64){return db[_0x3c7c('0x27')][_0x3c7c('0x45')]()['then'](respondWithResult(_0x13ba64,null))['catch'](handleError(_0x13ba64,null));}; \ No newline at end of file +var _0x7b9e=['catch','show','keys','include','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperBlack','includeAll','rows'];(function(_0x348d18,_0x2de3e8){var _0x13da47=function(_0x94e12f){while(--_0x94e12f){_0x348d18['push'](_0x348d18['shift']());}};_0x13da47(++_0x2de3e8);}(_0x7b9e,0xdd));var _0xe7b9=function(_0xb2f889,_0x44d48d){_0xb2f889=_0xb2f889-0x0;var _0x383ede=_0x7b9e[_0xb2f889];return _0x383ede;};'use strict';var emlformat=require(_0xe7b9('0x0'));var rimraf=require(_0xe7b9('0x1'));var zipdir=require(_0xe7b9('0x2'));var jsonpatch=require(_0xe7b9('0x3'));var rp=require(_0xe7b9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe7b9('0x5'));var path=require(_0xe7b9('0x6'));var sox=require(_0xe7b9('0x7'));var csv=require(_0xe7b9('0x8'));var ejs=require(_0xe7b9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe7b9('0xa'));var squel=require('squel');var crypto=require(_0xe7b9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe7b9('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe7b9('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7b9('0xe'));var qs=require(_0xe7b9('0xf'));var as=require(_0xe7b9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe7b9('0x11'))('api');var utils=require(_0xe7b9('0x12'));var config=require(_0xe7b9('0x13'));var licenseUtil=require(_0xe7b9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13400c,_0x48fb6f){_0x48fb6f=_0x48fb6f||0xcc;return function(_0x34b7f9){if(_0x34b7f9){return _0x13400c[_0xe7b9('0x15')](_0x48fb6f);}return _0x13400c[_0xe7b9('0x16')](_0x48fb6f)[_0xe7b9('0x17')]();};}function respondWithResult(_0x553d29,_0x546ac9){_0x546ac9=_0x546ac9||0xc8;return function(_0x19b087){if(_0x19b087){return _0x553d29[_0xe7b9('0x16')](_0x546ac9)[_0xe7b9('0x18')](_0x19b087);}};}function respondWithFilteredResult(_0x54896f,_0x3fff5c){return function(_0x6983ea){if(_0x6983ea){var _0x48f8cb=typeof _0x3fff5c[_0xe7b9('0x19')]===_0xe7b9('0x1a')&&typeof _0x3fff5c[_0xe7b9('0x1b')]===_0xe7b9('0x1a');var _0x1170ff=_0x6983ea[_0xe7b9('0x1c')];var _0x50b3c2=_0x48f8cb?0x0:_0x3fff5c[_0xe7b9('0x19')];var _0x236899=_0x48f8cb?_0x6983ea[_0xe7b9('0x1c')]:_0x3fff5c[_0xe7b9('0x19')]+_0x3fff5c[_0xe7b9('0x1b')];var _0x170a17;if(_0x236899>=_0x1170ff){_0x236899=_0x1170ff;_0x170a17=0xc8;}else{_0x170a17=0xce;}_0x54896f[_0xe7b9('0x16')](_0x170a17);return _0x54896f['set'](_0xe7b9('0x1d'),_0x50b3c2+'-'+_0x236899+'/'+_0x1170ff)[_0xe7b9('0x18')](_0x6983ea);}return null;};}function patchUpdates(_0x7e032){return function(_0x58f862){try{jsonpatch[_0xe7b9('0x1e')](_0x58f862,_0x7e032,!![]);}catch(_0x4a06be){return BPromise['reject'](_0x4a06be);}return _0x58f862[_0xe7b9('0x1f')]();};}function saveUpdates(_0x3b2a1f,_0x197338){return function(_0x2a6e25){if(_0x2a6e25){return _0x2a6e25[_0xe7b9('0x20')](_0x3b2a1f)['then'](function(_0x192387){return _0x192387;});}return null;};}function removeEntity(_0x3fe595,_0x252d1b){return function(_0x264eef){if(_0x264eef){return _0x264eef[_0xe7b9('0x21')]()[_0xe7b9('0x22')](function(){_0x3fe595[_0xe7b9('0x16')](0xcc)[_0xe7b9('0x17')]();});}};}function handleEntityNotFound(_0x514708,_0x2bc4fc){return function(_0x124db9){if(!_0x124db9){_0x514708[_0xe7b9('0x15')](0x194);}return _0x124db9;};}function handleError(_0x53b278,_0x3aadea){_0x3aadea=_0x3aadea||0x1f4;return function(_0x4f9cfa){logger[_0xe7b9('0x23')](_0x4f9cfa[_0xe7b9('0x24')]);if(_0x4f9cfa[_0xe7b9('0x25')]){delete _0x4f9cfa[_0xe7b9('0x25')];}_0x53b278[_0xe7b9('0x16')](_0x3aadea)[_0xe7b9('0x26')](_0x4f9cfa);};}exports[_0xe7b9('0x27')]=function(_0x3567c4,_0x278331){var _0xb68544={},_0x4394ab={},_0x54a832={'count':0x0,'rows':[]};var _0x58800f=_[_0xe7b9('0x28')](db['CmHopperBlack'][_0xe7b9('0x29')],function(_0x259766){return{'name':_0x259766['fieldName'],'type':_0x259766[_0xe7b9('0x2a')]['key']};});_0x4394ab[_0xe7b9('0x2b')]=_[_0xe7b9('0x28')](_0x58800f,_0xe7b9('0x25'));_0x4394ab['query']=_['keys'](_0x3567c4[_0xe7b9('0x2c')]);_0x4394ab[_0xe7b9('0x2d')]=_[_0xe7b9('0x2e')](_0x4394ab[_0xe7b9('0x2b')],_0x4394ab[_0xe7b9('0x2c')]);_0xb68544[_0xe7b9('0x2f')]=_[_0xe7b9('0x2e')](_0x4394ab[_0xe7b9('0x2b')],qs[_0xe7b9('0x30')](_0x3567c4['query'][_0xe7b9('0x30')]));_0xb68544['attributes']=_0xb68544['attributes'][_0xe7b9('0x31')]?_0xb68544['attributes']:_0x4394ab[_0xe7b9('0x2b')];if(!_0x3567c4[_0xe7b9('0x2c')][_0xe7b9('0x32')](_0xe7b9('0x33'))){_0xb68544[_0xe7b9('0x1b')]=qs['limit'](_0x3567c4[_0xe7b9('0x2c')]['limit']);_0xb68544[_0xe7b9('0x19')]=qs['offset'](_0x3567c4[_0xe7b9('0x2c')][_0xe7b9('0x19')]);}_0xb68544[_0xe7b9('0x34')]=qs[_0xe7b9('0x35')](_0x3567c4[_0xe7b9('0x2c')][_0xe7b9('0x35')]);_0xb68544[_0xe7b9('0x36')]=qs[_0xe7b9('0x2d')](_[_0xe7b9('0x37')](_0x3567c4[_0xe7b9('0x2c')],_0x4394ab['filters']),_0x58800f);if(_0x3567c4['query'][_0xe7b9('0x38')]){_0xb68544[_0xe7b9('0x36')]=_[_0xe7b9('0x39')](_0xb68544[_0xe7b9('0x36')],{'$or':_['map'](_0x58800f,function(_0x5b6436){if(_0x5b6436[_0xe7b9('0x2a')]!==_0xe7b9('0x3a')){var _0x277d30={};_0x277d30[_0x5b6436[_0xe7b9('0x25')]]={'$like':'%'+_0x3567c4[_0xe7b9('0x2c')][_0xe7b9('0x38')]+'%'};return _0x277d30;}})});}_0xb68544=_[_0xe7b9('0x39')]({},_0xb68544,_0x3567c4[_0xe7b9('0x3b')]);var _0x5192cf={'where':_0xb68544[_0xe7b9('0x36')]};return db[_0xe7b9('0x3c')][_0xe7b9('0x1c')](_0x5192cf)['then'](function(_0x449551){_0x54a832[_0xe7b9('0x1c')]=_0x449551;if(_0x3567c4['query'][_0xe7b9('0x3d')]){_0xb68544['include']=[{'all':!![]}];}return db[_0xe7b9('0x3c')]['findAll'](_0xb68544);})[_0xe7b9('0x22')](function(_0x17fd50){_0x54a832[_0xe7b9('0x3e')]=_0x17fd50;return _0x54a832;})['then'](respondWithFilteredResult(_0x278331,_0xb68544))[_0xe7b9('0x3f')](handleError(_0x278331,null));};exports[_0xe7b9('0x40')]=function(_0x38b7e9,_0x5b5889){var _0x140d78={'raw':!![],'where':{'id':_0x38b7e9['params']['id']}},_0x49eb52={};_0x49eb52[_0xe7b9('0x2b')]=_[_0xe7b9('0x41')](db[_0xe7b9('0x3c')]['rawAttributes']);_0x49eb52[_0xe7b9('0x2c')]=_[_0xe7b9('0x41')](_0x38b7e9[_0xe7b9('0x2c')]);_0x49eb52['filters']=_[_0xe7b9('0x2e')](_0x49eb52['model'],_0x49eb52['query']);_0x140d78[_0xe7b9('0x2f')]=_[_0xe7b9('0x2e')](_0x49eb52[_0xe7b9('0x2b')],qs['fields'](_0x38b7e9['query'][_0xe7b9('0x30')]));_0x140d78['attributes']=_0x140d78[_0xe7b9('0x2f')]['length']?_0x140d78[_0xe7b9('0x2f')]:_0x49eb52['model'];if(_0x38b7e9['query'][_0xe7b9('0x3d')]){_0x140d78[_0xe7b9('0x42')]=[{'all':!![]}];}_0x140d78=_[_0xe7b9('0x39')]({},_0x140d78,_0x38b7e9[_0xe7b9('0x3b')]);return db[_0xe7b9('0x3c')][_0xe7b9('0x43')](_0x140d78)[_0xe7b9('0x22')](handleEntityNotFound(_0x5b5889,null))[_0xe7b9('0x22')](respondWithResult(_0x5b5889,null))[_0xe7b9('0x3f')](handleError(_0x5b5889,null));};exports[_0xe7b9('0x20')]=function(_0x142cc6,_0x447151){if(_0x142cc6[_0xe7b9('0x44')]['id']){delete _0x142cc6['body']['id'];}return db[_0xe7b9('0x3c')][_0xe7b9('0x43')]({'where':{'id':_0x142cc6['params']['id']}})['then'](handleEntityNotFound(_0x447151,null))['then'](saveUpdates(_0x142cc6[_0xe7b9('0x44')],null))[_0xe7b9('0x22')](respondWithResult(_0x447151,null))['catch'](handleError(_0x447151,null));};exports[_0xe7b9('0x21')]=function(_0x15e624,_0x4a107f){return db[_0xe7b9('0x3c')][_0xe7b9('0x43')]({'where':{'id':_0x15e624[_0xe7b9('0x45')]['id']}})[_0xe7b9('0x22')](handleEntityNotFound(_0x4a107f,null))[_0xe7b9('0x22')](removeEntity(_0x4a107f,null))[_0xe7b9('0x3f')](handleError(_0x4a107f,null));};exports[_0xe7b9('0x46')]=function(_0x5746f3,_0x632812){return db[_0xe7b9('0x3c')][_0xe7b9('0x46')]()[_0xe7b9('0x22')](respondWithResult(_0x632812,null))[_0xe7b9('0x3f')](handleError(_0x632812,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index e69c9be..0a5fa35 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 _0xc074=['exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes'];(function(_0x4d4f61,_0x2492bb){var _0x5e688e=function(_0x2f92bb){while(--_0x2f92bb){_0x4d4f61['push'](_0x4d4f61['shift']());}};_0x5e688e(++_0x2492bb);}(_0xc074,0x146));var _0x4c07=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xc074[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x4c07('0x0'));var util=require(_0x4c07('0x1'));var logger=require(_0x4c07('0x2'))(_0x4c07('0x3'));var moment=require(_0x4c07('0x4'));var BPromise=require('bluebird');var rp=require(_0x4c07('0x5'));var fs=require('fs');var path=require(_0x4c07('0x6'));var rimraf=require(_0x4c07('0x7'));var config=require(_0x4c07('0x8'));var attributes=require(_0x4c07('0x9'));module[_0x4c07('0xa')]=function(_0x54db6e,_0x3575d2){return _0x54db6e[_0x4c07('0xb')](_0x4c07('0xc'),attributes,{'tableName':_0x4c07('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8658=['request-promise','path','../../config/environment','exports','define','CmHopperBlack','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4745a2,_0x196d86){var _0x4fa375=function(_0x121ae7){while(--_0x121ae7){_0x4745a2['push'](_0x4745a2['shift']());}};_0x4fa375(++_0x196d86);}(_0x8658,0x1be));var _0x8865=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x8658[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x8865('0x0'));var util=require(_0x8865('0x1'));var logger=require(_0x8865('0x2'))('api');var moment=require(_0x8865('0x3'));var BPromise=require(_0x8865('0x4'));var rp=require(_0x8865('0x5'));var fs=require('fs');var path=require(_0x8865('0x6'));var rimraf=require('rimraf');var config=require(_0x8865('0x7'));var attributes=require('./cmHopperBlack.attributes');module[_0x8865('0x8')]=function(_0x459f87,_0x5bb21d){return _0x459f87[_0x8865('0x9')](_0x8865('0xa'),attributes,{'tableName':'cm_hopper_black','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 d4038d6..70eb87c 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 _0x6099=['DestroyCmHopperBlack','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','raw','options','where','attributes','limit','include','model','map','debug','UpdateCmHopperBlack','update','body','stringify'];(function(_0x569257,_0x1da54f){var _0xb56f90=function(_0x7475ac){while(--_0x7475ac){_0x569257['push'](_0x569257['shift']());}};_0xb56f90(++_0x1da54f);}(_0x6099,0x17d));var _0x9609=function(_0xe8f070,_0xfddc1d){_0xe8f070=_0xe8f070-0x0;var _0x143e3c=_0x6099[_0xe8f070];return _0x143e3c;};'use strict';var _=require(_0x9609('0x0'));var util=require(_0x9609('0x1'));var moment=require('moment');var BPromise=require(_0x9609('0x2'));var rs=require(_0x9609('0x3'));var fs=require('fs');var Redis=require(_0x9609('0x4'));var db=require(_0x9609('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9609('0x6'))(_0x9609('0x7'));var config=require(_0x9609('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9609('0x9')][_0x9609('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13c221,_0x215e71,_0xdd9187){return new BPromise(function(_0x55c957,_0x8d18d6){return client[_0x9609('0xb')](_0x13c221,_0xdd9187)[_0x9609('0xc')](function(_0x1c9ec2){logger[_0x9609('0xd')](_0x9609('0xe'),_0x215e71,'request\x20sent');logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x215e71,_0x9609('0xf'),JSON['stringify'](_0x1c9ec2));if(_0x1c9ec2[_0x9609('0x10')]){if(_0x1c9ec2[_0x9609('0x10')][_0x9609('0x11')]===0x1f4){logger[_0x9609('0x10')](_0x9609('0xe'),_0x215e71,_0x1c9ec2[_0x9609('0x10')][_0x9609('0x12')]);return _0x8d18d6(_0x1c9ec2['error']['message']);}logger[_0x9609('0x10')](_0x9609('0xe'),_0x215e71,_0x1c9ec2[_0x9609('0x10')]['message']);return _0x55c957(_0x1c9ec2[_0x9609('0x10')][_0x9609('0x12')]);}else{logger['info'](_0x9609('0xe'),_0x215e71,'request\x20sent');_0x55c957(_0x1c9ec2[_0x9609('0x13')]['message']);}})[_0x9609('0x14')](function(_0x227681){logger[_0x9609('0x10')](_0x9609('0xe'),_0x215e71,_0x227681);_0x8d18d6(_0x227681);});});}exports[_0x9609('0x15')]=function(_0x56e046){var _0x1bb327=this;return new Promise(function(_0x53fd11,_0x40825a){return db[_0x9609('0x16')][_0x9609('0x17')]({'raw':_0x56e046['options']?_0x56e046['options'][_0x9609('0x18')]===undefined?!![]:![]:!![],'where':_0x56e046[_0x9609('0x19')]?_0x56e046[_0x9609('0x19')][_0x9609('0x1a')]||null:null,'attributes':_0x56e046['options']?_0x56e046[_0x9609('0x19')][_0x9609('0x1b')]||null:null,'limit':_0x56e046['options']?_0x56e046[_0x9609('0x19')][_0x9609('0x1c')]||null:null,'include':_0x56e046[_0x9609('0x19')]?_0x56e046[_0x9609('0x19')]['include']?_['map'](_0x56e046[_0x9609('0x19')][_0x9609('0x1d')],function(_0x2f315d){return{'model':db[_0x2f315d[_0x9609('0x1e')]],'as':_0x2f315d['as'],'attributes':_0x2f315d[_0x9609('0x1b')],'include':_0x2f315d['include']?_['map'](_0x2f315d[_0x9609('0x1d')],function(_0x5ec130){return{'model':db[_0x5ec130[_0x9609('0x1e')]],'as':_0x5ec130['as'],'attributes':_0x5ec130[_0x9609('0x1b')],'include':_0x5ec130[_0x9609('0x1d')]?_[_0x9609('0x1f')](_0x5ec130[_0x9609('0x1d')],function(_0xe4db48){return{'model':db[_0xe4db48[_0x9609('0x1e')]],'as':_0xe4db48['as'],'attributes':_0xe4db48[_0x9609('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20916f){logger['info'](_0x9609('0x15'),_0x56e046);logger[_0x9609('0x20')]('GetCmHopperBlack',_0x56e046,JSON['stringify'](_0x20916f));_0x53fd11(_0x20916f);})[_0x9609('0x14')](function(_0x5e4407){logger[_0x9609('0x10')]('GetCmHopperBlack',_0x5e4407[_0x9609('0x12')],_0x56e046);_0x40825a(_0x1bb327[_0x9609('0x10')](0x1f4,_0x5e4407['message']));});});};exports[_0x9609('0x21')]=function(_0x55e7b8){var _0x560f0b=this;return new Promise(function(_0x450217,_0x29b10d){return db[_0x9609('0x16')][_0x9609('0x22')](_0x55e7b8[_0x9609('0x23')],{'raw':_0x55e7b8[_0x9609('0x19')]?_0x55e7b8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55e7b8[_0x9609('0x19')]?_0x55e7b8[_0x9609('0x19')][_0x9609('0x1a')]||null:null,'attributes':_0x55e7b8['options']?_0x55e7b8[_0x9609('0x19')][_0x9609('0x1b')]||null:null,'limit':_0x55e7b8[_0x9609('0x19')]?_0x55e7b8[_0x9609('0x19')][_0x9609('0x1c')]||null:null})[_0x9609('0xc')](function(_0x34c9f6){logger[_0x9609('0xd')](_0x9609('0x21'),_0x55e7b8);logger['debug'](_0x9609('0x21'),_0x55e7b8,JSON[_0x9609('0x24')](_0x34c9f6));_0x450217(_0x34c9f6);})[_0x9609('0x14')](function(_0x1c24e5){logger[_0x9609('0x10')]('UpdateCmHopperBlack',_0x1c24e5['message'],_0x55e7b8);_0x29b10d(_0x560f0b[_0x9609('0x10')](0x1f4,_0x1c24e5[_0x9609('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x430dc7){var _0x400a28=this;return new Promise(function(_0x5ba268,_0x519e12){return db[_0x9609('0x16')]['destroy']({'where':_0x430dc7['options']?_0x430dc7['options'][_0x9609('0x1a')]||null:null})[_0x9609('0xc')](function(_0x476ea0){logger[_0x9609('0xd')](_0x9609('0x25'),_0x430dc7);logger[_0x9609('0x20')](_0x9609('0x25'),_0x430dc7,JSON[_0x9609('0x24')](_0x476ea0));_0x5ba268(_0x476ea0);})[_0x9609('0x14')](function(_0x6aef7e){logger[_0x9609('0x10')](_0x9609('0x25'),_0x6aef7e['message'],_0x430dc7);_0x519e12(_0x400a28[_0x9609('0x10')](0x1f4,_0x6aef7e[_0x9609('0x12')]));});});}; \ No newline at end of file +var _0x8385=['result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','limit','map','include','model','attributes','info','UpdateCmHopperBlack','body','DestroyCmHopperBlack','destroy','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0x8385,0x1ed));var _0x5838=function(_0x275ddf,_0x145108){_0x275ddf=_0x275ddf-0x0;var _0x5d00bf=_0x8385[_0x275ddf];return _0x5d00bf;};'use strict';var _=require('lodash');var util=require(_0x5838('0x0'));var moment=require('moment');var BPromise=require(_0x5838('0x1'));var rs=require(_0x5838('0x2'));var fs=require('fs');var Redis=require(_0x5838('0x3'));var db=require(_0x5838('0x4'))['db'];var utils=require(_0x5838('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5838('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5838('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e0ead,_0x2ed38e,_0x61e219){return new BPromise(function(_0x4c5ded,_0x4761c8){return client['request'](_0x2e0ead,_0x61e219)[_0x5838('0x8')](function(_0x23fe0b){logger['info'](_0x5838('0x9'),_0x2ed38e,_0x5838('0xa'));logger[_0x5838('0xb')](_0x5838('0xc'),_0x2ed38e,_0x5838('0xa'),JSON[_0x5838('0xd')](_0x23fe0b));if(_0x23fe0b[_0x5838('0xe')]){if(_0x23fe0b['error'][_0x5838('0xf')]===0x1f4){logger[_0x5838('0xe')](_0x5838('0x9'),_0x2ed38e,_0x23fe0b[_0x5838('0xe')][_0x5838('0x10')]);return _0x4761c8(_0x23fe0b['error'][_0x5838('0x10')]);}logger[_0x5838('0xe')](_0x5838('0x9'),_0x2ed38e,_0x23fe0b[_0x5838('0xe')]['message']);return _0x4c5ded(_0x23fe0b['error']['message']);}else{logger['info'](_0x5838('0x9'),_0x2ed38e,_0x5838('0xa'));_0x4c5ded(_0x23fe0b[_0x5838('0x11')][_0x5838('0x10')]);}})[_0x5838('0x12')](function(_0x2f6601){logger[_0x5838('0xe')](_0x5838('0x9'),_0x2ed38e,_0x2f6601);_0x4761c8(_0x2f6601);});});}exports[_0x5838('0x13')]=function(_0x2b9941){var _0x546246=this;return new Promise(function(_0x54cd8f,_0x3f2218){return db[_0x5838('0x14')]['findAll']({'raw':_0x2b9941[_0x5838('0x15')]?_0x2b9941[_0x5838('0x15')][_0x5838('0x16')]===undefined?!![]:![]:!![],'where':_0x2b9941['options']?_0x2b9941[_0x5838('0x15')]['where']||null:null,'attributes':_0x2b9941[_0x5838('0x15')]?_0x2b9941['options']['attributes']||null:null,'limit':_0x2b9941['options']?_0x2b9941[_0x5838('0x15')][_0x5838('0x17')]||null:null,'include':_0x2b9941[_0x5838('0x15')]?_0x2b9941[_0x5838('0x15')]['include']?_[_0x5838('0x18')](_0x2b9941[_0x5838('0x15')][_0x5838('0x19')],function(_0x1118c9){return{'model':db[_0x1118c9[_0x5838('0x1a')]],'as':_0x1118c9['as'],'attributes':_0x1118c9['attributes'],'include':_0x1118c9[_0x5838('0x19')]?_['map'](_0x1118c9[_0x5838('0x19')],function(_0x5f45ee){return{'model':db[_0x5f45ee[_0x5838('0x1a')]],'as':_0x5f45ee['as'],'attributes':_0x5f45ee[_0x5838('0x1b')],'include':_0x5f45ee[_0x5838('0x19')]?_[_0x5838('0x18')](_0x5f45ee[_0x5838('0x19')],function(_0x240b6e){return{'model':db[_0x240b6e['model']],'as':_0x240b6e['as'],'attributes':_0x240b6e[_0x5838('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5838('0x8')](function(_0x4f6c15){logger[_0x5838('0x1c')](_0x5838('0x13'),_0x2b9941);logger['debug'](_0x5838('0x13'),_0x2b9941,JSON[_0x5838('0xd')](_0x4f6c15));_0x54cd8f(_0x4f6c15);})[_0x5838('0x12')](function(_0x176c8b){logger[_0x5838('0xe')](_0x5838('0x13'),_0x176c8b['message'],_0x2b9941);_0x3f2218(_0x546246[_0x5838('0xe')](0x1f4,_0x176c8b[_0x5838('0x10')]));});});};exports[_0x5838('0x1d')]=function(_0x2b610a){var _0x4ebac2=this;return new Promise(function(_0x46e059,_0x2a8196){return db[_0x5838('0x14')]['update'](_0x2b610a[_0x5838('0x1e')],{'raw':_0x2b610a[_0x5838('0x15')]?_0x2b610a[_0x5838('0x15')][_0x5838('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b610a['options']?_0x2b610a['options']['where']||null:null,'attributes':_0x2b610a[_0x5838('0x15')]?_0x2b610a[_0x5838('0x15')][_0x5838('0x1b')]||null:null,'limit':_0x2b610a[_0x5838('0x15')]?_0x2b610a[_0x5838('0x15')][_0x5838('0x17')]||null:null})[_0x5838('0x8')](function(_0x37a73c){logger[_0x5838('0x1c')]('UpdateCmHopperBlack',_0x2b610a);logger[_0x5838('0xb')](_0x5838('0x1d'),_0x2b610a,JSON[_0x5838('0xd')](_0x37a73c));_0x46e059(_0x37a73c);})[_0x5838('0x12')](function(_0x3cdcb9){logger[_0x5838('0xe')](_0x5838('0x1d'),_0x3cdcb9[_0x5838('0x10')],_0x2b610a);_0x2a8196(_0x4ebac2[_0x5838('0xe')](0x1f4,_0x3cdcb9[_0x5838('0x10')]));});});};exports[_0x5838('0x1f')]=function(_0x4a0e27){var _0x4423ba=this;return new Promise(function(_0x4b0685,_0x3b2ff6){return db[_0x5838('0x14')][_0x5838('0x20')]({'where':_0x4a0e27[_0x5838('0x15')]?_0x4a0e27[_0x5838('0x15')][_0x5838('0x21')]||null:null})[_0x5838('0x8')](function(_0x25f7d7){logger[_0x5838('0x1c')](_0x5838('0x1f'),_0x4a0e27);logger['debug']('DestroyCmHopperBlack',_0x4a0e27,JSON[_0x5838('0xd')](_0x25f7d7));_0x4b0685(_0x25f7d7);})['catch'](function(_0x31f19a){logger[_0x5838('0xe')]('DestroyCmHopperBlack',_0x31f19a[_0x5838('0x10')],_0x4a0e27);_0x3b2ff6(_0x4423ba[_0x5838('0xe')](0x1f4,_0x31f19a[_0x5838('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 25b7022..97a5382 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 _0xafc4=['multer','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','/:id','show','put','delete','destroy'];(function(_0x4f8cbe,_0x59fd54){var _0x51c7b3=function(_0x401fd8){while(--_0x401fd8){_0x4f8cbe['push'](_0x4f8cbe['shift']());}};_0x51c7b3(++_0x59fd54);}(_0xafc4,0x69));var _0x4afc=function(_0x2ef089,_0x56343d){_0x2ef089=_0x2ef089-0x0;var _0x54e778=_0xafc4[_0x2ef089];return _0x54e778;};'use strict';var multer=require(_0x4afc('0x0'));var util=require('util');var path=require(_0x4afc('0x1'));var timeout=require('connect-timeout');var express=require(_0x4afc('0x2'));var router=express[_0x4afc('0x3')]();var fs_extra=require(_0x4afc('0x4'));var auth=require(_0x4afc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x4afc('0x6')]('/',auth[_0x4afc('0x7')](),controller[_0x4afc('0x8')]);router[_0x4afc('0x6')](_0x4afc('0x9'),auth[_0x4afc('0x7')](),controller['describe']);router[_0x4afc('0x6')](_0x4afc('0xa'),auth[_0x4afc('0x7')](),controller[_0x4afc('0xb')]);router[_0x4afc('0xc')](_0x4afc('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x4afc('0xd')]('/:id',auth[_0x4afc('0x7')](),controller[_0x4afc('0xe')]);module['exports']=router; \ No newline at end of file +var _0x5496=['../../config/environment','./cmHopperBlack.controller','index','get','isAuthenticated','describe','show','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x27e290,_0xf80487){var _0x18fdcb=function(_0x80cb42){while(--_0x80cb42){_0x27e290['push'](_0x27e290['shift']());}};_0x18fdcb(++_0xf80487);}(_0x5496,0x175));var _0x6549=function(_0xb587c6,_0x26cde2){_0xb587c6=_0xb587c6-0x0;var _0x2ea14a=_0x5496[_0xb587c6];return _0x2ea14a;};'use strict';var multer=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var path=require(_0x6549('0x2'));var timeout=require(_0x6549('0x3'));var express=require(_0x6549('0x4'));var router=express['Router']();var fs_extra=require(_0x6549('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var controller=require(_0x6549('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6549('0x9')]);router[_0x6549('0xa')]('/describe',auth[_0x6549('0xb')](),controller[_0x6549('0xc')]);router[_0x6549('0xa')]('/:id',auth[_0x6549('0xb')](),controller[_0x6549('0xd')]);router[_0x6549('0xe')](_0x6549('0xf'),auth[_0x6549('0xb')](),controller[_0x6549('0x10')]);router['delete']('/:id',auth[_0x6549('0xb')](),controller[_0x6549('0x11')]);module[_0x6549('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index d81fac0..556bd28 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 _0x79c1=['moment','exports','STRING','DATE','INTEGER','getDataValue','endtime','setDataValue','diff','seconds','dispositionat','BOOLEAN','sequelize'];(function(_0x4cee4b,_0x1dfff3){var _0x4d891d=function(_0x3722ba){while(--_0x3722ba){_0x4cee4b['push'](_0x4cee4b['shift']());}};_0x4d891d(++_0x1dfff3);}(_0x79c1,0x103));var _0x179c=function(_0x22d2ff,_0x56a793){_0x22d2ff=_0x22d2ff-0x0;var _0x4a50b6=_0x79c1[_0x22d2ff];return _0x4a50b6;};'use strict';var Sequelize=require(_0x179c('0x0'));var moment=require(_0x179c('0x1'));module[_0x179c('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x179c('0x3')]},'scheduledat':{'type':Sequelize[_0x179c('0x4')]},'countbusyretry':{'type':Sequelize[_0x179c('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x179c('0x3')]},'originatecalleridname':{'type':Sequelize[_0x179c('0x3')]},'calleridnum':{'type':Sequelize[_0x179c('0x3')]},'calleridname':{'type':Sequelize[_0x179c('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x179c('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x179c('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x179c('0x5')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x179c('0x5')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x179c('0x5')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x179c('0x3')]},'campaign':{'type':Sequelize[_0x179c('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x179c('0x3')]},'reason':{'type':Sequelize[_0x179c('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x179c('0x3')]},'dispositionat':{'type':Sequelize[_0x179c('0x4')],'set':function(_0x26e138){var _0x5a94a7=this[_0x179c('0x6')](_0x179c('0x7'));if(_0x5a94a7&&_0x26e138){this[_0x179c('0x8')]('followuptime',moment(_0x26e138)[_0x179c('0x9')](moment(_0x5a94a7),_0x179c('0xa')));}return this[_0x179c('0x8')](_0x179c('0xb'),_0x26e138);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x179c('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x179c('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x179c('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x179c('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x179c('0x4')]},'deleted':{'type':Sequelize[_0x179c('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x179c('0x4')]},'recallme':{'type':Sequelize[_0x179c('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x179c('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x179c('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x179c('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x60f4=['INTEGER','DATE','STRING','getDataValue','setDataValue','followuptime','seconds','BOOLEAN','sequelize','exports'];(function(_0x37bd46,_0x2cd9de){var _0x560101=function(_0x447878){while(--_0x447878){_0x37bd46['push'](_0x37bd46['shift']());}};_0x560101(++_0x2cd9de);}(_0x60f4,0xbc));var _0x460f=function(_0x4ec747,_0x1c13a9){_0x4ec747=_0x4ec747-0x0;var _0x39db90=_0x60f4[_0x4ec747];return _0x39db90;};'use strict';var Sequelize=require(_0x460f('0x0'));var moment=require('moment');module[_0x460f('0x1')]={'state':{'type':Sequelize[_0x460f('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x460f('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x460f('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x460f('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x460f('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x460f('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x460f('0x4')]},'originatecalleridname':{'type':Sequelize[_0x460f('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x460f('0x4')]},'starttime':{'type':Sequelize[_0x460f('0x3')]},'responsetime':{'type':Sequelize[_0x460f('0x3')]},'answertime':{'type':Sequelize[_0x460f('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x460f('0x3')]},'ringtime':{'type':Sequelize[_0x460f('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x460f('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x460f('0x4')]},'membername':{'type':Sequelize[_0x460f('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x460f('0x4')]},'thirdDisposition':{'type':Sequelize[_0x460f('0x4')]},'dispositionat':{'type':Sequelize[_0x460f('0x3')],'set':function(_0x15262d){var _0x6935f=this[_0x460f('0x5')]('endtime');if(_0x6935f&&_0x15262d){this[_0x460f('0x6')](_0x460f('0x7'),moment(_0x15262d)['diff'](moment(_0x6935f),_0x460f('0x8')));}return this[_0x460f('0x6')]('dispositionat',_0x15262d);}},'amd':{'type':Sequelize[_0x460f('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x460f('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x460f('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x460f('0x3')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x460f('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x460f('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x460f('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x460f('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x460f('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x460f('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 43205bd..0b7ad76 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 _0x5d58=['calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','ANY_VALUE(CampaignId)','cm_hopper_final','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','then','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','CmHopperFinal','include','findAll','rows','show','params','rawAttributes','keys','length','includeAll','merge','describe','catch','body','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)'];(function(_0x430e15,_0x4ae0f2){var _0x16c170=function(_0x4b4927){while(--_0x4b4927){_0x430e15['push'](_0x430e15['shift']());}};_0x16c170(++_0x4ae0f2);}(_0x5d58,0x187));var _0x85d5=function(_0x1bce4b,_0x35bf80){_0x1bce4b=_0x1bce4b-0x0;var _0x26b4eb=_0x5d58[_0x1bce4b];return _0x26b4eb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x85d5('0x0'));var BPromise=require(_0x85d5('0x1'));var Mustache=require('mustache');var util=require(_0x85d5('0x2'));var path=require(_0x85d5('0x3'));var sox=require('sox');var csv=require(_0x85d5('0x4'));var ejs=require(_0x85d5('0x5'));var fs=require('fs');var fs_extra=require(_0x85d5('0x6'));var _=require(_0x85d5('0x7'));var squel=require('squel');var crypto=require(_0x85d5('0x8'));var jsforce=require(_0x85d5('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x85d5('0x4'));var querystring=require('querystring');var Papa=require(_0x85d5('0xa'));var Redis=require(_0x85d5('0xb'));var authService=require(_0x85d5('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85d5('0xd'))(_0x85d5('0xe'));var utils=require(_0x85d5('0xf'));var config=require(_0x85d5('0x10'));var licenseUtil=require(_0x85d5('0x11'));var db=require(_0x85d5('0x12'))['db'];function respondWithStatusCode(_0x31409d,_0x5897af){_0x5897af=_0x5897af||0xcc;return function(_0x4bbf2a){if(_0x4bbf2a){return _0x31409d['sendStatus'](_0x5897af);}return _0x31409d[_0x85d5('0x13')](_0x5897af)[_0x85d5('0x14')]();};}function respondWithResult(_0x339d4f,_0x1704f0){_0x1704f0=_0x1704f0||0xc8;return function(_0x18a20c){if(_0x18a20c){return _0x339d4f[_0x85d5('0x13')](_0x1704f0)[_0x85d5('0x15')](_0x18a20c);}};}function respondWithFilteredResult(_0x586382,_0x18e977){return function(_0x2d7c95){if(_0x2d7c95){var _0x1621ed=typeof _0x18e977[_0x85d5('0x16')]===_0x85d5('0x17')&&typeof _0x18e977[_0x85d5('0x18')]===_0x85d5('0x17');var _0x12bef9=_0x2d7c95[_0x85d5('0x19')];var _0x17acb0=_0x1621ed?0x0:_0x18e977[_0x85d5('0x16')];var _0x432bd6=_0x1621ed?_0x2d7c95[_0x85d5('0x19')]:_0x18e977[_0x85d5('0x16')]+_0x18e977[_0x85d5('0x18')];var _0x26981b;if(_0x432bd6>=_0x12bef9){_0x432bd6=_0x12bef9;_0x26981b=0xc8;}else{_0x26981b=0xce;}_0x586382[_0x85d5('0x13')](_0x26981b);return _0x586382[_0x85d5('0x1a')]('Content-Range',_0x17acb0+'-'+_0x432bd6+'/'+_0x12bef9)[_0x85d5('0x15')](_0x2d7c95);}return null;};}function patchUpdates(_0x133fa9){return function(_0x5f5755){try{jsonpatch[_0x85d5('0x1b')](_0x5f5755,_0x133fa9,!![]);}catch(_0x1264ca){return BPromise['reject'](_0x1264ca);}return _0x5f5755['save']();};}function saveUpdates(_0x347337,_0x5a1b9a){return function(_0x2f2bae){if(_0x2f2bae){return _0x2f2bae['update'](_0x347337)[_0x85d5('0x1c')](function(_0x1f8d27){return _0x1f8d27;});}return null;};}function removeEntity(_0x560b3a,_0x4e11c4){return function(_0x4da71b){if(_0x4da71b){return _0x4da71b['destroy']()[_0x85d5('0x1c')](function(){_0x560b3a[_0x85d5('0x13')](0xcc)[_0x85d5('0x14')]();});}};}function handleEntityNotFound(_0x466bbd,_0x12fea3){return function(_0xef2405){if(!_0xef2405){_0x466bbd['sendStatus'](0x194);}return _0xef2405;};}function handleError(_0x7e9a11,_0x4f8c66){_0x4f8c66=_0x4f8c66||0x1f4;return function(_0x1b3fae){logger[_0x85d5('0x1d')](_0x1b3fae[_0x85d5('0x1e')]);if(_0x1b3fae['name']){delete _0x1b3fae[_0x85d5('0x1f')];}_0x7e9a11[_0x85d5('0x13')](_0x4f8c66)[_0x85d5('0x20')](_0x1b3fae);};}exports[_0x85d5('0x21')]=function(_0x4605c5,_0x56031f){var _0x1cbef1={},_0x476c8b={},_0x330f8a={'count':0x0,'rows':[]};var _0x22a961=_[_0x85d5('0x22')](db['CmHopperFinal']['rawAttributes'],function(_0x2ce7a9){return{'name':_0x2ce7a9[_0x85d5('0x23')],'type':_0x2ce7a9[_0x85d5('0x24')][_0x85d5('0x25')]};});_0x476c8b[_0x85d5('0x26')]=_['map'](_0x22a961,_0x85d5('0x1f'));_0x476c8b[_0x85d5('0x27')]=_['keys'](_0x4605c5['query']);_0x476c8b[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x476c8b['model'],_0x476c8b[_0x85d5('0x27')]);_0x1cbef1['attributes']=_[_0x85d5('0x29')](_0x476c8b[_0x85d5('0x26')],qs['fields'](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x1cbef1[_0x85d5('0x2b')]=_0x1cbef1[_0x85d5('0x2b')]['length']?_0x1cbef1['attributes']:_0x476c8b[_0x85d5('0x26')];if(!_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2c')](_0x85d5('0x2d'))){_0x1cbef1[_0x85d5('0x18')]=qs[_0x85d5('0x18')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x18')]);_0x1cbef1[_0x85d5('0x16')]=qs['offset'](_0x4605c5['query'][_0x85d5('0x16')]);}_0x1cbef1[_0x85d5('0x2e')]=qs[_0x85d5('0x2f')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2f')]);_0x1cbef1[_0x85d5('0x30')]=qs[_0x85d5('0x28')](_[_0x85d5('0x31')](_0x4605c5['query'],_0x476c8b[_0x85d5('0x28')]),_0x22a961);if(_0x4605c5[_0x85d5('0x27')][_0x85d5('0x32')]){_0x1cbef1[_0x85d5('0x30')]=_['merge'](_0x1cbef1[_0x85d5('0x30')],{'$or':_[_0x85d5('0x22')](_0x22a961,function(_0x3282d3){if(_0x3282d3[_0x85d5('0x24')]!=='VIRTUAL'){var _0x34caed={};_0x34caed[_0x3282d3['name']]={'$like':'%'+_0x4605c5['query'][_0x85d5('0x32')]+'%'};return _0x34caed;}})});}_0x1cbef1=_['merge']({},_0x1cbef1,_0x4605c5[_0x85d5('0x33')]);var _0x5ddba7={'where':_0x1cbef1['where']};return db[_0x85d5('0x34')][_0x85d5('0x19')](_0x5ddba7)[_0x85d5('0x1c')](function(_0x1beffc){_0x330f8a[_0x85d5('0x19')]=_0x1beffc;if(_0x4605c5['query']['includeAll']){_0x1cbef1[_0x85d5('0x35')]=[{'all':!![]}];}return db[_0x85d5('0x34')][_0x85d5('0x36')](_0x1cbef1);})[_0x85d5('0x1c')](function(_0xdd8b3e){_0x330f8a[_0x85d5('0x37')]=_0xdd8b3e;return _0x330f8a;})['then'](respondWithFilteredResult(_0x56031f,_0x1cbef1))['catch'](handleError(_0x56031f,null));};exports[_0x85d5('0x38')]=function(_0x52c99b,_0xfbf466){var _0x18e94d={'raw':!![],'where':{'id':_0x52c99b[_0x85d5('0x39')]['id']}},_0x7dd430={};_0x7dd430[_0x85d5('0x26')]=_['keys'](db['CmHopperFinal'][_0x85d5('0x3a')]);_0x7dd430[_0x85d5('0x27')]=_[_0x85d5('0x3b')](_0x52c99b[_0x85d5('0x27')]);_0x7dd430[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],_0x7dd430[_0x85d5('0x27')]);_0x18e94d[_0x85d5('0x2b')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],qs[_0x85d5('0x2a')](_0x52c99b[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x18e94d[_0x85d5('0x2b')]=_0x18e94d[_0x85d5('0x2b')][_0x85d5('0x3c')]?_0x18e94d['attributes']:_0x7dd430['model'];if(_0x52c99b[_0x85d5('0x27')][_0x85d5('0x3d')]){_0x18e94d[_0x85d5('0x35')]=[{'all':!![]}];}_0x18e94d=_[_0x85d5('0x3e')]({},_0x18e94d,_0x52c99b[_0x85d5('0x33')]);return db[_0x85d5('0x34')]['find'](_0x18e94d)[_0x85d5('0x1c')](handleEntityNotFound(_0xfbf466,null))['then'](respondWithResult(_0xfbf466,null))['catch'](handleError(_0xfbf466,null));};exports[_0x85d5('0x3f')]=function(_0x13ab32,_0x12a03){return db[_0x85d5('0x34')][_0x85d5('0x3f')]()['then'](respondWithResult(_0x12a03,null))[_0x85d5('0x40')](handleError(_0x12a03,null));};exports['update']=function(_0x1f2ef9,_0xd8db57){if(_0x1f2ef9[_0x85d5('0x41')]['uniqueid']){delete _0x1f2ef9['body']['uniqueid'];}return db[_0x85d5('0x34')][_0x85d5('0x42')]({'where':{'uniqueid':_0x1f2ef9[_0x85d5('0x39')]['id']}})['then'](handleEntityNotFound(_0xd8db57,null))['then'](saveUpdates(_0x1f2ef9[_0x85d5('0x41')],null))[_0x85d5('0x1c')](respondWithResult(_0xd8db57,null))[_0x85d5('0x40')](handleError(_0xd8db57,null));};exports[_0x85d5('0x43')]=function(_0x4b2dce,_0x3f69ea,_0x29442a){return db[_0x85d5('0x34')][_0x85d5('0x36')]({'raw':![],'where':{'VoiceQueueId':_0x4b2dce[_0x85d5('0x39')]['id']},'attributes':[[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x47')))),_0x85d5('0x48')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x49')))),_0x85d5('0x4a')],[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x4b')))),_0x85d5('0x4c')],[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x85d5('0x4d')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x85d5('0x4e')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x4f')))),_0x85d5('0x50')],[db['sequelize']['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')]('`state`\x20=\x2022,\x201,\x20null'))),_0x85d5('0x51')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x52')))),_0x85d5('0x53')]]})['then'](handleEntityNotFound(_0x3f69ea,null))[_0x85d5('0x1c')](respondWithResult(_0x3f69ea,null))[_0x85d5('0x40')](handleError(_0x3f69ea,null));};exports[_0x85d5('0x54')]=function(_0x561bde,_0x34aa42,_0x1c3e2c){return db['CmHopperFinal'][_0x85d5('0x36')]({'raw':![],'where':{'CampaignId':_0x561bde['params']['id']},'attributes':[[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x47')))),'noSuchContacts'],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x49')))),_0x85d5('0x4a')],[db[_0x85d5('0x44')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x85d5('0x44')]['literal'](_0x85d5('0x4b')))),_0x85d5('0x4c')],[db['sequelize']['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')]('`state`\x20=\x208,\x201,\x20null'))),_0x85d5('0x4d')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize']['literal'](_0x85d5('0x55')))),'dropContacts'],[db['sequelize']['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x85d5('0x50')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db['sequelize']['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x56')))),_0x85d5('0x51')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x85d5('0x53')]]})[_0x85d5('0x1c')](handleEntityNotFound(_0x34aa42,null))[_0x85d5('0x1c')](respondWithResult(_0x34aa42,null))['catch'](handleError(_0x34aa42,null));};exports[_0x85d5('0x57')]=function(_0x1fdefb,_0x496586,_0x2dbd18){return db[_0x85d5('0x58')][_0x85d5('0x42')]({'where':{'id':_0x1fdefb[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x496586,null))['then'](function(_0x35ba15){var _0x1b96eb;if(_0x35ba15){_0x1b96eb=squel[_0x85d5('0x59')]()[_0x85d5('0x5a')](_0x85d5('0x5b'))['fromQuery']([_0x85d5('0x5c'),_0x85d5('0x5d'),_0x85d5('0x5e'),_0x85d5('0x5f'),_0x85d5('0x60'),_0x85d5('0x61'),_0x85d5('0x62')],squel[_0x85d5('0x63')]()[_0x85d5('0x64')](_0x85d5('0x65'),'phone')[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x5d'))[_0x85d5('0x64')](_0x85d5('0x67'),_0x85d5('0x5e'))['field'](_0x85d5('0x68'),'ListId')['field'](_0x85d5('0x69'),_0x85d5('0x60'))[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x61'))[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x62'))[_0x85d5('0x6a')]('cm_hopper_final')[_0x85d5('0x30')](_0x85d5('0x6b'),_0x1fdefb[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6d'),_0x1fdefb[_0x85d5('0x41')][_0x85d5('0x6e')][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6f'))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')]('phone')['from'](_0x85d5('0x5b'))['where'](_0x85d5('0x6b'),_0x1fdefb[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]()))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')](_0x85d5('0x71'))[_0x85d5('0x6a')]('cm_hopper_final')[_0x85d5('0x30')](_0x85d5('0x6b'),_0x1fdefb['params']['id'][_0x85d5('0x6c')]())['where'](_0x85d5('0x72')))[_0x85d5('0x73')](_0x85d5('0x5e')))[_0x85d5('0x6c')]();return db['sequelize'][_0x85d5('0x27')](_0x1b96eb);}return[];})[_0x85d5('0x1c')](respondWithResult(_0x496586,null))['catch'](handleError(_0x496586,null));};exports[_0x85d5('0x74')]=function(_0x14e4e8,_0x57f26b,_0x45b1e2){return db[_0x85d5('0x75')][_0x85d5('0x42')]({'where':{'id':_0x14e4e8['params']['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x57f26b,null))[_0x85d5('0x1c')](function(_0x2dacf7){var _0x387a3b;if(_0x2dacf7){_0x387a3b=squel[_0x85d5('0x59')]()[_0x85d5('0x5a')]('cm_hopper')[_0x85d5('0x76')]([_0x85d5('0x5c'),'scheduledAt',_0x85d5('0x5e'),'ListId',_0x85d5('0x77'),_0x85d5('0x61'),_0x85d5('0x62')],squel['select']()[_0x85d5('0x64')](_0x85d5('0x65'),_0x85d5('0x5c'))[_0x85d5('0x64')](_0x85d5('0x66'),'scheduledAt')[_0x85d5('0x64')](_0x85d5('0x67'),_0x85d5('0x5e'))[_0x85d5('0x64')]('ANY_VALUE(ListId)',_0x85d5('0x5f'))[_0x85d5('0x64')](_0x85d5('0x78'),'CampaignId')[_0x85d5('0x64')]('NOW()',_0x85d5('0x61'))[_0x85d5('0x64')]('NOW()','updatedAt')[_0x85d5('0x6a')](_0x85d5('0x79'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6d'),_0x14e4e8['body'][_0x85d5('0x6e')][_0x85d5('0x6c')]())[_0x85d5('0x30')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x85d5('0x30')](_0x85d5('0x70'),squel['select']()[_0x85d5('0x64')](_0x85d5('0x5c'))[_0x85d5('0x6a')](_0x85d5('0x5b'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id']['toString']()))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')]('calleridnum')[_0x85d5('0x6a')](_0x85d5('0x79'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id']['toString']())['where'](_0x85d5('0x72')))['group'](_0x85d5('0x5e')))[_0x85d5('0x6c')]();return db[_0x85d5('0x44')][_0x85d5('0x27')](_0x387a3b);}return[];})[_0x85d5('0x1c')](respondWithResult(_0x57f26b,null))[_0x85d5('0x40')](handleError(_0x57f26b,null));};exports[_0x85d5('0x7b')]=function(_0x48553d,_0xedb32d,_0x5366bc){return db[_0x85d5('0x7c')][_0x85d5('0x7d')]({'where':{'VoiceQueueId':_0x48553d[_0x85d5('0x41')]['VoiceQueueId'],'CampaignId':_0x48553d[_0x85d5('0x41')][_0x85d5('0x77')],'ContactId':_0x48553d[_0x85d5('0x41')]['ContactId']}})['then'](handleEntityNotFound(_0xedb32d,null))[_0x85d5('0x1c')](function(_0x428fd4){if(_0x428fd4){return _0x428fd4;}return null;})['then'](respondWithResult(_0xedb32d,null))[_0x85d5('0x40')](handleError(_0xedb32d,null));}; \ No newline at end of file +var _0x2675=['lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','destroy','then','error','name','send','index','map','CmHopperFinal','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','rawAttributes','length','options','find','describe','body','uniqueid','params','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','busyContacts','abandonedContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','VoiceQueueId','createdAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','updatedAt','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','select','phone','from','calleridnum','cm_hopper_final','state\x20=\x204','moveContactsIvrCampaignHopperFinal','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','group','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x5e2ca6,_0x1c5629){var _0x4d6663=function(_0x3cd4ba){while(--_0x3cd4ba){_0x5e2ca6['push'](_0x5e2ca6['shift']());}};_0x4d6663(++_0x1c5629);}(_0x2675,0x75));var _0x5267=function(_0xedc923,_0x177129){_0xedc923=_0xedc923-0x0;var _0xc67cd0=_0x2675[_0xedc923];return _0xc67cd0;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];function respondWithStatusCode(_0x1f9be3,_0x1d7090){_0x1d7090=_0x1d7090||0xcc;return function(_0x1171b9){if(_0x1171b9){return _0x1f9be3[_0x5267('0x16')](_0x1d7090);}return _0x1f9be3[_0x5267('0x17')](_0x1d7090)[_0x5267('0x18')]();};}function respondWithResult(_0x1e2d3b,_0x16e5a7){_0x16e5a7=_0x16e5a7||0xc8;return function(_0x29349a){if(_0x29349a){return _0x1e2d3b[_0x5267('0x17')](_0x16e5a7)['json'](_0x29349a);}};}function respondWithFilteredResult(_0x52e24e,_0xa593fb){return function(_0x40d897){if(_0x40d897){var _0x38a147=typeof _0xa593fb[_0x5267('0x19')]===_0x5267('0x1a')&&typeof _0xa593fb[_0x5267('0x1b')]===_0x5267('0x1a');var _0x6831e0=_0x40d897[_0x5267('0x1c')];var _0xb1c97a=_0x38a147?0x0:_0xa593fb[_0x5267('0x19')];var _0x1ab03=_0x38a147?_0x40d897['count']:_0xa593fb[_0x5267('0x19')]+_0xa593fb[_0x5267('0x1b')];var _0x5069e8;if(_0x1ab03>=_0x6831e0){_0x1ab03=_0x6831e0;_0x5069e8=0xc8;}else{_0x5069e8=0xce;}_0x52e24e[_0x5267('0x17')](_0x5069e8);return _0x52e24e['set'](_0x5267('0x1d'),_0xb1c97a+'-'+_0x1ab03+'/'+_0x6831e0)[_0x5267('0x1e')](_0x40d897);}return null;};}function patchUpdates(_0x39c0c3){return function(_0x2a9f99){try{jsonpatch[_0x5267('0x1f')](_0x2a9f99,_0x39c0c3,!![]);}catch(_0x4dd637){return BPromise[_0x5267('0x20')](_0x4dd637);}return _0x2a9f99['save']();};}function saveUpdates(_0xa32663,_0x420fb8){return function(_0x3b53ac){if(_0x3b53ac){return _0x3b53ac['update'](_0xa32663)['then'](function(_0x5546e2){return _0x5546e2;});}return null;};}function removeEntity(_0x4a17c7,_0x5ea6a6){return function(_0x26c7f8){if(_0x26c7f8){return _0x26c7f8[_0x5267('0x21')]()[_0x5267('0x22')](function(){_0x4a17c7[_0x5267('0x17')](0xcc)[_0x5267('0x18')]();});}};}function handleEntityNotFound(_0x40d1be,_0x126a97){return function(_0x220e03){if(!_0x220e03){_0x40d1be[_0x5267('0x16')](0x194);}return _0x220e03;};}function handleError(_0x59f112,_0x5cb64f){_0x5cb64f=_0x5cb64f||0x1f4;return function(_0x354111){logger[_0x5267('0x23')](_0x354111['stack']);if(_0x354111[_0x5267('0x24')]){delete _0x354111['name'];}_0x59f112['status'](_0x5cb64f)[_0x5267('0x25')](_0x354111);};}exports[_0x5267('0x26')]=function(_0x1f33b7,_0x2d2ace){var _0x33c431={},_0x4f3d4d={},_0x5e87eb={'count':0x0,'rows':[]};var _0x18020c=_[_0x5267('0x27')](db[_0x5267('0x28')]['rawAttributes'],function(_0x58d685){return{'name':_0x58d685[_0x5267('0x29')],'type':_0x58d685[_0x5267('0x2a')][_0x5267('0x2b')]};});_0x4f3d4d['model']=_['map'](_0x18020c,_0x5267('0x24'));_0x4f3d4d[_0x5267('0x2c')]=_[_0x5267('0x2d')](_0x1f33b7[_0x5267('0x2c')]);_0x4f3d4d['filters']=_[_0x5267('0x2e')](_0x4f3d4d[_0x5267('0x2f')],_0x4f3d4d[_0x5267('0x2c')]);_0x33c431[_0x5267('0x30')]=_[_0x5267('0x2e')](_0x4f3d4d[_0x5267('0x2f')],qs[_0x5267('0x31')](_0x1f33b7[_0x5267('0x2c')]['fields']));_0x33c431['attributes']=_0x33c431[_0x5267('0x30')]['length']?_0x33c431[_0x5267('0x30')]:_0x4f3d4d[_0x5267('0x2f')];if(!_0x1f33b7[_0x5267('0x2c')][_0x5267('0x32')]('nolimit')){_0x33c431[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0x1f33b7[_0x5267('0x2c')][_0x5267('0x1b')]);_0x33c431[_0x5267('0x19')]=qs[_0x5267('0x19')](_0x1f33b7[_0x5267('0x2c')][_0x5267('0x19')]);}_0x33c431['order']=qs[_0x5267('0x33')](_0x1f33b7['query'][_0x5267('0x33')]);_0x33c431[_0x5267('0x34')]=qs[_0x5267('0x35')](_[_0x5267('0x36')](_0x1f33b7[_0x5267('0x2c')],_0x4f3d4d[_0x5267('0x35')]),_0x18020c);if(_0x1f33b7[_0x5267('0x2c')]['filter']){_0x33c431[_0x5267('0x34')]=_[_0x5267('0x37')](_0x33c431[_0x5267('0x34')],{'$or':_[_0x5267('0x27')](_0x18020c,function(_0x82cea7){if(_0x82cea7[_0x5267('0x2a')]!==_0x5267('0x38')){var _0x487dfc={};_0x487dfc[_0x82cea7[_0x5267('0x24')]]={'$like':'%'+_0x1f33b7['query'][_0x5267('0x39')]+'%'};return _0x487dfc;}})});}_0x33c431=_['merge']({},_0x33c431,_0x1f33b7['options']);var _0x51bddd={'where':_0x33c431[_0x5267('0x34')]};return db['CmHopperFinal'][_0x5267('0x1c')](_0x51bddd)[_0x5267('0x22')](function(_0x3d4b19){_0x5e87eb[_0x5267('0x1c')]=_0x3d4b19;if(_0x1f33b7['query'][_0x5267('0x3a')]){_0x33c431[_0x5267('0x3b')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x33c431);})[_0x5267('0x22')](function(_0x560cdf){_0x5e87eb[_0x5267('0x3c')]=_0x560cdf;return _0x5e87eb;})[_0x5267('0x22')](respondWithFilteredResult(_0x2d2ace,_0x33c431))[_0x5267('0x3d')](handleError(_0x2d2ace,null));};exports[_0x5267('0x3e')]=function(_0x36d0f1,_0x3012cb){var _0x27add5={'raw':!![],'where':{'id':_0x36d0f1['params']['id']}},_0x5697b3={};_0x5697b3[_0x5267('0x2f')]=_['keys'](db[_0x5267('0x28')][_0x5267('0x3f')]);_0x5697b3['query']=_[_0x5267('0x2d')](_0x36d0f1[_0x5267('0x2c')]);_0x5697b3[_0x5267('0x35')]=_[_0x5267('0x2e')](_0x5697b3[_0x5267('0x2f')],_0x5697b3[_0x5267('0x2c')]);_0x27add5[_0x5267('0x30')]=_[_0x5267('0x2e')](_0x5697b3[_0x5267('0x2f')],qs['fields'](_0x36d0f1[_0x5267('0x2c')][_0x5267('0x31')]));_0x27add5[_0x5267('0x30')]=_0x27add5[_0x5267('0x30')][_0x5267('0x40')]?_0x27add5['attributes']:_0x5697b3[_0x5267('0x2f')];if(_0x36d0f1['query'][_0x5267('0x3a')]){_0x27add5['include']=[{'all':!![]}];}_0x27add5=_['merge']({},_0x27add5,_0x36d0f1[_0x5267('0x41')]);return db['CmHopperFinal'][_0x5267('0x42')](_0x27add5)[_0x5267('0x22')](handleEntityNotFound(_0x3012cb,null))[_0x5267('0x22')](respondWithResult(_0x3012cb,null))[_0x5267('0x3d')](handleError(_0x3012cb,null));};exports['describe']=function(_0x12d6a8,_0x4ee826){return db['CmHopperFinal'][_0x5267('0x43')]()[_0x5267('0x22')](respondWithResult(_0x4ee826,null))['catch'](handleError(_0x4ee826,null));};exports['update']=function(_0x383ebe,_0xe0439e){if(_0x383ebe[_0x5267('0x44')][_0x5267('0x45')]){delete _0x383ebe[_0x5267('0x44')][_0x5267('0x45')];}return db[_0x5267('0x28')][_0x5267('0x42')]({'where':{'uniqueid':_0x383ebe[_0x5267('0x46')]['id']}})[_0x5267('0x22')](handleEntityNotFound(_0xe0439e,null))[_0x5267('0x22')](saveUpdates(_0x383ebe[_0x5267('0x44')],null))[_0x5267('0x22')](respondWithResult(_0xe0439e,null))[_0x5267('0x3d')](handleError(_0xe0439e,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x8636d0,_0x466d46,_0x371486){return db['CmHopperFinal'][_0x5267('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x8636d0[_0x5267('0x46')]['id']},'attributes':[[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x4a')))),'noSuchContacts'],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4c')))),_0x5267('0x4d')],[db['sequelize']['fn']('COUNT',db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x4e')))),'busyContacts'],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4f')))),_0x5267('0x50')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x51')))),_0x5267('0x52')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x53')))),'abandonedContacts'],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db['sequelize'][_0x5267('0x4b')](_0x5267('0x54')))),_0x5267('0x55')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db['sequelize'][_0x5267('0x4b')](_0x5267('0x56')))),_0x5267('0x57')]]})[_0x5267('0x22')](handleEntityNotFound(_0x466d46,null))['then'](respondWithResult(_0x466d46,null))['catch'](handleError(_0x466d46,null));};exports[_0x5267('0x58')]=function(_0x5393e9,_0x3f5cda,_0x47059c){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x5393e9[_0x5267('0x46')]['id']},'attributes':[[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db['sequelize']['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4a')))),_0x5267('0x59')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4c')))),_0x5267('0x4d')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x4e')))),_0x5267('0x5a')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4f')))),_0x5267('0x50')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x51')))),_0x5267('0x52')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x53')))),_0x5267('0x5b')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db['sequelize']['fn'](_0x5267('0x49'),db['sequelize']['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x56')))),_0x5267('0x57')]]})[_0x5267('0x22')](handleEntityNotFound(_0x3f5cda,null))[_0x5267('0x22')](respondWithResult(_0x3f5cda,null))[_0x5267('0x3d')](handleError(_0x3f5cda,null));};exports[_0x5267('0x5c')]=function(_0x21338f,_0x1103c5,_0x489b9a){return db['VoiceQueue']['find']({'where':{'id':_0x21338f[_0x5267('0x46')]['id']}})[_0x5267('0x22')](handleEntityNotFound(_0x1103c5,null))[_0x5267('0x22')](function(_0x457d84){var _0x4974d1;if(_0x457d84){_0x4974d1=squel[_0x5267('0x5d')]()[_0x5267('0x5e')](_0x5267('0x5f'))[_0x5267('0x60')](['phone',_0x5267('0x61'),_0x5267('0x62'),'ListId',_0x5267('0x63'),_0x5267('0x64'),'updatedAt'],squel['select']()[_0x5267('0x65')](_0x5267('0x66'),'phone')['field'](_0x5267('0x67'),_0x5267('0x61'))[_0x5267('0x65')](_0x5267('0x68'),_0x5267('0x62'))['field'](_0x5267('0x69'),_0x5267('0x6a'))['field'](_0x5267('0x6b'),_0x5267('0x63'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x64'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x6c'))['from']('cm_hopper_final')[_0x5267('0x34')](_0x5267('0x6d'),_0x21338f[_0x5267('0x46')]['id'][_0x5267('0x6e')]())['where'](_0x5267('0x6f'),_0x21338f['body'][_0x5267('0x70')][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x71'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5267('0x72')]()[_0x5267('0x65')](_0x5267('0x73'))[_0x5267('0x74')](_0x5267('0x5f'))[_0x5267('0x34')]('VoiceQueueId\x20=\x20?',_0x21338f[_0x5267('0x46')]['id']['toString']()))[_0x5267('0x34')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5267('0x72')]()[_0x5267('0x65')](_0x5267('0x75'))[_0x5267('0x74')](_0x5267('0x76'))[_0x5267('0x34')](_0x5267('0x6d'),_0x21338f[_0x5267('0x46')]['id'][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x77')))['group'](_0x5267('0x62')))[_0x5267('0x6e')]();return db['sequelize'][_0x5267('0x2c')](_0x4974d1);}return[];})[_0x5267('0x22')](respondWithResult(_0x1103c5,null))[_0x5267('0x3d')](handleError(_0x1103c5,null));};exports[_0x5267('0x78')]=function(_0xd18795,_0x37b007,_0x358543){return db['Campaign'][_0x5267('0x42')]({'where':{'id':_0xd18795[_0x5267('0x46')]['id']}})[_0x5267('0x22')](handleEntityNotFound(_0x37b007,null))[_0x5267('0x22')](function(_0x1cdf9f){var _0x4dbaa2;if(_0x1cdf9f){_0x4dbaa2=squel['insert']()[_0x5267('0x5e')](_0x5267('0x5f'))[_0x5267('0x60')]([_0x5267('0x73'),'scheduledAt',_0x5267('0x62'),_0x5267('0x6a'),_0x5267('0x79'),_0x5267('0x64'),_0x5267('0x6c')],squel[_0x5267('0x72')]()[_0x5267('0x65')](_0x5267('0x66'),_0x5267('0x73'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x61'))[_0x5267('0x65')]('ANY_VALUE(ContactId)',_0x5267('0x62'))[_0x5267('0x65')](_0x5267('0x69'),_0x5267('0x6a'))[_0x5267('0x65')](_0x5267('0x7a'),_0x5267('0x79'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x64'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x6c'))[_0x5267('0x74')](_0x5267('0x76'))[_0x5267('0x34')](_0x5267('0x7b'),_0xd18795[_0x5267('0x46')]['id'][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x6f'),_0xd18795[_0x5267('0x44')][_0x5267('0x70')]['toString']())[_0x5267('0x34')](_0x5267('0x71'))[_0x5267('0x34')](_0x5267('0x7c'),squel[_0x5267('0x72')]()['field'](_0x5267('0x73'))[_0x5267('0x74')]('cm_hopper')['where']('CampaignId\x20=\x20?',_0xd18795[_0x5267('0x46')]['id']['toString']()))[_0x5267('0x34')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x5267('0x65')](_0x5267('0x75'))[_0x5267('0x74')](_0x5267('0x76'))[_0x5267('0x34')]('CampaignId\x20=\x20?',_0xd18795['params']['id'][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x77')))[_0x5267('0x7d')](_0x5267('0x62')))['toString']();return db[_0x5267('0x48')]['query'](_0x4dbaa2);}return[];})['then'](respondWithResult(_0x37b007,null))[_0x5267('0x3d')](handleError(_0x37b007,null));};exports['checkContactHopper']=function(_0x5da8d6,_0x3ebe63,_0x321322){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x5da8d6['body'][_0x5267('0x63')],'CampaignId':_0x5da8d6['body'][_0x5267('0x79')],'ContactId':_0x5da8d6['body'][_0x5267('0x62')]}})[_0x5267('0x22')](handleEntityNotFound(_0x3ebe63,null))['then'](function(_0x1ae9fe){if(_0x1ae9fe){return _0x1ae9fe;}return null;})[_0x5267('0x22')](respondWithResult(_0x3ebe63,null))[_0x5267('0x3d')](handleError(_0x3ebe63,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 43fb7ad..3ac876d 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 _0x9255=['../../config/logger','api','bluebird','request-promise','path','rimraf','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x2ea6df,_0x3daed3){var _0x69240=function(_0x57f854){while(--_0x57f854){_0x2ea6df['push'](_0x2ea6df['shift']());}};_0x69240(++_0x3daed3);}(_0x9255,0x76));var _0x5925=function(_0x21df89,_0x3c65f5){_0x21df89=_0x21df89-0x0;var _0x4fb7fb=_0x9255[_0x21df89];return _0x4fb7fb;};'use strict';var _=require(_0x5925('0x0'));var util=require(_0x5925('0x1'));var logger=require(_0x5925('0x2'))(_0x5925('0x3'));var moment=require('moment');var BPromise=require(_0x5925('0x4'));var rp=require(_0x5925('0x5'));var fs=require('fs');var path=require(_0x5925('0x6'));var rimraf=require(_0x5925('0x7'));var config=require('../../config/environment');var attributes=require(_0x5925('0x8'));module[_0x5925('0x9')]=function(_0x46b836,_0x32b9d7){return _0x46b836[_0x5925('0xa')](_0x5925('0xb'),attributes,{'tableName':_0x5925('0xc'),'paranoid':![],'indexes':[{'name':_0x5925('0xd'),'fields':[_0x5925('0xd')]},{'name':_0x5925('0xe'),'fields':[_0x5925('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcdf4=['lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','define','cm_hopper_final','calleridnum','uniqueid'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xcdf4,0xbb));var _0x4cdf=function(_0x4fccc7,_0x1e2477){_0x4fccc7=_0x4fccc7-0x0;var _0x14917d=_0xcdf4[_0x4fccc7];return _0x14917d;};'use strict';var _=require(_0x4cdf('0x0'));var util=require('util');var logger=require(_0x4cdf('0x1'))('api');var moment=require(_0x4cdf('0x2'));var BPromise=require('bluebird');var rp=require(_0x4cdf('0x3'));var fs=require('fs');var path=require(_0x4cdf('0x4'));var rimraf=require(_0x4cdf('0x5'));var config=require(_0x4cdf('0x6'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x17193e,_0x4433b3){return _0x17193e[_0x4cdf('0x7')]('CmHopperFinal',attributes,{'tableName':_0x4cdf('0x8'),'paranoid':![],'indexes':[{'name':_0x4cdf('0x9'),'fields':[_0x4cdf('0x9')]},{'name':_0x4cdf('0xa'),'fields':[_0x4cdf('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 9090e08..ff3df9b 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x16561c,_0x19ac27){var _0x226a11=function(_0x3ff146){while(--_0x3ff146){_0x16561c['push'](_0x16561c['shift']());}};_0x226a11(++_0x19ac27);}(_0x7a54,0x106));var _0x47a5=function(_0x283313,_0x56a736){_0x283313=_0x283313-0x0;var _0x4b5edb=_0x7a54[_0x283313];return _0x4b5edb;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x459b92,_0x498ee){var _0x381936=function(_0x3d7d8a){while(--_0x3d7d8a){_0x459b92['push'](_0x459b92['shift']());}};_0x381936(++_0x498ee);}(_0x7a54,0x106));var _0x47a5=function(_0x43a666,_0x26cbdd){_0x43a666=_0x43a666-0x0;var _0x379174=_0x7a54[_0x43a666];return _0x379174;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index a04762d..1275d15 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 _0x00bb=['index','get','/describe','describe','/:id','isAuthenticated','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','post','/voice/campaign/moveContacts/:id','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x46ad76,_0x34b3fd){var _0x20f7ab=function(_0xb8c268){while(--_0xb8c268){_0x46ad76['push'](_0x46ad76['shift']());}};_0x20f7ab(++_0x34b3fd);}(_0x00bb,0x1bc));var _0xb00b=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x00bb[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0xb00b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb00b('0x1'));var express=require(_0xb00b('0x2'));var router=express[_0xb00b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb00b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb00b('0x5'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb00b('0x6')]);router[_0xb00b('0x7')](_0xb00b('0x8'),auth['isAuthenticated'](),controller[_0xb00b('0x9')]);router[_0xb00b('0x7')](_0xb00b('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xb00b('0x7')]('/voice/queue/countAttributes/:id',auth[_0xb00b('0xb')](),controller[_0xb00b('0xc')]);router[_0xb00b('0x7')]('/campaign/countAttributes/:id',auth[_0xb00b('0xb')](),controller[_0xb00b('0xd')]);router['post'](_0xb00b('0xe'),auth[_0xb00b('0xb')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xb00b('0xf')](_0xb00b('0x10'),auth[_0xb00b('0xb')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xb00b('0xf')]('/checkContactHopper',auth['isAuthenticated'](),controller['checkContactHopper']);router['put'](_0xb00b('0xa'),auth[_0xb00b('0xb')](),controller['update']);module[_0xb00b('0x11')]=router; \ No newline at end of file +var _0xd081=['Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','multer','util','path','connect-timeout','express'];(function(_0x545bed,_0x221e96){var _0x16c79c=function(_0x465346){while(--_0x465346){_0x545bed['push'](_0x545bed['shift']());}};_0x16c79c(++_0x221e96);}(_0xd081,0x13d));var _0x1d08=function(_0x6889d3,_0x527822){_0x6889d3=_0x6889d3-0x0;var _0x22457c=_0xd081[_0x6889d3];return _0x22457c;};'use strict';var multer=require(_0x1d08('0x0'));var util=require(_0x1d08('0x1'));var path=require(_0x1d08('0x2'));var timeout=require(_0x1d08('0x3'));var express=require(_0x1d08('0x4'));var router=express[_0x1d08('0x5')]();var fs_extra=require(_0x1d08('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1d08('0x7'));var config=require(_0x1d08('0x8'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0x1d08('0x9')](),controller['index']);router[_0x1d08('0xa')](_0x1d08('0xb'),auth[_0x1d08('0x9')](),controller[_0x1d08('0xc')]);router[_0x1d08('0xa')](_0x1d08('0xd'),auth[_0x1d08('0x9')](),controller[_0x1d08('0xe')]);router[_0x1d08('0xa')]('/voice/queue/countAttributes/:id',auth[_0x1d08('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x1d08('0xa')](_0x1d08('0xf'),auth[_0x1d08('0x9')](),controller[_0x1d08('0x10')]);router[_0x1d08('0x11')]('/voice/queue/moveContacts/:id',auth[_0x1d08('0x9')](),controller[_0x1d08('0x12')]);router['post'](_0x1d08('0x13'),auth['isAuthenticated'](),controller[_0x1d08('0x14')]);router[_0x1d08('0x11')](_0x1d08('0x15'),auth[_0x1d08('0x9')](),controller[_0x1d08('0x16')]);router['put'](_0x1d08('0xd'),auth[_0x1d08('0x9')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 5957e70..8acdc1d 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 _0x4d42=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x3b0baf,_0x5ccc5a){var _0x2abdcd=function(_0x5c9f45){while(--_0x5c9f45){_0x3b0baf['push'](_0x3b0baf['shift']());}};_0x2abdcd(++_0x5ccc5a);}(_0x4d42,0x174));var _0x24d4=function(_0x46f6a9,_0xa51d16){_0x46f6a9=_0x46f6a9-0x0;var _0x450368=_0x4d42[_0x46f6a9];return _0x450368;};'use strict';var Sequelize=require(_0x24d4('0x0'));module[_0x24d4('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x24d4('0x2')]},'scheduledat':{'type':Sequelize[_0x24d4('0x3')]},'countbusyretry':{'type':Sequelize[_0x24d4('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x24d4('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x24d4('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x24d4('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x24d4('0x2')]},'originatecalleridname':{'type':Sequelize[_0x24d4('0x2')]},'calleridnum':{'type':Sequelize[_0x24d4('0x2')]},'calleridname':{'type':Sequelize[_0x24d4('0x2')]},'starttime':{'type':Sequelize[_0x24d4('0x3')]},'responsetime':{'type':Sequelize[_0x24d4('0x3')]},'answertime':{'type':Sequelize[_0x24d4('0x3')]},'droptime':{'type':Sequelize[_0x24d4('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x24d4('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x24d4('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x24d4('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x24d4('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x24d4('0x2')]},'campaign':{'type':Sequelize[_0x24d4('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x24d4('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x24d4('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x24d4('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x24d4('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x24d4('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x24d4('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x24d4('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x24d4('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x24d4('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc143=['STRING','BOOLEAN','exports','INTEGER','DATE'];(function(_0x5f002d,_0x1b9dc8){var _0x544598=function(_0x929264){while(--_0x929264){_0x5f002d['push'](_0x5f002d['shift']());}};_0x544598(++_0x1b9dc8);}(_0xc143,0x138));var _0x3c14=function(_0x523863,_0x317a65){_0x523863=_0x523863-0x0;var _0x2d40a9=_0xc143[_0x523863];return _0x2d40a9;};'use strict';var Sequelize=require('sequelize');module[_0x3c14('0x0')]={'state':{'type':Sequelize[_0x3c14('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x3c14('0x2')]},'countbusyretry':{'type':Sequelize[_0x3c14('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3c14('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3c14('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3c14('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3c14('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x3c14('0x3')]},'originatecalleridname':{'type':Sequelize[_0x3c14('0x3')]},'calleridnum':{'type':Sequelize[_0x3c14('0x3')]},'calleridname':{'type':Sequelize[_0x3c14('0x3')]},'starttime':{'type':Sequelize[_0x3c14('0x2')]},'responsetime':{'type':Sequelize[_0x3c14('0x2')]},'answertime':{'type':Sequelize[_0x3c14('0x2')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3c14('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3c14('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3c14('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3c14('0x3')]},'campaign':{'type':Sequelize[_0x3c14('0x3')]},'campaigntype':{'type':Sequelize[_0x3c14('0x3')]},'membername':{'type':Sequelize[_0x3c14('0x3')]},'reason':{'type':Sequelize[_0x3c14('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x3c14('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x3c14('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3c14('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3c14('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x3c14('0x2')]},'edited':{'type':Sequelize[_0x3c14('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3c14('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3c14('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 0f53c2d..184a9fc 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 _0x8214=['moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','params','find','create','body','catch','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x179d19,_0x3f63fc){var _0x1ca47f=function(_0x42ef71){while(--_0x42ef71){_0x179d19['push'](_0x179d19['shift']());}};_0x1ca47f(++_0x3f63fc);}(_0x8214,0xd6));var _0x4821=function(_0xf127eb,_0xcd0d29){_0xf127eb=_0xf127eb-0x0;var _0x41fa14=_0x8214[_0xf127eb];return _0x41fa14;};'use strict';var emlformat=require(_0x4821('0x0'));var rimraf=require(_0x4821('0x1'));var zipdir=require(_0x4821('0x2'));var jsonpatch=require(_0x4821('0x3'));var rp=require(_0x4821('0x4'));var moment=require(_0x4821('0x5'));var BPromise=require(_0x4821('0x6'));var Mustache=require(_0x4821('0x7'));var util=require(_0x4821('0x8'));var path=require(_0x4821('0x9'));var sox=require(_0x4821('0xa'));var csv=require(_0x4821('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4821('0xc'));var squel=require(_0x4821('0xd'));var crypto=require(_0x4821('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4821('0xb'));var querystring=require(_0x4821('0xf'));var Papa=require('papaparse');var Redis=require(_0x4821('0x10'));var authService=require(_0x4821('0x11'));var qs=require(_0x4821('0x12'));var as=require(_0x4821('0x13'));var hardwareService=require(_0x4821('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4821('0x15'));var config=require(_0x4821('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4821('0x17'))['db'];function respondWithStatusCode(_0x3209e2,_0x525579){_0x525579=_0x525579||0xcc;return function(_0x167cde){if(_0x167cde){return _0x3209e2[_0x4821('0x18')](_0x525579);}return _0x3209e2['status'](_0x525579)['end']();};}function respondWithResult(_0x1d1abb,_0x5910d2){_0x5910d2=_0x5910d2||0xc8;return function(_0x25b1e6){if(_0x25b1e6){return _0x1d1abb[_0x4821('0x19')](_0x5910d2)[_0x4821('0x1a')](_0x25b1e6);}};}function respondWithFilteredResult(_0x58019f,_0x5080f1){return function(_0x12c302){if(_0x12c302){var _0x514c3d=typeof _0x5080f1[_0x4821('0x1b')]===_0x4821('0x1c')&&typeof _0x5080f1[_0x4821('0x1d')]===_0x4821('0x1c');var _0x1faa4d=_0x12c302[_0x4821('0x1e')];var _0x106259=_0x514c3d?0x0:_0x5080f1[_0x4821('0x1b')];var _0x1b2e20=_0x514c3d?_0x12c302[_0x4821('0x1e')]:_0x5080f1[_0x4821('0x1b')]+_0x5080f1[_0x4821('0x1d')];var _0x4ed07d;if(_0x1b2e20>=_0x1faa4d){_0x1b2e20=_0x1faa4d;_0x4ed07d=0xc8;}else{_0x4ed07d=0xce;}_0x58019f[_0x4821('0x19')](_0x4ed07d);return _0x58019f[_0x4821('0x1f')](_0x4821('0x20'),_0x106259+'-'+_0x1b2e20+'/'+_0x1faa4d)['json'](_0x12c302);}return null;};}function patchUpdates(_0x1dfa13){return function(_0x21e364){try{jsonpatch[_0x4821('0x21')](_0x21e364,_0x1dfa13,!![]);}catch(_0x162c5c){return BPromise[_0x4821('0x22')](_0x162c5c);}return _0x21e364[_0x4821('0x23')]();};}function saveUpdates(_0x25a663,_0x4761a9){return function(_0x3fa3cb){if(_0x3fa3cb){return _0x3fa3cb['update'](_0x25a663)[_0x4821('0x24')](function(_0xda5b9d){return _0xda5b9d;});}return null;};}function removeEntity(_0x38263a,_0x52aba1){return function(_0x2a1dd3){if(_0x2a1dd3){return _0x2a1dd3[_0x4821('0x25')]()[_0x4821('0x24')](function(){_0x38263a['status'](0xcc)[_0x4821('0x26')]();});}};}function handleEntityNotFound(_0x109ff7,_0x1e3439){return function(_0x3779c1){if(!_0x3779c1){_0x109ff7[_0x4821('0x18')](0x194);}return _0x3779c1;};}function handleError(_0x533032,_0x10ad22){_0x10ad22=_0x10ad22||0x1f4;return function(_0x2ee2bb){logger[_0x4821('0x27')](_0x2ee2bb[_0x4821('0x28')]);if(_0x2ee2bb['name']){delete _0x2ee2bb[_0x4821('0x29')];}_0x533032[_0x4821('0x19')](_0x10ad22)[_0x4821('0x2a')](_0x2ee2bb);};}exports[_0x4821('0x2b')]=function(_0x3f9623,_0xb23d9b){var _0x2b6ba1={},_0xb7b3d7={},_0xeef2f6={'count':0x0,'rows':[]};var _0x460945=_[_0x4821('0x2c')](db[_0x4821('0x2d')][_0x4821('0x2e')],function(_0x35feef){return{'name':_0x35feef['fieldName'],'type':_0x35feef['type'][_0x4821('0x2f')]};});_0xb7b3d7[_0x4821('0x30')]=_[_0x4821('0x2c')](_0x460945,_0x4821('0x29'));_0xb7b3d7[_0x4821('0x31')]=_[_0x4821('0x32')](_0x3f9623['query']);_0xb7b3d7[_0x4821('0x33')]=_[_0x4821('0x34')](_0xb7b3d7[_0x4821('0x30')],_0xb7b3d7[_0x4821('0x31')]);_0x2b6ba1[_0x4821('0x35')]=_['intersection'](_0xb7b3d7[_0x4821('0x30')],qs[_0x4821('0x36')](_0x3f9623[_0x4821('0x31')][_0x4821('0x36')]));_0x2b6ba1[_0x4821('0x35')]=_0x2b6ba1['attributes'][_0x4821('0x37')]?_0x2b6ba1['attributes']:_0xb7b3d7[_0x4821('0x30')];if(!_0x3f9623[_0x4821('0x31')][_0x4821('0x38')]('nolimit')){_0x2b6ba1[_0x4821('0x1d')]=qs[_0x4821('0x1d')](_0x3f9623[_0x4821('0x31')][_0x4821('0x1d')]);_0x2b6ba1[_0x4821('0x1b')]=qs[_0x4821('0x1b')](_0x3f9623[_0x4821('0x31')][_0x4821('0x1b')]);}_0x2b6ba1['order']=qs[_0x4821('0x39')](_0x3f9623[_0x4821('0x31')]['sort']);_0x2b6ba1[_0x4821('0x3a')]=qs[_0x4821('0x33')](_['pick'](_0x3f9623[_0x4821('0x31')],_0xb7b3d7[_0x4821('0x33')]),_0x460945);if(_0x3f9623[_0x4821('0x31')][_0x4821('0x3b')]){_0x2b6ba1[_0x4821('0x3a')]=_[_0x4821('0x3c')](_0x2b6ba1[_0x4821('0x3a')],{'$or':_[_0x4821('0x2c')](_0x460945,function(_0x105469){if(_0x105469[_0x4821('0x3d')]!==_0x4821('0x3e')){var _0x56b6ad={};_0x56b6ad[_0x105469[_0x4821('0x29')]]={'$like':'%'+_0x3f9623[_0x4821('0x31')][_0x4821('0x3b')]+'%'};return _0x56b6ad;}})});}_0x2b6ba1=_['merge']({},_0x2b6ba1,_0x3f9623[_0x4821('0x3f')]);var _0x5c5723={'where':_0x2b6ba1['where']};return db[_0x4821('0x2d')][_0x4821('0x1e')](_0x5c5723)['then'](function(_0x347f9b){_0xeef2f6['count']=_0x347f9b;if(_0x3f9623[_0x4821('0x31')][_0x4821('0x40')]){_0x2b6ba1['include']=[{'all':!![]}];}return db[_0x4821('0x2d')][_0x4821('0x41')](_0x2b6ba1);})['then'](function(_0x42c329){_0xeef2f6[_0x4821('0x42')]=_0x42c329;return _0xeef2f6;})[_0x4821('0x24')](respondWithFilteredResult(_0xb23d9b,_0x2b6ba1))['catch'](handleError(_0xb23d9b,null));};exports['show']=function(_0x250973,_0x467fdf){var _0x21463f={'raw':!![],'where':{'id':_0x250973[_0x4821('0x43')]['id']}},_0x2f2ad4={};_0x2f2ad4[_0x4821('0x30')]=_['keys'](db[_0x4821('0x2d')][_0x4821('0x2e')]);_0x2f2ad4[_0x4821('0x31')]=_['keys'](_0x250973[_0x4821('0x31')]);_0x2f2ad4[_0x4821('0x33')]=_['intersection'](_0x2f2ad4[_0x4821('0x30')],_0x2f2ad4[_0x4821('0x31')]);_0x21463f[_0x4821('0x35')]=_['intersection'](_0x2f2ad4[_0x4821('0x30')],qs[_0x4821('0x36')](_0x250973['query'][_0x4821('0x36')]));_0x21463f[_0x4821('0x35')]=_0x21463f['attributes'][_0x4821('0x37')]?_0x21463f[_0x4821('0x35')]:_0x2f2ad4[_0x4821('0x30')];if(_0x250973[_0x4821('0x31')][_0x4821('0x40')]){_0x21463f['include']=[{'all':!![]}];}_0x21463f=_['merge']({},_0x21463f,_0x250973['options']);return db[_0x4821('0x2d')][_0x4821('0x44')](_0x21463f)[_0x4821('0x24')](handleEntityNotFound(_0x467fdf,null))[_0x4821('0x24')](respondWithResult(_0x467fdf,null))['catch'](handleError(_0x467fdf,null));};exports[_0x4821('0x45')]=function(_0x189e7a,_0xad3070){return db[_0x4821('0x2d')]['create'](_0x189e7a[_0x4821('0x46')],{})['then'](respondWithResult(_0xad3070,0xc9))[_0x4821('0x47')](handleError(_0xad3070,null));};exports['describe']=function(_0x146088,_0x4f5239){return db[_0x4821('0x2d')]['describe']()[_0x4821('0x24')](respondWithResult(_0x4f5239,null))[_0x4821('0x47')](handleError(_0x4f5239,null));};exports['update']=function(_0x30ff86,_0x47352f){if(_0x30ff86[_0x4821('0x46')][_0x4821('0x48')]){delete _0x30ff86[_0x4821('0x46')][_0x4821('0x48')];}return db[_0x4821('0x2d')][_0x4821('0x44')]({'where':{'uniqueid':_0x30ff86['params']['id']}})[_0x4821('0x24')](handleEntityNotFound(_0x47352f,null))[_0x4821('0x24')](saveUpdates(_0x30ff86[_0x4821('0x46')],null))[_0x4821('0x24')](respondWithResult(_0x47352f,null))[_0x4821('0x47')](handleError(_0x47352f,null));}; \ No newline at end of file +var _0x3693=['set','Content-Range','apply','save','update','then','destroy','stack','name','map','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','CmHopperHistory','include','findAll','rows','catch','show','includeAll','find','create','body','describe','uniqueid','params','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x4c09c9,_0x13fe9b){var _0x2e0750=function(_0x2ff13e){while(--_0x2ff13e){_0x4c09c9['push'](_0x4c09c9['shift']());}};_0x2e0750(++_0x13fe9b);}(_0x3693,0x1d4));var _0x3369=function(_0x13bfe6,_0x4c4fe1){_0x13bfe6=_0x13bfe6-0x0;var _0x59e709=_0x3693[_0x13bfe6];return _0x59e709;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3369('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3369('0x1'));var rp=require(_0x3369('0x2'));var moment=require(_0x3369('0x3'));var BPromise=require(_0x3369('0x4'));var Mustache=require('mustache');var util=require(_0x3369('0x5'));var path=require(_0x3369('0x6'));var sox=require('sox');var csv=require(_0x3369('0x7'));var ejs=require(_0x3369('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3369('0x9'));var jsforce=require(_0x3369('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3369('0x7'));var querystring=require(_0x3369('0xb'));var Papa=require(_0x3369('0xc'));var Redis=require(_0x3369('0xd'));var authService=require(_0x3369('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3369('0xf'));var hardwareService=require(_0x3369('0x10'));var logger=require('../../config/logger')(_0x3369('0x11'));var utils=require(_0x3369('0x12'));var config=require(_0x3369('0x13'));var licenseUtil=require(_0x3369('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46059c,_0x18af0e){_0x18af0e=_0x18af0e||0xcc;return function(_0x355896){if(_0x355896){return _0x46059c[_0x3369('0x15')](_0x18af0e);}return _0x46059c[_0x3369('0x16')](_0x18af0e)[_0x3369('0x17')]();};}function respondWithResult(_0x133c0b,_0x1973a2){_0x1973a2=_0x1973a2||0xc8;return function(_0x3ecda1){if(_0x3ecda1){return _0x133c0b[_0x3369('0x16')](_0x1973a2)[_0x3369('0x18')](_0x3ecda1);}};}function respondWithFilteredResult(_0x10f840,_0x1b555e){return function(_0xd6e887){if(_0xd6e887){var _0x470857=typeof _0x1b555e['offset']===_0x3369('0x19')&&typeof _0x1b555e[_0x3369('0x1a')]==='undefined';var _0x17ba27=_0xd6e887[_0x3369('0x1b')];var _0x6e9902=_0x470857?0x0:_0x1b555e[_0x3369('0x1c')];var _0x21ed79=_0x470857?_0xd6e887[_0x3369('0x1b')]:_0x1b555e[_0x3369('0x1c')]+_0x1b555e[_0x3369('0x1a')];var _0x5393fe;if(_0x21ed79>=_0x17ba27){_0x21ed79=_0x17ba27;_0x5393fe=0xc8;}else{_0x5393fe=0xce;}_0x10f840[_0x3369('0x16')](_0x5393fe);return _0x10f840[_0x3369('0x1d')](_0x3369('0x1e'),_0x6e9902+'-'+_0x21ed79+'/'+_0x17ba27)[_0x3369('0x18')](_0xd6e887);}return null;};}function patchUpdates(_0x1a376d){return function(_0x2ab845){try{jsonpatch[_0x3369('0x1f')](_0x2ab845,_0x1a376d,!![]);}catch(_0x2107be){return BPromise['reject'](_0x2107be);}return _0x2ab845[_0x3369('0x20')]();};}function saveUpdates(_0x551026,_0x7bd5e5){return function(_0x2a75d2){if(_0x2a75d2){return _0x2a75d2[_0x3369('0x21')](_0x551026)[_0x3369('0x22')](function(_0x3683be){return _0x3683be;});}return null;};}function removeEntity(_0x175ef0,_0x54b986){return function(_0x22c228){if(_0x22c228){return _0x22c228[_0x3369('0x23')]()[_0x3369('0x22')](function(){_0x175ef0[_0x3369('0x16')](0xcc)[_0x3369('0x17')]();});}};}function handleEntityNotFound(_0x2a484e,_0xb14496){return function(_0x1bcd90){if(!_0x1bcd90){_0x2a484e[_0x3369('0x15')](0x194);}return _0x1bcd90;};}function handleError(_0x56dda8,_0x3d9b56){_0x3d9b56=_0x3d9b56||0x1f4;return function(_0xab5c73){logger['error'](_0xab5c73[_0x3369('0x24')]);if(_0xab5c73[_0x3369('0x25')]){delete _0xab5c73[_0x3369('0x25')];}_0x56dda8[_0x3369('0x16')](_0x3d9b56)['send'](_0xab5c73);};}exports['index']=function(_0x379978,_0x46c362){var _0x1530d7={},_0x4b40ec={},_0x497a76={'count':0x0,'rows':[]};var _0x31bf94=_[_0x3369('0x26')](db['CmHopperHistory']['rawAttributes'],function(_0x5dcfd0){return{'name':_0x5dcfd0['fieldName'],'type':_0x5dcfd0[_0x3369('0x27')][_0x3369('0x28')]};});_0x4b40ec[_0x3369('0x29')]=_[_0x3369('0x26')](_0x31bf94,'name');_0x4b40ec['query']=_[_0x3369('0x2a')](_0x379978[_0x3369('0x2b')]);_0x4b40ec[_0x3369('0x2c')]=_['intersection'](_0x4b40ec[_0x3369('0x29')],_0x4b40ec[_0x3369('0x2b')]);_0x1530d7['attributes']=_[_0x3369('0x2d')](_0x4b40ec[_0x3369('0x29')],qs[_0x3369('0x2e')](_0x379978[_0x3369('0x2b')]['fields']));_0x1530d7[_0x3369('0x2f')]=_0x1530d7[_0x3369('0x2f')][_0x3369('0x30')]?_0x1530d7['attributes']:_0x4b40ec[_0x3369('0x29')];if(!_0x379978[_0x3369('0x2b')][_0x3369('0x31')](_0x3369('0x32'))){_0x1530d7[_0x3369('0x1a')]=qs['limit'](_0x379978[_0x3369('0x2b')][_0x3369('0x1a')]);_0x1530d7['offset']=qs['offset'](_0x379978[_0x3369('0x2b')]['offset']);}_0x1530d7[_0x3369('0x33')]=qs['sort'](_0x379978[_0x3369('0x2b')]['sort']);_0x1530d7[_0x3369('0x34')]=qs[_0x3369('0x2c')](_[_0x3369('0x35')](_0x379978[_0x3369('0x2b')],_0x4b40ec['filters']),_0x31bf94);if(_0x379978['query'][_0x3369('0x36')]){_0x1530d7['where']=_[_0x3369('0x37')](_0x1530d7['where'],{'$or':_[_0x3369('0x26')](_0x31bf94,function(_0x5ab7bc){if(_0x5ab7bc[_0x3369('0x27')]!==_0x3369('0x38')){var _0x4aaf85={};_0x4aaf85[_0x5ab7bc[_0x3369('0x25')]]={'$like':'%'+_0x379978[_0x3369('0x2b')][_0x3369('0x36')]+'%'};return _0x4aaf85;}})});}_0x1530d7=_[_0x3369('0x37')]({},_0x1530d7,_0x379978[_0x3369('0x39')]);var _0x24aa74={'where':_0x1530d7[_0x3369('0x34')]};return db[_0x3369('0x3a')][_0x3369('0x1b')](_0x24aa74)[_0x3369('0x22')](function(_0xd3b0c0){_0x497a76['count']=_0xd3b0c0;if(_0x379978[_0x3369('0x2b')]['includeAll']){_0x1530d7[_0x3369('0x3b')]=[{'all':!![]}];}return db[_0x3369('0x3a')][_0x3369('0x3c')](_0x1530d7);})[_0x3369('0x22')](function(_0x50ae56){_0x497a76[_0x3369('0x3d')]=_0x50ae56;return _0x497a76;})[_0x3369('0x22')](respondWithFilteredResult(_0x46c362,_0x1530d7))[_0x3369('0x3e')](handleError(_0x46c362,null));};exports[_0x3369('0x3f')]=function(_0x111013,_0x2116a7){var _0x22573a={'raw':!![],'where':{'id':_0x111013['params']['id']}},_0x1c12bd={};_0x1c12bd['model']=_['keys'](db[_0x3369('0x3a')]['rawAttributes']);_0x1c12bd[_0x3369('0x2b')]=_[_0x3369('0x2a')](_0x111013['query']);_0x1c12bd[_0x3369('0x2c')]=_[_0x3369('0x2d')](_0x1c12bd['model'],_0x1c12bd[_0x3369('0x2b')]);_0x22573a[_0x3369('0x2f')]=_[_0x3369('0x2d')](_0x1c12bd[_0x3369('0x29')],qs[_0x3369('0x2e')](_0x111013[_0x3369('0x2b')][_0x3369('0x2e')]));_0x22573a[_0x3369('0x2f')]=_0x22573a[_0x3369('0x2f')][_0x3369('0x30')]?_0x22573a[_0x3369('0x2f')]:_0x1c12bd[_0x3369('0x29')];if(_0x111013[_0x3369('0x2b')][_0x3369('0x40')]){_0x22573a[_0x3369('0x3b')]=[{'all':!![]}];}_0x22573a=_['merge']({},_0x22573a,_0x111013[_0x3369('0x39')]);return db[_0x3369('0x3a')][_0x3369('0x41')](_0x22573a)['then'](handleEntityNotFound(_0x2116a7,null))['then'](respondWithResult(_0x2116a7,null))['catch'](handleError(_0x2116a7,null));};exports[_0x3369('0x42')]=function(_0x38a946,_0xe70c62){return db[_0x3369('0x3a')]['create'](_0x38a946[_0x3369('0x43')],{})[_0x3369('0x22')](respondWithResult(_0xe70c62,0xc9))['catch'](handleError(_0xe70c62,null));};exports[_0x3369('0x44')]=function(_0x202410,_0x20706a){return db['CmHopperHistory']['describe']()['then'](respondWithResult(_0x20706a,null))[_0x3369('0x3e')](handleError(_0x20706a,null));};exports[_0x3369('0x21')]=function(_0xc4a924,_0x20d613){if(_0xc4a924[_0x3369('0x43')][_0x3369('0x45')]){delete _0xc4a924[_0x3369('0x43')][_0x3369('0x45')];}return db['CmHopperHistory'][_0x3369('0x41')]({'where':{'uniqueid':_0xc4a924[_0x3369('0x46')]['id']}})[_0x3369('0x22')](handleEntityNotFound(_0x20d613,null))[_0x3369('0x22')](saveUpdates(_0xc4a924[_0x3369('0x43')],null))[_0x3369('0x22')](respondWithResult(_0x20d613,null))[_0x3369('0x3e')](handleError(_0x20d613,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 7cc84a1..69a1a2e 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 _0xda20=['define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','bluebird','path','rimraf','./cmHopperHistory.attributes','exports'];(function(_0x26c311,_0x26a54c){var _0x75f1b7=function(_0x15e470){while(--_0x15e470){_0x26c311['push'](_0x26c311['shift']());}};_0x75f1b7(++_0x26a54c);}(_0xda20,0x1d9));var _0x0da2=function(_0xda97dc,_0x39ec7e){_0xda97dc=_0xda97dc-0x0;var _0x1f2af0=_0xda20[_0xda97dc];return _0x1f2af0;};'use strict';var _=require(_0x0da2('0x0'));var util=require('util');var logger=require(_0x0da2('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0da2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0da2('0x3'));var rimraf=require(_0x0da2('0x4'));var config=require('../../config/environment');var attributes=require(_0x0da2('0x5'));module[_0x0da2('0x6')]=function(_0x5c1bcb,_0x4674a3){return _0x5c1bcb[_0x0da2('0x7')](_0x0da2('0x8'),attributes,{'tableName':_0x0da2('0x9'),'paranoid':![],'indexes':[{'name':_0x0da2('0xa'),'fields':[_0x0da2('0xa')]},{'name':_0x0da2('0xb'),'fields':[_0x0da2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfd49=['cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes'];(function(_0x2c0ded,_0x3de22c){var _0x4473e5=function(_0x3705bc){while(--_0x3705bc){_0x2c0ded['push'](_0x2c0ded['shift']());}};_0x4473e5(++_0x3de22c);}(_0xfd49,0x121));var _0x9fd4=function(_0x24549b,_0x5e2f92){_0x24549b=_0x24549b-0x0;var _0x352b98=_0xfd49[_0x24549b];return _0x352b98;};'use strict';var _=require(_0x9fd4('0x0'));var util=require(_0x9fd4('0x1'));var logger=require(_0x9fd4('0x2'))(_0x9fd4('0x3'));var moment=require(_0x9fd4('0x4'));var BPromise=require('bluebird');var rp=require(_0x9fd4('0x5'));var fs=require('fs');var path=require(_0x9fd4('0x6'));var rimraf=require(_0x9fd4('0x7'));var config=require(_0x9fd4('0x8'));var attributes=require(_0x9fd4('0x9'));module['exports']=function(_0x5d8420,_0x89e59b){return _0x5d8420['define']('CmHopperHistory',attributes,{'tableName':_0x9fd4('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x9fd4('0xb')]},{'name':'uniqueid','fields':[_0x9fd4('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 1e77a7c..5af444f 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 _0xe5fb=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','raw','CreateCmHopperHistory','AvgHandleTime','CmHopperHistory','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','where','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','randomstring'];(function(_0xb815aa,_0x15776a){var _0xd9d2ae=function(_0x2411df){while(--_0x2411df){_0xb815aa['push'](_0xb815aa['shift']());}};_0xd9d2ae(++_0x15776a);}(_0xe5fb,0xce));var _0xbe5f=function(_0x338f73,_0x1945c8){_0x338f73=_0x338f73-0x0;var _0x163fdf=_0xe5fb[_0x338f73];return _0x163fdf;};'use strict';var _=require(_0xbe5f('0x0'));var util=require(_0xbe5f('0x1'));var moment=require('moment');var BPromise=require(_0xbe5f('0x2'));var rs=require(_0xbe5f('0x3'));var fs=require('fs');var Redis=require(_0xbe5f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe5f('0x5'));var logger=require(_0xbe5f('0x6'))(_0xbe5f('0x7'));var config=require(_0xbe5f('0x8'));var jayson=require(_0xbe5f('0x9'));var client=jayson['client'][_0xbe5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dd594,_0x2fc62b,_0x38c423){return new BPromise(function(_0x3fc210,_0x188fe9){return client['request'](_0x2dd594,_0x38c423)[_0xbe5f('0xb')](function(_0x332fa9){logger[_0xbe5f('0xc')](_0xbe5f('0xd'),_0x2fc62b,_0xbe5f('0xe'));logger[_0xbe5f('0xf')](_0xbe5f('0x10'),_0x2fc62b,_0xbe5f('0xe'),JSON[_0xbe5f('0x11')](_0x332fa9));if(_0x332fa9[_0xbe5f('0x12')]){if(_0x332fa9[_0xbe5f('0x12')][_0xbe5f('0x13')]===0x1f4){logger['error'](_0xbe5f('0xd'),_0x2fc62b,_0x332fa9[_0xbe5f('0x12')][_0xbe5f('0x14')]);return _0x188fe9(_0x332fa9[_0xbe5f('0x12')][_0xbe5f('0x14')]);}logger[_0xbe5f('0x12')](_0xbe5f('0xd'),_0x2fc62b,_0x332fa9[_0xbe5f('0x12')][_0xbe5f('0x14')]);return _0x3fc210(_0x332fa9[_0xbe5f('0x12')][_0xbe5f('0x14')]);}else{logger[_0xbe5f('0xc')](_0xbe5f('0xd'),_0x2fc62b,_0xbe5f('0xe'));_0x3fc210(_0x332fa9[_0xbe5f('0x15')][_0xbe5f('0x14')]);}})[_0xbe5f('0x16')](function(_0x2bd011){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x2fc62b,_0x2bd011);_0x188fe9(_0x2bd011);});});}exports['CreateCmHopperHistory']=function(_0x565c40){var _0x9b274e=this;return new Promise(function(_0x35615a,_0x30f6d2){return db['CmHopperHistory']['create'](_0x565c40['body'],{'raw':_0x565c40[_0xbe5f('0x17')]?_0x565c40[_0xbe5f('0x17')][_0xbe5f('0x18')]===undefined?!![]:![]:!![]})[_0xbe5f('0xb')](function(_0x420ea7){logger[_0xbe5f('0xc')](_0xbe5f('0x19'),_0x565c40);logger['debug'](_0xbe5f('0x19'),_0x565c40,JSON[_0xbe5f('0x11')](_0x420ea7));_0x35615a(_0x420ea7);})[_0xbe5f('0x16')](function(_0x306974){logger[_0xbe5f('0x12')](_0xbe5f('0x19'),_0x306974[_0xbe5f('0x14')],_0x565c40);_0x30f6d2(_0x9b274e['error'](0x1f4,_0x306974[_0xbe5f('0x14')]));});});};exports[_0xbe5f('0x1a')]=function(_0x4832a7){var _0x37b5a9=this;return new Promise(function(_0x393418,_0x3d87ca){return db[_0xbe5f('0x1b')][_0xbe5f('0x1c')]({'raw':_0x4832a7[_0xbe5f('0x17')]?_0x4832a7[_0xbe5f('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4832a7['options']?_0x4832a7['options']['where']||null:null,'attributes':[[db[_0xbe5f('0x1d')]['fn'](_0xbe5f('0x1e'),db[_0xbe5f('0x1d')][_0xbe5f('0x1f')]('id')),_0xbe5f('0x20')],[db[_0xbe5f('0x1d')]['fn'](_0xbe5f('0x1e'),db[_0xbe5f('0x1d')]['fn']('IF',db[_0xbe5f('0x1d')][_0xbe5f('0x21')](_0xbe5f('0x22')))),_0xbe5f('0x23')],[db[_0xbe5f('0x1d')]['fn'](_0xbe5f('0x1e'),db[_0xbe5f('0x1d')]['fn']('IF',db[_0xbe5f('0x1d')][_0xbe5f('0x21')](_0xbe5f('0x24')))),_0xbe5f('0x25')],[db[_0xbe5f('0x1d')]['fn'](_0xbe5f('0x1e'),db[_0xbe5f('0x1d')]['fn']('IF',db[_0xbe5f('0x1d')][_0xbe5f('0x21')](_0xbe5f('0x26')))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0xbe5f('0x27'),db[_0xbe5f('0x1d')]['fn']('IF',db[_0xbe5f('0x1d')][_0xbe5f('0x21')](_0xbe5f('0x28')))),_0xbe5f('0x29')],[db[_0xbe5f('0x1d')]['fn'](_0xbe5f('0x27'),db[_0xbe5f('0x1d')]['fn']('IF',db[_0xbe5f('0x1d')][_0xbe5f('0x21')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xbe5f('0x2a')]]})['then'](function(_0x342e87){logger[_0xbe5f('0xc')](_0xbe5f('0x1a'),_0x4832a7);logger[_0xbe5f('0xf')](_0xbe5f('0x1a'),_0x4832a7,JSON[_0xbe5f('0x11')](_0x342e87));_0x393418(_0x342e87);})[_0xbe5f('0x16')](function(_0x18da92){logger[_0xbe5f('0x12')](_0xbe5f('0x1a'),_0x18da92['message'],_0x4832a7);_0x3d87ca(_0x37b5a9[_0xbe5f('0x12')](0x1f4,_0x18da92[_0xbe5f('0x14')]));});});};exports[_0xbe5f('0x2b')]=function(_0xb4a365){var _0x34e2f5=this;return new Promise(function(_0x282259,_0x4be02c){return db[_0xbe5f('0x1b')][_0xbe5f('0x1c')]({'raw':_0xb4a365['options']?_0xb4a365[_0xbe5f('0x17')][_0xbe5f('0x18')]===undefined?!![]:![]:!![],'where':_0xb4a365['options']?_0xb4a365['options']['where']||null:null,'attributes':[[_0xbe5f('0x2c'),_0xbe5f('0x2d')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xbe5f('0x1d')]['literal'](_0xbe5f('0x2e')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0xbe5f('0x1e'),db[_0xbe5f('0x1d')]['fn']('IF',db[_0xbe5f('0x1d')][_0xbe5f('0x21')]('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0xbe5f('0x1e'),db[_0xbe5f('0x1d')]['fn']('IF',db[_0xbe5f('0x1d')][_0xbe5f('0x21')](_0xbe5f('0x22')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0xbe5f('0x1e'),db[_0xbe5f('0x1d')]['fn']('IF',db[_0xbe5f('0x1d')][_0xbe5f('0x21')](_0xbe5f('0x2f')))),_0xbe5f('0x30')],[db[_0xbe5f('0x1d')]['fn'](_0xbe5f('0x1e'),db[_0xbe5f('0x1d')]['fn']('IF',db[_0xbe5f('0x1d')]['literal'](_0xbe5f('0x31')))),_0xbe5f('0x32')],[db[_0xbe5f('0x1d')]['fn'](_0xbe5f('0x1e'),db[_0xbe5f('0x1d')]['fn']('IF',db[_0xbe5f('0x1d')][_0xbe5f('0x21')](_0xbe5f('0x33')))),'outboundDropCallsDayTimeout'],[db[_0xbe5f('0x1d')]['fn']('COUNT',db[_0xbe5f('0x1d')]['fn']('IF',db[_0xbe5f('0x1d')][_0xbe5f('0x21')](_0xbe5f('0x34')))),_0xbe5f('0x35')],[db['sequelize']['fn'](_0xbe5f('0x1e'),db[_0xbe5f('0x1d')]['fn']('IF',db['sequelize'][_0xbe5f('0x21')](_0xbe5f('0x36')))),_0xbe5f('0x37')],[db['sequelize']['fn']('COUNT',db[_0xbe5f('0x1d')]['fn']('IF',db[_0xbe5f('0x1d')][_0xbe5f('0x21')](_0xbe5f('0x38')))),_0xbe5f('0x39')],[db[_0xbe5f('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xbe5f('0x1d')][_0xbe5f('0x21')]('`state`\x20=\x2014,\x201,\x20null'))),_0xbe5f('0x3a')],[db[_0xbe5f('0x1d')]['fn'](_0xbe5f('0x1e'),db[_0xbe5f('0x1d')]['fn']('IF',db['sequelize'][_0xbe5f('0x21')](_0xbe5f('0x3b')))),_0xbe5f('0x3c')],[db[_0xbe5f('0x1d')]['fn'](_0xbe5f('0x1e'),db[_0xbe5f('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xbe5f('0x3d')))),_0xbe5f('0x3e')],[db[_0xbe5f('0x1d')]['fn'](_0xbe5f('0x1e'),db[_0xbe5f('0x1d')]['fn']('IF',db[_0xbe5f('0x1d')][_0xbe5f('0x21')](_0xbe5f('0x3f')))),_0xbe5f('0x3c')],[db[_0xbe5f('0x1d')]['fn']('COUNT',db[_0xbe5f('0x1d')]['fn']('IF',db[_0xbe5f('0x1d')][_0xbe5f('0x21')](_0xbe5f('0x40')))),_0xbe5f('0x41')]],'group':[_0xbe5f('0x2c')]})['then'](function(_0x3aefce){logger[_0xbe5f('0xc')](_0xbe5f('0x2b'),_0xb4a365);logger[_0xbe5f('0xf')](_0xbe5f('0x2b'),_0xb4a365,JSON[_0xbe5f('0x11')](_0x3aefce));_0x282259(_0x3aefce);})[_0xbe5f('0x16')](function(_0x346a55){logger[_0xbe5f('0x12')](_0xbe5f('0x2b'),_0x346a55[_0xbe5f('0x14')],_0xb4a365);_0x4be02c(_0x34e2f5[_0xbe5f('0x12')](0x1f4,_0x346a55[_0xbe5f('0x14')]));});});};exports[_0xbe5f('0x42')]=function(_0x451e18){var _0x3bb2a5=this;return new Promise(function(_0x300520,_0x275f67){return db[_0xbe5f('0x1b')][_0xbe5f('0x1c')]({'raw':_0x451e18[_0xbe5f('0x17')]?_0x451e18[_0xbe5f('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x451e18[_0xbe5f('0x17')]?_0x451e18[_0xbe5f('0x17')][_0xbe5f('0x43')]||null:null,'attributes':[[_0xbe5f('0x2c'),'name'],[db[_0xbe5f('0x1d')]['fn'](_0xbe5f('0x1e'),db[_0xbe5f('0x1d')][_0xbe5f('0x1f')]('id')),_0xbe5f('0x44')],[db[_0xbe5f('0x1d')]['fn'](_0xbe5f('0x1e'),db[_0xbe5f('0x1d')]['fn']('IF',db[_0xbe5f('0x1d')]['literal'](_0xbe5f('0x22')))),_0xbe5f('0x45')]],'group':[_0xbe5f('0x2c')]})[_0xbe5f('0xb')](function(_0x290d81){logger[_0xbe5f('0xc')]('GetCampaignHopperHistory',_0x451e18);logger[_0xbe5f('0xf')](_0xbe5f('0x42'),_0x451e18,JSON[_0xbe5f('0x11')](_0x290d81));_0x300520(_0x290d81);})[_0xbe5f('0x16')](function(_0x2a6be1){logger[_0xbe5f('0x12')]('GetCampaignHopperHistory',_0x2a6be1['message'],_0x451e18);_0x275f67(_0x3bb2a5[_0xbe5f('0x12')](0x1f4,_0x2a6be1[_0xbe5f('0x14')]));});});}; \ No newline at end of file +var _0x47b4=['outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CmHopperHistory','create','body','options','raw','CreateCmHopperHistory','AvgHandleTime','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2016,\x201,\x20null'];(function(_0x2298cb,_0x37cfdf){var _0x345f48=function(_0x3b5799){while(--_0x3b5799){_0x2298cb['push'](_0x2298cb['shift']());}};_0x345f48(++_0x37cfdf);}(_0x47b4,0x1e2));var _0x447b=function(_0x328f58,_0xd55bb2){_0x328f58=_0x328f58-0x0;var _0x3bfdb8=_0x47b4[_0x328f58];return _0x3bfdb8;};'use strict';var _=require(_0x447b('0x0'));var util=require('util');var moment=require(_0x447b('0x1'));var BPromise=require(_0x447b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x447b('0x3'));var db=require(_0x447b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x447b('0x5'))(_0x447b('0x6'));var config=require(_0x447b('0x7'));var jayson=require(_0x447b('0x8'));var client=jayson[_0x447b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b8acc,_0x3e9339,_0x5c235f){return new BPromise(function(_0x38892e,_0x1e70dc){return client[_0x447b('0xa')](_0x5b8acc,_0x5c235f)[_0x447b('0xb')](function(_0x556b5d){logger[_0x447b('0xc')](_0x447b('0xd'),_0x3e9339,_0x447b('0xe'));logger[_0x447b('0xf')](_0x447b('0x10'),_0x3e9339,_0x447b('0xe'),JSON[_0x447b('0x11')](_0x556b5d));if(_0x556b5d[_0x447b('0x12')]){if(_0x556b5d[_0x447b('0x12')][_0x447b('0x13')]===0x1f4){logger[_0x447b('0x12')](_0x447b('0xd'),_0x3e9339,_0x556b5d[_0x447b('0x12')][_0x447b('0x14')]);return _0x1e70dc(_0x556b5d[_0x447b('0x12')][_0x447b('0x14')]);}logger[_0x447b('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x3e9339,_0x556b5d[_0x447b('0x12')]['message']);return _0x38892e(_0x556b5d['error'][_0x447b('0x14')]);}else{logger[_0x447b('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x3e9339,'request\x20sent');_0x38892e(_0x556b5d['result'][_0x447b('0x14')]);}})[_0x447b('0x15')](function(_0x5b08df){logger[_0x447b('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x3e9339,_0x5b08df);_0x1e70dc(_0x5b08df);});});}exports['CreateCmHopperHistory']=function(_0x508317){var _0xe68873=this;return new Promise(function(_0x2e0819,_0x25a8da){return db[_0x447b('0x16')][_0x447b('0x17')](_0x508317[_0x447b('0x18')],{'raw':_0x508317['options']?_0x508317[_0x447b('0x19')][_0x447b('0x1a')]===undefined?!![]:![]:!![]})[_0x447b('0xb')](function(_0x4be6ac){logger[_0x447b('0xc')](_0x447b('0x1b'),_0x508317);logger[_0x447b('0xf')]('CreateCmHopperHistory',_0x508317,JSON['stringify'](_0x4be6ac));_0x2e0819(_0x4be6ac);})[_0x447b('0x15')](function(_0x2d3811){logger[_0x447b('0x12')]('CreateCmHopperHistory',_0x2d3811[_0x447b('0x14')],_0x508317);_0x25a8da(_0xe68873['error'](0x1f4,_0x2d3811[_0x447b('0x14')]));});});};exports[_0x447b('0x1c')]=function(_0x3d0ed9){var _0x4709bf=this;return new Promise(function(_0x43447e,_0x726693){return db[_0x447b('0x16')][_0x447b('0x1d')]({'raw':_0x3d0ed9['options']?_0x3d0ed9[_0x447b('0x19')][_0x447b('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d0ed9['options']?_0x3d0ed9[_0x447b('0x19')][_0x447b('0x1e')]||null:null,'attributes':[[db[_0x447b('0x1f')]['fn']('COUNT',db[_0x447b('0x1f')][_0x447b('0x20')]('id')),_0x447b('0x21')],[db[_0x447b('0x1f')]['fn'](_0x447b('0x22'),db[_0x447b('0x1f')]['fn']('IF',db[_0x447b('0x1f')]['literal'](_0x447b('0x23')))),_0x447b('0x24')],[db[_0x447b('0x1f')]['fn'](_0x447b('0x22'),db['sequelize']['fn']('IF',db[_0x447b('0x1f')][_0x447b('0x25')](_0x447b('0x26')))),_0x447b('0x27')],[db['sequelize']['fn'](_0x447b('0x22'),db[_0x447b('0x1f')]['fn']('IF',db['sequelize'][_0x447b('0x25')](_0x447b('0x28')))),_0x447b('0x29')],[db[_0x447b('0x1f')]['fn'](_0x447b('0x2a'),db[_0x447b('0x1f')]['fn']('IF',db[_0x447b('0x1f')][_0x447b('0x25')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn'](_0x447b('0x2a'),db[_0x447b('0x1f')]['fn']('IF',db[_0x447b('0x1f')][_0x447b('0x25')](_0x447b('0x2b')))),_0x447b('0x2c')]]})[_0x447b('0xb')](function(_0x764fcd){logger[_0x447b('0xc')](_0x447b('0x1c'),_0x3d0ed9);logger[_0x447b('0xf')](_0x447b('0x1c'),_0x3d0ed9,JSON[_0x447b('0x11')](_0x764fcd));_0x43447e(_0x764fcd);})[_0x447b('0x15')](function(_0x41de5d){logger[_0x447b('0x12')](_0x447b('0x1c'),_0x41de5d[_0x447b('0x14')],_0x3d0ed9);_0x726693(_0x4709bf[_0x447b('0x12')](0x1f4,_0x41de5d[_0x447b('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x4653b9){var _0x413fb8=this;return new Promise(function(_0x2c517c,_0x5a63a7){return db['CmHopperHistory'][_0x447b('0x1d')]({'raw':_0x4653b9['options']?_0x4653b9[_0x447b('0x19')][_0x447b('0x1a')]===undefined?!![]:![]:!![],'where':_0x4653b9[_0x447b('0x19')]?_0x4653b9[_0x447b('0x19')]['where']||null:null,'attributes':[[_0x447b('0x2d'),_0x447b('0x2e')],[db[_0x447b('0x1f')]['fn'](_0x447b('0x22'),db['sequelize']['fn']('IF',db[_0x447b('0x1f')][_0x447b('0x25')](_0x447b('0x2f')))),_0x447b('0x30')],[db[_0x447b('0x1f')]['fn'](_0x447b('0x22'),db[_0x447b('0x1f')]['fn']('IF',db[_0x447b('0x1f')][_0x447b('0x25')]('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db[_0x447b('0x1f')]['fn'](_0x447b('0x22'),db[_0x447b('0x1f')]['fn']('IF',db[_0x447b('0x1f')][_0x447b('0x25')]('`state`\x20=\x204,\x201,\x20null'))),_0x447b('0x31')],[db[_0x447b('0x1f')]['fn'](_0x447b('0x22'),db[_0x447b('0x1f')]['fn']('IF',db['sequelize'][_0x447b('0x25')](_0x447b('0x32')))),_0x447b('0x33')],[db['sequelize']['fn']('COUNT',db[_0x447b('0x1f')]['fn']('IF',db[_0x447b('0x1f')][_0x447b('0x25')]('`state`\x20=\x208,\x201,\x20null'))),_0x447b('0x34')],[db[_0x447b('0x1f')]['fn']('COUNT',db[_0x447b('0x1f')]['fn']('IF',db[_0x447b('0x1f')]['literal'](_0x447b('0x35')))),_0x447b('0x36')],[db['sequelize']['fn'](_0x447b('0x22'),db[_0x447b('0x1f')]['fn']('IF',db[_0x447b('0x1f')]['literal'](_0x447b('0x37')))),_0x447b('0x38')],[db[_0x447b('0x1f')]['fn'](_0x447b('0x22'),db[_0x447b('0x1f')]['fn']('IF',db[_0x447b('0x1f')][_0x447b('0x25')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db[_0x447b('0x1f')]['fn'](_0x447b('0x22'),db[_0x447b('0x1f')]['fn']('IF',db[_0x447b('0x1f')][_0x447b('0x25')](_0x447b('0x39')))),_0x447b('0x3a')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x447b('0x1f')][_0x447b('0x25')](_0x447b('0x3b')))),_0x447b('0x3c')],[db[_0x447b('0x1f')]['fn'](_0x447b('0x22'),db['sequelize']['fn']('IF',db[_0x447b('0x1f')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x447b('0x1f')]['fn'](_0x447b('0x22'),db[_0x447b('0x1f')]['fn']('IF',db['sequelize'][_0x447b('0x25')](_0x447b('0x3d')))),_0x447b('0x3e')],[db[_0x447b('0x1f')]['fn'](_0x447b('0x22'),db[_0x447b('0x1f')]['fn']('IF',db[_0x447b('0x1f')][_0x447b('0x25')](_0x447b('0x3f')))),_0x447b('0x40')],[db[_0x447b('0x1f')]['fn'](_0x447b('0x22'),db[_0x447b('0x1f')]['fn']('IF',db['sequelize'][_0x447b('0x25')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x447b('0x41')]],'group':[_0x447b('0x2d')]})[_0x447b('0xb')](function(_0x49784e){logger[_0x447b('0xc')](_0x447b('0x42'),_0x4653b9);logger[_0x447b('0xf')]('GetVoiceQueueHopperHistory',_0x4653b9,JSON[_0x447b('0x11')](_0x49784e));_0x2c517c(_0x49784e);})[_0x447b('0x15')](function(_0x4b19ca){logger[_0x447b('0x12')](_0x447b('0x42'),_0x4b19ca['message'],_0x4653b9);_0x5a63a7(_0x413fb8[_0x447b('0x12')](0x1f4,_0x4b19ca[_0x447b('0x14')]));});});};exports[_0x447b('0x43')]=function(_0x2a6b68){var _0x2d8271=this;return new Promise(function(_0xc92636,_0x42bcf0){return db[_0x447b('0x16')][_0x447b('0x1d')]({'raw':_0x2a6b68['options']?_0x2a6b68[_0x447b('0x19')][_0x447b('0x1a')]===undefined?!![]:![]:!![],'where':_0x2a6b68[_0x447b('0x19')]?_0x2a6b68[_0x447b('0x19')]['where']||null:null,'attributes':[[_0x447b('0x2d'),_0x447b('0x2e')],[db[_0x447b('0x1f')]['fn']('COUNT',db[_0x447b('0x1f')]['col']('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x447b('0x22'),db[_0x447b('0x1f')]['fn']('IF',db[_0x447b('0x1f')][_0x447b('0x25')](_0x447b('0x23')))),'ivrAnswerCallsDay']],'group':[_0x447b('0x2d')]})[_0x447b('0xb')](function(_0x5084f3){logger['info'](_0x447b('0x43'),_0x2a6b68);logger[_0x447b('0xf')](_0x447b('0x43'),_0x2a6b68,JSON[_0x447b('0x11')](_0x5084f3));_0xc92636(_0x5084f3);})[_0x447b('0x15')](function(_0x1ea4eb){logger[_0x447b('0x12')](_0x447b('0x43'),_0x1ea4eb[_0x447b('0x14')],_0x2a6b68);_0x42bcf0(_0x2d8271[_0x447b('0x12')](0x1f4,_0x1ea4eb[_0x447b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 6226c47..1ad4dc2 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 _0x5f6f=['../../components/interaction/service','./cmHopperHistory.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x4ada84,_0x177d46){var _0x49a92e=function(_0x348b49){while(--_0x348b49){_0x4ada84['push'](_0x4ada84['shift']());}};_0x49a92e(++_0x177d46);}(_0x5f6f,0x1c6));var _0xf5f6=function(_0x4a23a9,_0x17a2c0){_0x4a23a9=_0x4a23a9-0x0;var _0x18c27f=_0x5f6f[_0x4a23a9];return _0x18c27f;};'use strict';var multer=require('multer');var util=require(_0xf5f6('0x0'));var path=require(_0xf5f6('0x1'));var timeout=require(_0xf5f6('0x2'));var express=require(_0xf5f6('0x3'));var router=express['Router']();var fs_extra=require(_0xf5f6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf5f6('0x5'));var config=require('../../config/environment');var controller=require(_0xf5f6('0x6'));router['get']('/',auth[_0xf5f6('0x7')](),controller[_0xf5f6('0x8')]);router[_0xf5f6('0x9')]('/describe',auth[_0xf5f6('0x7')](),controller['describe']);router[_0xf5f6('0x9')](_0xf5f6('0xa'),auth[_0xf5f6('0x7')](),controller[_0xf5f6('0xb')]);router[_0xf5f6('0xc')]('/',auth[_0xf5f6('0x7')](),controller[_0xf5f6('0xd')]);router[_0xf5f6('0xe')](_0xf5f6('0xa'),auth[_0xf5f6('0x7')](),controller[_0xf5f6('0xf')]);module[_0xf5f6('0x10')]=router; \ No newline at end of file +var _0x44d4=['describe','/:id','show','post','create','put','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe'];(function(_0x5b3d17,_0x38d256){var _0x2bbc83=function(_0xf8e85a){while(--_0xf8e85a){_0x5b3d17['push'](_0x5b3d17['shift']());}};_0x2bbc83(++_0x38d256);}(_0x44d4,0xf1));var _0x444d=function(_0x47feb6,_0x246208){_0x47feb6=_0x47feb6-0x0;var _0x4c9734=_0x44d4[_0x47feb6];return _0x4c9734;};'use strict';var multer=require(_0x444d('0x0'));var util=require(_0x444d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x444d('0x2'));var router=express[_0x444d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x444d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x444d('0x5'));var controller=require(_0x444d('0x6'));router[_0x444d('0x7')]('/',auth[_0x444d('0x8')](),controller[_0x444d('0x9')]);router[_0x444d('0x7')](_0x444d('0xa'),auth[_0x444d('0x8')](),controller[_0x444d('0xb')]);router['get'](_0x444d('0xc'),auth[_0x444d('0x8')](),controller[_0x444d('0xd')]);router[_0x444d('0xe')]('/',auth[_0x444d('0x8')](),controller[_0x444d('0xf')]);router[_0x444d('0x10')](_0x444d('0xc'),auth[_0x444d('0x8')](),controller['update']);module[_0x444d('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index a5ed51c..dfeeaec 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 _0xd6d6=['STRING','name','sequelize','exports'];(function(_0xc73714,_0x2d020c){var _0xd542d9=function(_0x370cfc){while(--_0x370cfc){_0xc73714['push'](_0xc73714['shift']());}};_0xd542d9(++_0x2d020c);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x489031,_0x5f3d3c){_0x489031=_0x489031-0x0;var _0x82d61b=_0xd6d6[_0x489031];return _0x82d61b;};'use strict';var Sequelize=require(_0x6d6d('0x0'));module[_0x6d6d('0x1')]={'name':{'type':Sequelize[_0x6d6d('0x2')],'unique':_0x6d6d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x6d6d('0x2')]}}; \ No newline at end of file +var _0x3fc6=['sequelize','exports','STRING'];(function(_0x3ab5bd,_0x56fbcf){var _0xe4109d=function(_0x36418b){while(--_0x36418b){_0x3ab5bd['push'](_0x3ab5bd['shift']());}};_0xe4109d(++_0x56fbcf);}(_0x3fc6,0x159));var _0x63fc=function(_0x26210c,_0x2b537f){_0x26210c=_0x26210c-0x0;var _0x5d631e=_0x3fc6[_0x26210c];return _0x5d631e;};'use strict';var Sequelize=require(_0x63fc('0x0'));module[_0x63fc('0x1')]={'name':{'type':Sequelize[_0x63fc('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x63fc('0x2')]},'dialPrefix':{'type':Sequelize[_0x63fc('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 73d5301..e766eaa 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 _0x70b1=['raw','getContactsCsv','CustomFields','format','isEmpty','setHeader','attachment;\x20filename=','list_%d_%s.csv','text/csv','/tmp/list_%d_%s.csv','sendStatus','addCustomField','transaction','addCustomFields','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cf_%s','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./cmList.socket','register','status','end','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','index','map','CmList','rawAttributes','type','key','name','query','filters','model','attributes','length','hasOwnProperty','limit','order','sort','where','options','includeAll','rows','catch','show','params','keys','intersection','fields','include','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','nolimit','filter','findAll','removeDispositions','ids','CmContact','tags','isArray','join','each','success','push','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','cf_%d','pick'];(function(_0x4c25cb,_0xce5c6c){var _0x5a61f2=function(_0x5ad642){while(--_0x5ad642){_0x4c25cb['push'](_0x4c25cb['shift']());}};_0x5a61f2(++_0xce5c6c);}(_0x70b1,0x140));var _0x170b=function(_0x2ad31f,_0x49cfb1){_0x2ad31f=_0x2ad31f-0x0;var _0x525da5=_0x70b1[_0x2ad31f];return _0x525da5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x170b('0x0'));var jsonpatch=require(_0x170b('0x1'));var rp=require(_0x170b('0x2'));var moment=require(_0x170b('0x3'));var BPromise=require(_0x170b('0x4'));var Mustache=require(_0x170b('0x5'));var util=require(_0x170b('0x6'));var path=require(_0x170b('0x7'));var sox=require(_0x170b('0x8'));var csv=require(_0x170b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x170b('0xa'));var _=require(_0x170b('0xb'));var squel=require(_0x170b('0xc'));var crypto=require(_0x170b('0xd'));var jsforce=require(_0x170b('0xe'));var deskjs=require(_0x170b('0xf'));var toCsv=require(_0x170b('0x9'));var querystring=require('querystring');var Papa=require(_0x170b('0x10'));var Redis=require('ioredis');var authService=require(_0x170b('0x11'));var qs=require(_0x170b('0x12'));var as=require(_0x170b('0x13'));var hardwareService=require(_0x170b('0x14'));var logger=require(_0x170b('0x15'))(_0x170b('0x16'));var utils=require(_0x170b('0x17'));var config=require(_0x170b('0x18'));var licenseUtil=require(_0x170b('0x19'));var db=require(_0x170b('0x1a'))['db'];config[_0x170b('0x1b')]=_['defaults'](config[_0x170b('0x1b')],{'host':_0x170b('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x170b('0x1b')]));require(_0x170b('0x1d'))[_0x170b('0x1e')](socket);function respondWithStatusCode(_0x57050e,_0x5eace1){_0x5eace1=_0x5eace1||0xcc;return function(_0x1e7e70){if(_0x1e7e70){return _0x57050e['sendStatus'](_0x5eace1);}return _0x57050e[_0x170b('0x1f')](_0x5eace1)[_0x170b('0x20')]();};}function respondWithResult(_0x472960,_0x99b67){_0x99b67=_0x99b67||0xc8;return function(_0x6068b9){if(_0x6068b9){return _0x472960[_0x170b('0x1f')](_0x99b67)['json'](_0x6068b9);}};}function respondWithFilteredResult(_0x47878f,_0x426b1d){return function(_0x197c3e){if(_0x197c3e){var _0x53da74=typeof _0x426b1d['offset']===_0x170b('0x21')&&typeof _0x426b1d['limit']===_0x170b('0x21');var _0x55e16c=_0x197c3e[_0x170b('0x22')];var _0x2b4114=_0x53da74?0x0:_0x426b1d[_0x170b('0x23')];var _0x51a433=_0x53da74?_0x197c3e[_0x170b('0x22')]:_0x426b1d[_0x170b('0x23')]+_0x426b1d['limit'];var _0x2b3114;if(_0x51a433>=_0x55e16c){_0x51a433=_0x55e16c;_0x2b3114=0xc8;}else{_0x2b3114=0xce;}_0x47878f[_0x170b('0x1f')](_0x2b3114);return _0x47878f[_0x170b('0x24')](_0x170b('0x25'),_0x2b4114+'-'+_0x51a433+'/'+_0x55e16c)[_0x170b('0x26')](_0x197c3e);}return null;};}function patchUpdates(_0x33ae50){return function(_0x4a1fad){try{jsonpatch[_0x170b('0x27')](_0x4a1fad,_0x33ae50,!![]);}catch(_0x537005){return BPromise[_0x170b('0x28')](_0x537005);}return _0x4a1fad[_0x170b('0x29')]();};}function saveUpdates(_0x5ce434,_0xd18536){return function(_0x4a3ee2){if(_0x4a3ee2){return _0x4a3ee2[_0x170b('0x2a')](_0x5ce434)[_0x170b('0x2b')](function(_0x2e2f99){return _0x2e2f99;});}return null;};}function removeEntity(_0x4f319c,_0x4d9c08){return function(_0xb5a2cf){if(_0xb5a2cf){return _0xb5a2cf[_0x170b('0x2c')]()[_0x170b('0x2b')](function(){var _0x257e16=_0xb5a2cf[_0x170b('0x2d')]({'plain':!![]});var _0x1490e0='Lists';return db[_0x170b('0x2e')][_0x170b('0x2c')]({'where':{'type':_0x1490e0,'resourceId':_0x257e16['id']}})[_0x170b('0x2b')](function(){return _0xb5a2cf;});})[_0x170b('0x2b')](function(){_0x4f319c['status'](0xcc)[_0x170b('0x20')]();});}};}function handleEntityNotFound(_0x2a2020,_0x9fc34e){return function(_0x570939){if(!_0x570939){_0x2a2020['sendStatus'](0x194);}return _0x570939;};}function handleError(_0x11fae1,_0x2a8493){_0x2a8493=_0x2a8493||0x1f4;return function(_0x8fb5a4){logger['error'](_0x8fb5a4['stack']);if(_0x8fb5a4['name']){delete _0x8fb5a4['name'];}_0x11fae1['status'](_0x2a8493)['send'](_0x8fb5a4);};}exports[_0x170b('0x2f')]=function(_0x140a6b,_0x935ade){var _0x2fe405={},_0x5ea978={},_0x11a125={'count':0x0,'rows':[]};var _0x3b4b2d=_[_0x170b('0x30')](db[_0x170b('0x31')][_0x170b('0x32')],function(_0xb8ea7c){return{'name':_0xb8ea7c['fieldName'],'type':_0xb8ea7c[_0x170b('0x33')][_0x170b('0x34')]};});_0x5ea978['model']=_[_0x170b('0x30')](_0x3b4b2d,_0x170b('0x35'));_0x5ea978[_0x170b('0x36')]=_['keys'](_0x140a6b[_0x170b('0x36')]);_0x5ea978[_0x170b('0x37')]=_['intersection'](_0x5ea978['model'],_0x5ea978[_0x170b('0x36')]);_0x2fe405['attributes']=_['intersection'](_0x5ea978[_0x170b('0x38')],qs['fields'](_0x140a6b[_0x170b('0x36')]['fields']));_0x2fe405['attributes']=_0x2fe405[_0x170b('0x39')][_0x170b('0x3a')]?_0x2fe405['attributes']:_0x5ea978[_0x170b('0x38')];if(!_0x140a6b['query'][_0x170b('0x3b')]('nolimit')){_0x2fe405[_0x170b('0x3c')]=qs[_0x170b('0x3c')](_0x140a6b[_0x170b('0x36')][_0x170b('0x3c')]);_0x2fe405[_0x170b('0x23')]=qs[_0x170b('0x23')](_0x140a6b[_0x170b('0x36')][_0x170b('0x23')]);}_0x2fe405[_0x170b('0x3d')]=qs[_0x170b('0x3e')](_0x140a6b[_0x170b('0x36')][_0x170b('0x3e')]);_0x2fe405[_0x170b('0x3f')]=qs[_0x170b('0x37')](_['pick'](_0x140a6b[_0x170b('0x36')],_0x5ea978['filters']),_0x3b4b2d);if(_0x140a6b[_0x170b('0x36')]['filter']){_0x2fe405[_0x170b('0x3f')]=_['merge'](_0x2fe405[_0x170b('0x3f')],{'$or':_[_0x170b('0x30')](_0x3b4b2d,function(_0x3da732){if(_0x3da732[_0x170b('0x33')]!=='VIRTUAL'){var _0x25d902={};_0x25d902[_0x3da732['name']]={'$like':'%'+_0x140a6b[_0x170b('0x36')]['filter']+'%'};return _0x25d902;}})});}_0x2fe405=_['merge']({},_0x2fe405,_0x140a6b[_0x170b('0x40')]);var _0x2d548a={'where':_0x2fe405[_0x170b('0x3f')]};return db[_0x170b('0x31')][_0x170b('0x22')](_0x2d548a)[_0x170b('0x2b')](function(_0x1cbb41){_0x11a125[_0x170b('0x22')]=_0x1cbb41;if(_0x140a6b['query'][_0x170b('0x41')]){_0x2fe405['include']=[{'all':!![]}];}return db[_0x170b('0x31')]['findAll'](_0x2fe405);})[_0x170b('0x2b')](function(_0x47680e){_0x11a125[_0x170b('0x42')]=_0x47680e;return _0x11a125;})[_0x170b('0x2b')](respondWithFilteredResult(_0x935ade,_0x2fe405))[_0x170b('0x43')](handleError(_0x935ade,null));};exports[_0x170b('0x44')]=function(_0x44a59f,_0x562234){var _0x2212d0={'raw':![],'where':{'id':_0x44a59f[_0x170b('0x45')]['id']}},_0x4013e7={};_0x4013e7[_0x170b('0x38')]=_['keys'](db[_0x170b('0x31')][_0x170b('0x32')]);_0x4013e7['query']=_[_0x170b('0x46')](_0x44a59f[_0x170b('0x36')]);_0x4013e7[_0x170b('0x37')]=_[_0x170b('0x47')](_0x4013e7[_0x170b('0x38')],_0x4013e7[_0x170b('0x36')]);_0x2212d0[_0x170b('0x39')]=_[_0x170b('0x47')](_0x4013e7[_0x170b('0x38')],qs['fields'](_0x44a59f[_0x170b('0x36')][_0x170b('0x48')]));_0x2212d0[_0x170b('0x39')]=_0x2212d0['attributes'][_0x170b('0x3a')]?_0x2212d0[_0x170b('0x39')]:_0x4013e7[_0x170b('0x38')];if(_0x44a59f[_0x170b('0x36')]['includeAll']){_0x2212d0[_0x170b('0x49')]=[{'all':!![]}];}_0x2212d0=_[_0x170b('0x4a')]({},_0x2212d0,_0x44a59f[_0x170b('0x40')]);return db[_0x170b('0x31')][_0x170b('0x4b')](_0x2212d0)[_0x170b('0x2b')](handleEntityNotFound(_0x562234,null))[_0x170b('0x2b')](respondWithResult(_0x562234,null))[_0x170b('0x43')](handleError(_0x562234,null));};exports[_0x170b('0x4c')]=function(_0x5778af,_0x228362){return db[_0x170b('0x31')][_0x170b('0x4c')](_0x5778af[_0x170b('0x4d')],{})['then'](function(_0x311f4e){var _0x42da9a=_0x5778af[_0x170b('0x4e')][_0x170b('0x2d')]({'plain':!![]});if(!_0x42da9a)throw new Error(_0x170b('0x4f'));if(_0x42da9a[_0x170b('0x50')]===_0x170b('0x4e')){var _0x46c8c3=_0x311f4e['get']({'plain':!![]});var _0x1098fb=_0x170b('0x51');return db[_0x170b('0x52')][_0x170b('0x4b')]({'where':{'name':_0x1098fb,'userProfileId':_0x42da9a['userProfileId']},'raw':!![]})[_0x170b('0x2b')](function(_0xa2fb8b){if(_0xa2fb8b&&_0xa2fb8b[_0x170b('0x53')]===0x0){return db[_0x170b('0x2e')][_0x170b('0x4c')]({'name':_0x46c8c3['name'],'resourceId':_0x46c8c3['id'],'type':_0xa2fb8b[_0x170b('0x35')],'sectionId':_0xa2fb8b['id']},{})[_0x170b('0x2b')](function(){return _0x311f4e;});}else{return _0x311f4e;}})[_0x170b('0x43')](function(_0x40313a){logger[_0x170b('0x54')](_0x170b('0x55'),_0x40313a);throw _0x40313a;});}return _0x311f4e;})[_0x170b('0x2b')](respondWithResult(_0x228362,0xc9))[_0x170b('0x43')](handleError(_0x228362,null));};exports[_0x170b('0x2a')]=function(_0x49d104,_0x3cb859){if(_0x49d104['body']['id']){delete _0x49d104[_0x170b('0x4d')]['id'];}return db[_0x170b('0x31')][_0x170b('0x4b')]({'where':{'id':_0x49d104['params']['id']}})['then'](handleEntityNotFound(_0x3cb859,null))[_0x170b('0x2b')](saveUpdates(_0x49d104[_0x170b('0x4d')],null))['then'](respondWithResult(_0x3cb859,null))[_0x170b('0x43')](handleError(_0x3cb859,null));};exports['destroy']=function(_0x449a28,_0x6e668a){return db[_0x170b('0x31')][_0x170b('0x4b')]({'where':{'id':_0x449a28[_0x170b('0x45')]['id']}})[_0x170b('0x2b')](handleEntityNotFound(_0x6e668a,null))[_0x170b('0x2b')](removeEntity(_0x6e668a,null))[_0x170b('0x43')](handleError(_0x6e668a,null));};exports[_0x170b('0x56')]=function(_0x3af196,_0x5a0dc3){return db['CmList']['describe']()[_0x170b('0x2b')](respondWithResult(_0x5a0dc3,null))['catch'](handleError(_0x5a0dc3,null));};exports[_0x170b('0x57')]=function(_0x4169e3,_0x1ced62,_0x432b2e){if(_0x4169e3[_0x170b('0x4d')]['id']){delete _0x4169e3['body']['id'];}return db['CmList'][_0x170b('0x4b')]({'where':{'id':_0x4169e3[_0x170b('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ced62,null))[_0x170b('0x2b')](function(_0x50d02b){if(_0x50d02b){_0x4169e3['body'][_0x170b('0x58')]=_0x50d02b['id'];return db[_0x170b('0x59')][_0x170b('0x4c')](_0x4169e3[_0x170b('0x4d')]);}})['then'](respondWithResult(_0x1ced62,null))[_0x170b('0x43')](handleError(_0x1ced62,null));};exports[_0x170b('0x5a')]=function(_0x3f43a8,_0x306e6c,_0x49bca0){var _0xb02cf6={'raw':![],'where':{}};var _0x4ba6c7={};var _0x4e60f8={'count':0x0,'rows':[]};return db[_0x170b('0x31')][_0x170b('0x5b')]({'where':{'id':_0x3f43a8[_0x170b('0x45')]['id']}})[_0x170b('0x2b')](handleEntityNotFound(_0x306e6c,null))[_0x170b('0x2b')](function(_0x2e74cc){if(_0x2e74cc){_0x4ba6c7[_0x170b('0x38')]=_[_0x170b('0x46')](db[_0x170b('0x59')]['rawAttributes']);_0x4ba6c7[_0x170b('0x36')]=_['keys'](_0x3f43a8[_0x170b('0x36')]);_0x4ba6c7[_0x170b('0x37')]=_['intersection'](_0x4ba6c7[_0x170b('0x38')],_0x4ba6c7[_0x170b('0x36')]);_0xb02cf6['attributes']=_[_0x170b('0x47')](_0x4ba6c7['model'],qs[_0x170b('0x48')](_0x3f43a8[_0x170b('0x36')][_0x170b('0x48')]));_0xb02cf6['attributes']=_0xb02cf6[_0x170b('0x39')][_0x170b('0x3a')]?_0xb02cf6['attributes']:_0x4ba6c7[_0x170b('0x38')];if(!_0x3f43a8['query'][_0x170b('0x3b')](_0x170b('0x5c'))){_0xb02cf6[_0x170b('0x3c')]=qs['limit'](_0x3f43a8[_0x170b('0x36')]['limit']);_0xb02cf6[_0x170b('0x23')]=qs[_0x170b('0x23')](_0x3f43a8[_0x170b('0x36')][_0x170b('0x23')]);}_0xb02cf6[_0x170b('0x3d')]=qs[_0x170b('0x3e')](_0x3f43a8[_0x170b('0x36')][_0x170b('0x3e')]);_0xb02cf6[_0x170b('0x3f')]=qs[_0x170b('0x37')](_['pick'](_0x3f43a8[_0x170b('0x36')],_0x4ba6c7['filters']));_0xb02cf6[_0x170b('0x3f')]['ListId']=_0x2e74cc['id'];if(_0x3f43a8[_0x170b('0x36')][_0x170b('0x5d')]){_0xb02cf6['where']=_['merge'](_0xb02cf6['where'],{'$or':_['map'](_0xb02cf6['attributes'],function(_0x23ca1c){var _0x49fbc0={};_0x49fbc0[_0x23ca1c]={'$like':'%'+_0x3f43a8['query'][_0x170b('0x5d')]+'%'};return _0x49fbc0;})});}_0xb02cf6=_[_0x170b('0x4a')]({},_0xb02cf6,_0x3f43a8[_0x170b('0x40')]);return db[_0x170b('0x59')][_0x170b('0x22')]({'where':_0xb02cf6['where']})['then'](function(_0x22a5cc){_0x4e60f8[_0x170b('0x22')]=_0x22a5cc;if(_0x3f43a8[_0x170b('0x36')][_0x170b('0x41')]){_0xb02cf6['include']=[{'all':!![]}];}return db[_0x170b('0x59')][_0x170b('0x5e')](_0xb02cf6);})[_0x170b('0x2b')](function(_0x521e70){_0x4e60f8[_0x170b('0x42')]=_0x521e70;return _0x4e60f8;});}})[_0x170b('0x2b')](respondWithFilteredResult(_0x306e6c,_0xb02cf6))[_0x170b('0x43')](handleError(_0x306e6c,null));};exports['removeDispositions']=function(_0xecf5b8,_0x86d8cc,_0x365aef){return db[_0x170b('0x31')][_0x170b('0x4b')]({'where':{'id':_0xecf5b8[_0x170b('0x45')]['id']}})['then'](handleEntityNotFound(_0x86d8cc,null))['then'](function(_0x27d940){if(_0x27d940){return _0x27d940[_0x170b('0x5f')](_0xecf5b8[_0x170b('0x36')][_0x170b('0x60')]);}})['then'](respondWithStatusCode(_0x86d8cc,null))[_0x170b('0x43')](handleError(_0x86d8cc,null));};exports['addContacts']=function(_0x385aef,_0x42bcd6,_0xcea01){return db[_0x170b('0x31')]['find']({'where':{'id':_0x385aef[_0x170b('0x45')]['id']}})['then'](handleEntityNotFound(_0x42bcd6,null))[_0x170b('0x2b')](function(_0x3807cb){if(_0x3807cb){var _0x4dc8a3=[];var _0x137b78={'success':[],'errors':[]};return db[_0x170b('0x61')][_0x170b('0x56')]()['then'](function(_0x558bf4){if(_0x385aef[_0x170b('0x4d')][_0x170b('0x62')]&&_[_0x170b('0x63')](_0x385aef[_0x170b('0x4d')][_0x170b('0x62')])){if(_0x385aef[_0x170b('0x4d')][_0x170b('0x62')]['length']){_0x385aef[_0x170b('0x4d')][_0x170b('0x62')]=_0x385aef[_0x170b('0x4d')][_0x170b('0x62')][_0x170b('0x64')](';')+';';}else{_0x385aef[_0x170b('0x4d')][_0x170b('0x62')]=null;}}else{_0x385aef['body']['tags']=null;}if(_0x385aef[_0x170b('0x4d')]&&_[_0x170b('0x63')](_0x385aef[_0x170b('0x4d')])){for(var _0x15d312=0x0;_0x15d312<_0x385aef['body'][_0x170b('0x3a')];_0x15d312+=0x1){_0x385aef['body'][_0x15d312][_0x170b('0x58')]=_0x385aef[_0x170b('0x45')]['id'];_0x4dc8a3['push'](_0x385aef['body'][_0x15d312]);}return BPromise[_0x170b('0x65')](_0x4dc8a3,function(_0x11a790){return db['CmContact'][_0x170b('0x4c')](_['omit'](_0x11a790,[_0x170b('0x60'),'id'])||{},{'fields':_[_0x170b('0x46')](_0x558bf4),'raw':!![]})['then'](function(_0x613f9d){_0x137b78[_0x170b('0x66')][_0x170b('0x67')](_0x613f9d[_0x170b('0x68')]);})[_0x170b('0x43')](function(_0x5c84a6){_0x137b78[_0x170b('0x69')]['push']({'data':_0x11a790,'error':_0x5c84a6['message']});});})['then'](function(_0x40f7d1){return _0x137b78;})['catch'](function(_0x1f4cc4){return _0x1f4cc4;});}else{_0x42bcd6[_0x170b('0x1f')](0x190)['json']({'message':_0x170b('0x6a')});}});}})['then'](respondWithResult(_0x42bcd6,null))['catch'](handleError(_0x42bcd6,null));};exports[_0x170b('0x6b')]=function(_0x115a8d,_0x527893,_0x377b23){var _0x57652b;return db['CmList'][_0x170b('0x4b')]({'where':{'id':_0x115a8d[_0x170b('0x45')]['id']},'include':[{'model':db[_0x170b('0x6c')],'as':'CustomFields'}]})[_0x170b('0x2b')](handleEntityNotFound(_0x527893,null))[_0x170b('0x2b')](function(_0x5cbbee){if(_0x5cbbee){_0x57652b=_0x5cbbee;return db['CmContact'][_0x170b('0x32')];}})[_0x170b('0x2b')](function(_0x566f9d){if(_0x566f9d){var _0x44ab0c={};var _0x237d07={};_0x237d07['model']=_[_0x170b('0x6d')](_[_0x170b('0x46')](_0x566f9d),_['map'](_0x57652b['CustomFields'],function(_0x321c51){return util['format'](_0x170b('0x6e'),_0x321c51['id']);}));_0x237d07[_0x170b('0x36')]=_[_0x170b('0x46')](_0x115a8d['query']);_0x237d07['filters']=_[_0x170b('0x47')](_0x237d07[_0x170b('0x38')],_0x237d07[_0x170b('0x36')]);_0x44ab0c[_0x170b('0x39')]=_[_0x170b('0x47')](_0x237d07[_0x170b('0x38')],qs[_0x170b('0x48')](_0x115a8d[_0x170b('0x36')]['fields']));_0x44ab0c[_0x170b('0x39')]=_0x44ab0c[_0x170b('0x39')][_0x170b('0x3a')]?_0x44ab0c['attributes']:_0x237d07[_0x170b('0x38')];if(!_0x115a8d[_0x170b('0x36')]['hasOwnProperty'](_0x170b('0x5c'))){_0x44ab0c[_0x170b('0x3c')]=qs[_0x170b('0x3c')](_0x115a8d[_0x170b('0x36')][_0x170b('0x3c')]);_0x44ab0c[_0x170b('0x23')]=qs[_0x170b('0x23')](_0x115a8d[_0x170b('0x36')][_0x170b('0x23')]);}_0x44ab0c[_0x170b('0x3d')]=qs[_0x170b('0x3e')](_0x115a8d[_0x170b('0x36')][_0x170b('0x3e')]);_0x44ab0c[_0x170b('0x3f')]=qs[_0x170b('0x37')](_[_0x170b('0x6f')](_0x115a8d[_0x170b('0x36')],_0x237d07['filters']));_0x44ab0c[_0x170b('0x70')]=!![];if(_0x115a8d[_0x170b('0x36')]['filter']){_0x44ab0c[_0x170b('0x3f')]=_[_0x170b('0x4a')](_0x44ab0c[_0x170b('0x3f')],{'$or':_['map'](_0x44ab0c[_0x170b('0x39')],function(_0x2305a7){var _0x16b0e1={};_0x16b0e1[_0x2305a7]={'$like':'%'+_0x115a8d[_0x170b('0x36')][_0x170b('0x5d')]+'%'};return _0x16b0e1;})});}_0x44ab0c=_[_0x170b('0x4a')]({},_0x44ab0c,_0x115a8d[_0x170b('0x40')]);return _0x57652b[_0x170b('0x6b')](_0x44ab0c);}})[_0x170b('0x2b')](respondWithResult(_0x527893,null))[_0x170b('0x43')](handleError(_0x527893,null));};exports[_0x170b('0x71')]=function(_0x104304,_0x59c6cc,_0x28cf3a){var _0x52d241;return db[_0x170b('0x31')][_0x170b('0x4b')]({'where':{'id':_0x104304['params']['id']},'include':[{'model':db[_0x170b('0x6c')],'as':_0x170b('0x72')}]})[_0x170b('0x2b')](handleEntityNotFound(_0x59c6cc,null))[_0x170b('0x2b')](function(_0x371caa){if(_0x371caa){_0x52d241=_0x371caa;return db['CmContact'][_0x170b('0x32')];}})[_0x170b('0x2b')](function(_0x2be13c){if(_0x2be13c){var _0x38f57b={};var _0x4d0de4={};_0x4d0de4['model']=_['concat'](_[_0x170b('0x46')](_0x2be13c),_[_0x170b('0x30')](_0x52d241[_0x170b('0x72')],function(_0x2f4b06){return util[_0x170b('0x73')](_0x170b('0x6e'),_0x2f4b06['id']);}));_0x4d0de4['query']=_[_0x170b('0x46')](_0x104304[_0x170b('0x36')]);_0x4d0de4[_0x170b('0x37')]=_['intersection'](_0x4d0de4[_0x170b('0x38')],_0x4d0de4['query']);_0x38f57b[_0x170b('0x39')]=_[_0x170b('0x47')](_0x4d0de4['model'],qs[_0x170b('0x48')](_0x104304[_0x170b('0x36')][_0x170b('0x48')]));_0x38f57b['attributes']=_0x38f57b[_0x170b('0x39')][_0x170b('0x3a')]?_0x38f57b['attributes']:_0x4d0de4[_0x170b('0x38')];if(!_0x104304[_0x170b('0x36')][_0x170b('0x3b')](_0x170b('0x5c'))){_0x38f57b[_0x170b('0x3c')]=qs[_0x170b('0x3c')](_0x104304[_0x170b('0x36')]['limit']);_0x38f57b[_0x170b('0x23')]=qs['offset'](_0x104304['query']['offset']);}_0x38f57b[_0x170b('0x3d')]=qs[_0x170b('0x3e')](_0x104304[_0x170b('0x36')][_0x170b('0x3e')]);_0x38f57b['where']=qs[_0x170b('0x37')](_[_0x170b('0x6f')](_0x104304['query'],_0x4d0de4[_0x170b('0x37')]));_0x38f57b[_0x170b('0x70')]=!![];if(_0x104304[_0x170b('0x36')][_0x170b('0x5d')]){_0x38f57b['where']=_['merge'](_0x38f57b[_0x170b('0x3f')],{'$or':_['map'](_0x38f57b['attributes'],function(_0x5963e3){var _0x434b52={};_0x434b52[_0x5963e3]={'$like':'%'+_0x104304['query'][_0x170b('0x5d')]+'%'};return _0x434b52;})});}_0x38f57b=_[_0x170b('0x4a')]({},_0x38f57b,_0x104304[_0x170b('0x40')]);return _0x52d241[_0x170b('0x6b')](_0x38f57b);}})['then'](function(_0x49678c){if(!_[_0x170b('0x74')](_0x49678c)){var _0x4ddf4a=toCsv(_0x49678c);var _0x40db4d=Date['now']();fs['writeFileSync'](util[_0x170b('0x73')]('/tmp/list_%d_%s.csv',_0x52d241['id'],_0x40db4d),_0x4ddf4a);_0x59c6cc[_0x170b('0x75')]('Content-disposition',_0x170b('0x76')+util[_0x170b('0x73')](_0x170b('0x77'),_0x52d241['id'],_0x40db4d));_0x59c6cc[_0x170b('0x75')]('Content-type',_0x170b('0x78'));return _0x59c6cc['download'](util[_0x170b('0x73')](_0x170b('0x79'),_0x52d241['id'],_0x40db4d));}else{return _0x59c6cc[_0x170b('0x7a')](0xcc);}})['catch'](handleError(_0x59c6cc,null));};exports[_0x170b('0x7b')]=function(_0x3eb89f,_0x46e2bb,_0x457997){var _0x4f3472;delete _0x3eb89f[_0x170b('0x4d')]['id'];return db[_0x170b('0x31')]['findOne']({'where':{'id':_0x3eb89f[_0x170b('0x45')]['id']}})[_0x170b('0x2b')](handleEntityNotFound(_0x46e2bb,null))[_0x170b('0x2b')](function(_0x2f2fed){if(_0x2f2fed){return db['sequelize'][_0x170b('0x7c')](function(_0x4fcc3f){return db['CmCustomField'][_0x170b('0x4c')](_0x3eb89f[_0x170b('0x4d')],{'transaction':_0x4fcc3f})[_0x170b('0x2b')](function(_0x92868f){_0x4f3472=_0x92868f;return _0x2f2fed[_0x170b('0x7d')](_0x92868f,{'transaction':_0x4fcc3f});})[_0x170b('0x2b')](function(){var _0x8e884b={'type':db['Sequelize'][_0x170b('0x7e')],'transaction':_0x4fcc3f};switch(_0x3eb89f[_0x170b('0x4d')][_0x170b('0x33')]){case _0x170b('0x7f'):_0x8e884b[_0x170b('0x33')]=db[_0x170b('0x80')][_0x170b('0x7e')];break;case _0x170b('0x81'):_0x8e884b[_0x170b('0x33')]=db[_0x170b('0x80')][_0x170b('0x82')];break;case _0x170b('0x83'):_0x8e884b[_0x170b('0x33')]=db['Sequelize'][_0x170b('0x84')];_0x8e884b[_0x170b('0x85')]=![];break;default:}return db['sequelize']['queryInterface'][_0x170b('0x86')]('cm_contacts',util['format'](_0x170b('0x87'),_0x4f3472['id']),_0x8e884b);})[_0x170b('0x2b')](function(){return _0x4f3472;});});}})[_0x170b('0x2b')](respondWithResult(_0x46e2bb,null))['catch'](handleError(_0x46e2bb,null));};exports['getCustomFields']=function(_0x585cb5,_0x2428a9,_0x33e53f){var _0x5221cd={};var _0x17597f={};var _0x48613b;var _0x9b3d24;return db[_0x170b('0x31')][_0x170b('0x5b')]({'where':{'id':_0x585cb5['params']['id']}})['then'](handleEntityNotFound(_0x2428a9,null))[_0x170b('0x2b')](function(_0x4d37b4){if(_0x4d37b4){_0x48613b=_0x4d37b4;_0x17597f[_0x170b('0x38')]=_['keys'](db[_0x170b('0x6c')][_0x170b('0x32')]);_0x17597f[_0x170b('0x36')]=_[_0x170b('0x46')](_0x585cb5[_0x170b('0x36')]);_0x17597f[_0x170b('0x37')]=_[_0x170b('0x47')](_0x17597f['model'],_0x17597f[_0x170b('0x36')]);_0x5221cd['attributes']=_['intersection'](_0x17597f[_0x170b('0x38')],qs['fields'](_0x585cb5[_0x170b('0x36')][_0x170b('0x48')]));_0x5221cd[_0x170b('0x39')]=_0x5221cd[_0x170b('0x39')][_0x170b('0x3a')]?_0x5221cd[_0x170b('0x39')]:_0x17597f[_0x170b('0x38')];_0x5221cd[_0x170b('0x3d')]=qs[_0x170b('0x3e')](_0x585cb5[_0x170b('0x36')][_0x170b('0x3e')]);_0x5221cd['where']=qs[_0x170b('0x37')](_[_0x170b('0x6f')](_0x585cb5['query'],_0x17597f[_0x170b('0x37')]));_0x5221cd[_0x170b('0x3f')]=_[_0x170b('0x4a')](_0x5221cd[_0x170b('0x3f')],{'$or':[{'ListId':_0x4d37b4['id']},{'ListId':null}]});if(_0x585cb5['query']['filter']){_0x5221cd[_0x170b('0x3f')]=_[_0x170b('0x4a')](_0x5221cd[_0x170b('0x3f')],{'$or':_['map'](_0x5221cd[_0x170b('0x39')],function(_0xac562f){var _0x3e5bce={};_0x3e5bce[_0xac562f]={'$like':'%'+_0x585cb5[_0x170b('0x36')][_0x170b('0x5d')]+'%'};return _0x3e5bce;})});}_0x5221cd=_[_0x170b('0x4a')]({},_0x5221cd,_0x585cb5[_0x170b('0x40')]);return db[_0x170b('0x6c')][_0x170b('0x88')](_0x5221cd);}})['then'](respondWithResult(_0x2428a9,null))[_0x170b('0x43')](handleError(_0x2428a9,null));};exports[_0x170b('0x89')]=function(_0x4c8bd4,_0x1e1893,_0x456493){return db[_0x170b('0x31')]['find']({'where':{'id':_0x4c8bd4[_0x170b('0x45')]['id']}})['then'](handleEntityNotFound(_0x1e1893,null))[_0x170b('0x2b')](function(_0x1ed7fe){if(_0x1ed7fe){return _0x1ed7fe[_0x170b('0x89')](_0x4c8bd4['body'][_0x170b('0x60')],_['omit'](_0x4c8bd4[_0x170b('0x4d')],[_0x170b('0x60'),'id'])||{})[_0x170b('0x8a')](function(_0x405801){for(var _0x122ccd=0x0;_0x122ccd<_0x4c8bd4['body'][_0x170b('0x60')]['length'];_0x122ccd+=0x1){socket[_0x170b('0x8b')](_0x170b('0x8c'),{'UserId':Number(_0x4c8bd4['body'][_0x170b('0x60')][_0x122ccd]),'CmListId':Number(_0x4c8bd4[_0x170b('0x45')]['id'])});}return _0x405801;});}})['then'](respondWithResult(_0x1e1893,null))[_0x170b('0x43')](handleError(_0x1e1893,null));};exports[_0x170b('0x8d')]=function(_0x1fe831,_0x475d70,_0xf5b6e2){return db['CmList'][_0x170b('0x4b')]({'where':{'id':_0x1fe831[_0x170b('0x45')]['id']}})['then'](handleEntityNotFound(_0x475d70,null))[_0x170b('0x2b')](function(_0x39f3d8){if(_0x39f3d8){return _0x39f3d8['removeAgents'](_0x1fe831[_0x170b('0x36')][_0x170b('0x60')])[_0x170b('0x2b')](function(){if(_[_0x170b('0x63')](_0x1fe831[_0x170b('0x36')][_0x170b('0x60')])){for(var _0x480810=0x0;_0x480810<_0x1fe831[_0x170b('0x36')][_0x170b('0x60')][_0x170b('0x3a')];_0x480810+=0x1){socket['emit'](_0x170b('0x8e'),{'UserId':Number(_0x1fe831[_0x170b('0x36')][_0x170b('0x60')][_0x480810]),'CmListId':Number(_0x1fe831[_0x170b('0x45')]['id'])});}}else{socket[_0x170b('0x8b')](_0x170b('0x8e'),{'UserId':Number(_0x1fe831['query'][_0x170b('0x60')]),'CmListId':Number(_0x1fe831[_0x170b('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0x475d70,null))['catch'](handleError(_0x475d70,null));};exports[_0x170b('0x8f')]=function(_0x3873a8,_0x8eabe3,_0x4156d4){var _0x16a4a1={};var _0x335397={};var _0x1eaa0d;var _0x2a0f53;return db['CmList']['findOne']({'where':{'id':_0x3873a8[_0x170b('0x45')]['id']}})[_0x170b('0x2b')](handleEntityNotFound(_0x8eabe3,null))['then'](function(_0x1bb6fe){if(_0x1bb6fe){_0x1eaa0d=_0x1bb6fe;_0x335397[_0x170b('0x38')]=_[_0x170b('0x46')](db['User']['rawAttributes']);_0x335397[_0x170b('0x36')]=_['keys'](_0x3873a8[_0x170b('0x36')]);_0x335397[_0x170b('0x37')]=_[_0x170b('0x47')](_0x335397[_0x170b('0x38')],_0x335397[_0x170b('0x36')]);_0x16a4a1[_0x170b('0x39')]=_[_0x170b('0x47')](_0x335397[_0x170b('0x38')],qs[_0x170b('0x48')](_0x3873a8[_0x170b('0x36')]['fields']));_0x16a4a1[_0x170b('0x39')]=_0x16a4a1[_0x170b('0x39')]['length']?_0x16a4a1[_0x170b('0x39')]:_0x335397['model'];_0x16a4a1[_0x170b('0x3d')]=qs[_0x170b('0x3e')](_0x3873a8[_0x170b('0x36')]['sort']);_0x16a4a1[_0x170b('0x3f')]=qs[_0x170b('0x37')](_[_0x170b('0x6f')](_0x3873a8[_0x170b('0x36')],_0x335397[_0x170b('0x37')]));if(_0x3873a8['query'][_0x170b('0x5d')]){_0x16a4a1[_0x170b('0x3f')]=_[_0x170b('0x4a')](_0x16a4a1[_0x170b('0x3f')],{'$or':_[_0x170b('0x30')](_0x16a4a1['attributes'],function(_0x34e20d){var _0x3cca84={};_0x3cca84[_0x34e20d]={'$like':'%'+_0x3873a8[_0x170b('0x36')]['filter']+'%'};return _0x3cca84;})});}_0x16a4a1=_['merge']({},_0x16a4a1,_0x3873a8['options']);return _0x1eaa0d[_0x170b('0x8f')](_0x16a4a1);}})[_0x170b('0x2b')](function(_0x9e759c){if(_0x9e759c){_0x2a0f53=_0x9e759c[_0x170b('0x3a')];if(!_0x3873a8[_0x170b('0x36')][_0x170b('0x3b')](_0x170b('0x5c'))){_0x16a4a1[_0x170b('0x3c')]=qs['limit'](_0x3873a8[_0x170b('0x36')][_0x170b('0x3c')]);_0x16a4a1[_0x170b('0x23')]=qs[_0x170b('0x23')](_0x3873a8['query'][_0x170b('0x23')]);}return _0x1eaa0d[_0x170b('0x8f')](_0x16a4a1);}})[_0x170b('0x2b')](function(_0x5654e6){if(_0x5654e6){return _0x5654e6?{'count':_0x2a0f53,'rows':_0x5654e6}:null;}})['then'](respondWithResult(_0x8eabe3,null))[_0x170b('0x43')](handleError(_0x8eabe3,null));}; \ No newline at end of file +var _0x76cb=['TEXT','Sequelize','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','userCmList:save','removeAgents','emit','getAgents','User','eml-format','rimraf','zip-dir','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','get','Lists','error','name','index','map','CmList','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','destroy','describe','ListId','getDispositions','findOne','Disposition','order','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','each','omit','success','push','dataValues','getContacts','CustomFields','format','cf_%d','hasOwnProperty','getContactsCsv','CmCustomField','raw','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','text'];(function(_0x17183c,_0x1fbcd4){var _0x5bf94a=function(_0x3b64e0){while(--_0x3b64e0){_0x17183c['push'](_0x17183c['shift']());}};_0x5bf94a(++_0x1fbcd4);}(_0x76cb,0x129));var _0xb76c=function(_0x20e5c3,_0x41470c){_0x20e5c3=_0x20e5c3-0x0;var _0x401520=_0x76cb[_0x20e5c3];return _0x401520;};'use strict';var emlformat=require(_0xb76c('0x0'));var rimraf=require(_0xb76c('0x1'));var zipdir=require(_0xb76c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb76c('0x3'));var Mustache=require(_0xb76c('0x4'));var util=require(_0xb76c('0x5'));var path=require('path');var sox=require(_0xb76c('0x6'));var csv=require(_0xb76c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb76c('0x8'));var _=require(_0xb76c('0x9'));var squel=require(_0xb76c('0xa'));var crypto=require(_0xb76c('0xb'));var jsforce=require(_0xb76c('0xc'));var deskjs=require(_0xb76c('0xd'));var toCsv=require(_0xb76c('0x7'));var querystring=require(_0xb76c('0xe'));var Papa=require('papaparse');var Redis=require(_0xb76c('0xf'));var authService=require(_0xb76c('0x10'));var qs=require(_0xb76c('0x11'));var as=require(_0xb76c('0x12'));var hardwareService=require(_0xb76c('0x13'));var logger=require(_0xb76c('0x14'))('api');var utils=require(_0xb76c('0x15'));var config=require(_0xb76c('0x16'));var licenseUtil=require(_0xb76c('0x17'));var db=require(_0xb76c('0x18'))['db'];config[_0xb76c('0x19')]=_[_0xb76c('0x1a')](config['redis'],{'host':_0xb76c('0x1b'),'port':0x18eb});var socket=require(_0xb76c('0x1c'))(new Redis(config[_0xb76c('0x19')]));require(_0xb76c('0x1d'))['register'](socket);function respondWithStatusCode(_0x2673a3,_0x2c5648){_0x2c5648=_0x2c5648||0xcc;return function(_0x398c44){if(_0x398c44){return _0x2673a3[_0xb76c('0x1e')](_0x2c5648);}return _0x2673a3[_0xb76c('0x1f')](_0x2c5648)[_0xb76c('0x20')]();};}function respondWithResult(_0x5e754a,_0x1cff8f){_0x1cff8f=_0x1cff8f||0xc8;return function(_0x42b342){if(_0x42b342){return _0x5e754a['status'](_0x1cff8f)[_0xb76c('0x21')](_0x42b342);}};}function respondWithFilteredResult(_0x672e0a,_0x55d200){return function(_0x751174){if(_0x751174){var _0x18fec1=typeof _0x55d200[_0xb76c('0x22')]==='undefined'&&typeof _0x55d200[_0xb76c('0x23')]===_0xb76c('0x24');var _0x3877ea=_0x751174[_0xb76c('0x25')];var _0x3bca4b=_0x18fec1?0x0:_0x55d200[_0xb76c('0x22')];var _0x53ed94=_0x18fec1?_0x751174[_0xb76c('0x25')]:_0x55d200[_0xb76c('0x22')]+_0x55d200[_0xb76c('0x23')];var _0x504d5f;if(_0x53ed94>=_0x3877ea){_0x53ed94=_0x3877ea;_0x504d5f=0xc8;}else{_0x504d5f=0xce;}_0x672e0a[_0xb76c('0x1f')](_0x504d5f);return _0x672e0a['set'](_0xb76c('0x26'),_0x3bca4b+'-'+_0x53ed94+'/'+_0x3877ea)[_0xb76c('0x21')](_0x751174);}return null;};}function patchUpdates(_0x1365a3){return function(_0x5800ee){try{jsonpatch[_0xb76c('0x27')](_0x5800ee,_0x1365a3,!![]);}catch(_0x3f579c){return BPromise[_0xb76c('0x28')](_0x3f579c);}return _0x5800ee['save']();};}function saveUpdates(_0x46194f,_0x2b7d3f){return function(_0x1ecc8a){if(_0x1ecc8a){return _0x1ecc8a[_0xb76c('0x29')](_0x46194f)[_0xb76c('0x2a')](function(_0x365eb3){return _0x365eb3;});}return null;};}function removeEntity(_0x500111,_0xe47563){return function(_0x14b09b){if(_0x14b09b){return _0x14b09b['destroy']()['then'](function(){var _0x370eaf=_0x14b09b[_0xb76c('0x2b')]({'plain':!![]});var _0x792f93=_0xb76c('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x792f93,'resourceId':_0x370eaf['id']}})[_0xb76c('0x2a')](function(){return _0x14b09b;});})['then'](function(){_0x500111['status'](0xcc)[_0xb76c('0x20')]();});}};}function handleEntityNotFound(_0x2970a8,_0x444e9f){return function(_0x5e92af){if(!_0x5e92af){_0x2970a8['sendStatus'](0x194);}return _0x5e92af;};}function handleError(_0x351d0c,_0x109f45){_0x109f45=_0x109f45||0x1f4;return function(_0x56f0cc){logger[_0xb76c('0x2d')](_0x56f0cc['stack']);if(_0x56f0cc[_0xb76c('0x2e')]){delete _0x56f0cc['name'];}_0x351d0c[_0xb76c('0x1f')](_0x109f45)['send'](_0x56f0cc);};}exports[_0xb76c('0x2f')]=function(_0x4d07ae,_0x196942){var _0x50824a={},_0x31b83b={},_0x22de0d={'count':0x0,'rows':[]};var _0x946139=_[_0xb76c('0x30')](db[_0xb76c('0x31')][_0xb76c('0x32')],function(_0x444db5){return{'name':_0x444db5['fieldName'],'type':_0x444db5[_0xb76c('0x33')][_0xb76c('0x34')]};});_0x31b83b['model']=_['map'](_0x946139,'name');_0x31b83b[_0xb76c('0x35')]=_[_0xb76c('0x36')](_0x4d07ae[_0xb76c('0x35')]);_0x31b83b['filters']=_[_0xb76c('0x37')](_0x31b83b[_0xb76c('0x38')],_0x31b83b[_0xb76c('0x35')]);_0x50824a[_0xb76c('0x39')]=_[_0xb76c('0x37')](_0x31b83b[_0xb76c('0x38')],qs[_0xb76c('0x3a')](_0x4d07ae[_0xb76c('0x35')][_0xb76c('0x3a')]));_0x50824a['attributes']=_0x50824a[_0xb76c('0x39')][_0xb76c('0x3b')]?_0x50824a['attributes']:_0x31b83b[_0xb76c('0x38')];if(!_0x4d07ae[_0xb76c('0x35')]['hasOwnProperty'](_0xb76c('0x3c'))){_0x50824a['limit']=qs[_0xb76c('0x23')](_0x4d07ae['query'][_0xb76c('0x23')]);_0x50824a[_0xb76c('0x22')]=qs[_0xb76c('0x22')](_0x4d07ae[_0xb76c('0x35')][_0xb76c('0x22')]);}_0x50824a['order']=qs[_0xb76c('0x3d')](_0x4d07ae['query'][_0xb76c('0x3d')]);_0x50824a['where']=qs[_0xb76c('0x3e')](_[_0xb76c('0x3f')](_0x4d07ae[_0xb76c('0x35')],_0x31b83b[_0xb76c('0x3e')]),_0x946139);if(_0x4d07ae[_0xb76c('0x35')][_0xb76c('0x40')]){_0x50824a['where']=_[_0xb76c('0x41')](_0x50824a[_0xb76c('0x42')],{'$or':_[_0xb76c('0x30')](_0x946139,function(_0x4f4cea){if(_0x4f4cea[_0xb76c('0x33')]!==_0xb76c('0x43')){var _0x562f32={};_0x562f32[_0x4f4cea[_0xb76c('0x2e')]]={'$like':'%'+_0x4d07ae[_0xb76c('0x35')][_0xb76c('0x40')]+'%'};return _0x562f32;}})});}_0x50824a=_[_0xb76c('0x41')]({},_0x50824a,_0x4d07ae[_0xb76c('0x44')]);var _0x3354ab={'where':_0x50824a[_0xb76c('0x42')]};return db['CmList'][_0xb76c('0x25')](_0x3354ab)[_0xb76c('0x2a')](function(_0x2edaa2){_0x22de0d[_0xb76c('0x25')]=_0x2edaa2;if(_0x4d07ae[_0xb76c('0x35')][_0xb76c('0x45')]){_0x50824a[_0xb76c('0x46')]=[{'all':!![]}];}return db[_0xb76c('0x31')][_0xb76c('0x47')](_0x50824a);})[_0xb76c('0x2a')](function(_0x403757){_0x22de0d[_0xb76c('0x48')]=_0x403757;return _0x22de0d;})['then'](respondWithFilteredResult(_0x196942,_0x50824a))[_0xb76c('0x49')](handleError(_0x196942,null));};exports[_0xb76c('0x4a')]=function(_0x37160c,_0x2dfc97){var _0x1d3b0d={'raw':![],'where':{'id':_0x37160c[_0xb76c('0x4b')]['id']}},_0x65178e={};_0x65178e[_0xb76c('0x38')]=_[_0xb76c('0x36')](db[_0xb76c('0x31')][_0xb76c('0x32')]);_0x65178e[_0xb76c('0x35')]=_['keys'](_0x37160c[_0xb76c('0x35')]);_0x65178e['filters']=_[_0xb76c('0x37')](_0x65178e[_0xb76c('0x38')],_0x65178e[_0xb76c('0x35')]);_0x1d3b0d['attributes']=_[_0xb76c('0x37')](_0x65178e[_0xb76c('0x38')],qs[_0xb76c('0x3a')](_0x37160c['query']['fields']));_0x1d3b0d['attributes']=_0x1d3b0d[_0xb76c('0x39')]['length']?_0x1d3b0d[_0xb76c('0x39')]:_0x65178e['model'];if(_0x37160c[_0xb76c('0x35')]['includeAll']){_0x1d3b0d['include']=[{'all':!![]}];}_0x1d3b0d=_[_0xb76c('0x41')]({},_0x1d3b0d,_0x37160c[_0xb76c('0x44')]);return db[_0xb76c('0x31')][_0xb76c('0x4c')](_0x1d3b0d)[_0xb76c('0x2a')](handleEntityNotFound(_0x2dfc97,null))['then'](respondWithResult(_0x2dfc97,null))[_0xb76c('0x49')](handleError(_0x2dfc97,null));};exports[_0xb76c('0x4d')]=function(_0x24aee8,_0x50d7bb){return db[_0xb76c('0x31')][_0xb76c('0x4d')](_0x24aee8['body'],{})[_0xb76c('0x2a')](function(_0x4cb7d0){var _0x57270e=_0x24aee8[_0xb76c('0x4e')]['get']({'plain':!![]});if(!_0x57270e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57270e[_0xb76c('0x4f')]===_0xb76c('0x4e')){var _0x31aa72=_0x4cb7d0[_0xb76c('0x2b')]({'plain':!![]});var _0x460dcc=_0xb76c('0x2c');return db[_0xb76c('0x50')]['find']({'where':{'name':_0x460dcc,'userProfileId':_0x57270e[_0xb76c('0x51')]},'raw':!![]})[_0xb76c('0x2a')](function(_0x4750c1){if(_0x4750c1&&_0x4750c1[_0xb76c('0x52')]===0x0){return db[_0xb76c('0x53')]['create']({'name':_0x31aa72[_0xb76c('0x2e')],'resourceId':_0x31aa72['id'],'type':_0x4750c1[_0xb76c('0x2e')],'sectionId':_0x4750c1['id']},{})[_0xb76c('0x2a')](function(){return _0x4cb7d0;});}else{return _0x4cb7d0;}})[_0xb76c('0x49')](function(_0x17b5c8){logger[_0xb76c('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17b5c8);throw _0x17b5c8;});}return _0x4cb7d0;})[_0xb76c('0x2a')](respondWithResult(_0x50d7bb,0xc9))[_0xb76c('0x49')](handleError(_0x50d7bb,null));};exports[_0xb76c('0x29')]=function(_0x5c715b,_0x28fca2){if(_0x5c715b[_0xb76c('0x54')]['id']){delete _0x5c715b[_0xb76c('0x54')]['id'];}return db[_0xb76c('0x31')][_0xb76c('0x4c')]({'where':{'id':_0x5c715b['params']['id']}})['then'](handleEntityNotFound(_0x28fca2,null))['then'](saveUpdates(_0x5c715b[_0xb76c('0x54')],null))[_0xb76c('0x2a')](respondWithResult(_0x28fca2,null))[_0xb76c('0x49')](handleError(_0x28fca2,null));};exports[_0xb76c('0x55')]=function(_0x2ad307,_0x6b6008){return db['CmList'][_0xb76c('0x4c')]({'where':{'id':_0x2ad307['params']['id']}})[_0xb76c('0x2a')](handleEntityNotFound(_0x6b6008,null))[_0xb76c('0x2a')](removeEntity(_0x6b6008,null))['catch'](handleError(_0x6b6008,null));};exports[_0xb76c('0x56')]=function(_0x4aa61e,_0x574f1c){return db['CmList']['describe']()[_0xb76c('0x2a')](respondWithResult(_0x574f1c,null))[_0xb76c('0x49')](handleError(_0x574f1c,null));};exports['addDisposition']=function(_0x40cf67,_0x124795,_0x47f02b){if(_0x40cf67['body']['id']){delete _0x40cf67[_0xb76c('0x54')]['id'];}return db[_0xb76c('0x31')][_0xb76c('0x4c')]({'where':{'id':_0x40cf67['params']['id']}})[_0xb76c('0x2a')](handleEntityNotFound(_0x124795,null))[_0xb76c('0x2a')](function(_0x2a7f40){if(_0x2a7f40){_0x40cf67['body'][_0xb76c('0x57')]=_0x2a7f40['id'];return db['Disposition'][_0xb76c('0x4d')](_0x40cf67['body']);}})[_0xb76c('0x2a')](respondWithResult(_0x124795,null))[_0xb76c('0x49')](handleError(_0x124795,null));};exports[_0xb76c('0x58')]=function(_0x372443,_0x3571ed,_0x2d54df){var _0x42797b={'raw':![],'where':{}};var _0x3ab705={};var _0x27765e={'count':0x0,'rows':[]};return db[_0xb76c('0x31')][_0xb76c('0x59')]({'where':{'id':_0x372443[_0xb76c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3571ed,null))[_0xb76c('0x2a')](function(_0x1bdf4d){if(_0x1bdf4d){_0x3ab705['model']=_[_0xb76c('0x36')](db[_0xb76c('0x5a')]['rawAttributes']);_0x3ab705[_0xb76c('0x35')]=_['keys'](_0x372443[_0xb76c('0x35')]);_0x3ab705[_0xb76c('0x3e')]=_['intersection'](_0x3ab705[_0xb76c('0x38')],_0x3ab705[_0xb76c('0x35')]);_0x42797b[_0xb76c('0x39')]=_[_0xb76c('0x37')](_0x3ab705[_0xb76c('0x38')],qs[_0xb76c('0x3a')](_0x372443['query'][_0xb76c('0x3a')]));_0x42797b[_0xb76c('0x39')]=_0x42797b[_0xb76c('0x39')][_0xb76c('0x3b')]?_0x42797b[_0xb76c('0x39')]:_0x3ab705[_0xb76c('0x38')];if(!_0x372443[_0xb76c('0x35')]['hasOwnProperty'](_0xb76c('0x3c'))){_0x42797b[_0xb76c('0x23')]=qs[_0xb76c('0x23')](_0x372443[_0xb76c('0x35')][_0xb76c('0x23')]);_0x42797b[_0xb76c('0x22')]=qs[_0xb76c('0x22')](_0x372443[_0xb76c('0x35')][_0xb76c('0x22')]);}_0x42797b[_0xb76c('0x5b')]=qs[_0xb76c('0x3d')](_0x372443[_0xb76c('0x35')]['sort']);_0x42797b[_0xb76c('0x42')]=qs[_0xb76c('0x3e')](_['pick'](_0x372443['query'],_0x3ab705['filters']));_0x42797b['where'][_0xb76c('0x57')]=_0x1bdf4d['id'];if(_0x372443['query'][_0xb76c('0x40')]){_0x42797b[_0xb76c('0x42')]=_[_0xb76c('0x41')](_0x42797b[_0xb76c('0x42')],{'$or':_[_0xb76c('0x30')](_0x42797b[_0xb76c('0x39')],function(_0x4853cc){var _0x10629f={};_0x10629f[_0x4853cc]={'$like':'%'+_0x372443['query']['filter']+'%'};return _0x10629f;})});}_0x42797b=_['merge']({},_0x42797b,_0x372443['options']);return db[_0xb76c('0x5a')][_0xb76c('0x25')]({'where':_0x42797b['where']})[_0xb76c('0x2a')](function(_0x26ae10){_0x27765e[_0xb76c('0x25')]=_0x26ae10;if(_0x372443[_0xb76c('0x35')][_0xb76c('0x45')]){_0x42797b[_0xb76c('0x46')]=[{'all':!![]}];}return db[_0xb76c('0x5a')][_0xb76c('0x47')](_0x42797b);})[_0xb76c('0x2a')](function(_0x475ebe){_0x27765e['rows']=_0x475ebe;return _0x27765e;});}})[_0xb76c('0x2a')](respondWithFilteredResult(_0x3571ed,_0x42797b))[_0xb76c('0x49')](handleError(_0x3571ed,null));};exports['removeDispositions']=function(_0x475ed7,_0x17cb7c,_0x169903){return db[_0xb76c('0x31')][_0xb76c('0x4c')]({'where':{'id':_0x475ed7[_0xb76c('0x4b')]['id']}})[_0xb76c('0x2a')](handleEntityNotFound(_0x17cb7c,null))[_0xb76c('0x2a')](function(_0x23b117){if(_0x23b117){return _0x23b117[_0xb76c('0x5c')](_0x475ed7['query'][_0xb76c('0x5d')]);}})['then'](respondWithStatusCode(_0x17cb7c,null))[_0xb76c('0x49')](handleError(_0x17cb7c,null));};exports[_0xb76c('0x5e')]=function(_0x531782,_0x4c1735,_0x17d376){return db[_0xb76c('0x31')][_0xb76c('0x4c')]({'where':{'id':_0x531782[_0xb76c('0x4b')]['id']}})[_0xb76c('0x2a')](handleEntityNotFound(_0x4c1735,null))['then'](function(_0x38a3e6){if(_0x38a3e6){var _0x4fc5a3=[];var _0x5e397b={'success':[],'errors':[]};return db[_0xb76c('0x5f')][_0xb76c('0x56')]()[_0xb76c('0x2a')](function(_0x8482a5){if(_0x531782[_0xb76c('0x54')][_0xb76c('0x60')]&&_[_0xb76c('0x61')](_0x531782[_0xb76c('0x54')][_0xb76c('0x60')])){if(_0x531782[_0xb76c('0x54')][_0xb76c('0x60')][_0xb76c('0x3b')]){_0x531782[_0xb76c('0x54')][_0xb76c('0x60')]=_0x531782[_0xb76c('0x54')][_0xb76c('0x60')][_0xb76c('0x62')](';')+';';}else{_0x531782[_0xb76c('0x54')][_0xb76c('0x60')]=null;}}else{_0x531782['body'][_0xb76c('0x60')]=null;}if(_0x531782[_0xb76c('0x54')]&&_[_0xb76c('0x61')](_0x531782[_0xb76c('0x54')])){for(var _0x3e6910=0x0;_0x3e6910<_0x531782[_0xb76c('0x54')][_0xb76c('0x3b')];_0x3e6910+=0x1){_0x531782['body'][_0x3e6910][_0xb76c('0x57')]=_0x531782[_0xb76c('0x4b')]['id'];_0x4fc5a3['push'](_0x531782[_0xb76c('0x54')][_0x3e6910]);}return BPromise[_0xb76c('0x63')](_0x4fc5a3,function(_0x5a373f){return db[_0xb76c('0x5f')][_0xb76c('0x4d')](_[_0xb76c('0x64')](_0x5a373f,[_0xb76c('0x5d'),'id'])||{},{'fields':_[_0xb76c('0x36')](_0x8482a5),'raw':!![]})[_0xb76c('0x2a')](function(_0x106b00){_0x5e397b[_0xb76c('0x65')][_0xb76c('0x66')](_0x106b00[_0xb76c('0x67')]);})[_0xb76c('0x49')](function(_0x1b0aab){_0x5e397b['errors'][_0xb76c('0x66')]({'data':_0x5a373f,'error':_0x1b0aab['message']});});})['then'](function(_0x351b8c){return _0x5e397b;})[_0xb76c('0x49')](function(_0x38b2b6){return _0x38b2b6;});}else{_0x4c1735[_0xb76c('0x1f')](0x190)[_0xb76c('0x21')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xb76c('0x2a')](respondWithResult(_0x4c1735,null))[_0xb76c('0x49')](handleError(_0x4c1735,null));};exports[_0xb76c('0x68')]=function(_0x352777,_0x5b8521,_0x198dc0){var _0x221ca2;return db['CmList'][_0xb76c('0x4c')]({'where':{'id':_0x352777['params']['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0xb76c('0x2a')](handleEntityNotFound(_0x5b8521,null))['then'](function(_0xfcabc1){if(_0xfcabc1){_0x221ca2=_0xfcabc1;return db[_0xb76c('0x5f')][_0xb76c('0x32')];}})[_0xb76c('0x2a')](function(_0x4d4564){if(_0x4d4564){var _0x25b395={};var _0x20a700={};_0x20a700[_0xb76c('0x38')]=_['concat'](_['keys'](_0x4d4564),_[_0xb76c('0x30')](_0x221ca2[_0xb76c('0x69')],function(_0x4d5c7d){return util[_0xb76c('0x6a')](_0xb76c('0x6b'),_0x4d5c7d['id']);}));_0x20a700['query']=_[_0xb76c('0x36')](_0x352777[_0xb76c('0x35')]);_0x20a700[_0xb76c('0x3e')]=_[_0xb76c('0x37')](_0x20a700[_0xb76c('0x38')],_0x20a700['query']);_0x25b395['attributes']=_[_0xb76c('0x37')](_0x20a700[_0xb76c('0x38')],qs['fields'](_0x352777[_0xb76c('0x35')][_0xb76c('0x3a')]));_0x25b395[_0xb76c('0x39')]=_0x25b395[_0xb76c('0x39')]['length']?_0x25b395[_0xb76c('0x39')]:_0x20a700['model'];if(!_0x352777['query'][_0xb76c('0x6c')](_0xb76c('0x3c'))){_0x25b395[_0xb76c('0x23')]=qs[_0xb76c('0x23')](_0x352777[_0xb76c('0x35')][_0xb76c('0x23')]);_0x25b395['offset']=qs[_0xb76c('0x22')](_0x352777[_0xb76c('0x35')]['offset']);}_0x25b395[_0xb76c('0x5b')]=qs[_0xb76c('0x3d')](_0x352777['query'][_0xb76c('0x3d')]);_0x25b395[_0xb76c('0x42')]=qs[_0xb76c('0x3e')](_['pick'](_0x352777[_0xb76c('0x35')],_0x20a700['filters']));_0x25b395['raw']=!![];if(_0x352777[_0xb76c('0x35')][_0xb76c('0x40')]){_0x25b395[_0xb76c('0x42')]=_[_0xb76c('0x41')](_0x25b395[_0xb76c('0x42')],{'$or':_['map'](_0x25b395['attributes'],function(_0x283172){var _0x28c556={};_0x28c556[_0x283172]={'$like':'%'+_0x352777['query'][_0xb76c('0x40')]+'%'};return _0x28c556;})});}_0x25b395=_[_0xb76c('0x41')]({},_0x25b395,_0x352777[_0xb76c('0x44')]);return _0x221ca2[_0xb76c('0x68')](_0x25b395);}})[_0xb76c('0x2a')](respondWithResult(_0x5b8521,null))[_0xb76c('0x49')](handleError(_0x5b8521,null));};exports[_0xb76c('0x6d')]=function(_0x6589c4,_0x1437df,_0x40f227){var _0x1041b0;return db['CmList']['find']({'where':{'id':_0x6589c4[_0xb76c('0x4b')]['id']},'include':[{'model':db[_0xb76c('0x6e')],'as':_0xb76c('0x69')}]})[_0xb76c('0x2a')](handleEntityNotFound(_0x1437df,null))[_0xb76c('0x2a')](function(_0x5b6283){if(_0x5b6283){_0x1041b0=_0x5b6283;return db[_0xb76c('0x5f')]['rawAttributes'];}})['then'](function(_0x228f4d){if(_0x228f4d){var _0x5f1ee5={};var _0x578a48={};_0x578a48[_0xb76c('0x38')]=_['concat'](_[_0xb76c('0x36')](_0x228f4d),_[_0xb76c('0x30')](_0x1041b0[_0xb76c('0x69')],function(_0x1852ab){return util['format'](_0xb76c('0x6b'),_0x1852ab['id']);}));_0x578a48[_0xb76c('0x35')]=_[_0xb76c('0x36')](_0x6589c4[_0xb76c('0x35')]);_0x578a48[_0xb76c('0x3e')]=_['intersection'](_0x578a48[_0xb76c('0x38')],_0x578a48[_0xb76c('0x35')]);_0x5f1ee5[_0xb76c('0x39')]=_[_0xb76c('0x37')](_0x578a48[_0xb76c('0x38')],qs[_0xb76c('0x3a')](_0x6589c4[_0xb76c('0x35')][_0xb76c('0x3a')]));_0x5f1ee5[_0xb76c('0x39')]=_0x5f1ee5[_0xb76c('0x39')]['length']?_0x5f1ee5[_0xb76c('0x39')]:_0x578a48[_0xb76c('0x38')];if(!_0x6589c4[_0xb76c('0x35')]['hasOwnProperty'](_0xb76c('0x3c'))){_0x5f1ee5[_0xb76c('0x23')]=qs[_0xb76c('0x23')](_0x6589c4[_0xb76c('0x35')][_0xb76c('0x23')]);_0x5f1ee5[_0xb76c('0x22')]=qs[_0xb76c('0x22')](_0x6589c4[_0xb76c('0x35')][_0xb76c('0x22')]);}_0x5f1ee5[_0xb76c('0x5b')]=qs[_0xb76c('0x3d')](_0x6589c4['query']['sort']);_0x5f1ee5[_0xb76c('0x42')]=qs['filters'](_['pick'](_0x6589c4[_0xb76c('0x35')],_0x578a48[_0xb76c('0x3e')]));_0x5f1ee5[_0xb76c('0x6f')]=!![];if(_0x6589c4[_0xb76c('0x35')][_0xb76c('0x40')]){_0x5f1ee5[_0xb76c('0x42')]=_['merge'](_0x5f1ee5['where'],{'$or':_[_0xb76c('0x30')](_0x5f1ee5[_0xb76c('0x39')],function(_0x213542){var _0x5ef129={};_0x5ef129[_0x213542]={'$like':'%'+_0x6589c4[_0xb76c('0x35')][_0xb76c('0x40')]+'%'};return _0x5ef129;})});}_0x5f1ee5=_[_0xb76c('0x41')]({},_0x5f1ee5,_0x6589c4[_0xb76c('0x44')]);return _0x1041b0[_0xb76c('0x68')](_0x5f1ee5);}})['then'](function(_0x2a6639){if(!_['isEmpty'](_0x2a6639)){var _0x498dce=toCsv(_0x2a6639);var _0x3fd081=Date['now']();fs[_0xb76c('0x70')](util[_0xb76c('0x6a')]('/tmp/list_%d_%s.csv',_0x1041b0['id'],_0x3fd081),_0x498dce);_0x1437df[_0xb76c('0x71')](_0xb76c('0x72'),_0xb76c('0x73')+util[_0xb76c('0x6a')](_0xb76c('0x74'),_0x1041b0['id'],_0x3fd081));_0x1437df[_0xb76c('0x71')](_0xb76c('0x75'),_0xb76c('0x76'));return _0x1437df[_0xb76c('0x77')](util[_0xb76c('0x6a')](_0xb76c('0x78'),_0x1041b0['id'],_0x3fd081));}else{return _0x1437df[_0xb76c('0x1e')](0xcc);}})[_0xb76c('0x49')](handleError(_0x1437df,null));};exports[_0xb76c('0x79')]=function(_0x8e0324,_0xba2e63,_0x57881a){var _0x4be37e;delete _0x8e0324[_0xb76c('0x54')]['id'];return db[_0xb76c('0x31')]['findOne']({'where':{'id':_0x8e0324['params']['id']}})[_0xb76c('0x2a')](handleEntityNotFound(_0xba2e63,null))[_0xb76c('0x2a')](function(_0x42a722){if(_0x42a722){return db['sequelize']['transaction'](function(_0x5d6cdc){return db[_0xb76c('0x6e')]['create'](_0x8e0324['body'],{'transaction':_0x5d6cdc})['then'](function(_0x401073){_0x4be37e=_0x401073;return _0x42a722['addCustomFields'](_0x401073,{'transaction':_0x5d6cdc});})[_0xb76c('0x2a')](function(){var _0x2fb8c1={'type':db['Sequelize']['TEXT'],'transaction':_0x5d6cdc};switch(_0x8e0324[_0xb76c('0x54')][_0xb76c('0x33')]){case _0xb76c('0x7a'):_0x2fb8c1[_0xb76c('0x33')]=db['Sequelize'][_0xb76c('0x7b')];break;case'number':_0x2fb8c1['type']=db[_0xb76c('0x7c')]['INTEGER'];break;case _0xb76c('0x7d'):_0x2fb8c1[_0xb76c('0x33')]=db[_0xb76c('0x7c')][_0xb76c('0x7e')];_0x2fb8c1[_0xb76c('0x7f')]=![];break;default:}return db[_0xb76c('0x80')][_0xb76c('0x81')][_0xb76c('0x82')](_0xb76c('0x83'),util[_0xb76c('0x6a')](_0xb76c('0x84'),_0x4be37e['id']),_0x2fb8c1);})[_0xb76c('0x2a')](function(){return _0x4be37e;});});}})[_0xb76c('0x2a')](respondWithResult(_0xba2e63,null))[_0xb76c('0x49')](handleError(_0xba2e63,null));};exports[_0xb76c('0x85')]=function(_0x49a626,_0x5a147a,_0x4689da){var _0x251f9b={};var _0x516022={};var _0x5ae8c6;var _0x2a26d6;return db[_0xb76c('0x31')]['findOne']({'where':{'id':_0x49a626[_0xb76c('0x4b')]['id']}})[_0xb76c('0x2a')](handleEntityNotFound(_0x5a147a,null))['then'](function(_0x49c027){if(_0x49c027){_0x5ae8c6=_0x49c027;_0x516022[_0xb76c('0x38')]=_[_0xb76c('0x36')](db[_0xb76c('0x6e')][_0xb76c('0x32')]);_0x516022[_0xb76c('0x35')]=_[_0xb76c('0x36')](_0x49a626['query']);_0x516022[_0xb76c('0x3e')]=_[_0xb76c('0x37')](_0x516022[_0xb76c('0x38')],_0x516022[_0xb76c('0x35')]);_0x251f9b[_0xb76c('0x39')]=_[_0xb76c('0x37')](_0x516022['model'],qs[_0xb76c('0x3a')](_0x49a626[_0xb76c('0x35')][_0xb76c('0x3a')]));_0x251f9b['attributes']=_0x251f9b[_0xb76c('0x39')][_0xb76c('0x3b')]?_0x251f9b[_0xb76c('0x39')]:_0x516022[_0xb76c('0x38')];_0x251f9b[_0xb76c('0x5b')]=qs['sort'](_0x49a626[_0xb76c('0x35')][_0xb76c('0x3d')]);_0x251f9b[_0xb76c('0x42')]=qs[_0xb76c('0x3e')](_[_0xb76c('0x3f')](_0x49a626['query'],_0x516022[_0xb76c('0x3e')]));_0x251f9b['where']=_[_0xb76c('0x41')](_0x251f9b['where'],{'$or':[{'ListId':_0x49c027['id']},{'ListId':null}]});if(_0x49a626['query'][_0xb76c('0x40')]){_0x251f9b['where']=_[_0xb76c('0x41')](_0x251f9b[_0xb76c('0x42')],{'$or':_[_0xb76c('0x30')](_0x251f9b[_0xb76c('0x39')],function(_0x2b9930){var _0x390899={};_0x390899[_0x2b9930]={'$like':'%'+_0x49a626[_0xb76c('0x35')][_0xb76c('0x40')]+'%'};return _0x390899;})});}_0x251f9b=_['merge']({},_0x251f9b,_0x49a626[_0xb76c('0x44')]);return db[_0xb76c('0x6e')]['findAndCountAll'](_0x251f9b);}})[_0xb76c('0x2a')](respondWithResult(_0x5a147a,null))[_0xb76c('0x49')](handleError(_0x5a147a,null));};exports[_0xb76c('0x86')]=function(_0x107c43,_0x2e4022,_0x25987e){return db[_0xb76c('0x31')]['find']({'where':{'id':_0x107c43[_0xb76c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2e4022,null))['then'](function(_0x22fc0f){if(_0x22fc0f){return _0x22fc0f[_0xb76c('0x86')](_0x107c43[_0xb76c('0x54')]['ids'],_[_0xb76c('0x64')](_0x107c43[_0xb76c('0x54')],['ids','id'])||{})['spread'](function(_0x5152ec){for(var _0x227fff=0x0;_0x227fff<_0x107c43[_0xb76c('0x54')][_0xb76c('0x5d')][_0xb76c('0x3b')];_0x227fff+=0x1){socket['emit'](_0xb76c('0x87'),{'UserId':Number(_0x107c43[_0xb76c('0x54')][_0xb76c('0x5d')][_0x227fff]),'CmListId':Number(_0x107c43[_0xb76c('0x4b')]['id'])});}return _0x5152ec;});}})[_0xb76c('0x2a')](respondWithResult(_0x2e4022,null))['catch'](handleError(_0x2e4022,null));};exports[_0xb76c('0x88')]=function(_0x3b599e,_0x2fd4b8,_0xe5ce3){return db[_0xb76c('0x31')][_0xb76c('0x4c')]({'where':{'id':_0x3b599e[_0xb76c('0x4b')]['id']}})[_0xb76c('0x2a')](handleEntityNotFound(_0x2fd4b8,null))[_0xb76c('0x2a')](function(_0x5650b1){if(_0x5650b1){return _0x5650b1[_0xb76c('0x88')](_0x3b599e[_0xb76c('0x35')][_0xb76c('0x5d')])[_0xb76c('0x2a')](function(){if(_[_0xb76c('0x61')](_0x3b599e[_0xb76c('0x35')]['ids'])){for(var _0x230b07=0x0;_0x230b07<_0x3b599e['query'][_0xb76c('0x5d')][_0xb76c('0x3b')];_0x230b07+=0x1){socket[_0xb76c('0x89')]('userCmList:remove',{'UserId':Number(_0x3b599e[_0xb76c('0x35')][_0xb76c('0x5d')][_0x230b07]),'CmListId':Number(_0x3b599e[_0xb76c('0x4b')]['id'])});}}else{socket[_0xb76c('0x89')]('userCmList:remove',{'UserId':Number(_0x3b599e[_0xb76c('0x35')][_0xb76c('0x5d')]),'CmListId':Number(_0x3b599e[_0xb76c('0x4b')]['id'])});}});}})[_0xb76c('0x2a')](respondWithStatusCode(_0x2fd4b8,null))['catch'](handleError(_0x2fd4b8,null));};exports[_0xb76c('0x8a')]=function(_0x230fbc,_0x8d50a2,_0x1dbed8){var _0x3f01a3={};var _0x36e910={};var _0x15f3c9;var _0x39f01c;return db['CmList'][_0xb76c('0x59')]({'where':{'id':_0x230fbc['params']['id']}})['then'](handleEntityNotFound(_0x8d50a2,null))[_0xb76c('0x2a')](function(_0x2f5f1f){if(_0x2f5f1f){_0x15f3c9=_0x2f5f1f;_0x36e910[_0xb76c('0x38')]=_[_0xb76c('0x36')](db[_0xb76c('0x8b')][_0xb76c('0x32')]);_0x36e910[_0xb76c('0x35')]=_[_0xb76c('0x36')](_0x230fbc['query']);_0x36e910[_0xb76c('0x3e')]=_[_0xb76c('0x37')](_0x36e910[_0xb76c('0x38')],_0x36e910[_0xb76c('0x35')]);_0x3f01a3['attributes']=_[_0xb76c('0x37')](_0x36e910[_0xb76c('0x38')],qs['fields'](_0x230fbc['query'][_0xb76c('0x3a')]));_0x3f01a3['attributes']=_0x3f01a3[_0xb76c('0x39')][_0xb76c('0x3b')]?_0x3f01a3[_0xb76c('0x39')]:_0x36e910[_0xb76c('0x38')];_0x3f01a3[_0xb76c('0x5b')]=qs[_0xb76c('0x3d')](_0x230fbc[_0xb76c('0x35')][_0xb76c('0x3d')]);_0x3f01a3['where']=qs['filters'](_[_0xb76c('0x3f')](_0x230fbc[_0xb76c('0x35')],_0x36e910[_0xb76c('0x3e')]));if(_0x230fbc['query']['filter']){_0x3f01a3['where']=_[_0xb76c('0x41')](_0x3f01a3[_0xb76c('0x42')],{'$or':_[_0xb76c('0x30')](_0x3f01a3[_0xb76c('0x39')],function(_0xe04684){var _0x5559fb={};_0x5559fb[_0xe04684]={'$like':'%'+_0x230fbc['query']['filter']+'%'};return _0x5559fb;})});}_0x3f01a3=_[_0xb76c('0x41')]({},_0x3f01a3,_0x230fbc['options']);return _0x15f3c9[_0xb76c('0x8a')](_0x3f01a3);}})['then'](function(_0x3f2814){if(_0x3f2814){_0x39f01c=_0x3f2814[_0xb76c('0x3b')];if(!_0x230fbc[_0xb76c('0x35')][_0xb76c('0x6c')](_0xb76c('0x3c'))){_0x3f01a3[_0xb76c('0x23')]=qs[_0xb76c('0x23')](_0x230fbc['query'][_0xb76c('0x23')]);_0x3f01a3[_0xb76c('0x22')]=qs['offset'](_0x230fbc[_0xb76c('0x35')]['offset']);}return _0x15f3c9[_0xb76c('0x8a')](_0x3f01a3);}})[_0xb76c('0x2a')](function(_0x3b0b1d){if(_0x3b0b1d){return _0x3b0b1d?{'count':_0x39f01c,'rows':_0x3b0b1d}:null;}})[_0xb76c('0x2a')](respondWithResult(_0x8d50a2,null))[_0xb76c('0x49')](handleError(_0x8d50a2,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index e572e2b..11ed48b 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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe14b,0x93));var _0xbe14=function(_0x5f4b2f,_0x33ff64){_0x5f4b2f=_0x5f4b2f-0x0;var _0x27ccc3=_0xe14b[_0x5f4b2f];return _0x27ccc3;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x13f0d0,_0x48e6e6){var _0x411b92=function(_0x50b5f5){while(--_0x50b5f5){_0x13f0d0['push'](_0x13f0d0['shift']());}};_0x411b92(++_0x48e6e6);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 46105f1..afd4669 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 _0x55e0=['./cmList.attributes','exports','define','cm_lists','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x55e0,0xdc));var _0x055e=function(_0x2591a9,_0x46863a){_0x2591a9=_0x2591a9-0x0;var _0x2aba17=_0x55e0[_0x2591a9];return _0x2aba17;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var logger=require(_0x055e('0x2'))(_0x055e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x055e('0x4'));var fs=require('fs');var path=require(_0x055e('0x5'));var rimraf=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var attributes=require(_0x055e('0x8'));module[_0x055e('0x9')]=function(_0x490ee1,_0x5239f6){return _0x490ee1[_0x055e('0xa')]('CmList',attributes,{'tableName':_0x055e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd64b=['define','CmList','cm_lists','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x380d16,_0xdf0d31){var _0x5d5253=function(_0x7a25bc){while(--_0x7a25bc){_0x380d16['push'](_0x380d16['shift']());}};_0x5d5253(++_0xdf0d31);}(_0xd64b,0xc1));var _0xbd64=function(_0x5ed413,_0x4f26c0){_0x5ed413=_0x5ed413-0x0;var _0x3cca33=_0xd64b[_0x5ed413];return _0x3cca33;};'use strict';var _=require(_0xbd64('0x0'));var util=require('util');var logger=require(_0xbd64('0x1'))('api');var moment=require(_0xbd64('0x2'));var BPromise=require(_0xbd64('0x3'));var rp=require(_0xbd64('0x4'));var fs=require('fs');var path=require(_0xbd64('0x5'));var rimraf=require(_0xbd64('0x6'));var config=require('../../config/environment');var attributes=require('./cmList.attributes');module['exports']=function(_0x51e87d,_0x58e9e7){return _0x51e87d[_0xbd64('0x7')](_0xbd64('0x8'),attributes,{'tableName':_0xbd64('0x9'),'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 77ab18d..03ff5c5 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 _0x4a2c=['debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmList,\x20%s,\x20%s','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','localhost','socket.io-emitter','redis','./cmList.socket','register','request','then','info','request\x20sent'];(function(_0x3b3ec3,_0x14c458){var _0x1a0deb=function(_0x4641bd){while(--_0x4641bd){_0x3b3ec3['push'](_0x3b3ec3['shift']());}};_0x1a0deb(++_0x14c458);}(_0x4a2c,0x1ad));var _0xc4a2=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4a2c[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xc4a2('0x0'));var util=require('util');var moment=require(_0xc4a2('0x1'));var BPromise=require('bluebird');var rs=require(_0xc4a2('0x2'));var fs=require('fs');var Redis=require(_0xc4a2('0x3'));var db=require(_0xc4a2('0x4'))['db'];var utils=require(_0xc4a2('0x5'));var logger=require(_0xc4a2('0x6'))(_0xc4a2('0x7'));var config=require('../../config/environment');var jayson=require(_0xc4a2('0x8'));var client=jayson['client'][_0xc4a2('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xc4a2('0xa'),'port':0x18eb});var socket=require(_0xc4a2('0xb'))(new Redis(config[_0xc4a2('0xc')]));require(_0xc4a2('0xd'))[_0xc4a2('0xe')](socket);function respondWithRpcPromise(_0x45f934,_0x321b72,_0x15eaeb){return new BPromise(function(_0x508548,_0x4e6a70){return client[_0xc4a2('0xf')](_0x45f934,_0x15eaeb)[_0xc4a2('0x10')](function(_0x34ae65){logger[_0xc4a2('0x11')]('CmList,\x20%s,\x20%s',_0x321b72,_0xc4a2('0x12'));logger[_0xc4a2('0x13')](_0xc4a2('0x14'),_0x321b72,_0xc4a2('0x12'),JSON[_0xc4a2('0x15')](_0x34ae65));if(_0x34ae65['error']){if(_0x34ae65[_0xc4a2('0x16')][_0xc4a2('0x17')]===0x1f4){logger[_0xc4a2('0x16')]('CmList,\x20%s,\x20%s',_0x321b72,_0x34ae65['error'][_0xc4a2('0x18')]);return _0x4e6a70(_0x34ae65['error'][_0xc4a2('0x18')]);}logger['error'](_0xc4a2('0x19'),_0x321b72,_0x34ae65[_0xc4a2('0x16')]['message']);return _0x508548(_0x34ae65[_0xc4a2('0x16')][_0xc4a2('0x18')]);}else{logger['info']('CmList,\x20%s,\x20%s',_0x321b72,_0xc4a2('0x12'));_0x508548(_0x34ae65[_0xc4a2('0x1a')][_0xc4a2('0x18')]);}})[_0xc4a2('0x1b')](function(_0x41d0ae){logger['error'](_0xc4a2('0x19'),_0x321b72,_0x41d0ae);_0x4e6a70(_0x41d0ae);});});} \ No newline at end of file +var _0x95fd=['register','request','then','info','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmList,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','./cmList.socket'];(function(_0x2e50d7,_0xc3ff7e){var _0x21721f=function(_0xaecb8f){while(--_0xaecb8f){_0x2e50d7['push'](_0x2e50d7['shift']());}};_0x21721f(++_0xc3ff7e);}(_0x95fd,0x9a));var _0xd95f=function(_0x29dcfe,_0x47efa9){_0x29dcfe=_0x29dcfe-0x0;var _0x5089bc=_0x95fd[_0x29dcfe];return _0x5089bc;};'use strict';var _=require(_0xd95f('0x0'));var util=require(_0xd95f('0x1'));var moment=require('moment');var BPromise=require(_0xd95f('0x2'));var rs=require(_0xd95f('0x3'));var fs=require('fs');var Redis=require(_0xd95f('0x4'));var db=require(_0xd95f('0x5'))['db'];var utils=require(_0xd95f('0x6'));var logger=require(_0xd95f('0x7'))(_0xd95f('0x8'));var config=require('../../config/environment');var jayson=require(_0xd95f('0x9'));var client=jayson[_0xd95f('0xa')][_0xd95f('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd95f('0xc')]));require(_0xd95f('0xd'))[_0xd95f('0xe')](socket);function respondWithRpcPromise(_0x348f00,_0x1ac629,_0xec8c3f){return new BPromise(function(_0x27c714,_0x43f864){return client[_0xd95f('0xf')](_0x348f00,_0xec8c3f)[_0xd95f('0x10')](function(_0xcd90e6){logger[_0xd95f('0x11')]('CmList,\x20%s,\x20%s',_0x1ac629,'request\x20sent');logger[_0xd95f('0x12')](_0xd95f('0x13'),_0x1ac629,_0xd95f('0x14'),JSON[_0xd95f('0x15')](_0xcd90e6));if(_0xcd90e6[_0xd95f('0x16')]){if(_0xcd90e6[_0xd95f('0x16')][_0xd95f('0x17')]===0x1f4){logger['error'](_0xd95f('0x18'),_0x1ac629,_0xcd90e6['error'][_0xd95f('0x19')]);return _0x43f864(_0xcd90e6[_0xd95f('0x16')][_0xd95f('0x19')]);}logger['error']('CmList,\x20%s,\x20%s',_0x1ac629,_0xcd90e6[_0xd95f('0x16')][_0xd95f('0x19')]);return _0x27c714(_0xcd90e6[_0xd95f('0x16')][_0xd95f('0x19')]);}else{logger[_0xd95f('0x11')]('CmList,\x20%s,\x20%s',_0x1ac629,_0xd95f('0x14'));_0x27c714(_0xcd90e6[_0xd95f('0x1a')][_0xd95f('0x19')]);}})[_0xd95f('0x1b')](function(_0x498a79){logger[_0xd95f('0x16')]('CmList,\x20%s,\x20%s',_0x1ac629,_0x498a79);_0x43f864(_0x498a79);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index d73d113..f6a1d3a 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 _0xab35=['update','emit','removeListener','./cmList.events','save','remove'];(function(_0x28278f,_0x574b0d){var _0x3d9f74=function(_0x306742){while(--_0x306742){_0x28278f['push'](_0x28278f['shift']());}};_0x3d9f74(++_0x574b0d);}(_0xab35,0xc9));var _0x5ab3=function(_0xed4881,_0x45771c){_0xed4881=_0xed4881-0x0;var _0x7fcbd5=_0xab35[_0xed4881];return _0x7fcbd5;};'use strict';var CmListEvents=require(_0x5ab3('0x0'));var events=[_0x5ab3('0x1'),_0x5ab3('0x2'),_0x5ab3('0x3')];function createListener(_0x34cae2,_0x27c38b){return function(_0x209181){_0x27c38b[_0x5ab3('0x4')](_0x34cae2,_0x209181);};}function removeListener(_0x5d1e9f,_0xd7917a){return function(){CmListEvents[_0x5ab3('0x5')](_0x5d1e9f,_0xd7917a);};}exports['register']=function(_0x5a609b){for(var _0x8a3f26=0x0,_0x213f85=events['length'];_0x8a3f26<_0x213f85;_0x8a3f26++){var _0x1b3238=events[_0x8a3f26];var _0x2e49e9=createListener('cmList:'+_0x1b3238,_0x5a609b);CmListEvents['on'](_0x1b3238,_0x2e49e9);}}; \ No newline at end of file +var _0xb85a=['register','cmList:','save','remove','update','removeListener'];(function(_0x45316e,_0x563fdf){var _0x59e0da=function(_0x1145b0){while(--_0x1145b0){_0x45316e['push'](_0x45316e['shift']());}};_0x59e0da(++_0x563fdf);}(_0xb85a,0xb0));var _0xab85=function(_0x309d93,_0x157662){_0x309d93=_0x309d93-0x0;var _0x2dd61d=_0xb85a[_0x309d93];return _0x2dd61d;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xab85('0x0'),_0xab85('0x1'),_0xab85('0x2')];function createListener(_0x473bea,_0x93ccdd){return function(_0x4cf4dd){_0x93ccdd['emit'](_0x473bea,_0x4cf4dd);};}function removeListener(_0x359e02,_0x221883){return function(){CmListEvents[_0xab85('0x3')](_0x359e02,_0x221883);};}exports[_0xab85('0x4')]=function(_0x386c9e){for(var _0x487a2e=0x0,_0x5a54e5=events['length'];_0x487a2e<_0x5a54e5;_0x487a2e++){var _0x288033=events[_0x487a2e];var _0x2ca148=createListener(_0xab85('0x5')+_0x288033,_0x386c9e);CmListEvents['on'](_0x288033,_0x2ca148);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index ae5f7af..6dd9774 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 _0x3b42=['update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','isAuthenticated','describe','/:id/dispositions','getDispositions','/:id/contacts','getCustomFields','/:id/users','getAgents','post','addDisposition','addContacts','/:id/fields','addCustomField','/:id'];(function(_0x38f1a9,_0x59881d){var _0x3f715c=function(_0x330cf8){while(--_0x330cf8){_0x38f1a9['push'](_0x38f1a9['shift']());}};_0x3f715c(++_0x59881d);}(_0x3b42,0x18a));var _0x23b4=function(_0x56f087,_0x8bea2b){_0x56f087=_0x56f087-0x0;var _0x278e8d=_0x3b42[_0x56f087];return _0x278e8d;};'use strict';var multer=require(_0x23b4('0x0'));var util=require('util');var path=require(_0x23b4('0x1'));var timeout=require(_0x23b4('0x2'));var express=require('express');var router=express[_0x23b4('0x3')]();var fs_extra=require(_0x23b4('0x4'));var auth=require(_0x23b4('0x5'));var interaction=require(_0x23b4('0x6'));var config=require(_0x23b4('0x7'));var controller=require(_0x23b4('0x8'));router[_0x23b4('0x9')]('/',auth['isAuthenticated'](),controller[_0x23b4('0xa')]);router['get'](_0x23b4('0xb'),auth[_0x23b4('0xc')](),controller[_0x23b4('0xd')]);router[_0x23b4('0x9')]('/:id',auth[_0x23b4('0xc')](),controller['show']);router[_0x23b4('0x9')](_0x23b4('0xe'),auth[_0x23b4('0xc')](),controller[_0x23b4('0xf')]);router[_0x23b4('0x9')](_0x23b4('0x10'),auth[_0x23b4('0xc')](),controller['getContacts']);router[_0x23b4('0x9')]('/:id/contacts/csv',auth[_0x23b4('0xc')](),controller['getContactsCsv']);router[_0x23b4('0x9')]('/:id/fields',auth[_0x23b4('0xc')](),controller[_0x23b4('0x11')]);router[_0x23b4('0x9')](_0x23b4('0x12'),auth[_0x23b4('0xc')](),controller[_0x23b4('0x13')]);router['post']('/',auth[_0x23b4('0xc')](),controller['create']);router[_0x23b4('0x14')](_0x23b4('0xe'),auth[_0x23b4('0xc')](),controller[_0x23b4('0x15')]);router[_0x23b4('0x14')](_0x23b4('0x10'),auth[_0x23b4('0xc')](),controller[_0x23b4('0x16')]);router[_0x23b4('0x14')](_0x23b4('0x17'),auth['isAuthenticated'](),controller[_0x23b4('0x18')]);router['post'](_0x23b4('0x12'),auth[_0x23b4('0xc')](),controller['addAgents']);router['put'](_0x23b4('0x19'),auth[_0x23b4('0xc')](),controller[_0x23b4('0x1a')]);router[_0x23b4('0x1b')](_0x23b4('0x19'),auth[_0x23b4('0xc')](),controller[_0x23b4('0x1c')]);router[_0x23b4('0x1b')](_0x23b4('0xe'),auth[_0x23b4('0xc')](),controller['removeDispositions']);router[_0x23b4('0x1b')](_0x23b4('0x12'),auth[_0x23b4('0xc')](),controller['removeAgents']);module[_0x23b4('0x1d')]=router; \ No newline at end of file +var _0xd42a=['post','create','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','util','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','get','/describe','describe','/:id','/:id/dispositions','/:id/contacts','getContacts','/:id/fields','getCustomFields','/:id/users'];(function(_0x1dd72b,_0x3b9cec){var _0x16bf8e=function(_0x13c2a5){while(--_0x13c2a5){_0x1dd72b['push'](_0x1dd72b['shift']());}};_0x16bf8e(++_0x3b9cec);}(_0xd42a,0x178));var _0xad42=function(_0x2e6857,_0x5cbea5){_0x2e6857=_0x2e6857-0x0;var _0x536755=_0xd42a[_0x2e6857];return _0x536755;};'use strict';var multer=require('multer');var util=require(_0xad42('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xad42('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0xad42('0x2'));var config=require(_0xad42('0x3'));var controller=require(_0xad42('0x4'));router['get']('/',auth[_0xad42('0x5')](),controller['index']);router[_0xad42('0x6')](_0xad42('0x7'),auth[_0xad42('0x5')](),controller[_0xad42('0x8')]);router[_0xad42('0x6')](_0xad42('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xad42('0x6')](_0xad42('0xa'),auth[_0xad42('0x5')](),controller['getDispositions']);router[_0xad42('0x6')](_0xad42('0xb'),auth['isAuthenticated'](),controller[_0xad42('0xc')]);router['get']('/:id/contacts/csv',auth[_0xad42('0x5')](),controller['getContactsCsv']);router[_0xad42('0x6')](_0xad42('0xd'),auth[_0xad42('0x5')](),controller[_0xad42('0xe')]);router[_0xad42('0x6')](_0xad42('0xf'),auth[_0xad42('0x5')](),controller['getAgents']);router[_0xad42('0x10')]('/',auth[_0xad42('0x5')](),controller[_0xad42('0x11')]);router[_0xad42('0x10')](_0xad42('0xa'),auth[_0xad42('0x5')](),controller[_0xad42('0x12')]);router['post']('/:id/contacts',auth[_0xad42('0x5')](),controller[_0xad42('0x13')]);router[_0xad42('0x10')]('/:id/fields',auth[_0xad42('0x5')](),controller[_0xad42('0x14')]);router[_0xad42('0x10')](_0xad42('0xf'),auth[_0xad42('0x5')](),controller[_0xad42('0x15')]);router[_0xad42('0x16')]('/:id',auth[_0xad42('0x5')](),controller[_0xad42('0x17')]);router[_0xad42('0x18')](_0xad42('0x9'),auth['isAuthenticated'](),controller[_0xad42('0x19')]);router[_0xad42('0x18')](_0xad42('0xa'),auth[_0xad42('0x5')](),controller['removeDispositions']);router[_0xad42('0x18')](_0xad42('0xf'),auth['isAuthenticated'](),controller[_0xad42('0x1a')]);module[_0xad42('0x1b')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 1f8149d..d14e9e8 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 _0xe86b=['getDataValue','field','STRING','sequelize','exports','VIRTUAL'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe86b,0x129));var _0xbe86=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe86b[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xbe86('0x0'));module[_0xbe86('0x1')]={'name':{'type':Sequelize[_0xbe86('0x2')],'get':function(_0xd4b341){return this[_0xbe86('0x3')](_0xbe86('0x4'));}},'field':{'type':Sequelize[_0xbe86('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0xbe86('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0xbe86('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0xcc82=['sequelize','exports','VIRTUAL','getDataValue','field','STRING'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0xcc82,0xb4));var _0x2cc8=function(_0x770f7,_0x3af003){_0x770f7=_0x770f7-0x0;var _0xe797c6=_0xcc82[_0x770f7];return _0xe797c6;};'use strict';var Sequelize=require(_0x2cc8('0x0'));module[_0x2cc8('0x1')]={'name':{'type':Sequelize[_0x2cc8('0x2')],'get':function(_0x246b93){return this[_0x2cc8('0x3')](_0x2cc8('0x4'));}},'field':{'type':Sequelize[_0x2cc8('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x2cc8('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x2cc8('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 1498346..9357309 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(_0x47372b,_0x2a3164){var _0x25b594=function(_0x5b5877){while(--_0x5b5877){_0x47372b['push'](_0x47372b['shift']());}};_0x25b594(++_0x2a3164);}(_0x7a54,0x106));var _0x47a5=function(_0x380e80,_0x118915){_0x380e80=_0x380e80-0x0;var _0x52e971=_0x7a54[_0x380e80];return _0x52e971;};'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(_0x462d57,_0x159833){var _0x369e89=function(_0x5032a0){while(--_0x5032a0){_0x462d57['push'](_0x462d57['shift']());}};_0x369e89(++_0x159833);}(_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 b7ffb39..865103c 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 _0x6653=['../../config/environment','define','Condition','tools_conditions','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4f2ab9,_0xacf272){var _0x2f22e1=function(_0x237cad){while(--_0x237cad){_0x4f2ab9['push'](_0x4f2ab9['shift']());}};_0x2f22e1(++_0xacf272);}(_0x6653,0x86));var _0x3665=function(_0x5840df,_0x59493d){_0x5840df=_0x5840df-0x0;var _0x1f5108=_0x6653[_0x5840df];return _0x1f5108;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3665('0x0'))(_0x3665('0x1'));var moment=require(_0x3665('0x2'));var BPromise=require(_0x3665('0x3'));var rp=require(_0x3665('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3665('0x5'));var config=require(_0x3665('0x6'));var attributes=require('./condition.attributes');module['exports']=function(_0x341511,_0x244a88){return _0x341511[_0x3665('0x7')](_0x3665('0x8'),attributes,{'tableName':_0x3665('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2ee=['api','moment','bluebird','path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util'];(function(_0x8769a7,_0x325064){var _0x5db797=function(_0x4838c8){while(--_0x4838c8){_0x8769a7['push'](_0x8769a7['shift']());}};_0x5db797(++_0x325064);}(_0xb2ee,0x8d));var _0xeb2e=function(_0x3a42a3,_0xe54681){_0x3a42a3=_0x3a42a3-0x0;var _0x59d5bd=_0xb2ee[_0x3a42a3];return _0x59d5bd;};'use strict';var _=require(_0xeb2e('0x0'));var util=require(_0xeb2e('0x1'));var logger=require('../../config/logger')(_0xeb2e('0x2'));var moment=require(_0xeb2e('0x3'));var BPromise=require(_0xeb2e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb2e('0x5'));var rimraf=require(_0xeb2e('0x6'));var config=require(_0xeb2e('0x7'));var attributes=require(_0xeb2e('0x8'));module[_0xeb2e('0x9')]=function(_0x32f331,_0x555fd5){return _0x32f331[_0xeb2e('0xa')](_0xeb2e('0xb'),attributes,{'tableName':_0xeb2e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index be1d7bd..1a51c2c 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 _0x2ad1=['error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x29c504,_0x5ce9aa){var _0x138d10=function(_0x2adacd){while(--_0x2adacd){_0x29c504['push'](_0x29c504['shift']());}};_0x138d10(++_0x5ce9aa);}(_0x2ad1,0x165));var _0x12ad=function(_0x4091fb,_0x50eb1d){_0x4091fb=_0x4091fb-0x0;var _0x651e3e=_0x2ad1[_0x4091fb];return _0x651e3e;};'use strict';var _=require(_0x12ad('0x0'));var util=require('util');var moment=require(_0x12ad('0x1'));var BPromise=require(_0x12ad('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x12ad('0x3'));var db=require(_0x12ad('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x12ad('0x5'))(_0x12ad('0x6'));var config=require(_0x12ad('0x7'));var jayson=require(_0x12ad('0x8'));var client=jayson[_0x12ad('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40b1b0,_0x166127,_0x54e086){return new BPromise(function(_0x28d339,_0x292839){return client[_0x12ad('0xa')](_0x40b1b0,_0x54e086)[_0x12ad('0xb')](function(_0x496470){logger[_0x12ad('0xc')](_0x12ad('0xd'),_0x166127,'request\x20sent');logger[_0x12ad('0xe')](_0x12ad('0xf'),_0x166127,_0x12ad('0x10'),JSON['stringify'](_0x496470));if(_0x496470[_0x12ad('0x11')]){if(_0x496470[_0x12ad('0x11')][_0x12ad('0x12')]===0x1f4){logger[_0x12ad('0x11')](_0x12ad('0xd'),_0x166127,_0x496470['error']['message']);return _0x292839(_0x496470[_0x12ad('0x11')][_0x12ad('0x13')]);}logger['error']('Condition,\x20%s,\x20%s',_0x166127,_0x496470[_0x12ad('0x11')]['message']);return _0x28d339(_0x496470[_0x12ad('0x11')][_0x12ad('0x13')]);}else{logger[_0x12ad('0xc')](_0x12ad('0xd'),_0x166127,_0x12ad('0x10'));_0x28d339(_0x496470[_0x12ad('0x14')][_0x12ad('0x13')]);}})[_0x12ad('0x15')](function(_0x5edfcf){logger[_0x12ad('0x11')]('Condition,\x20%s,\x20%s',_0x166127,_0x5edfcf);_0x292839(_0x5edfcf);});});} \ No newline at end of file +var _0x4a56=['request','then','info','Condition,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x18da58,_0x46f2cf){var _0x37e602=function(_0x4d05ad){while(--_0x4d05ad){_0x18da58['push'](_0x18da58['shift']());}};_0x37e602(++_0x46f2cf);}(_0x4a56,0x19a));var _0x64a5=function(_0x13f14d,_0x314e5c){_0x13f14d=_0x13f14d-0x0;var _0xac647b=_0x4a56[_0x13f14d];return _0xac647b;};'use strict';var _=require(_0x64a5('0x0'));var util=require(_0x64a5('0x1'));var moment=require(_0x64a5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x64a5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x64a5('0x4'));var logger=require(_0x64a5('0x5'))(_0x64a5('0x6'));var config=require(_0x64a5('0x7'));var jayson=require(_0x64a5('0x8'));var client=jayson[_0x64a5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30f594,_0x3b4636,_0x3aae22){return new BPromise(function(_0xa21fae,_0x2aa0b7){return client[_0x64a5('0xa')](_0x30f594,_0x3aae22)[_0x64a5('0xb')](function(_0x238ca1){logger[_0x64a5('0xc')](_0x64a5('0xd'),_0x3b4636,'request\x20sent');logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x3b4636,_0x64a5('0xe'),JSON[_0x64a5('0xf')](_0x238ca1));if(_0x238ca1[_0x64a5('0x10')]){if(_0x238ca1[_0x64a5('0x10')][_0x64a5('0x11')]===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x3b4636,_0x238ca1[_0x64a5('0x10')]['message']);return _0x2aa0b7(_0x238ca1[_0x64a5('0x10')]['message']);}logger[_0x64a5('0x10')](_0x64a5('0xd'),_0x3b4636,_0x238ca1[_0x64a5('0x10')][_0x64a5('0x12')]);return _0xa21fae(_0x238ca1[_0x64a5('0x10')]['message']);}else{logger[_0x64a5('0xc')](_0x64a5('0xd'),_0x3b4636,_0x64a5('0xe'));_0xa21fae(_0x238ca1['result'][_0x64a5('0x12')]);}})[_0x64a5('0x13')](function(_0x158c2d){logger[_0x64a5('0x10')]('Condition,\x20%s,\x20%s',_0x3b4636,_0x158c2d);_0x2aa0b7(_0x158c2d);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 26abd9e..763f8d4 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 _0x9d41=['update','delete','/:id','isAuthenticated','destroy','multer','path','connect-timeout','../../components/auth/service','../../config/environment','./condition.controller'];(function(_0x287795,_0x37bc44){var _0x594dde=function(_0xa48627){while(--_0xa48627){_0x287795['push'](_0x287795['shift']());}};_0x594dde(++_0x37bc44);}(_0x9d41,0x139));var _0x19d4=function(_0x2e5f0e,_0x3977cd){_0x2e5f0e=_0x2e5f0e-0x0;var _0x44ef55=_0x9d41[_0x2e5f0e];return _0x44ef55;};'use strict';var multer=require(_0x19d4('0x0'));var util=require('util');var path=require(_0x19d4('0x1'));var timeout=require(_0x19d4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x19d4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x19d4('0x4'));var controller=require(_0x19d4('0x5'));router['put']('/:id',auth['isAuthenticated'](),controller[_0x19d4('0x6')]);router[_0x19d4('0x7')](_0x19d4('0x8'),auth[_0x19d4('0x9')](),controller[_0x19d4('0xa')]);module['exports']=router; \ No newline at end of file +var _0x1650=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','/:id','isAuthenticated','exports','util'];(function(_0x52a257,_0x471c60){var _0x35fae7=function(_0x4e52d5){while(--_0x4e52d5){_0x52a257['push'](_0x52a257['shift']());}};_0x35fae7(++_0x471c60);}(_0x1650,0xf1));var _0x0165=function(_0x5067db,_0xf8d2f2){_0x5067db=_0x5067db-0x0;var _0x2771e4=_0x1650[_0x5067db];return _0x2771e4;};'use strict';var multer=require('multer');var util=require(_0x0165('0x0'));var path=require(_0x0165('0x1'));var timeout=require(_0x0165('0x2'));var express=require('express');var router=express[_0x0165('0x3')]();var fs_extra=require(_0x0165('0x4'));var auth=require(_0x0165('0x5'));var interaction=require(_0x0165('0x6'));var config=require('../../config/environment');var controller=require(_0x0165('0x7'));router['put'](_0x0165('0x8'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0165('0x8'),auth[_0x0165('0x9')](),controller['destroy']);module[_0x0165('0xa')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index daa5745..ee514e9 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['STRING','sequelize','exports'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xe706,0xa3));var _0x6e70=function(_0x3c60fc,_0x593ef5){_0x3c60fc=_0x3c60fc-0x0;var _0x495fd2=_0xe706[_0x3c60fc];return _0x495fd2;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xb7e7[_0x2a6809];return _0x11c371;};'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/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 022c04d..204c0bd 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 _0xa4da=['params','iframe','attrUrl','attrs','https://','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','findOne','getItems','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./dashboard.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','get','UserProfileResource','error','name','index','Dashboard','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','catch','show','rawAttributes','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','userProfileId','clone','omit','updatedAt','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x34cb85,_0x169fc7){var _0x1c1654=function(_0x55fffc){while(--_0x55fffc){_0x34cb85['push'](_0x34cb85['shift']());}};_0x1c1654(++_0x169fc7);}(_0xa4da,0xaa));var _0xaa4d=function(_0x42bd43,_0x59fb77){_0x42bd43=_0x42bd43-0x0;var _0x421e88=_0xa4da[_0x42bd43];return _0x421e88;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa4d('0x0'));var zipdir=require(_0xaa4d('0x1'));var jsonpatch=require(_0xaa4d('0x2'));var rp=require(_0xaa4d('0x3'));var moment=require(_0xaa4d('0x4'));var BPromise=require(_0xaa4d('0x5'));var Mustache=require('mustache');var util=require(_0xaa4d('0x6'));var path=require(_0xaa4d('0x7'));var sox=require('sox');var csv=require(_0xaa4d('0x8'));var ejs=require(_0xaa4d('0x9'));var fs=require('fs');var fs_extra=require(_0xaa4d('0xa'));var _=require(_0xaa4d('0xb'));var squel=require(_0xaa4d('0xc'));var crypto=require('crypto');var jsforce=require(_0xaa4d('0xd'));var deskjs=require(_0xaa4d('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaa4d('0xf'));var Redis=require(_0xaa4d('0x10'));var authService=require(_0xaa4d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xaa4d('0x12'));var hardwareService=require(_0xaa4d('0x13'));var logger=require(_0xaa4d('0x14'))(_0xaa4d('0x15'));var utils=require('../../config/utils');var config=require(_0xaa4d('0x16'));var licenseUtil=require(_0xaa4d('0x17'));var db=require(_0xaa4d('0x18'))['db'];config['redis']=_[_0xaa4d('0x19')](config[_0xaa4d('0x1a')],{'host':_0xaa4d('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa4d('0x1a')]));require(_0xaa4d('0x1c'))[_0xaa4d('0x1d')](socket);function respondWithStatusCode(_0xf69798,_0x457063){_0x457063=_0x457063||0xcc;return function(_0x3e7046){if(_0x3e7046){return _0xf69798[_0xaa4d('0x1e')](_0x457063);}return _0xf69798['status'](_0x457063)[_0xaa4d('0x1f')]();};}function respondWithResult(_0x1dc055,_0x5aae99){_0x5aae99=_0x5aae99||0xc8;return function(_0x3b567a){if(_0x3b567a){return _0x1dc055[_0xaa4d('0x20')](_0x5aae99)[_0xaa4d('0x21')](_0x3b567a);}};}function respondWithFilteredResult(_0x19659f,_0x3e33c4){return function(_0x552de2){if(_0x552de2){var _0x1344ab=typeof _0x3e33c4[_0xaa4d('0x22')]===_0xaa4d('0x23')&&typeof _0x3e33c4[_0xaa4d('0x24')]===_0xaa4d('0x23');var _0x1f31ee=_0x552de2[_0xaa4d('0x25')];var _0x4cb3f2=_0x1344ab?0x0:_0x3e33c4[_0xaa4d('0x22')];var _0x39052e=_0x1344ab?_0x552de2[_0xaa4d('0x25')]:_0x3e33c4['offset']+_0x3e33c4[_0xaa4d('0x24')];var _0x45a0b6;if(_0x39052e>=_0x1f31ee){_0x39052e=_0x1f31ee;_0x45a0b6=0xc8;}else{_0x45a0b6=0xce;}_0x19659f['status'](_0x45a0b6);return _0x19659f[_0xaa4d('0x26')]('Content-Range',_0x4cb3f2+'-'+_0x39052e+'/'+_0x1f31ee)[_0xaa4d('0x21')](_0x552de2);}return null;};}function patchUpdates(_0x300ba9){return function(_0x1fb8d2){try{jsonpatch[_0xaa4d('0x27')](_0x1fb8d2,_0x300ba9,!![]);}catch(_0x5430ca){return BPromise[_0xaa4d('0x28')](_0x5430ca);}return _0x1fb8d2['save']();};}function saveUpdates(_0x9c5478,_0x5c5778){return function(_0x346433){if(_0x346433){return _0x346433[_0xaa4d('0x29')](_0x9c5478)['then'](function(_0x56169){return _0x56169;});}return null;};}function removeEntity(_0x2d52db,_0x5131df){return function(_0x10b4f9){if(_0x10b4f9){return _0x10b4f9[_0xaa4d('0x2a')]()[_0xaa4d('0x2b')](function(){var _0x10ae75=_0x10b4f9[_0xaa4d('0x2c')]({'plain':!![]});var _0x581fe0='CustomDashboards';return db[_0xaa4d('0x2d')][_0xaa4d('0x2a')]({'where':{'type':_0x581fe0,'resourceId':_0x10ae75['id']}})[_0xaa4d('0x2b')](function(){return _0x10b4f9;});})[_0xaa4d('0x2b')](function(){_0x2d52db['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x480acd,_0xcb1f45){return function(_0x2698d7){if(!_0x2698d7){_0x480acd[_0xaa4d('0x1e')](0x194);}return _0x2698d7;};}function handleError(_0x2cf26c,_0x22220d){_0x22220d=_0x22220d||0x1f4;return function(_0x3c8ad2){logger[_0xaa4d('0x2e')](_0x3c8ad2['stack']);if(_0x3c8ad2[_0xaa4d('0x2f')]){delete _0x3c8ad2['name'];}_0x2cf26c[_0xaa4d('0x20')](_0x22220d)['send'](_0x3c8ad2);};}exports[_0xaa4d('0x30')]=function(_0x362f40,_0x38c37e){var _0x5c859c={},_0x5b1306={},_0x531055={'count':0x0,'rows':[]};var _0x13ebce=_['map'](db[_0xaa4d('0x31')]['rawAttributes'],function(_0x236757){return{'name':_0x236757[_0xaa4d('0x32')],'type':_0x236757['type'][_0xaa4d('0x33')]};});_0x5b1306[_0xaa4d('0x34')]=_[_0xaa4d('0x35')](_0x13ebce,_0xaa4d('0x2f'));_0x5b1306[_0xaa4d('0x36')]=_[_0xaa4d('0x37')](_0x362f40[_0xaa4d('0x36')]);_0x5b1306[_0xaa4d('0x38')]=_['intersection'](_0x5b1306['model'],_0x5b1306[_0xaa4d('0x36')]);_0x5c859c[_0xaa4d('0x39')]=_[_0xaa4d('0x3a')](_0x5b1306[_0xaa4d('0x34')],qs[_0xaa4d('0x3b')](_0x362f40[_0xaa4d('0x36')][_0xaa4d('0x3b')]));_0x5c859c[_0xaa4d('0x39')]=_0x5c859c[_0xaa4d('0x39')][_0xaa4d('0x3c')]?_0x5c859c[_0xaa4d('0x39')]:_0x5b1306[_0xaa4d('0x34')];if(!_0x362f40[_0xaa4d('0x36')][_0xaa4d('0x3d')](_0xaa4d('0x3e'))){_0x5c859c[_0xaa4d('0x24')]=qs['limit'](_0x362f40['query']['limit']);_0x5c859c['offset']=qs[_0xaa4d('0x22')](_0x362f40[_0xaa4d('0x36')][_0xaa4d('0x22')]);}_0x5c859c[_0xaa4d('0x3f')]=qs[_0xaa4d('0x40')](_0x362f40[_0xaa4d('0x36')][_0xaa4d('0x40')]);_0x5c859c[_0xaa4d('0x41')]=qs[_0xaa4d('0x38')](_[_0xaa4d('0x42')](_0x362f40[_0xaa4d('0x36')],_0x5b1306[_0xaa4d('0x38')]),_0x13ebce);if(_0x362f40[_0xaa4d('0x36')]['filter']){_0x5c859c['where']=_[_0xaa4d('0x43')](_0x5c859c[_0xaa4d('0x41')],{'$or':_['map'](_0x13ebce,function(_0xe86892){if(_0xe86892['type']!=='VIRTUAL'){var _0x26b38b={};_0x26b38b[_0xe86892['name']]={'$like':'%'+_0x362f40[_0xaa4d('0x36')][_0xaa4d('0x44')]+'%'};return _0x26b38b;}})});}_0x5c859c=_[_0xaa4d('0x43')]({},_0x5c859c,_0x362f40[_0xaa4d('0x45')]);var _0x4fb7d2={'where':_0x5c859c[_0xaa4d('0x41')]};return db[_0xaa4d('0x31')][_0xaa4d('0x25')](_0x4fb7d2)['then'](function(_0x3ac8bc){_0x531055[_0xaa4d('0x25')]=_0x3ac8bc;if(_0x362f40[_0xaa4d('0x36')]['includeAll']){_0x5c859c['include']=[{'all':!![]}];}return db[_0xaa4d('0x31')]['findAll'](_0x5c859c);})[_0xaa4d('0x2b')](function(_0x48f819){_0x531055['rows']=_0x48f819;return _0x531055;})[_0xaa4d('0x2b')](respondWithFilteredResult(_0x38c37e,_0x5c859c))[_0xaa4d('0x46')](handleError(_0x38c37e,null));};exports[_0xaa4d('0x47')]=function(_0x352469,_0x206f9c){var _0x56a377={'raw':![],'where':{'id':_0x352469['params']['id']}},_0x4c44eb={};_0x4c44eb['model']=_[_0xaa4d('0x37')](db['Dashboard'][_0xaa4d('0x48')]);_0x4c44eb[_0xaa4d('0x36')]=_[_0xaa4d('0x37')](_0x352469[_0xaa4d('0x36')]);_0x4c44eb[_0xaa4d('0x38')]=_[_0xaa4d('0x3a')](_0x4c44eb[_0xaa4d('0x34')],_0x4c44eb[_0xaa4d('0x36')]);_0x56a377[_0xaa4d('0x39')]=_['intersection'](_0x4c44eb[_0xaa4d('0x34')],qs[_0xaa4d('0x3b')](_0x352469[_0xaa4d('0x36')][_0xaa4d('0x3b')]));_0x56a377[_0xaa4d('0x39')]=_0x56a377[_0xaa4d('0x39')][_0xaa4d('0x3c')]?_0x56a377['attributes']:_0x4c44eb[_0xaa4d('0x34')];if(_0x352469[_0xaa4d('0x36')][_0xaa4d('0x49')]){_0x56a377[_0xaa4d('0x4a')]=[{'all':!![]}];}_0x56a377=_['merge']({},_0x56a377,_0x352469[_0xaa4d('0x45')]);return db[_0xaa4d('0x31')][_0xaa4d('0x4b')](_0x56a377)[_0xaa4d('0x2b')](handleEntityNotFound(_0x206f9c,null))['then'](respondWithResult(_0x206f9c,null))[_0xaa4d('0x46')](handleError(_0x206f9c,null));};exports['create']=function(_0x14357c,_0x533171){return db['Dashboard'][_0xaa4d('0x4c')](_0x14357c[_0xaa4d('0x4d')],{})[_0xaa4d('0x2b')](function(_0x4adca2){var _0x1bdbcf=_0x14357c[_0xaa4d('0x4e')][_0xaa4d('0x2c')]({'plain':!![]});if(!_0x1bdbcf)throw new Error(_0xaa4d('0x4f'));if(_0x1bdbcf[_0xaa4d('0x50')]===_0xaa4d('0x4e')){var _0x2dbedf=_0x4adca2[_0xaa4d('0x2c')]({'plain':!![]});var _0x2c70c8=_0xaa4d('0x51');return db['UserProfileSection'][_0xaa4d('0x4b')]({'where':{'name':_0x2c70c8,'userProfileId':_0x1bdbcf[_0xaa4d('0x52')]},'raw':!![]})[_0xaa4d('0x2b')](function(_0x27f6f4){if(_0x27f6f4&&_0x27f6f4['autoAssociation']===0x0){return db[_0xaa4d('0x2d')][_0xaa4d('0x4c')]({'name':_0x2dbedf[_0xaa4d('0x2f')],'resourceId':_0x2dbedf['id'],'type':_0x27f6f4[_0xaa4d('0x2f')],'sectionId':_0x27f6f4['id']},{})[_0xaa4d('0x2b')](function(){return _0x4adca2;});}else{return _0x4adca2;}})[_0xaa4d('0x46')](function(_0x2a91c1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a91c1);throw _0x2a91c1;});}return _0x4adca2;})[_0xaa4d('0x2b')](respondWithResult(_0x533171,0xc9))['catch'](handleError(_0x533171,null));};exports[_0xaa4d('0x53')]=function(_0x574e6e,_0x4d96c9){var _0x254b49={'where':{'id':_0x574e6e['params']['id']}},_0x4f50bd={};_0x4f50bd[_0xaa4d('0x34')]=_[_0xaa4d('0x37')](db[_0xaa4d('0x31')][_0xaa4d('0x48')]);_0x254b49['attributes']=_[_0xaa4d('0x3a')](_0x4f50bd[_0xaa4d('0x34')],qs[_0xaa4d('0x3b')](_0x574e6e['query'][_0xaa4d('0x3b')]));_0x254b49['attributes']=_0x254b49[_0xaa4d('0x39')][_0xaa4d('0x3c')]?_0x254b49[_0xaa4d('0x39')]:_0x4f50bd[_0xaa4d('0x34')];if(_0x574e6e[_0xaa4d('0x36')][_0xaa4d('0x49')]){_0x254b49['include']=[{'all':!![]}];}_0x254b49=_[_0xaa4d('0x43')]({},_0x254b49,_0x574e6e['options']);return db[_0xaa4d('0x31')]['find'](_0x254b49)['then'](handleEntityNotFound(_0x4d96c9,null))[_0xaa4d('0x2b')](function(_0x302b40){if(_0x302b40){var _0x17cb49=_0x302b40[_0xaa4d('0x2c')]({'plain':!![]});_0x17cb49=qs[_0xaa4d('0x54')](_0x17cb49,['id','createdAt',_0xaa4d('0x55')]);_0x574e6e[_0xaa4d('0x4d')]=_[_0xaa4d('0x54')](_0x574e6e[_0xaa4d('0x4d')],['id','createdAt',_0xaa4d('0x55')]);return db[_0xaa4d('0x31')][_0xaa4d('0x4c')](_['merge'](_0x17cb49,_0x574e6e['body']),{'include':_0x574e6e[_0xaa4d('0x36')][_0xaa4d('0x49')]?[{'all':!![]}]:undefined})[_0xaa4d('0x2b')](function(_0x32174a){var _0x4b9fe6=_0x574e6e['user'][_0xaa4d('0x2c')]({'plain':!![]});if(!_0x4b9fe6)throw new Error(_0xaa4d('0x4f'));if(_0x4b9fe6[_0xaa4d('0x50')]===_0xaa4d('0x4e')){var _0x1d6959=_0x32174a[_0xaa4d('0x2c')]({'plain':!![]});var _0x40bf30=_0xaa4d('0x51');return db[_0xaa4d('0x56')]['find']({'where':{'name':_0x40bf30,'userProfileId':_0x4b9fe6[_0xaa4d('0x52')]},'raw':!![]})[_0xaa4d('0x2b')](function(_0x242c31){if(_0x242c31&&_0x242c31['autoAssociation']===0x0){return db[_0xaa4d('0x2d')][_0xaa4d('0x4c')]({'name':_0x1d6959[_0xaa4d('0x2f')],'resourceId':_0x1d6959['id'],'type':_0x242c31[_0xaa4d('0x2f')],'sectionId':_0x242c31['id']},{})[_0xaa4d('0x2b')](function(){return _0x32174a;});}else{return _0x32174a;}})[_0xaa4d('0x46')](function(_0x51e287){logger[_0xaa4d('0x2e')](_0xaa4d('0x57'),_0x51e287);throw _0x51e287;});}return _0x32174a;});}})[_0xaa4d('0x2b')](respondWithResult(_0x4d96c9,0xc9))[_0xaa4d('0x46')](handleError(_0x4d96c9,null));};exports[_0xaa4d('0x29')]=function(_0x8ea82b,_0x596229){if(_0x8ea82b[_0xaa4d('0x4d')]['id']){delete _0x8ea82b['body']['id'];}return db[_0xaa4d('0x31')][_0xaa4d('0x4b')]({'where':{'id':_0x8ea82b[_0xaa4d('0x58')]['id']}})[_0xaa4d('0x2b')](handleEntityNotFound(_0x596229,null))[_0xaa4d('0x2b')](saveUpdates(_0x8ea82b['body'],null))[_0xaa4d('0x2b')](respondWithResult(_0x596229,null))[_0xaa4d('0x46')](handleError(_0x596229,null));};exports['destroy']=function(_0x4e7757,_0x4e11ca){return db[_0xaa4d('0x31')][_0xaa4d('0x4b')]({'where':{'id':_0x4e7757[_0xaa4d('0x58')]['id']}})[_0xaa4d('0x2b')](handleEntityNotFound(_0x4e11ca,null))[_0xaa4d('0x2b')](removeEntity(_0x4e11ca,null))[_0xaa4d('0x46')](handleError(_0x4e11ca,null));};function widgetAttributes(_0x5db204){try{switch(_0x5db204['type']){case _0xaa4d('0x59'):return[{'name':_0xaa4d('0x5a'),'value':_0x5db204[_0xaa4d('0x5a')]||(_0x5db204[_0xaa4d('0x5b')]&&_0x5db204[_0xaa4d('0x5b')][0x0]?_0x5db204[_0xaa4d('0x5b')][0x0]['value']:undefined)||_0xaa4d('0x5c')}];case'custom':return[{'name':_0xaa4d('0x5d'),'value':_0x5db204['attrPath']||(_0x5db204[_0xaa4d('0x5b')]&&_0x5db204['attrs'][0x0]?_0x5db204['attrs'][0x0][_0xaa4d('0x5e')]:undefined)||''}];case'clock':return[{'name':_0xaa4d('0x5f'),'value':_0x5db204[_0xaa4d('0x5f')]||(_0x5db204['attrs']&&_0x5db204['attrs'][0x0]?_0x5db204[_0xaa4d('0x5b')][0x0]['value']:undefined)||_0xaa4d('0x60')},{'name':_0xaa4d('0x61'),'value':_0x5db204[_0xaa4d('0x61')]||(_0x5db204[_0xaa4d('0x5b')]&&_0x5db204['attrs'][0x1]?_0x5db204[_0xaa4d('0x5b')][0x1][_0xaa4d('0x5e')]:undefined)||_0xaa4d('0x62')},{'name':_0xaa4d('0x63'),'value':_0x5db204['attrFontSize']||(_0x5db204['attrs']&&_0x5db204['attrs'][0x2]?_0x5db204[_0xaa4d('0x5b')][0x2][_0xaa4d('0x5e')]:undefined)||0xc}];case _0xaa4d('0x64'):return[{'name':_0xaa4d('0x65'),'value':_0x5db204['attrMetric']||(_0x5db204[_0xaa4d('0x5b')]&&_0x5db204[_0xaa4d('0x5b')][0x0]?_0x5db204[_0xaa4d('0x5b')][0x0]['value']:undefined)||_0xaa4d('0x66')},{'name':_0xaa4d('0x67'),'value':_0x5db204[_0xaa4d('0x67')]||(_0x5db204[_0xaa4d('0x5b')]&&_0x5db204['attrs'][0x1]?_0x5db204[_0xaa4d('0x5b')][0x1][_0xaa4d('0x5e')]:undefined)||[]},{'name':_0xaa4d('0x63'),'value':_0x5db204[_0xaa4d('0x63')]||(_0x5db204['attrs']&&_0x5db204['attrs'][0x2]?_0x5db204[_0xaa4d('0x5b')][0x2][_0xaa4d('0x5e')]:undefined)||0x14},{'name':'attrChannel','value':_0x5db204[_0xaa4d('0x68')]||(_0x5db204[_0xaa4d('0x5b')]&&_0x5db204['attrs'][0x3]?_0x5db204['attrs'][0x3][_0xaa4d('0x5e')]:undefined)||_0xaa4d('0x69')},{'name':_0xaa4d('0x6a'),'value':_0x5db204[_0xaa4d('0x6a')]||(_0x5db204[_0xaa4d('0x5b')]&&_0x5db204['attrs'][0x4]?_0x5db204['attrs'][0x4][_0xaa4d('0x5e')]:undefined)||''},{'name':_0xaa4d('0x6b'),'value':_0x5db204[_0xaa4d('0x6b')]||(_0x5db204[_0xaa4d('0x5b')]&&_0x5db204[_0xaa4d('0x5b')][0x5]?_0x5db204[_0xaa4d('0x5b')][0x5][_0xaa4d('0x5e')]:undefined)||''},{'name':_0xaa4d('0x6c'),'value':_0x5db204[_0xaa4d('0x6c')]||(_0x5db204[_0xaa4d('0x5b')]&&_0x5db204[_0xaa4d('0x5b')][0x6]?_0x5db204[_0xaa4d('0x5b')][0x6][_0xaa4d('0x5e')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5db204[_0xaa4d('0x6d')]||(_0x5db204['attrs']&&_0x5db204[_0xaa4d('0x5b')][0x7]?_0x5db204[_0xaa4d('0x5b')][0x7][_0xaa4d('0x5e')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5db204[_0xaa4d('0x6e')]||(_0x5db204[_0xaa4d('0x5b')]&&_0x5db204[_0xaa4d('0x5b')][0x8]?_0x5db204[_0xaa4d('0x5b')][0x8][_0xaa4d('0x5e')]:undefined)||''},{'name':'attrChatWebsites','value':_0x5db204[_0xaa4d('0x6f')]||(_0x5db204['attrs']&&_0x5db204[_0xaa4d('0x5b')][0x9]?_0x5db204['attrs'][0x9][_0xaa4d('0x5e')]:undefined)||''}];case _0xaa4d('0x70'):case _0xaa4d('0x71'):return[{'name':_0xaa4d('0x72'),'value':_0x5db204[_0xaa4d('0x72')]||(_0x5db204[_0xaa4d('0x5b')]&&_0x5db204[_0xaa4d('0x5b')][0x0]?_0x5db204['attrs'][0x0][_0xaa4d('0x5e')]:undefined)||_0xaa4d('0x66')},{'name':_0xaa4d('0x73'),'value':_0x5db204['attrSerie2']||(_0x5db204[_0xaa4d('0x5b')]&&_0x5db204['attrs'][0x1]?_0x5db204['attrs'][0x1][_0xaa4d('0x5e')]:undefined)||null},{'name':_0xaa4d('0x74'),'value':_0x5db204[_0xaa4d('0x74')]||(_0x5db204[_0xaa4d('0x5b')]&&_0x5db204[_0xaa4d('0x5b')][0x2]?_0x5db204['attrs'][0x2][_0xaa4d('0x5e')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x5db204[_0xaa4d('0x67')]||(_0x5db204[_0xaa4d('0x5b')]&&_0x5db204[_0xaa4d('0x5b')][0x3]?_0x5db204[_0xaa4d('0x5b')][0x3][_0xaa4d('0x5e')]:undefined)||[]},{'name':_0xaa4d('0x68'),'value':_0x5db204[_0xaa4d('0x68')]||(_0x5db204[_0xaa4d('0x5b')]&&_0x5db204[_0xaa4d('0x5b')][0x4]?_0x5db204[_0xaa4d('0x5b')][0x4][_0xaa4d('0x5e')]:undefined)||'voice'},{'name':_0xaa4d('0x6a'),'value':_0x5db204['attrEmailAccounts']||(_0x5db204[_0xaa4d('0x5b')]&&_0x5db204[_0xaa4d('0x5b')][0x5]?_0x5db204[_0xaa4d('0x5b')][0x5][_0xaa4d('0x5e')]:undefined)||''},{'name':_0xaa4d('0x6b'),'value':_0x5db204['attrFaxAccounts']||(_0x5db204[_0xaa4d('0x5b')]&&_0x5db204[_0xaa4d('0x5b')][0x6]?_0x5db204[_0xaa4d('0x5b')][0x6][_0xaa4d('0x5e')]:undefined)||''},{'name':_0xaa4d('0x6c'),'value':_0x5db204[_0xaa4d('0x6c')]||(_0x5db204['attrs']&&_0x5db204[_0xaa4d('0x5b')][0x7]?_0x5db204[_0xaa4d('0x5b')][0x7][_0xaa4d('0x5e')]:undefined)||''},{'name':_0xaa4d('0x6d'),'value':_0x5db204[_0xaa4d('0x6d')]||(_0x5db204[_0xaa4d('0x5b')]&&_0x5db204[_0xaa4d('0x5b')][0x8]?_0x5db204[_0xaa4d('0x5b')][0x8]['value']:undefined)||''},{'name':_0xaa4d('0x6e'),'value':_0x5db204['attrWhatsappAccounts']||(_0x5db204[_0xaa4d('0x5b')]&&_0x5db204['attrs'][0x9]?_0x5db204[_0xaa4d('0x5b')][0x9][_0xaa4d('0x5e')]:undefined)||''},{'name':_0xaa4d('0x6f'),'value':_0x5db204[_0xaa4d('0x6f')]||(_0x5db204['attrs']&&_0x5db204[_0xaa4d('0x5b')][0xa]?_0x5db204[_0xaa4d('0x5b')][0xa][_0xaa4d('0x5e')]:undefined)||''}];case _0xaa4d('0x75'):return[{'name':_0xaa4d('0x76'),'type':_0x5db204[_0xaa4d('0x77')]||(_0x5db204['attrs']&&_0x5db204[_0xaa4d('0x5b')][0x0]?_0x5db204['attrs'][0x0][_0xaa4d('0x78')]:undefined)||null,'value':_0x5db204[_0xaa4d('0x76')]||(_0x5db204['attrs']&&_0x5db204[_0xaa4d('0x5b')][0x0]?_0x5db204[_0xaa4d('0x5b')][0x0][_0xaa4d('0x5e')]:undefined)||null},{'name':'attrRefresh','value':_0x5db204[_0xaa4d('0x79')]||(_0x5db204['attrs']&&_0x5db204[_0xaa4d('0x5b')][0x1]?_0x5db204[_0xaa4d('0x5b')][0x1][_0xaa4d('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0xf7475d){logger[_0xaa4d('0x2e')](_0xaa4d('0x7a'),JSON[_0xaa4d('0x7b')](_0xf7475d));return[];}}exports[_0xaa4d('0x7c')]=function(_0xa1b9a5,_0x1e16eb,_0x3b16f5){if(_0xa1b9a5[_0xaa4d('0x4d')]['id']){delete _0xa1b9a5[_0xaa4d('0x4d')]['id'];}return db['Dashboard'][_0xaa4d('0x4b')]({'where':{'id':_0xa1b9a5[_0xaa4d('0x58')]['id']}})[_0xaa4d('0x2b')](handleEntityNotFound(_0x1e16eb,null))[_0xaa4d('0x2b')](function(_0x25f3b7){if(_0x25f3b7){_0xa1b9a5[_0xaa4d('0x4d')][_0xaa4d('0x7d')]=_0x25f3b7['id'];_0xa1b9a5[_0xaa4d('0x4d')][_0xaa4d('0x5b')]=widgetAttributes(_0xa1b9a5[_0xaa4d('0x4d')]);return db[_0xaa4d('0x7e')][_0xaa4d('0x4c')](_0xa1b9a5[_0xaa4d('0x4d')]);}})[_0xaa4d('0x2b')](respondWithResult(_0x1e16eb,null))[_0xaa4d('0x46')](handleError(_0x1e16eb,null));};exports['getItems']=function(_0x55fcd2,_0x2ca525,_0x32389d){var _0x4413f1={};var _0x618dab={};var _0x2b464e;var _0x5d7f8e;return db['Dashboard'][_0xaa4d('0x7f')]({'where':{'id':_0x55fcd2[_0xaa4d('0x58')]['id']}})[_0xaa4d('0x2b')](handleEntityNotFound(_0x2ca525,null))['then'](function(_0x905e7c){if(_0x905e7c){_0x2b464e=_0x905e7c;_0x618dab[_0xaa4d('0x34')]=_[_0xaa4d('0x37')](db['DashboardItem'][_0xaa4d('0x48')]);_0x618dab[_0xaa4d('0x36')]=_[_0xaa4d('0x37')](_0x55fcd2[_0xaa4d('0x36')]);_0x618dab[_0xaa4d('0x38')]=_[_0xaa4d('0x3a')](_0x618dab[_0xaa4d('0x34')],_0x618dab[_0xaa4d('0x36')]);_0x4413f1['attributes']=_[_0xaa4d('0x3a')](_0x618dab[_0xaa4d('0x34')],qs[_0xaa4d('0x3b')](_0x55fcd2[_0xaa4d('0x36')][_0xaa4d('0x3b')]));_0x4413f1[_0xaa4d('0x39')]=_0x4413f1[_0xaa4d('0x39')][_0xaa4d('0x3c')]?_0x4413f1[_0xaa4d('0x39')]:_0x618dab[_0xaa4d('0x34')];_0x4413f1['order']=qs[_0xaa4d('0x40')](_0x55fcd2[_0xaa4d('0x36')]['sort']);_0x4413f1['where']=qs[_0xaa4d('0x38')](_[_0xaa4d('0x42')](_0x55fcd2[_0xaa4d('0x36')],_0x618dab[_0xaa4d('0x38')]));if(_0x55fcd2['query'][_0xaa4d('0x44')]){_0x4413f1[_0xaa4d('0x41')]=_[_0xaa4d('0x43')](_0x4413f1['where'],{'$or':_['map'](_0x4413f1['attributes'],function(_0x2e2fe0){var _0x1a8b09={};_0x1a8b09[_0x2e2fe0]={'$like':'%'+_0x55fcd2['query']['filter']+'%'};return _0x1a8b09;})});}_0x4413f1=_['merge']({},_0x4413f1,_0x55fcd2[_0xaa4d('0x45')]);return _0x2b464e[_0xaa4d('0x80')](_0x4413f1);}})['then'](function(_0x2541e4){if(_0x2541e4){_0x5d7f8e=_0x2541e4[_0xaa4d('0x3c')];if(!_0x55fcd2[_0xaa4d('0x36')][_0xaa4d('0x3d')]('nolimit')){_0x4413f1['limit']=qs[_0xaa4d('0x24')](_0x55fcd2[_0xaa4d('0x36')][_0xaa4d('0x24')]);_0x4413f1[_0xaa4d('0x22')]=qs[_0xaa4d('0x22')](_0x55fcd2[_0xaa4d('0x36')][_0xaa4d('0x22')]);}return _0x2b464e[_0xaa4d('0x80')](_0x4413f1);}})[_0xaa4d('0x2b')](function(_0x12155b){if(_0x12155b){return _0x12155b?{'count':_0x5d7f8e,'rows':_0x12155b}:null;}})[_0xaa4d('0x2b')](respondWithResult(_0x2ca525,null))[_0xaa4d('0x46')](handleError(_0x2ca525,null));}; \ No newline at end of file +var _0x08fb=['attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','attrFaxAccounts','attrReport','reportType','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','CustomDashboards','UserProfileResource','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','Dashboard','includeAll','include','findAll','show','params','options','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','omit','create','userProfileId','iframe','attrUrl','attrs','value','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart'];(function(_0x4df017,_0x2a0aa4){var _0x42c215=function(_0x2f423f){while(--_0x2f423f){_0x4df017['push'](_0x4df017['shift']());}};_0x42c215(++_0x2a0aa4);}(_0x08fb,0x194));var _0xb08f=function(_0x5795ff,_0x300aaf){_0x5795ff=_0x5795ff-0x0;var _0x5f10ea=_0x08fb[_0x5795ff];return _0x5f10ea;};'use strict';var emlformat=require(_0xb08f('0x0'));var rimraf=require(_0xb08f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb08f('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb08f('0x3'));var util=require('util');var path=require(_0xb08f('0x4'));var sox=require(_0xb08f('0x5'));var csv=require(_0xb08f('0x6'));var ejs=require(_0xb08f('0x7'));var fs=require('fs');var fs_extra=require(_0xb08f('0x8'));var _=require(_0xb08f('0x9'));var squel=require(_0xb08f('0xa'));var crypto=require(_0xb08f('0xb'));var jsforce=require(_0xb08f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb08f('0x6'));var querystring=require(_0xb08f('0xd'));var Papa=require(_0xb08f('0xe'));var Redis=require(_0xb08f('0xf'));var authService=require(_0xb08f('0x10'));var qs=require(_0xb08f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb08f('0x12'));var logger=require(_0xb08f('0x13'))(_0xb08f('0x14'));var utils=require(_0xb08f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb08f('0x16'));var db=require(_0xb08f('0x17'))['db'];config['redis']=_[_0xb08f('0x18')](config[_0xb08f('0x19')],{'host':_0xb08f('0x1a'),'port':0x18eb});var socket=require(_0xb08f('0x1b'))(new Redis(config[_0xb08f('0x19')]));require(_0xb08f('0x1c'))['register'](socket);function respondWithStatusCode(_0x1f489f,_0x22e6d7){_0x22e6d7=_0x22e6d7||0xcc;return function(_0x4bf215){if(_0x4bf215){return _0x1f489f[_0xb08f('0x1d')](_0x22e6d7);}return _0x1f489f[_0xb08f('0x1e')](_0x22e6d7)['end']();};}function respondWithResult(_0x1f440c,_0x10ce79){_0x10ce79=_0x10ce79||0xc8;return function(_0x5d1d5a){if(_0x5d1d5a){return _0x1f440c[_0xb08f('0x1e')](_0x10ce79)[_0xb08f('0x1f')](_0x5d1d5a);}};}function respondWithFilteredResult(_0x3f78e7,_0x1465a2){return function(_0x4ef31a){if(_0x4ef31a){var _0x1be41d=typeof _0x1465a2[_0xb08f('0x20')]===_0xb08f('0x21')&&typeof _0x1465a2[_0xb08f('0x22')]==='undefined';var _0x4643f2=_0x4ef31a[_0xb08f('0x23')];var _0x1e8711=_0x1be41d?0x0:_0x1465a2[_0xb08f('0x20')];var _0x1904ae=_0x1be41d?_0x4ef31a[_0xb08f('0x23')]:_0x1465a2[_0xb08f('0x20')]+_0x1465a2[_0xb08f('0x22')];var _0x5a796e;if(_0x1904ae>=_0x4643f2){_0x1904ae=_0x4643f2;_0x5a796e=0xc8;}else{_0x5a796e=0xce;}_0x3f78e7[_0xb08f('0x1e')](_0x5a796e);return _0x3f78e7[_0xb08f('0x24')](_0xb08f('0x25'),_0x1e8711+'-'+_0x1904ae+'/'+_0x4643f2)['json'](_0x4ef31a);}return null;};}function patchUpdates(_0x3f116b){return function(_0x5e5138){try{jsonpatch[_0xb08f('0x26')](_0x5e5138,_0x3f116b,!![]);}catch(_0x3b698c){return BPromise['reject'](_0x3b698c);}return _0x5e5138[_0xb08f('0x27')]();};}function saveUpdates(_0x299908,_0x1d8333){return function(_0x37f8af){if(_0x37f8af){return _0x37f8af[_0xb08f('0x28')](_0x299908)[_0xb08f('0x29')](function(_0x36ce65){return _0x36ce65;});}return null;};}function removeEntity(_0x4d8421,_0x3fedbd){return function(_0xf8a175){if(_0xf8a175){return _0xf8a175[_0xb08f('0x2a')]()[_0xb08f('0x29')](function(){var _0x3ef3ad=_0xf8a175[_0xb08f('0x2b')]({'plain':!![]});var _0x3bf498=_0xb08f('0x2c');return db[_0xb08f('0x2d')][_0xb08f('0x2a')]({'where':{'type':_0x3bf498,'resourceId':_0x3ef3ad['id']}})['then'](function(){return _0xf8a175;});})[_0xb08f('0x29')](function(){_0x4d8421[_0xb08f('0x1e')](0xcc)[_0xb08f('0x2e')]();});}};}function handleEntityNotFound(_0x55ad15,_0x4281ef){return function(_0x21bbae){if(!_0x21bbae){_0x55ad15[_0xb08f('0x1d')](0x194);}return _0x21bbae;};}function handleError(_0x3d0e4c,_0x1772b5){_0x1772b5=_0x1772b5||0x1f4;return function(_0x5e73ca){logger[_0xb08f('0x2f')](_0x5e73ca[_0xb08f('0x30')]);if(_0x5e73ca['name']){delete _0x5e73ca[_0xb08f('0x31')];}_0x3d0e4c[_0xb08f('0x1e')](_0x1772b5)[_0xb08f('0x32')](_0x5e73ca);};}exports[_0xb08f('0x33')]=function(_0x2f6b0a,_0x42d62f){var _0x39169a={},_0x10fdfa={},_0x4a376c={'count':0x0,'rows':[]};var _0x3f6b0d=_['map'](db['Dashboard'][_0xb08f('0x34')],function(_0x5a077d){return{'name':_0x5a077d[_0xb08f('0x35')],'type':_0x5a077d[_0xb08f('0x36')][_0xb08f('0x37')]};});_0x10fdfa[_0xb08f('0x38')]=_[_0xb08f('0x39')](_0x3f6b0d,_0xb08f('0x31'));_0x10fdfa[_0xb08f('0x3a')]=_[_0xb08f('0x3b')](_0x2f6b0a[_0xb08f('0x3a')]);_0x10fdfa['filters']=_['intersection'](_0x10fdfa[_0xb08f('0x38')],_0x10fdfa[_0xb08f('0x3a')]);_0x39169a[_0xb08f('0x3c')]=_[_0xb08f('0x3d')](_0x10fdfa[_0xb08f('0x38')],qs[_0xb08f('0x3e')](_0x2f6b0a[_0xb08f('0x3a')][_0xb08f('0x3e')]));_0x39169a[_0xb08f('0x3c')]=_0x39169a['attributes'][_0xb08f('0x3f')]?_0x39169a[_0xb08f('0x3c')]:_0x10fdfa[_0xb08f('0x38')];if(!_0x2f6b0a[_0xb08f('0x3a')][_0xb08f('0x40')](_0xb08f('0x41'))){_0x39169a[_0xb08f('0x22')]=qs[_0xb08f('0x22')](_0x2f6b0a[_0xb08f('0x3a')][_0xb08f('0x22')]);_0x39169a[_0xb08f('0x20')]=qs[_0xb08f('0x20')](_0x2f6b0a[_0xb08f('0x3a')]['offset']);}_0x39169a[_0xb08f('0x42')]=qs['sort'](_0x2f6b0a['query'][_0xb08f('0x43')]);_0x39169a['where']=qs[_0xb08f('0x44')](_[_0xb08f('0x45')](_0x2f6b0a[_0xb08f('0x3a')],_0x10fdfa['filters']),_0x3f6b0d);if(_0x2f6b0a['query'][_0xb08f('0x46')]){_0x39169a['where']=_[_0xb08f('0x47')](_0x39169a[_0xb08f('0x48')],{'$or':_[_0xb08f('0x39')](_0x3f6b0d,function(_0x4f424b){if(_0x4f424b[_0xb08f('0x36')]!==_0xb08f('0x49')){var _0x7bbd19={};_0x7bbd19[_0x4f424b[_0xb08f('0x31')]]={'$like':'%'+_0x2f6b0a[_0xb08f('0x3a')][_0xb08f('0x46')]+'%'};return _0x7bbd19;}})});}_0x39169a=_[_0xb08f('0x47')]({},_0x39169a,_0x2f6b0a['options']);var _0x4456a3={'where':_0x39169a['where']};return db[_0xb08f('0x4a')][_0xb08f('0x23')](_0x4456a3)[_0xb08f('0x29')](function(_0x39d90c){_0x4a376c[_0xb08f('0x23')]=_0x39d90c;if(_0x2f6b0a[_0xb08f('0x3a')][_0xb08f('0x4b')]){_0x39169a[_0xb08f('0x4c')]=[{'all':!![]}];}return db[_0xb08f('0x4a')][_0xb08f('0x4d')](_0x39169a);})[_0xb08f('0x29')](function(_0xbdd529){_0x4a376c['rows']=_0xbdd529;return _0x4a376c;})[_0xb08f('0x29')](respondWithFilteredResult(_0x42d62f,_0x39169a))['catch'](handleError(_0x42d62f,null));};exports[_0xb08f('0x4e')]=function(_0x58d8e5,_0x49d969){var _0x334997={'raw':![],'where':{'id':_0x58d8e5[_0xb08f('0x4f')]['id']}},_0x1f3563={};_0x1f3563[_0xb08f('0x38')]=_[_0xb08f('0x3b')](db[_0xb08f('0x4a')][_0xb08f('0x34')]);_0x1f3563[_0xb08f('0x3a')]=_['keys'](_0x58d8e5[_0xb08f('0x3a')]);_0x1f3563[_0xb08f('0x44')]=_['intersection'](_0x1f3563[_0xb08f('0x38')],_0x1f3563['query']);_0x334997[_0xb08f('0x3c')]=_[_0xb08f('0x3d')](_0x1f3563[_0xb08f('0x38')],qs[_0xb08f('0x3e')](_0x58d8e5[_0xb08f('0x3a')]['fields']));_0x334997[_0xb08f('0x3c')]=_0x334997[_0xb08f('0x3c')]['length']?_0x334997['attributes']:_0x1f3563[_0xb08f('0x38')];if(_0x58d8e5[_0xb08f('0x3a')][_0xb08f('0x4b')]){_0x334997['include']=[{'all':!![]}];}_0x334997=_['merge']({},_0x334997,_0x58d8e5[_0xb08f('0x50')]);return db['Dashboard']['find'](_0x334997)[_0xb08f('0x29')](handleEntityNotFound(_0x49d969,null))[_0xb08f('0x29')](respondWithResult(_0x49d969,null))[_0xb08f('0x51')](handleError(_0x49d969,null));};exports['create']=function(_0x12c314,_0x539797){return db[_0xb08f('0x4a')]['create'](_0x12c314[_0xb08f('0x52')],{})['then'](function(_0x394431){var _0x254d91=_0x12c314[_0xb08f('0x53')][_0xb08f('0x2b')]({'plain':!![]});if(!_0x254d91)throw new Error(_0xb08f('0x54'));if(_0x254d91['role']===_0xb08f('0x53')){var _0x344d83=_0x394431['get']({'plain':!![]});var _0x403fc3='CustomDashboards';return db[_0xb08f('0x55')][_0xb08f('0x56')]({'where':{'name':_0x403fc3,'userProfileId':_0x254d91['userProfileId']},'raw':!![]})['then'](function(_0x4a7d54){if(_0x4a7d54&&_0x4a7d54[_0xb08f('0x57')]===0x0){return db[_0xb08f('0x2d')]['create']({'name':_0x344d83[_0xb08f('0x31')],'resourceId':_0x344d83['id'],'type':_0x4a7d54['name'],'sectionId':_0x4a7d54['id']},{})[_0xb08f('0x29')](function(){return _0x394431;});}else{return _0x394431;}})[_0xb08f('0x51')](function(_0x2031a2){logger['error'](_0xb08f('0x58'),_0x2031a2);throw _0x2031a2;});}return _0x394431;})['then'](respondWithResult(_0x539797,0xc9))[_0xb08f('0x51')](handleError(_0x539797,null));};exports[_0xb08f('0x59')]=function(_0x9e0e78,_0x4b3849){var _0x28ae23={'where':{'id':_0x9e0e78[_0xb08f('0x4f')]['id']}},_0x1643dd={};_0x1643dd[_0xb08f('0x38')]=_['keys'](db[_0xb08f('0x4a')][_0xb08f('0x34')]);_0x28ae23[_0xb08f('0x3c')]=_['intersection'](_0x1643dd[_0xb08f('0x38')],qs['fields'](_0x9e0e78['query'][_0xb08f('0x3e')]));_0x28ae23[_0xb08f('0x3c')]=_0x28ae23[_0xb08f('0x3c')][_0xb08f('0x3f')]?_0x28ae23[_0xb08f('0x3c')]:_0x1643dd[_0xb08f('0x38')];if(_0x9e0e78['query'][_0xb08f('0x4b')]){_0x28ae23['include']=[{'all':!![]}];}_0x28ae23=_[_0xb08f('0x47')]({},_0x28ae23,_0x9e0e78['options']);return db[_0xb08f('0x4a')][_0xb08f('0x56')](_0x28ae23)[_0xb08f('0x29')](handleEntityNotFound(_0x4b3849,null))[_0xb08f('0x29')](function(_0x3bd2b8){if(_0x3bd2b8){var _0x4033c6=_0x3bd2b8[_0xb08f('0x2b')]({'plain':!![]});_0x4033c6=qs['omit'](_0x4033c6,['id',_0xb08f('0x5a'),'updatedAt']);_0x9e0e78['body']=_[_0xb08f('0x5b')](_0x9e0e78[_0xb08f('0x52')],['id',_0xb08f('0x5a'),'updatedAt']);return db[_0xb08f('0x4a')][_0xb08f('0x5c')](_['merge'](_0x4033c6,_0x9e0e78[_0xb08f('0x52')]),{'include':_0x9e0e78[_0xb08f('0x3a')][_0xb08f('0x4b')]?[{'all':!![]}]:undefined})[_0xb08f('0x29')](function(_0x33826b){var _0xaf54c0=_0x9e0e78['user'][_0xb08f('0x2b')]({'plain':!![]});if(!_0xaf54c0)throw new Error(_0xb08f('0x54'));if(_0xaf54c0['role']===_0xb08f('0x53')){var _0x29f0f6=_0x33826b['get']({'plain':!![]});var _0x24fc32=_0xb08f('0x2c');return db['UserProfileSection'][_0xb08f('0x56')]({'where':{'name':_0x24fc32,'userProfileId':_0xaf54c0[_0xb08f('0x5d')]},'raw':!![]})[_0xb08f('0x29')](function(_0x3f7b70){if(_0x3f7b70&&_0x3f7b70[_0xb08f('0x57')]===0x0){return db[_0xb08f('0x2d')][_0xb08f('0x5c')]({'name':_0x29f0f6[_0xb08f('0x31')],'resourceId':_0x29f0f6['id'],'type':_0x3f7b70[_0xb08f('0x31')],'sectionId':_0x3f7b70['id']},{})['then'](function(){return _0x33826b;});}else{return _0x33826b;}})['catch'](function(_0x4eacdc){logger[_0xb08f('0x2f')](_0xb08f('0x58'),_0x4eacdc);throw _0x4eacdc;});}return _0x33826b;});}})[_0xb08f('0x29')](respondWithResult(_0x4b3849,0xc9))[_0xb08f('0x51')](handleError(_0x4b3849,null));};exports['update']=function(_0x24d4ad,_0x11063e){if(_0x24d4ad['body']['id']){delete _0x24d4ad[_0xb08f('0x52')]['id'];}return db[_0xb08f('0x4a')][_0xb08f('0x56')]({'where':{'id':_0x24d4ad[_0xb08f('0x4f')]['id']}})[_0xb08f('0x29')](handleEntityNotFound(_0x11063e,null))[_0xb08f('0x29')](saveUpdates(_0x24d4ad['body'],null))['then'](respondWithResult(_0x11063e,null))['catch'](handleError(_0x11063e,null));};exports[_0xb08f('0x2a')]=function(_0x2fce6b,_0x29732f){return db['Dashboard'][_0xb08f('0x56')]({'where':{'id':_0x2fce6b[_0xb08f('0x4f')]['id']}})[_0xb08f('0x29')](handleEntityNotFound(_0x29732f,null))['then'](removeEntity(_0x29732f,null))[_0xb08f('0x51')](handleError(_0x29732f,null));};function widgetAttributes(_0x1e10ad){try{switch(_0x1e10ad[_0xb08f('0x36')]){case _0xb08f('0x5e'):return[{'name':_0xb08f('0x5f'),'value':_0x1e10ad[_0xb08f('0x5f')]||(_0x1e10ad[_0xb08f('0x60')]&&_0x1e10ad[_0xb08f('0x60')][0x0]?_0x1e10ad[_0xb08f('0x60')][0x0][_0xb08f('0x61')]:undefined)||'https://'}];case _0xb08f('0x62'):return[{'name':_0xb08f('0x63'),'value':_0x1e10ad[_0xb08f('0x63')]||(_0x1e10ad[_0xb08f('0x60')]&&_0x1e10ad['attrs'][0x0]?_0x1e10ad[_0xb08f('0x60')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0xb08f('0x64'),'value':_0x1e10ad[_0xb08f('0x64')]||(_0x1e10ad[_0xb08f('0x60')]&&_0x1e10ad['attrs'][0x0]?_0x1e10ad[_0xb08f('0x60')][0x0]['value']:undefined)||_0xb08f('0x65')},{'name':_0xb08f('0x66'),'value':_0x1e10ad[_0xb08f('0x66')]||(_0x1e10ad[_0xb08f('0x60')]&&_0x1e10ad[_0xb08f('0x60')][0x1]?_0x1e10ad[_0xb08f('0x60')][0x1][_0xb08f('0x61')]:undefined)||_0xb08f('0x67')},{'name':_0xb08f('0x68'),'value':_0x1e10ad['attrFontSize']||(_0x1e10ad[_0xb08f('0x60')]&&_0x1e10ad[_0xb08f('0x60')][0x2]?_0x1e10ad[_0xb08f('0x60')][0x2][_0xb08f('0x61')]:undefined)||0xc}];case _0xb08f('0x69'):return[{'name':_0xb08f('0x6a'),'value':_0x1e10ad[_0xb08f('0x6a')]||(_0x1e10ad['attrs']&&_0x1e10ad['attrs'][0x0]?_0x1e10ad[_0xb08f('0x60')][0x0]['value']:undefined)||_0xb08f('0x6b')},{'name':_0xb08f('0x6c'),'value':_0x1e10ad[_0xb08f('0x6c')]||(_0x1e10ad['attrs']&&_0x1e10ad[_0xb08f('0x60')][0x1]?_0x1e10ad['attrs'][0x1][_0xb08f('0x61')]:undefined)||[]},{'name':'attrFontSize','value':_0x1e10ad[_0xb08f('0x68')]||(_0x1e10ad[_0xb08f('0x60')]&&_0x1e10ad[_0xb08f('0x60')][0x2]?_0x1e10ad[_0xb08f('0x60')][0x2][_0xb08f('0x61')]:undefined)||0x14},{'name':_0xb08f('0x6d'),'value':_0x1e10ad[_0xb08f('0x6d')]||(_0x1e10ad[_0xb08f('0x60')]&&_0x1e10ad[_0xb08f('0x60')][0x3]?_0x1e10ad[_0xb08f('0x60')][0x3][_0xb08f('0x61')]:undefined)||_0xb08f('0x6e')},{'name':'attrEmailAccounts','value':_0x1e10ad['attrEmailAccounts']||(_0x1e10ad[_0xb08f('0x60')]&&_0x1e10ad['attrs'][0x4]?_0x1e10ad[_0xb08f('0x60')][0x4][_0xb08f('0x61')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x1e10ad['attrFaxAccounts']||(_0x1e10ad[_0xb08f('0x60')]&&_0x1e10ad[_0xb08f('0x60')][0x5]?_0x1e10ad[_0xb08f('0x60')][0x5]['value']:undefined)||''},{'name':_0xb08f('0x6f'),'value':_0x1e10ad[_0xb08f('0x6f')]||(_0x1e10ad['attrs']&&_0x1e10ad['attrs'][0x6]?_0x1e10ad[_0xb08f('0x60')][0x6][_0xb08f('0x61')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x1e10ad['attrOpenchannelAccounts']||(_0x1e10ad[_0xb08f('0x60')]&&_0x1e10ad[_0xb08f('0x60')][0x7]?_0x1e10ad[_0xb08f('0x60')][0x7]['value']:undefined)||''},{'name':_0xb08f('0x70'),'value':_0x1e10ad['attrWhatsappAccounts']||(_0x1e10ad[_0xb08f('0x60')]&&_0x1e10ad[_0xb08f('0x60')][0x8]?_0x1e10ad['attrs'][0x8][_0xb08f('0x61')]:undefined)||''},{'name':'attrChatWebsites','value':_0x1e10ad[_0xb08f('0x71')]||(_0x1e10ad[_0xb08f('0x60')]&&_0x1e10ad[_0xb08f('0x60')][0x9]?_0x1e10ad[_0xb08f('0x60')][0x9]['value']:undefined)||''}];case _0xb08f('0x72'):case _0xb08f('0x73'):return[{'name':'attrSerie1','value':_0x1e10ad[_0xb08f('0x74')]||(_0x1e10ad[_0xb08f('0x60')]&&_0x1e10ad['attrs'][0x0]?_0x1e10ad[_0xb08f('0x60')][0x0]['value']:undefined)||_0xb08f('0x6b')},{'name':_0xb08f('0x75'),'value':_0x1e10ad[_0xb08f('0x75')]||(_0x1e10ad['attrs']&&_0x1e10ad['attrs'][0x1]?_0x1e10ad[_0xb08f('0x60')][0x1][_0xb08f('0x61')]:undefined)||null},{'name':_0xb08f('0x76'),'value':_0x1e10ad[_0xb08f('0x76')]||(_0x1e10ad[_0xb08f('0x60')]&&_0x1e10ad['attrs'][0x2]?_0x1e10ad[_0xb08f('0x60')][0x2][_0xb08f('0x61')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x1e10ad[_0xb08f('0x6c')]||(_0x1e10ad['attrs']&&_0x1e10ad[_0xb08f('0x60')][0x3]?_0x1e10ad[_0xb08f('0x60')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x1e10ad[_0xb08f('0x6d')]||(_0x1e10ad[_0xb08f('0x60')]&&_0x1e10ad[_0xb08f('0x60')][0x4]?_0x1e10ad[_0xb08f('0x60')][0x4][_0xb08f('0x61')]:undefined)||'voice'},{'name':_0xb08f('0x77'),'value':_0x1e10ad['attrEmailAccounts']||(_0x1e10ad[_0xb08f('0x60')]&&_0x1e10ad['attrs'][0x5]?_0x1e10ad[_0xb08f('0x60')][0x5]['value']:undefined)||''},{'name':_0xb08f('0x78'),'value':_0x1e10ad[_0xb08f('0x78')]||(_0x1e10ad[_0xb08f('0x60')]&&_0x1e10ad[_0xb08f('0x60')][0x6]?_0x1e10ad[_0xb08f('0x60')][0x6][_0xb08f('0x61')]:undefined)||''},{'name':_0xb08f('0x6f'),'value':_0x1e10ad[_0xb08f('0x6f')]||(_0x1e10ad[_0xb08f('0x60')]&&_0x1e10ad[_0xb08f('0x60')][0x7]?_0x1e10ad[_0xb08f('0x60')][0x7][_0xb08f('0x61')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x1e10ad['attrOpenchannelAccounts']||(_0x1e10ad['attrs']&&_0x1e10ad['attrs'][0x8]?_0x1e10ad[_0xb08f('0x60')][0x8][_0xb08f('0x61')]:undefined)||''},{'name':_0xb08f('0x70'),'value':_0x1e10ad[_0xb08f('0x70')]||(_0x1e10ad[_0xb08f('0x60')]&&_0x1e10ad[_0xb08f('0x60')][0x9]?_0x1e10ad[_0xb08f('0x60')][0x9][_0xb08f('0x61')]:undefined)||''},{'name':_0xb08f('0x71'),'value':_0x1e10ad[_0xb08f('0x71')]||(_0x1e10ad[_0xb08f('0x60')]&&_0x1e10ad[_0xb08f('0x60')][0xa]?_0x1e10ad['attrs'][0xa][_0xb08f('0x61')]:undefined)||''}];case'web-report':return[{'name':_0xb08f('0x79'),'type':_0x1e10ad[_0xb08f('0x7a')]||(_0x1e10ad[_0xb08f('0x60')]&&_0x1e10ad[_0xb08f('0x60')][0x0]?_0x1e10ad['attrs'][0x0][_0xb08f('0x36')]:undefined)||null,'value':_0x1e10ad[_0xb08f('0x79')]||(_0x1e10ad['attrs']&&_0x1e10ad['attrs'][0x0]?_0x1e10ad[_0xb08f('0x60')][0x0][_0xb08f('0x61')]:undefined)||null},{'name':_0xb08f('0x7b'),'value':_0x1e10ad[_0xb08f('0x7b')]||(_0x1e10ad[_0xb08f('0x60')]&&_0x1e10ad['attrs'][0x1]?_0x1e10ad[_0xb08f('0x60')][0x1][_0xb08f('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x29bf5a){logger[_0xb08f('0x2f')]('widgetAttributes:\x20%s',JSON[_0xb08f('0x7c')](_0x29bf5a));return[];}}exports[_0xb08f('0x7d')]=function(_0x1ccb6a,_0x571a3d,_0x133d58){if(_0x1ccb6a[_0xb08f('0x52')]['id']){delete _0x1ccb6a[_0xb08f('0x52')]['id'];}return db[_0xb08f('0x4a')][_0xb08f('0x56')]({'where':{'id':_0x1ccb6a['params']['id']}})['then'](handleEntityNotFound(_0x571a3d,null))['then'](function(_0x204d63){if(_0x204d63){_0x1ccb6a[_0xb08f('0x52')][_0xb08f('0x7e')]=_0x204d63['id'];_0x1ccb6a['body'][_0xb08f('0x60')]=widgetAttributes(_0x1ccb6a[_0xb08f('0x52')]);return db[_0xb08f('0x7f')]['create'](_0x1ccb6a[_0xb08f('0x52')]);}})['then'](respondWithResult(_0x571a3d,null))[_0xb08f('0x51')](handleError(_0x571a3d,null));};exports[_0xb08f('0x80')]=function(_0x3eb49a,_0x1b505a,_0x14bee5){var _0x47a2da={};var _0x59f294={};var _0xd36c48;var _0x4163e7;return db['Dashboard'][_0xb08f('0x81')]({'where':{'id':_0x3eb49a[_0xb08f('0x4f')]['id']}})[_0xb08f('0x29')](handleEntityNotFound(_0x1b505a,null))[_0xb08f('0x29')](function(_0x25c243){if(_0x25c243){_0xd36c48=_0x25c243;_0x59f294[_0xb08f('0x38')]=_['keys'](db[_0xb08f('0x7f')][_0xb08f('0x34')]);_0x59f294[_0xb08f('0x3a')]=_[_0xb08f('0x3b')](_0x3eb49a['query']);_0x59f294[_0xb08f('0x44')]=_[_0xb08f('0x3d')](_0x59f294['model'],_0x59f294[_0xb08f('0x3a')]);_0x47a2da[_0xb08f('0x3c')]=_['intersection'](_0x59f294[_0xb08f('0x38')],qs[_0xb08f('0x3e')](_0x3eb49a[_0xb08f('0x3a')][_0xb08f('0x3e')]));_0x47a2da[_0xb08f('0x3c')]=_0x47a2da[_0xb08f('0x3c')][_0xb08f('0x3f')]?_0x47a2da[_0xb08f('0x3c')]:_0x59f294[_0xb08f('0x38')];_0x47a2da[_0xb08f('0x42')]=qs[_0xb08f('0x43')](_0x3eb49a[_0xb08f('0x3a')]['sort']);_0x47a2da[_0xb08f('0x48')]=qs['filters'](_[_0xb08f('0x45')](_0x3eb49a[_0xb08f('0x3a')],_0x59f294[_0xb08f('0x44')]));if(_0x3eb49a[_0xb08f('0x3a')][_0xb08f('0x46')]){_0x47a2da[_0xb08f('0x48')]=_[_0xb08f('0x47')](_0x47a2da['where'],{'$or':_[_0xb08f('0x39')](_0x47a2da[_0xb08f('0x3c')],function(_0x40d83e){var _0xc2527={};_0xc2527[_0x40d83e]={'$like':'%'+_0x3eb49a[_0xb08f('0x3a')]['filter']+'%'};return _0xc2527;})});}_0x47a2da=_['merge']({},_0x47a2da,_0x3eb49a[_0xb08f('0x50')]);return _0xd36c48[_0xb08f('0x80')](_0x47a2da);}})['then'](function(_0x5754ce){if(_0x5754ce){_0x4163e7=_0x5754ce['length'];if(!_0x3eb49a[_0xb08f('0x3a')][_0xb08f('0x40')](_0xb08f('0x41'))){_0x47a2da[_0xb08f('0x22')]=qs[_0xb08f('0x22')](_0x3eb49a['query']['limit']);_0x47a2da['offset']=qs['offset'](_0x3eb49a[_0xb08f('0x3a')][_0xb08f('0x20')]);}return _0xd36c48[_0xb08f('0x80')](_0x47a2da);}})[_0xb08f('0x29')](function(_0x4b9212){if(_0x4b9212){return _0x4b9212?{'count':_0x4163e7,'rows':_0x4b9212}:null;}})[_0xb08f('0x29')](respondWithResult(_0x1b505a,null))[_0xb08f('0x51')](handleError(_0x1b505a,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 0542294..df875e1 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 _0xec30=['exports','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x20845e,_0x211e78){var _0x28cf2b=function(_0x31d613){while(--_0x31d613){_0x20845e['push'](_0x20845e['shift']());}};_0x28cf2b(++_0x211e78);}(_0xec30,0xf9));var _0x0ec3=function(_0x426cad,_0x45810d){_0x426cad=_0x426cad-0x0;var _0x50c00f=_0xec30[_0x426cad];return _0x50c00f;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x0ec3('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x0ec3('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0ec3('0x2'),'afterDestroy':_0x0ec3('0x3')};function emitEvent(_0x5bb22d){return function(_0x86436,_0x1a408d,_0x28e2dc){DashboardEvents[_0x0ec3('0x4')](_0x5bb22d+':'+_0x86436['id'],_0x86436);DashboardEvents[_0x0ec3('0x4')](_0x5bb22d,_0x86436);_0x28e2dc(null);};}for(var e in events){if(events[_0x0ec3('0x5')](e)){var event=events[e];Dashboard[_0x0ec3('0x6')](e,emitEvent(event));}}module[_0x0ec3('0x7')]=DashboardEvents; \ No newline at end of file +var _0x56ab=['emit','hasOwnProperty','exports','../../mysqldb','Dashboard','setMaxListeners','save','update','remove'];(function(_0x59561b,_0x24c031){var _0x3b415b=function(_0x4b0e87){while(--_0x4b0e87){_0x59561b['push'](_0x59561b['shift']());}};_0x3b415b(++_0x24c031);}(_0x56ab,0x174));var _0xb56a=function(_0x4d1042,_0x1f46e4){_0x4d1042=_0x4d1042-0x0;var _0x1dda72=_0x56ab[_0x4d1042];return _0x1dda72;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xb56a('0x0'))['db'][_0xb56a('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xb56a('0x2')](0x0);var events={'afterCreate':_0xb56a('0x3'),'afterUpdate':_0xb56a('0x4'),'afterDestroy':_0xb56a('0x5')};function emitEvent(_0x2b9235){return function(_0x2ebc2a,_0xd42497,_0x494486){DashboardEvents[_0xb56a('0x6')](_0x2b9235+':'+_0x2ebc2a['id'],_0x2ebc2a);DashboardEvents['emit'](_0x2b9235,_0x2ebc2a);_0x494486(null);};}for(var e in events){if(events[_0xb56a('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xb56a('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index fb9ffb1..5aa7784 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 _0xc1eb=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes','define','Dashboard','dashboards','lodash'];(function(_0x475554,_0x2b5042){var _0x267c03=function(_0x561bb2){while(--_0x561bb2){_0x475554['push'](_0x475554['shift']());}};_0x267c03(++_0x2b5042);}(_0xc1eb,0x1ed));var _0xbc1e=function(_0x5465e6,_0x2a8809){_0x5465e6=_0x5465e6-0x0;var _0x10044e=_0xc1eb[_0x5465e6];return _0x10044e;};'use strict';var _=require(_0xbc1e('0x0'));var util=require(_0xbc1e('0x1'));var logger=require(_0xbc1e('0x2'))(_0xbc1e('0x3'));var moment=require(_0xbc1e('0x4'));var BPromise=require(_0xbc1e('0x5'));var rp=require(_0xbc1e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbc1e('0x7'));var config=require(_0xbc1e('0x8'));var attributes=require(_0xbc1e('0x9'));module['exports']=function(_0x1c945b,_0x146e50){return _0x1c945b[_0xbc1e('0xa')](_0xbc1e('0xb'),attributes,{'tableName':_0xbc1e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf46d=['define','Dashboard','dashboards','util','../../config/logger','api','moment','path','../../config/environment','exports'];(function(_0x3bfd9f,_0x538d32){var _0x33decc=function(_0x8f5a3a){while(--_0x8f5a3a){_0x3bfd9f['push'](_0x3bfd9f['shift']());}};_0x33decc(++_0x538d32);}(_0xf46d,0x125));var _0xdf46=function(_0x1ab0e6,_0x17ba8d){_0x1ab0e6=_0x1ab0e6-0x0;var _0x248815=_0xf46d[_0x1ab0e6];return _0x248815;};'use strict';var _=require('lodash');var util=require(_0xdf46('0x0'));var logger=require(_0xdf46('0x1'))(_0xdf46('0x2'));var moment=require(_0xdf46('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf46('0x4'));var rimraf=require('rimraf');var config=require(_0xdf46('0x5'));var attributes=require('./dashboard.attributes');module[_0xdf46('0x6')]=function(_0x590988,_0x365cde){return _0x590988[_0xdf46('0x7')](_0xdf46('0x8'),attributes,{'tableName':_0xdf46('0x9'),'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 9db969b..8f9b1ed 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 _0xc126=['client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','then','info','request\x20sent','debug','stringify','error','message','Dashboard,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2ed605,_0x245d92){var _0xdb2f4b=function(_0x5d3971){while(--_0x5d3971){_0x2ed605['push'](_0x2ed605['shift']());}};_0xdb2f4b(++_0x245d92);}(_0xc126,0xdc));var _0x6c12=function(_0x2e0c6f,_0x3ec2d4){_0x2e0c6f=_0x2e0c6f-0x0;var _0x597e30=_0xc126[_0x2e0c6f];return _0x597e30;};'use strict';var _=require(_0x6c12('0x0'));var util=require(_0x6c12('0x1'));var moment=require(_0x6c12('0x2'));var BPromise=require(_0x6c12('0x3'));var rs=require(_0x6c12('0x4'));var fs=require('fs');var Redis=require(_0x6c12('0x5'));var db=require(_0x6c12('0x6'))['db'];var utils=require(_0x6c12('0x7'));var logger=require(_0x6c12('0x8'))(_0x6c12('0x9'));var config=require(_0x6c12('0xa'));var jayson=require(_0x6c12('0xb'));var client=jayson[_0x6c12('0xc')][_0x6c12('0xd')]({'port':0x232a});config[_0x6c12('0xe')]=_[_0x6c12('0xf')](config['redis'],{'host':_0x6c12('0x10'),'port':0x18eb});var socket=require(_0x6c12('0x11'))(new Redis(config['redis']));require(_0x6c12('0x12'))['register'](socket);function respondWithRpcPromise(_0x420e29,_0x2e6ca2,_0x522f80){return new BPromise(function(_0x4d2cfd,_0x58ac50){return client['request'](_0x420e29,_0x522f80)[_0x6c12('0x13')](function(_0x54a53c){logger[_0x6c12('0x14')]('Dashboard,\x20%s,\x20%s',_0x2e6ca2,_0x6c12('0x15'));logger[_0x6c12('0x16')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x2e6ca2,_0x6c12('0x15'),JSON[_0x6c12('0x17')](_0x54a53c));if(_0x54a53c[_0x6c12('0x18')]){if(_0x54a53c[_0x6c12('0x18')]['code']===0x1f4){logger[_0x6c12('0x18')]('Dashboard,\x20%s,\x20%s',_0x2e6ca2,_0x54a53c[_0x6c12('0x18')][_0x6c12('0x19')]);return _0x58ac50(_0x54a53c[_0x6c12('0x18')]['message']);}logger[_0x6c12('0x18')](_0x6c12('0x1a'),_0x2e6ca2,_0x54a53c[_0x6c12('0x18')][_0x6c12('0x19')]);return _0x4d2cfd(_0x54a53c[_0x6c12('0x18')][_0x6c12('0x19')]);}else{logger[_0x6c12('0x14')](_0x6c12('0x1a'),_0x2e6ca2,_0x6c12('0x15'));_0x4d2cfd(_0x54a53c[_0x6c12('0x1b')]['message']);}})[_0x6c12('0x1c')](function(_0x5ae295){logger['error'](_0x6c12('0x1a'),_0x2e6ca2,_0x5ae295);_0x58ac50(_0x5ae295);});});} \ No newline at end of file +var _0xabe2=['Dashboard,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x348652,_0x1ab849){var _0x18a9ea=function(_0x3fd540){while(--_0x3fd540){_0x348652['push'](_0x348652['shift']());}};_0x18a9ea(++_0x1ab849);}(_0xabe2,0x11a));var _0x2abe=function(_0x1e5b36,_0x52e2a3){_0x1e5b36=_0x1e5b36-0x0;var _0x2a5d46=_0xabe2[_0x1e5b36];return _0x2a5d46;};'use strict';var _=require(_0x2abe('0x0'));var util=require(_0x2abe('0x1'));var moment=require(_0x2abe('0x2'));var BPromise=require(_0x2abe('0x3'));var rs=require(_0x2abe('0x4'));var fs=require('fs');var Redis=require(_0x2abe('0x5'));var db=require(_0x2abe('0x6'))['db'];var utils=require(_0x2abe('0x7'));var logger=require(_0x2abe('0x8'))(_0x2abe('0x9'));var config=require(_0x2abe('0xa'));var jayson=require(_0x2abe('0xb'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x2abe('0xc')],{'host':_0x2abe('0xd'),'port':0x18eb});var socket=require(_0x2abe('0xe'))(new Redis(config[_0x2abe('0xc')]));require(_0x2abe('0xf'))[_0x2abe('0x10')](socket);function respondWithRpcPromise(_0x578a0c,_0x2d5c68,_0x9e3c36){return new BPromise(function(_0xbc0817,_0x5df004){return client[_0x2abe('0x11')](_0x578a0c,_0x9e3c36)[_0x2abe('0x12')](function(_0x51bf5c){logger[_0x2abe('0x13')]('Dashboard,\x20%s,\x20%s',_0x2d5c68,_0x2abe('0x14'));logger[_0x2abe('0x15')](_0x2abe('0x16'),_0x2d5c68,'request\x20sent',JSON[_0x2abe('0x17')](_0x51bf5c));if(_0x51bf5c[_0x2abe('0x18')]){if(_0x51bf5c[_0x2abe('0x18')]['code']===0x1f4){logger[_0x2abe('0x18')]('Dashboard,\x20%s,\x20%s',_0x2d5c68,_0x51bf5c[_0x2abe('0x18')]['message']);return _0x5df004(_0x51bf5c['error'][_0x2abe('0x19')]);}logger[_0x2abe('0x18')](_0x2abe('0x1a'),_0x2d5c68,_0x51bf5c[_0x2abe('0x18')][_0x2abe('0x19')]);return _0xbc0817(_0x51bf5c[_0x2abe('0x18')][_0x2abe('0x19')]);}else{logger[_0x2abe('0x13')]('Dashboard,\x20%s,\x20%s',_0x2d5c68,'request\x20sent');_0xbc0817(_0x51bf5c[_0x2abe('0x1b')][_0x2abe('0x19')]);}})['catch'](function(_0x2f0286){logger[_0x2abe('0x18')]('Dashboard,\x20%s,\x20%s',_0x2d5c68,_0x2f0286);_0x5df004(_0x2f0286);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 85307a4..fb4e3b1 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 _0xc59a=['./dashboard.events','remove','update','emit','removeListener','length','dashboard:'];(function(_0x6620b8,_0x8b3d5e){var _0x33de50=function(_0x2f1f07){while(--_0x2f1f07){_0x6620b8['push'](_0x6620b8['shift']());}};_0x33de50(++_0x8b3d5e);}(_0xc59a,0x10a));var _0xac59=function(_0x24e1cf,_0xbe36c7){_0x24e1cf=_0x24e1cf-0x0;var _0x25c584=_0xc59a[_0x24e1cf];return _0x25c584;};'use strict';var DashboardEvents=require(_0xac59('0x0'));var events=['save',_0xac59('0x1'),_0xac59('0x2')];function createListener(_0x519fad,_0x37439d){return function(_0x370886){_0x37439d[_0xac59('0x3')](_0x519fad,_0x370886);};}function removeListener(_0x25003e,_0x374901){return function(){DashboardEvents[_0xac59('0x4')](_0x25003e,_0x374901);};}exports['register']=function(_0x3e7ab3){for(var _0x55c8cd=0x0,_0xb07692=events[_0xac59('0x5')];_0x55c8cd<_0xb07692;_0x55c8cd++){var _0x20b8bd=events[_0x55c8cd];var _0xbcc1d9=createListener(_0xac59('0x6')+_0x20b8bd,_0x3e7ab3);DashboardEvents['on'](_0x20b8bd,_0xbcc1d9);}}; \ No newline at end of file +var _0x6b79=['removeListener','register','dashboard:','./dashboard.events','save','remove','emit'];(function(_0x331d6a,_0x4364b6){var _0x5e6144=function(_0x130c82){while(--_0x130c82){_0x331d6a['push'](_0x331d6a['shift']());}};_0x5e6144(++_0x4364b6);}(_0x6b79,0xd5));var _0x96b7=function(_0x18feb3,_0x27100f){_0x18feb3=_0x18feb3-0x0;var _0x3760c9=_0x6b79[_0x18feb3];return _0x3760c9;};'use strict';var DashboardEvents=require(_0x96b7('0x0'));var events=[_0x96b7('0x1'),_0x96b7('0x2'),'update'];function createListener(_0x9d219,_0x553e20){return function(_0x500b49){_0x553e20[_0x96b7('0x3')](_0x9d219,_0x500b49);};}function removeListener(_0x2d9192,_0x5bcc3c){return function(){DashboardEvents[_0x96b7('0x4')](_0x2d9192,_0x5bcc3c);};}exports[_0x96b7('0x5')]=function(_0x5b6873){for(var _0x32d13f=0x0,_0x37c148=events['length'];_0x32d13f<_0x37c148;_0x32d13f++){var _0x44251c=events[_0x32d13f];var _0x2ab998=createListener(_0x96b7('0x6')+_0x44251c,_0x5b6873);DashboardEvents['on'](_0x44251c,_0x2ab998);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 3a06b9f..ddfa00d 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 _0xb32d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','post','create','/:id/clone','/:id/items','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x249f14,_0x521d15){var _0x4807c9=function(_0x14dc97){while(--_0x14dc97){_0x249f14['push'](_0x249f14['shift']());}};_0x4807c9(++_0x521d15);}(_0xb32d,0xac));var _0xdb32=function(_0x3fa215,_0x3a749a){_0x3fa215=_0x3fa215-0x0;var _0x2b7668=_0xb32d[_0x3fa215];return _0x2b7668;};'use strict';var multer=require(_0xdb32('0x0'));var util=require(_0xdb32('0x1'));var path=require(_0xdb32('0x2'));var timeout=require(_0xdb32('0x3'));var express=require(_0xdb32('0x4'));var router=express[_0xdb32('0x5')]();var fs_extra=require(_0xdb32('0x6'));var auth=require(_0xdb32('0x7'));var interaction=require(_0xdb32('0x8'));var config=require(_0xdb32('0x9'));var controller=require('./dashboard.controller');router['get']('/',auth[_0xdb32('0xa')](),controller[_0xdb32('0xb')]);router['get'](_0xdb32('0xc'),auth[_0xdb32('0xa')](),controller[_0xdb32('0xd')]);router['get']('/:id/items',auth[_0xdb32('0xa')](),controller['getItems']);router[_0xdb32('0xe')]('/',auth['isAuthenticated'](),controller[_0xdb32('0xf')]);router['post'](_0xdb32('0x10'),auth[_0xdb32('0xa')](),controller['clone']);router[_0xdb32('0xe')](_0xdb32('0x11'),auth['isAuthenticated'](),controller['addItem']);router[_0xdb32('0x12')]('/:id',auth[_0xdb32('0xa')](),controller['update']);router[_0xdb32('0x13')](_0xdb32('0xc'),auth['isAuthenticated'](),controller[_0xdb32('0x14')]);module[_0xdb32('0x15')]=router; \ No newline at end of file +var _0xbad2=['./dashboard.controller','get','isAuthenticated','index','/:id','show','getItems','post','clone','/:id/items','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbad2,0x150));var _0x2bad=function(_0x52c1e6,_0x54c4a6){_0x52c1e6=_0x52c1e6-0x0;var _0x4fe184=_0xbad2[_0x52c1e6];return _0x4fe184;};'use strict';var multer=require(_0x2bad('0x0'));var util=require(_0x2bad('0x1'));var path=require(_0x2bad('0x2'));var timeout=require(_0x2bad('0x3'));var express=require(_0x2bad('0x4'));var router=express[_0x2bad('0x5')]();var fs_extra=require(_0x2bad('0x6'));var auth=require(_0x2bad('0x7'));var interaction=require(_0x2bad('0x8'));var config=require('../../config/environment');var controller=require(_0x2bad('0x9'));router[_0x2bad('0xa')]('/',auth[_0x2bad('0xb')](),controller[_0x2bad('0xc')]);router[_0x2bad('0xa')](_0x2bad('0xd'),auth['isAuthenticated'](),controller[_0x2bad('0xe')]);router[_0x2bad('0xa')]('/:id/items',auth[_0x2bad('0xb')](),controller[_0x2bad('0xf')]);router[_0x2bad('0x10')]('/',auth[_0x2bad('0xb')](),controller['create']);router[_0x2bad('0x10')]('/:id/clone',auth[_0x2bad('0xb')](),controller[_0x2bad('0x11')]);router[_0x2bad('0x10')](_0x2bad('0x12'),auth[_0x2bad('0xb')](),controller['addItem']);router[_0x2bad('0x13')](_0x2bad('0xd'),auth[_0x2bad('0xb')](),controller[_0x2bad('0x14')]);router['delete']('/:id',auth[_0x2bad('0xb')](),controller[_0x2bad('0x15')]);module[_0x2bad('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 57748b9..6bb1e53 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 _0xe2fe=['setDataValue','INTEGER','sequelize','exports','STRING','TEXT','long','parse','getDataValue','attrs','stringify'];(function(_0x4eec0f,_0xec3aee){var _0xb6cd47=function(_0x43dcee){while(--_0x43dcee){_0x4eec0f['push'](_0x4eec0f['shift']());}};_0xb6cd47(++_0xec3aee);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xee2f('0x0'));var squel=require('squel');var _=require('lodash');module[_0xee2f('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xee2f('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xee2f('0x3')](_0xee2f('0x4')),'get':function(){try{return JSON[_0xee2f('0x5')](this[_0xee2f('0x6')]('attrs'));}catch(_0x311a2f){return[];}},'set':function(_0x2b7e7c){try{this['setDataValue'](_0xee2f('0x7'),JSON[_0xee2f('0x8')](_0x2b7e7c));}catch(_0x5a7975){this[_0xee2f('0x9')]('attrs',JSON[_0xee2f('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xee2f('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xee2f('0xa')]},'col':{'type':Sequelize[_0xee2f('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xee2f('0x2')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x0295=['#ffffff','sequelize','exports','TEXT','long','parse','getDataValue','attrs','setDataValue','INTEGER','STRING'];(function(_0x39cdb8,_0x15ee98){var _0x44bbc9=function(_0x395338){while(--_0x395338){_0x39cdb8['push'](_0x39cdb8['shift']());}};_0x44bbc9(++_0x15ee98);}(_0x0295,0x1f0));var _0x5029=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x0295[_0x34eb31];return _0x254994;};'use strict';var Sequelize=require(_0x5029('0x0'));var squel=require('squel');var _=require('lodash');module[_0x5029('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5029('0x2')](_0x5029('0x3')),'get':function(){try{return JSON[_0x5029('0x4')](this[_0x5029('0x5')](_0x5029('0x6')));}catch(_0x69a497){return[];}},'set':function(_0x200217){try{this[_0x5029('0x7')](_0x5029('0x6'),JSON['stringify'](_0x200217));}catch(_0x54978f){this['setDataValue'](_0x5029('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x5029('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5029('0x8')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x5029('0x9')],'allowNull':![],'defaultValue':_0x5029('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5029('0x9')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5029('0x9')]},'titleFontSize':{'type':Sequelize[_0x5029('0x8')],'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 2b07ef1..0b46eec 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 _0x6050=['zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','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','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','find','catch','type','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf'];(function(_0x3a36e4,_0x420a62){var _0x3e3628=function(_0x528795){while(--_0x528795){_0x3a36e4['push'](_0x3a36e4['shift']());}};_0x3e3628(++_0x420a62);}(_0x6050,0x196));var _0x0605=function(_0x51b22d,_0x37949f){_0x51b22d=_0x51b22d-0x0;var _0x1e2b0a=_0x6050[_0x51b22d];return _0x1e2b0a;};'use strict';var emlformat=require(_0x0605('0x0'));var rimraf=require(_0x0605('0x1'));var zipdir=require(_0x0605('0x2'));var jsonpatch=require(_0x0605('0x3'));var rp=require(_0x0605('0x4'));var moment=require(_0x0605('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0605('0x6'));var util=require(_0x0605('0x7'));var path=require(_0x0605('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0605('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0605('0xa'));var deskjs=require(_0x0605('0xb'));var toCsv=require(_0x0605('0xc'));var querystring=require(_0x0605('0xd'));var Papa=require(_0x0605('0xe'));var Redis=require('ioredis');var authService=require(_0x0605('0xf'));var qs=require(_0x0605('0x10'));var as=require(_0x0605('0x11'));var hardwareService=require(_0x0605('0x12'));var logger=require(_0x0605('0x13'))(_0x0605('0x14'));var utils=require(_0x0605('0x15'));var config=require(_0x0605('0x16'));var licenseUtil=require(_0x0605('0x17'));var db=require(_0x0605('0x18'))['db'];config[_0x0605('0x19')]=_[_0x0605('0x1a')](config[_0x0605('0x19')],{'host':_0x0605('0x1b'),'port':0x18eb});var socket=require(_0x0605('0x1c'))(new Redis(config[_0x0605('0x19')]));require(_0x0605('0x1d'))[_0x0605('0x1e')](socket);function respondWithStatusCode(_0x1b944f,_0x5b08ba){_0x5b08ba=_0x5b08ba||0xcc;return function(_0x2b4610){if(_0x2b4610){return _0x1b944f[_0x0605('0x1f')](_0x5b08ba);}return _0x1b944f[_0x0605('0x20')](_0x5b08ba)['end']();};}function respondWithResult(_0x4eefe9,_0x12a455){_0x12a455=_0x12a455||0xc8;return function(_0xd0996d){if(_0xd0996d){return _0x4eefe9[_0x0605('0x20')](_0x12a455)[_0x0605('0x21')](_0xd0996d);}};}function respondWithFilteredResult(_0xefc557,_0x351dbd){return function(_0x2b7b5a){if(_0x2b7b5a){var _0x1d57ba=typeof _0x351dbd[_0x0605('0x22')]===_0x0605('0x23')&&typeof _0x351dbd[_0x0605('0x24')]===_0x0605('0x23');var _0x2e2204=_0x2b7b5a[_0x0605('0x25')];var _0x59bc87=_0x1d57ba?0x0:_0x351dbd[_0x0605('0x22')];var _0x14a920=_0x1d57ba?_0x2b7b5a[_0x0605('0x25')]:_0x351dbd[_0x0605('0x22')]+_0x351dbd[_0x0605('0x24')];var _0x90b2e1;if(_0x14a920>=_0x2e2204){_0x14a920=_0x2e2204;_0x90b2e1=0xc8;}else{_0x90b2e1=0xce;}_0xefc557[_0x0605('0x20')](_0x90b2e1);return _0xefc557[_0x0605('0x26')](_0x0605('0x27'),_0x59bc87+'-'+_0x14a920+'/'+_0x2e2204)['json'](_0x2b7b5a);}return null;};}function patchUpdates(_0xc334b8){return function(_0x4fe293){try{jsonpatch[_0x0605('0x28')](_0x4fe293,_0xc334b8,!![]);}catch(_0x118e9c){return BPromise[_0x0605('0x29')](_0x118e9c);}return _0x4fe293[_0x0605('0x2a')]();};}function saveUpdates(_0x10c575,_0xb4d805){return function(_0x2ea61d){if(_0x2ea61d){return _0x2ea61d[_0x0605('0x2b')](_0x10c575)[_0x0605('0x2c')](function(_0x2896d7){return _0x2896d7;});}return null;};}function removeEntity(_0x9f2833,_0x1c3722){return function(_0x5a602e){if(_0x5a602e){return _0x5a602e[_0x0605('0x2d')]()[_0x0605('0x2c')](function(){_0x9f2833['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55ebd8,_0x33558f){return function(_0x226825){if(!_0x226825){_0x55ebd8[_0x0605('0x1f')](0x194);}return _0x226825;};}function handleError(_0x149e36,_0x1cee1d){_0x1cee1d=_0x1cee1d||0x1f4;return function(_0x4554df){logger['error'](_0x4554df[_0x0605('0x2e')]);if(_0x4554df['name']){delete _0x4554df[_0x0605('0x2f')];}_0x149e36[_0x0605('0x20')](_0x1cee1d)[_0x0605('0x30')](_0x4554df);};}exports[_0x0605('0x31')]=function(_0x1f65aa,_0x352dd6){var _0x56dd1a={'raw':![],'where':{'id':_0x1f65aa[_0x0605('0x32')]['id']}},_0x165a0c={};_0x165a0c[_0x0605('0x33')]=_[_0x0605('0x34')](db[_0x0605('0x35')][_0x0605('0x36')]);_0x165a0c[_0x0605('0x37')]=_[_0x0605('0x34')](_0x1f65aa[_0x0605('0x37')]);_0x165a0c[_0x0605('0x38')]=_[_0x0605('0x39')](_0x165a0c[_0x0605('0x33')],_0x165a0c[_0x0605('0x37')]);_0x56dd1a[_0x0605('0x3a')]=_[_0x0605('0x39')](_0x165a0c[_0x0605('0x33')],qs[_0x0605('0x3b')](_0x1f65aa[_0x0605('0x37')][_0x0605('0x3b')]));_0x56dd1a[_0x0605('0x3a')]=_0x56dd1a[_0x0605('0x3a')][_0x0605('0x3c')]?_0x56dd1a[_0x0605('0x3a')]:_0x165a0c[_0x0605('0x33')];if(_0x1f65aa[_0x0605('0x37')][_0x0605('0x3d')]){_0x56dd1a[_0x0605('0x3e')]=[{'all':!![]}];}_0x56dd1a=_['merge']({},_0x56dd1a,_0x1f65aa[_0x0605('0x3f')]);return db[_0x0605('0x35')]['find'](_0x56dd1a)[_0x0605('0x2c')](handleEntityNotFound(_0x352dd6,null))[_0x0605('0x2c')](respondWithResult(_0x352dd6,null))['catch'](handleError(_0x352dd6,null));};exports[_0x0605('0x2d')]=function(_0x4743b4,_0x239e8f){return db[_0x0605('0x35')][_0x0605('0x40')]({'where':{'id':_0x4743b4[_0x0605('0x32')]['id']}})['then'](handleEntityNotFound(_0x239e8f,null))['then'](removeEntity(_0x239e8f,null))[_0x0605('0x41')](handleError(_0x239e8f,null));};function widgetAttributes(_0x18f7f2){try{switch(_0x18f7f2[_0x0605('0x42')]){case'iframe':return[{'name':_0x0605('0x43'),'value':_0x18f7f2['attrUrl']||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x0]?_0x18f7f2[_0x0605('0x44')][0x0][_0x0605('0x45')]:undefined)||_0x0605('0x46')}];case _0x0605('0x47'):return[{'name':_0x0605('0x48'),'value':_0x18f7f2[_0x0605('0x48')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x0]?_0x18f7f2['attrs'][0x0][_0x0605('0x45')]:undefined)||''}];case'clock':return[{'name':_0x0605('0x49'),'value':_0x18f7f2[_0x0605('0x49')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2['attrs'][0x0]?_0x18f7f2['attrs'][0x0][_0x0605('0x45')]:undefined)||'HH:mm:ss'},{'name':_0x0605('0x4a'),'value':_0x18f7f2[_0x0605('0x4a')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x1]?_0x18f7f2[_0x0605('0x44')][0x1][_0x0605('0x45')]:undefined)||_0x0605('0x4b')},{'name':_0x0605('0x4c'),'value':_0x18f7f2[_0x0605('0x4c')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x2]?_0x18f7f2[_0x0605('0x44')][0x2][_0x0605('0x45')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x18f7f2[_0x0605('0x4d')]||(_0x18f7f2['attrs']&&_0x18f7f2[_0x0605('0x44')][0x0]?_0x18f7f2[_0x0605('0x44')][0x0]['value']:undefined)||_0x0605('0x4e')},{'name':_0x0605('0x4f'),'value':_0x18f7f2['attrVoiceQueues']||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x1]?_0x18f7f2['attrs'][0x1][_0x0605('0x45')]:undefined)||[]},{'name':_0x0605('0x4c'),'value':_0x18f7f2['attrFontSize']||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2['attrs'][0x2]?_0x18f7f2['attrs'][0x2][_0x0605('0x45')]:undefined)||0x14},{'name':_0x0605('0x50'),'value':_0x18f7f2[_0x0605('0x50')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x3]?_0x18f7f2[_0x0605('0x44')][0x3][_0x0605('0x45')]:undefined)||_0x0605('0x51')},{'name':'attrEmailAccounts','value':_0x18f7f2[_0x0605('0x52')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x4]?_0x18f7f2['attrs'][0x4][_0x0605('0x45')]:undefined)||''},{'name':_0x0605('0x53'),'value':_0x18f7f2[_0x0605('0x53')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x5]?_0x18f7f2[_0x0605('0x44')][0x5][_0x0605('0x45')]:undefined)||''},{'name':_0x0605('0x54'),'value':_0x18f7f2[_0x0605('0x54')]||(_0x18f7f2['attrs']&&_0x18f7f2[_0x0605('0x44')][0x6]?_0x18f7f2[_0x0605('0x44')][0x6][_0x0605('0x45')]:undefined)||''},{'name':_0x0605('0x55'),'value':_0x18f7f2[_0x0605('0x55')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x7]?_0x18f7f2[_0x0605('0x44')][0x7][_0x0605('0x45')]:undefined)||''},{'name':_0x0605('0x56'),'value':_0x18f7f2['attrWhatsappAccounts']||(_0x18f7f2['attrs']&&_0x18f7f2['attrs'][0x8]?_0x18f7f2[_0x0605('0x44')][0x8][_0x0605('0x45')]:undefined)||''},{'name':_0x0605('0x57'),'value':_0x18f7f2[_0x0605('0x57')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x9]?_0x18f7f2['attrs'][0x9][_0x0605('0x45')]:undefined)||''}];case _0x0605('0x58'):case _0x0605('0x59'):return[{'name':_0x0605('0x5a'),'value':_0x18f7f2['attrSerie1']||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x0]?_0x18f7f2[_0x0605('0x44')][0x0]['value']:undefined)||'total'},{'name':_0x0605('0x5b'),'value':_0x18f7f2[_0x0605('0x5b')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2['attrs'][0x1]?_0x18f7f2['attrs'][0x1][_0x0605('0x45')]:undefined)||null},{'name':'attrSerie3','value':_0x18f7f2[_0x0605('0x5c')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x2]?_0x18f7f2[_0x0605('0x44')][0x2][_0x0605('0x45')]:undefined)||null},{'name':_0x0605('0x4f'),'value':_0x18f7f2[_0x0605('0x4f')]||(_0x18f7f2['attrs']&&_0x18f7f2[_0x0605('0x44')][0x3]?_0x18f7f2['attrs'][0x3][_0x0605('0x45')]:undefined)||[]},{'name':'attrChannel','value':_0x18f7f2[_0x0605('0x50')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x4]?_0x18f7f2[_0x0605('0x44')][0x4]['value']:undefined)||'voice'},{'name':_0x0605('0x52'),'value':_0x18f7f2[_0x0605('0x52')]||(_0x18f7f2['attrs']&&_0x18f7f2['attrs'][0x5]?_0x18f7f2['attrs'][0x5][_0x0605('0x45')]:undefined)||''},{'name':_0x0605('0x53'),'value':_0x18f7f2[_0x0605('0x53')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x6]?_0x18f7f2[_0x0605('0x44')][0x6]['value']:undefined)||''},{'name':_0x0605('0x54'),'value':_0x18f7f2[_0x0605('0x54')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x7]?_0x18f7f2[_0x0605('0x44')][0x7][_0x0605('0x45')]:undefined)||''},{'name':_0x0605('0x55'),'value':_0x18f7f2[_0x0605('0x55')]||(_0x18f7f2['attrs']&&_0x18f7f2['attrs'][0x8]?_0x18f7f2['attrs'][0x8][_0x0605('0x45')]:undefined)||''},{'name':_0x0605('0x56'),'value':_0x18f7f2[_0x0605('0x56')]||(_0x18f7f2['attrs']&&_0x18f7f2['attrs'][0x9]?_0x18f7f2[_0x0605('0x44')][0x9][_0x0605('0x45')]:undefined)||''},{'name':_0x0605('0x57'),'value':_0x18f7f2[_0x0605('0x57')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0xa]?_0x18f7f2[_0x0605('0x44')][0xa][_0x0605('0x45')]:undefined)||''}];case _0x0605('0x5d'):return[{'name':_0x0605('0x5e'),'type':_0x18f7f2[_0x0605('0x5f')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2['attrs'][0x0]?_0x18f7f2[_0x0605('0x44')][0x0][_0x0605('0x42')]:undefined)||null,'value':_0x18f7f2[_0x0605('0x5e')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x0]?_0x18f7f2[_0x0605('0x44')][0x0]['value']:undefined)||null},{'name':_0x0605('0x60'),'value':_0x18f7f2['attrRefresh']||(_0x18f7f2['attrs']&&_0x18f7f2[_0x0605('0x44')][0x1]?_0x18f7f2[_0x0605('0x44')][0x1][_0x0605('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x1d26a3){logger[_0x0605('0x61')](_0x0605('0x62'),JSON[_0x0605('0x63')](_0x1d26a3));return[];}}exports[_0x0605('0x64')]=function(_0x7ac9f0,_0x309da5){if(_0x7ac9f0['body']){_0x7ac9f0['body']['attrs']=widgetAttributes(_0x7ac9f0['body']);}return db['DashboardItem'][_0x0605('0x64')](_0x7ac9f0[_0x0605('0x65')],{})[_0x0605('0x2c')](respondWithResult(_0x309da5,0xc9))['catch'](handleError(_0x309da5,null));};exports[_0x0605('0x2b')]=function(_0x3e3bd7,_0x43d2a6){if(_0x3e3bd7[_0x0605('0x65')]['id']){delete _0x3e3bd7[_0x0605('0x65')]['id'];}_0x3e3bd7[_0x0605('0x65')]['attrs']=widgetAttributes(_0x3e3bd7[_0x0605('0x65')]);return db[_0x0605('0x35')][_0x0605('0x40')]({'where':{'id':_0x3e3bd7['params']['id']}})['then'](handleEntityNotFound(_0x43d2a6,null))['then'](saveUpdates(_0x3e3bd7[_0x0605('0x65')],null))[_0x0605('0x2c')](respondWithResult(_0x43d2a6,null))[_0x0605('0x41')](handleError(_0x43d2a6,null));}; \ No newline at end of file +var _0x5f71=['attrChatWebsites','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','attrEmailAccounts','attrSmsAccounts','web-report','attrReport','type','attrRefresh','error','widgetAttributes:\x20%s','create','body','update','eml-format','zip-dir','request-promise','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','name','send','show','params','model','DashboardItem','query','filters','intersection','fields','attributes','length','include','options','find','catch','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts'];(function(_0x208b3d,_0x17bb5c){var _0xc6800c=function(_0x5b65a2){while(--_0x5b65a2){_0x208b3d['push'](_0x208b3d['shift']());}};_0xc6800c(++_0x17bb5c);}(_0x5f71,0xc9));var _0x15f7=function(_0x546526,_0x36830c){_0x546526=_0x546526-0x0;var _0x298050=_0x5f71[_0x546526];return _0x298050;};'use strict';var emlformat=require(_0x15f7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x15f7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x15f7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x15f7('0x3'));var path=require(_0x15f7('0x4'));var sox=require('sox');var csv=require(_0x15f7('0x5'));var ejs=require(_0x15f7('0x6'));var fs=require('fs');var fs_extra=require(_0x15f7('0x7'));var _=require(_0x15f7('0x8'));var squel=require(_0x15f7('0x9'));var crypto=require(_0x15f7('0xa'));var jsforce=require(_0x15f7('0xb'));var deskjs=require(_0x15f7('0xc'));var toCsv=require(_0x15f7('0x5'));var querystring=require(_0x15f7('0xd'));var Papa=require(_0x15f7('0xe'));var Redis=require(_0x15f7('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x15f7('0x10'));var hardwareService=require(_0x15f7('0x11'));var logger=require('../../config/logger')(_0x15f7('0x12'));var utils=require(_0x15f7('0x13'));var config=require(_0x15f7('0x14'));var licenseUtil=require(_0x15f7('0x15'));var db=require(_0x15f7('0x16'))['db'];config[_0x15f7('0x17')]=_[_0x15f7('0x18')](config['redis'],{'host':_0x15f7('0x19'),'port':0x18eb});var socket=require(_0x15f7('0x1a'))(new Redis(config[_0x15f7('0x17')]));require('./dashboardItem.socket')[_0x15f7('0x1b')](socket);function respondWithStatusCode(_0x40dcb1,_0x52c1be){_0x52c1be=_0x52c1be||0xcc;return function(_0x24b6f5){if(_0x24b6f5){return _0x40dcb1[_0x15f7('0x1c')](_0x52c1be);}return _0x40dcb1[_0x15f7('0x1d')](_0x52c1be)[_0x15f7('0x1e')]();};}function respondWithResult(_0x345892,_0x2c0e67){_0x2c0e67=_0x2c0e67||0xc8;return function(_0x42928d){if(_0x42928d){return _0x345892['status'](_0x2c0e67)[_0x15f7('0x1f')](_0x42928d);}};}function respondWithFilteredResult(_0x385844,_0x4e61c9){return function(_0x2c78ca){if(_0x2c78ca){var _0x333ff8=typeof _0x4e61c9[_0x15f7('0x20')]===_0x15f7('0x21')&&typeof _0x4e61c9[_0x15f7('0x22')]===_0x15f7('0x21');var _0x3ced97=_0x2c78ca['count'];var _0x299fcf=_0x333ff8?0x0:_0x4e61c9[_0x15f7('0x20')];var _0x1362e1=_0x333ff8?_0x2c78ca[_0x15f7('0x23')]:_0x4e61c9[_0x15f7('0x20')]+_0x4e61c9[_0x15f7('0x22')];var _0x3bf068;if(_0x1362e1>=_0x3ced97){_0x1362e1=_0x3ced97;_0x3bf068=0xc8;}else{_0x3bf068=0xce;}_0x385844['status'](_0x3bf068);return _0x385844['set'](_0x15f7('0x24'),_0x299fcf+'-'+_0x1362e1+'/'+_0x3ced97)[_0x15f7('0x1f')](_0x2c78ca);}return null;};}function patchUpdates(_0x370652){return function(_0x35de93){try{jsonpatch[_0x15f7('0x25')](_0x35de93,_0x370652,!![]);}catch(_0x5cab58){return BPromise[_0x15f7('0x26')](_0x5cab58);}return _0x35de93['save']();};}function saveUpdates(_0x292958,_0xe6ec62){return function(_0x49fc13){if(_0x49fc13){return _0x49fc13['update'](_0x292958)[_0x15f7('0x27')](function(_0x5a1e21){return _0x5a1e21;});}return null;};}function removeEntity(_0x53128c,_0x2928fa){return function(_0x5de827){if(_0x5de827){return _0x5de827[_0x15f7('0x28')]()[_0x15f7('0x27')](function(){_0x53128c[_0x15f7('0x1d')](0xcc)[_0x15f7('0x1e')]();});}};}function handleEntityNotFound(_0x2d4d2d,_0x59b9e2){return function(_0x3adf28){if(!_0x3adf28){_0x2d4d2d[_0x15f7('0x1c')](0x194);}return _0x3adf28;};}function handleError(_0x1b50ed,_0x48f27c){_0x48f27c=_0x48f27c||0x1f4;return function(_0x4dd3d6){logger['error'](_0x4dd3d6['stack']);if(_0x4dd3d6[_0x15f7('0x29')]){delete _0x4dd3d6[_0x15f7('0x29')];}_0x1b50ed[_0x15f7('0x1d')](_0x48f27c)[_0x15f7('0x2a')](_0x4dd3d6);};}exports[_0x15f7('0x2b')]=function(_0x477950,_0x5394b6){var _0x521934={'raw':![],'where':{'id':_0x477950[_0x15f7('0x2c')]['id']}},_0x31bf43={};_0x31bf43[_0x15f7('0x2d')]=_['keys'](db[_0x15f7('0x2e')]['rawAttributes']);_0x31bf43[_0x15f7('0x2f')]=_['keys'](_0x477950[_0x15f7('0x2f')]);_0x31bf43[_0x15f7('0x30')]=_[_0x15f7('0x31')](_0x31bf43[_0x15f7('0x2d')],_0x31bf43['query']);_0x521934['attributes']=_[_0x15f7('0x31')](_0x31bf43[_0x15f7('0x2d')],qs[_0x15f7('0x32')](_0x477950[_0x15f7('0x2f')][_0x15f7('0x32')]));_0x521934[_0x15f7('0x33')]=_0x521934[_0x15f7('0x33')][_0x15f7('0x34')]?_0x521934[_0x15f7('0x33')]:_0x31bf43[_0x15f7('0x2d')];if(_0x477950[_0x15f7('0x2f')]['includeAll']){_0x521934[_0x15f7('0x35')]=[{'all':!![]}];}_0x521934=_['merge']({},_0x521934,_0x477950[_0x15f7('0x36')]);return db[_0x15f7('0x2e')][_0x15f7('0x37')](_0x521934)[_0x15f7('0x27')](handleEntityNotFound(_0x5394b6,null))[_0x15f7('0x27')](respondWithResult(_0x5394b6,null))[_0x15f7('0x38')](handleError(_0x5394b6,null));};exports['destroy']=function(_0x1af447,_0x5a2343){return db[_0x15f7('0x2e')][_0x15f7('0x37')]({'where':{'id':_0x1af447[_0x15f7('0x2c')]['id']}})[_0x15f7('0x27')](handleEntityNotFound(_0x5a2343,null))[_0x15f7('0x27')](removeEntity(_0x5a2343,null))['catch'](handleError(_0x5a2343,null));};function widgetAttributes(_0x2c875e){try{switch(_0x2c875e['type']){case'iframe':return[{'name':_0x15f7('0x39'),'value':_0x2c875e['attrUrl']||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x0]?_0x2c875e[_0x15f7('0x3a')][0x0][_0x15f7('0x3b')]:undefined)||_0x15f7('0x3c')}];case _0x15f7('0x3d'):return[{'name':_0x15f7('0x3e'),'value':_0x2c875e['attrPath']||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e['attrs'][0x0]?_0x2c875e[_0x15f7('0x3a')][0x0][_0x15f7('0x3b')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x2c875e[_0x15f7('0x3f')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x0]?_0x2c875e[_0x15f7('0x3a')][0x0][_0x15f7('0x3b')]:undefined)||_0x15f7('0x40')},{'name':_0x15f7('0x41'),'value':_0x2c875e[_0x15f7('0x41')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x1]?_0x2c875e[_0x15f7('0x3a')][0x1][_0x15f7('0x3b')]:undefined)||'0.00'},{'name':_0x15f7('0x42'),'value':_0x2c875e[_0x15f7('0x42')]||(_0x2c875e['attrs']&&_0x2c875e[_0x15f7('0x3a')][0x2]?_0x2c875e[_0x15f7('0x3a')][0x2]['value']:undefined)||0xc}];case _0x15f7('0x43'):return[{'name':_0x15f7('0x44'),'value':_0x2c875e[_0x15f7('0x44')]||(_0x2c875e['attrs']&&_0x2c875e[_0x15f7('0x3a')][0x0]?_0x2c875e[_0x15f7('0x3a')][0x0][_0x15f7('0x3b')]:undefined)||'total'},{'name':_0x15f7('0x45'),'value':_0x2c875e['attrVoiceQueues']||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x1]?_0x2c875e[_0x15f7('0x3a')][0x1][_0x15f7('0x3b')]:undefined)||[]},{'name':_0x15f7('0x42'),'value':_0x2c875e[_0x15f7('0x42')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x2]?_0x2c875e[_0x15f7('0x3a')][0x2][_0x15f7('0x3b')]:undefined)||0x14},{'name':_0x15f7('0x46'),'value':_0x2c875e[_0x15f7('0x46')]||(_0x2c875e['attrs']&&_0x2c875e[_0x15f7('0x3a')][0x3]?_0x2c875e['attrs'][0x3][_0x15f7('0x3b')]:undefined)||_0x15f7('0x47')},{'name':'attrEmailAccounts','value':_0x2c875e['attrEmailAccounts']||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x4]?_0x2c875e[_0x15f7('0x3a')][0x4]['value']:undefined)||''},{'name':_0x15f7('0x48'),'value':_0x2c875e[_0x15f7('0x48')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x5]?_0x2c875e[_0x15f7('0x3a')][0x5][_0x15f7('0x3b')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2c875e['attrSmsAccounts']||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e['attrs'][0x6]?_0x2c875e[_0x15f7('0x3a')][0x6][_0x15f7('0x3b')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2c875e[_0x15f7('0x49')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x7]?_0x2c875e[_0x15f7('0x3a')][0x7][_0x15f7('0x3b')]:undefined)||''},{'name':_0x15f7('0x4a'),'value':_0x2c875e[_0x15f7('0x4a')]||(_0x2c875e['attrs']&&_0x2c875e[_0x15f7('0x3a')][0x8]?_0x2c875e[_0x15f7('0x3a')][0x8][_0x15f7('0x3b')]:undefined)||''},{'name':_0x15f7('0x4b'),'value':_0x2c875e[_0x15f7('0x4b')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x9]?_0x2c875e['attrs'][0x9][_0x15f7('0x3b')]:undefined)||''}];case _0x15f7('0x4c'):case'pie-chart':return[{'name':_0x15f7('0x4d'),'value':_0x2c875e[_0x15f7('0x4d')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e['attrs'][0x0]?_0x2c875e[_0x15f7('0x3a')][0x0]['value']:undefined)||_0x15f7('0x4e')},{'name':_0x15f7('0x4f'),'value':_0x2c875e[_0x15f7('0x4f')]||(_0x2c875e['attrs']&&_0x2c875e[_0x15f7('0x3a')][0x1]?_0x2c875e[_0x15f7('0x3a')][0x1][_0x15f7('0x3b')]:undefined)||null},{'name':'attrSerie3','value':_0x2c875e[_0x15f7('0x50')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x2]?_0x2c875e[_0x15f7('0x3a')][0x2][_0x15f7('0x3b')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x2c875e[_0x15f7('0x45')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e['attrs'][0x3]?_0x2c875e['attrs'][0x3]['value']:undefined)||[]},{'name':_0x15f7('0x46'),'value':_0x2c875e[_0x15f7('0x46')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e['attrs'][0x4]?_0x2c875e[_0x15f7('0x3a')][0x4][_0x15f7('0x3b')]:undefined)||'voice'},{'name':_0x15f7('0x51'),'value':_0x2c875e[_0x15f7('0x51')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x5]?_0x2c875e['attrs'][0x5][_0x15f7('0x3b')]:undefined)||''},{'name':_0x15f7('0x48'),'value':_0x2c875e[_0x15f7('0x48')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e['attrs'][0x6]?_0x2c875e[_0x15f7('0x3a')][0x6][_0x15f7('0x3b')]:undefined)||''},{'name':_0x15f7('0x52'),'value':_0x2c875e[_0x15f7('0x52')]||(_0x2c875e['attrs']&&_0x2c875e['attrs'][0x7]?_0x2c875e[_0x15f7('0x3a')][0x7][_0x15f7('0x3b')]:undefined)||''},{'name':_0x15f7('0x49'),'value':_0x2c875e['attrOpenchannelAccounts']||(_0x2c875e['attrs']&&_0x2c875e[_0x15f7('0x3a')][0x8]?_0x2c875e[_0x15f7('0x3a')][0x8][_0x15f7('0x3b')]:undefined)||''},{'name':_0x15f7('0x4a'),'value':_0x2c875e[_0x15f7('0x4a')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x9]?_0x2c875e[_0x15f7('0x3a')][0x9][_0x15f7('0x3b')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2c875e['attrChatWebsites']||(_0x2c875e['attrs']&&_0x2c875e[_0x15f7('0x3a')][0xa]?_0x2c875e[_0x15f7('0x3a')][0xa][_0x15f7('0x3b')]:undefined)||''}];case _0x15f7('0x53'):return[{'name':_0x15f7('0x54'),'type':_0x2c875e['reportType']||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x0]?_0x2c875e[_0x15f7('0x3a')][0x0][_0x15f7('0x55')]:undefined)||null,'value':_0x2c875e[_0x15f7('0x54')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x0]?_0x2c875e['attrs'][0x0][_0x15f7('0x3b')]:undefined)||null},{'name':'attrRefresh','value':_0x2c875e[_0x15f7('0x56')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x1]?_0x2c875e[_0x15f7('0x3a')][0x1][_0x15f7('0x3b')]:undefined)||0x0}];default:return[];}}catch(_0x1cabc3){logger[_0x15f7('0x57')](_0x15f7('0x58'),JSON['stringify'](_0x1cabc3));return[];}}exports[_0x15f7('0x59')]=function(_0x3e320d,_0x5e0657){if(_0x3e320d[_0x15f7('0x5a')]){_0x3e320d['body'][_0x15f7('0x3a')]=widgetAttributes(_0x3e320d[_0x15f7('0x5a')]);}return db[_0x15f7('0x2e')][_0x15f7('0x59')](_0x3e320d['body'],{})['then'](respondWithResult(_0x5e0657,0xc9))['catch'](handleError(_0x5e0657,null));};exports[_0x15f7('0x5b')]=function(_0x343b44,_0x249087){if(_0x343b44[_0x15f7('0x5a')]['id']){delete _0x343b44[_0x15f7('0x5a')]['id'];}_0x343b44[_0x15f7('0x5a')]['attrs']=widgetAttributes(_0x343b44['body']);return db['DashboardItem'][_0x15f7('0x37')]({'where':{'id':_0x343b44[_0x15f7('0x2c')]['id']}})['then'](handleEntityNotFound(_0x249087,null))[_0x15f7('0x27')](saveUpdates(_0x343b44[_0x15f7('0x5a')],null))[_0x15f7('0x27')](respondWithResult(_0x249087,null))[_0x15f7('0x38')](handleError(_0x249087,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 32e89dd..69c1f61 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 _0x6aa1=['hook','exports','../../mysqldb','DashboardItem','save','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6aa1,0x1da));var _0x16aa=function(_0x271c83,_0xa5f09d){_0x271c83=_0x271c83-0x0;var _0x440ca2=_0x6aa1[_0x271c83];return _0x440ca2;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x16aa('0x0'))['db'][_0x16aa('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x16aa('0x2'),'afterUpdate':'update','afterDestroy':_0x16aa('0x3')};function emitEvent(_0x42d13e){return function(_0x20ca23,_0x515516,_0x598378){DashboardItemEvents[_0x16aa('0x4')](_0x42d13e+':'+_0x20ca23['id'],_0x20ca23);DashboardItemEvents[_0x16aa('0x4')](_0x42d13e,_0x20ca23);_0x598378(null);};}for(var e in events){if(events[_0x16aa('0x5')](e)){var event=events[e];DashboardItem[_0x16aa('0x6')](e,emitEvent(event));}}module[_0x16aa('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0xcde7=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','DashboardItem'];(function(_0x26eabf,_0x4420a0){var _0x56d5e3=function(_0x4f31fa){while(--_0x4f31fa){_0x26eabf['push'](_0x26eabf['shift']());}};_0x56d5e3(++_0x4420a0);}(_0xcde7,0x10c));var _0x7cde=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xcde7[_0x5d6456];return _0x4d66c1;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x7cde('0x0'))['db'][_0x7cde('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x7cde('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7cde('0x3'),'afterDestroy':_0x7cde('0x4')};function emitEvent(_0x1c60c4){return function(_0x234d90,_0x10d752,_0xe32346){DashboardItemEvents[_0x7cde('0x5')](_0x1c60c4+':'+_0x234d90['id'],_0x234d90);DashboardItemEvents[_0x7cde('0x5')](_0x1c60c4,_0x234d90);_0xe32346(null);};}for(var e in events){if(events[_0x7cde('0x6')](e)){var event=events[e];DashboardItem[_0x7cde('0x7')](e,emitEvent(event));}}module[_0x7cde('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 1e56deb..7d6e997 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 _0x11db=['../../config/logger','bluebird','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util'];(function(_0x30aaf8,_0x45433d){var _0x5d735f=function(_0x5a6d6a){while(--_0x5a6d6a){_0x30aaf8['push'](_0x30aaf8['shift']());}};_0x5d735f(++_0x45433d);}(_0x11db,0x195));var _0xb11d=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x11db[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xb11d('0x0'));var util=require(_0xb11d('0x1'));var logger=require(_0xb11d('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb11d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb11d('0x4'));var config=require(_0xb11d('0x5'));var attributes=require(_0xb11d('0x6'));module[_0xb11d('0x7')]=function(_0x59994b,_0x112a4a){return _0x59994b[_0xb11d('0x8')](_0xb11d('0x9'),attributes,{'tableName':_0xb11d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x692a=['moment','bluebird','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','dashboard_items','lodash','util'];(function(_0x281a86,_0x4ed37a){var _0xfbb5a2=function(_0x276922){while(--_0x276922){_0x281a86['push'](_0x281a86['shift']());}};_0xfbb5a2(++_0x4ed37a);}(_0x692a,0x12a));var _0xa692=function(_0x299070,_0x3dfaa1){_0x299070=_0x299070-0x0;var _0x1b2050=_0x692a[_0x299070];return _0x1b2050;};'use strict';var _=require(_0xa692('0x0'));var util=require(_0xa692('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa692('0x2'));var BPromise=require(_0xa692('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa692('0x4'));var config=require(_0xa692('0x5'));var attributes=require(_0xa692('0x6'));module[_0xa692('0x7')]=function(_0x496d52,_0x2c0ed1){return _0x496d52[_0xa692('0x8')]('DashboardItem',attributes,{'tableName':_0xa692('0x9'),'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 5cc5f2d..69d5bb3 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 _0xaf98=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x304429,_0x5c956f){var _0x26a77f=function(_0xe50d9d){while(--_0xe50d9d){_0x304429['push'](_0x304429['shift']());}};_0x26a77f(++_0x5c956f);}(_0xaf98,0x95));var _0x8af9=function(_0x22cddd,_0x497967){_0x22cddd=_0x22cddd-0x0;var _0x2f24dc=_0xaf98[_0x22cddd];return _0x2f24dc;};'use strict';var _=require(_0x8af9('0x0'));var util=require(_0x8af9('0x1'));var moment=require(_0x8af9('0x2'));var BPromise=require(_0x8af9('0x3'));var rs=require(_0x8af9('0x4'));var fs=require('fs');var Redis=require(_0x8af9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8af9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8af9('0x7'));var jayson=require(_0x8af9('0x8'));var client=jayson['client'][_0x8af9('0x9')]({'port':0x232a});config[_0x8af9('0xa')]=_[_0x8af9('0xb')](config[_0x8af9('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8af9('0xa')]));require('./dashboardItem.socket')[_0x8af9('0xc')](socket);function respondWithRpcPromise(_0x259168,_0x266fcb,_0x58c932){return new BPromise(function(_0x4f4dca,_0x18593a){return client[_0x8af9('0xd')](_0x259168,_0x58c932)[_0x8af9('0xe')](function(_0x1360cd){logger[_0x8af9('0xf')](_0x8af9('0x10'),_0x266fcb,_0x8af9('0x11'));logger[_0x8af9('0x12')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x266fcb,_0x8af9('0x11'),JSON[_0x8af9('0x13')](_0x1360cd));if(_0x1360cd[_0x8af9('0x14')]){if(_0x1360cd[_0x8af9('0x14')][_0x8af9('0x15')]===0x1f4){logger[_0x8af9('0x14')]('DashboardItem,\x20%s,\x20%s',_0x266fcb,_0x1360cd['error'][_0x8af9('0x16')]);return _0x18593a(_0x1360cd[_0x8af9('0x14')][_0x8af9('0x16')]);}logger[_0x8af9('0x14')](_0x8af9('0x10'),_0x266fcb,_0x1360cd[_0x8af9('0x14')]['message']);return _0x4f4dca(_0x1360cd[_0x8af9('0x14')]['message']);}else{logger[_0x8af9('0xf')]('DashboardItem,\x20%s,\x20%s',_0x266fcb,_0x8af9('0x11'));_0x4f4dca(_0x1360cd[_0x8af9('0x17')][_0x8af9('0x16')]);}})[_0x8af9('0x18')](function(_0x4c806b){logger[_0x8af9('0x14')]('DashboardItem,\x20%s,\x20%s',_0x266fcb,_0x4c806b);_0x18593a(_0x4c806b);});});} \ No newline at end of file +var _0x765a=['../../config/environment','jayson/promise','client','redis','defaults','localhost','./dashboardItem.socket','register','request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','DashboardItem,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0x765a,0x117));var _0xa765=function(_0xb9ddce,_0x524945){_0xb9ddce=_0xb9ddce-0x0;var _0x246755=_0x765a[_0xb9ddce];return _0x246755;};'use strict';var _=require(_0xa765('0x0'));var util=require(_0xa765('0x1'));var moment=require(_0xa765('0x2'));var BPromise=require(_0xa765('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa765('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa765('0x5'))(_0xa765('0x6'));var config=require(_0xa765('0x7'));var jayson=require(_0xa765('0x8'));var client=jayson[_0xa765('0x9')]['http']({'port':0x232a});config[_0xa765('0xa')]=_[_0xa765('0xb')](config['redis'],{'host':_0xa765('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa765('0xa')]));require(_0xa765('0xd'))[_0xa765('0xe')](socket);function respondWithRpcPromise(_0x1aac67,_0x43a64c,_0x3cf0c1){return new BPromise(function(_0x19de92,_0x138386){return client[_0xa765('0xf')](_0x1aac67,_0x3cf0c1)[_0xa765('0x10')](function(_0x41b21a){logger[_0xa765('0x11')]('DashboardItem,\x20%s,\x20%s',_0x43a64c,_0xa765('0x12'));logger[_0xa765('0x13')](_0xa765('0x14'),_0x43a64c,_0xa765('0x12'),JSON['stringify'](_0x41b21a));if(_0x41b21a[_0xa765('0x15')]){if(_0x41b21a['error'][_0xa765('0x16')]===0x1f4){logger[_0xa765('0x15')](_0xa765('0x17'),_0x43a64c,_0x41b21a[_0xa765('0x15')][_0xa765('0x18')]);return _0x138386(_0x41b21a[_0xa765('0x15')][_0xa765('0x18')]);}logger['error'](_0xa765('0x17'),_0x43a64c,_0x41b21a['error'][_0xa765('0x18')]);return _0x19de92(_0x41b21a[_0xa765('0x15')][_0xa765('0x18')]);}else{logger[_0xa765('0x11')](_0xa765('0x17'),_0x43a64c,_0xa765('0x12'));_0x19de92(_0x41b21a[_0xa765('0x19')]['message']);}})['catch'](function(_0x508a97){logger[_0xa765('0x15')](_0xa765('0x17'),_0x43a64c,_0x508a97);_0x138386(_0x508a97);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index ceafc94..abfd3e5 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 _0xbc04=['dashboardItem:','remove','update','length'];(function(_0x201994,_0x4a157c){var _0x3f658f=function(_0x59c30b){while(--_0x59c30b){_0x201994['push'](_0x201994['shift']());}};_0x3f658f(++_0x4a157c);}(_0xbc04,0x99));var _0x4bc0=function(_0x531b0e,_0x737e2d){_0x531b0e=_0x531b0e-0x0;var _0x5064c1=_0xbc04[_0x531b0e];return _0x5064c1;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save',_0x4bc0('0x0'),_0x4bc0('0x1')];function createListener(_0x5b0f71,_0x22c09c){return function(_0x324610){_0x22c09c['emit'](_0x5b0f71,_0x324610);};}function removeListener(_0x4d0e66,_0x4cd622){return function(){DashboardItemEvents['removeListener'](_0x4d0e66,_0x4cd622);};}exports['register']=function(_0x32e61d){for(var _0x59717a=0x0,_0x2c1c22=events[_0x4bc0('0x2')];_0x59717a<_0x2c1c22;_0x59717a++){var _0x676c13=events[_0x59717a];var _0x27cf4a=createListener(_0x4bc0('0x3')+_0x676c13,_0x32e61d);DashboardItemEvents['on'](_0x676c13,_0x27cf4a);}}; \ No newline at end of file +var _0x2bf9=['register','length','remove','update','emit','removeListener'];(function(_0x3732e9,_0x2b015b){var _0x309d04=function(_0x27b0cb){while(--_0x27b0cb){_0x3732e9['push'](_0x3732e9['shift']());}};_0x309d04(++_0x2b015b);}(_0x2bf9,0x140));var _0x92bf=function(_0x38cb7c,_0xf33f42){_0x38cb7c=_0x38cb7c-0x0;var _0x2a5f5e=_0x2bf9[_0x38cb7c];return _0x2a5f5e;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save',_0x92bf('0x0'),_0x92bf('0x1')];function createListener(_0x429141,_0x1b1990){return function(_0x4cb14d){_0x1b1990[_0x92bf('0x2')](_0x429141,_0x4cb14d);};}function removeListener(_0x2599f6,_0x35eba7){return function(){DashboardItemEvents[_0x92bf('0x3')](_0x2599f6,_0x35eba7);};}exports[_0x92bf('0x4')]=function(_0x4fbb15){for(var _0x4230db=0x0,_0x998777=events[_0x92bf('0x5')];_0x4230db<_0x998777;_0x4230db++){var _0x4f3fbf=events[_0x4230db];var _0x44c5e1=createListener('dashboardItem:'+_0x4f3fbf,_0x4fbb15);DashboardItemEvents['on'](_0x4f3fbf,_0x44c5e1);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 32cdab6..2075396 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 _0xfbc4=['create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post'];(function(_0x567fff,_0xd8acd8){var _0x465a37=function(_0x9d7bf7){while(--_0x9d7bf7){_0x567fff['push'](_0x567fff['shift']());}};_0x465a37(++_0xd8acd8);}(_0xfbc4,0x16e));var _0x4fbc=function(_0xa0643f,_0x182abb){_0xa0643f=_0xa0643f-0x0;var _0x332f16=_0xfbc4[_0xa0643f];return _0x332f16;};'use strict';var multer=require(_0x4fbc('0x0'));var util=require(_0x4fbc('0x1'));var path=require(_0x4fbc('0x2'));var timeout=require(_0x4fbc('0x3'));var express=require(_0x4fbc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4fbc('0x5'));var interaction=require(_0x4fbc('0x6'));var config=require(_0x4fbc('0x7'));var controller=require(_0x4fbc('0x8'));router[_0x4fbc('0x9')](_0x4fbc('0xa'),auth[_0x4fbc('0xb')](),controller[_0x4fbc('0xc')]);router[_0x4fbc('0xd')]('/',auth[_0x4fbc('0xb')](),controller[_0x4fbc('0xe')]);router[_0x4fbc('0xf')]('/:id',auth[_0x4fbc('0xb')](),controller[_0x4fbc('0x10')]);router[_0x4fbc('0x11')](_0x4fbc('0xa'),auth['isAuthenticated'](),controller[_0x4fbc('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf5c7=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','show','post','isAuthenticated','create','put','destroy','exports'];(function(_0x585d81,_0xf6d74f){var _0x1aca0d=function(_0x3782d3){while(--_0x3782d3){_0x585d81['push'](_0x585d81['shift']());}};_0x1aca0d(++_0xf6d74f);}(_0xf5c7,0x169));var _0x7f5c=function(_0x35fabd,_0x825452){_0x35fabd=_0x35fabd-0x0;var _0x61a8ee=_0xf5c7[_0x35fabd];return _0x61a8ee;};'use strict';var multer=require(_0x7f5c('0x0'));var util=require('util');var path=require(_0x7f5c('0x1'));var timeout=require(_0x7f5c('0x2'));var express=require(_0x7f5c('0x3'));var router=express[_0x7f5c('0x4')]();var fs_extra=require(_0x7f5c('0x5'));var auth=require(_0x7f5c('0x6'));var interaction=require(_0x7f5c('0x7'));var config=require(_0x7f5c('0x8'));var controller=require(_0x7f5c('0x9'));router[_0x7f5c('0xa')](_0x7f5c('0xb'),auth['isAuthenticated'](),controller[_0x7f5c('0xc')]);router[_0x7f5c('0xd')]('/',auth[_0x7f5c('0xe')](),controller[_0x7f5c('0xf')]);router[_0x7f5c('0x10')](_0x7f5c('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x7f5c('0xb'),auth['isAuthenticated'](),controller[_0x7f5c('0x11')]);module[_0x7f5c('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 bba9c64..be2ef91 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 _0xd5c7=['exports','STRING','ENUM','first','sequelize'];(function(_0x5c6e5c,_0x3c6229){var _0x1b57bb=function(_0x821a66){while(--_0x821a66){_0x5c6e5c['push'](_0x5c6e5c['shift']());}};_0x1b57bb(++_0x3c6229);}(_0xd5c7,0x9a));var _0x7d5c=function(_0x4c42b0,_0x21604a){_0x4c42b0=_0x4c42b0-0x0;var _0x3377f9=_0xd5c7[_0x4c42b0];return _0x3377f9;};'use strict';var Sequelize=require(_0x7d5c('0x0'));module[_0x7d5c('0x1')]={'name':{'type':Sequelize[_0x7d5c('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x7d5c('0x3')](_0x7d5c('0x4'),'second','third'),'allowNull':![],'defaultValue':_0x7d5c('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6832=['STRING','first','third','sequelize'];(function(_0x33a111,_0x30081e){var _0x356694=function(_0x16fa87){while(--_0x16fa87){_0x33a111['push'](_0x33a111['shift']());}};_0x356694(++_0x30081e);}(_0x6832,0x1c7));var _0x2683=function(_0x169c48,_0x28b40c){_0x169c48=_0x169c48-0x0;var _0x24a702=_0x6832[_0x169c48];return _0x24a702;};'use strict';var Sequelize=require(_0x2683('0x0'));module['exports']={'name':{'type':Sequelize[_0x2683('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x2683('0x2'),'second',_0x2683('0x3')),'allowNull':![],'defaultValue':_0x2683('0x2')},'description':{'type':Sequelize[_0x2683('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 27dd841..f15f718 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 _0x2568=['lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','count','Content-Range','json','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','sendStatus','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','findAll','rows','show','params','keys','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x41ad28,_0x483c5a){var _0x294377=function(_0x53e480){while(--_0x53e480){_0x41ad28['push'](_0x41ad28['shift']());}};_0x294377(++_0x483c5a);}(_0x2568,0x148));var _0x8256=function(_0x3c4420,_0x34cb51){_0x3c4420=_0x3c4420-0x0;var _0x43c77e=_0x2568[_0x3c4420];return _0x43c77e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8256('0x0'));var zipdir=require(_0x8256('0x1'));var jsonpatch=require(_0x8256('0x2'));var rp=require(_0x8256('0x3'));var moment=require(_0x8256('0x4'));var BPromise=require(_0x8256('0x5'));var Mustache=require(_0x8256('0x6'));var util=require('util');var path=require(_0x8256('0x7'));var sox=require(_0x8256('0x8'));var csv=require(_0x8256('0x9'));var ejs=require(_0x8256('0xa'));var fs=require('fs');var fs_extra=require(_0x8256('0xb'));var _=require(_0x8256('0xc'));var squel=require(_0x8256('0xd'));var crypto=require(_0x8256('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8256('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8256('0x10'));var Papa=require(_0x8256('0x11'));var Redis=require('ioredis');var authService=require(_0x8256('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8256('0x13'));var hardwareService=require(_0x8256('0x14'));var logger=require(_0x8256('0x15'))('api');var utils=require(_0x8256('0x16'));var config=require(_0x8256('0x17'));var licenseUtil=require(_0x8256('0x18'));var db=require(_0x8256('0x19'))['db'];function respondWithStatusCode(_0x3b0b98,_0x181d48){_0x181d48=_0x181d48||0xcc;return function(_0x376ee0){if(_0x376ee0){return _0x3b0b98['sendStatus'](_0x181d48);}return _0x3b0b98[_0x8256('0x1a')](_0x181d48)[_0x8256('0x1b')]();};}function respondWithResult(_0x2928ef,_0x1bbbdc){_0x1bbbdc=_0x1bbbdc||0xc8;return function(_0x558cd7){if(_0x558cd7){return _0x2928ef[_0x8256('0x1a')](_0x1bbbdc)['json'](_0x558cd7);}};}function respondWithFilteredResult(_0x231e1b,_0x3384d4){return function(_0x2d025a){if(_0x2d025a){var _0x3d40a2=typeof _0x3384d4[_0x8256('0x1c')]==='undefined'&&typeof _0x3384d4[_0x8256('0x1d')]==='undefined';var _0x4e6ad4=_0x2d025a['count'];var _0x33dff8=_0x3d40a2?0x0:_0x3384d4['offset'];var _0x21dd6a=_0x3d40a2?_0x2d025a[_0x8256('0x1e')]:_0x3384d4['offset']+_0x3384d4[_0x8256('0x1d')];var _0x39aa2a;if(_0x21dd6a>=_0x4e6ad4){_0x21dd6a=_0x4e6ad4;_0x39aa2a=0xc8;}else{_0x39aa2a=0xce;}_0x231e1b[_0x8256('0x1a')](_0x39aa2a);return _0x231e1b['set'](_0x8256('0x1f'),_0x33dff8+'-'+_0x21dd6a+'/'+_0x4e6ad4)[_0x8256('0x20')](_0x2d025a);}return null;};}function patchUpdates(_0x39a50e){return function(_0x3851ff){try{jsonpatch['apply'](_0x3851ff,_0x39a50e,!![]);}catch(_0x4e25e3){return BPromise[_0x8256('0x21')](_0x4e25e3);}return _0x3851ff[_0x8256('0x22')]();};}function saveUpdates(_0x33e0ce,_0x35e3b8){return function(_0x10aac3){if(_0x10aac3){return _0x10aac3[_0x8256('0x23')](_0x33e0ce)[_0x8256('0x24')](function(_0x272902){return _0x272902;});}return null;};}function removeEntity(_0x266e44,_0x1265dc){return function(_0x61bf74){if(_0x61bf74){return _0x61bf74[_0x8256('0x25')]()[_0x8256('0x24')](function(){var _0xbe4eb7=_0x61bf74[_0x8256('0x26')]({'plain':!![]});var _0x5b40c0=_0x8256('0x27');return db[_0x8256('0x28')]['destroy']({'where':{'type':_0x5b40c0,'resourceId':_0xbe4eb7['id']}})[_0x8256('0x24')](function(){return _0x61bf74;});})['then'](function(){_0x266e44[_0x8256('0x1a')](0xcc)[_0x8256('0x1b')]();});}};}function handleEntityNotFound(_0x3efab2,_0x34ec07){return function(_0x7c4afb){if(!_0x7c4afb){_0x3efab2[_0x8256('0x29')](0x194);}return _0x7c4afb;};}function handleError(_0x349815,_0x2464a6){_0x2464a6=_0x2464a6||0x1f4;return function(_0x4d4bc3){logger[_0x8256('0x2a')](_0x4d4bc3[_0x8256('0x2b')]);if(_0x4d4bc3[_0x8256('0x2c')]){delete _0x4d4bc3[_0x8256('0x2c')];}_0x349815[_0x8256('0x1a')](_0x2464a6)[_0x8256('0x2d')](_0x4d4bc3);};}exports[_0x8256('0x2e')]=function(_0x3e36a4,_0x594991){var _0x258f33={},_0x537285={},_0xdac80f={'count':0x0,'rows':[]};var _0x846acc=_[_0x8256('0x2f')](db[_0x8256('0x30')][_0x8256('0x31')],function(_0x20930b){return{'name':_0x20930b[_0x8256('0x32')],'type':_0x20930b[_0x8256('0x33')][_0x8256('0x34')]};});_0x537285[_0x8256('0x35')]=_['map'](_0x846acc,_0x8256('0x2c'));_0x537285[_0x8256('0x36')]=_['keys'](_0x3e36a4[_0x8256('0x36')]);_0x537285[_0x8256('0x37')]=_[_0x8256('0x38')](_0x537285[_0x8256('0x35')],_0x537285[_0x8256('0x36')]);_0x258f33[_0x8256('0x39')]=_[_0x8256('0x38')](_0x537285[_0x8256('0x35')],qs['fields'](_0x3e36a4[_0x8256('0x36')][_0x8256('0x3a')]));_0x258f33['attributes']=_0x258f33[_0x8256('0x39')]['length']?_0x258f33[_0x8256('0x39')]:_0x537285[_0x8256('0x35')];if(!_0x3e36a4[_0x8256('0x36')]['hasOwnProperty'](_0x8256('0x3b'))){_0x258f33[_0x8256('0x1d')]=qs[_0x8256('0x1d')](_0x3e36a4[_0x8256('0x36')][_0x8256('0x1d')]);_0x258f33['offset']=qs['offset'](_0x3e36a4[_0x8256('0x36')]['offset']);}_0x258f33[_0x8256('0x3c')]=qs[_0x8256('0x3d')](_0x3e36a4[_0x8256('0x36')][_0x8256('0x3d')]);_0x258f33[_0x8256('0x3e')]=qs[_0x8256('0x37')](_[_0x8256('0x3f')](_0x3e36a4[_0x8256('0x36')],_0x537285[_0x8256('0x37')]),_0x846acc);if(_0x3e36a4[_0x8256('0x36')]['filter']){_0x258f33[_0x8256('0x3e')]=_['merge'](_0x258f33[_0x8256('0x3e')],{'$or':_[_0x8256('0x2f')](_0x846acc,function(_0x28a405){if(_0x28a405[_0x8256('0x33')]!==_0x8256('0x40')){var _0x5be505={};_0x5be505[_0x28a405[_0x8256('0x2c')]]={'$like':'%'+_0x3e36a4[_0x8256('0x36')][_0x8256('0x41')]+'%'};return _0x5be505;}})});}_0x258f33=_[_0x8256('0x42')]({},_0x258f33,_0x3e36a4['options']);var _0x56eb23={'where':_0x258f33[_0x8256('0x3e')]};return db['Disposition'][_0x8256('0x1e')](_0x56eb23)['then'](function(_0x31c8a4){_0xdac80f[_0x8256('0x1e')]=_0x31c8a4;if(_0x3e36a4['query'][_0x8256('0x43')]){_0x258f33['include']=[{'all':!![]}];}return db[_0x8256('0x30')][_0x8256('0x44')](_0x258f33);})[_0x8256('0x24')](function(_0x3abe17){_0xdac80f[_0x8256('0x45')]=_0x3abe17;return _0xdac80f;})['then'](respondWithFilteredResult(_0x594991,_0x258f33))['catch'](handleError(_0x594991,null));};exports[_0x8256('0x46')]=function(_0x156572,_0x29ed75){var _0x36d48d={'raw':!![],'where':{'id':_0x156572[_0x8256('0x47')]['id']}},_0x23adf2={};_0x23adf2[_0x8256('0x35')]=_[_0x8256('0x48')](db[_0x8256('0x30')][_0x8256('0x31')]);_0x23adf2[_0x8256('0x36')]=_['keys'](_0x156572['query']);_0x23adf2[_0x8256('0x37')]=_['intersection'](_0x23adf2['model'],_0x23adf2[_0x8256('0x36')]);_0x36d48d['attributes']=_[_0x8256('0x38')](_0x23adf2['model'],qs['fields'](_0x156572['query']['fields']));_0x36d48d['attributes']=_0x36d48d['attributes']['length']?_0x36d48d['attributes']:_0x23adf2[_0x8256('0x35')];if(_0x156572[_0x8256('0x36')]['includeAll']){_0x36d48d[_0x8256('0x49')]=[{'all':!![]}];}_0x36d48d=_[_0x8256('0x42')]({},_0x36d48d,_0x156572[_0x8256('0x4a')]);return db[_0x8256('0x30')]['find'](_0x36d48d)[_0x8256('0x24')](handleEntityNotFound(_0x29ed75,null))[_0x8256('0x24')](respondWithResult(_0x29ed75,null))['catch'](handleError(_0x29ed75,null));};exports[_0x8256('0x4b')]=function(_0xf7ac51,_0xb7a942){return db[_0x8256('0x30')][_0x8256('0x4b')](_0xf7ac51[_0x8256('0x4c')],{})['then'](function(_0x23a61a){var _0x13259b=_0xf7ac51[_0x8256('0x4d')][_0x8256('0x26')]({'plain':!![]});if(!_0x13259b)throw new Error(_0x8256('0x4e'));if(_0x13259b[_0x8256('0x4f')]==='user'){var _0x3b8194=_0x23a61a[_0x8256('0x26')]({'plain':!![]});var _0xb4d8c=_0x8256('0x27');return db[_0x8256('0x50')]['find']({'where':{'name':_0xb4d8c,'userProfileId':_0x13259b[_0x8256('0x51')]},'raw':!![]})[_0x8256('0x24')](function(_0x4a0474){if(_0x4a0474&&_0x4a0474['autoAssociation']===0x0){return db[_0x8256('0x28')][_0x8256('0x4b')]({'name':_0x3b8194[_0x8256('0x2c')],'resourceId':_0x3b8194['id'],'type':_0x4a0474[_0x8256('0x2c')],'sectionId':_0x4a0474['id']},{})[_0x8256('0x24')](function(){return _0x23a61a;});}else{return _0x23a61a;}})[_0x8256('0x52')](function(_0x59a654){logger[_0x8256('0x2a')](_0x8256('0x53'),_0x59a654);throw _0x59a654;});}return _0x23a61a;})[_0x8256('0x24')](respondWithResult(_0xb7a942,0xc9))['catch'](handleError(_0xb7a942,null));};exports[_0x8256('0x23')]=function(_0x5e969f,_0x43976d){if(_0x5e969f[_0x8256('0x4c')]['id']){delete _0x5e969f['body']['id'];}return db[_0x8256('0x30')][_0x8256('0x54')]({'where':{'id':_0x5e969f[_0x8256('0x47')]['id']}})[_0x8256('0x24')](handleEntityNotFound(_0x43976d,null))[_0x8256('0x24')](saveUpdates(_0x5e969f[_0x8256('0x4c')],null))[_0x8256('0x24')](respondWithResult(_0x43976d,null))[_0x8256('0x52')](handleError(_0x43976d,null));};exports['destroy']=function(_0x4058c2,_0x32d256){return db['Disposition'][_0x8256('0x54')]({'where':{'id':_0x4058c2[_0x8256('0x47')]['id']}})[_0x8256('0x24')](handleEntityNotFound(_0x32d256,null))['then'](removeEntity(_0x32d256,null))['catch'](handleError(_0x32d256,null));}; \ No newline at end of file +var _0x5a0f=['nolimit','sort','where','filter','merge','map','VIRTUAL','includeAll','findAll','rows','params','options','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','mustache','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','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','reject','save','destroy','then','Dispositions','UserProfileResource','error','stack','name','send','index','Disposition','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty'];(function(_0x487ba2,_0xc460d5){var _0x23b5d6=function(_0x5b4d75){while(--_0x5b4d75){_0x487ba2['push'](_0x487ba2['shift']());}};_0x23b5d6(++_0xc460d5);}(_0x5a0f,0x1e4));var _0xf5a0=function(_0x111e9,_0xa29191){_0x111e9=_0x111e9-0x0;var _0x2b1897=_0x5a0f[_0x111e9];return _0x2b1897;};'use strict';var emlformat=require(_0xf5a0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf5a0('0x1'));var jsonpatch=require(_0xf5a0('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf5a0('0x3'));var util=require(_0xf5a0('0x4'));var path=require('path');var sox=require(_0xf5a0('0x5'));var csv=require(_0xf5a0('0x6'));var ejs=require(_0xf5a0('0x7'));var fs=require('fs');var fs_extra=require(_0xf5a0('0x8'));var _=require(_0xf5a0('0x9'));var squel=require(_0xf5a0('0xa'));var crypto=require(_0xf5a0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf5a0('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf5a0('0xd'));var Redis=require('ioredis');var authService=require(_0xf5a0('0xe'));var qs=require(_0xf5a0('0xf'));var as=require(_0xf5a0('0x10'));var hardwareService=require(_0xf5a0('0x11'));var logger=require(_0xf5a0('0x12'))(_0xf5a0('0x13'));var utils=require(_0xf5a0('0x14'));var config=require(_0xf5a0('0x15'));var licenseUtil=require(_0xf5a0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x348839,_0x14c076){_0x14c076=_0x14c076||0xcc;return function(_0x37041b){if(_0x37041b){return _0x348839[_0xf5a0('0x17')](_0x14c076);}return _0x348839['status'](_0x14c076)[_0xf5a0('0x18')]();};}function respondWithResult(_0x47c8a1,_0x82ef8e){_0x82ef8e=_0x82ef8e||0xc8;return function(_0x19ed3f){if(_0x19ed3f){return _0x47c8a1['status'](_0x82ef8e)[_0xf5a0('0x19')](_0x19ed3f);}};}function respondWithFilteredResult(_0xbd6e0b,_0x18cd94){return function(_0x583c54){if(_0x583c54){var _0x14e2a4=typeof _0x18cd94[_0xf5a0('0x1a')]===_0xf5a0('0x1b')&&typeof _0x18cd94[_0xf5a0('0x1c')]===_0xf5a0('0x1b');var _0x4c0962=_0x583c54[_0xf5a0('0x1d')];var _0x13fd37=_0x14e2a4?0x0:_0x18cd94[_0xf5a0('0x1a')];var _0x3d74a7=_0x14e2a4?_0x583c54[_0xf5a0('0x1d')]:_0x18cd94[_0xf5a0('0x1a')]+_0x18cd94['limit'];var _0x46a781;if(_0x3d74a7>=_0x4c0962){_0x3d74a7=_0x4c0962;_0x46a781=0xc8;}else{_0x46a781=0xce;}_0xbd6e0b[_0xf5a0('0x1e')](_0x46a781);return _0xbd6e0b[_0xf5a0('0x1f')]('Content-Range',_0x13fd37+'-'+_0x3d74a7+'/'+_0x4c0962)[_0xf5a0('0x19')](_0x583c54);}return null;};}function patchUpdates(_0x33ebfa){return function(_0x33f51a){try{jsonpatch['apply'](_0x33f51a,_0x33ebfa,!![]);}catch(_0x12fe40){return BPromise[_0xf5a0('0x20')](_0x12fe40);}return _0x33f51a[_0xf5a0('0x21')]();};}function saveUpdates(_0x6f2e29,_0x304545){return function(_0x1f4d82){if(_0x1f4d82){return _0x1f4d82['update'](_0x6f2e29)['then'](function(_0x555943){return _0x555943;});}return null;};}function removeEntity(_0x1a3389,_0x4af9d1){return function(_0xf3a785){if(_0xf3a785){return _0xf3a785[_0xf5a0('0x22')]()[_0xf5a0('0x23')](function(){var _0x56a70b=_0xf3a785['get']({'plain':!![]});var _0x4ab974=_0xf5a0('0x24');return db[_0xf5a0('0x25')][_0xf5a0('0x22')]({'where':{'type':_0x4ab974,'resourceId':_0x56a70b['id']}})['then'](function(){return _0xf3a785;});})['then'](function(){_0x1a3389[_0xf5a0('0x1e')](0xcc)[_0xf5a0('0x18')]();});}};}function handleEntityNotFound(_0x967565,_0x234901){return function(_0x9dc7a8){if(!_0x9dc7a8){_0x967565[_0xf5a0('0x17')](0x194);}return _0x9dc7a8;};}function handleError(_0x589d65,_0x50b12e){_0x50b12e=_0x50b12e||0x1f4;return function(_0x47103d){logger[_0xf5a0('0x26')](_0x47103d[_0xf5a0('0x27')]);if(_0x47103d['name']){delete _0x47103d[_0xf5a0('0x28')];}_0x589d65[_0xf5a0('0x1e')](_0x50b12e)[_0xf5a0('0x29')](_0x47103d);};}exports[_0xf5a0('0x2a')]=function(_0x50ce08,_0x21c164){var _0x5427d0={},_0x1c799a={},_0x219177={'count':0x0,'rows':[]};var _0x43cdc6=_['map'](db[_0xf5a0('0x2b')][_0xf5a0('0x2c')],function(_0x2e1d50){return{'name':_0x2e1d50[_0xf5a0('0x2d')],'type':_0x2e1d50[_0xf5a0('0x2e')]['key']};});_0x1c799a[_0xf5a0('0x2f')]=_['map'](_0x43cdc6,_0xf5a0('0x28'));_0x1c799a[_0xf5a0('0x30')]=_[_0xf5a0('0x31')](_0x50ce08[_0xf5a0('0x30')]);_0x1c799a[_0xf5a0('0x32')]=_[_0xf5a0('0x33')](_0x1c799a['model'],_0x1c799a[_0xf5a0('0x30')]);_0x5427d0['attributes']=_['intersection'](_0x1c799a[_0xf5a0('0x2f')],qs[_0xf5a0('0x34')](_0x50ce08[_0xf5a0('0x30')][_0xf5a0('0x34')]));_0x5427d0[_0xf5a0('0x35')]=_0x5427d0[_0xf5a0('0x35')]['length']?_0x5427d0[_0xf5a0('0x35')]:_0x1c799a[_0xf5a0('0x2f')];if(!_0x50ce08[_0xf5a0('0x30')][_0xf5a0('0x36')](_0xf5a0('0x37'))){_0x5427d0[_0xf5a0('0x1c')]=qs['limit'](_0x50ce08[_0xf5a0('0x30')][_0xf5a0('0x1c')]);_0x5427d0[_0xf5a0('0x1a')]=qs[_0xf5a0('0x1a')](_0x50ce08[_0xf5a0('0x30')][_0xf5a0('0x1a')]);}_0x5427d0['order']=qs['sort'](_0x50ce08['query'][_0xf5a0('0x38')]);_0x5427d0[_0xf5a0('0x39')]=qs[_0xf5a0('0x32')](_['pick'](_0x50ce08['query'],_0x1c799a['filters']),_0x43cdc6);if(_0x50ce08[_0xf5a0('0x30')][_0xf5a0('0x3a')]){_0x5427d0[_0xf5a0('0x39')]=_[_0xf5a0('0x3b')](_0x5427d0[_0xf5a0('0x39')],{'$or':_[_0xf5a0('0x3c')](_0x43cdc6,function(_0x1c24c3){if(_0x1c24c3['type']!==_0xf5a0('0x3d')){var _0x4008eb={};_0x4008eb[_0x1c24c3[_0xf5a0('0x28')]]={'$like':'%'+_0x50ce08[_0xf5a0('0x30')][_0xf5a0('0x3a')]+'%'};return _0x4008eb;}})});}_0x5427d0=_[_0xf5a0('0x3b')]({},_0x5427d0,_0x50ce08['options']);var _0x2acaa2={'where':_0x5427d0[_0xf5a0('0x39')]};return db[_0xf5a0('0x2b')]['count'](_0x2acaa2)[_0xf5a0('0x23')](function(_0x139118){_0x219177[_0xf5a0('0x1d')]=_0x139118;if(_0x50ce08['query'][_0xf5a0('0x3e')]){_0x5427d0['include']=[{'all':!![]}];}return db[_0xf5a0('0x2b')][_0xf5a0('0x3f')](_0x5427d0);})[_0xf5a0('0x23')](function(_0x10b366){_0x219177[_0xf5a0('0x40')]=_0x10b366;return _0x219177;})[_0xf5a0('0x23')](respondWithFilteredResult(_0x21c164,_0x5427d0))['catch'](handleError(_0x21c164,null));};exports['show']=function(_0x22a861,_0x2050a3){var _0x43d345={'raw':!![],'where':{'id':_0x22a861[_0xf5a0('0x41')]['id']}},_0x478276={};_0x478276[_0xf5a0('0x2f')]=_[_0xf5a0('0x31')](db[_0xf5a0('0x2b')][_0xf5a0('0x2c')]);_0x478276[_0xf5a0('0x30')]=_[_0xf5a0('0x31')](_0x22a861[_0xf5a0('0x30')]);_0x478276[_0xf5a0('0x32')]=_[_0xf5a0('0x33')](_0x478276[_0xf5a0('0x2f')],_0x478276['query']);_0x43d345['attributes']=_[_0xf5a0('0x33')](_0x478276[_0xf5a0('0x2f')],qs[_0xf5a0('0x34')](_0x22a861[_0xf5a0('0x30')][_0xf5a0('0x34')]));_0x43d345[_0xf5a0('0x35')]=_0x43d345['attributes']['length']?_0x43d345[_0xf5a0('0x35')]:_0x478276[_0xf5a0('0x2f')];if(_0x22a861[_0xf5a0('0x30')][_0xf5a0('0x3e')]){_0x43d345['include']=[{'all':!![]}];}_0x43d345=_[_0xf5a0('0x3b')]({},_0x43d345,_0x22a861[_0xf5a0('0x42')]);return db[_0xf5a0('0x2b')]['find'](_0x43d345)[_0xf5a0('0x23')](handleEntityNotFound(_0x2050a3,null))[_0xf5a0('0x23')](respondWithResult(_0x2050a3,null))[_0xf5a0('0x43')](handleError(_0x2050a3,null));};exports[_0xf5a0('0x44')]=function(_0x1449b0,_0x3b8822){return db[_0xf5a0('0x2b')][_0xf5a0('0x44')](_0x1449b0[_0xf5a0('0x45')],{})['then'](function(_0x33b4da){var _0x4ac4f0=_0x1449b0['user'][_0xf5a0('0x46')]({'plain':!![]});if(!_0x4ac4f0)throw new Error(_0xf5a0('0x47'));if(_0x4ac4f0[_0xf5a0('0x48')]===_0xf5a0('0x49')){var _0x41a82b=_0x33b4da[_0xf5a0('0x46')]({'plain':!![]});var _0x1b8938=_0xf5a0('0x24');return db['UserProfileSection'][_0xf5a0('0x4a')]({'where':{'name':_0x1b8938,'userProfileId':_0x4ac4f0['userProfileId']},'raw':!![]})[_0xf5a0('0x23')](function(_0x4e3c58){if(_0x4e3c58&&_0x4e3c58[_0xf5a0('0x4b')]===0x0){return db[_0xf5a0('0x25')]['create']({'name':_0x41a82b[_0xf5a0('0x28')],'resourceId':_0x41a82b['id'],'type':_0x4e3c58[_0xf5a0('0x28')],'sectionId':_0x4e3c58['id']},{})[_0xf5a0('0x23')](function(){return _0x33b4da;});}else{return _0x33b4da;}})[_0xf5a0('0x43')](function(_0x2f21de){logger[_0xf5a0('0x26')](_0xf5a0('0x4c'),_0x2f21de);throw _0x2f21de;});}return _0x33b4da;})[_0xf5a0('0x23')](respondWithResult(_0x3b8822,0xc9))['catch'](handleError(_0x3b8822,null));};exports['update']=function(_0x49e7a8,_0x55bc9d){if(_0x49e7a8['body']['id']){delete _0x49e7a8['body']['id'];}return db['Disposition'][_0xf5a0('0x4a')]({'where':{'id':_0x49e7a8['params']['id']}})[_0xf5a0('0x23')](handleEntityNotFound(_0x55bc9d,null))[_0xf5a0('0x23')](saveUpdates(_0x49e7a8[_0xf5a0('0x45')],null))[_0xf5a0('0x23')](respondWithResult(_0x55bc9d,null))[_0xf5a0('0x43')](handleError(_0x55bc9d,null));};exports[_0xf5a0('0x22')]=function(_0x56f83c,_0x6dfc6f){return db[_0xf5a0('0x2b')]['find']({'where':{'id':_0x56f83c[_0xf5a0('0x41')]['id']}})[_0xf5a0('0x23')](handleEntityNotFound(_0x6dfc6f,null))[_0xf5a0('0x23')](removeEntity(_0x6dfc6f,null))[_0xf5a0('0x43')](handleError(_0x6dfc6f,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 2310929..b779182 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 _0x3a44=['WhatsappAccountId','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name_voice','name','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId'];(function(_0x59edce,_0x56da7b){var _0x4f3c4f=function(_0x2181a3){while(--_0x2181a3){_0x59edce['push'](_0x59edce['shift']());}};_0x4f3c4f(++_0x56da7b);}(_0x3a44,0x1e5));var _0x43a4=function(_0x5c903f,_0x157a0b){_0x5c903f=_0x5c903f-0x0;var _0x56e90e=_0x3a44[_0x5c903f];return _0x56e90e;};'use strict';var _=require(_0x43a4('0x0'));var util=require(_0x43a4('0x1'));var logger=require('../../config/logger')(_0x43a4('0x2'));var moment=require(_0x43a4('0x3'));var BPromise=require(_0x43a4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x43a4('0x5'));var config=require(_0x43a4('0x6'));var attributes=require(_0x43a4('0x7'));module[_0x43a4('0x8')]=function(_0x4cc1fa,_0x2f9638){return _0x4cc1fa[_0x43a4('0x9')]('Disposition',attributes,{'tableName':_0x43a4('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x43a4('0xb'),'fields':[_0x43a4('0xc'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0x43a4('0xc'),'ChatWebsiteId']},{'unique':!![],'name':_0x43a4('0xd'),'fields':[_0x43a4('0xc'),_0x43a4('0xe')]},{'unique':!![],'name':_0x43a4('0xf'),'fields':[_0x43a4('0xc'),_0x43a4('0x10')]},{'unique':!![],'name':_0x43a4('0x11'),'fields':['name',_0x43a4('0x12')]},{'unique':!![],'name':_0x43a4('0x13'),'fields':[_0x43a4('0xc'),_0x43a4('0x14')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x43a4('0xc'),_0x43a4('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1b43=['name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','WhatsappAccountId','util','api','moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','exports','Disposition','tools_dispositions','name_voice','name','name_chat'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x1b43,0x168));var _0x31b4=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x1b43[_0xae7c2f];return _0x5d7001;};'use strict';var _=require('lodash');var util=require(_0x31b4('0x0'));var logger=require('../../config/logger')(_0x31b4('0x1'));var moment=require(_0x31b4('0x2'));var BPromise=require(_0x31b4('0x3'));var rp=require(_0x31b4('0x4'));var fs=require('fs');var path=require(_0x31b4('0x5'));var rimraf=require('rimraf');var config=require(_0x31b4('0x6'));var attributes=require(_0x31b4('0x7'));module[_0x31b4('0x8')]=function(_0x36c01f,_0x2a5565){return _0x36c01f['define'](_0x31b4('0x9'),attributes,{'tableName':_0x31b4('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x31b4('0xb'),'fields':[_0x31b4('0xc'),'ListId']},{'unique':!![],'name':_0x31b4('0xd'),'fields':[_0x31b4('0xc'),'ChatWebsiteId']},{'unique':!![],'name':_0x31b4('0xe'),'fields':[_0x31b4('0xc'),_0x31b4('0xf')]},{'unique':!![],'name':_0x31b4('0x10'),'fields':[_0x31b4('0xc'),_0x31b4('0x11')]},{'unique':!![],'name':_0x31b4('0x12'),'fields':[_0x31b4('0xc'),'FaxAccountId']},{'unique':!![],'name':_0x31b4('0x13'),'fields':[_0x31b4('0xc'),_0x31b4('0x14')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x31b4('0xc'),_0x31b4('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index f37e6ee..599b527 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(_0x4fb122,_0x3f6d0e){var _0x1b72d0=function(_0x43cec4){while(--_0x43cec4){_0x4fb122['push'](_0x4fb122['shift']());}};_0x1b72d0(++_0x3f6d0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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(_0x3dbaa1,_0x2e0a76){var _0x14c5c0=function(_0x5633d3){while(--_0x5633d3){_0x3dbaa1['push'](_0x3dbaa1['shift']());}};_0x14c5c0(++_0x2e0a76);}(_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 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 5d40731..662759a 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 _0x177a=['index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller'];(function(_0x45319d,_0x5a0653){var _0x20f076=function(_0x3da82c){while(--_0x3da82c){_0x45319d['push'](_0x45319d['shift']());}};_0x20f076(++_0x5a0653);}(_0x177a,0x114));var _0xa177=function(_0x483b7e,_0x32a141){_0x483b7e=_0x483b7e-0x0;var _0x3057a2=_0x177a[_0x483b7e];return _0x3057a2;};'use strict';var multer=require(_0xa177('0x0'));var util=require(_0xa177('0x1'));var path=require('path');var timeout=require(_0xa177('0x2'));var express=require(_0xa177('0x3'));var router=express['Router']();var fs_extra=require(_0xa177('0x4'));var auth=require(_0xa177('0x5'));var interaction=require(_0xa177('0x6'));var config=require(_0xa177('0x7'));var controller=require(_0xa177('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa177('0x9')]);router['get'](_0xa177('0xa'),auth[_0xa177('0xb')](),controller[_0xa177('0xc')]);router[_0xa177('0xd')]('/',auth[_0xa177('0xb')](),controller[_0xa177('0xe')]);router[_0xa177('0xf')]('/:id',auth[_0xa177('0xb')](),controller[_0xa177('0x10')]);router[_0xa177('0x11')](_0xa177('0xa'),auth[_0xa177('0xb')](),controller[_0xa177('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd969=['/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd969,0xcf));var _0x9d96=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xd969[_0xf0bcac];return _0x4e4c65;};'use strict';var multer=require(_0x9d96('0x0'));var util=require('util');var path=require(_0x9d96('0x1'));var timeout=require('connect-timeout');var express=require(_0x9d96('0x2'));var router=express[_0x9d96('0x3')]();var fs_extra=require(_0x9d96('0x4'));var auth=require(_0x9d96('0x5'));var interaction=require(_0x9d96('0x6'));var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x9d96('0x7')]('/',auth['isAuthenticated'](),controller[_0x9d96('0x8')]);router[_0x9d96('0x7')](_0x9d96('0x9'),auth[_0x9d96('0xa')](),controller[_0x9d96('0xb')]);router[_0x9d96('0xc')]('/',auth['isAuthenticated'](),controller[_0x9d96('0xd')]);router[_0x9d96('0xe')](_0x9d96('0x9'),auth[_0x9d96('0xa')](),controller[_0x9d96('0xf')]);router[_0x9d96('0x10')](_0x9d96('0x9'),auth[_0x9d96('0xa')](),controller['destroy']);module[_0x9d96('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 3159c18..c1bd753 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 _0x29fb=['yes','xCALLY\x20Motion\x20Fax','localstationid','9600','14400','4800','2400','7200','12000','SIP','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM'];(function(_0xb40bf9,_0x2c37f9){var _0x577c26=function(_0x366400){while(--_0x366400){_0xb40bf9['push'](_0xb40bf9['shift']());}};_0x577c26(++_0x2c37f9);}(_0x29fb,0x79));var _0xb29f=function(_0x1fe9bc,_0x4502cb){_0x1fe9bc=_0x1fe9bc-0x0;var _0x4002e8=_0x29fb[_0x1fe9bc];return _0x4002e8;};'use strict';var Sequelize=require(_0xb29f('0x0'));module[_0xb29f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb29f('0x2')]},'ecm':{'type':Sequelize[_0xb29f('0x3')](_0xb29f('0x4'),'no'),'defaultValue':_0xb29f('0x4')},'headerinfo':{'type':Sequelize[_0xb29f('0x2')],'defaultValue':_0xb29f('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xb29f('0x6')},'minrate':{'type':Sequelize[_0xb29f('0x3')]('2400','4800','7200',_0xb29f('0x7'),'12000',_0xb29f('0x8')),'defaultValue':_0xb29f('0x9')},'maxrate':{'type':Sequelize[_0xb29f('0x3')](_0xb29f('0xa'),_0xb29f('0x9'),_0xb29f('0xb'),_0xb29f('0x7'),_0xb29f('0xc'),_0xb29f('0x8')),'defaultValue':_0xb29f('0x8')},'modem':{'type':Sequelize[_0xb29f('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xb29f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xb29f('0x3')](_0xb29f('0xd'),_0xb29f('0xe'),'DADHI',_0xb29f('0xf')),'defaultValue':_0xb29f('0xd')},'key':{'type':Sequelize[_0xb29f('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb29f('0x10')],'defaultValue':function(){return _0xb29f('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb29f('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb29f('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb29f('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb29f('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb29f('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xb29f('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb29f('0x15'),'set':function(_0x33f8ba){if(!_0x33f8ba)this[_0xb29f('0x16')](_0xb29f('0x17'),null);this[_0xb29f('0x16')](_0xb29f('0x18'),_0x33f8ba);}}}; \ No newline at end of file +var _0x61c7=['IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','12000','14400','INTEGER','SIP'];(function(_0x2b0775,_0x200f50){var _0xbf41a9=function(_0x49c511){while(--_0x49c511){_0x2b0775['push'](_0x2b0775['shift']());}};_0xbf41a9(++_0x200f50);}(_0x61c7,0x1c0));var _0x761c=function(_0x5cdf7f,_0x1f682c){_0x5cdf7f=_0x5cdf7f-0x0;var _0x26609a=_0x61c7[_0x5cdf7f];return _0x26609a;};'use strict';var Sequelize=require(_0x761c('0x0'));module[_0x761c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x761c('0x2')]},'ecm':{'type':Sequelize[_0x761c('0x3')](_0x761c('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x761c('0x5')},'localstationid':{'type':Sequelize[_0x761c('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x761c('0x3')](_0x761c('0x6'),_0x761c('0x7'),_0x761c('0x8'),_0x761c('0x9'),'12000','14400'),'defaultValue':_0x761c('0x7')},'maxrate':{'type':Sequelize[_0x761c('0x3')](_0x761c('0x6'),_0x761c('0x7'),'7200','9600',_0x761c('0xa'),_0x761c('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x761c('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x761c('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x761c('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x761c('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x761c('0x3')](_0x761c('0xd'),_0x761c('0xe'),_0x761c('0xf'),_0x761c('0x10')),'defaultValue':_0x761c('0xd')},'key':{'type':Sequelize[_0x761c('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x761c('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x761c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x761c('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x761c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x761c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x761c('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x761c('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x761c('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4c177b){if(!_0x4c177b)this[_0x761c('0x14')](_0x761c('0x15'),null);this[_0x761c('0x14')]('mandatoryDisposition',_0x4c177b);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index ea95555..fd6a9a8 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 _0xb45c=['spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','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','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','get','FaxAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','finally','getApplications','from-voip-provider','exten','localstationid','app','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found'];(function(_0x1e7ddc,_0x1a8d9b){var _0x18346b=function(_0x264fe4){while(--_0x264fe4){_0x1e7ddc['push'](_0x1e7ddc['shift']());}};_0x18346b(++_0x1a8d9b);}(_0xb45c,0xd9));var _0xcb45=function(_0x4e6219,_0x4a46d6){_0x4e6219=_0x4e6219-0x0;var _0x50e08f=_0xb45c[_0x4e6219];return _0x50e08f;};'use strict';var emlformat=require(_0xcb45('0x0'));var rimraf=require(_0xcb45('0x1'));var zipdir=require(_0xcb45('0x2'));var jsonpatch=require(_0xcb45('0x3'));var rp=require(_0xcb45('0x4'));var moment=require('moment');var BPromise=require(_0xcb45('0x5'));var Mustache=require(_0xcb45('0x6'));var util=require(_0xcb45('0x7'));var path=require('path');var sox=require(_0xcb45('0x8'));var csv=require(_0xcb45('0x9'));var ejs=require(_0xcb45('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcb45('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcb45('0xc'));var deskjs=require(_0xcb45('0xd'));var toCsv=require(_0xcb45('0x9'));var querystring=require(_0xcb45('0xe'));var Papa=require(_0xcb45('0xf'));var Redis=require(_0xcb45('0x10'));var authService=require(_0xcb45('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xcb45('0x12'));var hardwareService=require(_0xcb45('0x13'));var logger=require(_0xcb45('0x14'))(_0xcb45('0x15'));var utils=require(_0xcb45('0x16'));var config=require(_0xcb45('0x17'));var licenseUtil=require(_0xcb45('0x18'));var db=require(_0xcb45('0x19'))['db'];config[_0xcb45('0x1a')]=_[_0xcb45('0x1b')](config[_0xcb45('0x1a')],{'host':_0xcb45('0x1c'),'port':0x18eb});var socket=require(_0xcb45('0x1d'))(new Redis(config['redis']));require(_0xcb45('0x1e'))[_0xcb45('0x1f')](socket);var jayson=require(_0xcb45('0x20'));var client=jayson[_0xcb45('0x21')][_0xcb45('0x22')]({'port':0x232c});var client9002=jayson[_0xcb45('0x21')][_0xcb45('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x499856,_0x5d3f69,_0x3c4bee,_0x2327ff){return new BPromise(function(_0x464733,_0x4411f5){var _0x30ecd5=_0x2327ff||client;return _0x30ecd5['request'](_0x499856,_0x3c4bee)['then'](function(_0x3ebff9){logger[_0xcb45('0x23')](_0xcb45('0x24'),_0x5d3f69,_0xcb45('0x25'));logger[_0xcb45('0x26')](_0xcb45('0x27'),_0x5d3f69,'request\x20sent',JSON[_0xcb45('0x28')](_0x3ebff9));if(_0x3ebff9[_0xcb45('0x29')]){if(_0x3ebff9[_0xcb45('0x29')]['code']===0x1f4){logger['error'](_0xcb45('0x24'),_0x5d3f69,_0x3ebff9['error']['message']);return _0x4411f5(_0x3ebff9[_0xcb45('0x29')][_0xcb45('0x2a')]);}logger['error'](_0xcb45('0x24'),_0x5d3f69,_0x3ebff9[_0xcb45('0x29')][_0xcb45('0x2a')]);return _0x464733(_0x3ebff9['error'][_0xcb45('0x2a')]);}else{logger['info'](_0xcb45('0x24'),_0x5d3f69,'request\x20sent');_0x464733(_0x3ebff9[_0xcb45('0x2b')][_0xcb45('0x2a')]);}})[_0xcb45('0x2c')](function(_0x1b50a2){logger[_0xcb45('0x29')](_0xcb45('0x24'),_0x5d3f69,_0x1b50a2);_0x4411f5(_0x1b50a2);});});}function respondWithStatusCode(_0x124190,_0x4c3c34){_0x4c3c34=_0x4c3c34||0xcc;return function(_0x909cf2){if(_0x909cf2){return _0x124190[_0xcb45('0x2d')](_0x4c3c34);}return _0x124190[_0xcb45('0x2e')](_0x4c3c34)[_0xcb45('0x2f')]();};}function respondWithResult(_0x4fe441,_0x44ce03){_0x44ce03=_0x44ce03||0xc8;return function(_0x4130cf){if(_0x4130cf){return _0x4fe441[_0xcb45('0x2e')](_0x44ce03)[_0xcb45('0x30')](_0x4130cf);}};}function respondWithFilteredResult(_0x343e2f,_0xd6298f){return function(_0x2fa530){if(_0x2fa530){var _0xc4c3e6=typeof _0xd6298f[_0xcb45('0x31')]===_0xcb45('0x32')&&typeof _0xd6298f['limit']===_0xcb45('0x32');var _0x4e1575=_0x2fa530['count'];var _0x37bf1a=_0xc4c3e6?0x0:_0xd6298f[_0xcb45('0x31')];var _0x3547fb=_0xc4c3e6?_0x2fa530[_0xcb45('0x33')]:_0xd6298f[_0xcb45('0x31')]+_0xd6298f[_0xcb45('0x34')];var _0xc59d7b;if(_0x3547fb>=_0x4e1575){_0x3547fb=_0x4e1575;_0xc59d7b=0xc8;}else{_0xc59d7b=0xce;}_0x343e2f[_0xcb45('0x2e')](_0xc59d7b);return _0x343e2f[_0xcb45('0x35')]('Content-Range',_0x37bf1a+'-'+_0x3547fb+'/'+_0x4e1575)[_0xcb45('0x30')](_0x2fa530);}return null;};}function patchUpdates(_0x380ce0){return function(_0x5e5063){try{jsonpatch[_0xcb45('0x36')](_0x5e5063,_0x380ce0,!![]);}catch(_0x1f9238){return BPromise['reject'](_0x1f9238);}return _0x5e5063[_0xcb45('0x37')]();};}function saveUpdates(_0x27bdfa,_0x1165d7){return function(_0x32f48e){if(_0x32f48e){return _0x32f48e[_0xcb45('0x38')](_0x27bdfa)['then'](function(_0x388f61){return _0x388f61;});}return null;};}function removeEntity(_0x5306d0,_0x4f46ef){return function(_0xbb79d9){if(_0xbb79d9){return _0xbb79d9['destroy']()[_0xcb45('0x39')](function(){var _0x2babc4=_0xbb79d9[_0xcb45('0x3a')]({'plain':!![]});var _0x5b99f9=_0xcb45('0x3b');return db[_0xcb45('0x3c')][_0xcb45('0x3d')]({'where':{'type':_0x5b99f9,'resourceId':_0x2babc4['id']}})[_0xcb45('0x39')](function(){return _0xbb79d9;});})[_0xcb45('0x39')](function(){_0x5306d0[_0xcb45('0x2e')](0xcc)[_0xcb45('0x2f')]();});}};}function handleEntityNotFound(_0x47f1de,_0x239fc2){return function(_0x205c19){if(!_0x205c19){_0x47f1de[_0xcb45('0x2d')](0x194);}return _0x205c19;};}function handleError(_0x508b90,_0x5d9375){_0x5d9375=_0x5d9375||0x1f4;return function(_0x5137b2){logger[_0xcb45('0x29')](_0x5137b2[_0xcb45('0x3e')]);if(_0x5137b2['name']){delete _0x5137b2[_0xcb45('0x3f')];}_0x508b90[_0xcb45('0x2e')](_0x5d9375)[_0xcb45('0x40')](_0x5137b2);};}exports[_0xcb45('0x41')]=function(_0x5ee82d,_0x4f6b43){var _0x3fff2c={'include':[{'model':db[_0xcb45('0x42')],'as':_0xcb45('0x43')}]},_0x21f096={},_0xd8bc08={'count':0x0,'rows':[]};var _0x5b1c71=_['map'](db[_0xcb45('0x44')][_0xcb45('0x45')],function(_0x496ee1){return{'name':_0x496ee1[_0xcb45('0x46')],'type':_0x496ee1[_0xcb45('0x47')][_0xcb45('0x48')]};});_0x21f096[_0xcb45('0x49')]=_[_0xcb45('0x4a')](_0x5b1c71,'name');_0x21f096[_0xcb45('0x4b')]=_[_0xcb45('0x4c')](_0x5ee82d[_0xcb45('0x4b')]);_0x21f096[_0xcb45('0x4d')]=_[_0xcb45('0x4e')](_0x21f096[_0xcb45('0x49')],_0x21f096[_0xcb45('0x4b')]);_0x3fff2c[_0xcb45('0x4f')]=_[_0xcb45('0x4e')](_0x21f096[_0xcb45('0x49')],qs['fields'](_0x5ee82d[_0xcb45('0x4b')][_0xcb45('0x50')]));_0x3fff2c[_0xcb45('0x4f')]=_0x3fff2c['attributes'][_0xcb45('0x51')]?_0x3fff2c[_0xcb45('0x4f')]:_0x21f096[_0xcb45('0x49')];if(!_0x5ee82d[_0xcb45('0x4b')][_0xcb45('0x52')](_0xcb45('0x53'))){_0x3fff2c[_0xcb45('0x34')]=qs[_0xcb45('0x34')](_0x5ee82d['query'][_0xcb45('0x34')]);_0x3fff2c['offset']=qs['offset'](_0x5ee82d[_0xcb45('0x4b')]['offset']);}_0x3fff2c[_0xcb45('0x54')]=qs[_0xcb45('0x55')](_0x5ee82d['query']['sort']);_0x3fff2c[_0xcb45('0x56')]=qs['filters'](_[_0xcb45('0x57')](_0x5ee82d['query'],_0x21f096[_0xcb45('0x4d')]),_0x5b1c71);if(_0x5ee82d[_0xcb45('0x4b')][_0xcb45('0x58')]){_0x3fff2c[_0xcb45('0x56')]=_[_0xcb45('0x59')](_0x3fff2c['where'],{'$or':_[_0xcb45('0x4a')](_0x5b1c71,function(_0x359fea){if(_0x359fea['type']!==_0xcb45('0x5a')){var _0x22af1e={};_0x22af1e[_0x359fea['name']]={'$like':'%'+_0x5ee82d[_0xcb45('0x4b')][_0xcb45('0x58')]+'%'};return _0x22af1e;}})});}_0x3fff2c=_[_0xcb45('0x59')]({},_0x3fff2c,_0x5ee82d[_0xcb45('0x5b')]);var _0x14d68c={'where':_0x3fff2c['where']};return db[_0xcb45('0x44')][_0xcb45('0x33')](_0x14d68c)[_0xcb45('0x39')](function(_0x75dd91){_0xd8bc08[_0xcb45('0x33')]=_0x75dd91;if(_0x5ee82d[_0xcb45('0x4b')][_0xcb45('0x5c')]){_0x3fff2c[_0xcb45('0x5d')]=[{'all':!![]}];}return db[_0xcb45('0x44')][_0xcb45('0x5e')](_0x3fff2c);})[_0xcb45('0x39')](function(_0x1fd475){_0xd8bc08[_0xcb45('0x5f')]=_0x1fd475;return _0xd8bc08;})['then'](respondWithFilteredResult(_0x4f6b43,_0x3fff2c))[_0xcb45('0x2c')](handleError(_0x4f6b43,null));};exports['show']=function(_0x12da45,_0x46f401){var _0x23cc39={'raw':![],'where':{'id':_0x12da45[_0xcb45('0x60')]['id']},'include':[{'model':db[_0xcb45('0x42')],'as':_0xcb45('0x43')}]},_0x32d2de={};_0x32d2de[_0xcb45('0x49')]=_[_0xcb45('0x4c')](db['FaxAccount'][_0xcb45('0x45')]);_0x32d2de[_0xcb45('0x4b')]=_['keys'](_0x12da45[_0xcb45('0x4b')]);_0x32d2de[_0xcb45('0x4d')]=_[_0xcb45('0x4e')](_0x32d2de[_0xcb45('0x49')],_0x32d2de['query']);_0x23cc39[_0xcb45('0x4f')]=_[_0xcb45('0x4e')](_0x32d2de['model'],qs[_0xcb45('0x50')](_0x12da45[_0xcb45('0x4b')][_0xcb45('0x50')]));_0x23cc39['attributes']=_0x23cc39[_0xcb45('0x4f')]['length']?_0x23cc39[_0xcb45('0x4f')]:_0x32d2de['model'];if(_0x12da45['query'][_0xcb45('0x5c')]){_0x23cc39['include']=[{'all':!![]}];}_0x23cc39=_['merge']({},_0x23cc39,_0x12da45['options']);return db['FaxAccount'][_0xcb45('0x61')](_0x23cc39)['then'](handleEntityNotFound(_0x46f401,null))[_0xcb45('0x39')](respondWithResult(_0x46f401,null))[_0xcb45('0x2c')](handleError(_0x46f401,null));};exports[_0xcb45('0x62')]=function(_0x677687,_0x586f10){return db[_0xcb45('0x44')]['create'](_0x677687[_0xcb45('0x63')],{})['then'](function(_0x18195d){var _0x111954=_0x677687[_0xcb45('0x64')][_0xcb45('0x3a')]({'plain':!![]});if(!_0x111954)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x111954['role']===_0xcb45('0x64')){var _0x303312=_0x18195d[_0xcb45('0x3a')]({'plain':!![]});var _0x5be7f6='FaxAccounts';return db['UserProfileSection'][_0xcb45('0x61')]({'where':{'name':_0x5be7f6,'userProfileId':_0x111954['userProfileId']},'raw':!![]})[_0xcb45('0x39')](function(_0x58228f){if(_0x58228f&&_0x58228f['autoAssociation']===0x0){return db['UserProfileResource'][_0xcb45('0x62')]({'name':_0x303312[_0xcb45('0x3f')],'resourceId':_0x303312['id'],'type':_0x58228f[_0xcb45('0x3f')],'sectionId':_0x58228f['id']},{})[_0xcb45('0x39')](function(){return _0x18195d;});}else{return _0x18195d;}})[_0xcb45('0x2c')](function(_0x219272){logger['error'](_0xcb45('0x65'),_0x219272);throw _0x219272;});}return _0x18195d;})[_0xcb45('0x39')](respondWithResult(_0x586f10,0xc9))[_0xcb45('0x2c')](handleError(_0x586f10,null));};exports['update']=function(_0x345c5d,_0x5a1e9a){if(_0x345c5d[_0xcb45('0x63')]['id']){delete _0x345c5d[_0xcb45('0x63')]['id'];}return db['FaxAccount'][_0xcb45('0x61')]({'where':{'id':_0x345c5d[_0xcb45('0x60')]['id']},'include':[{'model':db[_0xcb45('0x42')],'as':_0xcb45('0x43')}]})['then'](handleEntityNotFound(_0x5a1e9a,null))['then'](saveUpdates(_0x345c5d['body'],null))[_0xcb45('0x39')](respondWithResult(_0x5a1e9a,null))[_0xcb45('0x2c')](handleError(_0x5a1e9a,null));};exports[_0xcb45('0x3d')]=function(_0xa0e9dd,_0x52d57d){return db[_0xcb45('0x44')][_0xcb45('0x61')]({'where':{'id':_0xa0e9dd[_0xcb45('0x60')]['id']}})[_0xcb45('0x39')](handleEntityNotFound(_0x52d57d,null))[_0xcb45('0x39')](removeEntity(_0x52d57d,null))[_0xcb45('0x2c')](handleError(_0x52d57d,null));};exports['describe']=function(_0x2fb3ee,_0x2d3167){return db[_0xcb45('0x44')][_0xcb45('0x66')]()[_0xcb45('0x39')](respondWithResult(_0x2d3167,null))[_0xcb45('0x2c')](handleError(_0x2d3167,null));};exports[_0xcb45('0x67')]=function(_0x2e753c,_0x197fee,_0x3eb3a6){if(_0x2e753c[_0xcb45('0x63')]['id']){delete _0x2e753c[_0xcb45('0x63')]['id'];}return db[_0xcb45('0x44')][_0xcb45('0x61')]({'where':{'id':_0x2e753c['params']['id']}})[_0xcb45('0x39')](handleEntityNotFound(_0x197fee,null))[_0xcb45('0x39')](function(_0x57f867){if(_0x57f867){_0x2e753c['body'][_0xcb45('0x68')]=_0x57f867['id'];return db['Disposition'][_0xcb45('0x62')](_0x2e753c[_0xcb45('0x63')]);}})[_0xcb45('0x39')](respondWithResult(_0x197fee,null))[_0xcb45('0x2c')](handleError(_0x197fee,null));};exports[_0xcb45('0x69')]=function(_0x376aa3,_0xa93de4,_0x39b06e){var _0x4a6fd4={'raw':![],'where':{}};var _0x31e4d9={};var _0x115f11={'count':0x0,'rows':[]};return db[_0xcb45('0x44')][_0xcb45('0x6a')]({'where':{'id':_0x376aa3[_0xcb45('0x60')]['id']}})[_0xcb45('0x39')](handleEntityNotFound(_0xa93de4,null))[_0xcb45('0x39')](function(_0x258f01){if(_0x258f01){_0x31e4d9['model']=_[_0xcb45('0x4c')](db[_0xcb45('0x6b')][_0xcb45('0x45')]);_0x31e4d9[_0xcb45('0x4b')]=_[_0xcb45('0x4c')](_0x376aa3[_0xcb45('0x4b')]);_0x31e4d9[_0xcb45('0x4d')]=_[_0xcb45('0x4e')](_0x31e4d9['model'],_0x31e4d9[_0xcb45('0x4b')]);_0x4a6fd4['attributes']=_[_0xcb45('0x4e')](_0x31e4d9['model'],qs[_0xcb45('0x50')](_0x376aa3[_0xcb45('0x4b')]['fields']));_0x4a6fd4['attributes']=_0x4a6fd4[_0xcb45('0x4f')]['length']?_0x4a6fd4[_0xcb45('0x4f')]:_0x31e4d9[_0xcb45('0x49')];if(!_0x376aa3['query'][_0xcb45('0x52')]('nolimit')){_0x4a6fd4[_0xcb45('0x34')]=qs['limit'](_0x376aa3[_0xcb45('0x4b')][_0xcb45('0x34')]);_0x4a6fd4[_0xcb45('0x31')]=qs[_0xcb45('0x31')](_0x376aa3['query'][_0xcb45('0x31')]);}_0x4a6fd4['order']=qs[_0xcb45('0x55')](_0x376aa3[_0xcb45('0x4b')][_0xcb45('0x55')]);_0x4a6fd4[_0xcb45('0x56')]=qs['filters'](_[_0xcb45('0x57')](_0x376aa3[_0xcb45('0x4b')],_0x31e4d9[_0xcb45('0x4d')]));_0x4a6fd4['where'][_0xcb45('0x68')]=_0x258f01['id'];if(_0x376aa3[_0xcb45('0x4b')][_0xcb45('0x58')]){_0x4a6fd4['where']=_['merge'](_0x4a6fd4[_0xcb45('0x56')],{'$or':_['map'](_0x4a6fd4[_0xcb45('0x4f')],function(_0x4b41d8){var _0x5b2d3a={};_0x5b2d3a[_0x4b41d8]={'$like':'%'+_0x376aa3['query'][_0xcb45('0x58')]+'%'};return _0x5b2d3a;})});}_0x4a6fd4=_[_0xcb45('0x59')]({},_0x4a6fd4,_0x376aa3[_0xcb45('0x5b')]);return db[_0xcb45('0x6b')][_0xcb45('0x33')]({'where':_0x4a6fd4['where']})[_0xcb45('0x39')](function(_0x4b11ce){_0x115f11[_0xcb45('0x33')]=_0x4b11ce;if(_0x376aa3[_0xcb45('0x4b')][_0xcb45('0x5c')]){_0x4a6fd4[_0xcb45('0x5d')]=[{'all':!![]}];}return db['Disposition'][_0xcb45('0x5e')](_0x4a6fd4);})[_0xcb45('0x39')](function(_0x198749){_0x115f11[_0xcb45('0x5f')]=_0x198749;return _0x115f11;});}})[_0xcb45('0x39')](respondWithFilteredResult(_0xa93de4,_0x4a6fd4))[_0xcb45('0x2c')](handleError(_0xa93de4,null));};exports['removeDispositions']=function(_0x3418d9,_0x555daf,_0x4a7e81){return db['FaxAccount'][_0xcb45('0x61')]({'where':{'id':_0x3418d9['params']['id']}})[_0xcb45('0x39')](handleEntityNotFound(_0x555daf,null))['then'](function(_0x4c0aa0){if(_0x4c0aa0){return _0x4c0aa0['removeDispositions'](_0x3418d9[_0xcb45('0x4b')][_0xcb45('0x6c')]);}})['then'](respondWithStatusCode(_0x555daf,null))[_0xcb45('0x2c')](handleError(_0x555daf,null));};exports[_0xcb45('0x6d')]=function(_0x38f2c5,_0x283126,_0x2fe63c){if(_0x38f2c5[_0xcb45('0x63')]['id']){delete _0x38f2c5['body']['id'];}return db[_0xcb45('0x44')][_0xcb45('0x61')]({'where':{'id':_0x38f2c5[_0xcb45('0x60')]['id']}})['then'](handleEntityNotFound(_0x283126,null))[_0xcb45('0x39')](function(_0x529f23){if(_0x529f23){_0x38f2c5['body'][_0xcb45('0x68')]=_0x529f23['id'];return db['CannedAnswer'][_0xcb45('0x62')](_0x38f2c5['body']);}})[_0xcb45('0x39')](respondWithResult(_0x283126,null))[_0xcb45('0x2c')](handleError(_0x283126,null));};exports[_0xcb45('0x6e')]=function(_0x1f202c,_0x2daf33,_0x52e106){var _0x5248d1={'raw':![],'where':{}};var _0x97db18={};var _0x52fdaf={'count':0x0,'rows':[]};return db[_0xcb45('0x44')]['findOne']({'where':{'id':_0x1f202c[_0xcb45('0x60')]['id']}})[_0xcb45('0x39')](handleEntityNotFound(_0x2daf33,null))[_0xcb45('0x39')](function(_0x547ef0){if(_0x547ef0){_0x97db18[_0xcb45('0x49')]=_[_0xcb45('0x4c')](db['CannedAnswer'][_0xcb45('0x45')]);_0x97db18['query']=_['keys'](_0x1f202c[_0xcb45('0x4b')]);_0x97db18[_0xcb45('0x4d')]=_[_0xcb45('0x4e')](_0x97db18[_0xcb45('0x49')],_0x97db18[_0xcb45('0x4b')]);_0x5248d1['attributes']=_[_0xcb45('0x4e')](_0x97db18[_0xcb45('0x49')],qs[_0xcb45('0x50')](_0x1f202c[_0xcb45('0x4b')]['fields']));_0x5248d1[_0xcb45('0x4f')]=_0x5248d1[_0xcb45('0x4f')][_0xcb45('0x51')]?_0x5248d1[_0xcb45('0x4f')]:_0x97db18['model'];if(!_0x1f202c['query'][_0xcb45('0x52')](_0xcb45('0x53'))){_0x5248d1[_0xcb45('0x34')]=qs[_0xcb45('0x34')](_0x1f202c[_0xcb45('0x4b')][_0xcb45('0x34')]);_0x5248d1[_0xcb45('0x31')]=qs[_0xcb45('0x31')](_0x1f202c[_0xcb45('0x4b')][_0xcb45('0x31')]);}_0x5248d1[_0xcb45('0x54')]=qs[_0xcb45('0x55')](_0x1f202c[_0xcb45('0x4b')]['sort']);_0x5248d1['where']=qs[_0xcb45('0x4d')](_[_0xcb45('0x57')](_0x1f202c[_0xcb45('0x4b')],_0x97db18[_0xcb45('0x4d')]));_0x5248d1[_0xcb45('0x56')][_0xcb45('0x68')]=_0x547ef0['id'];if(_0x1f202c['query'][_0xcb45('0x58')]){_0x5248d1[_0xcb45('0x56')]=_[_0xcb45('0x59')](_0x5248d1[_0xcb45('0x56')],{'$or':_[_0xcb45('0x4a')](_0x5248d1[_0xcb45('0x4f')],function(_0x5f33e5){var _0x215274={};_0x215274[_0x5f33e5]={'$like':'%'+_0x1f202c[_0xcb45('0x4b')][_0xcb45('0x58')]+'%'};return _0x215274;})});}_0x5248d1=_[_0xcb45('0x59')]({},_0x5248d1,_0x1f202c[_0xcb45('0x5b')]);return db[_0xcb45('0x6f')][_0xcb45('0x33')]({'where':_0x5248d1[_0xcb45('0x56')]})[_0xcb45('0x39')](function(_0x6d387){_0x52fdaf[_0xcb45('0x33')]=_0x6d387;if(_0x1f202c['query'][_0xcb45('0x5c')]){_0x5248d1[_0xcb45('0x5d')]=[{'all':!![]}];}return db['CannedAnswer'][_0xcb45('0x5e')](_0x5248d1);})['then'](function(_0x3aa13b){_0x52fdaf[_0xcb45('0x5f')]=_0x3aa13b;return _0x52fdaf;});}})['then'](respondWithFilteredResult(_0x2daf33,_0x5248d1))[_0xcb45('0x2c')](handleError(_0x2daf33,null));};exports['removeAnswers']=function(_0x3e5777,_0x1bb325,_0xaea081){return db['FaxAccount'][_0xcb45('0x61')]({'where':{'id':_0x3e5777[_0xcb45('0x60')]['id']}})[_0xcb45('0x39')](handleEntityNotFound(_0x1bb325,null))['then'](function(_0x5a7be8){if(_0x5a7be8){return _0x5a7be8[_0xcb45('0x70')](_0x3e5777[_0xcb45('0x4b')][_0xcb45('0x6c')]);}})[_0xcb45('0x39')](respondWithStatusCode(_0x1bb325,null))[_0xcb45('0x2c')](handleError(_0x1bb325,null));};exports['addInteraction']=function(_0x344606,_0x49674b,_0x59061e){return db['FaxInteraction'][_0xcb45('0x61')]({'where':{'id':_0x344606[_0xcb45('0x60')]['id']}})[_0xcb45('0x39')](handleEntityNotFound(_0x49674b,null))['then'](function(_0x3bbe4c){if(_0x3bbe4c){return _0x3bbe4c['addInteraction'](_0x344606[_0xcb45('0x63')][_0xcb45('0x6c')],_[_0xcb45('0x71')](_0x344606['body'],['ids','id'])||{});}})[_0xcb45('0x39')](respondWithResult(_0x49674b,null))[_0xcb45('0x2c')](handleError(_0x49674b,null));};exports[_0xcb45('0x72')]=function(_0x286430,_0x11ef31,_0x5a7500){var _0x3b0917={'raw':![],'where':{}};var _0x2054cb={};var _0x366b5e={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x286430[_0xcb45('0x60')]['id']}})['then'](handleEntityNotFound(_0x11ef31,null))[_0xcb45('0x39')](function(_0x211a3a){if(_0x211a3a){_0x2054cb['model']=_[_0xcb45('0x4c')](db['FaxInteraction'][_0xcb45('0x45')]);_0x2054cb['query']=_[_0xcb45('0x4c')](_0x286430[_0xcb45('0x4b')]);_0x2054cb['filters']=_[_0xcb45('0x4e')](_0x2054cb['model'],_0x2054cb[_0xcb45('0x4b')]);_0x3b0917['attributes']=_[_0xcb45('0x4e')](_0x2054cb[_0xcb45('0x49')],qs[_0xcb45('0x50')](_0x286430[_0xcb45('0x4b')][_0xcb45('0x50')]));_0x3b0917['attributes']=_0x3b0917[_0xcb45('0x4f')][_0xcb45('0x51')]?_0x3b0917[_0xcb45('0x4f')]:_0x2054cb[_0xcb45('0x49')];if(!_0x286430['query'][_0xcb45('0x52')](_0xcb45('0x53'))){_0x3b0917[_0xcb45('0x34')]=qs[_0xcb45('0x34')](_0x286430['query']['limit']);_0x3b0917[_0xcb45('0x31')]=qs[_0xcb45('0x31')](_0x286430[_0xcb45('0x4b')][_0xcb45('0x31')]);}_0x3b0917[_0xcb45('0x54')]=qs[_0xcb45('0x55')](_0x286430[_0xcb45('0x4b')][_0xcb45('0x55')]);_0x3b0917[_0xcb45('0x56')]=qs[_0xcb45('0x4d')](_[_0xcb45('0x57')](_0x286430[_0xcb45('0x4b')],_0x2054cb['filters']));_0x3b0917['where']['FaxAccountId']=_0x211a3a['id'];if(_0x286430['query'][_0xcb45('0x58')]){_0x3b0917['where']=_[_0xcb45('0x59')](_0x3b0917[_0xcb45('0x56')],{'$or':_[_0xcb45('0x4a')](_0x3b0917[_0xcb45('0x4f')],function(_0x44e9ae){var _0x31953c={};_0x31953c[_0x44e9ae]={'$like':'%'+_0x286430[_0xcb45('0x4b')][_0xcb45('0x58')]+'%'};return _0x31953c;})});}_0x3b0917=_[_0xcb45('0x59')]({},_0x3b0917,_0x286430[_0xcb45('0x5b')]);return db[_0xcb45('0x73')][_0xcb45('0x33')]({'where':_0x3b0917[_0xcb45('0x56')]})[_0xcb45('0x39')](function(_0x3e0ad4){_0x366b5e[_0xcb45('0x33')]=_0x3e0ad4;if(_0x286430['query'][_0xcb45('0x5c')]){_0x3b0917[_0xcb45('0x5d')]=[{'model':db[_0xcb45('0x74')],'as':_0xcb45('0x75'),'required':![]},{'model':db[_0xcb45('0x76')],'as':_0xcb45('0x77'),'attributes':[_0xcb45('0x3f'),_0xcb45('0x78'),_0xcb45('0x79')],'required':![]},{'model':db['Tag'],'as':_0xcb45('0x7a'),'attributes':['id',_0xcb45('0x3f'),_0xcb45('0x7b')],'where':_0x286430['query'][_0xcb45('0x7c')]?{'id':_0x286430['query'][_0xcb45('0x7c')]}:undefined,'required':_0x286430[_0xcb45('0x4b')][_0xcb45('0x7c')]?!![]:![]}];}return db[_0xcb45('0x73')][_0xcb45('0x5e')](_0x3b0917);})[_0xcb45('0x39')](function(_0x5d795b){_0x366b5e[_0xcb45('0x5f')]=_0x5d795b;return _0x366b5e;});}})['then'](respondWithFilteredResult(_0x11ef31,_0x3b0917))['catch'](handleError(_0x11ef31,null));};exports[_0xcb45('0x7d')]=function(_0x160598,_0x33bf85){var _0x51edf8=_0x160598[_0xcb45('0x60')]['id'];var _0x2b66d4=_0x160598['body'];var _0x66ffbe=0xc8;var _0x11dc0c=null;return db[_0xcb45('0x7e')]['transaction']({'isolationLevel':db[_0xcb45('0x7e')]['Transaction'][_0xcb45('0x7f')][_0xcb45('0x80')]},function(_0x9e8147){return db[_0xcb45('0x44')][_0xcb45('0x6a')]({'where':{'id':_0x51edf8},'transaction':_0x9e8147})[_0xcb45('0x39')](function(_0x9d35c){if(_0x9d35c){return db[_0xcb45('0x81')]['destroy']({'where':{'FaxAccountId':_0x51edf8},'transaction':_0x9e8147})[_0xcb45('0x39')](function(){var _0x37dcf1=_[_0xcb45('0x4a')](_0x2b66d4,function(_0x57dc36){_0x57dc36['FaxAccountId']=_0x51edf8;return _0x57dc36;});return db[_0xcb45('0x81')][_0xcb45('0x82')](_0x37dcf1,{'transaction':_0x9e8147});});}else{_0x66ffbe=0x194;_0x11dc0c=[];}});})['then'](function(){if(_0x66ffbe!==0x194){return db[_0xcb45('0x81')]['findAndCountAll']({'where':{'FaxAccountId':_0x51edf8},'order':_0xcb45('0x83')})[_0xcb45('0x39')](function(_0x13ca9e){_0x11dc0c=_0x13ca9e;});}})[_0xcb45('0x2c')](function(_0x3aa928){_0x66ffbe=0x1f4;logger[_0xcb45('0x29')](_0x3aa928[_0xcb45('0x3e')]);if(_0x3aa928['name']){delete _0x3aa928['name'];}_0x11dc0c=_0x3aa928;})[_0xcb45('0x84')](function(){if(_0x11dc0c===null){_0x33bf85[_0xcb45('0x2d')](_0x66ffbe);}else{if(_0x66ffbe===0x1f4){_0x33bf85[_0xcb45('0x2e')](_0x66ffbe)[_0xcb45('0x40')](_0x11dc0c);}else{_0x33bf85[_0xcb45('0x2e')](_0x66ffbe)['json'](_0x11dc0c);}}});};exports[_0xcb45('0x85')]=function(_0x247b04,_0x9e7473,_0xe5a404){var _0x29f1e3={};var _0x327ab5={};var _0x18189f;var _0x1d62e9;return db['FaxAccount'][_0xcb45('0x6a')]({'where':{'id':_0x247b04[_0xcb45('0x60')]['id']}})[_0xcb45('0x39')](handleEntityNotFound(_0x9e7473,null))['then'](function(_0x42300b){if(_0x42300b){_0x18189f=_0x42300b;_0x327ab5[_0xcb45('0x49')]=_[_0xcb45('0x4c')](db[_0xcb45('0x81')][_0xcb45('0x45')]);_0x327ab5[_0xcb45('0x4b')]=_[_0xcb45('0x4c')](_0x247b04['query']);_0x327ab5['filters']=_['intersection'](_0x327ab5[_0xcb45('0x49')],_0x327ab5[_0xcb45('0x4b')]);_0x29f1e3[_0xcb45('0x4f')]=_['intersection'](_0x327ab5['model'],qs['fields'](_0x247b04[_0xcb45('0x4b')][_0xcb45('0x50')]));_0x29f1e3['attributes']=_0x29f1e3['attributes'][_0xcb45('0x51')]?_0x29f1e3['attributes']:_0x327ab5[_0xcb45('0x49')];_0x29f1e3[_0xcb45('0x54')]=qs[_0xcb45('0x55')](_0x247b04['query'][_0xcb45('0x55')]);_0x29f1e3[_0xcb45('0x56')]=qs['filters'](_[_0xcb45('0x57')](_0x247b04['query'],_0x327ab5[_0xcb45('0x4d')]));if(_0x247b04['query'][_0xcb45('0x58')]){_0x29f1e3['where']=_[_0xcb45('0x59')](_0x29f1e3['where'],{'$or':_[_0xcb45('0x4a')](_0x29f1e3['attributes'],function(_0x3823ce){var _0x3c96aa={};_0x3c96aa[_0x3823ce]={'$like':'%'+_0x247b04['query'][_0xcb45('0x58')]+'%'};return _0x3c96aa;})});}_0x29f1e3=_['merge']({},_0x29f1e3,_0x247b04[_0xcb45('0x5b')]);return _0x18189f['getApplications'](_0x29f1e3);}})[_0xcb45('0x39')](function(_0x433b39){if(_0x433b39){_0x1d62e9=_0x433b39[_0xcb45('0x51')];if(!_0x247b04[_0xcb45('0x4b')][_0xcb45('0x52')](_0xcb45('0x53'))){_0x29f1e3['limit']=qs[_0xcb45('0x34')](_0x247b04['query'][_0xcb45('0x34')]);_0x29f1e3[_0xcb45('0x31')]=qs[_0xcb45('0x31')](_0x247b04[_0xcb45('0x4b')]['offset']);}return _0x18189f[_0xcb45('0x85')](_0x29f1e3);}})[_0xcb45('0x39')](function(_0x266d78){if(_0x266d78){return _0x266d78?{'count':_0x1d62e9,'rows':_0x266d78}:null;}})['then'](respondWithResult(_0x9e7473,null))[_0xcb45('0x2c')](handleError(_0x9e7473,null));};function Extension(_0x50d5e1,_0x2f8e90,_0x44f19d,_0xa21ec9){this['context']=_0xcb45('0x86');this[_0xcb45('0x87')]=_0x50d5e1[_0xcb45('0x88')];this[_0xcb45('0x89')]=_0xa21ec9;this['type']='system';this['description']='Fax\x20Extension';this[_0xcb45('0x68')]=_0x50d5e1['id'];this[_0xcb45('0x83')]=_0x2f8e90;this[_0xcb45('0x8a')]=_0x44f19d;}function createExtensionsReciveFax(_0x49b311){var _0x180e0a=0x1;var _0x1a53cd=[];_0x1a53cd[_0xcb45('0x8b')](new Extension(_0x49b311,_0x180e0a,'',_0xcb45('0x8c')));_0x180e0a+=0x1;_0x1a53cd[_0xcb45('0x8b')](new Extension(_0x49b311,_0x180e0a,_0xcb45('0x8d'),_0xcb45('0x8e')));_0x180e0a+=0x1;for(var _0x313343 in _0x49b311){if(_0x49b311['hasOwnProperty'](_0x313343)&&(_0x313343===_0xcb45('0x8f')||_0x313343===_0xcb45('0x88')||_0x313343===_0xcb45('0x90')||_0x313343===_0xcb45('0x91')||_0x313343===_0xcb45('0x92')||_0x313343===_0xcb45('0x93')||_0x313343===_0xcb45('0x94')||_0x313343===_0xcb45('0x95')||_0x313343===_0xcb45('0x96'))){_0x1a53cd[_0xcb45('0x8b')](new Extension(_0x49b311,_0x180e0a,_0xcb45('0x97')+_0x313343+')='+_0x49b311[_0x313343],_0xcb45('0x8e')));_0x180e0a+=0x1;}}_0x1a53cd[_0xcb45('0x8b')](new Extension(_0x49b311,_0x180e0a,'6',_0xcb45('0x98')));_0x180e0a+=0x1;_0x1a53cd[_0xcb45('0x8b')](new Extension(_0x49b311,_0x180e0a,_0xcb45('0x99'),_0xcb45('0x9a')));_0x180e0a=0x0;return _0x1a53cd;}exports[_0xcb45('0x9b')]=function(_0x17d100,_0x4b1923,_0x1bc27a){var _0x5264b6;return db['sequelize'][_0xcb45('0x9c')](function(_0x466c77){return db[_0xcb45('0x44')]['create'](_0x17d100[_0xcb45('0x63')],{'transaction':_0x466c77})[_0xcb45('0x39')](function(_0x5dd63f){_0x5264b6=_0x5dd63f[_0xcb45('0x3a')]({'plain':!![]});return db[_0xcb45('0x9d')]['bulkCreate'](createExtensionsReciveFax(_0x5264b6),{'transaction':_0x466c77});});})['then'](function(){return _0x5264b6;})[_0xcb45('0x39')](respondWithResult(_0x4b1923,null))['catch'](handleError(_0x4b1923,null));};exports[_0xcb45('0x9e')]=function(_0x4a20b7,_0x3b9664,_0x249c8e){var _0x1bd970;return db['sequelize'][_0xcb45('0x9c')](function(_0x518d27){return db[_0xcb45('0x44')][_0xcb45('0x38')](_0x4a20b7[_0xcb45('0x63')],{'where':{'id':_0x4a20b7['body']['id']},'transaction':_0x518d27})[_0xcb45('0x39')](function(_0x2c1daf){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x4a20b7[_0xcb45('0x63')]['id']},'transaction':_0x518d27})['then'](function(_0x4e5c13){return db[_0xcb45('0x9d')][_0xcb45('0x82')](createExtensionsReciveFax(_[_0xcb45('0x71')](_0x4a20b7[_0xcb45('0x63')],[_0xcb45('0x9f'),_0xcb45('0x48'),_0xcb45('0xa0'),_0xcb45('0xa1'),_0xcb45('0xa2'),_0xcb45('0xa3')])),{'transaction':_0x518d27});});});})[_0xcb45('0x39')](function(){return db[_0xcb45('0x44')][_0xcb45('0xa4')](_0x4a20b7[_0xcb45('0x63')]['id']);})[_0xcb45('0x39')](respondWithResult(_0x3b9664,null))[_0xcb45('0x2c')](handleError(_0x3b9664,null));};exports[_0xcb45('0xa5')]=function(_0x24a41f,_0x29b8b8,_0x5268a5){var _0x4369d9={'raw':!![],'where':{}};var _0x375115={};var _0x126414={'count':0x0,'rows':[]};return db[_0xcb45('0x44')][_0xcb45('0x6a')]({'where':{'id':_0x24a41f[_0xcb45('0x60')]['id']}})[_0xcb45('0x39')](handleEntityNotFound(_0x29b8b8,null))[_0xcb45('0x39')](function(_0x405f74){if(_0x405f74){_0x375115[_0xcb45('0x49')]=_['keys'](db['FaxMessage'][_0xcb45('0x45')]);_0x375115[_0xcb45('0x4b')]=_[_0xcb45('0x4c')](_0x24a41f[_0xcb45('0x4b')]);_0x375115['filters']=_[_0xcb45('0x4e')](_0x375115[_0xcb45('0x49')],_0x375115[_0xcb45('0x4b')]);_0x4369d9[_0xcb45('0x4f')]=_[_0xcb45('0x4e')](_0x375115[_0xcb45('0x49')],qs[_0xcb45('0x50')](_0x24a41f[_0xcb45('0x4b')][_0xcb45('0x50')]));_0x4369d9[_0xcb45('0x4f')]=_0x4369d9[_0xcb45('0x4f')][_0xcb45('0x51')]?_0x4369d9['attributes']:_0x375115[_0xcb45('0x49')];if(!_0x24a41f['query'][_0xcb45('0x52')](_0xcb45('0x53'))){_0x4369d9['limit']=qs[_0xcb45('0x34')](_0x24a41f[_0xcb45('0x4b')]['limit']);_0x4369d9[_0xcb45('0x31')]=qs['offset'](_0x24a41f[_0xcb45('0x4b')]['offset']);}_0x4369d9['order']=qs[_0xcb45('0x55')](_0x24a41f[_0xcb45('0x4b')]['sort']);_0x4369d9[_0xcb45('0x56')]=qs[_0xcb45('0x4d')](_[_0xcb45('0x57')](_0x24a41f[_0xcb45('0x4b')],_0x375115['filters']));_0x4369d9[_0xcb45('0x56')][_0xcb45('0x68')]=_0x405f74['id'];if(_0x24a41f[_0xcb45('0x4b')][_0xcb45('0x58')]){_0x4369d9[_0xcb45('0x56')]=_[_0xcb45('0x59')](_0x4369d9[_0xcb45('0x56')],{'$or':_[_0xcb45('0x4a')](_0x4369d9[_0xcb45('0x4f')],function(_0x4da6ba){var _0x23d52d={};_0x23d52d[_0x4da6ba]={'$like':'%'+_0x24a41f[_0xcb45('0x4b')]['filter']+'%'};return _0x23d52d;})});}if(_0x24a41f[_0xcb45('0x4b')][_0xcb45('0xa6')]){var _0x35e182=_0x24a41f[_0xcb45('0x4b')][_0xcb45('0xa6')][_0xcb45('0xa7')](',');var _0x3d7bfa={};_0x3d7bfa[_0x35e182[0x0]]={'$gte':moment(_0x35e182[0x1])[_0xcb45('0xa8')](_0xcb45('0xa9'))};_0x4369d9[_0xcb45('0x56')]=_[_0xcb45('0x59')](_0x4369d9[_0xcb45('0x56')],_0x3d7bfa);}_0x4369d9=_[_0xcb45('0x59')]({},_0x4369d9,_0x24a41f['options']);return db[_0xcb45('0xaa')][_0xcb45('0x33')]({'where':_0x4369d9[_0xcb45('0x56')]})['then'](function(_0x431692){_0x126414[_0xcb45('0x33')]=_0x431692;if(_0x24a41f['query'][_0xcb45('0x5c')]){_0x4369d9[_0xcb45('0x5d')]=[{'all':!![]}];}return db[_0xcb45('0xaa')][_0xcb45('0x5e')](_0x4369d9);})[_0xcb45('0x39')](function(_0x360595){_0x126414[_0xcb45('0x5f')]=_0x360595;return _0x126414;});}})['then'](respondWithFilteredResult(_0x29b8b8,_0x4369d9))['catch'](handleError(_0x29b8b8,null));};exports[_0xcb45('0x40')]=function(_0x372088,_0x1f7690,_0x2f9555){var _0x45ac84,_0x14166a={},_0x590bee;if(_0x372088[_0xcb45('0x63')]['to']){_0x590bee=_0x372088[_0xcb45('0x63')]['to'][0x0];}return db[_0xcb45('0x44')][_0xcb45('0x61')]({'where':{'id':_0x372088[_0xcb45('0x60')]['id']},'include':[{'model':db[_0xcb45('0xab')],'as':_0xcb45('0xac'),'include':[{'model':db[_0xcb45('0x74')],'as':'Contacts','where':{'fax':_0x590bee},'limit':0x1,'order':[[_0xcb45('0xa1'),_0xcb45('0xad')]]}]}]})[_0xcb45('0x39')](handleEntityNotFound(_0x1f7690,null))[_0xcb45('0x39')](function(_0x5d01b5){_0x45ac84=_0x5d01b5;if(_0x372088['body'][_0xcb45('0xae')]&&_0x372088[_0xcb45('0x63')][_0xcb45('0xae')][_0xcb45('0x51')]){for(var _0x50a71c=0x0;_0x50a71c<_0x372088[_0xcb45('0x63')][_0xcb45('0xae')][_0xcb45('0x51')];_0x50a71c+=0x1){_0x372088[_0xcb45('0x63')][_0xcb45('0xae')][_0x50a71c]={'filename':_0x372088['body'][_0xcb45('0xae')][_0x50a71c][_0xcb45('0x3f')],'id':_0x372088[_0xcb45('0x63')]['attachments'][_0x50a71c]['id'],'path':path[_0xcb45('0xaf')](config[_0xcb45('0xb0')],_0xcb45('0xb1'),_0x372088[_0xcb45('0x63')][_0xcb45('0xae')][_0x50a71c][_0xcb45('0xb2')])};}}return respondWithRpcPromise('CheckAfterSend',_0xcb45('0xb3'),{'FaxAccountId':_[_0xcb45('0xb4')](_0x372088[_0xcb45('0x60')]['id'])?undefined:_0x372088[_0xcb45('0x60')]['id'],'path':_[_0xcb45('0xb4')](_0x372088[_0xcb45('0x63')][_0xcb45('0xae')][0x0][_0xcb45('0xb5')])?undefined:_0x372088[_0xcb45('0x63')][_0xcb45('0xae')][0x0]['path'],'fax':_[_0xcb45('0xb4')](_0x372088['body']['to'][0x0])?undefined:_0x372088[_0xcb45('0x63')]['to'][0x0]},client9002);})[_0xcb45('0x39')](function(){if(_0x45ac84){if(_[_0xcb45('0xb4')](_0x372088[_0xcb45('0x63')][_0xcb45('0xb6')])){_0x372088[_0xcb45('0x63')][_0xcb45('0xb6')]=util[_0xcb45('0xa8')](_0xcb45('0xb7'),_0x45ac84['name'],_0x45ac84[_0xcb45('0xb8')]);}if(_0x45ac84['List']){if(_0x45ac84[_0xcb45('0xac')][_0xcb45('0xb9')][_0xcb45('0x51')]){return _0x45ac84[_0xcb45('0xac')][_0xcb45('0xb9')][0x0];}else{return db[_0xcb45('0x74')][_0xcb45('0x62')](_[_0xcb45('0x1b')](_0x372088[_0xcb45('0x63')],{'firstName':_0x372088['body']['to'][0x0],'phone':_0x372088[_0xcb45('0x63')]['to'][0x0],'fax':_0x372088[_0xcb45('0x63')]['to'][0x0],'ListId':_0x45ac84[_0xcb45('0xa3')]}));}}else{throw new Error(_0xcb45('0xba'));}}else{throw new Error(_0xcb45('0xbb'));}})[_0xcb45('0x39')](function(_0x1b3e97){if(_0x1b3e97){return db[_0xcb45('0x73')]['find']({'where':{'ContactId':_0x1b3e97['id'],'closed':![],'FaxAccountId':_0x45ac84['id']}})[_0xcb45('0x39')](function(_0x374d3e){if(_0x374d3e){return[_0x374d3e,![]];}return db[_0xcb45('0x73')][_0xcb45('0x62')]({'UserId':_0x372088[_0xcb45('0x64')]['id'],'ContactId':_0x1b3e97['id'],'FaxAccountId':_0x45ac84['id'],'fax':_0x372088[_0xcb45('0x63')]['to'][0x0],'firstMsgDirection':_0xcb45('0xbc'),'Messages':[_[_0xcb45('0x59')](_0x372088[_0xcb45('0x63')],{'read':![],'body':_0x372088[_0xcb45('0x63')]['attachments'][0x0][_0xcb45('0xbd')],'FaxAccountId':_0x45ac84['id'],'UserId':_0x372088[_0xcb45('0x64')]['id'],'ContactId':_0x1b3e97['id'],'AttachmentId':_0x372088[_0xcb45('0x63')][_0xcb45('0xae')][0x0]['id']})]},{'include':[{'model':db[_0xcb45('0xaa')],'as':'Messages'}]})[_0xcb45('0x39')](function(_0x4faaa9){return[_0x4faaa9,!![]];});});}else{throw new Error(_0xcb45('0xbe'));}})[_0xcb45('0xbf')](function(_0x1daf94,_0x5c817d){if(_0x5c817d){return _0x1daf94;}return db['FaxMessage']['create']({'direction':_0xcb45('0xbc'),'read':![],'body':_0x372088[_0xcb45('0x63')]['attachments'][0x0][_0xcb45('0xbd')],'FaxAccountId':_0x45ac84['id'],'FaxInteractionId':_0x1daf94['id'],'UserId':_0x372088['user']['id'],'ContactId':_0x1daf94[_0xcb45('0xc0')],'AttachmentId':_0x372088['body'][_0xcb45('0xae')][0x0]['id']})[_0xcb45('0x39')](function(_0x3441a6){_0x1daf94[_0xcb45('0xc1')][_0xcb45('0xc2')]=[];_0x1daf94[_0xcb45('0xc1')][_0xcb45('0xc2')][_0xcb45('0x8b')](_0x3441a6['dataValues']);return _0x1daf94;});})['then'](function(_0x1286ac){respondWithRpcPromise(_0xcb45('0xc3'),_0xcb45('0xc3'),{'FaxAccountId':_[_0xcb45('0xb4')](_0x372088[_0xcb45('0x60')]['id'])?undefined:_0x372088[_0xcb45('0x60')]['id'],'path':_['isNil'](_0x372088[_0xcb45('0x63')][_0xcb45('0xae')][0x0][_0xcb45('0xb5')])?undefined:_0x372088['body']['attachments'][0x0][_0xcb45('0xb5')],'fax':_[_0xcb45('0xb4')](_0x372088['body']['to'][0x0])?undefined:_0x372088[_0xcb45('0x63')]['to'][0x0],'AttachmentId':_0x372088[_0xcb45('0x63')][_0xcb45('0xae')][0x0]['id']},client9002)['then'](function(_0x5906cc){logger['info']('SendFaxRpc,\x20%s',_0x5906cc);})[_0xcb45('0x2c')](function(_0x3467bb){logger[_0xcb45('0x23')](_0xcb45('0xc4'),_0x3467bb);});return _0x1286ac;})[_0xcb45('0x39')](respondWithResult(_0x1f7690,null))['catch'](handleError(_0x1f7690,null));};exports[_0xcb45('0xc5')]=function(_0x2bb929,_0x4ad201,_0x2b662f){return db[_0xcb45('0x44')][_0xcb45('0x61')]({'where':{'id':_0x2bb929['params']['id']}})[_0xcb45('0x39')](handleEntityNotFound(_0x4ad201,null))[_0xcb45('0x39')](function(_0x392d8f){if(_0x392d8f){return _0x392d8f[_0xcb45('0xc5')](_0x2bb929['body'][_0xcb45('0x6c')],_['omit'](_0x2bb929[_0xcb45('0x63')],[_0xcb45('0x6c'),'id'])||{})[_0xcb45('0xbf')](function(_0x1eb3f0){for(var _0x5217e6=0x0;_0x5217e6<_0x2bb929[_0xcb45('0x63')]['ids'][_0xcb45('0x51')];_0x5217e6+=0x1){socket[_0xcb45('0xc6')](_0xcb45('0xc7'),{'UserId':Number(_0x2bb929[_0xcb45('0x63')][_0xcb45('0x6c')][_0x5217e6]),'FaxAccountId':Number(_0x2bb929[_0xcb45('0x60')]['id'])});}return _0x1eb3f0;});}})[_0xcb45('0x39')](respondWithResult(_0x4ad201,null))[_0xcb45('0x2c')](handleError(_0x4ad201,null));};exports[_0xcb45('0xc8')]=function(_0x279c31,_0x3b4314,_0x1a8c2d){return db['FaxAccount']['find']({'where':{'id':_0x279c31['params']['id']}})[_0xcb45('0x39')](handleEntityNotFound(_0x3b4314,null))[_0xcb45('0x39')](function(_0x2e9499){if(_0x2e9499){return _0x2e9499[_0xcb45('0xc8')](_0x279c31[_0xcb45('0x4b')][_0xcb45('0x6c')])[_0xcb45('0x39')](function(){if(_[_0xcb45('0xc9')](_0x279c31[_0xcb45('0x4b')]['ids'])){for(var _0x3a89ab=0x0;_0x3a89ab<_0x279c31[_0xcb45('0x4b')][_0xcb45('0x6c')][_0xcb45('0x51')];_0x3a89ab+=0x1){socket[_0xcb45('0xc6')]('userFaxAccount:remove',{'UserId':Number(_0x279c31[_0xcb45('0x4b')][_0xcb45('0x6c')][_0x3a89ab]),'FaxAccountId':Number(_0x279c31['params']['id'])});}}else{socket[_0xcb45('0xc6')](_0xcb45('0xca'),{'UserId':Number(_0x279c31['query'][_0xcb45('0x6c')]),'FaxAccountId':Number(_0x279c31[_0xcb45('0x60')]['id'])});}});}})[_0xcb45('0x39')](respondWithStatusCode(_0x3b4314,null))[_0xcb45('0x2c')](handleError(_0x3b4314,null));};exports[_0xcb45('0xcb')]=function(_0x446f01,_0x586c2b,_0x89cde7){var _0x3af353={};var _0x21dda5={};var _0x3cffed;var _0x3b2e82;return db[_0xcb45('0x44')]['findOne']({'where':{'id':_0x446f01['params']['id']}})[_0xcb45('0x39')](handleEntityNotFound(_0x586c2b,null))[_0xcb45('0x39')](function(_0x1665a9){if(_0x1665a9){_0x3cffed=_0x1665a9;_0x21dda5[_0xcb45('0x49')]=_[_0xcb45('0x4c')](db[_0xcb45('0x76')][_0xcb45('0x45')]);_0x21dda5[_0xcb45('0x4b')]=_['keys'](_0x446f01[_0xcb45('0x4b')]);_0x21dda5[_0xcb45('0x4d')]=_[_0xcb45('0x4e')](_0x21dda5['model'],_0x21dda5['query']);_0x3af353[_0xcb45('0x4f')]=_[_0xcb45('0x4e')](_0x21dda5['model'],qs[_0xcb45('0x50')](_0x446f01[_0xcb45('0x4b')]['fields']));_0x3af353[_0xcb45('0x4f')]=_0x3af353[_0xcb45('0x4f')]['length']?_0x3af353['attributes']:_0x21dda5['model'];_0x3af353[_0xcb45('0x54')]=qs[_0xcb45('0x55')](_0x446f01[_0xcb45('0x4b')]['sort']);_0x3af353['where']=qs[_0xcb45('0x4d')](_[_0xcb45('0x57')](_0x446f01['query'],_0x21dda5[_0xcb45('0x4d')]));if(_0x446f01['query'][_0xcb45('0x58')]){_0x3af353[_0xcb45('0x56')]=_[_0xcb45('0x59')](_0x3af353[_0xcb45('0x56')],{'$or':_[_0xcb45('0x4a')](_0x3af353[_0xcb45('0x4f')],function(_0x36cf82){var _0x5df597={};_0x5df597[_0x36cf82]={'$like':'%'+_0x446f01['query'][_0xcb45('0x58')]+'%'};return _0x5df597;})});}_0x3af353=_[_0xcb45('0x59')]({},_0x3af353,_0x446f01[_0xcb45('0x5b')]);return _0x3cffed[_0xcb45('0xcb')](_0x3af353);}})['then'](function(_0x291d86){if(_0x291d86){_0x3b2e82=_0x291d86[_0xcb45('0x51')];if(!_0x446f01[_0xcb45('0x4b')]['hasOwnProperty'](_0xcb45('0x53'))){_0x3af353[_0xcb45('0x34')]=qs[_0xcb45('0x34')](_0x446f01[_0xcb45('0x4b')][_0xcb45('0x34')]);_0x3af353[_0xcb45('0x31')]=qs[_0xcb45('0x31')](_0x446f01[_0xcb45('0x4b')][_0xcb45('0x31')]);}return _0x3cffed[_0xcb45('0xcb')](_0x3af353);}})[_0xcb45('0x39')](function(_0x1c7161){if(_0x1c7161){return _0x1c7161?{'count':_0x3b2e82,'rows':_0x1c7161}:null;}})[_0xcb45('0x39')](respondWithResult(_0x586c2b,null))[_0xcb45('0x2c')](handleError(_0x586c2b,null));}; \ No newline at end of file +var _0x0682=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./faxAccount.socket','register','jayson/promise','client','http','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','update','get','FaxAccounts','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','show','params','includeAll','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','UserProfileResource','body','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','ids','FaxInteraction','CmContact','User','internal','Tag','color','tag','sequelize','transaction','Transaction','FaxApplication','bulkCreate','findAndCountAll','priority','json','getApplications','from-voip-provider','exten','localstationid','app','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','gateway','headerinfo','minrate','modem','FAXOPT(','Wait','addAccountApplications','VoiceExtension','updateAccountApplications','tech','updatedAt','TrunkId','ListId','findById','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','attachments','join','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring'];(function(_0x1d5a57,_0xecd824){var _0x133bee=function(_0x40214f){while(--_0x40214f){_0x1d5a57['push'](_0x1d5a57['shift']());}};_0x133bee(++_0xecd824);}(_0x0682,0x16a));var _0x2068=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0682[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2068('0x0'));var zipdir=require(_0x2068('0x1'));var jsonpatch=require(_0x2068('0x2'));var rp=require(_0x2068('0x3'));var moment=require(_0x2068('0x4'));var BPromise=require(_0x2068('0x5'));var Mustache=require(_0x2068('0x6'));var util=require(_0x2068('0x7'));var path=require(_0x2068('0x8'));var sox=require(_0x2068('0x9'));var csv=require(_0x2068('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2068('0xb'));var _=require('lodash');var squel=require(_0x2068('0xc'));var crypto=require(_0x2068('0xd'));var jsforce=require(_0x2068('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2068('0xa'));var querystring=require(_0x2068('0xf'));var Papa=require('papaparse');var Redis=require(_0x2068('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2068('0x11'));var as=require(_0x2068('0x12'));var hardwareService=require(_0x2068('0x13'));var logger=require('../../config/logger')(_0x2068('0x14'));var utils=require(_0x2068('0x15'));var config=require(_0x2068('0x16'));var licenseUtil=require(_0x2068('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x2068('0x18')],{'host':_0x2068('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2068('0x18')]));require(_0x2068('0x1a'))[_0x2068('0x1b')](socket);var jayson=require(_0x2068('0x1c'));var client=jayson[_0x2068('0x1d')][_0x2068('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x2068('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5bcf34,_0x21754a,_0x192a7f,_0x3b1023){return new BPromise(function(_0x3d4373,_0x4fc8b2){var _0x32e05b=_0x3b1023||client;return _0x32e05b['request'](_0x5bcf34,_0x192a7f)[_0x2068('0x1f')](function(_0x4f1e3a){logger[_0x2068('0x20')]('FaxAccount,\x20%s,\x20%s',_0x21754a,'request\x20sent');logger[_0x2068('0x21')](_0x2068('0x22'),_0x21754a,_0x2068('0x23'),JSON[_0x2068('0x24')](_0x4f1e3a));if(_0x4f1e3a['error']){if(_0x4f1e3a[_0x2068('0x25')]['code']===0x1f4){logger[_0x2068('0x25')](_0x2068('0x26'),_0x21754a,_0x4f1e3a[_0x2068('0x25')]['message']);return _0x4fc8b2(_0x4f1e3a[_0x2068('0x25')][_0x2068('0x27')]);}logger[_0x2068('0x25')](_0x2068('0x26'),_0x21754a,_0x4f1e3a[_0x2068('0x25')][_0x2068('0x27')]);return _0x3d4373(_0x4f1e3a[_0x2068('0x25')][_0x2068('0x27')]);}else{logger[_0x2068('0x20')](_0x2068('0x26'),_0x21754a,_0x2068('0x23'));_0x3d4373(_0x4f1e3a[_0x2068('0x28')][_0x2068('0x27')]);}})[_0x2068('0x29')](function(_0x41ce2e){logger[_0x2068('0x25')](_0x2068('0x26'),_0x21754a,_0x41ce2e);_0x4fc8b2(_0x41ce2e);});});}function respondWithStatusCode(_0x341de4,_0x54c175){_0x54c175=_0x54c175||0xcc;return function(_0x3aad22){if(_0x3aad22){return _0x341de4[_0x2068('0x2a')](_0x54c175);}return _0x341de4[_0x2068('0x2b')](_0x54c175)[_0x2068('0x2c')]();};}function respondWithResult(_0x554f5b,_0x611abe){_0x611abe=_0x611abe||0xc8;return function(_0x492202){if(_0x492202){return _0x554f5b[_0x2068('0x2b')](_0x611abe)['json'](_0x492202);}};}function respondWithFilteredResult(_0x250e8d,_0x5aa9e9){return function(_0x1c930b){if(_0x1c930b){var _0x4831bd=typeof _0x5aa9e9[_0x2068('0x2d')]===_0x2068('0x2e')&&typeof _0x5aa9e9[_0x2068('0x2f')]===_0x2068('0x2e');var _0x894e48=_0x1c930b['count'];var _0xbdd9fd=_0x4831bd?0x0:_0x5aa9e9[_0x2068('0x2d')];var _0x98fca9=_0x4831bd?_0x1c930b[_0x2068('0x30')]:_0x5aa9e9[_0x2068('0x2d')]+_0x5aa9e9[_0x2068('0x2f')];var _0x3fb99a;if(_0x98fca9>=_0x894e48){_0x98fca9=_0x894e48;_0x3fb99a=0xc8;}else{_0x3fb99a=0xce;}_0x250e8d[_0x2068('0x2b')](_0x3fb99a);return _0x250e8d[_0x2068('0x31')](_0x2068('0x32'),_0xbdd9fd+'-'+_0x98fca9+'/'+_0x894e48)['json'](_0x1c930b);}return null;};}function patchUpdates(_0x55d69a){return function(_0x33c1be){try{jsonpatch['apply'](_0x33c1be,_0x55d69a,!![]);}catch(_0x646cd8){return BPromise['reject'](_0x646cd8);}return _0x33c1be[_0x2068('0x33')]();};}function saveUpdates(_0x18f173,_0x6fb451){return function(_0x11d516){if(_0x11d516){return _0x11d516[_0x2068('0x34')](_0x18f173)[_0x2068('0x1f')](function(_0x10c506){return _0x10c506;});}return null;};}function removeEntity(_0xe7951f,_0x34ced9){return function(_0x18c446){if(_0x18c446){return _0x18c446['destroy']()[_0x2068('0x1f')](function(){var _0x3c9ed4=_0x18c446[_0x2068('0x35')]({'plain':!![]});var _0x35de09=_0x2068('0x36');return db['UserProfileResource'][_0x2068('0x37')]({'where':{'type':_0x35de09,'resourceId':_0x3c9ed4['id']}})[_0x2068('0x1f')](function(){return _0x18c446;});})['then'](function(){_0xe7951f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bee0f,_0x27cdfc){return function(_0x387269){if(!_0x387269){_0x3bee0f['sendStatus'](0x194);}return _0x387269;};}function handleError(_0x2fa432,_0x5b4603){_0x5b4603=_0x5b4603||0x1f4;return function(_0x35dc70){logger[_0x2068('0x25')](_0x35dc70[_0x2068('0x38')]);if(_0x35dc70[_0x2068('0x39')]){delete _0x35dc70[_0x2068('0x39')];}_0x2fa432[_0x2068('0x2b')](_0x5b4603)[_0x2068('0x3a')](_0x35dc70);};}exports[_0x2068('0x3b')]=function(_0x4f8b92,_0x3924fb){var _0x501ba7={'include':[{'model':db[_0x2068('0x3c')],'as':_0x2068('0x3d')}]},_0x19a182={},_0x3d00e2={'count':0x0,'rows':[]};var _0x56bf37=_['map'](db[_0x2068('0x3e')][_0x2068('0x3f')],function(_0x4d226c){return{'name':_0x4d226c[_0x2068('0x40')],'type':_0x4d226c[_0x2068('0x41')][_0x2068('0x42')]};});_0x19a182[_0x2068('0x43')]=_[_0x2068('0x44')](_0x56bf37,_0x2068('0x39'));_0x19a182[_0x2068('0x45')]=_[_0x2068('0x46')](_0x4f8b92[_0x2068('0x45')]);_0x19a182['filters']=_['intersection'](_0x19a182[_0x2068('0x43')],_0x19a182[_0x2068('0x45')]);_0x501ba7[_0x2068('0x47')]=_[_0x2068('0x48')](_0x19a182[_0x2068('0x43')],qs[_0x2068('0x49')](_0x4f8b92[_0x2068('0x45')]['fields']));_0x501ba7[_0x2068('0x47')]=_0x501ba7[_0x2068('0x47')][_0x2068('0x4a')]?_0x501ba7['attributes']:_0x19a182['model'];if(!_0x4f8b92[_0x2068('0x45')]['hasOwnProperty'](_0x2068('0x4b'))){_0x501ba7[_0x2068('0x2f')]=qs[_0x2068('0x2f')](_0x4f8b92[_0x2068('0x45')][_0x2068('0x2f')]);_0x501ba7[_0x2068('0x2d')]=qs[_0x2068('0x2d')](_0x4f8b92[_0x2068('0x45')][_0x2068('0x2d')]);}_0x501ba7[_0x2068('0x4c')]=qs[_0x2068('0x4d')](_0x4f8b92['query'][_0x2068('0x4d')]);_0x501ba7[_0x2068('0x4e')]=qs[_0x2068('0x4f')](_[_0x2068('0x50')](_0x4f8b92[_0x2068('0x45')],_0x19a182[_0x2068('0x4f')]),_0x56bf37);if(_0x4f8b92[_0x2068('0x45')][_0x2068('0x51')]){_0x501ba7[_0x2068('0x4e')]=_[_0x2068('0x52')](_0x501ba7['where'],{'$or':_[_0x2068('0x44')](_0x56bf37,function(_0x4882e7){if(_0x4882e7[_0x2068('0x41')]!==_0x2068('0x53')){var _0x1c9e2f={};_0x1c9e2f[_0x4882e7[_0x2068('0x39')]]={'$like':'%'+_0x4f8b92[_0x2068('0x45')][_0x2068('0x51')]+'%'};return _0x1c9e2f;}})});}_0x501ba7=_[_0x2068('0x52')]({},_0x501ba7,_0x4f8b92['options']);var _0x45ae12={'where':_0x501ba7[_0x2068('0x4e')]};return db['FaxAccount']['count'](_0x45ae12)[_0x2068('0x1f')](function(_0x35a755){_0x3d00e2['count']=_0x35a755;if(_0x4f8b92['query']['includeAll']){_0x501ba7[_0x2068('0x54')]=[{'all':!![]}];}return db[_0x2068('0x3e')][_0x2068('0x55')](_0x501ba7);})[_0x2068('0x1f')](function(_0x59bf84){_0x3d00e2[_0x2068('0x56')]=_0x59bf84;return _0x3d00e2;})[_0x2068('0x1f')](respondWithFilteredResult(_0x3924fb,_0x501ba7))[_0x2068('0x29')](handleError(_0x3924fb,null));};exports[_0x2068('0x57')]=function(_0x48863b,_0x437d45){var _0x226b4f={'raw':![],'where':{'id':_0x48863b[_0x2068('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x2068('0x3d')}]},_0x56b160={};_0x56b160['model']=_[_0x2068('0x46')](db[_0x2068('0x3e')][_0x2068('0x3f')]);_0x56b160[_0x2068('0x45')]=_[_0x2068('0x46')](_0x48863b[_0x2068('0x45')]);_0x56b160[_0x2068('0x4f')]=_['intersection'](_0x56b160[_0x2068('0x43')],_0x56b160[_0x2068('0x45')]);_0x226b4f[_0x2068('0x47')]=_['intersection'](_0x56b160[_0x2068('0x43')],qs[_0x2068('0x49')](_0x48863b[_0x2068('0x45')][_0x2068('0x49')]));_0x226b4f[_0x2068('0x47')]=_0x226b4f['attributes'][_0x2068('0x4a')]?_0x226b4f[_0x2068('0x47')]:_0x56b160[_0x2068('0x43')];if(_0x48863b['query'][_0x2068('0x59')]){_0x226b4f['include']=[{'all':!![]}];}_0x226b4f=_[_0x2068('0x52')]({},_0x226b4f,_0x48863b[_0x2068('0x5a')]);return db['FaxAccount'][_0x2068('0x5b')](_0x226b4f)[_0x2068('0x1f')](handleEntityNotFound(_0x437d45,null))[_0x2068('0x1f')](respondWithResult(_0x437d45,null))[_0x2068('0x29')](handleError(_0x437d45,null));};exports[_0x2068('0x5c')]=function(_0x352165,_0x1566b7){return db['FaxAccount'][_0x2068('0x5c')](_0x352165['body'],{})[_0x2068('0x1f')](function(_0x5ad92f){var _0x151925=_0x352165['user'][_0x2068('0x35')]({'plain':!![]});if(!_0x151925)throw new Error(_0x2068('0x5d'));if(_0x151925['role']===_0x2068('0x5e')){var _0x7aae16=_0x5ad92f[_0x2068('0x35')]({'plain':!![]});var _0x1f0c6f=_0x2068('0x36');return db['UserProfileSection']['find']({'where':{'name':_0x1f0c6f,'userProfileId':_0x151925[_0x2068('0x5f')]},'raw':!![]})[_0x2068('0x1f')](function(_0x861f56){if(_0x861f56&&_0x861f56['autoAssociation']===0x0){return db[_0x2068('0x60')][_0x2068('0x5c')]({'name':_0x7aae16['name'],'resourceId':_0x7aae16['id'],'type':_0x861f56['name'],'sectionId':_0x861f56['id']},{})[_0x2068('0x1f')](function(){return _0x5ad92f;});}else{return _0x5ad92f;}})[_0x2068('0x29')](function(_0x26700d){logger[_0x2068('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26700d);throw _0x26700d;});}return _0x5ad92f;})['then'](respondWithResult(_0x1566b7,0xc9))['catch'](handleError(_0x1566b7,null));};exports[_0x2068('0x34')]=function(_0x41d6af,_0x1d4e22){if(_0x41d6af[_0x2068('0x61')]['id']){delete _0x41d6af['body']['id'];}return db[_0x2068('0x3e')][_0x2068('0x5b')]({'where':{'id':_0x41d6af[_0x2068('0x58')]['id']},'include':[{'model':db[_0x2068('0x3c')],'as':_0x2068('0x3d')}]})['then'](handleEntityNotFound(_0x1d4e22,null))[_0x2068('0x1f')](saveUpdates(_0x41d6af[_0x2068('0x61')],null))[_0x2068('0x1f')](respondWithResult(_0x1d4e22,null))[_0x2068('0x29')](handleError(_0x1d4e22,null));};exports[_0x2068('0x37')]=function(_0x3fcdfa,_0x41674a){return db[_0x2068('0x3e')][_0x2068('0x5b')]({'where':{'id':_0x3fcdfa['params']['id']}})[_0x2068('0x1f')](handleEntityNotFound(_0x41674a,null))[_0x2068('0x1f')](removeEntity(_0x41674a,null))[_0x2068('0x29')](handleError(_0x41674a,null));};exports[_0x2068('0x62')]=function(_0x472de9,_0x1f196b){return db[_0x2068('0x3e')][_0x2068('0x62')]()[_0x2068('0x1f')](respondWithResult(_0x1f196b,null))[_0x2068('0x29')](handleError(_0x1f196b,null));};exports[_0x2068('0x63')]=function(_0x1a36c4,_0x53fef9,_0x537b1e){if(_0x1a36c4['body']['id']){delete _0x1a36c4[_0x2068('0x61')]['id'];}return db[_0x2068('0x3e')][_0x2068('0x5b')]({'where':{'id':_0x1a36c4['params']['id']}})[_0x2068('0x1f')](handleEntityNotFound(_0x53fef9,null))[_0x2068('0x1f')](function(_0x4cf28f){if(_0x4cf28f){_0x1a36c4['body'][_0x2068('0x64')]=_0x4cf28f['id'];return db[_0x2068('0x65')][_0x2068('0x5c')](_0x1a36c4[_0x2068('0x61')]);}})[_0x2068('0x1f')](respondWithResult(_0x53fef9,null))['catch'](handleError(_0x53fef9,null));};exports[_0x2068('0x66')]=function(_0x216684,_0xc59d4c,_0x2ac6eb){var _0x147d2d={'raw':![],'where':{}};var _0x3b1c92={};var _0x3c4fab={'count':0x0,'rows':[]};return db[_0x2068('0x3e')][_0x2068('0x67')]({'where':{'id':_0x216684[_0x2068('0x58')]['id']}})['then'](handleEntityNotFound(_0xc59d4c,null))[_0x2068('0x1f')](function(_0x29f472){if(_0x29f472){_0x3b1c92[_0x2068('0x43')]=_['keys'](db['Disposition'][_0x2068('0x3f')]);_0x3b1c92[_0x2068('0x45')]=_[_0x2068('0x46')](_0x216684['query']);_0x3b1c92['filters']=_['intersection'](_0x3b1c92[_0x2068('0x43')],_0x3b1c92[_0x2068('0x45')]);_0x147d2d[_0x2068('0x47')]=_[_0x2068('0x48')](_0x3b1c92['model'],qs[_0x2068('0x49')](_0x216684[_0x2068('0x45')][_0x2068('0x49')]));_0x147d2d[_0x2068('0x47')]=_0x147d2d[_0x2068('0x47')][_0x2068('0x4a')]?_0x147d2d[_0x2068('0x47')]:_0x3b1c92[_0x2068('0x43')];if(!_0x216684[_0x2068('0x45')][_0x2068('0x68')](_0x2068('0x4b'))){_0x147d2d[_0x2068('0x2f')]=qs[_0x2068('0x2f')](_0x216684[_0x2068('0x45')][_0x2068('0x2f')]);_0x147d2d['offset']=qs[_0x2068('0x2d')](_0x216684[_0x2068('0x45')]['offset']);}_0x147d2d[_0x2068('0x4c')]=qs[_0x2068('0x4d')](_0x216684['query'][_0x2068('0x4d')]);_0x147d2d[_0x2068('0x4e')]=qs['filters'](_[_0x2068('0x50')](_0x216684['query'],_0x3b1c92[_0x2068('0x4f')]));_0x147d2d[_0x2068('0x4e')][_0x2068('0x64')]=_0x29f472['id'];if(_0x216684[_0x2068('0x45')][_0x2068('0x51')]){_0x147d2d[_0x2068('0x4e')]=_[_0x2068('0x52')](_0x147d2d[_0x2068('0x4e')],{'$or':_[_0x2068('0x44')](_0x147d2d[_0x2068('0x47')],function(_0x10b143){var _0x4c730d={};_0x4c730d[_0x10b143]={'$like':'%'+_0x216684['query'][_0x2068('0x51')]+'%'};return _0x4c730d;})});}_0x147d2d=_[_0x2068('0x52')]({},_0x147d2d,_0x216684[_0x2068('0x5a')]);return db[_0x2068('0x65')][_0x2068('0x30')]({'where':_0x147d2d['where']})[_0x2068('0x1f')](function(_0x598148){_0x3c4fab[_0x2068('0x30')]=_0x598148;if(_0x216684[_0x2068('0x45')][_0x2068('0x59')]){_0x147d2d[_0x2068('0x54')]=[{'all':!![]}];}return db[_0x2068('0x65')][_0x2068('0x55')](_0x147d2d);})['then'](function(_0x268403){_0x3c4fab[_0x2068('0x56')]=_0x268403;return _0x3c4fab;});}})['then'](respondWithFilteredResult(_0xc59d4c,_0x147d2d))[_0x2068('0x29')](handleError(_0xc59d4c,null));};exports[_0x2068('0x69')]=function(_0x290e5b,_0x586175,_0x2f6824){return db[_0x2068('0x3e')][_0x2068('0x5b')]({'where':{'id':_0x290e5b[_0x2068('0x58')]['id']}})[_0x2068('0x1f')](handleEntityNotFound(_0x586175,null))[_0x2068('0x1f')](function(_0x180d68){if(_0x180d68){return _0x180d68['removeDispositions'](_0x290e5b[_0x2068('0x45')]['ids']);}})[_0x2068('0x1f')](respondWithStatusCode(_0x586175,null))['catch'](handleError(_0x586175,null));};exports[_0x2068('0x6a')]=function(_0x43a96b,_0x293924,_0x46132c){if(_0x43a96b['body']['id']){delete _0x43a96b[_0x2068('0x61')]['id'];}return db['FaxAccount'][_0x2068('0x5b')]({'where':{'id':_0x43a96b[_0x2068('0x58')]['id']}})['then'](handleEntityNotFound(_0x293924,null))[_0x2068('0x1f')](function(_0xd899ce){if(_0xd899ce){_0x43a96b[_0x2068('0x61')][_0x2068('0x64')]=_0xd899ce['id'];return db[_0x2068('0x6b')][_0x2068('0x5c')](_0x43a96b[_0x2068('0x61')]);}})['then'](respondWithResult(_0x293924,null))[_0x2068('0x29')](handleError(_0x293924,null));};exports[_0x2068('0x6c')]=function(_0x47bb0b,_0x76a1d4,_0x3ec74e){var _0x3a22ec={'raw':![],'where':{}};var _0x369b0a={};var _0x1463ab={'count':0x0,'rows':[]};return db[_0x2068('0x3e')][_0x2068('0x67')]({'where':{'id':_0x47bb0b[_0x2068('0x58')]['id']}})[_0x2068('0x1f')](handleEntityNotFound(_0x76a1d4,null))[_0x2068('0x1f')](function(_0xe7a96e){if(_0xe7a96e){_0x369b0a[_0x2068('0x43')]=_[_0x2068('0x46')](db[_0x2068('0x6b')][_0x2068('0x3f')]);_0x369b0a[_0x2068('0x45')]=_[_0x2068('0x46')](_0x47bb0b[_0x2068('0x45')]);_0x369b0a['filters']=_[_0x2068('0x48')](_0x369b0a[_0x2068('0x43')],_0x369b0a[_0x2068('0x45')]);_0x3a22ec['attributes']=_['intersection'](_0x369b0a[_0x2068('0x43')],qs[_0x2068('0x49')](_0x47bb0b[_0x2068('0x45')][_0x2068('0x49')]));_0x3a22ec[_0x2068('0x47')]=_0x3a22ec['attributes']['length']?_0x3a22ec['attributes']:_0x369b0a[_0x2068('0x43')];if(!_0x47bb0b[_0x2068('0x45')][_0x2068('0x68')](_0x2068('0x4b'))){_0x3a22ec[_0x2068('0x2f')]=qs[_0x2068('0x2f')](_0x47bb0b[_0x2068('0x45')][_0x2068('0x2f')]);_0x3a22ec['offset']=qs['offset'](_0x47bb0b['query'][_0x2068('0x2d')]);}_0x3a22ec[_0x2068('0x4c')]=qs[_0x2068('0x4d')](_0x47bb0b[_0x2068('0x45')]['sort']);_0x3a22ec[_0x2068('0x4e')]=qs[_0x2068('0x4f')](_[_0x2068('0x50')](_0x47bb0b[_0x2068('0x45')],_0x369b0a[_0x2068('0x4f')]));_0x3a22ec[_0x2068('0x4e')][_0x2068('0x64')]=_0xe7a96e['id'];if(_0x47bb0b['query'][_0x2068('0x51')]){_0x3a22ec['where']=_['merge'](_0x3a22ec[_0x2068('0x4e')],{'$or':_[_0x2068('0x44')](_0x3a22ec[_0x2068('0x47')],function(_0x17446e){var _0x47c33c={};_0x47c33c[_0x17446e]={'$like':'%'+_0x47bb0b[_0x2068('0x45')][_0x2068('0x51')]+'%'};return _0x47c33c;})});}_0x3a22ec=_[_0x2068('0x52')]({},_0x3a22ec,_0x47bb0b[_0x2068('0x5a')]);return db['CannedAnswer'][_0x2068('0x30')]({'where':_0x3a22ec['where']})['then'](function(_0xc4b99f){_0x1463ab['count']=_0xc4b99f;if(_0x47bb0b[_0x2068('0x45')][_0x2068('0x59')]){_0x3a22ec[_0x2068('0x54')]=[{'all':!![]}];}return db[_0x2068('0x6b')][_0x2068('0x55')](_0x3a22ec);})[_0x2068('0x1f')](function(_0x5955fe){_0x1463ab[_0x2068('0x56')]=_0x5955fe;return _0x1463ab;});}})[_0x2068('0x1f')](respondWithFilteredResult(_0x76a1d4,_0x3a22ec))['catch'](handleError(_0x76a1d4,null));};exports[_0x2068('0x6d')]=function(_0xf8bee9,_0x3aebf3,_0x54e855){return db[_0x2068('0x3e')]['find']({'where':{'id':_0xf8bee9['params']['id']}})[_0x2068('0x1f')](handleEntityNotFound(_0x3aebf3,null))[_0x2068('0x1f')](function(_0x557195){if(_0x557195){return _0x557195[_0x2068('0x6d')](_0xf8bee9[_0x2068('0x45')]['ids']);}})[_0x2068('0x1f')](respondWithStatusCode(_0x3aebf3,null))[_0x2068('0x29')](handleError(_0x3aebf3,null));};exports[_0x2068('0x6e')]=function(_0x318bb0,_0x5642b9,_0xc7b53a){return db['FaxInteraction'][_0x2068('0x5b')]({'where':{'id':_0x318bb0['params']['id']}})[_0x2068('0x1f')](handleEntityNotFound(_0x5642b9,null))[_0x2068('0x1f')](function(_0x1cf7b9){if(_0x1cf7b9){return _0x1cf7b9['addInteraction'](_0x318bb0[_0x2068('0x61')]['ids'],_[_0x2068('0x6f')](_0x318bb0[_0x2068('0x61')],[_0x2068('0x70'),'id'])||{});}})['then'](respondWithResult(_0x5642b9,null))[_0x2068('0x29')](handleError(_0x5642b9,null));};exports['getInteractions']=function(_0x4ca791,_0x521456,_0x3eed66){var _0x22ec13={'raw':![],'where':{}};var _0x104ed9={};var _0x5799a3={'count':0x0,'rows':[]};return db[_0x2068('0x3e')]['findOne']({'where':{'id':_0x4ca791[_0x2068('0x58')]['id']}})['then'](handleEntityNotFound(_0x521456,null))[_0x2068('0x1f')](function(_0xc9eab3){if(_0xc9eab3){_0x104ed9['model']=_[_0x2068('0x46')](db[_0x2068('0x71')][_0x2068('0x3f')]);_0x104ed9[_0x2068('0x45')]=_[_0x2068('0x46')](_0x4ca791[_0x2068('0x45')]);_0x104ed9['filters']=_['intersection'](_0x104ed9['model'],_0x104ed9['query']);_0x22ec13[_0x2068('0x47')]=_['intersection'](_0x104ed9[_0x2068('0x43')],qs['fields'](_0x4ca791['query'][_0x2068('0x49')]));_0x22ec13[_0x2068('0x47')]=_0x22ec13['attributes']['length']?_0x22ec13['attributes']:_0x104ed9[_0x2068('0x43')];if(!_0x4ca791[_0x2068('0x45')][_0x2068('0x68')](_0x2068('0x4b'))){_0x22ec13[_0x2068('0x2f')]=qs['limit'](_0x4ca791[_0x2068('0x45')][_0x2068('0x2f')]);_0x22ec13[_0x2068('0x2d')]=qs[_0x2068('0x2d')](_0x4ca791[_0x2068('0x45')][_0x2068('0x2d')]);}_0x22ec13[_0x2068('0x4c')]=qs['sort'](_0x4ca791['query'][_0x2068('0x4d')]);_0x22ec13[_0x2068('0x4e')]=qs['filters'](_[_0x2068('0x50')](_0x4ca791[_0x2068('0x45')],_0x104ed9[_0x2068('0x4f')]));_0x22ec13[_0x2068('0x4e')][_0x2068('0x64')]=_0xc9eab3['id'];if(_0x4ca791[_0x2068('0x45')][_0x2068('0x51')]){_0x22ec13['where']=_[_0x2068('0x52')](_0x22ec13[_0x2068('0x4e')],{'$or':_[_0x2068('0x44')](_0x22ec13[_0x2068('0x47')],function(_0x1eb688){var _0x4ecd40={};_0x4ecd40[_0x1eb688]={'$like':'%'+_0x4ca791[_0x2068('0x45')][_0x2068('0x51')]+'%'};return _0x4ecd40;})});}_0x22ec13=_[_0x2068('0x52')]({},_0x22ec13,_0x4ca791[_0x2068('0x5a')]);return db[_0x2068('0x71')][_0x2068('0x30')]({'where':_0x22ec13['where']})[_0x2068('0x1f')](function(_0x222bc6){_0x5799a3[_0x2068('0x30')]=_0x222bc6;if(_0x4ca791[_0x2068('0x45')][_0x2068('0x59')]){_0x22ec13[_0x2068('0x54')]=[{'model':db[_0x2068('0x72')],'as':'Contact','required':![]},{'model':db[_0x2068('0x73')],'as':'Owner','attributes':[_0x2068('0x39'),'fullname',_0x2068('0x74')],'required':![]},{'model':db[_0x2068('0x75')],'as':'Tags','attributes':['id','name',_0x2068('0x76')],'where':_0x4ca791[_0x2068('0x45')][_0x2068('0x77')]?{'id':_0x4ca791['query'][_0x2068('0x77')]}:undefined,'required':_0x4ca791[_0x2068('0x45')][_0x2068('0x77')]?!![]:![]}];}return db[_0x2068('0x71')][_0x2068('0x55')](_0x22ec13);})[_0x2068('0x1f')](function(_0x318d9e){_0x5799a3[_0x2068('0x56')]=_0x318d9e;return _0x5799a3;});}})['then'](respondWithFilteredResult(_0x521456,_0x22ec13))[_0x2068('0x29')](handleError(_0x521456,null));};exports['addApplications']=function(_0x28ed4b,_0x42cf1e){var _0x3b5cbd=_0x28ed4b[_0x2068('0x58')]['id'];var _0xe29fe1=_0x28ed4b['body'];var _0x5da2db=0xc8;var _0x1dd51d=null;return db[_0x2068('0x78')][_0x2068('0x79')]({'isolationLevel':db[_0x2068('0x78')][_0x2068('0x7a')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x183740){return db[_0x2068('0x3e')][_0x2068('0x67')]({'where':{'id':_0x3b5cbd},'transaction':_0x183740})[_0x2068('0x1f')](function(_0x35ecfe){if(_0x35ecfe){return db[_0x2068('0x7b')][_0x2068('0x37')]({'where':{'FaxAccountId':_0x3b5cbd},'transaction':_0x183740})[_0x2068('0x1f')](function(){var _0x518df9=_[_0x2068('0x44')](_0xe29fe1,function(_0xc203da){_0xc203da['FaxAccountId']=_0x3b5cbd;return _0xc203da;});return db[_0x2068('0x7b')][_0x2068('0x7c')](_0x518df9,{'transaction':_0x183740});});}else{_0x5da2db=0x194;_0x1dd51d=[];}});})[_0x2068('0x1f')](function(){if(_0x5da2db!==0x194){return db['FaxApplication'][_0x2068('0x7d')]({'where':{'FaxAccountId':_0x3b5cbd},'order':_0x2068('0x7e')})[_0x2068('0x1f')](function(_0x23ec2f){_0x1dd51d=_0x23ec2f;});}})['catch'](function(_0x445ca8){_0x5da2db=0x1f4;logger[_0x2068('0x25')](_0x445ca8[_0x2068('0x38')]);if(_0x445ca8[_0x2068('0x39')]){delete _0x445ca8[_0x2068('0x39')];}_0x1dd51d=_0x445ca8;})['finally'](function(){if(_0x1dd51d===null){_0x42cf1e[_0x2068('0x2a')](_0x5da2db);}else{if(_0x5da2db===0x1f4){_0x42cf1e['status'](_0x5da2db)['send'](_0x1dd51d);}else{_0x42cf1e['status'](_0x5da2db)[_0x2068('0x7f')](_0x1dd51d);}}});};exports[_0x2068('0x80')]=function(_0x56e0ea,_0x3d7ed9,_0x16f474){var _0xf9f49c={};var _0x1e089d={};var _0x5ce04b;var _0x4335a3;return db['FaxAccount']['findOne']({'where':{'id':_0x56e0ea['params']['id']}})[_0x2068('0x1f')](handleEntityNotFound(_0x3d7ed9,null))[_0x2068('0x1f')](function(_0x77c1b7){if(_0x77c1b7){_0x5ce04b=_0x77c1b7;_0x1e089d[_0x2068('0x43')]=_[_0x2068('0x46')](db[_0x2068('0x7b')]['rawAttributes']);_0x1e089d[_0x2068('0x45')]=_[_0x2068('0x46')](_0x56e0ea['query']);_0x1e089d[_0x2068('0x4f')]=_[_0x2068('0x48')](_0x1e089d[_0x2068('0x43')],_0x1e089d[_0x2068('0x45')]);_0xf9f49c[_0x2068('0x47')]=_[_0x2068('0x48')](_0x1e089d[_0x2068('0x43')],qs[_0x2068('0x49')](_0x56e0ea[_0x2068('0x45')][_0x2068('0x49')]));_0xf9f49c[_0x2068('0x47')]=_0xf9f49c[_0x2068('0x47')][_0x2068('0x4a')]?_0xf9f49c[_0x2068('0x47')]:_0x1e089d[_0x2068('0x43')];_0xf9f49c['order']=qs[_0x2068('0x4d')](_0x56e0ea[_0x2068('0x45')][_0x2068('0x4d')]);_0xf9f49c[_0x2068('0x4e')]=qs[_0x2068('0x4f')](_[_0x2068('0x50')](_0x56e0ea['query'],_0x1e089d[_0x2068('0x4f')]));if(_0x56e0ea[_0x2068('0x45')][_0x2068('0x51')]){_0xf9f49c['where']=_[_0x2068('0x52')](_0xf9f49c[_0x2068('0x4e')],{'$or':_['map'](_0xf9f49c[_0x2068('0x47')],function(_0x40187e){var _0x29a5f4={};_0x29a5f4[_0x40187e]={'$like':'%'+_0x56e0ea[_0x2068('0x45')][_0x2068('0x51')]+'%'};return _0x29a5f4;})});}_0xf9f49c=_[_0x2068('0x52')]({},_0xf9f49c,_0x56e0ea[_0x2068('0x5a')]);return _0x5ce04b['getApplications'](_0xf9f49c);}})[_0x2068('0x1f')](function(_0x3a2163){if(_0x3a2163){_0x4335a3=_0x3a2163[_0x2068('0x4a')];if(!_0x56e0ea['query'][_0x2068('0x68')]('nolimit')){_0xf9f49c[_0x2068('0x2f')]=qs['limit'](_0x56e0ea[_0x2068('0x45')][_0x2068('0x2f')]);_0xf9f49c[_0x2068('0x2d')]=qs[_0x2068('0x2d')](_0x56e0ea[_0x2068('0x45')][_0x2068('0x2d')]);}return _0x5ce04b[_0x2068('0x80')](_0xf9f49c);}})[_0x2068('0x1f')](function(_0x2c20cf){if(_0x2c20cf){return _0x2c20cf?{'count':_0x4335a3,'rows':_0x2c20cf}:null;}})['then'](respondWithResult(_0x3d7ed9,null))[_0x2068('0x29')](handleError(_0x3d7ed9,null));};function Extension(_0x5d1814,_0x2f3966,_0xbf8651,_0xdfbdbc){this['context']=_0x2068('0x81');this[_0x2068('0x82')]=_0x5d1814[_0x2068('0x83')];this[_0x2068('0x84')]=_0xdfbdbc;this[_0x2068('0x41')]='system';this[_0x2068('0x85')]=_0x2068('0x86');this[_0x2068('0x64')]=_0x5d1814['id'];this[_0x2068('0x7e')]=_0x2f3966;this[_0x2068('0x87')]=_0xbf8651;}function createExtensionsReciveFax(_0x2808c9){var _0x81af7e=0x1;var _0x2fe9ba=[];_0x2fe9ba[_0x2068('0x88')](new Extension(_0x2808c9,_0x81af7e,'',_0x2068('0x89')));_0x81af7e+=0x1;_0x2fe9ba[_0x2068('0x88')](new Extension(_0x2808c9,_0x81af7e,_0x2068('0x8a'),_0x2068('0x8b')));_0x81af7e+=0x1;for(var _0x284bf7 in _0x2808c9){if(_0x2808c9[_0x2068('0x68')](_0x284bf7)&&(_0x284bf7==='ecm'||_0x284bf7===_0x2068('0x83')||_0x284bf7===_0x2068('0x8c')||_0x284bf7==='faxdetect'||_0x284bf7===_0x2068('0x8d')||_0x284bf7==='maxrate'||_0x284bf7===_0x2068('0x8e')||_0x284bf7===_0x2068('0x8f')||_0x284bf7==='t38timeout')){_0x2fe9ba['push'](new Extension(_0x2808c9,_0x81af7e,_0x2068('0x90')+_0x284bf7+')='+_0x2808c9[_0x284bf7],'Set'));_0x81af7e+=0x1;}}_0x2fe9ba['push'](new Extension(_0x2808c9,_0x81af7e,'6',_0x2068('0x91')));_0x81af7e+=0x1;_0x2fe9ba[_0x2068('0x88')](new Extension(_0x2808c9,_0x81af7e,'/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'));_0x81af7e=0x0;return _0x2fe9ba;}exports[_0x2068('0x92')]=function(_0x445211,_0x32d994,_0x407818){var _0x1b27cf;return db['sequelize'][_0x2068('0x79')](function(_0x936c6f){return db['FaxAccount'][_0x2068('0x5c')](_0x445211[_0x2068('0x61')],{'transaction':_0x936c6f})[_0x2068('0x1f')](function(_0x221841){_0x1b27cf=_0x221841['get']({'plain':!![]});return db[_0x2068('0x93')][_0x2068('0x7c')](createExtensionsReciveFax(_0x1b27cf),{'transaction':_0x936c6f});});})['then'](function(){return _0x1b27cf;})[_0x2068('0x1f')](respondWithResult(_0x32d994,null))['catch'](handleError(_0x32d994,null));};exports[_0x2068('0x94')]=function(_0x889ec9,_0x32fce8,_0x2461ed){var _0x37c71b;return db[_0x2068('0x78')][_0x2068('0x79')](function(_0xff31e8){return db[_0x2068('0x3e')][_0x2068('0x34')](_0x889ec9[_0x2068('0x61')],{'where':{'id':_0x889ec9['body']['id']},'transaction':_0xff31e8})[_0x2068('0x1f')](function(_0x77cf09){return db[_0x2068('0x93')][_0x2068('0x37')]({'where':{'FaxAccountId':_0x889ec9[_0x2068('0x61')]['id']},'transaction':_0xff31e8})[_0x2068('0x1f')](function(_0x35a25c){return db[_0x2068('0x93')][_0x2068('0x7c')](createExtensionsReciveFax(_[_0x2068('0x6f')](_0x889ec9[_0x2068('0x61')],[_0x2068('0x95'),_0x2068('0x42'),'createdAt',_0x2068('0x96'),_0x2068('0x97'),_0x2068('0x98')])),{'transaction':_0xff31e8});});});})[_0x2068('0x1f')](function(){return db[_0x2068('0x3e')][_0x2068('0x99')](_0x889ec9[_0x2068('0x61')]['id']);})[_0x2068('0x1f')](respondWithResult(_0x32fce8,null))[_0x2068('0x29')](handleError(_0x32fce8,null));};exports['getMessages']=function(_0x5d478a,_0x581510,_0x3bb817){var _0x23c9b8={'raw':!![],'where':{}};var _0xee20cc={};var _0x1e0c55={'count':0x0,'rows':[]};return db['FaxAccount'][_0x2068('0x67')]({'where':{'id':_0x5d478a[_0x2068('0x58')]['id']}})[_0x2068('0x1f')](handleEntityNotFound(_0x581510,null))[_0x2068('0x1f')](function(_0x4c5852){if(_0x4c5852){_0xee20cc[_0x2068('0x43')]=_['keys'](db['FaxMessage'][_0x2068('0x3f')]);_0xee20cc['query']=_[_0x2068('0x46')](_0x5d478a['query']);_0xee20cc[_0x2068('0x4f')]=_['intersection'](_0xee20cc['model'],_0xee20cc[_0x2068('0x45')]);_0x23c9b8['attributes']=_[_0x2068('0x48')](_0xee20cc['model'],qs['fields'](_0x5d478a[_0x2068('0x45')][_0x2068('0x49')]));_0x23c9b8[_0x2068('0x47')]=_0x23c9b8[_0x2068('0x47')][_0x2068('0x4a')]?_0x23c9b8[_0x2068('0x47')]:_0xee20cc[_0x2068('0x43')];if(!_0x5d478a[_0x2068('0x45')][_0x2068('0x68')](_0x2068('0x4b'))){_0x23c9b8[_0x2068('0x2f')]=qs[_0x2068('0x2f')](_0x5d478a[_0x2068('0x45')][_0x2068('0x2f')]);_0x23c9b8['offset']=qs[_0x2068('0x2d')](_0x5d478a[_0x2068('0x45')]['offset']);}_0x23c9b8['order']=qs[_0x2068('0x4d')](_0x5d478a[_0x2068('0x45')][_0x2068('0x4d')]);_0x23c9b8[_0x2068('0x4e')]=qs[_0x2068('0x4f')](_['pick'](_0x5d478a[_0x2068('0x45')],_0xee20cc['filters']));_0x23c9b8['where'][_0x2068('0x64')]=_0x4c5852['id'];if(_0x5d478a['query'][_0x2068('0x51')]){_0x23c9b8['where']=_[_0x2068('0x52')](_0x23c9b8[_0x2068('0x4e')],{'$or':_[_0x2068('0x44')](_0x23c9b8[_0x2068('0x47')],function(_0x400e8b){var _0x1e54c1={};_0x1e54c1[_0x400e8b]={'$like':'%'+_0x5d478a[_0x2068('0x45')]['filter']+'%'};return _0x1e54c1;})});}if(_0x5d478a[_0x2068('0x45')]['$gte']){var _0x5181fe=_0x5d478a[_0x2068('0x45')][_0x2068('0x9a')][_0x2068('0x9b')](',');var _0x47410d={};_0x47410d[_0x5181fe[0x0]]={'$gte':moment(_0x5181fe[0x1])[_0x2068('0x9c')](_0x2068('0x9d'))};_0x23c9b8[_0x2068('0x4e')]=_['merge'](_0x23c9b8[_0x2068('0x4e')],_0x47410d);}_0x23c9b8=_[_0x2068('0x52')]({},_0x23c9b8,_0x5d478a['options']);return db[_0x2068('0x9e')][_0x2068('0x30')]({'where':_0x23c9b8['where']})[_0x2068('0x1f')](function(_0x518f7a){_0x1e0c55[_0x2068('0x30')]=_0x518f7a;if(_0x5d478a[_0x2068('0x45')]['includeAll']){_0x23c9b8[_0x2068('0x54')]=[{'all':!![]}];}return db[_0x2068('0x9e')][_0x2068('0x55')](_0x23c9b8);})['then'](function(_0x4a494a){_0x1e0c55['rows']=_0x4a494a;return _0x1e0c55;});}})[_0x2068('0x1f')](respondWithFilteredResult(_0x581510,_0x23c9b8))[_0x2068('0x29')](handleError(_0x581510,null));};exports['send']=function(_0xdf45d4,_0xa8b3cf,_0x3f283c){var _0x570eb1,_0x37edfc={},_0x40a646;if(_0xdf45d4[_0x2068('0x61')]['to']){_0x40a646=_0xdf45d4[_0x2068('0x61')]['to'][0x0];}return db['FaxAccount'][_0x2068('0x5b')]({'where':{'id':_0xdf45d4[_0x2068('0x58')]['id']},'include':[{'model':db[_0x2068('0x9f')],'as':_0x2068('0xa0'),'include':[{'model':db[_0x2068('0x72')],'as':'Contacts','where':{'fax':_0x40a646},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x2068('0x1f')](handleEntityNotFound(_0xa8b3cf,null))[_0x2068('0x1f')](function(_0x936bc5){_0x570eb1=_0x936bc5;if(_0xdf45d4[_0x2068('0x61')]['attachments']&&_0xdf45d4[_0x2068('0x61')][_0x2068('0xa1')][_0x2068('0x4a')]){for(var _0x44adae=0x0;_0x44adae<_0xdf45d4[_0x2068('0x61')][_0x2068('0xa1')][_0x2068('0x4a')];_0x44adae+=0x1){_0xdf45d4[_0x2068('0x61')]['attachments'][_0x44adae]={'filename':_0xdf45d4[_0x2068('0x61')][_0x2068('0xa1')][_0x44adae][_0x2068('0x39')],'id':_0xdf45d4[_0x2068('0x61')]['attachments'][_0x44adae]['id'],'path':path[_0x2068('0xa2')](config[_0x2068('0xa3')],'server/files/attachments',_0xdf45d4[_0x2068('0x61')][_0x2068('0xa1')][_0x44adae][_0x2068('0xa4')])};}}return respondWithRpcPromise(_0x2068('0xa5'),_0x2068('0xa5'),{'FaxAccountId':_['isNil'](_0xdf45d4[_0x2068('0x58')]['id'])?undefined:_0xdf45d4['params']['id'],'path':_[_0x2068('0xa6')](_0xdf45d4['body']['attachments'][0x0][_0x2068('0x8')])?undefined:_0xdf45d4['body']['attachments'][0x0][_0x2068('0x8')],'fax':_[_0x2068('0xa6')](_0xdf45d4[_0x2068('0x61')]['to'][0x0])?undefined:_0xdf45d4[_0x2068('0x61')]['to'][0x0]},client9002);})[_0x2068('0x1f')](function(){if(_0x570eb1){if(_['isNil'](_0xdf45d4[_0x2068('0x61')]['from'])){_0xdf45d4[_0x2068('0x61')][_0x2068('0xa7')]=util[_0x2068('0x9c')](_0x2068('0xa8'),_0x570eb1[_0x2068('0x39')],_0x570eb1[_0x2068('0xa9')]);}if(_0x570eb1['List']){if(_0x570eb1[_0x2068('0xa0')]['Contacts'][_0x2068('0x4a')]){return _0x570eb1[_0x2068('0xa0')][_0x2068('0xaa')][0x0];}else{return db['CmContact']['create'](_['defaults'](_0xdf45d4[_0x2068('0x61')],{'firstName':_0xdf45d4['body']['to'][0x0],'phone':_0xdf45d4[_0x2068('0x61')]['to'][0x0],'fax':_0xdf45d4[_0x2068('0x61')]['to'][0x0],'ListId':_0x570eb1[_0x2068('0x98')]}));}}else{throw new Error(_0x2068('0xab'));}}else{throw new Error(_0x2068('0xac'));}})[_0x2068('0x1f')](function(_0x316b65){if(_0x316b65){return db[_0x2068('0x71')][_0x2068('0x5b')]({'where':{'ContactId':_0x316b65['id'],'closed':![],'FaxAccountId':_0x570eb1['id']}})[_0x2068('0x1f')](function(_0x266b22){if(_0x266b22){return[_0x266b22,![]];}return db[_0x2068('0x71')][_0x2068('0x5c')]({'UserId':_0xdf45d4['user']['id'],'ContactId':_0x316b65['id'],'FaxAccountId':_0x570eb1['id'],'fax':_0xdf45d4[_0x2068('0x61')]['to'][0x0],'firstMsgDirection':_0x2068('0xad'),'Messages':[_[_0x2068('0x52')](_0xdf45d4[_0x2068('0x61')],{'read':![],'body':_0xdf45d4[_0x2068('0x61')][_0x2068('0xa1')][0x0][_0x2068('0xae')],'FaxAccountId':_0x570eb1['id'],'UserId':_0xdf45d4['user']['id'],'ContactId':_0x316b65['id'],'AttachmentId':_0xdf45d4['body']['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x2068('0xaf')}]})[_0x2068('0x1f')](function(_0x48d83c){return[_0x48d83c,!![]];});});}else{throw new Error(_0x2068('0xb0'));}})[_0x2068('0xb1')](function(_0x394c82,_0x1814fc){if(_0x1814fc){return _0x394c82;}return db['FaxMessage'][_0x2068('0x5c')]({'direction':_0x2068('0xad'),'read':![],'body':_0xdf45d4[_0x2068('0x61')][_0x2068('0xa1')][0x0]['filename'],'FaxAccountId':_0x570eb1['id'],'FaxInteractionId':_0x394c82['id'],'UserId':_0xdf45d4['user']['id'],'ContactId':_0x394c82[_0x2068('0xb2')],'AttachmentId':_0xdf45d4['body'][_0x2068('0xa1')][0x0]['id']})[_0x2068('0x1f')](function(_0x3a0e8e){_0x394c82[_0x2068('0xb3')]['Messages']=[];_0x394c82['dataValues'][_0x2068('0xaf')][_0x2068('0x88')](_0x3a0e8e[_0x2068('0xb3')]);return _0x394c82;});})[_0x2068('0x1f')](function(_0x3f74fc){respondWithRpcPromise('SendFax',_0x2068('0xb4'),{'FaxAccountId':_[_0x2068('0xa6')](_0xdf45d4['params']['id'])?undefined:_0xdf45d4['params']['id'],'path':_[_0x2068('0xa6')](_0xdf45d4['body'][_0x2068('0xa1')][0x0][_0x2068('0x8')])?undefined:_0xdf45d4[_0x2068('0x61')]['attachments'][0x0][_0x2068('0x8')],'fax':_[_0x2068('0xa6')](_0xdf45d4[_0x2068('0x61')]['to'][0x0])?undefined:_0xdf45d4['body']['to'][0x0],'AttachmentId':_0xdf45d4[_0x2068('0x61')][_0x2068('0xa1')][0x0]['id']},client9002)[_0x2068('0x1f')](function(_0x1c8fee){logger['info'](_0x2068('0xb5'),_0x1c8fee);})[_0x2068('0x29')](function(_0x386cf0){logger[_0x2068('0x20')](_0x2068('0xb5'),_0x386cf0);});return _0x3f74fc;})[_0x2068('0x1f')](respondWithResult(_0xa8b3cf,null))[_0x2068('0x29')](handleError(_0xa8b3cf,null));};exports[_0x2068('0xb6')]=function(_0xa96ac6,_0x3b626b,_0x180871){return db[_0x2068('0x3e')]['find']({'where':{'id':_0xa96ac6[_0x2068('0x58')]['id']}})[_0x2068('0x1f')](handleEntityNotFound(_0x3b626b,null))[_0x2068('0x1f')](function(_0x3b499c){if(_0x3b499c){return _0x3b499c[_0x2068('0xb6')](_0xa96ac6[_0x2068('0x61')][_0x2068('0x70')],_[_0x2068('0x6f')](_0xa96ac6[_0x2068('0x61')],['ids','id'])||{})[_0x2068('0xb1')](function(_0x400e9c){for(var _0xbb244c=0x0;_0xbb244c<_0xa96ac6[_0x2068('0x61')][_0x2068('0x70')]['length'];_0xbb244c+=0x1){socket[_0x2068('0xb7')](_0x2068('0xb8'),{'UserId':Number(_0xa96ac6[_0x2068('0x61')]['ids'][_0xbb244c]),'FaxAccountId':Number(_0xa96ac6[_0x2068('0x58')]['id'])});}return _0x400e9c;});}})[_0x2068('0x1f')](respondWithResult(_0x3b626b,null))[_0x2068('0x29')](handleError(_0x3b626b,null));};exports[_0x2068('0xb9')]=function(_0x4ec287,_0x117fd6,_0x30f12a){return db['FaxAccount']['find']({'where':{'id':_0x4ec287[_0x2068('0x58')]['id']}})[_0x2068('0x1f')](handleEntityNotFound(_0x117fd6,null))['then'](function(_0x1fb033){if(_0x1fb033){return _0x1fb033[_0x2068('0xb9')](_0x4ec287['query'][_0x2068('0x70')])[_0x2068('0x1f')](function(){if(_[_0x2068('0xba')](_0x4ec287['query'][_0x2068('0x70')])){for(var _0x23c2d8=0x0;_0x23c2d8<_0x4ec287[_0x2068('0x45')]['ids'][_0x2068('0x4a')];_0x23c2d8+=0x1){socket[_0x2068('0xb7')]('userFaxAccount:remove',{'UserId':Number(_0x4ec287[_0x2068('0x45')]['ids'][_0x23c2d8]),'FaxAccountId':Number(_0x4ec287['params']['id'])});}}else{socket[_0x2068('0xb7')](_0x2068('0xbb'),{'UserId':Number(_0x4ec287['query'][_0x2068('0x70')]),'FaxAccountId':Number(_0x4ec287['params']['id'])});}});}})[_0x2068('0x1f')](respondWithStatusCode(_0x117fd6,null))[_0x2068('0x29')](handleError(_0x117fd6,null));};exports[_0x2068('0xbc')]=function(_0x47ccd8,_0x191c11,_0x9dab59){var _0x347693={};var _0x432524={};var _0x2f547d;var _0x8836d6;return db['FaxAccount']['findOne']({'where':{'id':_0x47ccd8[_0x2068('0x58')]['id']}})[_0x2068('0x1f')](handleEntityNotFound(_0x191c11,null))['then'](function(_0x28b4f1){if(_0x28b4f1){_0x2f547d=_0x28b4f1;_0x432524['model']=_[_0x2068('0x46')](db[_0x2068('0x73')]['rawAttributes']);_0x432524[_0x2068('0x45')]=_[_0x2068('0x46')](_0x47ccd8['query']);_0x432524[_0x2068('0x4f')]=_[_0x2068('0x48')](_0x432524[_0x2068('0x43')],_0x432524[_0x2068('0x45')]);_0x347693[_0x2068('0x47')]=_[_0x2068('0x48')](_0x432524[_0x2068('0x43')],qs[_0x2068('0x49')](_0x47ccd8['query']['fields']));_0x347693[_0x2068('0x47')]=_0x347693[_0x2068('0x47')][_0x2068('0x4a')]?_0x347693[_0x2068('0x47')]:_0x432524[_0x2068('0x43')];_0x347693[_0x2068('0x4c')]=qs[_0x2068('0x4d')](_0x47ccd8[_0x2068('0x45')][_0x2068('0x4d')]);_0x347693[_0x2068('0x4e')]=qs[_0x2068('0x4f')](_[_0x2068('0x50')](_0x47ccd8[_0x2068('0x45')],_0x432524[_0x2068('0x4f')]));if(_0x47ccd8['query'][_0x2068('0x51')]){_0x347693[_0x2068('0x4e')]=_[_0x2068('0x52')](_0x347693[_0x2068('0x4e')],{'$or':_[_0x2068('0x44')](_0x347693[_0x2068('0x47')],function(_0x3b3a98){var _0x38ff19={};_0x38ff19[_0x3b3a98]={'$like':'%'+_0x47ccd8['query'][_0x2068('0x51')]+'%'};return _0x38ff19;})});}_0x347693=_[_0x2068('0x52')]({},_0x347693,_0x47ccd8[_0x2068('0x5a')]);return _0x2f547d['getAgents'](_0x347693);}})[_0x2068('0x1f')](function(_0x5e7ee6){if(_0x5e7ee6){_0x8836d6=_0x5e7ee6['length'];if(!_0x47ccd8[_0x2068('0x45')][_0x2068('0x68')]('nolimit')){_0x347693[_0x2068('0x2f')]=qs[_0x2068('0x2f')](_0x47ccd8[_0x2068('0x45')][_0x2068('0x2f')]);_0x347693[_0x2068('0x2d')]=qs['offset'](_0x47ccd8['query'][_0x2068('0x2d')]);}return _0x2f547d[_0x2068('0xbc')](_0x347693);}})['then'](function(_0x3890a8){if(_0x3890a8){return _0x3890a8?{'count':_0x8836d6,'rows':_0x3890a8}:null;}})[_0x2068('0x1f')](respondWithResult(_0x191c11,null))[_0x2068('0x29')](handleError(_0x191c11,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 3be8697..bfaa6f9 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 _0x71a0=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x537f79,_0x139d0d){var _0x56c812=function(_0x4ae9ef){while(--_0x4ae9ef){_0x537f79['push'](_0x537f79['shift']());}};_0x56c812(++_0x139d0d);}(_0x71a0,0xba));var _0x071a=function(_0x1eb231,_0x516a97){_0x1eb231=_0x1eb231-0x0;var _0x33468b=_0x71a0[_0x1eb231];return _0x33468b;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x071a('0x0'))['db'][_0x071a('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x071a('0x2')](0x0);var events={'afterCreate':_0x071a('0x3'),'afterUpdate':_0x071a('0x4'),'afterDestroy':_0x071a('0x5')};function emitEvent(_0x573951){return function(_0x22c8f3,_0x1dae09,_0x5153f8){FaxAccountEvents[_0x071a('0x6')](_0x573951+':'+_0x22c8f3['id'],_0x22c8f3);FaxAccountEvents[_0x071a('0x6')](_0x573951,_0x22c8f3);_0x5153f8(null);};}for(var e in events){if(events[_0x071a('0x7')](e)){var event=events[e];FaxAccount[_0x071a('0x8')](e,emitEvent(event));}}module[_0x071a('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x5e63=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxAccount','save'];(function(_0x2fc439,_0x2c8497){var _0x1e94d1=function(_0x5bb6e1){while(--_0x5bb6e1){_0x2fc439['push'](_0x2fc439['shift']());}};_0x1e94d1(++_0x2c8497);}(_0x5e63,0xb4));var _0x35e6=function(_0x134c2e,_0x1704d3){_0x134c2e=_0x134c2e-0x0;var _0x317bbe=_0x5e63[_0x134c2e];return _0x317bbe;};'use strict';var EventEmitter=require(_0x35e6('0x0'));var FaxAccount=require(_0x35e6('0x1'))['db'][_0x35e6('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x35e6('0x3'),'afterUpdate':'update','afterDestroy':_0x35e6('0x4')};function emitEvent(_0x195140){return function(_0x11992a,_0x134e47,_0x33af4b){FaxAccountEvents[_0x35e6('0x5')](_0x195140+':'+_0x11992a['id'],_0x11992a);FaxAccountEvents[_0x35e6('0x5')](_0x195140,_0x11992a);_0x33af4b(null);};}for(var e in events){if(events[_0x35e6('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x35e6('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index ac7c535..c6e6fea 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 _0xbf48=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts'];(function(_0x47e4a8,_0x2f67eb){var _0x4f4c9a=function(_0x6d3834){while(--_0x6d3834){_0x47e4a8['push'](_0x47e4a8['shift']());}};_0x4f4c9a(++_0x2f67eb);}(_0xbf48,0xee));var _0x8bf4=function(_0x1712e8,_0x100edd){_0x1712e8=_0x1712e8-0x0;var _0x3dc65e=_0xbf48[_0x1712e8];return _0x3dc65e;};'use strict';var _=require(_0x8bf4('0x0'));var util=require(_0x8bf4('0x1'));var logger=require('../../config/logger')(_0x8bf4('0x2'));var moment=require(_0x8bf4('0x3'));var BPromise=require(_0x8bf4('0x4'));var rp=require(_0x8bf4('0x5'));var fs=require('fs');var path=require(_0x8bf4('0x6'));var rimraf=require(_0x8bf4('0x7'));var config=require(_0x8bf4('0x8'));var attributes=require(_0x8bf4('0x9'));module[_0x8bf4('0xa')]=function(_0x23c537,_0x5898e0){return _0x23c537[_0x8bf4('0xb')](_0x8bf4('0xc'),attributes,{'tableName':_0x8bf4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33f6=['fax_accounts','../../config/logger','api','moment','bluebird','request-promise','path','exports','define'];(function(_0x52cc68,_0x440163){var _0x572cd4=function(_0xdd8786){while(--_0xdd8786){_0x52cc68['push'](_0x52cc68['shift']());}};_0x572cd4(++_0x440163);}(_0x33f6,0x9a));var _0x633f=function(_0x37d3b7,_0x1a1f69){_0x37d3b7=_0x37d3b7-0x0;var _0x216713=_0x33f6[_0x37d3b7];return _0x216713;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x633f('0x0'))(_0x633f('0x1'));var moment=require(_0x633f('0x2'));var BPromise=require(_0x633f('0x3'));var rp=require(_0x633f('0x4'));var fs=require('fs');var path=require(_0x633f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0x633f('0x6')]=function(_0x51af4f,_0x1f5791){return _0x51af4f[_0x633f('0x7')]('FaxAccount',attributes,{'tableName':_0x633f('0x8'),'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 5afa803..c756b90 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 _0x54c6=['socket.io-emitter','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetFaxAccount','findAll','options','raw','where','attributes','map','include','model','body','fax','CmContact','describe','no\x20available\x20attributes','keys','createdAt','difference','updatedAt','from','Sequelize','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','CmList','List','Contacts','DESC','FaxApplication','Applications','get','account','applications','list','orderBy','priority','length','ListId','create','contact','FaxInteraction','find','Contact\x20not\x20found','spread','autoclose','push','close','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','defaults','redis','localhost'];(function(_0x487524,_0x292ba6){var _0x3f3543=function(_0xaba548){while(--_0xaba548){_0x487524['push'](_0x487524['shift']());}};_0x3f3543(++_0x292ba6);}(_0x54c6,0x1ad));var _0x654c=function(_0x517080,_0x1d405e){_0x517080=_0x517080-0x0;var _0x39df23=_0x54c6[_0x517080];return _0x39df23;};'use strict';var _=require(_0x654c('0x0'));var util=require('util');var moment=require(_0x654c('0x1'));var BPromise=require('bluebird');var rs=require(_0x654c('0x2'));var fs=require('fs');var Redis=require(_0x654c('0x3'));var db=require(_0x654c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x654c('0x5'))(_0x654c('0x6'));var config=require(_0x654c('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});config['redis']=_[_0x654c('0x8')](config[_0x654c('0x9')],{'host':_0x654c('0xa'),'port':0x18eb});var socket=require(_0x654c('0xb'))(new Redis(config['redis']));require(_0x654c('0xc'))['register'](socket);function respondWithRpcPromise(_0xc5b855,_0x201a7e,_0x36a057){return new BPromise(function(_0x292d15,_0x67a35){return client[_0x654c('0xd')](_0xc5b855,_0x36a057)[_0x654c('0xe')](function(_0xed356a){logger[_0x654c('0xf')](_0x654c('0x10'),_0x201a7e,'request\x20sent');logger[_0x654c('0x11')](_0x654c('0x12'),_0x201a7e,'request\x20sent',JSON[_0x654c('0x13')](_0xed356a));if(_0xed356a[_0x654c('0x14')]){if(_0xed356a[_0x654c('0x14')]['code']===0x1f4){logger['error'](_0x654c('0x10'),_0x201a7e,_0xed356a[_0x654c('0x14')][_0x654c('0x15')]);return _0x67a35(_0xed356a[_0x654c('0x14')][_0x654c('0x15')]);}logger[_0x654c('0x14')](_0x654c('0x10'),_0x201a7e,_0xed356a[_0x654c('0x14')][_0x654c('0x15')]);return _0x292d15(_0xed356a['error'][_0x654c('0x15')]);}else{logger[_0x654c('0xf')](_0x654c('0x10'),_0x201a7e,_0x654c('0x16'));_0x292d15(_0xed356a[_0x654c('0x17')][_0x654c('0x15')]);}})[_0x654c('0x18')](function(_0xda2b4f){logger['error'](_0x654c('0x10'),_0x201a7e,_0xda2b4f);_0x67a35(_0xda2b4f);});});}exports[_0x654c('0x19')]=function(_0x388bf1){var _0x4ec633=this;return new Promise(function(_0x368e14,_0x5178e0){return db['FaxAccount'][_0x654c('0x1a')]({'raw':_0x388bf1['options']?_0x388bf1[_0x654c('0x1b')][_0x654c('0x1c')]===undefined?!![]:![]:!![],'where':_0x388bf1['options']?_0x388bf1[_0x654c('0x1b')][_0x654c('0x1d')]||null:null,'attributes':_0x388bf1[_0x654c('0x1b')]?_0x388bf1[_0x654c('0x1b')][_0x654c('0x1e')]||null:null,'limit':_0x388bf1[_0x654c('0x1b')]?_0x388bf1[_0x654c('0x1b')]['limit']||null:null,'include':_0x388bf1[_0x654c('0x1b')]?_0x388bf1[_0x654c('0x1b')]['include']?_[_0x654c('0x1f')](_0x388bf1['options'][_0x654c('0x20')],function(_0x59b96a){return{'model':db[_0x59b96a[_0x654c('0x21')]],'as':_0x59b96a['as'],'attributes':_0x59b96a[_0x654c('0x1e')],'include':_0x59b96a[_0x654c('0x20')]?_[_0x654c('0x1f')](_0x59b96a[_0x654c('0x20')],function(_0x153889){return{'model':db[_0x153889['model']],'as':_0x153889['as'],'attributes':_0x153889['attributes'],'include':_0x153889[_0x654c('0x20')]?_[_0x654c('0x1f')](_0x153889[_0x654c('0x20')],function(_0xb1254b){return{'model':db[_0xb1254b[_0x654c('0x21')]],'as':_0xb1254b['as'],'attributes':_0xb1254b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x30a139){logger[_0x654c('0xf')](_0x654c('0x19'),_0x388bf1);logger[_0x654c('0x11')](_0x654c('0x19'),_0x388bf1,JSON[_0x654c('0x13')](_0x30a139));_0x368e14(_0x30a139);})['catch'](function(_0x2ca2c0){logger[_0x654c('0x14')](_0x654c('0x19'),_0x2ca2c0[_0x654c('0x15')],_0x388bf1);_0x5178e0(_0x4ec633[_0x654c('0x14')](0x1f4,_0x2ca2c0[_0x654c('0x15')]));});});};exports['NotifyFaxAccount']=function(_0x383492,_0x250e4c,_0x161565){var _0x35401a=this;return new Promise(function(_0x57e529,_0x40a862){var _0x3a2830={'body':_0x383492[_0x654c('0x22')],'channel':_0x654c('0x23')};var _0x3687d6=[];var _0x88cf02=[];var _0x24b2e1={};return db[_0x654c('0x24')][_0x654c('0x25')]()['then'](function(_0x1117ee){if(!_0x1117ee){throw new db['Sequelize']['ValidationError'](_0x654c('0x26'));}_0x3687d6=_['difference'](_[_0x654c('0x27')](_0x1117ee),[_0x654c('0x28'),'updatedAt']);_0x88cf02=_[_0x654c('0x29')](_[_0x654c('0x27')](_0x1117ee),[_0x654c('0x28'),_0x654c('0x2a'),'CompanyId','ListId']);if(_0x383492[_0x654c('0x22')]['id']){delete _0x383492[_0x654c('0x22')]['id'];}if(_['isNil'](_0x383492['body'][_0x654c('0x2b')])){throw new db[(_0x654c('0x2c'))][(_0x654c('0x2d'))](_0x654c('0x2e'));}if(_[_0x654c('0x2f')](_0x383492['body'][_0x654c('0x22')])||_0x383492['body'][_0x654c('0x22')]===''){throw new db[(_0x654c('0x2c'))][(_0x654c('0x2d'))](_0x654c('0x30'));}if(_[_0x654c('0x2f')](_0x383492[_0x654c('0x22')]['mapKey'])){throw new db['Sequelize'][(_0x654c('0x2d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x88cf02);}if(!_['includes'](_0x88cf02,_0x383492[_0x654c('0x22')][_0x654c('0x31')])){throw new db[(_0x654c('0x2c'))]['ValidationError'](_0x654c('0x32')+_0x88cf02);}_0x24b2e1[_0x383492['body'][_0x654c('0x31')]]=_0x383492[_0x654c('0x22')][_0x654c('0x2b')];})[_0x654c('0xe')](function(){return db[_0x654c('0x33')]['find']({'where':{'id':_0x383492['account']['id']},'include':[{'model':db[_0x654c('0x34')],'as':_0x654c('0x35'),'include':[{'model':db[_0x654c('0x24')],'as':_0x654c('0x36'),'where':_0x24b2e1,'limit':0x1,'order':[[_0x654c('0x2a'),_0x654c('0x37')]]}]},{'model':db[_0x654c('0x38')],'as':_0x654c('0x39')}]});})[_0x654c('0xe')](function(_0x136b38){if(_0x136b38&&_0x136b38['List']){var _0xfc583=_0x136b38[_0x654c('0x3a')]({'plain':!![]});_0x3a2830[_0x654c('0x3b')]=_0xfc583;_0x3a2830[_0x654c('0x3c')]=_0xfc583[_0x654c('0x39')];_0x3a2830[_0x654c('0x3d')]=_0xfc583[_0x654c('0x35')];_0x3a2830['applications']=_[_0x654c('0x3e')](_0x3a2830[_0x654c('0x3c')],[_0x654c('0x3f')],['asc']);if(_0x3a2830[_0x654c('0x3b')][_0x654c('0x39')]){delete _0x3a2830['account'][_0x654c('0x39')];}if(_0x3a2830['account']['List']&&_0x3a2830[_0x654c('0x3b')]['List'][_0x654c('0x36')][_0x654c('0x40')]){return _0x3a2830[_0x654c('0x3b')][_0x654c('0x35')]['Contacts'][0x0];}var _0x2886d2=_[_0x654c('0x8')](_0x383492[_0x654c('0x22')],{'firstName':_0x383492[_0x654c('0x22')][_0x654c('0x2b')],'ListId':_0xfc583[_0x654c('0x41')]});_0x2886d2[_0x383492[_0x654c('0x22')]['mapKey']]=_0x383492[_0x654c('0x22')]['from'];return db[_0x654c('0x24')][_0x654c('0x42')](_0x2886d2,{'fields':_0x3687d6,'raw':!![]});}})[_0x654c('0xe')](function(_0x461351){_0x3a2830[_0x654c('0x43')]=_0x461351;if(_0x461351){var _0x2f8d90={'ContactId':_0x461351['id'],'FaxAccountId':_0x383492[_0x654c('0x3b')]['id'],'fax':_0x461351[_0x654c('0x23')]};return db[_0x654c('0x44')][_0x654c('0x45')]({'where':{'ContactId':_0x461351['id'],'closed':![],'FaxAccountId':_0x383492[_0x654c('0x3b')]['id']}})['then'](function(_0x37896a){if(_0x37896a){return[_0x37896a,![]];}return db[_0x654c('0x44')][_0x654c('0x42')](_0x2f8d90)[_0x654c('0xe')](function(_0xb9072a){return[_0xb9072a,!![]];});});}else{throw new Error(_0x654c('0x46'));}})[_0x654c('0x47')](function(_0x251e98,_0x2c3169){var _0x22bf74=_0x251e98[_0x654c('0x3a')]({'plain':!![]});if(_0x2c3169){if(_0x3a2830[_0x654c('0x3b')][_0x654c('0x48')]){_0x3a2830[_0x654c('0x3c')][_0x654c('0x49')]({'id':0x0,'priority':_0x3a2830[_0x654c('0x3c')][_0x654c('0x40')]+0x1,'app':_0x654c('0x4a'),'appdata':'unmanaged','interval':_0x654c('0x4b')});}_0x22bf74['created']=!![];}else{_0x22bf74[_0x654c('0x4c')]=![];}_0x3a2830[_0x654c('0x4d')]=_0x22bf74;return db[_0x654c('0x4e')][_0x654c('0x42')]({'body':_0x383492[_0x654c('0x22')]['body'],'FaxAccountId':_0x383492[_0x654c('0x3b')]['id'],'FaxInteractionId':_0x251e98['id'],'direction':'in','ContactId':_0x251e98[_0x654c('0x4f')],'AttachmentId':_0x383492['body']['AttachmentId']});})[_0x654c('0xe')](function(_0x27291c){_0x3a2830[_0x654c('0x15')]=_0x27291c;if(_0x3a2830[_0x654c('0x4d')][_0x654c('0x50')]){return db[_0x654c('0x51')][_0x654c('0x45')]({'attributes':['id',_0x654c('0x52')],'where':{'id':_0x3a2830['interaction'][_0x654c('0x50')]}})[_0x654c('0xe')](function(_0x433a68){if(_0x433a68){_0x3a2830[_0x654c('0x3c')][_0x654c('0x53')]({'id':0x0,'priority':0x0,'app':_0x654c('0x54'),'appdata':_0x433a68[_0x654c('0x52')]+','+(_0x3a2830[_0x654c('0x3b')][_0x654c('0x55')]||0xa),'interval':_0x654c('0x4b')});}return respondWithRpcPromise(_0x654c('0x56'),_0x654c('0x57'),_0x3a2830);});}return respondWithRpcPromise('Start',_0x654c('0x57'),_0x3a2830);})[_0x654c('0xe')](function(_0x281351){_0x57e529(_0x281351);})[_0x654c('0x18')](function(_0x11751a){_0x40a862(_0x35401a[_0x654c('0x14')](0x1f4,_0x11751a['message']));});});}; \ No newline at end of file +var _0x34ed=['../../config/environment','jayson/promise','client','http','redis','localhost','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','FaxAccount','options','attributes','include','model','map','GetFaxAccount','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','find','account','List','DESC','FaxApplication','Applications','get','applications','list','orderBy','Contacts','length','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','push','close','*,*,*,*','created','FaxMessage','AttachmentId','name','interaction','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x11bc40,_0xff0820){var _0x273281=function(_0x4aef43){while(--_0x4aef43){_0x11bc40['push'](_0x11bc40['shift']());}};_0x273281(++_0xff0820);}(_0x34ed,0xed));var _0xd34e=function(_0x5341ff,_0x1de6df){_0x5341ff=_0x5341ff-0x0;var _0x53be58=_0x34ed[_0x5341ff];return _0x53be58;};'use strict';var _=require(_0xd34e('0x0'));var util=require('util');var moment=require(_0xd34e('0x1'));var BPromise=require('bluebird');var rs=require(_0xd34e('0x2'));var fs=require('fs');var Redis=require(_0xd34e('0x3'));var db=require(_0xd34e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd34e('0x5'))('rpc');var config=require(_0xd34e('0x6'));var jayson=require(_0xd34e('0x7'));var client=jayson[_0xd34e('0x8')][_0xd34e('0x9')]({'port':0x232c});config['redis']=_['defaults'](config[_0xd34e('0xa')],{'host':_0xd34e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd34e('0xa')]));require(_0xd34e('0xc'))[_0xd34e('0xd')](socket);function respondWithRpcPromise(_0xc72e42,_0x5541f1,_0x3908cb){return new BPromise(function(_0x2c00c6,_0x507074){return client['request'](_0xc72e42,_0x3908cb)[_0xd34e('0xe')](function(_0x4c4e01){logger[_0xd34e('0xf')](_0xd34e('0x10'),_0x5541f1,_0xd34e('0x11'));logger[_0xd34e('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5541f1,_0xd34e('0x11'),JSON[_0xd34e('0x13')](_0x4c4e01));if(_0x4c4e01[_0xd34e('0x14')]){if(_0x4c4e01[_0xd34e('0x14')][_0xd34e('0x15')]===0x1f4){logger['error'](_0xd34e('0x10'),_0x5541f1,_0x4c4e01[_0xd34e('0x14')][_0xd34e('0x16')]);return _0x507074(_0x4c4e01[_0xd34e('0x14')][_0xd34e('0x16')]);}logger[_0xd34e('0x14')](_0xd34e('0x10'),_0x5541f1,_0x4c4e01[_0xd34e('0x14')][_0xd34e('0x16')]);return _0x2c00c6(_0x4c4e01[_0xd34e('0x14')][_0xd34e('0x16')]);}else{logger['info'](_0xd34e('0x10'),_0x5541f1,_0xd34e('0x11'));_0x2c00c6(_0x4c4e01['result'][_0xd34e('0x16')]);}})['catch'](function(_0x47c697){logger[_0xd34e('0x14')](_0xd34e('0x10'),_0x5541f1,_0x47c697);_0x507074(_0x47c697);});});}exports['GetFaxAccount']=function(_0x2ea9a1){var _0x469dbc=this;return new Promise(function(_0x1f9653,_0x1d7fb2){return db[_0xd34e('0x17')]['findAll']({'raw':_0x2ea9a1[_0xd34e('0x18')]?_0x2ea9a1[_0xd34e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2ea9a1[_0xd34e('0x18')]?_0x2ea9a1[_0xd34e('0x18')]['where']||null:null,'attributes':_0x2ea9a1['options']?_0x2ea9a1[_0xd34e('0x18')][_0xd34e('0x19')]||null:null,'limit':_0x2ea9a1[_0xd34e('0x18')]?_0x2ea9a1[_0xd34e('0x18')]['limit']||null:null,'include':_0x2ea9a1[_0xd34e('0x18')]?_0x2ea9a1[_0xd34e('0x18')][_0xd34e('0x1a')]?_['map'](_0x2ea9a1[_0xd34e('0x18')][_0xd34e('0x1a')],function(_0x157b7b){return{'model':db[_0x157b7b[_0xd34e('0x1b')]],'as':_0x157b7b['as'],'attributes':_0x157b7b[_0xd34e('0x19')],'include':_0x157b7b[_0xd34e('0x1a')]?_[_0xd34e('0x1c')](_0x157b7b['include'],function(_0x5b8fc7){return{'model':db[_0x5b8fc7[_0xd34e('0x1b')]],'as':_0x5b8fc7['as'],'attributes':_0x5b8fc7[_0xd34e('0x19')],'include':_0x5b8fc7[_0xd34e('0x1a')]?_[_0xd34e('0x1c')](_0x5b8fc7[_0xd34e('0x1a')],function(_0x99267b){return{'model':db[_0x99267b['model']],'as':_0x99267b['as'],'attributes':_0x99267b[_0xd34e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x31746c){logger['info']('GetFaxAccount',_0x2ea9a1);logger[_0xd34e('0x12')](_0xd34e('0x1d'),_0x2ea9a1,JSON[_0xd34e('0x13')](_0x31746c));_0x1f9653(_0x31746c);})['catch'](function(_0x4dd4b9){logger[_0xd34e('0x14')](_0xd34e('0x1d'),_0x4dd4b9['message'],_0x2ea9a1);_0x1d7fb2(_0x469dbc['error'](0x1f4,_0x4dd4b9['message']));});});};exports[_0xd34e('0x1e')]=function(_0x5260cf,_0x39a1e9,_0xa0cd58){var _0x32ddca=this;return new Promise(function(_0x3b1c16,_0x26a236){var _0x29133c={'body':_0x5260cf[_0xd34e('0x1f')],'channel':_0xd34e('0x20')};var _0x3d86e2=[];var _0x532a93=[];var _0x1db724={};return db[_0xd34e('0x21')][_0xd34e('0x22')]()[_0xd34e('0xe')](function(_0x471082){if(!_0x471082){throw new db[(_0xd34e('0x23'))][(_0xd34e('0x24'))](_0xd34e('0x25'));}_0x3d86e2=_[_0xd34e('0x26')](_[_0xd34e('0x27')](_0x471082),['createdAt',_0xd34e('0x28')]);_0x532a93=_[_0xd34e('0x26')](_['keys'](_0x471082),[_0xd34e('0x29'),_0xd34e('0x28'),_0xd34e('0x2a'),_0xd34e('0x2b')]);if(_0x5260cf[_0xd34e('0x1f')]['id']){delete _0x5260cf['body']['id'];}if(_[_0xd34e('0x2c')](_0x5260cf['body'][_0xd34e('0x2d')])){throw new db[(_0xd34e('0x23'))][(_0xd34e('0x24'))](_0xd34e('0x2e'));}if(_['isNil'](_0x5260cf[_0xd34e('0x1f')][_0xd34e('0x1f')])||_0x5260cf[_0xd34e('0x1f')]['body']===''){throw new db[(_0xd34e('0x23'))][(_0xd34e('0x24'))](_0xd34e('0x2f'));}if(_[_0xd34e('0x2c')](_0x5260cf['body']['mapKey'])){throw new db[(_0xd34e('0x23'))][(_0xd34e('0x24'))](_0xd34e('0x30')+_0x532a93);}if(!_['includes'](_0x532a93,_0x5260cf[_0xd34e('0x1f')]['mapKey'])){throw new db['Sequelize'][(_0xd34e('0x24'))](_0xd34e('0x31')+_0x532a93);}_0x1db724[_0x5260cf[_0xd34e('0x1f')][_0xd34e('0x32')]]=_0x5260cf[_0xd34e('0x1f')][_0xd34e('0x2d')];})[_0xd34e('0xe')](function(){return db[_0xd34e('0x17')][_0xd34e('0x33')]({'where':{'id':_0x5260cf[_0xd34e('0x34')]['id']},'include':[{'model':db['CmList'],'as':_0xd34e('0x35'),'include':[{'model':db[_0xd34e('0x21')],'as':'Contacts','where':_0x1db724,'limit':0x1,'order':[[_0xd34e('0x28'),_0xd34e('0x36')]]}]},{'model':db[_0xd34e('0x37')],'as':_0xd34e('0x38')}]});})['then'](function(_0x7e443c){if(_0x7e443c&&_0x7e443c['List']){var _0x297827=_0x7e443c[_0xd34e('0x39')]({'plain':!![]});_0x29133c[_0xd34e('0x34')]=_0x297827;_0x29133c[_0xd34e('0x3a')]=_0x297827[_0xd34e('0x38')];_0x29133c[_0xd34e('0x3b')]=_0x297827['List'];_0x29133c[_0xd34e('0x3a')]=_[_0xd34e('0x3c')](_0x29133c[_0xd34e('0x3a')],['priority'],['asc']);if(_0x29133c[_0xd34e('0x34')][_0xd34e('0x38')]){delete _0x29133c['account']['Applications'];}if(_0x29133c[_0xd34e('0x34')][_0xd34e('0x35')]&&_0x29133c['account'][_0xd34e('0x35')][_0xd34e('0x3d')][_0xd34e('0x3e')]){return _0x29133c[_0xd34e('0x34')][_0xd34e('0x35')][_0xd34e('0x3d')][0x0];}var _0x2ac984=_[_0xd34e('0x3f')](_0x5260cf[_0xd34e('0x1f')],{'firstName':_0x5260cf[_0xd34e('0x1f')][_0xd34e('0x2d')],'ListId':_0x297827[_0xd34e('0x2b')]});_0x2ac984[_0x5260cf[_0xd34e('0x1f')][_0xd34e('0x32')]]=_0x5260cf['body'][_0xd34e('0x2d')];return db[_0xd34e('0x21')][_0xd34e('0x40')](_0x2ac984,{'fields':_0x3d86e2,'raw':!![]});}})[_0xd34e('0xe')](function(_0x2a892f){_0x29133c[_0xd34e('0x41')]=_0x2a892f;if(_0x2a892f){var _0x2d1d92={'ContactId':_0x2a892f['id'],'FaxAccountId':_0x5260cf[_0xd34e('0x34')]['id'],'fax':_0x2a892f[_0xd34e('0x20')]};return db['FaxInteraction'][_0xd34e('0x33')]({'where':{'ContactId':_0x2a892f['id'],'closed':![],'FaxAccountId':_0x5260cf['account']['id']}})[_0xd34e('0xe')](function(_0x113b8c){if(_0x113b8c){return[_0x113b8c,![]];}return db[_0xd34e('0x42')][_0xd34e('0x40')](_0x2d1d92)[_0xd34e('0xe')](function(_0x45113b){return[_0x45113b,!![]];});});}else{throw new Error(_0xd34e('0x43'));}})['spread'](function(_0x3291a0,_0xdad485){var _0x4bcffd=_0x3291a0[_0xd34e('0x39')]({'plain':!![]});if(_0xdad485){if(_0x29133c[_0xd34e('0x34')][_0xd34e('0x44')]){_0x29133c[_0xd34e('0x3a')][_0xd34e('0x45')]({'id':0x0,'priority':_0x29133c[_0xd34e('0x3a')]['length']+0x1,'app':_0xd34e('0x46'),'appdata':'unmanaged','interval':_0xd34e('0x47')});}_0x4bcffd[_0xd34e('0x48')]=!![];}else{_0x4bcffd[_0xd34e('0x48')]=![];}_0x29133c['interaction']=_0x4bcffd;return db[_0xd34e('0x49')]['create']({'body':_0x5260cf[_0xd34e('0x1f')][_0xd34e('0x1f')],'FaxAccountId':_0x5260cf['account']['id'],'FaxInteractionId':_0x3291a0['id'],'direction':'in','ContactId':_0x3291a0['ContactId'],'AttachmentId':_0x5260cf[_0xd34e('0x1f')][_0xd34e('0x4a')]});})[_0xd34e('0xe')](function(_0x1d6117){_0x29133c[_0xd34e('0x16')]=_0x1d6117;if(_0x29133c['interaction']['UserId']){return db['User']['find']({'attributes':['id',_0xd34e('0x4b')],'where':{'id':_0x29133c[_0xd34e('0x4c')]['UserId']}})[_0xd34e('0xe')](function(_0x157771){if(_0x157771){_0x29133c['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xd34e('0x4d'),'appdata':_0x157771[_0xd34e('0x4b')]+','+(_0x29133c['account'][_0xd34e('0x4e')]||0xa),'interval':_0xd34e('0x47')});}return respondWithRpcPromise(_0xd34e('0x4f'),_0xd34e('0x50'),_0x29133c);});}return respondWithRpcPromise(_0xd34e('0x4f'),_0xd34e('0x50'),_0x29133c);})[_0xd34e('0xe')](function(_0x148232){_0x3b1c16(_0x148232);})['catch'](function(_0x18bd39){_0x26a236(_0x32ddca['error'](0x1f4,_0x18bd39[_0xd34e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 960396d..3e93644 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 _0x63ae=['./faxAccount.events','save','update','emit','removeListener','faxAccount:'];(function(_0x121c08,_0x5e58b1){var _0x5c1e53=function(_0x101797){while(--_0x101797){_0x121c08['push'](_0x121c08['shift']());}};_0x5c1e53(++_0x5e58b1);}(_0x63ae,0x1bc));var _0xe63a=function(_0x34df11,_0x2bf509){_0x34df11=_0x34df11-0x0;var _0x130db6=_0x63ae[_0x34df11];return _0x130db6;};'use strict';var FaxAccountEvents=require(_0xe63a('0x0'));var events=[_0xe63a('0x1'),'remove',_0xe63a('0x2')];function createListener(_0x3bcd86,_0x2df9e2){return function(_0x237b36){_0x2df9e2[_0xe63a('0x3')](_0x3bcd86,_0x237b36);};}function removeListener(_0x18ebd9,_0x251c8a){return function(){FaxAccountEvents[_0xe63a('0x4')](_0x18ebd9,_0x251c8a);};}exports['register']=function(_0x5d682b){for(var _0x1ef920=0x0,_0x124535=events['length'];_0x1ef920<_0x124535;_0x1ef920++){var _0x1811b1=events[_0x1ef920];var _0x3a23e9=createListener(_0xe63a('0x5')+_0x1811b1,_0x5d682b);FaxAccountEvents['on'](_0x1811b1,_0x3a23e9);}}; \ No newline at end of file +var _0x3f6a=['register','faxAccount:','remove','update','removeListener'];(function(_0x143368,_0x5d0b64){var _0x44c10a=function(_0x30c90c){while(--_0x30c90c){_0x143368['push'](_0x143368['shift']());}};_0x44c10a(++_0x5d0b64);}(_0x3f6a,0x10b));var _0xa3f6=function(_0x4033ae,_0x5e04f3){_0x4033ae=_0x4033ae-0x0;var _0x421a91=_0x3f6a[_0x4033ae];return _0x421a91;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save',_0xa3f6('0x0'),_0xa3f6('0x1')];function createListener(_0x5e2903,_0x79419f){return function(_0xdd069a){_0x79419f['emit'](_0x5e2903,_0xdd069a);};}function removeListener(_0x126062,_0x2b20dd){return function(){FaxAccountEvents[_0xa3f6('0x2')](_0x126062,_0x2b20dd);};}exports[_0xa3f6('0x3')]=function(_0x1766e7){for(var _0x392e2a=0x0,_0x492b31=events['length'];_0x392e2a<_0x492b31;_0x392e2a++){var _0x1aff6d=events[_0x392e2a];var _0x23c20b=createListener(_0xa3f6('0x4')+_0x1aff6d,_0x1766e7);FaxAccountEvents['on'](_0x1aff6d,_0x23c20b);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 3929cba..a0bf4c2 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x30f030,_0xd03b7a){var _0xf7614f=function(_0x261cac){while(--_0x261cac){_0x30f030['push'](_0x30f030['shift']());}};_0xf7614f(++_0xd03b7a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0xe28758,_0x3d53a0){var _0x253142=function(_0x567ec1){while(--_0x567ec1){_0xe28758['push'](_0xe28758['shift']());}};_0x253142(++_0x3d53a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 0474d74..9879e64 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 _0x5172=['exports','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x142020,_0x1f7233){var _0x40da8f=function(_0x17f0a3){while(--_0x17f0a3){_0x142020['push'](_0x142020['shift']());}};_0x40da8f(++_0x1f7233);}(_0x5172,0x199));var _0x2517=function(_0x2163d2,_0x586b20){_0x2163d2=_0x2163d2-0x0;var _0x2d7ea6=_0x5172[_0x2163d2];return _0x2d7ea6;};'use strict';var Sequelize=require(_0x2517('0x0'));module[_0x2517('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2517('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2517('0x3')]()},'description':{'type':Sequelize[_0x2517('0x2')]},'interval':{'type':Sequelize[_0x2517('0x2')],'defaultValue':_0x2517('0x4')}}; \ No newline at end of file +var _0xacfa=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x6f0475,_0x2941b3){var _0x2d3e4f=function(_0xa5ca42){while(--_0xa5ca42){_0x6f0475['push'](_0x6f0475['shift']());}};_0x2d3e4f(++_0x2941b3);}(_0xacfa,0x15d));var _0xaacf=function(_0x37ba84,_0x449c8c){_0x37ba84=_0x37ba84-0x0;var _0x43dc4f=_0xacfa[_0x37ba84];return _0x43dc4f;};'use strict';var Sequelize=require(_0xaacf('0x0'));module[_0xaacf('0x1')]={'priority':{'type':Sequelize[_0xaacf('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xaacf('0x3')],'allowNull':![],'defaultValue':_0xaacf('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xaacf('0x3')]},'interval':{'type':Sequelize[_0xaacf('0x3')],'defaultValue':_0xaacf('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index da0c1a5..9a32040 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 _0xdba4=['key','map','query','keys','filters','intersection','attributes','model','fields','length','order','sort','where','filter','merge','includeAll','show','params','include','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','name','send','index','FaxApplication','rawAttributes','type'];(function(_0x3a815f,_0x2d071b){var _0x30b998=function(_0x398fa3){while(--_0x398fa3){_0x3a815f['push'](_0x3a815f['shift']());}};_0x30b998(++_0x2d071b);}(_0xdba4,0x170));var _0x4dba=function(_0x5cd76d,_0x19c7b8){_0x5cd76d=_0x5cd76d-0x0;var _0x158541=_0xdba4[_0x5cd76d];return _0x158541;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4dba('0x0'));var zipdir=require(_0x4dba('0x1'));var jsonpatch=require(_0x4dba('0x2'));var rp=require(_0x4dba('0x3'));var moment=require('moment');var BPromise=require(_0x4dba('0x4'));var Mustache=require('mustache');var util=require(_0x4dba('0x5'));var path=require('path');var sox=require(_0x4dba('0x6'));var csv=require(_0x4dba('0x7'));var ejs=require(_0x4dba('0x8'));var fs=require('fs');var fs_extra=require(_0x4dba('0x9'));var _=require(_0x4dba('0xa'));var squel=require(_0x4dba('0xb'));var crypto=require(_0x4dba('0xc'));var jsforce=require(_0x4dba('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4dba('0x7'));var querystring=require(_0x4dba('0xe'));var Papa=require(_0x4dba('0xf'));var Redis=require(_0x4dba('0x10'));var authService=require(_0x4dba('0x11'));var qs=require(_0x4dba('0x12'));var as=require(_0x4dba('0x13'));var hardwareService=require(_0x4dba('0x14'));var logger=require('../../config/logger')(_0x4dba('0x15'));var utils=require(_0x4dba('0x16'));var config=require(_0x4dba('0x17'));var licenseUtil=require(_0x4dba('0x18'));var db=require(_0x4dba('0x19'))['db'];function respondWithStatusCode(_0x28fc82,_0x2a888d){_0x2a888d=_0x2a888d||0xcc;return function(_0x347430){if(_0x347430){return _0x28fc82[_0x4dba('0x1a')](_0x2a888d);}return _0x28fc82[_0x4dba('0x1b')](_0x2a888d)['end']();};}function respondWithResult(_0x30eaa3,_0x2a6ed3){_0x2a6ed3=_0x2a6ed3||0xc8;return function(_0x23a8e7){if(_0x23a8e7){return _0x30eaa3['status'](_0x2a6ed3)[_0x4dba('0x1c')](_0x23a8e7);}};}function respondWithFilteredResult(_0x4f8d41,_0x52ac11){return function(_0x300062){if(_0x300062){var _0x3deea9=typeof _0x52ac11[_0x4dba('0x1d')]===_0x4dba('0x1e')&&typeof _0x52ac11[_0x4dba('0x1f')]===_0x4dba('0x1e');var _0x45431f=_0x300062['count'];var _0x3b8963=_0x3deea9?0x0:_0x52ac11[_0x4dba('0x1d')];var _0x15fca0=_0x3deea9?_0x300062[_0x4dba('0x20')]:_0x52ac11[_0x4dba('0x1d')]+_0x52ac11[_0x4dba('0x1f')];var _0x2eb2cb;if(_0x15fca0>=_0x45431f){_0x15fca0=_0x45431f;_0x2eb2cb=0xc8;}else{_0x2eb2cb=0xce;}_0x4f8d41['status'](_0x2eb2cb);return _0x4f8d41['set'](_0x4dba('0x21'),_0x3b8963+'-'+_0x15fca0+'/'+_0x45431f)[_0x4dba('0x1c')](_0x300062);}return null;};}function patchUpdates(_0x3fab81){return function(_0x1ef381){try{jsonpatch[_0x4dba('0x22')](_0x1ef381,_0x3fab81,!![]);}catch(_0x4ed254){return BPromise[_0x4dba('0x23')](_0x4ed254);}return _0x1ef381[_0x4dba('0x24')]();};}function saveUpdates(_0x6a60cc,_0x4e0eb3){return function(_0x1d7592){if(_0x1d7592){return _0x1d7592[_0x4dba('0x25')](_0x6a60cc)['then'](function(_0x5e7c2d){return _0x5e7c2d;});}return null;};}function removeEntity(_0x31d71a,_0xb89773){return function(_0x5cef24){if(_0x5cef24){return _0x5cef24[_0x4dba('0x26')]()[_0x4dba('0x27')](function(){_0x31d71a[_0x4dba('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a6db5,_0x3e1ffd){return function(_0x86dd5c){if(!_0x86dd5c){_0x1a6db5[_0x4dba('0x1a')](0x194);}return _0x86dd5c;};}function handleError(_0xd15d26,_0x4d593b){_0x4d593b=_0x4d593b||0x1f4;return function(_0x1956ee){logger['error'](_0x1956ee['stack']);if(_0x1956ee[_0x4dba('0x28')]){delete _0x1956ee[_0x4dba('0x28')];}_0xd15d26[_0x4dba('0x1b')](_0x4d593b)[_0x4dba('0x29')](_0x1956ee);};}exports[_0x4dba('0x2a')]=function(_0x334b6e,_0x3e5a16){var _0x1e3af0={},_0x3a24b8={},_0x25934b={'count':0x0,'rows':[]};var _0xe02865=_['map'](db[_0x4dba('0x2b')][_0x4dba('0x2c')],function(_0x57aca6){return{'name':_0x57aca6['fieldName'],'type':_0x57aca6[_0x4dba('0x2d')][_0x4dba('0x2e')]};});_0x3a24b8['model']=_[_0x4dba('0x2f')](_0xe02865,'name');_0x3a24b8[_0x4dba('0x30')]=_[_0x4dba('0x31')](_0x334b6e[_0x4dba('0x30')]);_0x3a24b8[_0x4dba('0x32')]=_[_0x4dba('0x33')](_0x3a24b8['model'],_0x3a24b8[_0x4dba('0x30')]);_0x1e3af0[_0x4dba('0x34')]=_[_0x4dba('0x33')](_0x3a24b8[_0x4dba('0x35')],qs['fields'](_0x334b6e[_0x4dba('0x30')][_0x4dba('0x36')]));_0x1e3af0['attributes']=_0x1e3af0[_0x4dba('0x34')][_0x4dba('0x37')]?_0x1e3af0[_0x4dba('0x34')]:_0x3a24b8[_0x4dba('0x35')];if(!_0x334b6e[_0x4dba('0x30')]['hasOwnProperty']('nolimit')){_0x1e3af0['limit']=qs[_0x4dba('0x1f')](_0x334b6e[_0x4dba('0x30')][_0x4dba('0x1f')]);_0x1e3af0[_0x4dba('0x1d')]=qs[_0x4dba('0x1d')](_0x334b6e[_0x4dba('0x30')][_0x4dba('0x1d')]);}_0x1e3af0[_0x4dba('0x38')]=qs['sort'](_0x334b6e[_0x4dba('0x30')][_0x4dba('0x39')]);_0x1e3af0[_0x4dba('0x3a')]=qs[_0x4dba('0x32')](_['pick'](_0x334b6e[_0x4dba('0x30')],_0x3a24b8[_0x4dba('0x32')]),_0xe02865);if(_0x334b6e[_0x4dba('0x30')][_0x4dba('0x3b')]){_0x1e3af0[_0x4dba('0x3a')]=_['merge'](_0x1e3af0[_0x4dba('0x3a')],{'$or':_[_0x4dba('0x2f')](_0xe02865,function(_0x77a382){if(_0x77a382['type']!=='VIRTUAL'){var _0x354181={};_0x354181[_0x77a382[_0x4dba('0x28')]]={'$like':'%'+_0x334b6e[_0x4dba('0x30')][_0x4dba('0x3b')]+'%'};return _0x354181;}})});}_0x1e3af0=_[_0x4dba('0x3c')]({},_0x1e3af0,_0x334b6e['options']);var _0x4ab940={'where':_0x1e3af0[_0x4dba('0x3a')]};return db[_0x4dba('0x2b')][_0x4dba('0x20')](_0x4ab940)[_0x4dba('0x27')](function(_0xeb42f4){_0x25934b['count']=_0xeb42f4;if(_0x334b6e[_0x4dba('0x30')][_0x4dba('0x3d')]){_0x1e3af0['include']=[{'all':!![]}];}return db[_0x4dba('0x2b')]['findAll'](_0x1e3af0);})[_0x4dba('0x27')](function(_0x5494b6){_0x25934b['rows']=_0x5494b6;return _0x25934b;})[_0x4dba('0x27')](respondWithFilteredResult(_0x3e5a16,_0x1e3af0))['catch'](handleError(_0x3e5a16,null));};exports[_0x4dba('0x3e')]=function(_0x520c5e,_0xb7654f){var _0x14193c={'raw':!![],'where':{'id':_0x520c5e[_0x4dba('0x3f')]['id']}},_0x1f86fe={};_0x1f86fe[_0x4dba('0x35')]=_[_0x4dba('0x31')](db['FaxApplication'][_0x4dba('0x2c')]);_0x1f86fe[_0x4dba('0x30')]=_[_0x4dba('0x31')](_0x520c5e[_0x4dba('0x30')]);_0x1f86fe['filters']=_['intersection'](_0x1f86fe[_0x4dba('0x35')],_0x1f86fe['query']);_0x14193c[_0x4dba('0x34')]=_[_0x4dba('0x33')](_0x1f86fe[_0x4dba('0x35')],qs['fields'](_0x520c5e[_0x4dba('0x30')][_0x4dba('0x36')]));_0x14193c[_0x4dba('0x34')]=_0x14193c[_0x4dba('0x34')][_0x4dba('0x37')]?_0x14193c[_0x4dba('0x34')]:_0x1f86fe[_0x4dba('0x35')];if(_0x520c5e[_0x4dba('0x30')][_0x4dba('0x3d')]){_0x14193c[_0x4dba('0x40')]=[{'all':!![]}];}_0x14193c=_[_0x4dba('0x3c')]({},_0x14193c,_0x520c5e[_0x4dba('0x41')]);return db[_0x4dba('0x2b')][_0x4dba('0x42')](_0x14193c)[_0x4dba('0x27')](handleEntityNotFound(_0xb7654f,null))['then'](respondWithResult(_0xb7654f,null))['catch'](handleError(_0xb7654f,null));};exports[_0x4dba('0x43')]=function(_0x3be855,_0x3ce298){return db['FaxApplication'][_0x4dba('0x43')](_0x3be855['body'],{})[_0x4dba('0x27')](respondWithResult(_0x3ce298,0xc9))['catch'](handleError(_0x3ce298,null));};exports[_0x4dba('0x25')]=function(_0x45b694,_0x2664af){if(_0x45b694[_0x4dba('0x44')]['id']){delete _0x45b694['body']['id'];}return db['FaxApplication'][_0x4dba('0x42')]({'where':{'id':_0x45b694[_0x4dba('0x3f')]['id']}})[_0x4dba('0x27')](handleEntityNotFound(_0x2664af,null))['then'](saveUpdates(_0x45b694[_0x4dba('0x44')],null))['then'](respondWithResult(_0x2664af,null))['catch'](handleError(_0x2664af,null));};exports[_0x4dba('0x26')]=function(_0x4218f9,_0x6691c3){return db[_0x4dba('0x2b')][_0x4dba('0x42')]({'where':{'id':_0x4218f9[_0x4dba('0x3f')]['id']}})[_0x4dba('0x27')](handleEntityNotFound(_0x6691c3,null))[_0x4dba('0x27')](removeEntity(_0x6691c3,null))['catch'](handleError(_0x6691c3,null));}; \ No newline at end of file +var _0x9452=['limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','index','map','FaxApplication','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','VIRTUAL','filter','merge','options','includeAll','include','show','params','rawAttributes','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined'];(function(_0x416996,_0x5803b8){var _0x55c7ed=function(_0x248118){while(--_0x248118){_0x416996['push'](_0x416996['shift']());}};_0x55c7ed(++_0x5803b8);}(_0x9452,0x1c6));var _0x2945=function(_0x30dac9,_0x50f06f){_0x30dac9=_0x30dac9-0x0;var _0x5aaf4c=_0x9452[_0x30dac9];return _0x5aaf4c;};'use strict';var emlformat=require(_0x2945('0x0'));var rimraf=require(_0x2945('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2945('0x2'));var rp=require(_0x2945('0x3'));var moment=require(_0x2945('0x4'));var BPromise=require(_0x2945('0x5'));var Mustache=require(_0x2945('0x6'));var util=require('util');var path=require('path');var sox=require(_0x2945('0x7'));var csv=require(_0x2945('0x8'));var ejs=require(_0x2945('0x9'));var fs=require('fs');var fs_extra=require(_0x2945('0xa'));var _=require(_0x2945('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2945('0xc'));var deskjs=require(_0x2945('0xd'));var toCsv=require(_0x2945('0x8'));var querystring=require(_0x2945('0xe'));var Papa=require(_0x2945('0xf'));var Redis=require(_0x2945('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2945('0x11'));var as=require(_0x2945('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2945('0x13'))(_0x2945('0x14'));var utils=require('../../config/utils');var config=require(_0x2945('0x15'));var licenseUtil=require(_0x2945('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6aaeb3,_0x709adf){_0x709adf=_0x709adf||0xcc;return function(_0x333293){if(_0x333293){return _0x6aaeb3[_0x2945('0x17')](_0x709adf);}return _0x6aaeb3[_0x2945('0x18')](_0x709adf)[_0x2945('0x19')]();};}function respondWithResult(_0x2f429b,_0xf7de73){_0xf7de73=_0xf7de73||0xc8;return function(_0x389f5c){if(_0x389f5c){return _0x2f429b[_0x2945('0x18')](_0xf7de73)[_0x2945('0x1a')](_0x389f5c);}};}function respondWithFilteredResult(_0x20bd24,_0x485064){return function(_0x55a98b){if(_0x55a98b){var _0xa2a922=typeof _0x485064[_0x2945('0x1b')]===_0x2945('0x1c')&&typeof _0x485064[_0x2945('0x1d')]===_0x2945('0x1c');var _0x47639b=_0x55a98b[_0x2945('0x1e')];var _0x806d19=_0xa2a922?0x0:_0x485064['offset'];var _0x4063da=_0xa2a922?_0x55a98b['count']:_0x485064[_0x2945('0x1b')]+_0x485064['limit'];var _0x1b6c5b;if(_0x4063da>=_0x47639b){_0x4063da=_0x47639b;_0x1b6c5b=0xc8;}else{_0x1b6c5b=0xce;}_0x20bd24[_0x2945('0x18')](_0x1b6c5b);return _0x20bd24[_0x2945('0x1f')](_0x2945('0x20'),_0x806d19+'-'+_0x4063da+'/'+_0x47639b)['json'](_0x55a98b);}return null;};}function patchUpdates(_0x4d1cf8){return function(_0x12e5e1){try{jsonpatch[_0x2945('0x21')](_0x12e5e1,_0x4d1cf8,!![]);}catch(_0x5ce812){return BPromise[_0x2945('0x22')](_0x5ce812);}return _0x12e5e1['save']();};}function saveUpdates(_0x5933fe,_0x11687b){return function(_0x2d582e){if(_0x2d582e){return _0x2d582e[_0x2945('0x23')](_0x5933fe)[_0x2945('0x24')](function(_0xd40a2e){return _0xd40a2e;});}return null;};}function removeEntity(_0x56dc45,_0x5c522f){return function(_0x1550be){if(_0x1550be){return _0x1550be[_0x2945('0x25')]()[_0x2945('0x24')](function(){_0x56dc45[_0x2945('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x567be9,_0x316e3){return function(_0x44446c){if(!_0x44446c){_0x567be9[_0x2945('0x17')](0x194);}return _0x44446c;};}function handleError(_0x5133cc,_0x5c1f73){_0x5c1f73=_0x5c1f73||0x1f4;return function(_0x142c97){logger[_0x2945('0x26')](_0x142c97['stack']);if(_0x142c97[_0x2945('0x27')]){delete _0x142c97[_0x2945('0x27')];}_0x5133cc[_0x2945('0x18')](_0x5c1f73)['send'](_0x142c97);};}exports[_0x2945('0x28')]=function(_0x251ab1,_0xcb57b9){var _0x55672e={},_0xee1b16={},_0x151d82={'count':0x0,'rows':[]};var _0x384b48=_[_0x2945('0x29')](db[_0x2945('0x2a')]['rawAttributes'],function(_0x687ec2){return{'name':_0x687ec2[_0x2945('0x2b')],'type':_0x687ec2[_0x2945('0x2c')]['key']};});_0xee1b16[_0x2945('0x2d')]=_[_0x2945('0x29')](_0x384b48,_0x2945('0x27'));_0xee1b16[_0x2945('0x2e')]=_[_0x2945('0x2f')](_0x251ab1[_0x2945('0x2e')]);_0xee1b16[_0x2945('0x30')]=_[_0x2945('0x31')](_0xee1b16[_0x2945('0x2d')],_0xee1b16['query']);_0x55672e[_0x2945('0x32')]=_[_0x2945('0x31')](_0xee1b16['model'],qs[_0x2945('0x33')](_0x251ab1[_0x2945('0x2e')][_0x2945('0x33')]));_0x55672e['attributes']=_0x55672e['attributes'][_0x2945('0x34')]?_0x55672e[_0x2945('0x32')]:_0xee1b16[_0x2945('0x2d')];if(!_0x251ab1[_0x2945('0x2e')][_0x2945('0x35')](_0x2945('0x36'))){_0x55672e[_0x2945('0x1d')]=qs[_0x2945('0x1d')](_0x251ab1[_0x2945('0x2e')][_0x2945('0x1d')]);_0x55672e['offset']=qs['offset'](_0x251ab1[_0x2945('0x2e')][_0x2945('0x1b')]);}_0x55672e['order']=qs['sort'](_0x251ab1[_0x2945('0x2e')]['sort']);_0x55672e[_0x2945('0x37')]=qs[_0x2945('0x30')](_[_0x2945('0x38')](_0x251ab1[_0x2945('0x2e')],_0xee1b16[_0x2945('0x30')]),_0x384b48);if(_0x251ab1['query']['filter']){_0x55672e[_0x2945('0x37')]=_['merge'](_0x55672e['where'],{'$or':_[_0x2945('0x29')](_0x384b48,function(_0x56e15){if(_0x56e15[_0x2945('0x2c')]!==_0x2945('0x39')){var _0x1a5895={};_0x1a5895[_0x56e15[_0x2945('0x27')]]={'$like':'%'+_0x251ab1[_0x2945('0x2e')][_0x2945('0x3a')]+'%'};return _0x1a5895;}})});}_0x55672e=_[_0x2945('0x3b')]({},_0x55672e,_0x251ab1[_0x2945('0x3c')]);var _0x1c80eb={'where':_0x55672e['where']};return db['FaxApplication'][_0x2945('0x1e')](_0x1c80eb)[_0x2945('0x24')](function(_0xf5b46b){_0x151d82[_0x2945('0x1e')]=_0xf5b46b;if(_0x251ab1[_0x2945('0x2e')][_0x2945('0x3d')]){_0x55672e[_0x2945('0x3e')]=[{'all':!![]}];}return db[_0x2945('0x2a')]['findAll'](_0x55672e);})[_0x2945('0x24')](function(_0xd2e92a){_0x151d82['rows']=_0xd2e92a;return _0x151d82;})[_0x2945('0x24')](respondWithFilteredResult(_0xcb57b9,_0x55672e))['catch'](handleError(_0xcb57b9,null));};exports[_0x2945('0x3f')]=function(_0x11fe8f,_0x14c700){var _0x5e081f={'raw':!![],'where':{'id':_0x11fe8f[_0x2945('0x40')]['id']}},_0xa2aaa0={};_0xa2aaa0[_0x2945('0x2d')]=_[_0x2945('0x2f')](db[_0x2945('0x2a')][_0x2945('0x41')]);_0xa2aaa0['query']=_[_0x2945('0x2f')](_0x11fe8f[_0x2945('0x2e')]);_0xa2aaa0[_0x2945('0x30')]=_[_0x2945('0x31')](_0xa2aaa0[_0x2945('0x2d')],_0xa2aaa0['query']);_0x5e081f[_0x2945('0x32')]=_[_0x2945('0x31')](_0xa2aaa0['model'],qs[_0x2945('0x33')](_0x11fe8f[_0x2945('0x2e')]['fields']));_0x5e081f[_0x2945('0x32')]=_0x5e081f[_0x2945('0x32')]['length']?_0x5e081f[_0x2945('0x32')]:_0xa2aaa0['model'];if(_0x11fe8f[_0x2945('0x2e')]['includeAll']){_0x5e081f[_0x2945('0x3e')]=[{'all':!![]}];}_0x5e081f=_[_0x2945('0x3b')]({},_0x5e081f,_0x11fe8f[_0x2945('0x3c')]);return db['FaxApplication'][_0x2945('0x42')](_0x5e081f)['then'](handleEntityNotFound(_0x14c700,null))[_0x2945('0x24')](respondWithResult(_0x14c700,null))['catch'](handleError(_0x14c700,null));};exports[_0x2945('0x43')]=function(_0x2ec6e5,_0x2f5dc2){return db[_0x2945('0x2a')][_0x2945('0x43')](_0x2ec6e5[_0x2945('0x44')],{})[_0x2945('0x24')](respondWithResult(_0x2f5dc2,0xc9))['catch'](handleError(_0x2f5dc2,null));};exports[_0x2945('0x23')]=function(_0x45c18c,_0x541f1e){if(_0x45c18c[_0x2945('0x44')]['id']){delete _0x45c18c[_0x2945('0x44')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x45c18c[_0x2945('0x40')]['id']}})['then'](handleEntityNotFound(_0x541f1e,null))[_0x2945('0x24')](saveUpdates(_0x45c18c[_0x2945('0x44')],null))[_0x2945('0x24')](respondWithResult(_0x541f1e,null))['catch'](handleError(_0x541f1e,null));};exports[_0x2945('0x25')]=function(_0x56b15e,_0x2aca85){return db[_0x2945('0x2a')][_0x2945('0x42')]({'where':{'id':_0x56b15e[_0x2945('0x40')]['id']}})[_0x2945('0x24')](handleEntityNotFound(_0x2aca85,null))[_0x2945('0x24')](removeEntity(_0x2aca85,null))['catch'](handleError(_0x2aca85,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 31998b6..7ac13f8 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 _0xdbcf=['../../config/environment','./faxApplication.attributes','exports','FaxApplication','utf8mb4_unicode_ci','util','../../config/logger','api','moment','path','rimraf'];(function(_0x368587,_0x1b6554){var _0x42d33c=function(_0xfdccf){while(--_0xfdccf){_0x368587['push'](_0x368587['shift']());}};_0x42d33c(++_0x1b6554);}(_0xdbcf,0xec));var _0xfdbc=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xdbcf[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0xfdbc('0x0'));var logger=require(_0xfdbc('0x1'))(_0xfdbc('0x2'));var moment=require(_0xfdbc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdbc('0x4'));var rimraf=require(_0xfdbc('0x5'));var config=require(_0xfdbc('0x6'));var attributes=require(_0xfdbc('0x7'));module[_0xfdbc('0x8')]=function(_0x709c2f,_0x918b00){return _0x709c2f['define'](_0xfdbc('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xfdbc('0xa')});}; \ No newline at end of file +var _0x7acf=['../../config/logger','api','moment','bluebird','request-promise','rimraf','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x459d35,_0x343bc8){var _0x53414d=function(_0x3bf0da){while(--_0x3bf0da){_0x459d35['push'](_0x459d35['shift']());}};_0x53414d(++_0x343bc8);}(_0x7acf,0xca));var _0xf7ac=function(_0x2d96d1,_0x192cc1){_0x2d96d1=_0x2d96d1-0x0;var _0x189546=_0x7acf[_0x2d96d1];return _0x189546;};'use strict';var _=require(_0xf7ac('0x0'));var util=require(_0xf7ac('0x1'));var logger=require(_0xf7ac('0x2'))(_0xf7ac('0x3'));var moment=require(_0xf7ac('0x4'));var BPromise=require(_0xf7ac('0x5'));var rp=require(_0xf7ac('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf7ac('0x7'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module['exports']=function(_0x3cb71f,_0x4151fc){return _0x3cb71f['define'](_0xf7ac('0x8'),attributes,{'tableName':_0xf7ac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf7ac('0xa'),'collate':_0xf7ac('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 28662d2..b33b3a0 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 _0x1159=['FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','info','debug','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1159,0xf3));var _0x9115=function(_0x5a88ab,_0x3e2ce9){_0x5a88ab=_0x5a88ab-0x0;var _0x25b5c1=_0x1159[_0x5a88ab];return _0x25b5c1;};'use strict';var _=require(_0x9115('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9115('0x1'));var rs=require(_0x9115('0x2'));var fs=require('fs');var Redis=require(_0x9115('0x3'));var db=require(_0x9115('0x4'))['db'];var utils=require(_0x9115('0x5'));var logger=require(_0x9115('0x6'))(_0x9115('0x7'));var config=require(_0x9115('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9115('0x9')][_0x9115('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22bf7f,_0x55e62e,_0x27b1ca){return new BPromise(function(_0x1f69c2,_0x42c577){return client['request'](_0x22bf7f,_0x27b1ca)[_0x9115('0xb')](function(_0x121723){logger['info']('FaxApplication,\x20%s,\x20%s',_0x55e62e,_0x9115('0xc'));logger['debug'](_0x9115('0xd'),_0x55e62e,_0x9115('0xc'),JSON[_0x9115('0xe')](_0x121723));if(_0x121723[_0x9115('0xf')]){if(_0x121723['error'][_0x9115('0x10')]===0x1f4){logger[_0x9115('0xf')](_0x9115('0x11'),_0x55e62e,_0x121723[_0x9115('0xf')][_0x9115('0x12')]);return _0x42c577(_0x121723[_0x9115('0xf')][_0x9115('0x12')]);}logger[_0x9115('0xf')](_0x9115('0x11'),_0x55e62e,_0x121723['error'][_0x9115('0x12')]);return _0x1f69c2(_0x121723['error'][_0x9115('0x12')]);}else{logger['info'](_0x9115('0x11'),_0x55e62e,_0x9115('0xc'));_0x1f69c2(_0x121723[_0x9115('0x13')]['message']);}})['catch'](function(_0x5c1022){logger['error'](_0x9115('0x11'),_0x55e62e,_0x5c1022);_0x42c577(_0x5c1022);});});}exports[_0x9115('0x14')]=function(_0x2ade35){var _0x157ad2=this;return new Promise(function(_0x5752a3,_0x31ebb3){return db[_0x9115('0x15')][_0x9115('0x16')](_0x2ade35[_0x9115('0x17')],{'raw':_0x2ade35[_0x9115('0x18')]?_0x2ade35[_0x9115('0x18')][_0x9115('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ade35[_0x9115('0x18')]?_0x2ade35[_0x9115('0x18')][_0x9115('0x1a')]||null:null,'attributes':_0x2ade35[_0x9115('0x18')]?_0x2ade35['options'][_0x9115('0x1b')]||null:null,'limit':_0x2ade35[_0x9115('0x18')]?_0x2ade35[_0x9115('0x18')][_0x9115('0x1c')]||null:null})[_0x9115('0xb')](function(_0xa06aa8){logger[_0x9115('0x1d')](_0x9115('0x14'),_0x2ade35);logger[_0x9115('0x1e')](_0x9115('0x14'),_0x2ade35,JSON[_0x9115('0xe')](_0xa06aa8));_0x5752a3(_0xa06aa8);})[_0x9115('0x1f')](function(_0x3c4c08){logger[_0x9115('0xf')](_0x9115('0x14'),_0x3c4c08[_0x9115('0x12')],_0x2ade35);_0x31ebb3(_0x157ad2[_0x9115('0xf')](0x1f4,_0x3c4c08[_0x9115('0x12')]));});});}; \ No newline at end of file +var _0xdf98=['stringify','error','code','message','result','catch','UpdateFaxApplication','body','options','raw','attributes','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0xdf98,0xcf));var _0x8df9=function(_0x53be66,_0x9ec3be){_0x53be66=_0x53be66-0x0;var _0x9e5520=_0xdf98[_0x53be66];return _0x9e5520;};'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});function respondWithRpcPromise(_0x5e79af,_0x1ffe3b,_0x393533){return new BPromise(function(_0x410568,_0x48bc8e){return client['request'](_0x5e79af,_0x393533)[_0x8df9('0xb')](function(_0x513b37){logger[_0x8df9('0xc')](_0x8df9('0xd'),_0x1ffe3b,_0x8df9('0xe'));logger[_0x8df9('0xf')](_0x8df9('0x10'),_0x1ffe3b,_0x8df9('0xe'),JSON[_0x8df9('0x11')](_0x513b37));if(_0x513b37[_0x8df9('0x12')]){if(_0x513b37['error'][_0x8df9('0x13')]===0x1f4){logger[_0x8df9('0x12')](_0x8df9('0xd'),_0x1ffe3b,_0x513b37['error'][_0x8df9('0x14')]);return _0x48bc8e(_0x513b37[_0x8df9('0x12')][_0x8df9('0x14')]);}logger[_0x8df9('0x12')]('FaxApplication,\x20%s,\x20%s',_0x1ffe3b,_0x513b37['error'][_0x8df9('0x14')]);return _0x410568(_0x513b37[_0x8df9('0x12')][_0x8df9('0x14')]);}else{logger['info'](_0x8df9('0xd'),_0x1ffe3b,'request\x20sent');_0x410568(_0x513b37[_0x8df9('0x15')]['message']);}})[_0x8df9('0x16')](function(_0x8e547d){logger[_0x8df9('0x12')](_0x8df9('0xd'),_0x1ffe3b,_0x8e547d);_0x48bc8e(_0x8e547d);});});}exports[_0x8df9('0x17')]=function(_0x16e8c4){var _0x5e19e5=this;return new Promise(function(_0x54f2b0,_0x3bf137){return db['FaxApplication']['update'](_0x16e8c4[_0x8df9('0x18')],{'raw':_0x16e8c4[_0x8df9('0x19')]?_0x16e8c4[_0x8df9('0x19')][_0x8df9('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16e8c4[_0x8df9('0x19')]?_0x16e8c4[_0x8df9('0x19')]['where']||null:null,'attributes':_0x16e8c4[_0x8df9('0x19')]?_0x16e8c4[_0x8df9('0x19')][_0x8df9('0x1b')]||null:null,'limit':_0x16e8c4['options']?_0x16e8c4['options']['limit']||null:null})['then'](function(_0x5f210e){logger[_0x8df9('0xc')](_0x8df9('0x17'),_0x16e8c4);logger[_0x8df9('0xf')](_0x8df9('0x17'),_0x16e8c4,JSON[_0x8df9('0x11')](_0x5f210e));_0x54f2b0(_0x5f210e);})[_0x8df9('0x16')](function(_0x85eff4){logger[_0x8df9('0x12')]('UpdateFaxApplication',_0x85eff4[_0x8df9('0x14')],_0x16e8c4);_0x3bf137(_0x5e19e5[_0x8df9('0x12')](0x1f4,_0x85eff4[_0x8df9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 46ed206..e41b21c 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 _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x218dd8,_0x46df98){var _0x3de3f2=function(_0xeb2f61){while(--_0xeb2f61){_0x218dd8['push'](_0x218dd8['shift']());}};_0x3de3f2(++_0x46df98);}(_0xda3f,0xec));var _0xfda3=function(_0x5f18fa,_0x5ea78c){_0x5f18fa=_0x5f18fa-0x0;var _0x78f596=_0xda3f[_0x5f18fa];return _0x78f596;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./faxApplication.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file +var _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxApplication.controller'];(function(_0x208429,_0x3f8848){var _0x406352=function(_0x2a8203){while(--_0x2a8203){_0x208429['push'](_0x208429['shift']());}};_0x406352(++_0x3f8848);}(_0x14a0,0x8e));var _0x014a=function(_0x418d7a,_0x2cb736){_0x418d7a=_0x418d7a-0x0;var _0x1ca903=_0x14a0[_0x418d7a];return _0x1ca903;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 7ddbea6..1fbb2c1 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 _0x1a84=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x55d58f,_0x2bea83){var _0x1ad6e6=function(_0x31447e){while(--_0x31447e){_0x55d58f['push'](_0x55d58f['shift']());}};_0x1ad6e6(++_0x2bea83);}(_0x1a84,0x99));var _0x41a8=function(_0x12d928,_0x3dbd03){_0x12d928=_0x12d928-0x0;var _0x335fc6=_0x1a84[_0x12d928];return _0x335fc6;};'use strict';var Sequelize=require(_0x41a8('0x0'));module[_0x41a8('0x1')]={'closed':{'type':Sequelize[_0x41a8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x41a8('0x3')]},'disposition':{'type':Sequelize[_0x41a8('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x41a8('0x4')]},'note':{'type':Sequelize[_0x41a8('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x41a8('0x5')]('in',_0x41a8('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x41a8('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x25dd=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x23b12b,_0x554134){var _0x589478=function(_0x2a140e){while(--_0x2a140e){_0x23b12b['push'](_0x23b12b['shift']());}};_0x589478(++_0x554134);}(_0x25dd,0x116));var _0xd25d=function(_0x3b76e2,_0xab942b){_0x3b76e2=_0x3b76e2-0x0;var _0x2891cf=_0x25dd[_0x3b76e2];return _0x2891cf;};'use strict';var Sequelize=require(_0xd25d('0x0'));module[_0xd25d('0x1')]={'closed':{'type':Sequelize[_0xd25d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd25d('0x3')]},'disposition':{'type':Sequelize[_0xd25d('0x4')]},'secondDisposition':{'type':Sequelize[_0xd25d('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd25d('0x4')]},'read1stAt':{'type':Sequelize[_0xd25d('0x3')]},'fax':{'type':Sequelize[_0xd25d('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xd25d('0x5')]('in',_0xd25d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd25d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xd25d('0x5')]('in',_0xd25d('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 7a1bf52..bf4afdf 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 _0x2f49=['transcript-%d-%s.zip','Attachment','Messages','basename','existsSync','pipe','createWriteStream','log','unlinkSync','eml-format','rimraf','zip-dir','mustache','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./faxInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','unmanaged','closed','UserId','total','FaxInteraction','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','text','body','some','compact','isEmpty','FaxAccountId','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','agent','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','contactName','i.*','c.firstName','c.lastName','c.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','all','rows','show','params','includeAll','include','options','create','destroy','describe','addMessage','ids','omit','getMessages','FaxMessage','filter','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','emit','faxInteractionTags:save','removeTags','download','join','root','server','tmp','attachments'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f49,0xdc));var _0x92f4=function(_0x244b0c,_0x42dc47){_0x244b0c=_0x244b0c-0x0;var _0x33f49b=_0x2f49[_0x244b0c];return _0x33f49b;};'use strict';var emlformat=require(_0x92f4('0x0'));var rimraf=require(_0x92f4('0x1'));var zipdir=require(_0x92f4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x92f4('0x3'));var util=require('util');var path=require(_0x92f4('0x4'));var sox=require(_0x92f4('0x5'));var csv=require(_0x92f4('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x92f4('0x7'));var _=require(_0x92f4('0x8'));var squel=require('squel');var crypto=require(_0x92f4('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x92f4('0xa'));var toCsv=require(_0x92f4('0x6'));var querystring=require(_0x92f4('0xb'));var Papa=require(_0x92f4('0xc'));var Redis=require('ioredis');var authService=require(_0x92f4('0xd'));var qs=require(_0x92f4('0xe'));var as=require(_0x92f4('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x92f4('0x10'))('api');var utils=require(_0x92f4('0x11'));var config=require(_0x92f4('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x92f4('0x13'))['db'];config[_0x92f4('0x14')]=_['defaults'](config[_0x92f4('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x92f4('0x15'))(new Redis(config[_0x92f4('0x14')]));require(_0x92f4('0x16'))[_0x92f4('0x17')](socket);function respondWithStatusCode(_0x45533b,_0x4bc456){_0x4bc456=_0x4bc456||0xcc;return function(_0x471410){if(_0x471410){return _0x45533b['sendStatus'](_0x4bc456);}return _0x45533b[_0x92f4('0x18')](_0x4bc456)['end']();};}function respondWithResult(_0x3214a9,_0x520fc6){_0x520fc6=_0x520fc6||0xc8;return function(_0x33d62e){if(_0x33d62e){return _0x3214a9[_0x92f4('0x18')](_0x520fc6)[_0x92f4('0x19')](_0x33d62e);}};}function respondWithFilteredResult(_0x3efada,_0x43696c){return function(_0x3d3df5){if(_0x3d3df5){var _0x511942=typeof _0x43696c[_0x92f4('0x1a')]===_0x92f4('0x1b')&&typeof _0x43696c[_0x92f4('0x1c')]===_0x92f4('0x1b');var _0x489d50=_0x3d3df5['count'];var _0x3cbef5=_0x511942?0x0:_0x43696c[_0x92f4('0x1a')];var _0x3dc91d=_0x511942?_0x3d3df5[_0x92f4('0x1d')]:_0x43696c[_0x92f4('0x1a')]+_0x43696c['limit'];var _0x5baf92;if(_0x3dc91d>=_0x489d50){_0x3dc91d=_0x489d50;_0x5baf92=0xc8;}else{_0x5baf92=0xce;}_0x3efada[_0x92f4('0x18')](_0x5baf92);return _0x3efada[_0x92f4('0x1e')](_0x92f4('0x1f'),_0x3cbef5+'-'+_0x3dc91d+'/'+_0x489d50)[_0x92f4('0x19')](_0x3d3df5);}return null;};}function patchUpdates(_0xdfbd30){return function(_0x5f0752){try{jsonpatch['apply'](_0x5f0752,_0xdfbd30,!![]);}catch(_0x32c204){return BPromise['reject'](_0x32c204);}return _0x5f0752['save']();};}function saveUpdates(_0x42cf6f,_0x1fcefd){return function(_0x3b1f52){if(_0x3b1f52){return _0x3b1f52[_0x92f4('0x20')](_0x42cf6f)[_0x92f4('0x21')](function(_0x56a9f3){return _0x56a9f3;});}return null;};}function removeEntity(_0x57944b,_0x77809e){return function(_0xa151ba){if(_0xa151ba){return _0xa151ba['destroy']()[_0x92f4('0x21')](function(){_0x57944b[_0x92f4('0x18')](0xcc)[_0x92f4('0x22')]();});}};}function handleEntityNotFound(_0x337585,_0x170041){return function(_0x4ec091){if(!_0x4ec091){_0x337585[_0x92f4('0x23')](0x194);}return _0x4ec091;};}function handleError(_0x535691,_0x9e4dc8){_0x9e4dc8=_0x9e4dc8||0x1f4;return function(_0x228f56){logger[_0x92f4('0x24')](_0x228f56[_0x92f4('0x25')]);if(_0x228f56[_0x92f4('0x26')]){delete _0x228f56[_0x92f4('0x26')];}_0x535691['status'](_0x9e4dc8)[_0x92f4('0x27')](_0x228f56);};}function getInteractionUsers(_0x2b967e,_0x135e58){return new BPromise(function(_0x45b116,_0x203abe){try{if(_0x135e58[_0x2b967e['id']]){_0x2b967e[_0x92f4('0x28')]=_[_0x92f4('0x29')](_0x135e58[_0x2b967e['id']],function(_0x343410){return{'id':_0x343410['id'],'fullname':_0x343410[_0x92f4('0x2a')]};});}}catch(_0x53466c){_0x203abe(_0x53466c);}_0x45b116(_0x2b967e);});}function getInteractionTags(_0x2e674c,_0x2746b2){return new BPromise(function(_0x3c9f95,_0x539e5c){try{if(_0x2e674c[_0x92f4('0x2b')]){_0x2e674c[_0x92f4('0x2c')]=[];_0x2e674c[_0x92f4('0x2b')][_0x92f4('0x2d')](',')[_0x92f4('0x2e')](function(_0xd1a2d6){_0x2e674c['Tags'][_0x92f4('0x2f')](_0x2746b2[_0xd1a2d6]);});}delete _0x2e674c[_0x92f4('0x2b')];}catch(_0x1e2cbf){_0x539e5c(_0x1e2cbf);}_0x3c9f95(_0x2e674c);});}function updateFaxInteraction(_0x12c876,_0x12f009,_0x18ee8b){return new BPromise(function(_0x5e1c2a,_0x3d55b0){return getInteractionUsers(_0x12c876,_0x18ee8b)[_0x92f4('0x21')](function(_0x1e64f3){return getInteractionTags(_0x1e64f3,_0x12f009);})[_0x92f4('0x21')](function(_0x798fd){return getStateInteraction(_0x798fd);})[_0x92f4('0x21')](function(_0x398437){_0x5e1c2a(_0x398437);})[_0x92f4('0x30')](function(_0x38d993){_0x3d55b0(_0x38d993);});});}function getStateInteraction(_0x40c96e){return new BPromise(function(_0x420dda){_0x40c96e[_0x92f4('0x31')]=0x0;_0x40c96e[_0x92f4('0x32')]=0x0;_0x40c96e[_0x92f4('0x33')]=0x0;_0x40c96e[_0x92f4('0x34')]=0x0;_0x40c96e['total']=0x0;if(!_0x40c96e[_0x92f4('0x35')]&&!_0x40c96e['UserId']){_0x40c96e['waiting']+=0x1;}if(!_0x40c96e[_0x92f4('0x35')]&&_0x40c96e[_0x92f4('0x36')]){_0x40c96e[_0x92f4('0x32')]+=0x1;if(_0x40c96e[_0x92f4('0x31')]){_0x40c96e['waiting']-=0x1;}}if(_0x40c96e[_0x92f4('0x35')]&&_0x40c96e[_0x92f4('0x36')]){_0x40c96e[_0x92f4('0x33')]+=0x1;if(_0x40c96e[_0x92f4('0x32')]){_0x40c96e[_0x92f4('0x32')]-=0x1;}}if(_0x40c96e[_0x92f4('0x35')]&&!_0x40c96e[_0x92f4('0x36')]){_0x40c96e[_0x92f4('0x34')]+=0x1;if(_0x40c96e['waiting']){_0x40c96e[_0x92f4('0x31')]-=0x1;}}_0x40c96e[_0x92f4('0x37')]+=0x1;_0x420dda(_0x40c96e);});}exports['index']=function(_0x2c61c6,_0x480028){var _0x48bac9={},_0x5d7d2e={},_0x183a0f={'count':0x0,'rows':[]};var _0x2b28e7=_['map'](db[_0x92f4('0x38')][_0x92f4('0x39')],function(_0x5f26a4){return{'name':_0x5f26a4[_0x92f4('0x3a')],'type':_0x5f26a4[_0x92f4('0x3b')][_0x92f4('0x3c')]};});_0x5d7d2e['model']=_[_0x92f4('0x29')](_0x2b28e7,_0x92f4('0x26'));_0x5d7d2e[_0x92f4('0x3d')]=_[_0x92f4('0x3e')](_0x2c61c6[_0x92f4('0x3d')]);_0x5d7d2e[_0x92f4('0x3f')]=_['intersection'](_0x5d7d2e['model'],_0x5d7d2e['query']);_0x48bac9[_0x92f4('0x40')]=_[_0x92f4('0x41')](_0x5d7d2e[_0x92f4('0x42')],qs[_0x92f4('0x43')](_0x2c61c6[_0x92f4('0x3d')][_0x92f4('0x43')]));_0x48bac9[_0x92f4('0x40')]=_0x48bac9[_0x92f4('0x40')][_0x92f4('0x44')]?_0x48bac9['attributes']:_0x5d7d2e[_0x92f4('0x42')];if(!_0x2c61c6[_0x92f4('0x3d')][_0x92f4('0x45')](_0x92f4('0x46'))){_0x48bac9[_0x92f4('0x1c')]=qs[_0x92f4('0x1c')](_0x2c61c6['query'][_0x92f4('0x1c')]);_0x48bac9['offset']=qs[_0x92f4('0x1a')](_0x2c61c6['query'][_0x92f4('0x1a')]);}_0x48bac9['order']=qs[_0x92f4('0x47')](_0x2c61c6[_0x92f4('0x3d')][_0x92f4('0x47')]);_0x48bac9[_0x92f4('0x48')]=qs[_0x92f4('0x3f')](_[_0x92f4('0x49')](_0x2c61c6[_0x92f4('0x3d')],_0x5d7d2e[_0x92f4('0x3f')]),_0x2b28e7);var _0x49f367=[];var _0x133782=squel[_0x92f4('0x4a')]()[_0x92f4('0x4b')]('id')[_0x92f4('0x4b')](_0x92f4('0x26'))['field'](_0x92f4('0x4c'))[_0x92f4('0x4d')](_0x92f4('0x4e'));var _0xd55ef4=squel['select']()['field'](_0x92f4('0x4f'))[_0x92f4('0x4b')](_0x92f4('0x50'))['field'](_0x92f4('0x51'))[_0x92f4('0x4d')](_0x92f4('0x52'),'ui')[_0x92f4('0x53')](_0x92f4('0x54'),'u',_0x92f4('0x55'));var _0x223227=squel[_0x92f4('0x4a')]()[_0x92f4('0x4d')](_0x92f4('0x56'),'i')[_0x92f4('0x53')](_0x92f4('0x57'),'c',_0x92f4('0x58'))[_0x92f4('0x53')](_0x92f4('0x54'),'o',_0x92f4('0x59'))[_0x92f4('0x53')]('fax_accounts','a',_0x92f4('0x5a'))['left_join'](_0x92f4('0x5b'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x92f4('0x53')](_0x92f4('0x5c'),'it',_0x92f4('0x5d'))[_0x92f4('0x53')](_0x92f4('0x4e'),'t',_0x92f4('0x5e'));var _0x230bde=squel[_0x92f4('0x5f')]();var _0x4a817e=[];var _0x184c4b=squel['expr']();var _0x571a8d;if(_0x2c61c6[_0x92f4('0x3d')][_0x92f4('0x60')]){_0x571a8d=as[_0x92f4('0x61')](_0x2c61c6[_0x92f4('0x3d')][_0x92f4('0x60')]);var _0x2bdd5f=_0x571a8d['sqlOperator'];for(var _0x283e6e=0x0;_0x283e6e<_0x571a8d[_0x92f4('0x62')][_0x92f4('0x44')];_0x283e6e++){var _0x2167c4=_0x571a8d[_0x92f4('0x62')][_0x283e6e];var _0xc953b3='i';var _0x1d0df5=_[_0x92f4('0x63')](_0x2b28e7,['name',_0x2167c4[_0x92f4('0x4b')]]);if(!_0x1d0df5){switch(_0x2167c4[_0x92f4('0x4b')]){case'unreadMessages':if(_0x2167c4[_0x92f4('0x64')]==0x1){_0x223227[_0x92f4('0x65')]('`'+_0x2167c4[_0x92f4('0x4b')]+_0x92f4('0x66'));}else{_0x223227[_0x92f4('0x65')]('`'+_0x2167c4[_0x92f4('0x4b')]+_0x92f4('0x67'));}break;case _0x92f4('0x68'):if(_0x2167c4[_0x92f4('0x69')]===_0x92f4('0x6a')){if(_0x2167c4[_0x92f4('0x64')]['split']('\x20')[_0x92f4('0x44')]>0x1){_0x230bde[_0x2bdd5f]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x92f4('0x6b')](_0x2167c4['value']),null);}else{var _0x28f2a8='%'+_0x2167c4[_0x92f4('0x64')]+'%';_0x230bde[_0x2bdd5f](_0x92f4('0x6c'),_0x28f2a8,_0x28f2a8,_0x28f2a8);}}else{_0x1d0df5=_[_0x92f4('0x63')](_0x2b28e7,[_0x92f4('0x26'),'ContactId']);_0x2167c4[_0x92f4('0x4b')]=_0x92f4('0x6d');_0x307681=as['buildExpression'](_0xc953b3,_0x1d0df5[_0x92f4('0x3b')],_0x2167c4);_0x230bde[_0x2bdd5f](_0x307681['text'],_0x307681['value'][_0x92f4('0x6e')],_0x307681[_0x92f4('0x64')]['end']);}break;case'Tag':var _0x22b11b=_0x2167c4[_0x92f4('0x64')][_0x92f4('0x2d')](',')[_0x92f4('0x29')](function(_0x56ea31){return Number(_0x56ea31);});_0x22b11b[_0x92f4('0x2e')](function(_0x228526){_0x184c4b['or'](_0x92f4('0x6f'),'%,'+_0x228526+',%');});_0x4a817e=_[_0x92f4('0x70')](_0x4a817e,_0x22b11b);break;case _0x92f4('0x71'):if(_0x2167c4[_0x92f4('0x69')]==='$substring'){_0x230bde[_0x2bdd5f](_0x92f4('0x72'),'%'+_0x2167c4[_0x92f4('0x64')]+'%',null);}else{_0x1d0df5=_[_0x92f4('0x63')](_0x2b28e7,['name',_0x92f4('0x36')]);_0x2167c4[_0x92f4('0x4b')]='UserId';_0x307681=as[_0x92f4('0x73')](_0xc953b3,_0x1d0df5[_0x92f4('0x3b')],_0x2167c4);_0x230bde[_0x2bdd5f](_0x307681[_0x92f4('0x74')],_0x307681['value'][_0x92f4('0x6e')],_0x307681[_0x92f4('0x64')][_0x92f4('0x22')]);}break;case _0x92f4('0x75'):_0x307681=as[_0x92f4('0x73')]('me',null,_0x2167c4);_0x230bde[_0x2bdd5f](_0x307681[_0x92f4('0x74')],_0x307681['value']['start'],_0x307681[_0x92f4('0x64')][_0x92f4('0x22')]);break;}}else{var _0x307681=as[_0x92f4('0x73')](_0xc953b3,_0x1d0df5[_0x92f4('0x3b')],_0x2167c4);_0x230bde[_0x2bdd5f](_0x307681[_0x92f4('0x74')],_0x307681[_0x92f4('0x64')]['start'],_0x307681[_0x92f4('0x64')][_0x92f4('0x22')]);}}}else{var _0xd46f9=_(_0x2c61c6[_0x92f4('0x3d')])[_0x92f4('0x3e')]()[_0x92f4('0x29')](function(_0xaf9ba0){return _[_0x92f4('0x76')](_0x2b28e7,['name',_0xaf9ba0])?_0xaf9ba0:undefined;})[_0x92f4('0x77')]()[_0x92f4('0x64')]();if(!_[_0x92f4('0x78')](_0xd46f9)){_0xd46f9[_0x92f4('0x2e')](function(_0x29d025){if(_0x29d025===_0x92f4('0x79')){_0x223227['where']('i.FaxAccountId\x20IN\x20?',[]['concat'](_0x2c61c6[_0x92f4('0x3d')][_0x29d025]));}else if(_0x29d025==='createdAt'){var _0x4100da=JSON[_0x92f4('0x7a')](_0x2c61c6[_0x92f4('0x3d')][_0x29d025])[_0x92f4('0x7b')];var _0x598818=JSON[_0x92f4('0x7a')](_0x2c61c6['query'][_0x29d025])[_0x92f4('0x7c')];_0x223227[_0x92f4('0x48')](_0x92f4('0x7d'),_0x4100da,_0x598818);}else{if(_0x2c61c6[_0x92f4('0x3d')][_0x29d025]==='null'){_0x223227[_0x92f4('0x48')]('i.'+_0x29d025+_0x92f4('0x7e'));}else{_0x223227[_0x92f4('0x48')]('i.'+_0x29d025+_0x92f4('0x7f'),_0x2c61c6[_0x92f4('0x3d')][_0x29d025]);}}});}if(_0x2c61c6[_0x92f4('0x3d')][_0x92f4('0x80')]){if(_0x2c61c6[_0x92f4('0x3d')][_0x92f4('0x80')]==0x1){_0x223227[_0x92f4('0x65')](_0x92f4('0x81'));}else{_0x223227[_0x92f4('0x65')](_0x92f4('0x82'));}}if(_0x2c61c6[_0x92f4('0x3d')][_0x92f4('0x83')]){_0x4a817e=_['isArray'](_0x2c61c6[_0x92f4('0x3d')]['tag'])?_0x2c61c6[_0x92f4('0x3d')]['tag']:new Array(_0x2c61c6[_0x92f4('0x3d')]['tag']);_0x4a817e[_0x92f4('0x2e')](function(_0x217ac5){_0x184c4b['or'](_0x92f4('0x6f'),'%,'+_0x217ac5+',%');});}if(_0x2c61c6['query']['filter']){var _0x103452=_0x2c61c6[_0x92f4('0x3d')]['filter'][_0x92f4('0x84')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x92f4('0x85')](_0x103452)){_0x230bde['or'](_0x92f4('0x86'),_0x103452+'%')['or']('i.fax\x20LIKE\x20?',_0x103452+'%');}_0x230bde['or'](_0x92f4('0x87'),_0x103452+'%');}}_0x223227[_0x92f4('0x48')](_0x230bde);_0x223227[_0x92f4('0x88')]('i.id');var _0x437711={'type':db['Sequelize'][_0x92f4('0x89')][_0x92f4('0x8a')],'raw':!![]};var _0x1467a5=_0x223227[_0x92f4('0x8b')]();_0x1467a5[_0x92f4('0x4b')](_0x92f4('0x8c'));_0x1467a5[_0x92f4('0x4b')](_0x92f4('0x8d'),_0x92f4('0x8e'));if(_0x48bac9[_0x92f4('0x8f')]){_0x48bac9[_0x92f4('0x8f')][_0x92f4('0x2e')](function(_0x43d955){var _0x28897f=_0x43d955[0x0]==='contactName'?_0x43d955[0x0]:'i.'+_0x43d955[0x0];_0x223227[_0x92f4('0x8f')](_0x28897f,_0x43d955[0x1]==='DESC'?![]:!![]);});}if(!_[_0x92f4('0x78')](_0x4a817e)){_0x223227['having'](_0x184c4b);_0x1467a5[_0x92f4('0x48')](_0x92f4('0x90'),_0x4a817e);}BPromise[_0x92f4('0x91')]()[_0x92f4('0x21')](function(){if(!_0x571a8d){if(_0x2c61c6[_0x92f4('0x3d')][_0x92f4('0x79')])return;_0x1467a5[_0x92f4('0x48')](_0x92f4('0x92'));_0x223227[_0x92f4('0x48')](_0x92f4('0x92'));return;}if(_0x2c61c6[_0x92f4('0x93')][_0x92f4('0x94')]!=='agent')return;return _0x2c61c6['user'][_0x92f4('0x95')]({'attributes':['id'],'raw':!![]})[_0x92f4('0x21')](function(_0x1fad3b){if(_[_0x92f4('0x78')](_0x1fad3b)){_0x1467a5[_0x92f4('0x48')](_0x92f4('0x96'));_0x223227[_0x92f4('0x48')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x1467a5['where'](_0x92f4('0x97'),_[_0x92f4('0x29')](_0x1fad3b,'id'));_0x223227['where']('i.FaxAccountId\x20IN\x20?',_[_0x92f4('0x29')](_0x1fad3b,'id'));}});})[_0x92f4('0x21')](function(){if(_0x2c61c6['user']['role']===_0x92f4('0x98')&&!_0x571a8d&&!_0x2c61c6[_0x92f4('0x3d')][_0x92f4('0x79')])return[];return db[_0x92f4('0x99')][_0x92f4('0x3d')](_0x1467a5[_0x92f4('0x9a')](),_0x437711);})[_0x92f4('0x21')](function(_0x237524){_0x183a0f[_0x92f4('0x1d')]=_0x237524[_0x92f4('0x44')];if(_0x183a0f[_0x92f4('0x1d')]===0x0)return[];return db[_0x92f4('0x99')]['query'](_0x133782[_0x92f4('0x9a')](),_0x437711)[_0x92f4('0x21')](function(_0x343c8c){_0x49f367=_[_0x92f4('0x9b')](_0x343c8c,'id');_0x437711=_[_0x92f4('0x9c')](_0x437711,{'model':db[_0x92f4('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2c61c6[_0x92f4('0x3d')][_0x92f4('0x43')]){_0x48bac9[_0x92f4('0x40')][_0x92f4('0x2e')](function(_0x104fbb){_0x223227['field']('i.'+_0x104fbb);});}else{_0x223227['field'](_0x92f4('0x8d'),_0x92f4('0x8e'));_0x223227['field'](_0x92f4('0x9d'),_0x92f4('0x9e'));_0x223227['field']('a.mandatoryDisposition',_0x92f4('0x9f'));_0x223227[_0x92f4('0x4b')]('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',_0x92f4('0xa0'));_0x223227[_0x92f4('0x4b')](_0x92f4('0xa1'));_0x223227['field'](_0x92f4('0xa2'),'Contact.firstName');_0x223227[_0x92f4('0x4b')](_0x92f4('0xa3'),'Contact.lastName');_0x223227[_0x92f4('0x4b')](_0x92f4('0xa4'),'Contact.email');_0x223227['field'](_0x92f4('0xa5'),'Contact.phone');_0x223227[_0x92f4('0x4b')]('c.mobile',_0x92f4('0xa6'));_0x223227['field'](_0x92f4('0xa7'),_0x92f4('0xa8'));_0x223227['field'](_0x92f4('0xa9'),_0x92f4('0xaa'));_0x223227[_0x92f4('0x4b')]('o.internal','Owner.internal');_0x223227[_0x92f4('0x4b')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x92f4('0x2b'));}if(_0x48bac9['limit'])_0x223227['limit'](_0x48bac9[_0x92f4('0x1c')]);if(_0x48bac9[_0x92f4('0x1a')])_0x223227[_0x92f4('0x1a')](_0x48bac9[_0x92f4('0x1a')]);return db['sequelize'][_0x92f4('0x3d')](_0x223227[_0x92f4('0x9a')](),_0x437711);})[_0x92f4('0x21')](function(_0x2bce8d){if(_0x2bce8d['length']>0x0)_0xd55ef4['where'](_0x92f4('0xab'),_['map'](_0x2bce8d,'id'));return db[_0x92f4('0x99')][_0x92f4('0x3d')](_0xd55ef4[_0x92f4('0x9a')](),_0x437711)[_0x92f4('0x21')](function(_0x1e5e0a){var _0x2e5011=_['groupBy'](_0x1e5e0a,_0x92f4('0xac'));var _0x48b7e0=[];_0x2bce8d[_0x92f4('0x2e')](function(_0x3f6b72){_0x48b7e0[_0x92f4('0x2f')](updateFaxInteraction(_0x3f6b72,_0x49f367,_0x2e5011));});return BPromise[_0x92f4('0xad')](_0x48b7e0);});});})['then'](function(_0x5ddabc){_0x183a0f[_0x92f4('0xae')]=_0x5ddabc;return _0x183a0f;})[_0x92f4('0x21')](respondWithFilteredResult(_0x480028,_0x48bac9))[_0x92f4('0x30')](handleError(_0x480028,null));};exports[_0x92f4('0xaf')]=function(_0x1d9931,_0x39943b){var _0x5f3057={'raw':![],'where':{'id':_0x1d9931[_0x92f4('0xb0')]['id']}},_0x42f6cf={};_0x42f6cf[_0x92f4('0x42')]=_[_0x92f4('0x3e')](db[_0x92f4('0x38')]['rawAttributes']);_0x42f6cf[_0x92f4('0x3d')]=_[_0x92f4('0x3e')](_0x1d9931[_0x92f4('0x3d')]);_0x42f6cf[_0x92f4('0x3f')]=_['intersection'](_0x42f6cf[_0x92f4('0x42')],_0x42f6cf[_0x92f4('0x3d')]);_0x5f3057[_0x92f4('0x40')]=_[_0x92f4('0x41')](_0x42f6cf[_0x92f4('0x42')],qs['fields'](_0x1d9931['query'][_0x92f4('0x43')]));_0x5f3057[_0x92f4('0x40')]=_0x5f3057[_0x92f4('0x40')][_0x92f4('0x44')]?_0x5f3057['attributes']:_0x42f6cf[_0x92f4('0x42')];if(_0x1d9931[_0x92f4('0x3d')][_0x92f4('0xb1')]){_0x5f3057[_0x92f4('0xb2')]=[{'all':!![]}];}_0x5f3057=_[_0x92f4('0x9c')]({},_0x5f3057,_0x1d9931[_0x92f4('0xb3')]);return db['FaxInteraction']['find'](_0x5f3057)[_0x92f4('0x21')](handleEntityNotFound(_0x39943b,null))[_0x92f4('0x21')](respondWithResult(_0x39943b,null))[_0x92f4('0x30')](handleError(_0x39943b,null));};exports[_0x92f4('0xb4')]=function(_0x5063b5,_0x496aee){return db[_0x92f4('0x38')]['create'](_0x5063b5[_0x92f4('0x75')],{})[_0x92f4('0x21')](respondWithResult(_0x496aee,0xc9))[_0x92f4('0x30')](handleError(_0x496aee,null));};exports[_0x92f4('0x20')]=function(_0x1ff815,_0x26b337){if(_0x1ff815[_0x92f4('0x75')]['id']){delete _0x1ff815['body']['id'];}return db[_0x92f4('0x38')][_0x92f4('0x63')]({'where':{'id':_0x1ff815['params']['id']}})[_0x92f4('0x21')](handleEntityNotFound(_0x26b337,null))[_0x92f4('0x21')](saveUpdates(_0x1ff815[_0x92f4('0x75')],null))[_0x92f4('0x21')](respondWithResult(_0x26b337,null))[_0x92f4('0x30')](handleError(_0x26b337,null));};exports[_0x92f4('0xb5')]=function(_0x2712b2,_0x32e081){return db[_0x92f4('0x38')][_0x92f4('0x63')]({'where':{'id':_0x2712b2[_0x92f4('0xb0')]['id']}})[_0x92f4('0x21')](handleEntityNotFound(_0x32e081,null))[_0x92f4('0x21')](removeEntity(_0x32e081,null))[_0x92f4('0x30')](handleError(_0x32e081,null));};exports[_0x92f4('0xb6')]=function(_0x3ee729,_0x2e38b4){return db['FaxInteraction'][_0x92f4('0xb6')]()[_0x92f4('0x21')](respondWithResult(_0x2e38b4,null))[_0x92f4('0x30')](handleError(_0x2e38b4,null));};exports[_0x92f4('0xb7')]=function(_0x4289b0,_0xe9ec90,_0x3b2bf1){return db['FaxMessage'][_0x92f4('0x63')]({'where':{'id':_0x4289b0['params']['id']}})[_0x92f4('0x21')](handleEntityNotFound(_0xe9ec90,null))[_0x92f4('0x21')](function(_0x29d8b7){if(_0x29d8b7){return _0x29d8b7[_0x92f4('0xb7')](_0x4289b0[_0x92f4('0x75')][_0x92f4('0xb8')],_[_0x92f4('0xb9')](_0x4289b0[_0x92f4('0x75')],[_0x92f4('0xb8'),'id'])||{});}})[_0x92f4('0x21')](respondWithResult(_0xe9ec90,null))[_0x92f4('0x30')](handleError(_0xe9ec90,null));};exports[_0x92f4('0xba')]=function(_0x4e22e7,_0x460a5c,_0x345541){var _0x28f2d4={'raw':![],'where':{}};var _0x589f7b={};var _0x515bf0={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x4e22e7[_0x92f4('0xb0')]['id']}})[_0x92f4('0x21')](handleEntityNotFound(_0x460a5c,null))[_0x92f4('0x21')](function(_0x57a313){if(_0x57a313){_0x589f7b['model']=_[_0x92f4('0x3e')](db[_0x92f4('0xbb')]['rawAttributes']);_0x589f7b['query']=_['keys'](_0x4e22e7[_0x92f4('0x3d')]);_0x589f7b['filters']=_['intersection'](_0x589f7b['model'],_0x589f7b[_0x92f4('0x3d')]);_0x28f2d4[_0x92f4('0x40')]=_['intersection'](_0x589f7b[_0x92f4('0x42')],qs[_0x92f4('0x43')](_0x4e22e7[_0x92f4('0x3d')][_0x92f4('0x43')]));_0x28f2d4[_0x92f4('0x40')]=_0x28f2d4[_0x92f4('0x40')]['length']?_0x28f2d4[_0x92f4('0x40')]:_0x589f7b[_0x92f4('0x42')];if(!_0x4e22e7[_0x92f4('0x3d')][_0x92f4('0x45')](_0x92f4('0x46'))){_0x28f2d4[_0x92f4('0x1c')]=qs[_0x92f4('0x1c')](_0x4e22e7[_0x92f4('0x3d')][_0x92f4('0x1c')]);_0x28f2d4['offset']=qs['offset'](_0x4e22e7[_0x92f4('0x3d')][_0x92f4('0x1a')]);}_0x28f2d4['order']=qs[_0x92f4('0x47')](_0x4e22e7['query'][_0x92f4('0x47')]);_0x28f2d4['where']=qs[_0x92f4('0x3f')](_[_0x92f4('0x49')](_0x4e22e7[_0x92f4('0x3d')],_0x589f7b[_0x92f4('0x3f')]));_0x28f2d4[_0x92f4('0x48')][_0x92f4('0xac')]=_0x57a313['id'];if(_0x4e22e7[_0x92f4('0x3d')]['filter']){_0x28f2d4[_0x92f4('0x48')]=_['merge'](_0x28f2d4['where'],{'$or':_[_0x92f4('0x29')](_0x28f2d4[_0x92f4('0x40')],function(_0x2bcda0){var _0x504eb1={};_0x504eb1[_0x2bcda0]={'$like':'%'+_0x4e22e7['query'][_0x92f4('0xbc')]+'%'};return _0x504eb1;})});}if(_0x4e22e7[_0x92f4('0x3d')]['$gte']){var _0x5318d1=_0x4e22e7['query'][_0x92f4('0x7b')][_0x92f4('0x2d')](',');var _0x19ee4b={};_0x19ee4b[_0x5318d1[0x0]]={'$gte':moment(_0x5318d1[0x1])[_0x92f4('0xbd')](_0x92f4('0xbe'))};_0x28f2d4[_0x92f4('0x48')]=_[_0x92f4('0x9c')](_0x28f2d4['where'],_0x19ee4b);}_0x28f2d4=_[_0x92f4('0x9c')]({},_0x28f2d4,_0x4e22e7[_0x92f4('0xb3')]);return db[_0x92f4('0xbb')][_0x92f4('0x1d')]({'where':_0x28f2d4['where']})[_0x92f4('0x21')](function(_0x27bff2){_0x515bf0[_0x92f4('0x1d')]=_0x27bff2;if(_0x4e22e7[_0x92f4('0x3d')][_0x92f4('0xb1')]){_0x28f2d4['include']=[{'all':!![]}];}return db[_0x92f4('0xbb')][_0x92f4('0xbf')](_0x28f2d4);})[_0x92f4('0x21')](function(_0x54a39f){_0x515bf0[_0x92f4('0xae')]=_0x54a39f;return _0x515bf0;});}})[_0x92f4('0x21')](respondWithFilteredResult(_0x460a5c,_0x28f2d4))[_0x92f4('0x30')](handleError(_0x460a5c,null));};exports[_0x92f4('0xc0')]=function(_0x32df25,_0x4801c4,_0x1b53fb){return db[_0x92f4('0x38')][_0x92f4('0x63')]({'where':{'id':_0x32df25[_0x92f4('0xb0')]['id']}})[_0x92f4('0x21')](handleEntityNotFound(_0x4801c4,null))[_0x92f4('0x21')](function(_0x9f7c06){if(_0x9f7c06){return _0x9f7c06['setTags'](_0x32df25[_0x92f4('0x75')][_0x92f4('0xb8')],_[_0x92f4('0xb9')](_0x32df25['body'],[_0x92f4('0xb8'),'id'])||{})['spread'](function(){return db['Tag'][_0x92f4('0xbf')]({'attributes':['id',_0x92f4('0x26'),_0x92f4('0x4c')],'where':{'id':_0x32df25['body'][_0x92f4('0xb8')]}});})['then'](function(_0x4fa208){socket[_0x92f4('0xc1')](_0x92f4('0xc2'),{'id':Number(_0x32df25[_0x92f4('0xb0')]['id']),'tags':_0x4fa208||[]});return{'id':Number(_0x32df25[_0x92f4('0xb0')]['id']),'tags':_0x4fa208||[]};});}})[_0x92f4('0x21')](respondWithResult(_0x4801c4,null))[_0x92f4('0x30')](handleError(_0x4801c4,null));};exports[_0x92f4('0xc3')]=function(_0x177ca9,_0x37e96d,_0x486ba4){return db['FaxInteraction']['find']({'where':{'id':_0x177ca9[_0x92f4('0xb0')]['id']}})[_0x92f4('0x21')](handleEntityNotFound(_0x37e96d,null))[_0x92f4('0x21')](function(_0x453464){if(_0x453464){return _0x453464['removeTags'](_0x177ca9[_0x92f4('0x3d')][_0x92f4('0xb8')]);}})[_0x92f4('0x21')](respondWithStatusCode(_0x37e96d,null))['catch'](handleError(_0x37e96d,null));};exports[_0x92f4('0xc4')]=function(_0x568fab,_0x1c98f3){var _0x3b117b=moment()['unix']()[_0x92f4('0x9a')]();var _0x4af70e=path[_0x92f4('0xc5')](config[_0x92f4('0xc6')],_0x92f4('0xc7'),'files',_0x92f4('0xc8'));var _0x84245b=path[_0x92f4('0xc5')](config['root'],_0x92f4('0xc7'),'files',_0x92f4('0xc9'));var _0x3ad85c=path[_0x92f4('0xc5')](_0x4af70e,_0x3b117b);var _0x2054ba=util[_0x92f4('0xbd')](_0x92f4('0xca'),_0x568fab[_0x92f4('0xb0')]['id'],_0x3b117b);var _0x4a9555=path['join'](_0x4af70e,_0x2054ba);var _0x368cc3=[];_0x368cc3[_0x92f4('0x2f')]({'model':db[_0x92f4('0xcb')],'as':'Attachment','raw':!![]});var _0x2936eb=[{'model':db[_0x92f4('0xbb')],'as':_0x92f4('0xcc'),'attributes':['id',_0x92f4('0x75'),'createdAt'],'include':_0x368cc3}];return db[_0x92f4('0x38')][_0x92f4('0x63')]({'where':{'id':_0x568fab['params']['id']},'include':_0x2936eb})['then'](handleEntityNotFound(_0x1c98f3,null))[_0x92f4('0x21')](function(_0x5d2051){if(_0x5d2051&&_0x5d2051['Messages']){var _0x5e89a7=_0x5d2051['get']({'plain':!![]});fs['mkdirSync'](_0x3ad85c);for(var _0x5a4aa3=0x0;_0x5a4aa3<_0x5e89a7[_0x92f4('0xcc')][_0x92f4('0x44')];_0x5a4aa3++){var _0x1bb058=_0x5e89a7[_0x92f4('0xcc')][_0x5a4aa3]['Attachment'];if(_0x1bb058){var _0x136aa0=path[_0x92f4('0xc5')](_0x84245b,_0x1bb058[_0x92f4('0xcd')]);if(fs[_0x92f4('0xce')](_0x136aa0)){fs['createReadStream'](_0x136aa0)[_0x92f4('0xcf')](fs[_0x92f4('0xd0')](path['join'](_0x3ad85c,_0x1bb058['basename'])));}}}return BPromise['resolve']()[_0x92f4('0x21')](function(){return new BPromise(function(_0x1a8210,_0x16413c){zipdir(_0x3ad85c,{'saveTo':_0x4a9555},function(_0x4377a2,_0x4a655f){if(_0x4377a2)return _0x16413c(_0x4377a2);return _0x1a8210(_0x4a655f);});})[_0x92f4('0x21')](function(){return new BPromise(function(_0x3c0486,_0x4a3d36){rimraf(_0x3ad85c,function(_0x1d359a){if(_0x1d359a)_0x4a3d36(_0x1d359a);return _0x3c0486();});});})[_0x92f4('0x21')](function(){return _0x1c98f3[_0x92f4('0xc4')](_0x4a9555,_0x2054ba,function(_0x3a07fa){if(_0x3a07fa){console[_0x92f4('0xd1')]('err',_0x3a07fa);}else{fs[_0x92f4('0xd2')](_0x4a9555);}});});});}else{return _0x1c98f3[_0x92f4('0x23')](0xc8);}})[_0x92f4('0x30')](handleError(_0x1c98f3,null));}; \ No newline at end of file +var _0xb42e=['getMessages','findOne','nolimit','FaxInteractionId','findAll','rows','addTags','setTags','omit','spread','emit','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','Attachment','get','mkdirSync','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','name','fullname','TagIds','split','forEach','Tags','push','waiting','answered','total','closed','UserId','talking','unmanaged','map','fieldName','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','pick','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','having','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','text','body','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','role','sequelize','toString','merge','FaxInteraction','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','catch','show','params','keys','rawAttributes','includeAll','include','options','create','update','destroy','describe','addMessage','FaxMessage','ids'];(function(_0x4c6012,_0x4f3843){var _0x2fcaa8=function(_0x1c4609){while(--_0x1c4609){_0x4c6012['push'](_0x4c6012['shift']());}};_0x2fcaa8(++_0x4f3843);}(_0xb42e,0x101));var _0xeb42=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0xb42e[_0x1a7550];return _0x426e22;};'use strict';var emlformat=require(_0xeb42('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeb42('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb42('0x2'));var moment=require(_0xeb42('0x3'));var BPromise=require(_0xeb42('0x4'));var Mustache=require(_0xeb42('0x5'));var util=require(_0xeb42('0x6'));var path=require(_0xeb42('0x7'));var sox=require(_0xeb42('0x8'));var csv=require(_0xeb42('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb42('0xa'));var _=require(_0xeb42('0xb'));var squel=require(_0xeb42('0xc'));var crypto=require(_0xeb42('0xd'));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(_0xeb42('0xe'));var authService=require(_0xeb42('0xf'));var qs=require(_0xeb42('0x10'));var as=require(_0xeb42('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb42('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xeb42('0x13'));var licenseUtil=require(_0xeb42('0x14'));var db=require(_0xeb42('0x15'))['db'];config['redis']=_[_0xeb42('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb42('0x17')]));require(_0xeb42('0x18'))[_0xeb42('0x19')](socket);function respondWithStatusCode(_0xd5a9ba,_0x5ed9bf){_0x5ed9bf=_0x5ed9bf||0xcc;return function(_0x257f2a){if(_0x257f2a){return _0xd5a9ba[_0xeb42('0x1a')](_0x5ed9bf);}return _0xd5a9ba[_0xeb42('0x1b')](_0x5ed9bf)[_0xeb42('0x1c')]();};}function respondWithResult(_0x5bcfaf,_0xb7dbdb){_0xb7dbdb=_0xb7dbdb||0xc8;return function(_0x59d4fe){if(_0x59d4fe){return _0x5bcfaf['status'](_0xb7dbdb)[_0xeb42('0x1d')](_0x59d4fe);}};}function respondWithFilteredResult(_0x5de432,_0x156869){return function(_0x323835){if(_0x323835){var _0xea4cfa=typeof _0x156869[_0xeb42('0x1e')]===_0xeb42('0x1f')&&typeof _0x156869[_0xeb42('0x20')]===_0xeb42('0x1f');var _0x56fb63=_0x323835[_0xeb42('0x21')];var _0x187ca7=_0xea4cfa?0x0:_0x156869[_0xeb42('0x1e')];var _0x2c7211=_0xea4cfa?_0x323835[_0xeb42('0x21')]:_0x156869[_0xeb42('0x1e')]+_0x156869[_0xeb42('0x20')];var _0x5567c6;if(_0x2c7211>=_0x56fb63){_0x2c7211=_0x56fb63;_0x5567c6=0xc8;}else{_0x5567c6=0xce;}_0x5de432[_0xeb42('0x1b')](_0x5567c6);return _0x5de432[_0xeb42('0x22')](_0xeb42('0x23'),_0x187ca7+'-'+_0x2c7211+'/'+_0x56fb63)[_0xeb42('0x1d')](_0x323835);}return null;};}function patchUpdates(_0x2fea5e){return function(_0x180582){try{jsonpatch[_0xeb42('0x24')](_0x180582,_0x2fea5e,!![]);}catch(_0x41ff48){return BPromise[_0xeb42('0x25')](_0x41ff48);}return _0x180582[_0xeb42('0x26')]();};}function saveUpdates(_0x21e0a3,_0x1a3109){return function(_0x569a98){if(_0x569a98){return _0x569a98['update'](_0x21e0a3)[_0xeb42('0x27')](function(_0x1f5b91){return _0x1f5b91;});}return null;};}function removeEntity(_0x319a8d,_0x45bf05){return function(_0x4228dd){if(_0x4228dd){return _0x4228dd['destroy']()[_0xeb42('0x27')](function(){_0x319a8d[_0xeb42('0x1b')](0xcc)[_0xeb42('0x1c')]();});}};}function handleEntityNotFound(_0x1f4a17,_0x144275){return function(_0x48e308){if(!_0x48e308){_0x1f4a17[_0xeb42('0x1a')](0x194);}return _0x48e308;};}function handleError(_0xef44b0,_0x315423){_0x315423=_0x315423||0x1f4;return function(_0x5735a3){logger[_0xeb42('0x28')](_0x5735a3['stack']);if(_0x5735a3[_0xeb42('0x29')]){delete _0x5735a3[_0xeb42('0x29')];}_0xef44b0[_0xeb42('0x1b')](_0x315423)['send'](_0x5735a3);};}function getInteractionUsers(_0x228469,_0x1bb85d){return new BPromise(function(_0x5ac913,_0x242861){try{if(_0x1bb85d[_0x228469['id']]){_0x228469['Users']=_['map'](_0x1bb85d[_0x228469['id']],function(_0x5674ea){return{'id':_0x5674ea['id'],'fullname':_0x5674ea[_0xeb42('0x2a')]};});}}catch(_0x170a53){_0x242861(_0x170a53);}_0x5ac913(_0x228469);});}function getInteractionTags(_0x40b98d,_0x3bb22a){return new BPromise(function(_0x3397a5,_0x140559){try{if(_0x40b98d[_0xeb42('0x2b')]){_0x40b98d['Tags']=[];_0x40b98d[_0xeb42('0x2b')][_0xeb42('0x2c')](',')[_0xeb42('0x2d')](function(_0x29244a){_0x40b98d[_0xeb42('0x2e')][_0xeb42('0x2f')](_0x3bb22a[_0x29244a]);});}delete _0x40b98d['TagIds'];}catch(_0x569f69){_0x140559(_0x569f69);}_0x3397a5(_0x40b98d);});}function updateFaxInteraction(_0x20880a,_0x2b65d6,_0x4858b2){return new BPromise(function(_0x2d9e77,_0x49737f){return getInteractionUsers(_0x20880a,_0x4858b2)['then'](function(_0x24c197){return getInteractionTags(_0x24c197,_0x2b65d6);})[_0xeb42('0x27')](function(_0x474bd4){return getStateInteraction(_0x474bd4);})[_0xeb42('0x27')](function(_0x206656){_0x2d9e77(_0x206656);})['catch'](function(_0x250b76){_0x49737f(_0x250b76);});});}function getStateInteraction(_0x37fd90){return new BPromise(function(_0x477373){_0x37fd90[_0xeb42('0x30')]=0x0;_0x37fd90['talking']=0x0;_0x37fd90[_0xeb42('0x31')]=0x0;_0x37fd90['unmanaged']=0x0;_0x37fd90[_0xeb42('0x32')]=0x0;if(!_0x37fd90[_0xeb42('0x33')]&&!_0x37fd90[_0xeb42('0x34')]){_0x37fd90[_0xeb42('0x30')]+=0x1;}if(!_0x37fd90[_0xeb42('0x33')]&&_0x37fd90[_0xeb42('0x34')]){_0x37fd90[_0xeb42('0x35')]+=0x1;if(_0x37fd90[_0xeb42('0x30')]){_0x37fd90[_0xeb42('0x30')]-=0x1;}}if(_0x37fd90['closed']&&_0x37fd90[_0xeb42('0x34')]){_0x37fd90[_0xeb42('0x31')]+=0x1;if(_0x37fd90[_0xeb42('0x35')]){_0x37fd90[_0xeb42('0x35')]-=0x1;}}if(_0x37fd90[_0xeb42('0x33')]&&!_0x37fd90[_0xeb42('0x34')]){_0x37fd90[_0xeb42('0x36')]+=0x1;if(_0x37fd90[_0xeb42('0x30')]){_0x37fd90['waiting']-=0x1;}}_0x37fd90[_0xeb42('0x32')]+=0x1;_0x477373(_0x37fd90);});}exports['index']=function(_0x313651,_0x1e933b){var _0x3cf471={},_0x543d89={},_0x78f7a6={'count':0x0,'rows':[]};var _0xefd762=_[_0xeb42('0x37')](db['FaxInteraction']['rawAttributes'],function(_0x26e840){return{'name':_0x26e840[_0xeb42('0x38')],'type':_0x26e840[_0xeb42('0x39')][_0xeb42('0x3a')]};});_0x543d89['model']=_[_0xeb42('0x37')](_0xefd762,_0xeb42('0x29'));_0x543d89[_0xeb42('0x3b')]=_['keys'](_0x313651[_0xeb42('0x3b')]);_0x543d89['filters']=_[_0xeb42('0x3c')](_0x543d89['model'],_0x543d89[_0xeb42('0x3b')]);_0x3cf471[_0xeb42('0x3d')]=_[_0xeb42('0x3c')](_0x543d89[_0xeb42('0x3e')],qs['fields'](_0x313651[_0xeb42('0x3b')][_0xeb42('0x3f')]));_0x3cf471[_0xeb42('0x3d')]=_0x3cf471['attributes'][_0xeb42('0x40')]?_0x3cf471['attributes']:_0x543d89[_0xeb42('0x3e')];if(!_0x313651['query'][_0xeb42('0x41')]('nolimit')){_0x3cf471[_0xeb42('0x20')]=qs[_0xeb42('0x20')](_0x313651[_0xeb42('0x3b')][_0xeb42('0x20')]);_0x3cf471['offset']=qs[_0xeb42('0x1e')](_0x313651['query'][_0xeb42('0x1e')]);}_0x3cf471[_0xeb42('0x42')]=qs[_0xeb42('0x43')](_0x313651['query'][_0xeb42('0x43')]);_0x3cf471['where']=qs['filters'](_[_0xeb42('0x44')](_0x313651[_0xeb42('0x3b')],_0x543d89[_0xeb42('0x45')]),_0xefd762);var _0x24c864=[];var _0x52e86c=squel[_0xeb42('0x46')]()['field']('id')[_0xeb42('0x47')](_0xeb42('0x29'))[_0xeb42('0x47')](_0xeb42('0x48'))[_0xeb42('0x49')](_0xeb42('0x4a'));var _0x18f6d1=squel[_0xeb42('0x46')]()[_0xeb42('0x47')](_0xeb42('0x4b'))['field'](_0xeb42('0x4c'))['field'](_0xeb42('0x4d'))[_0xeb42('0x49')](_0xeb42('0x4e'),'ui')[_0xeb42('0x4f')](_0xeb42('0x50'),'u',_0xeb42('0x51'));var _0x593c35=squel[_0xeb42('0x46')]()[_0xeb42('0x49')](_0xeb42('0x52'),'i')[_0xeb42('0x4f')](_0xeb42('0x53'),'c',_0xeb42('0x54'))[_0xeb42('0x4f')](_0xeb42('0x50'),'o',_0xeb42('0x55'))[_0xeb42('0x4f')](_0xeb42('0x56'),'a','a.id\x20=\x20i.FaxAccountId')[_0xeb42('0x4f')](_0xeb42('0x57'),'me',_0xeb42('0x58'))[_0xeb42('0x4f')](_0xeb42('0x59'),'it',_0xeb42('0x5a'))[_0xeb42('0x4f')](_0xeb42('0x4a'),'t',_0xeb42('0x5b'));var _0x56dbee=squel[_0xeb42('0x5c')]();var _0x515a1a=[];var _0x16c033=squel[_0xeb42('0x5c')]();var _0x3f6c25;if(_0x313651[_0xeb42('0x3b')][_0xeb42('0x5d')]){_0x3f6c25=as['parseSearch'](_0x313651[_0xeb42('0x3b')][_0xeb42('0x5d')]);var _0x56037c=_0x3f6c25[_0xeb42('0x5e')];for(var _0x208dcc=0x0;_0x208dcc<_0x3f6c25[_0xeb42('0x5f')][_0xeb42('0x40')];_0x208dcc++){var _0x306be9=_0x3f6c25[_0xeb42('0x5f')][_0x208dcc];var _0x2a8017='i';var _0x459650=_[_0xeb42('0x60')](_0xefd762,[_0xeb42('0x29'),_0x306be9['field']]);if(!_0x459650){switch(_0x306be9[_0xeb42('0x47')]){case'unreadMessages':if(_0x306be9['value']==0x1){_0x593c35[_0xeb42('0x61')]('`'+_0x306be9[_0xeb42('0x47')]+'`\x20=\x200');}else{_0x593c35['having']('`'+_0x306be9[_0xeb42('0x47')]+'`\x20>\x200');}break;case _0xeb42('0x62'):if(_0x306be9[_0xeb42('0x63')]===_0xeb42('0x64')){if(_0x306be9[_0xeb42('0x65')][_0xeb42('0x2c')]('\x20')[_0xeb42('0x40')]>0x1){_0x56dbee[_0x56037c](_0xeb42('0x66'),qs[_0xeb42('0x67')](_0x306be9['value']),null);}else{var _0x527af3='%'+_0x306be9[_0xeb42('0x65')]+'%';_0x56dbee[_0x56037c](_0xeb42('0x68'),_0x527af3,_0x527af3,_0x527af3);}}else{_0x459650=_[_0xeb42('0x60')](_0xefd762,['name','ContactId']);_0x306be9['field']='ContactId';_0x55df6d=as['buildExpression'](_0x2a8017,_0x459650[_0xeb42('0x39')],_0x306be9);_0x56dbee[_0x56037c](_0x55df6d['text'],_0x55df6d['value'][_0xeb42('0x69')],_0x55df6d['value'][_0xeb42('0x1c')]);}break;case _0xeb42('0x6a'):var _0x26e7c1=_0x306be9[_0xeb42('0x65')][_0xeb42('0x2c')](',')[_0xeb42('0x37')](function(_0x41dcf6){return Number(_0x41dcf6);});_0x26e7c1[_0xeb42('0x2d')](function(_0x316597){_0x16c033['or'](_0xeb42('0x6b'),'%,'+_0x316597+',%');});_0x515a1a=_[_0xeb42('0x6c')](_0x515a1a,_0x26e7c1);break;case _0xeb42('0x6d'):if(_0x306be9[_0xeb42('0x63')]===_0xeb42('0x64')){_0x56dbee[_0x56037c](_0xeb42('0x6e'),'%'+_0x306be9[_0xeb42('0x65')]+'%',null);}else{_0x459650=_[_0xeb42('0x60')](_0xefd762,[_0xeb42('0x29'),_0xeb42('0x34')]);_0x306be9[_0xeb42('0x47')]=_0xeb42('0x34');_0x55df6d=as[_0xeb42('0x6f')](_0x2a8017,_0x459650[_0xeb42('0x39')],_0x306be9);_0x56dbee[_0x56037c](_0x55df6d[_0xeb42('0x70')],_0x55df6d[_0xeb42('0x65')][_0xeb42('0x69')],_0x55df6d['value'][_0xeb42('0x1c')]);}break;case _0xeb42('0x71'):_0x55df6d=as[_0xeb42('0x6f')]('me',null,_0x306be9);_0x56dbee[_0x56037c](_0x55df6d['text'],_0x55df6d['value'][_0xeb42('0x69')],_0x55df6d[_0xeb42('0x65')][_0xeb42('0x1c')]);break;}}else{var _0x55df6d=as[_0xeb42('0x6f')](_0x2a8017,_0x459650[_0xeb42('0x39')],_0x306be9);_0x56dbee[_0x56037c](_0x55df6d[_0xeb42('0x70')],_0x55df6d[_0xeb42('0x65')]['start'],_0x55df6d[_0xeb42('0x65')][_0xeb42('0x1c')]);}}}else{var _0x206a07=_(_0x313651['query'])['keys']()['map'](function(_0x10009d){return _[_0xeb42('0x72')](_0xefd762,[_0xeb42('0x29'),_0x10009d])?_0x10009d:undefined;})[_0xeb42('0x73')]()[_0xeb42('0x65')]();if(!_[_0xeb42('0x74')](_0x206a07)){_0x206a07[_0xeb42('0x2d')](function(_0x1e43db){if(_0x1e43db===_0xeb42('0x75')){_0x593c35['where'](_0xeb42('0x76'),[][_0xeb42('0x77')](_0x313651[_0xeb42('0x3b')][_0x1e43db]));}else if(_0x1e43db===_0xeb42('0x78')){var _0x5c1e2a=JSON[_0xeb42('0x79')](_0x313651[_0xeb42('0x3b')][_0x1e43db])[_0xeb42('0x7a')];var _0x5df6af=JSON[_0xeb42('0x79')](_0x313651[_0xeb42('0x3b')][_0x1e43db])['$lte'];_0x593c35['where'](_0xeb42('0x7b'),_0x5c1e2a,_0x5df6af);}else{if(_0x313651[_0xeb42('0x3b')][_0x1e43db]==='null'){_0x593c35[_0xeb42('0x7c')]('i.'+_0x1e43db+_0xeb42('0x7d'));}else{_0x593c35[_0xeb42('0x7c')]('i.'+_0x1e43db+_0xeb42('0x7e'),_0x313651[_0xeb42('0x3b')][_0x1e43db]);}}});}if(_0x313651[_0xeb42('0x3b')][_0xeb42('0x7f')]){if(_0x313651[_0xeb42('0x3b')][_0xeb42('0x7f')]==0x1){_0x593c35[_0xeb42('0x61')](_0xeb42('0x80'));}else{_0x593c35[_0xeb42('0x61')](_0xeb42('0x81'));}}if(_0x313651['query']['tag']){_0x515a1a=_[_0xeb42('0x82')](_0x313651[_0xeb42('0x3b')]['tag'])?_0x313651[_0xeb42('0x3b')][_0xeb42('0x83')]:new Array(_0x313651['query'][_0xeb42('0x83')]);_0x515a1a['forEach'](function(_0x325604){_0x16c033['or'](_0xeb42('0x6b'),'%,'+_0x325604+',%');});}if(_0x313651['query'][_0xeb42('0x84')]){var _0x26b64c=_0x313651[_0xeb42('0x3b')][_0xeb42('0x84')][_0xeb42('0x85')]('\x5c','\x5c\x5c')[_0xeb42('0x85')](/'/g,'\x27\x27');if(qs[_0xeb42('0x86')](_0x26b64c)){_0x56dbee['or'](_0xeb42('0x87'),_0x26b64c+'%')['or'](_0xeb42('0x88'),_0x26b64c+'%');}_0x56dbee['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x26b64c+'%');}}_0x593c35[_0xeb42('0x7c')](_0x56dbee);_0x593c35[_0xeb42('0x89')](_0xeb42('0x8a'));var _0x215fcf={'type':db['Sequelize'][_0xeb42('0x8b')]['SELECT'],'raw':!![]};var _0x1d29d4=_0x593c35[_0xeb42('0x8c')]();_0x1d29d4[_0xeb42('0x47')](_0xeb42('0x8a'));_0x1d29d4['field'](_0xeb42('0x8d'),_0xeb42('0x8e'));if(_0x3cf471[_0xeb42('0x42')]){_0x3cf471[_0xeb42('0x42')][_0xeb42('0x2d')](function(_0x4045dc){var _0xdee4bc=_0x4045dc[0x0]===_0xeb42('0x8f')?_0x4045dc[0x0]:'i.'+_0x4045dc[0x0];_0x593c35[_0xeb42('0x42')](_0xdee4bc,_0x4045dc[0x1]===_0xeb42('0x90')?![]:!![]);});}if(!_[_0xeb42('0x74')](_0x515a1a)){_0x593c35[_0xeb42('0x61')](_0x16c033);_0x1d29d4[_0xeb42('0x7c')](_0xeb42('0x91'),_0x515a1a);}BPromise[_0xeb42('0x92')]()[_0xeb42('0x27')](function(){if(!_0x3f6c25){if(_0x313651[_0xeb42('0x3b')][_0xeb42('0x75')])return;_0x1d29d4[_0xeb42('0x7c')](_0xeb42('0x93'));_0x593c35[_0xeb42('0x7c')](_0xeb42('0x93'));return;}if(_0x313651[_0xeb42('0x94')]['role']!==_0xeb42('0x95'))return;return _0x313651[_0xeb42('0x94')][_0xeb42('0x96')]({'attributes':['id'],'raw':!![]})[_0xeb42('0x27')](function(_0x841304){if(_[_0xeb42('0x74')](_0x841304)){_0x1d29d4[_0xeb42('0x7c')]('i.FaxAccountId\x20IS\x20NULL');_0x593c35[_0xeb42('0x7c')](_0xeb42('0x97'));}else{_0x1d29d4['where']('i.FaxAccountId\x20IN\x20?',_[_0xeb42('0x37')](_0x841304,'id'));_0x593c35[_0xeb42('0x7c')](_0xeb42('0x76'),_[_0xeb42('0x37')](_0x841304,'id'));}});})[_0xeb42('0x27')](function(){if(_0x313651[_0xeb42('0x94')][_0xeb42('0x98')]===_0xeb42('0x95')&&!_0x3f6c25&&!_0x313651[_0xeb42('0x3b')][_0xeb42('0x75')])return[];return db[_0xeb42('0x99')]['query'](_0x1d29d4[_0xeb42('0x9a')](),_0x215fcf);})[_0xeb42('0x27')](function(_0x524cce){_0x78f7a6[_0xeb42('0x21')]=_0x524cce[_0xeb42('0x40')];if(_0x78f7a6[_0xeb42('0x21')]===0x0)return[];return db['sequelize']['query'](_0x52e86c['toString'](),_0x215fcf)[_0xeb42('0x27')](function(_0x5a3d5d){_0x24c864=_['keyBy'](_0x5a3d5d,'id');_0x215fcf=_[_0xeb42('0x9b')](_0x215fcf,{'model':db[_0xeb42('0x9c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x313651['query'][_0xeb42('0x3f')]){_0x3cf471[_0xeb42('0x3d')]['forEach'](function(_0x4992a0){_0x593c35['field']('i.'+_0x4992a0);});}else{_0x593c35[_0xeb42('0x47')](_0xeb42('0x8d'),_0xeb42('0x8e'));_0x593c35[_0xeb42('0x47')](_0xeb42('0x9d'),_0xeb42('0x9e'));_0x593c35['field'](_0xeb42('0x9f'),'Account.mandatoryDisposition');_0x593c35[_0xeb42('0x47')](_0xeb42('0xa0'),_0xeb42('0x8f'));_0x593c35['field'](_0xeb42('0xa1'));_0x593c35[_0xeb42('0x47')](_0xeb42('0xa2'),'Contact.firstName');_0x593c35[_0xeb42('0x47')]('c.lastName',_0xeb42('0xa3'));_0x593c35[_0xeb42('0x47')](_0xeb42('0xa4'),_0xeb42('0xa5'));_0x593c35[_0xeb42('0x47')]('c.phone',_0xeb42('0xa6'));_0x593c35['field'](_0xeb42('0xa7'),_0xeb42('0xa8'));_0x593c35[_0xeb42('0x47')](_0xeb42('0xa9'),_0xeb42('0xaa'));_0x593c35[_0xeb42('0x47')](_0xeb42('0xab'),_0xeb42('0xac'));_0x593c35['field'](_0xeb42('0xad'),_0xeb42('0xae'));_0x593c35[_0xeb42('0x47')](_0xeb42('0xaf'),_0xeb42('0x2b'));}if(_0x3cf471[_0xeb42('0x20')])_0x593c35[_0xeb42('0x20')](_0x3cf471[_0xeb42('0x20')]);if(_0x3cf471['offset'])_0x593c35['offset'](_0x3cf471[_0xeb42('0x1e')]);return db[_0xeb42('0x99')][_0xeb42('0x3b')](_0x593c35[_0xeb42('0x9a')](),_0x215fcf);})['then'](function(_0xbea501){if(_0xbea501[_0xeb42('0x40')]>0x0)_0x18f6d1[_0xeb42('0x7c')](_0xeb42('0xb0'),_['map'](_0xbea501,'id'));return db[_0xeb42('0x99')][_0xeb42('0x3b')](_0x18f6d1[_0xeb42('0x9a')](),_0x215fcf)['then'](function(_0xc45751){var _0x49e640=_[_0xeb42('0xb1')](_0xc45751,'FaxInteractionId');var _0x1eee4a=[];_0xbea501['forEach'](function(_0x3585d6){_0x1eee4a[_0xeb42('0x2f')](updateFaxInteraction(_0x3585d6,_0x24c864,_0x49e640));});return BPromise['all'](_0x1eee4a);});});})[_0xeb42('0x27')](function(_0x16c092){_0x78f7a6['rows']=_0x16c092;return _0x78f7a6;})[_0xeb42('0x27')](respondWithFilteredResult(_0x1e933b,_0x3cf471))[_0xeb42('0xb2')](handleError(_0x1e933b,null));};exports[_0xeb42('0xb3')]=function(_0x972a32,_0x5ef8d8){var _0x49d55c={'raw':![],'where':{'id':_0x972a32[_0xeb42('0xb4')]['id']}},_0x3b6d56={};_0x3b6d56[_0xeb42('0x3e')]=_[_0xeb42('0xb5')](db[_0xeb42('0x9c')][_0xeb42('0xb6')]);_0x3b6d56[_0xeb42('0x3b')]=_[_0xeb42('0xb5')](_0x972a32['query']);_0x3b6d56[_0xeb42('0x45')]=_['intersection'](_0x3b6d56[_0xeb42('0x3e')],_0x3b6d56['query']);_0x49d55c[_0xeb42('0x3d')]=_['intersection'](_0x3b6d56[_0xeb42('0x3e')],qs[_0xeb42('0x3f')](_0x972a32[_0xeb42('0x3b')]['fields']));_0x49d55c[_0xeb42('0x3d')]=_0x49d55c[_0xeb42('0x3d')]['length']?_0x49d55c[_0xeb42('0x3d')]:_0x3b6d56['model'];if(_0x972a32[_0xeb42('0x3b')][_0xeb42('0xb7')]){_0x49d55c[_0xeb42('0xb8')]=[{'all':!![]}];}_0x49d55c=_[_0xeb42('0x9b')]({},_0x49d55c,_0x972a32[_0xeb42('0xb9')]);return db[_0xeb42('0x9c')][_0xeb42('0x60')](_0x49d55c)[_0xeb42('0x27')](handleEntityNotFound(_0x5ef8d8,null))[_0xeb42('0x27')](respondWithResult(_0x5ef8d8,null))[_0xeb42('0xb2')](handleError(_0x5ef8d8,null));};exports[_0xeb42('0xba')]=function(_0x2468fb,_0x1cc30e){return db[_0xeb42('0x9c')][_0xeb42('0xba')](_0x2468fb[_0xeb42('0x71')],{})[_0xeb42('0x27')](respondWithResult(_0x1cc30e,0xc9))['catch'](handleError(_0x1cc30e,null));};exports[_0xeb42('0xbb')]=function(_0x3b3bd6,_0x1c6316){if(_0x3b3bd6[_0xeb42('0x71')]['id']){delete _0x3b3bd6['body']['id'];}return db[_0xeb42('0x9c')][_0xeb42('0x60')]({'where':{'id':_0x3b3bd6['params']['id']}})[_0xeb42('0x27')](handleEntityNotFound(_0x1c6316,null))[_0xeb42('0x27')](saveUpdates(_0x3b3bd6[_0xeb42('0x71')],null))[_0xeb42('0x27')](respondWithResult(_0x1c6316,null))['catch'](handleError(_0x1c6316,null));};exports[_0xeb42('0xbc')]=function(_0x4fbccd,_0x5e819b){return db[_0xeb42('0x9c')]['find']({'where':{'id':_0x4fbccd[_0xeb42('0xb4')]['id']}})['then'](handleEntityNotFound(_0x5e819b,null))[_0xeb42('0x27')](removeEntity(_0x5e819b,null))[_0xeb42('0xb2')](handleError(_0x5e819b,null));};exports[_0xeb42('0xbd')]=function(_0x18856d,_0x46905b){return db[_0xeb42('0x9c')][_0xeb42('0xbd')]()['then'](respondWithResult(_0x46905b,null))[_0xeb42('0xb2')](handleError(_0x46905b,null));};exports[_0xeb42('0xbe')]=function(_0x2f241a,_0x5caa8a,_0x4173c5){return db[_0xeb42('0xbf')]['find']({'where':{'id':_0x2f241a['params']['id']}})[_0xeb42('0x27')](handleEntityNotFound(_0x5caa8a,null))[_0xeb42('0x27')](function(_0x5a16e2){if(_0x5a16e2){return _0x5a16e2[_0xeb42('0xbe')](_0x2f241a['body'][_0xeb42('0xc0')],_['omit'](_0x2f241a[_0xeb42('0x71')],[_0xeb42('0xc0'),'id'])||{});}})[_0xeb42('0x27')](respondWithResult(_0x5caa8a,null))[_0xeb42('0xb2')](handleError(_0x5caa8a,null));};exports[_0xeb42('0xc1')]=function(_0x54435c,_0x35cfea,_0x1f7f5d){var _0x248c8a={'raw':![],'where':{}};var _0x4d216c={};var _0x3468b5={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xeb42('0xc2')]({'where':{'id':_0x54435c['params']['id']}})[_0xeb42('0x27')](handleEntityNotFound(_0x35cfea,null))['then'](function(_0x3696da){if(_0x3696da){_0x4d216c[_0xeb42('0x3e')]=_[_0xeb42('0xb5')](db[_0xeb42('0xbf')][_0xeb42('0xb6')]);_0x4d216c[_0xeb42('0x3b')]=_[_0xeb42('0xb5')](_0x54435c[_0xeb42('0x3b')]);_0x4d216c[_0xeb42('0x45')]=_['intersection'](_0x4d216c[_0xeb42('0x3e')],_0x4d216c[_0xeb42('0x3b')]);_0x248c8a[_0xeb42('0x3d')]=_[_0xeb42('0x3c')](_0x4d216c['model'],qs['fields'](_0x54435c[_0xeb42('0x3b')]['fields']));_0x248c8a[_0xeb42('0x3d')]=_0x248c8a[_0xeb42('0x3d')][_0xeb42('0x40')]?_0x248c8a[_0xeb42('0x3d')]:_0x4d216c['model'];if(!_0x54435c[_0xeb42('0x3b')]['hasOwnProperty'](_0xeb42('0xc3'))){_0x248c8a[_0xeb42('0x20')]=qs[_0xeb42('0x20')](_0x54435c[_0xeb42('0x3b')][_0xeb42('0x20')]);_0x248c8a[_0xeb42('0x1e')]=qs[_0xeb42('0x1e')](_0x54435c[_0xeb42('0x3b')][_0xeb42('0x1e')]);}_0x248c8a['order']=qs[_0xeb42('0x43')](_0x54435c[_0xeb42('0x3b')][_0xeb42('0x43')]);_0x248c8a['where']=qs[_0xeb42('0x45')](_[_0xeb42('0x44')](_0x54435c[_0xeb42('0x3b')],_0x4d216c[_0xeb42('0x45')]));_0x248c8a[_0xeb42('0x7c')][_0xeb42('0xc4')]=_0x3696da['id'];if(_0x54435c[_0xeb42('0x3b')]['filter']){_0x248c8a['where']=_[_0xeb42('0x9b')](_0x248c8a[_0xeb42('0x7c')],{'$or':_[_0xeb42('0x37')](_0x248c8a[_0xeb42('0x3d')],function(_0x23a6b2){var _0x34bd58={};_0x34bd58[_0x23a6b2]={'$like':'%'+_0x54435c[_0xeb42('0x3b')]['filter']+'%'};return _0x34bd58;})});}if(_0x54435c['query'][_0xeb42('0x7a')]){var _0x676599=_0x54435c[_0xeb42('0x3b')][_0xeb42('0x7a')][_0xeb42('0x2c')](',');var _0x5f1cd0={};_0x5f1cd0[_0x676599[0x0]]={'$gte':moment(_0x676599[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x248c8a[_0xeb42('0x7c')]=_['merge'](_0x248c8a[_0xeb42('0x7c')],_0x5f1cd0);}_0x248c8a=_[_0xeb42('0x9b')]({},_0x248c8a,_0x54435c[_0xeb42('0xb9')]);return db[_0xeb42('0xbf')]['count']({'where':_0x248c8a[_0xeb42('0x7c')]})[_0xeb42('0x27')](function(_0x38a784){_0x3468b5[_0xeb42('0x21')]=_0x38a784;if(_0x54435c[_0xeb42('0x3b')][_0xeb42('0xb7')]){_0x248c8a['include']=[{'all':!![]}];}return db[_0xeb42('0xbf')][_0xeb42('0xc5')](_0x248c8a);})[_0xeb42('0x27')](function(_0x132437){_0x3468b5[_0xeb42('0xc6')]=_0x132437;return _0x3468b5;});}})['then'](respondWithFilteredResult(_0x35cfea,_0x248c8a))[_0xeb42('0xb2')](handleError(_0x35cfea,null));};exports[_0xeb42('0xc7')]=function(_0x18e170,_0x404925,_0xafbd8e){return db[_0xeb42('0x9c')][_0xeb42('0x60')]({'where':{'id':_0x18e170[_0xeb42('0xb4')]['id']}})[_0xeb42('0x27')](handleEntityNotFound(_0x404925,null))['then'](function(_0x2e1f0d){if(_0x2e1f0d){return _0x2e1f0d[_0xeb42('0xc8')](_0x18e170['body'][_0xeb42('0xc0')],_[_0xeb42('0xc9')](_0x18e170[_0xeb42('0x71')],[_0xeb42('0xc0'),'id'])||{})[_0xeb42('0xca')](function(){return db[_0xeb42('0x6a')][_0xeb42('0xc5')]({'attributes':['id','name',_0xeb42('0x48')],'where':{'id':_0x18e170[_0xeb42('0x71')][_0xeb42('0xc0')]}});})[_0xeb42('0x27')](function(_0x457757){socket[_0xeb42('0xcb')]('faxInteractionTags:save',{'id':Number(_0x18e170[_0xeb42('0xb4')]['id']),'tags':_0x457757||[]});return{'id':Number(_0x18e170[_0xeb42('0xb4')]['id']),'tags':_0x457757||[]};});}})['then'](respondWithResult(_0x404925,null))[_0xeb42('0xb2')](handleError(_0x404925,null));};exports[_0xeb42('0xcc')]=function(_0x20eb88,_0x23f12a,_0x3f21eb){return db['FaxInteraction'][_0xeb42('0x60')]({'where':{'id':_0x20eb88[_0xeb42('0xb4')]['id']}})[_0xeb42('0x27')](handleEntityNotFound(_0x23f12a,null))['then'](function(_0x322acd){if(_0x322acd){return _0x322acd['removeTags'](_0x20eb88[_0xeb42('0x3b')][_0xeb42('0xc0')]);}})[_0xeb42('0x27')](respondWithStatusCode(_0x23f12a,null))[_0xeb42('0xb2')](handleError(_0x23f12a,null));};exports[_0xeb42('0xcd')]=function(_0x2a6252,_0x2aff1a){var _0x4b2633=moment()[_0xeb42('0xce')]()[_0xeb42('0x9a')]();var _0xbd85eb=path['join'](config[_0xeb42('0xcf')],_0xeb42('0xd0'),_0xeb42('0xd1'),_0xeb42('0xd2'));var _0x4478db=path[_0xeb42('0xd3')](config[_0xeb42('0xcf')],_0xeb42('0xd0'),'files','attachments');var _0x2d7bdd=path[_0xeb42('0xd3')](_0xbd85eb,_0x4b2633);var _0x4e3374=util['format'](_0xeb42('0xd4'),_0x2a6252[_0xeb42('0xb4')]['id'],_0x4b2633);var _0x27708f=path[_0xeb42('0xd3')](_0xbd85eb,_0x4e3374);var _0x5dec64=[];_0x5dec64[_0xeb42('0x2f')]({'model':db['Attachment'],'as':_0xeb42('0xd5'),'raw':!![]});var _0xb1d37f=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id','body','createdAt'],'include':_0x5dec64}];return db[_0xeb42('0x9c')][_0xeb42('0x60')]({'where':{'id':_0x2a6252['params']['id']},'include':_0xb1d37f})[_0xeb42('0x27')](handleEntityNotFound(_0x2aff1a,null))[_0xeb42('0x27')](function(_0x1f970d){if(_0x1f970d&&_0x1f970d['Messages']){var _0x647930=_0x1f970d[_0xeb42('0xd6')]({'plain':!![]});fs[_0xeb42('0xd7')](_0x2d7bdd);for(var _0x331175=0x0;_0x331175<_0x647930['Messages'][_0xeb42('0x40')];_0x331175++){var _0x5bc9cb=_0x647930[_0xeb42('0xd8')][_0x331175][_0xeb42('0xd5')];if(_0x5bc9cb){var _0x1a6e8a=path[_0xeb42('0xd3')](_0x4478db,_0x5bc9cb[_0xeb42('0xd9')]);if(fs[_0xeb42('0xda')](_0x1a6e8a)){fs[_0xeb42('0xdb')](_0x1a6e8a)[_0xeb42('0xdc')](fs[_0xeb42('0xdd')](path[_0xeb42('0xd3')](_0x2d7bdd,_0x5bc9cb[_0xeb42('0xd9')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x218deb,_0x4b26de){zipdir(_0x2d7bdd,{'saveTo':_0x27708f},function(_0x6c39c8,_0x3cb094){if(_0x6c39c8)return _0x4b26de(_0x6c39c8);return _0x218deb(_0x3cb094);});})[_0xeb42('0x27')](function(){return new BPromise(function(_0x20573b,_0x5f5331){rimraf(_0x2d7bdd,function(_0x3de500){if(_0x3de500)_0x5f5331(_0x3de500);return _0x20573b();});});})[_0xeb42('0x27')](function(){return _0x2aff1a[_0xeb42('0xcd')](_0x27708f,_0x4e3374,function(_0x4adbb6){if(_0x4adbb6){console[_0xeb42('0xde')](_0xeb42('0xdf'),_0x4adbb6);}else{fs[_0xeb42('0xe0')](_0x27708f);}});});});}else{return _0x2aff1a['sendStatus'](0xc8);}})['catch'](handleError(_0x2aff1a,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index df93389..93c8398 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 _0xdf0f=['findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','FaxInteraction','FaxMessage','setMaxListeners','update','remove','setDataValue','Users','map'];(function(_0x5f19e5,_0x146464){var _0x3aa819=function(_0x5af886){while(--_0x5af886){_0x5f19e5['push'](_0x5f19e5['shift']());}};_0x3aa819(++_0x146464);}(_0xdf0f,0x18f));var _0xfdf0=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdf0f[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0xfdf0('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0xfdf0('0x1')];var FaxMessage=require('../../mysqldb')['db'][_0xfdf0('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xfdf0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfdf0('0x4'),'afterDestroy':_0xfdf0('0x5')};function emitEvent(_0x195614){return function(_0x35ea46,_0x14fb4e,_0x48ea0f){_0x35ea46['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x65dc3){_0x35ea46[_0xfdf0('0x6')](_0xfdf0('0x7'),_0x65dc3[_0xfdf0('0x8')](function(_0x1192b5){return{'id':_0x1192b5['id']};}));return FaxMessage[_0xfdf0('0x9')]({'where':{'FaxInteractionId':_0x35ea46['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfdf0('0xa')](function(_0xbfe763){_0x35ea46['setDataValue'](_0xfdf0('0xb'),_0xbfe763[_0xfdf0('0xc')]);FaxInteractionEvents[_0xfdf0('0xd')](_0x195614+':'+_0x35ea46['id'],_0x35ea46);FaxInteractionEvents[_0xfdf0('0xd')](_0x195614,_0x35ea46);_0x48ea0f(null);})[_0xfdf0('0xe')](_0x48ea0f(null));};}for(var e in events){if(events[_0xfdf0('0xf')](e)){var event=events[e];FaxInteraction[_0xfdf0('0x10')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0xcc3b=['then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x24e22a,_0x2d347a){var _0x4bad6b=function(_0x3310bb){while(--_0x3310bb){_0x24e22a['push'](_0x24e22a['shift']());}};_0x4bad6b(++_0x2d347a);}(_0xcc3b,0x70));var _0xbcc3=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xcc3b[_0x5c2e3e];return _0x53f64a;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xbcc3('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0xbcc3('0x0'))['db'][_0xbcc3('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xbcc3('0x2')](0x0);var events={'afterCreate':_0xbcc3('0x3'),'afterUpdate':_0xbcc3('0x4'),'afterDestroy':_0xbcc3('0x5')};function emitEvent(_0x4d8a0a){return function(_0x44f706,_0x280096,_0x447f89){_0x44f706[_0xbcc3('0x6')]({'attributes':['id'],'raw':!![]})[_0xbcc3('0x7')](function(_0x54175b){_0x44f706[_0xbcc3('0x8')](_0xbcc3('0x9'),_0x54175b[_0xbcc3('0xa')](function(_0x2812e3){return{'id':_0x2812e3['id']};}));return FaxMessage[_0xbcc3('0xb')]({'where':{'FaxInteractionId':_0x44f706['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbcc3('0x7')](function(_0x539a2d){_0x44f706['setDataValue'](_0xbcc3('0xc'),_0x539a2d['length']);FaxInteractionEvents[_0xbcc3('0xd')](_0x4d8a0a+':'+_0x44f706['id'],_0x44f706);FaxInteractionEvents['emit'](_0x4d8a0a,_0x44f706);_0x447f89(null);})['catch'](_0x447f89(null));};}for(var e in events){if(events[_0xbcc3('0xe')](e)){var event=events[e];FaxInteraction[_0xbcc3('0xf')](e,emitEvent(event));}}module[_0xbcc3('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 51ec8c5..db6dd6e 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 _0xf2c5=['exports','FaxInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes'];(function(_0x10fb8f,_0x1d0f3f){var _0x48ad55=function(_0x474e40){while(--_0x474e40){_0x10fb8f['push'](_0x10fb8f['shift']());}};_0x48ad55(++_0x1d0f3f);}(_0xf2c5,0x6d));var _0x5f2c=function(_0x584292,_0x4e18a0){_0x584292=_0x584292-0x0;var _0x23ed1b=_0xf2c5[_0x584292];return _0x23ed1b;};'use strict';var _=require(_0x5f2c('0x0'));var util=require(_0x5f2c('0x1'));var logger=require(_0x5f2c('0x2'))('api');var moment=require(_0x5f2c('0x3'));var BPromise=require(_0x5f2c('0x4'));var rp=require(_0x5f2c('0x5'));var fs=require('fs');var path=require(_0x5f2c('0x6'));var rimraf=require(_0x5f2c('0x7'));var config=require(_0x5f2c('0x8'));var attributes=require(_0x5f2c('0x9'));module[_0x5f2c('0xa')]=function(_0x106c1d,_0x30b823){return _0x106c1d['define'](_0x5f2c('0xb'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57e76a,_0x2c6342,_0x12c7da){if(_0x57e76a[_0x5f2c('0xc')](_0x5f2c('0xd'))){_0x57e76a[_0x5f2c('0xe')]=moment()[_0x5f2c('0xf')](_0x5f2c('0x10'));}_0x12c7da(null,_0x57e76a);}}});}; \ No newline at end of file +var _0xb01a=['moment','request-promise','../../config/environment','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api'];(function(_0x367507,_0x4b1e9d){var _0x43f680=function(_0x107229){while(--_0x107229){_0x367507['push'](_0x367507['shift']());}};_0x43f680(++_0x4b1e9d);}(_0xb01a,0x124));var _0xab01=function(_0x1b8d88,_0x34c12f){_0x1b8d88=_0x1b8d88-0x0;var _0x63962d=_0xb01a[_0x1b8d88];return _0x63962d;};'use strict';var _=require(_0xab01('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xab01('0x1'));var moment=require(_0xab01('0x2'));var BPromise=require('bluebird');var rp=require(_0xab01('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xab01('0x4'));var attributes=require('./faxInteraction.attributes');module[_0xab01('0x5')]=function(_0x1b6783,_0x41c841){return _0x1b6783[_0xab01('0x6')](_0xab01('0x7'),attributes,{'tableName':_0xab01('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x25d78d,_0x4431b9,_0x52a216){if(_0x25d78d[_0xab01('0x9')](_0xab01('0xa'))){_0x25d78d[_0xab01('0xb')]=moment()[_0xab01('0xc')](_0xab01('0xd'));}_0x52a216(null,_0x25d78d);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 2bb3f1c..fec81f8 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 _0xae8b=['FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','catch','where','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./faxInteraction.socket','register','request','then','info'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xae8b,0x16a));var _0xbae8=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xae8b[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xbae8('0x0'));var util=require(_0xbae8('0x1'));var moment=require('moment');var BPromise=require(_0xbae8('0x2'));var rs=require(_0xbae8('0x3'));var fs=require('fs');var Redis=require(_0xbae8('0x4'));var db=require(_0xbae8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbae8('0x6'))('rpc');var config=require(_0xbae8('0x7'));var jayson=require(_0xbae8('0x8'));var client=jayson[_0xbae8('0x9')][_0xbae8('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xbae8('0xb')],{'host':_0xbae8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbae8('0xb')]));require(_0xbae8('0xd'))[_0xbae8('0xe')](socket);function respondWithRpcPromise(_0x563375,_0x369095,_0x1eb67d){return new BPromise(function(_0xfb8913,_0x2fdc5b){return client[_0xbae8('0xf')](_0x563375,_0x1eb67d)[_0xbae8('0x10')](function(_0x5b6a0f){logger[_0xbae8('0x11')](_0xbae8('0x12'),_0x369095,_0xbae8('0x13'));logger[_0xbae8('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x369095,'request\x20sent',JSON[_0xbae8('0x15')](_0x5b6a0f));if(_0x5b6a0f[_0xbae8('0x16')]){if(_0x5b6a0f['error']['code']===0x1f4){logger[_0xbae8('0x16')](_0xbae8('0x12'),_0x369095,_0x5b6a0f[_0xbae8('0x16')][_0xbae8('0x17')]);return _0x2fdc5b(_0x5b6a0f[_0xbae8('0x16')]['message']);}logger[_0xbae8('0x16')](_0xbae8('0x12'),_0x369095,_0x5b6a0f[_0xbae8('0x16')]['message']);return _0xfb8913(_0x5b6a0f[_0xbae8('0x16')][_0xbae8('0x17')]);}else{logger[_0xbae8('0x11')](_0xbae8('0x12'),_0x369095,'request\x20sent');_0xfb8913(_0x5b6a0f['result'][_0xbae8('0x17')]);}})['catch'](function(_0x2f001c){logger[_0xbae8('0x16')](_0xbae8('0x12'),_0x369095,_0x2f001c);_0x2fdc5b(_0x2f001c);});});}exports[_0xbae8('0x18')]=function(_0x1cc682){var _0x566e08=this;return new Promise(function(_0x165b30,_0x1ce646){return db[_0xbae8('0x19')][_0xbae8('0x1a')](_0x1cc682[_0xbae8('0x1b')],{'raw':_0x1cc682[_0xbae8('0x1c')]?_0x1cc682[_0xbae8('0x1c')][_0xbae8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cc682['options']?_0x1cc682[_0xbae8('0x1c')]['where']||null:null,'attributes':_0x1cc682[_0xbae8('0x1c')]?_0x1cc682[_0xbae8('0x1c')][_0xbae8('0x1e')]||null:null,'limit':_0x1cc682[_0xbae8('0x1c')]?_0x1cc682['options']['limit']||null:null})[_0xbae8('0x10')](function(_0x32e508){logger[_0xbae8('0x11')](_0xbae8('0x18'),_0x1cc682);logger[_0xbae8('0x14')](_0xbae8('0x18'),_0x1cc682,JSON['stringify'](_0x32e508));_0x165b30(_0x32e508);})[_0xbae8('0x1f')](function(_0x3c05da){logger[_0xbae8('0x16')](_0xbae8('0x18'),_0x3c05da[_0xbae8('0x17')],_0x1cc682);_0x1ce646(_0x566e08['error'](0x1f4,_0x3c05da[_0xbae8('0x17')]));});});};exports['AddTagsToFaxInteraction']=function(_0x27212f){return new Promise(function(_0x25a763,_0x454595){return db[_0xbae8('0x19')]['find']({'where':_0x27212f[_0xbae8('0x1c')]?_0x27212f['options'][_0xbae8('0x20')]||null:null})[_0xbae8('0x10')](function(_0x204c75){if(_0x204c75){return _0x204c75[_0xbae8('0x21')](_0x27212f[_0xbae8('0x1b')][_0xbae8('0x22')],_[_0xbae8('0x23')](_0x27212f[_0xbae8('0x1b')],[_0xbae8('0x22'),'id'])||{});}})[_0xbae8('0x24')](function(_0x13665f){logger['info'](_0xbae8('0x25'),_0x27212f);logger[_0xbae8('0x14')]('AddTags',_0x27212f,JSON['stringify'](_0x13665f));_0x25a763(_0x13665f);})[_0xbae8('0x1f')](function(_0x47352a){logger[_0xbae8('0x16')]('AddTags',_0x47352a['message'],_0x27212f);_0x454595(_this[_0xbae8('0x16')](0x1f4,_0x47352a['message']));});});}; \ No newline at end of file +var _0x15e0=['AddTags','lodash','util','moment','../../mysqldb','../../config/logger','../../config/environment','http','redis','defaults','socket.io-emitter','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','attributes','limit','find','where','spread'];(function(_0x2c3530,_0x591054){var _0x537a16=function(_0xabde4d){while(--_0xabde4d){_0x2c3530['push'](_0x2c3530['shift']());}};_0x537a16(++_0x591054);}(_0x15e0,0x15f));var _0x015e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x15e0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x015e('0x0'));var util=require(_0x015e('0x1'));var moment=require(_0x015e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x015e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x015e('0x4'))('rpc');var config=require(_0x015e('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x015e('0x6')]({'port':0x232a});config[_0x015e('0x7')]=_[_0x015e('0x8')](config[_0x015e('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x015e('0x9'))(new Redis(config['redis']));require(_0x015e('0xa'))['register'](socket);function respondWithRpcPromise(_0x5e2d5b,_0x4d08f2,_0x2c3b6a){return new BPromise(function(_0x4e439e,_0x5593b5){return client[_0x015e('0xb')](_0x5e2d5b,_0x2c3b6a)[_0x015e('0xc')](function(_0xbb1560){logger[_0x015e('0xd')](_0x015e('0xe'),_0x4d08f2,_0x015e('0xf'));logger[_0x015e('0x10')](_0x015e('0x11'),_0x4d08f2,'request\x20sent',JSON[_0x015e('0x12')](_0xbb1560));if(_0xbb1560[_0x015e('0x13')]){if(_0xbb1560[_0x015e('0x13')][_0x015e('0x14')]===0x1f4){logger[_0x015e('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x4d08f2,_0xbb1560[_0x015e('0x13')]['message']);return _0x5593b5(_0xbb1560[_0x015e('0x13')][_0x015e('0x15')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x4d08f2,_0xbb1560['error'][_0x015e('0x15')]);return _0x4e439e(_0xbb1560['error']['message']);}else{logger[_0x015e('0xd')](_0x015e('0xe'),_0x4d08f2,'request\x20sent');_0x4e439e(_0xbb1560[_0x015e('0x16')][_0x015e('0x15')]);}})[_0x015e('0x17')](function(_0x431cad){logger[_0x015e('0x13')](_0x015e('0xe'),_0x4d08f2,_0x431cad);_0x5593b5(_0x431cad);});});}exports[_0x015e('0x18')]=function(_0x1a67dd){var _0xe115c2=this;return new Promise(function(_0x4da5b4,_0x5653f6){return db[_0x015e('0x19')][_0x015e('0x1a')](_0x1a67dd[_0x015e('0x1b')],{'raw':_0x1a67dd[_0x015e('0x1c')]?_0x1a67dd['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a67dd[_0x015e('0x1c')]?_0x1a67dd['options']['where']||null:null,'attributes':_0x1a67dd[_0x015e('0x1c')]?_0x1a67dd[_0x015e('0x1c')][_0x015e('0x1d')]||null:null,'limit':_0x1a67dd[_0x015e('0x1c')]?_0x1a67dd[_0x015e('0x1c')][_0x015e('0x1e')]||null:null})[_0x015e('0xc')](function(_0x386e24){logger[_0x015e('0xd')](_0x015e('0x18'),_0x1a67dd);logger['debug'](_0x015e('0x18'),_0x1a67dd,JSON['stringify'](_0x386e24));_0x4da5b4(_0x386e24);})[_0x015e('0x17')](function(_0x275e05){logger['error'](_0x015e('0x18'),_0x275e05[_0x015e('0x15')],_0x1a67dd);_0x5653f6(_0xe115c2[_0x015e('0x13')](0x1f4,_0x275e05[_0x015e('0x15')]));});});};exports['AddTagsToFaxInteraction']=function(_0x113632){return new Promise(function(_0x5d6415,_0x54df9f){return db[_0x015e('0x19')][_0x015e('0x1f')]({'where':_0x113632[_0x015e('0x1c')]?_0x113632[_0x015e('0x1c')][_0x015e('0x20')]||null:null})[_0x015e('0xc')](function(_0x73a00e){if(_0x73a00e){return _0x73a00e['addTags'](_0x113632[_0x015e('0x1b')]['ids'],_['omit'](_0x113632['body'],['ids','id'])||{});}})[_0x015e('0x21')](function(_0x16e4e7){logger[_0x015e('0xd')](_0x015e('0x22'),_0x113632);logger[_0x015e('0x10')](_0x015e('0x22'),_0x113632,JSON[_0x015e('0x12')](_0x16e4e7));_0x5d6415(_0x16e4e7);})[_0x015e('0x17')](function(_0x1373e4){logger['error']('AddTags',_0x1373e4[_0x015e('0x15')],_0x113632);_0x54df9f(_this['error'](0x1f4,_0x1373e4[_0x015e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 2406253..f0bc68d 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 _0x8eda=['remove','faxInteraction:','save'];(function(_0x63244,_0x45ac03){var _0x5c6100=function(_0x5d427b){while(--_0x5d427b){_0x63244['push'](_0x63244['shift']());}};_0x5c6100(++_0x45ac03);}(_0x8eda,0x68));var _0xa8ed=function(_0x28d07b,_0x15473d){_0x28d07b=_0x28d07b-0x0;var _0x35c70d=_0x8eda[_0x28d07b];return _0x35c70d;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xa8ed('0x0'),_0xa8ed('0x1'),'update'];function createListener(_0x478f41,_0x43dd00){return function(_0x38b3bb){_0x43dd00['emit'](_0x478f41,_0x38b3bb);};}function removeListener(_0x4e3c9e,_0x363f89){return function(){FaxInteractionEvents['removeListener'](_0x4e3c9e,_0x363f89);};}exports['register']=function(_0x30b7d5){for(var _0x3357d0=0x0,_0x50b3e1=events['length'];_0x3357d0<_0x50b3e1;_0x3357d0++){var _0x9267dc=events[_0x3357d0];var _0x1106fc=createListener(_0xa8ed('0x2')+_0x9267dc,_0x30b7d5);FaxInteractionEvents['on'](_0x9267dc,_0x1106fc);}}; \ No newline at end of file +var _0x9ea9=['register','length','faxInteraction:','remove','update','emit','removeListener'];(function(_0x6240f9,_0x1f8f27){var _0x1d4fae=function(_0x4d7559){while(--_0x4d7559){_0x6240f9['push'](_0x6240f9['shift']());}};_0x1d4fae(++_0x1f8f27);}(_0x9ea9,0x1c3));var _0x99ea=function(_0x521082,_0x1a3373){_0x521082=_0x521082-0x0;var _0x56e92b=_0x9ea9[_0x521082];return _0x56e92b;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0x99ea('0x0'),_0x99ea('0x1')];function createListener(_0x45d3a8,_0x30c889){return function(_0x480c7d){_0x30c889[_0x99ea('0x2')](_0x45d3a8,_0x480c7d);};}function removeListener(_0x3d22dc,_0x101a9d){return function(){FaxInteractionEvents[_0x99ea('0x3')](_0x3d22dc,_0x101a9d);};}exports[_0x99ea('0x4')]=function(_0x58bb5c){for(var _0x122f3f=0x0,_0x26e8e7=events[_0x99ea('0x5')];_0x122f3f<_0x26e8e7;_0x122f3f++){var _0x56dc2f=events[_0x122f3f];var _0x6f3e1f=createListener(_0x99ea('0x6')+_0x56dc2f,_0x58bb5c);FaxInteractionEvents['on'](_0x56dc2f,_0x6f3e1f);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 65226fd..249c977 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 _0xb768=['put','/:id','fax','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked'];(function(_0x24de9f,_0x228cac){var _0x1de54b=function(_0x1e92c9){while(--_0x1e92c9){_0x24de9f['push'](_0x24de9f['shift']());}};_0x1de54b(++_0x228cac);}(_0xb768,0x7d));var _0x8b76=function(_0x2b2a02,_0x42eb6e){_0x2b2a02=_0x2b2a02-0x0;var _0x2418d7=_0xb768[_0x2b2a02];return _0x2418d7;};'use strict';var multer=require(_0x8b76('0x0'));var util=require('util');var path=require(_0x8b76('0x1'));var timeout=require(_0x8b76('0x2'));var express=require('express');var router=express[_0x8b76('0x3')]();var fs_extra=require(_0x8b76('0x4'));var auth=require(_0x8b76('0x5'));var interaction=require(_0x8b76('0x6'));var config=require('../../config/environment');var controller=require('./faxInteraction.controller');router[_0x8b76('0x7')]('/',auth[_0x8b76('0x8')](),controller[_0x8b76('0x9')]);router['get'](_0x8b76('0xa'),auth[_0x8b76('0x8')](),controller[_0x8b76('0xb')]);router['get']('/:id',auth[_0x8b76('0x8')](),controller['show']);router[_0x8b76('0x7')](_0x8b76('0xc'),auth[_0x8b76('0x8')](),controller[_0x8b76('0xd')]);router[_0x8b76('0x7')](_0x8b76('0xe'),auth[_0x8b76('0x8')](),controller['download']);router[_0x8b76('0xf')]('/',auth['isAuthenticated'](),controller[_0x8b76('0x10')]);router[_0x8b76('0xf')](_0x8b76('0xc'),auth[_0x8b76('0x8')](),controller[_0x8b76('0x11')]);router[_0x8b76('0xf')](_0x8b76('0x12'),auth['isAuthenticated'](),interaction[_0x8b76('0x13')]('fax','faxinteraction:addtags'),controller['addTags']);router[_0x8b76('0x14')](_0x8b76('0x15'),auth['isAuthenticated'](),interaction[_0x8b76('0x13')](_0x8b76('0x16'),_0x8b76('0x17')),controller[_0x8b76('0x18')]);router[_0x8b76('0x19')]('/:id',auth[_0x8b76('0x8')](),interaction['tracked'](_0x8b76('0x16'),_0x8b76('0x1a')),controller[_0x8b76('0x1b')]);router[_0x8b76('0x19')](_0x8b76('0x12'),auth[_0x8b76('0x8')](),controller[_0x8b76('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x7b1f=['isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','create','addMessage','post','/:id/tags','fax','faxinteraction:addtags','addTags','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','./faxInteraction.controller','get'];(function(_0x14d896,_0x53578b){var _0x28679a=function(_0x14921f){while(--_0x14921f){_0x14d896['push'](_0x14d896['shift']());}};_0x28679a(++_0x53578b);}(_0x7b1f,0xab));var _0xf7b1=function(_0x37fb3a,_0x5a14ee){_0x37fb3a=_0x37fb3a-0x0;var _0x1e5c8f=_0x7b1f[_0x37fb3a];return _0x1e5c8f;};'use strict';var multer=require(_0xf7b1('0x0'));var util=require(_0xf7b1('0x1'));var path=require(_0xf7b1('0x2'));var timeout=require(_0xf7b1('0x3'));var express=require(_0xf7b1('0x4'));var router=express[_0xf7b1('0x5')]();var fs_extra=require(_0xf7b1('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf7b1('0x7'));router[_0xf7b1('0x8')]('/',auth[_0xf7b1('0x9')](),controller[_0xf7b1('0xa')]);router[_0xf7b1('0x8')](_0xf7b1('0xb'),auth[_0xf7b1('0x9')](),controller[_0xf7b1('0xc')]);router[_0xf7b1('0x8')](_0xf7b1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xf7b1('0x8')](_0xf7b1('0xe'),auth['isAuthenticated'](),controller[_0xf7b1('0xf')]);router[_0xf7b1('0x8')]('/:id/download',auth[_0xf7b1('0x9')](),controller['download']);router['post']('/',auth[_0xf7b1('0x9')](),controller[_0xf7b1('0x10')]);router['post'](_0xf7b1('0xe'),auth[_0xf7b1('0x9')](),controller[_0xf7b1('0x11')]);router[_0xf7b1('0x12')](_0xf7b1('0x13'),auth[_0xf7b1('0x9')](),interaction['tracked'](_0xf7b1('0x14'),_0xf7b1('0x15')),controller[_0xf7b1('0x16')]);router['put'](_0xf7b1('0xd'),auth[_0xf7b1('0x9')](),interaction[_0xf7b1('0x17')](_0xf7b1('0x14'),_0xf7b1('0x18')),controller[_0xf7b1('0x19')]);router[_0xf7b1('0x1a')](_0xf7b1('0xd'),auth['isAuthenticated'](),interaction[_0xf7b1('0x17')](_0xf7b1('0x14'),_0xf7b1('0x1b')),controller[_0xf7b1('0x1c')]);router[_0xf7b1('0x1a')](_0xf7b1('0x13'),auth[_0xf7b1('0x9')](),controller[_0xf7b1('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index e65ee5e..e6a5755 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 _0x0e85=['exports','medium','BOOLEAN','TEXT','sequelize'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x0e85,0x7c));var _0x50e8=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x0e85[_0x12fc8d];return _0x3f9d04;};'use strict';var Sequelize=require(_0x50e8('0x0'));module[_0x50e8('0x1')]={'body':{'type':Sequelize['TEXT'](_0x50e8('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x50e8('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x50e8('0x4')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x9649=['out','sequelize','exports','TEXT','medium','ENUM'];(function(_0x246346,_0x335ee5){var _0x5e0957=function(_0x310f9b){while(--_0x310f9b){_0x246346['push'](_0x246346['shift']());}};_0x5e0957(++_0x335ee5);}(_0x9649,0x19f));var _0x9964=function(_0x33c988,_0x1ea3a7){_0x33c988=_0x33c988-0x0;var _0x169b88=_0x9649[_0x33c988];return _0x169b88;};'use strict';var Sequelize=require(_0x9964('0x0'));module[_0x9964('0x1')]={'body':{'type':Sequelize[_0x9964('0x2')](_0x9964('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9964('0x4')]('in',_0x9964('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x9964('0x2')],'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 2b8b98b..4efdab5 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 _0x6787=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','index','FaxMessage','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','show','params','rawAttributes','options','body','find','describe','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','read1stAt','role','null','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','rejectmessage','create','isNil','Attachment','findOne','AttachmentId','basename','join','root','server','files','attachments','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x3707d5,_0x5827db){var _0x2d9ce3=function(_0x4bc241){while(--_0x4bc241){_0x3707d5['push'](_0x3707d5['shift']());}};_0x2d9ce3(++_0x5827db);}(_0x6787,0x105));var _0x7678=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x6787[_0xa1e3e3];return _0xc980e9;};'use strict';var emlformat=require(_0x7678('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7678('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7678('0x2'));var moment=require(_0x7678('0x3'));var BPromise=require(_0x7678('0x4'));var Mustache=require(_0x7678('0x5'));var util=require('util');var path=require(_0x7678('0x6'));var sox=require('sox');var csv=require(_0x7678('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7678('0x8'));var _=require(_0x7678('0x9'));var squel=require(_0x7678('0xa'));var crypto=require(_0x7678('0xb'));var jsforce=require(_0x7678('0xc'));var deskjs=require(_0x7678('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7678('0xe'));var Redis=require(_0x7678('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7678('0x10'));var hardwareService=require(_0x7678('0x11'));var logger=require(_0x7678('0x12'))(_0x7678('0x13'));var utils=require('../../config/utils');var config=require(_0x7678('0x14'));var licenseUtil=require(_0x7678('0x15'));var db=require('../../mysqldb')['db'];config[_0x7678('0x16')]=_['defaults'](config[_0x7678('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x7678('0x17'))(new Redis(config['redis']));require(_0x7678('0x18'))[_0x7678('0x19')](socket);var jayson=require(_0x7678('0x1a'));var client=jayson[_0x7678('0x1b')][_0x7678('0x1c')]({'port':0x232c});var client9002=jayson[_0x7678('0x1b')][_0x7678('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x43f849,_0x373477,_0x5688c9,_0x3d7794){return new BPromise(function(_0x3ced55,_0x53fac9){var _0x438894=_0x3d7794||client;return _0x438894[_0x7678('0x1d')](_0x43f849,_0x5688c9)[_0x7678('0x1e')](function(_0x4c441d){logger['info'](_0x7678('0x1f'),_0x373477,_0x7678('0x20'));logger[_0x7678('0x21')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x373477,_0x7678('0x20'),JSON[_0x7678('0x22')](_0x4c441d));if(_0x4c441d[_0x7678('0x23')]){if(_0x4c441d[_0x7678('0x23')]['code']===0x1f4){logger[_0x7678('0x23')]('FaxMessage,\x20%s,\x20%s',_0x373477,_0x4c441d['error'][_0x7678('0x24')]);return _0x53fac9(_0x4c441d['error'][_0x7678('0x24')]);}logger[_0x7678('0x23')](_0x7678('0x1f'),_0x373477,_0x4c441d[_0x7678('0x23')][_0x7678('0x24')]);return _0x3ced55(_0x4c441d[_0x7678('0x23')][_0x7678('0x24')]);}else{logger[_0x7678('0x25')](_0x7678('0x1f'),_0x373477,_0x7678('0x20'));_0x3ced55(_0x4c441d[_0x7678('0x26')][_0x7678('0x24')]);}})[_0x7678('0x27')](function(_0x5f0c3a){logger[_0x7678('0x23')](_0x7678('0x1f'),_0x373477,_0x5f0c3a);_0x53fac9(_0x5f0c3a);});});}function respondWithStatusCode(_0x1a9522,_0x568cce){_0x568cce=_0x568cce||0xcc;return function(_0x43280f){if(_0x43280f){return _0x1a9522[_0x7678('0x28')](_0x568cce);}return _0x1a9522[_0x7678('0x29')](_0x568cce)[_0x7678('0x2a')]();};}function respondWithResult(_0x1a9e4a,_0x3f32d5){_0x3f32d5=_0x3f32d5||0xc8;return function(_0x2e4cca){if(_0x2e4cca){return _0x1a9e4a['status'](_0x3f32d5)[_0x7678('0x2b')](_0x2e4cca);}};}function respondWithFilteredResult(_0x24bffb,_0x4257b2){return function(_0x3c3d87){if(_0x3c3d87){var _0x1a6b4b=typeof _0x4257b2[_0x7678('0x2c')]===_0x7678('0x2d')&&typeof _0x4257b2[_0x7678('0x2e')]===_0x7678('0x2d');var _0xa1b9d4=_0x3c3d87[_0x7678('0x2f')];var _0x3c8ac1=_0x1a6b4b?0x0:_0x4257b2[_0x7678('0x2c')];var _0x26dce8=_0x1a6b4b?_0x3c3d87[_0x7678('0x2f')]:_0x4257b2[_0x7678('0x2c')]+_0x4257b2['limit'];var _0x5614b3;if(_0x26dce8>=_0xa1b9d4){_0x26dce8=_0xa1b9d4;_0x5614b3=0xc8;}else{_0x5614b3=0xce;}_0x24bffb[_0x7678('0x29')](_0x5614b3);return _0x24bffb[_0x7678('0x30')](_0x7678('0x31'),_0x3c8ac1+'-'+_0x26dce8+'/'+_0xa1b9d4)[_0x7678('0x2b')](_0x3c3d87);}return null;};}function patchUpdates(_0x1b4e88){return function(_0x7aeeed){try{jsonpatch[_0x7678('0x32')](_0x7aeeed,_0x1b4e88,!![]);}catch(_0x4ee660){return BPromise[_0x7678('0x33')](_0x4ee660);}return _0x7aeeed[_0x7678('0x34')]();};}function saveUpdates(_0x2e4cf3,_0x7e9a16){return function(_0x4db1a2){if(_0x4db1a2){return _0x4db1a2[_0x7678('0x35')](_0x2e4cf3)[_0x7678('0x1e')](function(_0x2676e6){return _0x2676e6;});}return null;};}function removeEntity(_0x235d0a,_0x5d65ef){return function(_0x106611){if(_0x106611){return _0x106611[_0x7678('0x36')]()[_0x7678('0x1e')](function(){_0x235d0a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3737e5,_0x23271c){return function(_0x570c59){if(!_0x570c59){_0x3737e5[_0x7678('0x28')](0x194);}return _0x570c59;};}function handleError(_0x1f8f55,_0x4d3d48){_0x4d3d48=_0x4d3d48||0x1f4;return function(_0x33de29){logger['error'](_0x33de29['stack']);if(_0x33de29[_0x7678('0x37')]){delete _0x33de29[_0x7678('0x37')];}_0x1f8f55[_0x7678('0x29')](_0x4d3d48)['send'](_0x33de29);};}exports[_0x7678('0x38')]=function(_0x46a7fa,_0x4e1abf){var _0x36ef36={},_0x47b5d6={},_0x23f088={'count':0x0,'rows':[]};var _0x1ab966=_['map'](db[_0x7678('0x39')]['rawAttributes'],function(_0x9d5f26){return{'name':_0x9d5f26[_0x7678('0x3a')],'type':_0x9d5f26[_0x7678('0x3b')][_0x7678('0x3c')]};});_0x47b5d6[_0x7678('0x3d')]=_[_0x7678('0x3e')](_0x1ab966,_0x7678('0x37'));_0x47b5d6['query']=_[_0x7678('0x3f')](_0x46a7fa[_0x7678('0x40')]);_0x47b5d6[_0x7678('0x41')]=_[_0x7678('0x42')](_0x47b5d6[_0x7678('0x3d')],_0x47b5d6['query']);_0x36ef36[_0x7678('0x43')]=_[_0x7678('0x42')](_0x47b5d6['model'],qs[_0x7678('0x44')](_0x46a7fa[_0x7678('0x40')][_0x7678('0x44')]));_0x36ef36[_0x7678('0x43')]=_0x36ef36[_0x7678('0x43')][_0x7678('0x45')]?_0x36ef36[_0x7678('0x43')]:_0x47b5d6[_0x7678('0x3d')];if(!_0x46a7fa['query'][_0x7678('0x46')](_0x7678('0x47'))){_0x36ef36[_0x7678('0x2e')]=qs['limit'](_0x46a7fa[_0x7678('0x40')][_0x7678('0x2e')]);_0x36ef36['offset']=qs[_0x7678('0x2c')](_0x46a7fa[_0x7678('0x40')][_0x7678('0x2c')]);}_0x36ef36[_0x7678('0x48')]=qs[_0x7678('0x49')](_0x46a7fa['query']['sort']);_0x36ef36[_0x7678('0x4a')]=qs[_0x7678('0x41')](_[_0x7678('0x4b')](_0x46a7fa[_0x7678('0x40')],_0x47b5d6['filters']),_0x1ab966);if(_0x46a7fa[_0x7678('0x40')][_0x7678('0x4c')]){_0x36ef36['where']=_[_0x7678('0x4d')](_0x36ef36[_0x7678('0x4a')],{'$or':_[_0x7678('0x3e')](_0x1ab966,function(_0x43e7ae){if(_0x43e7ae['type']!=='VIRTUAL'){var _0x562fd3={};_0x562fd3[_0x43e7ae['name']]={'$like':'%'+_0x46a7fa[_0x7678('0x40')][_0x7678('0x4c')]+'%'};return _0x562fd3;}})});}_0x36ef36=_[_0x7678('0x4d')]({},_0x36ef36,_0x46a7fa['options']);var _0x122487={'where':_0x36ef36['where']};return db[_0x7678('0x39')][_0x7678('0x2f')](_0x122487)['then'](function(_0x40ffd5){_0x23f088[_0x7678('0x2f')]=_0x40ffd5;if(_0x46a7fa[_0x7678('0x40')][_0x7678('0x4e')]){_0x36ef36[_0x7678('0x4f')]=[{'all':!![]}];}return db[_0x7678('0x39')][_0x7678('0x50')](_0x36ef36);})[_0x7678('0x1e')](function(_0x5a3592){_0x23f088['rows']=_0x5a3592;return _0x23f088;})[_0x7678('0x1e')](respondWithFilteredResult(_0x4e1abf,_0x36ef36))[_0x7678('0x27')](handleError(_0x4e1abf,null));};exports[_0x7678('0x51')]=function(_0x202a9b,_0x56120c){var _0x348901={'raw':!![],'where':{'id':_0x202a9b[_0x7678('0x52')]['id']}},_0x54fbe1={};_0x54fbe1[_0x7678('0x3d')]=_['keys'](db[_0x7678('0x39')][_0x7678('0x53')]);_0x54fbe1[_0x7678('0x40')]=_[_0x7678('0x3f')](_0x202a9b[_0x7678('0x40')]);_0x54fbe1['filters']=_[_0x7678('0x42')](_0x54fbe1[_0x7678('0x3d')],_0x54fbe1[_0x7678('0x40')]);_0x348901[_0x7678('0x43')]=_[_0x7678('0x42')](_0x54fbe1['model'],qs['fields'](_0x202a9b[_0x7678('0x40')][_0x7678('0x44')]));_0x348901[_0x7678('0x43')]=_0x348901[_0x7678('0x43')]['length']?_0x348901[_0x7678('0x43')]:_0x54fbe1['model'];if(_0x202a9b['query'][_0x7678('0x4e')]){_0x348901[_0x7678('0x4f')]=[{'all':!![]}];}_0x348901=_[_0x7678('0x4d')]({},_0x348901,_0x202a9b[_0x7678('0x54')]);return db[_0x7678('0x39')]['find'](_0x348901)[_0x7678('0x1e')](handleEntityNotFound(_0x56120c,null))[_0x7678('0x1e')](respondWithResult(_0x56120c,null))[_0x7678('0x27')](handleError(_0x56120c,null));};exports[_0x7678('0x35')]=function(_0x843860,_0x387ab6){if(_0x843860[_0x7678('0x55')]['id']){delete _0x843860[_0x7678('0x55')]['id'];}return db['FaxMessage']['find']({'where':{'id':_0x843860[_0x7678('0x52')]['id']}})[_0x7678('0x1e')](handleEntityNotFound(_0x387ab6,null))['then'](saveUpdates(_0x843860[_0x7678('0x55')],null))[_0x7678('0x1e')](respondWithResult(_0x387ab6,null))[_0x7678('0x27')](handleError(_0x387ab6,null));};exports[_0x7678('0x36')]=function(_0x546fb6,_0xe96d82){return db[_0x7678('0x39')][_0x7678('0x56')]({'where':{'id':_0x546fb6[_0x7678('0x52')]['id']}})['then'](handleEntityNotFound(_0xe96d82,null))[_0x7678('0x1e')](removeEntity(_0xe96d82,null))[_0x7678('0x27')](handleError(_0xe96d82,null));};exports[_0x7678('0x57')]=function(_0x571460,_0x35c9da){return db[_0x7678('0x39')][_0x7678('0x57')]()[_0x7678('0x1e')](respondWithResult(_0x35c9da,null))[_0x7678('0x27')](handleError(_0x35c9da,null));};var interaction_log=require('../../config/logger')(_0x7678('0x58'));exports[_0x7678('0x59')]=function(_0x18e799,_0x386dcb,_0x454096){var _0x3a933e={'agent':{},'channel':_0x7678('0x5a')};if(_0x18e799[_0x7678('0x55')]['id']){delete _0x18e799[_0x7678('0x55')]['id'];}_0x18e799['body'][_0x7678('0x5b')]=!![];_0x18e799[_0x7678('0x55')]['readAt']=moment()[_0x7678('0x5c')](_0x7678('0x5d'));_0x18e799['body'][_0x7678('0x5e')]=_0x18e799[_0x7678('0x55')][_0x7678('0x5e')]||_0x18e799[_0x7678('0x5f')]['id'];_0x3a933e['agent']['id']=_0x18e799['body']['UserId'];return db[_0x7678('0x39')][_0x7678('0x56')]({'where':{'id':_0x18e799[_0x7678('0x52')]['id'],'UserId':null}})[_0x7678('0x1e')](handleEntityNotFound(_0x386dcb,null))['then'](saveUpdates(_0x18e799['body'],null))['then'](function(_0x48df97){if(_0x48df97){_0x3a933e['message']=_0x48df97[_0x7678('0x60')]({'plain':!![]});return db[_0x7678('0x61')][_0x7678('0x56')]({'where':{'id':_0x48df97[_0x7678('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x386dcb,null))[_0x7678('0x1e')](function(_0x5d78bc){if(_0x5d78bc){return _0x5d78bc['update']({'UserId':_0x18e799['body'][_0x7678('0x5e')],'read1stAt':_['isNil'](_0x5d78bc[_0x7678('0x63')])?moment()[_0x7678('0x5c')](_0x7678('0x5d')):undefined});}return null;})[_0x7678('0x1e')](function(_0x40382a){if(_0x40382a){_0x3a933e['interaction']=_0x40382a[_0x7678('0x60')]({'plain':!![]});interaction_log[_0x7678('0x25')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x18e799[_0x7678('0x5f')]['id'],_0x18e799['user']['name'],_0x18e799[_0x7678('0x5f')][_0x7678('0x64')],_0x3a933e['interaction']['id'],_0x18e799['body']?JSON[_0x7678('0x22')](_0x18e799[_0x7678('0x55')]):_0x7678('0x65'));return respondWithRpcPromise('AcceptMessage',_0x7678('0x66'),_0x3a933e);}return null;})[_0x7678('0x1e')](function(_0x349647){var _0x571d30='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x349647[_0x7678('0x24')][_0x7678('0x67')];return db[_0x7678('0x68')][_0x7678('0x40')](_0x571d30,{'type':db[_0x7678('0x69')][_0x7678('0x6a')][_0x7678('0x6b')],'raw':!![]})[_0x7678('0x1e')](function(_0xce6790){return _0xce6790;});})[_0x7678('0x1e')](function(_0x3eb688){if(_0x3eb688){_0x3a933e[_0x7678('0x24')][_0x7678('0x6c')]=_0x3eb688[0x0];if(!_0x18e799[_0x7678('0x55')][_0x7678('0x5e')])return;return db[_0x7678('0x6d')][_0x7678('0x56')]({'where':{'id':_0x18e799[_0x7678('0x55')][_0x7678('0x5e')],'role':_0x7678('0x6e')},'attributes':['id',_0x7678('0x37'),_0x7678('0x6f'),_0x7678('0x70'),_0x7678('0x71')],'raw':!![]});}return null;})[_0x7678('0x1e')](function(_0xbf4254){if(!_0xbf4254)return null;_0x3a933e[_0x7678('0x24')][_0x7678('0x6e')]=_0xbf4254;return _0x3a933e;})['then'](function(_0x292050){if(_0x292050){if(_0x18e799[_0x7678('0x55')][_0x7678('0x72')]){_0x3a933e[_0x7678('0x24')][_0x7678('0x73')]=util['format'](_0x7678('0x74'),_0x18e799[_0x7678('0x5f')]['name']);_0x3a933e[_0x7678('0x24')]['channel']=_0x3a933e[_0x7678('0x75')];_0x3a933e[_0x7678('0x24')][_0x7678('0x76')]=_0x3a933e[_0x7678('0x75')];_0x3a933e[_0x7678('0x24')][_0x7678('0x77')]=_0x7678('0x59');return respondWithRpcPromise('EventManager',_0x7678('0x78'),{'event':_0x7678('0x79'),'message':_0x3a933e[_0x7678('0x24')]},client9002)[_0x7678('0x1e')](function(){return _0x3a933e;});}return _0x3a933e;}return null;})[_0x7678('0x1e')](respondWithResult(_0x386dcb,null))[_0x7678('0x27')](handleError(_0x386dcb,null));};var interaction_log=require(_0x7678('0x12'))(_0x7678('0x58'));exports['reject']=function(_0x41bbe4,_0x2513e6,_0x4deeea){var _0x3ab857={'agent':{},'channel':_0x7678('0x5a')};if(_0x41bbe4[_0x7678('0x55')]['id']){delete _0x41bbe4[_0x7678('0x55')]['id'];}_0x41bbe4[_0x7678('0x55')][_0x7678('0x5e')]=_0x41bbe4[_0x7678('0x55')][_0x7678('0x5e')]||_0x41bbe4['user']['id'];_0x3ab857[_0x7678('0x6e')]['id']=_0x41bbe4['body'][_0x7678('0x5e')];return db['FaxMessage']['find']({'where':{'id':_0x41bbe4[_0x7678('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2513e6,null))[_0x7678('0x1e')](function(_0x4667c0){if(_0x4667c0){_0x3ab857[_0x7678('0x24')]=_0x4667c0[_0x7678('0x60')]({'plain':!![]});return db[_0x7678('0x61')][_0x7678('0x56')]({'where':{'id':_0x4667c0[_0x7678('0x62')]}});}return null;})[_0x7678('0x1e')](handleEntityNotFound(_0x2513e6,null))[_0x7678('0x1e')](function(_0x14948f){if(_0x14948f){_0x3ab857[_0x7678('0x7a')]=_0x14948f[_0x7678('0x60')]({'plain':!![]});interaction_log['info'](_0x7678('0x7b'),_0x41bbe4[_0x7678('0x5f')]['id'],_0x41bbe4[_0x7678('0x5f')]['name'],_0x41bbe4[_0x7678('0x5f')]['role'],_0x3ab857[_0x7678('0x7a')]['id'],_0x41bbe4[_0x7678('0x55')]?JSON['stringify'](_0x41bbe4[_0x7678('0x55')]):'null');return respondWithRpcPromise(_0x7678('0x7c'),_0x7678('0x7d'),_0x3ab857);}return null;})[_0x7678('0x1e')](function(_0x4018f6){var _0x40aa8a=_0x7678('0x7e')+_0x4018f6['message'][_0x7678('0x67')];return db[_0x7678('0x68')]['query'](_0x40aa8a,{'type':db[_0x7678('0x69')][_0x7678('0x6a')][_0x7678('0x6b')],'raw':!![]})[_0x7678('0x1e')](function(_0x37b0de){return _0x37b0de;});})[_0x7678('0x1e')](function(_0x2d7321){if(_0x2d7321){_0x3ab857['message']['contact']=_0x2d7321[0x0];if(!_0x41bbe4[_0x7678('0x55')]['UserId'])return;return db['User'][_0x7678('0x56')]({'where':{'id':_0x41bbe4[_0x7678('0x55')][_0x7678('0x5e')],'role':_0x7678('0x6e')},'attributes':['id',_0x7678('0x37'),_0x7678('0x6f'),_0x7678('0x70'),_0x7678('0x71')],'raw':!![]});}return null;})['then'](function(_0x3309e4){if(!_0x3309e4)return null;_0x3ab857[_0x7678('0x24')][_0x7678('0x6e')]=_0x3309e4;return _0x3ab857;})['then'](function(_0x3462eb){if(_0x3462eb){_0x3462eb[_0x7678('0x24')][_0x7678('0x73')]=util[_0x7678('0x5c')](_0x7678('0x74'),_0x41bbe4[_0x7678('0x5f')][_0x7678('0x37')]);_0x3462eb[_0x7678('0x24')][_0x7678('0x75')]=_0x3ab857[_0x7678('0x75')];_0x3462eb[_0x7678('0x24')]['motionChannel']=_0x3ab857[_0x7678('0x75')];_0x3462eb['message'][_0x7678('0x77')]=_0x7678('0x33');respondWithRpcPromise(_0x7678('0x78'),'EventManager',{'event':_0x7678('0x7f'),'message':_0x3462eb[_0x7678('0x24')]},client9002);return _0x3ab857;}return null;})[_0x7678('0x1e')](respondWithResult(_0x2513e6,null))[_0x7678('0x27')](handleError(_0x2513e6,null));};exports[_0x7678('0x80')]=function(_0x139802,_0xa5e6f1){var _0x1761ed;return db['FaxMessage'][_0x7678('0x80')](_0x139802[_0x7678('0x55')],{})[_0x7678('0x1e')](function(_0x4bdb7e){_0x1761ed=_0x4bdb7e;return db['CmContact']['findOne']({'where':{'id':_0x1761ed[_0x7678('0x67')]}});})['then'](function(_0x54a596){if(_[_0x7678('0x81')](_0x54a596)){return;}else{_0x1761ed['fax']=_0x54a596[_0x7678('0x5a')];return db[_0x7678('0x82')][_0x7678('0x83')]({'where':{'id':_0x1761ed[_0x7678('0x84')]}});}})[_0x7678('0x1e')](function(_0x4c53e3){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_['isNil'](_0x139802[_0x7678('0x55')])?undefined:_0x139802['body']['FaxAccountId'],'path':_[_0x7678('0x81')](_0x4c53e3)?undefined:util[_0x7678('0x5c')]('/var/opt/motion2/server/files/attachments/%s',_0x4c53e3[_0x7678('0x85')]),'fax':_[_0x7678('0x81')](_0x1761ed[_0x7678('0x5a')])?undefined:_0x1761ed['fax'],'AttachmentId':_0x1761ed[_0x7678('0x84')]},client9002);})[_0x7678('0x1e')](respondWithResult(_0xa5e6f1,0xc9))[_0x7678('0x27')](handleError(_0xa5e6f1,null));};exports['download']=function(_0x3630ad,_0x14b8bb){var _0x3c544b=path[_0x7678('0x86')](config[_0x7678('0x87')],_0x7678('0x88'),_0x7678('0x89'),_0x7678('0x8a'));return db[_0x7678('0x39')][_0x7678('0x56')]({'where':{'id':_0x3630ad[_0x7678('0x52')]['id']},'include':[{'model':db[_0x7678('0x82')],'as':_0x7678('0x82')}]})[_0x7678('0x1e')](handleEntityNotFound(_0x14b8bb,null))['then'](function(_0x492895){if(_0x492895){return _0x14b8bb['download'](path[_0x7678('0x86')](_0x3c544b,_0x492895[_0x7678('0x82')][_0x7678('0x85')]));}})[_0x7678('0x27')](handleError(_0x14b8bb,null));}; \ No newline at end of file +var _0x55f9=['/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','files','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','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','defaults','localhost','socket.io-emitter','redis','./faxMessage.socket','register','client','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','end','status','undefined','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','name','index','map','FaxMessage','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','rawAttributes','find','body','describe','fax-interactions','accept','fax','readAt','format','UserId','user','agent','FaxInteraction','read1stAt','YYYY-MM-DD\x20HH:mm:ss','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','fullname','rejectmessage','create','findOne','Attachment','SendFax','isNil'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x55f9,0x11f));var _0x955f=function(_0x44d139,_0x2934fe){_0x44d139=_0x44d139-0x0;var _0x495659=_0x55f9[_0x44d139];return _0x495659;};'use strict';var emlformat=require(_0x955f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x955f('0x1'));var jsonpatch=require(_0x955f('0x2'));var rp=require(_0x955f('0x3'));var moment=require('moment');var BPromise=require(_0x955f('0x4'));var Mustache=require(_0x955f('0x5'));var util=require(_0x955f('0x6'));var path=require(_0x955f('0x7'));var sox=require('sox');var csv=require(_0x955f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x955f('0x9'));var _=require('lodash');var squel=require(_0x955f('0xa'));var crypto=require('crypto');var jsforce=require(_0x955f('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x955f('0xc'));var Papa=require(_0x955f('0xd'));var Redis=require(_0x955f('0xe'));var authService=require(_0x955f('0xf'));var qs=require(_0x955f('0x10'));var as=require(_0x955f('0x11'));var hardwareService=require(_0x955f('0x12'));var logger=require(_0x955f('0x13'))(_0x955f('0x14'));var utils=require(_0x955f('0x15'));var config=require(_0x955f('0x16'));var licenseUtil=require(_0x955f('0x17'));var db=require(_0x955f('0x18'))['db'];config['redis']=_[_0x955f('0x19')](config['redis'],{'host':_0x955f('0x1a'),'port':0x18eb});var socket=require(_0x955f('0x1b'))(new Redis(config[_0x955f('0x1c')]));require(_0x955f('0x1d'))[_0x955f('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x955f('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x955f('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c40c6,_0x375ba1,_0x2a6e8a,_0x257b7f){return new BPromise(function(_0x3c1bcb,_0x55745a){var _0x13645e=_0x257b7f||client;return _0x13645e[_0x955f('0x20')](_0x4c40c6,_0x2a6e8a)['then'](function(_0x5af493){logger[_0x955f('0x21')](_0x955f('0x22'),_0x375ba1,_0x955f('0x23'));logger['debug'](_0x955f('0x24'),_0x375ba1,'request\x20sent',JSON[_0x955f('0x25')](_0x5af493));if(_0x5af493['error']){if(_0x5af493[_0x955f('0x26')]['code']===0x1f4){logger[_0x955f('0x26')](_0x955f('0x22'),_0x375ba1,_0x5af493[_0x955f('0x26')][_0x955f('0x27')]);return _0x55745a(_0x5af493[_0x955f('0x26')][_0x955f('0x27')]);}logger[_0x955f('0x26')]('FaxMessage,\x20%s,\x20%s',_0x375ba1,_0x5af493[_0x955f('0x26')]['message']);return _0x3c1bcb(_0x5af493['error'][_0x955f('0x27')]);}else{logger[_0x955f('0x21')](_0x955f('0x22'),_0x375ba1,'request\x20sent');_0x3c1bcb(_0x5af493[_0x955f('0x28')][_0x955f('0x27')]);}})['catch'](function(_0x8136a7){logger[_0x955f('0x26')](_0x955f('0x22'),_0x375ba1,_0x8136a7);_0x55745a(_0x8136a7);});});}function respondWithStatusCode(_0x15289a,_0x3a2ead){_0x3a2ead=_0x3a2ead||0xcc;return function(_0xc414bc){if(_0xc414bc){return _0x15289a[_0x955f('0x29')](_0x3a2ead);}return _0x15289a['status'](_0x3a2ead)[_0x955f('0x2a')]();};}function respondWithResult(_0x4971f1,_0x2c6f1d){_0x2c6f1d=_0x2c6f1d||0xc8;return function(_0x3a96b3){if(_0x3a96b3){return _0x4971f1[_0x955f('0x2b')](_0x2c6f1d)['json'](_0x3a96b3);}};}function respondWithFilteredResult(_0x4559ad,_0xd9653d){return function(_0x568df8){if(_0x568df8){var _0x3fa96c=typeof _0xd9653d['offset']===_0x955f('0x2c')&&typeof _0xd9653d['limit']===_0x955f('0x2c');var _0x460ea5=_0x568df8['count'];var _0x3bb5c2=_0x3fa96c?0x0:_0xd9653d[_0x955f('0x2d')];var _0x1a5621=_0x3fa96c?_0x568df8[_0x955f('0x2e')]:_0xd9653d['offset']+_0xd9653d[_0x955f('0x2f')];var _0x5591b9;if(_0x1a5621>=_0x460ea5){_0x1a5621=_0x460ea5;_0x5591b9=0xc8;}else{_0x5591b9=0xce;}_0x4559ad['status'](_0x5591b9);return _0x4559ad[_0x955f('0x30')](_0x955f('0x31'),_0x3bb5c2+'-'+_0x1a5621+'/'+_0x460ea5)['json'](_0x568df8);}return null;};}function patchUpdates(_0x3401fa){return function(_0x1d08ae){try{jsonpatch[_0x955f('0x32')](_0x1d08ae,_0x3401fa,!![]);}catch(_0x32cfc8){return BPromise[_0x955f('0x33')](_0x32cfc8);}return _0x1d08ae['save']();};}function saveUpdates(_0x5cd994,_0x481adf){return function(_0x2b5056){if(_0x2b5056){return _0x2b5056[_0x955f('0x34')](_0x5cd994)[_0x955f('0x35')](function(_0x20b96d){return _0x20b96d;});}return null;};}function removeEntity(_0x12c03c,_0x92f8da){return function(_0x219192){if(_0x219192){return _0x219192[_0x955f('0x36')]()[_0x955f('0x35')](function(){_0x12c03c['status'](0xcc)[_0x955f('0x2a')]();});}};}function handleEntityNotFound(_0x10b525,_0x284ec0){return function(_0x3d1463){if(!_0x3d1463){_0x10b525[_0x955f('0x29')](0x194);}return _0x3d1463;};}function handleError(_0x440ec8,_0x38966b){_0x38966b=_0x38966b||0x1f4;return function(_0xb72125){logger[_0x955f('0x26')](_0xb72125['stack']);if(_0xb72125[_0x955f('0x37')]){delete _0xb72125[_0x955f('0x37')];}_0x440ec8[_0x955f('0x2b')](_0x38966b)['send'](_0xb72125);};}exports[_0x955f('0x38')]=function(_0xee844e,_0x3c88ea){var _0x2f9298={},_0xecdae5={},_0x352b97={'count':0x0,'rows':[]};var _0x4afaf2=_[_0x955f('0x39')](db[_0x955f('0x3a')]['rawAttributes'],function(_0x22e7b4){return{'name':_0x22e7b4[_0x955f('0x3b')],'type':_0x22e7b4[_0x955f('0x3c')][_0x955f('0x3d')]};});_0xecdae5[_0x955f('0x3e')]=_['map'](_0x4afaf2,_0x955f('0x37'));_0xecdae5['query']=_[_0x955f('0x3f')](_0xee844e['query']);_0xecdae5[_0x955f('0x40')]=_[_0x955f('0x41')](_0xecdae5['model'],_0xecdae5[_0x955f('0x42')]);_0x2f9298['attributes']=_['intersection'](_0xecdae5['model'],qs['fields'](_0xee844e[_0x955f('0x42')][_0x955f('0x43')]));_0x2f9298[_0x955f('0x44')]=_0x2f9298['attributes'][_0x955f('0x45')]?_0x2f9298[_0x955f('0x44')]:_0xecdae5[_0x955f('0x3e')];if(!_0xee844e['query']['hasOwnProperty'](_0x955f('0x46'))){_0x2f9298[_0x955f('0x2f')]=qs['limit'](_0xee844e[_0x955f('0x42')][_0x955f('0x2f')]);_0x2f9298['offset']=qs[_0x955f('0x2d')](_0xee844e[_0x955f('0x42')][_0x955f('0x2d')]);}_0x2f9298[_0x955f('0x47')]=qs['sort'](_0xee844e[_0x955f('0x42')][_0x955f('0x48')]);_0x2f9298[_0x955f('0x49')]=qs[_0x955f('0x40')](_[_0x955f('0x4a')](_0xee844e[_0x955f('0x42')],_0xecdae5[_0x955f('0x40')]),_0x4afaf2);if(_0xee844e[_0x955f('0x42')][_0x955f('0x4b')]){_0x2f9298[_0x955f('0x49')]=_[_0x955f('0x4c')](_0x2f9298['where'],{'$or':_['map'](_0x4afaf2,function(_0x2f7b52){if(_0x2f7b52[_0x955f('0x3c')]!==_0x955f('0x4d')){var _0x1832e3={};_0x1832e3[_0x2f7b52[_0x955f('0x37')]]={'$like':'%'+_0xee844e[_0x955f('0x42')][_0x955f('0x4b')]+'%'};return _0x1832e3;}})});}_0x2f9298=_['merge']({},_0x2f9298,_0xee844e[_0x955f('0x4e')]);var _0x195030={'where':_0x2f9298[_0x955f('0x49')]};return db[_0x955f('0x3a')][_0x955f('0x2e')](_0x195030)[_0x955f('0x35')](function(_0x468c0a){_0x352b97[_0x955f('0x2e')]=_0x468c0a;if(_0xee844e[_0x955f('0x42')][_0x955f('0x4f')]){_0x2f9298[_0x955f('0x50')]=[{'all':!![]}];}return db[_0x955f('0x3a')][_0x955f('0x51')](_0x2f9298);})[_0x955f('0x35')](function(_0x4beb55){_0x352b97['rows']=_0x4beb55;return _0x352b97;})[_0x955f('0x35')](respondWithFilteredResult(_0x3c88ea,_0x2f9298))[_0x955f('0x52')](handleError(_0x3c88ea,null));};exports['show']=function(_0x438733,_0x26f260){var _0x37ea49={'raw':!![],'where':{'id':_0x438733['params']['id']}},_0x40a024={};_0x40a024[_0x955f('0x3e')]=_[_0x955f('0x3f')](db[_0x955f('0x3a')][_0x955f('0x53')]);_0x40a024[_0x955f('0x42')]=_[_0x955f('0x3f')](_0x438733[_0x955f('0x42')]);_0x40a024['filters']=_['intersection'](_0x40a024[_0x955f('0x3e')],_0x40a024[_0x955f('0x42')]);_0x37ea49['attributes']=_['intersection'](_0x40a024[_0x955f('0x3e')],qs[_0x955f('0x43')](_0x438733['query'][_0x955f('0x43')]));_0x37ea49['attributes']=_0x37ea49['attributes'][_0x955f('0x45')]?_0x37ea49[_0x955f('0x44')]:_0x40a024['model'];if(_0x438733['query'][_0x955f('0x4f')]){_0x37ea49[_0x955f('0x50')]=[{'all':!![]}];}_0x37ea49=_[_0x955f('0x4c')]({},_0x37ea49,_0x438733[_0x955f('0x4e')]);return db[_0x955f('0x3a')][_0x955f('0x54')](_0x37ea49)[_0x955f('0x35')](handleEntityNotFound(_0x26f260,null))[_0x955f('0x35')](respondWithResult(_0x26f260,null))['catch'](handleError(_0x26f260,null));};exports[_0x955f('0x34')]=function(_0x41a398,_0x2d6a1a){if(_0x41a398[_0x955f('0x55')]['id']){delete _0x41a398[_0x955f('0x55')]['id'];}return db['FaxMessage']['find']({'where':{'id':_0x41a398['params']['id']}})[_0x955f('0x35')](handleEntityNotFound(_0x2d6a1a,null))['then'](saveUpdates(_0x41a398[_0x955f('0x55')],null))['then'](respondWithResult(_0x2d6a1a,null))['catch'](handleError(_0x2d6a1a,null));};exports['destroy']=function(_0x2daa64,_0x2ef5a9){return db[_0x955f('0x3a')][_0x955f('0x54')]({'where':{'id':_0x2daa64['params']['id']}})[_0x955f('0x35')](handleEntityNotFound(_0x2ef5a9,null))[_0x955f('0x35')](removeEntity(_0x2ef5a9,null))[_0x955f('0x52')](handleError(_0x2ef5a9,null));};exports[_0x955f('0x56')]=function(_0x335361,_0x53e3ab){return db[_0x955f('0x3a')][_0x955f('0x56')]()[_0x955f('0x35')](respondWithResult(_0x53e3ab,null))[_0x955f('0x52')](handleError(_0x53e3ab,null));};var interaction_log=require(_0x955f('0x13'))(_0x955f('0x57'));exports[_0x955f('0x58')]=function(_0x3068db,_0x4c5dec,_0x586058){var _0x34ae69={'agent':{},'channel':_0x955f('0x59')};if(_0x3068db[_0x955f('0x55')]['id']){delete _0x3068db[_0x955f('0x55')]['id'];}_0x3068db['body']['read']=!![];_0x3068db[_0x955f('0x55')][_0x955f('0x5a')]=moment()[_0x955f('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x3068db[_0x955f('0x55')][_0x955f('0x5c')]=_0x3068db[_0x955f('0x55')][_0x955f('0x5c')]||_0x3068db[_0x955f('0x5d')]['id'];_0x34ae69[_0x955f('0x5e')]['id']=_0x3068db[_0x955f('0x55')][_0x955f('0x5c')];return db[_0x955f('0x3a')][_0x955f('0x54')]({'where':{'id':_0x3068db['params']['id'],'UserId':null}})[_0x955f('0x35')](handleEntityNotFound(_0x4c5dec,null))[_0x955f('0x35')](saveUpdates(_0x3068db[_0x955f('0x55')],null))[_0x955f('0x35')](function(_0x21436f){if(_0x21436f){_0x34ae69[_0x955f('0x27')]=_0x21436f['get']({'plain':!![]});return db[_0x955f('0x5f')][_0x955f('0x54')]({'where':{'id':_0x21436f['FaxInteractionId']}});}return null;})[_0x955f('0x35')](handleEntityNotFound(_0x4c5dec,null))[_0x955f('0x35')](function(_0x500d0a){if(_0x500d0a){return _0x500d0a[_0x955f('0x34')]({'UserId':_0x3068db[_0x955f('0x55')]['UserId'],'read1stAt':_['isNil'](_0x500d0a[_0x955f('0x60')])?moment()['format'](_0x955f('0x61')):undefined});}return null;})[_0x955f('0x35')](function(_0x34af0d){if(_0x34af0d){_0x34ae69['interaction']=_0x34af0d[_0x955f('0x62')]({'plain':!![]});interaction_log[_0x955f('0x21')](_0x955f('0x63'),_0x3068db[_0x955f('0x5d')]['id'],_0x3068db[_0x955f('0x5d')][_0x955f('0x37')],_0x3068db['user'][_0x955f('0x64')],_0x34ae69[_0x955f('0x65')]['id'],_0x3068db[_0x955f('0x55')]?JSON[_0x955f('0x25')](_0x3068db[_0x955f('0x55')]):'null');return respondWithRpcPromise(_0x955f('0x66'),_0x955f('0x67'),_0x34ae69);}return null;})[_0x955f('0x35')](function(_0x3a7655){var _0x5e7b59='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3a7655['message'][_0x955f('0x68')];return db[_0x955f('0x69')]['query'](_0x5e7b59,{'type':db['Sequelize'][_0x955f('0x6a')][_0x955f('0x6b')],'raw':!![]})[_0x955f('0x35')](function(_0x18691d){return _0x18691d;});})[_0x955f('0x35')](function(_0x18129e){if(_0x18129e){_0x34ae69[_0x955f('0x27')][_0x955f('0x6c')]=_0x18129e[0x0];if(!_0x3068db[_0x955f('0x55')][_0x955f('0x5c')])return;return db[_0x955f('0x6d')][_0x955f('0x54')]({'where':{'id':_0x3068db[_0x955f('0x55')]['UserId'],'role':'agent'},'attributes':['id','name','fullname',_0x955f('0x6e'),_0x955f('0x6f')],'raw':!![]});}return null;})[_0x955f('0x35')](function(_0x19f37e){if(!_0x19f37e)return null;_0x34ae69[_0x955f('0x27')]['agent']=_0x19f37e;return _0x34ae69;})[_0x955f('0x35')](function(_0x2e5461){if(_0x2e5461){if(_0x3068db[_0x955f('0x55')]['manual']){_0x34ae69['message'][_0x955f('0x70')]=util[_0x955f('0x5b')](_0x955f('0x71'),_0x3068db[_0x955f('0x5d')][_0x955f('0x37')]);_0x34ae69[_0x955f('0x27')][_0x955f('0x72')]=_0x34ae69['channel'];_0x34ae69[_0x955f('0x27')][_0x955f('0x73')]=_0x34ae69['channel'];_0x34ae69['message'][_0x955f('0x74')]=_0x955f('0x58');return respondWithRpcPromise(_0x955f('0x75'),_0x955f('0x75'),{'event':_0x955f('0x76'),'message':_0x34ae69[_0x955f('0x27')]},client9002)['then'](function(){return _0x34ae69;});}return _0x34ae69;}return null;})[_0x955f('0x35')](respondWithResult(_0x4c5dec,null))[_0x955f('0x52')](handleError(_0x4c5dec,null));};var interaction_log=require('../../config/logger')(_0x955f('0x57'));exports[_0x955f('0x33')]=function(_0x37fc54,_0x5b41c4,_0x184f14){var _0x107fd7={'agent':{},'channel':_0x955f('0x59')};if(_0x37fc54[_0x955f('0x55')]['id']){delete _0x37fc54[_0x955f('0x55')]['id'];}_0x37fc54[_0x955f('0x55')]['UserId']=_0x37fc54[_0x955f('0x55')][_0x955f('0x5c')]||_0x37fc54['user']['id'];_0x107fd7['agent']['id']=_0x37fc54['body'][_0x955f('0x5c')];return db[_0x955f('0x3a')][_0x955f('0x54')]({'where':{'id':_0x37fc54['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5b41c4,null))[_0x955f('0x35')](function(_0x13e74e){if(_0x13e74e){_0x107fd7[_0x955f('0x27')]=_0x13e74e[_0x955f('0x62')]({'plain':!![]});return db['FaxInteraction'][_0x955f('0x54')]({'where':{'id':_0x13e74e[_0x955f('0x77')]}});}return null;})[_0x955f('0x35')](handleEntityNotFound(_0x5b41c4,null))['then'](function(_0x322f35){if(_0x322f35){_0x107fd7[_0x955f('0x65')]=_0x322f35[_0x955f('0x62')]({'plain':!![]});interaction_log[_0x955f('0x21')](_0x955f('0x78'),_0x37fc54['user']['id'],_0x37fc54[_0x955f('0x5d')]['name'],_0x37fc54[_0x955f('0x5d')][_0x955f('0x64')],_0x107fd7['interaction']['id'],_0x37fc54[_0x955f('0x55')]?JSON[_0x955f('0x25')](_0x37fc54['body']):_0x955f('0x79'));return respondWithRpcPromise(_0x955f('0x7a'),_0x955f('0x7b'),_0x107fd7);}return null;})['then'](function(_0x3296a8){var _0x3efe1f=_0x955f('0x7c')+_0x3296a8['message'][_0x955f('0x68')];return db[_0x955f('0x69')][_0x955f('0x42')](_0x3efe1f,{'type':db[_0x955f('0x7d')][_0x955f('0x6a')][_0x955f('0x6b')],'raw':!![]})['then'](function(_0x16859b){return _0x16859b;});})[_0x955f('0x35')](function(_0x59bb02){if(_0x59bb02){_0x107fd7[_0x955f('0x27')][_0x955f('0x6c')]=_0x59bb02[0x0];if(!_0x37fc54[_0x955f('0x55')][_0x955f('0x5c')])return;return db[_0x955f('0x6d')][_0x955f('0x54')]({'where':{'id':_0x37fc54['body']['UserId'],'role':_0x955f('0x5e')},'attributes':['id',_0x955f('0x37'),_0x955f('0x7e'),_0x955f('0x6e'),_0x955f('0x6f')],'raw':!![]});}return null;})['then'](function(_0x276ae0){if(!_0x276ae0)return null;_0x107fd7['message'][_0x955f('0x5e')]=_0x276ae0;return _0x107fd7;})['then'](function(_0x3d414b){if(_0x3d414b){_0x3d414b[_0x955f('0x27')][_0x955f('0x70')]=util['format'](_0x955f('0x71'),_0x37fc54['user']['name']);_0x3d414b[_0x955f('0x27')][_0x955f('0x72')]=_0x107fd7[_0x955f('0x72')];_0x3d414b[_0x955f('0x27')][_0x955f('0x73')]=_0x107fd7[_0x955f('0x72')];_0x3d414b[_0x955f('0x27')]['event']=_0x955f('0x33');respondWithRpcPromise(_0x955f('0x75'),_0x955f('0x75'),{'event':_0x955f('0x7f'),'message':_0x3d414b[_0x955f('0x27')]},client9002);return _0x107fd7;}return null;})['then'](respondWithResult(_0x5b41c4,null))[_0x955f('0x52')](handleError(_0x5b41c4,null));};exports[_0x955f('0x80')]=function(_0x4e7f9e,_0x8b131a){var _0x545771;return db[_0x955f('0x3a')]['create'](_0x4e7f9e['body'],{})['then'](function(_0x38341d){_0x545771=_0x38341d;return db['CmContact'][_0x955f('0x81')]({'where':{'id':_0x545771['ContactId']}});})[_0x955f('0x35')](function(_0x42ec3d){if(_['isNil'](_0x42ec3d)){return;}else{_0x545771[_0x955f('0x59')]=_0x42ec3d[_0x955f('0x59')];return db[_0x955f('0x82')][_0x955f('0x81')]({'where':{'id':_0x545771['AttachmentId']}});}})[_0x955f('0x35')](function(_0x8048a5){return respondWithRpcPromise(_0x955f('0x83'),_0x955f('0x83'),{'FaxAccountId':_['isNil'](_0x4e7f9e[_0x955f('0x55')])?undefined:_0x4e7f9e['body']['FaxAccountId'],'path':_[_0x955f('0x84')](_0x8048a5)?undefined:util[_0x955f('0x5b')](_0x955f('0x85'),_0x8048a5[_0x955f('0x86')]),'fax':_['isNil'](_0x545771['fax'])?undefined:_0x545771[_0x955f('0x59')],'AttachmentId':_0x545771[_0x955f('0x87')]},client9002);})['then'](respondWithResult(_0x8b131a,0xc9))[_0x955f('0x52')](handleError(_0x8b131a,null));};exports[_0x955f('0x88')]=function(_0x3bfc80,_0xa3a558){var _0x4efbab=path[_0x955f('0x89')](config['root'],'server',_0x955f('0x8a'),'attachments');return db[_0x955f('0x3a')][_0x955f('0x54')]({'where':{'id':_0x3bfc80[_0x955f('0x8b')]['id']},'include':[{'model':db[_0x955f('0x82')],'as':_0x955f('0x82')}]})[_0x955f('0x35')](handleEntityNotFound(_0xa3a558,null))[_0x955f('0x35')](function(_0x281bdf){if(_0x281bdf){return _0xa3a558[_0x955f('0x88')](path['join'](_0x4efbab,_0x281bdf[_0x955f('0x82')][_0x955f('0x86')]));}})[_0x955f('0x52')](handleError(_0xa3a558,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index efbf5df..ed16690 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 _0xcbd3=['save','update','remove','emit','hook','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x5cd11e,_0x45a0b8){var _0x447476=function(_0x4420a2){while(--_0x4420a2){_0x5cd11e['push'](_0x5cd11e['shift']());}};_0x447476(++_0x45a0b8);}(_0xcbd3,0x1eb));var _0x3cbd=function(_0x54fbcc,_0xee1c10){_0x54fbcc=_0x54fbcc-0x0;var _0x6370be=_0xcbd3[_0x54fbcc];return _0x6370be;};'use strict';var EventEmitter=require(_0x3cbd('0x0'));var FaxMessage=require(_0x3cbd('0x1'))['db'][_0x3cbd('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x3cbd('0x3')](0x0);var events={'afterCreate':_0x3cbd('0x4'),'afterUpdate':_0x3cbd('0x5'),'afterDestroy':_0x3cbd('0x6')};function emitEvent(_0x3c40e5){return function(_0x2f4854,_0x32a914,_0x5484ce){FaxMessageEvents[_0x3cbd('0x7')](_0x3c40e5+':'+_0x2f4854['id'],_0x2f4854);FaxMessageEvents[_0x3cbd('0x7')](_0x3c40e5,_0x2f4854);_0x5484ce(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x3cbd('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x5078=['FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1c34ec,_0x5e0c1b){var _0x5a565a=function(_0x4c6782){while(--_0x4c6782){_0x1c34ec['push'](_0x1c34ec['shift']());}};_0x5a565a(++_0x5e0c1b);}(_0x5078,0x148));var _0x8507=function(_0x5d340a,_0x2441da){_0x5d340a=_0x5d340a-0x0;var _0x435564=_0x5078[_0x5d340a];return _0x435564;};'use strict';var EventEmitter=require(_0x8507('0x0'));var FaxMessage=require(_0x8507('0x1'))['db'][_0x8507('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x8507('0x3')](0x0);var events={'afterCreate':_0x8507('0x4'),'afterUpdate':_0x8507('0x5'),'afterDestroy':_0x8507('0x6')};function emitEvent(_0x20608d){return function(_0x1a4930,_0x239a82,_0x2aa379){FaxMessageEvents[_0x8507('0x7')](_0x20608d+':'+_0x1a4930['id'],_0x1a4930);FaxMessageEvents[_0x8507('0x7')](_0x20608d,_0x1a4930);_0x2aa379(null);};}for(var e in events){if(events[_0x8507('0x8')](e)){var event=events[e];FaxMessage[_0x8507('0x9')](e,emitEvent(event));}}module[_0x8507('0xa')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 19daef8..7dbfd75 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 _0x7307=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','fti_fax_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','createdAt','catch','error','utf8mb4'];(function(_0x3712e2,_0x32d752){var _0x1faff4=function(_0x550dc0){while(--_0x550dc0){_0x3712e2['push'](_0x3712e2['shift']());}};_0x1faff4(++_0x32d752);}(_0x7307,0xf3));var _0x7730=function(_0x52085a,_0x3717ca){_0x52085a=_0x52085a-0x0;var _0x5afc1a=_0x7307[_0x52085a];return _0x5afc1a;};'use strict';var _=require(_0x7730('0x0'));var util=require(_0x7730('0x1'));var logger=require('../../config/logger')(_0x7730('0x2'));var moment=require(_0x7730('0x3'));var BPromise=require(_0x7730('0x4'));var rp=require(_0x7730('0x5'));var fs=require('fs');var path=require(_0x7730('0x6'));var rimraf=require(_0x7730('0x7'));var config=require('../../config/environment');var attributes=require(_0x7730('0x8'));module[_0x7730('0x9')]=function(_0x1e0770,_0x2f0219){return _0x1e0770['define']('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x7730('0xa'),'fields':[_0x7730('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x330268,_0x3184b6,_0x5d4c63){var _0x8657de=_0x1e0770[_0x7730('0xc')];var _0x528940=_0x330268[_0x7730('0xd')]({'plain':!![]});if(_0x528940[_0x7730('0xe')]['toLowerCase']()==='in'||_0x528940[_0x7730('0xe')][_0x7730('0xf')]()===_0x7730('0x10')&&!_0x528940[_0x7730('0x11')]&&!_[_0x7730('0x12')](_0x528940[_0x7730('0x13')])){_0x8657de[_0x7730('0x14')]['findOne']({'where':{'id':_0x528940[_0x7730('0x15')]}})[_0x7730('0x16')](function(_0x463fa6){if(_0x463fa6){_0x463fa6['update']({'lastMsgAt':_0x528940[_0x7730('0x17')],'lastMsgDirection':_0x528940[_0x7730('0xe')][_0x7730('0xf')]()});}})[_0x7730('0x18')](function(_0x35d6cb){console[_0x7730('0x19')](_0x35d6cb);});}_0x5d4c63();}},'charset':_0x7730('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf4d5=['createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','path','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','get','direction','toLowerCase','out','secret','isNil','findOne','FaxInteractionId','then','update'];(function(_0x3f7830,_0x2ef515){var _0x392bcf=function(_0x495eb3){while(--_0x495eb3){_0x3f7830['push'](_0x3f7830['shift']());}};_0x392bcf(++_0x2ef515);}(_0xf4d5,0xbb));var _0x5f4d=function(_0x4e223a,_0xc51f5c){_0x4e223a=_0x4e223a-0x0;var _0x63b4d9=_0xf4d5[_0x4e223a];return _0x63b4d9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5f4d('0x0'))('api');var moment=require(_0x5f4d('0x1'));var BPromise=require(_0x5f4d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f4d('0x3'));var rimraf=require('rimraf');var config=require(_0x5f4d('0x4'));var attributes=require(_0x5f4d('0x5'));module['exports']=function(_0x17028a,_0x1d3d3a){return _0x17028a[_0x5f4d('0x6')](_0x5f4d('0x7'),attributes,{'tableName':_0x5f4d('0x8'),'paranoid':![],'indexes':[{'name':_0x5f4d('0x9'),'fields':[_0x5f4d('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2d34a0,_0xef3253,_0x3cfb63){var _0x5d8ad7=_0x17028a['models'];var _0x33c173=_0x2d34a0[_0x5f4d('0xb')]({'plain':!![]});if(_0x33c173[_0x5f4d('0xc')][_0x5f4d('0xd')]()==='in'||_0x33c173[_0x5f4d('0xc')][_0x5f4d('0xd')]()===_0x5f4d('0xe')&&!_0x33c173[_0x5f4d('0xf')]&&!_[_0x5f4d('0x10')](_0x33c173['UserId'])){_0x5d8ad7['FaxInteraction'][_0x5f4d('0x11')]({'where':{'id':_0x33c173[_0x5f4d('0x12')]}})[_0x5f4d('0x13')](function(_0x24a76b){if(_0x24a76b){_0x24a76b[_0x5f4d('0x14')]({'lastMsgAt':_0x33c173[_0x5f4d('0x15')],'lastMsgDirection':_0x33c173[_0x5f4d('0xc')][_0x5f4d('0xd')]()});}})[_0x5f4d('0x16')](function(_0x4dc481){console[_0x5f4d('0x17')](_0x4dc481);});}_0x3cfb63();}},'charset':_0x5f4d('0x18'),'collate':_0x5f4d('0x19')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index d26e00e..23c263a 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 _0xbec5=['then','info','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','catch','CreateFaxMessage','FaxMessage','create','body','options','UpdateFaxMessage','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket'];(function(_0x132a76,_0x21eca8){var _0x3ba968=function(_0x4f65b6){while(--_0x4f65b6){_0x132a76['push'](_0x132a76['shift']());}};_0x3ba968(++_0x21eca8);}(_0xbec5,0xe5));var _0x5bec=function(_0x445c98,_0x132bf7){_0x445c98=_0x445c98-0x0;var _0x2fe913=_0xbec5[_0x445c98];return _0x2fe913;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var moment=require('moment');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['client'][_0x5bec('0xa')]({'port':0x232a});config[_0x5bec('0xb')]=_[_0x5bec('0xc')](config[_0x5bec('0xb')],{'host':_0x5bec('0xd'),'port':0x18eb});var socket=require(_0x5bec('0xe'))(new Redis(config[_0x5bec('0xb')]));require(_0x5bec('0xf'))['register'](socket);function respondWithRpcPromise(_0x41a827,_0x5c2d67,_0x748f75){return new BPromise(function(_0x2a70a7,_0x117162){return client['request'](_0x41a827,_0x748f75)[_0x5bec('0x10')](function(_0x18fa47){logger[_0x5bec('0x11')]('FaxMessage,\x20%s,\x20%s',_0x5c2d67,_0x5bec('0x12'));logger[_0x5bec('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5c2d67,_0x5bec('0x12'),JSON[_0x5bec('0x14')](_0x18fa47));if(_0x18fa47[_0x5bec('0x15')]){if(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x16')]===0x1f4){logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);return _0x117162(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);}logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x18fa47['error']['message']);return _0x2a70a7(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);}else{logger[_0x5bec('0x11')](_0x5bec('0x17'),_0x5c2d67,'request\x20sent');_0x2a70a7(_0x18fa47['result'][_0x5bec('0x18')]);}})[_0x5bec('0x19')](function(_0x4e0191){logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x4e0191);_0x117162(_0x4e0191);});});}exports[_0x5bec('0x1a')]=function(_0x593786){var _0x554f9f=this;return new Promise(function(_0xab397b,_0x5be91c){return db[_0x5bec('0x1b')][_0x5bec('0x1c')](_0x593786[_0x5bec('0x1d')],{'raw':_0x593786[_0x5bec('0x1e')]?_0x593786[_0x5bec('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x5bec('0x10')](function(_0x4cfcb8){logger[_0x5bec('0x11')](_0x5bec('0x1a'),_0x593786);logger['debug'](_0x5bec('0x1a'),_0x593786,JSON[_0x5bec('0x14')](_0x4cfcb8));_0xab397b(_0x4cfcb8);})['catch'](function(_0x45afb7){logger[_0x5bec('0x15')](_0x5bec('0x1a'),_0x45afb7[_0x5bec('0x18')],_0x593786);_0x5be91c(_0x554f9f[_0x5bec('0x15')](0x1f4,_0x45afb7[_0x5bec('0x18')]));});});};exports[_0x5bec('0x1f')]=function(_0x4de66a){var _0x5b63ab=this;return new Promise(function(_0x5e44b3,_0x2961bd){return db[_0x5bec('0x1b')][_0x5bec('0x20')](_0x4de66a['body'],{'raw':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')]['where']||null:null,'attributes':_0x4de66a['options']?_0x4de66a[_0x5bec('0x1e')][_0x5bec('0x21')]||null:null,'limit':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')][_0x5bec('0x22')]||null:null})[_0x5bec('0x10')](function(_0x5d6621){logger[_0x5bec('0x11')]('UpdateFaxMessage',_0x4de66a);logger[_0x5bec('0x13')](_0x5bec('0x1f'),_0x4de66a,JSON[_0x5bec('0x14')](_0x5d6621));_0x5e44b3(_0x5d6621);})[_0x5bec('0x19')](function(_0x5128c0){logger[_0x5bec('0x15')](_0x5bec('0x1f'),_0x5128c0[_0x5bec('0x18')],_0x4de66a);_0x2961bd(_0x5b63ab['error'](0x1f4,_0x5128c0[_0x5bec('0x18')]));});});}; \ No newline at end of file +var _0x55ca=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','code','error','message','catch','CreateFaxMessage','FaxMessage','body','options','raw','UpdateFaxMessage','update','attributes','limit','debug','stringify','lodash','util','ioredis'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x55ca,0x126));var _0xa55c=function(_0x591e16,_0x5aefc1){_0x591e16=_0x591e16-0x0;var _0x543b35=_0x55ca[_0x591e16];return _0x543b35;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});config[_0xa55c('0xa')]=_['defaults'](config[_0xa55c('0xa')],{'host':_0xa55c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa55c('0xa')]));require(_0xa55c('0xc'))['register'](socket);function respondWithRpcPromise(_0x5849ad,_0x473d0e,_0x20c76a){return new BPromise(function(_0x381d07,_0x5d8e5a){return client[_0xa55c('0xd')](_0x5849ad,_0x20c76a)[_0xa55c('0xe')](function(_0x508342){logger[_0xa55c('0xf')](_0xa55c('0x10'),_0x473d0e,_0xa55c('0x11'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x473d0e,_0xa55c('0x11'),JSON['stringify'](_0x508342));if(_0x508342['error']){if(_0x508342['error'][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x13')](_0xa55c('0x10'),_0x473d0e,_0x508342[_0xa55c('0x13')][_0xa55c('0x14')]);return _0x5d8e5a(_0x508342[_0xa55c('0x13')]['message']);}logger[_0xa55c('0x13')](_0xa55c('0x10'),_0x473d0e,_0x508342[_0xa55c('0x13')][_0xa55c('0x14')]);return _0x381d07(_0x508342[_0xa55c('0x13')][_0xa55c('0x14')]);}else{logger[_0xa55c('0xf')](_0xa55c('0x10'),_0x473d0e,_0xa55c('0x11'));_0x381d07(_0x508342['result'][_0xa55c('0x14')]);}})[_0xa55c('0x15')](function(_0x461284){logger[_0xa55c('0x13')](_0xa55c('0x10'),_0x473d0e,_0x461284);_0x5d8e5a(_0x461284);});});}exports[_0xa55c('0x16')]=function(_0x4c0daf){var _0x5f5158=this;return new Promise(function(_0xd643cc,_0x3776ac){return db[_0xa55c('0x17')]['create'](_0x4c0daf[_0xa55c('0x18')],{'raw':_0x4c0daf[_0xa55c('0x19')]?_0x4c0daf['options'][_0xa55c('0x1a')]===undefined?!![]:![]:!![]})[_0xa55c('0xe')](function(_0x940f28){logger[_0xa55c('0xf')](_0xa55c('0x16'),_0x4c0daf);logger['debug'](_0xa55c('0x16'),_0x4c0daf,JSON['stringify'](_0x940f28));_0xd643cc(_0x940f28);})['catch'](function(_0x59d89a){logger[_0xa55c('0x13')]('CreateFaxMessage',_0x59d89a[_0xa55c('0x14')],_0x4c0daf);_0x3776ac(_0x5f5158[_0xa55c('0x13')](0x1f4,_0x59d89a[_0xa55c('0x14')]));});});};exports[_0xa55c('0x1b')]=function(_0x2313a9){var _0x170ba4=this;return new Promise(function(_0x1da633,_0x11e7f7){return db[_0xa55c('0x17')][_0xa55c('0x1c')](_0x2313a9[_0xa55c('0x18')],{'raw':_0x2313a9['options']?_0x2313a9[_0xa55c('0x19')][_0xa55c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2313a9[_0xa55c('0x19')]?_0x2313a9[_0xa55c('0x19')]['where']||null:null,'attributes':_0x2313a9[_0xa55c('0x19')]?_0x2313a9[_0xa55c('0x19')][_0xa55c('0x1d')]||null:null,'limit':_0x2313a9[_0xa55c('0x19')]?_0x2313a9[_0xa55c('0x19')][_0xa55c('0x1e')]||null:null})['then'](function(_0x23e698){logger['info'](_0xa55c('0x1b'),_0x2313a9);logger[_0xa55c('0x1f')](_0xa55c('0x1b'),_0x2313a9,JSON[_0xa55c('0x20')](_0x23e698));_0x1da633(_0x23e698);})['catch'](function(_0x3d28fb){logger[_0xa55c('0x13')](_0xa55c('0x1b'),_0x3d28fb[_0xa55c('0x14')],_0x2313a9);_0x11e7f7(_0x170ba4[_0xa55c('0x13')](0x1f4,_0x3d28fb[_0xa55c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 76c33a3..8c7a2cc 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 _0xa40e=['remove','update','emit','removeListener','register','length','./faxMessage.events'];(function(_0xe3e0af,_0x4564ed){var _0x4828e9=function(_0x55c7a7){while(--_0x55c7a7){_0xe3e0af['push'](_0xe3e0af['shift']());}};_0x4828e9(++_0x4564ed);}(_0xa40e,0xe6));var _0xea40=function(_0x1543dc,_0x8b2bfd){_0x1543dc=_0x1543dc-0x0;var _0xfdd35a=_0xa40e[_0x1543dc];return _0xfdd35a;};'use strict';var FaxMessageEvents=require(_0xea40('0x0'));var events=['save',_0xea40('0x1'),_0xea40('0x2')];function createListener(_0x1b0386,_0x3eb33c){return function(_0x152cf8){_0x3eb33c[_0xea40('0x3')](_0x1b0386,_0x152cf8);};}function removeListener(_0x478b1f,_0x42eca6){return function(){FaxMessageEvents[_0xea40('0x4')](_0x478b1f,_0x42eca6);};}exports[_0xea40('0x5')]=function(_0x5e517f){for(var _0x373ae2=0x0,_0x2cd7af=events[_0xea40('0x6')];_0x373ae2<_0x2cd7af;_0x373ae2++){var _0x4857b1=events[_0x373ae2];var _0x363a99=createListener('faxMessage:'+_0x4857b1,_0x5e517f);FaxMessageEvents['on'](_0x4857b1,_0x363a99);}}; \ No newline at end of file +var _0xc9ac=['./faxMessage.events','save','remove','emit','removeListener','register','length','faxMessage:'];(function(_0xa569b7,_0x4727c6){var _0x2988d2=function(_0x1a5ef7){while(--_0x1a5ef7){_0xa569b7['push'](_0xa569b7['shift']());}};_0x2988d2(++_0x4727c6);}(_0xc9ac,0x1b8));var _0xcc9a=function(_0x4e68aa,_0x77632d){_0x4e68aa=_0x4e68aa-0x0;var _0xfe0a56=_0xc9ac[_0x4e68aa];return _0xfe0a56;};'use strict';var FaxMessageEvents=require(_0xcc9a('0x0'));var events=[_0xcc9a('0x1'),_0xcc9a('0x2'),'update'];function createListener(_0xcd5212,_0x38d593){return function(_0x1911f7){_0x38d593[_0xcc9a('0x3')](_0xcd5212,_0x1911f7);};}function removeListener(_0x3fce79,_0x4563f){return function(){FaxMessageEvents[_0xcc9a('0x4')](_0x3fce79,_0x4563f);};}exports[_0xcc9a('0x5')]=function(_0x458aab){for(var _0x5eaaa4=0x0,_0x4b6f4d=events[_0xcc9a('0x6')];_0x5eaaa4<_0x4b6f4d;_0x5eaaa4++){var _0x382c70=events[_0x5eaaa4];var _0x8509ad=createListener(_0xcc9a('0x7')+_0x382c70,_0x458aab);FaxMessageEvents['on'](_0x382c70,_0x8509ad);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 20eb31b..2470029 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 _0x153f=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','tracked','fax','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x153f,0x15b));var _0xf153=function(_0x33ecc8,_0x88dc4e){_0x33ecc8=_0x33ecc8-0x0;var _0x140641=_0x153f[_0x33ecc8];return _0x140641;};'use strict';var multer=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var path=require(_0xf153('0x2'));var timeout=require(_0xf153('0x3'));var express=require(_0xf153('0x4'));var router=express[_0xf153('0x5')]();var fs_extra=require(_0xf153('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf153('0x7'));var config=require('../../config/environment');var controller=require(_0xf153('0x8'));router[_0xf153('0x9')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0xb')]);router[_0xf153('0x9')]('/describe',auth[_0xf153('0xa')](),controller[_0xf153('0xc')]);router[_0xf153('0x9')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0xe')]);router[_0xf153('0x9')](_0xf153('0xf'),auth[_0xf153('0xa')](),controller[_0xf153('0x10')]);router['post']('/',auth[_0xf153('0xa')](),interaction[_0xf153('0x11')](_0xf153('0x12'),'faxmessage:create'),controller[_0xf153('0x13')]);router[_0xf153('0x14')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0x15')]);router[_0xf153('0x14')](_0xf153('0x16'),auth[_0xf153('0xa')](),controller[_0xf153('0x17')]);router['put'](_0xf153('0x18'),auth[_0xf153('0xa')](),controller[_0xf153('0x19')]);router[_0xf153('0x1a')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0x1b')]);module[_0xf153('0x1c')]=router; \ No newline at end of file +var _0x7072=['/:id/download','download','post','tracked','fax','faxmessage:create','create','put','accept','/:id/reject','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2515a7,_0x223ba2){var _0x31f09=function(_0x167385){while(--_0x167385){_0x2515a7['push'](_0x2515a7['shift']());}};_0x31f09(++_0x223ba2);}(_0x7072,0x138));var _0x2707=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x7072[_0x3d42d8];return _0x27fc41;};'use strict';var multer=require('multer');var util=require(_0x2707('0x0'));var path=require(_0x2707('0x1'));var timeout=require(_0x2707('0x2'));var express=require(_0x2707('0x3'));var router=express[_0x2707('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2707('0x5'));var config=require('../../config/environment');var controller=require(_0x2707('0x6'));router[_0x2707('0x7')]('/',auth[_0x2707('0x8')](),controller[_0x2707('0x9')]);router[_0x2707('0x7')](_0x2707('0xa'),auth[_0x2707('0x8')](),controller[_0x2707('0xb')]);router[_0x2707('0x7')](_0x2707('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2707('0x7')](_0x2707('0xd'),auth[_0x2707('0x8')](),controller[_0x2707('0xe')]);router[_0x2707('0xf')]('/',auth[_0x2707('0x8')](),interaction[_0x2707('0x10')](_0x2707('0x11'),_0x2707('0x12')),controller[_0x2707('0x13')]);router[_0x2707('0x14')](_0x2707('0xc'),auth[_0x2707('0x8')](),controller['update']);router[_0x2707('0x14')]('/:id/accept',auth[_0x2707('0x8')](),controller[_0x2707('0x15')]);router[_0x2707('0x14')](_0x2707('0x16'),auth[_0x2707('0x8')](),controller['reject']);router[_0x2707('0x17')](_0x2707('0xc'),auth[_0x2707('0x8')](),controller['destroy']);module[_0x2707('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index da8943d..50f585a 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 _0x62a7=['ENUM','rrmemory','beepall','roundrobin','exports','STRING','name','INTEGER'];(function(_0x19054f,_0x46618b){var _0x3f5e01=function(_0x368d34){while(--_0x368d34){_0x19054f['push'](_0x19054f['shift']());}};_0x3f5e01(++_0x46618b);}(_0x62a7,0x84));var _0x762a=function(_0x3ab46c,_0x4d26cc){_0x3ab46c=_0x3ab46c-0x0;var _0x2c7e90=_0x62a7[_0x3ab46c];return _0x2c7e90;};'use strict';var Sequelize=require('sequelize');module[_0x762a('0x0')]={'name':{'type':Sequelize[_0x762a('0x1')],'unique':_0x762a('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x762a('0x1')]},'timeout':{'type':Sequelize[_0x762a('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x762a('0x4')](_0x762a('0x5'),_0x762a('0x6'),_0x762a('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9300=['ENUM','rrmemory','roundrobin','sequelize','name','STRING','INTEGER'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9300,0x153));var _0x0930=function(_0x18fec8,_0x31d0cd){_0x18fec8=_0x18fec8-0x0;var _0x5e400c=_0x9300[_0x18fec8];return _0x5e400c;};'use strict';var Sequelize=require(_0x0930('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x0930('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0930('0x2')]},'timeout':{'type':Sequelize[_0x0930('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0930('0x4')](_0x0930('0x5'),'beepall',_0x0930('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x0930('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 54115cf..46259ad 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 _0x0e91=['fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','pick','FaxQueueId','UserFaxQueue','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','ids','field','tq.TeamId','from','team_has_fax_queues','clone','push','toString','SELECT','every','TeamId','all','union','isEmpty','addAgents','omit','removeAgents','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','FaxQueues','error','name','index','map','FaxQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection'];(function(_0x180a8d,_0x432a75){var _0xe5b5c8=function(_0x48a91d){while(--_0x48a91d){_0x180a8d['push'](_0x180a8d['shift']());}};_0xe5b5c8(++_0x432a75);}(_0x0e91,0x169));var _0x10e9=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0x0e91[_0x1cbcf1];return _0x3a06f0;};'use strict';var emlformat=require(_0x10e9('0x0'));var rimraf=require(_0x10e9('0x1'));var zipdir=require(_0x10e9('0x2'));var jsonpatch=require(_0x10e9('0x3'));var rp=require(_0x10e9('0x4'));var moment=require(_0x10e9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x10e9('0x6'));var path=require(_0x10e9('0x7'));var sox=require(_0x10e9('0x8'));var csv=require(_0x10e9('0x9'));var ejs=require(_0x10e9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x10e9('0xb'));var squel=require(_0x10e9('0xc'));var crypto=require(_0x10e9('0xd'));var jsforce=require(_0x10e9('0xe'));var deskjs=require(_0x10e9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x10e9('0x10'));var Papa=require(_0x10e9('0x11'));var Redis=require(_0x10e9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x10e9('0x13'));var as=require(_0x10e9('0x14'));var hardwareService=require(_0x10e9('0x15'));var logger=require(_0x10e9('0x16'))('api');var utils=require(_0x10e9('0x17'));var config=require(_0x10e9('0x18'));var licenseUtil=require(_0x10e9('0x19'));var db=require(_0x10e9('0x1a'))['db'];config[_0x10e9('0x1b')]=_[_0x10e9('0x1c')](config[_0x10e9('0x1b')],{'host':_0x10e9('0x1d'),'port':0x18eb});var socket=require(_0x10e9('0x1e'))(new Redis(config['redis']));require(_0x10e9('0x1f'))[_0x10e9('0x20')](socket);function respondWithStatusCode(_0x4c1801,_0x3e9b61){_0x3e9b61=_0x3e9b61||0xcc;return function(_0x244e4c){if(_0x244e4c){return _0x4c1801[_0x10e9('0x21')](_0x3e9b61);}return _0x4c1801[_0x10e9('0x22')](_0x3e9b61)[_0x10e9('0x23')]();};}function respondWithResult(_0x3d5425,_0x3461cf){_0x3461cf=_0x3461cf||0xc8;return function(_0x1346a7){if(_0x1346a7){return _0x3d5425[_0x10e9('0x22')](_0x3461cf)['json'](_0x1346a7);}};}function respondWithFilteredResult(_0x140cc,_0x198a68){return function(_0x1fa6e1){if(_0x1fa6e1){var _0x3c30ca=typeof _0x198a68[_0x10e9('0x24')]==='undefined'&&typeof _0x198a68['limit']===_0x10e9('0x25');var _0x158893=_0x1fa6e1[_0x10e9('0x26')];var _0x3b05d8=_0x3c30ca?0x0:_0x198a68[_0x10e9('0x24')];var _0x17aa39=_0x3c30ca?_0x1fa6e1[_0x10e9('0x26')]:_0x198a68[_0x10e9('0x24')]+_0x198a68['limit'];var _0x7675ac;if(_0x17aa39>=_0x158893){_0x17aa39=_0x158893;_0x7675ac=0xc8;}else{_0x7675ac=0xce;}_0x140cc[_0x10e9('0x22')](_0x7675ac);return _0x140cc[_0x10e9('0x27')](_0x10e9('0x28'),_0x3b05d8+'-'+_0x17aa39+'/'+_0x158893)[_0x10e9('0x29')](_0x1fa6e1);}return null;};}function patchUpdates(_0x224454){return function(_0x5bfaff){try{jsonpatch[_0x10e9('0x2a')](_0x5bfaff,_0x224454,!![]);}catch(_0x261069){return BPromise[_0x10e9('0x2b')](_0x261069);}return _0x5bfaff[_0x10e9('0x2c')]();};}function saveUpdates(_0x324fce,_0x4fb9c9){return function(_0x5e0b95){if(_0x5e0b95){return _0x5e0b95[_0x10e9('0x2d')](_0x324fce)['then'](function(_0x426a78){return _0x426a78;});}return null;};}function removeEntity(_0x34d045,_0x124d2b){return function(_0x156940){if(_0x156940){return _0x156940[_0x10e9('0x2e')]()[_0x10e9('0x2f')](function(){var _0x4d2064=_0x156940['get']({'plain':!![]});var _0x1d8d5f=_0x10e9('0x30');return db['UserProfileResource'][_0x10e9('0x2e')]({'where':{'type':_0x1d8d5f,'resourceId':_0x4d2064['id']}})[_0x10e9('0x2f')](function(){return _0x156940;});})[_0x10e9('0x2f')](function(){_0x34d045[_0x10e9('0x22')](0xcc)[_0x10e9('0x23')]();});}};}function handleEntityNotFound(_0x41ce43,_0x26519e){return function(_0x299a68){if(!_0x299a68){_0x41ce43[_0x10e9('0x21')](0x194);}return _0x299a68;};}function handleError(_0x48d624,_0xb8893){_0xb8893=_0xb8893||0x1f4;return function(_0x359ed1){logger[_0x10e9('0x31')](_0x359ed1['stack']);if(_0x359ed1[_0x10e9('0x32')]){delete _0x359ed1[_0x10e9('0x32')];}_0x48d624[_0x10e9('0x22')](_0xb8893)['send'](_0x359ed1);};}exports[_0x10e9('0x33')]=function(_0x2a6260,_0x215c81){var _0x49447f={},_0x4bf0f2={},_0x4e448a={'count':0x0,'rows':[]};var _0x4e9880=_[_0x10e9('0x34')](db[_0x10e9('0x35')][_0x10e9('0x36')],function(_0x3b7d27){return{'name':_0x3b7d27[_0x10e9('0x37')],'type':_0x3b7d27['type'][_0x10e9('0x38')]};});_0x4bf0f2[_0x10e9('0x39')]=_[_0x10e9('0x34')](_0x4e9880,_0x10e9('0x32'));_0x4bf0f2[_0x10e9('0x3a')]=_[_0x10e9('0x3b')](_0x2a6260['query']);_0x4bf0f2[_0x10e9('0x3c')]=_['intersection'](_0x4bf0f2[_0x10e9('0x39')],_0x4bf0f2[_0x10e9('0x3a')]);_0x49447f['attributes']=_[_0x10e9('0x3d')](_0x4bf0f2['model'],qs['fields'](_0x2a6260[_0x10e9('0x3a')][_0x10e9('0x3e')]));_0x49447f[_0x10e9('0x3f')]=_0x49447f[_0x10e9('0x3f')][_0x10e9('0x40')]?_0x49447f[_0x10e9('0x3f')]:_0x4bf0f2['model'];if(!_0x2a6260[_0x10e9('0x3a')][_0x10e9('0x41')](_0x10e9('0x42'))){_0x49447f[_0x10e9('0x43')]=qs[_0x10e9('0x43')](_0x2a6260[_0x10e9('0x3a')][_0x10e9('0x43')]);_0x49447f[_0x10e9('0x24')]=qs[_0x10e9('0x24')](_0x2a6260['query'][_0x10e9('0x24')]);}_0x49447f[_0x10e9('0x44')]=qs[_0x10e9('0x45')](_0x2a6260['query'][_0x10e9('0x45')]);_0x49447f[_0x10e9('0x46')]=qs[_0x10e9('0x3c')](_['pick'](_0x2a6260[_0x10e9('0x3a')],_0x4bf0f2[_0x10e9('0x3c')]),_0x4e9880);if(_0x2a6260[_0x10e9('0x3a')][_0x10e9('0x47')]){_0x49447f['where']=_[_0x10e9('0x48')](_0x49447f[_0x10e9('0x46')],{'$or':_[_0x10e9('0x34')](_0x4e9880,function(_0x151594){if(_0x151594['type']!==_0x10e9('0x49')){var _0x36846d={};_0x36846d[_0x151594[_0x10e9('0x32')]]={'$like':'%'+_0x2a6260[_0x10e9('0x3a')][_0x10e9('0x47')]+'%'};return _0x36846d;}})});}_0x49447f=_[_0x10e9('0x48')]({},_0x49447f,_0x2a6260[_0x10e9('0x4a')]);var _0x1f929b={'where':_0x49447f[_0x10e9('0x46')]};return db[_0x10e9('0x35')]['count'](_0x1f929b)['then'](function(_0x796e14){_0x4e448a[_0x10e9('0x26')]=_0x796e14;if(_0x2a6260[_0x10e9('0x3a')]['includeAll']){_0x49447f[_0x10e9('0x4b')]=[{'all':!![]}];}return db[_0x10e9('0x35')][_0x10e9('0x4c')](_0x49447f);})['then'](function(_0x3e1757){_0x4e448a[_0x10e9('0x4d')]=_0x3e1757;return _0x4e448a;})['then'](respondWithFilteredResult(_0x215c81,_0x49447f))[_0x10e9('0x4e')](handleError(_0x215c81,null));};exports[_0x10e9('0x4f')]=function(_0x57fd09,_0x26870b){var _0x4f7d8c={'raw':!![],'where':{'id':_0x57fd09[_0x10e9('0x50')]['id']}},_0x58b363={};_0x58b363['model']=_[_0x10e9('0x3b')](db[_0x10e9('0x35')]['rawAttributes']);_0x58b363[_0x10e9('0x3a')]=_['keys'](_0x57fd09[_0x10e9('0x3a')]);_0x58b363[_0x10e9('0x3c')]=_[_0x10e9('0x3d')](_0x58b363['model'],_0x58b363[_0x10e9('0x3a')]);_0x4f7d8c[_0x10e9('0x3f')]=_[_0x10e9('0x3d')](_0x58b363[_0x10e9('0x39')],qs[_0x10e9('0x3e')](_0x57fd09[_0x10e9('0x3a')][_0x10e9('0x3e')]));_0x4f7d8c[_0x10e9('0x3f')]=_0x4f7d8c[_0x10e9('0x3f')]['length']?_0x4f7d8c['attributes']:_0x58b363[_0x10e9('0x39')];if(_0x57fd09[_0x10e9('0x3a')][_0x10e9('0x51')]){_0x4f7d8c['include']=[{'all':!![]}];}_0x4f7d8c=_[_0x10e9('0x48')]({},_0x4f7d8c,_0x57fd09['options']);return db['FaxQueue'][_0x10e9('0x52')](_0x4f7d8c)['then'](handleEntityNotFound(_0x26870b,null))[_0x10e9('0x2f')](respondWithResult(_0x26870b,null))['catch'](handleError(_0x26870b,null));};exports['create']=function(_0x4b7901,_0x332dba){return db['FaxQueue'][_0x10e9('0x53')](_0x4b7901[_0x10e9('0x54')],{})[_0x10e9('0x2f')](function(_0x2d24cc){var _0x25c23c=_0x4b7901[_0x10e9('0x55')][_0x10e9('0x56')]({'plain':!![]});if(!_0x25c23c)throw new Error(_0x10e9('0x57'));if(_0x25c23c[_0x10e9('0x58')]===_0x10e9('0x55')){var _0x559a9f=_0x2d24cc['get']({'plain':!![]});var _0x278a9e=_0x10e9('0x30');return db['UserProfileSection'][_0x10e9('0x52')]({'where':{'name':_0x278a9e,'userProfileId':_0x25c23c[_0x10e9('0x59')]},'raw':!![]})[_0x10e9('0x2f')](function(_0x4d74a2){if(_0x4d74a2&&_0x4d74a2['autoAssociation']===0x0){return db[_0x10e9('0x5a')][_0x10e9('0x53')]({'name':_0x559a9f['name'],'resourceId':_0x559a9f['id'],'type':_0x4d74a2[_0x10e9('0x32')],'sectionId':_0x4d74a2['id']},{})[_0x10e9('0x2f')](function(){return _0x2d24cc;});}else{return _0x2d24cc;}})['catch'](function(_0x1ba9d4){logger[_0x10e9('0x31')](_0x10e9('0x5b'),_0x1ba9d4);throw _0x1ba9d4;});}return _0x2d24cc;})[_0x10e9('0x2f')](respondWithResult(_0x332dba,0xc9))[_0x10e9('0x4e')](handleError(_0x332dba,null));};exports[_0x10e9('0x2d')]=function(_0x5ac5c8,_0x186a89){if(_0x5ac5c8[_0x10e9('0x54')]['id']){delete _0x5ac5c8['body']['id'];}return db['FaxQueue'][_0x10e9('0x52')]({'where':{'id':_0x5ac5c8[_0x10e9('0x50')]['id']}})[_0x10e9('0x2f')](handleEntityNotFound(_0x186a89,null))[_0x10e9('0x2f')](saveUpdates(_0x5ac5c8[_0x10e9('0x54')],null))[_0x10e9('0x2f')](respondWithResult(_0x186a89,null))[_0x10e9('0x4e')](handleError(_0x186a89,null));};exports[_0x10e9('0x2e')]=function(_0x25ed82,_0x142412){return db[_0x10e9('0x35')]['find']({'where':{'id':_0x25ed82[_0x10e9('0x50')]['id']}})[_0x10e9('0x2f')](handleEntityNotFound(_0x142412,null))[_0x10e9('0x2f')](removeEntity(_0x142412,null))[_0x10e9('0x4e')](handleError(_0x142412,null));};exports[_0x10e9('0x5c')]=function(_0x353013,_0x5698b5){return db[_0x10e9('0x35')]['describe']()[_0x10e9('0x2f')](respondWithResult(_0x5698b5,null))[_0x10e9('0x4e')](handleError(_0x5698b5,null));};exports[_0x10e9('0x5d')]=function(_0x58357f,_0xcf32f9,_0xe2de8a){var _0xe360de={'raw':!![],'where':{}},_0x277dbc={},_0xe9ef4e;return db[_0x10e9('0x35')][_0x10e9('0x5e')]({'where':{'id':_0x58357f[_0x10e9('0x50')]['id']}})[_0x10e9('0x2f')](handleEntityNotFound(_0xcf32f9,null))[_0x10e9('0x2f')](function(_0x118320){if(_0x118320){_0xe9ef4e=_0x118320[_0x10e9('0x56')]({'plain':!![]});_0x277dbc[_0x10e9('0x39')]=_[_0x10e9('0x3b')](db['UserFaxQueue'][_0x10e9('0x36')]);_0x277dbc['query']=_['keys'](_0x58357f[_0x10e9('0x3a')]);_0x277dbc[_0x10e9('0x3c')]=_[_0x10e9('0x3d')](_0x277dbc['model'],_0x277dbc[_0x10e9('0x3a')]);_0xe360de[_0x10e9('0x3f')]=_['intersection'](_0x277dbc[_0x10e9('0x39')],qs['fields'](_0x58357f[_0x10e9('0x3a')]['fields']));_0xe360de['attributes']=_0xe360de[_0x10e9('0x3f')][_0x10e9('0x40')]?_0xe360de['attributes']:_0x277dbc[_0x10e9('0x39')];if(!_0x58357f[_0x10e9('0x3a')]['hasOwnProperty']('nolimit')){_0xe360de[_0x10e9('0x43')]=qs[_0x10e9('0x43')](_0x58357f[_0x10e9('0x3a')][_0x10e9('0x43')]);_0xe360de[_0x10e9('0x24')]=qs['offset'](_0x58357f['query'][_0x10e9('0x24')]);}_0xe360de['order']=qs[_0x10e9('0x45')](_0x58357f[_0x10e9('0x3a')][_0x10e9('0x45')]);_0xe360de[_0x10e9('0x46')]=qs[_0x10e9('0x3c')](_[_0x10e9('0x5f')](_0x58357f[_0x10e9('0x3a')],_0x277dbc[_0x10e9('0x3c')]));_0xe360de[_0x10e9('0x46')][_0x10e9('0x60')]=_0x118320['id'];if(_0x58357f[_0x10e9('0x3a')][_0x10e9('0x47')]){_0xe360de[_0x10e9('0x46')]=_[_0x10e9('0x48')](_0xe360de[_0x10e9('0x46')],{'$or':_[_0x10e9('0x34')](_0xe360de[_0x10e9('0x3f')],function(_0x2169bc){var _0x2d99e7={};_0x2d99e7[_0x2169bc]={'$like':'%'+_0x58357f[_0x10e9('0x3a')][_0x10e9('0x47')]+'%'};return _0x2d99e7;})});}_0xe360de=_[_0x10e9('0x48')]({},_0xe360de,_0x58357f[_0x10e9('0x4a')]);return db[_0x10e9('0x61')]['findAll'](_0xe360de);}})['then'](function(_0xcbb00b){if(_0xcbb00b){return db[_0x10e9('0x62')][_0x10e9('0x63')]({'where':{'id':_[_0x10e9('0x34')](_0xcbb00b,_0x10e9('0x64')),'role':_0x10e9('0x65')},'attributes':['id','name',_0x10e9('0x66'),_0x10e9('0x67'),_0x10e9('0x68')]});}})['then'](function(_0x3c273a){if(_0x3c273a){return{'count':_0x3c273a[_0x10e9('0x26')],'rows':_[_0x10e9('0x34')](_0x3c273a[_0x10e9('0x4d')],function(_0x5bb489){return{'membername':_0x5bb489['name'],'UserId':_0x5bb489['id'],'queue_name':_0xe9ef4e['name'],'FaxQueueId':_0xe9ef4e['id'],'interface':util[_0x10e9('0x69')](_0x10e9('0x6a'),'SIP',_0x5bb489[_0x10e9('0x32')]),'penalty':0x0,'paused':_0x5bb489[_0x10e9('0x66')],'createdAt':_0x5bb489['createdAt'],'updatedAt':_0x5bb489[_0x10e9('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xcf32f9,_0xe360de))[_0x10e9('0x4e')](handleError(_0xcf32f9,null));};exports[_0x10e9('0x6b')]=function(_0x1d1cdb,_0x1959b5,_0x3a9210){var _0x436fbb={};var _0x70ca83={};var _0x470b9f;var _0x2c346c;return db[_0x10e9('0x35')][_0x10e9('0x5e')]({'where':{'id':_0x1d1cdb[_0x10e9('0x50')]['id']}})['then'](handleEntityNotFound(_0x1959b5,null))['then'](function(_0x1fe0a9){if(_0x1fe0a9){_0x470b9f=_0x1fe0a9;_0x70ca83[_0x10e9('0x39')]=_[_0x10e9('0x3b')](db[_0x10e9('0x6c')][_0x10e9('0x36')]);_0x70ca83['query']=_['keys'](_0x1d1cdb[_0x10e9('0x3a')]);_0x70ca83[_0x10e9('0x3c')]=_[_0x10e9('0x3d')](_0x70ca83[_0x10e9('0x39')],_0x70ca83[_0x10e9('0x3a')]);_0x436fbb['attributes']=_['intersection'](_0x70ca83[_0x10e9('0x39')],qs['fields'](_0x1d1cdb[_0x10e9('0x3a')]['fields']));_0x436fbb[_0x10e9('0x3f')]=_0x436fbb[_0x10e9('0x3f')][_0x10e9('0x40')]?_0x436fbb['attributes']:_0x70ca83[_0x10e9('0x39')];_0x436fbb[_0x10e9('0x44')]=qs[_0x10e9('0x45')](_0x1d1cdb[_0x10e9('0x3a')][_0x10e9('0x45')]);_0x436fbb['where']=qs['filters'](_['pick'](_0x1d1cdb[_0x10e9('0x3a')],_0x70ca83[_0x10e9('0x3c')]));if(_0x1d1cdb[_0x10e9('0x3a')]['filter']){_0x436fbb[_0x10e9('0x46')]=_[_0x10e9('0x48')](_0x436fbb[_0x10e9('0x46')],{'$or':_[_0x10e9('0x34')](_0x436fbb[_0x10e9('0x3f')],function(_0x185236){var _0x3268c2={};_0x3268c2[_0x185236]={'$like':'%'+_0x1d1cdb['query'][_0x10e9('0x47')]+'%'};return _0x3268c2;})});}_0x436fbb=_[_0x10e9('0x48')]({},_0x436fbb,_0x1d1cdb[_0x10e9('0x4a')]);return _0x470b9f[_0x10e9('0x6b')](_0x436fbb);}})['then'](function(_0x31180e){if(_0x31180e){_0x2c346c=_0x31180e['length'];if(!_0x1d1cdb[_0x10e9('0x3a')][_0x10e9('0x41')](_0x10e9('0x42'))){_0x436fbb[_0x10e9('0x43')]=qs[_0x10e9('0x43')](_0x1d1cdb[_0x10e9('0x3a')][_0x10e9('0x43')]);_0x436fbb[_0x10e9('0x24')]=qs[_0x10e9('0x24')](_0x1d1cdb['query'][_0x10e9('0x24')]);}return _0x470b9f[_0x10e9('0x6b')](_0x436fbb);}})[_0x10e9('0x2f')](function(_0x310830){if(_0x310830){return _0x310830?{'count':_0x2c346c,'rows':_0x310830}:null;}})[_0x10e9('0x2f')](respondWithResult(_0x1959b5,null))[_0x10e9('0x4e')](handleError(_0x1959b5,null));};exports[_0x10e9('0x6d')]=function(_0x46b63b,_0x208e88,_0xfd3497){var _0x3cefe0=_0x46b63b['body']['ids'];return db['Team'][_0x10e9('0x4c')]({'where':{'id':_0x3cefe0},'attributes':['id'],'include':[{'model':db[_0x10e9('0x62')],'as':_0x10e9('0x6e'),'attributes':['id',_0x10e9('0x32'),_0x10e9('0x6f'),_0x10e9('0x70'),_0x10e9('0x71')],'raw':!![]}]})[_0x10e9('0x2f')](function(_0x23977c){if(_0x23977c){var _0x75f211=_[_0x10e9('0x72')](_0x23977c,function(_0x5c6c97){var _0x19bb35=_0x5c6c97[_0x10e9('0x56')]({'plain':!![]});return _0x19bb35[_0x10e9('0x6e')];});return db[_0x10e9('0x35')][_0x10e9('0x52')]({'where':{'id':_0x46b63b[_0x10e9('0x50')]['id']}})[_0x10e9('0x2f')](function(_0x5162cc){return db[_0x10e9('0x73')][_0x10e9('0x74')](function(_0x1e6235){return _0x5162cc[_0x10e9('0x6d')](_0x3cefe0,{'transaction':_0x1e6235})[_0x10e9('0x2f')](function(){return BPromise[_0x10e9('0x75')](_0x75f211,function(_0x33e18e){return db[_0x10e9('0x61')][_0x10e9('0x76')]({'where':{'UserId':_0x33e18e['id'],'FaxQueueId':_0x46b63b[_0x10e9('0x50')]['id']},'transaction':_0x1e6235});});})[_0x10e9('0x2f')](function(){_0x75f211[_0x10e9('0x77')](function(_0x56593c){socket[_0x10e9('0x78')]('userFaxQueue:save',{'UserId':_0x56593c['id'],'FaxQueueId':_0x5162cc['id']});});});});});}})[_0x10e9('0x2f')](respondWithStatusCode(_0x208e88,null))['catch'](handleError(_0x208e88,null));};exports[_0x10e9('0x79')]=function(_0x56c097,_0x54be6b,_0x3acd78){return db['Team'][_0x10e9('0x4c')]({'where':{'id':_0x56c097[_0x10e9('0x3a')][_0x10e9('0x7a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x10e9('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x10e9('0x2f')](handleEntityNotFound(_0x54be6b,null))[_0x10e9('0x2f')](function(_0x5003d1){var _0x558e78=_[_0x10e9('0x34')](_0x5003d1,'id');var _0x15be16=[];var _0x221743=[];var _0x1694eb=squel['select']();_0x1694eb[_0x10e9('0x7b')](_0x10e9('0x7c'))[_0x10e9('0x7d')](_0x10e9('0x7e'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('FaxQueueId\x20=\x20?',_0x56c097['params']['id']);for(var _0x2adbef=0x0;_0x2adbef<_0x5003d1['length'];_0x2adbef+=0x1){let _0x29b3eb=_0x5003d1[_0x2adbef];for(var _0x3514e7=0x0;_0x3514e7<_0x29b3eb[_0x10e9('0x6e')][_0x10e9('0x40')];_0x3514e7+=0x1){let _0x2d3837=_0x29b3eb['Agents'][_0x3514e7];var _0x9a7a91=_0x1694eb[_0x10e9('0x7f')]();_0x9a7a91[_0x10e9('0x46')]('ut.UserId\x20=\x20?',_0x2d3837['id']);_0x221743[_0x10e9('0x80')](db[_0x10e9('0x73')][_0x10e9('0x3a')](_0x9a7a91[_0x10e9('0x81')](),{'type':db[_0x10e9('0x73')]['QueryTypes'][_0x10e9('0x82')]})[_0x10e9('0x2f')](function(_0x5dea53){if(_0x5dea53[_0x10e9('0x40')]===0x1){return _0x2d3837['id'];}else{var _0x4fcf2f=_[_0x10e9('0x83')](_[_0x10e9('0x34')](_0x5dea53,_0x10e9('0x84')),function(_0xe3d2d9){return _['includes'](_0x558e78,_0xe3d2d9);});if(_0x4fcf2f){return _0x2d3837['id'];}}}));}}return BPromise[_0x10e9('0x85')](_0x221743)['then'](function(_0x150c6f){_0x15be16=_(_0x15be16)[_0x10e9('0x86')](_0x150c6f)['compact']()['value']();return db[_0x10e9('0x35')][_0x10e9('0x52')]({'where':{'id':_0x56c097[_0x10e9('0x50')]['id']}})[_0x10e9('0x2f')](function(_0x50074d){return db[_0x10e9('0x73')][_0x10e9('0x74')](function(_0x27aebc){return _0x50074d['removeTeams'](_0x56c097['query'][_0x10e9('0x7a')],{'transaction':_0x27aebc})[_0x10e9('0x2f')](function(){if(!_[_0x10e9('0x87')](_0x15be16)){return _0x50074d['removeAgents'](_0x15be16,{'transaction':_0x27aebc});}})[_0x10e9('0x2f')](function(){_0x15be16[_0x10e9('0x77')](function(_0x207a95){socket[_0x10e9('0x78')]('userFaxQueue:remove',{'UserId':_0x207a95,'FaxQueueId':_0x50074d['id']});});});});});});})['then'](respondWithStatusCode(_0x54be6b,null))[_0x10e9('0x4e')](handleError(_0x54be6b,null));};exports[_0x10e9('0x88')]=function(_0x3ec0b9,_0x2e73ec,_0x3d6c4b){return db[_0x10e9('0x35')][_0x10e9('0x52')]({'where':{'id':_0x3ec0b9[_0x10e9('0x50')]['id']}})[_0x10e9('0x2f')](handleEntityNotFound(_0x2e73ec,null))[_0x10e9('0x2f')](function(_0x2dae76){if(_0x2dae76){return _0x2dae76[_0x10e9('0x88')](_0x3ec0b9[_0x10e9('0x54')][_0x10e9('0x7a')],_[_0x10e9('0x89')](_0x3ec0b9[_0x10e9('0x54')],[_0x10e9('0x7a'),'id'])||{})['spread'](function(_0x46fb92){for(var _0x4eef87=0x0;_0x4eef87<_0x3ec0b9['body'][_0x10e9('0x7a')]['length'];_0x4eef87+=0x1){socket[_0x10e9('0x78')]('userFaxQueue:save',{'UserId':Number(_0x3ec0b9[_0x10e9('0x54')]['ids'][_0x4eef87]),'FaxQueueId':Number(_0x3ec0b9[_0x10e9('0x50')]['id'])});}return _0x46fb92;});}})[_0x10e9('0x2f')](respondWithResult(_0x2e73ec,null))[_0x10e9('0x4e')](handleError(_0x2e73ec,null));};exports[_0x10e9('0x8a')]=function(_0x22e3e3,_0x5f3d30,_0x5c35bd){return db['FaxQueue'][_0x10e9('0x52')]({'where':{'id':_0x22e3e3[_0x10e9('0x50')]['id']}})[_0x10e9('0x2f')](handleEntityNotFound(_0x5f3d30,null))[_0x10e9('0x2f')](function(_0x931050){if(_0x931050){return _0x931050[_0x10e9('0x8a')](_0x22e3e3[_0x10e9('0x3a')][_0x10e9('0x7a')])[_0x10e9('0x2f')](function(){if(_['isArray'](_0x22e3e3[_0x10e9('0x3a')][_0x10e9('0x7a')])){for(var _0x140dc4=0x0;_0x140dc4<_0x22e3e3['query'][_0x10e9('0x7a')][_0x10e9('0x40')];_0x140dc4+=0x1){socket[_0x10e9('0x78')](_0x10e9('0x8b'),{'UserId':Number(_0x22e3e3[_0x10e9('0x3a')][_0x10e9('0x7a')][_0x140dc4]),'FaxQueueId':Number(_0x22e3e3[_0x10e9('0x50')]['id'])});}}else{socket[_0x10e9('0x78')]('userFaxQueue:remove',{'UserId':Number(_0x22e3e3[_0x10e9('0x3a')]['ids']),'FaxQueueId':Number(_0x22e3e3[_0x10e9('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x5f3d30,null))[_0x10e9('0x4e')](handleError(_0x5f3d30,null));};exports[_0x10e9('0x8c')]=function(_0x5e4ceb,_0xbbe783,_0x8c9e45){var _0x583d17={};var _0x45b8cc={};var _0x1e4c86;var _0x2a61a;return db[_0x10e9('0x35')][_0x10e9('0x5e')]({'where':{'id':_0x5e4ceb['params']['id']}})[_0x10e9('0x2f')](handleEntityNotFound(_0xbbe783,null))[_0x10e9('0x2f')](function(_0x3f9967){if(_0x3f9967){_0x1e4c86=_0x3f9967;_0x45b8cc[_0x10e9('0x39')]=_[_0x10e9('0x3b')](db[_0x10e9('0x62')][_0x10e9('0x36')]);_0x45b8cc[_0x10e9('0x3a')]=_[_0x10e9('0x3b')](_0x5e4ceb[_0x10e9('0x3a')]);_0x45b8cc[_0x10e9('0x3c')]=_[_0x10e9('0x3d')](_0x45b8cc[_0x10e9('0x39')],_0x45b8cc[_0x10e9('0x3a')]);_0x583d17[_0x10e9('0x3f')]=_[_0x10e9('0x3d')](_0x45b8cc[_0x10e9('0x39')],qs[_0x10e9('0x3e')](_0x5e4ceb[_0x10e9('0x3a')][_0x10e9('0x3e')]));_0x583d17['attributes']=_0x583d17['attributes'][_0x10e9('0x40')]?_0x583d17['attributes']:_0x45b8cc[_0x10e9('0x39')];_0x583d17[_0x10e9('0x44')]=qs[_0x10e9('0x45')](_0x5e4ceb[_0x10e9('0x3a')][_0x10e9('0x45')]);_0x583d17[_0x10e9('0x46')]=qs['filters'](_[_0x10e9('0x5f')](_0x5e4ceb['query'],_0x45b8cc['filters']));if(_0x5e4ceb[_0x10e9('0x3a')][_0x10e9('0x47')]){_0x583d17[_0x10e9('0x46')]=_[_0x10e9('0x48')](_0x583d17[_0x10e9('0x46')],{'$or':_[_0x10e9('0x34')](_0x583d17['attributes'],function(_0x4c3b96){var _0x1a0442={};_0x1a0442[_0x4c3b96]={'$like':'%'+_0x5e4ceb[_0x10e9('0x3a')][_0x10e9('0x47')]+'%'};return _0x1a0442;})});}_0x583d17=_[_0x10e9('0x48')]({},_0x583d17,_0x5e4ceb['options']);return _0x1e4c86['getAgents'](_0x583d17);}})[_0x10e9('0x2f')](function(_0x4d927d){if(_0x4d927d){_0x2a61a=_0x4d927d['length'];if(!_0x5e4ceb[_0x10e9('0x3a')][_0x10e9('0x41')]('nolimit')){_0x583d17[_0x10e9('0x43')]=qs[_0x10e9('0x43')](_0x5e4ceb[_0x10e9('0x3a')][_0x10e9('0x43')]);_0x583d17[_0x10e9('0x24')]=qs[_0x10e9('0x24')](_0x5e4ceb[_0x10e9('0x3a')][_0x10e9('0x24')]);}return _0x1e4c86[_0x10e9('0x8c')](_0x583d17);}})[_0x10e9('0x2f')](function(_0x1a25c9){if(_0x1a25c9){return _0x1a25c9?{'count':_0x2a61a,'rows':_0x1a25c9}:null;}})[_0x10e9('0x2f')](respondWithResult(_0xbbe783,null))[_0x10e9('0x4e')](handleError(_0xbbe783,null));}; \ No newline at end of file +var _0x095f=['defaults','localhost','./faxQueue.socket','register','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','update','then','destroy','get','end','error','name','send','index','FaxQueue','rawAttributes','key','model','map','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','show','params','fields','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','FaxQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserFaxQueue','FaxQueueId','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','SIP','faxPause','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','transaction','removeAgents','userFaxQueue:remove','addAgents','omit','spread','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','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','redis'];(function(_0x2a256f,_0x3d591f){var _0x1f4ce0=function(_0x393242){while(--_0x393242){_0x2a256f['push'](_0x2a256f['shift']());}};_0x1f4ce0(++_0x3d591f);}(_0x095f,0x6e));var _0xf095=function(_0x10033e,_0x33beb9){_0x10033e=_0x10033e-0x0;var _0x33c78f=_0x095f[_0x10033e];return _0x33c78f;};'use strict';var emlformat=require(_0xf095('0x0'));var rimraf=require(_0xf095('0x1'));var zipdir=require(_0xf095('0x2'));var jsonpatch=require(_0xf095('0x3'));var rp=require(_0xf095('0x4'));var moment=require(_0xf095('0x5'));var BPromise=require(_0xf095('0x6'));var Mustache=require(_0xf095('0x7'));var util=require(_0xf095('0x8'));var path=require(_0xf095('0x9'));var sox=require(_0xf095('0xa'));var csv=require(_0xf095('0xb'));var ejs=require(_0xf095('0xc'));var fs=require('fs');var fs_extra=require(_0xf095('0xd'));var _=require(_0xf095('0xe'));var squel=require(_0xf095('0xf'));var crypto=require(_0xf095('0x10'));var jsforce=require(_0xf095('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xf095('0xb'));var querystring=require(_0xf095('0x12'));var Papa=require(_0xf095('0x13'));var Redis=require('ioredis');var authService=require(_0xf095('0x14'));var qs=require(_0xf095('0x15'));var as=require(_0xf095('0x16'));var hardwareService=require(_0xf095('0x17'));var logger=require(_0xf095('0x18'))(_0xf095('0x19'));var utils=require(_0xf095('0x1a'));var config=require(_0xf095('0x1b'));var licenseUtil=require(_0xf095('0x1c'));var db=require(_0xf095('0x1d'))['db'];config[_0xf095('0x1e')]=_[_0xf095('0x1f')](config[_0xf095('0x1e')],{'host':_0xf095('0x20'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf095('0x1e')]));require(_0xf095('0x21'))[_0xf095('0x22')](socket);function respondWithStatusCode(_0x2f8b32,_0x759a99){_0x759a99=_0x759a99||0xcc;return function(_0x150e95){if(_0x150e95){return _0x2f8b32[_0xf095('0x23')](_0x759a99);}return _0x2f8b32[_0xf095('0x24')](_0x759a99)['end']();};}function respondWithResult(_0x246e76,_0x508f52){_0x508f52=_0x508f52||0xc8;return function(_0x56e2e4){if(_0x56e2e4){return _0x246e76['status'](_0x508f52)[_0xf095('0x25')](_0x56e2e4);}};}function respondWithFilteredResult(_0x29a2eb,_0x2178b1){return function(_0x338854){if(_0x338854){var _0x5299d=typeof _0x2178b1[_0xf095('0x26')]==='undefined'&&typeof _0x2178b1[_0xf095('0x27')]==='undefined';var _0x5315ac=_0x338854[_0xf095('0x28')];var _0x487508=_0x5299d?0x0:_0x2178b1[_0xf095('0x26')];var _0x11da46=_0x5299d?_0x338854[_0xf095('0x28')]:_0x2178b1[_0xf095('0x26')]+_0x2178b1[_0xf095('0x27')];var _0x3594a7;if(_0x11da46>=_0x5315ac){_0x11da46=_0x5315ac;_0x3594a7=0xc8;}else{_0x3594a7=0xce;}_0x29a2eb['status'](_0x3594a7);return _0x29a2eb[_0xf095('0x29')](_0xf095('0x2a'),_0x487508+'-'+_0x11da46+'/'+_0x5315ac)['json'](_0x338854);}return null;};}function patchUpdates(_0x453aaa){return function(_0x68ce7e){try{jsonpatch['apply'](_0x68ce7e,_0x453aaa,!![]);}catch(_0x96e305){return BPromise[_0xf095('0x2b')](_0x96e305);}return _0x68ce7e['save']();};}function saveUpdates(_0x2f56c2,_0x17ea8e){return function(_0x4bd799){if(_0x4bd799){return _0x4bd799[_0xf095('0x2c')](_0x2f56c2)[_0xf095('0x2d')](function(_0x52b94a){return _0x52b94a;});}return null;};}function removeEntity(_0x1692fd,_0x3ec3ab){return function(_0x5ef01d){if(_0x5ef01d){return _0x5ef01d[_0xf095('0x2e')]()[_0xf095('0x2d')](function(){var _0x2de2e4=_0x5ef01d[_0xf095('0x2f')]({'plain':!![]});var _0xcc815e='FaxQueues';return db['UserProfileResource'][_0xf095('0x2e')]({'where':{'type':_0xcc815e,'resourceId':_0x2de2e4['id']}})[_0xf095('0x2d')](function(){return _0x5ef01d;});})['then'](function(){_0x1692fd['status'](0xcc)[_0xf095('0x30')]();});}};}function handleEntityNotFound(_0x170620,_0x179b9b){return function(_0x303efc){if(!_0x303efc){_0x170620['sendStatus'](0x194);}return _0x303efc;};}function handleError(_0x20d440,_0x32d358){_0x32d358=_0x32d358||0x1f4;return function(_0x250213){logger[_0xf095('0x31')](_0x250213['stack']);if(_0x250213[_0xf095('0x32')]){delete _0x250213[_0xf095('0x32')];}_0x20d440[_0xf095('0x24')](_0x32d358)[_0xf095('0x33')](_0x250213);};}exports[_0xf095('0x34')]=function(_0x410bee,_0x11fa6c){var _0x540366={},_0x47d7c9={},_0x549dd7={'count':0x0,'rows':[]};var _0x32ff40=_['map'](db[_0xf095('0x35')][_0xf095('0x36')],function(_0xb08cd3){return{'name':_0xb08cd3['fieldName'],'type':_0xb08cd3['type'][_0xf095('0x37')]};});_0x47d7c9[_0xf095('0x38')]=_[_0xf095('0x39')](_0x32ff40,_0xf095('0x32'));_0x47d7c9['query']=_[_0xf095('0x3a')](_0x410bee[_0xf095('0x3b')]);_0x47d7c9[_0xf095('0x3c')]=_[_0xf095('0x3d')](_0x47d7c9['model'],_0x47d7c9['query']);_0x540366[_0xf095('0x3e')]=_[_0xf095('0x3d')](_0x47d7c9['model'],qs['fields'](_0x410bee['query']['fields']));_0x540366['attributes']=_0x540366['attributes'][_0xf095('0x3f')]?_0x540366['attributes']:_0x47d7c9['model'];if(!_0x410bee[_0xf095('0x3b')][_0xf095('0x40')](_0xf095('0x41'))){_0x540366[_0xf095('0x27')]=qs[_0xf095('0x27')](_0x410bee[_0xf095('0x3b')][_0xf095('0x27')]);_0x540366[_0xf095('0x26')]=qs[_0xf095('0x26')](_0x410bee[_0xf095('0x3b')][_0xf095('0x26')]);}_0x540366[_0xf095('0x42')]=qs[_0xf095('0x43')](_0x410bee['query']['sort']);_0x540366[_0xf095('0x44')]=qs['filters'](_[_0xf095('0x45')](_0x410bee[_0xf095('0x3b')],_0x47d7c9[_0xf095('0x3c')]),_0x32ff40);if(_0x410bee['query'][_0xf095('0x46')]){_0x540366[_0xf095('0x44')]=_[_0xf095('0x47')](_0x540366[_0xf095('0x44')],{'$or':_['map'](_0x32ff40,function(_0x3449cf){if(_0x3449cf[_0xf095('0x48')]!==_0xf095('0x49')){var _0x53bed6={};_0x53bed6[_0x3449cf[_0xf095('0x32')]]={'$like':'%'+_0x410bee[_0xf095('0x3b')][_0xf095('0x46')]+'%'};return _0x53bed6;}})});}_0x540366=_[_0xf095('0x47')]({},_0x540366,_0x410bee[_0xf095('0x4a')]);var _0x5cca8f={'where':_0x540366['where']};return db[_0xf095('0x35')][_0xf095('0x28')](_0x5cca8f)[_0xf095('0x2d')](function(_0x2f7301){_0x549dd7[_0xf095('0x28')]=_0x2f7301;if(_0x410bee[_0xf095('0x3b')][_0xf095('0x4b')]){_0x540366[_0xf095('0x4c')]=[{'all':!![]}];}return db[_0xf095('0x35')]['findAll'](_0x540366);})[_0xf095('0x2d')](function(_0x2fbe93){_0x549dd7['rows']=_0x2fbe93;return _0x549dd7;})['then'](respondWithFilteredResult(_0x11fa6c,_0x540366))['catch'](handleError(_0x11fa6c,null));};exports[_0xf095('0x4d')]=function(_0x50508f,_0x1ea780){var _0x555c8f={'raw':!![],'where':{'id':_0x50508f[_0xf095('0x4e')]['id']}},_0xad6102={};_0xad6102[_0xf095('0x38')]=_[_0xf095('0x3a')](db['FaxQueue'][_0xf095('0x36')]);_0xad6102[_0xf095('0x3b')]=_[_0xf095('0x3a')](_0x50508f[_0xf095('0x3b')]);_0xad6102[_0xf095('0x3c')]=_[_0xf095('0x3d')](_0xad6102['model'],_0xad6102[_0xf095('0x3b')]);_0x555c8f[_0xf095('0x3e')]=_[_0xf095('0x3d')](_0xad6102[_0xf095('0x38')],qs[_0xf095('0x4f')](_0x50508f[_0xf095('0x3b')][_0xf095('0x4f')]));_0x555c8f[_0xf095('0x3e')]=_0x555c8f[_0xf095('0x3e')][_0xf095('0x3f')]?_0x555c8f[_0xf095('0x3e')]:_0xad6102[_0xf095('0x38')];if(_0x50508f[_0xf095('0x3b')][_0xf095('0x4b')]){_0x555c8f[_0xf095('0x4c')]=[{'all':!![]}];}_0x555c8f=_['merge']({},_0x555c8f,_0x50508f[_0xf095('0x4a')]);return db[_0xf095('0x35')][_0xf095('0x50')](_0x555c8f)[_0xf095('0x2d')](handleEntityNotFound(_0x1ea780,null))[_0xf095('0x2d')](respondWithResult(_0x1ea780,null))[_0xf095('0x51')](handleError(_0x1ea780,null));};exports['create']=function(_0x2dfd97,_0x1881aa){return db[_0xf095('0x35')][_0xf095('0x52')](_0x2dfd97['body'],{})[_0xf095('0x2d')](function(_0x35a95d){var _0x5777bc=_0x2dfd97[_0xf095('0x53')][_0xf095('0x2f')]({'plain':!![]});if(!_0x5777bc)throw new Error(_0xf095('0x54'));if(_0x5777bc['role']===_0xf095('0x53')){var _0x3c9b3e=_0x35a95d['get']({'plain':!![]});var _0x3bb310=_0xf095('0x55');return db[_0xf095('0x56')]['find']({'where':{'name':_0x3bb310,'userProfileId':_0x5777bc['userProfileId']},'raw':!![]})['then'](function(_0xdce176){if(_0xdce176&&_0xdce176[_0xf095('0x57')]===0x0){return db['UserProfileResource'][_0xf095('0x52')]({'name':_0x3c9b3e[_0xf095('0x32')],'resourceId':_0x3c9b3e['id'],'type':_0xdce176['name'],'sectionId':_0xdce176['id']},{})['then'](function(){return _0x35a95d;});}else{return _0x35a95d;}})[_0xf095('0x51')](function(_0x58b26f){logger[_0xf095('0x31')](_0xf095('0x58'),_0x58b26f);throw _0x58b26f;});}return _0x35a95d;})['then'](respondWithResult(_0x1881aa,0xc9))[_0xf095('0x51')](handleError(_0x1881aa,null));};exports[_0xf095('0x2c')]=function(_0x22f69d,_0x4a8943){if(_0x22f69d[_0xf095('0x59')]['id']){delete _0x22f69d[_0xf095('0x59')]['id'];}return db[_0xf095('0x35')][_0xf095('0x50')]({'where':{'id':_0x22f69d['params']['id']}})[_0xf095('0x2d')](handleEntityNotFound(_0x4a8943,null))[_0xf095('0x2d')](saveUpdates(_0x22f69d[_0xf095('0x59')],null))[_0xf095('0x2d')](respondWithResult(_0x4a8943,null))[_0xf095('0x51')](handleError(_0x4a8943,null));};exports['destroy']=function(_0x3eaa20,_0x443273){return db[_0xf095('0x35')][_0xf095('0x50')]({'where':{'id':_0x3eaa20[_0xf095('0x4e')]['id']}})[_0xf095('0x2d')](handleEntityNotFound(_0x443273,null))[_0xf095('0x2d')](removeEntity(_0x443273,null))[_0xf095('0x51')](handleError(_0x443273,null));};exports['describe']=function(_0x32e704,_0x4171e9){return db[_0xf095('0x35')][_0xf095('0x5a')]()[_0xf095('0x2d')](respondWithResult(_0x4171e9,null))[_0xf095('0x51')](handleError(_0x4171e9,null));};exports['getMembers']=function(_0x2df5e3,_0x36da9e,_0x232eda){var _0x23d0fe={'raw':!![],'where':{}},_0x3c20d5={},_0x2c5db4;return db[_0xf095('0x35')][_0xf095('0x5b')]({'where':{'id':_0x2df5e3['params']['id']}})[_0xf095('0x2d')](handleEntityNotFound(_0x36da9e,null))[_0xf095('0x2d')](function(_0x55b223){if(_0x55b223){_0x2c5db4=_0x55b223[_0xf095('0x2f')]({'plain':!![]});_0x3c20d5[_0xf095('0x38')]=_[_0xf095('0x3a')](db[_0xf095('0x5c')]['rawAttributes']);_0x3c20d5[_0xf095('0x3b')]=_[_0xf095('0x3a')](_0x2df5e3[_0xf095('0x3b')]);_0x3c20d5[_0xf095('0x3c')]=_[_0xf095('0x3d')](_0x3c20d5[_0xf095('0x38')],_0x3c20d5[_0xf095('0x3b')]);_0x23d0fe[_0xf095('0x3e')]=_[_0xf095('0x3d')](_0x3c20d5['model'],qs['fields'](_0x2df5e3[_0xf095('0x3b')]['fields']));_0x23d0fe['attributes']=_0x23d0fe[_0xf095('0x3e')][_0xf095('0x3f')]?_0x23d0fe[_0xf095('0x3e')]:_0x3c20d5['model'];if(!_0x2df5e3['query'][_0xf095('0x40')](_0xf095('0x41'))){_0x23d0fe[_0xf095('0x27')]=qs['limit'](_0x2df5e3[_0xf095('0x3b')][_0xf095('0x27')]);_0x23d0fe['offset']=qs[_0xf095('0x26')](_0x2df5e3[_0xf095('0x3b')][_0xf095('0x26')]);}_0x23d0fe['order']=qs['sort'](_0x2df5e3['query'][_0xf095('0x43')]);_0x23d0fe['where']=qs[_0xf095('0x3c')](_['pick'](_0x2df5e3['query'],_0x3c20d5[_0xf095('0x3c')]));_0x23d0fe[_0xf095('0x44')][_0xf095('0x5d')]=_0x55b223['id'];if(_0x2df5e3['query'][_0xf095('0x46')]){_0x23d0fe['where']=_[_0xf095('0x47')](_0x23d0fe[_0xf095('0x44')],{'$or':_[_0xf095('0x39')](_0x23d0fe[_0xf095('0x3e')],function(_0x101817){var _0x4fad17={};_0x4fad17[_0x101817]={'$like':'%'+_0x2df5e3[_0xf095('0x3b')][_0xf095('0x46')]+'%'};return _0x4fad17;})});}_0x23d0fe=_[_0xf095('0x47')]({},_0x23d0fe,_0x2df5e3[_0xf095('0x4a')]);return db[_0xf095('0x5c')][_0xf095('0x5e')](_0x23d0fe);}})['then'](function(_0x446c1e){if(_0x446c1e){return db[_0xf095('0x5f')][_0xf095('0x60')]({'where':{'id':_[_0xf095('0x39')](_0x446c1e,_0xf095('0x61')),'role':_0xf095('0x62')},'attributes':['id',_0xf095('0x32'),'faxPause',_0xf095('0x63'),_0xf095('0x64')]});}})[_0xf095('0x2d')](function(_0x4275ea){if(_0x4275ea){return{'count':_0x4275ea[_0xf095('0x28')],'rows':_[_0xf095('0x39')](_0x4275ea['rows'],function(_0x5577b1){return{'membername':_0x5577b1['name'],'UserId':_0x5577b1['id'],'queue_name':_0x2c5db4[_0xf095('0x32')],'FaxQueueId':_0x2c5db4['id'],'interface':util['format']('%s/%s',_0xf095('0x65'),_0x5577b1[_0xf095('0x32')]),'penalty':0x0,'paused':_0x5577b1[_0xf095('0x66')],'createdAt':_0x5577b1[_0xf095('0x64')],'updatedAt':_0x5577b1[_0xf095('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf095('0x2d')](respondWithFilteredResult(_0x36da9e,_0x23d0fe))[_0xf095('0x51')](handleError(_0x36da9e,null));};exports[_0xf095('0x67')]=function(_0x36aaa1,_0x3a1222,_0x4b09ac){var _0x312bce={};var _0x3180ea={};var _0x117279;var _0x3e98cd;return db[_0xf095('0x35')][_0xf095('0x5b')]({'where':{'id':_0x36aaa1['params']['id']}})[_0xf095('0x2d')](handleEntityNotFound(_0x3a1222,null))[_0xf095('0x2d')](function(_0x297068){if(_0x297068){_0x117279=_0x297068;_0x3180ea['model']=_[_0xf095('0x3a')](db[_0xf095('0x68')][_0xf095('0x36')]);_0x3180ea['query']=_['keys'](_0x36aaa1['query']);_0x3180ea[_0xf095('0x3c')]=_[_0xf095('0x3d')](_0x3180ea[_0xf095('0x38')],_0x3180ea['query']);_0x312bce[_0xf095('0x3e')]=_['intersection'](_0x3180ea['model'],qs[_0xf095('0x4f')](_0x36aaa1[_0xf095('0x3b')]['fields']));_0x312bce[_0xf095('0x3e')]=_0x312bce[_0xf095('0x3e')]['length']?_0x312bce[_0xf095('0x3e')]:_0x3180ea[_0xf095('0x38')];_0x312bce['order']=qs[_0xf095('0x43')](_0x36aaa1[_0xf095('0x3b')]['sort']);_0x312bce[_0xf095('0x44')]=qs[_0xf095('0x3c')](_[_0xf095('0x45')](_0x36aaa1[_0xf095('0x3b')],_0x3180ea[_0xf095('0x3c')]));if(_0x36aaa1[_0xf095('0x3b')]['filter']){_0x312bce['where']=_[_0xf095('0x47')](_0x312bce[_0xf095('0x44')],{'$or':_[_0xf095('0x39')](_0x312bce[_0xf095('0x3e')],function(_0x3a2f7d){var _0x251ba5={};_0x251ba5[_0x3a2f7d]={'$like':'%'+_0x36aaa1[_0xf095('0x3b')][_0xf095('0x46')]+'%'};return _0x251ba5;})});}_0x312bce=_[_0xf095('0x47')]({},_0x312bce,_0x36aaa1[_0xf095('0x4a')]);return _0x117279[_0xf095('0x67')](_0x312bce);}})['then'](function(_0x4a0c23){if(_0x4a0c23){_0x3e98cd=_0x4a0c23['length'];if(!_0x36aaa1[_0xf095('0x3b')][_0xf095('0x40')](_0xf095('0x41'))){_0x312bce['limit']=qs[_0xf095('0x27')](_0x36aaa1[_0xf095('0x3b')]['limit']);_0x312bce[_0xf095('0x26')]=qs[_0xf095('0x26')](_0x36aaa1[_0xf095('0x3b')]['offset']);}return _0x117279[_0xf095('0x67')](_0x312bce);}})[_0xf095('0x2d')](function(_0x5066b9){if(_0x5066b9){return _0x5066b9?{'count':_0x3e98cd,'rows':_0x5066b9}:null;}})[_0xf095('0x2d')](respondWithResult(_0x3a1222,null))[_0xf095('0x51')](handleError(_0x3a1222,null));};exports[_0xf095('0x69')]=function(_0x3a454b,_0x3fd665,_0x328f67){var _0x4c1494=_0x3a454b[_0xf095('0x59')][_0xf095('0x6a')];return db[_0xf095('0x68')][_0xf095('0x5e')]({'where':{'id':_0x4c1494},'attributes':['id'],'include':[{'model':db[_0xf095('0x5f')],'as':_0xf095('0x6b'),'attributes':['id',_0xf095('0x32'),_0xf095('0x6c'),_0xf095('0x6d'),_0xf095('0x6e')],'raw':!![]}]})[_0xf095('0x2d')](function(_0x2377e4){if(_0x2377e4){var _0x23f8e4=_[_0xf095('0x6f')](_0x2377e4,function(_0x75b95){var _0xf5f5ce=_0x75b95[_0xf095('0x2f')]({'plain':!![]});return _0xf5f5ce[_0xf095('0x6b')];});return db[_0xf095('0x35')][_0xf095('0x50')]({'where':{'id':_0x3a454b[_0xf095('0x4e')]['id']}})['then'](function(_0x7492bc){return db[_0xf095('0x70')]['transaction'](function(_0x4d9f8d){return _0x7492bc['addTeams'](_0x4c1494,{'transaction':_0x4d9f8d})['then'](function(){return BPromise[_0xf095('0x71')](_0x23f8e4,function(_0x20f66e){return db[_0xf095('0x5c')][_0xf095('0x72')]({'where':{'UserId':_0x20f66e['id'],'FaxQueueId':_0x3a454b[_0xf095('0x4e')]['id']},'transaction':_0x4d9f8d});});})['then'](function(){_0x23f8e4[_0xf095('0x73')](function(_0x310531){socket['emit'](_0xf095('0x74'),{'UserId':_0x310531['id'],'FaxQueueId':_0x7492bc['id']});});});});});}})['then'](respondWithStatusCode(_0x3fd665,null))[_0xf095('0x51')](handleError(_0x3fd665,null));};exports[_0xf095('0x75')]=function(_0x1d27d8,_0x2e598c,_0x5b428f){return db['Team'][_0xf095('0x5e')]({'where':{'id':_0x1d27d8[_0xf095('0x3b')][_0xf095('0x6a')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf095('0x2d')](handleEntityNotFound(_0x2e598c,null))[_0xf095('0x2d')](function(_0x45cada){var _0x481373=_['map'](_0x45cada,'id');var _0x2c59db=[];var _0x1d4117=[];var _0x5cc365=squel['select']();_0x5cc365['field'](_0xf095('0x76'))[_0xf095('0x77')]('team_has_fax_queues','tq')[_0xf095('0x78')]('user_has_teams','ut',_0xf095('0x79'))[_0xf095('0x44')](_0xf095('0x7a'),_0x1d27d8[_0xf095('0x4e')]['id']);for(var _0x459175=0x0;_0x459175<_0x45cada[_0xf095('0x3f')];_0x459175+=0x1){let _0x1fe54e=_0x45cada[_0x459175];for(var _0x378e85=0x0;_0x378e85<_0x1fe54e[_0xf095('0x6b')][_0xf095('0x3f')];_0x378e85+=0x1){let _0x580570=_0x1fe54e[_0xf095('0x6b')][_0x378e85];var _0xa265b9=_0x5cc365[_0xf095('0x7b')]();_0xa265b9[_0xf095('0x44')]('ut.UserId\x20=\x20?',_0x580570['id']);_0x1d4117[_0xf095('0x7c')](db[_0xf095('0x70')]['query'](_0xa265b9[_0xf095('0x7d')](),{'type':db['sequelize'][_0xf095('0x7e')][_0xf095('0x7f')]})[_0xf095('0x2d')](function(_0x3f46fc){if(_0x3f46fc[_0xf095('0x3f')]===0x1){return _0x580570['id'];}else{var _0x3dce96=_['every'](_['map'](_0x3f46fc,_0xf095('0x80')),function(_0x4af0d0){return _[_0xf095('0x81')](_0x481373,_0x4af0d0);});if(_0x3dce96){return _0x580570['id'];}}}));}}return BPromise[_0xf095('0x82')](_0x1d4117)[_0xf095('0x2d')](function(_0x55a47d){_0x2c59db=_(_0x2c59db)[_0xf095('0x83')](_0x55a47d)[_0xf095('0x84')]()['value']();return db[_0xf095('0x35')]['find']({'where':{'id':_0x1d27d8[_0xf095('0x4e')]['id']}})[_0xf095('0x2d')](function(_0x42bc86){return db['sequelize'][_0xf095('0x85')](function(_0x38bd76){return _0x42bc86['removeTeams'](_0x1d27d8[_0xf095('0x3b')][_0xf095('0x6a')],{'transaction':_0x38bd76})[_0xf095('0x2d')](function(){if(!_['isEmpty'](_0x2c59db)){return _0x42bc86[_0xf095('0x86')](_0x2c59db,{'transaction':_0x38bd76});}})[_0xf095('0x2d')](function(){_0x2c59db['forEach'](function(_0x531104){socket['emit'](_0xf095('0x87'),{'UserId':_0x531104,'FaxQueueId':_0x42bc86['id']});});});});});});})['then'](respondWithStatusCode(_0x2e598c,null))[_0xf095('0x51')](handleError(_0x2e598c,null));};exports['addAgents']=function(_0x28169f,_0x2e3617,_0x1746bb){return db['FaxQueue']['find']({'where':{'id':_0x28169f['params']['id']}})['then'](handleEntityNotFound(_0x2e3617,null))[_0xf095('0x2d')](function(_0x17d8e9){if(_0x17d8e9){return _0x17d8e9[_0xf095('0x88')](_0x28169f[_0xf095('0x59')][_0xf095('0x6a')],_[_0xf095('0x89')](_0x28169f[_0xf095('0x59')],[_0xf095('0x6a'),'id'])||{})[_0xf095('0x8a')](function(_0x7f8b72){for(var _0xf7197b=0x0;_0xf7197b<_0x28169f[_0xf095('0x59')]['ids'][_0xf095('0x3f')];_0xf7197b+=0x1){socket[_0xf095('0x8b')](_0xf095('0x74'),{'UserId':Number(_0x28169f['body'][_0xf095('0x6a')][_0xf7197b]),'FaxQueueId':Number(_0x28169f[_0xf095('0x4e')]['id'])});}return _0x7f8b72;});}})[_0xf095('0x2d')](respondWithResult(_0x2e3617,null))[_0xf095('0x51')](handleError(_0x2e3617,null));};exports['removeAgents']=function(_0x37ab06,_0xf15d2a,_0x1dbc9c){return db[_0xf095('0x35')]['find']({'where':{'id':_0x37ab06['params']['id']}})[_0xf095('0x2d')](handleEntityNotFound(_0xf15d2a,null))[_0xf095('0x2d')](function(_0x46defc){if(_0x46defc){return _0x46defc[_0xf095('0x86')](_0x37ab06[_0xf095('0x3b')][_0xf095('0x6a')])[_0xf095('0x2d')](function(){if(_['isArray'](_0x37ab06['query'][_0xf095('0x6a')])){for(var _0x21ef6=0x0;_0x21ef6<_0x37ab06['query'][_0xf095('0x6a')]['length'];_0x21ef6+=0x1){socket[_0xf095('0x8b')](_0xf095('0x87'),{'UserId':Number(_0x37ab06[_0xf095('0x3b')][_0xf095('0x6a')][_0x21ef6]),'FaxQueueId':Number(_0x37ab06[_0xf095('0x4e')]['id'])});}}else{socket['emit'](_0xf095('0x87'),{'UserId':Number(_0x37ab06[_0xf095('0x3b')][_0xf095('0x6a')]),'FaxQueueId':Number(_0x37ab06[_0xf095('0x4e')]['id'])});}});}})[_0xf095('0x2d')](respondWithStatusCode(_0xf15d2a,null))[_0xf095('0x51')](handleError(_0xf15d2a,null));};exports['getAgents']=function(_0xf5322b,_0x5db7fd,_0x4eb628){var _0x3efe64={};var _0x3ce7c2={};var _0x3acc6e;var _0x29b3b9;return db[_0xf095('0x35')][_0xf095('0x5b')]({'where':{'id':_0xf5322b[_0xf095('0x4e')]['id']}})[_0xf095('0x2d')](handleEntityNotFound(_0x5db7fd,null))[_0xf095('0x2d')](function(_0x287e4c){if(_0x287e4c){_0x3acc6e=_0x287e4c;_0x3ce7c2[_0xf095('0x38')]=_['keys'](db[_0xf095('0x5f')]['rawAttributes']);_0x3ce7c2['query']=_[_0xf095('0x3a')](_0xf5322b['query']);_0x3ce7c2['filters']=_[_0xf095('0x3d')](_0x3ce7c2['model'],_0x3ce7c2[_0xf095('0x3b')]);_0x3efe64[_0xf095('0x3e')]=_[_0xf095('0x3d')](_0x3ce7c2['model'],qs[_0xf095('0x4f')](_0xf5322b[_0xf095('0x3b')][_0xf095('0x4f')]));_0x3efe64[_0xf095('0x3e')]=_0x3efe64[_0xf095('0x3e')][_0xf095('0x3f')]?_0x3efe64['attributes']:_0x3ce7c2[_0xf095('0x38')];_0x3efe64[_0xf095('0x42')]=qs[_0xf095('0x43')](_0xf5322b[_0xf095('0x3b')][_0xf095('0x43')]);_0x3efe64[_0xf095('0x44')]=qs[_0xf095('0x3c')](_[_0xf095('0x45')](_0xf5322b[_0xf095('0x3b')],_0x3ce7c2[_0xf095('0x3c')]));if(_0xf5322b['query'][_0xf095('0x46')]){_0x3efe64[_0xf095('0x44')]=_['merge'](_0x3efe64[_0xf095('0x44')],{'$or':_[_0xf095('0x39')](_0x3efe64[_0xf095('0x3e')],function(_0x24a145){var _0x7b61bd={};_0x7b61bd[_0x24a145]={'$like':'%'+_0xf5322b[_0xf095('0x3b')][_0xf095('0x46')]+'%'};return _0x7b61bd;})});}_0x3efe64=_[_0xf095('0x47')]({},_0x3efe64,_0xf5322b[_0xf095('0x4a')]);return _0x3acc6e[_0xf095('0x8c')](_0x3efe64);}})['then'](function(_0x2d6223){if(_0x2d6223){_0x29b3b9=_0x2d6223[_0xf095('0x3f')];if(!_0xf5322b[_0xf095('0x3b')]['hasOwnProperty'](_0xf095('0x41'))){_0x3efe64[_0xf095('0x27')]=qs[_0xf095('0x27')](_0xf5322b[_0xf095('0x3b')][_0xf095('0x27')]);_0x3efe64[_0xf095('0x26')]=qs[_0xf095('0x26')](_0xf5322b[_0xf095('0x3b')][_0xf095('0x26')]);}return _0x3acc6e[_0xf095('0x8c')](_0x3efe64);}})['then'](function(_0x301e03){if(_0x301e03){return _0x301e03?{'count':_0x29b3b9,'rows':_0x301e03}:null;}})[_0xf095('0x2d')](respondWithResult(_0x5db7fd,null))['catch'](handleError(_0x5db7fd,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 600ab31..fc9e9a5 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 _0x4508=['setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb','FaxQueue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4508,0x84));var _0x8450=function(_0x443346,_0x4e3ec7){_0x443346=_0x443346-0x0;var _0xfe49e8=_0x4508[_0x443346];return _0xfe49e8;};'use strict';var EventEmitter=require(_0x8450('0x0'));var FaxQueue=require(_0x8450('0x1'))['db'][_0x8450('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x8450('0x3')](0x0);var events={'afterCreate':_0x8450('0x4'),'afterUpdate':_0x8450('0x5'),'afterDestroy':_0x8450('0x6')};function emitEvent(_0x4af7a3){return function(_0x4b37f2,_0x282f2e,_0x3fdc38){FaxQueueEvents[_0x8450('0x7')](_0x4af7a3+':'+_0x4b37f2['id'],_0x4b37f2);FaxQueueEvents[_0x8450('0x7')](_0x4af7a3,_0x4b37f2);_0x3fdc38(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x8450('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x0eeb=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove'];(function(_0x4f970b,_0x1548f7){var _0x5f7bb9=function(_0x35580f){while(--_0x35580f){_0x4f970b['push'](_0x4f970b['shift']());}};_0x5f7bb9(++_0x1548f7);}(_0x0eeb,0x1b1));var _0xb0ee=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0eeb[_0x4a9fb1];return _0x348672;};'use strict';var EventEmitter=require(_0xb0ee('0x0'));var FaxQueue=require(_0xb0ee('0x1'))['db'][_0xb0ee('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb0ee('0x3')](0x0);var events={'afterCreate':_0xb0ee('0x4'),'afterUpdate':_0xb0ee('0x5'),'afterDestroy':_0xb0ee('0x6')};function emitEvent(_0x309883){return function(_0x584839,_0x2601cf,_0x13aeaa){FaxQueueEvents[_0xb0ee('0x7')](_0x309883+':'+_0x584839['id'],_0x584839);FaxQueueEvents[_0xb0ee('0x7')](_0x309883,_0x584839);_0x13aeaa(null);};}for(var e in events){if(events[_0xb0ee('0x8')](e)){var event=events[e];FaxQueue[_0xb0ee('0x9')](e,emitEvent(event));}}module[_0xb0ee('0xa')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 6a27c9c..4cb521c 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 _0xcfc7=['exports','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueue.attributes'];(function(_0x121132,_0x2024e0){var _0x4a1967=function(_0x1a6a74){while(--_0x1a6a74){_0x121132['push'](_0x121132['shift']());}};_0x4a1967(++_0x2024e0);}(_0xcfc7,0x92));var _0x7cfc=function(_0x217e64,_0x2aa0dd){_0x217e64=_0x217e64-0x0;var _0x5dffea=_0xcfc7[_0x217e64];return _0x5dffea;};'use strict';var _=require(_0x7cfc('0x0'));var util=require(_0x7cfc('0x1'));var logger=require(_0x7cfc('0x2'))(_0x7cfc('0x3'));var moment=require(_0x7cfc('0x4'));var BPromise=require(_0x7cfc('0x5'));var rp=require(_0x7cfc('0x6'));var fs=require('fs');var path=require(_0x7cfc('0x7'));var rimraf=require('rimraf');var config=require(_0x7cfc('0x8'));var attributes=require(_0x7cfc('0x9'));module[_0x7cfc('0xa')]=function(_0x59ff90,_0x3ebe1a){return _0x59ff90['define'](_0x7cfc('0xb'),attributes,{'tableName':_0x7cfc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ab7=['fax_queues','lodash','../../config/logger','api','bluebird','./faxQueue.attributes','exports','define','FaxQueue'];(function(_0x4cfd7b,_0x524510){var _0x2633e5=function(_0x3e0aca){while(--_0x3e0aca){_0x4cfd7b['push'](_0x4cfd7b['shift']());}};_0x2633e5(++_0x524510);}(_0x6ab7,0x10f));var _0x76ab=function(_0x2048e7,_0x53361b){_0x2048e7=_0x2048e7-0x0;var _0x4b894d=_0x6ab7[_0x2048e7];return _0x4b894d;};'use strict';var _=require(_0x76ab('0x0'));var util=require('util');var logger=require(_0x76ab('0x1'))(_0x76ab('0x2'));var moment=require('moment');var BPromise=require(_0x76ab('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x76ab('0x4'));module[_0x76ab('0x5')]=function(_0x27dff9,_0x1db0d5){return _0x27dff9[_0x76ab('0x6')](_0x76ab('0x7'),attributes,{'tableName':_0x76ab('0x8'),'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 4bcdf45..b67ab54 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 _0x115a=['./faxQueue.socket','then','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','limit','include','map','model','attributes','ShowFaxQueue','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost'];(function(_0x449761,_0x401d3d){var _0x2bd171=function(_0x374eef){while(--_0x374eef){_0x449761['push'](_0x449761['shift']());}};_0x2bd171(++_0x401d3d);}(_0x115a,0x1ed));var _0xa115=function(_0x2391db,_0x25bba8){_0x2391db=_0x2391db-0x0;var _0x370a71=_0x115a[_0x2391db];return _0x370a71;};'use strict';var _=require(_0xa115('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa115('0x1'));var rs=require(_0xa115('0x2'));var fs=require('fs');var Redis=require(_0xa115('0x3'));var db=require(_0xa115('0x4'))['db'];var utils=require(_0xa115('0x5'));var logger=require(_0xa115('0x6'))(_0xa115('0x7'));var config=require(_0xa115('0x8'));var jayson=require(_0xa115('0x9'));var client=jayson[_0xa115('0xa')]['http']({'port':0x232a});config[_0xa115('0xb')]=_[_0xa115('0xc')](config[_0xa115('0xb')],{'host':_0xa115('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa115('0xb')]));require(_0xa115('0xe'))['register'](socket);function respondWithRpcPromise(_0x613684,_0x160a79,_0x393bef){return new BPromise(function(_0x38e010,_0x1ff8e5){return client['request'](_0x613684,_0x393bef)[_0xa115('0xf')](function(_0x4a52eb){logger['info'](_0xa115('0x10'),_0x160a79,'request\x20sent');logger[_0xa115('0x11')](_0xa115('0x12'),_0x160a79,_0xa115('0x13'),JSON[_0xa115('0x14')](_0x4a52eb));if(_0x4a52eb['error']){if(_0x4a52eb[_0xa115('0x15')][_0xa115('0x16')]===0x1f4){logger[_0xa115('0x15')](_0xa115('0x10'),_0x160a79,_0x4a52eb[_0xa115('0x15')][_0xa115('0x17')]);return _0x1ff8e5(_0x4a52eb['error'][_0xa115('0x17')]);}logger[_0xa115('0x15')](_0xa115('0x10'),_0x160a79,_0x4a52eb['error'][_0xa115('0x17')]);return _0x38e010(_0x4a52eb[_0xa115('0x15')][_0xa115('0x17')]);}else{logger[_0xa115('0x18')](_0xa115('0x10'),_0x160a79,_0xa115('0x13'));_0x38e010(_0x4a52eb[_0xa115('0x19')][_0xa115('0x17')]);}})[_0xa115('0x1a')](function(_0x4a1ab1){logger[_0xa115('0x15')](_0xa115('0x10'),_0x160a79,_0x4a1ab1);_0x1ff8e5(_0x4a1ab1);});});}exports[_0xa115('0x1b')]=function(_0x1beee4){var _0x2fd791=this;return new Promise(function(_0x3aa0c5,_0x311609){return db[_0xa115('0x1c')][_0xa115('0x1d')]({'raw':_0x1beee4['options']?_0x1beee4[_0xa115('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1beee4['options']?_0x1beee4[_0xa115('0x1e')][_0xa115('0x1f')]||null:null,'attributes':_0x1beee4[_0xa115('0x1e')]?_0x1beee4[_0xa115('0x1e')]['attributes']||null:null,'limit':_0x1beee4['options']?_0x1beee4[_0xa115('0x1e')][_0xa115('0x20')]||null:null,'include':_0x1beee4[_0xa115('0x1e')]?_0x1beee4[_0xa115('0x1e')][_0xa115('0x21')]?_[_0xa115('0x22')](_0x1beee4[_0xa115('0x1e')][_0xa115('0x21')],function(_0x4f4753){return{'model':db[_0x4f4753[_0xa115('0x23')]],'as':_0x4f4753['as'],'attributes':_0x4f4753[_0xa115('0x24')],'include':_0x4f4753[_0xa115('0x21')]?_[_0xa115('0x22')](_0x4f4753[_0xa115('0x21')],function(_0x5acc8a){return{'model':db[_0x5acc8a[_0xa115('0x23')]],'as':_0x5acc8a['as'],'attributes':_0x5acc8a[_0xa115('0x24')],'include':_0x5acc8a[_0xa115('0x21')]?_[_0xa115('0x22')](_0x5acc8a[_0xa115('0x21')],function(_0x2b1c97){return{'model':db[_0x2b1c97['model']],'as':_0x2b1c97['as'],'attributes':_0x2b1c97['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x44a08f){logger['info'](_0xa115('0x1b'),_0x1beee4);logger[_0xa115('0x11')](_0xa115('0x1b'),_0x1beee4,JSON[_0xa115('0x14')](_0x44a08f));_0x3aa0c5(_0x44a08f);})['catch'](function(_0x2ea845){logger[_0xa115('0x15')](_0xa115('0x1b'),_0x2ea845[_0xa115('0x17')],_0x1beee4);_0x311609(_0x2fd791[_0xa115('0x15')](0x1f4,_0x2ea845[_0xa115('0x17')]));});});};exports[_0xa115('0x25')]=function(_0x929817){var _0x3c63a7=this;return new Promise(function(_0x4f6092,_0x812860){return db[_0xa115('0x1c')][_0xa115('0x26')]({'raw':_0x929817[_0xa115('0x1e')]?_0x929817[_0xa115('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x929817[_0xa115('0x1e')]?_0x929817['options'][_0xa115('0x1f')]||null:null,'attributes':_0x929817[_0xa115('0x1e')]?_0x929817[_0xa115('0x1e')][_0xa115('0x24')]||null:null,'include':_0x929817[_0xa115('0x1e')]?_0x929817['options'][_0xa115('0x21')]?_[_0xa115('0x22')](_0x929817[_0xa115('0x1e')]['include'],function(_0x25c80e){return{'model':db[_0x25c80e[_0xa115('0x23')]],'as':_0x25c80e['as'],'attributes':_0x25c80e[_0xa115('0x24')],'include':_0x25c80e[_0xa115('0x21')]?_[_0xa115('0x22')](_0x25c80e[_0xa115('0x21')],function(_0x3f6df8){return{'model':db[_0x3f6df8['model']],'as':_0x3f6df8['as'],'attributes':_0x3f6df8['attributes'],'include':_0x3f6df8[_0xa115('0x21')]?_[_0xa115('0x22')](_0x3f6df8[_0xa115('0x21')],function(_0xb21d53){return{'model':db[_0xb21d53[_0xa115('0x23')]],'as':_0xb21d53['as'],'attributes':_0xb21d53[_0xa115('0x24')]};}):[]};}):[]};}):[]:[]})[_0xa115('0xf')](function(_0x78f2e5){logger[_0xa115('0x18')](_0xa115('0x25'),_0x929817);logger['debug'](_0xa115('0x25'),_0x929817,JSON[_0xa115('0x14')](_0x78f2e5));_0x4f6092(_0x78f2e5);})[_0xa115('0x1a')](function(_0x264fd1){logger[_0xa115('0x15')](_0xa115('0x25'),_0x264fd1['message'],_0x929817);_0x812860(_0x3c63a7[_0xa115('0x15')](0x1f4,_0x264fd1[_0xa115('0x17')]));});});}; \ No newline at end of file +var _0xd173=['rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./faxQueue.socket','request','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFaxQueue','findAll','options','raw','where','attributes','include','model','map','then','ShowFaxQueue','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x25b4a4,_0x2e081b){var _0x707267=function(_0x440123){while(--_0x440123){_0x25b4a4['push'](_0x25b4a4['shift']());}};_0x707267(++_0x2e081b);}(_0xd173,0x1c1));var _0x3d17=function(_0x1a5258,_0x230212){_0x1a5258=_0x1a5258-0x0;var _0x569b04=_0xd173[_0x1a5258];return _0x569b04;};'use strict';var _=require(_0x3d17('0x0'));var util=require(_0x3d17('0x1'));var moment=require(_0x3d17('0x2'));var BPromise=require('bluebird');var rs=require(_0x3d17('0x3'));var fs=require('fs');var Redis=require(_0x3d17('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d17('0x5'));var logger=require(_0x3d17('0x6'))(_0x3d17('0x7'));var config=require(_0x3d17('0x8'));var jayson=require(_0x3d17('0x9'));var client=jayson[_0x3d17('0xa')]['http']({'port':0x232a});config[_0x3d17('0xb')]=_[_0x3d17('0xc')](config[_0x3d17('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d17('0xd'))(new Redis(config[_0x3d17('0xb')]));require(_0x3d17('0xe'))['register'](socket);function respondWithRpcPromise(_0x27d4fe,_0x46fa0c,_0x314c42){return new BPromise(function(_0x5f3407,_0x3eabca){return client[_0x3d17('0xf')](_0x27d4fe,_0x314c42)['then'](function(_0x434d8c){logger['info'](_0x3d17('0x10'),_0x46fa0c,_0x3d17('0x11'));logger[_0x3d17('0x12')](_0x3d17('0x13'),_0x46fa0c,_0x3d17('0x11'),JSON[_0x3d17('0x14')](_0x434d8c));if(_0x434d8c['error']){if(_0x434d8c[_0x3d17('0x15')][_0x3d17('0x16')]===0x1f4){logger['error'](_0x3d17('0x10'),_0x46fa0c,_0x434d8c['error'][_0x3d17('0x17')]);return _0x3eabca(_0x434d8c[_0x3d17('0x15')]['message']);}logger[_0x3d17('0x15')](_0x3d17('0x10'),_0x46fa0c,_0x434d8c[_0x3d17('0x15')][_0x3d17('0x17')]);return _0x5f3407(_0x434d8c[_0x3d17('0x15')]['message']);}else{logger[_0x3d17('0x18')](_0x3d17('0x10'),_0x46fa0c,_0x3d17('0x11'));_0x5f3407(_0x434d8c[_0x3d17('0x19')][_0x3d17('0x17')]);}})[_0x3d17('0x1a')](function(_0x120bd9){logger[_0x3d17('0x15')](_0x3d17('0x10'),_0x46fa0c,_0x120bd9);_0x3eabca(_0x120bd9);});});}exports[_0x3d17('0x1b')]=function(_0x29f789){var _0x251e79=this;return new Promise(function(_0x3737ef,_0x48a3e5){return db['FaxQueue'][_0x3d17('0x1c')]({'raw':_0x29f789[_0x3d17('0x1d')]?_0x29f789['options'][_0x3d17('0x1e')]===undefined?!![]:![]:!![],'where':_0x29f789[_0x3d17('0x1d')]?_0x29f789[_0x3d17('0x1d')][_0x3d17('0x1f')]||null:null,'attributes':_0x29f789[_0x3d17('0x1d')]?_0x29f789[_0x3d17('0x1d')][_0x3d17('0x20')]||null:null,'limit':_0x29f789[_0x3d17('0x1d')]?_0x29f789[_0x3d17('0x1d')]['limit']||null:null,'include':_0x29f789['options']?_0x29f789[_0x3d17('0x1d')][_0x3d17('0x21')]?_['map'](_0x29f789[_0x3d17('0x1d')][_0x3d17('0x21')],function(_0x3a49d9){return{'model':db[_0x3a49d9[_0x3d17('0x22')]],'as':_0x3a49d9['as'],'attributes':_0x3a49d9[_0x3d17('0x20')],'include':_0x3a49d9[_0x3d17('0x21')]?_[_0x3d17('0x23')](_0x3a49d9[_0x3d17('0x21')],function(_0x9886ac){return{'model':db[_0x9886ac['model']],'as':_0x9886ac['as'],'attributes':_0x9886ac[_0x3d17('0x20')],'include':_0x9886ac['include']?_[_0x3d17('0x23')](_0x9886ac[_0x3d17('0x21')],function(_0xa17d77){return{'model':db[_0xa17d77[_0x3d17('0x22')]],'as':_0xa17d77['as'],'attributes':_0xa17d77[_0x3d17('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3d17('0x24')](function(_0x34d83c){logger[_0x3d17('0x18')](_0x3d17('0x1b'),_0x29f789);logger[_0x3d17('0x12')](_0x3d17('0x1b'),_0x29f789,JSON[_0x3d17('0x14')](_0x34d83c));_0x3737ef(_0x34d83c);})['catch'](function(_0x36b333){logger[_0x3d17('0x15')](_0x3d17('0x1b'),_0x36b333['message'],_0x29f789);_0x48a3e5(_0x251e79[_0x3d17('0x15')](0x1f4,_0x36b333[_0x3d17('0x17')]));});});};exports[_0x3d17('0x25')]=function(_0xfa7b42){var _0x40a14e=this;return new Promise(function(_0x3bdc1e,_0x39f47e){return db['FaxQueue']['find']({'raw':_0xfa7b42[_0x3d17('0x1d')]?_0xfa7b42[_0x3d17('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0xfa7b42[_0x3d17('0x1d')]?_0xfa7b42[_0x3d17('0x1d')][_0x3d17('0x1f')]||null:null,'attributes':_0xfa7b42[_0x3d17('0x1d')]?_0xfa7b42[_0x3d17('0x1d')]['attributes']||null:null,'include':_0xfa7b42['options']?_0xfa7b42['options'][_0x3d17('0x21')]?_[_0x3d17('0x23')](_0xfa7b42[_0x3d17('0x1d')][_0x3d17('0x21')],function(_0x401849){return{'model':db[_0x401849[_0x3d17('0x22')]],'as':_0x401849['as'],'attributes':_0x401849[_0x3d17('0x20')],'include':_0x401849['include']?_[_0x3d17('0x23')](_0x401849['include'],function(_0x294a0b){return{'model':db[_0x294a0b[_0x3d17('0x22')]],'as':_0x294a0b['as'],'attributes':_0x294a0b['attributes'],'include':_0x294a0b['include']?_['map'](_0x294a0b['include'],function(_0x4c2d68){return{'model':db[_0x4c2d68['model']],'as':_0x4c2d68['as'],'attributes':_0x4c2d68[_0x3d17('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3d17('0x24')](function(_0x389135){logger['info'](_0x3d17('0x25'),_0xfa7b42);logger[_0x3d17('0x12')](_0x3d17('0x25'),_0xfa7b42,JSON[_0x3d17('0x14')](_0x389135));_0x3bdc1e(_0x389135);})['catch'](function(_0x39320a){logger[_0x3d17('0x15')](_0x3d17('0x25'),_0x39320a[_0x3d17('0x17')],_0xfa7b42);_0x39f47e(_0x40a14e[_0x3d17('0x15')](0x1f4,_0x39320a[_0x3d17('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 1b0e494..e7c3ae9 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 _0xee14=['faxQueue:','./faxQueue.events','remove','update','emit','removeListener','length'];(function(_0x321ccf,_0x2e780d){var _0x3a9a2a=function(_0x3291c2){while(--_0x3291c2){_0x321ccf['push'](_0x321ccf['shift']());}};_0x3a9a2a(++_0x2e780d);}(_0xee14,0x166));var _0x4ee1=function(_0x286c69,_0x323945){_0x286c69=_0x286c69-0x0;var _0x3924d1=_0xee14[_0x286c69];return _0x3924d1;};'use strict';var FaxQueueEvents=require(_0x4ee1('0x0'));var events=['save',_0x4ee1('0x1'),_0x4ee1('0x2')];function createListener(_0x40519a,_0xf072b3){return function(_0x5957b3){_0xf072b3[_0x4ee1('0x3')](_0x40519a,_0x5957b3);};}function removeListener(_0x267683,_0x127b3f){return function(){FaxQueueEvents[_0x4ee1('0x4')](_0x267683,_0x127b3f);};}exports['register']=function(_0x5961f3){for(var _0x37fbb3=0x0,_0x17312a=events[_0x4ee1('0x5')];_0x37fbb3<_0x17312a;_0x37fbb3++){var _0x43b89e=events[_0x37fbb3];var _0x3f970e=createListener(_0x4ee1('0x6')+_0x43b89e,_0x5961f3);FaxQueueEvents['on'](_0x43b89e,_0x3f970e);}}; \ No newline at end of file +var _0x850a=['register','length','faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener'];(function(_0x1da8e4,_0x131e9a){var _0x183067=function(_0x4bdd76){while(--_0x4bdd76){_0x1da8e4['push'](_0x1da8e4['shift']());}};_0x183067(++_0x131e9a);}(_0x850a,0x123));var _0xa850=function(_0x40b66c,_0x578758){_0x40b66c=_0x40b66c-0x0;var _0x2fd22b=_0x850a[_0x40b66c];return _0x2fd22b;};'use strict';var FaxQueueEvents=require(_0xa850('0x0'));var events=[_0xa850('0x1'),_0xa850('0x2'),_0xa850('0x3')];function createListener(_0x3ca3c8,_0x484ae1){return function(_0x157c5a){_0x484ae1[_0xa850('0x4')](_0x3ca3c8,_0x157c5a);};}function removeListener(_0x12b7d5,_0x16489b){return function(){FaxQueueEvents[_0xa850('0x5')](_0x12b7d5,_0x16489b);};}exports[_0xa850('0x6')]=function(_0x5501ab){for(var _0x48a0a8=0x0,_0x44d16d=events[_0xa850('0x7')];_0x48a0a8<_0x44d16d;_0x48a0a8++){var _0x2db9a5=events[_0x48a0a8];var _0x3a7248=createListener(_0xa850('0x8')+_0x2db9a5,_0x5501ab);FaxQueueEvents['on'](_0x2db9a5,_0x3a7248);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 6b703f7..32c4943 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 _0xdfa0=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xdfa0,0x69));var _0x0dfa=function(_0x30d402,_0x216e81){_0x30d402=_0x30d402-0x0;var _0x213b9f=_0xdfa0[_0x30d402];return _0x213b9f;};'use strict';var multer=require(_0x0dfa('0x0'));var util=require('util');var path=require(_0x0dfa('0x1'));var timeout=require(_0x0dfa('0x2'));var express=require('express');var router=express[_0x0dfa('0x3')]();var fs_extra=require(_0x0dfa('0x4'));var auth=require(_0x0dfa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0dfa('0x6'));var controller=require('./faxQueue.controller');router[_0x0dfa('0x7')]('/',auth[_0x0dfa('0x8')](),controller['index']);router[_0x0dfa('0x7')](_0x0dfa('0x9'),auth[_0x0dfa('0x8')](),controller[_0x0dfa('0xa')]);router[_0x0dfa('0x7')]('/:id',auth[_0x0dfa('0x8')](),controller[_0x0dfa('0xb')]);router[_0x0dfa('0x7')]('/:id/members',auth[_0x0dfa('0x8')](),controller['getMembers']);router[_0x0dfa('0x7')](_0x0dfa('0xc'),auth[_0x0dfa('0x8')](),controller['getTeams']);router[_0x0dfa('0x7')](_0x0dfa('0xd'),auth['isAuthenticated'](),controller[_0x0dfa('0xe')]);router[_0x0dfa('0xf')]('/',auth['isAuthenticated'](),controller[_0x0dfa('0x10')]);router[_0x0dfa('0xf')](_0x0dfa('0xc'),auth[_0x0dfa('0x8')](),controller[_0x0dfa('0x11')]);router[_0x0dfa('0xf')]('/:id/users',auth[_0x0dfa('0x8')](),controller[_0x0dfa('0x12')]);router[_0x0dfa('0x13')](_0x0dfa('0x14'),auth[_0x0dfa('0x8')](),controller[_0x0dfa('0x15')]);router[_0x0dfa('0x16')](_0x0dfa('0x14'),auth[_0x0dfa('0x8')](),controller[_0x0dfa('0x17')]);router[_0x0dfa('0x16')](_0x0dfa('0xc'),auth[_0x0dfa('0x8')](),controller[_0x0dfa('0x18')]);router[_0x0dfa('0x16')]('/:id/users',auth[_0x0dfa('0x8')](),controller[_0x0dfa('0x19')]);module[_0x0dfa('0x1a')]=router; \ No newline at end of file +var _0x326f=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','/:id','update','delete','removeTeams','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','show','/:id/members'];(function(_0x593fe1,_0x10194c){var _0x4afafc=function(_0x22d41e){while(--_0x22d41e){_0x593fe1['push'](_0x593fe1['shift']());}};_0x4afafc(++_0x10194c);}(_0x326f,0xd1));var _0xf326=function(_0x2b250b,_0x46f04c){_0x2b250b=_0x2b250b-0x0;var _0x597ef9=_0x326f[_0x2b250b];return _0x597ef9;};'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',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0x9')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router['get'](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['get'](_0xf326('0x12'),auth['isAuthenticated'](),controller[_0xf326('0x13')]);router[_0xf326('0x14')]('/',auth['isAuthenticated'](),controller[_0xf326('0x15')]);router[_0xf326('0x14')](_0xf326('0x10'),auth[_0xf326('0xa')](),controller['addTeams']);router[_0xf326('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x16')]);router[_0xf326('0x17')](_0xf326('0x18'),auth[_0xf326('0xa')](),controller[_0xf326('0x19')]);router[_0xf326('0x1a')](_0xf326('0x18'),auth[_0xf326('0xa')](),controller['destroy']);router[_0xf326('0x1a')](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x1b')]);router[_0xf326('0x1a')](_0xf326('0x12'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index ab7bc56..743d5ec 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 _0x3ee6=['STRING','DATE','moment','exports'];(function(_0x485ac6,_0xb5a4c5){var _0x5a26dc=function(_0x219ad4){while(--_0x219ad4){_0x485ac6['push'](_0x485ac6['shift']());}};_0x5a26dc(++_0xb5a4c5);}(_0x3ee6,0xa6));var _0x63ee=function(_0x21710d,_0x3f1365){_0x21710d=_0x21710d-0x0;var _0x10aefd=_0x3ee6[_0x21710d];return _0x10aefd;};'use strict';var moment=require(_0x63ee('0x0'));var Sequelize=require('sequelize');module[_0x63ee('0x1')]={'uniqueid':{'type':Sequelize[_0x63ee('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x63ee('0x3')]},'leaveAt':{'type':Sequelize[_0x63ee('0x3')]},'acceptAt':{'type':Sequelize[_0x63ee('0x3')]},'exitAt':{'type':Sequelize[_0x63ee('0x3')]},'reason':{'type':Sequelize[_0x63ee('0x2')]}}; \ No newline at end of file +var _0x20c4=['moment','sequelize','STRING','DATE'];(function(_0x4a9a3c,_0x313980){var _0x3a4f9e=function(_0x25d028){while(--_0x25d028){_0x4a9a3c['push'](_0x4a9a3c['shift']());}};_0x3a4f9e(++_0x313980);}(_0x20c4,0x88));var _0x420c=function(_0x31d642,_0x469480){_0x31d642=_0x31d642-0x0;var _0x483012=_0x20c4[_0x31d642];return _0x483012;};'use strict';var moment=require(_0x420c('0x0'));var Sequelize=require(_0x420c('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x420c('0x2')]},'joinAt':{'type':Sequelize[_0x420c('0x3')]},'leaveAt':{'type':Sequelize[_0x420c('0x3')]},'acceptAt':{'type':Sequelize[_0x420c('0x3')]},'exitAt':{'type':Sequelize[_0x420c('0x3')]},'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 5c18a19..16bcee4 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 _0xd84c=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','name','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','findAll','catch','show','params','includeAll','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xd84c,0x102));var _0xcd84=function(_0x143070,_0x51480a){_0x143070=_0x143070-0x0;var _0x52dd43=_0xd84c[_0x143070];return _0x52dd43;};'use strict';var emlformat=require(_0xcd84('0x0'));var rimraf=require(_0xcd84('0x1'));var zipdir=require(_0xcd84('0x2'));var jsonpatch=require(_0xcd84('0x3'));var rp=require(_0xcd84('0x4'));var moment=require(_0xcd84('0x5'));var BPromise=require(_0xcd84('0x6'));var Mustache=require(_0xcd84('0x7'));var util=require(_0xcd84('0x8'));var path=require('path');var sox=require(_0xcd84('0x9'));var csv=require(_0xcd84('0xa'));var ejs=require(_0xcd84('0xb'));var fs=require('fs');var fs_extra=require(_0xcd84('0xc'));var _=require('lodash');var squel=require(_0xcd84('0xd'));var crypto=require(_0xcd84('0xe'));var jsforce=require(_0xcd84('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xcd84('0xa'));var querystring=require(_0xcd84('0x10'));var Papa=require(_0xcd84('0x11'));var Redis=require(_0xcd84('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xcd84('0x13'));var as=require(_0xcd84('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd84('0x15'))(_0xcd84('0x16'));var utils=require(_0xcd84('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xcd84('0x18'));var db=require(_0xcd84('0x19'))['db'];function respondWithStatusCode(_0x6fcec,_0x116423){_0x116423=_0x116423||0xcc;return function(_0x4e1291){if(_0x4e1291){return _0x6fcec[_0xcd84('0x1a')](_0x116423);}return _0x6fcec[_0xcd84('0x1b')](_0x116423)[_0xcd84('0x1c')]();};}function respondWithResult(_0x3ccf60,_0x1271b4){_0x1271b4=_0x1271b4||0xc8;return function(_0x100a7b){if(_0x100a7b){return _0x3ccf60[_0xcd84('0x1b')](_0x1271b4)[_0xcd84('0x1d')](_0x100a7b);}};}function respondWithFilteredResult(_0xcc47a6,_0x45a92e){return function(_0x223127){if(_0x223127){var _0x23b116=typeof _0x45a92e[_0xcd84('0x1e')]===_0xcd84('0x1f')&&typeof _0x45a92e[_0xcd84('0x20')]===_0xcd84('0x1f');var _0x30d51c=_0x223127[_0xcd84('0x21')];var _0x4ff790=_0x23b116?0x0:_0x45a92e[_0xcd84('0x1e')];var _0x15099f=_0x23b116?_0x223127['count']:_0x45a92e[_0xcd84('0x1e')]+_0x45a92e[_0xcd84('0x20')];var _0x1ba160;if(_0x15099f>=_0x30d51c){_0x15099f=_0x30d51c;_0x1ba160=0xc8;}else{_0x1ba160=0xce;}_0xcc47a6[_0xcd84('0x1b')](_0x1ba160);return _0xcc47a6[_0xcd84('0x22')]('Content-Range',_0x4ff790+'-'+_0x15099f+'/'+_0x30d51c)[_0xcd84('0x1d')](_0x223127);}return null;};}function patchUpdates(_0x171813){return function(_0x225e15){try{jsonpatch['apply'](_0x225e15,_0x171813,!![]);}catch(_0x48a90e){return BPromise[_0xcd84('0x23')](_0x48a90e);}return _0x225e15['save']();};}function saveUpdates(_0x3a6f30,_0x20b0ce){return function(_0x5cb006){if(_0x5cb006){return _0x5cb006[_0xcd84('0x24')](_0x3a6f30)[_0xcd84('0x25')](function(_0x16b6ea){return _0x16b6ea;});}return null;};}function removeEntity(_0x13996e,_0x14cf35){return function(_0xfc2a17){if(_0xfc2a17){return _0xfc2a17['destroy']()[_0xcd84('0x25')](function(){_0x13996e[_0xcd84('0x1b')](0xcc)[_0xcd84('0x1c')]();});}};}function handleEntityNotFound(_0xbc0595,_0x243368){return function(_0x40d00a){if(!_0x40d00a){_0xbc0595[_0xcd84('0x1a')](0x194);}return _0x40d00a;};}function handleError(_0x5109b9,_0x5d610b){_0x5d610b=_0x5d610b||0x1f4;return function(_0x1967f6){logger['error'](_0x1967f6['stack']);if(_0x1967f6['name']){delete _0x1967f6[_0xcd84('0x26')];}_0x5109b9[_0xcd84('0x1b')](_0x5d610b)['send'](_0x1967f6);};}exports[_0xcd84('0x27')]=function(_0x3691a6,_0x1f75ac){var _0x5661a4={},_0x33fc4f={},_0x5d4bff={'count':0x0,'rows':[]};var _0x288cdd=_[_0xcd84('0x28')](db[_0xcd84('0x29')][_0xcd84('0x2a')],function(_0x42e649){return{'name':_0x42e649[_0xcd84('0x2b')],'type':_0x42e649[_0xcd84('0x2c')][_0xcd84('0x2d')]};});_0x33fc4f[_0xcd84('0x2e')]=_[_0xcd84('0x28')](_0x288cdd,_0xcd84('0x26'));_0x33fc4f[_0xcd84('0x2f')]=_['keys'](_0x3691a6[_0xcd84('0x2f')]);_0x33fc4f[_0xcd84('0x30')]=_[_0xcd84('0x31')](_0x33fc4f[_0xcd84('0x2e')],_0x33fc4f['query']);_0x5661a4[_0xcd84('0x32')]=_[_0xcd84('0x31')](_0x33fc4f[_0xcd84('0x2e')],qs[_0xcd84('0x33')](_0x3691a6[_0xcd84('0x2f')]['fields']));_0x5661a4[_0xcd84('0x32')]=_0x5661a4[_0xcd84('0x32')][_0xcd84('0x34')]?_0x5661a4[_0xcd84('0x32')]:_0x33fc4f[_0xcd84('0x2e')];if(!_0x3691a6[_0xcd84('0x2f')][_0xcd84('0x35')]('nolimit')){_0x5661a4[_0xcd84('0x20')]=qs[_0xcd84('0x20')](_0x3691a6['query'][_0xcd84('0x20')]);_0x5661a4['offset']=qs[_0xcd84('0x1e')](_0x3691a6[_0xcd84('0x2f')][_0xcd84('0x1e')]);}_0x5661a4[_0xcd84('0x36')]=qs[_0xcd84('0x37')](_0x3691a6[_0xcd84('0x2f')][_0xcd84('0x37')]);_0x5661a4[_0xcd84('0x38')]=qs[_0xcd84('0x30')](_[_0xcd84('0x39')](_0x3691a6[_0xcd84('0x2f')],_0x33fc4f[_0xcd84('0x30')]),_0x288cdd);if(_0x3691a6[_0xcd84('0x2f')][_0xcd84('0x3a')]){_0x5661a4[_0xcd84('0x38')]=_['merge'](_0x5661a4[_0xcd84('0x38')],{'$or':_['map'](_0x288cdd,function(_0x47f1c1){if(_0x47f1c1[_0xcd84('0x2c')]!==_0xcd84('0x3b')){var _0x1a8bbb={};_0x1a8bbb[_0x47f1c1[_0xcd84('0x26')]]={'$like':'%'+_0x3691a6['query']['filter']+'%'};return _0x1a8bbb;}})});}_0x5661a4=_[_0xcd84('0x3c')]({},_0x5661a4,_0x3691a6['options']);var _0x36628f={'where':_0x5661a4[_0xcd84('0x38')]};return db['FaxQueueReport'][_0xcd84('0x21')](_0x36628f)['then'](function(_0x34a6ee){_0x5d4bff[_0xcd84('0x21')]=_0x34a6ee;if(_0x3691a6[_0xcd84('0x2f')]['includeAll']){_0x5661a4['include']=[{'all':!![]}];}return db[_0xcd84('0x29')][_0xcd84('0x3d')](_0x5661a4);})[_0xcd84('0x25')](function(_0x449024){_0x5d4bff['rows']=_0x449024;return _0x5d4bff;})[_0xcd84('0x25')](respondWithFilteredResult(_0x1f75ac,_0x5661a4))[_0xcd84('0x3e')](handleError(_0x1f75ac,null));};exports[_0xcd84('0x3f')]=function(_0x1f8bdd,_0x3fc17d){var _0x1254cd={'raw':!![],'where':{'id':_0x1f8bdd[_0xcd84('0x40')]['id']}},_0x38d17d={};_0x38d17d[_0xcd84('0x2e')]=_['keys'](db[_0xcd84('0x29')]['rawAttributes']);_0x38d17d[_0xcd84('0x2f')]=_['keys'](_0x1f8bdd[_0xcd84('0x2f')]);_0x38d17d[_0xcd84('0x30')]=_['intersection'](_0x38d17d['model'],_0x38d17d[_0xcd84('0x2f')]);_0x1254cd[_0xcd84('0x32')]=_[_0xcd84('0x31')](_0x38d17d['model'],qs['fields'](_0x1f8bdd[_0xcd84('0x2f')]['fields']));_0x1254cd[_0xcd84('0x32')]=_0x1254cd[_0xcd84('0x32')]['length']?_0x1254cd[_0xcd84('0x32')]:_0x38d17d[_0xcd84('0x2e')];if(_0x1f8bdd['query'][_0xcd84('0x41')]){_0x1254cd[_0xcd84('0x42')]=[{'all':!![]}];}_0x1254cd=_[_0xcd84('0x3c')]({},_0x1254cd,_0x1f8bdd['options']);return db['FaxQueueReport']['find'](_0x1254cd)[_0xcd84('0x25')](handleEntityNotFound(_0x3fc17d,null))[_0xcd84('0x25')](respondWithResult(_0x3fc17d,null))[_0xcd84('0x3e')](handleError(_0x3fc17d,null));};exports[_0xcd84('0x43')]=function(_0x110019,_0x5d44ff){return db['FaxQueueReport'][_0xcd84('0x43')](_0x110019[_0xcd84('0x44')],{})['then'](respondWithResult(_0x5d44ff,0xc9))['catch'](handleError(_0x5d44ff,null));};exports[_0xcd84('0x24')]=function(_0x279af5,_0x1b3ee1){if(_0x279af5[_0xcd84('0x44')]['id']){delete _0x279af5[_0xcd84('0x44')]['id'];}return db[_0xcd84('0x29')][_0xcd84('0x45')]({'where':{'id':_0x279af5[_0xcd84('0x40')]['id']}})[_0xcd84('0x25')](handleEntityNotFound(_0x1b3ee1,null))[_0xcd84('0x25')](saveUpdates(_0x279af5[_0xcd84('0x44')],null))['then'](respondWithResult(_0x1b3ee1,null))[_0xcd84('0x3e')](handleError(_0x1b3ee1,null));};exports['destroy']=function(_0x20f25d,_0x4c50df){return db[_0xcd84('0x29')]['find']({'where':{'id':_0x20f25d[_0xcd84('0x40')]['id']}})['then'](handleEntityNotFound(_0x4c50df,null))[_0xcd84('0x25')](removeEntity(_0x4c50df,null))[_0xcd84('0x3e')](handleError(_0x4c50df,null));};exports['describe']=function(_0x794d0e,_0x268fe5){return db[_0xcd84('0x29')]['describe']()['then'](respondWithResult(_0x268fe5,null))[_0xcd84('0x3e')](handleError(_0x268fe5,null));}; \ No newline at end of file +var _0x80c7=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','type','key','model','query','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','keys','fields','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x28274f,_0x137812){var _0x32e54d=function(_0x174541){while(--_0x174541){_0x28274f['push'](_0x28274f['shift']());}};_0x32e54d(++_0x137812);}(_0x80c7,0x8d));var _0x780c=function(_0x34e447,_0x5305f8){_0x34e447=_0x34e447-0x0;var _0x230108=_0x80c7[_0x34e447];return _0x230108;};'use strict';var emlformat=require(_0x780c('0x0'));var rimraf=require(_0x780c('0x1'));var zipdir=require(_0x780c('0x2'));var jsonpatch=require(_0x780c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x780c('0x4'));var Mustache=require('mustache');var util=require(_0x780c('0x5'));var path=require(_0x780c('0x6'));var sox=require(_0x780c('0x7'));var csv=require(_0x780c('0x8'));var ejs=require(_0x780c('0x9'));var fs=require('fs');var fs_extra=require(_0x780c('0xa'));var _=require(_0x780c('0xb'));var squel=require(_0x780c('0xc'));var crypto=require(_0x780c('0xd'));var jsforce=require(_0x780c('0xe'));var deskjs=require(_0x780c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x780c('0x10'));var Papa=require(_0x780c('0x11'));var Redis=require('ioredis');var authService=require(_0x780c('0x12'));var qs=require(_0x780c('0x13'));var as=require(_0x780c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x780c('0x15'))(_0x780c('0x16'));var utils=require(_0x780c('0x17'));var config=require(_0x780c('0x18'));var licenseUtil=require(_0x780c('0x19'));var db=require(_0x780c('0x1a'))['db'];function respondWithStatusCode(_0x2b09af,_0x5a5986){_0x5a5986=_0x5a5986||0xcc;return function(_0x3aaa99){if(_0x3aaa99){return _0x2b09af[_0x780c('0x1b')](_0x5a5986);}return _0x2b09af[_0x780c('0x1c')](_0x5a5986)[_0x780c('0x1d')]();};}function respondWithResult(_0x5576e9,_0x4ea5df){_0x4ea5df=_0x4ea5df||0xc8;return function(_0x244934){if(_0x244934){return _0x5576e9[_0x780c('0x1c')](_0x4ea5df)['json'](_0x244934);}};}function respondWithFilteredResult(_0x5b74fb,_0x2c8c23){return function(_0xccd8c){if(_0xccd8c){var _0x21b69b=typeof _0x2c8c23[_0x780c('0x1e')]===_0x780c('0x1f')&&typeof _0x2c8c23[_0x780c('0x20')]==='undefined';var _0x45258b=_0xccd8c[_0x780c('0x21')];var _0x2127e2=_0x21b69b?0x0:_0x2c8c23[_0x780c('0x1e')];var _0x48e6fe=_0x21b69b?_0xccd8c[_0x780c('0x21')]:_0x2c8c23[_0x780c('0x1e')]+_0x2c8c23[_0x780c('0x20')];var _0x3d5269;if(_0x48e6fe>=_0x45258b){_0x48e6fe=_0x45258b;_0x3d5269=0xc8;}else{_0x3d5269=0xce;}_0x5b74fb['status'](_0x3d5269);return _0x5b74fb[_0x780c('0x22')](_0x780c('0x23'),_0x2127e2+'-'+_0x48e6fe+'/'+_0x45258b)['json'](_0xccd8c);}return null;};}function patchUpdates(_0x4f665d){return function(_0x5cccd3){try{jsonpatch[_0x780c('0x24')](_0x5cccd3,_0x4f665d,!![]);}catch(_0xe4e284){return BPromise[_0x780c('0x25')](_0xe4e284);}return _0x5cccd3[_0x780c('0x26')]();};}function saveUpdates(_0x444905,_0x21e720){return function(_0x2c66c5){if(_0x2c66c5){return _0x2c66c5[_0x780c('0x27')](_0x444905)[_0x780c('0x28')](function(_0x21b68a){return _0x21b68a;});}return null;};}function removeEntity(_0x1d0c8a,_0x55fc81){return function(_0x226f7b){if(_0x226f7b){return _0x226f7b[_0x780c('0x29')]()[_0x780c('0x28')](function(){_0x1d0c8a['status'](0xcc)[_0x780c('0x1d')]();});}};}function handleEntityNotFound(_0x121199,_0x38810b){return function(_0x27e326){if(!_0x27e326){_0x121199[_0x780c('0x1b')](0x194);}return _0x27e326;};}function handleError(_0x41a58b,_0x5d675c){_0x5d675c=_0x5d675c||0x1f4;return function(_0x1cb65e){logger[_0x780c('0x2a')](_0x1cb65e[_0x780c('0x2b')]);if(_0x1cb65e['name']){delete _0x1cb65e[_0x780c('0x2c')];}_0x41a58b[_0x780c('0x1c')](_0x5d675c)[_0x780c('0x2d')](_0x1cb65e);};}exports[_0x780c('0x2e')]=function(_0x26708b,_0x1819bf){var _0x37d6c8={},_0x35b97a={},_0x2a19b1={'count':0x0,'rows':[]};var _0x21f84e=_[_0x780c('0x2f')](db[_0x780c('0x30')][_0x780c('0x31')],function(_0x1216b4){return{'name':_0x1216b4['fieldName'],'type':_0x1216b4[_0x780c('0x32')][_0x780c('0x33')]};});_0x35b97a[_0x780c('0x34')]=_[_0x780c('0x2f')](_0x21f84e,_0x780c('0x2c'));_0x35b97a[_0x780c('0x35')]=_['keys'](_0x26708b[_0x780c('0x35')]);_0x35b97a[_0x780c('0x36')]=_[_0x780c('0x37')](_0x35b97a[_0x780c('0x34')],_0x35b97a['query']);_0x37d6c8['attributes']=_[_0x780c('0x37')](_0x35b97a[_0x780c('0x34')],qs['fields'](_0x26708b['query']['fields']));_0x37d6c8[_0x780c('0x38')]=_0x37d6c8[_0x780c('0x38')][_0x780c('0x39')]?_0x37d6c8['attributes']:_0x35b97a[_0x780c('0x34')];if(!_0x26708b['query']['hasOwnProperty'](_0x780c('0x3a'))){_0x37d6c8[_0x780c('0x20')]=qs[_0x780c('0x20')](_0x26708b[_0x780c('0x35')][_0x780c('0x20')]);_0x37d6c8[_0x780c('0x1e')]=qs['offset'](_0x26708b[_0x780c('0x35')][_0x780c('0x1e')]);}_0x37d6c8['order']=qs['sort'](_0x26708b[_0x780c('0x35')][_0x780c('0x3b')]);_0x37d6c8[_0x780c('0x3c')]=qs[_0x780c('0x36')](_[_0x780c('0x3d')](_0x26708b[_0x780c('0x35')],_0x35b97a[_0x780c('0x36')]),_0x21f84e);if(_0x26708b[_0x780c('0x35')][_0x780c('0x3e')]){_0x37d6c8[_0x780c('0x3c')]=_['merge'](_0x37d6c8[_0x780c('0x3c')],{'$or':_[_0x780c('0x2f')](_0x21f84e,function(_0x4c16b1){if(_0x4c16b1[_0x780c('0x32')]!==_0x780c('0x3f')){var _0x55ab16={};_0x55ab16[_0x4c16b1[_0x780c('0x2c')]]={'$like':'%'+_0x26708b['query'][_0x780c('0x3e')]+'%'};return _0x55ab16;}})});}_0x37d6c8=_[_0x780c('0x40')]({},_0x37d6c8,_0x26708b[_0x780c('0x41')]);var _0x5b2dfb={'where':_0x37d6c8['where']};return db[_0x780c('0x30')][_0x780c('0x21')](_0x5b2dfb)[_0x780c('0x28')](function(_0x71748b){_0x2a19b1[_0x780c('0x21')]=_0x71748b;if(_0x26708b[_0x780c('0x35')][_0x780c('0x42')]){_0x37d6c8[_0x780c('0x43')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x780c('0x44')](_0x37d6c8);})[_0x780c('0x28')](function(_0x5db660){_0x2a19b1[_0x780c('0x45')]=_0x5db660;return _0x2a19b1;})[_0x780c('0x28')](respondWithFilteredResult(_0x1819bf,_0x37d6c8))[_0x780c('0x46')](handleError(_0x1819bf,null));};exports['show']=function(_0x23cba0,_0x14a5d9){var _0x37d547={'raw':!![],'where':{'id':_0x23cba0['params']['id']}},_0x4be864={};_0x4be864[_0x780c('0x34')]=_[_0x780c('0x47')](db[_0x780c('0x30')][_0x780c('0x31')]);_0x4be864[_0x780c('0x35')]=_[_0x780c('0x47')](_0x23cba0[_0x780c('0x35')]);_0x4be864['filters']=_['intersection'](_0x4be864[_0x780c('0x34')],_0x4be864[_0x780c('0x35')]);_0x37d547[_0x780c('0x38')]=_[_0x780c('0x37')](_0x4be864[_0x780c('0x34')],qs[_0x780c('0x48')](_0x23cba0[_0x780c('0x35')][_0x780c('0x48')]));_0x37d547['attributes']=_0x37d547[_0x780c('0x38')][_0x780c('0x39')]?_0x37d547[_0x780c('0x38')]:_0x4be864['model'];if(_0x23cba0['query'][_0x780c('0x42')]){_0x37d547[_0x780c('0x43')]=[{'all':!![]}];}_0x37d547=_[_0x780c('0x40')]({},_0x37d547,_0x23cba0[_0x780c('0x41')]);return db[_0x780c('0x30')]['find'](_0x37d547)[_0x780c('0x28')](handleEntityNotFound(_0x14a5d9,null))[_0x780c('0x28')](respondWithResult(_0x14a5d9,null))['catch'](handleError(_0x14a5d9,null));};exports['create']=function(_0x412f72,_0x59be69){return db['FaxQueueReport']['create'](_0x412f72[_0x780c('0x49')],{})['then'](respondWithResult(_0x59be69,0xc9))[_0x780c('0x46')](handleError(_0x59be69,null));};exports['update']=function(_0x2deec6,_0x4eda4f){if(_0x2deec6[_0x780c('0x49')]['id']){delete _0x2deec6[_0x780c('0x49')]['id'];}return db[_0x780c('0x30')][_0x780c('0x4a')]({'where':{'id':_0x2deec6[_0x780c('0x4b')]['id']}})[_0x780c('0x28')](handleEntityNotFound(_0x4eda4f,null))[_0x780c('0x28')](saveUpdates(_0x2deec6[_0x780c('0x49')],null))['then'](respondWithResult(_0x4eda4f,null))[_0x780c('0x46')](handleError(_0x4eda4f,null));};exports[_0x780c('0x29')]=function(_0x3bae2d,_0x4e780e){return db[_0x780c('0x30')][_0x780c('0x4a')]({'where':{'id':_0x3bae2d['params']['id']}})[_0x780c('0x28')](handleEntityNotFound(_0x4e780e,null))[_0x780c('0x28')](removeEntity(_0x4e780e,null))[_0x780c('0x46')](handleError(_0x4e780e,null));};exports['describe']=function(_0x43f08b,_0x539358){return db[_0x780c('0x30')][_0x780c('0x4c')]()[_0x780c('0x28')](respondWithResult(_0x539358,null))['catch'](handleError(_0x539358,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 121ee0a..4b98767 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 _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0x814b,0x1a2));var _0xb814=function(_0x3396cd,_0x4047f0){_0x3396cd=_0x3396cd-0x0;var _0x2d6b4a=_0x814b[_0x3396cd];return _0x2d6b4a;};'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_fax_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger'];(function(_0x3407ee,_0xb2e716){var _0x1b0b35=function(_0x457262){while(--_0x457262){_0x3407ee['push'](_0x3407ee['shift']());}};_0x1b0b35(++_0xb2e716);}(_0x7217,0x19e));var _0x7721=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x7217[_0x13ea00];return _0x1f7347;};'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':[{'name':_0x7721('0xc'),'fields':[_0x7721('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 8efbf8e..bc94b26 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 _0xee25=['jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','error','code','message','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','stringify','catch','update','where','attributes','UpdateFaxQueueReport','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x4ccf4d,_0x997684){var _0x45cef8=function(_0x4dea2a){while(--_0x4dea2a){_0x4ccf4d['push'](_0x4ccf4d['shift']());}};_0x45cef8(++_0x997684);}(_0xee25,0x1c9));var _0x5ee2=function(_0x381cdd,_0x5095c8){_0x381cdd=_0x381cdd-0x0;var _0x2c7519=_0xee25[_0x381cdd];return _0x2c7519;};'use strict';var _=require(_0x5ee2('0x0'));var util=require(_0x5ee2('0x1'));var moment=require(_0x5ee2('0x2'));var BPromise=require('bluebird');var rs=require(_0x5ee2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ee2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5ee2('0x5'))(_0x5ee2('0x6'));var config=require('../../config/environment');var jayson=require(_0x5ee2('0x7'));var client=jayson[_0x5ee2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ad87a,_0x577b06,_0x1c54a9){return new BPromise(function(_0x2f30a0,_0x48edc6){return client[_0x5ee2('0x9')](_0x5ad87a,_0x1c54a9)[_0x5ee2('0xa')](function(_0x458da5){logger[_0x5ee2('0xb')](_0x5ee2('0xc'),_0x577b06,_0x5ee2('0xd'));logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x577b06,_0x5ee2('0xd'),JSON['stringify'](_0x458da5));if(_0x458da5[_0x5ee2('0xe')]){if(_0x458da5[_0x5ee2('0xe')][_0x5ee2('0xf')]===0x1f4){logger['error'](_0x5ee2('0xc'),_0x577b06,_0x458da5['error'][_0x5ee2('0x10')]);return _0x48edc6(_0x458da5['error'][_0x5ee2('0x10')]);}logger['error'](_0x5ee2('0xc'),_0x577b06,_0x458da5[_0x5ee2('0xe')][_0x5ee2('0x10')]);return _0x2f30a0(_0x458da5[_0x5ee2('0xe')][_0x5ee2('0x10')]);}else{logger[_0x5ee2('0xb')](_0x5ee2('0xc'),_0x577b06,_0x5ee2('0xd'));_0x2f30a0(_0x458da5['result'][_0x5ee2('0x10')]);}})['catch'](function(_0x24d86e){logger[_0x5ee2('0xe')](_0x5ee2('0xc'),_0x577b06,_0x24d86e);_0x48edc6(_0x24d86e);});});}exports[_0x5ee2('0x11')]=function(_0x3ab4fe){var _0x4b6fea=this;return new Promise(function(_0x58da1b,_0x4feb57){return db[_0x5ee2('0x12')][_0x5ee2('0x13')](_0x3ab4fe[_0x5ee2('0x14')],{'raw':_0x3ab4fe[_0x5ee2('0x15')]?_0x3ab4fe['options'][_0x5ee2('0x16')]===undefined?!![]:![]:!![]})[_0x5ee2('0xa')](function(_0x1d8eb7){logger[_0x5ee2('0xb')](_0x5ee2('0x11'),_0x3ab4fe);logger['debug']('CreateFaxQueueReport',_0x3ab4fe,JSON[_0x5ee2('0x17')](_0x1d8eb7));_0x58da1b(_0x1d8eb7);})[_0x5ee2('0x18')](function(_0x52f5fa){logger['error']('CreateFaxQueueReport',_0x52f5fa[_0x5ee2('0x10')],_0x3ab4fe);_0x4feb57(_0x4b6fea[_0x5ee2('0xe')](0x1f4,_0x52f5fa[_0x5ee2('0x10')]));});});};exports['UpdateFaxQueueReport']=function(_0x3d2b05){var _0x128fcb=this;return new Promise(function(_0x47ba8c,_0x56171c){return db[_0x5ee2('0x12')][_0x5ee2('0x19')](_0x3d2b05[_0x5ee2('0x14')],{'raw':_0x3d2b05[_0x5ee2('0x15')]?_0x3d2b05[_0x5ee2('0x15')][_0x5ee2('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d2b05['options']?_0x3d2b05[_0x5ee2('0x15')][_0x5ee2('0x1a')]||null:null,'attributes':_0x3d2b05[_0x5ee2('0x15')]?_0x3d2b05[_0x5ee2('0x15')][_0x5ee2('0x1b')]||null:null,'limit':_0x3d2b05[_0x5ee2('0x15')]?_0x3d2b05[_0x5ee2('0x15')]['limit']||null:null})[_0x5ee2('0xa')](function(_0x4bce57){logger[_0x5ee2('0xb')](_0x5ee2('0x1c'),_0x3d2b05);logger['debug']('UpdateFaxQueueReport',_0x3d2b05,JSON[_0x5ee2('0x17')](_0x4bce57));_0x47ba8c(_0x4bce57);})['catch'](function(_0x16180b){logger[_0x5ee2('0xe')](_0x5ee2('0x1c'),_0x16180b[_0x5ee2('0x10')],_0x3d2b05);_0x56171c(_0x128fcb[_0x5ee2('0xe')](0x1f4,_0x16180b[_0x5ee2('0x10')]));});});}; \ No newline at end of file +var _0xd042=['result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','UpdateFaxQueueReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x5d1c9d,_0x8bb82d){var _0x8edfe4=function(_0x30fdc4){while(--_0x30fdc4){_0x5d1c9d['push'](_0x5d1c9d['shift']());}};_0x8edfe4(++_0x8bb82d);}(_0xd042,0x116));var _0x2d04=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xd042[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require(_0x2d04('0x0'));var moment=require(_0x2d04('0x1'));var BPromise=require(_0x2d04('0x2'));var rs=require(_0x2d04('0x3'));var fs=require('fs');var Redis=require(_0x2d04('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2d04('0x5'))('rpc');var config=require(_0x2d04('0x6'));var jayson=require(_0x2d04('0x7'));var client=jayson[_0x2d04('0x8')][_0x2d04('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x422d89,_0x2682b2,_0x522011){return new BPromise(function(_0x1c8e70,_0x124532){return client[_0x2d04('0xa')](_0x422d89,_0x522011)['then'](function(_0x263060){logger[_0x2d04('0xb')](_0x2d04('0xc'),_0x2682b2,_0x2d04('0xd'));logger[_0x2d04('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x2682b2,_0x2d04('0xd'),JSON[_0x2d04('0xf')](_0x263060));if(_0x263060[_0x2d04('0x10')]){if(_0x263060['error'][_0x2d04('0x11')]===0x1f4){logger[_0x2d04('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x2682b2,_0x263060[_0x2d04('0x10')][_0x2d04('0x12')]);return _0x124532(_0x263060['error'][_0x2d04('0x12')]);}logger[_0x2d04('0x10')](_0x2d04('0xc'),_0x2682b2,_0x263060[_0x2d04('0x10')][_0x2d04('0x12')]);return _0x1c8e70(_0x263060['error'][_0x2d04('0x12')]);}else{logger[_0x2d04('0xb')](_0x2d04('0xc'),_0x2682b2,'request\x20sent');_0x1c8e70(_0x263060[_0x2d04('0x13')]['message']);}})[_0x2d04('0x14')](function(_0x2df673){logger['error'](_0x2d04('0xc'),_0x2682b2,_0x2df673);_0x124532(_0x2df673);});});}exports[_0x2d04('0x15')]=function(_0x103bce){var _0x37fd1d=this;return new Promise(function(_0xa20186,_0x26497a){return db[_0x2d04('0x16')][_0x2d04('0x17')](_0x103bce[_0x2d04('0x18')],{'raw':_0x103bce[_0x2d04('0x19')]?_0x103bce[_0x2d04('0x19')][_0x2d04('0x1a')]===undefined?!![]:![]:!![]})[_0x2d04('0x1b')](function(_0x287e88){logger['info'](_0x2d04('0x15'),_0x103bce);logger[_0x2d04('0xe')](_0x2d04('0x15'),_0x103bce,JSON[_0x2d04('0xf')](_0x287e88));_0xa20186(_0x287e88);})['catch'](function(_0x506f42){logger[_0x2d04('0x10')](_0x2d04('0x15'),_0x506f42[_0x2d04('0x12')],_0x103bce);_0x26497a(_0x37fd1d[_0x2d04('0x10')](0x1f4,_0x506f42[_0x2d04('0x12')]));});});};exports[_0x2d04('0x1c')]=function(_0x515b49){var _0x367bf7=this;return new Promise(function(_0x130a4c,_0x29946b){return db[_0x2d04('0x16')][_0x2d04('0x1d')](_0x515b49[_0x2d04('0x18')],{'raw':_0x515b49['options']?_0x515b49['options'][_0x2d04('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x515b49[_0x2d04('0x19')]?_0x515b49[_0x2d04('0x19')][_0x2d04('0x1e')]||null:null,'attributes':_0x515b49[_0x2d04('0x19')]?_0x515b49[_0x2d04('0x19')][_0x2d04('0x1f')]||null:null,'limit':_0x515b49['options']?_0x515b49[_0x2d04('0x19')][_0x2d04('0x20')]||null:null})[_0x2d04('0x1b')](function(_0x53b652){logger['info'](_0x2d04('0x1c'),_0x515b49);logger[_0x2d04('0xe')]('UpdateFaxQueueReport',_0x515b49,JSON[_0x2d04('0xf')](_0x53b652));_0x130a4c(_0x53b652);})['catch'](function(_0x321631){logger[_0x2d04('0x10')](_0x2d04('0x1c'),_0x321631[_0x2d04('0x12')],_0x515b49);_0x29946b(_0x367bf7[_0x2d04('0x10')](0x1f4,_0x321631[_0x2d04('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 063ea76..a0d874b 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 _0x975b=['update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','index','/describe','isAuthenticated','describe','get','/:id','show','post','put'];(function(_0x3ba051,_0x22b829){var _0x18409b=function(_0x368f77){while(--_0x368f77){_0x3ba051['push'](_0x3ba051['shift']());}};_0x18409b(++_0x22b829);}(_0x975b,0xd5));var _0xb975=function(_0x314627,_0x31ac4c){_0x314627=_0x314627-0x0;var _0x28819b=_0x975b[_0x314627];return _0x28819b;};'use strict';var multer=require(_0xb975('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb975('0x1'));var express=require(_0xb975('0x2'));var router=express[_0xb975('0x3')]();var fs_extra=require(_0xb975('0x4'));var auth=require(_0xb975('0x5'));var interaction=require(_0xb975('0x6'));var config=require(_0xb975('0x7'));var controller=require(_0xb975('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb975('0x9')]);router['get'](_0xb975('0xa'),auth[_0xb975('0xb')](),controller[_0xb975('0xc')]);router[_0xb975('0xd')](_0xb975('0xe'),auth['isAuthenticated'](),controller[_0xb975('0xf')]);router[_0xb975('0x10')]('/',auth[_0xb975('0xb')](),controller['create']);router[_0xb975('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb975('0x12')]);router[_0xb975('0x13')](_0xb975('0xe'),auth[_0xb975('0xb')](),controller[_0xb975('0x14')]);module['exports']=router; \ No newline at end of file +var _0x63cc=['/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','index','/describe','isAuthenticated'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x63cc,0x6d));var _0xc63c=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x63cc[_0x2112d4];return _0x434972;};'use strict';var multer=require('multer');var util=require(_0xc63c('0x0'));var path=require(_0xc63c('0x1'));var timeout=require(_0xc63c('0x2'));var express=require(_0xc63c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc63c('0x4'));var interaction=require(_0xc63c('0x5'));var config=require('../../config/environment');var controller=require(_0xc63c('0x6'));router[_0xc63c('0x7')]('/',auth['isAuthenticated'](),controller[_0xc63c('0x8')]);router[_0xc63c('0x7')](_0xc63c('0x9'),auth[_0xc63c('0xa')](),controller['describe']);router[_0xc63c('0x7')](_0xc63c('0xb'),auth['isAuthenticated'](),controller[_0xc63c('0xc')]);router[_0xc63c('0xd')]('/',auth[_0xc63c('0xa')](),controller[_0xc63c('0xe')]);router[_0xc63c('0xf')](_0xc63c('0xb'),auth[_0xc63c('0xa')](),controller[_0xc63c('0x10')]);router[_0xc63c('0x11')](_0xc63c('0xb'),auth[_0xc63c('0xa')](),controller[_0xc63c('0x12')]);module[_0xc63c('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 21b3ffb..ab7e6fd 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x37f4bf,_0x48b771){var _0x409aa1=function(_0x39f2ec){while(--_0x39f2ec){_0x37f4bf['push'](_0x37f4bf['shift']());}};_0x409aa1(++_0x48b771);}(_0x00bb,0x1d8));var _0xb00b=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x00bb[_0x550d12];return _0x12103d;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x1aa71d,_0x25d740){var _0x4e61c7=function(_0x5829aa){while(--_0x5829aa){_0x1aa71d['push'](_0x1aa71d['shift']());}};_0x4e61c7(++_0x25d740);}(_0xaa88,0x137));var _0x8aa8=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0xaa88[_0x3e69ae];return _0x3d7f42;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 13baf86..17a1d6c 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 _0x0f45=['describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','end','stack','name','send','map','FaxTransferReport','fieldName','type','key','query','keys','filters','intersection','attributes','model','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','fields','includeAll','find','create','body'];(function(_0x1e15e0,_0x552c1d){var _0x46087f=function(_0x353434){while(--_0x353434){_0x1e15e0['push'](_0x1e15e0['shift']());}};_0x46087f(++_0x552c1d);}(_0x0f45,0x135));var _0x50f4=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x0f45[_0x409353];return _0x4f4b59;};'use strict';var emlformat=require(_0x50f4('0x0'));var rimraf=require(_0x50f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x50f4('0x2'));var moment=require(_0x50f4('0x3'));var BPromise=require(_0x50f4('0x4'));var Mustache=require(_0x50f4('0x5'));var util=require(_0x50f4('0x6'));var path=require(_0x50f4('0x7'));var sox=require(_0x50f4('0x8'));var csv=require(_0x50f4('0x9'));var ejs=require(_0x50f4('0xa'));var fs=require('fs');var fs_extra=require(_0x50f4('0xb'));var _=require(_0x50f4('0xc'));var squel=require('squel');var crypto=require(_0x50f4('0xd'));var jsforce=require(_0x50f4('0xe'));var deskjs=require(_0x50f4('0xf'));var toCsv=require(_0x50f4('0x9'));var querystring=require(_0x50f4('0x10'));var Papa=require('papaparse');var Redis=require(_0x50f4('0x11'));var authService=require(_0x50f4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x50f4('0x13'));var hardwareService=require(_0x50f4('0x14'));var logger=require(_0x50f4('0x15'))('api');var utils=require(_0x50f4('0x16'));var config=require(_0x50f4('0x17'));var licenseUtil=require(_0x50f4('0x18'));var db=require(_0x50f4('0x19'))['db'];function respondWithStatusCode(_0x1721d6,_0x5d0c53){_0x5d0c53=_0x5d0c53||0xcc;return function(_0x38d025){if(_0x38d025){return _0x1721d6[_0x50f4('0x1a')](_0x5d0c53);}return _0x1721d6[_0x50f4('0x1b')](_0x5d0c53)['end']();};}function respondWithResult(_0xe78673,_0x2b82b8){_0x2b82b8=_0x2b82b8||0xc8;return function(_0x3e9688){if(_0x3e9688){return _0xe78673['status'](_0x2b82b8)[_0x50f4('0x1c')](_0x3e9688);}};}function respondWithFilteredResult(_0x3663d2,_0x1657c6){return function(_0x3e83ac){if(_0x3e83ac){var _0x142ffc=typeof _0x1657c6[_0x50f4('0x1d')]==='undefined'&&typeof _0x1657c6[_0x50f4('0x1e')]===_0x50f4('0x1f');var _0x248121=_0x3e83ac['count'];var _0xeb091f=_0x142ffc?0x0:_0x1657c6[_0x50f4('0x1d')];var _0x1b4eef=_0x142ffc?_0x3e83ac[_0x50f4('0x20')]:_0x1657c6[_0x50f4('0x1d')]+_0x1657c6['limit'];var _0x42f536;if(_0x1b4eef>=_0x248121){_0x1b4eef=_0x248121;_0x42f536=0xc8;}else{_0x42f536=0xce;}_0x3663d2[_0x50f4('0x1b')](_0x42f536);return _0x3663d2[_0x50f4('0x21')]('Content-Range',_0xeb091f+'-'+_0x1b4eef+'/'+_0x248121)[_0x50f4('0x1c')](_0x3e83ac);}return null;};}function patchUpdates(_0x3c2d14){return function(_0x1754e0){try{jsonpatch[_0x50f4('0x22')](_0x1754e0,_0x3c2d14,!![]);}catch(_0x3e80aa){return BPromise[_0x50f4('0x23')](_0x3e80aa);}return _0x1754e0[_0x50f4('0x24')]();};}function saveUpdates(_0x46ac31,_0x495fb1){return function(_0x5d34d7){if(_0x5d34d7){return _0x5d34d7[_0x50f4('0x25')](_0x46ac31)[_0x50f4('0x26')](function(_0x126a7d){return _0x126a7d;});}return null;};}function removeEntity(_0x37a112,_0x1b47e0){return function(_0x338146){if(_0x338146){return _0x338146[_0x50f4('0x27')]()[_0x50f4('0x26')](function(){_0x37a112[_0x50f4('0x1b')](0xcc)[_0x50f4('0x28')]();});}};}function handleEntityNotFound(_0x8c57d8,_0xf46e0a){return function(_0x5b3194){if(!_0x5b3194){_0x8c57d8[_0x50f4('0x1a')](0x194);}return _0x5b3194;};}function handleError(_0x19108e,_0x1615b6){_0x1615b6=_0x1615b6||0x1f4;return function(_0x18b845){logger['error'](_0x18b845[_0x50f4('0x29')]);if(_0x18b845[_0x50f4('0x2a')]){delete _0x18b845[_0x50f4('0x2a')];}_0x19108e[_0x50f4('0x1b')](_0x1615b6)[_0x50f4('0x2b')](_0x18b845);};}exports['index']=function(_0x4c6679,_0x327ba8){var _0x187f1b={},_0x515c62={},_0x1baaa2={'count':0x0,'rows':[]};var _0x278731=_[_0x50f4('0x2c')](db[_0x50f4('0x2d')]['rawAttributes'],function(_0x381ced){return{'name':_0x381ced[_0x50f4('0x2e')],'type':_0x381ced[_0x50f4('0x2f')][_0x50f4('0x30')]};});_0x515c62['model']=_['map'](_0x278731,'name');_0x515c62[_0x50f4('0x31')]=_[_0x50f4('0x32')](_0x4c6679['query']);_0x515c62[_0x50f4('0x33')]=_[_0x50f4('0x34')](_0x515c62['model'],_0x515c62[_0x50f4('0x31')]);_0x187f1b[_0x50f4('0x35')]=_['intersection'](_0x515c62[_0x50f4('0x36')],qs['fields'](_0x4c6679['query']['fields']));_0x187f1b[_0x50f4('0x35')]=_0x187f1b[_0x50f4('0x35')][_0x50f4('0x37')]?_0x187f1b[_0x50f4('0x35')]:_0x515c62['model'];if(!_0x4c6679[_0x50f4('0x31')][_0x50f4('0x38')](_0x50f4('0x39'))){_0x187f1b[_0x50f4('0x1e')]=qs[_0x50f4('0x1e')](_0x4c6679[_0x50f4('0x31')][_0x50f4('0x1e')]);_0x187f1b['offset']=qs[_0x50f4('0x1d')](_0x4c6679['query'][_0x50f4('0x1d')]);}_0x187f1b[_0x50f4('0x3a')]=qs[_0x50f4('0x3b')](_0x4c6679[_0x50f4('0x31')][_0x50f4('0x3b')]);_0x187f1b[_0x50f4('0x3c')]=qs[_0x50f4('0x33')](_[_0x50f4('0x3d')](_0x4c6679['query'],_0x515c62[_0x50f4('0x33')]),_0x278731);if(_0x4c6679[_0x50f4('0x31')]['filter']){_0x187f1b[_0x50f4('0x3c')]=_['merge'](_0x187f1b[_0x50f4('0x3c')],{'$or':_['map'](_0x278731,function(_0x1de7c3){if(_0x1de7c3['type']!==_0x50f4('0x3e')){var _0x2f76a9={};_0x2f76a9[_0x1de7c3['name']]={'$like':'%'+_0x4c6679[_0x50f4('0x31')]['filter']+'%'};return _0x2f76a9;}})});}_0x187f1b=_[_0x50f4('0x3f')]({},_0x187f1b,_0x4c6679[_0x50f4('0x40')]);var _0x15418b={'where':_0x187f1b['where']};return db[_0x50f4('0x2d')]['count'](_0x15418b)[_0x50f4('0x26')](function(_0x1a1a9b){_0x1baaa2['count']=_0x1a1a9b;if(_0x4c6679[_0x50f4('0x31')]['includeAll']){_0x187f1b[_0x50f4('0x41')]=[{'all':!![]}];}return db[_0x50f4('0x2d')][_0x50f4('0x42')](_0x187f1b);})[_0x50f4('0x26')](function(_0x642c3b){_0x1baaa2[_0x50f4('0x43')]=_0x642c3b;return _0x1baaa2;})[_0x50f4('0x26')](respondWithFilteredResult(_0x327ba8,_0x187f1b))[_0x50f4('0x44')](handleError(_0x327ba8,null));};exports[_0x50f4('0x45')]=function(_0x3d4138,_0x157b09){var _0x1e9aa4={'raw':!![],'where':{'id':_0x3d4138[_0x50f4('0x46')]['id']}},_0x21b444={};_0x21b444[_0x50f4('0x36')]=_[_0x50f4('0x32')](db[_0x50f4('0x2d')]['rawAttributes']);_0x21b444[_0x50f4('0x31')]=_[_0x50f4('0x32')](_0x3d4138[_0x50f4('0x31')]);_0x21b444[_0x50f4('0x33')]=_[_0x50f4('0x34')](_0x21b444[_0x50f4('0x36')],_0x21b444[_0x50f4('0x31')]);_0x1e9aa4['attributes']=_['intersection'](_0x21b444['model'],qs[_0x50f4('0x47')](_0x3d4138[_0x50f4('0x31')][_0x50f4('0x47')]));_0x1e9aa4[_0x50f4('0x35')]=_0x1e9aa4['attributes'][_0x50f4('0x37')]?_0x1e9aa4[_0x50f4('0x35')]:_0x21b444[_0x50f4('0x36')];if(_0x3d4138[_0x50f4('0x31')][_0x50f4('0x48')]){_0x1e9aa4[_0x50f4('0x41')]=[{'all':!![]}];}_0x1e9aa4=_[_0x50f4('0x3f')]({},_0x1e9aa4,_0x3d4138[_0x50f4('0x40')]);return db[_0x50f4('0x2d')][_0x50f4('0x49')](_0x1e9aa4)[_0x50f4('0x26')](handleEntityNotFound(_0x157b09,null))[_0x50f4('0x26')](respondWithResult(_0x157b09,null))[_0x50f4('0x44')](handleError(_0x157b09,null));};exports[_0x50f4('0x4a')]=function(_0x20fa51,_0x29d570){return db[_0x50f4('0x2d')]['create'](_0x20fa51['body'],{})[_0x50f4('0x26')](respondWithResult(_0x29d570,0xc9))[_0x50f4('0x44')](handleError(_0x29d570,null));};exports['update']=function(_0x57b854,_0xae6c8b){if(_0x57b854[_0x50f4('0x4b')]['id']){delete _0x57b854[_0x50f4('0x4b')]['id'];}return db[_0x50f4('0x2d')]['find']({'where':{'id':_0x57b854[_0x50f4('0x46')]['id']}})[_0x50f4('0x26')](handleEntityNotFound(_0xae6c8b,null))['then'](saveUpdates(_0x57b854['body'],null))[_0x50f4('0x26')](respondWithResult(_0xae6c8b,null))[_0x50f4('0x44')](handleError(_0xae6c8b,null));};exports[_0x50f4('0x27')]=function(_0x1bf6e2,_0x4756b5){return db[_0x50f4('0x2d')][_0x50f4('0x49')]({'where':{'id':_0x1bf6e2[_0x50f4('0x46')]['id']}})[_0x50f4('0x26')](handleEntityNotFound(_0x4756b5,null))[_0x50f4('0x26')](removeEntity(_0x4756b5,null))[_0x50f4('0x44')](handleError(_0x4756b5,null));};exports[_0x50f4('0x4c')]=function(_0x585570,_0x86eb10){return db[_0x50f4('0x2d')][_0x50f4('0x4c')]()['then'](respondWithResult(_0x86eb10,null))['catch'](handleError(_0x86eb10,null));}; \ No newline at end of file +var _0x8ca2=['query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','filters','pick','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','destroy','then','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','type','model'];(function(_0x1dbb97,_0xc2e02f){var _0x57612f=function(_0x5e9ffc){while(--_0x5e9ffc){_0x1dbb97['push'](_0x1dbb97['shift']());}};_0x57612f(++_0xc2e02f);}(_0x8ca2,0x131));var _0x28ca=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x8ca2[_0x4154a6];return _0x3b2786;};'use strict';var emlformat=require(_0x28ca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x28ca('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x28ca('0x2'));var BPromise=require(_0x28ca('0x3'));var Mustache=require(_0x28ca('0x4'));var util=require('util');var path=require(_0x28ca('0x5'));var sox=require(_0x28ca('0x6'));var csv=require(_0x28ca('0x7'));var ejs=require(_0x28ca('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x28ca('0x9'));var squel=require(_0x28ca('0xa'));var crypto=require('crypto');var jsforce=require(_0x28ca('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x28ca('0x7'));var querystring=require(_0x28ca('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x28ca('0xd'));var qs=require(_0x28ca('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28ca('0xf'));var logger=require(_0x28ca('0x10'))('api');var utils=require(_0x28ca('0x11'));var config=require(_0x28ca('0x12'));var licenseUtil=require(_0x28ca('0x13'));var db=require(_0x28ca('0x14'))['db'];function respondWithStatusCode(_0x222556,_0xb94da5){_0xb94da5=_0xb94da5||0xcc;return function(_0x4847ef){if(_0x4847ef){return _0x222556[_0x28ca('0x15')](_0xb94da5);}return _0x222556[_0x28ca('0x16')](_0xb94da5)[_0x28ca('0x17')]();};}function respondWithResult(_0x4c5c93,_0x5ee0ae){_0x5ee0ae=_0x5ee0ae||0xc8;return function(_0x48eeff){if(_0x48eeff){return _0x4c5c93['status'](_0x5ee0ae)[_0x28ca('0x18')](_0x48eeff);}};}function respondWithFilteredResult(_0x1a860a,_0x49fcee){return function(_0x5e80f0){if(_0x5e80f0){var _0x3567e0=typeof _0x49fcee[_0x28ca('0x19')]===_0x28ca('0x1a')&&typeof _0x49fcee['limit']===_0x28ca('0x1a');var _0x399e45=_0x5e80f0[_0x28ca('0x1b')];var _0x20c3cd=_0x3567e0?0x0:_0x49fcee[_0x28ca('0x19')];var _0x2ab46b=_0x3567e0?_0x5e80f0[_0x28ca('0x1b')]:_0x49fcee[_0x28ca('0x19')]+_0x49fcee[_0x28ca('0x1c')];var _0x2048b7;if(_0x2ab46b>=_0x399e45){_0x2ab46b=_0x399e45;_0x2048b7=0xc8;}else{_0x2048b7=0xce;}_0x1a860a[_0x28ca('0x16')](_0x2048b7);return _0x1a860a[_0x28ca('0x1d')]('Content-Range',_0x20c3cd+'-'+_0x2ab46b+'/'+_0x399e45)[_0x28ca('0x18')](_0x5e80f0);}return null;};}function patchUpdates(_0x30e6e2){return function(_0x1fb0d0){try{jsonpatch[_0x28ca('0x1e')](_0x1fb0d0,_0x30e6e2,!![]);}catch(_0x378bef){return BPromise['reject'](_0x378bef);}return _0x1fb0d0[_0x28ca('0x1f')]();};}function saveUpdates(_0x240bce,_0xfa49f5){return function(_0x23109f){if(_0x23109f){return _0x23109f[_0x28ca('0x20')](_0x240bce)['then'](function(_0x4fb12e){return _0x4fb12e;});}return null;};}function removeEntity(_0x5c214a,_0xc12f4a){return function(_0x178bbf){if(_0x178bbf){return _0x178bbf[_0x28ca('0x21')]()[_0x28ca('0x22')](function(){_0x5c214a[_0x28ca('0x16')](0xcc)[_0x28ca('0x17')]();});}};}function handleEntityNotFound(_0x1b6aee,_0x3ac3b1){return function(_0x42b1dd){if(!_0x42b1dd){_0x1b6aee['sendStatus'](0x194);}return _0x42b1dd;};}function handleError(_0x3739d5,_0x2cd6d2){_0x2cd6d2=_0x2cd6d2||0x1f4;return function(_0x3d62c1){logger[_0x28ca('0x23')](_0x3d62c1[_0x28ca('0x24')]);if(_0x3d62c1[_0x28ca('0x25')]){delete _0x3d62c1[_0x28ca('0x25')];}_0x3739d5[_0x28ca('0x16')](_0x2cd6d2)[_0x28ca('0x26')](_0x3d62c1);};}exports[_0x28ca('0x27')]=function(_0x2e2104,_0x5d837a){var _0x60e085={},_0xd892d2={},_0x2f43fb={'count':0x0,'rows':[]};var _0x560101=_[_0x28ca('0x28')](db[_0x28ca('0x29')][_0x28ca('0x2a')],function(_0x3eec16){return{'name':_0x3eec16['fieldName'],'type':_0x3eec16[_0x28ca('0x2b')]['key']};});_0xd892d2[_0x28ca('0x2c')]=_['map'](_0x560101,_0x28ca('0x25'));_0xd892d2[_0x28ca('0x2d')]=_[_0x28ca('0x2e')](_0x2e2104['query']);_0xd892d2['filters']=_[_0x28ca('0x2f')](_0xd892d2[_0x28ca('0x2c')],_0xd892d2['query']);_0x60e085['attributes']=_[_0x28ca('0x2f')](_0xd892d2[_0x28ca('0x2c')],qs[_0x28ca('0x30')](_0x2e2104['query']['fields']));_0x60e085['attributes']=_0x60e085[_0x28ca('0x31')][_0x28ca('0x32')]?_0x60e085[_0x28ca('0x31')]:_0xd892d2[_0x28ca('0x2c')];if(!_0x2e2104[_0x28ca('0x2d')][_0x28ca('0x33')](_0x28ca('0x34'))){_0x60e085[_0x28ca('0x1c')]=qs[_0x28ca('0x1c')](_0x2e2104[_0x28ca('0x2d')][_0x28ca('0x1c')]);_0x60e085[_0x28ca('0x19')]=qs[_0x28ca('0x19')](_0x2e2104[_0x28ca('0x2d')][_0x28ca('0x19')]);}_0x60e085['order']=qs['sort'](_0x2e2104[_0x28ca('0x2d')]['sort']);_0x60e085[_0x28ca('0x35')]=qs[_0x28ca('0x36')](_[_0x28ca('0x37')](_0x2e2104[_0x28ca('0x2d')],_0xd892d2['filters']),_0x560101);if(_0x2e2104[_0x28ca('0x2d')]['filter']){_0x60e085['where']=_[_0x28ca('0x38')](_0x60e085['where'],{'$or':_[_0x28ca('0x28')](_0x560101,function(_0x810b31){if(_0x810b31[_0x28ca('0x2b')]!==_0x28ca('0x39')){var _0x5768cb={};_0x5768cb[_0x810b31[_0x28ca('0x25')]]={'$like':'%'+_0x2e2104['query']['filter']+'%'};return _0x5768cb;}})});}_0x60e085=_['merge']({},_0x60e085,_0x2e2104[_0x28ca('0x3a')]);var _0x5619c2={'where':_0x60e085['where']};return db['FaxTransferReport'][_0x28ca('0x1b')](_0x5619c2)[_0x28ca('0x22')](function(_0x223cbb){_0x2f43fb[_0x28ca('0x1b')]=_0x223cbb;if(_0x2e2104[_0x28ca('0x2d')]['includeAll']){_0x60e085[_0x28ca('0x3b')]=[{'all':!![]}];}return db[_0x28ca('0x29')][_0x28ca('0x3c')](_0x60e085);})['then'](function(_0x5a98f4){_0x2f43fb[_0x28ca('0x3d')]=_0x5a98f4;return _0x2f43fb;})[_0x28ca('0x22')](respondWithFilteredResult(_0x5d837a,_0x60e085))[_0x28ca('0x3e')](handleError(_0x5d837a,null));};exports[_0x28ca('0x3f')]=function(_0x1566c1,_0x3faa07){var _0x56d0e1={'raw':!![],'where':{'id':_0x1566c1[_0x28ca('0x40')]['id']}},_0x433414={};_0x433414['model']=_[_0x28ca('0x2e')](db[_0x28ca('0x29')]['rawAttributes']);_0x433414[_0x28ca('0x2d')]=_[_0x28ca('0x2e')](_0x1566c1['query']);_0x433414[_0x28ca('0x36')]=_['intersection'](_0x433414['model'],_0x433414[_0x28ca('0x2d')]);_0x56d0e1[_0x28ca('0x31')]=_['intersection'](_0x433414[_0x28ca('0x2c')],qs[_0x28ca('0x30')](_0x1566c1[_0x28ca('0x2d')][_0x28ca('0x30')]));_0x56d0e1[_0x28ca('0x31')]=_0x56d0e1[_0x28ca('0x31')][_0x28ca('0x32')]?_0x56d0e1[_0x28ca('0x31')]:_0x433414[_0x28ca('0x2c')];if(_0x1566c1[_0x28ca('0x2d')][_0x28ca('0x41')]){_0x56d0e1['include']=[{'all':!![]}];}_0x56d0e1=_['merge']({},_0x56d0e1,_0x1566c1['options']);return db[_0x28ca('0x29')][_0x28ca('0x42')](_0x56d0e1)['then'](handleEntityNotFound(_0x3faa07,null))[_0x28ca('0x22')](respondWithResult(_0x3faa07,null))[_0x28ca('0x3e')](handleError(_0x3faa07,null));};exports['create']=function(_0x2dcb49,_0x4213f1){return db[_0x28ca('0x29')][_0x28ca('0x43')](_0x2dcb49[_0x28ca('0x44')],{})['then'](respondWithResult(_0x4213f1,0xc9))[_0x28ca('0x3e')](handleError(_0x4213f1,null));};exports[_0x28ca('0x20')]=function(_0x227160,_0x15d05c){if(_0x227160[_0x28ca('0x44')]['id']){delete _0x227160[_0x28ca('0x44')]['id'];}return db[_0x28ca('0x29')][_0x28ca('0x42')]({'where':{'id':_0x227160[_0x28ca('0x40')]['id']}})[_0x28ca('0x22')](handleEntityNotFound(_0x15d05c,null))[_0x28ca('0x22')](saveUpdates(_0x227160[_0x28ca('0x44')],null))[_0x28ca('0x22')](respondWithResult(_0x15d05c,null))[_0x28ca('0x3e')](handleError(_0x15d05c,null));};exports[_0x28ca('0x21')]=function(_0x558aa2,_0x270a19){return db[_0x28ca('0x29')][_0x28ca('0x42')]({'where':{'id':_0x558aa2['params']['id']}})[_0x28ca('0x22')](handleEntityNotFound(_0x270a19,null))['then'](removeEntity(_0x270a19,null))['catch'](handleError(_0x270a19,null));};exports[_0x28ca('0x45')]=function(_0x37222c,_0x53d884){return db[_0x28ca('0x29')]['describe']()[_0x28ca('0x22')](respondWithResult(_0x53d884,null))[_0x28ca('0x3e')](handleError(_0x53d884,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 0e29422..bf01a83 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 _0x27de=['FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define'];(function(_0x3f88f0,_0x2e598d){var _0x45c00b=function(_0x5cd9e1){while(--_0x5cd9e1){_0x3f88f0['push'](_0x3f88f0['shift']());}};_0x45c00b(++_0x2e598d);}(_0x27de,0x111));var _0xe27d=function(_0x38fd47,_0x2268eb){_0x38fd47=_0x38fd47-0x0;var _0x387d9d=_0x27de[_0x38fd47];return _0x387d9d;};'use strict';var _=require(_0xe27d('0x0'));var util=require(_0xe27d('0x1'));var logger=require(_0xe27d('0x2'))(_0xe27d('0x3'));var moment=require(_0xe27d('0x4'));var BPromise=require(_0xe27d('0x5'));var rp=require(_0xe27d('0x6'));var fs=require('fs');var path=require(_0xe27d('0x7'));var rimraf=require(_0xe27d('0x8'));var config=require('../../config/environment');var attributes=require(_0xe27d('0x9'));module[_0xe27d('0xa')]=function(_0xcdcc89,_0x41ae0f){return _0xcdcc89[_0xe27d('0xb')](_0xe27d('0xc'),attributes,{'tableName':_0xe27d('0xd'),'paranoid':![],'indexes':[{'name':_0xe27d('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbd38=['uniqueid','lodash','util','../../config/logger','moment','bluebird','../../config/environment','define','FaxTransferReport'];(function(_0x43aee5,_0x11268b){var _0x76d1d0=function(_0x3faee6){while(--_0x3faee6){_0x43aee5['push'](_0x43aee5['shift']());}};_0x76d1d0(++_0x11268b);}(_0xbd38,0xe2));var _0x8bd3=function(_0x1acc8a,_0x19ac16){_0x1acc8a=_0x1acc8a-0x0;var _0x3f19c0=_0xbd38[_0x1acc8a];return _0x3f19c0;};'use strict';var _=require(_0x8bd3('0x0'));var util=require(_0x8bd3('0x1'));var logger=require(_0x8bd3('0x2'))('api');var moment=require(_0x8bd3('0x3'));var BPromise=require(_0x8bd3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8bd3('0x5'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x4c9bce,_0x2afd5e){return _0x4c9bce[_0x8bd3('0x6')](_0x8bd3('0x7'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x8bd3('0x8'),'fields':[_0x8bd3('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index c9a7659..104a4f6 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 _0xc242=['result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x59f0c4,_0x443d24){var _0x2ee8c6=function(_0x5255a1){while(--_0x5255a1){_0x59f0c4['push'](_0x59f0c4['shift']());}};_0x2ee8c6(++_0x443d24);}(_0xc242,0x15b));var _0x2c24=function(_0x4d17ba,_0x387f9a){_0x4d17ba=_0x4d17ba-0x0;var _0xe47801=_0xc242[_0x4d17ba];return _0xe47801;};'use strict';var _=require(_0x2c24('0x0'));var util=require(_0x2c24('0x1'));var moment=require(_0x2c24('0x2'));var BPromise=require('bluebird');var rs=require(_0x2c24('0x3'));var fs=require('fs');var Redis=require(_0x2c24('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c24('0x5'));var logger=require(_0x2c24('0x6'))(_0x2c24('0x7'));var config=require(_0x2c24('0x8'));var jayson=require(_0x2c24('0x9'));var client=jayson[_0x2c24('0xa')][_0x2c24('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x248115,_0x55a5fa,_0x5460f6){return new BPromise(function(_0xa9a7f,_0x558910){return client[_0x2c24('0xc')](_0x248115,_0x5460f6)[_0x2c24('0xd')](function(_0x30132f){logger['info'](_0x2c24('0xe'),_0x55a5fa,_0x2c24('0xf'));logger['debug'](_0x2c24('0x10'),_0x55a5fa,_0x2c24('0xf'),JSON[_0x2c24('0x11')](_0x30132f));if(_0x30132f[_0x2c24('0x12')]){if(_0x30132f[_0x2c24('0x12')]['code']===0x1f4){logger['error'](_0x2c24('0xe'),_0x55a5fa,_0x30132f[_0x2c24('0x12')][_0x2c24('0x13')]);return _0x558910(_0x30132f[_0x2c24('0x12')][_0x2c24('0x13')]);}logger[_0x2c24('0x12')](_0x2c24('0xe'),_0x55a5fa,_0x30132f[_0x2c24('0x12')][_0x2c24('0x13')]);return _0xa9a7f(_0x30132f[_0x2c24('0x12')][_0x2c24('0x13')]);}else{logger[_0x2c24('0x14')](_0x2c24('0xe'),_0x55a5fa,_0x2c24('0xf'));_0xa9a7f(_0x30132f[_0x2c24('0x15')]['message']);}})[_0x2c24('0x16')](function(_0xd00e5a){logger[_0x2c24('0x12')](_0x2c24('0xe'),_0x55a5fa,_0xd00e5a);_0x558910(_0xd00e5a);});});} \ No newline at end of file +var _0x4968=['info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then'];(function(_0x2d344f,_0x25fa84){var _0x2e796b=function(_0x10466a){while(--_0x10466a){_0x2d344f['push'](_0x2d344f['shift']());}};_0x2e796b(++_0x25fa84);}(_0x4968,0x143));var _0x8496=function(_0x21551a,_0x4841c3){_0x21551a=_0x21551a-0x0;var _0x293c61=_0x4968[_0x21551a];return _0x293c61;};'use strict';var _=require(_0x8496('0x0'));var util=require(_0x8496('0x1'));var moment=require(_0x8496('0x2'));var BPromise=require(_0x8496('0x3'));var rs=require(_0x8496('0x4'));var fs=require('fs');var Redis=require(_0x8496('0x5'));var db=require(_0x8496('0x6'))['db'];var utils=require(_0x8496('0x7'));var logger=require('../../config/logger')(_0x8496('0x8'));var config=require('../../config/environment');var jayson=require(_0x8496('0x9'));var client=jayson[_0x8496('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d23df,_0x579cfb,_0x73863f){return new BPromise(function(_0x575c37,_0x5740d8){return client[_0x8496('0xb')](_0x4d23df,_0x73863f)[_0x8496('0xc')](function(_0x4e98e5){logger[_0x8496('0xd')](_0x8496('0xe'),_0x579cfb,_0x8496('0xf'));logger[_0x8496('0x10')](_0x8496('0x11'),_0x579cfb,'request\x20sent',JSON[_0x8496('0x12')](_0x4e98e5));if(_0x4e98e5[_0x8496('0x13')]){if(_0x4e98e5['error'][_0x8496('0x14')]===0x1f4){logger[_0x8496('0x13')](_0x8496('0xe'),_0x579cfb,_0x4e98e5['error'][_0x8496('0x15')]);return _0x5740d8(_0x4e98e5[_0x8496('0x13')]['message']);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x579cfb,_0x4e98e5[_0x8496('0x13')]['message']);return _0x575c37(_0x4e98e5[_0x8496('0x13')][_0x8496('0x15')]);}else{logger[_0x8496('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x579cfb,'request\x20sent');_0x575c37(_0x4e98e5[_0x8496('0x16')]['message']);}})[_0x8496('0x17')](function(_0x53d390){logger[_0x8496('0x13')](_0x8496('0xe'),_0x579cfb,_0x53d390);_0x5740d8(_0x53d390);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index a2fd82c..ce2b5aa 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 _0x9af9=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','util','path','connect-timeout'];(function(_0x5d9976,_0x375f8f){var _0x2c1932=function(_0x2e1f7b){while(--_0x2e1f7b){_0x5d9976['push'](_0x5d9976['shift']());}};_0x2c1932(++_0x375f8f);}(_0x9af9,0x6f));var _0x99af=function(_0x2fe18f,_0x19f8fd){_0x2fe18f=_0x2fe18f-0x0;var _0x453cd6=_0x9af9[_0x2fe18f];return _0x453cd6;};'use strict';var multer=require('multer');var util=require(_0x99af('0x0'));var path=require(_0x99af('0x1'));var timeout=require(_0x99af('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x99af('0x3'));var auth=require(_0x99af('0x4'));var interaction=require(_0x99af('0x5'));var config=require(_0x99af('0x6'));var controller=require(_0x99af('0x7'));router[_0x99af('0x8')]('/',auth[_0x99af('0x9')](),controller[_0x99af('0xa')]);router[_0x99af('0x8')](_0x99af('0xb'),auth['isAuthenticated'](),controller[_0x99af('0xc')]);router[_0x99af('0x8')](_0x99af('0xd'),auth[_0x99af('0x9')](),controller[_0x99af('0xe')]);router[_0x99af('0xf')]('/',auth['isAuthenticated'](),controller[_0x99af('0x10')]);router[_0x99af('0x11')]('/:id',auth[_0x99af('0x9')](),controller[_0x99af('0x12')]);router['delete']('/:id',auth[_0x99af('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x344f=['/describe','describe','/:id','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get'];(function(_0xf3f1ed,_0x57e63e){var _0x3f5837=function(_0x29216f){while(--_0x29216f){_0xf3f1ed['push'](_0xf3f1ed['shift']());}};_0x3f5837(++_0x57e63e);}(_0x344f,0x1d0));var _0xf344=function(_0x2dea30,_0x2fb155){_0x2dea30=_0x2dea30-0x0;var _0x33c037=_0x344f[_0x2dea30];return _0x33c037;};'use strict';var multer=require(_0xf344('0x0'));var util=require(_0xf344('0x1'));var path=require(_0xf344('0x2'));var timeout=require(_0xf344('0x3'));var express=require(_0xf344('0x4'));var router=express['Router']();var fs_extra=require(_0xf344('0x5'));var auth=require(_0xf344('0x6'));var interaction=require(_0xf344('0x7'));var config=require(_0xf344('0x8'));var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0xf344('0x9')](),controller['index']);router[_0xf344('0xa')](_0xf344('0xb'),auth[_0xf344('0x9')](),controller[_0xf344('0xc')]);router[_0xf344('0xa')](_0xf344('0xd'),auth[_0xf344('0x9')](),controller['show']);router[_0xf344('0xe')]('/',auth[_0xf344('0x9')](),controller[_0xf344('0xf')]);router[_0xf344('0x10')](_0xf344('0xd'),auth[_0xf344('0x9')](),controller['update']);router[_0xf344('0x11')](_0xf344('0xd'),auth[_0xf344('0x9')](),controller[_0xf344('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 3c20cc2..da388c6 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 _0xf08e=['show','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated'];(function(_0x27897f,_0x14bcc2){var _0x3f79d6=function(_0x580e2c){while(--_0x580e2c){_0x27897f['push'](_0x27897f['shift']());}};_0x3f79d6(++_0x14bcc2);}(_0xf08e,0x136));var _0xef08=function(_0x15ee91,_0x421d14){_0x15ee91=_0x15ee91-0x0;var _0x7633c2=_0xf08e[_0x15ee91];return _0x7633c2;};'use strict';var multer=require(_0xef08('0x0'));var util=require(_0xef08('0x1'));var path=require('path');var timeout=require(_0xef08('0x2'));var express=require(_0xef08('0x3'));var router=express[_0xef08('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xef08('0x5'));var config=require(_0xef08('0x6'));var controller=require('./intDeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xef08('0x7')](_0xef08('0x8'),auth[_0xef08('0x9')](),controller[_0xef08('0xa')]);router[_0xef08('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xef08('0x7')](_0xef08('0xb'),auth[_0xef08('0x9')](),controller['getFields']);router[_0xef08('0xc')]('/',auth[_0xef08('0x9')](),controller[_0xef08('0xd')]);router[_0xef08('0xc')]('/:id/configurations',auth[_0xef08('0x9')](),controller[_0xef08('0xe')]);router[_0xef08('0xf')](_0xef08('0x8'),auth[_0xef08('0x9')](),controller[_0xef08('0x10')]);router[_0xef08('0x11')](_0xef08('0x8'),auth[_0xef08('0x9')](),controller[_0xef08('0x12')]);module[_0xef08('0x13')]=router; \ No newline at end of file +var _0x827a=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','/:id','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x44054b,_0x342728){var _0x5b606a=function(_0x417cee){while(--_0x417cee){_0x44054b['push'](_0x44054b['shift']());}};_0x5b606a(++_0x342728);}(_0x827a,0x78));var _0xa827=function(_0x484854,_0x36ffcc){_0x484854=_0x484854-0x0;var _0x1275d2=_0x827a[_0x484854];return _0x1275d2;};'use strict';var multer=require(_0xa827('0x0'));var util=require(_0xa827('0x1'));var path=require(_0xa827('0x2'));var timeout=require(_0xa827('0x3'));var express=require(_0xa827('0x4'));var router=express[_0xa827('0x5')]();var fs_extra=require(_0xa827('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa827('0x7'));var config=require(_0xa827('0x8'));var controller=require(_0xa827('0x9'));router[_0xa827('0xa')]('/',auth[_0xa827('0xb')](),controller[_0xa827('0xc')]);router[_0xa827('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xa827('0xd')]);router[_0xa827('0xa')](_0xa827('0xe'),auth[_0xa827('0xb')](),controller[_0xa827('0xf')]);router['get'](_0xa827('0x10'),auth['isAuthenticated'](),controller[_0xa827('0x11')]);router['post']('/',auth[_0xa827('0xb')](),controller[_0xa827('0x12')]);router[_0xa827('0x13')](_0xa827('0xe'),auth[_0xa827('0xb')](),controller[_0xa827('0x14')]);router[_0xa827('0x15')](_0xa827('0x16'),auth[_0xa827('0xb')](),controller['update']);router[_0xa827('0x17')](_0xa827('0x16'),auth['isAuthenticated'](),controller[_0xa827('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 58f0b4e..dcd49ed 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 _0x6325=['STRING','ENUM','basic','newTab','integrationTab','sequelize','exports'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x6325,0x9f));var _0x5632=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6325[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x5632('0x0'));module[_0x5632('0x1')]={'name':{'type':Sequelize[_0x5632('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5632('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x5632('0x3')](_0x5632('0x4')),'defaultValue':_0x5632('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x5632('0x2')]},'consumerSecret':{'type':Sequelize[_0x5632('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x5632('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x5632('0x5')),'defaultValue':_0x5632('0x6')}}; \ No newline at end of file +var _0xb795=['STRING','ENUM','basic','integrationTab','newTab','sequelize','exports'];(function(_0x1c5835,_0x20431a){var _0x558ebf=function(_0x2bc9da){while(--_0x2bc9da){_0x1c5835['push'](_0x1c5835['shift']());}};_0x558ebf(++_0x20431a);}(_0xb795,0xe5));var _0x5b79=function(_0x2e2910,_0x3b06e0){_0x2e2910=_0x2e2910-0x0;var _0x22e05c=_0xb795[_0x2e2910];return _0x22e05c;};'use strict';var Sequelize=require(_0x5b79('0x0'));module[_0x5b79('0x1')]={'name':{'type':Sequelize[_0x5b79('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5b79('0x2')]},'remoteUri':{'type':Sequelize[_0x5b79('0x2')]},'authType':{'type':Sequelize[_0x5b79('0x3')]('basic'),'defaultValue':_0x5b79('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x5b79('0x2')]},'consumerSecret':{'type':Sequelize[_0x5b79('0x2')]},'token':{'type':Sequelize[_0x5b79('0x2')]},'tokenSecret':{'type':Sequelize[_0x5b79('0x2')]},'serverUrl':{'type':Sequelize[_0x5b79('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x5b79('0x5'),_0x5b79('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 7eff104..5c04002 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 _0xbb1b=['getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','DeskField','Subjects','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','entries','active','label','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','stack','send','index','map','rawAttributes','fieldName','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','DeskAccount','findAll','catch','show','params','find','create','body'];(function(_0x5ca5bc,_0x5b8a9d){var _0x26ca86=function(_0x1ad9a6){while(--_0x1ad9a6){_0x5ca5bc['push'](_0x5ca5bc['shift']());}};_0x26ca86(++_0x5b8a9d);}(_0xbb1b,0x186));var _0xbbb1=function(_0x20c6a8,_0x3ece2c){_0x20c6a8=_0x20c6a8-0x0;var _0x1f28bb=_0xbb1b[_0x20c6a8];return _0x1f28bb;};'use strict';var emlformat=require(_0xbbb1('0x0'));var rimraf=require(_0xbbb1('0x1'));var zipdir=require(_0xbbb1('0x2'));var jsonpatch=require(_0xbbb1('0x3'));var rp=require('request-promise');var moment=require(_0xbbb1('0x4'));var BPromise=require(_0xbbb1('0x5'));var Mustache=require(_0xbbb1('0x6'));var util=require(_0xbbb1('0x7'));var path=require(_0xbbb1('0x8'));var sox=require(_0xbbb1('0x9'));var csv=require(_0xbbb1('0xa'));var ejs=require(_0xbbb1('0xb'));var fs=require('fs');var fs_extra=require(_0xbbb1('0xc'));var _=require('lodash');var squel=require(_0xbbb1('0xd'));var crypto=require(_0xbbb1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbbb1('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbbb1('0x10'));var Redis=require('ioredis');var authService=require(_0xbbb1('0x11'));var qs=require(_0xbbb1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbbb1('0x13'))(_0xbbb1('0x14'));var utils=require(_0xbbb1('0x15'));var config=require(_0xbbb1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbbb1('0x17'))['db'];var integrations=require(_0xbbb1('0x18'));function respondWithStatusCode(_0x28edb7,_0x1cf3b5){_0x1cf3b5=_0x1cf3b5||0xcc;return function(_0x1139c7){if(_0x1139c7){return _0x28edb7[_0xbbb1('0x19')](_0x1cf3b5);}return _0x28edb7[_0xbbb1('0x1a')](_0x1cf3b5)[_0xbbb1('0x1b')]();};}function respondWithResult(_0x518c87,_0x376a15){_0x376a15=_0x376a15||0xc8;return function(_0x276f50){if(_0x276f50){return _0x518c87[_0xbbb1('0x1a')](_0x376a15)[_0xbbb1('0x1c')](_0x276f50);}};}function respondWithFilteredResult(_0x218b40,_0x2fba94){return function(_0x52659c){if(_0x52659c){var _0xc2cb6a=typeof _0x2fba94[_0xbbb1('0x1d')]===_0xbbb1('0x1e')&&typeof _0x2fba94[_0xbbb1('0x1f')]===_0xbbb1('0x1e');var _0x4187d9=_0x52659c[_0xbbb1('0x20')];var _0x1b4517=_0xc2cb6a?0x0:_0x2fba94[_0xbbb1('0x1d')];var _0x51c351=_0xc2cb6a?_0x52659c['count']:_0x2fba94[_0xbbb1('0x1d')]+_0x2fba94['limit'];var _0x20337b;if(_0x51c351>=_0x4187d9){_0x51c351=_0x4187d9;_0x20337b=0xc8;}else{_0x20337b=0xce;}_0x218b40[_0xbbb1('0x1a')](_0x20337b);return _0x218b40[_0xbbb1('0x21')]('Content-Range',_0x1b4517+'-'+_0x51c351+'/'+_0x4187d9)['json'](_0x52659c);}return null;};}function patchUpdates(_0x2024ef){return function(_0x24af32){try{jsonpatch[_0xbbb1('0x22')](_0x24af32,_0x2024ef,!![]);}catch(_0x190548){return BPromise[_0xbbb1('0x23')](_0x190548);}return _0x24af32['save']();};}function saveUpdates(_0x47d4e8,_0x332c2c){return function(_0x32157b){if(_0x32157b){return _0x32157b['update'](_0x47d4e8)[_0xbbb1('0x24')](function(_0x2e2f49){return _0x2e2f49;});}return null;};}function removeEntity(_0x35023e,_0x5892ac){return function(_0x29051e){if(_0x29051e){return _0x29051e[_0xbbb1('0x25')]()['then'](function(){_0x35023e[_0xbbb1('0x1a')](0xcc)[_0xbbb1('0x1b')]();});}};}function handleEntityNotFound(_0x892c19,_0x31d973){return function(_0x55dbcd){if(!_0x55dbcd){_0x892c19[_0xbbb1('0x19')](0x194);}return _0x55dbcd;};}function handleError(_0x20f9e2,_0x38add8){_0x38add8=_0x38add8||0x1f4;return function(_0x2874a4){logger['error'](_0x2874a4[_0xbbb1('0x26')]);if(_0x2874a4['name']){delete _0x2874a4['name'];}_0x20f9e2[_0xbbb1('0x1a')](_0x38add8)[_0xbbb1('0x27')](_0x2874a4);};}exports[_0xbbb1('0x28')]=function(_0x37de10,_0x2e089c){var _0x41ad71={},_0x34ee10={},_0x5b2de1={'count':0x0,'rows':[]};var _0x1870bd=_[_0xbbb1('0x29')](db['DeskAccount'][_0xbbb1('0x2a')],function(_0x53f0a8){return{'name':_0x53f0a8[_0xbbb1('0x2b')],'type':_0x53f0a8['type'][_0xbbb1('0x2c')]};});_0x34ee10['model']=_[_0xbbb1('0x29')](_0x1870bd,_0xbbb1('0x2d'));_0x34ee10[_0xbbb1('0x2e')]=_[_0xbbb1('0x2f')](_0x37de10[_0xbbb1('0x2e')]);_0x34ee10[_0xbbb1('0x30')]=_[_0xbbb1('0x31')](_0x34ee10[_0xbbb1('0x32')],_0x34ee10['query']);_0x41ad71[_0xbbb1('0x33')]=_[_0xbbb1('0x31')](_0x34ee10['model'],qs[_0xbbb1('0x34')](_0x37de10[_0xbbb1('0x2e')]['fields']));_0x41ad71['attributes']=_0x41ad71[_0xbbb1('0x33')][_0xbbb1('0x35')]?_0x41ad71['attributes']:_0x34ee10['model'];if(!_0x37de10[_0xbbb1('0x2e')][_0xbbb1('0x36')](_0xbbb1('0x37'))){_0x41ad71[_0xbbb1('0x1f')]=qs['limit'](_0x37de10[_0xbbb1('0x2e')]['limit']);_0x41ad71[_0xbbb1('0x1d')]=qs['offset'](_0x37de10['query'][_0xbbb1('0x1d')]);}_0x41ad71[_0xbbb1('0x38')]=qs[_0xbbb1('0x39')](_0x37de10[_0xbbb1('0x2e')][_0xbbb1('0x39')]);_0x41ad71[_0xbbb1('0x3a')]=qs[_0xbbb1('0x30')](_[_0xbbb1('0x3b')](_0x37de10[_0xbbb1('0x2e')],_0x34ee10[_0xbbb1('0x30')]),_0x1870bd);if(_0x37de10[_0xbbb1('0x2e')][_0xbbb1('0x3c')]){_0x41ad71[_0xbbb1('0x3a')]=_[_0xbbb1('0x3d')](_0x41ad71[_0xbbb1('0x3a')],{'$or':_['map'](_0x1870bd,function(_0xa48a71){if(_0xa48a71[_0xbbb1('0x3e')]!=='VIRTUAL'){var _0x1aa99d={};_0x1aa99d[_0xa48a71['name']]={'$like':'%'+_0x37de10['query'][_0xbbb1('0x3c')]+'%'};return _0x1aa99d;}})});}_0x41ad71=_[_0xbbb1('0x3d')]({},_0x41ad71,_0x37de10[_0xbbb1('0x3f')]);var _0x8b635f={'where':_0x41ad71[_0xbbb1('0x3a')]};return db['DeskAccount']['count'](_0x8b635f)[_0xbbb1('0x24')](function(_0x55a298){_0x5b2de1[_0xbbb1('0x20')]=_0x55a298;if(_0x37de10[_0xbbb1('0x2e')][_0xbbb1('0x40')]){_0x41ad71[_0xbbb1('0x41')]=[{'all':!![]}];}return db[_0xbbb1('0x42')][_0xbbb1('0x43')](_0x41ad71);})[_0xbbb1('0x24')](function(_0x429c7e){_0x5b2de1['rows']=_0x429c7e;return _0x5b2de1;})['then'](respondWithFilteredResult(_0x2e089c,_0x41ad71))[_0xbbb1('0x44')](handleError(_0x2e089c,null));};exports[_0xbbb1('0x45')]=function(_0x1db5d9,_0x5953eb){var _0x21374={'raw':![],'where':{'id':_0x1db5d9[_0xbbb1('0x46')]['id']}},_0x9ddeaf={};_0x9ddeaf[_0xbbb1('0x32')]=_['keys'](db[_0xbbb1('0x42')][_0xbbb1('0x2a')]);_0x9ddeaf[_0xbbb1('0x2e')]=_[_0xbbb1('0x2f')](_0x1db5d9[_0xbbb1('0x2e')]);_0x9ddeaf['filters']=_[_0xbbb1('0x31')](_0x9ddeaf[_0xbbb1('0x32')],_0x9ddeaf[_0xbbb1('0x2e')]);_0x21374[_0xbbb1('0x33')]=_[_0xbbb1('0x31')](_0x9ddeaf[_0xbbb1('0x32')],qs[_0xbbb1('0x34')](_0x1db5d9[_0xbbb1('0x2e')][_0xbbb1('0x34')]));_0x21374[_0xbbb1('0x33')]=_0x21374['attributes'][_0xbbb1('0x35')]?_0x21374[_0xbbb1('0x33')]:_0x9ddeaf[_0xbbb1('0x32')];if(_0x1db5d9['query'][_0xbbb1('0x40')]){_0x21374['include']=[{'all':!![]}];}_0x21374=_[_0xbbb1('0x3d')]({},_0x21374,_0x1db5d9[_0xbbb1('0x3f')]);return db[_0xbbb1('0x42')][_0xbbb1('0x47')](_0x21374)[_0xbbb1('0x24')](handleEntityNotFound(_0x5953eb,null))[_0xbbb1('0x24')](respondWithResult(_0x5953eb,null))['catch'](handleError(_0x5953eb,null));};exports['create']=function(_0x4f5a39,_0x243d4b){return db['DeskAccount'][_0xbbb1('0x48')](_0x4f5a39[_0xbbb1('0x49')],{})['then'](respondWithResult(_0x243d4b,0xc9))[_0xbbb1('0x44')](handleError(_0x243d4b,null));};exports['update']=function(_0x57de7c,_0x34009c){if(_0x57de7c[_0xbbb1('0x49')]['id']){delete _0x57de7c[_0xbbb1('0x49')]['id'];}return db[_0xbbb1('0x42')][_0xbbb1('0x47')]({'where':{'id':_0x57de7c[_0xbbb1('0x46')]['id']}})[_0xbbb1('0x24')](handleEntityNotFound(_0x34009c,null))[_0xbbb1('0x24')](saveUpdates(_0x57de7c[_0xbbb1('0x49')],null))[_0xbbb1('0x24')](respondWithResult(_0x34009c,null))[_0xbbb1('0x44')](handleError(_0x34009c,null));};exports[_0xbbb1('0x25')]=function(_0x7f64f7,_0x14c3ae){return db[_0xbbb1('0x42')]['find']({'where':{'id':_0x7f64f7['params']['id']}})[_0xbbb1('0x24')](handleEntityNotFound(_0x14c3ae,null))['then'](removeEntity(_0x14c3ae,null))[_0xbbb1('0x44')](handleError(_0x14c3ae,null));};exports[_0xbbb1('0x4a')]=function(_0x5d94b8,_0x2b5c07,_0x5874a4){var _0x3db9dc={};var _0x3e0800={};var _0x23c222;var _0x1e414f;return db[_0xbbb1('0x42')][_0xbbb1('0x4b')]({'where':{'id':_0x5d94b8[_0xbbb1('0x46')]['id']}})['then'](handleEntityNotFound(_0x2b5c07,null))['then'](function(_0x30a28b){if(_0x30a28b){_0x23c222=_0x30a28b;_0x3e0800['model']=_['keys'](db[_0xbbb1('0x4c')][_0xbbb1('0x2a')]);_0x3e0800[_0xbbb1('0x2e')]=_[_0xbbb1('0x2f')](_0x5d94b8[_0xbbb1('0x2e')]);_0x3e0800[_0xbbb1('0x30')]=_[_0xbbb1('0x31')](_0x3e0800[_0xbbb1('0x32')],_0x3e0800[_0xbbb1('0x2e')]);_0x3db9dc['attributes']=_[_0xbbb1('0x31')](_0x3e0800[_0xbbb1('0x32')],qs[_0xbbb1('0x34')](_0x5d94b8[_0xbbb1('0x2e')][_0xbbb1('0x34')]));_0x3db9dc[_0xbbb1('0x33')]=_0x3db9dc['attributes'][_0xbbb1('0x35')]?_0x3db9dc[_0xbbb1('0x33')]:_0x3e0800['model'];_0x3db9dc[_0xbbb1('0x38')]=qs[_0xbbb1('0x39')](_0x5d94b8[_0xbbb1('0x2e')]['sort']);_0x3db9dc[_0xbbb1('0x3a')]=qs[_0xbbb1('0x30')](_[_0xbbb1('0x3b')](_0x5d94b8['query'],_0x3e0800['filters']));if(_0x5d94b8[_0xbbb1('0x2e')]['filter']){_0x3db9dc['where']=_[_0xbbb1('0x3d')](_0x3db9dc[_0xbbb1('0x3a')],{'$or':_[_0xbbb1('0x29')](_0x3db9dc[_0xbbb1('0x33')],function(_0x4aa160){var _0x3c0a5e={};_0x3c0a5e[_0x4aa160]={'$like':'%'+_0x5d94b8[_0xbbb1('0x2e')][_0xbbb1('0x3c')]+'%'};return _0x3c0a5e;})});}_0x3db9dc=_['merge']({},_0x3db9dc,_0x5d94b8[_0xbbb1('0x3f')]);return _0x23c222['getConfigurations'](_0x3db9dc);}})['then'](function(_0x180a5c){if(_0x180a5c){_0x1e414f=_0x180a5c[_0xbbb1('0x35')];if(!_0x5d94b8[_0xbbb1('0x2e')][_0xbbb1('0x36')]('nolimit')){_0x3db9dc['limit']=qs[_0xbbb1('0x1f')](_0x5d94b8[_0xbbb1('0x2e')][_0xbbb1('0x1f')]);_0x3db9dc['offset']=qs[_0xbbb1('0x1d')](_0x5d94b8[_0xbbb1('0x2e')][_0xbbb1('0x1d')]);}return _0x23c222[_0xbbb1('0x4a')](_0x3db9dc);}})[_0xbbb1('0x24')](function(_0x3fd9a2){if(_0x3fd9a2){return _0x3fd9a2?{'count':_0x1e414f,'rows':_0x3fd9a2}:null;}})[_0xbbb1('0x24')](respondWithResult(_0x2b5c07,null))[_0xbbb1('0x44')](handleError(_0x2b5c07,null));};exports[_0xbbb1('0x4d')]=function(_0x217000,_0x4a6011,_0x1a7e02){if(_0x217000[_0xbbb1('0x49')]['id']){delete _0x217000[_0xbbb1('0x49')]['id'];}return db['DeskAccount'][_0xbbb1('0x4b')]({'where':{'id':_0x217000[_0xbbb1('0x46')]['id']}})['then'](handleEntityNotFound(_0x4a6011,null))['then'](function(_0x5215f2){if(_0x5215f2){_0x217000[_0xbbb1('0x49')][_0xbbb1('0x4e')]=_0x5215f2['id'];_0x217000[_0xbbb1('0x49')]['Subjects']=integrations[_0xbbb1('0x4f')](_0x217000[_0xbbb1('0x49')][_0xbbb1('0x50')],_0x217000[_0xbbb1('0x49')]['type']);_0x217000[_0xbbb1('0x49')][_0xbbb1('0x51')]=integrations[_0xbbb1('0x52')](_0x217000['body'][_0xbbb1('0x50')],_0x217000['body'][_0xbbb1('0x3e')]);return db[_0xbbb1('0x4c')][_0xbbb1('0x48')](_0x217000[_0xbbb1('0x49')],{'include':[{'model':db[_0xbbb1('0x53')],'as':_0xbbb1('0x54')},{'model':db[_0xbbb1('0x53')],'as':_0xbbb1('0x51')}]});}return null;})[_0xbbb1('0x24')](respondWithResult(_0x4a6011,null))['catch'](handleError(_0x4a6011,null));};exports['getFields']=function(_0x38ba1f,_0x754411,_0x39a3fc){var _0x27e65e=[{'name':_0xbbb1('0x55'),'label':_0xbbb1('0x55'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0xed737f='';return db['DeskAccount'][_0xbbb1('0x4b')]({'where':{'id':_0x38ba1f['params']['id']},'attributes':['id',_0xbbb1('0x56'),_0xbbb1('0x57'),_0xbbb1('0x58'),_0xbbb1('0x59'),_0xbbb1('0x5a'),'consumerSecret',_0xbbb1('0x5b'),_0xbbb1('0x5c')]})[_0xbbb1('0x24')](handleEntityNotFound(_0x754411,null))[_0xbbb1('0x24')](function(_0x18ca58){if(_0x18ca58){_0xed737f=_0x18ca58[_0xbbb1('0x56')];var _0xeee7ab=_0xed737f[_0xbbb1('0x5d')](-0x1);if(_0xeee7ab==='/'){_0xed737f=_0xed737f[_0xbbb1('0x5e')](0x0,_0xed737f[_0xbbb1('0x5f')](_0xeee7ab));}var _0x5c80fa={'method':'GET','uri':util[_0xbbb1('0x60')](_0xbbb1('0x61'),_0xed737f),'headers':{'Content-Type':_0xbbb1('0x62'),'Accept':_0xbbb1('0x62')},'json':!![]};if(_0x18ca58['authType']===_0xbbb1('0x63')){_0x5c80fa[_0xbbb1('0x64')][_0xbbb1('0x65')]=util[_0xbbb1('0x60')](_0xbbb1('0x66'),new Buffer(util['format'](_0xbbb1('0x67'),_0x18ca58['username'],_0x18ca58[_0xbbb1('0x59')]))[_0xbbb1('0x68')](_0xbbb1('0x69')));}return rp(_0x5c80fa)[_0xbbb1('0x24')](function(_0x5944d6){return _0x27e65e[_0xbbb1('0x6a')](_[_0xbbb1('0x29')](_0x5944d6['_embedded'][_0xbbb1('0x6b')],function(_0x4fb76b){return{'id':_0x4fb76b['name'],'name':_0x4fb76b[_0xbbb1('0x2d')],'type':_0x4fb76b[_0xbbb1('0x3e')],'active':_0x4fb76b[_0xbbb1('0x6c')],'label':_0x4fb76b[_0xbbb1('0x6d')],'custom':!![]};}));});}})[_0xbbb1('0x24')](function(_0x5730f8){return{'count':_0x5730f8['length'],'rows':_0x5730f8};})[_0xbbb1('0x24')](respondWithResult(_0x754411,null))[_0xbbb1('0x44')](function(_0x349c11){var _0x19861b=_0x38ba1f[_0xbbb1('0x2e')]['test']?0x1f4:_0x349c11['statusCode']||0x1f4;logger[_0xbbb1('0x6e')](_0xbbb1('0x6f'),_0xbbb1('0x70'),_0x19861b,JSON[_0xbbb1('0x71')](_0x349c11));delete _0x349c11[_0xbbb1('0x2d')];if(_0x19861b===0x191){_0x19861b=0x190;}_0x754411[_0xbbb1('0x1a')](_0x19861b)[_0xbbb1('0x27')](_0x38ba1f[_0xbbb1('0x2e')][_0xbbb1('0x72')]?{'message':_0xbbb1('0x73'),'statusCode':_0x349c11['statusCode']}:_0x349c11);});}; \ No newline at end of file +var _0x7d62=['include','findAll','rows','catch','show','params','length','options','create','body','find','destroy','getConfigurations','findOne','DeskConfiguration','order','filter','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','DeskField','getFields','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','toString','_embedded','entries','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','end','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','merge','includeAll'];(function(_0x2f7cc0,_0xa7ddc9){var _0x42ac73=function(_0x4d41d7){while(--_0x4d41d7){_0x2f7cc0['push'](_0x2f7cc0['shift']());}};_0x42ac73(++_0xa7ddc9);}(_0x7d62,0xa2));var _0x27d6=function(_0x25a2cd,_0x347f8b){_0x25a2cd=_0x25a2cd-0x0;var _0xfebeb7=_0x7d62[_0x25a2cd];return _0xfebeb7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27d6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x27d6('0x1'));var rp=require(_0x27d6('0x2'));var moment=require(_0x27d6('0x3'));var BPromise=require(_0x27d6('0x4'));var Mustache=require(_0x27d6('0x5'));var util=require(_0x27d6('0x6'));var path=require(_0x27d6('0x7'));var sox=require(_0x27d6('0x8'));var csv=require(_0x27d6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x27d6('0xa'));var squel=require(_0x27d6('0xb'));var crypto=require(_0x27d6('0xc'));var jsforce=require(_0x27d6('0xd'));var deskjs=require(_0x27d6('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x27d6('0xf'));var qs=require(_0x27d6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x27d6('0x11'));var utils=require(_0x27d6('0x12'));var config=require(_0x27d6('0x13'));var licenseUtil=require(_0x27d6('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x27d6('0x15'));function respondWithStatusCode(_0x32b125,_0x4d1ab7){_0x4d1ab7=_0x4d1ab7||0xcc;return function(_0x413a8c){if(_0x413a8c){return _0x32b125[_0x27d6('0x16')](_0x4d1ab7);}return _0x32b125[_0x27d6('0x17')](_0x4d1ab7)['end']();};}function respondWithResult(_0x1e993b,_0x405c31){_0x405c31=_0x405c31||0xc8;return function(_0x180828){if(_0x180828){return _0x1e993b[_0x27d6('0x17')](_0x405c31)[_0x27d6('0x18')](_0x180828);}};}function respondWithFilteredResult(_0x45fafe,_0x4f56af){return function(_0x58fd2d){if(_0x58fd2d){var _0x37500a=typeof _0x4f56af['offset']===_0x27d6('0x19')&&typeof _0x4f56af[_0x27d6('0x1a')]===_0x27d6('0x19');var _0x1a4e00=_0x58fd2d[_0x27d6('0x1b')];var _0x2c9780=_0x37500a?0x0:_0x4f56af[_0x27d6('0x1c')];var _0x4cd4c4=_0x37500a?_0x58fd2d['count']:_0x4f56af[_0x27d6('0x1c')]+_0x4f56af[_0x27d6('0x1a')];var _0x1d9095;if(_0x4cd4c4>=_0x1a4e00){_0x4cd4c4=_0x1a4e00;_0x1d9095=0xc8;}else{_0x1d9095=0xce;}_0x45fafe['status'](_0x1d9095);return _0x45fafe[_0x27d6('0x1d')]('Content-Range',_0x2c9780+'-'+_0x4cd4c4+'/'+_0x1a4e00)[_0x27d6('0x18')](_0x58fd2d);}return null;};}function patchUpdates(_0x1662bd){return function(_0x2dded0){try{jsonpatch[_0x27d6('0x1e')](_0x2dded0,_0x1662bd,!![]);}catch(_0x45fe42){return BPromise[_0x27d6('0x1f')](_0x45fe42);}return _0x2dded0[_0x27d6('0x20')]();};}function saveUpdates(_0x1a8e83,_0x160245){return function(_0x47f066){if(_0x47f066){return _0x47f066[_0x27d6('0x21')](_0x1a8e83)['then'](function(_0x34e493){return _0x34e493;});}return null;};}function removeEntity(_0x187450,_0x493e1c){return function(_0x1ef829){if(_0x1ef829){return _0x1ef829['destroy']()[_0x27d6('0x22')](function(){_0x187450['status'](0xcc)[_0x27d6('0x23')]();});}};}function handleEntityNotFound(_0xde52b,_0xb4001b){return function(_0x5db550){if(!_0x5db550){_0xde52b[_0x27d6('0x16')](0x194);}return _0x5db550;};}function handleError(_0x3ce490,_0x13d06f){_0x13d06f=_0x13d06f||0x1f4;return function(_0x5d911f){logger[_0x27d6('0x24')](_0x5d911f[_0x27d6('0x25')]);if(_0x5d911f[_0x27d6('0x26')]){delete _0x5d911f[_0x27d6('0x26')];}_0x3ce490[_0x27d6('0x17')](_0x13d06f)[_0x27d6('0x27')](_0x5d911f);};}exports[_0x27d6('0x28')]=function(_0x566b92,_0x238aa6){var _0x64d944={},_0x15e14e={},_0x1f63d5={'count':0x0,'rows':[]};var _0x50dde8=_[_0x27d6('0x29')](db[_0x27d6('0x2a')][_0x27d6('0x2b')],function(_0x57952c){return{'name':_0x57952c[_0x27d6('0x2c')],'type':_0x57952c['type'][_0x27d6('0x2d')]};});_0x15e14e[_0x27d6('0x2e')]=_[_0x27d6('0x29')](_0x50dde8,_0x27d6('0x26'));_0x15e14e[_0x27d6('0x2f')]=_[_0x27d6('0x30')](_0x566b92[_0x27d6('0x2f')]);_0x15e14e[_0x27d6('0x31')]=_[_0x27d6('0x32')](_0x15e14e[_0x27d6('0x2e')],_0x15e14e[_0x27d6('0x2f')]);_0x64d944['attributes']=_['intersection'](_0x15e14e[_0x27d6('0x2e')],qs[_0x27d6('0x33')](_0x566b92['query'][_0x27d6('0x33')]));_0x64d944[_0x27d6('0x34')]=_0x64d944['attributes']['length']?_0x64d944[_0x27d6('0x34')]:_0x15e14e[_0x27d6('0x2e')];if(!_0x566b92['query'][_0x27d6('0x35')](_0x27d6('0x36'))){_0x64d944[_0x27d6('0x1a')]=qs['limit'](_0x566b92[_0x27d6('0x2f')]['limit']);_0x64d944['offset']=qs[_0x27d6('0x1c')](_0x566b92['query']['offset']);}_0x64d944['order']=qs[_0x27d6('0x37')](_0x566b92[_0x27d6('0x2f')]['sort']);_0x64d944[_0x27d6('0x38')]=qs[_0x27d6('0x31')](_[_0x27d6('0x39')](_0x566b92['query'],_0x15e14e['filters']),_0x50dde8);if(_0x566b92['query']['filter']){_0x64d944[_0x27d6('0x38')]=_['merge'](_0x64d944[_0x27d6('0x38')],{'$or':_[_0x27d6('0x29')](_0x50dde8,function(_0x4cfee){if(_0x4cfee[_0x27d6('0x3a')]!==_0x27d6('0x3b')){var _0x40892a={};_0x40892a[_0x4cfee[_0x27d6('0x26')]]={'$like':'%'+_0x566b92['query']['filter']+'%'};return _0x40892a;}})});}_0x64d944=_[_0x27d6('0x3c')]({},_0x64d944,_0x566b92['options']);var _0x1c0048={'where':_0x64d944['where']};return db[_0x27d6('0x2a')]['count'](_0x1c0048)['then'](function(_0x4fd988){_0x1f63d5[_0x27d6('0x1b')]=_0x4fd988;if(_0x566b92[_0x27d6('0x2f')][_0x27d6('0x3d')]){_0x64d944[_0x27d6('0x3e')]=[{'all':!![]}];}return db['DeskAccount'][_0x27d6('0x3f')](_0x64d944);})[_0x27d6('0x22')](function(_0x91a51f){_0x1f63d5[_0x27d6('0x40')]=_0x91a51f;return _0x1f63d5;})[_0x27d6('0x22')](respondWithFilteredResult(_0x238aa6,_0x64d944))[_0x27d6('0x41')](handleError(_0x238aa6,null));};exports[_0x27d6('0x42')]=function(_0x401929,_0x2d1132){var _0x2c5602={'raw':![],'where':{'id':_0x401929[_0x27d6('0x43')]['id']}},_0x59535c={};_0x59535c[_0x27d6('0x2e')]=_['keys'](db[_0x27d6('0x2a')]['rawAttributes']);_0x59535c[_0x27d6('0x2f')]=_[_0x27d6('0x30')](_0x401929[_0x27d6('0x2f')]);_0x59535c[_0x27d6('0x31')]=_['intersection'](_0x59535c[_0x27d6('0x2e')],_0x59535c['query']);_0x2c5602[_0x27d6('0x34')]=_[_0x27d6('0x32')](_0x59535c[_0x27d6('0x2e')],qs[_0x27d6('0x33')](_0x401929[_0x27d6('0x2f')][_0x27d6('0x33')]));_0x2c5602[_0x27d6('0x34')]=_0x2c5602[_0x27d6('0x34')][_0x27d6('0x44')]?_0x2c5602[_0x27d6('0x34')]:_0x59535c[_0x27d6('0x2e')];if(_0x401929[_0x27d6('0x2f')]['includeAll']){_0x2c5602[_0x27d6('0x3e')]=[{'all':!![]}];}_0x2c5602=_['merge']({},_0x2c5602,_0x401929[_0x27d6('0x45')]);return db[_0x27d6('0x2a')]['find'](_0x2c5602)[_0x27d6('0x22')](handleEntityNotFound(_0x2d1132,null))[_0x27d6('0x22')](respondWithResult(_0x2d1132,null))[_0x27d6('0x41')](handleError(_0x2d1132,null));};exports['create']=function(_0x27f0a9,_0x4adfa2){return db[_0x27d6('0x2a')][_0x27d6('0x46')](_0x27f0a9[_0x27d6('0x47')],{})[_0x27d6('0x22')](respondWithResult(_0x4adfa2,0xc9))[_0x27d6('0x41')](handleError(_0x4adfa2,null));};exports['update']=function(_0x2af65c,_0x32548e){if(_0x2af65c[_0x27d6('0x47')]['id']){delete _0x2af65c[_0x27d6('0x47')]['id'];}return db[_0x27d6('0x2a')][_0x27d6('0x48')]({'where':{'id':_0x2af65c[_0x27d6('0x43')]['id']}})[_0x27d6('0x22')](handleEntityNotFound(_0x32548e,null))[_0x27d6('0x22')](saveUpdates(_0x2af65c[_0x27d6('0x47')],null))[_0x27d6('0x22')](respondWithResult(_0x32548e,null))[_0x27d6('0x41')](handleError(_0x32548e,null));};exports[_0x27d6('0x49')]=function(_0x52bf71,_0x1bbf91){return db[_0x27d6('0x2a')][_0x27d6('0x48')]({'where':{'id':_0x52bf71[_0x27d6('0x43')]['id']}})[_0x27d6('0x22')](handleEntityNotFound(_0x1bbf91,null))[_0x27d6('0x22')](removeEntity(_0x1bbf91,null))[_0x27d6('0x41')](handleError(_0x1bbf91,null));};exports[_0x27d6('0x4a')]=function(_0x265cb6,_0x51e825,_0x482ccf){var _0x578818={};var _0x515825={};var _0x32d03a;var _0x1dce94;return db['DeskAccount'][_0x27d6('0x4b')]({'where':{'id':_0x265cb6[_0x27d6('0x43')]['id']}})[_0x27d6('0x22')](handleEntityNotFound(_0x51e825,null))['then'](function(_0x16a90b){if(_0x16a90b){_0x32d03a=_0x16a90b;_0x515825['model']=_[_0x27d6('0x30')](db[_0x27d6('0x4c')][_0x27d6('0x2b')]);_0x515825['query']=_['keys'](_0x265cb6[_0x27d6('0x2f')]);_0x515825[_0x27d6('0x31')]=_[_0x27d6('0x32')](_0x515825[_0x27d6('0x2e')],_0x515825['query']);_0x578818['attributes']=_[_0x27d6('0x32')](_0x515825[_0x27d6('0x2e')],qs[_0x27d6('0x33')](_0x265cb6['query'][_0x27d6('0x33')]));_0x578818[_0x27d6('0x34')]=_0x578818[_0x27d6('0x34')][_0x27d6('0x44')]?_0x578818['attributes']:_0x515825[_0x27d6('0x2e')];_0x578818[_0x27d6('0x4d')]=qs[_0x27d6('0x37')](_0x265cb6['query'][_0x27d6('0x37')]);_0x578818[_0x27d6('0x38')]=qs['filters'](_[_0x27d6('0x39')](_0x265cb6[_0x27d6('0x2f')],_0x515825[_0x27d6('0x31')]));if(_0x265cb6[_0x27d6('0x2f')][_0x27d6('0x4e')]){_0x578818['where']=_[_0x27d6('0x3c')](_0x578818[_0x27d6('0x38')],{'$or':_[_0x27d6('0x29')](_0x578818['attributes'],function(_0x1cbe4f){var _0x16fd12={};_0x16fd12[_0x1cbe4f]={'$like':'%'+_0x265cb6[_0x27d6('0x2f')][_0x27d6('0x4e')]+'%'};return _0x16fd12;})});}_0x578818=_[_0x27d6('0x3c')]({},_0x578818,_0x265cb6[_0x27d6('0x45')]);return _0x32d03a[_0x27d6('0x4a')](_0x578818);}})[_0x27d6('0x22')](function(_0x1ee3d3){if(_0x1ee3d3){_0x1dce94=_0x1ee3d3[_0x27d6('0x44')];if(!_0x265cb6[_0x27d6('0x2f')][_0x27d6('0x35')](_0x27d6('0x36'))){_0x578818[_0x27d6('0x1a')]=qs[_0x27d6('0x1a')](_0x265cb6['query']['limit']);_0x578818[_0x27d6('0x1c')]=qs[_0x27d6('0x1c')](_0x265cb6[_0x27d6('0x2f')][_0x27d6('0x1c')]);}return _0x32d03a[_0x27d6('0x4a')](_0x578818);}})[_0x27d6('0x22')](function(_0xef0b38){if(_0xef0b38){return _0xef0b38?{'count':_0x1dce94,'rows':_0xef0b38}:null;}})['then'](respondWithResult(_0x51e825,null))[_0x27d6('0x41')](handleError(_0x51e825,null));};exports[_0x27d6('0x4f')]=function(_0xc71bf0,_0x4a36fa,_0x989526){if(_0xc71bf0['body']['id']){delete _0xc71bf0[_0x27d6('0x47')]['id'];}return db[_0x27d6('0x2a')][_0x27d6('0x4b')]({'where':{'id':_0xc71bf0[_0x27d6('0x43')]['id']}})[_0x27d6('0x22')](handleEntityNotFound(_0x4a36fa,null))[_0x27d6('0x22')](function(_0x3bafab){if(_0x3bafab){_0xc71bf0[_0x27d6('0x47')][_0x27d6('0x50')]=_0x3bafab['id'];_0xc71bf0[_0x27d6('0x47')][_0x27d6('0x51')]=integrations['getSubjects'](_0xc71bf0[_0x27d6('0x47')]['channel'],_0xc71bf0[_0x27d6('0x47')][_0x27d6('0x3a')]);_0xc71bf0[_0x27d6('0x47')][_0x27d6('0x52')]=integrations[_0x27d6('0x53')](_0xc71bf0[_0x27d6('0x47')][_0x27d6('0x54')],_0xc71bf0[_0x27d6('0x47')][_0x27d6('0x3a')]);return db[_0x27d6('0x4c')][_0x27d6('0x46')](_0xc71bf0[_0x27d6('0x47')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db[_0x27d6('0x55')],'as':'Descriptions'}]});}return null;})[_0x27d6('0x22')](respondWithResult(_0x4a36fa,null))['catch'](handleError(_0x4a36fa,null));};exports[_0x27d6('0x56')]=function(_0x258e69,_0x1c15fa,_0x9c1fd4){var _0x2f9d98=[{'name':'priority','label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x60d7d3='';return db['DeskAccount']['findOne']({'where':{'id':_0x258e69['params']['id']},'attributes':['id',_0x27d6('0x57'),_0x27d6('0x58'),_0x27d6('0x59'),_0x27d6('0x5a'),_0x27d6('0x5b'),_0x27d6('0x5c'),_0x27d6('0x5d'),_0x27d6('0x5e')]})['then'](handleEntityNotFound(_0x1c15fa,null))[_0x27d6('0x22')](function(_0x49a829){if(_0x49a829){_0x60d7d3=_0x49a829['remoteUri'];var _0x53e632=_0x60d7d3['slice'](-0x1);if(_0x53e632==='/'){_0x60d7d3=_0x60d7d3[_0x27d6('0x5f')](0x0,_0x60d7d3[_0x27d6('0x60')](_0x53e632));}var _0x1a6d25={'method':_0x27d6('0x61'),'uri':util[_0x27d6('0x62')](_0x27d6('0x63'),_0x60d7d3),'headers':{'Content-Type':_0x27d6('0x64'),'Accept':_0x27d6('0x64')},'json':!![]};if(_0x49a829[_0x27d6('0x58')]===_0x27d6('0x65')){_0x1a6d25[_0x27d6('0x66')][_0x27d6('0x67')]=util[_0x27d6('0x62')](_0x27d6('0x68'),new Buffer(util['format']('%s:%s',_0x49a829[_0x27d6('0x59')],_0x49a829['password']))[_0x27d6('0x69')]('base64'));}return rp(_0x1a6d25)['then'](function(_0x5c3b8a){return _0x2f9d98['concat'](_[_0x27d6('0x29')](_0x5c3b8a[_0x27d6('0x6a')][_0x27d6('0x6b')],function(_0x1da2de){return{'id':_0x1da2de[_0x27d6('0x26')],'name':_0x1da2de['name'],'type':_0x1da2de[_0x27d6('0x3a')],'active':_0x1da2de[_0x27d6('0x6c')],'label':_0x1da2de['label'],'custom':!![]};}));});}})['then'](function(_0x303ec0){return{'count':_0x303ec0[_0x27d6('0x44')],'rows':_0x303ec0};})[_0x27d6('0x22')](respondWithResult(_0x1c15fa,null))[_0x27d6('0x41')](function(_0x17705a){var _0x19ea94=_0x258e69['query'][_0x27d6('0x6d')]?0x1f4:_0x17705a[_0x27d6('0x6e')]||0x1f4;logger[_0x27d6('0x24')](_0x27d6('0x6f'),'getFields',_0x19ea94,JSON['stringify'](_0x17705a));delete _0x17705a[_0x27d6('0x26')];if(_0x19ea94===0x191){_0x19ea94=0x190;}_0x1c15fa[_0x27d6('0x17')](_0x19ea94)[_0x27d6('0x27')](_0x258e69[_0x27d6('0x2f')][_0x27d6('0x6d')]?{'message':'Wrong\x20credentials','statusCode':_0x17705a[_0x27d6('0x6e')]}:_0x17705a);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 2f30585..4d8e28a 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 _0xd620=['DeskAccount','lodash','api','moment','bluebird','request-promise','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0xe4f9bc,_0x4ff501){var _0x1fc872=function(_0x3751aa){while(--_0x3751aa){_0xe4f9bc['push'](_0xe4f9bc['shift']());}};_0x1fc872(++_0x4ff501);}(_0xd620,0x6d));var _0x0d62=function(_0x1ffb9a,_0x2fa189){_0x1ffb9a=_0x1ffb9a-0x0;var _0x340e9d=_0xd620[_0x1ffb9a];return _0x340e9d;};'use strict';var _=require(_0x0d62('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0d62('0x1'));var moment=require(_0x0d62('0x2'));var BPromise=require(_0x0d62('0x3'));var rp=require(_0x0d62('0x4'));var fs=require('fs');var path=require(_0x0d62('0x5'));var rimraf=require(_0x0d62('0x6'));var config=require('../../config/environment');var attributes=require(_0x0d62('0x7'));var integrations=require(_0x0d62('0x8'));module[_0x0d62('0x9')]=function(_0x41be9f,_0x513f40){return _0x41be9f[_0x0d62('0xa')](_0x0d62('0xb'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x285b=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x8fa535,_0x4243a9){var _0xb7265d=function(_0x1b9787){while(--_0x1b9787){_0x8fa535['push'](_0x8fa535['shift']());}};_0xb7265d(++_0x4243a9);}(_0x285b,0x90));var _0xb285=function(_0x2223b5,_0xef4e77){_0x2223b5=_0x2223b5-0x0;var _0x8cf3ac=_0x285b[_0x2223b5];return _0x8cf3ac;};'use strict';var _=require(_0xb285('0x0'));var util=require('util');var logger=require(_0xb285('0x1'))(_0xb285('0x2'));var moment=require(_0xb285('0x3'));var BPromise=require(_0xb285('0x4'));var rp=require(_0xb285('0x5'));var fs=require('fs');var path=require(_0xb285('0x6'));var rimraf=require('rimraf');var config=require(_0xb285('0x7'));var attributes=require(_0xb285('0x8'));var integrations=require(_0xb285('0x9'));module[_0xb285('0xa')]=function(_0x59890a,_0x276d35){return _0x59890a[_0xb285('0xb')]('DeskAccount',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 f713a01..d52c8cd 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 _0x2604=['catch','DeskAccount','findAll','options','where','attributes','limit','include','map','model','GetDeskAccount','find','raw','ShowDeskAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x1025fd,_0x53f59f){var _0x3497d5=function(_0x2a1f87){while(--_0x2a1f87){_0x1025fd['push'](_0x1025fd['shift']());}};_0x3497d5(++_0x53f59f);}(_0x2604,0x18f));var _0x4260=function(_0x29306a,_0x6d81b3){_0x29306a=_0x29306a-0x0;var _0xb06f31=_0x2604[_0x29306a];return _0xb06f31;};'use strict';var _=require(_0x4260('0x0'));var util=require(_0x4260('0x1'));var moment=require(_0x4260('0x2'));var BPromise=require(_0x4260('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4260('0x4'))['db'];var utils=require(_0x4260('0x5'));var logger=require(_0x4260('0x6'))(_0x4260('0x7'));var config=require(_0x4260('0x8'));var jayson=require(_0x4260('0x9'));var client=jayson['client'][_0x4260('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x185945,_0x45e432,_0x380723){return new BPromise(function(_0x1f737a,_0x229e22){return client[_0x4260('0xb')](_0x185945,_0x380723)[_0x4260('0xc')](function(_0x29609d){logger[_0x4260('0xd')](_0x4260('0xe'),_0x45e432,_0x4260('0xf'));logger[_0x4260('0x10')](_0x4260('0x11'),_0x45e432,_0x4260('0xf'),JSON[_0x4260('0x12')](_0x29609d));if(_0x29609d[_0x4260('0x13')]){if(_0x29609d[_0x4260('0x13')]['code']===0x1f4){logger[_0x4260('0x13')](_0x4260('0xe'),_0x45e432,_0x29609d['error'][_0x4260('0x14')]);return _0x229e22(_0x29609d[_0x4260('0x13')][_0x4260('0x14')]);}logger['error'](_0x4260('0xe'),_0x45e432,_0x29609d[_0x4260('0x13')]['message']);return _0x1f737a(_0x29609d[_0x4260('0x13')][_0x4260('0x14')]);}else{logger['info'](_0x4260('0xe'),_0x45e432,_0x4260('0xf'));_0x1f737a(_0x29609d['result'][_0x4260('0x14')]);}})[_0x4260('0x15')](function(_0x141617){logger[_0x4260('0x13')]('DeskAccount,\x20%s,\x20%s',_0x45e432,_0x141617);_0x229e22(_0x141617);});});}exports['GetDeskAccount']=function(_0x9e4d45){var _0xc39754=this;return new Promise(function(_0x44be03,_0x591a5f){return db[_0x4260('0x16')][_0x4260('0x17')]({'raw':_0x9e4d45[_0x4260('0x18')]?_0x9e4d45[_0x4260('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x9e4d45['options']?_0x9e4d45['options'][_0x4260('0x19')]||null:null,'attributes':_0x9e4d45['options']?_0x9e4d45[_0x4260('0x18')][_0x4260('0x1a')]||null:null,'limit':_0x9e4d45['options']?_0x9e4d45[_0x4260('0x18')][_0x4260('0x1b')]||null:null,'include':_0x9e4d45[_0x4260('0x18')]?_0x9e4d45['options'][_0x4260('0x1c')]?_[_0x4260('0x1d')](_0x9e4d45[_0x4260('0x18')][_0x4260('0x1c')],function(_0x411663){return{'model':db[_0x411663[_0x4260('0x1e')]],'as':_0x411663['as'],'attributes':_0x411663[_0x4260('0x1a')],'include':_0x411663['include']?_[_0x4260('0x1d')](_0x411663[_0x4260('0x1c')],function(_0x248165){return{'model':db[_0x248165['model']],'as':_0x248165['as'],'attributes':_0x248165[_0x4260('0x1a')],'include':_0x248165[_0x4260('0x1c')]?_[_0x4260('0x1d')](_0x248165['include'],function(_0x39d392){return{'model':db[_0x39d392[_0x4260('0x1e')]],'as':_0x39d392['as'],'attributes':_0x39d392['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x169a13){logger[_0x4260('0xd')]('GetDeskAccount',_0x9e4d45);logger[_0x4260('0x10')]('GetDeskAccount',_0x9e4d45,JSON['stringify'](_0x169a13));_0x44be03(_0x169a13);})['catch'](function(_0x19694e){logger[_0x4260('0x13')](_0x4260('0x1f'),_0x19694e[_0x4260('0x14')],_0x9e4d45);_0x591a5f(_0xc39754[_0x4260('0x13')](0x1f4,_0x19694e[_0x4260('0x14')]));});});};exports['ShowDeskAccount']=function(_0x37bc16){var _0x5cc3ef=this;return new Promise(function(_0x448594,_0x405356){return db[_0x4260('0x16')][_0x4260('0x20')]({'raw':_0x37bc16['options']?_0x37bc16[_0x4260('0x18')][_0x4260('0x21')]===undefined?!![]:![]:!![],'where':_0x37bc16[_0x4260('0x18')]?_0x37bc16['options'][_0x4260('0x19')]||null:null,'attributes':_0x37bc16['options']?_0x37bc16['options'][_0x4260('0x1a')]||null:null,'include':_0x37bc16['options']?_0x37bc16['options']['include']?_[_0x4260('0x1d')](_0x37bc16[_0x4260('0x18')][_0x4260('0x1c')],function(_0x51dacf){return{'model':db[_0x51dacf[_0x4260('0x1e')]],'as':_0x51dacf['as'],'attributes':_0x51dacf['attributes'],'include':_0x51dacf[_0x4260('0x1c')]?_['map'](_0x51dacf['include'],function(_0x83a525){return{'model':db[_0x83a525[_0x4260('0x1e')]],'as':_0x83a525['as'],'attributes':_0x83a525[_0x4260('0x1a')],'include':_0x83a525[_0x4260('0x1c')]?_[_0x4260('0x1d')](_0x83a525[_0x4260('0x1c')],function(_0x2eb843){return{'model':db[_0x2eb843['model']],'as':_0x2eb843['as'],'attributes':_0x2eb843[_0x4260('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d8d9f){logger['info'](_0x4260('0x22'),_0x37bc16);logger[_0x4260('0x10')](_0x4260('0x22'),_0x37bc16,JSON[_0x4260('0x12')](_0x2d8d9f));_0x448594(_0x2d8d9f);})[_0x4260('0x15')](function(_0x47feab){logger[_0x4260('0x13')](_0x4260('0x22'),_0x47feab[_0x4260('0x14')],_0x37bc16);_0x405356(_0x5cc3ef[_0x4260('0x13')](0x1f4,_0x47feab[_0x4260('0x14')]));});});}; \ No newline at end of file +var _0x9369=['info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetDeskAccount','findAll','options','raw','include','map','model','attributes','stringify','ShowDeskAccount','DeskAccount','find','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9369,0x181));var _0x9936=function(_0x397db8,_0x5658b4){_0x397db8=_0x397db8-0x0;var _0x505815=_0x9369[_0x397db8];return _0x505815;};'use strict';var _=require(_0x9936('0x0'));var util=require(_0x9936('0x1'));var moment=require('moment');var BPromise=require(_0x9936('0x2'));var rs=require(_0x9936('0x3'));var fs=require('fs');var Redis=require(_0x9936('0x4'));var db=require(_0x9936('0x5'))['db'];var utils=require(_0x9936('0x6'));var logger=require(_0x9936('0x7'))(_0x9936('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x12a2d0,_0x275473,_0x346cf8){return new BPromise(function(_0x2cf983,_0x18e5b4){return client[_0x9936('0x9')](_0x12a2d0,_0x346cf8)[_0x9936('0xa')](function(_0x16a967){logger[_0x9936('0xb')](_0x9936('0xc'),_0x275473,_0x9936('0xd'));logger[_0x9936('0xe')](_0x9936('0xf'),_0x275473,'request\x20sent',JSON['stringify'](_0x16a967));if(_0x16a967[_0x9936('0x10')]){if(_0x16a967[_0x9936('0x10')]['code']===0x1f4){logger[_0x9936('0x10')]('DeskAccount,\x20%s,\x20%s',_0x275473,_0x16a967[_0x9936('0x10')][_0x9936('0x11')]);return _0x18e5b4(_0x16a967[_0x9936('0x10')][_0x9936('0x11')]);}logger['error'](_0x9936('0xc'),_0x275473,_0x16a967[_0x9936('0x10')][_0x9936('0x11')]);return _0x2cf983(_0x16a967[_0x9936('0x10')][_0x9936('0x11')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x275473,_0x9936('0xd'));_0x2cf983(_0x16a967[_0x9936('0x12')][_0x9936('0x11')]);}})[_0x9936('0x13')](function(_0x5bb5f3){logger[_0x9936('0x10')](_0x9936('0xc'),_0x275473,_0x5bb5f3);_0x18e5b4(_0x5bb5f3);});});}exports[_0x9936('0x14')]=function(_0x3d6cd6){var _0x1d79c0=this;return new Promise(function(_0x5a52e5,_0x2538f0){return db['DeskAccount'][_0x9936('0x15')]({'raw':_0x3d6cd6[_0x9936('0x16')]?_0x3d6cd6[_0x9936('0x16')][_0x9936('0x17')]===undefined?!![]:![]:!![],'where':_0x3d6cd6['options']?_0x3d6cd6[_0x9936('0x16')]['where']||null:null,'attributes':_0x3d6cd6[_0x9936('0x16')]?_0x3d6cd6[_0x9936('0x16')]['attributes']||null:null,'limit':_0x3d6cd6[_0x9936('0x16')]?_0x3d6cd6[_0x9936('0x16')]['limit']||null:null,'include':_0x3d6cd6['options']?_0x3d6cd6[_0x9936('0x16')][_0x9936('0x18')]?_[_0x9936('0x19')](_0x3d6cd6[_0x9936('0x16')][_0x9936('0x18')],function(_0xbdcb93){return{'model':db[_0xbdcb93[_0x9936('0x1a')]],'as':_0xbdcb93['as'],'attributes':_0xbdcb93[_0x9936('0x1b')],'include':_0xbdcb93[_0x9936('0x18')]?_['map'](_0xbdcb93[_0x9936('0x18')],function(_0x211ca0){return{'model':db[_0x211ca0[_0x9936('0x1a')]],'as':_0x211ca0['as'],'attributes':_0x211ca0[_0x9936('0x1b')],'include':_0x211ca0['include']?_['map'](_0x211ca0[_0x9936('0x18')],function(_0x10c140){return{'model':db[_0x10c140[_0x9936('0x1a')]],'as':_0x10c140['as'],'attributes':_0x10c140['attributes']};}):[]};}):[]};}):[]:[]})[_0x9936('0xa')](function(_0x217c55){logger['info']('GetDeskAccount',_0x3d6cd6);logger[_0x9936('0xe')](_0x9936('0x14'),_0x3d6cd6,JSON[_0x9936('0x1c')](_0x217c55));_0x5a52e5(_0x217c55);})[_0x9936('0x13')](function(_0x59e80c){logger['error']('GetDeskAccount',_0x59e80c['message'],_0x3d6cd6);_0x2538f0(_0x1d79c0['error'](0x1f4,_0x59e80c['message']));});});};exports[_0x9936('0x1d')]=function(_0x2cc686){var _0x125af4=this;return new Promise(function(_0x288dba,_0x141d41){return db[_0x9936('0x1e')][_0x9936('0x1f')]({'raw':_0x2cc686[_0x9936('0x16')]?_0x2cc686[_0x9936('0x16')][_0x9936('0x17')]===undefined?!![]:![]:!![],'where':_0x2cc686[_0x9936('0x16')]?_0x2cc686[_0x9936('0x16')][_0x9936('0x20')]||null:null,'attributes':_0x2cc686[_0x9936('0x16')]?_0x2cc686[_0x9936('0x16')][_0x9936('0x1b')]||null:null,'include':_0x2cc686[_0x9936('0x16')]?_0x2cc686[_0x9936('0x16')][_0x9936('0x18')]?_['map'](_0x2cc686['options'][_0x9936('0x18')],function(_0x51dd8a){return{'model':db[_0x51dd8a[_0x9936('0x1a')]],'as':_0x51dd8a['as'],'attributes':_0x51dd8a[_0x9936('0x1b')],'include':_0x51dd8a[_0x9936('0x18')]?_['map'](_0x51dd8a[_0x9936('0x18')],function(_0x412ca2){return{'model':db[_0x412ca2['model']],'as':_0x412ca2['as'],'attributes':_0x412ca2[_0x9936('0x1b')],'include':_0x412ca2[_0x9936('0x18')]?_[_0x9936('0x19')](_0x412ca2[_0x9936('0x18')],function(_0x4b1d3c){return{'model':db[_0x4b1d3c['model']],'as':_0x4b1d3c['as'],'attributes':_0x4b1d3c[_0x9936('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9936('0xa')](function(_0x3811eb){logger[_0x9936('0xb')]('ShowDeskAccount',_0x2cc686);logger[_0x9936('0xe')]('ShowDeskAccount',_0x2cc686,JSON[_0x9936('0x1c')](_0x3811eb));_0x288dba(_0x3811eb);})[_0x9936('0x13')](function(_0x4dc08c){logger[_0x9936('0x10')](_0x9936('0x1d'),_0x4dc08c[_0x9936('0x11')],_0x2cc686);_0x141d41(_0x125af4[_0x9936('0x10')](0x1f4,_0x4dc08c[_0x9936('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index f99f90a..d089089 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(_0x4a94b1,_0x4f2518){var _0x20949f=function(_0x1c4aa6){while(--_0x1c4aa6){_0x4a94b1['push'](_0x4a94b1['shift']());}};_0x20949f(++_0x4f2518);}(_0x55ca,0x126));var _0xa55c=function(_0x1fa760,_0x1bf063){_0x1fa760=_0x1fa760-0x0;var _0xd8eda1=_0x55ca[_0x1fa760];return _0xd8eda1;};'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(_0x2f43cf,_0x46c935){var _0x361631=function(_0xe76003){while(--_0xe76003){_0x2f43cf['push'](_0x2f43cf['shift']());}};_0x361631(++_0x46c935);}(_0x008c,0x188));var _0xc008=function(_0xe719ec,_0x5a280e){_0xe719ec=_0xe719ec-0x0;var _0x4842a1=_0x008c[_0xe719ec];return _0x4842a1;};'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 5b57d23..6760102 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 _0xbd3e=['STRING','sequelize','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbd3e,0x9a));var _0xebd3=function(_0x247ab1,_0x537447){_0x247ab1=_0x247ab1-0x0;var _0x130f50=_0xbd3e[_0x247ab1];return _0x130f50;};'use strict';var Sequelize=require(_0xebd3('0x0'));module[_0xebd3('0x1')]={'name':{'type':Sequelize[_0xebd3('0x2')]},'description':{'type':Sequelize[_0xebd3('0x2')]}}; \ No newline at end of file +var _0x05a7=['sequelize','exports','STRING'];(function(_0x3522c8,_0x1e7c82){var _0x22f498=function(_0x5bf143){while(--_0x5bf143){_0x3522c8['push'](_0x3522c8['shift']());}};_0x22f498(++_0x1e7c82);}(_0x05a7,0x1ad));var _0x705a=function(_0x45ad09,_0x521ab1){_0x45ad09=_0x45ad09-0x0;var _0x2084fd=_0x05a7[_0x45ad09];return _0x2084fd;};'use strict';var Sequelize=require(_0x705a('0x0'));module[_0x705a('0x1')]={'name':{'type':Sequelize[_0x705a('0x2')]},'description':{'type':Sequelize[_0x705a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 3878b38..9159762 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 _0x7383=['../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','getFields','findOne','DeskField','getSubjects','hasOwnProperty','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x5ad9ac,_0x5b0d75){var _0x269e01=function(_0x570c86){while(--_0x570c86){_0x5ad9ac['push'](_0x5ad9ac['shift']());}};_0x269e01(++_0x5b0d75);}(_0x7383,0x187));var _0x3738=function(_0xb47fce,_0x4abd1d){_0xb47fce=_0xb47fce-0x0;var _0x2f07d0=_0x7383[_0xb47fce];return _0x2f07d0;};'use strict';var emlformat=require(_0x3738('0x0'));var rimraf=require(_0x3738('0x1'));var zipdir=require(_0x3738('0x2'));var jsonpatch=require(_0x3738('0x3'));var rp=require(_0x3738('0x4'));var moment=require(_0x3738('0x5'));var BPromise=require(_0x3738('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3738('0x7'));var sox=require(_0x3738('0x8'));var csv=require('to-csv');var ejs=require(_0x3738('0x9'));var fs=require('fs');var fs_extra=require(_0x3738('0xa'));var _=require(_0x3738('0xb'));var squel=require('squel');var crypto=require(_0x3738('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3738('0xd'));var toCsv=require(_0x3738('0xe'));var querystring=require(_0x3738('0xf'));var Papa=require(_0x3738('0x10'));var Redis=require(_0x3738('0x11'));var authService=require(_0x3738('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3738('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3738('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3738('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1640f3,_0x23d316){_0x23d316=_0x23d316||0xcc;return function(_0x598be5){if(_0x598be5){return _0x1640f3[_0x3738('0x16')](_0x23d316);}return _0x1640f3[_0x3738('0x17')](_0x23d316)['end']();};}function respondWithResult(_0x48b836,_0x1c815a){_0x1c815a=_0x1c815a||0xc8;return function(_0x4e47a7){if(_0x4e47a7){return _0x48b836[_0x3738('0x17')](_0x1c815a)['json'](_0x4e47a7);}};}function respondWithFilteredResult(_0x4e963f,_0x3e6682){return function(_0x44cb13){if(_0x44cb13){var _0x30c9d1=typeof _0x3e6682[_0x3738('0x18')]===_0x3738('0x19')&&typeof _0x3e6682['limit']===_0x3738('0x19');var _0x1754b9=_0x44cb13[_0x3738('0x1a')];var _0x32f15a=_0x30c9d1?0x0:_0x3e6682[_0x3738('0x18')];var _0x5872fb=_0x30c9d1?_0x44cb13[_0x3738('0x1a')]:_0x3e6682['offset']+_0x3e6682[_0x3738('0x1b')];var _0x451fa4;if(_0x5872fb>=_0x1754b9){_0x5872fb=_0x1754b9;_0x451fa4=0xc8;}else{_0x451fa4=0xce;}_0x4e963f['status'](_0x451fa4);return _0x4e963f[_0x3738('0x1c')]('Content-Range',_0x32f15a+'-'+_0x5872fb+'/'+_0x1754b9)[_0x3738('0x1d')](_0x44cb13);}return null;};}function patchUpdates(_0xedc95){return function(_0x245c60){try{jsonpatch[_0x3738('0x1e')](_0x245c60,_0xedc95,!![]);}catch(_0x335b8e){return BPromise[_0x3738('0x1f')](_0x335b8e);}return _0x245c60[_0x3738('0x20')]();};}function saveUpdates(_0x46d563,_0x13628d){return function(_0x3d46c1){if(_0x3d46c1){return _0x3d46c1[_0x3738('0x21')](_0x46d563)[_0x3738('0x22')](function(_0xadba80){return _0xadba80;});}return null;};}function removeEntity(_0x3568b9,_0x59d13e){return function(_0x2d26a7){if(_0x2d26a7){return _0x2d26a7[_0x3738('0x23')]()[_0x3738('0x22')](function(){_0x3568b9[_0x3738('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ed6b1,_0x21cb07){return function(_0x20f366){if(!_0x20f366){_0x2ed6b1[_0x3738('0x16')](0x194);}return _0x20f366;};}function handleError(_0x4e0d4a,_0x465995){_0x465995=_0x465995||0x1f4;return function(_0x31e6dc){logger[_0x3738('0x24')](_0x31e6dc[_0x3738('0x25')]);if(_0x31e6dc[_0x3738('0x26')]){delete _0x31e6dc[_0x3738('0x26')];}_0x4e0d4a[_0x3738('0x17')](_0x465995)[_0x3738('0x27')](_0x31e6dc);};}exports[_0x3738('0x28')]=function(_0x59e91c,_0x194593){var _0x206e8f={},_0x5158dd={},_0x346ada={'count':0x0,'rows':[]};var _0x18152d=_[_0x3738('0x29')](db[_0x3738('0x2a')][_0x3738('0x2b')],function(_0x18fb09){return{'name':_0x18fb09[_0x3738('0x2c')],'type':_0x18fb09[_0x3738('0x2d')][_0x3738('0x2e')]};});_0x5158dd[_0x3738('0x2f')]=_[_0x3738('0x29')](_0x18152d,_0x3738('0x26'));_0x5158dd[_0x3738('0x30')]=_[_0x3738('0x31')](_0x59e91c[_0x3738('0x30')]);_0x5158dd[_0x3738('0x32')]=_[_0x3738('0x33')](_0x5158dd['model'],_0x5158dd[_0x3738('0x30')]);_0x206e8f[_0x3738('0x34')]=_[_0x3738('0x33')](_0x5158dd['model'],qs[_0x3738('0x35')](_0x59e91c[_0x3738('0x30')][_0x3738('0x35')]));_0x206e8f[_0x3738('0x34')]=_0x206e8f[_0x3738('0x34')][_0x3738('0x36')]?_0x206e8f[_0x3738('0x34')]:_0x5158dd[_0x3738('0x2f')];if(!_0x59e91c[_0x3738('0x30')]['hasOwnProperty'](_0x3738('0x37'))){_0x206e8f[_0x3738('0x1b')]=qs[_0x3738('0x1b')](_0x59e91c[_0x3738('0x30')][_0x3738('0x1b')]);_0x206e8f[_0x3738('0x18')]=qs[_0x3738('0x18')](_0x59e91c[_0x3738('0x30')][_0x3738('0x18')]);}_0x206e8f[_0x3738('0x38')]=qs[_0x3738('0x39')](_0x59e91c[_0x3738('0x30')][_0x3738('0x39')]);_0x206e8f[_0x3738('0x3a')]=qs['filters'](_[_0x3738('0x3b')](_0x59e91c['query'],_0x5158dd[_0x3738('0x32')]),_0x18152d);if(_0x59e91c['query'][_0x3738('0x3c')]){_0x206e8f['where']=_[_0x3738('0x3d')](_0x206e8f[_0x3738('0x3a')],{'$or':_[_0x3738('0x29')](_0x18152d,function(_0x4095cb){if(_0x4095cb['type']!==_0x3738('0x3e')){var _0x41e95f={};_0x41e95f[_0x4095cb[_0x3738('0x26')]]={'$like':'%'+_0x59e91c[_0x3738('0x30')][_0x3738('0x3c')]+'%'};return _0x41e95f;}})});}_0x206e8f=_[_0x3738('0x3d')]({},_0x206e8f,_0x59e91c[_0x3738('0x3f')]);var _0x514d06={'where':_0x206e8f[_0x3738('0x3a')]};return db[_0x3738('0x2a')]['count'](_0x514d06)[_0x3738('0x22')](function(_0x28457e){_0x346ada[_0x3738('0x1a')]=_0x28457e;if(_0x59e91c['query'][_0x3738('0x40')]){_0x206e8f[_0x3738('0x41')]=[{'all':!![]}];}return db[_0x3738('0x2a')]['findAll'](_0x206e8f);})['then'](function(_0x18371a){_0x346ada[_0x3738('0x42')]=_0x18371a;return _0x346ada;})[_0x3738('0x22')](respondWithFilteredResult(_0x194593,_0x206e8f))[_0x3738('0x43')](handleError(_0x194593,null));};exports[_0x3738('0x44')]=function(_0xf3e96b,_0x5b991b){var _0x29d953={'raw':![],'where':{'id':_0xf3e96b[_0x3738('0x45')]['id']}},_0x373dc4={};_0x373dc4[_0x3738('0x2f')]=_[_0x3738('0x31')](db[_0x3738('0x2a')][_0x3738('0x2b')]);_0x373dc4[_0x3738('0x30')]=_[_0x3738('0x31')](_0xf3e96b[_0x3738('0x30')]);_0x373dc4[_0x3738('0x32')]=_[_0x3738('0x33')](_0x373dc4[_0x3738('0x2f')],_0x373dc4[_0x3738('0x30')]);_0x29d953[_0x3738('0x34')]=_[_0x3738('0x33')](_0x373dc4[_0x3738('0x2f')],qs[_0x3738('0x35')](_0xf3e96b[_0x3738('0x30')]['fields']));_0x29d953[_0x3738('0x34')]=_0x29d953[_0x3738('0x34')][_0x3738('0x36')]?_0x29d953[_0x3738('0x34')]:_0x373dc4['model'];if(_0xf3e96b['query'][_0x3738('0x40')]){_0x29d953[_0x3738('0x41')]=[{'all':!![]}];}_0x29d953=_[_0x3738('0x3d')]({},_0x29d953,_0xf3e96b[_0x3738('0x3f')]);return db[_0x3738('0x2a')][_0x3738('0x46')](_0x29d953)[_0x3738('0x22')](handleEntityNotFound(_0x5b991b,null))[_0x3738('0x22')](respondWithResult(_0x5b991b,null))[_0x3738('0x43')](handleError(_0x5b991b,null));};exports['create']=function(_0x2098db,_0x33c19b){return db[_0x3738('0x2a')][_0x3738('0x47')](_0x2098db[_0x3738('0x48')],{})[_0x3738('0x22')](respondWithResult(_0x33c19b,0xc9))[_0x3738('0x43')](handleError(_0x33c19b,null));};exports[_0x3738('0x21')]=function(_0x1de87c,_0x175773){if(_0x1de87c[_0x3738('0x48')]['id']){delete _0x1de87c[_0x3738('0x48')]['id'];}return db[_0x3738('0x2a')][_0x3738('0x46')]({'where':{'id':_0x1de87c[_0x3738('0x45')]['id']}})[_0x3738('0x22')](handleEntityNotFound(_0x175773,null))['then'](saveUpdates(_0x1de87c['body'],null))[_0x3738('0x22')](respondWithResult(_0x175773,null))[_0x3738('0x43')](handleError(_0x175773,null));};exports[_0x3738('0x23')]=function(_0x20707d,_0x5b3167){return db[_0x3738('0x2a')]['find']({'where':{'id':_0x20707d['params']['id']}})[_0x3738('0x22')](handleEntityNotFound(_0x5b3167,null))[_0x3738('0x22')](removeEntity(_0x5b3167,null))[_0x3738('0x43')](handleError(_0x5b3167,null));};exports[_0x3738('0x49')]=function(_0x12df59,_0x1a6d3d,_0x2b8a23){var _0x2d2da1={};var _0x4418a4={};var _0x50c891;var _0x56d7e4;return db[_0x3738('0x2a')][_0x3738('0x4a')]({'where':{'id':_0x12df59[_0x3738('0x45')]['id']}})[_0x3738('0x22')](handleEntityNotFound(_0x1a6d3d,null))[_0x3738('0x22')](function(_0x416668){if(_0x416668){_0x50c891=_0x416668;_0x4418a4[_0x3738('0x2f')]=_[_0x3738('0x31')](db['DeskField'][_0x3738('0x2b')]);_0x4418a4[_0x3738('0x30')]=_[_0x3738('0x31')](_0x12df59[_0x3738('0x30')]);_0x4418a4[_0x3738('0x32')]=_[_0x3738('0x33')](_0x4418a4[_0x3738('0x2f')],_0x4418a4[_0x3738('0x30')]);_0x2d2da1[_0x3738('0x34')]=_['intersection'](_0x4418a4[_0x3738('0x2f')],qs[_0x3738('0x35')](_0x12df59['query'][_0x3738('0x35')]));_0x2d2da1[_0x3738('0x34')]=_0x2d2da1[_0x3738('0x34')]['length']?_0x2d2da1[_0x3738('0x34')]:_0x4418a4[_0x3738('0x2f')];_0x2d2da1[_0x3738('0x38')]=qs[_0x3738('0x39')](_0x12df59[_0x3738('0x30')]['sort']);_0x2d2da1[_0x3738('0x3a')]=qs[_0x3738('0x32')](_[_0x3738('0x3b')](_0x12df59[_0x3738('0x30')],_0x4418a4[_0x3738('0x32')]));if(_0x12df59['query'][_0x3738('0x3c')]){_0x2d2da1[_0x3738('0x3a')]=_[_0x3738('0x3d')](_0x2d2da1[_0x3738('0x3a')],{'$or':_[_0x3738('0x29')](_0x2d2da1[_0x3738('0x34')],function(_0x419922){var _0x15a53d={};_0x15a53d[_0x419922]={'$like':'%'+_0x12df59[_0x3738('0x30')]['filter']+'%'};return _0x15a53d;})});}_0x2d2da1=_['merge']({},_0x2d2da1,_0x12df59[_0x3738('0x3f')]);return _0x50c891[_0x3738('0x49')](_0x2d2da1);}})['then'](function(_0x1b43f0){if(_0x1b43f0){_0x56d7e4=_0x1b43f0[_0x3738('0x36')];if(!_0x12df59[_0x3738('0x30')]['hasOwnProperty'](_0x3738('0x37'))){_0x2d2da1[_0x3738('0x1b')]=qs[_0x3738('0x1b')](_0x12df59[_0x3738('0x30')]['limit']);_0x2d2da1[_0x3738('0x18')]=qs['offset'](_0x12df59['query'][_0x3738('0x18')]);}return _0x50c891[_0x3738('0x49')](_0x2d2da1);}})[_0x3738('0x22')](function(_0xae5633){if(_0xae5633){return _0xae5633?{'count':_0x56d7e4,'rows':_0xae5633}:null;}})[_0x3738('0x22')](respondWithResult(_0x1a6d3d,null))[_0x3738('0x43')](handleError(_0x1a6d3d,null));};exports['getSubjects']=function(_0x376889,_0x51e7de,_0x1fd369){var _0xb38626={};var _0x538f4b={};var _0x15dce1;var _0x568208;return db['DeskConfiguration'][_0x3738('0x4a')]({'where':{'id':_0x376889[_0x3738('0x45')]['id']}})[_0x3738('0x22')](handleEntityNotFound(_0x51e7de,null))[_0x3738('0x22')](function(_0x444edf){if(_0x444edf){_0x15dce1=_0x444edf;_0x538f4b[_0x3738('0x2f')]=_[_0x3738('0x31')](db[_0x3738('0x4b')][_0x3738('0x2b')]);_0x538f4b[_0x3738('0x30')]=_[_0x3738('0x31')](_0x376889[_0x3738('0x30')]);_0x538f4b[_0x3738('0x32')]=_[_0x3738('0x33')](_0x538f4b[_0x3738('0x2f')],_0x538f4b[_0x3738('0x30')]);_0xb38626[_0x3738('0x34')]=_[_0x3738('0x33')](_0x538f4b[_0x3738('0x2f')],qs['fields'](_0x376889[_0x3738('0x30')]['fields']));_0xb38626[_0x3738('0x34')]=_0xb38626[_0x3738('0x34')][_0x3738('0x36')]?_0xb38626['attributes']:_0x538f4b[_0x3738('0x2f')];_0xb38626['order']=qs['sort'](_0x376889[_0x3738('0x30')][_0x3738('0x39')]);_0xb38626[_0x3738('0x3a')]=qs['filters'](_[_0x3738('0x3b')](_0x376889['query'],_0x538f4b[_0x3738('0x32')]));if(_0x376889['query']['filter']){_0xb38626[_0x3738('0x3a')]=_['merge'](_0xb38626[_0x3738('0x3a')],{'$or':_[_0x3738('0x29')](_0xb38626['attributes'],function(_0x3fb527){var _0x10c008={};_0x10c008[_0x3fb527]={'$like':'%'+_0x376889[_0x3738('0x30')][_0x3738('0x3c')]+'%'};return _0x10c008;})});}_0xb38626=_['merge']({},_0xb38626,_0x376889[_0x3738('0x3f')]);return _0x15dce1[_0x3738('0x4c')](_0xb38626);}})['then'](function(_0x3bcd04){if(_0x3bcd04){_0x568208=_0x3bcd04[_0x3738('0x36')];if(!_0x376889['query'][_0x3738('0x4d')]('nolimit')){_0xb38626[_0x3738('0x1b')]=qs['limit'](_0x376889[_0x3738('0x30')][_0x3738('0x1b')]);_0xb38626[_0x3738('0x18')]=qs[_0x3738('0x18')](_0x376889[_0x3738('0x30')][_0x3738('0x18')]);}return _0x15dce1[_0x3738('0x4c')](_0xb38626);}})[_0x3738('0x22')](function(_0x4bb2b2){if(_0x4bb2b2){return _0x4bb2b2?{'count':_0x568208,'rows':_0x4bb2b2}:null;}})[_0x3738('0x22')](respondWithResult(_0x51e7de,null))['catch'](handleError(_0x51e7de,null));};exports[_0x3738('0x4e')]=function(_0x285aa7,_0x14be3b,_0x2aac03){var _0x3bb86b={};var _0x1e471b={};var _0x364cf4;var _0x23fde1;return db['DeskConfiguration']['findOne']({'where':{'id':_0x285aa7[_0x3738('0x45')]['id']}})[_0x3738('0x22')](handleEntityNotFound(_0x14be3b,null))['then'](function(_0x2bcb65){if(_0x2bcb65){_0x364cf4=_0x2bcb65;_0x1e471b[_0x3738('0x2f')]=_[_0x3738('0x31')](db[_0x3738('0x4b')][_0x3738('0x2b')]);_0x1e471b[_0x3738('0x30')]=_[_0x3738('0x31')](_0x285aa7[_0x3738('0x30')]);_0x1e471b[_0x3738('0x32')]=_['intersection'](_0x1e471b['model'],_0x1e471b[_0x3738('0x30')]);_0x3bb86b[_0x3738('0x34')]=_[_0x3738('0x33')](_0x1e471b['model'],qs[_0x3738('0x35')](_0x285aa7[_0x3738('0x30')][_0x3738('0x35')]));_0x3bb86b[_0x3738('0x34')]=_0x3bb86b['attributes'][_0x3738('0x36')]?_0x3bb86b[_0x3738('0x34')]:_0x1e471b[_0x3738('0x2f')];_0x3bb86b['order']=qs[_0x3738('0x39')](_0x285aa7[_0x3738('0x30')]['sort']);_0x3bb86b[_0x3738('0x3a')]=qs[_0x3738('0x32')](_[_0x3738('0x3b')](_0x285aa7['query'],_0x1e471b['filters']));if(_0x285aa7[_0x3738('0x30')][_0x3738('0x3c')]){_0x3bb86b[_0x3738('0x3a')]=_['merge'](_0x3bb86b[_0x3738('0x3a')],{'$or':_[_0x3738('0x29')](_0x3bb86b[_0x3738('0x34')],function(_0x55b899){var _0x46ebec={};_0x46ebec[_0x55b899]={'$like':'%'+_0x285aa7[_0x3738('0x30')]['filter']+'%'};return _0x46ebec;})});}_0x3bb86b=_['merge']({},_0x3bb86b,_0x285aa7[_0x3738('0x3f')]);return _0x364cf4[_0x3738('0x4e')](_0x3bb86b);}})[_0x3738('0x22')](function(_0x2d6141){if(_0x2d6141){_0x23fde1=_0x2d6141['length'];if(!_0x285aa7[_0x3738('0x30')][_0x3738('0x4d')](_0x3738('0x37'))){_0x3bb86b[_0x3738('0x1b')]=qs[_0x3738('0x1b')](_0x285aa7[_0x3738('0x30')][_0x3738('0x1b')]);_0x3bb86b[_0x3738('0x18')]=qs['offset'](_0x285aa7[_0x3738('0x30')]['offset']);}return _0x364cf4[_0x3738('0x4e')](_0x3bb86b);}})['then'](function(_0x430477){if(_0x430477){return _0x430477?{'count':_0x23fde1,'rows':_0x430477}:null;}})[_0x3738('0x22')](respondWithResult(_0x14be3b,null))[_0x3738('0x43')](handleError(_0x14be3b,null));};exports[_0x3738('0x4f')]=function(_0x14af13,_0x4055a9,_0x33393e){var _0x20481e={};var _0x35e997={};var _0x555b67;var _0x2836b7;return db[_0x3738('0x2a')]['findOne']({'where':{'id':_0x14af13['params']['id']}})['then'](handleEntityNotFound(_0x4055a9,null))[_0x3738('0x22')](function(_0x52c5e1){if(_0x52c5e1){_0x555b67=_0x52c5e1;_0x35e997[_0x3738('0x2f')]=_[_0x3738('0x31')](db['Tag'][_0x3738('0x2b')]);_0x35e997[_0x3738('0x30')]=_[_0x3738('0x31')](_0x14af13[_0x3738('0x30')]);_0x35e997['filters']=_[_0x3738('0x33')](_0x35e997[_0x3738('0x2f')],_0x35e997[_0x3738('0x30')]);_0x20481e[_0x3738('0x34')]=_[_0x3738('0x33')](_0x35e997[_0x3738('0x2f')],qs[_0x3738('0x35')](_0x14af13[_0x3738('0x30')]['fields']));_0x20481e[_0x3738('0x34')]=_0x20481e[_0x3738('0x34')][_0x3738('0x36')]?_0x20481e[_0x3738('0x34')]:_0x35e997[_0x3738('0x2f')];_0x20481e[_0x3738('0x38')]=qs[_0x3738('0x39')](_0x14af13[_0x3738('0x30')][_0x3738('0x39')]);_0x20481e['where']=qs[_0x3738('0x32')](_['pick'](_0x14af13[_0x3738('0x30')],_0x35e997[_0x3738('0x32')]));if(_0x14af13[_0x3738('0x30')][_0x3738('0x3c')]){_0x20481e[_0x3738('0x3a')]=_[_0x3738('0x3d')](_0x20481e[_0x3738('0x3a')],{'$or':_['map'](_0x20481e['attributes'],function(_0x556255){var _0x4d8b56={};_0x4d8b56[_0x556255]={'$like':'%'+_0x14af13[_0x3738('0x30')]['filter']+'%'};return _0x4d8b56;})});}_0x20481e=_[_0x3738('0x3d')]({},_0x20481e,_0x14af13[_0x3738('0x3f')]);return _0x555b67['getTags'](_0x20481e);}})[_0x3738('0x22')](function(_0x374066){if(_0x374066){_0x2836b7=_0x374066[_0x3738('0x36')];if(!_0x14af13[_0x3738('0x30')][_0x3738('0x4d')]('nolimit')){_0x20481e[_0x3738('0x1b')]=qs[_0x3738('0x1b')](_0x14af13[_0x3738('0x30')][_0x3738('0x1b')]);_0x20481e['offset']=qs[_0x3738('0x18')](_0x14af13[_0x3738('0x30')][_0x3738('0x18')]);}return _0x555b67[_0x3738('0x4f')](_0x20481e);}})[_0x3738('0x22')](function(_0x33222d){if(_0x33222d){return _0x33222d?{'count':_0x2836b7,'rows':_0x33222d}:null;}})['then'](respondWithResult(_0x4055a9,null))['catch'](handleError(_0x4055a9,null));};exports[_0x3738('0x50')]=function(_0x55d84a,_0x26229a,_0xca648){if(_0x55d84a['body']['id']){delete _0x55d84a[_0x3738('0x48')]['id'];}return db['DeskConfiguration'][_0x3738('0x4a')]({'where':{'id':_0x55d84a['params']['id']}})[_0x3738('0x22')](handleEntityNotFound(_0x26229a,null))[_0x3738('0x22')](function(_0x5f217c){if(_0x5f217c){return _0x5f217c[_0x3738('0x50')](_0x55d84a[_0x3738('0x48')][_0x3738('0x51')]||[]);}return null;})[_0x3738('0x22')](respondWithResult(_0x26229a,null))[_0x3738('0x43')](handleError(_0x26229a,null));}; \ No newline at end of file +var _0xc32b=['limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','type','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','DeskConfiguration','includeAll','include','findAll','rows','catch','model','find','create','body','params','getFields','findOne','DeskField','rawAttributes','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined'];(function(_0x10286e,_0xa5e8c4){var _0x104edb=function(_0x2e950d){while(--_0x2e950d){_0x10286e['push'](_0x10286e['shift']());}};_0x104edb(++_0xa5e8c4);}(_0xc32b,0xdd));var _0xbc32=function(_0x41feb2,_0x10daed){_0x41feb2=_0x41feb2-0x0;var _0x3dacce=_0xc32b[_0x41feb2];return _0x3dacce;};'use strict';var emlformat=require(_0xbc32('0x0'));var rimraf=require(_0xbc32('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbc32('0x2'));var rp=require(_0xbc32('0x3'));var moment=require('moment');var BPromise=require(_0xbc32('0x4'));var Mustache=require(_0xbc32('0x5'));var util=require(_0xbc32('0x6'));var path=require(_0xbc32('0x7'));var sox=require('sox');var csv=require(_0xbc32('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbc32('0x9'));var squel=require('squel');var crypto=require(_0xbc32('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xbc32('0xb'));var toCsv=require(_0xbc32('0x8'));var querystring=require(_0xbc32('0xc'));var Papa=require(_0xbc32('0xd'));var Redis=require(_0xbc32('0xe'));var authService=require(_0xbc32('0xf'));var qs=require(_0xbc32('0x10'));var as=require(_0xbc32('0x11'));var hardwareService=require(_0xbc32('0x12'));var logger=require(_0xbc32('0x13'))(_0xbc32('0x14'));var utils=require(_0xbc32('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbc32('0x16'));var db=require(_0xbc32('0x17'))['db'];function respondWithStatusCode(_0x3024ff,_0x3ad5a1){_0x3ad5a1=_0x3ad5a1||0xcc;return function(_0x169be5){if(_0x169be5){return _0x3024ff[_0xbc32('0x18')](_0x3ad5a1);}return _0x3024ff[_0xbc32('0x19')](_0x3ad5a1)['end']();};}function respondWithResult(_0x1a4643,_0x4989b9){_0x4989b9=_0x4989b9||0xc8;return function(_0x356946){if(_0x356946){return _0x1a4643[_0xbc32('0x19')](_0x4989b9)[_0xbc32('0x1a')](_0x356946);}};}function respondWithFilteredResult(_0x350f57,_0x5daae6){return function(_0x3966f9){if(_0x3966f9){var _0x4288bb=typeof _0x5daae6['offset']===_0xbc32('0x1b')&&typeof _0x5daae6[_0xbc32('0x1c')]===_0xbc32('0x1b');var _0x37a1ec=_0x3966f9['count'];var _0x4c4aac=_0x4288bb?0x0:_0x5daae6[_0xbc32('0x1d')];var _0x1d590f=_0x4288bb?_0x3966f9[_0xbc32('0x1e')]:_0x5daae6['offset']+_0x5daae6['limit'];var _0x139101;if(_0x1d590f>=_0x37a1ec){_0x1d590f=_0x37a1ec;_0x139101=0xc8;}else{_0x139101=0xce;}_0x350f57[_0xbc32('0x19')](_0x139101);return _0x350f57['set'](_0xbc32('0x1f'),_0x4c4aac+'-'+_0x1d590f+'/'+_0x37a1ec)[_0xbc32('0x1a')](_0x3966f9);}return null;};}function patchUpdates(_0x46cf96){return function(_0x4633d9){try{jsonpatch[_0xbc32('0x20')](_0x4633d9,_0x46cf96,!![]);}catch(_0x59f068){return BPromise[_0xbc32('0x21')](_0x59f068);}return _0x4633d9[_0xbc32('0x22')]();};}function saveUpdates(_0x2a5035,_0x4ae3a2){return function(_0x3e5539){if(_0x3e5539){return _0x3e5539[_0xbc32('0x23')](_0x2a5035)[_0xbc32('0x24')](function(_0xa8cc36){return _0xa8cc36;});}return null;};}function removeEntity(_0x305ebd,_0x114f2d){return function(_0x91a599){if(_0x91a599){return _0x91a599[_0xbc32('0x25')]()[_0xbc32('0x24')](function(){_0x305ebd[_0xbc32('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51fd4e,_0x7aff9f){return function(_0xf3891){if(!_0xf3891){_0x51fd4e[_0xbc32('0x18')](0x194);}return _0xf3891;};}function handleError(_0x1bfd71,_0x134360){_0x134360=_0x134360||0x1f4;return function(_0x4b5acd){logger['error'](_0x4b5acd[_0xbc32('0x26')]);if(_0x4b5acd[_0xbc32('0x27')]){delete _0x4b5acd[_0xbc32('0x27')];}_0x1bfd71['status'](_0x134360)[_0xbc32('0x28')](_0x4b5acd);};}exports[_0xbc32('0x29')]=function(_0x38b916,_0x5b7e3f){var _0x3f8bb2={},_0x4a4ac8={},_0x58e541={'count':0x0,'rows':[]};var _0x7ba43a=_[_0xbc32('0x2a')](db['DeskConfiguration']['rawAttributes'],function(_0x3385a2){return{'name':_0x3385a2['fieldName'],'type':_0x3385a2[_0xbc32('0x2b')][_0xbc32('0x2c')]};});_0x4a4ac8['model']=_[_0xbc32('0x2a')](_0x7ba43a,'name');_0x4a4ac8[_0xbc32('0x2d')]=_[_0xbc32('0x2e')](_0x38b916[_0xbc32('0x2d')]);_0x4a4ac8[_0xbc32('0x2f')]=_[_0xbc32('0x30')](_0x4a4ac8['model'],_0x4a4ac8['query']);_0x3f8bb2[_0xbc32('0x31')]=_[_0xbc32('0x30')](_0x4a4ac8['model'],qs['fields'](_0x38b916[_0xbc32('0x2d')][_0xbc32('0x32')]));_0x3f8bb2[_0xbc32('0x31')]=_0x3f8bb2[_0xbc32('0x31')][_0xbc32('0x33')]?_0x3f8bb2[_0xbc32('0x31')]:_0x4a4ac8['model'];if(!_0x38b916['query'][_0xbc32('0x34')](_0xbc32('0x35'))){_0x3f8bb2['limit']=qs[_0xbc32('0x1c')](_0x38b916[_0xbc32('0x2d')][_0xbc32('0x1c')]);_0x3f8bb2[_0xbc32('0x1d')]=qs[_0xbc32('0x1d')](_0x38b916[_0xbc32('0x2d')]['offset']);}_0x3f8bb2[_0xbc32('0x36')]=qs[_0xbc32('0x37')](_0x38b916[_0xbc32('0x2d')][_0xbc32('0x37')]);_0x3f8bb2[_0xbc32('0x38')]=qs[_0xbc32('0x2f')](_[_0xbc32('0x39')](_0x38b916[_0xbc32('0x2d')],_0x4a4ac8['filters']),_0x7ba43a);if(_0x38b916[_0xbc32('0x2d')][_0xbc32('0x3a')]){_0x3f8bb2[_0xbc32('0x38')]=_[_0xbc32('0x3b')](_0x3f8bb2[_0xbc32('0x38')],{'$or':_[_0xbc32('0x2a')](_0x7ba43a,function(_0x44b73e){if(_0x44b73e[_0xbc32('0x2b')]!==_0xbc32('0x3c')){var _0x2c50a1={};_0x2c50a1[_0x44b73e['name']]={'$like':'%'+_0x38b916[_0xbc32('0x2d')][_0xbc32('0x3a')]+'%'};return _0x2c50a1;}})});}_0x3f8bb2=_['merge']({},_0x3f8bb2,_0x38b916[_0xbc32('0x3d')]);var _0x2a6cd9={'where':_0x3f8bb2['where']};return db[_0xbc32('0x3e')][_0xbc32('0x1e')](_0x2a6cd9)[_0xbc32('0x24')](function(_0x9f4abb){_0x58e541[_0xbc32('0x1e')]=_0x9f4abb;if(_0x38b916['query'][_0xbc32('0x3f')]){_0x3f8bb2[_0xbc32('0x40')]=[{'all':!![]}];}return db[_0xbc32('0x3e')][_0xbc32('0x41')](_0x3f8bb2);})[_0xbc32('0x24')](function(_0x398b18){_0x58e541[_0xbc32('0x42')]=_0x398b18;return _0x58e541;})[_0xbc32('0x24')](respondWithFilteredResult(_0x5b7e3f,_0x3f8bb2))[_0xbc32('0x43')](handleError(_0x5b7e3f,null));};exports['show']=function(_0x2fd9c1,_0x4910ec){var _0x2b04ad={'raw':![],'where':{'id':_0x2fd9c1['params']['id']}},_0x220b1c={};_0x220b1c['model']=_['keys'](db[_0xbc32('0x3e')]['rawAttributes']);_0x220b1c[_0xbc32('0x2d')]=_['keys'](_0x2fd9c1[_0xbc32('0x2d')]);_0x220b1c[_0xbc32('0x2f')]=_[_0xbc32('0x30')](_0x220b1c['model'],_0x220b1c[_0xbc32('0x2d')]);_0x2b04ad[_0xbc32('0x31')]=_[_0xbc32('0x30')](_0x220b1c[_0xbc32('0x44')],qs['fields'](_0x2fd9c1[_0xbc32('0x2d')]['fields']));_0x2b04ad['attributes']=_0x2b04ad[_0xbc32('0x31')][_0xbc32('0x33')]?_0x2b04ad[_0xbc32('0x31')]:_0x220b1c[_0xbc32('0x44')];if(_0x2fd9c1[_0xbc32('0x2d')][_0xbc32('0x3f')]){_0x2b04ad[_0xbc32('0x40')]=[{'all':!![]}];}_0x2b04ad=_[_0xbc32('0x3b')]({},_0x2b04ad,_0x2fd9c1[_0xbc32('0x3d')]);return db[_0xbc32('0x3e')][_0xbc32('0x45')](_0x2b04ad)[_0xbc32('0x24')](handleEntityNotFound(_0x4910ec,null))[_0xbc32('0x24')](respondWithResult(_0x4910ec,null))[_0xbc32('0x43')](handleError(_0x4910ec,null));};exports[_0xbc32('0x46')]=function(_0x51ce70,_0x3d8b1e){return db[_0xbc32('0x3e')]['create'](_0x51ce70['body'],{})['then'](respondWithResult(_0x3d8b1e,0xc9))[_0xbc32('0x43')](handleError(_0x3d8b1e,null));};exports[_0xbc32('0x23')]=function(_0x140dd8,_0x4a91fd){if(_0x140dd8[_0xbc32('0x47')]['id']){delete _0x140dd8['body']['id'];}return db[_0xbc32('0x3e')][_0xbc32('0x45')]({'where':{'id':_0x140dd8[_0xbc32('0x48')]['id']}})[_0xbc32('0x24')](handleEntityNotFound(_0x4a91fd,null))['then'](saveUpdates(_0x140dd8[_0xbc32('0x47')],null))[_0xbc32('0x24')](respondWithResult(_0x4a91fd,null))['catch'](handleError(_0x4a91fd,null));};exports['destroy']=function(_0x4bf925,_0x5b1e4a){return db[_0xbc32('0x3e')][_0xbc32('0x45')]({'where':{'id':_0x4bf925['params']['id']}})[_0xbc32('0x24')](handleEntityNotFound(_0x5b1e4a,null))[_0xbc32('0x24')](removeEntity(_0x5b1e4a,null))[_0xbc32('0x43')](handleError(_0x5b1e4a,null));};exports[_0xbc32('0x49')]=function(_0x1ff504,_0x4dc651,_0x39e6cd){var _0x276a9a={};var _0x30c70={};var _0x1ec7c0;var _0x12e87b;return db['DeskConfiguration'][_0xbc32('0x4a')]({'where':{'id':_0x1ff504['params']['id']}})[_0xbc32('0x24')](handleEntityNotFound(_0x4dc651,null))['then'](function(_0x372f11){if(_0x372f11){_0x1ec7c0=_0x372f11;_0x30c70[_0xbc32('0x44')]=_['keys'](db[_0xbc32('0x4b')][_0xbc32('0x4c')]);_0x30c70[_0xbc32('0x2d')]=_['keys'](_0x1ff504['query']);_0x30c70['filters']=_['intersection'](_0x30c70[_0xbc32('0x44')],_0x30c70['query']);_0x276a9a[_0xbc32('0x31')]=_[_0xbc32('0x30')](_0x30c70['model'],qs['fields'](_0x1ff504[_0xbc32('0x2d')]['fields']));_0x276a9a[_0xbc32('0x31')]=_0x276a9a[_0xbc32('0x31')][_0xbc32('0x33')]?_0x276a9a[_0xbc32('0x31')]:_0x30c70[_0xbc32('0x44')];_0x276a9a[_0xbc32('0x36')]=qs[_0xbc32('0x37')](_0x1ff504[_0xbc32('0x2d')][_0xbc32('0x37')]);_0x276a9a[_0xbc32('0x38')]=qs[_0xbc32('0x2f')](_['pick'](_0x1ff504[_0xbc32('0x2d')],_0x30c70['filters']));if(_0x1ff504[_0xbc32('0x2d')]['filter']){_0x276a9a[_0xbc32('0x38')]=_[_0xbc32('0x3b')](_0x276a9a['where'],{'$or':_['map'](_0x276a9a[_0xbc32('0x31')],function(_0x1fcbe9){var _0x2249a1={};_0x2249a1[_0x1fcbe9]={'$like':'%'+_0x1ff504['query']['filter']+'%'};return _0x2249a1;})});}_0x276a9a=_[_0xbc32('0x3b')]({},_0x276a9a,_0x1ff504[_0xbc32('0x3d')]);return _0x1ec7c0[_0xbc32('0x49')](_0x276a9a);}})[_0xbc32('0x24')](function(_0x559fcc){if(_0x559fcc){_0x12e87b=_0x559fcc[_0xbc32('0x33')];if(!_0x1ff504[_0xbc32('0x2d')][_0xbc32('0x34')](_0xbc32('0x35'))){_0x276a9a[_0xbc32('0x1c')]=qs[_0xbc32('0x1c')](_0x1ff504[_0xbc32('0x2d')][_0xbc32('0x1c')]);_0x276a9a['offset']=qs['offset'](_0x1ff504[_0xbc32('0x2d')][_0xbc32('0x1d')]);}return _0x1ec7c0[_0xbc32('0x49')](_0x276a9a);}})[_0xbc32('0x24')](function(_0x42c307){if(_0x42c307){return _0x42c307?{'count':_0x12e87b,'rows':_0x42c307}:null;}})[_0xbc32('0x24')](respondWithResult(_0x4dc651,null))[_0xbc32('0x43')](handleError(_0x4dc651,null));};exports[_0xbc32('0x4d')]=function(_0x28dc91,_0xfa5c81,_0x109487){var _0x5e7e5f={};var _0x22f96e={};var _0x37cb4c;var _0x5de745;return db[_0xbc32('0x3e')]['findOne']({'where':{'id':_0x28dc91[_0xbc32('0x48')]['id']}})['then'](handleEntityNotFound(_0xfa5c81,null))[_0xbc32('0x24')](function(_0x178013){if(_0x178013){_0x37cb4c=_0x178013;_0x22f96e['model']=_[_0xbc32('0x2e')](db[_0xbc32('0x4b')][_0xbc32('0x4c')]);_0x22f96e[_0xbc32('0x2d')]=_[_0xbc32('0x2e')](_0x28dc91[_0xbc32('0x2d')]);_0x22f96e[_0xbc32('0x2f')]=_[_0xbc32('0x30')](_0x22f96e[_0xbc32('0x44')],_0x22f96e[_0xbc32('0x2d')]);_0x5e7e5f[_0xbc32('0x31')]=_[_0xbc32('0x30')](_0x22f96e['model'],qs[_0xbc32('0x32')](_0x28dc91[_0xbc32('0x2d')]['fields']));_0x5e7e5f[_0xbc32('0x31')]=_0x5e7e5f[_0xbc32('0x31')]['length']?_0x5e7e5f['attributes']:_0x22f96e['model'];_0x5e7e5f[_0xbc32('0x36')]=qs[_0xbc32('0x37')](_0x28dc91['query'][_0xbc32('0x37')]);_0x5e7e5f[_0xbc32('0x38')]=qs[_0xbc32('0x2f')](_['pick'](_0x28dc91[_0xbc32('0x2d')],_0x22f96e[_0xbc32('0x2f')]));if(_0x28dc91['query'][_0xbc32('0x3a')]){_0x5e7e5f[_0xbc32('0x38')]=_[_0xbc32('0x3b')](_0x5e7e5f['where'],{'$or':_[_0xbc32('0x2a')](_0x5e7e5f[_0xbc32('0x31')],function(_0x4c6d4e){var _0x41aaf7={};_0x41aaf7[_0x4c6d4e]={'$like':'%'+_0x28dc91['query'][_0xbc32('0x3a')]+'%'};return _0x41aaf7;})});}_0x5e7e5f=_[_0xbc32('0x3b')]({},_0x5e7e5f,_0x28dc91[_0xbc32('0x3d')]);return _0x37cb4c[_0xbc32('0x4d')](_0x5e7e5f);}})['then'](function(_0x4bcfd6){if(_0x4bcfd6){_0x5de745=_0x4bcfd6[_0xbc32('0x33')];if(!_0x28dc91[_0xbc32('0x2d')]['hasOwnProperty'](_0xbc32('0x35'))){_0x5e7e5f[_0xbc32('0x1c')]=qs[_0xbc32('0x1c')](_0x28dc91[_0xbc32('0x2d')][_0xbc32('0x1c')]);_0x5e7e5f['offset']=qs[_0xbc32('0x1d')](_0x28dc91[_0xbc32('0x2d')][_0xbc32('0x1d')]);}return _0x37cb4c[_0xbc32('0x4d')](_0x5e7e5f);}})[_0xbc32('0x24')](function(_0x45508a){if(_0x45508a){return _0x45508a?{'count':_0x5de745,'rows':_0x45508a}:null;}})['then'](respondWithResult(_0xfa5c81,null))['catch'](handleError(_0xfa5c81,null));};exports[_0xbc32('0x4e')]=function(_0x76a738,_0xca71c6,_0x33cdd6){var _0x5c6e89={};var _0x17416={};var _0x33ebc8;var _0xc47af;return db['DeskConfiguration'][_0xbc32('0x4a')]({'where':{'id':_0x76a738[_0xbc32('0x48')]['id']}})['then'](handleEntityNotFound(_0xca71c6,null))[_0xbc32('0x24')](function(_0x5cd8f7){if(_0x5cd8f7){_0x33ebc8=_0x5cd8f7;_0x17416[_0xbc32('0x44')]=_[_0xbc32('0x2e')](db[_0xbc32('0x4b')][_0xbc32('0x4c')]);_0x17416[_0xbc32('0x2d')]=_['keys'](_0x76a738[_0xbc32('0x2d')]);_0x17416[_0xbc32('0x2f')]=_[_0xbc32('0x30')](_0x17416[_0xbc32('0x44')],_0x17416[_0xbc32('0x2d')]);_0x5c6e89[_0xbc32('0x31')]=_[_0xbc32('0x30')](_0x17416['model'],qs[_0xbc32('0x32')](_0x76a738[_0xbc32('0x2d')][_0xbc32('0x32')]));_0x5c6e89['attributes']=_0x5c6e89[_0xbc32('0x31')][_0xbc32('0x33')]?_0x5c6e89[_0xbc32('0x31')]:_0x17416['model'];_0x5c6e89['order']=qs[_0xbc32('0x37')](_0x76a738[_0xbc32('0x2d')][_0xbc32('0x37')]);_0x5c6e89['where']=qs[_0xbc32('0x2f')](_[_0xbc32('0x39')](_0x76a738[_0xbc32('0x2d')],_0x17416['filters']));if(_0x76a738[_0xbc32('0x2d')][_0xbc32('0x3a')]){_0x5c6e89['where']=_[_0xbc32('0x3b')](_0x5c6e89[_0xbc32('0x38')],{'$or':_[_0xbc32('0x2a')](_0x5c6e89[_0xbc32('0x31')],function(_0x4ca8df){var _0x3824fc={};_0x3824fc[_0x4ca8df]={'$like':'%'+_0x76a738[_0xbc32('0x2d')][_0xbc32('0x3a')]+'%'};return _0x3824fc;})});}_0x5c6e89=_[_0xbc32('0x3b')]({},_0x5c6e89,_0x76a738['options']);return _0x33ebc8[_0xbc32('0x4e')](_0x5c6e89);}})[_0xbc32('0x24')](function(_0x175ccd){if(_0x175ccd){_0xc47af=_0x175ccd[_0xbc32('0x33')];if(!_0x76a738[_0xbc32('0x2d')][_0xbc32('0x34')]('nolimit')){_0x5c6e89['limit']=qs[_0xbc32('0x1c')](_0x76a738['query'][_0xbc32('0x1c')]);_0x5c6e89['offset']=qs['offset'](_0x76a738['query']['offset']);}return _0x33ebc8['getDescriptions'](_0x5c6e89);}})['then'](function(_0x187685){if(_0x187685){return _0x187685?{'count':_0xc47af,'rows':_0x187685}:null;}})[_0xbc32('0x24')](respondWithResult(_0xca71c6,null))['catch'](handleError(_0xca71c6,null));};exports['getTags']=function(_0x4e8d6a,_0x3c1bf4,_0x17a696){var _0x44ce96={};var _0x5ceb95={};var _0x30cdcc;var _0x1d308a;return db['DeskConfiguration'][_0xbc32('0x4a')]({'where':{'id':_0x4e8d6a[_0xbc32('0x48')]['id']}})[_0xbc32('0x24')](handleEntityNotFound(_0x3c1bf4,null))[_0xbc32('0x24')](function(_0xfe6120){if(_0xfe6120){_0x30cdcc=_0xfe6120;_0x5ceb95[_0xbc32('0x44')]=_[_0xbc32('0x2e')](db[_0xbc32('0x4f')][_0xbc32('0x4c')]);_0x5ceb95['query']=_[_0xbc32('0x2e')](_0x4e8d6a[_0xbc32('0x2d')]);_0x5ceb95[_0xbc32('0x2f')]=_[_0xbc32('0x30')](_0x5ceb95[_0xbc32('0x44')],_0x5ceb95['query']);_0x44ce96[_0xbc32('0x31')]=_[_0xbc32('0x30')](_0x5ceb95[_0xbc32('0x44')],qs[_0xbc32('0x32')](_0x4e8d6a[_0xbc32('0x2d')][_0xbc32('0x32')]));_0x44ce96['attributes']=_0x44ce96[_0xbc32('0x31')][_0xbc32('0x33')]?_0x44ce96[_0xbc32('0x31')]:_0x5ceb95[_0xbc32('0x44')];_0x44ce96[_0xbc32('0x36')]=qs[_0xbc32('0x37')](_0x4e8d6a[_0xbc32('0x2d')]['sort']);_0x44ce96[_0xbc32('0x38')]=qs[_0xbc32('0x2f')](_['pick'](_0x4e8d6a['query'],_0x5ceb95[_0xbc32('0x2f')]));if(_0x4e8d6a[_0xbc32('0x2d')][_0xbc32('0x3a')]){_0x44ce96[_0xbc32('0x38')]=_['merge'](_0x44ce96['where'],{'$or':_[_0xbc32('0x2a')](_0x44ce96[_0xbc32('0x31')],function(_0x5dfebe){var _0xf4b21={};_0xf4b21[_0x5dfebe]={'$like':'%'+_0x4e8d6a[_0xbc32('0x2d')]['filter']+'%'};return _0xf4b21;})});}_0x44ce96=_[_0xbc32('0x3b')]({},_0x44ce96,_0x4e8d6a[_0xbc32('0x3d')]);return _0x30cdcc[_0xbc32('0x50')](_0x44ce96);}})[_0xbc32('0x24')](function(_0x443323){if(_0x443323){_0x1d308a=_0x443323['length'];if(!_0x4e8d6a[_0xbc32('0x2d')][_0xbc32('0x34')]('nolimit')){_0x44ce96[_0xbc32('0x1c')]=qs[_0xbc32('0x1c')](_0x4e8d6a[_0xbc32('0x2d')][_0xbc32('0x1c')]);_0x44ce96['offset']=qs['offset'](_0x4e8d6a[_0xbc32('0x2d')][_0xbc32('0x1d')]);}return _0x30cdcc[_0xbc32('0x50')](_0x44ce96);}})[_0xbc32('0x24')](function(_0x4b3c47){if(_0x4b3c47){return _0x4b3c47?{'count':_0x1d308a,'rows':_0x4b3c47}:null;}})[_0xbc32('0x24')](respondWithResult(_0x3c1bf4,null))[_0xbc32('0x43')](handleError(_0x3c1bf4,null));};exports[_0xbc32('0x51')]=function(_0x22d8b3,_0x47163b,_0x52b544){if(_0x22d8b3[_0xbc32('0x47')]['id']){delete _0x22d8b3['body']['id'];}return db[_0xbc32('0x3e')][_0xbc32('0x4a')]({'where':{'id':_0x22d8b3[_0xbc32('0x48')]['id']}})[_0xbc32('0x24')](handleEntityNotFound(_0x47163b,null))[_0xbc32('0x24')](function(_0x18e753){if(_0x18e753){return _0x18e753[_0xbc32('0x51')](_0x22d8b3['body'][_0xbc32('0x52')]||[]);}return null;})[_0xbc32('0x24')](respondWithResult(_0x47163b,null))[_0xbc32('0x43')](handleError(_0x47163b,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 70b7f28..26591f7 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 _0x802b=['api','moment','bluebird','request-promise','../../config/environment','./intDeskConfiguration.attributes','exports','define','int_desk_configurations','util'];(function(_0xf16b1,_0x33c637){var _0x26f94d=function(_0x5643d7){while(--_0x5643d7){_0xf16b1['push'](_0xf16b1['shift']());}};_0x26f94d(++_0x33c637);}(_0x802b,0x103));var _0xb802=function(_0x9e556a,_0x5c609d){_0x9e556a=_0x9e556a-0x0;var _0x5e448c=_0x802b[_0x9e556a];return _0x5e448c;};'use strict';var _=require('lodash');var util=require(_0xb802('0x0'));var logger=require('../../config/logger')(_0xb802('0x1'));var moment=require(_0xb802('0x2'));var BPromise=require(_0xb802('0x3'));var rp=require(_0xb802('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb802('0x5'));var attributes=require(_0xb802('0x6'));module[_0xb802('0x7')]=function(_0x3266a2,_0x2d339e){return _0x3266a2[_0xb802('0x8')]('DeskConfiguration',attributes,{'tableName':_0xb802('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4e9=['util','moment','request-promise','../../config/environment','./intDeskConfiguration.attributes','DeskConfiguration','lodash'];(function(_0x1aed80,_0x3ca6f6){var _0x43961e=function(_0x43bf2b){while(--_0x43bf2b){_0x1aed80['push'](_0x1aed80['shift']());}};_0x43961e(++_0x3ca6f6);}(_0xa4e9,0x1c6));var _0x9a4e=function(_0x5d115e,_0x35ce96){_0x5d115e=_0x5d115e-0x0;var _0x420939=_0xa4e9[_0x5d115e];return _0x420939;};'use strict';var _=require(_0x9a4e('0x0'));var util=require(_0x9a4e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9a4e('0x2'));var BPromise=require('bluebird');var rp=require(_0x9a4e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9a4e('0x4'));var attributes=require(_0x9a4e('0x5'));module['exports']=function(_0x4c78cd,_0x5dcbc7){return _0x4c78cd['define'](_0x9a4e('0x6'),attributes,{'tableName':'int_desk_configurations','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 5aab8dc..bcf0abf 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 _0xa413=['result','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','info'];(function(_0x5e9d1f,_0x37c578){var _0x895bea=function(_0x4e10bc){while(--_0x4e10bc){_0x5e9d1f['push'](_0x5e9d1f['shift']());}};_0x895bea(++_0x37c578);}(_0xa413,0x1e5));var _0x3a41=function(_0x60f097,_0x2ed802){_0x60f097=_0x60f097-0x0;var _0x4ab565=_0xa413[_0x60f097];return _0x4ab565;};'use strict';var _=require(_0x3a41('0x0'));var util=require('util');var moment=require(_0x3a41('0x1'));var BPromise=require('bluebird');var rs=require(_0x3a41('0x2'));var fs=require('fs');var Redis=require(_0x3a41('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3a41('0x4'))(_0x3a41('0x5'));var config=require(_0x3a41('0x6'));var jayson=require(_0x3a41('0x7'));var client=jayson[_0x3a41('0x8')][_0x3a41('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45f6d2,_0x407d52,_0xca7253){return new BPromise(function(_0x473cd2,_0x27c2e5){return client['request'](_0x45f6d2,_0xca7253)[_0x3a41('0xa')](function(_0x570304){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x407d52,_0x3a41('0xb'));logger['debug'](_0x3a41('0xc'),_0x407d52,'request\x20sent',JSON[_0x3a41('0xd')](_0x570304));if(_0x570304[_0x3a41('0xe')]){if(_0x570304['error'][_0x3a41('0xf')]===0x1f4){logger[_0x3a41('0xe')](_0x3a41('0x10'),_0x407d52,_0x570304[_0x3a41('0xe')][_0x3a41('0x11')]);return _0x27c2e5(_0x570304['error'][_0x3a41('0x11')]);}logger[_0x3a41('0xe')](_0x3a41('0x10'),_0x407d52,_0x570304[_0x3a41('0xe')][_0x3a41('0x11')]);return _0x473cd2(_0x570304[_0x3a41('0xe')][_0x3a41('0x11')]);}else{logger[_0x3a41('0x12')](_0x3a41('0x10'),_0x407d52,_0x3a41('0xb'));_0x473cd2(_0x570304[_0x3a41('0x13')]['message']);}})[_0x3a41('0x14')](function(_0x30d675){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x407d52,_0x30d675);_0x27c2e5(_0x30d675);});});} \ No newline at end of file +var _0x8c7a=['then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x16941f,_0x3d4cf8){var _0x5c8780=function(_0x3b8af1){while(--_0x3b8af1){_0x16941f['push'](_0x16941f['shift']());}};_0x5c8780(++_0x3d4cf8);}(_0x8c7a,0x197));var _0xa8c7=function(_0x518c8f,_0x23aff7){_0x518c8f=_0x518c8f-0x0;var _0x551cf5=_0x8c7a[_0x518c8f];return _0x551cf5;};'use strict';var _=require(_0xa8c7('0x0'));var util=require(_0xa8c7('0x1'));var moment=require(_0xa8c7('0x2'));var BPromise=require(_0xa8c7('0x3'));var rs=require(_0xa8c7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa8c7('0x5'))(_0xa8c7('0x6'));var config=require(_0xa8c7('0x7'));var jayson=require(_0xa8c7('0x8'));var client=jayson['client'][_0xa8c7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x373404,_0x1ecf2d,_0x13b3dd){return new BPromise(function(_0x22a59e,_0x595a4c){return client[_0xa8c7('0xa')](_0x373404,_0x13b3dd)[_0xa8c7('0xb')](function(_0x19d302){logger[_0xa8c7('0xc')](_0xa8c7('0xd'),_0x1ecf2d,_0xa8c7('0xe'));logger[_0xa8c7('0xf')](_0xa8c7('0x10'),_0x1ecf2d,_0xa8c7('0xe'),JSON[_0xa8c7('0x11')](_0x19d302));if(_0x19d302[_0xa8c7('0x12')]){if(_0x19d302[_0xa8c7('0x12')]['code']===0x1f4){logger[_0xa8c7('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x1ecf2d,_0x19d302[_0xa8c7('0x12')]['message']);return _0x595a4c(_0x19d302[_0xa8c7('0x12')]['message']);}logger[_0xa8c7('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x1ecf2d,_0x19d302['error']['message']);return _0x22a59e(_0x19d302['error'][_0xa8c7('0x13')]);}else{logger[_0xa8c7('0xc')](_0xa8c7('0xd'),_0x1ecf2d,_0xa8c7('0xe'));_0x22a59e(_0x19d302[_0xa8c7('0x14')]['message']);}})[_0xa8c7('0x15')](function(_0x5d82b6){logger['error'](_0xa8c7('0xd'),_0x1ecf2d,_0x5d82b6);_0x595a4c(_0x5d82b6);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index a8195ea..d972021 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 _0x0942=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','index','/:id','show','post','isAuthenticated','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x0942,0x11a));var _0x2094=function(_0x1c292e,_0x64468e){_0x1c292e=_0x1c292e-0x0;var _0xf1bef6=_0x0942[_0x1c292e];return _0xf1bef6;};'use strict';var multer=require('multer');var util=require(_0x2094('0x0'));var path=require(_0x2094('0x1'));var timeout=require(_0x2094('0x2'));var express=require(_0x2094('0x3'));var router=express[_0x2094('0x4')]();var fs_extra=require(_0x2094('0x5'));var auth=require(_0x2094('0x6'));var interaction=require(_0x2094('0x7'));var config=require('../../config/environment');var controller=require(_0x2094('0x8'));router[_0x2094('0x9')]('/',auth['isAuthenticated'](),controller[_0x2094('0xa')]);router[_0x2094('0x9')](_0x2094('0xb'),auth['isAuthenticated'](),controller[_0x2094('0xc')]);router[_0x2094('0xd')]('/',auth[_0x2094('0xe')](),controller['create']);router[_0x2094('0xf')](_0x2094('0xb'),auth[_0x2094('0xe')](),controller['update']);router[_0x2094('0x10')](_0x2094('0xb'),auth[_0x2094('0xe')](),controller[_0x2094('0x11')]);module[_0x2094('0x12')]=router; \ No newline at end of file +var _0x2a84=['../../config/environment','./intDeskField.controller','get','index','/:id','isAuthenticated','post','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4ed666,_0x134f7d){var _0x56d81d=function(_0x14f066){while(--_0x14f066){_0x4ed666['push'](_0x4ed666['shift']());}};_0x56d81d(++_0x134f7d);}(_0x2a84,0x170));var _0x42a8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2a84[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x42a8('0x0'));var util=require(_0x42a8('0x1'));var path=require('path');var timeout=require(_0x42a8('0x2'));var express=require(_0x42a8('0x3'));var router=express[_0x42a8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x42a8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x42a8('0x6'));var controller=require(_0x42a8('0x7'));router[_0x42a8('0x8')]('/',auth['isAuthenticated'](),controller[_0x42a8('0x9')]);router['get'](_0x42a8('0xa'),auth[_0x42a8('0xb')](),controller['show']);router[_0x42a8('0xc')]('/',auth[_0x42a8('0xb')](),controller['create']);router[_0x42a8('0xd')](_0x42a8('0xa'),auth['isAuthenticated'](),controller[_0x42a8('0xe')]);router[_0x42a8('0xf')](_0x42a8('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x42a8('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 6c6264b..554f2ff 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 _0x3f9c=['picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x3b3fbe,_0x85e207){var _0xccc387=function(_0x557bc4){while(--_0x557bc4){_0x3b3fbe['push'](_0x3b3fbe['shift']());}};_0xccc387(++_0x85e207);}(_0x3f9c,0xb7));var _0xc3f9=function(_0x2d9963,_0x3c9ca9){_0x2d9963=_0x2d9963-0x0;var _0xaf69b4=_0x3f9c[_0x2d9963];return _0xaf69b4;};'use strict';var Sequelize=require('sequelize');module[_0xc3f9('0x0')]={'type':{'type':Sequelize[_0xc3f9('0x1')](_0xc3f9('0x2'),_0xc3f9('0x3'),_0xc3f9('0x4'),_0xc3f9('0x5'),_0xc3f9('0x6')),'defaultValue':_0xc3f9('0x2')},'content':{'type':Sequelize[_0xc3f9('0x7')]},'key':{'type':Sequelize[_0xc3f9('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xc3f9('0x2'),'variable',_0xc3f9('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc3f9('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc3f9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc3f9('0x7')]}}; \ No newline at end of file +var _0xb4d3=['variable','customVariable','STRING','sequelize','ENUM','string'];(function(_0x582f63,_0x4ed6c1){var _0x32c7c1=function(_0x3e1c2d){while(--_0x3e1c2d){_0x582f63['push'](_0x582f63['shift']());}};_0x32c7c1(++_0x4ed6c1);}(_0xb4d3,0xcf));var _0x3b4d=function(_0x3fe6df,_0x5a04d4){_0x3fe6df=_0x3fe6df-0x0;var _0x372a0e=_0xb4d3[_0x3fe6df];return _0x372a0e;};'use strict';var Sequelize=require(_0x3b4d('0x0'));module['exports']={'type':{'type':Sequelize[_0x3b4d('0x1')](_0x3b4d('0x2'),_0x3b4d('0x3'),_0x3b4d('0x4'),'keyValue','picklist'),'defaultValue':_0x3b4d('0x2')},'content':{'type':Sequelize[_0x3b4d('0x5')]},'key':{'type':Sequelize[_0x3b4d('0x5')]},'keyType':{'type':Sequelize[_0x3b4d('0x1')]('string','variable',_0x3b4d('0x4'))},'keyContent':{'type':Sequelize[_0x3b4d('0x5')]},'idField':{'type':Sequelize[_0x3b4d('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3b4d('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 04828db..215b3bf 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 _0x1203=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','update','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','includeAll','include','findAll','then','rows','catch','show','keys','DeskField','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x4b4c9e,_0x36ee5f){var _0x51134c=function(_0x51d25e){while(--_0x51d25e){_0x4b4c9e['push'](_0x4b4c9e['shift']());}};_0x51134c(++_0x36ee5f);}(_0x1203,0x8c));var _0x3120=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1203[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3120('0x0'));var rimraf=require(_0x3120('0x1'));var zipdir=require(_0x3120('0x2'));var jsonpatch=require(_0x3120('0x3'));var rp=require(_0x3120('0x4'));var moment=require(_0x3120('0x5'));var BPromise=require(_0x3120('0x6'));var Mustache=require(_0x3120('0x7'));var util=require(_0x3120('0x8'));var path=require(_0x3120('0x9'));var sox=require(_0x3120('0xa'));var csv=require(_0x3120('0xb'));var ejs=require(_0x3120('0xc'));var fs=require('fs');var fs_extra=require(_0x3120('0xd'));var _=require(_0x3120('0xe'));var squel=require(_0x3120('0xf'));var crypto=require('crypto');var jsforce=require(_0x3120('0x10'));var deskjs=require(_0x3120('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3120('0x12'));var authService=require(_0x3120('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3120('0x14'));var hardwareService=require(_0x3120('0x15'));var logger=require(_0x3120('0x16'))(_0x3120('0x17'));var utils=require('../../config/utils');var config=require(_0x3120('0x18'));var licenseUtil=require(_0x3120('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a4312,_0x41a236){_0x41a236=_0x41a236||0xcc;return function(_0x2b1879){if(_0x2b1879){return _0x4a4312[_0x3120('0x1a')](_0x41a236);}return _0x4a4312[_0x3120('0x1b')](_0x41a236)[_0x3120('0x1c')]();};}function respondWithResult(_0x1f05b6,_0x1ef350){_0x1ef350=_0x1ef350||0xc8;return function(_0x4a2b20){if(_0x4a2b20){return _0x1f05b6[_0x3120('0x1b')](_0x1ef350)[_0x3120('0x1d')](_0x4a2b20);}};}function respondWithFilteredResult(_0xcda8,_0x18357e){return function(_0x1d919e){if(_0x1d919e){var _0x335d6b=typeof _0x18357e[_0x3120('0x1e')]==='undefined'&&typeof _0x18357e[_0x3120('0x1f')]==='undefined';var _0x1eb41f=_0x1d919e[_0x3120('0x20')];var _0x2bbdb7=_0x335d6b?0x0:_0x18357e[_0x3120('0x1e')];var _0x3c8c9b=_0x335d6b?_0x1d919e[_0x3120('0x20')]:_0x18357e[_0x3120('0x1e')]+_0x18357e['limit'];var _0xb16dcd;if(_0x3c8c9b>=_0x1eb41f){_0x3c8c9b=_0x1eb41f;_0xb16dcd=0xc8;}else{_0xb16dcd=0xce;}_0xcda8['status'](_0xb16dcd);return _0xcda8[_0x3120('0x21')](_0x3120('0x22'),_0x2bbdb7+'-'+_0x3c8c9b+'/'+_0x1eb41f)[_0x3120('0x1d')](_0x1d919e);}return null;};}function patchUpdates(_0x5bfd37){return function(_0x5a0bce){try{jsonpatch['apply'](_0x5a0bce,_0x5bfd37,!![]);}catch(_0x44a04c){return BPromise[_0x3120('0x23')](_0x44a04c);}return _0x5a0bce['save']();};}function saveUpdates(_0x1358e0,_0x2cf3be){return function(_0x3fbd05){if(_0x3fbd05){return _0x3fbd05[_0x3120('0x24')](_0x1358e0)['then'](function(_0x4739c3){return _0x4739c3;});}return null;};}function removeEntity(_0x5977b2,_0x444b3b){return function(_0xb762e2){if(_0xb762e2){return _0xb762e2[_0x3120('0x25')]()['then'](function(){_0x5977b2['status'](0xcc)[_0x3120('0x1c')]();});}};}function handleEntityNotFound(_0x7d0b5f,_0x5e0f82){return function(_0xc88506){if(!_0xc88506){_0x7d0b5f[_0x3120('0x1a')](0x194);}return _0xc88506;};}function handleError(_0x2493ca,_0x4bc011){_0x4bc011=_0x4bc011||0x1f4;return function(_0x2636b5){logger[_0x3120('0x26')](_0x2636b5[_0x3120('0x27')]);if(_0x2636b5[_0x3120('0x28')]){delete _0x2636b5['name'];}_0x2493ca['status'](_0x4bc011)['send'](_0x2636b5);};}exports[_0x3120('0x29')]=function(_0x5444ec,_0x2bc753){var _0x303055={},_0x3de290={},_0x3399fd={'count':0x0,'rows':[]};var _0x186ace=_[_0x3120('0x2a')](db['DeskField'][_0x3120('0x2b')],function(_0xeed487){return{'name':_0xeed487[_0x3120('0x2c')],'type':_0xeed487[_0x3120('0x2d')][_0x3120('0x2e')]};});_0x3de290[_0x3120('0x2f')]=_[_0x3120('0x2a')](_0x186ace,_0x3120('0x28'));_0x3de290['query']=_['keys'](_0x5444ec[_0x3120('0x30')]);_0x3de290[_0x3120('0x31')]=_[_0x3120('0x32')](_0x3de290[_0x3120('0x2f')],_0x3de290[_0x3120('0x30')]);_0x303055[_0x3120('0x33')]=_['intersection'](_0x3de290[_0x3120('0x2f')],qs[_0x3120('0x34')](_0x5444ec[_0x3120('0x30')][_0x3120('0x34')]));_0x303055[_0x3120('0x33')]=_0x303055[_0x3120('0x33')][_0x3120('0x35')]?_0x303055['attributes']:_0x3de290[_0x3120('0x2f')];if(!_0x5444ec[_0x3120('0x30')][_0x3120('0x36')](_0x3120('0x37'))){_0x303055[_0x3120('0x1f')]=qs[_0x3120('0x1f')](_0x5444ec[_0x3120('0x30')][_0x3120('0x1f')]);_0x303055[_0x3120('0x1e')]=qs[_0x3120('0x1e')](_0x5444ec[_0x3120('0x30')][_0x3120('0x1e')]);}_0x303055[_0x3120('0x38')]=qs['sort'](_0x5444ec['query'][_0x3120('0x39')]);_0x303055[_0x3120('0x3a')]=qs[_0x3120('0x31')](_['pick'](_0x5444ec[_0x3120('0x30')],_0x3de290[_0x3120('0x31')]),_0x186ace);if(_0x5444ec[_0x3120('0x30')]['filter']){_0x303055[_0x3120('0x3a')]=_[_0x3120('0x3b')](_0x303055[_0x3120('0x3a')],{'$or':_[_0x3120('0x2a')](_0x186ace,function(_0x8b0a5a){if(_0x8b0a5a[_0x3120('0x2d')]!=='VIRTUAL'){var _0x5e5200={};_0x5e5200[_0x8b0a5a['name']]={'$like':'%'+_0x5444ec[_0x3120('0x30')]['filter']+'%'};return _0x5e5200;}})});}_0x303055=_[_0x3120('0x3b')]({},_0x303055,_0x5444ec[_0x3120('0x3c')]);var _0x20bde7={'where':_0x303055[_0x3120('0x3a')]};return db['DeskField'][_0x3120('0x20')](_0x20bde7)['then'](function(_0x31bf0f){_0x3399fd[_0x3120('0x20')]=_0x31bf0f;if(_0x5444ec[_0x3120('0x30')][_0x3120('0x3d')]){_0x303055[_0x3120('0x3e')]=[{'all':!![]}];}return db['DeskField'][_0x3120('0x3f')](_0x303055);})[_0x3120('0x40')](function(_0x19a317){_0x3399fd[_0x3120('0x41')]=_0x19a317;return _0x3399fd;})['then'](respondWithFilteredResult(_0x2bc753,_0x303055))[_0x3120('0x42')](handleError(_0x2bc753,null));};exports[_0x3120('0x43')]=function(_0x513276,_0x1f7b81){var _0x30dfd1={'raw':!![],'where':{'id':_0x513276['params']['id']}},_0x1680cc={};_0x1680cc[_0x3120('0x2f')]=_[_0x3120('0x44')](db['DeskField'][_0x3120('0x2b')]);_0x1680cc[_0x3120('0x30')]=_['keys'](_0x513276['query']);_0x1680cc[_0x3120('0x31')]=_[_0x3120('0x32')](_0x1680cc[_0x3120('0x2f')],_0x1680cc[_0x3120('0x30')]);_0x30dfd1[_0x3120('0x33')]=_[_0x3120('0x32')](_0x1680cc[_0x3120('0x2f')],qs[_0x3120('0x34')](_0x513276[_0x3120('0x30')][_0x3120('0x34')]));_0x30dfd1['attributes']=_0x30dfd1[_0x3120('0x33')][_0x3120('0x35')]?_0x30dfd1[_0x3120('0x33')]:_0x1680cc[_0x3120('0x2f')];if(_0x513276['query']['includeAll']){_0x30dfd1[_0x3120('0x3e')]=[{'all':!![]}];}_0x30dfd1=_['merge']({},_0x30dfd1,_0x513276[_0x3120('0x3c')]);return db[_0x3120('0x45')][_0x3120('0x46')](_0x30dfd1)[_0x3120('0x40')](handleEntityNotFound(_0x1f7b81,null))[_0x3120('0x40')](respondWithResult(_0x1f7b81,null))[_0x3120('0x42')](handleError(_0x1f7b81,null));};exports[_0x3120('0x47')]=function(_0x22ac87,_0x5a741c){return db[_0x3120('0x45')][_0x3120('0x47')](_0x22ac87[_0x3120('0x48')],{})[_0x3120('0x40')](respondWithResult(_0x5a741c,0xc9))[_0x3120('0x42')](handleError(_0x5a741c,null));};exports['update']=function(_0x4bcb78,_0x5bbe60){if(_0x4bcb78[_0x3120('0x48')]['id']){delete _0x4bcb78[_0x3120('0x48')]['id'];}return db[_0x3120('0x45')][_0x3120('0x46')]({'where':{'id':_0x4bcb78['params']['id']}})[_0x3120('0x40')](handleEntityNotFound(_0x5bbe60,null))[_0x3120('0x40')](saveUpdates(_0x4bcb78[_0x3120('0x48')],null))[_0x3120('0x40')](respondWithResult(_0x5bbe60,null))[_0x3120('0x42')](handleError(_0x5bbe60,null));};exports[_0x3120('0x25')]=function(_0x297134,_0x2f7ae8){return db[_0x3120('0x45')]['find']({'where':{'id':_0x297134['params']['id']}})['then'](handleEntityNotFound(_0x2f7ae8,null))[_0x3120('0x40')](removeEntity(_0x2f7ae8,null))['catch'](handleError(_0x2f7ae8,null));}; \ No newline at end of file +var _0xaa0d=['../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','DeskField','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','zip-dir','fast-json-patch','moment','bluebird','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis'];(function(_0x52b675,_0x4f667e){var _0x4aaf04=function(_0x48df4b){while(--_0x48df4b){_0x52b675['push'](_0x52b675['shift']());}};_0x4aaf04(++_0x4f667e);}(_0xaa0d,0x18a));var _0xdaa0=function(_0x58b20c,_0x12958a){_0x58b20c=_0x58b20c-0x0;var _0x464d1d=_0xaa0d[_0x58b20c];return _0x464d1d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdaa0('0x0'));var jsonpatch=require(_0xdaa0('0x1'));var rp=require('request-promise');var moment=require(_0xdaa0('0x2'));var BPromise=require(_0xdaa0('0x3'));var Mustache=require('mustache');var util=require(_0xdaa0('0x4'));var path=require(_0xdaa0('0x5'));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(_0xdaa0('0x6'));var squel=require(_0xdaa0('0x7'));var crypto=require(_0xdaa0('0x8'));var jsforce=require(_0xdaa0('0x9'));var deskjs=require(_0xdaa0('0xa'));var toCsv=require(_0xdaa0('0xb'));var querystring=require('querystring');var Papa=require(_0xdaa0('0xc'));var Redis=require(_0xdaa0('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xdaa0('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdaa0('0xf'));var logger=require('../../config/logger')(_0xdaa0('0x10'));var utils=require(_0xdaa0('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xdaa0('0x12'));var db=require(_0xdaa0('0x13'))['db'];function respondWithStatusCode(_0x5917f9,_0x252119){_0x252119=_0x252119||0xcc;return function(_0x15ae8f){if(_0x15ae8f){return _0x5917f9['sendStatus'](_0x252119);}return _0x5917f9[_0xdaa0('0x14')](_0x252119)[_0xdaa0('0x15')]();};}function respondWithResult(_0x52f6b6,_0x1ac597){_0x1ac597=_0x1ac597||0xc8;return function(_0x1cdb9d){if(_0x1cdb9d){return _0x52f6b6[_0xdaa0('0x14')](_0x1ac597)['json'](_0x1cdb9d);}};}function respondWithFilteredResult(_0x827463,_0x42538d){return function(_0x7a1199){if(_0x7a1199){var _0x33724d=typeof _0x42538d[_0xdaa0('0x16')]==='undefined'&&typeof _0x42538d['limit']===_0xdaa0('0x17');var _0x517768=_0x7a1199['count'];var _0x25cdd9=_0x33724d?0x0:_0x42538d['offset'];var _0x30259b=_0x33724d?_0x7a1199['count']:_0x42538d[_0xdaa0('0x16')]+_0x42538d[_0xdaa0('0x18')];var _0x1236c2;if(_0x30259b>=_0x517768){_0x30259b=_0x517768;_0x1236c2=0xc8;}else{_0x1236c2=0xce;}_0x827463[_0xdaa0('0x14')](_0x1236c2);return _0x827463['set'](_0xdaa0('0x19'),_0x25cdd9+'-'+_0x30259b+'/'+_0x517768)[_0xdaa0('0x1a')](_0x7a1199);}return null;};}function patchUpdates(_0x52128c){return function(_0x4931da){try{jsonpatch[_0xdaa0('0x1b')](_0x4931da,_0x52128c,!![]);}catch(_0x3f07b8){return BPromise[_0xdaa0('0x1c')](_0x3f07b8);}return _0x4931da[_0xdaa0('0x1d')]();};}function saveUpdates(_0x18c0e3,_0x3ee642){return function(_0x3dc55a){if(_0x3dc55a){return _0x3dc55a[_0xdaa0('0x1e')](_0x18c0e3)[_0xdaa0('0x1f')](function(_0x4ab27f){return _0x4ab27f;});}return null;};}function removeEntity(_0x274b94,_0x551e28){return function(_0x569039){if(_0x569039){return _0x569039[_0xdaa0('0x20')]()[_0xdaa0('0x1f')](function(){_0x274b94['status'](0xcc)[_0xdaa0('0x15')]();});}};}function handleEntityNotFound(_0x2f25ef,_0x357127){return function(_0xfeb1fd){if(!_0xfeb1fd){_0x2f25ef[_0xdaa0('0x21')](0x194);}return _0xfeb1fd;};}function handleError(_0x2f81ee,_0x2df125){_0x2df125=_0x2df125||0x1f4;return function(_0x12e4fc){logger['error'](_0x12e4fc[_0xdaa0('0x22')]);if(_0x12e4fc[_0xdaa0('0x23')]){delete _0x12e4fc['name'];}_0x2f81ee['status'](_0x2df125)['send'](_0x12e4fc);};}exports[_0xdaa0('0x24')]=function(_0x14647a,_0x56c56c){var _0x46c8d9={},_0x3f297c={},_0x78b11d={'count':0x0,'rows':[]};var _0x54861b=_[_0xdaa0('0x25')](db[_0xdaa0('0x26')]['rawAttributes'],function(_0x15efd8){return{'name':_0x15efd8[_0xdaa0('0x27')],'type':_0x15efd8[_0xdaa0('0x28')][_0xdaa0('0x29')]};});_0x3f297c[_0xdaa0('0x2a')]=_[_0xdaa0('0x25')](_0x54861b,_0xdaa0('0x23'));_0x3f297c[_0xdaa0('0x2b')]=_[_0xdaa0('0x2c')](_0x14647a[_0xdaa0('0x2b')]);_0x3f297c[_0xdaa0('0x2d')]=_['intersection'](_0x3f297c[_0xdaa0('0x2a')],_0x3f297c[_0xdaa0('0x2b')]);_0x46c8d9[_0xdaa0('0x2e')]=_['intersection'](_0x3f297c[_0xdaa0('0x2a')],qs[_0xdaa0('0x2f')](_0x14647a[_0xdaa0('0x2b')][_0xdaa0('0x2f')]));_0x46c8d9[_0xdaa0('0x2e')]=_0x46c8d9['attributes'][_0xdaa0('0x30')]?_0x46c8d9[_0xdaa0('0x2e')]:_0x3f297c[_0xdaa0('0x2a')];if(!_0x14647a['query'][_0xdaa0('0x31')](_0xdaa0('0x32'))){_0x46c8d9[_0xdaa0('0x18')]=qs['limit'](_0x14647a[_0xdaa0('0x2b')][_0xdaa0('0x18')]);_0x46c8d9[_0xdaa0('0x16')]=qs['offset'](_0x14647a[_0xdaa0('0x2b')][_0xdaa0('0x16')]);}_0x46c8d9['order']=qs[_0xdaa0('0x33')](_0x14647a[_0xdaa0('0x2b')][_0xdaa0('0x33')]);_0x46c8d9[_0xdaa0('0x34')]=qs[_0xdaa0('0x2d')](_[_0xdaa0('0x35')](_0x14647a[_0xdaa0('0x2b')],_0x3f297c[_0xdaa0('0x2d')]),_0x54861b);if(_0x14647a[_0xdaa0('0x2b')]['filter']){_0x46c8d9[_0xdaa0('0x34')]=_[_0xdaa0('0x36')](_0x46c8d9[_0xdaa0('0x34')],{'$or':_[_0xdaa0('0x25')](_0x54861b,function(_0x5045ac){if(_0x5045ac['type']!==_0xdaa0('0x37')){var _0x400eb6={};_0x400eb6[_0x5045ac['name']]={'$like':'%'+_0x14647a[_0xdaa0('0x2b')][_0xdaa0('0x38')]+'%'};return _0x400eb6;}})});}_0x46c8d9=_[_0xdaa0('0x36')]({},_0x46c8d9,_0x14647a[_0xdaa0('0x39')]);var _0x4ea52b={'where':_0x46c8d9[_0xdaa0('0x34')]};return db[_0xdaa0('0x26')]['count'](_0x4ea52b)[_0xdaa0('0x1f')](function(_0x6f2007){_0x78b11d['count']=_0x6f2007;if(_0x14647a['query'][_0xdaa0('0x3a')]){_0x46c8d9[_0xdaa0('0x3b')]=[{'all':!![]}];}return db[_0xdaa0('0x26')][_0xdaa0('0x3c')](_0x46c8d9);})['then'](function(_0x2011bd){_0x78b11d[_0xdaa0('0x3d')]=_0x2011bd;return _0x78b11d;})[_0xdaa0('0x1f')](respondWithFilteredResult(_0x56c56c,_0x46c8d9))[_0xdaa0('0x3e')](handleError(_0x56c56c,null));};exports[_0xdaa0('0x3f')]=function(_0x360b66,_0x405a4c){var _0x14e2c0={'raw':!![],'where':{'id':_0x360b66[_0xdaa0('0x40')]['id']}},_0x52d1a3={};_0x52d1a3[_0xdaa0('0x2a')]=_['keys'](db[_0xdaa0('0x26')]['rawAttributes']);_0x52d1a3['query']=_[_0xdaa0('0x2c')](_0x360b66[_0xdaa0('0x2b')]);_0x52d1a3[_0xdaa0('0x2d')]=_['intersection'](_0x52d1a3[_0xdaa0('0x2a')],_0x52d1a3['query']);_0x14e2c0[_0xdaa0('0x2e')]=_['intersection'](_0x52d1a3[_0xdaa0('0x2a')],qs[_0xdaa0('0x2f')](_0x360b66[_0xdaa0('0x2b')][_0xdaa0('0x2f')]));_0x14e2c0[_0xdaa0('0x2e')]=_0x14e2c0[_0xdaa0('0x2e')][_0xdaa0('0x30')]?_0x14e2c0[_0xdaa0('0x2e')]:_0x52d1a3[_0xdaa0('0x2a')];if(_0x360b66[_0xdaa0('0x2b')][_0xdaa0('0x3a')]){_0x14e2c0[_0xdaa0('0x3b')]=[{'all':!![]}];}_0x14e2c0=_[_0xdaa0('0x36')]({},_0x14e2c0,_0x360b66['options']);return db[_0xdaa0('0x26')][_0xdaa0('0x41')](_0x14e2c0)[_0xdaa0('0x1f')](handleEntityNotFound(_0x405a4c,null))[_0xdaa0('0x1f')](respondWithResult(_0x405a4c,null))[_0xdaa0('0x3e')](handleError(_0x405a4c,null));};exports['create']=function(_0x3a6dd0,_0x417b00){return db[_0xdaa0('0x26')][_0xdaa0('0x42')](_0x3a6dd0['body'],{})['then'](respondWithResult(_0x417b00,0xc9))[_0xdaa0('0x3e')](handleError(_0x417b00,null));};exports[_0xdaa0('0x1e')]=function(_0x5355f5,_0x4dff20){if(_0x5355f5['body']['id']){delete _0x5355f5[_0xdaa0('0x43')]['id'];}return db['DeskField'][_0xdaa0('0x41')]({'where':{'id':_0x5355f5['params']['id']}})['then'](handleEntityNotFound(_0x4dff20,null))['then'](saveUpdates(_0x5355f5['body'],null))[_0xdaa0('0x1f')](respondWithResult(_0x4dff20,null))[_0xdaa0('0x3e')](handleError(_0x4dff20,null));};exports[_0xdaa0('0x20')]=function(_0x543cc2,_0x1a6b94){return db[_0xdaa0('0x26')][_0xdaa0('0x41')]({'where':{'id':_0x543cc2[_0xdaa0('0x40')]['id']}})[_0xdaa0('0x1f')](handleEntityNotFound(_0x1a6b94,null))['then'](removeEntity(_0x1a6b94,null))[_0xdaa0('0x3e')](handleError(_0x1a6b94,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index b3aff0e..291f8c5 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 _0x5384=['moment','bluebird','path','rimraf','../../config/environment','exports','define','int_desk_fields','desk_unique_index','FieldId','../../config/logger','api'];(function(_0x3f4ba6,_0x133cd6){var _0x4fa5a3=function(_0x136d8b){while(--_0x136d8b){_0x3f4ba6['push'](_0x3f4ba6['shift']());}};_0x4fa5a3(++_0x133cd6);}(_0x5384,0x12a));var _0x4538=function(_0x31f598,_0x4db552){_0x31f598=_0x31f598-0x0;var _0x4700c6=_0x5384[_0x31f598];return _0x4700c6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4538('0x0'))(_0x4538('0x1'));var moment=require(_0x4538('0x2'));var BPromise=require(_0x4538('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4538('0x4'));var rimraf=require(_0x4538('0x5'));var config=require(_0x4538('0x6'));var attributes=require('./intDeskField.attributes');module[_0x4538('0x7')]=function(_0x22ed75,_0x13ec2d){return _0x22ed75[_0x4538('0x8')]('DeskField',attributes,{'tableName':_0x4538('0x9'),'paranoid':![],'indexes':[{'name':_0x4538('0xa'),'fields':['idField',_0x4538('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x50af=['define','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x4ea05a,_0x5c5a00){var _0x16e176=function(_0x3e3a2c){while(--_0x3e3a2c){_0x4ea05a['push'](_0x4ea05a['shift']());}};_0x16e176(++_0x5c5a00);}(_0x50af,0x17c));var _0xf50a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x50af[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf50a('0x0'));var util=require(_0xf50a('0x1'));var logger=require(_0xf50a('0x2'))(_0xf50a('0x3'));var moment=require(_0xf50a('0x4'));var BPromise=require(_0xf50a('0x5'));var rp=require(_0xf50a('0x6'));var fs=require('fs');var path=require(_0xf50a('0x7'));var rimraf=require(_0xf50a('0x8'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0xf50a('0x9')]=function(_0x4b8b50,_0x587a93){return _0x4b8b50[_0xf50a('0xa')]('DeskField',attributes,{'tableName':_0xf50a('0xb'),'paranoid':![],'indexes':[{'name':_0xf50a('0xc'),'fields':[_0xf50a('0xd'),_0xf50a('0xe')],'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 df1bc40..ac7d06b 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 _0x6055=['../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','DeskField,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','../../mysqldb'];(function(_0x33eb1a,_0x5a7d04){var _0x1e6365=function(_0x398461){while(--_0x398461){_0x33eb1a['push'](_0x33eb1a['shift']());}};_0x1e6365(++_0x5a7d04);}(_0x6055,0x10c));var _0x5605=function(_0x69d49d,_0x34ad93){_0x69d49d=_0x69d49d-0x0;var _0x388b8a=_0x6055[_0x69d49d];return _0x388b8a;};'use strict';var _=require(_0x5605('0x0'));var util=require('util');var moment=require(_0x5605('0x1'));var BPromise=require(_0x5605('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5605('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5605('0x4'));var jayson=require(_0x5605('0x5'));var client=jayson['client'][_0x5605('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xd25564,_0x1cb5b5,_0x438f9a){return new BPromise(function(_0x54ede3,_0xae16c3){return client[_0x5605('0x7')](_0xd25564,_0x438f9a)['then'](function(_0x40a487){logger[_0x5605('0x8')]('DeskField,\x20%s,\x20%s',_0x1cb5b5,_0x5605('0x9'));logger[_0x5605('0xa')](_0x5605('0xb'),_0x1cb5b5,'request\x20sent',JSON['stringify'](_0x40a487));if(_0x40a487[_0x5605('0xc')]){if(_0x40a487['error']['code']===0x1f4){logger['error'](_0x5605('0xd'),_0x1cb5b5,_0x40a487[_0x5605('0xc')]['message']);return _0xae16c3(_0x40a487[_0x5605('0xc')][_0x5605('0xe')]);}logger[_0x5605('0xc')]('DeskField,\x20%s,\x20%s',_0x1cb5b5,_0x40a487['error'][_0x5605('0xe')]);return _0x54ede3(_0x40a487[_0x5605('0xc')][_0x5605('0xe')]);}else{logger[_0x5605('0x8')](_0x5605('0xd'),_0x1cb5b5,_0x5605('0x9'));_0x54ede3(_0x40a487['result'][_0x5605('0xe')]);}})[_0x5605('0xf')](function(_0x7506f5){logger[_0x5605('0xc')](_0x5605('0xd'),_0x1cb5b5,_0x7506f5);_0xae16c3(_0x7506f5);});});} \ No newline at end of file +var _0x2a56=['info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x2ff5fe,_0x309c9d){var _0x1a4c30=function(_0x5a28f8){while(--_0x5a28f8){_0x2ff5fe['push'](_0x2ff5fe['shift']());}};_0x1a4c30(++_0x309c9d);}(_0x2a56,0xa3));var _0x62a5=function(_0x30433b,_0x1f1900){_0x30433b=_0x30433b-0x0;var _0x310de4=_0x2a56[_0x30433b];return _0x310de4;};'use strict';var _=require(_0x62a5('0x0'));var util=require(_0x62a5('0x1'));var moment=require(_0x62a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x62a5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62a5('0x4'))['db'];var utils=require(_0x62a5('0x5'));var logger=require(_0x62a5('0x6'))(_0x62a5('0x7'));var config=require(_0x62a5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x62a5('0x9')][_0x62a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x576710,_0x290f80,_0x61836d){return new BPromise(function(_0x7576d0,_0xdf1e3f){return client[_0x62a5('0xb')](_0x576710,_0x61836d)[_0x62a5('0xc')](function(_0x5b38c2){logger[_0x62a5('0xd')](_0x62a5('0xe'),_0x290f80,_0x62a5('0xf'));logger['debug'](_0x62a5('0x10'),_0x290f80,_0x62a5('0xf'),JSON[_0x62a5('0x11')](_0x5b38c2));if(_0x5b38c2[_0x62a5('0x12')]){if(_0x5b38c2[_0x62a5('0x12')]['code']===0x1f4){logger['error'](_0x62a5('0xe'),_0x290f80,_0x5b38c2[_0x62a5('0x12')]['message']);return _0xdf1e3f(_0x5b38c2[_0x62a5('0x12')]['message']);}logger[_0x62a5('0x12')](_0x62a5('0xe'),_0x290f80,_0x5b38c2[_0x62a5('0x12')][_0x62a5('0x13')]);return _0x7576d0(_0x5b38c2[_0x62a5('0x12')][_0x62a5('0x13')]);}else{logger[_0x62a5('0xd')](_0x62a5('0xe'),_0x290f80,_0x62a5('0xf'));_0x7576d0(_0x5b38c2[_0x62a5('0x14')][_0x62a5('0x13')]);}})[_0x62a5('0x15')](function(_0x428baa){logger[_0x62a5('0x12')](_0x62a5('0xe'),_0x290f80,_0x428baa);_0xdf1e3f(_0x428baa);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index d24e228..aca08a0 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 _0x14a3=['util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','delete','destroy','exports'];(function(_0x23ec06,_0x561142){var _0x2831d4=function(_0x3802bc){while(--_0x3802bc){_0x23ec06['push'](_0x23ec06['shift']());}};_0x2831d4(++_0x561142);}(_0x14a3,0x165));var _0x314a=function(_0x448774,_0x45ddc7){_0x448774=_0x448774-0x0;var _0x46b2f6=_0x14a3[_0x448774];return _0x46b2f6;};'use strict';var multer=require('multer');var util=require(_0x314a('0x0'));var path=require('path');var timeout=require(_0x314a('0x1'));var express=require(_0x314a('0x2'));var router=express[_0x314a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x314a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x314a('0x5'));var controller=require(_0x314a('0x6'));router[_0x314a('0x7')]('/',auth[_0x314a('0x8')](),controller[_0x314a('0x9')]);router['get'](_0x314a('0xa'),auth['isAuthenticated'](),controller[_0x314a('0xb')]);router[_0x314a('0x7')](_0x314a('0xc'),auth[_0x314a('0x8')](),controller['getConfigurations']);router[_0x314a('0x7')](_0x314a('0xd'),auth[_0x314a('0x8')](),controller[_0x314a('0xe')]);router[_0x314a('0xf')]('/',auth[_0x314a('0x8')](),controller['create']);router['post'](_0x314a('0xc'),auth[_0x314a('0x8')](),controller[_0x314a('0x10')]);router[_0x314a('0x11')](_0x314a('0xa'),auth[_0x314a('0x8')](),controller['update']);router[_0x314a('0x12')](_0x314a('0xa'),auth[_0x314a('0x8')](),controller[_0x314a('0x13')]);module[_0x314a('0x14')]=router; \ No newline at end of file +var _0x2de4=['./intDynamics365Account.controller','index','get','isAuthenticated','show','getConfigurations','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x35efed,_0x31a75d){var _0xb3f72=function(_0x4c546d){while(--_0x4c546d){_0x35efed['push'](_0x35efed['shift']());}};_0xb3f72(++_0x31a75d);}(_0x2de4,0x190));var _0x42de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2de4[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x42de('0x0'));var path=require(_0x42de('0x1'));var timeout=require(_0x42de('0x2'));var express=require(_0x42de('0x3'));var router=express[_0x42de('0x4')]();var fs_extra=require(_0x42de('0x5'));var auth=require(_0x42de('0x6'));var interaction=require(_0x42de('0x7'));var config=require('../../config/environment');var controller=require(_0x42de('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x42de('0x9')]);router[_0x42de('0xa')]('/:id',auth[_0x42de('0xb')](),controller[_0x42de('0xc')]);router['get']('/:id/configurations',auth[_0x42de('0xb')](),controller[_0x42de('0xd')]);router[_0x42de('0xa')]('/:id/fields',auth[_0x42de('0xb')](),controller[_0x42de('0xe')]);router['post']('/',auth[_0x42de('0xb')](),controller[_0x42de('0xf')]);router[_0x42de('0x10')](_0x42de('0x11'),auth[_0x42de('0xb')](),controller[_0x42de('0x12')]);router[_0x42de('0x13')]('/:id',auth[_0x42de('0xb')](),controller[_0x42de('0x14')]);router[_0x42de('0x15')](_0x42de('0x16'),auth['isAuthenticated'](),controller[_0x42de('0x17')]);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 43f985b..41e9c6f 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 _0x1d2c=['STRING','sequelize','exports'];(function(_0x3bd53c,_0x15e862){var _0x33cacb=function(_0x59a10c){while(--_0x59a10c){_0x3bd53c['push'](_0x3bd53c['shift']());}};_0x33cacb(++_0x15e862);}(_0x1d2c,0x1a8));var _0xc1d2=function(_0x141eb6,_0x2c30ab){_0x141eb6=_0x141eb6-0x0;var _0x29ee9e=_0x1d2c[_0x141eb6];return _0x29ee9e;};'use strict';var Sequelize=require(_0xc1d2('0x0'));module[_0xc1d2('0x1')]={'name':{'type':Sequelize[_0xc1d2('0x2')]},'username':{'type':Sequelize[_0xc1d2('0x2')]},'password':{'type':Sequelize[_0xc1d2('0x2')]},'remoteUri':{'type':Sequelize[_0xc1d2('0x2')]},'tenantId':{'type':Sequelize[_0xc1d2('0x2')]},'clientId':{'type':Sequelize[_0xc1d2('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xc1d2('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc1d2('0x2')]}}; \ No newline at end of file +var _0x099f=['STRING','sequelize','exports'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x099f,0x133));var _0xf099=function(_0xa6b2bc,_0x415600){_0xa6b2bc=_0xa6b2bc-0x0;var _0x489a1b=_0x099f[_0xa6b2bc];return _0x489a1b;};'use strict';var Sequelize=require(_0xf099('0x0'));module[_0xf099('0x1')]={'name':{'type':Sequelize[_0xf099('0x2')]},'username':{'type':Sequelize[_0xf099('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xf099('0x2')]},'tenantId':{'type':Sequelize[_0xf099('0x2')]},'clientId':{'type':Sequelize[_0xf099('0x2')]},'clientSecret':{'type':Sequelize[_0xf099('0x2')]},'serverUrl':{'type':Sequelize[_0xf099('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf099('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 2564964..f7caeed 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 _0x55ca=['entitlementidname','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','remoteUri','tenantId','clientId','clientSecret','slice','substring','POST','https://login.microsoftonline.com/','/oauth2/token','username','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(','Attributes','remove','includes','LogicalName','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','forEach','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','statusCode','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false','Bearer\x20','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','Dynamics365Account','then','includeAll','include','findAll','rows','show','merge','options','find','catch','create','body','findOne','params','Dynamics365Configuration','sort','getConfigurations','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','getFields','ticketType','incident','PhoneCall','title','description','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress'];(function(_0x5d1d25,_0x763b36){var _0x5d5dce=function(_0x4e813c){while(--_0x4e813c){_0x5d1d25['push'](_0x5d1d25['shift']());}};_0x5d5dce(++_0x763b36);}(_0x55ca,0x126));var _0xa55c=function(_0x580cf8,_0x26751e){_0x580cf8=_0x580cf8-0x0;var _0xcc9a9e=_0x55ca[_0x580cf8];return _0xcc9a9e;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x59d84a,_0x2a35be){_0x2a35be=_0x2a35be||0xcc;return function(_0x576044){if(_0x576044){return _0x59d84a['sendStatus'](_0x2a35be);}return _0x59d84a['status'](_0x2a35be)[_0xa55c('0x18')]();};}function respondWithResult(_0x3930e4,_0x462cd6){_0x462cd6=_0x462cd6||0xc8;return function(_0x938bd6){if(_0x938bd6){return _0x3930e4[_0xa55c('0x19')](_0x462cd6)[_0xa55c('0x1a')](_0x938bd6);}};}function respondWithFilteredResult(_0x4e0b2f,_0x3ccf65){return function(_0x3dcf4f){if(_0x3dcf4f){var _0x25934f=typeof _0x3ccf65[_0xa55c('0x1b')]===_0xa55c('0x1c')&&typeof _0x3ccf65[_0xa55c('0x1d')]===_0xa55c('0x1c');var _0x2d09d8=_0x3dcf4f[_0xa55c('0x1e')];var _0x4cee3c=_0x25934f?0x0:_0x3ccf65[_0xa55c('0x1b')];var _0x104a99=_0x25934f?_0x3dcf4f[_0xa55c('0x1e')]:_0x3ccf65[_0xa55c('0x1b')]+_0x3ccf65[_0xa55c('0x1d')];var _0x5426e5;if(_0x104a99>=_0x2d09d8){_0x104a99=_0x2d09d8;_0x5426e5=0xc8;}else{_0x5426e5=0xce;}_0x4e0b2f['status'](_0x5426e5);return _0x4e0b2f['set'](_0xa55c('0x1f'),_0x4cee3c+'-'+_0x104a99+'/'+_0x2d09d8)[_0xa55c('0x1a')](_0x3dcf4f);}return null;};}function patchUpdates(_0xade4c4){return function(_0x4cfe10){try{jsonpatch[_0xa55c('0x20')](_0x4cfe10,_0xade4c4,!![]);}catch(_0x2fcb90){return BPromise['reject'](_0x2fcb90);}return _0x4cfe10[_0xa55c('0x21')]();};}function saveUpdates(_0x133096,_0x940f28){return function(_0x1965f1){if(_0x1965f1){return _0x1965f1[_0xa55c('0x22')](_0x133096)['then'](function(_0x1fc828){return _0x1fc828;});}return null;};}function removeEntity(_0x504c24,_0x5ba836){return function(_0x59d89a){if(_0x59d89a){return _0x59d89a[_0xa55c('0x23')]()['then'](function(){_0x504c24[_0xa55c('0x19')](0xcc)[_0xa55c('0x18')]();});}};}function handleEntityNotFound(_0x3f64de,_0xf0e574){return function(_0x2313a9){if(!_0x2313a9){_0x3f64de[_0xa55c('0x24')](0x194);}return _0x2313a9;};}function handleError(_0x1da633,_0x11e7f7){_0x11e7f7=_0x11e7f7||0x1f4;return function(_0x192df2){logger[_0xa55c('0x25')](_0x192df2[_0xa55c('0x26')]);if(_0x192df2['name']){delete _0x192df2[_0xa55c('0x27')];}_0x1da633[_0xa55c('0x19')](_0x11e7f7)[_0xa55c('0x28')](_0x192df2);};}exports[_0xa55c('0x29')]=function(_0x5d940d,_0x1377b0){var _0x22f6b6={},_0x1b8388={},_0x201941={'count':0x0,'rows':[]};var _0x45ee8d=_[_0xa55c('0x2a')](db['Dynamics365Account'][_0xa55c('0x2b')],function(_0x490b7d){return{'name':_0x490b7d[_0xa55c('0x2c')],'type':_0x490b7d[_0xa55c('0x2d')][_0xa55c('0x2e')]};});_0x1b8388[_0xa55c('0x2f')]=_['map'](_0x45ee8d,_0xa55c('0x27'));_0x1b8388[_0xa55c('0x30')]=_[_0xa55c('0x31')](_0x5d940d[_0xa55c('0x30')]);_0x1b8388[_0xa55c('0x32')]=_[_0xa55c('0x33')](_0x1b8388[_0xa55c('0x2f')],_0x1b8388[_0xa55c('0x30')]);_0x22f6b6[_0xa55c('0x34')]=_[_0xa55c('0x33')](_0x1b8388[_0xa55c('0x2f')],qs['fields'](_0x5d940d['query'][_0xa55c('0x35')]));_0x22f6b6[_0xa55c('0x34')]=_0x22f6b6['attributes'][_0xa55c('0x36')]?_0x22f6b6[_0xa55c('0x34')]:_0x1b8388[_0xa55c('0x2f')];if(!_0x5d940d[_0xa55c('0x30')][_0xa55c('0x37')](_0xa55c('0x38'))){_0x22f6b6[_0xa55c('0x1d')]=qs[_0xa55c('0x1d')](_0x5d940d[_0xa55c('0x30')]['limit']);_0x22f6b6['offset']=qs['offset'](_0x5d940d[_0xa55c('0x30')][_0xa55c('0x1b')]);}_0x22f6b6[_0xa55c('0x39')]=qs['sort'](_0x5d940d[_0xa55c('0x30')]['sort']);_0x22f6b6[_0xa55c('0x3a')]=qs['filters'](_[_0xa55c('0x3b')](_0x5d940d[_0xa55c('0x30')],_0x1b8388[_0xa55c('0x32')]),_0x45ee8d);if(_0x5d940d['query'][_0xa55c('0x3c')]){_0x22f6b6[_0xa55c('0x3a')]=_['merge'](_0x22f6b6[_0xa55c('0x3a')],{'$or':_[_0xa55c('0x2a')](_0x45ee8d,function(_0x4d9083){if(_0x4d9083['type']!==_0xa55c('0x3d')){var _0x5d3960={};_0x5d3960[_0x4d9083[_0xa55c('0x27')]]={'$like':'%'+_0x5d940d[_0xa55c('0x30')]['filter']+'%'};return _0x5d3960;}})});}_0x22f6b6=_['merge']({},_0x22f6b6,_0x5d940d['options']);var _0x4de781={'where':_0x22f6b6[_0xa55c('0x3a')]};return db[_0xa55c('0x3e')][_0xa55c('0x1e')](_0x4de781)[_0xa55c('0x3f')](function(_0x2d8cbf){_0x201941['count']=_0x2d8cbf;if(_0x5d940d[_0xa55c('0x30')][_0xa55c('0x40')]){_0x22f6b6[_0xa55c('0x41')]=[{'all':!![]}];}return db[_0xa55c('0x3e')][_0xa55c('0x42')](_0x22f6b6);})[_0xa55c('0x3f')](function(_0x554620){_0x201941[_0xa55c('0x43')]=_0x554620;return _0x201941;})['then'](respondWithFilteredResult(_0x1377b0,_0x22f6b6))['catch'](handleError(_0x1377b0,null));};exports[_0xa55c('0x44')]=function(_0x1f63d8,_0x496920){var _0x2bd98b={'raw':![],'where':{'id':_0x1f63d8['params']['id']}},_0x508bd3={};_0x508bd3[_0xa55c('0x2f')]=_[_0xa55c('0x31')](db[_0xa55c('0x3e')]['rawAttributes']);_0x508bd3[_0xa55c('0x30')]=_[_0xa55c('0x31')](_0x1f63d8['query']);_0x508bd3[_0xa55c('0x32')]=_['intersection'](_0x508bd3[_0xa55c('0x2f')],_0x508bd3[_0xa55c('0x30')]);_0x2bd98b['attributes']=_[_0xa55c('0x33')](_0x508bd3[_0xa55c('0x2f')],qs['fields'](_0x1f63d8[_0xa55c('0x30')][_0xa55c('0x35')]));_0x2bd98b[_0xa55c('0x34')]=_0x2bd98b['attributes'][_0xa55c('0x36')]?_0x2bd98b['attributes']:_0x508bd3[_0xa55c('0x2f')];if(_0x1f63d8[_0xa55c('0x30')][_0xa55c('0x40')]){_0x2bd98b['include']=[{'all':!![]}];}_0x2bd98b=_[_0xa55c('0x45')]({},_0x2bd98b,_0x1f63d8[_0xa55c('0x46')]);return db['Dynamics365Account'][_0xa55c('0x47')](_0x2bd98b)[_0xa55c('0x3f')](handleEntityNotFound(_0x496920,null))['then'](respondWithResult(_0x496920,null))[_0xa55c('0x48')](handleError(_0x496920,null));};exports[_0xa55c('0x49')]=function(_0x52f9a7,_0x46f839){return db[_0xa55c('0x3e')][_0xa55c('0x49')](_0x52f9a7[_0xa55c('0x4a')],{})['then'](respondWithResult(_0x46f839,0xc9))[_0xa55c('0x48')](handleError(_0x46f839,null));};exports['update']=function(_0x2157d6,_0x213100){if(_0x2157d6[_0xa55c('0x4a')]['id']){delete _0x2157d6['body']['id'];}return db[_0xa55c('0x3e')][_0xa55c('0x47')]({'where':{'id':_0x2157d6['params']['id']}})[_0xa55c('0x3f')](handleEntityNotFound(_0x213100,null))[_0xa55c('0x3f')](saveUpdates(_0x2157d6[_0xa55c('0x4a')],null))[_0xa55c('0x3f')](respondWithResult(_0x213100,null))[_0xa55c('0x48')](handleError(_0x213100,null));};exports[_0xa55c('0x23')]=function(_0x1e1293,_0x129626){return db[_0xa55c('0x3e')][_0xa55c('0x47')]({'where':{'id':_0x1e1293['params']['id']}})[_0xa55c('0x3f')](handleEntityNotFound(_0x129626,null))[_0xa55c('0x3f')](removeEntity(_0x129626,null))[_0xa55c('0x48')](handleError(_0x129626,null));};exports['getConfigurations']=function(_0x4c3095,_0x35bf0a,_0x4f5ecd){var _0x21b760={};var _0x4fa412={};var _0x2b6a0e;var _0x228df4;return db[_0xa55c('0x3e')][_0xa55c('0x4b')]({'where':{'id':_0x4c3095[_0xa55c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x35bf0a,null))[_0xa55c('0x3f')](function(_0x4607ca){if(_0x4607ca){_0x2b6a0e=_0x4607ca;_0x4fa412['model']=_[_0xa55c('0x31')](db[_0xa55c('0x4d')][_0xa55c('0x2b')]);_0x4fa412[_0xa55c('0x30')]=_['keys'](_0x4c3095['query']);_0x4fa412[_0xa55c('0x32')]=_[_0xa55c('0x33')](_0x4fa412[_0xa55c('0x2f')],_0x4fa412[_0xa55c('0x30')]);_0x21b760['attributes']=_[_0xa55c('0x33')](_0x4fa412['model'],qs[_0xa55c('0x35')](_0x4c3095[_0xa55c('0x30')][_0xa55c('0x35')]));_0x21b760[_0xa55c('0x34')]=_0x21b760[_0xa55c('0x34')]['length']?_0x21b760[_0xa55c('0x34')]:_0x4fa412['model'];_0x21b760[_0xa55c('0x39')]=qs[_0xa55c('0x4e')](_0x4c3095[_0xa55c('0x30')][_0xa55c('0x4e')]);_0x21b760[_0xa55c('0x3a')]=qs[_0xa55c('0x32')](_[_0xa55c('0x3b')](_0x4c3095['query'],_0x4fa412[_0xa55c('0x32')]));if(_0x4c3095[_0xa55c('0x30')][_0xa55c('0x3c')]){_0x21b760[_0xa55c('0x3a')]=_[_0xa55c('0x45')](_0x21b760['where'],{'$or':_[_0xa55c('0x2a')](_0x21b760[_0xa55c('0x34')],function(_0x28bac4){var _0x20e53c={};_0x20e53c[_0x28bac4]={'$like':'%'+_0x4c3095[_0xa55c('0x30')]['filter']+'%'};return _0x20e53c;})});}_0x21b760=_[_0xa55c('0x45')]({},_0x21b760,_0x4c3095[_0xa55c('0x46')]);return _0x2b6a0e[_0xa55c('0x4f')](_0x21b760);}})[_0xa55c('0x3f')](function(_0x3ba56d){if(_0x3ba56d){_0x228df4=_0x3ba56d['length'];if(!_0x4c3095[_0xa55c('0x30')]['hasOwnProperty'](_0xa55c('0x38'))){_0x21b760['limit']=qs[_0xa55c('0x1d')](_0x4c3095['query'][_0xa55c('0x1d')]);_0x21b760[_0xa55c('0x1b')]=qs[_0xa55c('0x1b')](_0x4c3095[_0xa55c('0x30')][_0xa55c('0x1b')]);}return _0x2b6a0e[_0xa55c('0x4f')](_0x21b760);}})[_0xa55c('0x3f')](function(_0x2f2226){if(_0x2f2226){return _0x2f2226?{'count':_0x228df4,'rows':_0x2f2226}:null;}})[_0xa55c('0x3f')](respondWithResult(_0x35bf0a,null))[_0xa55c('0x48')](handleError(_0x35bf0a,null));};exports['addConfiguration']=function(_0x150a07,_0x311bb9,_0x4ef914){if(_0x150a07[_0xa55c('0x4a')]['id']){delete _0x150a07[_0xa55c('0x4a')]['id'];}return db[_0xa55c('0x3e')][_0xa55c('0x4b')]({'where':{'id':_0x150a07[_0xa55c('0x4c')]['id']}})[_0xa55c('0x3f')](handleEntityNotFound(_0x311bb9,null))[_0xa55c('0x3f')](function(_0x202191){if(_0x202191){_0x150a07['body'][_0xa55c('0x50')]=_0x202191['id'];_0x150a07[_0xa55c('0x4a')][_0xa55c('0x51')]=integrations[_0xa55c('0x52')](_0x150a07[_0xa55c('0x4a')][_0xa55c('0x53')],_0x150a07[_0xa55c('0x4a')][_0xa55c('0x2d')]);_0x150a07[_0xa55c('0x4a')]['Descriptions']=integrations[_0xa55c('0x54')](_0x150a07[_0xa55c('0x4a')][_0xa55c('0x53')],_0x150a07[_0xa55c('0x4a')][_0xa55c('0x2d')]);return db[_0xa55c('0x4d')][_0xa55c('0x49')](_0x150a07[_0xa55c('0x4a')],{'include':[{'model':db[_0xa55c('0x55')],'as':_0xa55c('0x51')},{'model':db[_0xa55c('0x55')],'as':'Descriptions'}]});}return null;})[_0xa55c('0x3f')](respondWithResult(_0x311bb9,null))['catch'](handleError(_0x311bb9,null));};exports[_0xa55c('0x56')]=function(_0x1ff077,_0x129bb4,_0x4f2a7b){var _0x4d9722=_0x1ff077[_0xa55c('0x30')][_0xa55c('0x57')];var _0x23c84c=_0x4d9722===_0xa55c('0x58')?'Incident':_0xa55c('0x59');var _0xd02251='';var _0x8ea1c6='';var _0x3a9910='';var _0x21fc9b='';var _0x500968='';var _0x4b090c='';var _0x3f7fca='';var _0x38689e='';var _0x3f9d0a=[_0xa55c('0x5a'),_0xa55c('0x5b'),'customerid',_0xa55c('0x5c'),_0xa55c('0x5d'),'subject',_0xa55c('0x5e'),_0xa55c('0x5f'),_0xa55c('0x60'),'phonecall_activity_parties'];var _0x1521d5=[_0xa55c('0x61'),_0xa55c('0x62'),_0xa55c('0x63'),_0xa55c('0x64'),'contactidname',_0xa55c('0x65'),_0xa55c('0x66'),'contractidname','createdbyexternalpartyname',_0xa55c('0x67'),'createdbyname',_0xa55c('0x68'),_0xa55c('0x69'),_0xa55c('0x6a'),_0xa55c('0x6b'),_0xa55c('0x6c'),_0xa55c('0x6d'),_0xa55c('0x6e'),_0xa55c('0x6f'),_0xa55c('0x70'),'entityimage_timestamp',_0xa55c('0x71'),_0xa55c('0x72'),_0xa55c('0x73'),_0xa55c('0x74'),'followupby',_0xa55c('0x75'),_0xa55c('0x76'),_0xa55c('0x77'),_0xa55c('0x78'),'masteridname','modifiedbyexternalpartyname',_0xa55c('0x79'),_0xa55c('0x7a'),_0xa55c('0x7b'),_0xa55c('0x7c'),'modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0xa55c('0x7d'),_0xa55c('0x7e'),_0xa55c('0x7f'),_0xa55c('0x80'),_0xa55c('0x81'),_0xa55c('0x82'),_0xa55c('0x83'),'owneridyominame',_0xa55c('0x84'),'primarycontactidname',_0xa55c('0x85'),'prioritycodename',_0xa55c('0x86'),_0xa55c('0x87'),_0xa55c('0x88'),_0xa55c('0x89'),_0xa55c('0x8a'),_0xa55c('0x8b'),_0xa55c('0x8c'),_0xa55c('0x8d'),'slainvokedidname','slaname',_0xa55c('0x8e'),_0xa55c('0x8f'),_0xa55c('0x90'),_0xa55c('0x91'),_0xa55c('0x92'),_0xa55c('0x93'),'transactioncurrencyidname',_0xa55c('0x94'),_0xa55c('0x95'),_0xa55c('0x96')];var _0x3b117e=_0x3f9d0a[_0xa55c('0x97')](_0x1521d5);return db[_0xa55c('0x3e')][_0xa55c('0x4b')]({'where':{'id':_0x1ff077[_0xa55c('0x4c')]['id']},'attributes':['id','username',_0xa55c('0x98'),_0xa55c('0x99'),_0xa55c('0x9a'),_0xa55c('0x9b'),_0xa55c('0x9c')]})['then'](handleEntityNotFound(_0x129bb4,null))[_0xa55c('0x3f')](function(_0x2ab1f2){if(_0x2ab1f2){_0x38689e=_0x2ab1f2['remoteUri'];var _0x4863d5=_0x38689e[_0xa55c('0x9d')](-0x1);if(_0x4863d5==='/'){_0x38689e=_0x38689e[_0xa55c('0x9e')](0x0,_0x38689e['lastIndexOf'](_0x4863d5));}_0x3f7fca=util['format']('%s/api/data/v9.0/',_0x38689e);var _0x5ab79e={'method':_0xa55c('0x9f'),'uri':_0xa55c('0xa0')+_0x2ab1f2[_0xa55c('0x9a')]+_0xa55c('0xa1'),'form':{'client_id':_0x2ab1f2[_0xa55c('0x9b')],'resource':_0x38689e,'username':_0x2ab1f2[_0xa55c('0xa2')],'password':_0x2ab1f2['password'],'grant_type':_0xa55c('0x98'),'client_secret':_0x2ab1f2[_0xa55c('0x9c')]},'json':!![]};return rp(_0x5ab79e);}})[_0xa55c('0x3f')](function(_0x44a388){_0x4b090c=_0x44a388['access_token'];var _0x24154e={'method':_0xa55c('0xa3'),'uri':encodeURI(_0x3f7fca+_0xa55c('0xa4')+_0x23c84c+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x4b090c,'If-None-Match':null,'OData-Version':_0xa55c('0xa5')},'json':!![]};return rp(_0x24154e);})['then'](function(_0x5e26f0){var _0x1d20bf=_0x5e26f0[_0xa55c('0xa6')][0x0];var _0x1e298d=_0x1d20bf[_0xa55c('0xa7')];var _0x2544c1={'method':_0xa55c('0xa3'),'uri':_0x3f7fca+_0xa55c('0xa8')+_0x1e298d+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x4b090c,'If-None-Match':null,'OData-Version':_0xa55c('0xa5')},'json':!![]};return rp(_0x2544c1);})[_0xa55c('0x3f')](function(_0x24a368){_0xd02251=_0x24a368;_0x8ea1c6=_0xd02251[_0xa55c('0xa9')];_0x8ea1c6=_[_0xa55c('0xaa')](_0x8ea1c6,function(_0x2a0805){return!_0x3b117e[_0xa55c('0xab')](_0x2a0805[_0xa55c('0xac')]);});var _0xc79fb8=[];var _0x115fc4=[];_0x8ea1c6['forEach'](function(_0xc9c3fa){if(_0xc9c3fa[_0xa55c('0xad')]){var _0x540f1e=_0xc9c3fa[_0xa55c('0xad')]['substring'](_0xc9c3fa[_0xa55c('0xad')][_0xa55c('0xae')]('.')+0x1);if(_0x540f1e===_0xa55c('0xaf')){_0xc79fb8[_0xa55c('0xb0')](getSelectList(_0x3f7fca,_0x4d9722,_0x115fc4,_0xd02251[_0xa55c('0xa7')],_0xc9c3fa['MetadataId'],_0x4b090c));}}});return Promise[_0xa55c('0xb1')](_0xc79fb8);})[_0xa55c('0x3f')](function(_0x1f2f86){_0x3a9910=_0x1f2f86[0x0];var _0x376c1f=[];var _0x3300a9=[];_0x8ea1c6[_0xa55c('0xb2')](function(_0x193208){if(!_['isNil'](_0x193208['@odata.type'])){var _0x5c08e5=_0x193208[_0xa55c('0xad')]['substring'](_0x193208[_0xa55c('0xad')][_0xa55c('0xae')]('.')+0x1);if(_0x5c08e5===_0xa55c('0xb3')){_0x376c1f[_0xa55c('0xb0')](getBooleanList(_0x3f7fca,_0x4d9722,_0x3300a9,_0xd02251[_0xa55c('0xa7')],_0x193208['MetadataId'],_0x4b090c));}}});return Promise[_0xa55c('0xb1')](_0x376c1f);})['then'](function(_0x210db6){_0x21fc9b=_0x210db6[0x0];var _0x2bab53=[];var _0x430061=[];_0x8ea1c6[_0xa55c('0xb2')](function(_0x4b7e16){if(_0x4b7e16[_0xa55c('0xad')]){var _0x46f8ab=_0x4b7e16[_0xa55c('0xad')][_0xa55c('0x9e')](_0x4b7e16[_0xa55c('0xad')][_0xa55c('0xae')]('.')+0x1);if(_0x46f8ab===_0xa55c('0xb4')||_0x46f8ab===_0xa55c('0xb5')||_0x46f8ab==='BigIntAttributeMetadata'||_0x46f8ab===_0xa55c('0xb6')||_0x46f8ab===_0xa55c('0xb7')||_0x46f8ab===_0xa55c('0xb8')||_0x46f8ab===_0xa55c('0xb9')||_0x46f8ab===_0xa55c('0xba')||_0x46f8ab===_0xa55c('0xbb')||_0x46f8ab==='DecimalAttributeMetadata'){_0x2bab53[_0xa55c('0xb0')](getInputList(_0x3f7fca,_0x4d9722,_0x46f8ab,_0x430061,_0xd02251['MetadataId'],_0x4b7e16[_0xa55c('0xa7')],_0x4b090c));}}});return Promise['all'](_0x2bab53);})[_0xa55c('0x3f')](function(_0x35e292){_0x500968=_0x35e292[0x0];var _0x17312b=_0x3a9910['concat'](_0x21fc9b)[_0xa55c('0x97')](_0x500968);var _0x46efb4={'count':_0x17312b[_0xa55c('0x36')],'rows':_0x17312b};return _0x46efb4;})['then'](respondWithResult(_0x129bb4,null))[_0xa55c('0x48')](function(_0x4c0c82){var _0x777c32=_0x1ff077[_0xa55c('0x30')]['test']?0x1f4:_0x4c0c82[_0xa55c('0xbc')]||0x1f4;logger['error'](_0x4c0c82[_0xa55c('0x26')]);delete _0x4c0c82[_0xa55c('0x27')];if(_0x777c32===0x191){_0x777c32=0x190;}_0x129bb4['status'](_0x777c32)[_0xa55c('0x28')](_0x1ff077[_0xa55c('0x30')]['test']?{'message':_0xa55c('0xbd'),'statusCode':_0x4c0c82[_0xa55c('0xbc')]}:_0x4c0c82);});};function getSelectList(_0x5c071b,_0x3d8877,_0x56597c,_0x5c7059,_0x28a26d,_0x3113b9){var _0x28a71e={'method':_0xa55c('0xa3'),'uri':_0x5c071b+'EntityDefinitions('+_0x5c7059+_0xa55c('0xbe')+_0x28a26d+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xa55c('0xbf'),'headers':{'Authorization':'Bearer\x20'+_0x3113b9,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x28a71e)['then'](function(_0x999114){var _0x5ec269=[];var _0x4f0cb1=_0x999114[_0xa55c('0xc0')][_0xa55c('0xc1')];_0x4f0cb1[_0xa55c('0xb2')](function(_0x4046ae){_0x5ec269[_0xa55c('0xb0')]({'name':_0x4046ae[_0xa55c('0xc2')][_0xa55c('0xc3')][_0xa55c('0xc2')],'value':String(_0x4046ae[_0xa55c('0xc4')])});});var _0x1e37d6={'id':_0x3d8877+'_'+_0x999114[_0xa55c('0xac')],'name':_0x999114[_0xa55c('0xc5')][_0xa55c('0xc3')]['Label'],'custom':![],'options':_0x5ec269};_0x56597c[_0xa55c('0xb0')](_0x1e37d6);return _0x56597c;});}function getBooleanList(_0x4eebbb,_0x514d16,_0x5c8003,_0x325e29,_0x573aa2,_0xd5a27a){var _0x55e447={'method':_0xa55c('0xa3'),'uri':_0x4eebbb+'EntityDefinitions('+_0x325e29+')/Attributes('+_0x573aa2+_0xa55c('0xc6'),'headers':{'Authorization':'Bearer\x20'+_0xd5a27a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x55e447)[_0xa55c('0x3f')](function(_0x1796eb){var _0x4ba496=[];_0x4ba496[_0xa55c('0xb0')]({'name':_0x1796eb['OptionSet'][_0xa55c('0xc7')][_0xa55c('0xc2')][_0xa55c('0xc3')]['Label'],'value':'true'},{'name':_0x1796eb[_0xa55c('0xc0')][_0xa55c('0xc8')][_0xa55c('0xc2')][_0xa55c('0xc3')][_0xa55c('0xc2')],'value':_0xa55c('0xc9')});var _0x1483f4={'id':_0x514d16+'_'+_0x1796eb[_0xa55c('0xac')],'name':_0x1796eb['DisplayName'][_0xa55c('0xc3')][_0xa55c('0xc2')],'custom':![],'options':_0x4ba496};_0x5c8003[_0xa55c('0xb0')](_0x1483f4);return _0x5c8003;});}function getInputList(_0x39cc7c,_0x7e237d,_0x1a01de,_0x2fa186,_0x129a4d,_0x3e67b4,_0x54db98){var _0x19ebd5={'method':_0xa55c('0xa3'),'uri':_0x39cc7c+_0xa55c('0xa8')+_0x129a4d+')/Attributes('+_0x3e67b4+')/Microsoft.Dynamics.CRM.'+_0x1a01de+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xa55c('0xca')+_0x54db98,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x19ebd5)[_0xa55c('0x3f')](function(_0x41242e){var _0x7b7fa1={'id':_0x7e237d+'_'+_0x41242e[_0xa55c('0xac')],'name':_0x41242e[_0xa55c('0xc5')][_0xa55c('0xc3')]?_0x41242e[_0xa55c('0xc5')][_0xa55c('0xc3')][_0xa55c('0xc2')]:_0x41242e[_0xa55c('0xac')],'custom':![],'options':[]};_0x2fa186[_0xa55c('0xb0')](_0x7b7fa1);return _0x2fa186;});} \ No newline at end of file +var _0x9c44=['end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','error','name','send','map','Dynamics365Account','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','order','where','filters','pick','filter','type','VIRTUAL','merge','options','then','includeAll','include','findAll','show','params','length','find','catch','create','body','update','getConfigurations','findOne','Dynamics365Configuration','sort','hasOwnProperty','nolimit','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','exchangerate','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','remoteUri','tenantId','clientSecret','slice','substring','%s/api/data/v9.0/','POST','/oauth2/token','clientId','username','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','MetadataId','EntityDefinitions(','Bearer\x20','includes','LogicalName','@odata.type','PicklistAttributeMetadata','push','isNil','lastIndexOf','BooleanAttributeMetadata','forEach','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x270739,_0x165001){var _0x1258c4=function(_0x24ff07){while(--_0x24ff07){_0x270739['push'](_0x270739['shift']());}};_0x1258c4(++_0x165001);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x7df3a9,_0x403bfb){_0x403bfb=_0x403bfb||0xcc;return function(_0x5f2fd9){if(_0x5f2fd9){return _0x7df3a9[_0x49c4('0x16')](_0x403bfb);}return _0x7df3a9[_0x49c4('0x17')](_0x403bfb)[_0x49c4('0x18')]();};}function respondWithResult(_0x2decee,_0x12777c){_0x12777c=_0x12777c||0xc8;return function(_0x18211c){if(_0x18211c){return _0x2decee[_0x49c4('0x17')](_0x12777c)[_0x49c4('0x19')](_0x18211c);}};}function respondWithFilteredResult(_0x58d177,_0x3acd06){return function(_0x141003){if(_0x141003){var _0x13a2db=typeof _0x3acd06[_0x49c4('0x1a')]===_0x49c4('0x1b')&&typeof _0x3acd06['limit']===_0x49c4('0x1b');var _0x2891f4=_0x141003['count'];var _0x512650=_0x13a2db?0x0:_0x3acd06[_0x49c4('0x1a')];var _0x2f82d5=_0x13a2db?_0x141003[_0x49c4('0x1c')]:_0x3acd06['offset']+_0x3acd06[_0x49c4('0x1d')];var _0x50b151;if(_0x2f82d5>=_0x2891f4){_0x2f82d5=_0x2891f4;_0x50b151=0xc8;}else{_0x50b151=0xce;}_0x58d177[_0x49c4('0x17')](_0x50b151);return _0x58d177[_0x49c4('0x1e')](_0x49c4('0x1f'),_0x512650+'-'+_0x2f82d5+'/'+_0x2891f4)[_0x49c4('0x19')](_0x141003);}return null;};}function patchUpdates(_0x382040){return function(_0x41078c){try{jsonpatch[_0x49c4('0x20')](_0x41078c,_0x382040,!![]);}catch(_0x46e475){return BPromise[_0x49c4('0x21')](_0x46e475);}return _0x41078c['save']();};}function saveUpdates(_0x527126,_0x57f502){return function(_0x1c99b1){if(_0x1c99b1){return _0x1c99b1['update'](_0x527126)['then'](function(_0x2263ae){return _0x2263ae;});}return null;};}function removeEntity(_0x15581b,_0x26c640){return function(_0xd335e4){if(_0xd335e4){return _0xd335e4['destroy']()['then'](function(){_0x15581b[_0x49c4('0x17')](0xcc)[_0x49c4('0x18')]();});}};}function handleEntityNotFound(_0x565423,_0x207358){return function(_0x43e014){if(!_0x43e014){_0x565423[_0x49c4('0x16')](0x194);}return _0x43e014;};}function handleError(_0xa7a826,_0x531d92){_0x531d92=_0x531d92||0x1f4;return function(_0x543ea2){logger[_0x49c4('0x22')](_0x543ea2['stack']);if(_0x543ea2[_0x49c4('0x23')]){delete _0x543ea2[_0x49c4('0x23')];}_0xa7a826[_0x49c4('0x17')](_0x531d92)[_0x49c4('0x24')](_0x543ea2);};}exports['index']=function(_0x889909,_0x2b2793){var _0x46e04d={},_0x4f28a2={},_0x6329b3={'count':0x0,'rows':[]};var _0x29f835=_[_0x49c4('0x25')](db[_0x49c4('0x26')][_0x49c4('0x27')],function(_0x2cbd88){return{'name':_0x2cbd88[_0x49c4('0x28')],'type':_0x2cbd88['type']['key']};});_0x4f28a2['model']=_[_0x49c4('0x25')](_0x29f835,_0x49c4('0x23'));_0x4f28a2[_0x49c4('0x29')]=_[_0x49c4('0x2a')](_0x889909[_0x49c4('0x29')]);_0x4f28a2['filters']=_[_0x49c4('0x2b')](_0x4f28a2[_0x49c4('0x2c')],_0x4f28a2[_0x49c4('0x29')]);_0x46e04d[_0x49c4('0x2d')]=_['intersection'](_0x4f28a2['model'],qs[_0x49c4('0x2e')](_0x889909[_0x49c4('0x29')][_0x49c4('0x2e')]));_0x46e04d[_0x49c4('0x2d')]=_0x46e04d[_0x49c4('0x2d')]['length']?_0x46e04d[_0x49c4('0x2d')]:_0x4f28a2[_0x49c4('0x2c')];if(!_0x889909[_0x49c4('0x29')]['hasOwnProperty']('nolimit')){_0x46e04d[_0x49c4('0x1d')]=qs[_0x49c4('0x1d')](_0x889909[_0x49c4('0x29')][_0x49c4('0x1d')]);_0x46e04d[_0x49c4('0x1a')]=qs[_0x49c4('0x1a')](_0x889909[_0x49c4('0x29')][_0x49c4('0x1a')]);}_0x46e04d[_0x49c4('0x2f')]=qs['sort'](_0x889909[_0x49c4('0x29')]['sort']);_0x46e04d[_0x49c4('0x30')]=qs[_0x49c4('0x31')](_[_0x49c4('0x32')](_0x889909[_0x49c4('0x29')],_0x4f28a2['filters']),_0x29f835);if(_0x889909[_0x49c4('0x29')][_0x49c4('0x33')]){_0x46e04d[_0x49c4('0x30')]=_['merge'](_0x46e04d[_0x49c4('0x30')],{'$or':_[_0x49c4('0x25')](_0x29f835,function(_0x178987){if(_0x178987[_0x49c4('0x34')]!==_0x49c4('0x35')){var _0x24c177={};_0x24c177[_0x178987[_0x49c4('0x23')]]={'$like':'%'+_0x889909[_0x49c4('0x29')][_0x49c4('0x33')]+'%'};return _0x24c177;}})});}_0x46e04d=_[_0x49c4('0x36')]({},_0x46e04d,_0x889909[_0x49c4('0x37')]);var _0x4e0663={'where':_0x46e04d[_0x49c4('0x30')]};return db[_0x49c4('0x26')][_0x49c4('0x1c')](_0x4e0663)[_0x49c4('0x38')](function(_0x41ad28){_0x6329b3[_0x49c4('0x1c')]=_0x41ad28;if(_0x889909[_0x49c4('0x29')][_0x49c4('0x39')]){_0x46e04d[_0x49c4('0x3a')]=[{'all':!![]}];}return db[_0x49c4('0x26')][_0x49c4('0x3b')](_0x46e04d);})[_0x49c4('0x38')](function(_0x326142){_0x6329b3['rows']=_0x326142;return _0x6329b3;})[_0x49c4('0x38')](respondWithFilteredResult(_0x2b2793,_0x46e04d))['catch'](handleError(_0x2b2793,null));};exports[_0x49c4('0x3c')]=function(_0x4915bc,_0x28d4fb){var _0x1480da={'raw':![],'where':{'id':_0x4915bc[_0x49c4('0x3d')]['id']}},_0x239327={};_0x239327['model']=_['keys'](db[_0x49c4('0x26')][_0x49c4('0x27')]);_0x239327[_0x49c4('0x29')]=_[_0x49c4('0x2a')](_0x4915bc['query']);_0x239327[_0x49c4('0x31')]=_[_0x49c4('0x2b')](_0x239327[_0x49c4('0x2c')],_0x239327[_0x49c4('0x29')]);_0x1480da[_0x49c4('0x2d')]=_[_0x49c4('0x2b')](_0x239327[_0x49c4('0x2c')],qs[_0x49c4('0x2e')](_0x4915bc[_0x49c4('0x29')]['fields']));_0x1480da[_0x49c4('0x2d')]=_0x1480da['attributes'][_0x49c4('0x3e')]?_0x1480da[_0x49c4('0x2d')]:_0x239327[_0x49c4('0x2c')];if(_0x4915bc[_0x49c4('0x29')][_0x49c4('0x39')]){_0x1480da['include']=[{'all':!![]}];}_0x1480da=_[_0x49c4('0x36')]({},_0x1480da,_0x4915bc[_0x49c4('0x37')]);return db[_0x49c4('0x26')][_0x49c4('0x3f')](_0x1480da)[_0x49c4('0x38')](handleEntityNotFound(_0x28d4fb,null))[_0x49c4('0x38')](respondWithResult(_0x28d4fb,null))[_0x49c4('0x40')](handleError(_0x28d4fb,null));};exports['create']=function(_0x3bac1b,_0x5cfff9){return db[_0x49c4('0x26')][_0x49c4('0x41')](_0x3bac1b[_0x49c4('0x42')],{})[_0x49c4('0x38')](respondWithResult(_0x5cfff9,0xc9))[_0x49c4('0x40')](handleError(_0x5cfff9,null));};exports[_0x49c4('0x43')]=function(_0x2c6be1,_0x506c71){if(_0x2c6be1[_0x49c4('0x42')]['id']){delete _0x2c6be1[_0x49c4('0x42')]['id'];}return db['Dynamics365Account'][_0x49c4('0x3f')]({'where':{'id':_0x2c6be1[_0x49c4('0x3d')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x506c71,null))[_0x49c4('0x38')](saveUpdates(_0x2c6be1['body'],null))['then'](respondWithResult(_0x506c71,null))[_0x49c4('0x40')](handleError(_0x506c71,null));};exports['destroy']=function(_0x4597c3,_0x1f941f){return db[_0x49c4('0x26')][_0x49c4('0x3f')]({'where':{'id':_0x4597c3[_0x49c4('0x3d')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1f941f,null))[_0x49c4('0x38')](removeEntity(_0x1f941f,null))['catch'](handleError(_0x1f941f,null));};exports[_0x49c4('0x44')]=function(_0x1550ce,_0x3936d3,_0x3d944c){var _0x17ef75={};var _0x2644c0={};var _0x156748;var _0x25d174;return db[_0x49c4('0x26')][_0x49c4('0x45')]({'where':{'id':_0x1550ce['params']['id']}})['then'](handleEntityNotFound(_0x3936d3,null))[_0x49c4('0x38')](function(_0x3f9a9d){if(_0x3f9a9d){_0x156748=_0x3f9a9d;_0x2644c0['model']=_['keys'](db[_0x49c4('0x46')]['rawAttributes']);_0x2644c0['query']=_[_0x49c4('0x2a')](_0x1550ce[_0x49c4('0x29')]);_0x2644c0[_0x49c4('0x31')]=_[_0x49c4('0x2b')](_0x2644c0[_0x49c4('0x2c')],_0x2644c0[_0x49c4('0x29')]);_0x17ef75[_0x49c4('0x2d')]=_['intersection'](_0x2644c0[_0x49c4('0x2c')],qs[_0x49c4('0x2e')](_0x1550ce[_0x49c4('0x29')][_0x49c4('0x2e')]));_0x17ef75[_0x49c4('0x2d')]=_0x17ef75[_0x49c4('0x2d')]['length']?_0x17ef75['attributes']:_0x2644c0[_0x49c4('0x2c')];_0x17ef75[_0x49c4('0x2f')]=qs[_0x49c4('0x47')](_0x1550ce[_0x49c4('0x29')][_0x49c4('0x47')]);_0x17ef75[_0x49c4('0x30')]=qs[_0x49c4('0x31')](_['pick'](_0x1550ce[_0x49c4('0x29')],_0x2644c0[_0x49c4('0x31')]));if(_0x1550ce['query'][_0x49c4('0x33')]){_0x17ef75['where']=_[_0x49c4('0x36')](_0x17ef75[_0x49c4('0x30')],{'$or':_[_0x49c4('0x25')](_0x17ef75[_0x49c4('0x2d')],function(_0x845f7e){var _0x3e44d7={};_0x3e44d7[_0x845f7e]={'$like':'%'+_0x1550ce[_0x49c4('0x29')][_0x49c4('0x33')]+'%'};return _0x3e44d7;})});}_0x17ef75=_['merge']({},_0x17ef75,_0x1550ce[_0x49c4('0x37')]);return _0x156748[_0x49c4('0x44')](_0x17ef75);}})['then'](function(_0x10dec7){if(_0x10dec7){_0x25d174=_0x10dec7[_0x49c4('0x3e')];if(!_0x1550ce['query'][_0x49c4('0x48')](_0x49c4('0x49'))){_0x17ef75['limit']=qs['limit'](_0x1550ce['query']['limit']);_0x17ef75[_0x49c4('0x1a')]=qs['offset'](_0x1550ce[_0x49c4('0x29')][_0x49c4('0x1a')]);}return _0x156748['getConfigurations'](_0x17ef75);}})[_0x49c4('0x38')](function(_0xdb2b33){if(_0xdb2b33){return _0xdb2b33?{'count':_0x25d174,'rows':_0xdb2b33}:null;}})['then'](respondWithResult(_0x3936d3,null))[_0x49c4('0x40')](handleError(_0x3936d3,null));};exports[_0x49c4('0x4a')]=function(_0x167e84,_0x35f46f,_0x4fd9a1){if(_0x167e84[_0x49c4('0x42')]['id']){delete _0x167e84[_0x49c4('0x42')]['id'];}return db[_0x49c4('0x26')][_0x49c4('0x45')]({'where':{'id':_0x167e84['params']['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x35f46f,null))['then'](function(_0x568457){if(_0x568457){_0x167e84['body']['AccountId']=_0x568457['id'];_0x167e84[_0x49c4('0x42')][_0x49c4('0x4b')]=integrations[_0x49c4('0x4c')](_0x167e84[_0x49c4('0x42')]['channel'],_0x167e84['body'][_0x49c4('0x34')]);_0x167e84[_0x49c4('0x42')][_0x49c4('0x4d')]=integrations[_0x49c4('0x4e')](_0x167e84[_0x49c4('0x42')][_0x49c4('0x4f')],_0x167e84[_0x49c4('0x42')][_0x49c4('0x34')]);return db['Dynamics365Configuration'][_0x49c4('0x41')](_0x167e84['body'],{'include':[{'model':db[_0x49c4('0x50')],'as':_0x49c4('0x4b')},{'model':db[_0x49c4('0x50')],'as':_0x49c4('0x4d')}]});}return null;})[_0x49c4('0x38')](respondWithResult(_0x35f46f,null))[_0x49c4('0x40')](handleError(_0x35f46f,null));};exports[_0x49c4('0x51')]=function(_0x3feb0b,_0x13d951,_0x1743d0){var _0x1e3911=_0x3feb0b[_0x49c4('0x29')][_0x49c4('0x52')];var _0x14bd09=_0x1e3911===_0x49c4('0x53')?_0x49c4('0x54'):_0x49c4('0x55');var _0x3485c0='';var _0x4e1544='';var _0x5ec201='';var _0x10f2ec='';var _0x16b3e8='';var _0x4af680='';var _0x1a15f3='';var _0x38ad50='';var _0x2939fd=[_0x49c4('0x56'),'description','customerid','ownerid',_0x49c4('0x57'),_0x49c4('0x58'),_0x49c4('0x59'),_0x49c4('0x5a'),_0x49c4('0x5b'),_0x49c4('0x5c')];var _0x191afb=[_0x49c4('0x5d'),_0x49c4('0x5e'),'actualserviceunits',_0x49c4('0x5f'),_0x49c4('0x60'),_0x49c4('0x61'),'contractdetailidname',_0x49c4('0x62'),_0x49c4('0x63'),_0x49c4('0x64'),_0x49c4('0x65'),_0x49c4('0x66'),_0x49c4('0x67'),_0x49c4('0x68'),_0x49c4('0x69'),'customeridname',_0x49c4('0x6a'),_0x49c4('0x6b'),_0x49c4('0x6c'),_0x49c4('0x6d'),_0x49c4('0x6e'),'entityimage_url','escalatedon',_0x49c4('0x6f'),'firstresponsebykpiidname',_0x49c4('0x70'),'importsequencenumber',_0x49c4('0x71'),_0x49c4('0x72'),_0x49c4('0x73'),_0x49c4('0x74'),'modifiedbyexternalpartyname',_0x49c4('0x75'),_0x49c4('0x76'),_0x49c4('0x77'),_0x49c4('0x78'),_0x49c4('0x79'),_0x49c4('0x7a'),_0x49c4('0x7b'),_0x49c4('0x7c'),_0x49c4('0x7d'),_0x49c4('0x7e'),'overriddencreatedon',_0x49c4('0x7f'),_0x49c4('0x80'),'owneridyominame',_0x49c4('0x81'),'primarycontactidname',_0x49c4('0x82'),_0x49c4('0x83'),_0x49c4('0x84'),_0x49c4('0x85'),_0x49c4('0x86'),'resolvebykpiidname',_0x49c4('0x87'),_0x49c4('0x88'),'responsiblecontactidyominame',_0x49c4('0x89'),_0x49c4('0x8a'),'slaname',_0x49c4('0x8b'),_0x49c4('0x8c'),'statuscode',_0x49c4('0x8d'),_0x49c4('0x8e'),_0x49c4('0x8f'),_0x49c4('0x90'),'traversedpath',_0x49c4('0x91'),_0x49c4('0x92')];var _0x4c2fed=_0x2939fd[_0x49c4('0x93')](_0x191afb);return db['Dynamics365Account']['findOne']({'where':{'id':_0x3feb0b[_0x49c4('0x3d')]['id']},'attributes':['id','username','password',_0x49c4('0x94'),_0x49c4('0x95'),'clientId',_0x49c4('0x96')]})['then'](handleEntityNotFound(_0x13d951,null))['then'](function(_0x4c4bed){if(_0x4c4bed){_0x38ad50=_0x4c4bed[_0x49c4('0x94')];var _0x280685=_0x38ad50[_0x49c4('0x97')](-0x1);if(_0x280685==='/'){_0x38ad50=_0x38ad50[_0x49c4('0x98')](0x0,_0x38ad50['lastIndexOf'](_0x280685));}_0x1a15f3=util['format'](_0x49c4('0x99'),_0x38ad50);var _0x48705c={'method':_0x49c4('0x9a'),'uri':'https://login.microsoftonline.com/'+_0x4c4bed[_0x49c4('0x95')]+_0x49c4('0x9b'),'form':{'client_id':_0x4c4bed[_0x49c4('0x9c')],'resource':_0x38ad50,'username':_0x4c4bed[_0x49c4('0x9d')],'password':_0x4c4bed[_0x49c4('0x9e')],'grant_type':_0x49c4('0x9e'),'client_secret':_0x4c4bed[_0x49c4('0x96')]},'json':!![]};return rp(_0x48705c);}})['then'](function(_0xbde4b2){_0x4af680=_0xbde4b2[_0x49c4('0x9f')];var _0x44a188={'method':_0x49c4('0xa0'),'uri':encodeURI(_0x1a15f3+_0x49c4('0xa1')+_0x14bd09+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x4af680,'If-None-Match':null,'OData-Version':_0x49c4('0xa2')},'json':!![]};return rp(_0x44a188);})[_0x49c4('0x38')](function(_0x3f5a6e){var _0x59a6a5=_0x3f5a6e['value'][0x0];var _0xbfff7=_0x59a6a5[_0x49c4('0xa3')];var _0xd30fb9={'method':_0x49c4('0xa0'),'uri':_0x1a15f3+_0x49c4('0xa4')+_0xbfff7+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x49c4('0xa5')+_0x4af680,'If-None-Match':null,'OData-Version':_0x49c4('0xa2')},'json':!![]};return rp(_0xd30fb9);})[_0x49c4('0x38')](function(_0x2aae0f){_0x3485c0=_0x2aae0f;_0x4e1544=_0x3485c0['Attributes'];_0x4e1544=_['remove'](_0x4e1544,function(_0x2ca918){return!_0x4c2fed[_0x49c4('0xa6')](_0x2ca918[_0x49c4('0xa7')]);});var _0x294ba0=[];var _0x3dac77=[];_0x4e1544['forEach'](function(_0x389edb){if(_0x389edb[_0x49c4('0xa8')]){var _0x44f20d=_0x389edb[_0x49c4('0xa8')][_0x49c4('0x98')](_0x389edb[_0x49c4('0xa8')]['lastIndexOf']('.')+0x1);if(_0x44f20d===_0x49c4('0xa9')){_0x294ba0[_0x49c4('0xaa')](getSelectList(_0x1a15f3,_0x1e3911,_0x3dac77,_0x3485c0[_0x49c4('0xa3')],_0x389edb[_0x49c4('0xa3')],_0x4af680));}}});return Promise['all'](_0x294ba0);})['then'](function(_0xa96f53){_0x5ec201=_0xa96f53[0x0];var _0x4933a7=[];var _0x202b8a=[];_0x4e1544['forEach'](function(_0x303d49){if(!_[_0x49c4('0xab')](_0x303d49[_0x49c4('0xa8')])){var _0x20bec7=_0x303d49['@odata.type']['substring'](_0x303d49[_0x49c4('0xa8')][_0x49c4('0xac')]('.')+0x1);if(_0x20bec7===_0x49c4('0xad')){_0x4933a7['push'](getBooleanList(_0x1a15f3,_0x1e3911,_0x202b8a,_0x3485c0['MetadataId'],_0x303d49[_0x49c4('0xa3')],_0x4af680));}}});return Promise['all'](_0x4933a7);})['then'](function(_0x1b9473){_0x10f2ec=_0x1b9473[0x0];var _0x5a2858=[];var _0x22668b=[];_0x4e1544[_0x49c4('0xae')](function(_0x4fc419){if(_0x4fc419[_0x49c4('0xa8')]){var _0x45474e=_0x4fc419['@odata.type']['substring'](_0x4fc419[_0x49c4('0xa8')]['lastIndexOf']('.')+0x1);if(_0x45474e===_0x49c4('0xaf')||_0x45474e===_0x49c4('0xb0')||_0x45474e===_0x49c4('0xb1')||_0x45474e===_0x49c4('0xb2')||_0x45474e===_0x49c4('0xb3')||_0x45474e===_0x49c4('0xb4')||_0x45474e===_0x49c4('0xb5')||_0x45474e==='EntityNameAttributeMetadata'||_0x45474e===_0x49c4('0xb6')||_0x45474e===_0x49c4('0xb7')){_0x5a2858[_0x49c4('0xaa')](getInputList(_0x1a15f3,_0x1e3911,_0x45474e,_0x22668b,_0x3485c0[_0x49c4('0xa3')],_0x4fc419[_0x49c4('0xa3')],_0x4af680));}}});return Promise['all'](_0x5a2858);})[_0x49c4('0x38')](function(_0x59ccfc){_0x16b3e8=_0x59ccfc[0x0];var _0xb66e67=_0x5ec201[_0x49c4('0x93')](_0x10f2ec)[_0x49c4('0x93')](_0x16b3e8);var _0x3d662c={'count':_0xb66e67['length'],'rows':_0xb66e67};return _0x3d662c;})[_0x49c4('0x38')](respondWithResult(_0x13d951,null))[_0x49c4('0x40')](function(_0x312b02){var _0x1f5067=_0x3feb0b[_0x49c4('0x29')][_0x49c4('0xb8')]?0x1f4:_0x312b02['statusCode']||0x1f4;logger[_0x49c4('0x22')](_0x312b02['stack']);delete _0x312b02[_0x49c4('0x23')];if(_0x1f5067===0x191){_0x1f5067=0x190;}_0x13d951[_0x49c4('0x17')](_0x1f5067)[_0x49c4('0x24')](_0x3feb0b[_0x49c4('0x29')]['test']?{'message':_0x49c4('0xb9'),'statusCode':_0x312b02[_0x49c4('0xba')]}:_0x312b02);});};function getSelectList(_0x5829bc,_0x1e0b7d,_0x3c321f,_0x4971b1,_0x562f47,_0x25f1c7){var _0x3e5915={'method':_0x49c4('0xa0'),'uri':_0x5829bc+_0x49c4('0xa4')+_0x4971b1+_0x49c4('0xbb')+_0x562f47+_0x49c4('0xbc')+_0x49c4('0xbd'),'headers':{'Authorization':_0x49c4('0xa5')+_0x25f1c7,'If-None-Match':null,'OData-Version':_0x49c4('0xa2')},'json':!![]};return rp(_0x3e5915)[_0x49c4('0x38')](function(_0x269613){var _0x540a2b=[];var _0x58692b=_0x269613[_0x49c4('0xbe')][_0x49c4('0xbf')];_0x58692b[_0x49c4('0xae')](function(_0x5be042){_0x540a2b[_0x49c4('0xaa')]({'name':_0x5be042[_0x49c4('0xc0')]['UserLocalizedLabel'][_0x49c4('0xc0')],'value':String(_0x5be042['Value'])});});var _0x3d5547={'id':_0x1e0b7d+'_'+_0x269613[_0x49c4('0xa7')],'name':_0x269613[_0x49c4('0xc1')][_0x49c4('0xc2')]['Label'],'custom':![],'options':_0x540a2b};_0x3c321f[_0x49c4('0xaa')](_0x3d5547);return _0x3c321f;});}function getBooleanList(_0x44a9e2,_0x3e3eb0,_0x431ff1,_0x44a7e3,_0x54de3e,_0x5a4e00){var _0x5f4d82={'method':_0x49c4('0xa0'),'uri':_0x44a9e2+_0x49c4('0xa4')+_0x44a7e3+_0x49c4('0xbb')+_0x54de3e+_0x49c4('0xc3'),'headers':{'Authorization':_0x49c4('0xa5')+_0x5a4e00,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5f4d82)[_0x49c4('0x38')](function(_0x41ef7c){var _0x265dc3=[];_0x265dc3[_0x49c4('0xaa')]({'name':_0x41ef7c['OptionSet'][_0x49c4('0xc4')][_0x49c4('0xc0')][_0x49c4('0xc2')][_0x49c4('0xc0')],'value':_0x49c4('0xc5')},{'name':_0x41ef7c['OptionSet'][_0x49c4('0xc6')][_0x49c4('0xc0')][_0x49c4('0xc2')]['Label'],'value':_0x49c4('0xc7')});var _0x11f47f={'id':_0x3e3eb0+'_'+_0x41ef7c[_0x49c4('0xa7')],'name':_0x41ef7c['DisplayName'][_0x49c4('0xc2')]['Label'],'custom':![],'options':_0x265dc3};_0x431ff1['push'](_0x11f47f);return _0x431ff1;});}function getInputList(_0x2c2c7c,_0x14d930,_0x4ef4aa,_0x815b34,_0x1d7428,_0xf0bb4f,_0x1ffc9a){var _0x10f5fc={'method':_0x49c4('0xa0'),'uri':_0x2c2c7c+_0x49c4('0xa4')+_0x1d7428+_0x49c4('0xbb')+_0xf0bb4f+')/Microsoft.Dynamics.CRM.'+_0x4ef4aa+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x49c4('0xa5')+_0x1ffc9a,'If-None-Match':null,'OData-Version':_0x49c4('0xa2')},'json':!![]};return rp(_0x10f5fc)[_0x49c4('0x38')](function(_0x5f04f2){var _0x5c809e={'id':_0x14d930+'_'+_0x5f04f2[_0x49c4('0xa7')],'name':_0x5f04f2[_0x49c4('0xc1')][_0x49c4('0xc2')]?_0x5f04f2[_0x49c4('0xc1')][_0x49c4('0xc2')][_0x49c4('0xc0')]:_0x5f04f2[_0x49c4('0xa7')],'custom':![],'options':[]};_0x815b34[_0x49c4('0xaa')](_0x5c809e);return _0x815b34;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 2be0060..2805c00 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x54a2ae,_0x4ef2a2){var _0x2d4f2d=function(_0x470897){while(--_0x470897){_0x54a2ae['push'](_0x54a2ae['shift']());}};_0x2d4f2d(++_0x4ef2a2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x294917,_0x431be2){var _0x32e3b0=function(_0x6876ff){while(--_0x6876ff){_0x294917['push'](_0x294917['shift']());}};_0x32e3b0(++_0x431be2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0xcb91[_0x100682];return _0xcb6e87;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 4586ec5..f7a3ad6 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 _0x8708=['../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetDynamics365Account','findAll','options','raw','where','attributes','map','include','model','stringify','ShowDynamics365Account','Dynamics365Account','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8708,0x111));var _0x8870=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x8708[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x8870('0x0'));var util=require(_0x8870('0x1'));var moment=require(_0x8870('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8870('0x3'));var db=require(_0x8870('0x4'))['db'];var utils=require(_0x8870('0x5'));var logger=require(_0x8870('0x6'))('rpc');var config=require(_0x8870('0x7'));var jayson=require(_0x8870('0x8'));var client=jayson[_0x8870('0x9')][_0x8870('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3746f4,_0x4a19b4,_0x2f136e){return new BPromise(function(_0x144d92,_0x177a57){return client[_0x8870('0xb')](_0x3746f4,_0x2f136e)[_0x8870('0xc')](function(_0x114b11){logger[_0x8870('0xd')](_0x8870('0xe'),_0x4a19b4,'request\x20sent');logger[_0x8870('0xf')](_0x8870('0x10'),_0x4a19b4,_0x8870('0x11'),JSON['stringify'](_0x114b11));if(_0x114b11[_0x8870('0x12')]){if(_0x114b11[_0x8870('0x12')][_0x8870('0x13')]===0x1f4){logger[_0x8870('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x4a19b4,_0x114b11[_0x8870('0x12')][_0x8870('0x14')]);return _0x177a57(_0x114b11[_0x8870('0x12')][_0x8870('0x14')]);}logger[_0x8870('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x4a19b4,_0x114b11[_0x8870('0x12')]['message']);return _0x144d92(_0x114b11[_0x8870('0x12')][_0x8870('0x14')]);}else{logger[_0x8870('0xd')](_0x8870('0xe'),_0x4a19b4,_0x8870('0x11'));_0x144d92(_0x114b11['result'][_0x8870('0x14')]);}})[_0x8870('0x15')](function(_0x346d52){logger[_0x8870('0x12')](_0x8870('0xe'),_0x4a19b4,_0x346d52);_0x177a57(_0x346d52);});});}exports[_0x8870('0x16')]=function(_0xeda8d0){var _0x3a604f=this;return new Promise(function(_0x4e1352,_0x6bd919){return db['Dynamics365Account'][_0x8870('0x17')]({'raw':_0xeda8d0[_0x8870('0x18')]?_0xeda8d0['options'][_0x8870('0x19')]===undefined?!![]:![]:!![],'where':_0xeda8d0[_0x8870('0x18')]?_0xeda8d0[_0x8870('0x18')][_0x8870('0x1a')]||null:null,'attributes':_0xeda8d0[_0x8870('0x18')]?_0xeda8d0['options'][_0x8870('0x1b')]||null:null,'limit':_0xeda8d0['options']?_0xeda8d0[_0x8870('0x18')]['limit']||null:null,'include':_0xeda8d0['options']?_0xeda8d0[_0x8870('0x18')]['include']?_[_0x8870('0x1c')](_0xeda8d0[_0x8870('0x18')][_0x8870('0x1d')],function(_0x38d913){return{'model':db[_0x38d913[_0x8870('0x1e')]],'as':_0x38d913['as'],'attributes':_0x38d913[_0x8870('0x1b')],'include':_0x38d913[_0x8870('0x1d')]?_[_0x8870('0x1c')](_0x38d913['include'],function(_0x26f61c){return{'model':db[_0x26f61c['model']],'as':_0x26f61c['as'],'attributes':_0x26f61c[_0x8870('0x1b')],'include':_0x26f61c[_0x8870('0x1d')]?_[_0x8870('0x1c')](_0x26f61c[_0x8870('0x1d')],function(_0x3128e9){return{'model':db[_0x3128e9[_0x8870('0x1e')]],'as':_0x3128e9['as'],'attributes':_0x3128e9[_0x8870('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8870('0xc')](function(_0x4eaf14){logger['info']('GetDynamics365Account',_0xeda8d0);logger[_0x8870('0xf')](_0x8870('0x16'),_0xeda8d0,JSON[_0x8870('0x1f')](_0x4eaf14));_0x4e1352(_0x4eaf14);})[_0x8870('0x15')](function(_0x49176e){logger[_0x8870('0x12')]('GetDynamics365Account',_0x49176e[_0x8870('0x14')],_0xeda8d0);_0x6bd919(_0x3a604f[_0x8870('0x12')](0x1f4,_0x49176e[_0x8870('0x14')]));});});};exports[_0x8870('0x20')]=function(_0x3d2803){var _0x1f3938=this;return new Promise(function(_0x2f3df3,_0x2a8528){return db[_0x8870('0x21')][_0x8870('0x22')]({'raw':_0x3d2803[_0x8870('0x18')]?_0x3d2803[_0x8870('0x18')][_0x8870('0x19')]===undefined?!![]:![]:!![],'where':_0x3d2803[_0x8870('0x18')]?_0x3d2803[_0x8870('0x18')][_0x8870('0x1a')]||null:null,'attributes':_0x3d2803[_0x8870('0x18')]?_0x3d2803[_0x8870('0x18')][_0x8870('0x1b')]||null:null,'include':_0x3d2803[_0x8870('0x18')]?_0x3d2803[_0x8870('0x18')][_0x8870('0x1d')]?_['map'](_0x3d2803[_0x8870('0x18')][_0x8870('0x1d')],function(_0x5a39ff){return{'model':db[_0x5a39ff[_0x8870('0x1e')]],'as':_0x5a39ff['as'],'attributes':_0x5a39ff[_0x8870('0x1b')],'include':_0x5a39ff[_0x8870('0x1d')]?_[_0x8870('0x1c')](_0x5a39ff['include'],function(_0x2e4000){return{'model':db[_0x2e4000[_0x8870('0x1e')]],'as':_0x2e4000['as'],'attributes':_0x2e4000[_0x8870('0x1b')],'include':_0x2e4000['include']?_['map'](_0x2e4000['include'],function(_0x5ca69f){return{'model':db[_0x5ca69f[_0x8870('0x1e')]],'as':_0x5ca69f['as'],'attributes':_0x5ca69f[_0x8870('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8870('0xc')](function(_0x6c71cf){logger[_0x8870('0xd')](_0x8870('0x20'),_0x3d2803);logger[_0x8870('0xf')](_0x8870('0x20'),_0x3d2803,JSON['stringify'](_0x6c71cf));_0x2f3df3(_0x6c71cf);})['catch'](function(_0x145a08){logger[_0x8870('0x12')](_0x8870('0x20'),_0x145a08[_0x8870('0x14')],_0x3d2803);_0x2a8528(_0x1f3938[_0x8870('0x12')](0x1f4,_0x145a08[_0x8870('0x14')]));});});}; \ No newline at end of file +var _0x9351=['attributes','limit','include','model','map','find','where','ShowDynamics365Account','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Account,\x20%s,\x20%s','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw'];(function(_0x5b7963,_0x10bff5){var _0x57f611=function(_0x28d52e){while(--_0x28d52e){_0x5b7963['push'](_0x5b7963['shift']());}};_0x57f611(++_0x10bff5);}(_0x9351,0x104));var _0x1935=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9351[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x1935('0x0'));var util=require(_0x1935('0x1'));var moment=require('moment');var BPromise=require(_0x1935('0x2'));var rs=require(_0x1935('0x3'));var fs=require('fs');var Redis=require(_0x1935('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1935('0x5'));var logger=require(_0x1935('0x6'))(_0x1935('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1935('0x8')][_0x1935('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26ce5,_0x32fa13,_0x1d9eab){return new BPromise(function(_0x49193c,_0x2ad729){return client[_0x1935('0xa')](_0x26ce5,_0x1d9eab)[_0x1935('0xb')](function(_0x597353){logger[_0x1935('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x32fa13,_0x1935('0xd'));logger[_0x1935('0xe')](_0x1935('0xf'),_0x32fa13,'request\x20sent',JSON[_0x1935('0x10')](_0x597353));if(_0x597353[_0x1935('0x11')]){if(_0x597353['error'][_0x1935('0x12')]===0x1f4){logger[_0x1935('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x32fa13,_0x597353[_0x1935('0x11')][_0x1935('0x13')]);return _0x2ad729(_0x597353[_0x1935('0x11')]['message']);}logger['error'](_0x1935('0x14'),_0x32fa13,_0x597353[_0x1935('0x11')]['message']);return _0x49193c(_0x597353[_0x1935('0x11')][_0x1935('0x13')]);}else{logger[_0x1935('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x32fa13,_0x1935('0xd'));_0x49193c(_0x597353[_0x1935('0x15')][_0x1935('0x13')]);}})[_0x1935('0x16')](function(_0x1a923d){logger['error'](_0x1935('0x14'),_0x32fa13,_0x1a923d);_0x2ad729(_0x1a923d);});});}exports[_0x1935('0x17')]=function(_0x3ebead){var _0xb601=this;return new Promise(function(_0x43b31c,_0x528925){return db[_0x1935('0x18')][_0x1935('0x19')]({'raw':_0x3ebead[_0x1935('0x1a')]?_0x3ebead['options'][_0x1935('0x1b')]===undefined?!![]:![]:!![],'where':_0x3ebead[_0x1935('0x1a')]?_0x3ebead[_0x1935('0x1a')]['where']||null:null,'attributes':_0x3ebead[_0x1935('0x1a')]?_0x3ebead[_0x1935('0x1a')][_0x1935('0x1c')]||null:null,'limit':_0x3ebead[_0x1935('0x1a')]?_0x3ebead['options'][_0x1935('0x1d')]||null:null,'include':_0x3ebead['options']?_0x3ebead[_0x1935('0x1a')][_0x1935('0x1e')]?_['map'](_0x3ebead[_0x1935('0x1a')][_0x1935('0x1e')],function(_0xdd633d){return{'model':db[_0xdd633d[_0x1935('0x1f')]],'as':_0xdd633d['as'],'attributes':_0xdd633d[_0x1935('0x1c')],'include':_0xdd633d[_0x1935('0x1e')]?_[_0x1935('0x20')](_0xdd633d[_0x1935('0x1e')],function(_0x32db82){return{'model':db[_0x32db82['model']],'as':_0x32db82['as'],'attributes':_0x32db82['attributes'],'include':_0x32db82['include']?_[_0x1935('0x20')](_0x32db82[_0x1935('0x1e')],function(_0xa70ee2){return{'model':db[_0xa70ee2[_0x1935('0x1f')]],'as':_0xa70ee2['as'],'attributes':_0xa70ee2[_0x1935('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1935('0xb')](function(_0x1bca73){logger[_0x1935('0xc')]('GetDynamics365Account',_0x3ebead);logger[_0x1935('0xe')](_0x1935('0x17'),_0x3ebead,JSON[_0x1935('0x10')](_0x1bca73));_0x43b31c(_0x1bca73);})[_0x1935('0x16')](function(_0x392b3b){logger[_0x1935('0x11')]('GetDynamics365Account',_0x392b3b[_0x1935('0x13')],_0x3ebead);_0x528925(_0xb601[_0x1935('0x11')](0x1f4,_0x392b3b[_0x1935('0x13')]));});});};exports['ShowDynamics365Account']=function(_0x3793b4){var _0x262b13=this;return new Promise(function(_0x595019,_0xf322fb){return db[_0x1935('0x18')][_0x1935('0x21')]({'raw':_0x3793b4[_0x1935('0x1a')]?_0x3793b4[_0x1935('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3793b4['options']?_0x3793b4[_0x1935('0x1a')][_0x1935('0x22')]||null:null,'attributes':_0x3793b4['options']?_0x3793b4[_0x1935('0x1a')][_0x1935('0x1c')]||null:null,'include':_0x3793b4[_0x1935('0x1a')]?_0x3793b4['options']['include']?_['map'](_0x3793b4[_0x1935('0x1a')]['include'],function(_0x5b5066){return{'model':db[_0x5b5066['model']],'as':_0x5b5066['as'],'attributes':_0x5b5066[_0x1935('0x1c')],'include':_0x5b5066[_0x1935('0x1e')]?_['map'](_0x5b5066['include'],function(_0x473877){return{'model':db[_0x473877[_0x1935('0x1f')]],'as':_0x473877['as'],'attributes':_0x473877[_0x1935('0x1c')],'include':_0x473877[_0x1935('0x1e')]?_[_0x1935('0x20')](_0x473877[_0x1935('0x1e')],function(_0x662c69){return{'model':db[_0x662c69[_0x1935('0x1f')]],'as':_0x662c69['as'],'attributes':_0x662c69['attributes']};}):[]};}):[]};}):[]:[]})[_0x1935('0xb')](function(_0x5a24ce){logger['info'](_0x1935('0x23'),_0x3793b4);logger[_0x1935('0xe')](_0x1935('0x23'),_0x3793b4,JSON[_0x1935('0x10')](_0x5a24ce));_0x595019(_0x5a24ce);})[_0x1935('0x16')](function(_0x6a0277){logger[_0x1935('0x11')](_0x1935('0x23'),_0x6a0277[_0x1935('0x13')],_0x3793b4);_0xf322fb(_0x262b13[_0x1935('0x11')](0x1f4,_0x6a0277[_0x1935('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 3b6ea2a..76aca7e 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 _0x1219=['create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x4e518d,_0x32a45d){var _0x458ff2=function(_0xc96c49){while(--_0xc96c49){_0x4e518d['push'](_0x4e518d['shift']());}};_0x458ff2(++_0x32a45d);}(_0x1219,0x17c));var _0x9121=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1219[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9121('0x0'));var util=require(_0x9121('0x1'));var path=require(_0x9121('0x2'));var timeout=require(_0x9121('0x3'));var express=require(_0x9121('0x4'));var router=express['Router']();var fs_extra=require(_0x9121('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9121('0x6'));var config=require(_0x9121('0x7'));var controller=require(_0x9121('0x8'));router[_0x9121('0x9')]('/',auth[_0x9121('0xa')](),controller[_0x9121('0xb')]);router[_0x9121('0x9')](_0x9121('0xc'),auth[_0x9121('0xa')](),controller[_0x9121('0xd')]);router[_0x9121('0x9')]('/:id/fields',auth[_0x9121('0xa')](),controller[_0x9121('0xe')]);router[_0x9121('0x9')](_0x9121('0xf'),auth['isAuthenticated'](),controller[_0x9121('0x10')]);router[_0x9121('0x9')](_0x9121('0x11'),auth[_0x9121('0xa')](),controller[_0x9121('0x12')]);router[_0x9121('0x13')]('/',auth[_0x9121('0xa')](),controller[_0x9121('0x14')]);router[_0x9121('0x15')](_0x9121('0xc'),auth[_0x9121('0xa')](),controller[_0x9121('0x16')]);router[_0x9121('0x17')](_0x9121('0xc'),auth[_0x9121('0xa')](),controller['destroy']);module[_0x9121('0x18')]=router; \ No newline at end of file +var _0xdec1=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intDynamics365Configuration.controller','get','index','show','isAuthenticated','getFields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdec1,0x11f));var _0x1dec=function(_0x2a1852,_0x1cbce3){_0x2a1852=_0x2a1852-0x0;var _0x509c95=_0xdec1[_0x2a1852];return _0x509c95;};'use strict';var multer=require(_0x1dec('0x0'));var util=require('util');var path=require(_0x1dec('0x1'));var timeout=require(_0x1dec('0x2'));var express=require(_0x1dec('0x3'));var router=express[_0x1dec('0x4')]();var fs_extra=require(_0x1dec('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1dec('0x6'));var config=require('../../config/environment');var controller=require(_0x1dec('0x7'));router[_0x1dec('0x8')]('/',auth['isAuthenticated'](),controller[_0x1dec('0x9')]);router[_0x1dec('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1dec('0xa')]);router[_0x1dec('0x8')]('/:id/fields',auth[_0x1dec('0xb')](),controller[_0x1dec('0xc')]);router['get'](_0x1dec('0xd'),auth['isAuthenticated'](),controller[_0x1dec('0xe')]);router[_0x1dec('0x8')](_0x1dec('0xf'),auth[_0x1dec('0xb')](),controller[_0x1dec('0x10')]);router[_0x1dec('0x11')]('/',auth[_0x1dec('0xb')](),controller[_0x1dec('0x12')]);router[_0x1dec('0x13')](_0x1dec('0x14'),auth[_0x1dec('0xb')](),controller[_0x1dec('0x15')]);router[_0x1dec('0x16')]('/:id',auth[_0x1dec('0xb')](),controller[_0x1dec('0x17')]);module[_0x1dec('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index adb37bb..75ad7b1 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 _0xc339=['sequelize','STRING','incident','phonecall','nothing','contact'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xc339,0x10e));var _0x9c33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc339[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9c33('0x0'));module['exports']={'name':{'type':Sequelize[_0x9c33('0x1')]},'description':{'type':Sequelize[_0x9c33('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x9c33('0x2'),_0x9c33('0x3')),'defaultValue':_0x9c33('0x2')},'moduleCreate':{'type':Sequelize['ENUM']('contact',_0x9c33('0x4')),'defaultValue':_0x9c33('0x5'),'allowNull':![]}}; \ No newline at end of file +var _0x974c=['incident','contact','exports','STRING'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x974c,0x18e));var _0xc974=function(_0x16fc7a,_0x3ee6d2){_0x16fc7a=_0x16fc7a-0x0;var _0x5b5f74=_0x974c[_0x16fc7a];return _0x5b5f74;};'use strict';var Sequelize=require('sequelize');module[_0xc974('0x0')]={'name':{'type':Sequelize[_0xc974('0x1')]},'description':{'type':Sequelize[_0xc974('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0xc974('0x2'),'phonecall'),'defaultValue':_0xc974('0x2')},'moduleCreate':{'type':Sequelize['ENUM'](_0xc974('0x3'),'nothing'),'defaultValue':_0xc974('0x3'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 11ac165..c6cb4aa 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 _0x9289=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','count','apply','reject','save','update','then','sendStatus','stack','send','index','map','rawAttributes','fieldName','key','name','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','options','includeAll','include','Dynamics365Configuration','findAll','show','params','find','catch','body','destroy','getFields','findOne','Dynamics365Field','order','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9289,0xdb));var _0x9928=function(_0xd62ee0,_0x2da8a4){_0xd62ee0=_0xd62ee0-0x0;var _0x51fd35=_0x9289[_0xd62ee0];return _0x51fd35;};'use strict';var emlformat=require(_0x9928('0x0'));var rimraf=require(_0x9928('0x1'));var zipdir=require(_0x9928('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9928('0x3'));var moment=require(_0x9928('0x4'));var BPromise=require(_0x9928('0x5'));var Mustache=require(_0x9928('0x6'));var util=require('util');var path=require(_0x9928('0x7'));var sox=require(_0x9928('0x8'));var csv=require('to-csv');var ejs=require(_0x9928('0x9'));var fs=require('fs');var fs_extra=require(_0x9928('0xa'));var _=require(_0x9928('0xb'));var squel=require(_0x9928('0xc'));var crypto=require(_0x9928('0xd'));var jsforce=require(_0x9928('0xe'));var deskjs=require(_0x9928('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9928('0x10'));var Redis=require(_0x9928('0x11'));var authService=require(_0x9928('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9928('0x13'));var hardwareService=require(_0x9928('0x14'));var logger=require(_0x9928('0x15'))(_0x9928('0x16'));var utils=require(_0x9928('0x17'));var config=require(_0x9928('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9928('0x19'))['db'];function respondWithStatusCode(_0x1976d0,_0x4aa8f6){_0x4aa8f6=_0x4aa8f6||0xcc;return function(_0x19488e){if(_0x19488e){return _0x1976d0['sendStatus'](_0x4aa8f6);}return _0x1976d0[_0x9928('0x1a')](_0x4aa8f6)[_0x9928('0x1b')]();};}function respondWithResult(_0xe9f0b6,_0x5ef21a){_0x5ef21a=_0x5ef21a||0xc8;return function(_0x2a2bf2){if(_0x2a2bf2){return _0xe9f0b6[_0x9928('0x1a')](_0x5ef21a)[_0x9928('0x1c')](_0x2a2bf2);}};}function respondWithFilteredResult(_0x167a02,_0x4ca03c){return function(_0x53fa55){if(_0x53fa55){var _0x9e2845=typeof _0x4ca03c[_0x9928('0x1d')]==='undefined'&&typeof _0x4ca03c[_0x9928('0x1e')]==='undefined';var _0x2acfb5=_0x53fa55[_0x9928('0x1f')];var _0x48fc8c=_0x9e2845?0x0:_0x4ca03c[_0x9928('0x1d')];var _0x35aa81=_0x9e2845?_0x53fa55[_0x9928('0x1f')]:_0x4ca03c['offset']+_0x4ca03c[_0x9928('0x1e')];var _0x36b194;if(_0x35aa81>=_0x2acfb5){_0x35aa81=_0x2acfb5;_0x36b194=0xc8;}else{_0x36b194=0xce;}_0x167a02[_0x9928('0x1a')](_0x36b194);return _0x167a02['set']('Content-Range',_0x48fc8c+'-'+_0x35aa81+'/'+_0x2acfb5)[_0x9928('0x1c')](_0x53fa55);}return null;};}function patchUpdates(_0x79df75){return function(_0x36eb2a){try{jsonpatch[_0x9928('0x20')](_0x36eb2a,_0x79df75,!![]);}catch(_0x220ced){return BPromise[_0x9928('0x21')](_0x220ced);}return _0x36eb2a[_0x9928('0x22')]();};}function saveUpdates(_0x41720b,_0x1a08c3){return function(_0x214117){if(_0x214117){return _0x214117[_0x9928('0x23')](_0x41720b)[_0x9928('0x24')](function(_0x27e1e3){return _0x27e1e3;});}return null;};}function removeEntity(_0x31c0fc,_0x267878){return function(_0x36791a){if(_0x36791a){return _0x36791a['destroy']()[_0x9928('0x24')](function(){_0x31c0fc['status'](0xcc)[_0x9928('0x1b')]();});}};}function handleEntityNotFound(_0x2a5a83,_0xec8685){return function(_0x51d2c8){if(!_0x51d2c8){_0x2a5a83[_0x9928('0x25')](0x194);}return _0x51d2c8;};}function handleError(_0x2d1d02,_0x4bd7a7){_0x4bd7a7=_0x4bd7a7||0x1f4;return function(_0x288ff8){logger['error'](_0x288ff8[_0x9928('0x26')]);if(_0x288ff8['name']){delete _0x288ff8['name'];}_0x2d1d02[_0x9928('0x1a')](_0x4bd7a7)[_0x9928('0x27')](_0x288ff8);};}exports[_0x9928('0x28')]=function(_0x103f4c,_0x713ebb){var _0x249dde={},_0x1d4a13={},_0x1b868c={'count':0x0,'rows':[]};var _0x34bd1d=_[_0x9928('0x29')](db['Dynamics365Configuration'][_0x9928('0x2a')],function(_0x378fed){return{'name':_0x378fed[_0x9928('0x2b')],'type':_0x378fed['type'][_0x9928('0x2c')]};});_0x1d4a13['model']=_[_0x9928('0x29')](_0x34bd1d,_0x9928('0x2d'));_0x1d4a13[_0x9928('0x2e')]=_[_0x9928('0x2f')](_0x103f4c[_0x9928('0x2e')]);_0x1d4a13[_0x9928('0x30')]=_[_0x9928('0x31')](_0x1d4a13['model'],_0x1d4a13['query']);_0x249dde[_0x9928('0x32')]=_[_0x9928('0x31')](_0x1d4a13[_0x9928('0x33')],qs[_0x9928('0x34')](_0x103f4c[_0x9928('0x2e')]['fields']));_0x249dde[_0x9928('0x32')]=_0x249dde[_0x9928('0x32')][_0x9928('0x35')]?_0x249dde['attributes']:_0x1d4a13[_0x9928('0x33')];if(!_0x103f4c[_0x9928('0x2e')][_0x9928('0x36')]('nolimit')){_0x249dde[_0x9928('0x1e')]=qs[_0x9928('0x1e')](_0x103f4c[_0x9928('0x2e')][_0x9928('0x1e')]);_0x249dde['offset']=qs['offset'](_0x103f4c[_0x9928('0x2e')][_0x9928('0x1d')]);}_0x249dde['order']=qs['sort'](_0x103f4c[_0x9928('0x2e')][_0x9928('0x37')]);_0x249dde[_0x9928('0x38')]=qs[_0x9928('0x30')](_[_0x9928('0x39')](_0x103f4c['query'],_0x1d4a13[_0x9928('0x30')]),_0x34bd1d);if(_0x103f4c['query'][_0x9928('0x3a')]){_0x249dde[_0x9928('0x38')]=_[_0x9928('0x3b')](_0x249dde[_0x9928('0x38')],{'$or':_[_0x9928('0x29')](_0x34bd1d,function(_0x4aad32){if(_0x4aad32[_0x9928('0x3c')]!=='VIRTUAL'){var _0x149f20={};_0x149f20[_0x4aad32[_0x9928('0x2d')]]={'$like':'%'+_0x103f4c[_0x9928('0x2e')][_0x9928('0x3a')]+'%'};return _0x149f20;}})});}_0x249dde=_[_0x9928('0x3b')]({},_0x249dde,_0x103f4c[_0x9928('0x3d')]);var _0x1ab936={'where':_0x249dde[_0x9928('0x38')]};return db['Dynamics365Configuration'][_0x9928('0x1f')](_0x1ab936)[_0x9928('0x24')](function(_0x15a19e){_0x1b868c[_0x9928('0x1f')]=_0x15a19e;if(_0x103f4c['query'][_0x9928('0x3e')]){_0x249dde[_0x9928('0x3f')]=[{'all':!![]}];}return db[_0x9928('0x40')][_0x9928('0x41')](_0x249dde);})['then'](function(_0x4c9caf){_0x1b868c['rows']=_0x4c9caf;return _0x1b868c;})[_0x9928('0x24')](respondWithFilteredResult(_0x713ebb,_0x249dde))['catch'](handleError(_0x713ebb,null));};exports[_0x9928('0x42')]=function(_0x26613a,_0x45c16b){var _0xec18ae={'raw':![],'where':{'id':_0x26613a[_0x9928('0x43')]['id']}},_0x3cbc47={};_0x3cbc47[_0x9928('0x33')]=_['keys'](db['Dynamics365Configuration']['rawAttributes']);_0x3cbc47[_0x9928('0x2e')]=_[_0x9928('0x2f')](_0x26613a['query']);_0x3cbc47[_0x9928('0x30')]=_[_0x9928('0x31')](_0x3cbc47['model'],_0x3cbc47[_0x9928('0x2e')]);_0xec18ae[_0x9928('0x32')]=_[_0x9928('0x31')](_0x3cbc47[_0x9928('0x33')],qs[_0x9928('0x34')](_0x26613a[_0x9928('0x2e')][_0x9928('0x34')]));_0xec18ae[_0x9928('0x32')]=_0xec18ae[_0x9928('0x32')][_0x9928('0x35')]?_0xec18ae['attributes']:_0x3cbc47['model'];if(_0x26613a[_0x9928('0x2e')][_0x9928('0x3e')]){_0xec18ae['include']=[{'all':!![]}];}_0xec18ae=_[_0x9928('0x3b')]({},_0xec18ae,_0x26613a[_0x9928('0x3d')]);return db[_0x9928('0x40')][_0x9928('0x44')](_0xec18ae)['then'](handleEntityNotFound(_0x45c16b,null))[_0x9928('0x24')](respondWithResult(_0x45c16b,null))[_0x9928('0x45')](handleError(_0x45c16b,null));};exports['create']=function(_0x44e154,_0x2bed24){return db[_0x9928('0x40')]['create'](_0x44e154[_0x9928('0x46')],{})[_0x9928('0x24')](respondWithResult(_0x2bed24,0xc9))['catch'](handleError(_0x2bed24,null));};exports[_0x9928('0x23')]=function(_0x5a0e1c,_0x52acf4){if(_0x5a0e1c[_0x9928('0x46')]['id']){delete _0x5a0e1c[_0x9928('0x46')]['id'];}return db['Dynamics365Configuration'][_0x9928('0x44')]({'where':{'id':_0x5a0e1c[_0x9928('0x43')]['id']}})['then'](handleEntityNotFound(_0x52acf4,null))[_0x9928('0x24')](saveUpdates(_0x5a0e1c[_0x9928('0x46')],null))['then'](respondWithResult(_0x52acf4,null))[_0x9928('0x45')](handleError(_0x52acf4,null));};exports[_0x9928('0x47')]=function(_0x49d076,_0x488d83){return db['Dynamics365Configuration'][_0x9928('0x44')]({'where':{'id':_0x49d076[_0x9928('0x43')]['id']}})[_0x9928('0x24')](handleEntityNotFound(_0x488d83,null))[_0x9928('0x24')](removeEntity(_0x488d83,null))[_0x9928('0x45')](handleError(_0x488d83,null));};exports[_0x9928('0x48')]=function(_0x4c43b0,_0x1737b8,_0x24e51d){var _0xae35ab={};var _0x4d6c86={};var _0x2780a2;var _0x3984ff;return db[_0x9928('0x40')][_0x9928('0x49')]({'where':{'id':_0x4c43b0[_0x9928('0x43')]['id']}})[_0x9928('0x24')](handleEntityNotFound(_0x1737b8,null))[_0x9928('0x24')](function(_0x29214b){if(_0x29214b){_0x2780a2=_0x29214b;_0x4d6c86[_0x9928('0x33')]=_[_0x9928('0x2f')](db[_0x9928('0x4a')]['rawAttributes']);_0x4d6c86['query']=_[_0x9928('0x2f')](_0x4c43b0[_0x9928('0x2e')]);_0x4d6c86['filters']=_[_0x9928('0x31')](_0x4d6c86[_0x9928('0x33')],_0x4d6c86[_0x9928('0x2e')]);_0xae35ab[_0x9928('0x32')]=_[_0x9928('0x31')](_0x4d6c86['model'],qs[_0x9928('0x34')](_0x4c43b0[_0x9928('0x2e')][_0x9928('0x34')]));_0xae35ab[_0x9928('0x32')]=_0xae35ab[_0x9928('0x32')][_0x9928('0x35')]?_0xae35ab['attributes']:_0x4d6c86[_0x9928('0x33')];_0xae35ab[_0x9928('0x4b')]=qs[_0x9928('0x37')](_0x4c43b0[_0x9928('0x2e')]['sort']);_0xae35ab[_0x9928('0x38')]=qs[_0x9928('0x30')](_[_0x9928('0x39')](_0x4c43b0[_0x9928('0x2e')],_0x4d6c86['filters']));if(_0x4c43b0['query'][_0x9928('0x3a')]){_0xae35ab['where']=_['merge'](_0xae35ab[_0x9928('0x38')],{'$or':_[_0x9928('0x29')](_0xae35ab[_0x9928('0x32')],function(_0x4429b3){var _0x4a919a={};_0x4a919a[_0x4429b3]={'$like':'%'+_0x4c43b0[_0x9928('0x2e')][_0x9928('0x3a')]+'%'};return _0x4a919a;})});}_0xae35ab=_['merge']({},_0xae35ab,_0x4c43b0[_0x9928('0x3d')]);return _0x2780a2[_0x9928('0x48')](_0xae35ab);}})[_0x9928('0x24')](function(_0x489638){if(_0x489638){_0x3984ff=_0x489638[_0x9928('0x35')];if(!_0x4c43b0[_0x9928('0x2e')][_0x9928('0x36')](_0x9928('0x4c'))){_0xae35ab['limit']=qs[_0x9928('0x1e')](_0x4c43b0[_0x9928('0x2e')]['limit']);_0xae35ab[_0x9928('0x1d')]=qs[_0x9928('0x1d')](_0x4c43b0[_0x9928('0x2e')][_0x9928('0x1d')]);}return _0x2780a2[_0x9928('0x48')](_0xae35ab);}})[_0x9928('0x24')](function(_0x595b12){if(_0x595b12){return _0x595b12?{'count':_0x3984ff,'rows':_0x595b12}:null;}})[_0x9928('0x24')](respondWithResult(_0x1737b8,null))[_0x9928('0x45')](handleError(_0x1737b8,null));};exports[_0x9928('0x4d')]=function(_0x595fdc,_0x4112cf,_0x2634e7){var _0xf7d415={};var _0x12e988={};var _0x1ea6d1;var _0x43722c;return db['Dynamics365Configuration'][_0x9928('0x49')]({'where':{'id':_0x595fdc[_0x9928('0x43')]['id']}})[_0x9928('0x24')](handleEntityNotFound(_0x4112cf,null))['then'](function(_0x5577aa){if(_0x5577aa){_0x1ea6d1=_0x5577aa;_0x12e988[_0x9928('0x33')]=_[_0x9928('0x2f')](db[_0x9928('0x4a')][_0x9928('0x2a')]);_0x12e988['query']=_[_0x9928('0x2f')](_0x595fdc[_0x9928('0x2e')]);_0x12e988[_0x9928('0x30')]=_[_0x9928('0x31')](_0x12e988[_0x9928('0x33')],_0x12e988[_0x9928('0x2e')]);_0xf7d415['attributes']=_[_0x9928('0x31')](_0x12e988[_0x9928('0x33')],qs[_0x9928('0x34')](_0x595fdc[_0x9928('0x2e')][_0x9928('0x34')]));_0xf7d415['attributes']=_0xf7d415['attributes'][_0x9928('0x35')]?_0xf7d415[_0x9928('0x32')]:_0x12e988[_0x9928('0x33')];_0xf7d415[_0x9928('0x4b')]=qs[_0x9928('0x37')](_0x595fdc[_0x9928('0x2e')]['sort']);_0xf7d415[_0x9928('0x38')]=qs['filters'](_[_0x9928('0x39')](_0x595fdc[_0x9928('0x2e')],_0x12e988[_0x9928('0x30')]));if(_0x595fdc[_0x9928('0x2e')][_0x9928('0x3a')]){_0xf7d415[_0x9928('0x38')]=_[_0x9928('0x3b')](_0xf7d415['where'],{'$or':_[_0x9928('0x29')](_0xf7d415[_0x9928('0x32')],function(_0x320631){var _0x2091cd={};_0x2091cd[_0x320631]={'$like':'%'+_0x595fdc['query'][_0x9928('0x3a')]+'%'};return _0x2091cd;})});}_0xf7d415=_['merge']({},_0xf7d415,_0x595fdc['options']);return _0x1ea6d1[_0x9928('0x4d')](_0xf7d415);}})[_0x9928('0x24')](function(_0xe831c7){if(_0xe831c7){_0x43722c=_0xe831c7[_0x9928('0x35')];if(!_0x595fdc[_0x9928('0x2e')][_0x9928('0x36')]('nolimit')){_0xf7d415['limit']=qs[_0x9928('0x1e')](_0x595fdc[_0x9928('0x2e')]['limit']);_0xf7d415[_0x9928('0x1d')]=qs[_0x9928('0x1d')](_0x595fdc[_0x9928('0x2e')]['offset']);}return _0x1ea6d1['getSubjects'](_0xf7d415);}})['then'](function(_0x19c92f){if(_0x19c92f){return _0x19c92f?{'count':_0x43722c,'rows':_0x19c92f}:null;}})['then'](respondWithResult(_0x4112cf,null))['catch'](handleError(_0x4112cf,null));};exports[_0x9928('0x4e')]=function(_0x2a3310,_0x3842a1,_0x4b482f){var _0x13cdb4={};var _0x57f53a={};var _0x3107af;var _0x3f49aa;return db[_0x9928('0x40')][_0x9928('0x49')]({'where':{'id':_0x2a3310['params']['id']}})[_0x9928('0x24')](handleEntityNotFound(_0x3842a1,null))[_0x9928('0x24')](function(_0x2e1423){if(_0x2e1423){_0x3107af=_0x2e1423;_0x57f53a[_0x9928('0x33')]=_[_0x9928('0x2f')](db['Dynamics365Field'][_0x9928('0x2a')]);_0x57f53a[_0x9928('0x2e')]=_[_0x9928('0x2f')](_0x2a3310['query']);_0x57f53a[_0x9928('0x30')]=_[_0x9928('0x31')](_0x57f53a[_0x9928('0x33')],_0x57f53a[_0x9928('0x2e')]);_0x13cdb4[_0x9928('0x32')]=_[_0x9928('0x31')](_0x57f53a['model'],qs['fields'](_0x2a3310[_0x9928('0x2e')][_0x9928('0x34')]));_0x13cdb4[_0x9928('0x32')]=_0x13cdb4[_0x9928('0x32')]['length']?_0x13cdb4[_0x9928('0x32')]:_0x57f53a[_0x9928('0x33')];_0x13cdb4[_0x9928('0x4b')]=qs[_0x9928('0x37')](_0x2a3310[_0x9928('0x2e')][_0x9928('0x37')]);_0x13cdb4['where']=qs[_0x9928('0x30')](_[_0x9928('0x39')](_0x2a3310[_0x9928('0x2e')],_0x57f53a[_0x9928('0x30')]));if(_0x2a3310['query'][_0x9928('0x3a')]){_0x13cdb4[_0x9928('0x38')]=_[_0x9928('0x3b')](_0x13cdb4[_0x9928('0x38')],{'$or':_['map'](_0x13cdb4[_0x9928('0x32')],function(_0x3955c5){var _0x4e1948={};_0x4e1948[_0x3955c5]={'$like':'%'+_0x2a3310[_0x9928('0x2e')][_0x9928('0x3a')]+'%'};return _0x4e1948;})});}_0x13cdb4=_['merge']({},_0x13cdb4,_0x2a3310[_0x9928('0x3d')]);return _0x3107af[_0x9928('0x4e')](_0x13cdb4);}})[_0x9928('0x24')](function(_0x1a09dc){if(_0x1a09dc){_0x3f49aa=_0x1a09dc[_0x9928('0x35')];if(!_0x2a3310[_0x9928('0x2e')][_0x9928('0x36')]('nolimit')){_0x13cdb4[_0x9928('0x1e')]=qs[_0x9928('0x1e')](_0x2a3310['query'][_0x9928('0x1e')]);_0x13cdb4[_0x9928('0x1d')]=qs['offset'](_0x2a3310[_0x9928('0x2e')]['offset']);}return _0x3107af[_0x9928('0x4e')](_0x13cdb4);}})[_0x9928('0x24')](function(_0x1f213c){if(_0x1f213c){return _0x1f213c?{'count':_0x3f49aa,'rows':_0x1f213c}:null;}})[_0x9928('0x24')](respondWithResult(_0x3842a1,null))[_0x9928('0x45')](handleError(_0x3842a1,null));}; \ No newline at end of file +var _0x8802=['end','status','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','VIRTUAL','merge','options','Dynamics365Configuration','includeAll','include','findAll','params','catch','create','update','body','find','getFields','Dynamics365Field','order','pick','hasOwnProperty','getSubjects','map','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8802,0xdb));var _0x2880=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x8802[_0x556bb1];return _0x45455f;};'use strict';var emlformat=require(_0x2880('0x0'));var rimraf=require(_0x2880('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2880('0x2'));var rp=require(_0x2880('0x3'));var moment=require(_0x2880('0x4'));var BPromise=require(_0x2880('0x5'));var Mustache=require(_0x2880('0x6'));var util=require('util');var path=require(_0x2880('0x7'));var sox=require(_0x2880('0x8'));var csv=require(_0x2880('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2880('0xa'));var _=require(_0x2880('0xb'));var squel=require(_0x2880('0xc'));var crypto=require(_0x2880('0xd'));var jsforce=require(_0x2880('0xe'));var deskjs=require(_0x2880('0xf'));var toCsv=require(_0x2880('0x9'));var querystring=require(_0x2880('0x10'));var Papa=require(_0x2880('0x11'));var Redis=require(_0x2880('0x12'));var authService=require(_0x2880('0x13'));var qs=require(_0x2880('0x14'));var as=require(_0x2880('0x15'));var hardwareService=require(_0x2880('0x16'));var logger=require(_0x2880('0x17'))(_0x2880('0x18'));var utils=require(_0x2880('0x19'));var config=require(_0x2880('0x1a'));var licenseUtil=require(_0x2880('0x1b'));var db=require(_0x2880('0x1c'))['db'];function respondWithStatusCode(_0x3e9ec6,_0x2cef50){_0x2cef50=_0x2cef50||0xcc;return function(_0x898077){if(_0x898077){return _0x3e9ec6[_0x2880('0x1d')](_0x2cef50);}return _0x3e9ec6['status'](_0x2cef50)[_0x2880('0x1e')]();};}function respondWithResult(_0x550bc8,_0x37e5a6){_0x37e5a6=_0x37e5a6||0xc8;return function(_0x263845){if(_0x263845){return _0x550bc8[_0x2880('0x1f')](_0x37e5a6)['json'](_0x263845);}};}function respondWithFilteredResult(_0x4ccb64,_0x13c644){return function(_0x5589b7){if(_0x5589b7){var _0x4f06c4=typeof _0x13c644[_0x2880('0x20')]===_0x2880('0x21')&&typeof _0x13c644[_0x2880('0x22')]==='undefined';var _0x4dfc93=_0x5589b7[_0x2880('0x23')];var _0x53a067=_0x4f06c4?0x0:_0x13c644['offset'];var _0x22aeef=_0x4f06c4?_0x5589b7['count']:_0x13c644['offset']+_0x13c644[_0x2880('0x22')];var _0x4a3104;if(_0x22aeef>=_0x4dfc93){_0x22aeef=_0x4dfc93;_0x4a3104=0xc8;}else{_0x4a3104=0xce;}_0x4ccb64['status'](_0x4a3104);return _0x4ccb64[_0x2880('0x24')](_0x2880('0x25'),_0x53a067+'-'+_0x22aeef+'/'+_0x4dfc93)['json'](_0x5589b7);}return null;};}function patchUpdates(_0x1306bb){return function(_0x190352){try{jsonpatch[_0x2880('0x26')](_0x190352,_0x1306bb,!![]);}catch(_0x22c5f2){return BPromise['reject'](_0x22c5f2);}return _0x190352[_0x2880('0x27')]();};}function saveUpdates(_0x1d88e4,_0x448f7f){return function(_0x593f4a){if(_0x593f4a){return _0x593f4a['update'](_0x1d88e4)[_0x2880('0x28')](function(_0x4d7b3b){return _0x4d7b3b;});}return null;};}function removeEntity(_0xc60636,_0xae1717){return function(_0x52e901){if(_0x52e901){return _0x52e901[_0x2880('0x29')]()[_0x2880('0x28')](function(){_0xc60636[_0x2880('0x1f')](0xcc)[_0x2880('0x1e')]();});}};}function handleEntityNotFound(_0xe6906f,_0x48f00f){return function(_0x32f55e){if(!_0x32f55e){_0xe6906f[_0x2880('0x1d')](0x194);}return _0x32f55e;};}function handleError(_0x5f0870,_0x1ae9a9){_0x1ae9a9=_0x1ae9a9||0x1f4;return function(_0x4c3199){logger[_0x2880('0x2a')](_0x4c3199[_0x2880('0x2b')]);if(_0x4c3199[_0x2880('0x2c')]){delete _0x4c3199[_0x2880('0x2c')];}_0x5f0870[_0x2880('0x1f')](_0x1ae9a9)[_0x2880('0x2d')](_0x4c3199);};}exports[_0x2880('0x2e')]=function(_0x43bc10,_0xa7236e){var _0x5504c1={},_0x34b6ab={},_0xc15ace={'count':0x0,'rows':[]};var _0x28388d=_['map'](db['Dynamics365Configuration'][_0x2880('0x2f')],function(_0x1cbb25){return{'name':_0x1cbb25[_0x2880('0x30')],'type':_0x1cbb25[_0x2880('0x31')]['key']};});_0x34b6ab[_0x2880('0x32')]=_['map'](_0x28388d,_0x2880('0x2c'));_0x34b6ab[_0x2880('0x33')]=_[_0x2880('0x34')](_0x43bc10[_0x2880('0x33')]);_0x34b6ab[_0x2880('0x35')]=_[_0x2880('0x36')](_0x34b6ab[_0x2880('0x32')],_0x34b6ab[_0x2880('0x33')]);_0x5504c1[_0x2880('0x37')]=_[_0x2880('0x36')](_0x34b6ab['model'],qs[_0x2880('0x38')](_0x43bc10[_0x2880('0x33')][_0x2880('0x38')]));_0x5504c1['attributes']=_0x5504c1[_0x2880('0x37')][_0x2880('0x39')]?_0x5504c1[_0x2880('0x37')]:_0x34b6ab[_0x2880('0x32')];if(!_0x43bc10[_0x2880('0x33')]['hasOwnProperty'](_0x2880('0x3a'))){_0x5504c1['limit']=qs[_0x2880('0x22')](_0x43bc10['query']['limit']);_0x5504c1[_0x2880('0x20')]=qs['offset'](_0x43bc10[_0x2880('0x33')][_0x2880('0x20')]);}_0x5504c1['order']=qs[_0x2880('0x3b')](_0x43bc10[_0x2880('0x33')]['sort']);_0x5504c1[_0x2880('0x3c')]=qs[_0x2880('0x35')](_['pick'](_0x43bc10['query'],_0x34b6ab[_0x2880('0x35')]),_0x28388d);if(_0x43bc10[_0x2880('0x33')][_0x2880('0x3d')]){_0x5504c1[_0x2880('0x3c')]=_['merge'](_0x5504c1[_0x2880('0x3c')],{'$or':_['map'](_0x28388d,function(_0x32dfd5){if(_0x32dfd5['type']!==_0x2880('0x3e')){var _0x317610={};_0x317610[_0x32dfd5[_0x2880('0x2c')]]={'$like':'%'+_0x43bc10[_0x2880('0x33')][_0x2880('0x3d')]+'%'};return _0x317610;}})});}_0x5504c1=_[_0x2880('0x3f')]({},_0x5504c1,_0x43bc10[_0x2880('0x40')]);var _0x463a03={'where':_0x5504c1[_0x2880('0x3c')]};return db[_0x2880('0x41')][_0x2880('0x23')](_0x463a03)['then'](function(_0x11cf49){_0xc15ace[_0x2880('0x23')]=_0x11cf49;if(_0x43bc10[_0x2880('0x33')][_0x2880('0x42')]){_0x5504c1[_0x2880('0x43')]=[{'all':!![]}];}return db[_0x2880('0x41')][_0x2880('0x44')](_0x5504c1);})[_0x2880('0x28')](function(_0x23530c){_0xc15ace['rows']=_0x23530c;return _0xc15ace;})['then'](respondWithFilteredResult(_0xa7236e,_0x5504c1))['catch'](handleError(_0xa7236e,null));};exports['show']=function(_0x3a8820,_0x2d5076){var _0x954272={'raw':![],'where':{'id':_0x3a8820[_0x2880('0x45')]['id']}},_0x487a90={};_0x487a90[_0x2880('0x32')]=_[_0x2880('0x34')](db[_0x2880('0x41')]['rawAttributes']);_0x487a90[_0x2880('0x33')]=_['keys'](_0x3a8820[_0x2880('0x33')]);_0x487a90['filters']=_[_0x2880('0x36')](_0x487a90[_0x2880('0x32')],_0x487a90[_0x2880('0x33')]);_0x954272['attributes']=_[_0x2880('0x36')](_0x487a90[_0x2880('0x32')],qs['fields'](_0x3a8820['query'][_0x2880('0x38')]));_0x954272[_0x2880('0x37')]=_0x954272[_0x2880('0x37')][_0x2880('0x39')]?_0x954272['attributes']:_0x487a90[_0x2880('0x32')];if(_0x3a8820[_0x2880('0x33')][_0x2880('0x42')]){_0x954272['include']=[{'all':!![]}];}_0x954272=_['merge']({},_0x954272,_0x3a8820[_0x2880('0x40')]);return db[_0x2880('0x41')]['find'](_0x954272)[_0x2880('0x28')](handleEntityNotFound(_0x2d5076,null))[_0x2880('0x28')](respondWithResult(_0x2d5076,null))[_0x2880('0x46')](handleError(_0x2d5076,null));};exports[_0x2880('0x47')]=function(_0x52e886,_0xb2dd1b){return db[_0x2880('0x41')][_0x2880('0x47')](_0x52e886['body'],{})['then'](respondWithResult(_0xb2dd1b,0xc9))['catch'](handleError(_0xb2dd1b,null));};exports[_0x2880('0x48')]=function(_0x500c99,_0x1ccb73){if(_0x500c99[_0x2880('0x49')]['id']){delete _0x500c99['body']['id'];}return db[_0x2880('0x41')][_0x2880('0x4a')]({'where':{'id':_0x500c99['params']['id']}})[_0x2880('0x28')](handleEntityNotFound(_0x1ccb73,null))[_0x2880('0x28')](saveUpdates(_0x500c99['body'],null))[_0x2880('0x28')](respondWithResult(_0x1ccb73,null))['catch'](handleError(_0x1ccb73,null));};exports[_0x2880('0x29')]=function(_0x29b7be,_0x148d4c){return db['Dynamics365Configuration'][_0x2880('0x4a')]({'where':{'id':_0x29b7be[_0x2880('0x45')]['id']}})[_0x2880('0x28')](handleEntityNotFound(_0x148d4c,null))['then'](removeEntity(_0x148d4c,null))[_0x2880('0x46')](handleError(_0x148d4c,null));};exports[_0x2880('0x4b')]=function(_0x4c4b9e,_0x43c040,_0x8c7f7e){var _0x153276={};var _0x1bda13={};var _0x3685d9;var _0x3acad0;return db[_0x2880('0x41')]['findOne']({'where':{'id':_0x4c4b9e[_0x2880('0x45')]['id']}})[_0x2880('0x28')](handleEntityNotFound(_0x43c040,null))[_0x2880('0x28')](function(_0x396760){if(_0x396760){_0x3685d9=_0x396760;_0x1bda13[_0x2880('0x32')]=_[_0x2880('0x34')](db[_0x2880('0x4c')][_0x2880('0x2f')]);_0x1bda13['query']=_[_0x2880('0x34')](_0x4c4b9e[_0x2880('0x33')]);_0x1bda13[_0x2880('0x35')]=_[_0x2880('0x36')](_0x1bda13[_0x2880('0x32')],_0x1bda13['query']);_0x153276['attributes']=_[_0x2880('0x36')](_0x1bda13[_0x2880('0x32')],qs[_0x2880('0x38')](_0x4c4b9e[_0x2880('0x33')][_0x2880('0x38')]));_0x153276[_0x2880('0x37')]=_0x153276[_0x2880('0x37')][_0x2880('0x39')]?_0x153276['attributes']:_0x1bda13[_0x2880('0x32')];_0x153276[_0x2880('0x4d')]=qs[_0x2880('0x3b')](_0x4c4b9e[_0x2880('0x33')][_0x2880('0x3b')]);_0x153276[_0x2880('0x3c')]=qs[_0x2880('0x35')](_[_0x2880('0x4e')](_0x4c4b9e[_0x2880('0x33')],_0x1bda13[_0x2880('0x35')]));if(_0x4c4b9e[_0x2880('0x33')][_0x2880('0x3d')]){_0x153276[_0x2880('0x3c')]=_[_0x2880('0x3f')](_0x153276[_0x2880('0x3c')],{'$or':_['map'](_0x153276['attributes'],function(_0x2c1b85){var _0x1c730f={};_0x1c730f[_0x2c1b85]={'$like':'%'+_0x4c4b9e['query'][_0x2880('0x3d')]+'%'};return _0x1c730f;})});}_0x153276=_[_0x2880('0x3f')]({},_0x153276,_0x4c4b9e[_0x2880('0x40')]);return _0x3685d9[_0x2880('0x4b')](_0x153276);}})[_0x2880('0x28')](function(_0x1a14b6){if(_0x1a14b6){_0x3acad0=_0x1a14b6[_0x2880('0x39')];if(!_0x4c4b9e[_0x2880('0x33')][_0x2880('0x4f')](_0x2880('0x3a'))){_0x153276[_0x2880('0x22')]=qs['limit'](_0x4c4b9e[_0x2880('0x33')]['limit']);_0x153276[_0x2880('0x20')]=qs['offset'](_0x4c4b9e['query'][_0x2880('0x20')]);}return _0x3685d9['getFields'](_0x153276);}})[_0x2880('0x28')](function(_0x49ccbc){if(_0x49ccbc){return _0x49ccbc?{'count':_0x3acad0,'rows':_0x49ccbc}:null;}})[_0x2880('0x28')](respondWithResult(_0x43c040,null))[_0x2880('0x46')](handleError(_0x43c040,null));};exports[_0x2880('0x50')]=function(_0x11de7a,_0x5b0343,_0x164ccc){var _0x32b700={};var _0x45a862={};var _0x45ebd4;var _0x1b185f;return db[_0x2880('0x41')]['findOne']({'where':{'id':_0x11de7a[_0x2880('0x45')]['id']}})[_0x2880('0x28')](handleEntityNotFound(_0x5b0343,null))[_0x2880('0x28')](function(_0x3c6153){if(_0x3c6153){_0x45ebd4=_0x3c6153;_0x45a862['model']=_['keys'](db[_0x2880('0x4c')]['rawAttributes']);_0x45a862['query']=_['keys'](_0x11de7a[_0x2880('0x33')]);_0x45a862['filters']=_[_0x2880('0x36')](_0x45a862['model'],_0x45a862['query']);_0x32b700[_0x2880('0x37')]=_[_0x2880('0x36')](_0x45a862[_0x2880('0x32')],qs[_0x2880('0x38')](_0x11de7a[_0x2880('0x33')]['fields']));_0x32b700[_0x2880('0x37')]=_0x32b700[_0x2880('0x37')][_0x2880('0x39')]?_0x32b700[_0x2880('0x37')]:_0x45a862['model'];_0x32b700[_0x2880('0x4d')]=qs[_0x2880('0x3b')](_0x11de7a[_0x2880('0x33')][_0x2880('0x3b')]);_0x32b700[_0x2880('0x3c')]=qs[_0x2880('0x35')](_[_0x2880('0x4e')](_0x11de7a[_0x2880('0x33')],_0x45a862[_0x2880('0x35')]));if(_0x11de7a[_0x2880('0x33')][_0x2880('0x3d')]){_0x32b700[_0x2880('0x3c')]=_['merge'](_0x32b700[_0x2880('0x3c')],{'$or':_[_0x2880('0x51')](_0x32b700[_0x2880('0x37')],function(_0x7dd2e7){var _0x3aac40={};_0x3aac40[_0x7dd2e7]={'$like':'%'+_0x11de7a[_0x2880('0x33')][_0x2880('0x3d')]+'%'};return _0x3aac40;})});}_0x32b700=_[_0x2880('0x3f')]({},_0x32b700,_0x11de7a[_0x2880('0x40')]);return _0x45ebd4[_0x2880('0x50')](_0x32b700);}})['then'](function(_0x28a40a){if(_0x28a40a){_0x1b185f=_0x28a40a[_0x2880('0x39')];if(!_0x11de7a[_0x2880('0x33')][_0x2880('0x4f')](_0x2880('0x3a'))){_0x32b700[_0x2880('0x22')]=qs['limit'](_0x11de7a[_0x2880('0x33')][_0x2880('0x22')]);_0x32b700[_0x2880('0x20')]=qs[_0x2880('0x20')](_0x11de7a[_0x2880('0x33')][_0x2880('0x20')]);}return _0x45ebd4[_0x2880('0x50')](_0x32b700);}})[_0x2880('0x28')](function(_0x1b9f0e){if(_0x1b9f0e){return _0x1b9f0e?{'count':_0x1b185f,'rows':_0x1b9f0e}:null;}})[_0x2880('0x28')](respondWithResult(_0x5b0343,null))[_0x2880('0x46')](handleError(_0x5b0343,null));};exports[_0x2880('0x52')]=function(_0x7501e4,_0x5bc4d3,_0x10eeaf){var _0x3662f5={};var _0x29d32c={};var _0x4467eb;var _0x25718c;return db[_0x2880('0x41')]['findOne']({'where':{'id':_0x7501e4['params']['id']}})[_0x2880('0x28')](handleEntityNotFound(_0x5bc4d3,null))['then'](function(_0x316c4d){if(_0x316c4d){_0x4467eb=_0x316c4d;_0x29d32c[_0x2880('0x32')]=_['keys'](db[_0x2880('0x4c')][_0x2880('0x2f')]);_0x29d32c[_0x2880('0x33')]=_['keys'](_0x7501e4['query']);_0x29d32c['filters']=_['intersection'](_0x29d32c[_0x2880('0x32')],_0x29d32c[_0x2880('0x33')]);_0x3662f5[_0x2880('0x37')]=_['intersection'](_0x29d32c['model'],qs[_0x2880('0x38')](_0x7501e4[_0x2880('0x33')][_0x2880('0x38')]));_0x3662f5['attributes']=_0x3662f5[_0x2880('0x37')][_0x2880('0x39')]?_0x3662f5[_0x2880('0x37')]:_0x29d32c[_0x2880('0x32')];_0x3662f5['order']=qs[_0x2880('0x3b')](_0x7501e4[_0x2880('0x33')][_0x2880('0x3b')]);_0x3662f5[_0x2880('0x3c')]=qs[_0x2880('0x35')](_[_0x2880('0x4e')](_0x7501e4[_0x2880('0x33')],_0x29d32c[_0x2880('0x35')]));if(_0x7501e4['query'][_0x2880('0x3d')]){_0x3662f5[_0x2880('0x3c')]=_[_0x2880('0x3f')](_0x3662f5[_0x2880('0x3c')],{'$or':_[_0x2880('0x51')](_0x3662f5[_0x2880('0x37')],function(_0x4c89a9){var _0x55d097={};_0x55d097[_0x4c89a9]={'$like':'%'+_0x7501e4[_0x2880('0x33')]['filter']+'%'};return _0x55d097;})});}_0x3662f5=_[_0x2880('0x3f')]({},_0x3662f5,_0x7501e4['options']);return _0x4467eb[_0x2880('0x52')](_0x3662f5);}})['then'](function(_0x4ed455){if(_0x4ed455){_0x25718c=_0x4ed455[_0x2880('0x39')];if(!_0x7501e4[_0x2880('0x33')][_0x2880('0x4f')]('nolimit')){_0x3662f5[_0x2880('0x22')]=qs[_0x2880('0x22')](_0x7501e4[_0x2880('0x33')][_0x2880('0x22')]);_0x3662f5[_0x2880('0x20')]=qs[_0x2880('0x20')](_0x7501e4[_0x2880('0x33')]['offset']);}return _0x4467eb[_0x2880('0x52')](_0x3662f5);}})[_0x2880('0x28')](function(_0x3bade8){if(_0x3bade8){return _0x3bade8?{'count':_0x25718c,'rows':_0x3bade8}:null;}})[_0x2880('0x28')](respondWithResult(_0x5bc4d3,null))[_0x2880('0x46')](handleError(_0x5bc4d3,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index a5fc36d..12f4dcf 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 _0x6f0d=['./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x381606,_0x220cae){_0x381606=_0x381606-0x0;var _0x121ed1=_0x6f0d[_0x381606];return _0x121ed1;};'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 _0xd6d6=['path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x29b153,_0x1b416b){var _0x3de68e=function(_0x18d056){while(--_0x18d056){_0x29b153['push'](_0x29b153['shift']());}};_0x3de68e(++_0x1b416b);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x2956d3,_0x302749){_0x2956d3=_0x2956d3-0x0;var _0x2f2917=_0xd6d6[_0x2956d3];return _0x2f2917;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'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 c17fbca..60a82d0 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 _0x1a5f=['request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s'];(function(_0x5e9238,_0x134313){var _0x5a0d98=function(_0xb81f2){while(--_0xb81f2){_0x5e9238['push'](_0x5e9238['shift']());}};_0x5a0d98(++_0x134313);}(_0x1a5f,0x180));var _0xf1a5=function(_0x5319f5,_0x3135e0){_0x5319f5=_0x5319f5-0x0;var _0x4d278e=_0x1a5f[_0x5319f5];return _0x4d278e;};'use strict';var _=require('lodash');var util=require(_0xf1a5('0x0'));var moment=require(_0xf1a5('0x1'));var BPromise=require(_0xf1a5('0x2'));var rs=require(_0xf1a5('0x3'));var fs=require('fs');var Redis=require(_0xf1a5('0x4'));var db=require(_0xf1a5('0x5'))['db'];var utils=require(_0xf1a5('0x6'));var logger=require(_0xf1a5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf1a5('0x8'));var client=jayson[_0xf1a5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32c350,_0xd80e20,_0xab8e28){return new BPromise(function(_0x27a4ed,_0x4e5558){return client[_0xf1a5('0xa')](_0x32c350,_0xab8e28)['then'](function(_0xf2120c){logger[_0xf1a5('0xb')](_0xf1a5('0xc'),_0xd80e20,'request\x20sent');logger[_0xf1a5('0xd')](_0xf1a5('0xe'),_0xd80e20,_0xf1a5('0xf'),JSON[_0xf1a5('0x10')](_0xf2120c));if(_0xf2120c[_0xf1a5('0x11')]){if(_0xf2120c[_0xf1a5('0x11')][_0xf1a5('0x12')]===0x1f4){logger['error'](_0xf1a5('0xc'),_0xd80e20,_0xf2120c[_0xf1a5('0x11')][_0xf1a5('0x13')]);return _0x4e5558(_0xf2120c[_0xf1a5('0x11')]['message']);}logger[_0xf1a5('0x11')](_0xf1a5('0xc'),_0xd80e20,_0xf2120c[_0xf1a5('0x11')][_0xf1a5('0x13')]);return _0x27a4ed(_0xf2120c[_0xf1a5('0x11')]['message']);}else{logger[_0xf1a5('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0xd80e20,_0xf1a5('0xf'));_0x27a4ed(_0xf2120c['result'][_0xf1a5('0x13')]);}})[_0xf1a5('0x14')](function(_0x20bcdb){logger[_0xf1a5('0x11')](_0xf1a5('0xc'),_0xd80e20,_0x20bcdb);_0x4e5558(_0x20bcdb);});});} \ No newline at end of file +var _0xef52=['util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x11ba06,_0x41d28d){var _0x3053d8=function(_0x2362c9){while(--_0x2362c9){_0x11ba06['push'](_0x11ba06['shift']());}};_0x3053d8(++_0x41d28d);}(_0xef52,0xa2));var _0x2ef5=function(_0x39cad6,_0x1edf41){_0x39cad6=_0x39cad6-0x0;var _0x5a82f2=_0xef52[_0x39cad6];return _0x5a82f2;};'use strict';var _=require('lodash');var util=require(_0x2ef5('0x0'));var moment=require(_0x2ef5('0x1'));var BPromise=require(_0x2ef5('0x2'));var rs=require(_0x2ef5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ef5('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2ef5('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2ef5('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x453e0f,_0x4d41f4,_0x16f57c){return new BPromise(function(_0x3e7f42,_0x20b02f){return client[_0x2ef5('0x7')](_0x453e0f,_0x16f57c)[_0x2ef5('0x8')](function(_0x2be460){logger[_0x2ef5('0x9')](_0x2ef5('0xa'),_0x4d41f4,_0x2ef5('0xb'));logger[_0x2ef5('0xc')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x4d41f4,_0x2ef5('0xb'),JSON[_0x2ef5('0xd')](_0x2be460));if(_0x2be460[_0x2ef5('0xe')]){if(_0x2be460['error'][_0x2ef5('0xf')]===0x1f4){logger[_0x2ef5('0xe')](_0x2ef5('0xa'),_0x4d41f4,_0x2be460[_0x2ef5('0xe')][_0x2ef5('0x10')]);return _0x20b02f(_0x2be460['error'][_0x2ef5('0x10')]);}logger[_0x2ef5('0xe')](_0x2ef5('0xa'),_0x4d41f4,_0x2be460[_0x2ef5('0xe')][_0x2ef5('0x10')]);return _0x3e7f42(_0x2be460[_0x2ef5('0xe')][_0x2ef5('0x10')]);}else{logger[_0x2ef5('0x9')](_0x2ef5('0xa'),_0x4d41f4,_0x2ef5('0xb'));_0x3e7f42(_0x2be460[_0x2ef5('0x11')][_0x2ef5('0x10')]);}})['catch'](function(_0x19c427){logger['error'](_0x2ef5('0xa'),_0x4d41f4,_0x19c427);_0x20b02f(_0x19c427);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 44a2ea2..d52a21c 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 _0x2ad6=['/:id','show','post','put','delete','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index'];(function(_0x31e5cb,_0x2f5adf){var _0x4170df=function(_0x31c53e){while(--_0x31c53e){_0x31e5cb['push'](_0x31e5cb['shift']());}};_0x4170df(++_0x2f5adf);}(_0x2ad6,0x14a));var _0x62ad=function(_0x30d4fb,_0x197b49){_0x30d4fb=_0x30d4fb-0x0;var _0x3d592b=_0x2ad6[_0x30d4fb];return _0x3d592b;};'use strict';var multer=require(_0x62ad('0x0'));var util=require(_0x62ad('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x62ad('0x2')]();var fs_extra=require(_0x62ad('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x62ad('0x4'));var config=require(_0x62ad('0x5'));var controller=require(_0x62ad('0x6'));router[_0x62ad('0x7')]('/',auth[_0x62ad('0x8')](),controller[_0x62ad('0x9')]);router[_0x62ad('0x7')](_0x62ad('0xa'),auth[_0x62ad('0x8')](),controller[_0x62ad('0xb')]);router[_0x62ad('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x62ad('0xd')](_0x62ad('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x62ad('0xe')](_0x62ad('0xa'),auth[_0x62ad('0x8')](),controller[_0x62ad('0xf')]);module[_0x62ad('0x10')]=router; \ No newline at end of file +var _0x3e1b=['isAuthenticated','index','get','/:id','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x3e1b,0x1e4));var _0xb3e1=function(_0x41b4a5,_0x29cb14){_0x41b4a5=_0x41b4a5-0x0;var _0x2fa684=_0x3e1b[_0x41b4a5];return _0x2fa684;};'use strict';var multer=require(_0xb3e1('0x0'));var util=require(_0xb3e1('0x1'));var path=require(_0xb3e1('0x2'));var timeout=require(_0xb3e1('0x3'));var express=require(_0xb3e1('0x4'));var router=express[_0xb3e1('0x5')]();var fs_extra=require(_0xb3e1('0x6'));var auth=require(_0xb3e1('0x7'));var interaction=require(_0xb3e1('0x8'));var config=require(_0xb3e1('0x9'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0xb3e1('0xa')](),controller[_0xb3e1('0xb')]);router[_0xb3e1('0xc')](_0xb3e1('0xd'),auth[_0xb3e1('0xa')](),controller['show']);router[_0xb3e1('0xe')]('/',auth[_0xb3e1('0xa')](),controller[_0xb3e1('0xf')]);router[_0xb3e1('0x10')](_0xb3e1('0xd'),auth['isAuthenticated'](),controller[_0xb3e1('0x11')]);router['delete'](_0xb3e1('0xd'),auth[_0xb3e1('0xa')](),controller[_0xb3e1('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 3855ed1..f11a184 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 _0xf0d6=['variable','customVariable','keyValue','string','STRING','exports','ENUM'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf0d6,0x67));var _0x6f0d=function(_0xc911db,_0x16a30d){_0xc911db=_0xc911db-0x0;var _0x15a0d0=_0xf0d6[_0xc911db];return _0x15a0d0;};'use strict';var Sequelize=require('sequelize');module[_0x6f0d('0x0')]={'type':{'type':Sequelize[_0x6f0d('0x1')]('string',_0x6f0d('0x2'),_0x6f0d('0x3'),_0x6f0d('0x4'),'picklist'),'defaultValue':_0x6f0d('0x5')},'content':{'type':Sequelize[_0x6f0d('0x6')]},'key':{'type':Sequelize[_0x6f0d('0x6')]},'keyType':{'type':Sequelize[_0x6f0d('0x1')](_0x6f0d('0x5'),_0x6f0d('0x2'),_0x6f0d('0x3'))},'keyContent':{'type':Sequelize[_0x6f0d('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6f0d('0x6')]}}; \ No newline at end of file +var _0xa47a=['customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x5c197b,_0x31e51b){var _0x7a4a9b=function(_0x19eb22){while(--_0x19eb22){_0x5c197b['push'](_0x5c197b['shift']());}};_0x7a4a9b(++_0x31e51b);}(_0xa47a,0x19a));var _0xaa47=function(_0x135fce,_0x4a172a){_0x135fce=_0x135fce-0x0;var _0x83e40c=_0xa47a[_0x135fce];return _0x83e40c;};'use strict';var Sequelize=require('sequelize');module[_0xaa47('0x0')]={'type':{'type':Sequelize[_0xaa47('0x1')](_0xaa47('0x2'),_0xaa47('0x3'),_0xaa47('0x4'),_0xaa47('0x5'),_0xaa47('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xaa47('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xaa47('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xaa47('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xaa47('0x7')]},'customField':{'type':Sequelize[_0xaa47('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaa47('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 020ecd8..8fe03d6 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 _0xe4de=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','Dynamics365Field','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','create','body','find','params','eml-format','rimraf'];(function(_0xff780c,_0x3c94eb){var _0x1f0861=function(_0x390e26){while(--_0x390e26){_0xff780c['push'](_0xff780c['shift']());}};_0x1f0861(++_0x3c94eb);}(_0xe4de,0x9a));var _0xee4d=function(_0x318c93,_0x239912){_0x318c93=_0x318c93-0x0;var _0x47f7d6=_0xe4de[_0x318c93];return _0x47f7d6;};'use strict';var emlformat=require(_0xee4d('0x0'));var rimraf=require(_0xee4d('0x1'));var zipdir=require(_0xee4d('0x2'));var jsonpatch=require(_0xee4d('0x3'));var rp=require(_0xee4d('0x4'));var moment=require(_0xee4d('0x5'));var BPromise=require(_0xee4d('0x6'));var Mustache=require(_0xee4d('0x7'));var util=require(_0xee4d('0x8'));var path=require(_0xee4d('0x9'));var sox=require(_0xee4d('0xa'));var csv=require(_0xee4d('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee4d('0xc'));var squel=require(_0xee4d('0xd'));var crypto=require(_0xee4d('0xe'));var jsforce=require(_0xee4d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xee4d('0xb'));var querystring=require('querystring');var Papa=require(_0xee4d('0x10'));var Redis=require(_0xee4d('0x11'));var authService=require(_0xee4d('0x12'));var qs=require(_0xee4d('0x13'));var as=require(_0xee4d('0x14'));var hardwareService=require(_0xee4d('0x15'));var logger=require(_0xee4d('0x16'))(_0xee4d('0x17'));var utils=require(_0xee4d('0x18'));var config=require(_0xee4d('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xee4d('0x1a'))['db'];function respondWithStatusCode(_0xde470e,_0x3d693e){_0x3d693e=_0x3d693e||0xcc;return function(_0xe84349){if(_0xe84349){return _0xde470e[_0xee4d('0x1b')](_0x3d693e);}return _0xde470e[_0xee4d('0x1c')](_0x3d693e)[_0xee4d('0x1d')]();};}function respondWithResult(_0x16f5e7,_0xe0feb7){_0xe0feb7=_0xe0feb7||0xc8;return function(_0x36241f){if(_0x36241f){return _0x16f5e7[_0xee4d('0x1c')](_0xe0feb7)[_0xee4d('0x1e')](_0x36241f);}};}function respondWithFilteredResult(_0x35778b,_0x9c9dd4){return function(_0x2b4a6c){if(_0x2b4a6c){var _0x2b683d=typeof _0x9c9dd4['offset']===_0xee4d('0x1f')&&typeof _0x9c9dd4[_0xee4d('0x20')]===_0xee4d('0x1f');var _0x64c4a3=_0x2b4a6c[_0xee4d('0x21')];var _0x27be03=_0x2b683d?0x0:_0x9c9dd4[_0xee4d('0x22')];var _0x509e67=_0x2b683d?_0x2b4a6c[_0xee4d('0x21')]:_0x9c9dd4['offset']+_0x9c9dd4['limit'];var _0xdd98f2;if(_0x509e67>=_0x64c4a3){_0x509e67=_0x64c4a3;_0xdd98f2=0xc8;}else{_0xdd98f2=0xce;}_0x35778b[_0xee4d('0x1c')](_0xdd98f2);return _0x35778b[_0xee4d('0x23')](_0xee4d('0x24'),_0x27be03+'-'+_0x509e67+'/'+_0x64c4a3)[_0xee4d('0x1e')](_0x2b4a6c);}return null;};}function patchUpdates(_0x2a8f6d){return function(_0x5313cd){try{jsonpatch[_0xee4d('0x25')](_0x5313cd,_0x2a8f6d,!![]);}catch(_0x2b6439){return BPromise[_0xee4d('0x26')](_0x2b6439);}return _0x5313cd['save']();};}function saveUpdates(_0x3f1a56,_0x1a8414){return function(_0xa41a13){if(_0xa41a13){return _0xa41a13[_0xee4d('0x27')](_0x3f1a56)[_0xee4d('0x28')](function(_0x4d7093){return _0x4d7093;});}return null;};}function removeEntity(_0x2dc967,_0x46b4c9){return function(_0x457edd){if(_0x457edd){return _0x457edd[_0xee4d('0x29')]()[_0xee4d('0x28')](function(){_0x2dc967['status'](0xcc)[_0xee4d('0x1d')]();});}};}function handleEntityNotFound(_0xddf718,_0x858482){return function(_0x36a973){if(!_0x36a973){_0xddf718[_0xee4d('0x1b')](0x194);}return _0x36a973;};}function handleError(_0x204b49,_0x14954a){_0x14954a=_0x14954a||0x1f4;return function(_0x4ebe6b){logger[_0xee4d('0x2a')](_0x4ebe6b['stack']);if(_0x4ebe6b[_0xee4d('0x2b')]){delete _0x4ebe6b[_0xee4d('0x2b')];}_0x204b49[_0xee4d('0x1c')](_0x14954a)[_0xee4d('0x2c')](_0x4ebe6b);};}exports[_0xee4d('0x2d')]=function(_0x2dd321,_0x578e68){var _0xbfef57={},_0xede050={},_0x1432e8={'count':0x0,'rows':[]};var _0x18753c=_[_0xee4d('0x2e')](db[_0xee4d('0x2f')][_0xee4d('0x30')],function(_0x30de70){return{'name':_0x30de70['fieldName'],'type':_0x30de70[_0xee4d('0x31')][_0xee4d('0x32')]};});_0xede050[_0xee4d('0x33')]=_['map'](_0x18753c,_0xee4d('0x2b'));_0xede050[_0xee4d('0x34')]=_[_0xee4d('0x35')](_0x2dd321[_0xee4d('0x34')]);_0xede050[_0xee4d('0x36')]=_['intersection'](_0xede050[_0xee4d('0x33')],_0xede050[_0xee4d('0x34')]);_0xbfef57[_0xee4d('0x37')]=_[_0xee4d('0x38')](_0xede050[_0xee4d('0x33')],qs[_0xee4d('0x39')](_0x2dd321[_0xee4d('0x34')][_0xee4d('0x39')]));_0xbfef57[_0xee4d('0x37')]=_0xbfef57[_0xee4d('0x37')]['length']?_0xbfef57['attributes']:_0xede050[_0xee4d('0x33')];if(!_0x2dd321[_0xee4d('0x34')][_0xee4d('0x3a')](_0xee4d('0x3b'))){_0xbfef57[_0xee4d('0x20')]=qs['limit'](_0x2dd321[_0xee4d('0x34')][_0xee4d('0x20')]);_0xbfef57[_0xee4d('0x22')]=qs[_0xee4d('0x22')](_0x2dd321[_0xee4d('0x34')]['offset']);}_0xbfef57[_0xee4d('0x3c')]=qs[_0xee4d('0x3d')](_0x2dd321[_0xee4d('0x34')][_0xee4d('0x3d')]);_0xbfef57['where']=qs[_0xee4d('0x36')](_['pick'](_0x2dd321[_0xee4d('0x34')],_0xede050[_0xee4d('0x36')]),_0x18753c);if(_0x2dd321[_0xee4d('0x34')][_0xee4d('0x3e')]){_0xbfef57[_0xee4d('0x3f')]=_[_0xee4d('0x40')](_0xbfef57['where'],{'$or':_[_0xee4d('0x2e')](_0x18753c,function(_0x461a2f){if(_0x461a2f[_0xee4d('0x31')]!==_0xee4d('0x41')){var _0x97e6fd={};_0x97e6fd[_0x461a2f[_0xee4d('0x2b')]]={'$like':'%'+_0x2dd321[_0xee4d('0x34')][_0xee4d('0x3e')]+'%'};return _0x97e6fd;}})});}_0xbfef57=_['merge']({},_0xbfef57,_0x2dd321[_0xee4d('0x42')]);var _0x4f65f9={'where':_0xbfef57[_0xee4d('0x3f')]};return db[_0xee4d('0x2f')][_0xee4d('0x21')](_0x4f65f9)[_0xee4d('0x28')](function(_0x261352){_0x1432e8[_0xee4d('0x21')]=_0x261352;if(_0x2dd321['query'][_0xee4d('0x43')]){_0xbfef57[_0xee4d('0x44')]=[{'all':!![]}];}return db[_0xee4d('0x2f')][_0xee4d('0x45')](_0xbfef57);})['then'](function(_0x1da035){_0x1432e8[_0xee4d('0x46')]=_0x1da035;return _0x1432e8;})[_0xee4d('0x28')](respondWithFilteredResult(_0x578e68,_0xbfef57))[_0xee4d('0x47')](handleError(_0x578e68,null));};exports[_0xee4d('0x48')]=function(_0x2a0cff,_0x5a504f){var _0x3be6c4={'raw':!![],'where':{'id':_0x2a0cff['params']['id']}},_0xe85add={};_0xe85add[_0xee4d('0x33')]=_[_0xee4d('0x35')](db['Dynamics365Field'][_0xee4d('0x30')]);_0xe85add[_0xee4d('0x34')]=_[_0xee4d('0x35')](_0x2a0cff[_0xee4d('0x34')]);_0xe85add['filters']=_[_0xee4d('0x38')](_0xe85add[_0xee4d('0x33')],_0xe85add[_0xee4d('0x34')]);_0x3be6c4[_0xee4d('0x37')]=_['intersection'](_0xe85add[_0xee4d('0x33')],qs[_0xee4d('0x39')](_0x2a0cff[_0xee4d('0x34')]['fields']));_0x3be6c4[_0xee4d('0x37')]=_0x3be6c4[_0xee4d('0x37')][_0xee4d('0x49')]?_0x3be6c4[_0xee4d('0x37')]:_0xe85add[_0xee4d('0x33')];if(_0x2a0cff[_0xee4d('0x34')][_0xee4d('0x43')]){_0x3be6c4[_0xee4d('0x44')]=[{'all':!![]}];}_0x3be6c4=_[_0xee4d('0x40')]({},_0x3be6c4,_0x2a0cff[_0xee4d('0x42')]);return db['Dynamics365Field']['find'](_0x3be6c4)[_0xee4d('0x28')](handleEntityNotFound(_0x5a504f,null))['then'](respondWithResult(_0x5a504f,null))[_0xee4d('0x47')](handleError(_0x5a504f,null));};exports[_0xee4d('0x4a')]=function(_0xb72e07,_0x1dfd72){return db[_0xee4d('0x2f')][_0xee4d('0x4a')](_0xb72e07[_0xee4d('0x4b')],{})[_0xee4d('0x28')](respondWithResult(_0x1dfd72,0xc9))[_0xee4d('0x47')](handleError(_0x1dfd72,null));};exports[_0xee4d('0x27')]=function(_0x40acac,_0x4f2efe){if(_0x40acac['body']['id']){delete _0x40acac['body']['id'];}return db['Dynamics365Field'][_0xee4d('0x4c')]({'where':{'id':_0x40acac[_0xee4d('0x4d')]['id']}})[_0xee4d('0x28')](handleEntityNotFound(_0x4f2efe,null))[_0xee4d('0x28')](saveUpdates(_0x40acac[_0xee4d('0x4b')],null))[_0xee4d('0x28')](respondWithResult(_0x4f2efe,null))['catch'](handleError(_0x4f2efe,null));};exports[_0xee4d('0x29')]=function(_0x1228bd,_0x582ccc){return db['Dynamics365Field'][_0xee4d('0x4c')]({'where':{'id':_0x1228bd[_0xee4d('0x4d')]['id']}})[_0xee4d('0x28')](handleEntityNotFound(_0x582ccc,null))['then'](removeEntity(_0x582ccc,null))[_0xee4d('0x47')](handleError(_0x582ccc,null));}; \ No newline at end of file +var _0x5c2b=['moment','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','Dynamics365Field','rawAttributes','fieldName','type','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','options','include','findAll','catch','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x450477,_0x369cc4){var _0x14658f=function(_0x164571){while(--_0x164571){_0x450477['push'](_0x450477['shift']());}};_0x14658f(++_0x369cc4);}(_0x5c2b,0x1ab));var _0xb5c2=function(_0x42b085,_0x3efc96){_0x42b085=_0x42b085-0x0;var _0xe96778=_0x5c2b[_0x42b085];return _0xe96778;};'use strict';var emlformat=require(_0xb5c2('0x0'));var rimraf=require(_0xb5c2('0x1'));var zipdir=require(_0xb5c2('0x2'));var jsonpatch=require(_0xb5c2('0x3'));var rp=require(_0xb5c2('0x4'));var moment=require(_0xb5c2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb5c2('0x6'));var util=require(_0xb5c2('0x7'));var path=require(_0xb5c2('0x8'));var sox=require(_0xb5c2('0x9'));var csv=require(_0xb5c2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb5c2('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb5c2('0xc'));var jsforce=require(_0xb5c2('0xd'));var deskjs=require(_0xb5c2('0xe'));var toCsv=require(_0xb5c2('0xa'));var querystring=require(_0xb5c2('0xf'));var Papa=require(_0xb5c2('0x10'));var Redis=require(_0xb5c2('0x11'));var authService=require(_0xb5c2('0x12'));var qs=require(_0xb5c2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb5c2('0x14'));var logger=require(_0xb5c2('0x15'))('api');var utils=require(_0xb5c2('0x16'));var config=require(_0xb5c2('0x17'));var licenseUtil=require(_0xb5c2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55253d,_0x3043f9){_0x3043f9=_0x3043f9||0xcc;return function(_0xfc3d6a){if(_0xfc3d6a){return _0x55253d[_0xb5c2('0x19')](_0x3043f9);}return _0x55253d[_0xb5c2('0x1a')](_0x3043f9)[_0xb5c2('0x1b')]();};}function respondWithResult(_0x2a33c6,_0x35cd20){_0x35cd20=_0x35cd20||0xc8;return function(_0xf529fa){if(_0xf529fa){return _0x2a33c6[_0xb5c2('0x1a')](_0x35cd20)[_0xb5c2('0x1c')](_0xf529fa);}};}function respondWithFilteredResult(_0x1b6d80,_0x540c55){return function(_0x2bce9b){if(_0x2bce9b){var _0x119b71=typeof _0x540c55['offset']===_0xb5c2('0x1d')&&typeof _0x540c55['limit']===_0xb5c2('0x1d');var _0x129dbc=_0x2bce9b[_0xb5c2('0x1e')];var _0xcb38b=_0x119b71?0x0:_0x540c55[_0xb5c2('0x1f')];var _0x23d43b=_0x119b71?_0x2bce9b['count']:_0x540c55[_0xb5c2('0x1f')]+_0x540c55[_0xb5c2('0x20')];var _0x36467c;if(_0x23d43b>=_0x129dbc){_0x23d43b=_0x129dbc;_0x36467c=0xc8;}else{_0x36467c=0xce;}_0x1b6d80[_0xb5c2('0x1a')](_0x36467c);return _0x1b6d80[_0xb5c2('0x21')](_0xb5c2('0x22'),_0xcb38b+'-'+_0x23d43b+'/'+_0x129dbc)[_0xb5c2('0x1c')](_0x2bce9b);}return null;};}function patchUpdates(_0x3d1dc4){return function(_0x56ab4d){try{jsonpatch['apply'](_0x56ab4d,_0x3d1dc4,!![]);}catch(_0x5e7dd1){return BPromise[_0xb5c2('0x23')](_0x5e7dd1);}return _0x56ab4d[_0xb5c2('0x24')]();};}function saveUpdates(_0x181350,_0x303ae4){return function(_0x77b570){if(_0x77b570){return _0x77b570[_0xb5c2('0x25')](_0x181350)[_0xb5c2('0x26')](function(_0x1e8511){return _0x1e8511;});}return null;};}function removeEntity(_0x2e7770,_0x28b894){return function(_0x304e59){if(_0x304e59){return _0x304e59[_0xb5c2('0x27')]()['then'](function(){_0x2e7770[_0xb5c2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x534979,_0x3521df){return function(_0x535e65){if(!_0x535e65){_0x534979[_0xb5c2('0x19')](0x194);}return _0x535e65;};}function handleError(_0x577c12,_0x4d9fc9){_0x4d9fc9=_0x4d9fc9||0x1f4;return function(_0x551a6f){logger[_0xb5c2('0x28')](_0x551a6f[_0xb5c2('0x29')]);if(_0x551a6f[_0xb5c2('0x2a')]){delete _0x551a6f[_0xb5c2('0x2a')];}_0x577c12[_0xb5c2('0x1a')](_0x4d9fc9)['send'](_0x551a6f);};}exports[_0xb5c2('0x2b')]=function(_0x4bda0e,_0x27d762){var _0x2fc0fa={},_0x7b9043={},_0x34e1e5={'count':0x0,'rows':[]};var _0x1fe95a=_[_0xb5c2('0x2c')](db[_0xb5c2('0x2d')][_0xb5c2('0x2e')],function(_0x566e2a){return{'name':_0x566e2a[_0xb5c2('0x2f')],'type':_0x566e2a[_0xb5c2('0x30')]['key']};});_0x7b9043['model']=_['map'](_0x1fe95a,_0xb5c2('0x2a'));_0x7b9043['query']=_[_0xb5c2('0x31')](_0x4bda0e[_0xb5c2('0x32')]);_0x7b9043['filters']=_[_0xb5c2('0x33')](_0x7b9043[_0xb5c2('0x34')],_0x7b9043[_0xb5c2('0x32')]);_0x2fc0fa[_0xb5c2('0x35')]=_[_0xb5c2('0x33')](_0x7b9043[_0xb5c2('0x34')],qs[_0xb5c2('0x36')](_0x4bda0e[_0xb5c2('0x32')][_0xb5c2('0x36')]));_0x2fc0fa[_0xb5c2('0x35')]=_0x2fc0fa[_0xb5c2('0x35')][_0xb5c2('0x37')]?_0x2fc0fa[_0xb5c2('0x35')]:_0x7b9043[_0xb5c2('0x34')];if(!_0x4bda0e[_0xb5c2('0x32')][_0xb5c2('0x38')](_0xb5c2('0x39'))){_0x2fc0fa[_0xb5c2('0x20')]=qs[_0xb5c2('0x20')](_0x4bda0e['query'][_0xb5c2('0x20')]);_0x2fc0fa['offset']=qs['offset'](_0x4bda0e['query'][_0xb5c2('0x1f')]);}_0x2fc0fa['order']=qs['sort'](_0x4bda0e[_0xb5c2('0x32')][_0xb5c2('0x3a')]);_0x2fc0fa[_0xb5c2('0x3b')]=qs['filters'](_['pick'](_0x4bda0e['query'],_0x7b9043[_0xb5c2('0x3c')]),_0x1fe95a);if(_0x4bda0e[_0xb5c2('0x32')]['filter']){_0x2fc0fa[_0xb5c2('0x3b')]=_[_0xb5c2('0x3d')](_0x2fc0fa[_0xb5c2('0x3b')],{'$or':_[_0xb5c2('0x2c')](_0x1fe95a,function(_0x3ba6c5){if(_0x3ba6c5[_0xb5c2('0x30')]!==_0xb5c2('0x3e')){var _0x1cb269={};_0x1cb269[_0x3ba6c5[_0xb5c2('0x2a')]]={'$like':'%'+_0x4bda0e[_0xb5c2('0x32')]['filter']+'%'};return _0x1cb269;}})});}_0x2fc0fa=_['merge']({},_0x2fc0fa,_0x4bda0e[_0xb5c2('0x3f')]);var _0x521b34={'where':_0x2fc0fa['where']};return db[_0xb5c2('0x2d')][_0xb5c2('0x1e')](_0x521b34)[_0xb5c2('0x26')](function(_0x33b1ad){_0x34e1e5[_0xb5c2('0x1e')]=_0x33b1ad;if(_0x4bda0e[_0xb5c2('0x32')]['includeAll']){_0x2fc0fa[_0xb5c2('0x40')]=[{'all':!![]}];}return db[_0xb5c2('0x2d')][_0xb5c2('0x41')](_0x2fc0fa);})[_0xb5c2('0x26')](function(_0x5d26b3){_0x34e1e5['rows']=_0x5d26b3;return _0x34e1e5;})['then'](respondWithFilteredResult(_0x27d762,_0x2fc0fa))[_0xb5c2('0x42')](handleError(_0x27d762,null));};exports['show']=function(_0xdc471c,_0x2eb0a6){var _0x574143={'raw':!![],'where':{'id':_0xdc471c[_0xb5c2('0x43')]['id']}},_0x3584ae={};_0x3584ae[_0xb5c2('0x34')]=_[_0xb5c2('0x31')](db[_0xb5c2('0x2d')]['rawAttributes']);_0x3584ae[_0xb5c2('0x32')]=_[_0xb5c2('0x31')](_0xdc471c[_0xb5c2('0x32')]);_0x3584ae['filters']=_['intersection'](_0x3584ae[_0xb5c2('0x34')],_0x3584ae[_0xb5c2('0x32')]);_0x574143[_0xb5c2('0x35')]=_[_0xb5c2('0x33')](_0x3584ae[_0xb5c2('0x34')],qs['fields'](_0xdc471c[_0xb5c2('0x32')][_0xb5c2('0x36')]));_0x574143[_0xb5c2('0x35')]=_0x574143['attributes'][_0xb5c2('0x37')]?_0x574143['attributes']:_0x3584ae['model'];if(_0xdc471c[_0xb5c2('0x32')][_0xb5c2('0x44')]){_0x574143[_0xb5c2('0x40')]=[{'all':!![]}];}_0x574143=_[_0xb5c2('0x3d')]({},_0x574143,_0xdc471c[_0xb5c2('0x3f')]);return db[_0xb5c2('0x2d')][_0xb5c2('0x45')](_0x574143)[_0xb5c2('0x26')](handleEntityNotFound(_0x2eb0a6,null))['then'](respondWithResult(_0x2eb0a6,null))[_0xb5c2('0x42')](handleError(_0x2eb0a6,null));};exports[_0xb5c2('0x46')]=function(_0x24e4c7,_0x4f18b1){return db['Dynamics365Field']['create'](_0x24e4c7[_0xb5c2('0x47')],{})[_0xb5c2('0x26')](respondWithResult(_0x4f18b1,0xc9))['catch'](handleError(_0x4f18b1,null));};exports['update']=function(_0x54bf20,_0x382c82){if(_0x54bf20[_0xb5c2('0x47')]['id']){delete _0x54bf20[_0xb5c2('0x47')]['id'];}return db[_0xb5c2('0x2d')][_0xb5c2('0x45')]({'where':{'id':_0x54bf20[_0xb5c2('0x43')]['id']}})[_0xb5c2('0x26')](handleEntityNotFound(_0x382c82,null))[_0xb5c2('0x26')](saveUpdates(_0x54bf20[_0xb5c2('0x47')],null))['then'](respondWithResult(_0x382c82,null))[_0xb5c2('0x42')](handleError(_0x382c82,null));};exports['destroy']=function(_0x5d930c,_0x55b076){return db[_0xb5c2('0x2d')][_0xb5c2('0x45')]({'where':{'id':_0x5d930c['params']['id']}})[_0xb5c2('0x26')](handleEntityNotFound(_0x55b076,null))[_0xb5c2('0x26')](removeEntity(_0x55b076,null))[_0xb5c2('0x42')](handleError(_0x55b076,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index a1014ed..ce650d0 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 _0x31db=['moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','lodash','api'];(function(_0x4dd604,_0x7e9bfc){var _0x24beb0=function(_0x45f1ce){while(--_0x45f1ce){_0x4dd604['push'](_0x4dd604['shift']());}};_0x24beb0(++_0x7e9bfc);}(_0x31db,0x14e));var _0xb31d=function(_0x13137e,_0x29c0f3){_0x13137e=_0x13137e-0x0;var _0x346261=_0x31db[_0x13137e];return _0x346261;};'use strict';var _=require(_0xb31d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb31d('0x1'));var moment=require(_0xb31d('0x2'));var BPromise=require(_0xb31d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb31d('0x4'));var rimraf=require(_0xb31d('0x5'));var config=require(_0xb31d('0x6'));var attributes=require(_0xb31d('0x7'));module[_0xb31d('0x8')]=function(_0x321db4,_0x466d9b){return _0x321db4[_0xb31d('0x9')](_0xb31d('0xa'),attributes,{'tableName':_0xb31d('0xb'),'paranoid':![],'indexes':[{'name':_0xb31d('0xc'),'fields':[_0xb31d('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf4a2=['bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','Dynamics365Field','dynamics365_unique_index','FieldId','../../config/logger','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4a2,0x13d));var _0x2f4a=function(_0x285800,_0x26765e){_0x285800=_0x285800-0x0;var _0x4b809e=_0xf4a2[_0x285800];return _0x4b809e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2f4a('0x0'))('api');var moment=require(_0x2f4a('0x1'));var BPromise=require(_0x2f4a('0x2'));var rp=require(_0x2f4a('0x3'));var fs=require('fs');var path=require(_0x2f4a('0x4'));var rimraf=require(_0x2f4a('0x5'));var config=require(_0x2f4a('0x6'));var attributes=require(_0x2f4a('0x7'));module['exports']=function(_0x2f0c82,_0x11c683){return _0x2f0c82['define'](_0x2f4a('0x8'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x2f4a('0x9'),'fields':['idField',_0x2f4a('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index ed9a7e0..059248f 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 _0xc33f=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x57b809,_0x331623){var _0xf57b31=function(_0x12a4ed){while(--_0x12a4ed){_0x57b809['push'](_0x57b809['shift']());}};_0xf57b31(++_0x331623);}(_0xc33f,0x17f));var _0xfc33=function(_0xb1b7b,_0x13eaa0){_0xb1b7b=_0xb1b7b-0x0;var _0x339c3b=_0xc33f[_0xb1b7b];return _0x339c3b;};'use strict';var _=require(_0xfc33('0x0'));var util=require(_0xfc33('0x1'));var moment=require(_0xfc33('0x2'));var BPromise=require(_0xfc33('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc33('0x4'));var db=require(_0xfc33('0x5'))['db'];var utils=require(_0xfc33('0x6'));var logger=require(_0xfc33('0x7'))('rpc');var config=require(_0xfc33('0x8'));var jayson=require(_0xfc33('0x9'));var client=jayson['client'][_0xfc33('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12a91f,_0x2d9611,_0xe27cd8){return new BPromise(function(_0x5dd336,_0x44da4c){return client[_0xfc33('0xb')](_0x12a91f,_0xe27cd8)[_0xfc33('0xc')](function(_0x3beb15){logger[_0xfc33('0xd')](_0xfc33('0xe'),_0x2d9611,_0xfc33('0xf'));logger[_0xfc33('0x10')](_0xfc33('0x11'),_0x2d9611,_0xfc33('0xf'),JSON[_0xfc33('0x12')](_0x3beb15));if(_0x3beb15[_0xfc33('0x13')]){if(_0x3beb15['error'][_0xfc33('0x14')]===0x1f4){logger[_0xfc33('0x13')](_0xfc33('0xe'),_0x2d9611,_0x3beb15[_0xfc33('0x13')][_0xfc33('0x15')]);return _0x44da4c(_0x3beb15[_0xfc33('0x13')][_0xfc33('0x15')]);}logger[_0xfc33('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x2d9611,_0x3beb15[_0xfc33('0x13')][_0xfc33('0x15')]);return _0x5dd336(_0x3beb15[_0xfc33('0x13')][_0xfc33('0x15')]);}else{logger['info'](_0xfc33('0xe'),_0x2d9611,_0xfc33('0xf'));_0x5dd336(_0x3beb15[_0xfc33('0x16')][_0xfc33('0x15')]);}})[_0xfc33('0x17')](function(_0x29473b){logger[_0xfc33('0x13')](_0xfc33('0xe'),_0x2d9611,_0x29473b);_0x44da4c(_0x29473b);});});} \ No newline at end of file +var _0xbabb=['code','Dynamics365Field,\x20%s,\x20%s','message','info','result','lodash','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x272bb7,_0x455fb9){var _0x13bfaf=function(_0x8c7985){while(--_0x8c7985){_0x272bb7['push'](_0x272bb7['shift']());}};_0x13bfaf(++_0x455fb9);}(_0xbabb,0x1d3));var _0xbbab=function(_0x1932a1,_0x236a16){_0x1932a1=_0x1932a1-0x0;var _0x8643a7=_0xbabb[_0x1932a1];return _0x8643a7;};'use strict';var _=require(_0xbbab('0x0'));var util=require(_0xbbab('0x1'));var moment=require(_0xbbab('0x2'));var BPromise=require('bluebird');var rs=require(_0xbbab('0x3'));var fs=require('fs');var Redis=require(_0xbbab('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbbab('0x5'))('rpc');var config=require(_0xbbab('0x6'));var jayson=require(_0xbbab('0x7'));var client=jayson[_0xbbab('0x8')][_0xbbab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b4547,_0x4f30b0,_0x3001b4){return new BPromise(function(_0x189298,_0xd3eb92){return client[_0xbbab('0xa')](_0x2b4547,_0x3001b4)[_0xbbab('0xb')](function(_0x4cd774){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x4f30b0,_0xbbab('0xc'));logger[_0xbbab('0xd')](_0xbbab('0xe'),_0x4f30b0,_0xbbab('0xc'),JSON[_0xbbab('0xf')](_0x4cd774));if(_0x4cd774[_0xbbab('0x10')]){if(_0x4cd774[_0xbbab('0x10')][_0xbbab('0x11')]===0x1f4){logger[_0xbbab('0x10')](_0xbbab('0x12'),_0x4f30b0,_0x4cd774[_0xbbab('0x10')][_0xbbab('0x13')]);return _0xd3eb92(_0x4cd774[_0xbbab('0x10')][_0xbbab('0x13')]);}logger[_0xbbab('0x10')](_0xbbab('0x12'),_0x4f30b0,_0x4cd774[_0xbbab('0x10')][_0xbbab('0x13')]);return _0x189298(_0x4cd774[_0xbbab('0x10')][_0xbbab('0x13')]);}else{logger[_0xbbab('0x14')](_0xbbab('0x12'),_0x4f30b0,'request\x20sent');_0x189298(_0x4cd774[_0xbbab('0x15')]['message']);}})['catch'](function(_0x4ca16f){logger[_0xbbab('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x4f30b0,_0x4ca16f);_0xd3eb92(_0x4ca16f);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 1395e43..84e8c97 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 _0x5e9f=['destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete'];(function(_0x28bc89,_0x1edcd4){var _0x31aaa2=function(_0x3182a8){while(--_0x3182a8){_0x28bc89['push'](_0x28bc89['shift']());}};_0x31aaa2(++_0x1edcd4);}(_0x5e9f,0x182));var _0xf5e9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5e9f[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xf5e9('0x0'));var util=require('util');var path=require(_0xf5e9('0x1'));var timeout=require(_0xf5e9('0x2'));var express=require('express');var router=express[_0xf5e9('0x3')]();var fs_extra=require(_0xf5e9('0x4'));var auth=require(_0xf5e9('0x5'));var interaction=require(_0xf5e9('0x6'));var config=require('../../config/environment');var controller=require(_0xf5e9('0x7'));router[_0xf5e9('0x8')]('/',auth['isAuthenticated'](),controller[_0xf5e9('0x9')]);router[_0xf5e9('0x8')](_0xf5e9('0xa'),auth[_0xf5e9('0xb')](),controller[_0xf5e9('0xc')]);router['get'](_0xf5e9('0xd'),auth['isAuthenticated'](),controller[_0xf5e9('0xe')]);router[_0xf5e9('0x8')](_0xf5e9('0xf'),auth[_0xf5e9('0xb')](),controller['getFields']);router[_0xf5e9('0x10')]('/',auth[_0xf5e9('0xb')](),controller[_0xf5e9('0x11')]);router['post']('/:id/configurations',auth[_0xf5e9('0xb')](),controller[_0xf5e9('0x12')]);router[_0xf5e9('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xf5e9('0x14')]);router[_0xf5e9('0x15')](_0xf5e9('0xa'),auth[_0xf5e9('0xb')](),controller[_0xf5e9('0x16')]);module[_0xf5e9('0x17')]=router; \ No newline at end of file +var _0x8fe8=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration','put','/:id','update','destroy','exports','util'];(function(_0x1331be,_0x4f68bc){var _0x94e8b5=function(_0x15df98){while(--_0x15df98){_0x1331be['push'](_0x1331be['shift']());}};_0x94e8b5(++_0x4f68bc);}(_0x8fe8,0x175));var _0x88fe=function(_0x1f7d8b,_0x5e91c4){_0x1f7d8b=_0x1f7d8b-0x0;var _0x28f35c=_0x8fe8[_0x1f7d8b];return _0x28f35c;};'use strict';var multer=require('multer');var util=require(_0x88fe('0x0'));var path=require(_0x88fe('0x1'));var timeout=require(_0x88fe('0x2'));var express=require(_0x88fe('0x3'));var router=express[_0x88fe('0x4')]();var fs_extra=require(_0x88fe('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x88fe('0x6'));var config=require(_0x88fe('0x7'));var controller=require(_0x88fe('0x8'));router[_0x88fe('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x88fe('0xa')](),controller['show']);router[_0x88fe('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x88fe('0xb')]);router[_0x88fe('0x9')](_0x88fe('0xc'),auth[_0x88fe('0xa')](),controller['getFields']);router[_0x88fe('0xd')]('/',auth[_0x88fe('0xa')](),controller[_0x88fe('0xe')]);router[_0x88fe('0xd')](_0x88fe('0xf'),auth[_0x88fe('0xa')](),controller[_0x88fe('0x10')]);router[_0x88fe('0x11')](_0x88fe('0x12'),auth['isAuthenticated'](),controller[_0x88fe('0x13')]);router['delete'](_0x88fe('0x12'),auth['isAuthenticated'](),controller[_0x88fe('0x14')]);module[_0x88fe('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 e300f9a..ac8a854 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 _0x1967=['STRING','username','remoteUri','exports'];(function(_0x134764,_0x112da5){var _0x2fe527=function(_0x7db51d){while(--_0x7db51d){_0x134764['push'](_0x134764['shift']());}};_0x2fe527(++_0x112da5);}(_0x1967,0x173));var _0x7196=function(_0x586983,_0x3619c2){_0x586983=_0x586983-0x0;var _0x1bdbeb=_0x1967[_0x586983];return _0x1bdbeb;};'use strict';var Sequelize=require('sequelize');module[_0x7196('0x0')]={'name':{'type':Sequelize[_0x7196('0x1')]},'description':{'type':Sequelize[_0x7196('0x1')]},'username':{'type':Sequelize[_0x7196('0x1')],'unique':_0x7196('0x2')},'apiKey':{'type':Sequelize[_0x7196('0x1')]},'remoteUri':{'type':Sequelize[_0x7196('0x1')],'unique':_0x7196('0x3')},'serverUrl':{'type':Sequelize[_0x7196('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x66fa=['exports','STRING','username','remoteUri','sequelize'];(function(_0x11401f,_0x20ff36){var _0x4010f7=function(_0x196dd5){while(--_0x196dd5){_0x11401f['push'](_0x11401f['shift']());}};_0x4010f7(++_0x20ff36);}(_0x66fa,0x117));var _0xa66f=function(_0x120c96,_0x3434b9){_0x120c96=_0x120c96-0x0;var _0x173922=_0x66fa[_0x120c96];return _0x173922;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa66f('0x2')]},'username':{'type':Sequelize[_0xa66f('0x2')],'unique':_0xa66f('0x3')},'apiKey':{'type':Sequelize[_0xa66f('0x2')]},'remoteUri':{'type':Sequelize[_0xa66f('0x2')],'unique':_0xa66f('0x4')},'serverUrl':{'type':Sequelize[_0xa66f('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 f40faec..ffd0833 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 _0xf972=['AccountId','Subjects','channel','type','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format','%s:X','toString','base64','requester','subject','agent','priority','group','ticket_type','company','remove','includes','default','custom_text','statusCode','stringify','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','offset','undefined','count','set','apply','reject','update','then','destroy','end','error','stack','send','index','FreshdeskAccount','fieldName','key','map','name','query','keys','filters','intersection','model','fields','attributes','length','limit','order','sort','pick','filter','merge','where','options','includeAll','include','rows','catch','params','rawAttributes','find','body','getConfigurations','findOne','hasOwnProperty','nolimit','addConfiguration'];(function(_0x1034c3,_0x284c82){var _0x57140b=function(_0x4668ab){while(--_0x4668ab){_0x1034c3['push'](_0x1034c3['shift']());}};_0x57140b(++_0x284c82);}(_0xf972,0x171));var _0x2f97=function(_0x38f586,_0x157a92){_0x38f586=_0x38f586-0x0;var _0x4b149e=_0xf972[_0x38f586];return _0x4b149e;};'use strict';var emlformat=require(_0x2f97('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2f97('0x1'));var jsonpatch=require(_0x2f97('0x2'));var rp=require(_0x2f97('0x3'));var moment=require('moment');var BPromise=require(_0x2f97('0x4'));var Mustache=require(_0x2f97('0x5'));var util=require('util');var path=require(_0x2f97('0x6'));var sox=require(_0x2f97('0x7'));var csv=require(_0x2f97('0x8'));var ejs=require(_0x2f97('0x9'));var fs=require('fs');var fs_extra=require(_0x2f97('0xa'));var _=require(_0x2f97('0xb'));var squel=require(_0x2f97('0xc'));var crypto=require(_0x2f97('0xd'));var jsforce=require(_0x2f97('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2f97('0xf'));var Papa=require(_0x2f97('0x10'));var Redis=require(_0x2f97('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2f97('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f97('0x13'))(_0x2f97('0x14'));var utils=require(_0x2f97('0x15'));var config=require(_0x2f97('0x16'));var licenseUtil=require(_0x2f97('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2f97('0x18'));function respondWithStatusCode(_0x2c3c6b,_0x417c8f){_0x417c8f=_0x417c8f||0xcc;return function(_0x277cf1){if(_0x277cf1){return _0x2c3c6b[_0x2f97('0x19')](_0x417c8f);}return _0x2c3c6b[_0x2f97('0x1a')](_0x417c8f)['end']();};}function respondWithResult(_0x5559b8,_0x317314){_0x317314=_0x317314||0xc8;return function(_0x37c2ed){if(_0x37c2ed){return _0x5559b8[_0x2f97('0x1a')](_0x317314)['json'](_0x37c2ed);}};}function respondWithFilteredResult(_0x1de2b7,_0x17df46){return function(_0x2ffb8b){if(_0x2ffb8b){var _0x43bfd9=typeof _0x17df46[_0x2f97('0x1b')]===_0x2f97('0x1c')&&typeof _0x17df46['limit']===_0x2f97('0x1c');var _0x3dd773=_0x2ffb8b[_0x2f97('0x1d')];var _0x4f6bb1=_0x43bfd9?0x0:_0x17df46['offset'];var _0x52d36e=_0x43bfd9?_0x2ffb8b[_0x2f97('0x1d')]:_0x17df46[_0x2f97('0x1b')]+_0x17df46['limit'];var _0x1db3af;if(_0x52d36e>=_0x3dd773){_0x52d36e=_0x3dd773;_0x1db3af=0xc8;}else{_0x1db3af=0xce;}_0x1de2b7['status'](_0x1db3af);return _0x1de2b7[_0x2f97('0x1e')]('Content-Range',_0x4f6bb1+'-'+_0x52d36e+'/'+_0x3dd773)['json'](_0x2ffb8b);}return null;};}function patchUpdates(_0x29e4a4){return function(_0x1fe500){try{jsonpatch[_0x2f97('0x1f')](_0x1fe500,_0x29e4a4,!![]);}catch(_0x5aebf0){return BPromise[_0x2f97('0x20')](_0x5aebf0);}return _0x1fe500['save']();};}function saveUpdates(_0x39a332,_0x55cef3){return function(_0x239a92){if(_0x239a92){return _0x239a92[_0x2f97('0x21')](_0x39a332)[_0x2f97('0x22')](function(_0x58941a){return _0x58941a;});}return null;};}function removeEntity(_0x5ac20c,_0x10c1c1){return function(_0x20a1d1){if(_0x20a1d1){return _0x20a1d1[_0x2f97('0x23')]()[_0x2f97('0x22')](function(){_0x5ac20c[_0x2f97('0x1a')](0xcc)[_0x2f97('0x24')]();});}};}function handleEntityNotFound(_0x1bad85,_0x21d9d0){return function(_0x2fb36c){if(!_0x2fb36c){_0x1bad85[_0x2f97('0x19')](0x194);}return _0x2fb36c;};}function handleError(_0x1c08d5,_0x4a037d){_0x4a037d=_0x4a037d||0x1f4;return function(_0x3e098b){logger[_0x2f97('0x25')](_0x3e098b[_0x2f97('0x26')]);if(_0x3e098b['name']){delete _0x3e098b['name'];}_0x1c08d5['status'](_0x4a037d)[_0x2f97('0x27')](_0x3e098b);};}exports[_0x2f97('0x28')]=function(_0xa136bf,_0x56cb81){var _0x480e26={},_0x590161={},_0x592baf={'count':0x0,'rows':[]};var _0x21a306=_['map'](db[_0x2f97('0x29')]['rawAttributes'],function(_0x3f4ac8){return{'name':_0x3f4ac8[_0x2f97('0x2a')],'type':_0x3f4ac8['type'][_0x2f97('0x2b')]};});_0x590161['model']=_[_0x2f97('0x2c')](_0x21a306,_0x2f97('0x2d'));_0x590161[_0x2f97('0x2e')]=_[_0x2f97('0x2f')](_0xa136bf['query']);_0x590161[_0x2f97('0x30')]=_[_0x2f97('0x31')](_0x590161['model'],_0x590161[_0x2f97('0x2e')]);_0x480e26['attributes']=_['intersection'](_0x590161[_0x2f97('0x32')],qs[_0x2f97('0x33')](_0xa136bf[_0x2f97('0x2e')][_0x2f97('0x33')]));_0x480e26['attributes']=_0x480e26[_0x2f97('0x34')][_0x2f97('0x35')]?_0x480e26[_0x2f97('0x34')]:_0x590161[_0x2f97('0x32')];if(!_0xa136bf[_0x2f97('0x2e')]['hasOwnProperty']('nolimit')){_0x480e26[_0x2f97('0x36')]=qs[_0x2f97('0x36')](_0xa136bf[_0x2f97('0x2e')][_0x2f97('0x36')]);_0x480e26[_0x2f97('0x1b')]=qs[_0x2f97('0x1b')](_0xa136bf[_0x2f97('0x2e')][_0x2f97('0x1b')]);}_0x480e26[_0x2f97('0x37')]=qs['sort'](_0xa136bf[_0x2f97('0x2e')][_0x2f97('0x38')]);_0x480e26['where']=qs[_0x2f97('0x30')](_[_0x2f97('0x39')](_0xa136bf[_0x2f97('0x2e')],_0x590161[_0x2f97('0x30')]),_0x21a306);if(_0xa136bf[_0x2f97('0x2e')][_0x2f97('0x3a')]){_0x480e26['where']=_[_0x2f97('0x3b')](_0x480e26[_0x2f97('0x3c')],{'$or':_[_0x2f97('0x2c')](_0x21a306,function(_0x5f1e7e){if(_0x5f1e7e['type']!=='VIRTUAL'){var _0x1abad9={};_0x1abad9[_0x5f1e7e[_0x2f97('0x2d')]]={'$like':'%'+_0xa136bf['query'][_0x2f97('0x3a')]+'%'};return _0x1abad9;}})});}_0x480e26=_[_0x2f97('0x3b')]({},_0x480e26,_0xa136bf[_0x2f97('0x3d')]);var _0x59792c={'where':_0x480e26[_0x2f97('0x3c')]};return db[_0x2f97('0x29')][_0x2f97('0x1d')](_0x59792c)[_0x2f97('0x22')](function(_0x539018){_0x592baf['count']=_0x539018;if(_0xa136bf[_0x2f97('0x2e')][_0x2f97('0x3e')]){_0x480e26[_0x2f97('0x3f')]=[{'all':!![]}];}return db[_0x2f97('0x29')]['findAll'](_0x480e26);})[_0x2f97('0x22')](function(_0x1c828e){_0x592baf[_0x2f97('0x40')]=_0x1c828e;return _0x592baf;})['then'](respondWithFilteredResult(_0x56cb81,_0x480e26))[_0x2f97('0x41')](handleError(_0x56cb81,null));};exports['show']=function(_0x386963,_0x390ae2){var _0xae4436={'raw':![],'where':{'id':_0x386963[_0x2f97('0x42')]['id']}},_0x4dadad={};_0x4dadad[_0x2f97('0x32')]=_['keys'](db[_0x2f97('0x29')][_0x2f97('0x43')]);_0x4dadad[_0x2f97('0x2e')]=_[_0x2f97('0x2f')](_0x386963[_0x2f97('0x2e')]);_0x4dadad[_0x2f97('0x30')]=_['intersection'](_0x4dadad[_0x2f97('0x32')],_0x4dadad[_0x2f97('0x2e')]);_0xae4436['attributes']=_[_0x2f97('0x31')](_0x4dadad[_0x2f97('0x32')],qs[_0x2f97('0x33')](_0x386963[_0x2f97('0x2e')][_0x2f97('0x33')]));_0xae4436[_0x2f97('0x34')]=_0xae4436['attributes'][_0x2f97('0x35')]?_0xae4436['attributes']:_0x4dadad[_0x2f97('0x32')];if(_0x386963['query'][_0x2f97('0x3e')]){_0xae4436[_0x2f97('0x3f')]=[{'all':!![]}];}_0xae4436=_[_0x2f97('0x3b')]({},_0xae4436,_0x386963[_0x2f97('0x3d')]);return db['FreshdeskAccount'][_0x2f97('0x44')](_0xae4436)[_0x2f97('0x22')](handleEntityNotFound(_0x390ae2,null))['then'](respondWithResult(_0x390ae2,null))['catch'](handleError(_0x390ae2,null));};exports['create']=function(_0x4a1417,_0x22e616){return db[_0x2f97('0x29')]['create'](_0x4a1417['body'],{})['then'](respondWithResult(_0x22e616,0xc9))[_0x2f97('0x41')](handleError(_0x22e616,null));};exports[_0x2f97('0x21')]=function(_0x3f861c,_0x5637c1){if(_0x3f861c[_0x2f97('0x45')]['id']){delete _0x3f861c[_0x2f97('0x45')]['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x3f861c[_0x2f97('0x42')]['id']}})['then'](handleEntityNotFound(_0x5637c1,null))['then'](saveUpdates(_0x3f861c['body'],null))['then'](respondWithResult(_0x5637c1,null))[_0x2f97('0x41')](handleError(_0x5637c1,null));};exports[_0x2f97('0x23')]=function(_0x8b24b5,_0x4131af){return db[_0x2f97('0x29')]['find']({'where':{'id':_0x8b24b5['params']['id']}})['then'](handleEntityNotFound(_0x4131af,null))[_0x2f97('0x22')](removeEntity(_0x4131af,null))[_0x2f97('0x41')](handleError(_0x4131af,null));};exports[_0x2f97('0x46')]=function(_0x224bcd,_0x457ef3,_0x3db1b6){var _0x6daec5={};var _0x7d3c3c={};var _0x1806f2;var _0x54c2a4;return db[_0x2f97('0x29')][_0x2f97('0x47')]({'where':{'id':_0x224bcd[_0x2f97('0x42')]['id']}})[_0x2f97('0x22')](handleEntityNotFound(_0x457ef3,null))[_0x2f97('0x22')](function(_0xf4c50e){if(_0xf4c50e){_0x1806f2=_0xf4c50e;_0x7d3c3c[_0x2f97('0x32')]=_['keys'](db['FreshdeskConfiguration']['rawAttributes']);_0x7d3c3c[_0x2f97('0x2e')]=_[_0x2f97('0x2f')](_0x224bcd[_0x2f97('0x2e')]);_0x7d3c3c['filters']=_[_0x2f97('0x31')](_0x7d3c3c[_0x2f97('0x32')],_0x7d3c3c[_0x2f97('0x2e')]);_0x6daec5[_0x2f97('0x34')]=_[_0x2f97('0x31')](_0x7d3c3c[_0x2f97('0x32')],qs[_0x2f97('0x33')](_0x224bcd['query'][_0x2f97('0x33')]));_0x6daec5[_0x2f97('0x34')]=_0x6daec5[_0x2f97('0x34')][_0x2f97('0x35')]?_0x6daec5[_0x2f97('0x34')]:_0x7d3c3c[_0x2f97('0x32')];_0x6daec5[_0x2f97('0x37')]=qs[_0x2f97('0x38')](_0x224bcd['query']['sort']);_0x6daec5['where']=qs[_0x2f97('0x30')](_[_0x2f97('0x39')](_0x224bcd[_0x2f97('0x2e')],_0x7d3c3c[_0x2f97('0x30')]));if(_0x224bcd[_0x2f97('0x2e')][_0x2f97('0x3a')]){_0x6daec5[_0x2f97('0x3c')]=_[_0x2f97('0x3b')](_0x6daec5['where'],{'$or':_[_0x2f97('0x2c')](_0x6daec5['attributes'],function(_0x14e8ae){var _0xd6abdd={};_0xd6abdd[_0x14e8ae]={'$like':'%'+_0x224bcd['query']['filter']+'%'};return _0xd6abdd;})});}_0x6daec5=_[_0x2f97('0x3b')]({},_0x6daec5,_0x224bcd[_0x2f97('0x3d')]);return _0x1806f2[_0x2f97('0x46')](_0x6daec5);}})[_0x2f97('0x22')](function(_0x584617){if(_0x584617){_0x54c2a4=_0x584617[_0x2f97('0x35')];if(!_0x224bcd[_0x2f97('0x2e')][_0x2f97('0x48')](_0x2f97('0x49'))){_0x6daec5[_0x2f97('0x36')]=qs[_0x2f97('0x36')](_0x224bcd[_0x2f97('0x2e')][_0x2f97('0x36')]);_0x6daec5['offset']=qs[_0x2f97('0x1b')](_0x224bcd[_0x2f97('0x2e')]['offset']);}return _0x1806f2['getConfigurations'](_0x6daec5);}})['then'](function(_0x1d5fce){if(_0x1d5fce){return _0x1d5fce?{'count':_0x54c2a4,'rows':_0x1d5fce}:null;}})['then'](respondWithResult(_0x457ef3,null))['catch'](handleError(_0x457ef3,null));};exports[_0x2f97('0x4a')]=function(_0x460228,_0x95e156,_0x541481){if(_0x460228[_0x2f97('0x45')]['id']){delete _0x460228['body']['id'];}return db[_0x2f97('0x29')]['findOne']({'where':{'id':_0x460228[_0x2f97('0x42')]['id']}})[_0x2f97('0x22')](handleEntityNotFound(_0x95e156,null))[_0x2f97('0x22')](function(_0x3fe423){if(_0x3fe423){_0x460228['body'][_0x2f97('0x4b')]=_0x3fe423['id'];_0x460228['body'][_0x2f97('0x4c')]=integrations['getSubjects'](_0x460228['body'][_0x2f97('0x4d')],_0x460228[_0x2f97('0x45')][_0x2f97('0x4e')]);_0x460228[_0x2f97('0x45')][_0x2f97('0x4f')]=integrations[_0x2f97('0x50')](_0x460228['body'][_0x2f97('0x4d')],_0x460228['body'][_0x2f97('0x4e')]);return db[_0x2f97('0x51')]['create'](_0x460228['body'],{'include':[{'model':db[_0x2f97('0x52')],'as':_0x2f97('0x4c')},{'model':db[_0x2f97('0x52')],'as':_0x2f97('0x4f')}]});}return null;})[_0x2f97('0x22')](respondWithResult(_0x95e156,null))[_0x2f97('0x41')](handleError(_0x95e156,null));};exports[_0x2f97('0x53')]=function(_0x133009,_0x4bb3d2,_0x487ebe){var _0x5da7e5='';return db['FreshdeskAccount'][_0x2f97('0x47')]({'where':{'id':_0x133009['params']['id']},'attributes':['id',_0x2f97('0x54'),_0x2f97('0x55')]})['then'](handleEntityNotFound(_0x4bb3d2,null))[_0x2f97('0x22')](function(_0x2e29a3){if(_0x2e29a3){_0x5da7e5=_0x2e29a3[_0x2f97('0x54')];var _0x3a27a2=_0x5da7e5[_0x2f97('0x56')](-0x1);if(_0x3a27a2==='/'){_0x5da7e5=_0x5da7e5[_0x2f97('0x57')](0x0,_0x5da7e5[_0x2f97('0x58')](_0x3a27a2));}return rp({'method':_0x2f97('0x59'),'uri':util['format'](_0x2f97('0x5a'),_0x5da7e5,_0x2f97('0x5b')),'headers':{'Authorization':util[_0x2f97('0x5c')]('Basic\x20%s',new Buffer(util[_0x2f97('0x5c')](_0x2f97('0x5d'),_0x2e29a3['apiKey']))[_0x2f97('0x5e')](_0x2f97('0x5f')))},'json':!![]});}})[_0x2f97('0x22')](function(_0x3f34fe){if(_0x3f34fe){var _0x5bc007=[_0x2f97('0x60'),_0x2f97('0x61'),_0x2f97('0x62'),'description',_0x2f97('0x1a'),_0x2f97('0x63'),_0x2f97('0x64'),'source',_0x2f97('0x65'),_0x2f97('0x64'),_0x2f97('0x66')];_[_0x2f97('0x67')](_0x3f34fe,function(_0x2ff8d7){return _0x5bc007[_0x2f97('0x68')](_0x2ff8d7[_0x2f97('0x2d')])||!_0x2ff8d7[_0x2f97('0x69')]&&_0x2ff8d7['type']!==_0x2f97('0x6a')&&_0x2ff8d7[_0x2f97('0x4e')]!=='custom_dropdown';});return{'count':_0x3f34fe[_0x2f97('0x35')],'rows':_['map'](_0x3f34fe,function(_0x3c0c8b){return{'id':_0x3c0c8b[_0x2f97('0x2d')],'name':_0x3c0c8b['label'],'custom':!_0x3c0c8b['default'],'options':_0x3c0c8b['choices']?_['map'](_0x3c0c8b['choices'],function(_0x475723){return{'name':_['capitalize'](_0x475723),'value':_0x475723};}):[]};})};}})[_0x2f97('0x22')](respondWithResult(_0x4bb3d2,null))['catch'](function(_0x16931b){var _0xfde4ed=_0x133009['query']['test']?0x1f4:_0x16931b[_0x2f97('0x6b')]||0x1f4;logger[_0x2f97('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x2f97('0x53'),_0xfde4ed,JSON[_0x2f97('0x6c')](_0x16931b));delete _0x16931b[_0x2f97('0x2d')];if(_0xfde4ed===0x191){_0xfde4ed=0x190;}_0x4bb3d2[_0x2f97('0x1a')](_0xfde4ed)['send'](_0x133009['query'][_0x2f97('0x6d')]?{'message':_0x2f97('0x6e'),'statusCode':_0x16931b[_0x2f97('0x6b')]}:_0x16931b);});}; \ No newline at end of file +var _0x97a2=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','FreshdeskAccount','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','includeAll','findAll','rows','catch','show','include','find','body','params','getConfigurations','findOne','FreshdeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','FreshdeskField','getFields','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s/%s','%s:X','toString','base64','requester','subject','agent','description','group','company','remove','includes','default','custom_dropdown','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined'];(function(_0x335a50,_0x39f73e){var _0x45e720=function(_0x4f7014){while(--_0x4f7014){_0x335a50['push'](_0x335a50['shift']());}};_0x45e720(++_0x39f73e);}(_0x97a2,0x1b1));var _0x297a=function(_0x46eb60,_0x491888){_0x46eb60=_0x46eb60-0x0;var _0x5d0ea5=_0x97a2[_0x46eb60];return _0x5d0ea5;};'use strict';var emlformat=require(_0x297a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x297a('0x1'));var jsonpatch=require(_0x297a('0x2'));var rp=require(_0x297a('0x3'));var moment=require(_0x297a('0x4'));var BPromise=require(_0x297a('0x5'));var Mustache=require(_0x297a('0x6'));var util=require(_0x297a('0x7'));var path=require(_0x297a('0x8'));var sox=require('sox');var csv=require(_0x297a('0x9'));var ejs=require(_0x297a('0xa'));var fs=require('fs');var fs_extra=require(_0x297a('0xb'));var _=require(_0x297a('0xc'));var squel=require(_0x297a('0xd'));var crypto=require(_0x297a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x297a('0xf'));var toCsv=require(_0x297a('0x9'));var querystring=require(_0x297a('0x10'));var Papa=require(_0x297a('0x11'));var Redis=require(_0x297a('0x12'));var authService=require(_0x297a('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x297a('0x14'))(_0x297a('0x15'));var utils=require(_0x297a('0x16'));var config=require(_0x297a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x297a('0x18'))['db'];var integrations=require(_0x297a('0x19'));function respondWithStatusCode(_0x278334,_0x413bc4){_0x413bc4=_0x413bc4||0xcc;return function(_0xac6848){if(_0xac6848){return _0x278334[_0x297a('0x1a')](_0x413bc4);}return _0x278334[_0x297a('0x1b')](_0x413bc4)['end']();};}function respondWithResult(_0x4d826d,_0x417def){_0x417def=_0x417def||0xc8;return function(_0x523de5){if(_0x523de5){return _0x4d826d[_0x297a('0x1b')](_0x417def)[_0x297a('0x1c')](_0x523de5);}};}function respondWithFilteredResult(_0x53f1e4,_0x188540){return function(_0x40f080){if(_0x40f080){var _0x5256f7=typeof _0x188540[_0x297a('0x1d')]===_0x297a('0x1e')&&typeof _0x188540[_0x297a('0x1f')]==='undefined';var _0x400beb=_0x40f080[_0x297a('0x20')];var _0x29c6d6=_0x5256f7?0x0:_0x188540['offset'];var _0xba3b73=_0x5256f7?_0x40f080[_0x297a('0x20')]:_0x188540['offset']+_0x188540[_0x297a('0x1f')];var _0x43be0b;if(_0xba3b73>=_0x400beb){_0xba3b73=_0x400beb;_0x43be0b=0xc8;}else{_0x43be0b=0xce;}_0x53f1e4[_0x297a('0x1b')](_0x43be0b);return _0x53f1e4[_0x297a('0x21')](_0x297a('0x22'),_0x29c6d6+'-'+_0xba3b73+'/'+_0x400beb)[_0x297a('0x1c')](_0x40f080);}return null;};}function patchUpdates(_0x3e42c5){return function(_0x806fc3){try{jsonpatch[_0x297a('0x23')](_0x806fc3,_0x3e42c5,!![]);}catch(_0x2a1569){return BPromise[_0x297a('0x24')](_0x2a1569);}return _0x806fc3[_0x297a('0x25')]();};}function saveUpdates(_0x481f59,_0x5bb38a){return function(_0x514abf){if(_0x514abf){return _0x514abf[_0x297a('0x26')](_0x481f59)[_0x297a('0x27')](function(_0x4ad883){return _0x4ad883;});}return null;};}function removeEntity(_0xfbf16a,_0x40919d){return function(_0x2de036){if(_0x2de036){return _0x2de036[_0x297a('0x28')]()['then'](function(){_0xfbf16a[_0x297a('0x1b')](0xcc)[_0x297a('0x29')]();});}};}function handleEntityNotFound(_0x33f803,_0x4cc530){return function(_0x1a3f4f){if(!_0x1a3f4f){_0x33f803[_0x297a('0x1a')](0x194);}return _0x1a3f4f;};}function handleError(_0xbe22aa,_0x3c20f7){_0x3c20f7=_0x3c20f7||0x1f4;return function(_0x1ece0b){logger[_0x297a('0x2a')](_0x1ece0b[_0x297a('0x2b')]);if(_0x1ece0b[_0x297a('0x2c')]){delete _0x1ece0b[_0x297a('0x2c')];}_0xbe22aa[_0x297a('0x1b')](_0x3c20f7)[_0x297a('0x2d')](_0x1ece0b);};}exports['index']=function(_0x26e263,_0x1204b4){var _0xc30c85={},_0x592cc4={},_0x5032fb={'count':0x0,'rows':[]};var _0x1e5888=_[_0x297a('0x2e')](db[_0x297a('0x2f')][_0x297a('0x30')],function(_0x3eddd8){return{'name':_0x3eddd8[_0x297a('0x31')],'type':_0x3eddd8['type']['key']};});_0x592cc4[_0x297a('0x32')]=_['map'](_0x1e5888,_0x297a('0x2c'));_0x592cc4[_0x297a('0x33')]=_[_0x297a('0x34')](_0x26e263[_0x297a('0x33')]);_0x592cc4[_0x297a('0x35')]=_['intersection'](_0x592cc4[_0x297a('0x32')],_0x592cc4[_0x297a('0x33')]);_0xc30c85[_0x297a('0x36')]=_[_0x297a('0x37')](_0x592cc4[_0x297a('0x32')],qs[_0x297a('0x38')](_0x26e263[_0x297a('0x33')][_0x297a('0x38')]));_0xc30c85[_0x297a('0x36')]=_0xc30c85['attributes'][_0x297a('0x39')]?_0xc30c85['attributes']:_0x592cc4[_0x297a('0x32')];if(!_0x26e263[_0x297a('0x33')][_0x297a('0x3a')](_0x297a('0x3b'))){_0xc30c85['limit']=qs[_0x297a('0x1f')](_0x26e263['query'][_0x297a('0x1f')]);_0xc30c85[_0x297a('0x1d')]=qs['offset'](_0x26e263[_0x297a('0x33')][_0x297a('0x1d')]);}_0xc30c85[_0x297a('0x3c')]=qs['sort'](_0x26e263['query'][_0x297a('0x3d')]);_0xc30c85[_0x297a('0x3e')]=qs[_0x297a('0x35')](_['pick'](_0x26e263[_0x297a('0x33')],_0x592cc4[_0x297a('0x35')]),_0x1e5888);if(_0x26e263[_0x297a('0x33')][_0x297a('0x3f')]){_0xc30c85[_0x297a('0x3e')]=_[_0x297a('0x40')](_0xc30c85['where'],{'$or':_[_0x297a('0x2e')](_0x1e5888,function(_0x5491fe){if(_0x5491fe[_0x297a('0x41')]!=='VIRTUAL'){var _0x25c663={};_0x25c663[_0x5491fe['name']]={'$like':'%'+_0x26e263[_0x297a('0x33')]['filter']+'%'};return _0x25c663;}})});}_0xc30c85=_[_0x297a('0x40')]({},_0xc30c85,_0x26e263[_0x297a('0x42')]);var _0x44a413={'where':_0xc30c85['where']};return db['FreshdeskAccount'][_0x297a('0x20')](_0x44a413)['then'](function(_0x5266b5){_0x5032fb['count']=_0x5266b5;if(_0x26e263[_0x297a('0x33')][_0x297a('0x43')]){_0xc30c85['include']=[{'all':!![]}];}return db[_0x297a('0x2f')][_0x297a('0x44')](_0xc30c85);})[_0x297a('0x27')](function(_0x48baf9){_0x5032fb[_0x297a('0x45')]=_0x48baf9;return _0x5032fb;})[_0x297a('0x27')](respondWithFilteredResult(_0x1204b4,_0xc30c85))[_0x297a('0x46')](handleError(_0x1204b4,null));};exports[_0x297a('0x47')]=function(_0xe8621e,_0x47ca9d){var _0x441cdf={'raw':![],'where':{'id':_0xe8621e['params']['id']}},_0x4a459a={};_0x4a459a['model']=_[_0x297a('0x34')](db[_0x297a('0x2f')][_0x297a('0x30')]);_0x4a459a['query']=_[_0x297a('0x34')](_0xe8621e['query']);_0x4a459a[_0x297a('0x35')]=_[_0x297a('0x37')](_0x4a459a[_0x297a('0x32')],_0x4a459a[_0x297a('0x33')]);_0x441cdf[_0x297a('0x36')]=_[_0x297a('0x37')](_0x4a459a['model'],qs[_0x297a('0x38')](_0xe8621e[_0x297a('0x33')]['fields']));_0x441cdf[_0x297a('0x36')]=_0x441cdf[_0x297a('0x36')][_0x297a('0x39')]?_0x441cdf[_0x297a('0x36')]:_0x4a459a[_0x297a('0x32')];if(_0xe8621e['query'][_0x297a('0x43')]){_0x441cdf[_0x297a('0x48')]=[{'all':!![]}];}_0x441cdf=_[_0x297a('0x40')]({},_0x441cdf,_0xe8621e[_0x297a('0x42')]);return db[_0x297a('0x2f')][_0x297a('0x49')](_0x441cdf)[_0x297a('0x27')](handleEntityNotFound(_0x47ca9d,null))[_0x297a('0x27')](respondWithResult(_0x47ca9d,null))['catch'](handleError(_0x47ca9d,null));};exports['create']=function(_0x280185,_0x463103){return db['FreshdeskAccount']['create'](_0x280185[_0x297a('0x4a')],{})[_0x297a('0x27')](respondWithResult(_0x463103,0xc9))[_0x297a('0x46')](handleError(_0x463103,null));};exports[_0x297a('0x26')]=function(_0x4baed0,_0x11999e){if(_0x4baed0[_0x297a('0x4a')]['id']){delete _0x4baed0[_0x297a('0x4a')]['id'];}return db[_0x297a('0x2f')][_0x297a('0x49')]({'where':{'id':_0x4baed0[_0x297a('0x4b')]['id']}})[_0x297a('0x27')](handleEntityNotFound(_0x11999e,null))[_0x297a('0x27')](saveUpdates(_0x4baed0[_0x297a('0x4a')],null))[_0x297a('0x27')](respondWithResult(_0x11999e,null))['catch'](handleError(_0x11999e,null));};exports[_0x297a('0x28')]=function(_0x5cde7d,_0x46ccf9){return db[_0x297a('0x2f')][_0x297a('0x49')]({'where':{'id':_0x5cde7d['params']['id']}})[_0x297a('0x27')](handleEntityNotFound(_0x46ccf9,null))[_0x297a('0x27')](removeEntity(_0x46ccf9,null))[_0x297a('0x46')](handleError(_0x46ccf9,null));};exports[_0x297a('0x4c')]=function(_0x24694b,_0x2aa6bd,_0x2d0eda){var _0x2dc6ef={};var _0x2fb4f8={};var _0x5b5ec1;var _0x3d1bfd;return db[_0x297a('0x2f')][_0x297a('0x4d')]({'where':{'id':_0x24694b[_0x297a('0x4b')]['id']}})[_0x297a('0x27')](handleEntityNotFound(_0x2aa6bd,null))[_0x297a('0x27')](function(_0x56ddff){if(_0x56ddff){_0x5b5ec1=_0x56ddff;_0x2fb4f8['model']=_[_0x297a('0x34')](db[_0x297a('0x4e')][_0x297a('0x30')]);_0x2fb4f8[_0x297a('0x33')]=_['keys'](_0x24694b['query']);_0x2fb4f8[_0x297a('0x35')]=_[_0x297a('0x37')](_0x2fb4f8[_0x297a('0x32')],_0x2fb4f8[_0x297a('0x33')]);_0x2dc6ef[_0x297a('0x36')]=_[_0x297a('0x37')](_0x2fb4f8[_0x297a('0x32')],qs['fields'](_0x24694b['query'][_0x297a('0x38')]));_0x2dc6ef['attributes']=_0x2dc6ef['attributes']['length']?_0x2dc6ef[_0x297a('0x36')]:_0x2fb4f8['model'];_0x2dc6ef[_0x297a('0x3c')]=qs[_0x297a('0x3d')](_0x24694b[_0x297a('0x33')]['sort']);_0x2dc6ef['where']=qs['filters'](_[_0x297a('0x4f')](_0x24694b[_0x297a('0x33')],_0x2fb4f8[_0x297a('0x35')]));if(_0x24694b[_0x297a('0x33')][_0x297a('0x3f')]){_0x2dc6ef['where']=_['merge'](_0x2dc6ef[_0x297a('0x3e')],{'$or':_[_0x297a('0x2e')](_0x2dc6ef['attributes'],function(_0x3d1b49){var _0x1e105c={};_0x1e105c[_0x3d1b49]={'$like':'%'+_0x24694b[_0x297a('0x33')][_0x297a('0x3f')]+'%'};return _0x1e105c;})});}_0x2dc6ef=_[_0x297a('0x40')]({},_0x2dc6ef,_0x24694b[_0x297a('0x42')]);return _0x5b5ec1['getConfigurations'](_0x2dc6ef);}})['then'](function(_0x35a736){if(_0x35a736){_0x3d1bfd=_0x35a736[_0x297a('0x39')];if(!_0x24694b['query'][_0x297a('0x3a')](_0x297a('0x3b'))){_0x2dc6ef['limit']=qs[_0x297a('0x1f')](_0x24694b[_0x297a('0x33')][_0x297a('0x1f')]);_0x2dc6ef['offset']=qs[_0x297a('0x1d')](_0x24694b['query'][_0x297a('0x1d')]);}return _0x5b5ec1['getConfigurations'](_0x2dc6ef);}})['then'](function(_0x40de8f){if(_0x40de8f){return _0x40de8f?{'count':_0x3d1bfd,'rows':_0x40de8f}:null;}})['then'](respondWithResult(_0x2aa6bd,null))[_0x297a('0x46')](handleError(_0x2aa6bd,null));};exports[_0x297a('0x50')]=function(_0x2cdfa8,_0x4ee932,_0x59d38e){if(_0x2cdfa8[_0x297a('0x4a')]['id']){delete _0x2cdfa8[_0x297a('0x4a')]['id'];}return db[_0x297a('0x2f')]['findOne']({'where':{'id':_0x2cdfa8['params']['id']}})[_0x297a('0x27')](handleEntityNotFound(_0x4ee932,null))['then'](function(_0x4f210d){if(_0x4f210d){_0x2cdfa8[_0x297a('0x4a')][_0x297a('0x51')]=_0x4f210d['id'];_0x2cdfa8[_0x297a('0x4a')][_0x297a('0x52')]=integrations[_0x297a('0x53')](_0x2cdfa8['body']['channel'],_0x2cdfa8[_0x297a('0x4a')][_0x297a('0x41')]);_0x2cdfa8[_0x297a('0x4a')][_0x297a('0x54')]=integrations[_0x297a('0x55')](_0x2cdfa8[_0x297a('0x4a')][_0x297a('0x56')],_0x2cdfa8['body'][_0x297a('0x41')]);return db[_0x297a('0x4e')][_0x297a('0x57')](_0x2cdfa8[_0x297a('0x4a')],{'include':[{'model':db[_0x297a('0x58')],'as':'Subjects'},{'model':db[_0x297a('0x58')],'as':_0x297a('0x54')}]});}return null;})[_0x297a('0x27')](respondWithResult(_0x4ee932,null))['catch'](handleError(_0x4ee932,null));};exports[_0x297a('0x59')]=function(_0x14b925,_0x584c17,_0x10b88a){var _0x283790='';return db[_0x297a('0x2f')][_0x297a('0x4d')]({'where':{'id':_0x14b925[_0x297a('0x4b')]['id']},'attributes':['id',_0x297a('0x5a'),_0x297a('0x5b')]})[_0x297a('0x27')](handleEntityNotFound(_0x584c17,null))['then'](function(_0x2b5844){if(_0x2b5844){_0x283790=_0x2b5844[_0x297a('0x5a')];var _0x5130fb=_0x283790[_0x297a('0x5c')](-0x1);if(_0x5130fb==='/'){_0x283790=_0x283790['substring'](0x0,_0x283790[_0x297a('0x5d')](_0x5130fb));}return rp({'method':_0x297a('0x5e'),'uri':util[_0x297a('0x5f')](_0x297a('0x60'),_0x283790,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x297a('0x5f')]('Basic\x20%s',new Buffer(util['format'](_0x297a('0x61'),_0x2b5844['apiKey']))[_0x297a('0x62')](_0x297a('0x63')))},'json':!![]});}})['then'](function(_0x4cb9fa){if(_0x4cb9fa){var _0x31fc1d=[_0x297a('0x64'),_0x297a('0x65'),_0x297a('0x66'),_0x297a('0x67'),_0x297a('0x1b'),'priority',_0x297a('0x68'),'source','ticket_type',_0x297a('0x68'),_0x297a('0x69')];_[_0x297a('0x6a')](_0x4cb9fa,function(_0x3bf15e){return _0x31fc1d[_0x297a('0x6b')](_0x3bf15e[_0x297a('0x2c')])||!_0x3bf15e[_0x297a('0x6c')]&&_0x3bf15e[_0x297a('0x41')]!=='custom_text'&&_0x3bf15e[_0x297a('0x41')]!==_0x297a('0x6d');});return{'count':_0x4cb9fa['length'],'rows':_['map'](_0x4cb9fa,function(_0x5bb15b){return{'id':_0x5bb15b['name'],'name':_0x5bb15b['label'],'custom':!_0x5bb15b['default'],'options':_0x5bb15b[_0x297a('0x6e')]?_[_0x297a('0x2e')](_0x5bb15b[_0x297a('0x6e')],function(_0x5ba0d8){return{'name':_[_0x297a('0x6f')](_0x5ba0d8),'value':_0x5ba0d8};}):[]};})};}})[_0x297a('0x27')](respondWithResult(_0x584c17,null))['catch'](function(_0x28d29c){var _0x52319e=_0x14b925[_0x297a('0x33')][_0x297a('0x70')]?0x1f4:_0x28d29c['statusCode']||0x1f4;logger[_0x297a('0x2a')](_0x297a('0x71'),'getFields',_0x52319e,JSON[_0x297a('0x72')](_0x28d29c));delete _0x28d29c['name'];if(_0x52319e===0x191){_0x52319e=0x190;}_0x584c17['status'](_0x52319e)['send'](_0x14b925[_0x297a('0x33')][_0x297a('0x70')]?{'message':_0x297a('0x73'),'statusCode':_0x28d29c['statusCode']}:_0x28d29c);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 52dd2f4..6a81a81 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 _0xff5a=['bluebird','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','lodash','util','../../config/logger','api'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xff5a,0x1a9));var _0xaff5=function(_0x3ca7aa,_0x17a06e){_0x3ca7aa=_0x3ca7aa-0x0;var _0x3edc72=_0xff5a[_0x3ca7aa];return _0x3edc72;};'use strict';var _=require(_0xaff5('0x0'));var util=require(_0xaff5('0x1'));var logger=require(_0xaff5('0x2'))(_0xaff5('0x3'));var moment=require('moment');var BPromise=require(_0xaff5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaff5('0x5'));var rimraf=require(_0xaff5('0x6'));var config=require(_0xaff5('0x7'));var attributes=require(_0xaff5('0x8'));var integrations=require(_0xaff5('0x9'));module[_0xaff5('0xa')]=function(_0x13dce1,_0x412b6f){return _0x13dce1[_0xaff5('0xb')](_0xaff5('0xc'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0919=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','FreshdeskAccount','int_freshdesk_accounts','lodash','util'];(function(_0xe7ad4d,_0x1dae4c){var _0x2e552a=function(_0x49ecc5){while(--_0x49ecc5){_0xe7ad4d['push'](_0xe7ad4d['shift']());}};_0x2e552a(++_0x1dae4c);}(_0x0919,0x98));var _0x9091=function(_0x48f1db,_0x554c57){_0x48f1db=_0x48f1db-0x0;var _0x27de48=_0x0919[_0x48f1db];return _0x27de48;};'use strict';var _=require(_0x9091('0x0'));var util=require(_0x9091('0x1'));var logger=require(_0x9091('0x2'))(_0x9091('0x3'));var moment=require(_0x9091('0x4'));var BPromise=require(_0x9091('0x5'));var rp=require(_0x9091('0x6'));var fs=require('fs');var path=require(_0x9091('0x7'));var rimraf=require(_0x9091('0x8'));var config=require(_0x9091('0x9'));var attributes=require(_0x9091('0xa'));var integrations=require(_0x9091('0xb'));module['exports']=function(_0x3c5b54,_0x499703){return _0x3c5b54['define'](_0x9091('0xc'),attributes,{'tableName':_0x9091('0xd'),'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 330814a..2b107c1 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 _0x3a16=['rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','FreshdeskAccount','findAll','options','raw','where','attributes','include','map','model','debug','catch','GetFreshdeskAccount','ShowFreshdeskAccount','find','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x1a6e88,_0x740e89){var _0x2f7af4=function(_0x5cc5c0){while(--_0x5cc5c0){_0x1a6e88['push'](_0x1a6e88['shift']());}};_0x2f7af4(++_0x740e89);}(_0x3a16,0x192));var _0x63a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a16[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x63a1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x63a1('0x1'));var rs=require(_0x63a1('0x2'));var fs=require('fs');var Redis=require(_0x63a1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x63a1('0x4'));var logger=require(_0x63a1('0x5'))(_0x63a1('0x6'));var config=require(_0x63a1('0x7'));var jayson=require(_0x63a1('0x8'));var client=jayson[_0x63a1('0x9')][_0x63a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x567f5c,_0x5a4e22,_0x12df39){return new BPromise(function(_0x253e62,_0x18472d){return client['request'](_0x567f5c,_0x12df39)[_0x63a1('0xb')](function(_0x307bed){logger[_0x63a1('0xc')](_0x63a1('0xd'),_0x5a4e22,'request\x20sent');logger['debug'](_0x63a1('0xe'),_0x5a4e22,_0x63a1('0xf'),JSON[_0x63a1('0x10')](_0x307bed));if(_0x307bed[_0x63a1('0x11')]){if(_0x307bed['error']['code']===0x1f4){logger[_0x63a1('0x11')](_0x63a1('0xd'),_0x5a4e22,_0x307bed[_0x63a1('0x11')]['message']);return _0x18472d(_0x307bed[_0x63a1('0x11')]['message']);}logger[_0x63a1('0x11')](_0x63a1('0xd'),_0x5a4e22,_0x307bed['error'][_0x63a1('0x12')]);return _0x253e62(_0x307bed[_0x63a1('0x11')][_0x63a1('0x12')]);}else{logger[_0x63a1('0xc')](_0x63a1('0xd'),_0x5a4e22,_0x63a1('0xf'));_0x253e62(_0x307bed[_0x63a1('0x13')]['message']);}})['catch'](function(_0x9c2f87){logger[_0x63a1('0x11')](_0x63a1('0xd'),_0x5a4e22,_0x9c2f87);_0x18472d(_0x9c2f87);});});}exports['GetFreshdeskAccount']=function(_0x484625){var _0x513352=this;return new Promise(function(_0x421fd0,_0x4baa46){return db[_0x63a1('0x14')][_0x63a1('0x15')]({'raw':_0x484625[_0x63a1('0x16')]?_0x484625[_0x63a1('0x16')][_0x63a1('0x17')]===undefined?!![]:![]:!![],'where':_0x484625[_0x63a1('0x16')]?_0x484625['options'][_0x63a1('0x18')]||null:null,'attributes':_0x484625[_0x63a1('0x16')]?_0x484625['options'][_0x63a1('0x19')]||null:null,'limit':_0x484625[_0x63a1('0x16')]?_0x484625['options']['limit']||null:null,'include':_0x484625[_0x63a1('0x16')]?_0x484625[_0x63a1('0x16')][_0x63a1('0x1a')]?_[_0x63a1('0x1b')](_0x484625[_0x63a1('0x16')]['include'],function(_0x2f878f){return{'model':db[_0x2f878f['model']],'as':_0x2f878f['as'],'attributes':_0x2f878f[_0x63a1('0x19')],'include':_0x2f878f['include']?_[_0x63a1('0x1b')](_0x2f878f['include'],function(_0x446bfc){return{'model':db[_0x446bfc[_0x63a1('0x1c')]],'as':_0x446bfc['as'],'attributes':_0x446bfc[_0x63a1('0x19')],'include':_0x446bfc['include']?_['map'](_0x446bfc[_0x63a1('0x1a')],function(_0x46f34d){return{'model':db[_0x46f34d[_0x63a1('0x1c')]],'as':_0x46f34d['as'],'attributes':_0x46f34d['attributes']};}):[]};}):[]};}):[]:[]})[_0x63a1('0xb')](function(_0x58bff7){logger[_0x63a1('0xc')]('GetFreshdeskAccount',_0x484625);logger[_0x63a1('0x1d')]('GetFreshdeskAccount',_0x484625,JSON[_0x63a1('0x10')](_0x58bff7));_0x421fd0(_0x58bff7);})[_0x63a1('0x1e')](function(_0xea8c81){logger[_0x63a1('0x11')](_0x63a1('0x1f'),_0xea8c81[_0x63a1('0x12')],_0x484625);_0x4baa46(_0x513352[_0x63a1('0x11')](0x1f4,_0xea8c81['message']));});});};exports[_0x63a1('0x20')]=function(_0x540f17){var _0xd834db=this;return new Promise(function(_0x3d3344,_0x2f04ad){return db['FreshdeskAccount'][_0x63a1('0x21')]({'raw':_0x540f17[_0x63a1('0x16')]?_0x540f17['options']['raw']===undefined?!![]:![]:!![],'where':_0x540f17[_0x63a1('0x16')]?_0x540f17[_0x63a1('0x16')][_0x63a1('0x18')]||null:null,'attributes':_0x540f17[_0x63a1('0x16')]?_0x540f17[_0x63a1('0x16')][_0x63a1('0x19')]||null:null,'include':_0x540f17[_0x63a1('0x16')]?_0x540f17[_0x63a1('0x16')][_0x63a1('0x1a')]?_[_0x63a1('0x1b')](_0x540f17['options'][_0x63a1('0x1a')],function(_0x1bc85a){return{'model':db[_0x1bc85a[_0x63a1('0x1c')]],'as':_0x1bc85a['as'],'attributes':_0x1bc85a[_0x63a1('0x19')],'include':_0x1bc85a[_0x63a1('0x1a')]?_[_0x63a1('0x1b')](_0x1bc85a[_0x63a1('0x1a')],function(_0x38d36a){return{'model':db[_0x38d36a[_0x63a1('0x1c')]],'as':_0x38d36a['as'],'attributes':_0x38d36a[_0x63a1('0x19')],'include':_0x38d36a[_0x63a1('0x1a')]?_[_0x63a1('0x1b')](_0x38d36a['include'],function(_0x28b480){return{'model':db[_0x28b480[_0x63a1('0x1c')]],'as':_0x28b480['as'],'attributes':_0x28b480[_0x63a1('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10797e){logger[_0x63a1('0xc')](_0x63a1('0x20'),_0x540f17);logger[_0x63a1('0x1d')](_0x63a1('0x20'),_0x540f17,JSON[_0x63a1('0x10')](_0x10797e));_0x3d3344(_0x10797e);})[_0x63a1('0x1e')](function(_0x3706bc){logger['error'](_0x63a1('0x20'),_0x3706bc['message'],_0x540f17);_0x2f04ad(_0xd834db[_0x63a1('0x11')](0x1f4,_0x3706bc[_0x63a1('0x12')]));});});}; \ No newline at end of file +var _0x5665=['GetFreshdeskAccount','findAll','options','where','attributes','limit','include','map','model','debug','raw','then','ShowFreshdeskAccount','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x1abe59,_0x2ee058){var _0x48a395=function(_0x5edb8f){while(--_0x5edb8f){_0x1abe59['push'](_0x1abe59['shift']());}};_0x48a395(++_0x2ee058);}(_0x5665,0x162));var _0x5566=function(_0x502583,_0x3e77ee){_0x502583=_0x502583-0x0;var _0x5eb4d5=_0x5665[_0x502583];return _0x5eb4d5;};'use strict';var _=require(_0x5566('0x0'));var util=require('util');var moment=require(_0x5566('0x1'));var BPromise=require('bluebird');var rs=require(_0x5566('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5566('0x3'));var logger=require(_0x5566('0x4'))(_0x5566('0x5'));var config=require(_0x5566('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5566('0x7')][_0x5566('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x516a98,_0x4ad9e3,_0x3cd57a){return new BPromise(function(_0x210b55,_0x185e5c){return client['request'](_0x516a98,_0x3cd57a)['then'](function(_0x2c0209){logger[_0x5566('0x9')](_0x5566('0xa'),_0x4ad9e3,_0x5566('0xb'));logger['debug'](_0x5566('0xc'),_0x4ad9e3,_0x5566('0xb'),JSON[_0x5566('0xd')](_0x2c0209));if(_0x2c0209[_0x5566('0xe')]){if(_0x2c0209['error'][_0x5566('0xf')]===0x1f4){logger['error'](_0x5566('0xa'),_0x4ad9e3,_0x2c0209[_0x5566('0xe')][_0x5566('0x10')]);return _0x185e5c(_0x2c0209[_0x5566('0xe')][_0x5566('0x10')]);}logger[_0x5566('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x4ad9e3,_0x2c0209[_0x5566('0xe')][_0x5566('0x10')]);return _0x210b55(_0x2c0209['error'][_0x5566('0x10')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x4ad9e3,_0x5566('0xb'));_0x210b55(_0x2c0209['result']['message']);}})[_0x5566('0x11')](function(_0x465a64){logger['error'](_0x5566('0xa'),_0x4ad9e3,_0x465a64);_0x185e5c(_0x465a64);});});}exports[_0x5566('0x12')]=function(_0xd4ba19){var _0xfb4870=this;return new Promise(function(_0x54d49e,_0x5c4f39){return db['FreshdeskAccount'][_0x5566('0x13')]({'raw':_0xd4ba19['options']?_0xd4ba19[_0x5566('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0xd4ba19[_0x5566('0x14')]?_0xd4ba19[_0x5566('0x14')][_0x5566('0x15')]||null:null,'attributes':_0xd4ba19['options']?_0xd4ba19[_0x5566('0x14')][_0x5566('0x16')]||null:null,'limit':_0xd4ba19[_0x5566('0x14')]?_0xd4ba19[_0x5566('0x14')][_0x5566('0x17')]||null:null,'include':_0xd4ba19[_0x5566('0x14')]?_0xd4ba19[_0x5566('0x14')]['include']?_['map'](_0xd4ba19['options'][_0x5566('0x18')],function(_0xca5f54){return{'model':db[_0xca5f54['model']],'as':_0xca5f54['as'],'attributes':_0xca5f54[_0x5566('0x16')],'include':_0xca5f54['include']?_[_0x5566('0x19')](_0xca5f54['include'],function(_0x19585c){return{'model':db[_0x19585c['model']],'as':_0x19585c['as'],'attributes':_0x19585c[_0x5566('0x16')],'include':_0x19585c[_0x5566('0x18')]?_['map'](_0x19585c['include'],function(_0xebed5b){return{'model':db[_0xebed5b[_0x5566('0x1a')]],'as':_0xebed5b['as'],'attributes':_0xebed5b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x222236){logger[_0x5566('0x9')](_0x5566('0x12'),_0xd4ba19);logger[_0x5566('0x1b')](_0x5566('0x12'),_0xd4ba19,JSON[_0x5566('0xd')](_0x222236));_0x54d49e(_0x222236);})[_0x5566('0x11')](function(_0x5c200d){logger[_0x5566('0xe')](_0x5566('0x12'),_0x5c200d[_0x5566('0x10')],_0xd4ba19);_0x5c4f39(_0xfb4870[_0x5566('0xe')](0x1f4,_0x5c200d[_0x5566('0x10')]));});});};exports['ShowFreshdeskAccount']=function(_0xc4b6d8){var _0x54a540=this;return new Promise(function(_0x45289d,_0x440eaa){return db['FreshdeskAccount']['find']({'raw':_0xc4b6d8[_0x5566('0x14')]?_0xc4b6d8[_0x5566('0x14')][_0x5566('0x1c')]===undefined?!![]:![]:!![],'where':_0xc4b6d8['options']?_0xc4b6d8[_0x5566('0x14')][_0x5566('0x15')]||null:null,'attributes':_0xc4b6d8['options']?_0xc4b6d8[_0x5566('0x14')][_0x5566('0x16')]||null:null,'include':_0xc4b6d8['options']?_0xc4b6d8[_0x5566('0x14')][_0x5566('0x18')]?_[_0x5566('0x19')](_0xc4b6d8[_0x5566('0x14')][_0x5566('0x18')],function(_0x3c0e82){return{'model':db[_0x3c0e82['model']],'as':_0x3c0e82['as'],'attributes':_0x3c0e82[_0x5566('0x16')],'include':_0x3c0e82[_0x5566('0x18')]?_[_0x5566('0x19')](_0x3c0e82[_0x5566('0x18')],function(_0x1915ad){return{'model':db[_0x1915ad['model']],'as':_0x1915ad['as'],'attributes':_0x1915ad[_0x5566('0x16')],'include':_0x1915ad[_0x5566('0x18')]?_[_0x5566('0x19')](_0x1915ad['include'],function(_0x114faa){return{'model':db[_0x114faa[_0x5566('0x1a')]],'as':_0x114faa['as'],'attributes':_0x114faa['attributes']};}):[]};}):[]};}):[]:[]})[_0x5566('0x1d')](function(_0x257579){logger[_0x5566('0x9')](_0x5566('0x1e'),_0xc4b6d8);logger['debug']('ShowFreshdeskAccount',_0xc4b6d8,JSON[_0x5566('0xd')](_0x257579));_0x45289d(_0x257579);})[_0x5566('0x11')](function(_0x1673d7){logger['error'](_0x5566('0x1e'),_0x1673d7[_0x5566('0x10')],_0xc4b6d8);_0x440eaa(_0x54a540[_0x5566('0xe')](0x1f4,_0x1673d7[_0x5566('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 635004e..5862042 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 _0x67a9=['/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','setTags','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields'];(function(_0x44b54a,_0x3ff92f){var _0x4bd2fa=function(_0x3317d4){while(--_0x3317d4){_0x44b54a['push'](_0x44b54a['shift']());}};_0x4bd2fa(++_0x3ff92f);}(_0x67a9,0x150));var _0x967a=function(_0x46cad0,_0x4a3c0b){_0x46cad0=_0x46cad0-0x0;var _0x578e78=_0x67a9[_0x46cad0];return _0x578e78;};'use strict';var multer=require('multer');var util=require(_0x967a('0x0'));var path=require(_0x967a('0x1'));var timeout=require(_0x967a('0x2'));var express=require(_0x967a('0x3'));var router=express[_0x967a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x967a('0x5'));var interaction=require(_0x967a('0x6'));var config=require('../../config/environment');var controller=require(_0x967a('0x7'));router[_0x967a('0x8')]('/',auth[_0x967a('0x9')](),controller[_0x967a('0xa')]);router[_0x967a('0x8')]('/:id',auth[_0x967a('0x9')](),controller[_0x967a('0xb')]);router[_0x967a('0x8')](_0x967a('0xc'),auth['isAuthenticated'](),controller[_0x967a('0xd')]);router['get'](_0x967a('0xe'),auth[_0x967a('0x9')](),controller['getSubjects']);router['get'](_0x967a('0xf'),auth[_0x967a('0x9')](),controller[_0x967a('0x10')]);router[_0x967a('0x8')](_0x967a('0x11'),auth[_0x967a('0x9')](),controller['getTags']);router['post']('/',auth[_0x967a('0x9')](),controller[_0x967a('0x12')]);router[_0x967a('0x13')](_0x967a('0x11'),auth['isAuthenticated'](),controller[_0x967a('0x14')]);router['put'](_0x967a('0x15'),auth[_0x967a('0x9')](),controller[_0x967a('0x16')]);router['delete'](_0x967a('0x15'),auth['isAuthenticated'](),controller[_0x967a('0x17')]);module[_0x967a('0x18')]=router; \ No newline at end of file +var _0x9248=['put','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','show','/:id/fields','getFields','get','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags'];(function(_0x2f2ed0,_0x1c6435){var _0x250b0d=function(_0x1909c1){while(--_0x1909c1){_0x2f2ed0['push'](_0x2f2ed0['shift']());}};_0x250b0d(++_0x1c6435);}(_0x9248,0x17e));var _0x8924=function(_0x59f317,_0x23041a){_0x59f317=_0x59f317-0x0;var _0x1938c6=_0x9248[_0x59f317];return _0x1938c6;};'use strict';var multer=require(_0x8924('0x0'));var util=require(_0x8924('0x1'));var path=require(_0x8924('0x2'));var timeout=require('connect-timeout');var express=require(_0x8924('0x3'));var router=express['Router']();var fs_extra=require(_0x8924('0x4'));var auth=require(_0x8924('0x5'));var interaction=require(_0x8924('0x6'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x8924('0x7')](),controller[_0x8924('0x8')]);router['get'](_0x8924('0x9'),auth[_0x8924('0x7')](),controller[_0x8924('0xa')]);router['get'](_0x8924('0xb'),auth['isAuthenticated'](),controller[_0x8924('0xc')]);router[_0x8924('0xd')](_0x8924('0xe'),auth[_0x8924('0x7')](),controller[_0x8924('0xf')]);router[_0x8924('0xd')](_0x8924('0x10'),auth['isAuthenticated'](),controller[_0x8924('0x11')]);router['get'](_0x8924('0x12'),auth['isAuthenticated'](),controller[_0x8924('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8924('0x14')]);router[_0x8924('0x15')](_0x8924('0x12'),auth[_0x8924('0x7')](),controller[_0x8924('0x16')]);router[_0x8924('0x17')]('/:id',auth[_0x8924('0x7')](),controller[_0x8924('0x18')]);router[_0x8924('0x19')](_0x8924('0x9'),auth[_0x8924('0x7')](),controller['destroy']);module[_0x8924('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 4e0e9c9..eec3d32 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 _0xa00e=['STRING','exports'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0xa00e,0x18b));var _0xea00=function(_0x38e112,_0x500fe4){_0x38e112=_0x38e112-0x0;var _0x33c9a6=_0xa00e[_0x38e112];return _0x33c9a6;};'use strict';var Sequelize=require('sequelize');module[_0xea00('0x0')]={'name':{'type':Sequelize[_0xea00('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xde39=['STRING','exports'];(function(_0x119769,_0x32865d){var _0x105c19=function(_0x5682ea){while(--_0x5682ea){_0x119769['push'](_0x119769['shift']());}};_0x105c19(++_0x32865d);}(_0xde39,0xeb));var _0x9de3=function(_0x8b8564,_0x162976){_0x8b8564=_0x8b8564-0x0;var _0x360c61=_0xde39[_0x8b8564];return _0x360c61;};'use strict';var Sequelize=require('sequelize');module[_0x9de3('0x0')]={'name':{'type':Sequelize[_0x9de3('0x1')]},'description':{'type':Sequelize[_0x9de3('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index a16cdf8..aceeb12 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 _0x9914=['apply','save','update','then','end','sendStatus','error','stack','name','index','map','fieldName','key','query','filters','intersection','model','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','FreshdeskConfiguration','includeAll','findAll','rows','catch','show','params','rawAttributes','keys','fields','length','find','create','body','destroy','getFields','FreshdeskField','nolimit','getSubjects','getDescriptions','getTags','findOne','Tag','setTags','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json'];(function(_0x39177c,_0x1793d7){var _0x236b32=function(_0x36c796){while(--_0x36c796){_0x39177c['push'](_0x39177c['shift']());}};_0x236b32(++_0x1793d7);}(_0x9914,0x18c));var _0x4991=function(_0x330cbe,_0x2bdec2){_0x330cbe=_0x330cbe-0x0;var _0x3d2445=_0x9914[_0x330cbe];return _0x3d2445;};'use strict';var emlformat=require(_0x4991('0x0'));var rimraf=require(_0x4991('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4991('0x2'));var rp=require(_0x4991('0x3'));var moment=require('moment');var BPromise=require(_0x4991('0x4'));var Mustache=require(_0x4991('0x5'));var util=require(_0x4991('0x6'));var path=require(_0x4991('0x7'));var sox=require(_0x4991('0x8'));var csv=require('to-csv');var ejs=require(_0x4991('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4991('0xa'));var squel=require(_0x4991('0xb'));var crypto=require(_0x4991('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4991('0xd'));var toCsv=require(_0x4991('0xe'));var querystring=require(_0x4991('0xf'));var Papa=require(_0x4991('0x10'));var Redis=require(_0x4991('0x11'));var authService=require(_0x4991('0x12'));var qs=require(_0x4991('0x13'));var as=require(_0x4991('0x14'));var hardwareService=require(_0x4991('0x15'));var logger=require('../../config/logger')(_0x4991('0x16'));var utils=require(_0x4991('0x17'));var config=require(_0x4991('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4991('0x19'))['db'];function respondWithStatusCode(_0x405dd8,_0x30bd8a){_0x30bd8a=_0x30bd8a||0xcc;return function(_0x5f0346){if(_0x5f0346){return _0x405dd8['sendStatus'](_0x30bd8a);}return _0x405dd8['status'](_0x30bd8a)['end']();};}function respondWithResult(_0x1d3d32,_0x1d5dd4){_0x1d5dd4=_0x1d5dd4||0xc8;return function(_0x2ef604){if(_0x2ef604){return _0x1d3d32[_0x4991('0x1a')](_0x1d5dd4)['json'](_0x2ef604);}};}function respondWithFilteredResult(_0x3954b4,_0xe3de63){return function(_0xd9d0b4){if(_0xd9d0b4){var _0x2ca3d6=typeof _0xe3de63[_0x4991('0x1b')]===_0x4991('0x1c')&&typeof _0xe3de63[_0x4991('0x1d')]===_0x4991('0x1c');var _0x20116f=_0xd9d0b4['count'];var _0x45a6d2=_0x2ca3d6?0x0:_0xe3de63[_0x4991('0x1b')];var _0x2329a0=_0x2ca3d6?_0xd9d0b4[_0x4991('0x1e')]:_0xe3de63['offset']+_0xe3de63[_0x4991('0x1d')];var _0x3d8538;if(_0x2329a0>=_0x20116f){_0x2329a0=_0x20116f;_0x3d8538=0xc8;}else{_0x3d8538=0xce;}_0x3954b4['status'](_0x3d8538);return _0x3954b4[_0x4991('0x1f')](_0x4991('0x20'),_0x45a6d2+'-'+_0x2329a0+'/'+_0x20116f)[_0x4991('0x21')](_0xd9d0b4);}return null;};}function patchUpdates(_0x13ead5){return function(_0x620203){try{jsonpatch[_0x4991('0x22')](_0x620203,_0x13ead5,!![]);}catch(_0x571c33){return BPromise['reject'](_0x571c33);}return _0x620203[_0x4991('0x23')]();};}function saveUpdates(_0x2716e6,_0xd9852f){return function(_0x3c35e0){if(_0x3c35e0){return _0x3c35e0[_0x4991('0x24')](_0x2716e6)['then'](function(_0x5a744d){return _0x5a744d;});}return null;};}function removeEntity(_0x1bb83c,_0x1e3ce6){return function(_0x2ec2){if(_0x2ec2){return _0x2ec2['destroy']()[_0x4991('0x25')](function(){_0x1bb83c[_0x4991('0x1a')](0xcc)[_0x4991('0x26')]();});}};}function handleEntityNotFound(_0x4adc12,_0x212e4f){return function(_0x5a5feb){if(!_0x5a5feb){_0x4adc12[_0x4991('0x27')](0x194);}return _0x5a5feb;};}function handleError(_0x3bdfd2,_0x1540e6){_0x1540e6=_0x1540e6||0x1f4;return function(_0x478116){logger[_0x4991('0x28')](_0x478116[_0x4991('0x29')]);if(_0x478116[_0x4991('0x2a')]){delete _0x478116['name'];}_0x3bdfd2['status'](_0x1540e6)['send'](_0x478116);};}exports[_0x4991('0x2b')]=function(_0x4b5831,_0x50e44a){var _0x2d2557={},_0x5994ff={},_0x574b5f={'count':0x0,'rows':[]};var _0x185fc4=_[_0x4991('0x2c')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x2747e9){return{'name':_0x2747e9[_0x4991('0x2d')],'type':_0x2747e9['type'][_0x4991('0x2e')]};});_0x5994ff['model']=_['map'](_0x185fc4,'name');_0x5994ff[_0x4991('0x2f')]=_['keys'](_0x4b5831[_0x4991('0x2f')]);_0x5994ff[_0x4991('0x30')]=_[_0x4991('0x31')](_0x5994ff['model'],_0x5994ff[_0x4991('0x2f')]);_0x2d2557['attributes']=_[_0x4991('0x31')](_0x5994ff[_0x4991('0x32')],qs['fields'](_0x4b5831[_0x4991('0x2f')]['fields']));_0x2d2557[_0x4991('0x33')]=_0x2d2557[_0x4991('0x33')]['length']?_0x2d2557[_0x4991('0x33')]:_0x5994ff[_0x4991('0x32')];if(!_0x4b5831[_0x4991('0x2f')][_0x4991('0x34')]('nolimit')){_0x2d2557[_0x4991('0x1d')]=qs[_0x4991('0x1d')](_0x4b5831['query'][_0x4991('0x1d')]);_0x2d2557[_0x4991('0x1b')]=qs[_0x4991('0x1b')](_0x4b5831[_0x4991('0x2f')][_0x4991('0x1b')]);}_0x2d2557[_0x4991('0x35')]=qs['sort'](_0x4b5831['query'][_0x4991('0x36')]);_0x2d2557[_0x4991('0x37')]=qs[_0x4991('0x30')](_[_0x4991('0x38')](_0x4b5831[_0x4991('0x2f')],_0x5994ff['filters']),_0x185fc4);if(_0x4b5831[_0x4991('0x2f')][_0x4991('0x39')]){_0x2d2557[_0x4991('0x37')]=_[_0x4991('0x3a')](_0x2d2557[_0x4991('0x37')],{'$or':_[_0x4991('0x2c')](_0x185fc4,function(_0x1ffa40){if(_0x1ffa40[_0x4991('0x3b')]!==_0x4991('0x3c')){var _0x2f45c4={};_0x2f45c4[_0x1ffa40[_0x4991('0x2a')]]={'$like':'%'+_0x4b5831['query']['filter']+'%'};return _0x2f45c4;}})});}_0x2d2557=_[_0x4991('0x3a')]({},_0x2d2557,_0x4b5831[_0x4991('0x3d')]);var _0x58ff76={'where':_0x2d2557[_0x4991('0x37')]};return db[_0x4991('0x3e')][_0x4991('0x1e')](_0x58ff76)[_0x4991('0x25')](function(_0x2003da){_0x574b5f[_0x4991('0x1e')]=_0x2003da;if(_0x4b5831[_0x4991('0x2f')][_0x4991('0x3f')]){_0x2d2557['include']=[{'all':!![]}];}return db[_0x4991('0x3e')][_0x4991('0x40')](_0x2d2557);})[_0x4991('0x25')](function(_0x2955b8){_0x574b5f[_0x4991('0x41')]=_0x2955b8;return _0x574b5f;})[_0x4991('0x25')](respondWithFilteredResult(_0x50e44a,_0x2d2557))[_0x4991('0x42')](handleError(_0x50e44a,null));};exports[_0x4991('0x43')]=function(_0x103311,_0x3e1f8e){var _0x3d1be4={'raw':![],'where':{'id':_0x103311[_0x4991('0x44')]['id']}},_0x50ef27={};_0x50ef27[_0x4991('0x32')]=_['keys'](db[_0x4991('0x3e')][_0x4991('0x45')]);_0x50ef27[_0x4991('0x2f')]=_[_0x4991('0x46')](_0x103311['query']);_0x50ef27['filters']=_[_0x4991('0x31')](_0x50ef27[_0x4991('0x32')],_0x50ef27[_0x4991('0x2f')]);_0x3d1be4[_0x4991('0x33')]=_[_0x4991('0x31')](_0x50ef27['model'],qs[_0x4991('0x47')](_0x103311['query'][_0x4991('0x47')]));_0x3d1be4[_0x4991('0x33')]=_0x3d1be4['attributes'][_0x4991('0x48')]?_0x3d1be4[_0x4991('0x33')]:_0x50ef27[_0x4991('0x32')];if(_0x103311['query']['includeAll']){_0x3d1be4['include']=[{'all':!![]}];}_0x3d1be4=_[_0x4991('0x3a')]({},_0x3d1be4,_0x103311['options']);return db[_0x4991('0x3e')][_0x4991('0x49')](_0x3d1be4)[_0x4991('0x25')](handleEntityNotFound(_0x3e1f8e,null))['then'](respondWithResult(_0x3e1f8e,null))[_0x4991('0x42')](handleError(_0x3e1f8e,null));};exports[_0x4991('0x4a')]=function(_0x169685,_0x30f808){return db[_0x4991('0x3e')][_0x4991('0x4a')](_0x169685[_0x4991('0x4b')],{})[_0x4991('0x25')](respondWithResult(_0x30f808,0xc9))[_0x4991('0x42')](handleError(_0x30f808,null));};exports[_0x4991('0x24')]=function(_0x3dc7b2,_0xa59267){if(_0x3dc7b2['body']['id']){delete _0x3dc7b2[_0x4991('0x4b')]['id'];}return db[_0x4991('0x3e')][_0x4991('0x49')]({'where':{'id':_0x3dc7b2['params']['id']}})[_0x4991('0x25')](handleEntityNotFound(_0xa59267,null))[_0x4991('0x25')](saveUpdates(_0x3dc7b2[_0x4991('0x4b')],null))[_0x4991('0x25')](respondWithResult(_0xa59267,null))['catch'](handleError(_0xa59267,null));};exports[_0x4991('0x4c')]=function(_0x59af69,_0x727b8f){return db[_0x4991('0x3e')][_0x4991('0x49')]({'where':{'id':_0x59af69[_0x4991('0x44')]['id']}})[_0x4991('0x25')](handleEntityNotFound(_0x727b8f,null))[_0x4991('0x25')](removeEntity(_0x727b8f,null))[_0x4991('0x42')](handleError(_0x727b8f,null));};exports[_0x4991('0x4d')]=function(_0x16d75f,_0x3a132e,_0x167165){var _0x3a4bd2={};var _0x4df648={};var _0x182641;var _0x3f3178;return db[_0x4991('0x3e')]['findOne']({'where':{'id':_0x16d75f[_0x4991('0x44')]['id']}})[_0x4991('0x25')](handleEntityNotFound(_0x3a132e,null))[_0x4991('0x25')](function(_0x97e0f2){if(_0x97e0f2){_0x182641=_0x97e0f2;_0x4df648[_0x4991('0x32')]=_['keys'](db[_0x4991('0x4e')][_0x4991('0x45')]);_0x4df648[_0x4991('0x2f')]=_[_0x4991('0x46')](_0x16d75f['query']);_0x4df648[_0x4991('0x30')]=_['intersection'](_0x4df648[_0x4991('0x32')],_0x4df648[_0x4991('0x2f')]);_0x3a4bd2[_0x4991('0x33')]=_['intersection'](_0x4df648['model'],qs[_0x4991('0x47')](_0x16d75f[_0x4991('0x2f')][_0x4991('0x47')]));_0x3a4bd2[_0x4991('0x33')]=_0x3a4bd2[_0x4991('0x33')][_0x4991('0x48')]?_0x3a4bd2[_0x4991('0x33')]:_0x4df648[_0x4991('0x32')];_0x3a4bd2[_0x4991('0x35')]=qs[_0x4991('0x36')](_0x16d75f[_0x4991('0x2f')]['sort']);_0x3a4bd2[_0x4991('0x37')]=qs[_0x4991('0x30')](_[_0x4991('0x38')](_0x16d75f[_0x4991('0x2f')],_0x4df648[_0x4991('0x30')]));if(_0x16d75f[_0x4991('0x2f')][_0x4991('0x39')]){_0x3a4bd2[_0x4991('0x37')]=_[_0x4991('0x3a')](_0x3a4bd2[_0x4991('0x37')],{'$or':_[_0x4991('0x2c')](_0x3a4bd2['attributes'],function(_0x513364){var _0x1aa049={};_0x1aa049[_0x513364]={'$like':'%'+_0x16d75f['query']['filter']+'%'};return _0x1aa049;})});}_0x3a4bd2=_[_0x4991('0x3a')]({},_0x3a4bd2,_0x16d75f[_0x4991('0x3d')]);return _0x182641['getFields'](_0x3a4bd2);}})[_0x4991('0x25')](function(_0x13870c){if(_0x13870c){_0x3f3178=_0x13870c[_0x4991('0x48')];if(!_0x16d75f[_0x4991('0x2f')][_0x4991('0x34')](_0x4991('0x4f'))){_0x3a4bd2[_0x4991('0x1d')]=qs[_0x4991('0x1d')](_0x16d75f['query'][_0x4991('0x1d')]);_0x3a4bd2[_0x4991('0x1b')]=qs[_0x4991('0x1b')](_0x16d75f['query'][_0x4991('0x1b')]);}return _0x182641['getFields'](_0x3a4bd2);}})[_0x4991('0x25')](function(_0x2d691e){if(_0x2d691e){return _0x2d691e?{'count':_0x3f3178,'rows':_0x2d691e}:null;}})[_0x4991('0x25')](respondWithResult(_0x3a132e,null))[_0x4991('0x42')](handleError(_0x3a132e,null));};exports[_0x4991('0x50')]=function(_0x251253,_0x86ab92,_0x5f0efc){var _0x598663={};var _0x193065={};var _0x5cf21b;var _0x3c58fc;return db[_0x4991('0x3e')]['findOne']({'where':{'id':_0x251253[_0x4991('0x44')]['id']}})[_0x4991('0x25')](handleEntityNotFound(_0x86ab92,null))['then'](function(_0x332f57){if(_0x332f57){_0x5cf21b=_0x332f57;_0x193065[_0x4991('0x32')]=_[_0x4991('0x46')](db[_0x4991('0x4e')][_0x4991('0x45')]);_0x193065[_0x4991('0x2f')]=_[_0x4991('0x46')](_0x251253[_0x4991('0x2f')]);_0x193065['filters']=_[_0x4991('0x31')](_0x193065[_0x4991('0x32')],_0x193065['query']);_0x598663[_0x4991('0x33')]=_[_0x4991('0x31')](_0x193065[_0x4991('0x32')],qs[_0x4991('0x47')](_0x251253[_0x4991('0x2f')][_0x4991('0x47')]));_0x598663[_0x4991('0x33')]=_0x598663[_0x4991('0x33')][_0x4991('0x48')]?_0x598663['attributes']:_0x193065['model'];_0x598663[_0x4991('0x35')]=qs['sort'](_0x251253[_0x4991('0x2f')][_0x4991('0x36')]);_0x598663[_0x4991('0x37')]=qs[_0x4991('0x30')](_[_0x4991('0x38')](_0x251253[_0x4991('0x2f')],_0x193065[_0x4991('0x30')]));if(_0x251253[_0x4991('0x2f')][_0x4991('0x39')]){_0x598663['where']=_[_0x4991('0x3a')](_0x598663['where'],{'$or':_[_0x4991('0x2c')](_0x598663['attributes'],function(_0x1cc977){var _0x4de8e0={};_0x4de8e0[_0x1cc977]={'$like':'%'+_0x251253[_0x4991('0x2f')][_0x4991('0x39')]+'%'};return _0x4de8e0;})});}_0x598663=_[_0x4991('0x3a')]({},_0x598663,_0x251253[_0x4991('0x3d')]);return _0x5cf21b[_0x4991('0x50')](_0x598663);}})[_0x4991('0x25')](function(_0x565e4a){if(_0x565e4a){_0x3c58fc=_0x565e4a[_0x4991('0x48')];if(!_0x251253[_0x4991('0x2f')]['hasOwnProperty']('nolimit')){_0x598663[_0x4991('0x1d')]=qs[_0x4991('0x1d')](_0x251253[_0x4991('0x2f')][_0x4991('0x1d')]);_0x598663['offset']=qs[_0x4991('0x1b')](_0x251253['query'][_0x4991('0x1b')]);}return _0x5cf21b[_0x4991('0x50')](_0x598663);}})[_0x4991('0x25')](function(_0x5aed64){if(_0x5aed64){return _0x5aed64?{'count':_0x3c58fc,'rows':_0x5aed64}:null;}})[_0x4991('0x25')](respondWithResult(_0x86ab92,null))[_0x4991('0x42')](handleError(_0x86ab92,null));};exports['getDescriptions']=function(_0x3e794a,_0x23c44a,_0x633ebe){var _0x50202c={};var _0x5f4aa0={};var _0xc9d7f5;var _0x546b22;return db[_0x4991('0x3e')]['findOne']({'where':{'id':_0x3e794a[_0x4991('0x44')]['id']}})[_0x4991('0x25')](handleEntityNotFound(_0x23c44a,null))[_0x4991('0x25')](function(_0x2e720e){if(_0x2e720e){_0xc9d7f5=_0x2e720e;_0x5f4aa0[_0x4991('0x32')]=_['keys'](db[_0x4991('0x4e')][_0x4991('0x45')]);_0x5f4aa0[_0x4991('0x2f')]=_[_0x4991('0x46')](_0x3e794a[_0x4991('0x2f')]);_0x5f4aa0['filters']=_[_0x4991('0x31')](_0x5f4aa0[_0x4991('0x32')],_0x5f4aa0['query']);_0x50202c[_0x4991('0x33')]=_['intersection'](_0x5f4aa0[_0x4991('0x32')],qs[_0x4991('0x47')](_0x3e794a[_0x4991('0x2f')][_0x4991('0x47')]));_0x50202c['attributes']=_0x50202c[_0x4991('0x33')][_0x4991('0x48')]?_0x50202c[_0x4991('0x33')]:_0x5f4aa0[_0x4991('0x32')];_0x50202c[_0x4991('0x35')]=qs[_0x4991('0x36')](_0x3e794a[_0x4991('0x2f')]['sort']);_0x50202c[_0x4991('0x37')]=qs[_0x4991('0x30')](_['pick'](_0x3e794a[_0x4991('0x2f')],_0x5f4aa0[_0x4991('0x30')]));if(_0x3e794a[_0x4991('0x2f')][_0x4991('0x39')]){_0x50202c[_0x4991('0x37')]=_[_0x4991('0x3a')](_0x50202c[_0x4991('0x37')],{'$or':_[_0x4991('0x2c')](_0x50202c[_0x4991('0x33')],function(_0x26c50a){var _0x6c4e88={};_0x6c4e88[_0x26c50a]={'$like':'%'+_0x3e794a[_0x4991('0x2f')][_0x4991('0x39')]+'%'};return _0x6c4e88;})});}_0x50202c=_[_0x4991('0x3a')]({},_0x50202c,_0x3e794a['options']);return _0xc9d7f5[_0x4991('0x51')](_0x50202c);}})['then'](function(_0x5337b8){if(_0x5337b8){_0x546b22=_0x5337b8['length'];if(!_0x3e794a['query']['hasOwnProperty'](_0x4991('0x4f'))){_0x50202c[_0x4991('0x1d')]=qs[_0x4991('0x1d')](_0x3e794a[_0x4991('0x2f')]['limit']);_0x50202c[_0x4991('0x1b')]=qs[_0x4991('0x1b')](_0x3e794a[_0x4991('0x2f')][_0x4991('0x1b')]);}return _0xc9d7f5[_0x4991('0x51')](_0x50202c);}})[_0x4991('0x25')](function(_0x53059){if(_0x53059){return _0x53059?{'count':_0x546b22,'rows':_0x53059}:null;}})[_0x4991('0x25')](respondWithResult(_0x23c44a,null))[_0x4991('0x42')](handleError(_0x23c44a,null));};exports[_0x4991('0x52')]=function(_0x34e3f3,_0x119e7d,_0x12a094){var _0x259275={};var _0x320147={};var _0x4f5d21;var _0x87d385;return db[_0x4991('0x3e')][_0x4991('0x53')]({'where':{'id':_0x34e3f3[_0x4991('0x44')]['id']}})[_0x4991('0x25')](handleEntityNotFound(_0x119e7d,null))[_0x4991('0x25')](function(_0x53f942){if(_0x53f942){_0x4f5d21=_0x53f942;_0x320147['model']=_['keys'](db[_0x4991('0x54')][_0x4991('0x45')]);_0x320147['query']=_[_0x4991('0x46')](_0x34e3f3['query']);_0x320147['filters']=_[_0x4991('0x31')](_0x320147['model'],_0x320147['query']);_0x259275['attributes']=_['intersection'](_0x320147[_0x4991('0x32')],qs[_0x4991('0x47')](_0x34e3f3['query']['fields']));_0x259275['attributes']=_0x259275[_0x4991('0x33')][_0x4991('0x48')]?_0x259275[_0x4991('0x33')]:_0x320147['model'];_0x259275['order']=qs[_0x4991('0x36')](_0x34e3f3['query'][_0x4991('0x36')]);_0x259275[_0x4991('0x37')]=qs[_0x4991('0x30')](_[_0x4991('0x38')](_0x34e3f3[_0x4991('0x2f')],_0x320147[_0x4991('0x30')]));if(_0x34e3f3[_0x4991('0x2f')][_0x4991('0x39')]){_0x259275['where']=_[_0x4991('0x3a')](_0x259275['where'],{'$or':_[_0x4991('0x2c')](_0x259275[_0x4991('0x33')],function(_0x31a909){var _0x1b6b3e={};_0x1b6b3e[_0x31a909]={'$like':'%'+_0x34e3f3[_0x4991('0x2f')]['filter']+'%'};return _0x1b6b3e;})});}_0x259275=_[_0x4991('0x3a')]({},_0x259275,_0x34e3f3[_0x4991('0x3d')]);return _0x4f5d21[_0x4991('0x52')](_0x259275);}})['then'](function(_0x77d855){if(_0x77d855){_0x87d385=_0x77d855['length'];if(!_0x34e3f3[_0x4991('0x2f')][_0x4991('0x34')](_0x4991('0x4f'))){_0x259275[_0x4991('0x1d')]=qs[_0x4991('0x1d')](_0x34e3f3[_0x4991('0x2f')]['limit']);_0x259275[_0x4991('0x1b')]=qs['offset'](_0x34e3f3[_0x4991('0x2f')]['offset']);}return _0x4f5d21[_0x4991('0x52')](_0x259275);}})[_0x4991('0x25')](function(_0x1f4fa4){if(_0x1f4fa4){return _0x1f4fa4?{'count':_0x87d385,'rows':_0x1f4fa4}:null;}})[_0x4991('0x25')](respondWithResult(_0x119e7d,null))[_0x4991('0x42')](handleError(_0x119e7d,null));};exports[_0x4991('0x55')]=function(_0x5712d7,_0x1d5601,_0xf5061e){if(_0x5712d7[_0x4991('0x4b')]['id']){delete _0x5712d7[_0x4991('0x4b')]['id'];}return db[_0x4991('0x3e')][_0x4991('0x53')]({'where':{'id':_0x5712d7[_0x4991('0x44')]['id']}})[_0x4991('0x25')](handleEntityNotFound(_0x1d5601,null))[_0x4991('0x25')](function(_0x4596ae){if(_0x4596ae){return _0x4596ae[_0x4991('0x55')](_0x5712d7[_0x4991('0x4b')]['ids']||[]);}return null;})['then'](respondWithResult(_0x1d5601,null))[_0x4991('0x42')](handleError(_0x1d5601,null));}; \ No newline at end of file +var _0xf9e1=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','include','findAll','catch','show','length','find','body','params','getFields','findOne','intersection','pick','getSubjects','FreshdeskField','order','getDescriptions','getTags','Tag','setTags','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x20175a,_0x4903ab){var _0x1bf247=function(_0x212950){while(--_0x212950){_0x20175a['push'](_0x20175a['shift']());}};_0x1bf247(++_0x4903ab);}(_0xf9e1,0xe2));var _0x1f9e=function(_0x5614c0,_0xbeec05){_0x5614c0=_0x5614c0-0x0;var _0x3d31c3=_0xf9e1[_0x5614c0];return _0x3d31c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1f9e('0x0'));var zipdir=require(_0x1f9e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f9e('0x2'));var moment=require(_0x1f9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1f9e('0x4'));var util=require(_0x1f9e('0x5'));var path=require(_0x1f9e('0x6'));var sox=require('sox');var csv=require(_0x1f9e('0x7'));var ejs=require(_0x1f9e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f9e('0x9'));var squel=require(_0x1f9e('0xa'));var crypto=require(_0x1f9e('0xb'));var jsforce=require(_0x1f9e('0xc'));var deskjs=require(_0x1f9e('0xd'));var toCsv=require(_0x1f9e('0x7'));var querystring=require(_0x1f9e('0xe'));var Papa=require(_0x1f9e('0xf'));var Redis=require(_0x1f9e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1f9e('0x11'));var as=require(_0x1f9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f9e('0x13'))(_0x1f9e('0x14'));var utils=require(_0x1f9e('0x15'));var config=require(_0x1f9e('0x16'));var licenseUtil=require(_0x1f9e('0x17'));var db=require(_0x1f9e('0x18'))['db'];function respondWithStatusCode(_0x203c0d,_0x513d69){_0x513d69=_0x513d69||0xcc;return function(_0x4583a4){if(_0x4583a4){return _0x203c0d[_0x1f9e('0x19')](_0x513d69);}return _0x203c0d['status'](_0x513d69)[_0x1f9e('0x1a')]();};}function respondWithResult(_0x3987af,_0x1e91df){_0x1e91df=_0x1e91df||0xc8;return function(_0x1fcd32){if(_0x1fcd32){return _0x3987af[_0x1f9e('0x1b')](_0x1e91df)['json'](_0x1fcd32);}};}function respondWithFilteredResult(_0x4a6fa3,_0x246827){return function(_0x39d3ae){if(_0x39d3ae){var _0xe73c68=typeof _0x246827[_0x1f9e('0x1c')]==='undefined'&&typeof _0x246827[_0x1f9e('0x1d')]===_0x1f9e('0x1e');var _0x1fd39a=_0x39d3ae[_0x1f9e('0x1f')];var _0x1f03fc=_0xe73c68?0x0:_0x246827[_0x1f9e('0x1c')];var _0x638d5a=_0xe73c68?_0x39d3ae['count']:_0x246827['offset']+_0x246827[_0x1f9e('0x1d')];var _0x4d6ae0;if(_0x638d5a>=_0x1fd39a){_0x638d5a=_0x1fd39a;_0x4d6ae0=0xc8;}else{_0x4d6ae0=0xce;}_0x4a6fa3[_0x1f9e('0x1b')](_0x4d6ae0);return _0x4a6fa3['set'](_0x1f9e('0x20'),_0x1f03fc+'-'+_0x638d5a+'/'+_0x1fd39a)[_0x1f9e('0x21')](_0x39d3ae);}return null;};}function patchUpdates(_0x4b0103){return function(_0x4bbad7){try{jsonpatch[_0x1f9e('0x22')](_0x4bbad7,_0x4b0103,!![]);}catch(_0x23315e){return BPromise[_0x1f9e('0x23')](_0x23315e);}return _0x4bbad7[_0x1f9e('0x24')]();};}function saveUpdates(_0x123263,_0x3f2b99){return function(_0x2dd1f0){if(_0x2dd1f0){return _0x2dd1f0[_0x1f9e('0x25')](_0x123263)[_0x1f9e('0x26')](function(_0x5ec0ec){return _0x5ec0ec;});}return null;};}function removeEntity(_0x5a83e6,_0x3ad764){return function(_0x47d822){if(_0x47d822){return _0x47d822[_0x1f9e('0x27')]()[_0x1f9e('0x26')](function(){_0x5a83e6['status'](0xcc)[_0x1f9e('0x1a')]();});}};}function handleEntityNotFound(_0x7719e5,_0x5c1f75){return function(_0x167717){if(!_0x167717){_0x7719e5[_0x1f9e('0x19')](0x194);}return _0x167717;};}function handleError(_0x4e452e,_0x284e62){_0x284e62=_0x284e62||0x1f4;return function(_0x401042){logger[_0x1f9e('0x28')](_0x401042[_0x1f9e('0x29')]);if(_0x401042[_0x1f9e('0x2a')]){delete _0x401042[_0x1f9e('0x2a')];}_0x4e452e[_0x1f9e('0x1b')](_0x284e62)[_0x1f9e('0x2b')](_0x401042);};}exports['index']=function(_0x22d1ce,_0x1d3470){var _0x397edf={},_0x5c2e1e={},_0x3277a7={'count':0x0,'rows':[]};var _0xaa4a28=_[_0x1f9e('0x2c')](db[_0x1f9e('0x2d')][_0x1f9e('0x2e')],function(_0x5bb485){return{'name':_0x5bb485[_0x1f9e('0x2f')],'type':_0x5bb485['type'][_0x1f9e('0x30')]};});_0x5c2e1e[_0x1f9e('0x31')]=_[_0x1f9e('0x2c')](_0xaa4a28,_0x1f9e('0x2a'));_0x5c2e1e['query']=_[_0x1f9e('0x32')](_0x22d1ce[_0x1f9e('0x33')]);_0x5c2e1e[_0x1f9e('0x34')]=_['intersection'](_0x5c2e1e[_0x1f9e('0x31')],_0x5c2e1e[_0x1f9e('0x33')]);_0x397edf[_0x1f9e('0x35')]=_['intersection'](_0x5c2e1e[_0x1f9e('0x31')],qs[_0x1f9e('0x36')](_0x22d1ce[_0x1f9e('0x33')]['fields']));_0x397edf[_0x1f9e('0x35')]=_0x397edf[_0x1f9e('0x35')]['length']?_0x397edf[_0x1f9e('0x35')]:_0x5c2e1e[_0x1f9e('0x31')];if(!_0x22d1ce['query'][_0x1f9e('0x37')](_0x1f9e('0x38'))){_0x397edf[_0x1f9e('0x1d')]=qs['limit'](_0x22d1ce[_0x1f9e('0x33')]['limit']);_0x397edf[_0x1f9e('0x1c')]=qs['offset'](_0x22d1ce[_0x1f9e('0x33')]['offset']);}_0x397edf['order']=qs[_0x1f9e('0x39')](_0x22d1ce['query'][_0x1f9e('0x39')]);_0x397edf['where']=qs[_0x1f9e('0x34')](_['pick'](_0x22d1ce[_0x1f9e('0x33')],_0x5c2e1e[_0x1f9e('0x34')]),_0xaa4a28);if(_0x22d1ce[_0x1f9e('0x33')]['filter']){_0x397edf[_0x1f9e('0x3a')]=_[_0x1f9e('0x3b')](_0x397edf[_0x1f9e('0x3a')],{'$or':_['map'](_0xaa4a28,function(_0x5f4f63){if(_0x5f4f63['type']!==_0x1f9e('0x3c')){var _0xe57ea4={};_0xe57ea4[_0x5f4f63[_0x1f9e('0x2a')]]={'$like':'%'+_0x22d1ce['query'][_0x1f9e('0x3d')]+'%'};return _0xe57ea4;}})});}_0x397edf=_[_0x1f9e('0x3b')]({},_0x397edf,_0x22d1ce[_0x1f9e('0x3e')]);var _0x5eb0c0={'where':_0x397edf[_0x1f9e('0x3a')]};return db[_0x1f9e('0x2d')]['count'](_0x5eb0c0)['then'](function(_0x6f0fbd){_0x3277a7[_0x1f9e('0x1f')]=_0x6f0fbd;if(_0x22d1ce[_0x1f9e('0x33')]['includeAll']){_0x397edf[_0x1f9e('0x3f')]=[{'all':!![]}];}return db[_0x1f9e('0x2d')][_0x1f9e('0x40')](_0x397edf);})[_0x1f9e('0x26')](function(_0x49eb10){_0x3277a7['rows']=_0x49eb10;return _0x3277a7;})['then'](respondWithFilteredResult(_0x1d3470,_0x397edf))[_0x1f9e('0x41')](handleError(_0x1d3470,null));};exports[_0x1f9e('0x42')]=function(_0x402e8d,_0x5e7811){var _0xc445d0={'raw':![],'where':{'id':_0x402e8d['params']['id']}},_0x475883={};_0x475883[_0x1f9e('0x31')]=_['keys'](db[_0x1f9e('0x2d')][_0x1f9e('0x2e')]);_0x475883[_0x1f9e('0x33')]=_[_0x1f9e('0x32')](_0x402e8d['query']);_0x475883['filters']=_['intersection'](_0x475883[_0x1f9e('0x31')],_0x475883[_0x1f9e('0x33')]);_0xc445d0[_0x1f9e('0x35')]=_['intersection'](_0x475883[_0x1f9e('0x31')],qs[_0x1f9e('0x36')](_0x402e8d[_0x1f9e('0x33')]['fields']));_0xc445d0[_0x1f9e('0x35')]=_0xc445d0[_0x1f9e('0x35')][_0x1f9e('0x43')]?_0xc445d0[_0x1f9e('0x35')]:_0x475883['model'];if(_0x402e8d[_0x1f9e('0x33')]['includeAll']){_0xc445d0[_0x1f9e('0x3f')]=[{'all':!![]}];}_0xc445d0=_[_0x1f9e('0x3b')]({},_0xc445d0,_0x402e8d[_0x1f9e('0x3e')]);return db['FreshdeskConfiguration'][_0x1f9e('0x44')](_0xc445d0)[_0x1f9e('0x26')](handleEntityNotFound(_0x5e7811,null))[_0x1f9e('0x26')](respondWithResult(_0x5e7811,null))[_0x1f9e('0x41')](handleError(_0x5e7811,null));};exports['create']=function(_0x4b4186,_0x156b59){return db['FreshdeskConfiguration']['create'](_0x4b4186['body'],{})['then'](respondWithResult(_0x156b59,0xc9))[_0x1f9e('0x41')](handleError(_0x156b59,null));};exports[_0x1f9e('0x25')]=function(_0x48e4d7,_0x481179){if(_0x48e4d7[_0x1f9e('0x45')]['id']){delete _0x48e4d7[_0x1f9e('0x45')]['id'];}return db[_0x1f9e('0x2d')]['find']({'where':{'id':_0x48e4d7[_0x1f9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x481179,null))[_0x1f9e('0x26')](saveUpdates(_0x48e4d7[_0x1f9e('0x45')],null))['then'](respondWithResult(_0x481179,null))[_0x1f9e('0x41')](handleError(_0x481179,null));};exports[_0x1f9e('0x27')]=function(_0x5afccf,_0x30cd1a){return db['FreshdeskConfiguration'][_0x1f9e('0x44')]({'where':{'id':_0x5afccf[_0x1f9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x30cd1a,null))['then'](removeEntity(_0x30cd1a,null))[_0x1f9e('0x41')](handleError(_0x30cd1a,null));};exports[_0x1f9e('0x47')]=function(_0xafe7d0,_0x3da1b0,_0x2cea5d){var _0x3a61b0={};var _0x37a177={};var _0x47e98d;var _0x2d33f1;return db[_0x1f9e('0x2d')][_0x1f9e('0x48')]({'where':{'id':_0xafe7d0[_0x1f9e('0x46')]['id']}})[_0x1f9e('0x26')](handleEntityNotFound(_0x3da1b0,null))[_0x1f9e('0x26')](function(_0x159beb){if(_0x159beb){_0x47e98d=_0x159beb;_0x37a177[_0x1f9e('0x31')]=_[_0x1f9e('0x32')](db['FreshdeskField']['rawAttributes']);_0x37a177[_0x1f9e('0x33')]=_[_0x1f9e('0x32')](_0xafe7d0[_0x1f9e('0x33')]);_0x37a177['filters']=_[_0x1f9e('0x49')](_0x37a177[_0x1f9e('0x31')],_0x37a177[_0x1f9e('0x33')]);_0x3a61b0[_0x1f9e('0x35')]=_['intersection'](_0x37a177[_0x1f9e('0x31')],qs[_0x1f9e('0x36')](_0xafe7d0[_0x1f9e('0x33')][_0x1f9e('0x36')]));_0x3a61b0[_0x1f9e('0x35')]=_0x3a61b0[_0x1f9e('0x35')][_0x1f9e('0x43')]?_0x3a61b0[_0x1f9e('0x35')]:_0x37a177[_0x1f9e('0x31')];_0x3a61b0['order']=qs['sort'](_0xafe7d0['query'][_0x1f9e('0x39')]);_0x3a61b0[_0x1f9e('0x3a')]=qs[_0x1f9e('0x34')](_[_0x1f9e('0x4a')](_0xafe7d0[_0x1f9e('0x33')],_0x37a177[_0x1f9e('0x34')]));if(_0xafe7d0[_0x1f9e('0x33')][_0x1f9e('0x3d')]){_0x3a61b0[_0x1f9e('0x3a')]=_[_0x1f9e('0x3b')](_0x3a61b0['where'],{'$or':_['map'](_0x3a61b0['attributes'],function(_0x327971){var _0xeb62bd={};_0xeb62bd[_0x327971]={'$like':'%'+_0xafe7d0[_0x1f9e('0x33')][_0x1f9e('0x3d')]+'%'};return _0xeb62bd;})});}_0x3a61b0=_[_0x1f9e('0x3b')]({},_0x3a61b0,_0xafe7d0[_0x1f9e('0x3e')]);return _0x47e98d[_0x1f9e('0x47')](_0x3a61b0);}})['then'](function(_0x348f09){if(_0x348f09){_0x2d33f1=_0x348f09[_0x1f9e('0x43')];if(!_0xafe7d0['query'][_0x1f9e('0x37')]('nolimit')){_0x3a61b0['limit']=qs['limit'](_0xafe7d0[_0x1f9e('0x33')][_0x1f9e('0x1d')]);_0x3a61b0['offset']=qs[_0x1f9e('0x1c')](_0xafe7d0[_0x1f9e('0x33')]['offset']);}return _0x47e98d[_0x1f9e('0x47')](_0x3a61b0);}})['then'](function(_0x5616f3){if(_0x5616f3){return _0x5616f3?{'count':_0x2d33f1,'rows':_0x5616f3}:null;}})[_0x1f9e('0x26')](respondWithResult(_0x3da1b0,null))[_0x1f9e('0x41')](handleError(_0x3da1b0,null));};exports[_0x1f9e('0x4b')]=function(_0x3bed2c,_0x5c56ff,_0x34b296){var _0x1c7999={};var _0x317b24={};var _0xb1bc39;var _0x3215ea;return db[_0x1f9e('0x2d')][_0x1f9e('0x48')]({'where':{'id':_0x3bed2c[_0x1f9e('0x46')]['id']}})[_0x1f9e('0x26')](handleEntityNotFound(_0x5c56ff,null))['then'](function(_0x35fa60){if(_0x35fa60){_0xb1bc39=_0x35fa60;_0x317b24[_0x1f9e('0x31')]=_[_0x1f9e('0x32')](db[_0x1f9e('0x4c')][_0x1f9e('0x2e')]);_0x317b24[_0x1f9e('0x33')]=_[_0x1f9e('0x32')](_0x3bed2c['query']);_0x317b24['filters']=_['intersection'](_0x317b24['model'],_0x317b24[_0x1f9e('0x33')]);_0x1c7999[_0x1f9e('0x35')]=_[_0x1f9e('0x49')](_0x317b24[_0x1f9e('0x31')],qs[_0x1f9e('0x36')](_0x3bed2c['query'][_0x1f9e('0x36')]));_0x1c7999[_0x1f9e('0x35')]=_0x1c7999[_0x1f9e('0x35')][_0x1f9e('0x43')]?_0x1c7999[_0x1f9e('0x35')]:_0x317b24[_0x1f9e('0x31')];_0x1c7999[_0x1f9e('0x4d')]=qs[_0x1f9e('0x39')](_0x3bed2c[_0x1f9e('0x33')][_0x1f9e('0x39')]);_0x1c7999[_0x1f9e('0x3a')]=qs[_0x1f9e('0x34')](_[_0x1f9e('0x4a')](_0x3bed2c[_0x1f9e('0x33')],_0x317b24[_0x1f9e('0x34')]));if(_0x3bed2c['query']['filter']){_0x1c7999['where']=_[_0x1f9e('0x3b')](_0x1c7999[_0x1f9e('0x3a')],{'$or':_[_0x1f9e('0x2c')](_0x1c7999['attributes'],function(_0xbab0c){var _0x46d7f3={};_0x46d7f3[_0xbab0c]={'$like':'%'+_0x3bed2c[_0x1f9e('0x33')][_0x1f9e('0x3d')]+'%'};return _0x46d7f3;})});}_0x1c7999=_['merge']({},_0x1c7999,_0x3bed2c[_0x1f9e('0x3e')]);return _0xb1bc39[_0x1f9e('0x4b')](_0x1c7999);}})[_0x1f9e('0x26')](function(_0x22dc46){if(_0x22dc46){_0x3215ea=_0x22dc46[_0x1f9e('0x43')];if(!_0x3bed2c[_0x1f9e('0x33')][_0x1f9e('0x37')](_0x1f9e('0x38'))){_0x1c7999[_0x1f9e('0x1d')]=qs['limit'](_0x3bed2c['query'][_0x1f9e('0x1d')]);_0x1c7999[_0x1f9e('0x1c')]=qs[_0x1f9e('0x1c')](_0x3bed2c['query'][_0x1f9e('0x1c')]);}return _0xb1bc39[_0x1f9e('0x4b')](_0x1c7999);}})[_0x1f9e('0x26')](function(_0x4d111b){if(_0x4d111b){return _0x4d111b?{'count':_0x3215ea,'rows':_0x4d111b}:null;}})[_0x1f9e('0x26')](respondWithResult(_0x5c56ff,null))['catch'](handleError(_0x5c56ff,null));};exports[_0x1f9e('0x4e')]=function(_0x1c34eb,_0xb4620d,_0x3f291b){var _0xf225f0={};var _0x216d98={};var _0x634092;var _0x2213a3;return db['FreshdeskConfiguration'][_0x1f9e('0x48')]({'where':{'id':_0x1c34eb[_0x1f9e('0x46')]['id']}})[_0x1f9e('0x26')](handleEntityNotFound(_0xb4620d,null))[_0x1f9e('0x26')](function(_0x5f06f8){if(_0x5f06f8){_0x634092=_0x5f06f8;_0x216d98[_0x1f9e('0x31')]=_[_0x1f9e('0x32')](db[_0x1f9e('0x4c')][_0x1f9e('0x2e')]);_0x216d98[_0x1f9e('0x33')]=_[_0x1f9e('0x32')](_0x1c34eb[_0x1f9e('0x33')]);_0x216d98[_0x1f9e('0x34')]=_[_0x1f9e('0x49')](_0x216d98[_0x1f9e('0x31')],_0x216d98[_0x1f9e('0x33')]);_0xf225f0['attributes']=_['intersection'](_0x216d98['model'],qs[_0x1f9e('0x36')](_0x1c34eb['query'][_0x1f9e('0x36')]));_0xf225f0[_0x1f9e('0x35')]=_0xf225f0['attributes'][_0x1f9e('0x43')]?_0xf225f0[_0x1f9e('0x35')]:_0x216d98[_0x1f9e('0x31')];_0xf225f0[_0x1f9e('0x4d')]=qs[_0x1f9e('0x39')](_0x1c34eb[_0x1f9e('0x33')]['sort']);_0xf225f0[_0x1f9e('0x3a')]=qs[_0x1f9e('0x34')](_['pick'](_0x1c34eb['query'],_0x216d98['filters']));if(_0x1c34eb['query']['filter']){_0xf225f0[_0x1f9e('0x3a')]=_[_0x1f9e('0x3b')](_0xf225f0[_0x1f9e('0x3a')],{'$or':_['map'](_0xf225f0[_0x1f9e('0x35')],function(_0x107efa){var _0x59001c={};_0x59001c[_0x107efa]={'$like':'%'+_0x1c34eb[_0x1f9e('0x33')][_0x1f9e('0x3d')]+'%'};return _0x59001c;})});}_0xf225f0=_['merge']({},_0xf225f0,_0x1c34eb[_0x1f9e('0x3e')]);return _0x634092['getDescriptions'](_0xf225f0);}})[_0x1f9e('0x26')](function(_0x1f27a5){if(_0x1f27a5){_0x2213a3=_0x1f27a5[_0x1f9e('0x43')];if(!_0x1c34eb[_0x1f9e('0x33')][_0x1f9e('0x37')](_0x1f9e('0x38'))){_0xf225f0[_0x1f9e('0x1d')]=qs[_0x1f9e('0x1d')](_0x1c34eb[_0x1f9e('0x33')][_0x1f9e('0x1d')]);_0xf225f0[_0x1f9e('0x1c')]=qs[_0x1f9e('0x1c')](_0x1c34eb[_0x1f9e('0x33')][_0x1f9e('0x1c')]);}return _0x634092[_0x1f9e('0x4e')](_0xf225f0);}})[_0x1f9e('0x26')](function(_0x4bf351){if(_0x4bf351){return _0x4bf351?{'count':_0x2213a3,'rows':_0x4bf351}:null;}})[_0x1f9e('0x26')](respondWithResult(_0xb4620d,null))[_0x1f9e('0x41')](handleError(_0xb4620d,null));};exports[_0x1f9e('0x4f')]=function(_0x48eea5,_0x2c5421,_0x5b5049){var _0x5133a4={};var _0x2bade4={};var _0x41c03a;var _0x51b0e5;return db[_0x1f9e('0x2d')][_0x1f9e('0x48')]({'where':{'id':_0x48eea5[_0x1f9e('0x46')]['id']}})[_0x1f9e('0x26')](handleEntityNotFound(_0x2c5421,null))[_0x1f9e('0x26')](function(_0x181c28){if(_0x181c28){_0x41c03a=_0x181c28;_0x2bade4['model']=_['keys'](db[_0x1f9e('0x50')][_0x1f9e('0x2e')]);_0x2bade4[_0x1f9e('0x33')]=_[_0x1f9e('0x32')](_0x48eea5['query']);_0x2bade4[_0x1f9e('0x34')]=_[_0x1f9e('0x49')](_0x2bade4[_0x1f9e('0x31')],_0x2bade4[_0x1f9e('0x33')]);_0x5133a4[_0x1f9e('0x35')]=_[_0x1f9e('0x49')](_0x2bade4[_0x1f9e('0x31')],qs['fields'](_0x48eea5[_0x1f9e('0x33')]['fields']));_0x5133a4[_0x1f9e('0x35')]=_0x5133a4[_0x1f9e('0x35')][_0x1f9e('0x43')]?_0x5133a4[_0x1f9e('0x35')]:_0x2bade4[_0x1f9e('0x31')];_0x5133a4[_0x1f9e('0x4d')]=qs[_0x1f9e('0x39')](_0x48eea5[_0x1f9e('0x33')][_0x1f9e('0x39')]);_0x5133a4[_0x1f9e('0x3a')]=qs['filters'](_[_0x1f9e('0x4a')](_0x48eea5['query'],_0x2bade4['filters']));if(_0x48eea5['query']['filter']){_0x5133a4[_0x1f9e('0x3a')]=_[_0x1f9e('0x3b')](_0x5133a4[_0x1f9e('0x3a')],{'$or':_[_0x1f9e('0x2c')](_0x5133a4[_0x1f9e('0x35')],function(_0x4020f8){var _0x3e779a={};_0x3e779a[_0x4020f8]={'$like':'%'+_0x48eea5[_0x1f9e('0x33')]['filter']+'%'};return _0x3e779a;})});}_0x5133a4=_['merge']({},_0x5133a4,_0x48eea5[_0x1f9e('0x3e')]);return _0x41c03a[_0x1f9e('0x4f')](_0x5133a4);}})[_0x1f9e('0x26')](function(_0x181558){if(_0x181558){_0x51b0e5=_0x181558['length'];if(!_0x48eea5[_0x1f9e('0x33')][_0x1f9e('0x37')](_0x1f9e('0x38'))){_0x5133a4[_0x1f9e('0x1d')]=qs[_0x1f9e('0x1d')](_0x48eea5[_0x1f9e('0x33')]['limit']);_0x5133a4['offset']=qs['offset'](_0x48eea5[_0x1f9e('0x33')][_0x1f9e('0x1c')]);}return _0x41c03a[_0x1f9e('0x4f')](_0x5133a4);}})['then'](function(_0x38f3e8){if(_0x38f3e8){return _0x38f3e8?{'count':_0x51b0e5,'rows':_0x38f3e8}:null;}})['then'](respondWithResult(_0x2c5421,null))[_0x1f9e('0x41')](handleError(_0x2c5421,null));};exports[_0x1f9e('0x51')]=function(_0x5da42c,_0x269bd6,_0x17db48){if(_0x5da42c[_0x1f9e('0x45')]['id']){delete _0x5da42c[_0x1f9e('0x45')]['id'];}return db[_0x1f9e('0x2d')]['findOne']({'where':{'id':_0x5da42c[_0x1f9e('0x46')]['id']}})[_0x1f9e('0x26')](handleEntityNotFound(_0x269bd6,null))[_0x1f9e('0x26')](function(_0x5d7e5c){if(_0x5d7e5c){return _0x5d7e5c['setTags'](_0x5da42c[_0x1f9e('0x45')]['ids']||[]);}return null;})['then'](respondWithResult(_0x269bd6,null))[_0x1f9e('0x41')](handleError(_0x269bd6,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 6f821ae..2431736 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 _0x7f84=['define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x141521,_0x25c2bc){var _0xc758c7=function(_0x256ee9){while(--_0x256ee9){_0x141521['push'](_0x141521['shift']());}};_0xc758c7(++_0x25c2bc);}(_0x7f84,0x6b));var _0x47f8=function(_0x1887e6,_0x577cbd){_0x1887e6=_0x1887e6-0x0;var _0x4160e2=_0x7f84[_0x1887e6];return _0x4160e2;};'use strict';var _=require(_0x47f8('0x0'));var util=require(_0x47f8('0x1'));var logger=require(_0x47f8('0x2'))('api');var moment=require(_0x47f8('0x3'));var BPromise=require('bluebird');var rp=require(_0x47f8('0x4'));var fs=require('fs');var path=require(_0x47f8('0x5'));var rimraf=require(_0x47f8('0x6'));var config=require(_0x47f8('0x7'));var attributes=require(_0x47f8('0x8'));module[_0x47f8('0x9')]=function(_0x3eda9a,_0x4af795){return _0x3eda9a[_0x47f8('0xa')](_0x47f8('0xb'),attributes,{'tableName':_0x47f8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb436=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','lodash','util'];(function(_0x2e7a5a,_0x45f664){var _0x33be9e=function(_0x563338){while(--_0x563338){_0x2e7a5a['push'](_0x2e7a5a['shift']());}};_0x33be9e(++_0x45f664);}(_0xb436,0x82));var _0x6b43=function(_0x3e5f6d,_0x121db6){_0x3e5f6d=_0x3e5f6d-0x0;var _0x1bea6e=_0xb436[_0x3e5f6d];return _0x1bea6e;};'use strict';var _=require(_0x6b43('0x0'));var util=require(_0x6b43('0x1'));var logger=require(_0x6b43('0x2'))(_0x6b43('0x3'));var moment=require(_0x6b43('0x4'));var BPromise=require(_0x6b43('0x5'));var rp=require(_0x6b43('0x6'));var fs=require('fs');var path=require(_0x6b43('0x7'));var rimraf=require(_0x6b43('0x8'));var config=require('../../config/environment');var attributes=require(_0x6b43('0x9'));module[_0x6b43('0xa')]=function(_0x4fcbcd,_0x4e0e06){return _0x4fcbcd['define'](_0x6b43('0xb'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 97724c3..2f7fb77 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 _0x7300=['jayson/promise','client','http','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2118a9,_0x5a0cb8){var _0x236850=function(_0x264eef){while(--_0x264eef){_0x2118a9['push'](_0x2118a9['shift']());}};_0x236850(++_0x5a0cb8);}(_0x7300,0xb6));var _0x0730=function(_0x32e11e,_0x3fbe97){_0x32e11e=_0x32e11e-0x0;var _0x466b5b=_0x7300[_0x32e11e];return _0x466b5b;};'use strict';var _=require(_0x0730('0x0'));var util=require(_0x0730('0x1'));var moment=require(_0x0730('0x2'));var BPromise=require(_0x0730('0x3'));var rs=require(_0x0730('0x4'));var fs=require('fs');var Redis=require(_0x0730('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0730('0x6'));var logger=require(_0x0730('0x7'))(_0x0730('0x8'));var config=require(_0x0730('0x9'));var jayson=require(_0x0730('0xa'));var client=jayson[_0x0730('0xb')][_0x0730('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x560ed8,_0x1379cf,_0x40c31e){return new BPromise(function(_0x39c078,_0x34f488){return client['request'](_0x560ed8,_0x40c31e)[_0x0730('0xd')](function(_0xfec49d){logger[_0x0730('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1379cf,_0x0730('0xf'));logger[_0x0730('0x10')](_0x0730('0x11'),_0x1379cf,_0x0730('0xf'),JSON['stringify'](_0xfec49d));if(_0xfec49d[_0x0730('0x12')]){if(_0xfec49d[_0x0730('0x12')][_0x0730('0x13')]===0x1f4){logger[_0x0730('0x12')](_0x0730('0x14'),_0x1379cf,_0xfec49d[_0x0730('0x12')]['message']);return _0x34f488(_0xfec49d[_0x0730('0x12')][_0x0730('0x15')]);}logger[_0x0730('0x12')](_0x0730('0x14'),_0x1379cf,_0xfec49d[_0x0730('0x12')][_0x0730('0x15')]);return _0x39c078(_0xfec49d[_0x0730('0x12')]['message']);}else{logger[_0x0730('0xe')](_0x0730('0x14'),_0x1379cf,_0x0730('0xf'));_0x39c078(_0xfec49d[_0x0730('0x16')]['message']);}})[_0x0730('0x17')](function(_0x33ac7c){logger['error'](_0x0730('0x14'),_0x1379cf,_0x33ac7c);_0x34f488(_0x33ac7c);});});} \ No newline at end of file +var _0x519a=['code','message','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','error'];(function(_0x2db78d,_0x2c9bfe){var _0x156ebd=function(_0x2a0810){while(--_0x2a0810){_0x2db78d['push'](_0x2db78d['shift']());}};_0x156ebd(++_0x2c9bfe);}(_0x519a,0x156));var _0xa519=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x519a[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0xa519('0x0'));var util=require(_0xa519('0x1'));var moment=require(_0xa519('0x2'));var BPromise=require(_0xa519('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa519('0x4'))['db'];var utils=require(_0xa519('0x5'));var logger=require(_0xa519('0x6'))(_0xa519('0x7'));var config=require(_0xa519('0x8'));var jayson=require(_0xa519('0x9'));var client=jayson[_0xa519('0xa')][_0xa519('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28cbd6,_0xe8d30b,_0x36750e){return new BPromise(function(_0x5b523f,_0x592f08){return client[_0xa519('0xc')](_0x28cbd6,_0x36750e)[_0xa519('0xd')](function(_0x5e8189){logger[_0xa519('0xe')](_0xa519('0xf'),_0xe8d30b,_0xa519('0x10'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0xe8d30b,_0xa519('0x10'),JSON['stringify'](_0x5e8189));if(_0x5e8189[_0xa519('0x11')]){if(_0x5e8189['error'][_0xa519('0x12')]===0x1f4){logger['error'](_0xa519('0xf'),_0xe8d30b,_0x5e8189['error'][_0xa519('0x13')]);return _0x592f08(_0x5e8189[_0xa519('0x11')][_0xa519('0x13')]);}logger[_0xa519('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xe8d30b,_0x5e8189[_0xa519('0x11')][_0xa519('0x13')]);return _0x5b523f(_0x5e8189[_0xa519('0x11')]['message']);}else{logger[_0xa519('0xe')](_0xa519('0xf'),_0xe8d30b,_0xa519('0x10'));_0x5b523f(_0x5e8189['result'][_0xa519('0x13')]);}})['catch'](function(_0x16d5a9){logger[_0xa519('0x11')](_0xa519('0xf'),_0xe8d30b,_0x16d5a9);_0x592f08(_0x16d5a9);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index ffa7594..a44cdef 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 _0x1739=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','index','/:id','show','post','isAuthenticated','create','put','update'];(function(_0x2dd673,_0x198e54){var _0x24c434=function(_0x533b16){while(--_0x533b16){_0x2dd673['push'](_0x2dd673['shift']());}};_0x24c434(++_0x198e54);}(_0x1739,0xe7));var _0x9173=function(_0x230aea,_0x4d7408){_0x230aea=_0x230aea-0x0;var _0x2879d6=_0x1739[_0x230aea];return _0x2879d6;};'use strict';var multer=require('multer');var util=require(_0x9173('0x0'));var path=require(_0x9173('0x1'));var timeout=require(_0x9173('0x2'));var express=require(_0x9173('0x3'));var router=express[_0x9173('0x4')]();var fs_extra=require(_0x9173('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9173('0x6'));var controller=require('./intFreshdeskField.controller');router[_0x9173('0x7')]('/',auth['isAuthenticated'](),controller[_0x9173('0x8')]);router['get'](_0x9173('0x9'),auth['isAuthenticated'](),controller[_0x9173('0xa')]);router[_0x9173('0xb')]('/',auth[_0x9173('0xc')](),controller[_0x9173('0xd')]);router[_0x9173('0xe')]('/:id',auth[_0x9173('0xc')](),controller[_0x9173('0xf')]);router[_0x9173('0x10')](_0x9173('0x9'),auth[_0x9173('0xc')](),controller[_0x9173('0x11')]);module[_0x9173('0x12')]=router; \ No newline at end of file +var _0xcedf=['./intFreshdeskField.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x356e9f,_0x5bdb1e){var _0x3a1f98=function(_0x447739){while(--_0x447739){_0x356e9f['push'](_0x356e9f['shift']());}};_0x3a1f98(++_0x5bdb1e);}(_0xcedf,0x115));var _0xfced=function(_0x4e7f47,_0x390860){_0x4e7f47=_0x4e7f47-0x0;var _0x5d933c=_0xcedf[_0x4e7f47];return _0x5d933c;};'use strict';var multer=require(_0xfced('0x0'));var util=require(_0xfced('0x1'));var path=require(_0xfced('0x2'));var timeout=require(_0xfced('0x3'));var express=require(_0xfced('0x4'));var router=express[_0xfced('0x5')]();var fs_extra=require(_0xfced('0x6'));var auth=require(_0xfced('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfced('0x8'));router[_0xfced('0x9')]('/',auth['isAuthenticated'](),controller[_0xfced('0xa')]);router[_0xfced('0x9')](_0xfced('0xb'),auth[_0xfced('0xc')](),controller[_0xfced('0xd')]);router['post']('/',auth[_0xfced('0xc')](),controller[_0xfced('0xe')]);router[_0xfced('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xfced('0x10')]);router[_0xfced('0x11')]('/:id',auth[_0xfced('0xc')](),controller['destroy']);module[_0xfced('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 467f359..1121e78 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 _0x6198=['variable','customVariable','keyValue','picklist','STRING','string','exports','ENUM'];(function(_0x3e32ae,_0x3a9db1){var _0xe4f0c0=function(_0xe9794){while(--_0xe9794){_0x3e32ae['push'](_0x3e32ae['shift']());}};_0xe4f0c0(++_0x3a9db1);}(_0x6198,0x156));var _0x8619=function(_0x281c4d,_0x485fb2){_0x281c4d=_0x281c4d-0x0;var _0x3f3944=_0x6198[_0x281c4d];return _0x3f3944;};'use strict';var Sequelize=require('sequelize');module[_0x8619('0x0')]={'type':{'type':Sequelize[_0x8619('0x1')]('string',_0x8619('0x2'),_0x8619('0x3'),_0x8619('0x4'),_0x8619('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8619('0x6')]},'keyType':{'type':Sequelize[_0x8619('0x1')](_0x8619('0x7'),_0x8619('0x2'),_0x8619('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8619('0x6')]},'nameField':{'type':Sequelize[_0x8619('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0ef4=['string','STRING','customVariable','sequelize','exports','ENUM','variable','keyValue','picklist'];(function(_0x1f48e5,_0x451e6e){var _0x342f42=function(_0x520482){while(--_0x520482){_0x1f48e5['push'](_0x1f48e5['shift']());}};_0x342f42(++_0x451e6e);}(_0x0ef4,0xdb));var _0x40ef=function(_0x204ad4,_0x502841){_0x204ad4=_0x204ad4-0x0;var _0x50675f=_0x0ef4[_0x204ad4];return _0x50675f;};'use strict';var Sequelize=require(_0x40ef('0x0'));module[_0x40ef('0x1')]={'type':{'type':Sequelize[_0x40ef('0x2')]('string',_0x40ef('0x3'),'customVariable',_0x40ef('0x4'),_0x40ef('0x5')),'defaultValue':_0x40ef('0x6')},'content':{'type':Sequelize[_0x40ef('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x40ef('0x2')](_0x40ef('0x6'),_0x40ef('0x3'),_0x40ef('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x40ef('0x7')]},'nameField':{'type':Sequelize[_0x40ef('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index e9d6b4b..63e988d 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 _0x1bca=['index','map','fieldName','key','model','keys','filters','intersection','fields','attributes','query','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','create','FreshdeskField','body','find','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','error','stack','send'];(function(_0x42eeaf,_0x51cf32){var _0x3cc639=function(_0x4b1caa){while(--_0x4b1caa){_0x42eeaf['push'](_0x42eeaf['shift']());}};_0x3cc639(++_0x51cf32);}(_0x1bca,0xb6));var _0xa1bc=function(_0xdbc13,_0x1925de){_0xdbc13=_0xdbc13-0x0;var _0x45ff7b=_0x1bca[_0xdbc13];return _0x45ff7b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa1bc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa1bc('0x1'));var moment=require('moment');var BPromise=require(_0xa1bc('0x2'));var Mustache=require(_0xa1bc('0x3'));var util=require(_0xa1bc('0x4'));var path=require('path');var sox=require(_0xa1bc('0x5'));var csv=require(_0xa1bc('0x6'));var ejs=require(_0xa1bc('0x7'));var fs=require('fs');var fs_extra=require(_0xa1bc('0x8'));var _=require('lodash');var squel=require(_0xa1bc('0x9'));var crypto=require(_0xa1bc('0xa'));var jsforce=require(_0xa1bc('0xb'));var deskjs=require(_0xa1bc('0xc'));var toCsv=require(_0xa1bc('0x6'));var querystring=require(_0xa1bc('0xd'));var Papa=require(_0xa1bc('0xe'));var Redis=require('ioredis');var authService=require(_0xa1bc('0xf'));var qs=require(_0xa1bc('0x10'));var as=require(_0xa1bc('0x11'));var hardwareService=require(_0xa1bc('0x12'));var logger=require(_0xa1bc('0x13'))(_0xa1bc('0x14'));var utils=require(_0xa1bc('0x15'));var config=require(_0xa1bc('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f65bc,_0x37913b){_0x37913b=_0x37913b||0xcc;return function(_0x2b38cf){if(_0x2b38cf){return _0x1f65bc[_0xa1bc('0x17')](_0x37913b);}return _0x1f65bc[_0xa1bc('0x18')](_0x37913b)[_0xa1bc('0x19')]();};}function respondWithResult(_0x165acf,_0x2c5f01){_0x2c5f01=_0x2c5f01||0xc8;return function(_0xe0d028){if(_0xe0d028){return _0x165acf[_0xa1bc('0x18')](_0x2c5f01)[_0xa1bc('0x1a')](_0xe0d028);}};}function respondWithFilteredResult(_0x5a22e0,_0x565bc2){return function(_0xdb513d){if(_0xdb513d){var _0xf8c08e=typeof _0x565bc2[_0xa1bc('0x1b')]===_0xa1bc('0x1c')&&typeof _0x565bc2[_0xa1bc('0x1d')]===_0xa1bc('0x1c');var _0x36b899=_0xdb513d[_0xa1bc('0x1e')];var _0x4765be=_0xf8c08e?0x0:_0x565bc2['offset'];var _0x510046=_0xf8c08e?_0xdb513d[_0xa1bc('0x1e')]:_0x565bc2[_0xa1bc('0x1b')]+_0x565bc2[_0xa1bc('0x1d')];var _0x2b0410;if(_0x510046>=_0x36b899){_0x510046=_0x36b899;_0x2b0410=0xc8;}else{_0x2b0410=0xce;}_0x5a22e0['status'](_0x2b0410);return _0x5a22e0['set'](_0xa1bc('0x1f'),_0x4765be+'-'+_0x510046+'/'+_0x36b899)[_0xa1bc('0x1a')](_0xdb513d);}return null;};}function patchUpdates(_0x322703){return function(_0x95a766){try{jsonpatch[_0xa1bc('0x20')](_0x95a766,_0x322703,!![]);}catch(_0x3e8cd7){return BPromise['reject'](_0x3e8cd7);}return _0x95a766[_0xa1bc('0x21')]();};}function saveUpdates(_0xc81195,_0x1e4f4e){return function(_0x4fdf7d){if(_0x4fdf7d){return _0x4fdf7d[_0xa1bc('0x22')](_0xc81195)['then'](function(_0x10636d){return _0x10636d;});}return null;};}function removeEntity(_0x44f952,_0x23d67d){return function(_0x2a77a2){if(_0x2a77a2){return _0x2a77a2[_0xa1bc('0x23')]()[_0xa1bc('0x24')](function(){_0x44f952['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cc2e0,_0x3a87f4){return function(_0x5eff38){if(!_0x5eff38){_0x3cc2e0[_0xa1bc('0x17')](0x194);}return _0x5eff38;};}function handleError(_0x31d31c,_0x14e37b){_0x14e37b=_0x14e37b||0x1f4;return function(_0x2a0348){logger[_0xa1bc('0x25')](_0x2a0348[_0xa1bc('0x26')]);if(_0x2a0348['name']){delete _0x2a0348['name'];}_0x31d31c[_0xa1bc('0x18')](_0x14e37b)[_0xa1bc('0x27')](_0x2a0348);};}exports[_0xa1bc('0x28')]=function(_0x1270f5,_0x16a9d7){var _0x4ae5d0={},_0x228fc8={},_0x512608={'count':0x0,'rows':[]};var _0x332201=_[_0xa1bc('0x29')](db['FreshdeskField']['rawAttributes'],function(_0x4a120c){return{'name':_0x4a120c[_0xa1bc('0x2a')],'type':_0x4a120c['type'][_0xa1bc('0x2b')]};});_0x228fc8[_0xa1bc('0x2c')]=_[_0xa1bc('0x29')](_0x332201,'name');_0x228fc8['query']=_[_0xa1bc('0x2d')](_0x1270f5['query']);_0x228fc8[_0xa1bc('0x2e')]=_[_0xa1bc('0x2f')](_0x228fc8[_0xa1bc('0x2c')],_0x228fc8['query']);_0x4ae5d0['attributes']=_['intersection'](_0x228fc8[_0xa1bc('0x2c')],qs[_0xa1bc('0x30')](_0x1270f5['query'][_0xa1bc('0x30')]));_0x4ae5d0[_0xa1bc('0x31')]=_0x4ae5d0[_0xa1bc('0x31')]['length']?_0x4ae5d0[_0xa1bc('0x31')]:_0x228fc8[_0xa1bc('0x2c')];if(!_0x1270f5[_0xa1bc('0x32')]['hasOwnProperty'](_0xa1bc('0x33'))){_0x4ae5d0[_0xa1bc('0x1d')]=qs[_0xa1bc('0x1d')](_0x1270f5[_0xa1bc('0x32')][_0xa1bc('0x1d')]);_0x4ae5d0[_0xa1bc('0x1b')]=qs[_0xa1bc('0x1b')](_0x1270f5[_0xa1bc('0x32')]['offset']);}_0x4ae5d0[_0xa1bc('0x34')]=qs[_0xa1bc('0x35')](_0x1270f5[_0xa1bc('0x32')][_0xa1bc('0x35')]);_0x4ae5d0['where']=qs[_0xa1bc('0x2e')](_[_0xa1bc('0x36')](_0x1270f5['query'],_0x228fc8[_0xa1bc('0x2e')]),_0x332201);if(_0x1270f5[_0xa1bc('0x32')][_0xa1bc('0x37')]){_0x4ae5d0[_0xa1bc('0x38')]=_[_0xa1bc('0x39')](_0x4ae5d0['where'],{'$or':_[_0xa1bc('0x29')](_0x332201,function(_0x14c645){if(_0x14c645[_0xa1bc('0x3a')]!==_0xa1bc('0x3b')){var _0x3abf84={};_0x3abf84[_0x14c645['name']]={'$like':'%'+_0x1270f5[_0xa1bc('0x32')][_0xa1bc('0x37')]+'%'};return _0x3abf84;}})});}_0x4ae5d0=_[_0xa1bc('0x39')]({},_0x4ae5d0,_0x1270f5[_0xa1bc('0x3c')]);var _0xf9b275={'where':_0x4ae5d0['where']};return db['FreshdeskField']['count'](_0xf9b275)[_0xa1bc('0x24')](function(_0x57160e){_0x512608[_0xa1bc('0x1e')]=_0x57160e;if(_0x1270f5[_0xa1bc('0x32')][_0xa1bc('0x3d')]){_0x4ae5d0[_0xa1bc('0x3e')]=[{'all':!![]}];}return db['FreshdeskField'][_0xa1bc('0x3f')](_0x4ae5d0);})['then'](function(_0x482d37){_0x512608[_0xa1bc('0x40')]=_0x482d37;return _0x512608;})['then'](respondWithFilteredResult(_0x16a9d7,_0x4ae5d0))[_0xa1bc('0x41')](handleError(_0x16a9d7,null));};exports[_0xa1bc('0x42')]=function(_0x5d6c5c,_0x1d8e3c){var _0x5cd49d={'raw':!![],'where':{'id':_0x5d6c5c[_0xa1bc('0x43')]['id']}},_0x1544c8={};_0x1544c8[_0xa1bc('0x2c')]=_[_0xa1bc('0x2d')](db['FreshdeskField'][_0xa1bc('0x44')]);_0x1544c8[_0xa1bc('0x32')]=_['keys'](_0x5d6c5c[_0xa1bc('0x32')]);_0x1544c8[_0xa1bc('0x2e')]=_[_0xa1bc('0x2f')](_0x1544c8[_0xa1bc('0x2c')],_0x1544c8[_0xa1bc('0x32')]);_0x5cd49d[_0xa1bc('0x31')]=_[_0xa1bc('0x2f')](_0x1544c8[_0xa1bc('0x2c')],qs[_0xa1bc('0x30')](_0x5d6c5c[_0xa1bc('0x32')][_0xa1bc('0x30')]));_0x5cd49d[_0xa1bc('0x31')]=_0x5cd49d[_0xa1bc('0x31')][_0xa1bc('0x45')]?_0x5cd49d['attributes']:_0x1544c8[_0xa1bc('0x2c')];if(_0x5d6c5c['query'][_0xa1bc('0x3d')]){_0x5cd49d[_0xa1bc('0x3e')]=[{'all':!![]}];}_0x5cd49d=_[_0xa1bc('0x39')]({},_0x5cd49d,_0x5d6c5c[_0xa1bc('0x3c')]);return db['FreshdeskField']['find'](_0x5cd49d)['then'](handleEntityNotFound(_0x1d8e3c,null))['then'](respondWithResult(_0x1d8e3c,null))['catch'](handleError(_0x1d8e3c,null));};exports[_0xa1bc('0x46')]=function(_0x5cc542,_0x2dfad5){return db[_0xa1bc('0x47')][_0xa1bc('0x46')](_0x5cc542[_0xa1bc('0x48')],{})['then'](respondWithResult(_0x2dfad5,0xc9))[_0xa1bc('0x41')](handleError(_0x2dfad5,null));};exports[_0xa1bc('0x22')]=function(_0x3fa784,_0x3eb3d7){if(_0x3fa784[_0xa1bc('0x48')]['id']){delete _0x3fa784['body']['id'];}return db[_0xa1bc('0x47')][_0xa1bc('0x49')]({'where':{'id':_0x3fa784[_0xa1bc('0x43')]['id']}})[_0xa1bc('0x24')](handleEntityNotFound(_0x3eb3d7,null))['then'](saveUpdates(_0x3fa784['body'],null))['then'](respondWithResult(_0x3eb3d7,null))[_0xa1bc('0x41')](handleError(_0x3eb3d7,null));};exports[_0xa1bc('0x23')]=function(_0x5b3b1,_0x274684){return db[_0xa1bc('0x47')]['find']({'where':{'id':_0x5b3b1['params']['id']}})[_0xa1bc('0x24')](handleEntityNotFound(_0x274684,null))[_0xa1bc('0x24')](removeEntity(_0x274684,null))[_0xa1bc('0x41')](handleError(_0x274684,null));}; \ No newline at end of file +var _0x422f=['update','destroy','then','error','stack','name','map','FreshdeskField','fieldName','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','type','VIRTUAL','findAll','rows','show','params','rawAttributes','length','includeAll','include','merge','options','find','body','catch','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','reject','save'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0x422f,0x1c7));var _0xf422=function(_0x3c919e,_0x1a2b1e){_0x3c919e=_0x3c919e-0x0;var _0x4e304c=_0x422f[_0x3c919e];return _0x4e304c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf422('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf422('0x1'));var rp=require(_0xf422('0x2'));var moment=require('moment');var BPromise=require(_0xf422('0x3'));var Mustache=require(_0xf422('0x4'));var util=require(_0xf422('0x5'));var path=require(_0xf422('0x6'));var sox=require(_0xf422('0x7'));var csv=require(_0xf422('0x8'));var ejs=require(_0xf422('0x9'));var fs=require('fs');var fs_extra=require(_0xf422('0xa'));var _=require(_0xf422('0xb'));var squel=require('squel');var crypto=require(_0xf422('0xc'));var jsforce=require(_0xf422('0xd'));var deskjs=require(_0xf422('0xe'));var toCsv=require(_0xf422('0x8'));var querystring=require(_0xf422('0xf'));var Papa=require('papaparse');var Redis=require(_0xf422('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf422('0x11'));var hardwareService=require(_0xf422('0x12'));var logger=require(_0xf422('0x13'))(_0xf422('0x14'));var utils=require(_0xf422('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf422('0x16'));var db=require(_0xf422('0x17'))['db'];function respondWithStatusCode(_0x4d56d1,_0x133a6a){_0x133a6a=_0x133a6a||0xcc;return function(_0x8aa9cc){if(_0x8aa9cc){return _0x4d56d1[_0xf422('0x18')](_0x133a6a);}return _0x4d56d1[_0xf422('0x19')](_0x133a6a)[_0xf422('0x1a')]();};}function respondWithResult(_0x28a6a8,_0x223b21){_0x223b21=_0x223b21||0xc8;return function(_0x272430){if(_0x272430){return _0x28a6a8[_0xf422('0x19')](_0x223b21)['json'](_0x272430);}};}function respondWithFilteredResult(_0x54bb9c,_0x52f96b){return function(_0x1c81e1){if(_0x1c81e1){var _0x30b70a=typeof _0x52f96b[_0xf422('0x1b')]===_0xf422('0x1c')&&typeof _0x52f96b['limit']===_0xf422('0x1c');var _0x264964=_0x1c81e1[_0xf422('0x1d')];var _0x2ae133=_0x30b70a?0x0:_0x52f96b[_0xf422('0x1b')];var _0x29b0b1=_0x30b70a?_0x1c81e1['count']:_0x52f96b['offset']+_0x52f96b[_0xf422('0x1e')];var _0x4b657;if(_0x29b0b1>=_0x264964){_0x29b0b1=_0x264964;_0x4b657=0xc8;}else{_0x4b657=0xce;}_0x54bb9c[_0xf422('0x19')](_0x4b657);return _0x54bb9c['set'](_0xf422('0x1f'),_0x2ae133+'-'+_0x29b0b1+'/'+_0x264964)['json'](_0x1c81e1);}return null;};}function patchUpdates(_0x22afe7){return function(_0x15833b){try{jsonpatch[_0xf422('0x20')](_0x15833b,_0x22afe7,!![]);}catch(_0x4d6717){return BPromise[_0xf422('0x21')](_0x4d6717);}return _0x15833b[_0xf422('0x22')]();};}function saveUpdates(_0x511529,_0x4b80a0){return function(_0x268575){if(_0x268575){return _0x268575[_0xf422('0x23')](_0x511529)['then'](function(_0x25b6a5){return _0x25b6a5;});}return null;};}function removeEntity(_0x570ea2,_0x3b21a5){return function(_0x32ceee){if(_0x32ceee){return _0x32ceee[_0xf422('0x24')]()[_0xf422('0x25')](function(){_0x570ea2[_0xf422('0x19')](0xcc)[_0xf422('0x1a')]();});}};}function handleEntityNotFound(_0xd8d70f,_0x11d10b){return function(_0x5dcab4){if(!_0x5dcab4){_0xd8d70f[_0xf422('0x18')](0x194);}return _0x5dcab4;};}function handleError(_0x59d03d,_0x2f0f9f){_0x2f0f9f=_0x2f0f9f||0x1f4;return function(_0x7d36e7){logger[_0xf422('0x26')](_0x7d36e7[_0xf422('0x27')]);if(_0x7d36e7[_0xf422('0x28')]){delete _0x7d36e7[_0xf422('0x28')];}_0x59d03d[_0xf422('0x19')](_0x2f0f9f)['send'](_0x7d36e7);};}exports['index']=function(_0x35d1fa,_0x10d51b){var _0x266fb8={},_0x33ef63={},_0xefb99e={'count':0x0,'rows':[]};var _0x48e0c7=_[_0xf422('0x29')](db[_0xf422('0x2a')]['rawAttributes'],function(_0x5f0186){return{'name':_0x5f0186[_0xf422('0x2b')],'type':_0x5f0186['type']['key']};});_0x33ef63[_0xf422('0x2c')]=_[_0xf422('0x29')](_0x48e0c7,'name');_0x33ef63[_0xf422('0x2d')]=_[_0xf422('0x2e')](_0x35d1fa[_0xf422('0x2d')]);_0x33ef63[_0xf422('0x2f')]=_[_0xf422('0x30')](_0x33ef63['model'],_0x33ef63[_0xf422('0x2d')]);_0x266fb8['attributes']=_[_0xf422('0x30')](_0x33ef63[_0xf422('0x2c')],qs[_0xf422('0x31')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x31')]));_0x266fb8[_0xf422('0x32')]=_0x266fb8[_0xf422('0x32')]['length']?_0x266fb8['attributes']:_0x33ef63[_0xf422('0x2c')];if(!_0x35d1fa[_0xf422('0x2d')]['hasOwnProperty'](_0xf422('0x33'))){_0x266fb8[_0xf422('0x1e')]=qs[_0xf422('0x1e')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x1e')]);_0x266fb8[_0xf422('0x1b')]=qs[_0xf422('0x1b')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x1b')]);}_0x266fb8[_0xf422('0x34')]=qs[_0xf422('0x35')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x35')]);_0x266fb8[_0xf422('0x36')]=qs['filters'](_['pick'](_0x35d1fa['query'],_0x33ef63[_0xf422('0x2f')]),_0x48e0c7);if(_0x35d1fa[_0xf422('0x2d')]['filter']){_0x266fb8[_0xf422('0x36')]=_['merge'](_0x266fb8[_0xf422('0x36')],{'$or':_[_0xf422('0x29')](_0x48e0c7,function(_0x55ac68){if(_0x55ac68[_0xf422('0x37')]!==_0xf422('0x38')){var _0x174f6f={};_0x174f6f[_0x55ac68['name']]={'$like':'%'+_0x35d1fa[_0xf422('0x2d')]['filter']+'%'};return _0x174f6f;}})});}_0x266fb8=_['merge']({},_0x266fb8,_0x35d1fa['options']);var _0x112bce={'where':_0x266fb8[_0xf422('0x36')]};return db[_0xf422('0x2a')][_0xf422('0x1d')](_0x112bce)[_0xf422('0x25')](function(_0x2f82a0){_0xefb99e[_0xf422('0x1d')]=_0x2f82a0;if(_0x35d1fa[_0xf422('0x2d')]['includeAll']){_0x266fb8['include']=[{'all':!![]}];}return db[_0xf422('0x2a')][_0xf422('0x39')](_0x266fb8);})[_0xf422('0x25')](function(_0xb3955){_0xefb99e[_0xf422('0x3a')]=_0xb3955;return _0xefb99e;})[_0xf422('0x25')](respondWithFilteredResult(_0x10d51b,_0x266fb8))['catch'](handleError(_0x10d51b,null));};exports[_0xf422('0x3b')]=function(_0x4f453a,_0x17c1f2){var _0x391e3c={'raw':!![],'where':{'id':_0x4f453a[_0xf422('0x3c')]['id']}},_0x564041={};_0x564041[_0xf422('0x2c')]=_[_0xf422('0x2e')](db[_0xf422('0x2a')][_0xf422('0x3d')]);_0x564041['query']=_[_0xf422('0x2e')](_0x4f453a[_0xf422('0x2d')]);_0x564041[_0xf422('0x2f')]=_[_0xf422('0x30')](_0x564041[_0xf422('0x2c')],_0x564041['query']);_0x391e3c[_0xf422('0x32')]=_[_0xf422('0x30')](_0x564041['model'],qs[_0xf422('0x31')](_0x4f453a['query'][_0xf422('0x31')]));_0x391e3c[_0xf422('0x32')]=_0x391e3c[_0xf422('0x32')][_0xf422('0x3e')]?_0x391e3c[_0xf422('0x32')]:_0x564041[_0xf422('0x2c')];if(_0x4f453a[_0xf422('0x2d')][_0xf422('0x3f')]){_0x391e3c[_0xf422('0x40')]=[{'all':!![]}];}_0x391e3c=_[_0xf422('0x41')]({},_0x391e3c,_0x4f453a[_0xf422('0x42')]);return db[_0xf422('0x2a')][_0xf422('0x43')](_0x391e3c)[_0xf422('0x25')](handleEntityNotFound(_0x17c1f2,null))[_0xf422('0x25')](respondWithResult(_0x17c1f2,null))['catch'](handleError(_0x17c1f2,null));};exports['create']=function(_0x3c59dd,_0x2c2ce9){return db[_0xf422('0x2a')]['create'](_0x3c59dd[_0xf422('0x44')],{})[_0xf422('0x25')](respondWithResult(_0x2c2ce9,0xc9))[_0xf422('0x45')](handleError(_0x2c2ce9,null));};exports[_0xf422('0x23')]=function(_0x1f3a30,_0x259e24){if(_0x1f3a30[_0xf422('0x44')]['id']){delete _0x1f3a30['body']['id'];}return db[_0xf422('0x2a')]['find']({'where':{'id':_0x1f3a30[_0xf422('0x3c')]['id']}})[_0xf422('0x25')](handleEntityNotFound(_0x259e24,null))['then'](saveUpdates(_0x1f3a30[_0xf422('0x44')],null))[_0xf422('0x25')](respondWithResult(_0x259e24,null))[_0xf422('0x45')](handleError(_0x259e24,null));};exports[_0xf422('0x24')]=function(_0x2df71a,_0x5c3cb8){return db['FreshdeskField'][_0xf422('0x43')]({'where':{'id':_0x2df71a['params']['id']}})[_0xf422('0x25')](handleEntityNotFound(_0x5c3cb8,null))[_0xf422('0x25')](removeEntity(_0x5c3cb8,null))[_0xf422('0x45')](handleError(_0x5c3cb8,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index f361db5..32ced11 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 _0x1429=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x37fa2b,_0x3adbf7){var _0x44efee=function(_0x5bf7ce){while(--_0x5bf7ce){_0x37fa2b['push'](_0x37fa2b['shift']());}};_0x44efee(++_0x3adbf7);}(_0x1429,0x1d9));var _0x9142=function(_0x270dfb,_0x334d80){_0x270dfb=_0x270dfb-0x0;var _0x18b18f=_0x1429[_0x270dfb];return _0x18b18f;};'use strict';var _=require(_0x9142('0x0'));var util=require(_0x9142('0x1'));var logger=require(_0x9142('0x2'))(_0x9142('0x3'));var moment=require(_0x9142('0x4'));var BPromise=require(_0x9142('0x5'));var rp=require(_0x9142('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9142('0x7'));var config=require(_0x9142('0x8'));var attributes=require(_0x9142('0x9'));module[_0x9142('0xa')]=function(_0x324675,_0x370c18){return _0x324675[_0x9142('0xb')](_0x9142('0xc'),attributes,{'tableName':_0x9142('0xd'),'paranoid':![],'indexes':[{'name':_0x9142('0xe'),'fields':[_0x9142('0xf'),_0x9142('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf864=['../../config/logger','api','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index','FieldId','lodash'];(function(_0x21c7f6,_0xe9551f){var _0x288a27=function(_0x53085){while(--_0x53085){_0x21c7f6['push'](_0x21c7f6['shift']());}};_0x288a27(++_0xe9551f);}(_0xf864,0x11f));var _0x4f86=function(_0xc040ed,_0x220631){_0xc040ed=_0xc040ed-0x0;var _0x56819a=_0xf864[_0xc040ed];return _0x56819a;};'use strict';var _=require(_0x4f86('0x0'));var util=require('util');var logger=require(_0x4f86('0x1'))(_0x4f86('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f86('0x3'));var rimraf=require(_0x4f86('0x4'));var config=require(_0x4f86('0x5'));var attributes=require(_0x4f86('0x6'));module[_0x4f86('0x7')]=function(_0x262f8e,_0x312753){return _0x262f8e[_0x4f86('0x8')](_0x4f86('0x9'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x4f86('0xa'),'fields':['idField',_0x4f86('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 105be83..7b461e2 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 _0x53ef=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x52845c,_0x2981c4){var _0x4382cc=function(_0x47d6f0){while(--_0x47d6f0){_0x52845c['push'](_0x52845c['shift']());}};_0x4382cc(++_0x2981c4);}(_0x53ef,0xbd));var _0xf53e=function(_0x53b8e0,_0x55d46e){_0x53b8e0=_0x53b8e0-0x0;var _0x10630c=_0x53ef[_0x53b8e0];return _0x10630c;};'use strict';var _=require(_0xf53e('0x0'));var util=require(_0xf53e('0x1'));var moment=require(_0xf53e('0x2'));var BPromise=require(_0xf53e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf53e('0x4'))['db'];var utils=require(_0xf53e('0x5'));var logger=require(_0xf53e('0x6'))('rpc');var config=require(_0xf53e('0x7'));var jayson=require(_0xf53e('0x8'));var client=jayson['client'][_0xf53e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x566936,_0x4ab1c1,_0x37b3ac){return new BPromise(function(_0x42b079,_0x4c8abd){return client[_0xf53e('0xa')](_0x566936,_0x37b3ac)[_0xf53e('0xb')](function(_0xa6e2a5){logger['info'](_0xf53e('0xc'),_0x4ab1c1,_0xf53e('0xd'));logger[_0xf53e('0xe')](_0xf53e('0xf'),_0x4ab1c1,'request\x20sent',JSON['stringify'](_0xa6e2a5));if(_0xa6e2a5[_0xf53e('0x10')]){if(_0xa6e2a5[_0xf53e('0x10')][_0xf53e('0x11')]===0x1f4){logger[_0xf53e('0x10')](_0xf53e('0xc'),_0x4ab1c1,_0xa6e2a5[_0xf53e('0x10')][_0xf53e('0x12')]);return _0x4c8abd(_0xa6e2a5[_0xf53e('0x10')][_0xf53e('0x12')]);}logger[_0xf53e('0x10')](_0xf53e('0xc'),_0x4ab1c1,_0xa6e2a5['error'][_0xf53e('0x12')]);return _0x42b079(_0xa6e2a5[_0xf53e('0x10')]['message']);}else{logger['info'](_0xf53e('0xc'),_0x4ab1c1,'request\x20sent');_0x42b079(_0xa6e2a5[_0xf53e('0x13')][_0xf53e('0x12')]);}})[_0xf53e('0x14')](function(_0x52f5cf){logger[_0xf53e('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x4ab1c1,_0x52f5cf);_0x4c8abd(_0x52f5cf);});});} \ No newline at end of file +var _0x88ed=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x27e422,_0x523813){var _0x5e400d=function(_0x5a236c){while(--_0x5a236c){_0x27e422['push'](_0x27e422['shift']());}};_0x5e400d(++_0x523813);}(_0x88ed,0x70));var _0xd88e=function(_0x41d5ee,_0x2a7dfe){_0x41d5ee=_0x41d5ee-0x0;var _0x41fbb5=_0x88ed[_0x41d5ee];return _0x41fbb5;};'use strict';var _=require(_0xd88e('0x0'));var util=require(_0xd88e('0x1'));var moment=require(_0xd88e('0x2'));var BPromise=require(_0xd88e('0x3'));var rs=require(_0xd88e('0x4'));var fs=require('fs');var Redis=require(_0xd88e('0x5'));var db=require(_0xd88e('0x6'))['db'];var utils=require(_0xd88e('0x7'));var logger=require(_0xd88e('0x8'))('rpc');var config=require(_0xd88e('0x9'));var jayson=require(_0xd88e('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x419691,_0x265aa0,_0x4b30f8){return new BPromise(function(_0x144762,_0x158b15){return client[_0xd88e('0xb')](_0x419691,_0x4b30f8)['then'](function(_0x28ed62){logger[_0xd88e('0xc')](_0xd88e('0xd'),_0x265aa0,_0xd88e('0xe'));logger[_0xd88e('0xf')](_0xd88e('0x10'),_0x265aa0,_0xd88e('0xe'),JSON[_0xd88e('0x11')](_0x28ed62));if(_0x28ed62[_0xd88e('0x12')]){if(_0x28ed62[_0xd88e('0x12')][_0xd88e('0x13')]===0x1f4){logger[_0xd88e('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x265aa0,_0x28ed62['error']['message']);return _0x158b15(_0x28ed62[_0xd88e('0x12')][_0xd88e('0x14')]);}logger[_0xd88e('0x12')](_0xd88e('0xd'),_0x265aa0,_0x28ed62[_0xd88e('0x12')][_0xd88e('0x14')]);return _0x144762(_0x28ed62[_0xd88e('0x12')]['message']);}else{logger['info'](_0xd88e('0xd'),_0x265aa0,_0xd88e('0xe'));_0x144762(_0x28ed62[_0xd88e('0x15')][_0xd88e('0x14')]);}})[_0xd88e('0x16')](function(_0x5eb938){logger[_0xd88e('0x12')](_0xd88e('0xd'),_0x265aa0,_0x5eb938);_0x158b15(_0x5eb938);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index e4dc702..4eba8e8 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 _0x0713=['destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','delete'];(function(_0xc45b5,_0xe7aaed){var _0x576a93=function(_0x19a0d5){while(--_0x19a0d5){_0xc45b5['push'](_0xc45b5['shift']());}};_0x576a93(++_0xe7aaed);}(_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['getConfigurations']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')]('/',auth['isAuthenticated'](),controller[_0x3071('0x11')]);router[_0x3071('0x10')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x12')]);router['put']('/:id',auth[_0x3071('0x9')](),controller['update']);router[_0x3071('0x13')](_0x3071('0xb'),auth['isAuthenticated'](),controller[_0x3071('0x14')]);module['exports']=router; \ No newline at end of file +var _0x757a=['destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','index','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','/:id','delete'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x757a,0xde));var _0xa757=function(_0x527f83,_0x5651d1){_0x527f83=_0x527f83-0x0;var _0x5a3c31=_0x757a[_0x527f83];return _0x5a3c31;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['getConfigurations']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0xe')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xf')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0xa757('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xa757('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa757('0x12')]);module[_0xa757('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 5788d0b..748f05c 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 _0x5464=['remoteUri','sequelize','exports','STRING'];(function(_0x2dfd07,_0x2ebd46){var _0x3f31b6=function(_0x5872c7){while(--_0x5872c7){_0x2dfd07['push'](_0x2dfd07['shift']());}};_0x3f31b6(++_0x2ebd46);}(_0x5464,0x15d));var _0x4546=function(_0xea1408,_0x4265ad){_0xea1408=_0xea1408-0x0;var _0x40e8c6=_0x5464[_0xea1408];return _0x40e8c6;};'use strict';var Sequelize=require(_0x4546('0x0'));module[_0x4546('0x1')]={'name':{'type':Sequelize[_0x4546('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4546('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x4546('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x4546('0x3')},'serverUrl':{'type':Sequelize[_0x4546('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xef0f=['sequelize','STRING','remoteUri'];(function(_0x9d5b97,_0x8fcb17){var _0x59695b=function(_0x1390bd){while(--_0x1390bd){_0x9d5b97['push'](_0x9d5b97['shift']());}};_0x59695b(++_0x8fcb17);}(_0xef0f,0x168));var _0xfef0=function(_0x1742fb,_0xff8e96){_0x1742fb=_0x1742fb-0x0;var _0x141eed=_0xef0f[_0x1742fb];return _0x141eed;};'use strict';var Sequelize=require(_0xfef0('0x0'));module['exports']={'name':{'type':Sequelize[_0xfef0('0x1')]},'description':{'type':Sequelize[_0xfef0('0x1')]},'username':{'type':Sequelize[_0xfef0('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0xfef0('0x1')]},'remoteUri':{'type':Sequelize[_0xfef0('0x1')],'unique':_0xfef0('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 9ccc4a6..54bec82 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 _0xfa7e=['stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','then','include','rows','show','params','keys','includeAll','create','body','update','find','catch','getConfigurations','findOne','FreshsalesConfiguration','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','Subjects','username','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s%s','/api/selector/owners','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','end','error'];(function(_0x42d82,_0x3e885d){var _0x5eb00c=function(_0x47dab7){while(--_0x47dab7){_0x42d82['push'](_0x42d82['shift']());}};_0x5eb00c(++_0x3e885d);}(_0xfa7e,0x106));var _0xefa7=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0xfa7e[_0x238671];return _0x474844;};'use strict';var emlformat=require(_0xefa7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xefa7('0x1'));var jsonpatch=require(_0xefa7('0x2'));var rp=require(_0xefa7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xefa7('0x4'));var path=require(_0xefa7('0x5'));var sox=require(_0xefa7('0x6'));var csv=require(_0xefa7('0x7'));var ejs=require(_0xefa7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xefa7('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xefa7('0xa'));var toCsv=require(_0xefa7('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xefa7('0xb'));var authService=require(_0xefa7('0xc'));var qs=require(_0xefa7('0xd'));var as=require(_0xefa7('0xe'));var hardwareService=require(_0xefa7('0xf'));var logger=require('../../config/logger')(_0xefa7('0x10'));var utils=require(_0xefa7('0x11'));var config=require(_0xefa7('0x12'));var licenseUtil=require(_0xefa7('0x13'));var db=require(_0xefa7('0x14'))['db'];var integrations=require(_0xefa7('0x15'));function respondWithStatusCode(_0x142939,_0x5e8267){_0x5e8267=_0x5e8267||0xcc;return function(_0x23f3a9){if(_0x23f3a9){return _0x142939[_0xefa7('0x16')](_0x5e8267);}return _0x142939['status'](_0x5e8267)['end']();};}function respondWithResult(_0x1d03bd,_0x50108c){_0x50108c=_0x50108c||0xc8;return function(_0x1e0478){if(_0x1e0478){return _0x1d03bd[_0xefa7('0x17')](_0x50108c)['json'](_0x1e0478);}};}function respondWithFilteredResult(_0x3d6f1b,_0x5f5252){return function(_0x46719c){if(_0x46719c){var _0x284d76=typeof _0x5f5252[_0xefa7('0x18')]===_0xefa7('0x19')&&typeof _0x5f5252[_0xefa7('0x1a')]===_0xefa7('0x19');var _0x3c53b1=_0x46719c[_0xefa7('0x1b')];var _0x2ba013=_0x284d76?0x0:_0x5f5252[_0xefa7('0x18')];var _0x54e098=_0x284d76?_0x46719c[_0xefa7('0x1b')]:_0x5f5252[_0xefa7('0x18')]+_0x5f5252[_0xefa7('0x1a')];var _0x411c06;if(_0x54e098>=_0x3c53b1){_0x54e098=_0x3c53b1;_0x411c06=0xc8;}else{_0x411c06=0xce;}_0x3d6f1b[_0xefa7('0x17')](_0x411c06);return _0x3d6f1b[_0xefa7('0x1c')](_0xefa7('0x1d'),_0x2ba013+'-'+_0x54e098+'/'+_0x3c53b1)['json'](_0x46719c);}return null;};}function patchUpdates(_0xb3d40e){return function(_0x4b1772){try{jsonpatch[_0xefa7('0x1e')](_0x4b1772,_0xb3d40e,!![]);}catch(_0x5e88ff){return BPromise['reject'](_0x5e88ff);}return _0x4b1772[_0xefa7('0x1f')]();};}function saveUpdates(_0x462ab6,_0x25c6cb){return function(_0x3f7b49){if(_0x3f7b49){return _0x3f7b49['update'](_0x462ab6)['then'](function(_0x3538b3){return _0x3538b3;});}return null;};}function removeEntity(_0x5c2125,_0x11b27c){return function(_0x309efb){if(_0x309efb){return _0x309efb[_0xefa7('0x20')]()['then'](function(){_0x5c2125[_0xefa7('0x17')](0xcc)[_0xefa7('0x21')]();});}};}function handleEntityNotFound(_0x511868,_0x5a3cf6){return function(_0xc157de){if(!_0xc157de){_0x511868['sendStatus'](0x194);}return _0xc157de;};}function handleError(_0x10aeaa,_0x4cedcd){_0x4cedcd=_0x4cedcd||0x1f4;return function(_0x1a8fa1){logger[_0xefa7('0x22')](_0x1a8fa1[_0xefa7('0x23')]);if(_0x1a8fa1['name']){delete _0x1a8fa1[_0xefa7('0x24')];}_0x10aeaa[_0xefa7('0x17')](_0x4cedcd)[_0xefa7('0x25')](_0x1a8fa1);};}exports[_0xefa7('0x26')]=function(_0x382841,_0x22ffdd){var _0x1b36f4={},_0x221f52={},_0x2e947e={'count':0x0,'rows':[]};var _0x3db64f=_[_0xefa7('0x27')](db[_0xefa7('0x28')][_0xefa7('0x29')],function(_0x36852f){return{'name':_0x36852f[_0xefa7('0x2a')],'type':_0x36852f['type'][_0xefa7('0x2b')]};});_0x221f52[_0xefa7('0x2c')]=_[_0xefa7('0x27')](_0x3db64f,_0xefa7('0x24'));_0x221f52[_0xefa7('0x2d')]=_['keys'](_0x382841[_0xefa7('0x2d')]);_0x221f52['filters']=_[_0xefa7('0x2e')](_0x221f52['model'],_0x221f52['query']);_0x1b36f4['attributes']=_[_0xefa7('0x2e')](_0x221f52[_0xefa7('0x2c')],qs[_0xefa7('0x2f')](_0x382841[_0xefa7('0x2d')][_0xefa7('0x2f')]));_0x1b36f4[_0xefa7('0x30')]=_0x1b36f4[_0xefa7('0x30')][_0xefa7('0x31')]?_0x1b36f4[_0xefa7('0x30')]:_0x221f52[_0xefa7('0x2c')];if(!_0x382841[_0xefa7('0x2d')][_0xefa7('0x32')]('nolimit')){_0x1b36f4[_0xefa7('0x1a')]=qs[_0xefa7('0x1a')](_0x382841[_0xefa7('0x2d')][_0xefa7('0x1a')]);_0x1b36f4['offset']=qs[_0xefa7('0x18')](_0x382841[_0xefa7('0x2d')]['offset']);}_0x1b36f4[_0xefa7('0x33')]=qs[_0xefa7('0x34')](_0x382841[_0xefa7('0x2d')][_0xefa7('0x34')]);_0x1b36f4[_0xefa7('0x35')]=qs[_0xefa7('0x36')](_[_0xefa7('0x37')](_0x382841[_0xefa7('0x2d')],_0x221f52[_0xefa7('0x36')]),_0x3db64f);if(_0x382841[_0xefa7('0x2d')][_0xefa7('0x38')]){_0x1b36f4[_0xefa7('0x35')]=_[_0xefa7('0x39')](_0x1b36f4[_0xefa7('0x35')],{'$or':_[_0xefa7('0x27')](_0x3db64f,function(_0x46f317){if(_0x46f317['type']!==_0xefa7('0x3a')){var _0x10a0ee={};_0x10a0ee[_0x46f317[_0xefa7('0x24')]]={'$like':'%'+_0x382841[_0xefa7('0x2d')]['filter']+'%'};return _0x10a0ee;}})});}_0x1b36f4=_[_0xefa7('0x39')]({},_0x1b36f4,_0x382841[_0xefa7('0x3b')]);var _0x20be66={'where':_0x1b36f4[_0xefa7('0x35')]};return db[_0xefa7('0x28')][_0xefa7('0x1b')](_0x20be66)[_0xefa7('0x3c')](function(_0x1030bf){_0x2e947e[_0xefa7('0x1b')]=_0x1030bf;if(_0x382841['query']['includeAll']){_0x1b36f4[_0xefa7('0x3d')]=[{'all':!![]}];}return db[_0xefa7('0x28')]['findAll'](_0x1b36f4);})['then'](function(_0xd1cb67){_0x2e947e[_0xefa7('0x3e')]=_0xd1cb67;return _0x2e947e;})[_0xefa7('0x3c')](respondWithFilteredResult(_0x22ffdd,_0x1b36f4))['catch'](handleError(_0x22ffdd,null));};exports[_0xefa7('0x3f')]=function(_0x5af829,_0x5b11a4){var _0x4d021a={'raw':![],'where':{'id':_0x5af829[_0xefa7('0x40')]['id']}},_0x838e8e={};_0x838e8e['model']=_['keys'](db[_0xefa7('0x28')][_0xefa7('0x29')]);_0x838e8e[_0xefa7('0x2d')]=_[_0xefa7('0x41')](_0x5af829[_0xefa7('0x2d')]);_0x838e8e[_0xefa7('0x36')]=_[_0xefa7('0x2e')](_0x838e8e[_0xefa7('0x2c')],_0x838e8e[_0xefa7('0x2d')]);_0x4d021a[_0xefa7('0x30')]=_['intersection'](_0x838e8e[_0xefa7('0x2c')],qs[_0xefa7('0x2f')](_0x5af829[_0xefa7('0x2d')][_0xefa7('0x2f')]));_0x4d021a[_0xefa7('0x30')]=_0x4d021a[_0xefa7('0x30')][_0xefa7('0x31')]?_0x4d021a['attributes']:_0x838e8e[_0xefa7('0x2c')];if(_0x5af829[_0xefa7('0x2d')][_0xefa7('0x42')]){_0x4d021a[_0xefa7('0x3d')]=[{'all':!![]}];}_0x4d021a=_['merge']({},_0x4d021a,_0x5af829['options']);return db[_0xefa7('0x28')]['find'](_0x4d021a)['then'](handleEntityNotFound(_0x5b11a4,null))[_0xefa7('0x3c')](respondWithResult(_0x5b11a4,null))['catch'](handleError(_0x5b11a4,null));};exports[_0xefa7('0x43')]=function(_0x241050,_0x224902){return db['FreshsalesAccount'][_0xefa7('0x43')](_0x241050[_0xefa7('0x44')],{})[_0xefa7('0x3c')](respondWithResult(_0x224902,0xc9))['catch'](handleError(_0x224902,null));};exports[_0xefa7('0x45')]=function(_0x39425f,_0x1a0fc4){if(_0x39425f[_0xefa7('0x44')]['id']){delete _0x39425f[_0xefa7('0x44')]['id'];}return db[_0xefa7('0x28')][_0xefa7('0x46')]({'where':{'id':_0x39425f[_0xefa7('0x40')]['id']}})[_0xefa7('0x3c')](handleEntityNotFound(_0x1a0fc4,null))[_0xefa7('0x3c')](saveUpdates(_0x39425f[_0xefa7('0x44')],null))[_0xefa7('0x3c')](respondWithResult(_0x1a0fc4,null))['catch'](handleError(_0x1a0fc4,null));};exports[_0xefa7('0x20')]=function(_0x14540a,_0x22bd94){return db[_0xefa7('0x28')][_0xefa7('0x46')]({'where':{'id':_0x14540a[_0xefa7('0x40')]['id']}})['then'](handleEntityNotFound(_0x22bd94,null))[_0xefa7('0x3c')](removeEntity(_0x22bd94,null))[_0xefa7('0x47')](handleError(_0x22bd94,null));};exports[_0xefa7('0x48')]=function(_0x4e5695,_0x41511a,_0x5b67b2){var _0x38b904={};var _0x4c9cd4={};var _0x218c92;var _0x12a0a5;return db[_0xefa7('0x28')][_0xefa7('0x49')]({'where':{'id':_0x4e5695[_0xefa7('0x40')]['id']}})[_0xefa7('0x3c')](handleEntityNotFound(_0x41511a,null))[_0xefa7('0x3c')](function(_0x1a978b){if(_0x1a978b){_0x218c92=_0x1a978b;_0x4c9cd4[_0xefa7('0x2c')]=_[_0xefa7('0x41')](db[_0xefa7('0x4a')][_0xefa7('0x29')]);_0x4c9cd4[_0xefa7('0x2d')]=_[_0xefa7('0x41')](_0x4e5695[_0xefa7('0x2d')]);_0x4c9cd4[_0xefa7('0x36')]=_['intersection'](_0x4c9cd4[_0xefa7('0x2c')],_0x4c9cd4[_0xefa7('0x2d')]);_0x38b904['attributes']=_[_0xefa7('0x2e')](_0x4c9cd4[_0xefa7('0x2c')],qs[_0xefa7('0x2f')](_0x4e5695['query'][_0xefa7('0x2f')]));_0x38b904[_0xefa7('0x30')]=_0x38b904[_0xefa7('0x30')][_0xefa7('0x31')]?_0x38b904[_0xefa7('0x30')]:_0x4c9cd4[_0xefa7('0x2c')];_0x38b904[_0xefa7('0x33')]=qs[_0xefa7('0x34')](_0x4e5695[_0xefa7('0x2d')]['sort']);_0x38b904[_0xefa7('0x35')]=qs['filters'](_[_0xefa7('0x37')](_0x4e5695[_0xefa7('0x2d')],_0x4c9cd4['filters']));if(_0x4e5695[_0xefa7('0x2d')]['filter']){_0x38b904['where']=_[_0xefa7('0x39')](_0x38b904[_0xefa7('0x35')],{'$or':_[_0xefa7('0x27')](_0x38b904[_0xefa7('0x30')],function(_0x20f111){var _0x10d5ce={};_0x10d5ce[_0x20f111]={'$like':'%'+_0x4e5695['query'][_0xefa7('0x38')]+'%'};return _0x10d5ce;})});}_0x38b904=_[_0xefa7('0x39')]({},_0x38b904,_0x4e5695[_0xefa7('0x3b')]);return _0x218c92['getConfigurations'](_0x38b904);}})[_0xefa7('0x3c')](function(_0x34b058){if(_0x34b058){_0x12a0a5=_0x34b058[_0xefa7('0x31')];if(!_0x4e5695[_0xefa7('0x2d')][_0xefa7('0x32')](_0xefa7('0x4b'))){_0x38b904[_0xefa7('0x1a')]=qs[_0xefa7('0x1a')](_0x4e5695[_0xefa7('0x2d')]['limit']);_0x38b904['offset']=qs[_0xefa7('0x18')](_0x4e5695['query'][_0xefa7('0x18')]);}return _0x218c92['getConfigurations'](_0x38b904);}})[_0xefa7('0x3c')](function(_0x5cce2d){if(_0x5cce2d){return _0x5cce2d?{'count':_0x12a0a5,'rows':_0x5cce2d}:null;}})[_0xefa7('0x3c')](respondWithResult(_0x41511a,null))['catch'](handleError(_0x41511a,null));};exports[_0xefa7('0x4c')]=function(_0x4518d2,_0x15b855,_0xfbc4dc){if(_0x4518d2[_0xefa7('0x44')]['id']){delete _0x4518d2['body']['id'];}return db[_0xefa7('0x28')]['findOne']({'where':{'id':_0x4518d2[_0xefa7('0x40')]['id']}})[_0xefa7('0x3c')](handleEntityNotFound(_0x15b855,null))[_0xefa7('0x3c')](function(_0x10a28a){if(_0x10a28a){_0x4518d2[_0xefa7('0x44')][_0xefa7('0x4d')]=_0x10a28a['id'];_0x4518d2['body']['Subjects']=integrations[_0xefa7('0x4e')](_0x4518d2['body'][_0xefa7('0x4f')],_0x4518d2['body']['type']);_0x4518d2[_0xefa7('0x44')][_0xefa7('0x50')]=integrations['getDescriptions'](_0x4518d2[_0xefa7('0x44')][_0xefa7('0x4f')],_0x4518d2[_0xefa7('0x44')]['type']);return db[_0xefa7('0x4a')][_0xefa7('0x43')](_0x4518d2[_0xefa7('0x44')],{'include':[{'model':db['FreshsalesField'],'as':_0xefa7('0x51')},{'model':db['FreshsalesField'],'as':_0xefa7('0x50')}]});}return null;})['then'](respondWithResult(_0x15b855,null))[_0xefa7('0x47')](handleError(_0x15b855,null));};exports['getFields']=function(_0x15371d,_0x482e95,_0x5ba20a){var _0x5b62fb='';var _0x596270='';return db[_0xefa7('0x28')]['findOne']({'where':{'id':_0x15371d['params']['id']},'attributes':['id',_0xefa7('0x52'),_0xefa7('0x53'),_0xefa7('0x54')]})[_0xefa7('0x3c')](handleEntityNotFound(_0x482e95,null))['then'](function(_0x14fa51){if(_0x14fa51){_0x596270=_0x14fa51[_0xefa7('0x52')];_0x5b62fb=_0x14fa51[_0xefa7('0x53')];var _0x528a2c=_0x14fa51['remoteUri'][_0xefa7('0x55')](-0x1);if(_0x528a2c==='/'){_0x5b62fb=_0x5b62fb['substring'](0x0,_0x5b62fb[_0xefa7('0x56')](_0x528a2c));}return rp({'method':_0xefa7('0x57'),'uri':util[_0xefa7('0x58')](_0xefa7('0x59'),_0x5b62fb,_0xefa7('0x5a')),'headers':{'Authorization':'Token\x20token='+_0x14fa51[_0xefa7('0x54')]},'json':!![]});}})['then'](function(_0x149ceb){if(_0x149ceb){var _0x5c8ef7=_0x149ceb['users'];var _0x34ff8f=![];var _0x1d6862=null;for(_0x1d6862=0x0;_0x1d6862<_0x5c8ef7[_0xefa7('0x31')];_0x1d6862++){if(_0x5c8ef7[_0x1d6862][_0xefa7('0x5b')]===_0x596270){_0x34ff8f=!![];}}if(_0x34ff8f){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xefa7('0x5c')});}}})[_0xefa7('0x3c')](respondWithResult(_0x482e95,null))[_0xefa7('0x47')](function(_0x5bc732){var _0x548843=_0x15371d['query'][_0xefa7('0x5d')]?0x1f4:_0x5bc732[_0xefa7('0x5e')]||0x1f4;logger['error'](_0xefa7('0x5f'),_0xefa7('0x60'),_0x548843,JSON[_0xefa7('0x61')](_0x5bc732));delete _0x5bc732[_0xefa7('0x24')];if(_0x548843===0x191){_0x548843=0x190;}_0x482e95[_0xefa7('0x17')](_0x548843)[_0xefa7('0x25')](_0x15371d[_0xefa7('0x2d')][_0xefa7('0x5d')]?{'message':_0xefa7('0x62'),'statusCode':_0x5bc732[_0xefa7('0x5e')]}:_0x5bc732);});}; \ No newline at end of file +var _0x70a7=['to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','length','find','create','body','destroy','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','getDescriptions','channel','FreshsalesConfiguration','FreshsalesField','Descriptions','username','remoteUri','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','email','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','util','sox'];(function(_0x24b852,_0x2bad67){var _0x180ad2=function(_0x454562){while(--_0x454562){_0x24b852['push'](_0x24b852['shift']());}};_0x180ad2(++_0x2bad67);}(_0x70a7,0x18a));var _0x770a=function(_0x946518,_0x22816f){_0x946518=_0x946518-0x0;var _0x909b69=_0x70a7[_0x946518];return _0x909b69;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x770a('0x0'));var zipdir=require(_0x770a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x770a('0x2'));var moment=require(_0x770a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x770a('0x4'));var path=require('path');var sox=require(_0x770a('0x5'));var csv=require(_0x770a('0x6'));var ejs=require(_0x770a('0x7'));var fs=require('fs');var fs_extra=require(_0x770a('0x8'));var _=require('lodash');var squel=require(_0x770a('0x9'));var crypto=require('crypto');var jsforce=require(_0x770a('0xa'));var deskjs=require(_0x770a('0xb'));var toCsv=require(_0x770a('0x6'));var querystring=require(_0x770a('0xc'));var Papa=require(_0x770a('0xd'));var Redis=require(_0x770a('0xe'));var authService=require(_0x770a('0xf'));var qs=require(_0x770a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x770a('0x11'));var logger=require(_0x770a('0x12'))(_0x770a('0x13'));var utils=require(_0x770a('0x14'));var config=require(_0x770a('0x15'));var licenseUtil=require(_0x770a('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x770a('0x17'));function respondWithStatusCode(_0x5cf6f7,_0xcf8c1c){_0xcf8c1c=_0xcf8c1c||0xcc;return function(_0x55b1c8){if(_0x55b1c8){return _0x5cf6f7[_0x770a('0x18')](_0xcf8c1c);}return _0x5cf6f7[_0x770a('0x19')](_0xcf8c1c)[_0x770a('0x1a')]();};}function respondWithResult(_0x11ba97,_0x7d143f){_0x7d143f=_0x7d143f||0xc8;return function(_0x25f248){if(_0x25f248){return _0x11ba97[_0x770a('0x19')](_0x7d143f)[_0x770a('0x1b')](_0x25f248);}};}function respondWithFilteredResult(_0x2e9ecd,_0x5281cb){return function(_0x38a90f){if(_0x38a90f){var _0xfa26b4=typeof _0x5281cb[_0x770a('0x1c')]===_0x770a('0x1d')&&typeof _0x5281cb[_0x770a('0x1e')]===_0x770a('0x1d');var _0x3a8413=_0x38a90f['count'];var _0x150d94=_0xfa26b4?0x0:_0x5281cb[_0x770a('0x1c')];var _0x25d67f=_0xfa26b4?_0x38a90f[_0x770a('0x1f')]:_0x5281cb[_0x770a('0x1c')]+_0x5281cb['limit'];var _0x7b9fe3;if(_0x25d67f>=_0x3a8413){_0x25d67f=_0x3a8413;_0x7b9fe3=0xc8;}else{_0x7b9fe3=0xce;}_0x2e9ecd[_0x770a('0x19')](_0x7b9fe3);return _0x2e9ecd[_0x770a('0x20')](_0x770a('0x21'),_0x150d94+'-'+_0x25d67f+'/'+_0x3a8413)['json'](_0x38a90f);}return null;};}function patchUpdates(_0x51479b){return function(_0x28cdb6){try{jsonpatch['apply'](_0x28cdb6,_0x51479b,!![]);}catch(_0x1a2072){return BPromise['reject'](_0x1a2072);}return _0x28cdb6[_0x770a('0x22')]();};}function saveUpdates(_0x1892b4,_0x19b5f6){return function(_0x3b1ddb){if(_0x3b1ddb){return _0x3b1ddb[_0x770a('0x23')](_0x1892b4)[_0x770a('0x24')](function(_0xf3bfcb){return _0xf3bfcb;});}return null;};}function removeEntity(_0x515848,_0x4515e8){return function(_0x3ea937){if(_0x3ea937){return _0x3ea937['destroy']()[_0x770a('0x24')](function(){_0x515848[_0x770a('0x19')](0xcc)[_0x770a('0x1a')]();});}};}function handleEntityNotFound(_0x5594df,_0x17fe4f){return function(_0x4d1ea5){if(!_0x4d1ea5){_0x5594df[_0x770a('0x18')](0x194);}return _0x4d1ea5;};}function handleError(_0x47158b,_0x4686d1){_0x4686d1=_0x4686d1||0x1f4;return function(_0x2643cd){logger[_0x770a('0x25')](_0x2643cd[_0x770a('0x26')]);if(_0x2643cd[_0x770a('0x27')]){delete _0x2643cd[_0x770a('0x27')];}_0x47158b[_0x770a('0x19')](_0x4686d1)[_0x770a('0x28')](_0x2643cd);};}exports[_0x770a('0x29')]=function(_0x39cbb2,_0x17aad9){var _0x1ca62b={},_0x50c0fc={},_0x4c0638={'count':0x0,'rows':[]};var _0x58ae5a=_[_0x770a('0x2a')](db[_0x770a('0x2b')][_0x770a('0x2c')],function(_0x255979){return{'name':_0x255979['fieldName'],'type':_0x255979[_0x770a('0x2d')]['key']};});_0x50c0fc[_0x770a('0x2e')]=_[_0x770a('0x2a')](_0x58ae5a,_0x770a('0x27'));_0x50c0fc[_0x770a('0x2f')]=_['keys'](_0x39cbb2['query']);_0x50c0fc[_0x770a('0x30')]=_['intersection'](_0x50c0fc[_0x770a('0x2e')],_0x50c0fc[_0x770a('0x2f')]);_0x1ca62b[_0x770a('0x31')]=_[_0x770a('0x32')](_0x50c0fc[_0x770a('0x2e')],qs[_0x770a('0x33')](_0x39cbb2[_0x770a('0x2f')]['fields']));_0x1ca62b['attributes']=_0x1ca62b[_0x770a('0x31')]['length']?_0x1ca62b[_0x770a('0x31')]:_0x50c0fc[_0x770a('0x2e')];if(!_0x39cbb2[_0x770a('0x2f')][_0x770a('0x34')](_0x770a('0x35'))){_0x1ca62b[_0x770a('0x1e')]=qs[_0x770a('0x1e')](_0x39cbb2['query'][_0x770a('0x1e')]);_0x1ca62b[_0x770a('0x1c')]=qs[_0x770a('0x1c')](_0x39cbb2[_0x770a('0x2f')][_0x770a('0x1c')]);}_0x1ca62b[_0x770a('0x36')]=qs[_0x770a('0x37')](_0x39cbb2['query'][_0x770a('0x37')]);_0x1ca62b[_0x770a('0x38')]=qs[_0x770a('0x30')](_[_0x770a('0x39')](_0x39cbb2[_0x770a('0x2f')],_0x50c0fc['filters']),_0x58ae5a);if(_0x39cbb2[_0x770a('0x2f')][_0x770a('0x3a')]){_0x1ca62b[_0x770a('0x38')]=_[_0x770a('0x3b')](_0x1ca62b[_0x770a('0x38')],{'$or':_['map'](_0x58ae5a,function(_0x271e37){if(_0x271e37[_0x770a('0x2d')]!==_0x770a('0x3c')){var _0x11aefa={};_0x11aefa[_0x271e37[_0x770a('0x27')]]={'$like':'%'+_0x39cbb2[_0x770a('0x2f')][_0x770a('0x3a')]+'%'};return _0x11aefa;}})});}_0x1ca62b=_['merge']({},_0x1ca62b,_0x39cbb2[_0x770a('0x3d')]);var _0x44ee73={'where':_0x1ca62b[_0x770a('0x38')]};return db[_0x770a('0x2b')]['count'](_0x44ee73)[_0x770a('0x24')](function(_0x195a45){_0x4c0638[_0x770a('0x1f')]=_0x195a45;if(_0x39cbb2[_0x770a('0x2f')][_0x770a('0x3e')]){_0x1ca62b[_0x770a('0x3f')]=[{'all':!![]}];}return db[_0x770a('0x2b')][_0x770a('0x40')](_0x1ca62b);})[_0x770a('0x24')](function(_0x1e5986){_0x4c0638['rows']=_0x1e5986;return _0x4c0638;})[_0x770a('0x24')](respondWithFilteredResult(_0x17aad9,_0x1ca62b))[_0x770a('0x41')](handleError(_0x17aad9,null));};exports[_0x770a('0x42')]=function(_0x811398,_0x7459da){var _0x43c501={'raw':![],'where':{'id':_0x811398[_0x770a('0x43')]['id']}},_0x95bc2a={};_0x95bc2a['model']=_['keys'](db[_0x770a('0x2b')][_0x770a('0x2c')]);_0x95bc2a[_0x770a('0x2f')]=_[_0x770a('0x44')](_0x811398['query']);_0x95bc2a[_0x770a('0x30')]=_[_0x770a('0x32')](_0x95bc2a[_0x770a('0x2e')],_0x95bc2a[_0x770a('0x2f')]);_0x43c501[_0x770a('0x31')]=_[_0x770a('0x32')](_0x95bc2a[_0x770a('0x2e')],qs[_0x770a('0x33')](_0x811398['query'][_0x770a('0x33')]));_0x43c501[_0x770a('0x31')]=_0x43c501['attributes'][_0x770a('0x45')]?_0x43c501['attributes']:_0x95bc2a[_0x770a('0x2e')];if(_0x811398[_0x770a('0x2f')][_0x770a('0x3e')]){_0x43c501[_0x770a('0x3f')]=[{'all':!![]}];}_0x43c501=_[_0x770a('0x3b')]({},_0x43c501,_0x811398['options']);return db[_0x770a('0x2b')][_0x770a('0x46')](_0x43c501)[_0x770a('0x24')](handleEntityNotFound(_0x7459da,null))[_0x770a('0x24')](respondWithResult(_0x7459da,null))[_0x770a('0x41')](handleError(_0x7459da,null));};exports[_0x770a('0x47')]=function(_0x30aeec,_0x12e240){return db['FreshsalesAccount'][_0x770a('0x47')](_0x30aeec[_0x770a('0x48')],{})['then'](respondWithResult(_0x12e240,0xc9))['catch'](handleError(_0x12e240,null));};exports[_0x770a('0x23')]=function(_0x15f90e,_0xd372ce){if(_0x15f90e[_0x770a('0x48')]['id']){delete _0x15f90e[_0x770a('0x48')]['id'];}return db['FreshsalesAccount'][_0x770a('0x46')]({'where':{'id':_0x15f90e['params']['id']}})['then'](handleEntityNotFound(_0xd372ce,null))[_0x770a('0x24')](saveUpdates(_0x15f90e['body'],null))[_0x770a('0x24')](respondWithResult(_0xd372ce,null))[_0x770a('0x41')](handleError(_0xd372ce,null));};exports[_0x770a('0x49')]=function(_0x485c0a,_0x269912){return db[_0x770a('0x2b')][_0x770a('0x46')]({'where':{'id':_0x485c0a[_0x770a('0x43')]['id']}})[_0x770a('0x24')](handleEntityNotFound(_0x269912,null))[_0x770a('0x24')](removeEntity(_0x269912,null))['catch'](handleError(_0x269912,null));};exports[_0x770a('0x4a')]=function(_0x58a8ef,_0x420287,_0x265581){var _0x3569fe={};var _0x2837d1={};var _0x5c5740;var _0x3e1c9d;return db[_0x770a('0x2b')][_0x770a('0x4b')]({'where':{'id':_0x58a8ef[_0x770a('0x43')]['id']}})[_0x770a('0x24')](handleEntityNotFound(_0x420287,null))[_0x770a('0x24')](function(_0x42c173){if(_0x42c173){_0x5c5740=_0x42c173;_0x2837d1['model']=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0x2837d1['query']=_['keys'](_0x58a8ef[_0x770a('0x2f')]);_0x2837d1[_0x770a('0x30')]=_[_0x770a('0x32')](_0x2837d1[_0x770a('0x2e')],_0x2837d1[_0x770a('0x2f')]);_0x3569fe[_0x770a('0x31')]=_[_0x770a('0x32')](_0x2837d1['model'],qs[_0x770a('0x33')](_0x58a8ef['query'][_0x770a('0x33')]));_0x3569fe[_0x770a('0x31')]=_0x3569fe[_0x770a('0x31')]['length']?_0x3569fe[_0x770a('0x31')]:_0x2837d1[_0x770a('0x2e')];_0x3569fe['order']=qs[_0x770a('0x37')](_0x58a8ef[_0x770a('0x2f')][_0x770a('0x37')]);_0x3569fe['where']=qs[_0x770a('0x30')](_['pick'](_0x58a8ef[_0x770a('0x2f')],_0x2837d1[_0x770a('0x30')]));if(_0x58a8ef[_0x770a('0x2f')]['filter']){_0x3569fe[_0x770a('0x38')]=_[_0x770a('0x3b')](_0x3569fe[_0x770a('0x38')],{'$or':_[_0x770a('0x2a')](_0x3569fe['attributes'],function(_0x54d0d6){var _0x5503a6={};_0x5503a6[_0x54d0d6]={'$like':'%'+_0x58a8ef[_0x770a('0x2f')][_0x770a('0x3a')]+'%'};return _0x5503a6;})});}_0x3569fe=_[_0x770a('0x3b')]({},_0x3569fe,_0x58a8ef[_0x770a('0x3d')]);return _0x5c5740[_0x770a('0x4a')](_0x3569fe);}})[_0x770a('0x24')](function(_0x7a8fa8){if(_0x7a8fa8){_0x3e1c9d=_0x7a8fa8[_0x770a('0x45')];if(!_0x58a8ef[_0x770a('0x2f')][_0x770a('0x34')]('nolimit')){_0x3569fe[_0x770a('0x1e')]=qs[_0x770a('0x1e')](_0x58a8ef[_0x770a('0x2f')]['limit']);_0x3569fe[_0x770a('0x1c')]=qs['offset'](_0x58a8ef[_0x770a('0x2f')][_0x770a('0x1c')]);}return _0x5c5740[_0x770a('0x4a')](_0x3569fe);}})['then'](function(_0x51700c){if(_0x51700c){return _0x51700c?{'count':_0x3e1c9d,'rows':_0x51700c}:null;}})['then'](respondWithResult(_0x420287,null))['catch'](handleError(_0x420287,null));};exports[_0x770a('0x4c')]=function(_0x277e4e,_0x1f8d11,_0x26d333){if(_0x277e4e[_0x770a('0x48')]['id']){delete _0x277e4e[_0x770a('0x48')]['id'];}return db[_0x770a('0x2b')][_0x770a('0x4b')]({'where':{'id':_0x277e4e[_0x770a('0x43')]['id']}})[_0x770a('0x24')](handleEntityNotFound(_0x1f8d11,null))[_0x770a('0x24')](function(_0x404a40){if(_0x404a40){_0x277e4e[_0x770a('0x48')]['AccountId']=_0x404a40['id'];_0x277e4e[_0x770a('0x48')][_0x770a('0x4d')]=integrations[_0x770a('0x4e')](_0x277e4e[_0x770a('0x48')]['channel'],_0x277e4e[_0x770a('0x48')][_0x770a('0x2d')]);_0x277e4e[_0x770a('0x48')]['Descriptions']=integrations[_0x770a('0x4f')](_0x277e4e[_0x770a('0x48')][_0x770a('0x50')],_0x277e4e[_0x770a('0x48')][_0x770a('0x2d')]);return db[_0x770a('0x51')]['create'](_0x277e4e[_0x770a('0x48')],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db[_0x770a('0x52')],'as':_0x770a('0x53')}]});}return null;})['then'](respondWithResult(_0x1f8d11,null))[_0x770a('0x41')](handleError(_0x1f8d11,null));};exports['getFields']=function(_0x2bc456,_0x4f036f,_0x4ede66){var _0x54cf68='';var _0x40cf3a='';return db[_0x770a('0x2b')]['findOne']({'where':{'id':_0x2bc456[_0x770a('0x43')]['id']},'attributes':['id',_0x770a('0x54'),_0x770a('0x55'),'apiKey']})[_0x770a('0x24')](handleEntityNotFound(_0x4f036f,null))[_0x770a('0x24')](function(_0x2af1f3){if(_0x2af1f3){_0x40cf3a=_0x2af1f3['username'];_0x54cf68=_0x2af1f3[_0x770a('0x55')];var _0x192293=_0x2af1f3[_0x770a('0x55')]['slice'](-0x1);if(_0x192293==='/'){_0x54cf68=_0x54cf68[_0x770a('0x56')](0x0,_0x54cf68[_0x770a('0x57')](_0x192293));}return rp({'method':_0x770a('0x58'),'uri':util[_0x770a('0x59')](_0x770a('0x5a'),_0x54cf68,_0x770a('0x5b')),'headers':{'Authorization':_0x770a('0x5c')+_0x2af1f3[_0x770a('0x5d')]},'json':!![]});}})[_0x770a('0x24')](function(_0x180dee){if(_0x180dee){var _0x2ceb28=_0x180dee['users'];var _0x5164e1=![];var _0x4bb7b6=null;for(_0x4bb7b6=0x0;_0x4bb7b6<_0x2ceb28[_0x770a('0x45')];_0x4bb7b6++){if(_0x2ceb28[_0x4bb7b6][_0x770a('0x5e')]===_0x40cf3a){_0x5164e1=!![];}}if(_0x5164e1){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x770a('0x5f')});}}})[_0x770a('0x24')](respondWithResult(_0x4f036f,null))[_0x770a('0x41')](function(_0x150ed1){var _0x184187=_0x2bc456[_0x770a('0x2f')][_0x770a('0x60')]?0x1f4:_0x150ed1[_0x770a('0x61')]||0x1f4;logger[_0x770a('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x184187,JSON[_0x770a('0x62')](_0x150ed1));delete _0x150ed1[_0x770a('0x27')];if(_0x184187===0x191){_0x184187=0x190;}_0x4f036f[_0x770a('0x19')](_0x184187)[_0x770a('0x28')](_0x2bc456[_0x770a('0x2f')][_0x770a('0x60')]?{'message':_0x770a('0x63'),'statusCode':_0x150ed1[_0x770a('0x61')]}:_0x150ed1);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index e318037..ad0a919 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 _0x4745=['path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','FreshsalesAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1319d2,_0x42e13e){var _0x3b1b12=function(_0x3b1625){while(--_0x3b1625){_0x1319d2['push'](_0x1319d2['shift']());}};_0x3b1b12(++_0x42e13e);}(_0x4745,0x1e7));var _0x5474=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x4745[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var logger=require(_0x5474('0x2'))(_0x5474('0x3'));var moment=require(_0x5474('0x4'));var BPromise=require(_0x5474('0x5'));var rp=require(_0x5474('0x6'));var fs=require('fs');var path=require(_0x5474('0x7'));var rimraf=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var attributes=require(_0x5474('0xa'));var integrations=require(_0x5474('0xb'));module['exports']=function(_0x3d1e1,_0x431f81){return _0x3d1e1['define'](_0x5474('0xc'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa46e=['api','moment','bluebird','path','../../config/environment','../../components/integrations/configuration','FreshsalesAccount','int_freshsales_accounts','lodash','util'];(function(_0x13e275,_0x1a481b){var _0x1fb43d=function(_0x834fa3){while(--_0x834fa3){_0x13e275['push'](_0x13e275['shift']());}};_0x1fb43d(++_0x1a481b);}(_0xa46e,0x8a));var _0xea46=function(_0x3b4b1d,_0x15029e){_0x3b4b1d=_0x3b4b1d-0x0;var _0x488c36=_0xa46e[_0x3b4b1d];return _0x488c36;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea46('0x5'));var rimraf=require('rimraf');var config=require(_0xea46('0x6'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0xea46('0x7'));module['exports']=function(_0x10bee5,_0x3dc26f){return _0x10bee5['define'](_0xea46('0x8'),attributes,{'tableName':_0xea46('0x9'),'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 9378cef..39034a1 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 _0x25e7=['find','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','map','include','model','stringify'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x25e7,0x1d6));var _0x725e=function(_0x984e97,_0x2c72e7){_0x984e97=_0x984e97-0x0;var _0x3630e5=_0x25e7[_0x984e97];return _0x3630e5;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var moment=require(_0x725e('0x2'));var BPromise=require(_0x725e('0x3'));var rs=require(_0x725e('0x4'));var fs=require('fs');var Redis=require(_0x725e('0x5'));var db=require(_0x725e('0x6'))['db'];var utils=require(_0x725e('0x7'));var logger=require(_0x725e('0x8'))(_0x725e('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x725e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481316,_0x111a50,_0x192c27){return new BPromise(function(_0x216b33,_0x67de0c){return client[_0x725e('0xb')](_0x481316,_0x192c27)[_0x725e('0xc')](function(_0x39858a){logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,_0x725e('0xf'));logger[_0x725e('0x10')](_0x725e('0x11'),_0x111a50,'request\x20sent',JSON['stringify'](_0x39858a));if(_0x39858a[_0x725e('0x12')]){if(_0x39858a[_0x725e('0x12')]['code']===0x1f4){logger['error'](_0x725e('0xe'),_0x111a50,_0x39858a[_0x725e('0x12')]['message']);return _0x67de0c(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}logger[_0x725e('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x111a50,_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);return _0x216b33(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}else{logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,'request\x20sent');_0x216b33(_0x39858a[_0x725e('0x14')][_0x725e('0x13')]);}})[_0x725e('0x15')](function(_0x54ac0f){logger[_0x725e('0x12')](_0x725e('0xe'),_0x111a50,_0x54ac0f);_0x67de0c(_0x54ac0f);});});}exports[_0x725e('0x16')]=function(_0x397e33){var _0x268438=this;return new Promise(function(_0x2811e7,_0x528e7d){return db[_0x725e('0x17')][_0x725e('0x18')]({'raw':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')][_0x725e('0x1a')]===undefined?!![]:![]:!![],'where':_0x397e33[_0x725e('0x19')]?_0x397e33['options'][_0x725e('0x1b')]||null:null,'attributes':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')][_0x725e('0x1c')]||null:null,'limit':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')][_0x725e('0x1d')]||null:null,'include':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')]['include']?_[_0x725e('0x1e')](_0x397e33[_0x725e('0x19')][_0x725e('0x1f')],function(_0x3facae){return{'model':db[_0x3facae['model']],'as':_0x3facae['as'],'attributes':_0x3facae[_0x725e('0x1c')],'include':_0x3facae['include']?_['map'](_0x3facae['include'],function(_0x2aad7b){return{'model':db[_0x2aad7b[_0x725e('0x20')]],'as':_0x2aad7b['as'],'attributes':_0x2aad7b[_0x725e('0x1c')],'include':_0x2aad7b['include']?_[_0x725e('0x1e')](_0x2aad7b[_0x725e('0x1f')],function(_0x5a5bef){return{'model':db[_0x5a5bef[_0x725e('0x20')]],'as':_0x5a5bef['as'],'attributes':_0x5a5bef[_0x725e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x378ace){logger['info']('GetFreshsalesAccount',_0x397e33);logger[_0x725e('0x10')]('GetFreshsalesAccount',_0x397e33,JSON[_0x725e('0x21')](_0x378ace));_0x2811e7(_0x378ace);})['catch'](function(_0x4de2e0){logger[_0x725e('0x12')](_0x725e('0x16'),_0x4de2e0[_0x725e('0x13')],_0x397e33);_0x528e7d(_0x268438['error'](0x1f4,_0x4de2e0[_0x725e('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0x85d29c){var _0x1ce9c8=this;return new Promise(function(_0x39932f,_0x28951f){return db[_0x725e('0x17')][_0x725e('0x22')]({'raw':_0x85d29c[_0x725e('0x19')]?_0x85d29c[_0x725e('0x19')][_0x725e('0x1a')]===undefined?!![]:![]:!![],'where':_0x85d29c[_0x725e('0x19')]?_0x85d29c[_0x725e('0x19')]['where']||null:null,'attributes':_0x85d29c[_0x725e('0x19')]?_0x85d29c[_0x725e('0x19')]['attributes']||null:null,'include':_0x85d29c[_0x725e('0x19')]?_0x85d29c['options'][_0x725e('0x1f')]?_['map'](_0x85d29c[_0x725e('0x19')][_0x725e('0x1f')],function(_0x1f2898){return{'model':db[_0x1f2898[_0x725e('0x20')]],'as':_0x1f2898['as'],'attributes':_0x1f2898[_0x725e('0x1c')],'include':_0x1f2898[_0x725e('0x1f')]?_['map'](_0x1f2898['include'],function(_0x35e5e7){return{'model':db[_0x35e5e7[_0x725e('0x20')]],'as':_0x35e5e7['as'],'attributes':_0x35e5e7[_0x725e('0x1c')],'include':_0x35e5e7['include']?_[_0x725e('0x1e')](_0x35e5e7['include'],function(_0x3ce327){return{'model':db[_0x3ce327[_0x725e('0x20')]],'as':_0x3ce327['as'],'attributes':_0x3ce327[_0x725e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x725e('0xc')](function(_0x4f15f3){logger['info'](_0x725e('0x23'),_0x85d29c);logger[_0x725e('0x10')](_0x725e('0x23'),_0x85d29c,JSON['stringify'](_0x4f15f3));_0x39932f(_0x4f15f3);})[_0x725e('0x15')](function(_0xec3b9d){logger[_0x725e('0x12')]('ShowFreshsalesAccount',_0xec3b9d[_0x725e('0x13')],_0x85d29c);_0x28951f(_0x1ce9c8['error'](0x1f4,_0xec3b9d[_0x725e('0x13')]));});});}; \ No newline at end of file +var _0x8952=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','attributes','limit','include','map','model','ShowFreshsalesAccount','find','raw','debug','util','moment','bluebird'];(function(_0x2e1777,_0x1f056a){var _0x35628f=function(_0x50499e){while(--_0x50499e){_0x2e1777['push'](_0x2e1777['shift']());}};_0x35628f(++_0x1f056a);}(_0x8952,0x17e));var _0x2895=function(_0xe5e395,_0x34808e){_0xe5e395=_0xe5e395-0x0;var _0x47414c=_0x8952[_0xe5e395];return _0x47414c;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var moment=require(_0x2895('0x1'));var BPromise=require(_0x2895('0x2'));var rs=require(_0x2895('0x3'));var fs=require('fs');var Redis=require(_0x2895('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2895('0x5'));var logger=require(_0x2895('0x6'))(_0x2895('0x7'));var config=require('../../config/environment');var jayson=require(_0x2895('0x8'));var client=jayson[_0x2895('0x9')][_0x2895('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ea619,_0x526c32,_0x238b4a){return new BPromise(function(_0x335002,_0x159f86){return client[_0x2895('0xb')](_0x4ea619,_0x238b4a)[_0x2895('0xc')](function(_0x4952fa){logger[_0x2895('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x526c32,_0x2895('0xe'));logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x526c32,'request\x20sent',JSON[_0x2895('0xf')](_0x4952fa));if(_0x4952fa[_0x2895('0x10')]){if(_0x4952fa[_0x2895('0x10')]['code']===0x1f4){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x4952fa['error'][_0x2895('0x12')]);return _0x159f86(_0x4952fa[_0x2895('0x10')]['message']);}logger['error'](_0x2895('0x11'),_0x526c32,_0x4952fa[_0x2895('0x10')]['message']);return _0x335002(_0x4952fa[_0x2895('0x10')][_0x2895('0x12')]);}else{logger[_0x2895('0xd')](_0x2895('0x11'),_0x526c32,_0x2895('0xe'));_0x335002(_0x4952fa[_0x2895('0x13')][_0x2895('0x12')]);}})[_0x2895('0x14')](function(_0x3e96d7){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x3e96d7);_0x159f86(_0x3e96d7);});});}exports[_0x2895('0x15')]=function(_0xbf8b63){var _0x2cb505=this;return new Promise(function(_0x155124,_0x184d11){return db[_0x2895('0x16')][_0x2895('0x17')]({'raw':_0xbf8b63['options']?_0xbf8b63['options']['raw']===undefined?!![]:![]:!![],'where':_0xbf8b63[_0x2895('0x18')]?_0xbf8b63[_0x2895('0x18')][_0x2895('0x19')]||null:null,'attributes':_0xbf8b63['options']?_0xbf8b63[_0x2895('0x18')][_0x2895('0x1a')]||null:null,'limit':_0xbf8b63[_0x2895('0x18')]?_0xbf8b63[_0x2895('0x18')][_0x2895('0x1b')]||null:null,'include':_0xbf8b63['options']?_0xbf8b63[_0x2895('0x18')][_0x2895('0x1c')]?_['map'](_0xbf8b63[_0x2895('0x18')][_0x2895('0x1c')],function(_0x6f8ad4){return{'model':db[_0x6f8ad4['model']],'as':_0x6f8ad4['as'],'attributes':_0x6f8ad4['attributes'],'include':_0x6f8ad4[_0x2895('0x1c')]?_[_0x2895('0x1d')](_0x6f8ad4[_0x2895('0x1c')],function(_0x4a21cf){return{'model':db[_0x4a21cf[_0x2895('0x1e')]],'as':_0x4a21cf['as'],'attributes':_0x4a21cf[_0x2895('0x1a')],'include':_0x4a21cf['include']?_[_0x2895('0x1d')](_0x4a21cf[_0x2895('0x1c')],function(_0x2cd4df){return{'model':db[_0x2cd4df['model']],'as':_0x2cd4df['as'],'attributes':_0x2cd4df[_0x2895('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2895('0xc')](function(_0x5eedfc){logger[_0x2895('0xd')]('GetFreshsalesAccount',_0xbf8b63);logger['debug'](_0x2895('0x15'),_0xbf8b63,JSON['stringify'](_0x5eedfc));_0x155124(_0x5eedfc);})[_0x2895('0x14')](function(_0x381538){logger['error']('GetFreshsalesAccount',_0x381538[_0x2895('0x12')],_0xbf8b63);_0x184d11(_0x2cb505[_0x2895('0x10')](0x1f4,_0x381538[_0x2895('0x12')]));});});};exports[_0x2895('0x1f')]=function(_0x14d150){var _0xa61689=this;return new Promise(function(_0x34e110,_0x546514){return db[_0x2895('0x16')][_0x2895('0x20')]({'raw':_0x14d150[_0x2895('0x18')]?_0x14d150['options'][_0x2895('0x21')]===undefined?!![]:![]:!![],'where':_0x14d150[_0x2895('0x18')]?_0x14d150[_0x2895('0x18')][_0x2895('0x19')]||null:null,'attributes':_0x14d150['options']?_0x14d150[_0x2895('0x18')][_0x2895('0x1a')]||null:null,'include':_0x14d150[_0x2895('0x18')]?_0x14d150[_0x2895('0x18')][_0x2895('0x1c')]?_['map'](_0x14d150['options'][_0x2895('0x1c')],function(_0xf3c8f7){return{'model':db[_0xf3c8f7['model']],'as':_0xf3c8f7['as'],'attributes':_0xf3c8f7[_0x2895('0x1a')],'include':_0xf3c8f7['include']?_[_0x2895('0x1d')](_0xf3c8f7[_0x2895('0x1c')],function(_0x586c4a){return{'model':db[_0x586c4a[_0x2895('0x1e')]],'as':_0x586c4a['as'],'attributes':_0x586c4a['attributes'],'include':_0x586c4a[_0x2895('0x1c')]?_['map'](_0x586c4a['include'],function(_0xa6fe9e){return{'model':db[_0xa6fe9e[_0x2895('0x1e')]],'as':_0xa6fe9e['as'],'attributes':_0xa6fe9e[_0x2895('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e4348){logger[_0x2895('0xd')](_0x2895('0x1f'),_0x14d150);logger[_0x2895('0x22')](_0x2895('0x1f'),_0x14d150,JSON[_0x2895('0xf')](_0x1e4348));_0x34e110(_0x1e4348);})[_0x2895('0x14')](function(_0x240230){logger[_0x2895('0x10')](_0x2895('0x1f'),_0x240230['message'],_0x14d150);_0x546514(_0xa61689[_0x2895('0x10')](0x1f4,_0x240230[_0x2895('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 132eead..7440415 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 _0x5ce8=['delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getFields','create'];(function(_0x13524d,_0x505b49){var _0x9918b4=function(_0xef1f0a){while(--_0xef1f0a){_0x13524d['push'](_0x13524d['shift']());}};_0x9918b4(++_0x505b49);}(_0x5ce8,0x189));var _0x85ce=function(_0x3653ee,_0x180d8f){_0x3653ee=_0x3653ee-0x0;var _0x24c5e8=_0x5ce8[_0x3653ee];return _0x24c5e8;};'use strict';var multer=require(_0x85ce('0x0'));var util=require(_0x85ce('0x1'));var path=require(_0x85ce('0x2'));var timeout=require('connect-timeout');var express=require(_0x85ce('0x3'));var router=express[_0x85ce('0x4')]();var fs_extra=require(_0x85ce('0x5'));var auth=require(_0x85ce('0x6'));var interaction=require(_0x85ce('0x7'));var config=require(_0x85ce('0x8'));var controller=require(_0x85ce('0x9'));router[_0x85ce('0xa')]('/',auth['isAuthenticated'](),controller[_0x85ce('0xb')]);router['get'](_0x85ce('0xc'),auth[_0x85ce('0xd')](),controller[_0x85ce('0xe')]);router[_0x85ce('0xa')](_0x85ce('0xf'),auth[_0x85ce('0xd')](),controller[_0x85ce('0x10')]);router[_0x85ce('0xa')](_0x85ce('0x11'),auth[_0x85ce('0xd')](),controller[_0x85ce('0x12')]);router['get']('/:id/fields',auth[_0x85ce('0xd')](),controller[_0x85ce('0x13')]);router['post']('/',auth[_0x85ce('0xd')](),controller[_0x85ce('0x14')]);router['put'](_0x85ce('0xc'),auth[_0x85ce('0xd')](),controller['update']);router[_0x85ce('0x15')]('/:id',auth[_0x85ce('0xd')](),controller[_0x85ce('0x16')]);module['exports']=router; \ No newline at end of file +var _0x9f52=['getDescriptions','/:id/fields','post','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','/:id','getSubjects'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f52,0x105));var _0x29f5=function(_0x4fce10,_0x596096){_0x4fce10=_0x4fce10-0x0;var _0x180848=_0x9f52[_0x4fce10];return _0x180848;};'use strict';var multer=require(_0x29f5('0x0'));var util=require(_0x29f5('0x1'));var path=require(_0x29f5('0x2'));var timeout=require('connect-timeout');var express=require(_0x29f5('0x3'));var router=express[_0x29f5('0x4')]();var fs_extra=require(_0x29f5('0x5'));var auth=require(_0x29f5('0x6'));var interaction=require(_0x29f5('0x7'));var config=require(_0x29f5('0x8'));var controller=require(_0x29f5('0x9'));router['get']('/',auth[_0x29f5('0xa')](),controller[_0x29f5('0xb')]);router[_0x29f5('0xc')](_0x29f5('0xd'),auth[_0x29f5('0xa')](),controller['show']);router[_0x29f5('0xc')]('/:id/subjects',auth[_0x29f5('0xa')](),controller[_0x29f5('0xe')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x29f5('0xf')]);router[_0x29f5('0xc')](_0x29f5('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0x29f5('0x11')]('/',auth['isAuthenticated'](),controller[_0x29f5('0x12')]);router[_0x29f5('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x29f5('0x14')]);router['delete']('/:id',auth[_0x29f5('0xa')](),controller[_0x29f5('0x15')]);module[_0x29f5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 083dad1..2109eb2 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 _0x8515=['sequelize','STRING'];(function(_0xe0b81f,_0x1fb734){var _0x290e5e=function(_0x19b8d3){while(--_0x19b8d3){_0xe0b81f['push'](_0xe0b81f['shift']());}};_0x290e5e(++_0x1fb734);}(_0x8515,0x100));var _0x5851=function(_0x39106e,_0x586f3d){_0x39106e=_0x39106e-0x0;var _0x892aec=_0x8515[_0x39106e];return _0x892aec;};'use strict';var Sequelize=require(_0x5851('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5851('0x1')]}}; \ No newline at end of file +var _0x2f0d=['sequelize','exports','STRING'];(function(_0x579116,_0x54f33e){var _0x38970d=function(_0x11c50c){while(--_0x11c50c){_0x579116['push'](_0x579116['shift']());}};_0x38970d(++_0x54f33e);}(_0x2f0d,0x1bf));var _0xd2f0=function(_0x312564,_0x334d68){_0x312564=_0x312564-0x0;var _0x58e078=_0x2f0d[_0x312564];return _0x58e078;};'use strict';var Sequelize=require(_0xd2f0('0x0'));module[_0xd2f0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd2f0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 6af7459..85e1341 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 _0x4551=['save','update','then','stack','name','map','FreshsalesConfiguration','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','catch','create','body','destroy','findOne','FreshsalesField','order','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject'];(function(_0x5dfd65,_0x1ad889){var _0x47f853=function(_0x3fafbf){while(--_0x3fafbf){_0x5dfd65['push'](_0x5dfd65['shift']());}};_0x47f853(++_0x1ad889);}(_0x4551,0x15d));var _0x1455=function(_0x1b2c3b,_0x2767d5){_0x1b2c3b=_0x1b2c3b-0x0;var _0x16d7cb=_0x4551[_0x1b2c3b];return _0x16d7cb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1455('0x0'));var zipdir=require(_0x1455('0x1'));var jsonpatch=require(_0x1455('0x2'));var rp=require(_0x1455('0x3'));var moment=require(_0x1455('0x4'));var BPromise=require(_0x1455('0x5'));var Mustache=require('mustache');var util=require(_0x1455('0x6'));var path=require(_0x1455('0x7'));var sox=require('sox');var csv=require(_0x1455('0x8'));var ejs=require(_0x1455('0x9'));var fs=require('fs');var fs_extra=require(_0x1455('0xa'));var _=require('lodash');var squel=require(_0x1455('0xb'));var crypto=require(_0x1455('0xc'));var jsforce=require(_0x1455('0xd'));var deskjs=require(_0x1455('0xe'));var toCsv=require(_0x1455('0x8'));var querystring=require(_0x1455('0xf'));var Papa=require(_0x1455('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1455('0x11'));var as=require(_0x1455('0x12'));var hardwareService=require(_0x1455('0x13'));var logger=require(_0x1455('0x14'))(_0x1455('0x15'));var utils=require(_0x1455('0x16'));var config=require(_0x1455('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1455('0x18'))['db'];function respondWithStatusCode(_0x2ef952,_0xfc4fde){_0xfc4fde=_0xfc4fde||0xcc;return function(_0x1257a8){if(_0x1257a8){return _0x2ef952[_0x1455('0x19')](_0xfc4fde);}return _0x2ef952[_0x1455('0x1a')](_0xfc4fde)[_0x1455('0x1b')]();};}function respondWithResult(_0x3ec800,_0x3e84c3){_0x3e84c3=_0x3e84c3||0xc8;return function(_0xb9fdb6){if(_0xb9fdb6){return _0x3ec800[_0x1455('0x1a')](_0x3e84c3)[_0x1455('0x1c')](_0xb9fdb6);}};}function respondWithFilteredResult(_0x17e55b,_0x5eef4f){return function(_0x55f085){if(_0x55f085){var _0x15f3e3=typeof _0x5eef4f[_0x1455('0x1d')]==='undefined'&&typeof _0x5eef4f['limit']===_0x1455('0x1e');var _0x2991f2=_0x55f085[_0x1455('0x1f')];var _0x150d74=_0x15f3e3?0x0:_0x5eef4f['offset'];var _0x4b7240=_0x15f3e3?_0x55f085[_0x1455('0x1f')]:_0x5eef4f[_0x1455('0x1d')]+_0x5eef4f[_0x1455('0x20')];var _0x4c457a;if(_0x4b7240>=_0x2991f2){_0x4b7240=_0x2991f2;_0x4c457a=0xc8;}else{_0x4c457a=0xce;}_0x17e55b[_0x1455('0x1a')](_0x4c457a);return _0x17e55b[_0x1455('0x21')](_0x1455('0x22'),_0x150d74+'-'+_0x4b7240+'/'+_0x2991f2)[_0x1455('0x1c')](_0x55f085);}return null;};}function patchUpdates(_0x3114ae){return function(_0x205c14){try{jsonpatch['apply'](_0x205c14,_0x3114ae,!![]);}catch(_0x286d56){return BPromise[_0x1455('0x23')](_0x286d56);}return _0x205c14[_0x1455('0x24')]();};}function saveUpdates(_0x4911c0,_0x597817){return function(_0x32cf64){if(_0x32cf64){return _0x32cf64[_0x1455('0x25')](_0x4911c0)[_0x1455('0x26')](function(_0x5ea81d){return _0x5ea81d;});}return null;};}function removeEntity(_0x5d87b7,_0x1f6528){return function(_0x2965d7){if(_0x2965d7){return _0x2965d7['destroy']()['then'](function(){_0x5d87b7[_0x1455('0x1a')](0xcc)[_0x1455('0x1b')]();});}};}function handleEntityNotFound(_0xdee7d7,_0x5a6316){return function(_0x2e84dd){if(!_0x2e84dd){_0xdee7d7['sendStatus'](0x194);}return _0x2e84dd;};}function handleError(_0x24e8fd,_0x10fc4a){_0x10fc4a=_0x10fc4a||0x1f4;return function(_0x4d29de){logger['error'](_0x4d29de[_0x1455('0x27')]);if(_0x4d29de['name']){delete _0x4d29de[_0x1455('0x28')];}_0x24e8fd[_0x1455('0x1a')](_0x10fc4a)['send'](_0x4d29de);};}exports['index']=function(_0x5000bc,_0x4a7a3e){var _0x3cf118={},_0xd83917={},_0x4f4752={'count':0x0,'rows':[]};var _0x34ab96=_[_0x1455('0x29')](db[_0x1455('0x2a')][_0x1455('0x2b')],function(_0x656463){return{'name':_0x656463['fieldName'],'type':_0x656463[_0x1455('0x2c')]['key']};});_0xd83917[_0x1455('0x2d')]=_[_0x1455('0x29')](_0x34ab96,_0x1455('0x28'));_0xd83917[_0x1455('0x2e')]=_[_0x1455('0x2f')](_0x5000bc['query']);_0xd83917[_0x1455('0x30')]=_[_0x1455('0x31')](_0xd83917['model'],_0xd83917['query']);_0x3cf118[_0x1455('0x32')]=_[_0x1455('0x31')](_0xd83917[_0x1455('0x2d')],qs[_0x1455('0x33')](_0x5000bc['query'][_0x1455('0x33')]));_0x3cf118[_0x1455('0x32')]=_0x3cf118[_0x1455('0x32')][_0x1455('0x34')]?_0x3cf118['attributes']:_0xd83917['model'];if(!_0x5000bc[_0x1455('0x2e')][_0x1455('0x35')](_0x1455('0x36'))){_0x3cf118[_0x1455('0x20')]=qs[_0x1455('0x20')](_0x5000bc[_0x1455('0x2e')]['limit']);_0x3cf118[_0x1455('0x1d')]=qs[_0x1455('0x1d')](_0x5000bc[_0x1455('0x2e')][_0x1455('0x1d')]);}_0x3cf118['order']=qs[_0x1455('0x37')](_0x5000bc['query'][_0x1455('0x37')]);_0x3cf118[_0x1455('0x38')]=qs[_0x1455('0x30')](_[_0x1455('0x39')](_0x5000bc[_0x1455('0x2e')],_0xd83917[_0x1455('0x30')]),_0x34ab96);if(_0x5000bc[_0x1455('0x2e')][_0x1455('0x3a')]){_0x3cf118['where']=_['merge'](_0x3cf118[_0x1455('0x38')],{'$or':_['map'](_0x34ab96,function(_0x386411){if(_0x386411[_0x1455('0x2c')]!==_0x1455('0x3b')){var _0x3fa46b={};_0x3fa46b[_0x386411[_0x1455('0x28')]]={'$like':'%'+_0x5000bc[_0x1455('0x2e')][_0x1455('0x3a')]+'%'};return _0x3fa46b;}})});}_0x3cf118=_[_0x1455('0x3c')]({},_0x3cf118,_0x5000bc[_0x1455('0x3d')]);var _0x2ec0a9={'where':_0x3cf118[_0x1455('0x38')]};return db[_0x1455('0x2a')]['count'](_0x2ec0a9)[_0x1455('0x26')](function(_0x43dae5){_0x4f4752['count']=_0x43dae5;if(_0x5000bc[_0x1455('0x2e')][_0x1455('0x3e')]){_0x3cf118[_0x1455('0x3f')]=[{'all':!![]}];}return db[_0x1455('0x2a')][_0x1455('0x40')](_0x3cf118);})[_0x1455('0x26')](function(_0x5ecd30){_0x4f4752['rows']=_0x5ecd30;return _0x4f4752;})[_0x1455('0x26')](respondWithFilteredResult(_0x4a7a3e,_0x3cf118))['catch'](handleError(_0x4a7a3e,null));};exports[_0x1455('0x41')]=function(_0x363856,_0x2accc7){var _0x16f9a3={'raw':![],'where':{'id':_0x363856[_0x1455('0x42')]['id']}},_0x2da102={};_0x2da102[_0x1455('0x2d')]=_['keys'](db[_0x1455('0x2a')][_0x1455('0x2b')]);_0x2da102['query']=_[_0x1455('0x2f')](_0x363856['query']);_0x2da102[_0x1455('0x30')]=_[_0x1455('0x31')](_0x2da102[_0x1455('0x2d')],_0x2da102[_0x1455('0x2e')]);_0x16f9a3[_0x1455('0x32')]=_[_0x1455('0x31')](_0x2da102[_0x1455('0x2d')],qs[_0x1455('0x33')](_0x363856[_0x1455('0x2e')][_0x1455('0x33')]));_0x16f9a3[_0x1455('0x32')]=_0x16f9a3[_0x1455('0x32')][_0x1455('0x34')]?_0x16f9a3[_0x1455('0x32')]:_0x2da102[_0x1455('0x2d')];if(_0x363856[_0x1455('0x2e')][_0x1455('0x3e')]){_0x16f9a3['include']=[{'all':!![]}];}_0x16f9a3=_[_0x1455('0x3c')]({},_0x16f9a3,_0x363856['options']);return db['FreshsalesConfiguration'][_0x1455('0x43')](_0x16f9a3)[_0x1455('0x26')](handleEntityNotFound(_0x2accc7,null))[_0x1455('0x26')](respondWithResult(_0x2accc7,null))[_0x1455('0x44')](handleError(_0x2accc7,null));};exports[_0x1455('0x45')]=function(_0x3badf7,_0x1930ff){return db[_0x1455('0x2a')]['create'](_0x3badf7[_0x1455('0x46')],{})['then'](respondWithResult(_0x1930ff,0xc9))[_0x1455('0x44')](handleError(_0x1930ff,null));};exports[_0x1455('0x25')]=function(_0x195913,_0x261063){if(_0x195913['body']['id']){delete _0x195913[_0x1455('0x46')]['id'];}return db[_0x1455('0x2a')][_0x1455('0x43')]({'where':{'id':_0x195913['params']['id']}})[_0x1455('0x26')](handleEntityNotFound(_0x261063,null))['then'](saveUpdates(_0x195913['body'],null))['then'](respondWithResult(_0x261063,null))['catch'](handleError(_0x261063,null));};exports[_0x1455('0x47')]=function(_0xe05ac4,_0x27fae5){return db[_0x1455('0x2a')][_0x1455('0x43')]({'where':{'id':_0xe05ac4[_0x1455('0x42')]['id']}})[_0x1455('0x26')](handleEntityNotFound(_0x27fae5,null))[_0x1455('0x26')](removeEntity(_0x27fae5,null))[_0x1455('0x44')](handleError(_0x27fae5,null));};exports['getSubjects']=function(_0x138168,_0x1207f7,_0x25f227){var _0x53f9b9={};var _0x1283e0={};var _0x28680a;var _0x23cc94;return db['FreshsalesConfiguration'][_0x1455('0x48')]({'where':{'id':_0x138168[_0x1455('0x42')]['id']}})[_0x1455('0x26')](handleEntityNotFound(_0x1207f7,null))['then'](function(_0x3fe191){if(_0x3fe191){_0x28680a=_0x3fe191;_0x1283e0[_0x1455('0x2d')]=_['keys'](db[_0x1455('0x49')][_0x1455('0x2b')]);_0x1283e0['query']=_[_0x1455('0x2f')](_0x138168[_0x1455('0x2e')]);_0x1283e0[_0x1455('0x30')]=_[_0x1455('0x31')](_0x1283e0[_0x1455('0x2d')],_0x1283e0[_0x1455('0x2e')]);_0x53f9b9['attributes']=_[_0x1455('0x31')](_0x1283e0[_0x1455('0x2d')],qs['fields'](_0x138168[_0x1455('0x2e')][_0x1455('0x33')]));_0x53f9b9[_0x1455('0x32')]=_0x53f9b9[_0x1455('0x32')]['length']?_0x53f9b9[_0x1455('0x32')]:_0x1283e0[_0x1455('0x2d')];_0x53f9b9[_0x1455('0x4a')]=qs[_0x1455('0x37')](_0x138168[_0x1455('0x2e')][_0x1455('0x37')]);_0x53f9b9[_0x1455('0x38')]=qs[_0x1455('0x30')](_[_0x1455('0x39')](_0x138168[_0x1455('0x2e')],_0x1283e0[_0x1455('0x30')]));if(_0x138168[_0x1455('0x2e')][_0x1455('0x3a')]){_0x53f9b9[_0x1455('0x38')]=_[_0x1455('0x3c')](_0x53f9b9['where'],{'$or':_[_0x1455('0x29')](_0x53f9b9[_0x1455('0x32')],function(_0x46df03){var _0x2cd608={};_0x2cd608[_0x46df03]={'$like':'%'+_0x138168[_0x1455('0x2e')][_0x1455('0x3a')]+'%'};return _0x2cd608;})});}_0x53f9b9=_[_0x1455('0x3c')]({},_0x53f9b9,_0x138168['options']);return _0x28680a['getSubjects'](_0x53f9b9);}})[_0x1455('0x26')](function(_0x2ebc7d){if(_0x2ebc7d){_0x23cc94=_0x2ebc7d[_0x1455('0x34')];if(!_0x138168[_0x1455('0x2e')][_0x1455('0x35')]('nolimit')){_0x53f9b9['limit']=qs[_0x1455('0x20')](_0x138168[_0x1455('0x2e')][_0x1455('0x20')]);_0x53f9b9[_0x1455('0x1d')]=qs[_0x1455('0x1d')](_0x138168[_0x1455('0x2e')][_0x1455('0x1d')]);}return _0x28680a['getSubjects'](_0x53f9b9);}})[_0x1455('0x26')](function(_0x187ee7){if(_0x187ee7){return _0x187ee7?{'count':_0x23cc94,'rows':_0x187ee7}:null;}})[_0x1455('0x26')](respondWithResult(_0x1207f7,null))[_0x1455('0x44')](handleError(_0x1207f7,null));};exports['getDescriptions']=function(_0x2a973b,_0x172ba7,_0x21b3ce){var _0x588b2f={};var _0x420880={};var _0x1711e1;var _0x18c302;return db[_0x1455('0x2a')][_0x1455('0x48')]({'where':{'id':_0x2a973b[_0x1455('0x42')]['id']}})[_0x1455('0x26')](handleEntityNotFound(_0x172ba7,null))['then'](function(_0x51320e){if(_0x51320e){_0x1711e1=_0x51320e;_0x420880['model']=_['keys'](db[_0x1455('0x49')][_0x1455('0x2b')]);_0x420880[_0x1455('0x2e')]=_[_0x1455('0x2f')](_0x2a973b['query']);_0x420880[_0x1455('0x30')]=_[_0x1455('0x31')](_0x420880[_0x1455('0x2d')],_0x420880[_0x1455('0x2e')]);_0x588b2f[_0x1455('0x32')]=_['intersection'](_0x420880['model'],qs[_0x1455('0x33')](_0x2a973b[_0x1455('0x2e')]['fields']));_0x588b2f[_0x1455('0x32')]=_0x588b2f[_0x1455('0x32')][_0x1455('0x34')]?_0x588b2f[_0x1455('0x32')]:_0x420880[_0x1455('0x2d')];_0x588b2f[_0x1455('0x4a')]=qs[_0x1455('0x37')](_0x2a973b[_0x1455('0x2e')]['sort']);_0x588b2f[_0x1455('0x38')]=qs[_0x1455('0x30')](_[_0x1455('0x39')](_0x2a973b['query'],_0x420880[_0x1455('0x30')]));if(_0x2a973b[_0x1455('0x2e')]['filter']){_0x588b2f['where']=_[_0x1455('0x3c')](_0x588b2f['where'],{'$or':_['map'](_0x588b2f[_0x1455('0x32')],function(_0x2ff46a){var _0x4c62dd={};_0x4c62dd[_0x2ff46a]={'$like':'%'+_0x2a973b[_0x1455('0x2e')]['filter']+'%'};return _0x4c62dd;})});}_0x588b2f=_[_0x1455('0x3c')]({},_0x588b2f,_0x2a973b[_0x1455('0x3d')]);return _0x1711e1[_0x1455('0x4b')](_0x588b2f);}})['then'](function(_0xab2cf6){if(_0xab2cf6){_0x18c302=_0xab2cf6[_0x1455('0x34')];if(!_0x2a973b[_0x1455('0x2e')][_0x1455('0x35')]('nolimit')){_0x588b2f['limit']=qs[_0x1455('0x20')](_0x2a973b['query'][_0x1455('0x20')]);_0x588b2f['offset']=qs[_0x1455('0x1d')](_0x2a973b['query'][_0x1455('0x1d')]);}return _0x1711e1[_0x1455('0x4b')](_0x588b2f);}})[_0x1455('0x26')](function(_0xd9ef57){if(_0xd9ef57){return _0xd9ef57?{'count':_0x18c302,'rows':_0xd9ef57}:null;}})[_0x1455('0x26')](respondWithResult(_0x172ba7,null))[_0x1455('0x44')](handleError(_0x172ba7,null));};exports[_0x1455('0x4c')]=function(_0x18b5b1,_0x2def3d,_0x2eb65f){var _0x18e6dd={};var _0x396f58={};var _0x30995d;var _0x1ada4d;return db[_0x1455('0x2a')][_0x1455('0x48')]({'where':{'id':_0x18b5b1[_0x1455('0x42')]['id']}})['then'](handleEntityNotFound(_0x2def3d,null))['then'](function(_0x378416){if(_0x378416){_0x30995d=_0x378416;_0x396f58['model']=_[_0x1455('0x2f')](db[_0x1455('0x49')][_0x1455('0x2b')]);_0x396f58['query']=_[_0x1455('0x2f')](_0x18b5b1[_0x1455('0x2e')]);_0x396f58[_0x1455('0x30')]=_['intersection'](_0x396f58[_0x1455('0x2d')],_0x396f58[_0x1455('0x2e')]);_0x18e6dd['attributes']=_['intersection'](_0x396f58[_0x1455('0x2d')],qs[_0x1455('0x33')](_0x18b5b1[_0x1455('0x2e')][_0x1455('0x33')]));_0x18e6dd[_0x1455('0x32')]=_0x18e6dd['attributes'][_0x1455('0x34')]?_0x18e6dd[_0x1455('0x32')]:_0x396f58[_0x1455('0x2d')];_0x18e6dd[_0x1455('0x4a')]=qs[_0x1455('0x37')](_0x18b5b1['query'][_0x1455('0x37')]);_0x18e6dd[_0x1455('0x38')]=qs[_0x1455('0x30')](_[_0x1455('0x39')](_0x18b5b1['query'],_0x396f58['filters']));if(_0x18b5b1[_0x1455('0x2e')][_0x1455('0x3a')]){_0x18e6dd[_0x1455('0x38')]=_[_0x1455('0x3c')](_0x18e6dd['where'],{'$or':_[_0x1455('0x29')](_0x18e6dd[_0x1455('0x32')],function(_0x33b0e7){var _0x4bc078={};_0x4bc078[_0x33b0e7]={'$like':'%'+_0x18b5b1[_0x1455('0x2e')]['filter']+'%'};return _0x4bc078;})});}_0x18e6dd=_[_0x1455('0x3c')]({},_0x18e6dd,_0x18b5b1['options']);return _0x30995d[_0x1455('0x4c')](_0x18e6dd);}})[_0x1455('0x26')](function(_0x5cc317){if(_0x5cc317){_0x1ada4d=_0x5cc317[_0x1455('0x34')];if(!_0x18b5b1[_0x1455('0x2e')][_0x1455('0x35')]('nolimit')){_0x18e6dd['limit']=qs[_0x1455('0x20')](_0x18b5b1[_0x1455('0x2e')][_0x1455('0x20')]);_0x18e6dd['offset']=qs['offset'](_0x18b5b1[_0x1455('0x2e')]['offset']);}return _0x30995d[_0x1455('0x4c')](_0x18e6dd);}})[_0x1455('0x26')](function(_0x5d1307){if(_0x5d1307){return _0x5d1307?{'count':_0x1ada4d,'rows':_0x5d1307}:null;}})[_0x1455('0x26')](respondWithResult(_0x2def3d,null))[_0x1455('0x44')](handleError(_0x2def3d,null));}; \ No newline at end of file +var _0xaafc=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','merge','filter','options','FreshsalesConfiguration','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','getSubjects','findOne','hasOwnProperty','getDescriptions','FreshsalesField','getFields','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x30a31e,_0x31f766){var _0x170879=function(_0x313ee7){while(--_0x313ee7){_0x30a31e['push'](_0x30a31e['shift']());}};_0x170879(++_0x31f766);}(_0xaafc,0x176));var _0xcaaf=function(_0xc01e31,_0x48752e){_0xc01e31=_0xc01e31-0x0;var _0x2888a1=_0xaafc[_0xc01e31];return _0x2888a1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcaaf('0x0'));var zipdir=require(_0xcaaf('0x1'));var jsonpatch=require(_0xcaaf('0x2'));var rp=require(_0xcaaf('0x3'));var moment=require('moment');var BPromise=require(_0xcaaf('0x4'));var Mustache=require(_0xcaaf('0x5'));var util=require('util');var path=require('path');var sox=require(_0xcaaf('0x6'));var csv=require('to-csv');var ejs=require(_0xcaaf('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcaaf('0x8'));var squel=require(_0xcaaf('0x9'));var crypto=require(_0xcaaf('0xa'));var jsforce=require(_0xcaaf('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xcaaf('0xc'));var querystring=require('querystring');var Papa=require(_0xcaaf('0xd'));var Redis=require('ioredis');var authService=require(_0xcaaf('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xcaaf('0xf'));var hardwareService=require(_0xcaaf('0x10'));var logger=require(_0xcaaf('0x11'))(_0xcaaf('0x12'));var utils=require(_0xcaaf('0x13'));var config=require(_0xcaaf('0x14'));var licenseUtil=require(_0xcaaf('0x15'));var db=require(_0xcaaf('0x16'))['db'];function respondWithStatusCode(_0x27a940,_0x4b6dcf){_0x4b6dcf=_0x4b6dcf||0xcc;return function(_0x3b70a3){if(_0x3b70a3){return _0x27a940[_0xcaaf('0x17')](_0x4b6dcf);}return _0x27a940[_0xcaaf('0x18')](_0x4b6dcf)[_0xcaaf('0x19')]();};}function respondWithResult(_0x215949,_0x35d596){_0x35d596=_0x35d596||0xc8;return function(_0x6afc3){if(_0x6afc3){return _0x215949[_0xcaaf('0x18')](_0x35d596)[_0xcaaf('0x1a')](_0x6afc3);}};}function respondWithFilteredResult(_0x168550,_0x953779){return function(_0x552cf1){if(_0x552cf1){var _0x301344=typeof _0x953779[_0xcaaf('0x1b')]===_0xcaaf('0x1c')&&typeof _0x953779[_0xcaaf('0x1d')]===_0xcaaf('0x1c');var _0x360078=_0x552cf1['count'];var _0xf8e303=_0x301344?0x0:_0x953779[_0xcaaf('0x1b')];var _0x534598=_0x301344?_0x552cf1[_0xcaaf('0x1e')]:_0x953779[_0xcaaf('0x1b')]+_0x953779[_0xcaaf('0x1d')];var _0x43631b;if(_0x534598>=_0x360078){_0x534598=_0x360078;_0x43631b=0xc8;}else{_0x43631b=0xce;}_0x168550[_0xcaaf('0x18')](_0x43631b);return _0x168550[_0xcaaf('0x1f')](_0xcaaf('0x20'),_0xf8e303+'-'+_0x534598+'/'+_0x360078)[_0xcaaf('0x1a')](_0x552cf1);}return null;};}function patchUpdates(_0xbc6023){return function(_0x39e277){try{jsonpatch[_0xcaaf('0x21')](_0x39e277,_0xbc6023,!![]);}catch(_0x5bdc7a){return BPromise[_0xcaaf('0x22')](_0x5bdc7a);}return _0x39e277[_0xcaaf('0x23')]();};}function saveUpdates(_0x33914f,_0x110974){return function(_0x359339){if(_0x359339){return _0x359339[_0xcaaf('0x24')](_0x33914f)[_0xcaaf('0x25')](function(_0x5e0463){return _0x5e0463;});}return null;};}function removeEntity(_0xd6706f,_0x2c565f){return function(_0x3f62c8){if(_0x3f62c8){return _0x3f62c8['destroy']()[_0xcaaf('0x25')](function(){_0xd6706f[_0xcaaf('0x18')](0xcc)[_0xcaaf('0x19')]();});}};}function handleEntityNotFound(_0x3dac7d,_0x2a6d15){return function(_0x4346e2){if(!_0x4346e2){_0x3dac7d[_0xcaaf('0x17')](0x194);}return _0x4346e2;};}function handleError(_0x4ffbab,_0x387319){_0x387319=_0x387319||0x1f4;return function(_0x52145b){logger['error'](_0x52145b['stack']);if(_0x52145b[_0xcaaf('0x26')]){delete _0x52145b[_0xcaaf('0x26')];}_0x4ffbab[_0xcaaf('0x18')](_0x387319)[_0xcaaf('0x27')](_0x52145b);};}exports[_0xcaaf('0x28')]=function(_0x35e500,_0x20be72){var _0x34019c={},_0x1523bc={},_0x4c75a9={'count':0x0,'rows':[]};var _0x4cacf9=_[_0xcaaf('0x29')](db['FreshsalesConfiguration'][_0xcaaf('0x2a')],function(_0x58c170){return{'name':_0x58c170[_0xcaaf('0x2b')],'type':_0x58c170[_0xcaaf('0x2c')][_0xcaaf('0x2d')]};});_0x1523bc[_0xcaaf('0x2e')]=_['map'](_0x4cacf9,_0xcaaf('0x26'));_0x1523bc[_0xcaaf('0x2f')]=_[_0xcaaf('0x30')](_0x35e500['query']);_0x1523bc['filters']=_[_0xcaaf('0x31')](_0x1523bc[_0xcaaf('0x2e')],_0x1523bc['query']);_0x34019c[_0xcaaf('0x32')]=_[_0xcaaf('0x31')](_0x1523bc[_0xcaaf('0x2e')],qs[_0xcaaf('0x33')](_0x35e500[_0xcaaf('0x2f')][_0xcaaf('0x33')]));_0x34019c[_0xcaaf('0x32')]=_0x34019c[_0xcaaf('0x32')][_0xcaaf('0x34')]?_0x34019c['attributes']:_0x1523bc['model'];if(!_0x35e500[_0xcaaf('0x2f')]['hasOwnProperty'](_0xcaaf('0x35'))){_0x34019c[_0xcaaf('0x1d')]=qs[_0xcaaf('0x1d')](_0x35e500['query']['limit']);_0x34019c[_0xcaaf('0x1b')]=qs[_0xcaaf('0x1b')](_0x35e500['query']['offset']);}_0x34019c[_0xcaaf('0x36')]=qs[_0xcaaf('0x37')](_0x35e500[_0xcaaf('0x2f')]['sort']);_0x34019c[_0xcaaf('0x38')]=qs['filters'](_[_0xcaaf('0x39')](_0x35e500['query'],_0x1523bc[_0xcaaf('0x3a')]),_0x4cacf9);if(_0x35e500[_0xcaaf('0x2f')]['filter']){_0x34019c['where']=_[_0xcaaf('0x3b')](_0x34019c[_0xcaaf('0x38')],{'$or':_['map'](_0x4cacf9,function(_0x28e58e){if(_0x28e58e[_0xcaaf('0x2c')]!=='VIRTUAL'){var _0x210268={};_0x210268[_0x28e58e['name']]={'$like':'%'+_0x35e500[_0xcaaf('0x2f')][_0xcaaf('0x3c')]+'%'};return _0x210268;}})});}_0x34019c=_[_0xcaaf('0x3b')]({},_0x34019c,_0x35e500[_0xcaaf('0x3d')]);var _0x136a1f={'where':_0x34019c[_0xcaaf('0x38')]};return db[_0xcaaf('0x3e')][_0xcaaf('0x1e')](_0x136a1f)[_0xcaaf('0x25')](function(_0x48a598){_0x4c75a9['count']=_0x48a598;if(_0x35e500[_0xcaaf('0x2f')]['includeAll']){_0x34019c[_0xcaaf('0x3f')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xcaaf('0x40')](_0x34019c);})[_0xcaaf('0x25')](function(_0x11c09b){_0x4c75a9[_0xcaaf('0x41')]=_0x11c09b;return _0x4c75a9;})['then'](respondWithFilteredResult(_0x20be72,_0x34019c))[_0xcaaf('0x42')](handleError(_0x20be72,null));};exports[_0xcaaf('0x43')]=function(_0x5db97f,_0x16d607){var _0x2ee9d4={'raw':![],'where':{'id':_0x5db97f[_0xcaaf('0x44')]['id']}},_0x7b63bb={};_0x7b63bb[_0xcaaf('0x2e')]=_[_0xcaaf('0x30')](db[_0xcaaf('0x3e')][_0xcaaf('0x2a')]);_0x7b63bb[_0xcaaf('0x2f')]=_[_0xcaaf('0x30')](_0x5db97f[_0xcaaf('0x2f')]);_0x7b63bb[_0xcaaf('0x3a')]=_[_0xcaaf('0x31')](_0x7b63bb[_0xcaaf('0x2e')],_0x7b63bb[_0xcaaf('0x2f')]);_0x2ee9d4[_0xcaaf('0x32')]=_['intersection'](_0x7b63bb['model'],qs['fields'](_0x5db97f['query'][_0xcaaf('0x33')]));_0x2ee9d4[_0xcaaf('0x32')]=_0x2ee9d4[_0xcaaf('0x32')][_0xcaaf('0x34')]?_0x2ee9d4['attributes']:_0x7b63bb['model'];if(_0x5db97f['query'][_0xcaaf('0x45')]){_0x2ee9d4[_0xcaaf('0x3f')]=[{'all':!![]}];}_0x2ee9d4=_[_0xcaaf('0x3b')]({},_0x2ee9d4,_0x5db97f[_0xcaaf('0x3d')]);return db[_0xcaaf('0x3e')][_0xcaaf('0x46')](_0x2ee9d4)[_0xcaaf('0x25')](handleEntityNotFound(_0x16d607,null))['then'](respondWithResult(_0x16d607,null))[_0xcaaf('0x42')](handleError(_0x16d607,null));};exports[_0xcaaf('0x47')]=function(_0x5a61bc,_0x5962eb){return db['FreshsalesConfiguration'][_0xcaaf('0x47')](_0x5a61bc[_0xcaaf('0x48')],{})['then'](respondWithResult(_0x5962eb,0xc9))[_0xcaaf('0x42')](handleError(_0x5962eb,null));};exports['update']=function(_0x510324,_0x409f6b){if(_0x510324[_0xcaaf('0x48')]['id']){delete _0x510324[_0xcaaf('0x48')]['id'];}return db[_0xcaaf('0x3e')][_0xcaaf('0x46')]({'where':{'id':_0x510324[_0xcaaf('0x44')]['id']}})[_0xcaaf('0x25')](handleEntityNotFound(_0x409f6b,null))['then'](saveUpdates(_0x510324[_0xcaaf('0x48')],null))['then'](respondWithResult(_0x409f6b,null))[_0xcaaf('0x42')](handleError(_0x409f6b,null));};exports[_0xcaaf('0x49')]=function(_0x17676b,_0x24e40e){return db['FreshsalesConfiguration'][_0xcaaf('0x46')]({'where':{'id':_0x17676b['params']['id']}})[_0xcaaf('0x25')](handleEntityNotFound(_0x24e40e,null))[_0xcaaf('0x25')](removeEntity(_0x24e40e,null))[_0xcaaf('0x42')](handleError(_0x24e40e,null));};exports[_0xcaaf('0x4a')]=function(_0x293054,_0x45b0c1,_0x7ce144){var _0xb003d4={};var _0x4d4ee2={};var _0x46e400;var _0x180f41;return db['FreshsalesConfiguration'][_0xcaaf('0x4b')]({'where':{'id':_0x293054['params']['id']}})[_0xcaaf('0x25')](handleEntityNotFound(_0x45b0c1,null))[_0xcaaf('0x25')](function(_0x4bcc2f){if(_0x4bcc2f){_0x46e400=_0x4bcc2f;_0x4d4ee2[_0xcaaf('0x2e')]=_[_0xcaaf('0x30')](db['FreshsalesField'][_0xcaaf('0x2a')]);_0x4d4ee2['query']=_[_0xcaaf('0x30')](_0x293054['query']);_0x4d4ee2[_0xcaaf('0x3a')]=_[_0xcaaf('0x31')](_0x4d4ee2[_0xcaaf('0x2e')],_0x4d4ee2[_0xcaaf('0x2f')]);_0xb003d4[_0xcaaf('0x32')]=_[_0xcaaf('0x31')](_0x4d4ee2[_0xcaaf('0x2e')],qs[_0xcaaf('0x33')](_0x293054[_0xcaaf('0x2f')][_0xcaaf('0x33')]));_0xb003d4[_0xcaaf('0x32')]=_0xb003d4['attributes'][_0xcaaf('0x34')]?_0xb003d4[_0xcaaf('0x32')]:_0x4d4ee2[_0xcaaf('0x2e')];_0xb003d4[_0xcaaf('0x36')]=qs[_0xcaaf('0x37')](_0x293054[_0xcaaf('0x2f')][_0xcaaf('0x37')]);_0xb003d4[_0xcaaf('0x38')]=qs[_0xcaaf('0x3a')](_[_0xcaaf('0x39')](_0x293054['query'],_0x4d4ee2['filters']));if(_0x293054[_0xcaaf('0x2f')][_0xcaaf('0x3c')]){_0xb003d4['where']=_[_0xcaaf('0x3b')](_0xb003d4[_0xcaaf('0x38')],{'$or':_['map'](_0xb003d4[_0xcaaf('0x32')],function(_0x46ff21){var _0x4f6838={};_0x4f6838[_0x46ff21]={'$like':'%'+_0x293054[_0xcaaf('0x2f')][_0xcaaf('0x3c')]+'%'};return _0x4f6838;})});}_0xb003d4=_[_0xcaaf('0x3b')]({},_0xb003d4,_0x293054['options']);return _0x46e400[_0xcaaf('0x4a')](_0xb003d4);}})[_0xcaaf('0x25')](function(_0x259d80){if(_0x259d80){_0x180f41=_0x259d80[_0xcaaf('0x34')];if(!_0x293054[_0xcaaf('0x2f')][_0xcaaf('0x4c')](_0xcaaf('0x35'))){_0xb003d4['limit']=qs['limit'](_0x293054[_0xcaaf('0x2f')][_0xcaaf('0x1d')]);_0xb003d4[_0xcaaf('0x1b')]=qs['offset'](_0x293054[_0xcaaf('0x2f')][_0xcaaf('0x1b')]);}return _0x46e400['getSubjects'](_0xb003d4);}})[_0xcaaf('0x25')](function(_0x328a53){if(_0x328a53){return _0x328a53?{'count':_0x180f41,'rows':_0x328a53}:null;}})[_0xcaaf('0x25')](respondWithResult(_0x45b0c1,null))[_0xcaaf('0x42')](handleError(_0x45b0c1,null));};exports[_0xcaaf('0x4d')]=function(_0x4b5aba,_0x28f680,_0x3fdd10){var _0x272b16={};var _0x427868={};var _0x202df1;var _0x43648c;return db[_0xcaaf('0x3e')]['findOne']({'where':{'id':_0x4b5aba[_0xcaaf('0x44')]['id']}})['then'](handleEntityNotFound(_0x28f680,null))[_0xcaaf('0x25')](function(_0x59be41){if(_0x59be41){_0x202df1=_0x59be41;_0x427868[_0xcaaf('0x2e')]=_[_0xcaaf('0x30')](db[_0xcaaf('0x4e')][_0xcaaf('0x2a')]);_0x427868[_0xcaaf('0x2f')]=_[_0xcaaf('0x30')](_0x4b5aba['query']);_0x427868[_0xcaaf('0x3a')]=_[_0xcaaf('0x31')](_0x427868[_0xcaaf('0x2e')],_0x427868[_0xcaaf('0x2f')]);_0x272b16[_0xcaaf('0x32')]=_[_0xcaaf('0x31')](_0x427868[_0xcaaf('0x2e')],qs[_0xcaaf('0x33')](_0x4b5aba[_0xcaaf('0x2f')][_0xcaaf('0x33')]));_0x272b16['attributes']=_0x272b16[_0xcaaf('0x32')]['length']?_0x272b16[_0xcaaf('0x32')]:_0x427868[_0xcaaf('0x2e')];_0x272b16[_0xcaaf('0x36')]=qs[_0xcaaf('0x37')](_0x4b5aba['query'][_0xcaaf('0x37')]);_0x272b16[_0xcaaf('0x38')]=qs[_0xcaaf('0x3a')](_[_0xcaaf('0x39')](_0x4b5aba[_0xcaaf('0x2f')],_0x427868['filters']));if(_0x4b5aba[_0xcaaf('0x2f')][_0xcaaf('0x3c')]){_0x272b16[_0xcaaf('0x38')]=_[_0xcaaf('0x3b')](_0x272b16[_0xcaaf('0x38')],{'$or':_[_0xcaaf('0x29')](_0x272b16[_0xcaaf('0x32')],function(_0x459131){var _0x5bc89e={};_0x5bc89e[_0x459131]={'$like':'%'+_0x4b5aba[_0xcaaf('0x2f')]['filter']+'%'};return _0x5bc89e;})});}_0x272b16=_[_0xcaaf('0x3b')]({},_0x272b16,_0x4b5aba[_0xcaaf('0x3d')]);return _0x202df1[_0xcaaf('0x4d')](_0x272b16);}})[_0xcaaf('0x25')](function(_0x49e9ae){if(_0x49e9ae){_0x43648c=_0x49e9ae[_0xcaaf('0x34')];if(!_0x4b5aba['query'][_0xcaaf('0x4c')](_0xcaaf('0x35'))){_0x272b16[_0xcaaf('0x1d')]=qs[_0xcaaf('0x1d')](_0x4b5aba[_0xcaaf('0x2f')]['limit']);_0x272b16['offset']=qs[_0xcaaf('0x1b')](_0x4b5aba[_0xcaaf('0x2f')][_0xcaaf('0x1b')]);}return _0x202df1[_0xcaaf('0x4d')](_0x272b16);}})[_0xcaaf('0x25')](function(_0x170c15){if(_0x170c15){return _0x170c15?{'count':_0x43648c,'rows':_0x170c15}:null;}})['then'](respondWithResult(_0x28f680,null))[_0xcaaf('0x42')](handleError(_0x28f680,null));};exports[_0xcaaf('0x4f')]=function(_0x5614c8,_0x11f2a9,_0x4cbdff){var _0x7b9db={};var _0x1a97ee={};var _0x48cc87;var _0x58f134;return db[_0xcaaf('0x3e')][_0xcaaf('0x4b')]({'where':{'id':_0x5614c8[_0xcaaf('0x44')]['id']}})[_0xcaaf('0x25')](handleEntityNotFound(_0x11f2a9,null))[_0xcaaf('0x25')](function(_0x1982b6){if(_0x1982b6){_0x48cc87=_0x1982b6;_0x1a97ee[_0xcaaf('0x2e')]=_[_0xcaaf('0x30')](db[_0xcaaf('0x4e')][_0xcaaf('0x2a')]);_0x1a97ee[_0xcaaf('0x2f')]=_[_0xcaaf('0x30')](_0x5614c8[_0xcaaf('0x2f')]);_0x1a97ee['filters']=_[_0xcaaf('0x31')](_0x1a97ee[_0xcaaf('0x2e')],_0x1a97ee[_0xcaaf('0x2f')]);_0x7b9db[_0xcaaf('0x32')]=_[_0xcaaf('0x31')](_0x1a97ee[_0xcaaf('0x2e')],qs['fields'](_0x5614c8['query'][_0xcaaf('0x33')]));_0x7b9db['attributes']=_0x7b9db[_0xcaaf('0x32')][_0xcaaf('0x34')]?_0x7b9db['attributes']:_0x1a97ee[_0xcaaf('0x2e')];_0x7b9db[_0xcaaf('0x36')]=qs['sort'](_0x5614c8[_0xcaaf('0x2f')][_0xcaaf('0x37')]);_0x7b9db[_0xcaaf('0x38')]=qs[_0xcaaf('0x3a')](_[_0xcaaf('0x39')](_0x5614c8[_0xcaaf('0x2f')],_0x1a97ee[_0xcaaf('0x3a')]));if(_0x5614c8['query'][_0xcaaf('0x3c')]){_0x7b9db[_0xcaaf('0x38')]=_[_0xcaaf('0x3b')](_0x7b9db[_0xcaaf('0x38')],{'$or':_[_0xcaaf('0x29')](_0x7b9db['attributes'],function(_0x21a704){var _0x4e32a9={};_0x4e32a9[_0x21a704]={'$like':'%'+_0x5614c8[_0xcaaf('0x2f')]['filter']+'%'};return _0x4e32a9;})});}_0x7b9db=_[_0xcaaf('0x3b')]({},_0x7b9db,_0x5614c8['options']);return _0x48cc87['getFields'](_0x7b9db);}})[_0xcaaf('0x25')](function(_0x31113e){if(_0x31113e){_0x58f134=_0x31113e[_0xcaaf('0x34')];if(!_0x5614c8[_0xcaaf('0x2f')][_0xcaaf('0x4c')]('nolimit')){_0x7b9db[_0xcaaf('0x1d')]=qs[_0xcaaf('0x1d')](_0x5614c8[_0xcaaf('0x2f')][_0xcaaf('0x1d')]);_0x7b9db['offset']=qs['offset'](_0x5614c8['query'][_0xcaaf('0x1b')]);}return _0x48cc87[_0xcaaf('0x4f')](_0x7b9db);}})[_0xcaaf('0x25')](function(_0x5101b3){if(_0x5101b3){return _0x5101b3?{'count':_0x58f134,'rows':_0x5101b3}:null;}})[_0xcaaf('0x25')](respondWithResult(_0x11f2a9,null))[_0xcaaf('0x42')](handleError(_0x11f2a9,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index b7b0d2a..edf797e 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 _0x260d=['int_freshsales_configurations','util','api','moment','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0x1a69b6,_0x20adc4){var _0x1650a9=function(_0x53ad5b){while(--_0x53ad5b){_0x1a69b6['push'](_0x1a69b6['shift']());}};_0x1650a9(++_0x20adc4);}(_0x260d,0x1ae));var _0xd260=function(_0x4b88ae,_0x4a5b09){_0x4b88ae=_0x4b88ae-0x0;var _0x26655d=_0x260d[_0x4b88ae];return _0x26655d;};'use strict';var _=require('lodash');var util=require(_0xd260('0x0'));var logger=require('../../config/logger')(_0xd260('0x1'));var moment=require(_0xd260('0x2'));var BPromise=require('bluebird');var rp=require(_0xd260('0x3'));var fs=require('fs');var path=require(_0xd260('0x4'));var rimraf=require(_0xd260('0x5'));var config=require('../../config/environment');var attributes=require(_0xd260('0x6'));module[_0xd260('0x7')]=function(_0x38eab9,_0xcbfc67){return _0x38eab9[_0xd260('0x8')](_0xd260('0x9'),attributes,{'tableName':_0xd260('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8183=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','lodash'];(function(_0x153560,_0x1b1307){var _0x419546=function(_0xe77daf){while(--_0xe77daf){_0x153560['push'](_0x153560['shift']());}};_0x419546(++_0x1b1307);}(_0x8183,0xbf));var _0x3818=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x8183[_0xa8883];return _0x479426;};'use strict';var _=require(_0x3818('0x0'));var util=require(_0x3818('0x1'));var logger=require(_0x3818('0x2'))(_0x3818('0x3'));var moment=require(_0x3818('0x4'));var BPromise=require(_0x3818('0x5'));var rp=require(_0x3818('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3818('0x7'));var attributes=require(_0x3818('0x8'));module[_0x3818('0x9')]=function(_0x223997,_0x2fc083){return _0x223997[_0x3818('0xa')](_0x3818('0xb'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 909b38e..725b594 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 _0x3807=['request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0xe90990,_0x539ad6){var _0x3d7171=function(_0x40a100){while(--_0x40a100){_0xe90990['push'](_0xe90990['shift']());}};_0x3d7171(++_0x539ad6);}(_0x3807,0x1bc));var _0x7380=function(_0x54dea9,_0x1f9f72){_0x54dea9=_0x54dea9-0x0;var _0x51f29e=_0x3807[_0x54dea9];return _0x51f29e;};'use strict';var _=require(_0x7380('0x0'));var util=require(_0x7380('0x1'));var moment=require(_0x7380('0x2'));var BPromise=require('bluebird');var rs=require(_0x7380('0x3'));var fs=require('fs');var Redis=require(_0x7380('0x4'));var db=require(_0x7380('0x5'))['db'];var utils=require(_0x7380('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x7380('0x7'));var jayson=require(_0x7380('0x8'));var client=jayson['client'][_0x7380('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x324d4c,_0x19990a,_0x3a36bf){return new BPromise(function(_0x5ea68c,_0x19f143){return client[_0x7380('0xa')](_0x324d4c,_0x3a36bf)['then'](function(_0x39ae4c){logger['info'](_0x7380('0xb'),_0x19990a,_0x7380('0xc'));logger[_0x7380('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x19990a,'request\x20sent',JSON[_0x7380('0xe')](_0x39ae4c));if(_0x39ae4c[_0x7380('0xf')]){if(_0x39ae4c[_0x7380('0xf')]['code']===0x1f4){logger['error'](_0x7380('0xb'),_0x19990a,_0x39ae4c[_0x7380('0xf')][_0x7380('0x10')]);return _0x19f143(_0x39ae4c[_0x7380('0xf')][_0x7380('0x10')]);}logger[_0x7380('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x19990a,_0x39ae4c[_0x7380('0xf')]['message']);return _0x5ea68c(_0x39ae4c['error'][_0x7380('0x10')]);}else{logger['info'](_0x7380('0xb'),_0x19990a,_0x7380('0xc'));_0x5ea68c(_0x39ae4c[_0x7380('0x11')][_0x7380('0x10')]);}})[_0x7380('0x12')](function(_0x25f8da){logger['error'](_0x7380('0xb'),_0x19990a,_0x25f8da);_0x19f143(_0x25f8da);});});} \ No newline at end of file +var _0x40c8=['stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x568496,_0x565afd){var _0x26c5c1=function(_0x4d251e){while(--_0x4d251e){_0x568496['push'](_0x568496['shift']());}};_0x26c5c1(++_0x565afd);}(_0x40c8,0x1bf));var _0x840c=function(_0x1c9cff,_0x1fc8e6){_0x1c9cff=_0x1c9cff-0x0;var _0x5d5ac4=_0x40c8[_0x1c9cff];return _0x5d5ac4;};'use strict';var _=require('lodash');var util=require(_0x840c('0x0'));var moment=require(_0x840c('0x1'));var BPromise=require(_0x840c('0x2'));var rs=require(_0x840c('0x3'));var fs=require('fs');var Redis=require(_0x840c('0x4'));var db=require(_0x840c('0x5'))['db'];var utils=require(_0x840c('0x6'));var logger=require(_0x840c('0x7'))('rpc');var config=require(_0x840c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x840c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d66bf,_0x2220fc,_0x1c1423){return new BPromise(function(_0x21381a,_0x536507){return client[_0x840c('0xa')](_0x1d66bf,_0x1c1423)['then'](function(_0x335a78){logger[_0x840c('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2220fc,_0x840c('0xc'));logger[_0x840c('0xd')](_0x840c('0xe'),_0x2220fc,'request\x20sent',JSON[_0x840c('0xf')](_0x335a78));if(_0x335a78[_0x840c('0x10')]){if(_0x335a78[_0x840c('0x10')][_0x840c('0x11')]===0x1f4){logger[_0x840c('0x10')](_0x840c('0x12'),_0x2220fc,_0x335a78['error'][_0x840c('0x13')]);return _0x536507(_0x335a78[_0x840c('0x10')]['message']);}logger['error'](_0x840c('0x12'),_0x2220fc,_0x335a78[_0x840c('0x10')][_0x840c('0x13')]);return _0x21381a(_0x335a78['error'][_0x840c('0x13')]);}else{logger[_0x840c('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2220fc,'request\x20sent');_0x21381a(_0x335a78['result']['message']);}})[_0x840c('0x14')](function(_0x4a059a){logger[_0x840c('0x10')](_0x840c('0x12'),_0x2220fc,_0x4a059a);_0x536507(_0x4a059a);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index b5383b6..f904f5c 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 _0xd49c=['../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','util','connect-timeout','express','fs-extra'];(function(_0x1979d8,_0x10d8f2){var _0x1d5bb3=function(_0x42e0b4){while(--_0x42e0b4){_0x1979d8['push'](_0x1979d8['shift']());}};_0x1d5bb3(++_0x10d8f2);}(_0xd49c,0x1d8));var _0xcd49=function(_0xc54eef,_0x48182d){_0xc54eef=_0xc54eef-0x0;var _0x2cc046=_0xd49c[_0xc54eef];return _0x2cc046;};'use strict';var multer=require('multer');var util=require(_0xcd49('0x0'));var path=require('path');var timeout=require(_0xcd49('0x1'));var express=require(_0xcd49('0x2'));var router=express['Router']();var fs_extra=require(_0xcd49('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xcd49('0x4'));var config=require('../../config/environment');var controller=require(_0xcd49('0x5'));router[_0xcd49('0x6')]('/',auth[_0xcd49('0x7')](),controller[_0xcd49('0x8')]);router[_0xcd49('0x6')](_0xcd49('0x9'),auth[_0xcd49('0x7')](),controller[_0xcd49('0xa')]);router[_0xcd49('0xb')]('/',auth[_0xcd49('0x7')](),controller[_0xcd49('0xc')]);router['put'](_0xcd49('0x9'),auth[_0xcd49('0x7')](),controller[_0xcd49('0xd')]);router[_0xcd49('0xe')](_0xcd49('0x9'),auth[_0xcd49('0x7')](),controller[_0xcd49('0xf')]);module[_0xcd49('0x10')]=router; \ No newline at end of file +var _0xd136=['put','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id','post','create'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xd136,0x94));var _0x6d13=function(_0x2e39ca,_0x55cd72){_0x2e39ca=_0x2e39ca-0x0;var _0x288330=_0xd136[_0x2e39ca];return _0x288330;};'use strict';var multer=require('multer');var util=require(_0x6d13('0x0'));var path=require(_0x6d13('0x1'));var timeout=require('connect-timeout');var express=require(_0x6d13('0x2'));var router=express[_0x6d13('0x3')]();var fs_extra=require(_0x6d13('0x4'));var auth=require(_0x6d13('0x5'));var interaction=require(_0x6d13('0x6'));var config=require(_0x6d13('0x7'));var controller=require(_0x6d13('0x8'));router[_0x6d13('0x9')]('/',auth[_0x6d13('0xa')](),controller['index']);router[_0x6d13('0x9')](_0x6d13('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x6d13('0xc')]('/',auth[_0x6d13('0xa')](),controller[_0x6d13('0xd')]);router[_0x6d13('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x6d13('0xf')]);router[_0x6d13('0x10')](_0x6d13('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x6d13('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 da0e687..0a3616d 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 _0x3168=['picklist','STRING','ENUM','BOOLEAN','sequelize','exports','variable','keyValue'];(function(_0x531e48,_0x4bb96b){var _0x202971=function(_0x403bf5){while(--_0x403bf5){_0x531e48['push'](_0x531e48['shift']());}};_0x202971(++_0x4bb96b);}(_0x3168,0x1b4));var _0x8316=function(_0x179933,_0x2c5f95){_0x179933=_0x179933-0x0;var _0x5ebcde=_0x3168[_0x179933];return _0x5ebcde;};'use strict';var Sequelize=require(_0x8316('0x0'));module[_0x8316('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x8316('0x2'),'customVariable',_0x8316('0x3'),_0x8316('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8316('0x5')]},'key':{'type':Sequelize[_0x8316('0x5')]},'keyType':{'type':Sequelize[_0x8316('0x6')]('string',_0x8316('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8316('0x5')]},'nameField':{'type':Sequelize[_0x8316('0x5')]},'customField':{'type':Sequelize[_0x8316('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x251a=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0xd6b242,_0x5d5a7d){var _0x3b264d=function(_0x2b2caf){while(--_0x2b2caf){_0xd6b242['push'](_0xd6b242['shift']());}};_0x3b264d(++_0x5d5a7d);}(_0x251a,0x118));var _0xa251=function(_0x4bec28,_0x3138a9){_0x4bec28=_0x4bec28-0x0;var _0x36cd6e=_0x251a[_0x4bec28];return _0x36cd6e;};'use strict';var Sequelize=require(_0xa251('0x0'));module[_0xa251('0x1')]={'type':{'type':Sequelize[_0xa251('0x2')](_0xa251('0x3'),_0xa251('0x4'),_0xa251('0x5'),_0xa251('0x6'),_0xa251('0x7')),'defaultValue':_0xa251('0x3')},'content':{'type':Sequelize[_0xa251('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa251('0x2')](_0xa251('0x3'),_0xa251('0x4'),_0xa251('0x5'))},'keyContent':{'type':Sequelize[_0xa251('0x8')]},'idField':{'type':Sequelize[_0xa251('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa251('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa251('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 03e21c7..1915273 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 _0x7e44=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','filter','options','FreshsalesField','include','findAll','rows','catch','show','params','length','find','create','body','zip-dir','request-promise','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x15fe4e,_0x102667){var _0x5a98a3=function(_0x4b979e){while(--_0x4b979e){_0x15fe4e['push'](_0x15fe4e['shift']());}};_0x5a98a3(++_0x102667);}(_0x7e44,0x14e));var _0x47e4=function(_0xe45118,_0x5dffbc){_0xe45118=_0xe45118-0x0;var _0x15e15d=_0x7e44[_0xe45118];return _0x15e15d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x47e4('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47e4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x47e4('0x2'));var util=require(_0x47e4('0x3'));var path=require(_0x47e4('0x4'));var sox=require('sox');var csv=require(_0x47e4('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47e4('0x6'));var _=require(_0x47e4('0x7'));var squel=require(_0x47e4('0x8'));var crypto=require(_0x47e4('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x47e4('0x5'));var querystring=require(_0x47e4('0xa'));var Papa=require(_0x47e4('0xb'));var Redis=require(_0x47e4('0xc'));var authService=require(_0x47e4('0xd'));var qs=require(_0x47e4('0xe'));var as=require(_0x47e4('0xf'));var hardwareService=require(_0x47e4('0x10'));var logger=require(_0x47e4('0x11'))(_0x47e4('0x12'));var utils=require('../../config/utils');var config=require(_0x47e4('0x13'));var licenseUtil=require(_0x47e4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4de98a,_0x5b7fd5){_0x5b7fd5=_0x5b7fd5||0xcc;return function(_0x2292ce){if(_0x2292ce){return _0x4de98a[_0x47e4('0x15')](_0x5b7fd5);}return _0x4de98a[_0x47e4('0x16')](_0x5b7fd5)['end']();};}function respondWithResult(_0x234b3c,_0x42ecde){_0x42ecde=_0x42ecde||0xc8;return function(_0x35b03f){if(_0x35b03f){return _0x234b3c['status'](_0x42ecde)[_0x47e4('0x17')](_0x35b03f);}};}function respondWithFilteredResult(_0x5eaf6e,_0x3375df){return function(_0x1a690c){if(_0x1a690c){var _0x3fcae4=typeof _0x3375df[_0x47e4('0x18')]===_0x47e4('0x19')&&typeof _0x3375df['limit']===_0x47e4('0x19');var _0x4f2cf9=_0x1a690c[_0x47e4('0x1a')];var _0xcc68da=_0x3fcae4?0x0:_0x3375df['offset'];var _0x322f10=_0x3fcae4?_0x1a690c[_0x47e4('0x1a')]:_0x3375df[_0x47e4('0x18')]+_0x3375df['limit'];var _0x6bb676;if(_0x322f10>=_0x4f2cf9){_0x322f10=_0x4f2cf9;_0x6bb676=0xc8;}else{_0x6bb676=0xce;}_0x5eaf6e[_0x47e4('0x16')](_0x6bb676);return _0x5eaf6e['set'](_0x47e4('0x1b'),_0xcc68da+'-'+_0x322f10+'/'+_0x4f2cf9)[_0x47e4('0x17')](_0x1a690c);}return null;};}function patchUpdates(_0x11a71c){return function(_0x3c99d3){try{jsonpatch[_0x47e4('0x1c')](_0x3c99d3,_0x11a71c,!![]);}catch(_0x18dae0){return BPromise[_0x47e4('0x1d')](_0x18dae0);}return _0x3c99d3[_0x47e4('0x1e')]();};}function saveUpdates(_0x50c4f4,_0xe50c13){return function(_0x560e5a){if(_0x560e5a){return _0x560e5a[_0x47e4('0x1f')](_0x50c4f4)[_0x47e4('0x20')](function(_0x22f533){return _0x22f533;});}return null;};}function removeEntity(_0x2e278c,_0x59d1a4){return function(_0x4532f0){if(_0x4532f0){return _0x4532f0[_0x47e4('0x21')]()[_0x47e4('0x20')](function(){_0x2e278c[_0x47e4('0x16')](0xcc)[_0x47e4('0x22')]();});}};}function handleEntityNotFound(_0x51f4ad,_0x1c0f43){return function(_0x47f3eb){if(!_0x47f3eb){_0x51f4ad[_0x47e4('0x15')](0x194);}return _0x47f3eb;};}function handleError(_0x360b94,_0x1900d3){_0x1900d3=_0x1900d3||0x1f4;return function(_0x629dde){logger['error'](_0x629dde[_0x47e4('0x23')]);if(_0x629dde[_0x47e4('0x24')]){delete _0x629dde['name'];}_0x360b94['status'](_0x1900d3)[_0x47e4('0x25')](_0x629dde);};}exports[_0x47e4('0x26')]=function(_0x2bc149,_0x1d0476){var _0x49d633={},_0x15d62e={},_0x263576={'count':0x0,'rows':[]};var _0x46b3ab=_[_0x47e4('0x27')](db['FreshsalesField'][_0x47e4('0x28')],function(_0x46f43f){return{'name':_0x46f43f['fieldName'],'type':_0x46f43f[_0x47e4('0x29')]['key']};});_0x15d62e['model']=_[_0x47e4('0x27')](_0x46b3ab,_0x47e4('0x24'));_0x15d62e[_0x47e4('0x2a')]=_[_0x47e4('0x2b')](_0x2bc149[_0x47e4('0x2a')]);_0x15d62e[_0x47e4('0x2c')]=_[_0x47e4('0x2d')](_0x15d62e[_0x47e4('0x2e')],_0x15d62e['query']);_0x49d633[_0x47e4('0x2f')]=_[_0x47e4('0x2d')](_0x15d62e['model'],qs[_0x47e4('0x30')](_0x2bc149[_0x47e4('0x2a')][_0x47e4('0x30')]));_0x49d633[_0x47e4('0x2f')]=_0x49d633[_0x47e4('0x2f')]['length']?_0x49d633['attributes']:_0x15d62e[_0x47e4('0x2e')];if(!_0x2bc149[_0x47e4('0x2a')]['hasOwnProperty'](_0x47e4('0x31'))){_0x49d633[_0x47e4('0x32')]=qs[_0x47e4('0x32')](_0x2bc149[_0x47e4('0x2a')][_0x47e4('0x32')]);_0x49d633[_0x47e4('0x18')]=qs[_0x47e4('0x18')](_0x2bc149[_0x47e4('0x2a')][_0x47e4('0x18')]);}_0x49d633[_0x47e4('0x33')]=qs[_0x47e4('0x34')](_0x2bc149[_0x47e4('0x2a')]['sort']);_0x49d633['where']=qs['filters'](_[_0x47e4('0x35')](_0x2bc149[_0x47e4('0x2a')],_0x15d62e[_0x47e4('0x2c')]),_0x46b3ab);if(_0x2bc149['query']['filter']){_0x49d633[_0x47e4('0x36')]=_[_0x47e4('0x37')](_0x49d633[_0x47e4('0x36')],{'$or':_[_0x47e4('0x27')](_0x46b3ab,function(_0x4bb1fd){if(_0x4bb1fd[_0x47e4('0x29')]!==_0x47e4('0x38')){var _0x406677={};_0x406677[_0x4bb1fd['name']]={'$like':'%'+_0x2bc149[_0x47e4('0x2a')][_0x47e4('0x39')]+'%'};return _0x406677;}})});}_0x49d633=_[_0x47e4('0x37')]({},_0x49d633,_0x2bc149[_0x47e4('0x3a')]);var _0x2ef201={'where':_0x49d633['where']};return db[_0x47e4('0x3b')][_0x47e4('0x1a')](_0x2ef201)[_0x47e4('0x20')](function(_0x40aa05){_0x263576[_0x47e4('0x1a')]=_0x40aa05;if(_0x2bc149[_0x47e4('0x2a')]['includeAll']){_0x49d633[_0x47e4('0x3c')]=[{'all':!![]}];}return db[_0x47e4('0x3b')][_0x47e4('0x3d')](_0x49d633);})[_0x47e4('0x20')](function(_0x5ccba9){_0x263576[_0x47e4('0x3e')]=_0x5ccba9;return _0x263576;})[_0x47e4('0x20')](respondWithFilteredResult(_0x1d0476,_0x49d633))[_0x47e4('0x3f')](handleError(_0x1d0476,null));};exports[_0x47e4('0x40')]=function(_0x5ae0b6,_0x24e849){var _0x3c7bde={'raw':!![],'where':{'id':_0x5ae0b6[_0x47e4('0x41')]['id']}},_0x291b3b={};_0x291b3b[_0x47e4('0x2e')]=_[_0x47e4('0x2b')](db['FreshsalesField'][_0x47e4('0x28')]);_0x291b3b[_0x47e4('0x2a')]=_[_0x47e4('0x2b')](_0x5ae0b6[_0x47e4('0x2a')]);_0x291b3b[_0x47e4('0x2c')]=_[_0x47e4('0x2d')](_0x291b3b[_0x47e4('0x2e')],_0x291b3b['query']);_0x3c7bde[_0x47e4('0x2f')]=_[_0x47e4('0x2d')](_0x291b3b['model'],qs[_0x47e4('0x30')](_0x5ae0b6[_0x47e4('0x2a')][_0x47e4('0x30')]));_0x3c7bde[_0x47e4('0x2f')]=_0x3c7bde['attributes'][_0x47e4('0x42')]?_0x3c7bde[_0x47e4('0x2f')]:_0x291b3b[_0x47e4('0x2e')];if(_0x5ae0b6[_0x47e4('0x2a')]['includeAll']){_0x3c7bde[_0x47e4('0x3c')]=[{'all':!![]}];}_0x3c7bde=_[_0x47e4('0x37')]({},_0x3c7bde,_0x5ae0b6[_0x47e4('0x3a')]);return db[_0x47e4('0x3b')][_0x47e4('0x43')](_0x3c7bde)[_0x47e4('0x20')](handleEntityNotFound(_0x24e849,null))[_0x47e4('0x20')](respondWithResult(_0x24e849,null))['catch'](handleError(_0x24e849,null));};exports[_0x47e4('0x44')]=function(_0x440c42,_0x25db94){return db[_0x47e4('0x3b')][_0x47e4('0x44')](_0x440c42[_0x47e4('0x45')],{})[_0x47e4('0x20')](respondWithResult(_0x25db94,0xc9))[_0x47e4('0x3f')](handleError(_0x25db94,null));};exports[_0x47e4('0x1f')]=function(_0x3d7f39,_0x2131e8){if(_0x3d7f39[_0x47e4('0x45')]['id']){delete _0x3d7f39[_0x47e4('0x45')]['id'];}return db[_0x47e4('0x3b')][_0x47e4('0x43')]({'where':{'id':_0x3d7f39[_0x47e4('0x41')]['id']}})[_0x47e4('0x20')](handleEntityNotFound(_0x2131e8,null))[_0x47e4('0x20')](saveUpdates(_0x3d7f39[_0x47e4('0x45')],null))['then'](respondWithResult(_0x2131e8,null))[_0x47e4('0x3f')](handleError(_0x2131e8,null));};exports[_0x47e4('0x21')]=function(_0xe707be,_0x16532b){return db[_0x47e4('0x3b')]['find']({'where':{'id':_0xe707be[_0x47e4('0x41')]['id']}})[_0x47e4('0x20')](handleEntityNotFound(_0x16532b,null))[_0x47e4('0x20')](removeEntity(_0x16532b,null))[_0x47e4('0x3f')](handleError(_0x16532b,null));}; \ No newline at end of file +var _0x6158=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','send','index','map','FreshsalesField','rawAttributes','type','key','name','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x5f7da0,_0x2d82e0){var _0x504ff9=function(_0x23f0ef){while(--_0x23f0ef){_0x5f7da0['push'](_0x5f7da0['shift']());}};_0x504ff9(++_0x2d82e0);}(_0x6158,0x17c));var _0x8615=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6158[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8615('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8615('0x1'));var jsonpatch=require(_0x8615('0x2'));var rp=require(_0x8615('0x3'));var moment=require(_0x8615('0x4'));var BPromise=require(_0x8615('0x5'));var Mustache=require(_0x8615('0x6'));var util=require(_0x8615('0x7'));var path=require(_0x8615('0x8'));var sox=require(_0x8615('0x9'));var csv=require(_0x8615('0xa'));var ejs=require(_0x8615('0xb'));var fs=require('fs');var fs_extra=require(_0x8615('0xc'));var _=require(_0x8615('0xd'));var squel=require(_0x8615('0xe'));var crypto=require('crypto');var jsforce=require(_0x8615('0xf'));var deskjs=require(_0x8615('0x10'));var toCsv=require(_0x8615('0xa'));var querystring=require(_0x8615('0x11'));var Papa=require(_0x8615('0x12'));var Redis=require(_0x8615('0x13'));var authService=require(_0x8615('0x14'));var qs=require(_0x8615('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8615('0x16'));var logger=require(_0x8615('0x17'))(_0x8615('0x18'));var utils=require(_0x8615('0x19'));var config=require(_0x8615('0x1a'));var licenseUtil=require(_0x8615('0x1b'));var db=require(_0x8615('0x1c'))['db'];function respondWithStatusCode(_0x56e1f3,_0x578367){_0x578367=_0x578367||0xcc;return function(_0x54cbbb){if(_0x54cbbb){return _0x56e1f3['sendStatus'](_0x578367);}return _0x56e1f3[_0x8615('0x1d')](_0x578367)[_0x8615('0x1e')]();};}function respondWithResult(_0x2454d9,_0x950a54){_0x950a54=_0x950a54||0xc8;return function(_0x37b867){if(_0x37b867){return _0x2454d9['status'](_0x950a54)[_0x8615('0x1f')](_0x37b867);}};}function respondWithFilteredResult(_0xe5231c,_0x3c9ce5){return function(_0x5d7eda){if(_0x5d7eda){var _0x1d4b37=typeof _0x3c9ce5[_0x8615('0x20')]===_0x8615('0x21')&&typeof _0x3c9ce5[_0x8615('0x22')]===_0x8615('0x21');var _0x184130=_0x5d7eda[_0x8615('0x23')];var _0x2e2893=_0x1d4b37?0x0:_0x3c9ce5[_0x8615('0x20')];var _0x30bd05=_0x1d4b37?_0x5d7eda[_0x8615('0x23')]:_0x3c9ce5[_0x8615('0x20')]+_0x3c9ce5[_0x8615('0x22')];var _0x35888c;if(_0x30bd05>=_0x184130){_0x30bd05=_0x184130;_0x35888c=0xc8;}else{_0x35888c=0xce;}_0xe5231c[_0x8615('0x1d')](_0x35888c);return _0xe5231c[_0x8615('0x24')](_0x8615('0x25'),_0x2e2893+'-'+_0x30bd05+'/'+_0x184130)[_0x8615('0x1f')](_0x5d7eda);}return null;};}function patchUpdates(_0x104bdc){return function(_0x131f6){try{jsonpatch[_0x8615('0x26')](_0x131f6,_0x104bdc,!![]);}catch(_0x165f6c){return BPromise[_0x8615('0x27')](_0x165f6c);}return _0x131f6[_0x8615('0x28')]();};}function saveUpdates(_0x52748d,_0x15c173){return function(_0xf9cd5e){if(_0xf9cd5e){return _0xf9cd5e[_0x8615('0x29')](_0x52748d)[_0x8615('0x2a')](function(_0x1e0642){return _0x1e0642;});}return null;};}function removeEntity(_0x1bf590,_0x3de872){return function(_0xb202d2){if(_0xb202d2){return _0xb202d2[_0x8615('0x2b')]()[_0x8615('0x2a')](function(){_0x1bf590[_0x8615('0x1d')](0xcc)[_0x8615('0x1e')]();});}};}function handleEntityNotFound(_0x455f32,_0x1e5352){return function(_0x14aa03){if(!_0x14aa03){_0x455f32[_0x8615('0x2c')](0x194);}return _0x14aa03;};}function handleError(_0x1d8b89,_0x4b6be0){_0x4b6be0=_0x4b6be0||0x1f4;return function(_0x40ef3c){logger[_0x8615('0x2d')](_0x40ef3c['stack']);if(_0x40ef3c['name']){delete _0x40ef3c['name'];}_0x1d8b89['status'](_0x4b6be0)[_0x8615('0x2e')](_0x40ef3c);};}exports[_0x8615('0x2f')]=function(_0x46299a,_0x8488d0){var _0x1c794d={},_0x1e818f={},_0x400f61={'count':0x0,'rows':[]};var _0x59d181=_[_0x8615('0x30')](db[_0x8615('0x31')][_0x8615('0x32')],function(_0x31f879){return{'name':_0x31f879['fieldName'],'type':_0x31f879[_0x8615('0x33')][_0x8615('0x34')]};});_0x1e818f['model']=_[_0x8615('0x30')](_0x59d181,_0x8615('0x35'));_0x1e818f['query']=_[_0x8615('0x36')](_0x46299a[_0x8615('0x37')]);_0x1e818f[_0x8615('0x38')]=_[_0x8615('0x39')](_0x1e818f[_0x8615('0x3a')],_0x1e818f[_0x8615('0x37')]);_0x1c794d[_0x8615('0x3b')]=_[_0x8615('0x39')](_0x1e818f[_0x8615('0x3a')],qs['fields'](_0x46299a['query'][_0x8615('0x3c')]));_0x1c794d[_0x8615('0x3b')]=_0x1c794d['attributes'][_0x8615('0x3d')]?_0x1c794d[_0x8615('0x3b')]:_0x1e818f[_0x8615('0x3a')];if(!_0x46299a[_0x8615('0x37')]['hasOwnProperty'](_0x8615('0x3e'))){_0x1c794d['limit']=qs[_0x8615('0x22')](_0x46299a[_0x8615('0x37')][_0x8615('0x22')]);_0x1c794d[_0x8615('0x20')]=qs['offset'](_0x46299a['query'][_0x8615('0x20')]);}_0x1c794d['order']=qs[_0x8615('0x3f')](_0x46299a[_0x8615('0x37')]['sort']);_0x1c794d['where']=qs['filters'](_[_0x8615('0x40')](_0x46299a[_0x8615('0x37')],_0x1e818f[_0x8615('0x38')]),_0x59d181);if(_0x46299a[_0x8615('0x37')][_0x8615('0x41')]){_0x1c794d[_0x8615('0x42')]=_[_0x8615('0x43')](_0x1c794d[_0x8615('0x42')],{'$or':_[_0x8615('0x30')](_0x59d181,function(_0x2ac98b){if(_0x2ac98b['type']!==_0x8615('0x44')){var _0x4ee6d5={};_0x4ee6d5[_0x2ac98b['name']]={'$like':'%'+_0x46299a[_0x8615('0x37')][_0x8615('0x41')]+'%'};return _0x4ee6d5;}})});}_0x1c794d=_['merge']({},_0x1c794d,_0x46299a[_0x8615('0x45')]);var _0xd96c96={'where':_0x1c794d[_0x8615('0x42')]};return db[_0x8615('0x31')][_0x8615('0x23')](_0xd96c96)[_0x8615('0x2a')](function(_0x173484){_0x400f61[_0x8615('0x23')]=_0x173484;if(_0x46299a[_0x8615('0x37')]['includeAll']){_0x1c794d[_0x8615('0x46')]=[{'all':!![]}];}return db[_0x8615('0x31')][_0x8615('0x47')](_0x1c794d);})[_0x8615('0x2a')](function(_0x1f5169){_0x400f61[_0x8615('0x48')]=_0x1f5169;return _0x400f61;})['then'](respondWithFilteredResult(_0x8488d0,_0x1c794d))[_0x8615('0x49')](handleError(_0x8488d0,null));};exports[_0x8615('0x4a')]=function(_0x5b0d32,_0x28e287){var _0x1d8d33={'raw':!![],'where':{'id':_0x5b0d32[_0x8615('0x4b')]['id']}},_0x3336c4={};_0x3336c4[_0x8615('0x3a')]=_[_0x8615('0x36')](db['FreshsalesField'][_0x8615('0x32')]);_0x3336c4[_0x8615('0x37')]=_['keys'](_0x5b0d32[_0x8615('0x37')]);_0x3336c4[_0x8615('0x38')]=_[_0x8615('0x39')](_0x3336c4['model'],_0x3336c4[_0x8615('0x37')]);_0x1d8d33[_0x8615('0x3b')]=_[_0x8615('0x39')](_0x3336c4['model'],qs[_0x8615('0x3c')](_0x5b0d32[_0x8615('0x37')][_0x8615('0x3c')]));_0x1d8d33[_0x8615('0x3b')]=_0x1d8d33[_0x8615('0x3b')][_0x8615('0x3d')]?_0x1d8d33[_0x8615('0x3b')]:_0x3336c4[_0x8615('0x3a')];if(_0x5b0d32[_0x8615('0x37')][_0x8615('0x4c')]){_0x1d8d33[_0x8615('0x46')]=[{'all':!![]}];}_0x1d8d33=_[_0x8615('0x43')]({},_0x1d8d33,_0x5b0d32[_0x8615('0x45')]);return db[_0x8615('0x31')]['find'](_0x1d8d33)[_0x8615('0x2a')](handleEntityNotFound(_0x28e287,null))[_0x8615('0x2a')](respondWithResult(_0x28e287,null))['catch'](handleError(_0x28e287,null));};exports[_0x8615('0x4d')]=function(_0x3aaf6c,_0x32cb38){return db[_0x8615('0x31')]['create'](_0x3aaf6c['body'],{})[_0x8615('0x2a')](respondWithResult(_0x32cb38,0xc9))[_0x8615('0x49')](handleError(_0x32cb38,null));};exports[_0x8615('0x29')]=function(_0x586ffe,_0x2d18de){if(_0x586ffe[_0x8615('0x4e')]['id']){delete _0x586ffe[_0x8615('0x4e')]['id'];}return db[_0x8615('0x31')][_0x8615('0x4f')]({'where':{'id':_0x586ffe[_0x8615('0x4b')]['id']}})[_0x8615('0x2a')](handleEntityNotFound(_0x2d18de,null))['then'](saveUpdates(_0x586ffe[_0x8615('0x4e')],null))[_0x8615('0x2a')](respondWithResult(_0x2d18de,null))[_0x8615('0x49')](handleError(_0x2d18de,null));};exports[_0x8615('0x2b')]=function(_0x2948bf,_0x3a29a6){return db[_0x8615('0x31')][_0x8615('0x4f')]({'where':{'id':_0x2948bf[_0x8615('0x4b')]['id']}})[_0x8615('0x2a')](handleEntityNotFound(_0x3a29a6,null))[_0x8615('0x2a')](removeEntity(_0x3a29a6,null))['catch'](handleError(_0x3a29a6,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 22fafd8..eead29f 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 _0x20d8=['FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x23506e,_0x485b2b){var _0x140824=function(_0x10baa9){while(--_0x10baa9){_0x23506e['push'](_0x23506e['shift']());}};_0x140824(++_0x485b2b);}(_0x20d8,0xee));var _0x820d=function(_0x181cac,_0x4f8ee1){_0x181cac=_0x181cac-0x0;var _0x199d5d=_0x20d8[_0x181cac];return _0x199d5d;};'use strict';var _=require(_0x820d('0x0'));var util=require(_0x820d('0x1'));var logger=require(_0x820d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x820d('0x3'));var rp=require(_0x820d('0x4'));var fs=require('fs');var path=require(_0x820d('0x5'));var rimraf=require(_0x820d('0x6'));var config=require(_0x820d('0x7'));var attributes=require('./intFreshsalesField.attributes');module[_0x820d('0x8')]=function(_0x160735,_0x3b801d){return _0x160735['define'](_0x820d('0x9'),attributes,{'tableName':_0x820d('0xa'),'paranoid':![],'indexes':[{'name':_0x820d('0xb'),'fields':['idField',_0x820d('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe2cf=['request-promise','path','rimraf','./intFreshsalesField.attributes','exports','define','FreshsalesField','idField','FieldId','util','api','bluebird'];(function(_0x152630,_0x74f8b3){var _0x2ad68e=function(_0x313067){while(--_0x313067){_0x152630['push'](_0x152630['shift']());}};_0x2ad68e(++_0x74f8b3);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x36909d,_0x2795f1){_0x36909d=_0x36909d-0x0;var _0x1fd29d=_0xe2cf[_0x36909d];return _0x1fd29d;};'use strict';var _=require('lodash');var util=require(_0xfe2c('0x0'));var logger=require('../../config/logger')(_0xfe2c('0x1'));var moment=require('moment');var BPromise=require(_0xfe2c('0x2'));var rp=require(_0xfe2c('0x3'));var fs=require('fs');var path=require(_0xfe2c('0x4'));var rimraf=require(_0xfe2c('0x5'));var config=require('../../config/environment');var attributes=require(_0xfe2c('0x6'));module[_0xfe2c('0x7')]=function(_0x55bb12,_0x4fa079){return _0x55bb12[_0xfe2c('0x8')](_0xfe2c('0x9'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xfe2c('0xa'),_0xfe2c('0xb')],'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 742d4d6..be06229 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 _0xe2fe=['then','info','FreshsalesField,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x1678c6,_0x4b4146){var _0x32bfba=function(_0x3d1785){while(--_0x3d1785){_0x1678c6['push'](_0x1678c6['shift']());}};_0x32bfba(++_0x4b4146);}(_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 moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file +var _0xe2fe=['then','info','FreshsalesField,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x2c6a38,_0x96007c){var _0x46fd07=function(_0x8c445e){while(--_0x8c445e){_0x2c6a38['push'](_0x2c6a38['shift']());}};_0x46fd07(++_0x96007c);}(_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 moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 07b68b3..4735b97 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(_0x552e6a,_0x337be8){var _0x307a38=function(_0x3393c4){while(--_0x3393c4){_0x552e6a['push'](_0x552e6a['shift']());}};_0x307a38(++_0x337be8);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x41ec0c,_0x18243a){var _0x35c353=function(_0x60072a){while(--_0x60072a){_0x41ec0c['push'](_0x41ec0c['shift']());}};_0x35c353(++_0x18243a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 5f32ec6..1b95890 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 _0x5c82=['integrationTab','newTab','sequelize','exports','STRING','username','ENUM'];(function(_0xee6853,_0x581383){var _0x16dd09=function(_0x5427e7){while(--_0x5427e7){_0xee6853['push'](_0xee6853['shift']());}};_0x16dd09(++_0x581383);}(_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')]},'description':{'type':Sequelize[_0x25c8('0x2')]},'username':{'type':Sequelize[_0x25c8('0x2')],'unique':_0x25c8('0x3')},'remoteUri':{'type':Sequelize[_0x25c8('0x2')]},'password':{'type':Sequelize[_0x25c8('0x2')]},'clientId':{'type':Sequelize[_0x25c8('0x2')]},'clientSecret':{'type':Sequelize[_0x25c8('0x2')]},'securityToken':{'type':Sequelize[_0x25c8('0x2')]},'serverUrl':{'type':Sequelize[_0x25c8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x25c8('0x4')](_0x25c8('0x5'),_0x25c8('0x6')),'defaultValue':_0x25c8('0x5')}}; \ No newline at end of file +var _0x52aa=['exports','STRING','username','newTab','integrationTab'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x52aa,0x113));var _0xa52a=function(_0x582c28,_0x1605a1){_0x582c28=_0x582c28-0x0;var _0x2c29ca=_0x52aa[_0x582c28];return _0x2c29ca;};'use strict';var Sequelize=require('sequelize');module[_0xa52a('0x0')]={'name':{'type':Sequelize[_0xa52a('0x1')]},'description':{'type':Sequelize[_0xa52a('0x1')]},'username':{'type':Sequelize[_0xa52a('0x1')],'unique':_0xa52a('0x2')},'remoteUri':{'type':Sequelize[_0xa52a('0x1')]},'password':{'type':Sequelize[_0xa52a('0x1')]},'clientId':{'type':Sequelize[_0xa52a('0x1')]},'clientSecret':{'type':Sequelize[_0xa52a('0x1')]},'securityToken':{'type':Sequelize[_0xa52a('0x1')]},'serverUrl':{'type':Sequelize[_0xa52a('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xa52a('0x3')),'defaultValue':_0xa52a('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 28b4757..370c20b 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 _0x035c=['name','send','map','SalesforceAccount','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','SalesforceConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','clientId','clientSecret','username','password','securityToken','remoteUri','slice','substring','lastIndexOf','ticketType','sobject','OwnerId','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','phone','includes','custom','picklistValues','value','True','False','false','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','apply','save','update','then','destroy','end','error','stack'];(function(_0x5d5126,_0x17ed8a){var _0x3c38a6=function(_0x27e2d8){while(--_0x27e2d8){_0x5d5126['push'](_0x5d5126['shift']());}};_0x3c38a6(++_0x17ed8a);}(_0x035c,0xc6));var _0xc035=function(_0x46073d,_0x4fc71e){_0x46073d=_0x46073d-0x0;var _0x2294c6=_0x035c[_0x46073d];return _0x2294c6;};'use strict';var emlformat=require(_0xc035('0x0'));var rimraf=require(_0xc035('0x1'));var zipdir=require(_0xc035('0x2'));var jsonpatch=require(_0xc035('0x3'));var rp=require('request-promise');var moment=require(_0xc035('0x4'));var BPromise=require(_0xc035('0x5'));var Mustache=require(_0xc035('0x6'));var util=require('util');var path=require(_0xc035('0x7'));var sox=require('sox');var csv=require(_0xc035('0x8'));var ejs=require(_0xc035('0x9'));var fs=require('fs');var fs_extra=require(_0xc035('0xa'));var _=require(_0xc035('0xb'));var squel=require(_0xc035('0xc'));var crypto=require(_0xc035('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc035('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc035('0xf'));var Papa=require(_0xc035('0x10'));var Redis=require(_0xc035('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc035('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc035('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xc035('0x14'));var licenseUtil=require(_0xc035('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc035('0x16'));function respondWithStatusCode(_0x42e200,_0x408c06){_0x408c06=_0x408c06||0xcc;return function(_0x334566){if(_0x334566){return _0x42e200[_0xc035('0x17')](_0x408c06);}return _0x42e200[_0xc035('0x18')](_0x408c06)['end']();};}function respondWithResult(_0x482298,_0x59fd17){_0x59fd17=_0x59fd17||0xc8;return function(_0x205129){if(_0x205129){return _0x482298['status'](_0x59fd17)[_0xc035('0x19')](_0x205129);}};}function respondWithFilteredResult(_0x4907d3,_0x53cd12){return function(_0x48008a){if(_0x48008a){var _0x5728e1=typeof _0x53cd12[_0xc035('0x1a')]==='undefined'&&typeof _0x53cd12[_0xc035('0x1b')]===_0xc035('0x1c');var _0x1750b1=_0x48008a['count'];var _0x14fbe9=_0x5728e1?0x0:_0x53cd12['offset'];var _0x5583e2=_0x5728e1?_0x48008a[_0xc035('0x1d')]:_0x53cd12[_0xc035('0x1a')]+_0x53cd12[_0xc035('0x1b')];var _0x2b8ec5;if(_0x5583e2>=_0x1750b1){_0x5583e2=_0x1750b1;_0x2b8ec5=0xc8;}else{_0x2b8ec5=0xce;}_0x4907d3[_0xc035('0x18')](_0x2b8ec5);return _0x4907d3['set']('Content-Range',_0x14fbe9+'-'+_0x5583e2+'/'+_0x1750b1)[_0xc035('0x19')](_0x48008a);}return null;};}function patchUpdates(_0x23627a){return function(_0x154818){try{jsonpatch[_0xc035('0x1e')](_0x154818,_0x23627a,!![]);}catch(_0x45d741){return BPromise['reject'](_0x45d741);}return _0x154818[_0xc035('0x1f')]();};}function saveUpdates(_0x53cd9f,_0x3bf44d){return function(_0x182904){if(_0x182904){return _0x182904[_0xc035('0x20')](_0x53cd9f)[_0xc035('0x21')](function(_0x246982){return _0x246982;});}return null;};}function removeEntity(_0x2686c1,_0x28c9a3){return function(_0x408f1c){if(_0x408f1c){return _0x408f1c[_0xc035('0x22')]()['then'](function(){_0x2686c1[_0xc035('0x18')](0xcc)[_0xc035('0x23')]();});}};}function handleEntityNotFound(_0x388fc7,_0xb36c0c){return function(_0x494b0c){if(!_0x494b0c){_0x388fc7['sendStatus'](0x194);}return _0x494b0c;};}function handleError(_0xd8f348,_0x2504c1){_0x2504c1=_0x2504c1||0x1f4;return function(_0x259b0c){logger[_0xc035('0x24')](_0x259b0c[_0xc035('0x25')]);if(_0x259b0c[_0xc035('0x26')]){delete _0x259b0c[_0xc035('0x26')];}_0xd8f348[_0xc035('0x18')](_0x2504c1)[_0xc035('0x27')](_0x259b0c);};}exports['index']=function(_0x3a782b,_0xb3d7fe){var _0x571e27={},_0x50ab71={},_0x49913b={'count':0x0,'rows':[]};var _0x14ab3e=_[_0xc035('0x28')](db[_0xc035('0x29')][_0xc035('0x2a')],function(_0x3123af){return{'name':_0x3123af[_0xc035('0x2b')],'type':_0x3123af['type'][_0xc035('0x2c')]};});_0x50ab71['model']=_[_0xc035('0x28')](_0x14ab3e,_0xc035('0x26'));_0x50ab71[_0xc035('0x2d')]=_['keys'](_0x3a782b[_0xc035('0x2d')]);_0x50ab71[_0xc035('0x2e')]=_[_0xc035('0x2f')](_0x50ab71[_0xc035('0x30')],_0x50ab71[_0xc035('0x2d')]);_0x571e27[_0xc035('0x31')]=_['intersection'](_0x50ab71[_0xc035('0x30')],qs[_0xc035('0x32')](_0x3a782b[_0xc035('0x2d')]['fields']));_0x571e27[_0xc035('0x31')]=_0x571e27[_0xc035('0x31')][_0xc035('0x33')]?_0x571e27[_0xc035('0x31')]:_0x50ab71[_0xc035('0x30')];if(!_0x3a782b[_0xc035('0x2d')][_0xc035('0x34')](_0xc035('0x35'))){_0x571e27[_0xc035('0x1b')]=qs['limit'](_0x3a782b[_0xc035('0x2d')][_0xc035('0x1b')]);_0x571e27[_0xc035('0x1a')]=qs[_0xc035('0x1a')](_0x3a782b['query'][_0xc035('0x1a')]);}_0x571e27[_0xc035('0x36')]=qs[_0xc035('0x37')](_0x3a782b[_0xc035('0x2d')][_0xc035('0x37')]);_0x571e27[_0xc035('0x38')]=qs[_0xc035('0x2e')](_[_0xc035('0x39')](_0x3a782b[_0xc035('0x2d')],_0x50ab71[_0xc035('0x2e')]),_0x14ab3e);if(_0x3a782b[_0xc035('0x2d')][_0xc035('0x3a')]){_0x571e27[_0xc035('0x38')]=_[_0xc035('0x3b')](_0x571e27[_0xc035('0x38')],{'$or':_[_0xc035('0x28')](_0x14ab3e,function(_0x2ce261){if(_0x2ce261[_0xc035('0x3c')]!==_0xc035('0x3d')){var _0x29dd57={};_0x29dd57[_0x2ce261[_0xc035('0x26')]]={'$like':'%'+_0x3a782b['query'][_0xc035('0x3a')]+'%'};return _0x29dd57;}})});}_0x571e27=_[_0xc035('0x3b')]({},_0x571e27,_0x3a782b[_0xc035('0x3e')]);var _0x4c6da8={'where':_0x571e27[_0xc035('0x38')]};return db['SalesforceAccount'][_0xc035('0x1d')](_0x4c6da8)[_0xc035('0x21')](function(_0x3c6497){_0x49913b['count']=_0x3c6497;if(_0x3a782b[_0xc035('0x2d')][_0xc035('0x3f')]){_0x571e27[_0xc035('0x40')]=[{'all':!![]}];}return db[_0xc035('0x29')][_0xc035('0x41')](_0x571e27);})['then'](function(_0x3af695){_0x49913b[_0xc035('0x42')]=_0x3af695;return _0x49913b;})[_0xc035('0x21')](respondWithFilteredResult(_0xb3d7fe,_0x571e27))[_0xc035('0x43')](handleError(_0xb3d7fe,null));};exports[_0xc035('0x44')]=function(_0x104d78,_0x2d7189){var _0x1d665c={'raw':![],'where':{'id':_0x104d78[_0xc035('0x45')]['id']}},_0x28eff2={};_0x28eff2['model']=_[_0xc035('0x46')](db[_0xc035('0x29')][_0xc035('0x2a')]);_0x28eff2[_0xc035('0x2d')]=_[_0xc035('0x46')](_0x104d78[_0xc035('0x2d')]);_0x28eff2[_0xc035('0x2e')]=_[_0xc035('0x2f')](_0x28eff2[_0xc035('0x30')],_0x28eff2['query']);_0x1d665c[_0xc035('0x31')]=_[_0xc035('0x2f')](_0x28eff2[_0xc035('0x30')],qs[_0xc035('0x32')](_0x104d78[_0xc035('0x2d')]['fields']));_0x1d665c['attributes']=_0x1d665c[_0xc035('0x31')][_0xc035('0x33')]?_0x1d665c['attributes']:_0x28eff2[_0xc035('0x30')];if(_0x104d78[_0xc035('0x2d')][_0xc035('0x3f')]){_0x1d665c['include']=[{'all':!![]}];}_0x1d665c=_[_0xc035('0x3b')]({},_0x1d665c,_0x104d78['options']);return db[_0xc035('0x29')][_0xc035('0x47')](_0x1d665c)[_0xc035('0x21')](handleEntityNotFound(_0x2d7189,null))[_0xc035('0x21')](respondWithResult(_0x2d7189,null))['catch'](handleError(_0x2d7189,null));};exports[_0xc035('0x48')]=function(_0x63e8cd,_0x4854d8){return db[_0xc035('0x29')]['create'](_0x63e8cd[_0xc035('0x49')],{})[_0xc035('0x21')](respondWithResult(_0x4854d8,0xc9))['catch'](handleError(_0x4854d8,null));};exports[_0xc035('0x20')]=function(_0x2272ef,_0x3532f8){if(_0x2272ef[_0xc035('0x49')]['id']){delete _0x2272ef['body']['id'];}return db[_0xc035('0x29')][_0xc035('0x47')]({'where':{'id':_0x2272ef[_0xc035('0x45')]['id']}})[_0xc035('0x21')](handleEntityNotFound(_0x3532f8,null))['then'](saveUpdates(_0x2272ef[_0xc035('0x49')],null))[_0xc035('0x21')](respondWithResult(_0x3532f8,null))['catch'](handleError(_0x3532f8,null));};exports[_0xc035('0x22')]=function(_0x16919b,_0x486d09){return db[_0xc035('0x29')][_0xc035('0x47')]({'where':{'id':_0x16919b[_0xc035('0x45')]['id']}})[_0xc035('0x21')](handleEntityNotFound(_0x486d09,null))[_0xc035('0x21')](removeEntity(_0x486d09,null))[_0xc035('0x43')](handleError(_0x486d09,null));};exports[_0xc035('0x4a')]=function(_0x54ced9,_0x3609d1,_0x4f1075){var _0x47b750={};var _0x2f76d4={};var _0x185f00;var _0x554a02;return db['SalesforceAccount']['findOne']({'where':{'id':_0x54ced9['params']['id']}})[_0xc035('0x21')](handleEntityNotFound(_0x3609d1,null))[_0xc035('0x21')](function(_0x579e70){if(_0x579e70){_0x185f00=_0x579e70;_0x2f76d4['model']=_[_0xc035('0x46')](db[_0xc035('0x4b')][_0xc035('0x2a')]);_0x2f76d4[_0xc035('0x2d')]=_[_0xc035('0x46')](_0x54ced9[_0xc035('0x2d')]);_0x2f76d4['filters']=_['intersection'](_0x2f76d4[_0xc035('0x30')],_0x2f76d4['query']);_0x47b750[_0xc035('0x31')]=_[_0xc035('0x2f')](_0x2f76d4[_0xc035('0x30')],qs[_0xc035('0x32')](_0x54ced9['query']['fields']));_0x47b750['attributes']=_0x47b750[_0xc035('0x31')][_0xc035('0x33')]?_0x47b750[_0xc035('0x31')]:_0x2f76d4['model'];_0x47b750[_0xc035('0x36')]=qs[_0xc035('0x37')](_0x54ced9[_0xc035('0x2d')][_0xc035('0x37')]);_0x47b750[_0xc035('0x38')]=qs[_0xc035('0x2e')](_[_0xc035('0x39')](_0x54ced9[_0xc035('0x2d')],_0x2f76d4[_0xc035('0x2e')]));if(_0x54ced9[_0xc035('0x2d')]['filter']){_0x47b750['where']=_[_0xc035('0x3b')](_0x47b750[_0xc035('0x38')],{'$or':_[_0xc035('0x28')](_0x47b750[_0xc035('0x31')],function(_0x5d6dd4){var _0xe56f1e={};_0xe56f1e[_0x5d6dd4]={'$like':'%'+_0x54ced9[_0xc035('0x2d')][_0xc035('0x3a')]+'%'};return _0xe56f1e;})});}_0x47b750=_[_0xc035('0x3b')]({},_0x47b750,_0x54ced9[_0xc035('0x3e')]);return _0x185f00[_0xc035('0x4a')](_0x47b750);}})[_0xc035('0x21')](function(_0x24904a){if(_0x24904a){_0x554a02=_0x24904a['length'];if(!_0x54ced9[_0xc035('0x2d')][_0xc035('0x34')](_0xc035('0x35'))){_0x47b750[_0xc035('0x1b')]=qs['limit'](_0x54ced9[_0xc035('0x2d')][_0xc035('0x1b')]);_0x47b750['offset']=qs[_0xc035('0x1a')](_0x54ced9[_0xc035('0x2d')][_0xc035('0x1a')]);}return _0x185f00[_0xc035('0x4a')](_0x47b750);}})[_0xc035('0x21')](function(_0x16f6f6){if(_0x16f6f6){return _0x16f6f6?{'count':_0x554a02,'rows':_0x16f6f6}:null;}})[_0xc035('0x21')](respondWithResult(_0x3609d1,null))[_0xc035('0x43')](handleError(_0x3609d1,null));};exports['addConfiguration']=function(_0x18f272,_0x193f7b,_0x3632be){if(_0x18f272[_0xc035('0x49')]['id']){delete _0x18f272[_0xc035('0x49')]['id'];}return db['SalesforceAccount'][_0xc035('0x4c')]({'where':{'id':_0x18f272[_0xc035('0x45')]['id']}})['then'](handleEntityNotFound(_0x193f7b,null))['then'](function(_0x2c9cb1){if(_0x2c9cb1){_0x18f272['body']['AccountId']=_0x2c9cb1['id'];_0x18f272[_0xc035('0x49')][_0xc035('0x4d')]=integrations[_0xc035('0x4e')](_0x18f272[_0xc035('0x49')][_0xc035('0x4f')],_0x18f272[_0xc035('0x49')][_0xc035('0x3c')]);_0x18f272[_0xc035('0x49')][_0xc035('0x50')]=integrations[_0xc035('0x51')](_0x18f272[_0xc035('0x49')][_0xc035('0x4f')],_0x18f272[_0xc035('0x49')][_0xc035('0x3c')]);return db['SalesforceConfiguration'][_0xc035('0x48')](_0x18f272[_0xc035('0x49')],{'include':[{'model':db[_0xc035('0x52')],'as':_0xc035('0x4d')},{'model':db[_0xc035('0x52')],'as':_0xc035('0x50')}]});}return null;})[_0xc035('0x21')](respondWithResult(_0x193f7b,null))[_0xc035('0x43')](handleError(_0x193f7b,null));};exports[_0xc035('0x53')]=function(_0x14689b,_0x59f45f,_0x3cd2be){var _0x8c8835;var _0x453d41='';var _0x25ad78=_0xc035('0x54');return db[_0xc035('0x29')][_0xc035('0x4c')]({'where':{'id':_0x14689b[_0xc035('0x45')]['id']},'attributes':['id','remoteUri',_0xc035('0x55'),_0xc035('0x56'),_0xc035('0x57'),_0xc035('0x58'),_0xc035('0x59')]})[_0xc035('0x21')](handleEntityNotFound(_0x59f45f,null))[_0xc035('0x21')](function(_0x2b9924){if(_0x2b9924){_0x453d41=_0x2b9924[_0xc035('0x5a')];var _0x403ecd=_0x453d41[_0xc035('0x5b')](-0x1);if(_0x403ecd==='/'){_0x453d41=_0x453d41[_0xc035('0x5c')](0x0,_0x453d41[_0xc035('0x5d')](_0x403ecd));}_0x8c8835=new jsforce['Connection']({'oauth2':{'loginUrl':_0x453d41,'clientId':_0x2b9924[_0xc035('0x55')],'clientSecret':_0x2b9924[_0xc035('0x56')]}});return _0x8c8835['login'](_0x2b9924[_0xc035('0x57')],_0x2b9924[_0xc035('0x58')]['concat'](_0x2b9924[_0xc035('0x59')]));}})['then'](function(_0x316405){if(_0x316405){if(!_['isNil'](_0x14689b[_0xc035('0x2d')][_0xc035('0x5e')])){_0x25ad78=_0x14689b[_0xc035('0x2d')][_0xc035('0x5e')];}return _0x8c8835[_0xc035('0x5f')](_0x25ad78)['describe']();}})[_0xc035('0x21')](function(_0x52f50c){var _0x848167=[_0xc035('0x60'),'ActivityDate','IsReminderSet',_0xc035('0x61'),_0xc035('0x62'),_0xc035('0x63')];var _0x30983d=[_0xc035('0x64'),_0xc035('0x65'),_0xc035('0x66'),_0xc035('0x67'),_0xc035('0x68'),'textarea',_0xc035('0x69')];if(_0x52f50c){_['remove'](_0x52f50c[_0xc035('0x32')],function(_0x1d3eb3){return _0x848167[_0xc035('0x6a')](_0x1d3eb3['name'])||!_0x30983d[_0xc035('0x6a')](_0x1d3eb3[_0xc035('0x3c')]);});return{'count':_0x52f50c['fields'][_0xc035('0x33')],'rows':_[_0xc035('0x28')](_0x52f50c[_0xc035('0x32')],function(_0x544931){return{'id':_0x544931[_0xc035('0x26')],'name':_0x544931['label'],'custom':_0x544931[_0xc035('0x6b')],'options':_0x544931[_0xc035('0x6c')][_0xc035('0x33')]>0x0?_[_0xc035('0x28')](_0x544931[_0xc035('0x6c')],function(_0x5c07c6){return{'name':_0x5c07c6['label'],'value':_0x5c07c6[_0xc035('0x6d')]};}):_0x544931[_0xc035('0x3c')]=='boolean'?[{'name':_0xc035('0x6e'),'value':'true'},{'name':_0xc035('0x6f'),'value':_0xc035('0x70')}]:[]};})};}})[_0xc035('0x21')](respondWithResult(_0x59f45f,null))[_0xc035('0x43')](function(_0x14f844){var _0x55e828=_0x14689b[_0xc035('0x2d')][_0xc035('0x71')]?0x1f4:_0x14f844['statusCode']||0x1f4;logger[_0xc035('0x24')](_0xc035('0x72'),'getFields',_0x55e828,JSON[_0xc035('0x73')](_0x14f844));delete _0x14f844['name'];if(_0x55e828===0x191){_0x55e828=0x190;}_0x59f45f[_0xc035('0x18')](_0x55e828)[_0xc035('0x27')](_0x14689b[_0xc035('0x2d')][_0xc035('0x71')]?{'message':_0xc035('0x74'),'statusCode':_0x14f844[_0xc035('0x75')]}:_0x14f844);});}; \ No newline at end of file +var _0x6074=['picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','type','True','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','error','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','sort','pick','merge','VIRTUAL','filter','options','where','then','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','destroy','find','findOne','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','OwnerId','IsReminderSet','IsRecurrence','Description','string','int'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6074,0x8a));var _0x4607=function(_0x1caf3f,_0x1b4800){_0x1caf3f=_0x1caf3f-0x0;var _0x1905f0=_0x6074[_0x1caf3f];return _0x1905f0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4607('0x0'));var zipdir=require(_0x4607('0x1'));var jsonpatch=require(_0x4607('0x2'));var rp=require(_0x4607('0x3'));var moment=require('moment');var BPromise=require(_0x4607('0x4'));var Mustache=require(_0x4607('0x5'));var util=require(_0x4607('0x6'));var path=require(_0x4607('0x7'));var sox=require(_0x4607('0x8'));var csv=require('to-csv');var ejs=require(_0x4607('0x9'));var fs=require('fs');var fs_extra=require(_0x4607('0xa'));var _=require('lodash');var squel=require(_0x4607('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4607('0xc'));var toCsv=require(_0x4607('0xd'));var querystring=require(_0x4607('0xe'));var Papa=require(_0x4607('0xf'));var Redis=require('ioredis');var authService=require(_0x4607('0x10'));var qs=require(_0x4607('0x11'));var as=require(_0x4607('0x12'));var hardwareService=require(_0x4607('0x13'));var logger=require('../../config/logger')(_0x4607('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x4607('0x15'));function respondWithStatusCode(_0x503492,_0x23a6fb){_0x23a6fb=_0x23a6fb||0xcc;return function(_0x26a364){if(_0x26a364){return _0x503492[_0x4607('0x16')](_0x23a6fb);}return _0x503492[_0x4607('0x17')](_0x23a6fb)[_0x4607('0x18')]();};}function respondWithResult(_0x64a18c,_0x1ada9c){_0x1ada9c=_0x1ada9c||0xc8;return function(_0x31feb5){if(_0x31feb5){return _0x64a18c[_0x4607('0x17')](_0x1ada9c)[_0x4607('0x19')](_0x31feb5);}};}function respondWithFilteredResult(_0x352512,_0x112045){return function(_0x56844a){if(_0x56844a){var _0x1c0910=typeof _0x112045[_0x4607('0x1a')]===_0x4607('0x1b')&&typeof _0x112045['limit']===_0x4607('0x1b');var _0x464138=_0x56844a[_0x4607('0x1c')];var _0x58ae8f=_0x1c0910?0x0:_0x112045[_0x4607('0x1a')];var _0x4addc7=_0x1c0910?_0x56844a[_0x4607('0x1c')]:_0x112045[_0x4607('0x1a')]+_0x112045[_0x4607('0x1d')];var _0x182a65;if(_0x4addc7>=_0x464138){_0x4addc7=_0x464138;_0x182a65=0xc8;}else{_0x182a65=0xce;}_0x352512[_0x4607('0x17')](_0x182a65);return _0x352512[_0x4607('0x1e')](_0x4607('0x1f'),_0x58ae8f+'-'+_0x4addc7+'/'+_0x464138)[_0x4607('0x19')](_0x56844a);}return null;};}function patchUpdates(_0x5c7f03){return function(_0x5c63a6){try{jsonpatch[_0x4607('0x20')](_0x5c63a6,_0x5c7f03,!![]);}catch(_0x1f0849){return BPromise[_0x4607('0x21')](_0x1f0849);}return _0x5c63a6[_0x4607('0x22')]();};}function saveUpdates(_0x14f080,_0x5e554e){return function(_0x22d61e){if(_0x22d61e){return _0x22d61e[_0x4607('0x23')](_0x14f080)['then'](function(_0x1744c3){return _0x1744c3;});}return null;};}function removeEntity(_0x4a75e1,_0x278d07){return function(_0x4a997a){if(_0x4a997a){return _0x4a997a['destroy']()['then'](function(){_0x4a75e1[_0x4607('0x17')](0xcc)[_0x4607('0x18')]();});}};}function handleEntityNotFound(_0xc4af5,_0x499d95){return function(_0x5f8a5b){if(!_0x5f8a5b){_0xc4af5[_0x4607('0x16')](0x194);}return _0x5f8a5b;};}function handleError(_0x5735ce,_0x3a21da){_0x3a21da=_0x3a21da||0x1f4;return function(_0x51ef1a){logger[_0x4607('0x24')](_0x51ef1a['stack']);if(_0x51ef1a['name']){delete _0x51ef1a[_0x4607('0x25')];}_0x5735ce[_0x4607('0x17')](_0x3a21da)[_0x4607('0x26')](_0x51ef1a);};}exports[_0x4607('0x27')]=function(_0x5391b0,_0x404ba1){var _0x3ca3bd={},_0x2f0096={},_0x1dbb9a={'count':0x0,'rows':[]};var _0x3277de=_[_0x4607('0x28')](db[_0x4607('0x29')][_0x4607('0x2a')],function(_0xd32c85){return{'name':_0xd32c85[_0x4607('0x2b')],'type':_0xd32c85['type'][_0x4607('0x2c')]};});_0x2f0096[_0x4607('0x2d')]=_[_0x4607('0x28')](_0x3277de,_0x4607('0x25'));_0x2f0096[_0x4607('0x2e')]=_['keys'](_0x5391b0['query']);_0x2f0096[_0x4607('0x2f')]=_[_0x4607('0x30')](_0x2f0096[_0x4607('0x2d')],_0x2f0096[_0x4607('0x2e')]);_0x3ca3bd[_0x4607('0x31')]=_[_0x4607('0x30')](_0x2f0096[_0x4607('0x2d')],qs[_0x4607('0x32')](_0x5391b0[_0x4607('0x2e')][_0x4607('0x32')]));_0x3ca3bd[_0x4607('0x31')]=_0x3ca3bd[_0x4607('0x31')]['length']?_0x3ca3bd[_0x4607('0x31')]:_0x2f0096['model'];if(!_0x5391b0[_0x4607('0x2e')]['hasOwnProperty']('nolimit')){_0x3ca3bd['limit']=qs[_0x4607('0x1d')](_0x5391b0[_0x4607('0x2e')][_0x4607('0x1d')]);_0x3ca3bd['offset']=qs[_0x4607('0x1a')](_0x5391b0[_0x4607('0x2e')][_0x4607('0x1a')]);}_0x3ca3bd['order']=qs[_0x4607('0x33')](_0x5391b0['query'][_0x4607('0x33')]);_0x3ca3bd['where']=qs['filters'](_[_0x4607('0x34')](_0x5391b0[_0x4607('0x2e')],_0x2f0096[_0x4607('0x2f')]),_0x3277de);if(_0x5391b0[_0x4607('0x2e')]['filter']){_0x3ca3bd['where']=_[_0x4607('0x35')](_0x3ca3bd['where'],{'$or':_[_0x4607('0x28')](_0x3277de,function(_0x317bb0){if(_0x317bb0['type']!==_0x4607('0x36')){var _0x5278e6={};_0x5278e6[_0x317bb0[_0x4607('0x25')]]={'$like':'%'+_0x5391b0[_0x4607('0x2e')][_0x4607('0x37')]+'%'};return _0x5278e6;}})});}_0x3ca3bd=_[_0x4607('0x35')]({},_0x3ca3bd,_0x5391b0[_0x4607('0x38')]);var _0xf145b={'where':_0x3ca3bd[_0x4607('0x39')]};return db[_0x4607('0x29')][_0x4607('0x1c')](_0xf145b)[_0x4607('0x3a')](function(_0x150dbd){_0x1dbb9a[_0x4607('0x1c')]=_0x150dbd;if(_0x5391b0['query'][_0x4607('0x3b')]){_0x3ca3bd[_0x4607('0x3c')]=[{'all':!![]}];}return db[_0x4607('0x29')][_0x4607('0x3d')](_0x3ca3bd);})[_0x4607('0x3a')](function(_0x3b5548){_0x1dbb9a[_0x4607('0x3e')]=_0x3b5548;return _0x1dbb9a;})[_0x4607('0x3a')](respondWithFilteredResult(_0x404ba1,_0x3ca3bd))[_0x4607('0x3f')](handleError(_0x404ba1,null));};exports[_0x4607('0x40')]=function(_0x4494cc,_0x7409a){var _0x912ca2={'raw':![],'where':{'id':_0x4494cc[_0x4607('0x41')]['id']}},_0x177379={};_0x177379[_0x4607('0x2d')]=_[_0x4607('0x42')](db[_0x4607('0x29')][_0x4607('0x2a')]);_0x177379[_0x4607('0x2e')]=_[_0x4607('0x42')](_0x4494cc[_0x4607('0x2e')]);_0x177379['filters']=_[_0x4607('0x30')](_0x177379[_0x4607('0x2d')],_0x177379[_0x4607('0x2e')]);_0x912ca2[_0x4607('0x31')]=_[_0x4607('0x30')](_0x177379[_0x4607('0x2d')],qs[_0x4607('0x32')](_0x4494cc[_0x4607('0x2e')][_0x4607('0x32')]));_0x912ca2[_0x4607('0x31')]=_0x912ca2[_0x4607('0x31')][_0x4607('0x43')]?_0x912ca2[_0x4607('0x31')]:_0x177379[_0x4607('0x2d')];if(_0x4494cc[_0x4607('0x2e')]['includeAll']){_0x912ca2[_0x4607('0x3c')]=[{'all':!![]}];}_0x912ca2=_[_0x4607('0x35')]({},_0x912ca2,_0x4494cc[_0x4607('0x38')]);return db['SalesforceAccount']['find'](_0x912ca2)[_0x4607('0x3a')](handleEntityNotFound(_0x7409a,null))[_0x4607('0x3a')](respondWithResult(_0x7409a,null))[_0x4607('0x3f')](handleError(_0x7409a,null));};exports[_0x4607('0x44')]=function(_0x32810e,_0x5b2946){return db[_0x4607('0x29')]['create'](_0x32810e[_0x4607('0x45')],{})['then'](respondWithResult(_0x5b2946,0xc9))[_0x4607('0x3f')](handleError(_0x5b2946,null));};exports[_0x4607('0x23')]=function(_0x53f652,_0x3b0de4){if(_0x53f652[_0x4607('0x45')]['id']){delete _0x53f652[_0x4607('0x45')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x53f652['params']['id']}})[_0x4607('0x3a')](handleEntityNotFound(_0x3b0de4,null))['then'](saveUpdates(_0x53f652[_0x4607('0x45')],null))[_0x4607('0x3a')](respondWithResult(_0x3b0de4,null))[_0x4607('0x3f')](handleError(_0x3b0de4,null));};exports[_0x4607('0x46')]=function(_0x46fa09,_0x3ef5d0){return db['SalesforceAccount'][_0x4607('0x47')]({'where':{'id':_0x46fa09[_0x4607('0x41')]['id']}})['then'](handleEntityNotFound(_0x3ef5d0,null))[_0x4607('0x3a')](removeEntity(_0x3ef5d0,null))[_0x4607('0x3f')](handleError(_0x3ef5d0,null));};exports['getConfigurations']=function(_0x426d86,_0x277617,_0x179b41){var _0x33e850={};var _0x2c0a46={};var _0x3d798e;var _0x2415cb;return db[_0x4607('0x29')][_0x4607('0x48')]({'where':{'id':_0x426d86[_0x4607('0x41')]['id']}})[_0x4607('0x3a')](handleEntityNotFound(_0x277617,null))[_0x4607('0x3a')](function(_0x2744f0){if(_0x2744f0){_0x3d798e=_0x2744f0;_0x2c0a46['model']=_[_0x4607('0x42')](db['SalesforceConfiguration'][_0x4607('0x2a')]);_0x2c0a46[_0x4607('0x2e')]=_[_0x4607('0x42')](_0x426d86[_0x4607('0x2e')]);_0x2c0a46[_0x4607('0x2f')]=_[_0x4607('0x30')](_0x2c0a46[_0x4607('0x2d')],_0x2c0a46['query']);_0x33e850['attributes']=_[_0x4607('0x30')](_0x2c0a46[_0x4607('0x2d')],qs[_0x4607('0x32')](_0x426d86[_0x4607('0x2e')][_0x4607('0x32')]));_0x33e850[_0x4607('0x31')]=_0x33e850['attributes'][_0x4607('0x43')]?_0x33e850[_0x4607('0x31')]:_0x2c0a46[_0x4607('0x2d')];_0x33e850['order']=qs[_0x4607('0x33')](_0x426d86[_0x4607('0x2e')][_0x4607('0x33')]);_0x33e850['where']=qs[_0x4607('0x2f')](_[_0x4607('0x34')](_0x426d86[_0x4607('0x2e')],_0x2c0a46[_0x4607('0x2f')]));if(_0x426d86[_0x4607('0x2e')]['filter']){_0x33e850['where']=_[_0x4607('0x35')](_0x33e850[_0x4607('0x39')],{'$or':_[_0x4607('0x28')](_0x33e850[_0x4607('0x31')],function(_0x3b5f66){var _0x4fa646={};_0x4fa646[_0x3b5f66]={'$like':'%'+_0x426d86['query'][_0x4607('0x37')]+'%'};return _0x4fa646;})});}_0x33e850=_[_0x4607('0x35')]({},_0x33e850,_0x426d86[_0x4607('0x38')]);return _0x3d798e[_0x4607('0x49')](_0x33e850);}})[_0x4607('0x3a')](function(_0x1e8d1c){if(_0x1e8d1c){_0x2415cb=_0x1e8d1c[_0x4607('0x43')];if(!_0x426d86[_0x4607('0x2e')]['hasOwnProperty'](_0x4607('0x4a'))){_0x33e850[_0x4607('0x1d')]=qs['limit'](_0x426d86[_0x4607('0x2e')][_0x4607('0x1d')]);_0x33e850[_0x4607('0x1a')]=qs[_0x4607('0x1a')](_0x426d86[_0x4607('0x2e')][_0x4607('0x1a')]);}return _0x3d798e[_0x4607('0x49')](_0x33e850);}})[_0x4607('0x3a')](function(_0x47b371){if(_0x47b371){return _0x47b371?{'count':_0x2415cb,'rows':_0x47b371}:null;}})[_0x4607('0x3a')](respondWithResult(_0x277617,null))[_0x4607('0x3f')](handleError(_0x277617,null));};exports[_0x4607('0x4b')]=function(_0x537ad4,_0x324ff9,_0x285374){if(_0x537ad4[_0x4607('0x45')]['id']){delete _0x537ad4['body']['id'];}return db[_0x4607('0x29')][_0x4607('0x48')]({'where':{'id':_0x537ad4[_0x4607('0x41')]['id']}})['then'](handleEntityNotFound(_0x324ff9,null))[_0x4607('0x3a')](function(_0xf98956){if(_0xf98956){_0x537ad4[_0x4607('0x45')][_0x4607('0x4c')]=_0xf98956['id'];_0x537ad4[_0x4607('0x45')][_0x4607('0x4d')]=integrations[_0x4607('0x4e')](_0x537ad4[_0x4607('0x45')][_0x4607('0x4f')],_0x537ad4['body']['type']);_0x537ad4[_0x4607('0x45')][_0x4607('0x50')]=integrations[_0x4607('0x51')](_0x537ad4[_0x4607('0x45')][_0x4607('0x4f')],_0x537ad4[_0x4607('0x45')]['type']);return db[_0x4607('0x52')]['create'](_0x537ad4[_0x4607('0x45')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x4607('0x53')],'as':_0x4607('0x50')}]});}return null;})[_0x4607('0x3a')](respondWithResult(_0x324ff9,null))[_0x4607('0x3f')](handleError(_0x324ff9,null));};exports[_0x4607('0x54')]=function(_0x299fa6,_0x243854,_0x5865df){var _0x479f92;var _0x3040dd='';var _0x43e8d7='Task';return db[_0x4607('0x29')][_0x4607('0x48')]({'where':{'id':_0x299fa6[_0x4607('0x41')]['id']},'attributes':['id',_0x4607('0x55'),_0x4607('0x56'),_0x4607('0x57'),_0x4607('0x58'),_0x4607('0x59'),_0x4607('0x5a')]})[_0x4607('0x3a')](handleEntityNotFound(_0x243854,null))['then'](function(_0xeb5842){if(_0xeb5842){_0x3040dd=_0xeb5842[_0x4607('0x55')];var _0x516e1f=_0x3040dd[_0x4607('0x5b')](-0x1);if(_0x516e1f==='/'){_0x3040dd=_0x3040dd[_0x4607('0x5c')](0x0,_0x3040dd[_0x4607('0x5d')](_0x516e1f));}_0x479f92=new jsforce[(_0x4607('0x5e'))]({'oauth2':{'loginUrl':_0x3040dd,'clientId':_0xeb5842[_0x4607('0x56')],'clientSecret':_0xeb5842['clientSecret']}});return _0x479f92[_0x4607('0x5f')](_0xeb5842['username'],_0xeb5842[_0x4607('0x59')][_0x4607('0x60')](_0xeb5842[_0x4607('0x5a')]));}})[_0x4607('0x3a')](function(_0xcaa848){if(_0xcaa848){if(!_[_0x4607('0x61')](_0x299fa6[_0x4607('0x2e')][_0x4607('0x62')])){_0x43e8d7=_0x299fa6[_0x4607('0x2e')][_0x4607('0x62')];}return _0x479f92[_0x4607('0x63')](_0x43e8d7)['describe']();}})[_0x4607('0x3a')](function(_0x2c1b7b){var _0x9e7fb2=[_0x4607('0x64'),'ActivityDate',_0x4607('0x65'),_0x4607('0x66'),'Subject',_0x4607('0x67')];var _0x1c51af=[_0x4607('0x68'),_0x4607('0x69'),_0x4607('0x6a'),_0x4607('0x6b'),_0x4607('0x6c'),_0x4607('0x6d'),_0x4607('0x6e')];if(_0x2c1b7b){_[_0x4607('0x6f')](_0x2c1b7b[_0x4607('0x32')],function(_0x5b141c){return _0x9e7fb2[_0x4607('0x70')](_0x5b141c[_0x4607('0x25')])||!_0x1c51af[_0x4607('0x70')](_0x5b141c['type']);});return{'count':_0x2c1b7b[_0x4607('0x32')][_0x4607('0x43')],'rows':_['map'](_0x2c1b7b[_0x4607('0x32')],function(_0xc8a796){return{'id':_0xc8a796['name'],'name':_0xc8a796[_0x4607('0x71')],'custom':_0xc8a796[_0x4607('0x72')],'options':_0xc8a796[_0x4607('0x73')][_0x4607('0x43')]>0x0?_[_0x4607('0x28')](_0xc8a796['picklistValues'],function(_0x37305d){return{'name':_0x37305d[_0x4607('0x71')],'value':_0x37305d['value']};}):_0xc8a796[_0x4607('0x74')]=='boolean'?[{'name':_0x4607('0x75'),'value':'true'},{'name':'False','value':_0x4607('0x76')}]:[]};})};}})['then'](respondWithResult(_0x243854,null))[_0x4607('0x3f')](function(_0x40d023){var _0x37abd2=_0x299fa6[_0x4607('0x2e')][_0x4607('0x77')]?0x1f4:_0x40d023[_0x4607('0x78')]||0x1f4;logger[_0x4607('0x24')](_0x4607('0x79'),_0x4607('0x54'),_0x37abd2,JSON['stringify'](_0x40d023));delete _0x40d023[_0x4607('0x25')];if(_0x37abd2===0x191){_0x37abd2=0x190;}_0x243854[_0x4607('0x17')](_0x37abd2)[_0x4607('0x26')](_0x299fa6['query'][_0x4607('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0x40d023[_0x4607('0x78')]}:_0x40d023);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 4ac20c7..76e8946 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 _0xd0d5=['path','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','bluebird','request-promise'];(function(_0xc3ad12,_0x37f1df){var _0x24029b=function(_0x57db6e){while(--_0x57db6e){_0xc3ad12['push'](_0xc3ad12['shift']());}};_0x24029b(++_0x37f1df);}(_0xd0d5,0x1ed));var _0x5d0d=function(_0x51343a,_0x50e62e){_0x51343a=_0x51343a-0x0;var _0x120184=_0xd0d5[_0x51343a];return _0x120184;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5d0d('0x0'));var rp=require(_0x5d0d('0x1'));var fs=require('fs');var path=require(_0x5d0d('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5d0d('0x3'));var integrations=require(_0x5d0d('0x4'));module[_0x5d0d('0x5')]=function(_0x4259ce,_0x5ace89){return _0x4259ce[_0x5d0d('0x6')](_0x5d0d('0x7'),attributes,{'tableName':_0x5d0d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43b8=['SalesforceAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x43b8,0x1bd));var _0x843b=function(_0xc69fda,_0x367f93){_0xc69fda=_0xc69fda-0x0;var _0x721842=_0x43b8[_0xc69fda];return _0x721842;};'use strict';var _=require(_0x843b('0x0'));var util=require(_0x843b('0x1'));var logger=require(_0x843b('0x2'))(_0x843b('0x3'));var moment=require(_0x843b('0x4'));var BPromise=require(_0x843b('0x5'));var rp=require(_0x843b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x843b('0x7'));var config=require(_0x843b('0x8'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x843b('0x9'));module[_0x843b('0xa')]=function(_0x562b52,_0x16b94f){return _0x562b52['define'](_0x843b('0xb'),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 1f05b25..136dfbc 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 _0x551b=['then','GetSalesforceAccount','stringify','ShowSalesforceAccount','where','map','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','SalesforceAccount','options','raw','attributes','limit','include','model'];(function(_0x1ff33b,_0x3ea8f9){var _0x1a4887=function(_0x248007){while(--_0x248007){_0x1ff33b['push'](_0x1ff33b['shift']());}};_0x1a4887(++_0x3ea8f9);}(_0x551b,0x66));var _0xb551=function(_0x151721,_0x20d5bc){_0x151721=_0x151721-0x0;var _0x2deaa7=_0x551b[_0x151721];return _0x2deaa7;};'use strict';var _=require('lodash');var util=require(_0xb551('0x0'));var moment=require(_0xb551('0x1'));var BPromise=require(_0xb551('0x2'));var rs=require(_0xb551('0x3'));var fs=require('fs');var Redis=require(_0xb551('0x4'));var db=require(_0xb551('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb551('0x6'))(_0xb551('0x7'));var config=require(_0xb551('0x8'));var jayson=require(_0xb551('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x91740a,_0x4cbe9d,_0x58dca9){return new BPromise(function(_0x530a84,_0x5b3eee){return client['request'](_0x91740a,_0x58dca9)['then'](function(_0x339351){logger[_0xb551('0xa')](_0xb551('0xb'),_0x4cbe9d,'request\x20sent');logger[_0xb551('0xc')](_0xb551('0xd'),_0x4cbe9d,_0xb551('0xe'),JSON['stringify'](_0x339351));if(_0x339351['error']){if(_0x339351['error']['code']===0x1f4){logger[_0xb551('0xf')](_0xb551('0xb'),_0x4cbe9d,_0x339351[_0xb551('0xf')][_0xb551('0x10')]);return _0x5b3eee(_0x339351[_0xb551('0xf')][_0xb551('0x10')]);}logger[_0xb551('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x4cbe9d,_0x339351['error']['message']);return _0x530a84(_0x339351['error']['message']);}else{logger[_0xb551('0xa')](_0xb551('0xb'),_0x4cbe9d,_0xb551('0xe'));_0x530a84(_0x339351[_0xb551('0x11')][_0xb551('0x10')]);}})[_0xb551('0x12')](function(_0x1fb143){logger[_0xb551('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x4cbe9d,_0x1fb143);_0x5b3eee(_0x1fb143);});});}exports['GetSalesforceAccount']=function(_0x4fa188){var _0x5eda1f=this;return new Promise(function(_0x12ace6,_0x1dc01a){return db[_0xb551('0x13')]['findAll']({'raw':_0x4fa188[_0xb551('0x14')]?_0x4fa188[_0xb551('0x14')][_0xb551('0x15')]===undefined?!![]:![]:!![],'where':_0x4fa188[_0xb551('0x14')]?_0x4fa188[_0xb551('0x14')]['where']||null:null,'attributes':_0x4fa188['options']?_0x4fa188[_0xb551('0x14')][_0xb551('0x16')]||null:null,'limit':_0x4fa188[_0xb551('0x14')]?_0x4fa188[_0xb551('0x14')][_0xb551('0x17')]||null:null,'include':_0x4fa188['options']?_0x4fa188[_0xb551('0x14')]['include']?_['map'](_0x4fa188[_0xb551('0x14')][_0xb551('0x18')],function(_0x4ab1fa){return{'model':db[_0x4ab1fa['model']],'as':_0x4ab1fa['as'],'attributes':_0x4ab1fa[_0xb551('0x16')],'include':_0x4ab1fa['include']?_['map'](_0x4ab1fa[_0xb551('0x18')],function(_0x1cc958){return{'model':db[_0x1cc958[_0xb551('0x19')]],'as':_0x1cc958['as'],'attributes':_0x1cc958[_0xb551('0x16')],'include':_0x1cc958['include']?_['map'](_0x1cc958[_0xb551('0x18')],function(_0x363fe6){return{'model':db[_0x363fe6[_0xb551('0x19')]],'as':_0x363fe6['as'],'attributes':_0x363fe6[_0xb551('0x16')]};}):[]};}):[]};}):[]:[]})[_0xb551('0x1a')](function(_0x118938){logger[_0xb551('0xa')](_0xb551('0x1b'),_0x4fa188);logger['debug'](_0xb551('0x1b'),_0x4fa188,JSON[_0xb551('0x1c')](_0x118938));_0x12ace6(_0x118938);})[_0xb551('0x12')](function(_0x57f712){logger[_0xb551('0xf')](_0xb551('0x1b'),_0x57f712[_0xb551('0x10')],_0x4fa188);_0x1dc01a(_0x5eda1f[_0xb551('0xf')](0x1f4,_0x57f712[_0xb551('0x10')]));});});};exports[_0xb551('0x1d')]=function(_0x2bfb66){var _0x346cfe=this;return new Promise(function(_0x391626,_0x3cd7ab){return db['SalesforceAccount']['find']({'raw':_0x2bfb66[_0xb551('0x14')]?_0x2bfb66[_0xb551('0x14')][_0xb551('0x15')]===undefined?!![]:![]:!![],'where':_0x2bfb66[_0xb551('0x14')]?_0x2bfb66['options'][_0xb551('0x1e')]||null:null,'attributes':_0x2bfb66[_0xb551('0x14')]?_0x2bfb66['options'][_0xb551('0x16')]||null:null,'include':_0x2bfb66[_0xb551('0x14')]?_0x2bfb66[_0xb551('0x14')][_0xb551('0x18')]?_[_0xb551('0x1f')](_0x2bfb66['options']['include'],function(_0x5b4fd3){return{'model':db[_0x5b4fd3['model']],'as':_0x5b4fd3['as'],'attributes':_0x5b4fd3[_0xb551('0x16')],'include':_0x5b4fd3[_0xb551('0x18')]?_['map'](_0x5b4fd3[_0xb551('0x18')],function(_0xbf975e){return{'model':db[_0xbf975e[_0xb551('0x19')]],'as':_0xbf975e['as'],'attributes':_0xbf975e[_0xb551('0x16')],'include':_0xbf975e[_0xb551('0x18')]?_[_0xb551('0x1f')](_0xbf975e[_0xb551('0x18')],function(_0x104380){return{'model':db[_0x104380[_0xb551('0x19')]],'as':_0x104380['as'],'attributes':_0x104380['attributes']};}):[]};}):[]};}):[]:[]})[_0xb551('0x1a')](function(_0x4b7e23){logger[_0xb551('0xa')]('ShowSalesforceAccount',_0x2bfb66);logger[_0xb551('0xc')](_0xb551('0x1d'),_0x2bfb66,JSON[_0xb551('0x1c')](_0x4b7e23));_0x391626(_0x4b7e23);})['catch'](function(_0x3acea5){logger[_0xb551('0xf')]('ShowSalesforceAccount',_0x3acea5[_0xb551('0x10')],_0x2bfb66);_0x3cd7ab(_0x346cfe['error'](0x1f4,_0x3acea5[_0xb551('0x10')]));});});}; \ No newline at end of file +var _0xfbdd=['include','model','attributes','then','GetSalesforceAccount','ShowSalesforceAccount','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SalesforceAccount','findAll','options','raw','where','limit','map'];(function(_0x4158d5,_0x3f1719){var _0x4a95bd=function(_0x313ba1){while(--_0x313ba1){_0x4158d5['push'](_0x4158d5['shift']());}};_0x4a95bd(++_0x3f1719);}(_0xfbdd,0x17c));var _0xdfbd=function(_0xd396a8,_0x54caeb){_0xd396a8=_0xd396a8-0x0;var _0x577570=_0xfbdd[_0xd396a8];return _0x577570;};'use strict';var _=require(_0xdfbd('0x0'));var util=require('util');var moment=require(_0xdfbd('0x1'));var BPromise=require(_0xdfbd('0x2'));var rs=require(_0xdfbd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdfbd('0x4'));var logger=require(_0xdfbd('0x5'))(_0xdfbd('0x6'));var config=require(_0xdfbd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdfbd('0x8')][_0xdfbd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ed5ce,_0x53e52f,_0x204621){return new BPromise(function(_0x20cd6a,_0x4a4835){return client[_0xdfbd('0xa')](_0x1ed5ce,_0x204621)['then'](function(_0x8e888c){logger[_0xdfbd('0xb')](_0xdfbd('0xc'),_0x53e52f,_0xdfbd('0xd'));logger[_0xdfbd('0xe')](_0xdfbd('0xf'),_0x53e52f,_0xdfbd('0xd'),JSON[_0xdfbd('0x10')](_0x8e888c));if(_0x8e888c['error']){if(_0x8e888c[_0xdfbd('0x11')]['code']===0x1f4){logger[_0xdfbd('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x53e52f,_0x8e888c[_0xdfbd('0x11')][_0xdfbd('0x12')]);return _0x4a4835(_0x8e888c[_0xdfbd('0x11')][_0xdfbd('0x12')]);}logger['error'](_0xdfbd('0xc'),_0x53e52f,_0x8e888c[_0xdfbd('0x11')][_0xdfbd('0x12')]);return _0x20cd6a(_0x8e888c[_0xdfbd('0x11')]['message']);}else{logger['info'](_0xdfbd('0xc'),_0x53e52f,'request\x20sent');_0x20cd6a(_0x8e888c[_0xdfbd('0x13')][_0xdfbd('0x12')]);}})[_0xdfbd('0x14')](function(_0x4df819){logger['error'](_0xdfbd('0xc'),_0x53e52f,_0x4df819);_0x4a4835(_0x4df819);});});}exports['GetSalesforceAccount']=function(_0x133358){var _0x56808f=this;return new Promise(function(_0x308967,_0x37aaac){return db[_0xdfbd('0x15')][_0xdfbd('0x16')]({'raw':_0x133358[_0xdfbd('0x17')]?_0x133358[_0xdfbd('0x17')][_0xdfbd('0x18')]===undefined?!![]:![]:!![],'where':_0x133358['options']?_0x133358['options'][_0xdfbd('0x19')]||null:null,'attributes':_0x133358[_0xdfbd('0x17')]?_0x133358['options']['attributes']||null:null,'limit':_0x133358[_0xdfbd('0x17')]?_0x133358[_0xdfbd('0x17')][_0xdfbd('0x1a')]||null:null,'include':_0x133358['options']?_0x133358['options']['include']?_[_0xdfbd('0x1b')](_0x133358[_0xdfbd('0x17')][_0xdfbd('0x1c')],function(_0x582713){return{'model':db[_0x582713[_0xdfbd('0x1d')]],'as':_0x582713['as'],'attributes':_0x582713[_0xdfbd('0x1e')],'include':_0x582713[_0xdfbd('0x1c')]?_['map'](_0x582713['include'],function(_0x3e71d5){return{'model':db[_0x3e71d5[_0xdfbd('0x1d')]],'as':_0x3e71d5['as'],'attributes':_0x3e71d5[_0xdfbd('0x1e')],'include':_0x3e71d5[_0xdfbd('0x1c')]?_['map'](_0x3e71d5[_0xdfbd('0x1c')],function(_0x408cb7){return{'model':db[_0x408cb7[_0xdfbd('0x1d')]],'as':_0x408cb7['as'],'attributes':_0x408cb7[_0xdfbd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdfbd('0x1f')](function(_0x3d6ae8){logger['info'](_0xdfbd('0x20'),_0x133358);logger[_0xdfbd('0xe')](_0xdfbd('0x20'),_0x133358,JSON['stringify'](_0x3d6ae8));_0x308967(_0x3d6ae8);})[_0xdfbd('0x14')](function(_0x4503b7){logger[_0xdfbd('0x11')]('GetSalesforceAccount',_0x4503b7[_0xdfbd('0x12')],_0x133358);_0x37aaac(_0x56808f['error'](0x1f4,_0x4503b7['message']));});});};exports[_0xdfbd('0x21')]=function(_0x289246){var _0x336a93=this;return new Promise(function(_0x58ea81,_0x18b3ad){return db[_0xdfbd('0x15')]['find']({'raw':_0x289246[_0xdfbd('0x17')]?_0x289246[_0xdfbd('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x289246['options']?_0x289246['options'][_0xdfbd('0x19')]||null:null,'attributes':_0x289246[_0xdfbd('0x17')]?_0x289246[_0xdfbd('0x17')][_0xdfbd('0x1e')]||null:null,'include':_0x289246['options']?_0x289246[_0xdfbd('0x17')][_0xdfbd('0x1c')]?_[_0xdfbd('0x1b')](_0x289246[_0xdfbd('0x17')]['include'],function(_0x2b8dbf){return{'model':db[_0x2b8dbf[_0xdfbd('0x1d')]],'as':_0x2b8dbf['as'],'attributes':_0x2b8dbf[_0xdfbd('0x1e')],'include':_0x2b8dbf['include']?_['map'](_0x2b8dbf['include'],function(_0x297a92){return{'model':db[_0x297a92[_0xdfbd('0x1d')]],'as':_0x297a92['as'],'attributes':_0x297a92[_0xdfbd('0x1e')],'include':_0x297a92['include']?_[_0xdfbd('0x1b')](_0x297a92['include'],function(_0x29cacc){return{'model':db[_0x29cacc[_0xdfbd('0x1d')]],'as':_0x29cacc['as'],'attributes':_0x29cacc[_0xdfbd('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58d8ce){logger['info']('ShowSalesforceAccount',_0x289246);logger['debug'](_0xdfbd('0x21'),_0x289246,JSON['stringify'](_0x58d8ce));_0x58ea81(_0x58d8ce);})[_0xdfbd('0x14')](function(_0x37619b){logger[_0xdfbd('0x11')](_0xdfbd('0x21'),_0x37619b['message'],_0x289246);_0x18b3ad(_0x336a93[_0xdfbd('0x11')](0x1f4,_0x37619b[_0xdfbd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 8b9f693..d1533d9 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x538ae5,_0x2e7a44){var _0x2bcece=function(_0x2cf752){while(--_0x2cf752){_0x538ae5['push'](_0x538ae5['shift']());}};_0x2bcece(++_0x2e7a44);}(_0x5f2f,0x73));var _0xf5f2=function(_0x20c51d,_0x4246c9){_0x20c51d=_0x20c51d-0x0;var _0x56a6=_0x5f2f[_0x20c51d];return _0x56a6;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file +var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x3080a3,_0x10516e){var _0x305e6d=function(_0x453970){while(--_0x453970){_0x3080a3['push'](_0x3080a3['shift']());}};_0x305e6d(++_0x10516e);}(_0xadb5,0xad));var _0x5adb=function(_0x2c49ec,_0x5494d8){_0x2c49ec=_0x2c49ec-0x0;var _0x5e9931=_0xadb5[_0x2c49ec];return _0x5e9931;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index af21f0d..165aa3b 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 _0xfd1f=['ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead','account','sequelize','exports','STRING'];(function(_0x338c87,_0x1dc343){var _0x1e32a9=function(_0x2488fc){while(--_0x2488fc){_0x338c87['push'](_0x338c87['shift']());}};_0x1e32a9(++_0x1dc343);}(_0xfd1f,0xce));var _0xffd1=function(_0x51506b,_0x169982){_0x51506b=_0x51506b-0x0;var _0x2c0687=_0xfd1f[_0x51506b];return _0x2c0687;};'use strict';var Sequelize=require(_0xffd1('0x0'));module[_0xffd1('0x1')]={'name':{'type':Sequelize[_0xffd1('0x2')]},'description':{'type':Sequelize[_0xffd1('0x2')]},'ticketType':{'type':Sequelize[_0xffd1('0x3')](_0xffd1('0x4'),_0xffd1('0x5')),'defaultValue':_0xffd1('0x4')},'moduleSearch':{'type':Sequelize[_0xffd1('0x3')](_0xffd1('0x6'),_0xffd1('0x7'),_0xffd1('0x8'),_0xffd1('0x9'),_0xffd1('0xa')),'defaultValue':_0xffd1('0x6')},'moduleCreate':{'type':Sequelize[_0xffd1('0x3')]('nothing','contact','lead',_0xffd1('0xa')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xffd1('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xffd1('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xffd1('0x2')]}}; \ No newline at end of file +var _0x59b6=['Task','Case','ENUM','lead','account_contact_lead','account','contact_lead','nothing','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x59b6,0x1aa));var _0x659b=function(_0x5469ba,_0x19d3f1){_0x5469ba=_0x5469ba-0x0;var _0x54ca3e=_0x59b6[_0x5469ba];return _0x54ca3e;};'use strict';var Sequelize=require(_0x659b('0x0'));module[_0x659b('0x1')]={'name':{'type':Sequelize[_0x659b('0x2')]},'description':{'type':Sequelize[_0x659b('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x659b('0x3'),_0x659b('0x4')),'defaultValue':_0x659b('0x3')},'moduleSearch':{'type':Sequelize[_0x659b('0x5')]('contact_lead','contact',_0x659b('0x6'),_0x659b('0x7'),_0x659b('0x8')),'defaultValue':_0x659b('0x9')},'moduleCreate':{'type':Sequelize[_0x659b('0x5')](_0x659b('0xa'),'contact',_0x659b('0x6'),_0x659b('0x8')),'defaultValue':_0x659b('0x6')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x659b('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x659b('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x659b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 90d4b3d..34b4579 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 _0xcb33=['body','getFields','SalesforceField','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create'];(function(_0x259e77,_0x52f430){var _0x1f93bd=function(_0x3c9ffe){while(--_0x3c9ffe){_0x259e77['push'](_0x259e77['shift']());}};_0x1f93bd(++_0x52f430);}(_0xcb33,0xae));var _0x3cb3=function(_0x371577,_0x260aa3){_0x371577=_0x371577-0x0;var _0x3a0930=_0xcb33[_0x371577];return _0x3a0930;};'use strict';var emlformat=require(_0x3cb3('0x0'));var rimraf=require(_0x3cb3('0x1'));var zipdir=require(_0x3cb3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3cb3('0x3'));var moment=require('moment');var BPromise=require(_0x3cb3('0x4'));var Mustache=require(_0x3cb3('0x5'));var util=require(_0x3cb3('0x6'));var path=require(_0x3cb3('0x7'));var sox=require('sox');var csv=require(_0x3cb3('0x8'));var ejs=require(_0x3cb3('0x9'));var fs=require('fs');var fs_extra=require(_0x3cb3('0xa'));var _=require(_0x3cb3('0xb'));var squel=require(_0x3cb3('0xc'));var crypto=require(_0x3cb3('0xd'));var jsforce=require(_0x3cb3('0xe'));var deskjs=require(_0x3cb3('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3cb3('0x10'));var Papa=require(_0x3cb3('0x11'));var Redis=require(_0x3cb3('0x12'));var authService=require(_0x3cb3('0x13'));var qs=require(_0x3cb3('0x14'));var as=require(_0x3cb3('0x15'));var hardwareService=require(_0x3cb3('0x16'));var logger=require('../../config/logger')(_0x3cb3('0x17'));var utils=require(_0x3cb3('0x18'));var config=require(_0x3cb3('0x19'));var licenseUtil=require(_0x3cb3('0x1a'));var db=require(_0x3cb3('0x1b'))['db'];function respondWithStatusCode(_0x5ebfb4,_0x2c13e8){_0x2c13e8=_0x2c13e8||0xcc;return function(_0x259eb7){if(_0x259eb7){return _0x5ebfb4['sendStatus'](_0x2c13e8);}return _0x5ebfb4['status'](_0x2c13e8)['end']();};}function respondWithResult(_0x3b99d4,_0x5b692a){_0x5b692a=_0x5b692a||0xc8;return function(_0x5302d7){if(_0x5302d7){return _0x3b99d4[_0x3cb3('0x1c')](_0x5b692a)[_0x3cb3('0x1d')](_0x5302d7);}};}function respondWithFilteredResult(_0x4451b2,_0x4aa89a){return function(_0x2a438d){if(_0x2a438d){var _0x2c7430=typeof _0x4aa89a['offset']===_0x3cb3('0x1e')&&typeof _0x4aa89a[_0x3cb3('0x1f')]===_0x3cb3('0x1e');var _0xb43865=_0x2a438d[_0x3cb3('0x20')];var _0x555056=_0x2c7430?0x0:_0x4aa89a[_0x3cb3('0x21')];var _0x5871d9=_0x2c7430?_0x2a438d['count']:_0x4aa89a['offset']+_0x4aa89a[_0x3cb3('0x1f')];var _0x180d94;if(_0x5871d9>=_0xb43865){_0x5871d9=_0xb43865;_0x180d94=0xc8;}else{_0x180d94=0xce;}_0x4451b2[_0x3cb3('0x1c')](_0x180d94);return _0x4451b2[_0x3cb3('0x22')]('Content-Range',_0x555056+'-'+_0x5871d9+'/'+_0xb43865)[_0x3cb3('0x1d')](_0x2a438d);}return null;};}function patchUpdates(_0x100fb1){return function(_0x5a202c){try{jsonpatch[_0x3cb3('0x23')](_0x5a202c,_0x100fb1,!![]);}catch(_0x5f31d2){return BPromise[_0x3cb3('0x24')](_0x5f31d2);}return _0x5a202c[_0x3cb3('0x25')]();};}function saveUpdates(_0x4ca90a,_0x547cd5){return function(_0x2d12c3){if(_0x2d12c3){return _0x2d12c3[_0x3cb3('0x26')](_0x4ca90a)[_0x3cb3('0x27')](function(_0x2f23a2){return _0x2f23a2;});}return null;};}function removeEntity(_0x3648aa,_0x2d362e){return function(_0x3d0e79){if(_0x3d0e79){return _0x3d0e79[_0x3cb3('0x28')]()[_0x3cb3('0x27')](function(){_0x3648aa['status'](0xcc)[_0x3cb3('0x29')]();});}};}function handleEntityNotFound(_0x5d9a7a,_0x4fe729){return function(_0x206d66){if(!_0x206d66){_0x5d9a7a[_0x3cb3('0x2a')](0x194);}return _0x206d66;};}function handleError(_0x1d4f9d,_0xd7f1c6){_0xd7f1c6=_0xd7f1c6||0x1f4;return function(_0x3579e5){logger[_0x3cb3('0x2b')](_0x3579e5[_0x3cb3('0x2c')]);if(_0x3579e5[_0x3cb3('0x2d')]){delete _0x3579e5['name'];}_0x1d4f9d[_0x3cb3('0x1c')](_0xd7f1c6)[_0x3cb3('0x2e')](_0x3579e5);};}exports[_0x3cb3('0x2f')]=function(_0x4dc31d,_0x4366c4){var _0x1387f6={},_0x241686={},_0x18ecab={'count':0x0,'rows':[]};var _0x101be3=_[_0x3cb3('0x30')](db[_0x3cb3('0x31')][_0x3cb3('0x32')],function(_0x3144ee){return{'name':_0x3144ee['fieldName'],'type':_0x3144ee[_0x3cb3('0x33')]['key']};});_0x241686[_0x3cb3('0x34')]=_[_0x3cb3('0x30')](_0x101be3,'name');_0x241686[_0x3cb3('0x35')]=_['keys'](_0x4dc31d[_0x3cb3('0x35')]);_0x241686[_0x3cb3('0x36')]=_['intersection'](_0x241686[_0x3cb3('0x34')],_0x241686[_0x3cb3('0x35')]);_0x1387f6[_0x3cb3('0x37')]=_[_0x3cb3('0x38')](_0x241686['model'],qs[_0x3cb3('0x39')](_0x4dc31d['query']['fields']));_0x1387f6[_0x3cb3('0x37')]=_0x1387f6[_0x3cb3('0x37')][_0x3cb3('0x3a')]?_0x1387f6['attributes']:_0x241686[_0x3cb3('0x34')];if(!_0x4dc31d[_0x3cb3('0x35')][_0x3cb3('0x3b')](_0x3cb3('0x3c'))){_0x1387f6[_0x3cb3('0x1f')]=qs[_0x3cb3('0x1f')](_0x4dc31d[_0x3cb3('0x35')][_0x3cb3('0x1f')]);_0x1387f6['offset']=qs[_0x3cb3('0x21')](_0x4dc31d[_0x3cb3('0x35')][_0x3cb3('0x21')]);}_0x1387f6[_0x3cb3('0x3d')]=qs[_0x3cb3('0x3e')](_0x4dc31d[_0x3cb3('0x35')][_0x3cb3('0x3e')]);_0x1387f6[_0x3cb3('0x3f')]=qs[_0x3cb3('0x36')](_[_0x3cb3('0x40')](_0x4dc31d[_0x3cb3('0x35')],_0x241686[_0x3cb3('0x36')]),_0x101be3);if(_0x4dc31d[_0x3cb3('0x35')][_0x3cb3('0x41')]){_0x1387f6[_0x3cb3('0x3f')]=_['merge'](_0x1387f6[_0x3cb3('0x3f')],{'$or':_[_0x3cb3('0x30')](_0x101be3,function(_0x687e70){if(_0x687e70['type']!=='VIRTUAL'){var _0x5490b5={};_0x5490b5[_0x687e70['name']]={'$like':'%'+_0x4dc31d[_0x3cb3('0x35')][_0x3cb3('0x41')]+'%'};return _0x5490b5;}})});}_0x1387f6=_[_0x3cb3('0x42')]({},_0x1387f6,_0x4dc31d[_0x3cb3('0x43')]);var _0x30af20={'where':_0x1387f6[_0x3cb3('0x3f')]};return db[_0x3cb3('0x31')]['count'](_0x30af20)[_0x3cb3('0x27')](function(_0x5cd415){_0x18ecab[_0x3cb3('0x20')]=_0x5cd415;if(_0x4dc31d[_0x3cb3('0x35')][_0x3cb3('0x44')]){_0x1387f6[_0x3cb3('0x45')]=[{'all':!![]}];}return db[_0x3cb3('0x31')][_0x3cb3('0x46')](_0x1387f6);})['then'](function(_0x38e3ea){_0x18ecab[_0x3cb3('0x47')]=_0x38e3ea;return _0x18ecab;})[_0x3cb3('0x27')](respondWithFilteredResult(_0x4366c4,_0x1387f6))[_0x3cb3('0x48')](handleError(_0x4366c4,null));};exports[_0x3cb3('0x49')]=function(_0x37bd6c,_0x1579ef){var _0x3eb2b1={'raw':![],'where':{'id':_0x37bd6c[_0x3cb3('0x4a')]['id']}},_0x30111f={};_0x30111f[_0x3cb3('0x34')]=_[_0x3cb3('0x4b')](db['SalesforceConfiguration']['rawAttributes']);_0x30111f[_0x3cb3('0x35')]=_[_0x3cb3('0x4b')](_0x37bd6c[_0x3cb3('0x35')]);_0x30111f[_0x3cb3('0x36')]=_[_0x3cb3('0x38')](_0x30111f[_0x3cb3('0x34')],_0x30111f[_0x3cb3('0x35')]);_0x3eb2b1[_0x3cb3('0x37')]=_['intersection'](_0x30111f[_0x3cb3('0x34')],qs['fields'](_0x37bd6c['query'][_0x3cb3('0x39')]));_0x3eb2b1['attributes']=_0x3eb2b1['attributes']['length']?_0x3eb2b1[_0x3cb3('0x37')]:_0x30111f['model'];if(_0x37bd6c[_0x3cb3('0x35')][_0x3cb3('0x44')]){_0x3eb2b1[_0x3cb3('0x45')]=[{'all':!![]}];}_0x3eb2b1=_[_0x3cb3('0x42')]({},_0x3eb2b1,_0x37bd6c[_0x3cb3('0x43')]);return db[_0x3cb3('0x31')][_0x3cb3('0x4c')](_0x3eb2b1)['then'](handleEntityNotFound(_0x1579ef,null))[_0x3cb3('0x27')](respondWithResult(_0x1579ef,null))[_0x3cb3('0x48')](handleError(_0x1579ef,null));};exports[_0x3cb3('0x4d')]=function(_0x166a5e,_0x1cd637){return db[_0x3cb3('0x31')][_0x3cb3('0x4d')](_0x166a5e['body'],{})[_0x3cb3('0x27')](respondWithResult(_0x1cd637,0xc9))[_0x3cb3('0x48')](handleError(_0x1cd637,null));};exports[_0x3cb3('0x26')]=function(_0x29e080,_0x52ee2b){if(_0x29e080['body']['id']){delete _0x29e080[_0x3cb3('0x4e')]['id'];}return db[_0x3cb3('0x31')][_0x3cb3('0x4c')]({'where':{'id':_0x29e080[_0x3cb3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x52ee2b,null))[_0x3cb3('0x27')](saveUpdates(_0x29e080[_0x3cb3('0x4e')],null))['then'](respondWithResult(_0x52ee2b,null))[_0x3cb3('0x48')](handleError(_0x52ee2b,null));};exports['destroy']=function(_0x3c7864,_0x4806c2){return db[_0x3cb3('0x31')]['find']({'where':{'id':_0x3c7864[_0x3cb3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4806c2,null))['then'](removeEntity(_0x4806c2,null))[_0x3cb3('0x48')](handleError(_0x4806c2,null));};exports[_0x3cb3('0x4f')]=function(_0x1ba870,_0x366f48,_0x1b1624){var _0x14bd99={};var _0x3300d3={};var _0x2a6f47;var _0x25f9ce;return db[_0x3cb3('0x31')]['findOne']({'where':{'id':_0x1ba870[_0x3cb3('0x4a')]['id']}})[_0x3cb3('0x27')](handleEntityNotFound(_0x366f48,null))[_0x3cb3('0x27')](function(_0x15c740){if(_0x15c740){_0x2a6f47=_0x15c740;_0x3300d3[_0x3cb3('0x34')]=_['keys'](db[_0x3cb3('0x50')][_0x3cb3('0x32')]);_0x3300d3[_0x3cb3('0x35')]=_[_0x3cb3('0x4b')](_0x1ba870[_0x3cb3('0x35')]);_0x3300d3[_0x3cb3('0x36')]=_[_0x3cb3('0x38')](_0x3300d3[_0x3cb3('0x34')],_0x3300d3[_0x3cb3('0x35')]);_0x14bd99['attributes']=_[_0x3cb3('0x38')](_0x3300d3[_0x3cb3('0x34')],qs[_0x3cb3('0x39')](_0x1ba870[_0x3cb3('0x35')][_0x3cb3('0x39')]));_0x14bd99[_0x3cb3('0x37')]=_0x14bd99['attributes'][_0x3cb3('0x3a')]?_0x14bd99[_0x3cb3('0x37')]:_0x3300d3[_0x3cb3('0x34')];_0x14bd99[_0x3cb3('0x3d')]=qs['sort'](_0x1ba870[_0x3cb3('0x35')][_0x3cb3('0x3e')]);_0x14bd99[_0x3cb3('0x3f')]=qs[_0x3cb3('0x36')](_['pick'](_0x1ba870[_0x3cb3('0x35')],_0x3300d3[_0x3cb3('0x36')]));if(_0x1ba870[_0x3cb3('0x35')]['filter']){_0x14bd99[_0x3cb3('0x3f')]=_[_0x3cb3('0x42')](_0x14bd99['where'],{'$or':_[_0x3cb3('0x30')](_0x14bd99['attributes'],function(_0x434aa9){var _0x25f315={};_0x25f315[_0x434aa9]={'$like':'%'+_0x1ba870['query'][_0x3cb3('0x41')]+'%'};return _0x25f315;})});}_0x14bd99=_[_0x3cb3('0x42')]({},_0x14bd99,_0x1ba870[_0x3cb3('0x43')]);return _0x2a6f47[_0x3cb3('0x4f')](_0x14bd99);}})[_0x3cb3('0x27')](function(_0x197284){if(_0x197284){_0x25f9ce=_0x197284[_0x3cb3('0x3a')];if(!_0x1ba870[_0x3cb3('0x35')][_0x3cb3('0x3b')](_0x3cb3('0x3c'))){_0x14bd99[_0x3cb3('0x1f')]=qs[_0x3cb3('0x1f')](_0x1ba870['query'][_0x3cb3('0x1f')]);_0x14bd99[_0x3cb3('0x21')]=qs[_0x3cb3('0x21')](_0x1ba870['query']['offset']);}return _0x2a6f47[_0x3cb3('0x4f')](_0x14bd99);}})[_0x3cb3('0x27')](function(_0x5adb85){if(_0x5adb85){return _0x5adb85?{'count':_0x25f9ce,'rows':_0x5adb85}:null;}})[_0x3cb3('0x27')](respondWithResult(_0x366f48,null))[_0x3cb3('0x48')](handleError(_0x366f48,null));};exports['getSubjects']=function(_0x2b0b5b,_0x4c4978,_0x58ea7a){var _0xb5553c={};var _0xfac4ce={};var _0x4479e5;var _0x240460;return db[_0x3cb3('0x31')][_0x3cb3('0x51')]({'where':{'id':_0x2b0b5b[_0x3cb3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4c4978,null))[_0x3cb3('0x27')](function(_0x11325c){if(_0x11325c){_0x4479e5=_0x11325c;_0xfac4ce[_0x3cb3('0x34')]=_['keys'](db[_0x3cb3('0x50')][_0x3cb3('0x32')]);_0xfac4ce['query']=_[_0x3cb3('0x4b')](_0x2b0b5b[_0x3cb3('0x35')]);_0xfac4ce[_0x3cb3('0x36')]=_[_0x3cb3('0x38')](_0xfac4ce[_0x3cb3('0x34')],_0xfac4ce[_0x3cb3('0x35')]);_0xb5553c[_0x3cb3('0x37')]=_[_0x3cb3('0x38')](_0xfac4ce[_0x3cb3('0x34')],qs[_0x3cb3('0x39')](_0x2b0b5b['query']['fields']));_0xb5553c[_0x3cb3('0x37')]=_0xb5553c['attributes'][_0x3cb3('0x3a')]?_0xb5553c['attributes']:_0xfac4ce[_0x3cb3('0x34')];_0xb5553c[_0x3cb3('0x3d')]=qs[_0x3cb3('0x3e')](_0x2b0b5b[_0x3cb3('0x35')][_0x3cb3('0x3e')]);_0xb5553c['where']=qs['filters'](_[_0x3cb3('0x40')](_0x2b0b5b[_0x3cb3('0x35')],_0xfac4ce[_0x3cb3('0x36')]));if(_0x2b0b5b[_0x3cb3('0x35')][_0x3cb3('0x41')]){_0xb5553c[_0x3cb3('0x3f')]=_[_0x3cb3('0x42')](_0xb5553c['where'],{'$or':_[_0x3cb3('0x30')](_0xb5553c[_0x3cb3('0x37')],function(_0x3a8c1a){var _0x2d28a2={};_0x2d28a2[_0x3a8c1a]={'$like':'%'+_0x2b0b5b[_0x3cb3('0x35')]['filter']+'%'};return _0x2d28a2;})});}_0xb5553c=_[_0x3cb3('0x42')]({},_0xb5553c,_0x2b0b5b[_0x3cb3('0x43')]);return _0x4479e5['getSubjects'](_0xb5553c);}})[_0x3cb3('0x27')](function(_0x128496){if(_0x128496){_0x240460=_0x128496[_0x3cb3('0x3a')];if(!_0x2b0b5b['query']['hasOwnProperty'](_0x3cb3('0x3c'))){_0xb5553c[_0x3cb3('0x1f')]=qs[_0x3cb3('0x1f')](_0x2b0b5b[_0x3cb3('0x35')]['limit']);_0xb5553c[_0x3cb3('0x21')]=qs['offset'](_0x2b0b5b['query']['offset']);}return _0x4479e5[_0x3cb3('0x52')](_0xb5553c);}})[_0x3cb3('0x27')](function(_0x78cb3a){if(_0x78cb3a){return _0x78cb3a?{'count':_0x240460,'rows':_0x78cb3a}:null;}})[_0x3cb3('0x27')](respondWithResult(_0x4c4978,null))[_0x3cb3('0x48')](handleError(_0x4c4978,null));};exports[_0x3cb3('0x53')]=function(_0x170139,_0x46e0ca,_0x362eba){var _0x7a2efb={};var _0x2bf84f={};var _0x3f7e7a;var _0x6d5a48;return db[_0x3cb3('0x31')][_0x3cb3('0x51')]({'where':{'id':_0x170139['params']['id']}})['then'](handleEntityNotFound(_0x46e0ca,null))[_0x3cb3('0x27')](function(_0x5c7380){if(_0x5c7380){_0x3f7e7a=_0x5c7380;_0x2bf84f['model']=_['keys'](db[_0x3cb3('0x50')][_0x3cb3('0x32')]);_0x2bf84f[_0x3cb3('0x35')]=_[_0x3cb3('0x4b')](_0x170139[_0x3cb3('0x35')]);_0x2bf84f['filters']=_['intersection'](_0x2bf84f['model'],_0x2bf84f[_0x3cb3('0x35')]);_0x7a2efb['attributes']=_[_0x3cb3('0x38')](_0x2bf84f[_0x3cb3('0x34')],qs[_0x3cb3('0x39')](_0x170139[_0x3cb3('0x35')][_0x3cb3('0x39')]));_0x7a2efb[_0x3cb3('0x37')]=_0x7a2efb['attributes'][_0x3cb3('0x3a')]?_0x7a2efb[_0x3cb3('0x37')]:_0x2bf84f['model'];_0x7a2efb[_0x3cb3('0x3d')]=qs[_0x3cb3('0x3e')](_0x170139[_0x3cb3('0x35')]['sort']);_0x7a2efb[_0x3cb3('0x3f')]=qs[_0x3cb3('0x36')](_[_0x3cb3('0x40')](_0x170139[_0x3cb3('0x35')],_0x2bf84f[_0x3cb3('0x36')]));if(_0x170139['query'][_0x3cb3('0x41')]){_0x7a2efb[_0x3cb3('0x3f')]=_[_0x3cb3('0x42')](_0x7a2efb[_0x3cb3('0x3f')],{'$or':_['map'](_0x7a2efb['attributes'],function(_0x22f0fb){var _0x4ed1d7={};_0x4ed1d7[_0x22f0fb]={'$like':'%'+_0x170139['query'][_0x3cb3('0x41')]+'%'};return _0x4ed1d7;})});}_0x7a2efb=_[_0x3cb3('0x42')]({},_0x7a2efb,_0x170139['options']);return _0x3f7e7a['getDescriptions'](_0x7a2efb);}})['then'](function(_0x34b118){if(_0x34b118){_0x6d5a48=_0x34b118['length'];if(!_0x170139[_0x3cb3('0x35')][_0x3cb3('0x3b')](_0x3cb3('0x3c'))){_0x7a2efb['limit']=qs[_0x3cb3('0x1f')](_0x170139['query'][_0x3cb3('0x1f')]);_0x7a2efb[_0x3cb3('0x21')]=qs[_0x3cb3('0x21')](_0x170139['query']['offset']);}return _0x3f7e7a[_0x3cb3('0x53')](_0x7a2efb);}})['then'](function(_0x9f537e){if(_0x9f537e){return _0x9f537e?{'count':_0x6d5a48,'rows':_0x9f537e}:null;}})['then'](respondWithResult(_0x46e0ca,null))['catch'](handleError(_0x46e0ca,null));}; \ No newline at end of file +var _0x0c34=['rows','catch','show','rawAttributes','includeAll','find','create','body','params','getFields','SalesforceField','getSubjects','findOne','order','getDescriptions','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','name','options','include','SalesforceConfiguration','findAll'];(function(_0x4fdf44,_0x3b5859){var _0x4bf2b6=function(_0xcb1a5){while(--_0xcb1a5){_0x4fdf44['push'](_0x4fdf44['shift']());}};_0x4bf2b6(++_0x3b5859);}(_0x0c34,0x153));var _0x40c3=function(_0x1f3803,_0x1809d5){_0x1f3803=_0x1f3803-0x0;var _0x461b72=_0x0c34[_0x1f3803];return _0x461b72;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x40c3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x40c3('0x1'));var rp=require(_0x40c3('0x2'));var moment=require('moment');var BPromise=require(_0x40c3('0x3'));var Mustache=require(_0x40c3('0x4'));var util=require(_0x40c3('0x5'));var path=require(_0x40c3('0x6'));var sox=require(_0x40c3('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x40c3('0x8'));var _=require(_0x40c3('0x9'));var squel=require(_0x40c3('0xa'));var crypto=require(_0x40c3('0xb'));var jsforce=require(_0x40c3('0xc'));var deskjs=require(_0x40c3('0xd'));var toCsv=require(_0x40c3('0xe'));var querystring=require(_0x40c3('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x40c3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x40c3('0x11'));var hardwareService=require(_0x40c3('0x12'));var logger=require(_0x40c3('0x13'))(_0x40c3('0x14'));var utils=require(_0x40c3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x40c3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b22a1,_0x5d8e9a){_0x5d8e9a=_0x5d8e9a||0xcc;return function(_0x2f79bf){if(_0x2f79bf){return _0x1b22a1[_0x40c3('0x17')](_0x5d8e9a);}return _0x1b22a1['status'](_0x5d8e9a)['end']();};}function respondWithResult(_0x59a200,_0x5da43c){_0x5da43c=_0x5da43c||0xc8;return function(_0x198f9b){if(_0x198f9b){return _0x59a200[_0x40c3('0x18')](_0x5da43c)[_0x40c3('0x19')](_0x198f9b);}};}function respondWithFilteredResult(_0x1c2899,_0x547ca7){return function(_0xe36e29){if(_0xe36e29){var _0x162c1e=typeof _0x547ca7[_0x40c3('0x1a')]===_0x40c3('0x1b')&&typeof _0x547ca7[_0x40c3('0x1c')]===_0x40c3('0x1b');var _0x62cfd5=_0xe36e29[_0x40c3('0x1d')];var _0x3a09a3=_0x162c1e?0x0:_0x547ca7[_0x40c3('0x1a')];var _0x130c72=_0x162c1e?_0xe36e29[_0x40c3('0x1d')]:_0x547ca7['offset']+_0x547ca7[_0x40c3('0x1c')];var _0x28f741;if(_0x130c72>=_0x62cfd5){_0x130c72=_0x62cfd5;_0x28f741=0xc8;}else{_0x28f741=0xce;}_0x1c2899['status'](_0x28f741);return _0x1c2899[_0x40c3('0x1e')]('Content-Range',_0x3a09a3+'-'+_0x130c72+'/'+_0x62cfd5)[_0x40c3('0x19')](_0xe36e29);}return null;};}function patchUpdates(_0x17848c){return function(_0x2b422d){try{jsonpatch[_0x40c3('0x1f')](_0x2b422d,_0x17848c,!![]);}catch(_0xa773b0){return BPromise[_0x40c3('0x20')](_0xa773b0);}return _0x2b422d[_0x40c3('0x21')]();};}function saveUpdates(_0x127410,_0x116c17){return function(_0x39ed98){if(_0x39ed98){return _0x39ed98[_0x40c3('0x22')](_0x127410)[_0x40c3('0x23')](function(_0x167b92){return _0x167b92;});}return null;};}function removeEntity(_0x187afa,_0x5d4a03){return function(_0x130b36){if(_0x130b36){return _0x130b36[_0x40c3('0x24')]()['then'](function(){_0x187afa['status'](0xcc)[_0x40c3('0x25')]();});}};}function handleEntityNotFound(_0x287f59,_0x543ed1){return function(_0xad1a1f){if(!_0xad1a1f){_0x287f59['sendStatus'](0x194);}return _0xad1a1f;};}function handleError(_0x2d855d,_0x247c09){_0x247c09=_0x247c09||0x1f4;return function(_0x15a8de){logger[_0x40c3('0x26')](_0x15a8de[_0x40c3('0x27')]);if(_0x15a8de['name']){delete _0x15a8de['name'];}_0x2d855d[_0x40c3('0x18')](_0x247c09)[_0x40c3('0x28')](_0x15a8de);};}exports['index']=function(_0x2647dc,_0x47af1e){var _0x546824={},_0x3ed662={},_0x54ee57={'count':0x0,'rows':[]};var _0x1fe63d=_[_0x40c3('0x29')](db['SalesforceConfiguration']['rawAttributes'],function(_0x30ddaf){return{'name':_0x30ddaf[_0x40c3('0x2a')],'type':_0x30ddaf[_0x40c3('0x2b')][_0x40c3('0x2c')]};});_0x3ed662[_0x40c3('0x2d')]=_[_0x40c3('0x29')](_0x1fe63d,'name');_0x3ed662[_0x40c3('0x2e')]=_[_0x40c3('0x2f')](_0x2647dc[_0x40c3('0x2e')]);_0x3ed662[_0x40c3('0x30')]=_[_0x40c3('0x31')](_0x3ed662['model'],_0x3ed662[_0x40c3('0x2e')]);_0x546824[_0x40c3('0x32')]=_[_0x40c3('0x31')](_0x3ed662[_0x40c3('0x2d')],qs['fields'](_0x2647dc[_0x40c3('0x2e')][_0x40c3('0x33')]));_0x546824[_0x40c3('0x32')]=_0x546824[_0x40c3('0x32')][_0x40c3('0x34')]?_0x546824['attributes']:_0x3ed662[_0x40c3('0x2d')];if(!_0x2647dc[_0x40c3('0x2e')][_0x40c3('0x35')](_0x40c3('0x36'))){_0x546824[_0x40c3('0x1c')]=qs[_0x40c3('0x1c')](_0x2647dc[_0x40c3('0x2e')]['limit']);_0x546824[_0x40c3('0x1a')]=qs[_0x40c3('0x1a')](_0x2647dc[_0x40c3('0x2e')][_0x40c3('0x1a')]);}_0x546824['order']=qs[_0x40c3('0x37')](_0x2647dc[_0x40c3('0x2e')][_0x40c3('0x37')]);_0x546824['where']=qs[_0x40c3('0x30')](_[_0x40c3('0x38')](_0x2647dc[_0x40c3('0x2e')],_0x3ed662['filters']),_0x1fe63d);if(_0x2647dc[_0x40c3('0x2e')][_0x40c3('0x39')]){_0x546824[_0x40c3('0x3a')]=_[_0x40c3('0x3b')](_0x546824[_0x40c3('0x3a')],{'$or':_['map'](_0x1fe63d,function(_0x220258){if(_0x220258[_0x40c3('0x2b')]!==_0x40c3('0x3c')){var _0x49800c={};_0x49800c[_0x220258[_0x40c3('0x3d')]]={'$like':'%'+_0x2647dc[_0x40c3('0x2e')][_0x40c3('0x39')]+'%'};return _0x49800c;}})});}_0x546824=_['merge']({},_0x546824,_0x2647dc[_0x40c3('0x3e')]);var _0x1f6783={'where':_0x546824[_0x40c3('0x3a')]};return db['SalesforceConfiguration'][_0x40c3('0x1d')](_0x1f6783)[_0x40c3('0x23')](function(_0xae858b){_0x54ee57[_0x40c3('0x1d')]=_0xae858b;if(_0x2647dc[_0x40c3('0x2e')]['includeAll']){_0x546824[_0x40c3('0x3f')]=[{'all':!![]}];}return db[_0x40c3('0x40')][_0x40c3('0x41')](_0x546824);})[_0x40c3('0x23')](function(_0x113793){_0x54ee57[_0x40c3('0x42')]=_0x113793;return _0x54ee57;})['then'](respondWithFilteredResult(_0x47af1e,_0x546824))[_0x40c3('0x43')](handleError(_0x47af1e,null));};exports[_0x40c3('0x44')]=function(_0x17c3ac,_0x4968be){var _0x3c322e={'raw':![],'where':{'id':_0x17c3ac['params']['id']}},_0x5f3852={};_0x5f3852[_0x40c3('0x2d')]=_[_0x40c3('0x2f')](db[_0x40c3('0x40')][_0x40c3('0x45')]);_0x5f3852[_0x40c3('0x2e')]=_[_0x40c3('0x2f')](_0x17c3ac[_0x40c3('0x2e')]);_0x5f3852[_0x40c3('0x30')]=_[_0x40c3('0x31')](_0x5f3852['model'],_0x5f3852[_0x40c3('0x2e')]);_0x3c322e[_0x40c3('0x32')]=_['intersection'](_0x5f3852[_0x40c3('0x2d')],qs[_0x40c3('0x33')](_0x17c3ac[_0x40c3('0x2e')][_0x40c3('0x33')]));_0x3c322e[_0x40c3('0x32')]=_0x3c322e['attributes'][_0x40c3('0x34')]?_0x3c322e[_0x40c3('0x32')]:_0x5f3852['model'];if(_0x17c3ac[_0x40c3('0x2e')][_0x40c3('0x46')]){_0x3c322e[_0x40c3('0x3f')]=[{'all':!![]}];}_0x3c322e=_['merge']({},_0x3c322e,_0x17c3ac[_0x40c3('0x3e')]);return db['SalesforceConfiguration'][_0x40c3('0x47')](_0x3c322e)[_0x40c3('0x23')](handleEntityNotFound(_0x4968be,null))[_0x40c3('0x23')](respondWithResult(_0x4968be,null))[_0x40c3('0x43')](handleError(_0x4968be,null));};exports[_0x40c3('0x48')]=function(_0x181110,_0x316c96){return db[_0x40c3('0x40')]['create'](_0x181110[_0x40c3('0x49')],{})['then'](respondWithResult(_0x316c96,0xc9))['catch'](handleError(_0x316c96,null));};exports[_0x40c3('0x22')]=function(_0x864be0,_0x51ee3d){if(_0x864be0[_0x40c3('0x49')]['id']){delete _0x864be0[_0x40c3('0x49')]['id'];}return db['SalesforceConfiguration'][_0x40c3('0x47')]({'where':{'id':_0x864be0[_0x40c3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x51ee3d,null))[_0x40c3('0x23')](saveUpdates(_0x864be0[_0x40c3('0x49')],null))['then'](respondWithResult(_0x51ee3d,null))[_0x40c3('0x43')](handleError(_0x51ee3d,null));};exports['destroy']=function(_0x126fdd,_0x49e85e){return db[_0x40c3('0x40')][_0x40c3('0x47')]({'where':{'id':_0x126fdd[_0x40c3('0x4a')]['id']}})[_0x40c3('0x23')](handleEntityNotFound(_0x49e85e,null))['then'](removeEntity(_0x49e85e,null))[_0x40c3('0x43')](handleError(_0x49e85e,null));};exports[_0x40c3('0x4b')]=function(_0xff3d84,_0x3cd847,_0x744aae){var _0x444b3b={};var _0x4e97ac={};var _0x53cf01;var _0x5ea2b6;return db[_0x40c3('0x40')]['findOne']({'where':{'id':_0xff3d84[_0x40c3('0x4a')]['id']}})[_0x40c3('0x23')](handleEntityNotFound(_0x3cd847,null))[_0x40c3('0x23')](function(_0x379029){if(_0x379029){_0x53cf01=_0x379029;_0x4e97ac[_0x40c3('0x2d')]=_[_0x40c3('0x2f')](db[_0x40c3('0x4c')][_0x40c3('0x45')]);_0x4e97ac[_0x40c3('0x2e')]=_['keys'](_0xff3d84['query']);_0x4e97ac[_0x40c3('0x30')]=_[_0x40c3('0x31')](_0x4e97ac[_0x40c3('0x2d')],_0x4e97ac[_0x40c3('0x2e')]);_0x444b3b['attributes']=_[_0x40c3('0x31')](_0x4e97ac[_0x40c3('0x2d')],qs[_0x40c3('0x33')](_0xff3d84['query'][_0x40c3('0x33')]));_0x444b3b[_0x40c3('0x32')]=_0x444b3b[_0x40c3('0x32')][_0x40c3('0x34')]?_0x444b3b['attributes']:_0x4e97ac['model'];_0x444b3b['order']=qs[_0x40c3('0x37')](_0xff3d84['query']['sort']);_0x444b3b[_0x40c3('0x3a')]=qs[_0x40c3('0x30')](_[_0x40c3('0x38')](_0xff3d84['query'],_0x4e97ac['filters']));if(_0xff3d84[_0x40c3('0x2e')][_0x40c3('0x39')]){_0x444b3b[_0x40c3('0x3a')]=_[_0x40c3('0x3b')](_0x444b3b[_0x40c3('0x3a')],{'$or':_[_0x40c3('0x29')](_0x444b3b[_0x40c3('0x32')],function(_0x1d2f1b){var _0x10098b={};_0x10098b[_0x1d2f1b]={'$like':'%'+_0xff3d84[_0x40c3('0x2e')][_0x40c3('0x39')]+'%'};return _0x10098b;})});}_0x444b3b=_[_0x40c3('0x3b')]({},_0x444b3b,_0xff3d84[_0x40c3('0x3e')]);return _0x53cf01[_0x40c3('0x4b')](_0x444b3b);}})[_0x40c3('0x23')](function(_0x541924){if(_0x541924){_0x5ea2b6=_0x541924[_0x40c3('0x34')];if(!_0xff3d84[_0x40c3('0x2e')][_0x40c3('0x35')]('nolimit')){_0x444b3b[_0x40c3('0x1c')]=qs[_0x40c3('0x1c')](_0xff3d84['query']['limit']);_0x444b3b[_0x40c3('0x1a')]=qs[_0x40c3('0x1a')](_0xff3d84[_0x40c3('0x2e')][_0x40c3('0x1a')]);}return _0x53cf01['getFields'](_0x444b3b);}})[_0x40c3('0x23')](function(_0x281ed6){if(_0x281ed6){return _0x281ed6?{'count':_0x5ea2b6,'rows':_0x281ed6}:null;}})[_0x40c3('0x23')](respondWithResult(_0x3cd847,null))[_0x40c3('0x43')](handleError(_0x3cd847,null));};exports[_0x40c3('0x4d')]=function(_0x21e4c8,_0x11e814,_0x2fd437){var _0x1402ff={};var _0x214b38={};var _0x2814e4;var _0x17938a;return db[_0x40c3('0x40')][_0x40c3('0x4e')]({'where':{'id':_0x21e4c8[_0x40c3('0x4a')]['id']}})[_0x40c3('0x23')](handleEntityNotFound(_0x11e814,null))[_0x40c3('0x23')](function(_0x5d6201){if(_0x5d6201){_0x2814e4=_0x5d6201;_0x214b38['model']=_[_0x40c3('0x2f')](db['SalesforceField'][_0x40c3('0x45')]);_0x214b38[_0x40c3('0x2e')]=_[_0x40c3('0x2f')](_0x21e4c8['query']);_0x214b38['filters']=_[_0x40c3('0x31')](_0x214b38[_0x40c3('0x2d')],_0x214b38[_0x40c3('0x2e')]);_0x1402ff[_0x40c3('0x32')]=_[_0x40c3('0x31')](_0x214b38[_0x40c3('0x2d')],qs[_0x40c3('0x33')](_0x21e4c8[_0x40c3('0x2e')]['fields']));_0x1402ff[_0x40c3('0x32')]=_0x1402ff[_0x40c3('0x32')][_0x40c3('0x34')]?_0x1402ff['attributes']:_0x214b38[_0x40c3('0x2d')];_0x1402ff[_0x40c3('0x4f')]=qs[_0x40c3('0x37')](_0x21e4c8['query'][_0x40c3('0x37')]);_0x1402ff['where']=qs['filters'](_[_0x40c3('0x38')](_0x21e4c8[_0x40c3('0x2e')],_0x214b38[_0x40c3('0x30')]));if(_0x21e4c8[_0x40c3('0x2e')][_0x40c3('0x39')]){_0x1402ff['where']=_['merge'](_0x1402ff[_0x40c3('0x3a')],{'$or':_[_0x40c3('0x29')](_0x1402ff[_0x40c3('0x32')],function(_0x330313){var _0xfb1ebf={};_0xfb1ebf[_0x330313]={'$like':'%'+_0x21e4c8['query'][_0x40c3('0x39')]+'%'};return _0xfb1ebf;})});}_0x1402ff=_[_0x40c3('0x3b')]({},_0x1402ff,_0x21e4c8[_0x40c3('0x3e')]);return _0x2814e4[_0x40c3('0x4d')](_0x1402ff);}})[_0x40c3('0x23')](function(_0x2f6867){if(_0x2f6867){_0x17938a=_0x2f6867[_0x40c3('0x34')];if(!_0x21e4c8[_0x40c3('0x2e')][_0x40c3('0x35')]('nolimit')){_0x1402ff['limit']=qs[_0x40c3('0x1c')](_0x21e4c8['query'][_0x40c3('0x1c')]);_0x1402ff['offset']=qs[_0x40c3('0x1a')](_0x21e4c8[_0x40c3('0x2e')][_0x40c3('0x1a')]);}return _0x2814e4[_0x40c3('0x4d')](_0x1402ff);}})[_0x40c3('0x23')](function(_0x45e5fc){if(_0x45e5fc){return _0x45e5fc?{'count':_0x17938a,'rows':_0x45e5fc}:null;}})[_0x40c3('0x23')](respondWithResult(_0x11e814,null))[_0x40c3('0x43')](handleError(_0x11e814,null));};exports[_0x40c3('0x50')]=function(_0x294d79,_0x23de3f,_0x382599){var _0x3acb05={};var _0x5826e2={};var _0x5b4b66;var _0x381390;return db[_0x40c3('0x40')][_0x40c3('0x4e')]({'where':{'id':_0x294d79[_0x40c3('0x4a')]['id']}})[_0x40c3('0x23')](handleEntityNotFound(_0x23de3f,null))[_0x40c3('0x23')](function(_0x1950f4){if(_0x1950f4){_0x5b4b66=_0x1950f4;_0x5826e2[_0x40c3('0x2d')]=_[_0x40c3('0x2f')](db[_0x40c3('0x4c')]['rawAttributes']);_0x5826e2[_0x40c3('0x2e')]=_['keys'](_0x294d79[_0x40c3('0x2e')]);_0x5826e2[_0x40c3('0x30')]=_[_0x40c3('0x31')](_0x5826e2['model'],_0x5826e2[_0x40c3('0x2e')]);_0x3acb05[_0x40c3('0x32')]=_[_0x40c3('0x31')](_0x5826e2[_0x40c3('0x2d')],qs[_0x40c3('0x33')](_0x294d79[_0x40c3('0x2e')][_0x40c3('0x33')]));_0x3acb05[_0x40c3('0x32')]=_0x3acb05[_0x40c3('0x32')]['length']?_0x3acb05[_0x40c3('0x32')]:_0x5826e2[_0x40c3('0x2d')];_0x3acb05[_0x40c3('0x4f')]=qs[_0x40c3('0x37')](_0x294d79[_0x40c3('0x2e')]['sort']);_0x3acb05[_0x40c3('0x3a')]=qs[_0x40c3('0x30')](_[_0x40c3('0x38')](_0x294d79[_0x40c3('0x2e')],_0x5826e2[_0x40c3('0x30')]));if(_0x294d79[_0x40c3('0x2e')][_0x40c3('0x39')]){_0x3acb05[_0x40c3('0x3a')]=_[_0x40c3('0x3b')](_0x3acb05['where'],{'$or':_[_0x40c3('0x29')](_0x3acb05[_0x40c3('0x32')],function(_0x3efc9a){var _0x8e6f75={};_0x8e6f75[_0x3efc9a]={'$like':'%'+_0x294d79[_0x40c3('0x2e')][_0x40c3('0x39')]+'%'};return _0x8e6f75;})});}_0x3acb05=_[_0x40c3('0x3b')]({},_0x3acb05,_0x294d79[_0x40c3('0x3e')]);return _0x5b4b66[_0x40c3('0x50')](_0x3acb05);}})[_0x40c3('0x23')](function(_0x4ab35f){if(_0x4ab35f){_0x381390=_0x4ab35f[_0x40c3('0x34')];if(!_0x294d79[_0x40c3('0x2e')][_0x40c3('0x35')](_0x40c3('0x36'))){_0x3acb05[_0x40c3('0x1c')]=qs[_0x40c3('0x1c')](_0x294d79['query']['limit']);_0x3acb05['offset']=qs['offset'](_0x294d79[_0x40c3('0x2e')][_0x40c3('0x1a')]);}return _0x5b4b66[_0x40c3('0x50')](_0x3acb05);}})['then'](function(_0x43e58f){if(_0x43e58f){return _0x43e58f?{'count':_0x381390,'rows':_0x43e58f}:null;}})[_0x40c3('0x23')](respondWithResult(_0x23de3f,null))[_0x40c3('0x43')](handleError(_0x23de3f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 4cb6877..1112e2f 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 _0xe294=['lodash','util','api','bluebird','request-promise','rimraf','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe294,0x64));var _0x4e29=function(_0x25382b,_0x3b9ad1){_0x25382b=_0x25382b-0x0;var _0x26ec56=_0xe294[_0x25382b];return _0x26ec56;};'use strict';var _=require(_0x4e29('0x0'));var util=require(_0x4e29('0x1'));var logger=require('../../config/logger')(_0x4e29('0x2'));var moment=require('moment');var BPromise=require(_0x4e29('0x3'));var rp=require(_0x4e29('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e29('0x5'));var config=require('../../config/environment');var attributes=require(_0x4e29('0x6'));module[_0x4e29('0x7')]=function(_0x96e735,_0x358b5a){return _0x96e735['define'](_0x4e29('0x8'),attributes,{'tableName':_0x4e29('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0149=['moment','bluebird','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','int_salesforce_configurations','lodash','util','../../config/logger','api'];(function(_0x11db28,_0x156f54){var _0x1f7ec3=function(_0x2d0817){while(--_0x2d0817){_0x11db28['push'](_0x11db28['shift']());}};_0x1f7ec3(++_0x156f54);}(_0x0149,0x68));var _0x9014=function(_0x471f35,_0x1cee11){_0x471f35=_0x471f35-0x0;var _0xc6d18f=_0x0149[_0x471f35];return _0xc6d18f;};'use strict';var _=require(_0x9014('0x0'));var util=require(_0x9014('0x1'));var logger=require(_0x9014('0x2'))(_0x9014('0x3'));var moment=require(_0x9014('0x4'));var BPromise=require(_0x9014('0x5'));var rp=require(_0x9014('0x6'));var fs=require('fs');var path=require(_0x9014('0x7'));var rimraf=require('rimraf');var config=require(_0x9014('0x8'));var attributes=require(_0x9014('0x9'));module[_0x9014('0xa')]=function(_0x4cbe9c,_0x24bc83){return _0x4cbe9c['define']('SalesforceConfiguration',attributes,{'tableName':_0x9014('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index cee4feb..7f15f93 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 _0xed1c=['client','http','request','then','info','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x430a8c,_0x3be2bc){var _0x1de07b=function(_0x5c2c3c){while(--_0x5c2c3c){_0x430a8c['push'](_0x430a8c['shift']());}};_0x1de07b(++_0x3be2bc);}(_0xed1c,0x1d9));var _0xced1=function(_0x416f9d,_0x1e27a2){_0x416f9d=_0x416f9d-0x0;var _0xae6773=_0xed1c[_0x416f9d];return _0xae6773;};'use strict';var _=require('lodash');var util=require(_0xced1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xced1('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xced1('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xced1('0x3'))(_0xced1('0x4'));var config=require(_0xced1('0x5'));var jayson=require(_0xced1('0x6'));var client=jayson[_0xced1('0x7')][_0xced1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3270a2,_0x1e6d76,_0x2f6e00){return new BPromise(function(_0x3311b5,_0x77c8a4){return client[_0xced1('0x9')](_0x3270a2,_0x2f6e00)[_0xced1('0xa')](function(_0x369aab){logger[_0xced1('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1e6d76,_0xced1('0xc'));logger['debug'](_0xced1('0xd'),_0x1e6d76,'request\x20sent',JSON['stringify'](_0x369aab));if(_0x369aab[_0xced1('0xe')]){if(_0x369aab[_0xced1('0xe')][_0xced1('0xf')]===0x1f4){logger[_0xced1('0xe')](_0xced1('0x10'),_0x1e6d76,_0x369aab[_0xced1('0xe')][_0xced1('0x11')]);return _0x77c8a4(_0x369aab[_0xced1('0xe')][_0xced1('0x11')]);}logger['error'](_0xced1('0x10'),_0x1e6d76,_0x369aab[_0xced1('0xe')][_0xced1('0x11')]);return _0x3311b5(_0x369aab[_0xced1('0xe')]['message']);}else{logger[_0xced1('0xb')](_0xced1('0x10'),_0x1e6d76,'request\x20sent');_0x3311b5(_0x369aab[_0xced1('0x12')][_0xced1('0x11')]);}})[_0xced1('0x13')](function(_0x1b6aa2){logger[_0xced1('0xe')](_0xced1('0x10'),_0x1e6d76,_0x1b6aa2);_0x77c8a4(_0x1b6aa2);});});} \ No newline at end of file +var _0xd0ec=['client','http','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x25406b,_0x58dc45){var _0x211538=function(_0xa6a8bb){while(--_0xa6a8bb){_0x25406b['push'](_0x25406b['shift']());}};_0x211538(++_0x58dc45);}(_0xd0ec,0x92));var _0xcd0e=function(_0x272c5b,_0x46382d){_0x272c5b=_0x272c5b-0x0;var _0x47ceed=_0xd0ec[_0x272c5b];return _0x47ceed;};'use strict';var _=require('lodash');var util=require(_0xcd0e('0x0'));var moment=require('moment');var BPromise=require(_0xcd0e('0x1'));var rs=require(_0xcd0e('0x2'));var fs=require('fs');var Redis=require(_0xcd0e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcd0e('0x4'))(_0xcd0e('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcd0e('0x6')][_0xcd0e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xbadfb3,_0x5352c6,_0x1decc0){return new BPromise(function(_0x9e0c02,_0x4f1f90){return client['request'](_0xbadfb3,_0x1decc0)['then'](function(_0x3ce5e8){logger[_0xcd0e('0x8')](_0xcd0e('0x9'),_0x5352c6,_0xcd0e('0xa'));logger[_0xcd0e('0xb')](_0xcd0e('0xc'),_0x5352c6,_0xcd0e('0xa'),JSON[_0xcd0e('0xd')](_0x3ce5e8));if(_0x3ce5e8[_0xcd0e('0xe')]){if(_0x3ce5e8[_0xcd0e('0xe')][_0xcd0e('0xf')]===0x1f4){logger[_0xcd0e('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5352c6,_0x3ce5e8[_0xcd0e('0xe')][_0xcd0e('0x10')]);return _0x4f1f90(_0x3ce5e8[_0xcd0e('0xe')]['message']);}logger[_0xcd0e('0xe')](_0xcd0e('0x9'),_0x5352c6,_0x3ce5e8[_0xcd0e('0xe')][_0xcd0e('0x10')]);return _0x9e0c02(_0x3ce5e8[_0xcd0e('0xe')][_0xcd0e('0x10')]);}else{logger[_0xcd0e('0x8')](_0xcd0e('0x9'),_0x5352c6,_0xcd0e('0xa'));_0x9e0c02(_0x3ce5e8[_0xcd0e('0x11')][_0xcd0e('0x10')]);}})[_0xcd0e('0x12')](function(_0x237656){logger['error'](_0xcd0e('0x9'),_0x5352c6,_0x237656);_0x4f1f90(_0x237656);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 53fb00d..c53d2ce 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 _0x0395=['multer','util','path','express','Router','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x0395,0xc6));var _0x5039=function(_0x9f48e6,_0x8f87aa){_0x9f48e6=_0x9f48e6-0x0;var _0x45fc5c=_0x0395[_0x9f48e6];return _0x45fc5c;};'use strict';var multer=require(_0x5039('0x0'));var util=require(_0x5039('0x1'));var path=require(_0x5039('0x2'));var timeout=require('connect-timeout');var express=require(_0x5039('0x3'));var router=express[_0x5039('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5039('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5039('0x6'));var controller=require(_0x5039('0x7'));router[_0x5039('0x8')]('/',auth[_0x5039('0x9')](),controller[_0x5039('0xa')]);router['get'](_0x5039('0xb'),auth[_0x5039('0x9')](),controller[_0x5039('0xc')]);router[_0x5039('0xd')]('/',auth[_0x5039('0x9')](),controller[_0x5039('0xe')]);router['put'](_0x5039('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x5039('0xf')](_0x5039('0xb'),auth[_0x5039('0x9')](),controller[_0x5039('0x10')]);module[_0x5039('0x11')]=router; \ No newline at end of file +var _0xfe2b=['fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','isAuthenticated','/:id','show','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0xa68cd9,_0x35b670){var _0x567abc=function(_0xad8435){while(--_0xad8435){_0xa68cd9['push'](_0xa68cd9['shift']());}};_0x567abc(++_0x35b670);}(_0xfe2b,0x13e));var _0xbfe2=function(_0x4b1f8b,_0x249bd9){_0x4b1f8b=_0x4b1f8b-0x0;var _0x1a310e=_0xfe2b[_0x4b1f8b];return _0x1a310e;};'use strict';var multer=require(_0xbfe2('0x0'));var util=require('util');var path=require(_0xbfe2('0x1'));var timeout=require(_0xbfe2('0x2'));var express=require(_0xbfe2('0x3'));var router=express[_0xbfe2('0x4')]();var fs_extra=require(_0xbfe2('0x5'));var auth=require(_0xbfe2('0x6'));var interaction=require(_0xbfe2('0x7'));var config=require('../../config/environment');var controller=require(_0xbfe2('0x8'));router['get']('/',auth[_0xbfe2('0x9')](),controller['index']);router['get'](_0xbfe2('0xa'),auth[_0xbfe2('0x9')](),controller[_0xbfe2('0xb')]);router['post']('/',auth[_0xbfe2('0x9')](),controller[_0xbfe2('0xc')]);router[_0xbfe2('0xd')](_0xbfe2('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xbfe2('0xe')](_0xbfe2('0xa'),auth['isAuthenticated'](),controller[_0xbfe2('0xf')]);module[_0xbfe2('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 be40175..c2e1151 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 _0xcc1e=['ENUM','variable','customVariable','string','STRING','sequelize','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xcc1e,0xd0));var _0xecc1=function(_0xa81926,_0x38e368){_0xa81926=_0xa81926-0x0;var _0x8177ef=_0xcc1e[_0xa81926];return _0x8177ef;};'use strict';var Sequelize=require(_0xecc1('0x0'));module[_0xecc1('0x1')]={'type':{'type':Sequelize[_0xecc1('0x2')]('string',_0xecc1('0x3'),_0xecc1('0x4'),'keyValue','picklist'),'defaultValue':_0xecc1('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xecc1('0x6')]},'keyType':{'type':Sequelize[_0xecc1('0x2')](_0xecc1('0x5'),'variable',_0xecc1('0x4'))},'keyContent':{'type':Sequelize[_0xecc1('0x6')]},'idField':{'type':Sequelize[_0xecc1('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdbca=['STRING','exports','ENUM','string','variable','customVariable','picklist'];(function(_0x35fabd,_0x825452){var _0x61a8ee=function(_0x218f4c){while(--_0x218f4c){_0x35fabd['push'](_0x35fabd['shift']());}};_0x61a8ee(++_0x825452);}(_0xdbca,0x1ba));var _0xadbc=function(_0x454bd3,_0x3e4d94){_0x454bd3=_0x454bd3-0x0;var _0x4eb066=_0xdbca[_0x454bd3];return _0x4eb066;};'use strict';var Sequelize=require('sequelize');module[_0xadbc('0x0')]={'type':{'type':Sequelize[_0xadbc('0x1')](_0xadbc('0x2'),_0xadbc('0x3'),_0xadbc('0x4'),'keyValue',_0xadbc('0x5')),'defaultValue':_0xadbc('0x2')},'content':{'type':Sequelize[_0xadbc('0x6')]},'key':{'type':Sequelize[_0xadbc('0x6')]},'keyType':{'type':Sequelize[_0xadbc('0x1')](_0xadbc('0x2'),_0xadbc('0x3'),_0xadbc('0x4'))},'keyContent':{'type':Sequelize[_0xadbc('0x6')]},'idField':{'type':Sequelize[_0xadbc('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index d906aeb..147d69c 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 _0x137f=['end','offset','undefined','limit','count','Content-Range','json','reject','update','then','destroy','stack','name','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x4e0295,_0x4baf0b){var _0x543589=function(_0x1bafd8){while(--_0x1bafd8){_0x4e0295['push'](_0x4e0295['shift']());}};_0x543589(++_0x4baf0b);}(_0x137f,0x19f));var _0xf137=function(_0x5f11b8,_0x20db88){_0x5f11b8=_0x5f11b8-0x0;var _0x38cdd2=_0x137f[_0x5f11b8];return _0x38cdd2;};'use strict';var emlformat=require(_0xf137('0x0'));var rimraf=require(_0xf137('0x1'));var zipdir=require(_0xf137('0x2'));var jsonpatch=require(_0xf137('0x3'));var rp=require(_0xf137('0x4'));var moment=require(_0xf137('0x5'));var BPromise=require(_0xf137('0x6'));var Mustache=require('mustache');var util=require(_0xf137('0x7'));var path=require(_0xf137('0x8'));var sox=require(_0xf137('0x9'));var csv=require('to-csv');var ejs=require(_0xf137('0xa'));var fs=require('fs');var fs_extra=require(_0xf137('0xb'));var _=require(_0xf137('0xc'));var squel=require(_0xf137('0xd'));var crypto=require(_0xf137('0xe'));var jsforce=require(_0xf137('0xf'));var deskjs=require(_0xf137('0x10'));var toCsv=require(_0xf137('0x11'));var querystring=require(_0xf137('0x12'));var Papa=require('papaparse');var Redis=require(_0xf137('0x13'));var authService=require(_0xf137('0x14'));var qs=require(_0xf137('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf137('0x16'));var logger=require('../../config/logger')(_0xf137('0x17'));var utils=require(_0xf137('0x18'));var config=require(_0xf137('0x19'));var licenseUtil=require(_0xf137('0x1a'));var db=require(_0xf137('0x1b'))['db'];function respondWithStatusCode(_0x3d54d5,_0x45b0ac){_0x45b0ac=_0x45b0ac||0xcc;return function(_0x43e4de){if(_0x43e4de){return _0x3d54d5['sendStatus'](_0x45b0ac);}return _0x3d54d5[_0xf137('0x1c')](_0x45b0ac)[_0xf137('0x1d')]();};}function respondWithResult(_0x58cf67,_0x2388d7){_0x2388d7=_0x2388d7||0xc8;return function(_0x161310){if(_0x161310){return _0x58cf67[_0xf137('0x1c')](_0x2388d7)['json'](_0x161310);}};}function respondWithFilteredResult(_0x21a53d,_0x3a8644){return function(_0x1af436){if(_0x1af436){var _0x3b38d0=typeof _0x3a8644[_0xf137('0x1e')]===_0xf137('0x1f')&&typeof _0x3a8644[_0xf137('0x20')]===_0xf137('0x1f');var _0x5d9c19=_0x1af436[_0xf137('0x21')];var _0x38faf9=_0x3b38d0?0x0:_0x3a8644[_0xf137('0x1e')];var _0x3b4114=_0x3b38d0?_0x1af436[_0xf137('0x21')]:_0x3a8644[_0xf137('0x1e')]+_0x3a8644[_0xf137('0x20')];var _0x1f302e;if(_0x3b4114>=_0x5d9c19){_0x3b4114=_0x5d9c19;_0x1f302e=0xc8;}else{_0x1f302e=0xce;}_0x21a53d['status'](_0x1f302e);return _0x21a53d['set'](_0xf137('0x22'),_0x38faf9+'-'+_0x3b4114+'/'+_0x5d9c19)[_0xf137('0x23')](_0x1af436);}return null;};}function patchUpdates(_0x18211d){return function(_0x269f0d){try{jsonpatch['apply'](_0x269f0d,_0x18211d,!![]);}catch(_0x579b9d){return BPromise[_0xf137('0x24')](_0x579b9d);}return _0x269f0d['save']();};}function saveUpdates(_0x1f7e88,_0x3d5169){return function(_0x4fff76){if(_0x4fff76){return _0x4fff76[_0xf137('0x25')](_0x1f7e88)[_0xf137('0x26')](function(_0x5043ce){return _0x5043ce;});}return null;};}function removeEntity(_0x39db67,_0x43606c){return function(_0xe65b3a){if(_0xe65b3a){return _0xe65b3a[_0xf137('0x27')]()[_0xf137('0x26')](function(){_0x39db67[_0xf137('0x1c')](0xcc)[_0xf137('0x1d')]();});}};}function handleEntityNotFound(_0x18246b,_0x3e5813){return function(_0x566729){if(!_0x566729){_0x18246b['sendStatus'](0x194);}return _0x566729;};}function handleError(_0x8fb251,_0x56abd5){_0x56abd5=_0x56abd5||0x1f4;return function(_0x40bb8d){logger['error'](_0x40bb8d[_0xf137('0x28')]);if(_0x40bb8d['name']){delete _0x40bb8d[_0xf137('0x29')];}_0x8fb251['status'](_0x56abd5)['send'](_0x40bb8d);};}exports[_0xf137('0x2a')]=function(_0x295d5a,_0x3188bc){var _0x324bd1={},_0x1ef399={},_0x568290={'count':0x0,'rows':[]};var _0x34d864=_[_0xf137('0x2b')](db[_0xf137('0x2c')][_0xf137('0x2d')],function(_0x5bf7a7){return{'name':_0x5bf7a7[_0xf137('0x2e')],'type':_0x5bf7a7[_0xf137('0x2f')][_0xf137('0x30')]};});_0x1ef399[_0xf137('0x31')]=_[_0xf137('0x2b')](_0x34d864,_0xf137('0x29'));_0x1ef399['query']=_[_0xf137('0x32')](_0x295d5a[_0xf137('0x33')]);_0x1ef399['filters']=_['intersection'](_0x1ef399[_0xf137('0x31')],_0x1ef399[_0xf137('0x33')]);_0x324bd1[_0xf137('0x34')]=_[_0xf137('0x35')](_0x1ef399['model'],qs[_0xf137('0x36')](_0x295d5a[_0xf137('0x33')][_0xf137('0x36')]));_0x324bd1[_0xf137('0x34')]=_0x324bd1[_0xf137('0x34')]['length']?_0x324bd1[_0xf137('0x34')]:_0x1ef399['model'];if(!_0x295d5a[_0xf137('0x33')][_0xf137('0x37')]('nolimit')){_0x324bd1[_0xf137('0x20')]=qs['limit'](_0x295d5a[_0xf137('0x33')][_0xf137('0x20')]);_0x324bd1[_0xf137('0x1e')]=qs[_0xf137('0x1e')](_0x295d5a[_0xf137('0x33')][_0xf137('0x1e')]);}_0x324bd1[_0xf137('0x38')]=qs[_0xf137('0x39')](_0x295d5a[_0xf137('0x33')][_0xf137('0x39')]);_0x324bd1['where']=qs[_0xf137('0x3a')](_[_0xf137('0x3b')](_0x295d5a['query'],_0x1ef399[_0xf137('0x3a')]),_0x34d864);if(_0x295d5a[_0xf137('0x33')][_0xf137('0x3c')]){_0x324bd1[_0xf137('0x3d')]=_['merge'](_0x324bd1['where'],{'$or':_[_0xf137('0x2b')](_0x34d864,function(_0x1b42b2){if(_0x1b42b2[_0xf137('0x2f')]!=='VIRTUAL'){var _0x454c48={};_0x454c48[_0x1b42b2[_0xf137('0x29')]]={'$like':'%'+_0x295d5a[_0xf137('0x33')][_0xf137('0x3c')]+'%'};return _0x454c48;}})});}_0x324bd1=_[_0xf137('0x3e')]({},_0x324bd1,_0x295d5a[_0xf137('0x3f')]);var _0x5ace61={'where':_0x324bd1[_0xf137('0x3d')]};return db[_0xf137('0x2c')][_0xf137('0x21')](_0x5ace61)[_0xf137('0x26')](function(_0x186893){_0x568290[_0xf137('0x21')]=_0x186893;if(_0x295d5a[_0xf137('0x33')][_0xf137('0x40')]){_0x324bd1[_0xf137('0x41')]=[{'all':!![]}];}return db[_0xf137('0x2c')]['findAll'](_0x324bd1);})[_0xf137('0x26')](function(_0x1a8e77){_0x568290[_0xf137('0x42')]=_0x1a8e77;return _0x568290;})[_0xf137('0x26')](respondWithFilteredResult(_0x3188bc,_0x324bd1))[_0xf137('0x43')](handleError(_0x3188bc,null));};exports[_0xf137('0x44')]=function(_0x241eb9,_0x4c7c06){var _0x128974={'raw':!![],'where':{'id':_0x241eb9[_0xf137('0x45')]['id']}},_0x13b174={};_0x13b174[_0xf137('0x31')]=_[_0xf137('0x32')](db[_0xf137('0x2c')][_0xf137('0x2d')]);_0x13b174[_0xf137('0x33')]=_[_0xf137('0x32')](_0x241eb9[_0xf137('0x33')]);_0x13b174[_0xf137('0x3a')]=_[_0xf137('0x35')](_0x13b174[_0xf137('0x31')],_0x13b174[_0xf137('0x33')]);_0x128974[_0xf137('0x34')]=_[_0xf137('0x35')](_0x13b174[_0xf137('0x31')],qs[_0xf137('0x36')](_0x241eb9[_0xf137('0x33')][_0xf137('0x36')]));_0x128974[_0xf137('0x34')]=_0x128974['attributes'][_0xf137('0x46')]?_0x128974[_0xf137('0x34')]:_0x13b174[_0xf137('0x31')];if(_0x241eb9[_0xf137('0x33')][_0xf137('0x40')]){_0x128974[_0xf137('0x41')]=[{'all':!![]}];}_0x128974=_['merge']({},_0x128974,_0x241eb9[_0xf137('0x3f')]);return db[_0xf137('0x2c')][_0xf137('0x47')](_0x128974)[_0xf137('0x26')](handleEntityNotFound(_0x4c7c06,null))['then'](respondWithResult(_0x4c7c06,null))[_0xf137('0x43')](handleError(_0x4c7c06,null));};exports[_0xf137('0x48')]=function(_0x33dd59,_0x3861f1){return db['SalesforceField'][_0xf137('0x48')](_0x33dd59[_0xf137('0x49')],{})['then'](respondWithResult(_0x3861f1,0xc9))[_0xf137('0x43')](handleError(_0x3861f1,null));};exports[_0xf137('0x25')]=function(_0x2790ad,_0x11d2a4){if(_0x2790ad['body']['id']){delete _0x2790ad[_0xf137('0x49')]['id'];}return db[_0xf137('0x2c')][_0xf137('0x47')]({'where':{'id':_0x2790ad[_0xf137('0x45')]['id']}})[_0xf137('0x26')](handleEntityNotFound(_0x11d2a4,null))[_0xf137('0x26')](saveUpdates(_0x2790ad['body'],null))['then'](respondWithResult(_0x11d2a4,null))[_0xf137('0x43')](handleError(_0x11d2a4,null));};exports[_0xf137('0x27')]=function(_0x1556a1,_0x43360e){return db[_0xf137('0x2c')][_0xf137('0x47')]({'where':{'id':_0x1556a1['params']['id']}})[_0xf137('0x26')](handleEntityNotFound(_0x43360e,null))[_0xf137('0x26')](removeEntity(_0x43360e,null))[_0xf137('0x43')](handleError(_0x43360e,null));}; \ No newline at end of file +var _0x6186=['where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','stack','name','index','map','SalesforceField','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x531f5f,_0x5c2583){var _0xa85203=function(_0x44c9fb){while(--_0x44c9fb){_0x531f5f['push'](_0x531f5f['shift']());}};_0xa85203(++_0x5c2583);}(_0x6186,0x1d4));var _0x6618=function(_0x290492,_0x18cfad){_0x290492=_0x290492-0x0;var _0x52b5bf=_0x6186[_0x290492];return _0x52b5bf;};'use strict';var emlformat=require(_0x6618('0x0'));var rimraf=require(_0x6618('0x1'));var zipdir=require(_0x6618('0x2'));var jsonpatch=require(_0x6618('0x3'));var rp=require(_0x6618('0x4'));var moment=require(_0x6618('0x5'));var BPromise=require(_0x6618('0x6'));var Mustache=require(_0x6618('0x7'));var util=require(_0x6618('0x8'));var path=require('path');var sox=require(_0x6618('0x9'));var csv=require(_0x6618('0xa'));var ejs=require(_0x6618('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6618('0xc'));var squel=require(_0x6618('0xd'));var crypto=require('crypto');var jsforce=require(_0x6618('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6618('0xa'));var querystring=require(_0x6618('0xf'));var Papa=require(_0x6618('0x10'));var Redis=require(_0x6618('0x11'));var authService=require(_0x6618('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6618('0x13'));var logger=require(_0x6618('0x14'))(_0x6618('0x15'));var utils=require(_0x6618('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6618('0x17'));var db=require(_0x6618('0x18'))['db'];function respondWithStatusCode(_0x44838c,_0x5d24b0){_0x5d24b0=_0x5d24b0||0xcc;return function(_0x2f3e04){if(_0x2f3e04){return _0x44838c[_0x6618('0x19')](_0x5d24b0);}return _0x44838c[_0x6618('0x1a')](_0x5d24b0)[_0x6618('0x1b')]();};}function respondWithResult(_0x46bcd4,_0x36d78f){_0x36d78f=_0x36d78f||0xc8;return function(_0xa68161){if(_0xa68161){return _0x46bcd4[_0x6618('0x1a')](_0x36d78f)['json'](_0xa68161);}};}function respondWithFilteredResult(_0xcba007,_0x2dfd76){return function(_0x2699e6){if(_0x2699e6){var _0x1ce6b5=typeof _0x2dfd76[_0x6618('0x1c')]===_0x6618('0x1d')&&typeof _0x2dfd76[_0x6618('0x1e')]===_0x6618('0x1d');var _0x20c031=_0x2699e6[_0x6618('0x1f')];var _0x7dad60=_0x1ce6b5?0x0:_0x2dfd76[_0x6618('0x1c')];var _0x1ef2cf=_0x1ce6b5?_0x2699e6[_0x6618('0x1f')]:_0x2dfd76['offset']+_0x2dfd76[_0x6618('0x1e')];var _0x213e6a;if(_0x1ef2cf>=_0x20c031){_0x1ef2cf=_0x20c031;_0x213e6a=0xc8;}else{_0x213e6a=0xce;}_0xcba007[_0x6618('0x1a')](_0x213e6a);return _0xcba007[_0x6618('0x20')](_0x6618('0x21'),_0x7dad60+'-'+_0x1ef2cf+'/'+_0x20c031)[_0x6618('0x22')](_0x2699e6);}return null;};}function patchUpdates(_0x2a8a2e){return function(_0x2590cc){try{jsonpatch['apply'](_0x2590cc,_0x2a8a2e,!![]);}catch(_0x396eff){return BPromise['reject'](_0x396eff);}return _0x2590cc[_0x6618('0x23')]();};}function saveUpdates(_0x1d496b,_0x1275f0){return function(_0x2c04b5){if(_0x2c04b5){return _0x2c04b5[_0x6618('0x24')](_0x1d496b)[_0x6618('0x25')](function(_0x9e65ce){return _0x9e65ce;});}return null;};}function removeEntity(_0x2b446a,_0x347c19){return function(_0x2880f1){if(_0x2880f1){return _0x2880f1['destroy']()['then'](function(){_0x2b446a[_0x6618('0x1a')](0xcc)[_0x6618('0x1b')]();});}};}function handleEntityNotFound(_0x4bd9fb,_0x17a04f){return function(_0x5dc150){if(!_0x5dc150){_0x4bd9fb[_0x6618('0x19')](0x194);}return _0x5dc150;};}function handleError(_0x4214c7,_0x3e9a49){_0x3e9a49=_0x3e9a49||0x1f4;return function(_0x11081a){logger['error'](_0x11081a[_0x6618('0x26')]);if(_0x11081a['name']){delete _0x11081a[_0x6618('0x27')];}_0x4214c7[_0x6618('0x1a')](_0x3e9a49)['send'](_0x11081a);};}exports[_0x6618('0x28')]=function(_0x51431d,_0xbd885a){var _0x3dd571={},_0x33657c={},_0x531e87={'count':0x0,'rows':[]};var _0x1e09e5=_[_0x6618('0x29')](db[_0x6618('0x2a')][_0x6618('0x2b')],function(_0x3b2d65){return{'name':_0x3b2d65['fieldName'],'type':_0x3b2d65['type'][_0x6618('0x2c')]};});_0x33657c[_0x6618('0x2d')]=_[_0x6618('0x29')](_0x1e09e5,_0x6618('0x27'));_0x33657c[_0x6618('0x2e')]=_[_0x6618('0x2f')](_0x51431d[_0x6618('0x2e')]);_0x33657c[_0x6618('0x30')]=_[_0x6618('0x31')](_0x33657c[_0x6618('0x2d')],_0x33657c[_0x6618('0x2e')]);_0x3dd571['attributes']=_[_0x6618('0x31')](_0x33657c[_0x6618('0x2d')],qs[_0x6618('0x32')](_0x51431d[_0x6618('0x2e')][_0x6618('0x32')]));_0x3dd571[_0x6618('0x33')]=_0x3dd571[_0x6618('0x33')][_0x6618('0x34')]?_0x3dd571[_0x6618('0x33')]:_0x33657c[_0x6618('0x2d')];if(!_0x51431d[_0x6618('0x2e')][_0x6618('0x35')](_0x6618('0x36'))){_0x3dd571[_0x6618('0x1e')]=qs[_0x6618('0x1e')](_0x51431d[_0x6618('0x2e')]['limit']);_0x3dd571[_0x6618('0x1c')]=qs[_0x6618('0x1c')](_0x51431d[_0x6618('0x2e')][_0x6618('0x1c')]);}_0x3dd571[_0x6618('0x37')]=qs['sort'](_0x51431d[_0x6618('0x2e')][_0x6618('0x38')]);_0x3dd571[_0x6618('0x39')]=qs[_0x6618('0x30')](_[_0x6618('0x3a')](_0x51431d[_0x6618('0x2e')],_0x33657c['filters']),_0x1e09e5);if(_0x51431d[_0x6618('0x2e')][_0x6618('0x3b')]){_0x3dd571[_0x6618('0x39')]=_[_0x6618('0x3c')](_0x3dd571['where'],{'$or':_[_0x6618('0x29')](_0x1e09e5,function(_0x1bf396){if(_0x1bf396[_0x6618('0x3d')]!==_0x6618('0x3e')){var _0x3bd4f7={};_0x3bd4f7[_0x1bf396[_0x6618('0x27')]]={'$like':'%'+_0x51431d[_0x6618('0x2e')][_0x6618('0x3b')]+'%'};return _0x3bd4f7;}})});}_0x3dd571=_[_0x6618('0x3c')]({},_0x3dd571,_0x51431d[_0x6618('0x3f')]);var _0x135083={'where':_0x3dd571[_0x6618('0x39')]};return db[_0x6618('0x2a')]['count'](_0x135083)[_0x6618('0x25')](function(_0x17ead6){_0x531e87[_0x6618('0x1f')]=_0x17ead6;if(_0x51431d[_0x6618('0x2e')][_0x6618('0x40')]){_0x3dd571[_0x6618('0x41')]=[{'all':!![]}];}return db[_0x6618('0x2a')][_0x6618('0x42')](_0x3dd571);})[_0x6618('0x25')](function(_0x4aa9c4){_0x531e87[_0x6618('0x43')]=_0x4aa9c4;return _0x531e87;})[_0x6618('0x25')](respondWithFilteredResult(_0xbd885a,_0x3dd571))['catch'](handleError(_0xbd885a,null));};exports[_0x6618('0x44')]=function(_0x37ca72,_0x318fa7){var _0x22bed5={'raw':!![],'where':{'id':_0x37ca72[_0x6618('0x45')]['id']}},_0x2fbc48={};_0x2fbc48[_0x6618('0x2d')]=_[_0x6618('0x2f')](db['SalesforceField'][_0x6618('0x2b')]);_0x2fbc48[_0x6618('0x2e')]=_[_0x6618('0x2f')](_0x37ca72[_0x6618('0x2e')]);_0x2fbc48[_0x6618('0x30')]=_[_0x6618('0x31')](_0x2fbc48[_0x6618('0x2d')],_0x2fbc48[_0x6618('0x2e')]);_0x22bed5[_0x6618('0x33')]=_[_0x6618('0x31')](_0x2fbc48[_0x6618('0x2d')],qs[_0x6618('0x32')](_0x37ca72['query']['fields']));_0x22bed5[_0x6618('0x33')]=_0x22bed5[_0x6618('0x33')][_0x6618('0x34')]?_0x22bed5[_0x6618('0x33')]:_0x2fbc48[_0x6618('0x2d')];if(_0x37ca72[_0x6618('0x2e')][_0x6618('0x40')]){_0x22bed5['include']=[{'all':!![]}];}_0x22bed5=_['merge']({},_0x22bed5,_0x37ca72[_0x6618('0x3f')]);return db[_0x6618('0x2a')][_0x6618('0x46')](_0x22bed5)[_0x6618('0x25')](handleEntityNotFound(_0x318fa7,null))[_0x6618('0x25')](respondWithResult(_0x318fa7,null))[_0x6618('0x47')](handleError(_0x318fa7,null));};exports[_0x6618('0x48')]=function(_0x3dbab9,_0x17bca1){return db[_0x6618('0x2a')][_0x6618('0x48')](_0x3dbab9['body'],{})['then'](respondWithResult(_0x17bca1,0xc9))[_0x6618('0x47')](handleError(_0x17bca1,null));};exports[_0x6618('0x24')]=function(_0x16fc5e,_0x3741a6){if(_0x16fc5e[_0x6618('0x49')]['id']){delete _0x16fc5e['body']['id'];}return db['SalesforceField'][_0x6618('0x46')]({'where':{'id':_0x16fc5e[_0x6618('0x45')]['id']}})[_0x6618('0x25')](handleEntityNotFound(_0x3741a6,null))['then'](saveUpdates(_0x16fc5e['body'],null))['then'](respondWithResult(_0x3741a6,null))['catch'](handleError(_0x3741a6,null));};exports[_0x6618('0x4a')]=function(_0x26f112,_0x4b1e6e){return db[_0x6618('0x2a')][_0x6618('0x46')]({'where':{'id':_0x26f112[_0x6618('0x45')]['id']}})[_0x6618('0x25')](handleEntityNotFound(_0x4b1e6e,null))[_0x6618('0x25')](removeEntity(_0x4b1e6e,null))[_0x6618('0x47')](handleError(_0x4b1e6e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 0c03640..a5e54ed 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 _0xd9e2=['FieldId','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','int_salesforce_fields','salesforce_unique_index'];(function(_0x39c886,_0x33f9ae){var _0x2e66ee=function(_0x50da82){while(--_0x50da82){_0x39c886['push'](_0x39c886['shift']());}};_0x2e66ee(++_0x33f9ae);}(_0xd9e2,0x85));var _0x2d9e=function(_0x470d13,_0x3f22fa){_0x470d13=_0x470d13-0x0;var _0x18cc32=_0xd9e2[_0x470d13];return _0x18cc32;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2d9e('0x0'))(_0x2d9e('0x1'));var moment=require(_0x2d9e('0x2'));var BPromise=require(_0x2d9e('0x3'));var rp=require(_0x2d9e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d9e('0x5'));var config=require(_0x2d9e('0x6'));var attributes=require(_0x2d9e('0x7'));module['exports']=function(_0xdfa8c0,_0x2ee669){return _0xdfa8c0['define']('SalesforceField',attributes,{'tableName':_0x2d9e('0x8'),'paranoid':![],'indexes':[{'name':_0x2d9e('0x9'),'fields':['idField',_0x2d9e('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4ea0=['bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x5630c1,_0x27561a){var _0x4b3ff7=function(_0x7f5a0d){while(--_0x7f5a0d){_0x5630c1['push'](_0x5630c1['shift']());}};_0x4b3ff7(++_0x27561a);}(_0x4ea0,0x72));var _0x04ea=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0x4ea0[_0x100682];return _0xcb6e87;};'use strict';var _=require(_0x04ea('0x0'));var util=require(_0x04ea('0x1'));var logger=require(_0x04ea('0x2'))(_0x04ea('0x3'));var moment=require(_0x04ea('0x4'));var BPromise=require(_0x04ea('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x04ea('0x6'));var rimraf=require(_0x04ea('0x7'));var config=require(_0x04ea('0x8'));var attributes=require(_0x04ea('0x9'));module[_0x04ea('0xa')]=function(_0x2405b2,_0x114bc4){return _0x2405b2[_0x04ea('0xb')](_0x04ea('0xc'),attributes,{'tableName':_0x04ea('0xd'),'paranoid':![],'indexes':[{'name':_0x04ea('0xe'),'fields':[_0x04ea('0xf'),_0x04ea('0x10')],'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 904c471..fe6c689 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 _0x5617=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceField,\x20%s,\x20%s','message','result','lodash'];(function(_0x5169df,_0x123718){var _0x4c7f8d=function(_0x42cb68){while(--_0x42cb68){_0x5169df['push'](_0x5169df['shift']());}};_0x4c7f8d(++_0x123718);}(_0x5617,0x11d));var _0x7561=function(_0x13b593,_0x85a736){_0x13b593=_0x13b593-0x0;var _0x1d2958=_0x5617[_0x13b593];return _0x1d2958;};'use strict';var _=require(_0x7561('0x0'));var util=require(_0x7561('0x1'));var moment=require('moment');var BPromise=require(_0x7561('0x2'));var rs=require(_0x7561('0x3'));var fs=require('fs');var Redis=require(_0x7561('0x4'));var db=require(_0x7561('0x5'))['db'];var utils=require(_0x7561('0x6'));var logger=require(_0x7561('0x7'))(_0x7561('0x8'));var config=require(_0x7561('0x9'));var jayson=require(_0x7561('0xa'));var client=jayson['client'][_0x7561('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x396075,_0x5dd741,_0x560b0e){return new BPromise(function(_0xf13f72,_0xa6a44b){return client[_0x7561('0xc')](_0x396075,_0x560b0e)[_0x7561('0xd')](function(_0x340845){logger[_0x7561('0xe')]('SalesforceField,\x20%s,\x20%s',_0x5dd741,_0x7561('0xf'));logger['debug'](_0x7561('0x10'),_0x5dd741,'request\x20sent',JSON[_0x7561('0x11')](_0x340845));if(_0x340845[_0x7561('0x12')]){if(_0x340845[_0x7561('0x12')]['code']===0x1f4){logger['error'](_0x7561('0x13'),_0x5dd741,_0x340845[_0x7561('0x12')][_0x7561('0x14')]);return _0xa6a44b(_0x340845[_0x7561('0x12')][_0x7561('0x14')]);}logger[_0x7561('0x12')](_0x7561('0x13'),_0x5dd741,_0x340845[_0x7561('0x12')]['message']);return _0xf13f72(_0x340845['error'][_0x7561('0x14')]);}else{logger['info'](_0x7561('0x13'),_0x5dd741,_0x7561('0xf'));_0xf13f72(_0x340845[_0x7561('0x15')][_0x7561('0x14')]);}})['catch'](function(_0x1ac463){logger[_0x7561('0x12')](_0x7561('0x13'),_0x5dd741,_0x1ac463);_0xa6a44b(_0x1ac463);});});} \ No newline at end of file +var _0xa219=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','error'];(function(_0x724ae1,_0x124f0d){var _0x1c3ac9=function(_0x2dbd0b){while(--_0x2dbd0b){_0x724ae1['push'](_0x724ae1['shift']());}};_0x1c3ac9(++_0x124f0d);}(_0xa219,0x10d));var _0x9a21=function(_0x548d7d,_0x2d41fc){_0x548d7d=_0x548d7d-0x0;var _0xb1c878=_0xa219[_0x548d7d];return _0xb1c878;};'use strict';var _=require(_0x9a21('0x0'));var util=require(_0x9a21('0x1'));var moment=require(_0x9a21('0x2'));var BPromise=require(_0x9a21('0x3'));var rs=require(_0x9a21('0x4'));var fs=require('fs');var Redis=require(_0x9a21('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9a21('0x6'))('rpc');var config=require(_0x9a21('0x7'));var jayson=require(_0x9a21('0x8'));var client=jayson[_0x9a21('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x349588,_0x23d157,_0x5c46ab){return new BPromise(function(_0x297878,_0x3d6412){return client[_0x9a21('0xa')](_0x349588,_0x5c46ab)['then'](function(_0xc0aef3){logger[_0x9a21('0xb')](_0x9a21('0xc'),_0x23d157,_0x9a21('0xd'));logger['debug'](_0x9a21('0xe'),_0x23d157,'request\x20sent',JSON['stringify'](_0xc0aef3));if(_0xc0aef3[_0x9a21('0xf')]){if(_0xc0aef3[_0x9a21('0xf')][_0x9a21('0x10')]===0x1f4){logger[_0x9a21('0xf')](_0x9a21('0xc'),_0x23d157,_0xc0aef3['error'][_0x9a21('0x11')]);return _0x3d6412(_0xc0aef3['error'][_0x9a21('0x11')]);}logger[_0x9a21('0xf')](_0x9a21('0xc'),_0x23d157,_0xc0aef3[_0x9a21('0xf')]['message']);return _0x297878(_0xc0aef3['error']['message']);}else{logger[_0x9a21('0xb')](_0x9a21('0xc'),_0x23d157,_0x9a21('0xd'));_0x297878(_0xc0aef3['result'][_0x9a21('0x11')]);}})[_0x9a21('0x12')](function(_0x3eb49b){logger[_0x9a21('0xf')](_0x9a21('0xc'),_0x23d157,_0x3eb49b);_0x3d6412(_0x3eb49b);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 5f9fb53..c382563 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 _0xbda8=['show','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x4f2e14,_0x21d769){var _0xc9c7f5=function(_0x189959){while(--_0x189959){_0x4f2e14['push'](_0x4f2e14['shift']());}};_0xc9c7f5(++_0x21d769);}(_0xbda8,0xe3));var _0x8bda=function(_0x78fa07,_0x4d7642){_0x78fa07=_0x78fa07-0x0;var _0x27f22a=_0xbda8[_0x78fa07];return _0x27f22a;};'use strict';var multer=require('multer');var util=require(_0x8bda('0x0'));var path=require(_0x8bda('0x1'));var timeout=require(_0x8bda('0x2'));var express=require(_0x8bda('0x3'));var router=express[_0x8bda('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8bda('0x5'));var interaction=require(_0x8bda('0x6'));var config=require(_0x8bda('0x7'));var controller=require(_0x8bda('0x8'));router[_0x8bda('0x9')]('/',auth[_0x8bda('0xa')](),controller[_0x8bda('0xb')]);router[_0x8bda('0x9')](_0x8bda('0xc'),auth['isAuthenticated'](),controller[_0x8bda('0xd')]);router['get']('/:id/configurations',auth[_0x8bda('0xa')](),controller[_0x8bda('0xe')]);router[_0x8bda('0x9')](_0x8bda('0xf'),auth[_0x8bda('0xa')](),controller['getFields']);router[_0x8bda('0x10')]('/',auth[_0x8bda('0xa')](),controller[_0x8bda('0x11')]);router[_0x8bda('0x10')](_0x8bda('0x12'),auth[_0x8bda('0xa')](),controller[_0x8bda('0x13')]);router[_0x8bda('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8bda('0x15')](_0x8bda('0xc'),auth['isAuthenticated'](),controller[_0x8bda('0x16')]);module[_0x8bda('0x17')]=router; \ No newline at end of file +var _0x8696=['get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0x8696,0x143));var _0x6869=function(_0x7091dd,_0x1762f5){_0x7091dd=_0x7091dd-0x0;var _0x530e60=_0x8696[_0x7091dd];return _0x530e60;};'use strict';var multer=require(_0x6869('0x0'));var util=require(_0x6869('0x1'));var path=require('path');var timeout=require(_0x6869('0x2'));var express=require('express');var router=express[_0x6869('0x3')]();var fs_extra=require(_0x6869('0x4'));var auth=require(_0x6869('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6869('0x6'));var controller=require('./intServicenowAccount.controller');router[_0x6869('0x7')]('/',auth[_0x6869('0x8')](),controller['index']);router['get'](_0x6869('0x9'),auth[_0x6869('0x8')](),controller[_0x6869('0xa')]);router[_0x6869('0x7')](_0x6869('0xb'),auth[_0x6869('0x8')](),controller[_0x6869('0xc')]);router['get'](_0x6869('0xd'),auth[_0x6869('0x8')](),controller[_0x6869('0xe')]);router[_0x6869('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x6869('0xb'),auth[_0x6869('0x8')](),controller[_0x6869('0x10')]);router[_0x6869('0x11')](_0x6869('0x9'),auth['isAuthenticated'](),controller[_0x6869('0x12')]);router[_0x6869('0x13')]('/:id',auth[_0x6869('0x8')](),controller[_0x6869('0x14')]);module[_0x6869('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 208bbbd..c7cec9b 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 _0xa215=['sequelize','exports','STRING','remoteUri'];(function(_0x54a229,_0x479dd1){var _0x36232e=function(_0x48a4d3){while(--_0x48a4d3){_0x54a229['push'](_0x54a229['shift']());}};_0x36232e(++_0x479dd1);}(_0xa215,0x7c));var _0x5a21=function(_0x1b58b8,_0x3e1c2a){_0x1b58b8=_0x1b58b8-0x0;var _0x479502=_0xa215[_0x1b58b8];return _0x479502;};'use strict';var Sequelize=require(_0x5a21('0x0'));module[_0x5a21('0x1')]={'name':{'type':Sequelize[_0x5a21('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5a21('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x5a21('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5a21('0x2')],'unique':_0x5a21('0x3')},'serverUrl':{'type':Sequelize[_0x5a21('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1d59=['STRING','remoteUri','exports'];(function(_0x34eb31,_0x8f0f70){var _0x254994=function(_0xbec9a3){while(--_0xbec9a3){_0x34eb31['push'](_0x34eb31['shift']());}};_0x254994(++_0x8f0f70);}(_0x1d59,0x107));var _0x91d5=function(_0x118740,_0x18a399){_0x118740=_0x118740-0x0;var _0x21aac5=_0x1d59[_0x118740];return _0x21aac5;};'use strict';var Sequelize=require('sequelize');module[_0x91d5('0x0')]={'name':{'type':Sequelize[_0x91d5('0x1')]},'description':{'type':Sequelize[_0x91d5('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x91d5('0x1')]},'email':{'type':Sequelize[_0x91d5('0x1')]},'remoteUri':{'type':Sequelize[_0x91d5('0x1')],'unique':_0x91d5('0x2')},'serverUrl':{'type':Sequelize[_0x91d5('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 3d41bbb..5d30b23 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 _0xd700=['../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','undefined','count','offset','limit','set','apply','reject','save','then','error','stack','name','send','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','ServicenowAccount','findAll','catch','show','find','create','body','params','destroy','getConfigurations','findOne','ServicenowConfiguration','Subjects','channel','type','Descriptions','getDescriptions','ServicenowField','getFields','hold_reason','subcategory','notify','incident_state','category','parent','made_sla','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','user_input','state','sys_created_by','knowledge','closed_at','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','business_stc','description','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','urgency','problem_id','company','activity_due','severity','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','location','password','email','serverUrl','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','forEach','internalType','label','push','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','True','true','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0x4b3508,_0x65c00){var _0x21f61f=function(_0x4cc268){while(--_0x4cc268){_0x4b3508['push'](_0x4b3508['shift']());}};_0x21f61f(++_0x65c00);}(_0xd700,0x9c));var _0x0d70=function(_0x40e76b,_0x9f1a5){_0x40e76b=_0x40e76b-0x0;var _0x8b2a31=_0xd700[_0x40e76b];return _0x8b2a31;};'use strict';var emlformat=require(_0x0d70('0x0'));var rimraf=require(_0x0d70('0x1'));var zipdir=require(_0x0d70('0x2'));var jsonpatch=require(_0x0d70('0x3'));var rp=require(_0x0d70('0x4'));var moment=require(_0x0d70('0x5'));var BPromise=require(_0x0d70('0x6'));var Mustache=require('mustache');var util=require(_0x0d70('0x7'));var path=require(_0x0d70('0x8'));var sox=require(_0x0d70('0x9'));var csv=require(_0x0d70('0xa'));var ejs=require(_0x0d70('0xb'));var fs=require('fs');var fs_extra=require(_0x0d70('0xc'));var _=require(_0x0d70('0xd'));var squel=require('squel');var crypto=require(_0x0d70('0xe'));var jsforce=require(_0x0d70('0xf'));var deskjs=require(_0x0d70('0x10'));var toCsv=require(_0x0d70('0xa'));var querystring=require(_0x0d70('0x11'));var Papa=require(_0x0d70('0x12'));var Redis=require(_0x0d70('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0d70('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d70('0x15'))(_0x0d70('0x16'));var utils=require(_0x0d70('0x17'));var config=require(_0x0d70('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d70('0x19'))['db'];var integrations=require(_0x0d70('0x1a'));function respondWithStatusCode(_0x2452a,_0x3fbbed){_0x3fbbed=_0x3fbbed||0xcc;return function(_0x282821){if(_0x282821){return _0x2452a[_0x0d70('0x1b')](_0x3fbbed);}return _0x2452a['status'](_0x3fbbed)[_0x0d70('0x1c')]();};}function respondWithResult(_0x4c1294,_0x2d4c76){_0x2d4c76=_0x2d4c76||0xc8;return function(_0x54de72){if(_0x54de72){return _0x4c1294[_0x0d70('0x1d')](_0x2d4c76)['json'](_0x54de72);}};}function respondWithFilteredResult(_0x3f6573,_0x2ded06){return function(_0x4bb925){if(_0x4bb925){var _0x3ae81d=typeof _0x2ded06['offset']===_0x0d70('0x1e')&&typeof _0x2ded06['limit']==='undefined';var _0x4782ec=_0x4bb925[_0x0d70('0x1f')];var _0x570db8=_0x3ae81d?0x0:_0x2ded06[_0x0d70('0x20')];var _0x596c24=_0x3ae81d?_0x4bb925[_0x0d70('0x1f')]:_0x2ded06['offset']+_0x2ded06[_0x0d70('0x21')];var _0x15c512;if(_0x596c24>=_0x4782ec){_0x596c24=_0x4782ec;_0x15c512=0xc8;}else{_0x15c512=0xce;}_0x3f6573[_0x0d70('0x1d')](_0x15c512);return _0x3f6573[_0x0d70('0x22')]('Content-Range',_0x570db8+'-'+_0x596c24+'/'+_0x4782ec)['json'](_0x4bb925);}return null;};}function patchUpdates(_0x58690c){return function(_0x313833){try{jsonpatch[_0x0d70('0x23')](_0x313833,_0x58690c,!![]);}catch(_0x202819){return BPromise[_0x0d70('0x24')](_0x202819);}return _0x313833[_0x0d70('0x25')]();};}function saveUpdates(_0x20e4fb,_0x51d787){return function(_0x26798d){if(_0x26798d){return _0x26798d['update'](_0x20e4fb)['then'](function(_0x268532){return _0x268532;});}return null;};}function removeEntity(_0x16ce6f,_0x15c24c){return function(_0x2ea088){if(_0x2ea088){return _0x2ea088['destroy']()[_0x0d70('0x26')](function(){_0x16ce6f['status'](0xcc)[_0x0d70('0x1c')]();});}};}function handleEntityNotFound(_0x1d93a7,_0x264642){return function(_0x487ce5){if(!_0x487ce5){_0x1d93a7[_0x0d70('0x1b')](0x194);}return _0x487ce5;};}function handleError(_0x207a7f,_0x18b2a2){_0x18b2a2=_0x18b2a2||0x1f4;return function(_0x2964a8){logger[_0x0d70('0x27')](_0x2964a8[_0x0d70('0x28')]);if(_0x2964a8[_0x0d70('0x29')]){delete _0x2964a8[_0x0d70('0x29')];}_0x207a7f['status'](_0x18b2a2)[_0x0d70('0x2a')](_0x2964a8);};}exports['index']=function(_0x1904a4,_0x24908a){var _0x21c431={},_0x3abd30={},_0x54a7ec={'count':0x0,'rows':[]};var _0x2588b3=_['map'](db['ServicenowAccount'][_0x0d70('0x2b')],function(_0x138f34){return{'name':_0x138f34[_0x0d70('0x2c')],'type':_0x138f34['type'][_0x0d70('0x2d')]};});_0x3abd30[_0x0d70('0x2e')]=_[_0x0d70('0x2f')](_0x2588b3,_0x0d70('0x29'));_0x3abd30['query']=_[_0x0d70('0x30')](_0x1904a4[_0x0d70('0x31')]);_0x3abd30[_0x0d70('0x32')]=_[_0x0d70('0x33')](_0x3abd30['model'],_0x3abd30['query']);_0x21c431[_0x0d70('0x34')]=_['intersection'](_0x3abd30['model'],qs[_0x0d70('0x35')](_0x1904a4['query']['fields']));_0x21c431['attributes']=_0x21c431[_0x0d70('0x34')][_0x0d70('0x36')]?_0x21c431[_0x0d70('0x34')]:_0x3abd30[_0x0d70('0x2e')];if(!_0x1904a4[_0x0d70('0x31')][_0x0d70('0x37')]('nolimit')){_0x21c431[_0x0d70('0x21')]=qs['limit'](_0x1904a4[_0x0d70('0x31')]['limit']);_0x21c431[_0x0d70('0x20')]=qs[_0x0d70('0x20')](_0x1904a4['query'][_0x0d70('0x20')]);}_0x21c431[_0x0d70('0x38')]=qs[_0x0d70('0x39')](_0x1904a4['query']['sort']);_0x21c431[_0x0d70('0x3a')]=qs[_0x0d70('0x32')](_[_0x0d70('0x3b')](_0x1904a4['query'],_0x3abd30[_0x0d70('0x32')]),_0x2588b3);if(_0x1904a4[_0x0d70('0x31')]['filter']){_0x21c431[_0x0d70('0x3a')]=_[_0x0d70('0x3c')](_0x21c431['where'],{'$or':_[_0x0d70('0x2f')](_0x2588b3,function(_0xd0a8e9){if(_0xd0a8e9['type']!==_0x0d70('0x3d')){var _0x5e804d={};_0x5e804d[_0xd0a8e9[_0x0d70('0x29')]]={'$like':'%'+_0x1904a4[_0x0d70('0x31')][_0x0d70('0x3e')]+'%'};return _0x5e804d;}})});}_0x21c431=_['merge']({},_0x21c431,_0x1904a4[_0x0d70('0x3f')]);var _0x121074={'where':_0x21c431['where']};return db['ServicenowAccount']['count'](_0x121074)['then'](function(_0x724f42){_0x54a7ec[_0x0d70('0x1f')]=_0x724f42;if(_0x1904a4[_0x0d70('0x31')][_0x0d70('0x40')]){_0x21c431[_0x0d70('0x41')]=[{'all':!![]}];}return db[_0x0d70('0x42')][_0x0d70('0x43')](_0x21c431);})[_0x0d70('0x26')](function(_0x2049da){_0x54a7ec['rows']=_0x2049da;return _0x54a7ec;})[_0x0d70('0x26')](respondWithFilteredResult(_0x24908a,_0x21c431))[_0x0d70('0x44')](handleError(_0x24908a,null));};exports[_0x0d70('0x45')]=function(_0x3d90cc,_0x484496){var _0x512edb={'raw':![],'where':{'id':_0x3d90cc['params']['id']}},_0x3a29bc={};_0x3a29bc[_0x0d70('0x2e')]=_['keys'](db[_0x0d70('0x42')][_0x0d70('0x2b')]);_0x3a29bc[_0x0d70('0x31')]=_[_0x0d70('0x30')](_0x3d90cc[_0x0d70('0x31')]);_0x3a29bc['filters']=_[_0x0d70('0x33')](_0x3a29bc['model'],_0x3a29bc[_0x0d70('0x31')]);_0x512edb[_0x0d70('0x34')]=_[_0x0d70('0x33')](_0x3a29bc[_0x0d70('0x2e')],qs[_0x0d70('0x35')](_0x3d90cc[_0x0d70('0x31')][_0x0d70('0x35')]));_0x512edb[_0x0d70('0x34')]=_0x512edb[_0x0d70('0x34')][_0x0d70('0x36')]?_0x512edb['attributes']:_0x3a29bc[_0x0d70('0x2e')];if(_0x3d90cc[_0x0d70('0x31')][_0x0d70('0x40')]){_0x512edb[_0x0d70('0x41')]=[{'all':!![]}];}_0x512edb=_['merge']({},_0x512edb,_0x3d90cc['options']);return db[_0x0d70('0x42')][_0x0d70('0x46')](_0x512edb)[_0x0d70('0x26')](handleEntityNotFound(_0x484496,null))[_0x0d70('0x26')](respondWithResult(_0x484496,null))['catch'](handleError(_0x484496,null));};exports[_0x0d70('0x47')]=function(_0x2bb544,_0x28e312){return db[_0x0d70('0x42')][_0x0d70('0x47')](_0x2bb544[_0x0d70('0x48')],{})['then'](respondWithResult(_0x28e312,0xc9))['catch'](handleError(_0x28e312,null));};exports['update']=function(_0x3652cb,_0x1bfb84){if(_0x3652cb['body']['id']){delete _0x3652cb['body']['id'];}return db[_0x0d70('0x42')]['find']({'where':{'id':_0x3652cb[_0x0d70('0x49')]['id']}})[_0x0d70('0x26')](handleEntityNotFound(_0x1bfb84,null))['then'](saveUpdates(_0x3652cb[_0x0d70('0x48')],null))[_0x0d70('0x26')](respondWithResult(_0x1bfb84,null))['catch'](handleError(_0x1bfb84,null));};exports[_0x0d70('0x4a')]=function(_0x11151c,_0x504d7f){return db['ServicenowAccount'][_0x0d70('0x46')]({'where':{'id':_0x11151c[_0x0d70('0x49')]['id']}})[_0x0d70('0x26')](handleEntityNotFound(_0x504d7f,null))['then'](removeEntity(_0x504d7f,null))[_0x0d70('0x44')](handleError(_0x504d7f,null));};exports[_0x0d70('0x4b')]=function(_0x389589,_0x428574,_0x140f5b){var _0x2c9a98={};var _0xbbba6b={};var _0x30844c;var _0x3e7eac;return db[_0x0d70('0x42')][_0x0d70('0x4c')]({'where':{'id':_0x389589[_0x0d70('0x49')]['id']}})[_0x0d70('0x26')](handleEntityNotFound(_0x428574,null))[_0x0d70('0x26')](function(_0x53d7ec){if(_0x53d7ec){_0x30844c=_0x53d7ec;_0xbbba6b[_0x0d70('0x2e')]=_[_0x0d70('0x30')](db[_0x0d70('0x4d')]['rawAttributes']);_0xbbba6b[_0x0d70('0x31')]=_[_0x0d70('0x30')](_0x389589[_0x0d70('0x31')]);_0xbbba6b[_0x0d70('0x32')]=_['intersection'](_0xbbba6b['model'],_0xbbba6b[_0x0d70('0x31')]);_0x2c9a98[_0x0d70('0x34')]=_['intersection'](_0xbbba6b[_0x0d70('0x2e')],qs[_0x0d70('0x35')](_0x389589[_0x0d70('0x31')][_0x0d70('0x35')]));_0x2c9a98[_0x0d70('0x34')]=_0x2c9a98['attributes'][_0x0d70('0x36')]?_0x2c9a98[_0x0d70('0x34')]:_0xbbba6b[_0x0d70('0x2e')];_0x2c9a98[_0x0d70('0x38')]=qs[_0x0d70('0x39')](_0x389589[_0x0d70('0x31')][_0x0d70('0x39')]);_0x2c9a98[_0x0d70('0x3a')]=qs[_0x0d70('0x32')](_[_0x0d70('0x3b')](_0x389589[_0x0d70('0x31')],_0xbbba6b[_0x0d70('0x32')]));if(_0x389589[_0x0d70('0x31')][_0x0d70('0x3e')]){_0x2c9a98['where']=_[_0x0d70('0x3c')](_0x2c9a98[_0x0d70('0x3a')],{'$or':_[_0x0d70('0x2f')](_0x2c9a98['attributes'],function(_0x1d372d){var _0x244486={};_0x244486[_0x1d372d]={'$like':'%'+_0x389589['query'][_0x0d70('0x3e')]+'%'};return _0x244486;})});}_0x2c9a98=_[_0x0d70('0x3c')]({},_0x2c9a98,_0x389589[_0x0d70('0x3f')]);return _0x30844c[_0x0d70('0x4b')](_0x2c9a98);}})[_0x0d70('0x26')](function(_0x543a47){if(_0x543a47){_0x3e7eac=_0x543a47[_0x0d70('0x36')];if(!_0x389589['query'][_0x0d70('0x37')]('nolimit')){_0x2c9a98[_0x0d70('0x21')]=qs[_0x0d70('0x21')](_0x389589[_0x0d70('0x31')]['limit']);_0x2c9a98[_0x0d70('0x20')]=qs[_0x0d70('0x20')](_0x389589[_0x0d70('0x31')][_0x0d70('0x20')]);}return _0x30844c['getConfigurations'](_0x2c9a98);}})[_0x0d70('0x26')](function(_0x4594c0){if(_0x4594c0){return _0x4594c0?{'count':_0x3e7eac,'rows':_0x4594c0}:null;}})['then'](respondWithResult(_0x428574,null))['catch'](handleError(_0x428574,null));};exports['addConfiguration']=function(_0x43e85f,_0x192ecf,_0x12fba5){if(_0x43e85f[_0x0d70('0x48')]['id']){delete _0x43e85f[_0x0d70('0x48')]['id'];}return db[_0x0d70('0x42')][_0x0d70('0x4c')]({'where':{'id':_0x43e85f[_0x0d70('0x49')]['id']}})[_0x0d70('0x26')](handleEntityNotFound(_0x192ecf,null))[_0x0d70('0x26')](function(_0x10372f){if(_0x10372f){_0x43e85f['body']['AccountId']=_0x10372f['id'];_0x43e85f[_0x0d70('0x48')][_0x0d70('0x4e')]=integrations['getSubjects'](_0x43e85f['body'][_0x0d70('0x4f')],_0x43e85f[_0x0d70('0x48')][_0x0d70('0x50')]);_0x43e85f[_0x0d70('0x48')][_0x0d70('0x51')]=integrations[_0x0d70('0x52')](_0x43e85f[_0x0d70('0x48')][_0x0d70('0x4f')],_0x43e85f[_0x0d70('0x48')][_0x0d70('0x50')]);return db[_0x0d70('0x4d')][_0x0d70('0x47')](_0x43e85f[_0x0d70('0x48')],{'include':[{'model':db[_0x0d70('0x53')],'as':_0x0d70('0x4e')},{'model':db[_0x0d70('0x53')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x192ecf,null))[_0x0d70('0x44')](handleError(_0x192ecf,null));};exports[_0x0d70('0x54')]=function(_0x1e0075,_0x5a1cd4,_0x15eae1){var _0x56fdf9=['made_sla',_0x0d70('0x55'),'knowledge',_0x0d70('0x56'),'close_code',_0x0d70('0x57'),_0x0d70('0x58'),'severity',_0x0d70('0x59')];var _0x460340=[_0x0d70('0x5a'),_0x0d70('0x5b'),_0x0d70('0x5c'),'watch_list',_0x0d70('0x5d'),_0x0d70('0x5e'),_0x0d70('0x5f'),_0x0d70('0x55'),_0x0d70('0x60'),'number',_0x0d70('0x61'),_0x0d70('0x62'),'opened_by',_0x0d70('0x63'),'sys_created_on','sys_domain',_0x0d70('0x64'),_0x0d70('0x65'),_0x0d70('0x66'),'order','calendar_stc',_0x0d70('0x67'),'cmdb_ci',_0x0d70('0x68'),_0x0d70('0x69'),_0x0d70('0x6a'),_0x0d70('0x6b'),_0x0d70('0x6c'),_0x0d70('0x6d'),_0x0d70('0x6e'),_0x0d70('0x6f'),_0x0d70('0x70'),_0x0d70('0x71'),_0x0d70('0x72'),_0x0d70('0x73'),'group_list',_0x0d70('0x74'),_0x0d70('0x75'),_0x0d70('0x76'),_0x0d70('0x77'),_0x0d70('0x78'),_0x0d70('0x56'),_0x0d70('0x79'),_0x0d70('0x7a'),'close_code',_0x0d70('0x7b'),_0x0d70('0x7c'),'work_start','assignment_group',_0x0d70('0x7d'),'additional_assignee_list',_0x0d70('0x7e'),'calendar_duration',_0x0d70('0x57'),_0x0d70('0x7f'),_0x0d70('0x80'),_0x0d70('0x81'),_0x0d70('0x82'),'parent_incident',_0x0d70('0x83'),_0x0d70('0x84'),_0x0d70('0x85'),_0x0d70('0x58'),_0x0d70('0x86'),_0x0d70('0x87'),_0x0d70('0x88'),'reassignment_count',_0x0d70('0x89'),'assigned_to',_0x0d70('0x8a'),'comments',_0x0d70('0x8b'),_0x0d70('0x8c'),_0x0d70('0x8d'),_0x0d70('0x8e'),_0x0d70('0x8f'),_0x0d70('0x90'),_0x0d70('0x91'),_0x0d70('0x92'),'upon_approval','correlation_id',_0x0d70('0x93'),'category'];var _0x586b75='';var _0x54626f='';var _0x43caf2=[];var _0x111ebb='';var _0x34ccf7='';var _0x472f07=[];var _0x3e2db7='';var _0xc0890a='';var _0x6900b={};var _0x3859b4='';return db[_0x0d70('0x42')]['findOne']({'where':{'id':_0x1e0075['params']['id']},'attributes':['id','username',_0x0d70('0x94'),_0x0d70('0x95'),'remoteUri',_0x0d70('0x96')]})[_0x0d70('0x26')](handleEntityNotFound(_0x5a1cd4,null))[_0x0d70('0x26')](function(_0x3415c3){if(_0x3415c3){_0x3859b4=_0x3415c3['remoteUri'];var _0x5befa3=_0x3859b4['slice'](-0x1);if(_0x5befa3==='/'){_0x3859b4=_0x3859b4[_0x0d70('0x97')](0x0,_0x3859b4[_0x0d70('0x98')](_0x5befa3));}_0xc0890a=util[_0x0d70('0x99')](_0x0d70('0x9a'),_0x3859b4);_0x3e2db7=util[_0x0d70('0x99')](_0x0d70('0x9b'),_0x3859b4);_0x6900b={'user':_0x3415c3['username'],'pass':_0x3415c3[_0x0d70('0x94')]};var _0x592b12={'method':_0x0d70('0x9c'),'uri':_0xc0890a+_0x0d70('0x9d'),'auth':_0x6900b,'json':!![]};return rp(_0x592b12);}})[_0x0d70('0x26')](function(_0x1373be){if(_0x1373be[_0x0d70('0x9e')][_0x0d70('0x36')]>0x0){_0x586b75=_0x1373be['result'];}console[_0x0d70('0x9f')](_0x0d70('0xa0'),_0x586b75);_0x472f07=[];_0x54626f=Object[_0x0d70('0xa1')]([],_0x586b75);_['remove'](_0x54626f,function(_0x6a6d64){return!_0x56fdf9[_0x0d70('0xa2')](_0x6a6d64[_0x0d70('0x29')]);});_0x54626f[_0x0d70('0xa3')](function(_0x475bf3){var _0x25a4a8=createFieldObject(_0x3e2db7,_0x6900b,_0x475bf3[_0x0d70('0xa4')],_0x475bf3['name'],_0x475bf3[_0x0d70('0xa5')],![]);_0x472f07[_0x0d70('0xa6')](_0x25a4a8);});return Promise[_0x0d70('0xa7')](_0x472f07);})[_0x0d70('0x26')](function(_0x33b7e5){_0x43caf2=_0x33b7e5;_0x111ebb=Object[_0x0d70('0xa1')]([],_0x586b75);console[_0x0d70('0x9f')](_0x0d70('0xa8'),_0x586b75);_[_0x0d70('0xa9')](_0x111ebb,function(_0x1fe27e){return _0x460340[_0x0d70('0xa2')](_0x1fe27e[_0x0d70('0x29')]);});console[_0x0d70('0x9f')](_0x0d70('0xaa'),_0x111ebb);_0x472f07=[];_0x111ebb[_0x0d70('0xa3')](function(_0x16394c){var _0xaf8479=createFieldObject(_0x3e2db7,_0x6900b,_0x16394c['internalType'],_0x16394c[_0x0d70('0x29')],_0x16394c[_0x0d70('0xa5')],!![]);_0x472f07['push'](_0xaf8479);});return Promise[_0x0d70('0xa7')](_0x472f07);})[_0x0d70('0x26')](function(_0x42451a){_0x34ccf7=_0x42451a;var _0x1d142e=_0x43caf2[_0x0d70('0xab')](_0x34ccf7);return{'count':_0x1d142e[_0x0d70('0x36')],'rows':_0x1d142e};})[_0x0d70('0x26')](respondWithResult(_0x5a1cd4,null))[_0x0d70('0x44')](function(_0x1e90e8){console[_0x0d70('0x9f')](_0x0d70('0xac')+_0x1e90e8);var _0x4d1276=_0x1e0075[_0x0d70('0x31')][_0x0d70('0xad')]?0x1f4:_0x1e90e8[_0x0d70('0xae')]||0x1f4;logger[_0x0d70('0x27')](_0x1e90e8['stack']);delete _0x1e90e8[_0x0d70('0x29')];if(_0x4d1276===0x191){_0x4d1276=0x190;}_0x5a1cd4['status'](_0x4d1276)[_0x0d70('0x2a')](_0x1e0075['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x1e90e8[_0x0d70('0xae')]}:_0x1e90e8);});};function createFieldObject(_0x10e634,_0x1e0453,_0x5ed55a,_0x3940ee,_0x50656a,_0x2f369e){return new Promise(function(_0x4f563e,_0xba6115){var _0x5571e1={'id':_0x3940ee,'name':_0x50656a,'custom':_0x2f369e};if(_0x5ed55a===_0x0d70('0xaf')){_0x5571e1[_0x0d70('0x3f')]=[{'name':_0x0d70('0xb0'),'value':_0x0d70('0xb1')},{'name':'False','value':'false'}];_0x4f563e(_0x5571e1);}else{var _0x2f2eb4={'method':'GET','uri':_0x10e634+_0x0d70('0xb2')+_0x3940ee,'auth':_0x1e0453,'json':!![]};return rp(_0x2f2eb4)[_0x0d70('0x26')](function(_0x4499be){var _0x1ab626=[];if(_0x4499be['result'][_0x0d70('0x36')]>0x0){_0x4499be[_0x0d70('0x9e')][_0x0d70('0xa3')](function(_0x4044da){if(_0x4044da[_0x0d70('0xb3')]==='false'){var _0x276a8c={'name':_0x4044da['label'],'value':_0x4044da['value']};_0x1ab626[_0x0d70('0xa6')](_0x276a8c);}});}_0x5571e1['options']=_0x1ab626;if(_0x5571e1['options']['length']>0x0){_0x4f563e(_0x5571e1);}else{if(_0x2f369e==![]){_0x4f563e();}else{_0x4f563e(_0x5571e1);}}});}});} \ No newline at end of file +var _0x49a7=['query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','ServicenowAccount','includeAll','include','findAll','catch','show','params','length','options','create','body','find','getConfigurations','ServicenowConfiguration','addConfiguration','AccountId','getSubjects','getDescriptions','ServicenowField','Descriptions','getFields','hold_reason','knowledge','subcategory','close_code','notify','incident_state','category','parent','made_sla','watch_list','upon_reject','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','rfc','time_worked','expected_start','opened_at','group_list','work_end','resolved_at','approval_set','work_notes','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','closed_by','follow_up','sys_id','contact_type','reopened_by','urgency','problem_id','reassignment_count','activity_due','assigned_to','sla_due','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','forEach','internalType','label','all','remove','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','ServiceNow\x20error:\x20','statusCode','stack','test','Wrong\x20credentials','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','model','keys','filters','intersection'];(function(_0x4c8100,_0x2809ed){var _0x5a857a=function(_0x147f10){while(--_0x147f10){_0x4c8100['push'](_0x4c8100['shift']());}};_0x5a857a(++_0x2809ed);}(_0x49a7,0x1f4));var _0x749a=function(_0xa23638,_0x373769){_0xa23638=_0xa23638-0x0;var _0x1c9941=_0x49a7[_0xa23638];return _0x1c9941;};'use strict';var emlformat=require(_0x749a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x749a('0x1'));var jsonpatch=require(_0x749a('0x2'));var rp=require(_0x749a('0x3'));var moment=require(_0x749a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x749a('0x5'));var util=require(_0x749a('0x6'));var path=require('path');var sox=require(_0x749a('0x7'));var csv=require(_0x749a('0x8'));var ejs=require(_0x749a('0x9'));var fs=require('fs');var fs_extra=require(_0x749a('0xa'));var _=require(_0x749a('0xb'));var squel=require(_0x749a('0xc'));var crypto=require('crypto');var jsforce=require(_0x749a('0xd'));var deskjs=require(_0x749a('0xe'));var toCsv=require(_0x749a('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x749a('0xf'));var authService=require(_0x749a('0x10'));var qs=require(_0x749a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x749a('0x12'));var logger=require(_0x749a('0x13'))(_0x749a('0x14'));var utils=require(_0x749a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x749a('0x16'));var db=require(_0x749a('0x17'))['db'];var integrations=require(_0x749a('0x18'));function respondWithStatusCode(_0x426128,_0x5770a9){_0x5770a9=_0x5770a9||0xcc;return function(_0x5a2137){if(_0x5a2137){return _0x426128[_0x749a('0x19')](_0x5770a9);}return _0x426128[_0x749a('0x1a')](_0x5770a9)['end']();};}function respondWithResult(_0x1be673,_0x2b8505){_0x2b8505=_0x2b8505||0xc8;return function(_0x583485){if(_0x583485){return _0x1be673[_0x749a('0x1a')](_0x2b8505)[_0x749a('0x1b')](_0x583485);}};}function respondWithFilteredResult(_0x197bd5,_0x214210){return function(_0x134960){if(_0x134960){var _0x59f728=typeof _0x214210[_0x749a('0x1c')]===_0x749a('0x1d')&&typeof _0x214210[_0x749a('0x1e')]===_0x749a('0x1d');var _0x49ba70=_0x134960[_0x749a('0x1f')];var _0x3c7149=_0x59f728?0x0:_0x214210[_0x749a('0x1c')];var _0x5200b4=_0x59f728?_0x134960[_0x749a('0x1f')]:_0x214210[_0x749a('0x1c')]+_0x214210['limit'];var _0x583673;if(_0x5200b4>=_0x49ba70){_0x5200b4=_0x49ba70;_0x583673=0xc8;}else{_0x583673=0xce;}_0x197bd5[_0x749a('0x1a')](_0x583673);return _0x197bd5[_0x749a('0x20')](_0x749a('0x21'),_0x3c7149+'-'+_0x5200b4+'/'+_0x49ba70)[_0x749a('0x1b')](_0x134960);}return null;};}function patchUpdates(_0x2c6790){return function(_0x2f3bfc){try{jsonpatch[_0x749a('0x22')](_0x2f3bfc,_0x2c6790,!![]);}catch(_0x33b549){return BPromise[_0x749a('0x23')](_0x33b549);}return _0x2f3bfc[_0x749a('0x24')]();};}function saveUpdates(_0x33af4c,_0x3d9fa9){return function(_0x5ca4e2){if(_0x5ca4e2){return _0x5ca4e2[_0x749a('0x25')](_0x33af4c)[_0x749a('0x26')](function(_0x2db2c8){return _0x2db2c8;});}return null;};}function removeEntity(_0x3ea337,_0x18f1d3){return function(_0x3b12e8){if(_0x3b12e8){return _0x3b12e8[_0x749a('0x27')]()[_0x749a('0x26')](function(){_0x3ea337[_0x749a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28192d,_0x2d1f0b){return function(_0x2a5ec8){if(!_0x2a5ec8){_0x28192d['sendStatus'](0x194);}return _0x2a5ec8;};}function handleError(_0x2c2201,_0x5e8ff9){_0x5e8ff9=_0x5e8ff9||0x1f4;return function(_0x273322){logger[_0x749a('0x28')](_0x273322['stack']);if(_0x273322['name']){delete _0x273322[_0x749a('0x29')];}_0x2c2201[_0x749a('0x1a')](_0x5e8ff9)[_0x749a('0x2a')](_0x273322);};}exports[_0x749a('0x2b')]=function(_0x3ba91f,_0x5bdbda){var _0x21c80a={},_0x124d5f={},_0x22fa00={'count':0x0,'rows':[]};var _0x5f2713=_[_0x749a('0x2c')](db['ServicenowAccount'][_0x749a('0x2d')],function(_0x2382b0){return{'name':_0x2382b0[_0x749a('0x2e')],'type':_0x2382b0[_0x749a('0x2f')]['key']};});_0x124d5f[_0x749a('0x30')]=_['map'](_0x5f2713,_0x749a('0x29'));_0x124d5f['query']=_[_0x749a('0x31')](_0x3ba91f['query']);_0x124d5f[_0x749a('0x32')]=_[_0x749a('0x33')](_0x124d5f[_0x749a('0x30')],_0x124d5f[_0x749a('0x34')]);_0x21c80a[_0x749a('0x35')]=_[_0x749a('0x33')](_0x124d5f[_0x749a('0x30')],qs[_0x749a('0x36')](_0x3ba91f['query']['fields']));_0x21c80a[_0x749a('0x35')]=_0x21c80a['attributes']['length']?_0x21c80a[_0x749a('0x35')]:_0x124d5f['model'];if(!_0x3ba91f[_0x749a('0x34')][_0x749a('0x37')](_0x749a('0x38'))){_0x21c80a[_0x749a('0x1e')]=qs[_0x749a('0x1e')](_0x3ba91f['query'][_0x749a('0x1e')]);_0x21c80a[_0x749a('0x1c')]=qs[_0x749a('0x1c')](_0x3ba91f[_0x749a('0x34')][_0x749a('0x1c')]);}_0x21c80a[_0x749a('0x39')]=qs[_0x749a('0x3a')](_0x3ba91f['query'][_0x749a('0x3a')]);_0x21c80a[_0x749a('0x3b')]=qs[_0x749a('0x32')](_[_0x749a('0x3c')](_0x3ba91f[_0x749a('0x34')],_0x124d5f[_0x749a('0x32')]),_0x5f2713);if(_0x3ba91f['query'][_0x749a('0x3d')]){_0x21c80a['where']=_[_0x749a('0x3e')](_0x21c80a[_0x749a('0x3b')],{'$or':_[_0x749a('0x2c')](_0x5f2713,function(_0x38cc72){if(_0x38cc72[_0x749a('0x2f')]!=='VIRTUAL'){var _0x35105a={};_0x35105a[_0x38cc72[_0x749a('0x29')]]={'$like':'%'+_0x3ba91f[_0x749a('0x34')]['filter']+'%'};return _0x35105a;}})});}_0x21c80a=_['merge']({},_0x21c80a,_0x3ba91f['options']);var _0x22fdfd={'where':_0x21c80a[_0x749a('0x3b')]};return db[_0x749a('0x3f')]['count'](_0x22fdfd)[_0x749a('0x26')](function(_0x26a4b0){_0x22fa00[_0x749a('0x1f')]=_0x26a4b0;if(_0x3ba91f[_0x749a('0x34')][_0x749a('0x40')]){_0x21c80a[_0x749a('0x41')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x749a('0x42')](_0x21c80a);})[_0x749a('0x26')](function(_0x3a4e4a){_0x22fa00['rows']=_0x3a4e4a;return _0x22fa00;})[_0x749a('0x26')](respondWithFilteredResult(_0x5bdbda,_0x21c80a))[_0x749a('0x43')](handleError(_0x5bdbda,null));};exports[_0x749a('0x44')]=function(_0x5d627a,_0xc59139){var _0x326ef8={'raw':![],'where':{'id':_0x5d627a[_0x749a('0x45')]['id']}},_0x305d03={};_0x305d03[_0x749a('0x30')]=_[_0x749a('0x31')](db[_0x749a('0x3f')][_0x749a('0x2d')]);_0x305d03[_0x749a('0x34')]=_['keys'](_0x5d627a[_0x749a('0x34')]);_0x305d03[_0x749a('0x32')]=_[_0x749a('0x33')](_0x305d03[_0x749a('0x30')],_0x305d03[_0x749a('0x34')]);_0x326ef8[_0x749a('0x35')]=_[_0x749a('0x33')](_0x305d03[_0x749a('0x30')],qs[_0x749a('0x36')](_0x5d627a[_0x749a('0x34')][_0x749a('0x36')]));_0x326ef8[_0x749a('0x35')]=_0x326ef8[_0x749a('0x35')][_0x749a('0x46')]?_0x326ef8[_0x749a('0x35')]:_0x305d03[_0x749a('0x30')];if(_0x5d627a[_0x749a('0x34')]['includeAll']){_0x326ef8['include']=[{'all':!![]}];}_0x326ef8=_['merge']({},_0x326ef8,_0x5d627a[_0x749a('0x47')]);return db[_0x749a('0x3f')]['find'](_0x326ef8)[_0x749a('0x26')](handleEntityNotFound(_0xc59139,null))[_0x749a('0x26')](respondWithResult(_0xc59139,null))[_0x749a('0x43')](handleError(_0xc59139,null));};exports[_0x749a('0x48')]=function(_0x1143e0,_0x4b2dbc){return db['ServicenowAccount'][_0x749a('0x48')](_0x1143e0[_0x749a('0x49')],{})['then'](respondWithResult(_0x4b2dbc,0xc9))[_0x749a('0x43')](handleError(_0x4b2dbc,null));};exports[_0x749a('0x25')]=function(_0x880564,_0x4ea17f){if(_0x880564[_0x749a('0x49')]['id']){delete _0x880564[_0x749a('0x49')]['id'];}return db[_0x749a('0x3f')][_0x749a('0x4a')]({'where':{'id':_0x880564[_0x749a('0x45')]['id']}})[_0x749a('0x26')](handleEntityNotFound(_0x4ea17f,null))[_0x749a('0x26')](saveUpdates(_0x880564[_0x749a('0x49')],null))[_0x749a('0x26')](respondWithResult(_0x4ea17f,null))[_0x749a('0x43')](handleError(_0x4ea17f,null));};exports['destroy']=function(_0x4be49a,_0x5b68f5){return db['ServicenowAccount'][_0x749a('0x4a')]({'where':{'id':_0x4be49a[_0x749a('0x45')]['id']}})[_0x749a('0x26')](handleEntityNotFound(_0x5b68f5,null))[_0x749a('0x26')](removeEntity(_0x5b68f5,null))['catch'](handleError(_0x5b68f5,null));};exports[_0x749a('0x4b')]=function(_0x8e5f9b,_0x763c6b,_0x10a082){var _0x4c549e={};var _0x47da89={};var _0x56d781;var _0x591719;return db[_0x749a('0x3f')]['findOne']({'where':{'id':_0x8e5f9b['params']['id']}})[_0x749a('0x26')](handleEntityNotFound(_0x763c6b,null))[_0x749a('0x26')](function(_0x4570b9){if(_0x4570b9){_0x56d781=_0x4570b9;_0x47da89['model']=_['keys'](db[_0x749a('0x4c')][_0x749a('0x2d')]);_0x47da89[_0x749a('0x34')]=_[_0x749a('0x31')](_0x8e5f9b[_0x749a('0x34')]);_0x47da89[_0x749a('0x32')]=_['intersection'](_0x47da89[_0x749a('0x30')],_0x47da89['query']);_0x4c549e[_0x749a('0x35')]=_['intersection'](_0x47da89[_0x749a('0x30')],qs[_0x749a('0x36')](_0x8e5f9b[_0x749a('0x34')][_0x749a('0x36')]));_0x4c549e['attributes']=_0x4c549e['attributes'][_0x749a('0x46')]?_0x4c549e[_0x749a('0x35')]:_0x47da89[_0x749a('0x30')];_0x4c549e[_0x749a('0x39')]=qs[_0x749a('0x3a')](_0x8e5f9b[_0x749a('0x34')][_0x749a('0x3a')]);_0x4c549e[_0x749a('0x3b')]=qs[_0x749a('0x32')](_[_0x749a('0x3c')](_0x8e5f9b['query'],_0x47da89[_0x749a('0x32')]));if(_0x8e5f9b[_0x749a('0x34')][_0x749a('0x3d')]){_0x4c549e['where']=_[_0x749a('0x3e')](_0x4c549e[_0x749a('0x3b')],{'$or':_['map'](_0x4c549e[_0x749a('0x35')],function(_0x451812){var _0x2dde40={};_0x2dde40[_0x451812]={'$like':'%'+_0x8e5f9b[_0x749a('0x34')][_0x749a('0x3d')]+'%'};return _0x2dde40;})});}_0x4c549e=_['merge']({},_0x4c549e,_0x8e5f9b[_0x749a('0x47')]);return _0x56d781[_0x749a('0x4b')](_0x4c549e);}})['then'](function(_0x3ec72d){if(_0x3ec72d){_0x591719=_0x3ec72d[_0x749a('0x46')];if(!_0x8e5f9b[_0x749a('0x34')][_0x749a('0x37')](_0x749a('0x38'))){_0x4c549e[_0x749a('0x1e')]=qs[_0x749a('0x1e')](_0x8e5f9b[_0x749a('0x34')]['limit']);_0x4c549e[_0x749a('0x1c')]=qs[_0x749a('0x1c')](_0x8e5f9b[_0x749a('0x34')][_0x749a('0x1c')]);}return _0x56d781[_0x749a('0x4b')](_0x4c549e);}})[_0x749a('0x26')](function(_0x101991){if(_0x101991){return _0x101991?{'count':_0x591719,'rows':_0x101991}:null;}})['then'](respondWithResult(_0x763c6b,null))[_0x749a('0x43')](handleError(_0x763c6b,null));};exports[_0x749a('0x4d')]=function(_0x3cb5b4,_0x4b2601,_0x1d925e){if(_0x3cb5b4['body']['id']){delete _0x3cb5b4[_0x749a('0x49')]['id'];}return db[_0x749a('0x3f')]['findOne']({'where':{'id':_0x3cb5b4['params']['id']}})[_0x749a('0x26')](handleEntityNotFound(_0x4b2601,null))['then'](function(_0x534549){if(_0x534549){_0x3cb5b4[_0x749a('0x49')][_0x749a('0x4e')]=_0x534549['id'];_0x3cb5b4[_0x749a('0x49')]['Subjects']=integrations[_0x749a('0x4f')](_0x3cb5b4[_0x749a('0x49')]['channel'],_0x3cb5b4[_0x749a('0x49')][_0x749a('0x2f')]);_0x3cb5b4[_0x749a('0x49')]['Descriptions']=integrations[_0x749a('0x50')](_0x3cb5b4[_0x749a('0x49')]['channel'],_0x3cb5b4[_0x749a('0x49')][_0x749a('0x2f')]);return db[_0x749a('0x4c')][_0x749a('0x48')](_0x3cb5b4[_0x749a('0x49')],{'include':[{'model':db[_0x749a('0x51')],'as':'Subjects'},{'model':db[_0x749a('0x51')],'as':_0x749a('0x52')}]});}return null;})[_0x749a('0x26')](respondWithResult(_0x4b2601,null))[_0x749a('0x43')](handleError(_0x4b2601,null));};exports[_0x749a('0x53')]=function(_0x1bfa75,_0x334e14,_0x480c54){var _0x389e3d=['made_sla',_0x749a('0x54'),_0x749a('0x55'),_0x749a('0x56'),_0x749a('0x57'),_0x749a('0x58'),_0x749a('0x59'),'severity',_0x749a('0x5a')];var _0x44a91c=[_0x749a('0x5b'),_0x749a('0x5c'),'caused_by',_0x749a('0x5d'),_0x749a('0x5e'),'sys_updated_on','child_incidents',_0x749a('0x54'),'approval_history',_0x749a('0x5f'),_0x749a('0x60'),_0x749a('0x61'),'opened_by',_0x749a('0x62'),_0x749a('0x63'),_0x749a('0x64'),_0x749a('0x65'),_0x749a('0x66'),_0x749a('0x55'),_0x749a('0x39'),_0x749a('0x67'),_0x749a('0x68'),_0x749a('0x69'),_0x749a('0x6a'),_0x749a('0x6b'),_0x749a('0x6c'),_0x749a('0x6d'),_0x749a('0x6e'),_0x749a('0x6f'),'sys_domain_path',_0x749a('0x70'),_0x749a('0x71'),_0x749a('0x72'),_0x749a('0x73'),'business_duration',_0x749a('0x74'),_0x749a('0x75'),'reopened_time',_0x749a('0x76'),'caller_id',_0x749a('0x77'),_0x749a('0x56'),_0x749a('0x78'),'short_description',_0x749a('0x57'),_0x749a('0x79'),_0x749a('0x7a'),_0x749a('0x7b'),'assignment_group',_0x749a('0x7c'),_0x749a('0x7d'),_0x749a('0x7e'),_0x749a('0x7f'),_0x749a('0x58'),'sys_class_name','close_notes',_0x749a('0x80'),_0x749a('0x81'),'parent_incident',_0x749a('0x82'),_0x749a('0x83'),_0x749a('0x84'),_0x749a('0x59'),_0x749a('0x85'),_0x749a('0x86'),'company',_0x749a('0x87'),_0x749a('0x88'),_0x749a('0x89'),'severity','comments',_0x749a('0x8a'),_0x749a('0x8b'),'comments_and_work_notes',_0x749a('0x8c'),_0x749a('0x8d'),_0x749a('0x8e'),_0x749a('0x8f'),_0x749a('0x90'),_0x749a('0x91'),_0x749a('0x92'),_0x749a('0x93'),'category'];var _0x374504='';var _0x5f26de='';var _0x250a0f=[];var _0x34ec2c='';var _0x59e424='';var _0x3012ea=[];var _0x348438='';var _0x3f0f15='';var _0x39e028={};var _0x34eec5='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x1bfa75[_0x749a('0x45')]['id']},'attributes':['id',_0x749a('0x94'),'password',_0x749a('0x95'),_0x749a('0x96'),'serverUrl']})['then'](handleEntityNotFound(_0x334e14,null))[_0x749a('0x26')](function(_0x542855){if(_0x542855){_0x34eec5=_0x542855['remoteUri'];var _0x2f6f75=_0x34eec5[_0x749a('0x97')](-0x1);if(_0x2f6f75==='/'){_0x34eec5=_0x34eec5[_0x749a('0x98')](0x0,_0x34eec5[_0x749a('0x99')](_0x2f6f75));}_0x3f0f15=util[_0x749a('0x9a')](_0x749a('0x9b'),_0x34eec5);_0x348438=util[_0x749a('0x9a')](_0x749a('0x9c'),_0x34eec5);_0x39e028={'user':_0x542855[_0x749a('0x94')],'pass':_0x542855[_0x749a('0x9d')]};var _0x2d5403={'method':_0x749a('0x9e'),'uri':_0x3f0f15+_0x749a('0x9f'),'auth':_0x39e028,'json':!![]};return rp(_0x2d5403);}})[_0x749a('0x26')](function(_0x3ce67b){if(_0x3ce67b[_0x749a('0xa0')][_0x749a('0x46')]>0x0){_0x374504=_0x3ce67b[_0x749a('0xa0')];}console[_0x749a('0xa1')](_0x749a('0xa2'),_0x374504);_0x3012ea=[];_0x5f26de=Object[_0x749a('0xa3')]([],_0x374504);_['remove'](_0x5f26de,function(_0x1c1f97){return!_0x389e3d['includes'](_0x1c1f97[_0x749a('0x29')]);});_0x5f26de[_0x749a('0xa4')](function(_0x4f1416){var _0x2ed2fa=createFieldObject(_0x348438,_0x39e028,_0x4f1416[_0x749a('0xa5')],_0x4f1416['name'],_0x4f1416[_0x749a('0xa6')],![]);_0x3012ea['push'](_0x2ed2fa);});return Promise[_0x749a('0xa7')](_0x3012ea);})['then'](function(_0x167049){_0x250a0f=_0x167049;_0x34ec2c=Object[_0x749a('0xa3')]([],_0x374504);console[_0x749a('0xa1')]('TCL:\x20_object',_0x374504);_[_0x749a('0xa8')](_0x34ec2c,function(_0x16e6ba){return _0x44a91c[_0x749a('0xa9')](_0x16e6ba[_0x749a('0x29')]);});console[_0x749a('0xa1')](_0x749a('0xaa'),_0x34ec2c);_0x3012ea=[];_0x34ec2c['forEach'](function(_0x48a797){var _0x38bc3c=createFieldObject(_0x348438,_0x39e028,_0x48a797[_0x749a('0xa5')],_0x48a797[_0x749a('0x29')],_0x48a797[_0x749a('0xa6')],!![]);_0x3012ea[_0x749a('0xab')](_0x38bc3c);});return Promise['all'](_0x3012ea);})[_0x749a('0x26')](function(_0x55f129){_0x59e424=_0x55f129;var _0x14eb01=_0x250a0f[_0x749a('0xac')](_0x59e424);return{'count':_0x14eb01['length'],'rows':_0x14eb01};})[_0x749a('0x26')](respondWithResult(_0x334e14,null))[_0x749a('0x43')](function(_0x421ed0){console[_0x749a('0xa1')](_0x749a('0xad')+_0x421ed0);var _0x20b5c5=_0x1bfa75[_0x749a('0x34')]['test']?0x1f4:_0x421ed0[_0x749a('0xae')]||0x1f4;logger[_0x749a('0x28')](_0x421ed0[_0x749a('0xaf')]);delete _0x421ed0[_0x749a('0x29')];if(_0x20b5c5===0x191){_0x20b5c5=0x190;}_0x334e14[_0x749a('0x1a')](_0x20b5c5)[_0x749a('0x2a')](_0x1bfa75['query'][_0x749a('0xb0')]?{'message':_0x749a('0xb1'),'statusCode':_0x421ed0[_0x749a('0xae')]}:_0x421ed0);});};function createFieldObject(_0x3559aa,_0x282152,_0xbc6961,_0x5f1a16,_0x1c488c,_0x1d6d44){return new Promise(function(_0x38336d,_0x2d333e){var _0x4228c6={'id':_0x5f1a16,'name':_0x1c488c,'custom':_0x1d6d44};if(_0xbc6961==='boolean'){_0x4228c6[_0x749a('0x47')]=[{'name':'True','value':_0x749a('0xb2')},{'name':_0x749a('0xb3'),'value':'false'}];_0x38336d(_0x4228c6);}else{var _0x2d6e99={'method':_0x749a('0x9e'),'uri':_0x3559aa+_0x749a('0xb4')+_0x5f1a16,'auth':_0x282152,'json':!![]};return rp(_0x2d6e99)['then'](function(_0x5edabf){var _0x1f4ae8=[];if(_0x5edabf[_0x749a('0xa0')][_0x749a('0x46')]>0x0){_0x5edabf[_0x749a('0xa0')][_0x749a('0xa4')](function(_0x446e3e){if(_0x446e3e[_0x749a('0xb5')]===_0x749a('0xb6')){var _0x128698={'name':_0x446e3e[_0x749a('0xa6')],'value':_0x446e3e[_0x749a('0xb7')]};_0x1f4ae8[_0x749a('0xab')](_0x128698);}});}_0x4228c6[_0x749a('0x47')]=_0x1f4ae8;if(_0x4228c6['options'][_0x749a('0x46')]>0x0){_0x38336d(_0x4228c6);}else{if(_0x1d6d44==![]){_0x38336d();}else{_0x38336d(_0x4228c6);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 9265340..fad4414 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 _0x687b=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x1e34e5,_0x1ccc4e){var _0x4c4600=function(_0x96203c){while(--_0x96203c){_0x1e34e5['push'](_0x1e34e5['shift']());}};_0x4c4600(++_0x1ccc4e);}(_0x687b,0x14a));var _0xb687=function(_0x13ae89,_0x832c38){_0x13ae89=_0x13ae89-0x0;var _0x1744a0=_0x687b[_0x13ae89];return _0x1744a0;};'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 +var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','int_servicenow_accounts','lodash'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xf494,0x1c6));var _0x4f49=function(_0x221ebf,_0x5aacde){_0x221ebf=_0x221ebf-0x0;var _0x218db2=_0xf494[_0x221ebf];return _0x218db2;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));var integrations=require(_0x4f49('0xa'));module[_0x4f49('0xb')]=function(_0x413530,_0x42b0e8){return _0x413530['define']('ServicenowAccount',attributes,{'tableName':_0x4f49('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 d7eff61..f33dd61 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 _0xda88=['code','message','result','catch','ServicenowAccount','findAll','options','where','attributes','limit','include','map','model','GetServicenowAccount','ShowServicenowAccount','raw','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0xfcdda0,_0x32479b){var _0x17ebe3=function(_0x5bfaa3){while(--_0x5bfaa3){_0xfcdda0['push'](_0xfcdda0['shift']());}};_0x17ebe3(++_0x32479b);}(_0xda88,0x128));var _0x8da8=function(_0x50dd3b,_0x48332a){_0x50dd3b=_0x50dd3b-0x0;var _0x1c0509=_0xda88[_0x50dd3b];return _0x1c0509;};'use strict';var _=require(_0x8da8('0x0'));var util=require(_0x8da8('0x1'));var moment=require(_0x8da8('0x2'));var BPromise=require('bluebird');var rs=require(_0x8da8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8da8('0x4'))['db'];var utils=require(_0x8da8('0x5'));var logger=require(_0x8da8('0x6'))(_0x8da8('0x7'));var config=require(_0x8da8('0x8'));var jayson=require(_0x8da8('0x9'));var client=jayson[_0x8da8('0xa')][_0x8da8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a5dd0,_0x1cff0b,_0x26093f){return new BPromise(function(_0x23fdd4,_0x31bea5){return client['request'](_0x5a5dd0,_0x26093f)[_0x8da8('0xc')](function(_0x3f6107){logger[_0x8da8('0xd')](_0x8da8('0xe'),_0x1cff0b,_0x8da8('0xf'));logger[_0x8da8('0x10')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x1cff0b,_0x8da8('0xf'),JSON[_0x8da8('0x11')](_0x3f6107));if(_0x3f6107[_0x8da8('0x12')]){if(_0x3f6107['error'][_0x8da8('0x13')]===0x1f4){logger[_0x8da8('0x12')](_0x8da8('0xe'),_0x1cff0b,_0x3f6107[_0x8da8('0x12')][_0x8da8('0x14')]);return _0x31bea5(_0x3f6107[_0x8da8('0x12')][_0x8da8('0x14')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x1cff0b,_0x3f6107[_0x8da8('0x12')][_0x8da8('0x14')]);return _0x23fdd4(_0x3f6107[_0x8da8('0x12')]['message']);}else{logger[_0x8da8('0xd')](_0x8da8('0xe'),_0x1cff0b,_0x8da8('0xf'));_0x23fdd4(_0x3f6107[_0x8da8('0x15')][_0x8da8('0x14')]);}})[_0x8da8('0x16')](function(_0x5d3523){logger[_0x8da8('0x12')](_0x8da8('0xe'),_0x1cff0b,_0x5d3523);_0x31bea5(_0x5d3523);});});}exports['GetServicenowAccount']=function(_0x530dba){var _0x190dc9=this;return new Promise(function(_0x40ed91,_0x4098c2){return db[_0x8da8('0x17')][_0x8da8('0x18')]({'raw':_0x530dba[_0x8da8('0x19')]?_0x530dba[_0x8da8('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x530dba[_0x8da8('0x19')]?_0x530dba['options'][_0x8da8('0x1a')]||null:null,'attributes':_0x530dba[_0x8da8('0x19')]?_0x530dba[_0x8da8('0x19')][_0x8da8('0x1b')]||null:null,'limit':_0x530dba[_0x8da8('0x19')]?_0x530dba[_0x8da8('0x19')][_0x8da8('0x1c')]||null:null,'include':_0x530dba['options']?_0x530dba[_0x8da8('0x19')][_0x8da8('0x1d')]?_[_0x8da8('0x1e')](_0x530dba[_0x8da8('0x19')][_0x8da8('0x1d')],function(_0x25babf){return{'model':db[_0x25babf['model']],'as':_0x25babf['as'],'attributes':_0x25babf[_0x8da8('0x1b')],'include':_0x25babf[_0x8da8('0x1d')]?_['map'](_0x25babf['include'],function(_0x5846cc){return{'model':db[_0x5846cc[_0x8da8('0x1f')]],'as':_0x5846cc['as'],'attributes':_0x5846cc[_0x8da8('0x1b')],'include':_0x5846cc[_0x8da8('0x1d')]?_[_0x8da8('0x1e')](_0x5846cc['include'],function(_0x4fa0d0){return{'model':db[_0x4fa0d0[_0x8da8('0x1f')]],'as':_0x4fa0d0['as'],'attributes':_0x4fa0d0['attributes']};}):[]};}):[]};}):[]:[]})[_0x8da8('0xc')](function(_0x408a5f){logger[_0x8da8('0xd')]('GetServicenowAccount',_0x530dba);logger[_0x8da8('0x10')](_0x8da8('0x20'),_0x530dba,JSON[_0x8da8('0x11')](_0x408a5f));_0x40ed91(_0x408a5f);})['catch'](function(_0x55bd01){logger[_0x8da8('0x12')](_0x8da8('0x20'),_0x55bd01[_0x8da8('0x14')],_0x530dba);_0x4098c2(_0x190dc9[_0x8da8('0x12')](0x1f4,_0x55bd01['message']));});});};exports[_0x8da8('0x21')]=function(_0x32c297){var _0x46a5a7=this;return new Promise(function(_0x382236,_0x3ec81a){return db[_0x8da8('0x17')]['find']({'raw':_0x32c297[_0x8da8('0x19')]?_0x32c297['options'][_0x8da8('0x22')]===undefined?!![]:![]:!![],'where':_0x32c297[_0x8da8('0x19')]?_0x32c297['options'][_0x8da8('0x1a')]||null:null,'attributes':_0x32c297[_0x8da8('0x19')]?_0x32c297[_0x8da8('0x19')][_0x8da8('0x1b')]||null:null,'include':_0x32c297[_0x8da8('0x19')]?_0x32c297[_0x8da8('0x19')]['include']?_[_0x8da8('0x1e')](_0x32c297[_0x8da8('0x19')]['include'],function(_0x47a219){return{'model':db[_0x47a219[_0x8da8('0x1f')]],'as':_0x47a219['as'],'attributes':_0x47a219['attributes'],'include':_0x47a219[_0x8da8('0x1d')]?_[_0x8da8('0x1e')](_0x47a219[_0x8da8('0x1d')],function(_0x5ca909){return{'model':db[_0x5ca909[_0x8da8('0x1f')]],'as':_0x5ca909['as'],'attributes':_0x5ca909['attributes'],'include':_0x5ca909[_0x8da8('0x1d')]?_[_0x8da8('0x1e')](_0x5ca909[_0x8da8('0x1d')],function(_0x4ca6b4){return{'model':db[_0x4ca6b4['model']],'as':_0x4ca6b4['as'],'attributes':_0x4ca6b4[_0x8da8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8da8('0xc')](function(_0x1e7a11){logger[_0x8da8('0xd')](_0x8da8('0x21'),_0x32c297);logger[_0x8da8('0x10')](_0x8da8('0x21'),_0x32c297,JSON[_0x8da8('0x11')](_0x1e7a11));_0x382236(_0x1e7a11);})[_0x8da8('0x16')](function(_0x5ab38a){logger['error'](_0x8da8('0x21'),_0x5ab38a['message'],_0x32c297);_0x3ec81a(_0x46a5a7['error'](0x1f4,_0x5ab38a[_0x8da8('0x14')]));});});}; \ No newline at end of file +var _0xb3b1=['code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','info','debug','ShowServicenowAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x23b6ec,_0xcc10d4){var _0x1cebf8=function(_0x258452){while(--_0x258452){_0x23b6ec['push'](_0x23b6ec['shift']());}};_0x1cebf8(++_0xcc10d4);}(_0xb3b1,0x11e));var _0x1b3b=function(_0x1d3726,_0x35fa25){_0x1d3726=_0x1d3726-0x0;var _0x42d965=_0xb3b1[_0x1d3726];return _0x42d965;};'use strict';var _=require(_0x1b3b('0x0'));var util=require(_0x1b3b('0x1'));var moment=require(_0x1b3b('0x2'));var BPromise=require(_0x1b3b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b3b('0x4'));var db=require(_0x1b3b('0x5'))['db'];var utils=require(_0x1b3b('0x6'));var logger=require(_0x1b3b('0x7'))(_0x1b3b('0x8'));var config=require('../../config/environment');var jayson=require(_0x1b3b('0x9'));var client=jayson[_0x1b3b('0xa')][_0x1b3b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f221b,_0x2eda76,_0x175645){return new BPromise(function(_0x24f9bc,_0x2601e5){return client[_0x1b3b('0xc')](_0x3f221b,_0x175645)[_0x1b3b('0xd')](function(_0xd07eaa){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x2eda76,_0x1b3b('0xe'));logger['debug'](_0x1b3b('0xf'),_0x2eda76,_0x1b3b('0xe'),JSON[_0x1b3b('0x10')](_0xd07eaa));if(_0xd07eaa[_0x1b3b('0x11')]){if(_0xd07eaa[_0x1b3b('0x11')][_0x1b3b('0x12')]===0x1f4){logger[_0x1b3b('0x11')](_0x1b3b('0x13'),_0x2eda76,_0xd07eaa['error'][_0x1b3b('0x14')]);return _0x2601e5(_0xd07eaa[_0x1b3b('0x11')]['message']);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x2eda76,_0xd07eaa[_0x1b3b('0x11')][_0x1b3b('0x14')]);return _0x24f9bc(_0xd07eaa['error'][_0x1b3b('0x14')]);}else{logger['info'](_0x1b3b('0x13'),_0x2eda76,_0x1b3b('0xe'));_0x24f9bc(_0xd07eaa[_0x1b3b('0x15')][_0x1b3b('0x14')]);}})[_0x1b3b('0x16')](function(_0x3c1c81){logger[_0x1b3b('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x2eda76,_0x3c1c81);_0x2601e5(_0x3c1c81);});});}exports[_0x1b3b('0x17')]=function(_0x351a84){var _0x22b5e2=this;return new Promise(function(_0x44af86,_0x27b6d2){return db[_0x1b3b('0x18')][_0x1b3b('0x19')]({'raw':_0x351a84[_0x1b3b('0x1a')]?_0x351a84['options'][_0x1b3b('0x1b')]===undefined?!![]:![]:!![],'where':_0x351a84['options']?_0x351a84[_0x1b3b('0x1a')][_0x1b3b('0x1c')]||null:null,'attributes':_0x351a84[_0x1b3b('0x1a')]?_0x351a84[_0x1b3b('0x1a')][_0x1b3b('0x1d')]||null:null,'limit':_0x351a84[_0x1b3b('0x1a')]?_0x351a84[_0x1b3b('0x1a')][_0x1b3b('0x1e')]||null:null,'include':_0x351a84[_0x1b3b('0x1a')]?_0x351a84[_0x1b3b('0x1a')][_0x1b3b('0x1f')]?_[_0x1b3b('0x20')](_0x351a84[_0x1b3b('0x1a')][_0x1b3b('0x1f')],function(_0x208850){return{'model':db[_0x208850['model']],'as':_0x208850['as'],'attributes':_0x208850[_0x1b3b('0x1d')],'include':_0x208850[_0x1b3b('0x1f')]?_['map'](_0x208850[_0x1b3b('0x1f')],function(_0x26b8a0){return{'model':db[_0x26b8a0[_0x1b3b('0x21')]],'as':_0x26b8a0['as'],'attributes':_0x26b8a0['attributes'],'include':_0x26b8a0[_0x1b3b('0x1f')]?_[_0x1b3b('0x20')](_0x26b8a0[_0x1b3b('0x1f')],function(_0x5cbae8){return{'model':db[_0x5cbae8[_0x1b3b('0x21')]],'as':_0x5cbae8['as'],'attributes':_0x5cbae8[_0x1b3b('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ebaeb){logger[_0x1b3b('0x22')]('GetServicenowAccount',_0x351a84);logger[_0x1b3b('0x23')](_0x1b3b('0x17'),_0x351a84,JSON[_0x1b3b('0x10')](_0x4ebaeb));_0x44af86(_0x4ebaeb);})['catch'](function(_0x33f9ff){logger[_0x1b3b('0x11')](_0x1b3b('0x17'),_0x33f9ff['message'],_0x351a84);_0x27b6d2(_0x22b5e2[_0x1b3b('0x11')](0x1f4,_0x33f9ff[_0x1b3b('0x14')]));});});};exports[_0x1b3b('0x24')]=function(_0x210086){var _0x237b21=this;return new Promise(function(_0x56052f,_0x115432){return db[_0x1b3b('0x18')][_0x1b3b('0x25')]({'raw':_0x210086['options']?_0x210086[_0x1b3b('0x1a')][_0x1b3b('0x1b')]===undefined?!![]:![]:!![],'where':_0x210086[_0x1b3b('0x1a')]?_0x210086[_0x1b3b('0x1a')][_0x1b3b('0x1c')]||null:null,'attributes':_0x210086[_0x1b3b('0x1a')]?_0x210086[_0x1b3b('0x1a')]['attributes']||null:null,'include':_0x210086[_0x1b3b('0x1a')]?_0x210086[_0x1b3b('0x1a')]['include']?_['map'](_0x210086[_0x1b3b('0x1a')][_0x1b3b('0x1f')],function(_0x453f6e){return{'model':db[_0x453f6e['model']],'as':_0x453f6e['as'],'attributes':_0x453f6e['attributes'],'include':_0x453f6e[_0x1b3b('0x1f')]?_['map'](_0x453f6e['include'],function(_0x1f5d1d){return{'model':db[_0x1f5d1d[_0x1b3b('0x21')]],'as':_0x1f5d1d['as'],'attributes':_0x1f5d1d[_0x1b3b('0x1d')],'include':_0x1f5d1d[_0x1b3b('0x1f')]?_[_0x1b3b('0x20')](_0x1f5d1d[_0x1b3b('0x1f')],function(_0x5a4ceb){return{'model':db[_0x5a4ceb[_0x1b3b('0x21')]],'as':_0x5a4ceb['as'],'attributes':_0x5a4ceb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xaf6f50){logger[_0x1b3b('0x22')](_0x1b3b('0x24'),_0x210086);logger['debug'](_0x1b3b('0x24'),_0x210086,JSON['stringify'](_0xaf6f50));_0x56052f(_0xaf6f50);})[_0x1b3b('0x16')](function(_0x334259){logger['error'](_0x1b3b('0x24'),_0x334259[_0x1b3b('0x14')],_0x210086);_0x115432(_0x237b21[_0x1b3b('0x11')](0x1f4,_0x334259[_0x1b3b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index d161393..0da02a2 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 _0xea03=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id/fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xea03,0x180));var _0x3ea0=function(_0x34eb0d,_0x43448b){_0x34eb0d=_0x34eb0d-0x0;var _0x309bb3=_0xea03[_0x34eb0d];return _0x309bb3;};'use strict';var multer=require(_0x3ea0('0x0'));var util=require(_0x3ea0('0x1'));var path=require(_0x3ea0('0x2'));var timeout=require(_0x3ea0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3ea0('0x4'));var auth=require(_0x3ea0('0x5'));var interaction=require(_0x3ea0('0x6'));var config=require(_0x3ea0('0x7'));var controller=require(_0x3ea0('0x8'));router[_0x3ea0('0x9')]('/',auth[_0x3ea0('0xa')](),controller['index']);router[_0x3ea0('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3ea0('0x9')](_0x3ea0('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x3ea0('0x9')](_0x3ea0('0xc'),auth[_0x3ea0('0xa')](),controller[_0x3ea0('0xd')]);router['get'](_0x3ea0('0xe'),auth[_0x3ea0('0xa')](),controller[_0x3ea0('0xf')]);router[_0x3ea0('0x10')]('/',auth[_0x3ea0('0xa')](),controller[_0x3ea0('0x11')]);router['put'](_0x3ea0('0x12'),auth[_0x3ea0('0xa')](),controller['update']);router[_0x3ea0('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x3ea0('0x14')]);module[_0x3ea0('0x15')]=router; \ No newline at end of file +var _0x883f=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index'];(function(_0xf4d6a9,_0x2b1366){var _0x49923c=function(_0x3b01a4){while(--_0x3b01a4){_0xf4d6a9['push'](_0xf4d6a9['shift']());}};_0x49923c(++_0x2b1366);}(_0x883f,0x1b6));var _0xf883=function(_0x4d8fe4,_0x5c443c){_0x4d8fe4=_0x4d8fe4-0x0;var _0x392229=_0x883f[_0x4d8fe4];return _0x392229;};'use strict';var multer=require(_0xf883('0x0'));var util=require(_0xf883('0x1'));var path=require(_0xf883('0x2'));var timeout=require(_0xf883('0x3'));var express=require('express');var router=express[_0xf883('0x4')]();var fs_extra=require(_0xf883('0x5'));var auth=require(_0xf883('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf883('0x7'));var controller=require(_0xf883('0x8'));router[_0xf883('0x9')]('/',auth[_0xf883('0xa')](),controller[_0xf883('0xb')]);router['get']('/:id',auth[_0xf883('0xa')](),controller[_0xf883('0xc')]);router[_0xf883('0x9')](_0xf883('0xd'),auth[_0xf883('0xa')](),controller[_0xf883('0xe')]);router[_0xf883('0x9')]('/:id/subjects',auth[_0xf883('0xa')](),controller[_0xf883('0xf')]);router['get'](_0xf883('0x10'),auth['isAuthenticated'](),controller[_0xf883('0x11')]);router[_0xf883('0x12')]('/',auth[_0xf883('0xa')](),controller[_0xf883('0x13')]);router['put'](_0xf883('0x14'),auth[_0xf883('0xa')](),controller[_0xf883('0x15')]);router[_0xf883('0x16')](_0xf883('0x14'),auth[_0xf883('0xa')](),controller[_0xf883('0x17')]);module[_0xf883('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 448ccd4..305c9f1 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 _0x9309=['STRING','exports'];(function(_0x2e6cb7,_0x11596c){var _0x433ba0=function(_0x13d362){while(--_0x13d362){_0x2e6cb7['push'](_0x2e6cb7['shift']());}};_0x433ba0(++_0x11596c);}(_0x9309,0x17f));var _0x9930=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9309[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x9930('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9930('0x1')]}}; \ No newline at end of file +var _0x61c7=['exports','STRING'];(function(_0x4ea4ef,_0x2dbc4f){var _0x3c60c4=function(_0x363c22){while(--_0x363c22){_0x4ea4ef['push'](_0x4ea4ef['shift']());}};_0x3c60c4(++_0x2dbc4f);}(_0x61c7,0x14a));var _0x761c=function(_0x16c964,_0x229d1b){_0x16c964=_0x16c964-0x0;var _0x11cd1e=_0x61c7[_0x16c964];return _0x11cd1e;};'use strict';var Sequelize=require('sequelize');module[_0x761c('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x761c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 4590069..2b4247d 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 _0x340d=['bluebird','mustache','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','../../config/logger','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','destroy','then','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','findAll','rows','show','params','includeAll','include','options','find','catch','body','update','findOne','pick','getFields','getSubjects','ServicenowField','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x340d,0x191));var _0xd340=function(_0x34535d,_0xa306ee){_0x34535d=_0x34535d-0x0;var _0x59af24=_0x340d[_0x34535d];return _0x59af24;};'use strict';var emlformat=require(_0xd340('0x0'));var rimraf=require(_0xd340('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd340('0x2'));var rp=require(_0xd340('0x3'));var moment=require('moment');var BPromise=require(_0xd340('0x4'));var Mustache=require(_0xd340('0x5'));var util=require(_0xd340('0x6'));var path=require(_0xd340('0x7'));var sox=require(_0xd340('0x8'));var csv=require(_0xd340('0x9'));var ejs=require(_0xd340('0xa'));var fs=require('fs');var fs_extra=require(_0xd340('0xb'));var _=require(_0xd340('0xc'));var squel=require(_0xd340('0xd'));var crypto=require(_0xd340('0xe'));var jsforce=require(_0xd340('0xf'));var deskjs=require(_0xd340('0x10'));var toCsv=require(_0xd340('0x9'));var querystring=require(_0xd340('0x11'));var Papa=require('papaparse');var Redis=require(_0xd340('0x12'));var authService=require(_0xd340('0x13'));var qs=require(_0xd340('0x14'));var as=require(_0xd340('0x15'));var hardwareService=require(_0xd340('0x16'));var logger=require(_0xd340('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd340('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28ade5,_0x235f8d){_0x235f8d=_0x235f8d||0xcc;return function(_0x91b889){if(_0x91b889){return _0x28ade5[_0xd340('0x19')](_0x235f8d);}return _0x28ade5[_0xd340('0x1a')](_0x235f8d)[_0xd340('0x1b')]();};}function respondWithResult(_0x1016a1,_0xbd5a9a){_0xbd5a9a=_0xbd5a9a||0xc8;return function(_0x4d7971){if(_0x4d7971){return _0x1016a1[_0xd340('0x1a')](_0xbd5a9a)['json'](_0x4d7971);}};}function respondWithFilteredResult(_0x449a81,_0x30cb73){return function(_0x20d10f){if(_0x20d10f){var _0x206e70=typeof _0x30cb73[_0xd340('0x1c')]===_0xd340('0x1d')&&typeof _0x30cb73[_0xd340('0x1e')]===_0xd340('0x1d');var _0x1b5056=_0x20d10f[_0xd340('0x1f')];var _0x1b2500=_0x206e70?0x0:_0x30cb73['offset'];var _0x5c985c=_0x206e70?_0x20d10f[_0xd340('0x1f')]:_0x30cb73[_0xd340('0x1c')]+_0x30cb73[_0xd340('0x1e')];var _0x1c8609;if(_0x5c985c>=_0x1b5056){_0x5c985c=_0x1b5056;_0x1c8609=0xc8;}else{_0x1c8609=0xce;}_0x449a81[_0xd340('0x1a')](_0x1c8609);return _0x449a81['set'](_0xd340('0x20'),_0x1b2500+'-'+_0x5c985c+'/'+_0x1b5056)[_0xd340('0x21')](_0x20d10f);}return null;};}function patchUpdates(_0x4e5d21){return function(_0x43a9dc){try{jsonpatch[_0xd340('0x22')](_0x43a9dc,_0x4e5d21,!![]);}catch(_0x5e126d){return BPromise['reject'](_0x5e126d);}return _0x43a9dc['save']();};}function saveUpdates(_0x39c8b0,_0x220a21){return function(_0x1f8a43){if(_0x1f8a43){return _0x1f8a43['update'](_0x39c8b0)['then'](function(_0x5488c0){return _0x5488c0;});}return null;};}function removeEntity(_0x54f052,_0x3b4672){return function(_0x2f3409){if(_0x2f3409){return _0x2f3409[_0xd340('0x23')]()[_0xd340('0x24')](function(){_0x54f052[_0xd340('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43b3c8,_0x32387a){return function(_0x31f42f){if(!_0x31f42f){_0x43b3c8[_0xd340('0x19')](0x194);}return _0x31f42f;};}function handleError(_0x2936b4,_0x4224fb){_0x4224fb=_0x4224fb||0x1f4;return function(_0x1b2b23){logger[_0xd340('0x25')](_0x1b2b23[_0xd340('0x26')]);if(_0x1b2b23[_0xd340('0x27')]){delete _0x1b2b23[_0xd340('0x27')];}_0x2936b4[_0xd340('0x1a')](_0x4224fb)[_0xd340('0x28')](_0x1b2b23);};}exports[_0xd340('0x29')]=function(_0x4ce3d8,_0x555c67){var _0xbf7c12={},_0x144778={},_0x3f30fb={'count':0x0,'rows':[]};var _0x18a396=_[_0xd340('0x2a')](db[_0xd340('0x2b')][_0xd340('0x2c')],function(_0x493625){return{'name':_0x493625[_0xd340('0x2d')],'type':_0x493625[_0xd340('0x2e')][_0xd340('0x2f')]};});_0x144778[_0xd340('0x30')]=_[_0xd340('0x2a')](_0x18a396,_0xd340('0x27'));_0x144778[_0xd340('0x31')]=_[_0xd340('0x32')](_0x4ce3d8[_0xd340('0x31')]);_0x144778[_0xd340('0x33')]=_[_0xd340('0x34')](_0x144778[_0xd340('0x30')],_0x144778[_0xd340('0x31')]);_0xbf7c12[_0xd340('0x35')]=_[_0xd340('0x34')](_0x144778[_0xd340('0x30')],qs[_0xd340('0x36')](_0x4ce3d8['query'][_0xd340('0x36')]));_0xbf7c12[_0xd340('0x35')]=_0xbf7c12['attributes'][_0xd340('0x37')]?_0xbf7c12[_0xd340('0x35')]:_0x144778[_0xd340('0x30')];if(!_0x4ce3d8[_0xd340('0x31')][_0xd340('0x38')](_0xd340('0x39'))){_0xbf7c12[_0xd340('0x1e')]=qs[_0xd340('0x1e')](_0x4ce3d8[_0xd340('0x31')][_0xd340('0x1e')]);_0xbf7c12[_0xd340('0x1c')]=qs['offset'](_0x4ce3d8[_0xd340('0x31')][_0xd340('0x1c')]);}_0xbf7c12[_0xd340('0x3a')]=qs[_0xd340('0x3b')](_0x4ce3d8[_0xd340('0x31')][_0xd340('0x3b')]);_0xbf7c12[_0xd340('0x3c')]=qs[_0xd340('0x33')](_['pick'](_0x4ce3d8['query'],_0x144778[_0xd340('0x33')]),_0x18a396);if(_0x4ce3d8[_0xd340('0x31')]['filter']){_0xbf7c12[_0xd340('0x3c')]=_[_0xd340('0x3d')](_0xbf7c12[_0xd340('0x3c')],{'$or':_[_0xd340('0x2a')](_0x18a396,function(_0x23f810){if(_0x23f810[_0xd340('0x2e')]!==_0xd340('0x3e')){var _0x217114={};_0x217114[_0x23f810[_0xd340('0x27')]]={'$like':'%'+_0x4ce3d8[_0xd340('0x31')][_0xd340('0x3f')]+'%'};return _0x217114;}})});}_0xbf7c12=_[_0xd340('0x3d')]({},_0xbf7c12,_0x4ce3d8['options']);var _0x2f83d9={'where':_0xbf7c12['where']};return db['ServicenowConfiguration'][_0xd340('0x1f')](_0x2f83d9)[_0xd340('0x24')](function(_0x432e22){_0x3f30fb[_0xd340('0x1f')]=_0x432e22;if(_0x4ce3d8[_0xd340('0x31')]['includeAll']){_0xbf7c12['include']=[{'all':!![]}];}return db[_0xd340('0x2b')][_0xd340('0x40')](_0xbf7c12);})['then'](function(_0x494406){_0x3f30fb[_0xd340('0x41')]=_0x494406;return _0x3f30fb;})['then'](respondWithFilteredResult(_0x555c67,_0xbf7c12))['catch'](handleError(_0x555c67,null));};exports[_0xd340('0x42')]=function(_0x336025,_0x4a2fb8){var _0x56d559={'raw':![],'where':{'id':_0x336025[_0xd340('0x43')]['id']}},_0x1d6485={};_0x1d6485[_0xd340('0x30')]=_[_0xd340('0x32')](db[_0xd340('0x2b')][_0xd340('0x2c')]);_0x1d6485[_0xd340('0x31')]=_[_0xd340('0x32')](_0x336025['query']);_0x1d6485[_0xd340('0x33')]=_['intersection'](_0x1d6485[_0xd340('0x30')],_0x1d6485[_0xd340('0x31')]);_0x56d559['attributes']=_[_0xd340('0x34')](_0x1d6485[_0xd340('0x30')],qs[_0xd340('0x36')](_0x336025['query'][_0xd340('0x36')]));_0x56d559[_0xd340('0x35')]=_0x56d559[_0xd340('0x35')][_0xd340('0x37')]?_0x56d559[_0xd340('0x35')]:_0x1d6485[_0xd340('0x30')];if(_0x336025[_0xd340('0x31')][_0xd340('0x44')]){_0x56d559[_0xd340('0x45')]=[{'all':!![]}];}_0x56d559=_[_0xd340('0x3d')]({},_0x56d559,_0x336025[_0xd340('0x46')]);return db[_0xd340('0x2b')][_0xd340('0x47')](_0x56d559)[_0xd340('0x24')](handleEntityNotFound(_0x4a2fb8,null))[_0xd340('0x24')](respondWithResult(_0x4a2fb8,null))[_0xd340('0x48')](handleError(_0x4a2fb8,null));};exports['create']=function(_0x5b51bf,_0x12671d){return db[_0xd340('0x2b')]['create'](_0x5b51bf[_0xd340('0x49')],{})[_0xd340('0x24')](respondWithResult(_0x12671d,0xc9))['catch'](handleError(_0x12671d,null));};exports[_0xd340('0x4a')]=function(_0x1b1583,_0x51955c){if(_0x1b1583['body']['id']){delete _0x1b1583['body']['id'];}return db[_0xd340('0x2b')][_0xd340('0x47')]({'where':{'id':_0x1b1583['params']['id']}})['then'](handleEntityNotFound(_0x51955c,null))[_0xd340('0x24')](saveUpdates(_0x1b1583['body'],null))[_0xd340('0x24')](respondWithResult(_0x51955c,null))[_0xd340('0x48')](handleError(_0x51955c,null));};exports['destroy']=function(_0x1f7b7f,_0x19ffa3){return db[_0xd340('0x2b')][_0xd340('0x47')]({'where':{'id':_0x1f7b7f[_0xd340('0x43')]['id']}})['then'](handleEntityNotFound(_0x19ffa3,null))[_0xd340('0x24')](removeEntity(_0x19ffa3,null))[_0xd340('0x48')](handleError(_0x19ffa3,null));};exports['getFields']=function(_0x35dd97,_0x4212c1,_0x55dc8e){var _0x57531f={};var _0x49a4e5={};var _0x5ae5d3;var _0x47ff62;return db['ServicenowConfiguration'][_0xd340('0x4b')]({'where':{'id':_0x35dd97[_0xd340('0x43')]['id']}})[_0xd340('0x24')](handleEntityNotFound(_0x4212c1,null))['then'](function(_0x29c77a){if(_0x29c77a){_0x5ae5d3=_0x29c77a;_0x49a4e5['model']=_[_0xd340('0x32')](db['ServicenowField']['rawAttributes']);_0x49a4e5[_0xd340('0x31')]=_[_0xd340('0x32')](_0x35dd97['query']);_0x49a4e5['filters']=_[_0xd340('0x34')](_0x49a4e5[_0xd340('0x30')],_0x49a4e5[_0xd340('0x31')]);_0x57531f[_0xd340('0x35')]=_[_0xd340('0x34')](_0x49a4e5[_0xd340('0x30')],qs[_0xd340('0x36')](_0x35dd97['query'][_0xd340('0x36')]));_0x57531f[_0xd340('0x35')]=_0x57531f[_0xd340('0x35')]['length']?_0x57531f['attributes']:_0x49a4e5[_0xd340('0x30')];_0x57531f[_0xd340('0x3a')]=qs[_0xd340('0x3b')](_0x35dd97['query'][_0xd340('0x3b')]);_0x57531f['where']=qs[_0xd340('0x33')](_[_0xd340('0x4c')](_0x35dd97[_0xd340('0x31')],_0x49a4e5[_0xd340('0x33')]));if(_0x35dd97['query']['filter']){_0x57531f['where']=_[_0xd340('0x3d')](_0x57531f[_0xd340('0x3c')],{'$or':_[_0xd340('0x2a')](_0x57531f[_0xd340('0x35')],function(_0x3135ae){var _0x48deb3={};_0x48deb3[_0x3135ae]={'$like':'%'+_0x35dd97[_0xd340('0x31')][_0xd340('0x3f')]+'%'};return _0x48deb3;})});}_0x57531f=_[_0xd340('0x3d')]({},_0x57531f,_0x35dd97['options']);return _0x5ae5d3[_0xd340('0x4d')](_0x57531f);}})[_0xd340('0x24')](function(_0x3241f4){if(_0x3241f4){_0x47ff62=_0x3241f4[_0xd340('0x37')];if(!_0x35dd97[_0xd340('0x31')]['hasOwnProperty'](_0xd340('0x39'))){_0x57531f[_0xd340('0x1e')]=qs[_0xd340('0x1e')](_0x35dd97[_0xd340('0x31')][_0xd340('0x1e')]);_0x57531f[_0xd340('0x1c')]=qs[_0xd340('0x1c')](_0x35dd97[_0xd340('0x31')][_0xd340('0x1c')]);}return _0x5ae5d3[_0xd340('0x4d')](_0x57531f);}})['then'](function(_0x4d4aaa){if(_0x4d4aaa){return _0x4d4aaa?{'count':_0x47ff62,'rows':_0x4d4aaa}:null;}})[_0xd340('0x24')](respondWithResult(_0x4212c1,null))[_0xd340('0x48')](handleError(_0x4212c1,null));};exports[_0xd340('0x4e')]=function(_0x4ddce4,_0x43b23d,_0x4561f7){var _0x272e36={};var _0x172356={};var _0x819825;var _0x435a95;return db['ServicenowConfiguration'][_0xd340('0x4b')]({'where':{'id':_0x4ddce4['params']['id']}})[_0xd340('0x24')](handleEntityNotFound(_0x43b23d,null))[_0xd340('0x24')](function(_0x2031c1){if(_0x2031c1){_0x819825=_0x2031c1;_0x172356[_0xd340('0x30')]=_[_0xd340('0x32')](db[_0xd340('0x4f')][_0xd340('0x2c')]);_0x172356[_0xd340('0x31')]=_[_0xd340('0x32')](_0x4ddce4[_0xd340('0x31')]);_0x172356['filters']=_['intersection'](_0x172356[_0xd340('0x30')],_0x172356[_0xd340('0x31')]);_0x272e36['attributes']=_['intersection'](_0x172356[_0xd340('0x30')],qs[_0xd340('0x36')](_0x4ddce4[_0xd340('0x31')][_0xd340('0x36')]));_0x272e36['attributes']=_0x272e36[_0xd340('0x35')][_0xd340('0x37')]?_0x272e36[_0xd340('0x35')]:_0x172356[_0xd340('0x30')];_0x272e36['order']=qs[_0xd340('0x3b')](_0x4ddce4[_0xd340('0x31')][_0xd340('0x3b')]);_0x272e36['where']=qs[_0xd340('0x33')](_[_0xd340('0x4c')](_0x4ddce4[_0xd340('0x31')],_0x172356[_0xd340('0x33')]));if(_0x4ddce4[_0xd340('0x31')][_0xd340('0x3f')]){_0x272e36[_0xd340('0x3c')]=_[_0xd340('0x3d')](_0x272e36[_0xd340('0x3c')],{'$or':_[_0xd340('0x2a')](_0x272e36[_0xd340('0x35')],function(_0x254f56){var _0x29ba4e={};_0x29ba4e[_0x254f56]={'$like':'%'+_0x4ddce4[_0xd340('0x31')]['filter']+'%'};return _0x29ba4e;})});}_0x272e36=_['merge']({},_0x272e36,_0x4ddce4['options']);return _0x819825[_0xd340('0x4e')](_0x272e36);}})[_0xd340('0x24')](function(_0x2cbee9){if(_0x2cbee9){_0x435a95=_0x2cbee9[_0xd340('0x37')];if(!_0x4ddce4[_0xd340('0x31')][_0xd340('0x38')](_0xd340('0x39'))){_0x272e36[_0xd340('0x1e')]=qs[_0xd340('0x1e')](_0x4ddce4['query'][_0xd340('0x1e')]);_0x272e36[_0xd340('0x1c')]=qs[_0xd340('0x1c')](_0x4ddce4['query'][_0xd340('0x1c')]);}return _0x819825['getSubjects'](_0x272e36);}})[_0xd340('0x24')](function(_0x3970f8){if(_0x3970f8){return _0x3970f8?{'count':_0x435a95,'rows':_0x3970f8}:null;}})[_0xd340('0x24')](respondWithResult(_0x43b23d,null))[_0xd340('0x48')](handleError(_0x43b23d,null));};exports[_0xd340('0x50')]=function(_0x10d344,_0xa202bf,_0x551695){var _0x1c85e4={};var _0xa82451={};var _0x509f66;var _0x35e55f;return db[_0xd340('0x2b')][_0xd340('0x4b')]({'where':{'id':_0x10d344[_0xd340('0x43')]['id']}})[_0xd340('0x24')](handleEntityNotFound(_0xa202bf,null))[_0xd340('0x24')](function(_0x4fd77a){if(_0x4fd77a){_0x509f66=_0x4fd77a;_0xa82451[_0xd340('0x30')]=_[_0xd340('0x32')](db[_0xd340('0x4f')][_0xd340('0x2c')]);_0xa82451[_0xd340('0x31')]=_[_0xd340('0x32')](_0x10d344['query']);_0xa82451[_0xd340('0x33')]=_['intersection'](_0xa82451[_0xd340('0x30')],_0xa82451['query']);_0x1c85e4['attributes']=_[_0xd340('0x34')](_0xa82451[_0xd340('0x30')],qs[_0xd340('0x36')](_0x10d344[_0xd340('0x31')]['fields']));_0x1c85e4['attributes']=_0x1c85e4['attributes'][_0xd340('0x37')]?_0x1c85e4[_0xd340('0x35')]:_0xa82451[_0xd340('0x30')];_0x1c85e4[_0xd340('0x3a')]=qs[_0xd340('0x3b')](_0x10d344['query']['sort']);_0x1c85e4[_0xd340('0x3c')]=qs[_0xd340('0x33')](_['pick'](_0x10d344['query'],_0xa82451[_0xd340('0x33')]));if(_0x10d344[_0xd340('0x31')][_0xd340('0x3f')]){_0x1c85e4[_0xd340('0x3c')]=_[_0xd340('0x3d')](_0x1c85e4[_0xd340('0x3c')],{'$or':_[_0xd340('0x2a')](_0x1c85e4[_0xd340('0x35')],function(_0x1cc64f){var _0x3e4f61={};_0x3e4f61[_0x1cc64f]={'$like':'%'+_0x10d344[_0xd340('0x31')]['filter']+'%'};return _0x3e4f61;})});}_0x1c85e4=_[_0xd340('0x3d')]({},_0x1c85e4,_0x10d344['options']);return _0x509f66[_0xd340('0x50')](_0x1c85e4);}})['then'](function(_0x460ba2){if(_0x460ba2){_0x35e55f=_0x460ba2['length'];if(!_0x10d344[_0xd340('0x31')][_0xd340('0x38')](_0xd340('0x39'))){_0x1c85e4[_0xd340('0x1e')]=qs[_0xd340('0x1e')](_0x10d344[_0xd340('0x31')]['limit']);_0x1c85e4['offset']=qs['offset'](_0x10d344['query'][_0xd340('0x1c')]);}return _0x509f66[_0xd340('0x50')](_0x1c85e4);}})[_0xd340('0x24')](function(_0x32e50e){if(_0x32e50e){return _0x32e50e?{'count':_0x35e55f,'rows':_0x32e50e}:null;}})[_0xd340('0x24')](respondWithResult(_0xa202bf,null))[_0xd340('0x48')](handleError(_0xa202bf,null));}; \ No newline at end of file +var _0xb6a7=['send','index','map','ServicenowConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','show','params','catch','create','body','find','findOne','ServicenowField','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','status','stack','name'];(function(_0x2f82eb,_0x9fa9f6){var _0x19fbdb=function(_0x24d309){while(--_0x24d309){_0x2f82eb['push'](_0x2f82eb['shift']());}};_0x19fbdb(++_0x9fa9f6);}(_0xb6a7,0x117));var _0x7b6a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb6a7[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x7b6a('0x0'));var rimraf=require(_0x7b6a('0x1'));var zipdir=require(_0x7b6a('0x2'));var jsonpatch=require(_0x7b6a('0x3'));var rp=require(_0x7b6a('0x4'));var moment=require(_0x7b6a('0x5'));var BPromise=require(_0x7b6a('0x6'));var Mustache=require(_0x7b6a('0x7'));var util=require(_0x7b6a('0x8'));var path=require(_0x7b6a('0x9'));var sox=require('sox');var csv=require(_0x7b6a('0xa'));var ejs=require(_0x7b6a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7b6a('0xc'));var crypto=require(_0x7b6a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7b6a('0xe'));var toCsv=require(_0x7b6a('0xa'));var querystring=require(_0x7b6a('0xf'));var Papa=require(_0x7b6a('0x10'));var Redis=require(_0x7b6a('0x11'));var authService=require(_0x7b6a('0x12'));var qs=require(_0x7b6a('0x13'));var as=require(_0x7b6a('0x14'));var hardwareService=require(_0x7b6a('0x15'));var logger=require(_0x7b6a('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7b6a('0x17'))['db'];function respondWithStatusCode(_0x1d591d,_0x4201e4){_0x4201e4=_0x4201e4||0xcc;return function(_0x4767a6){if(_0x4767a6){return _0x1d591d[_0x7b6a('0x18')](_0x4201e4);}return _0x1d591d['status'](_0x4201e4)['end']();};}function respondWithResult(_0x5f419d,_0xc51432){_0xc51432=_0xc51432||0xc8;return function(_0x214045){if(_0x214045){return _0x5f419d['status'](_0xc51432)['json'](_0x214045);}};}function respondWithFilteredResult(_0x4736b3,_0x4c6153){return function(_0x1f9e22){if(_0x1f9e22){var _0x1d5c81=typeof _0x4c6153[_0x7b6a('0x19')]===_0x7b6a('0x1a')&&typeof _0x4c6153[_0x7b6a('0x1b')]===_0x7b6a('0x1a');var _0x38c69d=_0x1f9e22[_0x7b6a('0x1c')];var _0x51fc13=_0x1d5c81?0x0:_0x4c6153[_0x7b6a('0x19')];var _0x14d936=_0x1d5c81?_0x1f9e22[_0x7b6a('0x1c')]:_0x4c6153[_0x7b6a('0x19')]+_0x4c6153[_0x7b6a('0x1b')];var _0x3baa53;if(_0x14d936>=_0x38c69d){_0x14d936=_0x38c69d;_0x3baa53=0xc8;}else{_0x3baa53=0xce;}_0x4736b3['status'](_0x3baa53);return _0x4736b3[_0x7b6a('0x1d')](_0x7b6a('0x1e'),_0x51fc13+'-'+_0x14d936+'/'+_0x38c69d)[_0x7b6a('0x1f')](_0x1f9e22);}return null;};}function patchUpdates(_0x25582b){return function(_0xd5ca2c){try{jsonpatch[_0x7b6a('0x20')](_0xd5ca2c,_0x25582b,!![]);}catch(_0x189e43){return BPromise[_0x7b6a('0x21')](_0x189e43);}return _0xd5ca2c[_0x7b6a('0x22')]();};}function saveUpdates(_0x5108c5,_0x20214a){return function(_0x40bd43){if(_0x40bd43){return _0x40bd43[_0x7b6a('0x23')](_0x5108c5)[_0x7b6a('0x24')](function(_0x38da01){return _0x38da01;});}return null;};}function removeEntity(_0x3d7515,_0x5266c1){return function(_0x59f13f){if(_0x59f13f){return _0x59f13f[_0x7b6a('0x25')]()[_0x7b6a('0x24')](function(){_0x3d7515[_0x7b6a('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57be8c,_0x5279de){return function(_0x195438){if(!_0x195438){_0x57be8c['sendStatus'](0x194);}return _0x195438;};}function handleError(_0x2c80dd,_0x5259a7){_0x5259a7=_0x5259a7||0x1f4;return function(_0x57be4e){logger['error'](_0x57be4e[_0x7b6a('0x27')]);if(_0x57be4e[_0x7b6a('0x28')]){delete _0x57be4e['name'];}_0x2c80dd[_0x7b6a('0x26')](_0x5259a7)[_0x7b6a('0x29')](_0x57be4e);};}exports[_0x7b6a('0x2a')]=function(_0x196b72,_0x451de2){var _0x315554={},_0x4ff41a={},_0x4ecd48={'count':0x0,'rows':[]};var _0x46a881=_[_0x7b6a('0x2b')](db[_0x7b6a('0x2c')][_0x7b6a('0x2d')],function(_0x5958c5){return{'name':_0x5958c5[_0x7b6a('0x2e')],'type':_0x5958c5['type'][_0x7b6a('0x2f')]};});_0x4ff41a[_0x7b6a('0x30')]=_[_0x7b6a('0x2b')](_0x46a881,'name');_0x4ff41a[_0x7b6a('0x31')]=_[_0x7b6a('0x32')](_0x196b72[_0x7b6a('0x31')]);_0x4ff41a[_0x7b6a('0x33')]=_[_0x7b6a('0x34')](_0x4ff41a[_0x7b6a('0x30')],_0x4ff41a[_0x7b6a('0x31')]);_0x315554[_0x7b6a('0x35')]=_[_0x7b6a('0x34')](_0x4ff41a[_0x7b6a('0x30')],qs[_0x7b6a('0x36')](_0x196b72[_0x7b6a('0x31')]['fields']));_0x315554[_0x7b6a('0x35')]=_0x315554['attributes'][_0x7b6a('0x37')]?_0x315554[_0x7b6a('0x35')]:_0x4ff41a['model'];if(!_0x196b72[_0x7b6a('0x31')][_0x7b6a('0x38')](_0x7b6a('0x39'))){_0x315554[_0x7b6a('0x1b')]=qs[_0x7b6a('0x1b')](_0x196b72['query'][_0x7b6a('0x1b')]);_0x315554[_0x7b6a('0x19')]=qs[_0x7b6a('0x19')](_0x196b72[_0x7b6a('0x31')][_0x7b6a('0x19')]);}_0x315554[_0x7b6a('0x3a')]=qs[_0x7b6a('0x3b')](_0x196b72['query'][_0x7b6a('0x3b')]);_0x315554[_0x7b6a('0x3c')]=qs['filters'](_[_0x7b6a('0x3d')](_0x196b72['query'],_0x4ff41a[_0x7b6a('0x33')]),_0x46a881);if(_0x196b72[_0x7b6a('0x31')][_0x7b6a('0x3e')]){_0x315554[_0x7b6a('0x3c')]=_['merge'](_0x315554[_0x7b6a('0x3c')],{'$or':_[_0x7b6a('0x2b')](_0x46a881,function(_0x115192){if(_0x115192[_0x7b6a('0x3f')]!=='VIRTUAL'){var _0x27ab17={};_0x27ab17[_0x115192[_0x7b6a('0x28')]]={'$like':'%'+_0x196b72[_0x7b6a('0x31')][_0x7b6a('0x3e')]+'%'};return _0x27ab17;}})});}_0x315554=_[_0x7b6a('0x40')]({},_0x315554,_0x196b72[_0x7b6a('0x41')]);var _0x208dce={'where':_0x315554[_0x7b6a('0x3c')]};return db[_0x7b6a('0x2c')]['count'](_0x208dce)[_0x7b6a('0x24')](function(_0x17b4d2){_0x4ecd48[_0x7b6a('0x1c')]=_0x17b4d2;if(_0x196b72[_0x7b6a('0x31')][_0x7b6a('0x42')]){_0x315554[_0x7b6a('0x43')]=[{'all':!![]}];}return db[_0x7b6a('0x2c')][_0x7b6a('0x44')](_0x315554);})[_0x7b6a('0x24')](function(_0x8c67dc){_0x4ecd48['rows']=_0x8c67dc;return _0x4ecd48;})[_0x7b6a('0x24')](respondWithFilteredResult(_0x451de2,_0x315554))['catch'](handleError(_0x451de2,null));};exports[_0x7b6a('0x45')]=function(_0x98dfe1,_0x5ebc93){var _0x5a0d23={'raw':![],'where':{'id':_0x98dfe1[_0x7b6a('0x46')]['id']}},_0x2d2c3b={};_0x2d2c3b[_0x7b6a('0x30')]=_[_0x7b6a('0x32')](db['ServicenowConfiguration'][_0x7b6a('0x2d')]);_0x2d2c3b['query']=_[_0x7b6a('0x32')](_0x98dfe1[_0x7b6a('0x31')]);_0x2d2c3b['filters']=_[_0x7b6a('0x34')](_0x2d2c3b[_0x7b6a('0x30')],_0x2d2c3b[_0x7b6a('0x31')]);_0x5a0d23[_0x7b6a('0x35')]=_[_0x7b6a('0x34')](_0x2d2c3b[_0x7b6a('0x30')],qs[_0x7b6a('0x36')](_0x98dfe1['query'][_0x7b6a('0x36')]));_0x5a0d23[_0x7b6a('0x35')]=_0x5a0d23[_0x7b6a('0x35')][_0x7b6a('0x37')]?_0x5a0d23[_0x7b6a('0x35')]:_0x2d2c3b['model'];if(_0x98dfe1[_0x7b6a('0x31')][_0x7b6a('0x42')]){_0x5a0d23[_0x7b6a('0x43')]=[{'all':!![]}];}_0x5a0d23=_[_0x7b6a('0x40')]({},_0x5a0d23,_0x98dfe1['options']);return db[_0x7b6a('0x2c')]['find'](_0x5a0d23)['then'](handleEntityNotFound(_0x5ebc93,null))[_0x7b6a('0x24')](respondWithResult(_0x5ebc93,null))[_0x7b6a('0x47')](handleError(_0x5ebc93,null));};exports['create']=function(_0x225f85,_0x26e3b4){return db[_0x7b6a('0x2c')][_0x7b6a('0x48')](_0x225f85[_0x7b6a('0x49')],{})[_0x7b6a('0x24')](respondWithResult(_0x26e3b4,0xc9))[_0x7b6a('0x47')](handleError(_0x26e3b4,null));};exports[_0x7b6a('0x23')]=function(_0x42c7ab,_0x61fdf2){if(_0x42c7ab['body']['id']){delete _0x42c7ab['body']['id'];}return db[_0x7b6a('0x2c')][_0x7b6a('0x4a')]({'where':{'id':_0x42c7ab[_0x7b6a('0x46')]['id']}})[_0x7b6a('0x24')](handleEntityNotFound(_0x61fdf2,null))[_0x7b6a('0x24')](saveUpdates(_0x42c7ab[_0x7b6a('0x49')],null))[_0x7b6a('0x24')](respondWithResult(_0x61fdf2,null))[_0x7b6a('0x47')](handleError(_0x61fdf2,null));};exports[_0x7b6a('0x25')]=function(_0x179360,_0xf7ea86){return db['ServicenowConfiguration'][_0x7b6a('0x4a')]({'where':{'id':_0x179360['params']['id']}})['then'](handleEntityNotFound(_0xf7ea86,null))[_0x7b6a('0x24')](removeEntity(_0xf7ea86,null))[_0x7b6a('0x47')](handleError(_0xf7ea86,null));};exports['getFields']=function(_0x1887d0,_0x1f199d,_0x3d25c9){var _0x4bb8ee={};var _0x1cd208={};var _0x232690;var _0x3d569d;return db['ServicenowConfiguration'][_0x7b6a('0x4b')]({'where':{'id':_0x1887d0[_0x7b6a('0x46')]['id']}})[_0x7b6a('0x24')](handleEntityNotFound(_0x1f199d,null))[_0x7b6a('0x24')](function(_0x38b858){if(_0x38b858){_0x232690=_0x38b858;_0x1cd208[_0x7b6a('0x30')]=_[_0x7b6a('0x32')](db[_0x7b6a('0x4c')][_0x7b6a('0x2d')]);_0x1cd208[_0x7b6a('0x31')]=_[_0x7b6a('0x32')](_0x1887d0[_0x7b6a('0x31')]);_0x1cd208[_0x7b6a('0x33')]=_['intersection'](_0x1cd208['model'],_0x1cd208[_0x7b6a('0x31')]);_0x4bb8ee[_0x7b6a('0x35')]=_[_0x7b6a('0x34')](_0x1cd208[_0x7b6a('0x30')],qs['fields'](_0x1887d0[_0x7b6a('0x31')][_0x7b6a('0x36')]));_0x4bb8ee[_0x7b6a('0x35')]=_0x4bb8ee['attributes'][_0x7b6a('0x37')]?_0x4bb8ee[_0x7b6a('0x35')]:_0x1cd208[_0x7b6a('0x30')];_0x4bb8ee[_0x7b6a('0x3a')]=qs[_0x7b6a('0x3b')](_0x1887d0[_0x7b6a('0x31')][_0x7b6a('0x3b')]);_0x4bb8ee['where']=qs[_0x7b6a('0x33')](_['pick'](_0x1887d0[_0x7b6a('0x31')],_0x1cd208[_0x7b6a('0x33')]));if(_0x1887d0[_0x7b6a('0x31')][_0x7b6a('0x3e')]){_0x4bb8ee['where']=_[_0x7b6a('0x40')](_0x4bb8ee[_0x7b6a('0x3c')],{'$or':_[_0x7b6a('0x2b')](_0x4bb8ee[_0x7b6a('0x35')],function(_0x3b553c){var _0xbc4f1f={};_0xbc4f1f[_0x3b553c]={'$like':'%'+_0x1887d0[_0x7b6a('0x31')][_0x7b6a('0x3e')]+'%'};return _0xbc4f1f;})});}_0x4bb8ee=_[_0x7b6a('0x40')]({},_0x4bb8ee,_0x1887d0[_0x7b6a('0x41')]);return _0x232690[_0x7b6a('0x4d')](_0x4bb8ee);}})['then'](function(_0xa1102c){if(_0xa1102c){_0x3d569d=_0xa1102c[_0x7b6a('0x37')];if(!_0x1887d0[_0x7b6a('0x31')][_0x7b6a('0x38')](_0x7b6a('0x39'))){_0x4bb8ee['limit']=qs[_0x7b6a('0x1b')](_0x1887d0['query']['limit']);_0x4bb8ee['offset']=qs[_0x7b6a('0x19')](_0x1887d0['query'][_0x7b6a('0x19')]);}return _0x232690[_0x7b6a('0x4d')](_0x4bb8ee);}})[_0x7b6a('0x24')](function(_0x20815e){if(_0x20815e){return _0x20815e?{'count':_0x3d569d,'rows':_0x20815e}:null;}})[_0x7b6a('0x24')](respondWithResult(_0x1f199d,null))[_0x7b6a('0x47')](handleError(_0x1f199d,null));};exports[_0x7b6a('0x4e')]=function(_0x2e44da,_0x124b7d,_0x2c89d9){var _0x5260b9={};var _0x55096c={};var _0x36730c;var _0x114a42;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x2e44da['params']['id']}})[_0x7b6a('0x24')](handleEntityNotFound(_0x124b7d,null))['then'](function(_0x1ee70c){if(_0x1ee70c){_0x36730c=_0x1ee70c;_0x55096c[_0x7b6a('0x30')]=_[_0x7b6a('0x32')](db[_0x7b6a('0x4c')][_0x7b6a('0x2d')]);_0x55096c[_0x7b6a('0x31')]=_[_0x7b6a('0x32')](_0x2e44da[_0x7b6a('0x31')]);_0x55096c['filters']=_[_0x7b6a('0x34')](_0x55096c[_0x7b6a('0x30')],_0x55096c[_0x7b6a('0x31')]);_0x5260b9['attributes']=_[_0x7b6a('0x34')](_0x55096c[_0x7b6a('0x30')],qs[_0x7b6a('0x36')](_0x2e44da['query']['fields']));_0x5260b9[_0x7b6a('0x35')]=_0x5260b9[_0x7b6a('0x35')]['length']?_0x5260b9[_0x7b6a('0x35')]:_0x55096c['model'];_0x5260b9[_0x7b6a('0x3a')]=qs[_0x7b6a('0x3b')](_0x2e44da[_0x7b6a('0x31')][_0x7b6a('0x3b')]);_0x5260b9[_0x7b6a('0x3c')]=qs[_0x7b6a('0x33')](_[_0x7b6a('0x3d')](_0x2e44da[_0x7b6a('0x31')],_0x55096c['filters']));if(_0x2e44da[_0x7b6a('0x31')][_0x7b6a('0x3e')]){_0x5260b9[_0x7b6a('0x3c')]=_[_0x7b6a('0x40')](_0x5260b9['where'],{'$or':_[_0x7b6a('0x2b')](_0x5260b9[_0x7b6a('0x35')],function(_0x21c214){var _0x1aa4e7={};_0x1aa4e7[_0x21c214]={'$like':'%'+_0x2e44da[_0x7b6a('0x31')][_0x7b6a('0x3e')]+'%'};return _0x1aa4e7;})});}_0x5260b9=_['merge']({},_0x5260b9,_0x2e44da[_0x7b6a('0x41')]);return _0x36730c[_0x7b6a('0x4e')](_0x5260b9);}})[_0x7b6a('0x24')](function(_0x14aad1){if(_0x14aad1){_0x114a42=_0x14aad1[_0x7b6a('0x37')];if(!_0x2e44da[_0x7b6a('0x31')][_0x7b6a('0x38')]('nolimit')){_0x5260b9[_0x7b6a('0x1b')]=qs[_0x7b6a('0x1b')](_0x2e44da['query'][_0x7b6a('0x1b')]);_0x5260b9[_0x7b6a('0x19')]=qs['offset'](_0x2e44da[_0x7b6a('0x31')][_0x7b6a('0x19')]);}return _0x36730c[_0x7b6a('0x4e')](_0x5260b9);}})[_0x7b6a('0x24')](function(_0x4f6311){if(_0x4f6311){return _0x4f6311?{'count':_0x114a42,'rows':_0x4f6311}:null;}})[_0x7b6a('0x24')](respondWithResult(_0x124b7d,null))[_0x7b6a('0x47')](handleError(_0x124b7d,null));};exports[_0x7b6a('0x4f')]=function(_0x26ffe4,_0x10c303,_0x15293b){var _0x13359b={};var _0x198e6c={};var _0x4e7098;var _0x5d924e;return db[_0x7b6a('0x2c')][_0x7b6a('0x4b')]({'where':{'id':_0x26ffe4[_0x7b6a('0x46')]['id']}})['then'](handleEntityNotFound(_0x10c303,null))['then'](function(_0x188f2b){if(_0x188f2b){_0x4e7098=_0x188f2b;_0x198e6c[_0x7b6a('0x30')]=_[_0x7b6a('0x32')](db['ServicenowField'][_0x7b6a('0x2d')]);_0x198e6c[_0x7b6a('0x31')]=_['keys'](_0x26ffe4[_0x7b6a('0x31')]);_0x198e6c[_0x7b6a('0x33')]=_[_0x7b6a('0x34')](_0x198e6c[_0x7b6a('0x30')],_0x198e6c[_0x7b6a('0x31')]);_0x13359b[_0x7b6a('0x35')]=_['intersection'](_0x198e6c['model'],qs['fields'](_0x26ffe4['query'][_0x7b6a('0x36')]));_0x13359b[_0x7b6a('0x35')]=_0x13359b[_0x7b6a('0x35')][_0x7b6a('0x37')]?_0x13359b[_0x7b6a('0x35')]:_0x198e6c['model'];_0x13359b[_0x7b6a('0x3a')]=qs['sort'](_0x26ffe4[_0x7b6a('0x31')][_0x7b6a('0x3b')]);_0x13359b[_0x7b6a('0x3c')]=qs[_0x7b6a('0x33')](_[_0x7b6a('0x3d')](_0x26ffe4[_0x7b6a('0x31')],_0x198e6c[_0x7b6a('0x33')]));if(_0x26ffe4[_0x7b6a('0x31')][_0x7b6a('0x3e')]){_0x13359b[_0x7b6a('0x3c')]=_[_0x7b6a('0x40')](_0x13359b['where'],{'$or':_['map'](_0x13359b[_0x7b6a('0x35')],function(_0x2f6f2d){var _0x22b5cb={};_0x22b5cb[_0x2f6f2d]={'$like':'%'+_0x26ffe4[_0x7b6a('0x31')][_0x7b6a('0x3e')]+'%'};return _0x22b5cb;})});}_0x13359b=_[_0x7b6a('0x40')]({},_0x13359b,_0x26ffe4[_0x7b6a('0x41')]);return _0x4e7098[_0x7b6a('0x4f')](_0x13359b);}})['then'](function(_0x414703){if(_0x414703){_0x5d924e=_0x414703[_0x7b6a('0x37')];if(!_0x26ffe4[_0x7b6a('0x31')]['hasOwnProperty'](_0x7b6a('0x39'))){_0x13359b[_0x7b6a('0x1b')]=qs['limit'](_0x26ffe4['query'][_0x7b6a('0x1b')]);_0x13359b[_0x7b6a('0x19')]=qs['offset'](_0x26ffe4[_0x7b6a('0x31')][_0x7b6a('0x19')]);}return _0x4e7098[_0x7b6a('0x4f')](_0x13359b);}})[_0x7b6a('0x24')](function(_0x26abde){if(_0x26abde){return _0x26abde?{'count':_0x5d924e,'rows':_0x26abde}:null;}})[_0x7b6a('0x24')](respondWithResult(_0x10c303,null))['catch'](handleError(_0x10c303,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 332ba3b..4cb47c3 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 _0x9703=['api','moment','request-promise','rimraf','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','../../config/logger'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9703,0xdb));var _0x3970=function(_0x4d2c26,_0x2701f9){_0x4d2c26=_0x4d2c26-0x0;var _0x5bf9b4=_0x9703[_0x4d2c26];return _0x5bf9b4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3970('0x0'))(_0x3970('0x1'));var moment=require(_0x3970('0x2'));var BPromise=require('bluebird');var rp=require(_0x3970('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3970('0x4'));var config=require('../../config/environment');var attributes=require(_0x3970('0x5'));module[_0x3970('0x6')]=function(_0x5cdfda,_0x5669ec){return _0x5cdfda[_0x3970('0x7')](_0x3970('0x8'),attributes,{'tableName':_0x3970('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x530f=['path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','util','moment','bluebird','request-promise'];(function(_0x2f1a51,_0x3c1f80){var _0x581809=function(_0x190b5c){while(--_0x190b5c){_0x2f1a51['push'](_0x2f1a51['shift']());}};_0x581809(++_0x3c1f80);}(_0x530f,0x167));var _0xf530=function(_0x193bec,_0x5bbea3){_0x193bec=_0x193bec-0x0;var _0x3aea83=_0x530f[_0x193bec];return _0x3aea83;};'use strict';var _=require('lodash');var util=require(_0xf530('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf530('0x1'));var BPromise=require(_0xf530('0x2'));var rp=require(_0xf530('0x3'));var fs=require('fs');var path=require(_0xf530('0x4'));var rimraf=require(_0xf530('0x5'));var config=require(_0xf530('0x6'));var attributes=require(_0xf530('0x7'));module[_0xf530('0x8')]=function(_0x58f5f8,_0x3a0301){return _0x58f5f8[_0xf530('0x9')](_0xf530('0xa'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index a8a36fb..c0aced8 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 _0x61c4=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x22ffbf,_0x16f31e){var _0x360c17=function(_0x40807f){while(--_0x40807f){_0x22ffbf['push'](_0x22ffbf['shift']());}};_0x360c17(++_0x16f31e);}(_0x61c4,0x79));var _0x461c=function(_0x58bf2d,_0x204682){_0x58bf2d=_0x58bf2d-0x0;var _0x3f0804=_0x61c4[_0x58bf2d];return _0x3f0804;};'use strict';var _=require(_0x461c('0x0'));var util=require(_0x461c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x461c('0x2'));var fs=require('fs');var Redis=require(_0x461c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x461c('0x4'));var logger=require(_0x461c('0x5'))(_0x461c('0x6'));var config=require(_0x461c('0x7'));var jayson=require(_0x461c('0x8'));var client=jayson[_0x461c('0x9')][_0x461c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53d52b,_0x36a531,_0x332591){return new BPromise(function(_0x467d71,_0x39e6ee){return client['request'](_0x53d52b,_0x332591)['then'](function(_0x6c0732){logger['info'](_0x461c('0xb'),_0x36a531,_0x461c('0xc'));logger[_0x461c('0xd')](_0x461c('0xe'),_0x36a531,_0x461c('0xc'),JSON['stringify'](_0x6c0732));if(_0x6c0732[_0x461c('0xf')]){if(_0x6c0732[_0x461c('0xf')][_0x461c('0x10')]===0x1f4){logger[_0x461c('0xf')](_0x461c('0xb'),_0x36a531,_0x6c0732[_0x461c('0xf')][_0x461c('0x11')]);return _0x39e6ee(_0x6c0732['error']['message']);}logger[_0x461c('0xf')](_0x461c('0xb'),_0x36a531,_0x6c0732[_0x461c('0xf')]['message']);return _0x467d71(_0x6c0732['error'][_0x461c('0x11')]);}else{logger[_0x461c('0x12')](_0x461c('0xb'),_0x36a531,_0x461c('0xc'));_0x467d71(_0x6c0732[_0x461c('0x13')][_0x461c('0x11')]);}})[_0x461c('0x14')](function(_0x5d2e03){logger[_0x461c('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x36a531,_0x5d2e03);_0x39e6ee(_0x5d2e03);});});} \ No newline at end of file +var _0x6189=['../../config/environment','jayson/promise','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x129944,_0x5ce307){var _0x1510c3=function(_0x439bb0){while(--_0x439bb0){_0x129944['push'](_0x129944['shift']());}};_0x1510c3(++_0x5ce307);}(_0x6189,0x98));var _0x9618=function(_0x34ca7f,_0x401050){_0x34ca7f=_0x34ca7f-0x0;var _0x1ce011=_0x6189[_0x34ca7f];return _0x1ce011;};'use strict';var _=require(_0x9618('0x0'));var util=require(_0x9618('0x1'));var moment=require(_0x9618('0x2'));var BPromise=require(_0x9618('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9618('0x4'));var db=require(_0x9618('0x5'))['db'];var utils=require(_0x9618('0x6'));var logger=require('../../config/logger')(_0x9618('0x7'));var config=require(_0x9618('0x8'));var jayson=require(_0x9618('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x579143,_0x523307,_0x3655c7){return new BPromise(function(_0x77bd8c,_0x474f60){return client['request'](_0x579143,_0x3655c7)['then'](function(_0x292377){logger[_0x9618('0xa')]('ServicenowConfiguration,\x20%s,\x20%s',_0x523307,_0x9618('0xb'));logger[_0x9618('0xc')](_0x9618('0xd'),_0x523307,_0x9618('0xb'),JSON[_0x9618('0xe')](_0x292377));if(_0x292377['error']){if(_0x292377[_0x9618('0xf')][_0x9618('0x10')]===0x1f4){logger[_0x9618('0xf')](_0x9618('0x11'),_0x523307,_0x292377['error'][_0x9618('0x12')]);return _0x474f60(_0x292377[_0x9618('0xf')][_0x9618('0x12')]);}logger['error'](_0x9618('0x11'),_0x523307,_0x292377[_0x9618('0xf')][_0x9618('0x12')]);return _0x77bd8c(_0x292377[_0x9618('0xf')][_0x9618('0x12')]);}else{logger[_0x9618('0xa')](_0x9618('0x11'),_0x523307,'request\x20sent');_0x77bd8c(_0x292377['result']['message']);}})[_0x9618('0x13')](function(_0x39da94){logger[_0x9618('0xf')](_0x9618('0x11'),_0x523307,_0x39da94);_0x474f60(_0x39da94);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 7d26e80..d522054 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 _0xe1a6=['show','create','put','update','destroy','exports','multer','connect-timeout','express','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id'];(function(_0xc7f1bd,_0x4f09a2){var _0x123b0c=function(_0x968173){while(--_0x968173){_0xc7f1bd['push'](_0xc7f1bd['shift']());}};_0x123b0c(++_0x4f09a2);}(_0xe1a6,0x76));var _0x6e1a=function(_0x54b642,_0x48b3ec){_0x54b642=_0x54b642-0x0;var _0xdf8370=_0xe1a6[_0x54b642];return _0xdf8370;};'use strict';var multer=require(_0x6e1a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6e1a('0x1'));var express=require(_0x6e1a('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6e1a('0x3'));var config=require(_0x6e1a('0x4'));var controller=require(_0x6e1a('0x5'));router[_0x6e1a('0x6')]('/',auth[_0x6e1a('0x7')](),controller[_0x6e1a('0x8')]);router[_0x6e1a('0x6')](_0x6e1a('0x9'),auth[_0x6e1a('0x7')](),controller[_0x6e1a('0xa')]);router['post']('/',auth[_0x6e1a('0x7')](),controller[_0x6e1a('0xb')]);router[_0x6e1a('0xc')](_0x6e1a('0x9'),auth[_0x6e1a('0x7')](),controller[_0x6e1a('0xd')]);router['delete'](_0x6e1a('0x9'),auth[_0x6e1a('0x7')](),controller[_0x6e1a('0xe')]);module[_0x6e1a('0xf')]=router; \ No newline at end of file +var _0x5e2e=['Router','fs-extra','../../components/auth/service','./intServicenowField.controller','get','index','/:id','isAuthenticated','post','create','put','update','destroy','multer','util','express'];(function(_0x709f6f,_0xe46462){var _0x1fb4f5=function(_0x304538){while(--_0x304538){_0x709f6f['push'](_0x709f6f['shift']());}};_0x1fb4f5(++_0xe46462);}(_0x5e2e,0x1ad));var _0xe5e2=function(_0x60ca84,_0x977cf){_0x60ca84=_0x60ca84-0x0;var _0x1b8ffb=_0x5e2e[_0x60ca84];return _0x1b8ffb;};'use strict';var multer=require(_0xe5e2('0x0'));var util=require(_0xe5e2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe5e2('0x2'));var router=express[_0xe5e2('0x3')]();var fs_extra=require(_0xe5e2('0x4'));var auth=require(_0xe5e2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe5e2('0x6'));router[_0xe5e2('0x7')]('/',auth['isAuthenticated'](),controller[_0xe5e2('0x8')]);router['get'](_0xe5e2('0x9'),auth[_0xe5e2('0xa')](),controller['show']);router[_0xe5e2('0xb')]('/',auth['isAuthenticated'](),controller[_0xe5e2('0xc')]);router[_0xe5e2('0xd')](_0xe5e2('0x9'),auth[_0xe5e2('0xa')](),controller[_0xe5e2('0xe')]);router['delete'](_0xe5e2('0x9'),auth['isAuthenticated'](),controller[_0xe5e2('0xf')]);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 eb89115..38c37e4 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 _0xf14a=['customVariable','BOOLEAN','sequelize','exports','variable','picklist','string','STRING','ENUM'];(function(_0x456f6f,_0x30a863){var _0x17ea4c=function(_0x283032){while(--_0x283032){_0x456f6f['push'](_0x456f6f['shift']());}};_0x17ea4c(++_0x30a863);}(_0xf14a,0x65));var _0xaf14=function(_0x37fb4a,_0x471958){_0x37fb4a=_0x37fb4a-0x0;var _0x4555d3=_0xf14a[_0x37fb4a];return _0x4555d3;};'use strict';var Sequelize=require(_0xaf14('0x0'));module[_0xaf14('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xaf14('0x2'),'customVariable','keyValue',_0xaf14('0x3')),'defaultValue':_0xaf14('0x4')},'content':{'type':Sequelize[_0xaf14('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xaf14('0x6')](_0xaf14('0x4'),'variable',_0xaf14('0x7'))},'keyContent':{'type':Sequelize[_0xaf14('0x5')]},'idField':{'type':Sequelize[_0xaf14('0x5')]},'nameField':{'type':Sequelize[_0xaf14('0x5')]},'customField':{'type':Sequelize[_0xaf14('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaf14('0x5')]}}; \ No newline at end of file +var _0xbf27=['sequelize','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x4fd4b5,_0x378cc7){var _0x47a119=function(_0xe026b7){while(--_0xe026b7){_0x4fd4b5['push'](_0x4fd4b5['shift']());}};_0x47a119(++_0x378cc7);}(_0xbf27,0x156));var _0x7bf2=function(_0x1bade7,_0x5ac55d){_0x1bade7=_0x1bade7-0x0;var _0x4515a5=_0xbf27[_0x1bade7];return _0x4515a5;};'use strict';var Sequelize=require(_0x7bf2('0x0'));module['exports']={'type':{'type':Sequelize[_0x7bf2('0x1')](_0x7bf2('0x2'),_0x7bf2('0x3'),_0x7bf2('0x4'),_0x7bf2('0x5'),_0x7bf2('0x6')),'defaultValue':_0x7bf2('0x2')},'content':{'type':Sequelize[_0x7bf2('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7bf2('0x1')]('string',_0x7bf2('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x7bf2('0x7')]},'idField':{'type':Sequelize[_0x7bf2('0x7')]},'nameField':{'type':Sequelize[_0x7bf2('0x7')]},'customField':{'type':Sequelize[_0x7bf2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7bf2('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index e934cc1..df61c65 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 _0x7469=['offset','Content-Range','json','apply','reject','save','update','then','destroy','error','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowField','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x7469,0x78));var _0x9746=function(_0x1b79b0,_0x1db8e7){_0x1b79b0=_0x1b79b0-0x0;var _0x5e77e8=_0x7469[_0x1b79b0];return _0x5e77e8;};'use strict';var emlformat=require(_0x9746('0x0'));var rimraf=require(_0x9746('0x1'));var zipdir=require(_0x9746('0x2'));var jsonpatch=require(_0x9746('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9746('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9746('0x5'));var sox=require(_0x9746('0x6'));var csv=require('to-csv');var ejs=require(_0x9746('0x7'));var fs=require('fs');var fs_extra=require(_0x9746('0x8'));var _=require('lodash');var squel=require(_0x9746('0x9'));var crypto=require('crypto');var jsforce=require(_0x9746('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x9746('0xb'));var querystring=require(_0x9746('0xc'));var Papa=require(_0x9746('0xd'));var Redis=require(_0x9746('0xe'));var authService=require(_0x9746('0xf'));var qs=require(_0x9746('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9746('0x11'));var logger=require(_0x9746('0x12'))(_0x9746('0x13'));var utils=require(_0x9746('0x14'));var config=require(_0x9746('0x15'));var licenseUtil=require(_0x9746('0x16'));var db=require(_0x9746('0x17'))['db'];function respondWithStatusCode(_0x1250d2,_0x8a87ac){_0x8a87ac=_0x8a87ac||0xcc;return function(_0x2fe6ad){if(_0x2fe6ad){return _0x1250d2[_0x9746('0x18')](_0x8a87ac);}return _0x1250d2['status'](_0x8a87ac)[_0x9746('0x19')]();};}function respondWithResult(_0x501a73,_0x1b3384){_0x1b3384=_0x1b3384||0xc8;return function(_0x881ecc){if(_0x881ecc){return _0x501a73[_0x9746('0x1a')](_0x1b3384)['json'](_0x881ecc);}};}function respondWithFilteredResult(_0x3dabb0,_0x385809){return function(_0x8f61ce){if(_0x8f61ce){var _0xb8a0ad=typeof _0x385809['offset']===_0x9746('0x1b')&&typeof _0x385809[_0x9746('0x1c')]===_0x9746('0x1b');var _0x3b28b9=_0x8f61ce['count'];var _0x88eca2=_0xb8a0ad?0x0:_0x385809['offset'];var _0x5d28f0=_0xb8a0ad?_0x8f61ce[_0x9746('0x1d')]:_0x385809[_0x9746('0x1e')]+_0x385809[_0x9746('0x1c')];var _0x9118c2;if(_0x5d28f0>=_0x3b28b9){_0x5d28f0=_0x3b28b9;_0x9118c2=0xc8;}else{_0x9118c2=0xce;}_0x3dabb0[_0x9746('0x1a')](_0x9118c2);return _0x3dabb0['set'](_0x9746('0x1f'),_0x88eca2+'-'+_0x5d28f0+'/'+_0x3b28b9)[_0x9746('0x20')](_0x8f61ce);}return null;};}function patchUpdates(_0x44c33e){return function(_0x5ba079){try{jsonpatch[_0x9746('0x21')](_0x5ba079,_0x44c33e,!![]);}catch(_0x55934c){return BPromise[_0x9746('0x22')](_0x55934c);}return _0x5ba079[_0x9746('0x23')]();};}function saveUpdates(_0x395b0a,_0x64f4a9){return function(_0x4fad87){if(_0x4fad87){return _0x4fad87[_0x9746('0x24')](_0x395b0a)[_0x9746('0x25')](function(_0x3b45c5){return _0x3b45c5;});}return null;};}function removeEntity(_0xf41975,_0xcadb60){return function(_0x4d3ebc){if(_0x4d3ebc){return _0x4d3ebc[_0x9746('0x26')]()[_0x9746('0x25')](function(){_0xf41975[_0x9746('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d03cd,_0x2a33a6){return function(_0x27c51e){if(!_0x27c51e){_0x1d03cd['sendStatus'](0x194);}return _0x27c51e;};}function handleError(_0x3e0ddb,_0x395ce5){_0x395ce5=_0x395ce5||0x1f4;return function(_0xa88a7a){logger[_0x9746('0x27')](_0xa88a7a['stack']);if(_0xa88a7a['name']){delete _0xa88a7a['name'];}_0x3e0ddb[_0x9746('0x1a')](_0x395ce5)[_0x9746('0x28')](_0xa88a7a);};}exports[_0x9746('0x29')]=function(_0x3e5384,_0x3b1049){var _0x25deb8={},_0x238aba={},_0x42fad4={'count':0x0,'rows':[]};var _0x2d5a61=_[_0x9746('0x2a')](db['ServicenowField'][_0x9746('0x2b')],function(_0x28bc9d){return{'name':_0x28bc9d[_0x9746('0x2c')],'type':_0x28bc9d[_0x9746('0x2d')][_0x9746('0x2e')]};});_0x238aba[_0x9746('0x2f')]=_[_0x9746('0x2a')](_0x2d5a61,_0x9746('0x30'));_0x238aba[_0x9746('0x31')]=_[_0x9746('0x32')](_0x3e5384['query']);_0x238aba[_0x9746('0x33')]=_[_0x9746('0x34')](_0x238aba[_0x9746('0x2f')],_0x238aba[_0x9746('0x31')]);_0x25deb8[_0x9746('0x35')]=_[_0x9746('0x34')](_0x238aba['model'],qs[_0x9746('0x36')](_0x3e5384[_0x9746('0x31')][_0x9746('0x36')]));_0x25deb8['attributes']=_0x25deb8[_0x9746('0x35')][_0x9746('0x37')]?_0x25deb8['attributes']:_0x238aba[_0x9746('0x2f')];if(!_0x3e5384[_0x9746('0x31')]['hasOwnProperty'](_0x9746('0x38'))){_0x25deb8[_0x9746('0x1c')]=qs[_0x9746('0x1c')](_0x3e5384[_0x9746('0x31')][_0x9746('0x1c')]);_0x25deb8[_0x9746('0x1e')]=qs['offset'](_0x3e5384['query'][_0x9746('0x1e')]);}_0x25deb8[_0x9746('0x39')]=qs[_0x9746('0x3a')](_0x3e5384[_0x9746('0x31')][_0x9746('0x3a')]);_0x25deb8[_0x9746('0x3b')]=qs[_0x9746('0x33')](_[_0x9746('0x3c')](_0x3e5384[_0x9746('0x31')],_0x238aba['filters']),_0x2d5a61);if(_0x3e5384[_0x9746('0x31')][_0x9746('0x3d')]){_0x25deb8['where']=_[_0x9746('0x3e')](_0x25deb8[_0x9746('0x3b')],{'$or':_['map'](_0x2d5a61,function(_0x36a862){if(_0x36a862[_0x9746('0x2d')]!==_0x9746('0x3f')){var _0x3b2e71={};_0x3b2e71[_0x36a862[_0x9746('0x30')]]={'$like':'%'+_0x3e5384[_0x9746('0x31')][_0x9746('0x3d')]+'%'};return _0x3b2e71;}})});}_0x25deb8=_[_0x9746('0x3e')]({},_0x25deb8,_0x3e5384[_0x9746('0x40')]);var _0x2a773d={'where':_0x25deb8['where']};return db[_0x9746('0x41')][_0x9746('0x1d')](_0x2a773d)[_0x9746('0x25')](function(_0x265aff){_0x42fad4[_0x9746('0x1d')]=_0x265aff;if(_0x3e5384[_0x9746('0x31')][_0x9746('0x42')]){_0x25deb8[_0x9746('0x43')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x25deb8);})[_0x9746('0x25')](function(_0x4a5def){_0x42fad4[_0x9746('0x44')]=_0x4a5def;return _0x42fad4;})[_0x9746('0x25')](respondWithFilteredResult(_0x3b1049,_0x25deb8))[_0x9746('0x45')](handleError(_0x3b1049,null));};exports[_0x9746('0x46')]=function(_0xe3b401,_0x2147f9){var _0x5bc3af={'raw':!![],'where':{'id':_0xe3b401[_0x9746('0x47')]['id']}},_0x346119={};_0x346119[_0x9746('0x2f')]=_[_0x9746('0x32')](db[_0x9746('0x41')][_0x9746('0x2b')]);_0x346119[_0x9746('0x31')]=_[_0x9746('0x32')](_0xe3b401[_0x9746('0x31')]);_0x346119[_0x9746('0x33')]=_['intersection'](_0x346119[_0x9746('0x2f')],_0x346119[_0x9746('0x31')]);_0x5bc3af['attributes']=_[_0x9746('0x34')](_0x346119[_0x9746('0x2f')],qs[_0x9746('0x36')](_0xe3b401['query'][_0x9746('0x36')]));_0x5bc3af[_0x9746('0x35')]=_0x5bc3af['attributes'][_0x9746('0x37')]?_0x5bc3af[_0x9746('0x35')]:_0x346119[_0x9746('0x2f')];if(_0xe3b401[_0x9746('0x31')]['includeAll']){_0x5bc3af[_0x9746('0x43')]=[{'all':!![]}];}_0x5bc3af=_['merge']({},_0x5bc3af,_0xe3b401[_0x9746('0x40')]);return db[_0x9746('0x41')][_0x9746('0x48')](_0x5bc3af)['then'](handleEntityNotFound(_0x2147f9,null))[_0x9746('0x25')](respondWithResult(_0x2147f9,null))[_0x9746('0x45')](handleError(_0x2147f9,null));};exports[_0x9746('0x49')]=function(_0x2d23e5,_0x182906){return db[_0x9746('0x41')][_0x9746('0x49')](_0x2d23e5[_0x9746('0x4a')],{})['then'](respondWithResult(_0x182906,0xc9))[_0x9746('0x45')](handleError(_0x182906,null));};exports[_0x9746('0x24')]=function(_0x177b88,_0x2ac459){if(_0x177b88[_0x9746('0x4a')]['id']){delete _0x177b88[_0x9746('0x4a')]['id'];}return db['ServicenowField'][_0x9746('0x48')]({'where':{'id':_0x177b88[_0x9746('0x47')]['id']}})[_0x9746('0x25')](handleEntityNotFound(_0x2ac459,null))[_0x9746('0x25')](saveUpdates(_0x177b88[_0x9746('0x4a')],null))[_0x9746('0x25')](respondWithResult(_0x2ac459,null))[_0x9746('0x45')](handleError(_0x2ac459,null));};exports[_0x9746('0x26')]=function(_0x1c0120,_0x3e1639){return db[_0x9746('0x41')][_0x9746('0x48')]({'where':{'id':_0x1c0120[_0x9746('0x47')]['id']}})[_0x9746('0x25')](handleEntityNotFound(_0x3e1639,null))[_0x9746('0x25')](removeEntity(_0x3e1639,null))[_0x9746('0x45')](handleError(_0x3e1639,null));}; \ No newline at end of file +var _0x52c9=['stack','name','index','map','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','length','nolimit','sort','where','filters','type','VIRTUAL','filter','merge','options','ServicenowField','include','findAll','rows','catch','show','params','keys','create','body','find','eml-format','rimraf','zip-dir','request-promise','util','path','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','destroy','then','error'];(function(_0x1dbef0,_0x4ac63c){var _0x2104bb=function(_0x497a2a){while(--_0x497a2a){_0x1dbef0['push'](_0x1dbef0['shift']());}};_0x2104bb(++_0x4ac63c);}(_0x52c9,0xad));var _0x952c=function(_0x2a4f76,_0x4f3aa8){_0x2a4f76=_0x2a4f76-0x0;var _0x58952b=_0x52c9[_0x2a4f76];return _0x58952b;};'use strict';var emlformat=require(_0x952c('0x0'));var rimraf=require(_0x952c('0x1'));var zipdir=require(_0x952c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x952c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x952c('0x4'));var path=require(_0x952c('0x5'));var sox=require(_0x952c('0x6'));var csv=require(_0x952c('0x7'));var ejs=require(_0x952c('0x8'));var fs=require('fs');var fs_extra=require(_0x952c('0x9'));var _=require('lodash');var squel=require(_0x952c('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x952c('0x7'));var querystring=require(_0x952c('0xb'));var Papa=require(_0x952c('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x952c('0xd'));var as=require(_0x952c('0xe'));var hardwareService=require(_0x952c('0xf'));var logger=require(_0x952c('0x10'))(_0x952c('0x11'));var utils=require(_0x952c('0x12'));var config=require(_0x952c('0x13'));var licenseUtil=require(_0x952c('0x14'));var db=require(_0x952c('0x15'))['db'];function respondWithStatusCode(_0x493377,_0x1e9f12){_0x1e9f12=_0x1e9f12||0xcc;return function(_0x50ba02){if(_0x50ba02){return _0x493377['sendStatus'](_0x1e9f12);}return _0x493377['status'](_0x1e9f12)[_0x952c('0x16')]();};}function respondWithResult(_0x24e789,_0x50001a){_0x50001a=_0x50001a||0xc8;return function(_0x32abc7){if(_0x32abc7){return _0x24e789['status'](_0x50001a)[_0x952c('0x17')](_0x32abc7);}};}function respondWithFilteredResult(_0x2b46a6,_0x7f5558){return function(_0x4d13aa){if(_0x4d13aa){var _0x27390c=typeof _0x7f5558[_0x952c('0x18')]===_0x952c('0x19')&&typeof _0x7f5558[_0x952c('0x1a')]===_0x952c('0x19');var _0x163c46=_0x4d13aa[_0x952c('0x1b')];var _0x5b3113=_0x27390c?0x0:_0x7f5558[_0x952c('0x18')];var _0xd48235=_0x27390c?_0x4d13aa[_0x952c('0x1b')]:_0x7f5558[_0x952c('0x18')]+_0x7f5558['limit'];var _0x443f50;if(_0xd48235>=_0x163c46){_0xd48235=_0x163c46;_0x443f50=0xc8;}else{_0x443f50=0xce;}_0x2b46a6[_0x952c('0x1c')](_0x443f50);return _0x2b46a6[_0x952c('0x1d')](_0x952c('0x1e'),_0x5b3113+'-'+_0xd48235+'/'+_0x163c46)[_0x952c('0x17')](_0x4d13aa);}return null;};}function patchUpdates(_0x48604f){return function(_0x12596d){try{jsonpatch[_0x952c('0x1f')](_0x12596d,_0x48604f,!![]);}catch(_0x2d900a){return BPromise['reject'](_0x2d900a);}return _0x12596d[_0x952c('0x20')]();};}function saveUpdates(_0x5a854e,_0x4bd07a){return function(_0x4ab4b0){if(_0x4ab4b0){return _0x4ab4b0[_0x952c('0x21')](_0x5a854e)['then'](function(_0x47ad5a){return _0x47ad5a;});}return null;};}function removeEntity(_0x9da9d1,_0x4123fc){return function(_0x544b17){if(_0x544b17){return _0x544b17[_0x952c('0x22')]()[_0x952c('0x23')](function(){_0x9da9d1[_0x952c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fdf78,_0x236f94){return function(_0x415ea5){if(!_0x415ea5){_0x1fdf78['sendStatus'](0x194);}return _0x415ea5;};}function handleError(_0x212558,_0x28173d){_0x28173d=_0x28173d||0x1f4;return function(_0x57f011){logger[_0x952c('0x24')](_0x57f011[_0x952c('0x25')]);if(_0x57f011['name']){delete _0x57f011[_0x952c('0x26')];}_0x212558[_0x952c('0x1c')](_0x28173d)['send'](_0x57f011);};}exports[_0x952c('0x27')]=function(_0x4ce298,_0x5e1381){var _0x449f73={},_0x1782bc={},_0x314838={'count':0x0,'rows':[]};var _0x2e739d=_[_0x952c('0x28')](db['ServicenowField'][_0x952c('0x29')],function(_0x214b23){return{'name':_0x214b23[_0x952c('0x2a')],'type':_0x214b23['type'][_0x952c('0x2b')]};});_0x1782bc[_0x952c('0x2c')]=_[_0x952c('0x28')](_0x2e739d,'name');_0x1782bc['query']=_['keys'](_0x4ce298[_0x952c('0x2d')]);_0x1782bc['filters']=_['intersection'](_0x1782bc[_0x952c('0x2c')],_0x1782bc[_0x952c('0x2d')]);_0x449f73[_0x952c('0x2e')]=_[_0x952c('0x2f')](_0x1782bc[_0x952c('0x2c')],qs['fields'](_0x4ce298['query'][_0x952c('0x30')]));_0x449f73[_0x952c('0x2e')]=_0x449f73[_0x952c('0x2e')][_0x952c('0x31')]?_0x449f73[_0x952c('0x2e')]:_0x1782bc[_0x952c('0x2c')];if(!_0x4ce298['query']['hasOwnProperty'](_0x952c('0x32'))){_0x449f73[_0x952c('0x1a')]=qs[_0x952c('0x1a')](_0x4ce298[_0x952c('0x2d')][_0x952c('0x1a')]);_0x449f73['offset']=qs[_0x952c('0x18')](_0x4ce298['query']['offset']);}_0x449f73['order']=qs[_0x952c('0x33')](_0x4ce298[_0x952c('0x2d')][_0x952c('0x33')]);_0x449f73[_0x952c('0x34')]=qs['filters'](_['pick'](_0x4ce298[_0x952c('0x2d')],_0x1782bc[_0x952c('0x35')]),_0x2e739d);if(_0x4ce298['query']['filter']){_0x449f73['where']=_['merge'](_0x449f73[_0x952c('0x34')],{'$or':_[_0x952c('0x28')](_0x2e739d,function(_0x54788c){if(_0x54788c[_0x952c('0x36')]!==_0x952c('0x37')){var _0x3b5739={};_0x3b5739[_0x54788c[_0x952c('0x26')]]={'$like':'%'+_0x4ce298['query'][_0x952c('0x38')]+'%'};return _0x3b5739;}})});}_0x449f73=_[_0x952c('0x39')]({},_0x449f73,_0x4ce298[_0x952c('0x3a')]);var _0x19f032={'where':_0x449f73['where']};return db[_0x952c('0x3b')][_0x952c('0x1b')](_0x19f032)['then'](function(_0x5bed91){_0x314838[_0x952c('0x1b')]=_0x5bed91;if(_0x4ce298['query']['includeAll']){_0x449f73[_0x952c('0x3c')]=[{'all':!![]}];}return db[_0x952c('0x3b')][_0x952c('0x3d')](_0x449f73);})['then'](function(_0x462d53){_0x314838[_0x952c('0x3e')]=_0x462d53;return _0x314838;})[_0x952c('0x23')](respondWithFilteredResult(_0x5e1381,_0x449f73))[_0x952c('0x3f')](handleError(_0x5e1381,null));};exports[_0x952c('0x40')]=function(_0x250291,_0x51b708){var _0x4a8323={'raw':!![],'where':{'id':_0x250291[_0x952c('0x41')]['id']}},_0x24c2b9={};_0x24c2b9[_0x952c('0x2c')]=_[_0x952c('0x42')](db[_0x952c('0x3b')]['rawAttributes']);_0x24c2b9['query']=_[_0x952c('0x42')](_0x250291['query']);_0x24c2b9[_0x952c('0x35')]=_[_0x952c('0x2f')](_0x24c2b9[_0x952c('0x2c')],_0x24c2b9['query']);_0x4a8323[_0x952c('0x2e')]=_['intersection'](_0x24c2b9[_0x952c('0x2c')],qs[_0x952c('0x30')](_0x250291[_0x952c('0x2d')][_0x952c('0x30')]));_0x4a8323[_0x952c('0x2e')]=_0x4a8323[_0x952c('0x2e')][_0x952c('0x31')]?_0x4a8323[_0x952c('0x2e')]:_0x24c2b9['model'];if(_0x250291[_0x952c('0x2d')]['includeAll']){_0x4a8323['include']=[{'all':!![]}];}_0x4a8323=_['merge']({},_0x4a8323,_0x250291[_0x952c('0x3a')]);return db['ServicenowField']['find'](_0x4a8323)[_0x952c('0x23')](handleEntityNotFound(_0x51b708,null))['then'](respondWithResult(_0x51b708,null))['catch'](handleError(_0x51b708,null));};exports[_0x952c('0x43')]=function(_0x579733,_0x4caada){return db[_0x952c('0x3b')]['create'](_0x579733[_0x952c('0x44')],{})[_0x952c('0x23')](respondWithResult(_0x4caada,0xc9))[_0x952c('0x3f')](handleError(_0x4caada,null));};exports['update']=function(_0x5cce94,_0x3c84ca){if(_0x5cce94[_0x952c('0x44')]['id']){delete _0x5cce94[_0x952c('0x44')]['id'];}return db[_0x952c('0x3b')][_0x952c('0x45')]({'where':{'id':_0x5cce94['params']['id']}})[_0x952c('0x23')](handleEntityNotFound(_0x3c84ca,null))[_0x952c('0x23')](saveUpdates(_0x5cce94[_0x952c('0x44')],null))[_0x952c('0x23')](respondWithResult(_0x3c84ca,null))['catch'](handleError(_0x3c84ca,null));};exports[_0x952c('0x22')]=function(_0x144575,_0x4f7726){return db[_0x952c('0x3b')][_0x952c('0x45')]({'where':{'id':_0x144575[_0x952c('0x41')]['id']}})[_0x952c('0x23')](handleEntityNotFound(_0x4f7726,null))['then'](removeEntity(_0x4f7726,null))[_0x952c('0x3f')](handleError(_0x4f7726,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index ea95e4f..ecb970b 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 _0xb692=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField'];(function(_0x1f2c15,_0x202189){var _0x16a8bf=function(_0x2dbdca){while(--_0x2dbdca){_0x1f2c15['push'](_0x1f2c15['shift']());}};_0x16a8bf(++_0x202189);}(_0xb692,0x159));var _0x2b69=function(_0x239b5a,_0x56199a){_0x239b5a=_0x239b5a-0x0;var _0x5a701c=_0xb692[_0x239b5a];return _0x5a701c;};'use strict';var _=require(_0x2b69('0x0'));var util=require(_0x2b69('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2b69('0x2'));var BPromise=require(_0x2b69('0x3'));var rp=require(_0x2b69('0x4'));var fs=require('fs');var path=require(_0x2b69('0x5'));var rimraf=require(_0x2b69('0x6'));var config=require(_0x2b69('0x7'));var attributes=require(_0x2b69('0x8'));module[_0x2b69('0x9')]=function(_0x390927,_0x532db0){return _0x390927[_0x2b69('0xa')](_0x2b69('0xb'),attributes,{'tableName':_0x2b69('0xc'),'paranoid':![],'indexes':[{'name':_0x2b69('0xd'),'fields':[_0x2b69('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x538a=['moment','request-promise','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x2105b6,_0x453fd2){var _0x2af5c5=function(_0x40f4d6){while(--_0x40f4d6){_0x2105b6['push'](_0x2105b6['shift']());}};_0x2af5c5(++_0x453fd2);}(_0x538a,0x141));var _0xa538=function(_0x492e07,_0x624a46){_0x492e07=_0x492e07-0x0;var _0x3be942=_0x538a[_0x492e07];return _0x3be942;};'use strict';var _=require(_0xa538('0x0'));var util=require(_0xa538('0x1'));var logger=require(_0xa538('0x2'))(_0xa538('0x3'));var moment=require(_0xa538('0x4'));var BPromise=require('bluebird');var rp=require(_0xa538('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intServicenowField.attributes');module[_0xa538('0x6')]=function(_0x413a11,_0x5e3df7){return _0x413a11[_0xa538('0x7')](_0xa538('0x8'),attributes,{'tableName':_0xa538('0x9'),'paranoid':![],'indexes':[{'name':_0xa538('0xa'),'fields':[_0xa538('0xb'),_0xa538('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 f88d99e..a1c641e 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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xac4a,0x13f));var _0xaac4=function(_0x1b76e4,_0x5053c6){_0x1b76e4=_0x1b76e4-0x0;var _0x2ffb11=_0xac4a[_0x1b76e4];return _0x2ffb11;};'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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x34dd61,_0x889792){var _0x22b125=function(_0x5546dd){while(--_0x5546dd){_0x34dd61['push'](_0x34dd61['shift']());}};_0x22b125(++_0x889792);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3916b0,_0x493e62){_0x3916b0=_0x3916b0-0x0;var _0x358328=_0xb43b[_0x3916b0];return _0x358328;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 60e3f7a..9012960 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(_0x56e1f7,_0x1d4032){var _0x514c4e=function(_0xfd786){while(--_0xfd786){_0x56e1f7['push'](_0x56e1f7['shift']());}};_0x514c4e(++_0x1d4032);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x5ef3e7,_0x26fca5){var _0x36e335=function(_0x2e845c){while(--_0x2e845c){_0x5ef3e7['push'](_0x5ef3e7['shift']());}};_0x36e335(++_0x26fca5);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 3d19c74..56c1ff1 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(_0x9beb1,_0x34afc3){var _0x184ac3=function(_0x33adb2){while(--_0x33adb2){_0x9beb1['push'](_0x9beb1['shift']());}};_0x184ac3(++_0x34afc3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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(_0x218e1d,_0x10503a){var _0x4eb2b2=function(_0x43e7dd){while(--_0x43e7dd){_0x218e1d['push'](_0x218e1d['shift']());}};_0x4eb2b2(++_0x10503a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 518df5f..41f8dd6 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 _0x89b9=['/service/v4_1/rest.php','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','get_module_fields','stringify','Calls','values','module_fields','remove','includes','label','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','limit','count','offset','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','show','params','keys','find','create','body','findOne','SugarcrmConfiguration','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s'];(function(_0x50c492,_0x5c1e67){var _0x3505a8=function(_0x2f7937){while(--_0x2f7937){_0x50c492['push'](_0x50c492['shift']());}};_0x3505a8(++_0x5c1e67);}(_0x89b9,0x17a));var _0x989b=function(_0x9ff494,_0x5ec484){_0x9ff494=_0x9ff494-0x0;var _0x2c91d9=_0x89b9[_0x9ff494];return _0x2c91d9;};'use strict';var emlformat=require(_0x989b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x989b('0x1'));var BPromise=require(_0x989b('0x2'));var Mustache=require(_0x989b('0x3'));var util=require(_0x989b('0x4'));var path=require('path');var sox=require(_0x989b('0x5'));var csv=require(_0x989b('0x6'));var ejs=require(_0x989b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x989b('0x8'));var squel=require('squel');var crypto=require(_0x989b('0x9'));var jsforce=require(_0x989b('0xa'));var deskjs=require(_0x989b('0xb'));var toCsv=require(_0x989b('0x6'));var querystring=require(_0x989b('0xc'));var Papa=require(_0x989b('0xd'));var Redis=require(_0x989b('0xe'));var authService=require(_0x989b('0xf'));var qs=require(_0x989b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x989b('0x11'));var logger=require(_0x989b('0x12'))(_0x989b('0x13'));var utils=require(_0x989b('0x14'));var config=require(_0x989b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x989b('0x16'))['db'];var integrations=require(_0x989b('0x17'));function respondWithStatusCode(_0x41f076,_0x2d71b1){_0x2d71b1=_0x2d71b1||0xcc;return function(_0x77d4b5){if(_0x77d4b5){return _0x41f076[_0x989b('0x18')](_0x2d71b1);}return _0x41f076['status'](_0x2d71b1)[_0x989b('0x19')]();};}function respondWithResult(_0x2d0782,_0x2a6f01){_0x2a6f01=_0x2a6f01||0xc8;return function(_0x5b5d42){if(_0x5b5d42){return _0x2d0782['status'](_0x2a6f01)[_0x989b('0x1a')](_0x5b5d42);}};}function respondWithFilteredResult(_0x3f869c,_0x2eb334){return function(_0x47761b){if(_0x47761b){var _0x17d6f5=typeof _0x2eb334['offset']==='undefined'&&typeof _0x2eb334[_0x989b('0x1b')]==='undefined';var _0x218166=_0x47761b[_0x989b('0x1c')];var _0x344042=_0x17d6f5?0x0:_0x2eb334[_0x989b('0x1d')];var _0x5b02c4=_0x17d6f5?_0x47761b['count']:_0x2eb334['offset']+_0x2eb334[_0x989b('0x1b')];var _0x3b77a3;if(_0x5b02c4>=_0x218166){_0x5b02c4=_0x218166;_0x3b77a3=0xc8;}else{_0x3b77a3=0xce;}_0x3f869c[_0x989b('0x1e')](_0x3b77a3);return _0x3f869c[_0x989b('0x1f')](_0x989b('0x20'),_0x344042+'-'+_0x5b02c4+'/'+_0x218166)[_0x989b('0x1a')](_0x47761b);}return null;};}function patchUpdates(_0x4acf24){return function(_0x363805){try{jsonpatch[_0x989b('0x21')](_0x363805,_0x4acf24,!![]);}catch(_0x31c9ed){return BPromise[_0x989b('0x22')](_0x31c9ed);}return _0x363805[_0x989b('0x23')]();};}function saveUpdates(_0x12b3e5,_0x2b34aa){return function(_0xe62f0){if(_0xe62f0){return _0xe62f0['update'](_0x12b3e5)[_0x989b('0x24')](function(_0x58eef9){return _0x58eef9;});}return null;};}function removeEntity(_0x464c3e,_0x196c67){return function(_0x1b3a68){if(_0x1b3a68){return _0x1b3a68[_0x989b('0x25')]()[_0x989b('0x24')](function(){_0x464c3e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b98e3,_0x41aeb3){return function(_0x3af973){if(!_0x3af973){_0x4b98e3['sendStatus'](0x194);}return _0x3af973;};}function handleError(_0x39d9a2,_0x5aac8d){_0x5aac8d=_0x5aac8d||0x1f4;return function(_0xce8c8b){logger[_0x989b('0x26')](_0xce8c8b[_0x989b('0x27')]);if(_0xce8c8b[_0x989b('0x28')]){delete _0xce8c8b[_0x989b('0x28')];}_0x39d9a2['status'](_0x5aac8d)[_0x989b('0x29')](_0xce8c8b);};}exports[_0x989b('0x2a')]=function(_0xfa4712,_0x5d4400){var _0x225455={},_0x418f32={},_0x1f667d={'count':0x0,'rows':[]};var _0x51db54=_[_0x989b('0x2b')](db[_0x989b('0x2c')][_0x989b('0x2d')],function(_0x4067dc){return{'name':_0x4067dc['fieldName'],'type':_0x4067dc['type'][_0x989b('0x2e')]};});_0x418f32[_0x989b('0x2f')]=_[_0x989b('0x2b')](_0x51db54,'name');_0x418f32[_0x989b('0x30')]=_['keys'](_0xfa4712[_0x989b('0x30')]);_0x418f32[_0x989b('0x31')]=_[_0x989b('0x32')](_0x418f32[_0x989b('0x2f')],_0x418f32[_0x989b('0x30')]);_0x225455['attributes']=_[_0x989b('0x32')](_0x418f32[_0x989b('0x2f')],qs[_0x989b('0x33')](_0xfa4712['query'][_0x989b('0x33')]));_0x225455[_0x989b('0x34')]=_0x225455[_0x989b('0x34')][_0x989b('0x35')]?_0x225455[_0x989b('0x34')]:_0x418f32[_0x989b('0x2f')];if(!_0xfa4712[_0x989b('0x30')]['hasOwnProperty'](_0x989b('0x36'))){_0x225455[_0x989b('0x1b')]=qs[_0x989b('0x1b')](_0xfa4712['query'][_0x989b('0x1b')]);_0x225455[_0x989b('0x1d')]=qs[_0x989b('0x1d')](_0xfa4712[_0x989b('0x30')][_0x989b('0x1d')]);}_0x225455[_0x989b('0x37')]=qs[_0x989b('0x38')](_0xfa4712['query'][_0x989b('0x38')]);_0x225455[_0x989b('0x39')]=qs['filters'](_[_0x989b('0x3a')](_0xfa4712[_0x989b('0x30')],_0x418f32[_0x989b('0x31')]),_0x51db54);if(_0xfa4712[_0x989b('0x30')]['filter']){_0x225455['where']=_[_0x989b('0x3b')](_0x225455[_0x989b('0x39')],{'$or':_[_0x989b('0x2b')](_0x51db54,function(_0x1fe4d1){if(_0x1fe4d1['type']!==_0x989b('0x3c')){var _0x8a03dd={};_0x8a03dd[_0x1fe4d1[_0x989b('0x28')]]={'$like':'%'+_0xfa4712[_0x989b('0x30')][_0x989b('0x3d')]+'%'};return _0x8a03dd;}})});}_0x225455=_['merge']({},_0x225455,_0xfa4712[_0x989b('0x3e')]);var _0x3150c6={'where':_0x225455['where']};return db[_0x989b('0x2c')]['count'](_0x3150c6)[_0x989b('0x24')](function(_0x441acc){_0x1f667d[_0x989b('0x1c')]=_0x441acc;if(_0xfa4712['query'][_0x989b('0x3f')]){_0x225455[_0x989b('0x40')]=[{'all':!![]}];}return db[_0x989b('0x2c')]['findAll'](_0x225455);})[_0x989b('0x24')](function(_0x248d5b){_0x1f667d['rows']=_0x248d5b;return _0x1f667d;})['then'](respondWithFilteredResult(_0x5d4400,_0x225455))[_0x989b('0x41')](handleError(_0x5d4400,null));};exports[_0x989b('0x42')]=function(_0x7b1abf,_0x5aa0f8){var _0xca14f2={'raw':![],'where':{'id':_0x7b1abf[_0x989b('0x43')]['id']}},_0x6350ea={};_0x6350ea[_0x989b('0x2f')]=_[_0x989b('0x44')](db[_0x989b('0x2c')][_0x989b('0x2d')]);_0x6350ea[_0x989b('0x30')]=_['keys'](_0x7b1abf[_0x989b('0x30')]);_0x6350ea[_0x989b('0x31')]=_[_0x989b('0x32')](_0x6350ea['model'],_0x6350ea['query']);_0xca14f2[_0x989b('0x34')]=_[_0x989b('0x32')](_0x6350ea['model'],qs[_0x989b('0x33')](_0x7b1abf['query'][_0x989b('0x33')]));_0xca14f2[_0x989b('0x34')]=_0xca14f2['attributes']['length']?_0xca14f2[_0x989b('0x34')]:_0x6350ea['model'];if(_0x7b1abf[_0x989b('0x30')][_0x989b('0x3f')]){_0xca14f2[_0x989b('0x40')]=[{'all':!![]}];}_0xca14f2=_['merge']({},_0xca14f2,_0x7b1abf[_0x989b('0x3e')]);return db['SugarcrmAccount'][_0x989b('0x45')](_0xca14f2)[_0x989b('0x24')](handleEntityNotFound(_0x5aa0f8,null))[_0x989b('0x24')](respondWithResult(_0x5aa0f8,null))[_0x989b('0x41')](handleError(_0x5aa0f8,null));};exports['create']=function(_0x5c7707,_0x58b0c8){return db['SugarcrmAccount'][_0x989b('0x46')](_0x5c7707[_0x989b('0x47')],{})[_0x989b('0x24')](respondWithResult(_0x58b0c8,0xc9))[_0x989b('0x41')](handleError(_0x58b0c8,null));};exports['update']=function(_0x3961d4,_0xbc6d78){if(_0x3961d4[_0x989b('0x47')]['id']){delete _0x3961d4[_0x989b('0x47')]['id'];}return db[_0x989b('0x2c')][_0x989b('0x45')]({'where':{'id':_0x3961d4[_0x989b('0x43')]['id']}})['then'](handleEntityNotFound(_0xbc6d78,null))['then'](saveUpdates(_0x3961d4['body'],null))[_0x989b('0x24')](respondWithResult(_0xbc6d78,null))['catch'](handleError(_0xbc6d78,null));};exports[_0x989b('0x25')]=function(_0x554e62,_0x588c2c){return db[_0x989b('0x2c')][_0x989b('0x45')]({'where':{'id':_0x554e62['params']['id']}})[_0x989b('0x24')](handleEntityNotFound(_0x588c2c,null))[_0x989b('0x24')](removeEntity(_0x588c2c,null))[_0x989b('0x41')](handleError(_0x588c2c,null));};exports['getConfigurations']=function(_0x5a359a,_0x32b38e,_0x451688){var _0x4d4d63={};var _0xf0a3fe={};var _0x10452f;var _0x3d60a6;return db[_0x989b('0x2c')][_0x989b('0x48')]({'where':{'id':_0x5a359a[_0x989b('0x43')]['id']}})[_0x989b('0x24')](handleEntityNotFound(_0x32b38e,null))[_0x989b('0x24')](function(_0x1c2a7e){if(_0x1c2a7e){_0x10452f=_0x1c2a7e;_0xf0a3fe[_0x989b('0x2f')]=_[_0x989b('0x44')](db[_0x989b('0x49')]['rawAttributes']);_0xf0a3fe[_0x989b('0x30')]=_[_0x989b('0x44')](_0x5a359a[_0x989b('0x30')]);_0xf0a3fe['filters']=_['intersection'](_0xf0a3fe[_0x989b('0x2f')],_0xf0a3fe[_0x989b('0x30')]);_0x4d4d63[_0x989b('0x34')]=_[_0x989b('0x32')](_0xf0a3fe[_0x989b('0x2f')],qs['fields'](_0x5a359a['query']['fields']));_0x4d4d63[_0x989b('0x34')]=_0x4d4d63['attributes'][_0x989b('0x35')]?_0x4d4d63[_0x989b('0x34')]:_0xf0a3fe['model'];_0x4d4d63[_0x989b('0x37')]=qs['sort'](_0x5a359a[_0x989b('0x30')][_0x989b('0x38')]);_0x4d4d63[_0x989b('0x39')]=qs[_0x989b('0x31')](_[_0x989b('0x3a')](_0x5a359a[_0x989b('0x30')],_0xf0a3fe[_0x989b('0x31')]));if(_0x5a359a['query'][_0x989b('0x3d')]){_0x4d4d63[_0x989b('0x39')]=_['merge'](_0x4d4d63['where'],{'$or':_[_0x989b('0x2b')](_0x4d4d63[_0x989b('0x34')],function(_0x3b6178){var _0x4f8f48={};_0x4f8f48[_0x3b6178]={'$like':'%'+_0x5a359a[_0x989b('0x30')][_0x989b('0x3d')]+'%'};return _0x4f8f48;})});}_0x4d4d63=_[_0x989b('0x3b')]({},_0x4d4d63,_0x5a359a[_0x989b('0x3e')]);return _0x10452f[_0x989b('0x4a')](_0x4d4d63);}})[_0x989b('0x24')](function(_0x4db922){if(_0x4db922){_0x3d60a6=_0x4db922[_0x989b('0x35')];if(!_0x5a359a[_0x989b('0x30')][_0x989b('0x4b')](_0x989b('0x36'))){_0x4d4d63[_0x989b('0x1b')]=qs['limit'](_0x5a359a[_0x989b('0x30')]['limit']);_0x4d4d63[_0x989b('0x1d')]=qs[_0x989b('0x1d')](_0x5a359a['query']['offset']);}return _0x10452f[_0x989b('0x4a')](_0x4d4d63);}})[_0x989b('0x24')](function(_0x1e7e83){if(_0x1e7e83){return _0x1e7e83?{'count':_0x3d60a6,'rows':_0x1e7e83}:null;}})[_0x989b('0x24')](respondWithResult(_0x32b38e,null))[_0x989b('0x41')](handleError(_0x32b38e,null));};exports[_0x989b('0x4c')]=function(_0x30c6d0,_0x53e5b6,_0x44ed86){if(_0x30c6d0[_0x989b('0x47')]['id']){delete _0x30c6d0[_0x989b('0x47')]['id'];}return db[_0x989b('0x2c')][_0x989b('0x48')]({'where':{'id':_0x30c6d0['params']['id']}})[_0x989b('0x24')](handleEntityNotFound(_0x53e5b6,null))[_0x989b('0x24')](function(_0x141dad){if(_0x141dad){_0x30c6d0[_0x989b('0x47')][_0x989b('0x4d')]=_0x141dad['id'];_0x30c6d0[_0x989b('0x47')][_0x989b('0x4e')]=integrations[_0x989b('0x4f')](_0x30c6d0[_0x989b('0x47')]['channel'],_0x30c6d0['body'][_0x989b('0x50')]);_0x30c6d0['body'][_0x989b('0x51')]=integrations[_0x989b('0x52')](_0x30c6d0[_0x989b('0x47')]['channel'],_0x30c6d0[_0x989b('0x47')][_0x989b('0x50')]);return db[_0x989b('0x49')][_0x989b('0x46')](_0x30c6d0['body'],{'include':[{'model':db[_0x989b('0x53')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0x989b('0x51')}]});}return null;})[_0x989b('0x24')](respondWithResult(_0x53e5b6,null))['catch'](handleError(_0x53e5b6,null));};exports[_0x989b('0x54')]=function(_0x3ca516,_0x3f43d7,_0x3f04d4){var _0x6db575='';var _0x4524c3=['id',_0x989b('0x28'),_0x989b('0x55'),_0x989b('0x56'),'description',_0x989b('0x57'),_0x989b('0x58'),_0x989b('0x59'),_0x989b('0x5a'),_0x989b('0x5b'),_0x989b('0x5c'),_0x989b('0x5d')];return db[_0x989b('0x2c')][_0x989b('0x48')]({'where':{'id':_0x3ca516['params']['id']},'attributes':['id',_0x989b('0x5e'),'password','remoteUri']})[_0x989b('0x24')](handleEntityNotFound(_0x3f43d7,null))[_0x989b('0x24')](function(_0x31c59d){if(_0x31c59d){_0x6db575=_0x31c59d[_0x989b('0x5f')];var _0x3f5823=_0x6db575[_0x989b('0x60')](-0x1);if(_0x3f5823==='/'){_0x6db575=_0x6db575[_0x989b('0x61')](0x0,_0x6db575[_0x989b('0x62')](_0x3f5823));}return rp({'method':_0x989b('0x63'),'uri':util[_0x989b('0x64')](_0x989b('0x65'),_0x6db575,_0x989b('0x66')),'json':!![],'form':{'method':'login','input_type':_0x989b('0x67'),'response_type':_0x989b('0x67'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x31c59d['username'],'password':_0x31c59d[_0x989b('0x68')],'encryption':_0x989b('0x69')},'application':_0x989b('0x6a')})}});}})['then'](function(_0x17d583){if(_0x17d583&&_0x17d583[_0x989b('0x28')]!=='Invalid\x20Login'&&_0x17d583[_0x989b('0x28')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util[_0x989b('0x64')](_0x989b('0x65'),_0x6db575,_0x989b('0x66')),'json':!![],'form':{'method':_0x989b('0x6b'),'input_type':_0x989b('0x67'),'response_type':_0x989b('0x67'),'rest_data':JSON[_0x989b('0x6c')]({'session':_0x17d583['id'],'module_name':_0x989b('0x6d')})}})['then'](function(_0x429808){if(_0x429808){var _0x100a10=_[_0x989b('0x6e')](_0x429808[_0x989b('0x6f')]);_[_0x989b('0x70')](_0x100a10,function(_0x408288){return _0x4524c3[_0x989b('0x71')](_0x408288[_0x989b('0x28')]);});return{'count':_0x100a10[_0x989b('0x35')],'rows':_['map'](_0x100a10,function(_0xac3570){return{'id':_0xac3570[_0x989b('0x28')],'name':_0xac3570[_0x989b('0x72')],'custom':_['endsWith'](_0xac3570[_0x989b('0x28')],'_c')?!![]:![],'options':_0xac3570[_0x989b('0x3e')]?_['map'](_[_0x989b('0x6e')](_0xac3570[_0x989b('0x3e')]),function(_0x21ddf5){return{'name':_0x21ddf5[_0x989b('0x73')],'value':_0x21ddf5['name']};}):[]};})};}})['then'](respondWithResult(_0x3f43d7,null))[_0x989b('0x41')](function(_0x4753d4){var _0x657222=_0x3ca516[_0x989b('0x30')]['test']?0x1f4:_0x4753d4[_0x989b('0x74')]||0x1f4;logger[_0x989b('0x26')](_0x989b('0x75'),_0x989b('0x54'),_0x657222,JSON[_0x989b('0x6c')](_0x4753d4));delete _0x4753d4[_0x989b('0x28')];if(_0x657222===0x191){_0x657222=0x190;}_0x3f43d7[_0x989b('0x1e')](_0x657222)['send'](_0x3ca516[_0x989b('0x30')][_0x989b('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x4753d4['statusCode']}:_0x4753d4);});}else{var _0x116fd1=0x1f4;_0x3f43d7[_0x989b('0x1e')](_0x116fd1)[_0x989b('0x29')]({'message':_0x989b('0x77'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xbb2e=['attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','length','include','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','channel','getDescriptions','SugarcrmField','Subjects','Descriptions','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_name','username','password','remoteUri','slice','lastIndexOf','format','%s%s','/service/v4_1/rest.php','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','stringify','Calls','values','includes','label','endsWith','value','test','statusCode','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SugarcrmAccount','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','fields'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbb2e,0xb0));var _0xebb2=function(_0x338e0c,_0x488aa4){_0x338e0c=_0x338e0c-0x0;var _0x2831fe=_0xbb2e[_0x338e0c];return _0x2831fe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xebb2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xebb2('0x1'));var rp=require(_0xebb2('0x2'));var moment=require(_0xebb2('0x3'));var BPromise=require(_0xebb2('0x4'));var Mustache=require(_0xebb2('0x5'));var util=require('util');var path=require(_0xebb2('0x6'));var sox=require(_0xebb2('0x7'));var csv=require(_0xebb2('0x8'));var ejs=require(_0xebb2('0x9'));var fs=require('fs');var fs_extra=require(_0xebb2('0xa'));var _=require('lodash');var squel=require(_0xebb2('0xb'));var crypto=require(_0xebb2('0xc'));var jsforce=require(_0xebb2('0xd'));var deskjs=require(_0xebb2('0xe'));var toCsv=require(_0xebb2('0x8'));var querystring=require(_0xebb2('0xf'));var Papa=require(_0xebb2('0x10'));var Redis=require('ioredis');var authService=require(_0xebb2('0x11'));var qs=require(_0xebb2('0x12'));var as=require(_0xebb2('0x13'));var hardwareService=require(_0xebb2('0x14'));var logger=require(_0xebb2('0x15'))(_0xebb2('0x16'));var utils=require(_0xebb2('0x17'));var config=require(_0xebb2('0x18'));var licenseUtil=require(_0xebb2('0x19'));var db=require(_0xebb2('0x1a'))['db'];var integrations=require(_0xebb2('0x1b'));function respondWithStatusCode(_0xa33668,_0x3f43f5){_0x3f43f5=_0x3f43f5||0xcc;return function(_0x5c1e8b){if(_0x5c1e8b){return _0xa33668[_0xebb2('0x1c')](_0x3f43f5);}return _0xa33668['status'](_0x3f43f5)[_0xebb2('0x1d')]();};}function respondWithResult(_0x5f3d1d,_0x192974){_0x192974=_0x192974||0xc8;return function(_0x36419b){if(_0x36419b){return _0x5f3d1d[_0xebb2('0x1e')](_0x192974)['json'](_0x36419b);}};}function respondWithFilteredResult(_0x64dfcf,_0x5894b4){return function(_0x2307ac){if(_0x2307ac){var _0x819225=typeof _0x5894b4[_0xebb2('0x1f')]==='undefined'&&typeof _0x5894b4[_0xebb2('0x20')]===_0xebb2('0x21');var _0xf4bf8b=_0x2307ac[_0xebb2('0x22')];var _0x1577e7=_0x819225?0x0:_0x5894b4[_0xebb2('0x1f')];var _0x5526fd=_0x819225?_0x2307ac['count']:_0x5894b4[_0xebb2('0x1f')]+_0x5894b4[_0xebb2('0x20')];var _0x20f164;if(_0x5526fd>=_0xf4bf8b){_0x5526fd=_0xf4bf8b;_0x20f164=0xc8;}else{_0x20f164=0xce;}_0x64dfcf[_0xebb2('0x1e')](_0x20f164);return _0x64dfcf['set'](_0xebb2('0x23'),_0x1577e7+'-'+_0x5526fd+'/'+_0xf4bf8b)['json'](_0x2307ac);}return null;};}function patchUpdates(_0x4e1838){return function(_0x1b4807){try{jsonpatch[_0xebb2('0x24')](_0x1b4807,_0x4e1838,!![]);}catch(_0x312898){return BPromise[_0xebb2('0x25')](_0x312898);}return _0x1b4807[_0xebb2('0x26')]();};}function saveUpdates(_0x21dd12,_0x417084){return function(_0x372de8){if(_0x372de8){return _0x372de8[_0xebb2('0x27')](_0x21dd12)[_0xebb2('0x28')](function(_0x3a8488){return _0x3a8488;});}return null;};}function removeEntity(_0x1fe040,_0x23c24c){return function(_0x992e68){if(_0x992e68){return _0x992e68[_0xebb2('0x29')]()[_0xebb2('0x28')](function(){_0x1fe040[_0xebb2('0x1e')](0xcc)[_0xebb2('0x1d')]();});}};}function handleEntityNotFound(_0x191000,_0x19ffe3){return function(_0x50d5fd){if(!_0x50d5fd){_0x191000[_0xebb2('0x1c')](0x194);}return _0x50d5fd;};}function handleError(_0x103996,_0x19a9f4){_0x19a9f4=_0x19a9f4||0x1f4;return function(_0x14c18c){logger[_0xebb2('0x2a')](_0x14c18c[_0xebb2('0x2b')]);if(_0x14c18c[_0xebb2('0x2c')]){delete _0x14c18c[_0xebb2('0x2c')];}_0x103996[_0xebb2('0x1e')](_0x19a9f4)[_0xebb2('0x2d')](_0x14c18c);};}exports[_0xebb2('0x2e')]=function(_0x1b32b0,_0x2f9e16){var _0xcfe0c6={},_0x3753dd={},_0x58b14b={'count':0x0,'rows':[]};var _0x140921=_['map'](db[_0xebb2('0x2f')][_0xebb2('0x30')],function(_0x2c29b6){return{'name':_0x2c29b6[_0xebb2('0x31')],'type':_0x2c29b6[_0xebb2('0x32')]['key']};});_0x3753dd['model']=_[_0xebb2('0x33')](_0x140921,'name');_0x3753dd[_0xebb2('0x34')]=_[_0xebb2('0x35')](_0x1b32b0[_0xebb2('0x34')]);_0x3753dd[_0xebb2('0x36')]=_[_0xebb2('0x37')](_0x3753dd[_0xebb2('0x38')],_0x3753dd[_0xebb2('0x34')]);_0xcfe0c6['attributes']=_[_0xebb2('0x37')](_0x3753dd[_0xebb2('0x38')],qs[_0xebb2('0x39')](_0x1b32b0[_0xebb2('0x34')][_0xebb2('0x39')]));_0xcfe0c6[_0xebb2('0x3a')]=_0xcfe0c6[_0xebb2('0x3a')]['length']?_0xcfe0c6[_0xebb2('0x3a')]:_0x3753dd[_0xebb2('0x38')];if(!_0x1b32b0['query'][_0xebb2('0x3b')]('nolimit')){_0xcfe0c6[_0xebb2('0x20')]=qs[_0xebb2('0x20')](_0x1b32b0['query']['limit']);_0xcfe0c6[_0xebb2('0x1f')]=qs['offset'](_0x1b32b0[_0xebb2('0x34')][_0xebb2('0x1f')]);}_0xcfe0c6[_0xebb2('0x3c')]=qs[_0xebb2('0x3d')](_0x1b32b0[_0xebb2('0x34')][_0xebb2('0x3d')]);_0xcfe0c6[_0xebb2('0x3e')]=qs[_0xebb2('0x36')](_['pick'](_0x1b32b0[_0xebb2('0x34')],_0x3753dd[_0xebb2('0x36')]),_0x140921);if(_0x1b32b0[_0xebb2('0x34')][_0xebb2('0x3f')]){_0xcfe0c6[_0xebb2('0x3e')]=_[_0xebb2('0x40')](_0xcfe0c6[_0xebb2('0x3e')],{'$or':_[_0xebb2('0x33')](_0x140921,function(_0x1329ee){if(_0x1329ee[_0xebb2('0x32')]!==_0xebb2('0x41')){var _0x3db148={};_0x3db148[_0x1329ee[_0xebb2('0x2c')]]={'$like':'%'+_0x1b32b0[_0xebb2('0x34')][_0xebb2('0x3f')]+'%'};return _0x3db148;}})});}_0xcfe0c6=_['merge']({},_0xcfe0c6,_0x1b32b0[_0xebb2('0x42')]);var _0x3f2aca={'where':_0xcfe0c6['where']};return db[_0xebb2('0x2f')]['count'](_0x3f2aca)['then'](function(_0x26737e){_0x58b14b[_0xebb2('0x22')]=_0x26737e;if(_0x1b32b0['query'][_0xebb2('0x43')]){_0xcfe0c6['include']=[{'all':!![]}];}return db[_0xebb2('0x2f')]['findAll'](_0xcfe0c6);})[_0xebb2('0x28')](function(_0x5db425){_0x58b14b[_0xebb2('0x44')]=_0x5db425;return _0x58b14b;})[_0xebb2('0x28')](respondWithFilteredResult(_0x2f9e16,_0xcfe0c6))[_0xebb2('0x45')](handleError(_0x2f9e16,null));};exports[_0xebb2('0x46')]=function(_0x55e15f,_0x2792f4){var _0x3cdc64={'raw':![],'where':{'id':_0x55e15f[_0xebb2('0x47')]['id']}},_0x4200bc={};_0x4200bc[_0xebb2('0x38')]=_[_0xebb2('0x35')](db[_0xebb2('0x2f')][_0xebb2('0x30')]);_0x4200bc[_0xebb2('0x34')]=_[_0xebb2('0x35')](_0x55e15f['query']);_0x4200bc[_0xebb2('0x36')]=_[_0xebb2('0x37')](_0x4200bc[_0xebb2('0x38')],_0x4200bc[_0xebb2('0x34')]);_0x3cdc64['attributes']=_[_0xebb2('0x37')](_0x4200bc[_0xebb2('0x38')],qs[_0xebb2('0x39')](_0x55e15f['query'][_0xebb2('0x39')]));_0x3cdc64[_0xebb2('0x3a')]=_0x3cdc64[_0xebb2('0x3a')][_0xebb2('0x48')]?_0x3cdc64[_0xebb2('0x3a')]:_0x4200bc['model'];if(_0x55e15f[_0xebb2('0x34')][_0xebb2('0x43')]){_0x3cdc64[_0xebb2('0x49')]=[{'all':!![]}];}_0x3cdc64=_[_0xebb2('0x40')]({},_0x3cdc64,_0x55e15f[_0xebb2('0x42')]);return db['SugarcrmAccount'][_0xebb2('0x4a')](_0x3cdc64)[_0xebb2('0x28')](handleEntityNotFound(_0x2792f4,null))[_0xebb2('0x28')](respondWithResult(_0x2792f4,null))[_0xebb2('0x45')](handleError(_0x2792f4,null));};exports[_0xebb2('0x4b')]=function(_0x1fc335,_0x45e5e0){return db[_0xebb2('0x2f')]['create'](_0x1fc335[_0xebb2('0x4c')],{})[_0xebb2('0x28')](respondWithResult(_0x45e5e0,0xc9))[_0xebb2('0x45')](handleError(_0x45e5e0,null));};exports['update']=function(_0x588447,_0x440fbd){if(_0x588447[_0xebb2('0x4c')]['id']){delete _0x588447[_0xebb2('0x4c')]['id'];}return db[_0xebb2('0x2f')][_0xebb2('0x4a')]({'where':{'id':_0x588447[_0xebb2('0x47')]['id']}})[_0xebb2('0x28')](handleEntityNotFound(_0x440fbd,null))[_0xebb2('0x28')](saveUpdates(_0x588447['body'],null))[_0xebb2('0x28')](respondWithResult(_0x440fbd,null))[_0xebb2('0x45')](handleError(_0x440fbd,null));};exports['destroy']=function(_0x4e2c6b,_0x48f856){return db[_0xebb2('0x2f')][_0xebb2('0x4a')]({'where':{'id':_0x4e2c6b[_0xebb2('0x47')]['id']}})[_0xebb2('0x28')](handleEntityNotFound(_0x48f856,null))['then'](removeEntity(_0x48f856,null))[_0xebb2('0x45')](handleError(_0x48f856,null));};exports[_0xebb2('0x4d')]=function(_0x1eb88c,_0x46e482,_0x16b9c8){var _0x1acd58={};var _0x542a37={};var _0x42fe3c;var _0x459555;return db[_0xebb2('0x2f')][_0xebb2('0x4e')]({'where':{'id':_0x1eb88c[_0xebb2('0x47')]['id']}})[_0xebb2('0x28')](handleEntityNotFound(_0x46e482,null))[_0xebb2('0x28')](function(_0x10a7ec){if(_0x10a7ec){_0x42fe3c=_0x10a7ec;_0x542a37[_0xebb2('0x38')]=_[_0xebb2('0x35')](db[_0xebb2('0x4f')]['rawAttributes']);_0x542a37[_0xebb2('0x34')]=_['keys'](_0x1eb88c[_0xebb2('0x34')]);_0x542a37[_0xebb2('0x36')]=_[_0xebb2('0x37')](_0x542a37['model'],_0x542a37[_0xebb2('0x34')]);_0x1acd58[_0xebb2('0x3a')]=_[_0xebb2('0x37')](_0x542a37[_0xebb2('0x38')],qs['fields'](_0x1eb88c[_0xebb2('0x34')]['fields']));_0x1acd58[_0xebb2('0x3a')]=_0x1acd58['attributes']['length']?_0x1acd58['attributes']:_0x542a37[_0xebb2('0x38')];_0x1acd58[_0xebb2('0x3c')]=qs[_0xebb2('0x3d')](_0x1eb88c['query'][_0xebb2('0x3d')]);_0x1acd58['where']=qs[_0xebb2('0x36')](_['pick'](_0x1eb88c[_0xebb2('0x34')],_0x542a37[_0xebb2('0x36')]));if(_0x1eb88c['query'][_0xebb2('0x3f')]){_0x1acd58[_0xebb2('0x3e')]=_[_0xebb2('0x40')](_0x1acd58['where'],{'$or':_['map'](_0x1acd58['attributes'],function(_0x4ff7c0){var _0x4f8c2b={};_0x4f8c2b[_0x4ff7c0]={'$like':'%'+_0x1eb88c[_0xebb2('0x34')]['filter']+'%'};return _0x4f8c2b;})});}_0x1acd58=_[_0xebb2('0x40')]({},_0x1acd58,_0x1eb88c[_0xebb2('0x42')]);return _0x42fe3c[_0xebb2('0x4d')](_0x1acd58);}})[_0xebb2('0x28')](function(_0x1bc1e2){if(_0x1bc1e2){_0x459555=_0x1bc1e2[_0xebb2('0x48')];if(!_0x1eb88c[_0xebb2('0x34')][_0xebb2('0x3b')]('nolimit')){_0x1acd58[_0xebb2('0x20')]=qs[_0xebb2('0x20')](_0x1eb88c['query'][_0xebb2('0x20')]);_0x1acd58['offset']=qs[_0xebb2('0x1f')](_0x1eb88c[_0xebb2('0x34')][_0xebb2('0x1f')]);}return _0x42fe3c[_0xebb2('0x4d')](_0x1acd58);}})['then'](function(_0x348b5b){if(_0x348b5b){return _0x348b5b?{'count':_0x459555,'rows':_0x348b5b}:null;}})['then'](respondWithResult(_0x46e482,null))[_0xebb2('0x45')](handleError(_0x46e482,null));};exports['addConfiguration']=function(_0x5a6311,_0x4da25d,_0x565f8b){if(_0x5a6311['body']['id']){delete _0x5a6311[_0xebb2('0x4c')]['id'];}return db[_0xebb2('0x2f')][_0xebb2('0x4e')]({'where':{'id':_0x5a6311['params']['id']}})[_0xebb2('0x28')](handleEntityNotFound(_0x4da25d,null))[_0xebb2('0x28')](function(_0x26a7ae){if(_0x26a7ae){_0x5a6311['body']['AccountId']=_0x26a7ae['id'];_0x5a6311[_0xebb2('0x4c')]['Subjects']=integrations['getSubjects'](_0x5a6311[_0xebb2('0x4c')][_0xebb2('0x50')],_0x5a6311[_0xebb2('0x4c')][_0xebb2('0x32')]);_0x5a6311['body']['Descriptions']=integrations[_0xebb2('0x51')](_0x5a6311[_0xebb2('0x4c')][_0xebb2('0x50')],_0x5a6311['body'][_0xebb2('0x32')]);return db['SugarcrmConfiguration']['create'](_0x5a6311[_0xebb2('0x4c')],{'include':[{'model':db[_0xebb2('0x52')],'as':_0xebb2('0x53')},{'model':db[_0xebb2('0x52')],'as':_0xebb2('0x54')}]});}return null;})['then'](respondWithResult(_0x4da25d,null))[_0xebb2('0x45')](handleError(_0x4da25d,null));};exports[_0xebb2('0x55')]=function(_0x438972,_0x5e4342,_0x3f6bb1){var _0x4ebc4a='';var _0x3d1deb=['id','name',_0xebb2('0x56'),_0xebb2('0x57'),_0xebb2('0x58'),'date_start',_0xebb2('0x59'),_0xebb2('0x5a'),_0xebb2('0x5b'),'parent_type',_0xebb2('0x5c'),'direction'];return db['SugarcrmAccount'][_0xebb2('0x4e')]({'where':{'id':_0x438972[_0xebb2('0x47')]['id']},'attributes':['id',_0xebb2('0x5d'),_0xebb2('0x5e'),_0xebb2('0x5f')]})[_0xebb2('0x28')](handleEntityNotFound(_0x5e4342,null))[_0xebb2('0x28')](function(_0x2b70b4){if(_0x2b70b4){_0x4ebc4a=_0x2b70b4[_0xebb2('0x5f')];var _0x567ead=_0x4ebc4a[_0xebb2('0x60')](-0x1);if(_0x567ead==='/'){_0x4ebc4a=_0x4ebc4a['substring'](0x0,_0x4ebc4a[_0xebb2('0x61')](_0x567ead));}return rp({'method':'POST','uri':util[_0xebb2('0x62')](_0xebb2('0x63'),_0x4ebc4a,_0xebb2('0x64')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0xebb2('0x65'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x2b70b4[_0xebb2('0x5d')],'password':_0x2b70b4[_0xebb2('0x5e')],'encryption':_0xebb2('0x66')},'application':_0xebb2('0x67')})}});}})[_0xebb2('0x28')](function(_0x28a66d){if(_0x28a66d&&_0x28a66d[_0xebb2('0x2c')]!==_0xebb2('0x68')&&_0x28a66d['name']!==_0xebb2('0x69')){return rp({'method':_0xebb2('0x6a'),'uri':util[_0xebb2('0x62')](_0xebb2('0x63'),_0x4ebc4a,_0xebb2('0x64')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xebb2('0x65'),'response_type':_0xebb2('0x65'),'rest_data':JSON[_0xebb2('0x6b')]({'session':_0x28a66d['id'],'module_name':_0xebb2('0x6c')})}})[_0xebb2('0x28')](function(_0x5dd10b){if(_0x5dd10b){var _0x1b9183=_[_0xebb2('0x6d')](_0x5dd10b['module_fields']);_['remove'](_0x1b9183,function(_0xeef354){return _0x3d1deb[_0xebb2('0x6e')](_0xeef354['name']);});return{'count':_0x1b9183[_0xebb2('0x48')],'rows':_['map'](_0x1b9183,function(_0x50f4da){return{'id':_0x50f4da[_0xebb2('0x2c')],'name':_0x50f4da[_0xebb2('0x6f')],'custom':_[_0xebb2('0x70')](_0x50f4da[_0xebb2('0x2c')],'_c')?!![]:![],'options':_0x50f4da[_0xebb2('0x42')]?_[_0xebb2('0x33')](_['values'](_0x50f4da[_0xebb2('0x42')]),function(_0x7c1b66){return{'name':_0x7c1b66[_0xebb2('0x71')],'value':_0x7c1b66['name']};}):[]};})};}})[_0xebb2('0x28')](respondWithResult(_0x5e4342,null))[_0xebb2('0x45')](function(_0x3b7f18){var _0x11bb75=_0x438972[_0xebb2('0x34')][_0xebb2('0x72')]?0x1f4:_0x3b7f18[_0xebb2('0x73')]||0x1f4;logger[_0xebb2('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0xebb2('0x55'),_0x11bb75,JSON[_0xebb2('0x6b')](_0x3b7f18));delete _0x3b7f18[_0xebb2('0x2c')];if(_0x11bb75===0x191){_0x11bb75=0x190;}_0x5e4342[_0xebb2('0x1e')](_0x11bb75)[_0xebb2('0x2d')](_0x438972['query'][_0xebb2('0x72')]?{'message':_0xebb2('0x74'),'statusCode':_0x3b7f18[_0xebb2('0x73')]}:_0x3b7f18);});}else{var _0x1acf7a=0x1f4;_0x5e4342['status'](_0x1acf7a)['send']({'message':_0xebb2('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 ce4fcf6..4d6a86d 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 _0x486e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util'];(function(_0x2c366f,_0x1bd4f8){var _0x180634=function(_0x5dcd2c){while(--_0x5dcd2c){_0x2c366f['push'](_0x2c366f['shift']());}};_0x180634(++_0x1bd4f8);}(_0x486e,0xb2));var _0xe486=function(_0x31c421,_0x305720){_0x31c421=_0x31c421-0x0;var _0x403e17=_0x486e[_0x31c421];return _0x403e17;};'use strict';var _=require(_0xe486('0x0'));var util=require(_0xe486('0x1'));var logger=require('../../config/logger')(_0xe486('0x2'));var moment=require(_0xe486('0x3'));var BPromise=require(_0xe486('0x4'));var rp=require(_0xe486('0x5'));var fs=require('fs');var path=require(_0xe486('0x6'));var rimraf=require(_0xe486('0x7'));var config=require(_0xe486('0x8'));var attributes=require(_0xe486('0x9'));var integrations=require(_0xe486('0xa'));module[_0xe486('0xb')]=function(_0x1bf55d,_0x4fac5d){return _0x1bf55d[_0xe486('0xc')](_0xe486('0xd'),attributes,{'tableName':_0xe486('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb71=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x1d1967,_0x52b368){var _0x5d6ce0=function(_0x41f793){while(--_0x41f793){_0x1d1967['push'](_0x1d1967['shift']());}};_0x5d6ce0(++_0x52b368);}(_0xdb71,0x150));var _0x1db7=function(_0x45e26e,_0x46238e){_0x45e26e=_0x45e26e-0x0;var _0x5cdbb7=_0xdb71[_0x45e26e];return _0x5cdbb7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1db7('0x0'))(_0x1db7('0x1'));var moment=require('moment');var BPromise=require(_0x1db7('0x2'));var rp=require(_0x1db7('0x3'));var fs=require('fs');var path=require(_0x1db7('0x4'));var rimraf=require(_0x1db7('0x5'));var config=require(_0x1db7('0x6'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x25e474,_0xc50e14){return _0x25e474[_0x1db7('0x7')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','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 bf4737f..37c52d6 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 _0x0d68=['model','GetSugarcrmAccount','ShowSugarcrmAccount','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SugarcrmAccount','findAll','options','where','attributes','limit','include','map'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x0d68,0x1a9));var _0x80d6=function(_0x50aeaf,_0x2f0d49){_0x50aeaf=_0x50aeaf-0x0;var _0x49ae10=_0x0d68[_0x50aeaf];return _0x49ae10;};'use strict';var _=require(_0x80d6('0x0'));var util=require(_0x80d6('0x1'));var moment=require(_0x80d6('0x2'));var BPromise=require('bluebird');var rs=require(_0x80d6('0x3'));var fs=require('fs');var Redis=require(_0x80d6('0x4'));var db=require(_0x80d6('0x5'))['db'];var utils=require(_0x80d6('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x80d6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x80d6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d2cc6,_0x2d1bca,_0x24f77c){return new BPromise(function(_0x1ac212,_0x4801cb){return client[_0x80d6('0x9')](_0x2d2cc6,_0x24f77c)[_0x80d6('0xa')](function(_0xa4f6d2){logger[_0x80d6('0xb')](_0x80d6('0xc'),_0x2d1bca,_0x80d6('0xd'));logger[_0x80d6('0xe')](_0x80d6('0xf'),_0x2d1bca,_0x80d6('0xd'),JSON[_0x80d6('0x10')](_0xa4f6d2));if(_0xa4f6d2[_0x80d6('0x11')]){if(_0xa4f6d2[_0x80d6('0x11')][_0x80d6('0x12')]===0x1f4){logger[_0x80d6('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x2d1bca,_0xa4f6d2[_0x80d6('0x11')]['message']);return _0x4801cb(_0xa4f6d2[_0x80d6('0x11')][_0x80d6('0x13')]);}logger[_0x80d6('0x11')](_0x80d6('0xc'),_0x2d1bca,_0xa4f6d2[_0x80d6('0x11')][_0x80d6('0x13')]);return _0x1ac212(_0xa4f6d2['error'][_0x80d6('0x13')]);}else{logger[_0x80d6('0xb')](_0x80d6('0xc'),_0x2d1bca,_0x80d6('0xd'));_0x1ac212(_0xa4f6d2[_0x80d6('0x14')]['message']);}})[_0x80d6('0x15')](function(_0x3d152b){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x2d1bca,_0x3d152b);_0x4801cb(_0x3d152b);});});}exports['GetSugarcrmAccount']=function(_0x1500e2){var _0x12a657=this;return new Promise(function(_0xa2b65a,_0x59830a){return db[_0x80d6('0x16')][_0x80d6('0x17')]({'raw':_0x1500e2[_0x80d6('0x18')]?_0x1500e2['options']['raw']===undefined?!![]:![]:!![],'where':_0x1500e2['options']?_0x1500e2[_0x80d6('0x18')][_0x80d6('0x19')]||null:null,'attributes':_0x1500e2[_0x80d6('0x18')]?_0x1500e2[_0x80d6('0x18')][_0x80d6('0x1a')]||null:null,'limit':_0x1500e2[_0x80d6('0x18')]?_0x1500e2['options'][_0x80d6('0x1b')]||null:null,'include':_0x1500e2[_0x80d6('0x18')]?_0x1500e2[_0x80d6('0x18')][_0x80d6('0x1c')]?_['map'](_0x1500e2[_0x80d6('0x18')][_0x80d6('0x1c')],function(_0x129e8a){return{'model':db[_0x129e8a['model']],'as':_0x129e8a['as'],'attributes':_0x129e8a[_0x80d6('0x1a')],'include':_0x129e8a[_0x80d6('0x1c')]?_[_0x80d6('0x1d')](_0x129e8a[_0x80d6('0x1c')],function(_0x1395db){return{'model':db[_0x1395db['model']],'as':_0x1395db['as'],'attributes':_0x1395db['attributes'],'include':_0x1395db[_0x80d6('0x1c')]?_[_0x80d6('0x1d')](_0x1395db[_0x80d6('0x1c')],function(_0x3d8041){return{'model':db[_0x3d8041[_0x80d6('0x1e')]],'as':_0x3d8041['as'],'attributes':_0x3d8041[_0x80d6('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f7cce){logger[_0x80d6('0xb')](_0x80d6('0x1f'),_0x1500e2);logger[_0x80d6('0xe')](_0x80d6('0x1f'),_0x1500e2,JSON['stringify'](_0x4f7cce));_0xa2b65a(_0x4f7cce);})[_0x80d6('0x15')](function(_0x253b12){logger['error'](_0x80d6('0x1f'),_0x253b12[_0x80d6('0x13')],_0x1500e2);_0x59830a(_0x12a657[_0x80d6('0x11')](0x1f4,_0x253b12[_0x80d6('0x13')]));});});};exports[_0x80d6('0x20')]=function(_0x5b6da0){var _0x2fba4f=this;return new Promise(function(_0x1aa1c7,_0xeee2b3){return db[_0x80d6('0x16')][_0x80d6('0x21')]({'raw':_0x5b6da0['options']?_0x5b6da0[_0x80d6('0x18')][_0x80d6('0x22')]===undefined?!![]:![]:!![],'where':_0x5b6da0['options']?_0x5b6da0['options'][_0x80d6('0x19')]||null:null,'attributes':_0x5b6da0[_0x80d6('0x18')]?_0x5b6da0[_0x80d6('0x18')][_0x80d6('0x1a')]||null:null,'include':_0x5b6da0['options']?_0x5b6da0[_0x80d6('0x18')][_0x80d6('0x1c')]?_[_0x80d6('0x1d')](_0x5b6da0[_0x80d6('0x18')][_0x80d6('0x1c')],function(_0x2f1d71){return{'model':db[_0x2f1d71['model']],'as':_0x2f1d71['as'],'attributes':_0x2f1d71[_0x80d6('0x1a')],'include':_0x2f1d71['include']?_[_0x80d6('0x1d')](_0x2f1d71[_0x80d6('0x1c')],function(_0x59eeb1){return{'model':db[_0x59eeb1[_0x80d6('0x1e')]],'as':_0x59eeb1['as'],'attributes':_0x59eeb1['attributes'],'include':_0x59eeb1['include']?_['map'](_0x59eeb1[_0x80d6('0x1c')],function(_0x5ec3ac){return{'model':db[_0x5ec3ac['model']],'as':_0x5ec3ac['as'],'attributes':_0x5ec3ac[_0x80d6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x80d6('0xa')](function(_0x411887){logger[_0x80d6('0xb')](_0x80d6('0x20'),_0x5b6da0);logger['debug']('ShowSugarcrmAccount',_0x5b6da0,JSON['stringify'](_0x411887));_0x1aa1c7(_0x411887);})[_0x80d6('0x15')](function(_0x31cae1){logger[_0x80d6('0x11')]('ShowSugarcrmAccount',_0x31cae1[_0x80d6('0x13')],_0x5b6da0);_0xeee2b3(_0x2fba4f['error'](0x1f4,_0x31cae1[_0x80d6('0x13')]));});});}; \ No newline at end of file +var _0xb020=['where','attributes','map','include','model','catch','SugarcrmAccount','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetSugarcrmAccount','findAll','options','raw'];(function(_0x153322,_0x42cfcc){var _0x4a89d1=function(_0x4d079c){while(--_0x4d079c){_0x153322['push'](_0x153322['shift']());}};_0x4a89d1(++_0x42cfcc);}(_0xb020,0x1dc));var _0x0b02=function(_0x5c3ae9,_0x450f9a){_0x5c3ae9=_0x5c3ae9-0x0;var _0x3f5950=_0xb020[_0x5c3ae9];return _0x3f5950;};'use strict';var _=require(_0x0b02('0x0'));var util=require(_0x0b02('0x1'));var moment=require(_0x0b02('0x2'));var BPromise=require(_0x0b02('0x3'));var rs=require(_0x0b02('0x4'));var fs=require('fs');var Redis=require(_0x0b02('0x5'));var db=require(_0x0b02('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0b02('0x7'))(_0x0b02('0x8'));var config=require(_0x0b02('0x9'));var jayson=require(_0x0b02('0xa'));var client=jayson[_0x0b02('0xb')][_0x0b02('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a7cda,_0x5867fc,_0x28cd57){return new BPromise(function(_0x1d4ba6,_0x50fd39){return client[_0x0b02('0xd')](_0x1a7cda,_0x28cd57)[_0x0b02('0xe')](function(_0x4f821d){logger[_0x0b02('0xf')](_0x0b02('0x10'),_0x5867fc,_0x0b02('0x11'));logger[_0x0b02('0x12')](_0x0b02('0x13'),_0x5867fc,_0x0b02('0x11'),JSON[_0x0b02('0x14')](_0x4f821d));if(_0x4f821d[_0x0b02('0x15')]){if(_0x4f821d[_0x0b02('0x15')]['code']===0x1f4){logger[_0x0b02('0x15')](_0x0b02('0x10'),_0x5867fc,_0x4f821d[_0x0b02('0x15')][_0x0b02('0x16')]);return _0x50fd39(_0x4f821d['error'][_0x0b02('0x16')]);}logger[_0x0b02('0x15')](_0x0b02('0x10'),_0x5867fc,_0x4f821d[_0x0b02('0x15')][_0x0b02('0x16')]);return _0x1d4ba6(_0x4f821d[_0x0b02('0x15')][_0x0b02('0x16')]);}else{logger[_0x0b02('0xf')](_0x0b02('0x10'),_0x5867fc,_0x0b02('0x11'));_0x1d4ba6(_0x4f821d[_0x0b02('0x17')][_0x0b02('0x16')]);}})['catch'](function(_0x2fa5ff){logger[_0x0b02('0x15')](_0x0b02('0x10'),_0x5867fc,_0x2fa5ff);_0x50fd39(_0x2fa5ff);});});}exports[_0x0b02('0x18')]=function(_0x476cd1){var _0xf2a454=this;return new Promise(function(_0x4412e9,_0x3a0871){return db['SugarcrmAccount'][_0x0b02('0x19')]({'raw':_0x476cd1[_0x0b02('0x1a')]?_0x476cd1[_0x0b02('0x1a')][_0x0b02('0x1b')]===undefined?!![]:![]:!![],'where':_0x476cd1['options']?_0x476cd1[_0x0b02('0x1a')][_0x0b02('0x1c')]||null:null,'attributes':_0x476cd1[_0x0b02('0x1a')]?_0x476cd1[_0x0b02('0x1a')][_0x0b02('0x1d')]||null:null,'limit':_0x476cd1[_0x0b02('0x1a')]?_0x476cd1[_0x0b02('0x1a')]['limit']||null:null,'include':_0x476cd1[_0x0b02('0x1a')]?_0x476cd1[_0x0b02('0x1a')]['include']?_[_0x0b02('0x1e')](_0x476cd1[_0x0b02('0x1a')][_0x0b02('0x1f')],function(_0x233a20){return{'model':db[_0x233a20[_0x0b02('0x20')]],'as':_0x233a20['as'],'attributes':_0x233a20[_0x0b02('0x1d')],'include':_0x233a20[_0x0b02('0x1f')]?_[_0x0b02('0x1e')](_0x233a20[_0x0b02('0x1f')],function(_0x917ea0){return{'model':db[_0x917ea0['model']],'as':_0x917ea0['as'],'attributes':_0x917ea0[_0x0b02('0x1d')],'include':_0x917ea0[_0x0b02('0x1f')]?_[_0x0b02('0x1e')](_0x917ea0[_0x0b02('0x1f')],function(_0x11a87b){return{'model':db[_0x11a87b[_0x0b02('0x20')]],'as':_0x11a87b['as'],'attributes':_0x11a87b[_0x0b02('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0b02('0xe')](function(_0x13cbd6){logger[_0x0b02('0xf')](_0x0b02('0x18'),_0x476cd1);logger['debug'](_0x0b02('0x18'),_0x476cd1,JSON[_0x0b02('0x14')](_0x13cbd6));_0x4412e9(_0x13cbd6);})[_0x0b02('0x21')](function(_0xc08ebf){logger[_0x0b02('0x15')](_0x0b02('0x18'),_0xc08ebf[_0x0b02('0x16')],_0x476cd1);_0x3a0871(_0xf2a454[_0x0b02('0x15')](0x1f4,_0xc08ebf[_0x0b02('0x16')]));});});};exports['ShowSugarcrmAccount']=function(_0x34cff2){var _0x4238fb=this;return new Promise(function(_0xc00112,_0x559976){return db[_0x0b02('0x22')]['find']({'raw':_0x34cff2[_0x0b02('0x1a')]?_0x34cff2[_0x0b02('0x1a')][_0x0b02('0x1b')]===undefined?!![]:![]:!![],'where':_0x34cff2[_0x0b02('0x1a')]?_0x34cff2[_0x0b02('0x1a')][_0x0b02('0x1c')]||null:null,'attributes':_0x34cff2[_0x0b02('0x1a')]?_0x34cff2[_0x0b02('0x1a')][_0x0b02('0x1d')]||null:null,'include':_0x34cff2['options']?_0x34cff2[_0x0b02('0x1a')][_0x0b02('0x1f')]?_[_0x0b02('0x1e')](_0x34cff2[_0x0b02('0x1a')][_0x0b02('0x1f')],function(_0x3090bb){return{'model':db[_0x3090bb[_0x0b02('0x20')]],'as':_0x3090bb['as'],'attributes':_0x3090bb['attributes'],'include':_0x3090bb[_0x0b02('0x1f')]?_[_0x0b02('0x1e')](_0x3090bb[_0x0b02('0x1f')],function(_0x408c45){return{'model':db[_0x408c45[_0x0b02('0x20')]],'as':_0x408c45['as'],'attributes':_0x408c45[_0x0b02('0x1d')],'include':_0x408c45[_0x0b02('0x1f')]?_['map'](_0x408c45[_0x0b02('0x1f')],function(_0x591246){return{'model':db[_0x591246[_0x0b02('0x20')]],'as':_0x591246['as'],'attributes':_0x591246[_0x0b02('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0b02('0xe')](function(_0x41785e){logger[_0x0b02('0xf')](_0x0b02('0x23'),_0x34cff2);logger[_0x0b02('0x12')](_0x0b02('0x23'),_0x34cff2,JSON['stringify'](_0x41785e));_0xc00112(_0x41785e);})[_0x0b02('0x21')](function(_0x5e5653){logger['error'](_0x0b02('0x23'),_0x5e5653[_0x0b02('0x16')],_0x34cff2);_0x559976(_0x4238fb[_0x0b02('0x15')](0x1f4,_0x5e5653[_0x0b02('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index e2c6398..e2a4dd4 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 _0xd807=['get','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller'];(function(_0x1d1930,_0x4cf0c2){var _0x4e6c46=function(_0x1a7dac){while(--_0x1a7dac){_0x1d1930['push'](_0x1d1930['shift']());}};_0x4e6c46(++_0x4cf0c2);}(_0xd807,0x6f));var _0x7d80=function(_0x167c47,_0x3b18ff){_0x167c47=_0x167c47-0x0;var _0x405f11=_0xd807[_0x167c47];return _0x405f11;};'use strict';var multer=require(_0x7d80('0x0'));var util=require(_0x7d80('0x1'));var path=require('path');var timeout=require(_0x7d80('0x2'));var express=require(_0x7d80('0x3'));var router=express[_0x7d80('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7d80('0x5'));var interaction=require(_0x7d80('0x6'));var config=require(_0x7d80('0x7'));var controller=require(_0x7d80('0x8'));router[_0x7d80('0x9')]('/',auth[_0x7d80('0xa')](),controller['index']);router[_0x7d80('0x9')]('/:id',auth[_0x7d80('0xa')](),controller['show']);router['get'](_0x7d80('0xb'),auth[_0x7d80('0xa')](),controller[_0x7d80('0xc')]);router[_0x7d80('0x9')]('/:id/subjects',auth[_0x7d80('0xa')](),controller[_0x7d80('0xd')]);router[_0x7d80('0x9')](_0x7d80('0xe'),auth[_0x7d80('0xa')](),controller[_0x7d80('0xf')]);router[_0x7d80('0x10')]('/',auth[_0x7d80('0xa')](),controller[_0x7d80('0x11')]);router[_0x7d80('0x12')](_0x7d80('0x13'),auth['isAuthenticated'](),controller[_0x7d80('0x14')]);router[_0x7d80('0x15')](_0x7d80('0x13'),auth[_0x7d80('0xa')](),controller[_0x7d80('0x16')]);module[_0x7d80('0x17')]=router; \ No newline at end of file +var _0xdb66=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','exports','multer','util','path','express'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xdb66,0x1dc));var _0x6db6=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xdb66[_0x1fc122];return _0xa2cb13;};'use strict';var multer=require(_0x6db6('0x0'));var util=require(_0x6db6('0x1'));var path=require(_0x6db6('0x2'));var timeout=require('connect-timeout');var express=require(_0x6db6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6db6('0x4'));var interaction=require(_0x6db6('0x5'));var config=require(_0x6db6('0x6'));var controller=require(_0x6db6('0x7'));router[_0x6db6('0x8')]('/',auth[_0x6db6('0x9')](),controller['index']);router[_0x6db6('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x6db6('0xa')]);router[_0x6db6('0x8')](_0x6db6('0xb'),auth['isAuthenticated'](),controller[_0x6db6('0xc')]);router[_0x6db6('0x8')](_0x6db6('0xd'),auth[_0x6db6('0x9')](),controller[_0x6db6('0xe')]);router[_0x6db6('0x8')](_0x6db6('0xf'),auth[_0x6db6('0x9')](),controller[_0x6db6('0x10')]);router[_0x6db6('0x11')]('/',auth[_0x6db6('0x9')](),controller[_0x6db6('0x12')]);router[_0x6db6('0x13')](_0x6db6('0x14'),auth['isAuthenticated'](),controller[_0x6db6('0x15')]);router[_0x6db6('0x16')](_0x6db6('0x14'),auth[_0x6db6('0x9')](),controller['destroy']);module[_0x6db6('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index e101932..614ff73 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 _0xfb85=['exports','STRING'];(function(_0x315d84,_0x3dacc3){var _0x560da1=function(_0x22ccb0){while(--_0x22ccb0){_0x315d84['push'](_0x315d84['shift']());}};_0x560da1(++_0x3dacc3);}(_0xfb85,0x120));var _0x5fb8=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xfb85[_0xdea41a];return _0x15d0d8;};'use strict';var Sequelize=require('sequelize');module[_0x5fb8('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5fb8('0x1')]}}; \ No newline at end of file +var _0xb1e0=['sequelize','STRING'];(function(_0x1e9827,_0x4c26e6){var _0x84e342=function(_0x20aecb){while(--_0x20aecb){_0x1e9827['push'](_0x1e9827['shift']());}};_0x84e342(++_0x4c26e6);}(_0xb1e0,0x6a));var _0x0b1e=function(_0x59ac85,_0x27e3c8){_0x59ac85=_0x59ac85-0x0;var _0x18911e=_0xb1e0[_0x59ac85];return _0x18911e;};'use strict';var Sequelize=require(_0x0b1e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0b1e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 9d23bf0..c08b412 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 _0x06ec=['fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','save','update','then','error','name','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','options','includeAll','include','findAll','rows','catch','params','merge','find','create','body','destroy','getFields','findOne','SugarcrmField','getSubjects','pick','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox'];(function(_0x32293f,_0x6ac095){var _0x3e0d02=function(_0x25856f){while(--_0x25856f){_0x32293f['push'](_0x32293f['shift']());}};_0x3e0d02(++_0x6ac095);}(_0x06ec,0x183));var _0xc06e=function(_0x32067a,_0x3288d6){_0x32067a=_0x32067a-0x0;var _0x309922=_0x06ec[_0x32067a];return _0x309922;};'use strict';var emlformat=require(_0xc06e('0x0'));var rimraf=require(_0xc06e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc06e('0x2'));var rp=require(_0xc06e('0x3'));var moment=require(_0xc06e('0x4'));var BPromise=require(_0xc06e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc06e('0x6'));var sox=require(_0xc06e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc06e('0x8'));var _=require(_0xc06e('0x9'));var squel=require('squel');var crypto=require(_0xc06e('0xa'));var jsforce=require(_0xc06e('0xb'));var deskjs=require(_0xc06e('0xc'));var toCsv=require(_0xc06e('0xd'));var querystring=require(_0xc06e('0xe'));var Papa=require(_0xc06e('0xf'));var Redis=require(_0xc06e('0x10'));var authService=require(_0xc06e('0x11'));var qs=require(_0xc06e('0x12'));var as=require(_0xc06e('0x13'));var hardwareService=require(_0xc06e('0x14'));var logger=require(_0xc06e('0x15'))(_0xc06e('0x16'));var utils=require(_0xc06e('0x17'));var config=require(_0xc06e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc06e('0x19'))['db'];function respondWithStatusCode(_0x294a1b,_0x3bf4d4){_0x3bf4d4=_0x3bf4d4||0xcc;return function(_0x3b5cdb){if(_0x3b5cdb){return _0x294a1b[_0xc06e('0x1a')](_0x3bf4d4);}return _0x294a1b[_0xc06e('0x1b')](_0x3bf4d4)[_0xc06e('0x1c')]();};}function respondWithResult(_0x470a07,_0x3d5f32){_0x3d5f32=_0x3d5f32||0xc8;return function(_0x1c8efa){if(_0x1c8efa){return _0x470a07[_0xc06e('0x1b')](_0x3d5f32)[_0xc06e('0x1d')](_0x1c8efa);}};}function respondWithFilteredResult(_0x4daf37,_0x1c08c7){return function(_0x5c9cb4){if(_0x5c9cb4){var _0x473b9f=typeof _0x1c08c7[_0xc06e('0x1e')]===_0xc06e('0x1f')&&typeof _0x1c08c7[_0xc06e('0x20')]==='undefined';var _0x2cf436=_0x5c9cb4[_0xc06e('0x21')];var _0x4af104=_0x473b9f?0x0:_0x1c08c7[_0xc06e('0x1e')];var _0x1afede=_0x473b9f?_0x5c9cb4['count']:_0x1c08c7['offset']+_0x1c08c7[_0xc06e('0x20')];var _0x53318b;if(_0x1afede>=_0x2cf436){_0x1afede=_0x2cf436;_0x53318b=0xc8;}else{_0x53318b=0xce;}_0x4daf37[_0xc06e('0x1b')](_0x53318b);return _0x4daf37[_0xc06e('0x22')]('Content-Range',_0x4af104+'-'+_0x1afede+'/'+_0x2cf436)['json'](_0x5c9cb4);}return null;};}function patchUpdates(_0x5b577b){return function(_0x57a564){try{jsonpatch['apply'](_0x57a564,_0x5b577b,!![]);}catch(_0x5ee7a1){return BPromise['reject'](_0x5ee7a1);}return _0x57a564[_0xc06e('0x23')]();};}function saveUpdates(_0x18d1f2,_0x1f19cf){return function(_0x17f35f){if(_0x17f35f){return _0x17f35f[_0xc06e('0x24')](_0x18d1f2)[_0xc06e('0x25')](function(_0x5b359c){return _0x5b359c;});}return null;};}function removeEntity(_0x4875c5,_0x5bc11a){return function(_0x168278){if(_0x168278){return _0x168278['destroy']()[_0xc06e('0x25')](function(){_0x4875c5[_0xc06e('0x1b')](0xcc)[_0xc06e('0x1c')]();});}};}function handleEntityNotFound(_0x8c441c,_0x1084dc){return function(_0x273357){if(!_0x273357){_0x8c441c['sendStatus'](0x194);}return _0x273357;};}function handleError(_0x19c7eb,_0x23e96e){_0x23e96e=_0x23e96e||0x1f4;return function(_0x2f19db){logger[_0xc06e('0x26')](_0x2f19db['stack']);if(_0x2f19db['name']){delete _0x2f19db[_0xc06e('0x27')];}_0x19c7eb[_0xc06e('0x1b')](_0x23e96e)['send'](_0x2f19db);};}exports[_0xc06e('0x28')]=function(_0x26394d,_0x222f69){var _0xef0d17={},_0x516186={},_0x310581={'count':0x0,'rows':[]};var _0x1ec6ad=_[_0xc06e('0x29')](db[_0xc06e('0x2a')][_0xc06e('0x2b')],function(_0x53e182){return{'name':_0x53e182[_0xc06e('0x2c')],'type':_0x53e182[_0xc06e('0x2d')][_0xc06e('0x2e')]};});_0x516186['model']=_[_0xc06e('0x29')](_0x1ec6ad,_0xc06e('0x27'));_0x516186[_0xc06e('0x2f')]=_[_0xc06e('0x30')](_0x26394d[_0xc06e('0x2f')]);_0x516186['filters']=_[_0xc06e('0x31')](_0x516186[_0xc06e('0x32')],_0x516186['query']);_0xef0d17[_0xc06e('0x33')]=_['intersection'](_0x516186['model'],qs[_0xc06e('0x34')](_0x26394d[_0xc06e('0x2f')][_0xc06e('0x34')]));_0xef0d17[_0xc06e('0x33')]=_0xef0d17[_0xc06e('0x33')][_0xc06e('0x35')]?_0xef0d17['attributes']:_0x516186[_0xc06e('0x32')];if(!_0x26394d[_0xc06e('0x2f')][_0xc06e('0x36')](_0xc06e('0x37'))){_0xef0d17[_0xc06e('0x20')]=qs[_0xc06e('0x20')](_0x26394d['query'][_0xc06e('0x20')]);_0xef0d17[_0xc06e('0x1e')]=qs[_0xc06e('0x1e')](_0x26394d[_0xc06e('0x2f')][_0xc06e('0x1e')]);}_0xef0d17[_0xc06e('0x38')]=qs[_0xc06e('0x39')](_0x26394d[_0xc06e('0x2f')][_0xc06e('0x39')]);_0xef0d17[_0xc06e('0x3a')]=qs[_0xc06e('0x3b')](_['pick'](_0x26394d[_0xc06e('0x2f')],_0x516186[_0xc06e('0x3b')]),_0x1ec6ad);if(_0x26394d[_0xc06e('0x2f')][_0xc06e('0x3c')]){_0xef0d17[_0xc06e('0x3a')]=_['merge'](_0xef0d17['where'],{'$or':_[_0xc06e('0x29')](_0x1ec6ad,function(_0x42c854){if(_0x42c854[_0xc06e('0x2d')]!=='VIRTUAL'){var _0x4b49a1={};_0x4b49a1[_0x42c854[_0xc06e('0x27')]]={'$like':'%'+_0x26394d[_0xc06e('0x2f')][_0xc06e('0x3c')]+'%'};return _0x4b49a1;}})});}_0xef0d17=_['merge']({},_0xef0d17,_0x26394d[_0xc06e('0x3d')]);var _0x42a898={'where':_0xef0d17[_0xc06e('0x3a')]};return db[_0xc06e('0x2a')][_0xc06e('0x21')](_0x42a898)[_0xc06e('0x25')](function(_0x166db6){_0x310581[_0xc06e('0x21')]=_0x166db6;if(_0x26394d['query'][_0xc06e('0x3e')]){_0xef0d17[_0xc06e('0x3f')]=[{'all':!![]}];}return db[_0xc06e('0x2a')][_0xc06e('0x40')](_0xef0d17);})[_0xc06e('0x25')](function(_0x54f4af){_0x310581[_0xc06e('0x41')]=_0x54f4af;return _0x310581;})[_0xc06e('0x25')](respondWithFilteredResult(_0x222f69,_0xef0d17))[_0xc06e('0x42')](handleError(_0x222f69,null));};exports['show']=function(_0x2c1874,_0x1d35d8){var _0x212dea={'raw':![],'where':{'id':_0x2c1874[_0xc06e('0x43')]['id']}},_0x2f1c01={};_0x2f1c01[_0xc06e('0x32')]=_[_0xc06e('0x30')](db[_0xc06e('0x2a')][_0xc06e('0x2b')]);_0x2f1c01[_0xc06e('0x2f')]=_['keys'](_0x2c1874[_0xc06e('0x2f')]);_0x2f1c01['filters']=_[_0xc06e('0x31')](_0x2f1c01[_0xc06e('0x32')],_0x2f1c01[_0xc06e('0x2f')]);_0x212dea['attributes']=_['intersection'](_0x2f1c01[_0xc06e('0x32')],qs[_0xc06e('0x34')](_0x2c1874['query'][_0xc06e('0x34')]));_0x212dea[_0xc06e('0x33')]=_0x212dea[_0xc06e('0x33')][_0xc06e('0x35')]?_0x212dea[_0xc06e('0x33')]:_0x2f1c01['model'];if(_0x2c1874[_0xc06e('0x2f')][_0xc06e('0x3e')]){_0x212dea[_0xc06e('0x3f')]=[{'all':!![]}];}_0x212dea=_[_0xc06e('0x44')]({},_0x212dea,_0x2c1874['options']);return db[_0xc06e('0x2a')][_0xc06e('0x45')](_0x212dea)[_0xc06e('0x25')](handleEntityNotFound(_0x1d35d8,null))[_0xc06e('0x25')](respondWithResult(_0x1d35d8,null))[_0xc06e('0x42')](handleError(_0x1d35d8,null));};exports[_0xc06e('0x46')]=function(_0x413d0e,_0x5e7f55){return db[_0xc06e('0x2a')][_0xc06e('0x46')](_0x413d0e[_0xc06e('0x47')],{})[_0xc06e('0x25')](respondWithResult(_0x5e7f55,0xc9))['catch'](handleError(_0x5e7f55,null));};exports[_0xc06e('0x24')]=function(_0x10e272,_0x589967){if(_0x10e272[_0xc06e('0x47')]['id']){delete _0x10e272['body']['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x10e272['params']['id']}})[_0xc06e('0x25')](handleEntityNotFound(_0x589967,null))[_0xc06e('0x25')](saveUpdates(_0x10e272[_0xc06e('0x47')],null))[_0xc06e('0x25')](respondWithResult(_0x589967,null))['catch'](handleError(_0x589967,null));};exports[_0xc06e('0x48')]=function(_0x72c5e2,_0x29d099){return db[_0xc06e('0x2a')][_0xc06e('0x45')]({'where':{'id':_0x72c5e2['params']['id']}})[_0xc06e('0x25')](handleEntityNotFound(_0x29d099,null))[_0xc06e('0x25')](removeEntity(_0x29d099,null))['catch'](handleError(_0x29d099,null));};exports[_0xc06e('0x49')]=function(_0x5510f1,_0xd42442,_0x54ca12){var _0x4dbe4c={};var _0x13e15f={};var _0x457c32;var _0xe3ff62;return db['SugarcrmConfiguration'][_0xc06e('0x4a')]({'where':{'id':_0x5510f1[_0xc06e('0x43')]['id']}})[_0xc06e('0x25')](handleEntityNotFound(_0xd42442,null))[_0xc06e('0x25')](function(_0x18a0a3){if(_0x18a0a3){_0x457c32=_0x18a0a3;_0x13e15f['model']=_['keys'](db[_0xc06e('0x4b')][_0xc06e('0x2b')]);_0x13e15f['query']=_[_0xc06e('0x30')](_0x5510f1['query']);_0x13e15f['filters']=_['intersection'](_0x13e15f[_0xc06e('0x32')],_0x13e15f['query']);_0x4dbe4c[_0xc06e('0x33')]=_['intersection'](_0x13e15f[_0xc06e('0x32')],qs[_0xc06e('0x34')](_0x5510f1['query'][_0xc06e('0x34')]));_0x4dbe4c['attributes']=_0x4dbe4c['attributes'][_0xc06e('0x35')]?_0x4dbe4c[_0xc06e('0x33')]:_0x13e15f['model'];_0x4dbe4c['order']=qs[_0xc06e('0x39')](_0x5510f1[_0xc06e('0x2f')]['sort']);_0x4dbe4c[_0xc06e('0x3a')]=qs['filters'](_['pick'](_0x5510f1[_0xc06e('0x2f')],_0x13e15f[_0xc06e('0x3b')]));if(_0x5510f1[_0xc06e('0x2f')]['filter']){_0x4dbe4c[_0xc06e('0x3a')]=_[_0xc06e('0x44')](_0x4dbe4c['where'],{'$or':_[_0xc06e('0x29')](_0x4dbe4c[_0xc06e('0x33')],function(_0x531641){var _0x5e7bfe={};_0x5e7bfe[_0x531641]={'$like':'%'+_0x5510f1[_0xc06e('0x2f')][_0xc06e('0x3c')]+'%'};return _0x5e7bfe;})});}_0x4dbe4c=_['merge']({},_0x4dbe4c,_0x5510f1[_0xc06e('0x3d')]);return _0x457c32['getFields'](_0x4dbe4c);}})['then'](function(_0x520983){if(_0x520983){_0xe3ff62=_0x520983[_0xc06e('0x35')];if(!_0x5510f1[_0xc06e('0x2f')][_0xc06e('0x36')](_0xc06e('0x37'))){_0x4dbe4c[_0xc06e('0x20')]=qs[_0xc06e('0x20')](_0x5510f1['query'][_0xc06e('0x20')]);_0x4dbe4c[_0xc06e('0x1e')]=qs[_0xc06e('0x1e')](_0x5510f1[_0xc06e('0x2f')][_0xc06e('0x1e')]);}return _0x457c32[_0xc06e('0x49')](_0x4dbe4c);}})['then'](function(_0x16ba95){if(_0x16ba95){return _0x16ba95?{'count':_0xe3ff62,'rows':_0x16ba95}:null;}})['then'](respondWithResult(_0xd42442,null))[_0xc06e('0x42')](handleError(_0xd42442,null));};exports[_0xc06e('0x4c')]=function(_0x59adc6,_0x1ac675,_0x2b75d1){var _0x101dbf={};var _0x281913={};var _0x5874d1;var _0x4c2b17;return db[_0xc06e('0x2a')]['findOne']({'where':{'id':_0x59adc6[_0xc06e('0x43')]['id']}})[_0xc06e('0x25')](handleEntityNotFound(_0x1ac675,null))[_0xc06e('0x25')](function(_0x43493a){if(_0x43493a){_0x5874d1=_0x43493a;_0x281913[_0xc06e('0x32')]=_[_0xc06e('0x30')](db[_0xc06e('0x4b')][_0xc06e('0x2b')]);_0x281913[_0xc06e('0x2f')]=_[_0xc06e('0x30')](_0x59adc6['query']);_0x281913[_0xc06e('0x3b')]=_['intersection'](_0x281913[_0xc06e('0x32')],_0x281913[_0xc06e('0x2f')]);_0x101dbf[_0xc06e('0x33')]=_[_0xc06e('0x31')](_0x281913[_0xc06e('0x32')],qs[_0xc06e('0x34')](_0x59adc6[_0xc06e('0x2f')][_0xc06e('0x34')]));_0x101dbf[_0xc06e('0x33')]=_0x101dbf[_0xc06e('0x33')]['length']?_0x101dbf['attributes']:_0x281913['model'];_0x101dbf[_0xc06e('0x38')]=qs['sort'](_0x59adc6[_0xc06e('0x2f')][_0xc06e('0x39')]);_0x101dbf[_0xc06e('0x3a')]=qs[_0xc06e('0x3b')](_[_0xc06e('0x4d')](_0x59adc6[_0xc06e('0x2f')],_0x281913['filters']));if(_0x59adc6['query'][_0xc06e('0x3c')]){_0x101dbf[_0xc06e('0x3a')]=_[_0xc06e('0x44')](_0x101dbf['where'],{'$or':_[_0xc06e('0x29')](_0x101dbf[_0xc06e('0x33')],function(_0x47d279){var _0x1e6db1={};_0x1e6db1[_0x47d279]={'$like':'%'+_0x59adc6['query']['filter']+'%'};return _0x1e6db1;})});}_0x101dbf=_[_0xc06e('0x44')]({},_0x101dbf,_0x59adc6[_0xc06e('0x3d')]);return _0x5874d1['getSubjects'](_0x101dbf);}})['then'](function(_0x30318b){if(_0x30318b){_0x4c2b17=_0x30318b[_0xc06e('0x35')];if(!_0x59adc6['query']['hasOwnProperty'](_0xc06e('0x37'))){_0x101dbf[_0xc06e('0x20')]=qs[_0xc06e('0x20')](_0x59adc6[_0xc06e('0x2f')]['limit']);_0x101dbf['offset']=qs[_0xc06e('0x1e')](_0x59adc6['query']['offset']);}return _0x5874d1[_0xc06e('0x4c')](_0x101dbf);}})['then'](function(_0x1c001f){if(_0x1c001f){return _0x1c001f?{'count':_0x4c2b17,'rows':_0x1c001f}:null;}})[_0xc06e('0x25')](respondWithResult(_0x1ac675,null))[_0xc06e('0x42')](handleError(_0x1ac675,null));};exports['getDescriptions']=function(_0x18cb46,_0x2cf86f,_0x2b6b89){var _0x1e0484={};var _0x3efae4={};var _0x4f37c4;var _0x3dc667;return db[_0xc06e('0x2a')][_0xc06e('0x4a')]({'where':{'id':_0x18cb46['params']['id']}})['then'](handleEntityNotFound(_0x2cf86f,null))[_0xc06e('0x25')](function(_0x111956){if(_0x111956){_0x4f37c4=_0x111956;_0x3efae4['model']=_[_0xc06e('0x30')](db[_0xc06e('0x4b')]['rawAttributes']);_0x3efae4[_0xc06e('0x2f')]=_[_0xc06e('0x30')](_0x18cb46[_0xc06e('0x2f')]);_0x3efae4[_0xc06e('0x3b')]=_[_0xc06e('0x31')](_0x3efae4[_0xc06e('0x32')],_0x3efae4[_0xc06e('0x2f')]);_0x1e0484[_0xc06e('0x33')]=_[_0xc06e('0x31')](_0x3efae4[_0xc06e('0x32')],qs[_0xc06e('0x34')](_0x18cb46[_0xc06e('0x2f')][_0xc06e('0x34')]));_0x1e0484[_0xc06e('0x33')]=_0x1e0484[_0xc06e('0x33')][_0xc06e('0x35')]?_0x1e0484[_0xc06e('0x33')]:_0x3efae4[_0xc06e('0x32')];_0x1e0484[_0xc06e('0x38')]=qs[_0xc06e('0x39')](_0x18cb46[_0xc06e('0x2f')][_0xc06e('0x39')]);_0x1e0484[_0xc06e('0x3a')]=qs[_0xc06e('0x3b')](_[_0xc06e('0x4d')](_0x18cb46['query'],_0x3efae4[_0xc06e('0x3b')]));if(_0x18cb46[_0xc06e('0x2f')][_0xc06e('0x3c')]){_0x1e0484[_0xc06e('0x3a')]=_['merge'](_0x1e0484[_0xc06e('0x3a')],{'$or':_[_0xc06e('0x29')](_0x1e0484['attributes'],function(_0xc73b4a){var _0x288e97={};_0x288e97[_0xc73b4a]={'$like':'%'+_0x18cb46[_0xc06e('0x2f')][_0xc06e('0x3c')]+'%'};return _0x288e97;})});}_0x1e0484=_['merge']({},_0x1e0484,_0x18cb46[_0xc06e('0x3d')]);return _0x4f37c4[_0xc06e('0x4e')](_0x1e0484);}})[_0xc06e('0x25')](function(_0xdc3605){if(_0xdc3605){_0x3dc667=_0xdc3605[_0xc06e('0x35')];if(!_0x18cb46[_0xc06e('0x2f')][_0xc06e('0x36')]('nolimit')){_0x1e0484[_0xc06e('0x20')]=qs[_0xc06e('0x20')](_0x18cb46[_0xc06e('0x2f')][_0xc06e('0x20')]);_0x1e0484[_0xc06e('0x1e')]=qs[_0xc06e('0x1e')](_0x18cb46['query'][_0xc06e('0x1e')]);}return _0x4f37c4[_0xc06e('0x4e')](_0x1e0484);}})[_0xc06e('0x25')](function(_0x2a31f3){if(_0x2a31f3){return _0x2a31f3?{'count':_0x3dc667,'rows':_0x2a31f3}:null;}})[_0xc06e('0x25')](respondWithResult(_0x2cf86f,null))[_0xc06e('0x42')](handleError(_0x2cf86f,null));}; \ No newline at end of file +var _0xfc33=['length','create','body','find','getFields','SugarcrmField','getSubjects','getDescriptions','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','save','update','then','destroy','error','name','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0xfc33,0xad));var _0x3fc3=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xfc33[_0x5d6456];return _0x4d66c1;};'use strict';var emlformat=require(_0x3fc3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fc3('0x1'));var jsonpatch=require(_0x3fc3('0x2'));var rp=require(_0x3fc3('0x3'));var moment=require(_0x3fc3('0x4'));var BPromise=require(_0x3fc3('0x5'));var Mustache=require('mustache');var util=require(_0x3fc3('0x6'));var path=require(_0x3fc3('0x7'));var sox=require(_0x3fc3('0x8'));var csv=require(_0x3fc3('0x9'));var ejs=require(_0x3fc3('0xa'));var fs=require('fs');var fs_extra=require(_0x3fc3('0xb'));var _=require(_0x3fc3('0xc'));var squel=require('squel');var crypto=require(_0x3fc3('0xd'));var jsforce=require(_0x3fc3('0xe'));var deskjs=require(_0x3fc3('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3fc3('0x10'));var Papa=require(_0x3fc3('0x11'));var Redis=require(_0x3fc3('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3fc3('0x13'));var logger=require(_0x3fc3('0x14'))(_0x3fc3('0x15'));var utils=require(_0x3fc3('0x16'));var config=require(_0x3fc3('0x17'));var licenseUtil=require(_0x3fc3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xaa8c8,_0x253a54){_0x253a54=_0x253a54||0xcc;return function(_0x521262){if(_0x521262){return _0xaa8c8[_0x3fc3('0x19')](_0x253a54);}return _0xaa8c8[_0x3fc3('0x1a')](_0x253a54)[_0x3fc3('0x1b')]();};}function respondWithResult(_0x20a65c,_0x2016e6){_0x2016e6=_0x2016e6||0xc8;return function(_0x1b7833){if(_0x1b7833){return _0x20a65c['status'](_0x2016e6)[_0x3fc3('0x1c')](_0x1b7833);}};}function respondWithFilteredResult(_0x33b602,_0x904edc){return function(_0x410378){if(_0x410378){var _0x27e0b7=typeof _0x904edc['offset']===_0x3fc3('0x1d')&&typeof _0x904edc[_0x3fc3('0x1e')]==='undefined';var _0x1cde10=_0x410378['count'];var _0x24a09e=_0x27e0b7?0x0:_0x904edc[_0x3fc3('0x1f')];var _0x431cba=_0x27e0b7?_0x410378[_0x3fc3('0x20')]:_0x904edc[_0x3fc3('0x1f')]+_0x904edc['limit'];var _0x1f869e;if(_0x431cba>=_0x1cde10){_0x431cba=_0x1cde10;_0x1f869e=0xc8;}else{_0x1f869e=0xce;}_0x33b602[_0x3fc3('0x1a')](_0x1f869e);return _0x33b602[_0x3fc3('0x21')]('Content-Range',_0x24a09e+'-'+_0x431cba+'/'+_0x1cde10)[_0x3fc3('0x1c')](_0x410378);}return null;};}function patchUpdates(_0x3bdcda){return function(_0xe0af56){try{jsonpatch[_0x3fc3('0x22')](_0xe0af56,_0x3bdcda,!![]);}catch(_0x22ac3b){return BPromise[_0x3fc3('0x23')](_0x22ac3b);}return _0xe0af56[_0x3fc3('0x24')]();};}function saveUpdates(_0x44ee12,_0x4b1942){return function(_0x4d7d88){if(_0x4d7d88){return _0x4d7d88[_0x3fc3('0x25')](_0x44ee12)[_0x3fc3('0x26')](function(_0x1c75ee){return _0x1c75ee;});}return null;};}function removeEntity(_0x5c990e,_0x1ad4d6){return function(_0x34fc2c){if(_0x34fc2c){return _0x34fc2c[_0x3fc3('0x27')]()[_0x3fc3('0x26')](function(){_0x5c990e['status'](0xcc)[_0x3fc3('0x1b')]();});}};}function handleEntityNotFound(_0x2d6908,_0x2ed5f0){return function(_0x2eaf40){if(!_0x2eaf40){_0x2d6908[_0x3fc3('0x19')](0x194);}return _0x2eaf40;};}function handleError(_0x1a137d,_0x3d6e8b){_0x3d6e8b=_0x3d6e8b||0x1f4;return function(_0x1eb009){logger[_0x3fc3('0x28')](_0x1eb009['stack']);if(_0x1eb009[_0x3fc3('0x29')]){delete _0x1eb009[_0x3fc3('0x29')];}_0x1a137d['status'](_0x3d6e8b)['send'](_0x1eb009);};}exports[_0x3fc3('0x2a')]=function(_0x37fc30,_0x4982e1){var _0x4190f5={},_0x27fdc6={},_0x2a746e={'count':0x0,'rows':[]};var _0x3babb5=_[_0x3fc3('0x2b')](db[_0x3fc3('0x2c')][_0x3fc3('0x2d')],function(_0x146251){return{'name':_0x146251[_0x3fc3('0x2e')],'type':_0x146251[_0x3fc3('0x2f')][_0x3fc3('0x30')]};});_0x27fdc6[_0x3fc3('0x31')]=_[_0x3fc3('0x2b')](_0x3babb5,_0x3fc3('0x29'));_0x27fdc6[_0x3fc3('0x32')]=_[_0x3fc3('0x33')](_0x37fc30[_0x3fc3('0x32')]);_0x27fdc6[_0x3fc3('0x34')]=_[_0x3fc3('0x35')](_0x27fdc6[_0x3fc3('0x31')],_0x27fdc6[_0x3fc3('0x32')]);_0x4190f5[_0x3fc3('0x36')]=_['intersection'](_0x27fdc6[_0x3fc3('0x31')],qs['fields'](_0x37fc30[_0x3fc3('0x32')][_0x3fc3('0x37')]));_0x4190f5['attributes']=_0x4190f5['attributes']['length']?_0x4190f5[_0x3fc3('0x36')]:_0x27fdc6[_0x3fc3('0x31')];if(!_0x37fc30[_0x3fc3('0x32')][_0x3fc3('0x38')](_0x3fc3('0x39'))){_0x4190f5[_0x3fc3('0x1e')]=qs[_0x3fc3('0x1e')](_0x37fc30[_0x3fc3('0x32')][_0x3fc3('0x1e')]);_0x4190f5[_0x3fc3('0x1f')]=qs['offset'](_0x37fc30['query'][_0x3fc3('0x1f')]);}_0x4190f5[_0x3fc3('0x3a')]=qs[_0x3fc3('0x3b')](_0x37fc30['query'][_0x3fc3('0x3b')]);_0x4190f5[_0x3fc3('0x3c')]=qs[_0x3fc3('0x34')](_[_0x3fc3('0x3d')](_0x37fc30[_0x3fc3('0x32')],_0x27fdc6[_0x3fc3('0x34')]),_0x3babb5);if(_0x37fc30[_0x3fc3('0x32')][_0x3fc3('0x3e')]){_0x4190f5[_0x3fc3('0x3c')]=_[_0x3fc3('0x3f')](_0x4190f5[_0x3fc3('0x3c')],{'$or':_[_0x3fc3('0x2b')](_0x3babb5,function(_0x121767){if(_0x121767['type']!==_0x3fc3('0x40')){var _0x5f7a11={};_0x5f7a11[_0x121767[_0x3fc3('0x29')]]={'$like':'%'+_0x37fc30[_0x3fc3('0x32')][_0x3fc3('0x3e')]+'%'};return _0x5f7a11;}})});}_0x4190f5=_[_0x3fc3('0x3f')]({},_0x4190f5,_0x37fc30[_0x3fc3('0x41')]);var _0x120f1b={'where':_0x4190f5[_0x3fc3('0x3c')]};return db[_0x3fc3('0x2c')][_0x3fc3('0x20')](_0x120f1b)['then'](function(_0x1d0513){_0x2a746e['count']=_0x1d0513;if(_0x37fc30[_0x3fc3('0x32')][_0x3fc3('0x42')]){_0x4190f5[_0x3fc3('0x43')]=[{'all':!![]}];}return db[_0x3fc3('0x2c')][_0x3fc3('0x44')](_0x4190f5);})[_0x3fc3('0x26')](function(_0x1fa839){_0x2a746e[_0x3fc3('0x45')]=_0x1fa839;return _0x2a746e;})[_0x3fc3('0x26')](respondWithFilteredResult(_0x4982e1,_0x4190f5))[_0x3fc3('0x46')](handleError(_0x4982e1,null));};exports[_0x3fc3('0x47')]=function(_0x523e18,_0x4eef06){var _0x615cc1={'raw':![],'where':{'id':_0x523e18[_0x3fc3('0x48')]['id']}},_0x5ee312={};_0x5ee312['model']=_[_0x3fc3('0x33')](db[_0x3fc3('0x2c')][_0x3fc3('0x2d')]);_0x5ee312[_0x3fc3('0x32')]=_[_0x3fc3('0x33')](_0x523e18[_0x3fc3('0x32')]);_0x5ee312['filters']=_[_0x3fc3('0x35')](_0x5ee312['model'],_0x5ee312['query']);_0x615cc1[_0x3fc3('0x36')]=_[_0x3fc3('0x35')](_0x5ee312[_0x3fc3('0x31')],qs[_0x3fc3('0x37')](_0x523e18['query'][_0x3fc3('0x37')]));_0x615cc1[_0x3fc3('0x36')]=_0x615cc1[_0x3fc3('0x36')][_0x3fc3('0x49')]?_0x615cc1[_0x3fc3('0x36')]:_0x5ee312['model'];if(_0x523e18[_0x3fc3('0x32')]['includeAll']){_0x615cc1[_0x3fc3('0x43')]=[{'all':!![]}];}_0x615cc1=_['merge']({},_0x615cc1,_0x523e18[_0x3fc3('0x41')]);return db['SugarcrmConfiguration']['find'](_0x615cc1)[_0x3fc3('0x26')](handleEntityNotFound(_0x4eef06,null))['then'](respondWithResult(_0x4eef06,null))[_0x3fc3('0x46')](handleError(_0x4eef06,null));};exports[_0x3fc3('0x4a')]=function(_0x4811df,_0x1ec9a6){return db[_0x3fc3('0x2c')][_0x3fc3('0x4a')](_0x4811df[_0x3fc3('0x4b')],{})[_0x3fc3('0x26')](respondWithResult(_0x1ec9a6,0xc9))[_0x3fc3('0x46')](handleError(_0x1ec9a6,null));};exports[_0x3fc3('0x25')]=function(_0x557f9d,_0x56bef3){if(_0x557f9d['body']['id']){delete _0x557f9d[_0x3fc3('0x4b')]['id'];}return db[_0x3fc3('0x2c')][_0x3fc3('0x4c')]({'where':{'id':_0x557f9d[_0x3fc3('0x48')]['id']}})[_0x3fc3('0x26')](handleEntityNotFound(_0x56bef3,null))[_0x3fc3('0x26')](saveUpdates(_0x557f9d['body'],null))[_0x3fc3('0x26')](respondWithResult(_0x56bef3,null))[_0x3fc3('0x46')](handleError(_0x56bef3,null));};exports[_0x3fc3('0x27')]=function(_0x121b49,_0x3a9951){return db[_0x3fc3('0x2c')][_0x3fc3('0x4c')]({'where':{'id':_0x121b49[_0x3fc3('0x48')]['id']}})[_0x3fc3('0x26')](handleEntityNotFound(_0x3a9951,null))[_0x3fc3('0x26')](removeEntity(_0x3a9951,null))['catch'](handleError(_0x3a9951,null));};exports[_0x3fc3('0x4d')]=function(_0x143ea1,_0x382fc2,_0x5d571e){var _0x32062c={};var _0x1612fc={};var _0x37260f;var _0x5661db;return db[_0x3fc3('0x2c')]['findOne']({'where':{'id':_0x143ea1[_0x3fc3('0x48')]['id']}})[_0x3fc3('0x26')](handleEntityNotFound(_0x382fc2,null))[_0x3fc3('0x26')](function(_0x175a4a){if(_0x175a4a){_0x37260f=_0x175a4a;_0x1612fc[_0x3fc3('0x31')]=_[_0x3fc3('0x33')](db['SugarcrmField'][_0x3fc3('0x2d')]);_0x1612fc[_0x3fc3('0x32')]=_[_0x3fc3('0x33')](_0x143ea1['query']);_0x1612fc[_0x3fc3('0x34')]=_['intersection'](_0x1612fc['model'],_0x1612fc[_0x3fc3('0x32')]);_0x32062c[_0x3fc3('0x36')]=_['intersection'](_0x1612fc[_0x3fc3('0x31')],qs[_0x3fc3('0x37')](_0x143ea1[_0x3fc3('0x32')][_0x3fc3('0x37')]));_0x32062c[_0x3fc3('0x36')]=_0x32062c['attributes']['length']?_0x32062c['attributes']:_0x1612fc[_0x3fc3('0x31')];_0x32062c[_0x3fc3('0x3a')]=qs[_0x3fc3('0x3b')](_0x143ea1[_0x3fc3('0x32')][_0x3fc3('0x3b')]);_0x32062c[_0x3fc3('0x3c')]=qs[_0x3fc3('0x34')](_[_0x3fc3('0x3d')](_0x143ea1[_0x3fc3('0x32')],_0x1612fc[_0x3fc3('0x34')]));if(_0x143ea1[_0x3fc3('0x32')][_0x3fc3('0x3e')]){_0x32062c[_0x3fc3('0x3c')]=_[_0x3fc3('0x3f')](_0x32062c[_0x3fc3('0x3c')],{'$or':_[_0x3fc3('0x2b')](_0x32062c[_0x3fc3('0x36')],function(_0xc6b203){var _0x586926={};_0x586926[_0xc6b203]={'$like':'%'+_0x143ea1[_0x3fc3('0x32')]['filter']+'%'};return _0x586926;})});}_0x32062c=_[_0x3fc3('0x3f')]({},_0x32062c,_0x143ea1[_0x3fc3('0x41')]);return _0x37260f[_0x3fc3('0x4d')](_0x32062c);}})['then'](function(_0x1ab90a){if(_0x1ab90a){_0x5661db=_0x1ab90a[_0x3fc3('0x49')];if(!_0x143ea1['query'][_0x3fc3('0x38')](_0x3fc3('0x39'))){_0x32062c['limit']=qs[_0x3fc3('0x1e')](_0x143ea1[_0x3fc3('0x32')][_0x3fc3('0x1e')]);_0x32062c[_0x3fc3('0x1f')]=qs[_0x3fc3('0x1f')](_0x143ea1[_0x3fc3('0x32')][_0x3fc3('0x1f')]);}return _0x37260f['getFields'](_0x32062c);}})[_0x3fc3('0x26')](function(_0xfcf317){if(_0xfcf317){return _0xfcf317?{'count':_0x5661db,'rows':_0xfcf317}:null;}})['then'](respondWithResult(_0x382fc2,null))['catch'](handleError(_0x382fc2,null));};exports['getSubjects']=function(_0x2f9658,_0x190cc5,_0x5df221){var _0x417d68={};var _0x6b7ab7={};var _0x3a9c88;var _0x5d0061;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x2f9658[_0x3fc3('0x48')]['id']}})['then'](handleEntityNotFound(_0x190cc5,null))[_0x3fc3('0x26')](function(_0x2a7ef9){if(_0x2a7ef9){_0x3a9c88=_0x2a7ef9;_0x6b7ab7[_0x3fc3('0x31')]=_['keys'](db[_0x3fc3('0x4e')]['rawAttributes']);_0x6b7ab7[_0x3fc3('0x32')]=_['keys'](_0x2f9658[_0x3fc3('0x32')]);_0x6b7ab7[_0x3fc3('0x34')]=_[_0x3fc3('0x35')](_0x6b7ab7[_0x3fc3('0x31')],_0x6b7ab7[_0x3fc3('0x32')]);_0x417d68[_0x3fc3('0x36')]=_[_0x3fc3('0x35')](_0x6b7ab7[_0x3fc3('0x31')],qs[_0x3fc3('0x37')](_0x2f9658[_0x3fc3('0x32')][_0x3fc3('0x37')]));_0x417d68[_0x3fc3('0x36')]=_0x417d68[_0x3fc3('0x36')][_0x3fc3('0x49')]?_0x417d68[_0x3fc3('0x36')]:_0x6b7ab7['model'];_0x417d68[_0x3fc3('0x3a')]=qs[_0x3fc3('0x3b')](_0x2f9658[_0x3fc3('0x32')][_0x3fc3('0x3b')]);_0x417d68[_0x3fc3('0x3c')]=qs[_0x3fc3('0x34')](_[_0x3fc3('0x3d')](_0x2f9658[_0x3fc3('0x32')],_0x6b7ab7[_0x3fc3('0x34')]));if(_0x2f9658[_0x3fc3('0x32')][_0x3fc3('0x3e')]){_0x417d68['where']=_['merge'](_0x417d68[_0x3fc3('0x3c')],{'$or':_[_0x3fc3('0x2b')](_0x417d68[_0x3fc3('0x36')],function(_0x4b5b49){var _0x436770={};_0x436770[_0x4b5b49]={'$like':'%'+_0x2f9658[_0x3fc3('0x32')]['filter']+'%'};return _0x436770;})});}_0x417d68=_[_0x3fc3('0x3f')]({},_0x417d68,_0x2f9658['options']);return _0x3a9c88[_0x3fc3('0x4f')](_0x417d68);}})['then'](function(_0x247d25){if(_0x247d25){_0x5d0061=_0x247d25[_0x3fc3('0x49')];if(!_0x2f9658['query']['hasOwnProperty']('nolimit')){_0x417d68[_0x3fc3('0x1e')]=qs['limit'](_0x2f9658[_0x3fc3('0x32')][_0x3fc3('0x1e')]);_0x417d68['offset']=qs['offset'](_0x2f9658[_0x3fc3('0x32')][_0x3fc3('0x1f')]);}return _0x3a9c88[_0x3fc3('0x4f')](_0x417d68);}})[_0x3fc3('0x26')](function(_0x5c0576){if(_0x5c0576){return _0x5c0576?{'count':_0x5d0061,'rows':_0x5c0576}:null;}})['then'](respondWithResult(_0x190cc5,null))[_0x3fc3('0x46')](handleError(_0x190cc5,null));};exports[_0x3fc3('0x50')]=function(_0x4cb74c,_0x1e4ab1,_0x505de6){var _0x10d712={};var _0x1140df={};var _0x3171dd;var _0x73075e;return db[_0x3fc3('0x2c')][_0x3fc3('0x51')]({'where':{'id':_0x4cb74c[_0x3fc3('0x48')]['id']}})[_0x3fc3('0x26')](handleEntityNotFound(_0x1e4ab1,null))[_0x3fc3('0x26')](function(_0x6b67b6){if(_0x6b67b6){_0x3171dd=_0x6b67b6;_0x1140df[_0x3fc3('0x31')]=_[_0x3fc3('0x33')](db[_0x3fc3('0x4e')][_0x3fc3('0x2d')]);_0x1140df['query']=_['keys'](_0x4cb74c[_0x3fc3('0x32')]);_0x1140df[_0x3fc3('0x34')]=_[_0x3fc3('0x35')](_0x1140df[_0x3fc3('0x31')],_0x1140df[_0x3fc3('0x32')]);_0x10d712['attributes']=_[_0x3fc3('0x35')](_0x1140df[_0x3fc3('0x31')],qs['fields'](_0x4cb74c['query'][_0x3fc3('0x37')]));_0x10d712[_0x3fc3('0x36')]=_0x10d712[_0x3fc3('0x36')][_0x3fc3('0x49')]?_0x10d712['attributes']:_0x1140df[_0x3fc3('0x31')];_0x10d712['order']=qs[_0x3fc3('0x3b')](_0x4cb74c[_0x3fc3('0x32')]['sort']);_0x10d712[_0x3fc3('0x3c')]=qs['filters'](_['pick'](_0x4cb74c[_0x3fc3('0x32')],_0x1140df[_0x3fc3('0x34')]));if(_0x4cb74c[_0x3fc3('0x32')][_0x3fc3('0x3e')]){_0x10d712[_0x3fc3('0x3c')]=_[_0x3fc3('0x3f')](_0x10d712[_0x3fc3('0x3c')],{'$or':_[_0x3fc3('0x2b')](_0x10d712['attributes'],function(_0x331598){var _0x199f4b={};_0x199f4b[_0x331598]={'$like':'%'+_0x4cb74c[_0x3fc3('0x32')][_0x3fc3('0x3e')]+'%'};return _0x199f4b;})});}_0x10d712=_['merge']({},_0x10d712,_0x4cb74c[_0x3fc3('0x41')]);return _0x3171dd[_0x3fc3('0x50')](_0x10d712);}})[_0x3fc3('0x26')](function(_0x5dee0c){if(_0x5dee0c){_0x73075e=_0x5dee0c[_0x3fc3('0x49')];if(!_0x4cb74c['query'][_0x3fc3('0x38')](_0x3fc3('0x39'))){_0x10d712[_0x3fc3('0x1e')]=qs[_0x3fc3('0x1e')](_0x4cb74c[_0x3fc3('0x32')][_0x3fc3('0x1e')]);_0x10d712[_0x3fc3('0x1f')]=qs['offset'](_0x4cb74c['query']['offset']);}return _0x3171dd[_0x3fc3('0x50')](_0x10d712);}})[_0x3fc3('0x26')](function(_0x22004d){if(_0x22004d){return _0x22004d?{'count':_0x73075e,'rows':_0x22004d}:null;}})['then'](respondWithResult(_0x1e4ab1,null))['catch'](handleError(_0x1e4ab1,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index f382be6..d05770b 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 _0xfc1a=['request-promise','path','rimraf','../../config/environment','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','api','moment','bluebird'];(function(_0x1f1170,_0x3b5783){var _0x127b7b=function(_0x30c5ed){while(--_0x30c5ed){_0x1f1170['push'](_0x1f1170['shift']());}};_0x127b7b(++_0x3b5783);}(_0xfc1a,0xbb));var _0xafc1=function(_0x4ab569,_0x5e04b){_0x4ab569=_0x4ab569-0x0;var _0x40ca19=_0xfc1a[_0x4ab569];return _0x40ca19;};'use strict';var _=require(_0xafc1('0x0'));var util=require(_0xafc1('0x1'));var logger=require('../../config/logger')(_0xafc1('0x2'));var moment=require(_0xafc1('0x3'));var BPromise=require(_0xafc1('0x4'));var rp=require(_0xafc1('0x5'));var fs=require('fs');var path=require(_0xafc1('0x6'));var rimraf=require(_0xafc1('0x7'));var config=require(_0xafc1('0x8'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x437519,_0x53794f){return _0x437519[_0xafc1('0x9')](_0xafc1('0xa'),attributes,{'tableName':_0xafc1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd197=['exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xef1b50,_0x522642){var _0x2946a4=function(_0x550247){while(--_0x550247){_0xef1b50['push'](_0xef1b50['shift']());}};_0x2946a4(++_0x522642);}(_0xd197,0x1be));var _0x7d19=function(_0x296bf6,_0x34fd1f){_0x296bf6=_0x296bf6-0x0;var _0x377a6e=_0xd197[_0x296bf6];return _0x377a6e;};'use strict';var _=require(_0x7d19('0x0'));var util=require(_0x7d19('0x1'));var logger=require(_0x7d19('0x2'))(_0x7d19('0x3'));var moment=require('moment');var BPromise=require(_0x7d19('0x4'));var rp=require(_0x7d19('0x5'));var fs=require('fs');var path=require(_0x7d19('0x6'));var rimraf=require(_0x7d19('0x7'));var config=require(_0x7d19('0x8'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x7d19('0x9')]=function(_0x548e1e,_0x9e20f2){return _0x548e1e[_0x7d19('0xa')](_0x7d19('0xb'),attributes,{'tableName':_0x7d19('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index ebfe350..3ebaaa7 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 _0xaff7=['then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x508ca6,_0x4c7cc5){var _0x378d03=function(_0x240394){while(--_0x240394){_0x508ca6['push'](_0x508ca6['shift']());}};_0x378d03(++_0x4c7cc5);}(_0xaff7,0x184));var _0x7aff=function(_0x57db49,_0x288094){_0x57db49=_0x57db49-0x0;var _0xd0636f=_0xaff7[_0x57db49];return _0xd0636f;};'use strict';var _=require(_0x7aff('0x0'));var util=require(_0x7aff('0x1'));var moment=require(_0x7aff('0x2'));var BPromise=require('bluebird');var rs=require(_0x7aff('0x3'));var fs=require('fs');var Redis=require(_0x7aff('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7aff('0x5'));var logger=require(_0x7aff('0x6'))('rpc');var config=require(_0x7aff('0x7'));var jayson=require(_0x7aff('0x8'));var client=jayson[_0x7aff('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12306a,_0x3ef137,_0x281a43){return new BPromise(function(_0x3adf50,_0x58f98b){return client[_0x7aff('0xa')](_0x12306a,_0x281a43)[_0x7aff('0xb')](function(_0x4979c6){logger[_0x7aff('0xc')](_0x7aff('0xd'),_0x3ef137,_0x7aff('0xe'));logger['debug'](_0x7aff('0xf'),_0x3ef137,'request\x20sent',JSON[_0x7aff('0x10')](_0x4979c6));if(_0x4979c6['error']){if(_0x4979c6[_0x7aff('0x11')][_0x7aff('0x12')]===0x1f4){logger[_0x7aff('0x11')](_0x7aff('0xd'),_0x3ef137,_0x4979c6[_0x7aff('0x11')][_0x7aff('0x13')]);return _0x58f98b(_0x4979c6[_0x7aff('0x11')][_0x7aff('0x13')]);}logger[_0x7aff('0x11')](_0x7aff('0xd'),_0x3ef137,_0x4979c6[_0x7aff('0x11')][_0x7aff('0x13')]);return _0x3adf50(_0x4979c6[_0x7aff('0x11')][_0x7aff('0x13')]);}else{logger[_0x7aff('0xc')](_0x7aff('0xd'),_0x3ef137,_0x7aff('0xe'));_0x3adf50(_0x4979c6[_0x7aff('0x14')][_0x7aff('0x13')]);}})['catch'](function(_0x13368a){logger[_0x7aff('0x11')](_0x7aff('0xd'),_0x3ef137,_0x13368a);_0x58f98b(_0x13368a);});});} \ No newline at end of file +var _0x775b=['request','then','info','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmConfiguration,\x20%s,\x20%s','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xb533db,_0x143ed4){var _0x8d6dd6=function(_0x2cb9d4){while(--_0x2cb9d4){_0xb533db['push'](_0xb533db['shift']());}};_0x8d6dd6(++_0x143ed4);}(_0x775b,0xb3));var _0xb775=function(_0x35b195,_0x8893d5){_0x35b195=_0x35b195-0x0;var _0x2433bf=_0x775b[_0x35b195];return _0x2433bf;};'use strict';var _=require(_0xb775('0x0'));var util=require(_0xb775('0x1'));var moment=require(_0xb775('0x2'));var BPromise=require(_0xb775('0x3'));var rs=require(_0xb775('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb775('0x5'))['db'];var utils=require(_0xb775('0x6'));var logger=require(_0xb775('0x7'))(_0xb775('0x8'));var config=require(_0xb775('0x9'));var jayson=require(_0xb775('0xa'));var client=jayson[_0xb775('0xb')][_0xb775('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3bd370,_0x374724,_0xb4751e){return new BPromise(function(_0x4ed7cb,_0x297ecf){return client[_0xb775('0xd')](_0x3bd370,_0xb4751e)[_0xb775('0xe')](function(_0x178636){logger[_0xb775('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x374724,'request\x20sent');logger[_0xb775('0x10')](_0xb775('0x11'),_0x374724,'request\x20sent',JSON[_0xb775('0x12')](_0x178636));if(_0x178636[_0xb775('0x13')]){if(_0x178636[_0xb775('0x13')]['code']===0x1f4){logger[_0xb775('0x13')](_0xb775('0x14'),_0x374724,_0x178636['error'][_0xb775('0x15')]);return _0x297ecf(_0x178636[_0xb775('0x13')][_0xb775('0x15')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x374724,_0x178636[_0xb775('0x13')][_0xb775('0x15')]);return _0x4ed7cb(_0x178636['error']['message']);}else{logger[_0xb775('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x374724,_0xb775('0x16'));_0x4ed7cb(_0x178636['result'][_0xb775('0x15')]);}})[_0xb775('0x17')](function(_0x27a244){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x374724,_0x27a244);_0x297ecf(_0x27a244);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index dbb8b7e..e2d8cd2 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 _0x89b3=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','/:id','show','post','create','put','update','exports','multer'];(function(_0x555f5b,_0x2aa58d){var _0x1eb87b=function(_0xb72fe5){while(--_0xb72fe5){_0x555f5b['push'](_0x555f5b['shift']());}};_0x1eb87b(++_0x2aa58d);}(_0x89b3,0x1da));var _0x389b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x89b3[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x389b('0x0'));var util=require(_0x389b('0x1'));var path=require(_0x389b('0x2'));var timeout=require('connect-timeout');var express=require(_0x389b('0x3'));var router=express[_0x389b('0x4')]();var fs_extra=require(_0x389b('0x5'));var auth=require(_0x389b('0x6'));var interaction=require(_0x389b('0x7'));var config=require(_0x389b('0x8'));var controller=require(_0x389b('0x9'));router[_0x389b('0xa')]('/',auth[_0x389b('0xb')](),controller['index']);router[_0x389b('0xa')](_0x389b('0xc'),auth['isAuthenticated'](),controller[_0x389b('0xd')]);router[_0x389b('0xe')]('/',auth[_0x389b('0xb')](),controller[_0x389b('0xf')]);router[_0x389b('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x389b('0x11')]);router['delete'](_0x389b('0xc'),auth[_0x389b('0xb')](),controller['destroy']);module[_0x389b('0x12')]=router; \ No newline at end of file +var _0xd80b=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','Router','../../components/interaction/service','./intSugarcrmField.controller','isAuthenticated','index','get'];(function(_0x1dac7a,_0x1828ce){var _0x4cb363=function(_0x80f6de){while(--_0x80f6de){_0x1dac7a['push'](_0x1dac7a['shift']());}};_0x4cb363(++_0x1828ce);}(_0xd80b,0xf3));var _0xbd80=function(_0x4f680c,_0x4af4c4){_0x4f680c=_0x4f680c-0x0;var _0x31d93e=_0xd80b[_0x4f680c];return _0x31d93e;};'use strict';var multer=require(_0xbd80('0x0'));var util=require(_0xbd80('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbd80('0x2'));var router=express[_0xbd80('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbd80('0x4'));var config=require('../../config/environment');var controller=require(_0xbd80('0x5'));router['get']('/',auth[_0xbd80('0x6')](),controller[_0xbd80('0x7')]);router[_0xbd80('0x8')](_0xbd80('0x9'),auth['isAuthenticated'](),controller[_0xbd80('0xa')]);router[_0xbd80('0xb')]('/',auth[_0xbd80('0x6')](),controller[_0xbd80('0xc')]);router[_0xbd80('0xd')]('/:id',auth[_0xbd80('0x6')](),controller[_0xbd80('0xe')]);router[_0xbd80('0xf')](_0xbd80('0x9'),auth[_0xbd80('0x6')](),controller[_0xbd80('0x10')]);module[_0xbd80('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 47a7a1f..4aeb622 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 _0x3a33=['variable','customVariable','keyValue','picklist','string','STRING','sequelize','exports','ENUM'];(function(_0x1b5013,_0x2ad005){var _0xdc2fea=function(_0x30c130){while(--_0x30c130){_0x1b5013['push'](_0x1b5013['shift']());}};_0xdc2fea(++_0x2ad005);}(_0x3a33,0x72));var _0x33a3=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x3a33[_0x565c49];return _0x20ca34;};'use strict';var Sequelize=require(_0x33a3('0x0'));module[_0x33a3('0x1')]={'type':{'type':Sequelize[_0x33a3('0x2')]('string',_0x33a3('0x3'),_0x33a3('0x4'),_0x33a3('0x5'),_0x33a3('0x6')),'defaultValue':_0x33a3('0x7')},'content':{'type':Sequelize[_0x33a3('0x8')]},'key':{'type':Sequelize[_0x33a3('0x8')]},'keyType':{'type':Sequelize[_0x33a3('0x2')](_0x33a3('0x7'),_0x33a3('0x3'),_0x33a3('0x4'))},'keyContent':{'type':Sequelize[_0x33a3('0x8')]},'idField':{'type':Sequelize[_0x33a3('0x8')]},'nameField':{'type':Sequelize[_0x33a3('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x33a3('0x8')]}}; \ No newline at end of file +var _0x74c3=['picklist','string','STRING','ENUM','variable','BOOLEAN','sequelize','customVariable'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x74c3,0x1de));var _0x374c=function(_0x454311,_0x371ee2){_0x454311=_0x454311-0x0;var _0x279bfc=_0x74c3[_0x454311];return _0x279bfc;};'use strict';var Sequelize=require(_0x374c('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0x374c('0x1'),'keyValue',_0x374c('0x2')),'defaultValue':_0x374c('0x3')},'content':{'type':Sequelize[_0x374c('0x4')]},'key':{'type':Sequelize[_0x374c('0x4')]},'keyType':{'type':Sequelize[_0x374c('0x5')](_0x374c('0x3'),_0x374c('0x6'),_0x374c('0x1'))},'keyContent':{'type':Sequelize[_0x374c('0x4')]},'idField':{'type':Sequelize[_0x374c('0x4')]},'nameField':{'type':Sequelize[_0x374c('0x4')]},'customField':{'type':Sequelize[_0x374c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x374c('0x4')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 0d2f404..7e27149 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 _0x6a46=['create','body','find','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','Content-Range','json','reject','save','update','then','stack','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','includeAll'];(function(_0x404791,_0x572856){var _0x51d995=function(_0x1089d9){while(--_0x1089d9){_0x404791['push'](_0x404791['shift']());}};_0x51d995(++_0x572856);}(_0x6a46,0x130));var _0x66a4=function(_0x30f3fd,_0x5e36c7){_0x30f3fd=_0x30f3fd-0x0;var _0xaf923c=_0x6a46[_0x30f3fd];return _0xaf923c;};'use strict';var emlformat=require(_0x66a4('0x0'));var rimraf=require(_0x66a4('0x1'));var zipdir=require(_0x66a4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66a4('0x3'));var moment=require('moment');var BPromise=require(_0x66a4('0x4'));var Mustache=require(_0x66a4('0x5'));var util=require(_0x66a4('0x6'));var path=require(_0x66a4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x66a4('0x8'));var fs=require('fs');var fs_extra=require(_0x66a4('0x9'));var _=require(_0x66a4('0xa'));var squel=require(_0x66a4('0xb'));var crypto=require(_0x66a4('0xc'));var jsforce=require(_0x66a4('0xd'));var deskjs=require(_0x66a4('0xe'));var toCsv=require(_0x66a4('0xf'));var querystring=require('querystring');var Papa=require(_0x66a4('0x10'));var Redis=require(_0x66a4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x66a4('0x12'));var as=require(_0x66a4('0x13'));var hardwareService=require(_0x66a4('0x14'));var logger=require(_0x66a4('0x15'))(_0x66a4('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x66a4('0x17'));var db=require(_0x66a4('0x18'))['db'];function respondWithStatusCode(_0x3dc74f,_0x2d675b){_0x2d675b=_0x2d675b||0xcc;return function(_0x14d7da){if(_0x14d7da){return _0x3dc74f[_0x66a4('0x19')](_0x2d675b);}return _0x3dc74f['status'](_0x2d675b)[_0x66a4('0x1a')]();};}function respondWithResult(_0x179eb4,_0x350a72){_0x350a72=_0x350a72||0xc8;return function(_0x17557a){if(_0x17557a){return _0x179eb4[_0x66a4('0x1b')](_0x350a72)['json'](_0x17557a);}};}function respondWithFilteredResult(_0x158245,_0x47605b){return function(_0x55ce32){if(_0x55ce32){var _0xa7face=typeof _0x47605b[_0x66a4('0x1c')]===_0x66a4('0x1d')&&typeof _0x47605b['limit']===_0x66a4('0x1d');var _0x5545fd=_0x55ce32[_0x66a4('0x1e')];var _0x79eb1b=_0xa7face?0x0:_0x47605b[_0x66a4('0x1c')];var _0x526624=_0xa7face?_0x55ce32[_0x66a4('0x1e')]:_0x47605b[_0x66a4('0x1c')]+_0x47605b['limit'];var _0x47f705;if(_0x526624>=_0x5545fd){_0x526624=_0x5545fd;_0x47f705=0xc8;}else{_0x47f705=0xce;}_0x158245[_0x66a4('0x1b')](_0x47f705);return _0x158245[_0x66a4('0x1f')](_0x66a4('0x20'),_0x79eb1b+'-'+_0x526624+'/'+_0x5545fd)[_0x66a4('0x21')](_0x55ce32);}return null;};}function patchUpdates(_0x39247e){return function(_0x18b6df){try{jsonpatch['apply'](_0x18b6df,_0x39247e,!![]);}catch(_0x31b528){return BPromise[_0x66a4('0x22')](_0x31b528);}return _0x18b6df[_0x66a4('0x23')]();};}function saveUpdates(_0x5ce416,_0x33c726){return function(_0x88d71){if(_0x88d71){return _0x88d71[_0x66a4('0x24')](_0x5ce416)[_0x66a4('0x25')](function(_0xdcbfb5){return _0xdcbfb5;});}return null;};}function removeEntity(_0x14c44a,_0x2aee1b){return function(_0x52735e){if(_0x52735e){return _0x52735e['destroy']()['then'](function(){_0x14c44a['status'](0xcc)[_0x66a4('0x1a')]();});}};}function handleEntityNotFound(_0x2c0216,_0x219485){return function(_0x31ad21){if(!_0x31ad21){_0x2c0216[_0x66a4('0x19')](0x194);}return _0x31ad21;};}function handleError(_0x224700,_0x5a2970){_0x5a2970=_0x5a2970||0x1f4;return function(_0x546ebc){logger['error'](_0x546ebc[_0x66a4('0x26')]);if(_0x546ebc['name']){delete _0x546ebc['name'];}_0x224700['status'](_0x5a2970)['send'](_0x546ebc);};}exports[_0x66a4('0x27')]=function(_0x5c2edb,_0x2bcc65){var _0x152b37={},_0x461777={},_0x15fcb2={'count':0x0,'rows':[]};var _0x2d70be=_[_0x66a4('0x28')](db[_0x66a4('0x29')][_0x66a4('0x2a')],function(_0x285c4b){return{'name':_0x285c4b[_0x66a4('0x2b')],'type':_0x285c4b[_0x66a4('0x2c')][_0x66a4('0x2d')]};});_0x461777[_0x66a4('0x2e')]=_[_0x66a4('0x28')](_0x2d70be,_0x66a4('0x2f'));_0x461777[_0x66a4('0x30')]=_[_0x66a4('0x31')](_0x5c2edb[_0x66a4('0x30')]);_0x461777[_0x66a4('0x32')]=_[_0x66a4('0x33')](_0x461777[_0x66a4('0x2e')],_0x461777[_0x66a4('0x30')]);_0x152b37[_0x66a4('0x34')]=_['intersection'](_0x461777[_0x66a4('0x2e')],qs[_0x66a4('0x35')](_0x5c2edb['query'][_0x66a4('0x35')]));_0x152b37[_0x66a4('0x34')]=_0x152b37[_0x66a4('0x34')][_0x66a4('0x36')]?_0x152b37[_0x66a4('0x34')]:_0x461777[_0x66a4('0x2e')];if(!_0x5c2edb[_0x66a4('0x30')][_0x66a4('0x37')](_0x66a4('0x38'))){_0x152b37[_0x66a4('0x39')]=qs[_0x66a4('0x39')](_0x5c2edb[_0x66a4('0x30')][_0x66a4('0x39')]);_0x152b37[_0x66a4('0x1c')]=qs[_0x66a4('0x1c')](_0x5c2edb['query'][_0x66a4('0x1c')]);}_0x152b37[_0x66a4('0x3a')]=qs[_0x66a4('0x3b')](_0x5c2edb[_0x66a4('0x30')][_0x66a4('0x3b')]);_0x152b37[_0x66a4('0x3c')]=qs[_0x66a4('0x32')](_[_0x66a4('0x3d')](_0x5c2edb[_0x66a4('0x30')],_0x461777[_0x66a4('0x32')]),_0x2d70be);if(_0x5c2edb[_0x66a4('0x30')][_0x66a4('0x3e')]){_0x152b37[_0x66a4('0x3c')]=_[_0x66a4('0x3f')](_0x152b37['where'],{'$or':_[_0x66a4('0x28')](_0x2d70be,function(_0x2bdef3){if(_0x2bdef3[_0x66a4('0x2c')]!=='VIRTUAL'){var _0x298093={};_0x298093[_0x2bdef3[_0x66a4('0x2f')]]={'$like':'%'+_0x5c2edb[_0x66a4('0x30')]['filter']+'%'};return _0x298093;}})});}_0x152b37=_['merge']({},_0x152b37,_0x5c2edb[_0x66a4('0x40')]);var _0x2ee1b7={'where':_0x152b37['where']};return db['SugarcrmField']['count'](_0x2ee1b7)[_0x66a4('0x25')](function(_0x225cf4){_0x15fcb2[_0x66a4('0x1e')]=_0x225cf4;if(_0x5c2edb[_0x66a4('0x30')]['includeAll']){_0x152b37[_0x66a4('0x41')]=[{'all':!![]}];}return db[_0x66a4('0x29')][_0x66a4('0x42')](_0x152b37);})[_0x66a4('0x25')](function(_0x32f777){_0x15fcb2[_0x66a4('0x43')]=_0x32f777;return _0x15fcb2;})['then'](respondWithFilteredResult(_0x2bcc65,_0x152b37))[_0x66a4('0x44')](handleError(_0x2bcc65,null));};exports[_0x66a4('0x45')]=function(_0x3dd1e3,_0x430ca7){var _0x22e43e={'raw':!![],'where':{'id':_0x3dd1e3['params']['id']}},_0x1545b7={};_0x1545b7[_0x66a4('0x2e')]=_[_0x66a4('0x31')](db[_0x66a4('0x29')][_0x66a4('0x2a')]);_0x1545b7[_0x66a4('0x30')]=_[_0x66a4('0x31')](_0x3dd1e3[_0x66a4('0x30')]);_0x1545b7['filters']=_['intersection'](_0x1545b7[_0x66a4('0x2e')],_0x1545b7['query']);_0x22e43e[_0x66a4('0x34')]=_[_0x66a4('0x33')](_0x1545b7[_0x66a4('0x2e')],qs[_0x66a4('0x35')](_0x3dd1e3['query'][_0x66a4('0x35')]));_0x22e43e[_0x66a4('0x34')]=_0x22e43e['attributes']['length']?_0x22e43e[_0x66a4('0x34')]:_0x1545b7[_0x66a4('0x2e')];if(_0x3dd1e3[_0x66a4('0x30')][_0x66a4('0x46')]){_0x22e43e[_0x66a4('0x41')]=[{'all':!![]}];}_0x22e43e=_[_0x66a4('0x3f')]({},_0x22e43e,_0x3dd1e3[_0x66a4('0x40')]);return db[_0x66a4('0x29')]['find'](_0x22e43e)[_0x66a4('0x25')](handleEntityNotFound(_0x430ca7,null))['then'](respondWithResult(_0x430ca7,null))[_0x66a4('0x44')](handleError(_0x430ca7,null));};exports[_0x66a4('0x47')]=function(_0x4a4db0,_0x5a3f6b){return db[_0x66a4('0x29')][_0x66a4('0x47')](_0x4a4db0[_0x66a4('0x48')],{})[_0x66a4('0x25')](respondWithResult(_0x5a3f6b,0xc9))[_0x66a4('0x44')](handleError(_0x5a3f6b,null));};exports[_0x66a4('0x24')]=function(_0x56754b,_0x2dd1c1){if(_0x56754b[_0x66a4('0x48')]['id']){delete _0x56754b['body']['id'];}return db['SugarcrmField'][_0x66a4('0x49')]({'where':{'id':_0x56754b[_0x66a4('0x4a')]['id']}})[_0x66a4('0x25')](handleEntityNotFound(_0x2dd1c1,null))['then'](saveUpdates(_0x56754b[_0x66a4('0x48')],null))[_0x66a4('0x25')](respondWithResult(_0x2dd1c1,null))[_0x66a4('0x44')](handleError(_0x2dd1c1,null));};exports['destroy']=function(_0x10bf8a,_0x53a4b1){return db[_0x66a4('0x29')][_0x66a4('0x49')]({'where':{'id':_0x10bf8a[_0x66a4('0x4a')]['id']}})[_0x66a4('0x25')](handleEntityNotFound(_0x53a4b1,null))[_0x66a4('0x25')](removeEntity(_0x53a4b1,null))[_0x66a4('0x44')](handleError(_0x53a4b1,null));}; \ No newline at end of file +var _0x328a=['model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','filter','options','SugarcrmField','include','findAll','rows','catch','show','keys','includeAll','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','offset','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','fieldName','type','key'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x328a,0x1a1));var _0xa328=function(_0xf822f2,_0x532a8f){_0xf822f2=_0xf822f2-0x0;var _0x1cd623=_0x328a[_0xf822f2];return _0x1cd623;};'use strict';var emlformat=require(_0xa328('0x0'));var rimraf=require(_0xa328('0x1'));var zipdir=require(_0xa328('0x2'));var jsonpatch=require(_0xa328('0x3'));var rp=require(_0xa328('0x4'));var moment=require(_0xa328('0x5'));var BPromise=require(_0xa328('0x6'));var Mustache=require(_0xa328('0x7'));var util=require(_0xa328('0x8'));var path=require(_0xa328('0x9'));var sox=require(_0xa328('0xa'));var csv=require(_0xa328('0xb'));var ejs=require(_0xa328('0xc'));var fs=require('fs');var fs_extra=require(_0xa328('0xd'));var _=require(_0xa328('0xe'));var squel=require('squel');var crypto=require(_0xa328('0xf'));var jsforce=require(_0xa328('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xa328('0xb'));var querystring=require(_0xa328('0x11'));var Papa=require(_0xa328('0x12'));var Redis=require('ioredis');var authService=require(_0xa328('0x13'));var qs=require(_0xa328('0x14'));var as=require(_0xa328('0x15'));var hardwareService=require(_0xa328('0x16'));var logger=require('../../config/logger')(_0xa328('0x17'));var utils=require(_0xa328('0x18'));var config=require(_0xa328('0x19'));var licenseUtil=require(_0xa328('0x1a'));var db=require(_0xa328('0x1b'))['db'];function respondWithStatusCode(_0x148f8a,_0x113576){_0x113576=_0x113576||0xcc;return function(_0x2744d1){if(_0x2744d1){return _0x148f8a[_0xa328('0x1c')](_0x113576);}return _0x148f8a['status'](_0x113576)[_0xa328('0x1d')]();};}function respondWithResult(_0x538691,_0x33abcb){_0x33abcb=_0x33abcb||0xc8;return function(_0xbd915a){if(_0xbd915a){return _0x538691[_0xa328('0x1e')](_0x33abcb)['json'](_0xbd915a);}};}function respondWithFilteredResult(_0x45ecd2,_0x455439){return function(_0x1bd8a1){if(_0x1bd8a1){var _0x4255cc=typeof _0x455439['offset']===_0xa328('0x1f')&&typeof _0x455439['limit']===_0xa328('0x1f');var _0x28962c=_0x1bd8a1['count'];var _0x346d56=_0x4255cc?0x0:_0x455439[_0xa328('0x20')];var _0x2fcd86=_0x4255cc?_0x1bd8a1[_0xa328('0x21')]:_0x455439[_0xa328('0x20')]+_0x455439[_0xa328('0x22')];var _0x3ccbfc;if(_0x2fcd86>=_0x28962c){_0x2fcd86=_0x28962c;_0x3ccbfc=0xc8;}else{_0x3ccbfc=0xce;}_0x45ecd2[_0xa328('0x1e')](_0x3ccbfc);return _0x45ecd2['set'](_0xa328('0x23'),_0x346d56+'-'+_0x2fcd86+'/'+_0x28962c)[_0xa328('0x24')](_0x1bd8a1);}return null;};}function patchUpdates(_0x3bd2f1){return function(_0x1a18bb){try{jsonpatch[_0xa328('0x25')](_0x1a18bb,_0x3bd2f1,!![]);}catch(_0x2b8187){return BPromise[_0xa328('0x26')](_0x2b8187);}return _0x1a18bb[_0xa328('0x27')]();};}function saveUpdates(_0x5e0101,_0x53b6d4){return function(_0x27e49e){if(_0x27e49e){return _0x27e49e[_0xa328('0x28')](_0x5e0101)[_0xa328('0x29')](function(_0x5b0453){return _0x5b0453;});}return null;};}function removeEntity(_0x55f6fd,_0x4e18cb){return function(_0x572e2e){if(_0x572e2e){return _0x572e2e[_0xa328('0x2a')]()[_0xa328('0x29')](function(){_0x55f6fd[_0xa328('0x1e')](0xcc)[_0xa328('0x1d')]();});}};}function handleEntityNotFound(_0x43395d,_0x2117f9){return function(_0x2c09b8){if(!_0x2c09b8){_0x43395d[_0xa328('0x1c')](0x194);}return _0x2c09b8;};}function handleError(_0x58328f,_0x2c715d){_0x2c715d=_0x2c715d||0x1f4;return function(_0x406c2c){logger[_0xa328('0x2b')](_0x406c2c[_0xa328('0x2c')]);if(_0x406c2c[_0xa328('0x2d')]){delete _0x406c2c['name'];}_0x58328f[_0xa328('0x1e')](_0x2c715d)[_0xa328('0x2e')](_0x406c2c);};}exports['index']=function(_0x500e38,_0x509bd1){var _0x31d02c={},_0x3ee650={},_0x1ecf80={'count':0x0,'rows':[]};var _0x59d9e3=_[_0xa328('0x2f')](db['SugarcrmField']['rawAttributes'],function(_0x5b5fe9){return{'name':_0x5b5fe9[_0xa328('0x30')],'type':_0x5b5fe9[_0xa328('0x31')][_0xa328('0x32')]};});_0x3ee650[_0xa328('0x33')]=_[_0xa328('0x2f')](_0x59d9e3,_0xa328('0x2d'));_0x3ee650[_0xa328('0x34')]=_['keys'](_0x500e38[_0xa328('0x34')]);_0x3ee650['filters']=_[_0xa328('0x35')](_0x3ee650[_0xa328('0x33')],_0x3ee650[_0xa328('0x34')]);_0x31d02c[_0xa328('0x36')]=_[_0xa328('0x35')](_0x3ee650['model'],qs[_0xa328('0x37')](_0x500e38[_0xa328('0x34')][_0xa328('0x37')]));_0x31d02c['attributes']=_0x31d02c['attributes'][_0xa328('0x38')]?_0x31d02c[_0xa328('0x36')]:_0x3ee650[_0xa328('0x33')];if(!_0x500e38[_0xa328('0x34')]['hasOwnProperty'](_0xa328('0x39'))){_0x31d02c[_0xa328('0x22')]=qs[_0xa328('0x22')](_0x500e38[_0xa328('0x34')]['limit']);_0x31d02c[_0xa328('0x20')]=qs[_0xa328('0x20')](_0x500e38['query'][_0xa328('0x20')]);}_0x31d02c[_0xa328('0x3a')]=qs[_0xa328('0x3b')](_0x500e38[_0xa328('0x34')][_0xa328('0x3b')]);_0x31d02c[_0xa328('0x3c')]=qs[_0xa328('0x3d')](_[_0xa328('0x3e')](_0x500e38[_0xa328('0x34')],_0x3ee650[_0xa328('0x3d')]),_0x59d9e3);if(_0x500e38[_0xa328('0x34')]['filter']){_0x31d02c[_0xa328('0x3c')]=_[_0xa328('0x3f')](_0x31d02c[_0xa328('0x3c')],{'$or':_[_0xa328('0x2f')](_0x59d9e3,function(_0x2ce852){if(_0x2ce852[_0xa328('0x31')]!=='VIRTUAL'){var _0x3786e2={};_0x3786e2[_0x2ce852[_0xa328('0x2d')]]={'$like':'%'+_0x500e38[_0xa328('0x34')][_0xa328('0x40')]+'%'};return _0x3786e2;}})});}_0x31d02c=_[_0xa328('0x3f')]({},_0x31d02c,_0x500e38[_0xa328('0x41')]);var _0x4d3ea0={'where':_0x31d02c[_0xa328('0x3c')]};return db[_0xa328('0x42')][_0xa328('0x21')](_0x4d3ea0)['then'](function(_0x7fd76d){_0x1ecf80[_0xa328('0x21')]=_0x7fd76d;if(_0x500e38[_0xa328('0x34')]['includeAll']){_0x31d02c[_0xa328('0x43')]=[{'all':!![]}];}return db[_0xa328('0x42')][_0xa328('0x44')](_0x31d02c);})[_0xa328('0x29')](function(_0x1f8675){_0x1ecf80[_0xa328('0x45')]=_0x1f8675;return _0x1ecf80;})[_0xa328('0x29')](respondWithFilteredResult(_0x509bd1,_0x31d02c))[_0xa328('0x46')](handleError(_0x509bd1,null));};exports[_0xa328('0x47')]=function(_0x4b3a67,_0x1bece2){var _0x56ec4a={'raw':!![],'where':{'id':_0x4b3a67['params']['id']}},_0x57ceb5={};_0x57ceb5[_0xa328('0x33')]=_[_0xa328('0x48')](db[_0xa328('0x42')]['rawAttributes']);_0x57ceb5[_0xa328('0x34')]=_[_0xa328('0x48')](_0x4b3a67[_0xa328('0x34')]);_0x57ceb5['filters']=_['intersection'](_0x57ceb5[_0xa328('0x33')],_0x57ceb5[_0xa328('0x34')]);_0x56ec4a['attributes']=_[_0xa328('0x35')](_0x57ceb5[_0xa328('0x33')],qs['fields'](_0x4b3a67['query'][_0xa328('0x37')]));_0x56ec4a[_0xa328('0x36')]=_0x56ec4a[_0xa328('0x36')][_0xa328('0x38')]?_0x56ec4a[_0xa328('0x36')]:_0x57ceb5[_0xa328('0x33')];if(_0x4b3a67['query'][_0xa328('0x49')]){_0x56ec4a['include']=[{'all':!![]}];}_0x56ec4a=_[_0xa328('0x3f')]({},_0x56ec4a,_0x4b3a67[_0xa328('0x41')]);return db[_0xa328('0x42')][_0xa328('0x4a')](_0x56ec4a)['then'](handleEntityNotFound(_0x1bece2,null))[_0xa328('0x29')](respondWithResult(_0x1bece2,null))[_0xa328('0x46')](handleError(_0x1bece2,null));};exports['create']=function(_0x5bd804,_0x3f4370){return db['SugarcrmField'][_0xa328('0x4b')](_0x5bd804[_0xa328('0x4c')],{})[_0xa328('0x29')](respondWithResult(_0x3f4370,0xc9))[_0xa328('0x46')](handleError(_0x3f4370,null));};exports['update']=function(_0x3ab06d,_0x3bc7da){if(_0x3ab06d['body']['id']){delete _0x3ab06d['body']['id'];}return db[_0xa328('0x42')][_0xa328('0x4a')]({'where':{'id':_0x3ab06d['params']['id']}})['then'](handleEntityNotFound(_0x3bc7da,null))['then'](saveUpdates(_0x3ab06d[_0xa328('0x4c')],null))[_0xa328('0x29')](respondWithResult(_0x3bc7da,null))['catch'](handleError(_0x3bc7da,null));};exports['destroy']=function(_0x3d00ef,_0x8b2ba){return db['SugarcrmField']['find']({'where':{'id':_0x3d00ef[_0xa328('0x4d')]['id']}})['then'](handleEntityNotFound(_0x8b2ba,null))[_0xa328('0x29')](removeEntity(_0x8b2ba,null))[_0xa328('0x46')](handleError(_0x8b2ba,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index becae0a..e7be9cd 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 _0xbb57=['./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5f52e4,_0x5a69b3){var _0x25148b=function(_0x461a44){while(--_0x461a44){_0x5f52e4['push'](_0x5f52e4['shift']());}};_0x25148b(++_0x5a69b3);}(_0xbb57,0xc9));var _0x7bb5=function(_0x34a2a3,_0x1ed603){_0x34a2a3=_0x34a2a3-0x0;var _0x2b0ba1=_0xbb57[_0x34a2a3];return _0x2b0ba1;};'use strict';var _=require(_0x7bb5('0x0'));var util=require(_0x7bb5('0x1'));var logger=require(_0x7bb5('0x2'))(_0x7bb5('0x3'));var moment=require(_0x7bb5('0x4'));var BPromise=require(_0x7bb5('0x5'));var rp=require(_0x7bb5('0x6'));var fs=require('fs');var path=require(_0x7bb5('0x7'));var rimraf=require(_0x7bb5('0x8'));var config=require('../../config/environment');var attributes=require(_0x7bb5('0x9'));module[_0x7bb5('0xa')]=function(_0x2620e8,_0x46e815){return _0x2620e8[_0x7bb5('0xb')](_0x7bb5('0xc'),attributes,{'tableName':_0x7bb5('0xd'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x7bb5('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1f62=['moment','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','../../config/logger','api'];(function(_0x2c8812,_0x1cee22){var _0x56adff=function(_0x364233){while(--_0x364233){_0x2c8812['push'](_0x2c8812['shift']());}};_0x56adff(++_0x1cee22);}(_0x1f62,0x14d));var _0x21f6=function(_0x5f3de3,_0x40f0f5){_0x5f3de3=_0x5f3de3-0x0;var _0x287e0d=_0x1f62[_0x5f3de3];return _0x287e0d;};'use strict';var _=require(_0x21f6('0x0'));var util=require('util');var logger=require(_0x21f6('0x1'))(_0x21f6('0x2'));var moment=require(_0x21f6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x21f6('0x4'));var attributes=require('./intSugarcrmField.attributes');module[_0x21f6('0x5')]=function(_0x52efc3,_0x8b9364){return _0x52efc3[_0x21f6('0x6')](_0x21f6('0x7'),attributes,{'tableName':_0x21f6('0x8'),'paranoid':![],'indexes':[{'name':_0x21f6('0x9'),'fields':[_0x21f6('0xa'),_0x21f6('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 2e814bd..61d8789 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 _0x341d=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','SugarcrmField,\x20%s,\x20%s','debug'];(function(_0x169ca0,_0x48d215){var _0x2ce4df=function(_0x2721ca){while(--_0x2721ca){_0x169ca0['push'](_0x169ca0['shift']());}};_0x2ce4df(++_0x48d215);}(_0x341d,0x193));var _0xd341=function(_0x684ca2,_0x31e36a){_0x684ca2=_0x684ca2-0x0;var _0x5c5f67=_0x341d[_0x684ca2];return _0x5c5f67;};'use strict';var _=require(_0xd341('0x0'));var util=require(_0xd341('0x1'));var moment=require(_0xd341('0x2'));var BPromise=require(_0xd341('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd341('0x4'));var db=require(_0xd341('0x5'))['db'];var utils=require(_0xd341('0x6'));var logger=require(_0xd341('0x7'))('rpc');var config=require(_0xd341('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd341('0x9')][_0xd341('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5dd03d,_0x25a4c4,_0x17cc89){return new BPromise(function(_0x22c00c,_0x2a63b6){return client[_0xd341('0xb')](_0x5dd03d,_0x17cc89)[_0xd341('0xc')](function(_0x5d12f9){logger['info'](_0xd341('0xd'),_0x25a4c4,'request\x20sent');logger[_0xd341('0xe')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x25a4c4,'request\x20sent',JSON[_0xd341('0xf')](_0x5d12f9));if(_0x5d12f9[_0xd341('0x10')]){if(_0x5d12f9[_0xd341('0x10')][_0xd341('0x11')]===0x1f4){logger[_0xd341('0x10')](_0xd341('0xd'),_0x25a4c4,_0x5d12f9[_0xd341('0x10')][_0xd341('0x12')]);return _0x2a63b6(_0x5d12f9['error']['message']);}logger[_0xd341('0x10')](_0xd341('0xd'),_0x25a4c4,_0x5d12f9[_0xd341('0x10')]['message']);return _0x22c00c(_0x5d12f9['error'][_0xd341('0x12')]);}else{logger[_0xd341('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x25a4c4,'request\x20sent');_0x22c00c(_0x5d12f9[_0xd341('0x14')][_0xd341('0x12')]);}})[_0xd341('0x15')](function(_0x4d15ce){logger['error'](_0xd341('0xd'),_0x25a4c4,_0x4d15ce);_0x2a63b6(_0x4d15ce);});});} \ No newline at end of file +var _0x8725=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2159b2,_0x520eef){var _0xca35b9=function(_0x1aa426){while(--_0x1aa426){_0x2159b2['push'](_0x2159b2['shift']());}};_0xca35b9(++_0x520eef);}(_0x8725,0x68));var _0x5872=function(_0x55c00d,_0x520cb6){_0x55c00d=_0x55c00d-0x0;var _0x254a8f=_0x8725[_0x55c00d];return _0x254a8f;};'use strict';var _=require(_0x5872('0x0'));var util=require(_0x5872('0x1'));var moment=require(_0x5872('0x2'));var BPromise=require(_0x5872('0x3'));var rs=require(_0x5872('0x4'));var fs=require('fs');var Redis=require(_0x5872('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5872('0x6'));var logger=require(_0x5872('0x7'))(_0x5872('0x8'));var config=require(_0x5872('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5872('0xa')][_0x5872('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38aa4c,_0x505b9e,_0x1c014e){return new BPromise(function(_0x184718,_0x5c377b){return client['request'](_0x38aa4c,_0x1c014e)[_0x5872('0xc')](function(_0x28f5c8){logger[_0x5872('0xd')](_0x5872('0xe'),_0x505b9e,_0x5872('0xf'));logger[_0x5872('0x10')](_0x5872('0x11'),_0x505b9e,'request\x20sent',JSON[_0x5872('0x12')](_0x28f5c8));if(_0x28f5c8[_0x5872('0x13')]){if(_0x28f5c8[_0x5872('0x13')][_0x5872('0x14')]===0x1f4){logger[_0x5872('0x13')](_0x5872('0xe'),_0x505b9e,_0x28f5c8[_0x5872('0x13')][_0x5872('0x15')]);return _0x5c377b(_0x28f5c8[_0x5872('0x13')][_0x5872('0x15')]);}logger[_0x5872('0x13')](_0x5872('0xe'),_0x505b9e,_0x28f5c8[_0x5872('0x13')][_0x5872('0x15')]);return _0x184718(_0x28f5c8[_0x5872('0x13')][_0x5872('0x15')]);}else{logger['info'](_0x5872('0xe'),_0x505b9e,'request\x20sent');_0x184718(_0x28f5c8['result'][_0x5872('0x15')]);}})['catch'](function(_0x376834){logger[_0x5872('0x13')](_0x5872('0xe'),_0x505b9e,_0x376834);_0x5c377b(_0x376834);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 45e2e53..463cddd 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 _0x64b3=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x141345,_0x2a21eb){var _0x39e4c7=function(_0x368dd6){while(--_0x368dd6){_0x141345['push'](_0x141345['shift']());}};_0x39e4c7(++_0x2a21eb);}(_0x64b3,0x1de));var _0x364b=function(_0x546bb8,_0x5b0602){_0x546bb8=_0x546bb8-0x0;var _0x41e9f3=_0x64b3[_0x546bb8];return _0x41e9f3;};'use strict';var multer=require(_0x364b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x364b('0x1'));var express=require(_0x364b('0x2'));var router=express[_0x364b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x364b('0x4'));var interaction=require(_0x364b('0x5'));var config=require(_0x364b('0x6'));var controller=require(_0x364b('0x7'));router[_0x364b('0x8')]('/',auth[_0x364b('0x9')](),controller['index']);router['get'](_0x364b('0xa'),auth[_0x364b('0x9')](),controller[_0x364b('0xb')]);router[_0x364b('0x8')](_0x364b('0xc'),auth[_0x364b('0x9')](),controller[_0x364b('0xd')]);router[_0x364b('0x8')](_0x364b('0xe'),auth[_0x364b('0x9')](),controller[_0x364b('0xf')]);router[_0x364b('0x10')]('/',auth[_0x364b('0x9')](),controller[_0x364b('0x11')]);router[_0x364b('0x10')]('/:id/configurations',auth[_0x364b('0x9')](),controller[_0x364b('0x12')]);router[_0x364b('0x13')](_0x364b('0xa'),auth[_0x364b('0x9')](),controller[_0x364b('0x14')]);router[_0x364b('0x15')]('/:id',auth[_0x364b('0x9')](),controller[_0x364b('0x16')]);module[_0x364b('0x17')]=router; \ No newline at end of file +var _0xb4e6=['../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x503306,_0x356f2f){var _0x44a99d=function(_0x1a6ec4){while(--_0x1a6ec4){_0x503306['push'](_0x503306['shift']());}};_0x44a99d(++_0x356f2f);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xb4e6[_0xdc37a1];return _0x99b4fe;};'use strict';var multer=require(_0x6b4e('0x0'));var util=require('util');var path=require(_0x6b4e('0x1'));var timeout=require(_0x6b4e('0x2'));var express=require(_0x6b4e('0x3'));var router=express[_0x6b4e('0x4')]();var fs_extra=require(_0x6b4e('0x5'));var auth=require(_0x6b4e('0x6'));var interaction=require(_0x6b4e('0x7'));var config=require('../../config/environment');var controller=require(_0x6b4e('0x8'));router[_0x6b4e('0x9')]('/',auth[_0x6b4e('0xa')](),controller['index']);router[_0x6b4e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6b4e('0xb')]);router['get']('/:id/configurations',auth[_0x6b4e('0xa')](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0x9')](_0x6b4e('0xd'),auth[_0x6b4e('0xa')](),controller[_0x6b4e('0xe')]);router[_0x6b4e('0xf')]('/',auth['isAuthenticated'](),controller[_0x6b4e('0x10')]);router[_0x6b4e('0xf')]('/:id/configurations',auth[_0x6b4e('0xa')](),controller[_0x6b4e('0x11')]);router[_0x6b4e('0x12')](_0x6b4e('0x13'),auth[_0x6b4e('0xa')](),controller[_0x6b4e('0x14')]);router[_0x6b4e('0x15')]('/:id',auth[_0x6b4e('0xa')](),controller[_0x6b4e('0x16')]);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 1e04322..6ca2551 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 _0xa4ed=['exports','STRING','HelpDesk','sequelize'];(function(_0x215def,_0x52bf6c){var _0x42df56=function(_0x1faa57){while(--_0x1faa57){_0x215def['push'](_0x215def['shift']());}};_0x42df56(++_0x52bf6c);}(_0xa4ed,0x1cb));var _0xda4e=function(_0x3df5a4,_0x2e7acd){_0x3df5a4=_0x3df5a4-0x0;var _0x1cc6f7=_0xa4ed[_0x3df5a4];return _0x1cc6f7;};'use strict';var Sequelize=require(_0xda4e('0x0'));module[_0xda4e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xda4e('0x2')]},'username':{'type':Sequelize[_0xda4e('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xda4e('0x2')],'allowNull':![],'defaultValue':_0xda4e('0x3')},'remoteUri':{'type':Sequelize[_0xda4e('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xda4e('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xda4e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x2416=['HelpDesk','sequelize','exports','STRING'];(function(_0x86f131,_0x3655bd){var _0x1c2fe2=function(_0x222e43){while(--_0x222e43){_0x86f131['push'](_0x86f131['shift']());}};_0x1c2fe2(++_0x3655bd);}(_0x2416,0x91));var _0x6241=function(_0x345695,_0x31993d){_0x345695=_0x345695-0x0;var _0x1250ac=_0x2416[_0x345695];return _0x1250ac;};'use strict';var Sequelize=require(_0x6241('0x0'));module[_0x6241('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x6241('0x2')]},'username':{'type':Sequelize[_0x6241('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6241('0x2')],'allowNull':![],'defaultValue':_0x6241('0x3')},'remoteUri':{'type':Sequelize[_0x6241('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x6241('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 06f7e74..4640c6d 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 _0x65aa=['filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','catch','create','body','params','getConfigurations','findOne','VtigerConfiguration','rawAttributes','hasOwnProperty','addConfiguration','getSubjects','channel','VtigerField','Subjects','md5','username','moduleName','remoteUri','serverUrl','accessKey','slice','substring','format','%s/webservice.php','getchallenge','POST','result','token','success','GET','describe','sessionName','autogenerated','owner','includes','remove','false','startsWith','picklist','picklistValues','label','value','log','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','VtigerAccount','fieldName','type','key','model','map','query','keys'];(function(_0x16ca76,_0x258915){var _0xbfbbad=function(_0x5e1266){while(--_0x5e1266){_0x16ca76['push'](_0x16ca76['shift']());}};_0xbfbbad(++_0x258915);}(_0x65aa,0x132));var _0xa65a=function(_0x33e572,_0x4024f5){_0x33e572=_0x33e572-0x0;var _0x1513eb=_0x65aa[_0x33e572];return _0x1513eb;};'use strict';var emlformat=require(_0xa65a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa65a('0x1'));var jsonpatch=require(_0xa65a('0x2'));var rp=require(_0xa65a('0x3'));var moment=require(_0xa65a('0x4'));var BPromise=require(_0xa65a('0x5'));var Mustache=require(_0xa65a('0x6'));var util=require(_0xa65a('0x7'));var path=require(_0xa65a('0x8'));var sox=require('sox');var csv=require(_0xa65a('0x9'));var ejs=require(_0xa65a('0xa'));var fs=require('fs');var fs_extra=require(_0xa65a('0xb'));var _=require(_0xa65a('0xc'));var squel=require(_0xa65a('0xd'));var crypto=require('crypto');var jsforce=require(_0xa65a('0xe'));var deskjs=require(_0xa65a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa65a('0x10'));var Papa=require(_0xa65a('0x11'));var Redis=require('ioredis');var authService=require(_0xa65a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa65a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa65a('0x14'))(_0xa65a('0x15'));var utils=require(_0xa65a('0x16'));var config=require(_0xa65a('0x17'));var licenseUtil=require(_0xa65a('0x18'));var db=require(_0xa65a('0x19'))['db'];var integrations=require(_0xa65a('0x1a'));function respondWithStatusCode(_0x4ba60a,_0x253ef0){_0x253ef0=_0x253ef0||0xcc;return function(_0x56264e){if(_0x56264e){return _0x4ba60a[_0xa65a('0x1b')](_0x253ef0);}return _0x4ba60a[_0xa65a('0x1c')](_0x253ef0)[_0xa65a('0x1d')]();};}function respondWithResult(_0x3a1b98,_0x23b6e3){_0x23b6e3=_0x23b6e3||0xc8;return function(_0xe42beb){if(_0xe42beb){return _0x3a1b98['status'](_0x23b6e3)[_0xa65a('0x1e')](_0xe42beb);}};}function respondWithFilteredResult(_0x371985,_0x49bb1e){return function(_0x2d37be){if(_0x2d37be){var _0x2e7bbe=typeof _0x49bb1e['offset']==='undefined'&&typeof _0x49bb1e[_0xa65a('0x1f')]===_0xa65a('0x20');var _0x661cd6=_0x2d37be['count'];var _0x42ba1c=_0x2e7bbe?0x0:_0x49bb1e[_0xa65a('0x21')];var _0x490962=_0x2e7bbe?_0x2d37be[_0xa65a('0x22')]:_0x49bb1e[_0xa65a('0x21')]+_0x49bb1e['limit'];var _0x493d09;if(_0x490962>=_0x661cd6){_0x490962=_0x661cd6;_0x493d09=0xc8;}else{_0x493d09=0xce;}_0x371985['status'](_0x493d09);return _0x371985[_0xa65a('0x23')](_0xa65a('0x24'),_0x42ba1c+'-'+_0x490962+'/'+_0x661cd6)[_0xa65a('0x1e')](_0x2d37be);}return null;};}function patchUpdates(_0x252b64){return function(_0x5cdd5a){try{jsonpatch[_0xa65a('0x25')](_0x5cdd5a,_0x252b64,!![]);}catch(_0x23bbfa){return BPromise['reject'](_0x23bbfa);}return _0x5cdd5a[_0xa65a('0x26')]();};}function saveUpdates(_0x4cf91f,_0x1d803b){return function(_0x342d57){if(_0x342d57){return _0x342d57[_0xa65a('0x27')](_0x4cf91f)[_0xa65a('0x28')](function(_0x5770c7){return _0x5770c7;});}return null;};}function removeEntity(_0x296304,_0x489a09){return function(_0x2922f6){if(_0x2922f6){return _0x2922f6[_0xa65a('0x29')]()['then'](function(){_0x296304['status'](0xcc)[_0xa65a('0x1d')]();});}};}function handleEntityNotFound(_0x59c046,_0x3a2de5){return function(_0x300534){if(!_0x300534){_0x59c046[_0xa65a('0x1b')](0x194);}return _0x300534;};}function handleError(_0x5796fc,_0x4267dd){_0x4267dd=_0x4267dd||0x1f4;return function(_0x40c66d){logger[_0xa65a('0x2a')](_0x40c66d['stack']);if(_0x40c66d[_0xa65a('0x2b')]){delete _0x40c66d[_0xa65a('0x2b')];}_0x5796fc[_0xa65a('0x1c')](_0x4267dd)[_0xa65a('0x2c')](_0x40c66d);};}exports[_0xa65a('0x2d')]=function(_0x330409,_0x387b4a){var _0x1a70af={},_0x4aaf45={},_0x38248a={'count':0x0,'rows':[]};var _0x2240a8=_['map'](db[_0xa65a('0x2e')]['rawAttributes'],function(_0x38773f){return{'name':_0x38773f[_0xa65a('0x2f')],'type':_0x38773f[_0xa65a('0x30')][_0xa65a('0x31')]};});_0x4aaf45[_0xa65a('0x32')]=_[_0xa65a('0x33')](_0x2240a8,_0xa65a('0x2b'));_0x4aaf45[_0xa65a('0x34')]=_[_0xa65a('0x35')](_0x330409[_0xa65a('0x34')]);_0x4aaf45[_0xa65a('0x36')]=_['intersection'](_0x4aaf45[_0xa65a('0x32')],_0x4aaf45[_0xa65a('0x34')]);_0x1a70af[_0xa65a('0x37')]=_[_0xa65a('0x38')](_0x4aaf45[_0xa65a('0x32')],qs[_0xa65a('0x39')](_0x330409[_0xa65a('0x34')][_0xa65a('0x39')]));_0x1a70af[_0xa65a('0x37')]=_0x1a70af[_0xa65a('0x37')][_0xa65a('0x3a')]?_0x1a70af[_0xa65a('0x37')]:_0x4aaf45['model'];if(!_0x330409['query']['hasOwnProperty'](_0xa65a('0x3b'))){_0x1a70af[_0xa65a('0x1f')]=qs[_0xa65a('0x1f')](_0x330409[_0xa65a('0x34')][_0xa65a('0x1f')]);_0x1a70af[_0xa65a('0x21')]=qs[_0xa65a('0x21')](_0x330409['query'][_0xa65a('0x21')]);}_0x1a70af[_0xa65a('0x3c')]=qs[_0xa65a('0x3d')](_0x330409['query'][_0xa65a('0x3d')]);_0x1a70af[_0xa65a('0x3e')]=qs[_0xa65a('0x36')](_[_0xa65a('0x3f')](_0x330409[_0xa65a('0x34')],_0x4aaf45[_0xa65a('0x36')]),_0x2240a8);if(_0x330409[_0xa65a('0x34')][_0xa65a('0x40')]){_0x1a70af['where']=_[_0xa65a('0x41')](_0x1a70af[_0xa65a('0x3e')],{'$or':_[_0xa65a('0x33')](_0x2240a8,function(_0x2b5320){if(_0x2b5320[_0xa65a('0x30')]!=='VIRTUAL'){var _0x10ab57={};_0x10ab57[_0x2b5320[_0xa65a('0x2b')]]={'$like':'%'+_0x330409[_0xa65a('0x34')][_0xa65a('0x40')]+'%'};return _0x10ab57;}})});}_0x1a70af=_['merge']({},_0x1a70af,_0x330409[_0xa65a('0x42')]);var _0x5c8c55={'where':_0x1a70af[_0xa65a('0x3e')]};return db[_0xa65a('0x2e')][_0xa65a('0x22')](_0x5c8c55)[_0xa65a('0x28')](function(_0x2851c8){_0x38248a[_0xa65a('0x22')]=_0x2851c8;if(_0x330409['query'][_0xa65a('0x43')]){_0x1a70af['include']=[{'all':!![]}];}return db[_0xa65a('0x2e')][_0xa65a('0x44')](_0x1a70af);})[_0xa65a('0x28')](function(_0x168798){_0x38248a[_0xa65a('0x45')]=_0x168798;return _0x38248a;})[_0xa65a('0x28')](respondWithFilteredResult(_0x387b4a,_0x1a70af))['catch'](handleError(_0x387b4a,null));};exports[_0xa65a('0x46')]=function(_0x3bb078,_0x4f9515){var _0xb9c6d7={'raw':![],'where':{'id':_0x3bb078['params']['id']}},_0x599073={};_0x599073[_0xa65a('0x32')]=_[_0xa65a('0x35')](db[_0xa65a('0x2e')]['rawAttributes']);_0x599073[_0xa65a('0x34')]=_['keys'](_0x3bb078[_0xa65a('0x34')]);_0x599073['filters']=_[_0xa65a('0x38')](_0x599073[_0xa65a('0x32')],_0x599073[_0xa65a('0x34')]);_0xb9c6d7[_0xa65a('0x37')]=_[_0xa65a('0x38')](_0x599073['model'],qs[_0xa65a('0x39')](_0x3bb078['query'][_0xa65a('0x39')]));_0xb9c6d7[_0xa65a('0x37')]=_0xb9c6d7[_0xa65a('0x37')]['length']?_0xb9c6d7[_0xa65a('0x37')]:_0x599073['model'];if(_0x3bb078[_0xa65a('0x34')]['includeAll']){_0xb9c6d7['include']=[{'all':!![]}];}_0xb9c6d7=_['merge']({},_0xb9c6d7,_0x3bb078['options']);return db[_0xa65a('0x2e')]['find'](_0xb9c6d7)[_0xa65a('0x28')](handleEntityNotFound(_0x4f9515,null))[_0xa65a('0x28')](respondWithResult(_0x4f9515,null))[_0xa65a('0x47')](handleError(_0x4f9515,null));};exports[_0xa65a('0x48')]=function(_0x4dcc0f,_0x4ae4ad){return db[_0xa65a('0x2e')]['create'](_0x4dcc0f[_0xa65a('0x49')],{})[_0xa65a('0x28')](respondWithResult(_0x4ae4ad,0xc9))[_0xa65a('0x47')](handleError(_0x4ae4ad,null));};exports['update']=function(_0x336739,_0x2e60a8){if(_0x336739[_0xa65a('0x49')]['id']){delete _0x336739[_0xa65a('0x49')]['id'];}return db[_0xa65a('0x2e')]['find']({'where':{'id':_0x336739['params']['id']}})[_0xa65a('0x28')](handleEntityNotFound(_0x2e60a8,null))[_0xa65a('0x28')](saveUpdates(_0x336739[_0xa65a('0x49')],null))[_0xa65a('0x28')](respondWithResult(_0x2e60a8,null))[_0xa65a('0x47')](handleError(_0x2e60a8,null));};exports['destroy']=function(_0x32d0a3,_0x234331){return db[_0xa65a('0x2e')]['find']({'where':{'id':_0x32d0a3[_0xa65a('0x4a')]['id']}})[_0xa65a('0x28')](handleEntityNotFound(_0x234331,null))['then'](removeEntity(_0x234331,null))[_0xa65a('0x47')](handleError(_0x234331,null));};exports[_0xa65a('0x4b')]=function(_0x5112f1,_0xe69a07,_0x57f28f){var _0x3f06e3={};var _0x38c40b={};var _0x2ffa50;var _0x34c881;return db[_0xa65a('0x2e')][_0xa65a('0x4c')]({'where':{'id':_0x5112f1[_0xa65a('0x4a')]['id']}})['then'](handleEntityNotFound(_0xe69a07,null))[_0xa65a('0x28')](function(_0xc4f2ef){if(_0xc4f2ef){_0x2ffa50=_0xc4f2ef;_0x38c40b[_0xa65a('0x32')]=_[_0xa65a('0x35')](db[_0xa65a('0x4d')][_0xa65a('0x4e')]);_0x38c40b[_0xa65a('0x34')]=_[_0xa65a('0x35')](_0x5112f1[_0xa65a('0x34')]);_0x38c40b[_0xa65a('0x36')]=_['intersection'](_0x38c40b[_0xa65a('0x32')],_0x38c40b[_0xa65a('0x34')]);_0x3f06e3[_0xa65a('0x37')]=_[_0xa65a('0x38')](_0x38c40b[_0xa65a('0x32')],qs[_0xa65a('0x39')](_0x5112f1['query'][_0xa65a('0x39')]));_0x3f06e3[_0xa65a('0x37')]=_0x3f06e3[_0xa65a('0x37')][_0xa65a('0x3a')]?_0x3f06e3[_0xa65a('0x37')]:_0x38c40b[_0xa65a('0x32')];_0x3f06e3[_0xa65a('0x3c')]=qs[_0xa65a('0x3d')](_0x5112f1[_0xa65a('0x34')][_0xa65a('0x3d')]);_0x3f06e3['where']=qs[_0xa65a('0x36')](_[_0xa65a('0x3f')](_0x5112f1['query'],_0x38c40b['filters']));if(_0x5112f1[_0xa65a('0x34')][_0xa65a('0x40')]){_0x3f06e3['where']=_[_0xa65a('0x41')](_0x3f06e3[_0xa65a('0x3e')],{'$or':_[_0xa65a('0x33')](_0x3f06e3[_0xa65a('0x37')],function(_0x3d1c2c){var _0x108f1b={};_0x108f1b[_0x3d1c2c]={'$like':'%'+_0x5112f1[_0xa65a('0x34')][_0xa65a('0x40')]+'%'};return _0x108f1b;})});}_0x3f06e3=_[_0xa65a('0x41')]({},_0x3f06e3,_0x5112f1[_0xa65a('0x42')]);return _0x2ffa50[_0xa65a('0x4b')](_0x3f06e3);}})[_0xa65a('0x28')](function(_0x55b0e0){if(_0x55b0e0){_0x34c881=_0x55b0e0[_0xa65a('0x3a')];if(!_0x5112f1['query'][_0xa65a('0x4f')](_0xa65a('0x3b'))){_0x3f06e3[_0xa65a('0x1f')]=qs[_0xa65a('0x1f')](_0x5112f1[_0xa65a('0x34')][_0xa65a('0x1f')]);_0x3f06e3['offset']=qs[_0xa65a('0x21')](_0x5112f1[_0xa65a('0x34')][_0xa65a('0x21')]);}return _0x2ffa50[_0xa65a('0x4b')](_0x3f06e3);}})[_0xa65a('0x28')](function(_0xd436ee){if(_0xd436ee){return _0xd436ee?{'count':_0x34c881,'rows':_0xd436ee}:null;}})[_0xa65a('0x28')](respondWithResult(_0xe69a07,null))['catch'](handleError(_0xe69a07,null));};exports[_0xa65a('0x50')]=function(_0x376154,_0x16f2fb,_0x3c5d83){if(_0x376154[_0xa65a('0x49')]['id']){delete _0x376154[_0xa65a('0x49')]['id'];}return db['VtigerAccount'][_0xa65a('0x4c')]({'where':{'id':_0x376154[_0xa65a('0x4a')]['id']}})[_0xa65a('0x28')](handleEntityNotFound(_0x16f2fb,null))['then'](function(_0x1a1d44){if(_0x1a1d44){_0x376154[_0xa65a('0x49')]['AccountId']=_0x1a1d44['id'];_0x376154[_0xa65a('0x49')]['Subjects']=integrations[_0xa65a('0x51')](_0x376154[_0xa65a('0x49')][_0xa65a('0x52')],_0x376154[_0xa65a('0x49')][_0xa65a('0x30')]);_0x376154['body']['Descriptions']=integrations['getDescriptions'](_0x376154[_0xa65a('0x49')][_0xa65a('0x52')],_0x376154[_0xa65a('0x49')][_0xa65a('0x30')]);return db[_0xa65a('0x4d')][_0xa65a('0x48')](_0x376154[_0xa65a('0x49')],{'include':[{'model':db[_0xa65a('0x53')],'as':_0xa65a('0x54')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x16f2fb,null))[_0xa65a('0x47')](handleError(_0x16f2fb,null));};var md5=require(_0xa65a('0x55'));exports['getFields']=function(_0x2cda74,_0x2e40e6,_0x20b04e){var _0x2d0d99=null;var _0x8d22a7=null;var _0x2fecf5=null;var _0x4d446c=null;var _0x4a86a1='';return db[_0xa65a('0x2e')][_0xa65a('0x4c')]({'where':{'id':_0x2cda74[_0xa65a('0x4a')]['id']},'attributes':['id','name',_0xa65a('0x56'),'description',_0xa65a('0x57'),_0xa65a('0x58'),_0xa65a('0x59'),_0xa65a('0x5a')]})[_0xa65a('0x28')](handleEntityNotFound(_0x2e40e6,null))[_0xa65a('0x28')](function(_0x23065d){if(_0x23065d){_0x2d0d99=_0x23065d['username'];_0x8d22a7=_0x23065d['accessKey'];_0x2fecf5=_0x23065d[_0xa65a('0x57')];_0x4a86a1=_0x23065d[_0xa65a('0x58')];var _0x561d43=_0x4a86a1[_0xa65a('0x5b')](-0x1);if(_0x561d43==='/'){_0x4a86a1=_0x4a86a1[_0xa65a('0x5c')](0x0,_0x4a86a1['lastIndexOf'](_0x561d43));}_0x4d446c=util[_0xa65a('0x5d')](_0xa65a('0x5e'),_0x4a86a1);var _0x3338e9={'method':'GET','uri':_0x4d446c,'qs':{'operation':_0xa65a('0x5f'),'username':_0x23065d[_0xa65a('0x56')]},'json':!![]};return rp(_0x3338e9);}})['then'](function(_0x544de2){if(_0x544de2['success']){var _0x4e4794={'method':_0xa65a('0x60'),'uri':_0x4d446c,'form':{'operation':'login','username':_0x2d0d99,'accessKey':md5(_0x544de2[_0xa65a('0x61')][_0xa65a('0x62')]+_0x8d22a7)},'json':!![]};return rp(_0x4e4794);}})[_0xa65a('0x28')](function(_0x4273af){if(_0x4273af[_0xa65a('0x63')]){var _0x872804={'method':_0xa65a('0x64'),'uri':_0x4d446c,'qs':{'operation':_0xa65a('0x65'),'username':_0x2d0d99,'sessionName':_0x4273af[_0xa65a('0x61')][_0xa65a('0x66')],'elementType':_0x2fecf5},'json':!![]};return rp(_0x872804);}})[_0xa65a('0x28')](function(_0x1766f3){if(_0x1766f3[_0xa65a('0x63')]){var _0x5d39c0=[_0xa65a('0x67'),'reference',_0xa65a('0x68')];_['remove'](_0x1766f3[_0xa65a('0x61')][_0xa65a('0x39')],function(_0x51c3f1){return _0x5d39c0[_0xa65a('0x69')](_0x51c3f1[_0xa65a('0x30')][_0xa65a('0x2b')]);});_[_0xa65a('0x6a')](_0x1766f3['result'][_0xa65a('0x39')],function(_0x30956c){return _0x30956c['editable']===_0xa65a('0x6b');});return{'count':_0x1766f3[_0xa65a('0x61')][_0xa65a('0x39')]['length'],'rows':_[_0xa65a('0x33')](_0x1766f3[_0xa65a('0x61')][_0xa65a('0x39')],function(_0x5d3c2a){return{'id':_0x5d3c2a[_0xa65a('0x2b')],'name':_0x5d3c2a['label'],'custom':_[_0xa65a('0x6c')](_0x5d3c2a['name'],'cf_')?!![]:![],'options':_0x5d3c2a[_0xa65a('0x30')][_0xa65a('0x2b')]===_0xa65a('0x6d')&&_0x5d3c2a[_0xa65a('0x30')]['picklistValues']['length']>0x0?_[_0xa65a('0x33')](_0x5d3c2a[_0xa65a('0x30')][_0xa65a('0x6e')],function(_0x3269ee){return{'name':_0x3269ee[_0xa65a('0x6f')],'value':_0x3269ee[_0xa65a('0x70')]};}):[]};})};}})[_0xa65a('0x28')](respondWithResult(_0x2e40e6,null))[_0xa65a('0x47')](function(_0x5d6de4){console[_0xa65a('0x71')]('vTiger\x20error:\x20'+_0x5d6de4);var _0x1709d2=_0x2cda74[_0xa65a('0x34')]['test']?0x1f4:_0x5d6de4[_0xa65a('0x72')]||0x1f4;logger[_0xa65a('0x2a')](_0xa65a('0x73'),_0xa65a('0x74'),_0x1709d2,JSON[_0xa65a('0x75')](_0x5d6de4));delete _0x5d6de4[_0xa65a('0x2b')];if(_0x1709d2===0x191){_0x1709d2=0x190;}_0x2e40e6[_0xa65a('0x1c')](_0x1709d2)[_0xa65a('0x2c')](_0x2cda74[_0xa65a('0x34')][_0xa65a('0x76')]?{'message':_0xa65a('0x77'),'statusCode':_0x5d6de4[_0xa65a('0x72')]}:_0x5d6de4);});}; \ No newline at end of file +var _0xf84d=['destroy','error','stack','name','send','map','VtigerAccount','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','filter','VIRTUAL','options','include','findAll','rows','catch','params','keys','includeAll','find','create','body','findOne','rawAttributes','pick','merge','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','getFields','description','moduleName','remoteUri','serverUrl','slice','substring','lastIndexOf','format','GET','getchallenge','username','POST','login','describe','sessionName','success','autogenerated','reference','owner','result','includes','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then'];(function(_0xbf977,_0x379773){var _0x2fb0d6=function(_0x15f545){while(--_0x15f545){_0xbf977['push'](_0xbf977['shift']());}};_0x2fb0d6(++_0x379773);}(_0xf84d,0x1d8));var _0xdf84=function(_0x3861f7,_0x995b22){_0x3861f7=_0x3861f7-0x0;var _0x50879f=_0xf84d[_0x3861f7];return _0x50879f;};'use strict';var emlformat=require(_0xdf84('0x0'));var rimraf=require(_0xdf84('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdf84('0x2'));var rp=require(_0xdf84('0x3'));var moment=require(_0xdf84('0x4'));var BPromise=require(_0xdf84('0x5'));var Mustache=require(_0xdf84('0x6'));var util=require(_0xdf84('0x7'));var path=require(_0xdf84('0x8'));var sox=require(_0xdf84('0x9'));var csv=require(_0xdf84('0xa'));var ejs=require(_0xdf84('0xb'));var fs=require('fs');var fs_extra=require(_0xdf84('0xc'));var _=require(_0xdf84('0xd'));var squel=require(_0xdf84('0xe'));var crypto=require(_0xdf84('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xdf84('0x10'));var toCsv=require(_0xdf84('0xa'));var querystring=require(_0xdf84('0x11'));var Papa=require(_0xdf84('0x12'));var Redis=require(_0xdf84('0x13'));var authService=require(_0xdf84('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xdf84('0x15'));var hardwareService=require(_0xdf84('0x16'));var logger=require(_0xdf84('0x17'))(_0xdf84('0x18'));var utils=require(_0xdf84('0x19'));var config=require(_0xdf84('0x1a'));var licenseUtil=require(_0xdf84('0x1b'));var db=require(_0xdf84('0x1c'))['db'];var integrations=require(_0xdf84('0x1d'));function respondWithStatusCode(_0xa8be5a,_0x43dc07){_0x43dc07=_0x43dc07||0xcc;return function(_0x3ddf9c){if(_0x3ddf9c){return _0xa8be5a[_0xdf84('0x1e')](_0x43dc07);}return _0xa8be5a[_0xdf84('0x1f')](_0x43dc07)[_0xdf84('0x20')]();};}function respondWithResult(_0x48e5d9,_0xb97269){_0xb97269=_0xb97269||0xc8;return function(_0x2c177e){if(_0x2c177e){return _0x48e5d9[_0xdf84('0x1f')](_0xb97269)[_0xdf84('0x21')](_0x2c177e);}};}function respondWithFilteredResult(_0x40a64f,_0x340322){return function(_0x47286b){if(_0x47286b){var _0x131af8=typeof _0x340322['offset']===_0xdf84('0x22')&&typeof _0x340322[_0xdf84('0x23')]===_0xdf84('0x22');var _0x58ddb8=_0x47286b[_0xdf84('0x24')];var _0x12b924=_0x131af8?0x0:_0x340322[_0xdf84('0x25')];var _0x484e45=_0x131af8?_0x47286b['count']:_0x340322[_0xdf84('0x25')]+_0x340322['limit'];var _0x3605e;if(_0x484e45>=_0x58ddb8){_0x484e45=_0x58ddb8;_0x3605e=0xc8;}else{_0x3605e=0xce;}_0x40a64f[_0xdf84('0x1f')](_0x3605e);return _0x40a64f[_0xdf84('0x26')](_0xdf84('0x27'),_0x12b924+'-'+_0x484e45+'/'+_0x58ddb8)[_0xdf84('0x21')](_0x47286b);}return null;};}function patchUpdates(_0x15f60a){return function(_0x5e09b3){try{jsonpatch[_0xdf84('0x28')](_0x5e09b3,_0x15f60a,!![]);}catch(_0x2735eb){return BPromise[_0xdf84('0x29')](_0x2735eb);}return _0x5e09b3['save']();};}function saveUpdates(_0x1fd28c,_0x2c569c){return function(_0x358b2a){if(_0x358b2a){return _0x358b2a[_0xdf84('0x2a')](_0x1fd28c)[_0xdf84('0x2b')](function(_0x31101b){return _0x31101b;});}return null;};}function removeEntity(_0x24ccbc,_0x1384cd){return function(_0x107299){if(_0x107299){return _0x107299[_0xdf84('0x2c')]()['then'](function(){_0x24ccbc[_0xdf84('0x1f')](0xcc)[_0xdf84('0x20')]();});}};}function handleEntityNotFound(_0x2c7382,_0x5260df){return function(_0x3e244c){if(!_0x3e244c){_0x2c7382['sendStatus'](0x194);}return _0x3e244c;};}function handleError(_0x4daf06,_0x162e6a){_0x162e6a=_0x162e6a||0x1f4;return function(_0x4d149c){logger[_0xdf84('0x2d')](_0x4d149c[_0xdf84('0x2e')]);if(_0x4d149c[_0xdf84('0x2f')]){delete _0x4d149c['name'];}_0x4daf06[_0xdf84('0x1f')](_0x162e6a)[_0xdf84('0x30')](_0x4d149c);};}exports['index']=function(_0x2990f0,_0x45f7a2){var _0x543cde={},_0x56b82e={},_0x5e61ce={'count':0x0,'rows':[]};var _0x480f91=_[_0xdf84('0x31')](db[_0xdf84('0x32')]['rawAttributes'],function(_0x313ce4){return{'name':_0x313ce4[_0xdf84('0x33')],'type':_0x313ce4[_0xdf84('0x34')][_0xdf84('0x35')]};});_0x56b82e[_0xdf84('0x36')]=_[_0xdf84('0x31')](_0x480f91,_0xdf84('0x2f'));_0x56b82e[_0xdf84('0x37')]=_['keys'](_0x2990f0[_0xdf84('0x37')]);_0x56b82e['filters']=_['intersection'](_0x56b82e['model'],_0x56b82e[_0xdf84('0x37')]);_0x543cde[_0xdf84('0x38')]=_[_0xdf84('0x39')](_0x56b82e[_0xdf84('0x36')],qs['fields'](_0x2990f0[_0xdf84('0x37')][_0xdf84('0x3a')]));_0x543cde['attributes']=_0x543cde[_0xdf84('0x38')][_0xdf84('0x3b')]?_0x543cde[_0xdf84('0x38')]:_0x56b82e[_0xdf84('0x36')];if(!_0x2990f0[_0xdf84('0x37')][_0xdf84('0x3c')]('nolimit')){_0x543cde[_0xdf84('0x23')]=qs[_0xdf84('0x23')](_0x2990f0['query'][_0xdf84('0x23')]);_0x543cde[_0xdf84('0x25')]=qs[_0xdf84('0x25')](_0x2990f0[_0xdf84('0x37')]['offset']);}_0x543cde['order']=qs[_0xdf84('0x3d')](_0x2990f0[_0xdf84('0x37')]['sort']);_0x543cde[_0xdf84('0x3e')]=qs[_0xdf84('0x3f')](_['pick'](_0x2990f0[_0xdf84('0x37')],_0x56b82e['filters']),_0x480f91);if(_0x2990f0[_0xdf84('0x37')][_0xdf84('0x40')]){_0x543cde[_0xdf84('0x3e')]=_['merge'](_0x543cde['where'],{'$or':_['map'](_0x480f91,function(_0x61342b){if(_0x61342b[_0xdf84('0x34')]!==_0xdf84('0x41')){var _0x4d5680={};_0x4d5680[_0x61342b[_0xdf84('0x2f')]]={'$like':'%'+_0x2990f0[_0xdf84('0x37')]['filter']+'%'};return _0x4d5680;}})});}_0x543cde=_['merge']({},_0x543cde,_0x2990f0[_0xdf84('0x42')]);var _0xa0b631={'where':_0x543cde[_0xdf84('0x3e')]};return db[_0xdf84('0x32')]['count'](_0xa0b631)[_0xdf84('0x2b')](function(_0x48c9b7){_0x5e61ce[_0xdf84('0x24')]=_0x48c9b7;if(_0x2990f0['query']['includeAll']){_0x543cde[_0xdf84('0x43')]=[{'all':!![]}];}return db[_0xdf84('0x32')][_0xdf84('0x44')](_0x543cde);})['then'](function(_0x3cebdc){_0x5e61ce[_0xdf84('0x45')]=_0x3cebdc;return _0x5e61ce;})[_0xdf84('0x2b')](respondWithFilteredResult(_0x45f7a2,_0x543cde))[_0xdf84('0x46')](handleError(_0x45f7a2,null));};exports['show']=function(_0xa9bf80,_0x427743){var _0x5be8e0={'raw':![],'where':{'id':_0xa9bf80[_0xdf84('0x47')]['id']}},_0x4fcbd7={};_0x4fcbd7[_0xdf84('0x36')]=_[_0xdf84('0x48')](db[_0xdf84('0x32')]['rawAttributes']);_0x4fcbd7[_0xdf84('0x37')]=_[_0xdf84('0x48')](_0xa9bf80[_0xdf84('0x37')]);_0x4fcbd7['filters']=_[_0xdf84('0x39')](_0x4fcbd7[_0xdf84('0x36')],_0x4fcbd7[_0xdf84('0x37')]);_0x5be8e0['attributes']=_[_0xdf84('0x39')](_0x4fcbd7['model'],qs[_0xdf84('0x3a')](_0xa9bf80[_0xdf84('0x37')][_0xdf84('0x3a')]));_0x5be8e0[_0xdf84('0x38')]=_0x5be8e0[_0xdf84('0x38')][_0xdf84('0x3b')]?_0x5be8e0[_0xdf84('0x38')]:_0x4fcbd7[_0xdf84('0x36')];if(_0xa9bf80[_0xdf84('0x37')][_0xdf84('0x49')]){_0x5be8e0[_0xdf84('0x43')]=[{'all':!![]}];}_0x5be8e0=_['merge']({},_0x5be8e0,_0xa9bf80['options']);return db['VtigerAccount'][_0xdf84('0x4a')](_0x5be8e0)['then'](handleEntityNotFound(_0x427743,null))[_0xdf84('0x2b')](respondWithResult(_0x427743,null))['catch'](handleError(_0x427743,null));};exports[_0xdf84('0x4b')]=function(_0x99f306,_0x2015eb){return db[_0xdf84('0x32')][_0xdf84('0x4b')](_0x99f306['body'],{})['then'](respondWithResult(_0x2015eb,0xc9))[_0xdf84('0x46')](handleError(_0x2015eb,null));};exports[_0xdf84('0x2a')]=function(_0x2b7b02,_0x1eefdb){if(_0x2b7b02[_0xdf84('0x4c')]['id']){delete _0x2b7b02[_0xdf84('0x4c')]['id'];}return db['VtigerAccount'][_0xdf84('0x4a')]({'where':{'id':_0x2b7b02[_0xdf84('0x47')]['id']}})[_0xdf84('0x2b')](handleEntityNotFound(_0x1eefdb,null))['then'](saveUpdates(_0x2b7b02[_0xdf84('0x4c')],null))[_0xdf84('0x2b')](respondWithResult(_0x1eefdb,null))['catch'](handleError(_0x1eefdb,null));};exports[_0xdf84('0x2c')]=function(_0x4d63dd,_0x3b730a){return db[_0xdf84('0x32')][_0xdf84('0x4a')]({'where':{'id':_0x4d63dd['params']['id']}})[_0xdf84('0x2b')](handleEntityNotFound(_0x3b730a,null))[_0xdf84('0x2b')](removeEntity(_0x3b730a,null))[_0xdf84('0x46')](handleError(_0x3b730a,null));};exports['getConfigurations']=function(_0x287f75,_0x1b564f,_0x340f04){var _0x3475e9={};var _0x2807ca={};var _0x2b422a;var _0x2fce21;return db['VtigerAccount'][_0xdf84('0x4d')]({'where':{'id':_0x287f75['params']['id']}})[_0xdf84('0x2b')](handleEntityNotFound(_0x1b564f,null))[_0xdf84('0x2b')](function(_0x23adb7){if(_0x23adb7){_0x2b422a=_0x23adb7;_0x2807ca[_0xdf84('0x36')]=_[_0xdf84('0x48')](db['VtigerConfiguration'][_0xdf84('0x4e')]);_0x2807ca[_0xdf84('0x37')]=_[_0xdf84('0x48')](_0x287f75[_0xdf84('0x37')]);_0x2807ca[_0xdf84('0x3f')]=_[_0xdf84('0x39')](_0x2807ca[_0xdf84('0x36')],_0x2807ca[_0xdf84('0x37')]);_0x3475e9[_0xdf84('0x38')]=_[_0xdf84('0x39')](_0x2807ca[_0xdf84('0x36')],qs[_0xdf84('0x3a')](_0x287f75[_0xdf84('0x37')][_0xdf84('0x3a')]));_0x3475e9[_0xdf84('0x38')]=_0x3475e9[_0xdf84('0x38')][_0xdf84('0x3b')]?_0x3475e9['attributes']:_0x2807ca[_0xdf84('0x36')];_0x3475e9['order']=qs[_0xdf84('0x3d')](_0x287f75[_0xdf84('0x37')][_0xdf84('0x3d')]);_0x3475e9[_0xdf84('0x3e')]=qs[_0xdf84('0x3f')](_[_0xdf84('0x4f')](_0x287f75[_0xdf84('0x37')],_0x2807ca[_0xdf84('0x3f')]));if(_0x287f75['query'][_0xdf84('0x40')]){_0x3475e9[_0xdf84('0x3e')]=_[_0xdf84('0x50')](_0x3475e9[_0xdf84('0x3e')],{'$or':_[_0xdf84('0x31')](_0x3475e9[_0xdf84('0x38')],function(_0x3a1dfa){var _0x2ce082={};_0x2ce082[_0x3a1dfa]={'$like':'%'+_0x287f75[_0xdf84('0x37')]['filter']+'%'};return _0x2ce082;})});}_0x3475e9=_[_0xdf84('0x50')]({},_0x3475e9,_0x287f75[_0xdf84('0x42')]);return _0x2b422a[_0xdf84('0x51')](_0x3475e9);}})[_0xdf84('0x2b')](function(_0x1c0445){if(_0x1c0445){_0x2fce21=_0x1c0445[_0xdf84('0x3b')];if(!_0x287f75['query'][_0xdf84('0x3c')]('nolimit')){_0x3475e9[_0xdf84('0x23')]=qs['limit'](_0x287f75['query'][_0xdf84('0x23')]);_0x3475e9[_0xdf84('0x25')]=qs[_0xdf84('0x25')](_0x287f75['query'][_0xdf84('0x25')]);}return _0x2b422a[_0xdf84('0x51')](_0x3475e9);}})[_0xdf84('0x2b')](function(_0x3ccbb5){if(_0x3ccbb5){return _0x3ccbb5?{'count':_0x2fce21,'rows':_0x3ccbb5}:null;}})[_0xdf84('0x2b')](respondWithResult(_0x1b564f,null))[_0xdf84('0x46')](handleError(_0x1b564f,null));};exports[_0xdf84('0x52')]=function(_0x4a3c05,_0x293003,_0x35cb09){if(_0x4a3c05[_0xdf84('0x4c')]['id']){delete _0x4a3c05[_0xdf84('0x4c')]['id'];}return db[_0xdf84('0x32')][_0xdf84('0x4d')]({'where':{'id':_0x4a3c05[_0xdf84('0x47')]['id']}})[_0xdf84('0x2b')](handleEntityNotFound(_0x293003,null))[_0xdf84('0x2b')](function(_0x5bffef){if(_0x5bffef){_0x4a3c05[_0xdf84('0x4c')][_0xdf84('0x53')]=_0x5bffef['id'];_0x4a3c05[_0xdf84('0x4c')][_0xdf84('0x54')]=integrations[_0xdf84('0x55')](_0x4a3c05[_0xdf84('0x4c')][_0xdf84('0x56')],_0x4a3c05['body'][_0xdf84('0x34')]);_0x4a3c05[_0xdf84('0x4c')][_0xdf84('0x57')]=integrations[_0xdf84('0x58')](_0x4a3c05[_0xdf84('0x4c')][_0xdf84('0x56')],_0x4a3c05[_0xdf84('0x4c')]['type']);return db[_0xdf84('0x59')][_0xdf84('0x4b')](_0x4a3c05['body'],{'include':[{'model':db[_0xdf84('0x5a')],'as':_0xdf84('0x54')},{'model':db['VtigerField'],'as':_0xdf84('0x57')}]});}return null;})[_0xdf84('0x2b')](respondWithResult(_0x293003,null))[_0xdf84('0x46')](handleError(_0x293003,null));};var md5=require('md5');exports[_0xdf84('0x5b')]=function(_0x11fd2b,_0x1ee517,_0x5cc6de){var _0x256e10=null;var _0x2530d4=null;var _0x31c8a1=null;var _0x433d24=null;var _0x3cc7b4='';return db['VtigerAccount'][_0xdf84('0x4d')]({'where':{'id':_0x11fd2b[_0xdf84('0x47')]['id']},'attributes':['id','name','username',_0xdf84('0x5c'),_0xdf84('0x5d'),_0xdf84('0x5e'),_0xdf84('0x5f'),'accessKey']})[_0xdf84('0x2b')](handleEntityNotFound(_0x1ee517,null))['then'](function(_0x1504b0){if(_0x1504b0){_0x256e10=_0x1504b0['username'];_0x2530d4=_0x1504b0['accessKey'];_0x31c8a1=_0x1504b0['moduleName'];_0x3cc7b4=_0x1504b0[_0xdf84('0x5e')];var _0x4ce816=_0x3cc7b4[_0xdf84('0x60')](-0x1);if(_0x4ce816==='/'){_0x3cc7b4=_0x3cc7b4[_0xdf84('0x61')](0x0,_0x3cc7b4[_0xdf84('0x62')](_0x4ce816));}_0x433d24=util[_0xdf84('0x63')]('%s/webservice.php',_0x3cc7b4);var _0x3c3009={'method':_0xdf84('0x64'),'uri':_0x433d24,'qs':{'operation':_0xdf84('0x65'),'username':_0x1504b0[_0xdf84('0x66')]},'json':!![]};return rp(_0x3c3009);}})[_0xdf84('0x2b')](function(_0x5e5e99){if(_0x5e5e99['success']){var _0x3af1fa={'method':_0xdf84('0x67'),'uri':_0x433d24,'form':{'operation':_0xdf84('0x68'),'username':_0x256e10,'accessKey':md5(_0x5e5e99['result']['token']+_0x2530d4)},'json':!![]};return rp(_0x3af1fa);}})[_0xdf84('0x2b')](function(_0xbe0f06){if(_0xbe0f06['success']){var _0x19bbad={'method':'GET','uri':_0x433d24,'qs':{'operation':_0xdf84('0x69'),'username':_0x256e10,'sessionName':_0xbe0f06['result'][_0xdf84('0x6a')],'elementType':_0x31c8a1},'json':!![]};return rp(_0x19bbad);}})[_0xdf84('0x2b')](function(_0x422c92){if(_0x422c92[_0xdf84('0x6b')]){var _0x1542e0=[_0xdf84('0x6c'),_0xdf84('0x6d'),_0xdf84('0x6e')];_['remove'](_0x422c92[_0xdf84('0x6f')][_0xdf84('0x3a')],function(_0x31df52){return _0x1542e0[_0xdf84('0x70')](_0x31df52['type'][_0xdf84('0x2f')]);});_[_0xdf84('0x71')](_0x422c92[_0xdf84('0x6f')]['fields'],function(_0x584ab7){return _0x584ab7[_0xdf84('0x72')]===_0xdf84('0x73');});return{'count':_0x422c92[_0xdf84('0x6f')][_0xdf84('0x3a')][_0xdf84('0x3b')],'rows':_[_0xdf84('0x31')](_0x422c92[_0xdf84('0x6f')][_0xdf84('0x3a')],function(_0xea2610){return{'id':_0xea2610['name'],'name':_0xea2610[_0xdf84('0x74')],'custom':_[_0xdf84('0x75')](_0xea2610[_0xdf84('0x2f')],_0xdf84('0x76'))?!![]:![],'options':_0xea2610['type'][_0xdf84('0x2f')]===_0xdf84('0x77')&&_0xea2610['type'][_0xdf84('0x78')][_0xdf84('0x3b')]>0x0?_[_0xdf84('0x31')](_0xea2610[_0xdf84('0x34')][_0xdf84('0x78')],function(_0x2f83e5){return{'name':_0x2f83e5[_0xdf84('0x74')],'value':_0x2f83e5[_0xdf84('0x79')]};}):[]};})};}})[_0xdf84('0x2b')](respondWithResult(_0x1ee517,null))['catch'](function(_0x223ffc){console[_0xdf84('0x7a')](_0xdf84('0x7b')+_0x223ffc);var _0x5879cc=_0x11fd2b[_0xdf84('0x37')][_0xdf84('0x7c')]?0x1f4:_0x223ffc['statusCode']||0x1f4;logger['error'](_0xdf84('0x7d'),_0xdf84('0x5b'),_0x5879cc,JSON[_0xdf84('0x7e')](_0x223ffc));delete _0x223ffc[_0xdf84('0x2f')];if(_0x5879cc===0x191){_0x5879cc=0x190;}_0x1ee517['status'](_0x5879cc)[_0xdf84('0x30')](_0x11fd2b[_0xdf84('0x37')][_0xdf84('0x7c')]?{'message':_0xdf84('0x7f'),'statusCode':_0x223ffc[_0xdf84('0x80')]}:_0x223ffc);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 5ca642b..42954cf 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 _0x1753=['api','moment','bluebird','request-promise','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x1753,0xb3));var _0x3175=function(_0x7d9021,_0xd8c808){_0x7d9021=_0x7d9021-0x0;var _0x30c4e9=_0x1753[_0x7d9021];return _0x30c4e9;};'use strict';var _=require(_0x3175('0x0'));var util=require(_0x3175('0x1'));var logger=require(_0x3175('0x2'))(_0x3175('0x3'));var moment=require(_0x3175('0x4'));var BPromise=require(_0x3175('0x5'));var rp=require(_0x3175('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3175('0x7'));var config=require('../../config/environment');var attributes=require(_0x3175('0x8'));var integrations=require(_0x3175('0x9'));module['exports']=function(_0x1fe87f,_0x3227e4){return _0x1fe87f[_0x3175('0xa')](_0x3175('0xb'),attributes,{'tableName':_0x3175('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85a0=['VtigerAccount','int_vtiger_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','define'];(function(_0x26a4d3,_0x359ff9){var _0x5c8783=function(_0x229650){while(--_0x229650){_0x26a4d3['push'](_0x26a4d3['shift']());}};_0x5c8783(++_0x359ff9);}(_0x85a0,0xdf));var _0x085a=function(_0x232717,_0x5e8b91){_0x232717=_0x232717-0x0;var _0x305659=_0x85a0[_0x232717];return _0x305659;};'use strict';var _=require(_0x085a('0x0'));var util=require(_0x085a('0x1'));var logger=require('../../config/logger')(_0x085a('0x2'));var moment=require(_0x085a('0x3'));var BPromise=require(_0x085a('0x4'));var rp=require(_0x085a('0x5'));var fs=require('fs');var path=require(_0x085a('0x6'));var rimraf=require(_0x085a('0x7'));var config=require('../../config/environment');var attributes=require(_0x085a('0x8'));var integrations=require(_0x085a('0x9'));module['exports']=function(_0x5c9284,_0x3dcbc6){return _0x5c9284[_0x085a('0xa')](_0x085a('0xb'),attributes,{'tableName':_0x085a('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 cd8eea1..8cd037f 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 _0xe5b5=['GetVtigerAccount','VtigerAccount','options','where','attributes','include','map','model','debug','ShowVtigerAccount','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','catch'];(function(_0x3a5b9f,_0x599f46){var _0x4e9b72=function(_0x20ac03){while(--_0x20ac03){_0x3a5b9f['push'](_0x3a5b9f['shift']());}};_0x4e9b72(++_0x599f46);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x4667b2,_0x135b67){_0x4667b2=_0x4667b2-0x0;var _0x1070f2=_0xe5b5[_0x4667b2];return _0x1070f2;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var moment=require(_0x5e5b('0x2'));var BPromise=require(_0x5e5b('0x3'));var rs=require(_0x5e5b('0x4'));var fs=require('fs');var Redis=require(_0x5e5b('0x5'));var db=require(_0x5e5b('0x6'))['db'];var utils=require(_0x5e5b('0x7'));var logger=require(_0x5e5b('0x8'))(_0x5e5b('0x9'));var config=require(_0x5e5b('0xa'));var jayson=require(_0x5e5b('0xb'));var client=jayson[_0x5e5b('0xc')][_0x5e5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x545eb3,_0x29db2c,_0xe089b1){return new BPromise(function(_0xcbd478,_0x258414){return client[_0x5e5b('0xe')](_0x545eb3,_0xe089b1)[_0x5e5b('0xf')](function(_0x3a37db){logger[_0x5e5b('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x29db2c,_0x5e5b('0x11'));logger['debug'](_0x5e5b('0x12'),_0x29db2c,_0x5e5b('0x11'),JSON[_0x5e5b('0x13')](_0x3a37db));if(_0x3a37db[_0x5e5b('0x14')]){if(_0x3a37db['error']['code']===0x1f4){logger['error'](_0x5e5b('0x15'),_0x29db2c,_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);return _0x258414(_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);}logger[_0x5e5b('0x14')](_0x5e5b('0x15'),_0x29db2c,_0x3a37db['error'][_0x5e5b('0x16')]);return _0xcbd478(_0x3a37db[_0x5e5b('0x14')]['message']);}else{logger[_0x5e5b('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x29db2c,'request\x20sent');_0xcbd478(_0x3a37db[_0x5e5b('0x17')][_0x5e5b('0x16')]);}})[_0x5e5b('0x18')](function(_0x5c7148){logger[_0x5e5b('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x29db2c,_0x5c7148);_0x258414(_0x5c7148);});});}exports[_0x5e5b('0x19')]=function(_0x45a091){var _0x4c5f9a=this;return new Promise(function(_0xe5aa6b,_0x1560e1){return db[_0x5e5b('0x1a')]['findAll']({'raw':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1c')]||null:null,'attributes':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1d')]||null:null,'limit':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')]['limit']||null:null,'include':_0x45a091['options']?_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1e')],function(_0x28cd95){return{'model':db[_0x28cd95[_0x5e5b('0x20')]],'as':_0x28cd95['as'],'attributes':_0x28cd95[_0x5e5b('0x1d')],'include':_0x28cd95[_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0x28cd95[_0x5e5b('0x1e')],function(_0x4da321){return{'model':db[_0x4da321[_0x5e5b('0x20')]],'as':_0x4da321['as'],'attributes':_0x4da321[_0x5e5b('0x1d')],'include':_0x4da321[_0x5e5b('0x1e')]?_['map'](_0x4da321[_0x5e5b('0x1e')],function(_0xdb2863){return{'model':db[_0xdb2863['model']],'as':_0xdb2863['as'],'attributes':_0xdb2863[_0x5e5b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5e5b('0xf')](function(_0x39ce16){logger[_0x5e5b('0x10')](_0x5e5b('0x19'),_0x45a091);logger[_0x5e5b('0x21')](_0x5e5b('0x19'),_0x45a091,JSON[_0x5e5b('0x13')](_0x39ce16));_0xe5aa6b(_0x39ce16);})[_0x5e5b('0x18')](function(_0x42da3b){logger[_0x5e5b('0x14')](_0x5e5b('0x19'),_0x42da3b['message'],_0x45a091);_0x1560e1(_0x4c5f9a['error'](0x1f4,_0x42da3b[_0x5e5b('0x16')]));});});};exports[_0x5e5b('0x22')]=function(_0xb68419){var _0x3dcdab=this;return new Promise(function(_0x12f1ee,_0x4b9be8){return db[_0x5e5b('0x1a')]['find']({'raw':_0xb68419[_0x5e5b('0x1b')]?_0xb68419[_0x5e5b('0x1b')][_0x5e5b('0x23')]===undefined?!![]:![]:!![],'where':_0xb68419[_0x5e5b('0x1b')]?_0xb68419['options'][_0x5e5b('0x1c')]||null:null,'attributes':_0xb68419[_0x5e5b('0x1b')]?_0xb68419['options'][_0x5e5b('0x1d')]||null:null,'include':_0xb68419[_0x5e5b('0x1b')]?_0xb68419[_0x5e5b('0x1b')][_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0xb68419[_0x5e5b('0x1b')][_0x5e5b('0x1e')],function(_0x317451){return{'model':db[_0x317451['model']],'as':_0x317451['as'],'attributes':_0x317451[_0x5e5b('0x1d')],'include':_0x317451[_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0x317451[_0x5e5b('0x1e')],function(_0x7da7a5){return{'model':db[_0x7da7a5[_0x5e5b('0x20')]],'as':_0x7da7a5['as'],'attributes':_0x7da7a5['attributes'],'include':_0x7da7a5['include']?_[_0x5e5b('0x1f')](_0x7da7a5[_0x5e5b('0x1e')],function(_0x8ec651){return{'model':db[_0x8ec651['model']],'as':_0x8ec651['as'],'attributes':_0x8ec651[_0x5e5b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5e5b('0xf')](function(_0x18f5ba){logger[_0x5e5b('0x10')]('ShowVtigerAccount',_0xb68419);logger[_0x5e5b('0x21')](_0x5e5b('0x22'),_0xb68419,JSON['stringify'](_0x18f5ba));_0x12f1ee(_0x18f5ba);})['catch'](function(_0xe9c586){logger[_0x5e5b('0x14')](_0x5e5b('0x22'),_0xe9c586['message'],_0xb68419);_0x4b9be8(_0x3dcdab[_0x5e5b('0x14')](0x1f4,_0xe9c586['message']));});});}; \ No newline at end of file +var _0xd8b0=['raw','where','include','map','model','attributes','ShowVtigerAccount','find','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','options'];(function(_0x4ac494,_0x2ac7d3){var _0x369355=function(_0x8fefb2){while(--_0x8fefb2){_0x4ac494['push'](_0x4ac494['shift']());}};_0x369355(++_0x2ac7d3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['findAll']({'raw':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x19')]===undefined?!![]:![]:!![],'where':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')]['attributes']||null:null,'limit':_0x5fecbd['options']?_0x5fecbd[_0x0d8b('0x18')]['limit']||null:null,'include':_0x5fecbd['options']?_0x5fecbd['options'][_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x221071){return{'model':db[_0x221071[_0x0d8b('0x1d')]],'as':_0x221071['as'],'attributes':_0x221071[_0x0d8b('0x1e')],'include':_0x221071[_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x221071['include'],function(_0xe8bbee){return{'model':db[_0xe8bbee[_0x0d8b('0x1d')]],'as':_0xe8bbee['as'],'attributes':_0xe8bbee['attributes'],'include':_0xe8bbee[_0x0d8b('0x1b')]?_['map'](_0xe8bbee[_0x0d8b('0x1b')],function(_0x234bdd){return{'model':db[_0x234bdd[_0x0d8b('0x1d')]],'as':_0x234bdd['as'],'attributes':_0x234bdd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x28f639){logger[_0x0d8b('0xb')]('GetVtigerAccount',_0x5fecbd);logger[_0x0d8b('0xe')]('GetVtigerAccount',_0x5fecbd,JSON[_0x0d8b('0x10')](_0x28f639));_0x18dd2d(_0x28f639);})['catch'](function(_0x97050a){logger['error'](_0x0d8b('0x16'),_0x97050a['message'],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x97050a['message']));});});};exports[_0x0d8b('0x1f')]=function(_0x106e4c){var _0x2c058d=this;return new Promise(function(_0x56120a,_0x4c80a2){return db['VtigerAccount'][_0x0d8b('0x20')]({'raw':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1e')]||null:null,'include':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')]?_['map'](_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x4b3ea0){return{'model':db[_0x4b3ea0[_0x0d8b('0x1d')]],'as':_0x4b3ea0['as'],'attributes':_0x4b3ea0[_0x0d8b('0x1e')],'include':_0x4b3ea0[_0x0d8b('0x1b')]?_['map'](_0x4b3ea0[_0x0d8b('0x1b')],function(_0x2c507e){return{'model':db[_0x2c507e[_0x0d8b('0x1d')]],'as':_0x2c507e['as'],'attributes':_0x2c507e[_0x0d8b('0x1e')],'include':_0x2c507e[_0x0d8b('0x1b')]?_['map'](_0x2c507e[_0x0d8b('0x1b')],function(_0x1649fc){return{'model':db[_0x1649fc['model']],'as':_0x1649fc['as'],'attributes':_0x1649fc[_0x0d8b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0d8b('0xa')](function(_0x188af2){logger[_0x0d8b('0xb')](_0x0d8b('0x1f'),_0x106e4c);logger['debug']('ShowVtigerAccount',_0x106e4c,JSON[_0x0d8b('0x10')](_0x188af2));_0x56120a(_0x188af2);})['catch'](function(_0x531c55){logger[_0x0d8b('0x11')](_0x0d8b('0x1f'),_0x531c55[_0x0d8b('0x13')],_0x106e4c);_0x4c80a2(_0x2c058d[_0x0d8b('0x11')](0x1f4,_0x531c55[_0x0d8b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 0b418cb..8b11bdb 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 _0xf8b8=['/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x5628b2,_0x223018){var _0x2174a7=function(_0x41b4d5){while(--_0x41b4d5){_0x5628b2['push'](_0x5628b2['shift']());}};_0x2174a7(++_0x223018);}(_0xf8b8,0x6c));var _0x8f8b=function(_0xc46925,_0x3d50c2){_0xc46925=_0xc46925-0x0;var _0x4f178f=_0xf8b8[_0xc46925];return _0x4f178f;};'use strict';var multer=require(_0x8f8b('0x0'));var util=require(_0x8f8b('0x1'));var path=require(_0x8f8b('0x2'));var timeout=require(_0x8f8b('0x3'));var express=require(_0x8f8b('0x4'));var router=express[_0x8f8b('0x5')]();var fs_extra=require(_0x8f8b('0x6'));var auth=require(_0x8f8b('0x7'));var interaction=require(_0x8f8b('0x8'));var config=require('../../config/environment');var controller=require(_0x8f8b('0x9'));router[_0x8f8b('0xa')]('/',auth[_0x8f8b('0xb')](),controller['index']);router[_0x8f8b('0xa')](_0x8f8b('0xc'),auth[_0x8f8b('0xb')](),controller[_0x8f8b('0xd')]);router['get'](_0x8f8b('0xe'),auth[_0x8f8b('0xb')](),controller[_0x8f8b('0xf')]);router[_0x8f8b('0xa')]('/:id/subjects',auth[_0x8f8b('0xb')](),controller['getSubjects']);router[_0x8f8b('0xa')](_0x8f8b('0x10'),auth['isAuthenticated'](),controller[_0x8f8b('0x11')]);router[_0x8f8b('0x12')]('/',auth[_0x8f8b('0xb')](),controller['create']);router[_0x8f8b('0x13')]('/:id',auth[_0x8f8b('0xb')](),controller[_0x8f8b('0x14')]);router[_0x8f8b('0x15')](_0x8f8b('0xc'),auth['isAuthenticated'](),controller[_0x8f8b('0x16')]);module[_0x8f8b('0x17')]=router; \ No newline at end of file +var _0x0177=['put','/:id','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x14d6fd,_0x2352de){var _0x31784e=function(_0x5be79f){while(--_0x5be79f){_0x14d6fd['push'](_0x14d6fd['shift']());}};_0x31784e(++_0x2352de);}(_0x0177,0xb3));var _0x7017=function(_0x5d8dc3,_0x57e3e1){_0x5d8dc3=_0x5d8dc3-0x0;var _0x32b8f5=_0x0177[_0x5d8dc3];return _0x32b8f5;};'use strict';var multer=require(_0x7017('0x0'));var util=require('util');var path=require(_0x7017('0x1'));var timeout=require(_0x7017('0x2'));var express=require(_0x7017('0x3'));var router=express['Router']();var fs_extra=require(_0x7017('0x4'));var auth=require(_0x7017('0x5'));var interaction=require(_0x7017('0x6'));var config=require(_0x7017('0x7'));var controller=require(_0x7017('0x8'));router[_0x7017('0x9')]('/',auth[_0x7017('0xa')](),controller[_0x7017('0xb')]);router[_0x7017('0x9')]('/:id',auth[_0x7017('0xa')](),controller[_0x7017('0xc')]);router[_0x7017('0x9')](_0x7017('0xd'),auth[_0x7017('0xa')](),controller[_0x7017('0xe')]);router[_0x7017('0x9')](_0x7017('0xf'),auth[_0x7017('0xa')](),controller[_0x7017('0x10')]);router[_0x7017('0x9')](_0x7017('0x11'),auth[_0x7017('0xa')](),controller[_0x7017('0x12')]);router[_0x7017('0x13')]('/',auth['isAuthenticated'](),controller[_0x7017('0x14')]);router[_0x7017('0x15')](_0x7017('0x16'),auth[_0x7017('0xa')](),controller['update']);router['delete'](_0x7017('0x16'),auth[_0x7017('0xa')](),controller[_0x7017('0x17')]);module[_0x7017('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 1354e19..95261b5 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 _0xddae=['STRING','sequelize','exports'];(function(_0x216c6f,_0x440e3d){var _0x519222=function(_0x27bf61){while(--_0x27bf61){_0x216c6f['push'](_0x216c6f['shift']());}};_0x519222(++_0x440e3d);}(_0xddae,0x12d));var _0xedda=function(_0x6dce5e,_0x1fcf30){_0x6dce5e=_0x6dce5e-0x0;var _0x380732=_0xddae[_0x6dce5e];return _0x380732;};'use strict';var Sequelize=require(_0xedda('0x0'));module[_0xedda('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xedda('0x2')]}}; \ No newline at end of file +var _0x2aec=['sequelize','STRING'];(function(_0x50f157,_0x280833){var _0x7e0178=function(_0x14eaf1){while(--_0x14eaf1){_0x50f157['push'](_0x50f157['shift']());}};_0x7e0178(++_0x280833);}(_0x2aec,0x188));var _0xc2ae=function(_0x15661c,_0x4df362){_0x15661c=_0x15661c-0x0;var _0x126023=_0x2aec[_0x15661c];return _0x126023;};'use strict';var Sequelize=require(_0xc2ae('0x0'));module['exports']={'name':{'type':Sequelize[_0xc2ae('0x1')]},'description':{'type':Sequelize[_0xc2ae('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 5498b0b..a510421 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 _0xe50e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','error','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','fields','options','then','create','body','find','getFields','VtigerField','map','getSubjects','findOne','getDescriptions','eml-format','request-promise','moment'];(function(_0x40c6a7,_0x4fc99d){var _0x37f57d=function(_0x3ada7e){while(--_0x3ada7e){_0x40c6a7['push'](_0x40c6a7['shift']());}};_0x37f57d(++_0x4fc99d);}(_0xe50e,0xf9));var _0xee50=function(_0x95b080,_0x41e66a){_0x95b080=_0x95b080-0x0;var _0x457afa=_0xe50e[_0x95b080];return _0x457afa;};'use strict';var emlformat=require(_0xee50('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xee50('0x1'));var moment=require(_0xee50('0x2'));var BPromise=require(_0xee50('0x3'));var Mustache=require(_0xee50('0x4'));var util=require(_0xee50('0x5'));var path=require(_0xee50('0x6'));var sox=require(_0xee50('0x7'));var csv=require(_0xee50('0x8'));var ejs=require(_0xee50('0x9'));var fs=require('fs');var fs_extra=require(_0xee50('0xa'));var _=require(_0xee50('0xb'));var squel=require(_0xee50('0xc'));var crypto=require(_0xee50('0xd'));var jsforce=require(_0xee50('0xe'));var deskjs=require(_0xee50('0xf'));var toCsv=require(_0xee50('0x8'));var querystring=require(_0xee50('0x10'));var Papa=require(_0xee50('0x11'));var Redis=require(_0xee50('0x12'));var authService=require(_0xee50('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee50('0x14'));var logger=require(_0xee50('0x15'))(_0xee50('0x16'));var utils=require(_0xee50('0x17'));var config=require(_0xee50('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xee50('0x19'))['db'];function respondWithStatusCode(_0xbfb3ef,_0x2adc64){_0x2adc64=_0x2adc64||0xcc;return function(_0x387be6){if(_0x387be6){return _0xbfb3ef[_0xee50('0x1a')](_0x2adc64);}return _0xbfb3ef[_0xee50('0x1b')](_0x2adc64)[_0xee50('0x1c')]();};}function respondWithResult(_0x43a92a,_0x547863){_0x547863=_0x547863||0xc8;return function(_0x3b89a1){if(_0x3b89a1){return _0x43a92a[_0xee50('0x1b')](_0x547863)[_0xee50('0x1d')](_0x3b89a1);}};}function respondWithFilteredResult(_0x92688e,_0x5375e4){return function(_0x3db75e){if(_0x3db75e){var _0x361e0a=typeof _0x5375e4[_0xee50('0x1e')]===_0xee50('0x1f')&&typeof _0x5375e4['limit']===_0xee50('0x1f');var _0x281b5f=_0x3db75e[_0xee50('0x20')];var _0x201513=_0x361e0a?0x0:_0x5375e4[_0xee50('0x1e')];var _0x106a56=_0x361e0a?_0x3db75e['count']:_0x5375e4[_0xee50('0x1e')]+_0x5375e4[_0xee50('0x21')];var _0x37f439;if(_0x106a56>=_0x281b5f){_0x106a56=_0x281b5f;_0x37f439=0xc8;}else{_0x37f439=0xce;}_0x92688e['status'](_0x37f439);return _0x92688e[_0xee50('0x22')](_0xee50('0x23'),_0x201513+'-'+_0x106a56+'/'+_0x281b5f)[_0xee50('0x1d')](_0x3db75e);}return null;};}function patchUpdates(_0x5c0a6f){return function(_0x3e7dab){try{jsonpatch[_0xee50('0x24')](_0x3e7dab,_0x5c0a6f,!![]);}catch(_0x14bbd9){return BPromise[_0xee50('0x25')](_0x14bbd9);}return _0x3e7dab[_0xee50('0x26')]();};}function saveUpdates(_0x57dcb0,_0x3fad29){return function(_0x1990f2){if(_0x1990f2){return _0x1990f2[_0xee50('0x27')](_0x57dcb0)['then'](function(_0x15906e){return _0x15906e;});}return null;};}function removeEntity(_0x16934c,_0x722d5c){return function(_0x557c77){if(_0x557c77){return _0x557c77['destroy']()['then'](function(){_0x16934c[_0xee50('0x1b')](0xcc)[_0xee50('0x1c')]();});}};}function handleEntityNotFound(_0x53ddab,_0x5c5910){return function(_0x5762e5){if(!_0x5762e5){_0x53ddab[_0xee50('0x1a')](0x194);}return _0x5762e5;};}function handleError(_0x1e1761,_0x571655){_0x571655=_0x571655||0x1f4;return function(_0x15556f){logger[_0xee50('0x28')](_0x15556f[_0xee50('0x29')]);if(_0x15556f[_0xee50('0x2a')]){delete _0x15556f['name'];}_0x1e1761[_0xee50('0x1b')](_0x571655)[_0xee50('0x2b')](_0x15556f);};}exports[_0xee50('0x2c')]=function(_0x2a3e51,_0x2d3e91){var _0x6f16db={},_0x4c14b2={},_0x473f5b={'count':0x0,'rows':[]};var _0x1b3d2f=_['map'](db[_0xee50('0x2d')][_0xee50('0x2e')],function(_0x339686){return{'name':_0x339686[_0xee50('0x2f')],'type':_0x339686[_0xee50('0x30')][_0xee50('0x31')]};});_0x4c14b2['model']=_['map'](_0x1b3d2f,_0xee50('0x2a'));_0x4c14b2['query']=_['keys'](_0x2a3e51[_0xee50('0x32')]);_0x4c14b2[_0xee50('0x33')]=_[_0xee50('0x34')](_0x4c14b2[_0xee50('0x35')],_0x4c14b2[_0xee50('0x32')]);_0x6f16db[_0xee50('0x36')]=_['intersection'](_0x4c14b2['model'],qs['fields'](_0x2a3e51[_0xee50('0x32')]['fields']));_0x6f16db[_0xee50('0x36')]=_0x6f16db[_0xee50('0x36')][_0xee50('0x37')]?_0x6f16db[_0xee50('0x36')]:_0x4c14b2['model'];if(!_0x2a3e51[_0xee50('0x32')][_0xee50('0x38')](_0xee50('0x39'))){_0x6f16db[_0xee50('0x21')]=qs[_0xee50('0x21')](_0x2a3e51[_0xee50('0x32')][_0xee50('0x21')]);_0x6f16db['offset']=qs['offset'](_0x2a3e51[_0xee50('0x32')][_0xee50('0x1e')]);}_0x6f16db[_0xee50('0x3a')]=qs[_0xee50('0x3b')](_0x2a3e51['query']['sort']);_0x6f16db[_0xee50('0x3c')]=qs[_0xee50('0x33')](_[_0xee50('0x3d')](_0x2a3e51[_0xee50('0x32')],_0x4c14b2['filters']),_0x1b3d2f);if(_0x2a3e51[_0xee50('0x32')][_0xee50('0x3e')]){_0x6f16db[_0xee50('0x3c')]=_[_0xee50('0x3f')](_0x6f16db[_0xee50('0x3c')],{'$or':_['map'](_0x1b3d2f,function(_0x1eaa9b){if(_0x1eaa9b[_0xee50('0x30')]!==_0xee50('0x40')){var _0x4ee167={};_0x4ee167[_0x1eaa9b[_0xee50('0x2a')]]={'$like':'%'+_0x2a3e51[_0xee50('0x32')]['filter']+'%'};return _0x4ee167;}})});}_0x6f16db=_[_0xee50('0x3f')]({},_0x6f16db,_0x2a3e51['options']);var _0x42948b={'where':_0x6f16db['where']};return db[_0xee50('0x2d')][_0xee50('0x20')](_0x42948b)['then'](function(_0x114634){_0x473f5b[_0xee50('0x20')]=_0x114634;if(_0x2a3e51[_0xee50('0x32')]['includeAll']){_0x6f16db[_0xee50('0x41')]=[{'all':!![]}];}return db[_0xee50('0x2d')][_0xee50('0x42')](_0x6f16db);})['then'](function(_0x3647f4){_0x473f5b[_0xee50('0x43')]=_0x3647f4;return _0x473f5b;})['then'](respondWithFilteredResult(_0x2d3e91,_0x6f16db))[_0xee50('0x44')](handleError(_0x2d3e91,null));};exports[_0xee50('0x45')]=function(_0x26aa66,_0x4a3409){var _0x364803={'raw':![],'where':{'id':_0x26aa66[_0xee50('0x46')]['id']}},_0x3117e9={};_0x3117e9[_0xee50('0x35')]=_[_0xee50('0x47')](db[_0xee50('0x2d')][_0xee50('0x2e')]);_0x3117e9['query']=_[_0xee50('0x47')](_0x26aa66['query']);_0x3117e9[_0xee50('0x33')]=_[_0xee50('0x34')](_0x3117e9['model'],_0x3117e9[_0xee50('0x32')]);_0x364803['attributes']=_['intersection'](_0x3117e9[_0xee50('0x35')],qs[_0xee50('0x48')](_0x26aa66[_0xee50('0x32')][_0xee50('0x48')]));_0x364803[_0xee50('0x36')]=_0x364803[_0xee50('0x36')][_0xee50('0x37')]?_0x364803[_0xee50('0x36')]:_0x3117e9[_0xee50('0x35')];if(_0x26aa66[_0xee50('0x32')]['includeAll']){_0x364803[_0xee50('0x41')]=[{'all':!![]}];}_0x364803=_['merge']({},_0x364803,_0x26aa66[_0xee50('0x49')]);return db[_0xee50('0x2d')]['find'](_0x364803)[_0xee50('0x4a')](handleEntityNotFound(_0x4a3409,null))[_0xee50('0x4a')](respondWithResult(_0x4a3409,null))['catch'](handleError(_0x4a3409,null));};exports[_0xee50('0x4b')]=function(_0x45003e,_0x596ae9){return db[_0xee50('0x2d')][_0xee50('0x4b')](_0x45003e[_0xee50('0x4c')],{})[_0xee50('0x4a')](respondWithResult(_0x596ae9,0xc9))['catch'](handleError(_0x596ae9,null));};exports['update']=function(_0xc1a18e,_0x582ffe){if(_0xc1a18e['body']['id']){delete _0xc1a18e[_0xee50('0x4c')]['id'];}return db[_0xee50('0x2d')]['find']({'where':{'id':_0xc1a18e[_0xee50('0x46')]['id']}})['then'](handleEntityNotFound(_0x582ffe,null))[_0xee50('0x4a')](saveUpdates(_0xc1a18e[_0xee50('0x4c')],null))['then'](respondWithResult(_0x582ffe,null))[_0xee50('0x44')](handleError(_0x582ffe,null));};exports['destroy']=function(_0x4c867a,_0x9ad02c){return db[_0xee50('0x2d')][_0xee50('0x4d')]({'where':{'id':_0x4c867a[_0xee50('0x46')]['id']}})[_0xee50('0x4a')](handleEntityNotFound(_0x9ad02c,null))[_0xee50('0x4a')](removeEntity(_0x9ad02c,null))[_0xee50('0x44')](handleError(_0x9ad02c,null));};exports[_0xee50('0x4e')]=function(_0x2b300e,_0x5b2bcd,_0x3747ce){var _0x3e8147={};var _0x4de84f={};var _0x46b4e7;var _0x2df9aa;return db[_0xee50('0x2d')]['findOne']({'where':{'id':_0x2b300e['params']['id']}})[_0xee50('0x4a')](handleEntityNotFound(_0x5b2bcd,null))[_0xee50('0x4a')](function(_0x18aba7){if(_0x18aba7){_0x46b4e7=_0x18aba7;_0x4de84f[_0xee50('0x35')]=_[_0xee50('0x47')](db[_0xee50('0x4f')]['rawAttributes']);_0x4de84f[_0xee50('0x32')]=_[_0xee50('0x47')](_0x2b300e[_0xee50('0x32')]);_0x4de84f['filters']=_[_0xee50('0x34')](_0x4de84f['model'],_0x4de84f[_0xee50('0x32')]);_0x3e8147['attributes']=_[_0xee50('0x34')](_0x4de84f[_0xee50('0x35')],qs[_0xee50('0x48')](_0x2b300e[_0xee50('0x32')]['fields']));_0x3e8147[_0xee50('0x36')]=_0x3e8147[_0xee50('0x36')][_0xee50('0x37')]?_0x3e8147[_0xee50('0x36')]:_0x4de84f[_0xee50('0x35')];_0x3e8147[_0xee50('0x3a')]=qs[_0xee50('0x3b')](_0x2b300e['query'][_0xee50('0x3b')]);_0x3e8147[_0xee50('0x3c')]=qs[_0xee50('0x33')](_[_0xee50('0x3d')](_0x2b300e[_0xee50('0x32')],_0x4de84f[_0xee50('0x33')]));if(_0x2b300e[_0xee50('0x32')]['filter']){_0x3e8147[_0xee50('0x3c')]=_[_0xee50('0x3f')](_0x3e8147[_0xee50('0x3c')],{'$or':_[_0xee50('0x50')](_0x3e8147[_0xee50('0x36')],function(_0x230ea2){var _0xbb0f33={};_0xbb0f33[_0x230ea2]={'$like':'%'+_0x2b300e[_0xee50('0x32')]['filter']+'%'};return _0xbb0f33;})});}_0x3e8147=_[_0xee50('0x3f')]({},_0x3e8147,_0x2b300e[_0xee50('0x49')]);return _0x46b4e7['getFields'](_0x3e8147);}})[_0xee50('0x4a')](function(_0xa6d024){if(_0xa6d024){_0x2df9aa=_0xa6d024[_0xee50('0x37')];if(!_0x2b300e[_0xee50('0x32')][_0xee50('0x38')](_0xee50('0x39'))){_0x3e8147[_0xee50('0x21')]=qs[_0xee50('0x21')](_0x2b300e[_0xee50('0x32')][_0xee50('0x21')]);_0x3e8147[_0xee50('0x1e')]=qs[_0xee50('0x1e')](_0x2b300e[_0xee50('0x32')]['offset']);}return _0x46b4e7['getFields'](_0x3e8147);}})[_0xee50('0x4a')](function(_0x273705){if(_0x273705){return _0x273705?{'count':_0x2df9aa,'rows':_0x273705}:null;}})[_0xee50('0x4a')](respondWithResult(_0x5b2bcd,null))['catch'](handleError(_0x5b2bcd,null));};exports[_0xee50('0x51')]=function(_0x480a57,_0x4b9128,_0x43082d){var _0x19c410={};var _0x1db7e2={};var _0x4d12d6;var _0x2279c5;return db['VtigerConfiguration'][_0xee50('0x52')]({'where':{'id':_0x480a57['params']['id']}})['then'](handleEntityNotFound(_0x4b9128,null))[_0xee50('0x4a')](function(_0x39c300){if(_0x39c300){_0x4d12d6=_0x39c300;_0x1db7e2['model']=_[_0xee50('0x47')](db['VtigerField'][_0xee50('0x2e')]);_0x1db7e2[_0xee50('0x32')]=_[_0xee50('0x47')](_0x480a57['query']);_0x1db7e2[_0xee50('0x33')]=_[_0xee50('0x34')](_0x1db7e2['model'],_0x1db7e2[_0xee50('0x32')]);_0x19c410['attributes']=_['intersection'](_0x1db7e2[_0xee50('0x35')],qs[_0xee50('0x48')](_0x480a57['query']['fields']));_0x19c410['attributes']=_0x19c410['attributes']['length']?_0x19c410[_0xee50('0x36')]:_0x1db7e2['model'];_0x19c410['order']=qs[_0xee50('0x3b')](_0x480a57[_0xee50('0x32')]['sort']);_0x19c410[_0xee50('0x3c')]=qs[_0xee50('0x33')](_[_0xee50('0x3d')](_0x480a57['query'],_0x1db7e2[_0xee50('0x33')]));if(_0x480a57[_0xee50('0x32')][_0xee50('0x3e')]){_0x19c410[_0xee50('0x3c')]=_[_0xee50('0x3f')](_0x19c410[_0xee50('0x3c')],{'$or':_[_0xee50('0x50')](_0x19c410[_0xee50('0x36')],function(_0x371227){var _0x382d58={};_0x382d58[_0x371227]={'$like':'%'+_0x480a57[_0xee50('0x32')][_0xee50('0x3e')]+'%'};return _0x382d58;})});}_0x19c410=_[_0xee50('0x3f')]({},_0x19c410,_0x480a57[_0xee50('0x49')]);return _0x4d12d6[_0xee50('0x51')](_0x19c410);}})['then'](function(_0x121cbd){if(_0x121cbd){_0x2279c5=_0x121cbd[_0xee50('0x37')];if(!_0x480a57[_0xee50('0x32')]['hasOwnProperty'](_0xee50('0x39'))){_0x19c410[_0xee50('0x21')]=qs[_0xee50('0x21')](_0x480a57['query'][_0xee50('0x21')]);_0x19c410[_0xee50('0x1e')]=qs[_0xee50('0x1e')](_0x480a57[_0xee50('0x32')][_0xee50('0x1e')]);}return _0x4d12d6[_0xee50('0x51')](_0x19c410);}})[_0xee50('0x4a')](function(_0x597ce7){if(_0x597ce7){return _0x597ce7?{'count':_0x2279c5,'rows':_0x597ce7}:null;}})[_0xee50('0x4a')](respondWithResult(_0x4b9128,null))[_0xee50('0x44')](handleError(_0x4b9128,null));};exports[_0xee50('0x53')]=function(_0x44d82d,_0x411e95,_0x10c18e){var _0x27c83c={};var _0x43d154={};var _0x18d9f8;var _0x33e088;return db[_0xee50('0x2d')]['findOne']({'where':{'id':_0x44d82d[_0xee50('0x46')]['id']}})[_0xee50('0x4a')](handleEntityNotFound(_0x411e95,null))[_0xee50('0x4a')](function(_0x215a1a){if(_0x215a1a){_0x18d9f8=_0x215a1a;_0x43d154[_0xee50('0x35')]=_[_0xee50('0x47')](db['VtigerField'][_0xee50('0x2e')]);_0x43d154[_0xee50('0x32')]=_['keys'](_0x44d82d['query']);_0x43d154[_0xee50('0x33')]=_['intersection'](_0x43d154[_0xee50('0x35')],_0x43d154[_0xee50('0x32')]);_0x27c83c['attributes']=_[_0xee50('0x34')](_0x43d154[_0xee50('0x35')],qs[_0xee50('0x48')](_0x44d82d[_0xee50('0x32')]['fields']));_0x27c83c[_0xee50('0x36')]=_0x27c83c[_0xee50('0x36')]['length']?_0x27c83c[_0xee50('0x36')]:_0x43d154[_0xee50('0x35')];_0x27c83c[_0xee50('0x3a')]=qs[_0xee50('0x3b')](_0x44d82d[_0xee50('0x32')][_0xee50('0x3b')]);_0x27c83c[_0xee50('0x3c')]=qs['filters'](_[_0xee50('0x3d')](_0x44d82d[_0xee50('0x32')],_0x43d154['filters']));if(_0x44d82d['query'][_0xee50('0x3e')]){_0x27c83c[_0xee50('0x3c')]=_[_0xee50('0x3f')](_0x27c83c[_0xee50('0x3c')],{'$or':_[_0xee50('0x50')](_0x27c83c['attributes'],function(_0x14c9ad){var _0x2c0b68={};_0x2c0b68[_0x14c9ad]={'$like':'%'+_0x44d82d[_0xee50('0x32')]['filter']+'%'};return _0x2c0b68;})});}_0x27c83c=_['merge']({},_0x27c83c,_0x44d82d['options']);return _0x18d9f8['getDescriptions'](_0x27c83c);}})[_0xee50('0x4a')](function(_0x40a3bd){if(_0x40a3bd){_0x33e088=_0x40a3bd[_0xee50('0x37')];if(!_0x44d82d[_0xee50('0x32')][_0xee50('0x38')](_0xee50('0x39'))){_0x27c83c[_0xee50('0x21')]=qs[_0xee50('0x21')](_0x44d82d[_0xee50('0x32')]['limit']);_0x27c83c[_0xee50('0x1e')]=qs[_0xee50('0x1e')](_0x44d82d['query'][_0xee50('0x1e')]);}return _0x18d9f8[_0xee50('0x53')](_0x27c83c);}})[_0xee50('0x4a')](function(_0x4b6b9d){if(_0x4b6b9d){return _0x4b6b9d?{'count':_0x33e088,'rows':_0x4b6b9d}:null;}})['then'](respondWithResult(_0x411e95,null))[_0xee50('0x44')](handleError(_0x411e95,null));}; \ No newline at end of file +var _0xf9f9=['limit','undefined','count','offset','set','Content-Range','json','save','update','then','end','error','stack','name','index','map','VtigerConfiguration','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','find','body','params','destroy','getFields','findOne','VtigerField','rawAttributes','order','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x57a4d0,_0xa6e6b){var _0xaaadee=function(_0x544da2){while(--_0x544da2){_0x57a4d0['push'](_0x57a4d0['shift']());}};_0xaaadee(++_0xa6e6b);}(_0xf9f9,0x15b));var _0x9f9f=function(_0x533cf6,_0x6fea95){_0x533cf6=_0x533cf6-0x0;var _0x3f22f8=_0xf9f9[_0x533cf6];return _0x3f22f8;};'use strict';var emlformat=require(_0x9f9f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9f9f('0x1'));var jsonpatch=require(_0x9f9f('0x2'));var rp=require(_0x9f9f('0x3'));var moment=require('moment');var BPromise=require(_0x9f9f('0x4'));var Mustache=require('mustache');var util=require(_0x9f9f('0x5'));var path=require(_0x9f9f('0x6'));var sox=require(_0x9f9f('0x7'));var csv=require(_0x9f9f('0x8'));var ejs=require(_0x9f9f('0x9'));var fs=require('fs');var fs_extra=require(_0x9f9f('0xa'));var _=require('lodash');var squel=require(_0x9f9f('0xb'));var crypto=require('crypto');var jsforce=require(_0x9f9f('0xc'));var deskjs=require(_0x9f9f('0xd'));var toCsv=require(_0x9f9f('0x8'));var querystring=require('querystring');var Papa=require(_0x9f9f('0xe'));var Redis=require(_0x9f9f('0xf'));var authService=require(_0x9f9f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9f9f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x9f9f('0x12'));var config=require(_0x9f9f('0x13'));var licenseUtil=require(_0x9f9f('0x14'));var db=require(_0x9f9f('0x15'))['db'];function respondWithStatusCode(_0x284a4c,_0x3d09d6){_0x3d09d6=_0x3d09d6||0xcc;return function(_0x67bd70){if(_0x67bd70){return _0x284a4c['sendStatus'](_0x3d09d6);}return _0x284a4c[_0x9f9f('0x16')](_0x3d09d6)['end']();};}function respondWithResult(_0x5a8115,_0x469460){_0x469460=_0x469460||0xc8;return function(_0x56057b){if(_0x56057b){return _0x5a8115[_0x9f9f('0x16')](_0x469460)['json'](_0x56057b);}};}function respondWithFilteredResult(_0x1eb717,_0x100ba1){return function(_0x18b9f){if(_0x18b9f){var _0x32f17f=typeof _0x100ba1['offset']==='undefined'&&typeof _0x100ba1[_0x9f9f('0x17')]===_0x9f9f('0x18');var _0x2a0f77=_0x18b9f[_0x9f9f('0x19')];var _0x5d8c57=_0x32f17f?0x0:_0x100ba1['offset'];var _0x3c70c1=_0x32f17f?_0x18b9f[_0x9f9f('0x19')]:_0x100ba1[_0x9f9f('0x1a')]+_0x100ba1[_0x9f9f('0x17')];var _0x6631ea;if(_0x3c70c1>=_0x2a0f77){_0x3c70c1=_0x2a0f77;_0x6631ea=0xc8;}else{_0x6631ea=0xce;}_0x1eb717['status'](_0x6631ea);return _0x1eb717[_0x9f9f('0x1b')](_0x9f9f('0x1c'),_0x5d8c57+'-'+_0x3c70c1+'/'+_0x2a0f77)[_0x9f9f('0x1d')](_0x18b9f);}return null;};}function patchUpdates(_0x18d443){return function(_0x30b633){try{jsonpatch['apply'](_0x30b633,_0x18d443,!![]);}catch(_0x1e0474){return BPromise['reject'](_0x1e0474);}return _0x30b633[_0x9f9f('0x1e')]();};}function saveUpdates(_0x5aa453,_0xe68112){return function(_0x150022){if(_0x150022){return _0x150022[_0x9f9f('0x1f')](_0x5aa453)['then'](function(_0x21d21a){return _0x21d21a;});}return null;};}function removeEntity(_0x43b02a,_0x48b79d){return function(_0x22f30a){if(_0x22f30a){return _0x22f30a['destroy']()[_0x9f9f('0x20')](function(){_0x43b02a[_0x9f9f('0x16')](0xcc)[_0x9f9f('0x21')]();});}};}function handleEntityNotFound(_0x2126fb,_0xed11fb){return function(_0x3bd1b1){if(!_0x3bd1b1){_0x2126fb['sendStatus'](0x194);}return _0x3bd1b1;};}function handleError(_0x5a073f,_0x5e820d){_0x5e820d=_0x5e820d||0x1f4;return function(_0x53a48d){logger[_0x9f9f('0x22')](_0x53a48d[_0x9f9f('0x23')]);if(_0x53a48d['name']){delete _0x53a48d[_0x9f9f('0x24')];}_0x5a073f['status'](_0x5e820d)['send'](_0x53a48d);};}exports[_0x9f9f('0x25')]=function(_0x474643,_0x5a6bb8){var _0x1546fe={},_0x5ca8ee={},_0x3df2bc={'count':0x0,'rows':[]};var _0x4840e5=_[_0x9f9f('0x26')](db[_0x9f9f('0x27')]['rawAttributes'],function(_0x453647){return{'name':_0x453647['fieldName'],'type':_0x453647[_0x9f9f('0x28')]['key']};});_0x5ca8ee[_0x9f9f('0x29')]=_[_0x9f9f('0x26')](_0x4840e5,_0x9f9f('0x24'));_0x5ca8ee['query']=_['keys'](_0x474643[_0x9f9f('0x2a')]);_0x5ca8ee['filters']=_[_0x9f9f('0x2b')](_0x5ca8ee['model'],_0x5ca8ee[_0x9f9f('0x2a')]);_0x1546fe['attributes']=_['intersection'](_0x5ca8ee['model'],qs[_0x9f9f('0x2c')](_0x474643[_0x9f9f('0x2a')]['fields']));_0x1546fe[_0x9f9f('0x2d')]=_0x1546fe['attributes'][_0x9f9f('0x2e')]?_0x1546fe[_0x9f9f('0x2d')]:_0x5ca8ee[_0x9f9f('0x29')];if(!_0x474643[_0x9f9f('0x2a')][_0x9f9f('0x2f')](_0x9f9f('0x30'))){_0x1546fe['limit']=qs[_0x9f9f('0x17')](_0x474643['query']['limit']);_0x1546fe[_0x9f9f('0x1a')]=qs[_0x9f9f('0x1a')](_0x474643[_0x9f9f('0x2a')]['offset']);}_0x1546fe['order']=qs[_0x9f9f('0x31')](_0x474643[_0x9f9f('0x2a')][_0x9f9f('0x31')]);_0x1546fe[_0x9f9f('0x32')]=qs['filters'](_[_0x9f9f('0x33')](_0x474643['query'],_0x5ca8ee[_0x9f9f('0x34')]),_0x4840e5);if(_0x474643[_0x9f9f('0x2a')][_0x9f9f('0x35')]){_0x1546fe['where']=_[_0x9f9f('0x36')](_0x1546fe[_0x9f9f('0x32')],{'$or':_[_0x9f9f('0x26')](_0x4840e5,function(_0x23fd30){if(_0x23fd30[_0x9f9f('0x28')]!==_0x9f9f('0x37')){var _0x493171={};_0x493171[_0x23fd30[_0x9f9f('0x24')]]={'$like':'%'+_0x474643[_0x9f9f('0x2a')][_0x9f9f('0x35')]+'%'};return _0x493171;}})});}_0x1546fe=_[_0x9f9f('0x36')]({},_0x1546fe,_0x474643[_0x9f9f('0x38')]);var _0x458b44={'where':_0x1546fe[_0x9f9f('0x32')]};return db[_0x9f9f('0x27')]['count'](_0x458b44)['then'](function(_0x12dc57){_0x3df2bc[_0x9f9f('0x19')]=_0x12dc57;if(_0x474643[_0x9f9f('0x2a')][_0x9f9f('0x39')]){_0x1546fe[_0x9f9f('0x3a')]=[{'all':!![]}];}return db[_0x9f9f('0x27')]['findAll'](_0x1546fe);})[_0x9f9f('0x20')](function(_0xdfddd2){_0x3df2bc[_0x9f9f('0x3b')]=_0xdfddd2;return _0x3df2bc;})[_0x9f9f('0x20')](respondWithFilteredResult(_0x5a6bb8,_0x1546fe))[_0x9f9f('0x3c')](handleError(_0x5a6bb8,null));};exports[_0x9f9f('0x3d')]=function(_0x2aaf17,_0x16044a){var _0x4f57fa={'raw':![],'where':{'id':_0x2aaf17['params']['id']}},_0x1fef68={};_0x1fef68[_0x9f9f('0x29')]=_[_0x9f9f('0x3e')](db[_0x9f9f('0x27')]['rawAttributes']);_0x1fef68[_0x9f9f('0x2a')]=_[_0x9f9f('0x3e')](_0x2aaf17[_0x9f9f('0x2a')]);_0x1fef68[_0x9f9f('0x34')]=_['intersection'](_0x1fef68['model'],_0x1fef68['query']);_0x4f57fa['attributes']=_[_0x9f9f('0x2b')](_0x1fef68[_0x9f9f('0x29')],qs[_0x9f9f('0x2c')](_0x2aaf17[_0x9f9f('0x2a')][_0x9f9f('0x2c')]));_0x4f57fa[_0x9f9f('0x2d')]=_0x4f57fa[_0x9f9f('0x2d')]['length']?_0x4f57fa[_0x9f9f('0x2d')]:_0x1fef68['model'];if(_0x2aaf17[_0x9f9f('0x2a')][_0x9f9f('0x39')]){_0x4f57fa[_0x9f9f('0x3a')]=[{'all':!![]}];}_0x4f57fa=_[_0x9f9f('0x36')]({},_0x4f57fa,_0x2aaf17[_0x9f9f('0x38')]);return db['VtigerConfiguration'][_0x9f9f('0x3f')](_0x4f57fa)[_0x9f9f('0x20')](handleEntityNotFound(_0x16044a,null))[_0x9f9f('0x20')](respondWithResult(_0x16044a,null))[_0x9f9f('0x3c')](handleError(_0x16044a,null));};exports['create']=function(_0x36af7e,_0x43c5a0){return db[_0x9f9f('0x27')]['create'](_0x36af7e[_0x9f9f('0x40')],{})[_0x9f9f('0x20')](respondWithResult(_0x43c5a0,0xc9))[_0x9f9f('0x3c')](handleError(_0x43c5a0,null));};exports[_0x9f9f('0x1f')]=function(_0x22bfb0,_0x582e7f){if(_0x22bfb0['body']['id']){delete _0x22bfb0[_0x9f9f('0x40')]['id'];}return db['VtigerConfiguration'][_0x9f9f('0x3f')]({'where':{'id':_0x22bfb0[_0x9f9f('0x41')]['id']}})[_0x9f9f('0x20')](handleEntityNotFound(_0x582e7f,null))[_0x9f9f('0x20')](saveUpdates(_0x22bfb0[_0x9f9f('0x40')],null))[_0x9f9f('0x20')](respondWithResult(_0x582e7f,null))[_0x9f9f('0x3c')](handleError(_0x582e7f,null));};exports[_0x9f9f('0x42')]=function(_0x39ec91,_0x4d7b26){return db[_0x9f9f('0x27')]['find']({'where':{'id':_0x39ec91[_0x9f9f('0x41')]['id']}})[_0x9f9f('0x20')](handleEntityNotFound(_0x4d7b26,null))[_0x9f9f('0x20')](removeEntity(_0x4d7b26,null))[_0x9f9f('0x3c')](handleError(_0x4d7b26,null));};exports[_0x9f9f('0x43')]=function(_0x9d678b,_0x247105,_0x508eb4){var _0x28c272={};var _0x49caad={};var _0x27e1c1;var _0x3e07a1;return db[_0x9f9f('0x27')][_0x9f9f('0x44')]({'where':{'id':_0x9d678b['params']['id']}})['then'](handleEntityNotFound(_0x247105,null))['then'](function(_0x2ad090){if(_0x2ad090){_0x27e1c1=_0x2ad090;_0x49caad[_0x9f9f('0x29')]=_['keys'](db[_0x9f9f('0x45')][_0x9f9f('0x46')]);_0x49caad[_0x9f9f('0x2a')]=_[_0x9f9f('0x3e')](_0x9d678b[_0x9f9f('0x2a')]);_0x49caad['filters']=_[_0x9f9f('0x2b')](_0x49caad[_0x9f9f('0x29')],_0x49caad[_0x9f9f('0x2a')]);_0x28c272['attributes']=_[_0x9f9f('0x2b')](_0x49caad[_0x9f9f('0x29')],qs[_0x9f9f('0x2c')](_0x9d678b[_0x9f9f('0x2a')]['fields']));_0x28c272[_0x9f9f('0x2d')]=_0x28c272['attributes'][_0x9f9f('0x2e')]?_0x28c272[_0x9f9f('0x2d')]:_0x49caad[_0x9f9f('0x29')];_0x28c272[_0x9f9f('0x47')]=qs[_0x9f9f('0x31')](_0x9d678b[_0x9f9f('0x2a')][_0x9f9f('0x31')]);_0x28c272[_0x9f9f('0x32')]=qs[_0x9f9f('0x34')](_[_0x9f9f('0x33')](_0x9d678b['query'],_0x49caad[_0x9f9f('0x34')]));if(_0x9d678b[_0x9f9f('0x2a')][_0x9f9f('0x35')]){_0x28c272[_0x9f9f('0x32')]=_[_0x9f9f('0x36')](_0x28c272[_0x9f9f('0x32')],{'$or':_[_0x9f9f('0x26')](_0x28c272[_0x9f9f('0x2d')],function(_0x8adcc8){var _0x25b1d9={};_0x25b1d9[_0x8adcc8]={'$like':'%'+_0x9d678b[_0x9f9f('0x2a')][_0x9f9f('0x35')]+'%'};return _0x25b1d9;})});}_0x28c272=_['merge']({},_0x28c272,_0x9d678b[_0x9f9f('0x38')]);return _0x27e1c1[_0x9f9f('0x43')](_0x28c272);}})[_0x9f9f('0x20')](function(_0x373648){if(_0x373648){_0x3e07a1=_0x373648[_0x9f9f('0x2e')];if(!_0x9d678b[_0x9f9f('0x2a')][_0x9f9f('0x2f')](_0x9f9f('0x30'))){_0x28c272['limit']=qs[_0x9f9f('0x17')](_0x9d678b[_0x9f9f('0x2a')]['limit']);_0x28c272[_0x9f9f('0x1a')]=qs[_0x9f9f('0x1a')](_0x9d678b[_0x9f9f('0x2a')][_0x9f9f('0x1a')]);}return _0x27e1c1[_0x9f9f('0x43')](_0x28c272);}})[_0x9f9f('0x20')](function(_0x4e0379){if(_0x4e0379){return _0x4e0379?{'count':_0x3e07a1,'rows':_0x4e0379}:null;}})['then'](respondWithResult(_0x247105,null))[_0x9f9f('0x3c')](handleError(_0x247105,null));};exports[_0x9f9f('0x48')]=function(_0x142f09,_0x4472e1,_0x42cf15){var _0x4094ab={};var _0xbc8b78={};var _0x2311d5;var _0x11769c;return db[_0x9f9f('0x27')]['findOne']({'where':{'id':_0x142f09[_0x9f9f('0x41')]['id']}})[_0x9f9f('0x20')](handleEntityNotFound(_0x4472e1,null))[_0x9f9f('0x20')](function(_0x4107c4){if(_0x4107c4){_0x2311d5=_0x4107c4;_0xbc8b78[_0x9f9f('0x29')]=_['keys'](db[_0x9f9f('0x45')]['rawAttributes']);_0xbc8b78['query']=_['keys'](_0x142f09['query']);_0xbc8b78[_0x9f9f('0x34')]=_[_0x9f9f('0x2b')](_0xbc8b78[_0x9f9f('0x29')],_0xbc8b78[_0x9f9f('0x2a')]);_0x4094ab['attributes']=_[_0x9f9f('0x2b')](_0xbc8b78[_0x9f9f('0x29')],qs[_0x9f9f('0x2c')](_0x142f09[_0x9f9f('0x2a')][_0x9f9f('0x2c')]));_0x4094ab[_0x9f9f('0x2d')]=_0x4094ab[_0x9f9f('0x2d')]['length']?_0x4094ab[_0x9f9f('0x2d')]:_0xbc8b78['model'];_0x4094ab[_0x9f9f('0x47')]=qs[_0x9f9f('0x31')](_0x142f09['query'][_0x9f9f('0x31')]);_0x4094ab[_0x9f9f('0x32')]=qs[_0x9f9f('0x34')](_['pick'](_0x142f09[_0x9f9f('0x2a')],_0xbc8b78[_0x9f9f('0x34')]));if(_0x142f09['query']['filter']){_0x4094ab[_0x9f9f('0x32')]=_['merge'](_0x4094ab['where'],{'$or':_['map'](_0x4094ab[_0x9f9f('0x2d')],function(_0x22ae57){var _0x2c2309={};_0x2c2309[_0x22ae57]={'$like':'%'+_0x142f09['query'][_0x9f9f('0x35')]+'%'};return _0x2c2309;})});}_0x4094ab=_[_0x9f9f('0x36')]({},_0x4094ab,_0x142f09[_0x9f9f('0x38')]);return _0x2311d5[_0x9f9f('0x48')](_0x4094ab);}})[_0x9f9f('0x20')](function(_0x281e8c){if(_0x281e8c){_0x11769c=_0x281e8c[_0x9f9f('0x2e')];if(!_0x142f09[_0x9f9f('0x2a')][_0x9f9f('0x2f')]('nolimit')){_0x4094ab[_0x9f9f('0x17')]=qs[_0x9f9f('0x17')](_0x142f09[_0x9f9f('0x2a')][_0x9f9f('0x17')]);_0x4094ab[_0x9f9f('0x1a')]=qs[_0x9f9f('0x1a')](_0x142f09[_0x9f9f('0x2a')][_0x9f9f('0x1a')]);}return _0x2311d5[_0x9f9f('0x48')](_0x4094ab);}})[_0x9f9f('0x20')](function(_0x353ada){if(_0x353ada){return _0x353ada?{'count':_0x11769c,'rows':_0x353ada}:null;}})['then'](respondWithResult(_0x4472e1,null))[_0x9f9f('0x3c')](handleError(_0x4472e1,null));};exports[_0x9f9f('0x49')]=function(_0x5d4268,_0x478b11,_0x106ff2){var _0x2e2545={};var _0x52cb86={};var _0x17f8d6;var _0xdbfa9c;return db[_0x9f9f('0x27')][_0x9f9f('0x44')]({'where':{'id':_0x5d4268['params']['id']}})[_0x9f9f('0x20')](handleEntityNotFound(_0x478b11,null))[_0x9f9f('0x20')](function(_0x20237f){if(_0x20237f){_0x17f8d6=_0x20237f;_0x52cb86[_0x9f9f('0x29')]=_[_0x9f9f('0x3e')](db[_0x9f9f('0x45')]['rawAttributes']);_0x52cb86[_0x9f9f('0x2a')]=_['keys'](_0x5d4268[_0x9f9f('0x2a')]);_0x52cb86['filters']=_[_0x9f9f('0x2b')](_0x52cb86[_0x9f9f('0x29')],_0x52cb86[_0x9f9f('0x2a')]);_0x2e2545[_0x9f9f('0x2d')]=_[_0x9f9f('0x2b')](_0x52cb86[_0x9f9f('0x29')],qs[_0x9f9f('0x2c')](_0x5d4268[_0x9f9f('0x2a')][_0x9f9f('0x2c')]));_0x2e2545[_0x9f9f('0x2d')]=_0x2e2545['attributes'][_0x9f9f('0x2e')]?_0x2e2545[_0x9f9f('0x2d')]:_0x52cb86[_0x9f9f('0x29')];_0x2e2545['order']=qs[_0x9f9f('0x31')](_0x5d4268[_0x9f9f('0x2a')][_0x9f9f('0x31')]);_0x2e2545[_0x9f9f('0x32')]=qs['filters'](_[_0x9f9f('0x33')](_0x5d4268[_0x9f9f('0x2a')],_0x52cb86[_0x9f9f('0x34')]));if(_0x5d4268[_0x9f9f('0x2a')][_0x9f9f('0x35')]){_0x2e2545['where']=_[_0x9f9f('0x36')](_0x2e2545['where'],{'$or':_[_0x9f9f('0x26')](_0x2e2545[_0x9f9f('0x2d')],function(_0x34fde0){var _0x27041e={};_0x27041e[_0x34fde0]={'$like':'%'+_0x5d4268[_0x9f9f('0x2a')][_0x9f9f('0x35')]+'%'};return _0x27041e;})});}_0x2e2545=_['merge']({},_0x2e2545,_0x5d4268[_0x9f9f('0x38')]);return _0x17f8d6[_0x9f9f('0x49')](_0x2e2545);}})[_0x9f9f('0x20')](function(_0xadd583){if(_0xadd583){_0xdbfa9c=_0xadd583[_0x9f9f('0x2e')];if(!_0x5d4268[_0x9f9f('0x2a')][_0x9f9f('0x2f')](_0x9f9f('0x30'))){_0x2e2545[_0x9f9f('0x17')]=qs[_0x9f9f('0x17')](_0x5d4268[_0x9f9f('0x2a')][_0x9f9f('0x17')]);_0x2e2545[_0x9f9f('0x1a')]=qs['offset'](_0x5d4268[_0x9f9f('0x2a')][_0x9f9f('0x1a')]);}return _0x17f8d6[_0x9f9f('0x49')](_0x2e2545);}})[_0x9f9f('0x20')](function(_0x12341d){if(_0x12341d){return _0x12341d?{'count':_0xdbfa9c,'rows':_0x12341d}:null;}})[_0x9f9f('0x20')](respondWithResult(_0x478b11,null))[_0x9f9f('0x3c')](handleError(_0x478b11,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 5a311c5..8c94383 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 _0x0735=['bluebird','path','rimraf','define','VtigerConfiguration','int_vtiger_configurations'];(function(_0xbe40ad,_0x44343c){var _0x50fac9=function(_0xdaed07){while(--_0xdaed07){_0xbe40ad['push'](_0xbe40ad['shift']());}};_0x50fac9(++_0x44343c);}(_0x0735,0x14a));var _0x5073=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x0735[_0x3ff085];return _0x2b68c3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5073('0x0'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5073('0x1'));var rimraf=require(_0x5073('0x2'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x34e90e,_0x3fed3e){return _0x34e90e[_0x5073('0x3')](_0x5073('0x4'),attributes,{'tableName':_0x5073('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6723=['request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','exports','define','int_vtiger_configurations','lodash','util','moment'];(function(_0x4a4ccd,_0x50c1b9){var _0x26aef2=function(_0x238762){while(--_0x238762){_0x4a4ccd['push'](_0x4a4ccd['shift']());}};_0x26aef2(++_0x50c1b9);}(_0x6723,0x151));var _0x3672=function(_0x2b8837,_0x4efb7b){_0x2b8837=_0x2b8837-0x0;var _0x2c2b85=_0x6723[_0x2b8837];return _0x2c2b85;};'use strict';var _=require(_0x3672('0x0'));var util=require(_0x3672('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3672('0x2'));var BPromise=require('bluebird');var rp=require(_0x3672('0x3'));var fs=require('fs');var path=require(_0x3672('0x4'));var rimraf=require('rimraf');var config=require(_0x3672('0x5'));var attributes=require(_0x3672('0x6'));module[_0x3672('0x7')]=function(_0x1c2146,_0x169df5){return _0x1c2146[_0x3672('0x8')]('VtigerConfiguration',attributes,{'tableName':_0x3672('0x9'),'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 06d5ecf..881dfaf 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 _0x5123=['ioredis','../../mysqldb','../../config/environment','http','request','then','VtigerConfiguration,\x20%s,\x20%s','debug','stringify','error','message','info','result','lodash','util','moment'];(function(_0x53e010,_0x1b9ea5){var _0x3dc143=function(_0xb463b7){while(--_0xb463b7){_0x53e010['push'](_0x53e010['shift']());}};_0x3dc143(++_0x1b9ea5);}(_0x5123,0x13d));var _0x3512=function(_0x593660,_0x58864e){_0x593660=_0x593660-0x0;var _0x456af9=_0x5123[_0x593660];return _0x456af9;};'use strict';var _=require(_0x3512('0x0'));var util=require(_0x3512('0x1'));var moment=require(_0x3512('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3512('0x3'));var db=require(_0x3512('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x3512('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3512('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x367c53,_0x571739,_0x204123){return new BPromise(function(_0x2738c1,_0x2c0236){return client[_0x3512('0x7')](_0x367c53,_0x204123)[_0x3512('0x8')](function(_0x2c585c){logger['info'](_0x3512('0x9'),_0x571739,'request\x20sent');logger[_0x3512('0xa')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x571739,'request\x20sent',JSON[_0x3512('0xb')](_0x2c585c));if(_0x2c585c[_0x3512('0xc')]){if(_0x2c585c[_0x3512('0xc')]['code']===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x571739,_0x2c585c[_0x3512('0xc')][_0x3512('0xd')]);return _0x2c0236(_0x2c585c[_0x3512('0xc')][_0x3512('0xd')]);}logger['error'](_0x3512('0x9'),_0x571739,_0x2c585c[_0x3512('0xc')][_0x3512('0xd')]);return _0x2738c1(_0x2c585c[_0x3512('0xc')]['message']);}else{logger[_0x3512('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x571739,'request\x20sent');_0x2738c1(_0x2c585c[_0x3512('0xf')][_0x3512('0xd')]);}})['catch'](function(_0x136501){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x571739,_0x136501);_0x2c0236(_0x136501);});});} \ No newline at end of file +var _0xf84d=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x45081a,_0x3ae384){var _0x55bfe2=function(_0xdb8714){while(--_0xdb8714){_0x45081a['push'](_0x45081a['shift']());}};_0x55bfe2(++_0x3ae384);}(_0xf84d,0xaa));var _0xdf84=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0xf84d[_0x622035];return _0x326cf2;};'use strict';var _=require(_0xdf84('0x0'));var util=require(_0xdf84('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdf84('0x2'));var fs=require('fs');var Redis=require(_0xdf84('0x3'));var db=require(_0xdf84('0x4'))['db'];var utils=require(_0xdf84('0x5'));var logger=require(_0xdf84('0x6'))(_0xdf84('0x7'));var config=require(_0xdf84('0x8'));var jayson=require(_0xdf84('0x9'));var client=jayson['client'][_0xdf84('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6e43bb,_0x2feac7,_0x9826b5){return new BPromise(function(_0x184365,_0x5caae6){return client[_0xdf84('0xb')](_0x6e43bb,_0x9826b5)[_0xdf84('0xc')](function(_0x2df5f6){logger[_0xdf84('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x2feac7,_0xdf84('0xe'));logger[_0xdf84('0xf')](_0xdf84('0x10'),_0x2feac7,_0xdf84('0xe'),JSON['stringify'](_0x2df5f6));if(_0x2df5f6[_0xdf84('0x11')]){if(_0x2df5f6[_0xdf84('0x11')]['code']===0x1f4){logger[_0xdf84('0x11')](_0xdf84('0x12'),_0x2feac7,_0x2df5f6['error']['message']);return _0x5caae6(_0x2df5f6[_0xdf84('0x11')][_0xdf84('0x13')]);}logger[_0xdf84('0x11')](_0xdf84('0x12'),_0x2feac7,_0x2df5f6[_0xdf84('0x11')][_0xdf84('0x13')]);return _0x184365(_0x2df5f6[_0xdf84('0x11')][_0xdf84('0x13')]);}else{logger[_0xdf84('0xd')](_0xdf84('0x12'),_0x2feac7,_0xdf84('0xe'));_0x184365(_0x2df5f6[_0xdf84('0x14')][_0xdf84('0x13')]);}})[_0xdf84('0x15')](function(_0x2d9a9e){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x2feac7,_0x2d9a9e);_0x5caae6(_0x2d9a9e);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 777425b..6eab32b 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 _0x1e2c=['index','/:id','show','post','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated'];(function(_0x9bff4a,_0x5bfabd){var _0x158c5f=function(_0x5e384d){while(--_0x5e384d){_0x9bff4a['push'](_0x9bff4a['shift']());}};_0x158c5f(++_0x5bfabd);}(_0x1e2c,0xf6));var _0xc1e2=function(_0x4080a2,_0x59593e){_0x4080a2=_0x4080a2-0x0;var _0x2064ab=_0x1e2c[_0x4080a2];return _0x2064ab;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc1e2('0x0'));var timeout=require(_0xc1e2('0x1'));var express=require(_0xc1e2('0x2'));var router=express[_0xc1e2('0x3')]();var fs_extra=require(_0xc1e2('0x4'));var auth=require(_0xc1e2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc1e2('0x6'));var controller=require(_0xc1e2('0x7'));router[_0xc1e2('0x8')]('/',auth[_0xc1e2('0x9')](),controller[_0xc1e2('0xa')]);router[_0xc1e2('0x8')](_0xc1e2('0xb'),auth[_0xc1e2('0x9')](),controller[_0xc1e2('0xc')]);router[_0xc1e2('0xd')]('/',auth[_0xc1e2('0x9')](),controller['create']);router['put'](_0xc1e2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xc1e2('0xe')](_0xc1e2('0xb'),auth[_0xc1e2('0x9')](),controller['destroy']);module[_0xc1e2('0xf')]=router; \ No newline at end of file +var _0x1956=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x53774f,_0x5adb6d){var _0x3ab6e5=function(_0x3d21b5){while(--_0x3d21b5){_0x53774f['push'](_0x53774f['shift']());}};_0x3ab6e5(++_0x5adb6d);}(_0x1956,0x83));var _0x6195=function(_0x55821d,_0x27a22e){_0x55821d=_0x55821d-0x0;var _0x58ea8a=_0x1956[_0x55821d];return _0x58ea8a;};'use strict';var multer=require('multer');var util=require(_0x6195('0x0'));var path=require(_0x6195('0x1'));var timeout=require(_0x6195('0x2'));var express=require(_0x6195('0x3'));var router=express[_0x6195('0x4')]();var fs_extra=require(_0x6195('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6195('0x6'));var config=require(_0x6195('0x7'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x6195('0x8')](),controller[_0x6195('0x9')]);router[_0x6195('0xa')](_0x6195('0xb'),auth[_0x6195('0x8')](),controller['show']);router[_0x6195('0xc')]('/',auth[_0x6195('0x8')](),controller[_0x6195('0xd')]);router[_0x6195('0xe')](_0x6195('0xb'),auth[_0x6195('0x8')](),controller[_0x6195('0xf')]);router[_0x6195('0x10')](_0x6195('0xb'),auth[_0x6195('0x8')](),controller[_0x6195('0x11')]);module[_0x6195('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 c2a94b7..9637a4a 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 _0xe6e0=['customVariable','sequelize','exports','string','keyValue','picklist','STRING','ENUM'];(function(_0x22d1e3,_0x1b17d5){var _0x2869e2=function(_0x371783){while(--_0x371783){_0x22d1e3['push'](_0x22d1e3['shift']());}};_0x2869e2(++_0x1b17d5);}(_0xe6e0,0x1e1));var _0x0e6e=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xe6e0[_0xdc37a1];return _0x99b4fe;};'use strict';var Sequelize=require(_0x0e6e('0x0'));module[_0x0e6e('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0e6e('0x2'),'variable','customVariable',_0x0e6e('0x3'),_0x0e6e('0x4')),'defaultValue':_0x0e6e('0x2')},'content':{'type':Sequelize[_0x0e6e('0x5')]},'key':{'type':Sequelize[_0x0e6e('0x5')]},'keyType':{'type':Sequelize[_0x0e6e('0x6')](_0x0e6e('0x2'),'variable',_0x0e6e('0x7'))},'keyContent':{'type':Sequelize[_0x0e6e('0x5')]},'idField':{'type':Sequelize[_0x0e6e('0x5')]},'nameField':{'type':Sequelize[_0x0e6e('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0e6e('0x5')]}}; \ No newline at end of file +var _0xb8b6=['BOOLEAN','string','variable','keyValue','picklist','STRING','ENUM','customVariable'];(function(_0x1dfa63,_0x362bd4){var _0x26f2a9=function(_0x31cc52){while(--_0x31cc52){_0x1dfa63['push'](_0x1dfa63['shift']());}};_0x26f2a9(++_0x362bd4);}(_0xb8b6,0x189));var _0x6b8b=function(_0x2c7ba6,_0x458b83){_0x2c7ba6=_0x2c7ba6-0x0;var _0x5ecc30=_0xb8b6[_0x2c7ba6];return _0x5ecc30;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x6b8b('0x0'),_0x6b8b('0x1'),'customVariable',_0x6b8b('0x2'),_0x6b8b('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6b8b('0x4')]},'key':{'type':Sequelize[_0x6b8b('0x4')]},'keyType':{'type':Sequelize[_0x6b8b('0x5')](_0x6b8b('0x0'),_0x6b8b('0x1'),_0x6b8b('0x6'))},'keyContent':{'type':Sequelize[_0x6b8b('0x4')]},'idField':{'type':Sequelize[_0x6b8b('0x4')]},'nameField':{'type':Sequelize[_0x6b8b('0x4')]},'customField':{'type':Sequelize[_0x6b8b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6b8b('0x4')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 6a831b1..c20f43a 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 _0xe5c2=['lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','map','VIRTUAL','options','VtigerField','findAll','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv'];(function(_0x23d8f8,_0x79bff5){var _0x34019c=function(_0x49dc93){while(--_0x49dc93){_0x23d8f8['push'](_0x23d8f8['shift']());}};_0x34019c(++_0x79bff5);}(_0xe5c2,0xdc));var _0x2e5c=function(_0x564444,_0x4bd95c){_0x564444=_0x564444-0x0;var _0xecb5e1=_0xe5c2[_0x564444];return _0xecb5e1;};'use strict';var emlformat=require(_0x2e5c('0x0'));var rimraf=require(_0x2e5c('0x1'));var zipdir=require(_0x2e5c('0x2'));var jsonpatch=require(_0x2e5c('0x3'));var rp=require(_0x2e5c('0x4'));var moment=require('moment');var BPromise=require(_0x2e5c('0x5'));var Mustache=require(_0x2e5c('0x6'));var util=require(_0x2e5c('0x7'));var path=require(_0x2e5c('0x8'));var sox=require(_0x2e5c('0x9'));var csv=require(_0x2e5c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2e5c('0xb'));var squel=require('squel');var crypto=require(_0x2e5c('0xc'));var jsforce=require(_0x2e5c('0xd'));var deskjs=require(_0x2e5c('0xe'));var toCsv=require(_0x2e5c('0xa'));var querystring=require(_0x2e5c('0xf'));var Papa=require(_0x2e5c('0x10'));var Redis=require('ioredis');var authService=require(_0x2e5c('0x11'));var qs=require(_0x2e5c('0x12'));var as=require(_0x2e5c('0x13'));var hardwareService=require(_0x2e5c('0x14'));var logger=require('../../config/logger')(_0x2e5c('0x15'));var utils=require('../../config/utils');var config=require(_0x2e5c('0x16'));var licenseUtil=require(_0x2e5c('0x17'));var db=require(_0x2e5c('0x18'))['db'];function respondWithStatusCode(_0x32f311,_0x54e541){_0x54e541=_0x54e541||0xcc;return function(_0x4b06e5){if(_0x4b06e5){return _0x32f311['sendStatus'](_0x54e541);}return _0x32f311[_0x2e5c('0x19')](_0x54e541)[_0x2e5c('0x1a')]();};}function respondWithResult(_0x2a00d6,_0x18b1e4){_0x18b1e4=_0x18b1e4||0xc8;return function(_0xac703d){if(_0xac703d){return _0x2a00d6[_0x2e5c('0x19')](_0x18b1e4)[_0x2e5c('0x1b')](_0xac703d);}};}function respondWithFilteredResult(_0x275ff0,_0x398bc8){return function(_0x50514f){if(_0x50514f){var _0x389857=typeof _0x398bc8[_0x2e5c('0x1c')]==='undefined'&&typeof _0x398bc8['limit']===_0x2e5c('0x1d');var _0x1d069d=_0x50514f[_0x2e5c('0x1e')];var _0x5af367=_0x389857?0x0:_0x398bc8['offset'];var _0x2f1c06=_0x389857?_0x50514f[_0x2e5c('0x1e')]:_0x398bc8[_0x2e5c('0x1c')]+_0x398bc8[_0x2e5c('0x1f')];var _0x19689f;if(_0x2f1c06>=_0x1d069d){_0x2f1c06=_0x1d069d;_0x19689f=0xc8;}else{_0x19689f=0xce;}_0x275ff0[_0x2e5c('0x19')](_0x19689f);return _0x275ff0[_0x2e5c('0x20')](_0x2e5c('0x21'),_0x5af367+'-'+_0x2f1c06+'/'+_0x1d069d)[_0x2e5c('0x1b')](_0x50514f);}return null;};}function patchUpdates(_0x4e1860){return function(_0x454f65){try{jsonpatch[_0x2e5c('0x22')](_0x454f65,_0x4e1860,!![]);}catch(_0x4be965){return BPromise[_0x2e5c('0x23')](_0x4be965);}return _0x454f65[_0x2e5c('0x24')]();};}function saveUpdates(_0x190908,_0x1e2d48){return function(_0x5040e6){if(_0x5040e6){return _0x5040e6[_0x2e5c('0x25')](_0x190908)['then'](function(_0x1b66b8){return _0x1b66b8;});}return null;};}function removeEntity(_0x2d57e2,_0x20251a){return function(_0x1a89be){if(_0x1a89be){return _0x1a89be[_0x2e5c('0x26')]()[_0x2e5c('0x27')](function(){_0x2d57e2[_0x2e5c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5580ba,_0x8235b5){return function(_0x59560c){if(!_0x59560c){_0x5580ba[_0x2e5c('0x28')](0x194);}return _0x59560c;};}function handleError(_0x578770,_0xbe16bc){_0xbe16bc=_0xbe16bc||0x1f4;return function(_0x308ad8){logger[_0x2e5c('0x29')](_0x308ad8[_0x2e5c('0x2a')]);if(_0x308ad8[_0x2e5c('0x2b')]){delete _0x308ad8[_0x2e5c('0x2b')];}_0x578770[_0x2e5c('0x19')](_0xbe16bc)[_0x2e5c('0x2c')](_0x308ad8);};}exports[_0x2e5c('0x2d')]=function(_0x2289b8,_0x48e69b){var _0x2764fd={},_0x5a712e={},_0x4bad70={'count':0x0,'rows':[]};var _0x51e982=_['map'](db['VtigerField'][_0x2e5c('0x2e')],function(_0x2b0976){return{'name':_0x2b0976[_0x2e5c('0x2f')],'type':_0x2b0976[_0x2e5c('0x30')]['key']};});_0x5a712e[_0x2e5c('0x31')]=_['map'](_0x51e982,_0x2e5c('0x2b'));_0x5a712e[_0x2e5c('0x32')]=_[_0x2e5c('0x33')](_0x2289b8[_0x2e5c('0x32')]);_0x5a712e['filters']=_[_0x2e5c('0x34')](_0x5a712e[_0x2e5c('0x31')],_0x5a712e[_0x2e5c('0x32')]);_0x2764fd[_0x2e5c('0x35')]=_[_0x2e5c('0x34')](_0x5a712e['model'],qs['fields'](_0x2289b8[_0x2e5c('0x32')][_0x2e5c('0x36')]));_0x2764fd[_0x2e5c('0x35')]=_0x2764fd['attributes'][_0x2e5c('0x37')]?_0x2764fd[_0x2e5c('0x35')]:_0x5a712e[_0x2e5c('0x31')];if(!_0x2289b8[_0x2e5c('0x32')][_0x2e5c('0x38')](_0x2e5c('0x39'))){_0x2764fd[_0x2e5c('0x1f')]=qs[_0x2e5c('0x1f')](_0x2289b8[_0x2e5c('0x32')]['limit']);_0x2764fd[_0x2e5c('0x1c')]=qs[_0x2e5c('0x1c')](_0x2289b8[_0x2e5c('0x32')][_0x2e5c('0x1c')]);}_0x2764fd[_0x2e5c('0x3a')]=qs[_0x2e5c('0x3b')](_0x2289b8['query'][_0x2e5c('0x3b')]);_0x2764fd['where']=qs[_0x2e5c('0x3c')](_[_0x2e5c('0x3d')](_0x2289b8['query'],_0x5a712e[_0x2e5c('0x3c')]),_0x51e982);if(_0x2289b8[_0x2e5c('0x32')][_0x2e5c('0x3e')]){_0x2764fd[_0x2e5c('0x3f')]=_[_0x2e5c('0x40')](_0x2764fd[_0x2e5c('0x3f')],{'$or':_[_0x2e5c('0x41')](_0x51e982,function(_0x55e9de){if(_0x55e9de['type']!==_0x2e5c('0x42')){var _0x1201c0={};_0x1201c0[_0x55e9de[_0x2e5c('0x2b')]]={'$like':'%'+_0x2289b8[_0x2e5c('0x32')][_0x2e5c('0x3e')]+'%'};return _0x1201c0;}})});}_0x2764fd=_[_0x2e5c('0x40')]({},_0x2764fd,_0x2289b8[_0x2e5c('0x43')]);var _0x3c6ee6={'where':_0x2764fd[_0x2e5c('0x3f')]};return db[_0x2e5c('0x44')][_0x2e5c('0x1e')](_0x3c6ee6)['then'](function(_0x446719){_0x4bad70[_0x2e5c('0x1e')]=_0x446719;if(_0x2289b8[_0x2e5c('0x32')]['includeAll']){_0x2764fd['include']=[{'all':!![]}];}return db[_0x2e5c('0x44')][_0x2e5c('0x45')](_0x2764fd);})[_0x2e5c('0x27')](function(_0xf0172b){_0x4bad70['rows']=_0xf0172b;return _0x4bad70;})['then'](respondWithFilteredResult(_0x48e69b,_0x2764fd))[_0x2e5c('0x46')](handleError(_0x48e69b,null));};exports[_0x2e5c('0x47')]=function(_0x4f3b14,_0x4fd24a){var _0x2caeaf={'raw':!![],'where':{'id':_0x4f3b14[_0x2e5c('0x48')]['id']}},_0x44b407={};_0x44b407[_0x2e5c('0x31')]=_[_0x2e5c('0x33')](db[_0x2e5c('0x44')][_0x2e5c('0x2e')]);_0x44b407[_0x2e5c('0x32')]=_[_0x2e5c('0x33')](_0x4f3b14['query']);_0x44b407[_0x2e5c('0x3c')]=_[_0x2e5c('0x34')](_0x44b407['model'],_0x44b407[_0x2e5c('0x32')]);_0x2caeaf['attributes']=_[_0x2e5c('0x34')](_0x44b407[_0x2e5c('0x31')],qs[_0x2e5c('0x36')](_0x4f3b14['query'][_0x2e5c('0x36')]));_0x2caeaf[_0x2e5c('0x35')]=_0x2caeaf[_0x2e5c('0x35')][_0x2e5c('0x37')]?_0x2caeaf[_0x2e5c('0x35')]:_0x44b407[_0x2e5c('0x31')];if(_0x4f3b14['query']['includeAll']){_0x2caeaf[_0x2e5c('0x49')]=[{'all':!![]}];}_0x2caeaf=_[_0x2e5c('0x40')]({},_0x2caeaf,_0x4f3b14[_0x2e5c('0x43')]);return db[_0x2e5c('0x44')][_0x2e5c('0x4a')](_0x2caeaf)[_0x2e5c('0x27')](handleEntityNotFound(_0x4fd24a,null))[_0x2e5c('0x27')](respondWithResult(_0x4fd24a,null))[_0x2e5c('0x46')](handleError(_0x4fd24a,null));};exports[_0x2e5c('0x4b')]=function(_0x141d6c,_0x457d2b){return db[_0x2e5c('0x44')][_0x2e5c('0x4b')](_0x141d6c['body'],{})[_0x2e5c('0x27')](respondWithResult(_0x457d2b,0xc9))[_0x2e5c('0x46')](handleError(_0x457d2b,null));};exports[_0x2e5c('0x25')]=function(_0x42fa68,_0x474402){if(_0x42fa68[_0x2e5c('0x4c')]['id']){delete _0x42fa68[_0x2e5c('0x4c')]['id'];}return db['VtigerField'][_0x2e5c('0x4a')]({'where':{'id':_0x42fa68[_0x2e5c('0x48')]['id']}})[_0x2e5c('0x27')](handleEntityNotFound(_0x474402,null))[_0x2e5c('0x27')](saveUpdates(_0x42fa68[_0x2e5c('0x4c')],null))[_0x2e5c('0x27')](respondWithResult(_0x474402,null))[_0x2e5c('0x46')](handleError(_0x474402,null));};exports[_0x2e5c('0x26')]=function(_0x5cfa42,_0x1a4e46){return db[_0x2e5c('0x44')][_0x2e5c('0x4a')]({'where':{'id':_0x5cfa42[_0x2e5c('0x48')]['id']}})['then'](handleEntityNotFound(_0x1a4e46,null))[_0x2e5c('0x27')](removeEntity(_0x1a4e46,null))['catch'](handleError(_0x1a4e46,null));}; \ No newline at end of file +var _0x6665=['merge','VIRTUAL','includeAll','include','rows','catch','params','options','find','create','body','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','name','send','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x49db8b,_0x47fc66){var _0x39698a=function(_0x28820b){while(--_0x28820b){_0x49db8b['push'](_0x49db8b['shift']());}};_0x39698a(++_0x47fc66);}(_0x6665,0x1ee));var _0x5666=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x6665[_0x387777];return _0x3f84c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5666('0x0'));var zipdir=require(_0x5666('0x1'));var jsonpatch=require(_0x5666('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5666('0x3'));var Mustache=require(_0x5666('0x4'));var util=require(_0x5666('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x5666('0x6'));var ejs=require(_0x5666('0x7'));var fs=require('fs');var fs_extra=require(_0x5666('0x8'));var _=require('lodash');var squel=require(_0x5666('0x9'));var crypto=require(_0x5666('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5666('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5666('0xc'));var Papa=require(_0x5666('0xd'));var Redis=require('ioredis');var authService=require(_0x5666('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x5666('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5666('0x10'))('api');var utils=require(_0x5666('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5666('0x12'))['db'];function respondWithStatusCode(_0x5ab251,_0x110d93){_0x110d93=_0x110d93||0xcc;return function(_0x1e5436){if(_0x1e5436){return _0x5ab251['sendStatus'](_0x110d93);}return _0x5ab251[_0x5666('0x13')](_0x110d93)['end']();};}function respondWithResult(_0x2c450e,_0xb960b9){_0xb960b9=_0xb960b9||0xc8;return function(_0x1b5a45){if(_0x1b5a45){return _0x2c450e['status'](_0xb960b9)[_0x5666('0x14')](_0x1b5a45);}};}function respondWithFilteredResult(_0x3d0f0b,_0x1b08e2){return function(_0x1f21fb){if(_0x1f21fb){var _0x53f3f3=typeof _0x1b08e2['offset']===_0x5666('0x15')&&typeof _0x1b08e2['limit']===_0x5666('0x15');var _0x419500=_0x1f21fb['count'];var _0x555e8d=_0x53f3f3?0x0:_0x1b08e2[_0x5666('0x16')];var _0x238234=_0x53f3f3?_0x1f21fb[_0x5666('0x17')]:_0x1b08e2[_0x5666('0x16')]+_0x1b08e2[_0x5666('0x18')];var _0x2b24be;if(_0x238234>=_0x419500){_0x238234=_0x419500;_0x2b24be=0xc8;}else{_0x2b24be=0xce;}_0x3d0f0b['status'](_0x2b24be);return _0x3d0f0b[_0x5666('0x19')](_0x5666('0x1a'),_0x555e8d+'-'+_0x238234+'/'+_0x419500)[_0x5666('0x14')](_0x1f21fb);}return null;};}function patchUpdates(_0x2e3645){return function(_0x343a97){try{jsonpatch[_0x5666('0x1b')](_0x343a97,_0x2e3645,!![]);}catch(_0x3d95b9){return BPromise[_0x5666('0x1c')](_0x3d95b9);}return _0x343a97[_0x5666('0x1d')]();};}function saveUpdates(_0x23fec7,_0x4eeb88){return function(_0xa7216c){if(_0xa7216c){return _0xa7216c['update'](_0x23fec7)[_0x5666('0x1e')](function(_0x3c47e3){return _0x3c47e3;});}return null;};}function removeEntity(_0x309228,_0x1ece62){return function(_0x32968e){if(_0x32968e){return _0x32968e[_0x5666('0x1f')]()[_0x5666('0x1e')](function(){_0x309228[_0x5666('0x13')](0xcc)[_0x5666('0x20')]();});}};}function handleEntityNotFound(_0x129e37,_0x668c9a){return function(_0xd5e7d8){if(!_0xd5e7d8){_0x129e37[_0x5666('0x21')](0x194);}return _0xd5e7d8;};}function handleError(_0x444ac0,_0x4d2972){_0x4d2972=_0x4d2972||0x1f4;return function(_0x425719){logger[_0x5666('0x22')](_0x425719['stack']);if(_0x425719['name']){delete _0x425719[_0x5666('0x23')];}_0x444ac0[_0x5666('0x13')](_0x4d2972)[_0x5666('0x24')](_0x425719);};}exports['index']=function(_0x3bae3d,_0x171591){var _0x4f7a9b={},_0x1b9a2e={},_0x343ca2={'count':0x0,'rows':[]};var _0x31bb65=_[_0x5666('0x25')](db[_0x5666('0x26')][_0x5666('0x27')],function(_0x339e36){return{'name':_0x339e36[_0x5666('0x28')],'type':_0x339e36[_0x5666('0x29')][_0x5666('0x2a')]};});_0x1b9a2e[_0x5666('0x2b')]=_['map'](_0x31bb65,_0x5666('0x23'));_0x1b9a2e[_0x5666('0x2c')]=_[_0x5666('0x2d')](_0x3bae3d[_0x5666('0x2c')]);_0x1b9a2e[_0x5666('0x2e')]=_[_0x5666('0x2f')](_0x1b9a2e['model'],_0x1b9a2e[_0x5666('0x2c')]);_0x4f7a9b[_0x5666('0x30')]=_['intersection'](_0x1b9a2e[_0x5666('0x2b')],qs[_0x5666('0x31')](_0x3bae3d[_0x5666('0x2c')][_0x5666('0x31')]));_0x4f7a9b['attributes']=_0x4f7a9b[_0x5666('0x30')][_0x5666('0x32')]?_0x4f7a9b[_0x5666('0x30')]:_0x1b9a2e[_0x5666('0x2b')];if(!_0x3bae3d[_0x5666('0x2c')][_0x5666('0x33')](_0x5666('0x34'))){_0x4f7a9b[_0x5666('0x18')]=qs[_0x5666('0x18')](_0x3bae3d['query'][_0x5666('0x18')]);_0x4f7a9b[_0x5666('0x16')]=qs['offset'](_0x3bae3d[_0x5666('0x2c')][_0x5666('0x16')]);}_0x4f7a9b[_0x5666('0x35')]=qs[_0x5666('0x36')](_0x3bae3d[_0x5666('0x2c')][_0x5666('0x36')]);_0x4f7a9b[_0x5666('0x37')]=qs['filters'](_[_0x5666('0x38')](_0x3bae3d['query'],_0x1b9a2e[_0x5666('0x2e')]),_0x31bb65);if(_0x3bae3d[_0x5666('0x2c')][_0x5666('0x39')]){_0x4f7a9b[_0x5666('0x37')]=_[_0x5666('0x3a')](_0x4f7a9b[_0x5666('0x37')],{'$or':_[_0x5666('0x25')](_0x31bb65,function(_0x35f248){if(_0x35f248[_0x5666('0x29')]!==_0x5666('0x3b')){var _0x88945d={};_0x88945d[_0x35f248[_0x5666('0x23')]]={'$like':'%'+_0x3bae3d[_0x5666('0x2c')][_0x5666('0x39')]+'%'};return _0x88945d;}})});}_0x4f7a9b=_[_0x5666('0x3a')]({},_0x4f7a9b,_0x3bae3d['options']);var _0x552cc7={'where':_0x4f7a9b[_0x5666('0x37')]};return db[_0x5666('0x26')][_0x5666('0x17')](_0x552cc7)[_0x5666('0x1e')](function(_0x4d92ff){_0x343ca2[_0x5666('0x17')]=_0x4d92ff;if(_0x3bae3d[_0x5666('0x2c')][_0x5666('0x3c')]){_0x4f7a9b[_0x5666('0x3d')]=[{'all':!![]}];}return db[_0x5666('0x26')]['findAll'](_0x4f7a9b);})['then'](function(_0x2e0961){_0x343ca2[_0x5666('0x3e')]=_0x2e0961;return _0x343ca2;})[_0x5666('0x1e')](respondWithFilteredResult(_0x171591,_0x4f7a9b))[_0x5666('0x3f')](handleError(_0x171591,null));};exports['show']=function(_0x565a91,_0xdaa205){var _0x293bd2={'raw':!![],'where':{'id':_0x565a91[_0x5666('0x40')]['id']}},_0x3b2496={};_0x3b2496[_0x5666('0x2b')]=_[_0x5666('0x2d')](db[_0x5666('0x26')]['rawAttributes']);_0x3b2496['query']=_[_0x5666('0x2d')](_0x565a91[_0x5666('0x2c')]);_0x3b2496['filters']=_[_0x5666('0x2f')](_0x3b2496[_0x5666('0x2b')],_0x3b2496[_0x5666('0x2c')]);_0x293bd2[_0x5666('0x30')]=_[_0x5666('0x2f')](_0x3b2496[_0x5666('0x2b')],qs['fields'](_0x565a91['query'][_0x5666('0x31')]));_0x293bd2[_0x5666('0x30')]=_0x293bd2['attributes'][_0x5666('0x32')]?_0x293bd2['attributes']:_0x3b2496[_0x5666('0x2b')];if(_0x565a91[_0x5666('0x2c')][_0x5666('0x3c')]){_0x293bd2[_0x5666('0x3d')]=[{'all':!![]}];}_0x293bd2=_[_0x5666('0x3a')]({},_0x293bd2,_0x565a91[_0x5666('0x41')]);return db[_0x5666('0x26')][_0x5666('0x42')](_0x293bd2)[_0x5666('0x1e')](handleEntityNotFound(_0xdaa205,null))[_0x5666('0x1e')](respondWithResult(_0xdaa205,null))['catch'](handleError(_0xdaa205,null));};exports[_0x5666('0x43')]=function(_0x148017,_0x4b8c6c){return db[_0x5666('0x26')][_0x5666('0x43')](_0x148017[_0x5666('0x44')],{})[_0x5666('0x1e')](respondWithResult(_0x4b8c6c,0xc9))['catch'](handleError(_0x4b8c6c,null));};exports['update']=function(_0x36596a,_0x102ea2){if(_0x36596a[_0x5666('0x44')]['id']){delete _0x36596a[_0x5666('0x44')]['id'];}return db[_0x5666('0x26')][_0x5666('0x42')]({'where':{'id':_0x36596a[_0x5666('0x40')]['id']}})[_0x5666('0x1e')](handleEntityNotFound(_0x102ea2,null))[_0x5666('0x1e')](saveUpdates(_0x36596a['body'],null))['then'](respondWithResult(_0x102ea2,null))[_0x5666('0x3f')](handleError(_0x102ea2,null));};exports[_0x5666('0x1f')]=function(_0x5e3f1e,_0x9d080c){return db['VtigerField']['find']({'where':{'id':_0x5e3f1e[_0x5666('0x40')]['id']}})[_0x5666('0x1e')](handleEntityNotFound(_0x9d080c,null))[_0x5666('0x1e')](removeEntity(_0x9d080c,null))['catch'](handleError(_0x9d080c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 39df9b9..c397c43 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 _0x88b5=['exports','VtigerField','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes'];(function(_0x2061ad,_0x56f01b){var _0x5d4b02=function(_0x3cf820){while(--_0x3cf820){_0x2061ad['push'](_0x2061ad['shift']());}};_0x5d4b02(++_0x56f01b);}(_0x88b5,0x101));var _0x588b=function(_0x458236,_0x470e77){_0x458236=_0x458236-0x0;var _0x22516a=_0x88b5[_0x458236];return _0x22516a;};'use strict';var _=require(_0x588b('0x0'));var util=require(_0x588b('0x1'));var logger=require(_0x588b('0x2'))('api');var moment=require(_0x588b('0x3'));var BPromise=require('bluebird');var rp=require(_0x588b('0x4'));var fs=require('fs');var path=require(_0x588b('0x5'));var rimraf=require(_0x588b('0x6'));var config=require(_0x588b('0x7'));var attributes=require(_0x588b('0x8'));module[_0x588b('0x9')]=function(_0x5b47e3,_0x21943b){return _0x5b47e3['define'](_0x588b('0xa'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x588b('0xb'),'fields':[_0x588b('0xc'),_0x588b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5817=['int_vtiger_fields','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField'];(function(_0x3ffff2,_0x289fac){var _0x513720=function(_0xa8406c){while(--_0xa8406c){_0x3ffff2['push'](_0x3ffff2['shift']());}};_0x513720(++_0x289fac);}(_0x5817,0x1dd));var _0x7581=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5817[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x7581('0x0'));var util=require(_0x7581('0x1'));var logger=require(_0x7581('0x2'))('api');var moment=require(_0x7581('0x3'));var BPromise=require(_0x7581('0x4'));var rp=require(_0x7581('0x5'));var fs=require('fs');var path=require(_0x7581('0x6'));var rimraf=require(_0x7581('0x7'));var config=require(_0x7581('0x8'));var attributes=require(_0x7581('0x9'));module[_0x7581('0xa')]=function(_0x15832a,_0x2a2b58){return _0x15832a[_0x7581('0xb')](_0x7581('0xc'),attributes,{'tableName':_0x7581('0xd'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField','FieldId'],'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 7d45aba..c969c0b 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 _0x849a=['../../config/environment','jayson/promise','client','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc'];(function(_0x4d180c,_0x45c68e){var _0x49b57e=function(_0x264741){while(--_0x264741){_0x4d180c['push'](_0x4d180c['shift']());}};_0x49b57e(++_0x45c68e);}(_0x849a,0x116));var _0xa849=function(_0x475512,_0x11c03a){_0x475512=_0x475512-0x0;var _0x1a6bd2=_0x849a[_0x475512];return _0x1a6bd2;};'use strict';var _=require(_0xa849('0x0'));var util=require(_0xa849('0x1'));var moment=require(_0xa849('0x2'));var BPromise=require('bluebird');var rs=require(_0xa849('0x3'));var fs=require('fs');var Redis=require(_0xa849('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa849('0x5'));var logger=require('../../config/logger')(_0xa849('0x6'));var config=require(_0xa849('0x7'));var jayson=require(_0xa849('0x8'));var client=jayson[_0xa849('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b5c0d,_0x299dd7,_0x7da5f3){return new BPromise(function(_0x1120dd,_0x21a953){return client[_0xa849('0xa')](_0x1b5c0d,_0x7da5f3)[_0xa849('0xb')](function(_0x3f0fc0){logger['info'](_0xa849('0xc'),_0x299dd7,_0xa849('0xd'));logger[_0xa849('0xe')](_0xa849('0xf'),_0x299dd7,_0xa849('0xd'),JSON['stringify'](_0x3f0fc0));if(_0x3f0fc0[_0xa849('0x10')]){if(_0x3f0fc0['error'][_0xa849('0x11')]===0x1f4){logger[_0xa849('0x10')](_0xa849('0xc'),_0x299dd7,_0x3f0fc0[_0xa849('0x10')]['message']);return _0x21a953(_0x3f0fc0[_0xa849('0x10')][_0xa849('0x12')]);}logger[_0xa849('0x10')](_0xa849('0xc'),_0x299dd7,_0x3f0fc0[_0xa849('0x10')]['message']);return _0x1120dd(_0x3f0fc0['error'][_0xa849('0x12')]);}else{logger['info'](_0xa849('0xc'),_0x299dd7,'request\x20sent');_0x1120dd(_0x3f0fc0['result'][_0xa849('0x12')]);}})['catch'](function(_0x2883db){logger[_0xa849('0x10')](_0xa849('0xc'),_0x299dd7,_0x2883db);_0x21a953(_0x2883db);});});} \ No newline at end of file +var _0xc9bc=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4a0f16,_0x21ba18){var _0x45d653=function(_0x137e2c){while(--_0x137e2c){_0x4a0f16['push'](_0x4a0f16['shift']());}};_0x45d653(++_0x21ba18);}(_0xc9bc,0x156));var _0xcc9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc9bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcc9b('0x0'));var util=require(_0xcc9b('0x1'));var moment=require(_0xcc9b('0x2'));var BPromise=require(_0xcc9b('0x3'));var rs=require(_0xcc9b('0x4'));var fs=require('fs');var Redis=require(_0xcc9b('0x5'));var db=require(_0xcc9b('0x6'))['db'];var utils=require(_0xcc9b('0x7'));var logger=require(_0xcc9b('0x8'))(_0xcc9b('0x9'));var config=require('../../config/environment');var jayson=require(_0xcc9b('0xa'));var client=jayson[_0xcc9b('0xb')][_0xcc9b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x167dec,_0x4c9dfb,_0x50ab32){return new BPromise(function(_0x28f38d,_0x5406ba){return client[_0xcc9b('0xd')](_0x167dec,_0x50ab32)[_0xcc9b('0xe')](function(_0x69602d){logger[_0xcc9b('0xf')](_0xcc9b('0x10'),_0x4c9dfb,'request\x20sent');logger['debug'](_0xcc9b('0x11'),_0x4c9dfb,_0xcc9b('0x12'),JSON[_0xcc9b('0x13')](_0x69602d));if(_0x69602d[_0xcc9b('0x14')]){if(_0x69602d[_0xcc9b('0x14')][_0xcc9b('0x15')]===0x1f4){logger[_0xcc9b('0x14')](_0xcc9b('0x10'),_0x4c9dfb,_0x69602d[_0xcc9b('0x14')]['message']);return _0x5406ba(_0x69602d[_0xcc9b('0x14')][_0xcc9b('0x16')]);}logger[_0xcc9b('0x14')]('VtigerField,\x20%s,\x20%s',_0x4c9dfb,_0x69602d[_0xcc9b('0x14')][_0xcc9b('0x16')]);return _0x28f38d(_0x69602d['error'][_0xcc9b('0x16')]);}else{logger[_0xcc9b('0xf')](_0xcc9b('0x10'),_0x4c9dfb,'request\x20sent');_0x28f38d(_0x69602d[_0xcc9b('0x17')][_0xcc9b('0x16')]);}})[_0xcc9b('0x18')](function(_0x323372){logger[_0xcc9b('0x14')](_0xcc9b('0x10'),_0x4c9dfb,_0x323372);_0x5406ba(_0x323372);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 908fc58..daa9afc 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 _0x3a10=['/:id','isAuthenticated','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','index','get'];(function(_0x437a0d,_0x5935a0){var _0x497b02=function(_0x448b15){while(--_0x448b15){_0x437a0d['push'](_0x437a0d['shift']());}};_0x497b02(++_0x5935a0);}(_0x3a10,0x6f));var _0x03a1=function(_0x475623,_0x501169){_0x475623=_0x475623-0x0;var _0x5bc67c=_0x3a10[_0x475623];return _0x5bc67c;};'use strict';var multer=require('multer');var util=require(_0x03a1('0x0'));var path=require(_0x03a1('0x1'));var timeout=require('connect-timeout');var express=require(_0x03a1('0x2'));var router=express[_0x03a1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x03a1('0x4'));var interaction=require(_0x03a1('0x5'));var config=require('../../config/environment');var controller=require(_0x03a1('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x03a1('0x7')]);router[_0x03a1('0x8')](_0x03a1('0x9'),auth[_0x03a1('0xa')](),controller['show']);router[_0x03a1('0x8')]('/:id/configurations',auth[_0x03a1('0xa')](),controller['getConfigurations']);router[_0x03a1('0x8')](_0x03a1('0xb'),auth['isAuthenticated'](),controller[_0x03a1('0xc')]);router[_0x03a1('0xd')]('/',auth['isAuthenticated'](),controller[_0x03a1('0xe')]);router[_0x03a1('0xd')](_0x03a1('0xf'),auth[_0x03a1('0xa')](),controller[_0x03a1('0x10')]);router['put'](_0x03a1('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x03a1('0x11')](_0x03a1('0x9'),auth[_0x03a1('0xa')](),controller[_0x03a1('0x12')]);module[_0x03a1('0x13')]=router; \ No newline at end of file +var _0x2a65=['getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','/:id/fields'];(function(_0x5db313,_0x3c8f0c){var _0x36d503=function(_0x5d1ff6){while(--_0x5d1ff6){_0x5db313['push'](_0x5db313['shift']());}};_0x36d503(++_0x3c8f0c);}(_0x2a65,0x135));var _0x52a6=function(_0x2eab1d,_0x54edd4){_0x2eab1d=_0x2eab1d-0x0;var _0x37cfed=_0x2a65[_0x2eab1d];return _0x37cfed;};'use strict';var multer=require(_0x52a6('0x0'));var util=require('util');var path=require(_0x52a6('0x1'));var timeout=require(_0x52a6('0x2'));var express=require('express');var router=express[_0x52a6('0x3')]();var fs_extra=require(_0x52a6('0x4'));var auth=require(_0x52a6('0x5'));var interaction=require(_0x52a6('0x6'));var config=require(_0x52a6('0x7'));var controller=require(_0x52a6('0x8'));router[_0x52a6('0x9')]('/',auth['isAuthenticated'](),controller[_0x52a6('0xa')]);router[_0x52a6('0x9')](_0x52a6('0xb'),auth['isAuthenticated'](),controller[_0x52a6('0xc')]);router[_0x52a6('0x9')](_0x52a6('0xd'),auth[_0x52a6('0xe')](),controller['getConfigurations']);router[_0x52a6('0x9')](_0x52a6('0xf'),auth[_0x52a6('0xe')](),controller[_0x52a6('0x10')]);router['post']('/',auth[_0x52a6('0xe')](),controller[_0x52a6('0x11')]);router[_0x52a6('0x12')](_0x52a6('0xd'),auth[_0x52a6('0xe')](),controller[_0x52a6('0x13')]);router[_0x52a6('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x52a6('0x15')]);router[_0x52a6('0x16')](_0x52a6('0xb'),auth['isAuthenticated'](),controller[_0x52a6('0x17')]);module[_0x52a6('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 79c0e21..e8e9250 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 _0x229c=['ENUM','password','integrationTab','exports','STRING','remoteUri'];(function(_0x52bd11,_0x1917c8){var _0xdbfd4a=function(_0x4c5644){while(--_0x4c5644){_0x52bd11['push'](_0x52bd11['shift']());}};_0xdbfd4a(++_0x1917c8);}(_0x229c,0xcf));var _0xc229=function(_0x445ce3,_0x41c002){_0x445ce3=_0x445ce3-0x0;var _0x1534ef=_0x229c[_0x445ce3];return _0x1534ef;};'use strict';var Sequelize=require('sequelize');module[_0xc229('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc229('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xc229('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xc229('0x2')},'authType':{'type':Sequelize[_0xc229('0x3')](_0xc229('0x4'),'token'),'defaultValue':_0xc229('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xc229('0x3')](_0xc229('0x5'),'newTab'),'defaultValue':_0xc229('0x5')}}; \ No newline at end of file +var _0xde81=['integrationTab','sequelize','exports','STRING','username','ENUM','password','token'];(function(_0xbc3542,_0x4de021){var _0x1c88ff=function(_0x1d1fb4){while(--_0x1d1fb4){_0xbc3542['push'](_0xbc3542['shift']());}};_0x1c88ff(++_0x4de021);}(_0xde81,0x109));var _0x1de8=function(_0x4b1f40,_0x5d2a33){_0x4b1f40=_0x4b1f40-0x0;var _0xf5cdcc=_0xde81[_0x4b1f40];return _0xf5cdcc;};'use strict';var Sequelize=require(_0x1de8('0x0'));module[_0x1de8('0x1')]={'name':{'type':Sequelize[_0x1de8('0x2')]},'description':{'type':Sequelize[_0x1de8('0x2')]},'username':{'type':Sequelize[_0x1de8('0x2')],'unique':_0x1de8('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1de8('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x1de8('0x4')](_0x1de8('0x5'),_0x1de8('0x6')),'defaultValue':_0x1de8('0x5')},'serverUrl':{'type':Sequelize[_0x1de8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1de8('0x4')](_0x1de8('0x7'),'newTab'),'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 02ef636..9011bff 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 _0xb62e=['custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','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','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','sendStatus','error','stack','name','send','map','ZendeskAccount','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','include','rows','catch','keys','rawAttributes','length','find','create','update','body','params','getConfigurations','findOne','ZendeskConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','includes','position','system_field_options'];(function(_0x53de82,_0x70794f){var _0x349649=function(_0x453f68){while(--_0x453f68){_0x53de82['push'](_0x53de82['shift']());}};_0x349649(++_0x70794f);}(_0xb62e,0x1de));var _0xeb62=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xb62e[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require(_0xeb62('0x0'));var rimraf=require(_0xeb62('0x1'));var zipdir=require(_0xeb62('0x2'));var jsonpatch=require(_0xeb62('0x3'));var rp=require('request-promise');var moment=require(_0xeb62('0x4'));var BPromise=require(_0xeb62('0x5'));var Mustache=require(_0xeb62('0x6'));var util=require(_0xeb62('0x7'));var path=require(_0xeb62('0x8'));var sox=require(_0xeb62('0x9'));var csv=require('to-csv');var ejs=require(_0xeb62('0xa'));var fs=require('fs');var fs_extra=require(_0xeb62('0xb'));var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x11'));var authService=require(_0xeb62('0x12'));var qs=require(_0xeb62('0x13'));var as=require(_0xeb62('0x14'));var hardwareService=require(_0xeb62('0x15'));var logger=require(_0xeb62('0x16'))(_0xeb62('0x17'));var utils=require(_0xeb62('0x18'));var config=require(_0xeb62('0x19'));var licenseUtil=require(_0xeb62('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xeb62('0x1b'));function respondWithStatusCode(_0xcc11c4,_0x27671e){_0x27671e=_0x27671e||0xcc;return function(_0x6822bc){if(_0x6822bc){return _0xcc11c4['sendStatus'](_0x27671e);}return _0xcc11c4[_0xeb62('0x1c')](_0x27671e)[_0xeb62('0x1d')]();};}function respondWithResult(_0x23fb15,_0x4da178){_0x4da178=_0x4da178||0xc8;return function(_0x26c3fd){if(_0x26c3fd){return _0x23fb15[_0xeb62('0x1c')](_0x4da178)[_0xeb62('0x1e')](_0x26c3fd);}};}function respondWithFilteredResult(_0x4ce9fa,_0x1f6a1f){return function(_0x15b3e8){if(_0x15b3e8){var _0x184106=typeof _0x1f6a1f[_0xeb62('0x1f')]===_0xeb62('0x20')&&typeof _0x1f6a1f[_0xeb62('0x21')]===_0xeb62('0x20');var _0x1324d7=_0x15b3e8[_0xeb62('0x22')];var _0x27fd84=_0x184106?0x0:_0x1f6a1f[_0xeb62('0x1f')];var _0x11d516=_0x184106?_0x15b3e8[_0xeb62('0x22')]:_0x1f6a1f['offset']+_0x1f6a1f[_0xeb62('0x21')];var _0x130e2f;if(_0x11d516>=_0x1324d7){_0x11d516=_0x1324d7;_0x130e2f=0xc8;}else{_0x130e2f=0xce;}_0x4ce9fa[_0xeb62('0x1c')](_0x130e2f);return _0x4ce9fa[_0xeb62('0x23')](_0xeb62('0x24'),_0x27fd84+'-'+_0x11d516+'/'+_0x1324d7)[_0xeb62('0x1e')](_0x15b3e8);}return null;};}function patchUpdates(_0x2ed96d){return function(_0x589bf2){try{jsonpatch['apply'](_0x589bf2,_0x2ed96d,!![]);}catch(_0x1fbfaa){return BPromise[_0xeb62('0x25')](_0x1fbfaa);}return _0x589bf2[_0xeb62('0x26')]();};}function saveUpdates(_0x13243f,_0x122b15){return function(_0x4cafcf){if(_0x4cafcf){return _0x4cafcf['update'](_0x13243f)[_0xeb62('0x27')](function(_0x132861){return _0x132861;});}return null;};}function removeEntity(_0x182781,_0x395b70){return function(_0x55a169){if(_0x55a169){return _0x55a169['destroy']()[_0xeb62('0x27')](function(){_0x182781['status'](0xcc)[_0xeb62('0x1d')]();});}};}function handleEntityNotFound(_0x4b0f46,_0xfe3e16){return function(_0x516a72){if(!_0x516a72){_0x4b0f46[_0xeb62('0x28')](0x194);}return _0x516a72;};}function handleError(_0x6bfbbc,_0x46d1bb){_0x46d1bb=_0x46d1bb||0x1f4;return function(_0x4e4268){logger[_0xeb62('0x29')](_0x4e4268[_0xeb62('0x2a')]);if(_0x4e4268[_0xeb62('0x2b')]){delete _0x4e4268[_0xeb62('0x2b')];}_0x6bfbbc[_0xeb62('0x1c')](_0x46d1bb)[_0xeb62('0x2c')](_0x4e4268);};}exports['index']=function(_0x192517,_0x1616ee){var _0x57169a={},_0x157474={},_0x2b51b2={'count':0x0,'rows':[]};var _0x2c967c=_[_0xeb62('0x2d')](db[_0xeb62('0x2e')]['rawAttributes'],function(_0x4b58af){return{'name':_0x4b58af[_0xeb62('0x2f')],'type':_0x4b58af[_0xeb62('0x30')][_0xeb62('0x31')]};});_0x157474[_0xeb62('0x32')]=_[_0xeb62('0x2d')](_0x2c967c,_0xeb62('0x2b'));_0x157474[_0xeb62('0x33')]=_['keys'](_0x192517[_0xeb62('0x33')]);_0x157474['filters']=_['intersection'](_0x157474[_0xeb62('0x32')],_0x157474[_0xeb62('0x33')]);_0x57169a['attributes']=_[_0xeb62('0x34')](_0x157474['model'],qs[_0xeb62('0x35')](_0x192517[_0xeb62('0x33')]['fields']));_0x57169a[_0xeb62('0x36')]=_0x57169a[_0xeb62('0x36')]['length']?_0x57169a[_0xeb62('0x36')]:_0x157474[_0xeb62('0x32')];if(!_0x192517[_0xeb62('0x33')][_0xeb62('0x37')]('nolimit')){_0x57169a[_0xeb62('0x21')]=qs[_0xeb62('0x21')](_0x192517['query']['limit']);_0x57169a[_0xeb62('0x1f')]=qs[_0xeb62('0x1f')](_0x192517['query'][_0xeb62('0x1f')]);}_0x57169a[_0xeb62('0x38')]=qs[_0xeb62('0x39')](_0x192517[_0xeb62('0x33')][_0xeb62('0x39')]);_0x57169a[_0xeb62('0x3a')]=qs[_0xeb62('0x3b')](_['pick'](_0x192517['query'],_0x157474[_0xeb62('0x3b')]),_0x2c967c);if(_0x192517[_0xeb62('0x33')][_0xeb62('0x3c')]){_0x57169a[_0xeb62('0x3a')]=_['merge'](_0x57169a[_0xeb62('0x3a')],{'$or':_['map'](_0x2c967c,function(_0x20fd7a){if(_0x20fd7a[_0xeb62('0x30')]!==_0xeb62('0x3d')){var _0x136c5a={};_0x136c5a[_0x20fd7a[_0xeb62('0x2b')]]={'$like':'%'+_0x192517[_0xeb62('0x33')][_0xeb62('0x3c')]+'%'};return _0x136c5a;}})});}_0x57169a=_[_0xeb62('0x3e')]({},_0x57169a,_0x192517['options']);var _0x38f91b={'where':_0x57169a[_0xeb62('0x3a')]};return db[_0xeb62('0x2e')][_0xeb62('0x22')](_0x38f91b)['then'](function(_0x4eda8b){_0x2b51b2[_0xeb62('0x22')]=_0x4eda8b;if(_0x192517[_0xeb62('0x33')]['includeAll']){_0x57169a[_0xeb62('0x3f')]=[{'all':!![]}];}return db[_0xeb62('0x2e')]['findAll'](_0x57169a);})[_0xeb62('0x27')](function(_0x478a54){_0x2b51b2[_0xeb62('0x40')]=_0x478a54;return _0x2b51b2;})['then'](respondWithFilteredResult(_0x1616ee,_0x57169a))[_0xeb62('0x41')](handleError(_0x1616ee,null));};exports['show']=function(_0x2bf77f,_0x609b2d){var _0x317f50={'raw':![],'where':{'id':_0x2bf77f['params']['id']}},_0x594274={};_0x594274[_0xeb62('0x32')]=_[_0xeb62('0x42')](db[_0xeb62('0x2e')][_0xeb62('0x43')]);_0x594274[_0xeb62('0x33')]=_['keys'](_0x2bf77f[_0xeb62('0x33')]);_0x594274['filters']=_[_0xeb62('0x34')](_0x594274['model'],_0x594274[_0xeb62('0x33')]);_0x317f50['attributes']=_[_0xeb62('0x34')](_0x594274['model'],qs[_0xeb62('0x35')](_0x2bf77f[_0xeb62('0x33')][_0xeb62('0x35')]));_0x317f50[_0xeb62('0x36')]=_0x317f50[_0xeb62('0x36')][_0xeb62('0x44')]?_0x317f50['attributes']:_0x594274[_0xeb62('0x32')];if(_0x2bf77f[_0xeb62('0x33')]['includeAll']){_0x317f50['include']=[{'all':!![]}];}_0x317f50=_['merge']({},_0x317f50,_0x2bf77f['options']);return db[_0xeb62('0x2e')][_0xeb62('0x45')](_0x317f50)['then'](handleEntityNotFound(_0x609b2d,null))[_0xeb62('0x27')](respondWithResult(_0x609b2d,null))[_0xeb62('0x41')](handleError(_0x609b2d,null));};exports[_0xeb62('0x46')]=function(_0x16e262,_0x39595c){return db['ZendeskAccount'][_0xeb62('0x46')](_0x16e262['body'],{})[_0xeb62('0x27')](respondWithResult(_0x39595c,0xc9))[_0xeb62('0x41')](handleError(_0x39595c,null));};exports[_0xeb62('0x47')]=function(_0x18c40d,_0x1f2d87){if(_0x18c40d[_0xeb62('0x48')]['id']){delete _0x18c40d[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2e')][_0xeb62('0x45')]({'where':{'id':_0x18c40d[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0x1f2d87,null))[_0xeb62('0x27')](saveUpdates(_0x18c40d['body'],null))[_0xeb62('0x27')](respondWithResult(_0x1f2d87,null))['catch'](handleError(_0x1f2d87,null));};exports['destroy']=function(_0x2dcb2d,_0x31fd4a){return db['ZendeskAccount'][_0xeb62('0x45')]({'where':{'id':_0x2dcb2d[_0xeb62('0x49')]['id']}})['then'](handleEntityNotFound(_0x31fd4a,null))[_0xeb62('0x27')](removeEntity(_0x31fd4a,null))[_0xeb62('0x41')](handleError(_0x31fd4a,null));};exports[_0xeb62('0x4a')]=function(_0x60617,_0xe71e83,_0x1e6238){var _0x351027={};var _0x190e65={};var _0x497714;var _0x3e2be9;return db['ZendeskAccount'][_0xeb62('0x4b')]({'where':{'id':_0x60617[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0xe71e83,null))[_0xeb62('0x27')](function(_0x35d92d){if(_0x35d92d){_0x497714=_0x35d92d;_0x190e65[_0xeb62('0x32')]=_[_0xeb62('0x42')](db[_0xeb62('0x4c')]['rawAttributes']);_0x190e65['query']=_['keys'](_0x60617['query']);_0x190e65[_0xeb62('0x3b')]=_['intersection'](_0x190e65[_0xeb62('0x32')],_0x190e65['query']);_0x351027[_0xeb62('0x36')]=_[_0xeb62('0x34')](_0x190e65[_0xeb62('0x32')],qs['fields'](_0x60617[_0xeb62('0x33')][_0xeb62('0x35')]));_0x351027['attributes']=_0x351027[_0xeb62('0x36')][_0xeb62('0x44')]?_0x351027[_0xeb62('0x36')]:_0x190e65[_0xeb62('0x32')];_0x351027['order']=qs[_0xeb62('0x39')](_0x60617[_0xeb62('0x33')]['sort']);_0x351027[_0xeb62('0x3a')]=qs[_0xeb62('0x3b')](_[_0xeb62('0x4d')](_0x60617[_0xeb62('0x33')],_0x190e65[_0xeb62('0x3b')]));if(_0x60617[_0xeb62('0x33')][_0xeb62('0x3c')]){_0x351027[_0xeb62('0x3a')]=_[_0xeb62('0x3e')](_0x351027[_0xeb62('0x3a')],{'$or':_[_0xeb62('0x2d')](_0x351027[_0xeb62('0x36')],function(_0x200b43){var _0x3ae984={};_0x3ae984[_0x200b43]={'$like':'%'+_0x60617[_0xeb62('0x33')][_0xeb62('0x3c')]+'%'};return _0x3ae984;})});}_0x351027=_['merge']({},_0x351027,_0x60617['options']);return _0x497714['getConfigurations'](_0x351027);}})['then'](function(_0x279b83){if(_0x279b83){_0x3e2be9=_0x279b83['length'];if(!_0x60617[_0xeb62('0x33')][_0xeb62('0x37')](_0xeb62('0x4e'))){_0x351027[_0xeb62('0x21')]=qs[_0xeb62('0x21')](_0x60617[_0xeb62('0x33')][_0xeb62('0x21')]);_0x351027[_0xeb62('0x1f')]=qs[_0xeb62('0x1f')](_0x60617[_0xeb62('0x33')]['offset']);}return _0x497714[_0xeb62('0x4a')](_0x351027);}})[_0xeb62('0x27')](function(_0x42e992){if(_0x42e992){return _0x42e992?{'count':_0x3e2be9,'rows':_0x42e992}:null;}})[_0xeb62('0x27')](respondWithResult(_0xe71e83,null))['catch'](handleError(_0xe71e83,null));};exports[_0xeb62('0x4f')]=function(_0x2e5456,_0x3ff00a,_0x2abd21){if(_0x2e5456[_0xeb62('0x48')]['id']){delete _0x2e5456[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2e')][_0xeb62('0x4b')]({'where':{'id':_0x2e5456[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0x3ff00a,null))[_0xeb62('0x27')](function(_0x510275){if(_0x510275){_0x2e5456[_0xeb62('0x48')][_0xeb62('0x50')]=_0x510275['id'];_0x2e5456[_0xeb62('0x48')][_0xeb62('0x51')]=integrations[_0xeb62('0x52')](_0x2e5456[_0xeb62('0x48')][_0xeb62('0x53')],_0x2e5456[_0xeb62('0x48')][_0xeb62('0x30')]);_0x2e5456[_0xeb62('0x48')]['Descriptions']=integrations[_0xeb62('0x54')](_0x2e5456[_0xeb62('0x48')][_0xeb62('0x53')],_0x2e5456[_0xeb62('0x48')]['type']);return db[_0xeb62('0x4c')][_0xeb62('0x46')](_0x2e5456[_0xeb62('0x48')],{'include':[{'model':db[_0xeb62('0x55')],'as':_0xeb62('0x51')},{'model':db[_0xeb62('0x55')],'as':'Descriptions'}]});}return null;})[_0xeb62('0x27')](respondWithResult(_0x3ff00a,null))[_0xeb62('0x41')](handleError(_0x3ff00a,null));};exports[_0xeb62('0x56')]=function(_0x173c07,_0x351acf,_0x28d0ff){var _0x2e4502='';return db[_0xeb62('0x2e')][_0xeb62('0x4b')]({'where':{'id':_0x173c07[_0xeb62('0x49')]['id']},'attributes':['id',_0xeb62('0x57'),_0xeb62('0x58'),_0xeb62('0x59'),_0xeb62('0x5a'),_0xeb62('0x5b')]})[_0xeb62('0x27')](handleEntityNotFound(_0x351acf,null))['then'](function(_0x3b3eb1){if(_0x3b3eb1){_0x2e4502=_0x3b3eb1['remoteUri'];var _0x6ea297=_0x2e4502[_0xeb62('0x5c')](-0x1);if(_0x6ea297==='/'){_0x2e4502=_0x2e4502['substring'](0x0,_0x2e4502[_0xeb62('0x5d')](_0x6ea297));}var _0x10986a={'method':_0xeb62('0x5e'),'uri':util[_0xeb62('0x5f')](_0xeb62('0x60'),_0x2e4502,_0xeb62('0x61')),'json':!![]};switch(_0x3b3eb1[_0xeb62('0x5a')]){case _0xeb62('0x58'):_0x10986a[_0xeb62('0x62')]={'Authorization':util[_0xeb62('0x5f')](_0xeb62('0x63'),new Buffer(util[_0xeb62('0x5f')](_0xeb62('0x64'),_0x3b3eb1['username'],_0x3b3eb1[_0xeb62('0x58')]))[_0xeb62('0x65')]('base64'))};break;case _0xeb62('0x59'):_0x10986a['headers']={'Authorization':util[_0xeb62('0x5f')](_0xeb62('0x63'),new Buffer(util[_0xeb62('0x5f')](_0xeb62('0x66'),_0x3b3eb1[_0xeb62('0x57')],_0x3b3eb1[_0xeb62('0x59')]))['toString'](_0xeb62('0x67')))};break;default:throw new db['Sequelize'][(_0xeb62('0x68'))](_0xeb62('0x69'));}return rp(_0x10986a);}})[_0xeb62('0x27')](function(_0x489410){if(_0x489410){var _0x1dcd96=['subject',_0xeb62('0x6a'),_0xeb62('0x6b'),_0xeb62('0x6c')];_['remove'](_0x489410[_0xeb62('0x61')],function(_0x3ad496){return _0x1dcd96[_0xeb62('0x6d')](_0x3ad496[_0xeb62('0x30')]);});return{'count':_0x489410[_0xeb62('0x61')][_0xeb62('0x44')],'rows':_['map'](_0x489410['ticket_fields'],function(_0x4c7a56){return{'id':_0x4c7a56['id'],'name':_0x4c7a56['position']>0x7?_0x4c7a56['title']:_0x4c7a56[_0xeb62('0x30')],'custom':_0x4c7a56[_0xeb62('0x6e')]>0x7?!![]:![],'options':_0x4c7a56[_0xeb62('0x6f')]?_0x4c7a56[_0xeb62('0x6f')]:_0x4c7a56[_0xeb62('0x70')]?_0x4c7a56[_0xeb62('0x70')]:[]};})};}})[_0xeb62('0x27')](respondWithResult(_0x351acf,null))[_0xeb62('0x41')](function(_0xb28adb){var _0x2c6bb3=_0x173c07[_0xeb62('0x33')][_0xeb62('0x71')]?0x1f4:_0xb28adb['statusCode']||0x1f4;logger[_0xeb62('0x29')](_0xeb62('0x72'),_0xeb62('0x56'),_0x2c6bb3,JSON[_0xeb62('0x73')](_0xb28adb));delete _0xb28adb[_0xeb62('0x2b')];if(_0x2c6bb3===0x191){_0x2c6bb3=0x190;}_0x351acf[_0xeb62('0x1c')](_0x2c6bb3)[_0xeb62('0x2c')](_0x173c07[_0xeb62('0x33')][_0xeb62('0x71')]?{'message':_0xeb62('0x74'),'statusCode':_0xb28adb[_0xeb62('0x75')]}:_0xb28adb);});}; \ No newline at end of file +var _0x3de3=['token','%s/token:%s','base64','ValidationError','subject','description','assignee','includes','position','title','system_field_options','statusCode','stringify','test','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','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','../../components/integrations/configuration','end','json','offset','undefined','status','set','Content-Range','reject','update','destroy','then','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','create','body','find','params','getConfigurations','ZendeskConfiguration','hasOwnProperty','addConfiguration','AccountId','Descriptions','channel','ZendeskField','Subjects','getFields','findOne','username','password','remoteUri','slice','substring','lastIndexOf','format','%s/%s','ticket_fields','authType','headers','%s:%s','toString'];(function(_0x2d2a33,_0x2d1d1f){var _0x32d8ba=function(_0x566914){while(--_0x566914){_0x2d2a33['push'](_0x2d2a33['shift']());}};_0x32d8ba(++_0x2d1d1f);}(_0x3de3,0x1ce));var _0x33de=function(_0x1fe407,_0x52c3b9){_0x1fe407=_0x1fe407-0x0;var _0xd4f1cd=_0x3de3[_0x1fe407];return _0xd4f1cd;};'use strict';var emlformat=require(_0x33de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x33de('0x1'));var jsonpatch=require(_0x33de('0x2'));var rp=require('request-promise');var moment=require(_0x33de('0x3'));var BPromise=require(_0x33de('0x4'));var Mustache=require(_0x33de('0x5'));var util=require(_0x33de('0x6'));var path=require('path');var sox=require(_0x33de('0x7'));var csv=require(_0x33de('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x33de('0x9'));var _=require('lodash');var squel=require(_0x33de('0xa'));var crypto=require(_0x33de('0xb'));var jsforce=require(_0x33de('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x33de('0x8'));var querystring=require(_0x33de('0xd'));var Papa=require(_0x33de('0xe'));var Redis=require('ioredis');var authService=require(_0x33de('0xf'));var qs=require(_0x33de('0x10'));var as=require(_0x33de('0x11'));var hardwareService=require(_0x33de('0x12'));var logger=require(_0x33de('0x13'))(_0x33de('0x14'));var utils=require(_0x33de('0x15'));var config=require(_0x33de('0x16'));var licenseUtil=require(_0x33de('0x17'));var db=require(_0x33de('0x18'))['db'];var integrations=require(_0x33de('0x19'));function respondWithStatusCode(_0x5170ad,_0x6b1a4c){_0x6b1a4c=_0x6b1a4c||0xcc;return function(_0x25d069){if(_0x25d069){return _0x5170ad['sendStatus'](_0x6b1a4c);}return _0x5170ad['status'](_0x6b1a4c)[_0x33de('0x1a')]();};}function respondWithResult(_0x22bda8,_0x2b3748){_0x2b3748=_0x2b3748||0xc8;return function(_0x57a2a1){if(_0x57a2a1){return _0x22bda8['status'](_0x2b3748)[_0x33de('0x1b')](_0x57a2a1);}};}function respondWithFilteredResult(_0x1b1166,_0x522ba0){return function(_0x4ff69f){if(_0x4ff69f){var _0x185849=typeof _0x522ba0[_0x33de('0x1c')]===_0x33de('0x1d')&&typeof _0x522ba0['limit']===_0x33de('0x1d');var _0x1203cf=_0x4ff69f['count'];var _0x2815a7=_0x185849?0x0:_0x522ba0[_0x33de('0x1c')];var _0x482667=_0x185849?_0x4ff69f['count']:_0x522ba0[_0x33de('0x1c')]+_0x522ba0['limit'];var _0x16255f;if(_0x482667>=_0x1203cf){_0x482667=_0x1203cf;_0x16255f=0xc8;}else{_0x16255f=0xce;}_0x1b1166[_0x33de('0x1e')](_0x16255f);return _0x1b1166[_0x33de('0x1f')](_0x33de('0x20'),_0x2815a7+'-'+_0x482667+'/'+_0x1203cf)[_0x33de('0x1b')](_0x4ff69f);}return null;};}function patchUpdates(_0x40a8e6){return function(_0x6cdc4f){try{jsonpatch['apply'](_0x6cdc4f,_0x40a8e6,!![]);}catch(_0x571086){return BPromise[_0x33de('0x21')](_0x571086);}return _0x6cdc4f['save']();};}function saveUpdates(_0x8acd8d,_0x4cd8db){return function(_0x28ed17){if(_0x28ed17){return _0x28ed17[_0x33de('0x22')](_0x8acd8d)['then'](function(_0x2dbcf2){return _0x2dbcf2;});}return null;};}function removeEntity(_0x5cd77e,_0x67d040){return function(_0x5c602d){if(_0x5c602d){return _0x5c602d[_0x33de('0x23')]()[_0x33de('0x24')](function(){_0x5cd77e[_0x33de('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bdba4,_0x2d206b){return function(_0x140979){if(!_0x140979){_0x3bdba4['sendStatus'](0x194);}return _0x140979;};}function handleError(_0x34fba3,_0x5585a2){_0x5585a2=_0x5585a2||0x1f4;return function(_0x566373){logger[_0x33de('0x25')](_0x566373[_0x33de('0x26')]);if(_0x566373[_0x33de('0x27')]){delete _0x566373[_0x33de('0x27')];}_0x34fba3[_0x33de('0x1e')](_0x5585a2)[_0x33de('0x28')](_0x566373);};}exports[_0x33de('0x29')]=function(_0x1b4703,_0x59bc3b){var _0x5ae0e8={},_0x2755e6={},_0x1420d2={'count':0x0,'rows':[]};var _0xaeaec5=_[_0x33de('0x2a')](db[_0x33de('0x2b')][_0x33de('0x2c')],function(_0x427e82){return{'name':_0x427e82['fieldName'],'type':_0x427e82[_0x33de('0x2d')][_0x33de('0x2e')]};});_0x2755e6[_0x33de('0x2f')]=_[_0x33de('0x2a')](_0xaeaec5,'name');_0x2755e6[_0x33de('0x30')]=_[_0x33de('0x31')](_0x1b4703['query']);_0x2755e6['filters']=_['intersection'](_0x2755e6[_0x33de('0x2f')],_0x2755e6[_0x33de('0x30')]);_0x5ae0e8['attributes']=_[_0x33de('0x32')](_0x2755e6['model'],qs['fields'](_0x1b4703[_0x33de('0x30')][_0x33de('0x33')]));_0x5ae0e8[_0x33de('0x34')]=_0x5ae0e8[_0x33de('0x34')][_0x33de('0x35')]?_0x5ae0e8[_0x33de('0x34')]:_0x2755e6[_0x33de('0x2f')];if(!_0x1b4703[_0x33de('0x30')]['hasOwnProperty'](_0x33de('0x36'))){_0x5ae0e8['limit']=qs[_0x33de('0x37')](_0x1b4703['query']['limit']);_0x5ae0e8[_0x33de('0x1c')]=qs[_0x33de('0x1c')](_0x1b4703[_0x33de('0x30')][_0x33de('0x1c')]);}_0x5ae0e8[_0x33de('0x38')]=qs[_0x33de('0x39')](_0x1b4703['query'][_0x33de('0x39')]);_0x5ae0e8[_0x33de('0x3a')]=qs[_0x33de('0x3b')](_[_0x33de('0x3c')](_0x1b4703[_0x33de('0x30')],_0x2755e6[_0x33de('0x3b')]),_0xaeaec5);if(_0x1b4703[_0x33de('0x30')]['filter']){_0x5ae0e8[_0x33de('0x3a')]=_[_0x33de('0x3d')](_0x5ae0e8[_0x33de('0x3a')],{'$or':_[_0x33de('0x2a')](_0xaeaec5,function(_0x46ddfe){if(_0x46ddfe[_0x33de('0x2d')]!==_0x33de('0x3e')){var _0x511691={};_0x511691[_0x46ddfe[_0x33de('0x27')]]={'$like':'%'+_0x1b4703[_0x33de('0x30')][_0x33de('0x3f')]+'%'};return _0x511691;}})});}_0x5ae0e8=_[_0x33de('0x3d')]({},_0x5ae0e8,_0x1b4703[_0x33de('0x40')]);var _0x640136={'where':_0x5ae0e8['where']};return db[_0x33de('0x2b')]['count'](_0x640136)[_0x33de('0x24')](function(_0x66897c){_0x1420d2['count']=_0x66897c;if(_0x1b4703[_0x33de('0x30')][_0x33de('0x41')]){_0x5ae0e8[_0x33de('0x42')]=[{'all':!![]}];}return db[_0x33de('0x2b')][_0x33de('0x43')](_0x5ae0e8);})[_0x33de('0x24')](function(_0x22518d){_0x1420d2[_0x33de('0x44')]=_0x22518d;return _0x1420d2;})[_0x33de('0x24')](respondWithFilteredResult(_0x59bc3b,_0x5ae0e8))['catch'](handleError(_0x59bc3b,null));};exports['show']=function(_0x417d9b,_0x1f75f7){var _0x20d04f={'raw':![],'where':{'id':_0x417d9b['params']['id']}},_0x376c55={};_0x376c55[_0x33de('0x2f')]=_['keys'](db['ZendeskAccount'][_0x33de('0x2c')]);_0x376c55[_0x33de('0x30')]=_[_0x33de('0x31')](_0x417d9b[_0x33de('0x30')]);_0x376c55[_0x33de('0x3b')]=_[_0x33de('0x32')](_0x376c55[_0x33de('0x2f')],_0x376c55['query']);_0x20d04f[_0x33de('0x34')]=_['intersection'](_0x376c55[_0x33de('0x2f')],qs['fields'](_0x417d9b[_0x33de('0x30')][_0x33de('0x33')]));_0x20d04f['attributes']=_0x20d04f[_0x33de('0x34')][_0x33de('0x35')]?_0x20d04f[_0x33de('0x34')]:_0x376c55['model'];if(_0x417d9b['query'][_0x33de('0x41')]){_0x20d04f[_0x33de('0x42')]=[{'all':!![]}];}_0x20d04f=_['merge']({},_0x20d04f,_0x417d9b['options']);return db[_0x33de('0x2b')]['find'](_0x20d04f)['then'](handleEntityNotFound(_0x1f75f7,null))['then'](respondWithResult(_0x1f75f7,null))[_0x33de('0x45')](handleError(_0x1f75f7,null));};exports[_0x33de('0x46')]=function(_0x9a816c,_0xce6079){return db['ZendeskAccount']['create'](_0x9a816c[_0x33de('0x47')],{})[_0x33de('0x24')](respondWithResult(_0xce6079,0xc9))['catch'](handleError(_0xce6079,null));};exports[_0x33de('0x22')]=function(_0xc23633,_0x23a5e7){if(_0xc23633[_0x33de('0x47')]['id']){delete _0xc23633[_0x33de('0x47')]['id'];}return db['ZendeskAccount'][_0x33de('0x48')]({'where':{'id':_0xc23633[_0x33de('0x49')]['id']}})['then'](handleEntityNotFound(_0x23a5e7,null))[_0x33de('0x24')](saveUpdates(_0xc23633[_0x33de('0x47')],null))[_0x33de('0x24')](respondWithResult(_0x23a5e7,null))[_0x33de('0x45')](handleError(_0x23a5e7,null));};exports[_0x33de('0x23')]=function(_0x40f1b7,_0x3d6424){return db[_0x33de('0x2b')][_0x33de('0x48')]({'where':{'id':_0x40f1b7[_0x33de('0x49')]['id']}})['then'](handleEntityNotFound(_0x3d6424,null))[_0x33de('0x24')](removeEntity(_0x3d6424,null))[_0x33de('0x45')](handleError(_0x3d6424,null));};exports[_0x33de('0x4a')]=function(_0x464502,_0xe6d59,_0x3fe65d){var _0x5c91e7={};var _0x49e1d9={};var _0x109ec5;var _0x32042e;return db[_0x33de('0x2b')]['findOne']({'where':{'id':_0x464502[_0x33de('0x49')]['id']}})[_0x33de('0x24')](handleEntityNotFound(_0xe6d59,null))[_0x33de('0x24')](function(_0x303f72){if(_0x303f72){_0x109ec5=_0x303f72;_0x49e1d9['model']=_['keys'](db[_0x33de('0x4b')][_0x33de('0x2c')]);_0x49e1d9[_0x33de('0x30')]=_[_0x33de('0x31')](_0x464502[_0x33de('0x30')]);_0x49e1d9['filters']=_['intersection'](_0x49e1d9[_0x33de('0x2f')],_0x49e1d9[_0x33de('0x30')]);_0x5c91e7[_0x33de('0x34')]=_[_0x33de('0x32')](_0x49e1d9[_0x33de('0x2f')],qs[_0x33de('0x33')](_0x464502[_0x33de('0x30')][_0x33de('0x33')]));_0x5c91e7[_0x33de('0x34')]=_0x5c91e7['attributes'][_0x33de('0x35')]?_0x5c91e7[_0x33de('0x34')]:_0x49e1d9[_0x33de('0x2f')];_0x5c91e7['order']=qs[_0x33de('0x39')](_0x464502['query']['sort']);_0x5c91e7['where']=qs['filters'](_[_0x33de('0x3c')](_0x464502[_0x33de('0x30')],_0x49e1d9['filters']));if(_0x464502[_0x33de('0x30')][_0x33de('0x3f')]){_0x5c91e7['where']=_[_0x33de('0x3d')](_0x5c91e7[_0x33de('0x3a')],{'$or':_['map'](_0x5c91e7[_0x33de('0x34')],function(_0x2bd687){var _0x277bb7={};_0x277bb7[_0x2bd687]={'$like':'%'+_0x464502[_0x33de('0x30')][_0x33de('0x3f')]+'%'};return _0x277bb7;})});}_0x5c91e7=_[_0x33de('0x3d')]({},_0x5c91e7,_0x464502[_0x33de('0x40')]);return _0x109ec5['getConfigurations'](_0x5c91e7);}})['then'](function(_0x409e2e){if(_0x409e2e){_0x32042e=_0x409e2e['length'];if(!_0x464502[_0x33de('0x30')][_0x33de('0x4c')]('nolimit')){_0x5c91e7[_0x33de('0x37')]=qs['limit'](_0x464502[_0x33de('0x30')][_0x33de('0x37')]);_0x5c91e7['offset']=qs['offset'](_0x464502[_0x33de('0x30')][_0x33de('0x1c')]);}return _0x109ec5[_0x33de('0x4a')](_0x5c91e7);}})[_0x33de('0x24')](function(_0x24d936){if(_0x24d936){return _0x24d936?{'count':_0x32042e,'rows':_0x24d936}:null;}})['then'](respondWithResult(_0xe6d59,null))[_0x33de('0x45')](handleError(_0xe6d59,null));};exports[_0x33de('0x4d')]=function(_0x5d4ffd,_0xa10291,_0x375bda){if(_0x5d4ffd['body']['id']){delete _0x5d4ffd[_0x33de('0x47')]['id'];}return db[_0x33de('0x2b')]['findOne']({'where':{'id':_0x5d4ffd['params']['id']}})[_0x33de('0x24')](handleEntityNotFound(_0xa10291,null))['then'](function(_0x31a511){if(_0x31a511){_0x5d4ffd['body'][_0x33de('0x4e')]=_0x31a511['id'];_0x5d4ffd['body']['Subjects']=integrations['getSubjects'](_0x5d4ffd['body']['channel'],_0x5d4ffd['body'][_0x33de('0x2d')]);_0x5d4ffd['body'][_0x33de('0x4f')]=integrations['getDescriptions'](_0x5d4ffd['body'][_0x33de('0x50')],_0x5d4ffd[_0x33de('0x47')][_0x33de('0x2d')]);return db[_0x33de('0x4b')][_0x33de('0x46')](_0x5d4ffd[_0x33de('0x47')],{'include':[{'model':db[_0x33de('0x51')],'as':_0x33de('0x52')},{'model':db['ZendeskField'],'as':_0x33de('0x4f')}]});}return null;})['then'](respondWithResult(_0xa10291,null))[_0x33de('0x45')](handleError(_0xa10291,null));};exports[_0x33de('0x53')]=function(_0x2cbf20,_0x3a8d6b,_0x8a9729){var _0x3f5d52='';return db[_0x33de('0x2b')][_0x33de('0x54')]({'where':{'id':_0x2cbf20[_0x33de('0x49')]['id']},'attributes':['id',_0x33de('0x55'),_0x33de('0x56'),'token','authType',_0x33de('0x57')]})[_0x33de('0x24')](handleEntityNotFound(_0x3a8d6b,null))[_0x33de('0x24')](function(_0xbf482f){if(_0xbf482f){_0x3f5d52=_0xbf482f[_0x33de('0x57')];var _0x21a3ec=_0x3f5d52[_0x33de('0x58')](-0x1);if(_0x21a3ec==='/'){_0x3f5d52=_0x3f5d52[_0x33de('0x59')](0x0,_0x3f5d52[_0x33de('0x5a')](_0x21a3ec));}var _0x39e8c9={'method':'GET','uri':util[_0x33de('0x5b')](_0x33de('0x5c'),_0x3f5d52,_0x33de('0x5d')),'json':!![]};switch(_0xbf482f[_0x33de('0x5e')]){case _0x33de('0x56'):_0x39e8c9[_0x33de('0x5f')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x33de('0x60'),_0xbf482f[_0x33de('0x55')],_0xbf482f[_0x33de('0x56')]))[_0x33de('0x61')]('base64'))};break;case _0x33de('0x62'):_0x39e8c9[_0x33de('0x5f')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x33de('0x63'),_0xbf482f[_0x33de('0x55')],_0xbf482f[_0x33de('0x62')]))[_0x33de('0x61')](_0x33de('0x64')))};break;default:throw new db['Sequelize'][(_0x33de('0x65'))]('Unknown\x20authentication\x20type');}return rp(_0x39e8c9);}})[_0x33de('0x24')](function(_0x20e8ce){if(_0x20e8ce){var _0x50587b=[_0x33de('0x66'),_0x33de('0x67'),'group',_0x33de('0x68')];_['remove'](_0x20e8ce['ticket_fields'],function(_0x2b6729){return _0x50587b[_0x33de('0x69')](_0x2b6729[_0x33de('0x2d')]);});return{'count':_0x20e8ce[_0x33de('0x5d')][_0x33de('0x35')],'rows':_['map'](_0x20e8ce[_0x33de('0x5d')],function(_0x3bda5e){return{'id':_0x3bda5e['id'],'name':_0x3bda5e[_0x33de('0x6a')]>0x7?_0x3bda5e[_0x33de('0x6b')]:_0x3bda5e['type'],'custom':_0x3bda5e[_0x33de('0x6a')]>0x7?!![]:![],'options':_0x3bda5e[_0x33de('0x6c')]?_0x3bda5e[_0x33de('0x6c')]:_0x3bda5e['custom_field_options']?_0x3bda5e['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x3a8d6b,null))['catch'](function(_0x5769f7){var _0x1f0e87=_0x2cbf20[_0x33de('0x30')]['test']?0x1f4:_0x5769f7[_0x33de('0x6d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x33de('0x53'),_0x1f0e87,JSON[_0x33de('0x6e')](_0x5769f7));delete _0x5769f7['name'];if(_0x1f0e87===0x191){_0x1f0e87=0x190;}_0x3a8d6b[_0x33de('0x1e')](_0x1f0e87)[_0x33de('0x28')](_0x2cbf20['query'][_0x33de('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x5769f7[_0x33de('0x6d')]}:_0x5769f7);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 5b09702..90f9cdf 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 _0x2c8f=['path','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','util','bluebird','request-promise'];(function(_0x3ab319,_0x13a083){var _0x148a79=function(_0x1ff17c){while(--_0x1ff17c){_0x3ab319['push'](_0x3ab319['shift']());}};_0x148a79(++_0x13a083);}(_0x2c8f,0x192));var _0xf2c8=function(_0x1a6f82,_0x330c84){_0x1a6f82=_0x1a6f82-0x0;var _0x4bb74d=_0x2c8f[_0x1a6f82];return _0x4bb74d;};'use strict';var _=require('lodash');var util=require(_0xf2c8('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf2c8('0x1'));var rp=require(_0xf2c8('0x2'));var fs=require('fs');var path=require(_0xf2c8('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf2c8('0x4'));var integrations=require(_0xf2c8('0x5'));module[_0xf2c8('0x6')]=function(_0x3ad7a0,_0x2785ee){return _0x3ad7a0['define'](_0xf2c8('0x7'),attributes,{'tableName':_0xf2c8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbeb=['../../config/environment','./intZendeskAccount.attributes','exports','define','ZendeskAccount','int_zendesk_accounts','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4e58b5,_0x2dc5fe){var _0x2debe9=function(_0x5272ae){while(--_0x5272ae){_0x4e58b5['push'](_0x4e58b5['shift']());}};_0x2debe9(++_0x2dc5fe);}(_0xfbeb,0x1aa));var _0xbfbe=function(_0x1ad659,_0x1ab26a){_0x1ad659=_0x1ad659-0x0;var _0x56d7e2=_0xfbeb[_0x1ad659];return _0x56d7e2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbfbe('0x0'))(_0xbfbe('0x1'));var moment=require('moment');var BPromise=require(_0xbfbe('0x2'));var rp=require(_0xbfbe('0x3'));var fs=require('fs');var path=require(_0xbfbe('0x4'));var rimraf=require(_0xbfbe('0x5'));var config=require(_0xbfbe('0x6'));var attributes=require(_0xbfbe('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xbfbe('0x8')]=function(_0x18c7d3,_0x36d9bf){return _0x18c7d3[_0xbfbe('0x9')](_0xbfbe('0xa'),attributes,{'tableName':_0xbfbe('0xb'),'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 f8451f2..0fd8cd9 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 _0x8e77=['message','result','catch','GetZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowZendeskAccount','ZendeskAccount','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2a5c99,_0x40ed55){var _0x4f7b91=function(_0x3d1036){while(--_0x3d1036){_0x2a5c99['push'](_0x2a5c99['shift']());}};_0x4f7b91(++_0x40ed55);}(_0x8e77,0x1f2));var _0x78e7=function(_0x17a754,_0x5f1052){_0x17a754=_0x17a754-0x0;var _0x545d3e=_0x8e77[_0x17a754];return _0x545d3e;};'use strict';var _=require(_0x78e7('0x0'));var util=require(_0x78e7('0x1'));var moment=require(_0x78e7('0x2'));var BPromise=require('bluebird');var rs=require(_0x78e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78e7('0x4'))['db'];var utils=require(_0x78e7('0x5'));var logger=require(_0x78e7('0x6'))(_0x78e7('0x7'));var config=require(_0x78e7('0x8'));var jayson=require(_0x78e7('0x9'));var client=jayson[_0x78e7('0xa')][_0x78e7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1dcbed,_0x1d7c6d,_0x33b7b9){return new BPromise(function(_0x19e03f,_0x402439){return client[_0x78e7('0xc')](_0x1dcbed,_0x33b7b9)[_0x78e7('0xd')](function(_0x500db6){logger[_0x78e7('0xe')](_0x78e7('0xf'),_0x1d7c6d,_0x78e7('0x10'));logger['debug'](_0x78e7('0x11'),_0x1d7c6d,_0x78e7('0x10'),JSON[_0x78e7('0x12')](_0x500db6));if(_0x500db6[_0x78e7('0x13')]){if(_0x500db6['error']['code']===0x1f4){logger['error'](_0x78e7('0xf'),_0x1d7c6d,_0x500db6[_0x78e7('0x13')][_0x78e7('0x14')]);return _0x402439(_0x500db6[_0x78e7('0x13')][_0x78e7('0x14')]);}logger[_0x78e7('0x13')](_0x78e7('0xf'),_0x1d7c6d,_0x500db6[_0x78e7('0x13')][_0x78e7('0x14')]);return _0x19e03f(_0x500db6[_0x78e7('0x13')][_0x78e7('0x14')]);}else{logger[_0x78e7('0xe')](_0x78e7('0xf'),_0x1d7c6d,_0x78e7('0x10'));_0x19e03f(_0x500db6[_0x78e7('0x15')][_0x78e7('0x14')]);}})[_0x78e7('0x16')](function(_0x149c74){logger['error'](_0x78e7('0xf'),_0x1d7c6d,_0x149c74);_0x402439(_0x149c74);});});}exports[_0x78e7('0x17')]=function(_0x380ee5){var _0x16ccb7=this;return new Promise(function(_0x3a89a7,_0x1356ef){return db['ZendeskAccount'][_0x78e7('0x18')]({'raw':_0x380ee5[_0x78e7('0x19')]?_0x380ee5[_0x78e7('0x19')][_0x78e7('0x1a')]===undefined?!![]:![]:!![],'where':_0x380ee5[_0x78e7('0x19')]?_0x380ee5[_0x78e7('0x19')][_0x78e7('0x1b')]||null:null,'attributes':_0x380ee5['options']?_0x380ee5[_0x78e7('0x19')][_0x78e7('0x1c')]||null:null,'limit':_0x380ee5[_0x78e7('0x19')]?_0x380ee5[_0x78e7('0x19')][_0x78e7('0x1d')]||null:null,'include':_0x380ee5[_0x78e7('0x19')]?_0x380ee5['options'][_0x78e7('0x1e')]?_[_0x78e7('0x1f')](_0x380ee5[_0x78e7('0x19')][_0x78e7('0x1e')],function(_0x174dfc){return{'model':db[_0x174dfc[_0x78e7('0x20')]],'as':_0x174dfc['as'],'attributes':_0x174dfc['attributes'],'include':_0x174dfc[_0x78e7('0x1e')]?_[_0x78e7('0x1f')](_0x174dfc[_0x78e7('0x1e')],function(_0x59140b){return{'model':db[_0x59140b[_0x78e7('0x20')]],'as':_0x59140b['as'],'attributes':_0x59140b[_0x78e7('0x1c')],'include':_0x59140b[_0x78e7('0x1e')]?_[_0x78e7('0x1f')](_0x59140b[_0x78e7('0x1e')],function(_0x19fa10){return{'model':db[_0x19fa10[_0x78e7('0x20')]],'as':_0x19fa10['as'],'attributes':_0x19fa10[_0x78e7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x78e7('0xd')](function(_0x32f1fc){logger[_0x78e7('0xe')](_0x78e7('0x17'),_0x380ee5);logger[_0x78e7('0x21')](_0x78e7('0x17'),_0x380ee5,JSON[_0x78e7('0x12')](_0x32f1fc));_0x3a89a7(_0x32f1fc);})[_0x78e7('0x16')](function(_0x61160c){logger[_0x78e7('0x13')](_0x78e7('0x17'),_0x61160c['message'],_0x380ee5);_0x1356ef(_0x16ccb7['error'](0x1f4,_0x61160c[_0x78e7('0x14')]));});});};exports[_0x78e7('0x22')]=function(_0x2f9081){var _0x22ac1b=this;return new Promise(function(_0x4be089,_0x281f20){return db[_0x78e7('0x23')][_0x78e7('0x24')]({'raw':_0x2f9081[_0x78e7('0x19')]?_0x2f9081[_0x78e7('0x19')][_0x78e7('0x1a')]===undefined?!![]:![]:!![],'where':_0x2f9081[_0x78e7('0x19')]?_0x2f9081['options'][_0x78e7('0x1b')]||null:null,'attributes':_0x2f9081[_0x78e7('0x19')]?_0x2f9081[_0x78e7('0x19')][_0x78e7('0x1c')]||null:null,'include':_0x2f9081['options']?_0x2f9081[_0x78e7('0x19')][_0x78e7('0x1e')]?_[_0x78e7('0x1f')](_0x2f9081[_0x78e7('0x19')]['include'],function(_0x97e886){return{'model':db[_0x97e886[_0x78e7('0x20')]],'as':_0x97e886['as'],'attributes':_0x97e886[_0x78e7('0x1c')],'include':_0x97e886[_0x78e7('0x1e')]?_[_0x78e7('0x1f')](_0x97e886[_0x78e7('0x1e')],function(_0x443b84){return{'model':db[_0x443b84[_0x78e7('0x20')]],'as':_0x443b84['as'],'attributes':_0x443b84[_0x78e7('0x1c')],'include':_0x443b84[_0x78e7('0x1e')]?_['map'](_0x443b84[_0x78e7('0x1e')],function(_0x510163){return{'model':db[_0x510163[_0x78e7('0x20')]],'as':_0x510163['as'],'attributes':_0x510163[_0x78e7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x78e7('0xd')](function(_0xcafda9){logger['info']('ShowZendeskAccount',_0x2f9081);logger['debug']('ShowZendeskAccount',_0x2f9081,JSON['stringify'](_0xcafda9));_0x4be089(_0xcafda9);})['catch'](function(_0x18d387){logger[_0x78e7('0x13')](_0x78e7('0x22'),_0x18d387[_0x78e7('0x14')],_0x2f9081);_0x281f20(_0x22ac1b['error'](0x1f4,_0x18d387[_0x78e7('0x14')]));});});}; \ No newline at end of file +var _0x0097=['ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','catch','ShowZendeskAccount','find','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','request','then','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','GetZendeskAccount'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x0097,0x157));var _0x7009=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0097[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7009('0x0'));var moment=require(_0x7009('0x1'));var BPromise=require(_0x7009('0x2'));var rs=require(_0x7009('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7009('0x4'))['db'];var utils=require(_0x7009('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7009('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7009('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc7ff95,_0x1a6f82,_0x3240de){return new BPromise(function(_0x57e2ff,_0x491abb){return client[_0x7009('0x8')](_0xc7ff95,_0x3240de)[_0x7009('0x9')](function(_0x308640){logger['info'](_0x7009('0xa'),_0x1a6f82,'request\x20sent');logger[_0x7009('0xb')](_0x7009('0xc'),_0x1a6f82,_0x7009('0xd'),JSON[_0x7009('0xe')](_0x308640));if(_0x308640[_0x7009('0xf')]){if(_0x308640['error']['code']===0x1f4){logger[_0x7009('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x1a6f82,_0x308640[_0x7009('0xf')][_0x7009('0x10')]);return _0x491abb(_0x308640[_0x7009('0xf')][_0x7009('0x10')]);}logger[_0x7009('0xf')](_0x7009('0xa'),_0x1a6f82,_0x308640[_0x7009('0xf')][_0x7009('0x10')]);return _0x57e2ff(_0x308640[_0x7009('0xf')][_0x7009('0x10')]);}else{logger[_0x7009('0x11')](_0x7009('0xa'),_0x1a6f82,_0x7009('0xd'));_0x57e2ff(_0x308640[_0x7009('0x12')][_0x7009('0x10')]);}})['catch'](function(_0x54770d){logger[_0x7009('0xf')](_0x7009('0xa'),_0x1a6f82,_0x54770d);_0x491abb(_0x54770d);});});}exports[_0x7009('0x13')]=function(_0x491f19){var _0x340568=this;return new Promise(function(_0x2720a9,_0x511001){return db[_0x7009('0x14')][_0x7009('0x15')]({'raw':_0x491f19['options']?_0x491f19[_0x7009('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x491f19[_0x7009('0x16')]?_0x491f19[_0x7009('0x16')][_0x7009('0x17')]||null:null,'attributes':_0x491f19['options']?_0x491f19[_0x7009('0x16')][_0x7009('0x18')]||null:null,'limit':_0x491f19[_0x7009('0x16')]?_0x491f19[_0x7009('0x16')][_0x7009('0x19')]||null:null,'include':_0x491f19[_0x7009('0x16')]?_0x491f19[_0x7009('0x16')][_0x7009('0x1a')]?_[_0x7009('0x1b')](_0x491f19[_0x7009('0x16')]['include'],function(_0x3c1dd2){return{'model':db[_0x3c1dd2[_0x7009('0x1c')]],'as':_0x3c1dd2['as'],'attributes':_0x3c1dd2[_0x7009('0x18')],'include':_0x3c1dd2[_0x7009('0x1a')]?_[_0x7009('0x1b')](_0x3c1dd2[_0x7009('0x1a')],function(_0x3324f7){return{'model':db[_0x3324f7[_0x7009('0x1c')]],'as':_0x3324f7['as'],'attributes':_0x3324f7['attributes'],'include':_0x3324f7['include']?_[_0x7009('0x1b')](_0x3324f7['include'],function(_0x2c021e){return{'model':db[_0x2c021e[_0x7009('0x1c')]],'as':_0x2c021e['as'],'attributes':_0x2c021e[_0x7009('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4366a3){logger[_0x7009('0x11')](_0x7009('0x13'),_0x491f19);logger[_0x7009('0xb')]('GetZendeskAccount',_0x491f19,JSON[_0x7009('0xe')](_0x4366a3));_0x2720a9(_0x4366a3);})[_0x7009('0x1d')](function(_0x29df40){logger[_0x7009('0xf')](_0x7009('0x13'),_0x29df40[_0x7009('0x10')],_0x491f19);_0x511001(_0x340568[_0x7009('0xf')](0x1f4,_0x29df40[_0x7009('0x10')]));});});};exports[_0x7009('0x1e')]=function(_0x54271c){var _0xec591e=this;return new Promise(function(_0x386512,_0x34130d){return db[_0x7009('0x14')][_0x7009('0x1f')]({'raw':_0x54271c[_0x7009('0x16')]?_0x54271c['options'][_0x7009('0x20')]===undefined?!![]:![]:!![],'where':_0x54271c[_0x7009('0x16')]?_0x54271c['options'][_0x7009('0x17')]||null:null,'attributes':_0x54271c[_0x7009('0x16')]?_0x54271c[_0x7009('0x16')]['attributes']||null:null,'include':_0x54271c[_0x7009('0x16')]?_0x54271c['options'][_0x7009('0x1a')]?_[_0x7009('0x1b')](_0x54271c[_0x7009('0x16')]['include'],function(_0x1a4ccd){return{'model':db[_0x1a4ccd['model']],'as':_0x1a4ccd['as'],'attributes':_0x1a4ccd[_0x7009('0x18')],'include':_0x1a4ccd['include']?_[_0x7009('0x1b')](_0x1a4ccd[_0x7009('0x1a')],function(_0x2ca3d0){return{'model':db[_0x2ca3d0['model']],'as':_0x2ca3d0['as'],'attributes':_0x2ca3d0[_0x7009('0x18')],'include':_0x2ca3d0[_0x7009('0x1a')]?_[_0x7009('0x1b')](_0x2ca3d0['include'],function(_0xfc176a){return{'model':db[_0xfc176a['model']],'as':_0xfc176a['as'],'attributes':_0xfc176a[_0x7009('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13c7c0){logger['info'](_0x7009('0x1e'),_0x54271c);logger[_0x7009('0xb')](_0x7009('0x1e'),_0x54271c,JSON[_0x7009('0xe')](_0x13c7c0));_0x386512(_0x13c7c0);})['catch'](function(_0x37b312){logger[_0x7009('0xf')](_0x7009('0x1e'),_0x37b312['message'],_0x54271c);_0x34130d(_0xec591e[_0x7009('0xf')](0x1f4,_0x37b312['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 9eecec2..6b59735 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 _0x0713=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','setTags','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x3966c5,_0x220ec8){var _0x5f1a09=function(_0x3d51a2){while(--_0x3d51a2){_0x3966c5['push'](_0x3966c5['shift']());}};_0x5f1a09(++_0x220ec8);}(_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['getFields']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/descriptions',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x8')](_0x3071('0x11'),auth[_0x3071('0x9')](),controller['getTags']);router['post']('/',auth[_0x3071('0x9')](),controller['create']);router[_0x3071('0x12')](_0x3071('0x11'),auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['put'](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x14')]);router[_0x3071('0x15')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x16')]);module[_0x3071('0x17')]=router; \ No newline at end of file +var _0x750a=['getTags','post','setTags','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/tags'];(function(_0x505405,_0x2528a8){var _0x4710cc=function(_0x4c182d){while(--_0x4c182d){_0x505405['push'](_0x505405['shift']());}};_0x4710cc(++_0x2528a8);}(_0x750a,0x140));var _0xa750=function(_0x2caa2d,_0x584cf3){_0x2caa2d=_0x2caa2d-0x0;var _0x40b68f=_0x750a[_0x2caa2d];return _0x40b68f;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var fs_extra=require(_0xa750('0x3'));var auth=require(_0xa750('0x4'));var interaction=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var controller=require(_0xa750('0x7'));router[_0xa750('0x8')]('/',auth[_0xa750('0x9')](),controller[_0xa750('0xa')]);router[_0xa750('0x8')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller['show']);router['get'](_0xa750('0xc'),auth['isAuthenticated'](),controller[_0xa750('0xd')]);router[_0xa750('0x8')]('/:id/subjects',auth[_0xa750('0x9')](),controller[_0xa750('0xe')]);router['get']('/:id/descriptions',auth[_0xa750('0x9')](),controller['getDescriptions']);router[_0xa750('0x8')](_0xa750('0xf'),auth['isAuthenticated'](),controller[_0xa750('0x10')]);router[_0xa750('0x11')]('/',auth[_0xa750('0x9')](),controller['create']);router[_0xa750('0x11')](_0xa750('0xf'),auth[_0xa750('0x9')](),controller[_0xa750('0x12')]);router[_0xa750('0x13')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x14')]);router[_0xa750('0x15')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x16')]);module[_0xa750('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 4585df9..d9271c9 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 _0xbea4=['sequelize','exports','STRING'];(function(_0x147f4c,_0x264b0c){var _0x45ccec=function(_0x425ce7){while(--_0x425ce7){_0x147f4c['push'](_0x147f4c['shift']());}};_0x45ccec(++_0x264b0c);}(_0xbea4,0xed));var _0x4bea=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xbea4[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x4bea('0x0'));module[_0x4bea('0x1')]={'name':{'type':Sequelize[_0x4bea('0x2')]},'description':{'type':Sequelize[_0x4bea('0x2')]}}; \ No newline at end of file +var _0x0a86=['exports','STRING','sequelize'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x0a86,0x71));var _0x60a8=function(_0x325a08,_0x571fff){_0x325a08=_0x325a08-0x0;var _0x436e01=_0x0a86[_0x325a08];return _0x436e01;};'use strict';var Sequelize=require(_0x60a8('0x0'));module[_0x60a8('0x1')]={'name':{'type':Sequelize[_0x60a8('0x2')]},'description':{'type':Sequelize[_0x60a8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index d49f90e..bd4f094 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 _0x0209=['merge','then','includeAll','findAll','catch','show','params','include','options','find','create','update','body','findOne','keys','getFields','getSubjects','ZendeskField','getDescriptions','getTags','setTags','ids','eml-format','rimraf','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','destroy','stack','name','send','map','ZendeskConfiguration','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','VIRTUAL'];(function(_0x52bb13,_0x327982){var _0x5006aa=function(_0xe9f5f7){while(--_0xe9f5f7){_0x52bb13['push'](_0x52bb13['shift']());}};_0x5006aa(++_0x327982);}(_0x0209,0x115));var _0x9020=function(_0x4f72d4,_0x246301){_0x4f72d4=_0x4f72d4-0x0;var _0x3b1b6=_0x0209[_0x4f72d4];return _0x3b1b6;};'use strict';var emlformat=require(_0x9020('0x0'));var rimraf=require(_0x9020('0x1'));var zipdir=require(_0x9020('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9020('0x3'));var moment=require(_0x9020('0x4'));var BPromise=require(_0x9020('0x5'));var Mustache=require(_0x9020('0x6'));var util=require(_0x9020('0x7'));var path=require(_0x9020('0x8'));var sox=require(_0x9020('0x9'));var csv=require(_0x9020('0xa'));var ejs=require(_0x9020('0xb'));var fs=require('fs');var fs_extra=require(_0x9020('0xc'));var _=require(_0x9020('0xd'));var squel=require(_0x9020('0xe'));var crypto=require('crypto');var jsforce=require(_0x9020('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9020('0x10'));var Papa=require(_0x9020('0x11'));var Redis=require('ioredis');var authService=require(_0x9020('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9020('0x13'));var hardwareService=require(_0x9020('0x14'));var logger=require(_0x9020('0x15'))(_0x9020('0x16'));var utils=require(_0x9020('0x17'));var config=require(_0x9020('0x18'));var licenseUtil=require(_0x9020('0x19'));var db=require(_0x9020('0x1a'))['db'];function respondWithStatusCode(_0x535cf8,_0x24412d){_0x24412d=_0x24412d||0xcc;return function(_0x126f03){if(_0x126f03){return _0x535cf8[_0x9020('0x1b')](_0x24412d);}return _0x535cf8[_0x9020('0x1c')](_0x24412d)[_0x9020('0x1d')]();};}function respondWithResult(_0x1e4e9b,_0x32bf58){_0x32bf58=_0x32bf58||0xc8;return function(_0x41bb2c){if(_0x41bb2c){return _0x1e4e9b[_0x9020('0x1c')](_0x32bf58)[_0x9020('0x1e')](_0x41bb2c);}};}function respondWithFilteredResult(_0x340ad7,_0x2bced4){return function(_0x2e1c4e){if(_0x2e1c4e){var _0x2b7446=typeof _0x2bced4['offset']===_0x9020('0x1f')&&typeof _0x2bced4[_0x9020('0x20')]==='undefined';var _0x55a8ca=_0x2e1c4e[_0x9020('0x21')];var _0x247c98=_0x2b7446?0x0:_0x2bced4['offset'];var _0x363c5a=_0x2b7446?_0x2e1c4e[_0x9020('0x21')]:_0x2bced4['offset']+_0x2bced4[_0x9020('0x20')];var _0x1b6207;if(_0x363c5a>=_0x55a8ca){_0x363c5a=_0x55a8ca;_0x1b6207=0xc8;}else{_0x1b6207=0xce;}_0x340ad7[_0x9020('0x1c')](_0x1b6207);return _0x340ad7[_0x9020('0x22')](_0x9020('0x23'),_0x247c98+'-'+_0x363c5a+'/'+_0x55a8ca)[_0x9020('0x1e')](_0x2e1c4e);}return null;};}function patchUpdates(_0xaee41){return function(_0x33def8){try{jsonpatch[_0x9020('0x24')](_0x33def8,_0xaee41,!![]);}catch(_0x317557){return BPromise[_0x9020('0x25')](_0x317557);}return _0x33def8['save']();};}function saveUpdates(_0x4a44d3,_0x2892b5){return function(_0x26294f){if(_0x26294f){return _0x26294f['update'](_0x4a44d3)['then'](function(_0x568210){return _0x568210;});}return null;};}function removeEntity(_0x211a93,_0x2110d3){return function(_0x24fee8){if(_0x24fee8){return _0x24fee8[_0x9020('0x26')]()['then'](function(){_0x211a93[_0x9020('0x1c')](0xcc)[_0x9020('0x1d')]();});}};}function handleEntityNotFound(_0x62c99,_0x226405){return function(_0xf51992){if(!_0xf51992){_0x62c99['sendStatus'](0x194);}return _0xf51992;};}function handleError(_0x2f495c,_0x27d553){_0x27d553=_0x27d553||0x1f4;return function(_0x404db1){logger['error'](_0x404db1[_0x9020('0x27')]);if(_0x404db1[_0x9020('0x28')]){delete _0x404db1['name'];}_0x2f495c[_0x9020('0x1c')](_0x27d553)[_0x9020('0x29')](_0x404db1);};}exports['index']=function(_0x13effd,_0x59ce93){var _0x24ab5d={},_0x1497ef={},_0x53d671={'count':0x0,'rows':[]};var _0x555db2=_[_0x9020('0x2a')](db[_0x9020('0x2b')][_0x9020('0x2c')],function(_0x171cdf){return{'name':_0x171cdf['fieldName'],'type':_0x171cdf[_0x9020('0x2d')][_0x9020('0x2e')]};});_0x1497ef[_0x9020('0x2f')]=_[_0x9020('0x2a')](_0x555db2,_0x9020('0x28'));_0x1497ef[_0x9020('0x30')]=_['keys'](_0x13effd[_0x9020('0x30')]);_0x1497ef['filters']=_[_0x9020('0x31')](_0x1497ef[_0x9020('0x2f')],_0x1497ef[_0x9020('0x30')]);_0x24ab5d[_0x9020('0x32')]=_[_0x9020('0x31')](_0x1497ef['model'],qs[_0x9020('0x33')](_0x13effd[_0x9020('0x30')][_0x9020('0x33')]));_0x24ab5d[_0x9020('0x32')]=_0x24ab5d[_0x9020('0x32')][_0x9020('0x34')]?_0x24ab5d[_0x9020('0x32')]:_0x1497ef[_0x9020('0x2f')];if(!_0x13effd[_0x9020('0x30')][_0x9020('0x35')](_0x9020('0x36'))){_0x24ab5d['limit']=qs[_0x9020('0x20')](_0x13effd[_0x9020('0x30')][_0x9020('0x20')]);_0x24ab5d[_0x9020('0x37')]=qs[_0x9020('0x37')](_0x13effd['query'][_0x9020('0x37')]);}_0x24ab5d[_0x9020('0x38')]=qs[_0x9020('0x39')](_0x13effd['query'][_0x9020('0x39')]);_0x24ab5d[_0x9020('0x3a')]=qs[_0x9020('0x3b')](_[_0x9020('0x3c')](_0x13effd[_0x9020('0x30')],_0x1497ef['filters']),_0x555db2);if(_0x13effd[_0x9020('0x30')][_0x9020('0x3d')]){_0x24ab5d[_0x9020('0x3a')]=_['merge'](_0x24ab5d[_0x9020('0x3a')],{'$or':_[_0x9020('0x2a')](_0x555db2,function(_0x2cabe0){if(_0x2cabe0[_0x9020('0x2d')]!==_0x9020('0x3e')){var _0x3fc690={};_0x3fc690[_0x2cabe0['name']]={'$like':'%'+_0x13effd['query'][_0x9020('0x3d')]+'%'};return _0x3fc690;}})});}_0x24ab5d=_[_0x9020('0x3f')]({},_0x24ab5d,_0x13effd['options']);var _0x14a198={'where':_0x24ab5d[_0x9020('0x3a')]};return db[_0x9020('0x2b')][_0x9020('0x21')](_0x14a198)[_0x9020('0x40')](function(_0x59023c){_0x53d671[_0x9020('0x21')]=_0x59023c;if(_0x13effd[_0x9020('0x30')][_0x9020('0x41')]){_0x24ab5d['include']=[{'all':!![]}];}return db[_0x9020('0x2b')][_0x9020('0x42')](_0x24ab5d);})[_0x9020('0x40')](function(_0x29a341){_0x53d671['rows']=_0x29a341;return _0x53d671;})[_0x9020('0x40')](respondWithFilteredResult(_0x59ce93,_0x24ab5d))[_0x9020('0x43')](handleError(_0x59ce93,null));};exports[_0x9020('0x44')]=function(_0x4700f7,_0x81df95){var _0x58c8e8={'raw':![],'where':{'id':_0x4700f7[_0x9020('0x45')]['id']}},_0x388a3d={};_0x388a3d[_0x9020('0x2f')]=_['keys'](db[_0x9020('0x2b')]['rawAttributes']);_0x388a3d[_0x9020('0x30')]=_['keys'](_0x4700f7['query']);_0x388a3d[_0x9020('0x3b')]=_[_0x9020('0x31')](_0x388a3d[_0x9020('0x2f')],_0x388a3d[_0x9020('0x30')]);_0x58c8e8[_0x9020('0x32')]=_[_0x9020('0x31')](_0x388a3d[_0x9020('0x2f')],qs[_0x9020('0x33')](_0x4700f7['query'][_0x9020('0x33')]));_0x58c8e8[_0x9020('0x32')]=_0x58c8e8[_0x9020('0x32')][_0x9020('0x34')]?_0x58c8e8['attributes']:_0x388a3d[_0x9020('0x2f')];if(_0x4700f7['query'][_0x9020('0x41')]){_0x58c8e8[_0x9020('0x46')]=[{'all':!![]}];}_0x58c8e8=_[_0x9020('0x3f')]({},_0x58c8e8,_0x4700f7[_0x9020('0x47')]);return db[_0x9020('0x2b')][_0x9020('0x48')](_0x58c8e8)['then'](handleEntityNotFound(_0x81df95,null))['then'](respondWithResult(_0x81df95,null))[_0x9020('0x43')](handleError(_0x81df95,null));};exports[_0x9020('0x49')]=function(_0x393ef7,_0x1a71d6){return db[_0x9020('0x2b')][_0x9020('0x49')](_0x393ef7['body'],{})[_0x9020('0x40')](respondWithResult(_0x1a71d6,0xc9))[_0x9020('0x43')](handleError(_0x1a71d6,null));};exports[_0x9020('0x4a')]=function(_0x3c079e,_0x5aec88){if(_0x3c079e[_0x9020('0x4b')]['id']){delete _0x3c079e[_0x9020('0x4b')]['id'];}return db['ZendeskConfiguration'][_0x9020('0x48')]({'where':{'id':_0x3c079e['params']['id']}})[_0x9020('0x40')](handleEntityNotFound(_0x5aec88,null))[_0x9020('0x40')](saveUpdates(_0x3c079e[_0x9020('0x4b')],null))[_0x9020('0x40')](respondWithResult(_0x5aec88,null))[_0x9020('0x43')](handleError(_0x5aec88,null));};exports[_0x9020('0x26')]=function(_0x2bcb01,_0x309cd2){return db[_0x9020('0x2b')][_0x9020('0x48')]({'where':{'id':_0x2bcb01[_0x9020('0x45')]['id']}})['then'](handleEntityNotFound(_0x309cd2,null))['then'](removeEntity(_0x309cd2,null))[_0x9020('0x43')](handleError(_0x309cd2,null));};exports['getFields']=function(_0x1c3210,_0x1a2878,_0x409492){var _0x4bbb9c={};var _0x4944e4={};var _0x58e8fc;var _0x37c1d1;return db['ZendeskConfiguration'][_0x9020('0x4c')]({'where':{'id':_0x1c3210[_0x9020('0x45')]['id']}})['then'](handleEntityNotFound(_0x1a2878,null))['then'](function(_0xc78ddc){if(_0xc78ddc){_0x58e8fc=_0xc78ddc;_0x4944e4[_0x9020('0x2f')]=_[_0x9020('0x4d')](db['ZendeskField'][_0x9020('0x2c')]);_0x4944e4['query']=_[_0x9020('0x4d')](_0x1c3210[_0x9020('0x30')]);_0x4944e4[_0x9020('0x3b')]=_[_0x9020('0x31')](_0x4944e4['model'],_0x4944e4[_0x9020('0x30')]);_0x4bbb9c[_0x9020('0x32')]=_[_0x9020('0x31')](_0x4944e4[_0x9020('0x2f')],qs['fields'](_0x1c3210[_0x9020('0x30')][_0x9020('0x33')]));_0x4bbb9c['attributes']=_0x4bbb9c[_0x9020('0x32')][_0x9020('0x34')]?_0x4bbb9c['attributes']:_0x4944e4[_0x9020('0x2f')];_0x4bbb9c['order']=qs[_0x9020('0x39')](_0x1c3210['query'][_0x9020('0x39')]);_0x4bbb9c[_0x9020('0x3a')]=qs[_0x9020('0x3b')](_[_0x9020('0x3c')](_0x1c3210[_0x9020('0x30')],_0x4944e4[_0x9020('0x3b')]));if(_0x1c3210['query'][_0x9020('0x3d')]){_0x4bbb9c[_0x9020('0x3a')]=_['merge'](_0x4bbb9c['where'],{'$or':_[_0x9020('0x2a')](_0x4bbb9c[_0x9020('0x32')],function(_0x72fd96){var _0x5106c6={};_0x5106c6[_0x72fd96]={'$like':'%'+_0x1c3210['query']['filter']+'%'};return _0x5106c6;})});}_0x4bbb9c=_[_0x9020('0x3f')]({},_0x4bbb9c,_0x1c3210[_0x9020('0x47')]);return _0x58e8fc['getFields'](_0x4bbb9c);}})[_0x9020('0x40')](function(_0x155ca6){if(_0x155ca6){_0x37c1d1=_0x155ca6['length'];if(!_0x1c3210[_0x9020('0x30')][_0x9020('0x35')](_0x9020('0x36'))){_0x4bbb9c[_0x9020('0x20')]=qs['limit'](_0x1c3210['query']['limit']);_0x4bbb9c[_0x9020('0x37')]=qs[_0x9020('0x37')](_0x1c3210[_0x9020('0x30')]['offset']);}return _0x58e8fc[_0x9020('0x4e')](_0x4bbb9c);}})[_0x9020('0x40')](function(_0x3ab48e){if(_0x3ab48e){return _0x3ab48e?{'count':_0x37c1d1,'rows':_0x3ab48e}:null;}})[_0x9020('0x40')](respondWithResult(_0x1a2878,null))['catch'](handleError(_0x1a2878,null));};exports[_0x9020('0x4f')]=function(_0x2b752b,_0x21f1e1,_0x49bfcc){var _0x65b71={};var _0x12be75={};var _0x17b1db;var _0x4f6361;return db[_0x9020('0x2b')][_0x9020('0x4c')]({'where':{'id':_0x2b752b[_0x9020('0x45')]['id']}})['then'](handleEntityNotFound(_0x21f1e1,null))[_0x9020('0x40')](function(_0x478a60){if(_0x478a60){_0x17b1db=_0x478a60;_0x12be75['model']=_[_0x9020('0x4d')](db[_0x9020('0x50')][_0x9020('0x2c')]);_0x12be75[_0x9020('0x30')]=_[_0x9020('0x4d')](_0x2b752b[_0x9020('0x30')]);_0x12be75['filters']=_[_0x9020('0x31')](_0x12be75['model'],_0x12be75[_0x9020('0x30')]);_0x65b71['attributes']=_[_0x9020('0x31')](_0x12be75[_0x9020('0x2f')],qs[_0x9020('0x33')](_0x2b752b[_0x9020('0x30')]['fields']));_0x65b71[_0x9020('0x32')]=_0x65b71[_0x9020('0x32')][_0x9020('0x34')]?_0x65b71[_0x9020('0x32')]:_0x12be75[_0x9020('0x2f')];_0x65b71[_0x9020('0x38')]=qs[_0x9020('0x39')](_0x2b752b[_0x9020('0x30')][_0x9020('0x39')]);_0x65b71[_0x9020('0x3a')]=qs[_0x9020('0x3b')](_['pick'](_0x2b752b[_0x9020('0x30')],_0x12be75['filters']));if(_0x2b752b['query'][_0x9020('0x3d')]){_0x65b71[_0x9020('0x3a')]=_[_0x9020('0x3f')](_0x65b71['where'],{'$or':_[_0x9020('0x2a')](_0x65b71[_0x9020('0x32')],function(_0x4a56ad){var _0xc5dc40={};_0xc5dc40[_0x4a56ad]={'$like':'%'+_0x2b752b[_0x9020('0x30')][_0x9020('0x3d')]+'%'};return _0xc5dc40;})});}_0x65b71=_[_0x9020('0x3f')]({},_0x65b71,_0x2b752b['options']);return _0x17b1db['getSubjects'](_0x65b71);}})[_0x9020('0x40')](function(_0x2a61fc){if(_0x2a61fc){_0x4f6361=_0x2a61fc[_0x9020('0x34')];if(!_0x2b752b['query'][_0x9020('0x35')](_0x9020('0x36'))){_0x65b71['limit']=qs[_0x9020('0x20')](_0x2b752b[_0x9020('0x30')][_0x9020('0x20')]);_0x65b71[_0x9020('0x37')]=qs[_0x9020('0x37')](_0x2b752b[_0x9020('0x30')]['offset']);}return _0x17b1db[_0x9020('0x4f')](_0x65b71);}})[_0x9020('0x40')](function(_0x26e01b){if(_0x26e01b){return _0x26e01b?{'count':_0x4f6361,'rows':_0x26e01b}:null;}})[_0x9020('0x40')](respondWithResult(_0x21f1e1,null))[_0x9020('0x43')](handleError(_0x21f1e1,null));};exports['getDescriptions']=function(_0x5abe7a,_0x1540d1,_0x4d80b9){var _0x106c40={};var _0x5271f2={};var _0x327f55;var _0x5cfd20;return db[_0x9020('0x2b')]['findOne']({'where':{'id':_0x5abe7a[_0x9020('0x45')]['id']}})['then'](handleEntityNotFound(_0x1540d1,null))[_0x9020('0x40')](function(_0x479f3b){if(_0x479f3b){_0x327f55=_0x479f3b;_0x5271f2[_0x9020('0x2f')]=_['keys'](db['ZendeskField'][_0x9020('0x2c')]);_0x5271f2[_0x9020('0x30')]=_['keys'](_0x5abe7a[_0x9020('0x30')]);_0x5271f2[_0x9020('0x3b')]=_[_0x9020('0x31')](_0x5271f2[_0x9020('0x2f')],_0x5271f2[_0x9020('0x30')]);_0x106c40[_0x9020('0x32')]=_[_0x9020('0x31')](_0x5271f2['model'],qs[_0x9020('0x33')](_0x5abe7a['query'][_0x9020('0x33')]));_0x106c40[_0x9020('0x32')]=_0x106c40[_0x9020('0x32')][_0x9020('0x34')]?_0x106c40[_0x9020('0x32')]:_0x5271f2[_0x9020('0x2f')];_0x106c40[_0x9020('0x38')]=qs[_0x9020('0x39')](_0x5abe7a['query']['sort']);_0x106c40[_0x9020('0x3a')]=qs[_0x9020('0x3b')](_[_0x9020('0x3c')](_0x5abe7a[_0x9020('0x30')],_0x5271f2['filters']));if(_0x5abe7a['query']['filter']){_0x106c40[_0x9020('0x3a')]=_['merge'](_0x106c40[_0x9020('0x3a')],{'$or':_[_0x9020('0x2a')](_0x106c40[_0x9020('0x32')],function(_0x357eba){var _0x493993={};_0x493993[_0x357eba]={'$like':'%'+_0x5abe7a['query'][_0x9020('0x3d')]+'%'};return _0x493993;})});}_0x106c40=_[_0x9020('0x3f')]({},_0x106c40,_0x5abe7a[_0x9020('0x47')]);return _0x327f55[_0x9020('0x51')](_0x106c40);}})[_0x9020('0x40')](function(_0x20a878){if(_0x20a878){_0x5cfd20=_0x20a878[_0x9020('0x34')];if(!_0x5abe7a[_0x9020('0x30')][_0x9020('0x35')]('nolimit')){_0x106c40[_0x9020('0x20')]=qs['limit'](_0x5abe7a[_0x9020('0x30')][_0x9020('0x20')]);_0x106c40[_0x9020('0x37')]=qs[_0x9020('0x37')](_0x5abe7a[_0x9020('0x30')][_0x9020('0x37')]);}return _0x327f55['getDescriptions'](_0x106c40);}})['then'](function(_0x542695){if(_0x542695){return _0x542695?{'count':_0x5cfd20,'rows':_0x542695}:null;}})[_0x9020('0x40')](respondWithResult(_0x1540d1,null))[_0x9020('0x43')](handleError(_0x1540d1,null));};exports[_0x9020('0x52')]=function(_0x5827cc,_0x4c5e57,_0x1e3119){var _0x3c809d={};var _0x127be8={};var _0x40d376;var _0x408145;return db[_0x9020('0x2b')][_0x9020('0x4c')]({'where':{'id':_0x5827cc['params']['id']}})['then'](handleEntityNotFound(_0x4c5e57,null))['then'](function(_0x37a947){if(_0x37a947){_0x40d376=_0x37a947;_0x127be8[_0x9020('0x2f')]=_[_0x9020('0x4d')](db['Tag']['rawAttributes']);_0x127be8[_0x9020('0x30')]=_[_0x9020('0x4d')](_0x5827cc['query']);_0x127be8[_0x9020('0x3b')]=_[_0x9020('0x31')](_0x127be8[_0x9020('0x2f')],_0x127be8['query']);_0x3c809d['attributes']=_[_0x9020('0x31')](_0x127be8['model'],qs['fields'](_0x5827cc[_0x9020('0x30')]['fields']));_0x3c809d['attributes']=_0x3c809d[_0x9020('0x32')][_0x9020('0x34')]?_0x3c809d[_0x9020('0x32')]:_0x127be8['model'];_0x3c809d[_0x9020('0x38')]=qs[_0x9020('0x39')](_0x5827cc[_0x9020('0x30')][_0x9020('0x39')]);_0x3c809d['where']=qs['filters'](_[_0x9020('0x3c')](_0x5827cc[_0x9020('0x30')],_0x127be8[_0x9020('0x3b')]));if(_0x5827cc[_0x9020('0x30')][_0x9020('0x3d')]){_0x3c809d[_0x9020('0x3a')]=_[_0x9020('0x3f')](_0x3c809d[_0x9020('0x3a')],{'$or':_[_0x9020('0x2a')](_0x3c809d[_0x9020('0x32')],function(_0x5a12c2){var _0x27844a={};_0x27844a[_0x5a12c2]={'$like':'%'+_0x5827cc[_0x9020('0x30')][_0x9020('0x3d')]+'%'};return _0x27844a;})});}_0x3c809d=_[_0x9020('0x3f')]({},_0x3c809d,_0x5827cc[_0x9020('0x47')]);return _0x40d376[_0x9020('0x52')](_0x3c809d);}})[_0x9020('0x40')](function(_0x288aa6){if(_0x288aa6){_0x408145=_0x288aa6[_0x9020('0x34')];if(!_0x5827cc['query'][_0x9020('0x35')]('nolimit')){_0x3c809d['limit']=qs[_0x9020('0x20')](_0x5827cc['query'][_0x9020('0x20')]);_0x3c809d[_0x9020('0x37')]=qs[_0x9020('0x37')](_0x5827cc[_0x9020('0x30')]['offset']);}return _0x40d376['getTags'](_0x3c809d);}})[_0x9020('0x40')](function(_0x3fad1d){if(_0x3fad1d){return _0x3fad1d?{'count':_0x408145,'rows':_0x3fad1d}:null;}})['then'](respondWithResult(_0x4c5e57,null))['catch'](handleError(_0x4c5e57,null));};exports['setTags']=function(_0x20ff0b,_0x30c6c7,_0xfe1b04){if(_0x20ff0b[_0x9020('0x4b')]['id']){delete _0x20ff0b[_0x9020('0x4b')]['id'];}return db[_0x9020('0x2b')]['findOne']({'where':{'id':_0x20ff0b[_0x9020('0x45')]['id']}})[_0x9020('0x40')](handleEntityNotFound(_0x30c6c7,null))['then'](function(_0x48565a){if(_0x48565a){return _0x48565a[_0x9020('0x53')](_0x20ff0b[_0x9020('0x4b')][_0x9020('0x54')]||[]);}return null;})[_0x9020('0x40')](respondWithResult(_0x30c6c7,null))[_0x9020('0x43')](handleError(_0x30c6c7,null));}; \ No newline at end of file +var _0xe23a=['length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','catch','create','update','find','params','body','ZendeskField','getFields','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','limit','offset','count','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields'];(function(_0x376f19,_0x1e5ece){var _0x9777b4=function(_0x1887c0){while(--_0x1887c0){_0x376f19['push'](_0x376f19['shift']());}};_0x9777b4(++_0x1e5ece);}(_0xe23a,0x1d2));var _0xae23=function(_0x4521e3,_0x10a8a4){_0x4521e3=_0x4521e3-0x0;var _0x46a272=_0xe23a[_0x4521e3];return _0x46a272;};'use strict';var emlformat=require(_0xae23('0x0'));var rimraf=require(_0xae23('0x1'));var zipdir=require(_0xae23('0x2'));var jsonpatch=require(_0xae23('0x3'));var rp=require('request-promise');var moment=require(_0xae23('0x4'));var BPromise=require(_0xae23('0x5'));var Mustache=require(_0xae23('0x6'));var util=require(_0xae23('0x7'));var path=require(_0xae23('0x8'));var sox=require(_0xae23('0x9'));var csv=require(_0xae23('0xa'));var ejs=require(_0xae23('0xb'));var fs=require('fs');var fs_extra=require(_0xae23('0xc'));var _=require(_0xae23('0xd'));var squel=require(_0xae23('0xe'));var crypto=require(_0xae23('0xf'));var jsforce=require(_0xae23('0x10'));var deskjs=require(_0xae23('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae23('0x12'));var Redis=require(_0xae23('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xae23('0x14'));var hardwareService=require(_0xae23('0x15'));var logger=require(_0xae23('0x16'))(_0xae23('0x17'));var utils=require(_0xae23('0x18'));var config=require(_0xae23('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xae23('0x1a'))['db'];function respondWithStatusCode(_0x1feb8a,_0x51e7cf){_0x51e7cf=_0x51e7cf||0xcc;return function(_0x4a88f9){if(_0x4a88f9){return _0x1feb8a['sendStatus'](_0x51e7cf);}return _0x1feb8a[_0xae23('0x1b')](_0x51e7cf)['end']();};}function respondWithResult(_0x21f997,_0x54c200){_0x54c200=_0x54c200||0xc8;return function(_0xa9260d){if(_0xa9260d){return _0x21f997[_0xae23('0x1b')](_0x54c200)[_0xae23('0x1c')](_0xa9260d);}};}function respondWithFilteredResult(_0x2a548e,_0x32ae97){return function(_0x8e4999){if(_0x8e4999){var _0x3c1e4c=typeof _0x32ae97['offset']===_0xae23('0x1d')&&typeof _0x32ae97[_0xae23('0x1e')]===_0xae23('0x1d');var _0x21461d=_0x8e4999['count'];var _0x1751d=_0x3c1e4c?0x0:_0x32ae97[_0xae23('0x1f')];var _0x5fb849=_0x3c1e4c?_0x8e4999[_0xae23('0x20')]:_0x32ae97['offset']+_0x32ae97['limit'];var _0x1df91b;if(_0x5fb849>=_0x21461d){_0x5fb849=_0x21461d;_0x1df91b=0xc8;}else{_0x1df91b=0xce;}_0x2a548e['status'](_0x1df91b);return _0x2a548e[_0xae23('0x21')]('Content-Range',_0x1751d+'-'+_0x5fb849+'/'+_0x21461d)[_0xae23('0x1c')](_0x8e4999);}return null;};}function patchUpdates(_0x273882){return function(_0x112fbd){try{jsonpatch[_0xae23('0x22')](_0x112fbd,_0x273882,!![]);}catch(_0x5041e4){return BPromise[_0xae23('0x23')](_0x5041e4);}return _0x112fbd[_0xae23('0x24')]();};}function saveUpdates(_0x25ac2b,_0x140506){return function(_0xd836e6){if(_0xd836e6){return _0xd836e6['update'](_0x25ac2b)[_0xae23('0x25')](function(_0x44db66){return _0x44db66;});}return null;};}function removeEntity(_0x44670b,_0x3d92b6){return function(_0x25aba){if(_0x25aba){return _0x25aba[_0xae23('0x26')]()[_0xae23('0x25')](function(){_0x44670b[_0xae23('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48c492,_0x3ddea5){return function(_0x4d3b00){if(!_0x4d3b00){_0x48c492['sendStatus'](0x194);}return _0x4d3b00;};}function handleError(_0xf7c535,_0x334e38){_0x334e38=_0x334e38||0x1f4;return function(_0x3ac8e8){logger[_0xae23('0x27')](_0x3ac8e8[_0xae23('0x28')]);if(_0x3ac8e8['name']){delete _0x3ac8e8[_0xae23('0x29')];}_0xf7c535[_0xae23('0x1b')](_0x334e38)[_0xae23('0x2a')](_0x3ac8e8);};}exports[_0xae23('0x2b')]=function(_0x531560,_0x224edf){var _0x273e9f={},_0x18351a={},_0x224670={'count':0x0,'rows':[]};var _0x4854a9=_[_0xae23('0x2c')](db[_0xae23('0x2d')][_0xae23('0x2e')],function(_0x4f2c33){return{'name':_0x4f2c33[_0xae23('0x2f')],'type':_0x4f2c33[_0xae23('0x30')]['key']};});_0x18351a[_0xae23('0x31')]=_[_0xae23('0x2c')](_0x4854a9,_0xae23('0x29'));_0x18351a[_0xae23('0x32')]=_[_0xae23('0x33')](_0x531560[_0xae23('0x32')]);_0x18351a[_0xae23('0x34')]=_[_0xae23('0x35')](_0x18351a[_0xae23('0x31')],_0x18351a[_0xae23('0x32')]);_0x273e9f[_0xae23('0x36')]=_['intersection'](_0x18351a[_0xae23('0x31')],qs[_0xae23('0x37')](_0x531560[_0xae23('0x32')][_0xae23('0x37')]));_0x273e9f[_0xae23('0x36')]=_0x273e9f[_0xae23('0x36')][_0xae23('0x38')]?_0x273e9f[_0xae23('0x36')]:_0x18351a[_0xae23('0x31')];if(!_0x531560[_0xae23('0x32')][_0xae23('0x39')](_0xae23('0x3a'))){_0x273e9f[_0xae23('0x1e')]=qs[_0xae23('0x1e')](_0x531560[_0xae23('0x32')][_0xae23('0x1e')]);_0x273e9f[_0xae23('0x1f')]=qs[_0xae23('0x1f')](_0x531560[_0xae23('0x32')][_0xae23('0x1f')]);}_0x273e9f[_0xae23('0x3b')]=qs[_0xae23('0x3c')](_0x531560[_0xae23('0x32')][_0xae23('0x3c')]);_0x273e9f['where']=qs[_0xae23('0x34')](_[_0xae23('0x3d')](_0x531560[_0xae23('0x32')],_0x18351a[_0xae23('0x34')]),_0x4854a9);if(_0x531560['query']['filter']){_0x273e9f[_0xae23('0x3e')]=_[_0xae23('0x3f')](_0x273e9f['where'],{'$or':_[_0xae23('0x2c')](_0x4854a9,function(_0x121a3c){if(_0x121a3c['type']!==_0xae23('0x40')){var _0x3e00a1={};_0x3e00a1[_0x121a3c['name']]={'$like':'%'+_0x531560[_0xae23('0x32')][_0xae23('0x41')]+'%'};return _0x3e00a1;}})});}_0x273e9f=_['merge']({},_0x273e9f,_0x531560[_0xae23('0x42')]);var _0x2658b1={'where':_0x273e9f[_0xae23('0x3e')]};return db['ZendeskConfiguration'][_0xae23('0x20')](_0x2658b1)[_0xae23('0x25')](function(_0x3f766a){_0x224670[_0xae23('0x20')]=_0x3f766a;if(_0x531560[_0xae23('0x32')][_0xae23('0x43')]){_0x273e9f[_0xae23('0x44')]=[{'all':!![]}];}return db[_0xae23('0x2d')][_0xae23('0x45')](_0x273e9f);})[_0xae23('0x25')](function(_0x253b54){_0x224670[_0xae23('0x46')]=_0x253b54;return _0x224670;})[_0xae23('0x25')](respondWithFilteredResult(_0x224edf,_0x273e9f))['catch'](handleError(_0x224edf,null));};exports[_0xae23('0x47')]=function(_0x5137da,_0x50b18e){var _0x29fa0e={'raw':![],'where':{'id':_0x5137da['params']['id']}},_0xf7e7b7={};_0xf7e7b7[_0xae23('0x31')]=_[_0xae23('0x33')](db['ZendeskConfiguration'][_0xae23('0x2e')]);_0xf7e7b7['query']=_[_0xae23('0x33')](_0x5137da[_0xae23('0x32')]);_0xf7e7b7[_0xae23('0x34')]=_[_0xae23('0x35')](_0xf7e7b7[_0xae23('0x31')],_0xf7e7b7[_0xae23('0x32')]);_0x29fa0e['attributes']=_[_0xae23('0x35')](_0xf7e7b7[_0xae23('0x31')],qs[_0xae23('0x37')](_0x5137da[_0xae23('0x32')][_0xae23('0x37')]));_0x29fa0e[_0xae23('0x36')]=_0x29fa0e[_0xae23('0x36')][_0xae23('0x38')]?_0x29fa0e[_0xae23('0x36')]:_0xf7e7b7[_0xae23('0x31')];if(_0x5137da[_0xae23('0x32')]['includeAll']){_0x29fa0e[_0xae23('0x44')]=[{'all':!![]}];}_0x29fa0e=_[_0xae23('0x3f')]({},_0x29fa0e,_0x5137da[_0xae23('0x42')]);return db[_0xae23('0x2d')]['find'](_0x29fa0e)[_0xae23('0x25')](handleEntityNotFound(_0x50b18e,null))[_0xae23('0x25')](respondWithResult(_0x50b18e,null))[_0xae23('0x48')](handleError(_0x50b18e,null));};exports[_0xae23('0x49')]=function(_0x191b31,_0x2c5b02){return db['ZendeskConfiguration'][_0xae23('0x49')](_0x191b31['body'],{})[_0xae23('0x25')](respondWithResult(_0x2c5b02,0xc9))['catch'](handleError(_0x2c5b02,null));};exports[_0xae23('0x4a')]=function(_0x1ae1a8,_0x513d80){if(_0x1ae1a8['body']['id']){delete _0x1ae1a8['body']['id'];}return db[_0xae23('0x2d')][_0xae23('0x4b')]({'where':{'id':_0x1ae1a8[_0xae23('0x4c')]['id']}})[_0xae23('0x25')](handleEntityNotFound(_0x513d80,null))['then'](saveUpdates(_0x1ae1a8[_0xae23('0x4d')],null))[_0xae23('0x25')](respondWithResult(_0x513d80,null))[_0xae23('0x48')](handleError(_0x513d80,null));};exports[_0xae23('0x26')]=function(_0xbcc73d,_0x545c52){return db['ZendeskConfiguration']['find']({'where':{'id':_0xbcc73d[_0xae23('0x4c')]['id']}})[_0xae23('0x25')](handleEntityNotFound(_0x545c52,null))[_0xae23('0x25')](removeEntity(_0x545c52,null))['catch'](handleError(_0x545c52,null));};exports['getFields']=function(_0x1da7f2,_0x32092d,_0x2eb5dc){var _0x2bd952={};var _0x13709f={};var _0x137e87;var _0xb8d1b;return db[_0xae23('0x2d')]['findOne']({'where':{'id':_0x1da7f2['params']['id']}})[_0xae23('0x25')](handleEntityNotFound(_0x32092d,null))[_0xae23('0x25')](function(_0x8bc904){if(_0x8bc904){_0x137e87=_0x8bc904;_0x13709f[_0xae23('0x31')]=_['keys'](db[_0xae23('0x4e')][_0xae23('0x2e')]);_0x13709f[_0xae23('0x32')]=_[_0xae23('0x33')](_0x1da7f2[_0xae23('0x32')]);_0x13709f[_0xae23('0x34')]=_[_0xae23('0x35')](_0x13709f[_0xae23('0x31')],_0x13709f[_0xae23('0x32')]);_0x2bd952[_0xae23('0x36')]=_[_0xae23('0x35')](_0x13709f[_0xae23('0x31')],qs[_0xae23('0x37')](_0x1da7f2['query'][_0xae23('0x37')]));_0x2bd952['attributes']=_0x2bd952[_0xae23('0x36')]['length']?_0x2bd952[_0xae23('0x36')]:_0x13709f[_0xae23('0x31')];_0x2bd952[_0xae23('0x3b')]=qs[_0xae23('0x3c')](_0x1da7f2[_0xae23('0x32')][_0xae23('0x3c')]);_0x2bd952['where']=qs['filters'](_[_0xae23('0x3d')](_0x1da7f2['query'],_0x13709f[_0xae23('0x34')]));if(_0x1da7f2[_0xae23('0x32')]['filter']){_0x2bd952['where']=_['merge'](_0x2bd952['where'],{'$or':_[_0xae23('0x2c')](_0x2bd952[_0xae23('0x36')],function(_0x2bccbb){var _0x76a643={};_0x76a643[_0x2bccbb]={'$like':'%'+_0x1da7f2[_0xae23('0x32')][_0xae23('0x41')]+'%'};return _0x76a643;})});}_0x2bd952=_[_0xae23('0x3f')]({},_0x2bd952,_0x1da7f2['options']);return _0x137e87[_0xae23('0x4f')](_0x2bd952);}})['then'](function(_0x58339c){if(_0x58339c){_0xb8d1b=_0x58339c[_0xae23('0x38')];if(!_0x1da7f2[_0xae23('0x32')][_0xae23('0x39')](_0xae23('0x3a'))){_0x2bd952[_0xae23('0x1e')]=qs[_0xae23('0x1e')](_0x1da7f2[_0xae23('0x32')][_0xae23('0x1e')]);_0x2bd952[_0xae23('0x1f')]=qs[_0xae23('0x1f')](_0x1da7f2['query']['offset']);}return _0x137e87[_0xae23('0x4f')](_0x2bd952);}})[_0xae23('0x25')](function(_0x2d1720){if(_0x2d1720){return _0x2d1720?{'count':_0xb8d1b,'rows':_0x2d1720}:null;}})['then'](respondWithResult(_0x32092d,null))['catch'](handleError(_0x32092d,null));};exports[_0xae23('0x50')]=function(_0x358f6c,_0x57efff,_0x559cb4){var _0x444f59={};var _0x43dea5={};var _0xbc84b4;var _0x3b76d7;return db['ZendeskConfiguration'][_0xae23('0x51')]({'where':{'id':_0x358f6c['params']['id']}})[_0xae23('0x25')](handleEntityNotFound(_0x57efff,null))[_0xae23('0x25')](function(_0x167102){if(_0x167102){_0xbc84b4=_0x167102;_0x43dea5['model']=_[_0xae23('0x33')](db[_0xae23('0x4e')][_0xae23('0x2e')]);_0x43dea5['query']=_['keys'](_0x358f6c[_0xae23('0x32')]);_0x43dea5['filters']=_[_0xae23('0x35')](_0x43dea5[_0xae23('0x31')],_0x43dea5['query']);_0x444f59[_0xae23('0x36')]=_['intersection'](_0x43dea5[_0xae23('0x31')],qs[_0xae23('0x37')](_0x358f6c[_0xae23('0x32')]['fields']));_0x444f59[_0xae23('0x36')]=_0x444f59[_0xae23('0x36')]['length']?_0x444f59[_0xae23('0x36')]:_0x43dea5['model'];_0x444f59[_0xae23('0x3b')]=qs['sort'](_0x358f6c[_0xae23('0x32')][_0xae23('0x3c')]);_0x444f59['where']=qs[_0xae23('0x34')](_[_0xae23('0x3d')](_0x358f6c['query'],_0x43dea5[_0xae23('0x34')]));if(_0x358f6c['query'][_0xae23('0x41')]){_0x444f59[_0xae23('0x3e')]=_['merge'](_0x444f59['where'],{'$or':_[_0xae23('0x2c')](_0x444f59['attributes'],function(_0x24e7f1){var _0xd9eb3c={};_0xd9eb3c[_0x24e7f1]={'$like':'%'+_0x358f6c['query'][_0xae23('0x41')]+'%'};return _0xd9eb3c;})});}_0x444f59=_['merge']({},_0x444f59,_0x358f6c[_0xae23('0x42')]);return _0xbc84b4['getSubjects'](_0x444f59);}})['then'](function(_0x1a1ea3){if(_0x1a1ea3){_0x3b76d7=_0x1a1ea3['length'];if(!_0x358f6c[_0xae23('0x32')]['hasOwnProperty'](_0xae23('0x3a'))){_0x444f59['limit']=qs[_0xae23('0x1e')](_0x358f6c[_0xae23('0x32')][_0xae23('0x1e')]);_0x444f59[_0xae23('0x1f')]=qs[_0xae23('0x1f')](_0x358f6c[_0xae23('0x32')]['offset']);}return _0xbc84b4[_0xae23('0x50')](_0x444f59);}})['then'](function(_0x43cb31){if(_0x43cb31){return _0x43cb31?{'count':_0x3b76d7,'rows':_0x43cb31}:null;}})[_0xae23('0x25')](respondWithResult(_0x57efff,null))[_0xae23('0x48')](handleError(_0x57efff,null));};exports[_0xae23('0x52')]=function(_0x291b42,_0x74cbb4,_0x5e5b2d){var _0x20e4d0={};var _0x12e6c6={};var _0x135c75;var _0xe8f607;return db[_0xae23('0x2d')][_0xae23('0x51')]({'where':{'id':_0x291b42[_0xae23('0x4c')]['id']}})[_0xae23('0x25')](handleEntityNotFound(_0x74cbb4,null))[_0xae23('0x25')](function(_0x5b9438){if(_0x5b9438){_0x135c75=_0x5b9438;_0x12e6c6['model']=_['keys'](db[_0xae23('0x4e')][_0xae23('0x2e')]);_0x12e6c6[_0xae23('0x32')]=_[_0xae23('0x33')](_0x291b42[_0xae23('0x32')]);_0x12e6c6[_0xae23('0x34')]=_[_0xae23('0x35')](_0x12e6c6[_0xae23('0x31')],_0x12e6c6[_0xae23('0x32')]);_0x20e4d0[_0xae23('0x36')]=_['intersection'](_0x12e6c6[_0xae23('0x31')],qs[_0xae23('0x37')](_0x291b42[_0xae23('0x32')][_0xae23('0x37')]));_0x20e4d0[_0xae23('0x36')]=_0x20e4d0[_0xae23('0x36')][_0xae23('0x38')]?_0x20e4d0[_0xae23('0x36')]:_0x12e6c6[_0xae23('0x31')];_0x20e4d0[_0xae23('0x3b')]=qs['sort'](_0x291b42['query']['sort']);_0x20e4d0[_0xae23('0x3e')]=qs[_0xae23('0x34')](_[_0xae23('0x3d')](_0x291b42[_0xae23('0x32')],_0x12e6c6['filters']));if(_0x291b42[_0xae23('0x32')]['filter']){_0x20e4d0[_0xae23('0x3e')]=_['merge'](_0x20e4d0[_0xae23('0x3e')],{'$or':_[_0xae23('0x2c')](_0x20e4d0[_0xae23('0x36')],function(_0x108cd3){var _0x302bb8={};_0x302bb8[_0x108cd3]={'$like':'%'+_0x291b42[_0xae23('0x32')]['filter']+'%'};return _0x302bb8;})});}_0x20e4d0=_[_0xae23('0x3f')]({},_0x20e4d0,_0x291b42[_0xae23('0x42')]);return _0x135c75[_0xae23('0x52')](_0x20e4d0);}})[_0xae23('0x25')](function(_0x4e88ce){if(_0x4e88ce){_0xe8f607=_0x4e88ce[_0xae23('0x38')];if(!_0x291b42['query'][_0xae23('0x39')]('nolimit')){_0x20e4d0[_0xae23('0x1e')]=qs[_0xae23('0x1e')](_0x291b42[_0xae23('0x32')][_0xae23('0x1e')]);_0x20e4d0[_0xae23('0x1f')]=qs[_0xae23('0x1f')](_0x291b42['query'][_0xae23('0x1f')]);}return _0x135c75[_0xae23('0x52')](_0x20e4d0);}})['then'](function(_0x4fdcc0){if(_0x4fdcc0){return _0x4fdcc0?{'count':_0xe8f607,'rows':_0x4fdcc0}:null;}})['then'](respondWithResult(_0x74cbb4,null))[_0xae23('0x48')](handleError(_0x74cbb4,null));};exports[_0xae23('0x53')]=function(_0x2ef08d,_0x194064,_0x55d463){var _0x2eb75d={};var _0x307f49={};var _0x353283;var _0x26fc5d;return db[_0xae23('0x2d')][_0xae23('0x51')]({'where':{'id':_0x2ef08d[_0xae23('0x4c')]['id']}})['then'](handleEntityNotFound(_0x194064,null))[_0xae23('0x25')](function(_0x47d93f){if(_0x47d93f){_0x353283=_0x47d93f;_0x307f49[_0xae23('0x31')]=_[_0xae23('0x33')](db[_0xae23('0x54')]['rawAttributes']);_0x307f49[_0xae23('0x32')]=_[_0xae23('0x33')](_0x2ef08d[_0xae23('0x32')]);_0x307f49[_0xae23('0x34')]=_[_0xae23('0x35')](_0x307f49[_0xae23('0x31')],_0x307f49[_0xae23('0x32')]);_0x2eb75d[_0xae23('0x36')]=_[_0xae23('0x35')](_0x307f49[_0xae23('0x31')],qs[_0xae23('0x37')](_0x2ef08d[_0xae23('0x32')][_0xae23('0x37')]));_0x2eb75d[_0xae23('0x36')]=_0x2eb75d[_0xae23('0x36')][_0xae23('0x38')]?_0x2eb75d[_0xae23('0x36')]:_0x307f49['model'];_0x2eb75d[_0xae23('0x3b')]=qs['sort'](_0x2ef08d[_0xae23('0x32')][_0xae23('0x3c')]);_0x2eb75d['where']=qs[_0xae23('0x34')](_[_0xae23('0x3d')](_0x2ef08d[_0xae23('0x32')],_0x307f49[_0xae23('0x34')]));if(_0x2ef08d[_0xae23('0x32')][_0xae23('0x41')]){_0x2eb75d['where']=_[_0xae23('0x3f')](_0x2eb75d['where'],{'$or':_[_0xae23('0x2c')](_0x2eb75d[_0xae23('0x36')],function(_0x2f4cb0){var _0x244095={};_0x244095[_0x2f4cb0]={'$like':'%'+_0x2ef08d['query'][_0xae23('0x41')]+'%'};return _0x244095;})});}_0x2eb75d=_[_0xae23('0x3f')]({},_0x2eb75d,_0x2ef08d['options']);return _0x353283[_0xae23('0x53')](_0x2eb75d);}})[_0xae23('0x25')](function(_0x45014b){if(_0x45014b){_0x26fc5d=_0x45014b[_0xae23('0x38')];if(!_0x2ef08d[_0xae23('0x32')][_0xae23('0x39')](_0xae23('0x3a'))){_0x2eb75d['limit']=qs[_0xae23('0x1e')](_0x2ef08d[_0xae23('0x32')][_0xae23('0x1e')]);_0x2eb75d[_0xae23('0x1f')]=qs[_0xae23('0x1f')](_0x2ef08d[_0xae23('0x32')][_0xae23('0x1f')]);}return _0x353283[_0xae23('0x53')](_0x2eb75d);}})[_0xae23('0x25')](function(_0x4831fb){if(_0x4831fb){return _0x4831fb?{'count':_0x26fc5d,'rows':_0x4831fb}:null;}})[_0xae23('0x25')](respondWithResult(_0x194064,null))[_0xae23('0x48')](handleError(_0x194064,null));};exports[_0xae23('0x55')]=function(_0x5b7b67,_0x8ca11e,_0x167084){if(_0x5b7b67['body']['id']){delete _0x5b7b67[_0xae23('0x4d')]['id'];}return db[_0xae23('0x2d')][_0xae23('0x51')]({'where':{'id':_0x5b7b67['params']['id']}})['then'](handleEntityNotFound(_0x8ca11e,null))[_0xae23('0x25')](function(_0x25779c){if(_0x25779c){return _0x25779c[_0xae23('0x55')](_0x5b7b67[_0xae23('0x4d')][_0xae23('0x56')]||[]);}return null;})[_0xae23('0x25')](respondWithResult(_0x8ca11e,null))[_0xae23('0x48')](handleError(_0x8ca11e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 9a40878..2ac0aef 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 _0xe1e3=['exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x6bbc50,_0x26b8e9){var _0x5e8e93=function(_0x2dda79){while(--_0x2dda79){_0x6bbc50['push'](_0x6bbc50['shift']());}};_0x5e8e93(++_0x26b8e9);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0xc2a4f7,_0x148612){_0xc2a4f7=_0xc2a4f7-0x0;var _0x604c01=_0xe1e3[_0xc2a4f7];return _0x604c01;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var logger=require('../../config/logger')(_0x3e1e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e1e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e1e('0x4'));var config=require(_0x3e1e('0x5'));var attributes=require(_0x3e1e('0x6'));module[_0x3e1e('0x7')]=function(_0x40d6d8,_0x25701f){return _0x40d6d8['define'](_0x3e1e('0x8'),attributes,{'tableName':_0x3e1e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a95=['bluebird','request-promise','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','lodash','util','../../config/logger','api','moment'];(function(_0x817f3f,_0x380692){var _0x4524d7=function(_0x558078){while(--_0x558078){_0x817f3f['push'](_0x817f3f['shift']());}};_0x4524d7(++_0x380692);}(_0x6a95,0x1db));var _0x56a9=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x6a95[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var logger=require(_0x56a9('0x2'))(_0x56a9('0x3'));var moment=require(_0x56a9('0x4'));var BPromise=require(_0x56a9('0x5'));var rp=require(_0x56a9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x56a9('0x7'));var attributes=require(_0x56a9('0x8'));module[_0x56a9('0x9')]=function(_0x2eb132,_0x3c15b6){return _0x2eb132[_0x56a9('0xa')](_0x56a9('0xb'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 1c6b2b9..e114ff1 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 _0x4e44=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x5d897d,_0x8f648e){var _0x21a626=function(_0x43d4c9){while(--_0x43d4c9){_0x5d897d['push'](_0x5d897d['shift']());}};_0x21a626(++_0x8f648e);}(_0x4e44,0x7f));var _0x44e4=function(_0x146de6,_0x5ada22){_0x146de6=_0x146de6-0x0;var _0xab8940=_0x4e44[_0x146de6];return _0xab8940;};'use strict';var _=require('lodash');var util=require(_0x44e4('0x0'));var moment=require(_0x44e4('0x1'));var BPromise=require(_0x44e4('0x2'));var rs=require(_0x44e4('0x3'));var fs=require('fs');var Redis=require(_0x44e4('0x4'));var db=require(_0x44e4('0x5'))['db'];var utils=require(_0x44e4('0x6'));var logger=require(_0x44e4('0x7'))(_0x44e4('0x8'));var config=require('../../config/environment');var jayson=require(_0x44e4('0x9'));var client=jayson['client'][_0x44e4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1146d7,_0x4859d5,_0x138809){return new BPromise(function(_0x34a178,_0x5c1715){return client[_0x44e4('0xb')](_0x1146d7,_0x138809)[_0x44e4('0xc')](function(_0x3c937b){logger[_0x44e4('0xd')](_0x44e4('0xe'),_0x4859d5,_0x44e4('0xf'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4859d5,_0x44e4('0xf'),JSON[_0x44e4('0x10')](_0x3c937b));if(_0x3c937b[_0x44e4('0x11')]){if(_0x3c937b['error'][_0x44e4('0x12')]===0x1f4){logger[_0x44e4('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4859d5,_0x3c937b['error']['message']);return _0x5c1715(_0x3c937b[_0x44e4('0x11')][_0x44e4('0x13')]);}logger[_0x44e4('0x11')](_0x44e4('0xe'),_0x4859d5,_0x3c937b[_0x44e4('0x11')][_0x44e4('0x13')]);return _0x34a178(_0x3c937b['error'][_0x44e4('0x13')]);}else{logger['info'](_0x44e4('0xe'),_0x4859d5,_0x44e4('0xf'));_0x34a178(_0x3c937b[_0x44e4('0x14')]['message']);}})[_0x44e4('0x15')](function(_0x531d71){logger['error'](_0x44e4('0xe'),_0x4859d5,_0x531d71);_0x5c1715(_0x531d71);});});} \ No newline at end of file +var _0x1ead=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash'];(function(_0x1a8ab6,_0x4edd29){var _0x3348ee=function(_0x57051a){while(--_0x57051a){_0x1a8ab6['push'](_0x1a8ab6['shift']());}};_0x3348ee(++_0x4edd29);}(_0x1ead,0x99));var _0xd1ea=function(_0x2c716d,_0x5208c5){_0x2c716d=_0x2c716d-0x0;var _0x354865=_0x1ead[_0x2c716d];return _0x354865;};'use strict';var _=require(_0xd1ea('0x0'));var util=require(_0xd1ea('0x1'));var moment=require(_0xd1ea('0x2'));var BPromise=require(_0xd1ea('0x3'));var rs=require(_0xd1ea('0x4'));var fs=require('fs');var Redis=require(_0xd1ea('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd1ea('0x6'));var logger=require(_0xd1ea('0x7'))(_0xd1ea('0x8'));var config=require(_0xd1ea('0x9'));var jayson=require(_0xd1ea('0xa'));var client=jayson['client'][_0xd1ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x161d4e,_0x147fea,_0x19a0e6){return new BPromise(function(_0x3f6bd6,_0x255da8){return client[_0xd1ea('0xc')](_0x161d4e,_0x19a0e6)[_0xd1ea('0xd')](function(_0x12cf27){logger[_0xd1ea('0xe')](_0xd1ea('0xf'),_0x147fea,_0xd1ea('0x10'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x147fea,_0xd1ea('0x10'),JSON[_0xd1ea('0x11')](_0x12cf27));if(_0x12cf27[_0xd1ea('0x12')]){if(_0x12cf27[_0xd1ea('0x12')]['code']===0x1f4){logger[_0xd1ea('0x12')](_0xd1ea('0xf'),_0x147fea,_0x12cf27[_0xd1ea('0x12')][_0xd1ea('0x13')]);return _0x255da8(_0x12cf27['error']['message']);}logger[_0xd1ea('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x147fea,_0x12cf27['error'][_0xd1ea('0x13')]);return _0x3f6bd6(_0x12cf27[_0xd1ea('0x12')][_0xd1ea('0x13')]);}else{logger[_0xd1ea('0xe')](_0xd1ea('0xf'),_0x147fea,_0xd1ea('0x10'));_0x3f6bd6(_0x12cf27[_0xd1ea('0x14')][_0xd1ea('0x13')]);}})[_0xd1ea('0x15')](function(_0x344b43){logger[_0xd1ea('0x12')](_0xd1ea('0xf'),_0x147fea,_0x344b43);_0x255da8(_0x344b43);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 605f88a..f9bdcaf 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 _0xf586=['post','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x41635c,_0x4638f7){var _0x266eb9=function(_0x5c300e){while(--_0x5c300e){_0x41635c['push'](_0x41635c['shift']());}};_0x266eb9(++_0x4638f7);}(_0xf586,0xe2));var _0x6f58=function(_0x2a9ec5,_0xed23b){_0x2a9ec5=_0x2a9ec5-0x0;var _0x52c7c0=_0xf586[_0x2a9ec5];return _0x52c7c0;};'use strict';var multer=require(_0x6f58('0x0'));var util=require(_0x6f58('0x1'));var path=require(_0x6f58('0x2'));var timeout=require('connect-timeout');var express=require(_0x6f58('0x3'));var router=express[_0x6f58('0x4')]();var fs_extra=require(_0x6f58('0x5'));var auth=require(_0x6f58('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6f58('0x7'));var controller=require(_0x6f58('0x8'));router[_0x6f58('0x9')]('/',auth[_0x6f58('0xa')](),controller[_0x6f58('0xb')]);router[_0x6f58('0x9')](_0x6f58('0xc'),auth[_0x6f58('0xa')](),controller[_0x6f58('0xd')]);router[_0x6f58('0xe')]('/',auth[_0x6f58('0xa')](),controller[_0x6f58('0xf')]);router[_0x6f58('0x10')](_0x6f58('0xc'),auth[_0x6f58('0xa')](),controller['update']);router[_0x6f58('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x6f58('0x12')]);module[_0x6f58('0x13')]=router; \ No newline at end of file +var _0x7b24=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x7b24,0xbc));var _0x47b2=function(_0x21be6a,_0x18b8d8){_0x21be6a=_0x21be6a-0x0;var _0x596b7f=_0x7b24[_0x21be6a];return _0x596b7f;};'use strict';var multer=require(_0x47b2('0x0'));var util=require(_0x47b2('0x1'));var path=require(_0x47b2('0x2'));var timeout=require('connect-timeout');var express=require(_0x47b2('0x3'));var router=express[_0x47b2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47b2('0x5'));var interaction=require(_0x47b2('0x6'));var config=require(_0x47b2('0x7'));var controller=require(_0x47b2('0x8'));router[_0x47b2('0x9')]('/',auth[_0x47b2('0xa')](),controller['index']);router['get'](_0x47b2('0xb'),auth[_0x47b2('0xa')](),controller[_0x47b2('0xc')]);router[_0x47b2('0xd')]('/',auth[_0x47b2('0xa')](),controller[_0x47b2('0xe')]);router[_0x47b2('0xf')](_0x47b2('0xb'),auth[_0x47b2('0xa')](),controller[_0x47b2('0x10')]);router[_0x47b2('0x11')](_0x47b2('0xb'),auth[_0x47b2('0xa')](),controller['destroy']);module[_0x47b2('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 57272de..9737bb8 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 _0x8bfe=['customVariable','keyValue','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x789179,_0x455e5f){var _0x10878f=function(_0x450629){while(--_0x450629){_0x789179['push'](_0x789179['shift']());}};_0x10878f(++_0x455e5f);}(_0x8bfe,0x71));var _0xe8bf=function(_0x5c08cb,_0x456960){_0x5c08cb=_0x5c08cb-0x0;var _0x147907=_0x8bfe[_0x5c08cb];return _0x147907;};'use strict';var Sequelize=require(_0xe8bf('0x0'));module[_0xe8bf('0x1')]={'type':{'type':Sequelize[_0xe8bf('0x2')]('string',_0xe8bf('0x3'),_0xe8bf('0x4'),_0xe8bf('0x5'),'picklist'),'defaultValue':_0xe8bf('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xe8bf('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xe8bf('0x6'),'variable',_0xe8bf('0x4'))},'keyContent':{'type':Sequelize[_0xe8bf('0x7')]},'idField':{'type':Sequelize[_0xe8bf('0x7')]},'nameField':{'type':Sequelize[_0xe8bf('0x7')]},'customField':{'type':Sequelize[_0xe8bf('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe8bf('0x7')]}}; \ No newline at end of file +var _0x0025=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x35be08,_0x147d75){var _0x459fae=function(_0x16964b){while(--_0x16964b){_0x35be08['push'](_0x35be08['shift']());}};_0x459fae(++_0x147d75);}(_0x0025,0x6e));var _0x5002=function(_0x4b442a,_0x1daac7){_0x4b442a=_0x4b442a-0x0;var _0x193a35=_0x0025[_0x4b442a];return _0x193a35;};'use strict';var Sequelize=require('sequelize');module[_0x5002('0x0')]={'type':{'type':Sequelize[_0x5002('0x1')](_0x5002('0x2'),_0x5002('0x3'),_0x5002('0x4'),_0x5002('0x5'),_0x5002('0x6')),'defaultValue':_0x5002('0x2')},'content':{'type':Sequelize[_0x5002('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x5002('0x2'),_0x5002('0x3'),_0x5002('0x4'))},'keyContent':{'type':Sequelize[_0x5002('0x7')]},'idField':{'type':Sequelize[_0x5002('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5002('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5002('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 0b28e97..7ce7485 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 _0x3877=['fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','rimraf'];(function(_0x197381,_0x4c77b3){var _0x1d38c1=function(_0x5ce8c1){while(--_0x5ce8c1){_0x197381['push'](_0x197381['shift']());}};_0x1d38c1(++_0x4c77b3);}(_0x3877,0x1c1));var _0x7387=function(_0x1c1446,_0x25a1da){_0x1c1446=_0x1c1446-0x0;var _0x876879=_0x3877[_0x1c1446];return _0x876879;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7387('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7387('0x1'));var rp=require(_0x7387('0x2'));var moment=require(_0x7387('0x3'));var BPromise=require(_0x7387('0x4'));var Mustache=require(_0x7387('0x5'));var util=require(_0x7387('0x6'));var path=require('path');var sox=require(_0x7387('0x7'));var csv=require(_0x7387('0x8'));var ejs=require(_0x7387('0x9'));var fs=require('fs');var fs_extra=require(_0x7387('0xa'));var _=require(_0x7387('0xb'));var squel=require(_0x7387('0xc'));var crypto=require(_0x7387('0xd'));var jsforce=require(_0x7387('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7387('0xf'));var Papa=require(_0x7387('0x10'));var Redis=require(_0x7387('0x11'));var authService=require(_0x7387('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7387('0x13'));var hardwareService=require(_0x7387('0x14'));var logger=require(_0x7387('0x15'))('api');var utils=require(_0x7387('0x16'));var config=require(_0x7387('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7387('0x18'))['db'];function respondWithStatusCode(_0xe3221e,_0x272a9f){_0x272a9f=_0x272a9f||0xcc;return function(_0x521b98){if(_0x521b98){return _0xe3221e['sendStatus'](_0x272a9f);}return _0xe3221e[_0x7387('0x19')](_0x272a9f)[_0x7387('0x1a')]();};}function respondWithResult(_0x5b4271,_0x507c6a){_0x507c6a=_0x507c6a||0xc8;return function(_0xe885bf){if(_0xe885bf){return _0x5b4271['status'](_0x507c6a)[_0x7387('0x1b')](_0xe885bf);}};}function respondWithFilteredResult(_0x450986,_0x2e053b){return function(_0x3576eb){if(_0x3576eb){var _0x5e9c1c=typeof _0x2e053b[_0x7387('0x1c')]===_0x7387('0x1d')&&typeof _0x2e053b[_0x7387('0x1e')]==='undefined';var _0x33ddbd=_0x3576eb[_0x7387('0x1f')];var _0x442f87=_0x5e9c1c?0x0:_0x2e053b['offset'];var _0x23878d=_0x5e9c1c?_0x3576eb[_0x7387('0x1f')]:_0x2e053b[_0x7387('0x1c')]+_0x2e053b[_0x7387('0x1e')];var _0x1cd228;if(_0x23878d>=_0x33ddbd){_0x23878d=_0x33ddbd;_0x1cd228=0xc8;}else{_0x1cd228=0xce;}_0x450986[_0x7387('0x19')](_0x1cd228);return _0x450986['set'](_0x7387('0x20'),_0x442f87+'-'+_0x23878d+'/'+_0x33ddbd)[_0x7387('0x1b')](_0x3576eb);}return null;};}function patchUpdates(_0x25b45f){return function(_0x84656a){try{jsonpatch[_0x7387('0x21')](_0x84656a,_0x25b45f,!![]);}catch(_0x11b72d){return BPromise['reject'](_0x11b72d);}return _0x84656a[_0x7387('0x22')]();};}function saveUpdates(_0x1b88e5,_0x5473ef){return function(_0xdb1804){if(_0xdb1804){return _0xdb1804[_0x7387('0x23')](_0x1b88e5)[_0x7387('0x24')](function(_0x5d1ea8){return _0x5d1ea8;});}return null;};}function removeEntity(_0x486af1,_0xa20900){return function(_0x3b2b3d){if(_0x3b2b3d){return _0x3b2b3d[_0x7387('0x25')]()[_0x7387('0x24')](function(){_0x486af1[_0x7387('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x536193,_0x5afc24){return function(_0x1b132a){if(!_0x1b132a){_0x536193['sendStatus'](0x194);}return _0x1b132a;};}function handleError(_0x3d4a80,_0x42e369){_0x42e369=_0x42e369||0x1f4;return function(_0x197777){logger['error'](_0x197777[_0x7387('0x26')]);if(_0x197777['name']){delete _0x197777[_0x7387('0x27')];}_0x3d4a80[_0x7387('0x19')](_0x42e369)[_0x7387('0x28')](_0x197777);};}exports[_0x7387('0x29')]=function(_0x336e52,_0xdb7fc2){var _0x227f5d={},_0x3b0b3e={},_0x42c6ba={'count':0x0,'rows':[]};var _0x3525b1=_[_0x7387('0x2a')](db[_0x7387('0x2b')][_0x7387('0x2c')],function(_0x189419){return{'name':_0x189419[_0x7387('0x2d')],'type':_0x189419[_0x7387('0x2e')][_0x7387('0x2f')]};});_0x3b0b3e[_0x7387('0x30')]=_[_0x7387('0x2a')](_0x3525b1,_0x7387('0x27'));_0x3b0b3e[_0x7387('0x31')]=_[_0x7387('0x32')](_0x336e52[_0x7387('0x31')]);_0x3b0b3e['filters']=_[_0x7387('0x33')](_0x3b0b3e['model'],_0x3b0b3e[_0x7387('0x31')]);_0x227f5d[_0x7387('0x34')]=_['intersection'](_0x3b0b3e[_0x7387('0x30')],qs[_0x7387('0x35')](_0x336e52['query'][_0x7387('0x35')]));_0x227f5d[_0x7387('0x34')]=_0x227f5d[_0x7387('0x34')][_0x7387('0x36')]?_0x227f5d[_0x7387('0x34')]:_0x3b0b3e[_0x7387('0x30')];if(!_0x336e52[_0x7387('0x31')][_0x7387('0x37')](_0x7387('0x38'))){_0x227f5d[_0x7387('0x1e')]=qs[_0x7387('0x1e')](_0x336e52[_0x7387('0x31')][_0x7387('0x1e')]);_0x227f5d[_0x7387('0x1c')]=qs[_0x7387('0x1c')](_0x336e52['query'][_0x7387('0x1c')]);}_0x227f5d[_0x7387('0x39')]=qs[_0x7387('0x3a')](_0x336e52[_0x7387('0x31')]['sort']);_0x227f5d[_0x7387('0x3b')]=qs[_0x7387('0x3c')](_[_0x7387('0x3d')](_0x336e52[_0x7387('0x31')],_0x3b0b3e['filters']),_0x3525b1);if(_0x336e52['query'][_0x7387('0x3e')]){_0x227f5d[_0x7387('0x3b')]=_[_0x7387('0x3f')](_0x227f5d[_0x7387('0x3b')],{'$or':_[_0x7387('0x2a')](_0x3525b1,function(_0x16cb4c){if(_0x16cb4c[_0x7387('0x2e')]!==_0x7387('0x40')){var _0x6d4201={};_0x6d4201[_0x16cb4c[_0x7387('0x27')]]={'$like':'%'+_0x336e52['query'][_0x7387('0x3e')]+'%'};return _0x6d4201;}})});}_0x227f5d=_['merge']({},_0x227f5d,_0x336e52[_0x7387('0x41')]);var _0x6a2565={'where':_0x227f5d[_0x7387('0x3b')]};return db['ZendeskField'][_0x7387('0x1f')](_0x6a2565)[_0x7387('0x24')](function(_0x49bb5e){_0x42c6ba[_0x7387('0x1f')]=_0x49bb5e;if(_0x336e52['query'][_0x7387('0x42')]){_0x227f5d[_0x7387('0x43')]=[{'all':!![]}];}return db[_0x7387('0x2b')][_0x7387('0x44')](_0x227f5d);})['then'](function(_0x3f7552){_0x42c6ba[_0x7387('0x45')]=_0x3f7552;return _0x42c6ba;})[_0x7387('0x24')](respondWithFilteredResult(_0xdb7fc2,_0x227f5d))[_0x7387('0x46')](handleError(_0xdb7fc2,null));};exports['show']=function(_0x357e5e,_0x47cfdb){var _0x5ecf={'raw':!![],'where':{'id':_0x357e5e[_0x7387('0x47')]['id']}},_0x3560f0={};_0x3560f0[_0x7387('0x30')]=_[_0x7387('0x32')](db[_0x7387('0x2b')][_0x7387('0x2c')]);_0x3560f0[_0x7387('0x31')]=_[_0x7387('0x32')](_0x357e5e[_0x7387('0x31')]);_0x3560f0['filters']=_[_0x7387('0x33')](_0x3560f0[_0x7387('0x30')],_0x3560f0[_0x7387('0x31')]);_0x5ecf[_0x7387('0x34')]=_[_0x7387('0x33')](_0x3560f0[_0x7387('0x30')],qs[_0x7387('0x35')](_0x357e5e['query']['fields']));_0x5ecf['attributes']=_0x5ecf['attributes'][_0x7387('0x36')]?_0x5ecf[_0x7387('0x34')]:_0x3560f0[_0x7387('0x30')];if(_0x357e5e[_0x7387('0x31')]['includeAll']){_0x5ecf[_0x7387('0x43')]=[{'all':!![]}];}_0x5ecf=_[_0x7387('0x3f')]({},_0x5ecf,_0x357e5e[_0x7387('0x41')]);return db[_0x7387('0x2b')][_0x7387('0x48')](_0x5ecf)['then'](handleEntityNotFound(_0x47cfdb,null))['then'](respondWithResult(_0x47cfdb,null))[_0x7387('0x46')](handleError(_0x47cfdb,null));};exports[_0x7387('0x49')]=function(_0x341b8b,_0x1524b4){return db[_0x7387('0x2b')][_0x7387('0x49')](_0x341b8b[_0x7387('0x4a')],{})[_0x7387('0x24')](respondWithResult(_0x1524b4,0xc9))[_0x7387('0x46')](handleError(_0x1524b4,null));};exports[_0x7387('0x23')]=function(_0x4143dd,_0x7cfa7d){if(_0x4143dd['body']['id']){delete _0x4143dd[_0x7387('0x4a')]['id'];}return db[_0x7387('0x2b')]['find']({'where':{'id':_0x4143dd[_0x7387('0x47')]['id']}})[_0x7387('0x24')](handleEntityNotFound(_0x7cfa7d,null))[_0x7387('0x24')](saveUpdates(_0x4143dd['body'],null))[_0x7387('0x24')](respondWithResult(_0x7cfa7d,null))['catch'](handleError(_0x7cfa7d,null));};exports[_0x7387('0x25')]=function(_0x18075d,_0x2546b1){return db[_0x7387('0x2b')][_0x7387('0x48')]({'where':{'id':_0x18075d[_0x7387('0x47')]['id']}})[_0x7387('0x24')](handleEntityNotFound(_0x2546b1,null))[_0x7387('0x24')](removeEntity(_0x2546b1,null))[_0x7387('0x46')](handleError(_0x2546b1,null));}; \ No newline at end of file +var _0x72b8=['map','ZendeskField','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','catch','show','params','options','create','body','find','eml-format','rimraf','zip-dir','request-promise','mustache','util','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','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','end','stack','name','send'];(function(_0x328a31,_0x469e05){var _0x2e2591=function(_0x1b7f7a){while(--_0x1b7f7a){_0x328a31['push'](_0x328a31['shift']());}};_0x2e2591(++_0x469e05);}(_0x72b8,0x135));var _0x872b=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x72b8[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0x872b('0x0'));var rimraf=require(_0x872b('0x1'));var zipdir=require(_0x872b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x872b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x872b('0x4'));var util=require(_0x872b('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x872b('0x6'));var ejs=require(_0x872b('0x7'));var fs=require('fs');var fs_extra=require(_0x872b('0x8'));var _=require(_0x872b('0x9'));var squel=require('squel');var crypto=require(_0x872b('0xa'));var jsforce=require(_0x872b('0xb'));var deskjs=require(_0x872b('0xc'));var toCsv=require(_0x872b('0x6'));var querystring=require(_0x872b('0xd'));var Papa=require(_0x872b('0xe'));var Redis=require(_0x872b('0xf'));var authService=require(_0x872b('0x10'));var qs=require(_0x872b('0x11'));var as=require(_0x872b('0x12'));var hardwareService=require(_0x872b('0x13'));var logger=require('../../config/logger')(_0x872b('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x872b('0x15'));var db=require(_0x872b('0x16'))['db'];function respondWithStatusCode(_0x410e93,_0x2fb64f){_0x2fb64f=_0x2fb64f||0xcc;return function(_0x38b15b){if(_0x38b15b){return _0x410e93[_0x872b('0x17')](_0x2fb64f);}return _0x410e93[_0x872b('0x18')](_0x2fb64f)['end']();};}function respondWithResult(_0x3ae390,_0x89e2fc){_0x89e2fc=_0x89e2fc||0xc8;return function(_0x1a821d){if(_0x1a821d){return _0x3ae390[_0x872b('0x18')](_0x89e2fc)[_0x872b('0x19')](_0x1a821d);}};}function respondWithFilteredResult(_0x1a3729,_0x3ef1a2){return function(_0x32fa53){if(_0x32fa53){var _0x163466=typeof _0x3ef1a2['offset']==='undefined'&&typeof _0x3ef1a2['limit']===_0x872b('0x1a');var _0x4ee9da=_0x32fa53[_0x872b('0x1b')];var _0xe018a=_0x163466?0x0:_0x3ef1a2['offset'];var _0x30e59b=_0x163466?_0x32fa53[_0x872b('0x1b')]:_0x3ef1a2[_0x872b('0x1c')]+_0x3ef1a2[_0x872b('0x1d')];var _0x3f936b;if(_0x30e59b>=_0x4ee9da){_0x30e59b=_0x4ee9da;_0x3f936b=0xc8;}else{_0x3f936b=0xce;}_0x1a3729[_0x872b('0x18')](_0x3f936b);return _0x1a3729[_0x872b('0x1e')]('Content-Range',_0xe018a+'-'+_0x30e59b+'/'+_0x4ee9da)['json'](_0x32fa53);}return null;};}function patchUpdates(_0x223c0d){return function(_0x5c42d1){try{jsonpatch[_0x872b('0x1f')](_0x5c42d1,_0x223c0d,!![]);}catch(_0x4fdd09){return BPromise[_0x872b('0x20')](_0x4fdd09);}return _0x5c42d1[_0x872b('0x21')]();};}function saveUpdates(_0x1647b9,_0xf5e77a){return function(_0x2c8aff){if(_0x2c8aff){return _0x2c8aff[_0x872b('0x22')](_0x1647b9)[_0x872b('0x23')](function(_0x299c44){return _0x299c44;});}return null;};}function removeEntity(_0x4ef230,_0x2a8297){return function(_0x15a7cb){if(_0x15a7cb){return _0x15a7cb[_0x872b('0x24')]()[_0x872b('0x23')](function(){_0x4ef230[_0x872b('0x18')](0xcc)[_0x872b('0x25')]();});}};}function handleEntityNotFound(_0x31cf4e,_0x5e523e){return function(_0x37fc2f){if(!_0x37fc2f){_0x31cf4e[_0x872b('0x17')](0x194);}return _0x37fc2f;};}function handleError(_0x4657e3,_0x4eb6b7){_0x4eb6b7=_0x4eb6b7||0x1f4;return function(_0x3409f2){logger['error'](_0x3409f2[_0x872b('0x26')]);if(_0x3409f2[_0x872b('0x27')]){delete _0x3409f2[_0x872b('0x27')];}_0x4657e3[_0x872b('0x18')](_0x4eb6b7)[_0x872b('0x28')](_0x3409f2);};}exports['index']=function(_0x2404ef,_0xebe14){var _0xa36938={},_0x160fc1={},_0x43af5a={'count':0x0,'rows':[]};var _0x241bea=_[_0x872b('0x29')](db[_0x872b('0x2a')][_0x872b('0x2b')],function(_0x32acfc){return{'name':_0x32acfc['fieldName'],'type':_0x32acfc[_0x872b('0x2c')][_0x872b('0x2d')]};});_0x160fc1[_0x872b('0x2e')]=_[_0x872b('0x29')](_0x241bea,'name');_0x160fc1['query']=_[_0x872b('0x2f')](_0x2404ef[_0x872b('0x30')]);_0x160fc1[_0x872b('0x31')]=_['intersection'](_0x160fc1['model'],_0x160fc1[_0x872b('0x30')]);_0xa36938['attributes']=_[_0x872b('0x32')](_0x160fc1[_0x872b('0x2e')],qs[_0x872b('0x33')](_0x2404ef[_0x872b('0x30')][_0x872b('0x33')]));_0xa36938[_0x872b('0x34')]=_0xa36938[_0x872b('0x34')][_0x872b('0x35')]?_0xa36938[_0x872b('0x34')]:_0x160fc1[_0x872b('0x2e')];if(!_0x2404ef['query'][_0x872b('0x36')](_0x872b('0x37'))){_0xa36938['limit']=qs[_0x872b('0x1d')](_0x2404ef[_0x872b('0x30')]['limit']);_0xa36938['offset']=qs[_0x872b('0x1c')](_0x2404ef[_0x872b('0x30')]['offset']);}_0xa36938[_0x872b('0x38')]=qs[_0x872b('0x39')](_0x2404ef[_0x872b('0x30')][_0x872b('0x39')]);_0xa36938[_0x872b('0x3a')]=qs[_0x872b('0x31')](_[_0x872b('0x3b')](_0x2404ef[_0x872b('0x30')],_0x160fc1[_0x872b('0x31')]),_0x241bea);if(_0x2404ef[_0x872b('0x30')][_0x872b('0x3c')]){_0xa36938['where']=_['merge'](_0xa36938[_0x872b('0x3a')],{'$or':_[_0x872b('0x29')](_0x241bea,function(_0x43a031){if(_0x43a031[_0x872b('0x2c')]!==_0x872b('0x3d')){var _0x484443={};_0x484443[_0x43a031[_0x872b('0x27')]]={'$like':'%'+_0x2404ef[_0x872b('0x30')][_0x872b('0x3c')]+'%'};return _0x484443;}})});}_0xa36938=_['merge']({},_0xa36938,_0x2404ef['options']);var _0xa1a8c1={'where':_0xa36938['where']};return db[_0x872b('0x2a')][_0x872b('0x1b')](_0xa1a8c1)['then'](function(_0x5c6e80){_0x43af5a[_0x872b('0x1b')]=_0x5c6e80;if(_0x2404ef[_0x872b('0x30')][_0x872b('0x3e')]){_0xa36938['include']=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0xa36938);})[_0x872b('0x23')](function(_0x3de900){_0x43af5a['rows']=_0x3de900;return _0x43af5a;})[_0x872b('0x23')](respondWithFilteredResult(_0xebe14,_0xa36938))[_0x872b('0x3f')](handleError(_0xebe14,null));};exports[_0x872b('0x40')]=function(_0x3a03fb,_0x5a0c6a){var _0x57700b={'raw':!![],'where':{'id':_0x3a03fb[_0x872b('0x41')]['id']}},_0x5cce65={};_0x5cce65[_0x872b('0x2e')]=_[_0x872b('0x2f')](db[_0x872b('0x2a')][_0x872b('0x2b')]);_0x5cce65[_0x872b('0x30')]=_[_0x872b('0x2f')](_0x3a03fb['query']);_0x5cce65['filters']=_[_0x872b('0x32')](_0x5cce65[_0x872b('0x2e')],_0x5cce65[_0x872b('0x30')]);_0x57700b[_0x872b('0x34')]=_[_0x872b('0x32')](_0x5cce65[_0x872b('0x2e')],qs[_0x872b('0x33')](_0x3a03fb[_0x872b('0x30')][_0x872b('0x33')]));_0x57700b['attributes']=_0x57700b[_0x872b('0x34')][_0x872b('0x35')]?_0x57700b['attributes']:_0x5cce65[_0x872b('0x2e')];if(_0x3a03fb[_0x872b('0x30')][_0x872b('0x3e')]){_0x57700b['include']=[{'all':!![]}];}_0x57700b=_['merge']({},_0x57700b,_0x3a03fb[_0x872b('0x42')]);return db[_0x872b('0x2a')]['find'](_0x57700b)[_0x872b('0x23')](handleEntityNotFound(_0x5a0c6a,null))['then'](respondWithResult(_0x5a0c6a,null))[_0x872b('0x3f')](handleError(_0x5a0c6a,null));};exports['create']=function(_0x3c71e8,_0x5a9642){return db[_0x872b('0x2a')][_0x872b('0x43')](_0x3c71e8['body'],{})[_0x872b('0x23')](respondWithResult(_0x5a9642,0xc9))['catch'](handleError(_0x5a9642,null));};exports[_0x872b('0x22')]=function(_0x5c616b,_0x1c8584){if(_0x5c616b[_0x872b('0x44')]['id']){delete _0x5c616b[_0x872b('0x44')]['id'];}return db['ZendeskField'][_0x872b('0x45')]({'where':{'id':_0x5c616b[_0x872b('0x41')]['id']}})[_0x872b('0x23')](handleEntityNotFound(_0x1c8584,null))[_0x872b('0x23')](saveUpdates(_0x5c616b[_0x872b('0x44')],null))['then'](respondWithResult(_0x1c8584,null))[_0x872b('0x3f')](handleError(_0x1c8584,null));};exports['destroy']=function(_0x4a832a,_0x411f2a){return db[_0x872b('0x2a')][_0x872b('0x45')]({'where':{'id':_0x4a832a[_0x872b('0x41')]['id']}})[_0x872b('0x23')](handleEntityNotFound(_0x411f2a,null))[_0x872b('0x23')](removeEntity(_0x411f2a,null))[_0x872b('0x3f')](handleError(_0x411f2a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 4854dea..227a6af 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 _0xef36=['./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','idField','lodash','util','bluebird','path','rimraf','../../config/environment'];(function(_0x3028d4,_0x4f185b){var _0x2eb2b1=function(_0x3a8d7e){while(--_0x3a8d7e){_0x3028d4['push'](_0x3028d4['shift']());}};_0x2eb2b1(++_0x4f185b);}(_0xef36,0x1b6));var _0x6ef3=function(_0x3e93f3,_0x340bef){_0x3e93f3=_0x3e93f3-0x0;var _0x3db28e=_0xef36[_0x3e93f3];return _0x3db28e;};'use strict';var _=require(_0x6ef3('0x0'));var util=require(_0x6ef3('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6ef3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ef3('0x3'));var rimraf=require(_0x6ef3('0x4'));var config=require(_0x6ef3('0x5'));var attributes=require(_0x6ef3('0x6'));module[_0x6ef3('0x7')]=function(_0x4852bd,_0x4e0149){return _0x4852bd[_0x6ef3('0x8')](_0x6ef3('0x9'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x6ef3('0xa'),'fields':[_0x6ef3('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2448=['request-promise','rimraf','../../config/environment','./intZendeskField.attributes','define','ZendeskField','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1ca3cf,_0x18b5cc){var _0x21cdf7=function(_0x4e5342){while(--_0x4e5342){_0x1ca3cf['push'](_0x1ca3cf['shift']());}};_0x21cdf7(++_0x18b5cc);}(_0x2448,0x1e9));var _0x8244=function(_0x30ca12,_0x4b16b4){_0x30ca12=_0x30ca12-0x0;var _0x171ec1=_0x2448[_0x30ca12];return _0x171ec1;};'use strict';var _=require(_0x8244('0x0'));var util=require(_0x8244('0x1'));var logger=require(_0x8244('0x2'))(_0x8244('0x3'));var moment=require(_0x8244('0x4'));var BPromise=require(_0x8244('0x5'));var rp=require(_0x8244('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8244('0x7'));var config=require(_0x8244('0x8'));var attributes=require(_0x8244('0x9'));module['exports']=function(_0x345f99,_0x41c7e9){return _0x345f99[_0x8244('0xa')](_0x8244('0xb'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x8244('0xc'),'fields':[_0x8244('0xd'),_0x8244('0xe')],'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 a8dc80b..2c34dce 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 _0x9dae=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x2f12b6,_0x13795d){var _0xb39f=function(_0x41c19d){while(--_0x41c19d){_0x2f12b6['push'](_0x2f12b6['shift']());}};_0xb39f(++_0x13795d);}(_0x9dae,0x1b9));var _0xe9da=function(_0x45a363,_0x10bd28){_0x45a363=_0x45a363-0x0;var _0x554b54=_0x9dae[_0x45a363];return _0x554b54;};'use strict';var _=require(_0xe9da('0x0'));var util=require(_0xe9da('0x1'));var moment=require(_0xe9da('0x2'));var BPromise=require(_0xe9da('0x3'));var rs=require(_0xe9da('0x4'));var fs=require('fs');var Redis=require(_0xe9da('0x5'));var db=require(_0xe9da('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe9da('0x7'));var config=require('../../config/environment');var jayson=require(_0xe9da('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x576e84,_0x90125,_0x24511e){return new BPromise(function(_0x12a54b,_0x530f2d){return client[_0xe9da('0x9')](_0x576e84,_0x24511e)[_0xe9da('0xa')](function(_0x573af3){logger[_0xe9da('0xb')](_0xe9da('0xc'),_0x90125,_0xe9da('0xd'));logger[_0xe9da('0xe')](_0xe9da('0xf'),_0x90125,_0xe9da('0xd'),JSON[_0xe9da('0x10')](_0x573af3));if(_0x573af3[_0xe9da('0x11')]){if(_0x573af3[_0xe9da('0x11')][_0xe9da('0x12')]===0x1f4){logger[_0xe9da('0x11')]('ZendeskField,\x20%s,\x20%s',_0x90125,_0x573af3[_0xe9da('0x11')][_0xe9da('0x13')]);return _0x530f2d(_0x573af3['error'][_0xe9da('0x13')]);}logger[_0xe9da('0x11')]('ZendeskField,\x20%s,\x20%s',_0x90125,_0x573af3[_0xe9da('0x11')][_0xe9da('0x13')]);return _0x12a54b(_0x573af3[_0xe9da('0x11')][_0xe9da('0x13')]);}else{logger[_0xe9da('0xb')](_0xe9da('0xc'),_0x90125,_0xe9da('0xd'));_0x12a54b(_0x573af3['result']['message']);}})[_0xe9da('0x14')](function(_0x3b6853){logger[_0xe9da('0x11')]('ZendeskField,\x20%s,\x20%s',_0x90125,_0x3b6853);_0x530f2d(_0x3b6853);});});} \ No newline at end of file +var _0x1297=['error','code','ZendeskField,\x20%s,\x20%s','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x1297,0x14f));var _0x7129=function(_0x42b507,_0x3a2a46){_0x42b507=_0x42b507-0x0;var _0x1171b3=_0x1297[_0x42b507];return _0x1171b3;};'use strict';var _=require('lodash');var util=require(_0x7129('0x0'));var moment=require('moment');var BPromise=require(_0x7129('0x1'));var rs=require(_0x7129('0x2'));var fs=require('fs');var Redis=require(_0x7129('0x3'));var db=require(_0x7129('0x4'))['db'];var utils=require(_0x7129('0x5'));var logger=require(_0x7129('0x6'))(_0x7129('0x7'));var config=require(_0x7129('0x8'));var jayson=require(_0x7129('0x9'));var client=jayson[_0x7129('0xa')][_0x7129('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2145d1,_0x31560c,_0x6b8384){return new BPromise(function(_0x401d7b,_0x272543){return client['request'](_0x2145d1,_0x6b8384)['then'](function(_0x53f929){logger[_0x7129('0xc')]('ZendeskField,\x20%s,\x20%s',_0x31560c,_0x7129('0xd'));logger[_0x7129('0xe')](_0x7129('0xf'),_0x31560c,_0x7129('0xd'),JSON[_0x7129('0x10')](_0x53f929));if(_0x53f929[_0x7129('0x11')]){if(_0x53f929[_0x7129('0x11')][_0x7129('0x12')]===0x1f4){logger[_0x7129('0x11')](_0x7129('0x13'),_0x31560c,_0x53f929['error'][_0x7129('0x14')]);return _0x272543(_0x53f929[_0x7129('0x11')][_0x7129('0x14')]);}logger[_0x7129('0x11')](_0x7129('0x13'),_0x31560c,_0x53f929[_0x7129('0x11')]['message']);return _0x401d7b(_0x53f929[_0x7129('0x11')][_0x7129('0x14')]);}else{logger[_0x7129('0xc')](_0x7129('0x13'),_0x31560c,_0x7129('0xd'));_0x401d7b(_0x53f929[_0x7129('0x15')]['message']);}})['catch'](function(_0x1bcc75){logger[_0x7129('0x11')](_0x7129('0x13'),_0x31560c,_0x1bcc75);_0x272543(_0x1bcc75);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index e205720..97ff46f 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 _0xaf3c=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete'];(function(_0x33c0ce,_0x17513a){var _0x4f758d=function(_0x6ec558){while(--_0x6ec558){_0x33c0ce['push'](_0x33c0ce['shift']());}};_0x4f758d(++_0x17513a);}(_0xaf3c,0x109));var _0xcaf3=function(_0x59fd84,_0x3df774){_0x59fd84=_0x59fd84-0x0;var _0x3bbb6f=_0xaf3c[_0x59fd84];return _0x3bbb6f;};'use strict';var multer=require(_0xcaf3('0x0'));var util=require('util');var path=require(_0xcaf3('0x1'));var timeout=require(_0xcaf3('0x2'));var express=require(_0xcaf3('0x3'));var router=express[_0xcaf3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcaf3('0x5'));var interaction=require(_0xcaf3('0x6'));var config=require(_0xcaf3('0x7'));var controller=require(_0xcaf3('0x8'));router['get']('/',auth[_0xcaf3('0x9')](),controller[_0xcaf3('0xa')]);router['get'](_0xcaf3('0xb'),auth[_0xcaf3('0x9')](),controller[_0xcaf3('0xc')]);router[_0xcaf3('0xd')](_0xcaf3('0xe'),auth['isAuthenticated'](),controller[_0xcaf3('0xf')]);router[_0xcaf3('0xd')](_0xcaf3('0x10'),auth[_0xcaf3('0x9')](),controller[_0xcaf3('0x11')]);router[_0xcaf3('0x12')]('/',auth['isAuthenticated'](),controller[_0xcaf3('0x13')]);router[_0xcaf3('0x12')]('/:id/configurations',auth[_0xcaf3('0x9')](),controller[_0xcaf3('0x14')]);router[_0xcaf3('0x15')](_0xcaf3('0xb'),auth[_0xcaf3('0x9')](),controller['update']);router[_0xcaf3('0x16')](_0xcaf3('0xb'),auth[_0xcaf3('0x9')](),controller['destroy']);module[_0xcaf3('0x17')]=router; \ No newline at end of file +var _0xd696=['create','/:id/configurations','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../config/environment','./intZohoAccount.controller','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post'];(function(_0x1ac35c,_0x50421d){var _0x7fd6d5=function(_0x5b2cc5){while(--_0x5b2cc5){_0x1ac35c['push'](_0x1ac35c['shift']());}};_0x7fd6d5(++_0x50421d);}(_0xd696,0xcd));var _0x6d69=function(_0x7fd9e9,_0x1765d0){_0x7fd9e9=_0x7fd9e9-0x0;var _0x285d92=_0xd696[_0x7fd9e9];return _0x285d92;};'use strict';var multer=require(_0x6d69('0x0'));var util=require(_0x6d69('0x1'));var path=require(_0x6d69('0x2'));var timeout=require(_0x6d69('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6d69('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6d69('0x5'));var controller=require(_0x6d69('0x6'));router[_0x6d69('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6d69('0x7')](_0x6d69('0x8'),auth[_0x6d69('0x9')](),controller[_0x6d69('0xa')]);router[_0x6d69('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x6d69('0xb')]);router[_0x6d69('0x7')](_0x6d69('0xc'),auth[_0x6d69('0x9')](),controller[_0x6d69('0xd')]);router[_0x6d69('0xe')]('/',auth[_0x6d69('0x9')](),controller[_0x6d69('0xf')]);router[_0x6d69('0xe')](_0x6d69('0x10'),auth[_0x6d69('0x9')](),controller[_0x6d69('0x11')]);router[_0x6d69('0x12')](_0x6d69('0x8'),auth[_0x6d69('0x9')](),controller[_0x6d69('0x13')]);router[_0x6d69('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x6d69('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 4fe0dda..c0293cb 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 _0x4bc3=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4bc3,0x16e));var _0x34bc=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x4bc3[_0x1969a7];return _0x3d665f;};'use strict';var Sequelize=require(_0x34bc('0x0'));module[_0x34bc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x34bc('0x2')]},'host':{'type':Sequelize[_0x34bc('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x34bc('0x2')]},'clientSecret':{'type':Sequelize[_0x34bc('0x2')]},'serverUrl':{'type':Sequelize[_0x34bc('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x34bc('0x2')]},'refreshToken':{'type':Sequelize[_0x34bc('0x2')]}}; \ No newline at end of file +var _0x4ea3=['STRING','sequelize','exports'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x4ea3,0x70));var _0x34ea=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4ea3[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x34ea('0x0'));module[_0x34ea('0x1')]={'name':{'type':Sequelize[_0x34ea('0x2')]},'description':{'type':Sequelize[_0x34ea('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x34ea('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x34ea('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x34ea('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 94ab545..f73a9d3 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 _0xf2cf=['eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','zone','serverUrl','code','zoho.eu','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Duration','Call_Type','remove','includes','api_name','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send'];(function(_0xe5964c,_0x5fd1ec){var _0x46a276=function(_0x274961){while(--_0x274961){_0xe5964c['push'](_0xe5964c['shift']());}};_0x46a276(++_0x5fd1ec);}(_0xf2cf,0x16e));var _0xff2c=function(_0x2136b8,_0x415b6e){_0x2136b8=_0x2136b8-0x0;var _0x3d651c=_0xf2cf[_0x2136b8];return _0x3d651c;};'use strict';var emlformat=require(_0xff2c('0x0'));var rimraf=require(_0xff2c('0x1'));var zipdir=require(_0xff2c('0x2'));var jsonpatch=require(_0xff2c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xff2c('0x4'));var Mustache=require(_0xff2c('0x5'));var util=require('util');var path=require(_0xff2c('0x6'));var sox=require('sox');var csv=require(_0xff2c('0x7'));var ejs=require(_0xff2c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xff2c('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xff2c('0xa'));var deskjs=require(_0xff2c('0xb'));var toCsv=require(_0xff2c('0x7'));var querystring=require(_0xff2c('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xff2c('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xff2c('0xe'))(_0xff2c('0xf'));var utils=require(_0xff2c('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xff2c('0x11'));var db=require(_0xff2c('0x12'))['db'];var integrations=require(_0xff2c('0x13'));function respondWithStatusCode(_0x15f63d,_0x58d341){_0x58d341=_0x58d341||0xcc;return function(_0x22be0c){if(_0x22be0c){return _0x15f63d[_0xff2c('0x14')](_0x58d341);}return _0x15f63d[_0xff2c('0x15')](_0x58d341)['end']();};}function respondWithResult(_0x3fad0a,_0x4b5290){_0x4b5290=_0x4b5290||0xc8;return function(_0x325702){if(_0x325702){return _0x3fad0a[_0xff2c('0x15')](_0x4b5290)[_0xff2c('0x16')](_0x325702);}};}function respondWithFilteredResult(_0x2dcbe2,_0x813184){return function(_0xdb8ddf){if(_0xdb8ddf){var _0x522cd6=typeof _0x813184[_0xff2c('0x17')]===_0xff2c('0x18')&&typeof _0x813184[_0xff2c('0x19')]===_0xff2c('0x18');var _0x4f72f4=_0xdb8ddf[_0xff2c('0x1a')];var _0x85a078=_0x522cd6?0x0:_0x813184['offset'];var _0x17b948=_0x522cd6?_0xdb8ddf[_0xff2c('0x1a')]:_0x813184[_0xff2c('0x17')]+_0x813184[_0xff2c('0x19')];var _0x53ef98;if(_0x17b948>=_0x4f72f4){_0x17b948=_0x4f72f4;_0x53ef98=0xc8;}else{_0x53ef98=0xce;}_0x2dcbe2[_0xff2c('0x15')](_0x53ef98);return _0x2dcbe2[_0xff2c('0x1b')](_0xff2c('0x1c'),_0x85a078+'-'+_0x17b948+'/'+_0x4f72f4)[_0xff2c('0x16')](_0xdb8ddf);}return null;};}function patchUpdates(_0x1fa3fd){return function(_0xf4f18){try{jsonpatch['apply'](_0xf4f18,_0x1fa3fd,!![]);}catch(_0x5272e6){return BPromise['reject'](_0x5272e6);}return _0xf4f18[_0xff2c('0x1d')]();};}function saveUpdates(_0x5e0acb,_0x28dc55){return function(_0x5f2bf6){if(_0x5f2bf6){return _0x5f2bf6[_0xff2c('0x1e')](_0x5e0acb)[_0xff2c('0x1f')](function(_0x1902c7){return _0x1902c7;});}return null;};}function removeEntity(_0x37c798,_0x4efdb1){return function(_0x208fda){if(_0x208fda){return _0x208fda[_0xff2c('0x20')]()[_0xff2c('0x1f')](function(){_0x37c798[_0xff2c('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ccff2,_0xae72f3){return function(_0x45be10){if(!_0x45be10){_0x5ccff2[_0xff2c('0x14')](0x194);}return _0x45be10;};}function handleError(_0x1c4748,_0xc801ea){_0xc801ea=_0xc801ea||0x1f4;return function(_0x11b24e){logger[_0xff2c('0x21')](_0x11b24e[_0xff2c('0x22')]);if(_0x11b24e[_0xff2c('0x23')]){delete _0x11b24e[_0xff2c('0x23')];}_0x1c4748['status'](_0xc801ea)['send'](_0x11b24e);};}exports[_0xff2c('0x24')]=function(_0x320128,_0x501f4a){var _0x146254={},_0x3ac034={},_0x240a66={'count':0x0,'rows':[]};var _0x4ae105=_[_0xff2c('0x25')](db[_0xff2c('0x26')][_0xff2c('0x27')],function(_0xff609b){return{'name':_0xff609b[_0xff2c('0x28')],'type':_0xff609b[_0xff2c('0x29')]['key']};});_0x3ac034[_0xff2c('0x2a')]=_['map'](_0x4ae105,'name');_0x3ac034[_0xff2c('0x2b')]=_[_0xff2c('0x2c')](_0x320128[_0xff2c('0x2b')]);_0x3ac034[_0xff2c('0x2d')]=_[_0xff2c('0x2e')](_0x3ac034['model'],_0x3ac034[_0xff2c('0x2b')]);_0x146254['attributes']=_[_0xff2c('0x2e')](_0x3ac034[_0xff2c('0x2a')],qs[_0xff2c('0x2f')](_0x320128['query'][_0xff2c('0x2f')]));_0x146254[_0xff2c('0x30')]=_0x146254['attributes'][_0xff2c('0x31')]?_0x146254['attributes']:_0x3ac034[_0xff2c('0x2a')];if(!_0x320128[_0xff2c('0x2b')][_0xff2c('0x32')]('nolimit')){_0x146254['limit']=qs[_0xff2c('0x19')](_0x320128[_0xff2c('0x2b')][_0xff2c('0x19')]);_0x146254[_0xff2c('0x17')]=qs[_0xff2c('0x17')](_0x320128[_0xff2c('0x2b')][_0xff2c('0x17')]);}_0x146254[_0xff2c('0x33')]=qs[_0xff2c('0x34')](_0x320128[_0xff2c('0x2b')][_0xff2c('0x34')]);_0x146254[_0xff2c('0x35')]=qs['filters'](_['pick'](_0x320128[_0xff2c('0x2b')],_0x3ac034[_0xff2c('0x2d')]),_0x4ae105);if(_0x320128[_0xff2c('0x2b')]['filter']){_0x146254[_0xff2c('0x35')]=_['merge'](_0x146254[_0xff2c('0x35')],{'$or':_[_0xff2c('0x25')](_0x4ae105,function(_0x494e0a){if(_0x494e0a[_0xff2c('0x29')]!==_0xff2c('0x36')){var _0x4c2098={};_0x4c2098[_0x494e0a[_0xff2c('0x23')]]={'$like':'%'+_0x320128['query'][_0xff2c('0x37')]+'%'};return _0x4c2098;}})});}_0x146254=_[_0xff2c('0x38')]({},_0x146254,_0x320128['options']);var _0x5f1c77={'where':_0x146254[_0xff2c('0x35')]};return db[_0xff2c('0x26')]['count'](_0x5f1c77)[_0xff2c('0x1f')](function(_0x6177ca){_0x240a66[_0xff2c('0x1a')]=_0x6177ca;if(_0x320128[_0xff2c('0x2b')][_0xff2c('0x39')]){_0x146254[_0xff2c('0x3a')]=[{'all':!![]}];}return db[_0xff2c('0x26')][_0xff2c('0x3b')](_0x146254);})[_0xff2c('0x1f')](function(_0x456ea0){_0x240a66[_0xff2c('0x3c')]=_0x456ea0;return _0x240a66;})[_0xff2c('0x1f')](respondWithFilteredResult(_0x501f4a,_0x146254))[_0xff2c('0x3d')](handleError(_0x501f4a,null));};exports[_0xff2c('0x3e')]=function(_0x1dc56d,_0x1479ab){var _0x13c72e={'raw':![],'where':{'id':_0x1dc56d[_0xff2c('0x3f')]['id']}},_0x8aeed7={};_0x8aeed7['model']=_[_0xff2c('0x2c')](db[_0xff2c('0x26')][_0xff2c('0x27')]);_0x8aeed7[_0xff2c('0x2b')]=_[_0xff2c('0x2c')](_0x1dc56d[_0xff2c('0x2b')]);_0x8aeed7['filters']=_[_0xff2c('0x2e')](_0x8aeed7[_0xff2c('0x2a')],_0x8aeed7['query']);_0x13c72e[_0xff2c('0x30')]=_['intersection'](_0x8aeed7[_0xff2c('0x2a')],qs[_0xff2c('0x2f')](_0x1dc56d[_0xff2c('0x2b')][_0xff2c('0x2f')]));_0x13c72e[_0xff2c('0x30')]=_0x13c72e[_0xff2c('0x30')][_0xff2c('0x31')]?_0x13c72e[_0xff2c('0x30')]:_0x8aeed7[_0xff2c('0x2a')];if(_0x1dc56d[_0xff2c('0x2b')][_0xff2c('0x39')]){_0x13c72e[_0xff2c('0x3a')]=[{'all':!![]}];}_0x13c72e=_[_0xff2c('0x38')]({},_0x13c72e,_0x1dc56d['options']);return db[_0xff2c('0x26')][_0xff2c('0x40')](_0x13c72e)[_0xff2c('0x1f')](handleEntityNotFound(_0x1479ab,null))[_0xff2c('0x1f')](respondWithResult(_0x1479ab,null))[_0xff2c('0x3d')](handleError(_0x1479ab,null));};exports[_0xff2c('0x41')]=function(_0x49c680,_0x284b44){return db[_0xff2c('0x26')][_0xff2c('0x41')](_0x49c680[_0xff2c('0x42')],{})[_0xff2c('0x1f')](respondWithResult(_0x284b44,0xc9))['catch'](handleError(_0x284b44,null));};exports[_0xff2c('0x1e')]=function(_0x1eb538,_0x2eb374){if(_0x1eb538[_0xff2c('0x42')]['id']){delete _0x1eb538[_0xff2c('0x42')]['id'];}return db[_0xff2c('0x26')][_0xff2c('0x40')]({'where':{'id':_0x1eb538['params']['id']}})[_0xff2c('0x1f')](handleEntityNotFound(_0x2eb374,null))[_0xff2c('0x1f')](saveUpdates(_0x1eb538[_0xff2c('0x42')],null))[_0xff2c('0x1f')](respondWithResult(_0x2eb374,null))['catch'](handleError(_0x2eb374,null));};exports[_0xff2c('0x20')]=function(_0x3ff190,_0x4f4563){return db[_0xff2c('0x26')][_0xff2c('0x40')]({'where':{'id':_0x3ff190[_0xff2c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4f4563,null))[_0xff2c('0x1f')](removeEntity(_0x4f4563,null))[_0xff2c('0x3d')](handleError(_0x4f4563,null));};exports['getConfigurations']=function(_0x32c052,_0x2e8349,_0x5aee53){var _0x76c436={};var _0x562747={};var _0x33f3b5;var _0x335dcf;return db['ZohoAccount'][_0xff2c('0x43')]({'where':{'id':_0x32c052[_0xff2c('0x3f')]['id']}})[_0xff2c('0x1f')](handleEntityNotFound(_0x2e8349,null))[_0xff2c('0x1f')](function(_0x348253){if(_0x348253){_0x33f3b5=_0x348253;_0x562747[_0xff2c('0x2a')]=_['keys'](db['ZohoConfiguration']['rawAttributes']);_0x562747['query']=_[_0xff2c('0x2c')](_0x32c052[_0xff2c('0x2b')]);_0x562747[_0xff2c('0x2d')]=_['intersection'](_0x562747['model'],_0x562747[_0xff2c('0x2b')]);_0x76c436[_0xff2c('0x30')]=_[_0xff2c('0x2e')](_0x562747[_0xff2c('0x2a')],qs[_0xff2c('0x2f')](_0x32c052[_0xff2c('0x2b')][_0xff2c('0x2f')]));_0x76c436['attributes']=_0x76c436[_0xff2c('0x30')][_0xff2c('0x31')]?_0x76c436[_0xff2c('0x30')]:_0x562747['model'];_0x76c436[_0xff2c('0x33')]=qs['sort'](_0x32c052['query']['sort']);_0x76c436[_0xff2c('0x35')]=qs['filters'](_['pick'](_0x32c052[_0xff2c('0x2b')],_0x562747['filters']));if(_0x32c052[_0xff2c('0x2b')][_0xff2c('0x37')]){_0x76c436['where']=_[_0xff2c('0x38')](_0x76c436[_0xff2c('0x35')],{'$or':_[_0xff2c('0x25')](_0x76c436[_0xff2c('0x30')],function(_0x1b4414){var _0x73c78e={};_0x73c78e[_0x1b4414]={'$like':'%'+_0x32c052['query'][_0xff2c('0x37')]+'%'};return _0x73c78e;})});}_0x76c436=_[_0xff2c('0x38')]({},_0x76c436,_0x32c052['options']);return _0x33f3b5[_0xff2c('0x44')](_0x76c436);}})[_0xff2c('0x1f')](function(_0x3481b0){if(_0x3481b0){_0x335dcf=_0x3481b0[_0xff2c('0x31')];if(!_0x32c052['query'][_0xff2c('0x32')](_0xff2c('0x45'))){_0x76c436[_0xff2c('0x19')]=qs[_0xff2c('0x19')](_0x32c052[_0xff2c('0x2b')][_0xff2c('0x19')]);_0x76c436['offset']=qs[_0xff2c('0x17')](_0x32c052[_0xff2c('0x2b')]['offset']);}return _0x33f3b5[_0xff2c('0x44')](_0x76c436);}})[_0xff2c('0x1f')](function(_0x283eac){if(_0x283eac){return _0x283eac?{'count':_0x335dcf,'rows':_0x283eac}:null;}})[_0xff2c('0x1f')](respondWithResult(_0x2e8349,null))[_0xff2c('0x3d')](handleError(_0x2e8349,null));};exports[_0xff2c('0x46')]=function(_0x59c567,_0x2b34b2,_0x15d4a1){if(_0x59c567[_0xff2c('0x42')]['id']){delete _0x59c567['body']['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x59c567[_0xff2c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2b34b2,null))['then'](function(_0x199dbf){if(_0x199dbf){_0x59c567[_0xff2c('0x42')][_0xff2c('0x47')]=_0x199dbf['id'];_0x59c567[_0xff2c('0x42')][_0xff2c('0x48')]=integrations[_0xff2c('0x49')](_0x59c567[_0xff2c('0x42')][_0xff2c('0x4a')],_0x59c567['body']['type']);_0x59c567[_0xff2c('0x42')][_0xff2c('0x4b')]=integrations[_0xff2c('0x4c')](_0x59c567[_0xff2c('0x42')][_0xff2c('0x4a')],_0x59c567[_0xff2c('0x42')]['type']);return db[_0xff2c('0x4d')][_0xff2c('0x41')](_0x59c567[_0xff2c('0x42')],{'include':[{'model':db['ZohoField'],'as':_0xff2c('0x48')},{'model':db[_0xff2c('0x4e')],'as':_0xff2c('0x4b')}]});}return null;})[_0xff2c('0x1f')](respondWithResult(_0x2b34b2,null))['catch'](handleError(_0x2b34b2,null));};function getAccessToken(_0x11d180){return new Promise(function(_0x1e1ffb,_0x36de74){var _0x3f550f;switch(_0x11d180['zone']){case'US':_0x3f550f='https://accounts.zoho.com';break;case'AU':_0x3f550f=_0xff2c('0x4f');break;case'EU':_0x3f550f='https://accounts.zoho.eu';break;case'IN':_0x3f550f=_0xff2c('0x50');break;case'CN':_0x3f550f=_0xff2c('0x51');break;default:_0x3f550f=_0xff2c('0x52');break;}var _0x92921={'method':_0xff2c('0x53'),'uri':_0x3f550f+_0xff2c('0x54'),'qs':{'refresh_token':_0x11d180[_0xff2c('0x55')],'client_id':_0x11d180[_0xff2c('0x56')],'client_secret':_0x11d180[_0xff2c('0x57')],'grant_type':_0xff2c('0x58')},'json':!![]};return rp(_0x92921)[_0xff2c('0x1f')](function(_0x24a828){if(_0x24a828[_0xff2c('0x59')]){_0x1e1ffb(_0x24a828[_0xff2c('0x59')]);}else{_0x36de74('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x1d82d7){_0x36de74(_0x1d82d7);});});}exports[_0xff2c('0x5a')]=function(_0x503683,_0x2e1ccd,_0x12e9ad){var _0x25e607,_0x48d770,_0x59ebdc,_0x44b70d,_0x310b5e;return db[_0xff2c('0x26')][_0xff2c('0x43')]({'where':{'id':_0x503683[_0xff2c('0x3f')]['id']},'attributes':['id',_0xff2c('0x5b'),_0xff2c('0x5c'),_0xff2c('0x56'),'clientSecret',_0xff2c('0x5d'),_0xff2c('0x5e'),_0xff2c('0x55')]})['then'](handleEntityNotFound(_0x2e1ccd,null))[_0xff2c('0x1f')](function(_0x18a4da){_0x310b5e=_0x18a4da;_0x25e607=_0x310b5e[_0xff2c('0x5b')];_0x48d770=_0x25e607===_0xff2c('0x5f')?'eu':_0xff2c('0x60');_0x59ebdc=_0x310b5e[_0xff2c('0x5d')];var _0x2cb62f=_0x59ebdc['slice'](-0x1);if(_0x2cb62f==='/'||_0x2cb62f==='\x5c'||_0x2cb62f===':'){_0x59ebdc=_0x59ebdc[_0xff2c('0x61')](0x0,_0x59ebdc[_0xff2c('0x62')](_0x2cb62f));}if(!_0x310b5e[_0xff2c('0x55')]){throw new Error(_0xff2c('0x63'));}return getAccessToken(_0x310b5e);})[_0xff2c('0x1f')](function(_0x10d3af){if(_0x10d3af){return rp({'method':'GET','uri':util['format'](_0xff2c('0x64'),_0x48d770),'qs':{'module':'Calls'},'headers':{'Authorization':_0xff2c('0x65')+_0x10d3af},'json':!![]});}})[_0xff2c('0x1f')](function(_0x68db33){if(_0x68db33){if(_0x68db33[_0xff2c('0x66')]&&_0x68db33[_0xff2c('0x66')][_0xff2c('0x21')]){throw new Error(_0x68db33['response'][_0xff2c('0x21')][_0xff2c('0x67')]);}var _0x32fd69=[];var _0x548d34=[];var _0x2899d3=['Owner',_0xff2c('0x68'),_0xff2c('0x69'),_0xff2c('0x6a'),_0xff2c('0x6b'),'Call_Result','Call_Start_Time',_0xff2c('0x6c')];_0x548d34=_[_0xff2c('0x6d')](_0x68db33[_0xff2c('0x2f')],function(_0x12d06c){return _0x2899d3[_0xff2c('0x6e')](_0x12d06c[_0xff2c('0x6f')]);});for(var _0x1c2d4a=0x0;_0x1c2d4a<_0x548d34[_0xff2c('0x31')];_0x1c2d4a++){if(_0x548d34[_0x1c2d4a]['system_mandatory']===![]){_0x32fd69[_0xff2c('0x70')]({'id':_0x548d34[_0x1c2d4a]['id'],'name':_0x548d34[_0x1c2d4a][_0xff2c('0x71')],'custom':_0x548d34[_0x1c2d4a][_0xff2c('0x72')],'options':_0x548d34[_0x1c2d4a][_0xff2c('0x73')]==='picklist'&&_0x548d34[_0x1c2d4a][_0xff2c('0x74')][_0xff2c('0x31')]>-0x1?_['map'](_0x548d34[_0x1c2d4a][_0xff2c('0x74')],function(_0xbf9364){return{'name':_0xbf9364,'value':_0xbf9364};}):[]});}}return{'count':_0x32fd69['length'],'rows':_0x32fd69};}else{return{'count':0x0,'rows':[]};}})[_0xff2c('0x1f')](respondWithResult(_0x2e1ccd,null))[_0xff2c('0x3d')](function(_0x22ebf3){var _0x54747a=_0x503683[_0xff2c('0x2b')][_0xff2c('0x75')]?0x1f4:_0x22ebf3[_0xff2c('0x76')]||0x1f4;logger[_0xff2c('0x21')](_0xff2c('0x77'),_0xff2c('0x5a'),_0x54747a,JSON[_0xff2c('0x78')](_0x22ebf3));delete _0x22ebf3[_0xff2c('0x23')];if(_0x54747a===0x191){_0x54747a=0x190;}_0x2e1ccd[_0xff2c('0x15')](_0x54747a)[_0xff2c('0x79')](_0x503683[_0xff2c('0x2b')][_0xff2c('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x22ebf3[_0xff2c('0x76')]}:_0x22ebf3);});}; \ No newline at end of file +var _0x2258=['to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','where','pick','VIRTUAL','filter','merge','options','ZohoAccount','includeAll','include','findAll','rows','show','params','keys','fields','find','catch','create','body','findOne','ZohoConfiguration','sort','getConfigurations','addConfiguration','AccountId','Subjects','channel','type','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','code','zoho.eu','com','serverUrl','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','Call_Result','Call_Start_Time','Call_Type','includes','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x189ede,_0x4dcb05){var _0x111291=function(_0x2554b1){while(--_0x2554b1){_0x189ede['push'](_0x189ede['shift']());}};_0x111291(++_0x4dcb05);}(_0x2258,0x101));var _0x8225=function(_0x4e02a1,_0x1cc8eb){_0x4e02a1=_0x4e02a1-0x0;var _0x568573=_0x2258[_0x4e02a1];return _0x568573;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8225('0x0'));var zipdir=require(_0x8225('0x1'));var jsonpatch=require(_0x8225('0x2'));var rp=require(_0x8225('0x3'));var moment=require(_0x8225('0x4'));var BPromise=require(_0x8225('0x5'));var Mustache=require(_0x8225('0x6'));var util=require(_0x8225('0x7'));var path=require(_0x8225('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8225('0x9'));var _=require(_0x8225('0xa'));var squel=require(_0x8225('0xb'));var crypto=require(_0x8225('0xc'));var jsforce=require(_0x8225('0xd'));var deskjs=require(_0x8225('0xe'));var toCsv=require(_0x8225('0xf'));var querystring=require('querystring');var Papa=require(_0x8225('0x10'));var Redis=require(_0x8225('0x11'));var authService=require(_0x8225('0x12'));var qs=require(_0x8225('0x13'));var as=require(_0x8225('0x14'));var hardwareService=require(_0x8225('0x15'));var logger=require('../../config/logger')(_0x8225('0x16'));var utils=require('../../config/utils');var config=require(_0x8225('0x17'));var licenseUtil=require(_0x8225('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x59e8e3,_0x2e1eb2){_0x2e1eb2=_0x2e1eb2||0xcc;return function(_0x59d160){if(_0x59d160){return _0x59e8e3[_0x8225('0x19')](_0x2e1eb2);}return _0x59e8e3['status'](_0x2e1eb2)[_0x8225('0x1a')]();};}function respondWithResult(_0x5b509d,_0x28b139){_0x28b139=_0x28b139||0xc8;return function(_0x3ec20b){if(_0x3ec20b){return _0x5b509d['status'](_0x28b139)[_0x8225('0x1b')](_0x3ec20b);}};}function respondWithFilteredResult(_0x4018ec,_0x42e236){return function(_0x320afa){if(_0x320afa){var _0x1375bd=typeof _0x42e236['offset']===_0x8225('0x1c')&&typeof _0x42e236[_0x8225('0x1d')]===_0x8225('0x1c');var _0x1ad4fd=_0x320afa[_0x8225('0x1e')];var _0x1a2006=_0x1375bd?0x0:_0x42e236[_0x8225('0x1f')];var _0x486f5b=_0x1375bd?_0x320afa[_0x8225('0x1e')]:_0x42e236[_0x8225('0x1f')]+_0x42e236[_0x8225('0x1d')];var _0x4e4d2b;if(_0x486f5b>=_0x1ad4fd){_0x486f5b=_0x1ad4fd;_0x4e4d2b=0xc8;}else{_0x4e4d2b=0xce;}_0x4018ec[_0x8225('0x20')](_0x4e4d2b);return _0x4018ec[_0x8225('0x21')](_0x8225('0x22'),_0x1a2006+'-'+_0x486f5b+'/'+_0x1ad4fd)[_0x8225('0x1b')](_0x320afa);}return null;};}function patchUpdates(_0x215689){return function(_0x6a6e46){try{jsonpatch[_0x8225('0x23')](_0x6a6e46,_0x215689,!![]);}catch(_0x4cd1ed){return BPromise[_0x8225('0x24')](_0x4cd1ed);}return _0x6a6e46['save']();};}function saveUpdates(_0x53b5ec,_0x3b59f3){return function(_0x38c49e){if(_0x38c49e){return _0x38c49e[_0x8225('0x25')](_0x53b5ec)[_0x8225('0x26')](function(_0x53f8fe){return _0x53f8fe;});}return null;};}function removeEntity(_0x343648,_0x5ab6da){return function(_0x347f68){if(_0x347f68){return _0x347f68[_0x8225('0x27')]()[_0x8225('0x26')](function(){_0x343648['status'](0xcc)[_0x8225('0x1a')]();});}};}function handleEntityNotFound(_0x596298,_0x47281c){return function(_0x36e125){if(!_0x36e125){_0x596298['sendStatus'](0x194);}return _0x36e125;};}function handleError(_0x5875ce,_0x3def70){_0x3def70=_0x3def70||0x1f4;return function(_0x4356d6){logger[_0x8225('0x28')](_0x4356d6[_0x8225('0x29')]);if(_0x4356d6[_0x8225('0x2a')]){delete _0x4356d6[_0x8225('0x2a')];}_0x5875ce[_0x8225('0x20')](_0x3def70)['send'](_0x4356d6);};}exports[_0x8225('0x2b')]=function(_0x36207b,_0x16187c){var _0x8d4594={},_0x5a7b54={},_0x2232df={'count':0x0,'rows':[]};var _0x5be998=_[_0x8225('0x2c')](db['ZohoAccount'][_0x8225('0x2d')],function(_0x18c00c){return{'name':_0x18c00c[_0x8225('0x2e')],'type':_0x18c00c['type'][_0x8225('0x2f')]};});_0x5a7b54[_0x8225('0x30')]=_['map'](_0x5be998,_0x8225('0x2a'));_0x5a7b54[_0x8225('0x31')]=_['keys'](_0x36207b[_0x8225('0x31')]);_0x5a7b54[_0x8225('0x32')]=_[_0x8225('0x33')](_0x5a7b54[_0x8225('0x30')],_0x5a7b54[_0x8225('0x31')]);_0x8d4594['attributes']=_[_0x8225('0x33')](_0x5a7b54['model'],qs['fields'](_0x36207b[_0x8225('0x31')]['fields']));_0x8d4594[_0x8225('0x34')]=_0x8d4594[_0x8225('0x34')][_0x8225('0x35')]?_0x8d4594['attributes']:_0x5a7b54[_0x8225('0x30')];if(!_0x36207b[_0x8225('0x31')][_0x8225('0x36')](_0x8225('0x37'))){_0x8d4594[_0x8225('0x1d')]=qs[_0x8225('0x1d')](_0x36207b[_0x8225('0x31')]['limit']);_0x8d4594[_0x8225('0x1f')]=qs[_0x8225('0x1f')](_0x36207b[_0x8225('0x31')]['offset']);}_0x8d4594[_0x8225('0x38')]=qs['sort'](_0x36207b[_0x8225('0x31')]['sort']);_0x8d4594[_0x8225('0x39')]=qs[_0x8225('0x32')](_[_0x8225('0x3a')](_0x36207b[_0x8225('0x31')],_0x5a7b54[_0x8225('0x32')]),_0x5be998);if(_0x36207b[_0x8225('0x31')]['filter']){_0x8d4594[_0x8225('0x39')]=_['merge'](_0x8d4594[_0x8225('0x39')],{'$or':_[_0x8225('0x2c')](_0x5be998,function(_0x1faef9){if(_0x1faef9['type']!==_0x8225('0x3b')){var _0x39d417={};_0x39d417[_0x1faef9[_0x8225('0x2a')]]={'$like':'%'+_0x36207b['query'][_0x8225('0x3c')]+'%'};return _0x39d417;}})});}_0x8d4594=_[_0x8225('0x3d')]({},_0x8d4594,_0x36207b[_0x8225('0x3e')]);var _0xca440b={'where':_0x8d4594[_0x8225('0x39')]};return db[_0x8225('0x3f')][_0x8225('0x1e')](_0xca440b)[_0x8225('0x26')](function(_0x210df8){_0x2232df[_0x8225('0x1e')]=_0x210df8;if(_0x36207b['query'][_0x8225('0x40')]){_0x8d4594[_0x8225('0x41')]=[{'all':!![]}];}return db[_0x8225('0x3f')][_0x8225('0x42')](_0x8d4594);})[_0x8225('0x26')](function(_0x46c2db){_0x2232df[_0x8225('0x43')]=_0x46c2db;return _0x2232df;})[_0x8225('0x26')](respondWithFilteredResult(_0x16187c,_0x8d4594))['catch'](handleError(_0x16187c,null));};exports[_0x8225('0x44')]=function(_0x556c94,_0x46d905){var _0xe089e3={'raw':![],'where':{'id':_0x556c94[_0x8225('0x45')]['id']}},_0x27e9cf={};_0x27e9cf[_0x8225('0x30')]=_['keys'](db['ZohoAccount'][_0x8225('0x2d')]);_0x27e9cf[_0x8225('0x31')]=_[_0x8225('0x46')](_0x556c94[_0x8225('0x31')]);_0x27e9cf[_0x8225('0x32')]=_[_0x8225('0x33')](_0x27e9cf[_0x8225('0x30')],_0x27e9cf[_0x8225('0x31')]);_0xe089e3[_0x8225('0x34')]=_['intersection'](_0x27e9cf[_0x8225('0x30')],qs[_0x8225('0x47')](_0x556c94[_0x8225('0x31')][_0x8225('0x47')]));_0xe089e3['attributes']=_0xe089e3[_0x8225('0x34')][_0x8225('0x35')]?_0xe089e3[_0x8225('0x34')]:_0x27e9cf[_0x8225('0x30')];if(_0x556c94[_0x8225('0x31')][_0x8225('0x40')]){_0xe089e3[_0x8225('0x41')]=[{'all':!![]}];}_0xe089e3=_[_0x8225('0x3d')]({},_0xe089e3,_0x556c94['options']);return db['ZohoAccount'][_0x8225('0x48')](_0xe089e3)[_0x8225('0x26')](handleEntityNotFound(_0x46d905,null))[_0x8225('0x26')](respondWithResult(_0x46d905,null))[_0x8225('0x49')](handleError(_0x46d905,null));};exports[_0x8225('0x4a')]=function(_0x55e31a,_0x191e69){return db['ZohoAccount']['create'](_0x55e31a[_0x8225('0x4b')],{})['then'](respondWithResult(_0x191e69,0xc9))[_0x8225('0x49')](handleError(_0x191e69,null));};exports[_0x8225('0x25')]=function(_0x4248d8,_0x286d42){if(_0x4248d8[_0x8225('0x4b')]['id']){delete _0x4248d8[_0x8225('0x4b')]['id'];}return db[_0x8225('0x3f')]['find']({'where':{'id':_0x4248d8['params']['id']}})[_0x8225('0x26')](handleEntityNotFound(_0x286d42,null))['then'](saveUpdates(_0x4248d8[_0x8225('0x4b')],null))[_0x8225('0x26')](respondWithResult(_0x286d42,null))[_0x8225('0x49')](handleError(_0x286d42,null));};exports['destroy']=function(_0xd50e82,_0x3e8084){return db['ZohoAccount']['find']({'where':{'id':_0xd50e82[_0x8225('0x45')]['id']}})['then'](handleEntityNotFound(_0x3e8084,null))['then'](removeEntity(_0x3e8084,null))[_0x8225('0x49')](handleError(_0x3e8084,null));};exports['getConfigurations']=function(_0x3d0e26,_0x4ee769,_0x355bfa){var _0x18bf86={};var _0xf6a762={};var _0x2fd6d1;var _0xb02c8c;return db[_0x8225('0x3f')][_0x8225('0x4c')]({'where':{'id':_0x3d0e26[_0x8225('0x45')]['id']}})['then'](handleEntityNotFound(_0x4ee769,null))[_0x8225('0x26')](function(_0x553abb){if(_0x553abb){_0x2fd6d1=_0x553abb;_0xf6a762['model']=_[_0x8225('0x46')](db[_0x8225('0x4d')]['rawAttributes']);_0xf6a762[_0x8225('0x31')]=_[_0x8225('0x46')](_0x3d0e26[_0x8225('0x31')]);_0xf6a762[_0x8225('0x32')]=_[_0x8225('0x33')](_0xf6a762[_0x8225('0x30')],_0xf6a762['query']);_0x18bf86['attributes']=_[_0x8225('0x33')](_0xf6a762[_0x8225('0x30')],qs[_0x8225('0x47')](_0x3d0e26[_0x8225('0x31')][_0x8225('0x47')]));_0x18bf86[_0x8225('0x34')]=_0x18bf86[_0x8225('0x34')]['length']?_0x18bf86[_0x8225('0x34')]:_0xf6a762[_0x8225('0x30')];_0x18bf86['order']=qs[_0x8225('0x4e')](_0x3d0e26[_0x8225('0x31')][_0x8225('0x4e')]);_0x18bf86[_0x8225('0x39')]=qs['filters'](_[_0x8225('0x3a')](_0x3d0e26[_0x8225('0x31')],_0xf6a762[_0x8225('0x32')]));if(_0x3d0e26[_0x8225('0x31')]['filter']){_0x18bf86['where']=_[_0x8225('0x3d')](_0x18bf86[_0x8225('0x39')],{'$or':_[_0x8225('0x2c')](_0x18bf86['attributes'],function(_0x181fcb){var _0x50bf45={};_0x50bf45[_0x181fcb]={'$like':'%'+_0x3d0e26[_0x8225('0x31')][_0x8225('0x3c')]+'%'};return _0x50bf45;})});}_0x18bf86=_[_0x8225('0x3d')]({},_0x18bf86,_0x3d0e26[_0x8225('0x3e')]);return _0x2fd6d1[_0x8225('0x4f')](_0x18bf86);}})['then'](function(_0xfd2ca6){if(_0xfd2ca6){_0xb02c8c=_0xfd2ca6[_0x8225('0x35')];if(!_0x3d0e26[_0x8225('0x31')][_0x8225('0x36')](_0x8225('0x37'))){_0x18bf86[_0x8225('0x1d')]=qs[_0x8225('0x1d')](_0x3d0e26[_0x8225('0x31')]['limit']);_0x18bf86[_0x8225('0x1f')]=qs[_0x8225('0x1f')](_0x3d0e26['query'][_0x8225('0x1f')]);}return _0x2fd6d1[_0x8225('0x4f')](_0x18bf86);}})[_0x8225('0x26')](function(_0x8a3149){if(_0x8a3149){return _0x8a3149?{'count':_0xb02c8c,'rows':_0x8a3149}:null;}})['then'](respondWithResult(_0x4ee769,null))['catch'](handleError(_0x4ee769,null));};exports[_0x8225('0x50')]=function(_0x96e46f,_0x7f109f,_0x2a5f42){if(_0x96e46f['body']['id']){delete _0x96e46f[_0x8225('0x4b')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x96e46f[_0x8225('0x45')]['id']}})[_0x8225('0x26')](handleEntityNotFound(_0x7f109f,null))[_0x8225('0x26')](function(_0x3af5fc){if(_0x3af5fc){_0x96e46f[_0x8225('0x4b')][_0x8225('0x51')]=_0x3af5fc['id'];_0x96e46f[_0x8225('0x4b')][_0x8225('0x52')]=integrations['getSubjects'](_0x96e46f['body'][_0x8225('0x53')],_0x96e46f['body'][_0x8225('0x54')]);_0x96e46f[_0x8225('0x4b')][_0x8225('0x55')]=integrations[_0x8225('0x56')](_0x96e46f[_0x8225('0x4b')][_0x8225('0x53')],_0x96e46f['body'][_0x8225('0x54')]);return db['ZohoConfiguration'][_0x8225('0x4a')](_0x96e46f['body'],{'include':[{'model':db[_0x8225('0x57')],'as':_0x8225('0x52')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0x8225('0x26')](respondWithResult(_0x7f109f,null))[_0x8225('0x49')](handleError(_0x7f109f,null));};function getAccessToken(_0x27f656){return new Promise(function(_0x131ee7,_0x5dd10c){var _0x5c3832;switch(_0x27f656['zone']){case'US':_0x5c3832=_0x8225('0x58');break;case'AU':_0x5c3832=_0x8225('0x59');break;case'EU':_0x5c3832=_0x8225('0x5a');break;case'IN':_0x5c3832=_0x8225('0x5b');break;case'CN':_0x5c3832='https://accounts.zoho.com.cn';break;default:_0x5c3832=_0x8225('0x5a');break;}var _0x4cc443={'method':_0x8225('0x5c'),'uri':_0x5c3832+_0x8225('0x5d'),'qs':{'refresh_token':_0x27f656[_0x8225('0x5e')],'client_id':_0x27f656[_0x8225('0x5f')],'client_secret':_0x27f656[_0x8225('0x60')],'grant_type':_0x8225('0x61')},'json':!![]};return rp(_0x4cc443)[_0x8225('0x26')](function(_0x1ab4ba){if(_0x1ab4ba[_0x8225('0x62')]){_0x131ee7(_0x1ab4ba[_0x8225('0x62')]);}else{_0x5dd10c(_0x8225('0x63'));}})[_0x8225('0x49')](function(_0x4776f6){_0x5dd10c(_0x4776f6);});});}exports[_0x8225('0x64')]=function(_0x595b7b,_0x156816,_0x32c107){var _0x54ba5b,_0x23e25d,_0x292def,_0x4dc9b8,_0x170e09;return db[_0x8225('0x3f')][_0x8225('0x4c')]({'where':{'id':_0x595b7b[_0x8225('0x45')]['id']},'attributes':['id',_0x8225('0x65'),_0x8225('0x66'),_0x8225('0x5f'),'clientSecret','serverUrl',_0x8225('0x67'),_0x8225('0x5e')]})[_0x8225('0x26')](handleEntityNotFound(_0x156816,null))[_0x8225('0x26')](function(_0x4f2b1f){_0x170e09=_0x4f2b1f;_0x54ba5b=_0x170e09[_0x8225('0x65')];_0x23e25d=_0x54ba5b===_0x8225('0x68')?'eu':_0x8225('0x69');_0x292def=_0x170e09[_0x8225('0x6a')];var _0x557f6a=_0x292def[_0x8225('0x6b')](-0x1);if(_0x557f6a==='/'||_0x557f6a==='\x5c'||_0x557f6a===':'){_0x292def=_0x292def['substring'](0x0,_0x292def[_0x8225('0x6c')](_0x557f6a));}if(!_0x170e09['refreshToken']){throw new Error(_0x8225('0x6d'));}return getAccessToken(_0x170e09);})[_0x8225('0x26')](function(_0x5d622d){if(_0x5d622d){return rp({'method':_0x8225('0x6e'),'uri':util[_0x8225('0x6f')](_0x8225('0x70'),_0x23e25d),'qs':{'module':_0x8225('0x71')},'headers':{'Authorization':_0x8225('0x72')+_0x5d622d},'json':!![]});}})['then'](function(_0x525b44){if(_0x525b44){if(_0x525b44['response']&&_0x525b44[_0x8225('0x73')][_0x8225('0x28')]){throw new Error(_0x525b44[_0x8225('0x73')][_0x8225('0x28')][_0x8225('0x74')]);}var _0x27d78e=[];var _0x3185c8=[];var _0x7e2353=[_0x8225('0x75'),_0x8225('0x76'),_0x8225('0x77'),'WhoId','Call_Duration',_0x8225('0x78'),_0x8225('0x79'),_0x8225('0x7a')];_0x3185c8=_['remove'](_0x525b44['fields'],function(_0xc5f582){return _0x7e2353[_0x8225('0x7b')](_0xc5f582['api_name']);});for(var _0x4ed04c=0x0;_0x4ed04c<_0x3185c8[_0x8225('0x35')];_0x4ed04c++){if(_0x3185c8[_0x4ed04c][_0x8225('0x7c')]===![]){_0x27d78e[_0x8225('0x7d')]({'id':_0x3185c8[_0x4ed04c]['id'],'name':_0x3185c8[_0x4ed04c][_0x8225('0x7e')],'custom':_0x3185c8[_0x4ed04c][_0x8225('0x7f')],'options':_0x3185c8[_0x4ed04c][_0x8225('0x80')]===_0x8225('0x81')&&_0x3185c8[_0x4ed04c]['pick_list_values']['length']>-0x1?_['map'](_0x3185c8[_0x4ed04c][_0x8225('0x82')],function(_0x2ecce1){return{'name':_0x2ecce1,'value':_0x2ecce1};}):[]});}}return{'count':_0x27d78e[_0x8225('0x35')],'rows':_0x27d78e};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x156816,null))[_0x8225('0x49')](function(_0x42ccaf){var _0x22ab24=_0x595b7b[_0x8225('0x31')][_0x8225('0x83')]?0x1f4:_0x42ccaf[_0x8225('0x84')]||0x1f4;logger[_0x8225('0x28')](_0x8225('0x85'),_0x8225('0x64'),_0x22ab24,JSON['stringify'](_0x42ccaf));delete _0x42ccaf['name'];if(_0x22ab24===0x191){_0x22ab24=0x190;}_0x156816[_0x8225('0x20')](_0x22ab24)[_0x8225('0x86')](_0x595b7b[_0x8225('0x31')]['test']?{'message':_0x8225('0x87'),'statusCode':_0x42ccaf['statusCode']}:_0x42ccaf);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 9f0c73b..c2da569 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 _0x9561=['code','serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','info','format','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','error','https://accounts.zoho.com.au','then','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','clientSecret'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9561,0x122));var _0x1956=function(_0x4b075e,_0x57874c){_0x4b075e=_0x4b075e-0x0;var _0x31385c=_0x9561[_0x4b075e];return _0x31385c;};'use strict';var _=require(_0x1956('0x0'));var util=require(_0x1956('0x1'));var logger=require(_0x1956('0x2'))(_0x1956('0x3'));var moment=require(_0x1956('0x4'));var BPromise=require(_0x1956('0x5'));var rp=require(_0x1956('0x6'));var fs=require('fs');var path=require(_0x1956('0x7'));var rimraf=require(_0x1956('0x8'));var config=require(_0x1956('0x9'));var attributes=require(_0x1956('0xa'));var integrations=require(_0x1956('0xb'));module['exports']=function(_0x581fa4,_0x5bc89c){return _0x581fa4[_0x1956('0xc')](_0x1956('0xd'),attributes,{'tableName':_0x1956('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x43297b,_0x10a75f,_0x56b230){if(_0x43297b[_0x1956('0xf')](_0x1956('0x10'))||_0x43297b[_0x1956('0xf')]('serverUrl')||_0x43297b[_0x1956('0xf')]('clientId')||_0x43297b[_0x1956('0xf')](_0x1956('0x11'))||_0x43297b[_0x1956('0xf')](_0x1956('0x12'))||_0x43297b['changed']('host')){var _0x4e735c,_0x2f0100;_0x4e735c=_0x43297b[_0x1956('0x13')];var _0x513d52=_0x4e735c[_0x1956('0x14')](-0x1);if(_0x513d52==='/'||_0x513d52==='\x5c'||_0x513d52===':'){_0x4e735c=_0x4e735c[_0x1956('0x15')](0x0,_0x4e735c[_0x1956('0x16')](_0x513d52));}switch(_0x43297b[_0x1956('0x10')]){case'US':_0x2f0100=_0x1956('0x17');break;case'AU':_0x2f0100='https://accounts.zoho.com.au';break;case'IN':_0x2f0100=_0x1956('0x18');break;case'CN':_0x2f0100=_0x1956('0x19');break;default:_0x2f0100=_0x1956('0x1a');break;}var _0x49beda={'method':'POST','uri':_0x2f0100+_0x1956('0x1b'),'form':{'grant_type':_0x1956('0x1c'),'client_id':_0x43297b[_0x1956('0x1d')],'client_secret':_0x43297b['clientSecret'],'redirect_uri':_0x43297b[_0x1956('0x13')],'code':_0x43297b[_0x1956('0x12')]},'headers':{'Content-Type':_0x1956('0x1e')}};return rp(_0x49beda)['then'](function(_0xfc2de3){var _0x5f022f=JSON[_0x1956('0x1f')](_0xfc2de3);if(_0x5f022f[_0x1956('0x20')]){_0x43297b[_0x1956('0x21')]=_0x5f022f[_0x1956('0x20')];logger[_0x1956('0x22')](util[_0x1956('0x23')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x43297b[_0x1956('0x24')],_0x43297b['id']));}else{logger['error'](util[_0x1956('0x23')](_0x1956('0x25'),_0x43297b[_0x1956('0x24')],_0x43297b['id']),util[_0x1956('0x26')](_0x5f022f,{'showHidden':![],'depth':null}));}return _0x56b230(null,_0x10a75f);})[_0x1956('0x27')](function(_0x49fa7c){logger[_0x1956('0x28')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x43297b[_0x1956('0x24')],_0x43297b['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x56b230(_0x49fa7c);});}else{return _0x56b230(null,_0x10a75f);}},'beforeUpdate':function(_0x354d12,_0x52c283,_0x551b3c){if(_0x354d12[_0x1956('0xf')](_0x1956('0x10'))||_0x354d12[_0x1956('0xf')](_0x1956('0x13'))||_0x354d12[_0x1956('0xf')](_0x1956('0x1d'))||_0x354d12[_0x1956('0xf')]('clientSecret')||_0x354d12[_0x1956('0xf')]('code')||_0x354d12[_0x1956('0xf')]('host')){var _0x2ab1c3,_0x11e991;_0x2ab1c3=_0x354d12[_0x1956('0x13')];var _0x42b6ba=_0x2ab1c3[_0x1956('0x14')](-0x1);if(_0x42b6ba==='/'||_0x42b6ba==='\x5c'||_0x42b6ba===':'){_0x2ab1c3=_0x2ab1c3['substring'](0x0,_0x2ab1c3['lastIndexOf'](_0x42b6ba));}switch(_0x354d12[_0x1956('0x10')]){case'US':_0x11e991=_0x1956('0x17');break;case'AU':_0x11e991=_0x1956('0x29');break;case'IN':_0x11e991='https://accounts.zoho.in';break;case'CN':_0x11e991='https://accounts.zoho.com.cn';break;default:_0x11e991=_0x1956('0x1a');break;}var _0x4ef5c5={'method':'POST','uri':_0x11e991+_0x1956('0x1b'),'form':{'grant_type':_0x1956('0x1c'),'client_id':_0x354d12['clientId'],'client_secret':_0x354d12[_0x1956('0x11')],'redirect_uri':_0x354d12[_0x1956('0x13')],'code':_0x354d12['code']},'headers':{'Content-Type':_0x1956('0x1e')}};return rp(_0x4ef5c5)[_0x1956('0x2a')](function(_0x4db506){var _0x125af0=JSON['parse'](_0x4db506);if(_0x125af0['refresh_token']){_0x354d12[_0x1956('0x21')]=_0x125af0[_0x1956('0x20')];logger[_0x1956('0x22')](util[_0x1956('0x23')](_0x1956('0x2b'),_0x354d12['name'],_0x354d12['id']));}else{logger['error'](util['format'](_0x1956('0x25'),_0x354d12[_0x1956('0x24')],_0x354d12['id']),util['inspect'](_0x125af0,{'showHidden':![],'depth':null}));}return _0x551b3c(null,_0x52c283);})[_0x1956('0x27')](function(_0x98dc9d){logger[_0x1956('0x28')](util[_0x1956('0x23')](_0x1956('0x25'),_0x354d12[_0x1956('0x24')],_0x354d12['id']),util[_0x1956('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x551b3c(_0x98dc9d);});}else{return _0x551b3c(null,_0x52c283);}}}});}; \ No newline at end of file +var _0xcfd7=['api','bluebird','request-promise','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','host','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','code','lodash','../../config/logger'];(function(_0xd60ec9,_0x4c62fd){var _0x4a6c4b=function(_0x3d27cd){while(--_0x3d27cd){_0xd60ec9['push'](_0xd60ec9['shift']());}};_0x4a6c4b(++_0x4c62fd);}(_0xcfd7,0xe8));var _0x7cfd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcfd7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7cfd('0x0'));var util=require('util');var logger=require(_0x7cfd('0x1'))(_0x7cfd('0x2'));var moment=require('moment');var BPromise=require(_0x7cfd('0x3'));var rp=require(_0x7cfd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7cfd('0x5'));var attributes=require(_0x7cfd('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x7cfd('0x7')]=function(_0x1c98a9,_0x47c171){return _0x1c98a9[_0x7cfd('0x8')](_0x7cfd('0x9'),attributes,{'tableName':_0x7cfd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3ec4ec,_0x195e74,_0xe6576a){if(_0x3ec4ec[_0x7cfd('0xb')](_0x7cfd('0xc'))||_0x3ec4ec[_0x7cfd('0xb')](_0x7cfd('0xd'))||_0x3ec4ec['changed'](_0x7cfd('0xe'))||_0x3ec4ec[_0x7cfd('0xb')](_0x7cfd('0xf'))||_0x3ec4ec[_0x7cfd('0xb')]('code')||_0x3ec4ec['changed'](_0x7cfd('0x10'))){var _0x11a7ea,_0x4186e1;_0x11a7ea=_0x3ec4ec[_0x7cfd('0xd')];var _0xd17b00=_0x11a7ea[_0x7cfd('0x11')](-0x1);if(_0xd17b00==='/'||_0xd17b00==='\x5c'||_0xd17b00===':'){_0x11a7ea=_0x11a7ea[_0x7cfd('0x12')](0x0,_0x11a7ea['lastIndexOf'](_0xd17b00));}switch(_0x3ec4ec['zone']){case'US':_0x4186e1=_0x7cfd('0x13');break;case'AU':_0x4186e1=_0x7cfd('0x14');break;case'IN':_0x4186e1=_0x7cfd('0x15');break;case'CN':_0x4186e1=_0x7cfd('0x16');break;default:_0x4186e1=_0x7cfd('0x17');break;}var _0x7f71da={'method':_0x7cfd('0x18'),'uri':_0x4186e1+'/oauth/v2/token','form':{'grant_type':_0x7cfd('0x19'),'client_id':_0x3ec4ec[_0x7cfd('0xe')],'client_secret':_0x3ec4ec[_0x7cfd('0xf')],'redirect_uri':_0x3ec4ec['serverUrl'],'code':_0x3ec4ec['code']},'headers':{'Content-Type':_0x7cfd('0x1a')}};return rp(_0x7f71da)[_0x7cfd('0x1b')](function(_0x4d8b6d){var _0x1283c2=JSON[_0x7cfd('0x1c')](_0x4d8b6d);if(_0x1283c2[_0x7cfd('0x1d')]){_0x3ec4ec[_0x7cfd('0x1e')]=_0x1283c2[_0x7cfd('0x1d')];logger['info'](util[_0x7cfd('0x1f')](_0x7cfd('0x20'),_0x3ec4ec[_0x7cfd('0x21')],_0x3ec4ec['id']));}else{logger['error'](util[_0x7cfd('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3ec4ec[_0x7cfd('0x21')],_0x3ec4ec['id']),util[_0x7cfd('0x22')](_0x1283c2,{'showHidden':![],'depth':null}));}return _0xe6576a(null,_0x195e74);})[_0x7cfd('0x23')](function(_0xb270b){logger[_0x7cfd('0x24')](util[_0x7cfd('0x1f')](_0x7cfd('0x25'),_0x3ec4ec[_0x7cfd('0x21')],_0x3ec4ec['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0xe6576a(_0xb270b);});}else{return _0xe6576a(null,_0x195e74);}},'beforeUpdate':function(_0x11caaa,_0x1eccf1,_0x400c8c){if(_0x11caaa['changed'](_0x7cfd('0xc'))||_0x11caaa[_0x7cfd('0xb')]('serverUrl')||_0x11caaa['changed'](_0x7cfd('0xe'))||_0x11caaa[_0x7cfd('0xb')](_0x7cfd('0xf'))||_0x11caaa['changed'](_0x7cfd('0x26'))||_0x11caaa['changed'](_0x7cfd('0x10'))){var _0x39b659,_0x173830;_0x39b659=_0x11caaa[_0x7cfd('0xd')];var _0x56f887=_0x39b659[_0x7cfd('0x11')](-0x1);if(_0x56f887==='/'||_0x56f887==='\x5c'||_0x56f887===':'){_0x39b659=_0x39b659[_0x7cfd('0x12')](0x0,_0x39b659['lastIndexOf'](_0x56f887));}switch(_0x11caaa['zone']){case'US':_0x173830=_0x7cfd('0x13');break;case'AU':_0x173830=_0x7cfd('0x14');break;case'IN':_0x173830=_0x7cfd('0x15');break;case'CN':_0x173830='https://accounts.zoho.com.cn';break;default:_0x173830=_0x7cfd('0x17');break;}var _0x1d4fd4={'method':_0x7cfd('0x18'),'uri':_0x173830+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x11caaa['clientId'],'client_secret':_0x11caaa['clientSecret'],'redirect_uri':_0x11caaa[_0x7cfd('0xd')],'code':_0x11caaa['code']},'headers':{'Content-Type':_0x7cfd('0x1a')}};return rp(_0x1d4fd4)[_0x7cfd('0x1b')](function(_0x39ec2b){var _0x2da1ae=JSON[_0x7cfd('0x1c')](_0x39ec2b);if(_0x2da1ae[_0x7cfd('0x1d')]){_0x11caaa['refreshToken']=_0x2da1ae['refresh_token'];logger['info'](util[_0x7cfd('0x1f')](_0x7cfd('0x20'),_0x11caaa['name'],_0x11caaa['id']));}else{logger['error'](util['format'](_0x7cfd('0x25'),_0x11caaa[_0x7cfd('0x21')],_0x11caaa['id']),util['inspect'](_0x2da1ae,{'showHidden':![],'depth':null}));}return _0x400c8c(null,_0x1eccf1);})[_0x7cfd('0x23')](function(_0x4b15e4){logger[_0x7cfd('0x24')](util[_0x7cfd('0x1f')](_0x7cfd('0x25'),_0x11caaa[_0x7cfd('0x21')],_0x11caaa['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x400c8c(_0x4b15e4);});}else{return _0x400c8c(null,_0x1eccf1);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index da330d6..0ad8fb6 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 _0x46c1=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','include','map','model','ShowZohoAccount','util','moment','bluebird','randomstring'];(function(_0x43b28e,_0x251247){var _0x4d313b=function(_0x55c6fe){while(--_0x55c6fe){_0x43b28e['push'](_0x43b28e['shift']());}};_0x4d313b(++_0x251247);}(_0x46c1,0x7c));var _0x146c=function(_0x237464,_0x5d803c){_0x237464=_0x237464-0x0;var _0x561870=_0x46c1[_0x237464];return _0x561870;};'use strict';var _=require('lodash');var util=require(_0x146c('0x0'));var moment=require(_0x146c('0x1'));var BPromise=require(_0x146c('0x2'));var rs=require(_0x146c('0x3'));var fs=require('fs');var Redis=require(_0x146c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x146c('0x5'));var logger=require(_0x146c('0x6'))(_0x146c('0x7'));var config=require(_0x146c('0x8'));var jayson=require(_0x146c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e394f,_0x226480,_0x3bccd4){return new BPromise(function(_0x54f99b,_0x36a8c2){return client['request'](_0x2e394f,_0x3bccd4)[_0x146c('0xa')](function(_0x2c8c0a){logger['info'](_0x146c('0xb'),_0x226480,_0x146c('0xc'));logger[_0x146c('0xd')](_0x146c('0xe'),_0x226480,'request\x20sent',JSON[_0x146c('0xf')](_0x2c8c0a));if(_0x2c8c0a['error']){if(_0x2c8c0a[_0x146c('0x10')][_0x146c('0x11')]===0x1f4){logger[_0x146c('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x226480,_0x2c8c0a[_0x146c('0x10')]['message']);return _0x36a8c2(_0x2c8c0a[_0x146c('0x10')]['message']);}logger[_0x146c('0x10')](_0x146c('0xb'),_0x226480,_0x2c8c0a[_0x146c('0x10')][_0x146c('0x12')]);return _0x54f99b(_0x2c8c0a['error'][_0x146c('0x12')]);}else{logger[_0x146c('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x226480,_0x146c('0xc'));_0x54f99b(_0x2c8c0a['result']['message']);}})[_0x146c('0x14')](function(_0x512ac8){logger[_0x146c('0x10')](_0x146c('0xb'),_0x226480,_0x512ac8);_0x36a8c2(_0x512ac8);});});}exports[_0x146c('0x15')]=function(_0x4b1f21){var _0x4335e4=this;return new Promise(function(_0x22cd97,_0x30d654){return db[_0x146c('0x16')][_0x146c('0x17')]({'raw':_0x4b1f21[_0x146c('0x18')]?_0x4b1f21[_0x146c('0x18')][_0x146c('0x19')]===undefined?!![]:![]:!![],'where':_0x4b1f21[_0x146c('0x18')]?_0x4b1f21['options'][_0x146c('0x1a')]||null:null,'attributes':_0x4b1f21[_0x146c('0x18')]?_0x4b1f21[_0x146c('0x18')][_0x146c('0x1b')]||null:null,'limit':_0x4b1f21[_0x146c('0x18')]?_0x4b1f21['options']['limit']||null:null,'include':_0x4b1f21[_0x146c('0x18')]?_0x4b1f21[_0x146c('0x18')][_0x146c('0x1c')]?_[_0x146c('0x1d')](_0x4b1f21['options'][_0x146c('0x1c')],function(_0x3ee8d7){return{'model':db[_0x3ee8d7[_0x146c('0x1e')]],'as':_0x3ee8d7['as'],'attributes':_0x3ee8d7[_0x146c('0x1b')],'include':_0x3ee8d7[_0x146c('0x1c')]?_['map'](_0x3ee8d7['include'],function(_0x1257ff){return{'model':db[_0x1257ff[_0x146c('0x1e')]],'as':_0x1257ff['as'],'attributes':_0x1257ff[_0x146c('0x1b')],'include':_0x1257ff[_0x146c('0x1c')]?_['map'](_0x1257ff[_0x146c('0x1c')],function(_0x2a3cde){return{'model':db[_0x2a3cde[_0x146c('0x1e')]],'as':_0x2a3cde['as'],'attributes':_0x2a3cde[_0x146c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x146c('0xa')](function(_0x2298c0){logger[_0x146c('0x13')](_0x146c('0x15'),_0x4b1f21);logger[_0x146c('0xd')]('GetZohoAccount',_0x4b1f21,JSON[_0x146c('0xf')](_0x2298c0));_0x22cd97(_0x2298c0);})['catch'](function(_0x5c44ef){logger[_0x146c('0x10')](_0x146c('0x15'),_0x5c44ef[_0x146c('0x12')],_0x4b1f21);_0x30d654(_0x4335e4[_0x146c('0x10')](0x1f4,_0x5c44ef[_0x146c('0x12')]));});});};exports[_0x146c('0x1f')]=function(_0x2073e1){var _0x137f4c=this;return new Promise(function(_0x3d5ca9,_0x19c71d){return db[_0x146c('0x16')]['find']({'raw':_0x2073e1[_0x146c('0x18')]?_0x2073e1[_0x146c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2073e1[_0x146c('0x18')]?_0x2073e1[_0x146c('0x18')][_0x146c('0x1a')]||null:null,'attributes':_0x2073e1[_0x146c('0x18')]?_0x2073e1[_0x146c('0x18')]['attributes']||null:null,'include':_0x2073e1['options']?_0x2073e1[_0x146c('0x18')][_0x146c('0x1c')]?_[_0x146c('0x1d')](_0x2073e1[_0x146c('0x18')][_0x146c('0x1c')],function(_0x5cf055){return{'model':db[_0x5cf055[_0x146c('0x1e')]],'as':_0x5cf055['as'],'attributes':_0x5cf055[_0x146c('0x1b')],'include':_0x5cf055[_0x146c('0x1c')]?_[_0x146c('0x1d')](_0x5cf055['include'],function(_0x31437b){return{'model':db[_0x31437b[_0x146c('0x1e')]],'as':_0x31437b['as'],'attributes':_0x31437b[_0x146c('0x1b')],'include':_0x31437b[_0x146c('0x1c')]?_[_0x146c('0x1d')](_0x31437b[_0x146c('0x1c')],function(_0x3e2152){return{'model':db[_0x3e2152[_0x146c('0x1e')]],'as':_0x3e2152['as'],'attributes':_0x3e2152[_0x146c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x146c('0xa')](function(_0x209dba){logger[_0x146c('0x13')](_0x146c('0x1f'),_0x2073e1);logger[_0x146c('0xd')](_0x146c('0x1f'),_0x2073e1,JSON[_0x146c('0xf')](_0x209dba));_0x3d5ca9(_0x209dba);})['catch'](function(_0x3a47ce){logger['error'](_0x146c('0x1f'),_0x3a47ce[_0x146c('0x12')],_0x2073e1);_0x19c71d(_0x137f4c['error'](0x1f4,_0x3a47ce[_0x146c('0x12')]));});});}; \ No newline at end of file +var _0x73a1=['catch','GetZohoAccount','findAll','options','raw','include','model','attributes','map','debug','ShowZohoAccount','find','where','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result'];(function(_0x5422f3,_0x4343d0){var _0x44e87e=function(_0x21018f){while(--_0x21018f){_0x5422f3['push'](_0x5422f3['shift']());}};_0x44e87e(++_0x4343d0);}(_0x73a1,0x161));var _0x173a=function(_0x4067ac,_0x363603){_0x4067ac=_0x4067ac-0x0;var _0x53d74d=_0x73a1[_0x4067ac];return _0x53d74d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x173a('0x0'));var BPromise=require(_0x173a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x173a('0x2'));var db=require(_0x173a('0x3'))['db'];var utils=require(_0x173a('0x4'));var logger=require(_0x173a('0x5'))(_0x173a('0x6'));var config=require('../../config/environment');var jayson=require(_0x173a('0x7'));var client=jayson[_0x173a('0x8')][_0x173a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbd8757,_0x12bb11,_0x550e2b){return new BPromise(function(_0x2b545e,_0x2c7090){return client[_0x173a('0xa')](_0xbd8757,_0x550e2b)[_0x173a('0xb')](function(_0x30ffef){logger[_0x173a('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x12bb11,_0x173a('0xd'));logger['debug'](_0x173a('0xe'),_0x12bb11,_0x173a('0xd'),JSON[_0x173a('0xf')](_0x30ffef));if(_0x30ffef[_0x173a('0x10')]){if(_0x30ffef['error'][_0x173a('0x11')]===0x1f4){logger['error'](_0x173a('0x12'),_0x12bb11,_0x30ffef['error'][_0x173a('0x13')]);return _0x2c7090(_0x30ffef[_0x173a('0x10')]['message']);}logger[_0x173a('0x10')](_0x173a('0x12'),_0x12bb11,_0x30ffef[_0x173a('0x10')][_0x173a('0x13')]);return _0x2b545e(_0x30ffef[_0x173a('0x10')][_0x173a('0x13')]);}else{logger[_0x173a('0xc')](_0x173a('0x12'),_0x12bb11,'request\x20sent');_0x2b545e(_0x30ffef[_0x173a('0x14')][_0x173a('0x13')]);}})[_0x173a('0x15')](function(_0x4b323c){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x12bb11,_0x4b323c);_0x2c7090(_0x4b323c);});});}exports[_0x173a('0x16')]=function(_0x5e5ebd){var _0x578375=this;return new Promise(function(_0xd84224,_0x2d3b17){return db['ZohoAccount'][_0x173a('0x17')]({'raw':_0x5e5ebd[_0x173a('0x18')]?_0x5e5ebd[_0x173a('0x18')][_0x173a('0x19')]===undefined?!![]:![]:!![],'where':_0x5e5ebd[_0x173a('0x18')]?_0x5e5ebd[_0x173a('0x18')]['where']||null:null,'attributes':_0x5e5ebd[_0x173a('0x18')]?_0x5e5ebd[_0x173a('0x18')]['attributes']||null:null,'limit':_0x5e5ebd[_0x173a('0x18')]?_0x5e5ebd['options']['limit']||null:null,'include':_0x5e5ebd[_0x173a('0x18')]?_0x5e5ebd[_0x173a('0x18')][_0x173a('0x1a')]?_['map'](_0x5e5ebd[_0x173a('0x18')][_0x173a('0x1a')],function(_0x2a7f65){return{'model':db[_0x2a7f65[_0x173a('0x1b')]],'as':_0x2a7f65['as'],'attributes':_0x2a7f65[_0x173a('0x1c')],'include':_0x2a7f65[_0x173a('0x1a')]?_['map'](_0x2a7f65['include'],function(_0x44d885){return{'model':db[_0x44d885[_0x173a('0x1b')]],'as':_0x44d885['as'],'attributes':_0x44d885[_0x173a('0x1c')],'include':_0x44d885[_0x173a('0x1a')]?_[_0x173a('0x1d')](_0x44d885[_0x173a('0x1a')],function(_0x47f8a6){return{'model':db[_0x47f8a6[_0x173a('0x1b')]],'as':_0x47f8a6['as'],'attributes':_0x47f8a6[_0x173a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x173a('0xb')](function(_0x451695){logger[_0x173a('0xc')](_0x173a('0x16'),_0x5e5ebd);logger[_0x173a('0x1e')](_0x173a('0x16'),_0x5e5ebd,JSON[_0x173a('0xf')](_0x451695));_0xd84224(_0x451695);})[_0x173a('0x15')](function(_0x5aae65){logger['error']('GetZohoAccount',_0x5aae65[_0x173a('0x13')],_0x5e5ebd);_0x2d3b17(_0x578375[_0x173a('0x10')](0x1f4,_0x5aae65[_0x173a('0x13')]));});});};exports[_0x173a('0x1f')]=function(_0x118bda){var _0x4f4a7e=this;return new Promise(function(_0x3e3872,_0x2f1358){return db['ZohoAccount'][_0x173a('0x20')]({'raw':_0x118bda[_0x173a('0x18')]?_0x118bda[_0x173a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x118bda[_0x173a('0x18')]?_0x118bda['options'][_0x173a('0x21')]||null:null,'attributes':_0x118bda['options']?_0x118bda['options'][_0x173a('0x1c')]||null:null,'include':_0x118bda[_0x173a('0x18')]?_0x118bda[_0x173a('0x18')][_0x173a('0x1a')]?_['map'](_0x118bda[_0x173a('0x18')][_0x173a('0x1a')],function(_0x538771){return{'model':db[_0x538771[_0x173a('0x1b')]],'as':_0x538771['as'],'attributes':_0x538771['attributes'],'include':_0x538771[_0x173a('0x1a')]?_[_0x173a('0x1d')](_0x538771[_0x173a('0x1a')],function(_0x332ae7){return{'model':db[_0x332ae7[_0x173a('0x1b')]],'as':_0x332ae7['as'],'attributes':_0x332ae7[_0x173a('0x1c')],'include':_0x332ae7[_0x173a('0x1a')]?_['map'](_0x332ae7[_0x173a('0x1a')],function(_0x6ae39b){return{'model':db[_0x6ae39b[_0x173a('0x1b')]],'as':_0x6ae39b['as'],'attributes':_0x6ae39b[_0x173a('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d3c6a){logger[_0x173a('0xc')](_0x173a('0x1f'),_0x118bda);logger['debug'](_0x173a('0x1f'),_0x118bda,JSON[_0x173a('0xf')](_0x3d3c6a));_0x3e3872(_0x3d3c6a);})[_0x173a('0x15')](function(_0x2f4e6b){logger['error']('ShowZohoAccount',_0x2f4e6b[_0x173a('0x13')],_0x118bda);_0x2f1358(_0x4f4a7e[_0x173a('0x10')](0x1f4,_0x2f4e6b[_0x173a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 2136a3f..3b31321 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 _0x2072=['fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','create','/:id','update','delete','exports','util','express','Router'];(function(_0x4da681,_0x5d0b77){var _0x571bcd=function(_0x1133a3){while(--_0x1133a3){_0x4da681['push'](_0x4da681['shift']());}};_0x571bcd(++_0x5d0b77);}(_0x2072,0xf4));var _0x2207=function(_0x5dbac8,_0x2a86b3){_0x5dbac8=_0x5dbac8-0x0;var _0x4f5535=_0x2072[_0x5dbac8];return _0x4f5535;};'use strict';var multer=require('multer');var util=require(_0x2207('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2207('0x1'));var router=express[_0x2207('0x2')]();var fs_extra=require(_0x2207('0x3'));var auth=require(_0x2207('0x4'));var interaction=require(_0x2207('0x5'));var config=require('../../config/environment');var controller=require(_0x2207('0x6'));router[_0x2207('0x7')]('/',auth[_0x2207('0x8')](),controller['index']);router[_0x2207('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x2207('0x9')]);router[_0x2207('0x7')](_0x2207('0xa'),auth[_0x2207('0x8')](),controller['getFields']);router[_0x2207('0x7')](_0x2207('0xb'),auth[_0x2207('0x8')](),controller['getSubjects']);router[_0x2207('0x7')](_0x2207('0xc'),auth['isAuthenticated'](),controller[_0x2207('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2207('0xe')]);router['put'](_0x2207('0xf'),auth[_0x2207('0x8')](),controller[_0x2207('0x10')]);router[_0x2207('0x11')](_0x2207('0xf'),auth[_0x2207('0x8')](),controller['destroy']);module[_0x2207('0x12')]=router; \ No newline at end of file +var _0x6291=['show','/:id/fields','getFields','getSubjects','post','update','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x393b39,_0x462462){var _0x50c6bf=function(_0x270166){while(--_0x270166){_0x393b39['push'](_0x393b39['shift']());}};_0x50c6bf(++_0x462462);}(_0x6291,0x193));var _0x1629=function(_0x216f98,_0x470c7f){_0x216f98=_0x216f98-0x0;var _0xea6b36=_0x6291[_0x216f98];return _0xea6b36;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1629('0x0'));var timeout=require(_0x1629('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1629('0x2'));var auth=require(_0x1629('0x3'));var interaction=require(_0x1629('0x4'));var config=require(_0x1629('0x5'));var controller=require(_0x1629('0x6'));router[_0x1629('0x7')]('/',auth[_0x1629('0x8')](),controller[_0x1629('0x9')]);router[_0x1629('0x7')](_0x1629('0xa'),auth[_0x1629('0x8')](),controller[_0x1629('0xb')]);router[_0x1629('0x7')](_0x1629('0xc'),auth[_0x1629('0x8')](),controller[_0x1629('0xd')]);router[_0x1629('0x7')]('/:id/subjects',auth[_0x1629('0x8')](),controller[_0x1629('0xe')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x1629('0xf')]('/',auth[_0x1629('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1629('0x10')]);router['delete']('/:id',auth[_0x1629('0x8')](),controller['destroy']);module[_0x1629('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index d92d5d5..6f8f9ac 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 _0x5b8a=['lead','contact','nothing','ENUM','contact_lead','sequelize','exports','STRING'];(function(_0x1a55b1,_0x96ec8b){var _0x3ba4b0=function(_0x1f37b9){while(--_0x1f37b9){_0x1a55b1['push'](_0x1a55b1['shift']());}};_0x3ba4b0(++_0x96ec8b);}(_0x5b8a,0x14d));var _0xa5b8=function(_0x1c6827,_0xccf129){_0x1c6827=_0x1c6827-0x0;var _0x57be70=_0x5b8a[_0x1c6827];return _0x57be70;};'use strict';var Sequelize=require(_0xa5b8('0x0'));module[_0xa5b8('0x1')]={'name':{'type':Sequelize[_0xa5b8('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xa5b8('0x3'),_0xa5b8('0x4'),_0xa5b8('0x5')),'defaultValue':_0xa5b8('0x3')},'moduleSearch':{'type':Sequelize[_0xa5b8('0x6')](_0xa5b8('0x7'),_0xa5b8('0x4'),'lead'),'defaultValue':_0xa5b8('0x7')},'description':{'type':Sequelize[_0xa5b8('0x2')]}}; \ No newline at end of file +var _0x9a0b=['nothing','lead','contact_lead','STRING','ENUM','contact'];(function(_0x18fb16,_0x45edbc){var _0x147b0d=function(_0x5b1b00){while(--_0x5b1b00){_0x18fb16['push'](_0x18fb16['shift']());}};_0x147b0d(++_0x45edbc);}(_0x9a0b,0xff));var _0xb9a0=function(_0x1416f1,_0x4a3e3e){_0x1416f1=_0x1416f1-0x0;var _0x374d9f=_0x9a0b[_0x1416f1];return _0x374d9f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb9a0('0x0')]},'moduleCreate':{'type':Sequelize[_0xb9a0('0x1')]('lead',_0xb9a0('0x2'),_0xb9a0('0x3')),'defaultValue':_0xb9a0('0x4')},'moduleSearch':{'type':Sequelize[_0xb9a0('0x1')](_0xb9a0('0x5'),_0xb9a0('0x2'),_0xb9a0('0x4')),'defaultValue':_0xb9a0('0x5')},'description':{'type':Sequelize[_0xb9a0('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 5512f35..d1a4b07 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 _0xeb50=['length','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','find','create','body','params','getFields','findOne','ZohoField','nolimit','order','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','ZohoConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes'];(function(_0x47981a,_0x2d60c7){var _0x49ce4a=function(_0x2dd777){while(--_0x2dd777){_0x47981a['push'](_0x47981a['shift']());}};_0x49ce4a(++_0x2d60c7);}(_0xeb50,0x101));var _0x0eb5=function(_0x1551ed,_0x5cc3ce){_0x1551ed=_0x1551ed-0x0;var _0x499928=_0xeb50[_0x1551ed];return _0x499928;};'use strict';var emlformat=require(_0x0eb5('0x0'));var rimraf=require(_0x0eb5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0eb5('0x2'));var rp=require('request-promise');var moment=require(_0x0eb5('0x3'));var BPromise=require(_0x0eb5('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0eb5('0x5'));var sox=require(_0x0eb5('0x6'));var csv=require(_0x0eb5('0x7'));var ejs=require(_0x0eb5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0eb5('0x9'));var crypto=require(_0x0eb5('0xa'));var jsforce=require(_0x0eb5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0eb5('0x7'));var querystring=require('querystring');var Papa=require(_0x0eb5('0xc'));var Redis=require(_0x0eb5('0xd'));var authService=require(_0x0eb5('0xe'));var qs=require(_0x0eb5('0xf'));var as=require(_0x0eb5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0eb5('0x11'))(_0x0eb5('0x12'));var utils=require(_0x0eb5('0x13'));var config=require(_0x0eb5('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x528867,_0x5e48b1){_0x5e48b1=_0x5e48b1||0xcc;return function(_0x370299){if(_0x370299){return _0x528867[_0x0eb5('0x15')](_0x5e48b1);}return _0x528867[_0x0eb5('0x16')](_0x5e48b1)[_0x0eb5('0x17')]();};}function respondWithResult(_0x2a2e80,_0x4e6869){_0x4e6869=_0x4e6869||0xc8;return function(_0x29b637){if(_0x29b637){return _0x2a2e80[_0x0eb5('0x16')](_0x4e6869)[_0x0eb5('0x18')](_0x29b637);}};}function respondWithFilteredResult(_0x507ffb,_0x1d76b2){return function(_0x5d59e1){if(_0x5d59e1){var _0x96aef4=typeof _0x1d76b2[_0x0eb5('0x19')]===_0x0eb5('0x1a')&&typeof _0x1d76b2[_0x0eb5('0x1b')]===_0x0eb5('0x1a');var _0xf4f109=_0x5d59e1[_0x0eb5('0x1c')];var _0x10dc41=_0x96aef4?0x0:_0x1d76b2[_0x0eb5('0x19')];var _0x2dbdb3=_0x96aef4?_0x5d59e1[_0x0eb5('0x1c')]:_0x1d76b2['offset']+_0x1d76b2[_0x0eb5('0x1b')];var _0x53949b;if(_0x2dbdb3>=_0xf4f109){_0x2dbdb3=_0xf4f109;_0x53949b=0xc8;}else{_0x53949b=0xce;}_0x507ffb[_0x0eb5('0x16')](_0x53949b);return _0x507ffb['set'](_0x0eb5('0x1d'),_0x10dc41+'-'+_0x2dbdb3+'/'+_0xf4f109)[_0x0eb5('0x18')](_0x5d59e1);}return null;};}function patchUpdates(_0x4088a5){return function(_0x34a582){try{jsonpatch[_0x0eb5('0x1e')](_0x34a582,_0x4088a5,!![]);}catch(_0x233aa0){return BPromise[_0x0eb5('0x1f')](_0x233aa0);}return _0x34a582['save']();};}function saveUpdates(_0x16926e,_0x566bdd){return function(_0x1b3722){if(_0x1b3722){return _0x1b3722[_0x0eb5('0x20')](_0x16926e)['then'](function(_0x41301b){return _0x41301b;});}return null;};}function removeEntity(_0x547661,_0x1a1899){return function(_0x8df39e){if(_0x8df39e){return _0x8df39e[_0x0eb5('0x21')]()[_0x0eb5('0x22')](function(){_0x547661['status'](0xcc)[_0x0eb5('0x17')]();});}};}function handleEntityNotFound(_0x2dc257,_0x590777){return function(_0x518607){if(!_0x518607){_0x2dc257['sendStatus'](0x194);}return _0x518607;};}function handleError(_0xaf04f2,_0x3ad7b9){_0x3ad7b9=_0x3ad7b9||0x1f4;return function(_0x4184c9){logger[_0x0eb5('0x23')](_0x4184c9[_0x0eb5('0x24')]);if(_0x4184c9[_0x0eb5('0x25')]){delete _0x4184c9[_0x0eb5('0x25')];}_0xaf04f2[_0x0eb5('0x16')](_0x3ad7b9)['send'](_0x4184c9);};}exports[_0x0eb5('0x26')]=function(_0x193d43,_0x1268fb){var _0xc70339={},_0x24444a={},_0xef0a82={'count':0x0,'rows':[]};var _0x5e76a5=_['map'](db[_0x0eb5('0x27')][_0x0eb5('0x28')],function(_0x43dc53){return{'name':_0x43dc53[_0x0eb5('0x29')],'type':_0x43dc53[_0x0eb5('0x2a')][_0x0eb5('0x2b')]};});_0x24444a[_0x0eb5('0x2c')]=_[_0x0eb5('0x2d')](_0x5e76a5,_0x0eb5('0x25'));_0x24444a[_0x0eb5('0x2e')]=_[_0x0eb5('0x2f')](_0x193d43[_0x0eb5('0x2e')]);_0x24444a['filters']=_[_0x0eb5('0x30')](_0x24444a[_0x0eb5('0x2c')],_0x24444a[_0x0eb5('0x2e')]);_0xc70339['attributes']=_[_0x0eb5('0x30')](_0x24444a[_0x0eb5('0x2c')],qs['fields'](_0x193d43['query'][_0x0eb5('0x31')]));_0xc70339['attributes']=_0xc70339[_0x0eb5('0x32')][_0x0eb5('0x33')]?_0xc70339[_0x0eb5('0x32')]:_0x24444a['model'];if(!_0x193d43['query'][_0x0eb5('0x34')]('nolimit')){_0xc70339[_0x0eb5('0x1b')]=qs['limit'](_0x193d43[_0x0eb5('0x2e')][_0x0eb5('0x1b')]);_0xc70339[_0x0eb5('0x19')]=qs[_0x0eb5('0x19')](_0x193d43[_0x0eb5('0x2e')][_0x0eb5('0x19')]);}_0xc70339['order']=qs[_0x0eb5('0x35')](_0x193d43[_0x0eb5('0x2e')][_0x0eb5('0x35')]);_0xc70339[_0x0eb5('0x36')]=qs[_0x0eb5('0x37')](_[_0x0eb5('0x38')](_0x193d43[_0x0eb5('0x2e')],_0x24444a[_0x0eb5('0x37')]),_0x5e76a5);if(_0x193d43[_0x0eb5('0x2e')][_0x0eb5('0x39')]){_0xc70339[_0x0eb5('0x36')]=_['merge'](_0xc70339[_0x0eb5('0x36')],{'$or':_[_0x0eb5('0x2d')](_0x5e76a5,function(_0x103bb8){if(_0x103bb8[_0x0eb5('0x2a')]!==_0x0eb5('0x3a')){var _0x39b872={};_0x39b872[_0x103bb8[_0x0eb5('0x25')]]={'$like':'%'+_0x193d43[_0x0eb5('0x2e')][_0x0eb5('0x39')]+'%'};return _0x39b872;}})});}_0xc70339=_[_0x0eb5('0x3b')]({},_0xc70339,_0x193d43[_0x0eb5('0x3c')]);var _0x566b1d={'where':_0xc70339['where']};return db[_0x0eb5('0x27')][_0x0eb5('0x1c')](_0x566b1d)[_0x0eb5('0x22')](function(_0x590e98){_0xef0a82['count']=_0x590e98;if(_0x193d43[_0x0eb5('0x2e')]['includeAll']){_0xc70339[_0x0eb5('0x3d')]=[{'all':!![]}];}return db[_0x0eb5('0x27')][_0x0eb5('0x3e')](_0xc70339);})[_0x0eb5('0x22')](function(_0x5b100a){_0xef0a82[_0x0eb5('0x3f')]=_0x5b100a;return _0xef0a82;})['then'](respondWithFilteredResult(_0x1268fb,_0xc70339))[_0x0eb5('0x40')](handleError(_0x1268fb,null));};exports[_0x0eb5('0x41')]=function(_0x2f5cec,_0x264db2){var _0x10f5cc={'raw':![],'where':{'id':_0x2f5cec['params']['id']}},_0x27a5ee={};_0x27a5ee[_0x0eb5('0x2c')]=_['keys'](db['ZohoConfiguration'][_0x0eb5('0x28')]);_0x27a5ee['query']=_['keys'](_0x2f5cec[_0x0eb5('0x2e')]);_0x27a5ee[_0x0eb5('0x37')]=_['intersection'](_0x27a5ee[_0x0eb5('0x2c')],_0x27a5ee[_0x0eb5('0x2e')]);_0x10f5cc['attributes']=_['intersection'](_0x27a5ee[_0x0eb5('0x2c')],qs[_0x0eb5('0x31')](_0x2f5cec[_0x0eb5('0x2e')][_0x0eb5('0x31')]));_0x10f5cc[_0x0eb5('0x32')]=_0x10f5cc['attributes'][_0x0eb5('0x33')]?_0x10f5cc[_0x0eb5('0x32')]:_0x27a5ee[_0x0eb5('0x2c')];if(_0x2f5cec['query']['includeAll']){_0x10f5cc[_0x0eb5('0x3d')]=[{'all':!![]}];}_0x10f5cc=_[_0x0eb5('0x3b')]({},_0x10f5cc,_0x2f5cec[_0x0eb5('0x3c')]);return db['ZohoConfiguration'][_0x0eb5('0x42')](_0x10f5cc)[_0x0eb5('0x22')](handleEntityNotFound(_0x264db2,null))[_0x0eb5('0x22')](respondWithResult(_0x264db2,null))[_0x0eb5('0x40')](handleError(_0x264db2,null));};exports[_0x0eb5('0x43')]=function(_0x6bb3ba,_0x17c0e2){return db['ZohoConfiguration'][_0x0eb5('0x43')](_0x6bb3ba[_0x0eb5('0x44')],{})['then'](respondWithResult(_0x17c0e2,0xc9))[_0x0eb5('0x40')](handleError(_0x17c0e2,null));};exports[_0x0eb5('0x20')]=function(_0x1bfe3,_0x23cb69){if(_0x1bfe3['body']['id']){delete _0x1bfe3[_0x0eb5('0x44')]['id'];}return db[_0x0eb5('0x27')]['find']({'where':{'id':_0x1bfe3[_0x0eb5('0x45')]['id']}})['then'](handleEntityNotFound(_0x23cb69,null))[_0x0eb5('0x22')](saveUpdates(_0x1bfe3['body'],null))['then'](respondWithResult(_0x23cb69,null))['catch'](handleError(_0x23cb69,null));};exports[_0x0eb5('0x21')]=function(_0x3d27d7,_0x8d754a){return db[_0x0eb5('0x27')][_0x0eb5('0x42')]({'where':{'id':_0x3d27d7[_0x0eb5('0x45')]['id']}})[_0x0eb5('0x22')](handleEntityNotFound(_0x8d754a,null))['then'](removeEntity(_0x8d754a,null))[_0x0eb5('0x40')](handleError(_0x8d754a,null));};exports[_0x0eb5('0x46')]=function(_0x1841fd,_0x436176,_0x29b385){var _0x33f7ce={};var _0x1e690b={};var _0x34080b;var _0x5044e8;return db[_0x0eb5('0x27')][_0x0eb5('0x47')]({'where':{'id':_0x1841fd[_0x0eb5('0x45')]['id']}})[_0x0eb5('0x22')](handleEntityNotFound(_0x436176,null))[_0x0eb5('0x22')](function(_0x24b602){if(_0x24b602){_0x34080b=_0x24b602;_0x1e690b[_0x0eb5('0x2c')]=_[_0x0eb5('0x2f')](db[_0x0eb5('0x48')][_0x0eb5('0x28')]);_0x1e690b[_0x0eb5('0x2e')]=_[_0x0eb5('0x2f')](_0x1841fd[_0x0eb5('0x2e')]);_0x1e690b['filters']=_[_0x0eb5('0x30')](_0x1e690b[_0x0eb5('0x2c')],_0x1e690b[_0x0eb5('0x2e')]);_0x33f7ce[_0x0eb5('0x32')]=_[_0x0eb5('0x30')](_0x1e690b[_0x0eb5('0x2c')],qs[_0x0eb5('0x31')](_0x1841fd[_0x0eb5('0x2e')][_0x0eb5('0x31')]));_0x33f7ce[_0x0eb5('0x32')]=_0x33f7ce[_0x0eb5('0x32')]['length']?_0x33f7ce[_0x0eb5('0x32')]:_0x1e690b['model'];_0x33f7ce['order']=qs[_0x0eb5('0x35')](_0x1841fd[_0x0eb5('0x2e')][_0x0eb5('0x35')]);_0x33f7ce[_0x0eb5('0x36')]=qs[_0x0eb5('0x37')](_[_0x0eb5('0x38')](_0x1841fd[_0x0eb5('0x2e')],_0x1e690b[_0x0eb5('0x37')]));if(_0x1841fd[_0x0eb5('0x2e')][_0x0eb5('0x39')]){_0x33f7ce[_0x0eb5('0x36')]=_['merge'](_0x33f7ce['where'],{'$or':_[_0x0eb5('0x2d')](_0x33f7ce[_0x0eb5('0x32')],function(_0x581486){var _0x377e35={};_0x377e35[_0x581486]={'$like':'%'+_0x1841fd[_0x0eb5('0x2e')][_0x0eb5('0x39')]+'%'};return _0x377e35;})});}_0x33f7ce=_[_0x0eb5('0x3b')]({},_0x33f7ce,_0x1841fd[_0x0eb5('0x3c')]);return _0x34080b[_0x0eb5('0x46')](_0x33f7ce);}})[_0x0eb5('0x22')](function(_0x5203b8){if(_0x5203b8){_0x5044e8=_0x5203b8['length'];if(!_0x1841fd[_0x0eb5('0x2e')][_0x0eb5('0x34')](_0x0eb5('0x49'))){_0x33f7ce[_0x0eb5('0x1b')]=qs['limit'](_0x1841fd[_0x0eb5('0x2e')][_0x0eb5('0x1b')]);_0x33f7ce['offset']=qs[_0x0eb5('0x19')](_0x1841fd[_0x0eb5('0x2e')][_0x0eb5('0x19')]);}return _0x34080b[_0x0eb5('0x46')](_0x33f7ce);}})['then'](function(_0x29fddc){if(_0x29fddc){return _0x29fddc?{'count':_0x5044e8,'rows':_0x29fddc}:null;}})[_0x0eb5('0x22')](respondWithResult(_0x436176,null))[_0x0eb5('0x40')](handleError(_0x436176,null));};exports['getSubjects']=function(_0x1a8394,_0x530bc2,_0x42308e){var _0x3609c5={};var _0x2ed0bb={};var _0xf835a3;var _0x5b9d4a;return db['ZohoConfiguration'][_0x0eb5('0x47')]({'where':{'id':_0x1a8394['params']['id']}})['then'](handleEntityNotFound(_0x530bc2,null))[_0x0eb5('0x22')](function(_0x2be17b){if(_0x2be17b){_0xf835a3=_0x2be17b;_0x2ed0bb[_0x0eb5('0x2c')]=_[_0x0eb5('0x2f')](db[_0x0eb5('0x48')]['rawAttributes']);_0x2ed0bb[_0x0eb5('0x2e')]=_[_0x0eb5('0x2f')](_0x1a8394[_0x0eb5('0x2e')]);_0x2ed0bb[_0x0eb5('0x37')]=_[_0x0eb5('0x30')](_0x2ed0bb[_0x0eb5('0x2c')],_0x2ed0bb[_0x0eb5('0x2e')]);_0x3609c5['attributes']=_[_0x0eb5('0x30')](_0x2ed0bb['model'],qs[_0x0eb5('0x31')](_0x1a8394[_0x0eb5('0x2e')]['fields']));_0x3609c5[_0x0eb5('0x32')]=_0x3609c5[_0x0eb5('0x32')][_0x0eb5('0x33')]?_0x3609c5[_0x0eb5('0x32')]:_0x2ed0bb[_0x0eb5('0x2c')];_0x3609c5[_0x0eb5('0x4a')]=qs[_0x0eb5('0x35')](_0x1a8394[_0x0eb5('0x2e')][_0x0eb5('0x35')]);_0x3609c5[_0x0eb5('0x36')]=qs[_0x0eb5('0x37')](_['pick'](_0x1a8394[_0x0eb5('0x2e')],_0x2ed0bb['filters']));if(_0x1a8394[_0x0eb5('0x2e')][_0x0eb5('0x39')]){_0x3609c5[_0x0eb5('0x36')]=_[_0x0eb5('0x3b')](_0x3609c5[_0x0eb5('0x36')],{'$or':_['map'](_0x3609c5[_0x0eb5('0x32')],function(_0x120401){var _0x22c58c={};_0x22c58c[_0x120401]={'$like':'%'+_0x1a8394[_0x0eb5('0x2e')][_0x0eb5('0x39')]+'%'};return _0x22c58c;})});}_0x3609c5=_[_0x0eb5('0x3b')]({},_0x3609c5,_0x1a8394['options']);return _0xf835a3['getSubjects'](_0x3609c5);}})[_0x0eb5('0x22')](function(_0x53759a){if(_0x53759a){_0x5b9d4a=_0x53759a[_0x0eb5('0x33')];if(!_0x1a8394[_0x0eb5('0x2e')][_0x0eb5('0x34')]('nolimit')){_0x3609c5[_0x0eb5('0x1b')]=qs['limit'](_0x1a8394['query'][_0x0eb5('0x1b')]);_0x3609c5[_0x0eb5('0x19')]=qs[_0x0eb5('0x19')](_0x1a8394[_0x0eb5('0x2e')][_0x0eb5('0x19')]);}return _0xf835a3[_0x0eb5('0x4b')](_0x3609c5);}})[_0x0eb5('0x22')](function(_0x2c1761){if(_0x2c1761){return _0x2c1761?{'count':_0x5b9d4a,'rows':_0x2c1761}:null;}})[_0x0eb5('0x22')](respondWithResult(_0x530bc2,null))['catch'](handleError(_0x530bc2,null));};exports[_0x0eb5('0x4c')]=function(_0x505783,_0x951df4,_0x178066){var _0x1e529d={};var _0x59f7a7={};var _0x4eae4f;var _0x4c75a5;return db[_0x0eb5('0x27')][_0x0eb5('0x47')]({'where':{'id':_0x505783[_0x0eb5('0x45')]['id']}})[_0x0eb5('0x22')](handleEntityNotFound(_0x951df4,null))[_0x0eb5('0x22')](function(_0x1dec88){if(_0x1dec88){_0x4eae4f=_0x1dec88;_0x59f7a7[_0x0eb5('0x2c')]=_['keys'](db['ZohoField'][_0x0eb5('0x28')]);_0x59f7a7[_0x0eb5('0x2e')]=_[_0x0eb5('0x2f')](_0x505783[_0x0eb5('0x2e')]);_0x59f7a7[_0x0eb5('0x37')]=_[_0x0eb5('0x30')](_0x59f7a7['model'],_0x59f7a7[_0x0eb5('0x2e')]);_0x1e529d[_0x0eb5('0x32')]=_[_0x0eb5('0x30')](_0x59f7a7[_0x0eb5('0x2c')],qs[_0x0eb5('0x31')](_0x505783[_0x0eb5('0x2e')][_0x0eb5('0x31')]));_0x1e529d['attributes']=_0x1e529d[_0x0eb5('0x32')][_0x0eb5('0x33')]?_0x1e529d[_0x0eb5('0x32')]:_0x59f7a7[_0x0eb5('0x2c')];_0x1e529d[_0x0eb5('0x4a')]=qs[_0x0eb5('0x35')](_0x505783[_0x0eb5('0x2e')][_0x0eb5('0x35')]);_0x1e529d[_0x0eb5('0x36')]=qs[_0x0eb5('0x37')](_[_0x0eb5('0x38')](_0x505783['query'],_0x59f7a7[_0x0eb5('0x37')]));if(_0x505783[_0x0eb5('0x2e')][_0x0eb5('0x39')]){_0x1e529d[_0x0eb5('0x36')]=_['merge'](_0x1e529d['where'],{'$or':_[_0x0eb5('0x2d')](_0x1e529d['attributes'],function(_0x159479){var _0x1fd973={};_0x1fd973[_0x159479]={'$like':'%'+_0x505783[_0x0eb5('0x2e')][_0x0eb5('0x39')]+'%'};return _0x1fd973;})});}_0x1e529d=_['merge']({},_0x1e529d,_0x505783[_0x0eb5('0x3c')]);return _0x4eae4f[_0x0eb5('0x4c')](_0x1e529d);}})[_0x0eb5('0x22')](function(_0x152911){if(_0x152911){_0x4c75a5=_0x152911['length'];if(!_0x505783[_0x0eb5('0x2e')][_0x0eb5('0x34')](_0x0eb5('0x49'))){_0x1e529d[_0x0eb5('0x1b')]=qs['limit'](_0x505783['query'][_0x0eb5('0x1b')]);_0x1e529d['offset']=qs[_0x0eb5('0x19')](_0x505783[_0x0eb5('0x2e')][_0x0eb5('0x19')]);}return _0x4eae4f[_0x0eb5('0x4c')](_0x1e529d);}})['then'](function(_0x130604){if(_0x130604){return _0x130604?{'count':_0x4c75a5,'rows':_0x130604}:null;}})[_0x0eb5('0x22')](respondWithResult(_0x951df4,null))[_0x0eb5('0x40')](handleError(_0x951df4,null));}; \ No newline at end of file +var _0x087d=['limit','count','set','apply','reject','save','destroy','then','sendStatus','error','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','catch','include','find','create','body','update','params','getFields','findOne','fields','getSubjects','ZohoField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined'];(function(_0x35ede4,_0x256e30){var _0x13c24f=function(_0x2698c9){while(--_0x2698c9){_0x35ede4['push'](_0x35ede4['shift']());}};_0x13c24f(++_0x256e30);}(_0x087d,0x11e));var _0xd087=function(_0xbac83d,_0x308b61){_0xbac83d=_0xbac83d-0x0;var _0x4ada23=_0x087d[_0xbac83d];return _0x4ada23;};'use strict';var emlformat=require(_0xd087('0x0'));var rimraf=require(_0xd087('0x1'));var zipdir=require(_0xd087('0x2'));var jsonpatch=require(_0xd087('0x3'));var rp=require(_0xd087('0x4'));var moment=require(_0xd087('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd087('0x6'));var sox=require(_0xd087('0x7'));var csv=require(_0xd087('0x8'));var ejs=require(_0xd087('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd087('0xa'));var squel=require('squel');var crypto=require(_0xd087('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd087('0xc'));var toCsv=require(_0xd087('0x8'));var querystring=require(_0xd087('0xd'));var Papa=require(_0xd087('0xe'));var Redis=require('ioredis');var authService=require(_0xd087('0xf'));var qs=require(_0xd087('0x10'));var as=require(_0xd087('0x11'));var hardwareService=require(_0xd087('0x12'));var logger=require(_0xd087('0x13'))(_0xd087('0x14'));var utils=require(_0xd087('0x15'));var config=require(_0xd087('0x16'));var licenseUtil=require(_0xd087('0x17'));var db=require(_0xd087('0x18'))['db'];function respondWithStatusCode(_0x4ff6df,_0x4f0176){_0x4f0176=_0x4f0176||0xcc;return function(_0x2c2dac){if(_0x2c2dac){return _0x4ff6df['sendStatus'](_0x4f0176);}return _0x4ff6df[_0xd087('0x19')](_0x4f0176)[_0xd087('0x1a')]();};}function respondWithResult(_0x5821cb,_0x432390){_0x432390=_0x432390||0xc8;return function(_0x1ab32f){if(_0x1ab32f){return _0x5821cb['status'](_0x432390)[_0xd087('0x1b')](_0x1ab32f);}};}function respondWithFilteredResult(_0x83e4f8,_0xfd8059){return function(_0x513a84){if(_0x513a84){var _0x43d8a1=typeof _0xfd8059[_0xd087('0x1c')]===_0xd087('0x1d')&&typeof _0xfd8059[_0xd087('0x1e')]===_0xd087('0x1d');var _0x32cb31=_0x513a84[_0xd087('0x1f')];var _0x539773=_0x43d8a1?0x0:_0xfd8059[_0xd087('0x1c')];var _0x41360b=_0x43d8a1?_0x513a84['count']:_0xfd8059[_0xd087('0x1c')]+_0xfd8059[_0xd087('0x1e')];var _0x549bcf;if(_0x41360b>=_0x32cb31){_0x41360b=_0x32cb31;_0x549bcf=0xc8;}else{_0x549bcf=0xce;}_0x83e4f8[_0xd087('0x19')](_0x549bcf);return _0x83e4f8[_0xd087('0x20')]('Content-Range',_0x539773+'-'+_0x41360b+'/'+_0x32cb31)['json'](_0x513a84);}return null;};}function patchUpdates(_0x10a5be){return function(_0x47c9c4){try{jsonpatch[_0xd087('0x21')](_0x47c9c4,_0x10a5be,!![]);}catch(_0x22aa0c){return BPromise[_0xd087('0x22')](_0x22aa0c);}return _0x47c9c4[_0xd087('0x23')]();};}function saveUpdates(_0x4c7a36,_0x319a2c){return function(_0x129863){if(_0x129863){return _0x129863['update'](_0x4c7a36)['then'](function(_0x5f3926){return _0x5f3926;});}return null;};}function removeEntity(_0x42abef,_0x1587e8){return function(_0xa6d116){if(_0xa6d116){return _0xa6d116[_0xd087('0x24')]()[_0xd087('0x25')](function(){_0x42abef['status'](0xcc)[_0xd087('0x1a')]();});}};}function handleEntityNotFound(_0x121c4a,_0x241726){return function(_0x252e7e){if(!_0x252e7e){_0x121c4a[_0xd087('0x26')](0x194);}return _0x252e7e;};}function handleError(_0x225f11,_0x298576){_0x298576=_0x298576||0x1f4;return function(_0x44c4d2){logger[_0xd087('0x27')](_0x44c4d2['stack']);if(_0x44c4d2[_0xd087('0x28')]){delete _0x44c4d2['name'];}_0x225f11[_0xd087('0x19')](_0x298576)[_0xd087('0x29')](_0x44c4d2);};}exports[_0xd087('0x2a')]=function(_0x8916e,_0x4a4d14){var _0x534aac={},_0xbefd4e={},_0xaa8034={'count':0x0,'rows':[]};var _0x3097d8=_[_0xd087('0x2b')](db[_0xd087('0x2c')][_0xd087('0x2d')],function(_0x21ba3a){return{'name':_0x21ba3a[_0xd087('0x2e')],'type':_0x21ba3a[_0xd087('0x2f')]['key']};});_0xbefd4e[_0xd087('0x30')]=_[_0xd087('0x2b')](_0x3097d8,_0xd087('0x28'));_0xbefd4e[_0xd087('0x31')]=_[_0xd087('0x32')](_0x8916e[_0xd087('0x31')]);_0xbefd4e[_0xd087('0x33')]=_['intersection'](_0xbefd4e[_0xd087('0x30')],_0xbefd4e['query']);_0x534aac[_0xd087('0x34')]=_[_0xd087('0x35')](_0xbefd4e['model'],qs['fields'](_0x8916e[_0xd087('0x31')]['fields']));_0x534aac[_0xd087('0x34')]=_0x534aac['attributes'][_0xd087('0x36')]?_0x534aac['attributes']:_0xbefd4e[_0xd087('0x30')];if(!_0x8916e[_0xd087('0x31')][_0xd087('0x37')](_0xd087('0x38'))){_0x534aac['limit']=qs[_0xd087('0x1e')](_0x8916e[_0xd087('0x31')][_0xd087('0x1e')]);_0x534aac[_0xd087('0x1c')]=qs[_0xd087('0x1c')](_0x8916e[_0xd087('0x31')]['offset']);}_0x534aac[_0xd087('0x39')]=qs[_0xd087('0x3a')](_0x8916e[_0xd087('0x31')]['sort']);_0x534aac[_0xd087('0x3b')]=qs[_0xd087('0x33')](_[_0xd087('0x3c')](_0x8916e[_0xd087('0x31')],_0xbefd4e['filters']),_0x3097d8);if(_0x8916e['query'][_0xd087('0x3d')]){_0x534aac[_0xd087('0x3b')]=_[_0xd087('0x3e')](_0x534aac[_0xd087('0x3b')],{'$or':_[_0xd087('0x2b')](_0x3097d8,function(_0x3f6f09){if(_0x3f6f09[_0xd087('0x2f')]!==_0xd087('0x3f')){var _0x52984e={};_0x52984e[_0x3f6f09[_0xd087('0x28')]]={'$like':'%'+_0x8916e[_0xd087('0x31')][_0xd087('0x3d')]+'%'};return _0x52984e;}})});}_0x534aac=_[_0xd087('0x3e')]({},_0x534aac,_0x8916e[_0xd087('0x40')]);var _0x51f4c7={'where':_0x534aac[_0xd087('0x3b')]};return db[_0xd087('0x2c')][_0xd087('0x1f')](_0x51f4c7)[_0xd087('0x25')](function(_0x33ff5d){_0xaa8034[_0xd087('0x1f')]=_0x33ff5d;if(_0x8916e['query'][_0xd087('0x41')]){_0x534aac['include']=[{'all':!![]}];}return db[_0xd087('0x2c')]['findAll'](_0x534aac);})[_0xd087('0x25')](function(_0xb19c07){_0xaa8034['rows']=_0xb19c07;return _0xaa8034;})[_0xd087('0x25')](respondWithFilteredResult(_0x4a4d14,_0x534aac))[_0xd087('0x42')](handleError(_0x4a4d14,null));};exports['show']=function(_0x478738,_0x31c7ce){var _0x1bd8c7={'raw':![],'where':{'id':_0x478738['params']['id']}},_0x50662a={};_0x50662a['model']=_[_0xd087('0x32')](db[_0xd087('0x2c')][_0xd087('0x2d')]);_0x50662a['query']=_[_0xd087('0x32')](_0x478738[_0xd087('0x31')]);_0x50662a[_0xd087('0x33')]=_[_0xd087('0x35')](_0x50662a['model'],_0x50662a[_0xd087('0x31')]);_0x1bd8c7[_0xd087('0x34')]=_['intersection'](_0x50662a[_0xd087('0x30')],qs['fields'](_0x478738[_0xd087('0x31')]['fields']));_0x1bd8c7[_0xd087('0x34')]=_0x1bd8c7[_0xd087('0x34')][_0xd087('0x36')]?_0x1bd8c7[_0xd087('0x34')]:_0x50662a[_0xd087('0x30')];if(_0x478738[_0xd087('0x31')]['includeAll']){_0x1bd8c7[_0xd087('0x43')]=[{'all':!![]}];}_0x1bd8c7=_[_0xd087('0x3e')]({},_0x1bd8c7,_0x478738[_0xd087('0x40')]);return db[_0xd087('0x2c')][_0xd087('0x44')](_0x1bd8c7)['then'](handleEntityNotFound(_0x31c7ce,null))[_0xd087('0x25')](respondWithResult(_0x31c7ce,null))[_0xd087('0x42')](handleError(_0x31c7ce,null));};exports[_0xd087('0x45')]=function(_0x383acd,_0x2f4b09){return db[_0xd087('0x2c')][_0xd087('0x45')](_0x383acd[_0xd087('0x46')],{})[_0xd087('0x25')](respondWithResult(_0x2f4b09,0xc9))[_0xd087('0x42')](handleError(_0x2f4b09,null));};exports[_0xd087('0x47')]=function(_0x35f34c,_0x14d4da){if(_0x35f34c[_0xd087('0x46')]['id']){delete _0x35f34c[_0xd087('0x46')]['id'];}return db[_0xd087('0x2c')][_0xd087('0x44')]({'where':{'id':_0x35f34c[_0xd087('0x48')]['id']}})['then'](handleEntityNotFound(_0x14d4da,null))['then'](saveUpdates(_0x35f34c[_0xd087('0x46')],null))[_0xd087('0x25')](respondWithResult(_0x14d4da,null))[_0xd087('0x42')](handleError(_0x14d4da,null));};exports[_0xd087('0x24')]=function(_0x2cfa7c,_0x2cc55){return db[_0xd087('0x2c')][_0xd087('0x44')]({'where':{'id':_0x2cfa7c[_0xd087('0x48')]['id']}})[_0xd087('0x25')](handleEntityNotFound(_0x2cc55,null))['then'](removeEntity(_0x2cc55,null))['catch'](handleError(_0x2cc55,null));};exports[_0xd087('0x49')]=function(_0x366522,_0xfd351a,_0x2a0858){var _0x4df691={};var _0x4e5799={};var _0x3ce10b;var _0x3f5025;return db[_0xd087('0x2c')][_0xd087('0x4a')]({'where':{'id':_0x366522[_0xd087('0x48')]['id']}})[_0xd087('0x25')](handleEntityNotFound(_0xfd351a,null))['then'](function(_0x3ba3a7){if(_0x3ba3a7){_0x3ce10b=_0x3ba3a7;_0x4e5799[_0xd087('0x30')]=_['keys'](db['ZohoField'][_0xd087('0x2d')]);_0x4e5799[_0xd087('0x31')]=_[_0xd087('0x32')](_0x366522[_0xd087('0x31')]);_0x4e5799['filters']=_[_0xd087('0x35')](_0x4e5799[_0xd087('0x30')],_0x4e5799['query']);_0x4df691['attributes']=_[_0xd087('0x35')](_0x4e5799[_0xd087('0x30')],qs[_0xd087('0x4b')](_0x366522[_0xd087('0x31')][_0xd087('0x4b')]));_0x4df691[_0xd087('0x34')]=_0x4df691[_0xd087('0x34')][_0xd087('0x36')]?_0x4df691['attributes']:_0x4e5799[_0xd087('0x30')];_0x4df691[_0xd087('0x39')]=qs['sort'](_0x366522['query'][_0xd087('0x3a')]);_0x4df691[_0xd087('0x3b')]=qs[_0xd087('0x33')](_[_0xd087('0x3c')](_0x366522[_0xd087('0x31')],_0x4e5799[_0xd087('0x33')]));if(_0x366522[_0xd087('0x31')][_0xd087('0x3d')]){_0x4df691['where']=_[_0xd087('0x3e')](_0x4df691[_0xd087('0x3b')],{'$or':_[_0xd087('0x2b')](_0x4df691['attributes'],function(_0x2e9771){var _0x212791={};_0x212791[_0x2e9771]={'$like':'%'+_0x366522[_0xd087('0x31')][_0xd087('0x3d')]+'%'};return _0x212791;})});}_0x4df691=_['merge']({},_0x4df691,_0x366522[_0xd087('0x40')]);return _0x3ce10b[_0xd087('0x49')](_0x4df691);}})[_0xd087('0x25')](function(_0x29a2d2){if(_0x29a2d2){_0x3f5025=_0x29a2d2['length'];if(!_0x366522[_0xd087('0x31')][_0xd087('0x37')]('nolimit')){_0x4df691[_0xd087('0x1e')]=qs[_0xd087('0x1e')](_0x366522[_0xd087('0x31')][_0xd087('0x1e')]);_0x4df691[_0xd087('0x1c')]=qs['offset'](_0x366522['query'][_0xd087('0x1c')]);}return _0x3ce10b[_0xd087('0x49')](_0x4df691);}})[_0xd087('0x25')](function(_0x486cae){if(_0x486cae){return _0x486cae?{'count':_0x3f5025,'rows':_0x486cae}:null;}})[_0xd087('0x25')](respondWithResult(_0xfd351a,null))[_0xd087('0x42')](handleError(_0xfd351a,null));};exports[_0xd087('0x4c')]=function(_0x5d85de,_0x2b3a1b,_0x57893f){var _0x3d0357={};var _0x1ac0d7={};var _0x436792;var _0x22076a;return db[_0xd087('0x2c')][_0xd087('0x4a')]({'where':{'id':_0x5d85de[_0xd087('0x48')]['id']}})[_0xd087('0x25')](handleEntityNotFound(_0x2b3a1b,null))[_0xd087('0x25')](function(_0x2f69e8){if(_0x2f69e8){_0x436792=_0x2f69e8;_0x1ac0d7[_0xd087('0x30')]=_[_0xd087('0x32')](db[_0xd087('0x4d')][_0xd087('0x2d')]);_0x1ac0d7[_0xd087('0x31')]=_['keys'](_0x5d85de[_0xd087('0x31')]);_0x1ac0d7['filters']=_[_0xd087('0x35')](_0x1ac0d7['model'],_0x1ac0d7['query']);_0x3d0357[_0xd087('0x34')]=_[_0xd087('0x35')](_0x1ac0d7[_0xd087('0x30')],qs['fields'](_0x5d85de[_0xd087('0x31')][_0xd087('0x4b')]));_0x3d0357[_0xd087('0x34')]=_0x3d0357[_0xd087('0x34')][_0xd087('0x36')]?_0x3d0357[_0xd087('0x34')]:_0x1ac0d7[_0xd087('0x30')];_0x3d0357['order']=qs[_0xd087('0x3a')](_0x5d85de[_0xd087('0x31')][_0xd087('0x3a')]);_0x3d0357[_0xd087('0x3b')]=qs[_0xd087('0x33')](_['pick'](_0x5d85de['query'],_0x1ac0d7[_0xd087('0x33')]));if(_0x5d85de[_0xd087('0x31')][_0xd087('0x3d')]){_0x3d0357['where']=_[_0xd087('0x3e')](_0x3d0357[_0xd087('0x3b')],{'$or':_[_0xd087('0x2b')](_0x3d0357['attributes'],function(_0x4917c5){var _0x7ed1f={};_0x7ed1f[_0x4917c5]={'$like':'%'+_0x5d85de[_0xd087('0x31')][_0xd087('0x3d')]+'%'};return _0x7ed1f;})});}_0x3d0357=_['merge']({},_0x3d0357,_0x5d85de[_0xd087('0x40')]);return _0x436792[_0xd087('0x4c')](_0x3d0357);}})[_0xd087('0x25')](function(_0x5032a3){if(_0x5032a3){_0x22076a=_0x5032a3['length'];if(!_0x5d85de[_0xd087('0x31')][_0xd087('0x37')](_0xd087('0x38'))){_0x3d0357[_0xd087('0x1e')]=qs[_0xd087('0x1e')](_0x5d85de[_0xd087('0x31')]['limit']);_0x3d0357[_0xd087('0x1c')]=qs[_0xd087('0x1c')](_0x5d85de['query'][_0xd087('0x1c')]);}return _0x436792['getSubjects'](_0x3d0357);}})['then'](function(_0x5afddf){if(_0x5afddf){return _0x5afddf?{'count':_0x22076a,'rows':_0x5afddf}:null;}})[_0xd087('0x25')](respondWithResult(_0x2b3a1b,null))[_0xd087('0x42')](handleError(_0x2b3a1b,null));};exports[_0xd087('0x4e')]=function(_0x3bc588,_0x33253d,_0xf8d5ba){var _0x5eb3f0={};var _0x2cc0e3={};var _0x4436c7;var _0x2b904f;return db[_0xd087('0x2c')][_0xd087('0x4a')]({'where':{'id':_0x3bc588[_0xd087('0x48')]['id']}})['then'](handleEntityNotFound(_0x33253d,null))['then'](function(_0x14b78b){if(_0x14b78b){_0x4436c7=_0x14b78b;_0x2cc0e3[_0xd087('0x30')]=_['keys'](db[_0xd087('0x4d')][_0xd087('0x2d')]);_0x2cc0e3[_0xd087('0x31')]=_['keys'](_0x3bc588[_0xd087('0x31')]);_0x2cc0e3[_0xd087('0x33')]=_[_0xd087('0x35')](_0x2cc0e3[_0xd087('0x30')],_0x2cc0e3[_0xd087('0x31')]);_0x5eb3f0[_0xd087('0x34')]=_[_0xd087('0x35')](_0x2cc0e3[_0xd087('0x30')],qs[_0xd087('0x4b')](_0x3bc588[_0xd087('0x31')][_0xd087('0x4b')]));_0x5eb3f0[_0xd087('0x34')]=_0x5eb3f0[_0xd087('0x34')][_0xd087('0x36')]?_0x5eb3f0[_0xd087('0x34')]:_0x2cc0e3[_0xd087('0x30')];_0x5eb3f0[_0xd087('0x39')]=qs['sort'](_0x3bc588['query']['sort']);_0x5eb3f0[_0xd087('0x3b')]=qs[_0xd087('0x33')](_['pick'](_0x3bc588[_0xd087('0x31')],_0x2cc0e3[_0xd087('0x33')]));if(_0x3bc588[_0xd087('0x31')][_0xd087('0x3d')]){_0x5eb3f0[_0xd087('0x3b')]=_[_0xd087('0x3e')](_0x5eb3f0[_0xd087('0x3b')],{'$or':_[_0xd087('0x2b')](_0x5eb3f0['attributes'],function(_0x49841e){var _0x3653f8={};_0x3653f8[_0x49841e]={'$like':'%'+_0x3bc588[_0xd087('0x31')]['filter']+'%'};return _0x3653f8;})});}_0x5eb3f0=_[_0xd087('0x3e')]({},_0x5eb3f0,_0x3bc588[_0xd087('0x40')]);return _0x4436c7[_0xd087('0x4e')](_0x5eb3f0);}})[_0xd087('0x25')](function(_0x1179c5){if(_0x1179c5){_0x2b904f=_0x1179c5[_0xd087('0x36')];if(!_0x3bc588['query'][_0xd087('0x37')]('nolimit')){_0x5eb3f0[_0xd087('0x1e')]=qs[_0xd087('0x1e')](_0x3bc588[_0xd087('0x31')][_0xd087('0x1e')]);_0x5eb3f0['offset']=qs[_0xd087('0x1c')](_0x3bc588['query']['offset']);}return _0x4436c7['getDescriptions'](_0x5eb3f0);}})[_0xd087('0x25')](function(_0x57daf8){if(_0x57daf8){return _0x57daf8?{'count':_0x2b904f,'rows':_0x57daf8}:null;}})[_0xd087('0x25')](respondWithResult(_0x33253d,null))[_0xd087('0x42')](handleError(_0x33253d,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index d3d3cf8..c0cfde3 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 _0x3297=['../../config/environment','ZohoConfiguration','int_zoho_configurations','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x50cde0,_0x4818a2){var _0x274b93=function(_0x428bfb){while(--_0x428bfb){_0x50cde0['push'](_0x50cde0['shift']());}};_0x274b93(++_0x4818a2);}(_0x3297,0x161));var _0x7329=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x3297[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x7329('0x0'));var util=require(_0x7329('0x1'));var logger=require('../../config/logger')(_0x7329('0x2'));var moment=require('moment');var BPromise=require(_0x7329('0x3'));var rp=require(_0x7329('0x4'));var fs=require('fs');var path=require(_0x7329('0x5'));var rimraf=require(_0x7329('0x6'));var config=require(_0x7329('0x7'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x35121b,_0x25f377){return _0x35121b['define'](_0x7329('0x8'),attributes,{'tableName':_0x7329('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44bf=['moment','bluebird','request-promise','../../config/environment','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','util','../../config/logger'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x44bf,0x148));var _0xf44b=function(_0x294dbd,_0x3d603e){_0x294dbd=_0x294dbd-0x0;var _0x51b7a2=_0x44bf[_0x294dbd];return _0x51b7a2;};'use strict';var _=require('lodash');var util=require(_0xf44b('0x0'));var logger=require(_0xf44b('0x1'))('api');var moment=require(_0xf44b('0x2'));var BPromise=require(_0xf44b('0x3'));var rp=require(_0xf44b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf44b('0x5'));var attributes=require(_0xf44b('0x6'));module[_0xf44b('0x7')]=function(_0x36cf55,_0x37d208){return _0x36cf55['define'](_0xf44b('0x8'),attributes,{'tableName':_0xf44b('0x9'),'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 2fff39c..c39dc42 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 _0x5ce1=['lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5ce1,0xd2));var _0x15ce=function(_0x577cf0,_0x294a60){_0x577cf0=_0x577cf0-0x0;var _0x529a91=_0x5ce1[_0x577cf0];return _0x529a91;};'use strict';var _=require(_0x15ce('0x0'));var util=require('util');var moment=require(_0x15ce('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15ce('0x2'));var db=require(_0x15ce('0x3'))['db'];var utils=require(_0x15ce('0x4'));var logger=require(_0x15ce('0x5'))(_0x15ce('0x6'));var config=require(_0x15ce('0x7'));var jayson=require(_0x15ce('0x8'));var client=jayson[_0x15ce('0x9')][_0x15ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10ff1f,_0xe44dbe,_0x43df47){return new BPromise(function(_0xe5ef,_0xee8c2d){return client[_0x15ce('0xb')](_0x10ff1f,_0x43df47)['then'](function(_0x459d28){logger['info'](_0x15ce('0xc'),_0xe44dbe,_0x15ce('0xd'));logger['debug'](_0x15ce('0xe'),_0xe44dbe,_0x15ce('0xd'),JSON[_0x15ce('0xf')](_0x459d28));if(_0x459d28[_0x15ce('0x10')]){if(_0x459d28[_0x15ce('0x10')][_0x15ce('0x11')]===0x1f4){logger[_0x15ce('0x10')](_0x15ce('0xc'),_0xe44dbe,_0x459d28[_0x15ce('0x10')]['message']);return _0xee8c2d(_0x459d28[_0x15ce('0x10')][_0x15ce('0x12')]);}logger[_0x15ce('0x10')](_0x15ce('0xc'),_0xe44dbe,_0x459d28[_0x15ce('0x10')]['message']);return _0xe5ef(_0x459d28[_0x15ce('0x10')][_0x15ce('0x12')]);}else{logger[_0x15ce('0x13')](_0x15ce('0xc'),_0xe44dbe,_0x15ce('0xd'));_0xe5ef(_0x459d28[_0x15ce('0x14')][_0x15ce('0x12')]);}})['catch'](function(_0x518192){logger['error'](_0x15ce('0xc'),_0xe44dbe,_0x518192);_0xee8c2d(_0x518192);});});} \ No newline at end of file +var _0x6558=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger'];(function(_0x2b8ed7,_0xf279bc){var _0x346cd4=function(_0x4a8378){while(--_0x4a8378){_0x2b8ed7['push'](_0x2b8ed7['shift']());}};_0x346cd4(++_0xf279bc);}(_0x6558,0x68));var _0x8655=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x6558[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x8655('0x0'));var util=require(_0x8655('0x1'));var moment=require(_0x8655('0x2'));var BPromise=require(_0x8655('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8655('0x4'));var logger=require(_0x8655('0x5'))(_0x8655('0x6'));var config=require(_0x8655('0x7'));var jayson=require(_0x8655('0x8'));var client=jayson[_0x8655('0x9')][_0x8655('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42cb28,_0x4fc544,_0x2bd2d5){return new BPromise(function(_0x5e0e78,_0x2eb596){return client[_0x8655('0xb')](_0x42cb28,_0x2bd2d5)[_0x8655('0xc')](function(_0x324460){logger[_0x8655('0xd')](_0x8655('0xe'),_0x4fc544,_0x8655('0xf'));logger[_0x8655('0x10')](_0x8655('0x11'),_0x4fc544,'request\x20sent',JSON[_0x8655('0x12')](_0x324460));if(_0x324460[_0x8655('0x13')]){if(_0x324460[_0x8655('0x13')]['code']===0x1f4){logger[_0x8655('0x13')](_0x8655('0xe'),_0x4fc544,_0x324460[_0x8655('0x13')][_0x8655('0x14')]);return _0x2eb596(_0x324460[_0x8655('0x13')][_0x8655('0x14')]);}logger['error'](_0x8655('0xe'),_0x4fc544,_0x324460[_0x8655('0x13')]['message']);return _0x5e0e78(_0x324460[_0x8655('0x13')][_0x8655('0x14')]);}else{logger[_0x8655('0xd')](_0x8655('0xe'),_0x4fc544,_0x8655('0xf'));_0x5e0e78(_0x324460['result'][_0x8655('0x14')]);}})[_0x8655('0x15')](function(_0x437b05){logger[_0x8655('0x13')](_0x8655('0xe'),_0x4fc544,_0x437b05);_0x2eb596(_0x437b05);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index f39b154..a987cdb 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 _0x626f=['/:id','post','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated'];(function(_0x1d7e22,_0x138314){var _0x1a3475=function(_0x7b570b){while(--_0x7b570b){_0x1d7e22['push'](_0x1d7e22['shift']());}};_0x1a3475(++_0x138314);}(_0x626f,0xd9));var _0xf626=function(_0x423b0c,_0x2f88ba){_0x423b0c=_0x423b0c-0x0;var _0x446a46=_0x626f[_0x423b0c];return _0x446a46;};'use strict';var multer=require(_0xf626('0x0'));var util=require('util');var path=require(_0xf626('0x1'));var timeout=require('connect-timeout');var express=require(_0xf626('0x2'));var router=express[_0xf626('0x3')]();var fs_extra=require(_0xf626('0x4'));var auth=require(_0xf626('0x5'));var interaction=require(_0xf626('0x6'));var config=require(_0xf626('0x7'));var controller=require(_0xf626('0x8'));router[_0xf626('0x9')]('/',auth[_0xf626('0xa')](),controller['index']);router[_0xf626('0x9')](_0xf626('0xb'),auth[_0xf626('0xa')](),controller['show']);router[_0xf626('0xc')]('/',auth[_0xf626('0xa')](),controller[_0xf626('0xd')]);router[_0xf626('0xe')](_0xf626('0xb'),auth[_0xf626('0xa')](),controller[_0xf626('0xf')]);router[_0xf626('0x10')](_0xf626('0xb'),auth[_0xf626('0xa')](),controller[_0xf626('0x11')]);module[_0xf626('0x12')]=router; \ No newline at end of file +var _0x81d0=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x4515ed,_0x415121){var _0x52f99c=function(_0x30f3e5){while(--_0x30f3e5){_0x4515ed['push'](_0x4515ed['shift']());}};_0x52f99c(++_0x415121);}(_0x81d0,0x6b));var _0x081d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81d0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x081d('0x0'));var util=require(_0x081d('0x1'));var path=require(_0x081d('0x2'));var timeout=require(_0x081d('0x3'));var express=require(_0x081d('0x4'));var router=express[_0x081d('0x5')]();var fs_extra=require(_0x081d('0x6'));var auth=require(_0x081d('0x7'));var interaction=require(_0x081d('0x8'));var config=require(_0x081d('0x9'));var controller=require(_0x081d('0xa'));router[_0x081d('0xb')]('/',auth[_0x081d('0xc')](),controller[_0x081d('0xd')]);router[_0x081d('0xb')]('/:id',auth[_0x081d('0xc')](),controller[_0x081d('0xe')]);router[_0x081d('0xf')]('/',auth[_0x081d('0xc')](),controller[_0x081d('0x10')]);router[_0x081d('0x11')](_0x081d('0x12'),auth[_0x081d('0xc')](),controller['update']);router[_0x081d('0x13')]('/:id',auth[_0x081d('0xc')](),controller[_0x081d('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index abd3879..5a7cdd6 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 _0xeda5=['customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xeda5,0x113));var _0x5eda=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeda5[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x5eda('0x0')]={'type':{'type':Sequelize[_0x5eda('0x1')](_0x5eda('0x2'),_0x5eda('0x3'),_0x5eda('0x4'),_0x5eda('0x5'),_0x5eda('0x6')),'defaultValue':_0x5eda('0x2')},'content':{'type':Sequelize[_0x5eda('0x7')]},'key':{'type':Sequelize[_0x5eda('0x7')]},'keyType':{'type':Sequelize[_0x5eda('0x1')]('string','variable',_0x5eda('0x4'))},'keyContent':{'type':Sequelize[_0x5eda('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5eda('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x080a=['ENUM','string','customVariable','picklist','STRING','BOOLEAN','sequelize'];(function(_0x51a3bb,_0x1388d2){var _0x52a2d0=function(_0xaac3ff){while(--_0xaac3ff){_0x51a3bb['push'](_0x51a3bb['shift']());}};_0x52a2d0(++_0x1388d2);}(_0x080a,0x156));var _0xa080=function(_0x48b0e5,_0x2adebe){_0x48b0e5=_0x48b0e5-0x0;var _0x3649b5=_0x080a[_0x48b0e5];return _0x3649b5;};'use strict';var Sequelize=require(_0xa080('0x0'));module['exports']={'type':{'type':Sequelize[_0xa080('0x1')](_0xa080('0x2'),'variable',_0xa080('0x3'),'keyValue',_0xa080('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa080('0x5')]},'key':{'type':Sequelize[_0xa080('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xa080('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xa080('0x5')]},'idField':{'type':Sequelize[_0xa080('0x5')]},'nameField':{'type':Sequelize[_0xa080('0x5')]},'customField':{'type':Sequelize[_0xa080('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa080('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index f415542..d0ed471 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 _0x709b=['keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','include','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','stack','name','send','map','ZohoField','rawAttributes','fieldName','query'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x709b,0x97));var _0xb709=function(_0x5a93a2,_0x151631){_0x5a93a2=_0x5a93a2-0x0;var _0x3fda90=_0x709b[_0x5a93a2];return _0x3fda90;};'use strict';var emlformat=require(_0xb709('0x0'));var rimraf=require(_0xb709('0x1'));var zipdir=require(_0xb709('0x2'));var jsonpatch=require(_0xb709('0x3'));var rp=require(_0xb709('0x4'));var moment=require(_0xb709('0x5'));var BPromise=require(_0xb709('0x6'));var Mustache=require('mustache');var util=require(_0xb709('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xb709('0x8'));var ejs=require(_0xb709('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb709('0xa'));var squel=require(_0xb709('0xb'));var crypto=require(_0xb709('0xc'));var jsforce=require(_0xb709('0xd'));var deskjs=require(_0xb709('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb709('0xf'));var Papa=require('papaparse');var Redis=require(_0xb709('0x10'));var authService=require(_0xb709('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb709('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb709('0x13'))(_0xb709('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb709('0x15'));var db=require(_0xb709('0x16'))['db'];function respondWithStatusCode(_0x343663,_0x48cd04){_0x48cd04=_0x48cd04||0xcc;return function(_0x4117d4){if(_0x4117d4){return _0x343663[_0xb709('0x17')](_0x48cd04);}return _0x343663[_0xb709('0x18')](_0x48cd04)[_0xb709('0x19')]();};}function respondWithResult(_0x2263a0,_0x276528){_0x276528=_0x276528||0xc8;return function(_0x58c586){if(_0x58c586){return _0x2263a0['status'](_0x276528)[_0xb709('0x1a')](_0x58c586);}};}function respondWithFilteredResult(_0x2683d8,_0x57e2e6){return function(_0x12098d){if(_0x12098d){var _0x52d618=typeof _0x57e2e6[_0xb709('0x1b')]===_0xb709('0x1c')&&typeof _0x57e2e6[_0xb709('0x1d')]===_0xb709('0x1c');var _0x507c76=_0x12098d[_0xb709('0x1e')];var _0x156241=_0x52d618?0x0:_0x57e2e6[_0xb709('0x1b')];var _0x198ee8=_0x52d618?_0x12098d['count']:_0x57e2e6[_0xb709('0x1b')]+_0x57e2e6[_0xb709('0x1d')];var _0x207cc3;if(_0x198ee8>=_0x507c76){_0x198ee8=_0x507c76;_0x207cc3=0xc8;}else{_0x207cc3=0xce;}_0x2683d8[_0xb709('0x18')](_0x207cc3);return _0x2683d8['set'](_0xb709('0x1f'),_0x156241+'-'+_0x198ee8+'/'+_0x507c76)['json'](_0x12098d);}return null;};}function patchUpdates(_0x57d396){return function(_0x352373){try{jsonpatch[_0xb709('0x20')](_0x352373,_0x57d396,!![]);}catch(_0x58b4c7){return BPromise['reject'](_0x58b4c7);}return _0x352373['save']();};}function saveUpdates(_0x3e81be,_0x1cb81f){return function(_0x16a8a3){if(_0x16a8a3){return _0x16a8a3[_0xb709('0x21')](_0x3e81be)[_0xb709('0x22')](function(_0x407931){return _0x407931;});}return null;};}function removeEntity(_0x509411,_0x126698){return function(_0x6f63b5){if(_0x6f63b5){return _0x6f63b5[_0xb709('0x23')]()[_0xb709('0x22')](function(){_0x509411[_0xb709('0x18')](0xcc)[_0xb709('0x19')]();});}};}function handleEntityNotFound(_0x13aaf2,_0x36ffc7){return function(_0x4ad6fc){if(!_0x4ad6fc){_0x13aaf2[_0xb709('0x17')](0x194);}return _0x4ad6fc;};}function handleError(_0x212233,_0x30b6fa){_0x30b6fa=_0x30b6fa||0x1f4;return function(_0x5f5064){logger['error'](_0x5f5064[_0xb709('0x24')]);if(_0x5f5064[_0xb709('0x25')]){delete _0x5f5064[_0xb709('0x25')];}_0x212233['status'](_0x30b6fa)[_0xb709('0x26')](_0x5f5064);};}exports['index']=function(_0x57516c,_0x3274b1){var _0x1f4690={},_0x52ab14={},_0x4598a5={'count':0x0,'rows':[]};var _0x67a956=_[_0xb709('0x27')](db[_0xb709('0x28')][_0xb709('0x29')],function(_0x34cd17){return{'name':_0x34cd17[_0xb709('0x2a')],'type':_0x34cd17['type']['key']};});_0x52ab14['model']=_['map'](_0x67a956,_0xb709('0x25'));_0x52ab14[_0xb709('0x2b')]=_[_0xb709('0x2c')](_0x57516c[_0xb709('0x2b')]);_0x52ab14[_0xb709('0x2d')]=_[_0xb709('0x2e')](_0x52ab14[_0xb709('0x2f')],_0x52ab14[_0xb709('0x2b')]);_0x1f4690[_0xb709('0x30')]=_[_0xb709('0x2e')](_0x52ab14[_0xb709('0x2f')],qs[_0xb709('0x31')](_0x57516c[_0xb709('0x2b')]['fields']));_0x1f4690['attributes']=_0x1f4690['attributes'][_0xb709('0x32')]?_0x1f4690[_0xb709('0x30')]:_0x52ab14[_0xb709('0x2f')];if(!_0x57516c['query']['hasOwnProperty'](_0xb709('0x33'))){_0x1f4690['limit']=qs[_0xb709('0x1d')](_0x57516c['query'][_0xb709('0x1d')]);_0x1f4690[_0xb709('0x1b')]=qs[_0xb709('0x1b')](_0x57516c[_0xb709('0x2b')][_0xb709('0x1b')]);}_0x1f4690[_0xb709('0x34')]=qs[_0xb709('0x35')](_0x57516c[_0xb709('0x2b')][_0xb709('0x35')]);_0x1f4690[_0xb709('0x36')]=qs[_0xb709('0x2d')](_[_0xb709('0x37')](_0x57516c[_0xb709('0x2b')],_0x52ab14['filters']),_0x67a956);if(_0x57516c[_0xb709('0x2b')]['filter']){_0x1f4690['where']=_[_0xb709('0x38')](_0x1f4690[_0xb709('0x36')],{'$or':_['map'](_0x67a956,function(_0x49ca1f){if(_0x49ca1f['type']!=='VIRTUAL'){var _0x38984c={};_0x38984c[_0x49ca1f[_0xb709('0x25')]]={'$like':'%'+_0x57516c[_0xb709('0x2b')]['filter']+'%'};return _0x38984c;}})});}_0x1f4690=_[_0xb709('0x38')]({},_0x1f4690,_0x57516c['options']);var _0x566198={'where':_0x1f4690[_0xb709('0x36')]};return db[_0xb709('0x28')]['count'](_0x566198)[_0xb709('0x22')](function(_0x4dd816){_0x4598a5['count']=_0x4dd816;if(_0x57516c[_0xb709('0x2b')]['includeAll']){_0x1f4690[_0xb709('0x39')]=[{'all':!![]}];}return db[_0xb709('0x28')]['findAll'](_0x1f4690);})[_0xb709('0x22')](function(_0x4d978e){_0x4598a5[_0xb709('0x3a')]=_0x4d978e;return _0x4598a5;})[_0xb709('0x22')](respondWithFilteredResult(_0x3274b1,_0x1f4690))['catch'](handleError(_0x3274b1,null));};exports[_0xb709('0x3b')]=function(_0x41d65d,_0x47be59){var _0x5d415f={'raw':!![],'where':{'id':_0x41d65d[_0xb709('0x3c')]['id']}},_0x4ef87f={};_0x4ef87f[_0xb709('0x2f')]=_[_0xb709('0x2c')](db[_0xb709('0x28')][_0xb709('0x29')]);_0x4ef87f['query']=_[_0xb709('0x2c')](_0x41d65d[_0xb709('0x2b')]);_0x4ef87f['filters']=_[_0xb709('0x2e')](_0x4ef87f[_0xb709('0x2f')],_0x4ef87f[_0xb709('0x2b')]);_0x5d415f[_0xb709('0x30')]=_[_0xb709('0x2e')](_0x4ef87f[_0xb709('0x2f')],qs[_0xb709('0x31')](_0x41d65d[_0xb709('0x2b')]['fields']));_0x5d415f['attributes']=_0x5d415f['attributes'][_0xb709('0x32')]?_0x5d415f[_0xb709('0x30')]:_0x4ef87f[_0xb709('0x2f')];if(_0x41d65d[_0xb709('0x2b')]['includeAll']){_0x5d415f[_0xb709('0x39')]=[{'all':!![]}];}_0x5d415f=_[_0xb709('0x38')]({},_0x5d415f,_0x41d65d['options']);return db[_0xb709('0x28')][_0xb709('0x3d')](_0x5d415f)[_0xb709('0x22')](handleEntityNotFound(_0x47be59,null))[_0xb709('0x22')](respondWithResult(_0x47be59,null))[_0xb709('0x3e')](handleError(_0x47be59,null));};exports[_0xb709('0x3f')]=function(_0x24fb1e,_0x3878fb){return db['ZohoField'][_0xb709('0x3f')](_0x24fb1e[_0xb709('0x40')],{})['then'](respondWithResult(_0x3878fb,0xc9))[_0xb709('0x3e')](handleError(_0x3878fb,null));};exports[_0xb709('0x21')]=function(_0x2d1dea,_0x22e138){if(_0x2d1dea[_0xb709('0x40')]['id']){delete _0x2d1dea[_0xb709('0x40')]['id'];}return db[_0xb709('0x28')][_0xb709('0x3d')]({'where':{'id':_0x2d1dea[_0xb709('0x3c')]['id']}})[_0xb709('0x22')](handleEntityNotFound(_0x22e138,null))['then'](saveUpdates(_0x2d1dea[_0xb709('0x40')],null))[_0xb709('0x22')](respondWithResult(_0x22e138,null))[_0xb709('0x3e')](handleError(_0x22e138,null));};exports[_0xb709('0x23')]=function(_0xc9f8c4,_0x2ac558){return db[_0xb709('0x28')][_0xb709('0x3d')]({'where':{'id':_0xc9f8c4[_0xb709('0x3c')]['id']}})[_0xb709('0x22')](handleEntityNotFound(_0x2ac558,null))['then'](removeEntity(_0x2ac558,null))[_0xb709('0x3e')](handleError(_0x2ac558,null));}; \ No newline at end of file +var _0x6d58=['to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','name','send','index','map','ZohoField','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','pick','filter','where','merge','type','VIRTUAL','options','includeAll','rows','params','rawAttributes','create','body','catch','find','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x4c6a90,_0x43dbb1){var _0x157178=function(_0x332344){while(--_0x332344){_0x4c6a90['push'](_0x4c6a90['shift']());}};_0x157178(++_0x43dbb1);}(_0x6d58,0x7e));var _0x86d5=function(_0x363637,_0x3f4c04){_0x363637=_0x363637-0x0;var _0x2b77f2=_0x6d58[_0x363637];return _0x2b77f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d5('0x0'));var zipdir=require(_0x86d5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x86d5('0x2'));var BPromise=require(_0x86d5('0x3'));var Mustache=require('mustache');var util=require(_0x86d5('0x4'));var path=require(_0x86d5('0x5'));var sox=require(_0x86d5('0x6'));var csv=require('to-csv');var ejs=require(_0x86d5('0x7'));var fs=require('fs');var fs_extra=require(_0x86d5('0x8'));var _=require(_0x86d5('0x9'));var squel=require(_0x86d5('0xa'));var crypto=require(_0x86d5('0xb'));var jsforce=require(_0x86d5('0xc'));var deskjs=require(_0x86d5('0xd'));var toCsv=require(_0x86d5('0xe'));var querystring=require('querystring');var Papa=require(_0x86d5('0xf'));var Redis=require(_0x86d5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x86d5('0x11'));var as=require(_0x86d5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d5('0x13'))(_0x86d5('0x14'));var utils=require(_0x86d5('0x15'));var config=require(_0x86d5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d5('0x17'))['db'];function respondWithStatusCode(_0x15f9e9,_0x72fa53){_0x72fa53=_0x72fa53||0xcc;return function(_0x2a243e){if(_0x2a243e){return _0x15f9e9[_0x86d5('0x18')](_0x72fa53);}return _0x15f9e9[_0x86d5('0x19')](_0x72fa53)[_0x86d5('0x1a')]();};}function respondWithResult(_0x22e5a3,_0x1bc08c){_0x1bc08c=_0x1bc08c||0xc8;return function(_0x538f8b){if(_0x538f8b){return _0x22e5a3['status'](_0x1bc08c)[_0x86d5('0x1b')](_0x538f8b);}};}function respondWithFilteredResult(_0x72e5b7,_0x5c76db){return function(_0x52a55e){if(_0x52a55e){var _0x15640e=typeof _0x5c76db[_0x86d5('0x1c')]==='undefined'&&typeof _0x5c76db[_0x86d5('0x1d')]==='undefined';var _0x2aedf1=_0x52a55e['count'];var _0x215379=_0x15640e?0x0:_0x5c76db['offset'];var _0x1939ee=_0x15640e?_0x52a55e[_0x86d5('0x1e')]:_0x5c76db[_0x86d5('0x1c')]+_0x5c76db[_0x86d5('0x1d')];var _0x5cd0e2;if(_0x1939ee>=_0x2aedf1){_0x1939ee=_0x2aedf1;_0x5cd0e2=0xc8;}else{_0x5cd0e2=0xce;}_0x72e5b7[_0x86d5('0x19')](_0x5cd0e2);return _0x72e5b7[_0x86d5('0x1f')](_0x86d5('0x20'),_0x215379+'-'+_0x1939ee+'/'+_0x2aedf1)[_0x86d5('0x1b')](_0x52a55e);}return null;};}function patchUpdates(_0x42e155){return function(_0x675e64){try{jsonpatch[_0x86d5('0x21')](_0x675e64,_0x42e155,!![]);}catch(_0x55b4d9){return BPromise['reject'](_0x55b4d9);}return _0x675e64[_0x86d5('0x22')]();};}function saveUpdates(_0x259213,_0x203d0e){return function(_0x1f4cfa){if(_0x1f4cfa){return _0x1f4cfa[_0x86d5('0x23')](_0x259213)[_0x86d5('0x24')](function(_0x439247){return _0x439247;});}return null;};}function removeEntity(_0x4bf1b3,_0x4f0dcc){return function(_0x490ca6){if(_0x490ca6){return _0x490ca6[_0x86d5('0x25')]()[_0x86d5('0x24')](function(){_0x4bf1b3[_0x86d5('0x19')](0xcc)[_0x86d5('0x1a')]();});}};}function handleEntityNotFound(_0x4919df,_0x245272){return function(_0x51b629){if(!_0x51b629){_0x4919df[_0x86d5('0x18')](0x194);}return _0x51b629;};}function handleError(_0x3a5034,_0x14ae0e){_0x14ae0e=_0x14ae0e||0x1f4;return function(_0x25f632){logger['error'](_0x25f632['stack']);if(_0x25f632[_0x86d5('0x26')]){delete _0x25f632[_0x86d5('0x26')];}_0x3a5034[_0x86d5('0x19')](_0x14ae0e)[_0x86d5('0x27')](_0x25f632);};}exports[_0x86d5('0x28')]=function(_0x48560a,_0x25b94c){var _0x10946e={},_0x1b2dfc={},_0x5aa39f={'count':0x0,'rows':[]};var _0x4016d9=_[_0x86d5('0x29')](db[_0x86d5('0x2a')]['rawAttributes'],function(_0x5a0465){return{'name':_0x5a0465[_0x86d5('0x2b')],'type':_0x5a0465['type'][_0x86d5('0x2c')]};});_0x1b2dfc['model']=_['map'](_0x4016d9,_0x86d5('0x26'));_0x1b2dfc[_0x86d5('0x2d')]=_[_0x86d5('0x2e')](_0x48560a[_0x86d5('0x2d')]);_0x1b2dfc[_0x86d5('0x2f')]=_[_0x86d5('0x30')](_0x1b2dfc['model'],_0x1b2dfc[_0x86d5('0x2d')]);_0x10946e[_0x86d5('0x31')]=_[_0x86d5('0x30')](_0x1b2dfc[_0x86d5('0x32')],qs['fields'](_0x48560a[_0x86d5('0x2d')][_0x86d5('0x33')]));_0x10946e[_0x86d5('0x31')]=_0x10946e['attributes'][_0x86d5('0x34')]?_0x10946e[_0x86d5('0x31')]:_0x1b2dfc[_0x86d5('0x32')];if(!_0x48560a[_0x86d5('0x2d')]['hasOwnProperty'](_0x86d5('0x35'))){_0x10946e['limit']=qs[_0x86d5('0x1d')](_0x48560a['query'][_0x86d5('0x1d')]);_0x10946e[_0x86d5('0x1c')]=qs[_0x86d5('0x1c')](_0x48560a[_0x86d5('0x2d')][_0x86d5('0x1c')]);}_0x10946e[_0x86d5('0x36')]=qs['sort'](_0x48560a[_0x86d5('0x2d')]['sort']);_0x10946e['where']=qs[_0x86d5('0x2f')](_[_0x86d5('0x37')](_0x48560a[_0x86d5('0x2d')],_0x1b2dfc[_0x86d5('0x2f')]),_0x4016d9);if(_0x48560a[_0x86d5('0x2d')][_0x86d5('0x38')]){_0x10946e[_0x86d5('0x39')]=_[_0x86d5('0x3a')](_0x10946e[_0x86d5('0x39')],{'$or':_[_0x86d5('0x29')](_0x4016d9,function(_0x3de9f1){if(_0x3de9f1[_0x86d5('0x3b')]!==_0x86d5('0x3c')){var _0x14939f={};_0x14939f[_0x3de9f1[_0x86d5('0x26')]]={'$like':'%'+_0x48560a[_0x86d5('0x2d')]['filter']+'%'};return _0x14939f;}})});}_0x10946e=_[_0x86d5('0x3a')]({},_0x10946e,_0x48560a[_0x86d5('0x3d')]);var _0x704871={'where':_0x10946e[_0x86d5('0x39')]};return db[_0x86d5('0x2a')][_0x86d5('0x1e')](_0x704871)[_0x86d5('0x24')](function(_0x48d146){_0x5aa39f[_0x86d5('0x1e')]=_0x48d146;if(_0x48560a[_0x86d5('0x2d')][_0x86d5('0x3e')]){_0x10946e['include']=[{'all':!![]}];}return db[_0x86d5('0x2a')]['findAll'](_0x10946e);})[_0x86d5('0x24')](function(_0x2214c3){_0x5aa39f[_0x86d5('0x3f')]=_0x2214c3;return _0x5aa39f;})['then'](respondWithFilteredResult(_0x25b94c,_0x10946e))['catch'](handleError(_0x25b94c,null));};exports['show']=function(_0x319d94,_0x25fd07){var _0x2a98bc={'raw':!![],'where':{'id':_0x319d94[_0x86d5('0x40')]['id']}},_0x384679={};_0x384679[_0x86d5('0x32')]=_[_0x86d5('0x2e')](db[_0x86d5('0x2a')][_0x86d5('0x41')]);_0x384679['query']=_[_0x86d5('0x2e')](_0x319d94['query']);_0x384679['filters']=_[_0x86d5('0x30')](_0x384679[_0x86d5('0x32')],_0x384679['query']);_0x2a98bc[_0x86d5('0x31')]=_[_0x86d5('0x30')](_0x384679[_0x86d5('0x32')],qs[_0x86d5('0x33')](_0x319d94[_0x86d5('0x2d')]['fields']));_0x2a98bc['attributes']=_0x2a98bc[_0x86d5('0x31')]['length']?_0x2a98bc[_0x86d5('0x31')]:_0x384679['model'];if(_0x319d94['query']['includeAll']){_0x2a98bc['include']=[{'all':!![]}];}_0x2a98bc=_[_0x86d5('0x3a')]({},_0x2a98bc,_0x319d94[_0x86d5('0x3d')]);return db['ZohoField']['find'](_0x2a98bc)[_0x86d5('0x24')](handleEntityNotFound(_0x25fd07,null))[_0x86d5('0x24')](respondWithResult(_0x25fd07,null))['catch'](handleError(_0x25fd07,null));};exports['create']=function(_0x138a3c,_0x1d35a0){return db[_0x86d5('0x2a')][_0x86d5('0x42')](_0x138a3c[_0x86d5('0x43')],{})['then'](respondWithResult(_0x1d35a0,0xc9))[_0x86d5('0x44')](handleError(_0x1d35a0,null));};exports['update']=function(_0x5f410b,_0xcecda4){if(_0x5f410b[_0x86d5('0x43')]['id']){delete _0x5f410b[_0x86d5('0x43')]['id'];}return db[_0x86d5('0x2a')]['find']({'where':{'id':_0x5f410b[_0x86d5('0x40')]['id']}})['then'](handleEntityNotFound(_0xcecda4,null))[_0x86d5('0x24')](saveUpdates(_0x5f410b[_0x86d5('0x43')],null))['then'](respondWithResult(_0xcecda4,null))[_0x86d5('0x44')](handleError(_0xcecda4,null));};exports[_0x86d5('0x25')]=function(_0x7ea1e1,_0x29402f){return db[_0x86d5('0x2a')][_0x86d5('0x45')]({'where':{'id':_0x7ea1e1[_0x86d5('0x40')]['id']}})[_0x86d5('0x24')](handleEntityNotFound(_0x29402f,null))[_0x86d5('0x24')](removeEntity(_0x29402f,null))[_0x86d5('0x44')](handleError(_0x29402f,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 5fc043b..e79d886 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 _0x33af=['moment','bluebird','request-promise','path','rimraf','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','util','api'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x33af,0xec));var _0xf33a=function(_0x1bc762,_0x523eb3){_0x1bc762=_0x1bc762-0x0;var _0x40f70c=_0x33af[_0x1bc762];return _0x40f70c;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var logger=require('../../config/logger')(_0xf33a('0x1'));var moment=require(_0xf33a('0x2'));var BPromise=require(_0xf33a('0x3'));var rp=require(_0xf33a('0x4'));var fs=require('fs');var path=require(_0xf33a('0x5'));var rimraf=require(_0xf33a('0x6'));var config=require('../../config/environment');var attributes=require(_0xf33a('0x7'));module[_0xf33a('0x8')]=function(_0x583e54,_0xc0dd13){return _0x583e54[_0xf33a('0x9')](_0xf33a('0xa'),attributes,{'tableName':_0xf33a('0xb'),'paranoid':![],'indexes':[{'name':_0xf33a('0xc'),'fields':[_0xf33a('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0424=['define','ZohoField','int_zoho_fields','FieldId','../../config/logger','api','moment','bluebird','path','./intZohoField.attributes','exports'];(function(_0x106539,_0x443b45){var _0x51c88=function(_0x2d3336){while(--_0x2d3336){_0x106539['push'](_0x106539['shift']());}};_0x51c88(++_0x443b45);}(_0x0424,0x159));var _0x4042=function(_0x6afc9c,_0xf6b755){_0x6afc9c=_0x6afc9c-0x0;var _0x195d68=_0x0424[_0x6afc9c];return _0x195d68;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4042('0x0'))(_0x4042('0x1'));var moment=require(_0x4042('0x2'));var BPromise=require(_0x4042('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4042('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4042('0x5'));module[_0x4042('0x6')]=function(_0x472795,_0xc0fba0){return _0x472795[_0x4042('0x7')](_0x4042('0x8'),attributes,{'tableName':_0x4042('0x9'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x4042('0xa')],'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 20d197c..a3bd90a 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 _0xd59d=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x1fb4e1,_0x3d4ce6){var _0x22d1b0=function(_0x553822){while(--_0x553822){_0x1fb4e1['push'](_0x1fb4e1['shift']());}};_0x22d1b0(++_0x3d4ce6);}(_0xd59d,0xa7));var _0xdd59=function(_0x58965a,_0x2e71db){_0x58965a=_0x58965a-0x0;var _0x254efc=_0xd59d[_0x58965a];return _0x254efc;};'use strict';var _=require(_0xdd59('0x0'));var util=require(_0xdd59('0x1'));var moment=require(_0xdd59('0x2'));var BPromise=require(_0xdd59('0x3'));var rs=require(_0xdd59('0x4'));var fs=require('fs');var Redis=require(_0xdd59('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdd59('0x6'));var logger=require(_0xdd59('0x7'))(_0xdd59('0x8'));var config=require(_0xdd59('0x9'));var jayson=require(_0xdd59('0xa'));var client=jayson[_0xdd59('0xb')][_0xdd59('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x321fa1,_0x483b88,_0x4eeba5){return new BPromise(function(_0x192f0c,_0x1c1d37){return client[_0xdd59('0xd')](_0x321fa1,_0x4eeba5)['then'](function(_0x2d7cb5){logger[_0xdd59('0xe')](_0xdd59('0xf'),_0x483b88,_0xdd59('0x10'));logger[_0xdd59('0x11')](_0xdd59('0x12'),_0x483b88,_0xdd59('0x10'),JSON[_0xdd59('0x13')](_0x2d7cb5));if(_0x2d7cb5[_0xdd59('0x14')]){if(_0x2d7cb5[_0xdd59('0x14')][_0xdd59('0x15')]===0x1f4){logger[_0xdd59('0x14')](_0xdd59('0xf'),_0x483b88,_0x2d7cb5[_0xdd59('0x14')][_0xdd59('0x16')]);return _0x1c1d37(_0x2d7cb5[_0xdd59('0x14')]['message']);}logger['error'](_0xdd59('0xf'),_0x483b88,_0x2d7cb5[_0xdd59('0x14')]['message']);return _0x192f0c(_0x2d7cb5[_0xdd59('0x14')][_0xdd59('0x16')]);}else{logger[_0xdd59('0xe')]('ZohoField,\x20%s,\x20%s',_0x483b88,_0xdd59('0x10'));_0x192f0c(_0x2d7cb5['result'][_0xdd59('0x16')]);}})[_0xdd59('0x17')](function(_0x2fa039){logger[_0xdd59('0x14')](_0xdd59('0xf'),_0x483b88,_0x2fa039);_0x1c1d37(_0x2fa039);});});} \ No newline at end of file +var _0xdef5=['rpc','jayson/promise','client','http','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x18b16a,_0x240b4a){var _0x5cee97=function(_0x339b38){while(--_0x339b38){_0x18b16a['push'](_0x18b16a['shift']());}};_0x5cee97(++_0x240b4a);}(_0xdef5,0x124));var _0x5def=function(_0x19cd68,_0x5d211a){_0x19cd68=_0x19cd68-0x0;var _0x5b84e8=_0xdef5[_0x19cd68];return _0x5b84e8;};'use strict';var _=require(_0x5def('0x0'));var util=require(_0x5def('0x1'));var moment=require(_0x5def('0x2'));var BPromise=require(_0x5def('0x3'));var rs=require(_0x5def('0x4'));var fs=require('fs');var Redis=require(_0x5def('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5def('0x6'));var logger=require(_0x5def('0x7'))(_0x5def('0x8'));var config=require('../../config/environment');var jayson=require(_0x5def('0x9'));var client=jayson[_0x5def('0xa')][_0x5def('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e7c08,_0x4ec38e,_0x1c1b65){return new BPromise(function(_0x1e34b0,_0x1d9825){return client['request'](_0x1e7c08,_0x1c1b65)['then'](function(_0x344ac7){logger[_0x5def('0xc')](_0x5def('0xd'),_0x4ec38e,_0x5def('0xe'));logger[_0x5def('0xf')](_0x5def('0x10'),_0x4ec38e,_0x5def('0xe'),JSON['stringify'](_0x344ac7));if(_0x344ac7['error']){if(_0x344ac7[_0x5def('0x11')]['code']===0x1f4){logger[_0x5def('0x11')](_0x5def('0xd'),_0x4ec38e,_0x344ac7[_0x5def('0x11')][_0x5def('0x12')]);return _0x1d9825(_0x344ac7['error'][_0x5def('0x12')]);}logger[_0x5def('0x11')]('ZohoField,\x20%s,\x20%s',_0x4ec38e,_0x344ac7[_0x5def('0x11')]['message']);return _0x1e34b0(_0x344ac7[_0x5def('0x11')][_0x5def('0x12')]);}else{logger[_0x5def('0xc')](_0x5def('0xd'),_0x4ec38e,_0x5def('0xe'));_0x1e34b0(_0x344ac7[_0x5def('0x13')]['message']);}})['catch'](function(_0x5a4c59){logger[_0x5def('0x11')](_0x5def('0xd'),_0x4ec38e,_0x5a4c59);_0x1d9825(_0x5a4c59);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 8e06b2c..937a391 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x251421,_0x34bf49){var _0xe9bbff=function(_0x522759){while(--_0x522759){_0x251421['push'](_0x251421['shift']());}};_0xe9bbff(++_0x34bf49);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3b29cf,_0x171bc9){var _0x1dc73b=function(_0x2531e6){while(--_0x2531e6){_0x3b29cf['push'](_0x3b29cf['shift']());}};_0x1dc73b(++_0x171bc9);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 46879a5..dbb8ee3 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 _0x8583=['INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x16a683,_0x2ebd64){var _0x2754da=function(_0x25e636){while(--_0x25e636){_0x16a683['push'](_0x16a683['shift']());}};_0x2754da(++_0x2ebd64);}(_0x8583,0x183));var _0x3858=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8583[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x3858('0x0'));module[_0x3858('0x1')]={'name':{'type':Sequelize[_0x3858('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x3858('0x2')],'allowNull':![],'unique':_0x3858('0x3')},'main':{'type':Sequelize[_0x3858('0x2')],'defaultValue':_0x3858('0x4')},'filename':{'type':Sequelize[_0x3858('0x2')]},'path':{'type':Sequelize[_0x3858('0x2')]},'type':{'type':Sequelize[_0x3858('0x2')]},'size':{'type':Sequelize[_0x3858('0x5')]},'active':{'type':Sequelize[_0x3858('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x3858('0x2')]},'logo':{'type':Sequelize[_0x3858('0x2')]},'state':{'type':Sequelize[_0x3858('0x2')],'unique':_0x3858('0x7')},'description':{'type':Sequelize[_0x3858('0x2')]},'title':{'type':Sequelize[_0x3858('0x2')]},'remoteUri':{'type':Sequelize[_0x3858('0x2')]},'link':{'type':Sequelize[_0x3858('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xb630=['state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0x28ce42,_0x33004f){var _0x35d341=function(_0x9f391e){while(--_0x9f391e){_0x28ce42['push'](_0x28ce42['shift']());}};_0x35d341(++_0x33004f);}(_0xb630,0xb1));var _0x0b63=function(_0x3cf518,_0x2cd587){_0x3cf518=_0x3cf518-0x0;var _0x187969=_0xb630[_0x3cf518];return _0x187969;};'use strict';var Sequelize=require(_0x0b63('0x0'));module[_0x0b63('0x1')]={'name':{'type':Sequelize[_0x0b63('0x2')],'allowNull':![],'unique':_0x0b63('0x3')},'version':{'type':Sequelize[_0x0b63('0x2')],'allowNull':![],'unique':_0x0b63('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x0b63('0x4')},'filename':{'type':Sequelize[_0x0b63('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x0b63('0x5')]},'active':{'type':Sequelize[_0x0b63('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x0b63('0x2')]},'logo':{'type':Sequelize[_0x0b63('0x2')]},'state':{'type':Sequelize[_0x0b63('0x2')],'unique':_0x0b63('0x7')},'description':{'type':Sequelize[_0x0b63('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x0b63('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 943fad6..ab2c721 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 _0x1a37=['stack','name','send','index','map','Integration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x1a37,0xb4));var _0x71a3=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x1a37[_0x409353];return _0x4f4b59;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=typeof _0x32591a[_0x71a3('0x1b')]===_0x71a3('0x1c')&&typeof _0x32591a[_0x71a3('0x1d')]===_0x71a3('0x1c');var _0x1af1bc=_0x59021f[_0x71a3('0x1e')];var _0x5d4dee=_0x4aa918?0x0:_0x32591a[_0x71a3('0x1b')];var _0x27bfb4=_0x4aa918?_0x59021f['count']:_0x32591a['offset']+_0x32591a[_0x71a3('0x1d')];var _0x250db3;if(_0x27bfb4>=_0x1af1bc){_0x27bfb4=_0x1af1bc;_0x250db3=0xc8;}else{_0x250db3=0xce;}_0x1743d7[_0x71a3('0x19')](_0x250db3);return _0x1743d7[_0x71a3('0x1f')](_0x71a3('0x20'),_0x5d4dee+'-'+_0x27bfb4+'/'+_0x1af1bc)['json'](_0x59021f);}return null;};}function patchUpdates(_0x1ab947){return function(_0x4156e1){try{jsonpatch[_0x71a3('0x21')](_0x4156e1,_0x1ab947,!![]);}catch(_0x3ea036){return BPromise[_0x71a3('0x22')](_0x3ea036);}return _0x4156e1['save']();};}function saveUpdates(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x23')](_0x1af24b)[_0x71a3('0x24')](function(_0x21899d){return _0x21899d;});}return null;};}function removeEntity(_0x452bc4,_0x2847b4){return function(_0x5f33c5){if(_0x5f33c5){return _0x5f33c5[_0x71a3('0x25')]()[_0x71a3('0x24')](function(){_0x452bc4[_0x71a3('0x19')](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0xb0f3aa,_0x4fd214){return function(_0x107fbd){if(!_0x107fbd){_0xb0f3aa[_0x71a3('0x18')](0x194);}return _0x107fbd;};}function handleError(_0x4c1a3d,_0x412746){_0x412746=_0x412746||0x1f4;return function(_0x515519){logger[_0x71a3('0x26')](_0x515519[_0x71a3('0x27')]);if(_0x515519[_0x71a3('0x28')]){delete _0x515519[_0x71a3('0x28')];}_0x4c1a3d[_0x71a3('0x19')](_0x412746)[_0x71a3('0x29')](_0x515519);};}exports[_0x71a3('0x2a')]=function(_0x242b85,_0x305eb1){var _0x3fc578={},_0x3ea7aa={},_0x228afa={'count':0x0,'rows':[]};var _0x51cde3=_[_0x71a3('0x2b')](db[_0x71a3('0x2c')][_0x71a3('0x2d')],function(_0x23ae85){return{'name':_0x23ae85['fieldName'],'type':_0x23ae85[_0x71a3('0x2e')][_0x71a3('0x2f')]};});_0x3ea7aa[_0x71a3('0x30')]=_[_0x71a3('0x2b')](_0x51cde3,_0x71a3('0x28'));_0x3ea7aa[_0x71a3('0x31')]=_[_0x71a3('0x32')](_0x242b85['query']);_0x3ea7aa[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],_0x3ea7aa[_0x71a3('0x31')]);_0x3fc578[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x36')]));_0x3fc578[_0x71a3('0x35')]=_0x3fc578[_0x71a3('0x35')][_0x71a3('0x37')]?_0x3fc578['attributes']:_0x3ea7aa['model'];if(!_0x242b85[_0x71a3('0x31')][_0x71a3('0x38')]('nolimit')){_0x3fc578[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x242b85['query'][_0x71a3('0x1d')]);_0x3fc578[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x1b')]);}_0x3fc578[_0x71a3('0x39')]=qs[_0x71a3('0x3a')](_0x242b85['query'][_0x71a3('0x3a')]);_0x3fc578[_0x71a3('0x3b')]=qs[_0x71a3('0x33')](_['pick'](_0x242b85[_0x71a3('0x31')],_0x3ea7aa[_0x71a3('0x33')]),_0x51cde3);if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]){_0x3fc578[_0x71a3('0x3b')]=_['merge'](_0x3fc578['where'],{'$or':_[_0x71a3('0x2b')](_0x51cde3,function(_0x2b3197){if(_0x2b3197[_0x71a3('0x2e')]!==_0x71a3('0x3d')){var _0x36ed2e={};_0x36ed2e[_0x2b3197['name']]={'$like':'%'+_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]+'%'};return _0x36ed2e;}})});}_0x3fc578=_[_0x71a3('0x3e')]({},_0x3fc578,_0x242b85['options']);var _0x17c467={'where':_0x3fc578['where']};return db[_0x71a3('0x2c')][_0x71a3('0x1e')](_0x17c467)[_0x71a3('0x24')](function(_0x43c6d1){_0x228afa[_0x71a3('0x1e')]=_0x43c6d1;if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x3fc578[_0x71a3('0x40')]=[{'all':!![]}];}return db[_0x71a3('0x2c')][_0x71a3('0x41')](_0x3fc578);})['then'](function(_0xa49846){_0x228afa['rows']=_0xa49846;return _0x228afa;})[_0x71a3('0x24')](respondWithFilteredResult(_0x305eb1,_0x3fc578))[_0x71a3('0x42')](handleError(_0x305eb1,null));};exports[_0x71a3('0x43')]=function(_0x18974c,_0x59c7c9){var _0x412bce={'raw':![],'where':{'id':_0x18974c['params']['id']}},_0x4b4fde={};_0x4b4fde[_0x71a3('0x30')]=_[_0x71a3('0x32')](db[_0x71a3('0x2c')][_0x71a3('0x2d')]);_0x4b4fde['query']=_[_0x71a3('0x32')](_0x18974c[_0x71a3('0x31')]);_0x4b4fde[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],_0x4b4fde[_0x71a3('0x31')]);_0x412bce[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x18974c[_0x71a3('0x31')][_0x71a3('0x36')]));_0x412bce[_0x71a3('0x35')]=_0x412bce[_0x71a3('0x35')][_0x71a3('0x37')]?_0x412bce[_0x71a3('0x35')]:_0x4b4fde['model'];if(_0x18974c[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x412bce['include']=[{'all':!![]}];}_0x412bce=_[_0x71a3('0x3e')]({},_0x412bce,_0x18974c[_0x71a3('0x44')]);return db[_0x71a3('0x2c')][_0x71a3('0x45')](_0x412bce)[_0x71a3('0x24')](handleEntityNotFound(_0x59c7c9,null))['then'](respondWithResult(_0x59c7c9,null))['catch'](handleError(_0x59c7c9,null));};exports[_0x71a3('0x46')]=function(_0x4305ee,_0x51d20d){return db[_0x71a3('0x2c')][_0x71a3('0x46')](_0x4305ee[_0x71a3('0x47')],{})[_0x71a3('0x24')](respondWithResult(_0x51d20d,0xc9))[_0x71a3('0x42')](handleError(_0x51d20d,null));};exports[_0x71a3('0x23')]=function(_0x501a62,_0x1c9ba6){if(_0x501a62['body']['id']){delete _0x501a62[_0x71a3('0x47')]['id'];}return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x501a62[_0x71a3('0x48')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1c9ba6,null))['then'](saveUpdates(_0x501a62[_0x71a3('0x47')],null))[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,null))[_0x71a3('0x42')](handleError(_0x1c9ba6,null));};exports['destroy']=function(_0x6c34,_0x4e6423){return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x6c34['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x4e6423,null))[_0x71a3('0x24')](removeEntity(_0x4e6423,null))[_0x71a3('0x42')](handleError(_0x4e6423,null));}; \ No newline at end of file +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(_0x224ad4,_0x13f800){var _0x4dd034=function(_0x272820){while(--_0x272820){_0x224ad4['push'](_0x224ad4['shift']());}};_0x4dd034(++_0x13f800);}(_0x781d,0x14a));var _0xd781=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x781d[_0x2d7f0e];return _0x110b07;};'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 diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 6d43437..3b5a4ad 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 _0x8a0a=['define','Integration','integrations','api','moment','bluebird','request-promise','rimraf','../../config/environment','./integration.attributes','exports'];(function(_0x50eba0,_0x3f92b4){var _0x21c82b=function(_0x2fb4ec){while(--_0x2fb4ec){_0x50eba0['push'](_0x50eba0['shift']());}};_0x21c82b(++_0x3f92b4);}(_0x8a0a,0x71));var _0xa8a0=function(_0x56de88,_0x3dcc91){_0x56de88=_0x56de88-0x0;var _0xb1cd48=_0x8a0a[_0x56de88];return _0xb1cd48;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa8a0('0x0'));var moment=require(_0xa8a0('0x1'));var BPromise=require(_0xa8a0('0x2'));var rp=require(_0xa8a0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa8a0('0x4'));var config=require(_0xa8a0('0x5'));var attributes=require(_0xa8a0('0x6'));module[_0xa8a0('0x7')]=function(_0x2a56cb,_0x4781cc){return _0x2a56cb[_0xa8a0('0x8')](_0xa8a0('0x9'),attributes,{'tableName':_0xa8a0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd16d=['bluebird','request-promise','rimraf','../../config/environment','./integration.attributes','exports','define','lodash','util','api','moment'];(function(_0x22377a,_0x3397cb){var _0x36f105=function(_0x2174cc){while(--_0x2174cc){_0x22377a['push'](_0x22377a['shift']());}};_0x36f105(++_0x3397cb);}(_0xd16d,0x19e));var _0xdd16=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xd16d[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xdd16('0x0'));var util=require(_0xdd16('0x1'));var logger=require('../../config/logger')(_0xdd16('0x2'));var moment=require(_0xdd16('0x3'));var BPromise=require(_0xdd16('0x4'));var rp=require(_0xdd16('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdd16('0x6'));var config=require(_0xdd16('0x7'));var attributes=require(_0xdd16('0x8'));module[_0xdd16('0x9')]=function(_0x198627,_0x208655){return _0x198627[_0xdd16('0xa')]('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 3a311b3..ef8a16d 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 _0xdd4f=['lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x5722eb,_0x3af96a){var _0x1289e3=function(_0x49b465){while(--_0x49b465){_0x5722eb['push'](_0x5722eb['shift']());}};_0x1289e3(++_0x3af96a);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x4d0d4d,_0x4fce93){_0x4d0d4d=_0x4d0d4d-0x0;var _0x27d527=_0xdd4f[_0x4d0d4d];return _0x27d527;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfdd4('0x1'));var fs=require('fs');var Redis=require(_0xfdd4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfdd4('0x3'));var logger=require(_0xfdd4('0x4'))(_0xfdd4('0x5'));var config=require('../../config/environment');var jayson=require(_0xfdd4('0x6'));var client=jayson[_0xfdd4('0x7')][_0xfdd4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x307ac6,_0x3c72d4,_0x51acd6){return new BPromise(function(_0x3cd8e6,_0x563ae6){return client[_0xfdd4('0x9')](_0x307ac6,_0x51acd6)[_0xfdd4('0xa')](function(_0x1e823e){logger['info'](_0xfdd4('0xb'),_0x3c72d4,'request\x20sent');logger[_0xfdd4('0xc')](_0xfdd4('0xd'),_0x3c72d4,_0xfdd4('0xe'),JSON[_0xfdd4('0xf')](_0x1e823e));if(_0x1e823e[_0xfdd4('0x10')]){if(_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x11')]===0x1f4){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x12')]);return _0x563ae6(_0x1e823e['error'][_0xfdd4('0x12')]);}logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e['error'][_0xfdd4('0x12')]);return _0x3cd8e6(_0x1e823e['error'][_0xfdd4('0x12')]);}else{logger[_0xfdd4('0x13')](_0xfdd4('0xb'),_0x3c72d4,_0xfdd4('0xe'));_0x3cd8e6(_0x1e823e[_0xfdd4('0x14')]['message']);}})['catch'](function(_0x559c77){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x559c77);_0x563ae6(_0x559c77);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x499d15,_0x5376c1){var _0x189291=function(_0x52884f){while(--_0x52884f){_0x499d15['push'](_0x499d15['shift']());}};_0x189291(++_0x5376c1);}(_0x2ef3,0xba));var _0x32ef=function(_0x1052d2,_0x40810b){_0x1052d2=_0x1052d2-0x0;var _0x220b3e=_0x2ef3[_0x1052d2];return _0x220b3e;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('Integration,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('Integration,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 830cbb3..8fef355 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 _0x4137=['show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x4137,0xf8));var _0x7413=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x4137[_0x4e676e];return _0x336a3c;};'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')]('/',auth['isAuthenticated'](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x14')]);router['delete'](_0x7413('0xf'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('0x15')]=router; \ No newline at end of file +var _0xc6ac=['./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4cf288,_0x5ab818){var _0x6ff7e5=function(_0x20aeff){while(--_0x20aeff){_0x4cf288['push'](_0x4cf288['shift']());}};_0x6ff7e5(++_0x5ab818);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x52f15c,_0x23f711){_0x52f15c=_0x52f15c-0x0;var _0x416b2b=_0xc6ac[_0x52f15c];return _0x416b2b;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require(_0xcc6a('0x6'));var auth=require(_0xcc6a('0x7'));var interaction=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var controller=require(_0xcc6a('0xa'));router[_0xcc6a('0xb')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router['get'](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router['get'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x11')]);router[_0xcc6a('0x12')]('/',auth[_0xcc6a('0xc')](),controller['create']);router[_0xcc6a('0x13')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['update']);router[_0xcc6a('0x14')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 3e5422b..6ae5a29 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 _0x7602=['SENDING','RECEIVED','FAILED','exports','STRING','DATE','INTEGER','BOOLEAN','TEXT','SENT'];(function(_0x1c0fa0,_0x43e1e7){var _0x47525f=function(_0x2a2f5a){while(--_0x2a2f5a){_0x1c0fa0['push'](_0x1c0fa0['shift']());}};_0x47525f(++_0x43e1e7);}(_0x7602,0x1c5));var _0x2760=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x7602[_0x47a349];return _0x18ab75;};'use strict';var Sequelize=require('sequelize');module[_0x2760('0x0')]={'integration':{'type':Sequelize[_0x2760('0x1')]},'eventChannel':{'type':Sequelize[_0x2760('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x2760('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x2760('0x1')]},'uniqueid':{'type':Sequelize[_0x2760('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2760('0x1')]},'queue':{'type':Sequelize[_0x2760('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x2760('0x2')]},'agentconnectAt':{'type':Sequelize[_0x2760('0x2')]},'holdtime':{'type':Sequelize[_0x2760('0x3')]},'agentcomplete':{'type':Sequelize[_0x2760('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x2760('0x2')]},'talktime':{'type':Sequelize[_0x2760('0x3')]},'agentacw':{'type':Sequelize[_0x2760('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2760('0x3')]},'reason':{'type':Sequelize[_0x2760('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x2760('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x2760('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x2760('0x1')]},'channel':{'type':Sequelize[_0x2760('0x1')]},'channelstate':{'type':Sequelize[_0x2760('0x3')]},'channelstatedesc':{'type':Sequelize[_0x2760('0x1')]},'connectedlinenum':{'type':Sequelize[_0x2760('0x1')]},'connectedlinename':{'type':Sequelize[_0x2760('0x1')]},'language':{'type':Sequelize[_0x2760('0x1')]},'accountcode':{'type':Sequelize[_0x2760('0x1')]},'context':{'type':Sequelize[_0x2760('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x2760('0x1')]},'destchannel':{'type':Sequelize[_0x2760('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x2760('0x1')]},'destcalleridnum':{'type':Sequelize[_0x2760('0x1')]},'destcalleridname':{'type':Sequelize[_0x2760('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x2760('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x2760('0x1')]},'destcontext':{'type':Sequelize[_0x2760('0x1')]},'destexten':{'type':Sequelize[_0x2760('0x1')]},'destpriority':{'type':Sequelize[_0x2760('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x2760('0x1')]},'inReplyTo':{'type':Sequelize[_0x2760('0x1')]},'subject':{'type':Sequelize[_0x2760('0x1')]},'from':{'type':Sequelize[_0x2760('0x1')]},'to':{'type':Sequelize[_0x2760('0x1')]},'cc':{'type':Sequelize[_0x2760('0x1')]},'attachment':{'type':Sequelize[_0x2760('0x5')]},'html':{'type':Sequelize[_0x2760('0x5')]},'text':{'type':Sequelize[_0x2760('0x5')]},'status':{'type':Sequelize['ENUM'](_0x2760('0x6'),_0x2760('0x7'),_0x2760('0x8'),_0x2760('0x9'))},'url':{'type':Sequelize[_0x2760('0x1')]},'app':{'type':Sequelize[_0x2760('0x1')]},'appdata':{'type':Sequelize[_0x2760('0x1')]},'projectId':{'type':Sequelize[_0x2760('0x3')]}}; \ No newline at end of file +var _0x605f=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','RECEIVED','sequelize','exports'];(function(_0x334297,_0x939764){var _0x3b76de=function(_0x5c8dc4){while(--_0x5c8dc4){_0x334297['push'](_0x334297['shift']());}};_0x3b76de(++_0x939764);}(_0x605f,0x1ac));var _0xf605=function(_0x4fb425,_0x572718){_0x4fb425=_0x4fb425-0x0;var _0x23e206=_0x605f[_0x4fb425];return _0x23e206;};'use strict';var Sequelize=require(_0xf605('0x0'));module[_0xf605('0x1')]={'integration':{'type':Sequelize[_0xf605('0x2')]},'eventChannel':{'type':Sequelize[_0xf605('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xf605('0x2')]},'integrationId':{'type':Sequelize[_0xf605('0x3')]},'contacts':{'type':Sequelize[_0xf605('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf605('0x2')]},'calleridname':{'type':Sequelize[_0xf605('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xf605('0x2')]},'membername':{'type':Sequelize[_0xf605('0x2')]},'agentcalledAt':{'type':Sequelize[_0xf605('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xf605('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xf605('0x4')]},'talktime':{'type':Sequelize[_0xf605('0x3')]},'agentacw':{'type':Sequelize[_0xf605('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf605('0x3')]},'reason':{'type':Sequelize[_0xf605('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xf605('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf605('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf605('0x2')]},'channelstate':{'type':Sequelize[_0xf605('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xf605('0x2')]},'language':{'type':Sequelize[_0xf605('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf605('0x2')]},'exten':{'type':Sequelize[_0xf605('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf605('0x2')]},'destchannelstate':{'type':Sequelize[_0xf605('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xf605('0x2')]},'destcalleridname':{'type':Sequelize[_0xf605('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xf605('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xf605('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xf605('0x2')]},'destexten':{'type':Sequelize[_0xf605('0x2')]},'destpriority':{'type':Sequelize[_0xf605('0x2')]},'destuniqueid':{'type':Sequelize[_0xf605('0x2')]},'messageId':{'type':Sequelize[_0xf605('0x2')]},'inReplyTo':{'type':Sequelize[_0xf605('0x2')]},'subject':{'type':Sequelize[_0xf605('0x2')]},'from':{'type':Sequelize[_0xf605('0x2')]},'to':{'type':Sequelize[_0xf605('0x2')]},'cc':{'type':Sequelize[_0xf605('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xf605('0x6')]},'text':{'type':Sequelize[_0xf605('0x6')]},'status':{'type':Sequelize[_0xf605('0x7')](_0xf605('0x8'),'SENDING',_0xf605('0x9'),'FAILED')},'url':{'type':Sequelize[_0xf605('0x2')]},'app':{'type':Sequelize[_0xf605('0x2')]},'appdata':{'type':Sequelize[_0xf605('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 726b6ca..c709d03 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 _0x25cc=['reject','update','then','end','sendStatus','stack','name','send','index','IntegrationReport','rawAttributes','fieldName','key','map','query','filters','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','rows','show','params','keys','intersection','include','options','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','json','undefined','limit','count','offset','status','set','Content-Range','apply'];(function(_0x13c003,_0x6db775){var _0x1d59cc=function(_0x7e4d50){while(--_0x7e4d50){_0x13c003['push'](_0x13c003['shift']());}};_0x1d59cc(++_0x6db775);}(_0x25cc,0x78));var _0xc25c=function(_0x5667e3,_0x42c522){_0x5667e3=_0x5667e3-0x0;var _0x169e62=_0x25cc[_0x5667e3];return _0x169e62;};'use strict';var emlformat=require(_0xc25c('0x0'));var rimraf=require(_0xc25c('0x1'));var zipdir=require(_0xc25c('0x2'));var jsonpatch=require(_0xc25c('0x3'));var rp=require(_0xc25c('0x4'));var moment=require(_0xc25c('0x5'));var BPromise=require(_0xc25c('0x6'));var Mustache=require('mustache');var util=require(_0xc25c('0x7'));var path=require(_0xc25c('0x8'));var sox=require(_0xc25c('0x9'));var csv=require(_0xc25c('0xa'));var ejs=require(_0xc25c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc25c('0xc'));var squel=require('squel');var crypto=require(_0xc25c('0xd'));var jsforce=require(_0xc25c('0xe'));var deskjs=require(_0xc25c('0xf'));var toCsv=require(_0xc25c('0xa'));var querystring=require(_0xc25c('0x10'));var Papa=require(_0xc25c('0x11'));var Redis=require(_0xc25c('0x12'));var authService=require(_0xc25c('0x13'));var qs=require(_0xc25c('0x14'));var as=require(_0xc25c('0x15'));var hardwareService=require(_0xc25c('0x16'));var logger=require(_0xc25c('0x17'))('api');var utils=require(_0xc25c('0x18'));var config=require(_0xc25c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc25c('0x1a'))['db'];function respondWithStatusCode(_0x457681,_0x58e7cd){_0x58e7cd=_0x58e7cd||0xcc;return function(_0x306a31){if(_0x306a31){return _0x457681['sendStatus'](_0x58e7cd);}return _0x457681['status'](_0x58e7cd)['end']();};}function respondWithResult(_0x25e08b,_0x1c0af6){_0x1c0af6=_0x1c0af6||0xc8;return function(_0x21ddc0){if(_0x21ddc0){return _0x25e08b['status'](_0x1c0af6)[_0xc25c('0x1b')](_0x21ddc0);}};}function respondWithFilteredResult(_0x3afd76,_0x377022){return function(_0x4bac46){if(_0x4bac46){var _0x5290ae=typeof _0x377022['offset']===_0xc25c('0x1c')&&typeof _0x377022[_0xc25c('0x1d')]===_0xc25c('0x1c');var _0xe481f9=_0x4bac46[_0xc25c('0x1e')];var _0xe38b55=_0x5290ae?0x0:_0x377022[_0xc25c('0x1f')];var _0xed7097=_0x5290ae?_0x4bac46[_0xc25c('0x1e')]:_0x377022[_0xc25c('0x1f')]+_0x377022[_0xc25c('0x1d')];var _0x3d3355;if(_0xed7097>=_0xe481f9){_0xed7097=_0xe481f9;_0x3d3355=0xc8;}else{_0x3d3355=0xce;}_0x3afd76[_0xc25c('0x20')](_0x3d3355);return _0x3afd76[_0xc25c('0x21')](_0xc25c('0x22'),_0xe38b55+'-'+_0xed7097+'/'+_0xe481f9)['json'](_0x4bac46);}return null;};}function patchUpdates(_0x3809a6){return function(_0x4f52fc){try{jsonpatch[_0xc25c('0x23')](_0x4f52fc,_0x3809a6,!![]);}catch(_0x5f4304){return BPromise[_0xc25c('0x24')](_0x5f4304);}return _0x4f52fc['save']();};}function saveUpdates(_0x8b6636,_0x1650da){return function(_0x5e3d00){if(_0x5e3d00){return _0x5e3d00[_0xc25c('0x25')](_0x8b6636)[_0xc25c('0x26')](function(_0x198f2e){return _0x198f2e;});}return null;};}function removeEntity(_0x3da0a3,_0x4cd8f2){return function(_0x369a00){if(_0x369a00){return _0x369a00['destroy']()[_0xc25c('0x26')](function(){_0x3da0a3['status'](0xcc)[_0xc25c('0x27')]();});}};}function handleEntityNotFound(_0x25c0e1,_0x1b65eb){return function(_0xa3d183){if(!_0xa3d183){_0x25c0e1[_0xc25c('0x28')](0x194);}return _0xa3d183;};}function handleError(_0x2d64ba,_0x21fa3e){_0x21fa3e=_0x21fa3e||0x1f4;return function(_0x332f95){logger['error'](_0x332f95[_0xc25c('0x29')]);if(_0x332f95[_0xc25c('0x2a')]){delete _0x332f95[_0xc25c('0x2a')];}_0x2d64ba[_0xc25c('0x20')](_0x21fa3e)[_0xc25c('0x2b')](_0x332f95);};}exports[_0xc25c('0x2c')]=function(_0x280372,_0x66064c){var _0x53be33={},_0x2c1779={},_0x533707={'count':0x0,'rows':[]};var _0x30377b=_['map'](db[_0xc25c('0x2d')][_0xc25c('0x2e')],function(_0x12e1d4){return{'name':_0x12e1d4[_0xc25c('0x2f')],'type':_0x12e1d4['type'][_0xc25c('0x30')]};});_0x2c1779['model']=_[_0xc25c('0x31')](_0x30377b,'name');_0x2c1779[_0xc25c('0x32')]=_['keys'](_0x280372[_0xc25c('0x32')]);_0x2c1779[_0xc25c('0x33')]=_['intersection'](_0x2c1779[_0xc25c('0x34')],_0x2c1779[_0xc25c('0x32')]);_0x53be33[_0xc25c('0x35')]=_['intersection'](_0x2c1779[_0xc25c('0x34')],qs[_0xc25c('0x36')](_0x280372[_0xc25c('0x32')][_0xc25c('0x36')]));_0x53be33[_0xc25c('0x35')]=_0x53be33[_0xc25c('0x35')][_0xc25c('0x37')]?_0x53be33['attributes']:_0x2c1779[_0xc25c('0x34')];if(!_0x280372['query']['hasOwnProperty'](_0xc25c('0x38'))){_0x53be33[_0xc25c('0x1d')]=qs[_0xc25c('0x1d')](_0x280372['query'][_0xc25c('0x1d')]);_0x53be33[_0xc25c('0x1f')]=qs[_0xc25c('0x1f')](_0x280372[_0xc25c('0x32')][_0xc25c('0x1f')]);}_0x53be33[_0xc25c('0x39')]=qs['sort'](_0x280372[_0xc25c('0x32')][_0xc25c('0x3a')]);_0x53be33[_0xc25c('0x3b')]=qs[_0xc25c('0x33')](_[_0xc25c('0x3c')](_0x280372[_0xc25c('0x32')],_0x2c1779[_0xc25c('0x33')]),_0x30377b);if(_0x280372[_0xc25c('0x32')][_0xc25c('0x3d')]){_0x53be33[_0xc25c('0x3b')]=_[_0xc25c('0x3e')](_0x53be33['where'],{'$or':_[_0xc25c('0x31')](_0x30377b,function(_0x2cf240){if(_0x2cf240[_0xc25c('0x3f')]!==_0xc25c('0x40')){var _0x1571ba={};_0x1571ba[_0x2cf240[_0xc25c('0x2a')]]={'$like':'%'+_0x280372[_0xc25c('0x32')][_0xc25c('0x3d')]+'%'};return _0x1571ba;}})});}_0x53be33=_['merge']({},_0x53be33,_0x280372['options']);var _0x5d3640={'where':_0x53be33[_0xc25c('0x3b')]};return db[_0xc25c('0x2d')][_0xc25c('0x1e')](_0x5d3640)['then'](function(_0x53464a){_0x533707[_0xc25c('0x1e')]=_0x53464a;if(_0x280372[_0xc25c('0x32')][_0xc25c('0x41')]){_0x53be33['include']=[{'all':!![]}];}return db[_0xc25c('0x2d')]['findAll'](_0x53be33);})['then'](function(_0x316704){_0x533707[_0xc25c('0x42')]=_0x316704;return _0x533707;})[_0xc25c('0x26')](respondWithFilteredResult(_0x66064c,_0x53be33))['catch'](handleError(_0x66064c,null));};exports[_0xc25c('0x43')]=function(_0x1093a9,_0x53cc89){var _0x38968e={'raw':![],'where':{'id':_0x1093a9[_0xc25c('0x44')]['id']}},_0x2fb07f={};_0x2fb07f[_0xc25c('0x34')]=_[_0xc25c('0x45')](db['IntegrationReport'][_0xc25c('0x2e')]);_0x2fb07f[_0xc25c('0x32')]=_['keys'](_0x1093a9[_0xc25c('0x32')]);_0x2fb07f[_0xc25c('0x33')]=_[_0xc25c('0x46')](_0x2fb07f[_0xc25c('0x34')],_0x2fb07f[_0xc25c('0x32')]);_0x38968e[_0xc25c('0x35')]=_[_0xc25c('0x46')](_0x2fb07f[_0xc25c('0x34')],qs['fields'](_0x1093a9[_0xc25c('0x32')][_0xc25c('0x36')]));_0x38968e[_0xc25c('0x35')]=_0x38968e[_0xc25c('0x35')][_0xc25c('0x37')]?_0x38968e[_0xc25c('0x35')]:_0x2fb07f[_0xc25c('0x34')];if(_0x1093a9[_0xc25c('0x32')][_0xc25c('0x41')]){_0x38968e[_0xc25c('0x47')]=[{'all':!![]}];}_0x38968e=_[_0xc25c('0x3e')]({},_0x38968e,_0x1093a9[_0xc25c('0x48')]);return db[_0xc25c('0x2d')]['find'](_0x38968e)[_0xc25c('0x26')](handleEntityNotFound(_0x53cc89,null))[_0xc25c('0x26')](respondWithResult(_0x53cc89,null))[_0xc25c('0x49')](handleError(_0x53cc89,null));};exports[_0xc25c('0x4a')]=function(_0x23b040,_0x5eff94){return db['IntegrationReport'][_0xc25c('0x4a')](_0x23b040[_0xc25c('0x4b')],{})[_0xc25c('0x26')](respondWithResult(_0x5eff94,0xc9))[_0xc25c('0x49')](handleError(_0x5eff94,null));};exports[_0xc25c('0x25')]=function(_0x31a536,_0x555f43){if(_0x31a536['body']['id']){delete _0x31a536[_0xc25c('0x4b')]['id'];}return db['IntegrationReport'][_0xc25c('0x4c')]({'where':{'id':_0x31a536[_0xc25c('0x44')]['id']}})[_0xc25c('0x26')](handleEntityNotFound(_0x555f43,null))[_0xc25c('0x26')](saveUpdates(_0x31a536[_0xc25c('0x4b')],null))[_0xc25c('0x26')](respondWithResult(_0x555f43,null))[_0xc25c('0x49')](handleError(_0x555f43,null));};exports['destroy']=function(_0x481430,_0x2bbf24){return db[_0xc25c('0x2d')][_0xc25c('0x4c')]({'where':{'id':_0x481430[_0xc25c('0x44')]['id']}})['then'](handleEntityNotFound(_0x2bbf24,null))['then'](removeEntity(_0x2bbf24,null))[_0xc25c('0x49')](handleError(_0x2bbf24,null));};exports[_0xc25c('0x4d')]=function(_0x526ab9,_0x356d54){return db['IntegrationReport'][_0xc25c('0x4d')]()['then'](respondWithResult(_0x356d54,null))['catch'](handleError(_0x356d54,null));}; \ No newline at end of file +var _0x6c91=['sort','filters','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','describe','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','update','then','destroy','error','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x307f86,_0x253aac){var _0x7249a=function(_0x12989c){while(--_0x12989c){_0x307f86['push'](_0x307f86['shift']());}};_0x7249a(++_0x253aac);}(_0x6c91,0xa3));var _0x16c9=function(_0x25b96d,_0x15b1e1){_0x25b96d=_0x25b96d-0x0;var _0x10b347=_0x6c91[_0x25b96d];return _0x10b347;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x16c9('0x0'));var zipdir=require(_0x16c9('0x1'));var jsonpatch=require(_0x16c9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x16c9('0x3'));var Mustache=require(_0x16c9('0x4'));var util=require(_0x16c9('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x16c9('0x6'));var ejs=require(_0x16c9('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x16c9('0x8'));var squel=require(_0x16c9('0x9'));var crypto=require(_0x16c9('0xa'));var jsforce=require(_0x16c9('0xb'));var deskjs=require(_0x16c9('0xc'));var toCsv=require('to-csv');var querystring=require(_0x16c9('0xd'));var Papa=require(_0x16c9('0xe'));var Redis=require(_0x16c9('0xf'));var authService=require(_0x16c9('0x10'));var qs=require(_0x16c9('0x11'));var as=require(_0x16c9('0x12'));var hardwareService=require(_0x16c9('0x13'));var logger=require(_0x16c9('0x14'))(_0x16c9('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x16c9('0x16'));var db=require(_0x16c9('0x17'))['db'];function respondWithStatusCode(_0x22d030,_0xe21f61){_0xe21f61=_0xe21f61||0xcc;return function(_0x131696){if(_0x131696){return _0x22d030[_0x16c9('0x18')](_0xe21f61);}return _0x22d030['status'](_0xe21f61)[_0x16c9('0x19')]();};}function respondWithResult(_0x5e36eb,_0x25d7e6){_0x25d7e6=_0x25d7e6||0xc8;return function(_0x595790){if(_0x595790){return _0x5e36eb['status'](_0x25d7e6)[_0x16c9('0x1a')](_0x595790);}};}function respondWithFilteredResult(_0x2a1a31,_0x43d42d){return function(_0x2fb2d5){if(_0x2fb2d5){var _0x3039be=typeof _0x43d42d[_0x16c9('0x1b')]===_0x16c9('0x1c')&&typeof _0x43d42d[_0x16c9('0x1d')]==='undefined';var _0x2065e4=_0x2fb2d5[_0x16c9('0x1e')];var _0x2997ca=_0x3039be?0x0:_0x43d42d['offset'];var _0x572d80=_0x3039be?_0x2fb2d5[_0x16c9('0x1e')]:_0x43d42d[_0x16c9('0x1b')]+_0x43d42d['limit'];var _0x32cb40;if(_0x572d80>=_0x2065e4){_0x572d80=_0x2065e4;_0x32cb40=0xc8;}else{_0x32cb40=0xce;}_0x2a1a31[_0x16c9('0x1f')](_0x32cb40);return _0x2a1a31[_0x16c9('0x20')](_0x16c9('0x21'),_0x2997ca+'-'+_0x572d80+'/'+_0x2065e4)['json'](_0x2fb2d5);}return null;};}function patchUpdates(_0x3e9672){return function(_0x480311){try{jsonpatch[_0x16c9('0x22')](_0x480311,_0x3e9672,!![]);}catch(_0x35eb61){return BPromise['reject'](_0x35eb61);}return _0x480311['save']();};}function saveUpdates(_0x2657c6,_0x13a254){return function(_0x37e13a){if(_0x37e13a){return _0x37e13a[_0x16c9('0x23')](_0x2657c6)[_0x16c9('0x24')](function(_0x3f8137){return _0x3f8137;});}return null;};}function removeEntity(_0xb3a278,_0x5ec0de){return function(_0x1f6bb2){if(_0x1f6bb2){return _0x1f6bb2[_0x16c9('0x25')]()['then'](function(){_0xb3a278['status'](0xcc)[_0x16c9('0x19')]();});}};}function handleEntityNotFound(_0xea08a9,_0x430a34){return function(_0x19f6fa){if(!_0x19f6fa){_0xea08a9['sendStatus'](0x194);}return _0x19f6fa;};}function handleError(_0x27fc1a,_0x267a7d){_0x267a7d=_0x267a7d||0x1f4;return function(_0x23f448){logger[_0x16c9('0x26')](_0x23f448[_0x16c9('0x27')]);if(_0x23f448['name']){delete _0x23f448[_0x16c9('0x28')];}_0x27fc1a[_0x16c9('0x1f')](_0x267a7d)['send'](_0x23f448);};}exports[_0x16c9('0x29')]=function(_0x1e2c0a,_0x314cbe){var _0x385861={},_0x3a8c61={},_0xbb57c6={'count':0x0,'rows':[]};var _0x382d51=_[_0x16c9('0x2a')](db[_0x16c9('0x2b')][_0x16c9('0x2c')],function(_0x5ed3f1){return{'name':_0x5ed3f1[_0x16c9('0x2d')],'type':_0x5ed3f1[_0x16c9('0x2e')][_0x16c9('0x2f')]};});_0x3a8c61[_0x16c9('0x30')]=_[_0x16c9('0x2a')](_0x382d51,_0x16c9('0x28'));_0x3a8c61[_0x16c9('0x31')]=_[_0x16c9('0x32')](_0x1e2c0a['query']);_0x3a8c61['filters']=_[_0x16c9('0x33')](_0x3a8c61[_0x16c9('0x30')],_0x3a8c61['query']);_0x385861[_0x16c9('0x34')]=_[_0x16c9('0x33')](_0x3a8c61[_0x16c9('0x30')],qs[_0x16c9('0x35')](_0x1e2c0a[_0x16c9('0x31')][_0x16c9('0x35')]));_0x385861[_0x16c9('0x34')]=_0x385861[_0x16c9('0x34')][_0x16c9('0x36')]?_0x385861['attributes']:_0x3a8c61[_0x16c9('0x30')];if(!_0x1e2c0a[_0x16c9('0x31')][_0x16c9('0x37')]('nolimit')){_0x385861['limit']=qs[_0x16c9('0x1d')](_0x1e2c0a[_0x16c9('0x31')]['limit']);_0x385861['offset']=qs[_0x16c9('0x1b')](_0x1e2c0a[_0x16c9('0x31')]['offset']);}_0x385861['order']=qs[_0x16c9('0x38')](_0x1e2c0a['query'][_0x16c9('0x38')]);_0x385861['where']=qs[_0x16c9('0x39')](_['pick'](_0x1e2c0a[_0x16c9('0x31')],_0x3a8c61[_0x16c9('0x39')]),_0x382d51);if(_0x1e2c0a[_0x16c9('0x31')][_0x16c9('0x3a')]){_0x385861['where']=_['merge'](_0x385861[_0x16c9('0x3b')],{'$or':_['map'](_0x382d51,function(_0x387c56){if(_0x387c56[_0x16c9('0x2e')]!==_0x16c9('0x3c')){var _0x4c7f4c={};_0x4c7f4c[_0x387c56[_0x16c9('0x28')]]={'$like':'%'+_0x1e2c0a['query'][_0x16c9('0x3a')]+'%'};return _0x4c7f4c;}})});}_0x385861=_['merge']({},_0x385861,_0x1e2c0a[_0x16c9('0x3d')]);var _0x4862ae={'where':_0x385861['where']};return db[_0x16c9('0x2b')]['count'](_0x4862ae)[_0x16c9('0x24')](function(_0xf5fc75){_0xbb57c6['count']=_0xf5fc75;if(_0x1e2c0a[_0x16c9('0x31')][_0x16c9('0x3e')]){_0x385861[_0x16c9('0x3f')]=[{'all':!![]}];}return db[_0x16c9('0x2b')][_0x16c9('0x40')](_0x385861);})['then'](function(_0x10a6f3){_0xbb57c6[_0x16c9('0x41')]=_0x10a6f3;return _0xbb57c6;})[_0x16c9('0x24')](respondWithFilteredResult(_0x314cbe,_0x385861))['catch'](handleError(_0x314cbe,null));};exports[_0x16c9('0x42')]=function(_0x262e6d,_0x2f65f3){var _0x20f40a={'raw':![],'where':{'id':_0x262e6d[_0x16c9('0x43')]['id']}},_0x950333={};_0x950333[_0x16c9('0x30')]=_[_0x16c9('0x32')](db[_0x16c9('0x2b')][_0x16c9('0x2c')]);_0x950333[_0x16c9('0x31')]=_[_0x16c9('0x32')](_0x262e6d[_0x16c9('0x31')]);_0x950333[_0x16c9('0x39')]=_['intersection'](_0x950333[_0x16c9('0x30')],_0x950333[_0x16c9('0x31')]);_0x20f40a[_0x16c9('0x34')]=_[_0x16c9('0x33')](_0x950333[_0x16c9('0x30')],qs['fields'](_0x262e6d[_0x16c9('0x31')]['fields']));_0x20f40a[_0x16c9('0x34')]=_0x20f40a[_0x16c9('0x34')]['length']?_0x20f40a[_0x16c9('0x34')]:_0x950333['model'];if(_0x262e6d[_0x16c9('0x31')][_0x16c9('0x3e')]){_0x20f40a[_0x16c9('0x3f')]=[{'all':!![]}];}_0x20f40a=_['merge']({},_0x20f40a,_0x262e6d[_0x16c9('0x3d')]);return db['IntegrationReport']['find'](_0x20f40a)[_0x16c9('0x24')](handleEntityNotFound(_0x2f65f3,null))[_0x16c9('0x24')](respondWithResult(_0x2f65f3,null))[_0x16c9('0x44')](handleError(_0x2f65f3,null));};exports['create']=function(_0x341af9,_0xce491b){return db[_0x16c9('0x2b')][_0x16c9('0x45')](_0x341af9[_0x16c9('0x46')],{})[_0x16c9('0x24')](respondWithResult(_0xce491b,0xc9))['catch'](handleError(_0xce491b,null));};exports[_0x16c9('0x23')]=function(_0x3ba206,_0x3e8985){if(_0x3ba206[_0x16c9('0x46')]['id']){delete _0x3ba206[_0x16c9('0x46')]['id'];}return db[_0x16c9('0x2b')]['find']({'where':{'id':_0x3ba206[_0x16c9('0x43')]['id']}})[_0x16c9('0x24')](handleEntityNotFound(_0x3e8985,null))[_0x16c9('0x24')](saveUpdates(_0x3ba206[_0x16c9('0x46')],null))[_0x16c9('0x24')](respondWithResult(_0x3e8985,null))[_0x16c9('0x44')](handleError(_0x3e8985,null));};exports[_0x16c9('0x25')]=function(_0x49ccef,_0x54e6a8){return db[_0x16c9('0x2b')][_0x16c9('0x47')]({'where':{'id':_0x49ccef['params']['id']}})['then'](handleEntityNotFound(_0x54e6a8,null))[_0x16c9('0x24')](removeEntity(_0x54e6a8,null))[_0x16c9('0x44')](handleError(_0x54e6a8,null));};exports[_0x16c9('0x48')]=function(_0x3cef23,_0x5cd228){return db[_0x16c9('0x2b')]['describe']()[_0x16c9('0x24')](respondWithResult(_0x5cd228,null))[_0x16c9('0x44')](handleError(_0x5cd228,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 5f76f69..7154d52 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 _0xbe5f=['./integrationReport.attributes','exports','define','IntegrationReport','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x461599,_0x158353){var _0x2393ff=function(_0x4ab087){while(--_0x4ab087){_0x461599['push'](_0x461599['shift']());}};_0x2393ff(++_0x158353);}(_0xbe5f,0x17a));var _0xfbe5=function(_0xdf2216,_0x5e6227){_0xdf2216=_0xdf2216-0x0;var _0x3c0bdf=_0xbe5f[_0xdf2216];return _0x3c0bdf;};'use strict';var _=require(_0xfbe5('0x0'));var util=require('util');var logger=require(_0xfbe5('0x1'))(_0xfbe5('0x2'));var moment=require(_0xfbe5('0x3'));var BPromise=require(_0xfbe5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfbe5('0x5'));var config=require(_0xfbe5('0x6'));var attributes=require(_0xfbe5('0x7'));module[_0xfbe5('0x8')]=function(_0x2d6920,_0x4ad9f1){return _0x2d6920[_0xfbe5('0x9')](_0xfbe5('0xa'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf95a=['define','../../config/logger','api','bluebird','path','rimraf','./integrationReport.attributes','exports'];(function(_0x34b927,_0xf119ef){var _0x393632=function(_0x5c15ec){while(--_0x5c15ec){_0x34b927['push'](_0x34b927['shift']());}};_0x393632(++_0xf119ef);}(_0xf95a,0x1a1));var _0xaf95=function(_0x1c58aa,_0x422585){_0x1c58aa=_0x1c58aa-0x0;var _0x134381=_0xf95a[_0x1c58aa];return _0x134381;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaf95('0x0'))(_0xaf95('0x1'));var moment=require('moment');var BPromise=require(_0xaf95('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf95('0x3'));var rimraf=require(_0xaf95('0x4'));var config=require('../../config/environment');var attributes=require(_0xaf95('0x5'));module[_0xaf95('0x6')]=function(_0x3f23e8,_0x44e914){return _0x3f23e8[_0xaf95('0x7')]('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index a96a4f2..b4f700e 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 _0x0295=['client','http','then','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','IntegrationReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x401fe6,_0x41fb95){var _0x3258af=function(_0x18fcbb){while(--_0x18fcbb){_0x401fe6['push'](_0x401fe6['shift']());}};_0x3258af(++_0x41fb95);}(_0x0295,0x1f0));var _0x5029=function(_0x4139b8,_0x554564){_0x4139b8=_0x4139b8-0x0;var _0x40c6d6=_0x0295[_0x4139b8];return _0x40c6d6;};'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')]('IntegrationReport,\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);});});} \ No newline at end of file +var _0x7a54=['info','IntegrationReport,\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(_0x1a4de5,_0x252087){_0x1a4de5=_0x1a4de5-0x0;var _0x6c4c11=_0x7a54[_0x1a4de5];return _0x6c4c11;};'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')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 3b61a4f..6e92ac4 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 _0x0b91=['express','Router','fs-extra','../../config/environment','./interval.controller','get','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','destroy','exports','util','path'];(function(_0x3a3b34,_0x1e3779){var _0x44758a=function(_0x188f0e){while(--_0x188f0e){_0x3a3b34['push'](_0x3a3b34['shift']());}};_0x44758a(++_0x1e3779);}(_0x0b91,0xae));var _0x10b9=function(_0x8986ef,_0x46766b){_0x8986ef=_0x8986ef-0x0;var _0x2c73e8=_0x0b91[_0x8986ef];return _0x2c73e8;};'use strict';var multer=require('multer');var util=require(_0x10b9('0x0'));var path=require(_0x10b9('0x1'));var timeout=require('connect-timeout');var express=require(_0x10b9('0x2'));var router=express[_0x10b9('0x3')]();var fs_extra=require(_0x10b9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x10b9('0x5'));var controller=require(_0x10b9('0x6'));router[_0x10b9('0x7')]('/',auth[_0x10b9('0x8')](),controller['index']);router[_0x10b9('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x10b9('0x9')]);router['get'](_0x10b9('0xa'),auth[_0x10b9('0x8')](),controller[_0x10b9('0xb')]);router[_0x10b9('0xc')]('/',auth['isAuthenticated'](),controller[_0x10b9('0xd')]);router[_0x10b9('0xc')](_0x10b9('0xa'),auth[_0x10b9('0x8')](),controller[_0x10b9('0xe')]);router[_0x10b9('0xc')](_0x10b9('0xf'),auth['isAuthenticated'](),controller[_0x10b9('0x10')]);router[_0x10b9('0x11')](_0x10b9('0x12'),auth[_0x10b9('0x8')](),controller[_0x10b9('0x13')]);router['delete'](_0x10b9('0x12'),auth[_0x10b9('0x8')](),controller[_0x10b9('0x14')]);module[_0x10b9('0x15')]=router; \ No newline at end of file +var _0x8ca9=['show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','index','/:id','isAuthenticated'];(function(_0x1af430,_0x4ad130){var _0x2657d6=function(_0x10232d){while(--_0x10232d){_0x1af430['push'](_0x1af430['shift']());}};_0x2657d6(++_0x4ad130);}(_0x8ca9,0x9c));var _0x98ca=function(_0x2bc71d,_0x32fef2){_0x2bc71d=_0x2bc71d-0x0;var _0x482d0d=_0x8ca9[_0x2bc71d];return _0x482d0d;};'use strict';var multer=require(_0x98ca('0x0'));var util=require(_0x98ca('0x1'));var path=require(_0x98ca('0x2'));var timeout=require(_0x98ca('0x3'));var express=require(_0x98ca('0x4'));var router=express[_0x98ca('0x5')]();var fs_extra=require(_0x98ca('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x98ca('0x7'));var controller=require('./interval.controller');router[_0x98ca('0x8')]('/',auth['isAuthenticated'](),controller[_0x98ca('0x9')]);router[_0x98ca('0x8')](_0x98ca('0xa'),auth[_0x98ca('0xb')](),controller[_0x98ca('0xc')]);router[_0x98ca('0x8')](_0x98ca('0xd'),auth[_0x98ca('0xb')](),controller[_0x98ca('0xe')]);router[_0x98ca('0xf')]('/',auth[_0x98ca('0xb')](),controller[_0x98ca('0x10')]);router[_0x98ca('0xf')](_0x98ca('0xd'),auth[_0x98ca('0xb')](),controller[_0x98ca('0x11')]);router[_0x98ca('0xf')](_0x98ca('0x12'),auth['isAuthenticated'](),controller[_0x98ca('0x13')]);router[_0x98ca('0x14')](_0x98ca('0xa'),auth[_0x98ca('0xb')](),controller['update']);router[_0x98ca('0x15')](_0x98ca('0xa'),auth[_0x98ca('0xb')](),controller[_0x98ca('0x16')]);module[_0x98ca('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 720f293..0f94bba 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 _0x0527=['STRING','exports'];(function(_0x755c96,_0x3c3d43){var _0x1e5cea=function(_0xdee267){while(--_0xdee267){_0x755c96['push'](_0x755c96['shift']());}};_0x1e5cea(++_0x3c3d43);}(_0x0527,0x1a7));var _0x7052=function(_0x284e0c,_0x4e6167){_0x284e0c=_0x284e0c-0x0;var _0x1f110f=_0x0527[_0x284e0c];return _0x1f110f;};'use strict';var Sequelize=require('sequelize');module[_0x7052('0x0')]={'name':{'type':Sequelize[_0x7052('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7052('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x9798=['STRING','sequelize','exports'];(function(_0x2d1321,_0x37f086){var _0x1a78ab=function(_0x44ac6b){while(--_0x44ac6b){_0x2d1321['push'](_0x2d1321['shift']());}};_0x1a78ab(++_0x37f086);}(_0x9798,0x1a8));var _0x8979=function(_0x24dd12,_0x14e7b8){_0x24dd12=_0x24dd12-0x0;var _0x534378=_0x9798[_0x24dd12];return _0x534378;};'use strict';var Sequelize=require(_0x8979('0x0'));module[_0x8979('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8979('0x2')]},'interval':{'type':Sequelize[_0x8979('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 46b8117..a8d30f8 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 _0x6845=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','findOne','getIntervals','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/extensions/rewrite','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','get','Intervals','UserProfileResource','destroy','name','send','map','Interval','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x1e2b5b,_0x919349){var _0x27494c=function(_0x11d555){while(--_0x11d555){_0x1e2b5b['push'](_0x1e2b5b['shift']());}};_0x27494c(++_0x919349);}(_0x6845,0x1eb));var _0x5684=function(_0x2d7635,_0x5355bd){_0x2d7635=_0x2d7635-0x0;var _0x4d7e56=_0x6845[_0x2d7635];return _0x4d7e56;};'use strict';var emlformat=require(_0x5684('0x0'));var rimraf=require(_0x5684('0x1'));var zipdir=require(_0x5684('0x2'));var jsonpatch=require(_0x5684('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5684('0x4'));var Mustache=require(_0x5684('0x5'));var util=require('util');var path=require(_0x5684('0x6'));var sox=require(_0x5684('0x7'));var csv=require(_0x5684('0x8'));var ejs=require(_0x5684('0x9'));var fs=require('fs');var fs_extra=require(_0x5684('0xa'));var _=require(_0x5684('0xb'));var squel=require(_0x5684('0xc'));var crypto=require(_0x5684('0xd'));var jsforce=require(_0x5684('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5684('0x8'));var querystring=require('querystring');var Papa=require(_0x5684('0xf'));var Redis=require('ioredis');var authService=require(_0x5684('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5684('0x11'));var hardwareService=require(_0x5684('0x12'));var logger=require(_0x5684('0x13'))(_0x5684('0x14'));var utils=require('../../config/utils');var config=require(_0x5684('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require(_0x5684('0x16'));function respondWithStatusCode(_0x20c9b7,_0x33b7e0){_0x33b7e0=_0x33b7e0||0xcc;return function(_0x3d62f5){if(_0x3d62f5){return _0x20c9b7[_0x5684('0x17')](_0x33b7e0);}return _0x20c9b7[_0x5684('0x18')](_0x33b7e0)[_0x5684('0x19')]();};}function respondWithResult(_0x752e3f,_0x10cf35){_0x10cf35=_0x10cf35||0xc8;return function(_0x3fe0db){if(_0x3fe0db){return _0x752e3f[_0x5684('0x18')](_0x10cf35)['json'](_0x3fe0db);}};}function respondWithFilteredResult(_0x1ea398,_0x4c128e){return function(_0x5e0e24){if(_0x5e0e24){var _0x722784=typeof _0x4c128e[_0x5684('0x1a')]===_0x5684('0x1b')&&typeof _0x4c128e[_0x5684('0x1c')]==='undefined';var _0x32d320=_0x5e0e24[_0x5684('0x1d')];var _0x3cfdf4=_0x722784?0x0:_0x4c128e[_0x5684('0x1a')];var _0x51567d=_0x722784?_0x5e0e24[_0x5684('0x1d')]:_0x4c128e[_0x5684('0x1a')]+_0x4c128e['limit'];var _0x460a0e;if(_0x51567d>=_0x32d320){_0x51567d=_0x32d320;_0x460a0e=0xc8;}else{_0x460a0e=0xce;}_0x1ea398['status'](_0x460a0e);return _0x1ea398[_0x5684('0x1e')](_0x5684('0x1f'),_0x3cfdf4+'-'+_0x51567d+'/'+_0x32d320)[_0x5684('0x20')](_0x5e0e24);}return null;};}function patchUpdates(_0x1d7320){return function(_0x1bfc85){try{jsonpatch[_0x5684('0x21')](_0x1bfc85,_0x1d7320,!![]);}catch(_0x5858bc){return BPromise[_0x5684('0x22')](_0x5858bc);}return _0x1bfc85[_0x5684('0x23')]();};}function saveUpdates(_0x1c5e95,_0x302e21){return function(_0x3960fa){if(_0x3960fa){return _0x3960fa[_0x5684('0x24')](_0x1c5e95)[_0x5684('0x25')](function(_0x522872){return _0x522872;});}return null;};}function removeEntity(_0x2a47c1,_0x19cc70){return function(_0x529403){if(_0x529403){return _0x529403['destroy']()[_0x5684('0x25')](function(){var _0xdcc776=_0x529403[_0x5684('0x26')]({'plain':!![]});var _0x5d8ef8=_0x5684('0x27');return db[_0x5684('0x28')][_0x5684('0x29')]({'where':{'type':_0x5d8ef8,'resourceId':_0xdcc776['id']}})['then'](function(){return _0x529403;});})[_0x5684('0x25')](function(){_0x2a47c1[_0x5684('0x18')](0xcc)[_0x5684('0x19')]();});}};}function handleEntityNotFound(_0x171eae,_0x325028){return function(_0xed2985){if(!_0xed2985){_0x171eae[_0x5684('0x17')](0x194);}return _0xed2985;};}function handleError(_0x1813f3,_0x24f78e){_0x24f78e=_0x24f78e||0x1f4;return function(_0x2dfd17){logger['error'](_0x2dfd17['stack']);if(_0x2dfd17[_0x5684('0x2a')]){delete _0x2dfd17[_0x5684('0x2a')];}_0x1813f3[_0x5684('0x18')](_0x24f78e)[_0x5684('0x2b')](_0x2dfd17);};}exports['index']=function(_0x2515f7,_0x2aded0){var _0x3e3f6d={},_0x4f0a68={},_0x28862b={'count':0x0,'rows':[]};var _0x56026a=_[_0x5684('0x2c')](db[_0x5684('0x2d')][_0x5684('0x2e')],function(_0x3e3fff){return{'name':_0x3e3fff['fieldName'],'type':_0x3e3fff['type'][_0x5684('0x2f')]};});_0x4f0a68[_0x5684('0x30')]=_[_0x5684('0x2c')](_0x56026a,_0x5684('0x2a'));_0x4f0a68[_0x5684('0x31')]=_[_0x5684('0x32')](_0x2515f7[_0x5684('0x31')]);_0x4f0a68[_0x5684('0x33')]=_[_0x5684('0x34')](_0x4f0a68[_0x5684('0x30')],_0x4f0a68['query']);_0x3e3f6d[_0x5684('0x35')]=_[_0x5684('0x34')](_0x4f0a68[_0x5684('0x30')],qs[_0x5684('0x36')](_0x2515f7[_0x5684('0x31')][_0x5684('0x36')]));_0x3e3f6d[_0x5684('0x35')]=_0x3e3f6d['attributes'][_0x5684('0x37')]?_0x3e3f6d[_0x5684('0x35')]:_0x4f0a68['model'];if(!_0x2515f7['query'][_0x5684('0x38')](_0x5684('0x39'))){_0x3e3f6d[_0x5684('0x1c')]=qs[_0x5684('0x1c')](_0x2515f7['query']['limit']);_0x3e3f6d[_0x5684('0x1a')]=qs['offset'](_0x2515f7['query'][_0x5684('0x1a')]);}_0x3e3f6d[_0x5684('0x3a')]=qs['sort'](_0x2515f7['query'][_0x5684('0x3b')]);_0x3e3f6d[_0x5684('0x3c')]=qs['filters'](_[_0x5684('0x3d')](_0x2515f7[_0x5684('0x31')],_0x4f0a68[_0x5684('0x33')]),_0x56026a);if(_0x2515f7[_0x5684('0x31')][_0x5684('0x3e')]){_0x3e3f6d[_0x5684('0x3c')]=_[_0x5684('0x3f')](_0x3e3f6d[_0x5684('0x3c')],{'$or':_['map'](_0x56026a,function(_0x1cdb6b){if(_0x1cdb6b['type']!==_0x5684('0x40')){var _0xa2c078={};_0xa2c078[_0x1cdb6b[_0x5684('0x2a')]]={'$like':'%'+_0x2515f7['query'][_0x5684('0x3e')]+'%'};return _0xa2c078;}})});}_0x3e3f6d=_[_0x5684('0x3f')]({},_0x3e3f6d,_0x2515f7[_0x5684('0x41')]);var _0x2431f3={'where':_0x3e3f6d[_0x5684('0x3c')]};return db[_0x5684('0x2d')]['count'](_0x2431f3)['then'](function(_0x1ed2dc){_0x28862b[_0x5684('0x1d')]=_0x1ed2dc;if(_0x2515f7[_0x5684('0x31')]['includeAll']){_0x3e3f6d['include']=[{'all':!![]}];}return db[_0x5684('0x2d')][_0x5684('0x42')](_0x3e3f6d);})[_0x5684('0x25')](function(_0x1dc413){_0x28862b[_0x5684('0x43')]=_0x1dc413;return _0x28862b;})[_0x5684('0x25')](respondWithFilteredResult(_0x2aded0,_0x3e3f6d))['catch'](handleError(_0x2aded0,null));};exports[_0x5684('0x44')]=function(_0x3a6af7,_0x47fcae){var _0x4964be={'raw':!![],'where':{'id':_0x3a6af7[_0x5684('0x45')]['id']}},_0x4635be={};_0x4635be[_0x5684('0x30')]=_[_0x5684('0x32')](db['Interval'][_0x5684('0x2e')]);_0x4635be[_0x5684('0x31')]=_[_0x5684('0x32')](_0x3a6af7[_0x5684('0x31')]);_0x4635be[_0x5684('0x33')]=_[_0x5684('0x34')](_0x4635be[_0x5684('0x30')],_0x4635be[_0x5684('0x31')]);_0x4964be[_0x5684('0x35')]=_[_0x5684('0x34')](_0x4635be[_0x5684('0x30')],qs['fields'](_0x3a6af7[_0x5684('0x31')][_0x5684('0x36')]));_0x4964be[_0x5684('0x35')]=_0x4964be[_0x5684('0x35')]['length']?_0x4964be[_0x5684('0x35')]:_0x4635be['model'];if(_0x3a6af7['query'][_0x5684('0x46')]){_0x4964be[_0x5684('0x47')]=[{'all':!![]}];}_0x4964be=_[_0x5684('0x3f')]({},_0x4964be,_0x3a6af7[_0x5684('0x41')]);return db[_0x5684('0x2d')][_0x5684('0x48')](_0x4964be)[_0x5684('0x25')](handleEntityNotFound(_0x47fcae,null))[_0x5684('0x25')](respondWithResult(_0x47fcae,null))[_0x5684('0x49')](handleError(_0x47fcae,null));};exports[_0x5684('0x4a')]=function(_0x40a276,_0x3d8596){return db[_0x5684('0x2d')][_0x5684('0x4a')](_0x40a276[_0x5684('0x4b')],{})['then'](function(_0x29bead){var _0x223013=_0x40a276['user'][_0x5684('0x26')]({'plain':!![]});if(!_0x223013)throw new Error(_0x5684('0x4c'));if(_0x223013[_0x5684('0x4d')]==='user'){var _0x32b92f=_0x29bead['get']({'plain':!![]});var _0x829af1=_0x5684('0x27');return db[_0x5684('0x4e')][_0x5684('0x48')]({'where':{'name':_0x829af1,'userProfileId':_0x223013[_0x5684('0x4f')]},'raw':!![]})[_0x5684('0x25')](function(_0x1ab3a9){if(_0x1ab3a9&&_0x1ab3a9[_0x5684('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x32b92f[_0x5684('0x2a')],'resourceId':_0x32b92f['id'],'type':_0x1ab3a9[_0x5684('0x2a')],'sectionId':_0x1ab3a9['id']},{})[_0x5684('0x25')](function(){return _0x29bead;});}else{return _0x29bead;}})[_0x5684('0x49')](function(_0x3f61cb){logger[_0x5684('0x51')](_0x5684('0x52'),_0x3f61cb);throw _0x3f61cb;});}return _0x29bead;})['then'](respondWithResult(_0x3d8596,0xc9))[_0x5684('0x49')](handleError(_0x3d8596,null));};exports[_0x5684('0x24')]=function(_0x323ef0,_0x4ed5ec){if(_0x323ef0[_0x5684('0x4b')]['id']){delete _0x323ef0[_0x5684('0x4b')]['id'];}return db[_0x5684('0x2d')]['find']({'where':{'id':_0x323ef0[_0x5684('0x45')]['id']}})[_0x5684('0x25')](handleEntityNotFound(_0x4ed5ec,null))[_0x5684('0x25')](saveUpdates(_0x323ef0[_0x5684('0x4b')],null))['then'](respondWithResult(_0x4ed5ec,null))[_0x5684('0x49')](handleError(_0x4ed5ec,null));};exports[_0x5684('0x29')]=function(_0x5e17c6,_0xa90449){return db[_0x5684('0x2d')][_0x5684('0x48')]({'where':{'id':_0x5e17c6[_0x5684('0x45')]['id']}})['then'](handleEntityNotFound(_0xa90449,null))[_0x5684('0x25')](removeEntity(_0xa90449,null))[_0x5684('0x49')](handleError(_0xa90449,null));};exports[_0x5684('0x53')]=function(_0x329720,_0x3b997f,_0x384d90){if(_0x329720[_0x5684('0x4b')]['id']){delete _0x329720[_0x5684('0x4b')]['id'];}return db[_0x5684('0x2d')][_0x5684('0x48')]({'where':{'id':_0x329720[_0x5684('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b997f,null))[_0x5684('0x25')](function(_0x1c872f){if(_0x1c872f){_0x329720[_0x5684('0x4b')][_0x5684('0x54')]=_0x1c872f['id'];return db[_0x5684('0x2d')][_0x5684('0x4a')](_0x329720[_0x5684('0x4b')]);}})[_0x5684('0x25')](respondWithResult(_0x3b997f,null))[_0x5684('0x49')](handleError(_0x3b997f,null));};exports['getIntervals']=function(_0x461a08,_0x144d40,_0x56653c){var _0x1cfdd8={};var _0x4355f2={};var _0x35e4b7;var _0x33fd8c;return db[_0x5684('0x2d')][_0x5684('0x55')]({'where':{'id':_0x461a08[_0x5684('0x45')]['id']}})['then'](handleEntityNotFound(_0x144d40,null))['then'](function(_0x172066){if(_0x172066){_0x35e4b7=_0x172066;_0x4355f2[_0x5684('0x30')]=_[_0x5684('0x32')](db[_0x5684('0x2d')]['rawAttributes']);_0x4355f2[_0x5684('0x31')]=_[_0x5684('0x32')](_0x461a08[_0x5684('0x31')]);_0x4355f2['filters']=_['intersection'](_0x4355f2[_0x5684('0x30')],_0x4355f2[_0x5684('0x31')]);_0x1cfdd8['attributes']=_[_0x5684('0x34')](_0x4355f2[_0x5684('0x30')],qs[_0x5684('0x36')](_0x461a08[_0x5684('0x31')][_0x5684('0x36')]));_0x1cfdd8[_0x5684('0x35')]=_0x1cfdd8[_0x5684('0x35')][_0x5684('0x37')]?_0x1cfdd8[_0x5684('0x35')]:_0x4355f2[_0x5684('0x30')];_0x1cfdd8[_0x5684('0x3a')]=qs[_0x5684('0x3b')](_0x461a08[_0x5684('0x31')][_0x5684('0x3b')]);_0x1cfdd8[_0x5684('0x3c')]=qs[_0x5684('0x33')](_['pick'](_0x461a08[_0x5684('0x31')],_0x4355f2[_0x5684('0x33')]));if(_0x461a08['query'][_0x5684('0x3e')]){_0x1cfdd8['where']=_[_0x5684('0x3f')](_0x1cfdd8[_0x5684('0x3c')],{'$or':_['map'](_0x1cfdd8[_0x5684('0x35')],function(_0x17bb1e){var _0x5c95e9={};_0x5c95e9[_0x17bb1e]={'$like':'%'+_0x461a08['query'][_0x5684('0x3e')]+'%'};return _0x5c95e9;})});}_0x1cfdd8=_['merge']({},_0x1cfdd8,_0x461a08['options']);return _0x35e4b7[_0x5684('0x56')](_0x1cfdd8);}})[_0x5684('0x25')](function(_0x30e598){if(_0x30e598){_0x33fd8c=_0x30e598[_0x5684('0x37')];if(!_0x461a08[_0x5684('0x31')][_0x5684('0x38')](_0x5684('0x39'))){_0x1cfdd8[_0x5684('0x1c')]=qs[_0x5684('0x1c')](_0x461a08[_0x5684('0x31')][_0x5684('0x1c')]);_0x1cfdd8[_0x5684('0x1a')]=qs[_0x5684('0x1a')](_0x461a08[_0x5684('0x31')][_0x5684('0x1a')]);}return _0x35e4b7['getIntervals'](_0x1cfdd8);}})['then'](function(_0x424da3){if(_0x424da3){return _0x424da3?{'count':_0x33fd8c,'rows':_0x424da3}:null;}})['then'](respondWithResult(_0x144d40,null))[_0x5684('0x49')](handleError(_0x144d40,null));};exports[_0x5684('0x57')]=function(_0x476c43,_0x28d2c1,_0x45b9ec){return db[_0x5684('0x2d')][_0x5684('0x55')]({'where':{'id':_0x476c43[_0x5684('0x45')]['id']}})[_0x5684('0x25')](handleEntityNotFound(_0x28d2c1,null))[_0x5684('0x25')](function(_0xed1ab2){if(_0xed1ab2){return db[_0x5684('0x58')][_0x5684('0x59')](function(_0x351193){return db[_0x5684('0x2d')][_0x5684('0x29')]({'where':{'IntervalId':_0x476c43['params']['id']},'transaction':_0x351193})[_0x5684('0x25')](function(_0x2f1a1a){var _0x76662=_['map'](_0x476c43['body'],function(_0x5a5455){delete _0x5a5455['id'];_0x5a5455[_0x5684('0x54')]=_0x476c43[_0x5684('0x45')]['id'];return _0x5a5455;});return db[_0x5684('0x2d')][_0x5684('0x5a')](_0x76662,{'transaction':_0x351193});});})['then'](function(){return db[_0x5684('0x2d')]['findAll']({'where':{'IntervalId':_0x476c43[_0x5684('0x45')]['id']}});});}})[_0x5684('0x25')](respondWithResult(_0x28d2c1,null))['catch'](handleError(_0x28d2c1,null));}; \ No newline at end of file +var _0x7607=['to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','get','Intervals','UserProfileResource','destroy','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','options','includeAll','findAll','rawAttributes','include','find','catch','create','Interval','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','getIntervals','findOne','order','pick','sequelize','transaction','bulkCreate','eml-format','rimraf','moment','bluebird','mustache','util','path','sox'];(function(_0x1d94d1,_0x347bb8){var _0x23c397=function(_0x489441){while(--_0x489441){_0x1d94d1['push'](_0x1d94d1['shift']());}};_0x23c397(++_0x347bb8);}(_0x7607,0x9e));var _0x7760=function(_0x54073c,_0x464629){_0x54073c=_0x54073c-0x0;var _0xdeb649=_0x7607[_0x54073c];return _0xdeb649;};'use strict';var emlformat=require(_0x7760('0x0'));var rimraf=require(_0x7760('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7760('0x2'));var BPromise=require(_0x7760('0x3'));var Mustache=require(_0x7760('0x4'));var util=require(_0x7760('0x5'));var path=require(_0x7760('0x6'));var sox=require(_0x7760('0x7'));var csv=require(_0x7760('0x8'));var ejs=require(_0x7760('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7760('0xa'));var squel=require('squel');var crypto=require(_0x7760('0xb'));var jsforce=require(_0x7760('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7760('0x8'));var querystring=require(_0x7760('0xd'));var Papa=require(_0x7760('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7760('0xf'));var hardwareService=require(_0x7760('0x10'));var logger=require(_0x7760('0x11'))(_0x7760('0x12'));var utils=require(_0x7760('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7760('0x14'));var db=require(_0x7760('0x15'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x512469,_0x47cf01){_0x47cf01=_0x47cf01||0xcc;return function(_0x54ccbf){if(_0x54ccbf){return _0x512469['sendStatus'](_0x47cf01);}return _0x512469[_0x7760('0x16')](_0x47cf01)[_0x7760('0x17')]();};}function respondWithResult(_0x57143d,_0x4f91f5){_0x4f91f5=_0x4f91f5||0xc8;return function(_0x28d931){if(_0x28d931){return _0x57143d[_0x7760('0x16')](_0x4f91f5)[_0x7760('0x18')](_0x28d931);}};}function respondWithFilteredResult(_0x4c886a,_0x35ba73){return function(_0x4174f0){if(_0x4174f0){var _0x404234=typeof _0x35ba73[_0x7760('0x19')]===_0x7760('0x1a')&&typeof _0x35ba73[_0x7760('0x1b')]===_0x7760('0x1a');var _0x54a5ce=_0x4174f0['count'];var _0x1671f1=_0x404234?0x0:_0x35ba73[_0x7760('0x19')];var _0x15cd60=_0x404234?_0x4174f0[_0x7760('0x1c')]:_0x35ba73['offset']+_0x35ba73[_0x7760('0x1b')];var _0x4562ee;if(_0x15cd60>=_0x54a5ce){_0x15cd60=_0x54a5ce;_0x4562ee=0xc8;}else{_0x4562ee=0xce;}_0x4c886a[_0x7760('0x16')](_0x4562ee);return _0x4c886a[_0x7760('0x1d')](_0x7760('0x1e'),_0x1671f1+'-'+_0x15cd60+'/'+_0x54a5ce)[_0x7760('0x18')](_0x4174f0);}return null;};}function patchUpdates(_0x3c326d){return function(_0x26a47){try{jsonpatch[_0x7760('0x1f')](_0x26a47,_0x3c326d,!![]);}catch(_0x548bd6){return BPromise['reject'](_0x548bd6);}return _0x26a47['save']();};}function saveUpdates(_0x26b4e5,_0x21d816){return function(_0x14dcf6){if(_0x14dcf6){return _0x14dcf6[_0x7760('0x20')](_0x26b4e5)[_0x7760('0x21')](function(_0x4fad3d){return _0x4fad3d;});}return null;};}function removeEntity(_0x1dd6b0,_0x48b6f3){return function(_0x37d169){if(_0x37d169){return _0x37d169['destroy']()[_0x7760('0x21')](function(){var _0x470f6b=_0x37d169[_0x7760('0x22')]({'plain':!![]});var _0x1fc1e6=_0x7760('0x23');return db[_0x7760('0x24')][_0x7760('0x25')]({'where':{'type':_0x1fc1e6,'resourceId':_0x470f6b['id']}})['then'](function(){return _0x37d169;});})[_0x7760('0x21')](function(){_0x1dd6b0[_0x7760('0x16')](0xcc)[_0x7760('0x17')]();});}};}function handleEntityNotFound(_0xf505d7,_0x5dce81){return function(_0x3416c5){if(!_0x3416c5){_0xf505d7['sendStatus'](0x194);}return _0x3416c5;};}function handleError(_0x4122aa,_0x278531){_0x278531=_0x278531||0x1f4;return function(_0x25c7b7){logger[_0x7760('0x26')](_0x25c7b7[_0x7760('0x27')]);if(_0x25c7b7[_0x7760('0x28')]){delete _0x25c7b7[_0x7760('0x28')];}_0x4122aa[_0x7760('0x16')](_0x278531)[_0x7760('0x29')](_0x25c7b7);};}exports[_0x7760('0x2a')]=function(_0x4d9c28,_0x4aec82){var _0x197b36={},_0x1848b4={},_0xf4f5e4={'count':0x0,'rows':[]};var _0x5d509b=_[_0x7760('0x2b')](db['Interval']['rawAttributes'],function(_0x9786d5){return{'name':_0x9786d5['fieldName'],'type':_0x9786d5[_0x7760('0x2c')][_0x7760('0x2d')]};});_0x1848b4[_0x7760('0x2e')]=_[_0x7760('0x2b')](_0x5d509b,_0x7760('0x28'));_0x1848b4[_0x7760('0x2f')]=_[_0x7760('0x30')](_0x4d9c28['query']);_0x1848b4[_0x7760('0x31')]=_[_0x7760('0x32')](_0x1848b4[_0x7760('0x2e')],_0x1848b4['query']);_0x197b36[_0x7760('0x33')]=_[_0x7760('0x32')](_0x1848b4[_0x7760('0x2e')],qs[_0x7760('0x34')](_0x4d9c28[_0x7760('0x2f')][_0x7760('0x34')]));_0x197b36[_0x7760('0x33')]=_0x197b36[_0x7760('0x33')][_0x7760('0x35')]?_0x197b36['attributes']:_0x1848b4['model'];if(!_0x4d9c28['query'][_0x7760('0x36')]('nolimit')){_0x197b36[_0x7760('0x1b')]=qs[_0x7760('0x1b')](_0x4d9c28[_0x7760('0x2f')][_0x7760('0x1b')]);_0x197b36[_0x7760('0x19')]=qs[_0x7760('0x19')](_0x4d9c28['query']['offset']);}_0x197b36['order']=qs[_0x7760('0x37')](_0x4d9c28[_0x7760('0x2f')]['sort']);_0x197b36[_0x7760('0x38')]=qs[_0x7760('0x31')](_['pick'](_0x4d9c28[_0x7760('0x2f')],_0x1848b4[_0x7760('0x31')]),_0x5d509b);if(_0x4d9c28[_0x7760('0x2f')][_0x7760('0x39')]){_0x197b36['where']=_[_0x7760('0x3a')](_0x197b36[_0x7760('0x38')],{'$or':_['map'](_0x5d509b,function(_0x253919){if(_0x253919['type']!=='VIRTUAL'){var _0x46f31f={};_0x46f31f[_0x253919[_0x7760('0x28')]]={'$like':'%'+_0x4d9c28['query']['filter']+'%'};return _0x46f31f;}})});}_0x197b36=_[_0x7760('0x3a')]({},_0x197b36,_0x4d9c28[_0x7760('0x3b')]);var _0x25cfed={'where':_0x197b36[_0x7760('0x38')]};return db['Interval'][_0x7760('0x1c')](_0x25cfed)['then'](function(_0x1eb053){_0xf4f5e4[_0x7760('0x1c')]=_0x1eb053;if(_0x4d9c28['query'][_0x7760('0x3c')]){_0x197b36['include']=[{'all':!![]}];}return db['Interval'][_0x7760('0x3d')](_0x197b36);})[_0x7760('0x21')](function(_0x563177){_0xf4f5e4['rows']=_0x563177;return _0xf4f5e4;})[_0x7760('0x21')](respondWithFilteredResult(_0x4aec82,_0x197b36))['catch'](handleError(_0x4aec82,null));};exports['show']=function(_0x4ff903,_0x5b6260){var _0x4444d2={'raw':!![],'where':{'id':_0x4ff903['params']['id']}},_0x534746={};_0x534746['model']=_['keys'](db['Interval'][_0x7760('0x3e')]);_0x534746['query']=_[_0x7760('0x30')](_0x4ff903[_0x7760('0x2f')]);_0x534746[_0x7760('0x31')]=_[_0x7760('0x32')](_0x534746[_0x7760('0x2e')],_0x534746[_0x7760('0x2f')]);_0x4444d2[_0x7760('0x33')]=_[_0x7760('0x32')](_0x534746[_0x7760('0x2e')],qs[_0x7760('0x34')](_0x4ff903[_0x7760('0x2f')]['fields']));_0x4444d2[_0x7760('0x33')]=_0x4444d2[_0x7760('0x33')][_0x7760('0x35')]?_0x4444d2[_0x7760('0x33')]:_0x534746['model'];if(_0x4ff903['query']['includeAll']){_0x4444d2[_0x7760('0x3f')]=[{'all':!![]}];}_0x4444d2=_[_0x7760('0x3a')]({},_0x4444d2,_0x4ff903[_0x7760('0x3b')]);return db['Interval'][_0x7760('0x40')](_0x4444d2)[_0x7760('0x21')](handleEntityNotFound(_0x5b6260,null))[_0x7760('0x21')](respondWithResult(_0x5b6260,null))[_0x7760('0x41')](handleError(_0x5b6260,null));};exports[_0x7760('0x42')]=function(_0x23d832,_0x29e7b1){return db[_0x7760('0x43')][_0x7760('0x42')](_0x23d832[_0x7760('0x44')],{})[_0x7760('0x21')](function(_0x4dfb65){var _0x5dd928=_0x23d832[_0x7760('0x45')][_0x7760('0x22')]({'plain':!![]});if(!_0x5dd928)throw new Error(_0x7760('0x46'));if(_0x5dd928[_0x7760('0x47')]===_0x7760('0x45')){var _0x63bfb1=_0x4dfb65[_0x7760('0x22')]({'plain':!![]});var _0x5f26f2=_0x7760('0x23');return db[_0x7760('0x48')][_0x7760('0x40')]({'where':{'name':_0x5f26f2,'userProfileId':_0x5dd928['userProfileId']},'raw':!![]})['then'](function(_0x588cc2){if(_0x588cc2&&_0x588cc2['autoAssociation']===0x0){return db[_0x7760('0x24')][_0x7760('0x42')]({'name':_0x63bfb1[_0x7760('0x28')],'resourceId':_0x63bfb1['id'],'type':_0x588cc2[_0x7760('0x28')],'sectionId':_0x588cc2['id']},{})[_0x7760('0x21')](function(){return _0x4dfb65;});}else{return _0x4dfb65;}})[_0x7760('0x41')](function(_0x767c72){logger[_0x7760('0x26')](_0x7760('0x49'),_0x767c72);throw _0x767c72;});}return _0x4dfb65;})['then'](respondWithResult(_0x29e7b1,0xc9))[_0x7760('0x41')](handleError(_0x29e7b1,null));};exports[_0x7760('0x20')]=function(_0x42e1c1,_0x1a45e7){if(_0x42e1c1['body']['id']){delete _0x42e1c1[_0x7760('0x44')]['id'];}return db[_0x7760('0x43')][_0x7760('0x40')]({'where':{'id':_0x42e1c1[_0x7760('0x4a')]['id']}})[_0x7760('0x21')](handleEntityNotFound(_0x1a45e7,null))[_0x7760('0x21')](saveUpdates(_0x42e1c1['body'],null))[_0x7760('0x21')](respondWithResult(_0x1a45e7,null))[_0x7760('0x41')](handleError(_0x1a45e7,null));};exports[_0x7760('0x25')]=function(_0x36505f,_0x3dce25){return db[_0x7760('0x43')]['find']({'where':{'id':_0x36505f[_0x7760('0x4a')]['id']}})[_0x7760('0x21')](handleEntityNotFound(_0x3dce25,null))['then'](removeEntity(_0x3dce25,null))[_0x7760('0x41')](handleError(_0x3dce25,null));};exports[_0x7760('0x4b')]=function(_0x2a7534,_0x14fa74,_0x1eb8b9){if(_0x2a7534['body']['id']){delete _0x2a7534['body']['id'];}return db['Interval']['find']({'where':{'id':_0x2a7534[_0x7760('0x4a')]['id']}})[_0x7760('0x21')](handleEntityNotFound(_0x14fa74,null))[_0x7760('0x21')](function(_0x2940ff){if(_0x2940ff){_0x2a7534[_0x7760('0x44')]['IntervalId']=_0x2940ff['id'];return db[_0x7760('0x43')][_0x7760('0x42')](_0x2a7534['body']);}})[_0x7760('0x21')](respondWithResult(_0x14fa74,null))[_0x7760('0x41')](handleError(_0x14fa74,null));};exports[_0x7760('0x4c')]=function(_0x527dc4,_0x33937b,_0x2b6f9f){var _0x8a004c={};var _0x4b949a={};var _0x296bd1;var _0x2000a7;return db[_0x7760('0x43')][_0x7760('0x4d')]({'where':{'id':_0x527dc4[_0x7760('0x4a')]['id']}})[_0x7760('0x21')](handleEntityNotFound(_0x33937b,null))[_0x7760('0x21')](function(_0x2a3cd1){if(_0x2a3cd1){_0x296bd1=_0x2a3cd1;_0x4b949a[_0x7760('0x2e')]=_['keys'](db[_0x7760('0x43')][_0x7760('0x3e')]);_0x4b949a[_0x7760('0x2f')]=_[_0x7760('0x30')](_0x527dc4['query']);_0x4b949a[_0x7760('0x31')]=_['intersection'](_0x4b949a[_0x7760('0x2e')],_0x4b949a[_0x7760('0x2f')]);_0x8a004c[_0x7760('0x33')]=_[_0x7760('0x32')](_0x4b949a['model'],qs['fields'](_0x527dc4[_0x7760('0x2f')][_0x7760('0x34')]));_0x8a004c[_0x7760('0x33')]=_0x8a004c[_0x7760('0x33')][_0x7760('0x35')]?_0x8a004c['attributes']:_0x4b949a['model'];_0x8a004c[_0x7760('0x4e')]=qs[_0x7760('0x37')](_0x527dc4[_0x7760('0x2f')][_0x7760('0x37')]);_0x8a004c[_0x7760('0x38')]=qs[_0x7760('0x31')](_[_0x7760('0x4f')](_0x527dc4[_0x7760('0x2f')],_0x4b949a[_0x7760('0x31')]));if(_0x527dc4['query'][_0x7760('0x39')]){_0x8a004c[_0x7760('0x38')]=_['merge'](_0x8a004c['where'],{'$or':_[_0x7760('0x2b')](_0x8a004c['attributes'],function(_0xa84601){var _0xbe4b3={};_0xbe4b3[_0xa84601]={'$like':'%'+_0x527dc4['query'][_0x7760('0x39')]+'%'};return _0xbe4b3;})});}_0x8a004c=_['merge']({},_0x8a004c,_0x527dc4[_0x7760('0x3b')]);return _0x296bd1[_0x7760('0x4c')](_0x8a004c);}})[_0x7760('0x21')](function(_0x13269f){if(_0x13269f){_0x2000a7=_0x13269f[_0x7760('0x35')];if(!_0x527dc4[_0x7760('0x2f')][_0x7760('0x36')]('nolimit')){_0x8a004c['limit']=qs[_0x7760('0x1b')](_0x527dc4[_0x7760('0x2f')][_0x7760('0x1b')]);_0x8a004c['offset']=qs[_0x7760('0x19')](_0x527dc4[_0x7760('0x2f')][_0x7760('0x19')]);}return _0x296bd1[_0x7760('0x4c')](_0x8a004c);}})[_0x7760('0x21')](function(_0x48d6f1){if(_0x48d6f1){return _0x48d6f1?{'count':_0x2000a7,'rows':_0x48d6f1}:null;}})[_0x7760('0x21')](respondWithResult(_0x33937b,null))[_0x7760('0x41')](handleError(_0x33937b,null));};exports['addIntervals']=function(_0x52db3d,_0x405e38,_0x54d985){return db[_0x7760('0x43')]['findOne']({'where':{'id':_0x52db3d[_0x7760('0x4a')]['id']}})[_0x7760('0x21')](handleEntityNotFound(_0x405e38,null))[_0x7760('0x21')](function(_0x5d9f05){if(_0x5d9f05){return db[_0x7760('0x50')][_0x7760('0x51')](function(_0x59a541){return db[_0x7760('0x43')][_0x7760('0x25')]({'where':{'IntervalId':_0x52db3d[_0x7760('0x4a')]['id']},'transaction':_0x59a541})[_0x7760('0x21')](function(_0x576cc3){var _0x4cd639=_[_0x7760('0x2b')](_0x52db3d[_0x7760('0x44')],function(_0x705c51){delete _0x705c51['id'];_0x705c51['IntervalId']=_0x52db3d['params']['id'];return _0x705c51;});return db['Interval'][_0x7760('0x52')](_0x4cd639,{'transaction':_0x59a541});});})['then'](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x52db3d[_0x7760('0x4a')]['id']}});});}})[_0x7760('0x21')](respondWithResult(_0x405e38,null))[_0x7760('0x41')](handleError(_0x405e38,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index a4cafdb..fc4411d 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 _0xd283=['bluebird','request-promise','path','rimraf','./interval.attributes','../../components/extensions/rewrite','exports','Interval','rewrite','lodash','util','../../config/logger','api','moment'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0xd283,0xf7));var _0x3d28=function(_0x1175f8,_0x533733){_0x1175f8=_0x1175f8-0x0;var _0x34e2ba=_0xd283[_0x1175f8];return _0x34e2ba;};'use strict';var _=require(_0x3d28('0x0'));var util=require(_0x3d28('0x1'));var logger=require(_0x3d28('0x2'))(_0x3d28('0x3'));var moment=require(_0x3d28('0x4'));var BPromise=require(_0x3d28('0x5'));var rp=require(_0x3d28('0x6'));var fs=require('fs');var path=require(_0x3d28('0x7'));var rimraf=require(_0x3d28('0x8'));var config=require('../../config/environment');var attributes=require(_0x3d28('0x9'));var extensions=require(_0x3d28('0xa'));module[_0x3d28('0xb')]=function(_0x45ac90,_0x431a91){return _0x45ac90['define'](_0x3d28('0xc'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x7a95d3,_0x3e2e46){extensions[_0x3d28('0xd')](_0x45ac90,_0x7a95d3);},'afterBulkCreate':function(_0x301d60,_0x3cb883,_0x502bbd){_0x502bbd();extensions['rewrite'](_0x45ac90,_0x301d60[0x0]);},'afterUpdate':function(_0x483503,_0x34f229){extensions[_0x3d28('0xd')](_0x45ac90,_0x483503);},'afterDestroy':function(_0x54314a,_0x3107e7){extensions[_0x3d28('0xd')](_0x45ac90,_0x54314a);}}});}; \ No newline at end of file +var _0x0427=['rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','rewrite','lodash','util','api','moment','bluebird','request-promise'];(function(_0x33bcdb,_0x11846b){var _0x18a9bf=function(_0x34417a){while(--_0x34417a){_0x33bcdb['push'](_0x33bcdb['shift']());}};_0x18a9bf(++_0x11846b);}(_0x0427,0x173));var _0x7042=function(_0x386ee5,_0x2b38ac){_0x386ee5=_0x386ee5-0x0;var _0x34db92=_0x0427[_0x386ee5];return _0x34db92;};'use strict';var _=require(_0x7042('0x0'));var util=require(_0x7042('0x1'));var logger=require('../../config/logger')(_0x7042('0x2'));var moment=require(_0x7042('0x3'));var BPromise=require(_0x7042('0x4'));var rp=require(_0x7042('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7042('0x6'));var config=require(_0x7042('0x7'));var attributes=require(_0x7042('0x8'));var extensions=require(_0x7042('0x9'));module[_0x7042('0xa')]=function(_0xa68e28,_0x2e4aa7){return _0xa68e28[_0x7042('0xb')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x10a62a,_0x444113){extensions[_0x7042('0xc')](_0xa68e28,_0x10a62a);},'afterBulkCreate':function(_0x136db3,_0x3f3452,_0x4f679a){_0x4f679a();extensions['rewrite'](_0xa68e28,_0x136db3[0x0]);},'afterUpdate':function(_0x1f3be9,_0x46f099){extensions[_0x7042('0xc')](_0xa68e28,_0x1f3be9);},'afterDestroy':function(_0x3a66a1,_0x33a0e4){extensions[_0x7042('0xc')](_0xa68e28,_0x3a66a1);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index ef21298..2191d50 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x1196bd,_0xba4aea){var _0x26014f=function(_0x542a3d){while(--_0x542a3d){_0x1196bd['push'](_0x1196bd['shift']());}};_0x26014f(++_0xba4aea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x2df724,_0x411382){var _0x1b2504=function(_0x1d3cd1){while(--_0x1d3cd1){_0x2df724['push'](_0x2df724['shift']());}};_0x1b2504(++_0x411382);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index b016af1..96681e0 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 _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x2fa0c8,_0x5ecf96){var _0x10d498=function(_0x3fb147){while(--_0x3fb147){_0x2fa0c8['push'](_0x2fa0c8['shift']());}};_0x10d498(++_0x5ecf96);}(_0x2032,0xd9));var _0x2203=function(_0xb2f83e,_0x4cc86d){_0xb2f83e=_0xb2f83e-0x0;var _0x1ba012=_0x2032[_0xb2f83e];return _0x1ba012;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x29931f,_0x1cef65){var _0x1e38ba=function(_0x101185){while(--_0x101185){_0x29931f['push'](_0x29931f['shift']());}};_0x1e38ba(++_0x1cef65);}(_0x2ef3,0xba));var _0x32ef=function(_0x24e049,_0x471dee){_0x24e049=_0x24e049-0x0;var _0x1e0a9e=_0x2ef3[_0x24e049];return _0x1e0a9e;};'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 f34e516..71b8ce1 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 _0x1448=['https','api','3eAmWpBVP0','MOTGUI','Report','description','stringify','issuetype','Bug','fields','customfield_11500','customfield_11501','customfield_11502','customfield_11503','name','reason','customfield_10102','/rest/api/2/issue','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','body','headers','connection','remoteAddress','socket','bluebird'];(function(_0x32b935,_0x117f2a){var _0x184737=function(_0x5e2f53){while(--_0x5e2f53){_0x32b935['push'](_0x32b935['shift']());}};_0x184737(++_0x117f2a);}(_0x1448,0x18f));var _0x8144=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1448[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x8144('0x0'));var https=require(_0x8144('0x1'));var logger=require('../../config/logger')(_0x8144('0x2'));var USERNAME='support';var PASSWORD=_0x8144('0x3');function openIssue(_0x395895,_0x423a26){var _0x2f1b01={'fields':{'project':{'key':_0x395895['key']||_0x8144('0x4')},'summary':(_0x395895['summary']||_0x8144('0x5'))+'\x20from\x20'+_0x395895['ip'],'description':_0x395895[_0x8144('0x6')]||JSON[_0x8144('0x7')](_0x395895),'issuetype':{'name':_0x395895[_0x8144('0x8')]||_0x8144('0x9')}}};_0x2f1b01[_0x8144('0xa')][_0x8144('0xb')]=_0x395895['email'];_0x2f1b01[_0x8144('0xa')][_0x8144('0xc')]=_0x395895['oldToken'];_0x2f1b01[_0x8144('0xa')][_0x8144('0xd')]=_0x395895['newToken'];_0x2f1b01[_0x8144('0xa')][_0x8144('0xe')]=_0x395895[_0x8144('0xf')];_0x2f1b01[_0x8144('0xa')]['customfield_11504']=_0x395895[_0x8144('0x10')];_0x2f1b01[_0x8144('0xa')][_0x8144('0x11')]=_0x395895['ip'];var _0x325edd={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x8144('0x12'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x8144('0x13')](_0x8144('0x14'))}};var _0x23ee93=JSON[_0x8144('0x7')](_0x2f1b01);var _0x4162a6=https[_0x8144('0x15')](_0x325edd,function(_0x3252ee){_0x3252ee[_0x8144('0x16')](_0x8144('0x17'));var _0x94d46a='';_0x3252ee['on'](_0x8144('0x18'),function(_0x537e5c){_0x94d46a+=_0x537e5c;});_0x3252ee['on'](_0x8144('0x19'),function(){if(_0x423a26){return _0x423a26[_0x8144('0x1a')](_0x3252ee[_0x8144('0x1b')])[_0x8144('0x1c')](JSON[_0x8144('0x1d')](_0x94d46a));}});});_0x4162a6['on'](_0x8144('0x1e'),function(_0x46884f){if(_0x423a26){return _0x423a26['status'](0x1f4)[_0x8144('0x1c')]({'errors':[{'message':_0x8144('0x1f'),'type':_0x8144('0x20')}]});}});_0x4162a6[_0x8144('0x21')](_0x23ee93);_0x4162a6[_0x8144('0x19')]();}exports['openIssue']=openIssue;exports[_0x8144('0x22')]=function(_0xb79eaa,_0x2c5c08){_0xb79eaa[_0x8144('0x23')]['ip']=_0xb79eaa[_0x8144('0x24')]['x-forwarded-for']||_0xb79eaa[_0x8144('0x25')]['remoteAddress']||_0xb79eaa['socket'][_0x8144('0x26')]||_0xb79eaa[_0x8144('0x25')][_0x8144('0x27')][_0x8144('0x26')];return openIssue(_0xb79eaa[_0x8144('0x23')],_0x2c5c08);}; \ No newline at end of file +var _0x53f5=['setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','Bug','fields','customfield_11500','email','oldToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','application/json','toString','base64','stringify','request'];(function(_0xc6fa31,_0x44303e){var _0x44f10d=function(_0x452f70){while(--_0x452f70){_0xc6fa31['push'](_0xc6fa31['shift']());}};_0x44f10d(++_0x44303e);}(_0x53f5,0x1c2));var _0x553f=function(_0x53c39f,_0x38efaf){_0x53c39f=_0x53c39f-0x0;var _0x42a98c=_0x53f5[_0x53c39f];return _0x42a98c;};'use strict';var BPromise=require(_0x553f('0x0'));var https=require(_0x553f('0x1'));var logger=require('../../config/logger')('api');var USERNAME='support';var PASSWORD=_0x553f('0x2');function openIssue(_0x32bba5,_0xb9880f){var _0x476f04={'fields':{'project':{'key':_0x32bba5[_0x553f('0x3')]||_0x553f('0x4')},'summary':(_0x32bba5[_0x553f('0x5')]||'Report')+_0x553f('0x6')+_0x32bba5['ip'],'description':_0x32bba5['description']||JSON['stringify'](_0x32bba5),'issuetype':{'name':_0x32bba5['issuetype']||_0x553f('0x7')}}};_0x476f04[_0x553f('0x8')][_0x553f('0x9')]=_0x32bba5[_0x553f('0xa')];_0x476f04[_0x553f('0x8')]['customfield_11501']=_0x32bba5[_0x553f('0xb')];_0x476f04[_0x553f('0x8')]['customfield_11502']=_0x32bba5['newToken'];_0x476f04[_0x553f('0x8')][_0x553f('0xc')]=_0x32bba5[_0x553f('0xd')];_0x476f04[_0x553f('0x8')][_0x553f('0xe')]=_0x32bba5[_0x553f('0xf')];_0x476f04[_0x553f('0x8')][_0x553f('0x10')]=_0x32bba5['ip'];var _0x18cbce={'host':_0x553f('0x11'),'port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x553f('0x12'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x553f('0x13')](_0x553f('0x14'))}};var _0x28ee66=JSON[_0x553f('0x15')](_0x476f04);var _0x389a6b=https[_0x553f('0x16')](_0x18cbce,function(_0x14a566){_0x14a566[_0x553f('0x17')](_0x553f('0x18'));var _0x3f530d='';_0x14a566['on'](_0x553f('0x19'),function(_0x4a8b80){_0x3f530d+=_0x4a8b80;});_0x14a566['on'](_0x553f('0x1a'),function(){if(_0xb9880f){return _0xb9880f[_0x553f('0x1b')](_0x14a566[_0x553f('0x1c')])[_0x553f('0x1d')](JSON[_0x553f('0x1e')](_0x3f530d));}});});_0x389a6b['on'](_0x553f('0x1f'),function(_0x553de9){if(_0xb9880f){return _0xb9880f[_0x553f('0x1b')](0x1f4)['json']({'errors':[{'message':_0x553f('0x20'),'type':_0x553f('0x21')}]});}});_0x389a6b[_0x553f('0x22')](_0x28ee66);_0x389a6b[_0x553f('0x1a')]();}exports[_0x553f('0x23')]=openIssue;exports[_0x553f('0x24')]=function(_0x1d0d4d,_0x41d235){_0x1d0d4d[_0x553f('0x25')]['ip']=_0x1d0d4d[_0x553f('0x26')][_0x553f('0x27')]||_0x1d0d4d[_0x553f('0x28')]['remoteAddress']||_0x1d0d4d[_0x553f('0x29')][_0x553f('0x2a')]||_0x1d0d4d['connection']['socket'][_0x553f('0x2a')];return openIssue(_0x1d0d4d[_0x553f('0x25')],_0x41d235);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index d9f30db..fd3699e 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','show','post'];(function(_0x5ef55a,_0x2a03b1){var _0x20ae40=function(_0x46ce81){while(--_0x46ce81){_0x5ef55a['push'](_0x5ef55a['shift']());}};_0x20ae40(++_0x2a03b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 _0x91a7=['Router','../../components/auth/service','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout'];(function(_0x3c5f49,_0x2ca859){var _0xb0b1c6=function(_0x3dea19){while(--_0x3dea19){_0x3c5f49['push'](_0x3c5f49['shift']());}};_0xb0b1c6(++_0x2ca859);}(_0x91a7,0xe7));var _0x791a=function(_0x503215,_0x8e7a30){_0x503215=_0x503215-0x0;var _0x110c37=_0x91a7[_0x503215];return _0x110c37;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['describe']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0xc')]('/',auth['isAuthenticated'](),controller[_0x791a('0xd')]);router[_0x791a('0xe')]('/:id',auth[_0x791a('0x9')](),controller[_0x791a('0xf')]);router[_0x791a('0x10')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 77c5052..ab84668 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(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x7a54,0x106));var _0x47a5=function(_0x2b7633,_0x5cf140){_0x2b7633=_0x2b7633-0x0;var _0x42951c=_0x7a54[_0x2b7633];return _0x42951c;};'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(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x7a54,0x106));var _0x47a5=function(_0x4a50b5,_0x2f5679){_0x4a50b5=_0x4a50b5-0x0;var _0x436686=_0x7a54[_0x4a50b5];return _0x436686;};'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 b03996d..900ebd9 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 _0x943c=['util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','type','key','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','includeAll','include','rows','show','params','fields','options','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x207811,_0x3420a6){var _0x170d56=function(_0x4340b7){while(--_0x4340b7){_0x207811['push'](_0x207811['shift']());}};_0x170d56(++_0x3420a6);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc943('0x0'));var rimraf=require(_0xc943('0x1'));var zipdir=require(_0xc943('0x2'));var jsonpatch=require(_0xc943('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc943('0x4'));var Mustache=require(_0xc943('0x5'));var util=require(_0xc943('0x6'));var path=require('path');var sox=require(_0xc943('0x7'));var csv=require(_0xc943('0x8'));var ejs=require(_0xc943('0x9'));var fs=require('fs');var fs_extra=require(_0xc943('0xa'));var _=require(_0xc943('0xb'));var squel=require(_0xc943('0xc'));var crypto=require(_0xc943('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc943('0xe'));var toCsv=require(_0xc943('0x8'));var querystring=require(_0xc943('0xf'));var Papa=require(_0xc943('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc943('0x11'));var as=require(_0xc943('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc943('0x13'));var utils=require(_0xc943('0x14'));var config=require(_0xc943('0x15'));var licenseUtil=require(_0xc943('0x16'));var db=require(_0xc943('0x17'))['db'];function respondWithStatusCode(_0x21c3e7,_0x5ee50d){_0x5ee50d=_0x5ee50d||0xcc;return function(_0xf11802){if(_0xf11802){return _0x21c3e7[_0xc943('0x18')](_0x5ee50d);}return _0x21c3e7['status'](_0x5ee50d)['end']();};}function respondWithResult(_0x4e9f88,_0x334fe2){_0x334fe2=_0x334fe2||0xc8;return function(_0xbdc5c4){if(_0xbdc5c4){return _0x4e9f88['status'](_0x334fe2)[_0xc943('0x19')](_0xbdc5c4);}};}function respondWithFilteredResult(_0x537a11,_0x559fb0){return function(_0x2fa39b){if(_0x2fa39b){var _0x5541d8=typeof _0x559fb0[_0xc943('0x1a')]===_0xc943('0x1b')&&typeof _0x559fb0[_0xc943('0x1c')]===_0xc943('0x1b');var _0x4b6a28=_0x2fa39b[_0xc943('0x1d')];var _0x3b3661=_0x5541d8?0x0:_0x559fb0[_0xc943('0x1a')];var _0x4fd8f5=_0x5541d8?_0x2fa39b[_0xc943('0x1d')]:_0x559fb0[_0xc943('0x1a')]+_0x559fb0[_0xc943('0x1c')];var _0x200cba;if(_0x4fd8f5>=_0x4b6a28){_0x4fd8f5=_0x4b6a28;_0x200cba=0xc8;}else{_0x200cba=0xce;}_0x537a11[_0xc943('0x1e')](_0x200cba);return _0x537a11[_0xc943('0x1f')](_0xc943('0x20'),_0x3b3661+'-'+_0x4fd8f5+'/'+_0x4b6a28)[_0xc943('0x19')](_0x2fa39b);}return null;};}function patchUpdates(_0x2dbb35){return function(_0x1765c5){try{jsonpatch[_0xc943('0x21')](_0x1765c5,_0x2dbb35,!![]);}catch(_0x6ca3c6){return BPromise[_0xc943('0x22')](_0x6ca3c6);}return _0x1765c5[_0xc943('0x23')]();};}function saveUpdates(_0x47082e,_0x19f93e){return function(_0x43712d){if(_0x43712d){return _0x43712d[_0xc943('0x24')](_0x47082e)[_0xc943('0x25')](function(_0x59055e){return _0x59055e;});}return null;};}function removeEntity(_0x454c48,_0x469b9e){return function(_0x2a0731){if(_0x2a0731){return _0x2a0731[_0xc943('0x26')]()[_0xc943('0x25')](function(){_0x454c48[_0xc943('0x1e')](0xcc)[_0xc943('0x27')]();});}};}function handleEntityNotFound(_0x319a7a,_0x3dbaef){return function(_0x41b83e){if(!_0x41b83e){_0x319a7a[_0xc943('0x18')](0x194);}return _0x41b83e;};}function handleError(_0x462bfc,_0x1d2bf4){_0x1d2bf4=_0x1d2bf4||0x1f4;return function(_0x1a87fd){logger['error'](_0x1a87fd[_0xc943('0x28')]);if(_0x1a87fd[_0xc943('0x29')]){delete _0x1a87fd[_0xc943('0x29')];}_0x462bfc[_0xc943('0x1e')](_0x1d2bf4)[_0xc943('0x2a')](_0x1a87fd);};}exports[_0xc943('0x2b')]=function(_0x4e77b3,_0x282cca){var _0x4ac0ad={},_0x7ada76={},_0x288700={'count':0x0,'rows':[]};var _0x280434=_[_0xc943('0x2c')](db[_0xc943('0x2d')][_0xc943('0x2e')],function(_0x4a7bce){return{'name':_0x4a7bce['fieldName'],'type':_0x4a7bce[_0xc943('0x2f')][_0xc943('0x30')]};});_0x7ada76[_0xc943('0x31')]=_[_0xc943('0x2c')](_0x280434,'name');_0x7ada76['query']=_[_0xc943('0x32')](_0x4e77b3[_0xc943('0x33')]);_0x7ada76['filters']=_[_0xc943('0x34')](_0x7ada76['model'],_0x7ada76[_0xc943('0x33')]);_0x4ac0ad[_0xc943('0x35')]=_[_0xc943('0x34')](_0x7ada76[_0xc943('0x31')],qs['fields'](_0x4e77b3[_0xc943('0x33')]['fields']));_0x4ac0ad[_0xc943('0x35')]=_0x4ac0ad[_0xc943('0x35')][_0xc943('0x36')]?_0x4ac0ad['attributes']:_0x7ada76[_0xc943('0x31')];if(!_0x4e77b3[_0xc943('0x33')][_0xc943('0x37')](_0xc943('0x38'))){_0x4ac0ad[_0xc943('0x1c')]=qs[_0xc943('0x1c')](_0x4e77b3['query']['limit']);_0x4ac0ad['offset']=qs[_0xc943('0x1a')](_0x4e77b3[_0xc943('0x33')][_0xc943('0x1a')]);}_0x4ac0ad[_0xc943('0x39')]=qs[_0xc943('0x3a')](_0x4e77b3[_0xc943('0x33')][_0xc943('0x3a')]);_0x4ac0ad[_0xc943('0x3b')]=qs[_0xc943('0x3c')](_['pick'](_0x4e77b3['query'],_0x7ada76[_0xc943('0x3c')]),_0x280434);if(_0x4e77b3[_0xc943('0x33')]['filter']){_0x4ac0ad['where']=_[_0xc943('0x3d')](_0x4ac0ad[_0xc943('0x3b')],{'$or':_[_0xc943('0x2c')](_0x280434,function(_0x5e8344){if(_0x5e8344[_0xc943('0x2f')]!=='VIRTUAL'){var _0x79cc0d={};_0x79cc0d[_0x5e8344['name']]={'$like':'%'+_0x4e77b3[_0xc943('0x33')][_0xc943('0x3e')]+'%'};return _0x79cc0d;}})});}_0x4ac0ad=_[_0xc943('0x3d')]({},_0x4ac0ad,_0x4e77b3['options']);var _0x5797d7={'where':_0x4ac0ad[_0xc943('0x3b')]};return db[_0xc943('0x2d')][_0xc943('0x1d')](_0x5797d7)[_0xc943('0x25')](function(_0x5e6f15){_0x288700[_0xc943('0x1d')]=_0x5e6f15;if(_0x4e77b3[_0xc943('0x33')][_0xc943('0x3f')]){_0x4ac0ad[_0xc943('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x4ac0ad);})['then'](function(_0x573fba){_0x288700[_0xc943('0x41')]=_0x573fba;return _0x288700;})[_0xc943('0x25')](respondWithFilteredResult(_0x282cca,_0x4ac0ad))['catch'](handleError(_0x282cca,null));};exports[_0xc943('0x42')]=function(_0x476393,_0x40cc60){var _0x3a172c={'raw':!![],'where':{'id':_0x476393[_0xc943('0x43')]['id']}},_0x127e4e={};_0x127e4e[_0xc943('0x31')]=_[_0xc943('0x32')](db['JscriptyAnswerReport'][_0xc943('0x2e')]);_0x127e4e[_0xc943('0x33')]=_[_0xc943('0x32')](_0x476393[_0xc943('0x33')]);_0x127e4e[_0xc943('0x3c')]=_['intersection'](_0x127e4e[_0xc943('0x31')],_0x127e4e['query']);_0x3a172c['attributes']=_['intersection'](_0x127e4e[_0xc943('0x31')],qs[_0xc943('0x44')](_0x476393['query'][_0xc943('0x44')]));_0x3a172c[_0xc943('0x35')]=_0x3a172c[_0xc943('0x35')][_0xc943('0x36')]?_0x3a172c[_0xc943('0x35')]:_0x127e4e[_0xc943('0x31')];if(_0x476393[_0xc943('0x33')][_0xc943('0x3f')]){_0x3a172c[_0xc943('0x40')]=[{'all':!![]}];}_0x3a172c=_[_0xc943('0x3d')]({},_0x3a172c,_0x476393[_0xc943('0x45')]);return db[_0xc943('0x2d')][_0xc943('0x46')](_0x3a172c)['then'](handleEntityNotFound(_0x40cc60,null))[_0xc943('0x25')](respondWithResult(_0x40cc60,null))['catch'](handleError(_0x40cc60,null));};exports['create']=function(_0xc138e0,_0x388fdc){return db[_0xc943('0x2d')]['create'](_0xc138e0['body'],{})[_0xc943('0x25')](respondWithResult(_0x388fdc,0xc9))[_0xc943('0x47')](handleError(_0x388fdc,null));};exports[_0xc943('0x24')]=function(_0x37a29d,_0x26ff18){if(_0x37a29d[_0xc943('0x48')]['id']){delete _0x37a29d[_0xc943('0x48')]['id'];}return db[_0xc943('0x2d')]['find']({'where':{'id':_0x37a29d['params']['id']}})[_0xc943('0x25')](handleEntityNotFound(_0x26ff18,null))[_0xc943('0x25')](saveUpdates(_0x37a29d[_0xc943('0x48')],null))['then'](respondWithResult(_0x26ff18,null))[_0xc943('0x47')](handleError(_0x26ff18,null));};exports[_0xc943('0x26')]=function(_0x1a0934,_0x3f264b){return db[_0xc943('0x2d')]['find']({'where':{'id':_0x1a0934[_0xc943('0x43')]['id']}})['then'](handleEntityNotFound(_0x3f264b,null))[_0xc943('0x25')](removeEntity(_0x3f264b,null))[_0xc943('0x47')](handleError(_0x3f264b,null));};exports[_0xc943('0x49')]=function(_0x2e2eac,_0x3eb2da){return db[_0xc943('0x2d')][_0xc943('0x49')]()[_0xc943('0x25')](respondWithResult(_0x3eb2da,null))[_0xc943('0x47')](handleError(_0x3eb2da,null));}; \ No newline at end of file +var _0xb091=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','index','map','JscriptyAnswerReport','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv'];(function(_0x5dd4e2,_0x491f31){var _0x20b5b2=function(_0x194503){while(--_0x194503){_0x5dd4e2['push'](_0x5dd4e2['shift']());}};_0x20b5b2(++_0x491f31);}(_0xb091,0x16e));var _0x1b09=function(_0xceb651,_0x19e6a1){_0xceb651=_0xceb651-0x0;var _0x4aab94=_0xb091[_0xceb651];return _0x4aab94;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b09('0x0'));var zipdir=require(_0x1b09('0x1'));var jsonpatch=require(_0x1b09('0x2'));var rp=require(_0x1b09('0x3'));var moment=require('moment');var BPromise=require(_0x1b09('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1b09('0x5'));var sox=require(_0x1b09('0x6'));var csv=require('to-csv');var ejs=require(_0x1b09('0x7'));var fs=require('fs');var fs_extra=require(_0x1b09('0x8'));var _=require(_0x1b09('0x9'));var squel=require('squel');var crypto=require(_0x1b09('0xa'));var jsforce=require(_0x1b09('0xb'));var deskjs=require(_0x1b09('0xc'));var toCsv=require(_0x1b09('0xd'));var querystring=require(_0x1b09('0xe'));var Papa=require(_0x1b09('0xf'));var Redis=require(_0x1b09('0x10'));var authService=require(_0x1b09('0x11'));var qs=require(_0x1b09('0x12'));var as=require(_0x1b09('0x13'));var hardwareService=require(_0x1b09('0x14'));var logger=require('../../config/logger')(_0x1b09('0x15'));var utils=require(_0x1b09('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1b09('0x17'))['db'];function respondWithStatusCode(_0x4284ad,_0x3ae4a0){_0x3ae4a0=_0x3ae4a0||0xcc;return function(_0x1046f8){if(_0x1046f8){return _0x4284ad[_0x1b09('0x18')](_0x3ae4a0);}return _0x4284ad[_0x1b09('0x19')](_0x3ae4a0)[_0x1b09('0x1a')]();};}function respondWithResult(_0x58392d,_0x37fdb2){_0x37fdb2=_0x37fdb2||0xc8;return function(_0x515ade){if(_0x515ade){return _0x58392d[_0x1b09('0x19')](_0x37fdb2)[_0x1b09('0x1b')](_0x515ade);}};}function respondWithFilteredResult(_0x11ab46,_0x37673e){return function(_0x10b7eb){if(_0x10b7eb){var _0x1dc96b=typeof _0x37673e[_0x1b09('0x1c')]===_0x1b09('0x1d')&&typeof _0x37673e[_0x1b09('0x1e')]===_0x1b09('0x1d');var _0x311158=_0x10b7eb[_0x1b09('0x1f')];var _0x646575=_0x1dc96b?0x0:_0x37673e['offset'];var _0x214c6b=_0x1dc96b?_0x10b7eb[_0x1b09('0x1f')]:_0x37673e['offset']+_0x37673e['limit'];var _0xe93ac4;if(_0x214c6b>=_0x311158){_0x214c6b=_0x311158;_0xe93ac4=0xc8;}else{_0xe93ac4=0xce;}_0x11ab46['status'](_0xe93ac4);return _0x11ab46[_0x1b09('0x20')]('Content-Range',_0x646575+'-'+_0x214c6b+'/'+_0x311158)[_0x1b09('0x1b')](_0x10b7eb);}return null;};}function patchUpdates(_0x4b2eab){return function(_0x2d6dba){try{jsonpatch[_0x1b09('0x21')](_0x2d6dba,_0x4b2eab,!![]);}catch(_0x29dd70){return BPromise[_0x1b09('0x22')](_0x29dd70);}return _0x2d6dba[_0x1b09('0x23')]();};}function saveUpdates(_0x39e569,_0x48b803){return function(_0x5e2806){if(_0x5e2806){return _0x5e2806[_0x1b09('0x24')](_0x39e569)[_0x1b09('0x25')](function(_0x4ce7dc){return _0x4ce7dc;});}return null;};}function removeEntity(_0x3c0496,_0x11d0d5){return function(_0x6e132c){if(_0x6e132c){return _0x6e132c[_0x1b09('0x26')]()['then'](function(){_0x3c0496[_0x1b09('0x19')](0xcc)[_0x1b09('0x1a')]();});}};}function handleEntityNotFound(_0x4936d0,_0x2d3b86){return function(_0x472d30){if(!_0x472d30){_0x4936d0['sendStatus'](0x194);}return _0x472d30;};}function handleError(_0x13c89c,_0x108d80){_0x108d80=_0x108d80||0x1f4;return function(_0xa71272){logger[_0x1b09('0x27')](_0xa71272['stack']);if(_0xa71272[_0x1b09('0x28')]){delete _0xa71272[_0x1b09('0x28')];}_0x13c89c['status'](_0x108d80)[_0x1b09('0x29')](_0xa71272);};}exports[_0x1b09('0x2a')]=function(_0x26befb,_0x1cbbd5){var _0x11098e={},_0x1aa179={},_0x34620f={'count':0x0,'rows':[]};var _0x5a503d=_[_0x1b09('0x2b')](db[_0x1b09('0x2c')]['rawAttributes'],function(_0x34d912){return{'name':_0x34d912[_0x1b09('0x2d')],'type':_0x34d912[_0x1b09('0x2e')][_0x1b09('0x2f')]};});_0x1aa179[_0x1b09('0x30')]=_['map'](_0x5a503d,_0x1b09('0x28'));_0x1aa179['query']=_[_0x1b09('0x31')](_0x26befb['query']);_0x1aa179[_0x1b09('0x32')]=_[_0x1b09('0x33')](_0x1aa179[_0x1b09('0x30')],_0x1aa179[_0x1b09('0x34')]);_0x11098e[_0x1b09('0x35')]=_[_0x1b09('0x33')](_0x1aa179[_0x1b09('0x30')],qs[_0x1b09('0x36')](_0x26befb[_0x1b09('0x34')][_0x1b09('0x36')]));_0x11098e['attributes']=_0x11098e[_0x1b09('0x35')][_0x1b09('0x37')]?_0x11098e[_0x1b09('0x35')]:_0x1aa179['model'];if(!_0x26befb[_0x1b09('0x34')][_0x1b09('0x38')](_0x1b09('0x39'))){_0x11098e[_0x1b09('0x1e')]=qs[_0x1b09('0x1e')](_0x26befb[_0x1b09('0x34')][_0x1b09('0x1e')]);_0x11098e[_0x1b09('0x1c')]=qs['offset'](_0x26befb[_0x1b09('0x34')]['offset']);}_0x11098e[_0x1b09('0x3a')]=qs['sort'](_0x26befb[_0x1b09('0x34')][_0x1b09('0x3b')]);_0x11098e[_0x1b09('0x3c')]=qs[_0x1b09('0x32')](_[_0x1b09('0x3d')](_0x26befb[_0x1b09('0x34')],_0x1aa179[_0x1b09('0x32')]),_0x5a503d);if(_0x26befb[_0x1b09('0x34')][_0x1b09('0x3e')]){_0x11098e[_0x1b09('0x3c')]=_[_0x1b09('0x3f')](_0x11098e[_0x1b09('0x3c')],{'$or':_[_0x1b09('0x2b')](_0x5a503d,function(_0x4bd6fa){if(_0x4bd6fa['type']!==_0x1b09('0x40')){var _0xb2ef05={};_0xb2ef05[_0x4bd6fa[_0x1b09('0x28')]]={'$like':'%'+_0x26befb[_0x1b09('0x34')][_0x1b09('0x3e')]+'%'};return _0xb2ef05;}})});}_0x11098e=_[_0x1b09('0x3f')]({},_0x11098e,_0x26befb[_0x1b09('0x41')]);var _0x33d697={'where':_0x11098e['where']};return db['JscriptyAnswerReport'][_0x1b09('0x1f')](_0x33d697)['then'](function(_0x966873){_0x34620f[_0x1b09('0x1f')]=_0x966873;if(_0x26befb[_0x1b09('0x34')]['includeAll']){_0x11098e[_0x1b09('0x42')]=[{'all':!![]}];}return db[_0x1b09('0x2c')][_0x1b09('0x43')](_0x11098e);})['then'](function(_0x3edcde){_0x34620f[_0x1b09('0x44')]=_0x3edcde;return _0x34620f;})[_0x1b09('0x25')](respondWithFilteredResult(_0x1cbbd5,_0x11098e))[_0x1b09('0x45')](handleError(_0x1cbbd5,null));};exports['show']=function(_0x36f814,_0x2b2341){var _0x4c0559={'raw':!![],'where':{'id':_0x36f814[_0x1b09('0x46')]['id']}},_0x1c7ec6={};_0x1c7ec6['model']=_['keys'](db['JscriptyAnswerReport']['rawAttributes']);_0x1c7ec6[_0x1b09('0x34')]=_[_0x1b09('0x31')](_0x36f814[_0x1b09('0x34')]);_0x1c7ec6['filters']=_[_0x1b09('0x33')](_0x1c7ec6[_0x1b09('0x30')],_0x1c7ec6['query']);_0x4c0559[_0x1b09('0x35')]=_[_0x1b09('0x33')](_0x1c7ec6[_0x1b09('0x30')],qs[_0x1b09('0x36')](_0x36f814[_0x1b09('0x34')][_0x1b09('0x36')]));_0x4c0559[_0x1b09('0x35')]=_0x4c0559[_0x1b09('0x35')][_0x1b09('0x37')]?_0x4c0559[_0x1b09('0x35')]:_0x1c7ec6['model'];if(_0x36f814[_0x1b09('0x34')][_0x1b09('0x47')]){_0x4c0559[_0x1b09('0x42')]=[{'all':!![]}];}_0x4c0559=_['merge']({},_0x4c0559,_0x36f814[_0x1b09('0x41')]);return db['JscriptyAnswerReport'][_0x1b09('0x48')](_0x4c0559)[_0x1b09('0x25')](handleEntityNotFound(_0x2b2341,null))['then'](respondWithResult(_0x2b2341,null))[_0x1b09('0x45')](handleError(_0x2b2341,null));};exports[_0x1b09('0x49')]=function(_0x3732fb,_0x25443a){return db[_0x1b09('0x2c')][_0x1b09('0x49')](_0x3732fb['body'],{})[_0x1b09('0x25')](respondWithResult(_0x25443a,0xc9))['catch'](handleError(_0x25443a,null));};exports[_0x1b09('0x24')]=function(_0x58a158,_0x50a66c){if(_0x58a158[_0x1b09('0x4a')]['id']){delete _0x58a158[_0x1b09('0x4a')]['id'];}return db[_0x1b09('0x2c')][_0x1b09('0x48')]({'where':{'id':_0x58a158[_0x1b09('0x46')]['id']}})[_0x1b09('0x25')](handleEntityNotFound(_0x50a66c,null))[_0x1b09('0x25')](saveUpdates(_0x58a158[_0x1b09('0x4a')],null))['then'](respondWithResult(_0x50a66c,null))[_0x1b09('0x45')](handleError(_0x50a66c,null));};exports[_0x1b09('0x26')]=function(_0x21b4c2,_0x481147){return db['JscriptyAnswerReport'][_0x1b09('0x48')]({'where':{'id':_0x21b4c2['params']['id']}})[_0x1b09('0x25')](handleEntityNotFound(_0x481147,null))[_0x1b09('0x25')](removeEntity(_0x481147,null))['catch'](handleError(_0x481147,null));};exports[_0x1b09('0x4b')]=function(_0x6f4589,_0x5941df){return db[_0x1b09('0x2c')][_0x1b09('0x4b')]()[_0x1b09('0x25')](respondWithResult(_0x5941df,null))[_0x1b09('0x45')](handleError(_0x5941df,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 664f1c6..5f33650 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 _0xa17a=['util','bluebird','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','report_jscripty_answers','lodash'];(function(_0x39ea42,_0x3c1f50){var _0x33f5b7=function(_0x5d8e73){while(--_0x5d8e73){_0x39ea42['push'](_0x39ea42['shift']());}};_0x33f5b7(++_0x3c1f50);}(_0xa17a,0x10d));var _0xaa17=function(_0x95b44e,_0x4af5e1){_0x95b44e=_0x95b44e-0x0;var _0x4d33ea=_0xa17a[_0x95b44e];return _0x4d33ea;};'use strict';var _=require(_0xaa17('0x0'));var util=require(_0xaa17('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xaa17('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa17('0x3'));var rimraf=require(_0xaa17('0x4'));var config=require(_0xaa17('0x5'));var attributes=require(_0xaa17('0x6'));module[_0xaa17('0x7')]=function(_0x3a615c,_0x1b37e3){return _0x3a615c['define']('JscriptyAnswerReport',attributes,{'tableName':_0xaa17('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x547f=['moment','bluebird','path','rimraf','../../config/environment','define','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','api'];(function(_0x3388ed,_0x2732a9){var _0x296e1e=function(_0xf1dc96){while(--_0xf1dc96){_0x3388ed['push'](_0x3388ed['shift']());}};_0x296e1e(++_0x2732a9);}(_0x547f,0x19f));var _0xf547=function(_0x5e6975,_0x21cccd){_0x5e6975=_0x5e6975-0x0;var _0x3986b5=_0x547f[_0x5e6975];return _0x3986b5;};'use strict';var _=require(_0xf547('0x0'));var util=require('util');var logger=require(_0xf547('0x1'))(_0xf547('0x2'));var moment=require(_0xf547('0x3'));var BPromise=require(_0xf547('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf547('0x5'));var rimraf=require(_0xf547('0x6'));var config=require(_0xf547('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x12d426,_0x504023){return _0x12d426[_0xf547('0x8')](_0xf547('0x9'),attributes,{'tableName':_0xf547('0xa'),'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 3b980ea..af8b205 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 _0x78b5=['request\x20sent','stringify','error','code','message','JscriptyAnswerReport,\x20%s,\x20%s','result','lodash','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s'];(function(_0x2f2cb6,_0x5f5576){var _0x33c4a7=function(_0x57b59c){while(--_0x57b59c){_0x2f2cb6['push'](_0x2f2cb6['shift']());}};_0x33c4a7(++_0x5f5576);}(_0x78b5,0x66));var _0x578b=function(_0x476f14,_0x213096){_0x476f14=_0x476f14-0x0;var _0x382e6=_0x78b5[_0x476f14];return _0x382e6;};'use strict';var _=require(_0x578b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x578b('0x1'));var fs=require('fs');var Redis=require(_0x578b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x578b('0x3'));var logger=require('../../config/logger')(_0x578b('0x4'));var config=require(_0x578b('0x5'));var jayson=require(_0x578b('0x6'));var client=jayson[_0x578b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5874da,_0xf8c70e,_0x2d8da1){return new BPromise(function(_0x1f5b2f,_0x373378){return client['request'](_0x5874da,_0x2d8da1)[_0x578b('0x8')](function(_0x883dc7){logger[_0x578b('0x9')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xf8c70e,'request\x20sent');logger[_0x578b('0xa')](_0x578b('0xb'),_0xf8c70e,_0x578b('0xc'),JSON[_0x578b('0xd')](_0x883dc7));if(_0x883dc7[_0x578b('0xe')]){if(_0x883dc7[_0x578b('0xe')][_0x578b('0xf')]===0x1f4){logger[_0x578b('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xf8c70e,_0x883dc7['error'][_0x578b('0x10')]);return _0x373378(_0x883dc7[_0x578b('0xe')][_0x578b('0x10')]);}logger[_0x578b('0xe')](_0x578b('0x11'),_0xf8c70e,_0x883dc7[_0x578b('0xe')]['message']);return _0x1f5b2f(_0x883dc7[_0x578b('0xe')]['message']);}else{logger[_0x578b('0x9')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xf8c70e,_0x578b('0xc'));_0x1f5b2f(_0x883dc7[_0x578b('0x12')][_0x578b('0x10')]);}})['catch'](function(_0x24b26c){logger[_0x578b('0xe')](_0x578b('0x11'),_0xf8c70e,_0x24b26c);_0x373378(_0x24b26c);});});} \ No newline at end of file +var _0x5b53=['debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','JscriptyAnswerReport,\x20%s,\x20%s'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x5b53,0x15d));var _0x35b5=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0x5b53[_0x380307];return _0x9ea14b;};'use strict';var _=require(_0x35b5('0x0'));var util=require(_0x35b5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x35b5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x35b5('0x3'));var logger=require(_0x35b5('0x4'))('rpc');var config=require(_0x35b5('0x5'));var jayson=require(_0x35b5('0x6'));var client=jayson[_0x35b5('0x7')][_0x35b5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1db386,_0x8c4498,_0x1df162){return new BPromise(function(_0x44e966,_0x2ba841){return client[_0x35b5('0x9')](_0x1db386,_0x1df162)['then'](function(_0xd718a7){logger['info'](_0x35b5('0xa'),_0x8c4498,'request\x20sent');logger[_0x35b5('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x8c4498,_0x35b5('0xc'),JSON[_0x35b5('0xd')](_0xd718a7));if(_0xd718a7[_0x35b5('0xe')]){if(_0xd718a7[_0x35b5('0xe')][_0x35b5('0xf')]===0x1f4){logger[_0x35b5('0xe')](_0x35b5('0xa'),_0x8c4498,_0xd718a7[_0x35b5('0xe')][_0x35b5('0x10')]);return _0x2ba841(_0xd718a7[_0x35b5('0xe')][_0x35b5('0x10')]);}logger[_0x35b5('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x8c4498,_0xd718a7[_0x35b5('0xe')][_0x35b5('0x10')]);return _0x44e966(_0xd718a7[_0x35b5('0xe')][_0x35b5('0x10')]);}else{logger[_0x35b5('0x11')](_0x35b5('0xa'),_0x8c4498,_0x35b5('0xc'));_0x44e966(_0xd718a7[_0x35b5('0x12')]['message']);}})[_0x35b5('0x13')](function(_0x822f55){logger[_0x35b5('0xe')](_0x35b5('0xa'),_0x8c4498,_0x822f55);_0x2ba841(_0x822f55);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 6c530f1..f2ca76d 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 _0x6d82=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','show','/:id/sessions','getSessions','/:id/summary','getSummary','post','create','/:id/clone','clone','/:id','update','delete','exports','multer','util','path'];(function(_0x4a63de,_0x10f00f){var _0x6fa39a=function(_0x217a34){while(--_0x217a34){_0x4a63de['push'](_0x4a63de['shift']());}};_0x6fa39a(++_0x10f00f);}(_0x6d82,0x18d));var _0x26d8=function(_0x2f9057,_0x297256){_0x2f9057=_0x2f9057-0x0;var _0x3e3ef8=_0x6d82[_0x2f9057];return _0x3e3ef8;};'use strict';var multer=require(_0x26d8('0x0'));var util=require(_0x26d8('0x1'));var path=require(_0x26d8('0x2'));var timeout=require('connect-timeout');var express=require(_0x26d8('0x3'));var router=express[_0x26d8('0x4')]();var fs_extra=require(_0x26d8('0x5'));var auth=require(_0x26d8('0x6'));var interaction=require(_0x26d8('0x7'));var config=require(_0x26d8('0x8'));var controller=require(_0x26d8('0x9'));router[_0x26d8('0xa')]('/',auth[_0x26d8('0xb')](),controller['index']);router[_0x26d8('0xa')]('/:id',auth[_0x26d8('0xb')](),controller[_0x26d8('0xc')]);router['get'](_0x26d8('0xd'),auth[_0x26d8('0xb')](),controller[_0x26d8('0xe')]);router[_0x26d8('0xa')]('/:id/answers',auth[_0x26d8('0xb')](),controller['getAnswers']);router[_0x26d8('0xa')](_0x26d8('0xf'),auth['isAuthenticated'](),timeout('30s'),controller[_0x26d8('0x10')]);router[_0x26d8('0x11')]('/',auth[_0x26d8('0xb')](),controller[_0x26d8('0x12')]);router[_0x26d8('0x11')](_0x26d8('0x13'),auth[_0x26d8('0xb')](),controller[_0x26d8('0x14')]);router['put'](_0x26d8('0x15'),auth[_0x26d8('0xb')](),controller[_0x26d8('0x16')]);router[_0x26d8('0x17')]('/:id',auth[_0x26d8('0xb')](),controller['destroy']);module[_0x26d8('0x18')]=router; \ No newline at end of file +var _0x9e95=['getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','/:id','show','/:id/sessions','isAuthenticated'];(function(_0x285c85,_0x132c21){var _0x2f81cd=function(_0x9b9962){while(--_0x9b9962){_0x285c85['push'](_0x285c85['shift']());}};_0x2f81cd(++_0x132c21);}(_0x9e95,0x15a));var _0x59e9=function(_0x3087e2,_0x2acf9c){_0x3087e2=_0x3087e2-0x0;var _0x5068a2=_0x9e95[_0x3087e2];return _0x5068a2;};'use strict';var multer=require(_0x59e9('0x0'));var util=require(_0x59e9('0x1'));var path=require('path');var timeout=require(_0x59e9('0x2'));var express=require(_0x59e9('0x3'));var router=express[_0x59e9('0x4')]();var fs_extra=require(_0x59e9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x59e9('0x6'));var config=require(_0x59e9('0x7'));var controller=require(_0x59e9('0x8'));router[_0x59e9('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x59e9('0x9')](_0x59e9('0xa'),auth['isAuthenticated'](),controller[_0x59e9('0xb')]);router[_0x59e9('0x9')](_0x59e9('0xc'),auth[_0x59e9('0xd')](),controller[_0x59e9('0xe')]);router['get'](_0x59e9('0xf'),auth[_0x59e9('0xd')](),controller[_0x59e9('0x10')]);router[_0x59e9('0x9')](_0x59e9('0x11'),auth['isAuthenticated'](),timeout(_0x59e9('0x12')),controller[_0x59e9('0x13')]);router[_0x59e9('0x14')]('/',auth[_0x59e9('0xd')](),controller['create']);router[_0x59e9('0x14')]('/:id/clone',auth[_0x59e9('0xd')](),controller['clone']);router['put'](_0x59e9('0xa'),auth[_0x59e9('0xd')](),controller['update']);router[_0x59e9('0x15')]('/:id',auth[_0x59e9('0xd')](),controller[_0x59e9('0x16')]);module[_0x59e9('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 2ac998a..8cd885c 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 _0xd6b4=['sequelize','lodash','util','exports','STRING','name','long','formData','stringify','isString','setDataValue','getDataValue','description','BOOLEAN'];(function(_0x1bb030,_0x27d05f){var _0x28ef4f=function(_0xb1150e){while(--_0xb1150e){_0x1bb030['push'](_0x1bb030['shift']());}};_0x28ef4f(++_0x27d05f);}(_0xd6b4,0x10a));var _0x4d6b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd6b4[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x4d6b('0x0'));var _=require(_0x4d6b('0x1'));var util=require(_0x4d6b('0x2'));module[_0x4d6b('0x3')]={'name':{'type':Sequelize[_0x4d6b('0x4')],'unique':_0x4d6b('0x5')},'description':{'type':Sequelize[_0x4d6b('0x4')]},'formData':{'type':Sequelize['TEXT'](_0x4d6b('0x6')),'set':function(_0x3ac6d9){if(_['isObjectLike'](_0x3ac6d9)){this['setDataValue'](_0x4d6b('0x7'),JSON[_0x4d6b('0x8')](_0x3ac6d9));}else if(_[_0x4d6b('0x9')](_0x3ac6d9)){this[_0x4d6b('0xa')](_0x4d6b('0x7'),_0x3ac6d9);}else{this['setDataValue'](_0x4d6b('0x7'),util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x4d6b('0xb')](_0x4d6b('0x5'))||'',this[_0x4d6b('0xb')](_0x4d6b('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x4d6b('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x4d6b('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x502b=['setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','lodash','exports','STRING','name','TEXT','long','isObjectLike','formData','isString'];(function(_0x3bd869,_0x16ac17){var _0x3f7dd8=function(_0x41a459){while(--_0x41a459){_0x3bd869['push'](_0x3bd869['shift']());}};_0x3f7dd8(++_0x16ac17);}(_0x502b,0xf3));var _0xb502=function(_0x4f9522,_0x399e9f){_0x4f9522=_0x4f9522-0x0;var _0x5a89a7=_0x502b[_0x4f9522];return _0x5a89a7;};'use strict';var Sequelize=require('sequelize');var _=require(_0xb502('0x0'));var util=require('util');module[_0xb502('0x1')]={'name':{'type':Sequelize[_0xb502('0x2')],'unique':_0xb502('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xb502('0x4')](_0xb502('0x5')),'set':function(_0x1dd1b0){if(_[_0xb502('0x6')](_0x1dd1b0)){this['setDataValue'](_0xb502('0x7'),JSON['stringify'](_0x1dd1b0));}else if(_[_0xb502('0x8')](_0x1dd1b0)){this[_0xb502('0x9')]('formData',_0x1dd1b0);}else{this[_0xb502('0x9')](_0xb502('0x7'),util[_0xb502('0xa')](_0xb502('0xb'),this[_0xb502('0xc')]('name')||'',this[_0xb502('0xc')](_0xb502('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index ed11995..d50ba5c 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 _0x72fa=['moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','Projects','destroy','error','name','send','JscriptyProject','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','show','params','rawAttributes','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','userProfileId','getSessions','JscriptySessionReport','ProjectId','rows','getAnswers','findOne','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x146feb,_0x3159f0){var _0x5edb7e=function(_0x4ff67c){while(--_0x4ff67c){_0x146feb['push'](_0x146feb['shift']());}};_0x5edb7e(++_0x3159f0);}(_0x72fa,0x78));var _0xa72f=function(_0x248a82,_0x4fca3e){_0x248a82=_0x248a82-0x0;var _0x4bef56=_0x72fa[_0x248a82];return _0x4bef56;};'use strict';var emlformat=require(_0xa72f('0x0'));var rimraf=require(_0xa72f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa72f('0x2'));var rp=require(_0xa72f('0x3'));var moment=require(_0xa72f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa72f('0x5'));var path=require(_0xa72f('0x6'));var sox=require(_0xa72f('0x7'));var csv=require(_0xa72f('0x8'));var ejs=require(_0xa72f('0x9'));var fs=require('fs');var fs_extra=require(_0xa72f('0xa'));var _=require(_0xa72f('0xb'));var squel=require(_0xa72f('0xc'));var crypto=require(_0xa72f('0xd'));var jsforce=require(_0xa72f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa72f('0x8'));var querystring=require(_0xa72f('0xf'));var Papa=require(_0xa72f('0x10'));var Redis=require('ioredis');var authService=require(_0xa72f('0x11'));var qs=require(_0xa72f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa72f('0x13'));var logger=require(_0xa72f('0x14'))(_0xa72f('0x15'));var utils=require(_0xa72f('0x16'));var config=require(_0xa72f('0x17'));var licenseUtil=require(_0xa72f('0x18'));var db=require(_0xa72f('0x19'))['db'];function respondWithStatusCode(_0x130178,_0x1a5953){_0x1a5953=_0x1a5953||0xcc;return function(_0x42054f){if(_0x42054f){return _0x130178[_0xa72f('0x1a')](_0x1a5953);}return _0x130178[_0xa72f('0x1b')](_0x1a5953)['end']();};}function respondWithResult(_0x3f83d8,_0x3003dd){_0x3003dd=_0x3003dd||0xc8;return function(_0x39ff7a){if(_0x39ff7a){return _0x3f83d8['status'](_0x3003dd)[_0xa72f('0x1c')](_0x39ff7a);}};}function respondWithFilteredResult(_0x5aeda8,_0x22c97c){return function(_0x661032){if(_0x661032){var _0x5c150c=typeof _0x22c97c[_0xa72f('0x1d')]===_0xa72f('0x1e')&&typeof _0x22c97c[_0xa72f('0x1f')]===_0xa72f('0x1e');var _0x505fe9=_0x661032[_0xa72f('0x20')];var _0x79d7a=_0x5c150c?0x0:_0x22c97c[_0xa72f('0x1d')];var _0x303faa=_0x5c150c?_0x661032['count']:_0x22c97c[_0xa72f('0x1d')]+_0x22c97c[_0xa72f('0x1f')];var _0x24b207;if(_0x303faa>=_0x505fe9){_0x303faa=_0x505fe9;_0x24b207=0xc8;}else{_0x24b207=0xce;}_0x5aeda8[_0xa72f('0x1b')](_0x24b207);return _0x5aeda8[_0xa72f('0x21')](_0xa72f('0x22'),_0x79d7a+'-'+_0x303faa+'/'+_0x505fe9)['json'](_0x661032);}return null;};}function patchUpdates(_0x2ec121){return function(_0x4a6234){try{jsonpatch[_0xa72f('0x23')](_0x4a6234,_0x2ec121,!![]);}catch(_0x29d49d){return BPromise['reject'](_0x29d49d);}return _0x4a6234[_0xa72f('0x24')]();};}function saveUpdates(_0x2eaf9c,_0x355740){return function(_0x284f22){if(_0x284f22){return _0x284f22[_0xa72f('0x25')](_0x2eaf9c)[_0xa72f('0x26')](function(_0x363755){return _0x363755;});}return null;};}function removeEntity(_0x276123,_0x1e3af9){return function(_0x13c717){if(_0x13c717){return _0x13c717['destroy']()[_0xa72f('0x26')](function(){var _0xf99de8=_0x13c717[_0xa72f('0x27')]({'plain':!![]});var _0x40cc13=_0xa72f('0x28');return db['UserProfileResource'][_0xa72f('0x29')]({'where':{'type':_0x40cc13,'resourceId':_0xf99de8['id']}})[_0xa72f('0x26')](function(){return _0x13c717;});})[_0xa72f('0x26')](function(){_0x276123[_0xa72f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e02a2,_0x4596cb){return function(_0x51e4e4){if(!_0x51e4e4){_0x4e02a2[_0xa72f('0x1a')](0x194);}return _0x51e4e4;};}function handleError(_0x25a618,_0x3e03bc){_0x3e03bc=_0x3e03bc||0x1f4;return function(_0x224d1a){logger[_0xa72f('0x2a')](_0x224d1a['stack']);if(_0x224d1a[_0xa72f('0x2b')]){delete _0x224d1a[_0xa72f('0x2b')];}_0x25a618[_0xa72f('0x1b')](_0x3e03bc)[_0xa72f('0x2c')](_0x224d1a);};}exports['index']=function(_0x26aa28,_0x3843f6){var _0x4c1eff={},_0x2cd213={},_0x2216ce={'count':0x0,'rows':[]};var _0x3206ab=_['map'](db[_0xa72f('0x2d')]['rawAttributes'],function(_0x1e2a12){return{'name':_0x1e2a12['fieldName'],'type':_0x1e2a12[_0xa72f('0x2e')]['key']};});_0x2cd213[_0xa72f('0x2f')]=_[_0xa72f('0x30')](_0x3206ab,_0xa72f('0x2b'));_0x2cd213[_0xa72f('0x31')]=_[_0xa72f('0x32')](_0x26aa28['query']);_0x2cd213[_0xa72f('0x33')]=_[_0xa72f('0x34')](_0x2cd213[_0xa72f('0x2f')],_0x2cd213[_0xa72f('0x31')]);_0x4c1eff[_0xa72f('0x35')]=_[_0xa72f('0x34')](_0x2cd213[_0xa72f('0x2f')],qs[_0xa72f('0x36')](_0x26aa28[_0xa72f('0x31')][_0xa72f('0x36')]));_0x4c1eff[_0xa72f('0x35')]=_0x4c1eff['attributes']['length']?_0x4c1eff[_0xa72f('0x35')]:_0x2cd213[_0xa72f('0x2f')];if(!_0x26aa28[_0xa72f('0x31')][_0xa72f('0x37')](_0xa72f('0x38'))){_0x4c1eff[_0xa72f('0x1f')]=qs['limit'](_0x26aa28[_0xa72f('0x31')][_0xa72f('0x1f')]);_0x4c1eff['offset']=qs[_0xa72f('0x1d')](_0x26aa28['query'][_0xa72f('0x1d')]);}_0x4c1eff[_0xa72f('0x39')]=qs[_0xa72f('0x3a')](_0x26aa28[_0xa72f('0x31')][_0xa72f('0x3a')]);_0x4c1eff[_0xa72f('0x3b')]=qs['filters'](_[_0xa72f('0x3c')](_0x26aa28[_0xa72f('0x31')],_0x2cd213[_0xa72f('0x33')]),_0x3206ab);if(_0x26aa28[_0xa72f('0x31')][_0xa72f('0x3d')]){_0x4c1eff[_0xa72f('0x3b')]=_['merge'](_0x4c1eff['where'],{'$or':_[_0xa72f('0x30')](_0x3206ab,function(_0x460528){if(_0x460528['type']!==_0xa72f('0x3e')){var _0x5d2ec0={};_0x5d2ec0[_0x460528[_0xa72f('0x2b')]]={'$like':'%'+_0x26aa28[_0xa72f('0x31')][_0xa72f('0x3d')]+'%'};return _0x5d2ec0;}})});}_0x4c1eff=_[_0xa72f('0x3f')]({},_0x4c1eff,_0x26aa28[_0xa72f('0x40')]);var _0xa53025={'where':_0x4c1eff[_0xa72f('0x3b')]};return db[_0xa72f('0x2d')][_0xa72f('0x20')](_0xa53025)[_0xa72f('0x26')](function(_0x17c079){_0x2216ce[_0xa72f('0x20')]=_0x17c079;if(_0x26aa28['query']['includeAll']){_0x4c1eff[_0xa72f('0x41')]=[{'all':!![]}];}return db['JscriptyProject'][_0xa72f('0x42')](_0x4c1eff);})[_0xa72f('0x26')](function(_0x5c6233){_0x2216ce['rows']=_0x5c6233;return _0x2216ce;})[_0xa72f('0x26')](respondWithFilteredResult(_0x3843f6,_0x4c1eff))['catch'](handleError(_0x3843f6,null));};exports[_0xa72f('0x43')]=function(_0x51feef,_0x37f4c9){var _0xe31ac4={'raw':![],'where':{'id':_0x51feef[_0xa72f('0x44')]['id']}},_0xdb166e={};_0xdb166e[_0xa72f('0x2f')]=_[_0xa72f('0x32')](db[_0xa72f('0x2d')][_0xa72f('0x45')]);_0xdb166e[_0xa72f('0x31')]=_[_0xa72f('0x32')](_0x51feef['query']);_0xdb166e['filters']=_[_0xa72f('0x34')](_0xdb166e['model'],_0xdb166e[_0xa72f('0x31')]);_0xe31ac4[_0xa72f('0x35')]=_['intersection'](_0xdb166e[_0xa72f('0x2f')],qs['fields'](_0x51feef[_0xa72f('0x31')]['fields']));_0xe31ac4[_0xa72f('0x35')]=_0xe31ac4['attributes'][_0xa72f('0x46')]?_0xe31ac4[_0xa72f('0x35')]:_0xdb166e[_0xa72f('0x2f')];if(_0x51feef['query'][_0xa72f('0x47')]){_0xe31ac4[_0xa72f('0x41')]=[{'all':!![]}];}_0xe31ac4=_[_0xa72f('0x3f')]({},_0xe31ac4,_0x51feef[_0xa72f('0x40')]);return db[_0xa72f('0x2d')][_0xa72f('0x48')](_0xe31ac4)[_0xa72f('0x26')](handleEntityNotFound(_0x37f4c9,null))[_0xa72f('0x26')](respondWithResult(_0x37f4c9,null))['catch'](handleError(_0x37f4c9,null));};exports[_0xa72f('0x49')]=function(_0x309774,_0x2f5e0f){return db[_0xa72f('0x2d')][_0xa72f('0x49')](_0x309774[_0xa72f('0x4a')],{})['then'](function(_0x4f2b71){var _0x246bd0=_0x309774[_0xa72f('0x4b')]['get']({'plain':!![]});if(!_0x246bd0)throw new Error(_0xa72f('0x4c'));if(_0x246bd0[_0xa72f('0x4d')]===_0xa72f('0x4b')){var _0x14adb4=_0x4f2b71[_0xa72f('0x27')]({'plain':!![]});var _0x16bca6=_0xa72f('0x28');return db['UserProfileSection'][_0xa72f('0x48')]({'where':{'name':_0x16bca6,'userProfileId':_0x246bd0['userProfileId']},'raw':!![]})[_0xa72f('0x26')](function(_0x4485ef){if(_0x4485ef&&_0x4485ef[_0xa72f('0x4e')]===0x0){return db[_0xa72f('0x4f')]['create']({'name':_0x14adb4[_0xa72f('0x2b')],'resourceId':_0x14adb4['id'],'type':_0x4485ef['name'],'sectionId':_0x4485ef['id']},{})[_0xa72f('0x26')](function(){return _0x4f2b71;});}else{return _0x4f2b71;}})[_0xa72f('0x50')](function(_0x49a1e1){logger[_0xa72f('0x2a')](_0xa72f('0x51'),_0x49a1e1);throw _0x49a1e1;});}return _0x4f2b71;})['then'](respondWithResult(_0x2f5e0f,0xc9))[_0xa72f('0x50')](handleError(_0x2f5e0f,null));};exports[_0xa72f('0x52')]=function(_0x3c18fd,_0x1930a2){var _0x1a85df={'where':{'id':_0x3c18fd['params']['id']}},_0x5ac438={};_0x5ac438[_0xa72f('0x2f')]=_[_0xa72f('0x32')](db[_0xa72f('0x2d')][_0xa72f('0x45')]);_0x1a85df[_0xa72f('0x35')]=_[_0xa72f('0x34')](_0x5ac438[_0xa72f('0x2f')],qs[_0xa72f('0x36')](_0x3c18fd[_0xa72f('0x31')]['fields']));_0x1a85df[_0xa72f('0x35')]=_0x1a85df['attributes'][_0xa72f('0x46')]?_0x1a85df[_0xa72f('0x35')]:_0x5ac438['model'];if(_0x3c18fd[_0xa72f('0x31')][_0xa72f('0x47')]){_0x1a85df[_0xa72f('0x41')]=[{'all':!![]}];}_0x1a85df=_[_0xa72f('0x3f')]({},_0x1a85df,_0x3c18fd['options']);return db[_0xa72f('0x2d')][_0xa72f('0x48')](_0x1a85df)[_0xa72f('0x26')](handleEntityNotFound(_0x1930a2,null))['then'](function(_0x471554){if(_0x471554){var _0x349fa9=_0x471554['get']({'plain':!![]});_0x349fa9=qs[_0xa72f('0x53')](_0x349fa9,['id',_0xa72f('0x54'),_0xa72f('0x55')]);_0x3c18fd[_0xa72f('0x4a')]=_[_0xa72f('0x53')](_0x3c18fd['body'],['id','createdAt',_0xa72f('0x55')]);return db[_0xa72f('0x2d')][_0xa72f('0x49')](_['merge'](_0x349fa9,_0x3c18fd[_0xa72f('0x4a')]),{'include':_0x3c18fd[_0xa72f('0x31')][_0xa72f('0x47')]?[{'all':!![]}]:undefined})[_0xa72f('0x26')](function(_0x2cd505){var _0x1bdf23=_0x3c18fd[_0xa72f('0x4b')][_0xa72f('0x27')]({'plain':!![]});if(!_0x1bdf23)throw new Error(_0xa72f('0x4c'));if(_0x1bdf23['role']===_0xa72f('0x4b')){var _0x2a781d=_0x2cd505[_0xa72f('0x27')]({'plain':!![]});var _0x3dcb1f=_0xa72f('0x28');return db[_0xa72f('0x56')][_0xa72f('0x48')]({'where':{'name':_0x3dcb1f,'userProfileId':_0x1bdf23[_0xa72f('0x57')]},'raw':!![]})[_0xa72f('0x26')](function(_0x3d885f){if(_0x3d885f&&_0x3d885f[_0xa72f('0x4e')]===0x0){return db[_0xa72f('0x4f')][_0xa72f('0x49')]({'name':_0x2a781d[_0xa72f('0x2b')],'resourceId':_0x2a781d['id'],'type':_0x3d885f[_0xa72f('0x2b')],'sectionId':_0x3d885f['id']},{})[_0xa72f('0x26')](function(){return _0x2cd505;});}else{return _0x2cd505;}})[_0xa72f('0x50')](function(_0x6d3344){logger[_0xa72f('0x2a')](_0xa72f('0x51'),_0x6d3344);throw _0x6d3344;});}return _0x2cd505;});}})['then'](respondWithResult(_0x1930a2,0xc9))[_0xa72f('0x50')](handleError(_0x1930a2,null));};exports[_0xa72f('0x25')]=function(_0x3f8b7e,_0x3ad715){if(_0x3f8b7e['body']['id']){delete _0x3f8b7e[_0xa72f('0x4a')]['id'];}return db[_0xa72f('0x2d')][_0xa72f('0x48')]({'where':{'id':_0x3f8b7e['params']['id']}})[_0xa72f('0x26')](handleEntityNotFound(_0x3ad715,null))[_0xa72f('0x26')](saveUpdates(_0x3f8b7e[_0xa72f('0x4a')],null))[_0xa72f('0x26')](respondWithResult(_0x3ad715,null))[_0xa72f('0x50')](handleError(_0x3ad715,null));};exports[_0xa72f('0x29')]=function(_0x18da37,_0x3e81dd){return db['JscriptyProject']['find']({'where':{'id':_0x18da37[_0xa72f('0x44')]['id']}})[_0xa72f('0x26')](handleEntityNotFound(_0x3e81dd,null))[_0xa72f('0x26')](removeEntity(_0x3e81dd,null))[_0xa72f('0x50')](handleError(_0x3e81dd,null));};exports[_0xa72f('0x58')]=function(_0x44670a,_0x4e14f7,_0x40a8e0){var _0x232c9d={'raw':!![],'where':{}};var _0x42e60c={};var _0x47a4ed={'count':0x0,'rows':[]};return db[_0xa72f('0x2d')]['findOne']({'where':{'id':_0x44670a[_0xa72f('0x44')]['id']}})[_0xa72f('0x26')](handleEntityNotFound(_0x4e14f7,null))[_0xa72f('0x26')](function(_0x324c9a){if(_0x324c9a){_0x42e60c[_0xa72f('0x2f')]=_[_0xa72f('0x32')](db[_0xa72f('0x59')][_0xa72f('0x45')]);_0x42e60c['query']=_[_0xa72f('0x32')](_0x44670a['query']);_0x42e60c[_0xa72f('0x33')]=_[_0xa72f('0x34')](_0x42e60c['model'],_0x42e60c[_0xa72f('0x31')]);_0x232c9d[_0xa72f('0x35')]=_[_0xa72f('0x34')](_0x42e60c['model'],qs[_0xa72f('0x36')](_0x44670a[_0xa72f('0x31')][_0xa72f('0x36')]));_0x232c9d[_0xa72f('0x35')]=_0x232c9d['attributes'][_0xa72f('0x46')]?_0x232c9d[_0xa72f('0x35')]:_0x42e60c['model'];if(!_0x44670a[_0xa72f('0x31')][_0xa72f('0x37')](_0xa72f('0x38'))){_0x232c9d['limit']=qs[_0xa72f('0x1f')](_0x44670a[_0xa72f('0x31')][_0xa72f('0x1f')]);_0x232c9d[_0xa72f('0x1d')]=qs[_0xa72f('0x1d')](_0x44670a['query'][_0xa72f('0x1d')]);}_0x232c9d[_0xa72f('0x39')]=qs['sort'](_0x44670a[_0xa72f('0x31')]['sort']);_0x232c9d['where']=qs[_0xa72f('0x33')](_['pick'](_0x44670a[_0xa72f('0x31')],_0x42e60c[_0xa72f('0x33')]));_0x232c9d[_0xa72f('0x3b')][_0xa72f('0x5a')]=_0x324c9a['id'];if(_0x44670a['query'][_0xa72f('0x3d')]){_0x232c9d[_0xa72f('0x3b')]=_['merge'](_0x232c9d[_0xa72f('0x3b')],{'$or':_[_0xa72f('0x30')](_0x232c9d[_0xa72f('0x35')],function(_0xf1fe15){var _0x3a70ce={};_0x3a70ce[_0xf1fe15]={'$like':'%'+_0x44670a[_0xa72f('0x31')][_0xa72f('0x3d')]+'%'};return _0x3a70ce;})});}_0x232c9d=_[_0xa72f('0x3f')]({},_0x232c9d,_0x44670a[_0xa72f('0x40')]);return db[_0xa72f('0x59')][_0xa72f('0x20')]({'where':_0x232c9d[_0xa72f('0x3b')]})[_0xa72f('0x26')](function(_0x3bc819){_0x47a4ed[_0xa72f('0x20')]=_0x3bc819;if(_0x44670a[_0xa72f('0x31')][_0xa72f('0x47')]){_0x232c9d['include']=[{'all':!![]}];}return db[_0xa72f('0x59')][_0xa72f('0x42')](_0x232c9d);})[_0xa72f('0x26')](function(_0x50013b){_0x47a4ed[_0xa72f('0x5b')]=_0x50013b;return _0x47a4ed;});}})[_0xa72f('0x26')](respondWithFilteredResult(_0x4e14f7,_0x232c9d))['catch'](handleError(_0x4e14f7,null));};exports[_0xa72f('0x5c')]=function(_0x2f1268,_0x5c5bad,_0x472b81){var _0x1f3b31={'raw':!![],'where':{}};var _0x51282b={};var _0x40aa0f={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xa72f('0x5d')]({'where':{'id':_0x2f1268[_0xa72f('0x44')]['id']}})[_0xa72f('0x26')](handleEntityNotFound(_0x5c5bad,null))[_0xa72f('0x26')](function(_0xce6253){if(_0xce6253){_0x51282b[_0xa72f('0x2f')]=_[_0xa72f('0x32')](db['JscriptyAnswerReport'][_0xa72f('0x45')]);_0x51282b[_0xa72f('0x31')]=_['keys'](_0x2f1268[_0xa72f('0x31')]);_0x51282b[_0xa72f('0x33')]=_['intersection'](_0x51282b[_0xa72f('0x2f')],_0x51282b[_0xa72f('0x31')]);_0x1f3b31[_0xa72f('0x35')]=_[_0xa72f('0x34')](_0x51282b[_0xa72f('0x2f')],qs[_0xa72f('0x36')](_0x2f1268['query']['fields']));_0x1f3b31[_0xa72f('0x35')]=_0x1f3b31[_0xa72f('0x35')][_0xa72f('0x46')]?_0x1f3b31['attributes']:_0x51282b[_0xa72f('0x2f')];if(!_0x2f1268['query'][_0xa72f('0x37')](_0xa72f('0x38'))){_0x1f3b31[_0xa72f('0x1f')]=qs[_0xa72f('0x1f')](_0x2f1268[_0xa72f('0x31')]['limit']);_0x1f3b31[_0xa72f('0x1d')]=qs['offset'](_0x2f1268[_0xa72f('0x31')]['offset']);}_0x1f3b31[_0xa72f('0x39')]=qs['sort'](_0x2f1268['query'][_0xa72f('0x3a')]);_0x1f3b31[_0xa72f('0x3b')]=qs[_0xa72f('0x33')](_['pick'](_0x2f1268['query'],_0x51282b[_0xa72f('0x33')]));_0x1f3b31[_0xa72f('0x3b')][_0xa72f('0x5a')]=_0xce6253['id'];if(_0x2f1268[_0xa72f('0x31')][_0xa72f('0x3d')]){_0x1f3b31['where']=_[_0xa72f('0x3f')](_0x1f3b31[_0xa72f('0x3b')],{'$or':_[_0xa72f('0x30')](_0x1f3b31[_0xa72f('0x35')],function(_0x52b5d2){var _0x245b5d={};_0x245b5d[_0x52b5d2]={'$like':'%'+_0x2f1268[_0xa72f('0x31')][_0xa72f('0x3d')]+'%'};return _0x245b5d;})});}_0x1f3b31=_['merge']({},_0x1f3b31,_0x2f1268['options']);return db[_0xa72f('0x5e')]['count']({'where':_0x1f3b31['where']})[_0xa72f('0x26')](function(_0x1d8503){_0x40aa0f[_0xa72f('0x20')]=_0x1d8503;if(_0x2f1268[_0xa72f('0x31')][_0xa72f('0x47')]){_0x1f3b31[_0xa72f('0x41')]=[{'all':!![]}];}return db[_0xa72f('0x5e')]['findAll'](_0x1f3b31);})[_0xa72f('0x26')](function(_0x50a9ca){_0x40aa0f[_0xa72f('0x5b')]=_0x50a9ca;return _0x40aa0f;});}})[_0xa72f('0x26')](respondWithFilteredResult(_0x5c5bad,_0x1f3b31))[_0xa72f('0x50')](handleError(_0x5c5bad,null));};function char(_0x48b964){return _0xa72f('0x5f')===typeof _0x48b964?String[_0xa72f('0x60')][_0xa72f('0x23')](null,arguments):_0x48b964;}function needsEncapsulation(_0x5e9fbc){return!!_0x5e9fbc&&(_0x5e9fbc[_0xa72f('0x61')]()[_0xa72f('0x62')](char(0xd))>=0x0||_0x5e9fbc[_0xa72f('0x61')]()[_0xa72f('0x62')](char(0xa))>=0x0||_0x5e9fbc['toString']()[_0xa72f('0x62')](char(0x2c))>=0x0||_0x5e9fbc['toString']()[_0xa72f('0x62')](char(0x22))>=0x0);}function encapsulate(_0x30d418){var _0xb0f400=char(0x22),_0x235b04='\x5c'+char(0x22),_0x4fd2ca=_0x30d418[_0xa72f('0x61')]()[_0xa72f('0x63')](new RegExp(_0xb0f400,'g'),_0x235b04);return _0xb0f400+_0x4fd2ca+_0xb0f400;}exports[_0xa72f('0x64')]=function(_0xfcab7e,_0x4fa85f,_0x311bc3){var _0x419132,_0x4bd220;var _0x360023={'where':{'ProjectId':_0xfcab7e['params']['id']}};if(_0xfcab7e[_0xa72f('0x31')]['startTime']){_0x360023[_0xa72f('0x3b')][_0xa72f('0x65')]=JSON[_0xa72f('0x66')](_0xfcab7e[_0xa72f('0x31')][_0xa72f('0x67')]);}return db[_0xa72f('0x59')][_0xa72f('0x42')](_0x360023)[_0xa72f('0x26')](handleEntityNotFound(_0x4fa85f,null))['then'](function(_0x39761d){if(_0x39761d){_0x419132=_0x39761d;return db[_0xa72f('0x68')]['findAll']({'where':{'SessionId':{'$in':_[_0xa72f('0x30')](_0x419132,'id')},'ProjectId':_0xfcab7e[_0xa72f('0x44')]['id']},'order':_0xa72f('0x69')});}})['then'](handleEntityNotFound(_0x4fa85f,null))[_0xa72f('0x26')](function(_0x12e5cc){if(_0x12e5cc){_0x4bd220=_0x12e5cc;var _0x457a7d={};for(var _0x2f436=0x0,_0x35f90f=_0x4bd220[_0xa72f('0x46')];_0x2f436<_0x35f90f;_0x2f436++){if(!_0x457a7d[_0xa72f('0x37')](_0x4bd220[_0x2f436][_0xa72f('0x6a')])){_0x457a7d[_0x4bd220[_0x2f436][_0xa72f('0x6a')]]=needsEncapsulation(_0x4bd220[_0x2f436][_0xa72f('0x6b')])?encapsulate(_0x4bd220[_0x2f436][_0xa72f('0x6b')]):_0x4bd220[_0x2f436][_0xa72f('0x6b')];}}var _0x5d3735=[],_0x569d93={};for(var _0x15698e=0x0,_0x1f1a1e=_0x419132[_0xa72f('0x46')];_0x15698e<_0x1f1a1e;_0x15698e++){_0x569d93={'ProjectId':_0xfcab7e[_0xa72f('0x44')]['id'],'SessionId':_0x419132[_0x15698e]['id'],'StartTime':moment(_0x419132[_0x15698e][_0xa72f('0x65')])[_0xa72f('0x6c')](_0xa72f('0x6d'))};for(var _0x54c0dd=0x0,_0x2dfacb=_0x4bd220[_0xa72f('0x46')];_0x54c0dd<_0x2dfacb;_0x54c0dd++){if(_0x4bd220[_0x54c0dd][_0xa72f('0x6e')]==_0x419132[_0x15698e]['id']&&_0x457a7d['hasOwnProperty'](_0x4bd220[_0x54c0dd][_0xa72f('0x6a')])){_0x569d93[_0x457a7d[_0x4bd220[_0x54c0dd][_0xa72f('0x6a')]]]=_0x4bd220[_0x54c0dd][_0xa72f('0x6f')];}}for(var _0x41a985 in _0x457a7d){if(!_0x569d93[_0xa72f('0x37')](_0x457a7d[_0x41a985])){_0x569d93[_0x457a7d[_0x41a985]]=null;}}_0x5d3735[_0xa72f('0x70')](_0x569d93);}return _0x5d3735;}})[_0xa72f('0x26')](function(_0x3e3667){if(!_[_0xa72f('0x71')](_0x3e3667)){var _0xecab4c=toCsv(_0x3e3667);var _0x28fc4c=Date[_0xa72f('0x72')]();fs[_0xa72f('0x73')](util[_0xa72f('0x6c')](_0xa72f('0x74'),_0xfcab7e[_0xa72f('0x44')]['id'],_0x28fc4c),_0xecab4c);_0x4fa85f['setHeader'](_0xa72f('0x75'),_0xa72f('0x76')+util[_0xa72f('0x6c')](_0xa72f('0x77'),_0xfcab7e['params']['id'],_0x28fc4c));_0x4fa85f[_0xa72f('0x78')](_0xa72f('0x79'),_0xa72f('0x7a'));return _0x4fa85f[_0xa72f('0x7b')](util[_0xa72f('0x6c')](_0xa72f('0x74'),_0xfcab7e['params']['id'],_0x28fc4c));}else{return _0x4fa85f['sendStatus'](0xcc);}})['catch'](handleError(_0x4fa85f,null));}; \ No newline at end of file +var _0xffe1=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','clone','find','get','omit','createdAt','updatedAt','findOne','JscriptySessionReport','ProjectId','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','set','Content-Range','apply','update','destroy','then','Projects','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0x20c832,_0x31ed06){var _0x418155=function(_0x504193){while(--_0x504193){_0x20c832['push'](_0x20c832['shift']());}};_0x418155(++_0x31ed06);}(_0xffe1,0x187));var _0x1ffe=function(_0x46d321,_0x202bcc){_0x46d321=_0x46d321-0x0;var _0x2be3bb=_0xffe1[_0x46d321];return _0x2be3bb;};'use strict';var emlformat=require(_0x1ffe('0x0'));var rimraf=require(_0x1ffe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1ffe('0x2'));var rp=require('request-promise');var moment=require(_0x1ffe('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1ffe('0x4'));var util=require(_0x1ffe('0x5'));var path=require(_0x1ffe('0x6'));var sox=require(_0x1ffe('0x7'));var csv=require(_0x1ffe('0x8'));var ejs=require(_0x1ffe('0x9'));var fs=require('fs');var fs_extra=require(_0x1ffe('0xa'));var _=require(_0x1ffe('0xb'));var squel=require(_0x1ffe('0xc'));var crypto=require('crypto');var jsforce=require(_0x1ffe('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1ffe('0x8'));var querystring=require('querystring');var Papa=require(_0x1ffe('0xe'));var Redis=require('ioredis');var authService=require(_0x1ffe('0xf'));var qs=require(_0x1ffe('0x10'));var as=require(_0x1ffe('0x11'));var hardwareService=require(_0x1ffe('0x12'));var logger=require(_0x1ffe('0x13'))(_0x1ffe('0x14'));var utils=require(_0x1ffe('0x15'));var config=require(_0x1ffe('0x16'));var licenseUtil=require(_0x1ffe('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ebb12,_0x3b925b){_0x3b925b=_0x3b925b||0xcc;return function(_0x32c382){if(_0x32c382){return _0x5ebb12[_0x1ffe('0x18')](_0x3b925b);}return _0x5ebb12[_0x1ffe('0x19')](_0x3b925b)[_0x1ffe('0x1a')]();};}function respondWithResult(_0x3470a8,_0x3fc73c){_0x3fc73c=_0x3fc73c||0xc8;return function(_0x59440c){if(_0x59440c){return _0x3470a8[_0x1ffe('0x19')](_0x3fc73c)[_0x1ffe('0x1b')](_0x59440c);}};}function respondWithFilteredResult(_0x2494e6,_0x32bc09){return function(_0x1c78ec){if(_0x1c78ec){var _0x45459f=typeof _0x32bc09[_0x1ffe('0x1c')]==='undefined'&&typeof _0x32bc09['limit']==='undefined';var _0x17ca0c=_0x1c78ec['count'];var _0x37ce73=_0x45459f?0x0:_0x32bc09[_0x1ffe('0x1c')];var _0x762656=_0x45459f?_0x1c78ec[_0x1ffe('0x1d')]:_0x32bc09[_0x1ffe('0x1c')]+_0x32bc09['limit'];var _0x2d88be;if(_0x762656>=_0x17ca0c){_0x762656=_0x17ca0c;_0x2d88be=0xc8;}else{_0x2d88be=0xce;}_0x2494e6[_0x1ffe('0x19')](_0x2d88be);return _0x2494e6[_0x1ffe('0x1e')](_0x1ffe('0x1f'),_0x37ce73+'-'+_0x762656+'/'+_0x17ca0c)[_0x1ffe('0x1b')](_0x1c78ec);}return null;};}function patchUpdates(_0x280598){return function(_0x1b1136){try{jsonpatch[_0x1ffe('0x20')](_0x1b1136,_0x280598,!![]);}catch(_0x400160){return BPromise['reject'](_0x400160);}return _0x1b1136['save']();};}function saveUpdates(_0x161c9e,_0x2be091){return function(_0x45885b){if(_0x45885b){return _0x45885b[_0x1ffe('0x21')](_0x161c9e)['then'](function(_0x5c5515){return _0x5c5515;});}return null;};}function removeEntity(_0x42fb48,_0x5a7b39){return function(_0x49d68b){if(_0x49d68b){return _0x49d68b[_0x1ffe('0x22')]()[_0x1ffe('0x23')](function(){var _0x5215db=_0x49d68b['get']({'plain':!![]});var _0x5aa3a8=_0x1ffe('0x24');return db[_0x1ffe('0x25')][_0x1ffe('0x22')]({'where':{'type':_0x5aa3a8,'resourceId':_0x5215db['id']}})[_0x1ffe('0x23')](function(){return _0x49d68b;});})['then'](function(){_0x42fb48[_0x1ffe('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x266304,_0x4a0e20){return function(_0x1e0b1e){if(!_0x1e0b1e){_0x266304[_0x1ffe('0x18')](0x194);}return _0x1e0b1e;};}function handleError(_0xf9381f,_0x246e86){_0x246e86=_0x246e86||0x1f4;return function(_0x56bee3){logger[_0x1ffe('0x26')](_0x56bee3[_0x1ffe('0x27')]);if(_0x56bee3[_0x1ffe('0x28')]){delete _0x56bee3[_0x1ffe('0x28')];}_0xf9381f[_0x1ffe('0x19')](_0x246e86)[_0x1ffe('0x29')](_0x56bee3);};}exports[_0x1ffe('0x2a')]=function(_0x36feeb,_0x35f8fd){var _0x1edb78={},_0x1e697f={},_0x3f0a65={'count':0x0,'rows':[]};var _0x4ec473=_[_0x1ffe('0x2b')](db[_0x1ffe('0x2c')][_0x1ffe('0x2d')],function(_0x39226e){return{'name':_0x39226e[_0x1ffe('0x2e')],'type':_0x39226e[_0x1ffe('0x2f')][_0x1ffe('0x30')]};});_0x1e697f[_0x1ffe('0x31')]=_[_0x1ffe('0x2b')](_0x4ec473,_0x1ffe('0x28'));_0x1e697f[_0x1ffe('0x32')]=_[_0x1ffe('0x33')](_0x36feeb[_0x1ffe('0x32')]);_0x1e697f[_0x1ffe('0x34')]=_[_0x1ffe('0x35')](_0x1e697f['model'],_0x1e697f[_0x1ffe('0x32')]);_0x1edb78[_0x1ffe('0x36')]=_['intersection'](_0x1e697f['model'],qs['fields'](_0x36feeb[_0x1ffe('0x32')][_0x1ffe('0x37')]));_0x1edb78[_0x1ffe('0x36')]=_0x1edb78['attributes'][_0x1ffe('0x38')]?_0x1edb78[_0x1ffe('0x36')]:_0x1e697f[_0x1ffe('0x31')];if(!_0x36feeb[_0x1ffe('0x32')][_0x1ffe('0x39')](_0x1ffe('0x3a'))){_0x1edb78[_0x1ffe('0x3b')]=qs[_0x1ffe('0x3b')](_0x36feeb['query'][_0x1ffe('0x3b')]);_0x1edb78[_0x1ffe('0x1c')]=qs['offset'](_0x36feeb[_0x1ffe('0x32')][_0x1ffe('0x1c')]);}_0x1edb78[_0x1ffe('0x3c')]=qs[_0x1ffe('0x3d')](_0x36feeb[_0x1ffe('0x32')]['sort']);_0x1edb78[_0x1ffe('0x3e')]=qs[_0x1ffe('0x34')](_[_0x1ffe('0x3f')](_0x36feeb[_0x1ffe('0x32')],_0x1e697f[_0x1ffe('0x34')]),_0x4ec473);if(_0x36feeb['query'][_0x1ffe('0x40')]){_0x1edb78[_0x1ffe('0x3e')]=_[_0x1ffe('0x41')](_0x1edb78[_0x1ffe('0x3e')],{'$or':_[_0x1ffe('0x2b')](_0x4ec473,function(_0xb03c21){if(_0xb03c21[_0x1ffe('0x2f')]!==_0x1ffe('0x42')){var _0x3a88e1={};_0x3a88e1[_0xb03c21[_0x1ffe('0x28')]]={'$like':'%'+_0x36feeb[_0x1ffe('0x32')][_0x1ffe('0x40')]+'%'};return _0x3a88e1;}})});}_0x1edb78=_[_0x1ffe('0x41')]({},_0x1edb78,_0x36feeb[_0x1ffe('0x43')]);var _0x25fd00={'where':_0x1edb78[_0x1ffe('0x3e')]};return db[_0x1ffe('0x2c')][_0x1ffe('0x1d')](_0x25fd00)[_0x1ffe('0x23')](function(_0x2ed943){_0x3f0a65['count']=_0x2ed943;if(_0x36feeb[_0x1ffe('0x32')][_0x1ffe('0x44')]){_0x1edb78[_0x1ffe('0x45')]=[{'all':!![]}];}return db['JscriptyProject'][_0x1ffe('0x46')](_0x1edb78);})[_0x1ffe('0x23')](function(_0x33a214){_0x3f0a65[_0x1ffe('0x47')]=_0x33a214;return _0x3f0a65;})[_0x1ffe('0x23')](respondWithFilteredResult(_0x35f8fd,_0x1edb78))[_0x1ffe('0x48')](handleError(_0x35f8fd,null));};exports[_0x1ffe('0x49')]=function(_0x1039d6,_0xa28f7a){var _0x4146e6={'raw':![],'where':{'id':_0x1039d6[_0x1ffe('0x4a')]['id']}},_0x51013e={};_0x51013e[_0x1ffe('0x31')]=_[_0x1ffe('0x33')](db[_0x1ffe('0x2c')][_0x1ffe('0x2d')]);_0x51013e[_0x1ffe('0x32')]=_['keys'](_0x1039d6['query']);_0x51013e[_0x1ffe('0x34')]=_[_0x1ffe('0x35')](_0x51013e[_0x1ffe('0x31')],_0x51013e[_0x1ffe('0x32')]);_0x4146e6[_0x1ffe('0x36')]=_['intersection'](_0x51013e['model'],qs[_0x1ffe('0x37')](_0x1039d6[_0x1ffe('0x32')][_0x1ffe('0x37')]));_0x4146e6['attributes']=_0x4146e6['attributes'][_0x1ffe('0x38')]?_0x4146e6[_0x1ffe('0x36')]:_0x51013e[_0x1ffe('0x31')];if(_0x1039d6[_0x1ffe('0x32')][_0x1ffe('0x44')]){_0x4146e6[_0x1ffe('0x45')]=[{'all':!![]}];}_0x4146e6=_[_0x1ffe('0x41')]({},_0x4146e6,_0x1039d6['options']);return db[_0x1ffe('0x2c')]['find'](_0x4146e6)[_0x1ffe('0x23')](handleEntityNotFound(_0xa28f7a,null))[_0x1ffe('0x23')](respondWithResult(_0xa28f7a,null))[_0x1ffe('0x48')](handleError(_0xa28f7a,null));};exports[_0x1ffe('0x4b')]=function(_0x306238,_0x369254){return db[_0x1ffe('0x2c')][_0x1ffe('0x4b')](_0x306238[_0x1ffe('0x4c')],{})['then'](function(_0x58f346){var _0x202651=_0x306238[_0x1ffe('0x4d')]['get']({'plain':!![]});if(!_0x202651)throw new Error(_0x1ffe('0x4e'));if(_0x202651[_0x1ffe('0x4f')]===_0x1ffe('0x4d')){var _0x49e8f2=_0x58f346['get']({'plain':!![]});var _0x116be0=_0x1ffe('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x116be0,'userProfileId':_0x202651[_0x1ffe('0x50')]},'raw':!![]})['then'](function(_0x2a5d60){if(_0x2a5d60&&_0x2a5d60[_0x1ffe('0x51')]===0x0){return db[_0x1ffe('0x25')]['create']({'name':_0x49e8f2[_0x1ffe('0x28')],'resourceId':_0x49e8f2['id'],'type':_0x2a5d60[_0x1ffe('0x28')],'sectionId':_0x2a5d60['id']},{})[_0x1ffe('0x23')](function(){return _0x58f346;});}else{return _0x58f346;}})[_0x1ffe('0x48')](function(_0x319e6b){logger[_0x1ffe('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x319e6b);throw _0x319e6b;});}return _0x58f346;})['then'](respondWithResult(_0x369254,0xc9))[_0x1ffe('0x48')](handleError(_0x369254,null));};exports[_0x1ffe('0x52')]=function(_0x1c06dc,_0x3ba6c3){var _0x44000d={'where':{'id':_0x1c06dc[_0x1ffe('0x4a')]['id']}},_0x4f96b0={};_0x4f96b0[_0x1ffe('0x31')]=_[_0x1ffe('0x33')](db['JscriptyProject'][_0x1ffe('0x2d')]);_0x44000d[_0x1ffe('0x36')]=_[_0x1ffe('0x35')](_0x4f96b0[_0x1ffe('0x31')],qs[_0x1ffe('0x37')](_0x1c06dc[_0x1ffe('0x32')]['fields']));_0x44000d[_0x1ffe('0x36')]=_0x44000d[_0x1ffe('0x36')][_0x1ffe('0x38')]?_0x44000d[_0x1ffe('0x36')]:_0x4f96b0[_0x1ffe('0x31')];if(_0x1c06dc[_0x1ffe('0x32')][_0x1ffe('0x44')]){_0x44000d[_0x1ffe('0x45')]=[{'all':!![]}];}_0x44000d=_[_0x1ffe('0x41')]({},_0x44000d,_0x1c06dc[_0x1ffe('0x43')]);return db[_0x1ffe('0x2c')][_0x1ffe('0x53')](_0x44000d)['then'](handleEntityNotFound(_0x3ba6c3,null))[_0x1ffe('0x23')](function(_0x2e14af){if(_0x2e14af){var _0x3aff33=_0x2e14af[_0x1ffe('0x54')]({'plain':!![]});_0x3aff33=qs[_0x1ffe('0x55')](_0x3aff33,['id',_0x1ffe('0x56'),_0x1ffe('0x57')]);_0x1c06dc[_0x1ffe('0x4c')]=_['omit'](_0x1c06dc[_0x1ffe('0x4c')],['id','createdAt',_0x1ffe('0x57')]);return db[_0x1ffe('0x2c')][_0x1ffe('0x4b')](_[_0x1ffe('0x41')](_0x3aff33,_0x1c06dc[_0x1ffe('0x4c')]),{'include':_0x1c06dc[_0x1ffe('0x32')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x5aee4b){var _0x3ab5f3=_0x1c06dc[_0x1ffe('0x4d')]['get']({'plain':!![]});if(!_0x3ab5f3)throw new Error(_0x1ffe('0x4e'));if(_0x3ab5f3[_0x1ffe('0x4f')]==='user'){var _0x1b30bf=_0x5aee4b[_0x1ffe('0x54')]({'plain':!![]});var _0x37c51a='Projects';return db['UserProfileSection']['find']({'where':{'name':_0x37c51a,'userProfileId':_0x3ab5f3[_0x1ffe('0x50')]},'raw':!![]})[_0x1ffe('0x23')](function(_0x3c294d){if(_0x3c294d&&_0x3c294d[_0x1ffe('0x51')]===0x0){return db[_0x1ffe('0x25')][_0x1ffe('0x4b')]({'name':_0x1b30bf[_0x1ffe('0x28')],'resourceId':_0x1b30bf['id'],'type':_0x3c294d['name'],'sectionId':_0x3c294d['id']},{})[_0x1ffe('0x23')](function(){return _0x5aee4b;});}else{return _0x5aee4b;}})[_0x1ffe('0x48')](function(_0xf98da2){logger[_0x1ffe('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf98da2);throw _0xf98da2;});}return _0x5aee4b;});}})[_0x1ffe('0x23')](respondWithResult(_0x3ba6c3,0xc9))['catch'](handleError(_0x3ba6c3,null));};exports[_0x1ffe('0x21')]=function(_0x4b3822,_0x1e302d){if(_0x4b3822['body']['id']){delete _0x4b3822[_0x1ffe('0x4c')]['id'];}return db[_0x1ffe('0x2c')][_0x1ffe('0x53')]({'where':{'id':_0x4b3822[_0x1ffe('0x4a')]['id']}})[_0x1ffe('0x23')](handleEntityNotFound(_0x1e302d,null))[_0x1ffe('0x23')](saveUpdates(_0x4b3822[_0x1ffe('0x4c')],null))[_0x1ffe('0x23')](respondWithResult(_0x1e302d,null))[_0x1ffe('0x48')](handleError(_0x1e302d,null));};exports[_0x1ffe('0x22')]=function(_0x5a037e,_0x280daf){return db[_0x1ffe('0x2c')][_0x1ffe('0x53')]({'where':{'id':_0x5a037e[_0x1ffe('0x4a')]['id']}})[_0x1ffe('0x23')](handleEntityNotFound(_0x280daf,null))[_0x1ffe('0x23')](removeEntity(_0x280daf,null))[_0x1ffe('0x48')](handleError(_0x280daf,null));};exports['getSessions']=function(_0x2cc67e,_0x45647a,_0x3e0864){var _0x1f6823={'raw':!![],'where':{}};var _0x2ada98={};var _0x33d1c1={'count':0x0,'rows':[]};return db[_0x1ffe('0x2c')][_0x1ffe('0x58')]({'where':{'id':_0x2cc67e['params']['id']}})[_0x1ffe('0x23')](handleEntityNotFound(_0x45647a,null))[_0x1ffe('0x23')](function(_0x50c645){if(_0x50c645){_0x2ada98[_0x1ffe('0x31')]=_['keys'](db[_0x1ffe('0x59')][_0x1ffe('0x2d')]);_0x2ada98[_0x1ffe('0x32')]=_[_0x1ffe('0x33')](_0x2cc67e['query']);_0x2ada98['filters']=_[_0x1ffe('0x35')](_0x2ada98[_0x1ffe('0x31')],_0x2ada98[_0x1ffe('0x32')]);_0x1f6823[_0x1ffe('0x36')]=_[_0x1ffe('0x35')](_0x2ada98[_0x1ffe('0x31')],qs[_0x1ffe('0x37')](_0x2cc67e['query'][_0x1ffe('0x37')]));_0x1f6823[_0x1ffe('0x36')]=_0x1f6823[_0x1ffe('0x36')]['length']?_0x1f6823[_0x1ffe('0x36')]:_0x2ada98['model'];if(!_0x2cc67e[_0x1ffe('0x32')][_0x1ffe('0x39')](_0x1ffe('0x3a'))){_0x1f6823[_0x1ffe('0x3b')]=qs['limit'](_0x2cc67e[_0x1ffe('0x32')][_0x1ffe('0x3b')]);_0x1f6823['offset']=qs['offset'](_0x2cc67e[_0x1ffe('0x32')][_0x1ffe('0x1c')]);}_0x1f6823[_0x1ffe('0x3c')]=qs[_0x1ffe('0x3d')](_0x2cc67e['query'][_0x1ffe('0x3d')]);_0x1f6823[_0x1ffe('0x3e')]=qs[_0x1ffe('0x34')](_['pick'](_0x2cc67e[_0x1ffe('0x32')],_0x2ada98['filters']));_0x1f6823[_0x1ffe('0x3e')][_0x1ffe('0x5a')]=_0x50c645['id'];if(_0x2cc67e[_0x1ffe('0x32')][_0x1ffe('0x40')]){_0x1f6823['where']=_[_0x1ffe('0x41')](_0x1f6823[_0x1ffe('0x3e')],{'$or':_['map'](_0x1f6823[_0x1ffe('0x36')],function(_0x243e20){var _0x4636ea={};_0x4636ea[_0x243e20]={'$like':'%'+_0x2cc67e[_0x1ffe('0x32')]['filter']+'%'};return _0x4636ea;})});}_0x1f6823=_['merge']({},_0x1f6823,_0x2cc67e[_0x1ffe('0x43')]);return db[_0x1ffe('0x59')]['count']({'where':_0x1f6823[_0x1ffe('0x3e')]})[_0x1ffe('0x23')](function(_0x1115a0){_0x33d1c1[_0x1ffe('0x1d')]=_0x1115a0;if(_0x2cc67e[_0x1ffe('0x32')][_0x1ffe('0x44')]){_0x1f6823['include']=[{'all':!![]}];}return db[_0x1ffe('0x59')][_0x1ffe('0x46')](_0x1f6823);})[_0x1ffe('0x23')](function(_0x583968){_0x33d1c1[_0x1ffe('0x47')]=_0x583968;return _0x33d1c1;});}})[_0x1ffe('0x23')](respondWithFilteredResult(_0x45647a,_0x1f6823))['catch'](handleError(_0x45647a,null));};exports['getAnswers']=function(_0xa722ac,_0x23e0bd,_0x1b7412){var _0xe3ef20={'raw':!![],'where':{}};var _0x217a65={};var _0x24894e={'count':0x0,'rows':[]};return db[_0x1ffe('0x2c')]['findOne']({'where':{'id':_0xa722ac[_0x1ffe('0x4a')]['id']}})[_0x1ffe('0x23')](handleEntityNotFound(_0x23e0bd,null))['then'](function(_0x98856a){if(_0x98856a){_0x217a65['model']=_['keys'](db['JscriptyAnswerReport'][_0x1ffe('0x2d')]);_0x217a65[_0x1ffe('0x32')]=_['keys'](_0xa722ac[_0x1ffe('0x32')]);_0x217a65[_0x1ffe('0x34')]=_['intersection'](_0x217a65[_0x1ffe('0x31')],_0x217a65['query']);_0xe3ef20[_0x1ffe('0x36')]=_[_0x1ffe('0x35')](_0x217a65[_0x1ffe('0x31')],qs[_0x1ffe('0x37')](_0xa722ac[_0x1ffe('0x32')][_0x1ffe('0x37')]));_0xe3ef20['attributes']=_0xe3ef20[_0x1ffe('0x36')][_0x1ffe('0x38')]?_0xe3ef20[_0x1ffe('0x36')]:_0x217a65[_0x1ffe('0x31')];if(!_0xa722ac[_0x1ffe('0x32')]['hasOwnProperty'](_0x1ffe('0x3a'))){_0xe3ef20['limit']=qs[_0x1ffe('0x3b')](_0xa722ac[_0x1ffe('0x32')]['limit']);_0xe3ef20[_0x1ffe('0x1c')]=qs[_0x1ffe('0x1c')](_0xa722ac[_0x1ffe('0x32')]['offset']);}_0xe3ef20[_0x1ffe('0x3c')]=qs[_0x1ffe('0x3d')](_0xa722ac[_0x1ffe('0x32')][_0x1ffe('0x3d')]);_0xe3ef20[_0x1ffe('0x3e')]=qs['filters'](_[_0x1ffe('0x3f')](_0xa722ac[_0x1ffe('0x32')],_0x217a65['filters']));_0xe3ef20['where'][_0x1ffe('0x5a')]=_0x98856a['id'];if(_0xa722ac[_0x1ffe('0x32')][_0x1ffe('0x40')]){_0xe3ef20[_0x1ffe('0x3e')]=_['merge'](_0xe3ef20[_0x1ffe('0x3e')],{'$or':_[_0x1ffe('0x2b')](_0xe3ef20[_0x1ffe('0x36')],function(_0x592a3f){var _0x1e18a6={};_0x1e18a6[_0x592a3f]={'$like':'%'+_0xa722ac['query'][_0x1ffe('0x40')]+'%'};return _0x1e18a6;})});}_0xe3ef20=_['merge']({},_0xe3ef20,_0xa722ac['options']);return db[_0x1ffe('0x5b')][_0x1ffe('0x1d')]({'where':_0xe3ef20[_0x1ffe('0x3e')]})[_0x1ffe('0x23')](function(_0x4ea724){_0x24894e[_0x1ffe('0x1d')]=_0x4ea724;if(_0xa722ac[_0x1ffe('0x32')]['includeAll']){_0xe3ef20[_0x1ffe('0x45')]=[{'all':!![]}];}return db[_0x1ffe('0x5b')][_0x1ffe('0x46')](_0xe3ef20);})[_0x1ffe('0x23')](function(_0x15a0d6){_0x24894e[_0x1ffe('0x47')]=_0x15a0d6;return _0x24894e;});}})[_0x1ffe('0x23')](respondWithFilteredResult(_0x23e0bd,_0xe3ef20))[_0x1ffe('0x48')](handleError(_0x23e0bd,null));};function char(_0x42a8b6){return'number'===typeof _0x42a8b6?String[_0x1ffe('0x5c')][_0x1ffe('0x20')](null,arguments):_0x42a8b6;}function needsEncapsulation(_0x3fe97b){return!!_0x3fe97b&&(_0x3fe97b[_0x1ffe('0x5d')]()[_0x1ffe('0x5e')](char(0xd))>=0x0||_0x3fe97b[_0x1ffe('0x5d')]()[_0x1ffe('0x5e')](char(0xa))>=0x0||_0x3fe97b['toString']()[_0x1ffe('0x5e')](char(0x2c))>=0x0||_0x3fe97b[_0x1ffe('0x5d')]()[_0x1ffe('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x50cc12){var _0x6b357=char(0x22),_0x100d3a='\x5c'+char(0x22),_0x4009d7=_0x50cc12['toString']()[_0x1ffe('0x5f')](new RegExp(_0x6b357,'g'),_0x100d3a);return _0x6b357+_0x4009d7+_0x6b357;}exports[_0x1ffe('0x60')]=function(_0x23624c,_0x488bce,_0x20a87b){var _0x2e0f6f,_0x4454da;var _0x31f849={'where':{'ProjectId':_0x23624c[_0x1ffe('0x4a')]['id']}};if(_0x23624c['query'][_0x1ffe('0x61')]){_0x31f849[_0x1ffe('0x3e')][_0x1ffe('0x62')]=JSON[_0x1ffe('0x63')](_0x23624c[_0x1ffe('0x32')][_0x1ffe('0x61')]);}return db[_0x1ffe('0x59')][_0x1ffe('0x46')](_0x31f849)['then'](handleEntityNotFound(_0x488bce,null))[_0x1ffe('0x23')](function(_0x246538){if(_0x246538){_0x2e0f6f=_0x246538;return db['JscriptyQuestionReport'][_0x1ffe('0x46')]({'where':{'SessionId':{'$in':_['map'](_0x2e0f6f,'id')},'ProjectId':_0x23624c[_0x1ffe('0x4a')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x488bce,null))[_0x1ffe('0x23')](function(_0x4105b0){if(_0x4105b0){_0x4454da=_0x4105b0;var _0x24176d={};for(var _0x45e6a7=0x0,_0x379b64=_0x4454da[_0x1ffe('0x38')];_0x45e6a7<_0x379b64;_0x45e6a7++){if(!_0x24176d['hasOwnProperty'](_0x4454da[_0x45e6a7][_0x1ffe('0x64')])){_0x24176d[_0x4454da[_0x45e6a7][_0x1ffe('0x64')]]=needsEncapsulation(_0x4454da[_0x45e6a7][_0x1ffe('0x65')])?encapsulate(_0x4454da[_0x45e6a7][_0x1ffe('0x65')]):_0x4454da[_0x45e6a7][_0x1ffe('0x65')];}}var _0x14dff5=[],_0x5ac930={};for(var _0x21b5f2=0x0,_0x10ac74=_0x2e0f6f[_0x1ffe('0x38')];_0x21b5f2<_0x10ac74;_0x21b5f2++){_0x5ac930={'ProjectId':_0x23624c[_0x1ffe('0x4a')]['id'],'SessionId':_0x2e0f6f[_0x21b5f2]['id'],'StartTime':moment(_0x2e0f6f[_0x21b5f2][_0x1ffe('0x62')])[_0x1ffe('0x66')](_0x1ffe('0x67'))};for(var _0x27dbe2=0x0,_0x5b3d24=_0x4454da[_0x1ffe('0x38')];_0x27dbe2<_0x5b3d24;_0x27dbe2++){if(_0x4454da[_0x27dbe2][_0x1ffe('0x68')]==_0x2e0f6f[_0x21b5f2]['id']&&_0x24176d['hasOwnProperty'](_0x4454da[_0x27dbe2][_0x1ffe('0x64')])){_0x5ac930[_0x24176d[_0x4454da[_0x27dbe2]['questionId']]]=_0x4454da[_0x27dbe2]['answer'];}}for(var _0x51e330 in _0x24176d){if(!_0x5ac930[_0x1ffe('0x39')](_0x24176d[_0x51e330])){_0x5ac930[_0x24176d[_0x51e330]]=null;}}_0x14dff5['push'](_0x5ac930);}return _0x14dff5;}})[_0x1ffe('0x23')](function(_0xd02a40){if(!_['isEmpty'](_0xd02a40)){var _0x36b212=toCsv(_0xd02a40);var _0x278e13=Date['now']();fs['writeFileSync'](util[_0x1ffe('0x66')](_0x1ffe('0x69'),_0x23624c[_0x1ffe('0x4a')]['id'],_0x278e13),_0x36b212);_0x488bce['setHeader'](_0x1ffe('0x6a'),_0x1ffe('0x6b')+util[_0x1ffe('0x66')](_0x1ffe('0x6c'),_0x23624c[_0x1ffe('0x4a')]['id'],_0x278e13));_0x488bce[_0x1ffe('0x6d')](_0x1ffe('0x6e'),_0x1ffe('0x6f'));return _0x488bce[_0x1ffe('0x70')](util['format'](_0x1ffe('0x69'),_0x23624c['params']['id'],_0x278e13));}else{return _0x488bce[_0x1ffe('0x18')](0xcc);}})[_0x1ffe('0x48')](handleError(_0x488bce,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 0e073c7..e28b15a 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 _0x1e19=['../../config/logger','api','moment','../../config/environment','./jscriptyProject.attributes','exports','JscriptyProject','lodash','util'];(function(_0x11bd81,_0x11fa4c){var _0x158de0=function(_0xa93fbb){while(--_0xa93fbb){_0x11bd81['push'](_0x11bd81['shift']());}};_0x158de0(++_0x11fa4c);}(_0x1e19,0x1c9));var _0x91e1=function(_0x17eb9c,_0x2ef070){_0x17eb9c=_0x17eb9c-0x0;var _0x3301e1=_0x1e19[_0x17eb9c];return _0x3301e1;};'use strict';var _=require(_0x91e1('0x0'));var util=require(_0x91e1('0x1'));var logger=require(_0x91e1('0x2'))(_0x91e1('0x3'));var moment=require(_0x91e1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x91e1('0x5'));var attributes=require(_0x91e1('0x6'));module[_0x91e1('0x7')]=function(_0x45d13a,_0x38c2c0){return _0x45d13a['define'](_0x91e1('0x8'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56da=['../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4afd3b,_0x2bf7c0){var _0x28b32f=function(_0x1f6b07){while(--_0x1f6b07){_0x4afd3b['push'](_0x4afd3b['shift']());}};_0x28b32f(++_0x2bf7c0);}(_0x56da,0x119));var _0xa56d=function(_0x2be240,_0x1e119d){_0x2be240=_0x2be240-0x0;var _0x123543=_0x56da[_0x2be240];return _0x123543;};'use strict';var _=require(_0xa56d('0x0'));var util=require('util');var logger=require(_0xa56d('0x1'))(_0xa56d('0x2'));var moment=require('moment');var BPromise=require(_0xa56d('0x3'));var rp=require(_0xa56d('0x4'));var fs=require('fs');var path=require(_0xa56d('0x5'));var rimraf=require(_0xa56d('0x6'));var config=require(_0xa56d('0x7'));var attributes=require(_0xa56d('0x8'));module[_0xa56d('0x9')]=function(_0x14a16e,_0x4751ee){return _0x14a16e[_0xa56d('0xa')](_0xa56d('0xb'),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 f526b10..e5281ec 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 _0xa9e0=['http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0xcf24fa,_0x1f22f4){var _0x1c47ab=function(_0x146b12){while(--_0x146b12){_0xcf24fa['push'](_0xcf24fa['shift']());}};_0x1c47ab(++_0x1f22f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x461992,_0x453a30){var _0x29929e=function(_0x58cc36){while(--_0x58cc36){_0x461992['push'](_0x461992['shift']());}};_0x29929e(++_0x453a30);}(_0x70e0,0x17b));var _0x070e=function(_0xdb434,_0xdbbc54){_0xdb434=_0xdb434-0x0;var _0x1a33ea=_0x70e0[_0xdb434];return _0x1a33ea;};'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')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\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 diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 1f78e05..3f53b96 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 _0xb333=['post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x387189,_0x39c791){var _0x3ebb38=function(_0x1c3f76){while(--_0x1c3f76){_0x387189['push'](_0x387189['shift']());}};_0x3ebb38(++_0x39c791);}(_0xb333,0x101));var _0x3b33=function(_0x5270f3,_0xd15cb1){_0x5270f3=_0x5270f3-0x0;var _0x550dbd=_0xb333[_0x5270f3];return _0x550dbd;};'use strict';var multer=require(_0x3b33('0x0'));var util=require(_0x3b33('0x1'));var path=require(_0x3b33('0x2'));var timeout=require(_0x3b33('0x3'));var express=require(_0x3b33('0x4'));var router=express[_0x3b33('0x5')]();var fs_extra=require(_0x3b33('0x6'));var auth=require(_0x3b33('0x7'));var interaction=require(_0x3b33('0x8'));var config=require(_0x3b33('0x9'));var controller=require(_0x3b33('0xa'));router[_0x3b33('0xb')]('/',auth[_0x3b33('0xc')](),controller[_0x3b33('0xd')]);router[_0x3b33('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x3b33('0xb')](_0x3b33('0xe'),auth[_0x3b33('0xc')](),controller[_0x3b33('0xf')]);router[_0x3b33('0x10')]('/',auth[_0x3b33('0xc')](),controller[_0x3b33('0x11')]);router[_0x3b33('0x12')]('/:id',auth[_0x3b33('0xc')](),controller[_0x3b33('0x13')]);router[_0x3b33('0x14')]('/:id',auth[_0x3b33('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6d0b=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','get','/describe','/:id','show','put','destroy','exports','multer','path'];(function(_0xf0330b,_0x814253){var _0x538518=function(_0x9c7d43){while(--_0x9c7d43){_0xf0330b['push'](_0xf0330b['shift']());}};_0x538518(++_0x814253);}(_0x6d0b,0x11e));var _0xb6d0=function(_0x23880,_0x202b77){_0x23880=_0x23880-0x0;var _0x14a7a7=_0x6d0b[_0x23880];return _0x14a7a7;};'use strict';var multer=require(_0xb6d0('0x0'));var util=require('util');var path=require(_0xb6d0('0x1'));var timeout=require(_0xb6d0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb6d0('0x3'));var interaction=require(_0xb6d0('0x4'));var config=require(_0xb6d0('0x5'));var controller=require(_0xb6d0('0x6'));router['get']('/',auth[_0xb6d0('0x7')](),controller[_0xb6d0('0x8')]);router[_0xb6d0('0x9')](_0xb6d0('0xa'),auth[_0xb6d0('0x7')](),controller['describe']);router[_0xb6d0('0x9')](_0xb6d0('0xb'),auth['isAuthenticated'](),controller[_0xb6d0('0xc')]);router['post']('/',auth[_0xb6d0('0x7')](),controller['create']);router[_0xb6d0('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xb6d0('0x7')](),controller[_0xb6d0('0xe')]);module[_0xb6d0('0xf')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 42bb630..3aca4bf 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(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x7a54,0x106));var _0x47a5=function(_0x4eaece,_0x2a1e81){_0x4eaece=_0x4eaece-0x0;var _0x2af6e6=_0x7a54[_0x4eaece];return _0x2af6e6;};'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(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x7a54,0x106));var _0x47a5=function(_0x33a710,_0x2391f4){_0x33a710=_0x33a710-0x0;var _0x1f9fce=_0x7a54[_0x33a710];return _0x1f9fce;};'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 cbb4b27..d378182 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 _0xdf65=['rows','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','apply','reject','update','then','end','sendStatus','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','include','findAll'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdf65,0x9d));var _0x5df6=function(_0x547cb9,_0xcbb18d){_0x547cb9=_0x547cb9-0x0;var _0x11dfbb=_0xdf65[_0x547cb9];return _0x11dfbb;};'use strict';var emlformat=require(_0x5df6('0x0'));var rimraf=require(_0x5df6('0x1'));var zipdir=require(_0x5df6('0x2'));var jsonpatch=require(_0x5df6('0x3'));var rp=require(_0x5df6('0x4'));var moment=require('moment');var BPromise=require(_0x5df6('0x5'));var Mustache=require('mustache');var util=require(_0x5df6('0x6'));var path=require('path');var sox=require(_0x5df6('0x7'));var csv=require(_0x5df6('0x8'));var ejs=require(_0x5df6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5df6('0xa'));var squel=require(_0x5df6('0xb'));var crypto=require(_0x5df6('0xc'));var jsforce=require(_0x5df6('0xd'));var deskjs=require(_0x5df6('0xe'));var toCsv=require(_0x5df6('0x8'));var querystring=require(_0x5df6('0xf'));var Papa=require('papaparse');var Redis=require(_0x5df6('0x10'));var authService=require(_0x5df6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5df6('0x12'));var hardwareService=require(_0x5df6('0x13'));var logger=require(_0x5df6('0x14'))(_0x5df6('0x15'));var utils=require(_0x5df6('0x16'));var config=require(_0x5df6('0x17'));var licenseUtil=require(_0x5df6('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55bc4e,_0x1db1fb){_0x1db1fb=_0x1db1fb||0xcc;return function(_0x57d1d6){if(_0x57d1d6){return _0x55bc4e['sendStatus'](_0x1db1fb);}return _0x55bc4e[_0x5df6('0x19')](_0x1db1fb)['end']();};}function respondWithResult(_0x1840e9,_0x573ca2){_0x573ca2=_0x573ca2||0xc8;return function(_0x554f87){if(_0x554f87){return _0x1840e9[_0x5df6('0x19')](_0x573ca2)[_0x5df6('0x1a')](_0x554f87);}};}function respondWithFilteredResult(_0x3bc846,_0x5a046e){return function(_0x5b8298){if(_0x5b8298){var _0x413a61=typeof _0x5a046e[_0x5df6('0x1b')]===_0x5df6('0x1c')&&typeof _0x5a046e[_0x5df6('0x1d')]===_0x5df6('0x1c');var _0x8a280a=_0x5b8298['count'];var _0x316357=_0x413a61?0x0:_0x5a046e[_0x5df6('0x1b')];var _0x7880a9=_0x413a61?_0x5b8298[_0x5df6('0x1e')]:_0x5a046e[_0x5df6('0x1b')]+_0x5a046e[_0x5df6('0x1d')];var _0x520dee;if(_0x7880a9>=_0x8a280a){_0x7880a9=_0x8a280a;_0x520dee=0xc8;}else{_0x520dee=0xce;}_0x3bc846[_0x5df6('0x19')](_0x520dee);return _0x3bc846[_0x5df6('0x1f')]('Content-Range',_0x316357+'-'+_0x7880a9+'/'+_0x8a280a)[_0x5df6('0x1a')](_0x5b8298);}return null;};}function patchUpdates(_0x454221){return function(_0x470da3){try{jsonpatch[_0x5df6('0x20')](_0x470da3,_0x454221,!![]);}catch(_0x848c87){return BPromise[_0x5df6('0x21')](_0x848c87);}return _0x470da3['save']();};}function saveUpdates(_0x59a740,_0x452b04){return function(_0x2ac02a){if(_0x2ac02a){return _0x2ac02a[_0x5df6('0x22')](_0x59a740)[_0x5df6('0x23')](function(_0x49c5fc){return _0x49c5fc;});}return null;};}function removeEntity(_0x2be4e3,_0x2c5ef0){return function(_0x6458c8){if(_0x6458c8){return _0x6458c8['destroy']()['then'](function(){_0x2be4e3[_0x5df6('0x19')](0xcc)[_0x5df6('0x24')]();});}};}function handleEntityNotFound(_0x10ee1a,_0x427810){return function(_0x121937){if(!_0x121937){_0x10ee1a[_0x5df6('0x25')](0x194);}return _0x121937;};}function handleError(_0x33840b,_0x504570){_0x504570=_0x504570||0x1f4;return function(_0x4479b0){logger['error'](_0x4479b0['stack']);if(_0x4479b0[_0x5df6('0x26')]){delete _0x4479b0[_0x5df6('0x26')];}_0x33840b[_0x5df6('0x19')](_0x504570)[_0x5df6('0x27')](_0x4479b0);};}exports['index']=function(_0x2168b1,_0x3e777a){var _0x2375e4={},_0x18d5c0={},_0x324da8={'count':0x0,'rows':[]};var _0x3bdae6=_[_0x5df6('0x28')](db[_0x5df6('0x29')][_0x5df6('0x2a')],function(_0x1b3a99){return{'name':_0x1b3a99[_0x5df6('0x2b')],'type':_0x1b3a99[_0x5df6('0x2c')][_0x5df6('0x2d')]};});_0x18d5c0[_0x5df6('0x2e')]=_[_0x5df6('0x28')](_0x3bdae6,_0x5df6('0x26'));_0x18d5c0[_0x5df6('0x2f')]=_[_0x5df6('0x30')](_0x2168b1[_0x5df6('0x2f')]);_0x18d5c0['filters']=_[_0x5df6('0x31')](_0x18d5c0[_0x5df6('0x2e')],_0x18d5c0[_0x5df6('0x2f')]);_0x2375e4['attributes']=_['intersection'](_0x18d5c0[_0x5df6('0x2e')],qs[_0x5df6('0x32')](_0x2168b1[_0x5df6('0x2f')][_0x5df6('0x32')]));_0x2375e4[_0x5df6('0x33')]=_0x2375e4[_0x5df6('0x33')][_0x5df6('0x34')]?_0x2375e4[_0x5df6('0x33')]:_0x18d5c0[_0x5df6('0x2e')];if(!_0x2168b1['query'][_0x5df6('0x35')](_0x5df6('0x36'))){_0x2375e4['limit']=qs[_0x5df6('0x1d')](_0x2168b1[_0x5df6('0x2f')][_0x5df6('0x1d')]);_0x2375e4[_0x5df6('0x1b')]=qs[_0x5df6('0x1b')](_0x2168b1[_0x5df6('0x2f')]['offset']);}_0x2375e4[_0x5df6('0x37')]=qs['sort'](_0x2168b1[_0x5df6('0x2f')][_0x5df6('0x38')]);_0x2375e4[_0x5df6('0x39')]=qs['filters'](_['pick'](_0x2168b1['query'],_0x18d5c0[_0x5df6('0x3a')]),_0x3bdae6);if(_0x2168b1['query']['filter']){_0x2375e4['where']=_[_0x5df6('0x3b')](_0x2375e4[_0x5df6('0x39')],{'$or':_[_0x5df6('0x28')](_0x3bdae6,function(_0x2d1cd8){if(_0x2d1cd8[_0x5df6('0x2c')]!==_0x5df6('0x3c')){var _0x9e40cc={};_0x9e40cc[_0x2d1cd8['name']]={'$like':'%'+_0x2168b1[_0x5df6('0x2f')][_0x5df6('0x3d')]+'%'};return _0x9e40cc;}})});}_0x2375e4=_[_0x5df6('0x3b')]({},_0x2375e4,_0x2168b1[_0x5df6('0x3e')]);var _0x52aacf={'where':_0x2375e4[_0x5df6('0x39')]};return db[_0x5df6('0x29')][_0x5df6('0x1e')](_0x52aacf)[_0x5df6('0x23')](function(_0x3ce501){_0x324da8[_0x5df6('0x1e')]=_0x3ce501;if(_0x2168b1['query']['includeAll']){_0x2375e4[_0x5df6('0x3f')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x5df6('0x40')](_0x2375e4);})['then'](function(_0x7ab2d3){_0x324da8[_0x5df6('0x41')]=_0x7ab2d3;return _0x324da8;})[_0x5df6('0x23')](respondWithFilteredResult(_0x3e777a,_0x2375e4))[_0x5df6('0x42')](handleError(_0x3e777a,null));};exports[_0x5df6('0x43')]=function(_0x41ae17,_0x570066){var _0x419cfb={'raw':!![],'where':{'id':_0x41ae17[_0x5df6('0x44')]['id']}},_0x13c5af={};_0x13c5af[_0x5df6('0x2e')]=_['keys'](db[_0x5df6('0x29')][_0x5df6('0x2a')]);_0x13c5af[_0x5df6('0x2f')]=_[_0x5df6('0x30')](_0x41ae17[_0x5df6('0x2f')]);_0x13c5af[_0x5df6('0x3a')]=_['intersection'](_0x13c5af['model'],_0x13c5af[_0x5df6('0x2f')]);_0x419cfb['attributes']=_[_0x5df6('0x31')](_0x13c5af['model'],qs[_0x5df6('0x32')](_0x41ae17[_0x5df6('0x2f')][_0x5df6('0x32')]));_0x419cfb['attributes']=_0x419cfb[_0x5df6('0x33')]['length']?_0x419cfb[_0x5df6('0x33')]:_0x13c5af['model'];if(_0x41ae17[_0x5df6('0x2f')]['includeAll']){_0x419cfb['include']=[{'all':!![]}];}_0x419cfb=_['merge']({},_0x419cfb,_0x41ae17[_0x5df6('0x3e')]);return db[_0x5df6('0x29')]['find'](_0x419cfb)['then'](handleEntityNotFound(_0x570066,null))[_0x5df6('0x23')](respondWithResult(_0x570066,null))[_0x5df6('0x42')](handleError(_0x570066,null));};exports[_0x5df6('0x45')]=function(_0xae9cd0,_0x397f03){return db['JscriptyQuestionReport'][_0x5df6('0x45')](_0xae9cd0[_0x5df6('0x46')],{})[_0x5df6('0x23')](respondWithResult(_0x397f03,0xc9))[_0x5df6('0x42')](handleError(_0x397f03,null));};exports['update']=function(_0x110dcd,_0xcff08){if(_0x110dcd[_0x5df6('0x46')]['id']){delete _0x110dcd[_0x5df6('0x46')]['id'];}return db[_0x5df6('0x29')][_0x5df6('0x47')]({'where':{'id':_0x110dcd['params']['id']}})['then'](handleEntityNotFound(_0xcff08,null))[_0x5df6('0x23')](saveUpdates(_0x110dcd['body'],null))['then'](respondWithResult(_0xcff08,null))[_0x5df6('0x42')](handleError(_0xcff08,null));};exports[_0x5df6('0x48')]=function(_0x430c33,_0x181402){return db[_0x5df6('0x29')][_0x5df6('0x47')]({'where':{'id':_0x430c33[_0x5df6('0x44')]['id']}})['then'](handleEntityNotFound(_0x181402,null))[_0x5df6('0x23')](removeEntity(_0x181402,null))[_0x5df6('0x42')](handleError(_0x181402,null));};exports[_0x5df6('0x49')]=function(_0x1890c3,_0x708cc3){return db[_0x5df6('0x29')][_0x5df6('0x49')]()['then'](respondWithResult(_0x708cc3,null))[_0x5df6('0x42')](handleError(_0x708cc3,null));}; \ No newline at end of file +var _0x4ff3=['type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','keys','find','create','body','params','describe','eml-format','rimraf','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','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4ff3,0x1ac));var _0x34ff=function(_0x460230,_0x3d4cab){_0x460230=_0x460230-0x0;var _0x1f3bde=_0x4ff3[_0x460230];return _0x1f3bde;};'use strict';var emlformat=require(_0x34ff('0x0'));var rimraf=require(_0x34ff('0x1'));var zipdir=require(_0x34ff('0x2'));var jsonpatch=require(_0x34ff('0x3'));var rp=require(_0x34ff('0x4'));var moment=require(_0x34ff('0x5'));var BPromise=require(_0x34ff('0x6'));var Mustache=require(_0x34ff('0x7'));var util=require(_0x34ff('0x8'));var path=require('path');var sox=require(_0x34ff('0x9'));var csv=require('to-csv');var ejs=require(_0x34ff('0xa'));var fs=require('fs');var fs_extra=require(_0x34ff('0xb'));var _=require(_0x34ff('0xc'));var squel=require(_0x34ff('0xd'));var crypto=require(_0x34ff('0xe'));var jsforce=require(_0x34ff('0xf'));var deskjs=require(_0x34ff('0x10'));var toCsv=require(_0x34ff('0x11'));var querystring=require(_0x34ff('0x12'));var Papa=require(_0x34ff('0x13'));var Redis=require(_0x34ff('0x14'));var authService=require(_0x34ff('0x15'));var qs=require(_0x34ff('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x34ff('0x17'));var logger=require(_0x34ff('0x18'))(_0x34ff('0x19'));var utils=require(_0x34ff('0x1a'));var config=require(_0x34ff('0x1b'));var licenseUtil=require(_0x34ff('0x1c'));var db=require(_0x34ff('0x1d'))['db'];function respondWithStatusCode(_0x17b92d,_0x47b9a5){_0x47b9a5=_0x47b9a5||0xcc;return function(_0x109a57){if(_0x109a57){return _0x17b92d['sendStatus'](_0x47b9a5);}return _0x17b92d[_0x34ff('0x1e')](_0x47b9a5)[_0x34ff('0x1f')]();};}function respondWithResult(_0x1bfee0,_0x2c8cbe){_0x2c8cbe=_0x2c8cbe||0xc8;return function(_0x451855){if(_0x451855){return _0x1bfee0['status'](_0x2c8cbe)[_0x34ff('0x20')](_0x451855);}};}function respondWithFilteredResult(_0x35ba16,_0x4405ee){return function(_0x1dcefd){if(_0x1dcefd){var _0x1a1187=typeof _0x4405ee[_0x34ff('0x21')]===_0x34ff('0x22')&&typeof _0x4405ee[_0x34ff('0x23')]===_0x34ff('0x22');var _0x221244=_0x1dcefd[_0x34ff('0x24')];var _0x3beb61=_0x1a1187?0x0:_0x4405ee[_0x34ff('0x21')];var _0x121f10=_0x1a1187?_0x1dcefd['count']:_0x4405ee[_0x34ff('0x21')]+_0x4405ee[_0x34ff('0x23')];var _0x288134;if(_0x121f10>=_0x221244){_0x121f10=_0x221244;_0x288134=0xc8;}else{_0x288134=0xce;}_0x35ba16[_0x34ff('0x1e')](_0x288134);return _0x35ba16[_0x34ff('0x25')]('Content-Range',_0x3beb61+'-'+_0x121f10+'/'+_0x221244)[_0x34ff('0x20')](_0x1dcefd);}return null;};}function patchUpdates(_0x3cae82){return function(_0x37a7f8){try{jsonpatch['apply'](_0x37a7f8,_0x3cae82,!![]);}catch(_0x381767){return BPromise[_0x34ff('0x26')](_0x381767);}return _0x37a7f8[_0x34ff('0x27')]();};}function saveUpdates(_0x19dc60,_0x122b79){return function(_0xb0e0ab){if(_0xb0e0ab){return _0xb0e0ab[_0x34ff('0x28')](_0x19dc60)[_0x34ff('0x29')](function(_0x1e47f7){return _0x1e47f7;});}return null;};}function removeEntity(_0xacae24,_0x2ee703){return function(_0x163db8){if(_0x163db8){return _0x163db8[_0x34ff('0x2a')]()[_0x34ff('0x29')](function(){_0xacae24[_0x34ff('0x1e')](0xcc)[_0x34ff('0x1f')]();});}};}function handleEntityNotFound(_0x9bfedc,_0x1e37b3){return function(_0xbd67f){if(!_0xbd67f){_0x9bfedc['sendStatus'](0x194);}return _0xbd67f;};}function handleError(_0x9a1afd,_0x5872b4){_0x5872b4=_0x5872b4||0x1f4;return function(_0x1340fc){logger[_0x34ff('0x2b')](_0x1340fc[_0x34ff('0x2c')]);if(_0x1340fc['name']){delete _0x1340fc[_0x34ff('0x2d')];}_0x9a1afd[_0x34ff('0x1e')](_0x5872b4)[_0x34ff('0x2e')](_0x1340fc);};}exports[_0x34ff('0x2f')]=function(_0x435427,_0x58825a){var _0x4258b9={},_0x44131a={},_0x169395={'count':0x0,'rows':[]};var _0xbcfb8a=_[_0x34ff('0x30')](db[_0x34ff('0x31')][_0x34ff('0x32')],function(_0x54703e){return{'name':_0x54703e[_0x34ff('0x33')],'type':_0x54703e[_0x34ff('0x34')][_0x34ff('0x35')]};});_0x44131a[_0x34ff('0x36')]=_[_0x34ff('0x30')](_0xbcfb8a,_0x34ff('0x2d'));_0x44131a['query']=_['keys'](_0x435427[_0x34ff('0x37')]);_0x44131a[_0x34ff('0x38')]=_[_0x34ff('0x39')](_0x44131a[_0x34ff('0x36')],_0x44131a[_0x34ff('0x37')]);_0x4258b9[_0x34ff('0x3a')]=_[_0x34ff('0x39')](_0x44131a[_0x34ff('0x36')],qs['fields'](_0x435427[_0x34ff('0x37')][_0x34ff('0x3b')]));_0x4258b9['attributes']=_0x4258b9[_0x34ff('0x3a')][_0x34ff('0x3c')]?_0x4258b9[_0x34ff('0x3a')]:_0x44131a[_0x34ff('0x36')];if(!_0x435427[_0x34ff('0x37')][_0x34ff('0x3d')]('nolimit')){_0x4258b9['limit']=qs['limit'](_0x435427['query'][_0x34ff('0x23')]);_0x4258b9[_0x34ff('0x21')]=qs[_0x34ff('0x21')](_0x435427[_0x34ff('0x37')][_0x34ff('0x21')]);}_0x4258b9[_0x34ff('0x3e')]=qs[_0x34ff('0x3f')](_0x435427[_0x34ff('0x37')]['sort']);_0x4258b9[_0x34ff('0x40')]=qs[_0x34ff('0x38')](_['pick'](_0x435427[_0x34ff('0x37')],_0x44131a[_0x34ff('0x38')]),_0xbcfb8a);if(_0x435427[_0x34ff('0x37')]['filter']){_0x4258b9[_0x34ff('0x40')]=_[_0x34ff('0x41')](_0x4258b9['where'],{'$or':_[_0x34ff('0x30')](_0xbcfb8a,function(_0x19a8cb){if(_0x19a8cb[_0x34ff('0x34')]!==_0x34ff('0x42')){var _0x4a52eb={};_0x4a52eb[_0x19a8cb[_0x34ff('0x2d')]]={'$like':'%'+_0x435427[_0x34ff('0x37')][_0x34ff('0x43')]+'%'};return _0x4a52eb;}})});}_0x4258b9=_[_0x34ff('0x41')]({},_0x4258b9,_0x435427[_0x34ff('0x44')]);var _0x161bdf={'where':_0x4258b9[_0x34ff('0x40')]};return db['JscriptyQuestionReport'][_0x34ff('0x24')](_0x161bdf)[_0x34ff('0x29')](function(_0x398222){_0x169395[_0x34ff('0x24')]=_0x398222;if(_0x435427[_0x34ff('0x37')][_0x34ff('0x45')]){_0x4258b9[_0x34ff('0x46')]=[{'all':!![]}];}return db[_0x34ff('0x31')][_0x34ff('0x47')](_0x4258b9);})[_0x34ff('0x29')](function(_0x4b7cb7){_0x169395['rows']=_0x4b7cb7;return _0x169395;})[_0x34ff('0x29')](respondWithFilteredResult(_0x58825a,_0x4258b9))[_0x34ff('0x48')](handleError(_0x58825a,null));};exports[_0x34ff('0x49')]=function(_0x3ac091,_0x5d36c9){var _0x2f68ee={'raw':!![],'where':{'id':_0x3ac091['params']['id']}},_0x3a26c5={};_0x3a26c5[_0x34ff('0x36')]=_[_0x34ff('0x4a')](db[_0x34ff('0x31')][_0x34ff('0x32')]);_0x3a26c5['query']=_[_0x34ff('0x4a')](_0x3ac091[_0x34ff('0x37')]);_0x3a26c5[_0x34ff('0x38')]=_['intersection'](_0x3a26c5[_0x34ff('0x36')],_0x3a26c5[_0x34ff('0x37')]);_0x2f68ee['attributes']=_[_0x34ff('0x39')](_0x3a26c5['model'],qs['fields'](_0x3ac091[_0x34ff('0x37')][_0x34ff('0x3b')]));_0x2f68ee['attributes']=_0x2f68ee[_0x34ff('0x3a')]['length']?_0x2f68ee['attributes']:_0x3a26c5[_0x34ff('0x36')];if(_0x3ac091[_0x34ff('0x37')][_0x34ff('0x45')]){_0x2f68ee[_0x34ff('0x46')]=[{'all':!![]}];}_0x2f68ee=_[_0x34ff('0x41')]({},_0x2f68ee,_0x3ac091[_0x34ff('0x44')]);return db['JscriptyQuestionReport'][_0x34ff('0x4b')](_0x2f68ee)[_0x34ff('0x29')](handleEntityNotFound(_0x5d36c9,null))[_0x34ff('0x29')](respondWithResult(_0x5d36c9,null))[_0x34ff('0x48')](handleError(_0x5d36c9,null));};exports[_0x34ff('0x4c')]=function(_0x5e7938,_0x3136bf){return db['JscriptyQuestionReport'][_0x34ff('0x4c')](_0x5e7938[_0x34ff('0x4d')],{})[_0x34ff('0x29')](respondWithResult(_0x3136bf,0xc9))[_0x34ff('0x48')](handleError(_0x3136bf,null));};exports['update']=function(_0x2b7e33,_0x5156cb){if(_0x2b7e33['body']['id']){delete _0x2b7e33[_0x34ff('0x4d')]['id'];}return db[_0x34ff('0x31')]['find']({'where':{'id':_0x2b7e33[_0x34ff('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5156cb,null))[_0x34ff('0x29')](saveUpdates(_0x2b7e33[_0x34ff('0x4d')],null))['then'](respondWithResult(_0x5156cb,null))['catch'](handleError(_0x5156cb,null));};exports[_0x34ff('0x2a')]=function(_0x4bbcde,_0x1eae30){return db['JscriptyQuestionReport'][_0x34ff('0x4b')]({'where':{'id':_0x4bbcde[_0x34ff('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1eae30,null))[_0x34ff('0x29')](removeEntity(_0x1eae30,null))[_0x34ff('0x48')](handleError(_0x1eae30,null));};exports[_0x34ff('0x4f')]=function(_0xb59dfb,_0x5873ca){return db['JscriptyQuestionReport'][_0x34ff('0x4f')]()[_0x34ff('0x29')](respondWithResult(_0x5873ca,null))['catch'](handleError(_0x5873ca,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 7902f2f..9563052 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 _0x94b2=['exports','JscriptyQuestionReport','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x94b2,0xb6));var _0x294b=function(_0x46e89c,_0x55a03b){_0x46e89c=_0x46e89c-0x0;var _0x781ef6=_0x94b2[_0x46e89c];return _0x781ef6;};'use strict';var _=require(_0x294b('0x0'));var util=require(_0x294b('0x1'));var logger=require(_0x294b('0x2'))(_0x294b('0x3'));var moment=require(_0x294b('0x4'));var BPromise=require('bluebird');var rp=require(_0x294b('0x5'));var fs=require('fs');var path=require(_0x294b('0x6'));var rimraf=require(_0x294b('0x7'));var config=require(_0x294b('0x8'));var attributes=require(_0x294b('0x9'));module[_0x294b('0xa')]=function(_0x17e6a8,_0x1caffa){return _0x17e6a8['define'](_0x294b('0xb'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1584=['util','api','moment','bluebird','path','rimraf','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions'];(function(_0x5b6f8b,_0x443c3b){var _0x2e0972=function(_0x3e9742){while(--_0x3e9742){_0x5b6f8b['push'](_0x5b6f8b['shift']());}};_0x2e0972(++_0x443c3b);}(_0x1584,0x1ea));var _0x4158=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x1584[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var util=require(_0x4158('0x0'));var logger=require('../../config/logger')(_0x4158('0x1'));var moment=require(_0x4158('0x2'));var BPromise=require(_0x4158('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4158('0x4'));var rimraf=require(_0x4158('0x5'));var config=require('../../config/environment');var attributes=require(_0x4158('0x6'));module['exports']=function(_0x117dbf,_0x193ef9){return _0x117dbf[_0x4158('0x7')](_0x4158('0x8'),attributes,{'tableName':_0x4158('0x9'),'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 ac3ac36..37e9916 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 _0x63c0=['request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x30bd18,_0x5611d8){var _0x36a5a4=function(_0xff995e){while(--_0xff995e){_0x30bd18['push'](_0x30bd18['shift']());}};_0x36a5a4(++_0x5611d8);}(_0x63c0,0xe7));var _0x063c=function(_0x2b29ab,_0x201845){_0x2b29ab=_0x2b29ab-0x0;var _0x16e64b=_0x63c0[_0x2b29ab];return _0x16e64b;};'use strict';var _=require(_0x063c('0x0'));var util=require(_0x063c('0x1'));var moment=require('moment');var BPromise=require(_0x063c('0x2'));var rs=require(_0x063c('0x3'));var fs=require('fs');var Redis=require(_0x063c('0x4'));var db=require(_0x063c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x063c('0x6'))(_0x063c('0x7'));var config=require(_0x063c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x063c('0x9')][_0x063c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c6a21,_0x2922d5,_0x59299c){return new BPromise(function(_0x418bb0,_0x586c5b){return client[_0x063c('0xb')](_0x5c6a21,_0x59299c)['then'](function(_0x4d2e5f){logger[_0x063c('0xc')](_0x063c('0xd'),_0x2922d5,_0x063c('0xe'));logger[_0x063c('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x2922d5,_0x063c('0xe'),JSON[_0x063c('0x10')](_0x4d2e5f));if(_0x4d2e5f[_0x063c('0x11')]){if(_0x4d2e5f[_0x063c('0x11')][_0x063c('0x12')]===0x1f4){logger[_0x063c('0x11')](_0x063c('0xd'),_0x2922d5,_0x4d2e5f[_0x063c('0x11')][_0x063c('0x13')]);return _0x586c5b(_0x4d2e5f[_0x063c('0x11')][_0x063c('0x13')]);}logger[_0x063c('0x11')](_0x063c('0xd'),_0x2922d5,_0x4d2e5f['error']['message']);return _0x418bb0(_0x4d2e5f[_0x063c('0x11')][_0x063c('0x13')]);}else{logger[_0x063c('0xc')](_0x063c('0xd'),_0x2922d5,_0x063c('0xe'));_0x418bb0(_0x4d2e5f[_0x063c('0x14')]['message']);}})[_0x063c('0x15')](function(_0x20d631){logger[_0x063c('0x11')](_0x063c('0xd'),_0x2922d5,_0x20d631);_0x586c5b(_0x20d631);});});} \ No newline at end of file +var _0x20f6=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x20f6,0x11a));var _0x620f=function(_0x55a85a,_0x314647){_0x55a85a=_0x55a85a-0x0;var _0x106807=_0x20f6[_0x55a85a];return _0x106807;};'use strict';var _=require('lodash');var util=require(_0x620f('0x0'));var moment=require(_0x620f('0x1'));var BPromise=require(_0x620f('0x2'));var rs=require(_0x620f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x620f('0x4'))['db'];var utils=require(_0x620f('0x5'));var logger=require(_0x620f('0x6'))(_0x620f('0x7'));var config=require(_0x620f('0x8'));var jayson=require(_0x620f('0x9'));var client=jayson[_0x620f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3189df,_0xa8f1ea,_0x134d8c){return new BPromise(function(_0x420b4c,_0xd5c66b){return client[_0x620f('0xb')](_0x3189df,_0x134d8c)['then'](function(_0x368007){logger[_0x620f('0xc')](_0x620f('0xd'),_0xa8f1ea,_0x620f('0xe'));logger[_0x620f('0xf')](_0x620f('0x10'),_0xa8f1ea,_0x620f('0xe'),JSON['stringify'](_0x368007));if(_0x368007[_0x620f('0x11')]){if(_0x368007['error'][_0x620f('0x12')]===0x1f4){logger[_0x620f('0x11')](_0x620f('0xd'),_0xa8f1ea,_0x368007[_0x620f('0x11')][_0x620f('0x13')]);return _0xd5c66b(_0x368007[_0x620f('0x11')][_0x620f('0x13')]);}logger[_0x620f('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xa8f1ea,_0x368007['error'][_0x620f('0x13')]);return _0x420b4c(_0x368007['error']['message']);}else{logger[_0x620f('0xc')](_0x620f('0xd'),_0xa8f1ea,_0x620f('0xe'));_0x420b4c(_0x368007[_0x620f('0x14')][_0x620f('0x13')]);}})[_0x620f('0x15')](function(_0x46fc87){logger[_0x620f('0x11')](_0x620f('0xd'),_0xa8f1ea,_0x46fc87);_0xd5c66b(_0x46fc87);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index ce44f73..afa1e00 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 _0x6ab3=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','show','/:id/questions','getQuestions','post','create','put','/:id','destroy','multer','util','path'];(function(_0x4d8e65,_0x734f78){var _0x56fdd9=function(_0x3cdd0a){while(--_0x3cdd0a){_0x4d8e65['push'](_0x4d8e65['shift']());}};_0x56fdd9(++_0x734f78);}(_0x6ab3,0x189));var _0x36ab=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0x6ab3[_0x5eaa0b];return _0x28b295;};'use strict';var multer=require(_0x36ab('0x0'));var util=require(_0x36ab('0x1'));var path=require(_0x36ab('0x2'));var timeout=require(_0x36ab('0x3'));var express=require(_0x36ab('0x4'));var router=express[_0x36ab('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x36ab('0x6'));var config=require(_0x36ab('0x7'));var controller=require(_0x36ab('0x8'));router[_0x36ab('0x9')]('/',auth[_0x36ab('0xa')](),controller[_0x36ab('0xb')]);router[_0x36ab('0x9')](_0x36ab('0xc'),auth[_0x36ab('0xa')](),controller[_0x36ab('0xd')]);router[_0x36ab('0x9')]('/:id',auth[_0x36ab('0xa')](),controller[_0x36ab('0xe')]);router['get'](_0x36ab('0xf'),auth[_0x36ab('0xa')](),controller[_0x36ab('0x10')]);router[_0x36ab('0x11')]('/',auth[_0x36ab('0xa')](),controller[_0x36ab('0x12')]);router[_0x36ab('0x13')](_0x36ab('0x14'),auth[_0x36ab('0xa')](),controller['update']);router['delete'](_0x36ab('0x14'),auth[_0x36ab('0xa')](),controller[_0x36ab('0x15')]);module['exports']=router; \ No newline at end of file +var _0xd8f3=['/:id/questions','getQuestions','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./jscriptySessionReport.controller','get','index','/describe','describe','/:id','isAuthenticated'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xd8f3,0x1ac));var _0x3d8f=function(_0x123576,_0x52375e){_0x123576=_0x123576-0x0;var _0x1da63f=_0xd8f3[_0x123576];return _0x1da63f;};'use strict';var multer=require('multer');var util=require(_0x3d8f('0x0'));var path=require(_0x3d8f('0x1'));var timeout=require(_0x3d8f('0x2'));var express=require(_0x3d8f('0x3'));var router=express[_0x3d8f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3d8f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3d8f('0x6'));router[_0x3d8f('0x7')]('/',auth['isAuthenticated'](),controller[_0x3d8f('0x8')]);router[_0x3d8f('0x7')](_0x3d8f('0x9'),auth['isAuthenticated'](),controller[_0x3d8f('0xa')]);router[_0x3d8f('0x7')](_0x3d8f('0xb'),auth[_0x3d8f('0xc')](),controller['show']);router[_0x3d8f('0x7')](_0x3d8f('0xd'),auth['isAuthenticated'](),controller[_0x3d8f('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3d8f('0xf')]);router[_0x3d8f('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x3d8f('0x11')]);router[_0x3d8f('0x12')](_0x3d8f('0xb'),auth['isAuthenticated'](),controller[_0x3d8f('0x13')]);module[_0x3d8f('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index a6d8f82..3712043 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 _0xf277=['STRING','moment','sequelize','DATE','setDataValue','starttime','endtime','format'];(function(_0x251d9c,_0x580977){var _0x16ae64=function(_0x4d3b53){while(--_0x4d3b53){_0x251d9c['push'](_0x251d9c['shift']());}};_0x16ae64(++_0x580977);}(_0xf277,0x1e1));var _0x7f27=function(_0x2a217d,_0x368192){_0x2a217d=_0x2a217d-0x0;var _0x434d9f=_0xf277[_0x2a217d];return _0x434d9f;};'use strict';var moment=require(_0x7f27('0x0'));var Sequelize=require(_0x7f27('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x7f27('0x2')],'set':function(_0x56c8d3){this[_0x7f27('0x3')](_0x7f27('0x4'),_0x56c8d3);this[_0x7f27('0x3')](_0x7f27('0x5'),moment()[_0x7f27('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x7f27('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x7f27('0x7')]},'queue':{'type':Sequelize[_0x7f27('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7f27('0x7')]},'calleridnum':{'type':Sequelize[_0x7f27('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb13e=['setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','exports','DATE'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xb13e,0x1f0));var _0xeb13=function(_0x5874e5,_0x1d62df){_0x5874e5=_0x5874e5-0x0;var _0xcddd1e=_0xb13e[_0x5874e5];return _0xcddd1e;};'use strict';var moment=require(_0xeb13('0x0'));var Sequelize=require(_0xeb13('0x1'));module[_0xeb13('0x2')]={'starttime':{'type':Sequelize[_0xeb13('0x3')],'set':function(_0x196705){this[_0xeb13('0x4')](_0xeb13('0x5'),_0x196705);this['setDataValue'](_0xeb13('0x6'),moment()[_0xeb13('0x7')](_0xeb13('0x8')));}},'endtime':{'type':Sequelize[_0xeb13('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xeb13('0x9')]},'queue':{'type':Sequelize[_0xeb13('0x9')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xeb13('0x9')]},'calleridnum':{'type':Sequelize[_0xeb13('0x9')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index c74dbaa..642e422 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 _0x2a64=['to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','JscriptySessionReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','find','create','catch','body','destroy','describe','findOne','JscriptyQuestionReport','SessionId','rows','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox'];(function(_0x267da0,_0x38ef09){var _0x561cf4=function(_0x1279ee){while(--_0x1279ee){_0x267da0['push'](_0x267da0['shift']());}};_0x561cf4(++_0x38ef09);}(_0x2a64,0xee));var _0x42a6=function(_0x3e5841,_0x1573f9){_0x3e5841=_0x3e5841-0x0;var _0x555f62=_0x2a64[_0x3e5841];return _0x555f62;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x42a6('0x0'));var zipdir=require(_0x42a6('0x1'));var jsonpatch=require(_0x42a6('0x2'));var rp=require(_0x42a6('0x3'));var moment=require('moment');var BPromise=require(_0x42a6('0x4'));var Mustache=require(_0x42a6('0x5'));var util=require(_0x42a6('0x6'));var path=require('path');var sox=require(_0x42a6('0x7'));var csv=require(_0x42a6('0x8'));var ejs=require(_0x42a6('0x9'));var fs=require('fs');var fs_extra=require(_0x42a6('0xa'));var _=require(_0x42a6('0xb'));var squel=require(_0x42a6('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x42a6('0xd'));var toCsv=require(_0x42a6('0x8'));var querystring=require('querystring');var Papa=require(_0x42a6('0xe'));var Redis=require(_0x42a6('0xf'));var authService=require(_0x42a6('0x10'));var qs=require(_0x42a6('0x11'));var as=require(_0x42a6('0x12'));var hardwareService=require(_0x42a6('0x13'));var logger=require(_0x42a6('0x14'))(_0x42a6('0x15'));var utils=require(_0x42a6('0x16'));var config=require(_0x42a6('0x17'));var licenseUtil=require(_0x42a6('0x18'));var db=require(_0x42a6('0x19'))['db'];function respondWithStatusCode(_0x34f2b2,_0x971ca3){_0x971ca3=_0x971ca3||0xcc;return function(_0x4f4942){if(_0x4f4942){return _0x34f2b2[_0x42a6('0x1a')](_0x971ca3);}return _0x34f2b2[_0x42a6('0x1b')](_0x971ca3)[_0x42a6('0x1c')]();};}function respondWithResult(_0x4c83d2,_0x373921){_0x373921=_0x373921||0xc8;return function(_0x1aee6e){if(_0x1aee6e){return _0x4c83d2[_0x42a6('0x1b')](_0x373921)[_0x42a6('0x1d')](_0x1aee6e);}};}function respondWithFilteredResult(_0x26441e,_0x4ae7b1){return function(_0x41400d){if(_0x41400d){var _0x157a41=typeof _0x4ae7b1['offset']===_0x42a6('0x1e')&&typeof _0x4ae7b1[_0x42a6('0x1f')]===_0x42a6('0x1e');var _0x453658=_0x41400d[_0x42a6('0x20')];var _0xb47894=_0x157a41?0x0:_0x4ae7b1[_0x42a6('0x21')];var _0x3d26be=_0x157a41?_0x41400d[_0x42a6('0x20')]:_0x4ae7b1[_0x42a6('0x21')]+_0x4ae7b1[_0x42a6('0x1f')];var _0x1acbbb;if(_0x3d26be>=_0x453658){_0x3d26be=_0x453658;_0x1acbbb=0xc8;}else{_0x1acbbb=0xce;}_0x26441e[_0x42a6('0x1b')](_0x1acbbb);return _0x26441e[_0x42a6('0x22')](_0x42a6('0x23'),_0xb47894+'-'+_0x3d26be+'/'+_0x453658)[_0x42a6('0x1d')](_0x41400d);}return null;};}function patchUpdates(_0x3401d5){return function(_0x4e75f3){try{jsonpatch[_0x42a6('0x24')](_0x4e75f3,_0x3401d5,!![]);}catch(_0x1b4cbc){return BPromise['reject'](_0x1b4cbc);}return _0x4e75f3[_0x42a6('0x25')]();};}function saveUpdates(_0x196e48,_0x3a2002){return function(_0x325fd2){if(_0x325fd2){return _0x325fd2[_0x42a6('0x26')](_0x196e48)[_0x42a6('0x27')](function(_0x2ecb06){return _0x2ecb06;});}return null;};}function removeEntity(_0x107689,_0x401ee8){return function(_0x138568){if(_0x138568){return _0x138568['destroy']()[_0x42a6('0x27')](function(){_0x107689[_0x42a6('0x1b')](0xcc)[_0x42a6('0x1c')]();});}};}function handleEntityNotFound(_0x76eedd,_0x1d664d){return function(_0x25a69f){if(!_0x25a69f){_0x76eedd[_0x42a6('0x1a')](0x194);}return _0x25a69f;};}function handleError(_0x57ad1c,_0xeed318){_0xeed318=_0xeed318||0x1f4;return function(_0x2a325a){logger[_0x42a6('0x28')](_0x2a325a[_0x42a6('0x29')]);if(_0x2a325a[_0x42a6('0x2a')]){delete _0x2a325a[_0x42a6('0x2a')];}_0x57ad1c[_0x42a6('0x1b')](_0xeed318)[_0x42a6('0x2b')](_0x2a325a);};}exports[_0x42a6('0x2c')]=function(_0xbc8277,_0x43b131){var _0x55d719={},_0x110d27={},_0x58b4c6={'count':0x0,'rows':[]};var _0x14cf18=_[_0x42a6('0x2d')](db[_0x42a6('0x2e')]['rawAttributes'],function(_0x3b0fb3){return{'name':_0x3b0fb3[_0x42a6('0x2f')],'type':_0x3b0fb3[_0x42a6('0x30')][_0x42a6('0x31')]};});_0x110d27[_0x42a6('0x32')]=_[_0x42a6('0x2d')](_0x14cf18,'name');_0x110d27[_0x42a6('0x33')]=_[_0x42a6('0x34')](_0xbc8277['query']);_0x110d27[_0x42a6('0x35')]=_[_0x42a6('0x36')](_0x110d27['model'],_0x110d27['query']);_0x55d719[_0x42a6('0x37')]=_['intersection'](_0x110d27['model'],qs[_0x42a6('0x38')](_0xbc8277[_0x42a6('0x33')][_0x42a6('0x38')]));_0x55d719[_0x42a6('0x37')]=_0x55d719['attributes'][_0x42a6('0x39')]?_0x55d719[_0x42a6('0x37')]:_0x110d27[_0x42a6('0x32')];if(!_0xbc8277[_0x42a6('0x33')][_0x42a6('0x3a')](_0x42a6('0x3b'))){_0x55d719[_0x42a6('0x1f')]=qs[_0x42a6('0x1f')](_0xbc8277[_0x42a6('0x33')][_0x42a6('0x1f')]);_0x55d719[_0x42a6('0x21')]=qs[_0x42a6('0x21')](_0xbc8277[_0x42a6('0x33')][_0x42a6('0x21')]);}_0x55d719['order']=qs['sort'](_0xbc8277[_0x42a6('0x33')][_0x42a6('0x3c')]);_0x55d719[_0x42a6('0x3d')]=qs[_0x42a6('0x35')](_[_0x42a6('0x3e')](_0xbc8277[_0x42a6('0x33')],_0x110d27[_0x42a6('0x35')]),_0x14cf18);if(_0xbc8277['query']['filter']){_0x55d719['where']=_[_0x42a6('0x3f')](_0x55d719[_0x42a6('0x3d')],{'$or':_[_0x42a6('0x2d')](_0x14cf18,function(_0x319efd){if(_0x319efd[_0x42a6('0x30')]!==_0x42a6('0x40')){var _0x414dd3={};_0x414dd3[_0x319efd[_0x42a6('0x2a')]]={'$like':'%'+_0xbc8277['query'][_0x42a6('0x41')]+'%'};return _0x414dd3;}})});}_0x55d719=_[_0x42a6('0x3f')]({},_0x55d719,_0xbc8277[_0x42a6('0x42')]);var _0x3fba90={'where':_0x55d719['where']};return db[_0x42a6('0x2e')][_0x42a6('0x20')](_0x3fba90)[_0x42a6('0x27')](function(_0x468479){_0x58b4c6['count']=_0x468479;if(_0xbc8277['query'][_0x42a6('0x43')]){_0x55d719[_0x42a6('0x44')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x42a6('0x45')](_0x55d719);})[_0x42a6('0x27')](function(_0x317aa0){_0x58b4c6['rows']=_0x317aa0;return _0x58b4c6;})[_0x42a6('0x27')](respondWithFilteredResult(_0x43b131,_0x55d719))['catch'](handleError(_0x43b131,null));};exports[_0x42a6('0x46')]=function(_0x343038,_0x5cb8ea){var _0x44af13={'raw':!![],'where':{'id':_0x343038[_0x42a6('0x47')]['id']}},_0x284d13={};_0x284d13['model']=_['keys'](db['JscriptySessionReport']['rawAttributes']);_0x284d13[_0x42a6('0x33')]=_[_0x42a6('0x34')](_0x343038[_0x42a6('0x33')]);_0x284d13['filters']=_[_0x42a6('0x36')](_0x284d13['model'],_0x284d13[_0x42a6('0x33')]);_0x44af13[_0x42a6('0x37')]=_['intersection'](_0x284d13[_0x42a6('0x32')],qs[_0x42a6('0x38')](_0x343038[_0x42a6('0x33')]['fields']));_0x44af13[_0x42a6('0x37')]=_0x44af13['attributes'][_0x42a6('0x39')]?_0x44af13[_0x42a6('0x37')]:_0x284d13['model'];if(_0x343038[_0x42a6('0x33')][_0x42a6('0x43')]){_0x44af13[_0x42a6('0x44')]=[{'all':!![]}];}_0x44af13=_[_0x42a6('0x3f')]({},_0x44af13,_0x343038['options']);return db['JscriptySessionReport'][_0x42a6('0x48')](_0x44af13)[_0x42a6('0x27')](handleEntityNotFound(_0x5cb8ea,null))[_0x42a6('0x27')](respondWithResult(_0x5cb8ea,null))['catch'](handleError(_0x5cb8ea,null));};exports[_0x42a6('0x49')]=function(_0x3e0d89,_0x1cfe36){return db[_0x42a6('0x2e')][_0x42a6('0x49')](_0x3e0d89['body'],{})[_0x42a6('0x27')](respondWithResult(_0x1cfe36,0xc9))[_0x42a6('0x4a')](handleError(_0x1cfe36,null));};exports[_0x42a6('0x26')]=function(_0xf63ecb,_0x52d859){if(_0xf63ecb[_0x42a6('0x4b')]['id']){delete _0xf63ecb[_0x42a6('0x4b')]['id'];}return db['JscriptySessionReport']['find']({'where':{'id':_0xf63ecb[_0x42a6('0x47')]['id']}})[_0x42a6('0x27')](handleEntityNotFound(_0x52d859,null))[_0x42a6('0x27')](saveUpdates(_0xf63ecb['body'],null))['then'](respondWithResult(_0x52d859,null))[_0x42a6('0x4a')](handleError(_0x52d859,null));};exports[_0x42a6('0x4c')]=function(_0x4a60a4,_0x475863){return db['JscriptySessionReport']['find']({'where':{'id':_0x4a60a4[_0x42a6('0x47')]['id']}})[_0x42a6('0x27')](handleEntityNotFound(_0x475863,null))['then'](removeEntity(_0x475863,null))[_0x42a6('0x4a')](handleError(_0x475863,null));};exports[_0x42a6('0x4d')]=function(_0x103976,_0x51348f){return db[_0x42a6('0x2e')][_0x42a6('0x4d')]()[_0x42a6('0x27')](respondWithResult(_0x51348f,null))['catch'](handleError(_0x51348f,null));};exports['getQuestions']=function(_0xb554fd,_0xf219d6,_0xef7d69){var _0x184204={'raw':!![],'where':{}};var _0x33d602={};var _0x24b5e8={'count':0x0,'rows':[]};return db[_0x42a6('0x2e')][_0x42a6('0x4e')]({'where':{'id':_0xb554fd[_0x42a6('0x47')]['id']}})[_0x42a6('0x27')](handleEntityNotFound(_0xf219d6,null))[_0x42a6('0x27')](function(_0x307f96){if(_0x307f96){_0x33d602[_0x42a6('0x32')]=_[_0x42a6('0x34')](db[_0x42a6('0x4f')]['rawAttributes']);_0x33d602[_0x42a6('0x33')]=_[_0x42a6('0x34')](_0xb554fd[_0x42a6('0x33')]);_0x33d602[_0x42a6('0x35')]=_[_0x42a6('0x36')](_0x33d602[_0x42a6('0x32')],_0x33d602[_0x42a6('0x33')]);_0x184204[_0x42a6('0x37')]=_[_0x42a6('0x36')](_0x33d602[_0x42a6('0x32')],qs[_0x42a6('0x38')](_0xb554fd[_0x42a6('0x33')][_0x42a6('0x38')]));_0x184204[_0x42a6('0x37')]=_0x184204[_0x42a6('0x37')][_0x42a6('0x39')]?_0x184204[_0x42a6('0x37')]:_0x33d602[_0x42a6('0x32')];if(!_0xb554fd[_0x42a6('0x33')]['hasOwnProperty']('nolimit')){_0x184204[_0x42a6('0x1f')]=qs[_0x42a6('0x1f')](_0xb554fd[_0x42a6('0x33')][_0x42a6('0x1f')]);_0x184204[_0x42a6('0x21')]=qs[_0x42a6('0x21')](_0xb554fd[_0x42a6('0x33')][_0x42a6('0x21')]);}_0x184204['order']=qs[_0x42a6('0x3c')](_0xb554fd[_0x42a6('0x33')]['sort']);_0x184204['where']=qs[_0x42a6('0x35')](_[_0x42a6('0x3e')](_0xb554fd[_0x42a6('0x33')],_0x33d602['filters']));_0x184204['where'][_0x42a6('0x50')]=_0x307f96['id'];if(_0xb554fd[_0x42a6('0x33')][_0x42a6('0x41')]){_0x184204['where']=_[_0x42a6('0x3f')](_0x184204[_0x42a6('0x3d')],{'$or':_[_0x42a6('0x2d')](_0x184204[_0x42a6('0x37')],function(_0x167cce){var _0x2491f0={};_0x2491f0[_0x167cce]={'$like':'%'+_0xb554fd[_0x42a6('0x33')][_0x42a6('0x41')]+'%'};return _0x2491f0;})});}_0x184204=_[_0x42a6('0x3f')]({},_0x184204,_0xb554fd[_0x42a6('0x42')]);return db[_0x42a6('0x4f')]['count']({'where':_0x184204[_0x42a6('0x3d')]})['then'](function(_0x5e210b){_0x24b5e8[_0x42a6('0x20')]=_0x5e210b;if(_0xb554fd['query'][_0x42a6('0x43')]){_0x184204['include']=[{'all':!![]}];}return db[_0x42a6('0x4f')][_0x42a6('0x45')](_0x184204);})['then'](function(_0x2e230e){_0x24b5e8[_0x42a6('0x51')]=_0x2e230e;return _0x24b5e8;});}})[_0x42a6('0x27')](respondWithFilteredResult(_0xf219d6,_0x184204))[_0x42a6('0x4a')](handleError(_0xf219d6,null));}; \ No newline at end of file +var _0x78e0=['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','api','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','apply','update','then','sendStatus','name','send','index','map','JscriptySessionReport','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','pick','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','merge','body','find','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','SessionId','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x530c87,_0x4d5451){var _0x4f24ee=function(_0x586bb6){while(--_0x586bb6){_0x530c87['push'](_0x530c87['shift']());}};_0x4f24ee(++_0x4d5451);}(_0x78e0,0x134));var _0x078e=function(_0x254744,_0x219e6b){_0x254744=_0x254744-0x0;var _0x2a6a96=_0x78e0[_0x254744];return _0x2a6a96;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x078e('0x0'));var zipdir=require(_0x078e('0x1'));var jsonpatch=require(_0x078e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x078e('0x3'));var Mustache=require(_0x078e('0x4'));var util=require(_0x078e('0x5'));var path=require(_0x078e('0x6'));var sox=require(_0x078e('0x7'));var csv=require(_0x078e('0x8'));var ejs=require(_0x078e('0x9'));var fs=require('fs');var fs_extra=require(_0x078e('0xa'));var _=require(_0x078e('0xb'));var squel=require(_0x078e('0xc'));var crypto=require(_0x078e('0xd'));var jsforce=require(_0x078e('0xe'));var deskjs=require(_0x078e('0xf'));var toCsv=require(_0x078e('0x8'));var querystring=require(_0x078e('0x10'));var Papa=require(_0x078e('0x11'));var Redis=require(_0x078e('0x12'));var authService=require(_0x078e('0x13'));var qs=require(_0x078e('0x14'));var as=require(_0x078e('0x15'));var hardwareService=require(_0x078e('0x16'));var logger=require(_0x078e('0x17'))(_0x078e('0x18'));var utils=require('../../config/utils');var config=require(_0x078e('0x19'));var licenseUtil=require(_0x078e('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fbb5b,_0x5e1fef){_0x5e1fef=_0x5e1fef||0xcc;return function(_0x2044d3){if(_0x2044d3){return _0x1fbb5b['sendStatus'](_0x5e1fef);}return _0x1fbb5b['status'](_0x5e1fef)[_0x078e('0x1b')]();};}function respondWithResult(_0x56374c,_0x27cff1){_0x27cff1=_0x27cff1||0xc8;return function(_0x46e5f1){if(_0x46e5f1){return _0x56374c[_0x078e('0x1c')](_0x27cff1)[_0x078e('0x1d')](_0x46e5f1);}};}function respondWithFilteredResult(_0x5cc2f4,_0x296c51){return function(_0x235839){if(_0x235839){var _0x4037fc=typeof _0x296c51[_0x078e('0x1e')]===_0x078e('0x1f')&&typeof _0x296c51[_0x078e('0x20')]==='undefined';var _0x33eebc=_0x235839[_0x078e('0x21')];var _0x42e9f8=_0x4037fc?0x0:_0x296c51[_0x078e('0x1e')];var _0x1ae11d=_0x4037fc?_0x235839['count']:_0x296c51[_0x078e('0x1e')]+_0x296c51[_0x078e('0x20')];var _0x2a2153;if(_0x1ae11d>=_0x33eebc){_0x1ae11d=_0x33eebc;_0x2a2153=0xc8;}else{_0x2a2153=0xce;}_0x5cc2f4[_0x078e('0x1c')](_0x2a2153);return _0x5cc2f4[_0x078e('0x22')]('Content-Range',_0x42e9f8+'-'+_0x1ae11d+'/'+_0x33eebc)[_0x078e('0x1d')](_0x235839);}return null;};}function patchUpdates(_0x25db11){return function(_0x51e6f7){try{jsonpatch[_0x078e('0x23')](_0x51e6f7,_0x25db11,!![]);}catch(_0x2316bb){return BPromise['reject'](_0x2316bb);}return _0x51e6f7['save']();};}function saveUpdates(_0xcbb78c,_0x1214ba){return function(_0x31f200){if(_0x31f200){return _0x31f200[_0x078e('0x24')](_0xcbb78c)[_0x078e('0x25')](function(_0x27f380){return _0x27f380;});}return null;};}function removeEntity(_0x841e3a,_0x80f7b9){return function(_0x2ff85e){if(_0x2ff85e){return _0x2ff85e['destroy']()[_0x078e('0x25')](function(){_0x841e3a[_0x078e('0x1c')](0xcc)[_0x078e('0x1b')]();});}};}function handleEntityNotFound(_0x120602,_0x7fa7f8){return function(_0x47ab49){if(!_0x47ab49){_0x120602[_0x078e('0x26')](0x194);}return _0x47ab49;};}function handleError(_0x488baf,_0x4c0e71){_0x4c0e71=_0x4c0e71||0x1f4;return function(_0x2d0e23){logger['error'](_0x2d0e23['stack']);if(_0x2d0e23[_0x078e('0x27')]){delete _0x2d0e23[_0x078e('0x27')];}_0x488baf[_0x078e('0x1c')](_0x4c0e71)[_0x078e('0x28')](_0x2d0e23);};}exports[_0x078e('0x29')]=function(_0x497394,_0x1754f7){var _0x531985={},_0x39a216={},_0xfc2f0f={'count':0x0,'rows':[]};var _0x589665=_[_0x078e('0x2a')](db[_0x078e('0x2b')]['rawAttributes'],function(_0x1a0bf8){return{'name':_0x1a0bf8[_0x078e('0x2c')],'type':_0x1a0bf8['type'][_0x078e('0x2d')]};});_0x39a216[_0x078e('0x2e')]=_['map'](_0x589665,_0x078e('0x27'));_0x39a216[_0x078e('0x2f')]=_[_0x078e('0x30')](_0x497394[_0x078e('0x2f')]);_0x39a216[_0x078e('0x31')]=_[_0x078e('0x32')](_0x39a216['model'],_0x39a216['query']);_0x531985['attributes']=_[_0x078e('0x32')](_0x39a216[_0x078e('0x2e')],qs[_0x078e('0x33')](_0x497394[_0x078e('0x2f')]['fields']));_0x531985['attributes']=_0x531985[_0x078e('0x34')][_0x078e('0x35')]?_0x531985[_0x078e('0x34')]:_0x39a216[_0x078e('0x2e')];if(!_0x497394['query']['hasOwnProperty'](_0x078e('0x36'))){_0x531985['limit']=qs[_0x078e('0x20')](_0x497394[_0x078e('0x2f')][_0x078e('0x20')]);_0x531985[_0x078e('0x1e')]=qs[_0x078e('0x1e')](_0x497394[_0x078e('0x2f')][_0x078e('0x1e')]);}_0x531985['order']=qs[_0x078e('0x37')](_0x497394[_0x078e('0x2f')][_0x078e('0x37')]);_0x531985['where']=qs[_0x078e('0x31')](_[_0x078e('0x38')](_0x497394['query'],_0x39a216['filters']),_0x589665);if(_0x497394[_0x078e('0x2f')]['filter']){_0x531985[_0x078e('0x39')]=_['merge'](_0x531985['where'],{'$or':_[_0x078e('0x2a')](_0x589665,function(_0x452eb5){if(_0x452eb5['type']!==_0x078e('0x3a')){var _0x343f1a={};_0x343f1a[_0x452eb5['name']]={'$like':'%'+_0x497394[_0x078e('0x2f')][_0x078e('0x3b')]+'%'};return _0x343f1a;}})});}_0x531985=_['merge']({},_0x531985,_0x497394[_0x078e('0x3c')]);var _0x4d1c06={'where':_0x531985[_0x078e('0x39')]};return db[_0x078e('0x2b')][_0x078e('0x21')](_0x4d1c06)[_0x078e('0x25')](function(_0x595a45){_0xfc2f0f[_0x078e('0x21')]=_0x595a45;if(_0x497394[_0x078e('0x2f')][_0x078e('0x3d')]){_0x531985[_0x078e('0x3e')]=[{'all':!![]}];}return db[_0x078e('0x2b')][_0x078e('0x3f')](_0x531985);})[_0x078e('0x25')](function(_0x346735){_0xfc2f0f[_0x078e('0x40')]=_0x346735;return _0xfc2f0f;})[_0x078e('0x25')](respondWithFilteredResult(_0x1754f7,_0x531985))[_0x078e('0x41')](handleError(_0x1754f7,null));};exports['show']=function(_0x4b03b6,_0x4508cc){var _0x36f15b={'raw':!![],'where':{'id':_0x4b03b6[_0x078e('0x42')]['id']}},_0x379880={};_0x379880['model']=_[_0x078e('0x30')](db['JscriptySessionReport'][_0x078e('0x43')]);_0x379880[_0x078e('0x2f')]=_[_0x078e('0x30')](_0x4b03b6['query']);_0x379880['filters']=_[_0x078e('0x32')](_0x379880[_0x078e('0x2e')],_0x379880[_0x078e('0x2f')]);_0x36f15b[_0x078e('0x34')]=_[_0x078e('0x32')](_0x379880['model'],qs[_0x078e('0x33')](_0x4b03b6[_0x078e('0x2f')][_0x078e('0x33')]));_0x36f15b[_0x078e('0x34')]=_0x36f15b['attributes']['length']?_0x36f15b[_0x078e('0x34')]:_0x379880['model'];if(_0x4b03b6['query']['includeAll']){_0x36f15b['include']=[{'all':!![]}];}_0x36f15b=_[_0x078e('0x44')]({},_0x36f15b,_0x4b03b6[_0x078e('0x3c')]);return db[_0x078e('0x2b')]['find'](_0x36f15b)['then'](handleEntityNotFound(_0x4508cc,null))[_0x078e('0x25')](respondWithResult(_0x4508cc,null))[_0x078e('0x41')](handleError(_0x4508cc,null));};exports['create']=function(_0xc9fabb,_0x1e4cb6){return db[_0x078e('0x2b')]['create'](_0xc9fabb[_0x078e('0x45')],{})[_0x078e('0x25')](respondWithResult(_0x1e4cb6,0xc9))['catch'](handleError(_0x1e4cb6,null));};exports[_0x078e('0x24')]=function(_0x377d97,_0x2cbbbb){if(_0x377d97[_0x078e('0x45')]['id']){delete _0x377d97[_0x078e('0x45')]['id'];}return db[_0x078e('0x2b')][_0x078e('0x46')]({'where':{'id':_0x377d97[_0x078e('0x42')]['id']}})[_0x078e('0x25')](handleEntityNotFound(_0x2cbbbb,null))['then'](saveUpdates(_0x377d97[_0x078e('0x45')],null))[_0x078e('0x25')](respondWithResult(_0x2cbbbb,null))['catch'](handleError(_0x2cbbbb,null));};exports[_0x078e('0x47')]=function(_0x1156bf,_0x265839){return db[_0x078e('0x2b')]['find']({'where':{'id':_0x1156bf['params']['id']}})['then'](handleEntityNotFound(_0x265839,null))['then'](removeEntity(_0x265839,null))[_0x078e('0x41')](handleError(_0x265839,null));};exports['describe']=function(_0x38d9cc,_0x2f90b9){return db['JscriptySessionReport'][_0x078e('0x48')]()[_0x078e('0x25')](respondWithResult(_0x2f90b9,null))[_0x078e('0x41')](handleError(_0x2f90b9,null));};exports[_0x078e('0x49')]=function(_0x393fa4,_0x12fd60,_0xf0b5d2){var _0x232206={'raw':!![],'where':{}};var _0x28757e={};var _0x2e0ab1={'count':0x0,'rows':[]};return db[_0x078e('0x2b')][_0x078e('0x4a')]({'where':{'id':_0x393fa4['params']['id']}})[_0x078e('0x25')](handleEntityNotFound(_0x12fd60,null))[_0x078e('0x25')](function(_0x230c7f){if(_0x230c7f){_0x28757e[_0x078e('0x2e')]=_['keys'](db[_0x078e('0x4b')]['rawAttributes']);_0x28757e[_0x078e('0x2f')]=_[_0x078e('0x30')](_0x393fa4['query']);_0x28757e['filters']=_['intersection'](_0x28757e[_0x078e('0x2e')],_0x28757e['query']);_0x232206[_0x078e('0x34')]=_[_0x078e('0x32')](_0x28757e['model'],qs['fields'](_0x393fa4[_0x078e('0x2f')]['fields']));_0x232206[_0x078e('0x34')]=_0x232206[_0x078e('0x34')]['length']?_0x232206[_0x078e('0x34')]:_0x28757e[_0x078e('0x2e')];if(!_0x393fa4[_0x078e('0x2f')][_0x078e('0x4c')](_0x078e('0x36'))){_0x232206[_0x078e('0x20')]=qs[_0x078e('0x20')](_0x393fa4[_0x078e('0x2f')][_0x078e('0x20')]);_0x232206[_0x078e('0x1e')]=qs[_0x078e('0x1e')](_0x393fa4['query'][_0x078e('0x1e')]);}_0x232206['order']=qs[_0x078e('0x37')](_0x393fa4[_0x078e('0x2f')][_0x078e('0x37')]);_0x232206['where']=qs[_0x078e('0x31')](_['pick'](_0x393fa4[_0x078e('0x2f')],_0x28757e[_0x078e('0x31')]));_0x232206[_0x078e('0x39')][_0x078e('0x4d')]=_0x230c7f['id'];if(_0x393fa4['query'][_0x078e('0x3b')]){_0x232206[_0x078e('0x39')]=_[_0x078e('0x44')](_0x232206[_0x078e('0x39')],{'$or':_['map'](_0x232206[_0x078e('0x34')],function(_0x1265fe){var _0x2a1366={};_0x2a1366[_0x1265fe]={'$like':'%'+_0x393fa4[_0x078e('0x2f')]['filter']+'%'};return _0x2a1366;})});}_0x232206=_[_0x078e('0x44')]({},_0x232206,_0x393fa4[_0x078e('0x3c')]);return db[_0x078e('0x4b')][_0x078e('0x21')]({'where':_0x232206[_0x078e('0x39')]})[_0x078e('0x25')](function(_0x2a990f){_0x2e0ab1[_0x078e('0x21')]=_0x2a990f;if(_0x393fa4[_0x078e('0x2f')][_0x078e('0x3d')]){_0x232206[_0x078e('0x3e')]=[{'all':!![]}];}return db[_0x078e('0x4b')][_0x078e('0x3f')](_0x232206);})['then'](function(_0x2e1f59){_0x2e0ab1['rows']=_0x2e1f59;return _0x2e0ab1;});}})[_0x078e('0x25')](respondWithFilteredResult(_0x12fd60,_0x232206))[_0x078e('0x41')](handleError(_0x12fd60,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 2d57d8c..d25c1bd 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 _0xfcf0=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0xfcf0,0x138));var _0x0fcf=function(_0x43de22,_0x1eced6){_0x43de22=_0x43de22-0x0;var _0x4b15ee=_0xfcf0[_0x43de22];return _0x4b15ee;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));module[_0x0fcf('0x9')]=function(_0x1bace8,_0x1a7b03){return _0x1bace8[_0x0fcf('0xa')](_0x0fcf('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25fa=['path','./jscriptySessionReport.attributes','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x430095,_0x122722){var _0x115f8a=function(_0x5af765){while(--_0x5af765){_0x430095['push'](_0x430095['shift']());}};_0x115f8a(++_0x122722);}(_0x25fa,0x109));var _0xa25f=function(_0x3f0bf0,_0x49251c){_0x3f0bf0=_0x3f0bf0-0x0;var _0x32b3c7=_0x25fa[_0x3f0bf0];return _0x32b3c7;};'use strict';var _=require(_0xa25f('0x0'));var util=require('util');var logger=require(_0xa25f('0x1'))(_0xa25f('0x2'));var moment=require('moment');var BPromise=require(_0xa25f('0x3'));var rp=require(_0xa25f('0x4'));var fs=require('fs');var path=require(_0xa25f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa25f('0x6'));module['exports']=function(_0x2ea9ea,_0x3ab530){return _0x2ea9ea[_0xa25f('0x7')](_0xa25f('0x8'),attributes,{'tableName':_0xa25f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 7bd2c4f..21e5c4c 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 _0x6d38=['request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x521dca,_0x4059ee){var _0x445def=function(_0x1ae3fc){while(--_0x1ae3fc){_0x521dca['push'](_0x521dca['shift']());}};_0x445def(++_0x4059ee);}(_0x6d38,0x1ef));var _0x86d3=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6d38[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file +var _0xafb9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x1a148e,_0x3a5eda){var _0x45ce19=function(_0x21de84){while(--_0x21de84){_0x1a148e['push'](_0x1a148e['shift']());}};_0x45ce19(++_0x3a5eda);}(_0xafb9,0x68));var _0x9afb=function(_0x313b3c,_0x4b6b3e){_0x313b3c=_0x313b3c-0x0;var _0x12dc67=_0xafb9[_0x313b3c];return _0x12dc67;};'use strict';var _=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var moment=require(_0x9afb('0x2'));var BPromise=require(_0x9afb('0x3'));var rs=require(_0x9afb('0x4'));var fs=require('fs');var Redis=require(_0x9afb('0x5'));var db=require(_0x9afb('0x6'))['db'];var utils=require(_0x9afb('0x7'));var logger=require(_0x9afb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9afb('0x9'));var client=jayson['client'][_0x9afb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x548b24,_0x556880,_0x4c0e9d){return new BPromise(function(_0x1edf77,_0x20b8c1){return client['request'](_0x548b24,_0x4c0e9d)[_0x9afb('0xb')](function(_0x3e0264){logger[_0x9afb('0xc')](_0x9afb('0xd'),_0x556880,_0x9afb('0xe'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x556880,_0x9afb('0xe'),JSON[_0x9afb('0xf')](_0x3e0264));if(_0x3e0264[_0x9afb('0x10')]){if(_0x3e0264[_0x9afb('0x10')][_0x9afb('0x11')]===0x1f4){logger[_0x9afb('0x10')](_0x9afb('0xd'),_0x556880,_0x3e0264[_0x9afb('0x10')][_0x9afb('0x12')]);return _0x20b8c1(_0x3e0264[_0x9afb('0x10')]['message']);}logger[_0x9afb('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x556880,_0x3e0264['error'][_0x9afb('0x12')]);return _0x1edf77(_0x3e0264[_0x9afb('0x10')][_0x9afb('0x12')]);}else{logger[_0x9afb('0xc')](_0x9afb('0xd'),_0x556880,_0x9afb('0xe'));_0x1edf77(_0x3e0264[_0x9afb('0x13')]['message']);}})[_0x9afb('0x14')](function(_0x2145c2){logger[_0x9afb('0x10')](_0x9afb('0xd'),_0x556880,_0x2145c2);_0x20b8c1(_0x2145c2);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 698ccd9..6769992 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 _0x1e6c=['isAuthenticated','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./license.controller','get','index','put','/:id'];(function(_0x26548a,_0x3a829e){var _0x3341aa=function(_0xbbb9b7){while(--_0xbbb9b7){_0x26548a['push'](_0x26548a['shift']());}};_0x3341aa(++_0x3a829e);}(_0x1e6c,0x11a));var _0xc1e6=function(_0x26bcec,_0xe13f50){_0x26bcec=_0x26bcec-0x0;var _0x1049dc=_0x1e6c[_0x26bcec];return _0x1049dc;};'use strict';var multer=require(_0xc1e6('0x0'));var util=require('util');var path=require(_0xc1e6('0x1'));var timeout=require(_0xc1e6('0x2'));var express=require(_0xc1e6('0x3'));var router=express[_0xc1e6('0x4')]();var fs_extra=require(_0xc1e6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc1e6('0x6'));var controller=require(_0xc1e6('0x7'));router[_0xc1e6('0x8')]('/',controller[_0xc1e6('0x9')]);router[_0xc1e6('0xa')](_0xc1e6('0xb'),auth[_0xc1e6('0xc')](),controller['update']);module[_0xc1e6('0xd')]=router; \ No newline at end of file +var _0x528f=['Router','../../components/auth/service','./license.controller','index','put','isAuthenticated','update','exports','util','path','connect-timeout','express'];(function(_0x48c44a,_0x1ff7e2){var _0x179b34=function(_0x23ddd){while(--_0x23ddd){_0x48c44a['push'](_0x48c44a['shift']());}};_0x179b34(++_0x1ff7e2);}(_0x528f,0x140));var _0xf528=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x528f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xf528('0x0'));var path=require(_0xf528('0x1'));var timeout=require(_0xf528('0x2'));var express=require(_0xf528('0x3'));var router=express[_0xf528('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf528('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf528('0x6'));router['get']('/',controller[_0xf528('0x7')]);router[_0xf528('0x8')]('/:id',auth[_0xf528('0x9')](),controller[_0xf528('0xa')]);module[_0xf528('0xb')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 62b1dec..21d72e5 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 _0xf1e2=['exports','STRING','INTEGER'];(function(_0x3151c4,_0x590439){var _0x2842f9=function(_0x1e08d5){while(--_0x1e08d5){_0x3151c4['push'](_0x3151c4['shift']());}};_0x2842f9(++_0x590439);}(_0xf1e2,0x87));var _0x2f1e=function(_0x37f13a,_0x3c2fb2){_0x37f13a=_0x37f13a-0x0;var _0x30a74d=_0xf1e2[_0x37f13a];return _0x30a74d;};'use strict';var Sequelize=require('sequelize');module[_0x2f1e('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x2f1e('0x1')]},'data2':{'type':Sequelize[_0x2f1e('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x2f1e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4546=['STRING','INTEGER','exports','TEXT'];(function(_0x119214,_0x108f03){var _0xf0b47a=function(_0xc6457c){while(--_0xc6457c){_0x119214['push'](_0x119214['shift']());}};_0xf0b47a(++_0x108f03);}(_0x4546,0x106));var _0x6454=function(_0xdce91a,_0x47656a){_0xdce91a=_0xdce91a-0x0;var _0x4e398a=_0x4546[_0xdce91a];return _0x4e398a;};'use strict';var Sequelize=require('sequelize');module[_0x6454('0x0')]={'license':{'type':Sequelize[_0x6454('0x1')]},'data1':{'type':Sequelize[_0x6454('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x6454('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 32595c7..9204796 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 _0x2ef3=['length','options','then','catch','body','params','get','checkLicense','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','index','model','keys','rawAttributes','query','filters','intersection','attributes','fields'];(function(_0x556bc8,_0x33ef1f){var _0x40b0c4=function(_0x5346ba){while(--_0x5346ba){_0x556bc8['push'](_0x556bc8['shift']());}};_0x40b0c4(++_0x33ef1f);}(_0x2ef3,0xba));var _0x32ef=function(_0x4759c5,_0x51431e){_0x4759c5=_0x4759c5-0x0;var _0x587fc7=_0x2ef3[_0x4759c5];return _0x587fc7;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}var utilLicense=require('../../config/license/util');exports[_0x32ef('0x29')]=function(_0x2f5d06,_0x5a04cd){var _0x12de1a={'raw':!![],'where':{'id':0x1}},_0x3c569d={};_0x3c569d[_0x32ef('0x2a')]=_[_0x32ef('0x2b')](db['License'][_0x32ef('0x2c')]);_0x3c569d[_0x32ef('0x2d')]=_[_0x32ef('0x2b')](_0x2f5d06[_0x32ef('0x2d')]);_0x3c569d[_0x32ef('0x2e')]=_[_0x32ef('0x2f')](_0x3c569d[_0x32ef('0x2a')],_0x3c569d['query']);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x3c569d[_0x32ef('0x2a')],qs[_0x32ef('0x31')](_0x2f5d06['query'][_0x32ef('0x31')]));_0x12de1a[_0x32ef('0x30')]=_0x12de1a[_0x32ef('0x30')][_0x32ef('0x32')]?_0x12de1a[_0x32ef('0x30')]:_0x3c569d['model'];_0x12de1a=_['merge']({},_0x12de1a,_0x2f5d06[_0x32ef('0x33')]);return utilLicense['getLicense'](_0x12de1a)[_0x32ef('0x34')](respondWithResult(_0x5a04cd,null))[_0x32ef('0x35')](handleError(_0x5a04cd,null));};exports[_0x32ef('0x24')]=function(_0x390670,_0x389583){if(_0x390670[_0x32ef('0x36')]['id']){delete _0x390670['body']['id'];}return db['License']['find']({'where':{'id':_0x390670[_0x32ef('0x37')]['id']}})[_0x32ef('0x34')](handleEntityNotFound(_0x389583,null))[_0x32ef('0x34')](function(_0x5f2443){var _0x4fb402=_0x5f2443[_0x32ef('0x38')]({'plain':!![]});return utilLicense[_0x32ef('0x39')](_0x4fb402,_0x390670[_0x32ef('0x36')]['key']);})['then'](function(_0xcbdec8){if(!_0xcbdec8[_0x32ef('0x3a')]){return saveUpdates(_0x390670[_0x32ef('0x36')],null);}return _0xcbdec8;})[_0x32ef('0x34')](respondWithResult(_0x389583,null))[_0x32ef('0x35')](handleError(_0x389583,null));}; \ No newline at end of file +var _0x2ef3=['length','options','then','catch','body','params','get','checkLicense','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','index','model','keys','rawAttributes','query','filters','intersection','attributes','fields'];(function(_0x14b7fd,_0x3dbae7){var _0x4ee25d=function(_0x4877ae){while(--_0x4877ae){_0x14b7fd['push'](_0x14b7fd['shift']());}};_0x4ee25d(++_0x3dbae7);}(_0x2ef3,0xba));var _0x32ef=function(_0x567246,_0x4aacdd){_0x567246=_0x567246-0x0;var _0x4f04f9=_0x2ef3[_0x567246];return _0x4f04f9;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}var utilLicense=require('../../config/license/util');exports[_0x32ef('0x29')]=function(_0x2f5d06,_0x5a04cd){var _0x12de1a={'raw':!![],'where':{'id':0x1}},_0x3c569d={};_0x3c569d[_0x32ef('0x2a')]=_[_0x32ef('0x2b')](db['License'][_0x32ef('0x2c')]);_0x3c569d[_0x32ef('0x2d')]=_[_0x32ef('0x2b')](_0x2f5d06[_0x32ef('0x2d')]);_0x3c569d[_0x32ef('0x2e')]=_[_0x32ef('0x2f')](_0x3c569d[_0x32ef('0x2a')],_0x3c569d['query']);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x3c569d[_0x32ef('0x2a')],qs[_0x32ef('0x31')](_0x2f5d06['query'][_0x32ef('0x31')]));_0x12de1a[_0x32ef('0x30')]=_0x12de1a[_0x32ef('0x30')][_0x32ef('0x32')]?_0x12de1a[_0x32ef('0x30')]:_0x3c569d['model'];_0x12de1a=_['merge']({},_0x12de1a,_0x2f5d06[_0x32ef('0x33')]);return utilLicense['getLicense'](_0x12de1a)[_0x32ef('0x34')](respondWithResult(_0x5a04cd,null))[_0x32ef('0x35')](handleError(_0x5a04cd,null));};exports[_0x32ef('0x24')]=function(_0x390670,_0x389583){if(_0x390670[_0x32ef('0x36')]['id']){delete _0x390670['body']['id'];}return db['License']['find']({'where':{'id':_0x390670[_0x32ef('0x37')]['id']}})[_0x32ef('0x34')](handleEntityNotFound(_0x389583,null))[_0x32ef('0x34')](function(_0x5f2443){var _0x4fb402=_0x5f2443[_0x32ef('0x38')]({'plain':!![]});return utilLicense[_0x32ef('0x39')](_0x4fb402,_0x390670[_0x32ef('0x36')]['key']);})['then'](function(_0xcbdec8){if(!_0xcbdec8[_0x32ef('0x3a')]){return saveUpdates(_0x390670[_0x32ef('0x36')],null);}return _0xcbdec8;})[_0x32ef('0x34')](respondWithResult(_0x389583,null))[_0x32ef('0x35')](handleError(_0x389583,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 09e911a..61291ae 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 _0x521c=['rimraf','./license.attributes','exports','define','License','license','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x10eea6,_0x3df423){var _0x3f49f6=function(_0xbd6d5e){while(--_0xbd6d5e){_0x10eea6['push'](_0x10eea6['shift']());}};_0x3f49f6(++_0x3df423);}(_0x521c,0xcc));var _0xc521=function(_0x26a706,_0x5df364){_0x26a706=_0x26a706-0x0;var _0x3364be=_0x521c[_0x26a706];return _0x3364be;};'use strict';var _=require('lodash');var util=require(_0xc521('0x0'));var logger=require(_0xc521('0x1'))('api');var moment=require(_0xc521('0x2'));var BPromise=require(_0xc521('0x3'));var rp=require(_0xc521('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc521('0x5'));var config=require('../../config/environment');var attributes=require(_0xc521('0x6'));module[_0xc521('0x7')]=function(_0x15fafd,_0x272e48){return _0x15fafd[_0xc521('0x8')](_0xc521('0x9'),attributes,{'tableName':_0xc521('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29b7=['exports','define','License','license','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./license.attributes'];(function(_0x5a2d3f,_0x27b04e){var _0x5c65d8=function(_0x2d1965){while(--_0x2d1965){_0x5a2d3f['push'](_0x5a2d3f['shift']());}};_0x5c65d8(++_0x27b04e);}(_0x29b7,0x17d));var _0x729b=function(_0x843148,_0x23b142){_0x843148=_0x843148-0x0;var _0x578ece=_0x29b7[_0x843148];return _0x578ece;};'use strict';var _=require('lodash');var util=require(_0x729b('0x0'));var logger=require(_0x729b('0x1'))(_0x729b('0x2'));var moment=require(_0x729b('0x3'));var BPromise=require(_0x729b('0x4'));var rp=require(_0x729b('0x5'));var fs=require('fs');var path=require(_0x729b('0x6'));var rimraf=require(_0x729b('0x7'));var config=require('../../config/environment');var attributes=require(_0x729b('0x8'));module[_0x729b('0x9')]=function(_0x47ef25,_0x1fdba3){return _0x47ef25[_0x729b('0xa')](_0x729b('0xb'),attributes,{'tableName':_0x729b('0xc'),'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 cdb8ae7..f34edf0 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 _0xdedf=['info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x1c8caf,_0x49bd2a){var _0x1ff482=function(_0x470261){while(--_0x470261){_0x1c8caf['push'](_0x1c8caf['shift']());}};_0x1ff482(++_0x49bd2a);}(_0xdedf,0x195));var _0xfded=function(_0x4772c4,_0xf1b805){_0x4772c4=_0x4772c4-0x0;var _0x428805=_0xdedf[_0x4772c4];return _0x428805;};'use strict';var _=require(_0xfded('0x0'));var util=require(_0xfded('0x1'));var moment=require(_0xfded('0x2'));var BPromise=require(_0xfded('0x3'));var rs=require(_0xfded('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfded('0x5'))['db'];var utils=require(_0xfded('0x6'));var logger=require('../../config/logger')(_0xfded('0x7'));var config=require(_0xfded('0x8'));var jayson=require(_0xfded('0x9'));var client=jayson['client'][_0xfded('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14b316,_0x385381,_0x86a4a){return new BPromise(function(_0x47963f,_0x27fefb){return client[_0xfded('0xb')](_0x14b316,_0x86a4a)[_0xfded('0xc')](function(_0x3afc7c){logger[_0xfded('0xd')](_0xfded('0xe'),_0x385381,_0xfded('0xf'));logger[_0xfded('0x10')](_0xfded('0x11'),_0x385381,_0xfded('0xf'),JSON['stringify'](_0x3afc7c));if(_0x3afc7c['error']){if(_0x3afc7c[_0xfded('0x12')][_0xfded('0x13')]===0x1f4){logger[_0xfded('0x12')](_0xfded('0xe'),_0x385381,_0x3afc7c[_0xfded('0x12')]['message']);return _0x27fefb(_0x3afc7c['error'][_0xfded('0x14')]);}logger['error'](_0xfded('0xe'),_0x385381,_0x3afc7c[_0xfded('0x12')]['message']);return _0x47963f(_0x3afc7c[_0xfded('0x12')][_0xfded('0x14')]);}else{logger[_0xfded('0xd')](_0xfded('0xe'),_0x385381,_0xfded('0xf'));_0x47963f(_0x3afc7c['result'][_0xfded('0x14')]);}})[_0xfded('0x15')](function(_0xb4971e){logger[_0xfded('0x12')](_0xfded('0xe'),_0x385381,_0xb4971e);_0x27fefb(_0xb4971e);});});} \ No newline at end of file +var _0x69de=['http','request','info','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x14e683,_0x46aa4a){var _0xc29dfd=function(_0x43ae64){while(--_0x43ae64){_0x14e683['push'](_0x14e683['shift']());}};_0xc29dfd(++_0x46aa4a);}(_0x69de,0x6f));var _0xe69d=function(_0x196e1b,_0x55fa06){_0x196e1b=_0x196e1b-0x0;var _0x5e1f18=_0x69de[_0x196e1b];return _0x5e1f18;};'use strict';var _=require(_0xe69d('0x0'));var util=require(_0xe69d('0x1'));var moment=require('moment');var BPromise=require(_0xe69d('0x2'));var rs=require(_0xe69d('0x3'));var fs=require('fs');var Redis=require(_0xe69d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe69d('0x5'));var logger=require(_0xe69d('0x6'))(_0xe69d('0x7'));var config=require(_0xe69d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe69d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d4091,_0xad1f37,_0x1f96a1){return new BPromise(function(_0x35a796,_0x33ff04){return client[_0xe69d('0xa')](_0x3d4091,_0x1f96a1)['then'](function(_0x57b32e){logger[_0xe69d('0xb')]('License,\x20%s,\x20%s',_0xad1f37,_0xe69d('0xc'));logger['debug'](_0xe69d('0xd'),_0xad1f37,_0xe69d('0xc'),JSON[_0xe69d('0xe')](_0x57b32e));if(_0x57b32e[_0xe69d('0xf')]){if(_0x57b32e[_0xe69d('0xf')][_0xe69d('0x10')]===0x1f4){logger[_0xe69d('0xf')](_0xe69d('0x11'),_0xad1f37,_0x57b32e[_0xe69d('0xf')][_0xe69d('0x12')]);return _0x33ff04(_0x57b32e[_0xe69d('0xf')][_0xe69d('0x12')]);}logger['error']('License,\x20%s,\x20%s',_0xad1f37,_0x57b32e[_0xe69d('0xf')][_0xe69d('0x12')]);return _0x35a796(_0x57b32e[_0xe69d('0xf')][_0xe69d('0x12')]);}else{logger[_0xe69d('0xb')](_0xe69d('0x11'),_0xad1f37,_0xe69d('0xc'));_0x35a796(_0x57b32e[_0xe69d('0x13')][_0xe69d('0x12')]);}})['catch'](function(_0x46981a){logger[_0xe69d('0xf')](_0xe69d('0x11'),_0xad1f37,_0x46981a);_0x33ff04(_0x46981a);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index d076955..4558b9f 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 _0x289a=['isAuthenticated','show','/:id/dispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','index','/describe','describe','/:id'];(function(_0x514571,_0x1ca787){var _0x4c9af7=function(_0x404ed9){while(--_0x404ed9){_0x514571['push'](_0x514571['shift']());}};_0x4c9af7(++_0x1ca787);}(_0x289a,0x11e));var _0xa289=function(_0x17dcd1,_0x3b7ccb){_0x17dcd1=_0x17dcd1-0x0;var _0x12af77=_0x289a[_0x17dcd1];return _0x12af77;};'use strict';var multer=require(_0xa289('0x0'));var util=require(_0xa289('0x1'));var path=require(_0xa289('0x2'));var timeout=require('connect-timeout');var express=require(_0xa289('0x3'));var router=express[_0xa289('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa289('0x5'));var interaction=require(_0xa289('0x6'));var config=require(_0xa289('0x7'));var controller=require(_0xa289('0x8'));router[_0xa289('0x9')]('/',auth['isAuthenticated'](),controller[_0xa289('0xa')]);router[_0xa289('0x9')](_0xa289('0xb'),auth['isAuthenticated'](),controller[_0xa289('0xc')]);router[_0xa289('0x9')](_0xa289('0xd'),auth[_0xa289('0xe')](),controller[_0xa289('0xf')]);router['get'](_0xa289('0x10'),auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0xa289('0x11'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0xa289('0x12'),auth[_0xa289('0xe')](),controller[_0xa289('0x13')]);router['get'](_0xa289('0x14'),auth[_0xa289('0xe')](),controller[_0xa289('0x15')]);router[_0xa289('0x9')](_0xa289('0x16'),auth['isAuthenticated'](),controller[_0xa289('0x17')]);router['get'](_0xa289('0x18'),auth['isAuthenticated'](),controller[_0xa289('0x19')]);router[_0xa289('0x9')]('/:id/messages',auth[_0xa289('0xe')](),controller[_0xa289('0x1a')]);router['get'](_0xa289('0x1b'),auth[_0xa289('0xe')](),controller[_0xa289('0x1c')]);router[_0xa289('0x9')](_0xa289('0x1d'),auth[_0xa289('0xe')](),controller[_0xa289('0x1e')]);router['post'](_0xa289('0x10'),auth[_0xa289('0xe')](),controller['addDisposition']);router[_0xa289('0x1f')](_0xa289('0x11'),auth[_0xa289('0xe')](),controller[_0xa289('0x20')]);router['post']('/',auth[_0xa289('0xe')](),controller[_0xa289('0x21')]);router['post'](_0xa289('0x12'),auth[_0xa289('0xe')](),controller[_0xa289('0x22')]);router[_0xa289('0x1f')]('/:id/out_servers',auth[_0xa289('0xe')](),controller[_0xa289('0x23')]);router[_0xa289('0x1f')](_0xa289('0x16'),auth[_0xa289('0xe')](),controller[_0xa289('0x24')]);router[_0xa289('0x1f')](_0xa289('0x18'),auth['isAuthenticated'](),controller[_0xa289('0x25')]);router[_0xa289('0x1f')](_0xa289('0x26'),auth[_0xa289('0xe')](),controller[_0xa289('0x27')]);router[_0xa289('0x1f')](_0xa289('0x1d'),auth['isAuthenticated'](),controller[_0xa289('0x28')]);router[_0xa289('0x29')]('/:id',auth['isAuthenticated'](),controller[_0xa289('0x2a')]);router[_0xa289('0x2b')](_0xa289('0x10'),auth[_0xa289('0xe')](),controller[_0xa289('0x2c')]);router[_0xa289('0x2b')](_0xa289('0x11'),auth[_0xa289('0xe')](),controller[_0xa289('0x2d')]);router[_0xa289('0x2b')](_0xa289('0x12'),auth[_0xa289('0xe')](),controller[_0xa289('0x2e')]);router[_0xa289('0x2b')]('/:id/out_servers',auth[_0xa289('0xe')](),controller[_0xa289('0x2f')]);router[_0xa289('0x2b')]('/:id',auth[_0xa289('0xe')](),controller[_0xa289('0x30')]);router[_0xa289('0x2b')](_0xa289('0x1d'),auth[_0xa289('0xe')](),controller[_0xa289('0x31')]);module['exports']=router; \ No newline at end of file +var _0xe872=['getInteractions','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/dispositions','addAnswer','/:id/out_servers','addSmtp','addInteraction','/:id/applications','addApplications','/:id/send','send','put','update','delete','removeDispositions','removeAnswers','removeSmtp','/:id','destroy','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getSmtp','/:id/interactions'];(function(_0x34a46b,_0x54a95e){var _0x1a69a9=function(_0x334f93){while(--_0x334f93){_0x34a46b['push'](_0x34a46b['shift']());}};_0x1a69a9(++_0x54a95e);}(_0xe872,0x11b));var _0x2e87=function(_0x540980,_0x1d26a7){_0x540980=_0x540980-0x0;var _0x19cbb7=_0xe872[_0x540980];return _0x19cbb7;};'use strict';var multer=require('multer');var util=require(_0x2e87('0x0'));var path=require(_0x2e87('0x1'));var timeout=require('connect-timeout');var express=require(_0x2e87('0x2'));var router=express['Router']();var fs_extra=require(_0x2e87('0x3'));var auth=require(_0x2e87('0x4'));var interaction=require(_0x2e87('0x5'));var config=require(_0x2e87('0x6'));var controller=require('./mailAccount.controller');router[_0x2e87('0x7')]('/',auth[_0x2e87('0x8')](),controller[_0x2e87('0x9')]);router[_0x2e87('0x7')](_0x2e87('0xa'),auth['isAuthenticated'](),controller[_0x2e87('0xb')]);router[_0x2e87('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2e87('0x7')]('/:id/dispositions',auth[_0x2e87('0x8')](),controller[_0x2e87('0xc')]);router[_0x2e87('0x7')](_0x2e87('0xd'),auth['isAuthenticated'](),controller[_0x2e87('0xe')]);router[_0x2e87('0x7')](_0x2e87('0xf'),auth[_0x2e87('0x8')](),controller['getImap']);router[_0x2e87('0x7')]('/:id/out_servers',auth[_0x2e87('0x8')](),controller[_0x2e87('0x10')]);router['get'](_0x2e87('0x11'),auth[_0x2e87('0x8')](),controller[_0x2e87('0x12')]);router[_0x2e87('0x7')]('/:id/applications',auth[_0x2e87('0x8')](),controller[_0x2e87('0x13')]);router[_0x2e87('0x7')]('/:id/messages',auth[_0x2e87('0x8')](),controller[_0x2e87('0x14')]);router[_0x2e87('0x7')](_0x2e87('0x15'),auth['isAuthenticated'](),controller[_0x2e87('0x16')]);router['get'](_0x2e87('0x17'),auth[_0x2e87('0x8')](),controller[_0x2e87('0x18')]);router[_0x2e87('0x19')](_0x2e87('0x1a'),auth[_0x2e87('0x8')](),controller['addDisposition']);router[_0x2e87('0x19')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x2e87('0x1b')]);router['post']('/',auth[_0x2e87('0x8')](),controller['create']);router['post'](_0x2e87('0xf'),auth[_0x2e87('0x8')](),controller['addImap']);router[_0x2e87('0x19')](_0x2e87('0x1c'),auth[_0x2e87('0x8')](),controller[_0x2e87('0x1d')]);router[_0x2e87('0x19')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x2e87('0x1e')]);router['post'](_0x2e87('0x1f'),auth['isAuthenticated'](),controller[_0x2e87('0x20')]);router[_0x2e87('0x19')](_0x2e87('0x21'),auth[_0x2e87('0x8')](),controller[_0x2e87('0x22')]);router[_0x2e87('0x19')](_0x2e87('0x17'),auth[_0x2e87('0x8')](),controller['addAgents']);router[_0x2e87('0x23')]('/:id',auth[_0x2e87('0x8')](),controller[_0x2e87('0x24')]);router[_0x2e87('0x25')]('/:id/dispositions',auth[_0x2e87('0x8')](),controller[_0x2e87('0x26')]);router[_0x2e87('0x25')](_0x2e87('0xd'),auth['isAuthenticated'](),controller[_0x2e87('0x27')]);router['delete'](_0x2e87('0xf'),auth[_0x2e87('0x8')](),controller['removeImap']);router[_0x2e87('0x25')](_0x2e87('0x1c'),auth[_0x2e87('0x8')](),controller[_0x2e87('0x28')]);router[_0x2e87('0x25')](_0x2e87('0x29'),auth['isAuthenticated'](),controller[_0x2e87('0x2a')]);router[_0x2e87('0x25')](_0x2e87('0x17'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index c157e8f..24db40d 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 _0xbcba=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0x24ed01,_0x1ebf73){var _0x32351c=function(_0x41ec4e){while(--_0x41ec4e){_0x24ed01['push'](_0x24ed01['shift']());}};_0x32351c(++_0x1ebf73);}(_0xbcba,0x6d));var _0xabcb=function(_0x5c7a44,_0x52e3f9){_0x5c7a44=_0x5c7a44-0x0;var _0xdfa1e4=_0xbcba[_0x5c7a44];return _0xdfa1e4;};'use strict';var Sequelize=require(_0xabcb('0x0'));module[_0xabcb('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xabcb('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xabcb('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xabcb('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xabcb('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xabcb('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xabcb('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xabcb('0x5')},'fontSize':{'type':Sequelize[_0xabcb('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xabcb('0x7');}},'notificationSound':{'type':Sequelize[_0xabcb('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xabcb('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xabcb('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xabcb('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xabcb('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xabcb('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xabcb('0x9'),'set':function(_0x45174e){if(!_0x45174e)this[_0xabcb('0xa')](_0xabcb('0xb'),null);this[_0xabcb('0xa')](_0xabcb('0xc'),_0x45174e);}}}; \ No newline at end of file +var _0xff96=['sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x1c01de,_0x38ec65){var _0x2b0ad2=function(_0x1803ca){while(--_0x1803ca){_0x1c01de['push'](_0x1c01de['shift']());}};_0x2b0ad2(++_0x38ec65);}(_0xff96,0x179));var _0x6ff9=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xff96[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0x6ff9('0x0'));module[_0x6ff9('0x1')]={'description':{'type':Sequelize[_0x6ff9('0x2')]},'name':{'type':Sequelize[_0x6ff9('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x6ff9('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x6ff9('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x6ff9('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x6ff9('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x6ff9('0x4')]},'markAsUnread':{'type':Sequelize[_0x6ff9('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x6ff9('0x2')],'allowNull':![],'defaultValue':_0x6ff9('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x6ff9('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6ff9('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6ff9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6ff9('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6ff9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6ff9('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6ff9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x6ff9('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x6ff9('0x3')],'defaultValue':![],'comment':_0x6ff9('0x9'),'set':function(_0xdadc3c){if(!_0xdadc3c)this[_0x6ff9('0xa')](_0x6ff9('0xb'),null);this[_0x6ff9('0xa')](_0x6ff9('0xc'),_0xdadc3c);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 5e12a87..0517d84 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 _0x7427=['authentication','host','port','service','cservice','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','sequelize','transaction','ISOLATION_LEVELS','MailApplication','findAndCountAll','priority','stack','finally','json','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','root','server/files/attachments','secure','List\x20not\x20found','defaults','messageId','subject','attach','out','Interaction','verifySmtp','auth','Sequelize','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','jayson/promise','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','sendStatus','status','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','fields','include','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','hasOwnProperty','removeDispositions','ids','getAnswers','findOne','CannedAnswer','removeAnswers','email','ListId','isNil','active','description','cauthentication','user','cuser','password','pass','cpassword'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x7427,0x111));var _0x7742=function(_0x1bbc08,_0x444008){_0x1bbc08=_0x1bbc08-0x0;var _0x5d825b=_0x7427[_0x1bbc08];return _0x5d825b;};'use strict';var emlformat=require(_0x7742('0x0'));var rimraf=require(_0x7742('0x1'));var zipdir=require(_0x7742('0x2'));var jsonpatch=require(_0x7742('0x3'));var rp=require('request-promise');var moment=require(_0x7742('0x4'));var BPromise=require(_0x7742('0x5'));var Mustache=require('mustache');var util=require(_0x7742('0x6'));var path=require(_0x7742('0x7'));var sox=require(_0x7742('0x8'));var csv=require(_0x7742('0x9'));var ejs=require(_0x7742('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7742('0xb'));var crypto=require(_0x7742('0xc'));var jsforce=require(_0x7742('0xd'));var deskjs=require(_0x7742('0xe'));var toCsv=require(_0x7742('0x9'));var querystring=require(_0x7742('0xf'));var Papa=require(_0x7742('0x10'));var htmlToText=require(_0x7742('0x11'));var juice=require('juice');var Redis=require('ioredis');var authService=require(_0x7742('0x12'));var qs=require(_0x7742('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7742('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x7742('0x15'));var config=require(_0x7742('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7742('0x17'))['db'];config[_0x7742('0x18')]=_['defaults'](config['redis'],{'host':_0x7742('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailAccount.socket')['register'](socket);var jayson=require(_0x7742('0x1a'));var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x687ee6,_0x5422f7,_0x27b0c4,_0x2c8989){return new BPromise(function(_0x1f3ffc,_0x3584dd){var _0x315d9d=_0x2c8989||client;return _0x315d9d[_0x7742('0x1b')](_0x687ee6,_0x27b0c4)['then'](function(_0x180201){logger[_0x7742('0x1c')](_0x7742('0x1d'),_0x5422f7,_0x7742('0x1e'));logger['debug'](_0x7742('0x1f'),_0x5422f7,'request\x20sent',JSON['stringify'](_0x180201));if(_0x180201['error']){if(_0x180201['error'][_0x7742('0x20')]===0x1f4){logger[_0x7742('0x21')](_0x7742('0x1d'),_0x5422f7,_0x180201[_0x7742('0x21')][_0x7742('0x22')]);return _0x3584dd(_0x180201['error']['message']);}logger[_0x7742('0x21')](_0x7742('0x1d'),_0x5422f7,_0x180201[_0x7742('0x21')][_0x7742('0x22')]);return _0x1f3ffc(_0x180201['error'][_0x7742('0x22')]);}else{logger[_0x7742('0x1c')](_0x7742('0x1d'),_0x5422f7,_0x7742('0x1e'));_0x1f3ffc(_0x180201[_0x7742('0x23')][_0x7742('0x22')]);}})['catch'](function(_0x3e7e71){logger[_0x7742('0x21')](_0x7742('0x1d'),_0x5422f7,_0x3e7e71);_0x3584dd(_0x3e7e71);});});}function respondWithStatusCode(_0x35f890,_0x1e6647){_0x1e6647=_0x1e6647||0xcc;return function(_0x3ec1b0){if(_0x3ec1b0){return _0x35f890[_0x7742('0x24')](_0x1e6647);}return _0x35f890[_0x7742('0x25')](_0x1e6647)['end']();};}function respondWithResult(_0x5410a8,_0x239997){_0x239997=_0x239997||0xc8;return function(_0x3650f4){if(_0x3650f4){return _0x5410a8[_0x7742('0x25')](_0x239997)['json'](_0x3650f4);}};}function respondWithFilteredResult(_0x3ee80d,_0x4ccad8){return function(_0x4e07fc){if(_0x4e07fc){var _0x58716d=typeof _0x4ccad8['offset']===_0x7742('0x26')&&typeof _0x4ccad8[_0x7742('0x27')]===_0x7742('0x26');var _0x47396a=_0x4e07fc[_0x7742('0x28')];var _0xd60376=_0x58716d?0x0:_0x4ccad8[_0x7742('0x29')];var _0x98a003=_0x58716d?_0x4e07fc[_0x7742('0x28')]:_0x4ccad8[_0x7742('0x29')]+_0x4ccad8['limit'];var _0x1bd9c0;if(_0x98a003>=_0x47396a){_0x98a003=_0x47396a;_0x1bd9c0=0xc8;}else{_0x1bd9c0=0xce;}_0x3ee80d[_0x7742('0x25')](_0x1bd9c0);return _0x3ee80d['set'](_0x7742('0x2a'),_0xd60376+'-'+_0x98a003+'/'+_0x47396a)['json'](_0x4e07fc);}return null;};}function patchUpdates(_0x494ba9){return function(_0x135095){try{jsonpatch[_0x7742('0x2b')](_0x135095,_0x494ba9,!![]);}catch(_0x34d575){return BPromise[_0x7742('0x2c')](_0x34d575);}return _0x135095[_0x7742('0x2d')]();};}function saveUpdates(_0x34204e,_0x1722df){return function(_0x357327){if(_0x357327){return _0x357327[_0x7742('0x2e')](_0x34204e)['then'](function(_0x325702){return _0x325702;});}return null;};}function removeEntity(_0x25d96f,_0x20a63d){return function(_0x3e3d00){if(_0x3e3d00){return _0x3e3d00[_0x7742('0x2f')]()[_0x7742('0x30')](function(){var _0x23c81b=_0x3e3d00[_0x7742('0x31')]({'plain':!![]});var _0x4f5a61='MailAccounts';return db[_0x7742('0x32')][_0x7742('0x2f')]({'where':{'type':_0x4f5a61,'resourceId':_0x23c81b['id']}})[_0x7742('0x30')](function(){return _0x3e3d00;});})[_0x7742('0x30')](function(){_0x25d96f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26d5b1,_0x96bc41){return function(_0xe3164f){if(!_0xe3164f){_0x26d5b1['sendStatus'](0x194);}return _0xe3164f;};}function handleError(_0x10ad29,_0x422456){_0x422456=_0x422456||0x1f4;return function(_0x13698f){logger[_0x7742('0x21')](_0x13698f['stack']);if(_0x13698f[_0x7742('0x33')]){delete _0x13698f[_0x7742('0x33')];}_0x10ad29['status'](_0x422456)[_0x7742('0x34')](_0x13698f);};}exports[_0x7742('0x35')]=function(_0x131da8,_0x1a1e8f){var _0x5511c9={'include':[{'model':db[_0x7742('0x36')],'as':_0x7742('0x37')},{'model':db[_0x7742('0x38')],'as':_0x7742('0x39')},{'model':db[_0x7742('0x3a')],'as':_0x7742('0x3b')}]},_0x5e23d2={},_0x5dbe31={'count':0x0,'rows':[]};var _0x30b118=_[_0x7742('0x3c')](db[_0x7742('0x3d')][_0x7742('0x3e')],function(_0xcb7729){return{'name':_0xcb7729[_0x7742('0x3f')],'type':_0xcb7729[_0x7742('0x40')][_0x7742('0x41')]};});_0x5e23d2[_0x7742('0x42')]=_[_0x7742('0x3c')](_0x30b118,_0x7742('0x33'));_0x5e23d2[_0x7742('0x43')]=_[_0x7742('0x44')](_0x131da8['query']);_0x5e23d2[_0x7742('0x45')]=_[_0x7742('0x46')](_0x5e23d2[_0x7742('0x42')],_0x5e23d2[_0x7742('0x43')]);_0x5511c9[_0x7742('0x47')]=_[_0x7742('0x46')](_0x5e23d2[_0x7742('0x42')],qs['fields'](_0x131da8[_0x7742('0x43')]['fields']));_0x5511c9[_0x7742('0x47')]=_0x5511c9['attributes'][_0x7742('0x48')]?_0x5511c9[_0x7742('0x47')]:_0x5e23d2['model'];if(!_0x131da8['query']['hasOwnProperty'](_0x7742('0x49'))){_0x5511c9[_0x7742('0x27')]=qs[_0x7742('0x27')](_0x131da8[_0x7742('0x43')]['limit']);_0x5511c9['offset']=qs['offset'](_0x131da8[_0x7742('0x43')][_0x7742('0x29')]);}_0x5511c9[_0x7742('0x4a')]=qs['sort'](_0x131da8[_0x7742('0x43')][_0x7742('0x4b')]);_0x5511c9[_0x7742('0x4c')]=qs[_0x7742('0x45')](_[_0x7742('0x4d')](_0x131da8[_0x7742('0x43')],_0x5e23d2[_0x7742('0x45')]),_0x30b118);if(_0x131da8[_0x7742('0x43')][_0x7742('0x4e')]){_0x5511c9[_0x7742('0x4c')]=_[_0x7742('0x4f')](_0x5511c9[_0x7742('0x4c')],{'$or':_[_0x7742('0x3c')](_0x30b118,function(_0x432ee3){if(_0x432ee3[_0x7742('0x40')]!=='VIRTUAL'){var _0x25d294={};_0x25d294[_0x432ee3[_0x7742('0x33')]]={'$like':'%'+_0x131da8[_0x7742('0x43')][_0x7742('0x4e')]+'%'};return _0x25d294;}})});}_0x5511c9=_[_0x7742('0x4f')]({},_0x5511c9,_0x131da8[_0x7742('0x50')]);var _0x1b204b={'where':_0x5511c9[_0x7742('0x4c')]};return db['MailAccount']['count'](_0x1b204b)[_0x7742('0x30')](function(_0x32e350){_0x5dbe31[_0x7742('0x28')]=_0x32e350;if(_0x131da8['query'][_0x7742('0x51')]){_0x5511c9['include']=[{'all':!![]}];}return db[_0x7742('0x3d')][_0x7742('0x52')](_0x5511c9);})[_0x7742('0x30')](function(_0x56489c){_0x5dbe31[_0x7742('0x53')]=_0x56489c;return _0x5dbe31;})[_0x7742('0x30')](respondWithFilteredResult(_0x1a1e8f,_0x5511c9))[_0x7742('0x54')](handleError(_0x1a1e8f,null));};exports[_0x7742('0x55')]=function(_0x35090f,_0x20ebd3){var _0x533ed9={'raw':![],'where':{'id':_0x35090f[_0x7742('0x56')]['id']},'include':[{'model':db[_0x7742('0x36')],'as':_0x7742('0x37')},{'model':db[_0x7742('0x38')],'as':_0x7742('0x39')},{'model':db[_0x7742('0x3a')],'as':_0x7742('0x3b')}]},_0x5b81db={};_0x5b81db[_0x7742('0x42')]=_['keys'](db['MailAccount'][_0x7742('0x3e')]);_0x5b81db[_0x7742('0x43')]=_[_0x7742('0x44')](_0x35090f[_0x7742('0x43')]);_0x5b81db['filters']=_[_0x7742('0x46')](_0x5b81db[_0x7742('0x42')],_0x5b81db['query']);_0x533ed9['attributes']=_[_0x7742('0x46')](_0x5b81db[_0x7742('0x42')],qs['fields'](_0x35090f[_0x7742('0x43')][_0x7742('0x57')]));_0x533ed9[_0x7742('0x47')]=_0x533ed9[_0x7742('0x47')]['length']?_0x533ed9['attributes']:_0x5b81db[_0x7742('0x42')];if(_0x35090f['query'][_0x7742('0x51')]){_0x533ed9[_0x7742('0x58')]=[{'all':!![]}];}_0x533ed9=_[_0x7742('0x4f')]({},_0x533ed9,_0x35090f[_0x7742('0x50')]);return db[_0x7742('0x3d')][_0x7742('0x59')](_0x533ed9)[_0x7742('0x30')](handleEntityNotFound(_0x20ebd3,null))['then'](respondWithResult(_0x20ebd3,null))[_0x7742('0x54')](handleError(_0x20ebd3,null));};exports['update']=function(_0x97dc94,_0x3a478b){if(_0x97dc94[_0x7742('0x5a')]['id']){delete _0x97dc94[_0x7742('0x5a')]['id'];}return db[_0x7742('0x3d')][_0x7742('0x59')]({'where':{'id':_0x97dc94['params']['id']},'include':[{'model':db[_0x7742('0x36')],'as':'Imap'},{'model':db[_0x7742('0x38')],'as':_0x7742('0x39')},{'model':db[_0x7742('0x3a')],'as':'mandatoryDispositionPause'}]})[_0x7742('0x30')](handleEntityNotFound(_0x3a478b,null))[_0x7742('0x30')](saveUpdates(_0x97dc94['body'],null))[_0x7742('0x30')](function(_0x147c06){if(_0x147c06&&_0x97dc94[_0x7742('0x5a')][_0x7742('0x37')]){return db[_0x7742('0x36')][_0x7742('0x2e')](_0x97dc94[_0x7742('0x5a')][_0x7742('0x37')],{'where':{'MailAccountId':_0x147c06['id']}})[_0x7742('0x30')](function(){return _0x147c06;});}return _0x147c06;})[_0x7742('0x30')](function(_0x20f608){if(_0x20f608&&_0x97dc94[_0x7742('0x5a')]['Smtp']){return db[_0x7742('0x38')][_0x7742('0x2e')](_0x97dc94[_0x7742('0x5a')][_0x7742('0x39')],{'where':{'MailAccountId':_0x20f608['id']}})['then'](function(){return _0x20f608;});}return _0x20f608;})[_0x7742('0x30')](respondWithResult(_0x3a478b,null))[_0x7742('0x54')](handleError(_0x3a478b,null));};exports[_0x7742('0x5b')]=function(_0x41d9bf,_0x2ba27b){return db['MailAccount'][_0x7742('0x5b')]()['then'](respondWithResult(_0x2ba27b,null))['catch'](handleError(_0x2ba27b,null));};exports[_0x7742('0x5c')]=function(_0x45e922,_0x2a49af,_0x1f8bc3){if(_0x45e922['body']['id']){delete _0x45e922[_0x7742('0x5a')]['id'];}return db[_0x7742('0x3d')]['find']({'where':{'id':_0x45e922['params']['id']}})[_0x7742('0x30')](handleEntityNotFound(_0x2a49af,null))[_0x7742('0x30')](function(_0x30c11f){if(_0x30c11f){_0x45e922['body'][_0x7742('0x5d')]=_0x30c11f['id'];return db[_0x7742('0x5e')][_0x7742('0x5f')](_0x45e922[_0x7742('0x5a')]);}})[_0x7742('0x30')](respondWithResult(_0x2a49af,null))[_0x7742('0x54')](handleError(_0x2a49af,null));};exports[_0x7742('0x60')]=function(_0x69dd79,_0x106d73,_0x278b44){var _0x23cc8e={'raw':![],'where':{}};var _0xf27cab={};var _0x4cbb49={'count':0x0,'rows':[]};return db[_0x7742('0x3d')]['findOne']({'where':{'id':_0x69dd79['params']['id']}})['then'](handleEntityNotFound(_0x106d73,null))[_0x7742('0x30')](function(_0x124ea4){if(_0x124ea4){_0xf27cab[_0x7742('0x42')]=_[_0x7742('0x44')](db[_0x7742('0x5e')][_0x7742('0x3e')]);_0xf27cab[_0x7742('0x43')]=_[_0x7742('0x44')](_0x69dd79[_0x7742('0x43')]);_0xf27cab[_0x7742('0x45')]=_['intersection'](_0xf27cab[_0x7742('0x42')],_0xf27cab[_0x7742('0x43')]);_0x23cc8e['attributes']=_[_0x7742('0x46')](_0xf27cab[_0x7742('0x42')],qs['fields'](_0x69dd79['query'][_0x7742('0x57')]));_0x23cc8e[_0x7742('0x47')]=_0x23cc8e[_0x7742('0x47')]['length']?_0x23cc8e[_0x7742('0x47')]:_0xf27cab[_0x7742('0x42')];if(!_0x69dd79[_0x7742('0x43')][_0x7742('0x61')]('nolimit')){_0x23cc8e[_0x7742('0x27')]=qs[_0x7742('0x27')](_0x69dd79[_0x7742('0x43')][_0x7742('0x27')]);_0x23cc8e['offset']=qs[_0x7742('0x29')](_0x69dd79[_0x7742('0x43')][_0x7742('0x29')]);}_0x23cc8e[_0x7742('0x4a')]=qs[_0x7742('0x4b')](_0x69dd79[_0x7742('0x43')][_0x7742('0x4b')]);_0x23cc8e[_0x7742('0x4c')]=qs[_0x7742('0x45')](_[_0x7742('0x4d')](_0x69dd79[_0x7742('0x43')],_0xf27cab[_0x7742('0x45')]));_0x23cc8e[_0x7742('0x4c')][_0x7742('0x5d')]=_0x124ea4['id'];if(_0x69dd79[_0x7742('0x43')][_0x7742('0x4e')]){_0x23cc8e[_0x7742('0x4c')]=_[_0x7742('0x4f')](_0x23cc8e[_0x7742('0x4c')],{'$or':_[_0x7742('0x3c')](_0x23cc8e[_0x7742('0x47')],function(_0x4dd81d){var _0x12a9d1={};_0x12a9d1[_0x4dd81d]={'$like':'%'+_0x69dd79[_0x7742('0x43')][_0x7742('0x4e')]+'%'};return _0x12a9d1;})});}_0x23cc8e=_['merge']({},_0x23cc8e,_0x69dd79[_0x7742('0x50')]);return db[_0x7742('0x5e')][_0x7742('0x28')]({'where':_0x23cc8e['where']})[_0x7742('0x30')](function(_0x5883b8){_0x4cbb49['count']=_0x5883b8;if(_0x69dd79['query'][_0x7742('0x51')]){_0x23cc8e[_0x7742('0x58')]=[{'all':!![]}];}return db[_0x7742('0x5e')][_0x7742('0x52')](_0x23cc8e);})[_0x7742('0x30')](function(_0x340bdc){_0x4cbb49[_0x7742('0x53')]=_0x340bdc;return _0x4cbb49;});}})['then'](respondWithFilteredResult(_0x106d73,_0x23cc8e))[_0x7742('0x54')](handleError(_0x106d73,null));};exports[_0x7742('0x62')]=function(_0x27a24e,_0x217268,_0x73a22f){return db[_0x7742('0x3d')][_0x7742('0x59')]({'where':{'id':_0x27a24e['params']['id']}})[_0x7742('0x30')](handleEntityNotFound(_0x217268,null))['then'](function(_0x3cf8ad){if(_0x3cf8ad){return _0x3cf8ad[_0x7742('0x62')](_0x27a24e[_0x7742('0x43')][_0x7742('0x63')]);}})[_0x7742('0x30')](respondWithStatusCode(_0x217268,null))[_0x7742('0x54')](handleError(_0x217268,null));};exports['addAnswer']=function(_0x570c4e,_0x227057,_0x19f357){if(_0x570c4e[_0x7742('0x5a')]['id']){delete _0x570c4e[_0x7742('0x5a')]['id'];}return db[_0x7742('0x3d')][_0x7742('0x59')]({'where':{'id':_0x570c4e[_0x7742('0x56')]['id']}})[_0x7742('0x30')](handleEntityNotFound(_0x227057,null))['then'](function(_0x25dc08){if(_0x25dc08){_0x570c4e[_0x7742('0x5a')][_0x7742('0x5d')]=_0x25dc08['id'];return db['CannedAnswer'][_0x7742('0x5f')](_0x570c4e[_0x7742('0x5a')]);}})[_0x7742('0x30')](respondWithResult(_0x227057,null))[_0x7742('0x54')](handleError(_0x227057,null));};exports[_0x7742('0x64')]=function(_0x763e07,_0x3b7418,_0x4cdaeb){var _0x979773={'raw':![],'where':{}};var _0x48c2aa={};var _0x412bfc={'count':0x0,'rows':[]};return db[_0x7742('0x3d')][_0x7742('0x65')]({'where':{'id':_0x763e07[_0x7742('0x56')]['id']}})[_0x7742('0x30')](handleEntityNotFound(_0x3b7418,null))[_0x7742('0x30')](function(_0x4d2f16){if(_0x4d2f16){_0x48c2aa[_0x7742('0x42')]=_[_0x7742('0x44')](db['CannedAnswer'][_0x7742('0x3e')]);_0x48c2aa[_0x7742('0x43')]=_['keys'](_0x763e07[_0x7742('0x43')]);_0x48c2aa['filters']=_[_0x7742('0x46')](_0x48c2aa[_0x7742('0x42')],_0x48c2aa['query']);_0x979773[_0x7742('0x47')]=_[_0x7742('0x46')](_0x48c2aa[_0x7742('0x42')],qs[_0x7742('0x57')](_0x763e07[_0x7742('0x43')][_0x7742('0x57')]));_0x979773[_0x7742('0x47')]=_0x979773[_0x7742('0x47')][_0x7742('0x48')]?_0x979773[_0x7742('0x47')]:_0x48c2aa[_0x7742('0x42')];if(!_0x763e07['query'][_0x7742('0x61')]('nolimit')){_0x979773[_0x7742('0x27')]=qs[_0x7742('0x27')](_0x763e07[_0x7742('0x43')][_0x7742('0x27')]);_0x979773['offset']=qs[_0x7742('0x29')](_0x763e07[_0x7742('0x43')][_0x7742('0x29')]);}_0x979773[_0x7742('0x4a')]=qs[_0x7742('0x4b')](_0x763e07['query'][_0x7742('0x4b')]);_0x979773[_0x7742('0x4c')]=qs[_0x7742('0x45')](_['pick'](_0x763e07[_0x7742('0x43')],_0x48c2aa[_0x7742('0x45')]));_0x979773[_0x7742('0x4c')][_0x7742('0x5d')]=_0x4d2f16['id'];if(_0x763e07[_0x7742('0x43')][_0x7742('0x4e')]){_0x979773['where']=_[_0x7742('0x4f')](_0x979773[_0x7742('0x4c')],{'$or':_[_0x7742('0x3c')](_0x979773[_0x7742('0x47')],function(_0x557a96){var _0x2883c3={};_0x2883c3[_0x557a96]={'$like':'%'+_0x763e07[_0x7742('0x43')][_0x7742('0x4e')]+'%'};return _0x2883c3;})});}_0x979773=_[_0x7742('0x4f')]({},_0x979773,_0x763e07['options']);return db['CannedAnswer'][_0x7742('0x28')]({'where':_0x979773[_0x7742('0x4c')]})[_0x7742('0x30')](function(_0x1da192){_0x412bfc[_0x7742('0x28')]=_0x1da192;if(_0x763e07[_0x7742('0x43')][_0x7742('0x51')]){_0x979773[_0x7742('0x58')]=[{'all':!![]}];}return db[_0x7742('0x66')][_0x7742('0x52')](_0x979773);})[_0x7742('0x30')](function(_0x5d31c2){_0x412bfc[_0x7742('0x53')]=_0x5d31c2;return _0x412bfc;});}})[_0x7742('0x30')](respondWithFilteredResult(_0x3b7418,_0x979773))['catch'](handleError(_0x3b7418,null));};exports[_0x7742('0x67')]=function(_0x19b18c,_0x2d1b3c,_0x211315){return db['MailAccount']['find']({'where':{'id':_0x19b18c['params']['id']}})[_0x7742('0x30')](handleEntityNotFound(_0x2d1b3c,null))[_0x7742('0x30')](function(_0x5d653e){if(_0x5d653e){return _0x5d653e['removeAnswers'](_0x19b18c[_0x7742('0x43')]['ids']);}})[_0x7742('0x30')](respondWithStatusCode(_0x2d1b3c,null))[_0x7742('0x54')](handleError(_0x2d1b3c,null));};exports[_0x7742('0x5f')]=function(_0x512a4b,_0x616a0b){var _0x44cd06={'name':_0x512a4b[_0x7742('0x5a')]['name'],'key':_0x512a4b[_0x7742('0x5a')][_0x7742('0x41')],'email':_0x512a4b[_0x7742('0x5a')][_0x7742('0x68')],'ListId':_0x512a4b['body'][_0x7742('0x69')],'active':!_[_0x7742('0x6a')](_0x512a4b[_0x7742('0x5a')]['active'])?_0x512a4b[_0x7742('0x5a')][_0x7742('0x6b')]:!![],'description':_0x512a4b['body'][_0x7742('0x6c')]||null,'Imap':{},'Smtp':{}};if(_[_0x7742('0x6a')](_0x512a4b['body']['cservice'])){if(_0x512a4b['body'][_0x7742('0x6d')]){_0x44cd06[_0x7742('0x37')][_0x7742('0x6e')]=_0x44cd06[_0x7742('0x39')][_0x7742('0x6e')]=_0x512a4b['body'][_0x7742('0x6f')];_0x44cd06[_0x7742('0x37')][_0x7742('0x70')]=_0x44cd06['Smtp'][_0x7742('0x71')]=_0x512a4b[_0x7742('0x5a')][_0x7742('0x72')];}else{_0x44cd06[_0x7742('0x37')][_0x7742('0x73')]=_0x44cd06[_0x7742('0x39')][_0x7742('0x73')]=![];}_0x44cd06[_0x7742('0x37')]['host']=_0x512a4b['body'][_0x7742('0x37')][_0x7742('0x74')];_0x44cd06[_0x7742('0x37')][_0x7742('0x75')]=_0x512a4b[_0x7742('0x5a')][_0x7742('0x37')][_0x7742('0x75')];_0x44cd06[_0x7742('0x39')]['host']=_0x512a4b[_0x7742('0x5a')]['Smtp'][_0x7742('0x74')];_0x44cd06[_0x7742('0x39')]['port']=_0x512a4b[_0x7742('0x5a')][_0x7742('0x39')][_0x7742('0x75')];}else{_0x44cd06[_0x7742('0x37')][_0x7742('0x76')]=_0x44cd06[_0x7742('0x39')][_0x7742('0x76')]=_0x512a4b[_0x7742('0x5a')][_0x7742('0x77')];_0x44cd06[_0x7742('0x37')][_0x7742('0x6e')]=_0x44cd06[_0x7742('0x39')][_0x7742('0x6e')]=_0x512a4b[_0x7742('0x5a')]['cuser'];_0x44cd06[_0x7742('0x37')][_0x7742('0x70')]=_0x44cd06[_0x7742('0x39')][_0x7742('0x71')]=_0x512a4b[_0x7742('0x5a')][_0x7742('0x72')];}return db['MailAccount'][_0x7742('0x5f')](_0x44cd06,{'include':[{'model':db[_0x7742('0x38')],'as':_0x7742('0x39')},{'model':db['MailServerIn'],'as':_0x7742('0x37')}]})[_0x7742('0x30')](function(_0x3855f6){var _0x567951=_0x512a4b[_0x7742('0x6e')][_0x7742('0x31')]({'plain':!![]});if(!_0x567951)throw new Error(_0x7742('0x78'));if(_0x567951[_0x7742('0x79')]===_0x7742('0x6e')){var _0x30f783=_0x3855f6[_0x7742('0x31')]({'plain':!![]});return db[_0x7742('0x7a')][_0x7742('0x59')]({'where':{'name':_0x7742('0x7b'),'userProfileId':_0x567951[_0x7742('0x7c')]},'raw':!![]})[_0x7742('0x30')](function(_0x258e6f){if(_0x258e6f&&_0x258e6f[_0x7742('0x7d')]===0x0){return db[_0x7742('0x32')]['create']({'name':_0x30f783[_0x7742('0x33')],'resourceId':_0x30f783['id'],'type':_0x258e6f['name'],'sectionId':_0x258e6f['id']},{})[_0x7742('0x30')](function(){return _0x3855f6;});}else{return _0x3855f6;}})[_0x7742('0x54')](function(_0xa1f2ff){logger[_0x7742('0x21')](_0x7742('0x7e'),_0xa1f2ff);throw _0xa1f2ff;});}return _0x3855f6;})[_0x7742('0x30')](respondWithResult(_0x616a0b,0xc9))['catch'](handleError(_0x616a0b,null));};exports['getImap']=function(_0x4507df,_0x445425,_0x53a393){return db[_0x7742('0x3d')]['findOne']({'where':{'id':_0x4507df['params']['id']}})[_0x7742('0x30')](handleEntityNotFound(_0x445425,null))[_0x7742('0x30')](function(_0xd8d7df){if(_0xd8d7df){return _0xd8d7df[_0x7742('0x7f')]();}return null;})[_0x7742('0x30')](respondWithResult(_0x445425,null))['catch'](handleError(_0x445425,null));};exports[_0x7742('0x80')]=function(_0x252105,_0x54878e,_0x56f7c7){if(_0x252105[_0x7742('0x5a')]['id']){delete _0x252105['body']['id'];}return db[_0x7742('0x3d')]['find']({'where':{'id':_0x252105[_0x7742('0x56')]['id']}})['then'](handleEntityNotFound(_0x54878e,null))['then'](function(_0x3f6250){if(_0x3f6250){_0x252105[_0x7742('0x5a')][_0x7742('0x5d')]=_0x3f6250['id'];return db[_0x7742('0x36')]['create'](_0x252105[_0x7742('0x5a')]);}})[_0x7742('0x30')](respondWithResult(_0x54878e,null))['catch'](handleError(_0x54878e,null));};exports['removeImap']=function(_0x428e8f,_0x2112fd,_0x4fcbf8){return db['MailAccount'][_0x7742('0x65')]({'where':{'id':_0x428e8f[_0x7742('0x56')]['id']}})[_0x7742('0x30')](handleEntityNotFound(_0x2112fd,null))[_0x7742('0x30')](function(_0x4b914a){if(_0x4b914a){return _0x4b914a[_0x7742('0x81')](null);}return null;})[_0x7742('0x30')](respondWithStatusCode(_0x2112fd,null))['catch'](handleError(_0x2112fd,null));};exports['getSmtp']=function(_0x438bba,_0x8afc6c,_0xf2d277){return db[_0x7742('0x3d')][_0x7742('0x65')]({'where':{'id':_0x438bba[_0x7742('0x56')]['id']}})[_0x7742('0x30')](handleEntityNotFound(_0x8afc6c,null))['then'](function(_0x5e9acb){if(_0x5e9acb){return _0x5e9acb[_0x7742('0x82')]();}return null;})[_0x7742('0x30')](respondWithResult(_0x8afc6c,null))['catch'](handleError(_0x8afc6c,null));};exports[_0x7742('0x83')]=function(_0x79be81,_0x182178,_0x4ccc2f){if(_0x79be81[_0x7742('0x5a')]['id']){delete _0x79be81[_0x7742('0x5a')]['id'];}return db[_0x7742('0x3d')][_0x7742('0x59')]({'where':{'id':_0x79be81[_0x7742('0x56')]['id']}})[_0x7742('0x30')](handleEntityNotFound(_0x182178,null))[_0x7742('0x30')](function(_0xef5014){if(_0xef5014){_0x79be81[_0x7742('0x5a')][_0x7742('0x5d')]=_0xef5014['id'];return db[_0x7742('0x38')][_0x7742('0x5f')](_0x79be81[_0x7742('0x5a')]);}})[_0x7742('0x30')](respondWithResult(_0x182178,null))[_0x7742('0x54')](handleError(_0x182178,null));};exports[_0x7742('0x84')]=function(_0x258304,_0x1c4416,_0x5b859c){return db['MailAccount'][_0x7742('0x65')]({'where':{'id':_0x258304[_0x7742('0x56')]['id']}})[_0x7742('0x30')](handleEntityNotFound(_0x1c4416,null))['then'](function(_0x4406e1){if(_0x4406e1){return _0x4406e1[_0x7742('0x85')](null);}return null;})[_0x7742('0x30')](respondWithStatusCode(_0x1c4416,null))[_0x7742('0x54')](handleError(_0x1c4416,null));};exports[_0x7742('0x86')]=function(_0x2152fe,_0x3934d9,_0x40e34c){return db[_0x7742('0x87')][_0x7742('0x59')]({'where':{'id':_0x2152fe[_0x7742('0x56')]['id']}})[_0x7742('0x30')](handleEntityNotFound(_0x3934d9,null))[_0x7742('0x30')](function(_0x4564f7){if(_0x4564f7){return _0x4564f7[_0x7742('0x86')](_0x2152fe['body']['ids'],_[_0x7742('0x88')](_0x2152fe[_0x7742('0x5a')],[_0x7742('0x63'),'id'])||{});}})[_0x7742('0x30')](respondWithResult(_0x3934d9,null))[_0x7742('0x54')](handleError(_0x3934d9,null));};exports[_0x7742('0x89')]=function(_0xda205b,_0x52845d,_0x582d16){var _0x208de3={'raw':![],'where':{}};var _0x1088ef={};var _0x4a31ab={'count':0x0,'rows':[]};return db[_0x7742('0x3d')][_0x7742('0x65')]({'where':{'id':_0xda205b[_0x7742('0x56')]['id']}})['then'](handleEntityNotFound(_0x52845d,null))[_0x7742('0x30')](function(_0x4edc34){if(_0x4edc34){_0x1088ef[_0x7742('0x42')]=_['keys'](db[_0x7742('0x87')][_0x7742('0x3e')]);_0x1088ef[_0x7742('0x43')]=_[_0x7742('0x44')](_0xda205b[_0x7742('0x43')]);_0x1088ef[_0x7742('0x45')]=_[_0x7742('0x46')](_0x1088ef[_0x7742('0x42')],_0x1088ef['query']);_0x208de3[_0x7742('0x47')]=_['intersection'](_0x1088ef[_0x7742('0x42')],qs[_0x7742('0x57')](_0xda205b[_0x7742('0x43')]['fields']));_0x208de3[_0x7742('0x47')]=_0x208de3[_0x7742('0x47')]['length']?_0x208de3[_0x7742('0x47')]:_0x1088ef[_0x7742('0x42')];if(!_0xda205b[_0x7742('0x43')][_0x7742('0x61')](_0x7742('0x49'))){_0x208de3[_0x7742('0x27')]=qs[_0x7742('0x27')](_0xda205b[_0x7742('0x43')][_0x7742('0x27')]);_0x208de3[_0x7742('0x29')]=qs[_0x7742('0x29')](_0xda205b[_0x7742('0x43')][_0x7742('0x29')]);}_0x208de3[_0x7742('0x4a')]=qs[_0x7742('0x4b')](_0xda205b[_0x7742('0x43')][_0x7742('0x4b')]);_0x208de3['where']=qs[_0x7742('0x45')](_['pick'](_0xda205b[_0x7742('0x43')],_0x1088ef[_0x7742('0x45')]));_0x208de3['where'][_0x7742('0x5d')]=_0x4edc34['id'];if(_0xda205b[_0x7742('0x43')][_0x7742('0x4e')]){_0x208de3[_0x7742('0x4c')]=_[_0x7742('0x4f')](_0x208de3[_0x7742('0x4c')],{'$or':_[_0x7742('0x3c')](_0x208de3[_0x7742('0x47')],function(_0x2b8107){var _0x1e4c26={};_0x1e4c26[_0x2b8107]={'$like':'%'+_0xda205b[_0x7742('0x43')][_0x7742('0x4e')]+'%'};return _0x1e4c26;})});}_0x208de3=_[_0x7742('0x4f')]({},_0x208de3,_0xda205b[_0x7742('0x50')]);return db[_0x7742('0x87')][_0x7742('0x28')]({'where':_0x208de3[_0x7742('0x4c')]})[_0x7742('0x30')](function(_0x5a90cb){_0x4a31ab[_0x7742('0x28')]=_0x5a90cb;if(_0xda205b[_0x7742('0x43')][_0x7742('0x51')]){_0x208de3[_0x7742('0x58')]=[{'model':db[_0x7742('0x8a')],'as':_0x7742('0x8b'),'required':![]},{'model':db[_0x7742('0x8c')],'as':_0x7742('0x8d'),'attributes':[_0x7742('0x33'),_0x7742('0x8e'),_0x7742('0x8f')],'required':![]},{'model':db[_0x7742('0x90')],'as':_0x7742('0x91'),'attributes':['id',_0x7742('0x33'),'color'],'where':_0xda205b['query'][_0x7742('0x92')]?{'id':_0xda205b[_0x7742('0x43')][_0x7742('0x92')]}:undefined,'required':_0xda205b[_0x7742('0x43')][_0x7742('0x92')]?!![]:![]}];}return db['MailInteraction'][_0x7742('0x52')](_0x208de3);})[_0x7742('0x30')](function(_0x2d2b52){_0x4a31ab[_0x7742('0x53')]=_0x2d2b52;return _0x4a31ab;});}})[_0x7742('0x30')](respondWithFilteredResult(_0x52845d,_0x208de3))[_0x7742('0x54')](handleError(_0x52845d,null));};exports['addApplications']=function addApplications(_0x3f9799,_0x25ddb8){var _0x396626=_0x3f9799['params']['id'];var _0x460bc4=_0x3f9799[_0x7742('0x5a')];var _0x4a2e7b=0xc8;var _0x321a25=null;return db[_0x7742('0x93')][_0x7742('0x94')]({'isolationLevel':db[_0x7742('0x93')]['Transaction'][_0x7742('0x95')]['READ_COMMITTED']},function(_0x2e4e35){return db[_0x7742('0x3d')]['findOne']({'where':{'id':_0x396626},'transaction':_0x2e4e35})[_0x7742('0x30')](function(_0x1045d1){if(_0x1045d1){return db['MailApplication'][_0x7742('0x2f')]({'where':{'MailAccountId':_0x396626},'transaction':_0x2e4e35})[_0x7742('0x30')](function(){var _0x1151eb=_[_0x7742('0x3c')](_0x460bc4,function(_0x148b0b){_0x148b0b['MailAccountId']=_0x396626;return _0x148b0b;});return db[_0x7742('0x96')]['bulkCreate'](_0x1151eb,{'transaction':_0x2e4e35});});}else{_0x4a2e7b=0x194;_0x321a25=[];}});})['then'](function(){if(_0x4a2e7b!==0x194){return db[_0x7742('0x96')][_0x7742('0x97')]({'where':{'MailAccountId':_0x396626},'order':_0x7742('0x98')})[_0x7742('0x30')](function(_0x48664f){_0x321a25=_0x48664f;});}})['catch'](function(_0x6f45b){_0x4a2e7b=0x1f4;logger['error'](_0x6f45b[_0x7742('0x99')]);if(_0x6f45b[_0x7742('0x33')]){delete _0x6f45b[_0x7742('0x33')];}_0x321a25=_0x6f45b;})[_0x7742('0x9a')](function(){if(_0x321a25===null){_0x25ddb8['sendStatus'](_0x4a2e7b);}else{if(_0x4a2e7b===0x1f4){_0x25ddb8[_0x7742('0x25')](_0x4a2e7b)[_0x7742('0x34')](_0x321a25);}else{_0x25ddb8[_0x7742('0x25')](_0x4a2e7b)[_0x7742('0x9b')](_0x321a25);}}});};exports[_0x7742('0x9c')]=function(_0x5b5424,_0x301686,_0x7be9d0){var _0x5c657e={};var _0x576a9f={};var _0x119c17;var _0x12d239;return db[_0x7742('0x3d')][_0x7742('0x65')]({'where':{'id':_0x5b5424[_0x7742('0x56')]['id']}})['then'](handleEntityNotFound(_0x301686,null))['then'](function(_0x42ac6e){if(_0x42ac6e){_0x119c17=_0x42ac6e;_0x576a9f[_0x7742('0x42')]=_['keys'](db[_0x7742('0x96')][_0x7742('0x3e')]);_0x576a9f[_0x7742('0x43')]=_['keys'](_0x5b5424[_0x7742('0x43')]);_0x576a9f['filters']=_[_0x7742('0x46')](_0x576a9f[_0x7742('0x42')],_0x576a9f[_0x7742('0x43')]);_0x5c657e[_0x7742('0x47')]=_[_0x7742('0x46')](_0x576a9f[_0x7742('0x42')],qs['fields'](_0x5b5424[_0x7742('0x43')][_0x7742('0x57')]));_0x5c657e[_0x7742('0x47')]=_0x5c657e[_0x7742('0x47')][_0x7742('0x48')]?_0x5c657e[_0x7742('0x47')]:_0x576a9f[_0x7742('0x42')];_0x5c657e[_0x7742('0x4a')]=qs[_0x7742('0x4b')](_0x5b5424['query']['sort']);_0x5c657e[_0x7742('0x4c')]=qs['filters'](_['pick'](_0x5b5424[_0x7742('0x43')],_0x576a9f[_0x7742('0x45')]));if(_0x5b5424[_0x7742('0x43')][_0x7742('0x4e')]){_0x5c657e[_0x7742('0x4c')]=_['merge'](_0x5c657e[_0x7742('0x4c')],{'$or':_[_0x7742('0x3c')](_0x5c657e[_0x7742('0x47')],function(_0x37493f){var _0x3967e2={};_0x3967e2[_0x37493f]={'$like':'%'+_0x5b5424[_0x7742('0x43')][_0x7742('0x4e')]+'%'};return _0x3967e2;})});}_0x5c657e=_['merge']({},_0x5c657e,_0x5b5424[_0x7742('0x50')]);return _0x119c17[_0x7742('0x9c')](_0x5c657e);}})[_0x7742('0x30')](function(_0x29bde3){if(_0x29bde3){_0x12d239=_0x29bde3[_0x7742('0x48')];if(!_0x5b5424[_0x7742('0x43')][_0x7742('0x61')](_0x7742('0x49'))){_0x5c657e[_0x7742('0x27')]=qs[_0x7742('0x27')](_0x5b5424[_0x7742('0x43')][_0x7742('0x27')]);_0x5c657e[_0x7742('0x29')]=qs[_0x7742('0x29')](_0x5b5424[_0x7742('0x43')]['offset']);}return _0x119c17[_0x7742('0x9c')](_0x5c657e);}})['then'](function(_0x2d6c67){if(_0x2d6c67){return _0x2d6c67?{'count':_0x12d239,'rows':_0x2d6c67}:null;}})[_0x7742('0x30')](respondWithResult(_0x301686,null))['catch'](handleError(_0x301686,null));};exports[_0x7742('0x9d')]=function(_0x2a6676,_0x2d62c1,_0x452686){var _0x5d10ba={'raw':!![],'where':{}};var _0x50ca43={};var _0x5ebf92={'count':0x0,'rows':[]};return db['MailAccount'][_0x7742('0x65')]({'where':{'id':_0x2a6676[_0x7742('0x56')]['id']}})[_0x7742('0x30')](handleEntityNotFound(_0x2d62c1,null))[_0x7742('0x30')](function(_0x5f45dc){if(_0x5f45dc){_0x50ca43[_0x7742('0x42')]=_[_0x7742('0x44')](db[_0x7742('0x9e')][_0x7742('0x3e')]);_0x50ca43['query']=_[_0x7742('0x44')](_0x2a6676[_0x7742('0x43')]);_0x50ca43['filters']=_[_0x7742('0x46')](_0x50ca43['model'],_0x50ca43[_0x7742('0x43')]);_0x5d10ba[_0x7742('0x47')]=_[_0x7742('0x46')](_0x50ca43['model'],qs[_0x7742('0x57')](_0x2a6676[_0x7742('0x43')][_0x7742('0x57')]));_0x5d10ba['attributes']=_0x5d10ba[_0x7742('0x47')]['length']?_0x5d10ba[_0x7742('0x47')]:_0x50ca43[_0x7742('0x42')];if(!_0x2a6676[_0x7742('0x43')][_0x7742('0x61')](_0x7742('0x49'))){_0x5d10ba[_0x7742('0x27')]=qs[_0x7742('0x27')](_0x2a6676[_0x7742('0x43')][_0x7742('0x27')]);_0x5d10ba[_0x7742('0x29')]=qs['offset'](_0x2a6676[_0x7742('0x43')][_0x7742('0x29')]);}_0x5d10ba[_0x7742('0x4a')]=qs['sort'](_0x2a6676[_0x7742('0x43')][_0x7742('0x4b')]);_0x5d10ba[_0x7742('0x4c')]=qs['filters'](_[_0x7742('0x4d')](_0x2a6676[_0x7742('0x43')],_0x50ca43['filters']));_0x5d10ba['where'][_0x7742('0x5d')]=_0x5f45dc['id'];if(_0x2a6676[_0x7742('0x43')]['filter']){_0x5d10ba[_0x7742('0x4c')]=_[_0x7742('0x4f')](_0x5d10ba[_0x7742('0x4c')],{'$or':_[_0x7742('0x3c')](_0x5d10ba[_0x7742('0x47')],function(_0xa26f3f){var _0x45c903={};_0x45c903[_0xa26f3f]={'$like':'%'+_0x2a6676['query'][_0x7742('0x4e')]+'%'};return _0x45c903;})});}if(_0x2a6676[_0x7742('0x43')][_0x7742('0x9f')]){var _0x45fa9c=_0x2a6676['query']['$gte'][_0x7742('0xa0')](',');var _0x654e7c={};_0x654e7c[_0x45fa9c[0x0]]={'$gte':moment(_0x45fa9c[0x1])[_0x7742('0xa1')](_0x7742('0xa2'))};_0x5d10ba[_0x7742('0x4c')]=_[_0x7742('0x4f')](_0x5d10ba[_0x7742('0x4c')],_0x654e7c);}_0x5d10ba=_[_0x7742('0x4f')]({},_0x5d10ba,_0x2a6676[_0x7742('0x50')]);return db['MailMessage'][_0x7742('0x28')]({'where':_0x5d10ba[_0x7742('0x4c')]})['then'](function(_0x2e4bbe){_0x5ebf92[_0x7742('0x28')]=_0x2e4bbe;if(_0x2a6676['query'][_0x7742('0x51')]){_0x5d10ba[_0x7742('0x58')]=[{'all':!![]}];}return db[_0x7742('0x9e')]['findAll'](_0x5d10ba);})[_0x7742('0x30')](function(_0x14a30a){if(_0x2a6676[_0x7742('0x43')][_0x7742('0xa3')]===_0x7742('0xa4')){for(var _0x4a78bb=0x0;_0x4a78bb<_0x14a30a['length'];_0x4a78bb++){_0x14a30a[_0x4a78bb][_0x7742('0x5a')]=juice(_0x14a30a[_0x4a78bb][_0x7742('0x5a')]);}}_0x5ebf92['rows']=_0x14a30a;return _0x5ebf92;});}})['then'](respondWithFilteredResult(_0x2d62c1,_0x5d10ba))['catch'](handleError(_0x2d62c1,null));};exports[_0x7742('0x34')]=function(_0x4790c1,_0x483627,_0x367b4a){var _0x4c993b,_0x512046={},_0x29fc99;if(_0x4790c1['body']['to']){_0x29fc99=_0x4790c1[_0x7742('0x5a')]['to']['split'](',')[0x0];}return db['MailAccount'][_0x7742('0x59')]({'where':{'id':_0x4790c1['params']['id']},'include':[{'model':db[_0x7742('0xa5')],'as':_0x7742('0xa6'),'include':[{'model':db[_0x7742('0x8a')],'as':_0x7742('0xa7'),'where':{'email':_0x29fc99},'limit':0x1,'order':[[_0x7742('0xa8'),_0x7742('0xa9')]]}]},{'model':db['MailServerOut'],'as':_0x7742('0x39'),'raw':!![]}]})['then'](handleEntityNotFound(_0x483627,null))[_0x7742('0x30')](function(_0x9c67c6){if(_0x9c67c6){_0x4c993b=_0x9c67c6;if(_0x9c67c6['Smtp']){if(_['isNil'](_0x4790c1[_0x7742('0x5a')][_0x7742('0xaa')])){_0x4790c1['body']['from']=util[_0x7742('0xa1')](_0x7742('0xab'),_0x9c67c6[_0x7742('0x33')],_0x9c67c6['email']||_0x9c67c6[_0x7742('0x39')][_0x7742('0x6e')]);}if(_0x4790c1[_0x7742('0x5a')][_0x7742('0xac')]&&_0x4790c1[_0x7742('0x5a')][_0x7742('0xac')][_0x7742('0x48')]){for(var _0x39f62b=0x0;_0x39f62b<_0x4790c1[_0x7742('0x5a')][_0x7742('0xac')][_0x7742('0x48')];_0x39f62b+=0x1){_0x4790c1['body'][_0x7742('0xac')][_0x39f62b]={'filename':_0x4790c1[_0x7742('0x5a')][_0x7742('0xac')][_0x39f62b]['name'],'path':path['join'](config[_0x7742('0xad')],_0x7742('0xae'),_0x4790c1[_0x7742('0x5a')]['attachments'][_0x39f62b]['basename'])};}}var _0x112949={'tls':{'rejectUnauthorized':![]}};if(_[_0x7742('0x6a')](_0x9c67c6[_0x7742('0x39')][_0x7742('0x76')])){if(_0x9c67c6[_0x7742('0x39')][_0x7742('0x73')]){_0x112949['auth']={'user':_0x9c67c6[_0x7742('0x39')][_0x7742('0x6e')],'pass':_0x9c67c6[_0x7742('0x39')][_0x7742('0x71')]};}_0x112949[_0x7742('0x74')]=_0x9c67c6['Smtp'][_0x7742('0x74')];_0x112949['port']=_0x9c67c6[_0x7742('0x39')][_0x7742('0x75')];_0x112949[_0x7742('0xaf')]=_0x9c67c6[_0x7742('0x39')][_0x7742('0xaf')];}else{_0x112949[_0x7742('0x76')]=_0x9c67c6[_0x7742('0x39')][_0x7742('0x76')];_0x112949['auth']={'user':_0x9c67c6[_0x7742('0x39')][_0x7742('0x6e')],'pass':_0x9c67c6[_0x7742('0x39')]['pass']};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x112949,'message':_0x4790c1[_0x7742('0x5a')]});}else{throw new Error(_0x7742('0xb0'));}}})[_0x7742('0x30')](function(_0xcb26e5){if(_0xcb26e5){_0x512046=_0xcb26e5;if(_0x4c993b[_0x7742('0xa6')]){if(_0x4c993b[_0x7742('0xa6')]['Contacts'][_0x7742('0x48')]){return _0x4c993b['List'][_0x7742('0xa7')][0x0];}else{return db[_0x7742('0x8a')][_0x7742('0x5f')](_[_0x7742('0xb1')](_0x4790c1['body'],{'firstName':_0x4790c1[_0x7742('0x5a')]['to'],'email':_0x4790c1[_0x7742('0x5a')]['to'],'phone':_0x4790c1['body']['to'],'ListId':_0x4c993b[_0x7742('0x69')]}));}}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x393692){if(_0x393692){var _0x24c0d3={'UserId':_0x4790c1['user']['id'],'ContactId':_0x393692['id'],'MailAccountId':_0x4c993b['id'],'inReplyTo':_0x512046[_0x7742('0xb2')],'to':_0x4790c1['body'][_0x7742('0xaa')],'cc':_0x4790c1['body']['cc'],'subject':_0x4790c1[_0x7742('0x5a')][_0x7742('0xb3')],'attach':_0x4790c1[_0x7742('0x5a')][_0x7742('0xb4')],'firstMsgDirection':_0x7742('0xb5'),'lastMsgAt':moment()[_0x7742('0xa1')](_0x7742('0xa2')),'lastMsgDirection':_0x7742('0xb5'),'Messages':[_[_0x7742('0x4f')](_0x4790c1[_0x7742('0x5a')],{'messageId':_0x512046[_0x7742('0xb2')],'sentAt':moment()['format'](_0x7742('0xa2')),'read':!![],'MailAccountId':_0x4c993b['id'],'UserId':_0x4790c1[_0x7742('0x6e')]['id'],'ContactId':_0x393692['id']})]};if(_0x4790c1['body'][_0x7742('0xb6')]){_0x24c0d3=_['merge'](_0x24c0d3,_0x4790c1[_0x7742('0x5a')][_0x7742('0xb6')]);}return db[_0x7742('0x87')]['create'](_0x24c0d3,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});}})['then'](respondWithResult(_0x483627,null))[_0x7742('0x54')](handleError(_0x483627,null));};exports[_0x7742('0xb7')]=function(_0x472b3f,_0x5ed2b1,_0x16129b){return db[_0x7742('0x3d')]['find']({'where':{'id':_0x472b3f[_0x7742('0x56')]['id']},'include':[{'model':db[_0x7742('0x38')],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x5ed2b1,null))[_0x7742('0x30')](function(_0x303f7c){if(_0x303f7c&&_0x303f7c[_0x7742('0x39')]){var _0x17e54b={'id':_0x303f7c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x303f7c['Smtp']['service']){_0x17e54b[_0x7742('0x76')]=_0x303f7c[_0x7742('0x39')][_0x7742('0x76')];}else{_0x17e54b[_0x7742('0x74')]=_0x303f7c['Smtp'][_0x7742('0x74')];_0x17e54b['port']=_0x303f7c[_0x7742('0x39')][_0x7742('0x75')];_0x17e54b[_0x7742('0xaf')]=_0x303f7c['Smtp']['secure'];}if(_0x303f7c['Smtp'][_0x7742('0x73')]){_0x17e54b[_0x7742('0xb8')]={'user':_0x303f7c[_0x7742('0x39')]['user'],'pass':_0x303f7c[_0x7742('0x39')][_0x7742('0x71')]};}return respondWithRpcPromise('VerifySmtp',_0x7742('0xb7'),{'account':_0x17e54b});}})['then'](respondWithResult(_0x5ed2b1,null))[_0x7742('0x54')](handleError(_0x5ed2b1,null));};exports['destroy']=function(_0x4639b0,_0x148db5){return db[_0x7742('0x3d')][_0x7742('0x59')]({'where':{'id':_0x4639b0[_0x7742('0x56')]['id']}})['then'](handleEntityNotFound(_0x148db5,null))['then'](function(_0x5c3311){if(_0x5c3311&&_0x5c3311['service']){throw new db[(_0x7742('0xb9'))]['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x5c3311;})['then'](removeEntity(_0x148db5,null))['catch'](handleError(_0x148db5,null));};exports[_0x7742('0xba')]=function(_0x3af94c,_0x1ce770,_0x3eaf99){return db[_0x7742('0x3d')][_0x7742('0x59')]({'where':{'id':_0x3af94c[_0x7742('0x56')]['id']}})['then'](handleEntityNotFound(_0x1ce770,null))[_0x7742('0x30')](function(_0x5c4629){if(_0x5c4629){return _0x5c4629[_0x7742('0xba')](_0x3af94c[_0x7742('0x5a')][_0x7742('0x63')],_[_0x7742('0x88')](_0x3af94c[_0x7742('0x5a')],['ids','id'])||{})[_0x7742('0xbb')](function(_0x569ba8){for(var _0x2357c7=0x0;_0x2357c7<_0x3af94c['body'][_0x7742('0x63')][_0x7742('0x48')];_0x2357c7+=0x1){socket[_0x7742('0xbc')](_0x7742('0xbd'),{'UserId':Number(_0x3af94c[_0x7742('0x5a')][_0x7742('0x63')][_0x2357c7]),'MailAccountId':Number(_0x3af94c[_0x7742('0x56')]['id'])});}return _0x569ba8;});}})[_0x7742('0x30')](respondWithResult(_0x1ce770,null))['catch'](handleError(_0x1ce770,null));};exports[_0x7742('0xbe')]=function(_0x4dd9b6,_0x16adb1,_0x228be5){return db[_0x7742('0x3d')][_0x7742('0x59')]({'where':{'id':_0x4dd9b6[_0x7742('0x56')]['id']}})[_0x7742('0x30')](handleEntityNotFound(_0x16adb1,null))[_0x7742('0x30')](function(_0x3b7db6){if(_0x3b7db6){return _0x3b7db6[_0x7742('0xbe')](_0x4dd9b6['query'][_0x7742('0x63')])[_0x7742('0x30')](function(){if(_[_0x7742('0xbf')](_0x4dd9b6[_0x7742('0x43')][_0x7742('0x63')])){for(var _0x20c393=0x0;_0x20c393<_0x4dd9b6['query']['ids'][_0x7742('0x48')];_0x20c393+=0x1){socket['emit'](_0x7742('0xc0'),{'UserId':Number(_0x4dd9b6[_0x7742('0x43')][_0x7742('0x63')][_0x20c393]),'MailAccountId':Number(_0x4dd9b6[_0x7742('0x56')]['id'])});}}else{socket[_0x7742('0xbc')]('userMailAccount:remove',{'UserId':Number(_0x4dd9b6[_0x7742('0x43')][_0x7742('0x63')]),'MailAccountId':Number(_0x4dd9b6[_0x7742('0x56')]['id'])});}});}})[_0x7742('0x30')](respondWithStatusCode(_0x16adb1,null))[_0x7742('0x54')](handleError(_0x16adb1,null));};exports[_0x7742('0xc1')]=function(_0x16d863,_0x1f0bc9,_0x9d385f){var _0x3b6cdd={};var _0x4f8a2d={};var _0x2629b9;var _0x46ab6a;return db[_0x7742('0x3d')]['findOne']({'where':{'id':_0x16d863[_0x7742('0x56')]['id']}})[_0x7742('0x30')](handleEntityNotFound(_0x1f0bc9,null))['then'](function(_0x425529){if(_0x425529){_0x2629b9=_0x425529;_0x4f8a2d[_0x7742('0x42')]=_['keys'](db['User'][_0x7742('0x3e')]);_0x4f8a2d[_0x7742('0x43')]=_[_0x7742('0x44')](_0x16d863[_0x7742('0x43')]);_0x4f8a2d[_0x7742('0x45')]=_[_0x7742('0x46')](_0x4f8a2d['model'],_0x4f8a2d[_0x7742('0x43')]);_0x3b6cdd[_0x7742('0x47')]=_['intersection'](_0x4f8a2d[_0x7742('0x42')],qs[_0x7742('0x57')](_0x16d863[_0x7742('0x43')]['fields']));_0x3b6cdd[_0x7742('0x47')]=_0x3b6cdd['attributes'][_0x7742('0x48')]?_0x3b6cdd['attributes']:_0x4f8a2d[_0x7742('0x42')];_0x3b6cdd['order']=qs[_0x7742('0x4b')](_0x16d863['query'][_0x7742('0x4b')]);_0x3b6cdd[_0x7742('0x4c')]=qs[_0x7742('0x45')](_[_0x7742('0x4d')](_0x16d863[_0x7742('0x43')],_0x4f8a2d[_0x7742('0x45')]));if(_0x16d863[_0x7742('0x43')][_0x7742('0x4e')]){_0x3b6cdd['where']=_['merge'](_0x3b6cdd[_0x7742('0x4c')],{'$or':_[_0x7742('0x3c')](_0x3b6cdd[_0x7742('0x47')],function(_0xadb55c){var _0x3487e0={};_0x3487e0[_0xadb55c]={'$like':'%'+_0x16d863[_0x7742('0x43')][_0x7742('0x4e')]+'%'};return _0x3487e0;})});}_0x3b6cdd=_[_0x7742('0x4f')]({},_0x3b6cdd,_0x16d863[_0x7742('0x50')]);return _0x2629b9[_0x7742('0xc1')](_0x3b6cdd);}})[_0x7742('0x30')](function(_0x49356c){if(_0x49356c){_0x46ab6a=_0x49356c[_0x7742('0x48')];if(!_0x16d863[_0x7742('0x43')]['hasOwnProperty'](_0x7742('0x49'))){_0x3b6cdd['limit']=qs[_0x7742('0x27')](_0x16d863[_0x7742('0x43')][_0x7742('0x27')]);_0x3b6cdd[_0x7742('0x29')]=qs[_0x7742('0x29')](_0x16d863[_0x7742('0x43')][_0x7742('0x29')]);}return _0x2629b9[_0x7742('0xc1')](_0x3b6cdd);}})[_0x7742('0x30')](function(_0x14ee41){if(_0x14ee41){return _0x14ee41?{'count':_0x46ab6a,'rows':_0x14ee41}:null;}})[_0x7742('0x30')](respondWithResult(_0x1f0bc9,null))[_0x7742('0x54')](handleError(_0x1f0bc9,null));}; \ No newline at end of file +var _0xc192=['Messages','VerifySmtp','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','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','./mailAccount.socket','register','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','show','options','find','body','params','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','CannedAnswer','create','getAnswers','removeAnswers','email','ListId','isNil','active','description','cauthentication','user','password','pass','cpassword','authentication','host','port','service','cuser','Unable\x20to\x20retrieve\x20the\x20current\x20user','MailAccounts','userProfileId','autoAssociation','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','Tag','Tags','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction'];(function(_0x3d7115,_0x290b9b){var _0x4f99c1=function(_0x5aac24){while(--_0x5aac24){_0x3d7115['push'](_0x3d7115['shift']());}};_0x4f99c1(++_0x290b9b);}(_0xc192,0xd6));var _0x2c19=function(_0x51298f,_0x412c11){_0x51298f=_0x51298f-0x0;var _0x1517b2=_0xc192[_0x51298f];return _0x1517b2;};'use strict';var emlformat=require(_0x2c19('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2c19('0x1'));var jsonpatch=require(_0x2c19('0x2'));var rp=require(_0x2c19('0x3'));var moment=require(_0x2c19('0x4'));var BPromise=require(_0x2c19('0x5'));var Mustache=require(_0x2c19('0x6'));var util=require(_0x2c19('0x7'));var path=require(_0x2c19('0x8'));var sox=require(_0x2c19('0x9'));var csv=require(_0x2c19('0xa'));var ejs=require(_0x2c19('0xb'));var fs=require('fs');var fs_extra=require(_0x2c19('0xc'));var _=require(_0x2c19('0xd'));var squel=require('squel');var crypto=require(_0x2c19('0xe'));var jsforce=require(_0x2c19('0xf'));var deskjs=require(_0x2c19('0x10'));var toCsv=require(_0x2c19('0xa'));var querystring=require(_0x2c19('0x11'));var Papa=require(_0x2c19('0x12'));var htmlToText=require(_0x2c19('0x13'));var juice=require('juice');var Redis=require(_0x2c19('0x14'));var authService=require(_0x2c19('0x15'));var qs=require(_0x2c19('0x16'));var as=require(_0x2c19('0x17'));var hardwareService=require(_0x2c19('0x18'));var logger=require(_0x2c19('0x19'))(_0x2c19('0x1a'));var utils=require(_0x2c19('0x1b'));var config=require(_0x2c19('0x1c'));var licenseUtil=require(_0x2c19('0x1d'));var db=require(_0x2c19('0x1e'))['db'];config[_0x2c19('0x1f')]=_[_0x2c19('0x20')](config[_0x2c19('0x1f')],{'host':_0x2c19('0x21'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2c19('0x1f')]));require(_0x2c19('0x22'))[_0x2c19('0x23')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x2c19('0x24')]({'port':0x232b});function respondWithRpcPromise(_0x487c65,_0x260de6,_0x459bf0,_0x1781a9){return new BPromise(function(_0x538bb2,_0x5e9a6e){var _0x53540e=_0x1781a9||client;return _0x53540e['request'](_0x487c65,_0x459bf0)[_0x2c19('0x25')](function(_0x331dd1){logger[_0x2c19('0x26')](_0x2c19('0x27'),_0x260de6,_0x2c19('0x28'));logger[_0x2c19('0x29')](_0x2c19('0x2a'),_0x260de6,_0x2c19('0x28'),JSON[_0x2c19('0x2b')](_0x331dd1));if(_0x331dd1[_0x2c19('0x2c')]){if(_0x331dd1[_0x2c19('0x2c')][_0x2c19('0x2d')]===0x1f4){logger['error'](_0x2c19('0x27'),_0x260de6,_0x331dd1[_0x2c19('0x2c')]['message']);return _0x5e9a6e(_0x331dd1['error']['message']);}logger[_0x2c19('0x2c')](_0x2c19('0x27'),_0x260de6,_0x331dd1[_0x2c19('0x2c')][_0x2c19('0x2e')]);return _0x538bb2(_0x331dd1[_0x2c19('0x2c')]['message']);}else{logger['info'](_0x2c19('0x27'),_0x260de6,_0x2c19('0x28'));_0x538bb2(_0x331dd1['result'][_0x2c19('0x2e')]);}})[_0x2c19('0x2f')](function(_0x2ba384){logger[_0x2c19('0x2c')](_0x2c19('0x27'),_0x260de6,_0x2ba384);_0x5e9a6e(_0x2ba384);});});}function respondWithStatusCode(_0x31a38a,_0xdb33bc){_0xdb33bc=_0xdb33bc||0xcc;return function(_0x3a1e26){if(_0x3a1e26){return _0x31a38a[_0x2c19('0x30')](_0xdb33bc);}return _0x31a38a[_0x2c19('0x31')](_0xdb33bc)[_0x2c19('0x32')]();};}function respondWithResult(_0x1db301,_0x21d816){_0x21d816=_0x21d816||0xc8;return function(_0x225460){if(_0x225460){return _0x1db301['status'](_0x21d816)[_0x2c19('0x33')](_0x225460);}};}function respondWithFilteredResult(_0x35a666,_0x27c7b7){return function(_0x397cad){if(_0x397cad){var _0x539a67=typeof _0x27c7b7[_0x2c19('0x34')]===_0x2c19('0x35')&&typeof _0x27c7b7['limit']===_0x2c19('0x35');var _0x2f7b96=_0x397cad['count'];var _0x166d0a=_0x539a67?0x0:_0x27c7b7['offset'];var _0x42f855=_0x539a67?_0x397cad[_0x2c19('0x36')]:_0x27c7b7['offset']+_0x27c7b7[_0x2c19('0x37')];var _0x4d8c39;if(_0x42f855>=_0x2f7b96){_0x42f855=_0x2f7b96;_0x4d8c39=0xc8;}else{_0x4d8c39=0xce;}_0x35a666[_0x2c19('0x31')](_0x4d8c39);return _0x35a666[_0x2c19('0x38')](_0x2c19('0x39'),_0x166d0a+'-'+_0x42f855+'/'+_0x2f7b96)['json'](_0x397cad);}return null;};}function patchUpdates(_0x49fed1){return function(_0x174ffe){try{jsonpatch[_0x2c19('0x3a')](_0x174ffe,_0x49fed1,!![]);}catch(_0x4e051){return BPromise[_0x2c19('0x3b')](_0x4e051);}return _0x174ffe[_0x2c19('0x3c')]();};}function saveUpdates(_0x1e8fc5,_0x15dc66){return function(_0x110f51){if(_0x110f51){return _0x110f51[_0x2c19('0x3d')](_0x1e8fc5)[_0x2c19('0x25')](function(_0x18f303){return _0x18f303;});}return null;};}function removeEntity(_0x4c49b8,_0x55f3fb){return function(_0x56ad20){if(_0x56ad20){return _0x56ad20[_0x2c19('0x3e')]()[_0x2c19('0x25')](function(){var _0x518652=_0x56ad20[_0x2c19('0x3f')]({'plain':!![]});var _0xf2a6eb='MailAccounts';return db[_0x2c19('0x40')][_0x2c19('0x3e')]({'where':{'type':_0xf2a6eb,'resourceId':_0x518652['id']}})['then'](function(){return _0x56ad20;});})[_0x2c19('0x25')](function(){_0x4c49b8[_0x2c19('0x31')](0xcc)[_0x2c19('0x32')]();});}};}function handleEntityNotFound(_0x2ccfe5,_0x4c3307){return function(_0x20b5c4){if(!_0x20b5c4){_0x2ccfe5['sendStatus'](0x194);}return _0x20b5c4;};}function handleError(_0x53fc02,_0x12ae26){_0x12ae26=_0x12ae26||0x1f4;return function(_0x29dfa1){logger['error'](_0x29dfa1[_0x2c19('0x41')]);if(_0x29dfa1['name']){delete _0x29dfa1[_0x2c19('0x42')];}_0x53fc02[_0x2c19('0x31')](_0x12ae26)[_0x2c19('0x43')](_0x29dfa1);};}exports['index']=function(_0x53e1ac,_0x7b8098){var _0x15f754={'include':[{'model':db[_0x2c19('0x44')],'as':_0x2c19('0x45')},{'model':db[_0x2c19('0x46')],'as':_0x2c19('0x47')},{'model':db[_0x2c19('0x48')],'as':_0x2c19('0x49')}]},_0x55e6d0={},_0x485e7e={'count':0x0,'rows':[]};var _0x1c5a8f=_[_0x2c19('0x4a')](db[_0x2c19('0x4b')][_0x2c19('0x4c')],function(_0x1bc4ce){return{'name':_0x1bc4ce['fieldName'],'type':_0x1bc4ce['type'][_0x2c19('0x4d')]};});_0x55e6d0[_0x2c19('0x4e')]=_[_0x2c19('0x4a')](_0x1c5a8f,'name');_0x55e6d0[_0x2c19('0x4f')]=_[_0x2c19('0x50')](_0x53e1ac['query']);_0x55e6d0[_0x2c19('0x51')]=_[_0x2c19('0x52')](_0x55e6d0['model'],_0x55e6d0[_0x2c19('0x4f')]);_0x15f754['attributes']=_[_0x2c19('0x52')](_0x55e6d0[_0x2c19('0x4e')],qs['fields'](_0x53e1ac['query'][_0x2c19('0x53')]));_0x15f754[_0x2c19('0x54')]=_0x15f754[_0x2c19('0x54')][_0x2c19('0x55')]?_0x15f754[_0x2c19('0x54')]:_0x55e6d0[_0x2c19('0x4e')];if(!_0x53e1ac[_0x2c19('0x4f')][_0x2c19('0x56')](_0x2c19('0x57'))){_0x15f754[_0x2c19('0x37')]=qs[_0x2c19('0x37')](_0x53e1ac['query'][_0x2c19('0x37')]);_0x15f754['offset']=qs[_0x2c19('0x34')](_0x53e1ac[_0x2c19('0x4f')]['offset']);}_0x15f754[_0x2c19('0x58')]=qs[_0x2c19('0x59')](_0x53e1ac[_0x2c19('0x4f')][_0x2c19('0x59')]);_0x15f754[_0x2c19('0x5a')]=qs['filters'](_['pick'](_0x53e1ac[_0x2c19('0x4f')],_0x55e6d0[_0x2c19('0x51')]),_0x1c5a8f);if(_0x53e1ac[_0x2c19('0x4f')][_0x2c19('0x5b')]){_0x15f754[_0x2c19('0x5a')]=_[_0x2c19('0x5c')](_0x15f754[_0x2c19('0x5a')],{'$or':_['map'](_0x1c5a8f,function(_0x47516a){if(_0x47516a['type']!=='VIRTUAL'){var _0x563ad1={};_0x563ad1[_0x47516a['name']]={'$like':'%'+_0x53e1ac['query'][_0x2c19('0x5b')]+'%'};return _0x563ad1;}})});}_0x15f754=_['merge']({},_0x15f754,_0x53e1ac['options']);var _0x21dd01={'where':_0x15f754[_0x2c19('0x5a')]};return db[_0x2c19('0x4b')][_0x2c19('0x36')](_0x21dd01)[_0x2c19('0x25')](function(_0x467769){_0x485e7e['count']=_0x467769;if(_0x53e1ac[_0x2c19('0x4f')][_0x2c19('0x5d')]){_0x15f754[_0x2c19('0x5e')]=[{'all':!![]}];}return db[_0x2c19('0x4b')][_0x2c19('0x5f')](_0x15f754);})[_0x2c19('0x25')](function(_0x49af85){_0x485e7e[_0x2c19('0x60')]=_0x49af85;return _0x485e7e;})[_0x2c19('0x25')](respondWithFilteredResult(_0x7b8098,_0x15f754))[_0x2c19('0x2f')](handleError(_0x7b8098,null));};exports[_0x2c19('0x61')]=function(_0x2e3a4c,_0x2fbda4){var _0x21413={'raw':![],'where':{'id':_0x2e3a4c['params']['id']},'include':[{'model':db[_0x2c19('0x44')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x2c19('0x47')},{'model':db[_0x2c19('0x48')],'as':'mandatoryDispositionPause'}]},_0x5ebefc={};_0x5ebefc[_0x2c19('0x4e')]=_[_0x2c19('0x50')](db[_0x2c19('0x4b')][_0x2c19('0x4c')]);_0x5ebefc[_0x2c19('0x4f')]=_[_0x2c19('0x50')](_0x2e3a4c[_0x2c19('0x4f')]);_0x5ebefc[_0x2c19('0x51')]=_[_0x2c19('0x52')](_0x5ebefc[_0x2c19('0x4e')],_0x5ebefc[_0x2c19('0x4f')]);_0x21413[_0x2c19('0x54')]=_[_0x2c19('0x52')](_0x5ebefc[_0x2c19('0x4e')],qs[_0x2c19('0x53')](_0x2e3a4c[_0x2c19('0x4f')][_0x2c19('0x53')]));_0x21413[_0x2c19('0x54')]=_0x21413[_0x2c19('0x54')][_0x2c19('0x55')]?_0x21413['attributes']:_0x5ebefc['model'];if(_0x2e3a4c['query']['includeAll']){_0x21413[_0x2c19('0x5e')]=[{'all':!![]}];}_0x21413=_[_0x2c19('0x5c')]({},_0x21413,_0x2e3a4c[_0x2c19('0x62')]);return db[_0x2c19('0x4b')][_0x2c19('0x63')](_0x21413)[_0x2c19('0x25')](handleEntityNotFound(_0x2fbda4,null))[_0x2c19('0x25')](respondWithResult(_0x2fbda4,null))[_0x2c19('0x2f')](handleError(_0x2fbda4,null));};exports[_0x2c19('0x3d')]=function(_0x4fb53a,_0xabf1ff){if(_0x4fb53a[_0x2c19('0x64')]['id']){delete _0x4fb53a[_0x2c19('0x64')]['id'];}return db[_0x2c19('0x4b')][_0x2c19('0x63')]({'where':{'id':_0x4fb53a[_0x2c19('0x65')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x2c19('0x46')],'as':_0x2c19('0x47')},{'model':db[_0x2c19('0x48')],'as':_0x2c19('0x49')}]})[_0x2c19('0x25')](handleEntityNotFound(_0xabf1ff,null))['then'](saveUpdates(_0x4fb53a[_0x2c19('0x64')],null))['then'](function(_0xe1c54){if(_0xe1c54&&_0x4fb53a[_0x2c19('0x64')][_0x2c19('0x45')]){return db[_0x2c19('0x44')][_0x2c19('0x3d')](_0x4fb53a[_0x2c19('0x64')][_0x2c19('0x45')],{'where':{'MailAccountId':_0xe1c54['id']}})['then'](function(){return _0xe1c54;});}return _0xe1c54;})['then'](function(_0x31a17c){if(_0x31a17c&&_0x4fb53a[_0x2c19('0x64')][_0x2c19('0x47')]){return db[_0x2c19('0x46')][_0x2c19('0x3d')](_0x4fb53a[_0x2c19('0x64')][_0x2c19('0x47')],{'where':{'MailAccountId':_0x31a17c['id']}})[_0x2c19('0x25')](function(){return _0x31a17c;});}return _0x31a17c;})['then'](respondWithResult(_0xabf1ff,null))[_0x2c19('0x2f')](handleError(_0xabf1ff,null));};exports['describe']=function(_0x46ee76,_0x1e01ee){return db['MailAccount'][_0x2c19('0x66')]()[_0x2c19('0x25')](respondWithResult(_0x1e01ee,null))[_0x2c19('0x2f')](handleError(_0x1e01ee,null));};exports[_0x2c19('0x67')]=function(_0xa49f2,_0xcb2c16,_0x5d85a9){if(_0xa49f2[_0x2c19('0x64')]['id']){delete _0xa49f2[_0x2c19('0x64')]['id'];}return db[_0x2c19('0x4b')][_0x2c19('0x63')]({'where':{'id':_0xa49f2[_0x2c19('0x65')]['id']}})[_0x2c19('0x25')](handleEntityNotFound(_0xcb2c16,null))[_0x2c19('0x25')](function(_0x1c85f1){if(_0x1c85f1){_0xa49f2[_0x2c19('0x64')][_0x2c19('0x68')]=_0x1c85f1['id'];return db[_0x2c19('0x69')]['create'](_0xa49f2['body']);}})['then'](respondWithResult(_0xcb2c16,null))[_0x2c19('0x2f')](handleError(_0xcb2c16,null));};exports[_0x2c19('0x6a')]=function(_0x62ac94,_0x2546ff,_0x4108a0){var _0x792a2={'raw':![],'where':{}};var _0x199d04={};var _0x367c4b={'count':0x0,'rows':[]};return db[_0x2c19('0x4b')][_0x2c19('0x6b')]({'where':{'id':_0x62ac94[_0x2c19('0x65')]['id']}})[_0x2c19('0x25')](handleEntityNotFound(_0x2546ff,null))[_0x2c19('0x25')](function(_0x56d592){if(_0x56d592){_0x199d04[_0x2c19('0x4e')]=_[_0x2c19('0x50')](db['Disposition'][_0x2c19('0x4c')]);_0x199d04[_0x2c19('0x4f')]=_['keys'](_0x62ac94['query']);_0x199d04[_0x2c19('0x51')]=_[_0x2c19('0x52')](_0x199d04[_0x2c19('0x4e')],_0x199d04['query']);_0x792a2[_0x2c19('0x54')]=_['intersection'](_0x199d04[_0x2c19('0x4e')],qs[_0x2c19('0x53')](_0x62ac94[_0x2c19('0x4f')]['fields']));_0x792a2['attributes']=_0x792a2[_0x2c19('0x54')][_0x2c19('0x55')]?_0x792a2[_0x2c19('0x54')]:_0x199d04[_0x2c19('0x4e')];if(!_0x62ac94[_0x2c19('0x4f')]['hasOwnProperty'](_0x2c19('0x57'))){_0x792a2[_0x2c19('0x37')]=qs[_0x2c19('0x37')](_0x62ac94['query']['limit']);_0x792a2[_0x2c19('0x34')]=qs[_0x2c19('0x34')](_0x62ac94['query'][_0x2c19('0x34')]);}_0x792a2['order']=qs[_0x2c19('0x59')](_0x62ac94[_0x2c19('0x4f')]['sort']);_0x792a2[_0x2c19('0x5a')]=qs[_0x2c19('0x51')](_[_0x2c19('0x6c')](_0x62ac94[_0x2c19('0x4f')],_0x199d04[_0x2c19('0x51')]));_0x792a2[_0x2c19('0x5a')]['MailAccountId']=_0x56d592['id'];if(_0x62ac94[_0x2c19('0x4f')][_0x2c19('0x5b')]){_0x792a2[_0x2c19('0x5a')]=_[_0x2c19('0x5c')](_0x792a2[_0x2c19('0x5a')],{'$or':_['map'](_0x792a2[_0x2c19('0x54')],function(_0x467082){var _0x594b47={};_0x594b47[_0x467082]={'$like':'%'+_0x62ac94['query'][_0x2c19('0x5b')]+'%'};return _0x594b47;})});}_0x792a2=_['merge']({},_0x792a2,_0x62ac94[_0x2c19('0x62')]);return db[_0x2c19('0x69')][_0x2c19('0x36')]({'where':_0x792a2[_0x2c19('0x5a')]})[_0x2c19('0x25')](function(_0x50571e){_0x367c4b[_0x2c19('0x36')]=_0x50571e;if(_0x62ac94['query'][_0x2c19('0x5d')]){_0x792a2[_0x2c19('0x5e')]=[{'all':!![]}];}return db['Disposition'][_0x2c19('0x5f')](_0x792a2);})[_0x2c19('0x25')](function(_0x4c3f98){_0x367c4b[_0x2c19('0x60')]=_0x4c3f98;return _0x367c4b;});}})[_0x2c19('0x25')](respondWithFilteredResult(_0x2546ff,_0x792a2))[_0x2c19('0x2f')](handleError(_0x2546ff,null));};exports[_0x2c19('0x6d')]=function(_0x3ea710,_0x241e72,_0x341c6d){return db['MailAccount'][_0x2c19('0x63')]({'where':{'id':_0x3ea710[_0x2c19('0x65')]['id']}})[_0x2c19('0x25')](handleEntityNotFound(_0x241e72,null))[_0x2c19('0x25')](function(_0x344401){if(_0x344401){return _0x344401[_0x2c19('0x6d')](_0x3ea710[_0x2c19('0x4f')][_0x2c19('0x6e')]);}})[_0x2c19('0x25')](respondWithStatusCode(_0x241e72,null))['catch'](handleError(_0x241e72,null));};exports[_0x2c19('0x6f')]=function(_0x2e3a27,_0x29ed5a,_0x42d1f2){if(_0x2e3a27[_0x2c19('0x64')]['id']){delete _0x2e3a27[_0x2c19('0x64')]['id'];}return db[_0x2c19('0x4b')][_0x2c19('0x63')]({'where':{'id':_0x2e3a27[_0x2c19('0x65')]['id']}})[_0x2c19('0x25')](handleEntityNotFound(_0x29ed5a,null))[_0x2c19('0x25')](function(_0x2c2eb5){if(_0x2c2eb5){_0x2e3a27['body'][_0x2c19('0x68')]=_0x2c2eb5['id'];return db[_0x2c19('0x70')][_0x2c19('0x71')](_0x2e3a27['body']);}})[_0x2c19('0x25')](respondWithResult(_0x29ed5a,null))['catch'](handleError(_0x29ed5a,null));};exports[_0x2c19('0x72')]=function(_0x5c48e1,_0x2757f2,_0x2898d7){var _0x2dd703={'raw':![],'where':{}};var _0x54777d={};var _0x39db0b={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x5c48e1[_0x2c19('0x65')]['id']}})['then'](handleEntityNotFound(_0x2757f2,null))[_0x2c19('0x25')](function(_0x5748b7){if(_0x5748b7){_0x54777d['model']=_[_0x2c19('0x50')](db['CannedAnswer'][_0x2c19('0x4c')]);_0x54777d[_0x2c19('0x4f')]=_[_0x2c19('0x50')](_0x5c48e1[_0x2c19('0x4f')]);_0x54777d[_0x2c19('0x51')]=_[_0x2c19('0x52')](_0x54777d[_0x2c19('0x4e')],_0x54777d[_0x2c19('0x4f')]);_0x2dd703['attributes']=_[_0x2c19('0x52')](_0x54777d[_0x2c19('0x4e')],qs[_0x2c19('0x53')](_0x5c48e1[_0x2c19('0x4f')][_0x2c19('0x53')]));_0x2dd703[_0x2c19('0x54')]=_0x2dd703[_0x2c19('0x54')][_0x2c19('0x55')]?_0x2dd703[_0x2c19('0x54')]:_0x54777d[_0x2c19('0x4e')];if(!_0x5c48e1[_0x2c19('0x4f')]['hasOwnProperty'](_0x2c19('0x57'))){_0x2dd703['limit']=qs[_0x2c19('0x37')](_0x5c48e1[_0x2c19('0x4f')]['limit']);_0x2dd703[_0x2c19('0x34')]=qs[_0x2c19('0x34')](_0x5c48e1[_0x2c19('0x4f')][_0x2c19('0x34')]);}_0x2dd703[_0x2c19('0x58')]=qs[_0x2c19('0x59')](_0x5c48e1[_0x2c19('0x4f')][_0x2c19('0x59')]);_0x2dd703[_0x2c19('0x5a')]=qs[_0x2c19('0x51')](_[_0x2c19('0x6c')](_0x5c48e1['query'],_0x54777d['filters']));_0x2dd703[_0x2c19('0x5a')][_0x2c19('0x68')]=_0x5748b7['id'];if(_0x5c48e1['query'][_0x2c19('0x5b')]){_0x2dd703[_0x2c19('0x5a')]=_[_0x2c19('0x5c')](_0x2dd703[_0x2c19('0x5a')],{'$or':_[_0x2c19('0x4a')](_0x2dd703[_0x2c19('0x54')],function(_0x467020){var _0x4cb9ff={};_0x4cb9ff[_0x467020]={'$like':'%'+_0x5c48e1['query'][_0x2c19('0x5b')]+'%'};return _0x4cb9ff;})});}_0x2dd703=_[_0x2c19('0x5c')]({},_0x2dd703,_0x5c48e1[_0x2c19('0x62')]);return db['CannedAnswer']['count']({'where':_0x2dd703[_0x2c19('0x5a')]})[_0x2c19('0x25')](function(_0x9ab625){_0x39db0b[_0x2c19('0x36')]=_0x9ab625;if(_0x5c48e1['query'][_0x2c19('0x5d')]){_0x2dd703['include']=[{'all':!![]}];}return db[_0x2c19('0x70')][_0x2c19('0x5f')](_0x2dd703);})[_0x2c19('0x25')](function(_0x4fb261){_0x39db0b[_0x2c19('0x60')]=_0x4fb261;return _0x39db0b;});}})['then'](respondWithFilteredResult(_0x2757f2,_0x2dd703))['catch'](handleError(_0x2757f2,null));};exports[_0x2c19('0x73')]=function(_0x2810db,_0xde7370,_0x587b93){return db['MailAccount'][_0x2c19('0x63')]({'where':{'id':_0x2810db['params']['id']}})[_0x2c19('0x25')](handleEntityNotFound(_0xde7370,null))[_0x2c19('0x25')](function(_0x214331){if(_0x214331){return _0x214331[_0x2c19('0x73')](_0x2810db[_0x2c19('0x4f')][_0x2c19('0x6e')]);}})[_0x2c19('0x25')](respondWithStatusCode(_0xde7370,null))['catch'](handleError(_0xde7370,null));};exports[_0x2c19('0x71')]=function(_0x4aaa3c,_0x3c4224){var _0x18f407={'name':_0x4aaa3c['body'][_0x2c19('0x42')],'key':_0x4aaa3c[_0x2c19('0x64')][_0x2c19('0x4d')],'email':_0x4aaa3c[_0x2c19('0x64')][_0x2c19('0x74')],'ListId':_0x4aaa3c[_0x2c19('0x64')][_0x2c19('0x75')],'active':!_[_0x2c19('0x76')](_0x4aaa3c[_0x2c19('0x64')][_0x2c19('0x77')])?_0x4aaa3c[_0x2c19('0x64')][_0x2c19('0x77')]:!![],'description':_0x4aaa3c[_0x2c19('0x64')][_0x2c19('0x78')]||null,'Imap':{},'Smtp':{}};if(_[_0x2c19('0x76')](_0x4aaa3c[_0x2c19('0x64')]['cservice'])){if(_0x4aaa3c[_0x2c19('0x64')][_0x2c19('0x79')]){_0x18f407['Imap'][_0x2c19('0x7a')]=_0x18f407[_0x2c19('0x47')][_0x2c19('0x7a')]=_0x4aaa3c['body']['cuser'];_0x18f407['Imap'][_0x2c19('0x7b')]=_0x18f407['Smtp'][_0x2c19('0x7c')]=_0x4aaa3c['body'][_0x2c19('0x7d')];}else{_0x18f407[_0x2c19('0x45')][_0x2c19('0x7e')]=_0x18f407['Smtp'][_0x2c19('0x7e')]=![];}_0x18f407[_0x2c19('0x45')][_0x2c19('0x7f')]=_0x4aaa3c[_0x2c19('0x64')][_0x2c19('0x45')][_0x2c19('0x7f')];_0x18f407['Imap'][_0x2c19('0x80')]=_0x4aaa3c[_0x2c19('0x64')]['Imap']['port'];_0x18f407[_0x2c19('0x47')][_0x2c19('0x7f')]=_0x4aaa3c['body'][_0x2c19('0x47')][_0x2c19('0x7f')];_0x18f407[_0x2c19('0x47')]['port']=_0x4aaa3c[_0x2c19('0x64')][_0x2c19('0x47')][_0x2c19('0x80')];}else{_0x18f407[_0x2c19('0x45')][_0x2c19('0x81')]=_0x18f407[_0x2c19('0x47')][_0x2c19('0x81')]=_0x4aaa3c[_0x2c19('0x64')]['cservice'];_0x18f407[_0x2c19('0x45')][_0x2c19('0x7a')]=_0x18f407[_0x2c19('0x47')][_0x2c19('0x7a')]=_0x4aaa3c[_0x2c19('0x64')][_0x2c19('0x82')];_0x18f407[_0x2c19('0x45')][_0x2c19('0x7b')]=_0x18f407[_0x2c19('0x47')][_0x2c19('0x7c')]=_0x4aaa3c[_0x2c19('0x64')][_0x2c19('0x7d')];}return db['MailAccount'][_0x2c19('0x71')](_0x18f407,{'include':[{'model':db[_0x2c19('0x46')],'as':_0x2c19('0x47')},{'model':db[_0x2c19('0x44')],'as':'Imap'}]})[_0x2c19('0x25')](function(_0x139ba1){var _0xc23d95=_0x4aaa3c[_0x2c19('0x7a')][_0x2c19('0x3f')]({'plain':!![]});if(!_0xc23d95)throw new Error(_0x2c19('0x83'));if(_0xc23d95['role']==='user'){var _0x1f5e7d=_0x139ba1['get']({'plain':!![]});return db['UserProfileSection'][_0x2c19('0x63')]({'where':{'name':_0x2c19('0x84'),'userProfileId':_0xc23d95[_0x2c19('0x85')]},'raw':!![]})[_0x2c19('0x25')](function(_0x3c8a0c){if(_0x3c8a0c&&_0x3c8a0c[_0x2c19('0x86')]===0x0){return db[_0x2c19('0x40')][_0x2c19('0x71')]({'name':_0x1f5e7d[_0x2c19('0x42')],'resourceId':_0x1f5e7d['id'],'type':_0x3c8a0c[_0x2c19('0x42')],'sectionId':_0x3c8a0c['id']},{})['then'](function(){return _0x139ba1;});}else{return _0x139ba1;}})[_0x2c19('0x2f')](function(_0x20e65a){logger[_0x2c19('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20e65a);throw _0x20e65a;});}return _0x139ba1;})[_0x2c19('0x25')](respondWithResult(_0x3c4224,0xc9))[_0x2c19('0x2f')](handleError(_0x3c4224,null));};exports[_0x2c19('0x87')]=function(_0x5a67fe,_0x14b917,_0x3b7e99){return db[_0x2c19('0x4b')][_0x2c19('0x6b')]({'where':{'id':_0x5a67fe[_0x2c19('0x65')]['id']}})[_0x2c19('0x25')](handleEntityNotFound(_0x14b917,null))['then'](function(_0x180575){if(_0x180575){return _0x180575[_0x2c19('0x87')]();}return null;})[_0x2c19('0x25')](respondWithResult(_0x14b917,null))['catch'](handleError(_0x14b917,null));};exports[_0x2c19('0x88')]=function(_0x2fc4a9,_0x5a65f8,_0x259913){if(_0x2fc4a9[_0x2c19('0x64')]['id']){delete _0x2fc4a9['body']['id'];}return db[_0x2c19('0x4b')][_0x2c19('0x63')]({'where':{'id':_0x2fc4a9[_0x2c19('0x65')]['id']}})[_0x2c19('0x25')](handleEntityNotFound(_0x5a65f8,null))['then'](function(_0x35f7fd){if(_0x35f7fd){_0x2fc4a9['body'][_0x2c19('0x68')]=_0x35f7fd['id'];return db['MailServerIn']['create'](_0x2fc4a9[_0x2c19('0x64')]);}})[_0x2c19('0x25')](respondWithResult(_0x5a65f8,null))[_0x2c19('0x2f')](handleError(_0x5a65f8,null));};exports[_0x2c19('0x89')]=function(_0xb80623,_0xe19610,_0x385302){return db[_0x2c19('0x4b')][_0x2c19('0x6b')]({'where':{'id':_0xb80623[_0x2c19('0x65')]['id']}})[_0x2c19('0x25')](handleEntityNotFound(_0xe19610,null))['then'](function(_0xcb9184){if(_0xcb9184){return _0xcb9184['setImap'](null);}return null;})[_0x2c19('0x25')](respondWithStatusCode(_0xe19610,null))['catch'](handleError(_0xe19610,null));};exports[_0x2c19('0x8a')]=function(_0xf50a21,_0x250c9a,_0x582933){return db[_0x2c19('0x4b')][_0x2c19('0x6b')]({'where':{'id':_0xf50a21[_0x2c19('0x65')]['id']}})['then'](handleEntityNotFound(_0x250c9a,null))[_0x2c19('0x25')](function(_0x509814){if(_0x509814){return _0x509814[_0x2c19('0x8a')]();}return null;})['then'](respondWithResult(_0x250c9a,null))[_0x2c19('0x2f')](handleError(_0x250c9a,null));};exports[_0x2c19('0x8b')]=function(_0x2b5ef9,_0x10daab,_0x1312e5){if(_0x2b5ef9['body']['id']){delete _0x2b5ef9[_0x2c19('0x64')]['id'];}return db[_0x2c19('0x4b')][_0x2c19('0x63')]({'where':{'id':_0x2b5ef9['params']['id']}})[_0x2c19('0x25')](handleEntityNotFound(_0x10daab,null))[_0x2c19('0x25')](function(_0x17a0e0){if(_0x17a0e0){_0x2b5ef9[_0x2c19('0x64')]['MailAccountId']=_0x17a0e0['id'];return db[_0x2c19('0x46')][_0x2c19('0x71')](_0x2b5ef9[_0x2c19('0x64')]);}})[_0x2c19('0x25')](respondWithResult(_0x10daab,null))[_0x2c19('0x2f')](handleError(_0x10daab,null));};exports[_0x2c19('0x8c')]=function(_0x4d4650,_0x319789,_0x1746c1){return db['MailAccount'][_0x2c19('0x6b')]({'where':{'id':_0x4d4650[_0x2c19('0x65')]['id']}})[_0x2c19('0x25')](handleEntityNotFound(_0x319789,null))[_0x2c19('0x25')](function(_0x111b41){if(_0x111b41){return _0x111b41['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x319789,null))['catch'](handleError(_0x319789,null));};exports[_0x2c19('0x8d')]=function(_0x30c140,_0x3d877b,_0xdd4781){return db[_0x2c19('0x8e')]['find']({'where':{'id':_0x30c140['params']['id']}})[_0x2c19('0x25')](handleEntityNotFound(_0x3d877b,null))[_0x2c19('0x25')](function(_0x3bec58){if(_0x3bec58){return _0x3bec58[_0x2c19('0x8d')](_0x30c140[_0x2c19('0x64')][_0x2c19('0x6e')],_[_0x2c19('0x8f')](_0x30c140[_0x2c19('0x64')],['ids','id'])||{});}})[_0x2c19('0x25')](respondWithResult(_0x3d877b,null))[_0x2c19('0x2f')](handleError(_0x3d877b,null));};exports[_0x2c19('0x90')]=function(_0x37d782,_0x59ee28,_0x52f0cc){var _0x27674f={'raw':![],'where':{}};var _0x2c2996={};var _0xc2aa78={'count':0x0,'rows':[]};return db[_0x2c19('0x4b')][_0x2c19('0x6b')]({'where':{'id':_0x37d782[_0x2c19('0x65')]['id']}})[_0x2c19('0x25')](handleEntityNotFound(_0x59ee28,null))[_0x2c19('0x25')](function(_0x50beaf){if(_0x50beaf){_0x2c2996[_0x2c19('0x4e')]=_[_0x2c19('0x50')](db[_0x2c19('0x8e')][_0x2c19('0x4c')]);_0x2c2996[_0x2c19('0x4f')]=_[_0x2c19('0x50')](_0x37d782['query']);_0x2c2996['filters']=_[_0x2c19('0x52')](_0x2c2996['model'],_0x2c2996['query']);_0x27674f[_0x2c19('0x54')]=_[_0x2c19('0x52')](_0x2c2996[_0x2c19('0x4e')],qs[_0x2c19('0x53')](_0x37d782['query']['fields']));_0x27674f['attributes']=_0x27674f['attributes'][_0x2c19('0x55')]?_0x27674f[_0x2c19('0x54')]:_0x2c2996[_0x2c19('0x4e')];if(!_0x37d782[_0x2c19('0x4f')][_0x2c19('0x56')](_0x2c19('0x57'))){_0x27674f[_0x2c19('0x37')]=qs['limit'](_0x37d782[_0x2c19('0x4f')][_0x2c19('0x37')]);_0x27674f[_0x2c19('0x34')]=qs[_0x2c19('0x34')](_0x37d782[_0x2c19('0x4f')][_0x2c19('0x34')]);}_0x27674f[_0x2c19('0x58')]=qs[_0x2c19('0x59')](_0x37d782[_0x2c19('0x4f')]['sort']);_0x27674f[_0x2c19('0x5a')]=qs[_0x2c19('0x51')](_['pick'](_0x37d782['query'],_0x2c2996[_0x2c19('0x51')]));_0x27674f[_0x2c19('0x5a')][_0x2c19('0x68')]=_0x50beaf['id'];if(_0x37d782['query']['filter']){_0x27674f[_0x2c19('0x5a')]=_[_0x2c19('0x5c')](_0x27674f[_0x2c19('0x5a')],{'$or':_[_0x2c19('0x4a')](_0x27674f[_0x2c19('0x54')],function(_0x59374f){var _0x37135c={};_0x37135c[_0x59374f]={'$like':'%'+_0x37d782[_0x2c19('0x4f')]['filter']+'%'};return _0x37135c;})});}_0x27674f=_['merge']({},_0x27674f,_0x37d782[_0x2c19('0x62')]);return db[_0x2c19('0x8e')]['count']({'where':_0x27674f[_0x2c19('0x5a')]})[_0x2c19('0x25')](function(_0x3373af){_0xc2aa78['count']=_0x3373af;if(_0x37d782['query'][_0x2c19('0x5d')]){_0x27674f[_0x2c19('0x5e')]=[{'model':db[_0x2c19('0x91')],'as':_0x2c19('0x92'),'required':![]},{'model':db[_0x2c19('0x93')],'as':_0x2c19('0x94'),'attributes':[_0x2c19('0x42'),'fullname','internal'],'required':![]},{'model':db[_0x2c19('0x95')],'as':_0x2c19('0x96'),'attributes':['id',_0x2c19('0x42'),_0x2c19('0x97')],'where':_0x37d782['query'][_0x2c19('0x98')]?{'id':_0x37d782[_0x2c19('0x4f')][_0x2c19('0x98')]}:undefined,'required':_0x37d782[_0x2c19('0x4f')]['tag']?!![]:![]}];}return db[_0x2c19('0x8e')][_0x2c19('0x5f')](_0x27674f);})[_0x2c19('0x25')](function(_0x1004cb){_0xc2aa78['rows']=_0x1004cb;return _0xc2aa78;});}})['then'](respondWithFilteredResult(_0x59ee28,_0x27674f))[_0x2c19('0x2f')](handleError(_0x59ee28,null));};exports[_0x2c19('0x99')]=function addApplications(_0x9af0de,_0x25eb49){var _0x367ba8=_0x9af0de[_0x2c19('0x65')]['id'];var _0x1b4887=_0x9af0de['body'];var _0x324668=0xc8;var _0x258dab=null;return db['sequelize'][_0x2c19('0x9a')]({'isolationLevel':db[_0x2c19('0x9b')][_0x2c19('0x9c')][_0x2c19('0x9d')][_0x2c19('0x9e')]},function(_0x269627){return db['MailAccount']['findOne']({'where':{'id':_0x367ba8},'transaction':_0x269627})[_0x2c19('0x25')](function(_0x2e01b7){if(_0x2e01b7){return db[_0x2c19('0x9f')][_0x2c19('0x3e')]({'where':{'MailAccountId':_0x367ba8},'transaction':_0x269627})[_0x2c19('0x25')](function(){var _0x53c8f0=_[_0x2c19('0x4a')](_0x1b4887,function(_0x4e31b8){_0x4e31b8[_0x2c19('0x68')]=_0x367ba8;return _0x4e31b8;});return db[_0x2c19('0x9f')][_0x2c19('0xa0')](_0x53c8f0,{'transaction':_0x269627});});}else{_0x324668=0x194;_0x258dab=[];}});})[_0x2c19('0x25')](function(){if(_0x324668!==0x194){return db['MailApplication'][_0x2c19('0xa1')]({'where':{'MailAccountId':_0x367ba8},'order':_0x2c19('0xa2')})['then'](function(_0x539919){_0x258dab=_0x539919;});}})['catch'](function(_0x4f9ed2){_0x324668=0x1f4;logger[_0x2c19('0x2c')](_0x4f9ed2[_0x2c19('0x41')]);if(_0x4f9ed2[_0x2c19('0x42')]){delete _0x4f9ed2[_0x2c19('0x42')];}_0x258dab=_0x4f9ed2;})['finally'](function(){if(_0x258dab===null){_0x25eb49[_0x2c19('0x30')](_0x324668);}else{if(_0x324668===0x1f4){_0x25eb49[_0x2c19('0x31')](_0x324668)[_0x2c19('0x43')](_0x258dab);}else{_0x25eb49[_0x2c19('0x31')](_0x324668)[_0x2c19('0x33')](_0x258dab);}}});};exports[_0x2c19('0xa3')]=function(_0x10e966,_0x380a0,_0x50dd1c){var _0x469db5={};var _0x25aaec={};var _0x5414d0;var _0x45bce4;return db[_0x2c19('0x4b')][_0x2c19('0x6b')]({'where':{'id':_0x10e966[_0x2c19('0x65')]['id']}})['then'](handleEntityNotFound(_0x380a0,null))[_0x2c19('0x25')](function(_0x242cb2){if(_0x242cb2){_0x5414d0=_0x242cb2;_0x25aaec['model']=_[_0x2c19('0x50')](db['MailApplication'][_0x2c19('0x4c')]);_0x25aaec[_0x2c19('0x4f')]=_['keys'](_0x10e966[_0x2c19('0x4f')]);_0x25aaec[_0x2c19('0x51')]=_[_0x2c19('0x52')](_0x25aaec[_0x2c19('0x4e')],_0x25aaec[_0x2c19('0x4f')]);_0x469db5['attributes']=_[_0x2c19('0x52')](_0x25aaec[_0x2c19('0x4e')],qs['fields'](_0x10e966['query'][_0x2c19('0x53')]));_0x469db5[_0x2c19('0x54')]=_0x469db5[_0x2c19('0x54')][_0x2c19('0x55')]?_0x469db5[_0x2c19('0x54')]:_0x25aaec[_0x2c19('0x4e')];_0x469db5[_0x2c19('0x58')]=qs['sort'](_0x10e966['query'][_0x2c19('0x59')]);_0x469db5['where']=qs[_0x2c19('0x51')](_[_0x2c19('0x6c')](_0x10e966['query'],_0x25aaec[_0x2c19('0x51')]));if(_0x10e966[_0x2c19('0x4f')][_0x2c19('0x5b')]){_0x469db5[_0x2c19('0x5a')]=_['merge'](_0x469db5[_0x2c19('0x5a')],{'$or':_[_0x2c19('0x4a')](_0x469db5[_0x2c19('0x54')],function(_0x5213d3){var _0x3fd4d3={};_0x3fd4d3[_0x5213d3]={'$like':'%'+_0x10e966[_0x2c19('0x4f')][_0x2c19('0x5b')]+'%'};return _0x3fd4d3;})});}_0x469db5=_[_0x2c19('0x5c')]({},_0x469db5,_0x10e966[_0x2c19('0x62')]);return _0x5414d0['getApplications'](_0x469db5);}})[_0x2c19('0x25')](function(_0x1f87fa){if(_0x1f87fa){_0x45bce4=_0x1f87fa[_0x2c19('0x55')];if(!_0x10e966[_0x2c19('0x4f')][_0x2c19('0x56')](_0x2c19('0x57'))){_0x469db5[_0x2c19('0x37')]=qs['limit'](_0x10e966[_0x2c19('0x4f')][_0x2c19('0x37')]);_0x469db5[_0x2c19('0x34')]=qs[_0x2c19('0x34')](_0x10e966[_0x2c19('0x4f')]['offset']);}return _0x5414d0[_0x2c19('0xa3')](_0x469db5);}})[_0x2c19('0x25')](function(_0x1a317a){if(_0x1a317a){return _0x1a317a?{'count':_0x45bce4,'rows':_0x1a317a}:null;}})[_0x2c19('0x25')](respondWithResult(_0x380a0,null))[_0x2c19('0x2f')](handleError(_0x380a0,null));};exports['getMessages']=function(_0x3e6cb3,_0x2f3b60,_0xbee67d){var _0x15caaf={'raw':!![],'where':{}};var _0x176be={};var _0x4270fd={'count':0x0,'rows':[]};return db['MailAccount'][_0x2c19('0x6b')]({'where':{'id':_0x3e6cb3['params']['id']}})[_0x2c19('0x25')](handleEntityNotFound(_0x2f3b60,null))[_0x2c19('0x25')](function(_0xa75182){if(_0xa75182){_0x176be[_0x2c19('0x4e')]=_[_0x2c19('0x50')](db[_0x2c19('0xa4')]['rawAttributes']);_0x176be['query']=_[_0x2c19('0x50')](_0x3e6cb3[_0x2c19('0x4f')]);_0x176be[_0x2c19('0x51')]=_[_0x2c19('0x52')](_0x176be[_0x2c19('0x4e')],_0x176be[_0x2c19('0x4f')]);_0x15caaf['attributes']=_[_0x2c19('0x52')](_0x176be[_0x2c19('0x4e')],qs['fields'](_0x3e6cb3['query'][_0x2c19('0x53')]));_0x15caaf['attributes']=_0x15caaf[_0x2c19('0x54')][_0x2c19('0x55')]?_0x15caaf['attributes']:_0x176be[_0x2c19('0x4e')];if(!_0x3e6cb3[_0x2c19('0x4f')][_0x2c19('0x56')](_0x2c19('0x57'))){_0x15caaf[_0x2c19('0x37')]=qs['limit'](_0x3e6cb3[_0x2c19('0x4f')][_0x2c19('0x37')]);_0x15caaf['offset']=qs['offset'](_0x3e6cb3['query'][_0x2c19('0x34')]);}_0x15caaf[_0x2c19('0x58')]=qs['sort'](_0x3e6cb3['query'][_0x2c19('0x59')]);_0x15caaf[_0x2c19('0x5a')]=qs[_0x2c19('0x51')](_['pick'](_0x3e6cb3[_0x2c19('0x4f')],_0x176be[_0x2c19('0x51')]));_0x15caaf['where'][_0x2c19('0x68')]=_0xa75182['id'];if(_0x3e6cb3[_0x2c19('0x4f')][_0x2c19('0x5b')]){_0x15caaf[_0x2c19('0x5a')]=_['merge'](_0x15caaf[_0x2c19('0x5a')],{'$or':_[_0x2c19('0x4a')](_0x15caaf[_0x2c19('0x54')],function(_0x1b4c9e){var _0x226b3c={};_0x226b3c[_0x1b4c9e]={'$like':'%'+_0x3e6cb3[_0x2c19('0x4f')][_0x2c19('0x5b')]+'%'};return _0x226b3c;})});}if(_0x3e6cb3[_0x2c19('0x4f')][_0x2c19('0xa5')]){var _0x8e743f=_0x3e6cb3[_0x2c19('0x4f')][_0x2c19('0xa5')][_0x2c19('0xa6')](',');var _0x1433de={};_0x1433de[_0x8e743f[0x0]]={'$gte':moment(_0x8e743f[0x1])[_0x2c19('0xa7')](_0x2c19('0xa8'))};_0x15caaf[_0x2c19('0x5a')]=_['merge'](_0x15caaf[_0x2c19('0x5a')],_0x1433de);}_0x15caaf=_[_0x2c19('0x5c')]({},_0x15caaf,_0x3e6cb3['options']);return db[_0x2c19('0xa4')][_0x2c19('0x36')]({'where':_0x15caaf['where']})[_0x2c19('0x25')](function(_0x108513){_0x4270fd['count']=_0x108513;if(_0x3e6cb3['query'][_0x2c19('0x5d')]){_0x15caaf[_0x2c19('0x5e')]=[{'all':!![]}];}return db[_0x2c19('0xa4')][_0x2c19('0x5f')](_0x15caaf);})['then'](function(_0x265907){if(_0x3e6cb3[_0x2c19('0x4f')][_0x2c19('0xa9')]===_0x2c19('0xaa')){for(var _0x2772a6=0x0;_0x2772a6<_0x265907[_0x2c19('0x55')];_0x2772a6++){_0x265907[_0x2772a6][_0x2c19('0x64')]=juice(_0x265907[_0x2772a6][_0x2c19('0x64')]);}}_0x4270fd[_0x2c19('0x60')]=_0x265907;return _0x4270fd;});}})[_0x2c19('0x25')](respondWithFilteredResult(_0x2f3b60,_0x15caaf))[_0x2c19('0x2f')](handleError(_0x2f3b60,null));};exports['send']=function(_0xf7e353,_0x463739,_0x108905){var _0x315512,_0x113f86={},_0x5c5445;if(_0xf7e353[_0x2c19('0x64')]['to']){_0x5c5445=_0xf7e353[_0x2c19('0x64')]['to'][_0x2c19('0xa6')](',')[0x0];}return db[_0x2c19('0x4b')][_0x2c19('0x63')]({'where':{'id':_0xf7e353[_0x2c19('0x65')]['id']},'include':[{'model':db[_0x2c19('0xab')],'as':_0x2c19('0xac'),'include':[{'model':db[_0x2c19('0x91')],'as':_0x2c19('0xad'),'where':{'email':_0x5c5445},'limit':0x1,'order':[[_0x2c19('0xae'),_0x2c19('0xaf')]]}]},{'model':db[_0x2c19('0x46')],'as':_0x2c19('0x47'),'raw':!![]}]})[_0x2c19('0x25')](handleEntityNotFound(_0x463739,null))[_0x2c19('0x25')](function(_0xb467bd){if(_0xb467bd){_0x315512=_0xb467bd;if(_0xb467bd[_0x2c19('0x47')]){if(_[_0x2c19('0x76')](_0xf7e353['body'][_0x2c19('0xb0')])){_0xf7e353[_0x2c19('0x64')][_0x2c19('0xb0')]=util['format'](_0x2c19('0xb1'),_0xb467bd[_0x2c19('0x42')],_0xb467bd[_0x2c19('0x74')]||_0xb467bd['Smtp'][_0x2c19('0x7a')]);}if(_0xf7e353['body'][_0x2c19('0xb2')]&&_0xf7e353[_0x2c19('0x64')]['attachments'][_0x2c19('0x55')]){for(var _0x3ff143=0x0;_0x3ff143<_0xf7e353['body'][_0x2c19('0xb2')]['length'];_0x3ff143+=0x1){_0xf7e353['body'][_0x2c19('0xb2')][_0x3ff143]={'filename':_0xf7e353['body'][_0x2c19('0xb2')][_0x3ff143][_0x2c19('0x42')],'path':path['join'](config[_0x2c19('0xb3')],_0x2c19('0xb4'),_0xf7e353['body'][_0x2c19('0xb2')][_0x3ff143][_0x2c19('0xb5')])};}}var _0x46350f={'tls':{'rejectUnauthorized':![]}};if(_[_0x2c19('0x76')](_0xb467bd['Smtp'][_0x2c19('0x81')])){if(_0xb467bd['Smtp'][_0x2c19('0x7e')]){_0x46350f[_0x2c19('0xb6')]={'user':_0xb467bd[_0x2c19('0x47')][_0x2c19('0x7a')],'pass':_0xb467bd[_0x2c19('0x47')]['pass']};}_0x46350f[_0x2c19('0x7f')]=_0xb467bd[_0x2c19('0x47')]['host'];_0x46350f[_0x2c19('0x80')]=_0xb467bd[_0x2c19('0x47')]['port'];_0x46350f[_0x2c19('0xb7')]=_0xb467bd['Smtp']['secure'];}else{_0x46350f[_0x2c19('0x81')]=_0xb467bd[_0x2c19('0x47')]['service'];_0x46350f[_0x2c19('0xb6')]={'user':_0xb467bd[_0x2c19('0x47')][_0x2c19('0x7a')],'pass':_0xb467bd[_0x2c19('0x47')][_0x2c19('0x7c')]};}return respondWithRpcPromise(_0x2c19('0xb8'),_0x2c19('0xb9'),{'account':_0x46350f,'message':_0xf7e353[_0x2c19('0x64')]});}else{throw new Error('List\x20not\x20found');}}})[_0x2c19('0x25')](function(_0x48b86e){if(_0x48b86e){_0x113f86=_0x48b86e;if(_0x315512[_0x2c19('0xac')]){if(_0x315512[_0x2c19('0xac')][_0x2c19('0xad')][_0x2c19('0x55')]){return _0x315512[_0x2c19('0xac')][_0x2c19('0xad')][0x0];}else{return db[_0x2c19('0x91')]['create'](_[_0x2c19('0x20')](_0xf7e353['body'],{'firstName':_0xf7e353[_0x2c19('0x64')]['to'],'email':_0xf7e353[_0x2c19('0x64')]['to'],'phone':_0xf7e353['body']['to'],'ListId':_0x315512['ListId']}));}}else{throw new Error(_0x2c19('0xba'));}}})[_0x2c19('0x25')](function(_0xcb0140){if(_0xcb0140){var _0xb3e380={'UserId':_0xf7e353[_0x2c19('0x7a')]['id'],'ContactId':_0xcb0140['id'],'MailAccountId':_0x315512['id'],'inReplyTo':_0x113f86[_0x2c19('0xbb')],'to':_0xf7e353['body']['from'],'cc':_0xf7e353[_0x2c19('0x64')]['cc'],'subject':_0xf7e353[_0x2c19('0x64')][_0x2c19('0xbc')],'attach':_0xf7e353[_0x2c19('0x64')][_0x2c19('0xbd')],'firstMsgDirection':_0x2c19('0xbe'),'lastMsgAt':moment()[_0x2c19('0xa7')](_0x2c19('0xa8')),'lastMsgDirection':_0x2c19('0xbe'),'Messages':[_[_0x2c19('0x5c')](_0xf7e353[_0x2c19('0x64')],{'messageId':_0x113f86['messageId'],'sentAt':moment()[_0x2c19('0xa7')](_0x2c19('0xa8')),'read':!![],'MailAccountId':_0x315512['id'],'UserId':_0xf7e353[_0x2c19('0x7a')]['id'],'ContactId':_0xcb0140['id']})]};if(_0xf7e353['body'][_0x2c19('0xbf')]){_0xb3e380=_[_0x2c19('0x5c')](_0xb3e380,_0xf7e353[_0x2c19('0x64')][_0x2c19('0xbf')]);}return db[_0x2c19('0x8e')]['create'](_0xb3e380,{'include':[{'model':db[_0x2c19('0xa4')],'as':_0x2c19('0xc0')}]});}})[_0x2c19('0x25')](respondWithResult(_0x463739,null))['catch'](handleError(_0x463739,null));};exports['verifySmtp']=function(_0x35dc35,_0x8a93fc,_0x74bdeb){return db[_0x2c19('0x4b')][_0x2c19('0x63')]({'where':{'id':_0x35dc35[_0x2c19('0x65')]['id']},'include':[{'model':db[_0x2c19('0x46')],'as':'Smtp','raw':!![]}]})[_0x2c19('0x25')](handleEntityNotFound(_0x8a93fc,null))['then'](function(_0x52cf1f){if(_0x52cf1f&&_0x52cf1f[_0x2c19('0x47')]){var _0x1fb11e={'id':_0x52cf1f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x52cf1f['Smtp'][_0x2c19('0x81')]){_0x1fb11e[_0x2c19('0x81')]=_0x52cf1f['Smtp'][_0x2c19('0x81')];}else{_0x1fb11e['host']=_0x52cf1f[_0x2c19('0x47')]['host'];_0x1fb11e[_0x2c19('0x80')]=_0x52cf1f[_0x2c19('0x47')][_0x2c19('0x80')];_0x1fb11e[_0x2c19('0xb7')]=_0x52cf1f[_0x2c19('0x47')][_0x2c19('0xb7')];}if(_0x52cf1f[_0x2c19('0x47')][_0x2c19('0x7e')]){_0x1fb11e['auth']={'user':_0x52cf1f[_0x2c19('0x47')][_0x2c19('0x7a')],'pass':_0x52cf1f['Smtp'][_0x2c19('0x7c')]};}return respondWithRpcPromise(_0x2c19('0xc1'),_0x2c19('0xc2'),{'account':_0x1fb11e});}})[_0x2c19('0x25')](respondWithResult(_0x8a93fc,null))[_0x2c19('0x2f')](handleError(_0x8a93fc,null));};exports[_0x2c19('0x3e')]=function(_0x38ee63,_0x1c7d5c){return db[_0x2c19('0x4b')]['find']({'where':{'id':_0x38ee63[_0x2c19('0x65')]['id']}})[_0x2c19('0x25')](handleEntityNotFound(_0x1c7d5c,null))[_0x2c19('0x25')](function(_0x3a82a0){if(_0x3a82a0&&_0x3a82a0[_0x2c19('0x81')]){throw new db[(_0x2c19('0xc3'))]['ValidationError'](_0x2c19('0xc4'));}return _0x3a82a0;})[_0x2c19('0x25')](removeEntity(_0x1c7d5c,null))[_0x2c19('0x2f')](handleError(_0x1c7d5c,null));};exports['addAgents']=function(_0x22124a,_0x3a9cf5,_0x470d25){return db[_0x2c19('0x4b')][_0x2c19('0x63')]({'where':{'id':_0x22124a['params']['id']}})[_0x2c19('0x25')](handleEntityNotFound(_0x3a9cf5,null))[_0x2c19('0x25')](function(_0x1ac4e7){if(_0x1ac4e7){return _0x1ac4e7['addAgents'](_0x22124a['body'][_0x2c19('0x6e')],_[_0x2c19('0x8f')](_0x22124a['body'],[_0x2c19('0x6e'),'id'])||{})['spread'](function(_0x5ede32){for(var _0x3e640d=0x0;_0x3e640d<_0x22124a[_0x2c19('0x64')][_0x2c19('0x6e')][_0x2c19('0x55')];_0x3e640d+=0x1){socket['emit'](_0x2c19('0xc5'),{'UserId':Number(_0x22124a[_0x2c19('0x64')][_0x2c19('0x6e')][_0x3e640d]),'MailAccountId':Number(_0x22124a[_0x2c19('0x65')]['id'])});}return _0x5ede32;});}})['then'](respondWithResult(_0x3a9cf5,null))[_0x2c19('0x2f')](handleError(_0x3a9cf5,null));};exports['removeAgents']=function(_0x32ca9f,_0x28e37a,_0x711635){return db[_0x2c19('0x4b')][_0x2c19('0x63')]({'where':{'id':_0x32ca9f['params']['id']}})[_0x2c19('0x25')](handleEntityNotFound(_0x28e37a,null))[_0x2c19('0x25')](function(_0x1a8d59){if(_0x1a8d59){return _0x1a8d59[_0x2c19('0xc6')](_0x32ca9f[_0x2c19('0x4f')][_0x2c19('0x6e')])[_0x2c19('0x25')](function(){if(_[_0x2c19('0xc7')](_0x32ca9f[_0x2c19('0x4f')][_0x2c19('0x6e')])){for(var _0x22950a=0x0;_0x22950a<_0x32ca9f[_0x2c19('0x4f')][_0x2c19('0x6e')][_0x2c19('0x55')];_0x22950a+=0x1){socket[_0x2c19('0xc8')](_0x2c19('0xc9'),{'UserId':Number(_0x32ca9f[_0x2c19('0x4f')][_0x2c19('0x6e')][_0x22950a]),'MailAccountId':Number(_0x32ca9f[_0x2c19('0x65')]['id'])});}}else{socket[_0x2c19('0xc8')](_0x2c19('0xc9'),{'UserId':Number(_0x32ca9f[_0x2c19('0x4f')]['ids']),'MailAccountId':Number(_0x32ca9f['params']['id'])});}});}})[_0x2c19('0x25')](respondWithStatusCode(_0x28e37a,null))['catch'](handleError(_0x28e37a,null));};exports[_0x2c19('0xca')]=function(_0x2ff19c,_0x2c80ab,_0x573233){var _0x4834db={};var _0x3d044e={};var _0x57442b;var _0x536ece;return db[_0x2c19('0x4b')][_0x2c19('0x6b')]({'where':{'id':_0x2ff19c[_0x2c19('0x65')]['id']}})[_0x2c19('0x25')](handleEntityNotFound(_0x2c80ab,null))[_0x2c19('0x25')](function(_0x571812){if(_0x571812){_0x57442b=_0x571812;_0x3d044e['model']=_[_0x2c19('0x50')](db[_0x2c19('0x93')][_0x2c19('0x4c')]);_0x3d044e[_0x2c19('0x4f')]=_[_0x2c19('0x50')](_0x2ff19c['query']);_0x3d044e[_0x2c19('0x51')]=_[_0x2c19('0x52')](_0x3d044e[_0x2c19('0x4e')],_0x3d044e[_0x2c19('0x4f')]);_0x4834db[_0x2c19('0x54')]=_[_0x2c19('0x52')](_0x3d044e[_0x2c19('0x4e')],qs['fields'](_0x2ff19c[_0x2c19('0x4f')][_0x2c19('0x53')]));_0x4834db[_0x2c19('0x54')]=_0x4834db[_0x2c19('0x54')][_0x2c19('0x55')]?_0x4834db[_0x2c19('0x54')]:_0x3d044e[_0x2c19('0x4e')];_0x4834db[_0x2c19('0x58')]=qs[_0x2c19('0x59')](_0x2ff19c[_0x2c19('0x4f')][_0x2c19('0x59')]);_0x4834db['where']=qs[_0x2c19('0x51')](_[_0x2c19('0x6c')](_0x2ff19c[_0x2c19('0x4f')],_0x3d044e['filters']));if(_0x2ff19c[_0x2c19('0x4f')][_0x2c19('0x5b')]){_0x4834db[_0x2c19('0x5a')]=_['merge'](_0x4834db['where'],{'$or':_[_0x2c19('0x4a')](_0x4834db['attributes'],function(_0x60e63b){var _0x2aeb46={};_0x2aeb46[_0x60e63b]={'$like':'%'+_0x2ff19c['query']['filter']+'%'};return _0x2aeb46;})});}_0x4834db=_[_0x2c19('0x5c')]({},_0x4834db,_0x2ff19c['options']);return _0x57442b[_0x2c19('0xca')](_0x4834db);}})[_0x2c19('0x25')](function(_0x314573){if(_0x314573){_0x536ece=_0x314573[_0x2c19('0x55')];if(!_0x2ff19c['query'][_0x2c19('0x56')](_0x2c19('0x57'))){_0x4834db['limit']=qs[_0x2c19('0x37')](_0x2ff19c[_0x2c19('0x4f')][_0x2c19('0x37')]);_0x4834db['offset']=qs[_0x2c19('0x34')](_0x2ff19c[_0x2c19('0x4f')][_0x2c19('0x34')]);}return _0x57442b['getAgents'](_0x4834db);}})[_0x2c19('0x25')](function(_0x5e8644){if(_0x5e8644){return _0x5e8644?{'count':_0x536ece,'rows':_0x5e8644}:null;}})[_0x2c19('0x25')](respondWithResult(_0x2c80ab,null))[_0x2c19('0x2f')](handleError(_0x2c80ab,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 08954b4..5e4fe5c 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 _0x4329=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','MailAccount','setMaxListeners','save'];(function(_0xb30689,_0x59a222){var _0x2bed52=function(_0x3a8e4a){while(--_0x3a8e4a){_0xb30689['push'](_0xb30689['shift']());}};_0x2bed52(++_0x59a222);}(_0x4329,0x13b));var _0x9432=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4329[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0x9432('0x0'));var MailAccount=require(_0x9432('0x1'))['db'][_0x9432('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x9432('0x3')](0x0);var events={'afterCreate':_0x9432('0x4'),'afterUpdate':_0x9432('0x5'),'afterDestroy':_0x9432('0x6')};function emitEvent(_0xfbc97c){return function(_0x2b1e79,_0x5796ef,_0x13add2){MailAccountEvents[_0x9432('0x7')](_0xfbc97c+':'+_0x2b1e79['id'],_0x2b1e79);MailAccountEvents[_0x9432('0x7')](_0xfbc97c,_0x2b1e79);_0x13add2(null);};}for(var e in events){if(events[_0x9432('0x8')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x9432('0x9')]=MailAccountEvents; \ No newline at end of file +var _0xa751=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','update'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xa751,0x175));var _0x1a75=function(_0x210926,_0x329a06){_0x210926=_0x210926-0x0;var _0x1b5f0=_0xa751[_0x210926];return _0x1b5f0;};'use strict';var EventEmitter=require(_0x1a75('0x0'));var MailAccount=require(_0x1a75('0x1'))['db'][_0x1a75('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x1a75('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1a75('0x4'),'afterDestroy':'remove'};function emitEvent(_0x31db55){return function(_0x95fa7,_0x2ea393,_0x4ebf37){MailAccountEvents[_0x1a75('0x5')](_0x31db55+':'+_0x95fa7['id'],_0x95fa7);MailAccountEvents[_0x1a75('0x5')](_0x31db55,_0x95fa7);_0x4ebf37(null);};}for(var e in events){if(events[_0x1a75('0x6')](e)){var event=events[e];MailAccount[_0x1a75('0x7')](e,emitEvent(event));}}module[_0x1a75('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 732f737..a53c2fe 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 _0xf0cd=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger'];(function(_0x1c8de7,_0x5555be){var _0x328b05=function(_0x512c9c){while(--_0x512c9c){_0x1c8de7['push'](_0x1c8de7['shift']());}};_0x328b05(++_0x5555be);}(_0xf0cd,0xd9));var _0xdf0c=function(_0x45e299,_0x37704d){_0x45e299=_0x45e299-0x0;var _0x1a895f=_0xf0cd[_0x45e299];return _0x1a895f;};'use strict';var _=require(_0xdf0c('0x0'));var util=require(_0xdf0c('0x1'));var logger=require(_0xdf0c('0x2'))(_0xdf0c('0x3'));var moment=require(_0xdf0c('0x4'));var BPromise=require(_0xdf0c('0x5'));var rp=require(_0xdf0c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdf0c('0x7'));var config=require(_0xdf0c('0x8'));var attributes=require('./mailAccount.attributes');module[_0xdf0c('0x9')]=function(_0xb7a73d,_0x456c81){return _0xb7a73d[_0xdf0c('0xa')]('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d07=['../../config/logger','api','moment','path','../../config/environment','./mailAccount.attributes','exports','MailAccount','lodash'];(function(_0x48f8fa,_0xd15238){var _0x499316=function(_0x1d10b5){while(--_0x1d10b5){_0x48f8fa['push'](_0x48f8fa['shift']());}};_0x499316(++_0xd15238);}(_0x0d07,0x104));var _0x70d0=function(_0x5c4990,_0x5c7ee8){_0x5c4990=_0x5c4990-0x0;var _0x1462a7=_0x0d07[_0x5c4990];return _0x1462a7;};'use strict';var _=require(_0x70d0('0x0'));var util=require('util');var logger=require(_0x70d0('0x1'))(_0x70d0('0x2'));var moment=require(_0x70d0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x70d0('0x4'));var rimraf=require('rimraf');var config=require(_0x70d0('0x5'));var attributes=require(_0x70d0('0x6'));module[_0x70d0('0x7')]=function(_0x58abc5,_0x1ec064){return _0x58abc5['define'](_0x70d0('0x8'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index c14d1d8..8ad670c 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 _0x3b71=['*,*,*,*','Contacts','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','created','attachments','originTo','originCc','bcc','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','User','name','unshift','agent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','defaults','localhost','socket.io-emitter','redis','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','MailAccount','findAll','options','where','attributes','limit','include','map','model','GetMailAccount','debug','ShowMailAccount','find','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','MailApplication','Applications','MailServerOut','Smtp','get','omit','List','applications','list','priority','push','length','autoclose'];(function(_0x32e2eb,_0x3347b7){var _0x2418ce=function(_0x13ed52){while(--_0x13ed52){_0x32e2eb['push'](_0x32e2eb['shift']());}};_0x2418ce(++_0x3347b7);}(_0x3b71,0x164));var _0x13b7=function(_0x58a1d9,_0x5e8b8d){_0x58a1d9=_0x58a1d9-0x0;var _0x3e36a1=_0x3b71[_0x58a1d9];return _0x3e36a1;};'use strict';var _=require(_0x13b7('0x0'));var util=require(_0x13b7('0x1'));var moment=require('moment');var BPromise=require(_0x13b7('0x2'));var rs=require(_0x13b7('0x3'));var fs=require('fs');var Redis=require(_0x13b7('0x4'));var db=require(_0x13b7('0x5'))['db'];var utils=require(_0x13b7('0x6'));var logger=require(_0x13b7('0x7'))(_0x13b7('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x13b7('0x9')]['http']({'port':0x232c});config['redis']=_[_0x13b7('0xa')](config['redis'],{'host':_0x13b7('0xb'),'port':0x18eb});var socket=require(_0x13b7('0xc'))(new Redis(config[_0x13b7('0xd')]));require(_0x13b7('0xe'))[_0x13b7('0xf')](socket);function respondWithRpcPromise(_0x33ad35,_0x2e03aa,_0x1327c0){return new BPromise(function(_0x522649,_0x2990bb){return client[_0x13b7('0x10')](_0x33ad35,_0x1327c0)[_0x13b7('0x11')](function(_0x32e122){logger[_0x13b7('0x12')](_0x13b7('0x13'),_0x2e03aa,_0x13b7('0x14'));logger['debug'](_0x13b7('0x15'),_0x2e03aa,_0x13b7('0x14'),JSON[_0x13b7('0x16')](_0x32e122));if(_0x32e122[_0x13b7('0x17')]){if(_0x32e122['error']['code']===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x2e03aa,_0x32e122[_0x13b7('0x17')][_0x13b7('0x18')]);return _0x2990bb(_0x32e122['error'][_0x13b7('0x18')]);}logger['error'](_0x13b7('0x13'),_0x2e03aa,_0x32e122[_0x13b7('0x17')][_0x13b7('0x18')]);return _0x522649(_0x32e122[_0x13b7('0x17')][_0x13b7('0x18')]);}else{logger[_0x13b7('0x12')]('MailAccount,\x20%s,\x20%s',_0x2e03aa,_0x13b7('0x14'));_0x522649(_0x32e122[_0x13b7('0x19')][_0x13b7('0x18')]);}})[_0x13b7('0x1a')](function(_0x18cf49){logger[_0x13b7('0x17')](_0x13b7('0x13'),_0x2e03aa,_0x18cf49);_0x2990bb(_0x18cf49);});});}exports['GetMailAccount']=function(_0x381bd7){var _0x59d9e3=this;return new Promise(function(_0x5c00bc,_0x94fdb5){return db[_0x13b7('0x1b')][_0x13b7('0x1c')]({'raw':_0x381bd7[_0x13b7('0x1d')]?_0x381bd7[_0x13b7('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x381bd7['options']?_0x381bd7[_0x13b7('0x1d')][_0x13b7('0x1e')]||null:null,'attributes':_0x381bd7[_0x13b7('0x1d')]?_0x381bd7['options'][_0x13b7('0x1f')]||null:null,'limit':_0x381bd7[_0x13b7('0x1d')]?_0x381bd7[_0x13b7('0x1d')][_0x13b7('0x20')]||null:null,'include':_0x381bd7[_0x13b7('0x1d')]?_0x381bd7[_0x13b7('0x1d')]['include']?_['map'](_0x381bd7['options'][_0x13b7('0x21')],function(_0x277fbe){return{'model':db[_0x277fbe['model']],'as':_0x277fbe['as'],'attributes':_0x277fbe[_0x13b7('0x1f')],'include':_0x277fbe['include']?_[_0x13b7('0x22')](_0x277fbe[_0x13b7('0x21')],function(_0x16e0ae){return{'model':db[_0x16e0ae[_0x13b7('0x23')]],'as':_0x16e0ae['as'],'attributes':_0x16e0ae[_0x13b7('0x1f')],'include':_0x16e0ae[_0x13b7('0x21')]?_[_0x13b7('0x22')](_0x16e0ae['include'],function(_0x460f17){return{'model':db[_0x460f17[_0x13b7('0x23')]],'as':_0x460f17['as'],'attributes':_0x460f17[_0x13b7('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x481fbe){logger[_0x13b7('0x12')](_0x13b7('0x24'),_0x381bd7);logger[_0x13b7('0x25')](_0x13b7('0x24'),_0x381bd7,JSON[_0x13b7('0x16')](_0x481fbe));_0x5c00bc(_0x481fbe);})[_0x13b7('0x1a')](function(_0x1abd75){logger['error']('GetMailAccount',_0x1abd75[_0x13b7('0x18')],_0x381bd7);_0x94fdb5(_0x59d9e3[_0x13b7('0x17')](0x1f4,_0x1abd75[_0x13b7('0x18')]));});});};exports[_0x13b7('0x26')]=function(_0x3cabbf){var _0x18c0fd=this;return new Promise(function(_0x5adc8b,_0x115910){return db['MailAccount'][_0x13b7('0x27')]({'raw':_0x3cabbf[_0x13b7('0x1d')]?_0x3cabbf['options']['raw']===undefined?!![]:![]:!![],'where':_0x3cabbf['options']?_0x3cabbf[_0x13b7('0x1d')]['where']||null:null,'attributes':_0x3cabbf[_0x13b7('0x1d')]?_0x3cabbf[_0x13b7('0x1d')][_0x13b7('0x1f')]||null:null,'include':_0x3cabbf[_0x13b7('0x1d')]?_0x3cabbf[_0x13b7('0x1d')]['include']?_[_0x13b7('0x22')](_0x3cabbf[_0x13b7('0x1d')]['include'],function(_0x5541cd){return{'model':db[_0x5541cd[_0x13b7('0x23')]],'as':_0x5541cd['as'],'attributes':_0x5541cd[_0x13b7('0x1f')],'include':_0x5541cd[_0x13b7('0x21')]?_[_0x13b7('0x22')](_0x5541cd['include'],function(_0x39ceb5){return{'model':db[_0x39ceb5[_0x13b7('0x23')]],'as':_0x39ceb5['as'],'attributes':_0x39ceb5['attributes'],'include':_0x39ceb5[_0x13b7('0x21')]?_[_0x13b7('0x22')](_0x39ceb5[_0x13b7('0x21')],function(_0x12604d){return{'model':db[_0x12604d['model']],'as':_0x12604d['as'],'attributes':_0x12604d[_0x13b7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x13b7('0x11')](function(_0xfc87b7){logger['info'](_0x13b7('0x26'),_0x3cabbf);logger[_0x13b7('0x25')](_0x13b7('0x26'),_0x3cabbf,JSON['stringify'](_0xfc87b7));_0x5adc8b(_0xfc87b7);})[_0x13b7('0x1a')](function(_0x9963d6){logger[_0x13b7('0x17')](_0x13b7('0x26'),_0x9963d6['message'],_0x3cabbf);_0x115910(_0x18c0fd[_0x13b7('0x17')](0x1f4,_0x9963d6['message']));});});};exports[_0x13b7('0x28')]=function(_0x33a6e2){var _0x597c54=this;return new Promise(function(_0x681f25,_0x3ecbb3){var _0x38b1c3={'body':_0x33a6e2['body'],'channel':_0x13b7('0x29')};var _0x1f9850=_[_0x13b7('0x2a')](_[_0x13b7('0x2b')](db[_0x13b7('0x2c')][_0x13b7('0x2d')]),['createdAt','updatedAt',_0x13b7('0x2e'),_0x13b7('0x2f')]);var _0x3638cd=![];if(_0x33a6e2[_0x13b7('0x30')]['id']){delete _0x33a6e2[_0x13b7('0x30')]['id'];}if(_[_0x13b7('0x31')](_0x33a6e2[_0x13b7('0x30')][_0x13b7('0x32')])){return _0x3ecbb3(_0x597c54[_0x13b7('0x17')](0x1f4,_0x13b7('0x33')));}if(_['isNil'](_0x33a6e2[_0x13b7('0x30')][_0x13b7('0x30')])||_0x33a6e2[_0x13b7('0x30')][_0x13b7('0x30')]===''){return _0x3ecbb3(_0x597c54[_0x13b7('0x17')](0x1f4,_0x13b7('0x34')));}if(_[_0x13b7('0x31')](_0x33a6e2['body'][_0x13b7('0x35')])){return _0x3ecbb3(_0x597c54[_0x13b7('0x17')](0x1f4,_0x13b7('0x36')+_0x1f9850));}if(!_[_0x13b7('0x37')](_0x1f9850,_0x33a6e2[_0x13b7('0x30')][_0x13b7('0x35')])){return _0x3ecbb3(_0x597c54[_0x13b7('0x17')](0x1f4,_0x13b7('0x38')+_0x1f9850));}var _0x4ec7d4={};_0x4ec7d4[_0x33a6e2[_0x13b7('0x30')][_0x13b7('0x35')]]=_0x33a6e2[_0x13b7('0x30')][_0x13b7('0x32')];return db[_0x13b7('0x1b')][_0x13b7('0x27')]({'where':{'id':_0x33a6e2[_0x13b7('0x39')]['id']},'include':[{'model':db[_0x13b7('0x3a')],'as':'List','include':[{'model':db[_0x13b7('0x2c')],'as':'Contacts','where':_0x4ec7d4,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x13b7('0x3b')],'as':_0x13b7('0x3c')},{'model':db[_0x13b7('0x3d')],'as':_0x13b7('0x3e')}]})[_0x13b7('0x11')](function(_0x2a9883){if(_0x2a9883&&_0x2a9883['List']){var _0x328096=_0x2a9883[_0x13b7('0x3f')]({'plain':!![]});_0x38b1c3['account']=_[_0x13b7('0x40')](_0x328096,[_0x13b7('0x3c'),_0x13b7('0x41')]);_0x38b1c3[_0x13b7('0x42')]=_0x328096[_0x13b7('0x3c')];_0x38b1c3[_0x13b7('0x43')]=_0x328096[_0x13b7('0x41')];_0x38b1c3[_0x13b7('0x42')]=_['orderBy'](_0x38b1c3[_0x13b7('0x42')],[_0x13b7('0x44')],['asc']);if(_0x38b1c3[_0x13b7('0x39')]&&_0x38b1c3[_0x13b7('0x39')]['autoclose']){_0x38b1c3[_0x13b7('0x42')][_0x13b7('0x45')]({'id':0x0,'priority':_0x38b1c3['applications'][_0x13b7('0x46')]+0x1,'app':'close','appdata':_0x13b7('0x47'),'interval':_0x13b7('0x48')});}if(_0x38b1c3[_0x13b7('0x39')][_0x13b7('0x3c')]){delete _0x38b1c3[_0x13b7('0x39')][_0x13b7('0x3c')];}if(_0x38b1c3[_0x13b7('0x39')][_0x13b7('0x41')]){delete _0x38b1c3[_0x13b7('0x39')][_0x13b7('0x41')];}if(_0x328096[_0x13b7('0x41')][_0x13b7('0x49')][_0x13b7('0x46')]){return _0x328096['List'][_0x13b7('0x49')][0x0];}var _0x6df349=_[_0x13b7('0xa')](_0x33a6e2[_0x13b7('0x30')],{'firstName':_0x33a6e2['body'][_0x13b7('0x32')],'ListId':_0x328096[_0x13b7('0x2f')]});_0x6df349[_0x33a6e2['body'][_0x13b7('0x35')]]=_0x33a6e2[_0x13b7('0x30')]['from'];return db[_0x13b7('0x2c')][_0x13b7('0x4a')](_0x6df349);}else{throw new Error(_0x13b7('0x4b'));}})[_0x13b7('0x11')](function(_0x311722){_0x38b1c3[_0x13b7('0x4c')]=_0x311722;if(_0x311722){if(!_0x33a6e2['body']['message'][_0x13b7('0x4d')]){_0x33a6e2[_0x13b7('0x30')][_0x13b7('0x18')][_0x13b7('0x4d')]=rs[_0x13b7('0x4e')]()+'\x20'+_0x33a6e2['body'][_0x13b7('0x18')][_0x13b7('0x32')];}var _0x4125e0={'ContactId':_0x311722['id'],'MailAccountId':_0x33a6e2[_0x13b7('0x39')]['id'],'inReplyTo':_0x33a6e2[_0x13b7('0x30')][_0x13b7('0x18')][_0x13b7('0x4d')],'to':_0x33a6e2[_0x13b7('0x30')]['message'][_0x13b7('0x32')],'cc':_0x33a6e2['body'][_0x13b7('0x18')]['cc'],'subject':_0x33a6e2[_0x13b7('0x30')][_0x13b7('0x18')][_0x13b7('0x4f')],'attach':_0x33a6e2[_0x13b7('0x30')][_0x13b7('0x18')][_0x13b7('0x50')],'lastMsgAt':moment()[_0x13b7('0x51')](_0x13b7('0x52')),'lastMsgDirection':'in'};return db[_0x13b7('0x53')][_0x13b7('0x27')]({'where':{'closed':![],'MailAccountId':_0x33a6e2['account']['id']},'include':[{'model':db[_0x13b7('0x54')],'as':_0x13b7('0x55'),'attributes':[_0x13b7('0x4d')],'where':{'messageId':_0x33a6e2[_0x13b7('0x30')][_0x13b7('0x18')][_0x13b7('0x56')]}}]})['then'](function(_0x5236e5){if(_0x5236e5){return[_0x5236e5,![]];}return db[_0x13b7('0x53')]['create'](_0x4125e0)[_0x13b7('0x11')](function(_0xc41ad2){return[_0xc41ad2,!![]];});});}else{throw new Error(_0x13b7('0x57'));}})[_0x13b7('0x58')](function(_0x1634ce,_0x446f3a){if(_0x1634ce){_0x3638cd=_0x446f3a;if(!_0x446f3a){return _0x1634ce[_0x13b7('0x59')]({'inReplyTo':_0x33a6e2[_0x13b7('0x30')][_0x13b7('0x18')][_0x13b7('0x4d')],'to':_0x33a6e2[_0x13b7('0x30')]['message'][_0x13b7('0x32')],'cc':_0x33a6e2[_0x13b7('0x30')][_0x13b7('0x18')]['cc'],'subject':_0x33a6e2[_0x13b7('0x30')][_0x13b7('0x18')][_0x13b7('0x4f')],'attach':_0x1634ce[_0x13b7('0x50')]?_0x1634ce[_0x13b7('0x50')]:_0x33a6e2[_0x13b7('0x30')][_0x13b7('0x18')][_0x13b7('0x50')],'substatus':null,'substatusAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x13b7('0x51')](_0x13b7('0x52')),'lastMsgDirection':'in'});}else{return _0x1634ce;}}})[_0x13b7('0x11')](function(_0x5cfba3){_0x38b1c3[_0x13b7('0x5a')]=_0x5cfba3[_0x13b7('0x3f')]({'plain':!![]});_0x38b1c3[_0x13b7('0x5a')][_0x13b7('0x5b')]=_0x3638cd;return db['MailMessage'][_0x13b7('0x4a')]({'body':_0x33a6e2['body'][_0x13b7('0x30')],'MailAccountId':_0x33a6e2[_0x13b7('0x39')]['id'],'MailInteractionId':_0x5cfba3['id'],'direction':'in','ContactId':_0x38b1c3['contact']['id'],'messageId':_0x33a6e2[_0x13b7('0x30')][_0x13b7('0x18')][_0x13b7('0x4d')],'from':_0x33a6e2['body'][_0x13b7('0x18')][_0x13b7('0x32')],'to':_0x33a6e2['body']['message']['to'],'cc':_0x33a6e2['body']['message']['cc'],'subject':_0x33a6e2[_0x13b7('0x30')][_0x13b7('0x18')][_0x13b7('0x4f')],'attach':_0x33a6e2[_0x13b7('0x30')][_0x13b7('0x18')]['attach'],'Attachments':_0x33a6e2[_0x13b7('0x30')]['message'][_0x13b7('0x5c')],'originTo':_0x33a6e2[_0x13b7('0x30')]['message'][_0x13b7('0x5d')],'originCc':_0x33a6e2[_0x13b7('0x30')][_0x13b7('0x18')][_0x13b7('0x5e')],'bcc':_0x33a6e2[_0x13b7('0x30')]['message'][_0x13b7('0x5f')],'ChatWebsiteId':_0x33a6e2['body']['message']['ChatWebsiteId']||null,'originChannel':_0x33a6e2[_0x13b7('0x30')]['message'][_0x13b7('0x60')]||_0x13b7('0x61'),'ChatOfflineMessageId':_0x33a6e2['body'][_0x13b7('0x18')][_0x13b7('0x62')]||null},{'include':[{'model':db['Attachment'],'as':_0x13b7('0x63')}]});})[_0x13b7('0x11')](function(_0x5429e6){_0x38b1c3[_0x13b7('0x18')]=_0x5429e6;if(_0x38b1c3[_0x13b7('0x5a')][_0x13b7('0x64')]){return db[_0x13b7('0x65')]['find']({'attributes':['id',_0x13b7('0x66')],'where':{'id':_0x38b1c3[_0x13b7('0x5a')][_0x13b7('0x64')]}})['then'](function(_0x127921){if(_0x127921){_0x38b1c3[_0x13b7('0x42')][_0x13b7('0x67')]({'id':0x0,'priority':0x0,'app':_0x13b7('0x68'),'appdata':_0x127921[_0x13b7('0x66')]+','+(_0x38b1c3['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x13b7('0x69'),_0x13b7('0x6a'),_0x38b1c3);});}return respondWithRpcPromise(_0x13b7('0x69'),'startRouting',_0x38b1c3);})[_0x13b7('0x11')](function(_0x59976f){_0x681f25(_0x59976f);})[_0x13b7('0x1a')](function(_0x39ee6b){_0x3ecbb3(_0x597c54[_0x13b7('0x17')](0x1f4,_0x39ee6b[_0x13b7('0x18')]));});});}; \ No newline at end of file +var _0xc6df=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailAccount','findAll','options','raw','attributes','limit','include','map','model','ShowMailAccount','where','difference','keys','updatedAt','CompanyId','ListId','body','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','CmList','List','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','list','orderBy','push','length','close','autoclose','*,*,*,*','Contacts','defaults','CmContact','create','List\x20not\x20found','contact','messageId','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','update','subject','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','bcc','ChatWebsiteId','originChannel','Email','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','startRouting','Start','lodash','util','moment','bluebird'];(function(_0x445c75,_0x50303d){var _0x813dd1=function(_0x44f541){while(--_0x44f541){_0x445c75['push'](_0x445c75['shift']());}};_0x813dd1(++_0x50303d);}(_0xc6df,0x131));var _0xfc6d=function(_0x4749fa,_0x1ddcf6){_0x4749fa=_0x4749fa-0x0;var _0x5d2476=_0xc6df[_0x4749fa];return _0x5d2476;};'use strict';var _=require(_0xfc6d('0x0'));var util=require(_0xfc6d('0x1'));var moment=require(_0xfc6d('0x2'));var BPromise=require(_0xfc6d('0x3'));var rs=require(_0xfc6d('0x4'));var fs=require('fs');var Redis=require(_0xfc6d('0x5'));var db=require(_0xfc6d('0x6'))['db'];var utils=require(_0xfc6d('0x7'));var logger=require(_0xfc6d('0x8'))('rpc');var config=require(_0xfc6d('0x9'));var jayson=require(_0xfc6d('0xa'));var client=jayson[_0xfc6d('0xb')]['http']({'port':0x232c});config[_0xfc6d('0xc')]=_['defaults'](config[_0xfc6d('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfc6d('0xd'))[_0xfc6d('0xe')](socket);function respondWithRpcPromise(_0x33d239,_0x23a11c,_0x5b3dc4){return new BPromise(function(_0x231a51,_0x30b535){return client['request'](_0x33d239,_0x5b3dc4)[_0xfc6d('0xf')](function(_0x12d2ad){logger[_0xfc6d('0x10')](_0xfc6d('0x11'),_0x23a11c,_0xfc6d('0x12'));logger[_0xfc6d('0x13')](_0xfc6d('0x14'),_0x23a11c,_0xfc6d('0x12'),JSON[_0xfc6d('0x15')](_0x12d2ad));if(_0x12d2ad[_0xfc6d('0x16')]){if(_0x12d2ad[_0xfc6d('0x16')]['code']===0x1f4){logger[_0xfc6d('0x16')]('MailAccount,\x20%s,\x20%s',_0x23a11c,_0x12d2ad[_0xfc6d('0x16')][_0xfc6d('0x17')]);return _0x30b535(_0x12d2ad[_0xfc6d('0x16')][_0xfc6d('0x17')]);}logger[_0xfc6d('0x16')](_0xfc6d('0x11'),_0x23a11c,_0x12d2ad[_0xfc6d('0x16')]['message']);return _0x231a51(_0x12d2ad[_0xfc6d('0x16')]['message']);}else{logger[_0xfc6d('0x10')](_0xfc6d('0x11'),_0x23a11c,'request\x20sent');_0x231a51(_0x12d2ad[_0xfc6d('0x18')][_0xfc6d('0x17')]);}})[_0xfc6d('0x19')](function(_0x493b65){logger[_0xfc6d('0x16')](_0xfc6d('0x11'),_0x23a11c,_0x493b65);_0x30b535(_0x493b65);});});}exports[_0xfc6d('0x1a')]=function(_0x52479a){var _0x11ca21=this;return new Promise(function(_0x4e1ea6,_0x558bfa){return db['MailAccount'][_0xfc6d('0x1b')]({'raw':_0x52479a[_0xfc6d('0x1c')]?_0x52479a[_0xfc6d('0x1c')][_0xfc6d('0x1d')]===undefined?!![]:![]:!![],'where':_0x52479a['options']?_0x52479a[_0xfc6d('0x1c')]['where']||null:null,'attributes':_0x52479a['options']?_0x52479a[_0xfc6d('0x1c')][_0xfc6d('0x1e')]||null:null,'limit':_0x52479a['options']?_0x52479a[_0xfc6d('0x1c')][_0xfc6d('0x1f')]||null:null,'include':_0x52479a['options']?_0x52479a['options'][_0xfc6d('0x20')]?_[_0xfc6d('0x21')](_0x52479a[_0xfc6d('0x1c')]['include'],function(_0x5f42ec){return{'model':db[_0x5f42ec[_0xfc6d('0x22')]],'as':_0x5f42ec['as'],'attributes':_0x5f42ec[_0xfc6d('0x1e')],'include':_0x5f42ec[_0xfc6d('0x20')]?_[_0xfc6d('0x21')](_0x5f42ec[_0xfc6d('0x20')],function(_0x222047){return{'model':db[_0x222047[_0xfc6d('0x22')]],'as':_0x222047['as'],'attributes':_0x222047[_0xfc6d('0x1e')],'include':_0x222047[_0xfc6d('0x20')]?_[_0xfc6d('0x21')](_0x222047[_0xfc6d('0x20')],function(_0x3a794f){return{'model':db[_0x3a794f[_0xfc6d('0x22')]],'as':_0x3a794f['as'],'attributes':_0x3a794f['attributes']};}):[]};}):[]};}):[]:[]})[_0xfc6d('0xf')](function(_0x4fb2c4){logger[_0xfc6d('0x10')](_0xfc6d('0x1a'),_0x52479a);logger[_0xfc6d('0x13')]('GetMailAccount',_0x52479a,JSON[_0xfc6d('0x15')](_0x4fb2c4));_0x4e1ea6(_0x4fb2c4);})[_0xfc6d('0x19')](function(_0x131dda){logger['error'](_0xfc6d('0x1a'),_0x131dda[_0xfc6d('0x17')],_0x52479a);_0x558bfa(_0x11ca21[_0xfc6d('0x16')](0x1f4,_0x131dda[_0xfc6d('0x17')]));});});};exports[_0xfc6d('0x23')]=function(_0x230e82){var _0x3e2355=this;return new Promise(function(_0x5eebbc,_0x14ed7d){return db['MailAccount']['find']({'raw':_0x230e82[_0xfc6d('0x1c')]?_0x230e82[_0xfc6d('0x1c')][_0xfc6d('0x1d')]===undefined?!![]:![]:!![],'where':_0x230e82['options']?_0x230e82[_0xfc6d('0x1c')][_0xfc6d('0x24')]||null:null,'attributes':_0x230e82['options']?_0x230e82['options']['attributes']||null:null,'include':_0x230e82[_0xfc6d('0x1c')]?_0x230e82[_0xfc6d('0x1c')][_0xfc6d('0x20')]?_['map'](_0x230e82[_0xfc6d('0x1c')][_0xfc6d('0x20')],function(_0x3ef34e){return{'model':db[_0x3ef34e['model']],'as':_0x3ef34e['as'],'attributes':_0x3ef34e[_0xfc6d('0x1e')],'include':_0x3ef34e['include']?_[_0xfc6d('0x21')](_0x3ef34e['include'],function(_0x387189){return{'model':db[_0x387189[_0xfc6d('0x22')]],'as':_0x387189['as'],'attributes':_0x387189['attributes'],'include':_0x387189[_0xfc6d('0x20')]?_[_0xfc6d('0x21')](_0x387189[_0xfc6d('0x20')],function(_0x5776ed){return{'model':db[_0x5776ed['model']],'as':_0x5776ed['as'],'attributes':_0x5776ed[_0xfc6d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfc6d('0xf')](function(_0xf176dc){logger[_0xfc6d('0x10')](_0xfc6d('0x23'),_0x230e82);logger['debug'](_0xfc6d('0x23'),_0x230e82,JSON[_0xfc6d('0x15')](_0xf176dc));_0x5eebbc(_0xf176dc);})['catch'](function(_0x147498){logger[_0xfc6d('0x16')](_0xfc6d('0x23'),_0x147498[_0xfc6d('0x17')],_0x230e82);_0x14ed7d(_0x3e2355[_0xfc6d('0x16')](0x1f4,_0x147498[_0xfc6d('0x17')]));});});};exports['NotifyMailAccount']=function(_0xfe9e9){var _0x1570fe=this;return new Promise(function(_0x186af6,_0x22e3ee){var _0x38f0b1={'body':_0xfe9e9['body'],'channel':'mail'};var _0x3223e5=_[_0xfc6d('0x25')](_[_0xfc6d('0x26')](db['CmContact']['rawAttributes']),['createdAt',_0xfc6d('0x27'),_0xfc6d('0x28'),_0xfc6d('0x29')]);var _0x4d5524=![];if(_0xfe9e9['body']['id']){delete _0xfe9e9[_0xfc6d('0x2a')]['id'];}if(_[_0xfc6d('0x2b')](_0xfe9e9[_0xfc6d('0x2a')][_0xfc6d('0x2c')])){return _0x22e3ee(_0x1570fe[_0xfc6d('0x16')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xfc6d('0x2b')](_0xfe9e9[_0xfc6d('0x2a')][_0xfc6d('0x2a')])||_0xfe9e9['body']['body']===''){return _0x22e3ee(_0x1570fe[_0xfc6d('0x16')](0x1f4,_0xfc6d('0x2d')));}if(_[_0xfc6d('0x2b')](_0xfe9e9[_0xfc6d('0x2a')][_0xfc6d('0x2e')])){return _0x22e3ee(_0x1570fe[_0xfc6d('0x16')](0x1f4,_0xfc6d('0x2f')+_0x3223e5));}if(!_[_0xfc6d('0x30')](_0x3223e5,_0xfe9e9[_0xfc6d('0x2a')][_0xfc6d('0x2e')])){return _0x22e3ee(_0x1570fe['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3223e5));}var _0x1fadd7={};_0x1fadd7[_0xfe9e9[_0xfc6d('0x2a')][_0xfc6d('0x2e')]]=_0xfe9e9[_0xfc6d('0x2a')][_0xfc6d('0x2c')];return db['MailAccount'][_0xfc6d('0x31')]({'where':{'id':_0xfe9e9[_0xfc6d('0x32')]['id']},'include':[{'model':db[_0xfc6d('0x33')],'as':_0xfc6d('0x34'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x1fadd7,'limit':0x1,'order':[['updatedAt',_0xfc6d('0x35')]]}]},{'model':db[_0xfc6d('0x36')],'as':_0xfc6d('0x37')},{'model':db[_0xfc6d('0x38')],'as':_0xfc6d('0x39')}]})[_0xfc6d('0xf')](function(_0x28c396){if(_0x28c396&&_0x28c396['List']){var _0x14c147=_0x28c396[_0xfc6d('0x3a')]({'plain':!![]});_0x38f0b1['account']=_[_0xfc6d('0x3b')](_0x14c147,[_0xfc6d('0x37'),'List']);_0x38f0b1[_0xfc6d('0x3c')]=_0x14c147[_0xfc6d('0x37')];_0x38f0b1[_0xfc6d('0x3d')]=_0x14c147[_0xfc6d('0x34')];_0x38f0b1[_0xfc6d('0x3c')]=_[_0xfc6d('0x3e')](_0x38f0b1[_0xfc6d('0x3c')],['priority'],['asc']);if(_0x38f0b1[_0xfc6d('0x32')]&&_0x38f0b1[_0xfc6d('0x32')]['autoclose']){_0x38f0b1[_0xfc6d('0x3c')][_0xfc6d('0x3f')]({'id':0x0,'priority':_0x38f0b1['applications'][_0xfc6d('0x40')]+0x1,'app':_0xfc6d('0x41'),'appdata':_0xfc6d('0x42'),'interval':_0xfc6d('0x43')});}if(_0x38f0b1[_0xfc6d('0x32')][_0xfc6d('0x37')]){delete _0x38f0b1[_0xfc6d('0x32')]['Applications'];}if(_0x38f0b1[_0xfc6d('0x32')]['List']){delete _0x38f0b1[_0xfc6d('0x32')][_0xfc6d('0x34')];}if(_0x14c147[_0xfc6d('0x34')][_0xfc6d('0x44')][_0xfc6d('0x40')]){return _0x14c147[_0xfc6d('0x34')][_0xfc6d('0x44')][0x0];}var _0x57aad3=_[_0xfc6d('0x45')](_0xfe9e9[_0xfc6d('0x2a')],{'firstName':_0xfe9e9[_0xfc6d('0x2a')][_0xfc6d('0x2c')],'ListId':_0x14c147[_0xfc6d('0x29')]});_0x57aad3[_0xfe9e9[_0xfc6d('0x2a')][_0xfc6d('0x2e')]]=_0xfe9e9[_0xfc6d('0x2a')][_0xfc6d('0x2c')];return db[_0xfc6d('0x46')][_0xfc6d('0x47')](_0x57aad3);}else{throw new Error(_0xfc6d('0x48'));}})['then'](function(_0x18fac2){_0x38f0b1[_0xfc6d('0x49')]=_0x18fac2;if(_0x18fac2){if(!_0xfe9e9[_0xfc6d('0x2a')]['message']['messageId']){_0xfe9e9[_0xfc6d('0x2a')]['message'][_0xfc6d('0x4a')]=rs['generate']()+'\x20'+_0xfe9e9[_0xfc6d('0x2a')]['message'][_0xfc6d('0x2c')];}var _0x5ad137={'ContactId':_0x18fac2['id'],'MailAccountId':_0xfe9e9[_0xfc6d('0x32')]['id'],'inReplyTo':_0xfe9e9['body'][_0xfc6d('0x17')]['messageId'],'to':_0xfe9e9[_0xfc6d('0x2a')][_0xfc6d('0x17')][_0xfc6d('0x2c')],'cc':_0xfe9e9[_0xfc6d('0x2a')][_0xfc6d('0x17')]['cc'],'subject':_0xfe9e9[_0xfc6d('0x2a')]['message']['subject'],'attach':_0xfe9e9['body'][_0xfc6d('0x17')][_0xfc6d('0x4b')],'lastMsgAt':moment()[_0xfc6d('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0xfc6d('0x4d')]['find']({'where':{'closed':![],'MailAccountId':_0xfe9e9[_0xfc6d('0x32')]['id']},'include':[{'model':db[_0xfc6d('0x4e')],'as':_0xfc6d('0x4f'),'attributes':[_0xfc6d('0x4a')],'where':{'messageId':_0xfe9e9[_0xfc6d('0x2a')]['message'][_0xfc6d('0x50')]}}]})[_0xfc6d('0xf')](function(_0x4a31cb){if(_0x4a31cb){return[_0x4a31cb,![]];}return db[_0xfc6d('0x4d')][_0xfc6d('0x47')](_0x5ad137)['then'](function(_0x2291ef){return[_0x2291ef,!![]];});});}else{throw new Error(_0xfc6d('0x51'));}})['spread'](function(_0x4a11e8,_0x2ee7e9){if(_0x4a11e8){_0x4d5524=_0x2ee7e9;if(!_0x2ee7e9){return _0x4a11e8[_0xfc6d('0x52')]({'inReplyTo':_0xfe9e9[_0xfc6d('0x2a')][_0xfc6d('0x17')]['messageId'],'to':_0xfe9e9['body'][_0xfc6d('0x17')]['from'],'cc':_0xfe9e9[_0xfc6d('0x2a')][_0xfc6d('0x17')]['cc'],'subject':_0xfe9e9['body'][_0xfc6d('0x17')][_0xfc6d('0x53')],'attach':_0x4a11e8[_0xfc6d('0x4b')]?_0x4a11e8[_0xfc6d('0x4b')]:_0xfe9e9[_0xfc6d('0x2a')]['message'][_0xfc6d('0x4b')],'substatus':null,'substatusAt':moment()[_0xfc6d('0x4c')](_0xfc6d('0x54')),'lastMsgAt':moment()[_0xfc6d('0x4c')](_0xfc6d('0x54')),'lastMsgDirection':'in'});}else{return _0x4a11e8;}}})[_0xfc6d('0xf')](function(_0xcf8171){_0x38f0b1[_0xfc6d('0x55')]=_0xcf8171[_0xfc6d('0x3a')]({'plain':!![]});_0x38f0b1[_0xfc6d('0x55')][_0xfc6d('0x56')]=_0x4d5524;return db[_0xfc6d('0x4e')][_0xfc6d('0x47')]({'body':_0xfe9e9[_0xfc6d('0x2a')][_0xfc6d('0x2a')],'MailAccountId':_0xfe9e9['account']['id'],'MailInteractionId':_0xcf8171['id'],'direction':'in','ContactId':_0x38f0b1[_0xfc6d('0x49')]['id'],'messageId':_0xfe9e9[_0xfc6d('0x2a')][_0xfc6d('0x17')][_0xfc6d('0x4a')],'from':_0xfe9e9[_0xfc6d('0x2a')]['message'][_0xfc6d('0x2c')],'to':_0xfe9e9['body'][_0xfc6d('0x17')]['to'],'cc':_0xfe9e9[_0xfc6d('0x2a')][_0xfc6d('0x17')]['cc'],'subject':_0xfe9e9[_0xfc6d('0x2a')][_0xfc6d('0x17')]['subject'],'attach':_0xfe9e9['body'][_0xfc6d('0x17')][_0xfc6d('0x4b')],'Attachments':_0xfe9e9[_0xfc6d('0x2a')][_0xfc6d('0x17')][_0xfc6d('0x57')],'originTo':_0xfe9e9[_0xfc6d('0x2a')][_0xfc6d('0x17')][_0xfc6d('0x58')],'originCc':_0xfe9e9['body'][_0xfc6d('0x17')]['originCc'],'bcc':_0xfe9e9[_0xfc6d('0x2a')]['message'][_0xfc6d('0x59')],'ChatWebsiteId':_0xfe9e9[_0xfc6d('0x2a')][_0xfc6d('0x17')][_0xfc6d('0x5a')]||null,'originChannel':_0xfe9e9[_0xfc6d('0x2a')][_0xfc6d('0x17')][_0xfc6d('0x5b')]||_0xfc6d('0x5c'),'ChatOfflineMessageId':_0xfe9e9[_0xfc6d('0x2a')][_0xfc6d('0x17')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xfc6d('0x5d')],'as':_0xfc6d('0x5e')}]});})[_0xfc6d('0xf')](function(_0x16d288){_0x38f0b1['message']=_0x16d288;if(_0x38f0b1[_0xfc6d('0x55')][_0xfc6d('0x5f')]){return db[_0xfc6d('0x60')][_0xfc6d('0x31')]({'attributes':['id',_0xfc6d('0x61')],'where':{'id':_0x38f0b1[_0xfc6d('0x55')][_0xfc6d('0x5f')]}})[_0xfc6d('0xf')](function(_0x461c37){if(_0x461c37){_0x38f0b1[_0xfc6d('0x3c')][_0xfc6d('0x62')]({'id':0x0,'priority':0x0,'app':_0xfc6d('0x63'),'appdata':_0x461c37[_0xfc6d('0x61')]+','+(_0x38f0b1['account'][_0xfc6d('0x64')]||0xa),'interval':_0xfc6d('0x43')});}return respondWithRpcPromise('Start',_0xfc6d('0x65'),_0x38f0b1);});}return respondWithRpcPromise(_0xfc6d('0x66'),_0xfc6d('0x65'),_0x38f0b1);})[_0xfc6d('0xf')](function(_0x717e16){_0x186af6(_0x717e16);})[_0xfc6d('0x19')](function(_0x18aed5){_0x22e3ee(_0x1570fe['error'](0x1f4,_0x18aed5[_0xfc6d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index b8ff1bd..f9c6e2e 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 _0xae76=['emit','removeListener','register','mailAccount:','./mailAccount.events','remove','update'];(function(_0x102471,_0x4b9204){var _0x138a89=function(_0x63e1a8){while(--_0x63e1a8){_0x102471['push'](_0x102471['shift']());}};_0x138a89(++_0x4b9204);}(_0xae76,0x74));var _0x6ae7=function(_0x3db32b,_0x38ecdc){_0x3db32b=_0x3db32b-0x0;var _0x299e38=_0xae76[_0x3db32b];return _0x299e38;};'use strict';var MailAccountEvents=require(_0x6ae7('0x0'));var events=['save',_0x6ae7('0x1'),_0x6ae7('0x2')];function createListener(_0x51817a,_0x387816){return function(_0x3d2edf){_0x387816[_0x6ae7('0x3')](_0x51817a,_0x3d2edf);};}function removeListener(_0x3ad153,_0x4d793d){return function(){MailAccountEvents[_0x6ae7('0x4')](_0x3ad153,_0x4d793d);};}exports[_0x6ae7('0x5')]=function(_0x43a6c9){for(var _0x234f6c=0x0,_0x34ff5a=events['length'];_0x234f6c<_0x34ff5a;_0x234f6c++){var _0x4534a1=events[_0x234f6c];var _0x2b181f=createListener(_0x6ae7('0x6')+_0x4534a1,_0x43a6c9);MailAccountEvents['on'](_0x4534a1,_0x2b181f);}}; \ No newline at end of file +var _0x5085=['removeListener','mailAccount:','save','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5085,0xe3));var _0x5508=function(_0x2b77a3,_0x104e9e){_0x2b77a3=_0x2b77a3-0x0;var _0x4a4eec=_0x5085[_0x2b77a3];return _0x4a4eec;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x5508('0x0'),_0x5508('0x1'),'update'];function createListener(_0x1e421a,_0xf80df5){return function(_0x69cdec){_0xf80df5[_0x5508('0x2')](_0x1e421a,_0x69cdec);};}function removeListener(_0xc3ba7,_0x5c16a4){return function(){MailAccountEvents[_0x5508('0x3')](_0xc3ba7,_0x5c16a4);};}exports['register']=function(_0x1911e9){for(var _0x5cfc06=0x0,_0x347aaf=events['length'];_0x5cfc06<_0x347aaf;_0x5cfc06++){var _0x35dfa4=events[_0x5cfc06];var _0x4d5894=createListener(_0x5508('0x4')+_0x35dfa4,_0x1911e9);MailAccountEvents['on'](_0x35dfa4,_0x4d5894);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 4005188..71ae4ba 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 _0x7627=['show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./mailApplication.controller','/:id','isAuthenticated'];(function(_0x1d9643,_0x41df28){var _0x12bfdf=function(_0x313f81){while(--_0x313f81){_0x1d9643['push'](_0x1d9643['shift']());}};_0x12bfdf(++_0x41df28);}(_0x7627,0xba));var _0x7762=function(_0x4e4e64,_0x254ae5){_0x4e4e64=_0x4e4e64-0x0;var _0x3f423c=_0x7627[_0x4e4e64];return _0x3f423c;};'use strict';var multer=require(_0x7762('0x0'));var util=require(_0x7762('0x1'));var path=require(_0x7762('0x2'));var timeout=require(_0x7762('0x3'));var express=require(_0x7762('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7762('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7762('0x6'));router['get'](_0x7762('0x7'),auth[_0x7762('0x8')](),controller[_0x7762('0x9')]);router[_0x7762('0xa')](_0x7762('0x7'),auth[_0x7762('0x8')](),controller[_0x7762('0xb')]);router[_0x7762('0xc')]('/:id',auth[_0x7762('0x8')](),controller[_0x7762('0xd')]);module[_0x7762('0xe')]=router; \ No newline at end of file +var _0x9f3c=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','put','update','delete','destroy','exports'];(function(_0x2353fe,_0x4b0bca){var _0x4d43f6=function(_0x5d0bd9){while(--_0x5d0bd9){_0x2353fe['push'](_0x2353fe['shift']());}};_0x4d43f6(++_0x4b0bca);}(_0x9f3c,0x190));var _0xc9f3=function(_0x4a74f5,_0x43b76a){_0x4a74f5=_0x4a74f5-0x0;var _0x451969=_0x9f3c[_0x4a74f5];return _0x451969;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc9f3('0x0'));var timeout=require(_0xc9f3('0x1'));var express=require(_0xc9f3('0x2'));var router=express[_0xc9f3('0x3')]();var fs_extra=require(_0xc9f3('0x4'));var auth=require(_0xc9f3('0x5'));var interaction=require(_0xc9f3('0x6'));var config=require('../../config/environment');var controller=require(_0xc9f3('0x7'));router[_0xc9f3('0x8')](_0xc9f3('0x9'),auth[_0xc9f3('0xa')](),controller['show']);router[_0xc9f3('0xb')](_0xc9f3('0x9'),auth[_0xc9f3('0xa')](),controller[_0xc9f3('0xc')]);router[_0xc9f3('0xd')]('/:id',auth[_0xc9f3('0xa')](),controller[_0xc9f3('0xe')]);module[_0xc9f3('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index cda096e..d75d903 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 _0x7810=['sequelize','exports','INTEGER','noop','STRING','*,*,*,*'];(function(_0x2d2258,_0x2ce510){var _0x18e155=function(_0x11949e){while(--_0x11949e){_0x2d2258['push'](_0x2d2258['shift']());}};_0x18e155(++_0x2ce510);}(_0x7810,0x14a));var _0x0781=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x7810[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0x0781('0x0'));module[_0x0781('0x1')]={'priority':{'type':Sequelize[_0x0781('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0781('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0781('0x4')],'defaultValue':_0x0781('0x5')}}; \ No newline at end of file +var _0x4c37=['STRING','TEXT','sequelize','exports','INTEGER'];(function(_0x282712,_0x489bbe){var _0xc1c850=function(_0x58b33c){while(--_0x58b33c){_0x282712['push'](_0x282712['shift']());}};_0xc1c850(++_0x489bbe);}(_0x4c37,0xf7));var _0x74c3=function(_0x11d4a4,_0x2829a5){_0x11d4a4=_0x11d4a4-0x0;var _0x183227=_0x4c37[_0x11d4a4];return _0x183227;};'use strict';var Sequelize=require(_0x74c3('0x0'));module[_0x74c3('0x1')]={'priority':{'type':Sequelize[_0x74c3('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x74c3('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x74c3('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 513d7ba..dcf6c82 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x3f2e2e,_0x3d72bd){var _0xeb92b1=function(_0x53d92b){while(--_0x53d92b){_0x3f2e2e['push'](_0x3f2e2e['shift']());}};_0xeb92b1(++_0x3d72bd);}(_0xf4eb,0xec));var _0xbf4e=function(_0x137b6b,_0x5583ba){_0x137b6b=_0x137b6b-0x0;var _0x4ddf88=_0xf4eb[_0x137b6b];return _0x4ddf88;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file +var _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0xf0cf28,_0x1a5fe2){var _0x2d367d=function(_0x57362f){while(--_0x57362f){_0xf0cf28['push'](_0xf0cf28['shift']());}};_0x2d367d(++_0x1a5fe2);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index af5a93d..1a1499d 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 _0x1a94=['moment','bluebird','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications','util','../../config/logger','api'];(function(_0x4d1380,_0x238dda){var _0x7db68f=function(_0x429033){while(--_0x429033){_0x4d1380['push'](_0x4d1380['shift']());}};_0x7db68f(++_0x238dda);}(_0x1a94,0x15d));var _0x41a9=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x1a94[_0x4b2863];return _0x567d67;};'use strict';var _=require('lodash');var util=require(_0x41a9('0x0'));var logger=require(_0x41a9('0x1'))(_0x41a9('0x2'));var moment=require(_0x41a9('0x3'));var BPromise=require(_0x41a9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x41a9('0x5'));var config=require(_0x41a9('0x6'));var attributes=require(_0x41a9('0x7'));module[_0x41a9('0x8')]=function(_0x1fcb6d,_0x187ba3){return _0x1fcb6d['define'](_0x41a9('0x9'),attributes,{'tableName':_0x41a9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8114=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x8114,0xfe));var _0x4811=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x8114[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0x4811('0x0'));var util=require(_0x4811('0x1'));var logger=require('../../config/logger')(_0x4811('0x2'));var moment=require(_0x4811('0x3'));var BPromise=require(_0x4811('0x4'));var rp=require(_0x4811('0x5'));var fs=require('fs');var path=require(_0x4811('0x6'));var rimraf=require(_0x4811('0x7'));var config=require(_0x4811('0x8'));var attributes=require(_0x4811('0x9'));module[_0x4811('0xa')]=function(_0x3020a7,_0xcfe665){return _0x3020a7[_0x4811('0xb')](_0x4811('0xc'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4811('0xd'),'collate':_0x4811('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 38c0322..621b995 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 _0xf60a=['info','result','catch','MailApplication','update','body','options','raw','where','attributes','then','UpdateMailApplication','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0xfff9cf,_0x55ad70){var _0x231718=function(_0x410e35){while(--_0x410e35){_0xfff9cf['push'](_0xfff9cf['shift']());}};_0x231718(++_0x55ad70);}(_0xf60a,0x10d));var _0xaf60=function(_0x5cda66,_0x118246){_0x5cda66=_0x5cda66-0x0;var _0x28d8f9=_0xf60a[_0x5cda66];return _0x28d8f9;};'use strict';var _=require(_0xaf60('0x0'));var util=require('util');var moment=require(_0xaf60('0x1'));var BPromise=require(_0xaf60('0x2'));var rs=require(_0xaf60('0x3'));var fs=require('fs');var Redis=require(_0xaf60('0x4'));var db=require(_0xaf60('0x5'))['db'];var utils=require(_0xaf60('0x6'));var logger=require(_0xaf60('0x7'))(_0xaf60('0x8'));var config=require(_0xaf60('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaf60('0xa')][_0xaf60('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2807c0,_0x27a432,_0x2c413d){return new BPromise(function(_0x314d0b,_0x198859){return client[_0xaf60('0xc')](_0x2807c0,_0x2c413d)['then'](function(_0x10f20e){logger['info'](_0xaf60('0xd'),_0x27a432,'request\x20sent');logger['debug'](_0xaf60('0xe'),_0x27a432,_0xaf60('0xf'),JSON[_0xaf60('0x10')](_0x10f20e));if(_0x10f20e['error']){if(_0x10f20e[_0xaf60('0x11')]['code']===0x1f4){logger['error'](_0xaf60('0xd'),_0x27a432,_0x10f20e[_0xaf60('0x11')][_0xaf60('0x12')]);return _0x198859(_0x10f20e[_0xaf60('0x11')][_0xaf60('0x12')]);}logger[_0xaf60('0x11')](_0xaf60('0xd'),_0x27a432,_0x10f20e['error']['message']);return _0x314d0b(_0x10f20e[_0xaf60('0x11')]['message']);}else{logger[_0xaf60('0x13')](_0xaf60('0xd'),_0x27a432,_0xaf60('0xf'));_0x314d0b(_0x10f20e[_0xaf60('0x14')][_0xaf60('0x12')]);}})[_0xaf60('0x15')](function(_0xd3cc19){logger['error'](_0xaf60('0xd'),_0x27a432,_0xd3cc19);_0x198859(_0xd3cc19);});});}exports['UpdateMailApplication']=function(_0x1cec76){var _0x128267=this;return new Promise(function(_0x51406b,_0x2d167d){return db[_0xaf60('0x16')][_0xaf60('0x17')](_0x1cec76[_0xaf60('0x18')],{'raw':_0x1cec76[_0xaf60('0x19')]?_0x1cec76['options'][_0xaf60('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cec76[_0xaf60('0x19')]?_0x1cec76[_0xaf60('0x19')][_0xaf60('0x1b')]||null:null,'attributes':_0x1cec76[_0xaf60('0x19')]?_0x1cec76[_0xaf60('0x19')][_0xaf60('0x1c')]||null:null,'limit':_0x1cec76[_0xaf60('0x19')]?_0x1cec76['options']['limit']||null:null})[_0xaf60('0x1d')](function(_0x22e47f){logger[_0xaf60('0x13')](_0xaf60('0x1e'),_0x1cec76);logger[_0xaf60('0x1f')](_0xaf60('0x1e'),_0x1cec76,JSON[_0xaf60('0x10')](_0x22e47f));_0x51406b(_0x22e47f);})[_0xaf60('0x15')](function(_0x117471){logger['error'](_0xaf60('0x1e'),_0x117471[_0xaf60('0x12')],_0x1cec76);_0x2d167d(_0x128267[_0xaf60('0x11')](0x1f4,_0x117471[_0xaf60('0x12')]));});});}; \ No newline at end of file +var _0x2cf9=['message','result','catch','MailApplication','update','body','options','raw','where','attributes','limit','UpdateMailApplication','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x19e928,_0x26a0e4){var _0x4e941f=function(_0x52a5cd){while(--_0x52a5cd){_0x19e928['push'](_0x19e928['shift']());}};_0x4e941f(++_0x26a0e4);}(_0x2cf9,0x180));var _0x92cf=function(_0x37fdd0,_0x5d522d){_0x37fdd0=_0x37fdd0-0x0;var _0x1c927c=_0x2cf9[_0x37fdd0];return _0x1c927c;};'use strict';var _=require('lodash');var util=require(_0x92cf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x92cf('0x1'));var fs=require('fs');var Redis=require(_0x92cf('0x2'));var db=require(_0x92cf('0x3'))['db'];var utils=require(_0x92cf('0x4'));var logger=require(_0x92cf('0x5'))(_0x92cf('0x6'));var config=require(_0x92cf('0x7'));var jayson=require(_0x92cf('0x8'));var client=jayson['client'][_0x92cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x518806,_0x29494c,_0x4ac30a){return new BPromise(function(_0x2a0a04,_0x1bee56){return client[_0x92cf('0xa')](_0x518806,_0x4ac30a)[_0x92cf('0xb')](function(_0x12423b){logger[_0x92cf('0xc')](_0x92cf('0xd'),_0x29494c,_0x92cf('0xe'));logger[_0x92cf('0xf')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x29494c,'request\x20sent',JSON[_0x92cf('0x10')](_0x12423b));if(_0x12423b['error']){if(_0x12423b[_0x92cf('0x11')][_0x92cf('0x12')]===0x1f4){logger[_0x92cf('0x11')](_0x92cf('0xd'),_0x29494c,_0x12423b['error'][_0x92cf('0x13')]);return _0x1bee56(_0x12423b['error'][_0x92cf('0x13')]);}logger['error'](_0x92cf('0xd'),_0x29494c,_0x12423b[_0x92cf('0x11')][_0x92cf('0x13')]);return _0x2a0a04(_0x12423b['error']['message']);}else{logger['info'](_0x92cf('0xd'),_0x29494c,_0x92cf('0xe'));_0x2a0a04(_0x12423b[_0x92cf('0x14')][_0x92cf('0x13')]);}})[_0x92cf('0x15')](function(_0x3159d7){logger[_0x92cf('0x11')]('MailApplication,\x20%s,\x20%s',_0x29494c,_0x3159d7);_0x1bee56(_0x3159d7);});});}exports['UpdateMailApplication']=function(_0x5b2c98){var _0x2e4155=this;return new Promise(function(_0x322ba9,_0x337359){return db[_0x92cf('0x16')][_0x92cf('0x17')](_0x5b2c98[_0x92cf('0x18')],{'raw':_0x5b2c98[_0x92cf('0x19')]?_0x5b2c98[_0x92cf('0x19')][_0x92cf('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b2c98[_0x92cf('0x19')]?_0x5b2c98[_0x92cf('0x19')][_0x92cf('0x1b')]||null:null,'attributes':_0x5b2c98['options']?_0x5b2c98[_0x92cf('0x19')][_0x92cf('0x1c')]||null:null,'limit':_0x5b2c98[_0x92cf('0x19')]?_0x5b2c98[_0x92cf('0x19')][_0x92cf('0x1d')]||null:null})['then'](function(_0x2a15ca){logger[_0x92cf('0xc')](_0x92cf('0x1e'),_0x5b2c98);logger[_0x92cf('0xf')]('UpdateMailApplication',_0x5b2c98,JSON[_0x92cf('0x10')](_0x2a15ca));_0x322ba9(_0x2a15ca);})[_0x92cf('0x15')](function(_0x2e44b3){logger[_0x92cf('0x11')]('UpdateMailApplication',_0x2e44b3['message'],_0x5b2c98);_0x337359(_0x2e4155['error'](0x1f4,_0x2e44b3[_0x92cf('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 53dea20..0f85a98 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 _0xf388=['mailinteraction:destroy','destroy','exports','express','Router','../../components/auth/service','./mailInteraction.controller','isAuthenticated','get','describe','/:id','show','getMessages','/:id/download','post','create','/:id/messages','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','delete'];(function(_0x1c0ed3,_0x45e543){var _0x16a5ca=function(_0x4d4e32){while(--_0x4d4e32){_0x1c0ed3['push'](_0x1c0ed3['shift']());}};_0x16a5ca(++_0x45e543);}(_0xf388,0x99));var _0x8f38=function(_0x1edaa4,_0x425a79){_0x1edaa4=_0x1edaa4-0x0;var _0x32e7ae=_0xf388[_0x1edaa4];return _0x32e7ae;};'use strict';var express=require(_0x8f38('0x0'));var router=express[_0x8f38('0x1')]();var auth=require(_0x8f38('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0x8f38('0x3'));router['get']('/',auth[_0x8f38('0x4')](),controller['index']);router[_0x8f38('0x5')]('/describe',auth['isAuthenticated'](),controller[_0x8f38('0x6')]);router['get'](_0x8f38('0x7'),auth[_0x8f38('0x4')](),controller[_0x8f38('0x8')]);router[_0x8f38('0x5')]('/:id/messages',auth[_0x8f38('0x4')](),controller[_0x8f38('0x9')]);router[_0x8f38('0x5')](_0x8f38('0xa'),auth[_0x8f38('0x4')](),controller['download']);router[_0x8f38('0xb')]('/',auth[_0x8f38('0x4')](),controller[_0x8f38('0xc')]);router['post'](_0x8f38('0xd'),auth[_0x8f38('0x4')](),controller[_0x8f38('0xe')]);router[_0x8f38('0xb')](_0x8f38('0xf'),auth[_0x8f38('0x4')](),interaction[_0x8f38('0x10')](_0x8f38('0x11'),_0x8f38('0x12')),controller['addTags']);router[_0x8f38('0x13')]('/:id',auth[_0x8f38('0x4')](),interaction['tracked'](_0x8f38('0x11'),_0x8f38('0x14')),controller['update']);router[_0x8f38('0x15')](_0x8f38('0x7'),auth[_0x8f38('0x4')](),interaction[_0x8f38('0x10')](_0x8f38('0x11'),_0x8f38('0x16')),controller[_0x8f38('0x17')]);router[_0x8f38('0x15')](_0x8f38('0xf'),auth[_0x8f38('0x4')](),controller['removeTags']);module[_0x8f38('0x18')]=router; \ No newline at end of file +var _0x05ee=['express','Router','../../components/auth/service','./mailInteraction.controller','isAuthenticated','index','/describe','get','/:id','show','/:id/messages','getMessages','create','addMessage','post','/:id/tags','tracked','mail','put','mailinteraction:update','update','mailinteraction:destroy','destroy','delete','removeTags','exports'];(function(_0xd58d5a,_0x1e61e1){var _0x5a4832=function(_0x3e5ba3){while(--_0x3e5ba3){_0xd58d5a['push'](_0xd58d5a['shift']());}};_0x5a4832(++_0x1e61e1);}(_0x05ee,0x1a0));var _0xe05e=function(_0x788a54,_0x12450b){_0x788a54=_0x788a54-0x0;var _0x8b73a4=_0x05ee[_0x788a54];return _0x8b73a4;};'use strict';var express=require(_0xe05e('0x0'));var router=express[_0xe05e('0x1')]();var auth=require(_0xe05e('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0xe05e('0x3'));router['get']('/',auth[_0xe05e('0x4')](),controller[_0xe05e('0x5')]);router['get'](_0xe05e('0x6'),auth[_0xe05e('0x4')](),controller['describe']);router[_0xe05e('0x7')](_0xe05e('0x8'),auth['isAuthenticated'](),controller[_0xe05e('0x9')]);router[_0xe05e('0x7')](_0xe05e('0xa'),auth[_0xe05e('0x4')](),controller[_0xe05e('0xb')]);router['get']('/:id/download',auth[_0xe05e('0x4')](),controller['download']);router['post']('/',auth[_0xe05e('0x4')](),controller[_0xe05e('0xc')]);router['post'](_0xe05e('0xa'),auth[_0xe05e('0x4')](),controller[_0xe05e('0xd')]);router[_0xe05e('0xe')](_0xe05e('0xf'),auth['isAuthenticated'](),interaction[_0xe05e('0x10')](_0xe05e('0x11'),'mailinteraction:addtags'),controller['addTags']);router[_0xe05e('0x12')](_0xe05e('0x8'),auth[_0xe05e('0x4')](),interaction['tracked']('mail',_0xe05e('0x13')),controller[_0xe05e('0x14')]);router['delete']('/:id',auth[_0xe05e('0x4')](),interaction[_0xe05e('0x10')](_0xe05e('0x11'),_0xe05e('0x15')),controller[_0xe05e('0x16')]);router[_0xe05e('0x17')](_0xe05e('0xf'),auth[_0xe05e('0x4')](),controller[_0xe05e('0x18')]);module[_0xe05e('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 7a0aaad..e2c2715 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 _0x940a=['BOOLEAN','DATE','STRING','long','TEXT','out','sequelize','iconv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x940a,0x1ce));var _0xa940=function(_0x57975f,_0x388556){_0x57975f=_0x57975f-0x0;var _0x4793b8=_0x940a[_0x57975f];return _0x4793b8;};'use strict';var Sequelize=require(_0xa940('0x0'));var iconv=require(_0xa940('0x1'));module['exports']={'closed':{'type':Sequelize[_0xa940('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa940('0x3')]},'disposition':{'type':Sequelize[_0xa940('0x4')]},'secondDisposition':{'type':Sequelize[_0xa940('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa940('0x4')]},'inReplyTo':{'type':Sequelize[_0xa940('0x4')](0x1fe)},'to':{'type':Sequelize[_0xa940('0x4')]},'cc':{'type':Sequelize['TEXT'](_0xa940('0x5'))},'subject':{'type':Sequelize[_0xa940('0x6')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xa940('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xa940('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa940('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa940('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa940('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xb213=['TEXT','long','out','ENUM','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x29e2a4,_0x3bf366){var _0x209dca=function(_0x1e495e){while(--_0x1e495e){_0x29e2a4['push'](_0x29e2a4['shift']());}};_0x209dca(++_0x3bf366);}(_0xb213,0x199));var _0x3b21=function(_0x18e1a1,_0x5426d6){_0x18e1a1=_0x18e1a1-0x0;var _0x3613d0=_0xb213[_0x18e1a1];return _0x3613d0;};'use strict';var Sequelize=require(_0x3b21('0x0'));var iconv=require('iconv');module[_0x3b21('0x1')]={'closed':{'type':Sequelize[_0x3b21('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3b21('0x3')]},'disposition':{'type':Sequelize[_0x3b21('0x4')]},'secondDisposition':{'type':Sequelize[_0x3b21('0x4')]},'thirdDisposition':{'type':Sequelize[_0x3b21('0x4')]},'note':{'type':Sequelize[_0x3b21('0x4')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x3b21('0x4')]},'cc':{'type':Sequelize[_0x3b21('0x5')](_0x3b21('0x6'))},'subject':{'type':Sequelize[_0x3b21('0x5')]()},'attach':{'type':Sequelize[_0x3b21('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x3b21('0x3')]},'substatus':{'type':Sequelize[_0x3b21('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x3b21('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x3b21('0x8')]('in',_0x3b21('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3b21('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index c2b22b4..2832ea9 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 _0x3ca4=['sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.lastMsgDirection','i.subject','i.secondDisposition','i.substatus','i.to','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','describe','addMessage','ids','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','omit','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','root','files','tmp','attachments','Attachments','bcc','subject','Messages','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','util','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','./mailInteraction.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','MailInteraction','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','mail_messages','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search'];(function(_0x2595ed,_0x4047f2){var _0x5ed73b=function(_0x109380){while(--_0x109380){_0x2595ed['push'](_0x2595ed['shift']());}};_0x5ed73b(++_0x4047f2);}(_0x3ca4,0x17d));var _0x43ca=function(_0x16e7ff,_0x23777e){_0x16e7ff=_0x16e7ff-0x0;var _0x5b99bb=_0x3ca4[_0x16e7ff];return _0x5b99bb;};'use strict';var emlformat=require(_0x43ca('0x0'));var rimraf=require(_0x43ca('0x1'));var zipdir=require(_0x43ca('0x2'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x43ca('0x3'));var path=require(_0x43ca('0x4'));var fs=require('fs');var _=require(_0x43ca('0x5'));var squel=require(_0x43ca('0x6'));var juice=require(_0x43ca('0x7'));var Redis=require(_0x43ca('0x8'));var qs=require(_0x43ca('0x9'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x43ca('0xa'))(_0x43ca('0xb'));var config=require(_0x43ca('0xc'));var db=require(_0x43ca('0xd'))['db'];var htmlEntities=require(_0x43ca('0xe'));config[_0x43ca('0xf')]=_[_0x43ca('0x10')](config[_0x43ca('0xf')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x43ca('0xf')]));require(_0x43ca('0x11'))[_0x43ca('0x12')](socket);function respondWithStatusCode(_0x2facc9,_0x4ae0a3){_0x4ae0a3=_0x4ae0a3||0xcc;return function(_0x41518b){if(_0x41518b){return _0x2facc9[_0x43ca('0x13')](_0x4ae0a3);}return _0x2facc9[_0x43ca('0x14')](_0x4ae0a3)[_0x43ca('0x15')]();};}function respondWithResult(_0x346a64,_0x246ead){_0x246ead=_0x246ead||0xc8;return function(_0x30184f){if(_0x30184f){return _0x346a64[_0x43ca('0x14')](_0x246ead)[_0x43ca('0x16')](_0x30184f);}};}function respondWithFilteredResult(_0x55cbce,_0x22988c){return function(_0x13cf26){if(_0x13cf26){var _0x4b710d=typeof _0x22988c[_0x43ca('0x17')]==='undefined'&&typeof _0x22988c[_0x43ca('0x18')]==='undefined';var _0xdccc62=_0x13cf26[_0x43ca('0x19')];var _0x51a517=_0x4b710d?0x0:_0x22988c[_0x43ca('0x17')];var _0x366180=_0x4b710d?_0x13cf26[_0x43ca('0x19')]:_0x22988c['offset']+_0x22988c['limit'];var _0x48a75c;if(_0x366180>=_0xdccc62){_0x366180=_0xdccc62;_0x48a75c=0xc8;}else{_0x48a75c=0xce;}_0x55cbce['status'](_0x48a75c);return _0x55cbce[_0x43ca('0x1a')](_0x43ca('0x1b'),_0x51a517+'-'+_0x366180+'/'+_0xdccc62)[_0x43ca('0x16')](_0x13cf26);}return null;};}function saveUpdates(_0x5296b9){return function(_0x3f5258){if(_0x3f5258){return _0x3f5258[_0x43ca('0x1c')](_0x5296b9)[_0x43ca('0x1d')](function(_0x4a07cd){return _0x4a07cd;});}return null;};}function removeEntity(_0x23ee82){return function(_0x51cb85){if(_0x51cb85){return _0x51cb85[_0x43ca('0x1e')]()[_0x43ca('0x1d')](function(){_0x23ee82[_0x43ca('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25244a){return function(_0xe1d605){if(!_0xe1d605){_0x25244a[_0x43ca('0x13')](0x194);}return _0xe1d605;};}function handleError(_0x2ad8fa,_0x35d34c){_0x35d34c=_0x35d34c||0x1f4;return function(_0x4c27d8){logger[_0x43ca('0x1f')](_0x4c27d8[_0x43ca('0x20')]);if(_0x4c27d8['name']){delete _0x4c27d8[_0x43ca('0x21')];}_0x2ad8fa[_0x43ca('0x14')](_0x35d34c)[_0x43ca('0x22')](_0x4c27d8);};}function getInteractionUsers(_0x3bc9ae,_0x450897){return new BPromise(function(_0x544130,_0x2da1ec){try{if(_0x450897[_0x3bc9ae['id']]){_0x3bc9ae[_0x43ca('0x23')]=_[_0x43ca('0x24')](_0x450897[_0x3bc9ae['id']],function(_0x24abdb){return{'id':_0x24abdb['id'],'fullname':_0x24abdb[_0x43ca('0x25')]};});}}catch(_0x1de54b){_0x2da1ec(_0x1de54b);}_0x544130(_0x3bc9ae);});}function getInteractionTags(_0x3b2078,_0x428fc0){return new BPromise(function(_0x5aa57c,_0x4c6b44){try{if(_0x3b2078['TagIds']){_0x3b2078[_0x43ca('0x26')]=[];_0x3b2078[_0x43ca('0x27')][_0x43ca('0x28')](',')[_0x43ca('0x29')](function(_0x34dc4f){_0x3b2078[_0x43ca('0x26')][_0x43ca('0x2a')](_0x428fc0[_0x34dc4f]);});}delete _0x3b2078[_0x43ca('0x27')];}catch(_0x5f37ff){_0x4c6b44(_0x5f37ff);}_0x5aa57c(_0x3b2078);});}function getLastMessageText(_0x3d278d){return new BPromise(function(_0x5904c7,_0x5c7c80){return db[_0x43ca('0x2b')][_0x43ca('0x2c')]({'where':{'$and':[{'MailInteractionId':_0x3d278d['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x43ca('0x2d')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x43ca('0x2e')],'order':_0x43ca('0x2f'),'raw':!![]})['then'](function(_0x1689cf){if(_0x1689cf&&_0x1689cf['plainBody']){_0x3d278d[_0x43ca('0x30')]=_['trimStart'](_0x1689cf[_0x43ca('0x2e')]);}_0x5904c7(_0x3d278d);})[_0x43ca('0x31')](function(_0x57c850){_0x5c7c80(_0x57c850);});});}function updateMailInteraction(_0x609b81,_0xce2d1a,_0x3ae919,_0x2a2f8a){return new BPromise(function(_0x46650d,_0x1baaed){return getInteractionUsers(_0x609b81,_0x3ae919)[_0x43ca('0x1d')](function(_0x4909ff){return getInteractionTags(_0x4909ff,_0xce2d1a);})[_0x43ca('0x1d')](function(_0x5976a3){return getStateInteraction(_0x5976a3);})[_0x43ca('0x1d')](function(_0x3ac086){if(_0x2a2f8a){_0x46650d(getLastMessageText(_0x3ac086));}else{_0x46650d(_0x3ac086);}})['catch'](function(_0x33b0b6){_0x1baaed(_0x33b0b6);});});}function getStateInteraction(_0x5ce3a0){return new BPromise(function(_0x49ef94){_0x5ce3a0[_0x43ca('0x32')]=0x0;_0x5ce3a0[_0x43ca('0x33')]=0x0;_0x5ce3a0[_0x43ca('0x34')]=0x0;_0x5ce3a0[_0x43ca('0x35')]=0x0;_0x5ce3a0[_0x43ca('0x36')]=0x0;if(!_0x5ce3a0[_0x43ca('0x37')]&&!_0x5ce3a0[_0x43ca('0x38')]){_0x5ce3a0['waiting']+=0x1;}if(!_0x5ce3a0[_0x43ca('0x37')]&&_0x5ce3a0[_0x43ca('0x38')]){_0x5ce3a0['talking']+=0x1;if(_0x5ce3a0[_0x43ca('0x32')]){_0x5ce3a0[_0x43ca('0x32')]-=0x1;}}if(_0x5ce3a0['closed']&&_0x5ce3a0[_0x43ca('0x38')]){_0x5ce3a0['answered']+=0x1;if(_0x5ce3a0['talking']){_0x5ce3a0[_0x43ca('0x33')]-=0x1;}}if(_0x5ce3a0[_0x43ca('0x37')]&&!_0x5ce3a0[_0x43ca('0x38')]){_0x5ce3a0[_0x43ca('0x35')]+=0x1;if(_0x5ce3a0[_0x43ca('0x32')]){_0x5ce3a0[_0x43ca('0x32')]-=0x1;}}_0x5ce3a0[_0x43ca('0x36')]+=0x1;_0x49ef94(_0x5ce3a0);});}exports[_0x43ca('0x39')]=function(_0x35e316,_0x267c2d){var _0x9f4f91={},_0x12372f={},_0x5f1da2={'count':0x0,'rows':[]};var _0x58e2d4=_[_0x43ca('0x24')](db[_0x43ca('0x3a')][_0x43ca('0x3b')],function(_0x5d68af){return{'name':_0x5d68af[_0x43ca('0x3c')],'type':_0x5d68af['type'][_0x43ca('0x3d')]};});_0x12372f['model']=_[_0x43ca('0x24')](_0x58e2d4,_0x43ca('0x21'));_0x12372f[_0x43ca('0x3e')]=_[_0x43ca('0x3f')](_0x35e316[_0x43ca('0x3e')]);_0x12372f[_0x43ca('0x40')]=_['intersection'](_0x12372f['model'],_0x12372f[_0x43ca('0x3e')]);_0x9f4f91[_0x43ca('0x41')]=_[_0x43ca('0x42')](_0x12372f[_0x43ca('0x43')],qs[_0x43ca('0x44')](_0x35e316[_0x43ca('0x3e')][_0x43ca('0x44')]));_0x9f4f91[_0x43ca('0x41')]=_0x9f4f91[_0x43ca('0x41')][_0x43ca('0x45')]?_0x9f4f91[_0x43ca('0x41')]:_0x12372f[_0x43ca('0x43')];if(!_0x35e316[_0x43ca('0x3e')][_0x43ca('0x46')](_0x43ca('0x47'))){_0x9f4f91[_0x43ca('0x18')]=qs[_0x43ca('0x18')](_0x35e316[_0x43ca('0x3e')][_0x43ca('0x18')]);_0x9f4f91[_0x43ca('0x17')]=qs[_0x43ca('0x17')](_0x35e316['query'][_0x43ca('0x17')]);}_0x9f4f91[_0x43ca('0x48')]=qs[_0x43ca('0x49')](_0x35e316['query'][_0x43ca('0x49')]);_0x9f4f91[_0x43ca('0x4a')]=qs[_0x43ca('0x40')](_[_0x43ca('0x4b')](_0x35e316[_0x43ca('0x3e')],_0x12372f[_0x43ca('0x40')]),_0x58e2d4);var _0x1ec08c=[];var _0x23ddf0=squel[_0x43ca('0x4c')]()[_0x43ca('0x4d')]('id')[_0x43ca('0x4d')]('name')[_0x43ca('0x4d')](_0x43ca('0x4e'))[_0x43ca('0x4f')]('tools_tags');var _0x4bbf51=squel[_0x43ca('0x4c')]()['field'](_0x43ca('0x50'))['field'](_0x43ca('0x51'))[_0x43ca('0x4d')](_0x43ca('0x52'))['from'](_0x43ca('0x53'),'ui')[_0x43ca('0x54')]('users','u',_0x43ca('0x55'));var _0x4d2aed=squel['select']()[_0x43ca('0x4f')](_0x43ca('0x56'),'i')[_0x43ca('0x54')](_0x43ca('0x57'),'c',_0x43ca('0x58'))[_0x43ca('0x54')]('users','o','o.id\x20=\x20i.UserId')[_0x43ca('0x54')](_0x43ca('0x59'),'a','a.id\x20=\x20i.MailAccountId')['left_join'](_0x43ca('0x5a'),'me','me.MailInteractionId\x20=\x20i.id')[_0x43ca('0x54')](_0x43ca('0x5b'),'it',_0x43ca('0x5c'))['left_join'](_0x43ca('0x5d'),'t',_0x43ca('0x5e'));var _0x5c3827=squel['expr']();var _0x3235b7=[];var _0x1d22c4=squel[_0x43ca('0x5f')]();var _0x3f53e8;if(_0x35e316[_0x43ca('0x3e')][_0x43ca('0x60')]){_0x3f53e8=as['parseSearch'](_0x35e316['query'][_0x43ca('0x60')]);var _0x27e5cc=_0x3f53e8[_0x43ca('0x61')];for(var _0x3d91d2=0x0;_0x3d91d2<_0x3f53e8[_0x43ca('0x62')][_0x43ca('0x45')];_0x3d91d2++){var _0x3aa110=_0x3f53e8[_0x43ca('0x62')][_0x3d91d2];var _0x41da8d='i';var _0x7357f9=_[_0x43ca('0x63')](_0x58e2d4,[_0x43ca('0x21'),_0x3aa110[_0x43ca('0x4d')]]);if(!_0x7357f9){switch(_0x3aa110[_0x43ca('0x4d')]){case'unreadMessages':if(_0x3aa110[_0x43ca('0x64')]==0x1){_0x4d2aed[_0x43ca('0x65')]('`'+_0x3aa110[_0x43ca('0x4d')]+_0x43ca('0x66'));}else{_0x4d2aed[_0x43ca('0x65')]('`'+_0x3aa110['field']+_0x43ca('0x67'));}break;case _0x43ca('0x68'):if(_0x3aa110['operator']===_0x43ca('0x69')){if(_0x3aa110[_0x43ca('0x64')]['split']('\x20')['length']>0x1){_0x5c3827[_0x27e5cc](_0x43ca('0x6a'),qs[_0x43ca('0x6b')](_0x3aa110[_0x43ca('0x64')]),null);}else{var _0x52f625='%'+_0x3aa110[_0x43ca('0x64')]+'%';_0x5c3827[_0x27e5cc](_0x43ca('0x6c'),_0x52f625,_0x52f625,_0x52f625);}}else{_0x7357f9=_[_0x43ca('0x63')](_0x58e2d4,[_0x43ca('0x21'),_0x43ca('0x6d')]);_0x3aa110[_0x43ca('0x4d')]=_0x43ca('0x6d');_0x282813=as[_0x43ca('0x6e')](_0x41da8d,_0x7357f9[_0x43ca('0x6f')],_0x3aa110);_0x5c3827[_0x27e5cc](_0x282813[_0x43ca('0x70')],_0x282813['value'][_0x43ca('0x71')],_0x282813[_0x43ca('0x64')][_0x43ca('0x15')]);}break;case _0x43ca('0x72'):var _0x2e3353=_0x3aa110[_0x43ca('0x64')]['split'](',')[_0x43ca('0x24')](function(_0x3d25cc){return Number(_0x3d25cc);});_0x2e3353[_0x43ca('0x29')](function(_0x2b1c94){_0x1d22c4['or'](_0x43ca('0x73'),'%,'+_0x2b1c94+',%');});_0x3235b7=_[_0x43ca('0x74')](_0x3235b7,_0x2e3353);break;case _0x43ca('0x75'):if(_0x3aa110[_0x43ca('0x76')]==='$substring'){_0x5c3827[_0x27e5cc](_0x43ca('0x77'),'%'+_0x3aa110[_0x43ca('0x64')]+'%',null);}else{_0x7357f9=_[_0x43ca('0x63')](_0x58e2d4,['name',_0x43ca('0x38')]);_0x3aa110[_0x43ca('0x4d')]='UserId';_0x282813=as[_0x43ca('0x6e')](_0x41da8d,_0x7357f9['type'],_0x3aa110);_0x5c3827[_0x27e5cc](_0x282813['text'],_0x282813[_0x43ca('0x64')][_0x43ca('0x71')],_0x282813[_0x43ca('0x64')][_0x43ca('0x15')]);}break;case _0x43ca('0x2e'):_0x282813=as['buildExpression']('me',null,_0x3aa110);_0x5c3827[_0x27e5cc](_0x282813[_0x43ca('0x70')],_0x282813['value'][_0x43ca('0x71')],_0x282813[_0x43ca('0x64')][_0x43ca('0x15')]);break;}}else{var _0x282813=as[_0x43ca('0x6e')](_0x41da8d,_0x7357f9[_0x43ca('0x6f')],_0x3aa110);_0x5c3827[_0x27e5cc](_0x282813[_0x43ca('0x70')],_0x282813['value'][_0x43ca('0x71')],_0x282813[_0x43ca('0x64')][_0x43ca('0x15')]);}}}else{var _0x248e4e=_(_0x35e316[_0x43ca('0x3e')])['keys']()[_0x43ca('0x24')](function(_0x4361a1){return _['some'](_0x58e2d4,[_0x43ca('0x21'),_0x4361a1])?_0x4361a1:undefined;})[_0x43ca('0x78')]()[_0x43ca('0x64')]();if(!_[_0x43ca('0x79')](_0x248e4e)){_0x248e4e[_0x43ca('0x29')](function(_0x15584e){if(_0x15584e===_0x43ca('0x7a')){_0x4d2aed[_0x43ca('0x4a')](_0x43ca('0x7b'),[][_0x43ca('0x7c')](_0x35e316['query'][_0x15584e]));}else if(_0x15584e===_0x43ca('0x7d')){var _0xfdc74a=JSON['parse'](_0x35e316[_0x43ca('0x3e')][_0x15584e])[_0x43ca('0x7e')];var _0x1394a2=JSON[_0x43ca('0x7f')](_0x35e316[_0x43ca('0x3e')][_0x15584e])['$lte'];_0x4d2aed[_0x43ca('0x4a')](_0x43ca('0x80'),_0xfdc74a,_0x1394a2);}else{if(_0x35e316['query'][_0x15584e]===_0x43ca('0x81')){_0x4d2aed[_0x43ca('0x4a')]('i.'+_0x15584e+_0x43ca('0x82'));}else{_0x4d2aed[_0x43ca('0x4a')]('i.'+_0x15584e+_0x43ca('0x83'),_0x35e316[_0x43ca('0x3e')][_0x15584e]);}}});}if(_0x35e316[_0x43ca('0x3e')][_0x43ca('0x84')]){if(_0x35e316['query']['read']==0x1){_0x4d2aed[_0x43ca('0x65')]('`unreadMessages`\x20=\x200');}else{_0x4d2aed['having'](_0x43ca('0x85'));}}if(_0x35e316[_0x43ca('0x3e')][_0x43ca('0x86')]){_0x3235b7=_[_0x43ca('0x87')](_0x35e316[_0x43ca('0x3e')][_0x43ca('0x86')])?_0x35e316[_0x43ca('0x3e')][_0x43ca('0x86')]:new Array(_0x35e316['query']['tag']);_0x3235b7[_0x43ca('0x29')](function(_0x2dadba){_0x1d22c4['or'](_0x43ca('0x73'),'%,'+_0x2dadba+',%');});}if(_0x35e316[_0x43ca('0x3e')][_0x43ca('0x88')]){var _0x258f96=_0x35e316[_0x43ca('0x3e')][_0x43ca('0x88')][_0x43ca('0x89')]('\x5c','\x5c\x5c')[_0x43ca('0x89')](/'/g,'\x27\x27');if(qs[_0x43ca('0x8a')](_0x258f96)){_0x5c3827['or'](_0x43ca('0x8b'),_0x258f96+'%');}else if(qs[_0x43ca('0x8c')](_0x258f96)){_0x5c3827['or']('c.email\x20LIKE\x20?',_0x258f96+'%');}else{_0x5c3827['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x258f96))['or'](_0x43ca('0x8d'),qs[_0x43ca('0x6b')](_0x258f96));}}}_0x4d2aed[_0x43ca('0x4a')](_0x5c3827);_0x4d2aed[_0x43ca('0x8e')](_0x43ca('0x8f'));var _0x2e5536={'type':db[_0x43ca('0x90')][_0x43ca('0x91')][_0x43ca('0x92')],'raw':!![]};var _0xf0abf0=_0x4d2aed['clone']();_0xf0abf0['field'](_0x43ca('0x8f'));_0xf0abf0[_0x43ca('0x4d')](_0x43ca('0x93'),_0x43ca('0x94'));if(_0x9f4f91['order']){_0x9f4f91[_0x43ca('0x48')][_0x43ca('0x29')](function(_0x3bb4ba){var _0x3a54ff=_0x3bb4ba[0x0]===_0x43ca('0x95')?_0x3bb4ba[0x0]:'i.'+_0x3bb4ba[0x0];_0x4d2aed[_0x43ca('0x48')](_0x3a54ff,_0x3bb4ba[0x1]===_0x43ca('0x96')?![]:!![]);});}if(!_[_0x43ca('0x79')](_0x3235b7)){_0x4d2aed['having'](_0x1d22c4);_0xf0abf0[_0x43ca('0x4a')](_0x43ca('0x97'),_0x3235b7);}BPromise[_0x43ca('0x98')]()[_0x43ca('0x1d')](function(){if(!_0x3f53e8){if(_0x35e316[_0x43ca('0x3e')][_0x43ca('0x7a')])return;_0xf0abf0[_0x43ca('0x4a')](_0x43ca('0x99'));_0x4d2aed[_0x43ca('0x4a')](_0x43ca('0x99'));return;}if(_0x35e316[_0x43ca('0x9a')]['role']!=='agent')return;return _0x35e316[_0x43ca('0x9a')][_0x43ca('0x9b')]({'attributes':['id'],'raw':!![]})['then'](function(_0x289cb5){if(_[_0x43ca('0x79')](_0x289cb5)){_0xf0abf0[_0x43ca('0x4a')](_0x43ca('0x9c'));_0x4d2aed[_0x43ca('0x4a')](_0x43ca('0x9c'));}else{_0xf0abf0['where'](_0x43ca('0x7b'),_[_0x43ca('0x24')](_0x289cb5,'id'));_0x4d2aed[_0x43ca('0x4a')](_0x43ca('0x7b'),_['map'](_0x289cb5,'id'));}});})[_0x43ca('0x1d')](function(){if(_0x35e316[_0x43ca('0x9a')]['role']==='agent'&&!_0x3f53e8&&!_0x35e316[_0x43ca('0x3e')][_0x43ca('0x7a')])return[];return db[_0x43ca('0x9d')][_0x43ca('0x3e')](_0xf0abf0[_0x43ca('0x9e')](),_0x2e5536);})[_0x43ca('0x1d')](function(_0x4c9b3d){_0x5f1da2[_0x43ca('0x19')]=_0x4c9b3d[_0x43ca('0x45')];if(_0x5f1da2[_0x43ca('0x19')]===0x0)return[];return db[_0x43ca('0x9d')][_0x43ca('0x3e')](_0x23ddf0['toString'](),_0x2e5536)[_0x43ca('0x1d')](function(_0x2b7445){_0x1ec08c=_['keyBy'](_0x2b7445,'id');_0x2e5536=_[_0x43ca('0x9f')](_0x2e5536,{'model':db[_0x43ca('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x35e316[_0x43ca('0x3e')][_0x43ca('0x44')]){_0x9f4f91[_0x43ca('0x41')][_0x43ca('0x29')](function(_0x3a88b4){_0x4d2aed['field']('i.'+_0x3a88b4);});}else{_0x4d2aed[_0x43ca('0x4d')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x43ca('0x94'));_0x4d2aed[_0x43ca('0x4d')](_0x43ca('0xa0'),_0x43ca('0xa1'));_0x4d2aed[_0x43ca('0x4d')](_0x43ca('0xa2'),'Account.mandatoryDisposition');_0x4d2aed[_0x43ca('0x4d')](_0x43ca('0xa3'),_0x43ca('0x95'));_0x4d2aed[_0x43ca('0x4d')](_0x43ca('0x8f'));_0x4d2aed[_0x43ca('0x4d')](_0x43ca('0xa4'));_0x4d2aed[_0x43ca('0x4d')](_0x43ca('0xa5'));_0x4d2aed['field'](_0x43ca('0xa6'));_0x4d2aed[_0x43ca('0x4d')]('i.closedAt');_0x4d2aed[_0x43ca('0x4d')]('i.attach');_0x4d2aed[_0x43ca('0x4d')]('i.lastMsgAt');_0x4d2aed[_0x43ca('0x4d')](_0x43ca('0xa7'));_0x4d2aed['field'](_0x43ca('0xa8'));_0x4d2aed[_0x43ca('0x4d')]('i.disposition');_0x4d2aed[_0x43ca('0x4d')](_0x43ca('0xa9'));_0x4d2aed[_0x43ca('0x4d')]('i.thirdDisposition');_0x4d2aed[_0x43ca('0x4d')](_0x43ca('0xaa'));_0x4d2aed[_0x43ca('0x4d')](_0x43ca('0xab'));_0x4d2aed[_0x43ca('0x4d')]('i.ContactId');_0x4d2aed[_0x43ca('0x4d')](_0x43ca('0xac'));_0x4d2aed[_0x43ca('0x4d')](_0x43ca('0xad'));_0x4d2aed[_0x43ca('0x4d')](_0x43ca('0xae'),_0x43ca('0xaf'));_0x4d2aed[_0x43ca('0x4d')](_0x43ca('0xb0'),'Contact.lastName');_0x4d2aed['field'](_0x43ca('0xb1'),'Contact.email');_0x4d2aed[_0x43ca('0x4d')](_0x43ca('0xb2'),'Contact.phone');_0x4d2aed['field'](_0x43ca('0xb3'),_0x43ca('0xb4'));_0x4d2aed[_0x43ca('0x4d')](_0x43ca('0xb5'),_0x43ca('0xb6'));_0x4d2aed[_0x43ca('0x4d')](_0x43ca('0xb7'),_0x43ca('0xb8'));_0x4d2aed['field'](_0x43ca('0xb9'),_0x43ca('0xba'));_0x4d2aed['field'](_0x43ca('0xbb'),'TagIds');}if(_0x9f4f91['limit'])_0x4d2aed[_0x43ca('0x18')](_0x9f4f91['limit']);if(_0x9f4f91[_0x43ca('0x17')])_0x4d2aed[_0x43ca('0x17')](_0x9f4f91[_0x43ca('0x17')]);return db[_0x43ca('0x9d')][_0x43ca('0x3e')](_0x4d2aed[_0x43ca('0x9e')](),_0x2e5536);})[_0x43ca('0x1d')](function(_0x10b5c9){if(_0x10b5c9[_0x43ca('0x45')]>0x0)_0x4bbf51[_0x43ca('0x4a')](_0x43ca('0xbc'),_[_0x43ca('0x24')](_0x10b5c9,'id'));return db[_0x43ca('0x9d')]['query'](_0x4bbf51['toString'](),_0x2e5536)[_0x43ca('0x1d')](function(_0x4cf7f7){var _0x25d2ba=_[_0x43ca('0xbd')](_0x4cf7f7,_0x43ca('0xbe'));var _0x2d275f=[];return db[_0x43ca('0xbf')][_0x43ca('0x2c')]({'attributes':['enableEmailPreview'],'raw':!![]})['then'](function(_0x4845f7){var _0x45bca5=_0x4845f7[_0x43ca('0xc0')];_0x10b5c9['forEach'](function(_0x23baf4){_0x2d275f['push'](updateMailInteraction(_0x23baf4,_0x1ec08c,_0x25d2ba,_0x45bca5));});return BPromise[_0x43ca('0xc1')](_0x2d275f);});});});})[_0x43ca('0x1d')](function(_0x1f8ba0){_0x5f1da2[_0x43ca('0xc2')]=_0x1f8ba0;return _0x5f1da2;})[_0x43ca('0x1d')](respondWithFilteredResult(_0x267c2d,_0x9f4f91))[_0x43ca('0x31')](handleError(_0x267c2d,null));};exports[_0x43ca('0xc3')]=function(_0x43bfce,_0x3607d8){var _0x5db2fe={'raw':![],'where':{'id':_0x43bfce[_0x43ca('0xc4')]['id']}},_0x312b62={};_0x312b62[_0x43ca('0x43')]=_[_0x43ca('0x3f')](db[_0x43ca('0x3a')][_0x43ca('0x3b')]);_0x312b62[_0x43ca('0x3e')]=_[_0x43ca('0x3f')](_0x43bfce[_0x43ca('0x3e')]);_0x312b62['filters']=_[_0x43ca('0x42')](_0x312b62[_0x43ca('0x43')],_0x312b62['query']);_0x5db2fe['attributes']=_['intersection'](_0x312b62[_0x43ca('0x43')],qs[_0x43ca('0x44')](_0x43bfce[_0x43ca('0x3e')]['fields']));_0x5db2fe[_0x43ca('0x41')]=_0x5db2fe[_0x43ca('0x41')][_0x43ca('0x45')]?_0x5db2fe[_0x43ca('0x41')]:_0x312b62[_0x43ca('0x43')];if(_0x43bfce[_0x43ca('0x3e')][_0x43ca('0xc5')]){_0x5db2fe[_0x43ca('0xc6')]=[{'all':!![]}];}_0x5db2fe=_['merge']({},_0x5db2fe,_0x43bfce[_0x43ca('0xc7')]);return db[_0x43ca('0x3a')][_0x43ca('0x63')](_0x5db2fe)[_0x43ca('0x1d')](handleEntityNotFound(_0x3607d8,null))['then'](respondWithResult(_0x3607d8,null))[_0x43ca('0x31')](handleError(_0x3607d8,null));};exports['create']=function(_0x300edc,_0x5038e7){return db[_0x43ca('0x3a')][_0x43ca('0xc8')](_0x300edc[_0x43ca('0xc9')],{})['then'](respondWithResult(_0x5038e7,0xc9))['catch'](handleError(_0x5038e7,null));};exports[_0x43ca('0x1c')]=function(_0x52c889,_0x405b8a){if(_0x52c889['body']['id']){delete _0x52c889['body']['id'];}return db[_0x43ca('0x3a')]['find']({'where':{'id':_0x52c889[_0x43ca('0xc4')]['id']}})[_0x43ca('0x1d')](handleEntityNotFound(_0x405b8a,null))['then'](saveUpdates(_0x52c889['body'],null))['then'](respondWithResult(_0x405b8a,null))[_0x43ca('0x31')](handleError(_0x405b8a,null));};exports['destroy']=function(_0x4b974e,_0x441faa){return db[_0x43ca('0x3a')][_0x43ca('0x63')]({'where':{'id':_0x4b974e['params']['id']}})['then'](handleEntityNotFound(_0x441faa,null))['then'](removeEntity(_0x441faa,null))[_0x43ca('0x31')](handleError(_0x441faa,null));};exports[_0x43ca('0xca')]=function(_0x1ad8c7,_0x2d5da0){return db['MailInteraction'][_0x43ca('0xca')]()[_0x43ca('0x1d')](respondWithResult(_0x2d5da0,null))[_0x43ca('0x31')](handleError(_0x2d5da0,null));};exports[_0x43ca('0xcb')]=function(_0x2bebbe,_0x5b7082){return db['MailMessage'][_0x43ca('0x63')]({'where':{'id':_0x2bebbe[_0x43ca('0xc4')]['id']}})[_0x43ca('0x1d')](handleEntityNotFound(_0x5b7082,null))[_0x43ca('0x1d')](function(_0x1ea99d){if(_0x1ea99d){return _0x1ea99d[_0x43ca('0xcb')](_0x2bebbe[_0x43ca('0xc9')]['ids'],_['omit'](_0x2bebbe[_0x43ca('0xc9')],[_0x43ca('0xcc'),'id'])||{});}})[_0x43ca('0x1d')](respondWithResult(_0x5b7082,null))['catch'](handleError(_0x5b7082,null));};exports[_0x43ca('0xcd')]=function(_0xc96d40,_0x3aef2f){var _0x5d3abf={'raw':![],'where':{}};var _0x9016e5={};var _0x4911f1={'count':0x0,'rows':[]};return db[_0x43ca('0x3a')][_0x43ca('0x2c')]({'where':{'id':_0xc96d40['params']['id']}})[_0x43ca('0x1d')](handleEntityNotFound(_0x3aef2f,null))[_0x43ca('0x1d')](function(_0x497c87){if(_0x497c87){_0x9016e5['model']=_[_0x43ca('0x3f')](db[_0x43ca('0x2b')][_0x43ca('0x3b')]);_0x9016e5[_0x43ca('0x3e')]=_[_0x43ca('0x3f')](_0xc96d40[_0x43ca('0x3e')]);_0x9016e5[_0x43ca('0x40')]=_['intersection'](_0x9016e5['model'],_0x9016e5[_0x43ca('0x3e')]);_0x5d3abf['attributes']=_[_0x43ca('0x42')](_0x9016e5[_0x43ca('0x43')],qs['fields'](_0xc96d40['query'][_0x43ca('0x44')]));_0x5d3abf[_0x43ca('0x41')]=_0x5d3abf[_0x43ca('0x41')][_0x43ca('0x45')]?_0x5d3abf[_0x43ca('0x41')]:_0x9016e5[_0x43ca('0x43')];if(!_0xc96d40[_0x43ca('0x3e')][_0x43ca('0x46')](_0x43ca('0x47'))){_0x5d3abf[_0x43ca('0x18')]=qs[_0x43ca('0x18')](_0xc96d40[_0x43ca('0x3e')]['limit']);_0x5d3abf[_0x43ca('0x17')]=qs[_0x43ca('0x17')](_0xc96d40[_0x43ca('0x3e')][_0x43ca('0x17')]);}_0x5d3abf['order']=qs[_0x43ca('0x49')](_0xc96d40[_0x43ca('0x3e')][_0x43ca('0x49')]);_0x5d3abf[_0x43ca('0x4a')]=qs[_0x43ca('0x40')](_['pick'](_0xc96d40[_0x43ca('0x3e')],_0x9016e5['filters']));_0x5d3abf[_0x43ca('0x4a')][_0x43ca('0xbe')]=_0x497c87['id'];if(_0xc96d40[_0x43ca('0x3e')]['filter']){_0x5d3abf[_0x43ca('0x4a')]=_['merge'](_0x5d3abf[_0x43ca('0x4a')],{'$or':_[_0x43ca('0x24')](_0x5d3abf[_0x43ca('0x41')],function(_0x3050f8){var _0x36125e={};_0x36125e[_0x3050f8]={'$like':'%'+_0xc96d40[_0x43ca('0x3e')][_0x43ca('0x88')]+'%'};return _0x36125e;})});}if(_0xc96d40[_0x43ca('0x3e')][_0x43ca('0x7e')]){var _0x1b0cae=_0xc96d40['query'][_0x43ca('0x7e')]['split'](',');var _0x2fc08e={};_0x2fc08e[_0x1b0cae[0x0]]={'$gte':moment(_0x1b0cae[0x1])[_0x43ca('0xce')](_0x43ca('0xcf'))};_0x5d3abf['where']=_[_0x43ca('0x9f')](_0x5d3abf[_0x43ca('0x4a')],_0x2fc08e);}_0x5d3abf=_[_0x43ca('0x9f')]({},_0x5d3abf,_0xc96d40[_0x43ca('0xc7')]);return db['MailMessage'][_0x43ca('0x19')]({'where':_0x5d3abf[_0x43ca('0x4a')]})[_0x43ca('0x1d')](function(_0x11bbcb){_0x4911f1[_0x43ca('0x19')]=_0x11bbcb;if(_0xc96d40['query']['includeAll']){_0x5d3abf[_0x43ca('0xc6')]=[{'all':!![]}];}return db[_0x43ca('0x2b')][_0x43ca('0xd0')](_0x5d3abf);})[_0x43ca('0x1d')](function(_0x366116){if(_0xc96d40[_0x43ca('0x3e')]['inlineCss']==='true'){for(var _0x277a2a=0x0;_0x277a2a<_0x366116[_0x43ca('0x45')];_0x277a2a++){_0x366116[_0x277a2a][_0x43ca('0xc9')]=juice(_0x366116[_0x277a2a]['body']);}}_0x4911f1[_0x43ca('0xc2')]=_0x366116;return _0x4911f1;});}})[_0x43ca('0x1d')](respondWithFilteredResult(_0x3aef2f,_0x5d3abf))[_0x43ca('0x31')](handleError(_0x3aef2f,null));};exports[_0x43ca('0xd1')]=function(_0xf1a9ef,_0x30b1be){return db[_0x43ca('0x3a')][_0x43ca('0x63')]({'where':{'id':_0xf1a9ef['params']['id']}})[_0x43ca('0x1d')](handleEntityNotFound(_0x30b1be,null))['then'](function(_0x46e25b){if(_0x46e25b){return _0x46e25b['setTags'](_0xf1a9ef[_0x43ca('0xc9')][_0x43ca('0xcc')],_[_0x43ca('0xd2')](_0xf1a9ef[_0x43ca('0xc9')],[_0x43ca('0xcc'),'id'])||{})[_0x43ca('0xd3')](function(){return db[_0x43ca('0x72')][_0x43ca('0xd0')]({'attributes':['id',_0x43ca('0x21'),_0x43ca('0x4e')],'where':{'id':_0xf1a9ef[_0x43ca('0xc9')][_0x43ca('0xcc')]}});})['then'](function(_0x4fc8df){socket[_0x43ca('0xd4')](_0x43ca('0xd5'),{'id':Number(_0xf1a9ef['params']['id']),'tags':_0x4fc8df||[]});return{'id':Number(_0xf1a9ef[_0x43ca('0xc4')]['id']),'tags':_0x4fc8df||[]};});}})['then'](respondWithResult(_0x30b1be,null))[_0x43ca('0x31')](handleError(_0x30b1be,null));};exports[_0x43ca('0xd6')]=function(_0x53c97a,_0xfdfeab){return db[_0x43ca('0x3a')][_0x43ca('0x63')]({'where':{'id':_0x53c97a[_0x43ca('0xc4')]['id']}})[_0x43ca('0x1d')](handleEntityNotFound(_0xfdfeab,null))[_0x43ca('0x1d')](function(_0x1c147f){if(_0x1c147f){return _0x1c147f[_0x43ca('0xd6')](_0x53c97a['query'][_0x43ca('0xcc')]);}})['then'](respondWithStatusCode(_0xfdfeab,null))[_0x43ca('0x31')](handleError(_0xfdfeab,null));};exports[_0x43ca('0xd7')]=function(_0xd59f60,_0x222c62){var _0x4a84ac=moment()[_0x43ca('0xd8')]()[_0x43ca('0x9e')]();var _0x395b95=path[_0x43ca('0xd9')](config[_0x43ca('0xda')],'server',_0x43ca('0xdb'),_0x43ca('0xdc'));var _0x3a772f=path['join'](config[_0x43ca('0xda')],'server',_0x43ca('0xdb'),_0x43ca('0xdd'));var _0x43c2f8=path[_0x43ca('0xd9')](_0x395b95,_0x4a84ac);var _0x4cf4b0=util[_0x43ca('0xce')]('transcript-%d-%s.zip',_0xd59f60[_0x43ca('0xc4')]['id'],_0x4a84ac);var _0x297216=path[_0x43ca('0xd9')](_0x395b95,_0x4cf4b0);var _0x499daa=[];if(_0xd59f60[_0x43ca('0x3e')][_0x43ca('0xdd')]){_0x499daa[_0x43ca('0x2a')]({'model':db['Attachment'],'as':_0x43ca('0xde'),'raw':!![]});}var _0x4633d2=[{'model':db[_0x43ca('0x2b')],'as':'Messages','attributes':['id',_0x43ca('0xc9'),_0x43ca('0x4f'),'to','cc',_0x43ca('0xdf'),_0x43ca('0xe0'),_0x43ca('0x7d')],'where':{'secret':![]},'order':qs[_0x43ca('0x49')]('id'),'include':_0x499daa}];return db[_0x43ca('0x3a')][_0x43ca('0x63')]({'where':{'id':_0xd59f60[_0x43ca('0xc4')]['id']},'include':_0x4633d2})[_0x43ca('0x1d')](handleEntityNotFound(_0x222c62,null))[_0x43ca('0x1d')](function(_0x5bc3c5){if(_0x5bc3c5&&_0x5bc3c5[_0x43ca('0xe1')]){var _0x559579=_0x5bc3c5[_0x43ca('0xe2')]({'plain':!![]});fs[_0x43ca('0xe3')](_0x43c2f8);return BPromise[_0x43ca('0xe4')](_0x559579[_0x43ca('0xe1')],function(_0x58eec0,_0x4cc034){var _0x1d85ff={'from':_0x58eec0[_0x43ca('0x4f')],'to':_0x58eec0['to'],'subject':_0x58eec0['subject'],'html':htmlEntities[_0x43ca('0xe5')](_0x58eec0[_0x43ca('0xc9')]),'headers':{'Date':moment(_0x58eec0['createdAt'])['format'](_0x43ca('0xe6'))},'attachments':[]};if(_0x58eec0['cc']){_0x1d85ff[_0x43ca('0xe7')]['Cc']=_0x58eec0['cc'];}if(_0x58eec0[_0x43ca('0xdf')]){_0x1d85ff[_0x43ca('0xe7')][_0x43ca('0xe8')]=_0x58eec0['bcc'];}return new BPromise(function(_0x5d645c,_0x31b409){if(_0x58eec0['Attachments']){for(var _0x2a10cd=0x0;_0x2a10cd<_0x58eec0[_0x43ca('0xde')][_0x43ca('0x45')];_0x2a10cd++){var _0x52a271=_0x58eec0[_0x43ca('0xde')][_0x2a10cd];var _0x36023d=path['join'](_0x3a772f,_0x52a271[_0x43ca('0xe9')]);if(fs['existsSync'](_0x36023d)){_0x1d85ff[_0x43ca('0xdd')][_0x43ca('0x2a')]({'name':_0x52a271['name'],'contentType':_0x52a271['type'],'data':fs[_0x43ca('0xea')](_0x36023d)});}}}emlformat[_0x43ca('0xeb')](_0x1d85ff,function(_0x2a84b6,_0x3c46e6){if(_0x2a84b6)return _0x31b409(_0x2a84b6);fs[_0x43ca('0xec')](path[_0x43ca('0xd9')](_0x43c2f8,util[_0x43ca('0xce')](_0x43ca('0xed'),_0x4cc034)),_0x3c46e6);return _0x5d645c(_0x3c46e6);});});})[_0x43ca('0x1d')](function(){return new BPromise(function(_0x30b7af,_0xdfa83f){zipdir(_0x43c2f8,{'saveTo':_0x297216},function(_0x457674,_0x1a2c1b){if(_0x457674)return _0xdfa83f(_0x457674);return _0x30b7af(_0x1a2c1b);});})[_0x43ca('0x1d')](function(){return new BPromise(function(_0x592552,_0x2115b5){rimraf(_0x43c2f8,function(_0x224c3f){if(_0x224c3f)_0x2115b5(_0x224c3f);return _0x592552();});});})['then'](function(){return _0x222c62[_0x43ca('0xd7')](_0x297216,_0x4cf4b0,function(_0x20479c){if(!_0x20479c)fs[_0x43ca('0xee')](_0x297216);});});});}else{return _0x222c62[_0x43ca('0x13')](0xc8);}})[_0x43ca('0x31')](handleError(_0x222c62,null));}; \ No newline at end of file +var _0x8375=['sequelize','toString','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.substatus','i.to','i.ContactId','i.MailAccountId','c.firstName','Contact.firstName','c.email','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','Setting','enableEmailPreview','all','rows','params','includeAll','include','merge','options','create','body','describe','addMessage','ids','omit','getMessages','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','join','server','files','root','transcript-%d-%s.zip','attachments','Messages','bcc','subject','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','basename','readFileSync','build','writeFileSync','message%d.eml','download','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','squel','juice','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','update','then','end','error','name','Users','map','fullname','TagIds','Tags','split','push','MailMessage','findOne','out','plainBody','lastMsgText','catch','talking','answered','total','UserId','waiting','closed','unmanaged','MailInteraction','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','select','field','color','from','tools_tags','u.fullname','ui.MailInteractionId','user_has_mail_interactions','users','u.id\x20=\x20ui.UserId','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','text','some','compact','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','unreadMessages','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL'];(function(_0x1a205c,_0x27e81b){var _0x23b212=function(_0x4d5a3d){while(--_0x4d5a3d){_0x1a205c['push'](_0x1a205c['shift']());}};_0x23b212(++_0x27e81b);}(_0x8375,0x132));var _0x5837=function(_0x430d2,_0x31a588){_0x430d2=_0x430d2-0x0;var _0x66448f=_0x8375[_0x430d2];return _0x66448f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5837('0x0'));var zipdir=require(_0x5837('0x1'));var moment=require(_0x5837('0x2'));var BPromise=require(_0x5837('0x3'));var util=require(_0x5837('0x4'));var path=require(_0x5837('0x5'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5837('0x6'));var juice=require(_0x5837('0x7'));var Redis=require('ioredis');var qs=require(_0x5837('0x8'));var as=require(_0x5837('0x9'));var logger=require(_0x5837('0xa'))(_0x5837('0xb'));var config=require('../../config/environment');var db=require(_0x5837('0xc'))['db'];var htmlEntities=require(_0x5837('0xd'));config[_0x5837('0xe')]=_[_0x5837('0xf')](config[_0x5837('0xe')],{'host':_0x5837('0x10'),'port':0x18eb});var socket=require(_0x5837('0x11'))(new Redis(config[_0x5837('0xe')]));require(_0x5837('0x12'))['register'](socket);function respondWithStatusCode(_0x4051b5,_0x174b22){_0x174b22=_0x174b22||0xcc;return function(_0x5505e1){if(_0x5505e1){return _0x4051b5[_0x5837('0x13')](_0x174b22);}return _0x4051b5[_0x5837('0x14')](_0x174b22)['end']();};}function respondWithResult(_0x1b8e89,_0x5abd5e){_0x5abd5e=_0x5abd5e||0xc8;return function(_0x2b0b43){if(_0x2b0b43){return _0x1b8e89[_0x5837('0x14')](_0x5abd5e)[_0x5837('0x15')](_0x2b0b43);}};}function respondWithFilteredResult(_0xf01fb2,_0x5802e3){return function(_0x2b82a9){if(_0x2b82a9){var _0x103b9c=typeof _0x5802e3[_0x5837('0x16')]==='undefined'&&typeof _0x5802e3[_0x5837('0x17')]===_0x5837('0x18');var _0x2f8af0=_0x2b82a9[_0x5837('0x19')];var _0x304fe7=_0x103b9c?0x0:_0x5802e3[_0x5837('0x16')];var _0x4adc98=_0x103b9c?_0x2b82a9['count']:_0x5802e3['offset']+_0x5802e3[_0x5837('0x17')];var _0x106824;if(_0x4adc98>=_0x2f8af0){_0x4adc98=_0x2f8af0;_0x106824=0xc8;}else{_0x106824=0xce;}_0xf01fb2[_0x5837('0x14')](_0x106824);return _0xf01fb2[_0x5837('0x1a')](_0x5837('0x1b'),_0x304fe7+'-'+_0x4adc98+'/'+_0x2f8af0)[_0x5837('0x15')](_0x2b82a9);}return null;};}function saveUpdates(_0x2b87fb){return function(_0x4be747){if(_0x4be747){return _0x4be747[_0x5837('0x1c')](_0x2b87fb)[_0x5837('0x1d')](function(_0x295ae3){return _0x295ae3;});}return null;};}function removeEntity(_0x30c6f6){return function(_0x387809){if(_0x387809){return _0x387809['destroy']()['then'](function(){_0x30c6f6[_0x5837('0x14')](0xcc)[_0x5837('0x1e')]();});}};}function handleEntityNotFound(_0x23ccd6){return function(_0x4f74e3){if(!_0x4f74e3){_0x23ccd6[_0x5837('0x13')](0x194);}return _0x4f74e3;};}function handleError(_0x46786c,_0x4b59b1){_0x4b59b1=_0x4b59b1||0x1f4;return function(_0x3e055d){logger[_0x5837('0x1f')](_0x3e055d['stack']);if(_0x3e055d[_0x5837('0x20')]){delete _0x3e055d[_0x5837('0x20')];}_0x46786c[_0x5837('0x14')](_0x4b59b1)['send'](_0x3e055d);};}function getInteractionUsers(_0x413ea9,_0x4c431c){return new BPromise(function(_0x81fdac,_0x8e5a48){try{if(_0x4c431c[_0x413ea9['id']]){_0x413ea9[_0x5837('0x21')]=_[_0x5837('0x22')](_0x4c431c[_0x413ea9['id']],function(_0x3c92eb){return{'id':_0x3c92eb['id'],'fullname':_0x3c92eb[_0x5837('0x23')]};});}}catch(_0x22564a){_0x8e5a48(_0x22564a);}_0x81fdac(_0x413ea9);});}function getInteractionTags(_0x1d7285,_0x4f63c3){return new BPromise(function(_0x192883,_0x24b941){try{if(_0x1d7285[_0x5837('0x24')]){_0x1d7285[_0x5837('0x25')]=[];_0x1d7285[_0x5837('0x24')][_0x5837('0x26')](',')['forEach'](function(_0x321c49){_0x1d7285[_0x5837('0x25')][_0x5837('0x27')](_0x4f63c3[_0x321c49]);});}delete _0x1d7285[_0x5837('0x24')];}catch(_0x80cfc6){_0x24b941(_0x80cfc6);}_0x192883(_0x1d7285);});}function getLastMessageText(_0x445c5a){return new BPromise(function(_0x274235,_0x4e3259){return db[_0x5837('0x28')][_0x5837('0x29')]({'where':{'$and':[{'MailInteractionId':_0x445c5a['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x5837('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x5837('0x2b')],'order':'-id','raw':!![]})['then'](function(_0x42d16c){if(_0x42d16c&&_0x42d16c[_0x5837('0x2b')]){_0x445c5a[_0x5837('0x2c')]=_['trimStart'](_0x42d16c[_0x5837('0x2b')]);}_0x274235(_0x445c5a);})[_0x5837('0x2d')](function(_0x33b918){_0x4e3259(_0x33b918);});});}function updateMailInteraction(_0x38f42d,_0x35be70,_0xd4608b,_0x55df2d){return new BPromise(function(_0xd9f705,_0x794c94){return getInteractionUsers(_0x38f42d,_0xd4608b)['then'](function(_0x1f2ef5){return getInteractionTags(_0x1f2ef5,_0x35be70);})[_0x5837('0x1d')](function(_0x216f11){return getStateInteraction(_0x216f11);})['then'](function(_0x57c976){if(_0x55df2d){_0xd9f705(getLastMessageText(_0x57c976));}else{_0xd9f705(_0x57c976);}})['catch'](function(_0x550fd0){_0x794c94(_0x550fd0);});});}function getStateInteraction(_0xab3ad2){return new BPromise(function(_0x57322c){_0xab3ad2['waiting']=0x0;_0xab3ad2[_0x5837('0x2e')]=0x0;_0xab3ad2[_0x5837('0x2f')]=0x0;_0xab3ad2['unmanaged']=0x0;_0xab3ad2[_0x5837('0x30')]=0x0;if(!_0xab3ad2['closed']&&!_0xab3ad2[_0x5837('0x31')]){_0xab3ad2[_0x5837('0x32')]+=0x1;}if(!_0xab3ad2['closed']&&_0xab3ad2[_0x5837('0x31')]){_0xab3ad2[_0x5837('0x2e')]+=0x1;if(_0xab3ad2['waiting']){_0xab3ad2[_0x5837('0x32')]-=0x1;}}if(_0xab3ad2['closed']&&_0xab3ad2[_0x5837('0x31')]){_0xab3ad2['answered']+=0x1;if(_0xab3ad2['talking']){_0xab3ad2[_0x5837('0x2e')]-=0x1;}}if(_0xab3ad2[_0x5837('0x33')]&&!_0xab3ad2[_0x5837('0x31')]){_0xab3ad2[_0x5837('0x34')]+=0x1;if(_0xab3ad2[_0x5837('0x32')]){_0xab3ad2['waiting']-=0x1;}}_0xab3ad2[_0x5837('0x30')]+=0x1;_0x57322c(_0xab3ad2);});}exports['index']=function(_0x5d29ed,_0x4702de){var _0x30b48e={},_0x4af852={},_0x360ce4={'count':0x0,'rows':[]};var _0x3c27e8=_[_0x5837('0x22')](db[_0x5837('0x35')][_0x5837('0x36')],function(_0x40b390){return{'name':_0x40b390[_0x5837('0x37')],'type':_0x40b390[_0x5837('0x38')][_0x5837('0x39')]};});_0x4af852['model']=_[_0x5837('0x22')](_0x3c27e8,'name');_0x4af852['query']=_[_0x5837('0x3a')](_0x5d29ed[_0x5837('0x3b')]);_0x4af852['filters']=_[_0x5837('0x3c')](_0x4af852[_0x5837('0x3d')],_0x4af852[_0x5837('0x3b')]);_0x30b48e[_0x5837('0x3e')]=_['intersection'](_0x4af852[_0x5837('0x3d')],qs[_0x5837('0x3f')](_0x5d29ed[_0x5837('0x3b')][_0x5837('0x3f')]));_0x30b48e[_0x5837('0x3e')]=_0x30b48e['attributes'][_0x5837('0x40')]?_0x30b48e[_0x5837('0x3e')]:_0x4af852[_0x5837('0x3d')];if(!_0x5d29ed['query'][_0x5837('0x41')](_0x5837('0x42'))){_0x30b48e[_0x5837('0x17')]=qs[_0x5837('0x17')](_0x5d29ed[_0x5837('0x3b')][_0x5837('0x17')]);_0x30b48e[_0x5837('0x16')]=qs[_0x5837('0x16')](_0x5d29ed[_0x5837('0x3b')][_0x5837('0x16')]);}_0x30b48e[_0x5837('0x43')]=qs['sort'](_0x5d29ed[_0x5837('0x3b')][_0x5837('0x44')]);_0x30b48e['where']=qs['filters'](_[_0x5837('0x45')](_0x5d29ed['query'],_0x4af852[_0x5837('0x46')]),_0x3c27e8);var _0x226ad2=[];var _0xa48299=squel[_0x5837('0x47')]()['field']('id')[_0x5837('0x48')](_0x5837('0x20'))[_0x5837('0x48')](_0x5837('0x49'))[_0x5837('0x4a')](_0x5837('0x4b'));var _0x143b87=squel[_0x5837('0x47')]()[_0x5837('0x48')]('u.id')[_0x5837('0x48')](_0x5837('0x4c'))[_0x5837('0x48')](_0x5837('0x4d'))[_0x5837('0x4a')](_0x5837('0x4e'),'ui')['left_join'](_0x5837('0x4f'),'u',_0x5837('0x50'));var _0x3f5db9=squel[_0x5837('0x47')]()[_0x5837('0x4a')]('mail_interactions','i')[_0x5837('0x51')]('cm_contacts','c',_0x5837('0x52'))[_0x5837('0x51')](_0x5837('0x4f'),'o','o.id\x20=\x20i.UserId')[_0x5837('0x51')](_0x5837('0x53'),'a',_0x5837('0x54'))[_0x5837('0x51')](_0x5837('0x55'),'me',_0x5837('0x56'))[_0x5837('0x51')](_0x5837('0x57'),'it',_0x5837('0x58'))['left_join']('tools_tags','t',_0x5837('0x59'));var _0x219f2d=squel['expr']();var _0x5ebbf5=[];var _0x2575ee=squel[_0x5837('0x5a')]();var _0x1f1104;if(_0x5d29ed[_0x5837('0x3b')][_0x5837('0x5b')]){_0x1f1104=as['parseSearch'](_0x5d29ed[_0x5837('0x3b')][_0x5837('0x5b')]);var _0x387b45=_0x1f1104['sqlOperator'];for(var _0x5e413e=0x0;_0x5e413e<_0x1f1104[_0x5837('0x5c')][_0x5837('0x40')];_0x5e413e++){var _0xe443b=_0x1f1104[_0x5837('0x5c')][_0x5e413e];var _0x5d4e43='i';var _0x1ad14c=_['find'](_0x3c27e8,['name',_0xe443b[_0x5837('0x48')]]);if(!_0x1ad14c){switch(_0xe443b[_0x5837('0x48')]){case'unreadMessages':if(_0xe443b[_0x5837('0x5d')]==0x1){_0x3f5db9[_0x5837('0x5e')]('`'+_0xe443b[_0x5837('0x48')]+'`\x20=\x200');}else{_0x3f5db9[_0x5837('0x5e')]('`'+_0xe443b[_0x5837('0x48')]+_0x5837('0x5f'));}break;case _0x5837('0x60'):if(_0xe443b[_0x5837('0x61')]==='$substring'){if(_0xe443b[_0x5837('0x5d')][_0x5837('0x26')]('\x20')['length']>0x1){_0x219f2d[_0x387b45](_0x5837('0x62'),qs[_0x5837('0x63')](_0xe443b['value']),null);}else{var _0x39b44b='%'+_0xe443b['value']+'%';_0x219f2d[_0x387b45](_0x5837('0x64'),_0x39b44b,_0x39b44b,_0x39b44b);}}else{_0x1ad14c=_[_0x5837('0x65')](_0x3c27e8,['name','ContactId']);_0xe443b[_0x5837('0x48')]=_0x5837('0x66');_0x1ff55d=as['buildExpression'](_0x5d4e43,_0x1ad14c['type'],_0xe443b);_0x219f2d[_0x387b45](_0x1ff55d['text'],_0x1ff55d[_0x5837('0x5d')][_0x5837('0x67')],_0x1ff55d[_0x5837('0x5d')][_0x5837('0x1e')]);}break;case _0x5837('0x68'):var _0x4c7aef=_0xe443b[_0x5837('0x5d')][_0x5837('0x26')](',')[_0x5837('0x22')](function(_0x307cf0){return Number(_0x307cf0);});_0x4c7aef[_0x5837('0x69')](function(_0x51f0a5){_0x2575ee['or'](_0x5837('0x6a'),'%,'+_0x51f0a5+',%');});_0x5ebbf5=_['union'](_0x5ebbf5,_0x4c7aef);break;case _0x5837('0x6b'):if(_0xe443b[_0x5837('0x61')]==='$substring'){_0x219f2d[_0x387b45](_0x5837('0x6c'),'%'+_0xe443b[_0x5837('0x5d')]+'%',null);}else{_0x1ad14c=_[_0x5837('0x65')](_0x3c27e8,[_0x5837('0x20'),_0x5837('0x31')]);_0xe443b['field']=_0x5837('0x31');_0x1ff55d=as[_0x5837('0x6d')](_0x5d4e43,_0x1ad14c[_0x5837('0x38')],_0xe443b);_0x219f2d[_0x387b45](_0x1ff55d[_0x5837('0x6e')],_0x1ff55d['value']['start'],_0x1ff55d['value'][_0x5837('0x1e')]);}break;case'plainBody':_0x1ff55d=as[_0x5837('0x6d')]('me',null,_0xe443b);_0x219f2d[_0x387b45](_0x1ff55d[_0x5837('0x6e')],_0x1ff55d[_0x5837('0x5d')][_0x5837('0x67')],_0x1ff55d['value']['end']);break;}}else{var _0x1ff55d=as['buildExpression'](_0x5d4e43,_0x1ad14c[_0x5837('0x38')],_0xe443b);_0x219f2d[_0x387b45](_0x1ff55d[_0x5837('0x6e')],_0x1ff55d['value'][_0x5837('0x67')],_0x1ff55d[_0x5837('0x5d')][_0x5837('0x1e')]);}}}else{var _0x307d73=_(_0x5d29ed[_0x5837('0x3b')])[_0x5837('0x3a')]()[_0x5837('0x22')](function(_0x4bf93a){return _[_0x5837('0x6f')](_0x3c27e8,[_0x5837('0x20'),_0x4bf93a])?_0x4bf93a:undefined;})[_0x5837('0x70')]()[_0x5837('0x5d')]();if(!_['isEmpty'](_0x307d73)){_0x307d73['forEach'](function(_0x65f338){if(_0x65f338==='MailAccountId'){_0x3f5db9[_0x5837('0x71')](_0x5837('0x72'),[][_0x5837('0x73')](_0x5d29ed[_0x5837('0x3b')][_0x65f338]));}else if(_0x65f338===_0x5837('0x74')){var _0x4ab9bf=JSON[_0x5837('0x75')](_0x5d29ed[_0x5837('0x3b')][_0x65f338])[_0x5837('0x76')];var _0x47b3d5=JSON['parse'](_0x5d29ed[_0x5837('0x3b')][_0x65f338])[_0x5837('0x77')];_0x3f5db9[_0x5837('0x71')](_0x5837('0x78'),_0x4ab9bf,_0x47b3d5);}else{if(_0x5d29ed[_0x5837('0x3b')][_0x65f338]===_0x5837('0x79')){_0x3f5db9[_0x5837('0x71')]('i.'+_0x65f338+_0x5837('0x7a'));}else{_0x3f5db9[_0x5837('0x71')]('i.'+_0x65f338+'\x20=\x20?',_0x5d29ed[_0x5837('0x3b')][_0x65f338]);}}});}if(_0x5d29ed[_0x5837('0x3b')]['read']){if(_0x5d29ed['query'][_0x5837('0x7b')]==0x1){_0x3f5db9['having']('`unreadMessages`\x20=\x200');}else{_0x3f5db9[_0x5837('0x5e')](_0x5837('0x7c'));}}if(_0x5d29ed['query'][_0x5837('0x7d')]){_0x5ebbf5=_['isArray'](_0x5d29ed[_0x5837('0x3b')][_0x5837('0x7d')])?_0x5d29ed[_0x5837('0x3b')][_0x5837('0x7d')]:new Array(_0x5d29ed[_0x5837('0x3b')][_0x5837('0x7d')]);_0x5ebbf5[_0x5837('0x69')](function(_0x3e8392){_0x2575ee['or'](_0x5837('0x6a'),'%,'+_0x3e8392+',%');});}if(_0x5d29ed[_0x5837('0x3b')][_0x5837('0x7e')]){var _0x2aa0b6=_0x5d29ed[_0x5837('0x3b')][_0x5837('0x7e')]['replace']('\x5c','\x5c\x5c')[_0x5837('0x7f')](/'/g,'\x27\x27');if(qs[_0x5837('0x80')](_0x2aa0b6)){_0x219f2d['or'](_0x5837('0x81'),_0x2aa0b6+'%');}else if(qs[_0x5837('0x82')](_0x2aa0b6)){_0x219f2d['or'](_0x5837('0x83'),_0x2aa0b6+'%');}else{_0x219f2d['or'](_0x5837('0x84'),qs[_0x5837('0x63')](_0x2aa0b6))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x5837('0x63')](_0x2aa0b6));}}}_0x3f5db9[_0x5837('0x71')](_0x219f2d);_0x3f5db9[_0x5837('0x85')](_0x5837('0x86'));var _0xc4b0bc={'type':db[_0x5837('0x87')][_0x5837('0x88')][_0x5837('0x89')],'raw':!![]};var _0x140244=_0x3f5db9['clone']();_0x140244['field'](_0x5837('0x86'));_0x140244['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5837('0x8a'));if(_0x30b48e[_0x5837('0x43')]){_0x30b48e[_0x5837('0x43')][_0x5837('0x69')](function(_0x4ef085){var _0x570fea=_0x4ef085[0x0]===_0x5837('0x8b')?_0x4ef085[0x0]:'i.'+_0x4ef085[0x0];_0x3f5db9[_0x5837('0x43')](_0x570fea,_0x4ef085[0x1]===_0x5837('0x8c')?![]:!![]);});}if(!_[_0x5837('0x8d')](_0x5ebbf5)){_0x3f5db9[_0x5837('0x5e')](_0x2575ee);_0x140244[_0x5837('0x71')](_0x5837('0x8e'),_0x5ebbf5);}BPromise[_0x5837('0x8f')]()[_0x5837('0x1d')](function(){if(!_0x1f1104){if(_0x5d29ed[_0x5837('0x3b')]['MailAccountId'])return;_0x140244[_0x5837('0x71')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x3f5db9['where'](_0x5837('0x90'));return;}if(_0x5d29ed[_0x5837('0x91')][_0x5837('0x92')]!==_0x5837('0x93'))return;return _0x5d29ed[_0x5837('0x91')][_0x5837('0x94')]({'attributes':['id'],'raw':!![]})[_0x5837('0x1d')](function(_0x51c64e){if(_[_0x5837('0x8d')](_0x51c64e)){_0x140244[_0x5837('0x71')](_0x5837('0x95'));_0x3f5db9[_0x5837('0x71')](_0x5837('0x95'));}else{_0x140244[_0x5837('0x71')](_0x5837('0x72'),_[_0x5837('0x22')](_0x51c64e,'id'));_0x3f5db9['where'](_0x5837('0x72'),_[_0x5837('0x22')](_0x51c64e,'id'));}});})['then'](function(){if(_0x5d29ed[_0x5837('0x91')]['role']===_0x5837('0x93')&&!_0x1f1104&&!_0x5d29ed[_0x5837('0x3b')]['MailAccountId'])return[];return db[_0x5837('0x96')]['query'](_0x140244[_0x5837('0x97')](),_0xc4b0bc);})[_0x5837('0x1d')](function(_0x28590c){_0x360ce4[_0x5837('0x19')]=_0x28590c[_0x5837('0x40')];if(_0x360ce4[_0x5837('0x19')]===0x0)return[];return db[_0x5837('0x96')]['query'](_0xa48299['toString'](),_0xc4b0bc)['then'](function(_0x113d3d){_0x226ad2=_['keyBy'](_0x113d3d,'id');_0xc4b0bc=_['merge'](_0xc4b0bc,{'model':db[_0x5837('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5d29ed[_0x5837('0x3b')][_0x5837('0x3f')]){_0x30b48e[_0x5837('0x3e')]['forEach'](function(_0x28c7af){_0x3f5db9[_0x5837('0x48')]('i.'+_0x28c7af);});}else{_0x3f5db9[_0x5837('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5837('0x8a'));_0x3f5db9[_0x5837('0x48')]('a.key','Account.key');_0x3f5db9[_0x5837('0x48')](_0x5837('0x98'),_0x5837('0x99'));_0x3f5db9['field'](_0x5837('0x9a'),'contactName');_0x3f5db9[_0x5837('0x48')](_0x5837('0x86'));_0x3f5db9[_0x5837('0x48')]('i.createdAt');_0x3f5db9[_0x5837('0x48')](_0x5837('0x9b'));_0x3f5db9['field'](_0x5837('0x9c'));_0x3f5db9[_0x5837('0x48')](_0x5837('0x9d'));_0x3f5db9['field'](_0x5837('0x9e'));_0x3f5db9[_0x5837('0x48')](_0x5837('0x9f'));_0x3f5db9['field'](_0x5837('0xa0'));_0x3f5db9[_0x5837('0x48')](_0x5837('0xa1'));_0x3f5db9[_0x5837('0x48')](_0x5837('0xa2'));_0x3f5db9[_0x5837('0x48')]('i.secondDisposition');_0x3f5db9[_0x5837('0x48')]('i.thirdDisposition');_0x3f5db9[_0x5837('0x48')](_0x5837('0xa3'));_0x3f5db9[_0x5837('0x48')](_0x5837('0xa4'));_0x3f5db9[_0x5837('0x48')](_0x5837('0xa5'));_0x3f5db9[_0x5837('0x48')](_0x5837('0xa6'));_0x3f5db9[_0x5837('0x48')]('i.UserId');_0x3f5db9['field'](_0x5837('0xa7'),_0x5837('0xa8'));_0x3f5db9[_0x5837('0x48')]('c.lastName','Contact.lastName');_0x3f5db9[_0x5837('0x48')](_0x5837('0xa9'),'Contact.email');_0x3f5db9['field']('c.phone',_0x5837('0xaa'));_0x3f5db9[_0x5837('0x48')]('c.mobile','Contact.mobile');_0x3f5db9['field'](_0x5837('0xab'),_0x5837('0xac'));_0x3f5db9[_0x5837('0x48')](_0x5837('0xad'),_0x5837('0xae'));_0x3f5db9['field'](_0x5837('0xaf'),'Owner.internal');_0x3f5db9[_0x5837('0x48')](_0x5837('0xb0'),_0x5837('0x24'));}if(_0x30b48e[_0x5837('0x17')])_0x3f5db9[_0x5837('0x17')](_0x30b48e[_0x5837('0x17')]);if(_0x30b48e[_0x5837('0x16')])_0x3f5db9[_0x5837('0x16')](_0x30b48e['offset']);return db[_0x5837('0x96')][_0x5837('0x3b')](_0x3f5db9['toString'](),_0xc4b0bc);})[_0x5837('0x1d')](function(_0x3d2735){if(_0x3d2735[_0x5837('0x40')]>0x0)_0x143b87[_0x5837('0x71')](_0x5837('0xb1'),_[_0x5837('0x22')](_0x3d2735,'id'));return db[_0x5837('0x96')][_0x5837('0x3b')](_0x143b87[_0x5837('0x97')](),_0xc4b0bc)[_0x5837('0x1d')](function(_0xf256a){var _0x41cb23=_[_0x5837('0xb2')](_0xf256a,'MailInteractionId');var _0x374eaa=[];return db[_0x5837('0xb3')][_0x5837('0x29')]({'attributes':[_0x5837('0xb4')],'raw':!![]})[_0x5837('0x1d')](function(_0x5301f0){var _0x30af00=_0x5301f0[_0x5837('0xb4')];_0x3d2735['forEach'](function(_0x3d7c53){_0x374eaa[_0x5837('0x27')](updateMailInteraction(_0x3d7c53,_0x226ad2,_0x41cb23,_0x30af00));});return BPromise[_0x5837('0xb5')](_0x374eaa);});});});})[_0x5837('0x1d')](function(_0x5bcb3d){_0x360ce4[_0x5837('0xb6')]=_0x5bcb3d;return _0x360ce4;})[_0x5837('0x1d')](respondWithFilteredResult(_0x4702de,_0x30b48e))['catch'](handleError(_0x4702de,null));};exports['show']=function(_0x56c3a6,_0x4c6ab4){var _0x33d251={'raw':![],'where':{'id':_0x56c3a6[_0x5837('0xb7')]['id']}},_0x315568={};_0x315568['model']=_[_0x5837('0x3a')](db[_0x5837('0x35')]['rawAttributes']);_0x315568[_0x5837('0x3b')]=_[_0x5837('0x3a')](_0x56c3a6[_0x5837('0x3b')]);_0x315568[_0x5837('0x46')]=_[_0x5837('0x3c')](_0x315568['model'],_0x315568[_0x5837('0x3b')]);_0x33d251[_0x5837('0x3e')]=_[_0x5837('0x3c')](_0x315568['model'],qs['fields'](_0x56c3a6[_0x5837('0x3b')][_0x5837('0x3f')]));_0x33d251[_0x5837('0x3e')]=_0x33d251[_0x5837('0x3e')][_0x5837('0x40')]?_0x33d251['attributes']:_0x315568['model'];if(_0x56c3a6[_0x5837('0x3b')][_0x5837('0xb8')]){_0x33d251[_0x5837('0xb9')]=[{'all':!![]}];}_0x33d251=_[_0x5837('0xba')]({},_0x33d251,_0x56c3a6[_0x5837('0xbb')]);return db[_0x5837('0x35')]['find'](_0x33d251)[_0x5837('0x1d')](handleEntityNotFound(_0x4c6ab4,null))[_0x5837('0x1d')](respondWithResult(_0x4c6ab4,null))[_0x5837('0x2d')](handleError(_0x4c6ab4,null));};exports[_0x5837('0xbc')]=function(_0x579750,_0x4e886e){return db[_0x5837('0x35')][_0x5837('0xbc')](_0x579750['body'],{})[_0x5837('0x1d')](respondWithResult(_0x4e886e,0xc9))['catch'](handleError(_0x4e886e,null));};exports['update']=function(_0x40635b,_0x2636ea){if(_0x40635b['body']['id']){delete _0x40635b[_0x5837('0xbd')]['id'];}return db[_0x5837('0x35')][_0x5837('0x65')]({'where':{'id':_0x40635b[_0x5837('0xb7')]['id']}})[_0x5837('0x1d')](handleEntityNotFound(_0x2636ea,null))['then'](saveUpdates(_0x40635b[_0x5837('0xbd')],null))[_0x5837('0x1d')](respondWithResult(_0x2636ea,null))[_0x5837('0x2d')](handleError(_0x2636ea,null));};exports['destroy']=function(_0x581368,_0xf1ecbb){return db[_0x5837('0x35')][_0x5837('0x65')]({'where':{'id':_0x581368['params']['id']}})[_0x5837('0x1d')](handleEntityNotFound(_0xf1ecbb,null))['then'](removeEntity(_0xf1ecbb,null))['catch'](handleError(_0xf1ecbb,null));};exports[_0x5837('0xbe')]=function(_0x322a4b,_0x4881d7){return db['MailInteraction']['describe']()[_0x5837('0x1d')](respondWithResult(_0x4881d7,null))[_0x5837('0x2d')](handleError(_0x4881d7,null));};exports[_0x5837('0xbf')]=function(_0x4f4058,_0x2f988b){return db[_0x5837('0x28')]['find']({'where':{'id':_0x4f4058['params']['id']}})[_0x5837('0x1d')](handleEntityNotFound(_0x2f988b,null))['then'](function(_0x264219){if(_0x264219){return _0x264219[_0x5837('0xbf')](_0x4f4058[_0x5837('0xbd')][_0x5837('0xc0')],_[_0x5837('0xc1')](_0x4f4058[_0x5837('0xbd')],[_0x5837('0xc0'),'id'])||{});}})[_0x5837('0x1d')](respondWithResult(_0x2f988b,null))['catch'](handleError(_0x2f988b,null));};exports[_0x5837('0xc2')]=function(_0x224813,_0x3471df){var _0x30dd85={'raw':![],'where':{}};var _0x1a974b={};var _0x389577={'count':0x0,'rows':[]};return db['MailInteraction'][_0x5837('0x29')]({'where':{'id':_0x224813[_0x5837('0xb7')]['id']}})[_0x5837('0x1d')](handleEntityNotFound(_0x3471df,null))[_0x5837('0x1d')](function(_0x4122fc){if(_0x4122fc){_0x1a974b[_0x5837('0x3d')]=_[_0x5837('0x3a')](db[_0x5837('0x28')][_0x5837('0x36')]);_0x1a974b[_0x5837('0x3b')]=_[_0x5837('0x3a')](_0x224813[_0x5837('0x3b')]);_0x1a974b[_0x5837('0x46')]=_[_0x5837('0x3c')](_0x1a974b['model'],_0x1a974b[_0x5837('0x3b')]);_0x30dd85[_0x5837('0x3e')]=_['intersection'](_0x1a974b[_0x5837('0x3d')],qs[_0x5837('0x3f')](_0x224813['query'][_0x5837('0x3f')]));_0x30dd85[_0x5837('0x3e')]=_0x30dd85[_0x5837('0x3e')][_0x5837('0x40')]?_0x30dd85[_0x5837('0x3e')]:_0x1a974b[_0x5837('0x3d')];if(!_0x224813[_0x5837('0x3b')][_0x5837('0x41')](_0x5837('0x42'))){_0x30dd85[_0x5837('0x17')]=qs[_0x5837('0x17')](_0x224813['query'][_0x5837('0x17')]);_0x30dd85['offset']=qs[_0x5837('0x16')](_0x224813[_0x5837('0x3b')][_0x5837('0x16')]);}_0x30dd85[_0x5837('0x43')]=qs['sort'](_0x224813[_0x5837('0x3b')][_0x5837('0x44')]);_0x30dd85[_0x5837('0x71')]=qs[_0x5837('0x46')](_[_0x5837('0x45')](_0x224813[_0x5837('0x3b')],_0x1a974b['filters']));_0x30dd85['where'][_0x5837('0xc3')]=_0x4122fc['id'];if(_0x224813[_0x5837('0x3b')][_0x5837('0x7e')]){_0x30dd85[_0x5837('0x71')]=_[_0x5837('0xba')](_0x30dd85['where'],{'$or':_[_0x5837('0x22')](_0x30dd85[_0x5837('0x3e')],function(_0x520d99){var _0x18beed={};_0x18beed[_0x520d99]={'$like':'%'+_0x224813[_0x5837('0x3b')]['filter']+'%'};return _0x18beed;})});}if(_0x224813[_0x5837('0x3b')]['$gte']){var _0x3d34e4=_0x224813[_0x5837('0x3b')][_0x5837('0x76')]['split'](',');var _0xf3a40a={};_0xf3a40a[_0x3d34e4[0x0]]={'$gte':moment(_0x3d34e4[0x1])[_0x5837('0xc4')](_0x5837('0xc5'))};_0x30dd85['where']=_[_0x5837('0xba')](_0x30dd85['where'],_0xf3a40a);}_0x30dd85=_['merge']({},_0x30dd85,_0x224813[_0x5837('0xbb')]);return db[_0x5837('0x28')][_0x5837('0x19')]({'where':_0x30dd85[_0x5837('0x71')]})['then'](function(_0x3f9d23){_0x389577[_0x5837('0x19')]=_0x3f9d23;if(_0x224813[_0x5837('0x3b')]['includeAll']){_0x30dd85[_0x5837('0xb9')]=[{'all':!![]}];}return db[_0x5837('0x28')]['findAll'](_0x30dd85);})[_0x5837('0x1d')](function(_0x447e74){if(_0x224813[_0x5837('0x3b')][_0x5837('0xc6')]===_0x5837('0xc7')){for(var _0x21897b=0x0;_0x21897b<_0x447e74[_0x5837('0x40')];_0x21897b++){_0x447e74[_0x21897b]['body']=juice(_0x447e74[_0x21897b][_0x5837('0xbd')]);}}_0x389577[_0x5837('0xb6')]=_0x447e74;return _0x389577;});}})[_0x5837('0x1d')](respondWithFilteredResult(_0x3471df,_0x30dd85))['catch'](handleError(_0x3471df,null));};exports[_0x5837('0xc8')]=function(_0x35ffe2,_0x422f29){return db[_0x5837('0x35')]['find']({'where':{'id':_0x35ffe2['params']['id']}})[_0x5837('0x1d')](handleEntityNotFound(_0x422f29,null))[_0x5837('0x1d')](function(_0x22bfee){if(_0x22bfee){return _0x22bfee[_0x5837('0xc9')](_0x35ffe2[_0x5837('0xbd')][_0x5837('0xc0')],_[_0x5837('0xc1')](_0x35ffe2[_0x5837('0xbd')],['ids','id'])||{})['spread'](function(){return db[_0x5837('0x68')]['findAll']({'attributes':['id',_0x5837('0x20'),_0x5837('0x49')],'where':{'id':_0x35ffe2[_0x5837('0xbd')][_0x5837('0xc0')]}});})['then'](function(_0x4e40be){socket[_0x5837('0xca')](_0x5837('0xcb'),{'id':Number(_0x35ffe2['params']['id']),'tags':_0x4e40be||[]});return{'id':Number(_0x35ffe2[_0x5837('0xb7')]['id']),'tags':_0x4e40be||[]};});}})[_0x5837('0x1d')](respondWithResult(_0x422f29,null))['catch'](handleError(_0x422f29,null));};exports[_0x5837('0xcc')]=function(_0xd215c3,_0x52916d){return db['MailInteraction'][_0x5837('0x65')]({'where':{'id':_0xd215c3['params']['id']}})[_0x5837('0x1d')](handleEntityNotFound(_0x52916d,null))['then'](function(_0x38cc50){if(_0x38cc50){return _0x38cc50[_0x5837('0xcc')](_0xd215c3['query'][_0x5837('0xc0')]);}})[_0x5837('0x1d')](respondWithStatusCode(_0x52916d,null))[_0x5837('0x2d')](handleError(_0x52916d,null));};exports['download']=function(_0x3f954e,_0x969474){var _0x4ceff5=moment()[_0x5837('0xcd')]()[_0x5837('0x97')]();var _0x47d53d=path[_0x5837('0xce')](config['root'],_0x5837('0xcf'),_0x5837('0xd0'),'tmp');var _0x2789dc=path[_0x5837('0xce')](config[_0x5837('0xd1')],_0x5837('0xcf'),'files','attachments');var _0x28509c=path[_0x5837('0xce')](_0x47d53d,_0x4ceff5);var _0x8a12a9=util[_0x5837('0xc4')](_0x5837('0xd2'),_0x3f954e['params']['id'],_0x4ceff5);var _0x4de3cb=path[_0x5837('0xce')](_0x47d53d,_0x8a12a9);var _0x17c094=[];if(_0x3f954e[_0x5837('0x3b')][_0x5837('0xd3')]){_0x17c094['push']({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x31f7d5=[{'model':db[_0x5837('0x28')],'as':_0x5837('0xd4'),'attributes':['id',_0x5837('0xbd'),_0x5837('0x4a'),'to','cc',_0x5837('0xd5'),_0x5837('0xd6'),_0x5837('0x74')],'where':{'secret':![]},'order':qs[_0x5837('0x44')]('id'),'include':_0x17c094}];return db[_0x5837('0x35')]['find']({'where':{'id':_0x3f954e['params']['id']},'include':_0x31f7d5})[_0x5837('0x1d')](handleEntityNotFound(_0x969474,null))[_0x5837('0x1d')](function(_0x39a368){if(_0x39a368&&_0x39a368['Messages']){var _0x3827a8=_0x39a368[_0x5837('0xd7')]({'plain':!![]});fs[_0x5837('0xd8')](_0x28509c);return BPromise[_0x5837('0xd9')](_0x3827a8[_0x5837('0xd4')],function(_0x2a610d,_0x55779f){var _0x291e62={'from':_0x2a610d[_0x5837('0x4a')],'to':_0x2a610d['to'],'subject':_0x2a610d[_0x5837('0xd6')],'html':htmlEntities['decode'](_0x2a610d[_0x5837('0xbd')]),'headers':{'Date':moment(_0x2a610d[_0x5837('0x74')])[_0x5837('0xc4')](_0x5837('0xda'))},'attachments':[]};if(_0x2a610d['cc']){_0x291e62[_0x5837('0xdb')]['Cc']=_0x2a610d['cc'];}if(_0x2a610d['bcc']){_0x291e62[_0x5837('0xdb')]['Bcc']=_0x2a610d[_0x5837('0xd5')];}return new BPromise(function(_0x19ae8a,_0x51134d){if(_0x2a610d[_0x5837('0xdc')]){for(var _0xf30558=0x0;_0xf30558<_0x2a610d[_0x5837('0xdc')][_0x5837('0x40')];_0xf30558++){var _0x4cbdfc=_0x2a610d[_0x5837('0xdc')][_0xf30558];var _0x3ca09a=path[_0x5837('0xce')](_0x2789dc,_0x4cbdfc[_0x5837('0xdd')]);if(fs['existsSync'](_0x3ca09a)){_0x291e62['attachments'][_0x5837('0x27')]({'name':_0x4cbdfc[_0x5837('0x20')],'contentType':_0x4cbdfc['type'],'data':fs[_0x5837('0xde')](_0x3ca09a)});}}}emlformat[_0x5837('0xdf')](_0x291e62,function(_0xd72a5d,_0x52cb2a){if(_0xd72a5d)return _0x51134d(_0xd72a5d);fs[_0x5837('0xe0')](path[_0x5837('0xce')](_0x28509c,util[_0x5837('0xc4')](_0x5837('0xe1'),_0x55779f)),_0x52cb2a);return _0x19ae8a(_0x52cb2a);});});})[_0x5837('0x1d')](function(){return new BPromise(function(_0xd4dd9,_0x4ce0b3){zipdir(_0x28509c,{'saveTo':_0x4de3cb},function(_0x156cd9,_0x1e2bec){if(_0x156cd9)return _0x4ce0b3(_0x156cd9);return _0xd4dd9(_0x1e2bec);});})[_0x5837('0x1d')](function(){return new BPromise(function(_0x4bb19a,_0x4b4430){rimraf(_0x28509c,function(_0x136557){if(_0x136557)_0x4b4430(_0x136557);return _0x4bb19a();});});})[_0x5837('0x1d')](function(){return _0x969474[_0x5837('0xe2')](_0x4de3cb,_0x8a12a9,function(_0x3cc083){if(!_0x3cc083)fs[_0x5837('0xe3')](_0x4de3cb);});});});}else{return _0x969474[_0x5837('0x13')](0xc8);}})['catch'](handleError(_0x969474,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 639ec9e..89d8c74 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 _0x0c23=['catch','hasOwnProperty','hook','exports','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','then','Users','map','unreadMessages','emit'];(function(_0x52868e,_0x4ca017){var _0x18d509=function(_0x296618){while(--_0x296618){_0x52868e['push'](_0x52868e['shift']());}};_0x18d509(++_0x4ca017);}(_0x0c23,0x7c));var _0x30c2=function(_0x39ce9e,_0x29f042){_0x39ce9e=_0x39ce9e-0x0;var _0x4e5629=_0x0c23[_0x39ce9e];return _0x4e5629;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0x30c2('0x0'))['db'][_0x30c2('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x30c2('0x2')](0x0);var events={'afterCreate':_0x30c2('0x3'),'afterUpdate':_0x30c2('0x4'),'afterDestroy':_0x30c2('0x5')};function emitEvent(_0x2d4e6a){return function(_0x17dd57,_0x24f078,_0x518ffa){_0x17dd57['getUsers']({'attributes':['id'],'raw':!![]})[_0x30c2('0x6')](function(_0x368ce0){_0x17dd57['setDataValue'](_0x30c2('0x7'),_0x368ce0[_0x30c2('0x8')](function(_0x50f6d9){return{'id':_0x50f6d9['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x17dd57['id'],'direction':'in','read':![]},'raw':!![]});})[_0x30c2('0x6')](function(_0x182219){_0x17dd57['setDataValue'](_0x30c2('0x9'),_0x182219['length']);MailInteractionEvents[_0x30c2('0xa')](_0x2d4e6a+':'+_0x17dd57['id'],_0x17dd57);MailInteractionEvents['emit'](_0x2d4e6a,_0x17dd57);_0x518ffa(null);})[_0x30c2('0xb')](_0x518ffa(null));};}for(var e in events){if(events[_0x30c2('0xc')](e)){var event=events[e];MailInteraction[_0x30c2('0xd')](e,emitEvent(event));}}module[_0x30c2('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0xb817=['remove','getUsers','then','Users','map','findAll','setDataValue','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','setMaxListeners','save'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xb817,0x181));var _0x7b81=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb817[_0xfae23b];return _0x200640;};'use strict';var EventEmitter=require(_0x7b81('0x0'));var MailInteraction=require(_0x7b81('0x1'))['db'][_0x7b81('0x2')];var MailMessage=require(_0x7b81('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x7b81('0x3')](0x0);var events={'afterCreate':_0x7b81('0x4'),'afterUpdate':'update','afterDestroy':_0x7b81('0x5')};function emitEvent(_0x34d61b){return function(_0x1e84ab,_0x588f53,_0x7cc3a7){_0x1e84ab[_0x7b81('0x6')]({'attributes':['id'],'raw':!![]})[_0x7b81('0x7')](function(_0xcb36e){_0x1e84ab['setDataValue'](_0x7b81('0x8'),_0xcb36e[_0x7b81('0x9')](function(_0x2b30f6){return{'id':_0x2b30f6['id']};}));return MailMessage[_0x7b81('0xa')]({'where':{'MailInteractionId':_0x1e84ab['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7b81('0x7')](function(_0x3bc570){_0x1e84ab[_0x7b81('0xb')]('unreadMessages',_0x3bc570['length']);MailInteractionEvents['emit'](_0x34d61b+':'+_0x1e84ab['id'],_0x1e84ab);MailInteractionEvents['emit'](_0x34d61b,_0x1e84ab);_0x7cc3a7(null);})['catch'](_0x7cc3a7(null));};}for(var e in events){if(events[_0x7b81('0xc')](e)){var event=events[e];MailInteraction[_0x7b81('0xd')](e,emitEvent(event));}}module[_0x7b81('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index e00aec7..c2a5503 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 _0x9580=['substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closedAt','format','changed','closed','models','get','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT'];(function(_0x381765,_0x155f32){var _0x20b393=function(_0x1b9351){while(--_0x1b9351){_0x381765['push'](_0x381765['shift']());}};_0x20b393(++_0x155f32);}(_0x9580,0x126));var _0x0958=function(_0x14c480,_0x159abf){_0x14c480=_0x14c480-0x0;var _0x3d6c0a=_0x9580[_0x14c480];return _0x3d6c0a;};'use strict';var _=require(_0x0958('0x0'));var util=require(_0x0958('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0958('0x2'));var BPromise=require(_0x0958('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0958('0x4'));var rimraf=require(_0x0958('0x5'));var config=require(_0x0958('0x6'));var attributes=require(_0x0958('0x7'));module[_0x0958('0x8')]=function(_0x17f506,_0x569aa0){return _0x17f506[_0x0958('0x9')](_0x0958('0xa'),attributes,{'tableName':_0x0958('0xb'),'paranoid':![],'indexes':[{'name':_0x0958('0xc'),'fields':['subject','to'],'type':_0x0958('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x72308a,_0x225830,_0x2a8d18){if(_0x72308a[_0x0958('0xe')]){_0x72308a[_0x0958('0xf')]=moment()['format'](_0x0958('0x10'));}if(_0x72308a['closed']){_0x72308a[_0x0958('0x11')]=moment()[_0x0958('0x12')](_0x0958('0x10'));}_0x2a8d18(null,_0x225830);},'beforeUpdate':function(_0x4512f8,_0x2977a7,_0xb39e0a){if(_0x4512f8['changed'](_0x0958('0xe'))){_0x4512f8[_0x0958('0xf')]=_0x4512f8[_0x0958('0xe')]?moment()[_0x0958('0x12')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x4512f8[_0x0958('0x13')](_0x0958('0x14'))){_0x4512f8[_0x0958('0x11')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4512f8[_0x0958('0xe')]=null;_0x4512f8[_0x0958('0xf')]=null;}_0xb39e0a(null,_0x4512f8);},'afterUpdate':function(_0x47f5e7,_0x39429d,_0x3e482c){var _0x2f1bba=_0x17f506[_0x0958('0x15')];var _0x443742=_0x47f5e7[_0x0958('0x16')]({'plain':!![]});if(_0x443742['closed']){return _0x2f1bba[_0x0958('0x17')][_0x0958('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x443742['id']}})['then'](function(){_0x3e482c();})[_0x0958('0x19')](function(_0x4e758a){_0x3e482c(_0x4e758a);});}else{_0x3e482c();}}},'charset':_0x0958('0x1a'),'collate':_0x0958('0x1b')});}; \ No newline at end of file +var _0xd7a7=['subject','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','substatusAt','changed','get','MailMessage','update','then','catch','utf8mb4','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','MailInteraction','fti_mail_interactions'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd7a7,0x153));var _0x7d7a=function(_0x152a67,_0x56c02d){_0x152a67=_0x152a67-0x0;var _0x247125=_0xd7a7[_0x152a67];return _0x247125;};'use strict';var _=require(_0x7d7a('0x0'));var util=require(_0x7d7a('0x1'));var logger=require(_0x7d7a('0x2'))(_0x7d7a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7d7a('0x4'));var fs=require('fs');var path=require(_0x7d7a('0x5'));var rimraf=require(_0x7d7a('0x6'));var config=require(_0x7d7a('0x7'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x44e6c7,_0x1bf61d){return _0x44e6c7[_0x7d7a('0x8')](_0x7d7a('0x9'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x7d7a('0xa'),'fields':[_0x7d7a('0xb'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3ff966,_0xc24a4b,_0x51ac51){if(_0x3ff966[_0x7d7a('0xc')]){_0x3ff966['substatusAt']=moment()[_0x7d7a('0xd')](_0x7d7a('0xe'));}if(_0x3ff966[_0x7d7a('0xf')]){_0x3ff966[_0x7d7a('0x10')]=moment()[_0x7d7a('0xd')](_0x7d7a('0xe'));}_0x51ac51(null,_0xc24a4b);},'beforeUpdate':function(_0x5bf81a,_0xb6a06d,_0x519d6c){if(_0x5bf81a['changed'](_0x7d7a('0xc'))){_0x5bf81a[_0x7d7a('0x11')]=_0x5bf81a[_0x7d7a('0xc')]?moment()[_0x7d7a('0xd')](_0x7d7a('0xe')):null;}if(_0x5bf81a[_0x7d7a('0x12')](_0x7d7a('0xf'))){_0x5bf81a[_0x7d7a('0x10')]=moment()['format'](_0x7d7a('0xe'));_0x5bf81a[_0x7d7a('0xc')]=null;_0x5bf81a[_0x7d7a('0x11')]=null;}_0x519d6c(null,_0x5bf81a);},'afterUpdate':function(_0x37fa7d,_0x526f08,_0x5a7bfe){var _0x46fe98=_0x44e6c7['models'];var _0x1947cb=_0x37fa7d[_0x7d7a('0x13')]({'plain':!![]});if(_0x1947cb['closed']){return _0x46fe98[_0x7d7a('0x14')][_0x7d7a('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x1947cb['id']}})[_0x7d7a('0x16')](function(){_0x5a7bfe();})[_0x7d7a('0x17')](function(_0xba8e43){_0x5a7bfe(_0xba8e43);});}else{_0x5a7bfe();}}},'charset':_0x7d7a('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 324e126..bd9c262 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 _0xaac4=['info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateMailInteraction','MailInteraction','update','body','options','raw','attributes','limit','catch','find','where','addTags','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./mailInteraction.socket','register','request','then'];(function(_0x514f32,_0x5cec37){var _0x422066=function(_0x1b4fc1){while(--_0x1b4fc1){_0x514f32['push'](_0x514f32['shift']());}};_0x422066(++_0x5cec37);}(_0xaac4,0x6c));var _0x4aac=function(_0x539386,_0x4cbc27){_0x539386=_0x539386-0x0;var _0x3d370c=_0xaac4[_0x539386];return _0x3d370c;};'use strict';var _=require(_0x4aac('0x0'));var util=require(_0x4aac('0x1'));var moment=require('moment');var BPromise=require(_0x4aac('0x2'));var rs=require(_0x4aac('0x3'));var fs=require('fs');var Redis=require(_0x4aac('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4aac('0x5'));var logger=require(_0x4aac('0x6'))(_0x4aac('0x7'));var config=require(_0x4aac('0x8'));var jayson=require(_0x4aac('0x9'));var client=jayson['client'][_0x4aac('0xa')]({'port':0x232a});config[_0x4aac('0xb')]=_[_0x4aac('0xc')](config['redis'],{'host':_0x4aac('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4aac('0xb')]));require(_0x4aac('0xe'))[_0x4aac('0xf')](socket);function respondWithRpcPromise(_0x3e3567,_0x33551f,_0x4c151a){return new BPromise(function(_0xabb74,_0x9660af){return client[_0x4aac('0x10')](_0x3e3567,_0x4c151a)[_0x4aac('0x11')](function(_0x4b8932){logger[_0x4aac('0x12')](_0x4aac('0x13'),_0x33551f,_0x4aac('0x14'));logger[_0x4aac('0x15')](_0x4aac('0x16'),_0x33551f,_0x4aac('0x14'),JSON[_0x4aac('0x17')](_0x4b8932));if(_0x4b8932['error']){if(_0x4b8932[_0x4aac('0x18')]['code']===0x1f4){logger[_0x4aac('0x18')]('MailInteraction,\x20%s,\x20%s',_0x33551f,_0x4b8932[_0x4aac('0x18')]['message']);return _0x9660af(_0x4b8932[_0x4aac('0x18')][_0x4aac('0x19')]);}logger[_0x4aac('0x18')]('MailInteraction,\x20%s,\x20%s',_0x33551f,_0x4b8932[_0x4aac('0x18')][_0x4aac('0x19')]);return _0xabb74(_0x4b8932['error']['message']);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x33551f,_0x4aac('0x14'));_0xabb74(_0x4b8932[_0x4aac('0x1a')][_0x4aac('0x19')]);}})['catch'](function(_0x286060){logger[_0x4aac('0x18')](_0x4aac('0x13'),_0x33551f,_0x286060);_0x9660af(_0x286060);});});}exports[_0x4aac('0x1b')]=function(_0x22a0fe){var _0x2da712=this;return new Promise(function(_0x430725,_0x2c26cc){return db[_0x4aac('0x1c')][_0x4aac('0x1d')](_0x22a0fe[_0x4aac('0x1e')],{'raw':_0x22a0fe['options']?_0x22a0fe[_0x4aac('0x1f')][_0x4aac('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22a0fe['options']?_0x22a0fe[_0x4aac('0x1f')]['where']||null:null,'attributes':_0x22a0fe[_0x4aac('0x1f')]?_0x22a0fe[_0x4aac('0x1f')][_0x4aac('0x21')]||null:null,'limit':_0x22a0fe[_0x4aac('0x1f')]?_0x22a0fe[_0x4aac('0x1f')][_0x4aac('0x22')]||null:null})[_0x4aac('0x11')](function(_0x52ce26){logger[_0x4aac('0x12')](_0x4aac('0x1b'),_0x22a0fe);logger[_0x4aac('0x15')]('UpdateMailInteraction',_0x22a0fe,JSON[_0x4aac('0x17')](_0x52ce26));_0x430725(_0x52ce26);})[_0x4aac('0x23')](function(_0x1b57ed){logger[_0x4aac('0x18')](_0x4aac('0x1b'),_0x1b57ed['message'],_0x22a0fe);_0x2c26cc(_0x2da712[_0x4aac('0x18')](0x1f4,_0x1b57ed['message']));});});};exports['AddTagsToMailInteraction']=function(_0x1ed8ac){return new Promise(function(_0x34af11,_0x459028){return db[_0x4aac('0x1c')][_0x4aac('0x24')]({'where':_0x1ed8ac['options']?_0x1ed8ac[_0x4aac('0x1f')][_0x4aac('0x25')]||null:null})['then'](function(_0x869ea2){if(_0x869ea2){return _0x869ea2[_0x4aac('0x26')](_0x1ed8ac['body'][_0x4aac('0x27')],_['omit'](_0x1ed8ac['body'],[_0x4aac('0x27'),'id'])||{});}})[_0x4aac('0x28')](function(_0x91f415){logger['info'](_0x4aac('0x29'),_0x1ed8ac);logger[_0x4aac('0x15')](_0x4aac('0x29'),_0x1ed8ac,JSON[_0x4aac('0x17')](_0x91f415));_0x34af11(_0x91f415);})[_0x4aac('0x23')](function(_0x5f0f40){logger[_0x4aac('0x18')](_0x4aac('0x29'),_0x5f0f40[_0x4aac('0x19')],_0x1ed8ac);_0x459028(_this[_0x4aac('0x18')](0x1f4,_0x5f0f40['message']));});});}; \ No newline at end of file +var _0x81f8=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','request\x20sent','debug','stringify','error','MailInteraction,\x20%s,\x20%s','message','catch','UpdateMailInteraction','body','options','raw','where','attributes','info','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags'];(function(_0x459d30,_0x4e010e){var _0x49526c=function(_0x20772b){while(--_0x20772b){_0x459d30['push'](_0x459d30['shift']());}};_0x49526c(++_0x4e010e);}(_0x81f8,0x186));var _0x881f=function(_0x5b2923,_0x4bf98d){_0x5b2923=_0x5b2923-0x0;var _0x586e63=_0x81f8[_0x5b2923];return _0x586e63;};'use strict';var _=require(_0x881f('0x0'));var util=require(_0x881f('0x1'));var moment=require('moment');var BPromise=require(_0x881f('0x2'));var rs=require(_0x881f('0x3'));var fs=require('fs');var Redis=require(_0x881f('0x4'));var db=require(_0x881f('0x5'))['db'];var utils=require(_0x881f('0x6'));var logger=require('../../config/logger')(_0x881f('0x7'));var config=require(_0x881f('0x8'));var jayson=require(_0x881f('0x9'));var client=jayson[_0x881f('0xa')][_0x881f('0xb')]({'port':0x232a});config[_0x881f('0xc')]=_[_0x881f('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x881f('0xe'))(new Redis(config[_0x881f('0xc')]));require('./mailInteraction.socket')[_0x881f('0xf')](socket);function respondWithRpcPromise(_0x213a06,_0x44b3e2,_0x63d5a6){return new BPromise(function(_0x56d967,_0x519cd5){return client[_0x881f('0x10')](_0x213a06,_0x63d5a6)[_0x881f('0x11')](function(_0x2095e9){logger['info']('MailInteraction,\x20%s,\x20%s',_0x44b3e2,_0x881f('0x12'));logger[_0x881f('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x44b3e2,'request\x20sent',JSON[_0x881f('0x14')](_0x2095e9));if(_0x2095e9[_0x881f('0x15')]){if(_0x2095e9[_0x881f('0x15')]['code']===0x1f4){logger[_0x881f('0x15')](_0x881f('0x16'),_0x44b3e2,_0x2095e9['error'][_0x881f('0x17')]);return _0x519cd5(_0x2095e9[_0x881f('0x15')]['message']);}logger[_0x881f('0x15')](_0x881f('0x16'),_0x44b3e2,_0x2095e9[_0x881f('0x15')][_0x881f('0x17')]);return _0x56d967(_0x2095e9[_0x881f('0x15')][_0x881f('0x17')]);}else{logger['info'](_0x881f('0x16'),_0x44b3e2,'request\x20sent');_0x56d967(_0x2095e9['result'][_0x881f('0x17')]);}})[_0x881f('0x18')](function(_0x382886){logger['error'](_0x881f('0x16'),_0x44b3e2,_0x382886);_0x519cd5(_0x382886);});});}exports[_0x881f('0x19')]=function(_0x4e7f3d){var _0x954062=this;return new Promise(function(_0x3eeabb,_0x2f66d8){return db['MailInteraction']['update'](_0x4e7f3d[_0x881f('0x1a')],{'raw':_0x4e7f3d[_0x881f('0x1b')]?_0x4e7f3d[_0x881f('0x1b')][_0x881f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e7f3d['options']?_0x4e7f3d[_0x881f('0x1b')][_0x881f('0x1d')]||null:null,'attributes':_0x4e7f3d[_0x881f('0x1b')]?_0x4e7f3d['options'][_0x881f('0x1e')]||null:null,'limit':_0x4e7f3d['options']?_0x4e7f3d[_0x881f('0x1b')]['limit']||null:null})[_0x881f('0x11')](function(_0xdba5e5){logger[_0x881f('0x1f')](_0x881f('0x19'),_0x4e7f3d);logger['debug'](_0x881f('0x19'),_0x4e7f3d,JSON[_0x881f('0x14')](_0xdba5e5));_0x3eeabb(_0xdba5e5);})[_0x881f('0x18')](function(_0xdcb6b7){logger[_0x881f('0x15')](_0x881f('0x19'),_0xdcb6b7['message'],_0x4e7f3d);_0x2f66d8(_0x954062[_0x881f('0x15')](0x1f4,_0xdcb6b7[_0x881f('0x17')]));});});};exports[_0x881f('0x20')]=function(_0x1cf9c3){return new Promise(function(_0x3c889d,_0x518ddb){return db['MailInteraction'][_0x881f('0x21')]({'where':_0x1cf9c3[_0x881f('0x1b')]?_0x1cf9c3[_0x881f('0x1b')]['where']||null:null})[_0x881f('0x11')](function(_0x21bbd8){if(_0x21bbd8){return _0x21bbd8[_0x881f('0x22')](_0x1cf9c3[_0x881f('0x1a')][_0x881f('0x23')],_[_0x881f('0x24')](_0x1cf9c3[_0x881f('0x1a')],[_0x881f('0x23'),'id'])||{});}})[_0x881f('0x25')](function(_0x27d011){logger[_0x881f('0x1f')](_0x881f('0x26'),_0x1cf9c3);logger[_0x881f('0x13')]('AddTags',_0x1cf9c3,JSON[_0x881f('0x14')](_0x27d011));_0x3c889d(_0x27d011);})[_0x881f('0x18')](function(_0x16dcea){logger['error'](_0x881f('0x26'),_0x16dcea[_0x881f('0x17')],_0x1cf9c3);_0x518ddb(_this['error'](0x1f4,_0x16dcea[_0x881f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 96ebfcc..464d7a7 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 _0x1905=['removeListener','mailInteraction:','save','remove','update','emit'];(function(_0x4fe617,_0x5b2420){var _0x243588=function(_0x1d0daa){while(--_0x1d0daa){_0x4fe617['push'](_0x4fe617['shift']());}};_0x243588(++_0x5b2420);}(_0x1905,0x188));var _0x5190=function(_0x37e4e0,_0x2183d8){_0x37e4e0=_0x37e4e0-0x0;var _0x26b4ae=_0x1905[_0x37e4e0];return _0x26b4ae;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x5190('0x0'),_0x5190('0x1'),_0x5190('0x2')];function createListener(_0x226271,_0x13581b){return function(_0x4654df){_0x13581b[_0x5190('0x3')](_0x226271,_0x4654df);};}function removeListener(_0x3d31c6,_0x502cc1){return function(){MailInteractionEvents[_0x5190('0x4')](_0x3d31c6,_0x502cc1);};}exports['register']=function(_0x4d6b7b){for(var _0x1fa5e7=0x0,_0x47df44=events['length'];_0x1fa5e7<_0x47df44;_0x1fa5e7++){var _0x137077=events[_0x1fa5e7];var _0x211dc6=createListener(_0x5190('0x5')+_0x137077,_0x4d6b7b);MailInteractionEvents['on'](_0x137077,_0x211dc6);}}; \ No newline at end of file +var _0x0bcc=['save','update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0bcc,0xdf));var _0xc0bc=function(_0x37abe8,_0x59e65d){_0x37abe8=_0x37abe8-0x0;var _0x4c2670=_0x0bcc[_0x37abe8];return _0x4c2670;};'use strict';var MailInteractionEvents=require(_0xc0bc('0x0'));var events=[_0xc0bc('0x1'),'remove',_0xc0bc('0x2')];function createListener(_0xf2feaa,_0x1cc205){return function(_0xc3eaba){_0x1cc205[_0xc0bc('0x3')](_0xf2feaa,_0xc3eaba);};}function removeListener(_0x20398b,_0x26e8b6){return function(){MailInteractionEvents[_0xc0bc('0x4')](_0x20398b,_0x26e8b6);};}exports[_0xc0bc('0x5')]=function(_0x40d7d1){for(var _0x326f94=0x0,_0x57b17a=events[_0xc0bc('0x6')];_0x326f94<_0x57b17a;_0x326f94++){var _0x16ce89=events[_0x326f94];var _0x19beea=createListener(_0xc0bc('0x7')+_0x16ce89,_0x40d7d1);MailInteractionEvents['on'](_0x16ce89,_0x19beea);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 7554ee6..f8be368 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 _0xc8f8=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','download','mailmessage:create','update','put','/:id/accept','/:id/reject','reject','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc8f8,0x1cc));var _0x8c8f=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xc8f8[_0x13b8f3];return _0x1a6d06;};'use strict';var multer=require(_0x8c8f('0x0'));var util=require(_0x8c8f('0x1'));var path=require(_0x8c8f('0x2'));var timeout=require(_0x8c8f('0x3'));var express=require('express');var router=express[_0x8c8f('0x4')]();var fs_extra=require(_0x8c8f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8c8f('0x6'));var config=require(_0x8c8f('0x7'));var controller=require(_0x8c8f('0x8'));router[_0x8c8f('0x9')]('/',auth[_0x8c8f('0xa')](),controller[_0x8c8f('0xb')]);router[_0x8c8f('0x9')](_0x8c8f('0xc'),auth[_0x8c8f('0xa')](),controller[_0x8c8f('0xd')]);router[_0x8c8f('0x9')](_0x8c8f('0xe'),auth[_0x8c8f('0xa')](),controller['show']);router[_0x8c8f('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x8c8f('0xf')]);router['post']('/',auth[_0x8c8f('0xa')](),interaction['tracked']('mail',_0x8c8f('0x10')),controller['create']);router['put'](_0x8c8f('0xe'),auth['isAuthenticated'](),controller[_0x8c8f('0x11')]);router[_0x8c8f('0x12')](_0x8c8f('0x13'),auth[_0x8c8f('0xa')](),controller['accept']);router['put'](_0x8c8f('0x14'),auth[_0x8c8f('0xa')](),controller[_0x8c8f('0x15')]);router['delete'](_0x8c8f('0xe'),auth[_0x8c8f('0xa')](),controller['destroy']);module[_0x8c8f('0x16')]=router; \ No newline at end of file +var _0x2d4d=['./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x49751c,_0x4789e3){var _0x404b4f=function(_0x161e23){while(--_0x161e23){_0x49751c['push'](_0x49751c['shift']());}};_0x404b4f(++_0x4789e3);}(_0x2d4d,0x94));var _0xd2d4=function(_0x27483a,_0x3a1a2f){_0x27483a=_0x27483a-0x0;var _0x14e21c=_0x2d4d[_0x27483a];return _0x14e21c;};'use strict';var multer=require(_0xd2d4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd2d4('0x1'));var router=express[_0xd2d4('0x2')]();var fs_extra=require(_0xd2d4('0x3'));var auth=require(_0xd2d4('0x4'));var interaction=require(_0xd2d4('0x5'));var config=require(_0xd2d4('0x6'));var controller=require(_0xd2d4('0x7'));router[_0xd2d4('0x8')]('/',auth[_0xd2d4('0x9')](),controller[_0xd2d4('0xa')]);router['get'](_0xd2d4('0xb'),auth['isAuthenticated'](),controller[_0xd2d4('0xc')]);router[_0xd2d4('0x8')](_0xd2d4('0xd'),auth[_0xd2d4('0x9')](),controller[_0xd2d4('0xe')]);router[_0xd2d4('0x8')](_0xd2d4('0xf'),auth[_0xd2d4('0x9')](),controller[_0xd2d4('0x10')]);router[_0xd2d4('0x11')]('/',auth[_0xd2d4('0x9')](),interaction[_0xd2d4('0x12')](_0xd2d4('0x13'),_0xd2d4('0x14')),controller[_0xd2d4('0x15')]);router[_0xd2d4('0x16')](_0xd2d4('0xd'),auth[_0xd2d4('0x9')](),controller[_0xd2d4('0x17')]);router[_0xd2d4('0x16')](_0xd2d4('0x18'),auth[_0xd2d4('0x9')](),controller[_0xd2d4('0x19')]);router[_0xd2d4('0x16')](_0xd2d4('0x1a'),auth[_0xd2d4('0x9')](),controller[_0xd2d4('0x1b')]);router[_0xd2d4('0x1c')](_0xd2d4('0xd'),auth['isAuthenticated'](),controller[_0xd2d4('0x1d')]);module[_0xd2d4('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 3ca5ef1..28bdbfc 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 _0x3434=['Email','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3434,0x83));var _0x4343=function(_0x4b2e57,_0x3a5e36){_0x4b2e57=_0x4b2e57-0x0;var _0x304eab=_0x3434[_0x4b2e57];return _0x304eab;};'use strict';var Sequelize=require(_0x4343('0x0'));var _=require(_0x4343('0x1'));module[_0x4343('0x2')]={'body':{'type':Sequelize[_0x4343('0x3')](_0x4343('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x4343('0x3')](_0x4343('0x5'))},'read':{'type':Sequelize[_0x4343('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4343('0x7')]('in',_0x4343('0x8')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x4343('0x9')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x4343('0x3')](_0x4343('0x4'))},'cc':{'type':Sequelize['TEXT'](_0x4343('0x4'))},'bcc':{'type':Sequelize[_0x4343('0x3')](_0x4343('0x4'))},'subject':{'type':Sequelize[_0x4343('0x3')]},'sentAt':{'type':Sequelize[_0x4343('0xa')]},'attach':{'type':Sequelize[_0x4343('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x4343('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x4343('0xa')]},'originTo':{'type':Sequelize[_0x4343('0x3')](_0x4343('0x4'))},'originCc':{'type':Sequelize[_0x4343('0x3')](_0x4343('0x4'))},'originChannel':{'type':Sequelize[_0x4343('0x7')](_0x4343('0xc'),'Chat'),'defaultValue':_0x4343('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0xb9ba=['out','STRING','INTEGER','BOOLEAN','DATE','Email','sequelize','lodash','long','TEXT','medium','ENUM'];(function(_0x5481d8,_0xd7f96f){var _0x3d49a3=function(_0x48c734){while(--_0x48c734){_0x5481d8['push'](_0x5481d8['shift']());}};_0x3d49a3(++_0xd7f96f);}(_0xb9ba,0x72));var _0xab9b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb9ba[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xab9b('0x0'));var _=require(_0xab9b('0x1'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xab9b('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xab9b('0x3')](_0xab9b('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xab9b('0x5')]('in',_0xab9b('0x6')),'defaultValue':_0xab9b('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xab9b('0x7')](0x1fe)},'from':{'type':Sequelize[_0xab9b('0x7')]},'to':{'type':Sequelize[_0xab9b('0x3')](_0xab9b('0x2'))},'cc':{'type':Sequelize[_0xab9b('0x3')](_0xab9b('0x2'))},'bcc':{'type':Sequelize[_0xab9b('0x3')](_0xab9b('0x2'))},'subject':{'type':Sequelize[_0xab9b('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xab9b('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xab9b('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xab9b('0xa')]},'originTo':{'type':Sequelize['TEXT'](_0xab9b('0x2'))},'originCc':{'type':Sequelize[_0xab9b('0x3')](_0xab9b('0x2'))},'originChannel':{'type':Sequelize[_0xab9b('0x5')](_0xab9b('0xb'),'Chat'),'defaultValue':_0xab9b('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 1f0e34d..fe6986e 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 _0xb718=['catch','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','stack','name','send','index','MailMessage','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','options','include','findAll','show','includeAll','body','find','params','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','updatedAt','MailServerOut','isNil','Smtp','service','host','port','secure','auth','pass','user','attachments','join','root','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','accept','mail','read','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','acceptMessage','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','headers','Bcc','existsSync','push','writeFileSync','unlinkSync','moment','bluebird','util','ioredis','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','html-entities','register','jayson/promise','client','http','request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','MailMessage,\x20%s,\x20%s','message','result'];(function(_0x1a3ec0,_0x3452d7){var _0x4d24e6=function(_0x1facf1){while(--_0x1facf1){_0x1a3ec0['push'](_0x1a3ec0['shift']());}};_0x4d24e6(++_0x3452d7);}(_0xb718,0x12d));var _0x8b71=function(_0x16243c,_0x150648){_0x16243c=_0x16243c-0x0;var _0x3656ae=_0xb718[_0x16243c];return _0x3656ae;};'use strict';var emlformat=require('eml-format');var moment=require(_0x8b71('0x0'));var BPromise=require(_0x8b71('0x1'));var util=require(_0x8b71('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0x8b71('0x3'));var htmlToText=require('html-to-text');var qs=require(_0x8b71('0x4'));var logger=require(_0x8b71('0x5'))(_0x8b71('0x6'));var interaction_log=require(_0x8b71('0x5'))(_0x8b71('0x7'));var config=require(_0x8b71('0x8'));var db=require(_0x8b71('0x9'))['db'];config[_0x8b71('0xa')]=_[_0x8b71('0xb')](config[_0x8b71('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8b71('0xc'))(new Redis(config['redis']));var htmlEntities=require(_0x8b71('0xd'));require('./mailMessage.socket')[_0x8b71('0xe')](socket);var jayson=require(_0x8b71('0xf'));var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0x8b71('0x10')][_0x8b71('0x11')]({'port':0x232b});var client9002=jayson[_0x8b71('0x10')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46e262,_0x3815fd,_0x544d79,_0x3d7498){return new BPromise(function(_0x47de17,_0x5262f7){var _0x3234fb=_0x3d7498||client;return _0x3234fb[_0x8b71('0x12')](_0x46e262,_0x544d79)['then'](function(_0x2a34d0){logger[_0x8b71('0x13')]('MailMessage,\x20%s,\x20%s',_0x3815fd,_0x8b71('0x14'));logger[_0x8b71('0x15')](_0x8b71('0x16'),_0x3815fd,'request\x20sent',JSON['stringify'](_0x2a34d0));if(_0x2a34d0['error']){if(_0x2a34d0['error']['code']===0x1f4){logger[_0x8b71('0x17')](_0x8b71('0x18'),_0x3815fd,_0x2a34d0[_0x8b71('0x17')][_0x8b71('0x19')]);return _0x5262f7(_0x2a34d0[_0x8b71('0x17')]['message']);}logger[_0x8b71('0x17')](_0x8b71('0x18'),_0x3815fd,_0x2a34d0['error'][_0x8b71('0x19')]);return _0x47de17(_0x2a34d0[_0x8b71('0x17')]['message']);}else{logger[_0x8b71('0x13')]('MailMessage,\x20%s,\x20%s',_0x3815fd,'request\x20sent');_0x47de17(_0x2a34d0[_0x8b71('0x1a')][_0x8b71('0x19')]);}})[_0x8b71('0x1b')](function(_0x4f80be){logger[_0x8b71('0x17')]('MailMessage,\x20%s,\x20%s',_0x3815fd,_0x4f80be);_0x5262f7(_0x4f80be);});});}function respondWithResult(_0x146e12,_0x39c586){_0x39c586=_0x39c586||0xc8;return function(_0x2b3f04){if(_0x2b3f04){return _0x146e12[_0x8b71('0x1c')](_0x39c586)[_0x8b71('0x1d')](_0x2b3f04);}};}function respondWithFilteredResult(_0x377149,_0x32c046){return function(_0x257b66){if(_0x257b66){var _0x41cbed=typeof _0x32c046[_0x8b71('0x1e')]===_0x8b71('0x1f')&&typeof _0x32c046[_0x8b71('0x20')]==='undefined';var _0x3fe95d=_0x257b66[_0x8b71('0x21')];var _0x117dfa=_0x41cbed?0x0:_0x32c046[_0x8b71('0x1e')];var _0x42561b=_0x41cbed?_0x257b66[_0x8b71('0x21')]:_0x32c046['offset']+_0x32c046[_0x8b71('0x20')];var _0x485ebc;if(_0x42561b>=_0x3fe95d){_0x42561b=_0x3fe95d;_0x485ebc=0xc8;}else{_0x485ebc=0xce;}_0x377149[_0x8b71('0x1c')](_0x485ebc);return _0x377149[_0x8b71('0x22')](_0x8b71('0x23'),_0x117dfa+'-'+_0x42561b+'/'+_0x3fe95d)[_0x8b71('0x1d')](_0x257b66);}return null;};}function saveUpdates(_0x561e90){return function(_0x5a8a70){if(_0x5a8a70){return _0x5a8a70[_0x8b71('0x24')](_0x561e90)[_0x8b71('0x25')](function(_0x529e79){return _0x529e79;});}return null;};}function removeEntity(_0x38916e){return function(_0xaaa990){if(_0xaaa990){return _0xaaa990[_0x8b71('0x26')]()[_0x8b71('0x25')](function(){_0x38916e[_0x8b71('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c0025){return function(_0xff41bb){if(!_0xff41bb){_0x3c0025['sendStatus'](0x194);}return _0xff41bb;};}function handleError(_0x194b63,_0x27b40b){_0x27b40b=_0x27b40b||0x1f4;return function(_0x58df7b){logger['error'](_0x58df7b[_0x8b71('0x27')]);if(_0x58df7b[_0x8b71('0x28')]){delete _0x58df7b['name'];}_0x194b63[_0x8b71('0x1c')](_0x27b40b)[_0x8b71('0x29')](_0x58df7b);};}exports[_0x8b71('0x2a')]=function(_0x34aa77,_0x21e51e){var _0x40d419={},_0x3be40b={},_0x194e70={'count':0x0,'rows':[]};var _0xc710d8=_['map'](db[_0x8b71('0x2b')][_0x8b71('0x2c')],function(_0x37a72d){return{'name':_0x37a72d['fieldName'],'type':_0x37a72d['type'][_0x8b71('0x2d')]};});_0x3be40b[_0x8b71('0x2e')]=_[_0x8b71('0x2f')](_0xc710d8,_0x8b71('0x28'));_0x3be40b[_0x8b71('0x30')]=_[_0x8b71('0x31')](_0x34aa77[_0x8b71('0x30')]);_0x3be40b[_0x8b71('0x32')]=_[_0x8b71('0x33')](_0x3be40b[_0x8b71('0x2e')],_0x3be40b[_0x8b71('0x30')]);_0x40d419[_0x8b71('0x34')]=_[_0x8b71('0x33')](_0x3be40b['model'],qs[_0x8b71('0x35')](_0x34aa77[_0x8b71('0x30')][_0x8b71('0x35')]));_0x40d419[_0x8b71('0x34')]=_0x40d419[_0x8b71('0x34')][_0x8b71('0x36')]?_0x40d419[_0x8b71('0x34')]:_0x3be40b[_0x8b71('0x2e')];if(!_0x34aa77['query'][_0x8b71('0x37')](_0x8b71('0x38'))){_0x40d419[_0x8b71('0x20')]=qs[_0x8b71('0x20')](_0x34aa77[_0x8b71('0x30')]['limit']);_0x40d419[_0x8b71('0x1e')]=qs[_0x8b71('0x1e')](_0x34aa77[_0x8b71('0x30')]['offset']);}_0x40d419[_0x8b71('0x39')]=qs[_0x8b71('0x3a')](_0x34aa77[_0x8b71('0x30')][_0x8b71('0x3a')]);_0x40d419[_0x8b71('0x3b')]=qs[_0x8b71('0x32')](_['pick'](_0x34aa77[_0x8b71('0x30')],_0x3be40b[_0x8b71('0x32')]),_0xc710d8);if(_0x34aa77[_0x8b71('0x30')][_0x8b71('0x3c')]){_0x40d419[_0x8b71('0x3b')]=_['merge'](_0x40d419[_0x8b71('0x3b')],{'$or':_[_0x8b71('0x2f')](_0xc710d8,function(_0x5c2769){if(_0x5c2769[_0x8b71('0x3d')]!==_0x8b71('0x3e')){var _0x23f42b={};_0x23f42b[_0x5c2769['name']]={'$like':'%'+_0x34aa77[_0x8b71('0x30')]['filter']+'%'};return _0x23f42b;}})});}_0x40d419=_['merge']({},_0x40d419,_0x34aa77[_0x8b71('0x3f')]);var _0x49fc8b={'where':_0x40d419[_0x8b71('0x3b')]};return db[_0x8b71('0x2b')][_0x8b71('0x21')](_0x49fc8b)[_0x8b71('0x25')](function(_0x37ca15){_0x194e70[_0x8b71('0x21')]=_0x37ca15;if(_0x34aa77['query']['includeAll']){_0x40d419[_0x8b71('0x40')]=[{'all':!![]}];}return db[_0x8b71('0x2b')][_0x8b71('0x41')](_0x40d419);})[_0x8b71('0x25')](function(_0x40df91){_0x194e70['rows']=_0x40df91;return _0x194e70;})[_0x8b71('0x25')](respondWithFilteredResult(_0x21e51e,_0x40d419))[_0x8b71('0x1b')](handleError(_0x21e51e,null));};exports[_0x8b71('0x42')]=function(_0x1b999d,_0x56cb8c){var _0x5c8aa4={'raw':!![],'where':{'id':_0x1b999d['params']['id']}},_0x573e27={};_0x573e27['model']=_['keys'](db[_0x8b71('0x2b')][_0x8b71('0x2c')]);_0x573e27[_0x8b71('0x30')]=_[_0x8b71('0x31')](_0x1b999d['query']);_0x573e27[_0x8b71('0x32')]=_[_0x8b71('0x33')](_0x573e27['model'],_0x573e27['query']);_0x5c8aa4[_0x8b71('0x34')]=_[_0x8b71('0x33')](_0x573e27[_0x8b71('0x2e')],qs[_0x8b71('0x35')](_0x1b999d[_0x8b71('0x30')][_0x8b71('0x35')]));_0x5c8aa4[_0x8b71('0x34')]=_0x5c8aa4['attributes'][_0x8b71('0x36')]?_0x5c8aa4[_0x8b71('0x34')]:_0x573e27[_0x8b71('0x2e')];if(_0x1b999d[_0x8b71('0x30')][_0x8b71('0x43')]){_0x5c8aa4[_0x8b71('0x40')]=[{'all':!![]}];}_0x5c8aa4=_['merge']({},_0x5c8aa4,_0x1b999d[_0x8b71('0x3f')]);return db[_0x8b71('0x2b')]['find'](_0x5c8aa4)[_0x8b71('0x25')](handleEntityNotFound(_0x56cb8c,null))['then'](respondWithResult(_0x56cb8c,null))[_0x8b71('0x1b')](handleError(_0x56cb8c,null));};exports[_0x8b71('0x24')]=function(_0x49e095,_0x29cf7a){if(_0x49e095[_0x8b71('0x44')]['id']){delete _0x49e095['body']['id'];}return db[_0x8b71('0x2b')][_0x8b71('0x45')]({'where':{'id':_0x49e095[_0x8b71('0x46')]['id']}})[_0x8b71('0x25')](handleEntityNotFound(_0x29cf7a,null))[_0x8b71('0x25')](saveUpdates(_0x49e095[_0x8b71('0x44')],null))[_0x8b71('0x25')](respondWithResult(_0x29cf7a,null))[_0x8b71('0x1b')](handleError(_0x29cf7a,null));};exports[_0x8b71('0x26')]=function(_0x5f5169,_0x4baef0){return db[_0x8b71('0x2b')][_0x8b71('0x45')]({'where':{'id':_0x5f5169[_0x8b71('0x46')]['id']}})[_0x8b71('0x25')](handleEntityNotFound(_0x4baef0,null))[_0x8b71('0x25')](removeEntity(_0x4baef0,null))[_0x8b71('0x1b')](handleError(_0x4baef0,null));};exports[_0x8b71('0x47')]=function(_0x3557bd,_0x2e653e){return db[_0x8b71('0x2b')][_0x8b71('0x47')]()[_0x8b71('0x25')](respondWithResult(_0x2e653e,null))['catch'](handleError(_0x2e653e,null));};exports[_0x8b71('0x48')]=function(_0x2c2375,_0x3af292){return db[_0x8b71('0x2b')]['create'](_0x2c2375[_0x8b71('0x44')])[_0x8b71('0x25')](function(_0x518b2e){if(_0x518b2e){if(_0x518b2e[_0x8b71('0x49')]===_0x8b71('0x4a')&&!_0x518b2e[_0x8b71('0x4b')]){var _0x304dbc,_0x10e159,_0x40cb64;if(_0x2c2375[_0x8b71('0x44')]['to']){_0x10e159=_0x2c2375['body']['to'][_0x8b71('0x4c')](',')[0x0];}return db[_0x8b71('0x4d')][_0x8b71('0x4e')]({'where':{'id':_0x518b2e[_0x8b71('0x4f')]},'include':[{'model':db[_0x8b71('0x50')],'as':_0x8b71('0x51'),'include':[{'model':db[_0x8b71('0x52')],'as':'Contacts','where':{'email':_0x10e159},'limit':0x1,'order':[[_0x8b71('0x53'),'DESC']]}]},{'model':db[_0x8b71('0x54')],'as':'Smtp','raw':!![]}]})[_0x8b71('0x25')](function(_0x3f9f11){_0x304dbc=_0x3f9f11;if(_0x304dbc&&_0x304dbc['Smtp']){var _0x226fb9={'tls':{'rejectUnauthorized':![]}};if(_[_0x8b71('0x55')](_0x304dbc[_0x8b71('0x56')][_0x8b71('0x57')])){_0x226fb9[_0x8b71('0x58')]=_0x304dbc[_0x8b71('0x56')][_0x8b71('0x58')];_0x226fb9['port']=_0x304dbc[_0x8b71('0x56')][_0x8b71('0x59')];_0x226fb9[_0x8b71('0x5a')]=_0x304dbc[_0x8b71('0x56')][_0x8b71('0x5a')];if(_0x304dbc[_0x8b71('0x56')]['authentication']){_0x226fb9[_0x8b71('0x5b')]={'user':_0x304dbc[_0x8b71('0x56')]['user'],'pass':_0x304dbc[_0x8b71('0x56')][_0x8b71('0x5c')]};}}else{_0x226fb9[_0x8b71('0x57')]=_0x304dbc[_0x8b71('0x56')]['service'];_0x226fb9[_0x8b71('0x5b')]={'user':_0x304dbc['Smtp'][_0x8b71('0x5d')],'pass':_0x304dbc['Smtp']['pass']};_0x226fb9['secure']=_0x304dbc[_0x8b71('0x56')][_0x8b71('0x5a')];}if(_0x2c2375['body'][_0x8b71('0x5e')]&&_0x2c2375[_0x8b71('0x44')][_0x8b71('0x5e')][_0x8b71('0x36')]){for(var _0x123c5d=0x0;_0x123c5d<_0x2c2375[_0x8b71('0x44')][_0x8b71('0x5e')]['length'];_0x123c5d+=0x1){_0x2c2375['body'][_0x8b71('0x5e')][_0x123c5d]={'filename':_0x2c2375[_0x8b71('0x44')][_0x8b71('0x5e')][_0x123c5d][_0x8b71('0x28')],'path':path[_0x8b71('0x5f')](config[_0x8b71('0x60')],_0x8b71('0x61'),_0x2c2375[_0x8b71('0x44')][_0x8b71('0x5e')][_0x123c5d][_0x8b71('0x62')])};}}_0x40cb64={'account':_0x226fb9,'message':_0x2c2375[_0x8b71('0x44')]};return;}})[_0x8b71('0x25')](function(){if(_0x304dbc[_0x8b71('0x51')]){if(_0x304dbc[_0x8b71('0x51')][_0x8b71('0x63')][_0x8b71('0x36')]){return _0x304dbc[_0x8b71('0x51')][_0x8b71('0x63')][0x0];}else{return db[_0x8b71('0x52')][_0x8b71('0x48')](_['defaults'](_0x2c2375['body'],{'firstName':_0x2c2375['body']['to'],'email':_0x2c2375[_0x8b71('0x44')]['to'],'phone':_0x2c2375[_0x8b71('0x44')]['to'],'ListId':_0x304dbc[_0x8b71('0x64')]}));}}else{throw new Error(_0x8b71('0x65'));}})['then'](function(){if(_0x40cb64){return respondWithRpcPromise(_0x8b71('0x66'),_0x8b71('0x67'),_0x40cb64,client9003)[_0x8b71('0x25')](function(_0x500780){return _0x518b2e['update']({'read':!![],'messageId':_0x500780[_0x8b71('0x68')],'sentAt':moment()[_0x8b71('0x69')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x8b71('0x1b')](function(_0x169242){logger[_0x8b71('0x17')]('%s',JSON['stringify'](_0x169242));return _0x518b2e;});}return _0x518b2e;});}return _0x518b2e;}})[_0x8b71('0x25')](respondWithResult(_0x3af292,0xc9))[_0x8b71('0x1b')](handleError(_0x3af292,null));};exports[_0x8b71('0x6a')]=function(_0x372e93,_0x4be387){var _0x397144={'agent':{},'channel':_0x8b71('0x6b')};if(_0x372e93['body']['id']){delete _0x372e93['body']['id'];}_0x372e93[_0x8b71('0x44')][_0x8b71('0x6c')]=!![];_0x372e93[_0x8b71('0x44')]['readAt']=moment()[_0x8b71('0x69')](_0x8b71('0x6d'));_0x372e93['body'][_0x8b71('0x6e')]=_0x372e93[_0x8b71('0x44')][_0x8b71('0x6e')]||_0x372e93[_0x8b71('0x5d')]['id'];_0x397144[_0x8b71('0x6f')]['id']=_0x372e93[_0x8b71('0x44')][_0x8b71('0x6e')];return db[_0x8b71('0x2b')][_0x8b71('0x45')]({'where':{'id':_0x372e93[_0x8b71('0x46')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4be387,null))[_0x8b71('0x25')](saveUpdates(_0x372e93[_0x8b71('0x44')],null))[_0x8b71('0x25')](function(_0x450506){if(_0x450506){_0x397144[_0x8b71('0x19')]=_0x450506[_0x8b71('0x70')]({'plain':!![]});return db[_0x8b71('0x71')][_0x8b71('0x45')]({'where':{'id':_0x450506[_0x8b71('0x72')]}});}return null;})['then'](handleEntityNotFound(_0x4be387,null))['then'](function(_0x2e3025){if(_0x2e3025){return _0x2e3025[_0x8b71('0x24')]({'UserId':_0x372e93[_0x8b71('0x44')][_0x8b71('0x6e')],'read1stAt':_[_0x8b71('0x55')](_0x2e3025[_0x8b71('0x73')])?moment()['format'](_0x8b71('0x6d')):undefined});}return null;})[_0x8b71('0x25')](function(_0xf2961){if(_0xf2961){_0x397144[_0x8b71('0x74')]=_0xf2961[_0x8b71('0x70')]({'plain':!![]});interaction_log[_0x8b71('0x13')](_0x8b71('0x75'),_0x372e93['user']['id'],_0x372e93['user'][_0x8b71('0x28')],_0x372e93[_0x8b71('0x5d')][_0x8b71('0x76')],_0x397144[_0x8b71('0x74')]['id'],_0x372e93[_0x8b71('0x44')]?JSON[_0x8b71('0x77')](_0x372e93['body']):_0x8b71('0x78'));return respondWithRpcPromise('AcceptMessage',_0x8b71('0x79'),_0x397144);}return null;})[_0x8b71('0x25')](function(_0x8c2f96){var _0x2df5d0='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x8c2f96[_0x8b71('0x19')]['ContactId'];return db['sequelize'][_0x8b71('0x30')](_0x2df5d0,{'type':db[_0x8b71('0x7a')][_0x8b71('0x7b')]['SELECT'],'raw':!![]})[_0x8b71('0x25')](function(_0x3deb89){return _0x3deb89;});})[_0x8b71('0x25')](function(_0x1ff800){if(_0x1ff800){_0x397144[_0x8b71('0x19')][_0x8b71('0x7c')]=_0x1ff800[0x0];if(!_0x372e93[_0x8b71('0x44')]['UserId'])return;return db[_0x8b71('0x7d')][_0x8b71('0x45')]({'where':{'id':_0x372e93[_0x8b71('0x44')][_0x8b71('0x6e')],'role':_0x8b71('0x6f')},'attributes':['id','name',_0x8b71('0x7e'),_0x8b71('0x7f'),_0x8b71('0x80')],'raw':!![]});}return null;})[_0x8b71('0x25')](function(_0x322450){if(!_0x322450)return null;_0x397144['message'][_0x8b71('0x6f')]=_0x322450;return _0x397144;})[_0x8b71('0x25')](function(_0x3fb9dd){if(_0x3fb9dd){if(_0x372e93[_0x8b71('0x44')][_0x8b71('0x81')]){_0x397144['message'][_0x8b71('0x82')]=util[_0x8b71('0x69')](_0x8b71('0x83'),_0x372e93[_0x8b71('0x5d')][_0x8b71('0x28')]);_0x397144[_0x8b71('0x19')][_0x8b71('0x84')]=_0x397144[_0x8b71('0x84')];_0x397144[_0x8b71('0x19')][_0x8b71('0x85')]=_0x397144[_0x8b71('0x84')];_0x397144[_0x8b71('0x19')][_0x8b71('0x86')]=_0x8b71('0x6a');_0x397144['message'][_0x8b71('0x44')]=htmlToText[_0x8b71('0x87')](_0x397144['message']['body']);return respondWithRpcPromise('EventManager',_0x8b71('0x88'),{'event':_0x8b71('0x89'),'message':_0x397144[_0x8b71('0x19')]},client9002)[_0x8b71('0x25')](function(){return _0x397144;});}return _0x397144;}return null;})['then'](respondWithResult(_0x4be387,null))[_0x8b71('0x1b')](handleError(_0x4be387,null));};exports[_0x8b71('0x8a')]=function(_0x99e705,_0x5b618f){var _0x7adb24={'agent':{},'channel':_0x8b71('0x6b')};if(_0x99e705[_0x8b71('0x44')]['id']){delete _0x99e705[_0x8b71('0x44')]['id'];}_0x99e705[_0x8b71('0x44')]['UserId']=_0x99e705[_0x8b71('0x44')][_0x8b71('0x6e')]||_0x99e705[_0x8b71('0x5d')]['id'];_0x7adb24[_0x8b71('0x6f')]['id']=_0x99e705[_0x8b71('0x44')][_0x8b71('0x6e')];return db[_0x8b71('0x2b')][_0x8b71('0x45')]({'where':{'id':_0x99e705[_0x8b71('0x46')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5b618f,null))[_0x8b71('0x25')](function(_0x3add05){if(_0x3add05){_0x7adb24[_0x8b71('0x19')]=_0x3add05[_0x8b71('0x70')]({'plain':!![]});return db[_0x8b71('0x71')][_0x8b71('0x45')]({'where':{'id':_0x3add05[_0x8b71('0x72')]}});}return null;})[_0x8b71('0x25')](handleEntityNotFound(_0x5b618f,null))['then'](function(_0x179cb6){if(_0x179cb6){_0x7adb24['interaction']=_0x179cb6[_0x8b71('0x70')]({'plain':!![]});interaction_log[_0x8b71('0x13')](_0x8b71('0x8b'),_0x99e705[_0x8b71('0x5d')]['id'],_0x99e705['user']['name'],_0x99e705['user'][_0x8b71('0x76')],_0x7adb24[_0x8b71('0x74')]['id'],_0x99e705[_0x8b71('0x44')]?JSON[_0x8b71('0x77')](_0x99e705['body']):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x7adb24);}return null;})['then'](function(_0x4620fb){var _0x34af7f=_0x8b71('0x8c')+_0x4620fb['message'][_0x8b71('0x8d')];return db[_0x8b71('0x8e')][_0x8b71('0x30')](_0x34af7f,{'type':db[_0x8b71('0x7a')][_0x8b71('0x7b')]['SELECT'],'raw':!![]})[_0x8b71('0x25')](function(_0x3e9a57){return _0x3e9a57;});})[_0x8b71('0x25')](function(_0x48e63c){if(_0x48e63c){_0x7adb24[_0x8b71('0x19')][_0x8b71('0x7c')]=_0x48e63c[0x0];if(!_0x99e705[_0x8b71('0x44')][_0x8b71('0x6e')])return;return db[_0x8b71('0x7d')][_0x8b71('0x45')]({'where':{'id':_0x99e705['body'][_0x8b71('0x6e')],'role':_0x8b71('0x6f')},'attributes':['id','name','fullname',_0x8b71('0x7f'),_0x8b71('0x80')],'raw':!![]});}return null;})['then'](function(_0x6a66d3){if(!_0x6a66d3)return null;_0x7adb24[_0x8b71('0x19')][_0x8b71('0x6f')]=_0x6a66d3;return _0x7adb24;})[_0x8b71('0x25')](function(_0x335b5b){if(_0x335b5b){_0x335b5b[_0x8b71('0x19')][_0x8b71('0x82')]=util[_0x8b71('0x69')](_0x8b71('0x83'),_0x99e705['user']['name']);_0x335b5b['message'][_0x8b71('0x84')]=_0x7adb24[_0x8b71('0x84')];_0x335b5b['message']['motionChannel']=_0x7adb24['channel'];_0x335b5b[_0x8b71('0x19')][_0x8b71('0x86')]=_0x8b71('0x8a');_0x335b5b[_0x8b71('0x19')][_0x8b71('0x44')]=htmlToText['fromString'](_0x7adb24[_0x8b71('0x19')][_0x8b71('0x44')]);respondWithRpcPromise(_0x8b71('0x88'),_0x8b71('0x88'),{'event':_0x8b71('0x8f'),'message':_0x335b5b[_0x8b71('0x19')]},client9002);return _0x7adb24;}return null;})[_0x8b71('0x25')](respondWithResult(_0x5b618f,null))[_0x8b71('0x1b')](handleError(_0x5b618f,null));};exports[_0x8b71('0x90')]=function(_0x105cea,_0x56c500){var _0x54203c=moment()[_0x8b71('0x91')]()[_0x8b71('0x92')]();var _0x30eb66=path[_0x8b71('0x5f')](config[_0x8b71('0x60')],_0x8b71('0x93'),_0x8b71('0x94'),_0x8b71('0x95'));var _0x304cfa=path[_0x8b71('0x5f')](config[_0x8b71('0x60')],_0x8b71('0x93'),_0x8b71('0x94'),'attachments');var _0x3712ef=util[_0x8b71('0x69')](_0x8b71('0x96'),_0x54203c);return db[_0x8b71('0x2b')][_0x8b71('0x45')]({'where':{'id':_0x105cea[_0x8b71('0x46')]['id']},'attributes':['id',_0x8b71('0x44'),_0x8b71('0x97'),'to','cc',_0x8b71('0x98'),_0x8b71('0x99'),_0x8b71('0x9a')],'include':_0x105cea[_0x8b71('0x30')][_0x8b71('0x5e')]?[{'model':db[_0x8b71('0x9b')],'as':_0x8b71('0x9c')}]:undefined})['then'](handleEntityNotFound(_0x56c500,null))[_0x8b71('0x25')](function(_0x42ab59){if(_0x42ab59){var _0xa95b60=_0x42ab59;var _0x245b06={'from':_0xa95b60[_0x8b71('0x97')],'to':_0xa95b60['to'],'subject':_0xa95b60[_0x8b71('0x99')],'html':htmlEntities[_0x8b71('0x9d')](_0xa95b60[_0x8b71('0x44')]),'headers':{'Date':moment(_0xa95b60[_0x8b71('0x9a')])[_0x8b71('0x69')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x42ab59['cc']){_0x245b06[_0x8b71('0x9e')]['Cc']=_0x42ab59['cc'];}if(_0x42ab59[_0x8b71('0x98')]){_0x245b06[_0x8b71('0x9e')][_0x8b71('0x9f')]=_0x42ab59[_0x8b71('0x98')];}return new BPromise(function(_0x18808f,_0x4cc55b){if(_0x42ab59[_0x8b71('0x9c')]){for(var _0x5e4583=0x0;_0x5e4583<_0x42ab59[_0x8b71('0x9c')][_0x8b71('0x36')];_0x5e4583++){var _0x55126b=_0x42ab59['Attachments'][_0x5e4583];var _0x1b2b8f=path[_0x8b71('0x5f')](_0x304cfa,_0x55126b[_0x8b71('0x62')]);if(fs[_0x8b71('0xa0')](_0x1b2b8f)){_0x245b06[_0x8b71('0x5e')][_0x8b71('0xa1')]({'name':_0x55126b[_0x8b71('0x28')],'contentType':_0x55126b[_0x8b71('0x3d')],'data':fs['readFileSync'](_0x1b2b8f)});}}}emlformat['build'](_0x245b06,function(_0x5a6bbd,_0x467d1d){if(_0x5a6bbd)return _0x4cc55b(_0x5a6bbd);fs[_0x8b71('0xa2')](path[_0x8b71('0x5f')](_0x30eb66,_0x3712ef),_0x467d1d);return _0x18808f(_0x467d1d);});});}})[_0x8b71('0x25')](function(_0x5f1e02){if(_0x5f1e02){return _0x56c500[_0x8b71('0x90')](path[_0x8b71('0x5f')](_0x30eb66,_0x3712ef),_0x3712ef,function(_0x537686){if(!_0x537686)fs[_0x8b71('0xa3')](path[_0x8b71('0x5f')](_0x30eb66,_0x3712ef));});}})[_0x8b71('0x1b')](handleError(_0x56c500,null));}; \ No newline at end of file +var _0xfff6=['Content-Range','update','then','destroy','status','sendStatus','name','send','index','MailMessage','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','includeAll','options','body','find','params','catch','describe','create','direction','out','split','MailAccount','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','Smtp','isNil','service','host','port','auth','pass','secure','attachments','root','basename','List','ListId','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','read','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','User','fullname','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','reject','mail','role','null','RejectMessage','sequelize','Sequelize','rejectmessage','join','server','files','tmp','message-%s.eml','from','subject','createdAt','Attachment','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','Attachments','existsSync','push','type','build','download','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','defaults','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','json','offset','limit','count','set'];(function(_0x4e7af4,_0x758572){var _0x2548f1=function(_0xa849c){while(--_0xa849c){_0x4e7af4['push'](_0x4e7af4['shift']());}};_0x2548f1(++_0x758572);}(_0xfff6,0x120));var _0x6fff=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xfff6[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require('eml-format');var moment=require(_0x6fff('0x0'));var BPromise=require(_0x6fff('0x1'));var util=require(_0x6fff('0x2'));var path=require(_0x6fff('0x3'));var fs=require('fs');var _=require(_0x6fff('0x4'));var Redis=require(_0x6fff('0x5'));var htmlToText=require(_0x6fff('0x6'));var qs=require(_0x6fff('0x7'));var logger=require(_0x6fff('0x8'))(_0x6fff('0x9'));var interaction_log=require(_0x6fff('0x8'))(_0x6fff('0xa'));var config=require(_0x6fff('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x6fff('0xc')](config[_0x6fff('0xd')],{'host':_0x6fff('0xe'),'port':0x18eb});var socket=require(_0x6fff('0xf'))(new Redis(config[_0x6fff('0xd')]));var htmlEntities=require(_0x6fff('0x10'));require(_0x6fff('0x11'))[_0x6fff('0x12')](socket);var jayson=require(_0x6fff('0x13'));var client=jayson[_0x6fff('0x14')][_0x6fff('0x15')]({'port':0x232c});var client9003=jayson[_0x6fff('0x14')][_0x6fff('0x15')]({'port':0x232b});var client9002=jayson[_0x6fff('0x14')][_0x6fff('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x415869,_0x3ad685,_0xa6aec3,_0xc9cf3c){return new BPromise(function(_0x3edb75,_0xf8f73c){var _0x4202d2=_0xc9cf3c||client;return _0x4202d2[_0x6fff('0x16')](_0x415869,_0xa6aec3)['then'](function(_0x50df5e){logger[_0x6fff('0x17')](_0x6fff('0x18'),_0x3ad685,_0x6fff('0x19'));logger[_0x6fff('0x1a')](_0x6fff('0x1b'),_0x3ad685,_0x6fff('0x19'),JSON[_0x6fff('0x1c')](_0x50df5e));if(_0x50df5e['error']){if(_0x50df5e['error'][_0x6fff('0x1d')]===0x1f4){logger[_0x6fff('0x1e')](_0x6fff('0x18'),_0x3ad685,_0x50df5e[_0x6fff('0x1e')][_0x6fff('0x1f')]);return _0xf8f73c(_0x50df5e['error'][_0x6fff('0x1f')]);}logger['error'](_0x6fff('0x18'),_0x3ad685,_0x50df5e[_0x6fff('0x1e')][_0x6fff('0x1f')]);return _0x3edb75(_0x50df5e[_0x6fff('0x1e')][_0x6fff('0x1f')]);}else{logger[_0x6fff('0x17')](_0x6fff('0x18'),_0x3ad685,'request\x20sent');_0x3edb75(_0x50df5e[_0x6fff('0x20')][_0x6fff('0x1f')]);}})['catch'](function(_0x2c8c8c){logger[_0x6fff('0x1e')](_0x6fff('0x18'),_0x3ad685,_0x2c8c8c);_0xf8f73c(_0x2c8c8c);});});}function respondWithResult(_0x2cb8bc,_0x16ac38){_0x16ac38=_0x16ac38||0xc8;return function(_0x4163a5){if(_0x4163a5){return _0x2cb8bc['status'](_0x16ac38)[_0x6fff('0x21')](_0x4163a5);}};}function respondWithFilteredResult(_0xf8070f,_0x1db4ae){return function(_0x55d368){if(_0x55d368){var _0x4816b9=typeof _0x1db4ae[_0x6fff('0x22')]==='undefined'&&typeof _0x1db4ae[_0x6fff('0x23')]==='undefined';var _0x4c00e5=_0x55d368[_0x6fff('0x24')];var _0x17fbf4=_0x4816b9?0x0:_0x1db4ae[_0x6fff('0x22')];var _0x37e172=_0x4816b9?_0x55d368[_0x6fff('0x24')]:_0x1db4ae[_0x6fff('0x22')]+_0x1db4ae[_0x6fff('0x23')];var _0x45eeb2;if(_0x37e172>=_0x4c00e5){_0x37e172=_0x4c00e5;_0x45eeb2=0xc8;}else{_0x45eeb2=0xce;}_0xf8070f['status'](_0x45eeb2);return _0xf8070f[_0x6fff('0x25')](_0x6fff('0x26'),_0x17fbf4+'-'+_0x37e172+'/'+_0x4c00e5)[_0x6fff('0x21')](_0x55d368);}return null;};}function saveUpdates(_0x1a83c8){return function(_0x37a7a0){if(_0x37a7a0){return _0x37a7a0[_0x6fff('0x27')](_0x1a83c8)[_0x6fff('0x28')](function(_0xccc78f){return _0xccc78f;});}return null;};}function removeEntity(_0xf73364){return function(_0x304d6a){if(_0x304d6a){return _0x304d6a[_0x6fff('0x29')]()['then'](function(){_0xf73364[_0x6fff('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x563c8a){return function(_0x5fd743){if(!_0x5fd743){_0x563c8a[_0x6fff('0x2b')](0x194);}return _0x5fd743;};}function handleError(_0x4b704d,_0x308b32){_0x308b32=_0x308b32||0x1f4;return function(_0x36e960){logger['error'](_0x36e960['stack']);if(_0x36e960[_0x6fff('0x2c')]){delete _0x36e960[_0x6fff('0x2c')];}_0x4b704d[_0x6fff('0x2a')](_0x308b32)[_0x6fff('0x2d')](_0x36e960);};}exports[_0x6fff('0x2e')]=function(_0x4d50ef,_0xb7c65b){var _0x15cb44={},_0x370f3a={},_0x5d4292={'count':0x0,'rows':[]};var _0x665ac2=_['map'](db[_0x6fff('0x2f')][_0x6fff('0x30')],function(_0x4cbac7){return{'name':_0x4cbac7[_0x6fff('0x31')],'type':_0x4cbac7['type']['key']};});_0x370f3a[_0x6fff('0x32')]=_['map'](_0x665ac2,_0x6fff('0x2c'));_0x370f3a[_0x6fff('0x33')]=_[_0x6fff('0x34')](_0x4d50ef[_0x6fff('0x33')]);_0x370f3a[_0x6fff('0x35')]=_[_0x6fff('0x36')](_0x370f3a[_0x6fff('0x32')],_0x370f3a[_0x6fff('0x33')]);_0x15cb44[_0x6fff('0x37')]=_[_0x6fff('0x36')](_0x370f3a[_0x6fff('0x32')],qs['fields'](_0x4d50ef[_0x6fff('0x33')][_0x6fff('0x38')]));_0x15cb44[_0x6fff('0x37')]=_0x15cb44[_0x6fff('0x37')][_0x6fff('0x39')]?_0x15cb44[_0x6fff('0x37')]:_0x370f3a[_0x6fff('0x32')];if(!_0x4d50ef[_0x6fff('0x33')][_0x6fff('0x3a')](_0x6fff('0x3b'))){_0x15cb44[_0x6fff('0x23')]=qs['limit'](_0x4d50ef['query'][_0x6fff('0x23')]);_0x15cb44[_0x6fff('0x22')]=qs[_0x6fff('0x22')](_0x4d50ef[_0x6fff('0x33')][_0x6fff('0x22')]);}_0x15cb44[_0x6fff('0x3c')]=qs['sort'](_0x4d50ef[_0x6fff('0x33')][_0x6fff('0x3d')]);_0x15cb44[_0x6fff('0x3e')]=qs['filters'](_[_0x6fff('0x3f')](_0x4d50ef[_0x6fff('0x33')],_0x370f3a[_0x6fff('0x35')]),_0x665ac2);if(_0x4d50ef[_0x6fff('0x33')][_0x6fff('0x40')]){_0x15cb44[_0x6fff('0x3e')]=_[_0x6fff('0x41')](_0x15cb44['where'],{'$or':_['map'](_0x665ac2,function(_0x1d9345){if(_0x1d9345['type']!==_0x6fff('0x42')){var _0x33d98e={};_0x33d98e[_0x1d9345['name']]={'$like':'%'+_0x4d50ef[_0x6fff('0x33')][_0x6fff('0x40')]+'%'};return _0x33d98e;}})});}_0x15cb44=_['merge']({},_0x15cb44,_0x4d50ef['options']);var _0xcfed35={'where':_0x15cb44[_0x6fff('0x3e')]};return db[_0x6fff('0x2f')][_0x6fff('0x24')](_0xcfed35)[_0x6fff('0x28')](function(_0x50ccec){_0x5d4292[_0x6fff('0x24')]=_0x50ccec;if(_0x4d50ef['query']['includeAll']){_0x15cb44[_0x6fff('0x43')]=[{'all':!![]}];}return db[_0x6fff('0x2f')][_0x6fff('0x44')](_0x15cb44);})[_0x6fff('0x28')](function(_0x348028){_0x5d4292[_0x6fff('0x45')]=_0x348028;return _0x5d4292;})['then'](respondWithFilteredResult(_0xb7c65b,_0x15cb44))['catch'](handleError(_0xb7c65b,null));};exports[_0x6fff('0x46')]=function(_0x6e227,_0x5075dd){var _0x3b9dd1={'raw':!![],'where':{'id':_0x6e227['params']['id']}},_0x36089a={};_0x36089a[_0x6fff('0x32')]=_['keys'](db[_0x6fff('0x2f')][_0x6fff('0x30')]);_0x36089a['query']=_[_0x6fff('0x34')](_0x6e227[_0x6fff('0x33')]);_0x36089a[_0x6fff('0x35')]=_[_0x6fff('0x36')](_0x36089a['model'],_0x36089a['query']);_0x3b9dd1['attributes']=_[_0x6fff('0x36')](_0x36089a['model'],qs[_0x6fff('0x38')](_0x6e227[_0x6fff('0x33')]['fields']));_0x3b9dd1[_0x6fff('0x37')]=_0x3b9dd1[_0x6fff('0x37')][_0x6fff('0x39')]?_0x3b9dd1[_0x6fff('0x37')]:_0x36089a['model'];if(_0x6e227['query'][_0x6fff('0x47')]){_0x3b9dd1['include']=[{'all':!![]}];}_0x3b9dd1=_['merge']({},_0x3b9dd1,_0x6e227[_0x6fff('0x48')]);return db[_0x6fff('0x2f')]['find'](_0x3b9dd1)[_0x6fff('0x28')](handleEntityNotFound(_0x5075dd,null))[_0x6fff('0x28')](respondWithResult(_0x5075dd,null))['catch'](handleError(_0x5075dd,null));};exports['update']=function(_0x4d7fba,_0x3efd88){if(_0x4d7fba[_0x6fff('0x49')]['id']){delete _0x4d7fba['body']['id'];}return db[_0x6fff('0x2f')][_0x6fff('0x4a')]({'where':{'id':_0x4d7fba[_0x6fff('0x4b')]['id']}})[_0x6fff('0x28')](handleEntityNotFound(_0x3efd88,null))[_0x6fff('0x28')](saveUpdates(_0x4d7fba['body'],null))['then'](respondWithResult(_0x3efd88,null))[_0x6fff('0x4c')](handleError(_0x3efd88,null));};exports['destroy']=function(_0x5bda13,_0x483b9){return db[_0x6fff('0x2f')]['find']({'where':{'id':_0x5bda13[_0x6fff('0x4b')]['id']}})['then'](handleEntityNotFound(_0x483b9,null))[_0x6fff('0x28')](removeEntity(_0x483b9,null))[_0x6fff('0x4c')](handleError(_0x483b9,null));};exports[_0x6fff('0x4d')]=function(_0x2b708d,_0x4bc07a){return db['MailMessage'][_0x6fff('0x4d')]()[_0x6fff('0x28')](respondWithResult(_0x4bc07a,null))[_0x6fff('0x4c')](handleError(_0x4bc07a,null));};exports[_0x6fff('0x4e')]=function(_0x3ac26f,_0x40cde9){return db['MailMessage'][_0x6fff('0x4e')](_0x3ac26f[_0x6fff('0x49')])['then'](function(_0x338435){if(_0x338435){if(_0x338435[_0x6fff('0x4f')]===_0x6fff('0x50')&&!_0x338435['secret']){var _0x3bd4b5,_0x1bf83f,_0x4eb921;if(_0x3ac26f[_0x6fff('0x49')]['to']){_0x1bf83f=_0x3ac26f['body']['to'][_0x6fff('0x51')](',')[0x0];}return db[_0x6fff('0x52')]['findOne']({'where':{'id':_0x338435[_0x6fff('0x53')]},'include':[{'model':db[_0x6fff('0x54')],'as':'List','include':[{'model':db[_0x6fff('0x55')],'as':_0x6fff('0x56'),'where':{'email':_0x1bf83f},'limit':0x1,'order':[[_0x6fff('0x57'),_0x6fff('0x58')]]}]},{'model':db['MailServerOut'],'as':_0x6fff('0x59'),'raw':!![]}]})['then'](function(_0x197ab8){_0x3bd4b5=_0x197ab8;if(_0x3bd4b5&&_0x3bd4b5[_0x6fff('0x59')]){var _0x3c5c6b={'tls':{'rejectUnauthorized':![]}};if(_[_0x6fff('0x5a')](_0x3bd4b5[_0x6fff('0x59')][_0x6fff('0x5b')])){_0x3c5c6b[_0x6fff('0x5c')]=_0x3bd4b5[_0x6fff('0x59')][_0x6fff('0x5c')];_0x3c5c6b[_0x6fff('0x5d')]=_0x3bd4b5[_0x6fff('0x59')][_0x6fff('0x5d')];_0x3c5c6b['secure']=_0x3bd4b5[_0x6fff('0x59')]['secure'];if(_0x3bd4b5[_0x6fff('0x59')]['authentication']){_0x3c5c6b['auth']={'user':_0x3bd4b5[_0x6fff('0x59')]['user'],'pass':_0x3bd4b5[_0x6fff('0x59')]['pass']};}}else{_0x3c5c6b[_0x6fff('0x5b')]=_0x3bd4b5[_0x6fff('0x59')][_0x6fff('0x5b')];_0x3c5c6b[_0x6fff('0x5e')]={'user':_0x3bd4b5['Smtp']['user'],'pass':_0x3bd4b5[_0x6fff('0x59')][_0x6fff('0x5f')]};_0x3c5c6b[_0x6fff('0x60')]=_0x3bd4b5[_0x6fff('0x59')][_0x6fff('0x60')];}if(_0x3ac26f[_0x6fff('0x49')][_0x6fff('0x61')]&&_0x3ac26f['body']['attachments'][_0x6fff('0x39')]){for(var _0x5e0bec=0x0;_0x5e0bec<_0x3ac26f['body']['attachments'][_0x6fff('0x39')];_0x5e0bec+=0x1){_0x3ac26f[_0x6fff('0x49')]['attachments'][_0x5e0bec]={'filename':_0x3ac26f[_0x6fff('0x49')][_0x6fff('0x61')][_0x5e0bec]['name'],'path':path['join'](config[_0x6fff('0x62')],'server/files/attachments',_0x3ac26f[_0x6fff('0x49')][_0x6fff('0x61')][_0x5e0bec][_0x6fff('0x63')])};}}_0x4eb921={'account':_0x3c5c6b,'message':_0x3ac26f['body']};return;}})[_0x6fff('0x28')](function(){if(_0x3bd4b5[_0x6fff('0x64')]){if(_0x3bd4b5[_0x6fff('0x64')]['Contacts'][_0x6fff('0x39')]){return _0x3bd4b5['List'][_0x6fff('0x56')][0x0];}else{return db[_0x6fff('0x55')][_0x6fff('0x4e')](_['defaults'](_0x3ac26f['body'],{'firstName':_0x3ac26f[_0x6fff('0x49')]['to'],'email':_0x3ac26f['body']['to'],'phone':_0x3ac26f[_0x6fff('0x49')]['to'],'ListId':_0x3bd4b5[_0x6fff('0x65')]}));}}else{throw new Error(_0x6fff('0x66'));}})['then'](function(){if(_0x4eb921){return respondWithRpcPromise(_0x6fff('0x67'),'sendMail',_0x4eb921,client9003)['then'](function(_0x2b4d8d){return _0x338435[_0x6fff('0x27')]({'read':!![],'messageId':_0x2b4d8d[_0x6fff('0x68')],'sentAt':moment()[_0x6fff('0x69')](_0x6fff('0x6a'))});})[_0x6fff('0x4c')](function(_0x4da3fe){logger[_0x6fff('0x1e')]('%s',JSON['stringify'](_0x4da3fe));return _0x338435;});}return _0x338435;});}return _0x338435;}})[_0x6fff('0x28')](respondWithResult(_0x40cde9,0xc9))[_0x6fff('0x4c')](handleError(_0x40cde9,null));};exports['accept']=function(_0x526b18,_0x2b80fb){var _0x10419d={'agent':{},'channel':'mail'};if(_0x526b18[_0x6fff('0x49')]['id']){delete _0x526b18['body']['id'];}_0x526b18[_0x6fff('0x49')][_0x6fff('0x6b')]=!![];_0x526b18[_0x6fff('0x49')][_0x6fff('0x6c')]=moment()[_0x6fff('0x69')]('YYYY-MM-DD\x20HH:mm:ss');_0x526b18[_0x6fff('0x49')]['UserId']=_0x526b18[_0x6fff('0x49')][_0x6fff('0x6d')]||_0x526b18[_0x6fff('0x6e')]['id'];_0x10419d[_0x6fff('0x6f')]['id']=_0x526b18['body'][_0x6fff('0x6d')];return db['MailMessage'][_0x6fff('0x4a')]({'where':{'id':_0x526b18[_0x6fff('0x4b')]['id'],'UserId':null}})[_0x6fff('0x28')](handleEntityNotFound(_0x2b80fb,null))['then'](saveUpdates(_0x526b18[_0x6fff('0x49')],null))[_0x6fff('0x28')](function(_0x53c564){if(_0x53c564){_0x10419d[_0x6fff('0x1f')]=_0x53c564[_0x6fff('0x70')]({'plain':!![]});return db[_0x6fff('0x71')]['find']({'where':{'id':_0x53c564[_0x6fff('0x72')]}});}return null;})[_0x6fff('0x28')](handleEntityNotFound(_0x2b80fb,null))[_0x6fff('0x28')](function(_0xe149ef){if(_0xe149ef){return _0xe149ef[_0x6fff('0x27')]({'UserId':_0x526b18['body'][_0x6fff('0x6d')],'read1stAt':_['isNil'](_0xe149ef[_0x6fff('0x73')])?moment()[_0x6fff('0x69')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6fff('0x28')](function(_0xc95a02){if(_0xc95a02){_0x10419d[_0x6fff('0x74')]=_0xc95a02[_0x6fff('0x70')]({'plain':!![]});interaction_log[_0x6fff('0x17')](_0x6fff('0x75'),_0x526b18[_0x6fff('0x6e')]['id'],_0x526b18[_0x6fff('0x6e')][_0x6fff('0x2c')],_0x526b18[_0x6fff('0x6e')]['role'],_0x10419d[_0x6fff('0x74')]['id'],_0x526b18[_0x6fff('0x49')]?JSON['stringify'](_0x526b18[_0x6fff('0x49')]):'null');return respondWithRpcPromise(_0x6fff('0x76'),_0x6fff('0x77'),_0x10419d);}return null;})[_0x6fff('0x28')](function(_0x4837fb){var _0x542f08=_0x6fff('0x78')+_0x4837fb[_0x6fff('0x1f')][_0x6fff('0x79')];return db['sequelize'][_0x6fff('0x33')](_0x542f08,{'type':db['Sequelize'][_0x6fff('0x7a')][_0x6fff('0x7b')],'raw':!![]})[_0x6fff('0x28')](function(_0x5dbf23){return _0x5dbf23;});})[_0x6fff('0x28')](function(_0x162290){if(_0x162290){_0x10419d['message'][_0x6fff('0x7c')]=_0x162290[0x0];if(!_0x526b18[_0x6fff('0x49')][_0x6fff('0x6d')])return;return db[_0x6fff('0x7d')][_0x6fff('0x4a')]({'where':{'id':_0x526b18[_0x6fff('0x49')][_0x6fff('0x6d')],'role':_0x6fff('0x6f')},'attributes':['id',_0x6fff('0x2c'),_0x6fff('0x7e'),'email','internal'],'raw':!![]});}return null;})[_0x6fff('0x28')](function(_0x2497c4){if(!_0x2497c4)return null;_0x10419d[_0x6fff('0x1f')]['agent']=_0x2497c4;return _0x10419d;})[_0x6fff('0x28')](function(_0x19be5a){if(_0x19be5a){if(_0x526b18[_0x6fff('0x49')]['manual']){_0x10419d[_0x6fff('0x1f')][_0x6fff('0x7f')]=util[_0x6fff('0x69')](_0x6fff('0x80'),_0x526b18['user'][_0x6fff('0x2c')]);_0x10419d[_0x6fff('0x1f')][_0x6fff('0x81')]=_0x10419d[_0x6fff('0x81')];_0x10419d[_0x6fff('0x1f')][_0x6fff('0x82')]=_0x10419d['channel'];_0x10419d[_0x6fff('0x1f')][_0x6fff('0x83')]=_0x6fff('0x84');_0x10419d['message'][_0x6fff('0x49')]=htmlToText['fromString'](_0x10419d[_0x6fff('0x1f')][_0x6fff('0x49')]);return respondWithRpcPromise(_0x6fff('0x85'),_0x6fff('0x85'),{'event':_0x6fff('0x86'),'message':_0x10419d[_0x6fff('0x1f')]},client9002)[_0x6fff('0x28')](function(){return _0x10419d;});}return _0x10419d;}return null;})[_0x6fff('0x28')](respondWithResult(_0x2b80fb,null))['catch'](handleError(_0x2b80fb,null));};exports[_0x6fff('0x87')]=function(_0x2b219c,_0x2d14bb){var _0x276365={'agent':{},'channel':_0x6fff('0x88')};if(_0x2b219c[_0x6fff('0x49')]['id']){delete _0x2b219c[_0x6fff('0x49')]['id'];}_0x2b219c['body']['UserId']=_0x2b219c['body']['UserId']||_0x2b219c[_0x6fff('0x6e')]['id'];_0x276365[_0x6fff('0x6f')]['id']=_0x2b219c[_0x6fff('0x49')][_0x6fff('0x6d')];return db['MailMessage'][_0x6fff('0x4a')]({'where':{'id':_0x2b219c['params']['id'],'UserId':null}})[_0x6fff('0x28')](handleEntityNotFound(_0x2d14bb,null))[_0x6fff('0x28')](function(_0x420e2c){if(_0x420e2c){_0x276365[_0x6fff('0x1f')]=_0x420e2c['get']({'plain':!![]});return db[_0x6fff('0x71')][_0x6fff('0x4a')]({'where':{'id':_0x420e2c[_0x6fff('0x72')]}});}return null;})['then'](handleEntityNotFound(_0x2d14bb,null))[_0x6fff('0x28')](function(_0x2a98ce){if(_0x2a98ce){_0x276365[_0x6fff('0x74')]=_0x2a98ce['get']({'plain':!![]});interaction_log[_0x6fff('0x17')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2b219c[_0x6fff('0x6e')]['id'],_0x2b219c[_0x6fff('0x6e')][_0x6fff('0x2c')],_0x2b219c[_0x6fff('0x6e')][_0x6fff('0x89')],_0x276365[_0x6fff('0x74')]['id'],_0x2b219c['body']?JSON[_0x6fff('0x1c')](_0x2b219c[_0x6fff('0x49')]):_0x6fff('0x8a'));return respondWithRpcPromise(_0x6fff('0x8b'),'rejectMessage',_0x276365);}return null;})[_0x6fff('0x28')](function(_0x1b980d){var _0x3e00c8=_0x6fff('0x78')+_0x1b980d[_0x6fff('0x1f')][_0x6fff('0x79')];return db[_0x6fff('0x8c')][_0x6fff('0x33')](_0x3e00c8,{'type':db[_0x6fff('0x8d')][_0x6fff('0x7a')]['SELECT'],'raw':!![]})['then'](function(_0x20b7f3){return _0x20b7f3;});})[_0x6fff('0x28')](function(_0x3c1edd){if(_0x3c1edd){_0x276365[_0x6fff('0x1f')][_0x6fff('0x7c')]=_0x3c1edd[0x0];if(!_0x2b219c[_0x6fff('0x49')][_0x6fff('0x6d')])return;return db[_0x6fff('0x7d')][_0x6fff('0x4a')]({'where':{'id':_0x2b219c['body'][_0x6fff('0x6d')],'role':'agent'},'attributes':['id','name',_0x6fff('0x7e'),'email','internal'],'raw':!![]});}return null;})[_0x6fff('0x28')](function(_0x411d0d){if(!_0x411d0d)return null;_0x276365[_0x6fff('0x1f')][_0x6fff('0x6f')]=_0x411d0d;return _0x276365;})['then'](function(_0x5ca782){if(_0x5ca782){_0x5ca782[_0x6fff('0x1f')][_0x6fff('0x7f')]=util[_0x6fff('0x69')](_0x6fff('0x80'),_0x2b219c[_0x6fff('0x6e')][_0x6fff('0x2c')]);_0x5ca782[_0x6fff('0x1f')][_0x6fff('0x81')]=_0x276365[_0x6fff('0x81')];_0x5ca782[_0x6fff('0x1f')][_0x6fff('0x82')]=_0x276365['channel'];_0x5ca782[_0x6fff('0x1f')][_0x6fff('0x83')]='reject';_0x5ca782['message'][_0x6fff('0x49')]=htmlToText['fromString'](_0x276365['message'][_0x6fff('0x49')]);respondWithRpcPromise(_0x6fff('0x85'),_0x6fff('0x85'),{'event':_0x6fff('0x8e'),'message':_0x5ca782['message']},client9002);return _0x276365;}return null;})[_0x6fff('0x28')](respondWithResult(_0x2d14bb,null))['catch'](handleError(_0x2d14bb,null));};exports['download']=function(_0xaefca,_0x40286e){var _0x286a8f=moment()['unix']()['toString']();var _0x37560b=path[_0x6fff('0x8f')](config[_0x6fff('0x62')],_0x6fff('0x90'),_0x6fff('0x91'),_0x6fff('0x92'));var _0x564a28=path[_0x6fff('0x8f')](config[_0x6fff('0x62')],_0x6fff('0x90'),'files',_0x6fff('0x61'));var _0x353ea9=util['format'](_0x6fff('0x93'),_0x286a8f);return db[_0x6fff('0x2f')][_0x6fff('0x4a')]({'where':{'id':_0xaefca[_0x6fff('0x4b')]['id']},'attributes':['id',_0x6fff('0x49'),_0x6fff('0x94'),'to','cc','bcc',_0x6fff('0x95'),_0x6fff('0x96')],'include':_0xaefca[_0x6fff('0x33')][_0x6fff('0x61')]?[{'model':db[_0x6fff('0x97')],'as':'Attachments'}]:undefined})[_0x6fff('0x28')](handleEntityNotFound(_0x40286e,null))['then'](function(_0x3bd36e){if(_0x3bd36e){var _0x40c31e=_0x3bd36e;var _0x476927={'from':_0x40c31e['from'],'to':_0x40c31e['to'],'subject':_0x40c31e[_0x6fff('0x95')],'html':htmlEntities[_0x6fff('0x98')](_0x40c31e[_0x6fff('0x49')]),'headers':{'Date':moment(_0x40c31e[_0x6fff('0x96')])[_0x6fff('0x69')](_0x6fff('0x99'))},'attachments':[]};if(_0x3bd36e['cc']){_0x476927[_0x6fff('0x9a')]['Cc']=_0x3bd36e['cc'];}if(_0x3bd36e[_0x6fff('0x9b')]){_0x476927['headers'][_0x6fff('0x9c')]=_0x3bd36e[_0x6fff('0x9b')];}return new BPromise(function(_0x5193b8,_0x9e6262){if(_0x3bd36e[_0x6fff('0x9d')]){for(var _0x34af74=0x0;_0x34af74<_0x3bd36e[_0x6fff('0x9d')][_0x6fff('0x39')];_0x34af74++){var _0x38f473=_0x3bd36e[_0x6fff('0x9d')][_0x34af74];var _0x4ce318=path[_0x6fff('0x8f')](_0x564a28,_0x38f473[_0x6fff('0x63')]);if(fs[_0x6fff('0x9e')](_0x4ce318)){_0x476927[_0x6fff('0x61')][_0x6fff('0x9f')]({'name':_0x38f473['name'],'contentType':_0x38f473[_0x6fff('0xa0')],'data':fs['readFileSync'](_0x4ce318)});}}}emlformat[_0x6fff('0xa1')](_0x476927,function(_0xfe98cc,_0x46aab5){if(_0xfe98cc)return _0x9e6262(_0xfe98cc);fs['writeFileSync'](path['join'](_0x37560b,_0x353ea9),_0x46aab5);return _0x5193b8(_0x46aab5);});});}})['then'](function(_0x13ee00){if(_0x13ee00){return _0x40286e[_0x6fff('0xa2')](path['join'](_0x37560b,_0x353ea9),_0x353ea9,function(_0x3f1f4f){if(!_0x3f1f4f)fs['unlinkSync'](path[_0x6fff('0x8f')](_0x37560b,_0x353ea9));});}})[_0x6fff('0x4c')](handleError(_0x40286e,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 112ca9b..a3706af 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 _0x980a=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x980a,0x1bf));var _0xa980=function(_0x9883be,_0x3fd960){_0x9883be=_0x9883be-0x0;var _0x322f0d=_0x980a[_0x9883be];return _0x322f0d;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xa980('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xa980('0x1')](0x0);var events={'afterCreate':_0xa980('0x2'),'afterUpdate':'update','afterDestroy':_0xa980('0x3')};function emitEvent(_0x4c93b2){return function(_0xc22bf7,_0x520c9e,_0x2420eb){MailMessageEvents[_0xa980('0x4')](_0x4c93b2+':'+_0xc22bf7['id'],_0xc22bf7);MailMessageEvents[_0xa980('0x4')](_0x4c93b2,_0xc22bf7);_0x2420eb(null);};}for(var e in events){if(events[_0xa980('0x5')](e)){var event=events[e];MailMessage[_0xa980('0x6')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x9b70=['remove','emit','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x5027b1,_0x6c2346){var _0x5ef581=function(_0xb14398){while(--_0xb14398){_0x5027b1['push'](_0x5027b1['shift']());}};_0x5ef581(++_0x6c2346);}(_0x9b70,0xf2));var _0x09b7=function(_0x493370,_0x4c7fac){_0x493370=_0x493370-0x0;var _0xac15d=_0x9b70[_0x493370];return _0xac15d;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x09b7('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x09b7('0x1')](0x0);var events={'afterCreate':_0x09b7('0x2'),'afterUpdate':'update','afterDestroy':_0x09b7('0x3')};function emitEvent(_0x1b2c05){return function(_0x57fd5f,_0x455670,_0x299ff9){MailMessageEvents[_0x09b7('0x4')](_0x1b2c05+':'+_0x57fd5f['id'],_0x57fd5f);MailMessageEvents[_0x09b7('0x4')](_0x1b2c05,_0x57fd5f);_0x299ff9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x09b7('0x5')](e,emitEvent(event));}}module[_0x09b7('0x6')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index ad00db0..65bbbc0 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 _0xd93f=['moment','request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','body','fromString','get','direction','toLowerCase','secret','MailInteraction','findOne','then','update','createdAt','catch','utf8mb4','../../config/logger','api'];(function(_0x4fb078,_0x4f0e49){var _0x3d6fd1=function(_0x2f682d){while(--_0x2f682d){_0x4fb078['push'](_0x4fb078['shift']());}};_0x3d6fd1(++_0x4f0e49);}(_0xd93f,0x132));var _0xfd93=function(_0x285680,_0x18ce0e){_0x285680=_0x285680-0x0;var _0x4140ae=_0xd93f[_0x285680];return _0x4140ae;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfd93('0x0'))(_0xfd93('0x1'));var moment=require(_0xfd93('0x2'));var BPromise=require('bluebird');var rp=require(_0xfd93('0x3'));var htmlToText=require(_0xfd93('0x4'));var fs=require('fs');var path=require(_0xfd93('0x5'));var rimraf=require('rimraf');var config=require(_0xfd93('0x6'));var attributes=require(_0xfd93('0x7'));module[_0xfd93('0x8')]=function(_0x18006a,_0xa22ce3){return _0x18006a[_0xfd93('0x9')](_0xfd93('0xa'),attributes,{'tableName':_0xfd93('0xb'),'paranoid':![],'indexes':[{'name':_0xfd93('0xc'),'fields':[_0xfd93('0xc')]},{'name':_0xfd93('0xd'),'fields':['plainBody',_0xfd93('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4d7bc8,_0x495bdc,_0x58ace){if(_0x4d7bc8[_0xfd93('0xf')]){_0x4d7bc8['plainBody']=htmlToText[_0xfd93('0x10')](_0x4d7bc8[_0xfd93('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x58ace(null,_0x495bdc);},'afterCreate':function(_0xb29b6d,_0x36484d,_0x6c40d4){var _0x2d0a66=_0x18006a['models'];var _0x1b1a9e=_0xb29b6d[_0xfd93('0x11')]({'plain':!![]});if(_0x1b1a9e[_0xfd93('0x12')][_0xfd93('0x13')]()==='in'||_0x1b1a9e['direction'][_0xfd93('0x13')]()==='out'&&!_0x1b1a9e[_0xfd93('0x14')]&&!_['isNil'](_0x1b1a9e['UserId'])){_0x2d0a66[_0xfd93('0x15')][_0xfd93('0x16')]({'where':{'id':_0x1b1a9e['MailInteractionId']}})[_0xfd93('0x17')](function(_0x2d8d9e){if(_0x2d8d9e){_0x2d8d9e[_0xfd93('0x18')]({'lastMsgAt':_0x1b1a9e[_0xfd93('0x19')],'lastMsgDirection':_0x1b1a9e[_0xfd93('0x12')][_0xfd93('0x13')]()});}})[_0xfd93('0x1a')](function(_0x288686){console['error'](_0x288686);});}_0x6c40d4();}},'charset':_0xfd93('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8eba=['secret','isNil','UserId','MailInteraction','findOne','then','update','toLowerCase','catch','error','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','exports','define','messageId','fti_mail_messages','plainBody','subject','body','fromString','get','direction','out'];(function(_0x3a3509,_0x5defad){var _0x3d7d2d=function(_0x117625){while(--_0x117625){_0x3a3509['push'](_0x3a3509['shift']());}};_0x3d7d2d(++_0x5defad);}(_0x8eba,0x16b));var _0xa8eb=function(_0x4ec9e3,_0x15fbf4){_0x4ec9e3=_0x4ec9e3-0x0;var _0x2883ce=_0x8eba[_0x4ec9e3];return _0x2883ce;};'use strict';var _=require('lodash');var util=require(_0xa8eb('0x0'));var logger=require(_0xa8eb('0x1'))(_0xa8eb('0x2'));var moment=require(_0xa8eb('0x3'));var BPromise=require(_0xa8eb('0x4'));var rp=require(_0xa8eb('0x5'));var htmlToText=require(_0xa8eb('0x6'));var fs=require('fs');var path=require(_0xa8eb('0x7'));var rimraf=require('rimraf');var config=require(_0xa8eb('0x8'));var attributes=require(_0xa8eb('0x9'));module[_0xa8eb('0xa')]=function(_0x296e83,_0xa5ecac){return _0x296e83[_0xa8eb('0xb')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xa8eb('0xc'),'fields':['messageId']},{'name':_0xa8eb('0xd'),'fields':[_0xa8eb('0xe'),_0xa8eb('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3fdd43,_0x505b09,_0x4a809d){if(_0x3fdd43[_0xa8eb('0x10')]){_0x3fdd43[_0xa8eb('0xe')]=htmlToText[_0xa8eb('0x11')](_0x3fdd43[_0xa8eb('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4a809d(null,_0x505b09);},'afterCreate':function(_0x25c2e6,_0x4e3260,_0x38094d){var _0x5442fd=_0x296e83['models'];var _0x280f69=_0x25c2e6[_0xa8eb('0x12')]({'plain':!![]});if(_0x280f69[_0xa8eb('0x13')]['toLowerCase']()==='in'||_0x280f69[_0xa8eb('0x13')]['toLowerCase']()===_0xa8eb('0x14')&&!_0x280f69[_0xa8eb('0x15')]&&!_[_0xa8eb('0x16')](_0x280f69[_0xa8eb('0x17')])){_0x5442fd[_0xa8eb('0x18')][_0xa8eb('0x19')]({'where':{'id':_0x280f69['MailInteractionId']}})[_0xa8eb('0x1a')](function(_0x2ebb94){if(_0x2ebb94){_0x2ebb94[_0xa8eb('0x1b')]({'lastMsgAt':_0x280f69['createdAt'],'lastMsgDirection':_0x280f69[_0xa8eb('0x13')][_0xa8eb('0x1c')]()});}})[_0xa8eb('0x1d')](function(_0x66ca41){console[_0xa8eb('0x1e')](_0x66ca41);});}_0x38094d();}},'charset':_0xa8eb('0x1f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index d9d1be7..4e712b4 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 _0x77e6=['catch','CreateMailMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','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','message','result'];(function(_0x17cca1,_0x4cd1f6){var _0x2a1d4a=function(_0x33c8a1){while(--_0x33c8a1){_0x17cca1['push'](_0x17cca1['shift']());}};_0x2a1d4a(++_0x4cd1f6);}(_0x77e6,0x1a6));var _0x677e=function(_0x3006aa,_0x3be1ef){_0x3006aa=_0x3006aa-0x0;var _0x42897d=_0x77e6[_0x3006aa];return _0x42897d;};'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});config[_0x677e('0xb')]=_['defaults'](config['redis'],{'host':_0x677e('0xc'),'port':0x18eb});var socket=require(_0x677e('0xd'))(new Redis(config[_0x677e('0xb')]));require(_0x677e('0xe'))['register'](socket);function respondWithRpcPromise(_0x206305,_0x5bf52d,_0x3cdbe3){return new BPromise(function(_0x227084,_0x1e4fd9){return client[_0x677e('0xf')](_0x206305,_0x3cdbe3)[_0x677e('0x10')](function(_0x49ca35){logger[_0x677e('0x11')](_0x677e('0x12'),_0x5bf52d,_0x677e('0x13'));logger[_0x677e('0x14')](_0x677e('0x15'),_0x5bf52d,_0x677e('0x13'),JSON[_0x677e('0x16')](_0x49ca35));if(_0x49ca35[_0x677e('0x17')]){if(_0x49ca35['error']['code']===0x1f4){logger['error'](_0x677e('0x12'),_0x5bf52d,_0x49ca35[_0x677e('0x17')][_0x677e('0x18')]);return _0x1e4fd9(_0x49ca35[_0x677e('0x17')][_0x677e('0x18')]);}logger[_0x677e('0x17')](_0x677e('0x12'),_0x5bf52d,_0x49ca35[_0x677e('0x17')][_0x677e('0x18')]);return _0x227084(_0x49ca35[_0x677e('0x17')][_0x677e('0x18')]);}else{logger[_0x677e('0x11')]('MailMessage,\x20%s,\x20%s',_0x5bf52d,_0x677e('0x13'));_0x227084(_0x49ca35[_0x677e('0x19')][_0x677e('0x18')]);}})[_0x677e('0x1a')](function(_0xba1c26){logger[_0x677e('0x17')]('MailMessage,\x20%s,\x20%s',_0x5bf52d,_0xba1c26);_0x1e4fd9(_0xba1c26);});});}exports[_0x677e('0x1b')]=function(_0x4bfbb6){var _0x18424e=this;return new Promise(function(_0x267aac,_0x26e9c5){return db['MailMessage'][_0x677e('0x1c')](_0x4bfbb6[_0x677e('0x1d')],{'raw':_0x4bfbb6[_0x677e('0x1e')]?_0x4bfbb6[_0x677e('0x1e')][_0x677e('0x1f')]===undefined?!![]:![]:!![]})[_0x677e('0x10')](function(_0x3a7895){logger['info']('CreateMailMessage',_0x4bfbb6);logger['debug'](_0x677e('0x1b'),_0x4bfbb6,JSON[_0x677e('0x16')](_0x3a7895));_0x267aac(_0x3a7895);})[_0x677e('0x1a')](function(_0x540d0e){logger[_0x677e('0x17')](_0x677e('0x1b'),_0x540d0e[_0x677e('0x18')],_0x4bfbb6);_0x26e9c5(_0x18424e[_0x677e('0x17')](0x1f4,_0x540d0e[_0x677e('0x18')]));});});}; \ No newline at end of file +var _0xed3c=['request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateMailMessage','MailMessage','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','localhost','register'];(function(_0x258381,_0x174a4b){var _0x508dc1=function(_0x261b5b){while(--_0x261b5b){_0x258381['push'](_0x258381['shift']());}};_0x508dc1(++_0x174a4b);}(_0xed3c,0x1a6));var _0xced3=function(_0x5f1617,_0x46277b){_0x5f1617=_0x5f1617-0x0;var _0x3af5da=_0xed3c[_0x5f1617];return _0x3af5da;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var moment=require(_0xced3('0x2'));var BPromise=require(_0xced3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xced3('0x4'));var db=require(_0xced3('0x5'))['db'];var utils=require(_0xced3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xced3('0x7'));var jayson=require(_0xced3('0x8'));var client=jayson[_0xced3('0x9')][_0xced3('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xced3('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailMessage.socket')[_0xced3('0xc')](socket);function respondWithRpcPromise(_0x321c42,_0x3e5a04,_0x12612f){return new BPromise(function(_0x1cb639,_0x5934b2){return client[_0xced3('0xd')](_0x321c42,_0x12612f)[_0xced3('0xe')](function(_0x3da0ff){logger['info'](_0xced3('0xf'),_0x3e5a04,_0xced3('0x10'));logger[_0xced3('0x11')](_0xced3('0x12'),_0x3e5a04,_0xced3('0x10'),JSON[_0xced3('0x13')](_0x3da0ff));if(_0x3da0ff[_0xced3('0x14')]){if(_0x3da0ff['error'][_0xced3('0x15')]===0x1f4){logger['error'](_0xced3('0xf'),_0x3e5a04,_0x3da0ff[_0xced3('0x14')][_0xced3('0x16')]);return _0x5934b2(_0x3da0ff[_0xced3('0x14')]['message']);}logger[_0xced3('0x14')](_0xced3('0xf'),_0x3e5a04,_0x3da0ff['error'][_0xced3('0x16')]);return _0x1cb639(_0x3da0ff[_0xced3('0x14')][_0xced3('0x16')]);}else{logger[_0xced3('0x17')]('MailMessage,\x20%s,\x20%s',_0x3e5a04,_0xced3('0x10'));_0x1cb639(_0x3da0ff['result'][_0xced3('0x16')]);}})[_0xced3('0x18')](function(_0x32c402){logger[_0xced3('0x14')](_0xced3('0xf'),_0x3e5a04,_0x32c402);_0x5934b2(_0x32c402);});});}exports[_0xced3('0x19')]=function(_0xe0cf2e){var _0x16d30d=this;return new Promise(function(_0x3f688c,_0x17c011){return db[_0xced3('0x1a')]['create'](_0xe0cf2e['body'],{'raw':_0xe0cf2e['options']?_0xe0cf2e[_0xced3('0x1b')][_0xced3('0x1c')]===undefined?!![]:![]:!![]})[_0xced3('0xe')](function(_0x4bf915){logger[_0xced3('0x17')](_0xced3('0x19'),_0xe0cf2e);logger['debug']('CreateMailMessage',_0xe0cf2e,JSON[_0xced3('0x13')](_0x4bf915));_0x3f688c(_0x4bf915);})[_0xced3('0x18')](function(_0x219fa8){logger[_0xced3('0x14')]('CreateMailMessage',_0x219fa8[_0xced3('0x16')],_0xe0cf2e);_0x17c011(_0x16d30d[_0xced3('0x14')](0x1f4,_0x219fa8['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 3c7a93f..942db37 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 _0xfb45=['mailMessage:','./mailMessage.events','save','remove','emit','removeListener'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfb45,0x115));var _0x5fb4=function(_0x577b6e,_0x3686c2){_0x577b6e=_0x577b6e-0x0;var _0x336620=_0xfb45[_0x577b6e];return _0x336620;};'use strict';var MailMessageEvents=require(_0x5fb4('0x0'));var events=[_0x5fb4('0x1'),_0x5fb4('0x2'),'update'];function createListener(_0x4ce203,_0x2c4135){return function(_0x20d63f){_0x2c4135[_0x5fb4('0x3')](_0x4ce203,_0x20d63f);};}function removeListener(_0x214116,_0x578f61){return function(){MailMessageEvents[_0x5fb4('0x4')](_0x214116,_0x578f61);};}exports['register']=function(_0x19d18d){for(var _0x3f7256=0x0,_0x434405=events['length'];_0x3f7256<_0x434405;_0x3f7256++){var _0x5badcd=events[_0x3f7256];var _0xca3fcd=createListener(_0x5fb4('0x5')+_0x5badcd,_0x19d18d);MailMessageEvents['on'](_0x5badcd,_0xca3fcd);}}; \ No newline at end of file +var _0x0587=['update','emit','removeListener','register','length','mailMessage:','./mailMessage.events','save','remove'];(function(_0x17c531,_0x2dd4ed){var _0x3a9d6c=function(_0x18f5b0){while(--_0x18f5b0){_0x17c531['push'](_0x17c531['shift']());}};_0x3a9d6c(++_0x2dd4ed);}(_0x0587,0x11d));var _0x7058=function(_0x16a967,_0x2d6c86){_0x16a967=_0x16a967-0x0;var _0x523bc5=_0x0587[_0x16a967];return _0x523bc5;};'use strict';var MailMessageEvents=require(_0x7058('0x0'));var events=[_0x7058('0x1'),_0x7058('0x2'),_0x7058('0x3')];function createListener(_0x321979,_0x270cb3){return function(_0x55b5a3){_0x270cb3[_0x7058('0x4')](_0x321979,_0x55b5a3);};}function removeListener(_0x14cc3d,_0x14fd16){return function(){MailMessageEvents[_0x7058('0x5')](_0x14cc3d,_0x14fd16);};}exports[_0x7058('0x6')]=function(_0x1acc16){for(var _0x2c0060=0x0,_0x273cd4=events[_0x7058('0x7')];_0x2c0060<_0x273cd4;_0x2c0060++){var _0xd07fbc=events[_0x2c0060];var _0x2e4590=createListener(_0x7058('0x8')+_0xd07fbc,_0x1acc16);MailMessageEvents['on'](_0xd07fbc,_0x2e4590);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 34c5e2a..c6ed6a9 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 _0x8a7b=['delete','/:id/teams','removeTeams','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','./mailQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','put','update'];(function(_0x57ce63,_0x24d76b){var _0x374a82=function(_0x5605c4){while(--_0x5605c4){_0x57ce63['push'](_0x57ce63['shift']());}};_0x374a82(++_0x24d76b);}(_0x8a7b,0x139));var _0xb8a7=function(_0x1d2b66,_0x256c6e){_0x1d2b66=_0x1d2b66-0x0;var _0x445a66=_0x8a7b[_0x1d2b66];return _0x445a66;};'use strict';var multer=require(_0xb8a7('0x0'));var util=require(_0xb8a7('0x1'));var path=require(_0xb8a7('0x2'));var timeout=require('connect-timeout');var express=require(_0xb8a7('0x3'));var router=express['Router']();var fs_extra=require(_0xb8a7('0x4'));var auth=require(_0xb8a7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb8a7('0x6'));router[_0xb8a7('0x7')]('/',auth['isAuthenticated'](),controller[_0xb8a7('0x8')]);router['get'](_0xb8a7('0x9'),auth[_0xb8a7('0xa')](),controller[_0xb8a7('0xb')]);router[_0xb8a7('0x7')](_0xb8a7('0xc'),auth[_0xb8a7('0xa')](),controller['show']);router[_0xb8a7('0x7')](_0xb8a7('0xd'),auth['isAuthenticated'](),controller[_0xb8a7('0xe')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0xb8a7('0xf')]);router[_0xb8a7('0x7')](_0xb8a7('0x10'),auth['isAuthenticated'](),controller[_0xb8a7('0x11')]);router[_0xb8a7('0x12')]('/',auth[_0xb8a7('0xa')](),controller[_0xb8a7('0x13')]);router[_0xb8a7('0x12')]('/:id/teams',auth['isAuthenticated'](),controller[_0xb8a7('0x14')]);router[_0xb8a7('0x12')](_0xb8a7('0x10'),auth[_0xb8a7('0xa')](),controller['addAgents']);router[_0xb8a7('0x15')](_0xb8a7('0xc'),auth[_0xb8a7('0xa')](),controller[_0xb8a7('0x16')]);router[_0xb8a7('0x17')](_0xb8a7('0xc'),auth[_0xb8a7('0xa')](),controller['destroy']);router['delete'](_0xb8a7('0x18'),auth['isAuthenticated'](),controller[_0xb8a7('0x19')]);router[_0xb8a7('0x17')](_0xb8a7('0x10'),auth['isAuthenticated'](),controller[_0xb8a7('0x1a')]);module[_0xb8a7('0x1b')]=router; \ No newline at end of file +var _0x8606=['getAgents','create','post','addTeams','addAgents','put','update','destroy','delete','exports','multer','util','path','connect-timeout','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8606,0x128));var _0x6860=function(_0x4beb7a,_0x246983){_0x4beb7a=_0x4beb7a-0x0;var _0x50c7dd=_0x8606[_0x4beb7a];return _0x50c7dd;};'use strict';var multer=require(_0x6860('0x0'));var util=require(_0x6860('0x1'));var path=require(_0x6860('0x2'));var timeout=require(_0x6860('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6860('0x4'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router[_0x6860('0x5')]('/',auth['isAuthenticated'](),controller[_0x6860('0x6')]);router[_0x6860('0x5')](_0x6860('0x7'),auth[_0x6860('0x8')](),controller[_0x6860('0x9')]);router[_0x6860('0x5')](_0x6860('0xa'),auth[_0x6860('0x8')](),controller[_0x6860('0xb')]);router[_0x6860('0x5')]('/:id/members',auth['isAuthenticated'](),controller[_0x6860('0xc')]);router[_0x6860('0x5')](_0x6860('0xd'),auth['isAuthenticated'](),controller[_0x6860('0xe')]);router[_0x6860('0x5')](_0x6860('0xf'),auth[_0x6860('0x8')](),controller[_0x6860('0x10')]);router['post']('/',auth[_0x6860('0x8')](),controller[_0x6860('0x11')]);router[_0x6860('0x12')]('/:id/teams',auth[_0x6860('0x8')](),controller[_0x6860('0x13')]);router[_0x6860('0x12')]('/:id/users',auth[_0x6860('0x8')](),controller[_0x6860('0x14')]);router[_0x6860('0x15')](_0x6860('0xa'),auth[_0x6860('0x8')](),controller[_0x6860('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6860('0x17')]);router['delete']('/:id/teams',auth[_0x6860('0x8')](),controller['removeTeams']);router[_0x6860('0x18')]('/:id/users',auth[_0x6860('0x8')](),controller['removeAgents']);module[_0x6860('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index fe14877..cd33ea5 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 _0xcbaf=['rrmemory','beepall','roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM'];(function(_0x29f7a2,_0x21f742){var _0x5e8993=function(_0x635bb4){while(--_0x635bb4){_0x29f7a2['push'](_0x29f7a2['shift']());}};_0x5e8993(++_0x21f742);}(_0xcbaf,0x162));var _0xfcba=function(_0x269738,_0x2deacc){_0x269738=_0x269738-0x0;var _0x1fc97d=_0xcbaf[_0x269738];return _0x1fc97d;};'use strict';var Sequelize=require(_0xfcba('0x0'));module[_0xfcba('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfcba('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfcba('0x3')]},'timeout':{'type':Sequelize[_0xfcba('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfcba('0x5')](_0xfcba('0x6'),_0xfcba('0x7'),_0xfcba('0x8'))}}; \ No newline at end of file +var _0x2a8e=['rrmemory','beepall','sequelize','STRING','ENUM'];(function(_0x148719,_0x524293){var _0x1d5f74=function(_0x472b9b){while(--_0x472b9b){_0x148719['push'](_0x148719['shift']());}};_0x1d5f74(++_0x524293);}(_0x2a8e,0xbb));var _0xe2a8=function(_0x551c48,_0x320cfd){_0x551c48=_0x551c48-0x0;var _0x5dc9a1=_0x2a8e[_0x551c48];return _0x5dc9a1;};'use strict';var Sequelize=require(_0xe2a8('0x0'));module['exports']={'name':{'type':Sequelize[_0xe2a8('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe2a8('0x2')](_0xe2a8('0x3'),_0xe2a8('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 25b9a95..af3bb8d 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 _0x8a9d=['length','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','hasOwnProperty','MailQueueId','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','SIP','getTeams','findOne','Team','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','status','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','MailQueues','UserProfileResource','end','sendStatus','error','stack','name','send','MailQueue','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields'];(function(_0x33d4a2,_0x2baaf4){var _0x2c793f=function(_0x414303){while(--_0x414303){_0x33d4a2['push'](_0x33d4a2['shift']());}};_0x2c793f(++_0x2baaf4);}(_0x8a9d,0x1ed));var _0xd8a9=function(_0x110d59,_0x50c4fb){_0x110d59=_0x110d59-0x0;var _0x2fce64=_0x8a9d[_0x110d59];return _0x2fce64;};'use strict';var emlformat=require(_0xd8a9('0x0'));var rimraf=require(_0xd8a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd8a9('0x2'));var rp=require(_0xd8a9('0x3'));var moment=require('moment');var BPromise=require(_0xd8a9('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd8a9('0x5'));var sox=require(_0xd8a9('0x6'));var csv=require(_0xd8a9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd8a9('0x8'));var _=require(_0xd8a9('0x9'));var squel=require(_0xd8a9('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd8a9('0xb'));var toCsv=require(_0xd8a9('0x7'));var querystring=require('querystring');var Papa=require(_0xd8a9('0xc'));var Redis=require(_0xd8a9('0xd'));var authService=require(_0xd8a9('0xe'));var qs=require(_0xd8a9('0xf'));var as=require(_0xd8a9('0x10'));var hardwareService=require(_0xd8a9('0x11'));var logger=require(_0xd8a9('0x12'))(_0xd8a9('0x13'));var utils=require(_0xd8a9('0x14'));var config=require(_0xd8a9('0x15'));var licenseUtil=require(_0xd8a9('0x16'));var db=require(_0xd8a9('0x17'))['db'];config[_0xd8a9('0x18')]=_[_0xd8a9('0x19')](config[_0xd8a9('0x18')],{'host':_0xd8a9('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd8a9('0x18')]));require('./mailQueue.socket')[_0xd8a9('0x1b')](socket);function respondWithStatusCode(_0x34a7ee,_0x33cec4){_0x33cec4=_0x33cec4||0xcc;return function(_0x5c1a5e){if(_0x5c1a5e){return _0x34a7ee['sendStatus'](_0x33cec4);}return _0x34a7ee[_0xd8a9('0x1c')](_0x33cec4)['end']();};}function respondWithResult(_0x1db97b,_0x379eb0){_0x379eb0=_0x379eb0||0xc8;return function(_0x369c56){if(_0x369c56){return _0x1db97b[_0xd8a9('0x1c')](_0x379eb0)['json'](_0x369c56);}};}function respondWithFilteredResult(_0x34ce6a,_0x230092){return function(_0x359e9f){if(_0x359e9f){var _0x486e61=typeof _0x230092[_0xd8a9('0x1d')]===_0xd8a9('0x1e')&&typeof _0x230092[_0xd8a9('0x1f')]===_0xd8a9('0x1e');var _0x3c597b=_0x359e9f[_0xd8a9('0x20')];var _0x37c2b5=_0x486e61?0x0:_0x230092[_0xd8a9('0x1d')];var _0x3a8a3d=_0x486e61?_0x359e9f[_0xd8a9('0x20')]:_0x230092['offset']+_0x230092[_0xd8a9('0x1f')];var _0x427feb;if(_0x3a8a3d>=_0x3c597b){_0x3a8a3d=_0x3c597b;_0x427feb=0xc8;}else{_0x427feb=0xce;}_0x34ce6a[_0xd8a9('0x1c')](_0x427feb);return _0x34ce6a[_0xd8a9('0x21')](_0xd8a9('0x22'),_0x37c2b5+'-'+_0x3a8a3d+'/'+_0x3c597b)['json'](_0x359e9f);}return null;};}function patchUpdates(_0xff2b6e){return function(_0x385663){try{jsonpatch[_0xd8a9('0x23')](_0x385663,_0xff2b6e,!![]);}catch(_0x3bb258){return BPromise['reject'](_0x3bb258);}return _0x385663['save']();};}function saveUpdates(_0x4ae351,_0x5ddb32){return function(_0x2b487b){if(_0x2b487b){return _0x2b487b[_0xd8a9('0x24')](_0x4ae351)[_0xd8a9('0x25')](function(_0x1e62ef){return _0x1e62ef;});}return null;};}function removeEntity(_0x442c96,_0x1de15d){return function(_0xf7237){if(_0xf7237){return _0xf7237[_0xd8a9('0x26')]()[_0xd8a9('0x25')](function(){var _0x598457=_0xf7237['get']({'plain':!![]});var _0x131437=_0xd8a9('0x27');return db[_0xd8a9('0x28')]['destroy']({'where':{'type':_0x131437,'resourceId':_0x598457['id']}})[_0xd8a9('0x25')](function(){return _0xf7237;});})[_0xd8a9('0x25')](function(){_0x442c96[_0xd8a9('0x1c')](0xcc)[_0xd8a9('0x29')]();});}};}function handleEntityNotFound(_0x1bb98f,_0x3563e2){return function(_0x52ea4d){if(!_0x52ea4d){_0x1bb98f[_0xd8a9('0x2a')](0x194);}return _0x52ea4d;};}function handleError(_0x51fa43,_0x262d54){_0x262d54=_0x262d54||0x1f4;return function(_0x34dab0){logger[_0xd8a9('0x2b')](_0x34dab0[_0xd8a9('0x2c')]);if(_0x34dab0[_0xd8a9('0x2d')]){delete _0x34dab0[_0xd8a9('0x2d')];}_0x51fa43[_0xd8a9('0x1c')](_0x262d54)[_0xd8a9('0x2e')](_0x34dab0);};}exports['index']=function(_0x3417db,_0x515bf2){var _0x4f2bc6={},_0x2b459c={},_0x44ed53={'count':0x0,'rows':[]};var _0x1d2286=_['map'](db[_0xd8a9('0x2f')][_0xd8a9('0x30')],function(_0x14b7e6){return{'name':_0x14b7e6[_0xd8a9('0x31')],'type':_0x14b7e6[_0xd8a9('0x32')]['key']};});_0x2b459c[_0xd8a9('0x33')]=_[_0xd8a9('0x34')](_0x1d2286,'name');_0x2b459c[_0xd8a9('0x35')]=_[_0xd8a9('0x36')](_0x3417db[_0xd8a9('0x35')]);_0x2b459c[_0xd8a9('0x37')]=_[_0xd8a9('0x38')](_0x2b459c[_0xd8a9('0x33')],_0x2b459c[_0xd8a9('0x35')]);_0x4f2bc6[_0xd8a9('0x39')]=_[_0xd8a9('0x38')](_0x2b459c[_0xd8a9('0x33')],qs['fields'](_0x3417db[_0xd8a9('0x35')][_0xd8a9('0x3a')]));_0x4f2bc6['attributes']=_0x4f2bc6[_0xd8a9('0x39')][_0xd8a9('0x3b')]?_0x4f2bc6[_0xd8a9('0x39')]:_0x2b459c[_0xd8a9('0x33')];if(!_0x3417db['query']['hasOwnProperty'](_0xd8a9('0x3c'))){_0x4f2bc6[_0xd8a9('0x1f')]=qs[_0xd8a9('0x1f')](_0x3417db[_0xd8a9('0x35')][_0xd8a9('0x1f')]);_0x4f2bc6[_0xd8a9('0x1d')]=qs[_0xd8a9('0x1d')](_0x3417db[_0xd8a9('0x35')]['offset']);}_0x4f2bc6[_0xd8a9('0x3d')]=qs[_0xd8a9('0x3e')](_0x3417db['query'][_0xd8a9('0x3e')]);_0x4f2bc6[_0xd8a9('0x3f')]=qs[_0xd8a9('0x37')](_[_0xd8a9('0x40')](_0x3417db[_0xd8a9('0x35')],_0x2b459c[_0xd8a9('0x37')]),_0x1d2286);if(_0x3417db['query'][_0xd8a9('0x41')]){_0x4f2bc6[_0xd8a9('0x3f')]=_[_0xd8a9('0x42')](_0x4f2bc6['where'],{'$or':_[_0xd8a9('0x34')](_0x1d2286,function(_0x238401){if(_0x238401[_0xd8a9('0x32')]!=='VIRTUAL'){var _0x6fe4a6={};_0x6fe4a6[_0x238401[_0xd8a9('0x2d')]]={'$like':'%'+_0x3417db['query']['filter']+'%'};return _0x6fe4a6;}})});}_0x4f2bc6=_[_0xd8a9('0x42')]({},_0x4f2bc6,_0x3417db[_0xd8a9('0x43')]);var _0x704fc={'where':_0x4f2bc6['where']};return db[_0xd8a9('0x2f')]['count'](_0x704fc)['then'](function(_0x5e3076){_0x44ed53['count']=_0x5e3076;if(_0x3417db['query']['includeAll']){_0x4f2bc6[_0xd8a9('0x44')]=[{'all':!![]}];}return db['MailQueue'][_0xd8a9('0x45')](_0x4f2bc6);})[_0xd8a9('0x25')](function(_0x36c43f){_0x44ed53[_0xd8a9('0x46')]=_0x36c43f;return _0x44ed53;})['then'](respondWithFilteredResult(_0x515bf2,_0x4f2bc6))[_0xd8a9('0x47')](handleError(_0x515bf2,null));};exports['show']=function(_0x464104,_0x335abf){var _0x19cc72={'raw':!![],'where':{'id':_0x464104[_0xd8a9('0x48')]['id']}},_0x242420={};_0x242420[_0xd8a9('0x33')]=_[_0xd8a9('0x36')](db[_0xd8a9('0x2f')]['rawAttributes']);_0x242420['query']=_[_0xd8a9('0x36')](_0x464104[_0xd8a9('0x35')]);_0x242420[_0xd8a9('0x37')]=_[_0xd8a9('0x38')](_0x242420[_0xd8a9('0x33')],_0x242420[_0xd8a9('0x35')]);_0x19cc72['attributes']=_['intersection'](_0x242420[_0xd8a9('0x33')],qs['fields'](_0x464104[_0xd8a9('0x35')][_0xd8a9('0x3a')]));_0x19cc72[_0xd8a9('0x39')]=_0x19cc72[_0xd8a9('0x39')][_0xd8a9('0x3b')]?_0x19cc72[_0xd8a9('0x39')]:_0x242420[_0xd8a9('0x33')];if(_0x464104[_0xd8a9('0x35')][_0xd8a9('0x49')]){_0x19cc72['include']=[{'all':!![]}];}_0x19cc72=_[_0xd8a9('0x42')]({},_0x19cc72,_0x464104[_0xd8a9('0x43')]);return db[_0xd8a9('0x2f')][_0xd8a9('0x4a')](_0x19cc72)['then'](handleEntityNotFound(_0x335abf,null))[_0xd8a9('0x25')](respondWithResult(_0x335abf,null))['catch'](handleError(_0x335abf,null));};exports[_0xd8a9('0x4b')]=function(_0x48e9f6,_0x1c1f54){return db[_0xd8a9('0x2f')]['create'](_0x48e9f6[_0xd8a9('0x4c')],{})['then'](function(_0x257a7c){var _0x3346a4=_0x48e9f6[_0xd8a9('0x4d')]['get']({'plain':!![]});if(!_0x3346a4)throw new Error(_0xd8a9('0x4e'));if(_0x3346a4[_0xd8a9('0x4f')]===_0xd8a9('0x4d')){var _0x5d228f=_0x257a7c[_0xd8a9('0x50')]({'plain':!![]});var _0x58ae38='MailQueues';return db['UserProfileSection'][_0xd8a9('0x4a')]({'where':{'name':_0x58ae38,'userProfileId':_0x3346a4['userProfileId']},'raw':!![]})[_0xd8a9('0x25')](function(_0x255854){if(_0x255854&&_0x255854[_0xd8a9('0x51')]===0x0){return db[_0xd8a9('0x28')][_0xd8a9('0x4b')]({'name':_0x5d228f[_0xd8a9('0x2d')],'resourceId':_0x5d228f['id'],'type':_0x255854[_0xd8a9('0x2d')],'sectionId':_0x255854['id']},{})[_0xd8a9('0x25')](function(){return _0x257a7c;});}else{return _0x257a7c;}})['catch'](function(_0x2bb19c){logger[_0xd8a9('0x2b')](_0xd8a9('0x52'),_0x2bb19c);throw _0x2bb19c;});}return _0x257a7c;})['then'](respondWithResult(_0x1c1f54,0xc9))[_0xd8a9('0x47')](handleError(_0x1c1f54,null));};exports[_0xd8a9('0x24')]=function(_0x3121e4,_0x5c41ea){if(_0x3121e4[_0xd8a9('0x4c')]['id']){delete _0x3121e4[_0xd8a9('0x4c')]['id'];}return db[_0xd8a9('0x2f')][_0xd8a9('0x4a')]({'where':{'id':_0x3121e4[_0xd8a9('0x48')]['id']}})[_0xd8a9('0x25')](handleEntityNotFound(_0x5c41ea,null))[_0xd8a9('0x25')](saveUpdates(_0x3121e4[_0xd8a9('0x4c')],null))['then'](respondWithResult(_0x5c41ea,null))[_0xd8a9('0x47')](handleError(_0x5c41ea,null));};exports[_0xd8a9('0x26')]=function(_0x15b62c,_0x1f6ce7){return db[_0xd8a9('0x2f')][_0xd8a9('0x4a')]({'where':{'id':_0x15b62c[_0xd8a9('0x48')]['id']}})[_0xd8a9('0x25')](handleEntityNotFound(_0x1f6ce7,null))['then'](removeEntity(_0x1f6ce7,null))[_0xd8a9('0x47')](handleError(_0x1f6ce7,null));};exports[_0xd8a9('0x53')]=function(_0x368491,_0x34b3cf){return db[_0xd8a9('0x2f')][_0xd8a9('0x53')]()['then'](respondWithResult(_0x34b3cf,null))[_0xd8a9('0x47')](handleError(_0x34b3cf,null));};exports[_0xd8a9('0x54')]=function(_0x36b3cd,_0x430923,_0x4f2b4e){var _0x5834cb={'raw':!![],'where':{}},_0x51a1cb={},_0x425805;return db['MailQueue']['findOne']({'where':{'id':_0x36b3cd[_0xd8a9('0x48')]['id']}})[_0xd8a9('0x25')](handleEntityNotFound(_0x430923,null))['then'](function(_0x39402a){if(_0x39402a){_0x425805=_0x39402a[_0xd8a9('0x50')]({'plain':!![]});_0x51a1cb[_0xd8a9('0x33')]=_[_0xd8a9('0x36')](db[_0xd8a9('0x55')][_0xd8a9('0x30')]);_0x51a1cb[_0xd8a9('0x35')]=_[_0xd8a9('0x36')](_0x36b3cd[_0xd8a9('0x35')]);_0x51a1cb['filters']=_[_0xd8a9('0x38')](_0x51a1cb['model'],_0x51a1cb['query']);_0x5834cb[_0xd8a9('0x39')]=_[_0xd8a9('0x38')](_0x51a1cb['model'],qs['fields'](_0x36b3cd[_0xd8a9('0x35')][_0xd8a9('0x3a')]));_0x5834cb[_0xd8a9('0x39')]=_0x5834cb['attributes']['length']?_0x5834cb[_0xd8a9('0x39')]:_0x51a1cb[_0xd8a9('0x33')];if(!_0x36b3cd['query'][_0xd8a9('0x56')]('nolimit')){_0x5834cb[_0xd8a9('0x1f')]=qs['limit'](_0x36b3cd['query'][_0xd8a9('0x1f')]);_0x5834cb[_0xd8a9('0x1d')]=qs[_0xd8a9('0x1d')](_0x36b3cd[_0xd8a9('0x35')][_0xd8a9('0x1d')]);}_0x5834cb[_0xd8a9('0x3d')]=qs[_0xd8a9('0x3e')](_0x36b3cd['query'][_0xd8a9('0x3e')]);_0x5834cb[_0xd8a9('0x3f')]=qs[_0xd8a9('0x37')](_[_0xd8a9('0x40')](_0x36b3cd[_0xd8a9('0x35')],_0x51a1cb['filters']));_0x5834cb[_0xd8a9('0x3f')][_0xd8a9('0x57')]=_0x39402a['id'];if(_0x36b3cd[_0xd8a9('0x35')][_0xd8a9('0x41')]){_0x5834cb[_0xd8a9('0x3f')]=_[_0xd8a9('0x42')](_0x5834cb[_0xd8a9('0x3f')],{'$or':_[_0xd8a9('0x34')](_0x5834cb[_0xd8a9('0x39')],function(_0x295350){var _0x16a483={};_0x16a483[_0x295350]={'$like':'%'+_0x36b3cd[_0xd8a9('0x35')][_0xd8a9('0x41')]+'%'};return _0x16a483;})});}_0x5834cb=_['merge']({},_0x5834cb,_0x36b3cd[_0xd8a9('0x43')]);return db[_0xd8a9('0x55')][_0xd8a9('0x45')](_0x5834cb);}})[_0xd8a9('0x25')](function(_0x3ae62f){if(_0x3ae62f){return db['User'][_0xd8a9('0x58')]({'where':{'id':_['map'](_0x3ae62f,_0xd8a9('0x59')),'role':_0xd8a9('0x5a')},'attributes':['id',_0xd8a9('0x2d'),_0xd8a9('0x5b'),_0xd8a9('0x5c'),_0xd8a9('0x5d')]});}})[_0xd8a9('0x25')](function(_0x5ea5d){if(_0x5ea5d){return{'count':_0x5ea5d['count'],'rows':_[_0xd8a9('0x34')](_0x5ea5d[_0xd8a9('0x46')],function(_0x21a674){return{'membername':_0x21a674['name'],'UserId':_0x21a674['id'],'queue_name':_0x425805[_0xd8a9('0x2d')],'MailQueueId':_0x425805['id'],'interface':util['format']('%s/%s',_0xd8a9('0x5e'),_0x21a674['name']),'penalty':0x0,'paused':_0x21a674['mailPause'],'createdAt':_0x21a674[_0xd8a9('0x5d')],'updatedAt':_0x21a674[_0xd8a9('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x430923,_0x5834cb))['catch'](handleError(_0x430923,null));};exports[_0xd8a9('0x5f')]=function(_0x207fb5,_0x5e08ab,_0x55af45){var _0x30d9db={};var _0x29f55f={};var _0xf24c63;var _0x47d722;return db[_0xd8a9('0x2f')][_0xd8a9('0x60')]({'where':{'id':_0x207fb5[_0xd8a9('0x48')]['id']}})[_0xd8a9('0x25')](handleEntityNotFound(_0x5e08ab,null))['then'](function(_0x32591b){if(_0x32591b){_0xf24c63=_0x32591b;_0x29f55f[_0xd8a9('0x33')]=_[_0xd8a9('0x36')](db[_0xd8a9('0x61')][_0xd8a9('0x30')]);_0x29f55f['query']=_[_0xd8a9('0x36')](_0x207fb5[_0xd8a9('0x35')]);_0x29f55f[_0xd8a9('0x37')]=_[_0xd8a9('0x38')](_0x29f55f[_0xd8a9('0x33')],_0x29f55f[_0xd8a9('0x35')]);_0x30d9db[_0xd8a9('0x39')]=_[_0xd8a9('0x38')](_0x29f55f[_0xd8a9('0x33')],qs['fields'](_0x207fb5[_0xd8a9('0x35')]['fields']));_0x30d9db[_0xd8a9('0x39')]=_0x30d9db[_0xd8a9('0x39')][_0xd8a9('0x3b')]?_0x30d9db[_0xd8a9('0x39')]:_0x29f55f['model'];_0x30d9db[_0xd8a9('0x3d')]=qs[_0xd8a9('0x3e')](_0x207fb5['query'][_0xd8a9('0x3e')]);_0x30d9db[_0xd8a9('0x3f')]=qs[_0xd8a9('0x37')](_[_0xd8a9('0x40')](_0x207fb5['query'],_0x29f55f['filters']));if(_0x207fb5[_0xd8a9('0x35')]['filter']){_0x30d9db['where']=_[_0xd8a9('0x42')](_0x30d9db['where'],{'$or':_['map'](_0x30d9db[_0xd8a9('0x39')],function(_0x218c63){var _0x3d1af8={};_0x3d1af8[_0x218c63]={'$like':'%'+_0x207fb5['query'][_0xd8a9('0x41')]+'%'};return _0x3d1af8;})});}_0x30d9db=_['merge']({},_0x30d9db,_0x207fb5['options']);return _0xf24c63[_0xd8a9('0x5f')](_0x30d9db);}})[_0xd8a9('0x25')](function(_0x35c916){if(_0x35c916){_0x47d722=_0x35c916['length'];if(!_0x207fb5[_0xd8a9('0x35')][_0xd8a9('0x56')](_0xd8a9('0x3c'))){_0x30d9db[_0xd8a9('0x1f')]=qs[_0xd8a9('0x1f')](_0x207fb5[_0xd8a9('0x35')][_0xd8a9('0x1f')]);_0x30d9db[_0xd8a9('0x1d')]=qs[_0xd8a9('0x1d')](_0x207fb5['query'][_0xd8a9('0x1d')]);}return _0xf24c63['getTeams'](_0x30d9db);}})['then'](function(_0x2c5047){if(_0x2c5047){return _0x2c5047?{'count':_0x47d722,'rows':_0x2c5047}:null;}})[_0xd8a9('0x25')](respondWithResult(_0x5e08ab,null))[_0xd8a9('0x47')](handleError(_0x5e08ab,null));};exports['addTeams']=function(_0xbdba9f,_0x422cfc,_0x1709cc){var _0x3a9981=_0xbdba9f[_0xd8a9('0x4c')][_0xd8a9('0x62')];return db['Team'][_0xd8a9('0x45')]({'where':{'id':_0x3a9981},'attributes':['id'],'include':[{'model':db[_0xd8a9('0x63')],'as':_0xd8a9('0x64'),'attributes':['id','name',_0xd8a9('0x65'),_0xd8a9('0x66'),_0xd8a9('0x67')],'raw':!![]}]})['then'](function(_0x9ac103){if(_0x9ac103){var _0x58df63=_[_0xd8a9('0x68')](_0x9ac103,function(_0x348a32){var _0x913da4=_0x348a32[_0xd8a9('0x50')]({'plain':!![]});return _0x913da4[_0xd8a9('0x64')];});return db['MailQueue']['find']({'where':{'id':_0xbdba9f['params']['id']}})[_0xd8a9('0x25')](function(_0x6b1503){return db[_0xd8a9('0x69')][_0xd8a9('0x6a')](function(_0x1e2f0e){return _0x6b1503[_0xd8a9('0x6b')](_0x3a9981,{'transaction':_0x1e2f0e})['then'](function(){return BPromise['each'](_0x58df63,function(_0x4665a6){return db[_0xd8a9('0x55')]['findOrCreate']({'where':{'UserId':_0x4665a6['id'],'MailQueueId':_0xbdba9f[_0xd8a9('0x48')]['id']},'transaction':_0x1e2f0e});});})['then'](function(){_0x58df63[_0xd8a9('0x6c')](function(_0x3ffc24){socket[_0xd8a9('0x6d')](_0xd8a9('0x6e'),{'UserId':_0x3ffc24['id'],'MailQueueId':_0x6b1503['id']});});});});});}})[_0xd8a9('0x25')](respondWithStatusCode(_0x422cfc,null))[_0xd8a9('0x47')](handleError(_0x422cfc,null));};exports[_0xd8a9('0x6f')]=function(_0x44fcc6,_0x3428ab,_0x9c0d11){return db[_0xd8a9('0x61')][_0xd8a9('0x45')]({'where':{'id':_0x44fcc6[_0xd8a9('0x35')][_0xd8a9('0x62')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3428ab,null))[_0xd8a9('0x25')](function(_0x3a88a1){var _0x229a5e=_['map'](_0x3a88a1,'id');var _0x5c98d3=[];var _0x500a34=[];var _0x3222fb=squel[_0xd8a9('0x70')]();_0x3222fb[_0xd8a9('0x71')](_0xd8a9('0x72'))[_0xd8a9('0x73')](_0xd8a9('0x74'),'tq')['join']('user_has_teams','ut',_0xd8a9('0x75'))[_0xd8a9('0x3f')]('MailQueueId\x20=\x20?',_0x44fcc6[_0xd8a9('0x48')]['id']);for(var _0x1d5462=0x0;_0x1d5462<_0x3a88a1[_0xd8a9('0x3b')];_0x1d5462+=0x1){let _0x1cf2d3=_0x3a88a1[_0x1d5462];for(var _0x35db00=0x0;_0x35db00<_0x1cf2d3[_0xd8a9('0x64')][_0xd8a9('0x3b')];_0x35db00+=0x1){let _0x1d92a2=_0x1cf2d3[_0xd8a9('0x64')][_0x35db00];var _0x259811=_0x3222fb[_0xd8a9('0x76')]();_0x259811[_0xd8a9('0x3f')](_0xd8a9('0x77'),_0x1d92a2['id']);_0x500a34[_0xd8a9('0x78')](db[_0xd8a9('0x69')][_0xd8a9('0x35')](_0x259811[_0xd8a9('0x79')](),{'type':db[_0xd8a9('0x69')][_0xd8a9('0x7a')][_0xd8a9('0x7b')]})[_0xd8a9('0x25')](function(_0x223fe0){if(_0x223fe0[_0xd8a9('0x3b')]===0x1){return _0x1d92a2['id'];}else{var _0x243d8e=_[_0xd8a9('0x7c')](_[_0xd8a9('0x34')](_0x223fe0,_0xd8a9('0x7d')),function(_0x3ea5cd){return _['includes'](_0x229a5e,_0x3ea5cd);});if(_0x243d8e){return _0x1d92a2['id'];}}}));}}return BPromise[_0xd8a9('0x7e')](_0x500a34)[_0xd8a9('0x25')](function(_0x9e8d33){_0x5c98d3=_(_0x5c98d3)[_0xd8a9('0x7f')](_0x9e8d33)[_0xd8a9('0x80')]()[_0xd8a9('0x81')]();return db[_0xd8a9('0x2f')][_0xd8a9('0x4a')]({'where':{'id':_0x44fcc6[_0xd8a9('0x48')]['id']}})['then'](function(_0x44b9a3){return db['sequelize'][_0xd8a9('0x6a')](function(_0x39ad00){return _0x44b9a3[_0xd8a9('0x6f')](_0x44fcc6[_0xd8a9('0x35')]['ids'],{'transaction':_0x39ad00})[_0xd8a9('0x25')](function(){if(!_[_0xd8a9('0x82')](_0x5c98d3)){return _0x44b9a3['removeAgents'](_0x5c98d3,{'transaction':_0x39ad00});}})[_0xd8a9('0x25')](function(){_0x5c98d3[_0xd8a9('0x6c')](function(_0x499165){socket[_0xd8a9('0x6d')](_0xd8a9('0x83'),{'UserId':_0x499165,'MailQueueId':_0x44b9a3['id']});});});});});});})[_0xd8a9('0x25')](respondWithStatusCode(_0x3428ab,null))[_0xd8a9('0x47')](handleError(_0x3428ab,null));};exports[_0xd8a9('0x84')]=function(_0x53099f,_0x2ea634,_0x3d33c5){return db['MailQueue'][_0xd8a9('0x4a')]({'where':{'id':_0x53099f[_0xd8a9('0x48')]['id']}})[_0xd8a9('0x25')](handleEntityNotFound(_0x2ea634,null))['then'](function(_0x5a90a1){if(_0x5a90a1){return _0x5a90a1[_0xd8a9('0x84')](_0x53099f['body']['ids'],_[_0xd8a9('0x85')](_0x53099f[_0xd8a9('0x4c')],[_0xd8a9('0x62'),'id'])||{})[_0xd8a9('0x86')](function(_0xf3605b){for(var _0x4337e4=0x0;_0x4337e4<_0x53099f[_0xd8a9('0x4c')][_0xd8a9('0x62')][_0xd8a9('0x3b')];_0x4337e4+=0x1){socket[_0xd8a9('0x6d')]('userMailQueue:save',{'UserId':Number(_0x53099f['body']['ids'][_0x4337e4]),'MailQueueId':Number(_0x53099f[_0xd8a9('0x48')]['id'])});}return _0xf3605b;});}})[_0xd8a9('0x25')](respondWithResult(_0x2ea634,null))[_0xd8a9('0x47')](handleError(_0x2ea634,null));};exports['removeAgents']=function(_0x3327e6,_0x55dae9,_0x81f0ca){return db['MailQueue'][_0xd8a9('0x4a')]({'where':{'id':_0x3327e6[_0xd8a9('0x48')]['id']}})['then'](handleEntityNotFound(_0x55dae9,null))[_0xd8a9('0x25')](function(_0x598223){if(_0x598223){return _0x598223[_0xd8a9('0x87')](_0x3327e6['query'][_0xd8a9('0x62')])[_0xd8a9('0x25')](function(){if(_[_0xd8a9('0x88')](_0x3327e6['query'][_0xd8a9('0x62')])){for(var _0x48a1c6=0x0;_0x48a1c6<_0x3327e6[_0xd8a9('0x35')][_0xd8a9('0x62')][_0xd8a9('0x3b')];_0x48a1c6+=0x1){socket['emit'](_0xd8a9('0x83'),{'UserId':Number(_0x3327e6['query']['ids'][_0x48a1c6]),'MailQueueId':Number(_0x3327e6['params']['id'])});}}else{socket[_0xd8a9('0x6d')](_0xd8a9('0x83'),{'UserId':Number(_0x3327e6[_0xd8a9('0x35')][_0xd8a9('0x62')]),'MailQueueId':Number(_0x3327e6[_0xd8a9('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x55dae9,null))[_0xd8a9('0x47')](handleError(_0x55dae9,null));};exports['getAgents']=function(_0x386803,_0x4ae76f,_0xf621f5){var _0x105a24={};var _0x5b0a36={};var _0x5b58d1;var _0x235439;return db[_0xd8a9('0x2f')][_0xd8a9('0x60')]({'where':{'id':_0x386803[_0xd8a9('0x48')]['id']}})[_0xd8a9('0x25')](handleEntityNotFound(_0x4ae76f,null))[_0xd8a9('0x25')](function(_0x2b2a98){if(_0x2b2a98){_0x5b58d1=_0x2b2a98;_0x5b0a36[_0xd8a9('0x33')]=_[_0xd8a9('0x36')](db['User'][_0xd8a9('0x30')]);_0x5b0a36[_0xd8a9('0x35')]=_[_0xd8a9('0x36')](_0x386803[_0xd8a9('0x35')]);_0x5b0a36['filters']=_[_0xd8a9('0x38')](_0x5b0a36[_0xd8a9('0x33')],_0x5b0a36['query']);_0x105a24['attributes']=_['intersection'](_0x5b0a36[_0xd8a9('0x33')],qs[_0xd8a9('0x3a')](_0x386803[_0xd8a9('0x35')][_0xd8a9('0x3a')]));_0x105a24[_0xd8a9('0x39')]=_0x105a24[_0xd8a9('0x39')][_0xd8a9('0x3b')]?_0x105a24[_0xd8a9('0x39')]:_0x5b0a36['model'];_0x105a24[_0xd8a9('0x3d')]=qs[_0xd8a9('0x3e')](_0x386803['query']['sort']);_0x105a24[_0xd8a9('0x3f')]=qs[_0xd8a9('0x37')](_[_0xd8a9('0x40')](_0x386803['query'],_0x5b0a36[_0xd8a9('0x37')]));if(_0x386803[_0xd8a9('0x35')][_0xd8a9('0x41')]){_0x105a24['where']=_[_0xd8a9('0x42')](_0x105a24[_0xd8a9('0x3f')],{'$or':_[_0xd8a9('0x34')](_0x105a24[_0xd8a9('0x39')],function(_0x2773c9){var _0x118123={};_0x118123[_0x2773c9]={'$like':'%'+_0x386803[_0xd8a9('0x35')][_0xd8a9('0x41')]+'%'};return _0x118123;})});}_0x105a24=_[_0xd8a9('0x42')]({},_0x105a24,_0x386803['options']);return _0x5b58d1[_0xd8a9('0x89')](_0x105a24);}})['then'](function(_0x13e854){if(_0x13e854){_0x235439=_0x13e854[_0xd8a9('0x3b')];if(!_0x386803[_0xd8a9('0x35')]['hasOwnProperty'](_0xd8a9('0x3c'))){_0x105a24[_0xd8a9('0x1f')]=qs[_0xd8a9('0x1f')](_0x386803[_0xd8a9('0x35')][_0xd8a9('0x1f')]);_0x105a24[_0xd8a9('0x1d')]=qs[_0xd8a9('0x1d')](_0x386803[_0xd8a9('0x35')][_0xd8a9('0x1d')]);}return _0x5b58d1[_0xd8a9('0x89')](_0x105a24);}})['then'](function(_0x24c504){if(_0x24c504){return _0x24c504?{'count':_0x235439,'rows':_0x24c504}:null;}})[_0xd8a9('0x25')](respondWithResult(_0x4ae76f,null))[_0xd8a9('0x47')](handleError(_0x4ae76f,null));}; \ No newline at end of file +var _0xdcf9=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','save','update','then','get','MailQueues','error','stack','name','send','map','MailQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','describe','getMembers','findOne','UserMailQueue','order','MailQueueId','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','sequelize','each','findOrCreate','forEach','emit','userMailQueue:save','select','field','tq.TeamId','from','team_has_mail_queues','join','MailQueueId\x20=\x20?','clone','push','toString','SELECT','every','TeamId','includes','all','union','value','transaction','isEmpty','userMailQueue:remove','addAgents','omit','spread','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x45b91e,_0x4adfbe){var _0x2cf52c=function(_0x3dedf9){while(--_0x3dedf9){_0x45b91e['push'](_0x45b91e['shift']());}};_0x2cf52c(++_0x4adfbe);}(_0xdcf9,0x101));var _0x9dcf=function(_0x5adb6e,_0x536a82){_0x5adb6e=_0x5adb6e-0x0;var _0xfd0977=_0xdcf9[_0x5adb6e];return _0xfd0977;};'use strict';var emlformat=require(_0x9dcf('0x0'));var rimraf=require(_0x9dcf('0x1'));var zipdir=require(_0x9dcf('0x2'));var jsonpatch=require(_0x9dcf('0x3'));var rp=require(_0x9dcf('0x4'));var moment=require(_0x9dcf('0x5'));var BPromise=require(_0x9dcf('0x6'));var Mustache=require(_0x9dcf('0x7'));var util=require(_0x9dcf('0x8'));var path=require(_0x9dcf('0x9'));var sox=require(_0x9dcf('0xa'));var csv=require(_0x9dcf('0xb'));var ejs=require(_0x9dcf('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9dcf('0xd'));var jsforce=require(_0x9dcf('0xe'));var deskjs=require(_0x9dcf('0xf'));var toCsv=require(_0x9dcf('0xb'));var querystring=require(_0x9dcf('0x10'));var Papa=require('papaparse');var Redis=require(_0x9dcf('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9dcf('0x12'));var logger=require('../../config/logger')(_0x9dcf('0x13'));var utils=require(_0x9dcf('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9dcf('0x15'));var db=require(_0x9dcf('0x16'))['db'];config[_0x9dcf('0x17')]=_['defaults'](config[_0x9dcf('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x9dcf('0x18'))(new Redis(config['redis']));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x127f63,_0xc46435){_0xc46435=_0xc46435||0xcc;return function(_0x554385){if(_0x554385){return _0x127f63[_0x9dcf('0x19')](_0xc46435);}return _0x127f63['status'](_0xc46435)[_0x9dcf('0x1a')]();};}function respondWithResult(_0x3572fa,_0x46afbe){_0x46afbe=_0x46afbe||0xc8;return function(_0x38a720){if(_0x38a720){return _0x3572fa[_0x9dcf('0x1b')](_0x46afbe)[_0x9dcf('0x1c')](_0x38a720);}};}function respondWithFilteredResult(_0x5d5f0d,_0x4cbb53){return function(_0x335f63){if(_0x335f63){var _0xf4aced=typeof _0x4cbb53[_0x9dcf('0x1d')]==='undefined'&&typeof _0x4cbb53[_0x9dcf('0x1e')]===_0x9dcf('0x1f');var _0x168971=_0x335f63[_0x9dcf('0x20')];var _0x400942=_0xf4aced?0x0:_0x4cbb53[_0x9dcf('0x1d')];var _0x100e8a=_0xf4aced?_0x335f63[_0x9dcf('0x20')]:_0x4cbb53[_0x9dcf('0x1d')]+_0x4cbb53[_0x9dcf('0x1e')];var _0x133950;if(_0x100e8a>=_0x168971){_0x100e8a=_0x168971;_0x133950=0xc8;}else{_0x133950=0xce;}_0x5d5f0d[_0x9dcf('0x1b')](_0x133950);return _0x5d5f0d['set'](_0x9dcf('0x21'),_0x400942+'-'+_0x100e8a+'/'+_0x168971)['json'](_0x335f63);}return null;};}function patchUpdates(_0x53fd31){return function(_0x54b8cb){try{jsonpatch['apply'](_0x54b8cb,_0x53fd31,!![]);}catch(_0x2b4942){return BPromise['reject'](_0x2b4942);}return _0x54b8cb[_0x9dcf('0x22')]();};}function saveUpdates(_0x3093ef,_0x5a2842){return function(_0x3a5164){if(_0x3a5164){return _0x3a5164[_0x9dcf('0x23')](_0x3093ef)['then'](function(_0x35e5ee){return _0x35e5ee;});}return null;};}function removeEntity(_0x39b934,_0x382c03){return function(_0x3dec72){if(_0x3dec72){return _0x3dec72['destroy']()[_0x9dcf('0x24')](function(){var _0x9ab5f=_0x3dec72[_0x9dcf('0x25')]({'plain':!![]});var _0x4082a4=_0x9dcf('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x4082a4,'resourceId':_0x9ab5f['id']}})['then'](function(){return _0x3dec72;});})['then'](function(){_0x39b934[_0x9dcf('0x1b')](0xcc)[_0x9dcf('0x1a')]();});}};}function handleEntityNotFound(_0x137d0e,_0x1161ad){return function(_0x26bb1d){if(!_0x26bb1d){_0x137d0e[_0x9dcf('0x19')](0x194);}return _0x26bb1d;};}function handleError(_0x7ebac0,_0x37fd3f){_0x37fd3f=_0x37fd3f||0x1f4;return function(_0x3bd4d6){logger[_0x9dcf('0x27')](_0x3bd4d6[_0x9dcf('0x28')]);if(_0x3bd4d6[_0x9dcf('0x29')]){delete _0x3bd4d6[_0x9dcf('0x29')];}_0x7ebac0[_0x9dcf('0x1b')](_0x37fd3f)[_0x9dcf('0x2a')](_0x3bd4d6);};}exports['index']=function(_0x29a513,_0x216b43){var _0x5ad1d0={},_0x10960f={},_0x5ebff9={'count':0x0,'rows':[]};var _0x553c9b=_[_0x9dcf('0x2b')](db[_0x9dcf('0x2c')][_0x9dcf('0x2d')],function(_0x274c20){return{'name':_0x274c20[_0x9dcf('0x2e')],'type':_0x274c20[_0x9dcf('0x2f')][_0x9dcf('0x30')]};});_0x10960f['model']=_[_0x9dcf('0x2b')](_0x553c9b,_0x9dcf('0x29'));_0x10960f[_0x9dcf('0x31')]=_[_0x9dcf('0x32')](_0x29a513[_0x9dcf('0x31')]);_0x10960f[_0x9dcf('0x33')]=_[_0x9dcf('0x34')](_0x10960f[_0x9dcf('0x35')],_0x10960f[_0x9dcf('0x31')]);_0x5ad1d0[_0x9dcf('0x36')]=_['intersection'](_0x10960f[_0x9dcf('0x35')],qs[_0x9dcf('0x37')](_0x29a513[_0x9dcf('0x31')]['fields']));_0x5ad1d0['attributes']=_0x5ad1d0[_0x9dcf('0x36')][_0x9dcf('0x38')]?_0x5ad1d0[_0x9dcf('0x36')]:_0x10960f['model'];if(!_0x29a513[_0x9dcf('0x31')][_0x9dcf('0x39')](_0x9dcf('0x3a'))){_0x5ad1d0[_0x9dcf('0x1e')]=qs[_0x9dcf('0x1e')](_0x29a513['query'][_0x9dcf('0x1e')]);_0x5ad1d0[_0x9dcf('0x1d')]=qs[_0x9dcf('0x1d')](_0x29a513[_0x9dcf('0x31')][_0x9dcf('0x1d')]);}_0x5ad1d0['order']=qs[_0x9dcf('0x3b')](_0x29a513[_0x9dcf('0x31')]['sort']);_0x5ad1d0[_0x9dcf('0x3c')]=qs['filters'](_[_0x9dcf('0x3d')](_0x29a513[_0x9dcf('0x31')],_0x10960f[_0x9dcf('0x33')]),_0x553c9b);if(_0x29a513[_0x9dcf('0x31')][_0x9dcf('0x3e')]){_0x5ad1d0['where']=_[_0x9dcf('0x3f')](_0x5ad1d0[_0x9dcf('0x3c')],{'$or':_[_0x9dcf('0x2b')](_0x553c9b,function(_0x19214a){if(_0x19214a[_0x9dcf('0x2f')]!==_0x9dcf('0x40')){var _0x3d45a6={};_0x3d45a6[_0x19214a[_0x9dcf('0x29')]]={'$like':'%'+_0x29a513[_0x9dcf('0x31')][_0x9dcf('0x3e')]+'%'};return _0x3d45a6;}})});}_0x5ad1d0=_[_0x9dcf('0x3f')]({},_0x5ad1d0,_0x29a513['options']);var _0x40293f={'where':_0x5ad1d0[_0x9dcf('0x3c')]};return db[_0x9dcf('0x2c')][_0x9dcf('0x20')](_0x40293f)[_0x9dcf('0x24')](function(_0x11ae37){_0x5ebff9[_0x9dcf('0x20')]=_0x11ae37;if(_0x29a513[_0x9dcf('0x31')]['includeAll']){_0x5ad1d0[_0x9dcf('0x41')]=[{'all':!![]}];}return db[_0x9dcf('0x2c')][_0x9dcf('0x42')](_0x5ad1d0);})[_0x9dcf('0x24')](function(_0x15bbab){_0x5ebff9[_0x9dcf('0x43')]=_0x15bbab;return _0x5ebff9;})[_0x9dcf('0x24')](respondWithFilteredResult(_0x216b43,_0x5ad1d0))['catch'](handleError(_0x216b43,null));};exports['show']=function(_0x2c0814,_0x5e3d9c){var _0x1133cf={'raw':!![],'where':{'id':_0x2c0814['params']['id']}},_0x50db19={};_0x50db19[_0x9dcf('0x35')]=_[_0x9dcf('0x32')](db[_0x9dcf('0x2c')][_0x9dcf('0x2d')]);_0x50db19[_0x9dcf('0x31')]=_['keys'](_0x2c0814[_0x9dcf('0x31')]);_0x50db19['filters']=_[_0x9dcf('0x34')](_0x50db19[_0x9dcf('0x35')],_0x50db19['query']);_0x1133cf[_0x9dcf('0x36')]=_[_0x9dcf('0x34')](_0x50db19[_0x9dcf('0x35')],qs['fields'](_0x2c0814[_0x9dcf('0x31')][_0x9dcf('0x37')]));_0x1133cf[_0x9dcf('0x36')]=_0x1133cf[_0x9dcf('0x36')][_0x9dcf('0x38')]?_0x1133cf['attributes']:_0x50db19['model'];if(_0x2c0814[_0x9dcf('0x31')]['includeAll']){_0x1133cf[_0x9dcf('0x41')]=[{'all':!![]}];}_0x1133cf=_['merge']({},_0x1133cf,_0x2c0814[_0x9dcf('0x44')]);return db[_0x9dcf('0x2c')][_0x9dcf('0x45')](_0x1133cf)[_0x9dcf('0x24')](handleEntityNotFound(_0x5e3d9c,null))[_0x9dcf('0x24')](respondWithResult(_0x5e3d9c,null))[_0x9dcf('0x46')](handleError(_0x5e3d9c,null));};exports[_0x9dcf('0x47')]=function(_0x5c03a3,_0x51dc98){return db[_0x9dcf('0x2c')]['create'](_0x5c03a3['body'],{})[_0x9dcf('0x24')](function(_0x2d5194){var _0x1ca2b6=_0x5c03a3[_0x9dcf('0x48')][_0x9dcf('0x25')]({'plain':!![]});if(!_0x1ca2b6)throw new Error(_0x9dcf('0x49'));if(_0x1ca2b6['role']===_0x9dcf('0x48')){var _0x585e11=_0x2d5194['get']({'plain':!![]});var _0x186885=_0x9dcf('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x186885,'userProfileId':_0x1ca2b6[_0x9dcf('0x4a')]},'raw':!![]})[_0x9dcf('0x24')](function(_0x5232d6){if(_0x5232d6&&_0x5232d6['autoAssociation']===0x0){return db[_0x9dcf('0x4b')]['create']({'name':_0x585e11[_0x9dcf('0x29')],'resourceId':_0x585e11['id'],'type':_0x5232d6['name'],'sectionId':_0x5232d6['id']},{})[_0x9dcf('0x24')](function(){return _0x2d5194;});}else{return _0x2d5194;}})[_0x9dcf('0x46')](function(_0x4cfbdb){logger[_0x9dcf('0x27')](_0x9dcf('0x4c'),_0x4cfbdb);throw _0x4cfbdb;});}return _0x2d5194;})[_0x9dcf('0x24')](respondWithResult(_0x51dc98,0xc9))[_0x9dcf('0x46')](handleError(_0x51dc98,null));};exports[_0x9dcf('0x23')]=function(_0x23212a,_0x2bd27c){if(_0x23212a['body']['id']){delete _0x23212a[_0x9dcf('0x4d')]['id'];}return db[_0x9dcf('0x2c')][_0x9dcf('0x45')]({'where':{'id':_0x23212a[_0x9dcf('0x4e')]['id']}})[_0x9dcf('0x24')](handleEntityNotFound(_0x2bd27c,null))[_0x9dcf('0x24')](saveUpdates(_0x23212a[_0x9dcf('0x4d')],null))[_0x9dcf('0x24')](respondWithResult(_0x2bd27c,null))[_0x9dcf('0x46')](handleError(_0x2bd27c,null));};exports[_0x9dcf('0x4f')]=function(_0x2bfcec,_0xc3f8){return db[_0x9dcf('0x2c')][_0x9dcf('0x45')]({'where':{'id':_0x2bfcec[_0x9dcf('0x4e')]['id']}})['then'](handleEntityNotFound(_0xc3f8,null))[_0x9dcf('0x24')](removeEntity(_0xc3f8,null))[_0x9dcf('0x46')](handleError(_0xc3f8,null));};exports[_0x9dcf('0x50')]=function(_0x5986d2,_0x14bbe3){return db['MailQueue'][_0x9dcf('0x50')]()['then'](respondWithResult(_0x14bbe3,null))[_0x9dcf('0x46')](handleError(_0x14bbe3,null));};exports[_0x9dcf('0x51')]=function(_0x1f3bc4,_0x50bab9,_0x13d4ac){var _0x482bd0={'raw':!![],'where':{}},_0x57519a={},_0xd53513;return db['MailQueue'][_0x9dcf('0x52')]({'where':{'id':_0x1f3bc4[_0x9dcf('0x4e')]['id']}})['then'](handleEntityNotFound(_0x50bab9,null))[_0x9dcf('0x24')](function(_0x3af328){if(_0x3af328){_0xd53513=_0x3af328['get']({'plain':!![]});_0x57519a[_0x9dcf('0x35')]=_[_0x9dcf('0x32')](db[_0x9dcf('0x53')]['rawAttributes']);_0x57519a['query']=_[_0x9dcf('0x32')](_0x1f3bc4['query']);_0x57519a['filters']=_[_0x9dcf('0x34')](_0x57519a[_0x9dcf('0x35')],_0x57519a[_0x9dcf('0x31')]);_0x482bd0[_0x9dcf('0x36')]=_[_0x9dcf('0x34')](_0x57519a[_0x9dcf('0x35')],qs[_0x9dcf('0x37')](_0x1f3bc4[_0x9dcf('0x31')]['fields']));_0x482bd0[_0x9dcf('0x36')]=_0x482bd0[_0x9dcf('0x36')][_0x9dcf('0x38')]?_0x482bd0[_0x9dcf('0x36')]:_0x57519a[_0x9dcf('0x35')];if(!_0x1f3bc4[_0x9dcf('0x31')][_0x9dcf('0x39')]('nolimit')){_0x482bd0[_0x9dcf('0x1e')]=qs[_0x9dcf('0x1e')](_0x1f3bc4[_0x9dcf('0x31')][_0x9dcf('0x1e')]);_0x482bd0[_0x9dcf('0x1d')]=qs['offset'](_0x1f3bc4[_0x9dcf('0x31')][_0x9dcf('0x1d')]);}_0x482bd0[_0x9dcf('0x54')]=qs[_0x9dcf('0x3b')](_0x1f3bc4[_0x9dcf('0x31')][_0x9dcf('0x3b')]);_0x482bd0[_0x9dcf('0x3c')]=qs['filters'](_['pick'](_0x1f3bc4[_0x9dcf('0x31')],_0x57519a[_0x9dcf('0x33')]));_0x482bd0['where'][_0x9dcf('0x55')]=_0x3af328['id'];if(_0x1f3bc4['query'][_0x9dcf('0x3e')]){_0x482bd0[_0x9dcf('0x3c')]=_[_0x9dcf('0x3f')](_0x482bd0[_0x9dcf('0x3c')],{'$or':_['map'](_0x482bd0['attributes'],function(_0x1bfed9){var _0x459748={};_0x459748[_0x1bfed9]={'$like':'%'+_0x1f3bc4[_0x9dcf('0x31')]['filter']+'%'};return _0x459748;})});}_0x482bd0=_[_0x9dcf('0x3f')]({},_0x482bd0,_0x1f3bc4[_0x9dcf('0x44')]);return db[_0x9dcf('0x53')][_0x9dcf('0x42')](_0x482bd0);}})[_0x9dcf('0x24')](function(_0x36398d){if(_0x36398d){return db[_0x9dcf('0x56')][_0x9dcf('0x57')]({'where':{'id':_[_0x9dcf('0x2b')](_0x36398d,'UserId'),'role':_0x9dcf('0x58')},'attributes':['id',_0x9dcf('0x29'),_0x9dcf('0x59'),_0x9dcf('0x5a'),_0x9dcf('0x5b')]});}})[_0x9dcf('0x24')](function(_0x2c7811){if(_0x2c7811){return{'count':_0x2c7811['count'],'rows':_[_0x9dcf('0x2b')](_0x2c7811[_0x9dcf('0x43')],function(_0x5397e6){return{'membername':_0x5397e6[_0x9dcf('0x29')],'UserId':_0x5397e6['id'],'queue_name':_0xd53513[_0x9dcf('0x29')],'MailQueueId':_0xd53513['id'],'interface':util[_0x9dcf('0x5c')](_0x9dcf('0x5d'),_0x9dcf('0x5e'),_0x5397e6[_0x9dcf('0x29')]),'penalty':0x0,'paused':_0x5397e6[_0x9dcf('0x59')],'createdAt':_0x5397e6[_0x9dcf('0x5b')],'updatedAt':_0x5397e6[_0x9dcf('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9dcf('0x24')](respondWithFilteredResult(_0x50bab9,_0x482bd0))[_0x9dcf('0x46')](handleError(_0x50bab9,null));};exports['getTeams']=function(_0x5667aa,_0x3fe1cc,_0x5f2dfe){var _0x8d5117={};var _0x2324bb={};var _0x355441;var _0x471f2d;return db[_0x9dcf('0x2c')][_0x9dcf('0x52')]({'where':{'id':_0x5667aa[_0x9dcf('0x4e')]['id']}})[_0x9dcf('0x24')](handleEntityNotFound(_0x3fe1cc,null))[_0x9dcf('0x24')](function(_0x3b86ce){if(_0x3b86ce){_0x355441=_0x3b86ce;_0x2324bb[_0x9dcf('0x35')]=_[_0x9dcf('0x32')](db['Team'][_0x9dcf('0x2d')]);_0x2324bb['query']=_[_0x9dcf('0x32')](_0x5667aa[_0x9dcf('0x31')]);_0x2324bb[_0x9dcf('0x33')]=_[_0x9dcf('0x34')](_0x2324bb['model'],_0x2324bb[_0x9dcf('0x31')]);_0x8d5117[_0x9dcf('0x36')]=_[_0x9dcf('0x34')](_0x2324bb[_0x9dcf('0x35')],qs[_0x9dcf('0x37')](_0x5667aa[_0x9dcf('0x31')][_0x9dcf('0x37')]));_0x8d5117[_0x9dcf('0x36')]=_0x8d5117[_0x9dcf('0x36')][_0x9dcf('0x38')]?_0x8d5117[_0x9dcf('0x36')]:_0x2324bb[_0x9dcf('0x35')];_0x8d5117[_0x9dcf('0x54')]=qs[_0x9dcf('0x3b')](_0x5667aa['query'][_0x9dcf('0x3b')]);_0x8d5117[_0x9dcf('0x3c')]=qs[_0x9dcf('0x33')](_[_0x9dcf('0x3d')](_0x5667aa[_0x9dcf('0x31')],_0x2324bb[_0x9dcf('0x33')]));if(_0x5667aa[_0x9dcf('0x31')]['filter']){_0x8d5117[_0x9dcf('0x3c')]=_[_0x9dcf('0x3f')](_0x8d5117['where'],{'$or':_[_0x9dcf('0x2b')](_0x8d5117[_0x9dcf('0x36')],function(_0x403711){var _0xe790ee={};_0xe790ee[_0x403711]={'$like':'%'+_0x5667aa[_0x9dcf('0x31')][_0x9dcf('0x3e')]+'%'};return _0xe790ee;})});}_0x8d5117=_[_0x9dcf('0x3f')]({},_0x8d5117,_0x5667aa['options']);return _0x355441[_0x9dcf('0x5f')](_0x8d5117);}})[_0x9dcf('0x24')](function(_0xc26bfe){if(_0xc26bfe){_0x471f2d=_0xc26bfe[_0x9dcf('0x38')];if(!_0x5667aa[_0x9dcf('0x31')][_0x9dcf('0x39')](_0x9dcf('0x3a'))){_0x8d5117['limit']=qs[_0x9dcf('0x1e')](_0x5667aa[_0x9dcf('0x31')][_0x9dcf('0x1e')]);_0x8d5117['offset']=qs[_0x9dcf('0x1d')](_0x5667aa[_0x9dcf('0x31')][_0x9dcf('0x1d')]);}return _0x355441[_0x9dcf('0x5f')](_0x8d5117);}})[_0x9dcf('0x24')](function(_0x50e953){if(_0x50e953){return _0x50e953?{'count':_0x471f2d,'rows':_0x50e953}:null;}})[_0x9dcf('0x24')](respondWithResult(_0x3fe1cc,null))[_0x9dcf('0x46')](handleError(_0x3fe1cc,null));};exports[_0x9dcf('0x60')]=function(_0x2a38fa,_0x94d1eb,_0x3e948f){var _0x56d351=_0x2a38fa[_0x9dcf('0x4d')][_0x9dcf('0x61')];return db[_0x9dcf('0x62')][_0x9dcf('0x42')]({'where':{'id':_0x56d351},'attributes':['id'],'include':[{'model':db[_0x9dcf('0x56')],'as':_0x9dcf('0x63'),'attributes':['id',_0x9dcf('0x29'),'online','voicePause','interface'],'raw':!![]}]})[_0x9dcf('0x24')](function(_0x40c4b1){if(_0x40c4b1){var _0x481487=_['flatMap'](_0x40c4b1,function(_0x3b2a6d){var _0xeffbc=_0x3b2a6d[_0x9dcf('0x25')]({'plain':!![]});return _0xeffbc[_0x9dcf('0x63')];});return db[_0x9dcf('0x2c')][_0x9dcf('0x45')]({'where':{'id':_0x2a38fa[_0x9dcf('0x4e')]['id']}})[_0x9dcf('0x24')](function(_0x475401){return db[_0x9dcf('0x64')]['transaction'](function(_0x465778){return _0x475401[_0x9dcf('0x60')](_0x56d351,{'transaction':_0x465778})[_0x9dcf('0x24')](function(){return BPromise[_0x9dcf('0x65')](_0x481487,function(_0x46d52c){return db[_0x9dcf('0x53')][_0x9dcf('0x66')]({'where':{'UserId':_0x46d52c['id'],'MailQueueId':_0x2a38fa[_0x9dcf('0x4e')]['id']},'transaction':_0x465778});});})[_0x9dcf('0x24')](function(){_0x481487[_0x9dcf('0x67')](function(_0x2d6c9a){socket[_0x9dcf('0x68')](_0x9dcf('0x69'),{'UserId':_0x2d6c9a['id'],'MailQueueId':_0x475401['id']});});});});});}})[_0x9dcf('0x24')](respondWithStatusCode(_0x94d1eb,null))[_0x9dcf('0x46')](handleError(_0x94d1eb,null));};exports['removeTeams']=function(_0x155207,_0x3b6f78,_0x1b2a65){return db[_0x9dcf('0x62')]['findAll']({'where':{'id':_0x155207[_0x9dcf('0x31')][_0x9dcf('0x61')]},'attributes':['id'],'include':[{'model':db[_0x9dcf('0x56')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9dcf('0x24')](handleEntityNotFound(_0x3b6f78,null))[_0x9dcf('0x24')](function(_0x152b42){var _0xcc8578=_[_0x9dcf('0x2b')](_0x152b42,'id');var _0x707630=[];var _0x3495e3=[];var _0x575230=squel[_0x9dcf('0x6a')]();_0x575230[_0x9dcf('0x6b')](_0x9dcf('0x6c'))[_0x9dcf('0x6d')](_0x9dcf('0x6e'),'tq')[_0x9dcf('0x6f')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9dcf('0x3c')](_0x9dcf('0x70'),_0x155207[_0x9dcf('0x4e')]['id']);for(var _0x4f92b7=0x0;_0x4f92b7<_0x152b42[_0x9dcf('0x38')];_0x4f92b7+=0x1){let _0x24c08d=_0x152b42[_0x4f92b7];for(var _0x1525e6=0x0;_0x1525e6<_0x24c08d['Agents'][_0x9dcf('0x38')];_0x1525e6+=0x1){let _0x103eda=_0x24c08d[_0x9dcf('0x63')][_0x1525e6];var _0x7c8b7b=_0x575230[_0x9dcf('0x71')]();_0x7c8b7b[_0x9dcf('0x3c')]('ut.UserId\x20=\x20?',_0x103eda['id']);_0x3495e3[_0x9dcf('0x72')](db['sequelize'][_0x9dcf('0x31')](_0x7c8b7b[_0x9dcf('0x73')](),{'type':db['sequelize']['QueryTypes'][_0x9dcf('0x74')]})[_0x9dcf('0x24')](function(_0x1af675){if(_0x1af675[_0x9dcf('0x38')]===0x1){return _0x103eda['id'];}else{var _0x1545cb=_[_0x9dcf('0x75')](_[_0x9dcf('0x2b')](_0x1af675,_0x9dcf('0x76')),function(_0x3d24a3){return _[_0x9dcf('0x77')](_0xcc8578,_0x3d24a3);});if(_0x1545cb){return _0x103eda['id'];}}}));}}return BPromise[_0x9dcf('0x78')](_0x3495e3)[_0x9dcf('0x24')](function(_0x2d3860){_0x707630=_(_0x707630)[_0x9dcf('0x79')](_0x2d3860)['compact']()[_0x9dcf('0x7a')]();return db[_0x9dcf('0x2c')]['find']({'where':{'id':_0x155207[_0x9dcf('0x4e')]['id']}})['then'](function(_0xa03387){return db[_0x9dcf('0x64')][_0x9dcf('0x7b')](function(_0x5c112f){return _0xa03387['removeTeams'](_0x155207[_0x9dcf('0x31')][_0x9dcf('0x61')],{'transaction':_0x5c112f})[_0x9dcf('0x24')](function(){if(!_[_0x9dcf('0x7c')](_0x707630)){return _0xa03387['removeAgents'](_0x707630,{'transaction':_0x5c112f});}})[_0x9dcf('0x24')](function(){_0x707630['forEach'](function(_0x3819a4){socket[_0x9dcf('0x68')](_0x9dcf('0x7d'),{'UserId':_0x3819a4,'MailQueueId':_0xa03387['id']});});});});});});})[_0x9dcf('0x24')](respondWithStatusCode(_0x3b6f78,null))[_0x9dcf('0x46')](handleError(_0x3b6f78,null));};exports[_0x9dcf('0x7e')]=function(_0x14fa5f,_0x2c2086,_0xc03e34){return db[_0x9dcf('0x2c')][_0x9dcf('0x45')]({'where':{'id':_0x14fa5f[_0x9dcf('0x4e')]['id']}})[_0x9dcf('0x24')](handleEntityNotFound(_0x2c2086,null))[_0x9dcf('0x24')](function(_0x3b4eca){if(_0x3b4eca){return _0x3b4eca[_0x9dcf('0x7e')](_0x14fa5f[_0x9dcf('0x4d')]['ids'],_[_0x9dcf('0x7f')](_0x14fa5f[_0x9dcf('0x4d')],['ids','id'])||{})[_0x9dcf('0x80')](function(_0x211cf3){for(var _0x1efeff=0x0;_0x1efeff<_0x14fa5f['body'][_0x9dcf('0x61')][_0x9dcf('0x38')];_0x1efeff+=0x1){socket['emit'](_0x9dcf('0x69'),{'UserId':Number(_0x14fa5f[_0x9dcf('0x4d')][_0x9dcf('0x61')][_0x1efeff]),'MailQueueId':Number(_0x14fa5f[_0x9dcf('0x4e')]['id'])});}return _0x211cf3;});}})[_0x9dcf('0x24')](respondWithResult(_0x2c2086,null))[_0x9dcf('0x46')](handleError(_0x2c2086,null));};exports['removeAgents']=function(_0x1db81f,_0x5e27e4,_0x119cc5){return db[_0x9dcf('0x2c')][_0x9dcf('0x45')]({'where':{'id':_0x1db81f[_0x9dcf('0x4e')]['id']}})[_0x9dcf('0x24')](handleEntityNotFound(_0x5e27e4,null))[_0x9dcf('0x24')](function(_0x4f328a){if(_0x4f328a){return _0x4f328a[_0x9dcf('0x81')](_0x1db81f[_0x9dcf('0x31')][_0x9dcf('0x61')])[_0x9dcf('0x24')](function(){if(_['isArray'](_0x1db81f[_0x9dcf('0x31')][_0x9dcf('0x61')])){for(var _0x42edd4=0x0;_0x42edd4<_0x1db81f[_0x9dcf('0x31')][_0x9dcf('0x61')][_0x9dcf('0x38')];_0x42edd4+=0x1){socket[_0x9dcf('0x68')](_0x9dcf('0x7d'),{'UserId':Number(_0x1db81f[_0x9dcf('0x31')][_0x9dcf('0x61')][_0x42edd4]),'MailQueueId':Number(_0x1db81f[_0x9dcf('0x4e')]['id'])});}}else{socket[_0x9dcf('0x68')](_0x9dcf('0x7d'),{'UserId':Number(_0x1db81f[_0x9dcf('0x31')][_0x9dcf('0x61')]),'MailQueueId':Number(_0x1db81f[_0x9dcf('0x4e')]['id'])});}});}})[_0x9dcf('0x24')](respondWithStatusCode(_0x5e27e4,null))['catch'](handleError(_0x5e27e4,null));};exports[_0x9dcf('0x82')]=function(_0x571459,_0x113725,_0x59da12){var _0x271cf2={};var _0x37ae3c={};var _0x742a1d;var _0x4db615;return db[_0x9dcf('0x2c')]['findOne']({'where':{'id':_0x571459[_0x9dcf('0x4e')]['id']}})[_0x9dcf('0x24')](handleEntityNotFound(_0x113725,null))[_0x9dcf('0x24')](function(_0x2080f4){if(_0x2080f4){_0x742a1d=_0x2080f4;_0x37ae3c['model']=_['keys'](db[_0x9dcf('0x56')][_0x9dcf('0x2d')]);_0x37ae3c[_0x9dcf('0x31')]=_[_0x9dcf('0x32')](_0x571459[_0x9dcf('0x31')]);_0x37ae3c[_0x9dcf('0x33')]=_[_0x9dcf('0x34')](_0x37ae3c[_0x9dcf('0x35')],_0x37ae3c[_0x9dcf('0x31')]);_0x271cf2['attributes']=_[_0x9dcf('0x34')](_0x37ae3c['model'],qs[_0x9dcf('0x37')](_0x571459[_0x9dcf('0x31')][_0x9dcf('0x37')]));_0x271cf2[_0x9dcf('0x36')]=_0x271cf2[_0x9dcf('0x36')]['length']?_0x271cf2[_0x9dcf('0x36')]:_0x37ae3c['model'];_0x271cf2['order']=qs[_0x9dcf('0x3b')](_0x571459[_0x9dcf('0x31')]['sort']);_0x271cf2[_0x9dcf('0x3c')]=qs[_0x9dcf('0x33')](_[_0x9dcf('0x3d')](_0x571459['query'],_0x37ae3c[_0x9dcf('0x33')]));if(_0x571459[_0x9dcf('0x31')][_0x9dcf('0x3e')]){_0x271cf2[_0x9dcf('0x3c')]=_['merge'](_0x271cf2[_0x9dcf('0x3c')],{'$or':_[_0x9dcf('0x2b')](_0x271cf2[_0x9dcf('0x36')],function(_0x9b1739){var _0x47a436={};_0x47a436[_0x9b1739]={'$like':'%'+_0x571459[_0x9dcf('0x31')][_0x9dcf('0x3e')]+'%'};return _0x47a436;})});}_0x271cf2=_[_0x9dcf('0x3f')]({},_0x271cf2,_0x571459[_0x9dcf('0x44')]);return _0x742a1d[_0x9dcf('0x82')](_0x271cf2);}})[_0x9dcf('0x24')](function(_0x2da23b){if(_0x2da23b){_0x4db615=_0x2da23b[_0x9dcf('0x38')];if(!_0x571459[_0x9dcf('0x31')][_0x9dcf('0x39')]('nolimit')){_0x271cf2['limit']=qs['limit'](_0x571459[_0x9dcf('0x31')]['limit']);_0x271cf2[_0x9dcf('0x1d')]=qs['offset'](_0x571459[_0x9dcf('0x31')]['offset']);}return _0x742a1d[_0x9dcf('0x82')](_0x271cf2);}})[_0x9dcf('0x24')](function(_0x464fce){if(_0x464fce){return _0x464fce?{'count':_0x4db615,'rows':_0x464fce}:null;}})[_0x9dcf('0x24')](respondWithResult(_0x113725,null))[_0x9dcf('0x46')](handleError(_0x113725,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 625f3f8..df35dac 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 _0xaf83=['emit','hasOwnProperty','hook','events','MailQueue','save','update','remove'];(function(_0x31a8ff,_0x2c5d8e){var _0x4d23b5=function(_0x5acd7d){while(--_0x5acd7d){_0x31a8ff['push'](_0x31a8ff['shift']());}};_0x4d23b5(++_0x2c5d8e);}(_0xaf83,0x1b3));var _0x3af8=function(_0x4a5a67,_0x317c1a){_0x4a5a67=_0x4a5a67-0x0;var _0x140346=_0xaf83[_0x4a5a67];return _0x140346;};'use strict';var EventEmitter=require(_0x3af8('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x3af8('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3af8('0x2'),'afterUpdate':_0x3af8('0x3'),'afterDestroy':_0x3af8('0x4')};function emitEvent(_0x4c8f90){return function(_0x4275bf,_0x3b329d,_0x30031a){MailQueueEvents[_0x3af8('0x5')](_0x4c8f90+':'+_0x4275bf['id'],_0x4275bf);MailQueueEvents['emit'](_0x4c8f90,_0x4275bf);_0x30031a(null);};}for(var e in events){if(events[_0x3af8('0x6')](e)){var event=events[e];MailQueue[_0x3af8('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x7e8d=['../../mysqldb','MailQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x20f511,_0x3e0380){var _0x4364ef=function(_0x28b792){while(--_0x28b792){_0x20f511['push'](_0x20f511['shift']());}};_0x4364ef(++_0x3e0380);}(_0x7e8d,0x12b));var _0xd7e8=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x7e8d[_0x45783c];return _0x1161da;};'use strict';var EventEmitter=require(_0xd7e8('0x0'));var MailQueue=require(_0xd7e8('0x1'))['db'][_0xd7e8('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xd7e8('0x3')](0x0);var events={'afterCreate':_0xd7e8('0x4'),'afterUpdate':_0xd7e8('0x5'),'afterDestroy':'remove'};function emitEvent(_0x423447){return function(_0x3709e2,_0x5264a5,_0x21a750){MailQueueEvents['emit'](_0x423447+':'+_0x3709e2['id'],_0x3709e2);MailQueueEvents[_0xd7e8('0x6')](_0x423447,_0x3709e2);_0x21a750(null);};}for(var e in events){if(events[_0xd7e8('0x7')](e)){var event=events[e];MailQueue[_0xd7e8('0x8')](e,emitEvent(event));}}module[_0xd7e8('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 6c42b86..dc5b3e0 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 _0x0c92=['mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue'];(function(_0x5f2a43,_0x567dbc){var _0x47cb96=function(_0x1a21e6){while(--_0x1a21e6){_0x5f2a43['push'](_0x5f2a43['shift']());}};_0x47cb96(++_0x567dbc);}(_0x0c92,0x7f));var _0x20c9=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x0c92[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x20c9('0x0'));var util=require(_0x20c9('0x1'));var logger=require(_0x20c9('0x2'))(_0x20c9('0x3'));var moment=require(_0x20c9('0x4'));var BPromise=require(_0x20c9('0x5'));var rp=require(_0x20c9('0x6'));var fs=require('fs');var path=require(_0x20c9('0x7'));var rimraf=require(_0x20c9('0x8'));var config=require(_0x20c9('0x9'));var attributes=require(_0x20c9('0xa'));module[_0x20c9('0xb')]=function(_0x2c0a31,_0x5b7c48){return _0x2c0a31['define'](_0x20c9('0xc'),attributes,{'tableName':_0x20c9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcda5=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues','lodash'];(function(_0x35c972,_0x1f478b){var _0x4bdbcc=function(_0x308535){while(--_0x308535){_0x35c972['push'](_0x35c972['shift']());}};_0x4bdbcc(++_0x1f478b);}(_0xcda5,0x1c2));var _0x5cda=function(_0x51cc8a,_0x88ccba){_0x51cc8a=_0x51cc8a-0x0;var _0x1dee11=_0xcda5[_0x51cc8a];return _0x1dee11;};'use strict';var _=require(_0x5cda('0x0'));var util=require('util');var logger=require(_0x5cda('0x1'))('api');var moment=require(_0x5cda('0x2'));var BPromise=require(_0x5cda('0x3'));var rp=require(_0x5cda('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5cda('0x5'));var config=require(_0x5cda('0x6'));var attributes=require(_0x5cda('0x7'));module[_0x5cda('0x8')]=function(_0x51b2cf,_0x7457d1){return _0x51b2cf['define'](_0x5cda('0x9'),attributes,{'tableName':_0x5cda('0xa'),'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 e5cf7dc..61d3b76 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 _0xb9bd=['result','catch','GetMailQueue','MailQueue','raw','options','where','attributes','include','map','model','ShowMailQueue','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent'];(function(_0x3500e7,_0x38ea3b){var _0x177cfe=function(_0x3d112c){while(--_0x3d112c){_0x3500e7['push'](_0x3500e7['shift']());}};_0x177cfe(++_0x38ea3b);}(_0xb9bd,0x9d));var _0xdb9b=function(_0x151c49,_0x3cc0ce){_0x151c49=_0x151c49-0x0;var _0x20e449=_0xb9bd[_0x151c49];return _0x20e449;};'use strict';var _=require(_0xdb9b('0x0'));var util=require(_0xdb9b('0x1'));var moment=require(_0xdb9b('0x2'));var BPromise=require(_0xdb9b('0x3'));var rs=require(_0xdb9b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdb9b('0x5'));var logger=require('../../config/logger')(_0xdb9b('0x6'));var config=require(_0xdb9b('0x7'));var jayson=require(_0xdb9b('0x8'));var client=jayson['client'][_0xdb9b('0x9')]({'port':0x232a});config[_0xdb9b('0xa')]=_['defaults'](config[_0xdb9b('0xa')],{'host':_0xdb9b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdb9b('0xa')]));require(_0xdb9b('0xc'))[_0xdb9b('0xd')](socket);function respondWithRpcPromise(_0x27fbe6,_0x4468bd,_0x15ab10){return new BPromise(function(_0x1977d1,_0x260ec5){return client[_0xdb9b('0xe')](_0x27fbe6,_0x15ab10)[_0xdb9b('0xf')](function(_0x6c67ee){logger[_0xdb9b('0x10')](_0xdb9b('0x11'),_0x4468bd,'request\x20sent');logger['debug'](_0xdb9b('0x12'),_0x4468bd,'request\x20sent',JSON['stringify'](_0x6c67ee));if(_0x6c67ee[_0xdb9b('0x13')]){if(_0x6c67ee['error'][_0xdb9b('0x14')]===0x1f4){logger[_0xdb9b('0x13')](_0xdb9b('0x11'),_0x4468bd,_0x6c67ee[_0xdb9b('0x13')][_0xdb9b('0x15')]);return _0x260ec5(_0x6c67ee['error']['message']);}logger[_0xdb9b('0x13')](_0xdb9b('0x11'),_0x4468bd,_0x6c67ee[_0xdb9b('0x13')][_0xdb9b('0x15')]);return _0x1977d1(_0x6c67ee[_0xdb9b('0x13')][_0xdb9b('0x15')]);}else{logger[_0xdb9b('0x10')](_0xdb9b('0x11'),_0x4468bd,_0xdb9b('0x16'));_0x1977d1(_0x6c67ee[_0xdb9b('0x17')]['message']);}})[_0xdb9b('0x18')](function(_0x23612b){logger['error'](_0xdb9b('0x11'),_0x4468bd,_0x23612b);_0x260ec5(_0x23612b);});});}exports[_0xdb9b('0x19')]=function(_0x4ba079){var _0x513b58=this;return new Promise(function(_0x352c58,_0x248abc){return db[_0xdb9b('0x1a')]['findAll']({'raw':_0x4ba079['options']?_0x4ba079['options'][_0xdb9b('0x1b')]===undefined?!![]:![]:!![],'where':_0x4ba079[_0xdb9b('0x1c')]?_0x4ba079[_0xdb9b('0x1c')][_0xdb9b('0x1d')]||null:null,'attributes':_0x4ba079[_0xdb9b('0x1c')]?_0x4ba079[_0xdb9b('0x1c')][_0xdb9b('0x1e')]||null:null,'limit':_0x4ba079[_0xdb9b('0x1c')]?_0x4ba079['options']['limit']||null:null,'include':_0x4ba079[_0xdb9b('0x1c')]?_0x4ba079[_0xdb9b('0x1c')][_0xdb9b('0x1f')]?_['map'](_0x4ba079[_0xdb9b('0x1c')]['include'],function(_0x4283c7){return{'model':db[_0x4283c7['model']],'as':_0x4283c7['as'],'attributes':_0x4283c7[_0xdb9b('0x1e')],'include':_0x4283c7[_0xdb9b('0x1f')]?_[_0xdb9b('0x20')](_0x4283c7[_0xdb9b('0x1f')],function(_0x1ac9e6){return{'model':db[_0x1ac9e6[_0xdb9b('0x21')]],'as':_0x1ac9e6['as'],'attributes':_0x1ac9e6[_0xdb9b('0x1e')],'include':_0x1ac9e6[_0xdb9b('0x1f')]?_[_0xdb9b('0x20')](_0x1ac9e6[_0xdb9b('0x1f')],function(_0xc7af3){return{'model':db[_0xc7af3[_0xdb9b('0x21')]],'as':_0xc7af3['as'],'attributes':_0xc7af3['attributes']};}):[]};}):[]};}):[]:[]})[_0xdb9b('0xf')](function(_0x2dd6d0){logger[_0xdb9b('0x10')](_0xdb9b('0x19'),_0x4ba079);logger['debug'](_0xdb9b('0x19'),_0x4ba079,JSON['stringify'](_0x2dd6d0));_0x352c58(_0x2dd6d0);})[_0xdb9b('0x18')](function(_0x2a5f4b){logger[_0xdb9b('0x13')]('GetMailQueue',_0x2a5f4b['message'],_0x4ba079);_0x248abc(_0x513b58[_0xdb9b('0x13')](0x1f4,_0x2a5f4b[_0xdb9b('0x15')]));});});};exports[_0xdb9b('0x22')]=function(_0x34656a){var _0x3237d0=this;return new Promise(function(_0x435be4,_0x23a86c){return db['MailQueue']['find']({'raw':_0x34656a[_0xdb9b('0x1c')]?_0x34656a['options'][_0xdb9b('0x1b')]===undefined?!![]:![]:!![],'where':_0x34656a['options']?_0x34656a['options'][_0xdb9b('0x1d')]||null:null,'attributes':_0x34656a[_0xdb9b('0x1c')]?_0x34656a[_0xdb9b('0x1c')][_0xdb9b('0x1e')]||null:null,'include':_0x34656a[_0xdb9b('0x1c')]?_0x34656a[_0xdb9b('0x1c')]['include']?_['map'](_0x34656a[_0xdb9b('0x1c')][_0xdb9b('0x1f')],function(_0xf18ccd){return{'model':db[_0xf18ccd[_0xdb9b('0x21')]],'as':_0xf18ccd['as'],'attributes':_0xf18ccd[_0xdb9b('0x1e')],'include':_0xf18ccd[_0xdb9b('0x1f')]?_[_0xdb9b('0x20')](_0xf18ccd['include'],function(_0x2e33ee){return{'model':db[_0x2e33ee[_0xdb9b('0x21')]],'as':_0x2e33ee['as'],'attributes':_0x2e33ee['attributes'],'include':_0x2e33ee[_0xdb9b('0x1f')]?_[_0xdb9b('0x20')](_0x2e33ee[_0xdb9b('0x1f')],function(_0x48a114){return{'model':db[_0x48a114[_0xdb9b('0x21')]],'as':_0x48a114['as'],'attributes':_0x48a114[_0xdb9b('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x225062){logger[_0xdb9b('0x10')](_0xdb9b('0x22'),_0x34656a);logger[_0xdb9b('0x23')](_0xdb9b('0x22'),_0x34656a,JSON['stringify'](_0x225062));_0x435be4(_0x225062);})[_0xdb9b('0x18')](function(_0x3bf337){logger[_0xdb9b('0x13')](_0xdb9b('0x22'),_0x3bf337[_0xdb9b('0x15')],_0x34656a);_0x23a86c(_0x3237d0[_0xdb9b('0x13')](0x1f4,_0x3bf337['message']));});});}; \ No newline at end of file +var _0xb0bb=['message','request\x20sent','result','GetMailQueue','MailQueue','options','raw','where','attributes','include','map','model','catch','ShowMailQueue','stringify','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','MailQueue,\x20%s,\x20%s'];(function(_0x5c1345,_0x40116e){var _0x1c070d=function(_0x1e862f){while(--_0x1e862f){_0x5c1345['push'](_0x5c1345['shift']());}};_0x1c070d(++_0x40116e);}(_0xb0bb,0xaf));var _0xbb0b=function(_0x2d47f8,_0x517e15){_0x2d47f8=_0x2d47f8-0x0;var _0x3d5152=_0xb0bb[_0x2d47f8];return _0x3d5152;};'use strict';var _=require(_0xbb0b('0x0'));var util=require(_0xbb0b('0x1'));var moment=require(_0xbb0b('0x2'));var BPromise=require(_0xbb0b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb0b('0x4'))['db'];var utils=require(_0xbb0b('0x5'));var logger=require(_0xbb0b('0x6'))(_0xbb0b('0x7'));var config=require('../../config/environment');var jayson=require(_0xbb0b('0x8'));var client=jayson[_0xbb0b('0x9')][_0xbb0b('0xa')]({'port':0x232a});config[_0xbb0b('0xb')]=_[_0xbb0b('0xc')](config[_0xbb0b('0xb')],{'host':_0xbb0b('0xd'),'port':0x18eb});var socket=require(_0xbb0b('0xe'))(new Redis(config[_0xbb0b('0xb')]));require(_0xbb0b('0xf'))[_0xbb0b('0x10')](socket);function respondWithRpcPromise(_0x43575e,_0x435b6d,_0x9a38d7){return new BPromise(function(_0x5dfe73,_0x39a9ee){return client[_0xbb0b('0x11')](_0x43575e,_0x9a38d7)[_0xbb0b('0x12')](function(_0x3e3294){logger[_0xbb0b('0x13')]('MailQueue,\x20%s,\x20%s',_0x435b6d,'request\x20sent');logger[_0xbb0b('0x14')](_0xbb0b('0x15'),_0x435b6d,'request\x20sent',JSON['stringify'](_0x3e3294));if(_0x3e3294[_0xbb0b('0x16')]){if(_0x3e3294[_0xbb0b('0x16')][_0xbb0b('0x17')]===0x1f4){logger[_0xbb0b('0x16')](_0xbb0b('0x18'),_0x435b6d,_0x3e3294[_0xbb0b('0x16')][_0xbb0b('0x19')]);return _0x39a9ee(_0x3e3294[_0xbb0b('0x16')][_0xbb0b('0x19')]);}logger['error'](_0xbb0b('0x18'),_0x435b6d,_0x3e3294[_0xbb0b('0x16')][_0xbb0b('0x19')]);return _0x5dfe73(_0x3e3294[_0xbb0b('0x16')][_0xbb0b('0x19')]);}else{logger[_0xbb0b('0x13')]('MailQueue,\x20%s,\x20%s',_0x435b6d,_0xbb0b('0x1a'));_0x5dfe73(_0x3e3294[_0xbb0b('0x1b')][_0xbb0b('0x19')]);}})['catch'](function(_0x432d14){logger[_0xbb0b('0x16')](_0xbb0b('0x18'),_0x435b6d,_0x432d14);_0x39a9ee(_0x432d14);});});}exports[_0xbb0b('0x1c')]=function(_0x1a9213){var _0x57d3b3=this;return new Promise(function(_0x58ca8c,_0x20f7e4){return db[_0xbb0b('0x1d')]['findAll']({'raw':_0x1a9213['options']?_0x1a9213[_0xbb0b('0x1e')][_0xbb0b('0x1f')]===undefined?!![]:![]:!![],'where':_0x1a9213['options']?_0x1a9213[_0xbb0b('0x1e')][_0xbb0b('0x20')]||null:null,'attributes':_0x1a9213['options']?_0x1a9213[_0xbb0b('0x1e')][_0xbb0b('0x21')]||null:null,'limit':_0x1a9213['options']?_0x1a9213[_0xbb0b('0x1e')]['limit']||null:null,'include':_0x1a9213[_0xbb0b('0x1e')]?_0x1a9213[_0xbb0b('0x1e')][_0xbb0b('0x22')]?_['map'](_0x1a9213[_0xbb0b('0x1e')]['include'],function(_0x1a50a4){return{'model':db[_0x1a50a4['model']],'as':_0x1a50a4['as'],'attributes':_0x1a50a4[_0xbb0b('0x21')],'include':_0x1a50a4[_0xbb0b('0x22')]?_[_0xbb0b('0x23')](_0x1a50a4['include'],function(_0x1788e7){return{'model':db[_0x1788e7['model']],'as':_0x1788e7['as'],'attributes':_0x1788e7[_0xbb0b('0x21')],'include':_0x1788e7['include']?_[_0xbb0b('0x23')](_0x1788e7[_0xbb0b('0x22')],function(_0xdd48d8){return{'model':db[_0xdd48d8[_0xbb0b('0x24')]],'as':_0xdd48d8['as'],'attributes':_0xdd48d8[_0xbb0b('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20965c){logger[_0xbb0b('0x13')](_0xbb0b('0x1c'),_0x1a9213);logger[_0xbb0b('0x14')]('GetMailQueue',_0x1a9213,JSON['stringify'](_0x20965c));_0x58ca8c(_0x20965c);})[_0xbb0b('0x25')](function(_0x19965b){logger[_0xbb0b('0x16')](_0xbb0b('0x1c'),_0x19965b[_0xbb0b('0x19')],_0x1a9213);_0x20f7e4(_0x57d3b3['error'](0x1f4,_0x19965b[_0xbb0b('0x19')]));});});};exports[_0xbb0b('0x26')]=function(_0x23c80c){var _0x2cdfcc=this;return new Promise(function(_0x165426,_0x370bd1){return db[_0xbb0b('0x1d')]['find']({'raw':_0x23c80c['options']?_0x23c80c['options'][_0xbb0b('0x1f')]===undefined?!![]:![]:!![],'where':_0x23c80c[_0xbb0b('0x1e')]?_0x23c80c[_0xbb0b('0x1e')][_0xbb0b('0x20')]||null:null,'attributes':_0x23c80c[_0xbb0b('0x1e')]?_0x23c80c[_0xbb0b('0x1e')][_0xbb0b('0x21')]||null:null,'include':_0x23c80c['options']?_0x23c80c[_0xbb0b('0x1e')]['include']?_['map'](_0x23c80c[_0xbb0b('0x1e')][_0xbb0b('0x22')],function(_0x40fb38){return{'model':db[_0x40fb38['model']],'as':_0x40fb38['as'],'attributes':_0x40fb38['attributes'],'include':_0x40fb38[_0xbb0b('0x22')]?_[_0xbb0b('0x23')](_0x40fb38[_0xbb0b('0x22')],function(_0x4b2f09){return{'model':db[_0x4b2f09[_0xbb0b('0x24')]],'as':_0x4b2f09['as'],'attributes':_0x4b2f09[_0xbb0b('0x21')],'include':_0x4b2f09['include']?_['map'](_0x4b2f09[_0xbb0b('0x22')],function(_0x58fb21){return{'model':db[_0x58fb21['model']],'as':_0x58fb21['as'],'attributes':_0x58fb21['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb0b('0x12')](function(_0x5c7ac1){logger[_0xbb0b('0x13')](_0xbb0b('0x26'),_0x23c80c);logger[_0xbb0b('0x14')]('ShowMailQueue',_0x23c80c,JSON[_0xbb0b('0x27')](_0x5c7ac1));_0x165426(_0x5c7ac1);})['catch'](function(_0x352cc1){logger[_0xbb0b('0x16')](_0xbb0b('0x26'),_0x352cc1[_0xbb0b('0x19')],_0x23c80c);_0x370bd1(_0x2cdfcc[_0xbb0b('0x16')](0x1f4,_0x352cc1[_0xbb0b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 6dc23fc..40a3261 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 _0x5a93=['save','remove','removeListener','length','mailQueue:','./mailQueue.events'];(function(_0x442ede,_0x2c3376){var _0x3b7c68=function(_0x4fd896){while(--_0x4fd896){_0x442ede['push'](_0x442ede['shift']());}};_0x3b7c68(++_0x2c3376);}(_0x5a93,0x149));var _0x35a9=function(_0x4cbb68,_0x390087){_0x4cbb68=_0x4cbb68-0x0;var _0x18f742=_0x5a93[_0x4cbb68];return _0x18f742;};'use strict';var MailQueueEvents=require(_0x35a9('0x0'));var events=[_0x35a9('0x1'),_0x35a9('0x2'),'update'];function createListener(_0x10638a,_0x38d80e){return function(_0x78c05b){_0x38d80e['emit'](_0x10638a,_0x78c05b);};}function removeListener(_0x89a89b,_0x4a30ba){return function(){MailQueueEvents[_0x35a9('0x3')](_0x89a89b,_0x4a30ba);};}exports['register']=function(_0xb9c65f){for(var _0x1c6096=0x0,_0x24e77f=events[_0x35a9('0x4')];_0x1c6096<_0x24e77f;_0x1c6096++){var _0x521c31=events[_0x1c6096];var _0x23a364=createListener(_0x35a9('0x5')+_0x521c31,_0xb9c65f);MailQueueEvents['on'](_0x521c31,_0x23a364);}}; \ No newline at end of file +var _0xe36c=['remove','emit','./mailQueue.events','save'];(function(_0x225915,_0x2eaa2f){var _0x3b8d10=function(_0x4c9dd5){while(--_0x4c9dd5){_0x225915['push'](_0x225915['shift']());}};_0x3b8d10(++_0x2eaa2f);}(_0xe36c,0x17a));var _0xce36=function(_0x389028,_0x2cbeff){_0x389028=_0x389028-0x0;var _0xc511d9=_0xe36c[_0x389028];return _0xc511d9;};'use strict';var MailQueueEvents=require(_0xce36('0x0'));var events=[_0xce36('0x1'),_0xce36('0x2'),'update'];function createListener(_0x18a5cb,_0x49995a){return function(_0x44bd5f){_0x49995a[_0xce36('0x3')](_0x18a5cb,_0x44bd5f);};}function removeListener(_0x3e7bb1,_0x44fda3){return function(){MailQueueEvents['removeListener'](_0x3e7bb1,_0x44fda3);};}exports['register']=function(_0x4091a2){for(var _0x53f911=0x0,_0x19db17=events['length'];_0x53f911<_0x19db17;_0x53f911++){var _0x3fa90b=events[_0x53f911];var _0x5b11f2=createListener('mailQueue:'+_0x3fa90b,_0x4091a2);MailQueueEvents['on'](_0x3fa90b,_0x5b11f2);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 80e064b..2323bd4 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 _0xa2fb=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','destroy','exports'];(function(_0x7bb7f6,_0x53064e){var _0x53e1ea=function(_0x1871b6){while(--_0x1871b6){_0x7bb7f6['push'](_0x7bb7f6['shift']());}};_0x53e1ea(++_0x53064e);}(_0xa2fb,0x18f));var _0xba2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa2fb[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xba2f('0x0'));var path=require(_0xba2f('0x1'));var timeout=require(_0xba2f('0x2'));var express=require(_0xba2f('0x3'));var router=express[_0xba2f('0x4')]();var fs_extra=require(_0xba2f('0x5'));var auth=require(_0xba2f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xba2f('0x7'));var controller=require(_0xba2f('0x8'));router[_0xba2f('0x9')]('/',auth[_0xba2f('0xa')](),controller[_0xba2f('0xb')]);router[_0xba2f('0x9')](_0xba2f('0xc'),auth[_0xba2f('0xa')](),controller[_0xba2f('0xd')]);router[_0xba2f('0x9')](_0xba2f('0xe'),auth['isAuthenticated'](),controller[_0xba2f('0xf')]);router[_0xba2f('0x10')]('/',auth[_0xba2f('0xa')](),controller[_0xba2f('0x11')]);router[_0xba2f('0x12')](_0xba2f('0xe'),auth[_0xba2f('0xa')](),controller['update']);router['delete'](_0xba2f('0xe'),auth[_0xba2f('0xa')](),controller[_0xba2f('0x13')]);module[_0xba2f('0x14')]=router; \ No newline at end of file +var _0xdc9e=['path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','multer'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xdc9e,0x1af));var _0xedc9=function(_0x92342b,_0x4b1810){_0x92342b=_0x92342b-0x0;var _0x44a822=_0xdc9e[_0x92342b];return _0x44a822;};'use strict';var multer=require(_0xedc9('0x0'));var util=require('util');var path=require(_0xedc9('0x1'));var timeout=require(_0xedc9('0x2'));var express=require('express');var router=express[_0xedc9('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xedc9('0x4'));var config=require(_0xedc9('0x5'));var controller=require(_0xedc9('0x6'));router[_0xedc9('0x7')]('/',auth[_0xedc9('0x8')](),controller[_0xedc9('0x9')]);router['get']('/describe',auth[_0xedc9('0x8')](),controller['describe']);router[_0xedc9('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xedc9('0xa')]);router[_0xedc9('0xb')]('/',auth[_0xedc9('0x8')](),controller[_0xedc9('0xc')]);router[_0xedc9('0xd')](_0xedc9('0xe'),auth['isAuthenticated'](),controller[_0xedc9('0xf')]);router[_0xedc9('0x10')]('/:id',auth[_0xedc9('0x8')](),controller['destroy']);module[_0xedc9('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index df3224a..e80383d 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 _0xd04c=['DATE','moment','sequelize','exports','STRING'];(function(_0x2e9951,_0x33ca79){var _0xd7caa1=function(_0x23a3fc){while(--_0x23a3fc){_0x2e9951['push'](_0x2e9951['shift']());}};_0xd7caa1(++_0x33ca79);}(_0xd04c,0xd3));var _0xcd04=function(_0x199e43,_0x3a39f3){_0x199e43=_0x199e43-0x0;var _0x551f37=_0xd04c[_0x199e43];return _0x551f37;};'use strict';var moment=require(_0xcd04('0x0'));var Sequelize=require(_0xcd04('0x1'));module[_0xcd04('0x2')]={'uniqueid':{'type':Sequelize[_0xcd04('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xcd04('0x3')]},'joinAt':{'type':Sequelize[_0xcd04('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xcd04('0x4')]},'exitAt':{'type':Sequelize[_0xcd04('0x4')]},'reason':{'type':Sequelize[_0xcd04('0x3')]}}; \ No newline at end of file +var _0xf3e5=['moment','exports','STRING','DATE'];(function(_0x5df59f,_0xf11a72){var _0x190e3b=function(_0x2b983e){while(--_0x2b983e){_0x5df59f['push'](_0x5df59f['shift']());}};_0x190e3b(++_0xf11a72);}(_0xf3e5,0x188));var _0x5f3e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xf3e5[_0xbb091];return _0x467a04;};'use strict';var moment=require(_0x5f3e('0x0'));var Sequelize=require('sequelize');module[_0x5f3e('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5f3e('0x2')]},'joinAt':{'type':Sequelize[_0x5f3e('0x3')]},'leaveAt':{'type':Sequelize[_0x5f3e('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x5f3e('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 9af3be7..8976a94 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 _0x5430=['update','then','destroy','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','merge','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','save'];(function(_0x10dd97,_0x5aa5d8){var _0x5ed455=function(_0x2e81ce){while(--_0x2e81ce){_0x10dd97['push'](_0x10dd97['shift']());}};_0x5ed455(++_0x5aa5d8);}(_0x5430,0x10c));var _0x0543=function(_0x387d2e,_0x42c98c){_0x387d2e=_0x387d2e-0x0;var _0x5719a1=_0x5430[_0x387d2e];return _0x5719a1;};'use strict';var emlformat=require(_0x0543('0x0'));var rimraf=require(_0x0543('0x1'));var zipdir=require(_0x0543('0x2'));var jsonpatch=require(_0x0543('0x3'));var rp=require(_0x0543('0x4'));var moment=require(_0x0543('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0543('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0543('0x7'));var ejs=require(_0x0543('0x8'));var fs=require('fs');var fs_extra=require(_0x0543('0x9'));var _=require(_0x0543('0xa'));var squel=require(_0x0543('0xb'));var crypto=require('crypto');var jsforce=require(_0x0543('0xc'));var deskjs=require(_0x0543('0xd'));var toCsv=require(_0x0543('0x7'));var querystring=require(_0x0543('0xe'));var Papa=require(_0x0543('0xf'));var Redis=require(_0x0543('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0543('0x11'));var as=require(_0x0543('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0543('0x13'))(_0x0543('0x14'));var utils=require(_0x0543('0x15'));var config=require(_0x0543('0x16'));var licenseUtil=require(_0x0543('0x17'));var db=require(_0x0543('0x18'))['db'];function respondWithStatusCode(_0x30c54e,_0x27290d){_0x27290d=_0x27290d||0xcc;return function(_0x46d176){if(_0x46d176){return _0x30c54e[_0x0543('0x19')](_0x27290d);}return _0x30c54e[_0x0543('0x1a')](_0x27290d)[_0x0543('0x1b')]();};}function respondWithResult(_0x552980,_0x4f1f2a){_0x4f1f2a=_0x4f1f2a||0xc8;return function(_0x21e9ac){if(_0x21e9ac){return _0x552980['status'](_0x4f1f2a)['json'](_0x21e9ac);}};}function respondWithFilteredResult(_0xcb09df,_0x40fb03){return function(_0x1dff7d){if(_0x1dff7d){var _0x1cfadf=typeof _0x40fb03[_0x0543('0x1c')]==='undefined'&&typeof _0x40fb03[_0x0543('0x1d')]===_0x0543('0x1e');var _0x2dd5cb=_0x1dff7d[_0x0543('0x1f')];var _0x20b396=_0x1cfadf?0x0:_0x40fb03[_0x0543('0x1c')];var _0x577cf0=_0x1cfadf?_0x1dff7d['count']:_0x40fb03[_0x0543('0x1c')]+_0x40fb03['limit'];var _0x50ea84;if(_0x577cf0>=_0x2dd5cb){_0x577cf0=_0x2dd5cb;_0x50ea84=0xc8;}else{_0x50ea84=0xce;}_0xcb09df[_0x0543('0x1a')](_0x50ea84);return _0xcb09df[_0x0543('0x20')](_0x0543('0x21'),_0x20b396+'-'+_0x577cf0+'/'+_0x2dd5cb)['json'](_0x1dff7d);}return null;};}function patchUpdates(_0x3f0452){return function(_0x51c271){try{jsonpatch[_0x0543('0x22')](_0x51c271,_0x3f0452,!![]);}catch(_0x411ec2){return BPromise['reject'](_0x411ec2);}return _0x51c271[_0x0543('0x23')]();};}function saveUpdates(_0x333c72,_0x427919){return function(_0x110060){if(_0x110060){return _0x110060[_0x0543('0x24')](_0x333c72)[_0x0543('0x25')](function(_0x4adba7){return _0x4adba7;});}return null;};}function removeEntity(_0x5979d2,_0x59f1b2){return function(_0xbfe5dc){if(_0xbfe5dc){return _0xbfe5dc[_0x0543('0x26')]()[_0x0543('0x25')](function(){_0x5979d2[_0x0543('0x1a')](0xcc)[_0x0543('0x1b')]();});}};}function handleEntityNotFound(_0x26e500,_0x36d824){return function(_0x17a3de){if(!_0x17a3de){_0x26e500[_0x0543('0x19')](0x194);}return _0x17a3de;};}function handleError(_0xf1eccf,_0x40a261){_0x40a261=_0x40a261||0x1f4;return function(_0x21fc63){logger['error'](_0x21fc63[_0x0543('0x27')]);if(_0x21fc63[_0x0543('0x28')]){delete _0x21fc63[_0x0543('0x28')];}_0xf1eccf['status'](_0x40a261)[_0x0543('0x29')](_0x21fc63);};}exports[_0x0543('0x2a')]=function(_0x41c4a7,_0x10b881){var _0x5dd789={},_0x1732be={},_0x10b9f3={'count':0x0,'rows':[]};var _0x492f60=_['map'](db[_0x0543('0x2b')][_0x0543('0x2c')],function(_0x51d49d){return{'name':_0x51d49d[_0x0543('0x2d')],'type':_0x51d49d[_0x0543('0x2e')][_0x0543('0x2f')]};});_0x1732be[_0x0543('0x30')]=_[_0x0543('0x31')](_0x492f60,_0x0543('0x28'));_0x1732be[_0x0543('0x32')]=_['keys'](_0x41c4a7[_0x0543('0x32')]);_0x1732be['filters']=_[_0x0543('0x33')](_0x1732be[_0x0543('0x30')],_0x1732be[_0x0543('0x32')]);_0x5dd789[_0x0543('0x34')]=_[_0x0543('0x33')](_0x1732be['model'],qs[_0x0543('0x35')](_0x41c4a7['query'][_0x0543('0x35')]));_0x5dd789[_0x0543('0x34')]=_0x5dd789[_0x0543('0x34')][_0x0543('0x36')]?_0x5dd789['attributes']:_0x1732be[_0x0543('0x30')];if(!_0x41c4a7['query'][_0x0543('0x37')](_0x0543('0x38'))){_0x5dd789[_0x0543('0x1d')]=qs[_0x0543('0x1d')](_0x41c4a7[_0x0543('0x32')][_0x0543('0x1d')]);_0x5dd789[_0x0543('0x1c')]=qs[_0x0543('0x1c')](_0x41c4a7[_0x0543('0x32')][_0x0543('0x1c')]);}_0x5dd789['order']=qs[_0x0543('0x39')](_0x41c4a7[_0x0543('0x32')]['sort']);_0x5dd789[_0x0543('0x3a')]=qs['filters'](_[_0x0543('0x3b')](_0x41c4a7[_0x0543('0x32')],_0x1732be['filters']),_0x492f60);if(_0x41c4a7['query'][_0x0543('0x3c')]){_0x5dd789[_0x0543('0x3a')]=_['merge'](_0x5dd789[_0x0543('0x3a')],{'$or':_[_0x0543('0x31')](_0x492f60,function(_0x54543f){if(_0x54543f[_0x0543('0x2e')]!==_0x0543('0x3d')){var _0x3ecd70={};_0x3ecd70[_0x54543f[_0x0543('0x28')]]={'$like':'%'+_0x41c4a7[_0x0543('0x32')]['filter']+'%'};return _0x3ecd70;}})});}_0x5dd789=_['merge']({},_0x5dd789,_0x41c4a7['options']);var _0x486d9c={'where':_0x5dd789[_0x0543('0x3a')]};return db[_0x0543('0x2b')][_0x0543('0x1f')](_0x486d9c)['then'](function(_0xc66396){_0x10b9f3[_0x0543('0x1f')]=_0xc66396;if(_0x41c4a7[_0x0543('0x32')][_0x0543('0x3e')]){_0x5dd789[_0x0543('0x3f')]=[{'all':!![]}];}return db[_0x0543('0x2b')][_0x0543('0x40')](_0x5dd789);})['then'](function(_0x24a891){_0x10b9f3[_0x0543('0x41')]=_0x24a891;return _0x10b9f3;})[_0x0543('0x25')](respondWithFilteredResult(_0x10b881,_0x5dd789))[_0x0543('0x42')](handleError(_0x10b881,null));};exports[_0x0543('0x43')]=function(_0x43b7e8,_0x5bf53d){var _0x53dfb8={'raw':!![],'where':{'id':_0x43b7e8[_0x0543('0x44')]['id']}},_0x44116a={};_0x44116a[_0x0543('0x30')]=_[_0x0543('0x45')](db[_0x0543('0x2b')][_0x0543('0x2c')]);_0x44116a[_0x0543('0x32')]=_[_0x0543('0x45')](_0x43b7e8[_0x0543('0x32')]);_0x44116a['filters']=_['intersection'](_0x44116a[_0x0543('0x30')],_0x44116a[_0x0543('0x32')]);_0x53dfb8['attributes']=_['intersection'](_0x44116a[_0x0543('0x30')],qs[_0x0543('0x35')](_0x43b7e8['query'][_0x0543('0x35')]));_0x53dfb8['attributes']=_0x53dfb8[_0x0543('0x34')][_0x0543('0x36')]?_0x53dfb8['attributes']:_0x44116a['model'];if(_0x43b7e8[_0x0543('0x32')]['includeAll']){_0x53dfb8[_0x0543('0x3f')]=[{'all':!![]}];}_0x53dfb8=_[_0x0543('0x46')]({},_0x53dfb8,_0x43b7e8[_0x0543('0x47')]);return db[_0x0543('0x2b')][_0x0543('0x48')](_0x53dfb8)[_0x0543('0x25')](handleEntityNotFound(_0x5bf53d,null))['then'](respondWithResult(_0x5bf53d,null))[_0x0543('0x42')](handleError(_0x5bf53d,null));};exports[_0x0543('0x49')]=function(_0xb8076c,_0xf0a28f){return db[_0x0543('0x2b')]['create'](_0xb8076c[_0x0543('0x4a')],{})['then'](respondWithResult(_0xf0a28f,0xc9))[_0x0543('0x42')](handleError(_0xf0a28f,null));};exports[_0x0543('0x24')]=function(_0x3f4c40,_0x46d398){if(_0x3f4c40[_0x0543('0x4a')]['id']){delete _0x3f4c40[_0x0543('0x4a')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x3f4c40['params']['id']}})[_0x0543('0x25')](handleEntityNotFound(_0x46d398,null))[_0x0543('0x25')](saveUpdates(_0x3f4c40['body'],null))[_0x0543('0x25')](respondWithResult(_0x46d398,null))[_0x0543('0x42')](handleError(_0x46d398,null));};exports[_0x0543('0x26')]=function(_0x3d3bfc,_0x90dd22){return db[_0x0543('0x2b')]['find']({'where':{'id':_0x3d3bfc[_0x0543('0x44')]['id']}})[_0x0543('0x25')](handleEntityNotFound(_0x90dd22,null))[_0x0543('0x25')](removeEntity(_0x90dd22,null))[_0x0543('0x42')](handleError(_0x90dd22,null));};exports[_0x0543('0x4b')]=function(_0x449150,_0x265bc1){return db[_0x0543('0x2b')][_0x0543('0x4b')]()[_0x0543('0x25')](respondWithResult(_0x265bc1,null))[_0x0543('0x42')](handleError(_0x265bc1,null));}; \ No newline at end of file +var _0x0adf=['find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','MailQueueReport','count','includeAll','include','findAll','rows','catch','show','params','fields'];(function(_0x2fc960,_0x5219db){var _0x3072a7=function(_0x3f6730){while(--_0x3f6730){_0x2fc960['push'](_0x2fc960['shift']());}};_0x3072a7(++_0x5219db);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x46ff97,_0x5b3ad6){_0x46ff97=_0x46ff97-0x0;var _0x42c816=_0x0adf[_0x46ff97];return _0x42c816;};'use strict';var emlformat=require(_0xf0ad('0x0'));var rimraf=require(_0xf0ad('0x1'));var zipdir=require(_0xf0ad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf0ad('0x3'));var moment=require(_0xf0ad('0x4'));var BPromise=require(_0xf0ad('0x5'));var Mustache=require(_0xf0ad('0x6'));var util=require(_0xf0ad('0x7'));var path=require(_0xf0ad('0x8'));var sox=require(_0xf0ad('0x9'));var csv=require('to-csv');var ejs=require(_0xf0ad('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf0ad('0xb'));var squel=require(_0xf0ad('0xc'));var crypto=require(_0xf0ad('0xd'));var jsforce=require(_0xf0ad('0xe'));var deskjs=require(_0xf0ad('0xf'));var toCsv=require(_0xf0ad('0x10'));var querystring=require(_0xf0ad('0x11'));var Papa=require('papaparse');var Redis=require(_0xf0ad('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf0ad('0x13'));var as=require(_0xf0ad('0x14'));var hardwareService=require(_0xf0ad('0x15'));var logger=require(_0xf0ad('0x16'))(_0xf0ad('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf0ad('0x18'));var db=require(_0xf0ad('0x19'))['db'];function respondWithStatusCode(_0x3646a2,_0x238c3b){_0x238c3b=_0x238c3b||0xcc;return function(_0x597c40){if(_0x597c40){return _0x3646a2[_0xf0ad('0x1a')](_0x238c3b);}return _0x3646a2[_0xf0ad('0x1b')](_0x238c3b)['end']();};}function respondWithResult(_0x49df92,_0x5332e9){_0x5332e9=_0x5332e9||0xc8;return function(_0x221d7b){if(_0x221d7b){return _0x49df92['status'](_0x5332e9)[_0xf0ad('0x1c')](_0x221d7b);}};}function respondWithFilteredResult(_0x313ad6,_0xfa544c){return function(_0xfa829e){if(_0xfa829e){var _0x237dd9=typeof _0xfa544c['offset']===_0xf0ad('0x1d')&&typeof _0xfa544c[_0xf0ad('0x1e')]===_0xf0ad('0x1d');var _0x1c9fac=_0xfa829e['count'];var _0x4e9970=_0x237dd9?0x0:_0xfa544c[_0xf0ad('0x1f')];var _0x46fb20=_0x237dd9?_0xfa829e['count']:_0xfa544c[_0xf0ad('0x1f')]+_0xfa544c[_0xf0ad('0x1e')];var _0x9a95bf;if(_0x46fb20>=_0x1c9fac){_0x46fb20=_0x1c9fac;_0x9a95bf=0xc8;}else{_0x9a95bf=0xce;}_0x313ad6[_0xf0ad('0x1b')](_0x9a95bf);return _0x313ad6['set']('Content-Range',_0x4e9970+'-'+_0x46fb20+'/'+_0x1c9fac)[_0xf0ad('0x1c')](_0xfa829e);}return null;};}function patchUpdates(_0x2da425){return function(_0x37b968){try{jsonpatch[_0xf0ad('0x20')](_0x37b968,_0x2da425,!![]);}catch(_0x2ac8ba){return BPromise[_0xf0ad('0x21')](_0x2ac8ba);}return _0x37b968['save']();};}function saveUpdates(_0x33c95d,_0x16e62a){return function(_0x31635b){if(_0x31635b){return _0x31635b[_0xf0ad('0x22')](_0x33c95d)[_0xf0ad('0x23')](function(_0x88b47b){return _0x88b47b;});}return null;};}function removeEntity(_0xb91769,_0x276322){return function(_0x3fc97e){if(_0x3fc97e){return _0x3fc97e[_0xf0ad('0x24')]()[_0xf0ad('0x23')](function(){_0xb91769[_0xf0ad('0x1b')](0xcc)[_0xf0ad('0x25')]();});}};}function handleEntityNotFound(_0x456f81,_0x879f89){return function(_0x557f90){if(!_0x557f90){_0x456f81[_0xf0ad('0x1a')](0x194);}return _0x557f90;};}function handleError(_0x1507a3,_0x248794){_0x248794=_0x248794||0x1f4;return function(_0x7377d7){logger[_0xf0ad('0x26')](_0x7377d7[_0xf0ad('0x27')]);if(_0x7377d7['name']){delete _0x7377d7[_0xf0ad('0x28')];}_0x1507a3[_0xf0ad('0x1b')](_0x248794)[_0xf0ad('0x29')](_0x7377d7);};}exports[_0xf0ad('0x2a')]=function(_0x1b6880,_0x1ac25c){var _0x267b7a={},_0x1bee71={},_0x2386e8={'count':0x0,'rows':[]};var _0x39c46c=_[_0xf0ad('0x2b')](db['MailQueueReport'][_0xf0ad('0x2c')],function(_0x5f5115){return{'name':_0x5f5115[_0xf0ad('0x2d')],'type':_0x5f5115['type'][_0xf0ad('0x2e')]};});_0x1bee71[_0xf0ad('0x2f')]=_[_0xf0ad('0x2b')](_0x39c46c,_0xf0ad('0x28'));_0x1bee71[_0xf0ad('0x30')]=_[_0xf0ad('0x31')](_0x1b6880[_0xf0ad('0x30')]);_0x1bee71[_0xf0ad('0x32')]=_['intersection'](_0x1bee71['model'],_0x1bee71[_0xf0ad('0x30')]);_0x267b7a[_0xf0ad('0x33')]=_[_0xf0ad('0x34')](_0x1bee71[_0xf0ad('0x2f')],qs['fields'](_0x1b6880[_0xf0ad('0x30')]['fields']));_0x267b7a[_0xf0ad('0x33')]=_0x267b7a['attributes'][_0xf0ad('0x35')]?_0x267b7a['attributes']:_0x1bee71[_0xf0ad('0x2f')];if(!_0x1b6880[_0xf0ad('0x30')][_0xf0ad('0x36')](_0xf0ad('0x37'))){_0x267b7a[_0xf0ad('0x1e')]=qs[_0xf0ad('0x1e')](_0x1b6880[_0xf0ad('0x30')][_0xf0ad('0x1e')]);_0x267b7a['offset']=qs[_0xf0ad('0x1f')](_0x1b6880['query'][_0xf0ad('0x1f')]);}_0x267b7a['order']=qs[_0xf0ad('0x38')](_0x1b6880[_0xf0ad('0x30')][_0xf0ad('0x38')]);_0x267b7a[_0xf0ad('0x39')]=qs[_0xf0ad('0x32')](_['pick'](_0x1b6880[_0xf0ad('0x30')],_0x1bee71[_0xf0ad('0x32')]),_0x39c46c);if(_0x1b6880[_0xf0ad('0x30')][_0xf0ad('0x3a')]){_0x267b7a[_0xf0ad('0x39')]=_[_0xf0ad('0x3b')](_0x267b7a[_0xf0ad('0x39')],{'$or':_['map'](_0x39c46c,function(_0x2e0c7a){if(_0x2e0c7a[_0xf0ad('0x3c')]!==_0xf0ad('0x3d')){var _0x189f67={};_0x189f67[_0x2e0c7a[_0xf0ad('0x28')]]={'$like':'%'+_0x1b6880[_0xf0ad('0x30')][_0xf0ad('0x3a')]+'%'};return _0x189f67;}})});}_0x267b7a=_[_0xf0ad('0x3b')]({},_0x267b7a,_0x1b6880[_0xf0ad('0x3e')]);var _0x5dd631={'where':_0x267b7a[_0xf0ad('0x39')]};return db[_0xf0ad('0x3f')][_0xf0ad('0x40')](_0x5dd631)['then'](function(_0x510f54){_0x2386e8['count']=_0x510f54;if(_0x1b6880[_0xf0ad('0x30')][_0xf0ad('0x41')]){_0x267b7a[_0xf0ad('0x42')]=[{'all':!![]}];}return db[_0xf0ad('0x3f')][_0xf0ad('0x43')](_0x267b7a);})[_0xf0ad('0x23')](function(_0x39083d){_0x2386e8[_0xf0ad('0x44')]=_0x39083d;return _0x2386e8;})[_0xf0ad('0x23')](respondWithFilteredResult(_0x1ac25c,_0x267b7a))[_0xf0ad('0x45')](handleError(_0x1ac25c,null));};exports[_0xf0ad('0x46')]=function(_0x516a72,_0x4ea947){var _0x5cd1dc={'raw':!![],'where':{'id':_0x516a72[_0xf0ad('0x47')]['id']}},_0x1c0609={};_0x1c0609['model']=_[_0xf0ad('0x31')](db[_0xf0ad('0x3f')]['rawAttributes']);_0x1c0609[_0xf0ad('0x30')]=_[_0xf0ad('0x31')](_0x516a72[_0xf0ad('0x30')]);_0x1c0609[_0xf0ad('0x32')]=_['intersection'](_0x1c0609[_0xf0ad('0x2f')],_0x1c0609[_0xf0ad('0x30')]);_0x5cd1dc[_0xf0ad('0x33')]=_[_0xf0ad('0x34')](_0x1c0609[_0xf0ad('0x2f')],qs[_0xf0ad('0x48')](_0x516a72[_0xf0ad('0x30')][_0xf0ad('0x48')]));_0x5cd1dc[_0xf0ad('0x33')]=_0x5cd1dc[_0xf0ad('0x33')][_0xf0ad('0x35')]?_0x5cd1dc['attributes']:_0x1c0609[_0xf0ad('0x2f')];if(_0x516a72[_0xf0ad('0x30')][_0xf0ad('0x41')]){_0x5cd1dc['include']=[{'all':!![]}];}_0x5cd1dc=_['merge']({},_0x5cd1dc,_0x516a72[_0xf0ad('0x3e')]);return db[_0xf0ad('0x3f')][_0xf0ad('0x49')](_0x5cd1dc)[_0xf0ad('0x23')](handleEntityNotFound(_0x4ea947,null))[_0xf0ad('0x23')](respondWithResult(_0x4ea947,null))[_0xf0ad('0x45')](handleError(_0x4ea947,null));};exports[_0xf0ad('0x4a')]=function(_0x561f2a,_0x1e35ce){return db['MailQueueReport'][_0xf0ad('0x4a')](_0x561f2a[_0xf0ad('0x4b')],{})[_0xf0ad('0x23')](respondWithResult(_0x1e35ce,0xc9))[_0xf0ad('0x45')](handleError(_0x1e35ce,null));};exports[_0xf0ad('0x22')]=function(_0x5b18a7,_0x4e8ef5){if(_0x5b18a7[_0xf0ad('0x4b')]['id']){delete _0x5b18a7[_0xf0ad('0x4b')]['id'];}return db[_0xf0ad('0x3f')][_0xf0ad('0x49')]({'where':{'id':_0x5b18a7[_0xf0ad('0x47')]['id']}})[_0xf0ad('0x23')](handleEntityNotFound(_0x4e8ef5,null))[_0xf0ad('0x23')](saveUpdates(_0x5b18a7['body'],null))[_0xf0ad('0x23')](respondWithResult(_0x4e8ef5,null))[_0xf0ad('0x45')](handleError(_0x4e8ef5,null));};exports[_0xf0ad('0x24')]=function(_0xda0e52,_0x2cb082){return db['MailQueueReport'][_0xf0ad('0x49')]({'where':{'id':_0xda0e52[_0xf0ad('0x47')]['id']}})[_0xf0ad('0x23')](handleEntityNotFound(_0x2cb082,null))[_0xf0ad('0x23')](removeEntity(_0x2cb082,null))[_0xf0ad('0x45')](handleError(_0x2cb082,null));};exports[_0xf0ad('0x4c')]=function(_0x3d156d,_0x5e75d0){return db[_0xf0ad('0x3f')][_0xf0ad('0x4c')]()[_0xf0ad('0x23')](respondWithResult(_0x5e75d0,null))['catch'](handleError(_0x5e75d0,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index a3410bf..7059511 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 _0x6182=['report_mail_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailQueueReport.attributes','MailQueueReport'];(function(_0x5de7f2,_0x358f95){var _0x1095d3=function(_0xc6093c){while(--_0xc6093c){_0x5de7f2['push'](_0x5de7f2['shift']());}};_0x1095d3(++_0x358f95);}(_0x6182,0xc2));var _0x2618=function(_0x4cd731,_0x59c185){_0x4cd731=_0x4cd731-0x0;var _0xff1df2=_0x6182[_0x4cd731];return _0xff1df2;};'use strict';var _=require(_0x2618('0x0'));var util=require('util');var logger=require(_0x2618('0x1'))(_0x2618('0x2'));var moment=require(_0x2618('0x3'));var BPromise=require(_0x2618('0x4'));var rp=require(_0x2618('0x5'));var fs=require('fs');var path=require(_0x2618('0x6'));var rimraf=require('rimraf');var config=require(_0x2618('0x7'));var attributes=require(_0x2618('0x8'));module['exports']=function(_0x3834b1,_0x24624a){return _0x3834b1['define'](_0x2618('0x9'),attributes,{'tableName':_0x2618('0xa'),'paranoid':![],'indexes':[{'name':_0x2618('0xb'),'fields':[_0x2618('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x46b1=['rimraf','../../config/environment','MailQueueReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x217894,_0x1b1467){var _0x258472=function(_0x1c7a3d){while(--_0x1c7a3d){_0x217894['push'](_0x217894['shift']());}};_0x258472(++_0x1b1467);}(_0x46b1,0x143));var _0x146b=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x46b1[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x146b('0x0'));var util=require(_0x146b('0x1'));var logger=require(_0x146b('0x2'))('api');var moment=require(_0x146b('0x3'));var BPromise=require(_0x146b('0x4'));var rp=require(_0x146b('0x5'));var fs=require('fs');var path=require(_0x146b('0x6'));var rimraf=require(_0x146b('0x7'));var config=require(_0x146b('0x8'));var attributes=require('./mailQueueReport.attributes');module['exports']=function(_0x107b05,_0x2622ec){return _0x107b05['define'](_0x146b('0x9'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x146b('0xa'),'fields':[_0x146b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 9b20706..2d99e7f 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 _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x466b88,_0x48ae96){var _0x5125ec=function(_0x5b8586){while(--_0x5b8586){_0x466b88['push'](_0x466b88['shift']());}};_0x5125ec(++_0x48ae96);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc4aa[_0x5d6456];return _0x4d66c1;};'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')]('MailQueueReport,\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);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x15b9bb,_0x1d554c){var _0x39049f=function(_0x3c7b44){while(--_0x3c7b44){_0x15b9bb['push'](_0x15b9bb['shift']());}};_0x39049f(++_0x1d554c);}(_0x7a54,0x106));var _0x47a5=function(_0x1f9df3,_0x586802){_0x1f9df3=_0x1f9df3-0x0;var _0x1c0214=_0x7a54[_0x1f9df3];return _0x1c0214;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index d422f53..d9a567f 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3e798a,_0x1c3f1f){var _0x34538f=function(_0x40e35d){while(--_0x40e35d){_0x3e798a['push'](_0x3e798a['shift']());}};_0x34538f(++_0x1c3f1f);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x61711c,_0x5b2962){var _0x4cf0e9=function(_0x179352){while(--_0x179352){_0x61711c['push'](_0x61711c['shift']());}};_0x4cf0e9(++_0x5b2962);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 49d7309..9e13b72 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 _0x9aea=['INBOX','sequelize','STRING','BOOLEAN','INTEGER'];(function(_0x984e73,_0x3e6337){var _0xe0b4a5=function(_0x1170f9){while(--_0x1170f9){_0x984e73['push'](_0x984e73['shift']());}};_0xe0b4a5(++_0x3e6337);}(_0x9aea,0xdd));var _0xa9ae=function(_0xa9c9f1,_0x34b760){_0xa9c9f1=_0xa9c9f1-0x0;var _0x556293=_0x9aea[_0xa9c9f1];return _0x556293;};'use strict';var Sequelize=require(_0xa9ae('0x0'));module['exports']={'description':{'type':Sequelize[_0xa9ae('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xa9ae('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xa9ae('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xa9ae('0x3')]},'tls':{'type':Sequelize[_0xa9ae('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xa9ae('0x1')],'defaultValue':_0xa9ae('0x4')},'connTimeout':{'type':Sequelize[_0xa9ae('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xa9ae('0x1')]}}; \ No newline at end of file +var _0xac4a=['INTEGER','sequelize','exports','STRING','BOOLEAN','INBOX'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xac4a,0x13f));var _0xaac4=function(_0xad2527,_0x498ec3){_0xad2527=_0xad2527-0x0;var _0x212b23=_0xac4a[_0xad2527];return _0x212b23;};'use strict';var Sequelize=require(_0xaac4('0x0'));module[_0xaac4('0x1')]={'description':{'type':Sequelize[_0xaac4('0x2')]},'host':{'type':Sequelize[_0xaac4('0x2')]},'authentication':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xaac4('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xaac4('0x2')],'defaultValue':_0xaac4('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xaac4('0x5')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index fa8a718..a0751c2 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 _0x1cb5=['exports','mail_servers_in','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0x4a26ec,_0x4fb7d2){var _0x546224=function(_0x1b74d1){while(--_0x1b74d1){_0x4a26ec['push'](_0x4a26ec['shift']());}};_0x546224(++_0x4fb7d2);}(_0x1cb5,0x14c));var _0x51cb=function(_0x2eaa30,_0x40588d){_0x2eaa30=_0x2eaa30-0x0;var _0x3cf1cd=_0x1cb5[_0x2eaa30];return _0x3cf1cd;};'use strict';var _=require(_0x51cb('0x0'));var util=require(_0x51cb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x51cb('0x2'));var BPromise=require(_0x51cb('0x3'));var rp=require(_0x51cb('0x4'));var fs=require('fs');var path=require(_0x51cb('0x5'));var rimraf=require(_0x51cb('0x6'));var config=require(_0x51cb('0x7'));var attributes=require(_0x51cb('0x8'));module[_0x51cb('0x9')]=function(_0x45ae1b,_0x20bcd4){return _0x45ae1b['define']('MailServerIn',attributes,{'tableName':_0x51cb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb882=['mail_servers_in','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./mailServerIn.attributes','MailServerIn'];(function(_0x16a740,_0x5d6159){var _0x217ecf=function(_0x50b1a3){while(--_0x50b1a3){_0x16a740['push'](_0x16a740['shift']());}};_0x217ecf(++_0x5d6159);}(_0xb882,0xf1));var _0x2b88=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xb882[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require(_0x2b88('0x0'));var util=require('util');var logger=require(_0x2b88('0x1'))('api');var moment=require(_0x2b88('0x2'));var BPromise=require(_0x2b88('0x3'));var rp=require(_0x2b88('0x4'));var fs=require('fs');var path=require(_0x2b88('0x5'));var rimraf=require('rimraf');var config=require(_0x2b88('0x6'));var attributes=require(_0x2b88('0x7'));module['exports']=function(_0x5d508e,_0x33a2b3){return _0x5d508e['define'](_0x2b88('0x8'),attributes,{'tableName':_0x2b88('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index a4af46d..42a3a81 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 _0xa4b1=['attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','request\x20sent','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','limit','include','map','model'];(function(_0x379c5c,_0x1a3d1c){var _0x1d4c04=function(_0x325d36){while(--_0x325d36){_0x379c5c['push'](_0x379c5c['shift']());}};_0x1d4c04(++_0x1a3d1c);}(_0xa4b1,0x133));var _0x1a4b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa4b1[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1a4b('0x0'));var util=require(_0x1a4b('0x1'));var moment=require(_0x1a4b('0x2'));var BPromise=require(_0x1a4b('0x3'));var rs=require(_0x1a4b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a4b('0x5'))['db'];var utils=require(_0x1a4b('0x6'));var logger=require('../../config/logger')(_0x1a4b('0x7'));var config=require(_0x1a4b('0x8'));var jayson=require(_0x1a4b('0x9'));var client=jayson[_0x1a4b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c55a5,_0x25ff32,_0xf2658b){return new BPromise(function(_0x5bbbc6,_0x5b86af){return client['request'](_0x3c55a5,_0xf2658b)[_0x1a4b('0xb')](function(_0x4fd24e){logger[_0x1a4b('0xc')]('MailServerIn,\x20%s,\x20%s',_0x25ff32,'request\x20sent');logger[_0x1a4b('0xd')](_0x1a4b('0xe'),_0x25ff32,'request\x20sent',JSON[_0x1a4b('0xf')](_0x4fd24e));if(_0x4fd24e[_0x1a4b('0x10')]){if(_0x4fd24e[_0x1a4b('0x10')][_0x1a4b('0x11')]===0x1f4){logger[_0x1a4b('0x10')](_0x1a4b('0x12'),_0x25ff32,_0x4fd24e[_0x1a4b('0x10')][_0x1a4b('0x13')]);return _0x5b86af(_0x4fd24e[_0x1a4b('0x10')][_0x1a4b('0x13')]);}logger[_0x1a4b('0x10')](_0x1a4b('0x12'),_0x25ff32,_0x4fd24e[_0x1a4b('0x10')][_0x1a4b('0x13')]);return _0x5bbbc6(_0x4fd24e['error']['message']);}else{logger[_0x1a4b('0xc')]('MailServerIn,\x20%s,\x20%s',_0x25ff32,_0x1a4b('0x14'));_0x5bbbc6(_0x4fd24e[_0x1a4b('0x15')][_0x1a4b('0x13')]);}})[_0x1a4b('0x16')](function(_0x131564){logger[_0x1a4b('0x10')](_0x1a4b('0x12'),_0x25ff32,_0x131564);_0x5b86af(_0x131564);});});}exports[_0x1a4b('0x17')]=function(_0x151026){var _0x29fd38=this;return new Promise(function(_0x21cd42,_0x1ce6a9){return db[_0x1a4b('0x18')][_0x1a4b('0x19')]({'raw':_0x151026[_0x1a4b('0x1a')]?_0x151026['options'][_0x1a4b('0x1b')]===undefined?!![]:![]:!![],'where':_0x151026[_0x1a4b('0x1a')]?_0x151026[_0x1a4b('0x1a')][_0x1a4b('0x1c')]||null:null,'attributes':_0x151026[_0x1a4b('0x1a')]?_0x151026[_0x1a4b('0x1a')]['attributes']||null:null,'limit':_0x151026[_0x1a4b('0x1a')]?_0x151026['options'][_0x1a4b('0x1d')]||null:null,'include':_0x151026[_0x1a4b('0x1a')]?_0x151026[_0x1a4b('0x1a')][_0x1a4b('0x1e')]?_[_0x1a4b('0x1f')](_0x151026['options'][_0x1a4b('0x1e')],function(_0x4e223a){return{'model':db[_0x4e223a[_0x1a4b('0x20')]],'as':_0x4e223a['as'],'attributes':_0x4e223a[_0x1a4b('0x21')],'include':_0x4e223a[_0x1a4b('0x1e')]?_[_0x1a4b('0x1f')](_0x4e223a[_0x1a4b('0x1e')],function(_0x213bbb){return{'model':db[_0x213bbb['model']],'as':_0x213bbb['as'],'attributes':_0x213bbb[_0x1a4b('0x21')],'include':_0x213bbb[_0x1a4b('0x1e')]?_['map'](_0x213bbb[_0x1a4b('0x1e')],function(_0x14f68e){return{'model':db[_0x14f68e[_0x1a4b('0x20')]],'as':_0x14f68e['as'],'attributes':_0x14f68e[_0x1a4b('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54fbd6){logger[_0x1a4b('0xc')](_0x1a4b('0x17'),_0x151026);logger[_0x1a4b('0xd')]('GetMailServerIn',_0x151026,JSON[_0x1a4b('0xf')](_0x54fbd6));_0x21cd42(_0x54fbd6);})[_0x1a4b('0x16')](function(_0x392576){logger['error']('GetMailServerIn',_0x392576['message'],_0x151026);_0x1ce6a9(_0x29fd38[_0x1a4b('0x10')](0x1f4,_0x392576[_0x1a4b('0x13')]));});});}; \ No newline at end of file +var _0xd84c=['where','limit','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw'];(function(_0x5b68cb,_0x345fbe){var _0x3fb636=function(_0x335eff){while(--_0x335eff){_0x5b68cb['push'](_0x5b68cb['shift']());}};_0x3fb636(++_0x345fbe);}(_0xd84c,0x102));var _0xcd84=function(_0x1a93f6,_0x28cfa6){_0x1a93f6=_0x1a93f6-0x0;var _0x15b2ee=_0xd84c[_0x1a93f6];return _0x15b2ee;};'use strict';var _=require(_0xcd84('0x0'));var util=require(_0xcd84('0x1'));var moment=require(_0xcd84('0x2'));var BPromise=require(_0xcd84('0x3'));var rs=require(_0xcd84('0x4'));var fs=require('fs');var Redis=require(_0xcd84('0x5'));var db=require(_0xcd84('0x6'))['db'];var utils=require(_0xcd84('0x7'));var logger=require(_0xcd84('0x8'))('rpc');var config=require(_0xcd84('0x9'));var jayson=require(_0xcd84('0xa'));var client=jayson[_0xcd84('0xb')][_0xcd84('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x520d49,_0x2b5383,_0x22c811){return new BPromise(function(_0x3f3617,_0x5408e2){return client[_0xcd84('0xd')](_0x520d49,_0x22c811)[_0xcd84('0xe')](function(_0xec34a2){logger[_0xcd84('0xf')]('MailServerIn,\x20%s,\x20%s',_0x2b5383,_0xcd84('0x10'));logger[_0xcd84('0x11')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x2b5383,_0xcd84('0x10'),JSON[_0xcd84('0x12')](_0xec34a2));if(_0xec34a2[_0xcd84('0x13')]){if(_0xec34a2['error'][_0xcd84('0x14')]===0x1f4){logger[_0xcd84('0x13')](_0xcd84('0x15'),_0x2b5383,_0xec34a2[_0xcd84('0x13')]['message']);return _0x5408e2(_0xec34a2[_0xcd84('0x13')][_0xcd84('0x16')]);}logger[_0xcd84('0x13')](_0xcd84('0x15'),_0x2b5383,_0xec34a2[_0xcd84('0x13')][_0xcd84('0x16')]);return _0x3f3617(_0xec34a2[_0xcd84('0x13')][_0xcd84('0x16')]);}else{logger[_0xcd84('0xf')](_0xcd84('0x15'),_0x2b5383,_0xcd84('0x10'));_0x3f3617(_0xec34a2[_0xcd84('0x17')][_0xcd84('0x16')]);}})[_0xcd84('0x18')](function(_0xfc4ec7){logger[_0xcd84('0x13')](_0xcd84('0x15'),_0x2b5383,_0xfc4ec7);_0x5408e2(_0xfc4ec7);});});}exports[_0xcd84('0x19')]=function(_0x4ff790){var _0x3c2d33=this;return new Promise(function(_0x15099f,_0x4c9509){return db[_0xcd84('0x1a')][_0xcd84('0x1b')]({'raw':_0x4ff790[_0xcd84('0x1c')]?_0x4ff790[_0xcd84('0x1c')][_0xcd84('0x1d')]===undefined?!![]:![]:!![],'where':_0x4ff790['options']?_0x4ff790[_0xcd84('0x1c')][_0xcd84('0x1e')]||null:null,'attributes':_0x4ff790[_0xcd84('0x1c')]?_0x4ff790['options']['attributes']||null:null,'limit':_0x4ff790[_0xcd84('0x1c')]?_0x4ff790['options'][_0xcd84('0x1f')]||null:null,'include':_0x4ff790[_0xcd84('0x1c')]?_0x4ff790['options'][_0xcd84('0x20')]?_[_0xcd84('0x21')](_0x4ff790[_0xcd84('0x1c')][_0xcd84('0x20')],function(_0x14cf35){return{'model':db[_0x14cf35[_0xcd84('0x22')]],'as':_0x14cf35['as'],'attributes':_0x14cf35['attributes'],'include':_0x14cf35[_0xcd84('0x20')]?_[_0xcd84('0x21')](_0x14cf35[_0xcd84('0x20')],function(_0xbc0595){return{'model':db[_0xbc0595[_0xcd84('0x22')]],'as':_0xbc0595['as'],'attributes':_0xbc0595[_0xcd84('0x23')],'include':_0xbc0595[_0xcd84('0x20')]?_['map'](_0xbc0595['include'],function(_0x1967f6){return{'model':db[_0x1967f6['model']],'as':_0x1967f6['as'],'attributes':_0x1967f6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x333734){logger[_0xcd84('0xf')]('GetMailServerIn',_0x4ff790);logger[_0xcd84('0x11')](_0xcd84('0x19'),_0x4ff790,JSON[_0xcd84('0x12')](_0x333734));_0x15099f(_0x333734);})['catch'](function(_0x33fc4f){logger['error'](_0xcd84('0x19'),_0x33fc4f[_0xcd84('0x16')],_0x4ff790);_0x4c9509(_0x3c2d33[_0xcd84('0x13')](0x1f4,_0x33fc4f[_0xcd84('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 4aa0719..87774aa 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a54,0x106));var _0x47a5=function(_0x177306,_0x1df9a4){_0x177306=_0x177306-0x0;var _0x3ffbef=_0x7a54[_0x177306];return _0x3ffbef;};'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 c621a12..1cef864 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 _0x9952=['STRING','INTEGER','BOOLEAN','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9952,0xf7));var _0x2995=function(_0xadde88,_0x58ad47){_0xadde88=_0xadde88-0x0;var _0x3b8eb6=_0x9952[_0xadde88];return _0x3b8eb6;};'use strict';var Sequelize=require('sequelize');module[_0x2995('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x2995('0x1')]},'user':{'type':Sequelize[_0x2995('0x1')]},'pass':{'type':Sequelize[_0x2995('0x1')]},'port':{'type':Sequelize[_0x2995('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x2995('0x1')]},'authentication':{'type':Sequelize[_0x2995('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x36d7=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x468be0,_0x50b945){var _0x3c71ec=function(_0x40ad7c){while(--_0x40ad7c){_0x468be0['push'](_0x468be0['shift']());}};_0x3c71ec(++_0x50b945);}(_0x36d7,0xf7));var _0x736d=function(_0xaaa123,_0x4c23e3){_0xaaa123=_0xaaa123-0x0;var _0x44d6d7=_0x36d7[_0xaaa123];return _0x44d6d7;};'use strict';var Sequelize=require(_0x736d('0x0'));module[_0x736d('0x1')]={'description':{'type':Sequelize[_0x736d('0x2')]},'host':{'type':Sequelize[_0x736d('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x736d('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x736d('0x2')]},'authentication':{'type':Sequelize[_0x736d('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 0a46b0e..211f042 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 _0xc75d=['keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','offset','undefined','count','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query'];(function(_0x42d55e,_0x31153){var _0x4103b6=function(_0x2a7d63){while(--_0x2a7d63){_0x42d55e['push'](_0x42d55e['shift']());}};_0x4103b6(++_0x31153);}(_0xc75d,0xea));var _0xdc75=function(_0xe3bf81,_0x12182b){_0xe3bf81=_0xe3bf81-0x0;var _0x1c686d=_0xc75d[_0xe3bf81];return _0x1c686d;};'use strict';var emlformat=require(_0xdc75('0x0'));var rimraf=require(_0xdc75('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdc75('0x2'));var rp=require(_0xdc75('0x3'));var moment=require(_0xdc75('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdc75('0x5'));var util=require(_0xdc75('0x6'));var path=require(_0xdc75('0x7'));var sox=require(_0xdc75('0x8'));var csv=require(_0xdc75('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdc75('0xa'));var _=require(_0xdc75('0xb'));var squel=require(_0xdc75('0xc'));var crypto=require(_0xdc75('0xd'));var jsforce=require(_0xdc75('0xe'));var deskjs=require(_0xdc75('0xf'));var toCsv=require(_0xdc75('0x9'));var querystring=require(_0xdc75('0x10'));var Papa=require('papaparse');var Redis=require(_0xdc75('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdc75('0x12'));var logger=require(_0xdc75('0x13'))(_0xdc75('0x14'));var utils=require(_0xdc75('0x15'));var config=require(_0xdc75('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e7dbf,_0x35c9bb){_0x35c9bb=_0x35c9bb||0xcc;return function(_0xd315e4){if(_0xd315e4){return _0x5e7dbf['sendStatus'](_0x35c9bb);}return _0x5e7dbf[_0xdc75('0x17')](_0x35c9bb)['end']();};}function respondWithResult(_0x458ac7,_0x3ac69a){_0x3ac69a=_0x3ac69a||0xc8;return function(_0x5af96a){if(_0x5af96a){return _0x458ac7[_0xdc75('0x17')](_0x3ac69a)['json'](_0x5af96a);}};}function respondWithFilteredResult(_0x458145,_0x20d42f){return function(_0x5216e6){if(_0x5216e6){var _0x4251ff=typeof _0x20d42f[_0xdc75('0x18')]==='undefined'&&typeof _0x20d42f['limit']===_0xdc75('0x19');var _0x1fe11c=_0x5216e6['count'];var _0x2b4147=_0x4251ff?0x0:_0x20d42f[_0xdc75('0x18')];var _0x451306=_0x4251ff?_0x5216e6[_0xdc75('0x1a')]:_0x20d42f['offset']+_0x20d42f['limit'];var _0xc03135;if(_0x451306>=_0x1fe11c){_0x451306=_0x1fe11c;_0xc03135=0xc8;}else{_0xc03135=0xce;}_0x458145['status'](_0xc03135);return _0x458145['set']('Content-Range',_0x2b4147+'-'+_0x451306+'/'+_0x1fe11c)['json'](_0x5216e6);}return null;};}function patchUpdates(_0x5c64e3){return function(_0x533d80){try{jsonpatch[_0xdc75('0x1b')](_0x533d80,_0x5c64e3,!![]);}catch(_0x22fa00){return BPromise[_0xdc75('0x1c')](_0x22fa00);}return _0x533d80[_0xdc75('0x1d')]();};}function saveUpdates(_0x3d9902,_0x38b93a){return function(_0x5d1a02){if(_0x5d1a02){return _0x5d1a02['update'](_0x3d9902)[_0xdc75('0x1e')](function(_0x3663cb){return _0x3663cb;});}return null;};}function removeEntity(_0x202908,_0x19f30d){return function(_0x3c4b75){if(_0x3c4b75){return _0x3c4b75[_0xdc75('0x1f')]()['then'](function(){_0x202908[_0xdc75('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54e0f5,_0x189715){return function(_0x16ed0d){if(!_0x16ed0d){_0x54e0f5[_0xdc75('0x20')](0x194);}return _0x16ed0d;};}function handleError(_0xb82879,_0x3c2cad){_0x3c2cad=_0x3c2cad||0x1f4;return function(_0x4ab826){logger[_0xdc75('0x21')](_0x4ab826[_0xdc75('0x22')]);if(_0x4ab826['name']){delete _0x4ab826[_0xdc75('0x23')];}_0xb82879['status'](_0x3c2cad)[_0xdc75('0x24')](_0x4ab826);};}exports[_0xdc75('0x25')]=function(_0x1a2db4,_0x2ae692){var _0x2f1eb7={},_0x3334c0={},_0x261f0d={'count':0x0,'rows':[]};var _0x3c89da=_[_0xdc75('0x26')](db[_0xdc75('0x27')][_0xdc75('0x28')],function(_0x4bcddd){return{'name':_0x4bcddd[_0xdc75('0x29')],'type':_0x4bcddd[_0xdc75('0x2a')][_0xdc75('0x2b')]};});_0x3334c0[_0xdc75('0x2c')]=_[_0xdc75('0x26')](_0x3c89da,_0xdc75('0x23'));_0x3334c0[_0xdc75('0x2d')]=_[_0xdc75('0x2e')](_0x1a2db4[_0xdc75('0x2d')]);_0x3334c0[_0xdc75('0x2f')]=_[_0xdc75('0x30')](_0x3334c0[_0xdc75('0x2c')],_0x3334c0[_0xdc75('0x2d')]);_0x2f1eb7[_0xdc75('0x31')]=_[_0xdc75('0x30')](_0x3334c0[_0xdc75('0x2c')],qs[_0xdc75('0x32')](_0x1a2db4[_0xdc75('0x2d')]['fields']));_0x2f1eb7[_0xdc75('0x31')]=_0x2f1eb7[_0xdc75('0x31')][_0xdc75('0x33')]?_0x2f1eb7[_0xdc75('0x31')]:_0x3334c0[_0xdc75('0x2c')];if(!_0x1a2db4[_0xdc75('0x2d')]['hasOwnProperty'](_0xdc75('0x34'))){_0x2f1eb7[_0xdc75('0x35')]=qs[_0xdc75('0x35')](_0x1a2db4[_0xdc75('0x2d')][_0xdc75('0x35')]);_0x2f1eb7[_0xdc75('0x18')]=qs[_0xdc75('0x18')](_0x1a2db4[_0xdc75('0x2d')][_0xdc75('0x18')]);}_0x2f1eb7[_0xdc75('0x36')]=qs[_0xdc75('0x37')](_0x1a2db4[_0xdc75('0x2d')][_0xdc75('0x37')]);_0x2f1eb7[_0xdc75('0x38')]=qs[_0xdc75('0x2f')](_[_0xdc75('0x39')](_0x1a2db4[_0xdc75('0x2d')],_0x3334c0[_0xdc75('0x2f')]),_0x3c89da);if(_0x1a2db4['query'][_0xdc75('0x3a')]){_0x2f1eb7['where']=_[_0xdc75('0x3b')](_0x2f1eb7[_0xdc75('0x38')],{'$or':_[_0xdc75('0x26')](_0x3c89da,function(_0x21795f){if(_0x21795f[_0xdc75('0x2a')]!=='VIRTUAL'){var _0x2debf1={};_0x2debf1[_0x21795f['name']]={'$like':'%'+_0x1a2db4['query'][_0xdc75('0x3a')]+'%'};return _0x2debf1;}})});}_0x2f1eb7=_[_0xdc75('0x3b')]({},_0x2f1eb7,_0x1a2db4[_0xdc75('0x3c')]);var _0x362a08={'where':_0x2f1eb7[_0xdc75('0x38')]};return db[_0xdc75('0x27')][_0xdc75('0x1a')](_0x362a08)[_0xdc75('0x1e')](function(_0x5959e4){_0x261f0d[_0xdc75('0x1a')]=_0x5959e4;if(_0x1a2db4['query'][_0xdc75('0x3d')]){_0x2f1eb7[_0xdc75('0x3e')]=[{'all':!![]}];}return db[_0xdc75('0x27')][_0xdc75('0x3f')](_0x2f1eb7);})[_0xdc75('0x1e')](function(_0x4b75e6){_0x261f0d[_0xdc75('0x40')]=_0x4b75e6;return _0x261f0d;})[_0xdc75('0x1e')](respondWithFilteredResult(_0x2ae692,_0x2f1eb7))[_0xdc75('0x41')](handleError(_0x2ae692,null));};exports['show']=function(_0x2b6f69,_0x526618){var _0x3f4d0b={'raw':!![],'where':{'id':_0x2b6f69['params']['id']}},_0x2ce907={};_0x2ce907['model']=_[_0xdc75('0x2e')](db[_0xdc75('0x27')][_0xdc75('0x28')]);_0x2ce907['query']=_[_0xdc75('0x2e')](_0x2b6f69[_0xdc75('0x2d')]);_0x2ce907[_0xdc75('0x2f')]=_[_0xdc75('0x30')](_0x2ce907[_0xdc75('0x2c')],_0x2ce907[_0xdc75('0x2d')]);_0x3f4d0b[_0xdc75('0x31')]=_['intersection'](_0x2ce907['model'],qs['fields'](_0x2b6f69[_0xdc75('0x2d')][_0xdc75('0x32')]));_0x3f4d0b['attributes']=_0x3f4d0b['attributes'][_0xdc75('0x33')]?_0x3f4d0b['attributes']:_0x2ce907['model'];if(_0x2b6f69[_0xdc75('0x2d')][_0xdc75('0x3d')]){_0x3f4d0b[_0xdc75('0x3e')]=[{'all':!![]}];}_0x3f4d0b=_['merge']({},_0x3f4d0b,_0x2b6f69['options']);return db[_0xdc75('0x27')][_0xdc75('0x42')](_0x3f4d0b)[_0xdc75('0x1e')](handleEntityNotFound(_0x526618,null))[_0xdc75('0x1e')](respondWithResult(_0x526618,null))[_0xdc75('0x41')](handleError(_0x526618,null));};exports[_0xdc75('0x43')]=function(_0x432b88,_0x2ba855){return db[_0xdc75('0x27')]['create'](_0x432b88[_0xdc75('0x44')],{})[_0xdc75('0x1e')](respondWithResult(_0x2ba855,0xc9))['catch'](handleError(_0x2ba855,null));};exports['update']=function(_0x24bb7b,_0x34f90d){if(_0x24bb7b[_0xdc75('0x44')]['id']){delete _0x24bb7b[_0xdc75('0x44')]['id'];}return db[_0xdc75('0x27')][_0xdc75('0x42')]({'where':{'id':_0x24bb7b[_0xdc75('0x45')]['id']}})[_0xdc75('0x1e')](handleEntityNotFound(_0x34f90d,null))[_0xdc75('0x1e')](saveUpdates(_0x24bb7b['body'],null))[_0xdc75('0x1e')](respondWithResult(_0x34f90d,null))['catch'](handleError(_0x34f90d,null));};exports[_0xdc75('0x1f')]=function(_0x39d836,_0x4dcac2){return db[_0xdc75('0x27')]['find']({'where':{'id':_0x39d836[_0xdc75('0x45')]['id']}})[_0xdc75('0x1e')](handleEntityNotFound(_0x4dcac2,null))[_0xdc75('0x1e')](removeEntity(_0x4dcac2,null))[_0xdc75('0x41')](handleError(_0x4dcac2,null));}; \ No newline at end of file +var _0x07be=['limit','status','json','apply','save','update','then','destroy','name','send','map','MailServerOut','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','catch','show','length','find','create','body','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','count'];(function(_0x374949,_0x5af52e){var _0xdae091=function(_0x661d95){while(--_0x661d95){_0x374949['push'](_0x374949['shift']());}};_0xdae091(++_0x5af52e);}(_0x07be,0x140));var _0xe07b=function(_0x559431,_0x433b73){_0x559431=_0x559431-0x0;var _0x3b6ed3=_0x07be[_0x559431];return _0x3b6ed3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe07b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe07b('0x1'));var rp=require(_0xe07b('0x2'));var moment=require(_0xe07b('0x3'));var BPromise=require(_0xe07b('0x4'));var Mustache=require(_0xe07b('0x5'));var util=require(_0xe07b('0x6'));var path=require(_0xe07b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe07b('0x8'));var _=require(_0xe07b('0x9'));var squel=require(_0xe07b('0xa'));var crypto=require(_0xe07b('0xb'));var jsforce=require(_0xe07b('0xc'));var deskjs=require(_0xe07b('0xd'));var toCsv=require(_0xe07b('0xe'));var querystring=require('querystring');var Papa=require(_0xe07b('0xf'));var Redis=require(_0xe07b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe07b('0x11'));var as=require(_0xe07b('0x12'));var hardwareService=require(_0xe07b('0x13'));var logger=require('../../config/logger')(_0xe07b('0x14'));var utils=require(_0xe07b('0x15'));var config=require(_0xe07b('0x16'));var licenseUtil=require(_0xe07b('0x17'));var db=require(_0xe07b('0x18'))['db'];function respondWithStatusCode(_0x4dfdcd,_0x30538c){_0x30538c=_0x30538c||0xcc;return function(_0x34c82e){if(_0x34c82e){return _0x4dfdcd[_0xe07b('0x19')](_0x30538c);}return _0x4dfdcd['status'](_0x30538c)[_0xe07b('0x1a')]();};}function respondWithResult(_0x331ff2,_0x152ba5){_0x152ba5=_0x152ba5||0xc8;return function(_0xc1e053){if(_0xc1e053){return _0x331ff2['status'](_0x152ba5)['json'](_0xc1e053);}};}function respondWithFilteredResult(_0x43714e,_0x2ef8fe){return function(_0x3c8884){if(_0x3c8884){var _0x54e7e7=typeof _0x2ef8fe[_0xe07b('0x1b')]===_0xe07b('0x1c')&&typeof _0x2ef8fe['limit']===_0xe07b('0x1c');var _0x9eb598=_0x3c8884[_0xe07b('0x1d')];var _0x61258f=_0x54e7e7?0x0:_0x2ef8fe[_0xe07b('0x1b')];var _0x5a3eb7=_0x54e7e7?_0x3c8884[_0xe07b('0x1d')]:_0x2ef8fe[_0xe07b('0x1b')]+_0x2ef8fe[_0xe07b('0x1e')];var _0x2ba85d;if(_0x5a3eb7>=_0x9eb598){_0x5a3eb7=_0x9eb598;_0x2ba85d=0xc8;}else{_0x2ba85d=0xce;}_0x43714e[_0xe07b('0x1f')](_0x2ba85d);return _0x43714e['set']('Content-Range',_0x61258f+'-'+_0x5a3eb7+'/'+_0x9eb598)[_0xe07b('0x20')](_0x3c8884);}return null;};}function patchUpdates(_0x4ed4a2){return function(_0x5c4a5e){try{jsonpatch[_0xe07b('0x21')](_0x5c4a5e,_0x4ed4a2,!![]);}catch(_0x10c0c2){return BPromise['reject'](_0x10c0c2);}return _0x5c4a5e[_0xe07b('0x22')]();};}function saveUpdates(_0x1fee7c,_0x3282e5){return function(_0x31196b){if(_0x31196b){return _0x31196b[_0xe07b('0x23')](_0x1fee7c)[_0xe07b('0x24')](function(_0x1127c6){return _0x1127c6;});}return null;};}function removeEntity(_0x59ed1b,_0xbbf8b8){return function(_0x3521f4){if(_0x3521f4){return _0x3521f4[_0xe07b('0x25')]()[_0xe07b('0x24')](function(){_0x59ed1b[_0xe07b('0x1f')](0xcc)[_0xe07b('0x1a')]();});}};}function handleEntityNotFound(_0x4c535e,_0x391249){return function(_0x1c7e92){if(!_0x1c7e92){_0x4c535e[_0xe07b('0x19')](0x194);}return _0x1c7e92;};}function handleError(_0x4d81b9,_0x499b65){_0x499b65=_0x499b65||0x1f4;return function(_0x4dc188){logger['error'](_0x4dc188['stack']);if(_0x4dc188[_0xe07b('0x26')]){delete _0x4dc188[_0xe07b('0x26')];}_0x4d81b9['status'](_0x499b65)[_0xe07b('0x27')](_0x4dc188);};}exports['index']=function(_0x1a7dfb,_0x21bf8e){var _0x4f68ee={},_0x379da7={},_0x10ccec={'count':0x0,'rows':[]};var _0x5d1869=_[_0xe07b('0x28')](db[_0xe07b('0x29')][_0xe07b('0x2a')],function(_0x1d22e2){return{'name':_0x1d22e2[_0xe07b('0x2b')],'type':_0x1d22e2['type']['key']};});_0x379da7['model']=_[_0xe07b('0x28')](_0x5d1869,'name');_0x379da7[_0xe07b('0x2c')]=_[_0xe07b('0x2d')](_0x1a7dfb[_0xe07b('0x2c')]);_0x379da7[_0xe07b('0x2e')]=_[_0xe07b('0x2f')](_0x379da7[_0xe07b('0x30')],_0x379da7[_0xe07b('0x2c')]);_0x4f68ee[_0xe07b('0x31')]=_['intersection'](_0x379da7[_0xe07b('0x30')],qs[_0xe07b('0x32')](_0x1a7dfb[_0xe07b('0x2c')][_0xe07b('0x32')]));_0x4f68ee['attributes']=_0x4f68ee[_0xe07b('0x31')]['length']?_0x4f68ee[_0xe07b('0x31')]:_0x379da7[_0xe07b('0x30')];if(!_0x1a7dfb[_0xe07b('0x2c')][_0xe07b('0x33')](_0xe07b('0x34'))){_0x4f68ee[_0xe07b('0x1e')]=qs[_0xe07b('0x1e')](_0x1a7dfb[_0xe07b('0x2c')][_0xe07b('0x1e')]);_0x4f68ee[_0xe07b('0x1b')]=qs[_0xe07b('0x1b')](_0x1a7dfb[_0xe07b('0x2c')]['offset']);}_0x4f68ee['order']=qs['sort'](_0x1a7dfb[_0xe07b('0x2c')][_0xe07b('0x35')]);_0x4f68ee[_0xe07b('0x36')]=qs[_0xe07b('0x2e')](_[_0xe07b('0x37')](_0x1a7dfb[_0xe07b('0x2c')],_0x379da7['filters']),_0x5d1869);if(_0x1a7dfb[_0xe07b('0x2c')][_0xe07b('0x38')]){_0x4f68ee[_0xe07b('0x36')]=_[_0xe07b('0x39')](_0x4f68ee[_0xe07b('0x36')],{'$or':_[_0xe07b('0x28')](_0x5d1869,function(_0x309766){if(_0x309766[_0xe07b('0x3a')]!=='VIRTUAL'){var _0x2276f3={};_0x2276f3[_0x309766[_0xe07b('0x26')]]={'$like':'%'+_0x1a7dfb[_0xe07b('0x2c')][_0xe07b('0x38')]+'%'};return _0x2276f3;}})});}_0x4f68ee=_[_0xe07b('0x39')]({},_0x4f68ee,_0x1a7dfb[_0xe07b('0x3b')]);var _0x4cdcae={'where':_0x4f68ee[_0xe07b('0x36')]};return db['MailServerOut']['count'](_0x4cdcae)[_0xe07b('0x24')](function(_0x5667e5){_0x10ccec[_0xe07b('0x1d')]=_0x5667e5;if(_0x1a7dfb[_0xe07b('0x2c')][_0xe07b('0x3c')]){_0x4f68ee[_0xe07b('0x3d')]=[{'all':!![]}];}return db['MailServerOut'][_0xe07b('0x3e')](_0x4f68ee);})[_0xe07b('0x24')](function(_0x12d95c){_0x10ccec['rows']=_0x12d95c;return _0x10ccec;})['then'](respondWithFilteredResult(_0x21bf8e,_0x4f68ee))[_0xe07b('0x3f')](handleError(_0x21bf8e,null));};exports[_0xe07b('0x40')]=function(_0xb21555,_0x5c03c9){var _0x161bba={'raw':!![],'where':{'id':_0xb21555['params']['id']}},_0x5672b8={};_0x5672b8[_0xe07b('0x30')]=_[_0xe07b('0x2d')](db[_0xe07b('0x29')][_0xe07b('0x2a')]);_0x5672b8[_0xe07b('0x2c')]=_[_0xe07b('0x2d')](_0xb21555[_0xe07b('0x2c')]);_0x5672b8[_0xe07b('0x2e')]=_['intersection'](_0x5672b8[_0xe07b('0x30')],_0x5672b8['query']);_0x161bba[_0xe07b('0x31')]=_['intersection'](_0x5672b8[_0xe07b('0x30')],qs[_0xe07b('0x32')](_0xb21555[_0xe07b('0x2c')][_0xe07b('0x32')]));_0x161bba['attributes']=_0x161bba['attributes'][_0xe07b('0x41')]?_0x161bba['attributes']:_0x5672b8[_0xe07b('0x30')];if(_0xb21555['query'][_0xe07b('0x3c')]){_0x161bba[_0xe07b('0x3d')]=[{'all':!![]}];}_0x161bba=_['merge']({},_0x161bba,_0xb21555[_0xe07b('0x3b')]);return db[_0xe07b('0x29')][_0xe07b('0x42')](_0x161bba)[_0xe07b('0x24')](handleEntityNotFound(_0x5c03c9,null))[_0xe07b('0x24')](respondWithResult(_0x5c03c9,null))['catch'](handleError(_0x5c03c9,null));};exports[_0xe07b('0x43')]=function(_0x16d833,_0x2a4be6){return db[_0xe07b('0x29')][_0xe07b('0x43')](_0x16d833[_0xe07b('0x44')],{})[_0xe07b('0x24')](respondWithResult(_0x2a4be6,0xc9))[_0xe07b('0x3f')](handleError(_0x2a4be6,null));};exports[_0xe07b('0x23')]=function(_0x5e5852,_0xacd03){if(_0x5e5852['body']['id']){delete _0x5e5852[_0xe07b('0x44')]['id'];}return db[_0xe07b('0x29')][_0xe07b('0x42')]({'where':{'id':_0x5e5852[_0xe07b('0x45')]['id']}})[_0xe07b('0x24')](handleEntityNotFound(_0xacd03,null))[_0xe07b('0x24')](saveUpdates(_0x5e5852[_0xe07b('0x44')],null))['then'](respondWithResult(_0xacd03,null))['catch'](handleError(_0xacd03,null));};exports[_0xe07b('0x25')]=function(_0x34f362,_0xb991){return db['MailServerOut'][_0xe07b('0x42')]({'where':{'id':_0x34f362[_0xe07b('0x45')]['id']}})[_0xe07b('0x24')](handleEntityNotFound(_0xb991,null))[_0xe07b('0x24')](removeEntity(_0xb991,null))['catch'](handleError(_0xb991,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index f958a5e..2cae920 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 _0xeecd=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','define','MailServerOut'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xeecd,0xb4));var _0xdeec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeecd[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xdeec('0x0'));var util=require(_0xdeec('0x1'));var logger=require(_0xdeec('0x2'))(_0xdeec('0x3'));var moment=require(_0xdeec('0x4'));var BPromise=require('bluebird');var rp=require(_0xdeec('0x5'));var fs=require('fs');var path=require(_0xdeec('0x6'));var rimraf=require(_0xdeec('0x7'));var config=require(_0xdeec('0x8'));var attributes=require(_0xdeec('0x9'));module['exports']=function(_0x2ea544,_0x3c86ad){return _0x2ea544[_0xdeec('0xa')](_0xdeec('0xb'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d5e=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','mail_servers_out'];(function(_0x4a5f6c,_0x4f532e){var _0x281ffd=function(_0x4c68e3){while(--_0x4c68e3){_0x4a5f6c['push'](_0x4a5f6c['shift']());}};_0x281ffd(++_0x4f532e);}(_0x7d5e,0x145));var _0xe7d5=function(_0x110777,_0x2929cc){_0x110777=_0x110777-0x0;var _0x3ac224=_0x7d5e[_0x110777];return _0x3ac224;};'use strict';var _=require(_0xe7d5('0x0'));var util=require(_0xe7d5('0x1'));var logger=require(_0xe7d5('0x2'))('api');var moment=require(_0xe7d5('0x3'));var BPromise=require(_0xe7d5('0x4'));var rp=require(_0xe7d5('0x5'));var fs=require('fs');var path=require(_0xe7d5('0x6'));var rimraf=require(_0xe7d5('0x7'));var config=require(_0xe7d5('0x8'));var attributes=require(_0xe7d5('0x9'));module[_0xe7d5('0xa')]=function(_0x2eefe7,_0x5e8398){return _0x2eefe7[_0xe7d5('0xb')]('MailServerOut',attributes,{'tableName':_0xe7d5('0xc'),'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 68611d9..b2c1afc 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x536128,_0x205e2b){var _0x19eb75=function(_0x5d5aa0){while(--_0x5d5aa0){_0x536128['push'](_0x536128['shift']());}};_0x19eb75(++_0x205e2b);}(_0x2ef3,0xba));var _0x32ef=function(_0x1b806e,_0x1c5385){_0x1b806e=_0x1b806e-0x0;var _0x4ed828=_0x2ef3[_0x1b806e];return _0x4ed828;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x2903ac,_0x2078ce){var _0x33772c=function(_0x111d65){while(--_0x111d65){_0x2903ac['push'](_0x2903ac['shift']());}};_0x33772c(++_0x2078ce);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index f5b5426..2b93477 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 _0xc1e4=['show','post','put','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x13cac8,_0x97c7d7){var _0x5e4e20=function(_0x5da240){while(--_0x5da240){_0x13cac8['push'](_0x13cac8['shift']());}};_0x5e4e20(++_0x97c7d7);}(_0xc1e4,0x1da));var _0x4c1e=function(_0x13bcc0,_0x27f767){_0x13bcc0=_0x13bcc0-0x0;var _0x2b5664=_0xc1e4[_0x13bcc0];return _0x2b5664;};'use strict';var multer=require('multer');var util=require(_0x4c1e('0x0'));var path=require(_0x4c1e('0x1'));var timeout=require(_0x4c1e('0x2'));var express=require(_0x4c1e('0x3'));var router=express['Router']();var fs_extra=require(_0x4c1e('0x4'));var auth=require(_0x4c1e('0x5'));var interaction=require(_0x4c1e('0x6'));var config=require(_0x4c1e('0x7'));var controller=require('./mailSubstatus.controller');router[_0x4c1e('0x8')]('/',auth[_0x4c1e('0x9')](),controller[_0x4c1e('0xa')]);router[_0x4c1e('0x8')]('/describe',auth[_0x4c1e('0x9')](),controller['describe']);router[_0x4c1e('0x8')](_0x4c1e('0xb'),auth[_0x4c1e('0x9')](),controller[_0x4c1e('0xc')]);router[_0x4c1e('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4c1e('0xe')](_0x4c1e('0xb'),auth['isAuthenticated'](),controller[_0x4c1e('0xf')]);router[_0x4c1e('0x10')](_0x4c1e('0xb'),auth[_0x4c1e('0x9')](),controller[_0x4c1e('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa4c6=['express','Router','../../components/interaction/service','./mailSubstatus.controller','isAuthenticated','index','get','/describe','describe','show','create','put','/:id','update','delete','destroy','multer','connect-timeout'];(function(_0x5ef905,_0x564b87){var _0x367808=function(_0x14f487){while(--_0x14f487){_0x5ef905['push'](_0x5ef905['shift']());}};_0x367808(++_0x564b87);}(_0xa4c6,0x130));var _0x6a4c=function(_0x4ad845,_0x5e50ed){_0x4ad845=_0x4ad845-0x0;var _0x3b2710=_0xa4c6[_0x4ad845];return _0x3b2710;};'use strict';var multer=require(_0x6a4c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6a4c('0x1'));var express=require(_0x6a4c('0x2'));var router=express[_0x6a4c('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6a4c('0x4'));var config=require('../../config/environment');var controller=require(_0x6a4c('0x5'));router['get']('/',auth[_0x6a4c('0x6')](),controller[_0x6a4c('0x7')]);router[_0x6a4c('0x8')](_0x6a4c('0x9'),auth['isAuthenticated'](),controller[_0x6a4c('0xa')]);router[_0x6a4c('0x8')]('/:id',auth[_0x6a4c('0x6')](),controller[_0x6a4c('0xb')]);router['post']('/',auth[_0x6a4c('0x6')](),controller[_0x6a4c('0xc')]);router[_0x6a4c('0xd')](_0x6a4c('0xe'),auth[_0x6a4c('0x6')](),controller[_0x6a4c('0xf')]);router[_0x6a4c('0x10')]('/:id',auth[_0x6a4c('0x6')](),controller[_0x6a4c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 522cbd1..a52c06e 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 _0xeae8=['sequelize','exports','STRING'];(function(_0x4c3646,_0x435f4e){var _0x489112=function(_0x4433ea){while(--_0x4433ea){_0x4c3646['push'](_0x4c3646['shift']());}};_0x489112(++_0x435f4e);}(_0xeae8,0x66));var _0x8eae=function(_0x42ad35,_0x35d038){_0x42ad35=_0x42ad35-0x0;var _0x4b6187=_0xeae8[_0x42ad35];return _0x4b6187;};'use strict';var Sequelize=require(_0x8eae('0x0'));module[_0x8eae('0x1')]={'name':{'type':Sequelize[_0x8eae('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8eae('0x2')]}}; \ No newline at end of file +var _0x3e24=['exports','STRING','name','sequelize'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x3e24,0x167));var _0x43e2=function(_0x257ada,_0x117063){_0x257ada=_0x257ada-0x0;var _0x38bbfd=_0x3e24[_0x257ada];return _0x38bbfd;};'use strict';var Sequelize=require(_0x43e2('0x0'));module[_0x43e2('0x1')]={'name':{'type':Sequelize[_0x43e2('0x2')],'unique':_0x43e2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x43e2('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 3c0292b..9e4f81d 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 _0xf762=['undefined','limit','count','offset','status','Content-Range','save','update','then','destroy','end','sendStatus','name','send','index','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','params','keys','MailSubstatus','rawAttributes','includeAll','create','body','find','describe','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json'];(function(_0x211087,_0x354fdd){var _0x2a581f=function(_0x2928fe){while(--_0x2928fe){_0x211087['push'](_0x211087['shift']());}};_0x2a581f(++_0x354fdd);}(_0xf762,0xc5));var _0x2f76=function(_0x37b6d7,_0x27a4a6){_0x37b6d7=_0x37b6d7-0x0;var _0x1b9b46=_0xf762[_0x37b6d7];return _0x1b9b46;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f76('0x0'));var zipdir=require(_0x2f76('0x1'));var jsonpatch=require(_0x2f76('0x2'));var rp=require(_0x2f76('0x3'));var moment=require(_0x2f76('0x4'));var BPromise=require(_0x2f76('0x5'));var Mustache=require('mustache');var util=require(_0x2f76('0x6'));var path=require(_0x2f76('0x7'));var sox=require('sox');var csv=require(_0x2f76('0x8'));var ejs=require(_0x2f76('0x9'));var fs=require('fs');var fs_extra=require(_0x2f76('0xa'));var _=require(_0x2f76('0xb'));var squel=require(_0x2f76('0xc'));var crypto=require('crypto');var jsforce=require(_0x2f76('0xd'));var deskjs=require(_0x2f76('0xe'));var toCsv=require(_0x2f76('0x8'));var querystring=require(_0x2f76('0xf'));var Papa=require(_0x2f76('0x10'));var Redis=require(_0x2f76('0x11'));var authService=require(_0x2f76('0x12'));var qs=require(_0x2f76('0x13'));var as=require(_0x2f76('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f76('0x15'))(_0x2f76('0x16'));var utils=require(_0x2f76('0x17'));var config=require(_0x2f76('0x18'));var licenseUtil=require(_0x2f76('0x19'));var db=require(_0x2f76('0x1a'))['db'];function respondWithStatusCode(_0x3132f0,_0x11744d){_0x11744d=_0x11744d||0xcc;return function(_0x2ab582){if(_0x2ab582){return _0x3132f0['sendStatus'](_0x11744d);}return _0x3132f0['status'](_0x11744d)['end']();};}function respondWithResult(_0x311a3d,_0x2f9a24){_0x2f9a24=_0x2f9a24||0xc8;return function(_0x3f819a){if(_0x3f819a){return _0x311a3d['status'](_0x2f9a24)[_0x2f76('0x1b')](_0x3f819a);}};}function respondWithFilteredResult(_0x551e99,_0x5e592e){return function(_0x362376){if(_0x362376){var _0x14bd0a=typeof _0x5e592e['offset']===_0x2f76('0x1c')&&typeof _0x5e592e[_0x2f76('0x1d')]===_0x2f76('0x1c');var _0x459416=_0x362376[_0x2f76('0x1e')];var _0x227e4f=_0x14bd0a?0x0:_0x5e592e['offset'];var _0x2752d1=_0x14bd0a?_0x362376[_0x2f76('0x1e')]:_0x5e592e[_0x2f76('0x1f')]+_0x5e592e['limit'];var _0x840067;if(_0x2752d1>=_0x459416){_0x2752d1=_0x459416;_0x840067=0xc8;}else{_0x840067=0xce;}_0x551e99[_0x2f76('0x20')](_0x840067);return _0x551e99['set'](_0x2f76('0x21'),_0x227e4f+'-'+_0x2752d1+'/'+_0x459416)[_0x2f76('0x1b')](_0x362376);}return null;};}function patchUpdates(_0xd4366){return function(_0x2aa850){try{jsonpatch['apply'](_0x2aa850,_0xd4366,!![]);}catch(_0x58afc0){return BPromise['reject'](_0x58afc0);}return _0x2aa850[_0x2f76('0x22')]();};}function saveUpdates(_0x4ce039,_0x53182e){return function(_0x5ceed3){if(_0x5ceed3){return _0x5ceed3[_0x2f76('0x23')](_0x4ce039)[_0x2f76('0x24')](function(_0x144c61){return _0x144c61;});}return null;};}function removeEntity(_0xcfc6b9,_0x4c7985){return function(_0x4dcd5e){if(_0x4dcd5e){return _0x4dcd5e[_0x2f76('0x25')]()[_0x2f76('0x24')](function(){_0xcfc6b9[_0x2f76('0x20')](0xcc)[_0x2f76('0x26')]();});}};}function handleEntityNotFound(_0x16f314,_0xe6803c){return function(_0x220704){if(!_0x220704){_0x16f314[_0x2f76('0x27')](0x194);}return _0x220704;};}function handleError(_0x840eb0,_0x56107b){_0x56107b=_0x56107b||0x1f4;return function(_0x4928fb){logger['error'](_0x4928fb['stack']);if(_0x4928fb[_0x2f76('0x28')]){delete _0x4928fb['name'];}_0x840eb0['status'](_0x56107b)[_0x2f76('0x29')](_0x4928fb);};}exports[_0x2f76('0x2a')]=function(_0x33fac7,_0x28f454){var _0x247695={},_0x248735={},_0x24820f={'count':0x0,'rows':[]};var _0x222463=_['map'](db['MailSubstatus']['rawAttributes'],function(_0x541904){return{'name':_0x541904[_0x2f76('0x2b')],'type':_0x541904[_0x2f76('0x2c')]['key']};});_0x248735[_0x2f76('0x2d')]=_[_0x2f76('0x2e')](_0x222463,_0x2f76('0x28'));_0x248735['query']=_['keys'](_0x33fac7[_0x2f76('0x2f')]);_0x248735[_0x2f76('0x30')]=_[_0x2f76('0x31')](_0x248735[_0x2f76('0x2d')],_0x248735[_0x2f76('0x2f')]);_0x247695[_0x2f76('0x32')]=_[_0x2f76('0x31')](_0x248735[_0x2f76('0x2d')],qs[_0x2f76('0x33')](_0x33fac7[_0x2f76('0x2f')][_0x2f76('0x33')]));_0x247695[_0x2f76('0x32')]=_0x247695['attributes']['length']?_0x247695[_0x2f76('0x32')]:_0x248735[_0x2f76('0x2d')];if(!_0x33fac7[_0x2f76('0x2f')][_0x2f76('0x34')](_0x2f76('0x35'))){_0x247695['limit']=qs[_0x2f76('0x1d')](_0x33fac7[_0x2f76('0x2f')][_0x2f76('0x1d')]);_0x247695[_0x2f76('0x1f')]=qs[_0x2f76('0x1f')](_0x33fac7[_0x2f76('0x2f')][_0x2f76('0x1f')]);}_0x247695[_0x2f76('0x36')]=qs['sort'](_0x33fac7['query'][_0x2f76('0x37')]);_0x247695['where']=qs['filters'](_[_0x2f76('0x38')](_0x33fac7[_0x2f76('0x2f')],_0x248735['filters']),_0x222463);if(_0x33fac7[_0x2f76('0x2f')][_0x2f76('0x39')]){_0x247695[_0x2f76('0x3a')]=_['merge'](_0x247695[_0x2f76('0x3a')],{'$or':_[_0x2f76('0x2e')](_0x222463,function(_0xe5905b){if(_0xe5905b['type']!==_0x2f76('0x3b')){var _0x1267be={};_0x1267be[_0xe5905b[_0x2f76('0x28')]]={'$like':'%'+_0x33fac7[_0x2f76('0x2f')][_0x2f76('0x39')]+'%'};return _0x1267be;}})});}_0x247695=_[_0x2f76('0x3c')]({},_0x247695,_0x33fac7[_0x2f76('0x3d')]);var _0x393691={'where':_0x247695[_0x2f76('0x3a')]};return db['MailSubstatus']['count'](_0x393691)[_0x2f76('0x24')](function(_0x1e2952){_0x24820f[_0x2f76('0x1e')]=_0x1e2952;if(_0x33fac7['query']['includeAll']){_0x247695[_0x2f76('0x3e')]=[{'all':!![]}];}return db['MailSubstatus'][_0x2f76('0x3f')](_0x247695);})['then'](function(_0x2c9cdc){_0x24820f[_0x2f76('0x40')]=_0x2c9cdc;return _0x24820f;})[_0x2f76('0x24')](respondWithFilteredResult(_0x28f454,_0x247695))[_0x2f76('0x41')](handleError(_0x28f454,null));};exports['show']=function(_0x1f9755,_0x29a869){var _0x545c66={'raw':!![],'where':{'id':_0x1f9755[_0x2f76('0x42')]['id']}},_0x9104df={};_0x9104df[_0x2f76('0x2d')]=_[_0x2f76('0x43')](db[_0x2f76('0x44')][_0x2f76('0x45')]);_0x9104df[_0x2f76('0x2f')]=_[_0x2f76('0x43')](_0x1f9755['query']);_0x9104df['filters']=_[_0x2f76('0x31')](_0x9104df['model'],_0x9104df[_0x2f76('0x2f')]);_0x545c66['attributes']=_['intersection'](_0x9104df[_0x2f76('0x2d')],qs['fields'](_0x1f9755[_0x2f76('0x2f')][_0x2f76('0x33')]));_0x545c66[_0x2f76('0x32')]=_0x545c66['attributes']['length']?_0x545c66[_0x2f76('0x32')]:_0x9104df[_0x2f76('0x2d')];if(_0x1f9755['query'][_0x2f76('0x46')]){_0x545c66[_0x2f76('0x3e')]=[{'all':!![]}];}_0x545c66=_[_0x2f76('0x3c')]({},_0x545c66,_0x1f9755[_0x2f76('0x3d')]);return db[_0x2f76('0x44')]['find'](_0x545c66)[_0x2f76('0x24')](handleEntityNotFound(_0x29a869,null))[_0x2f76('0x24')](respondWithResult(_0x29a869,null))[_0x2f76('0x41')](handleError(_0x29a869,null));};exports[_0x2f76('0x47')]=function(_0x317f3b,_0x205975){return db[_0x2f76('0x44')][_0x2f76('0x47')](_0x317f3b[_0x2f76('0x48')],{})['then'](respondWithResult(_0x205975,0xc9))[_0x2f76('0x41')](handleError(_0x205975,null));};exports[_0x2f76('0x23')]=function(_0x4d2c48,_0x4b110f){if(_0x4d2c48[_0x2f76('0x48')]['id']){delete _0x4d2c48['body']['id'];}return db[_0x2f76('0x44')][_0x2f76('0x49')]({'where':{'id':_0x4d2c48[_0x2f76('0x42')]['id']}})['then'](handleEntityNotFound(_0x4b110f,null))[_0x2f76('0x24')](saveUpdates(_0x4d2c48[_0x2f76('0x48')],null))[_0x2f76('0x24')](respondWithResult(_0x4b110f,null))[_0x2f76('0x41')](handleError(_0x4b110f,null));};exports[_0x2f76('0x25')]=function(_0x2c21ac,_0x4d779d){return db['MailSubstatus'][_0x2f76('0x49')]({'where':{'id':_0x2c21ac[_0x2f76('0x42')]['id']}})[_0x2f76('0x24')](handleEntityNotFound(_0x4d779d,null))['then'](removeEntity(_0x4d779d,null))['catch'](handleError(_0x4d779d,null));};exports[_0x2f76('0x4a')]=function(_0x1baaa0,_0x723ccb){return db[_0x2f76('0x44')][_0x2f76('0x4a')]()[_0x2f76('0x24')](respondWithResult(_0x723ccb,null))[_0x2f76('0x41')](handleError(_0x723ccb,null));}; \ No newline at end of file +var _0xf7e3=['index','map','MailSubstatus','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','options','where','includeAll','include','findAll','catch','show','params','create','update','body','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','save','then','destroy','end','sendStatus','error','stack','name'];(function(_0x4c3ece,_0x57053e){var _0x409c1d=function(_0x411a3b){while(--_0x411a3b){_0x4c3ece['push'](_0x4c3ece['shift']());}};_0x409c1d(++_0x57053e);}(_0xf7e3,0xbc));var _0x3f7e=function(_0x3ab9b5,_0x499396){_0x3ab9b5=_0x3ab9b5-0x0;var _0x340ef7=_0xf7e3[_0x3ab9b5];return _0x340ef7;};'use strict';var emlformat=require(_0x3f7e('0x0'));var rimraf=require(_0x3f7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f7e('0x2'));var rp=require('request-promise');var moment=require(_0x3f7e('0x3'));var BPromise=require(_0x3f7e('0x4'));var Mustache=require(_0x3f7e('0x5'));var util=require(_0x3f7e('0x6'));var path=require(_0x3f7e('0x7'));var sox=require(_0x3f7e('0x8'));var csv=require(_0x3f7e('0x9'));var ejs=require(_0x3f7e('0xa'));var fs=require('fs');var fs_extra=require(_0x3f7e('0xb'));var _=require(_0x3f7e('0xc'));var squel=require(_0x3f7e('0xd'));var crypto=require(_0x3f7e('0xe'));var jsforce=require(_0x3f7e('0xf'));var deskjs=require(_0x3f7e('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3f7e('0x11'));var Papa=require(_0x3f7e('0x12'));var Redis=require(_0x3f7e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3f7e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f7e('0x15'));var logger=require(_0x3f7e('0x16'))(_0x3f7e('0x17'));var utils=require(_0x3f7e('0x18'));var config=require(_0x3f7e('0x19'));var licenseUtil=require(_0x3f7e('0x1a'));var db=require(_0x3f7e('0x1b'))['db'];function respondWithStatusCode(_0x1eec61,_0x58d606){_0x58d606=_0x58d606||0xcc;return function(_0x5d5452){if(_0x5d5452){return _0x1eec61['sendStatus'](_0x58d606);}return _0x1eec61[_0x3f7e('0x1c')](_0x58d606)['end']();};}function respondWithResult(_0x2a1a3d,_0x56cdf6){_0x56cdf6=_0x56cdf6||0xc8;return function(_0x50dfff){if(_0x50dfff){return _0x2a1a3d[_0x3f7e('0x1c')](_0x56cdf6)[_0x3f7e('0x1d')](_0x50dfff);}};}function respondWithFilteredResult(_0x3f4dad,_0x2ca13b){return function(_0x47e123){if(_0x47e123){var _0x15e147=typeof _0x2ca13b[_0x3f7e('0x1e')]===_0x3f7e('0x1f')&&typeof _0x2ca13b[_0x3f7e('0x20')]===_0x3f7e('0x1f');var _0x309520=_0x47e123[_0x3f7e('0x21')];var _0x338ff3=_0x15e147?0x0:_0x2ca13b['offset'];var _0x3b11a7=_0x15e147?_0x47e123['count']:_0x2ca13b[_0x3f7e('0x1e')]+_0x2ca13b[_0x3f7e('0x20')];var _0x301862;if(_0x3b11a7>=_0x309520){_0x3b11a7=_0x309520;_0x301862=0xc8;}else{_0x301862=0xce;}_0x3f4dad[_0x3f7e('0x1c')](_0x301862);return _0x3f4dad['set']('Content-Range',_0x338ff3+'-'+_0x3b11a7+'/'+_0x309520)['json'](_0x47e123);}return null;};}function patchUpdates(_0x142db6){return function(_0x4586bb){try{jsonpatch['apply'](_0x4586bb,_0x142db6,!![]);}catch(_0x51c055){return BPromise[_0x3f7e('0x22')](_0x51c055);}return _0x4586bb[_0x3f7e('0x23')]();};}function saveUpdates(_0x565d59,_0x4feb28){return function(_0x56a396){if(_0x56a396){return _0x56a396['update'](_0x565d59)[_0x3f7e('0x24')](function(_0x1da9ac){return _0x1da9ac;});}return null;};}function removeEntity(_0x1b68ed,_0x17a004){return function(_0x340f06){if(_0x340f06){return _0x340f06[_0x3f7e('0x25')]()[_0x3f7e('0x24')](function(){_0x1b68ed[_0x3f7e('0x1c')](0xcc)[_0x3f7e('0x26')]();});}};}function handleEntityNotFound(_0x565d23,_0x40949c){return function(_0xf38e98){if(!_0xf38e98){_0x565d23[_0x3f7e('0x27')](0x194);}return _0xf38e98;};}function handleError(_0x5608ed,_0x31ff5e){_0x31ff5e=_0x31ff5e||0x1f4;return function(_0x422303){logger[_0x3f7e('0x28')](_0x422303[_0x3f7e('0x29')]);if(_0x422303[_0x3f7e('0x2a')]){delete _0x422303['name'];}_0x5608ed[_0x3f7e('0x1c')](_0x31ff5e)['send'](_0x422303);};}exports[_0x3f7e('0x2b')]=function(_0x20ba29,_0x1e7fa5){var _0x55dec7={},_0xd018df={},_0x54f5ef={'count':0x0,'rows':[]};var _0x5b28f8=_[_0x3f7e('0x2c')](db[_0x3f7e('0x2d')][_0x3f7e('0x2e')],function(_0x4601cf){return{'name':_0x4601cf[_0x3f7e('0x2f')],'type':_0x4601cf['type'][_0x3f7e('0x30')]};});_0xd018df[_0x3f7e('0x31')]=_[_0x3f7e('0x2c')](_0x5b28f8,_0x3f7e('0x2a'));_0xd018df['query']=_[_0x3f7e('0x32')](_0x20ba29['query']);_0xd018df[_0x3f7e('0x33')]=_[_0x3f7e('0x34')](_0xd018df[_0x3f7e('0x31')],_0xd018df[_0x3f7e('0x35')]);_0x55dec7[_0x3f7e('0x36')]=_['intersection'](_0xd018df['model'],qs[_0x3f7e('0x37')](_0x20ba29['query'][_0x3f7e('0x37')]));_0x55dec7[_0x3f7e('0x36')]=_0x55dec7['attributes'][_0x3f7e('0x38')]?_0x55dec7[_0x3f7e('0x36')]:_0xd018df[_0x3f7e('0x31')];if(!_0x20ba29['query'][_0x3f7e('0x39')](_0x3f7e('0x3a'))){_0x55dec7[_0x3f7e('0x20')]=qs[_0x3f7e('0x20')](_0x20ba29['query']['limit']);_0x55dec7[_0x3f7e('0x1e')]=qs[_0x3f7e('0x1e')](_0x20ba29['query'][_0x3f7e('0x1e')]);}_0x55dec7[_0x3f7e('0x3b')]=qs[_0x3f7e('0x3c')](_0x20ba29[_0x3f7e('0x35')][_0x3f7e('0x3c')]);_0x55dec7['where']=qs[_0x3f7e('0x33')](_[_0x3f7e('0x3d')](_0x20ba29[_0x3f7e('0x35')],_0xd018df[_0x3f7e('0x33')]),_0x5b28f8);if(_0x20ba29[_0x3f7e('0x35')][_0x3f7e('0x3e')]){_0x55dec7['where']=_[_0x3f7e('0x3f')](_0x55dec7['where'],{'$or':_[_0x3f7e('0x2c')](_0x5b28f8,function(_0x4a8de9){if(_0x4a8de9['type']!=='VIRTUAL'){var _0x19f8e0={};_0x19f8e0[_0x4a8de9['name']]={'$like':'%'+_0x20ba29[_0x3f7e('0x35')][_0x3f7e('0x3e')]+'%'};return _0x19f8e0;}})});}_0x55dec7=_[_0x3f7e('0x3f')]({},_0x55dec7,_0x20ba29[_0x3f7e('0x40')]);var _0xf521ca={'where':_0x55dec7[_0x3f7e('0x41')]};return db['MailSubstatus'][_0x3f7e('0x21')](_0xf521ca)[_0x3f7e('0x24')](function(_0xa936ac){_0x54f5ef[_0x3f7e('0x21')]=_0xa936ac;if(_0x20ba29[_0x3f7e('0x35')][_0x3f7e('0x42')]){_0x55dec7[_0x3f7e('0x43')]=[{'all':!![]}];}return db[_0x3f7e('0x2d')][_0x3f7e('0x44')](_0x55dec7);})['then'](function(_0x19d042){_0x54f5ef['rows']=_0x19d042;return _0x54f5ef;})[_0x3f7e('0x24')](respondWithFilteredResult(_0x1e7fa5,_0x55dec7))[_0x3f7e('0x45')](handleError(_0x1e7fa5,null));};exports[_0x3f7e('0x46')]=function(_0x4575a8,_0xb26dfb){var _0x1df0aa={'raw':!![],'where':{'id':_0x4575a8[_0x3f7e('0x47')]['id']}},_0x2a7866={};_0x2a7866[_0x3f7e('0x31')]=_[_0x3f7e('0x32')](db[_0x3f7e('0x2d')][_0x3f7e('0x2e')]);_0x2a7866[_0x3f7e('0x35')]=_[_0x3f7e('0x32')](_0x4575a8['query']);_0x2a7866[_0x3f7e('0x33')]=_['intersection'](_0x2a7866[_0x3f7e('0x31')],_0x2a7866[_0x3f7e('0x35')]);_0x1df0aa[_0x3f7e('0x36')]=_[_0x3f7e('0x34')](_0x2a7866[_0x3f7e('0x31')],qs['fields'](_0x4575a8[_0x3f7e('0x35')]['fields']));_0x1df0aa[_0x3f7e('0x36')]=_0x1df0aa[_0x3f7e('0x36')][_0x3f7e('0x38')]?_0x1df0aa[_0x3f7e('0x36')]:_0x2a7866[_0x3f7e('0x31')];if(_0x4575a8[_0x3f7e('0x35')][_0x3f7e('0x42')]){_0x1df0aa['include']=[{'all':!![]}];}_0x1df0aa=_[_0x3f7e('0x3f')]({},_0x1df0aa,_0x4575a8[_0x3f7e('0x40')]);return db[_0x3f7e('0x2d')]['find'](_0x1df0aa)[_0x3f7e('0x24')](handleEntityNotFound(_0xb26dfb,null))[_0x3f7e('0x24')](respondWithResult(_0xb26dfb,null))[_0x3f7e('0x45')](handleError(_0xb26dfb,null));};exports[_0x3f7e('0x48')]=function(_0x210786,_0x562fa0){return db[_0x3f7e('0x2d')]['create'](_0x210786['body'],{})[_0x3f7e('0x24')](respondWithResult(_0x562fa0,0xc9))[_0x3f7e('0x45')](handleError(_0x562fa0,null));};exports[_0x3f7e('0x49')]=function(_0x5e1bfb,_0x58a736){if(_0x5e1bfb[_0x3f7e('0x4a')]['id']){delete _0x5e1bfb[_0x3f7e('0x4a')]['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x5e1bfb[_0x3f7e('0x47')]['id']}})[_0x3f7e('0x24')](handleEntityNotFound(_0x58a736,null))['then'](saveUpdates(_0x5e1bfb[_0x3f7e('0x4a')],null))[_0x3f7e('0x24')](respondWithResult(_0x58a736,null))['catch'](handleError(_0x58a736,null));};exports['destroy']=function(_0x1c74d0,_0x4ca07e){return db[_0x3f7e('0x2d')][_0x3f7e('0x4b')]({'where':{'id':_0x1c74d0[_0x3f7e('0x47')]['id']}})[_0x3f7e('0x24')](handleEntityNotFound(_0x4ca07e,null))['then'](removeEntity(_0x4ca07e,null))[_0x3f7e('0x45')](handleError(_0x4ca07e,null));};exports[_0x3f7e('0x4c')]=function(_0x229454,_0x50e09a){return db['MailSubstatus'][_0x3f7e('0x4c')]()['then'](respondWithResult(_0x50e09a,null))['catch'](handleError(_0x50e09a,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 4ef42b1..7d625fb 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 _0xdd9f=['emit','hasOwnProperty','exports','events','MailSubstatus','update'];(function(_0x214f8f,_0x26ccef){var _0x34fefa=function(_0x26451){while(--_0x26451){_0x214f8f['push'](_0x214f8f['shift']());}};_0x34fefa(++_0x26ccef);}(_0xdd9f,0x171));var _0xfdd9=function(_0x55d8c5,_0x10287a){_0x55d8c5=_0x55d8c5-0x0;var _0x225ae5=_0xdd9f[_0x55d8c5];return _0x225ae5;};'use strict';var EventEmitter=require(_0xfdd9('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0xfdd9('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xfdd9('0x2')};function emitEvent(_0x2d4465){return function(_0x15e0c9,_0x1d8cd7,_0xdca62e){MailSubstatusEvents[_0xfdd9('0x3')](_0x2d4465+':'+_0x15e0c9['id'],_0x15e0c9);MailSubstatusEvents[_0xfdd9('0x3')](_0x2d4465,_0x15e0c9);_0xdca62e(null);};}for(var e in events){if(events[_0xfdd9('0x4')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0xfdd9('0x5')]=MailSubstatusEvents; \ No newline at end of file +var _0xc156=['setMaxListeners','emit','hook','exports','../../mysqldb','MailSubstatus'];(function(_0x57294c,_0x181b17){var _0x4e07fd=function(_0x904c8b){while(--_0x904c8b){_0x57294c['push'](_0x57294c['shift']());}};_0x4e07fd(++_0x181b17);}(_0xc156,0x7c));var _0x6c15=function(_0x2fb985,_0x140701){_0x2fb985=_0x2fb985-0x0;var _0x21dba5=_0xc156[_0x2fb985];return _0x21dba5;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x6c15('0x0'))['db'][_0x6c15('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x6c15('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x1f633e){return function(_0x555e2d,_0x4916a4,_0x4ea808){MailSubstatusEvents[_0x6c15('0x3')](_0x1f633e+':'+_0x555e2d['id'],_0x555e2d);MailSubstatusEvents[_0x6c15('0x3')](_0x1f633e,_0x555e2d);_0x4ea808(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x6c15('0x4')](e,emitEvent(event));}}module[_0x6c15('0x5')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 3e28a9f..f86c2e7 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 _0x48fc=['define','MailSubstatus','Condition','update','name','then','./mailSubstatus.attributes','exports','models'];(function(_0x59603c,_0x107405){var _0x14863c=function(_0x245607){while(--_0x245607){_0x59603c['push'](_0x59603c['shift']());}};_0x14863c(++_0x107405);}(_0x48fc,0xa8));var _0xc48f=function(_0x501b68,_0x2508a9){_0x501b68=_0x501b68-0x0;var _0x2f18d4=_0x48fc[_0x501b68];return _0x2f18d4;};'use strict';var attributes=require(_0xc48f('0x0'));module[_0xc48f('0x1')]=function(_0x5a30e3){var _0x1b3a81=_0x5a30e3[_0xc48f('0x2')];return _0x5a30e3[_0xc48f('0x3')](_0xc48f('0x4'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x941b1d,_0x1693a4,_0x2638a6){return _0x1b3a81[_0xc48f('0x5')][_0xc48f('0x6')]({'value':_0x941b1d['name']},{'where':{'field':'mailSubstatus','value':_0x941b1d['_previousDataValues'][_0xc48f('0x7')]}})[_0xc48f('0x8')](function(){_0x2638a6();})['catch'](function(_0x3d9eab){_0x2638a6(_0x3d9eab);});}}});}; \ No newline at end of file +var _0x175c=['then','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues'];(function(_0x44cb52,_0x405806){var _0x422463=function(_0x51c053){while(--_0x51c053){_0x44cb52['push'](_0x44cb52['shift']());}};_0x422463(++_0x405806);}(_0x175c,0x120));var _0xc175=function(_0x5cfdf7,_0x74f0ea){_0x5cfdf7=_0x5cfdf7-0x0;var _0x38aaed=_0x175c[_0x5cfdf7];return _0x38aaed;};'use strict';var attributes=require(_0xc175('0x0'));module[_0xc175('0x1')]=function(_0x59f746){var _0x4f519e=_0x59f746[_0xc175('0x2')];return _0x59f746[_0xc175('0x3')](_0xc175('0x4'),attributes,{'tableName':_0xc175('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xc1711,_0x198101,_0xdf4cae){return _0x4f519e[_0xc175('0x6')][_0xc175('0x7')]({'value':_0xc1711[_0xc175('0x8')]},{'where':{'field':_0xc175('0x9'),'value':_0xc1711[_0xc175('0xa')][_0xc175('0x8')]}})[_0xc175('0xb')](function(){_0xdf4cae();})[_0xc175('0xc')](function(_0x402008){_0xdf4cae(_0x402008);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index fade81f..ed5094a 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 _0x0f03=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment'];(function(_0xbb91d6,_0x55984b){var _0x5daefd=function(_0x5ee2f7){while(--_0x5ee2f7){_0xbb91d6['push'](_0xbb91d6['shift']());}};_0x5daefd(++_0x55984b);}(_0x0f03,0x18e));var _0x30f0=function(_0x529989,_0x10cb1a){_0x529989=_0x529989-0x0;var _0x9ba369=_0x0f03[_0x529989];return _0x9ba369;};'use strict';var _=require('lodash');var util=require(_0x30f0('0x0'));var moment=require(_0x30f0('0x1'));var BPromise=require('bluebird');var rs=require(_0x30f0('0x2'));var fs=require('fs');var Redis=require(_0x30f0('0x3'));var db=require(_0x30f0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x30f0('0x5'))(_0x30f0('0x6'));var config=require('../../config/environment');var jayson=require(_0x30f0('0x7'));var client=jayson[_0x30f0('0x8')][_0x30f0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c86d2,_0x31aa3a,_0x26d761){return new BPromise(function(_0x4e29fd,_0x1469ea){return client[_0x30f0('0xa')](_0x4c86d2,_0x26d761)[_0x30f0('0xb')](function(_0xc37b1d){logger[_0x30f0('0xc')](_0x30f0('0xd'),_0x31aa3a,_0x30f0('0xe'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x31aa3a,_0x30f0('0xe'),JSON[_0x30f0('0xf')](_0xc37b1d));if(_0xc37b1d['error']){if(_0xc37b1d[_0x30f0('0x10')][_0x30f0('0x11')]===0x1f4){logger[_0x30f0('0x10')](_0x30f0('0xd'),_0x31aa3a,_0xc37b1d[_0x30f0('0x10')][_0x30f0('0x12')]);return _0x1469ea(_0xc37b1d[_0x30f0('0x10')][_0x30f0('0x12')]);}logger[_0x30f0('0x10')](_0x30f0('0xd'),_0x31aa3a,_0xc37b1d[_0x30f0('0x10')][_0x30f0('0x12')]);return _0x4e29fd(_0xc37b1d[_0x30f0('0x10')][_0x30f0('0x12')]);}else{logger['info'](_0x30f0('0xd'),_0x31aa3a,_0x30f0('0xe'));_0x4e29fd(_0xc37b1d['result'][_0x30f0('0x12')]);}})[_0x30f0('0x13')](function(_0x56dd24){logger[_0x30f0('0x10')](_0x30f0('0xd'),_0x31aa3a,_0x56dd24);_0x1469ea(_0x56dd24);});});} \ No newline at end of file +var _0x71bc=['result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','MailSubstatus,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent'];(function(_0x29c211,_0x1aa5b4){var _0x4ae692=function(_0x37c5bc){while(--_0x37c5bc){_0x29c211['push'](_0x29c211['shift']());}};_0x4ae692(++_0x1aa5b4);}(_0x71bc,0x132));var _0xc71b=function(_0xabf9d5,_0x9d1c7e){_0xabf9d5=_0xabf9d5-0x0;var _0x507824=_0x71bc[_0xabf9d5];return _0x507824;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc71b('0x0'));var rs=require(_0xc71b('0x1'));var fs=require('fs');var Redis=require(_0xc71b('0x2'));var db=require(_0xc71b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc71b('0x4'))(_0xc71b('0x5'));var config=require(_0xc71b('0x6'));var jayson=require(_0xc71b('0x7'));var client=jayson['client'][_0xc71b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x461788,_0x2d1342,_0x24ff83){return new BPromise(function(_0x12a53d,_0x1fd8c6){return client['request'](_0x461788,_0x24ff83)['then'](function(_0x2a2acc){logger['info'](_0xc71b('0x9'),_0x2d1342,'request\x20sent');logger[_0xc71b('0xa')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x2d1342,'request\x20sent',JSON[_0xc71b('0xb')](_0x2a2acc));if(_0x2a2acc['error']){if(_0x2a2acc[_0xc71b('0xc')][_0xc71b('0xd')]===0x1f4){logger[_0xc71b('0xc')](_0xc71b('0x9'),_0x2d1342,_0x2a2acc[_0xc71b('0xc')][_0xc71b('0xe')]);return _0x1fd8c6(_0x2a2acc[_0xc71b('0xc')][_0xc71b('0xe')]);}logger[_0xc71b('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x2d1342,_0x2a2acc[_0xc71b('0xc')]['message']);return _0x12a53d(_0x2a2acc[_0xc71b('0xc')]['message']);}else{logger[_0xc71b('0xf')](_0xc71b('0x9'),_0x2d1342,_0xc71b('0x10'));_0x12a53d(_0x2a2acc[_0xc71b('0x11')][_0xc71b('0xe')]);}})[_0xc71b('0x12')](function(_0x153b22){logger[_0xc71b('0xc')](_0xc71b('0x9'),_0x2d1342,_0x153b22);_0x1fd8c6(_0x153b22);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 001741d..83468be 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 _0xcdc5=['fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','/:id','post','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x225805,_0x596d93){var _0x1c902c=function(_0x54371e){while(--_0x54371e){_0x225805['push'](_0x225805['shift']());}};_0x1c902c(++_0x596d93);}(_0xcdc5,0x18a));var _0x5cdc=function(_0x170a83,_0x428934){_0x170a83=_0x170a83-0x0;var _0xbc0eb1=_0xcdc5[_0x170a83];return _0xbc0eb1;};'use strict';var multer=require(_0x5cdc('0x0'));var util=require(_0x5cdc('0x1'));var path=require(_0x5cdc('0x2'));var timeout=require(_0x5cdc('0x3'));var express=require(_0x5cdc('0x4'));var router=express['Router']();var fs_extra=require(_0x5cdc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5cdc('0x6'));var config=require(_0x5cdc('0x7'));var controller=require(_0x5cdc('0x8'));router[_0x5cdc('0x9')]('/',auth[_0x5cdc('0xa')](),controller[_0x5cdc('0xb')]);router[_0x5cdc('0x9')](_0x5cdc('0xc'),auth[_0x5cdc('0xa')](),controller['describe']);router['get'](_0x5cdc('0xd'),auth[_0x5cdc('0xa')](),controller['show']);router[_0x5cdc('0xe')]('/',auth[_0x5cdc('0xa')](),controller['create']);router[_0x5cdc('0xf')](_0x5cdc('0xd'),auth[_0x5cdc('0xa')](),controller[_0x5cdc('0x10')]);router['delete'](_0x5cdc('0xd'),auth[_0x5cdc('0xa')](),controller[_0x5cdc('0x11')]);module[_0x5cdc('0x12')]=router; \ No newline at end of file +var _0xa264=['post','create','put','/:id','destroy','exports','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xa264,0x1e2));var _0x4a26=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xa264[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require('multer');var util=require(_0x4a26('0x0'));var path=require(_0x4a26('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4a26('0x2')]();var fs_extra=require(_0x4a26('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4a26('0x4'));var config=require(_0x4a26('0x5'));var controller=require('./mailTransferReport.controller');router[_0x4a26('0x6')]('/',auth[_0x4a26('0x7')](),controller[_0x4a26('0x8')]);router[_0x4a26('0x6')](_0x4a26('0x9'),auth[_0x4a26('0x7')](),controller['describe']);router[_0x4a26('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x4a26('0xa')]);router[_0x4a26('0xb')]('/',auth[_0x4a26('0x7')](),controller[_0x4a26('0xc')]);router[_0x4a26('0xd')](_0x4a26('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x4a26('0xe'),auth[_0x4a26('0x7')](),controller[_0x4a26('0xf')]);module[_0x4a26('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index e2e1c65..63b95f9 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x4747bf,_0x269e79){var _0x1061e4=function(_0x1a3653){while(--_0x1a3653){_0x4747bf['push'](_0x4747bf['shift']());}};_0x1061e4(++_0x269e79);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xf3cd[_0x481bf7];return _0x461787;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x483377,_0x90b3e3){var _0x22cef7=function(_0xeeab30){while(--_0xeeab30){_0x483377['push'](_0x483377['shift']());}};_0x22cef7(++_0x90b3e3);}(_0xedd9,0xfc));var _0x9edd=function(_0x4b83de,_0x398ac0){_0x4b83de=_0x4b83de-0x0;var _0x205940=_0xedd9[_0x4b83de];return _0x205940;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 8d743f5..68114e6 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 _0x3b69=['VIRTUAL','includeAll','findAll','catch','show','params','include','options','find','body','destroy','describe','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','limit','count','offset','status','set','Content-Range','reject','then','sendStatus','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','model','keys','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x110d3e,_0x129d53){var _0x99d8a1=function(_0x2043ae){while(--_0x2043ae){_0x110d3e['push'](_0x110d3e['shift']());}};_0x99d8a1(++_0x129d53);}(_0x3b69,0x179));var _0x93b6=function(_0x1c3309,_0x22e25d){_0x1c3309=_0x1c3309-0x0;var _0x304ad4=_0x3b69[_0x1c3309];return _0x304ad4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x93b6('0x0'));var zipdir=require(_0x93b6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x93b6('0x2'));var moment=require('moment');var BPromise=require(_0x93b6('0x3'));var Mustache=require(_0x93b6('0x4'));var util=require(_0x93b6('0x5'));var path=require(_0x93b6('0x6'));var sox=require(_0x93b6('0x7'));var csv=require('to-csv');var ejs=require(_0x93b6('0x8'));var fs=require('fs');var fs_extra=require(_0x93b6('0x9'));var _=require(_0x93b6('0xa'));var squel=require(_0x93b6('0xb'));var crypto=require('crypto');var jsforce=require(_0x93b6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x93b6('0xd'));var querystring=require(_0x93b6('0xe'));var Papa=require('papaparse');var Redis=require(_0x93b6('0xf'));var authService=require(_0x93b6('0x10'));var qs=require(_0x93b6('0x11'));var as=require(_0x93b6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x93b6('0x13'))(_0x93b6('0x14'));var utils=require(_0x93b6('0x15'));var config=require(_0x93b6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x93b6('0x17'))['db'];function respondWithStatusCode(_0x2c822d,_0x50e53d){_0x50e53d=_0x50e53d||0xcc;return function(_0x504a85){if(_0x504a85){return _0x2c822d['sendStatus'](_0x50e53d);}return _0x2c822d['status'](_0x50e53d)[_0x93b6('0x18')]();};}function respondWithResult(_0x23e3c9,_0x213b83){_0x213b83=_0x213b83||0xc8;return function(_0x565e3f){if(_0x565e3f){return _0x23e3c9['status'](_0x213b83)[_0x93b6('0x19')](_0x565e3f);}};}function respondWithFilteredResult(_0x34246e,_0x454fd3){return function(_0x24a27c){if(_0x24a27c){var _0x42a024=typeof _0x454fd3['offset']==='undefined'&&typeof _0x454fd3[_0x93b6('0x1a')]==='undefined';var _0x4a4068=_0x24a27c[_0x93b6('0x1b')];var _0x4354f5=_0x42a024?0x0:_0x454fd3['offset'];var _0x3d1b71=_0x42a024?_0x24a27c[_0x93b6('0x1b')]:_0x454fd3[_0x93b6('0x1c')]+_0x454fd3[_0x93b6('0x1a')];var _0x79b62;if(_0x3d1b71>=_0x4a4068){_0x3d1b71=_0x4a4068;_0x79b62=0xc8;}else{_0x79b62=0xce;}_0x34246e[_0x93b6('0x1d')](_0x79b62);return _0x34246e[_0x93b6('0x1e')](_0x93b6('0x1f'),_0x4354f5+'-'+_0x3d1b71+'/'+_0x4a4068)[_0x93b6('0x19')](_0x24a27c);}return null;};}function patchUpdates(_0x2787cb){return function(_0x9fd31b){try{jsonpatch['apply'](_0x9fd31b,_0x2787cb,!![]);}catch(_0x19ee18){return BPromise[_0x93b6('0x20')](_0x19ee18);}return _0x9fd31b['save']();};}function saveUpdates(_0x42f4b1,_0x1aa0a0){return function(_0x2de4ca){if(_0x2de4ca){return _0x2de4ca['update'](_0x42f4b1)[_0x93b6('0x21')](function(_0x133de0){return _0x133de0;});}return null;};}function removeEntity(_0x57aff9,_0xb0a546){return function(_0x48e74e){if(_0x48e74e){return _0x48e74e['destroy']()[_0x93b6('0x21')](function(){_0x57aff9[_0x93b6('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x241062,_0x371c38){return function(_0x4cb1fb){if(!_0x4cb1fb){_0x241062[_0x93b6('0x22')](0x194);}return _0x4cb1fb;};}function handleError(_0x38bc3a,_0x27f416){_0x27f416=_0x27f416||0x1f4;return function(_0x6bab40){logger[_0x93b6('0x23')](_0x6bab40[_0x93b6('0x24')]);if(_0x6bab40['name']){delete _0x6bab40[_0x93b6('0x25')];}_0x38bc3a[_0x93b6('0x1d')](_0x27f416)[_0x93b6('0x26')](_0x6bab40);};}exports[_0x93b6('0x27')]=function(_0x582dfd,_0x1449a2){var _0x4225ae={},_0x5aa6e3={},_0x3c0d24={'count':0x0,'rows':[]};var _0x3f8c32=_[_0x93b6('0x28')](db[_0x93b6('0x29')][_0x93b6('0x2a')],function(_0x5dd24d){return{'name':_0x5dd24d[_0x93b6('0x2b')],'type':_0x5dd24d[_0x93b6('0x2c')]['key']};});_0x5aa6e3[_0x93b6('0x2d')]=_['map'](_0x3f8c32,'name');_0x5aa6e3['query']=_[_0x93b6('0x2e')](_0x582dfd['query']);_0x5aa6e3[_0x93b6('0x2f')]=_['intersection'](_0x5aa6e3[_0x93b6('0x2d')],_0x5aa6e3[_0x93b6('0x30')]);_0x4225ae['attributes']=_[_0x93b6('0x31')](_0x5aa6e3[_0x93b6('0x2d')],qs[_0x93b6('0x32')](_0x582dfd[_0x93b6('0x30')][_0x93b6('0x32')]));_0x4225ae[_0x93b6('0x33')]=_0x4225ae[_0x93b6('0x33')][_0x93b6('0x34')]?_0x4225ae[_0x93b6('0x33')]:_0x5aa6e3[_0x93b6('0x2d')];if(!_0x582dfd[_0x93b6('0x30')][_0x93b6('0x35')](_0x93b6('0x36'))){_0x4225ae[_0x93b6('0x1a')]=qs[_0x93b6('0x1a')](_0x582dfd[_0x93b6('0x30')][_0x93b6('0x1a')]);_0x4225ae[_0x93b6('0x1c')]=qs[_0x93b6('0x1c')](_0x582dfd[_0x93b6('0x30')][_0x93b6('0x1c')]);}_0x4225ae[_0x93b6('0x37')]=qs['sort'](_0x582dfd[_0x93b6('0x30')][_0x93b6('0x38')]);_0x4225ae[_0x93b6('0x39')]=qs[_0x93b6('0x2f')](_[_0x93b6('0x3a')](_0x582dfd[_0x93b6('0x30')],_0x5aa6e3[_0x93b6('0x2f')]),_0x3f8c32);if(_0x582dfd[_0x93b6('0x30')][_0x93b6('0x3b')]){_0x4225ae[_0x93b6('0x39')]=_[_0x93b6('0x3c')](_0x4225ae[_0x93b6('0x39')],{'$or':_[_0x93b6('0x28')](_0x3f8c32,function(_0xd414c3){if(_0xd414c3[_0x93b6('0x2c')]!==_0x93b6('0x3d')){var _0x402996={};_0x402996[_0xd414c3[_0x93b6('0x25')]]={'$like':'%'+_0x582dfd[_0x93b6('0x30')][_0x93b6('0x3b')]+'%'};return _0x402996;}})});}_0x4225ae=_[_0x93b6('0x3c')]({},_0x4225ae,_0x582dfd['options']);var _0x221508={'where':_0x4225ae[_0x93b6('0x39')]};return db[_0x93b6('0x29')]['count'](_0x221508)['then'](function(_0x548533){_0x3c0d24[_0x93b6('0x1b')]=_0x548533;if(_0x582dfd['query'][_0x93b6('0x3e')]){_0x4225ae['include']=[{'all':!![]}];}return db[_0x93b6('0x29')][_0x93b6('0x3f')](_0x4225ae);})[_0x93b6('0x21')](function(_0x2582f0){_0x3c0d24['rows']=_0x2582f0;return _0x3c0d24;})['then'](respondWithFilteredResult(_0x1449a2,_0x4225ae))[_0x93b6('0x40')](handleError(_0x1449a2,null));};exports[_0x93b6('0x41')]=function(_0x155699,_0x25ff28){var _0x2e7726={'raw':!![],'where':{'id':_0x155699[_0x93b6('0x42')]['id']}},_0x248a3a={};_0x248a3a[_0x93b6('0x2d')]=_[_0x93b6('0x2e')](db['MailTransferReport'][_0x93b6('0x2a')]);_0x248a3a[_0x93b6('0x30')]=_[_0x93b6('0x2e')](_0x155699[_0x93b6('0x30')]);_0x248a3a[_0x93b6('0x2f')]=_['intersection'](_0x248a3a[_0x93b6('0x2d')],_0x248a3a[_0x93b6('0x30')]);_0x2e7726[_0x93b6('0x33')]=_[_0x93b6('0x31')](_0x248a3a[_0x93b6('0x2d')],qs[_0x93b6('0x32')](_0x155699[_0x93b6('0x30')][_0x93b6('0x32')]));_0x2e7726[_0x93b6('0x33')]=_0x2e7726[_0x93b6('0x33')][_0x93b6('0x34')]?_0x2e7726['attributes']:_0x248a3a[_0x93b6('0x2d')];if(_0x155699['query']['includeAll']){_0x2e7726[_0x93b6('0x43')]=[{'all':!![]}];}_0x2e7726=_[_0x93b6('0x3c')]({},_0x2e7726,_0x155699[_0x93b6('0x44')]);return db['MailTransferReport'][_0x93b6('0x45')](_0x2e7726)[_0x93b6('0x21')](handleEntityNotFound(_0x25ff28,null))[_0x93b6('0x21')](respondWithResult(_0x25ff28,null))[_0x93b6('0x40')](handleError(_0x25ff28,null));};exports['create']=function(_0x2243d0,_0x6329c0){return db[_0x93b6('0x29')]['create'](_0x2243d0['body'],{})[_0x93b6('0x21')](respondWithResult(_0x6329c0,0xc9))[_0x93b6('0x40')](handleError(_0x6329c0,null));};exports['update']=function(_0x2a8e98,_0x48fc3b){if(_0x2a8e98[_0x93b6('0x46')]['id']){delete _0x2a8e98[_0x93b6('0x46')]['id'];}return db[_0x93b6('0x29')][_0x93b6('0x45')]({'where':{'id':_0x2a8e98[_0x93b6('0x42')]['id']}})[_0x93b6('0x21')](handleEntityNotFound(_0x48fc3b,null))['then'](saveUpdates(_0x2a8e98[_0x93b6('0x46')],null))[_0x93b6('0x21')](respondWithResult(_0x48fc3b,null))[_0x93b6('0x40')](handleError(_0x48fc3b,null));};exports[_0x93b6('0x47')]=function(_0x1c9a9d,_0x5d8f78){return db['MailTransferReport'][_0x93b6('0x45')]({'where':{'id':_0x1c9a9d[_0x93b6('0x42')]['id']}})[_0x93b6('0x21')](handleEntityNotFound(_0x5d8f78,null))[_0x93b6('0x21')](removeEntity(_0x5d8f78,null))[_0x93b6('0x40')](handleError(_0x5d8f78,null));};exports[_0x93b6('0x48')]=function(_0x4e4522,_0x182bd6){return db[_0x93b6('0x29')][_0x93b6('0x48')]()[_0x93b6('0x21')](respondWithResult(_0x182bd6,null))[_0x93b6('0x40')](handleError(_0x182bd6,null));}; \ No newline at end of file +var _0x6d5f=['create','catch','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','then','destroy','error','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filters','where','merge','VIRTUAL','filter','options','MailTransferReport','includeAll','include','findAll','show','params','rawAttributes','find'];(function(_0x5ae00c,_0x3a689a){var _0x59950e=function(_0x37305f){while(--_0x37305f){_0x5ae00c['push'](_0x5ae00c['shift']());}};_0x59950e(++_0x3a689a);}(_0x6d5f,0xa1));var _0xf6d5=function(_0x1a3e76,_0x43a50c){_0x1a3e76=_0x1a3e76-0x0;var _0x41bc26=_0x6d5f[_0x1a3e76];return _0x41bc26;};'use strict';var emlformat=require(_0xf6d5('0x0'));var rimraf=require(_0xf6d5('0x1'));var zipdir=require(_0xf6d5('0x2'));var jsonpatch=require(_0xf6d5('0x3'));var rp=require('request-promise');var moment=require(_0xf6d5('0x4'));var BPromise=require(_0xf6d5('0x5'));var Mustache=require(_0xf6d5('0x6'));var util=require(_0xf6d5('0x7'));var path=require(_0xf6d5('0x8'));var sox=require(_0xf6d5('0x9'));var csv=require(_0xf6d5('0xa'));var ejs=require(_0xf6d5('0xb'));var fs=require('fs');var fs_extra=require(_0xf6d5('0xc'));var _=require(_0xf6d5('0xd'));var squel=require(_0xf6d5('0xe'));var crypto=require(_0xf6d5('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xf6d5('0x10'));var toCsv=require(_0xf6d5('0xa'));var querystring=require(_0xf6d5('0x11'));var Papa=require(_0xf6d5('0x12'));var Redis=require('ioredis');var authService=require(_0xf6d5('0x13'));var qs=require(_0xf6d5('0x14'));var as=require(_0xf6d5('0x15'));var hardwareService=require(_0xf6d5('0x16'));var logger=require(_0xf6d5('0x17'))('api');var utils=require(_0xf6d5('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf6d5('0x19'));var db=require(_0xf6d5('0x1a'))['db'];function respondWithStatusCode(_0x12edad,_0x54470c){_0x54470c=_0x54470c||0xcc;return function(_0x3f9d22){if(_0x3f9d22){return _0x12edad[_0xf6d5('0x1b')](_0x54470c);}return _0x12edad[_0xf6d5('0x1c')](_0x54470c)[_0xf6d5('0x1d')]();};}function respondWithResult(_0x2479ff,_0xf075c3){_0xf075c3=_0xf075c3||0xc8;return function(_0x4df6e0){if(_0x4df6e0){return _0x2479ff[_0xf6d5('0x1c')](_0xf075c3)[_0xf6d5('0x1e')](_0x4df6e0);}};}function respondWithFilteredResult(_0x27e7b4,_0x481670){return function(_0x15a509){if(_0x15a509){var _0x1bc1a4=typeof _0x481670[_0xf6d5('0x1f')]==='undefined'&&typeof _0x481670[_0xf6d5('0x20')]===_0xf6d5('0x21');var _0x54a65f=_0x15a509[_0xf6d5('0x22')];var _0x389f32=_0x1bc1a4?0x0:_0x481670[_0xf6d5('0x1f')];var _0x6534ee=_0x1bc1a4?_0x15a509['count']:_0x481670[_0xf6d5('0x1f')]+_0x481670[_0xf6d5('0x20')];var _0x132a0d;if(_0x6534ee>=_0x54a65f){_0x6534ee=_0x54a65f;_0x132a0d=0xc8;}else{_0x132a0d=0xce;}_0x27e7b4[_0xf6d5('0x1c')](_0x132a0d);return _0x27e7b4[_0xf6d5('0x23')]('Content-Range',_0x389f32+'-'+_0x6534ee+'/'+_0x54a65f)[_0xf6d5('0x1e')](_0x15a509);}return null;};}function patchUpdates(_0x4bf936){return function(_0x266192){try{jsonpatch[_0xf6d5('0x24')](_0x266192,_0x4bf936,!![]);}catch(_0x70b06e){return BPromise['reject'](_0x70b06e);}return _0x266192[_0xf6d5('0x25')]();};}function saveUpdates(_0x33ed10,_0x4a4380){return function(_0x252ada){if(_0x252ada){return _0x252ada['update'](_0x33ed10)[_0xf6d5('0x26')](function(_0x3485ef){return _0x3485ef;});}return null;};}function removeEntity(_0x3024f3,_0x3b4e6e){return function(_0x5093c4){if(_0x5093c4){return _0x5093c4[_0xf6d5('0x27')]()[_0xf6d5('0x26')](function(){_0x3024f3[_0xf6d5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45669c,_0x2b76eb){return function(_0x4ad74f){if(!_0x4ad74f){_0x45669c[_0xf6d5('0x1b')](0x194);}return _0x4ad74f;};}function handleError(_0x933919,_0x4b5a1a){_0x4b5a1a=_0x4b5a1a||0x1f4;return function(_0x77a41f){logger[_0xf6d5('0x28')](_0x77a41f['stack']);if(_0x77a41f[_0xf6d5('0x29')]){delete _0x77a41f['name'];}_0x933919[_0xf6d5('0x1c')](_0x4b5a1a)[_0xf6d5('0x2a')](_0x77a41f);};}exports[_0xf6d5('0x2b')]=function(_0x10d486,_0x7b20c0){var _0x149a49={},_0x412cbd={},_0x29db91={'count':0x0,'rows':[]};var _0x4c2150=_[_0xf6d5('0x2c')](db['MailTransferReport']['rawAttributes'],function(_0x63a721){return{'name':_0x63a721[_0xf6d5('0x2d')],'type':_0x63a721[_0xf6d5('0x2e')][_0xf6d5('0x2f')]};});_0x412cbd[_0xf6d5('0x30')]=_[_0xf6d5('0x2c')](_0x4c2150,_0xf6d5('0x29'));_0x412cbd[_0xf6d5('0x31')]=_[_0xf6d5('0x32')](_0x10d486[_0xf6d5('0x31')]);_0x412cbd['filters']=_[_0xf6d5('0x33')](_0x412cbd[_0xf6d5('0x30')],_0x412cbd[_0xf6d5('0x31')]);_0x149a49[_0xf6d5('0x34')]=_[_0xf6d5('0x33')](_0x412cbd[_0xf6d5('0x30')],qs[_0xf6d5('0x35')](_0x10d486[_0xf6d5('0x31')]['fields']));_0x149a49['attributes']=_0x149a49[_0xf6d5('0x34')][_0xf6d5('0x36')]?_0x149a49[_0xf6d5('0x34')]:_0x412cbd['model'];if(!_0x10d486[_0xf6d5('0x31')][_0xf6d5('0x37')]('nolimit')){_0x149a49[_0xf6d5('0x20')]=qs[_0xf6d5('0x20')](_0x10d486['query'][_0xf6d5('0x20')]);_0x149a49[_0xf6d5('0x1f')]=qs[_0xf6d5('0x1f')](_0x10d486['query'][_0xf6d5('0x1f')]);}_0x149a49[_0xf6d5('0x38')]=qs[_0xf6d5('0x39')](_0x10d486[_0xf6d5('0x31')][_0xf6d5('0x39')]);_0x149a49['where']=qs['filters'](_[_0xf6d5('0x3a')](_0x10d486[_0xf6d5('0x31')],_0x412cbd[_0xf6d5('0x3b')]),_0x4c2150);if(_0x10d486['query']['filter']){_0x149a49[_0xf6d5('0x3c')]=_[_0xf6d5('0x3d')](_0x149a49[_0xf6d5('0x3c')],{'$or':_[_0xf6d5('0x2c')](_0x4c2150,function(_0x16139e){if(_0x16139e[_0xf6d5('0x2e')]!==_0xf6d5('0x3e')){var _0x5b502f={};_0x5b502f[_0x16139e[_0xf6d5('0x29')]]={'$like':'%'+_0x10d486['query'][_0xf6d5('0x3f')]+'%'};return _0x5b502f;}})});}_0x149a49=_[_0xf6d5('0x3d')]({},_0x149a49,_0x10d486[_0xf6d5('0x40')]);var _0x29de68={'where':_0x149a49[_0xf6d5('0x3c')]};return db[_0xf6d5('0x41')][_0xf6d5('0x22')](_0x29de68)['then'](function(_0x3d757d){_0x29db91[_0xf6d5('0x22')]=_0x3d757d;if(_0x10d486[_0xf6d5('0x31')][_0xf6d5('0x42')]){_0x149a49[_0xf6d5('0x43')]=[{'all':!![]}];}return db[_0xf6d5('0x41')][_0xf6d5('0x44')](_0x149a49);})[_0xf6d5('0x26')](function(_0x2c6bc7){_0x29db91['rows']=_0x2c6bc7;return _0x29db91;})[_0xf6d5('0x26')](respondWithFilteredResult(_0x7b20c0,_0x149a49))['catch'](handleError(_0x7b20c0,null));};exports[_0xf6d5('0x45')]=function(_0x3029b4,_0x10c040){var _0x449adc={'raw':!![],'where':{'id':_0x3029b4[_0xf6d5('0x46')]['id']}},_0x5bc24e={};_0x5bc24e['model']=_['keys'](db[_0xf6d5('0x41')][_0xf6d5('0x47')]);_0x5bc24e[_0xf6d5('0x31')]=_[_0xf6d5('0x32')](_0x3029b4[_0xf6d5('0x31')]);_0x5bc24e['filters']=_[_0xf6d5('0x33')](_0x5bc24e[_0xf6d5('0x30')],_0x5bc24e['query']);_0x449adc['attributes']=_['intersection'](_0x5bc24e[_0xf6d5('0x30')],qs[_0xf6d5('0x35')](_0x3029b4[_0xf6d5('0x31')][_0xf6d5('0x35')]));_0x449adc[_0xf6d5('0x34')]=_0x449adc['attributes'][_0xf6d5('0x36')]?_0x449adc[_0xf6d5('0x34')]:_0x5bc24e[_0xf6d5('0x30')];if(_0x3029b4[_0xf6d5('0x31')][_0xf6d5('0x42')]){_0x449adc[_0xf6d5('0x43')]=[{'all':!![]}];}_0x449adc=_[_0xf6d5('0x3d')]({},_0x449adc,_0x3029b4['options']);return db[_0xf6d5('0x41')][_0xf6d5('0x48')](_0x449adc)[_0xf6d5('0x26')](handleEntityNotFound(_0x10c040,null))['then'](respondWithResult(_0x10c040,null))['catch'](handleError(_0x10c040,null));};exports[_0xf6d5('0x49')]=function(_0x34a96a,_0x1feacf){return db['MailTransferReport']['create'](_0x34a96a['body'],{})['then'](respondWithResult(_0x1feacf,0xc9))[_0xf6d5('0x4a')](handleError(_0x1feacf,null));};exports[_0xf6d5('0x4b')]=function(_0x17b15b,_0x665ea3){if(_0x17b15b['body']['id']){delete _0x17b15b[_0xf6d5('0x4c')]['id'];}return db['MailTransferReport'][_0xf6d5('0x48')]({'where':{'id':_0x17b15b[_0xf6d5('0x46')]['id']}})[_0xf6d5('0x26')](handleEntityNotFound(_0x665ea3,null))[_0xf6d5('0x26')](saveUpdates(_0x17b15b[_0xf6d5('0x4c')],null))[_0xf6d5('0x26')](respondWithResult(_0x665ea3,null))['catch'](handleError(_0x665ea3,null));};exports[_0xf6d5('0x27')]=function(_0x23fd7a,_0x1ed78e){return db[_0xf6d5('0x41')]['find']({'where':{'id':_0x23fd7a[_0xf6d5('0x46')]['id']}})['then'](handleEntityNotFound(_0x1ed78e,null))[_0xf6d5('0x26')](removeEntity(_0x1ed78e,null))[_0xf6d5('0x4a')](handleError(_0x1ed78e,null));};exports['describe']=function(_0x1b7737,_0x42412d){return db[_0xf6d5('0x41')][_0xf6d5('0x4d')]()['then'](respondWithResult(_0x42412d,null))['catch'](handleError(_0x42412d,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 83dd447..62a2eba 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 _0x397c=['uniqueid','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','MailTransferReport','report_mail_transfer'];(function(_0x2d9d73,_0x17370d){var _0x2d084c=function(_0x962495){while(--_0x962495){_0x2d9d73['push'](_0x2d9d73['shift']());}};_0x2d084c(++_0x17370d);}(_0x397c,0xc1));var _0xc397=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x397c[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0xc397('0x0'));var util=require(_0xc397('0x1'));var logger=require(_0xc397('0x2'))('api');var moment=require(_0xc397('0x3'));var BPromise=require('bluebird');var rp=require(_0xc397('0x4'));var fs=require('fs');var path=require(_0xc397('0x5'));var rimraf=require(_0xc397('0x6'));var config=require(_0xc397('0x7'));var attributes=require(_0xc397('0x8'));module['exports']=function(_0x1d39b9,_0x187c41){return _0x1d39b9['define'](_0xc397('0x9'),attributes,{'tableName':_0xc397('0xa'),'paranoid':![],'indexes':[{'name':_0xc397('0xb'),'fields':[_0xc397('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8c79=['lodash','moment','request-promise','path','../../config/environment','MailTransferReport','report_mail_transfer'];(function(_0x136bc6,_0x491dc9){var _0x3bd141=function(_0x5beef1){while(--_0x5beef1){_0x136bc6['push'](_0x136bc6['shift']());}};_0x3bd141(++_0x491dc9);}(_0x8c79,0xa8));var _0x98c7=function(_0x1717a0,_0x3df0e9){_0x1717a0=_0x1717a0-0x0;var _0x4065f3=_0x8c79[_0x1717a0];return _0x4065f3;};'use strict';var _=require(_0x98c7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x98c7('0x1'));var BPromise=require('bluebird');var rp=require(_0x98c7('0x2'));var fs=require('fs');var path=require(_0x98c7('0x3'));var rimraf=require('rimraf');var config=require(_0x98c7('0x4'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x553d51,_0x9e9609){return _0x553d51['define'](_0x98c7('0x5'),attributes,{'tableName':_0x98c7('0x6'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 74de08c..aa0e1fa 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 _0x4abc=['info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x54d6da,_0x597a6d){var _0x520096=function(_0xadc15a){while(--_0xadc15a){_0x54d6da['push'](_0x54d6da['shift']());}};_0x520096(++_0x597a6d);}(_0x4abc,0x79));var _0xc4ab=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x4abc[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0xc4ab('0x0'));var util=require('util');var moment=require(_0xc4ab('0x1'));var BPromise=require(_0xc4ab('0x2'));var rs=require(_0xc4ab('0x3'));var fs=require('fs');var Redis=require(_0xc4ab('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc4ab('0x5'));var logger=require(_0xc4ab('0x6'))('rpc');var config=require(_0xc4ab('0x7'));var jayson=require(_0xc4ab('0x8'));var client=jayson[_0xc4ab('0x9')][_0xc4ab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x360678,_0x4f4b74,_0x391dba){return new BPromise(function(_0x2d8139,_0x538495){return client['request'](_0x360678,_0x391dba)['then'](function(_0x1de2f4){logger[_0xc4ab('0xb')](_0xc4ab('0xc'),_0x4f4b74,_0xc4ab('0xd'));logger[_0xc4ab('0xe')](_0xc4ab('0xf'),_0x4f4b74,_0xc4ab('0xd'),JSON[_0xc4ab('0x10')](_0x1de2f4));if(_0x1de2f4['error']){if(_0x1de2f4[_0xc4ab('0x11')][_0xc4ab('0x12')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x4f4b74,_0x1de2f4[_0xc4ab('0x11')][_0xc4ab('0x13')]);return _0x538495(_0x1de2f4[_0xc4ab('0x11')]['message']);}logger[_0xc4ab('0x11')](_0xc4ab('0xc'),_0x4f4b74,_0x1de2f4['error']['message']);return _0x2d8139(_0x1de2f4[_0xc4ab('0x11')]['message']);}else{logger[_0xc4ab('0xb')](_0xc4ab('0xc'),_0x4f4b74,_0xc4ab('0xd'));_0x2d8139(_0x1de2f4[_0xc4ab('0x14')]['message']);}})[_0xc4ab('0x15')](function(_0x20e789){logger[_0xc4ab('0x11')](_0xc4ab('0xc'),_0x4f4b74,_0x20e789);_0x538495(_0x20e789);});});} \ No newline at end of file +var _0x6645=['debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailTransferReport,\x20%s,\x20%s'];(function(_0x832a41,_0x5c0933){var _0x486bf7=function(_0x4ff984){while(--_0x4ff984){_0x832a41['push'](_0x832a41['shift']());}};_0x486bf7(++_0x5c0933);}(_0x6645,0x7f));var _0x5664=function(_0x1d4fd3,_0x1c6444){_0x1d4fd3=_0x1d4fd3-0x0;var _0x30b7ea=_0x6645[_0x1d4fd3];return _0x30b7ea;};'use strict';var _=require(_0x5664('0x0'));var util=require('util');var moment=require(_0x5664('0x1'));var BPromise=require('bluebird');var rs=require(_0x5664('0x2'));var fs=require('fs');var Redis=require(_0x5664('0x3'));var db=require(_0x5664('0x4'))['db'];var utils=require(_0x5664('0x5'));var logger=require(_0x5664('0x6'))('rpc');var config=require(_0x5664('0x7'));var jayson=require(_0x5664('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5b1670,_0x4bbd91,_0x60ae28){return new BPromise(function(_0x44c8a2,_0x127777){return client[_0x5664('0x9')](_0x5b1670,_0x60ae28)[_0x5664('0xa')](function(_0x9510f6){logger[_0x5664('0xb')](_0x5664('0xc'),_0x4bbd91,'request\x20sent');logger[_0x5664('0xd')](_0x5664('0xe'),_0x4bbd91,_0x5664('0xf'),JSON['stringify'](_0x9510f6));if(_0x9510f6[_0x5664('0x10')]){if(_0x9510f6['error'][_0x5664('0x11')]===0x1f4){logger[_0x5664('0x10')](_0x5664('0xc'),_0x4bbd91,_0x9510f6[_0x5664('0x10')][_0x5664('0x12')]);return _0x127777(_0x9510f6[_0x5664('0x10')][_0x5664('0x12')]);}logger[_0x5664('0x10')](_0x5664('0xc'),_0x4bbd91,_0x9510f6['error'][_0x5664('0x12')]);return _0x44c8a2(_0x9510f6['error'][_0x5664('0x12')]);}else{logger[_0x5664('0xb')](_0x5664('0xc'),_0x4bbd91,_0x5664('0xf'));_0x44c8a2(_0x9510f6['result'][_0x5664('0x12')]);}})[_0x5664('0x13')](function(_0x52d306){logger[_0x5664('0x10')](_0x5664('0xc'),_0x4bbd91,_0x52d306);_0x127777(_0x52d306);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 1201cf9..3758fa0 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 _0x8744=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x2795ff,_0x48d3ea){var _0x9d96be=function(_0x14c181){while(--_0x14c181){_0x2795ff['push'](_0x2795ff['shift']());}};_0x9d96be(++_0x48d3ea);}(_0x8744,0xce));var _0x4874=function(_0x27c814,_0x47d59){_0x27c814=_0x27c814-0x0;var _0x2c54c8=_0x8744[_0x27c814];return _0x2c54c8;};'use strict';var multer=require(_0x4874('0x0'));var util=require(_0x4874('0x1'));var path=require('path');var timeout=require(_0x4874('0x2'));var express=require(_0x4874('0x3'));var router=express[_0x4874('0x4')]();var fs_extra=require(_0x4874('0x5'));var auth=require(_0x4874('0x6'));var interaction=require(_0x4874('0x7'));var config=require(_0x4874('0x8'));var controller=require('./memberReport.controller');router['get']('/',auth[_0x4874('0x9')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x4874('0xa')]);router['get'](_0x4874('0xb'),auth[_0x4874('0x9')](),controller[_0x4874('0xc')]);router[_0x4874('0xd')]('/',auth[_0x4874('0x9')](),controller['create']);router[_0x4874('0xe')](_0x4874('0xb'),auth['isAuthenticated'](),controller[_0x4874('0xf')]);router[_0x4874('0x10')](_0x4874('0xb'),auth[_0x4874('0x9')](),controller[_0x4874('0x11')]);module[_0x4874('0x12')]=router; \ No newline at end of file +var _0x02b6=['/:id','show','post','put','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x411c99,_0x534db8){var _0x5f080a=function(_0x52c182){while(--_0x52c182){_0x411c99['push'](_0x411c99['shift']());}};_0x5f080a(++_0x534db8);}(_0x02b6,0x157));var _0x602b=function(_0x49dc10,_0x5ee9d3){_0x49dc10=_0x49dc10-0x0;var _0x39ad54=_0x02b6[_0x49dc10];return _0x39ad54;};'use strict';var multer=require('multer');var util=require(_0x602b('0x0'));var path=require(_0x602b('0x1'));var timeout=require(_0x602b('0x2'));var express=require('express');var router=express[_0x602b('0x3')]();var fs_extra=require(_0x602b('0x4'));var auth=require(_0x602b('0x5'));var interaction=require(_0x602b('0x6'));var config=require(_0x602b('0x7'));var controller=require(_0x602b('0x8'));router[_0x602b('0x9')]('/',auth['isAuthenticated'](),controller[_0x602b('0xa')]);router[_0x602b('0x9')](_0x602b('0xb'),auth[_0x602b('0xc')](),controller[_0x602b('0xd')]);router[_0x602b('0x9')](_0x602b('0xe'),auth['isAuthenticated'](),controller[_0x602b('0xf')]);router[_0x602b('0x10')]('/',auth[_0x602b('0xc')](),controller['create']);router[_0x602b('0x11')](_0x602b('0xe'),auth[_0x602b('0xc')](),controller[_0x602b('0x12')]);router[_0x602b('0x13')](_0x602b('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x602b('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 5eab8c7..2a6118d 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 _0xd670=['seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','INTEGER','getDataValue','diff'];(function(_0x94e170,_0x259db1){var _0x7fef03=function(_0x33fb03){while(--_0x33fb03){_0x94e170['push'](_0x94e170['shift']());}};_0x7fef03(++_0x259db1);}(_0xd670,0xe9));var _0x0d67=function(_0x56a020,_0x3065c6){_0x56a020=_0x56a020-0x0;var _0xc4220c=_0xd670[_0x56a020];return _0xc4220c;};'use strict';var Sequelize=require(_0x0d67('0x0'));var moment=require(_0x0d67('0x1'));module[_0x0d67('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0d67('0x3')]},'interface':{'type':Sequelize[_0x0d67('0x3')]},'type':{'type':Sequelize[_0x0d67('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x0d67('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x324c7a){var _0x3de715=moment(_0x324c7a);var _0x35e984=moment(this[_0x0d67('0x5')]('enterAt'));var _0x67ea33=_0x3de715[_0x0d67('0x6')](_0x35e984,_0x0d67('0x7'));this[_0x0d67('0x8')](_0x0d67('0x9'),_0x324c7a);this[_0x0d67('0x8')](_0x0d67('0xa'),_0x67ea33>=0x0?_0x67ea33:null);}},'data1':{'type':Sequelize[_0x0d67('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x0d67('0x3')],'comment':_0x0d67('0xb')},'data3':{'type':Sequelize[_0x0d67('0x3')],'comment':_0x0d67('0xc')},'data4':{'type':Sequelize[_0x0d67('0x3')],'comment':_0x0d67('0xd')},'data5':{'type':Sequelize[_0x0d67('0x3')],'comment':_0x0d67('0xe')},'role':{'type':Sequelize[_0x0d67('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x0d67('0x3')]}}; \ No newline at end of file +var _0xa2de=['duration','talk:[start]','talk:[destination]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue'];(function(_0x22b6e5,_0x2819c8){var _0x1c21e5=function(_0x18a52c){while(--_0x18a52c){_0x22b6e5['push'](_0x22b6e5['shift']());}};_0x1c21e5(++_0x2819c8);}(_0xa2de,0x19c));var _0xea2d=function(_0x42c04e,_0x399d20){_0x42c04e=_0x42c04e-0x0;var _0x182f88=_0xa2de[_0x42c04e];return _0x182f88;};'use strict';var Sequelize=require(_0xea2d('0x0'));var moment=require(_0xea2d('0x1'));module[_0xea2d('0x2')]={'channel':{'type':Sequelize[_0xea2d('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xea2d('0x3')]},'type':{'type':Sequelize[_0xea2d('0x3')],'defaultValue':_0xea2d('0x4'),'comment':_0xea2d('0x5')},'duration':{'type':Sequelize[_0xea2d('0x6')]},'enterAt':{'type':Sequelize[_0xea2d('0x7')]},'exitAt':{'type':Sequelize[_0xea2d('0x7')],'set':function(_0x5b932b){var _0x12451c=moment(_0x5b932b);var _0x4c7a19=moment(this[_0xea2d('0x8')](_0xea2d('0x9')));var _0x2322fe=_0x12451c[_0xea2d('0xa')](_0x4c7a19,_0xea2d('0xb'));this[_0xea2d('0xc')]('exitAt',_0x5b932b);this['setDataValue'](_0xea2d('0xd'),_0x2322fe>=0x0?_0x2322fe:null);}},'data1':{'type':Sequelize[_0xea2d('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xea2d('0x3')],'comment':_0xea2d('0xe')},'data3':{'type':Sequelize[_0xea2d('0x3')],'comment':_0xea2d('0xf')},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xea2d('0x3')],'comment':_0xea2d('0x10')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xea2d('0x6')]},'uniqueid':{'type':Sequelize[_0xea2d('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 1e15c73..4321d8b 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x5afab3,_0x5052c5){var _0x129165=function(_0x4d49ae){while(--_0x4d49ae){_0x5afab3['push'](_0x5afab3['shift']());}};_0x129165(++_0x5052c5);}(_0x3e74,0x175));var _0x43e7=function(_0x145d64,_0x1132e9){_0x145d64=_0x145d64-0x0;var _0x467786=_0x3e74[_0x145d64];return _0x467786;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file +var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xedd9,0xfc));var _0x9edd=function(_0x226a31,_0xb09ab){_0x226a31=_0x226a31-0x0;var _0x1ab86a=_0xedd9[_0x226a31];return _0x1ab86a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 84cda91..956029a 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 _0x1952=['../../config/environment','./memberReport.attributes','define','MemberReport','membername','interface','util','../../config/logger','moment','request-promise'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0x1952,0x92));var _0x2195=function(_0x51eb43,_0x32f9d3){_0x51eb43=_0x51eb43-0x0;var _0x468182=_0x1952[_0x51eb43];return _0x468182;};'use strict';var _=require('lodash');var util=require(_0x2195('0x0'));var logger=require(_0x2195('0x1'))('api');var moment=require(_0x2195('0x2'));var BPromise=require('bluebird');var rp=require(_0x2195('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2195('0x4'));var attributes=require(_0x2195('0x5'));module['exports']=function(_0x140263,_0xfdb1ac){return _0x140263[_0x2195('0x6')](_0x2195('0x7'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x2195('0x8'),_0x2195('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x43c0=['rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','membername_interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xb47e97,_0x1c9b7b){var _0x3dc310=function(_0x215d94){while(--_0x215d94){_0xb47e97['push'](_0xb47e97['shift']());}};_0x3dc310(++_0x1c9b7b);}(_0x43c0,0x12c));var _0x043c=function(_0x4008d3,_0x53dbd8){_0x4008d3=_0x4008d3-0x0;var _0x265603=_0x43c0[_0x4008d3];return _0x265603;};'use strict';var _=require(_0x043c('0x0'));var util=require(_0x043c('0x1'));var logger=require(_0x043c('0x2'))(_0x043c('0x3'));var moment=require(_0x043c('0x4'));var BPromise=require(_0x043c('0x5'));var rp=require(_0x043c('0x6'));var fs=require('fs');var path=require(_0x043c('0x7'));var rimraf=require(_0x043c('0x8'));var config=require(_0x043c('0x9'));var attributes=require(_0x043c('0xa'));module[_0x043c('0xb')]=function(_0x5bb096,_0x202454){return _0x5bb096['define'](_0x043c('0xc'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x043c('0xd'),'fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 5732a61..11e82db 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 _0xce22=['request','then','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetMemberReport','findAll','options','raw','attributes','include','map','model','debug','stringify','catch','CreateMemberReport','create','UpdateMemberReport','MemberReport','update','body','where','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0xce22,0xea));var _0x2ce2=function(_0x3cb793,_0x4e7311){_0x3cb793=_0x3cb793-0x0;var _0xe380ea=_0xce22[_0x3cb793];return _0xe380ea;};'use strict';var _=require(_0x2ce2('0x0'));var util=require(_0x2ce2('0x1'));var moment=require(_0x2ce2('0x2'));var BPromise=require(_0x2ce2('0x3'));var rs=require(_0x2ce2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ce2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ce2('0x6'))(_0x2ce2('0x7'));var config=require(_0x2ce2('0x8'));var jayson=require(_0x2ce2('0x9'));var client=jayson[_0x2ce2('0xa')][_0x2ce2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6515b5,_0x4d0c17,_0x225737){return new BPromise(function(_0x111f56,_0x3c3d0b){return client[_0x2ce2('0xc')](_0x6515b5,_0x225737)[_0x2ce2('0xd')](function(_0x1dff2c){logger['info'](_0x2ce2('0xe'),_0x4d0c17,_0x2ce2('0xf'));logger['debug'](_0x2ce2('0x10'),_0x4d0c17,_0x2ce2('0xf'),JSON['stringify'](_0x1dff2c));if(_0x1dff2c[_0x2ce2('0x11')]){if(_0x1dff2c[_0x2ce2('0x11')][_0x2ce2('0x12')]===0x1f4){logger[_0x2ce2('0x11')]('MemberReport,\x20%s,\x20%s',_0x4d0c17,_0x1dff2c[_0x2ce2('0x11')][_0x2ce2('0x13')]);return _0x3c3d0b(_0x1dff2c[_0x2ce2('0x11')]['message']);}logger[_0x2ce2('0x11')]('MemberReport,\x20%s,\x20%s',_0x4d0c17,_0x1dff2c['error'][_0x2ce2('0x13')]);return _0x111f56(_0x1dff2c[_0x2ce2('0x11')][_0x2ce2('0x13')]);}else{logger[_0x2ce2('0x14')](_0x2ce2('0xe'),_0x4d0c17,_0x2ce2('0xf'));_0x111f56(_0x1dff2c[_0x2ce2('0x15')]['message']);}})['catch'](function(_0x515f90){logger[_0x2ce2('0x11')](_0x2ce2('0xe'),_0x4d0c17,_0x515f90);_0x3c3d0b(_0x515f90);});});}exports[_0x2ce2('0x16')]=function(_0x3443e6){var _0x3a7989=this;return new Promise(function(_0x560a77,_0x35353e){return db['MemberReport'][_0x2ce2('0x17')]({'raw':_0x3443e6[_0x2ce2('0x18')]?_0x3443e6[_0x2ce2('0x18')][_0x2ce2('0x19')]===undefined?!![]:![]:!![],'where':_0x3443e6[_0x2ce2('0x18')]?_0x3443e6[_0x2ce2('0x18')]['where']||null:null,'attributes':_0x3443e6['options']?_0x3443e6[_0x2ce2('0x18')][_0x2ce2('0x1a')]||null:null,'limit':_0x3443e6[_0x2ce2('0x18')]?_0x3443e6[_0x2ce2('0x18')]['limit']||null:null,'include':_0x3443e6['options']?_0x3443e6['options'][_0x2ce2('0x1b')]?_[_0x2ce2('0x1c')](_0x3443e6['options'][_0x2ce2('0x1b')],function(_0x43a7b6){return{'model':db[_0x43a7b6[_0x2ce2('0x1d')]],'as':_0x43a7b6['as'],'attributes':_0x43a7b6[_0x2ce2('0x1a')],'include':_0x43a7b6[_0x2ce2('0x1b')]?_[_0x2ce2('0x1c')](_0x43a7b6[_0x2ce2('0x1b')],function(_0x5c748f){return{'model':db[_0x5c748f['model']],'as':_0x5c748f['as'],'attributes':_0x5c748f[_0x2ce2('0x1a')],'include':_0x5c748f['include']?_[_0x2ce2('0x1c')](_0x5c748f[_0x2ce2('0x1b')],function(_0x3a701e){return{'model':db[_0x3a701e[_0x2ce2('0x1d')]],'as':_0x3a701e['as'],'attributes':_0x3a701e[_0x2ce2('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x585752){logger[_0x2ce2('0x14')]('GetMemberReport',_0x3443e6);logger[_0x2ce2('0x1e')](_0x2ce2('0x16'),_0x3443e6,JSON[_0x2ce2('0x1f')](_0x585752));_0x560a77(_0x585752);})[_0x2ce2('0x20')](function(_0x1e1f17){logger[_0x2ce2('0x11')]('GetMemberReport',_0x1e1f17[_0x2ce2('0x13')],_0x3443e6);_0x35353e(_0x3a7989[_0x2ce2('0x11')](0x1f4,_0x1e1f17[_0x2ce2('0x13')]));});});};exports[_0x2ce2('0x21')]=function(_0x12457b){var _0x104a2e=this;return new Promise(function(_0x2222fc,_0x133043){return db['MemberReport'][_0x2ce2('0x22')](_0x12457b['body'],{'raw':_0x12457b['options']?_0x12457b[_0x2ce2('0x18')][_0x2ce2('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x36474b){logger[_0x2ce2('0x14')](_0x2ce2('0x21'),_0x12457b);logger[_0x2ce2('0x1e')](_0x2ce2('0x21'),_0x12457b,JSON[_0x2ce2('0x1f')](_0x36474b));_0x2222fc(_0x36474b);})['catch'](function(_0x226ae5){logger[_0x2ce2('0x11')](_0x2ce2('0x21'),_0x226ae5[_0x2ce2('0x13')],_0x12457b);_0x133043(_0x104a2e['error'](0x1f4,_0x226ae5[_0x2ce2('0x13')]));});});};exports[_0x2ce2('0x23')]=function(_0x247f6f){var _0x417923=this;return new Promise(function(_0x339263,_0x58e22b){return db[_0x2ce2('0x24')][_0x2ce2('0x25')](_0x247f6f[_0x2ce2('0x26')],{'raw':_0x247f6f[_0x2ce2('0x18')]?_0x247f6f[_0x2ce2('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x247f6f[_0x2ce2('0x18')]?_0x247f6f[_0x2ce2('0x18')][_0x2ce2('0x27')]||null:null,'attributes':_0x247f6f[_0x2ce2('0x18')]?_0x247f6f[_0x2ce2('0x18')][_0x2ce2('0x1a')]||null:null,'limit':_0x247f6f[_0x2ce2('0x18')]?_0x247f6f[_0x2ce2('0x18')][_0x2ce2('0x28')]||null:null})[_0x2ce2('0xd')](function(_0x2a4d3f){logger[_0x2ce2('0x14')]('UpdateMemberReport',_0x247f6f);logger[_0x2ce2('0x1e')](_0x2ce2('0x23'),_0x247f6f,JSON['stringify'](_0x2a4d3f));_0x339263(_0x2a4d3f);})[_0x2ce2('0x20')](function(_0x1f0b51){logger[_0x2ce2('0x11')](_0x2ce2('0x23'),_0x1f0b51[_0x2ce2('0x13')],_0x247f6f);_0x58e22b(_0x417923['error'](0x1f4,_0x1f0b51[_0x2ce2('0x13')]));});});}; \ No newline at end of file +var _0x539d=['then','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MemberReport,\x20%s,\x20%s','result','catch','GetMemberReport','MemberReport','findAll','options','where','attributes','limit','include','map','model','CreateMemberReport','create','raw','update','body','UpdateMemberReport','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x539d,0x17b));var _0xd539=function(_0x14f7fe,_0x5132c4){_0x14f7fe=_0x14f7fe-0x0;var _0x3d8309=_0x539d[_0x14f7fe];return _0x3d8309;};'use strict';var _=require(_0xd539('0x0'));var util=require('util');var moment=require(_0xd539('0x1'));var BPromise=require(_0xd539('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd539('0x3'))['db'];var utils=require(_0xd539('0x4'));var logger=require(_0xd539('0x5'))(_0xd539('0x6'));var config=require(_0xd539('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd539('0x8')][_0xd539('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27f14e,_0x1766e8,_0x8d4eb5){return new BPromise(function(_0x3cb142,_0x555080){return client[_0xd539('0xa')](_0x27f14e,_0x8d4eb5)[_0xd539('0xb')](function(_0x43d7d3){logger[_0xd539('0xc')]('MemberReport,\x20%s,\x20%s',_0x1766e8,'request\x20sent');logger[_0xd539('0xd')](_0xd539('0xe'),_0x1766e8,_0xd539('0xf'),JSON[_0xd539('0x10')](_0x43d7d3));if(_0x43d7d3[_0xd539('0x11')]){if(_0x43d7d3[_0xd539('0x11')][_0xd539('0x12')]===0x1f4){logger[_0xd539('0x11')]('MemberReport,\x20%s,\x20%s',_0x1766e8,_0x43d7d3[_0xd539('0x11')][_0xd539('0x13')]);return _0x555080(_0x43d7d3[_0xd539('0x11')][_0xd539('0x13')]);}logger[_0xd539('0x11')](_0xd539('0x14'),_0x1766e8,_0x43d7d3['error'][_0xd539('0x13')]);return _0x3cb142(_0x43d7d3[_0xd539('0x11')][_0xd539('0x13')]);}else{logger[_0xd539('0xc')](_0xd539('0x14'),_0x1766e8,_0xd539('0xf'));_0x3cb142(_0x43d7d3[_0xd539('0x15')][_0xd539('0x13')]);}})[_0xd539('0x16')](function(_0x17f7bf){logger[_0xd539('0x11')]('MemberReport,\x20%s,\x20%s',_0x1766e8,_0x17f7bf);_0x555080(_0x17f7bf);});});}exports[_0xd539('0x17')]=function(_0x41fb1e){var _0x6d6bbe=this;return new Promise(function(_0x99327a,_0x464986){return db[_0xd539('0x18')][_0xd539('0x19')]({'raw':_0x41fb1e[_0xd539('0x1a')]?_0x41fb1e['options']['raw']===undefined?!![]:![]:!![],'where':_0x41fb1e[_0xd539('0x1a')]?_0x41fb1e[_0xd539('0x1a')][_0xd539('0x1b')]||null:null,'attributes':_0x41fb1e[_0xd539('0x1a')]?_0x41fb1e['options'][_0xd539('0x1c')]||null:null,'limit':_0x41fb1e[_0xd539('0x1a')]?_0x41fb1e[_0xd539('0x1a')][_0xd539('0x1d')]||null:null,'include':_0x41fb1e[_0xd539('0x1a')]?_0x41fb1e[_0xd539('0x1a')][_0xd539('0x1e')]?_[_0xd539('0x1f')](_0x41fb1e[_0xd539('0x1a')]['include'],function(_0x28d376){return{'model':db[_0x28d376[_0xd539('0x20')]],'as':_0x28d376['as'],'attributes':_0x28d376[_0xd539('0x1c')],'include':_0x28d376['include']?_['map'](_0x28d376[_0xd539('0x1e')],function(_0xfd3352){return{'model':db[_0xfd3352[_0xd539('0x20')]],'as':_0xfd3352['as'],'attributes':_0xfd3352[_0xd539('0x1c')],'include':_0xfd3352['include']?_[_0xd539('0x1f')](_0xfd3352['include'],function(_0x1343de){return{'model':db[_0x1343de[_0xd539('0x20')]],'as':_0x1343de['as'],'attributes':_0x1343de[_0xd539('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd539('0xb')](function(_0x5a9d68){logger['info'](_0xd539('0x17'),_0x41fb1e);logger[_0xd539('0xd')]('GetMemberReport',_0x41fb1e,JSON['stringify'](_0x5a9d68));_0x99327a(_0x5a9d68);})['catch'](function(_0xe17d1c){logger[_0xd539('0x11')](_0xd539('0x17'),_0xe17d1c[_0xd539('0x13')],_0x41fb1e);_0x464986(_0x6d6bbe['error'](0x1f4,_0xe17d1c[_0xd539('0x13')]));});});};exports[_0xd539('0x21')]=function(_0x516806){var _0x1b0c81=this;return new Promise(function(_0x932ed0,_0x3de809){return db[_0xd539('0x18')][_0xd539('0x22')](_0x516806['body'],{'raw':_0x516806[_0xd539('0x1a')]?_0x516806['options'][_0xd539('0x23')]===undefined?!![]:![]:!![]})['then'](function(_0x23f266){logger['info'](_0xd539('0x21'),_0x516806);logger[_0xd539('0xd')](_0xd539('0x21'),_0x516806,JSON[_0xd539('0x10')](_0x23f266));_0x932ed0(_0x23f266);})[_0xd539('0x16')](function(_0x2f9fc4){logger[_0xd539('0x11')](_0xd539('0x21'),_0x2f9fc4[_0xd539('0x13')],_0x516806);_0x3de809(_0x1b0c81[_0xd539('0x11')](0x1f4,_0x2f9fc4[_0xd539('0x13')]));});});};exports['UpdateMemberReport']=function(_0x463920){var _0x4fffa7=this;return new Promise(function(_0x26bc62,_0x22fbf9){return db['MemberReport'][_0xd539('0x24')](_0x463920[_0xd539('0x25')],{'raw':_0x463920['options']?_0x463920['options'][_0xd539('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x463920[_0xd539('0x1a')]?_0x463920[_0xd539('0x1a')][_0xd539('0x1b')]||null:null,'attributes':_0x463920['options']?_0x463920[_0xd539('0x1a')][_0xd539('0x1c')]||null:null,'limit':_0x463920[_0xd539('0x1a')]?_0x463920[_0xd539('0x1a')]['limit']||null:null})[_0xd539('0xb')](function(_0x41032f){logger[_0xd539('0xc')](_0xd539('0x26'),_0x463920);logger[_0xd539('0xd')](_0xd539('0x26'),_0x463920,JSON['stringify'](_0x41032f));_0x26bc62(_0x41032f);})['catch'](function(_0x1623f5){logger[_0xd539('0x11')](_0xd539('0x26'),_0x1623f5[_0xd539('0x13')],_0x463920);_0x22fbf9(_0x4fffa7['error'](0x1f4,_0x1623f5[_0xd539('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 1f27f13..64c12f1 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 _0xc5fd=['get','index','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0xe31282,_0x5a6548){var _0x1ef446=function(_0x35f7dd){while(--_0x35f7dd){_0xe31282['push'](_0xe31282['shift']());}};_0x1ef446(++_0x5a6548);}(_0xc5fd,0xfa));var _0xdc5f=function(_0x2d0d9f,_0x22c0d8){_0x2d0d9f=_0x2d0d9f-0x0;var _0x30243d=_0xc5fd[_0x2d0d9f];return _0x30243d;};'use strict';var multer=require(_0xdc5f('0x0'));var util=require(_0xdc5f('0x1'));var path=require(_0xdc5f('0x2'));var timeout=require(_0xdc5f('0x3'));var express=require(_0xdc5f('0x4'));var router=express['Router']();var fs_extra=require(_0xdc5f('0x5'));var auth=require(_0xdc5f('0x6'));var interaction=require(_0xdc5f('0x7'));var config=require(_0xdc5f('0x8'));var controller=require(_0xdc5f('0x9'));router[_0xdc5f('0xa')]('/',controller[_0xdc5f('0xb')]);module[_0xdc5f('0xc')]=router; \ No newline at end of file +var _0xbfd3=['multer','util','path','connect-timeout','express','fs-extra','../../config/environment','index','exports'];(function(_0x3b8d30,_0x3dd4c6){var _0x1113bf=function(_0x5cb5d1){while(--_0x5cb5d1){_0x3b8d30['push'](_0x3b8d30['shift']());}};_0x1113bf(++_0x3dd4c6);}(_0xbfd3,0x144));var _0x3bfd=function(_0x36f3c2,_0x5d1440){_0x36f3c2=_0x36f3c2-0x0;var _0x6312f7=_0xbfd3[_0x36f3c2];return _0x6312f7;};'use strict';var multer=require(_0x3bfd('0x0'));var util=require(_0x3bfd('0x1'));var path=require(_0x3bfd('0x2'));var timeout=require(_0x3bfd('0x3'));var express=require(_0x3bfd('0x4'));var router=express['Router']();var fs_extra=require(_0x3bfd('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3bfd('0x6'));var controller=require('./migration.controller');router['get']('/',controller[_0x3bfd('0x7')]);module[_0x3bfd('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 5fbda49..1891f5a 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 _0xe0dd=['exports','STRING','version'];(function(_0x3a43f6,_0x2892ad){var _0x673ac1=function(_0x37c5d4){while(--_0x37c5d4){_0x3a43f6['push'](_0x3a43f6['shift']());}};_0x673ac1(++_0x2892ad);}(_0xe0dd,0xea));var _0xde0d=function(_0x188a93,_0xaf57db){_0x188a93=_0x188a93-0x0;var _0x23b40d=_0xe0dd[_0x188a93];return _0x23b40d;};'use strict';var Sequelize=require('sequelize');module[_0xde0d('0x0')]={'version':{'type':Sequelize[_0xde0d('0x1')],'unique':_0xde0d('0x2')}}; \ No newline at end of file +var _0xf245=['STRING','exports'];(function(_0x419aa4,_0x5926a7){var _0x557d9b=function(_0x43c9ac){while(--_0x43c9ac){_0x419aa4['push'](_0x419aa4['shift']());}};_0x557d9b(++_0x5926a7);}(_0xf245,0xbf));var _0x5f24=function(_0x120123,_0x4eff59){_0x120123=_0x120123-0x0;var _0x3bec4c=_0xf245[_0x120123];return _0x3bec4c;};'use strict';var Sequelize=require('sequelize');module[_0x5f24('0x0')]={'version':{'type':Sequelize[_0x5f24('0x1')],'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 affb109..cddc43a 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 _0x6a16=['stack','name','send','index','Migration','rawAttributes','type','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x6a16,0x19d));var _0x66a1=function(_0x34229a,_0x127148){_0x34229a=_0x34229a-0x0;var _0x41a4c0=_0x6a16[_0x34229a];return _0x41a4c0;};'use strict';var emlformat=require(_0x66a1('0x0'));var rimraf=require(_0x66a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x66a1('0x2'));var rp=require(_0x66a1('0x3'));var moment=require(_0x66a1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x66a1('0x5'));var path=require('path');var sox=require(_0x66a1('0x6'));var csv=require(_0x66a1('0x7'));var ejs=require(_0x66a1('0x8'));var fs=require('fs');var fs_extra=require(_0x66a1('0x9'));var _=require(_0x66a1('0xa'));var squel=require(_0x66a1('0xb'));var crypto=require(_0x66a1('0xc'));var jsforce=require(_0x66a1('0xd'));var deskjs=require(_0x66a1('0xe'));var toCsv=require(_0x66a1('0x7'));var querystring=require(_0x66a1('0xf'));var Papa=require(_0x66a1('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x66a1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x66a1('0x12'));var utils=require(_0x66a1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x66a1('0x14'));var db=require(_0x66a1('0x15'))['db'];function respondWithStatusCode(_0x589218,_0x3a102d){_0x3a102d=_0x3a102d||0xcc;return function(_0xbde698){if(_0xbde698){return _0x589218['sendStatus'](_0x3a102d);}return _0x589218['status'](_0x3a102d)[_0x66a1('0x16')]();};}function respondWithResult(_0x21af56,_0x5ed473){_0x5ed473=_0x5ed473||0xc8;return function(_0x473dec){if(_0x473dec){return _0x21af56[_0x66a1('0x17')](_0x5ed473)[_0x66a1('0x18')](_0x473dec);}};}function respondWithFilteredResult(_0x482e23,_0x382bbe){return function(_0x284454){if(_0x284454){var _0x42a57b=typeof _0x382bbe[_0x66a1('0x19')]===_0x66a1('0x1a')&&typeof _0x382bbe[_0x66a1('0x1b')]==='undefined';var _0x2acb3e=_0x284454[_0x66a1('0x1c')];var _0x556434=_0x42a57b?0x0:_0x382bbe[_0x66a1('0x19')];var _0x4d796f=_0x42a57b?_0x284454['count']:_0x382bbe[_0x66a1('0x19')]+_0x382bbe[_0x66a1('0x1b')];var _0x5c4ffd;if(_0x4d796f>=_0x2acb3e){_0x4d796f=_0x2acb3e;_0x5c4ffd=0xc8;}else{_0x5c4ffd=0xce;}_0x482e23[_0x66a1('0x17')](_0x5c4ffd);return _0x482e23['set'](_0x66a1('0x1d'),_0x556434+'-'+_0x4d796f+'/'+_0x2acb3e)[_0x66a1('0x18')](_0x284454);}return null;};}function patchUpdates(_0x5b70d8){return function(_0x334355){try{jsonpatch[_0x66a1('0x1e')](_0x334355,_0x5b70d8,!![]);}catch(_0x3cff19){return BPromise[_0x66a1('0x1f')](_0x3cff19);}return _0x334355[_0x66a1('0x20')]();};}function saveUpdates(_0xe96951,_0x7fddf3){return function(_0x106e99){if(_0x106e99){return _0x106e99['update'](_0xe96951)['then'](function(_0x5816a5){return _0x5816a5;});}return null;};}function removeEntity(_0x8f03a3,_0x1c5c88){return function(_0x53d916){if(_0x53d916){return _0x53d916[_0x66a1('0x21')]()[_0x66a1('0x22')](function(){_0x8f03a3[_0x66a1('0x17')](0xcc)[_0x66a1('0x16')]();});}};}function handleEntityNotFound(_0x322f3f,_0x50fcf9){return function(_0x2d1a3e){if(!_0x2d1a3e){_0x322f3f['sendStatus'](0x194);}return _0x2d1a3e;};}function handleError(_0x29b2fe,_0x2e5a52){_0x2e5a52=_0x2e5a52||0x1f4;return function(_0x3282f4){logger['error'](_0x3282f4[_0x66a1('0x23')]);if(_0x3282f4[_0x66a1('0x24')]){delete _0x3282f4['name'];}_0x29b2fe['status'](_0x2e5a52)[_0x66a1('0x25')](_0x3282f4);};}exports[_0x66a1('0x26')]=function(_0x57551d,_0x135d3b){var _0x5ab129={},_0x5f1559={},_0x381be5={'count':0x0,'rows':[]};var _0x5cea75=_['map'](db[_0x66a1('0x27')][_0x66a1('0x28')],function(_0x2913e6){return{'name':_0x2913e6['fieldName'],'type':_0x2913e6[_0x66a1('0x29')]['key']};});_0x5f1559[_0x66a1('0x2a')]=_[_0x66a1('0x2b')](_0x5cea75,_0x66a1('0x24'));_0x5f1559[_0x66a1('0x2c')]=_['keys'](_0x57551d[_0x66a1('0x2c')]);_0x5f1559[_0x66a1('0x2d')]=_['intersection'](_0x5f1559[_0x66a1('0x2a')],_0x5f1559[_0x66a1('0x2c')]);_0x5ab129[_0x66a1('0x2e')]=_[_0x66a1('0x2f')](_0x5f1559[_0x66a1('0x2a')],qs[_0x66a1('0x30')](_0x57551d['query'][_0x66a1('0x30')]));_0x5ab129[_0x66a1('0x2e')]=_0x5ab129[_0x66a1('0x2e')][_0x66a1('0x31')]?_0x5ab129[_0x66a1('0x2e')]:_0x5f1559['model'];if(!_0x57551d['query'][_0x66a1('0x32')](_0x66a1('0x33'))){_0x5ab129[_0x66a1('0x1b')]=qs['limit'](_0x57551d[_0x66a1('0x2c')][_0x66a1('0x1b')]);_0x5ab129[_0x66a1('0x19')]=qs[_0x66a1('0x19')](_0x57551d[_0x66a1('0x2c')][_0x66a1('0x19')]);}_0x5ab129[_0x66a1('0x34')]=qs[_0x66a1('0x35')](_0x57551d[_0x66a1('0x2c')][_0x66a1('0x35')]);_0x5ab129['where']=qs[_0x66a1('0x2d')](_[_0x66a1('0x36')](_0x57551d['query'],_0x5f1559[_0x66a1('0x2d')]),_0x5cea75);if(_0x57551d[_0x66a1('0x2c')][_0x66a1('0x37')]){_0x5ab129[_0x66a1('0x38')]=_[_0x66a1('0x39')](_0x5ab129[_0x66a1('0x38')],{'$or':_[_0x66a1('0x2b')](_0x5cea75,function(_0x5a0d69){if(_0x5a0d69['type']!==_0x66a1('0x3a')){var _0x40fedb={};_0x40fedb[_0x5a0d69[_0x66a1('0x24')]]={'$like':'%'+_0x57551d[_0x66a1('0x2c')][_0x66a1('0x37')]+'%'};return _0x40fedb;}})});}_0x5ab129=_[_0x66a1('0x39')]({},_0x5ab129,_0x57551d[_0x66a1('0x3b')]);var _0x3f0530={'where':_0x5ab129[_0x66a1('0x38')]};return db['Migration'][_0x66a1('0x1c')](_0x3f0530)[_0x66a1('0x22')](function(_0x373f59){_0x381be5[_0x66a1('0x1c')]=_0x373f59;if(_0x57551d[_0x66a1('0x2c')][_0x66a1('0x3c')]){_0x5ab129[_0x66a1('0x3d')]=[{'all':!![]}];}return db['Migration'][_0x66a1('0x3e')](_0x5ab129);})[_0x66a1('0x22')](function(_0x290cba){_0x381be5['rows']=_0x290cba;return _0x381be5;})[_0x66a1('0x22')](respondWithFilteredResult(_0x135d3b,_0x5ab129))[_0x66a1('0x3f')](handleError(_0x135d3b,null));}; \ No newline at end of file +var _0x4293=['name','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','where','pick','merge','type','VIRTUAL','filter','options','Migration','includeAll','findAll','rows','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','error'];(function(_0x12833b,_0x26c1d2){var _0x3acad3=function(_0x2f9ec9){while(--_0x2f9ec9){_0x12833b['push'](_0x12833b['shift']());}};_0x3acad3(++_0x26c1d2);}(_0x4293,0x140));var _0x3429=function(_0x5232de,_0x194b49){_0x5232de=_0x5232de-0x0;var _0x737b7f=_0x4293[_0x5232de];return _0x737b7f;};'use strict';var emlformat=require(_0x3429('0x0'));var rimraf=require(_0x3429('0x1'));var zipdir=require(_0x3429('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3429('0x3'));var moment=require(_0x3429('0x4'));var BPromise=require(_0x3429('0x5'));var Mustache=require(_0x3429('0x6'));var util=require(_0x3429('0x7'));var path=require(_0x3429('0x8'));var sox=require(_0x3429('0x9'));var csv=require(_0x3429('0xa'));var ejs=require(_0x3429('0xb'));var fs=require('fs');var fs_extra=require(_0x3429('0xc'));var _=require('lodash');var squel=require(_0x3429('0xd'));var crypto=require(_0x3429('0xe'));var jsforce=require(_0x3429('0xf'));var deskjs=require(_0x3429('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3429('0x11'));var Papa=require(_0x3429('0x12'));var Redis=require(_0x3429('0x13'));var authService=require(_0x3429('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x3429('0x15'));var hardwareService=require(_0x3429('0x16'));var logger=require(_0x3429('0x17'))(_0x3429('0x18'));var utils=require(_0x3429('0x19'));var config=require(_0x3429('0x1a'));var licenseUtil=require(_0x3429('0x1b'));var db=require(_0x3429('0x1c'))['db'];function respondWithStatusCode(_0x26d42d,_0x423d18){_0x423d18=_0x423d18||0xcc;return function(_0x2eab0d){if(_0x2eab0d){return _0x26d42d[_0x3429('0x1d')](_0x423d18);}return _0x26d42d[_0x3429('0x1e')](_0x423d18)['end']();};}function respondWithResult(_0x4e1a0f,_0xeb1d7d){_0xeb1d7d=_0xeb1d7d||0xc8;return function(_0x5dcf45){if(_0x5dcf45){return _0x4e1a0f[_0x3429('0x1e')](_0xeb1d7d)[_0x3429('0x1f')](_0x5dcf45);}};}function respondWithFilteredResult(_0x573d66,_0x3c365c){return function(_0x486d59){if(_0x486d59){var _0x16eaeb=typeof _0x3c365c[_0x3429('0x20')]==='undefined'&&typeof _0x3c365c[_0x3429('0x21')]===_0x3429('0x22');var _0x44beac=_0x486d59['count'];var _0x5a46ec=_0x16eaeb?0x0:_0x3c365c[_0x3429('0x20')];var _0x1cc3f1=_0x16eaeb?_0x486d59[_0x3429('0x23')]:_0x3c365c[_0x3429('0x20')]+_0x3c365c[_0x3429('0x21')];var _0x183b2d;if(_0x1cc3f1>=_0x44beac){_0x1cc3f1=_0x44beac;_0x183b2d=0xc8;}else{_0x183b2d=0xce;}_0x573d66[_0x3429('0x1e')](_0x183b2d);return _0x573d66[_0x3429('0x24')](_0x3429('0x25'),_0x5a46ec+'-'+_0x1cc3f1+'/'+_0x44beac)['json'](_0x486d59);}return null;};}function patchUpdates(_0x4ffa27){return function(_0xf4c11e){try{jsonpatch[_0x3429('0x26')](_0xf4c11e,_0x4ffa27,!![]);}catch(_0x3118d4){return BPromise[_0x3429('0x27')](_0x3118d4);}return _0xf4c11e['save']();};}function saveUpdates(_0x6b387e,_0x2e42a8){return function(_0x47dc9f){if(_0x47dc9f){return _0x47dc9f[_0x3429('0x28')](_0x6b387e)[_0x3429('0x29')](function(_0x410cc2){return _0x410cc2;});}return null;};}function removeEntity(_0x28eeb7,_0x401bd7){return function(_0x14396a){if(_0x14396a){return _0x14396a[_0x3429('0x2a')]()[_0x3429('0x29')](function(){_0x28eeb7[_0x3429('0x1e')](0xcc)[_0x3429('0x2b')]();});}};}function handleEntityNotFound(_0x271e07,_0x85258f){return function(_0x5d35d0){if(!_0x5d35d0){_0x271e07['sendStatus'](0x194);}return _0x5d35d0;};}function handleError(_0x3de62c,_0x2478d0){_0x2478d0=_0x2478d0||0x1f4;return function(_0x51a9ea){logger[_0x3429('0x2c')](_0x51a9ea['stack']);if(_0x51a9ea[_0x3429('0x2d')]){delete _0x51a9ea['name'];}_0x3de62c[_0x3429('0x1e')](_0x2478d0)['send'](_0x51a9ea);};}exports[_0x3429('0x2e')]=function(_0x28544b,_0x19cec0){var _0x174dbd={},_0x159904={},_0x278b4b={'count':0x0,'rows':[]};var _0x3f3f0e=_[_0x3429('0x2f')](db['Migration'][_0x3429('0x30')],function(_0x4e87fc){return{'name':_0x4e87fc[_0x3429('0x31')],'type':_0x4e87fc['type'][_0x3429('0x32')]};});_0x159904['model']=_[_0x3429('0x2f')](_0x3f3f0e,_0x3429('0x2d'));_0x159904[_0x3429('0x33')]=_[_0x3429('0x34')](_0x28544b['query']);_0x159904[_0x3429('0x35')]=_[_0x3429('0x36')](_0x159904[_0x3429('0x37')],_0x159904[_0x3429('0x33')]);_0x174dbd['attributes']=_[_0x3429('0x36')](_0x159904[_0x3429('0x37')],qs[_0x3429('0x38')](_0x28544b['query']['fields']));_0x174dbd[_0x3429('0x39')]=_0x174dbd[_0x3429('0x39')][_0x3429('0x3a')]?_0x174dbd[_0x3429('0x39')]:_0x159904[_0x3429('0x37')];if(!_0x28544b[_0x3429('0x33')][_0x3429('0x3b')]('nolimit')){_0x174dbd[_0x3429('0x21')]=qs[_0x3429('0x21')](_0x28544b[_0x3429('0x33')]['limit']);_0x174dbd[_0x3429('0x20')]=qs[_0x3429('0x20')](_0x28544b['query']['offset']);}_0x174dbd[_0x3429('0x3c')]=qs['sort'](_0x28544b[_0x3429('0x33')]['sort']);_0x174dbd[_0x3429('0x3d')]=qs[_0x3429('0x35')](_[_0x3429('0x3e')](_0x28544b[_0x3429('0x33')],_0x159904[_0x3429('0x35')]),_0x3f3f0e);if(_0x28544b[_0x3429('0x33')]['filter']){_0x174dbd['where']=_[_0x3429('0x3f')](_0x174dbd[_0x3429('0x3d')],{'$or':_['map'](_0x3f3f0e,function(_0x1cb941){if(_0x1cb941[_0x3429('0x40')]!==_0x3429('0x41')){var _0x1a83d9={};_0x1a83d9[_0x1cb941[_0x3429('0x2d')]]={'$like':'%'+_0x28544b[_0x3429('0x33')][_0x3429('0x42')]+'%'};return _0x1a83d9;}})});}_0x174dbd=_[_0x3429('0x3f')]({},_0x174dbd,_0x28544b[_0x3429('0x43')]);var _0x2b2750={'where':_0x174dbd[_0x3429('0x3d')]};return db[_0x3429('0x44')][_0x3429('0x23')](_0x2b2750)[_0x3429('0x29')](function(_0x50cbc1){_0x278b4b[_0x3429('0x23')]=_0x50cbc1;if(_0x28544b[_0x3429('0x33')][_0x3429('0x45')]){_0x174dbd['include']=[{'all':!![]}];}return db[_0x3429('0x44')][_0x3429('0x46')](_0x174dbd);})['then'](function(_0x56dd64){_0x278b4b[_0x3429('0x47')]=_0x56dd64;return _0x278b4b;})[_0x3429('0x29')](respondWithFilteredResult(_0x19cec0,_0x174dbd))[_0x3429('0x48')](handleError(_0x19cec0,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 32be4f2..cf522a2 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 _0xa5c2=['exports','define','migrations','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes'];(function(_0x52ff09,_0xdb5c7f){var _0xcaddb2=function(_0x29038e){while(--_0x29038e){_0x52ff09['push'](_0x52ff09['shift']());}};_0xcaddb2(++_0xdb5c7f);}(_0xa5c2,0x13b));var _0x2a5c=function(_0x40aaa4,_0x3b22f4){_0x40aaa4=_0x40aaa4-0x0;var _0x4e21e5=_0xa5c2[_0x40aaa4];return _0x4e21e5;};'use strict';var _=require('lodash');var util=require(_0x2a5c('0x0'));var logger=require(_0x2a5c('0x1'))(_0x2a5c('0x2'));var moment=require('moment');var BPromise=require(_0x2a5c('0x3'));var rp=require(_0x2a5c('0x4'));var fs=require('fs');var path=require(_0x2a5c('0x5'));var rimraf=require(_0x2a5c('0x6'));var config=require(_0x2a5c('0x7'));var attributes=require(_0x2a5c('0x8'));module[_0x2a5c('0x9')]=function(_0x3df5fa,_0x51d79a){return _0x3df5fa[_0x2a5c('0xa')]('Migration',attributes,{'tableName':_0x2a5c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae48=['request-promise','path','rimraf','../../config/environment','./migration.attributes','define','Migration','lodash','util','bluebird'];(function(_0x212b3d,_0x235f44){var _0x5dd16f=function(_0x1c0afc){while(--_0x1c0afc){_0x212b3d['push'](_0x212b3d['shift']());}};_0x5dd16f(++_0x235f44);}(_0xae48,0xf7));var _0x8ae4=function(_0x47a12a,_0x70f591){_0x47a12a=_0x47a12a-0x0;var _0x30cd40=_0xae48[_0x47a12a];return _0x30cd40;};'use strict';var _=require(_0x8ae4('0x0'));var util=require(_0x8ae4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8ae4('0x2'));var rp=require(_0x8ae4('0x3'));var fs=require('fs');var path=require(_0x8ae4('0x4'));var rimraf=require(_0x8ae4('0x5'));var config=require(_0x8ae4('0x6'));var attributes=require(_0x8ae4('0x7'));module['exports']=function(_0x319672,_0x3d394d){return _0x319672[_0x8ae4('0x8')](_0x8ae4('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index dd83c48..b3484b4 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 _0x63bb=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x567497,_0x37757e){var _0x56fca7=function(_0x4ba0ed){while(--_0x4ba0ed){_0x567497['push'](_0x567497['shift']());}};_0x56fca7(++_0x37757e);}(_0x63bb,0xf8));var _0xb63b=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0x63bb[_0x1b02bb];return _0x131245;};'use strict';var _=require(_0xb63b('0x0'));var util=require(_0xb63b('0x1'));var moment=require(_0xb63b('0x2'));var BPromise=require(_0xb63b('0x3'));var rs=require(_0xb63b('0x4'));var fs=require('fs');var Redis=require(_0xb63b('0x5'));var db=require(_0xb63b('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb63b('0x7'));var config=require(_0xb63b('0x8'));var jayson=require(_0xb63b('0x9'));var client=jayson[_0xb63b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3eb1be,_0x2a27f9,_0x2aa873){return new BPromise(function(_0x544988,_0x366bda){return client[_0xb63b('0xb')](_0x3eb1be,_0x2aa873)['then'](function(_0x2d5002){logger[_0xb63b('0xc')](_0xb63b('0xd'),_0x2a27f9,_0xb63b('0xe'));logger[_0xb63b('0xf')]('Migration,\x20%s,\x20%s,\x20%s',_0x2a27f9,_0xb63b('0xe'),JSON[_0xb63b('0x10')](_0x2d5002));if(_0x2d5002[_0xb63b('0x11')]){if(_0x2d5002['error']['code']===0x1f4){logger[_0xb63b('0x11')](_0xb63b('0xd'),_0x2a27f9,_0x2d5002[_0xb63b('0x11')][_0xb63b('0x12')]);return _0x366bda(_0x2d5002['error'][_0xb63b('0x12')]);}logger[_0xb63b('0x11')](_0xb63b('0xd'),_0x2a27f9,_0x2d5002[_0xb63b('0x11')][_0xb63b('0x12')]);return _0x544988(_0x2d5002[_0xb63b('0x11')][_0xb63b('0x12')]);}else{logger['info'](_0xb63b('0xd'),_0x2a27f9,'request\x20sent');_0x544988(_0x2d5002[_0xb63b('0x13')][_0xb63b('0x12')]);}})[_0xb63b('0x14')](function(_0x41bfc4){logger[_0xb63b('0x11')]('Migration,\x20%s,\x20%s',_0x2a27f9,_0x41bfc4);_0x366bda(_0x41bfc4);});});} \ No newline at end of file +var _0x0fd9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x0fd9,0xa3));var _0x90fd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0fd9[_0x2641f9];return _0x585741;};'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')]('Migration,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x2acef7(_0x234ba9[_0x90fd('0x11')]['message']);}logger[_0x90fd('0x11')]('Migration,\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 diff --git a/server/api/network/index.js b/server/api/network/index.js index 2e51bf3..14965ed 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 _0xcbe7=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','post','create','put','update','destroy','util','path'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xcbe7,0x152));var _0x7cbe=function(_0x421a2d,_0xefe4a4){_0x421a2d=_0x421a2d-0x0;var _0x461f53=_0xcbe7[_0x421a2d];return _0x461f53;};'use strict';var multer=require('multer');var util=require(_0x7cbe('0x0'));var path=require(_0x7cbe('0x1'));var timeout=require(_0x7cbe('0x2'));var express=require(_0x7cbe('0x3'));var router=express[_0x7cbe('0x4')]();var fs_extra=require(_0x7cbe('0x5'));var auth=require(_0x7cbe('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7cbe('0x7'));var controller=require('./network.controller');router['get']('/',auth[_0x7cbe('0x8')](),controller[_0x7cbe('0x9')]);router[_0x7cbe('0xa')](_0x7cbe('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x7cbe('0xc')]('/',auth[_0x7cbe('0x8')](),controller[_0x7cbe('0xd')]);router[_0x7cbe('0xe')](_0x7cbe('0xb'),auth['isAuthenticated'](),controller[_0x7cbe('0xf')]);router['delete'](_0x7cbe('0xb'),auth[_0x7cbe('0x8')](),controller[_0x7cbe('0x10')]);module['exports']=router; \ No newline at end of file +var _0x7deb=['Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','show','post','create','delete','exports','multer','util','express'];(function(_0x210e58,_0xbde86){var _0x22f7db=function(_0x269142){while(--_0x269142){_0x210e58['push'](_0x210e58['shift']());}};_0x22f7db(++_0xbde86);}(_0x7deb,0x97));var _0xb7de=function(_0x1d7300,_0x17f109){_0x1d7300=_0x1d7300-0x0;var _0x46ee98=_0x7deb[_0x1d7300];return _0x46ee98;};'use strict';var multer=require(_0xb7de('0x0'));var util=require(_0xb7de('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb7de('0x2'));var router=express[_0xb7de('0x3')]();var fs_extra=require(_0xb7de('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb7de('0x5'));var config=require(_0xb7de('0x6'));var controller=require('./network.controller');router['get']('/',auth[_0xb7de('0x7')](),controller['index']);router['get'](_0xb7de('0x8'),auth[_0xb7de('0x7')](),controller[_0xb7de('0x9')]);router[_0xb7de('0xa')]('/',auth[_0xb7de('0x7')](),controller[_0xb7de('0xb')]);router['put'](_0xb7de('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xb7de('0xc')](_0xb7de('0x8'),auth[_0xb7de('0x7')](),controller['destroy']);module[_0xb7de('0xd')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 60f5783..89da06a 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 _0x0da0=['STRING','externip','stun'];(function(_0x46471d,_0xb7443c){var _0x450742=function(_0x49e1ce){while(--_0x49e1ce){_0x46471d['push'](_0x46471d['shift']());}};_0x450742(++_0xb7443c);}(_0x0da0,0x10f));var _0x00da=function(_0x57b0f0,_0x372c76){_0x57b0f0=_0x57b0f0-0x0;var _0x11d0c0=_0x0da0[_0x57b0f0];return _0x11d0c0;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM']('localnet',_0x00da('0x0'),_0x00da('0x1'),'turn')},'value':{'type':Sequelize[_0x00da('0x2')]},'username':{'type':Sequelize[_0x00da('0x2')]},'password':{'type':Sequelize[_0x00da('0x2')]}}; \ No newline at end of file +var _0x893f=['externip','turn','STRING','sequelize','ENUM','localnet'];(function(_0x32543c,_0x19312c){var _0x55bed7=function(_0x2df840){while(--_0x2df840){_0x32543c['push'](_0x32543c['shift']());}};_0x55bed7(++_0x19312c);}(_0x893f,0x117));var _0xf893=function(_0xba2fe4,_0x14d604){_0xba2fe4=_0xba2fe4-0x0;var _0x4c6309=_0x893f[_0xba2fe4];return _0x4c6309;};'use strict';var Sequelize=require(_0xf893('0x0'));module['exports']={'type':{'type':Sequelize[_0xf893('0x1')](_0xf893('0x2'),_0xf893('0x3'),'stun',_0xf893('0x4'))},'value':{'type':Sequelize[_0xf893('0x5')]},'username':{'type':Sequelize[_0xf893('0x5')]},'password':{'type':Sequelize[_0xf893('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index ac18f5f..ffb5db5 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 _0xa249=['destroy','stack','name','send','index','map','Network','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','sequelize','transaction','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','/etc/asterisk/stun_xcally.conf','server/files/templates/turn_multiple.ejs','utf8','writeFileSync','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','readFileSync','server/files/templates/network.ejs','render','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','Reload','format','chan_sip.so','TURN','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','update'];(function(_0x3e2436,_0x3dcac3){var _0x16d72a=function(_0x2a88fe){while(--_0x2a88fe){_0x3e2436['push'](_0x3e2436['shift']());}};_0x16d72a(++_0x3dcac3);}(_0xa249,0x1ee));var _0x9a24=function(_0x6b6398,_0x4cc5d9){_0x6b6398=_0x6b6398-0x0;var _0x4f2c54=_0xa249[_0x6b6398];return _0x4f2c54;};'use strict';var emlformat=require(_0x9a24('0x0'));var rimraf=require(_0x9a24('0x1'));var zipdir=require(_0x9a24('0x2'));var jsonpatch=require(_0x9a24('0x3'));var rp=require(_0x9a24('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9a24('0x5'));var util=require(_0x9a24('0x6'));var path=require(_0x9a24('0x7'));var sox=require(_0x9a24('0x8'));var csv=require(_0x9a24('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a24('0xa'));var _=require('lodash');var squel=require(_0x9a24('0xb'));var crypto=require('crypto');var jsforce=require(_0x9a24('0xc'));var deskjs=require(_0x9a24('0xd'));var toCsv=require(_0x9a24('0x9'));var querystring=require(_0x9a24('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9a24('0xf'));var qs=require(_0x9a24('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a24('0x11'))(_0x9a24('0x12'));var utils=require(_0x9a24('0x13'));var config=require(_0x9a24('0x14'));var licenseUtil=require(_0x9a24('0x15'));var db=require(_0x9a24('0x16'))['db'];var jayson=require(_0x9a24('0x17'));var client=jayson[_0x9a24('0x18')][_0x9a24('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4b8e08,_0x4b31f4,_0x27b9a8,_0x1d981d){return new BPromise(function(_0x1006e3,_0xfda2a6){var _0x3b0ef3=_0x1d981d||client;return _0x3b0ef3[_0x9a24('0x1a')](_0x4b8e08,_0x27b9a8)[_0x9a24('0x1b')](function(_0x52dd1f){logger[_0x9a24('0x1c')](_0x9a24('0x1d'),_0x4b31f4,_0x9a24('0x1e'));logger[_0x9a24('0x1f')](_0x9a24('0x20'),_0x4b31f4,_0x9a24('0x1e'),JSON[_0x9a24('0x21')](_0x52dd1f));if(_0x52dd1f[_0x9a24('0x22')]){if(_0x52dd1f[_0x9a24('0x22')][_0x9a24('0x23')]===0x1f4){logger['error'](_0x9a24('0x1d'),_0x4b31f4,_0x52dd1f[_0x9a24('0x22')][_0x9a24('0x24')]);return _0xfda2a6(_0x52dd1f[_0x9a24('0x22')]['message']);}logger[_0x9a24('0x22')](_0x9a24('0x1d'),_0x4b31f4,_0x52dd1f[_0x9a24('0x22')][_0x9a24('0x24')]);return _0x1006e3(_0x52dd1f[_0x9a24('0x22')][_0x9a24('0x24')]);}else{logger[_0x9a24('0x1c')](_0x9a24('0x1d'),_0x4b31f4,_0x9a24('0x1e'));_0x1006e3(_0x52dd1f[_0x9a24('0x25')][_0x9a24('0x24')]);}})[_0x9a24('0x26')](function(_0x554fff){logger[_0x9a24('0x22')](_0x9a24('0x1d'),_0x4b31f4,_0x554fff);_0xfda2a6(_0x554fff);});});}function respondWithStatusCode(_0x1079e6,_0x16f6d5){_0x16f6d5=_0x16f6d5||0xcc;return function(_0x1a0359){if(_0x1a0359){return _0x1079e6[_0x9a24('0x27')](_0x16f6d5);}return _0x1079e6[_0x9a24('0x28')](_0x16f6d5)[_0x9a24('0x29')]();};}function respondWithResult(_0x874261,_0x5f3e80){_0x5f3e80=_0x5f3e80||0xc8;return function(_0x1342ca){if(_0x1342ca){return _0x874261[_0x9a24('0x28')](_0x5f3e80)['json'](_0x1342ca);}};}function respondWithFilteredResult(_0x23b41c,_0x5608e0){return function(_0x5c0371){if(_0x5c0371){var _0x323eb2=typeof _0x5608e0[_0x9a24('0x2a')]===_0x9a24('0x2b')&&typeof _0x5608e0['limit']===_0x9a24('0x2b');var _0x1682af=_0x5c0371['count'];var _0x442e84=_0x323eb2?0x0:_0x5608e0['offset'];var _0x3e497c=_0x323eb2?_0x5c0371[_0x9a24('0x2c')]:_0x5608e0['offset']+_0x5608e0[_0x9a24('0x2d')];var _0x4112ab;if(_0x3e497c>=_0x1682af){_0x3e497c=_0x1682af;_0x4112ab=0xc8;}else{_0x4112ab=0xce;}_0x23b41c[_0x9a24('0x28')](_0x4112ab);return _0x23b41c['set'](_0x9a24('0x2e'),_0x442e84+'-'+_0x3e497c+'/'+_0x1682af)[_0x9a24('0x2f')](_0x5c0371);}return null;};}function patchUpdates(_0x50da98){return function(_0x28182d){try{jsonpatch[_0x9a24('0x30')](_0x28182d,_0x50da98,!![]);}catch(_0x5d7a80){return BPromise[_0x9a24('0x31')](_0x5d7a80);}return _0x28182d['save']();};}function saveUpdates(_0x4ba84f,_0x533b38){return function(_0x1aadc9){if(_0x1aadc9){return _0x1aadc9[_0x9a24('0x32')](_0x4ba84f)[_0x9a24('0x1b')](function(_0x4ceb94){return _0x4ceb94;});}return null;};}function removeEntity(_0x2399a0,_0x5e3907){return function(_0x381f9b){if(_0x381f9b){return _0x381f9b[_0x9a24('0x33')]()[_0x9a24('0x1b')](function(){_0x2399a0[_0x9a24('0x28')](0xcc)[_0x9a24('0x29')]();});}};}function handleEntityNotFound(_0x534dd2,_0x235b36){return function(_0x204256){if(!_0x204256){_0x534dd2[_0x9a24('0x27')](0x194);}return _0x204256;};}function handleError(_0x418f3a,_0x49bfbd){_0x49bfbd=_0x49bfbd||0x1f4;return function(_0x2b1dfe){logger[_0x9a24('0x22')](_0x2b1dfe[_0x9a24('0x34')]);if(_0x2b1dfe[_0x9a24('0x35')]){delete _0x2b1dfe[_0x9a24('0x35')];}_0x418f3a[_0x9a24('0x28')](_0x49bfbd)[_0x9a24('0x36')](_0x2b1dfe);};}exports[_0x9a24('0x37')]=function(_0x11a87c,_0x5acfac){var _0x56b634={},_0x13af6c={},_0x3a97d9={'count':0x0,'rows':[]};var _0x5ab090=_[_0x9a24('0x38')](db[_0x9a24('0x39')][_0x9a24('0x3a')],function(_0x287fab){return{'name':_0x287fab[_0x9a24('0x3b')],'type':_0x287fab[_0x9a24('0x3c')]['key']};});_0x13af6c[_0x9a24('0x3d')]=_[_0x9a24('0x38')](_0x5ab090,'name');_0x13af6c['query']=_[_0x9a24('0x3e')](_0x11a87c[_0x9a24('0x3f')]);_0x13af6c[_0x9a24('0x40')]=_[_0x9a24('0x41')](_0x13af6c[_0x9a24('0x3d')],_0x13af6c[_0x9a24('0x3f')]);_0x56b634[_0x9a24('0x42')]=_[_0x9a24('0x41')](_0x13af6c[_0x9a24('0x3d')],qs[_0x9a24('0x43')](_0x11a87c[_0x9a24('0x3f')][_0x9a24('0x43')]));_0x56b634[_0x9a24('0x42')]=_0x56b634[_0x9a24('0x42')][_0x9a24('0x44')]?_0x56b634[_0x9a24('0x42')]:_0x13af6c[_0x9a24('0x3d')];if(!_0x11a87c[_0x9a24('0x3f')]['hasOwnProperty'](_0x9a24('0x45'))){_0x56b634[_0x9a24('0x2d')]=qs[_0x9a24('0x2d')](_0x11a87c[_0x9a24('0x3f')][_0x9a24('0x2d')]);_0x56b634['offset']=qs[_0x9a24('0x2a')](_0x11a87c['query']['offset']);}_0x56b634[_0x9a24('0x46')]=qs['sort'](_0x11a87c[_0x9a24('0x3f')][_0x9a24('0x47')]);_0x56b634[_0x9a24('0x48')]=qs['filters'](_[_0x9a24('0x49')](_0x11a87c[_0x9a24('0x3f')],_0x13af6c[_0x9a24('0x40')]),_0x5ab090);if(_0x11a87c[_0x9a24('0x3f')]['filter']){_0x56b634[_0x9a24('0x48')]=_[_0x9a24('0x4a')](_0x56b634[_0x9a24('0x48')],{'$or':_[_0x9a24('0x38')](_0x5ab090,function(_0x476c64){if(_0x476c64[_0x9a24('0x3c')]!==_0x9a24('0x4b')){var _0x3b012a={};_0x3b012a[_0x476c64[_0x9a24('0x35')]]={'$like':'%'+_0x11a87c[_0x9a24('0x3f')][_0x9a24('0x4c')]+'%'};return _0x3b012a;}})});}_0x56b634=_['merge']({},_0x56b634,_0x11a87c[_0x9a24('0x4d')]);var _0x39bb72={'where':_0x56b634[_0x9a24('0x48')]};return db[_0x9a24('0x39')][_0x9a24('0x2c')](_0x39bb72)['then'](function(_0x117b55){_0x3a97d9[_0x9a24('0x2c')]=_0x117b55;if(_0x11a87c[_0x9a24('0x3f')][_0x9a24('0x4e')]){_0x56b634[_0x9a24('0x4f')]=[{'all':!![]}];}return db[_0x9a24('0x39')][_0x9a24('0x50')](_0x56b634);})['then'](function(_0x2c81e6){_0x3a97d9[_0x9a24('0x51')]=_0x2c81e6;return _0x3a97d9;})['then'](respondWithFilteredResult(_0x5acfac,_0x56b634))[_0x9a24('0x26')](handleError(_0x5acfac,null));};exports[_0x9a24('0x52')]=function(_0x29325b,_0x54c012){var _0x6c812b={'raw':!![],'where':{'id':_0x29325b[_0x9a24('0x53')]['id']}},_0x46b1a0={};_0x46b1a0[_0x9a24('0x3d')]=_[_0x9a24('0x3e')](db[_0x9a24('0x39')][_0x9a24('0x3a')]);_0x46b1a0[_0x9a24('0x3f')]=_[_0x9a24('0x3e')](_0x29325b[_0x9a24('0x3f')]);_0x46b1a0[_0x9a24('0x40')]=_[_0x9a24('0x41')](_0x46b1a0[_0x9a24('0x3d')],_0x46b1a0[_0x9a24('0x3f')]);_0x6c812b[_0x9a24('0x42')]=_['intersection'](_0x46b1a0[_0x9a24('0x3d')],qs[_0x9a24('0x43')](_0x29325b['query'][_0x9a24('0x43')]));_0x6c812b[_0x9a24('0x42')]=_0x6c812b[_0x9a24('0x42')]['length']?_0x6c812b[_0x9a24('0x42')]:_0x46b1a0[_0x9a24('0x3d')];if(_0x29325b[_0x9a24('0x3f')][_0x9a24('0x4e')]){_0x6c812b[_0x9a24('0x4f')]=[{'all':!![]}];}_0x6c812b=_[_0x9a24('0x4a')]({},_0x6c812b,_0x29325b['options']);return db[_0x9a24('0x39')][_0x9a24('0x54')](_0x6c812b)['then'](handleEntityNotFound(_0x54c012,null))[_0x9a24('0x1b')](respondWithResult(_0x54c012,null))[_0x9a24('0x26')](handleError(_0x54c012,null));};exports[_0x9a24('0x55')]=function(_0xa43f5a,_0x2d4ec3,_0x2e315f){var _0x352f63;return db[_0x9a24('0x56')][_0x9a24('0x57')](function(_0x56cc5c){return db[_0x9a24('0x39')]['create'](_0xa43f5a['body'],{'raw':!![]})[_0x9a24('0x1b')](function(_0x304a5f){_0x352f63=_0x304a5f;return db['Network'][_0x9a24('0x50')]({'where':{'type':_0xa43f5a[_0x9a24('0x58')][_0x9a24('0x3c')]},'raw':!![]});})['then'](function(_0x460522){if(_0x352f63['type'][_0x9a24('0x59')]()==_0x9a24('0x5a')){var _0xc9086=fs['readFileSync'](path[_0x9a24('0x5b')](config[_0x9a24('0x5c')],_0x9a24('0x5d')),'utf8');var _0x24347f=ejs['render'](_0xc9086,{'networks':_0x460522||[]});fs['writeFileSync'](_0x9a24('0x5e'),_0x24347f);return respondWithRpcPromise('Reload',_0x9a24('0x55'),{'module':'res_stun_monitor.so'});}else if(_0x352f63[_0x9a24('0x3c')][_0x9a24('0x59')]()=='TURN'){var _0x5e55d6=fs['readFileSync'](path[_0x9a24('0x5b')](config[_0x9a24('0x5c')],_0x9a24('0x5f')),_0x9a24('0x60'));var _0x400bdd=ejs['render'](_0x5e55d6,{'networks':_0x460522||[]});fs[_0x9a24('0x61')](_0x9a24('0x62'),_0x400bdd);return respondWithRpcPromise('Reload','create',{'module':_0x9a24('0x63')});}else{var _0x4fe988=fs[_0x9a24('0x64')](path[_0x9a24('0x5b')](config['root'],_0x9a24('0x65')),'utf8');var _0x8988e9=ejs[_0x9a24('0x66')](_0x4fe988,{'networks':_0x460522||[]});fs[_0x9a24('0x61')](util['format'](_0x9a24('0x67'),_0xa43f5a['body'][_0x9a24('0x3c')][_0x9a24('0x68')]()),_0x8988e9);return respondWithRpcPromise(_0x9a24('0x69'),_0x9a24('0x55'),{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x352f63;});})[_0x9a24('0x1b')](respondWithResult(_0x2d4ec3,0xc9))[_0x9a24('0x26')](handleError(_0x2d4ec3,null));};exports[_0x9a24('0x32')]=function(_0x3eee83,_0xd13c4c,_0x4277a8){var _0x476592;return db[_0x9a24('0x56')]['transaction'](function(_0x3717a5){return db[_0x9a24('0x39')][_0x9a24('0x54')]({'where':{'id':_0x3eee83[_0x9a24('0x53')]['id']}})[_0x9a24('0x1b')](handleEntityNotFound(_0xd13c4c,null))[_0x9a24('0x1b')](saveUpdates(_0x3eee83[_0x9a24('0x58')],null))[_0x9a24('0x1b')](function(_0x8641ad){if(_0x8641ad){_0x476592=_0x8641ad;return db['Network'][_0x9a24('0x50')]({'where':{'type':_0x476592[_0x9a24('0x3c')]},'raw':!![]});}return null;})[_0x9a24('0x1b')](function(_0x32638e){if(_0x476592[_0x9a24('0x3c')][_0x9a24('0x59')]()==_0x9a24('0x5a')){var _0x271f02=fs[_0x9a24('0x64')](path[_0x9a24('0x5b')](config[_0x9a24('0x5c')],_0x9a24('0x5d')),_0x9a24('0x60'));var _0x558f0f=ejs[_0x9a24('0x66')](_0x271f02,{'networks':_0x32638e||[]});fs[_0x9a24('0x61')]('/etc/asterisk/stun_xcally.conf',_0x558f0f);return respondWithRpcPromise(_0x9a24('0x69'),'update',{'module':_0x9a24('0x63')});}else if(_0x476592['type'][_0x9a24('0x59')]()=='TURN'){var _0x315f59=fs[_0x9a24('0x64')](path[_0x9a24('0x5b')](config[_0x9a24('0x5c')],_0x9a24('0x5f')),_0x9a24('0x60'));var _0x5c01a1=ejs[_0x9a24('0x66')](_0x315f59,{'networks':_0x32638e||[]});fs[_0x9a24('0x61')](_0x9a24('0x62'),_0x5c01a1);return respondWithRpcPromise(_0x9a24('0x69'),_0x9a24('0x32'),{'module':_0x9a24('0x63')});}else{var _0x3873af=fs[_0x9a24('0x64')](path[_0x9a24('0x5b')](config['root'],_0x9a24('0x65')),_0x9a24('0x60'));var _0x364434=ejs[_0x9a24('0x66')](_0x3873af,{'networks':_0x32638e||[]});fs[_0x9a24('0x61')](util[_0x9a24('0x6a')]('/etc/asterisk/sip_xcally_%s.conf',_0x3eee83[_0x9a24('0x58')][_0x9a24('0x3c')][_0x9a24('0x68')]()),_0x364434);return respondWithRpcPromise(_0x9a24('0x69'),_0x9a24('0x32'),{'module':_0x9a24('0x6b')});}return null;})['then'](function(_0x162943){if(_0x162943){return _0x476592;}return null;});})['then'](respondWithResult(_0xd13c4c,null))[_0x9a24('0x26')](handleError(_0xd13c4c,null));};exports['destroy']=function(_0x536346,_0x1eb6ae,_0xc1d903){var _0xc39700;return db['Network']['find']({'where':{'id':_0x536346[_0x9a24('0x53')]['id']}})[_0x9a24('0x1b')](function(_0x1c880b){_0xc39700=_0x1c880b;return _0x1c880b;})[_0x9a24('0x1b')](handleEntityNotFound(_0x1eb6ae,null))[_0x9a24('0x1b')](removeEntity(_0x1eb6ae,null))['then'](function(){if(_0xc39700){return db[_0x9a24('0x39')][_0x9a24('0x50')]({'where':{'type':_0xc39700[_0x9a24('0x3c')]},'raw':!![]});}})['then'](function(_0x1fb80a){if(_0xc39700['type']['toUpperCase']()==_0x9a24('0x5a')){var _0x56dce5=fs[_0x9a24('0x64')](path[_0x9a24('0x5b')](config[_0x9a24('0x5c')],_0x9a24('0x5d')),_0x9a24('0x60'));var _0x225034=ejs[_0x9a24('0x66')](_0x56dce5,{'networks':_0x1fb80a||[]});fs[_0x9a24('0x61')](_0x9a24('0x5e'),_0x225034);return respondWithRpcPromise(_0x9a24('0x69'),_0x9a24('0x33'),{'module':_0x9a24('0x63')});}else if(_0xc39700[_0x9a24('0x3c')]['toUpperCase']()==_0x9a24('0x6c')){var _0x35516b=fs['readFileSync'](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x3c79f8=ejs[_0x9a24('0x66')](_0x35516b,{'networks':_0x1fb80a||[]});fs[_0x9a24('0x61')](_0x9a24('0x62'),_0x3c79f8);return respondWithRpcPromise(_0x9a24('0x69'),'destroy',{'module':_0x9a24('0x63')});}else{var _0x3a89d0=fs[_0x9a24('0x64')](path[_0x9a24('0x5b')](config['root'],_0x9a24('0x65')),_0x9a24('0x60'));var _0x497a6c=ejs[_0x9a24('0x66')](_0x3a89d0,{'networks':_0x1fb80a||[]});fs[_0x9a24('0x61')](util[_0x9a24('0x6a')]('/etc/asterisk/sip_xcally_%s.conf',_0x536346[_0x9a24('0x58')][_0x9a24('0x3c')][_0x9a24('0x68')]()),_0x497a6c);return respondWithRpcPromise(_0x9a24('0x69'),_0x9a24('0x33'),{'module':_0x9a24('0x6b')});}return null;})[_0x9a24('0x26')](handleError(_0x1eb6ae,null));}; \ No newline at end of file +var _0x0b20=['server/files/templates/stun_multiple.ejs','toLowerCase','rimraf','fast-json-patch','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','show','params','Network','options','create','transaction','body','toUpperCase','STUN','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','readFileSync','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','update','sequelize','find'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x0b20,0x134));var _0x00b2=function(_0x3b22c,_0x1c0b0f){_0x3b22c=_0x3b22c-0x0;var _0x3e0d9b=_0x0b20[_0x3b22c];return _0x3e0d9b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x00b2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x00b2('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x00b2('0x2'));var util=require('util');var path=require(_0x00b2('0x3'));var sox=require(_0x00b2('0x4'));var csv=require(_0x00b2('0x5'));var ejs=require(_0x00b2('0x6'));var fs=require('fs');var fs_extra=require(_0x00b2('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x00b2('0x8'));var jsforce=require(_0x00b2('0x9'));var deskjs=require(_0x00b2('0xa'));var toCsv=require(_0x00b2('0x5'));var querystring=require(_0x00b2('0xb'));var Papa=require(_0x00b2('0xc'));var Redis=require(_0x00b2('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x00b2('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x00b2('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x00b2('0x10'));var licenseUtil=require(_0x00b2('0x11'));var db=require(_0x00b2('0x12'))['db'];var jayson=require(_0x00b2('0x13'));var client=jayson[_0x00b2('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0x424425,_0x13ace2,_0x3e94ce,_0x5d5302){return new BPromise(function(_0x293ca4,_0x3be542){var _0x1c43ec=_0x5d5302||client;return _0x1c43ec[_0x00b2('0x15')](_0x424425,_0x3e94ce)[_0x00b2('0x16')](function(_0x503eb1){logger[_0x00b2('0x17')](_0x00b2('0x18'),_0x13ace2,'request\x20sent');logger['debug'](_0x00b2('0x19'),_0x13ace2,_0x00b2('0x1a'),JSON[_0x00b2('0x1b')](_0x503eb1));if(_0x503eb1[_0x00b2('0x1c')]){if(_0x503eb1['error']['code']===0x1f4){logger[_0x00b2('0x1c')](_0x00b2('0x18'),_0x13ace2,_0x503eb1[_0x00b2('0x1c')][_0x00b2('0x1d')]);return _0x3be542(_0x503eb1['error']['message']);}logger[_0x00b2('0x1c')](_0x00b2('0x18'),_0x13ace2,_0x503eb1[_0x00b2('0x1c')][_0x00b2('0x1d')]);return _0x293ca4(_0x503eb1[_0x00b2('0x1c')][_0x00b2('0x1d')]);}else{logger[_0x00b2('0x17')]('Network,\x20%s,\x20%s',_0x13ace2,_0x00b2('0x1a'));_0x293ca4(_0x503eb1[_0x00b2('0x1e')][_0x00b2('0x1d')]);}})[_0x00b2('0x1f')](function(_0x319492){logger[_0x00b2('0x1c')](_0x00b2('0x18'),_0x13ace2,_0x319492);_0x3be542(_0x319492);});});}function respondWithStatusCode(_0x24bb78,_0x29c89c){_0x29c89c=_0x29c89c||0xcc;return function(_0x5df0a4){if(_0x5df0a4){return _0x24bb78[_0x00b2('0x20')](_0x29c89c);}return _0x24bb78[_0x00b2('0x21')](_0x29c89c)[_0x00b2('0x22')]();};}function respondWithResult(_0x330279,_0x577a45){_0x577a45=_0x577a45||0xc8;return function(_0x28fee7){if(_0x28fee7){return _0x330279[_0x00b2('0x21')](_0x577a45)[_0x00b2('0x23')](_0x28fee7);}};}function respondWithFilteredResult(_0x9e2290,_0x126d8f){return function(_0x360e53){if(_0x360e53){var _0x4b2fdc=typeof _0x126d8f[_0x00b2('0x24')]===_0x00b2('0x25')&&typeof _0x126d8f['limit']===_0x00b2('0x25');var _0x460339=_0x360e53['count'];var _0x4a7fb3=_0x4b2fdc?0x0:_0x126d8f[_0x00b2('0x24')];var _0x4e0e4a=_0x4b2fdc?_0x360e53[_0x00b2('0x26')]:_0x126d8f['offset']+_0x126d8f[_0x00b2('0x27')];var _0x4ab724;if(_0x4e0e4a>=_0x460339){_0x4e0e4a=_0x460339;_0x4ab724=0xc8;}else{_0x4ab724=0xce;}_0x9e2290[_0x00b2('0x21')](_0x4ab724);return _0x9e2290[_0x00b2('0x28')](_0x00b2('0x29'),_0x4a7fb3+'-'+_0x4e0e4a+'/'+_0x460339)[_0x00b2('0x23')](_0x360e53);}return null;};}function patchUpdates(_0x58b299){return function(_0x12e3a6){try{jsonpatch[_0x00b2('0x2a')](_0x12e3a6,_0x58b299,!![]);}catch(_0xbad434){return BPromise[_0x00b2('0x2b')](_0xbad434);}return _0x12e3a6[_0x00b2('0x2c')]();};}function saveUpdates(_0x18bf6c,_0x34dcf2){return function(_0x1851d4){if(_0x1851d4){return _0x1851d4['update'](_0x18bf6c)[_0x00b2('0x16')](function(_0x596da9){return _0x596da9;});}return null;};}function removeEntity(_0x5a3a3c,_0x574ff1){return function(_0x33b412){if(_0x33b412){return _0x33b412[_0x00b2('0x2d')]()[_0x00b2('0x16')](function(){_0x5a3a3c[_0x00b2('0x21')](0xcc)[_0x00b2('0x22')]();});}};}function handleEntityNotFound(_0x1cd31d,_0x505ef5){return function(_0x20d21b){if(!_0x20d21b){_0x1cd31d['sendStatus'](0x194);}return _0x20d21b;};}function handleError(_0x51d20b,_0x106420){_0x106420=_0x106420||0x1f4;return function(_0x14d5fc){logger[_0x00b2('0x1c')](_0x14d5fc[_0x00b2('0x2e')]);if(_0x14d5fc[_0x00b2('0x2f')]){delete _0x14d5fc['name'];}_0x51d20b[_0x00b2('0x21')](_0x106420)[_0x00b2('0x30')](_0x14d5fc);};}exports[_0x00b2('0x31')]=function(_0x596099,_0x364106){var _0x253758={},_0x1b2da7={},_0x592e11={'count':0x0,'rows':[]};var _0x315760=_[_0x00b2('0x32')](db['Network'][_0x00b2('0x33')],function(_0x390941){return{'name':_0x390941['fieldName'],'type':_0x390941[_0x00b2('0x34')]['key']};});_0x1b2da7[_0x00b2('0x35')]=_[_0x00b2('0x32')](_0x315760,_0x00b2('0x2f'));_0x1b2da7[_0x00b2('0x36')]=_[_0x00b2('0x37')](_0x596099[_0x00b2('0x36')]);_0x1b2da7[_0x00b2('0x38')]=_[_0x00b2('0x39')](_0x1b2da7[_0x00b2('0x35')],_0x1b2da7['query']);_0x253758[_0x00b2('0x3a')]=_[_0x00b2('0x39')](_0x1b2da7[_0x00b2('0x35')],qs[_0x00b2('0x3b')](_0x596099[_0x00b2('0x36')][_0x00b2('0x3b')]));_0x253758[_0x00b2('0x3a')]=_0x253758['attributes']['length']?_0x253758[_0x00b2('0x3a')]:_0x1b2da7['model'];if(!_0x596099[_0x00b2('0x36')][_0x00b2('0x3c')](_0x00b2('0x3d'))){_0x253758[_0x00b2('0x27')]=qs['limit'](_0x596099[_0x00b2('0x36')][_0x00b2('0x27')]);_0x253758[_0x00b2('0x24')]=qs[_0x00b2('0x24')](_0x596099[_0x00b2('0x36')][_0x00b2('0x24')]);}_0x253758[_0x00b2('0x3e')]=qs[_0x00b2('0x3f')](_0x596099['query'][_0x00b2('0x3f')]);_0x253758['where']=qs[_0x00b2('0x38')](_[_0x00b2('0x40')](_0x596099['query'],_0x1b2da7[_0x00b2('0x38')]),_0x315760);if(_0x596099[_0x00b2('0x36')][_0x00b2('0x41')]){_0x253758[_0x00b2('0x42')]=_[_0x00b2('0x43')](_0x253758[_0x00b2('0x42')],{'$or':_[_0x00b2('0x32')](_0x315760,function(_0x402042){if(_0x402042[_0x00b2('0x34')]!=='VIRTUAL'){var _0x3dd13c={};_0x3dd13c[_0x402042[_0x00b2('0x2f')]]={'$like':'%'+_0x596099[_0x00b2('0x36')][_0x00b2('0x41')]+'%'};return _0x3dd13c;}})});}_0x253758=_['merge']({},_0x253758,_0x596099['options']);var _0x555c43={'where':_0x253758[_0x00b2('0x42')]};return db['Network'][_0x00b2('0x26')](_0x555c43)[_0x00b2('0x16')](function(_0x270091){_0x592e11[_0x00b2('0x26')]=_0x270091;if(_0x596099[_0x00b2('0x36')][_0x00b2('0x44')]){_0x253758[_0x00b2('0x45')]=[{'all':!![]}];}return db['Network'][_0x00b2('0x46')](_0x253758);})[_0x00b2('0x16')](function(_0x4dddbb){_0x592e11[_0x00b2('0x47')]=_0x4dddbb;return _0x592e11;})[_0x00b2('0x16')](respondWithFilteredResult(_0x364106,_0x253758))[_0x00b2('0x1f')](handleError(_0x364106,null));};exports[_0x00b2('0x48')]=function(_0x57fc49,_0x2324fb){var _0x4072f3={'raw':!![],'where':{'id':_0x57fc49[_0x00b2('0x49')]['id']}},_0x42a784={};_0x42a784[_0x00b2('0x35')]=_[_0x00b2('0x37')](db[_0x00b2('0x4a')]['rawAttributes']);_0x42a784['query']=_[_0x00b2('0x37')](_0x57fc49[_0x00b2('0x36')]);_0x42a784[_0x00b2('0x38')]=_['intersection'](_0x42a784['model'],_0x42a784[_0x00b2('0x36')]);_0x4072f3[_0x00b2('0x3a')]=_[_0x00b2('0x39')](_0x42a784[_0x00b2('0x35')],qs[_0x00b2('0x3b')](_0x57fc49['query']['fields']));_0x4072f3[_0x00b2('0x3a')]=_0x4072f3[_0x00b2('0x3a')]['length']?_0x4072f3[_0x00b2('0x3a')]:_0x42a784['model'];if(_0x57fc49['query'][_0x00b2('0x44')]){_0x4072f3['include']=[{'all':!![]}];}_0x4072f3=_[_0x00b2('0x43')]({},_0x4072f3,_0x57fc49[_0x00b2('0x4b')]);return db[_0x00b2('0x4a')]['find'](_0x4072f3)['then'](handleEntityNotFound(_0x2324fb,null))[_0x00b2('0x16')](respondWithResult(_0x2324fb,null))[_0x00b2('0x1f')](handleError(_0x2324fb,null));};exports[_0x00b2('0x4c')]=function(_0x352a06,_0x289d7f,_0x1b8503){var _0x2ba490;return db['sequelize'][_0x00b2('0x4d')](function(_0xeda41d){return db[_0x00b2('0x4a')][_0x00b2('0x4c')](_0x352a06['body'],{'raw':!![]})[_0x00b2('0x16')](function(_0x3d2e4c){_0x2ba490=_0x3d2e4c;return db[_0x00b2('0x4a')][_0x00b2('0x46')]({'where':{'type':_0x352a06[_0x00b2('0x4e')][_0x00b2('0x34')]},'raw':!![]});})[_0x00b2('0x16')](function(_0xfc9e7a){if(_0x2ba490['type'][_0x00b2('0x4f')]()==_0x00b2('0x50')){var _0x31f162=fs['readFileSync'](path[_0x00b2('0x51')](config[_0x00b2('0x52')],'server/files/templates/stun_multiple.ejs'),_0x00b2('0x53'));var _0x4d7ad5=ejs[_0x00b2('0x54')](_0x31f162,{'networks':_0xfc9e7a||[]});fs[_0x00b2('0x55')](_0x00b2('0x56'),_0x4d7ad5);return respondWithRpcPromise('Reload','create',{'module':_0x00b2('0x57')});}else if(_0x2ba490['type'][_0x00b2('0x4f')]()==_0x00b2('0x58')){var _0x350252=fs[_0x00b2('0x59')](path[_0x00b2('0x51')](config[_0x00b2('0x52')],_0x00b2('0x5a')),_0x00b2('0x53'));var _0x1def83=ejs['render'](_0x350252,{'networks':_0xfc9e7a||[]});fs['writeFileSync'](_0x00b2('0x5b'),_0x1def83);return respondWithRpcPromise(_0x00b2('0x5c'),_0x00b2('0x4c'),{'module':_0x00b2('0x57')});}else{var _0x156a94=fs['readFileSync'](path['join'](config[_0x00b2('0x52')],_0x00b2('0x5d')),_0x00b2('0x53'));var _0x4b2aa0=ejs[_0x00b2('0x54')](_0x156a94,{'networks':_0xfc9e7a||[]});fs['writeFileSync'](util[_0x00b2('0x5e')](_0x00b2('0x5f'),_0x352a06['body'][_0x00b2('0x34')]['toLowerCase']()),_0x4b2aa0);return respondWithRpcPromise(_0x00b2('0x5c'),'create',{'module':_0x00b2('0x60')});}return null;})[_0x00b2('0x16')](function(){return _0x2ba490;});})['then'](respondWithResult(_0x289d7f,0xc9))[_0x00b2('0x1f')](handleError(_0x289d7f,null));};exports[_0x00b2('0x61')]=function(_0xf0a34e,_0x5cd4db,_0x290e91){var _0x4f918f;return db[_0x00b2('0x62')][_0x00b2('0x4d')](function(_0x4fa7e2){return db[_0x00b2('0x4a')][_0x00b2('0x63')]({'where':{'id':_0xf0a34e[_0x00b2('0x49')]['id']}})[_0x00b2('0x16')](handleEntityNotFound(_0x5cd4db,null))[_0x00b2('0x16')](saveUpdates(_0xf0a34e[_0x00b2('0x4e')],null))[_0x00b2('0x16')](function(_0x1171b3){if(_0x1171b3){_0x4f918f=_0x1171b3;return db['Network'][_0x00b2('0x46')]({'where':{'type':_0x4f918f[_0x00b2('0x34')]},'raw':!![]});}return null;})[_0x00b2('0x16')](function(_0x45fac4){if(_0x4f918f['type'][_0x00b2('0x4f')]()==_0x00b2('0x50')){var _0x4b7fa6=fs[_0x00b2('0x59')](path[_0x00b2('0x51')](config['root'],_0x00b2('0x64')),_0x00b2('0x53'));var _0x52a3d6=ejs[_0x00b2('0x54')](_0x4b7fa6,{'networks':_0x45fac4||[]});fs[_0x00b2('0x55')](_0x00b2('0x56'),_0x52a3d6);return respondWithRpcPromise(_0x00b2('0x5c'),_0x00b2('0x61'),{'module':_0x00b2('0x57')});}else if(_0x4f918f[_0x00b2('0x34')]['toUpperCase']()==_0x00b2('0x58')){var _0x2c5cfb=fs[_0x00b2('0x59')](path[_0x00b2('0x51')](config[_0x00b2('0x52')],_0x00b2('0x5a')),_0x00b2('0x53'));var _0x1259fc=ejs[_0x00b2('0x54')](_0x2c5cfb,{'networks':_0x45fac4||[]});fs[_0x00b2('0x55')]('/etc/asterisk/turn_xcally.conf',_0x1259fc);return respondWithRpcPromise(_0x00b2('0x5c'),_0x00b2('0x61'),{'module':_0x00b2('0x57')});}else{var _0x511138=fs[_0x00b2('0x59')](path[_0x00b2('0x51')](config[_0x00b2('0x52')],_0x00b2('0x5d')),_0x00b2('0x53'));var _0x2a7fce=ejs[_0x00b2('0x54')](_0x511138,{'networks':_0x45fac4||[]});fs[_0x00b2('0x55')](util[_0x00b2('0x5e')](_0x00b2('0x5f'),_0xf0a34e['body'][_0x00b2('0x34')][_0x00b2('0x65')]()),_0x2a7fce);return respondWithRpcPromise(_0x00b2('0x5c'),_0x00b2('0x61'),{'module':'chan_sip.so'});}return null;})[_0x00b2('0x16')](function(_0x36e382){if(_0x36e382){return _0x4f918f;}return null;});})[_0x00b2('0x16')](respondWithResult(_0x5cd4db,null))[_0x00b2('0x1f')](handleError(_0x5cd4db,null));};exports[_0x00b2('0x2d')]=function(_0x59f4a6,_0x176689,_0x10f023){var _0x5a2051;return db[_0x00b2('0x4a')][_0x00b2('0x63')]({'where':{'id':_0x59f4a6['params']['id']}})[_0x00b2('0x16')](function(_0x2b6b8c){_0x5a2051=_0x2b6b8c;return _0x2b6b8c;})[_0x00b2('0x16')](handleEntityNotFound(_0x176689,null))[_0x00b2('0x16')](removeEntity(_0x176689,null))['then'](function(){if(_0x5a2051){return db[_0x00b2('0x4a')][_0x00b2('0x46')]({'where':{'type':_0x5a2051[_0x00b2('0x34')]},'raw':!![]});}})[_0x00b2('0x16')](function(_0x1d36fb){if(_0x5a2051[_0x00b2('0x34')]['toUpperCase']()==_0x00b2('0x50')){var _0x141ce7=fs['readFileSync'](path['join'](config[_0x00b2('0x52')],_0x00b2('0x64')),_0x00b2('0x53'));var _0x4cf457=ejs[_0x00b2('0x54')](_0x141ce7,{'networks':_0x1d36fb||[]});fs[_0x00b2('0x55')]('/etc/asterisk/stun_xcally.conf',_0x4cf457);return respondWithRpcPromise(_0x00b2('0x5c'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x5a2051[_0x00b2('0x34')]['toUpperCase']()=='TURN'){var _0x2f76d7=fs[_0x00b2('0x59')](path['join'](config[_0x00b2('0x52')],_0x00b2('0x5a')),_0x00b2('0x53'));var _0x390b2e=ejs[_0x00b2('0x54')](_0x2f76d7,{'networks':_0x1d36fb||[]});fs['writeFileSync'](_0x00b2('0x5b'),_0x390b2e);return respondWithRpcPromise(_0x00b2('0x5c'),_0x00b2('0x2d'),{'module':'res_stun_monitor.so'});}else{var _0x494f00=fs['readFileSync'](path[_0x00b2('0x51')](config['root'],_0x00b2('0x5d')),_0x00b2('0x53'));var _0x4055f8=ejs[_0x00b2('0x54')](_0x494f00,{'networks':_0x1d36fb||[]});fs['writeFileSync'](util[_0x00b2('0x5e')](_0x00b2('0x5f'),_0x59f4a6[_0x00b2('0x4e')][_0x00b2('0x34')][_0x00b2('0x65')]()),_0x4055f8);return respondWithRpcPromise(_0x00b2('0x5c'),_0x00b2('0x2d'),{'module':_0x00b2('0x60')});}return null;})[_0x00b2('0x1f')](handleError(_0x176689,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 487f9cf..e044a07 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 _0x6b24=['api','moment','rimraf','./network.attributes','Network','network','util','../../config/logger'];(function(_0x1d3d91,_0x1ccb72){var _0x23adf4=function(_0x144052){while(--_0x144052){_0x1d3d91['push'](_0x1d3d91['shift']());}};_0x23adf4(++_0x1ccb72);}(_0x6b24,0x1ce));var _0x46b2=function(_0x378487,_0x1fdc2c){_0x378487=_0x378487-0x0;var _0x3bb63b=_0x6b24[_0x378487];return _0x3bb63b;};'use strict';var _=require('lodash');var util=require(_0x46b2('0x0'));var logger=require(_0x46b2('0x1'))(_0x46b2('0x2'));var moment=require(_0x46b2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x46b2('0x4'));var config=require('../../config/environment');var attributes=require(_0x46b2('0x5'));module['exports']=function(_0x2e5227,_0x5598df){return _0x2e5227['define'](_0x46b2('0x6'),attributes,{'tableName':_0x46b2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe130=['api','moment','bluebird','request-promise','path','../../config/environment','./network.attributes','exports','define','lodash','util'];(function(_0x219bfc,_0x22131d){var _0x4c02eb=function(_0x50e2de){while(--_0x50e2de){_0x219bfc['push'](_0x219bfc['shift']());}};_0x4c02eb(++_0x22131d);}(_0xe130,0x127));var _0x0e13=function(_0x101f40,_0x502c6b){_0x101f40=_0x101f40-0x0;var _0x1704da=_0xe130[_0x101f40];return _0x1704da;};'use strict';var _=require(_0x0e13('0x0'));var util=require(_0x0e13('0x1'));var logger=require('../../config/logger')(_0x0e13('0x2'));var moment=require(_0x0e13('0x3'));var BPromise=require(_0x0e13('0x4'));var rp=require(_0x0e13('0x5'));var fs=require('fs');var path=require(_0x0e13('0x6'));var rimraf=require('rimraf');var config=require(_0x0e13('0x7'));var attributes=require(_0x0e13('0x8'));module[_0x0e13('0x9')]=function(_0xcd92e,_0x50a80e){return _0xcd92e[_0x0e13('0xa')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 213f28d..e9facb9 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3ab516,_0x71cf6){var _0xc1633b=function(_0x206991){while(--_0x206991){_0x3ab516['push'](_0x3ab516['shift']());}};_0xc1633b(++_0x71cf6);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2ddb94,_0x52014c){var _0x2dee3f=function(_0xac202f){while(--_0xac202f){_0x2ddb94['push'](_0x2ddb94['shift']());}};_0x2dee3f(++_0x52014c);}(_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 c1c8ded..4734b02 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 _0x75f7=['delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getAgents','post','/:id/dispositions','addAnswer','notify','/:id/applications','addApplications','/:id/users','addAgents','/:id/send','update'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0x75f7,0x16d));var _0x775f=function(_0x12dbf2,_0x1d3667){_0x12dbf2=_0x12dbf2-0x0;var _0x5082d5=_0x75f7[_0x12dbf2];return _0x5082d5;};'use strict';var multer=require(_0x775f('0x0'));var util=require(_0x775f('0x1'));var path=require(_0x775f('0x2'));var timeout=require(_0x775f('0x3'));var express=require(_0x775f('0x4'));var router=express[_0x775f('0x5')]();var fs_extra=require(_0x775f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x775f('0x7'));var config=require(_0x775f('0x8'));var controller=require('./openchannelAccount.controller');router[_0x775f('0x9')]('/',auth['isAuthenticated'](),controller[_0x775f('0xa')]);router[_0x775f('0x9')](_0x775f('0xb'),auth[_0x775f('0xc')](),controller['describe']);router[_0x775f('0x9')](_0x775f('0xd'),auth['isAuthenticated'](),controller[_0x775f('0xe')]);router[_0x775f('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x775f('0xf')]);router[_0x775f('0x9')](_0x775f('0x10'),auth['isAuthenticated'](),controller[_0x775f('0x11')]);router[_0x775f('0x9')]('/:id/applications',auth[_0x775f('0xc')](),controller[_0x775f('0x12')]);router[_0x775f('0x9')](_0x775f('0x13'),auth[_0x775f('0xc')](),controller['getInteractions']);router[_0x775f('0x9')]('/:id/users',auth[_0x775f('0xc')](),controller[_0x775f('0x14')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x775f('0x15')](_0x775f('0x16'),auth[_0x775f('0xc')](),controller['addDisposition']);router[_0x775f('0x15')](_0x775f('0x10'),auth['isAuthenticated'](),controller[_0x775f('0x17')]);router[_0x775f('0x15')]('/:id/notify',controller[_0x775f('0x18')]);router[_0x775f('0x15')](_0x775f('0x19'),auth[_0x775f('0xc')](),controller[_0x775f('0x1a')]);router['post'](_0x775f('0x1b'),auth[_0x775f('0xc')](),controller[_0x775f('0x1c')]);router[_0x775f('0x15')](_0x775f('0x1d'),auth[_0x775f('0xc')](),controller['send']);router['put'](_0x775f('0xd'),auth[_0x775f('0xc')](),controller[_0x775f('0x1e')]);router[_0x775f('0x1f')](_0x775f('0xd'),auth['isAuthenticated'](),controller[_0x775f('0x20')]);router['delete'](_0x775f('0x16'),auth[_0x775f('0xc')](),controller[_0x775f('0x21')]);router[_0x775f('0x1f')](_0x775f('0x10'),auth[_0x775f('0xc')](),controller[_0x775f('0x22')]);router['delete'](_0x775f('0x1b'),auth[_0x775f('0xc')](),controller[_0x775f('0x23')]);module['exports']=router; \ No newline at end of file +var _0xf91e=['removeAnswers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','post','/:id/notify','notify','/:id/applications','addApplications','addAgents','/:id/send','send','put','update','delete'];(function(_0xda7cee,_0x30176e){var _0x5a2680=function(_0x5cb0a6){while(--_0x5cb0a6){_0xda7cee['push'](_0xda7cee['shift']());}};_0x5a2680(++_0x30176e);}(_0xf91e,0x19a));var _0xef91=function(_0x2329db,_0x469a17){_0x2329db=_0x2329db-0x0;var _0x87e030=_0xf91e[_0x2329db];return _0x87e030;};'use strict';var multer=require(_0xef91('0x0'));var util=require(_0xef91('0x1'));var path=require(_0xef91('0x2'));var timeout=require(_0xef91('0x3'));var express=require(_0xef91('0x4'));var router=express[_0xef91('0x5')]();var fs_extra=require(_0xef91('0x6'));var auth=require(_0xef91('0x7'));var interaction=require(_0xef91('0x8'));var config=require(_0xef91('0x9'));var controller=require('./openchannelAccount.controller');router[_0xef91('0xa')]('/',auth[_0xef91('0xb')](),controller['index']);router[_0xef91('0xa')](_0xef91('0xc'),auth['isAuthenticated'](),controller[_0xef91('0xd')]);router[_0xef91('0xa')]('/:id',auth[_0xef91('0xb')](),controller['show']);router[_0xef91('0xa')](_0xef91('0xe'),auth[_0xef91('0xb')](),controller['getDispositions']);router[_0xef91('0xa')](_0xef91('0xf'),auth[_0xef91('0xb')](),controller[_0xef91('0x10')]);router[_0xef91('0xa')]('/:id/applications',auth[_0xef91('0xb')](),controller[_0xef91('0x11')]);router[_0xef91('0xa')](_0xef91('0x12'),auth[_0xef91('0xb')](),controller[_0xef91('0x13')]);router[_0xef91('0xa')](_0xef91('0x14'),auth[_0xef91('0xb')](),controller['getAgents']);router[_0xef91('0x15')]('/',auth[_0xef91('0xb')](),controller['create']);router[_0xef91('0x15')](_0xef91('0xe'),auth[_0xef91('0xb')](),controller['addDisposition']);router[_0xef91('0x15')](_0xef91('0xf'),auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0xef91('0x16'),controller[_0xef91('0x17')]);router['post'](_0xef91('0x18'),auth[_0xef91('0xb')](),controller[_0xef91('0x19')]);router[_0xef91('0x15')]('/:id/users',auth[_0xef91('0xb')](),controller[_0xef91('0x1a')]);router[_0xef91('0x15')](_0xef91('0x1b'),auth[_0xef91('0xb')](),controller[_0xef91('0x1c')]);router[_0xef91('0x1d')]('/:id',auth[_0xef91('0xb')](),controller[_0xef91('0x1e')]);router[_0xef91('0x1f')]('/:id',auth[_0xef91('0xb')](),controller['destroy']);router[_0xef91('0x1f')](_0xef91('0xe'),auth[_0xef91('0xb')](),controller['removeDispositions']);router[_0xef91('0x1f')](_0xef91('0xf'),auth[_0xef91('0xb')](),controller[_0xef91('0x20')]);router['delete']('/:id/users',auth[_0xef91('0xb')](),controller['removeAgents']);module[_0xef91('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 835e6a9..9cea41f 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 _0x88d3=['INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','TEXT'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x88d3,0x132));var _0x388d=function(_0x4ae998,_0x4d3ffb){_0x4ae998=_0x4ae998-0x0;var _0x5f19be=_0x88d3[_0x4ae998];return _0x5f19be;};'use strict';var Sequelize=require(_0x388d('0x0'));var rs=require(_0x388d('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x388d('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x388d('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x388d('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x388d('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x388d('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x388d('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x388d('0x6')},'mandatoryDisposition':{'type':Sequelize[_0x388d('0x5')],'defaultValue':![],'comment':_0x388d('0x7'),'set':function(_0x566d55){if(!_0x566d55)this[_0x388d('0x8')]('mandatoryDispositionPauseId',null);this[_0x388d('0x8')](_0x388d('0x9'),_0x566d55);}}}; \ No newline at end of file +var _0x45ba=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate'];(function(_0x4333cc,_0xca7da9){var _0x5577bc=function(_0x1d2682){while(--_0x1d2682){_0x4333cc['push'](_0x4333cc['shift']());}};_0x5577bc(++_0xca7da9);}(_0x45ba,0x1ba));var _0xa45b=function(_0x544607,_0x19eca2){_0x544607=_0x544607-0x0;var _0x2d91e6=_0x45ba[_0x544607];return _0x2d91e6;};'use strict';var Sequelize=require(_0xa45b('0x0'));var rs=require(_0xa45b('0x1'));module[_0xa45b('0x2')]={'name':{'type':Sequelize[_0xa45b('0x3')],'unique':_0xa45b('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xa45b('0x3')]},'token':{'type':Sequelize[_0xa45b('0x3')],'defaultValue':function(){return rs[_0xa45b('0x5')]();}},'replyUri':{'type':Sequelize[_0xa45b('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xa45b('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa45b('0x6')],'defaultValue':function(){return _0xa45b('0x7');}},'notificationSound':{'type':Sequelize[_0xa45b('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa45b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xa45b('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa45b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa45b('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa45b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa45b('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0xa45b('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xa45b('0x8')],'defaultValue':![],'comment':_0xa45b('0xb'),'set':function(_0x38846a){if(!_0x38846a)this[_0xa45b('0xc')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xa45b('0xd'),_0x38846a);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 464dedb..5aecce6 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 _0x49d4=['show','params','keys','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','order','options','findAll','rows','removeDispositions','ids','CannedAnswer','getAnswers','rawAttributes','nolimit','removeAnswers','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','account','applications','Applications','list','orderBy','priority','asc','contact','firstName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','stack','getApplications','getInteractions','Contact','Owner','fullname','Tag','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','emit','userOpenchannelAccount:remove','getAgents','User','CmList','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','update','get','OpenchannelAccounts','UserProfileResource','destroy','end','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','type','key','model','query','intersection','attributes','fields','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','catch'];(function(_0xd0b7f3,_0x3fea9f){var _0xd21081=function(_0x278faf){while(--_0x278faf){_0xd0b7f3['push'](_0xd0b7f3['shift']());}};_0xd21081(++_0x3fea9f);}(_0x49d4,0x1eb));var _0x449d=function(_0x4c32b9,_0x1e69a0){_0x4c32b9=_0x4c32b9-0x0;var _0x184001=_0x49d4[_0x4c32b9];return _0x184001;};'use strict';var emlformat=require(_0x449d('0x0'));var rimraf=require(_0x449d('0x1'));var zipdir=require(_0x449d('0x2'));var jsonpatch=require(_0x449d('0x3'));var rp=require(_0x449d('0x4'));var moment=require(_0x449d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x449d('0x6'));var csv=require(_0x449d('0x7'));var ejs=require(_0x449d('0x8'));var fs=require('fs');var fs_extra=require(_0x449d('0x9'));var _=require(_0x449d('0xa'));var squel=require(_0x449d('0xb'));var crypto=require(_0x449d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x449d('0xd'));var toCsv=require(_0x449d('0x7'));var querystring=require(_0x449d('0xe'));var Papa=require(_0x449d('0xf'));var Redis=require(_0x449d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x449d('0x11'));var as=require(_0x449d('0x12'));var hardwareService=require(_0x449d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x449d('0x14'));var config=require(_0x449d('0x15'));var licenseUtil=require(_0x449d('0x16'));var db=require('../../mysqldb')['db'];config[_0x449d('0x17')]=_[_0x449d('0x18')](config[_0x449d('0x17')],{'host':_0x449d('0x19'),'port':0x18eb});var socket=require(_0x449d('0x1a'))(new Redis(config[_0x449d('0x17')]));require(_0x449d('0x1b'))[_0x449d('0x1c')](socket);var jayson=require(_0x449d('0x1d'));var client=jayson['client'][_0x449d('0x1e')]({'port':0x232c});var client9002=jayson[_0x449d('0x1f')][_0x449d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3c5a6f,_0x113e73,_0x37aad8,_0x3313fc){return new BPromise(function(_0x126824,_0x26bce3){var _0x125ec4=_0x3313fc||client;return _0x125ec4[_0x449d('0x20')](_0x3c5a6f,_0x37aad8)[_0x449d('0x21')](function(_0x22011a){logger[_0x449d('0x22')](_0x449d('0x23'),_0x113e73,'request\x20sent');logger[_0x449d('0x24')](_0x449d('0x25'),_0x113e73,_0x449d('0x26'),JSON[_0x449d('0x27')](_0x22011a));if(_0x22011a[_0x449d('0x28')]){if(_0x22011a[_0x449d('0x28')][_0x449d('0x29')]===0x1f4){logger[_0x449d('0x28')](_0x449d('0x23'),_0x113e73,_0x22011a[_0x449d('0x28')][_0x449d('0x2a')]);return _0x26bce3(_0x22011a[_0x449d('0x28')][_0x449d('0x2a')]);}logger[_0x449d('0x28')](_0x449d('0x23'),_0x113e73,_0x22011a[_0x449d('0x28')]['message']);return _0x126824(_0x22011a[_0x449d('0x28')][_0x449d('0x2a')]);}else{logger['info'](_0x449d('0x23'),_0x113e73,_0x449d('0x26'));_0x126824(_0x22011a[_0x449d('0x2b')][_0x449d('0x2a')]);}})['catch'](function(_0x2e7b45){logger[_0x449d('0x28')](_0x449d('0x23'),_0x113e73,_0x2e7b45);_0x26bce3(_0x2e7b45);});});}function respondWithStatusCode(_0x1ee3a3,_0x4126a3){_0x4126a3=_0x4126a3||0xcc;return function(_0x5a077d){if(_0x5a077d){return _0x1ee3a3[_0x449d('0x2c')](_0x4126a3);}return _0x1ee3a3[_0x449d('0x2d')](_0x4126a3)['end']();};}function respondWithResult(_0x40307f,_0x3dd2e5){_0x3dd2e5=_0x3dd2e5||0xc8;return function(_0x33f848){if(_0x33f848){return _0x40307f[_0x449d('0x2d')](_0x3dd2e5)[_0x449d('0x2e')](_0x33f848);}};}function respondWithFilteredResult(_0x4f635c,_0x145539){return function(_0x63089f){if(_0x63089f){var _0x2a5a8f=typeof _0x145539[_0x449d('0x2f')]===_0x449d('0x30')&&typeof _0x145539[_0x449d('0x31')]===_0x449d('0x30');var _0x3b3f43=_0x63089f['count'];var _0x786fa9=_0x2a5a8f?0x0:_0x145539['offset'];var _0x100f06=_0x2a5a8f?_0x63089f['count']:_0x145539[_0x449d('0x2f')]+_0x145539[_0x449d('0x31')];var _0x1816ca;if(_0x100f06>=_0x3b3f43){_0x100f06=_0x3b3f43;_0x1816ca=0xc8;}else{_0x1816ca=0xce;}_0x4f635c[_0x449d('0x2d')](_0x1816ca);return _0x4f635c[_0x449d('0x32')](_0x449d('0x33'),_0x786fa9+'-'+_0x100f06+'/'+_0x3b3f43)[_0x449d('0x2e')](_0x63089f);}return null;};}function patchUpdates(_0x56537f){return function(_0x17b857){try{jsonpatch[_0x449d('0x34')](_0x17b857,_0x56537f,!![]);}catch(_0x3f9462){return BPromise['reject'](_0x3f9462);}return _0x17b857['save']();};}function saveUpdates(_0x230dd0,_0x2f3cbb){return function(_0x53366f){if(_0x53366f){return _0x53366f[_0x449d('0x35')](_0x230dd0)[_0x449d('0x21')](function(_0x503694){return _0x503694;});}return null;};}function removeEntity(_0x3711b4,_0x16b6cd){return function(_0x34e9a0){if(_0x34e9a0){return _0x34e9a0['destroy']()[_0x449d('0x21')](function(){var _0x57ffcc=_0x34e9a0[_0x449d('0x36')]({'plain':!![]});var _0x4e5ff5=_0x449d('0x37');return db[_0x449d('0x38')][_0x449d('0x39')]({'where':{'type':_0x4e5ff5,'resourceId':_0x57ffcc['id']}})[_0x449d('0x21')](function(){return _0x34e9a0;});})[_0x449d('0x21')](function(){_0x3711b4[_0x449d('0x2d')](0xcc)[_0x449d('0x3a')]();});}};}function handleEntityNotFound(_0x5c4753,_0x5df5bd){return function(_0x5e0c3e){if(!_0x5e0c3e){_0x5c4753[_0x449d('0x2c')](0x194);}return _0x5e0c3e;};}function handleError(_0x438955,_0x52d795){_0x52d795=_0x52d795||0x1f4;return function(_0x1b68df){logger['error'](_0x1b68df['stack']);if(_0x1b68df['name']){delete _0x1b68df[_0x449d('0x3b')];}_0x438955[_0x449d('0x2d')](_0x52d795)[_0x449d('0x3c')](_0x1b68df);};}exports[_0x449d('0x3d')]=function(_0x55e8e1,_0x68dae2){var _0x3e66ed={'include':[{'model':db[_0x449d('0x3e')],'as':_0x449d('0x3f')}]},_0x3905d2={},_0x4d87c0={'count':0x0,'rows':[]};var _0x50568d=_[_0x449d('0x40')](db[_0x449d('0x41')]['rawAttributes'],function(_0x1b1c82){return{'name':_0x1b1c82[_0x449d('0x42')],'type':_0x1b1c82[_0x449d('0x43')][_0x449d('0x44')]};});_0x3905d2[_0x449d('0x45')]=_[_0x449d('0x40')](_0x50568d,_0x449d('0x3b'));_0x3905d2[_0x449d('0x46')]=_['keys'](_0x55e8e1[_0x449d('0x46')]);_0x3905d2['filters']=_[_0x449d('0x47')](_0x3905d2[_0x449d('0x45')],_0x3905d2[_0x449d('0x46')]);_0x3e66ed[_0x449d('0x48')]=_[_0x449d('0x47')](_0x3905d2[_0x449d('0x45')],qs[_0x449d('0x49')](_0x55e8e1[_0x449d('0x46')]['fields']));_0x3e66ed[_0x449d('0x48')]=_0x3e66ed[_0x449d('0x48')]['length']?_0x3e66ed[_0x449d('0x48')]:_0x3905d2[_0x449d('0x45')];if(!_0x55e8e1['query']['hasOwnProperty']('nolimit')){_0x3e66ed['limit']=qs[_0x449d('0x31')](_0x55e8e1[_0x449d('0x46')][_0x449d('0x31')]);_0x3e66ed[_0x449d('0x2f')]=qs[_0x449d('0x2f')](_0x55e8e1[_0x449d('0x46')][_0x449d('0x2f')]);}_0x3e66ed['order']=qs[_0x449d('0x4a')](_0x55e8e1[_0x449d('0x46')][_0x449d('0x4a')]);_0x3e66ed[_0x449d('0x4b')]=qs[_0x449d('0x4c')](_[_0x449d('0x4d')](_0x55e8e1['query'],_0x3905d2[_0x449d('0x4c')]),_0x50568d);if(_0x55e8e1[_0x449d('0x46')][_0x449d('0x4e')]){_0x3e66ed[_0x449d('0x4b')]=_[_0x449d('0x4f')](_0x3e66ed[_0x449d('0x4b')],{'$or':_['map'](_0x50568d,function(_0x4ceff5){if(_0x4ceff5[_0x449d('0x43')]!==_0x449d('0x50')){var _0x29dd6b={};_0x29dd6b[_0x4ceff5[_0x449d('0x3b')]]={'$like':'%'+_0x55e8e1[_0x449d('0x46')][_0x449d('0x4e')]+'%'};return _0x29dd6b;}})});}_0x3e66ed=_[_0x449d('0x4f')]({},_0x3e66ed,_0x55e8e1['options']);var _0x2d3ec9={'where':_0x3e66ed[_0x449d('0x4b')]};return db[_0x449d('0x41')][_0x449d('0x51')](_0x2d3ec9)['then'](function(_0x2b71f6){_0x4d87c0[_0x449d('0x51')]=_0x2b71f6;if(_0x55e8e1[_0x449d('0x46')][_0x449d('0x52')]){_0x3e66ed[_0x449d('0x53')]=[{'all':!![]}];}return db[_0x449d('0x41')]['findAll'](_0x3e66ed);})[_0x449d('0x21')](function(_0x23d11d){_0x4d87c0['rows']=_0x23d11d;return _0x4d87c0;})['then'](respondWithFilteredResult(_0x68dae2,_0x3e66ed))[_0x449d('0x54')](handleError(_0x68dae2,null));};exports[_0x449d('0x55')]=function(_0x4e3156,_0x1880bf){var _0x3a4127={'raw':![],'where':{'id':_0x4e3156[_0x449d('0x56')]['id']},'include':[{'model':db[_0x449d('0x3e')],'as':_0x449d('0x3f')}]},_0xa147df={};_0xa147df[_0x449d('0x45')]=_[_0x449d('0x57')](db[_0x449d('0x41')]['rawAttributes']);_0xa147df['query']=_['keys'](_0x4e3156['query']);_0xa147df[_0x449d('0x4c')]=_['intersection'](_0xa147df['model'],_0xa147df[_0x449d('0x46')]);_0x3a4127['attributes']=_[_0x449d('0x47')](_0xa147df[_0x449d('0x45')],qs[_0x449d('0x49')](_0x4e3156['query'][_0x449d('0x49')]));_0x3a4127['attributes']=_0x3a4127[_0x449d('0x48')][_0x449d('0x58')]?_0x3a4127[_0x449d('0x48')]:_0xa147df['model'];if(_0x4e3156[_0x449d('0x46')][_0x449d('0x52')]){_0x3a4127[_0x449d('0x53')]=[{'all':!![]}];}_0x3a4127=_[_0x449d('0x4f')]({},_0x3a4127,_0x4e3156['options']);return db[_0x449d('0x41')]['find'](_0x3a4127)[_0x449d('0x21')](handleEntityNotFound(_0x1880bf,null))['then'](respondWithResult(_0x1880bf,null))[_0x449d('0x54')](handleError(_0x1880bf,null));};exports[_0x449d('0x59')]=function(_0x56b2cc,_0x2c951e){return db[_0x449d('0x41')]['create'](_0x56b2cc[_0x449d('0x5a')],{})[_0x449d('0x21')](function(_0x528f4b){var _0x58f576=_0x56b2cc[_0x449d('0x5b')][_0x449d('0x36')]({'plain':!![]});if(!_0x58f576)throw new Error(_0x449d('0x5c'));if(_0x58f576[_0x449d('0x5d')]===_0x449d('0x5b')){var _0x4f8f01=_0x528f4b[_0x449d('0x36')]({'plain':!![]});var _0x1d128e=_0x449d('0x37');return db['UserProfileSection'][_0x449d('0x5e')]({'where':{'name':_0x1d128e,'userProfileId':_0x58f576[_0x449d('0x5f')]},'raw':!![]})[_0x449d('0x21')](function(_0x44af5c){if(_0x44af5c&&_0x44af5c['autoAssociation']===0x0){return db[_0x449d('0x38')][_0x449d('0x59')]({'name':_0x4f8f01['name'],'resourceId':_0x4f8f01['id'],'type':_0x44af5c[_0x449d('0x3b')],'sectionId':_0x44af5c['id']},{})[_0x449d('0x21')](function(){return _0x528f4b;});}else{return _0x528f4b;}})[_0x449d('0x54')](function(_0x248555){logger['error'](_0x449d('0x60'),_0x248555);throw _0x248555;});}return _0x528f4b;})[_0x449d('0x21')](respondWithResult(_0x2c951e,0xc9))[_0x449d('0x54')](handleError(_0x2c951e,null));};exports[_0x449d('0x35')]=function(_0x10632d,_0x545596){if(_0x10632d[_0x449d('0x5a')]['id']){delete _0x10632d[_0x449d('0x5a')]['id'];}return db[_0x449d('0x41')]['find']({'where':{'id':_0x10632d[_0x449d('0x56')]['id']},'include':[{'model':db[_0x449d('0x3e')],'as':_0x449d('0x3f')}]})[_0x449d('0x21')](handleEntityNotFound(_0x545596,null))[_0x449d('0x21')](saveUpdates(_0x10632d[_0x449d('0x5a')],null))[_0x449d('0x21')](respondWithResult(_0x545596,null))[_0x449d('0x54')](handleError(_0x545596,null));};exports[_0x449d('0x39')]=function(_0x1ea246,_0x8c7f9){return db[_0x449d('0x41')][_0x449d('0x5e')]({'where':{'id':_0x1ea246[_0x449d('0x56')]['id']}})['then'](handleEntityNotFound(_0x8c7f9,null))[_0x449d('0x21')](removeEntity(_0x8c7f9,null))[_0x449d('0x54')](handleError(_0x8c7f9,null));};exports[_0x449d('0x61')]=function(_0x2285b5,_0x46340e){return db[_0x449d('0x41')]['describe']()[_0x449d('0x21')](respondWithResult(_0x46340e,null))[_0x449d('0x54')](handleError(_0x46340e,null));};exports[_0x449d('0x62')]=function(_0x102d2,_0x515afd,_0x4d8c48){if(_0x102d2['body']['id']){delete _0x102d2[_0x449d('0x5a')]['id'];}return db['OpenchannelAccount'][_0x449d('0x5e')]({'where':{'id':_0x102d2[_0x449d('0x56')]['id']}})['then'](handleEntityNotFound(_0x515afd,null))[_0x449d('0x21')](function(_0x578c14){if(_0x578c14){_0x102d2[_0x449d('0x5a')][_0x449d('0x63')]=_0x578c14['id'];return db[_0x449d('0x64')][_0x449d('0x59')](_0x102d2['body']);}})['then'](respondWithResult(_0x515afd,null))[_0x449d('0x54')](handleError(_0x515afd,null));};exports[_0x449d('0x65')]=function(_0x5c3152,_0xdd456a,_0x83d078){var _0x2ba6bd={'raw':![],'where':{}};var _0x4e180f={};var _0x1db7ed={'count':0x0,'rows':[]};return db[_0x449d('0x41')][_0x449d('0x66')]({'where':{'id':_0x5c3152['params']['id']}})[_0x449d('0x21')](handleEntityNotFound(_0xdd456a,null))[_0x449d('0x21')](function(_0x206baa){if(_0x206baa){_0x4e180f[_0x449d('0x45')]=_[_0x449d('0x57')](db[_0x449d('0x64')]['rawAttributes']);_0x4e180f[_0x449d('0x46')]=_[_0x449d('0x57')](_0x5c3152[_0x449d('0x46')]);_0x4e180f['filters']=_[_0x449d('0x47')](_0x4e180f['model'],_0x4e180f[_0x449d('0x46')]);_0x2ba6bd['attributes']=_[_0x449d('0x47')](_0x4e180f[_0x449d('0x45')],qs[_0x449d('0x49')](_0x5c3152[_0x449d('0x46')][_0x449d('0x49')]));_0x2ba6bd[_0x449d('0x48')]=_0x2ba6bd[_0x449d('0x48')][_0x449d('0x58')]?_0x2ba6bd[_0x449d('0x48')]:_0x4e180f[_0x449d('0x45')];if(!_0x5c3152['query'][_0x449d('0x67')]('nolimit')){_0x2ba6bd[_0x449d('0x31')]=qs['limit'](_0x5c3152[_0x449d('0x46')][_0x449d('0x31')]);_0x2ba6bd[_0x449d('0x2f')]=qs[_0x449d('0x2f')](_0x5c3152[_0x449d('0x46')][_0x449d('0x2f')]);}_0x2ba6bd[_0x449d('0x68')]=qs[_0x449d('0x4a')](_0x5c3152['query'][_0x449d('0x4a')]);_0x2ba6bd[_0x449d('0x4b')]=qs[_0x449d('0x4c')](_[_0x449d('0x4d')](_0x5c3152[_0x449d('0x46')],_0x4e180f[_0x449d('0x4c')]));_0x2ba6bd['where'][_0x449d('0x63')]=_0x206baa['id'];if(_0x5c3152[_0x449d('0x46')][_0x449d('0x4e')]){_0x2ba6bd[_0x449d('0x4b')]=_[_0x449d('0x4f')](_0x2ba6bd['where'],{'$or':_[_0x449d('0x40')](_0x2ba6bd[_0x449d('0x48')],function(_0x43fd4c){var _0x3144b5={};_0x3144b5[_0x43fd4c]={'$like':'%'+_0x5c3152[_0x449d('0x46')][_0x449d('0x4e')]+'%'};return _0x3144b5;})});}_0x2ba6bd=_[_0x449d('0x4f')]({},_0x2ba6bd,_0x5c3152[_0x449d('0x69')]);return db['Disposition'][_0x449d('0x51')]({'where':_0x2ba6bd[_0x449d('0x4b')]})['then'](function(_0xcaee80){_0x1db7ed[_0x449d('0x51')]=_0xcaee80;if(_0x5c3152[_0x449d('0x46')][_0x449d('0x52')]){_0x2ba6bd[_0x449d('0x53')]=[{'all':!![]}];}return db[_0x449d('0x64')][_0x449d('0x6a')](_0x2ba6bd);})[_0x449d('0x21')](function(_0x9566){_0x1db7ed[_0x449d('0x6b')]=_0x9566;return _0x1db7ed;});}})[_0x449d('0x21')](respondWithFilteredResult(_0xdd456a,_0x2ba6bd))[_0x449d('0x54')](handleError(_0xdd456a,null));};exports['removeDispositions']=function(_0xccd6c7,_0x41f895,_0x495e33){return db['OpenchannelAccount'][_0x449d('0x5e')]({'where':{'id':_0xccd6c7[_0x449d('0x56')]['id']}})[_0x449d('0x21')](handleEntityNotFound(_0x41f895,null))[_0x449d('0x21')](function(_0x40dae1){if(_0x40dae1){return _0x40dae1[_0x449d('0x6c')](_0xccd6c7[_0x449d('0x46')][_0x449d('0x6d')]);}})[_0x449d('0x21')](respondWithStatusCode(_0x41f895,null))['catch'](handleError(_0x41f895,null));};exports['addAnswer']=function(_0x4e78d4,_0x4c2ee4,_0xeffa28){if(_0x4e78d4[_0x449d('0x5a')]['id']){delete _0x4e78d4['body']['id'];}return db[_0x449d('0x41')][_0x449d('0x5e')]({'where':{'id':_0x4e78d4['params']['id']}})[_0x449d('0x21')](handleEntityNotFound(_0x4c2ee4,null))[_0x449d('0x21')](function(_0x3a6cbf){if(_0x3a6cbf){_0x4e78d4[_0x449d('0x5a')]['OpenchannelAccountId']=_0x3a6cbf['id'];return db[_0x449d('0x6e')][_0x449d('0x59')](_0x4e78d4[_0x449d('0x5a')]);}})['then'](respondWithResult(_0x4c2ee4,null))[_0x449d('0x54')](handleError(_0x4c2ee4,null));};exports[_0x449d('0x6f')]=function(_0x1e6df9,_0x5b86fc,_0x46e68b){var _0x32315a={'raw':![],'where':{}};var _0x480935={};var _0x8ecb84={'count':0x0,'rows':[]};return db[_0x449d('0x41')][_0x449d('0x66')]({'where':{'id':_0x1e6df9[_0x449d('0x56')]['id']}})[_0x449d('0x21')](handleEntityNotFound(_0x5b86fc,null))[_0x449d('0x21')](function(_0x46e011){if(_0x46e011){_0x480935[_0x449d('0x45')]=_[_0x449d('0x57')](db[_0x449d('0x6e')][_0x449d('0x70')]);_0x480935[_0x449d('0x46')]=_[_0x449d('0x57')](_0x1e6df9['query']);_0x480935[_0x449d('0x4c')]=_[_0x449d('0x47')](_0x480935[_0x449d('0x45')],_0x480935[_0x449d('0x46')]);_0x32315a[_0x449d('0x48')]=_[_0x449d('0x47')](_0x480935['model'],qs[_0x449d('0x49')](_0x1e6df9[_0x449d('0x46')]['fields']));_0x32315a[_0x449d('0x48')]=_0x32315a[_0x449d('0x48')][_0x449d('0x58')]?_0x32315a['attributes']:_0x480935[_0x449d('0x45')];if(!_0x1e6df9[_0x449d('0x46')][_0x449d('0x67')](_0x449d('0x71'))){_0x32315a[_0x449d('0x31')]=qs[_0x449d('0x31')](_0x1e6df9[_0x449d('0x46')]['limit']);_0x32315a[_0x449d('0x2f')]=qs[_0x449d('0x2f')](_0x1e6df9[_0x449d('0x46')][_0x449d('0x2f')]);}_0x32315a[_0x449d('0x68')]=qs[_0x449d('0x4a')](_0x1e6df9[_0x449d('0x46')][_0x449d('0x4a')]);_0x32315a[_0x449d('0x4b')]=qs[_0x449d('0x4c')](_[_0x449d('0x4d')](_0x1e6df9[_0x449d('0x46')],_0x480935[_0x449d('0x4c')]));_0x32315a[_0x449d('0x4b')]['OpenchannelAccountId']=_0x46e011['id'];if(_0x1e6df9[_0x449d('0x46')][_0x449d('0x4e')]){_0x32315a[_0x449d('0x4b')]=_['merge'](_0x32315a[_0x449d('0x4b')],{'$or':_[_0x449d('0x40')](_0x32315a[_0x449d('0x48')],function(_0x207b3b){var _0x2c1d1e={};_0x2c1d1e[_0x207b3b]={'$like':'%'+_0x1e6df9[_0x449d('0x46')][_0x449d('0x4e')]+'%'};return _0x2c1d1e;})});}_0x32315a=_['merge']({},_0x32315a,_0x1e6df9['options']);return db[_0x449d('0x6e')][_0x449d('0x51')]({'where':_0x32315a[_0x449d('0x4b')]})[_0x449d('0x21')](function(_0x4ba7a2){_0x8ecb84['count']=_0x4ba7a2;if(_0x1e6df9[_0x449d('0x46')][_0x449d('0x52')]){_0x32315a[_0x449d('0x53')]=[{'all':!![]}];}return db[_0x449d('0x6e')][_0x449d('0x6a')](_0x32315a);})[_0x449d('0x21')](function(_0xa63b56){_0x8ecb84[_0x449d('0x6b')]=_0xa63b56;return _0x8ecb84;});}})[_0x449d('0x21')](respondWithFilteredResult(_0x5b86fc,_0x32315a))['catch'](handleError(_0x5b86fc,null));};exports[_0x449d('0x72')]=function(_0x557985,_0x2e3076,_0x2b9100){return db[_0x449d('0x41')][_0x449d('0x5e')]({'where':{'id':_0x557985['params']['id']}})[_0x449d('0x21')](handleEntityNotFound(_0x2e3076,null))[_0x449d('0x21')](function(_0x29d8af){if(_0x29d8af){return _0x29d8af[_0x449d('0x72')](_0x557985[_0x449d('0x46')][_0x449d('0x6d')]);}})['then'](respondWithStatusCode(_0x2e3076,null))['catch'](handleError(_0x2e3076,null));};exports[_0x449d('0x73')]=function(_0x23dae6,_0x44f9bd,_0x442f3a){var _0x36b45f={'body':_0x23dae6[_0x449d('0x5a')],'channel':'openchannel'};var _0x3c98b5=[];var _0x3773c0=[];var _0x2a6290={};var _0x7804b4=![];return db[_0x449d('0x74')][_0x449d('0x61')]()['then'](function(_0x1fa14e){if(!_0x1fa14e){throw new db[(_0x449d('0x75'))][(_0x449d('0x76'))](_0x449d('0x77'));}_0x3c98b5=_['difference'](_[_0x449d('0x57')](_0x1fa14e),['createdAt','updatedAt']);_0x3773c0=_[_0x449d('0x78')](_[_0x449d('0x57')](_0x1fa14e),[_0x449d('0x79'),_0x449d('0x7a'),_0x449d('0x7b'),_0x449d('0x7c')]);if(_0x23dae6[_0x449d('0x5a')]['id']){delete _0x23dae6['body']['id'];}if(_[_0x449d('0x7d')](_0x23dae6[_0x449d('0x5a')][_0x449d('0x7e')])){throw new db[(_0x449d('0x75'))][(_0x449d('0x76'))](_0x449d('0x7f'));}if(_['isNil'](_0x23dae6[_0x449d('0x5a')][_0x449d('0x5a')])||_0x23dae6['body'][_0x449d('0x5a')]===''){throw new db['Sequelize'][(_0x449d('0x76'))](_0x449d('0x80'));}if(_[_0x449d('0x7d')](_0x23dae6[_0x449d('0x5a')][_0x449d('0x81')])){throw new db[(_0x449d('0x75'))][(_0x449d('0x76'))](_0x449d('0x82')+_0x3773c0);}if(!_['includes'](_0x3773c0,_0x23dae6[_0x449d('0x5a')][_0x449d('0x81')])){throw new db[(_0x449d('0x75'))][(_0x449d('0x76'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3773c0);}_0x2a6290[_0x23dae6['body'][_0x449d('0x81')]]=_0x23dae6[_0x449d('0x5a')]['from'];})[_0x449d('0x21')](function(){return db[_0x449d('0x41')]['find']({'where':{'id':_0x23dae6['params']['id']},'include':[{'model':db['CmList'],'as':_0x449d('0x83'),'include':[{'model':db[_0x449d('0x74')],'as':_0x449d('0x84'),'where':_0x2a6290,'limit':0x1,'order':[[_0x449d('0x7a'),_0x449d('0x85')]]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x44f9bd,null))[_0x449d('0x21')](function(_0x1c1b31){if(_0x1c1b31&&_0x1c1b31[_0x449d('0x83')]){_0x36b45f[_0x449d('0x86')]=_0x1c1b31;_0x36b45f[_0x449d('0x87')]=_0x1c1b31[_0x449d('0x88')];_0x36b45f[_0x449d('0x89')]=_0x1c1b31['List'];_0x36b45f[_0x449d('0x87')]=_[_0x449d('0x8a')](_0x36b45f['applications'],[_0x449d('0x8b')],[_0x449d('0x8c')]);if(_0x36b45f[_0x449d('0x86')][_0x449d('0x88')]){delete _0x36b45f[_0x449d('0x86')][_0x449d('0x88')];}if(_0x36b45f['account'][_0x449d('0x83')]&&_0x36b45f[_0x449d('0x86')][_0x449d('0x83')][_0x449d('0x84')][_0x449d('0x58')]){return _0x36b45f[_0x449d('0x86')][_0x449d('0x83')][_0x449d('0x84')][0x0];}var _0x2221dd=_['defaults'](_0x23dae6['body'],{'firstName':_0x23dae6[_0x449d('0x5a')]['from'],'ListId':_0x1c1b31['ListId']});_0x2221dd[_0x23dae6[_0x449d('0x5a')][_0x449d('0x81')]]=_0x23dae6[_0x449d('0x5a')]['from'];return db['CmContact'][_0x449d('0x59')](_0x2221dd,{'fields':_0x3c98b5,'raw':!![]});}})['then'](handleEntityNotFound(_0x44f9bd,null))[_0x449d('0x21')](function(_0x467340){_0x36b45f[_0x449d('0x8d')]=_0x467340;if(_0x467340){var _0xcfea4d={'ContactId':_0x467340['id'],'OpenchannelAccountId':_0x23dae6[_0x449d('0x56')]['id'],'from':(_0x467340[_0x449d('0x8e')]||'')+'\x20'+(_0x467340['lastName']||'')};var _0x357f3f={'OpenchannelAccountId':_0x23dae6['params']['id'],'closed':![]};if(_0x23dae6['body'][_0x449d('0x8f')]){_0x357f3f[_0x449d('0x8f')]=_0x23dae6[_0x449d('0x5a')][_0x449d('0x8f')];return db[_0x449d('0x90')][_0x449d('0x5e')]({'where':_0x357f3f})[_0x449d('0x21')](function(_0x216a85){if(_0x216a85){return[_0x216a85,![]];}_0xcfea4d[_0x449d('0x8f')]=_0x23dae6['body'][_0x449d('0x8f')];_0xcfea4d[_0x449d('0x91')]=_0x23dae6[_0x449d('0x5a')][_0x449d('0x91')];return db[_0x449d('0x90')][_0x449d('0x59')](_0xcfea4d)[_0x449d('0x21')](function(_0x27cbd9){return[_0x27cbd9,!![]];});});}else{_0x357f3f[_0x449d('0x8f')]=null;}_0x357f3f['ContactId']=_0x467340['id'];return db[_0x449d('0x90')][_0x449d('0x5e')]({'where':_0x357f3f})['then'](function(_0x4172e2){if(_0x4172e2){return[_0x4172e2,![]];}return db['OpenchannelInteraction']['create'](_0xcfea4d)[_0x449d('0x21')](function(_0x5065f0){return[_0x5065f0,!![]];});});}})[_0x449d('0x92')](function(_0x33cb2c,_0x49788d){if(_0x33cb2c){_0x7804b4=_0x49788d;if(!_0x49788d){var _0x15cf07={'from':(_0x36b45f[_0x449d('0x8d')][_0x449d('0x8e')]||'')+'\x20'+(_0x36b45f[_0x449d('0x8d')]['lastName']||'')};if(_0x23dae6[_0x449d('0x5a')][_0x449d('0x8f')]&&_0x23dae6['body'][_0x449d('0x93')]&&_0x23dae6[_0x449d('0x5a')][_0x449d('0x8f')]!=_0x23dae6['body']['messageId']){_0x15cf07['threadId']=_0x23dae6[_0x449d('0x5a')]['messageId'];}return _0x33cb2c[_0x449d('0x35')](_0x15cf07);}else{return _0x33cb2c;}}})['then'](function(_0x2e4ace){_0x36b45f[_0x449d('0x94')]=_0x2e4ace[_0x449d('0x36')]({'plain':!![]});_0x36b45f[_0x449d('0x94')][_0x449d('0x95')]=_0x7804b4;if(_0x36b45f[_0x449d('0x94')][_0x449d('0x95')]){if(_0x36b45f[_0x449d('0x86')][_0x449d('0x96')]){_0x36b45f[_0x449d('0x87')]['push']({'id':0x0,'priority':_0x36b45f[_0x449d('0x87')]['length']+0x1,'app':_0x449d('0x97'),'appdata':_0x449d('0x98'),'interval':_0x449d('0x99')});}}return db[_0x449d('0x9a')][_0x449d('0x59')]({'body':_0x23dae6[_0x449d('0x5a')][_0x449d('0x5a')],'OpenchannelAccountId':_0x23dae6[_0x449d('0x56')]['id'],'OpenchannelInteractionId':_0x2e4ace['id'],'direction':'in','ContactId':_0x36b45f[_0x449d('0x8d')]['id'],'AttachmentId':_0x23dae6['body'][_0x449d('0x9b')]});})['then'](function(_0x55ad9a){_0x36b45f[_0x449d('0x2a')]=_0x55ad9a;if(_0x36b45f[_0x449d('0x94')][_0x449d('0x9c')]){return db['User'][_0x449d('0x5e')]({'attributes':['id','name'],'where':{'id':_0x36b45f[_0x449d('0x94')][_0x449d('0x9c')]}})[_0x449d('0x21')](function(_0x23d59b){if(_0x23d59b){_0x36b45f[_0x449d('0x87')][_0x449d('0x9d')]({'id':0x0,'priority':0x0,'app':_0x449d('0x9e'),'appdata':_0x23d59b[_0x449d('0x3b')]+','+(_0x36b45f['account'][_0x449d('0x9f')]||0xa),'interval':_0x449d('0x99')});_0x36b45f[_0x449d('0xa0')]=![];}return respondWithRpcPromise(_0x449d('0xa1'),_0x449d('0xa2'),_0x36b45f);});}return respondWithRpcPromise('Start',_0x449d('0xa2'),_0x36b45f);})[_0x449d('0x21')](function(_0x2a2458){respondWithRpcPromise(_0x449d('0xa3'),_0x449d('0xa3'),{'event':'notify','message':_0x2a2458},client9002);return _0x2a2458;})[_0x449d('0x21')](respondWithResult(_0x44f9bd,null))['catch'](handleError(_0x44f9bd,null));};exports['addApplications']=function(_0x347e1f,_0x2fb2ac){var _0x11c58f=_0x347e1f[_0x449d('0x56')]['id'];var _0x57f74e=_0x347e1f['body'];var _0x2671f9=0xc8;var _0x153181=null;return db[_0x449d('0xa4')][_0x449d('0xa5')]({'isolationLevel':db['sequelize'][_0x449d('0xa6')][_0x449d('0xa7')][_0x449d('0xa8')]},function(_0x4ebc8e){return db[_0x449d('0x41')][_0x449d('0x66')]({'where':{'id':_0x11c58f},'transaction':_0x4ebc8e})[_0x449d('0x21')](function(_0x58fbbc){if(_0x58fbbc){return db[_0x449d('0xa9')][_0x449d('0x39')]({'where':{'OpenchannelAccountId':_0x11c58f},'transaction':_0x4ebc8e})[_0x449d('0x21')](function(){var _0x47d540=_[_0x449d('0x40')](_0x57f74e,function(_0x15d14d){_0x15d14d[_0x449d('0x63')]=_0x11c58f;return _0x15d14d;});return db[_0x449d('0xa9')][_0x449d('0xaa')](_0x47d540,{'transaction':_0x4ebc8e});});}else{_0x2671f9=0x194;_0x153181=[];}});})[_0x449d('0x21')](function(){if(_0x2671f9!==0x194){return db[_0x449d('0xa9')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x11c58f},'order':_0x449d('0x8b')})[_0x449d('0x21')](function(_0x1f4159){_0x153181=_0x1f4159;});}})[_0x449d('0x54')](function(_0x33f4ae){_0x2671f9=0x1f4;logger['error'](_0x33f4ae[_0x449d('0xab')]);if(_0x33f4ae[_0x449d('0x3b')]){delete _0x33f4ae[_0x449d('0x3b')];}_0x153181=_0x33f4ae;})['finally'](function(){if(_0x153181===null){_0x2fb2ac[_0x449d('0x2c')](_0x2671f9);}else{if(_0x2671f9===0x1f4){_0x2fb2ac['status'](_0x2671f9)[_0x449d('0x3c')](_0x153181);}else{_0x2fb2ac[_0x449d('0x2d')](_0x2671f9)[_0x449d('0x2e')](_0x153181);}}});};exports[_0x449d('0xac')]=function(_0x5b5c0b,_0x9df76,_0x1dfd6b){var _0x56ac5a={};var _0x390a52={};var _0x51b259;var _0x5ad6f1;return db['OpenchannelAccount'][_0x449d('0x66')]({'where':{'id':_0x5b5c0b['params']['id']}})['then'](handleEntityNotFound(_0x9df76,null))[_0x449d('0x21')](function(_0x1c10ed){if(_0x1c10ed){_0x51b259=_0x1c10ed;_0x390a52[_0x449d('0x45')]=_[_0x449d('0x57')](db[_0x449d('0xa9')][_0x449d('0x70')]);_0x390a52[_0x449d('0x46')]=_[_0x449d('0x57')](_0x5b5c0b['query']);_0x390a52[_0x449d('0x4c')]=_['intersection'](_0x390a52[_0x449d('0x45')],_0x390a52['query']);_0x56ac5a[_0x449d('0x48')]=_[_0x449d('0x47')](_0x390a52[_0x449d('0x45')],qs[_0x449d('0x49')](_0x5b5c0b[_0x449d('0x46')][_0x449d('0x49')]));_0x56ac5a[_0x449d('0x48')]=_0x56ac5a[_0x449d('0x48')][_0x449d('0x58')]?_0x56ac5a[_0x449d('0x48')]:_0x390a52[_0x449d('0x45')];_0x56ac5a[_0x449d('0x68')]=qs[_0x449d('0x4a')](_0x5b5c0b[_0x449d('0x46')][_0x449d('0x4a')]);_0x56ac5a[_0x449d('0x4b')]=qs['filters'](_['pick'](_0x5b5c0b[_0x449d('0x46')],_0x390a52[_0x449d('0x4c')]));if(_0x5b5c0b[_0x449d('0x46')]['filter']){_0x56ac5a[_0x449d('0x4b')]=_['merge'](_0x56ac5a[_0x449d('0x4b')],{'$or':_[_0x449d('0x40')](_0x56ac5a['attributes'],function(_0x58d588){var _0x54dffb={};_0x54dffb[_0x58d588]={'$like':'%'+_0x5b5c0b['query'][_0x449d('0x4e')]+'%'};return _0x54dffb;})});}_0x56ac5a=_[_0x449d('0x4f')]({},_0x56ac5a,_0x5b5c0b[_0x449d('0x69')]);return _0x51b259[_0x449d('0xac')](_0x56ac5a);}})[_0x449d('0x21')](function(_0x1590e9){if(_0x1590e9){_0x5ad6f1=_0x1590e9[_0x449d('0x58')];if(!_0x5b5c0b[_0x449d('0x46')][_0x449d('0x67')](_0x449d('0x71'))){_0x56ac5a[_0x449d('0x31')]=qs[_0x449d('0x31')](_0x5b5c0b[_0x449d('0x46')][_0x449d('0x31')]);_0x56ac5a[_0x449d('0x2f')]=qs['offset'](_0x5b5c0b[_0x449d('0x46')][_0x449d('0x2f')]);}return _0x51b259[_0x449d('0xac')](_0x56ac5a);}})[_0x449d('0x21')](function(_0xb241d0){if(_0xb241d0){return _0xb241d0?{'count':_0x5ad6f1,'rows':_0xb241d0}:null;}})[_0x449d('0x21')](respondWithResult(_0x9df76,null))['catch'](handleError(_0x9df76,null));};exports[_0x449d('0xad')]=function(_0x36f84e,_0x546b5c,_0x49e5f4){var _0xf7ecdf={'raw':![],'where':{}};var _0x52bdc4={};var _0x6edd77={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x449d('0x66')]({'where':{'id':_0x36f84e['params']['id']}})[_0x449d('0x21')](handleEntityNotFound(_0x546b5c,null))['then'](function(_0x1ea08e){if(_0x1ea08e){_0x52bdc4[_0x449d('0x45')]=_[_0x449d('0x57')](db[_0x449d('0x90')][_0x449d('0x70')]);_0x52bdc4[_0x449d('0x46')]=_[_0x449d('0x57')](_0x36f84e[_0x449d('0x46')]);_0x52bdc4[_0x449d('0x4c')]=_[_0x449d('0x47')](_0x52bdc4[_0x449d('0x45')],_0x52bdc4['query']);_0xf7ecdf[_0x449d('0x48')]=_[_0x449d('0x47')](_0x52bdc4[_0x449d('0x45')],qs[_0x449d('0x49')](_0x36f84e[_0x449d('0x46')][_0x449d('0x49')]));_0xf7ecdf['attributes']=_0xf7ecdf['attributes'][_0x449d('0x58')]?_0xf7ecdf['attributes']:_0x52bdc4[_0x449d('0x45')];if(!_0x36f84e[_0x449d('0x46')][_0x449d('0x67')](_0x449d('0x71'))){_0xf7ecdf[_0x449d('0x31')]=qs[_0x449d('0x31')](_0x36f84e['query'][_0x449d('0x31')]);_0xf7ecdf[_0x449d('0x2f')]=qs[_0x449d('0x2f')](_0x36f84e[_0x449d('0x46')][_0x449d('0x2f')]);}_0xf7ecdf['order']=qs['sort'](_0x36f84e['query'][_0x449d('0x4a')]);_0xf7ecdf[_0x449d('0x4b')]=qs[_0x449d('0x4c')](_[_0x449d('0x4d')](_0x36f84e['query'],_0x52bdc4[_0x449d('0x4c')]));_0xf7ecdf[_0x449d('0x4b')]['OpenchannelAccountId']=_0x1ea08e['id'];if(_0x36f84e[_0x449d('0x46')][_0x449d('0x4e')]){_0xf7ecdf[_0x449d('0x4b')]=_[_0x449d('0x4f')](_0xf7ecdf['where'],{'$or':_[_0x449d('0x40')](_0xf7ecdf[_0x449d('0x48')],function(_0x147d6d){var _0x44b3ae={};_0x44b3ae[_0x147d6d]={'$like':'%'+_0x36f84e[_0x449d('0x46')][_0x449d('0x4e')]+'%'};return _0x44b3ae;})});}_0xf7ecdf=_[_0x449d('0x4f')]({},_0xf7ecdf,_0x36f84e[_0x449d('0x69')]);return db[_0x449d('0x90')][_0x449d('0x51')]({'where':_0xf7ecdf['where']})[_0x449d('0x21')](function(_0x34e9e6){_0x6edd77['count']=_0x34e9e6;if(_0x36f84e[_0x449d('0x46')][_0x449d('0x52')]){_0xf7ecdf[_0x449d('0x53')]=[{'model':db[_0x449d('0x74')],'as':_0x449d('0xae'),'required':![]},{'model':db['User'],'as':_0x449d('0xaf'),'attributes':[_0x449d('0x3b'),_0x449d('0xb0'),'internal'],'required':![]},{'model':db[_0x449d('0xb1')],'as':'Tags','attributes':['id',_0x449d('0x3b'),_0x449d('0xb2')],'where':_0x36f84e[_0x449d('0x46')][_0x449d('0xb3')]?{'id':_0x36f84e[_0x449d('0x46')][_0x449d('0xb3')]}:undefined,'required':_0x36f84e[_0x449d('0x46')][_0x449d('0xb3')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x449d('0x6a')](_0xf7ecdf);})[_0x449d('0x21')](function(_0x58081e){_0x6edd77[_0x449d('0x6b')]=_0x58081e;return _0x6edd77;});}})[_0x449d('0x21')](respondWithFilteredResult(_0x546b5c,_0xf7ecdf))[_0x449d('0x54')](handleError(_0x546b5c,null));};exports['addAgents']=function(_0x38d507,_0x3cb3dc,_0x4e8ccb){return db['OpenchannelAccount'][_0x449d('0x5e')]({'where':{'id':_0x38d507['params']['id']}})[_0x449d('0x21')](handleEntityNotFound(_0x3cb3dc,null))['then'](function(_0x25520e){if(_0x25520e){return _0x25520e[_0x449d('0xb4')](_0x38d507[_0x449d('0x5a')]['ids'],_[_0x449d('0xb5')](_0x38d507[_0x449d('0x5a')],[_0x449d('0x6d'),'id'])||{})['spread'](function(_0x470370){for(var _0x2fc1b8=0x0;_0x2fc1b8<_0x38d507[_0x449d('0x5a')][_0x449d('0x6d')][_0x449d('0x58')];_0x2fc1b8+=0x1){socket['emit'](_0x449d('0xb6'),{'UserId':Number(_0x38d507[_0x449d('0x5a')][_0x449d('0x6d')][_0x2fc1b8]),'OpenchannelAccountId':Number(_0x38d507[_0x449d('0x56')]['id'])});}return _0x470370;});}})[_0x449d('0x21')](respondWithResult(_0x3cb3dc,null))['catch'](handleError(_0x3cb3dc,null));};exports[_0x449d('0xb7')]=function(_0x3c86ed,_0x359792,_0x49d8e0){return db[_0x449d('0x41')][_0x449d('0x5e')]({'where':{'id':_0x3c86ed[_0x449d('0x56')]['id']}})[_0x449d('0x21')](handleEntityNotFound(_0x359792,null))['then'](function(_0x2ad87b){if(_0x2ad87b){return _0x2ad87b[_0x449d('0xb7')](_0x3c86ed[_0x449d('0x46')][_0x449d('0x6d')])[_0x449d('0x21')](function(){if(_['isArray'](_0x3c86ed[_0x449d('0x46')][_0x449d('0x6d')])){for(var _0x5de02c=0x0;_0x5de02c<_0x3c86ed[_0x449d('0x46')][_0x449d('0x6d')]['length'];_0x5de02c+=0x1){socket[_0x449d('0xb8')](_0x449d('0xb9'),{'UserId':Number(_0x3c86ed[_0x449d('0x46')][_0x449d('0x6d')][_0x5de02c]),'OpenchannelAccountId':Number(_0x3c86ed[_0x449d('0x56')]['id'])});}}else{socket['emit'](_0x449d('0xb9'),{'UserId':Number(_0x3c86ed[_0x449d('0x46')]['ids']),'OpenchannelAccountId':Number(_0x3c86ed['params']['id'])});}});}})[_0x449d('0x21')](respondWithStatusCode(_0x359792,null))[_0x449d('0x54')](handleError(_0x359792,null));};exports[_0x449d('0xba')]=function(_0x546339,_0x1363c0,_0x283502){var _0x42161e={};var _0x30b864={};var _0x30db30;var _0x18f0d2;return db[_0x449d('0x41')][_0x449d('0x66')]({'where':{'id':_0x546339[_0x449d('0x56')]['id']}})[_0x449d('0x21')](handleEntityNotFound(_0x1363c0,null))['then'](function(_0x5aa8d5){if(_0x5aa8d5){_0x30db30=_0x5aa8d5;_0x30b864[_0x449d('0x45')]=_['keys'](db[_0x449d('0xbb')][_0x449d('0x70')]);_0x30b864[_0x449d('0x46')]=_[_0x449d('0x57')](_0x546339[_0x449d('0x46')]);_0x30b864[_0x449d('0x4c')]=_[_0x449d('0x47')](_0x30b864[_0x449d('0x45')],_0x30b864[_0x449d('0x46')]);_0x42161e[_0x449d('0x48')]=_[_0x449d('0x47')](_0x30b864[_0x449d('0x45')],qs[_0x449d('0x49')](_0x546339[_0x449d('0x46')][_0x449d('0x49')]));_0x42161e[_0x449d('0x48')]=_0x42161e[_0x449d('0x48')]['length']?_0x42161e[_0x449d('0x48')]:_0x30b864['model'];_0x42161e[_0x449d('0x68')]=qs[_0x449d('0x4a')](_0x546339['query'][_0x449d('0x4a')]);_0x42161e['where']=qs[_0x449d('0x4c')](_[_0x449d('0x4d')](_0x546339[_0x449d('0x46')],_0x30b864[_0x449d('0x4c')]));if(_0x546339[_0x449d('0x46')][_0x449d('0x4e')]){_0x42161e[_0x449d('0x4b')]=_[_0x449d('0x4f')](_0x42161e[_0x449d('0x4b')],{'$or':_['map'](_0x42161e[_0x449d('0x48')],function(_0x2c38cb){var _0x153bd9={};_0x153bd9[_0x2c38cb]={'$like':'%'+_0x546339[_0x449d('0x46')][_0x449d('0x4e')]+'%'};return _0x153bd9;})});}_0x42161e=_['merge']({},_0x42161e,_0x546339[_0x449d('0x69')]);return _0x30db30[_0x449d('0xba')](_0x42161e);}})['then'](function(_0x3039e1){if(_0x3039e1){_0x18f0d2=_0x3039e1[_0x449d('0x58')];if(!_0x546339[_0x449d('0x46')]['hasOwnProperty']('nolimit')){_0x42161e[_0x449d('0x31')]=qs[_0x449d('0x31')](_0x546339[_0x449d('0x46')][_0x449d('0x31')]);_0x42161e[_0x449d('0x2f')]=qs['offset'](_0x546339[_0x449d('0x46')][_0x449d('0x2f')]);}return _0x30db30[_0x449d('0xba')](_0x42161e);}})[_0x449d('0x21')](function(_0x12308e){if(_0x12308e){return _0x12308e?{'count':_0x18f0d2,'rows':_0x12308e}:null;}})['then'](respondWithResult(_0x1363c0,null))['catch'](handleError(_0x1363c0,null));};exports[_0x449d('0x3c')]=function(_0x1f9ba0,_0x2ea887,_0xed5e6d){var _0x5ed56a,_0x89f286,_0x4c0dcd;if(_[_0x449d('0x7d')](_0x1f9ba0[_0x449d('0x5a')][_0x449d('0x5a')])||_0x1f9ba0[_0x449d('0x5a')][_0x449d('0x5a')]===''){throw new db['Sequelize'][(_0x449d('0x76'))](_0x449d('0x80'));}if(_['isNil'](_0x1f9ba0[_0x449d('0x5a')]['to'])){}_0x5ed56a=_0x1f9ba0[_0x449d('0x5a')]['to'];return db[_0x449d('0x41')][_0x449d('0x66')]({'where':{'id':_0x1f9ba0['params']['id']}})[_0x449d('0x21')](handleEntityNotFound(_0x2ea887,null))[_0x449d('0x21')](function(_0x53c0b9){if(_0x53c0b9){return db[_0x449d('0x41')][_0x449d('0x5e')]({'where':{'id':_0x53c0b9['id']},'include':[{'model':db[_0x449d('0xbc')],'as':_0x449d('0x83'),'include':[{'model':db[_0x449d('0x74')],'as':'Contacts','where':{[_0x53c0b9[_0x449d('0x81')]]:_0x5ed56a},'limit':0x1,'order':[[_0x449d('0x7a'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x2ea887,null))[_0x449d('0x21')](function(_0x310058){if(_0x310058&&_0x310058[_0x449d('0x83')]){_0x89f286=_0x310058[_0x449d('0x36')]({'plain':!![]});if(_0x89f286[_0x449d('0x83')]&&_0x89f286['List'][_0x449d('0x84')][_0x449d('0x58')]){return _0x89f286[_0x449d('0x83')]['Contacts'][0x0];}return db[_0x449d('0x74')][_0x449d('0x59')](_[_0x449d('0x18')](_0x1f9ba0['body'],{'firstName':_0x5ed56a,[_0x310058[_0x449d('0x81')]]:_0x5ed56a,'phone':_0x5ed56a,'ListId':_0x89f286[_0x449d('0x7c')]}));}})[_0x449d('0x21')](handleEntityNotFound(_0x2ea887,null))[_0x449d('0x21')](function(_0x2e12ce){if(_0x2e12ce){_0x4c0dcd=_0x2e12ce;return db[_0x449d('0x90')][_0x449d('0x5e')]({'where':{'ContactId':_0x4c0dcd['id'],'closed':![],'OpenchannelAccountId':_0x89f286['id']}})[_0x449d('0x21')](function(_0x37022d){if(_0x37022d){return[_0x37022d,![]];}return db[_0x449d('0x90')][_0x449d('0x59')]({'UserId':_0x1f9ba0[_0x449d('0x5b')]['id'],'ContactId':_0x4c0dcd['id'],'OpenchannelAccountId':_0x89f286['id'],'lastMsgDirection':_0x449d('0xbd'),'Messages':[_[_0x449d('0x4f')](_0x1f9ba0[_0x449d('0x5a')],{'read':![],'body':_0x1f9ba0[_0x449d('0x5a')][_0x449d('0x5a')],'OpenchannelAccountId':_0x89f286['id'],'UserId':_0x1f9ba0['user']['id'],'ContactId':_0x4c0dcd['id']})]},{'include':[{'model':db[_0x449d('0x9a')],'as':_0x449d('0xbe')}]})[_0x449d('0x21')](function(_0x419692){return[_0x419692,!![]];});});}})[_0x449d('0x92')](function(_0x104d8e,_0x222ab7){if(_0x222ab7){return _0x104d8e;}return db[_0x449d('0x9a')]['create'](_[_0x449d('0x4f')](_0x1f9ba0['body'],{'read':![],'body':_0x1f9ba0[_0x449d('0x5a')]['body'],'OpenchannelAccountId':_0x89f286['id'],'OpenchannelInteractionId':_0x104d8e['id'],'UserId':_0x1f9ba0[_0x449d('0x5b')]['id'],'ContactId':_0x4c0dcd['id']}))[_0x449d('0x21')](function(_0x1a67d6){_0x104d8e[_0x449d('0xbf')][_0x449d('0xbe')]=[];_0x104d8e['dataValues'][_0x449d('0xbe')]['push'](_0x1a67d6[_0x449d('0xbf')]);return _0x104d8e;});});}})['then'](respondWithResult(_0x2ea887,null))[_0x449d('0x54')](handleError(_0x2ea887,null));}; \ No newline at end of file +var _0x5364=['send','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','nolimit','limit','order','sort','where','filters','pick','VIRTUAL','filter','options','include','findAll','rows','show','Pause','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','merge','removeDispositions','ids','addAnswer','CannedAnswer','includeAll','removeAnswers','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','Sequelize','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','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','priority','asc','defaults','from','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','update','interaction','created','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','notify','addApplications','sequelize','Transaction','READ_COMMITTED','findAndCountAll','finally','getApplications','hasOwnProperty','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','undefined','count','offset','Content-Range','apply','reject','save','get','OpenchannelAccounts','UserProfileResource','destroy','sendStatus','stack','name'];(function(_0x47e6ef,_0x24acec){var _0xc1f82d=function(_0x50a872){while(--_0x50a872){_0x47e6ef['push'](_0x47e6ef['shift']());}};_0xc1f82d(++_0x24acec);}(_0x5364,0x82));var _0x4536=function(_0x5cd7c3,_0x70f967){_0x5cd7c3=_0x5cd7c3-0x0;var _0x3e6e67=_0x5364[_0x5cd7c3];return _0x3e6e67;};'use strict';var emlformat=require(_0x4536('0x0'));var rimraf=require(_0x4536('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4536('0x2'));var rp=require('request-promise');var moment=require(_0x4536('0x3'));var BPromise=require(_0x4536('0x4'));var Mustache=require(_0x4536('0x5'));var util=require(_0x4536('0x6'));var path=require(_0x4536('0x7'));var sox=require(_0x4536('0x8'));var csv=require(_0x4536('0x9'));var ejs=require(_0x4536('0xa'));var fs=require('fs');var fs_extra=require(_0x4536('0xb'));var _=require(_0x4536('0xc'));var squel=require(_0x4536('0xd'));var crypto=require(_0x4536('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4536('0xf'));var toCsv=require(_0x4536('0x9'));var querystring=require('querystring');var Papa=require(_0x4536('0x10'));var Redis=require(_0x4536('0x11'));var authService=require(_0x4536('0x12'));var qs=require(_0x4536('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4536('0x14'))(_0x4536('0x15'));var utils=require('../../config/utils');var config=require(_0x4536('0x16'));var licenseUtil=require(_0x4536('0x17'));var db=require(_0x4536('0x18'))['db'];config[_0x4536('0x19')]=_['defaults'](config[_0x4536('0x19')],{'host':_0x4536('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4536('0x19')]));require('./openchannelAccount.socket')[_0x4536('0x1b')](socket);var jayson=require(_0x4536('0x1c'));var client=jayson[_0x4536('0x1d')][_0x4536('0x1e')]({'port':0x232c});var client9002=jayson[_0x4536('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d1563,_0x4f1419,_0x4c4e9a,_0x5d49db){return new BPromise(function(_0x4423dc,_0x5deab9){var _0x23bcb5=_0x5d49db||client;return _0x23bcb5['request'](_0x2d1563,_0x4c4e9a)[_0x4536('0x1f')](function(_0x12ebab){logger[_0x4536('0x20')](_0x4536('0x21'),_0x4f1419,_0x4536('0x22'));logger['debug'](_0x4536('0x23'),_0x4f1419,_0x4536('0x22'),JSON['stringify'](_0x12ebab));if(_0x12ebab['error']){if(_0x12ebab[_0x4536('0x24')][_0x4536('0x25')]===0x1f4){logger[_0x4536('0x24')](_0x4536('0x21'),_0x4f1419,_0x12ebab[_0x4536('0x24')][_0x4536('0x26')]);return _0x5deab9(_0x12ebab[_0x4536('0x24')][_0x4536('0x26')]);}logger[_0x4536('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x4f1419,_0x12ebab[_0x4536('0x24')][_0x4536('0x26')]);return _0x4423dc(_0x12ebab[_0x4536('0x24')][_0x4536('0x26')]);}else{logger[_0x4536('0x20')](_0x4536('0x21'),_0x4f1419,_0x4536('0x22'));_0x4423dc(_0x12ebab[_0x4536('0x27')][_0x4536('0x26')]);}})[_0x4536('0x28')](function(_0x5a0c42){logger['error'](_0x4536('0x21'),_0x4f1419,_0x5a0c42);_0x5deab9(_0x5a0c42);});});}function respondWithStatusCode(_0x430cbd,_0x488729){_0x488729=_0x488729||0xcc;return function(_0x545d6a){if(_0x545d6a){return _0x430cbd['sendStatus'](_0x488729);}return _0x430cbd[_0x4536('0x29')](_0x488729)[_0x4536('0x2a')]();};}function respondWithResult(_0x2d886c,_0x1f224f){_0x1f224f=_0x1f224f||0xc8;return function(_0x56f951){if(_0x56f951){return _0x2d886c[_0x4536('0x29')](_0x1f224f)[_0x4536('0x2b')](_0x56f951);}};}function respondWithFilteredResult(_0x719706,_0x43a850){return function(_0x7d6719){if(_0x7d6719){var _0xa95783=typeof _0x43a850['offset']===_0x4536('0x2c')&&typeof _0x43a850['limit']==='undefined';var _0x48bca6=_0x7d6719[_0x4536('0x2d')];var _0x5847fb=_0xa95783?0x0:_0x43a850[_0x4536('0x2e')];var _0x22bb8d=_0xa95783?_0x7d6719[_0x4536('0x2d')]:_0x43a850[_0x4536('0x2e')]+_0x43a850['limit'];var _0x2372ad;if(_0x22bb8d>=_0x48bca6){_0x22bb8d=_0x48bca6;_0x2372ad=0xc8;}else{_0x2372ad=0xce;}_0x719706['status'](_0x2372ad);return _0x719706['set'](_0x4536('0x2f'),_0x5847fb+'-'+_0x22bb8d+'/'+_0x48bca6)[_0x4536('0x2b')](_0x7d6719);}return null;};}function patchUpdates(_0x37bdba){return function(_0xd6bfa7){try{jsonpatch[_0x4536('0x30')](_0xd6bfa7,_0x37bdba,!![]);}catch(_0x237323){return BPromise[_0x4536('0x31')](_0x237323);}return _0xd6bfa7[_0x4536('0x32')]();};}function saveUpdates(_0x5b5e95,_0x4ed794){return function(_0x5e8557){if(_0x5e8557){return _0x5e8557['update'](_0x5b5e95)[_0x4536('0x1f')](function(_0x175558){return _0x175558;});}return null;};}function removeEntity(_0x26c11e,_0x3ab339){return function(_0x44f892){if(_0x44f892){return _0x44f892['destroy']()[_0x4536('0x1f')](function(){var _0xd06471=_0x44f892[_0x4536('0x33')]({'plain':!![]});var _0x28cf69=_0x4536('0x34');return db[_0x4536('0x35')][_0x4536('0x36')]({'where':{'type':_0x28cf69,'resourceId':_0xd06471['id']}})[_0x4536('0x1f')](function(){return _0x44f892;});})[_0x4536('0x1f')](function(){_0x26c11e[_0x4536('0x29')](0xcc)[_0x4536('0x2a')]();});}};}function handleEntityNotFound(_0x2e88cf,_0x203806){return function(_0x26bff6){if(!_0x26bff6){_0x2e88cf[_0x4536('0x37')](0x194);}return _0x26bff6;};}function handleError(_0x4091e7,_0x433252){_0x433252=_0x433252||0x1f4;return function(_0x21ecae){logger['error'](_0x21ecae[_0x4536('0x38')]);if(_0x21ecae[_0x4536('0x39')]){delete _0x21ecae[_0x4536('0x39')];}_0x4091e7[_0x4536('0x29')](_0x433252)[_0x4536('0x3a')](_0x21ecae);};}exports['index']=function(_0x36cbee,_0x4dbce5){var _0xa209ae={'include':[{'model':db['Pause'],'as':_0x4536('0x3b')}]},_0x144f4d={},_0x3c697e={'count':0x0,'rows':[]};var _0x1025fa=_[_0x4536('0x3c')](db[_0x4536('0x3d')][_0x4536('0x3e')],function(_0x510fff){return{'name':_0x510fff[_0x4536('0x3f')],'type':_0x510fff[_0x4536('0x40')][_0x4536('0x41')]};});_0x144f4d[_0x4536('0x42')]=_[_0x4536('0x3c')](_0x1025fa,_0x4536('0x39'));_0x144f4d['query']=_[_0x4536('0x43')](_0x36cbee[_0x4536('0x44')]);_0x144f4d['filters']=_['intersection'](_0x144f4d[_0x4536('0x42')],_0x144f4d['query']);_0xa209ae[_0x4536('0x45')]=_[_0x4536('0x46')](_0x144f4d[_0x4536('0x42')],qs[_0x4536('0x47')](_0x36cbee[_0x4536('0x44')]['fields']));_0xa209ae[_0x4536('0x45')]=_0xa209ae[_0x4536('0x45')][_0x4536('0x48')]?_0xa209ae['attributes']:_0x144f4d['model'];if(!_0x36cbee[_0x4536('0x44')]['hasOwnProperty'](_0x4536('0x49'))){_0xa209ae[_0x4536('0x4a')]=qs[_0x4536('0x4a')](_0x36cbee[_0x4536('0x44')]['limit']);_0xa209ae['offset']=qs['offset'](_0x36cbee[_0x4536('0x44')][_0x4536('0x2e')]);}_0xa209ae[_0x4536('0x4b')]=qs[_0x4536('0x4c')](_0x36cbee['query']['sort']);_0xa209ae[_0x4536('0x4d')]=qs[_0x4536('0x4e')](_[_0x4536('0x4f')](_0x36cbee[_0x4536('0x44')],_0x144f4d[_0x4536('0x4e')]),_0x1025fa);if(_0x36cbee[_0x4536('0x44')]['filter']){_0xa209ae[_0x4536('0x4d')]=_['merge'](_0xa209ae[_0x4536('0x4d')],{'$or':_['map'](_0x1025fa,function(_0x4870c2){if(_0x4870c2[_0x4536('0x40')]!==_0x4536('0x50')){var _0x11d2ea={};_0x11d2ea[_0x4870c2[_0x4536('0x39')]]={'$like':'%'+_0x36cbee[_0x4536('0x44')][_0x4536('0x51')]+'%'};return _0x11d2ea;}})});}_0xa209ae=_['merge']({},_0xa209ae,_0x36cbee[_0x4536('0x52')]);var _0x5adeae={'where':_0xa209ae[_0x4536('0x4d')]};return db[_0x4536('0x3d')][_0x4536('0x2d')](_0x5adeae)['then'](function(_0x2a04c6){_0x3c697e[_0x4536('0x2d')]=_0x2a04c6;if(_0x36cbee['query']['includeAll']){_0xa209ae[_0x4536('0x53')]=[{'all':!![]}];}return db[_0x4536('0x3d')][_0x4536('0x54')](_0xa209ae);})[_0x4536('0x1f')](function(_0x1bd112){_0x3c697e[_0x4536('0x55')]=_0x1bd112;return _0x3c697e;})['then'](respondWithFilteredResult(_0x4dbce5,_0xa209ae))[_0x4536('0x28')](handleError(_0x4dbce5,null));};exports[_0x4536('0x56')]=function(_0x28da5e,_0x34f36a){var _0x395f69={'raw':![],'where':{'id':_0x28da5e['params']['id']},'include':[{'model':db[_0x4536('0x57')],'as':_0x4536('0x3b')}]},_0x2e313c={};_0x2e313c[_0x4536('0x42')]=_[_0x4536('0x43')](db[_0x4536('0x3d')][_0x4536('0x3e')]);_0x2e313c[_0x4536('0x44')]=_[_0x4536('0x43')](_0x28da5e[_0x4536('0x44')]);_0x2e313c[_0x4536('0x4e')]=_['intersection'](_0x2e313c['model'],_0x2e313c[_0x4536('0x44')]);_0x395f69[_0x4536('0x45')]=_[_0x4536('0x46')](_0x2e313c[_0x4536('0x42')],qs[_0x4536('0x47')](_0x28da5e['query'][_0x4536('0x47')]));_0x395f69['attributes']=_0x395f69[_0x4536('0x45')][_0x4536('0x48')]?_0x395f69[_0x4536('0x45')]:_0x2e313c[_0x4536('0x42')];if(_0x28da5e[_0x4536('0x44')]['includeAll']){_0x395f69[_0x4536('0x53')]=[{'all':!![]}];}_0x395f69=_['merge']({},_0x395f69,_0x28da5e[_0x4536('0x52')]);return db[_0x4536('0x3d')][_0x4536('0x58')](_0x395f69)[_0x4536('0x1f')](handleEntityNotFound(_0x34f36a,null))[_0x4536('0x1f')](respondWithResult(_0x34f36a,null))[_0x4536('0x28')](handleError(_0x34f36a,null));};exports[_0x4536('0x59')]=function(_0x423a65,_0x551bdd){return db[_0x4536('0x3d')][_0x4536('0x59')](_0x423a65['body'],{})[_0x4536('0x1f')](function(_0x3e2822){var _0x317434=_0x423a65[_0x4536('0x5a')][_0x4536('0x33')]({'plain':!![]});if(!_0x317434)throw new Error(_0x4536('0x5b'));if(_0x317434['role']===_0x4536('0x5a')){var _0x459566=_0x3e2822[_0x4536('0x33')]({'plain':!![]});var _0x161a1c=_0x4536('0x34');return db[_0x4536('0x5c')][_0x4536('0x58')]({'where':{'name':_0x161a1c,'userProfileId':_0x317434[_0x4536('0x5d')]},'raw':!![]})[_0x4536('0x1f')](function(_0x4a95ec){if(_0x4a95ec&&_0x4a95ec[_0x4536('0x5e')]===0x0){return db[_0x4536('0x35')][_0x4536('0x59')]({'name':_0x459566['name'],'resourceId':_0x459566['id'],'type':_0x4a95ec[_0x4536('0x39')],'sectionId':_0x4a95ec['id']},{})[_0x4536('0x1f')](function(){return _0x3e2822;});}else{return _0x3e2822;}})[_0x4536('0x28')](function(_0x581165){logger[_0x4536('0x24')](_0x4536('0x5f'),_0x581165);throw _0x581165;});}return _0x3e2822;})[_0x4536('0x1f')](respondWithResult(_0x551bdd,0xc9))['catch'](handleError(_0x551bdd,null));};exports['update']=function(_0x28c55b,_0x38b5ab){if(_0x28c55b[_0x4536('0x60')]['id']){delete _0x28c55b[_0x4536('0x60')]['id'];}return db['OpenchannelAccount'][_0x4536('0x58')]({'where':{'id':_0x28c55b[_0x4536('0x61')]['id']},'include':[{'model':db[_0x4536('0x57')],'as':_0x4536('0x3b')}]})[_0x4536('0x1f')](handleEntityNotFound(_0x38b5ab,null))[_0x4536('0x1f')](saveUpdates(_0x28c55b[_0x4536('0x60')],null))[_0x4536('0x1f')](respondWithResult(_0x38b5ab,null))['catch'](handleError(_0x38b5ab,null));};exports[_0x4536('0x36')]=function(_0x2a6f57,_0xbb89f2){return db[_0x4536('0x3d')][_0x4536('0x58')]({'where':{'id':_0x2a6f57[_0x4536('0x61')]['id']}})[_0x4536('0x1f')](handleEntityNotFound(_0xbb89f2,null))['then'](removeEntity(_0xbb89f2,null))[_0x4536('0x28')](handleError(_0xbb89f2,null));};exports[_0x4536('0x62')]=function(_0x4a5b2c,_0x1a9d44){return db['OpenchannelAccount'][_0x4536('0x62')]()[_0x4536('0x1f')](respondWithResult(_0x1a9d44,null))[_0x4536('0x28')](handleError(_0x1a9d44,null));};exports[_0x4536('0x63')]=function(_0x3e04d9,_0x38c57e,_0x2a6be7){if(_0x3e04d9[_0x4536('0x60')]['id']){delete _0x3e04d9[_0x4536('0x60')]['id'];}return db[_0x4536('0x3d')]['find']({'where':{'id':_0x3e04d9[_0x4536('0x61')]['id']}})[_0x4536('0x1f')](handleEntityNotFound(_0x38c57e,null))['then'](function(_0x5167f5){if(_0x5167f5){_0x3e04d9[_0x4536('0x60')][_0x4536('0x64')]=_0x5167f5['id'];return db[_0x4536('0x65')][_0x4536('0x59')](_0x3e04d9[_0x4536('0x60')]);}})[_0x4536('0x1f')](respondWithResult(_0x38c57e,null))['catch'](handleError(_0x38c57e,null));};exports[_0x4536('0x66')]=function(_0x362cce,_0xed2106,_0xdb2c7){var _0xdb3ba9={'raw':![],'where':{}};var _0x213e63={};var _0x40e070={'count':0x0,'rows':[]};return db[_0x4536('0x3d')][_0x4536('0x67')]({'where':{'id':_0x362cce[_0x4536('0x61')]['id']}})['then'](handleEntityNotFound(_0xed2106,null))[_0x4536('0x1f')](function(_0x4cbddc){if(_0x4cbddc){_0x213e63[_0x4536('0x42')]=_[_0x4536('0x43')](db[_0x4536('0x65')][_0x4536('0x3e')]);_0x213e63[_0x4536('0x44')]=_[_0x4536('0x43')](_0x362cce[_0x4536('0x44')]);_0x213e63[_0x4536('0x4e')]=_[_0x4536('0x46')](_0x213e63[_0x4536('0x42')],_0x213e63[_0x4536('0x44')]);_0xdb3ba9[_0x4536('0x45')]=_['intersection'](_0x213e63['model'],qs[_0x4536('0x47')](_0x362cce['query'][_0x4536('0x47')]));_0xdb3ba9[_0x4536('0x45')]=_0xdb3ba9[_0x4536('0x45')][_0x4536('0x48')]?_0xdb3ba9[_0x4536('0x45')]:_0x213e63[_0x4536('0x42')];if(!_0x362cce['query']['hasOwnProperty'](_0x4536('0x49'))){_0xdb3ba9['limit']=qs[_0x4536('0x4a')](_0x362cce[_0x4536('0x44')][_0x4536('0x4a')]);_0xdb3ba9['offset']=qs[_0x4536('0x2e')](_0x362cce[_0x4536('0x44')][_0x4536('0x2e')]);}_0xdb3ba9[_0x4536('0x4b')]=qs[_0x4536('0x4c')](_0x362cce[_0x4536('0x44')][_0x4536('0x4c')]);_0xdb3ba9[_0x4536('0x4d')]=qs[_0x4536('0x4e')](_[_0x4536('0x4f')](_0x362cce[_0x4536('0x44')],_0x213e63[_0x4536('0x4e')]));_0xdb3ba9[_0x4536('0x4d')][_0x4536('0x64')]=_0x4cbddc['id'];if(_0x362cce[_0x4536('0x44')][_0x4536('0x51')]){_0xdb3ba9[_0x4536('0x4d')]=_[_0x4536('0x68')](_0xdb3ba9[_0x4536('0x4d')],{'$or':_[_0x4536('0x3c')](_0xdb3ba9[_0x4536('0x45')],function(_0x38b1ac){var _0x2c5ff9={};_0x2c5ff9[_0x38b1ac]={'$like':'%'+_0x362cce[_0x4536('0x44')][_0x4536('0x51')]+'%'};return _0x2c5ff9;})});}_0xdb3ba9=_[_0x4536('0x68')]({},_0xdb3ba9,_0x362cce[_0x4536('0x52')]);return db['Disposition'][_0x4536('0x2d')]({'where':_0xdb3ba9[_0x4536('0x4d')]})[_0x4536('0x1f')](function(_0x36ac6b){_0x40e070[_0x4536('0x2d')]=_0x36ac6b;if(_0x362cce[_0x4536('0x44')]['includeAll']){_0xdb3ba9['include']=[{'all':!![]}];}return db[_0x4536('0x65')][_0x4536('0x54')](_0xdb3ba9);})[_0x4536('0x1f')](function(_0x2ba1e4){_0x40e070['rows']=_0x2ba1e4;return _0x40e070;});}})[_0x4536('0x1f')](respondWithFilteredResult(_0xed2106,_0xdb3ba9))[_0x4536('0x28')](handleError(_0xed2106,null));};exports[_0x4536('0x69')]=function(_0x23a22f,_0x49f95f,_0x4a0844){return db[_0x4536('0x3d')][_0x4536('0x58')]({'where':{'id':_0x23a22f[_0x4536('0x61')]['id']}})[_0x4536('0x1f')](handleEntityNotFound(_0x49f95f,null))[_0x4536('0x1f')](function(_0xaa13ec){if(_0xaa13ec){return _0xaa13ec[_0x4536('0x69')](_0x23a22f[_0x4536('0x44')][_0x4536('0x6a')]);}})[_0x4536('0x1f')](respondWithStatusCode(_0x49f95f,null))[_0x4536('0x28')](handleError(_0x49f95f,null));};exports[_0x4536('0x6b')]=function(_0x261ae9,_0x3c7f83,_0xc2cad8){if(_0x261ae9['body']['id']){delete _0x261ae9[_0x4536('0x60')]['id'];}return db[_0x4536('0x3d')][_0x4536('0x58')]({'where':{'id':_0x261ae9[_0x4536('0x61')]['id']}})[_0x4536('0x1f')](handleEntityNotFound(_0x3c7f83,null))[_0x4536('0x1f')](function(_0xa6936e){if(_0xa6936e){_0x261ae9['body'][_0x4536('0x64')]=_0xa6936e['id'];return db[_0x4536('0x6c')][_0x4536('0x59')](_0x261ae9[_0x4536('0x60')]);}})[_0x4536('0x1f')](respondWithResult(_0x3c7f83,null))[_0x4536('0x28')](handleError(_0x3c7f83,null));};exports['getAnswers']=function(_0x6c1468,_0x243d66,_0x3115c9){var _0x4e1291={'raw':![],'where':{}};var _0x46dc8f={};var _0xc7f425={'count':0x0,'rows':[]};return db[_0x4536('0x3d')]['findOne']({'where':{'id':_0x6c1468[_0x4536('0x61')]['id']}})[_0x4536('0x1f')](handleEntityNotFound(_0x243d66,null))[_0x4536('0x1f')](function(_0x25e9b2){if(_0x25e9b2){_0x46dc8f[_0x4536('0x42')]=_[_0x4536('0x43')](db[_0x4536('0x6c')][_0x4536('0x3e')]);_0x46dc8f[_0x4536('0x44')]=_[_0x4536('0x43')](_0x6c1468[_0x4536('0x44')]);_0x46dc8f[_0x4536('0x4e')]=_['intersection'](_0x46dc8f['model'],_0x46dc8f[_0x4536('0x44')]);_0x4e1291['attributes']=_['intersection'](_0x46dc8f['model'],qs[_0x4536('0x47')](_0x6c1468['query'][_0x4536('0x47')]));_0x4e1291['attributes']=_0x4e1291[_0x4536('0x45')][_0x4536('0x48')]?_0x4e1291['attributes']:_0x46dc8f['model'];if(!_0x6c1468[_0x4536('0x44')]['hasOwnProperty'](_0x4536('0x49'))){_0x4e1291['limit']=qs[_0x4536('0x4a')](_0x6c1468[_0x4536('0x44')]['limit']);_0x4e1291['offset']=qs[_0x4536('0x2e')](_0x6c1468['query'][_0x4536('0x2e')]);}_0x4e1291[_0x4536('0x4b')]=qs[_0x4536('0x4c')](_0x6c1468[_0x4536('0x44')][_0x4536('0x4c')]);_0x4e1291[_0x4536('0x4d')]=qs[_0x4536('0x4e')](_['pick'](_0x6c1468[_0x4536('0x44')],_0x46dc8f[_0x4536('0x4e')]));_0x4e1291['where'][_0x4536('0x64')]=_0x25e9b2['id'];if(_0x6c1468['query'][_0x4536('0x51')]){_0x4e1291[_0x4536('0x4d')]=_['merge'](_0x4e1291[_0x4536('0x4d')],{'$or':_[_0x4536('0x3c')](_0x4e1291[_0x4536('0x45')],function(_0x47bd4f){var _0x4372af={};_0x4372af[_0x47bd4f]={'$like':'%'+_0x6c1468['query']['filter']+'%'};return _0x4372af;})});}_0x4e1291=_['merge']({},_0x4e1291,_0x6c1468[_0x4536('0x52')]);return db[_0x4536('0x6c')][_0x4536('0x2d')]({'where':_0x4e1291['where']})[_0x4536('0x1f')](function(_0x5bd901){_0xc7f425['count']=_0x5bd901;if(_0x6c1468[_0x4536('0x44')][_0x4536('0x6d')]){_0x4e1291[_0x4536('0x53')]=[{'all':!![]}];}return db[_0x4536('0x6c')][_0x4536('0x54')](_0x4e1291);})['then'](function(_0x5a0311){_0xc7f425[_0x4536('0x55')]=_0x5a0311;return _0xc7f425;});}})[_0x4536('0x1f')](respondWithFilteredResult(_0x243d66,_0x4e1291))[_0x4536('0x28')](handleError(_0x243d66,null));};exports[_0x4536('0x6e')]=function(_0x13824f,_0x316284,_0x42e894){return db[_0x4536('0x3d')][_0x4536('0x58')]({'where':{'id':_0x13824f[_0x4536('0x61')]['id']}})[_0x4536('0x1f')](handleEntityNotFound(_0x316284,null))[_0x4536('0x1f')](function(_0x274b17){if(_0x274b17){return _0x274b17[_0x4536('0x6e')](_0x13824f['query'][_0x4536('0x6a')]);}})[_0x4536('0x1f')](respondWithStatusCode(_0x316284,null))[_0x4536('0x28')](handleError(_0x316284,null));};exports['notify']=function(_0x52438f,_0x153f42,_0x1c5d13){var _0x445348={'body':_0x52438f[_0x4536('0x60')],'channel':'openchannel'};var _0x44afe2=[];var _0x6c3cfe=[];var _0x3e0479={};var _0x57cd6f=![];return db[_0x4536('0x6f')][_0x4536('0x62')]()[_0x4536('0x1f')](function(_0x2c304e){if(!_0x2c304e){throw new db['Sequelize'][(_0x4536('0x70'))](_0x4536('0x71'));}_0x44afe2=_[_0x4536('0x72')](_[_0x4536('0x43')](_0x2c304e),['createdAt','updatedAt']);_0x6c3cfe=_[_0x4536('0x72')](_[_0x4536('0x43')](_0x2c304e),[_0x4536('0x73'),_0x4536('0x74'),'CompanyId',_0x4536('0x75')]);if(_0x52438f[_0x4536('0x60')]['id']){delete _0x52438f[_0x4536('0x60')]['id'];}if(_[_0x4536('0x76')](_0x52438f['body']['from'])){throw new db[(_0x4536('0x77'))]['ValidationError'](_0x4536('0x78'));}if(_[_0x4536('0x76')](_0x52438f[_0x4536('0x60')][_0x4536('0x60')])||_0x52438f[_0x4536('0x60')]['body']===''){throw new db[(_0x4536('0x77'))][(_0x4536('0x70'))](_0x4536('0x79'));}if(_[_0x4536('0x76')](_0x52438f[_0x4536('0x60')][_0x4536('0x7a')])){throw new db[(_0x4536('0x77'))][(_0x4536('0x70'))](_0x4536('0x7b')+_0x6c3cfe);}if(!_[_0x4536('0x7c')](_0x6c3cfe,_0x52438f['body'][_0x4536('0x7a')])){throw new db[(_0x4536('0x77'))]['ValidationError'](_0x4536('0x7d')+_0x6c3cfe);}_0x3e0479[_0x52438f[_0x4536('0x60')][_0x4536('0x7a')]]=_0x52438f['body']['from'];})['then'](function(){return db[_0x4536('0x3d')][_0x4536('0x58')]({'where':{'id':_0x52438f[_0x4536('0x61')]['id']},'include':[{'model':db[_0x4536('0x7e')],'as':_0x4536('0x7f'),'include':[{'model':db[_0x4536('0x6f')],'as':_0x4536('0x80'),'where':_0x3e0479,'limit':0x1,'order':[[_0x4536('0x74'),_0x4536('0x81')]]}]},{'model':db[_0x4536('0x82')],'as':_0x4536('0x83')}]});})[_0x4536('0x1f')](handleEntityNotFound(_0x153f42,null))[_0x4536('0x1f')](function(_0x20ece5){if(_0x20ece5&&_0x20ece5[_0x4536('0x7f')]){_0x445348[_0x4536('0x84')]=_0x20ece5;_0x445348[_0x4536('0x85')]=_0x20ece5[_0x4536('0x83')];_0x445348[_0x4536('0x86')]=_0x20ece5[_0x4536('0x7f')];_0x445348[_0x4536('0x85')]=_['orderBy'](_0x445348[_0x4536('0x85')],[_0x4536('0x87')],[_0x4536('0x88')]);if(_0x445348[_0x4536('0x84')][_0x4536('0x83')]){delete _0x445348['account']['Applications'];}if(_0x445348['account'][_0x4536('0x7f')]&&_0x445348[_0x4536('0x84')][_0x4536('0x7f')][_0x4536('0x80')][_0x4536('0x48')]){return _0x445348['account'][_0x4536('0x7f')]['Contacts'][0x0];}var _0x3d0e2e=_[_0x4536('0x89')](_0x52438f['body'],{'firstName':_0x52438f['body']['from'],'ListId':_0x20ece5['ListId']});_0x3d0e2e[_0x52438f[_0x4536('0x60')][_0x4536('0x7a')]]=_0x52438f[_0x4536('0x60')][_0x4536('0x8a')];return db[_0x4536('0x6f')]['create'](_0x3d0e2e,{'fields':_0x44afe2,'raw':!![]});}})['then'](handleEntityNotFound(_0x153f42,null))[_0x4536('0x1f')](function(_0x512092){_0x445348[_0x4536('0x8b')]=_0x512092;if(_0x512092){var _0x364b4={'ContactId':_0x512092['id'],'OpenchannelAccountId':_0x52438f[_0x4536('0x61')]['id'],'from':(_0x512092['firstName']||'')+'\x20'+(_0x512092[_0x4536('0x8c')]||'')};var _0x471c1b={'OpenchannelAccountId':_0x52438f[_0x4536('0x61')]['id'],'closed':![]};if(_0x52438f[_0x4536('0x60')][_0x4536('0x8d')]){_0x471c1b['threadId']=_0x52438f[_0x4536('0x60')]['threadId'];return db[_0x4536('0x8e')]['find']({'where':_0x471c1b})[_0x4536('0x1f')](function(_0x5a3a69){if(_0x5a3a69){return[_0x5a3a69,![]];}_0x364b4['threadId']=_0x52438f[_0x4536('0x60')][_0x4536('0x8d')];_0x364b4[_0x4536('0x8f')]=_0x52438f['body'][_0x4536('0x8f')];return db[_0x4536('0x8e')][_0x4536('0x59')](_0x364b4)['then'](function(_0x47322f){return[_0x47322f,!![]];});});}else{_0x471c1b[_0x4536('0x8d')]=null;}_0x471c1b[_0x4536('0x90')]=_0x512092['id'];return db['OpenchannelInteraction']['find']({'where':_0x471c1b})[_0x4536('0x1f')](function(_0x337664){if(_0x337664){return[_0x337664,![]];}return db['OpenchannelInteraction'][_0x4536('0x59')](_0x364b4)['then'](function(_0x4d42d5){return[_0x4d42d5,!![]];});});}})[_0x4536('0x91')](function(_0x147544,_0x205ee5){if(_0x147544){_0x57cd6f=_0x205ee5;if(!_0x205ee5){var _0x58dc03={'from':(_0x445348[_0x4536('0x8b')][_0x4536('0x92')]||'')+'\x20'+(_0x445348[_0x4536('0x8b')][_0x4536('0x8c')]||'')};if(_0x52438f[_0x4536('0x60')][_0x4536('0x8d')]&&_0x52438f[_0x4536('0x60')]['messageId']&&_0x52438f[_0x4536('0x60')][_0x4536('0x8d')]!=_0x52438f[_0x4536('0x60')]['messageId']){_0x58dc03[_0x4536('0x8d')]=_0x52438f['body']['messageId'];}return _0x147544[_0x4536('0x93')](_0x58dc03);}else{return _0x147544;}}})['then'](function(_0x4ef5a9){_0x445348[_0x4536('0x94')]=_0x4ef5a9[_0x4536('0x33')]({'plain':!![]});_0x445348[_0x4536('0x94')][_0x4536('0x95')]=_0x57cd6f;if(_0x445348['interaction']['created']){if(_0x445348['account']['autoclose']){_0x445348[_0x4536('0x85')][_0x4536('0x96')]({'id':0x0,'priority':_0x445348[_0x4536('0x85')]['length']+0x1,'app':_0x4536('0x97'),'appdata':'unmanaged','interval':_0x4536('0x98')});}}return db[_0x4536('0x99')][_0x4536('0x59')]({'body':_0x52438f[_0x4536('0x60')][_0x4536('0x60')],'OpenchannelAccountId':_0x52438f['params']['id'],'OpenchannelInteractionId':_0x4ef5a9['id'],'direction':'in','ContactId':_0x445348[_0x4536('0x8b')]['id'],'AttachmentId':_0x52438f['body'][_0x4536('0x9a')]});})[_0x4536('0x1f')](function(_0x2c0582){_0x445348[_0x4536('0x26')]=_0x2c0582;if(_0x445348[_0x4536('0x94')]['UserId']){return db[_0x4536('0x9b')][_0x4536('0x58')]({'attributes':['id',_0x4536('0x39')],'where':{'id':_0x445348['interaction'][_0x4536('0x9c')]}})[_0x4536('0x1f')](function(_0x33602d){if(_0x33602d){_0x445348['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x4536('0x9d'),'appdata':_0x33602d[_0x4536('0x39')]+','+(_0x445348[_0x4536('0x84')][_0x4536('0x9e')]||0xa),'interval':'*,*,*,*'});_0x445348['forcedOwnership']=![];}return respondWithRpcPromise(_0x4536('0x9f'),_0x4536('0xa0'),_0x445348);});}return respondWithRpcPromise(_0x4536('0x9f'),_0x4536('0xa0'),_0x445348);})['then'](function(_0x22a2d7){respondWithRpcPromise('EventManager',_0x4536('0xa1'),{'event':_0x4536('0xa2'),'message':_0x22a2d7},client9002);return _0x22a2d7;})[_0x4536('0x1f')](respondWithResult(_0x153f42,null))[_0x4536('0x28')](handleError(_0x153f42,null));};exports[_0x4536('0xa3')]=function(_0xf1d06,_0x3b1ba9){var _0x4f64f5=_0xf1d06[_0x4536('0x61')]['id'];var _0x3a5481=_0xf1d06[_0x4536('0x60')];var _0x38e977=0xc8;var _0x3179de=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x4536('0xa4')][_0x4536('0xa5')]['ISOLATION_LEVELS'][_0x4536('0xa6')]},function(_0x53ed48){return db[_0x4536('0x3d')][_0x4536('0x67')]({'where':{'id':_0x4f64f5},'transaction':_0x53ed48})[_0x4536('0x1f')](function(_0x46801f){if(_0x46801f){return db[_0x4536('0x82')][_0x4536('0x36')]({'where':{'OpenchannelAccountId':_0x4f64f5},'transaction':_0x53ed48})['then'](function(){var _0x1fd659=_[_0x4536('0x3c')](_0x3a5481,function(_0x201a38){_0x201a38[_0x4536('0x64')]=_0x4f64f5;return _0x201a38;});return db[_0x4536('0x82')]['bulkCreate'](_0x1fd659,{'transaction':_0x53ed48});});}else{_0x38e977=0x194;_0x3179de=[];}});})['then'](function(){if(_0x38e977!==0x194){return db[_0x4536('0x82')][_0x4536('0xa7')]({'where':{'OpenchannelAccountId':_0x4f64f5},'order':_0x4536('0x87')})[_0x4536('0x1f')](function(_0x3e106d){_0x3179de=_0x3e106d;});}})[_0x4536('0x28')](function(_0x167042){_0x38e977=0x1f4;logger[_0x4536('0x24')](_0x167042[_0x4536('0x38')]);if(_0x167042[_0x4536('0x39')]){delete _0x167042[_0x4536('0x39')];}_0x3179de=_0x167042;})[_0x4536('0xa8')](function(){if(_0x3179de===null){_0x3b1ba9[_0x4536('0x37')](_0x38e977);}else{if(_0x38e977===0x1f4){_0x3b1ba9[_0x4536('0x29')](_0x38e977)[_0x4536('0x3a')](_0x3179de);}else{_0x3b1ba9[_0x4536('0x29')](_0x38e977)[_0x4536('0x2b')](_0x3179de);}}});};exports[_0x4536('0xa9')]=function(_0x5b0ea3,_0x7f1903,_0x57b6bc){var _0xea923c={};var _0x46b8e9={};var _0x1ecc2f;var _0x4f9f49;return db[_0x4536('0x3d')][_0x4536('0x67')]({'where':{'id':_0x5b0ea3[_0x4536('0x61')]['id']}})[_0x4536('0x1f')](handleEntityNotFound(_0x7f1903,null))[_0x4536('0x1f')](function(_0x42eb10){if(_0x42eb10){_0x1ecc2f=_0x42eb10;_0x46b8e9[_0x4536('0x42')]=_[_0x4536('0x43')](db['OpenchannelApplication'][_0x4536('0x3e')]);_0x46b8e9[_0x4536('0x44')]=_[_0x4536('0x43')](_0x5b0ea3['query']);_0x46b8e9['filters']=_[_0x4536('0x46')](_0x46b8e9[_0x4536('0x42')],_0x46b8e9[_0x4536('0x44')]);_0xea923c['attributes']=_[_0x4536('0x46')](_0x46b8e9['model'],qs[_0x4536('0x47')](_0x5b0ea3['query'][_0x4536('0x47')]));_0xea923c[_0x4536('0x45')]=_0xea923c[_0x4536('0x45')][_0x4536('0x48')]?_0xea923c[_0x4536('0x45')]:_0x46b8e9[_0x4536('0x42')];_0xea923c['order']=qs['sort'](_0x5b0ea3['query'][_0x4536('0x4c')]);_0xea923c[_0x4536('0x4d')]=qs[_0x4536('0x4e')](_[_0x4536('0x4f')](_0x5b0ea3[_0x4536('0x44')],_0x46b8e9[_0x4536('0x4e')]));if(_0x5b0ea3[_0x4536('0x44')]['filter']){_0xea923c[_0x4536('0x4d')]=_['merge'](_0xea923c[_0x4536('0x4d')],{'$or':_[_0x4536('0x3c')](_0xea923c[_0x4536('0x45')],function(_0x9d639e){var _0x24b9aa={};_0x24b9aa[_0x9d639e]={'$like':'%'+_0x5b0ea3[_0x4536('0x44')][_0x4536('0x51')]+'%'};return _0x24b9aa;})});}_0xea923c=_[_0x4536('0x68')]({},_0xea923c,_0x5b0ea3[_0x4536('0x52')]);return _0x1ecc2f['getApplications'](_0xea923c);}})[_0x4536('0x1f')](function(_0x5f41e1){if(_0x5f41e1){_0x4f9f49=_0x5f41e1[_0x4536('0x48')];if(!_0x5b0ea3[_0x4536('0x44')]['hasOwnProperty'](_0x4536('0x49'))){_0xea923c[_0x4536('0x4a')]=qs[_0x4536('0x4a')](_0x5b0ea3[_0x4536('0x44')][_0x4536('0x4a')]);_0xea923c[_0x4536('0x2e')]=qs[_0x4536('0x2e')](_0x5b0ea3['query']['offset']);}return _0x1ecc2f[_0x4536('0xa9')](_0xea923c);}})[_0x4536('0x1f')](function(_0xc5db77){if(_0xc5db77){return _0xc5db77?{'count':_0x4f9f49,'rows':_0xc5db77}:null;}})[_0x4536('0x1f')](respondWithResult(_0x7f1903,null))[_0x4536('0x28')](handleError(_0x7f1903,null));};exports['getInteractions']=function(_0x118b0d,_0x13027a,_0x54ce08){var _0x211841={'raw':![],'where':{}};var _0x30937f={};var _0x4c8646={'count':0x0,'rows':[]};return db[_0x4536('0x3d')]['findOne']({'where':{'id':_0x118b0d[_0x4536('0x61')]['id']}})[_0x4536('0x1f')](handleEntityNotFound(_0x13027a,null))[_0x4536('0x1f')](function(_0x7771a4){if(_0x7771a4){_0x30937f[_0x4536('0x42')]=_[_0x4536('0x43')](db[_0x4536('0x8e')][_0x4536('0x3e')]);_0x30937f[_0x4536('0x44')]=_[_0x4536('0x43')](_0x118b0d['query']);_0x30937f[_0x4536('0x4e')]=_[_0x4536('0x46')](_0x30937f[_0x4536('0x42')],_0x30937f['query']);_0x211841[_0x4536('0x45')]=_[_0x4536('0x46')](_0x30937f[_0x4536('0x42')],qs['fields'](_0x118b0d[_0x4536('0x44')][_0x4536('0x47')]));_0x211841['attributes']=_0x211841[_0x4536('0x45')][_0x4536('0x48')]?_0x211841['attributes']:_0x30937f['model'];if(!_0x118b0d[_0x4536('0x44')][_0x4536('0xaa')]('nolimit')){_0x211841[_0x4536('0x4a')]=qs[_0x4536('0x4a')](_0x118b0d[_0x4536('0x44')]['limit']);_0x211841[_0x4536('0x2e')]=qs[_0x4536('0x2e')](_0x118b0d[_0x4536('0x44')][_0x4536('0x2e')]);}_0x211841[_0x4536('0x4b')]=qs[_0x4536('0x4c')](_0x118b0d[_0x4536('0x44')][_0x4536('0x4c')]);_0x211841['where']=qs[_0x4536('0x4e')](_[_0x4536('0x4f')](_0x118b0d[_0x4536('0x44')],_0x30937f[_0x4536('0x4e')]));_0x211841[_0x4536('0x4d')][_0x4536('0x64')]=_0x7771a4['id'];if(_0x118b0d[_0x4536('0x44')]['filter']){_0x211841[_0x4536('0x4d')]=_[_0x4536('0x68')](_0x211841[_0x4536('0x4d')],{'$or':_['map'](_0x211841[_0x4536('0x45')],function(_0x4ab98d){var _0x2b5b2c={};_0x2b5b2c[_0x4ab98d]={'$like':'%'+_0x118b0d['query']['filter']+'%'};return _0x2b5b2c;})});}_0x211841=_[_0x4536('0x68')]({},_0x211841,_0x118b0d[_0x4536('0x52')]);return db[_0x4536('0x8e')]['count']({'where':_0x211841[_0x4536('0x4d')]})[_0x4536('0x1f')](function(_0x19ac67){_0x4c8646[_0x4536('0x2d')]=_0x19ac67;if(_0x118b0d[_0x4536('0x44')][_0x4536('0x6d')]){_0x211841[_0x4536('0x53')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0x4536('0xab'),'attributes':[_0x4536('0x39'),_0x4536('0xac'),_0x4536('0xad')],'required':![]},{'model':db[_0x4536('0xae')],'as':_0x4536('0xaf'),'attributes':['id',_0x4536('0x39'),_0x4536('0xb0')],'where':_0x118b0d[_0x4536('0x44')]['tag']?{'id':_0x118b0d[_0x4536('0x44')][_0x4536('0xb1')]}:undefined,'required':_0x118b0d[_0x4536('0x44')][_0x4536('0xb1')]?!![]:![]}];}return db[_0x4536('0x8e')]['findAll'](_0x211841);})[_0x4536('0x1f')](function(_0x175ae6){_0x4c8646[_0x4536('0x55')]=_0x175ae6;return _0x4c8646;});}})[_0x4536('0x1f')](respondWithFilteredResult(_0x13027a,_0x211841))['catch'](handleError(_0x13027a,null));};exports[_0x4536('0xb2')]=function(_0x14fcc7,_0xeab7f5,_0x5b9dec){return db[_0x4536('0x3d')][_0x4536('0x58')]({'where':{'id':_0x14fcc7['params']['id']}})['then'](handleEntityNotFound(_0xeab7f5,null))[_0x4536('0x1f')](function(_0x4d260f){if(_0x4d260f){return _0x4d260f[_0x4536('0xb2')](_0x14fcc7[_0x4536('0x60')][_0x4536('0x6a')],_[_0x4536('0xb3')](_0x14fcc7[_0x4536('0x60')],['ids','id'])||{})['spread'](function(_0x5f3c63){for(var _0x50c8aa=0x0;_0x50c8aa<_0x14fcc7[_0x4536('0x60')][_0x4536('0x6a')][_0x4536('0x48')];_0x50c8aa+=0x1){socket['emit']('userOpenchannelAccount:save',{'UserId':Number(_0x14fcc7[_0x4536('0x60')]['ids'][_0x50c8aa]),'OpenchannelAccountId':Number(_0x14fcc7[_0x4536('0x61')]['id'])});}return _0x5f3c63;});}})[_0x4536('0x1f')](respondWithResult(_0xeab7f5,null))[_0x4536('0x28')](handleError(_0xeab7f5,null));};exports[_0x4536('0xb4')]=function(_0x3b5f47,_0x341c30,_0x551d63){return db[_0x4536('0x3d')][_0x4536('0x58')]({'where':{'id':_0x3b5f47[_0x4536('0x61')]['id']}})[_0x4536('0x1f')](handleEntityNotFound(_0x341c30,null))['then'](function(_0x4ea533){if(_0x4ea533){return _0x4ea533[_0x4536('0xb4')](_0x3b5f47[_0x4536('0x44')]['ids'])['then'](function(){if(_[_0x4536('0xb5')](_0x3b5f47[_0x4536('0x44')]['ids'])){for(var _0x64ccc2=0x0;_0x64ccc2<_0x3b5f47[_0x4536('0x44')]['ids'][_0x4536('0x48')];_0x64ccc2+=0x1){socket[_0x4536('0xb6')](_0x4536('0xb7'),{'UserId':Number(_0x3b5f47[_0x4536('0x44')][_0x4536('0x6a')][_0x64ccc2]),'OpenchannelAccountId':Number(_0x3b5f47['params']['id'])});}}else{socket[_0x4536('0xb6')](_0x4536('0xb7'),{'UserId':Number(_0x3b5f47[_0x4536('0x44')][_0x4536('0x6a')]),'OpenchannelAccountId':Number(_0x3b5f47[_0x4536('0x61')]['id'])});}});}})[_0x4536('0x1f')](respondWithStatusCode(_0x341c30,null))['catch'](handleError(_0x341c30,null));};exports['getAgents']=function(_0x5641ba,_0x96d783,_0x18c463){var _0x24ac47={};var _0x43ca0f={};var _0x596a81;var _0xa30ae3;return db[_0x4536('0x3d')]['findOne']({'where':{'id':_0x5641ba[_0x4536('0x61')]['id']}})[_0x4536('0x1f')](handleEntityNotFound(_0x96d783,null))[_0x4536('0x1f')](function(_0x53ed0e){if(_0x53ed0e){_0x596a81=_0x53ed0e;_0x43ca0f[_0x4536('0x42')]=_['keys'](db[_0x4536('0x9b')][_0x4536('0x3e')]);_0x43ca0f[_0x4536('0x44')]=_[_0x4536('0x43')](_0x5641ba[_0x4536('0x44')]);_0x43ca0f['filters']=_[_0x4536('0x46')](_0x43ca0f[_0x4536('0x42')],_0x43ca0f[_0x4536('0x44')]);_0x24ac47[_0x4536('0x45')]=_['intersection'](_0x43ca0f[_0x4536('0x42')],qs['fields'](_0x5641ba[_0x4536('0x44')][_0x4536('0x47')]));_0x24ac47[_0x4536('0x45')]=_0x24ac47[_0x4536('0x45')][_0x4536('0x48')]?_0x24ac47['attributes']:_0x43ca0f['model'];_0x24ac47['order']=qs[_0x4536('0x4c')](_0x5641ba[_0x4536('0x44')][_0x4536('0x4c')]);_0x24ac47[_0x4536('0x4d')]=qs[_0x4536('0x4e')](_[_0x4536('0x4f')](_0x5641ba[_0x4536('0x44')],_0x43ca0f[_0x4536('0x4e')]));if(_0x5641ba[_0x4536('0x44')]['filter']){_0x24ac47[_0x4536('0x4d')]=_['merge'](_0x24ac47[_0x4536('0x4d')],{'$or':_['map'](_0x24ac47[_0x4536('0x45')],function(_0x4d5348){var _0x399f6b={};_0x399f6b[_0x4d5348]={'$like':'%'+_0x5641ba[_0x4536('0x44')][_0x4536('0x51')]+'%'};return _0x399f6b;})});}_0x24ac47=_[_0x4536('0x68')]({},_0x24ac47,_0x5641ba[_0x4536('0x52')]);return _0x596a81[_0x4536('0xb8')](_0x24ac47);}})['then'](function(_0x2e392c){if(_0x2e392c){_0xa30ae3=_0x2e392c[_0x4536('0x48')];if(!_0x5641ba[_0x4536('0x44')][_0x4536('0xaa')](_0x4536('0x49'))){_0x24ac47[_0x4536('0x4a')]=qs['limit'](_0x5641ba[_0x4536('0x44')]['limit']);_0x24ac47[_0x4536('0x2e')]=qs['offset'](_0x5641ba[_0x4536('0x44')][_0x4536('0x2e')]);}return _0x596a81[_0x4536('0xb8')](_0x24ac47);}})[_0x4536('0x1f')](function(_0x51d346){if(_0x51d346){return _0x51d346?{'count':_0xa30ae3,'rows':_0x51d346}:null;}})[_0x4536('0x1f')](respondWithResult(_0x96d783,null))['catch'](handleError(_0x96d783,null));};exports[_0x4536('0x3a')]=function(_0x4c9743,_0x975d2b,_0x41007a){var _0x1ba904,_0x418e40,_0x2272ad;if(_[_0x4536('0x76')](_0x4c9743['body'][_0x4536('0x60')])||_0x4c9743['body'][_0x4536('0x60')]===''){throw new db[(_0x4536('0x77'))]['ValidationError'](_0x4536('0x79'));}if(_[_0x4536('0x76')](_0x4c9743['body']['to'])){}_0x1ba904=_0x4c9743[_0x4536('0x60')]['to'];return db[_0x4536('0x3d')][_0x4536('0x67')]({'where':{'id':_0x4c9743[_0x4536('0x61')]['id']}})[_0x4536('0x1f')](handleEntityNotFound(_0x975d2b,null))[_0x4536('0x1f')](function(_0x5dde01){if(_0x5dde01){return db[_0x4536('0x3d')]['find']({'where':{'id':_0x5dde01['id']},'include':[{'model':db['CmList'],'as':_0x4536('0x7f'),'include':[{'model':db['CmContact'],'as':_0x4536('0x80'),'where':{[_0x5dde01['mapKey']]:_0x1ba904},'limit':0x1,'order':[[_0x4536('0x74'),_0x4536('0x81')]]}]}]})[_0x4536('0x1f')](handleEntityNotFound(_0x975d2b,null))['then'](function(_0x235c18){if(_0x235c18&&_0x235c18[_0x4536('0x7f')]){_0x418e40=_0x235c18[_0x4536('0x33')]({'plain':!![]});if(_0x418e40['List']&&_0x418e40[_0x4536('0x7f')]['Contacts'][_0x4536('0x48')]){return _0x418e40['List'][_0x4536('0x80')][0x0];}return db['CmContact'][_0x4536('0x59')](_['defaults'](_0x4c9743['body'],{'firstName':_0x1ba904,[_0x235c18[_0x4536('0x7a')]]:_0x1ba904,'phone':_0x1ba904,'ListId':_0x418e40[_0x4536('0x75')]}));}})[_0x4536('0x1f')](handleEntityNotFound(_0x975d2b,null))[_0x4536('0x1f')](function(_0x59bbc8){if(_0x59bbc8){_0x2272ad=_0x59bbc8;return db[_0x4536('0x8e')][_0x4536('0x58')]({'where':{'ContactId':_0x2272ad['id'],'closed':![],'OpenchannelAccountId':_0x418e40['id']}})[_0x4536('0x1f')](function(_0x50601d){if(_0x50601d){return[_0x50601d,![]];}return db['OpenchannelInteraction'][_0x4536('0x59')]({'UserId':_0x4c9743[_0x4536('0x5a')]['id'],'ContactId':_0x2272ad['id'],'OpenchannelAccountId':_0x418e40['id'],'lastMsgDirection':_0x4536('0xb9'),'Messages':[_[_0x4536('0x68')](_0x4c9743['body'],{'read':![],'body':_0x4c9743[_0x4536('0x60')][_0x4536('0x60')],'OpenchannelAccountId':_0x418e40['id'],'UserId':_0x4c9743[_0x4536('0x5a')]['id'],'ContactId':_0x2272ad['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x4536('0xba')}]})[_0x4536('0x1f')](function(_0x4a3828){return[_0x4a3828,!![]];});});}})['spread'](function(_0x114364,_0x203d3c){if(_0x203d3c){return _0x114364;}return db[_0x4536('0x99')][_0x4536('0x59')](_[_0x4536('0x68')](_0x4c9743['body'],{'read':![],'body':_0x4c9743[_0x4536('0x60')][_0x4536('0x60')],'OpenchannelAccountId':_0x418e40['id'],'OpenchannelInteractionId':_0x114364['id'],'UserId':_0x4c9743[_0x4536('0x5a')]['id'],'ContactId':_0x2272ad['id']}))[_0x4536('0x1f')](function(_0x56aaca){_0x114364['dataValues']['Messages']=[];_0x114364['dataValues'][_0x4536('0xba')][_0x4536('0x96')](_0x56aaca[_0x4536('0xbb')]);return _0x114364;});});}})['then'](respondWithResult(_0x975d2b,null))[_0x4536('0x28')](handleError(_0x975d2b,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 43aeede..b21b7a7 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 _0x3c81=['hook','exports','events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x27a900,_0x1cc305){var _0xea9b1f=function(_0xaddd55){while(--_0xaddd55){_0x27a900['push'](_0x27a900['shift']());}};_0xea9b1f(++_0x1cc305);}(_0x3c81,0x102));var _0x13c8=function(_0x3d5ae5,_0x4848fe){_0x3d5ae5=_0x3d5ae5-0x0;var _0x2f6e4d=_0x3c81[_0x3d5ae5];return _0x2f6e4d;};'use strict';var EventEmitter=require(_0x13c8('0x0'));var OpenchannelAccount=require(_0x13c8('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x13c8('0x2')](0x0);var events={'afterCreate':_0x13c8('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5c3ba4){return function(_0x548599,_0x101d4f,_0x3ec886){OpenchannelAccountEvents[_0x13c8('0x4')](_0x5c3ba4+':'+_0x548599['id'],_0x548599);OpenchannelAccountEvents[_0x13c8('0x4')](_0x5c3ba4,_0x548599);_0x3ec886(null);};}for(var e in events){if(events[_0x13c8('0x5')](e)){var event=events[e];OpenchannelAccount[_0x13c8('0x6')](e,emitEvent(event));}}module[_0x13c8('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x9bde=['exports','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x5649c2,_0x5c8d04){var _0x28b072=function(_0x17c1a0){while(--_0x17c1a0){_0x5649c2['push'](_0x5649c2['shift']());}};_0x28b072(++_0x5c8d04);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5eca38,_0x3019ba){_0x5eca38=_0x5eca38-0x0;var _0x54f40d=_0x9bde[_0x5eca38];return _0x54f40d;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xe9bd('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xe9bd('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe9bd('0x2'),'afterDestroy':_0xe9bd('0x3')};function emitEvent(_0x131f6a){return function(_0x1c1b34,_0x10822d,_0x1a4d14){OpenchannelAccountEvents[_0xe9bd('0x4')](_0x131f6a+':'+_0x1c1b34['id'],_0x1c1b34);OpenchannelAccountEvents['emit'](_0x131f6a,_0x1c1b34);_0x1a4d14(null);};}for(var e in events){if(events[_0xe9bd('0x5')](e)){var event=events[e];OpenchannelAccount[_0xe9bd('0x6')](e,emitEvent(event));}}module[_0xe9bd('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 4216acb..7c27edc 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(_0x3a94d8,_0x45d89b){var _0x53616d=function(_0x9f853c){while(--_0x9f853c){_0x3a94d8['push'](_0x3a94d8['shift']());}};_0x53616d(++_0x45d89b);}(_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':'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(_0x76cca0,_0x2389bf){var _0x58d896=function(_0x4022d7){while(--_0x4022d7){_0x76cca0['push'](_0x76cca0['shift']());}};_0x58d896(++_0x2389bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 ca01a69..692d888 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 _0x0647=['jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x0647,0xd0));var _0x7064=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0x0647[_0xcd0918];return _0x250704;};'use strict';var _=require(_0x7064('0x0'));var util=require('util');var moment=require(_0x7064('0x1'));var BPromise=require(_0x7064('0x2'));var rs=require(_0x7064('0x3'));var fs=require('fs');var Redis=require(_0x7064('0x4'));var db=require(_0x7064('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7064('0x6'));var config=require(_0x7064('0x7'));var jayson=require(_0x7064('0x8'));var client=jayson[_0x7064('0x9')][_0x7064('0xa')]({'port':0x232a});config[_0x7064('0xb')]=_['defaults'](config['redis'],{'host':_0x7064('0xc'),'port':0x18eb});var socket=require(_0x7064('0xd'))(new Redis(config[_0x7064('0xb')]));require('./openchannelAccount.socket')[_0x7064('0xe')](socket);function respondWithRpcPromise(_0x3f3bdd,_0x5f4ba5,_0xd2aec9){return new BPromise(function(_0x1465bd,_0x3fc84f){return client['request'](_0x3f3bdd,_0xd2aec9)[_0x7064('0xf')](function(_0x17a558){logger[_0x7064('0x10')](_0x7064('0x11'),_0x5f4ba5,'request\x20sent');logger[_0x7064('0x12')](_0x7064('0x13'),_0x5f4ba5,_0x7064('0x14'),JSON[_0x7064('0x15')](_0x17a558));if(_0x17a558[_0x7064('0x16')]){if(_0x17a558[_0x7064('0x16')][_0x7064('0x17')]===0x1f4){logger[_0x7064('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x5f4ba5,_0x17a558['error']['message']);return _0x3fc84f(_0x17a558[_0x7064('0x16')][_0x7064('0x18')]);}logger[_0x7064('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x5f4ba5,_0x17a558[_0x7064('0x16')][_0x7064('0x18')]);return _0x1465bd(_0x17a558['error'][_0x7064('0x18')]);}else{logger[_0x7064('0x10')](_0x7064('0x11'),_0x5f4ba5,_0x7064('0x14'));_0x1465bd(_0x17a558[_0x7064('0x19')][_0x7064('0x18')]);}})[_0x7064('0x1a')](function(_0x3e8d73){logger[_0x7064('0x16')](_0x7064('0x11'),_0x5f4ba5,_0x3e8d73);_0x3fc84f(_0x3e8d73);});});} \ No newline at end of file +var _0x235a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x235a,0x1ef));var _0xa235=function(_0x2657a8,_0x442b0e){_0x2657a8=_0x2657a8-0x0;var _0x1e6c3e=_0x235a[_0x2657a8];return _0x1e6c3e;};'use strict';var _=require(_0xa235('0x0'));var util=require(_0xa235('0x1'));var moment=require(_0xa235('0x2'));var BPromise=require('bluebird');var rs=require(_0xa235('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa235('0x4'))['db'];var utils=require(_0xa235('0x5'));var logger=require(_0xa235('0x6'))(_0xa235('0x7'));var config=require(_0xa235('0x8'));var jayson=require(_0xa235('0x9'));var client=jayson[_0xa235('0xa')][_0xa235('0xb')]({'port':0x232a});config['redis']=_[_0xa235('0xc')](config[_0xa235('0xd')],{'host':_0xa235('0xe'),'port':0x18eb});var socket=require(_0xa235('0xf'))(new Redis(config['redis']));require(_0xa235('0x10'))['register'](socket);function respondWithRpcPromise(_0x560eb1,_0x10bb4f,_0x504b60){return new BPromise(function(_0xbde1c7,_0x535bb9){return client['request'](_0x560eb1,_0x504b60)['then'](function(_0x464a85){logger[_0xa235('0x11')](_0xa235('0x12'),_0x10bb4f,_0xa235('0x13'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x10bb4f,'request\x20sent',JSON[_0xa235('0x14')](_0x464a85));if(_0x464a85[_0xa235('0x15')]){if(_0x464a85[_0xa235('0x15')][_0xa235('0x16')]===0x1f4){logger[_0xa235('0x15')](_0xa235('0x12'),_0x10bb4f,_0x464a85[_0xa235('0x15')][_0xa235('0x17')]);return _0x535bb9(_0x464a85[_0xa235('0x15')]['message']);}logger[_0xa235('0x15')](_0xa235('0x12'),_0x10bb4f,_0x464a85[_0xa235('0x15')][_0xa235('0x17')]);return _0xbde1c7(_0x464a85[_0xa235('0x15')][_0xa235('0x17')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x10bb4f,_0xa235('0x13'));_0xbde1c7(_0x464a85[_0xa235('0x18')][_0xa235('0x17')]);}})['catch'](function(_0x40b4a9){logger[_0xa235('0x15')](_0xa235('0x12'),_0x10bb4f,_0x40b4a9);_0x535bb9(_0x40b4a9);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 074cb02..64335ee 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 _0x8cfd=['emit','removeListener','register','openchannelAccount:','./openchannelAccount.events','save','remove','update'];(function(_0xba290e,_0x1e7596){var _0x3fbd79=function(_0xe75668){while(--_0xe75668){_0xba290e['push'](_0xba290e['shift']());}};_0x3fbd79(++_0x1e7596);}(_0x8cfd,0xe4));var _0xd8cf=function(_0x3f6b1b,_0x58d3d6){_0x3f6b1b=_0x3f6b1b-0x0;var _0x4a3d2b=_0x8cfd[_0x3f6b1b];return _0x4a3d2b;};'use strict';var OpenchannelAccountEvents=require(_0xd8cf('0x0'));var events=[_0xd8cf('0x1'),_0xd8cf('0x2'),_0xd8cf('0x3')];function createListener(_0x6ea39,_0x30dc05){return function(_0x562c81){_0x30dc05[_0xd8cf('0x4')](_0x6ea39,_0x562c81);};}function removeListener(_0x1146ed,_0x35b295){return function(){OpenchannelAccountEvents[_0xd8cf('0x5')](_0x1146ed,_0x35b295);};}exports[_0xd8cf('0x6')]=function(_0x318a72){for(var _0x305768=0x0,_0x4b41b7=events['length'];_0x305768<_0x4b41b7;_0x305768++){var _0x3fe2d2=events[_0x305768];var _0xa5b446=createListener(_0xd8cf('0x7')+_0x3fe2d2,_0x318a72);OpenchannelAccountEvents['on'](_0x3fe2d2,_0xa5b446);}}; \ No newline at end of file +var _0x2621=['register','length','./openchannelAccount.events','save','remove','update','emit','removeListener'];(function(_0x42be53,_0x3fe666){var _0x42655a=function(_0x36bab2){while(--_0x36bab2){_0x42be53['push'](_0x42be53['shift']());}};_0x42655a(++_0x3fe666);}(_0x2621,0x1d2));var _0x1262=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2621[_0x14add3];return _0x4a174f;};'use strict';var OpenchannelAccountEvents=require(_0x1262('0x0'));var events=[_0x1262('0x1'),_0x1262('0x2'),_0x1262('0x3')];function createListener(_0x1e5b47,_0x44878a){return function(_0x2dfe65){_0x44878a[_0x1262('0x4')](_0x1e5b47,_0x2dfe65);};}function removeListener(_0x192339,_0x3a6d7f){return function(){OpenchannelAccountEvents[_0x1262('0x5')](_0x192339,_0x3a6d7f);};}exports[_0x1262('0x6')]=function(_0x421716){for(var _0x16075c=0x0,_0x4d4535=events[_0x1262('0x7')];_0x16075c<_0x4d4535;_0x16075c++){var _0x52af34=events[_0x16075c];var _0xaa3c86=createListener('openchannelAccount:'+_0x52af34,_0x421716);OpenchannelAccountEvents['on'](_0x52af34,_0xaa3c86);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 693682b..c2000b1 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 _0x06c8=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','create','put','/:id','update','destroy','exports','multer'];(function(_0x393ea0,_0x2a6d70){var _0x3ee6f3=function(_0x753b0d){while(--_0x753b0d){_0x393ea0['push'](_0x393ea0['shift']());}};_0x3ee6f3(++_0x2a6d70);}(_0x06c8,0xc7));var _0x806c=function(_0x48e52d,_0x27b477){_0x48e52d=_0x48e52d-0x0;var _0x870b49=_0x06c8[_0x48e52d];return _0x870b49;};'use strict';var multer=require(_0x806c('0x0'));var util=require(_0x806c('0x1'));var path=require(_0x806c('0x2'));var timeout=require(_0x806c('0x3'));var express=require(_0x806c('0x4'));var router=express[_0x806c('0x5')]();var fs_extra=require(_0x806c('0x6'));var auth=require(_0x806c('0x7'));var interaction=require(_0x806c('0x8'));var config=require(_0x806c('0x9'));var controller=require('./openchannelApplication.controller');router[_0x806c('0xa')]('/',auth['isAuthenticated'](),controller[_0x806c('0xb')]);router[_0x806c('0xa')]('/:id',auth[_0x806c('0xc')](),controller[_0x806c('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x806c('0xe')]);router[_0x806c('0xf')](_0x806c('0x10'),auth[_0x806c('0xc')](),controller[_0x806c('0x11')]);router['delete'](_0x806c('0x10'),auth[_0x806c('0xc')](),controller[_0x806c('0x12')]);module[_0x806c('0x13')]=router; \ No newline at end of file +var _0x010a=['/:id','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','isAuthenticated','post','create','put'];(function(_0xfc4fd4,_0x20b298){var _0x5971ad=function(_0x54c4c7){while(--_0x54c4c7){_0xfc4fd4['push'](_0xfc4fd4['shift']());}};_0x5971ad(++_0x20b298);}(_0x010a,0x1b4));var _0xa010=function(_0x419fce,_0x1f3b45){_0x419fce=_0x419fce-0x0;var _0x5033e1=_0x010a[_0x419fce];return _0x5033e1;};'use strict';var multer=require(_0xa010('0x0'));var util=require(_0xa010('0x1'));var path=require(_0xa010('0x2'));var timeout=require('connect-timeout');var express=require(_0xa010('0x3'));var router=express[_0xa010('0x4')]();var fs_extra=require(_0xa010('0x5'));var auth=require(_0xa010('0x6'));var interaction=require(_0xa010('0x7'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xa010('0x8')]);router[_0xa010('0x9')]('/:id',auth[_0xa010('0xa')](),controller['show']);router[_0xa010('0xb')]('/',auth[_0xa010('0xa')](),controller[_0xa010('0xc')]);router[_0xa010('0xd')](_0xa010('0xe'),auth[_0xa010('0xa')](),controller[_0xa010('0xf')]);router[_0xa010('0x10')]('/:id',auth[_0xa010('0xa')](),controller['destroy']);module[_0xa010('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index d63e7e9..097f65c 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 _0x7548=['*,*,*,*','exports','INTEGER','STRING','noop','TEXT'];(function(_0x20e283,_0x2b5a6e){var _0x199e10=function(_0xaccd3a){while(--_0xaccd3a){_0x20e283['push'](_0x20e283['shift']());}};_0x199e10(++_0x2b5a6e);}(_0x7548,0x157));var _0x8754=function(_0x4b0017,_0x4345c8){_0x4b0017=_0x4b0017-0x0;var _0x3ee410=_0x7548[_0x4b0017];return _0x3ee410;};'use strict';var Sequelize=require('sequelize');module[_0x8754('0x0')]={'priority':{'type':Sequelize[_0x8754('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x8754('0x2')],'allowNull':![],'defaultValue':_0x8754('0x3')},'appdata':{'type':Sequelize[_0x8754('0x4')]()},'description':{'type':Sequelize[_0x8754('0x2')]},'interval':{'type':Sequelize[_0x8754('0x2')],'defaultValue':_0x8754('0x5')}}; \ No newline at end of file +var _0xf695=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf695,0x11c));var _0x5f69=function(_0x217224,_0x1563b2){_0x217224=_0x217224-0x0;var _0x136b48=_0xf695[_0x217224];return _0x136b48;};'use strict';var Sequelize=require(_0x5f69('0x0'));module[_0x5f69('0x1')]={'priority':{'type':Sequelize[_0x5f69('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5f69('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x5f69('0x4')]},'interval':{'type':Sequelize[_0x5f69('0x4')],'defaultValue':_0x5f69('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 073e32a..82ff9ee 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 _0xb763=['undefined','limit','count','set','Content-Range','apply','save','then','destroy','stack','name','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','length','find','catch','create','body','update','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x272734,_0x5e33e4){var _0x1f7aa0=function(_0x541ec3){while(--_0x541ec3){_0x272734['push'](_0x272734['shift']());}};_0x1f7aa0(++_0x5e33e4);}(_0xb763,0x195));var _0x3b76=function(_0x37e51d,_0xf9e104){_0x37e51d=_0x37e51d-0x0;var _0x2812b8=_0xb763[_0x37e51d];return _0x2812b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b76('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3b76('0x1'));var rp=require(_0x3b76('0x2'));var moment=require(_0x3b76('0x3'));var BPromise=require(_0x3b76('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3b76('0x5'));var sox=require(_0x3b76('0x6'));var csv=require('to-csv');var ejs=require(_0x3b76('0x7'));var fs=require('fs');var fs_extra=require(_0x3b76('0x8'));var _=require(_0x3b76('0x9'));var squel=require(_0x3b76('0xa'));var crypto=require('crypto');var jsforce=require(_0x3b76('0xb'));var deskjs=require(_0x3b76('0xc'));var toCsv=require(_0x3b76('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3b76('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3b76('0xf'));var hardwareService=require(_0x3b76('0x10'));var logger=require('../../config/logger')(_0x3b76('0x11'));var utils=require(_0x3b76('0x12'));var config=require(_0x3b76('0x13'));var licenseUtil=require(_0x3b76('0x14'));var db=require(_0x3b76('0x15'))['db'];function respondWithStatusCode(_0x73fed1,_0x4f0bdf){_0x4f0bdf=_0x4f0bdf||0xcc;return function(_0x218c14){if(_0x218c14){return _0x73fed1[_0x3b76('0x16')](_0x4f0bdf);}return _0x73fed1[_0x3b76('0x17')](_0x4f0bdf)[_0x3b76('0x18')]();};}function respondWithResult(_0x3394a7,_0x27d6ee){_0x27d6ee=_0x27d6ee||0xc8;return function(_0x4639e3){if(_0x4639e3){return _0x3394a7[_0x3b76('0x17')](_0x27d6ee)[_0x3b76('0x19')](_0x4639e3);}};}function respondWithFilteredResult(_0x1457cd,_0x13ed18){return function(_0x134fc9){if(_0x134fc9){var _0x52cdd3=typeof _0x13ed18[_0x3b76('0x1a')]===_0x3b76('0x1b')&&typeof _0x13ed18[_0x3b76('0x1c')]===_0x3b76('0x1b');var _0x2502f2=_0x134fc9[_0x3b76('0x1d')];var _0x521c0a=_0x52cdd3?0x0:_0x13ed18['offset'];var _0x4a4fac=_0x52cdd3?_0x134fc9[_0x3b76('0x1d')]:_0x13ed18[_0x3b76('0x1a')]+_0x13ed18['limit'];var _0x3e504e;if(_0x4a4fac>=_0x2502f2){_0x4a4fac=_0x2502f2;_0x3e504e=0xc8;}else{_0x3e504e=0xce;}_0x1457cd['status'](_0x3e504e);return _0x1457cd[_0x3b76('0x1e')](_0x3b76('0x1f'),_0x521c0a+'-'+_0x4a4fac+'/'+_0x2502f2)[_0x3b76('0x19')](_0x134fc9);}return null;};}function patchUpdates(_0x19aa77){return function(_0xf2ca90){try{jsonpatch[_0x3b76('0x20')](_0xf2ca90,_0x19aa77,!![]);}catch(_0x54f2f5){return BPromise['reject'](_0x54f2f5);}return _0xf2ca90[_0x3b76('0x21')]();};}function saveUpdates(_0x532698,_0x421379){return function(_0x28eb34){if(_0x28eb34){return _0x28eb34['update'](_0x532698)[_0x3b76('0x22')](function(_0xe52a52){return _0xe52a52;});}return null;};}function removeEntity(_0x2de722,_0x110b22){return function(_0x1bc402){if(_0x1bc402){return _0x1bc402[_0x3b76('0x23')]()[_0x3b76('0x22')](function(){_0x2de722[_0x3b76('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d7e8f,_0x1426d7){return function(_0x387148){if(!_0x387148){_0x3d7e8f[_0x3b76('0x16')](0x194);}return _0x387148;};}function handleError(_0x20e136,_0x4b6a03){_0x4b6a03=_0x4b6a03||0x1f4;return function(_0x1a8741){logger['error'](_0x1a8741[_0x3b76('0x24')]);if(_0x1a8741[_0x3b76('0x25')]){delete _0x1a8741['name'];}_0x20e136['status'](_0x4b6a03)['send'](_0x1a8741);};}exports[_0x3b76('0x26')]=function(_0x56c0e7,_0x27e9a6){var _0x1c70de={},_0x4d9dca={},_0x42c00f={'count':0x0,'rows':[]};var _0x454fc1=_[_0x3b76('0x27')](db[_0x3b76('0x28')][_0x3b76('0x29')],function(_0x3b2622){return{'name':_0x3b2622[_0x3b76('0x2a')],'type':_0x3b2622[_0x3b76('0x2b')][_0x3b76('0x2c')]};});_0x4d9dca['model']=_[_0x3b76('0x27')](_0x454fc1,_0x3b76('0x25'));_0x4d9dca[_0x3b76('0x2d')]=_[_0x3b76('0x2e')](_0x56c0e7[_0x3b76('0x2d')]);_0x4d9dca['filters']=_[_0x3b76('0x2f')](_0x4d9dca[_0x3b76('0x30')],_0x4d9dca[_0x3b76('0x2d')]);_0x1c70de[_0x3b76('0x31')]=_[_0x3b76('0x2f')](_0x4d9dca[_0x3b76('0x30')],qs['fields'](_0x56c0e7['query'][_0x3b76('0x32')]));_0x1c70de['attributes']=_0x1c70de['attributes']['length']?_0x1c70de[_0x3b76('0x31')]:_0x4d9dca[_0x3b76('0x30')];if(!_0x56c0e7['query'][_0x3b76('0x33')](_0x3b76('0x34'))){_0x1c70de['limit']=qs[_0x3b76('0x1c')](_0x56c0e7[_0x3b76('0x2d')]['limit']);_0x1c70de[_0x3b76('0x1a')]=qs[_0x3b76('0x1a')](_0x56c0e7['query']['offset']);}_0x1c70de[_0x3b76('0x35')]=qs[_0x3b76('0x36')](_0x56c0e7[_0x3b76('0x2d')][_0x3b76('0x36')]);_0x1c70de[_0x3b76('0x37')]=qs[_0x3b76('0x38')](_['pick'](_0x56c0e7['query'],_0x4d9dca[_0x3b76('0x38')]),_0x454fc1);if(_0x56c0e7[_0x3b76('0x2d')][_0x3b76('0x39')]){_0x1c70de[_0x3b76('0x37')]=_[_0x3b76('0x3a')](_0x1c70de[_0x3b76('0x37')],{'$or':_[_0x3b76('0x27')](_0x454fc1,function(_0x11c375){if(_0x11c375[_0x3b76('0x2b')]!==_0x3b76('0x3b')){var _0x264a92={};_0x264a92[_0x11c375[_0x3b76('0x25')]]={'$like':'%'+_0x56c0e7[_0x3b76('0x2d')][_0x3b76('0x39')]+'%'};return _0x264a92;}})});}_0x1c70de=_[_0x3b76('0x3a')]({},_0x1c70de,_0x56c0e7[_0x3b76('0x3c')]);var _0x274658={'where':_0x1c70de['where']};return db['OpenchannelApplication'][_0x3b76('0x1d')](_0x274658)[_0x3b76('0x22')](function(_0x152ce4){_0x42c00f[_0x3b76('0x1d')]=_0x152ce4;if(_0x56c0e7[_0x3b76('0x2d')][_0x3b76('0x3d')]){_0x1c70de[_0x3b76('0x3e')]=[{'all':!![]}];}return db[_0x3b76('0x28')][_0x3b76('0x3f')](_0x1c70de);})[_0x3b76('0x22')](function(_0x9153d5){_0x42c00f[_0x3b76('0x40')]=_0x9153d5;return _0x42c00f;})['then'](respondWithFilteredResult(_0x27e9a6,_0x1c70de))['catch'](handleError(_0x27e9a6,null));};exports['show']=function(_0x289460,_0x20c7d1){var _0xaab01a={'raw':!![],'where':{'id':_0x289460[_0x3b76('0x41')]['id']}},_0x401525={};_0x401525[_0x3b76('0x30')]=_[_0x3b76('0x2e')](db[_0x3b76('0x28')][_0x3b76('0x29')]);_0x401525[_0x3b76('0x2d')]=_[_0x3b76('0x2e')](_0x289460[_0x3b76('0x2d')]);_0x401525[_0x3b76('0x38')]=_[_0x3b76('0x2f')](_0x401525[_0x3b76('0x30')],_0x401525[_0x3b76('0x2d')]);_0xaab01a[_0x3b76('0x31')]=_[_0x3b76('0x2f')](_0x401525['model'],qs['fields'](_0x289460[_0x3b76('0x2d')][_0x3b76('0x32')]));_0xaab01a[_0x3b76('0x31')]=_0xaab01a[_0x3b76('0x31')][_0x3b76('0x42')]?_0xaab01a[_0x3b76('0x31')]:_0x401525[_0x3b76('0x30')];if(_0x289460['query'][_0x3b76('0x3d')]){_0xaab01a[_0x3b76('0x3e')]=[{'all':!![]}];}_0xaab01a=_['merge']({},_0xaab01a,_0x289460[_0x3b76('0x3c')]);return db[_0x3b76('0x28')][_0x3b76('0x43')](_0xaab01a)['then'](handleEntityNotFound(_0x20c7d1,null))['then'](respondWithResult(_0x20c7d1,null))[_0x3b76('0x44')](handleError(_0x20c7d1,null));};exports[_0x3b76('0x45')]=function(_0x4c6911,_0x3e11fa){return db[_0x3b76('0x28')][_0x3b76('0x45')](_0x4c6911[_0x3b76('0x46')],{})['then'](respondWithResult(_0x3e11fa,0xc9))[_0x3b76('0x44')](handleError(_0x3e11fa,null));};exports[_0x3b76('0x47')]=function(_0x529df1,_0x1fad33){if(_0x529df1[_0x3b76('0x46')]['id']){delete _0x529df1[_0x3b76('0x46')]['id'];}return db[_0x3b76('0x28')]['find']({'where':{'id':_0x529df1[_0x3b76('0x41')]['id']}})[_0x3b76('0x22')](handleEntityNotFound(_0x1fad33,null))['then'](saveUpdates(_0x529df1[_0x3b76('0x46')],null))[_0x3b76('0x22')](respondWithResult(_0x1fad33,null))[_0x3b76('0x44')](handleError(_0x1fad33,null));};exports[_0x3b76('0x23')]=function(_0x5db78c,_0x400600){return db[_0x3b76('0x28')][_0x3b76('0x43')]({'where':{'id':_0x5db78c['params']['id']}})[_0x3b76('0x22')](handleEntityNotFound(_0x400600,null))[_0x3b76('0x22')](removeEntity(_0x400600,null))[_0x3b76('0x44')](handleError(_0x400600,null));}; \ No newline at end of file +var _0x20c0=['rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','OpenchannelApplication','include','catch','show','includeAll','merge','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index'];(function(_0x11efa2,_0x52b871){var _0x5d406b=function(_0x3d515f){while(--_0x3d515f){_0x11efa2['push'](_0x11efa2['shift']());}};_0x5d406b(++_0x52b871);}(_0x20c0,0x1d6));var _0x020c=function(_0x1e5e65,_0x140d32){_0x1e5e65=_0x1e5e65-0x0;var _0x284c37=_0x20c0[_0x1e5e65];return _0x284c37;};'use strict';var emlformat=require(_0x020c('0x0'));var rimraf=require(_0x020c('0x1'));var zipdir=require(_0x020c('0x2'));var jsonpatch=require(_0x020c('0x3'));var rp=require(_0x020c('0x4'));var moment=require(_0x020c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x020c('0x6'));var util=require(_0x020c('0x7'));var path=require(_0x020c('0x8'));var sox=require('sox');var csv=require(_0x020c('0x9'));var ejs=require(_0x020c('0xa'));var fs=require('fs');var fs_extra=require(_0x020c('0xb'));var _=require(_0x020c('0xc'));var squel=require(_0x020c('0xd'));var crypto=require('crypto');var jsforce=require(_0x020c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x020c('0x9'));var querystring=require('querystring');var Papa=require(_0x020c('0xf'));var Redis=require(_0x020c('0x10'));var authService=require(_0x020c('0x11'));var qs=require(_0x020c('0x12'));var as=require(_0x020c('0x13'));var hardwareService=require(_0x020c('0x14'));var logger=require('../../config/logger')(_0x020c('0x15'));var utils=require('../../config/utils');var config=require(_0x020c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x020c('0x17'))['db'];function respondWithStatusCode(_0x1fb32e,_0x5e1be2){_0x5e1be2=_0x5e1be2||0xcc;return function(_0x172ba3){if(_0x172ba3){return _0x1fb32e['sendStatus'](_0x5e1be2);}return _0x1fb32e['status'](_0x5e1be2)['end']();};}function respondWithResult(_0x5a7d44,_0x5bd03c){_0x5bd03c=_0x5bd03c||0xc8;return function(_0x250d62){if(_0x250d62){return _0x5a7d44[_0x020c('0x18')](_0x5bd03c)[_0x020c('0x19')](_0x250d62);}};}function respondWithFilteredResult(_0x34ecc3,_0x22b458){return function(_0x3b99a2){if(_0x3b99a2){var _0x38f719=typeof _0x22b458[_0x020c('0x1a')]==='undefined'&&typeof _0x22b458[_0x020c('0x1b')]===_0x020c('0x1c');var _0x543fea=_0x3b99a2['count'];var _0x2b5a6b=_0x38f719?0x0:_0x22b458[_0x020c('0x1a')];var _0x4170ab=_0x38f719?_0x3b99a2[_0x020c('0x1d')]:_0x22b458[_0x020c('0x1a')]+_0x22b458[_0x020c('0x1b')];var _0x308d3e;if(_0x4170ab>=_0x543fea){_0x4170ab=_0x543fea;_0x308d3e=0xc8;}else{_0x308d3e=0xce;}_0x34ecc3[_0x020c('0x18')](_0x308d3e);return _0x34ecc3[_0x020c('0x1e')](_0x020c('0x1f'),_0x2b5a6b+'-'+_0x4170ab+'/'+_0x543fea)[_0x020c('0x19')](_0x3b99a2);}return null;};}function patchUpdates(_0x20888f){return function(_0x26608c){try{jsonpatch['apply'](_0x26608c,_0x20888f,!![]);}catch(_0x59be29){return BPromise[_0x020c('0x20')](_0x59be29);}return _0x26608c[_0x020c('0x21')]();};}function saveUpdates(_0x2f1bae,_0x15d2d4){return function(_0x243fe5){if(_0x243fe5){return _0x243fe5['update'](_0x2f1bae)[_0x020c('0x22')](function(_0x4020f7){return _0x4020f7;});}return null;};}function removeEntity(_0x2b076d,_0x5f0a86){return function(_0x32d098){if(_0x32d098){return _0x32d098[_0x020c('0x23')]()[_0x020c('0x22')](function(){_0x2b076d[_0x020c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a439d,_0x17a696){return function(_0x35e325){if(!_0x35e325){_0x5a439d['sendStatus'](0x194);}return _0x35e325;};}function handleError(_0x4d9e31,_0xde8b19){_0xde8b19=_0xde8b19||0x1f4;return function(_0x3b7db7){logger[_0x020c('0x24')](_0x3b7db7[_0x020c('0x25')]);if(_0x3b7db7[_0x020c('0x26')]){delete _0x3b7db7[_0x020c('0x26')];}_0x4d9e31[_0x020c('0x18')](_0xde8b19)[_0x020c('0x27')](_0x3b7db7);};}exports[_0x020c('0x28')]=function(_0x3832a8,_0x2ff4d7){var _0x4e1867={},_0x56c4e6={},_0x271669={'count':0x0,'rows':[]};var _0x311439=_['map'](db['OpenchannelApplication'][_0x020c('0x29')],function(_0x103bc2){return{'name':_0x103bc2[_0x020c('0x2a')],'type':_0x103bc2[_0x020c('0x2b')][_0x020c('0x2c')]};});_0x56c4e6[_0x020c('0x2d')]=_[_0x020c('0x2e')](_0x311439,_0x020c('0x26'));_0x56c4e6[_0x020c('0x2f')]=_[_0x020c('0x30')](_0x3832a8['query']);_0x56c4e6[_0x020c('0x31')]=_[_0x020c('0x32')](_0x56c4e6['model'],_0x56c4e6[_0x020c('0x2f')]);_0x4e1867[_0x020c('0x33')]=_[_0x020c('0x32')](_0x56c4e6['model'],qs[_0x020c('0x34')](_0x3832a8['query']['fields']));_0x4e1867['attributes']=_0x4e1867[_0x020c('0x33')][_0x020c('0x35')]?_0x4e1867[_0x020c('0x33')]:_0x56c4e6[_0x020c('0x2d')];if(!_0x3832a8[_0x020c('0x2f')][_0x020c('0x36')](_0x020c('0x37'))){_0x4e1867[_0x020c('0x1b')]=qs['limit'](_0x3832a8[_0x020c('0x2f')][_0x020c('0x1b')]);_0x4e1867[_0x020c('0x1a')]=qs[_0x020c('0x1a')](_0x3832a8[_0x020c('0x2f')][_0x020c('0x1a')]);}_0x4e1867[_0x020c('0x38')]=qs['sort'](_0x3832a8[_0x020c('0x2f')][_0x020c('0x39')]);_0x4e1867[_0x020c('0x3a')]=qs[_0x020c('0x31')](_[_0x020c('0x3b')](_0x3832a8['query'],_0x56c4e6[_0x020c('0x31')]),_0x311439);if(_0x3832a8[_0x020c('0x2f')][_0x020c('0x3c')]){_0x4e1867['where']=_['merge'](_0x4e1867[_0x020c('0x3a')],{'$or':_[_0x020c('0x2e')](_0x311439,function(_0x2f2889){if(_0x2f2889[_0x020c('0x2b')]!=='VIRTUAL'){var _0x593038={};_0x593038[_0x2f2889['name']]={'$like':'%'+_0x3832a8[_0x020c('0x2f')][_0x020c('0x3c')]+'%'};return _0x593038;}})});}_0x4e1867=_['merge']({},_0x4e1867,_0x3832a8[_0x020c('0x3d')]);var _0x14d81c={'where':_0x4e1867['where']};return db[_0x020c('0x3e')][_0x020c('0x1d')](_0x14d81c)[_0x020c('0x22')](function(_0x24a4a0){_0x271669['count']=_0x24a4a0;if(_0x3832a8[_0x020c('0x2f')]['includeAll']){_0x4e1867[_0x020c('0x3f')]=[{'all':!![]}];}return db[_0x020c('0x3e')]['findAll'](_0x4e1867);})[_0x020c('0x22')](function(_0x9afbc5){_0x271669['rows']=_0x9afbc5;return _0x271669;})[_0x020c('0x22')](respondWithFilteredResult(_0x2ff4d7,_0x4e1867))[_0x020c('0x40')](handleError(_0x2ff4d7,null));};exports[_0x020c('0x41')]=function(_0x382c8c,_0x268bba){var _0x13155c={'raw':!![],'where':{'id':_0x382c8c['params']['id']}},_0x30ff4a={};_0x30ff4a[_0x020c('0x2d')]=_[_0x020c('0x30')](db[_0x020c('0x3e')][_0x020c('0x29')]);_0x30ff4a[_0x020c('0x2f')]=_[_0x020c('0x30')](_0x382c8c[_0x020c('0x2f')]);_0x30ff4a[_0x020c('0x31')]=_[_0x020c('0x32')](_0x30ff4a[_0x020c('0x2d')],_0x30ff4a[_0x020c('0x2f')]);_0x13155c[_0x020c('0x33')]=_[_0x020c('0x32')](_0x30ff4a[_0x020c('0x2d')],qs['fields'](_0x382c8c[_0x020c('0x2f')]['fields']));_0x13155c[_0x020c('0x33')]=_0x13155c[_0x020c('0x33')]['length']?_0x13155c[_0x020c('0x33')]:_0x30ff4a[_0x020c('0x2d')];if(_0x382c8c['query'][_0x020c('0x42')]){_0x13155c[_0x020c('0x3f')]=[{'all':!![]}];}_0x13155c=_[_0x020c('0x43')]({},_0x13155c,_0x382c8c['options']);return db['OpenchannelApplication'][_0x020c('0x44')](_0x13155c)[_0x020c('0x22')](handleEntityNotFound(_0x268bba,null))[_0x020c('0x22')](respondWithResult(_0x268bba,null))[_0x020c('0x40')](handleError(_0x268bba,null));};exports[_0x020c('0x45')]=function(_0x550fc2,_0x206a06){return db['OpenchannelApplication'][_0x020c('0x45')](_0x550fc2[_0x020c('0x46')],{})[_0x020c('0x22')](respondWithResult(_0x206a06,0xc9))['catch'](handleError(_0x206a06,null));};exports[_0x020c('0x47')]=function(_0x557a64,_0x440e8a){if(_0x557a64['body']['id']){delete _0x557a64[_0x020c('0x46')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x557a64['params']['id']}})[_0x020c('0x22')](handleEntityNotFound(_0x440e8a,null))[_0x020c('0x22')](saveUpdates(_0x557a64[_0x020c('0x46')],null))[_0x020c('0x22')](respondWithResult(_0x440e8a,null))[_0x020c('0x40')](handleError(_0x440e8a,null));};exports[_0x020c('0x23')]=function(_0x4b667f,_0x214b77){return db[_0x020c('0x3e')]['find']({'where':{'id':_0x4b667f[_0x020c('0x48')]['id']}})[_0x020c('0x22')](handleEntityNotFound(_0x214b77,null))[_0x020c('0x22')](removeEntity(_0x214b77,null))[_0x020c('0x40')](handleError(_0x214b77,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index e480fe3..82f9c14 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 _0xb298=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x3dae81,_0x60b8d9){var _0x4428ac=function(_0x2caf9d){while(--_0x2caf9d){_0x3dae81['push'](_0x3dae81['shift']());}};_0x4428ac(++_0x60b8d9);}(_0xb298,0xef));var _0x8b29=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb298[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8b29('0x0'));var util=require(_0x8b29('0x1'));var logger=require(_0x8b29('0x2'))(_0x8b29('0x3'));var moment=require(_0x8b29('0x4'));var BPromise=require(_0x8b29('0x5'));var rp=require(_0x8b29('0x6'));var fs=require('fs');var path=require(_0x8b29('0x7'));var rimraf=require(_0x8b29('0x8'));var config=require('../../config/environment');var attributes=require(_0x8b29('0x9'));module[_0x8b29('0xa')]=function(_0x51c94f,_0x21c702){return _0x51c94f[_0x8b29('0xb')]('OpenchannelApplication',attributes,{'tableName':_0x8b29('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8b29('0xd'),'collate':_0x8b29('0xe')});}; \ No newline at end of file +var _0x0ac5=['bluebird','path','rimraf','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x4b6753,_0x55f75f){var _0x335a44=function(_0x5063fe){while(--_0x5063fe){_0x4b6753['push'](_0x4b6753['shift']());}};_0x335a44(++_0x55f75f);}(_0x0ac5,0x1b8));var _0x50ac=function(_0x5c82d3,_0x2ef64e){_0x5c82d3=_0x5c82d3-0x0;var _0x20377e=_0x0ac5[_0x5c82d3];return _0x20377e;};'use strict';var _=require(_0x50ac('0x0'));var util=require('util');var logger=require(_0x50ac('0x1'))(_0x50ac('0x2'));var moment=require(_0x50ac('0x3'));var BPromise=require(_0x50ac('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x50ac('0x5'));var rimraf=require(_0x50ac('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x4238e0,_0x3236c5){return _0x4238e0[_0x50ac('0x7')](_0x50ac('0x8'),attributes,{'tableName':_0x50ac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x50ac('0xa'),'collate':_0x50ac('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 19dcace..720d50d 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 _0x2ade=['jayson/promise','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UpdateOpenchannelApplication','update','body','options','raw','where','attributes','stringify','lodash','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x2ade,0xe9));var _0xe2ad=function(_0x4d4af9,_0x431751){_0x4d4af9=_0x4d4af9-0x0;var _0x500e0c=_0x2ade[_0x4d4af9];return _0x500e0c;};'use strict';var _=require(_0xe2ad('0x0'));var util=require(_0xe2ad('0x1'));var moment=require('moment');var BPromise=require(_0xe2ad('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe2ad('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe2ad('0x4'))(_0xe2ad('0x5'));var config=require(_0xe2ad('0x6'));var jayson=require(_0xe2ad('0x7'));var client=jayson[_0xe2ad('0x8')][_0xe2ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x500786,_0xea7b37,_0x8496f7){return new BPromise(function(_0x1a6a42,_0x4ff430){return client[_0xe2ad('0xa')](_0x500786,_0x8496f7)[_0xe2ad('0xb')](function(_0x581515){logger['info'](_0xe2ad('0xc'),_0xea7b37,_0xe2ad('0xd'));logger[_0xe2ad('0xe')](_0xe2ad('0xf'),_0xea7b37,_0xe2ad('0xd'),JSON['stringify'](_0x581515));if(_0x581515[_0xe2ad('0x10')]){if(_0x581515[_0xe2ad('0x10')][_0xe2ad('0x11')]===0x1f4){logger[_0xe2ad('0x10')](_0xe2ad('0xc'),_0xea7b37,_0x581515['error'][_0xe2ad('0x12')]);return _0x4ff430(_0x581515[_0xe2ad('0x10')][_0xe2ad('0x12')]);}logger['error'](_0xe2ad('0xc'),_0xea7b37,_0x581515[_0xe2ad('0x10')][_0xe2ad('0x12')]);return _0x1a6a42(_0x581515[_0xe2ad('0x10')]['message']);}else{logger[_0xe2ad('0x13')](_0xe2ad('0xc'),_0xea7b37,_0xe2ad('0xd'));_0x1a6a42(_0x581515[_0xe2ad('0x14')][_0xe2ad('0x12')]);}})[_0xe2ad('0x15')](function(_0x2d736a){logger[_0xe2ad('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0xea7b37,_0x2d736a);_0x4ff430(_0x2d736a);});});}exports[_0xe2ad('0x16')]=function(_0x4299f2){var _0x3d2dfe=this;return new Promise(function(_0x28a201,_0x13aadc){return db['OpenchannelApplication'][_0xe2ad('0x17')](_0x4299f2[_0xe2ad('0x18')],{'raw':_0x4299f2['options']?_0x4299f2[_0xe2ad('0x19')][_0xe2ad('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4299f2['options']?_0x4299f2['options'][_0xe2ad('0x1b')]||null:null,'attributes':_0x4299f2[_0xe2ad('0x19')]?_0x4299f2[_0xe2ad('0x19')][_0xe2ad('0x1c')]||null:null,'limit':_0x4299f2[_0xe2ad('0x19')]?_0x4299f2[_0xe2ad('0x19')]['limit']||null:null})[_0xe2ad('0xb')](function(_0x1ed16c){logger['info'](_0xe2ad('0x16'),_0x4299f2);logger[_0xe2ad('0xe')](_0xe2ad('0x16'),_0x4299f2,JSON[_0xe2ad('0x1d')](_0x1ed16c));_0x28a201(_0x1ed16c);})[_0xe2ad('0x15')](function(_0x1eee36){logger[_0xe2ad('0x10')](_0xe2ad('0x16'),_0x1eee36[_0xe2ad('0x12')],_0x4299f2);_0x13aadc(_0x3d2dfe[_0xe2ad('0x10')](0x1f4,_0x1eee36['message']));});});}; \ No newline at end of file +var _0x30ce=['UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x278fa4,_0x24b8e0){var _0x47a40e=function(_0x491d1b){while(--_0x491d1b){_0x278fa4['push'](_0x278fa4['shift']());}};_0x47a40e(++_0x24b8e0);}(_0x30ce,0x15d));var _0xe30c=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x30ce[_0x1cb18a];return _0x22442e;};'use strict';var _=require(_0xe30c('0x0'));var util=require(_0xe30c('0x1'));var moment=require('moment');var BPromise=require(_0xe30c('0x2'));var rs=require(_0xe30c('0x3'));var fs=require('fs');var Redis=require(_0xe30c('0x4'));var db=require(_0xe30c('0x5'))['db'];var utils=require(_0xe30c('0x6'));var logger=require(_0xe30c('0x7'))(_0xe30c('0x8'));var config=require('../../config/environment');var jayson=require(_0xe30c('0x9'));var client=jayson[_0xe30c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc91ea8,_0x4f637e,_0x3e0e1f){return new BPromise(function(_0x2dd37c,_0x28911d){return client[_0xe30c('0xb')](_0xc91ea8,_0x3e0e1f)[_0xe30c('0xc')](function(_0x5694dc){logger[_0xe30c('0xd')](_0xe30c('0xe'),_0x4f637e,_0xe30c('0xf'));logger[_0xe30c('0x10')](_0xe30c('0x11'),_0x4f637e,'request\x20sent',JSON[_0xe30c('0x12')](_0x5694dc));if(_0x5694dc[_0xe30c('0x13')]){if(_0x5694dc['error'][_0xe30c('0x14')]===0x1f4){logger[_0xe30c('0x13')](_0xe30c('0xe'),_0x4f637e,_0x5694dc['error'][_0xe30c('0x15')]);return _0x28911d(_0x5694dc[_0xe30c('0x13')][_0xe30c('0x15')]);}logger[_0xe30c('0x13')](_0xe30c('0xe'),_0x4f637e,_0x5694dc[_0xe30c('0x13')]['message']);return _0x2dd37c(_0x5694dc[_0xe30c('0x13')][_0xe30c('0x15')]);}else{logger['info'](_0xe30c('0xe'),_0x4f637e,_0xe30c('0xf'));_0x2dd37c(_0x5694dc[_0xe30c('0x16')][_0xe30c('0x15')]);}})['catch'](function(_0x33af74){logger[_0xe30c('0x13')](_0xe30c('0xe'),_0x4f637e,_0x33af74);_0x28911d(_0x33af74);});});}exports[_0xe30c('0x17')]=function(_0x38daae){var _0x2ac8dd=this;return new Promise(function(_0x37fae2,_0x445124){return db[_0xe30c('0x18')][_0xe30c('0x19')](_0x38daae[_0xe30c('0x1a')],{'raw':_0x38daae[_0xe30c('0x1b')]?_0x38daae[_0xe30c('0x1b')][_0xe30c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38daae[_0xe30c('0x1b')]?_0x38daae[_0xe30c('0x1b')][_0xe30c('0x1d')]||null:null,'attributes':_0x38daae[_0xe30c('0x1b')]?_0x38daae['options'][_0xe30c('0x1e')]||null:null,'limit':_0x38daae[_0xe30c('0x1b')]?_0x38daae[_0xe30c('0x1b')]['limit']||null:null})[_0xe30c('0xc')](function(_0x4ee691){logger[_0xe30c('0xd')](_0xe30c('0x17'),_0x38daae);logger[_0xe30c('0x10')]('UpdateOpenchannelApplication',_0x38daae,JSON[_0xe30c('0x12')](_0x4ee691));_0x37fae2(_0x4ee691);})['catch'](function(_0x1d6e46){logger[_0xe30c('0x13')](_0xe30c('0x17'),_0x1d6e46['message'],_0x38daae);_0x445124(_0x2ac8dd[_0xe30c('0x13')](0x1f4,_0x1d6e46[_0xe30c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index dd6f034..fc1b761 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 _0xb170=['openchannelinteraction:addtags','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','post','addMessage','/:id/tags','tracked','openchannel'];(function(_0x47b247,_0x73044){var _0x213000=function(_0xe74b52){while(--_0xe74b52){_0x47b247['push'](_0x47b247['shift']());}};_0x213000(++_0x73044);}(_0xb170,0xae));var _0x0b17=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xb170[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0x0b17('0x0'));var util=require(_0x0b17('0x1'));var path=require(_0x0b17('0x2'));var timeout=require(_0x0b17('0x3'));var express=require(_0x0b17('0x4'));var router=express[_0x0b17('0x5')]();var fs_extra=require(_0x0b17('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0b17('0x7'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0x0b17('0x8')]('/',auth['isAuthenticated'](),controller[_0x0b17('0x9')]);router['get'](_0x0b17('0xa'),auth[_0x0b17('0xb')](),controller[_0x0b17('0xc')]);router[_0x0b17('0x8')](_0x0b17('0xd'),auth[_0x0b17('0xb')](),controller[_0x0b17('0xe')]);router[_0x0b17('0x8')](_0x0b17('0xf'),auth[_0x0b17('0xb')](),controller['getMessages']);router[_0x0b17('0x8')](_0x0b17('0x10'),auth[_0x0b17('0xb')](),controller['download']);router['post']('/',auth[_0x0b17('0xb')](),controller['create']);router[_0x0b17('0x11')](_0x0b17('0xf'),auth['isAuthenticated'](),controller[_0x0b17('0x12')]);router[_0x0b17('0x11')](_0x0b17('0x13'),auth[_0x0b17('0xb')](),interaction[_0x0b17('0x14')](_0x0b17('0x15'),_0x0b17('0x16')),controller['addTags']);router['put']('/:id',auth[_0x0b17('0xb')](),interaction['tracked'](_0x0b17('0x15'),_0x0b17('0x17')),controller[_0x0b17('0x18')]);router[_0x0b17('0x19')](_0x0b17('0xd'),auth[_0x0b17('0xb')](),interaction[_0x0b17('0x14')](_0x0b17('0x15'),_0x0b17('0x1a')),controller['destroy']);router[_0x0b17('0x19')](_0x0b17('0x13'),auth[_0x0b17('0xb')](),controller[_0x0b17('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xbc14=['delete','openchannel','openchannelinteraction:destroy','removeTags','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','./openchannelInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','update'];(function(_0x457e81,_0x44c530){var _0x2558e4=function(_0x1d7ed9){while(--_0x1d7ed9){_0x457e81['push'](_0x457e81['shift']());}};_0x2558e4(++_0x44c530);}(_0xbc14,0x19b));var _0x4bc1=function(_0x3cc751,_0x38b8ff){_0x3cc751=_0x3cc751-0x0;var _0x3956a2=_0xbc14[_0x3cc751];return _0x3956a2;};'use strict';var multer=require(_0x4bc1('0x0'));var util=require(_0x4bc1('0x1'));var path=require('path');var timeout=require(_0x4bc1('0x2'));var express=require('express');var router=express[_0x4bc1('0x3')]();var fs_extra=require(_0x4bc1('0x4'));var auth=require(_0x4bc1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4bc1('0x6'));router[_0x4bc1('0x7')]('/',auth[_0x4bc1('0x8')](),controller[_0x4bc1('0x9')]);router[_0x4bc1('0x7')]('/describe',auth[_0x4bc1('0x8')](),controller[_0x4bc1('0xa')]);router['get'](_0x4bc1('0xb'),auth[_0x4bc1('0x8')](),controller['show']);router['get'](_0x4bc1('0xc'),auth[_0x4bc1('0x8')](),controller[_0x4bc1('0xd')]);router['get']('/:id/download',auth[_0x4bc1('0x8')](),controller[_0x4bc1('0xe')]);router['post']('/',auth[_0x4bc1('0x8')](),controller[_0x4bc1('0xf')]);router[_0x4bc1('0x10')](_0x4bc1('0xc'),auth['isAuthenticated'](),controller[_0x4bc1('0x11')]);router[_0x4bc1('0x10')](_0x4bc1('0x12'),auth[_0x4bc1('0x8')](),interaction[_0x4bc1('0x13')]('openchannel',_0x4bc1('0x14')),controller[_0x4bc1('0x15')]);router[_0x4bc1('0x16')](_0x4bc1('0xb'),auth['isAuthenticated'](),interaction[_0x4bc1('0x13')]('openchannel','openchannelinteraction:update'),controller[_0x4bc1('0x17')]);router[_0x4bc1('0x18')]('/:id',auth[_0x4bc1('0x8')](),interaction[_0x4bc1('0x13')](_0x4bc1('0x19'),_0x4bc1('0x1a')),controller['destroy']);router['delete']('/:id/tags',auth[_0x4bc1('0x8')](),controller[_0x4bc1('0x1b')]);module[_0x4bc1('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 09dc2ca..c61eb58 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 _0x8ce1=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x8ce1,0x183));var _0x18ce=function(_0x333349,_0x597cec){_0x333349=_0x333349-0x0;var _0x567170=_0x8ce1[_0x333349];return _0x567170;};'use strict';var Sequelize=require(_0x18ce('0x0'));module[_0x18ce('0x1')]={'closed':{'type':Sequelize[_0x18ce('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x18ce('0x3')]},'disposition':{'type':Sequelize[_0x18ce('0x4')]},'secondDisposition':{'type':Sequelize[_0x18ce('0x4')]},'thirdDisposition':{'type':Sequelize[_0x18ce('0x4')]},'note':{'type':Sequelize[_0x18ce('0x4')]},'read1stAt':{'type':Sequelize[_0x18ce('0x3')]},'threadId':{'type':Sequelize[_0x18ce('0x4')]},'externalUrl':{'type':Sequelize[_0x18ce('0x4')]},'lastMsgAt':{'type':Sequelize[_0x18ce('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x18ce('0x5')]('in',_0x18ce('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x18ce('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x18ce('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x4d9e=['sequelize','DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x32cbf9,_0x1370b4){var _0x5c2bd6=function(_0x50c03c){while(--_0x50c03c){_0x32cbf9['push'](_0x32cbf9['shift']());}};_0x5c2bd6(++_0x1370b4);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x3fe199,_0x102a03){_0x3fe199=_0x3fe199-0x0;var _0x46c19b=_0x4d9e[_0x3fe199];return _0x46c19b;};'use strict';var Sequelize=require(_0xe4d9('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe4d9('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xe4d9('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe4d9('0x2')]},'read1stAt':{'type':Sequelize[_0xe4d9('0x1')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xe4d9('0x2')]},'lastMsgAt':{'type':Sequelize[_0xe4d9('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xe4d9('0x3')]('in',_0xe4d9('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xe4d9('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0xe4d9('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index ed1eaad..32a7607 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 _0x9831=['`\x20>\x200','Contact','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','end','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','order','contactName','DESC','t.id\x20IN\x20?','resolve','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','agent','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','all','rows','catch','show','params','includeAll','include','create','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','options','addTags','setTags','spread','removeTags','unix','join','root','server','files','tmp','transcript-%d-%s.zip','User','fullname','CmContact','firstName','lastName','attachments','Attachment','direction','OpenchannelAccount','Account','Owner','mkdirSync','Openchannel','N.A.','closedAt','disposition','threadId','Private','Messages','basename','existsSync','createReadStream','out','System','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','offset','undefined','count','set','Content-Range','json','reject','save','update','destroy','then','stack','name','send','Users','map','TagIds','Tags','push','waiting','talking','answered','unmanaged','closed','UserId','index','OpenchannelInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','pick','select','field','color','from','tools_tags','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','unreadMessages','value'];(function(_0x496e54,_0x575c5d){var _0x41ab42=function(_0x5e4253){while(--_0x5e4253){_0x496e54['push'](_0x496e54['shift']());}};_0x41ab42(++_0x575c5d);}(_0x9831,0x18b));var _0x1983=function(_0x6d2a1,_0x4ffe96){_0x6d2a1=_0x6d2a1-0x0;var _0x1ff99d=_0x9831[_0x6d2a1];return _0x1ff99d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1983('0x0'));var zipdir=require(_0x1983('0x1'));var jsonpatch=require(_0x1983('0x2'));var rp=require(_0x1983('0x3'));var moment=require(_0x1983('0x4'));var BPromise=require(_0x1983('0x5'));var Mustache=require(_0x1983('0x6'));var util=require(_0x1983('0x7'));var path=require(_0x1983('0x8'));var sox=require(_0x1983('0x9'));var csv=require('to-csv');var ejs=require(_0x1983('0xa'));var fs=require('fs');var fs_extra=require(_0x1983('0xb'));var _=require('lodash');var squel=require(_0x1983('0xc'));var crypto=require(_0x1983('0xd'));var jsforce=require(_0x1983('0xe'));var deskjs=require(_0x1983('0xf'));var toCsv=require(_0x1983('0x10'));var querystring=require('querystring');var Papa=require(_0x1983('0x11'));var Redis=require(_0x1983('0x12'));var authService=require(_0x1983('0x13'));var qs=require(_0x1983('0x14'));var as=require(_0x1983('0x15'));var pdf=require(_0x1983('0x16'));var hardwareService=require(_0x1983('0x17'));var logger=require(_0x1983('0x18'))(_0x1983('0x19'));var utils=require(_0x1983('0x1a'));var config=require(_0x1983('0x1b'));var licenseUtil=require(_0x1983('0x1c'));var db=require(_0x1983('0x1d'))['db'];config[_0x1983('0x1e')]=_[_0x1983('0x1f')](config['redis'],{'host':_0x1983('0x20'),'port':0x18eb});var socket=require(_0x1983('0x21'))(new Redis(config[_0x1983('0x1e')]));require(_0x1983('0x22'))[_0x1983('0x23')](socket);function respondWithStatusCode(_0x350bb1,_0x382153){_0x382153=_0x382153||0xcc;return function(_0x47ef8e){if(_0x47ef8e){return _0x350bb1[_0x1983('0x24')](_0x382153);}return _0x350bb1[_0x1983('0x25')](_0x382153)['end']();};}function respondWithResult(_0x44cd1a,_0x486e2b){_0x486e2b=_0x486e2b||0xc8;return function(_0x4a0dae){if(_0x4a0dae){return _0x44cd1a[_0x1983('0x25')](_0x486e2b)['json'](_0x4a0dae);}};}function respondWithFilteredResult(_0x4630bb,_0x3342f6){return function(_0x1b48a7){if(_0x1b48a7){var _0x3b63de=typeof _0x3342f6[_0x1983('0x26')]===_0x1983('0x27')&&typeof _0x3342f6['limit']==='undefined';var _0x518475=_0x1b48a7[_0x1983('0x28')];var _0x409ad6=_0x3b63de?0x0:_0x3342f6[_0x1983('0x26')];var _0x3a30e7=_0x3b63de?_0x1b48a7[_0x1983('0x28')]:_0x3342f6[_0x1983('0x26')]+_0x3342f6['limit'];var _0x552fcb;if(_0x3a30e7>=_0x518475){_0x3a30e7=_0x518475;_0x552fcb=0xc8;}else{_0x552fcb=0xce;}_0x4630bb[_0x1983('0x25')](_0x552fcb);return _0x4630bb[_0x1983('0x29')](_0x1983('0x2a'),_0x409ad6+'-'+_0x3a30e7+'/'+_0x518475)[_0x1983('0x2b')](_0x1b48a7);}return null;};}function patchUpdates(_0x42d698){return function(_0x25eb7d){try{jsonpatch['apply'](_0x25eb7d,_0x42d698,!![]);}catch(_0xe8b183){return BPromise[_0x1983('0x2c')](_0xe8b183);}return _0x25eb7d[_0x1983('0x2d')]();};}function saveUpdates(_0x36d5ca,_0x534974){return function(_0x39d6ff){if(_0x39d6ff){return _0x39d6ff[_0x1983('0x2e')](_0x36d5ca)['then'](function(_0x3e1905){return _0x3e1905;});}return null;};}function removeEntity(_0x425871,_0x2f13dc){return function(_0x5cc303){if(_0x5cc303){return _0x5cc303[_0x1983('0x2f')]()[_0x1983('0x30')](function(){_0x425871[_0x1983('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56687a,_0x2f6f5d){return function(_0x2d2e34){if(!_0x2d2e34){_0x56687a[_0x1983('0x24')](0x194);}return _0x2d2e34;};}function handleError(_0x37ad1d,_0x330871){_0x330871=_0x330871||0x1f4;return function(_0x396d76){logger['error'](_0x396d76[_0x1983('0x31')]);if(_0x396d76[_0x1983('0x32')]){delete _0x396d76[_0x1983('0x32')];}_0x37ad1d[_0x1983('0x25')](_0x330871)[_0x1983('0x33')](_0x396d76);};}function getInteractionUsers(_0x218f7f,_0x20172e){return new BPromise(function(_0x3fcfd8,_0x57d00f){try{if(_0x20172e[_0x218f7f['id']]){_0x218f7f[_0x1983('0x34')]=_[_0x1983('0x35')](_0x20172e[_0x218f7f['id']],function(_0x176d84){return{'id':_0x176d84['id'],'fullname':_0x176d84['fullname']};});}}catch(_0x5b2077){_0x57d00f(_0x5b2077);}_0x3fcfd8(_0x218f7f);});}function getInteractionTags(_0x18942e,_0x162c95){return new BPromise(function(_0x21b998,_0x458fff){try{if(_0x18942e[_0x1983('0x36')]){_0x18942e[_0x1983('0x37')]=[];_0x18942e[_0x1983('0x36')]['split'](',')['forEach'](function(_0x2c5566){_0x18942e[_0x1983('0x37')][_0x1983('0x38')](_0x162c95[_0x2c5566]);});}delete _0x18942e[_0x1983('0x36')];}catch(_0xe35cd4){_0x458fff(_0xe35cd4);}_0x21b998(_0x18942e);});}function updateOpenchannelInteraction(_0x56adde,_0xb6207a,_0x44ced9){return new BPromise(function(_0x20fecd,_0x2839df){return getInteractionUsers(_0x56adde,_0x44ced9)[_0x1983('0x30')](function(_0xfc8fce){return getInteractionTags(_0xfc8fce,_0xb6207a);})['then'](function(_0x9375b3){return getStateInteraction(_0x9375b3);})[_0x1983('0x30')](function(_0x22e49f){_0x20fecd(_0x22e49f);})['catch'](function(_0x12a181){_0x2839df(_0x12a181);});});}function getStateInteraction(_0x32bbbf){return new BPromise(function(_0x1206e0){_0x32bbbf[_0x1983('0x39')]=0x0;_0x32bbbf[_0x1983('0x3a')]=0x0;_0x32bbbf[_0x1983('0x3b')]=0x0;_0x32bbbf[_0x1983('0x3c')]=0x0;_0x32bbbf['total']=0x0;if(!_0x32bbbf[_0x1983('0x3d')]&&!_0x32bbbf[_0x1983('0x3e')]){_0x32bbbf[_0x1983('0x39')]+=0x1;}if(!_0x32bbbf[_0x1983('0x3d')]&&_0x32bbbf['UserId']){_0x32bbbf[_0x1983('0x3a')]+=0x1;if(_0x32bbbf[_0x1983('0x39')]){_0x32bbbf['waiting']-=0x1;}}if(_0x32bbbf[_0x1983('0x3d')]&&_0x32bbbf[_0x1983('0x3e')]){_0x32bbbf[_0x1983('0x3b')]+=0x1;if(_0x32bbbf[_0x1983('0x3a')]){_0x32bbbf[_0x1983('0x3a')]-=0x1;}}if(_0x32bbbf['closed']&&!_0x32bbbf['UserId']){_0x32bbbf[_0x1983('0x3c')]+=0x1;if(_0x32bbbf[_0x1983('0x39')]){_0x32bbbf[_0x1983('0x39')]-=0x1;}}_0x32bbbf['total']+=0x1;_0x1206e0(_0x32bbbf);});}exports[_0x1983('0x3f')]=function(_0x2466ef,_0x1ef0b9){var _0xd7a7e6={},_0x107f08={},_0x25b1d5={'count':0x0,'rows':[]};var _0x4c0f25=_[_0x1983('0x35')](db[_0x1983('0x40')][_0x1983('0x41')],function(_0x35e9d5){return{'name':_0x35e9d5[_0x1983('0x42')],'type':_0x35e9d5['type'][_0x1983('0x43')]};});_0x107f08[_0x1983('0x44')]=_[_0x1983('0x35')](_0x4c0f25,_0x1983('0x32'));_0x107f08[_0x1983('0x45')]=_[_0x1983('0x46')](_0x2466ef[_0x1983('0x45')]);_0x107f08[_0x1983('0x47')]=_[_0x1983('0x48')](_0x107f08[_0x1983('0x44')],_0x107f08[_0x1983('0x45')]);_0xd7a7e6['attributes']=_[_0x1983('0x48')](_0x107f08[_0x1983('0x44')],qs[_0x1983('0x49')](_0x2466ef[_0x1983('0x45')][_0x1983('0x49')]));_0xd7a7e6['attributes']=_0xd7a7e6[_0x1983('0x4a')][_0x1983('0x4b')]?_0xd7a7e6[_0x1983('0x4a')]:_0x107f08[_0x1983('0x44')];if(!_0x2466ef[_0x1983('0x45')][_0x1983('0x4c')]('nolimit')){_0xd7a7e6[_0x1983('0x4d')]=qs['limit'](_0x2466ef['query'][_0x1983('0x4d')]);_0xd7a7e6['offset']=qs[_0x1983('0x26')](_0x2466ef['query'][_0x1983('0x26')]);}_0xd7a7e6['order']=qs[_0x1983('0x4e')](_0x2466ef[_0x1983('0x45')][_0x1983('0x4e')]);_0xd7a7e6['where']=qs[_0x1983('0x47')](_[_0x1983('0x4f')](_0x2466ef[_0x1983('0x45')],_0x107f08[_0x1983('0x47')]),_0x4c0f25);var _0x214f02=[];var _0x2f3173=squel[_0x1983('0x50')]()[_0x1983('0x51')]('id')[_0x1983('0x51')](_0x1983('0x32'))[_0x1983('0x51')](_0x1983('0x52'))[_0x1983('0x53')](_0x1983('0x54'));var _0x58f74a=squel[_0x1983('0x50')]()[_0x1983('0x51')](_0x1983('0x55'))[_0x1983('0x51')]('u.fullname')['field'](_0x1983('0x56'))['from'](_0x1983('0x57'),'ui')[_0x1983('0x58')](_0x1983('0x59'),'u',_0x1983('0x5a'));var _0x521e59=squel['select']()[_0x1983('0x53')]('openchannel_interactions','i')['left_join'](_0x1983('0x5b'),'c',_0x1983('0x5c'))[_0x1983('0x58')](_0x1983('0x59'),'o','o.id\x20=\x20i.UserId')[_0x1983('0x58')](_0x1983('0x5d'),'a',_0x1983('0x5e'))[_0x1983('0x58')]('openchannel_messages','me',_0x1983('0x5f'))[_0x1983('0x58')](_0x1983('0x60'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x1983('0x58')](_0x1983('0x54'),'t',_0x1983('0x61'));var _0x2dd2d=squel[_0x1983('0x62')]();var _0x7eb684=[];var _0xb622bf=squel[_0x1983('0x62')]();var _0x31b4f5;if(_0x2466ef[_0x1983('0x45')]['search']){_0x31b4f5=as[_0x1983('0x63')](_0x2466ef['query'][_0x1983('0x64')]);var _0x5b7446=_0x31b4f5['sqlOperator'];for(var _0xf3f889=0x0;_0xf3f889<_0x31b4f5['conditions'][_0x1983('0x4b')];_0xf3f889++){var _0x5332e3=_0x31b4f5[_0x1983('0x65')][_0xf3f889];var _0x3cf73d='i';var _0x17ca4b=_[_0x1983('0x66')](_0x4c0f25,[_0x1983('0x32'),_0x5332e3[_0x1983('0x51')]]);if(!_0x17ca4b){switch(_0x5332e3[_0x1983('0x51')]){case _0x1983('0x67'):if(_0x5332e3[_0x1983('0x68')]==0x1){_0x521e59['having']('`'+_0x5332e3['field']+'`\x20=\x200');}else{_0x521e59['having']('`'+_0x5332e3['field']+_0x1983('0x69'));}break;case _0x1983('0x6a'):if(_0x5332e3['operator']===_0x1983('0x6b')){if(_0x5332e3[_0x1983('0x68')][_0x1983('0x6c')]('\x20')[_0x1983('0x4b')]>0x1){_0x2dd2d[_0x5b7446](_0x1983('0x6d'),qs[_0x1983('0x6e')](_0x5332e3[_0x1983('0x68')]),null);}else{var _0x30dd25='%'+_0x5332e3[_0x1983('0x68')]+'%';_0x2dd2d[_0x5b7446](_0x1983('0x6f'),_0x30dd25,_0x30dd25,_0x30dd25);}}else{_0x17ca4b=_[_0x1983('0x66')](_0x4c0f25,[_0x1983('0x32'),_0x1983('0x70')]);_0x5332e3[_0x1983('0x51')]=_0x1983('0x70');_0x5d088f=as[_0x1983('0x71')](_0x3cf73d,_0x17ca4b[_0x1983('0x72')],_0x5332e3);_0x2dd2d[_0x5b7446](_0x5d088f[_0x1983('0x73')],_0x5d088f['value'][_0x1983('0x74')],_0x5d088f[_0x1983('0x68')][_0x1983('0x75')]);}break;case _0x1983('0x76'):var _0x54bbc9=_0x5332e3['value'][_0x1983('0x6c')](',')['map'](function(_0x121ac6){return Number(_0x121ac6);});_0x54bbc9[_0x1983('0x77')](function(_0x1f1202){_0xb622bf['or'](_0x1983('0x78'),'%,'+_0x1f1202+',%');});_0x7eb684=_[_0x1983('0x79')](_0x7eb684,_0x54bbc9);break;case'User':if(_0x5332e3[_0x1983('0x7a')]===_0x1983('0x6b')){_0x2dd2d[_0x5b7446](_0x1983('0x7b'),'%'+_0x5332e3[_0x1983('0x68')]+'%',null);}else{_0x17ca4b=_['find'](_0x4c0f25,['name',_0x1983('0x3e')]);_0x5332e3[_0x1983('0x51')]=_0x1983('0x3e');_0x5d088f=as[_0x1983('0x71')](_0x3cf73d,_0x17ca4b['type'],_0x5332e3);_0x2dd2d[_0x5b7446](_0x5d088f[_0x1983('0x73')],_0x5d088f[_0x1983('0x68')][_0x1983('0x74')],_0x5d088f[_0x1983('0x68')]['end']);}break;case _0x1983('0x7c'):_0x5d088f=as['buildExpression']('me',null,_0x5332e3);_0x2dd2d[_0x5b7446](_0x5d088f[_0x1983('0x73')],_0x5d088f[_0x1983('0x68')][_0x1983('0x74')],_0x5d088f[_0x1983('0x68')][_0x1983('0x75')]);break;}}else{var _0x5d088f=as[_0x1983('0x71')](_0x3cf73d,_0x17ca4b['type'],_0x5332e3);_0x2dd2d[_0x5b7446](_0x5d088f['text'],_0x5d088f[_0x1983('0x68')]['start'],_0x5d088f[_0x1983('0x68')][_0x1983('0x75')]);}}}else{var _0x234554=_(_0x2466ef[_0x1983('0x45')])[_0x1983('0x46')]()[_0x1983('0x35')](function(_0x82b750){return _[_0x1983('0x7d')](_0x4c0f25,[_0x1983('0x32'),_0x82b750])?_0x82b750:undefined;})['compact']()[_0x1983('0x68')]();if(!_[_0x1983('0x7e')](_0x234554)){_0x234554[_0x1983('0x77')](function(_0x4db6ab){if(_0x4db6ab===_0x1983('0x7f')){_0x521e59[_0x1983('0x80')](_0x1983('0x81'),[][_0x1983('0x82')](_0x2466ef['query'][_0x4db6ab]));}else if(_0x4db6ab===_0x1983('0x83')){var _0x3cb62f=JSON['parse'](_0x2466ef[_0x1983('0x45')][_0x4db6ab])[_0x1983('0x84')];var _0x44fd73=JSON[_0x1983('0x85')](_0x2466ef[_0x1983('0x45')][_0x4db6ab])[_0x1983('0x86')];_0x521e59[_0x1983('0x80')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3cb62f,_0x44fd73);}else{if(_0x2466ef['query'][_0x4db6ab]===_0x1983('0x87')){_0x521e59[_0x1983('0x80')]('i.'+_0x4db6ab+_0x1983('0x88'));}else{_0x521e59[_0x1983('0x80')]('i.'+_0x4db6ab+_0x1983('0x89'),_0x2466ef[_0x1983('0x45')][_0x4db6ab]);}}});}if(_0x2466ef[_0x1983('0x45')][_0x1983('0x8a')]){if(_0x2466ef[_0x1983('0x45')][_0x1983('0x8a')]==0x1){_0x521e59[_0x1983('0x8b')](_0x1983('0x8c'));}else{_0x521e59[_0x1983('0x8b')](_0x1983('0x8d'));}}if(_0x2466ef['query'][_0x1983('0x8e')]){_0x7eb684=_[_0x1983('0x8f')](_0x2466ef[_0x1983('0x45')][_0x1983('0x8e')])?_0x2466ef['query'][_0x1983('0x8e')]:new Array(_0x2466ef['query'][_0x1983('0x8e')]);_0x7eb684[_0x1983('0x77')](function(_0x3d7673){_0xb622bf['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3d7673+',%');});}if(_0x2466ef[_0x1983('0x45')][_0x1983('0x90')]){var _0x93e511=_0x2466ef['query']['filter'][_0x1983('0x91')]('\x5c','\x5c\x5c')[_0x1983('0x91')](/'/g,'\x27\x27');if(qs[_0x1983('0x92')](_0x93e511)){_0x2dd2d['or'](_0x1983('0x93'),_0x93e511+'%');}else{_0x2dd2d['or'](_0x1983('0x94'),qs[_0x1983('0x6e')](_0x93e511))['or'](_0x1983('0x95'),_0x93e511+'%')['or'](_0x1983('0x96'),_0x93e511+'%');}}}_0x521e59[_0x1983('0x80')](_0x2dd2d);_0x521e59[_0x1983('0x97')](_0x1983('0x98'));var _0x5402f8={'type':db['Sequelize'][_0x1983('0x99')][_0x1983('0x9a')],'raw':!![]};var _0x5a7da0=_0x521e59[_0x1983('0x9b')]();_0x5a7da0[_0x1983('0x51')](_0x1983('0x98'));_0x5a7da0[_0x1983('0x51')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x1983('0x67'));if(_0xd7a7e6[_0x1983('0x9c')]){_0xd7a7e6[_0x1983('0x9c')][_0x1983('0x77')](function(_0x4947e8){var _0x70f0d9=_0x4947e8[0x0]===_0x1983('0x9d')?_0x4947e8[0x0]:'i.'+_0x4947e8[0x0];_0x521e59[_0x1983('0x9c')](_0x70f0d9,_0x4947e8[0x1]===_0x1983('0x9e')?![]:!![]);});}if(!_['isEmpty'](_0x7eb684)){_0x521e59['having'](_0xb622bf);_0x5a7da0[_0x1983('0x80')](_0x1983('0x9f'),_0x7eb684);}BPromise[_0x1983('0xa0')]()[_0x1983('0x30')](function(){if(!_0x31b4f5){if(_0x2466ef[_0x1983('0x45')][_0x1983('0x7f')])return;_0x5a7da0[_0x1983('0x80')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x521e59['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x2466ef['user']['role']!=='agent')return;return _0x2466ef[_0x1983('0xa1')][_0x1983('0xa2')]({'attributes':['id'],'raw':!![]})[_0x1983('0x30')](function(_0x263a39){if(_[_0x1983('0x7e')](_0x263a39)){_0x5a7da0[_0x1983('0x80')](_0x1983('0xa3'));_0x521e59[_0x1983('0x80')](_0x1983('0xa3'));}else{_0x5a7da0[_0x1983('0x80')](_0x1983('0x81'),_[_0x1983('0x35')](_0x263a39,'id'));_0x521e59[_0x1983('0x80')](_0x1983('0x81'),_[_0x1983('0x35')](_0x263a39,'id'));}});})[_0x1983('0x30')](function(){if(_0x2466ef[_0x1983('0xa1')][_0x1983('0xa4')]===_0x1983('0xa5')&&!_0x31b4f5&&!_0x2466ef[_0x1983('0x45')][_0x1983('0x7f')])return[];return db[_0x1983('0xa6')]['query'](_0x5a7da0['toString'](),_0x5402f8);})[_0x1983('0x30')](function(_0x5f43f6){_0x25b1d5[_0x1983('0x28')]=_0x5f43f6[_0x1983('0x4b')];if(_0x25b1d5['count']===0x0)return[];return db[_0x1983('0xa6')]['query'](_0x2f3173[_0x1983('0xa7')](),_0x5402f8)[_0x1983('0x30')](function(_0x407ee9){_0x214f02=_[_0x1983('0xa8')](_0x407ee9,'id');_0x5402f8=_[_0x1983('0xa9')](_0x5402f8,{'model':db[_0x1983('0x40')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2466ef[_0x1983('0x45')][_0x1983('0x49')]){_0xd7a7e6[_0x1983('0x4a')][_0x1983('0x77')](function(_0x5472f8){_0x521e59[_0x1983('0x51')]('i.'+_0x5472f8);});}else{_0x521e59[_0x1983('0x51')](_0x1983('0xaa'),_0x1983('0x67'));_0x521e59[_0x1983('0x51')](_0x1983('0xab'),_0x1983('0xac'));_0x521e59['field'](_0x1983('0xad'),'Account.mandatoryDisposition');_0x521e59[_0x1983('0x51')]('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',_0x1983('0x9d'));_0x521e59[_0x1983('0x51')](_0x1983('0xae'));_0x521e59[_0x1983('0x51')](_0x1983('0xaf'),_0x1983('0xb0'));_0x521e59[_0x1983('0x51')](_0x1983('0xb1'),_0x1983('0xb2'));_0x521e59['field']('c.email',_0x1983('0xb3'));_0x521e59[_0x1983('0x51')](_0x1983('0xb4'),_0x1983('0xb5'));_0x521e59[_0x1983('0x51')](_0x1983('0xb6'),_0x1983('0xb7'));_0x521e59['field'](_0x1983('0xb8'),_0x1983('0xb9'));_0x521e59[_0x1983('0x51')](_0x1983('0xba'),_0x1983('0xbb'));_0x521e59[_0x1983('0x51')]('o.internal','Owner.internal');_0x521e59[_0x1983('0x51')](_0x1983('0xbc'),_0x1983('0x36'));}if(_0xd7a7e6[_0x1983('0x4d')])_0x521e59[_0x1983('0x4d')](_0xd7a7e6[_0x1983('0x4d')]);if(_0xd7a7e6[_0x1983('0x26')])_0x521e59[_0x1983('0x26')](_0xd7a7e6[_0x1983('0x26')]);return db[_0x1983('0xa6')][_0x1983('0x45')](_0x521e59['toString'](),_0x5402f8);})['then'](function(_0x4da7ca){if(_0x4da7ca[_0x1983('0x4b')]>0x0)_0x58f74a['where'](_0x1983('0xbd'),_[_0x1983('0x35')](_0x4da7ca,'id'));return db[_0x1983('0xa6')][_0x1983('0x45')](_0x58f74a[_0x1983('0xa7')](),_0x5402f8)['then'](function(_0x44a984){var _0x59efe9=_['groupBy'](_0x44a984,_0x1983('0xbe'));var _0x595ffa=[];_0x4da7ca[_0x1983('0x77')](function(_0x4950ed){_0x595ffa[_0x1983('0x38')](updateOpenchannelInteraction(_0x4950ed,_0x214f02,_0x59efe9));});return BPromise[_0x1983('0xbf')](_0x595ffa);});});})[_0x1983('0x30')](function(_0x4097dc){_0x25b1d5[_0x1983('0xc0')]=_0x4097dc;return _0x25b1d5;})[_0x1983('0x30')](respondWithFilteredResult(_0x1ef0b9,_0xd7a7e6))[_0x1983('0xc1')](handleError(_0x1ef0b9,null));};exports[_0x1983('0xc2')]=function(_0x316dca,_0x589871){var _0x2df67={};if(_0x316dca[_0x1983('0x45')][_0x1983('0x72')]&&_0x316dca[_0x1983('0x45')][_0x1983('0x72')]===_0x1983('0x53')){_0x2df67[_0x1983('0x53')]=_0x316dca[_0x1983('0xc3')]['id'];}else{_0x2df67['id']=_0x316dca['params']['id'];}var _0xcee6ed={'raw':![],'where':_0x2df67},_0x4fa23a={};_0x4fa23a[_0x1983('0x44')]=_[_0x1983('0x46')](db[_0x1983('0x40')][_0x1983('0x41')]);_0x4fa23a['query']=_[_0x1983('0x46')](_0x316dca['query']);_0x4fa23a[_0x1983('0x47')]=_[_0x1983('0x48')](_0x4fa23a[_0x1983('0x44')],_0x4fa23a[_0x1983('0x45')]);_0xcee6ed['attributes']=_[_0x1983('0x48')](_0x4fa23a['model'],qs[_0x1983('0x49')](_0x316dca['query'][_0x1983('0x49')]));_0xcee6ed['attributes']=_0xcee6ed[_0x1983('0x4a')][_0x1983('0x4b')]?_0xcee6ed['attributes']:_0x4fa23a[_0x1983('0x44')];if(_0x316dca[_0x1983('0x45')][_0x1983('0xc4')]){_0xcee6ed[_0x1983('0xc5')]=[{'all':!![]}];}_0xcee6ed=_[_0x1983('0xa9')]({},_0xcee6ed,_0x316dca['options']);return db[_0x1983('0x40')]['find'](_0xcee6ed)[_0x1983('0x30')](handleEntityNotFound(_0x589871,null))['then'](respondWithResult(_0x589871,null))[_0x1983('0xc1')](handleError(_0x589871,null));};exports[_0x1983('0xc6')]=function(_0x532a88,_0x1937e9){return db[_0x1983('0x40')][_0x1983('0xc6')](_0x532a88[_0x1983('0x7c')],{})[_0x1983('0x30')](respondWithResult(_0x1937e9,0xc9))[_0x1983('0xc1')](handleError(_0x1937e9,null));};exports['update']=function(_0x5e8b67,_0x4dc60e){if(_0x5e8b67[_0x1983('0x7c')]['id']){delete _0x5e8b67[_0x1983('0x7c')]['id'];}return db[_0x1983('0x40')][_0x1983('0x66')]({'where':{'id':_0x5e8b67[_0x1983('0xc3')]['id']}})[_0x1983('0x30')](handleEntityNotFound(_0x4dc60e,null))['then'](saveUpdates(_0x5e8b67[_0x1983('0x7c')],null))[_0x1983('0x30')](respondWithResult(_0x4dc60e,null))[_0x1983('0xc1')](handleError(_0x4dc60e,null));};exports['destroy']=function(_0x205610,_0x39c8b5){return db[_0x1983('0x40')][_0x1983('0x66')]({'where':{'id':_0x205610[_0x1983('0xc3')]['id']}})[_0x1983('0x30')](handleEntityNotFound(_0x39c8b5,null))[_0x1983('0x30')](removeEntity(_0x39c8b5,null))[_0x1983('0xc1')](handleError(_0x39c8b5,null));};exports[_0x1983('0xc7')]=function(_0xa85996,_0x16cb8d){return db[_0x1983('0x40')]['describe']()[_0x1983('0x30')](respondWithResult(_0x16cb8d,null))['catch'](handleError(_0x16cb8d,null));};exports[_0x1983('0xc8')]=function(_0x2487fd,_0x27e3f0,_0x128378){return db[_0x1983('0xc9')][_0x1983('0x66')]({'where':{'id':_0x2487fd[_0x1983('0xc3')]['id']}})[_0x1983('0x30')](handleEntityNotFound(_0x27e3f0,null))[_0x1983('0x30')](function(_0x3ac9e1){if(_0x3ac9e1){return _0x3ac9e1[_0x1983('0xc8')](_0x2487fd[_0x1983('0x7c')][_0x1983('0xca')],_[_0x1983('0xcb')](_0x2487fd[_0x1983('0x7c')],[_0x1983('0xca'),'id'])||{});}})[_0x1983('0x30')](respondWithResult(_0x27e3f0,null))[_0x1983('0xc1')](handleError(_0x27e3f0,null));};exports[_0x1983('0xcc')]=function(_0x219af0,_0x5efa7b,_0x376405){var _0x5a655={'raw':![],'where':{}};var _0x3ed117={};var _0x38fda1={'count':0x0,'rows':[]};return db[_0x1983('0x40')]['findOne']({'where':{'id':_0x219af0[_0x1983('0xc3')]['id']}})[_0x1983('0x30')](handleEntityNotFound(_0x5efa7b,null))[_0x1983('0x30')](function(_0x2fbb25){if(_0x2fbb25){_0x3ed117[_0x1983('0x44')]=_[_0x1983('0x46')](db[_0x1983('0xc9')][_0x1983('0x41')]);_0x3ed117['query']=_[_0x1983('0x46')](_0x219af0[_0x1983('0x45')]);_0x3ed117[_0x1983('0x47')]=_['intersection'](_0x3ed117['model'],_0x3ed117[_0x1983('0x45')]);_0x5a655['attributes']=_[_0x1983('0x48')](_0x3ed117[_0x1983('0x44')],qs[_0x1983('0x49')](_0x219af0[_0x1983('0x45')][_0x1983('0x49')]));_0x5a655['attributes']=_0x5a655[_0x1983('0x4a')][_0x1983('0x4b')]?_0x5a655[_0x1983('0x4a')]:_0x3ed117[_0x1983('0x44')];if(!_0x219af0['query'][_0x1983('0x4c')](_0x1983('0xcd'))){_0x5a655[_0x1983('0x4d')]=qs[_0x1983('0x4d')](_0x219af0['query'][_0x1983('0x4d')]);_0x5a655[_0x1983('0x26')]=qs[_0x1983('0x26')](_0x219af0[_0x1983('0x45')][_0x1983('0x26')]);}_0x5a655[_0x1983('0x9c')]=qs['sort'](_0x219af0[_0x1983('0x45')]['sort']);_0x5a655['where']=qs[_0x1983('0x47')](_[_0x1983('0x4f')](_0x219af0[_0x1983('0x45')],_0x3ed117[_0x1983('0x47')]));_0x5a655[_0x1983('0x80')]['OpenchannelInteractionId']=_0x2fbb25['id'];if(_0x219af0[_0x1983('0x45')][_0x1983('0x90')]){_0x5a655[_0x1983('0x80')]=_[_0x1983('0xa9')](_0x5a655['where'],{'$or':_['map'](_0x5a655[_0x1983('0x4a')],function(_0x27353e){var _0x151866={};_0x151866[_0x27353e]={'$like':'%'+_0x219af0[_0x1983('0x45')]['filter']+'%'};return _0x151866;})});}if(_0x219af0[_0x1983('0x45')][_0x1983('0x84')]){var _0x207b7f=_0x219af0[_0x1983('0x45')][_0x1983('0x84')]['split'](',');var _0x21d2b7={};_0x21d2b7[_0x207b7f[0x0]]={'$gte':moment(_0x207b7f[0x1])[_0x1983('0xce')](_0x1983('0xcf'))};_0x5a655[_0x1983('0x80')]=_['merge'](_0x5a655[_0x1983('0x80')],_0x21d2b7);}_0x5a655=_['merge']({},_0x5a655,_0x219af0[_0x1983('0xd0')]);return db[_0x1983('0xc9')][_0x1983('0x28')]({'where':_0x5a655[_0x1983('0x80')]})[_0x1983('0x30')](function(_0x4ebab2){_0x38fda1[_0x1983('0x28')]=_0x4ebab2;if(_0x219af0['query'][_0x1983('0xc4')]){_0x5a655[_0x1983('0xc5')]=[{'all':!![]}];}return db[_0x1983('0xc9')]['findAll'](_0x5a655);})[_0x1983('0x30')](function(_0x274b9b){_0x38fda1[_0x1983('0xc0')]=_0x274b9b;return _0x38fda1;});}})['then'](respondWithFilteredResult(_0x5efa7b,_0x5a655))['catch'](handleError(_0x5efa7b,null));};exports[_0x1983('0xd1')]=function(_0x52ad16,_0xcb005,_0x81d57b){return db[_0x1983('0x40')][_0x1983('0x66')]({'where':{'id':_0x52ad16['params']['id']}})['then'](handleEntityNotFound(_0xcb005,null))[_0x1983('0x30')](function(_0x3b8825){if(_0x3b8825){return _0x3b8825[_0x1983('0xd2')](_0x52ad16['body'][_0x1983('0xca')],_[_0x1983('0xcb')](_0x52ad16[_0x1983('0x7c')],['ids','id'])||{})[_0x1983('0xd3')](function(){return db[_0x1983('0x76')]['findAll']({'attributes':['id',_0x1983('0x32'),'color'],'where':{'id':_0x52ad16[_0x1983('0x7c')][_0x1983('0xca')]}});})['then'](function(_0x89dabb){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x52ad16[_0x1983('0xc3')]['id']),'tags':_0x89dabb||[]});return{'id':Number(_0x52ad16[_0x1983('0xc3')]['id']),'tags':_0x89dabb||[]};});}})[_0x1983('0x30')](respondWithResult(_0xcb005,null))[_0x1983('0xc1')](handleError(_0xcb005,null));};exports[_0x1983('0xd4')]=function(_0x40ee7e,_0x1eb10e,_0x5a9379){return db['OpenchannelInteraction'][_0x1983('0x66')]({'where':{'id':_0x40ee7e[_0x1983('0xc3')]['id']}})[_0x1983('0x30')](handleEntityNotFound(_0x1eb10e,null))['then'](function(_0x345c1d){if(_0x345c1d){return _0x345c1d['removeTags'](_0x40ee7e[_0x1983('0x45')][_0x1983('0xca')]);}})[_0x1983('0x30')](respondWithStatusCode(_0x1eb10e,null))['catch'](handleError(_0x1eb10e,null));};exports['download']=function(_0x1821ca,_0x59d26c){var _0xd9ceb4=moment()[_0x1983('0xd5')]()[_0x1983('0xa7')]();var _0x21ba6f=path[_0x1983('0xd6')](config[_0x1983('0xd7')],_0x1983('0xd8'),_0x1983('0xd9'),_0x1983('0xda'));var _0x5512f8=path[_0x1983('0xd6')](config[_0x1983('0xd7')],_0x1983('0xd8'),_0x1983('0xd9'),'attachments');var _0x31e3aa=path[_0x1983('0xd6')](_0x21ba6f,_0xd9ceb4);var _0x588a4e=util[_0x1983('0xce')](_0x1983('0xdb'),_0x1821ca[_0x1983('0xc3')]['id'],_0xd9ceb4);var _0x1c8c72=path[_0x1983('0xd6')](_0x21ba6f,_0x588a4e);var _0x45bf7=[];_0x45bf7[_0x1983('0x38')]({'model':db[_0x1983('0xdc')],'as':_0x1983('0xdc'),'attributes':['id',_0x1983('0xdd')],'raw':!![]});_0x45bf7[_0x1983('0x38')]({'model':db[_0x1983('0xde')],'as':_0x1983('0x6a'),'attributes':['id',_0x1983('0xdf'),_0x1983('0xe0')],'raw':!![]});if(_0x1821ca[_0x1983('0x45')][_0x1983('0xe1')]){_0x45bf7['push']({'model':db[_0x1983('0xe2')],'as':_0x1983('0xe2'),'raw':!![]});}var _0x4beefd=[{'model':db[_0x1983('0xc9')],'as':'Messages','attributes':['id',_0x1983('0x7c'),_0x1983('0x83'),_0x1983('0xe3'),'secret',_0x1983('0x8a')],'include':_0x45bf7}];_0x4beefd[_0x1983('0x38')]({'model':db[_0x1983('0xe4')],'as':_0x1983('0xe5'),'attributes':['id','name']});_0x4beefd[_0x1983('0x38')]({'model':db[_0x1983('0xdc')],'as':_0x1983('0xe6'),'attributes':['id',_0x1983('0xdd')]});return db[_0x1983('0x40')][_0x1983('0x66')]({'where':{'id':_0x1821ca['params']['id']},'include':_0x4beefd})[_0x1983('0x30')](handleEntityNotFound(_0x59d26c,null))[_0x1983('0x30')](function(_0x3bb556){if(_0x3bb556){var _0x5b811d=_0x3bb556['get']({'plain':!![]});fs[_0x1983('0xe7')](_0x31e3aa);var _0x57847e={'channel':_0x1983('0xe8'),'account':_0x5b811d[_0x1983('0xe5')][_0x1983('0x32')],'agent':_0x5b811d[_0x1983('0xe6')]?_0x5b811d[_0x1983('0xe6')][_0x1983('0xdd')]:_0x1983('0xe9'),'createdAt':moment(_0x5b811d[_0x1983('0x83')])[_0x1983('0xce')](_0x1983('0xcf'))[_0x1983('0xa7')](),'closedAt':_0x5b811d[_0x1983('0x3d')]?moment(_0x5b811d[_0x1983('0xea')])[_0x1983('0xce')](_0x1983('0xcf'))[_0x1983('0xa7')]():'','disposition':_0x5b811d[_0x1983('0xeb')],'visibility':_0x5b811d[_0x1983('0xec')]?'Public':_0x1983('0xed'),'messages':_(_0x5b811d[_0x1983('0xee')])[_0x1983('0x90')]({'secret':![]})[_0x1983('0x35')](function(_0x8709cb){if(_0x8709cb[_0x1983('0xe2')]){var _0x45891c=path[_0x1983('0xd6')](_0x5512f8,_0x8709cb['Attachment'][_0x1983('0xef')]);if(fs[_0x1983('0xf0')](_0x45891c)){fs[_0x1983('0xf1')](_0x45891c)['pipe'](fs['createWriteStream'](path[_0x1983('0xd6')](_0x31e3aa,_0x8709cb[_0x1983('0xe2')][_0x1983('0xef')])));}}return{'date':moment(_0x8709cb[_0x1983('0x83')])[_0x1983('0xce')](_0x1983('0xcf'))[_0x1983('0xa7')](),'sender':_0x8709cb[_0x1983('0xe3')]===_0x1983('0xf2')?_0x8709cb[_0x1983('0xdc')]?_0x8709cb[_0x1983('0xdc')][_0x1983('0xdd')]:_0x1983('0xf3'):_0x8709cb['Contact'][_0x1983('0xdf')]+(_0x8709cb[_0x1983('0x6a')][_0x1983('0xe0')]?'\x20'+_0x8709cb[_0x1983('0x6a')]['lastName']:''),'body':_0x8709cb[_0x1983('0xe2')]?_0x8709cb[_0x1983('0xe2')]['basename']:_0x8709cb['body'],'direction':_0x8709cb['direction']===_0x1983('0xf2')?'A':'C','secret':_0x8709cb['secret'],'read':_0x8709cb[_0x1983('0x8a')],'attachment':_0x8709cb['Attachment']};})['value']()};return ejs[_0x1983('0xf4')](path[_0x1983('0xd6')](config['root'],_0x1983('0xd8'),'views',_0x1983('0xf5')),{'interaction':_0x57847e})['then'](function(_0x5a6c6e){var _0x119747=path['join'](_0x31e3aa,_0x1983('0xf6')+_0x5b811d['id']+'-'+_0xd9ceb4+_0x1983('0xf7'));var _0x17b658={'path':_0x119747,'channel':_0x1983('0xe8'),'interactionId':_0x5b811d['id']};return pdf[_0x1983('0xf8')](_0x5a6c6e,_0x17b658);})['then'](function(){return new BPromise(function(_0x1e5381,_0x3c7281){zipdir(_0x31e3aa,{'saveTo':_0x1c8c72},function(_0x52e61c,_0xdf4f59){if(_0x52e61c)return _0x3c7281(_0x52e61c);return _0x1e5381(_0xdf4f59);});})[_0x1983('0x30')](function(){return new BPromise(function(_0x28e4f9,_0x5b7b29){rimraf(_0x31e3aa,function(_0x29eeb0){if(_0x29eeb0)_0x5b7b29(_0x29eeb0);return _0x28e4f9();});});})['then'](function(){return _0x59d26c[_0x1983('0xf9')](_0x1c8c72,_0x588a4e,function(_0x1e0e4f){if(_0x1e0e4f){console['log']('err',_0x1e0e4f);}else{fs['unlinkSync'](_0x1c8c72);}});});});}else{return _0x59d26c['sendStatus'](0xc8);}})['catch'](handleError(_0x59d26c,null));}; \ No newline at end of file +var _0xeed1=['o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','length','find','unreadMessages','having','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','body','isEmpty','OpenchannelAccountId','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','group','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','toString','sequelize','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','rows','show','params','includeAll','include','options','create','destroy','describe','ids','omit','findOne','OpenchannelMessage','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','Tag','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','direction','secret','Owner','mkdirSync','Openchannel','N.A.','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','out','System','renderFile','views','transcript-','err','unlinkSync','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','save','update','then','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','field','color','from','tools_tags','select','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','users'];(function(_0x27b862,_0x1c5786){var _0x183809=function(_0x26765a){while(--_0x26765a){_0x27b862['push'](_0x27b862['shift']());}};_0x183809(++_0x1c5786);}(_0xeed1,0x186));var _0x1eed=function(_0x4d674b,_0x176474){_0x4d674b=_0x4d674b-0x0;var _0x535a1f=_0xeed1[_0x4d674b];return _0x535a1f;};'use strict';var emlformat=require(_0x1eed('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1eed('0x1'));var rp=require(_0x1eed('0x2'));var moment=require(_0x1eed('0x3'));var BPromise=require(_0x1eed('0x4'));var Mustache=require(_0x1eed('0x5'));var util=require(_0x1eed('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1eed('0x7'));var ejs=require(_0x1eed('0x8'));var fs=require('fs');var fs_extra=require(_0x1eed('0x9'));var _=require('lodash');var squel=require(_0x1eed('0xa'));var crypto=require(_0x1eed('0xb'));var jsforce=require(_0x1eed('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1eed('0x7'));var querystring=require(_0x1eed('0xd'));var Papa=require(_0x1eed('0xe'));var Redis=require('ioredis');var authService=require(_0x1eed('0xf'));var qs=require(_0x1eed('0x10'));var as=require(_0x1eed('0x11'));var pdf=require(_0x1eed('0x12'));var hardwareService=require(_0x1eed('0x13'));var logger=require(_0x1eed('0x14'))(_0x1eed('0x15'));var utils=require(_0x1eed('0x16'));var config=require(_0x1eed('0x17'));var licenseUtil=require(_0x1eed('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x1eed('0x19')](config[_0x1eed('0x1a')],{'host':_0x1eed('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1eed('0x1a')]));require(_0x1eed('0x1c'))[_0x1eed('0x1d')](socket);function respondWithStatusCode(_0xbff8f6,_0x222714){_0x222714=_0x222714||0xcc;return function(_0x1bd2e2){if(_0x1bd2e2){return _0xbff8f6[_0x1eed('0x1e')](_0x222714);}return _0xbff8f6[_0x1eed('0x1f')](_0x222714)[_0x1eed('0x20')]();};}function respondWithResult(_0x3e4f77,_0x36fe5f){_0x36fe5f=_0x36fe5f||0xc8;return function(_0x535830){if(_0x535830){return _0x3e4f77[_0x1eed('0x1f')](_0x36fe5f)[_0x1eed('0x21')](_0x535830);}};}function respondWithFilteredResult(_0xe8bf7d,_0x3cb30b){return function(_0x88b2a6){if(_0x88b2a6){var _0x5aca1a=typeof _0x3cb30b['offset']===_0x1eed('0x22')&&typeof _0x3cb30b[_0x1eed('0x23')]===_0x1eed('0x22');var _0x1ac95c=_0x88b2a6['count'];var _0xe61dcd=_0x5aca1a?0x0:_0x3cb30b[_0x1eed('0x24')];var _0x25ac4f=_0x5aca1a?_0x88b2a6[_0x1eed('0x25')]:_0x3cb30b[_0x1eed('0x24')]+_0x3cb30b[_0x1eed('0x23')];var _0x2152ae;if(_0x25ac4f>=_0x1ac95c){_0x25ac4f=_0x1ac95c;_0x2152ae=0xc8;}else{_0x2152ae=0xce;}_0xe8bf7d[_0x1eed('0x1f')](_0x2152ae);return _0xe8bf7d[_0x1eed('0x26')]('Content-Range',_0xe61dcd+'-'+_0x25ac4f+'/'+_0x1ac95c)[_0x1eed('0x21')](_0x88b2a6);}return null;};}function patchUpdates(_0x2df863){return function(_0x2cb3eb){try{jsonpatch['apply'](_0x2cb3eb,_0x2df863,!![]);}catch(_0x1e42ac){return BPromise['reject'](_0x1e42ac);}return _0x2cb3eb[_0x1eed('0x27')]();};}function saveUpdates(_0x1e7286,_0x1baf83){return function(_0x22cbae){if(_0x22cbae){return _0x22cbae[_0x1eed('0x28')](_0x1e7286)['then'](function(_0x11856f){return _0x11856f;});}return null;};}function removeEntity(_0x20d047,_0x1e3e39){return function(_0xf7c212){if(_0xf7c212){return _0xf7c212['destroy']()[_0x1eed('0x29')](function(){_0x20d047['status'](0xcc)[_0x1eed('0x20')]();});}};}function handleEntityNotFound(_0x2aeddc,_0x1963df){return function(_0x36e892){if(!_0x36e892){_0x2aeddc[_0x1eed('0x1e')](0x194);}return _0x36e892;};}function handleError(_0x16c3d0,_0x51c234){_0x51c234=_0x51c234||0x1f4;return function(_0xcae24c){logger['error'](_0xcae24c[_0x1eed('0x2a')]);if(_0xcae24c['name']){delete _0xcae24c[_0x1eed('0x2b')];}_0x16c3d0['status'](_0x51c234)[_0x1eed('0x2c')](_0xcae24c);};}function getInteractionUsers(_0x22582f,_0x39cb46){return new BPromise(function(_0x46023a,_0x24f6c7){try{if(_0x39cb46[_0x22582f['id']]){_0x22582f[_0x1eed('0x2d')]=_['map'](_0x39cb46[_0x22582f['id']],function(_0x560c98){return{'id':_0x560c98['id'],'fullname':_0x560c98[_0x1eed('0x2e')]};});}}catch(_0x525127){_0x24f6c7(_0x525127);}_0x46023a(_0x22582f);});}function getInteractionTags(_0x1e7113,_0x5cb45f){return new BPromise(function(_0x3896fe,_0x1c344f){try{if(_0x1e7113[_0x1eed('0x2f')]){_0x1e7113[_0x1eed('0x30')]=[];_0x1e7113[_0x1eed('0x2f')][_0x1eed('0x31')](',')[_0x1eed('0x32')](function(_0x4bd4c7){_0x1e7113[_0x1eed('0x30')]['push'](_0x5cb45f[_0x4bd4c7]);});}delete _0x1e7113[_0x1eed('0x2f')];}catch(_0xb639cc){_0x1c344f(_0xb639cc);}_0x3896fe(_0x1e7113);});}function updateOpenchannelInteraction(_0x35b764,_0x45be98,_0x1190f7){return new BPromise(function(_0x2e53a8,_0x4b41b9){return getInteractionUsers(_0x35b764,_0x1190f7)[_0x1eed('0x29')](function(_0x4ef7fb){return getInteractionTags(_0x4ef7fb,_0x45be98);})['then'](function(_0x2463b6){return getStateInteraction(_0x2463b6);})['then'](function(_0x4dbf34){_0x2e53a8(_0x4dbf34);})[_0x1eed('0x33')](function(_0x56155a){_0x4b41b9(_0x56155a);});});}function getStateInteraction(_0x595e75){return new BPromise(function(_0xb274db){_0x595e75[_0x1eed('0x34')]=0x0;_0x595e75[_0x1eed('0x35')]=0x0;_0x595e75[_0x1eed('0x36')]=0x0;_0x595e75[_0x1eed('0x37')]=0x0;_0x595e75[_0x1eed('0x38')]=0x0;if(!_0x595e75[_0x1eed('0x39')]&&!_0x595e75[_0x1eed('0x3a')]){_0x595e75[_0x1eed('0x34')]+=0x1;}if(!_0x595e75[_0x1eed('0x39')]&&_0x595e75[_0x1eed('0x3a')]){_0x595e75[_0x1eed('0x35')]+=0x1;if(_0x595e75['waiting']){_0x595e75['waiting']-=0x1;}}if(_0x595e75[_0x1eed('0x39')]&&_0x595e75[_0x1eed('0x3a')]){_0x595e75[_0x1eed('0x36')]+=0x1;if(_0x595e75[_0x1eed('0x35')]){_0x595e75['talking']-=0x1;}}if(_0x595e75[_0x1eed('0x39')]&&!_0x595e75[_0x1eed('0x3a')]){_0x595e75[_0x1eed('0x37')]+=0x1;if(_0x595e75[_0x1eed('0x34')]){_0x595e75[_0x1eed('0x34')]-=0x1;}}_0x595e75[_0x1eed('0x38')]+=0x1;_0xb274db(_0x595e75);});}exports[_0x1eed('0x3b')]=function(_0x47dafb,_0x557ad9){var _0x4b5093={},_0x13e53a={},_0xd3cd02={'count':0x0,'rows':[]};var _0x17cebc=_[_0x1eed('0x3c')](db[_0x1eed('0x3d')][_0x1eed('0x3e')],function(_0x537909){return{'name':_0x537909[_0x1eed('0x3f')],'type':_0x537909[_0x1eed('0x40')]['key']};});_0x13e53a['model']=_[_0x1eed('0x3c')](_0x17cebc,_0x1eed('0x2b'));_0x13e53a[_0x1eed('0x41')]=_[_0x1eed('0x42')](_0x47dafb[_0x1eed('0x41')]);_0x13e53a['filters']=_[_0x1eed('0x43')](_0x13e53a[_0x1eed('0x44')],_0x13e53a[_0x1eed('0x41')]);_0x4b5093[_0x1eed('0x45')]=_[_0x1eed('0x43')](_0x13e53a[_0x1eed('0x44')],qs['fields'](_0x47dafb['query'][_0x1eed('0x46')]));_0x4b5093['attributes']=_0x4b5093[_0x1eed('0x45')]['length']?_0x4b5093[_0x1eed('0x45')]:_0x13e53a['model'];if(!_0x47dafb[_0x1eed('0x41')][_0x1eed('0x47')](_0x1eed('0x48'))){_0x4b5093[_0x1eed('0x23')]=qs[_0x1eed('0x23')](_0x47dafb[_0x1eed('0x41')][_0x1eed('0x23')]);_0x4b5093[_0x1eed('0x24')]=qs[_0x1eed('0x24')](_0x47dafb['query'][_0x1eed('0x24')]);}_0x4b5093['order']=qs[_0x1eed('0x49')](_0x47dafb[_0x1eed('0x41')]['sort']);_0x4b5093[_0x1eed('0x4a')]=qs[_0x1eed('0x4b')](_['pick'](_0x47dafb['query'],_0x13e53a['filters']),_0x17cebc);var _0x5af416=[];var _0x1d9187=squel['select']()[_0x1eed('0x4c')]('id')[_0x1eed('0x4c')](_0x1eed('0x2b'))[_0x1eed('0x4c')](_0x1eed('0x4d'))[_0x1eed('0x4e')](_0x1eed('0x4f'));var _0xf4f543=squel[_0x1eed('0x50')]()[_0x1eed('0x4c')](_0x1eed('0x51'))[_0x1eed('0x4c')](_0x1eed('0x52'))[_0x1eed('0x4c')](_0x1eed('0x53'))[_0x1eed('0x4e')](_0x1eed('0x54'),'ui')[_0x1eed('0x55')]('users','u',_0x1eed('0x56'));var _0x31160a=squel[_0x1eed('0x50')]()[_0x1eed('0x4e')](_0x1eed('0x57'),'i')[_0x1eed('0x55')](_0x1eed('0x58'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x1eed('0x55')](_0x1eed('0x59'),'o',_0x1eed('0x5a'))['left_join'](_0x1eed('0x5b'),'a',_0x1eed('0x5c'))[_0x1eed('0x55')](_0x1eed('0x5d'),'me',_0x1eed('0x5e'))[_0x1eed('0x55')](_0x1eed('0x5f'),'it',_0x1eed('0x60'))['left_join'](_0x1eed('0x4f'),'t',_0x1eed('0x61'));var _0xf3b699=squel[_0x1eed('0x62')]();var _0x47dfe0=[];var _0x512f74=squel[_0x1eed('0x62')]();var _0xfe25d3;if(_0x47dafb[_0x1eed('0x41')]['search']){_0xfe25d3=as[_0x1eed('0x63')](_0x47dafb[_0x1eed('0x41')][_0x1eed('0x64')]);var _0x59f672=_0xfe25d3[_0x1eed('0x65')];for(var _0x3fae9d=0x0;_0x3fae9d<_0xfe25d3[_0x1eed('0x66')][_0x1eed('0x67')];_0x3fae9d++){var _0x2352e5=_0xfe25d3[_0x1eed('0x66')][_0x3fae9d];var _0x4ca48e='i';var _0x431a99=_[_0x1eed('0x68')](_0x17cebc,[_0x1eed('0x2b'),_0x2352e5[_0x1eed('0x4c')]]);if(!_0x431a99){switch(_0x2352e5[_0x1eed('0x4c')]){case _0x1eed('0x69'):if(_0x2352e5['value']==0x1){_0x31160a[_0x1eed('0x6a')]('`'+_0x2352e5[_0x1eed('0x4c')]+'`\x20=\x200');}else{_0x31160a[_0x1eed('0x6a')]('`'+_0x2352e5[_0x1eed('0x4c')]+'`\x20>\x200');}break;case _0x1eed('0x6b'):if(_0x2352e5['operator']===_0x1eed('0x6c')){if(_0x2352e5[_0x1eed('0x6d')]['split']('\x20')[_0x1eed('0x67')]>0x1){_0xf3b699[_0x59f672](_0x1eed('0x6e'),qs[_0x1eed('0x6f')](_0x2352e5[_0x1eed('0x6d')]),null);}else{var _0x48abd3='%'+_0x2352e5[_0x1eed('0x6d')]+'%';_0xf3b699[_0x59f672](_0x1eed('0x70'),_0x48abd3,_0x48abd3,_0x48abd3);}}else{_0x431a99=_[_0x1eed('0x68')](_0x17cebc,[_0x1eed('0x2b'),_0x1eed('0x71')]);_0x2352e5[_0x1eed('0x4c')]='ContactId';_0x18d8ee=as[_0x1eed('0x72')](_0x4ca48e,_0x431a99[_0x1eed('0x40')],_0x2352e5);_0xf3b699[_0x59f672](_0x18d8ee[_0x1eed('0x73')],_0x18d8ee[_0x1eed('0x6d')]['start'],_0x18d8ee[_0x1eed('0x6d')]['end']);}break;case'Tag':var _0x3ab719=_0x2352e5[_0x1eed('0x6d')]['split'](',')[_0x1eed('0x3c')](function(_0x57d3fd){return Number(_0x57d3fd);});_0x3ab719['forEach'](function(_0x221955){_0x512f74['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x221955+',%');});_0x47dfe0=_[_0x1eed('0x74')](_0x47dfe0,_0x3ab719);break;case _0x1eed('0x75'):if(_0x2352e5[_0x1eed('0x76')]==='$substring'){_0xf3b699[_0x59f672](_0x1eed('0x77'),'%'+_0x2352e5[_0x1eed('0x6d')]+'%',null);}else{_0x431a99=_['find'](_0x17cebc,[_0x1eed('0x2b'),_0x1eed('0x3a')]);_0x2352e5[_0x1eed('0x4c')]=_0x1eed('0x3a');_0x18d8ee=as[_0x1eed('0x72')](_0x4ca48e,_0x431a99['type'],_0x2352e5);_0xf3b699[_0x59f672](_0x18d8ee[_0x1eed('0x73')],_0x18d8ee[_0x1eed('0x6d')][_0x1eed('0x78')],_0x18d8ee['value'][_0x1eed('0x20')]);}break;case _0x1eed('0x79'):_0x18d8ee=as[_0x1eed('0x72')]('me',null,_0x2352e5);_0xf3b699[_0x59f672](_0x18d8ee[_0x1eed('0x73')],_0x18d8ee[_0x1eed('0x6d')]['start'],_0x18d8ee[_0x1eed('0x6d')]['end']);break;}}else{var _0x18d8ee=as[_0x1eed('0x72')](_0x4ca48e,_0x431a99[_0x1eed('0x40')],_0x2352e5);_0xf3b699[_0x59f672](_0x18d8ee[_0x1eed('0x73')],_0x18d8ee[_0x1eed('0x6d')][_0x1eed('0x78')],_0x18d8ee[_0x1eed('0x6d')][_0x1eed('0x20')]);}}}else{var _0x590831=_(_0x47dafb[_0x1eed('0x41')])['keys']()[_0x1eed('0x3c')](function(_0x3cb16e){return _['some'](_0x17cebc,[_0x1eed('0x2b'),_0x3cb16e])?_0x3cb16e:undefined;})['compact']()[_0x1eed('0x6d')]();if(!_[_0x1eed('0x7a')](_0x590831)){_0x590831['forEach'](function(_0x1fd6cf){if(_0x1fd6cf===_0x1eed('0x7b')){_0x31160a[_0x1eed('0x4a')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x1eed('0x7c')](_0x47dafb[_0x1eed('0x41')][_0x1fd6cf]));}else if(_0x1fd6cf===_0x1eed('0x7d')){var _0x487da4=JSON['parse'](_0x47dafb[_0x1eed('0x41')][_0x1fd6cf])[_0x1eed('0x7e')];var _0x14397c=JSON[_0x1eed('0x7f')](_0x47dafb[_0x1eed('0x41')][_0x1fd6cf])[_0x1eed('0x80')];_0x31160a[_0x1eed('0x4a')](_0x1eed('0x81'),_0x487da4,_0x14397c);}else{if(_0x47dafb['query'][_0x1fd6cf]==='null'){_0x31160a[_0x1eed('0x4a')]('i.'+_0x1fd6cf+_0x1eed('0x82'));}else{_0x31160a[_0x1eed('0x4a')]('i.'+_0x1fd6cf+_0x1eed('0x83'),_0x47dafb[_0x1eed('0x41')][_0x1fd6cf]);}}});}if(_0x47dafb['query'][_0x1eed('0x84')]){if(_0x47dafb[_0x1eed('0x41')][_0x1eed('0x84')]==0x1){_0x31160a[_0x1eed('0x6a')](_0x1eed('0x85'));}else{_0x31160a['having'](_0x1eed('0x86'));}}if(_0x47dafb[_0x1eed('0x41')]['tag']){_0x47dfe0=_[_0x1eed('0x87')](_0x47dafb[_0x1eed('0x41')][_0x1eed('0x88')])?_0x47dafb['query'][_0x1eed('0x88')]:new Array(_0x47dafb[_0x1eed('0x41')][_0x1eed('0x88')]);_0x47dfe0['forEach'](function(_0x19f9bd){_0x512f74['or'](_0x1eed('0x89'),'%,'+_0x19f9bd+',%');});}if(_0x47dafb[_0x1eed('0x41')]['filter']){var _0x463b9e=_0x47dafb[_0x1eed('0x41')][_0x1eed('0x8a')][_0x1eed('0x8b')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x1eed('0x8c')](_0x463b9e)){_0xf3b699['or']('i.id\x20LIKE\x20?',_0x463b9e+'%');}else{_0xf3b699['or'](_0x1eed('0x8d'),qs[_0x1eed('0x6f')](_0x463b9e))['or'](_0x1eed('0x8e'),_0x463b9e+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x463b9e+'%');}}}_0x31160a['where'](_0xf3b699);_0x31160a[_0x1eed('0x8f')](_0x1eed('0x90'));var _0x671bbd={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};var _0x245c95=_0x31160a['clone']();_0x245c95[_0x1eed('0x4c')]('i.id');_0x245c95[_0x1eed('0x4c')](_0x1eed('0x91'),_0x1eed('0x69'));if(_0x4b5093[_0x1eed('0x92')]){_0x4b5093['order'][_0x1eed('0x32')](function(_0x5269d6){var _0x48c1a6=_0x5269d6[0x0]===_0x1eed('0x93')?_0x5269d6[0x0]:'i.'+_0x5269d6[0x0];_0x31160a['order'](_0x48c1a6,_0x5269d6[0x1]===_0x1eed('0x94')?![]:!![]);});}if(!_['isEmpty'](_0x47dfe0)){_0x31160a[_0x1eed('0x6a')](_0x512f74);_0x245c95['where'](_0x1eed('0x95'),_0x47dfe0);}BPromise[_0x1eed('0x96')]()[_0x1eed('0x29')](function(){if(!_0xfe25d3){if(_0x47dafb[_0x1eed('0x41')][_0x1eed('0x7b')])return;_0x245c95['where'](_0x1eed('0x97'));_0x31160a[_0x1eed('0x4a')](_0x1eed('0x97'));return;}if(_0x47dafb['user'][_0x1eed('0x98')]!==_0x1eed('0x99'))return;return _0x47dafb['user'][_0x1eed('0x9a')]({'attributes':['id'],'raw':!![]})[_0x1eed('0x29')](function(_0x3578b7){if(_[_0x1eed('0x7a')](_0x3578b7)){_0x245c95[_0x1eed('0x4a')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x31160a[_0x1eed('0x4a')](_0x1eed('0x9b'));}else{_0x245c95[_0x1eed('0x4a')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x3578b7,'id'));_0x31160a[_0x1eed('0x4a')](_0x1eed('0x9c'),_[_0x1eed('0x3c')](_0x3578b7,'id'));}});})[_0x1eed('0x29')](function(){if(_0x47dafb['user']['role']===_0x1eed('0x99')&&!_0xfe25d3&&!_0x47dafb[_0x1eed('0x41')]['OpenchannelAccountId'])return[];return db['sequelize'][_0x1eed('0x41')](_0x245c95[_0x1eed('0x9d')](),_0x671bbd);})[_0x1eed('0x29')](function(_0x3d9f1a){_0xd3cd02[_0x1eed('0x25')]=_0x3d9f1a[_0x1eed('0x67')];if(_0xd3cd02[_0x1eed('0x25')]===0x0)return[];return db[_0x1eed('0x9e')]['query'](_0x1d9187['toString'](),_0x671bbd)[_0x1eed('0x29')](function(_0x229424){_0x5af416=_['keyBy'](_0x229424,'id');_0x671bbd=_[_0x1eed('0x9f')](_0x671bbd,{'model':db[_0x1eed('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x47dafb[_0x1eed('0x41')]['fields']){_0x4b5093[_0x1eed('0x45')][_0x1eed('0x32')](function(_0x49572e){_0x31160a[_0x1eed('0x4c')]('i.'+_0x49572e);});}else{_0x31160a[_0x1eed('0x4c')](_0x1eed('0x91'),_0x1eed('0x69'));_0x31160a[_0x1eed('0x4c')](_0x1eed('0xa0'),_0x1eed('0xa1'));_0x31160a[_0x1eed('0x4c')](_0x1eed('0xa2'),_0x1eed('0xa3'));_0x31160a['field'](_0x1eed('0xa4'),_0x1eed('0x93'));_0x31160a['field']('i.*');_0x31160a[_0x1eed('0x4c')](_0x1eed('0xa5'),'Contact.firstName');_0x31160a[_0x1eed('0x4c')](_0x1eed('0xa6'),_0x1eed('0xa7'));_0x31160a[_0x1eed('0x4c')](_0x1eed('0xa8'),_0x1eed('0xa9'));_0x31160a[_0x1eed('0x4c')]('c.phone',_0x1eed('0xaa'));_0x31160a[_0x1eed('0x4c')](_0x1eed('0xab'),_0x1eed('0xac'));_0x31160a[_0x1eed('0x4c')](_0x1eed('0xad'),_0x1eed('0xae'));_0x31160a[_0x1eed('0x4c')](_0x1eed('0xaf'),_0x1eed('0xb0'));_0x31160a[_0x1eed('0x4c')](_0x1eed('0xb1'),_0x1eed('0xb2'));_0x31160a[_0x1eed('0x4c')](_0x1eed('0xb3'),'TagIds');}if(_0x4b5093['limit'])_0x31160a['limit'](_0x4b5093['limit']);if(_0x4b5093[_0x1eed('0x24')])_0x31160a[_0x1eed('0x24')](_0x4b5093[_0x1eed('0x24')]);return db[_0x1eed('0x9e')]['query'](_0x31160a['toString'](),_0x671bbd);})[_0x1eed('0x29')](function(_0x3e963d){if(_0x3e963d[_0x1eed('0x67')]>0x0)_0xf4f543[_0x1eed('0x4a')](_0x1eed('0xb4'),_[_0x1eed('0x3c')](_0x3e963d,'id'));return db[_0x1eed('0x9e')][_0x1eed('0x41')](_0xf4f543[_0x1eed('0x9d')](),_0x671bbd)[_0x1eed('0x29')](function(_0x3523e2){var _0x29c965=_[_0x1eed('0xb5')](_0x3523e2,_0x1eed('0xb6'));var _0x2f6e07=[];_0x3e963d[_0x1eed('0x32')](function(_0x415345){_0x2f6e07[_0x1eed('0xb7')](updateOpenchannelInteraction(_0x415345,_0x5af416,_0x29c965));});return BPromise['all'](_0x2f6e07);});});})[_0x1eed('0x29')](function(_0x270c73){_0xd3cd02[_0x1eed('0xb8')]=_0x270c73;return _0xd3cd02;})[_0x1eed('0x29')](respondWithFilteredResult(_0x557ad9,_0x4b5093))[_0x1eed('0x33')](handleError(_0x557ad9,null));};exports[_0x1eed('0xb9')]=function(_0x47a61a,_0x18a53d){var _0x315179={};if(_0x47a61a[_0x1eed('0x41')]['type']&&_0x47a61a[_0x1eed('0x41')][_0x1eed('0x40')]===_0x1eed('0x4e')){_0x315179[_0x1eed('0x4e')]=_0x47a61a[_0x1eed('0xba')]['id'];}else{_0x315179['id']=_0x47a61a[_0x1eed('0xba')]['id'];}var _0x5507fd={'raw':![],'where':_0x315179},_0x3e96ff={};_0x3e96ff[_0x1eed('0x44')]=_['keys'](db['OpenchannelInteraction'][_0x1eed('0x3e')]);_0x3e96ff[_0x1eed('0x41')]=_[_0x1eed('0x42')](_0x47a61a[_0x1eed('0x41')]);_0x3e96ff[_0x1eed('0x4b')]=_[_0x1eed('0x43')](_0x3e96ff[_0x1eed('0x44')],_0x3e96ff['query']);_0x5507fd['attributes']=_['intersection'](_0x3e96ff[_0x1eed('0x44')],qs[_0x1eed('0x46')](_0x47a61a[_0x1eed('0x41')][_0x1eed('0x46')]));_0x5507fd[_0x1eed('0x45')]=_0x5507fd[_0x1eed('0x45')]['length']?_0x5507fd[_0x1eed('0x45')]:_0x3e96ff[_0x1eed('0x44')];if(_0x47a61a[_0x1eed('0x41')][_0x1eed('0xbb')]){_0x5507fd[_0x1eed('0xbc')]=[{'all':!![]}];}_0x5507fd=_[_0x1eed('0x9f')]({},_0x5507fd,_0x47a61a[_0x1eed('0xbd')]);return db[_0x1eed('0x3d')][_0x1eed('0x68')](_0x5507fd)[_0x1eed('0x29')](handleEntityNotFound(_0x18a53d,null))['then'](respondWithResult(_0x18a53d,null))[_0x1eed('0x33')](handleError(_0x18a53d,null));};exports[_0x1eed('0xbe')]=function(_0x241629,_0x1b90f9){return db[_0x1eed('0x3d')][_0x1eed('0xbe')](_0x241629[_0x1eed('0x79')],{})[_0x1eed('0x29')](respondWithResult(_0x1b90f9,0xc9))[_0x1eed('0x33')](handleError(_0x1b90f9,null));};exports[_0x1eed('0x28')]=function(_0x42b309,_0x1a8ecb){if(_0x42b309[_0x1eed('0x79')]['id']){delete _0x42b309[_0x1eed('0x79')]['id'];}return db[_0x1eed('0x3d')][_0x1eed('0x68')]({'where':{'id':_0x42b309[_0x1eed('0xba')]['id']}})['then'](handleEntityNotFound(_0x1a8ecb,null))[_0x1eed('0x29')](saveUpdates(_0x42b309[_0x1eed('0x79')],null))['then'](respondWithResult(_0x1a8ecb,null))['catch'](handleError(_0x1a8ecb,null));};exports[_0x1eed('0xbf')]=function(_0x3d3d9b,_0x18df88){return db['OpenchannelInteraction'][_0x1eed('0x68')]({'where':{'id':_0x3d3d9b['params']['id']}})['then'](handleEntityNotFound(_0x18df88,null))['then'](removeEntity(_0x18df88,null))['catch'](handleError(_0x18df88,null));};exports[_0x1eed('0xc0')]=function(_0x1a070f,_0x346a24){return db[_0x1eed('0x3d')]['describe']()[_0x1eed('0x29')](respondWithResult(_0x346a24,null))['catch'](handleError(_0x346a24,null));};exports['addMessage']=function(_0x19506b,_0x3200fd,_0x5e5f38){return db['OpenchannelMessage'][_0x1eed('0x68')]({'where':{'id':_0x19506b['params']['id']}})['then'](handleEntityNotFound(_0x3200fd,null))[_0x1eed('0x29')](function(_0x11c436){if(_0x11c436){return _0x11c436['addMessage'](_0x19506b[_0x1eed('0x79')][_0x1eed('0xc1')],_[_0x1eed('0xc2')](_0x19506b[_0x1eed('0x79')],[_0x1eed('0xc1'),'id'])||{});}})['then'](respondWithResult(_0x3200fd,null))[_0x1eed('0x33')](handleError(_0x3200fd,null));};exports['getMessages']=function(_0x5055fb,_0xea9508,_0x86a3f3){var _0x10a993={'raw':![],'where':{}};var _0x1c0a2d={};var _0x812ca7={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x1eed('0xc3')]({'where':{'id':_0x5055fb[_0x1eed('0xba')]['id']}})[_0x1eed('0x29')](handleEntityNotFound(_0xea9508,null))['then'](function(_0x3ce810){if(_0x3ce810){_0x1c0a2d[_0x1eed('0x44')]=_['keys'](db[_0x1eed('0xc4')][_0x1eed('0x3e')]);_0x1c0a2d['query']=_[_0x1eed('0x42')](_0x5055fb[_0x1eed('0x41')]);_0x1c0a2d[_0x1eed('0x4b')]=_[_0x1eed('0x43')](_0x1c0a2d['model'],_0x1c0a2d[_0x1eed('0x41')]);_0x10a993[_0x1eed('0x45')]=_[_0x1eed('0x43')](_0x1c0a2d['model'],qs[_0x1eed('0x46')](_0x5055fb[_0x1eed('0x41')][_0x1eed('0x46')]));_0x10a993[_0x1eed('0x45')]=_0x10a993[_0x1eed('0x45')]['length']?_0x10a993[_0x1eed('0x45')]:_0x1c0a2d['model'];if(!_0x5055fb['query'][_0x1eed('0x47')](_0x1eed('0x48'))){_0x10a993[_0x1eed('0x23')]=qs[_0x1eed('0x23')](_0x5055fb['query']['limit']);_0x10a993[_0x1eed('0x24')]=qs[_0x1eed('0x24')](_0x5055fb[_0x1eed('0x41')]['offset']);}_0x10a993[_0x1eed('0x92')]=qs['sort'](_0x5055fb['query'][_0x1eed('0x49')]);_0x10a993[_0x1eed('0x4a')]=qs['filters'](_['pick'](_0x5055fb[_0x1eed('0x41')],_0x1c0a2d[_0x1eed('0x4b')]));_0x10a993[_0x1eed('0x4a')]['OpenchannelInteractionId']=_0x3ce810['id'];if(_0x5055fb[_0x1eed('0x41')][_0x1eed('0x8a')]){_0x10a993[_0x1eed('0x4a')]=_[_0x1eed('0x9f')](_0x10a993[_0x1eed('0x4a')],{'$or':_[_0x1eed('0x3c')](_0x10a993[_0x1eed('0x45')],function(_0x5092e8){var _0x5f0182={};_0x5f0182[_0x5092e8]={'$like':'%'+_0x5055fb[_0x1eed('0x41')][_0x1eed('0x8a')]+'%'};return _0x5f0182;})});}if(_0x5055fb[_0x1eed('0x41')][_0x1eed('0x7e')]){var _0x5399fa=_0x5055fb[_0x1eed('0x41')][_0x1eed('0x7e')][_0x1eed('0x31')](',');var _0x283f22={};_0x283f22[_0x5399fa[0x0]]={'$gte':moment(_0x5399fa[0x1])['format'](_0x1eed('0xc5'))};_0x10a993[_0x1eed('0x4a')]=_[_0x1eed('0x9f')](_0x10a993[_0x1eed('0x4a')],_0x283f22);}_0x10a993=_[_0x1eed('0x9f')]({},_0x10a993,_0x5055fb[_0x1eed('0xbd')]);return db[_0x1eed('0xc4')][_0x1eed('0x25')]({'where':_0x10a993[_0x1eed('0x4a')]})[_0x1eed('0x29')](function(_0x3a239b){_0x812ca7[_0x1eed('0x25')]=_0x3a239b;if(_0x5055fb['query']['includeAll']){_0x10a993[_0x1eed('0xbc')]=[{'all':!![]}];}return db[_0x1eed('0xc4')][_0x1eed('0xc6')](_0x10a993);})[_0x1eed('0x29')](function(_0x4654ca){_0x812ca7['rows']=_0x4654ca;return _0x812ca7;});}})['then'](respondWithFilteredResult(_0xea9508,_0x10a993))[_0x1eed('0x33')](handleError(_0xea9508,null));};exports[_0x1eed('0xc7')]=function(_0x265b5e,_0xa683b0,_0x36e330){return db[_0x1eed('0x3d')][_0x1eed('0x68')]({'where':{'id':_0x265b5e[_0x1eed('0xba')]['id']}})[_0x1eed('0x29')](handleEntityNotFound(_0xa683b0,null))[_0x1eed('0x29')](function(_0x48ed7e){if(_0x48ed7e){return _0x48ed7e[_0x1eed('0xc8')](_0x265b5e[_0x1eed('0x79')][_0x1eed('0xc1')],_['omit'](_0x265b5e[_0x1eed('0x79')],[_0x1eed('0xc1'),'id'])||{})['spread'](function(){return db[_0x1eed('0xc9')][_0x1eed('0xc6')]({'attributes':['id','name',_0x1eed('0x4d')],'where':{'id':_0x265b5e[_0x1eed('0x79')]['ids']}});})[_0x1eed('0x29')](function(_0x5d02e3){socket['emit'](_0x1eed('0xca'),{'id':Number(_0x265b5e[_0x1eed('0xba')]['id']),'tags':_0x5d02e3||[]});return{'id':Number(_0x265b5e[_0x1eed('0xba')]['id']),'tags':_0x5d02e3||[]};});}})[_0x1eed('0x29')](respondWithResult(_0xa683b0,null))[_0x1eed('0x33')](handleError(_0xa683b0,null));};exports[_0x1eed('0xcb')]=function(_0x46b9b2,_0x33174d,_0x5cbe59){return db[_0x1eed('0x3d')][_0x1eed('0x68')]({'where':{'id':_0x46b9b2[_0x1eed('0xba')]['id']}})[_0x1eed('0x29')](handleEntityNotFound(_0x33174d,null))[_0x1eed('0x29')](function(_0xaf07e7){if(_0xaf07e7){return _0xaf07e7[_0x1eed('0xcb')](_0x46b9b2[_0x1eed('0x41')]['ids']);}})[_0x1eed('0x29')](respondWithStatusCode(_0x33174d,null))[_0x1eed('0x33')](handleError(_0x33174d,null));};exports[_0x1eed('0xcc')]=function(_0x208d63,_0x19f13d){var _0x16d265=moment()[_0x1eed('0xcd')]()['toString']();var _0xb8c6d2=path[_0x1eed('0xce')](config[_0x1eed('0xcf')],_0x1eed('0xd0'),_0x1eed('0xd1'),_0x1eed('0xd2'));var _0x164c21=path[_0x1eed('0xce')](config[_0x1eed('0xcf')],'server',_0x1eed('0xd1'),_0x1eed('0xd3'));var _0x47d21f=path[_0x1eed('0xce')](_0xb8c6d2,_0x16d265);var _0x42d9b5=util[_0x1eed('0xd4')](_0x1eed('0xd5'),_0x208d63[_0x1eed('0xba')]['id'],_0x16d265);var _0x9a2980=path['join'](_0xb8c6d2,_0x42d9b5);var _0x4c88ef=[];_0x4c88ef[_0x1eed('0xb7')]({'model':db['User'],'as':'User','attributes':['id',_0x1eed('0x2e')],'raw':!![]});_0x4c88ef[_0x1eed('0xb7')]({'model':db[_0x1eed('0xd6')],'as':'Contact','attributes':['id',_0x1eed('0xd7'),_0x1eed('0xd8')],'raw':!![]});if(_0x208d63['query']['attachments']){_0x4c88ef[_0x1eed('0xb7')]({'model':db[_0x1eed('0xd9')],'as':'Attachment','raw':!![]});}var _0x3736e6=[{'model':db[_0x1eed('0xc4')],'as':_0x1eed('0xda'),'attributes':['id',_0x1eed('0x79'),_0x1eed('0x7d'),_0x1eed('0xdb'),_0x1eed('0xdc'),_0x1eed('0x84')],'include':_0x4c88ef}];_0x3736e6[_0x1eed('0xb7')]({'model':db['OpenchannelAccount'],'as':'Account','attributes':['id','name']});_0x3736e6['push']({'model':db[_0x1eed('0x75')],'as':_0x1eed('0xdd'),'attributes':['id',_0x1eed('0x2e')]});return db[_0x1eed('0x3d')][_0x1eed('0x68')]({'where':{'id':_0x208d63[_0x1eed('0xba')]['id']},'include':_0x3736e6})[_0x1eed('0x29')](handleEntityNotFound(_0x19f13d,null))[_0x1eed('0x29')](function(_0x2902ae){if(_0x2902ae){var _0x1601fd=_0x2902ae['get']({'plain':!![]});fs[_0x1eed('0xde')](_0x47d21f);var _0x5da9af={'channel':_0x1eed('0xdf'),'account':_0x1601fd['Account']['name'],'agent':_0x1601fd[_0x1eed('0xdd')]?_0x1601fd[_0x1eed('0xdd')]['fullname']:_0x1eed('0xe0'),'createdAt':moment(_0x1601fd['createdAt'])['format'](_0x1eed('0xc5'))['toString'](),'closedAt':_0x1601fd[_0x1eed('0x39')]?moment(_0x1601fd[_0x1eed('0xe1')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x1eed('0x9d')]():'','disposition':_0x1601fd[_0x1eed('0xe2')],'visibility':_0x1601fd[_0x1eed('0xe3')]?_0x1eed('0xe4'):_0x1eed('0xe5'),'messages':_(_0x1601fd[_0x1eed('0xda')])[_0x1eed('0x8a')]({'secret':![]})['map'](function(_0x3cf787){if(_0x3cf787[_0x1eed('0xd9')]){var _0x57d690=path[_0x1eed('0xce')](_0x164c21,_0x3cf787['Attachment'][_0x1eed('0xe6')]);if(fs[_0x1eed('0xe7')](_0x57d690)){fs[_0x1eed('0xe8')](_0x57d690)['pipe'](fs['createWriteStream'](path[_0x1eed('0xce')](_0x47d21f,_0x3cf787[_0x1eed('0xd9')][_0x1eed('0xe6')])));}}return{'date':moment(_0x3cf787[_0x1eed('0x7d')])[_0x1eed('0xd4')](_0x1eed('0xc5'))[_0x1eed('0x9d')](),'sender':_0x3cf787[_0x1eed('0xdb')]===_0x1eed('0xe9')?_0x3cf787[_0x1eed('0x75')]?_0x3cf787['User'][_0x1eed('0x2e')]:_0x1eed('0xea'):_0x3cf787[_0x1eed('0x6b')][_0x1eed('0xd7')]+(_0x3cf787[_0x1eed('0x6b')][_0x1eed('0xd8')]?'\x20'+_0x3cf787[_0x1eed('0x6b')]['lastName']:''),'body':_0x3cf787['Attachment']?_0x3cf787[_0x1eed('0xd9')][_0x1eed('0xe6')]:_0x3cf787['body'],'direction':_0x3cf787[_0x1eed('0xdb')]===_0x1eed('0xe9')?'A':'C','secret':_0x3cf787['secret'],'read':_0x3cf787[_0x1eed('0x84')],'attachment':_0x3cf787[_0x1eed('0xd9')]};})['value']()};return ejs[_0x1eed('0xeb')](path[_0x1eed('0xce')](config[_0x1eed('0xcf')],_0x1eed('0xd0'),_0x1eed('0xec'),'downloadInteraction.ejs'),{'interaction':_0x5da9af})[_0x1eed('0x29')](function(_0x95ec60){var _0x3e6d2e=path['join'](_0x47d21f,_0x1eed('0xed')+_0x1601fd['id']+'-'+_0x16d265+'.pdf');var _0x55ffcb={'path':_0x3e6d2e,'channel':_0x1eed('0xdf'),'interactionId':_0x1601fd['id']};return pdf['createPdfFromHTML'](_0x95ec60,_0x55ffcb);})[_0x1eed('0x29')](function(){return new BPromise(function(_0x528a53,_0x335cd0){zipdir(_0x47d21f,{'saveTo':_0x9a2980},function(_0x55ff6b,_0xb05bbb){if(_0x55ff6b)return _0x335cd0(_0x55ff6b);return _0x528a53(_0xb05bbb);});})['then'](function(){return new BPromise(function(_0x5dee0a,_0x1f6170){rimraf(_0x47d21f,function(_0x5385fa){if(_0x5385fa)_0x1f6170(_0x5385fa);return _0x5dee0a();});});})[_0x1eed('0x29')](function(){return _0x19f13d[_0x1eed('0xcc')](_0x9a2980,_0x42d9b5,function(_0x1e1ca6){if(_0x1e1ca6){console['log'](_0x1eed('0xee'),_0x1e1ca6);}else{fs[_0x1eed('0xef')](_0x9a2980);}});});});}else{return _0x19f13d['sendStatus'](0xc8);}})[_0x1eed('0x33')](handleError(_0x19f13d,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index a75783b..2c60370 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 _0xe774=['OpenchannelMessage','setMaxListeners','save','update','remove','setDataValue','Users','map','findAll','then','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','OpenchannelInteraction','../../mysqldb'];(function(_0x58cf2b,_0x4b3053){var _0x57bfa9=function(_0x3ef34f){while(--_0x3ef34f){_0x58cf2b['push'](_0x58cf2b['shift']());}};_0x57bfa9(++_0x4b3053);}(_0xe774,0x95));var _0x4e77=function(_0x58c17e,_0x378f45){_0x58c17e=_0x58c17e-0x0;var _0x3b6fc2=_0xe774[_0x58c17e];return _0x3b6fc2;};'use strict';var EventEmitter=require(_0x4e77('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x4e77('0x1')];var OpenchannelMessage=require(_0x4e77('0x2'))['db'][_0x4e77('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4e77('0x4')](0x0);var events={'afterCreate':_0x4e77('0x5'),'afterUpdate':_0x4e77('0x6'),'afterDestroy':_0x4e77('0x7')};function emitEvent(_0xc3719d){return function(_0x57bbb3,_0xefb78d,_0x17874f){_0x57bbb3['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x3f04c2){_0x57bbb3[_0x4e77('0x8')](_0x4e77('0x9'),_0x3f04c2[_0x4e77('0xa')](function(_0xd5157){return{'id':_0xd5157['id']};}));return OpenchannelMessage[_0x4e77('0xb')]({'where':{'OpenchannelInteractionId':_0x57bbb3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4e77('0xc')](function(_0x695a05){_0x57bbb3[_0x4e77('0x8')](_0x4e77('0xd'),_0x695a05['length']);OpenchannelInteractionEvents[_0x4e77('0xe')](_0xc3719d+':'+_0x57bbb3['id'],_0x57bbb3);OpenchannelInteractionEvents[_0x4e77('0xe')](_0xc3719d,_0x57bbb3);_0x17874f(null);})[_0x4e77('0xf')](_0x17874f(null));};}for(var e in events){if(events[_0x4e77('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x4e77('0x11')](e,emitEvent(event));}}module[_0x4e77('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x6135=['exports','OpenchannelInteraction','../../mysqldb','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','catch','hasOwnProperty','hook'];(function(_0x36d11c,_0x6dffa7){var _0xd95b50=function(_0x5ed180){while(--_0x5ed180){_0x36d11c['push'](_0x36d11c['shift']());}};_0xd95b50(++_0x6dffa7);}(_0x6135,0x101));var _0x5613=function(_0x4c9f6a,_0xcb2cb2){_0x4c9f6a=_0x4c9f6a-0x0;var _0x5df5b9=_0x6135[_0x4c9f6a];return _0x5df5b9;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0x5613('0x0')];var OpenchannelMessage=require(_0x5613('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x5613('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5613('0x3'),'afterDestroy':_0x5613('0x4')};function emitEvent(_0x260ab4){return function(_0x4f7ceb,_0x1e4792,_0x4ad215){_0x4f7ceb[_0x5613('0x5')]({'attributes':['id'],'raw':!![]})[_0x5613('0x6')](function(_0x8f0b50){_0x4f7ceb[_0x5613('0x7')](_0x5613('0x8'),_0x8f0b50['map'](function(_0x6edd9c){return{'id':_0x6edd9c['id']};}));return OpenchannelMessage[_0x5613('0x9')]({'where':{'OpenchannelInteractionId':_0x4f7ceb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5613('0x6')](function(_0xf7d386){_0x4f7ceb[_0x5613('0x7')](_0x5613('0xa'),_0xf7d386[_0x5613('0xb')]);OpenchannelInteractionEvents['emit'](_0x260ab4+':'+_0x4f7ceb['id'],_0x4f7ceb);OpenchannelInteractionEvents['emit'](_0x260ab4,_0x4f7ceb);_0x4ad215(null);})[_0x5613('0xc')](_0x4ad215(null));};}for(var e in events){if(events[_0x5613('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x5613('0xe')](e,emitEvent(event));}}module[_0x5613('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 4fa6a90..231ad96 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 _0x0cde=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelInteraction.attributes','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','closed'];(function(_0x168d05,_0x3170f7){var _0x3d31a9=function(_0x22912f){while(--_0x22912f){_0x168d05['push'](_0x168d05['shift']());}};_0x3d31a9(++_0x3170f7);}(_0x0cde,0x1df));var _0xe0cd=function(_0x3ca412,_0x191194){_0x3ca412=_0x3ca412-0x0;var _0x299e00=_0x0cde[_0x3ca412];return _0x299e00;};'use strict';var _=require(_0xe0cd('0x0'));var util=require(_0xe0cd('0x1'));var logger=require(_0xe0cd('0x2'))(_0xe0cd('0x3'));var moment=require(_0xe0cd('0x4'));var BPromise=require(_0xe0cd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe0cd('0x6'));var rimraf=require(_0xe0cd('0x7'));var config=require('../../config/environment');var attributes=require(_0xe0cd('0x8'));module['exports']=function(_0xaf80c5,_0x75d61f){return _0xaf80c5['define'](_0xe0cd('0x9'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe0cd('0xa'),'collate':_0xe0cd('0xb'),'hooks':{'beforeUpdate':function(_0x36a5d1,_0x2192a3,_0x592120){if(_0x36a5d1[_0xe0cd('0xc')](_0xe0cd('0xd'))){_0x36a5d1[_0xe0cd('0xe')]=moment()[_0xe0cd('0xf')](_0xe0cd('0x10'));}_0x592120(null,_0x36a5d1);}}});}; \ No newline at end of file +var _0x5adb=['OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','request-promise','path','rimraf','./openchannelInteraction.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5adb,0x84));var _0xb5ad=function(_0x2110bb,_0x5bf49e){_0x2110bb=_0x2110bb-0x0;var _0x5cf87c=_0x5adb[_0x2110bb];return _0x5cf87c;};'use strict';var _=require('lodash');var util=require(_0xb5ad('0x0'));var logger=require(_0xb5ad('0x1'))('api');var moment=require(_0xb5ad('0x2'));var BPromise=require('bluebird');var rp=require(_0xb5ad('0x3'));var fs=require('fs');var path=require(_0xb5ad('0x4'));var rimraf=require(_0xb5ad('0x5'));var config=require('../../config/environment');var attributes=require(_0xb5ad('0x6'));module[_0xb5ad('0x7')]=function(_0x806ac5,_0xc4fd4){return _0x806ac5['define'](_0xb5ad('0x8'),attributes,{'tableName':_0xb5ad('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb5ad('0xa'),'hooks':{'beforeUpdate':function(_0x178dd3,_0x3c4b86,_0x4e6f41){if(_0x178dd3['changed'](_0xb5ad('0xb'))){_0x178dd3['closedAt']=moment()[_0xb5ad('0xc')](_0xb5ad('0xd'));}_0x4e6f41(null,_0x178dd3);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 5531dc3..aebaa07 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 _0x1dfd=['where','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','attributes','limit','AddTagsToOpenchannelInteraction','find'];(function(_0x22e34a,_0x5dd00c){var _0x85bbc1=function(_0x290382){while(--_0x290382){_0x22e34a['push'](_0x22e34a['shift']());}};_0x85bbc1(++_0x5dd00c);}(_0x1dfd,0xd9));var _0xd1df=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x1dfd[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xd1df('0x0'));var util=require(_0xd1df('0x1'));var moment=require(_0xd1df('0x2'));var BPromise=require('bluebird');var rs=require(_0xd1df('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1df('0x4'))['db'];var utils=require(_0xd1df('0x5'));var logger=require(_0xd1df('0x6'))(_0xd1df('0x7'));var config=require('../../config/environment');var jayson=require(_0xd1df('0x8'));var client=jayson[_0xd1df('0x9')][_0xd1df('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd1df('0xb')],{'host':_0xd1df('0xc'),'port':0x18eb});var socket=require(_0xd1df('0xd'))(new Redis(config[_0xd1df('0xb')]));require(_0xd1df('0xe'))[_0xd1df('0xf')](socket);function respondWithRpcPromise(_0x4c2912,_0x5ecccc,_0x3e8934){return new BPromise(function(_0x1e3bf1,_0x30eb9e){return client['request'](_0x4c2912,_0x3e8934)[_0xd1df('0x10')](function(_0xd6b7f5){logger[_0xd1df('0x11')](_0xd1df('0x12'),_0x5ecccc,_0xd1df('0x13'));logger[_0xd1df('0x14')](_0xd1df('0x15'),_0x5ecccc,'request\x20sent',JSON[_0xd1df('0x16')](_0xd6b7f5));if(_0xd6b7f5[_0xd1df('0x17')]){if(_0xd6b7f5[_0xd1df('0x17')]['code']===0x1f4){logger[_0xd1df('0x17')](_0xd1df('0x12'),_0x5ecccc,_0xd6b7f5['error']['message']);return _0x30eb9e(_0xd6b7f5[_0xd1df('0x17')][_0xd1df('0x18')]);}logger[_0xd1df('0x17')](_0xd1df('0x12'),_0x5ecccc,_0xd6b7f5['error'][_0xd1df('0x18')]);return _0x1e3bf1(_0xd6b7f5[_0xd1df('0x17')]['message']);}else{logger[_0xd1df('0x11')](_0xd1df('0x12'),_0x5ecccc,_0xd1df('0x13'));_0x1e3bf1(_0xd6b7f5[_0xd1df('0x19')][_0xd1df('0x18')]);}})[_0xd1df('0x1a')](function(_0x2086ef){logger[_0xd1df('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x5ecccc,_0x2086ef);_0x30eb9e(_0x2086ef);});});}exports[_0xd1df('0x1b')]=function(_0x838f78){var _0xc2555e=this;return new Promise(function(_0x2a57ba,_0x2ad14a){return db[_0xd1df('0x1c')]['update'](_0x838f78['body'],{'raw':_0x838f78['options']?_0x838f78[_0xd1df('0x1d')][_0xd1df('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x838f78['options']?_0x838f78['options']['where']||null:null,'attributes':_0x838f78[_0xd1df('0x1d')]?_0x838f78[_0xd1df('0x1d')][_0xd1df('0x1f')]||null:null,'limit':_0x838f78['options']?_0x838f78[_0xd1df('0x1d')][_0xd1df('0x20')]||null:null})[_0xd1df('0x10')](function(_0x525ad4){logger[_0xd1df('0x11')](_0xd1df('0x1b'),_0x838f78);logger[_0xd1df('0x14')](_0xd1df('0x1b'),_0x838f78,JSON[_0xd1df('0x16')](_0x525ad4));_0x2a57ba(_0x525ad4);})[_0xd1df('0x1a')](function(_0x365fa6){logger[_0xd1df('0x17')](_0xd1df('0x1b'),_0x365fa6[_0xd1df('0x18')],_0x838f78);_0x2ad14a(_0xc2555e[_0xd1df('0x17')](0x1f4,_0x365fa6[_0xd1df('0x18')]));});});};exports[_0xd1df('0x21')]=function(_0x864ff3){return new Promise(function(_0x4e66a7,_0x57487d){return db['OpenchannelInteraction'][_0xd1df('0x22')]({'where':_0x864ff3[_0xd1df('0x1d')]?_0x864ff3['options'][_0xd1df('0x23')]||null:null})[_0xd1df('0x10')](function(_0x26aad9){if(_0x26aad9){return _0x26aad9[_0xd1df('0x24')](_0x864ff3[_0xd1df('0x25')][_0xd1df('0x26')],_[_0xd1df('0x27')](_0x864ff3[_0xd1df('0x25')],['ids','id'])||{});}})[_0xd1df('0x28')](function(_0x65ce04){logger[_0xd1df('0x11')](_0xd1df('0x29'),_0x864ff3);logger[_0xd1df('0x14')](_0xd1df('0x29'),_0x864ff3,JSON[_0xd1df('0x16')](_0x65ce04));_0x4e66a7(_0x65ce04);})[_0xd1df('0x1a')](function(_0x1f36ab){logger[_0xd1df('0x17')]('AddTags',_0x1f36ab[_0xd1df('0x18')],_0x864ff3);_0x57487d(_this[_0xd1df('0x17')](0x1f4,_0x1f36ab[_0xd1df('0x18')]));});});}; \ No newline at end of file +var _0xf9d7=['../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','where','attributes','AddTagsToOpenchannelInteraction','find','addTags','body','ids','omit','AddTags','lodash','moment','bluebird','randomstring'];(function(_0x548d7d,_0x2d41fc){var _0xb1c878=function(_0x570f09){while(--_0x570f09){_0x548d7d['push'](_0x548d7d['shift']());}};_0xb1c878(++_0x2d41fc);}(_0xf9d7,0x19e));var _0x7f9d=function(_0x3ee9b2,_0xa090bb){_0x3ee9b2=_0x3ee9b2-0x0;var _0x51ac3e=_0xf9d7[_0x3ee9b2];return _0x51ac3e;};'use strict';var _=require(_0x7f9d('0x0'));var util=require('util');var moment=require(_0x7f9d('0x1'));var BPromise=require(_0x7f9d('0x2'));var rs=require(_0x7f9d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7f9d('0x4'));var logger=require(_0x7f9d('0x5'))(_0x7f9d('0x6'));var config=require('../../config/environment');var jayson=require(_0x7f9d('0x7'));var client=jayson[_0x7f9d('0x8')]['http']({'port':0x232a});config[_0x7f9d('0x9')]=_[_0x7f9d('0xa')](config[_0x7f9d('0x9')],{'host':_0x7f9d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7f9d('0xc'))[_0x7f9d('0xd')](socket);function respondWithRpcPromise(_0x5e963f,_0x565e06,_0x3524a4){return new BPromise(function(_0x45327f,_0x27387d){return client[_0x7f9d('0xe')](_0x5e963f,_0x3524a4)[_0x7f9d('0xf')](function(_0xeb89f8){logger['info'](_0x7f9d('0x10'),_0x565e06,_0x7f9d('0x11'));logger[_0x7f9d('0x12')](_0x7f9d('0x13'),_0x565e06,_0x7f9d('0x11'),JSON[_0x7f9d('0x14')](_0xeb89f8));if(_0xeb89f8[_0x7f9d('0x15')]){if(_0xeb89f8['error']['code']===0x1f4){logger[_0x7f9d('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x565e06,_0xeb89f8['error'][_0x7f9d('0x16')]);return _0x27387d(_0xeb89f8['error']['message']);}logger[_0x7f9d('0x15')](_0x7f9d('0x10'),_0x565e06,_0xeb89f8['error'][_0x7f9d('0x16')]);return _0x45327f(_0xeb89f8['error'][_0x7f9d('0x16')]);}else{logger[_0x7f9d('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x565e06,_0x7f9d('0x11'));_0x45327f(_0xeb89f8[_0x7f9d('0x18')][_0x7f9d('0x16')]);}})['catch'](function(_0x4262d2){logger[_0x7f9d('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x565e06,_0x4262d2);_0x27387d(_0x4262d2);});});}exports[_0x7f9d('0x19')]=function(_0x40dbb4){var _0x37c032=this;return new Promise(function(_0x3460cc,_0x5dd6b9){return db[_0x7f9d('0x1a')]['update'](_0x40dbb4['body'],{'raw':_0x40dbb4[_0x7f9d('0x1b')]?_0x40dbb4['options'][_0x7f9d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40dbb4[_0x7f9d('0x1b')]?_0x40dbb4[_0x7f9d('0x1b')][_0x7f9d('0x1d')]||null:null,'attributes':_0x40dbb4['options']?_0x40dbb4[_0x7f9d('0x1b')][_0x7f9d('0x1e')]||null:null,'limit':_0x40dbb4[_0x7f9d('0x1b')]?_0x40dbb4[_0x7f9d('0x1b')]['limit']||null:null})['then'](function(_0x34ad94){logger[_0x7f9d('0x17')](_0x7f9d('0x19'),_0x40dbb4);logger['debug']('UpdateOpenchannelInteraction',_0x40dbb4,JSON[_0x7f9d('0x14')](_0x34ad94));_0x3460cc(_0x34ad94);})['catch'](function(_0xd173bd){logger[_0x7f9d('0x15')](_0x7f9d('0x19'),_0xd173bd[_0x7f9d('0x16')],_0x40dbb4);_0x5dd6b9(_0x37c032['error'](0x1f4,_0xd173bd['message']));});});};exports[_0x7f9d('0x1f')]=function(_0x25ce7b){return new Promise(function(_0x4b2e37,_0x4ced3f){return db['OpenchannelInteraction'][_0x7f9d('0x20')]({'where':_0x25ce7b[_0x7f9d('0x1b')]?_0x25ce7b[_0x7f9d('0x1b')]['where']||null:null})['then'](function(_0x32c201){if(_0x32c201){return _0x32c201[_0x7f9d('0x21')](_0x25ce7b[_0x7f9d('0x22')][_0x7f9d('0x23')],_[_0x7f9d('0x24')](_0x25ce7b[_0x7f9d('0x22')],[_0x7f9d('0x23'),'id'])||{});}})['spread'](function(_0xb79099){logger['info'](_0x7f9d('0x25'),_0x25ce7b);logger['debug']('AddTags',_0x25ce7b,JSON[_0x7f9d('0x14')](_0xb79099));_0x4b2e37(_0xb79099);})['catch'](function(_0x33c4bf){logger[_0x7f9d('0x15')](_0x7f9d('0x25'),_0x33c4bf[_0x7f9d('0x16')],_0x25ce7b);_0x4ced3f(_this[_0x7f9d('0x15')](0x1f4,_0x33c4bf[_0x7f9d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index fab0b6a..e433eaf 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 _0x0429=['length','openchannelInteraction:','./openchannelInteraction.events','save','remove','emit'];(function(_0x23390c,_0x4cf6cd){var _0x43f2a3=function(_0x5e353f){while(--_0x5e353f){_0x23390c['push'](_0x23390c['shift']());}};_0x43f2a3(++_0x4cf6cd);}(_0x0429,0x176));var _0x9042=function(_0x5dd4f1,_0xf13ffa){_0x5dd4f1=_0x5dd4f1-0x0;var _0x45cafe=_0x0429[_0x5dd4f1];return _0x45cafe;};'use strict';var OpenchannelInteractionEvents=require(_0x9042('0x0'));var events=[_0x9042('0x1'),_0x9042('0x2'),'update'];function createListener(_0x4a8a06,_0x146025){return function(_0x36ebce){_0x146025[_0x9042('0x3')](_0x4a8a06,_0x36ebce);};}function removeListener(_0x1bb528,_0xddcd67){return function(){OpenchannelInteractionEvents['removeListener'](_0x1bb528,_0xddcd67);};}exports['register']=function(_0x544c5f){for(var _0x2d59c5=0x0,_0x5b2d39=events[_0x9042('0x4')];_0x2d59c5<_0x5b2d39;_0x2d59c5++){var _0x52a66d=events[_0x2d59c5];var _0x56fc6f=createListener(_0x9042('0x5')+_0x52a66d,_0x544c5f);OpenchannelInteractionEvents['on'](_0x52a66d,_0x56fc6f);}}; \ No newline at end of file +var _0x645c=['update','length','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x57eff0,_0x3f4684){var _0x448ff1=function(_0x1973ef){while(--_0x1973ef){_0x57eff0['push'](_0x57eff0['shift']());}};_0x448ff1(++_0x3f4684);}(_0x645c,0x1ed));var _0xc645=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x645c[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelInteractionEvents=require(_0xc645('0x0'));var events=[_0xc645('0x1'),'remove',_0xc645('0x2')];function createListener(_0x48d639,_0x1df890){return function(_0x3691f9){_0x1df890['emit'](_0x48d639,_0x3691f9);};}function removeListener(_0x37eddf,_0x5e0c0d){return function(){OpenchannelInteractionEvents['removeListener'](_0x37eddf,_0x5e0c0d);};}exports['register']=function(_0x529c69){for(var _0x238d72=0x0,_0x5914a2=events[_0xc645('0x3')];_0x238d72<_0x5914a2;_0x238d72++){var _0x100160=events[_0x238d72];var _0x45223d=createListener(_0xc645('0x4')+_0x100160,_0x529c69);OpenchannelInteractionEvents['on'](_0x100160,_0x45223d);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index f88e55a..208936e 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 _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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_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 +var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70e0,0x17b));var _0x070e=function(_0x226e17,_0x276467){_0x226e17=_0x226e17-0x0;var _0x412c6e=_0x70e0[_0x226e17];return _0x412c6e;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 92e5990..c2cc939 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 _0x2032=['STRING','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x33bc5f,_0x5a524c){var _0x24fa6e=function(_0x389156){while(--_0x389156){_0x33bc5f['push'](_0x33bc5f['shift']());}};_0x24fa6e(++_0x5a524c);}(_0x2032,0xd9));var _0x2203=function(_0x183942,_0x35792e){_0x183942=_0x183942-0x0;var _0x179968=_0x2032[_0x183942];return _0x179968;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x2203('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2203('0x4')]('in','out'),'defaultValue':_0x2203('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x2203('0x6')]},'providerName':{'type':Sequelize[_0x2203('0x7')]},'providerResponse':{'type':Sequelize[_0x2203('0x1')]}}; \ No newline at end of file +var _0x09df=['DATE','STRING','sequelize','exports','medium','ENUM'];(function(_0x99405c,_0x445476){var _0x3daed0=function(_0x21d002){while(--_0x21d002){_0x99405c['push'](_0x99405c['shift']());}};_0x3daed0(++_0x445476);}(_0x09df,0x164));var _0xf09d=function(_0x2e53e1,_0x12aed1){_0x2e53e1=_0x2e53e1-0x0;var _0x3a23de=_0x09df[_0x2e53e1];return _0x3a23de;};'use strict';var Sequelize=require(_0xf09d('0x0'));module[_0xf09d('0x1')]={'body':{'type':Sequelize['TEXT'](_0xf09d('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf09d('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xf09d('0x4')]},'providerName':{'type':Sequelize[_0xf09d('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 01fdcad..fb85524 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 _0x926e=['code','message','result','catch','json','limit','count','offset','status','set','Content-Range','reject','update','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','OpenchannelMessage','includeAll','findAll','rows','params','length','create','body','find','describe','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE: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','ContactId','sequelize','QueryTypes','SELECT','User','internal','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','openchannel-interactions','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','Sequelize','contact','fullname','email','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','register','jayson/promise','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3fc2f2,_0x59d988){var _0x12ca26=function(_0x3347a6){while(--_0x3347a6){_0x3fc2f2['push'](_0x3fc2f2['shift']());}};_0x12ca26(++_0x59d988);}(_0x926e,0x1e5));var _0xe926=function(_0x80c919,_0x4bda96){_0x80c919=_0x80c919-0x0;var _0x2c1f72=_0x926e[_0x80c919];return _0x2c1f72;};'use strict';var emlformat=require(_0xe926('0x0'));var rimraf=require(_0xe926('0x1'));var zipdir=require(_0xe926('0x2'));var jsonpatch=require(_0xe926('0x3'));var rp=require(_0xe926('0x4'));var moment=require(_0xe926('0x5'));var BPromise=require(_0xe926('0x6'));var Mustache=require(_0xe926('0x7'));var util=require(_0xe926('0x8'));var path=require(_0xe926('0x9'));var sox=require(_0xe926('0xa'));var csv=require(_0xe926('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe926('0xc'));var crypto=require('crypto');var jsforce=require(_0xe926('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe926('0xb'));var querystring=require('querystring');var Papa=require(_0xe926('0xe'));var Redis=require(_0xe926('0xf'));var authService=require(_0xe926('0x10'));var qs=require(_0xe926('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe926('0x12'));var logger=require(_0xe926('0x13'))(_0xe926('0x14'));var utils=require('../../config/utils');var config=require(_0xe926('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe926('0x16'))['db'];config[_0xe926('0x17')]=_[_0xe926('0x18')](config['redis'],{'host':_0xe926('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe926('0x17')]));require(_0xe926('0x1a'))[_0xe926('0x1b')](socket);var jayson=require(_0xe926('0x1c'));var client=jayson[_0xe926('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xe926('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a1ac1,_0x23510b,_0x31bca3,_0xf403b){return new BPromise(function(_0x58d86a,_0x18ab82){var _0x598a18=_0xf403b||client;return _0x598a18[_0xe926('0x1e')](_0x1a1ac1,_0x31bca3)[_0xe926('0x1f')](function(_0x5c52be){logger[_0xe926('0x20')](_0xe926('0x21'),_0x23510b,_0xe926('0x22'));logger[_0xe926('0x23')](_0xe926('0x24'),_0x23510b,'request\x20sent',JSON[_0xe926('0x25')](_0x5c52be));if(_0x5c52be[_0xe926('0x26')]){if(_0x5c52be[_0xe926('0x26')][_0xe926('0x27')]===0x1f4){logger[_0xe926('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x23510b,_0x5c52be[_0xe926('0x26')][_0xe926('0x28')]);return _0x18ab82(_0x5c52be[_0xe926('0x26')][_0xe926('0x28')]);}logger['error'](_0xe926('0x21'),_0x23510b,_0x5c52be[_0xe926('0x26')]['message']);return _0x58d86a(_0x5c52be[_0xe926('0x26')]['message']);}else{logger[_0xe926('0x20')](_0xe926('0x21'),_0x23510b,_0xe926('0x22'));_0x58d86a(_0x5c52be[_0xe926('0x29')][_0xe926('0x28')]);}})[_0xe926('0x2a')](function(_0x537f0a){logger['error'](_0xe926('0x21'),_0x23510b,_0x537f0a);_0x18ab82(_0x537f0a);});});}function respondWithStatusCode(_0x27390f,_0x262cf1){_0x262cf1=_0x262cf1||0xcc;return function(_0x3036f8){if(_0x3036f8){return _0x27390f['sendStatus'](_0x262cf1);}return _0x27390f['status'](_0x262cf1)['end']();};}function respondWithResult(_0x54c589,_0x538831){_0x538831=_0x538831||0xc8;return function(_0x22712c){if(_0x22712c){return _0x54c589['status'](_0x538831)[_0xe926('0x2b')](_0x22712c);}};}function respondWithFilteredResult(_0x34606c,_0x523ae8){return function(_0x529a54){if(_0x529a54){var _0x77997=typeof _0x523ae8['offset']==='undefined'&&typeof _0x523ae8[_0xe926('0x2c')]==='undefined';var _0xd0eef1=_0x529a54[_0xe926('0x2d')];var _0x62b371=_0x77997?0x0:_0x523ae8[_0xe926('0x2e')];var _0x4e8a95=_0x77997?_0x529a54['count']:_0x523ae8['offset']+_0x523ae8[_0xe926('0x2c')];var _0xb3e525;if(_0x4e8a95>=_0xd0eef1){_0x4e8a95=_0xd0eef1;_0xb3e525=0xc8;}else{_0xb3e525=0xce;}_0x34606c[_0xe926('0x2f')](_0xb3e525);return _0x34606c[_0xe926('0x30')](_0xe926('0x31'),_0x62b371+'-'+_0x4e8a95+'/'+_0xd0eef1)[_0xe926('0x2b')](_0x529a54);}return null;};}function patchUpdates(_0x273262){return function(_0x5138cb){try{jsonpatch['apply'](_0x5138cb,_0x273262,!![]);}catch(_0x3017a8){return BPromise[_0xe926('0x32')](_0x3017a8);}return _0x5138cb['save']();};}function saveUpdates(_0x14c64d,_0x13bafa){return function(_0x4fc7d){if(_0x4fc7d){return _0x4fc7d[_0xe926('0x33')](_0x14c64d)['then'](function(_0x11fac8){return _0x11fac8;});}return null;};}function removeEntity(_0x180c08,_0x28e687){return function(_0x3e0f62){if(_0x3e0f62){return _0x3e0f62[_0xe926('0x34')]()[_0xe926('0x1f')](function(){_0x180c08['status'](0xcc)[_0xe926('0x35')]();});}};}function handleEntityNotFound(_0x1773ab,_0x358a87){return function(_0x59a25b){if(!_0x59a25b){_0x1773ab[_0xe926('0x36')](0x194);}return _0x59a25b;};}function handleError(_0x195e97,_0x27a885){_0x27a885=_0x27a885||0x1f4;return function(_0x6a5e65){logger[_0xe926('0x26')](_0x6a5e65[_0xe926('0x37')]);if(_0x6a5e65[_0xe926('0x38')]){delete _0x6a5e65[_0xe926('0x38')];}_0x195e97[_0xe926('0x2f')](_0x27a885)[_0xe926('0x39')](_0x6a5e65);};}exports[_0xe926('0x3a')]=function(_0x5a1a10,_0x57ff39){var _0x382b27={},_0x2f75c4={},_0x1dab45={'count':0x0,'rows':[]};var _0x59e7f3=_[_0xe926('0x3b')](db['OpenchannelMessage'][_0xe926('0x3c')],function(_0x3a461a){return{'name':_0x3a461a[_0xe926('0x3d')],'type':_0x3a461a[_0xe926('0x3e')][_0xe926('0x3f')]};});_0x2f75c4['model']=_[_0xe926('0x3b')](_0x59e7f3,_0xe926('0x38'));_0x2f75c4[_0xe926('0x40')]=_[_0xe926('0x41')](_0x5a1a10[_0xe926('0x40')]);_0x2f75c4['filters']=_[_0xe926('0x42')](_0x2f75c4[_0xe926('0x43')],_0x2f75c4[_0xe926('0x40')]);_0x382b27[_0xe926('0x44')]=_[_0xe926('0x42')](_0x2f75c4[_0xe926('0x43')],qs[_0xe926('0x45')](_0x5a1a10['query'][_0xe926('0x45')]));_0x382b27['attributes']=_0x382b27[_0xe926('0x44')]['length']?_0x382b27[_0xe926('0x44')]:_0x2f75c4[_0xe926('0x43')];if(!_0x5a1a10['query'][_0xe926('0x46')](_0xe926('0x47'))){_0x382b27[_0xe926('0x2c')]=qs[_0xe926('0x2c')](_0x5a1a10['query'][_0xe926('0x2c')]);_0x382b27[_0xe926('0x2e')]=qs[_0xe926('0x2e')](_0x5a1a10[_0xe926('0x40')]['offset']);}_0x382b27[_0xe926('0x48')]=qs[_0xe926('0x49')](_0x5a1a10[_0xe926('0x40')][_0xe926('0x49')]);_0x382b27[_0xe926('0x4a')]=qs['filters'](_[_0xe926('0x4b')](_0x5a1a10[_0xe926('0x40')],_0x2f75c4['filters']),_0x59e7f3);if(_0x5a1a10[_0xe926('0x40')]['filter']){_0x382b27[_0xe926('0x4a')]=_['merge'](_0x382b27[_0xe926('0x4a')],{'$or':_[_0xe926('0x3b')](_0x59e7f3,function(_0x36357b){if(_0x36357b[_0xe926('0x3e')]!==_0xe926('0x4c')){var _0x1030df={};_0x1030df[_0x36357b[_0xe926('0x38')]]={'$like':'%'+_0x5a1a10[_0xe926('0x40')][_0xe926('0x4d')]+'%'};return _0x1030df;}})});}_0x382b27=_[_0xe926('0x4e')]({},_0x382b27,_0x5a1a10[_0xe926('0x4f')]);var _0x2f8622={'where':_0x382b27[_0xe926('0x4a')]};return db[_0xe926('0x50')][_0xe926('0x2d')](_0x2f8622)['then'](function(_0x5ec824){_0x1dab45['count']=_0x5ec824;if(_0x5a1a10[_0xe926('0x40')][_0xe926('0x51')]){_0x382b27['include']=[{'all':!![]}];}return db[_0xe926('0x50')][_0xe926('0x52')](_0x382b27);})[_0xe926('0x1f')](function(_0x308339){_0x1dab45[_0xe926('0x53')]=_0x308339;return _0x1dab45;})[_0xe926('0x1f')](respondWithFilteredResult(_0x57ff39,_0x382b27))[_0xe926('0x2a')](handleError(_0x57ff39,null));};exports['show']=function(_0xd01773,_0x55e8a4){var _0x3ccf4f={'raw':!![],'where':{'id':_0xd01773[_0xe926('0x54')]['id']}},_0x93aa54={};_0x93aa54[_0xe926('0x43')]=_[_0xe926('0x41')](db[_0xe926('0x50')][_0xe926('0x3c')]);_0x93aa54[_0xe926('0x40')]=_['keys'](_0xd01773[_0xe926('0x40')]);_0x93aa54['filters']=_[_0xe926('0x42')](_0x93aa54[_0xe926('0x43')],_0x93aa54[_0xe926('0x40')]);_0x3ccf4f[_0xe926('0x44')]=_[_0xe926('0x42')](_0x93aa54['model'],qs[_0xe926('0x45')](_0xd01773[_0xe926('0x40')]['fields']));_0x3ccf4f[_0xe926('0x44')]=_0x3ccf4f[_0xe926('0x44')][_0xe926('0x55')]?_0x3ccf4f[_0xe926('0x44')]:_0x93aa54[_0xe926('0x43')];if(_0xd01773[_0xe926('0x40')][_0xe926('0x51')]){_0x3ccf4f['include']=[{'all':!![]}];}_0x3ccf4f=_[_0xe926('0x4e')]({},_0x3ccf4f,_0xd01773[_0xe926('0x4f')]);return db[_0xe926('0x50')]['find'](_0x3ccf4f)['then'](handleEntityNotFound(_0x55e8a4,null))[_0xe926('0x1f')](respondWithResult(_0x55e8a4,null))[_0xe926('0x2a')](handleError(_0x55e8a4,null));};exports[_0xe926('0x56')]=function(_0x24159b,_0xc4299d){return db[_0xe926('0x50')][_0xe926('0x56')](_0x24159b['body'],{})['then'](respondWithResult(_0xc4299d,0xc9))[_0xe926('0x2a')](handleError(_0xc4299d,null));};exports[_0xe926('0x33')]=function(_0x300079,_0x2db43d){if(_0x300079[_0xe926('0x57')]['id']){delete _0x300079[_0xe926('0x57')]['id'];}return db[_0xe926('0x50')][_0xe926('0x58')]({'where':{'id':_0x300079[_0xe926('0x54')]['id']}})[_0xe926('0x1f')](handleEntityNotFound(_0x2db43d,null))['then'](saveUpdates(_0x300079[_0xe926('0x57')],null))['then'](respondWithResult(_0x2db43d,null))[_0xe926('0x2a')](handleError(_0x2db43d,null));};exports[_0xe926('0x34')]=function(_0x44bfd1,_0x34760e){return db[_0xe926('0x50')][_0xe926('0x58')]({'where':{'id':_0x44bfd1['params']['id']}})[_0xe926('0x1f')](handleEntityNotFound(_0x34760e,null))[_0xe926('0x1f')](removeEntity(_0x34760e,null))['catch'](handleError(_0x34760e,null));};exports[_0xe926('0x59')]=function(_0x41c48b,_0x51e133){return db[_0xe926('0x50')][_0xe926('0x59')]()[_0xe926('0x1f')](respondWithResult(_0x51e133,null))[_0xe926('0x2a')](handleError(_0x51e133,null));};var interaction_log=require(_0xe926('0x13'))('openchannel-interactions');exports['accept']=function(_0x3a9be6,_0x2329cf,_0x11e62b){var _0x4ac896={'agent':{},'channel':_0xe926('0x5a')};if(_0x3a9be6[_0xe926('0x57')]['id']){delete _0x3a9be6[_0xe926('0x57')]['id'];}_0x3a9be6[_0xe926('0x57')][_0xe926('0x5b')]=!![];_0x3a9be6['body']['readAt']=moment()[_0xe926('0x5c')](_0xe926('0x5d'));_0x3a9be6['body'][_0xe926('0x5e')]=_0x3a9be6[_0xe926('0x57')]['UserId']||_0x3a9be6['user']['id'];_0x4ac896[_0xe926('0x5f')]['id']=_0x3a9be6['body']['UserId'];return db[_0xe926('0x50')][_0xe926('0x58')]({'where':{'id':_0x3a9be6[_0xe926('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2329cf,null))[_0xe926('0x1f')](saveUpdates(_0x3a9be6['body'],null))['then'](function(_0xc471f0){if(_0xc471f0){_0x4ac896[_0xe926('0x28')]=_0xc471f0[_0xe926('0x60')]({'plain':!![]});return db[_0xe926('0x61')][_0xe926('0x58')]({'where':{'id':_0xc471f0['OpenchannelInteractionId']}});}return null;})[_0xe926('0x1f')](handleEntityNotFound(_0x2329cf,null))[_0xe926('0x1f')](function(_0x132cae){if(_0x132cae){return _0x132cae[_0xe926('0x33')]({'UserId':_0x3a9be6[_0xe926('0x57')][_0xe926('0x5e')],'read1stAt':_[_0xe926('0x62')](_0x132cae[_0xe926('0x63')])?moment()[_0xe926('0x5c')](_0xe926('0x5d')):undefined});}return null;})[_0xe926('0x1f')](function(_0x142052){if(_0x142052){_0x4ac896[_0xe926('0x64')]=_0x142052[_0xe926('0x60')]({'plain':!![]});interaction_log['info'](_0xe926('0x65'),_0x3a9be6[_0xe926('0x66')]['id'],_0x3a9be6[_0xe926('0x66')][_0xe926('0x38')],_0x3a9be6[_0xe926('0x66')][_0xe926('0x67')],_0x4ac896[_0xe926('0x64')]['id'],_0x3a9be6[_0xe926('0x57')]?JSON[_0xe926('0x25')](_0x3a9be6[_0xe926('0x57')]):_0xe926('0x68'));return respondWithRpcPromise(_0xe926('0x69'),_0xe926('0x6a'),_0x4ac896);}return null;})['then'](function(_0x2f9442){var _0x3b9f65=_0xe926('0x6b')+_0x2f9442['message'][_0xe926('0x6c')];return db[_0xe926('0x6d')][_0xe926('0x40')](_0x3b9f65,{'type':db['Sequelize'][_0xe926('0x6e')][_0xe926('0x6f')],'raw':!![]})['then'](function(_0x524465){return _0x524465;});})['then'](function(_0x5524a4){if(_0x5524a4){_0x4ac896[_0xe926('0x28')]['contact']=_0x5524a4[0x0];if(!_0x3a9be6['body'][_0xe926('0x5e')])return;return db[_0xe926('0x70')]['find']({'where':{'id':_0x3a9be6['body'][_0xe926('0x5e')],'role':'agent'},'attributes':['id','name','fullname','email',_0xe926('0x71')],'raw':!![]});}return null;})[_0xe926('0x1f')](function(_0x3c340c){if(!_0x3c340c)return null;_0x4ac896[_0xe926('0x28')][_0xe926('0x5f')]=_0x3c340c;return _0x4ac896;})[_0xe926('0x1f')](function(_0x5c3e24){if(_0x5c3e24){if(_0x3a9be6[_0xe926('0x57')]['manual']){_0x4ac896[_0xe926('0x28')][_0xe926('0x72')]=util[_0xe926('0x5c')](_0xe926('0x73'),_0x3a9be6[_0xe926('0x66')][_0xe926('0x38')]);_0x4ac896['message'][_0xe926('0x74')]=_0x4ac896[_0xe926('0x74')];_0x4ac896['message'][_0xe926('0x75')]=_0x4ac896[_0xe926('0x74')];_0x4ac896[_0xe926('0x28')][_0xe926('0x76')]=_0xe926('0x77');return respondWithRpcPromise(_0xe926('0x78'),_0xe926('0x78'),{'event':_0xe926('0x79'),'message':_0x4ac896[_0xe926('0x28')]},client9002)[_0xe926('0x1f')](function(){return _0x4ac896;});}return _0x4ac896;}return null;})[_0xe926('0x1f')](respondWithResult(_0x2329cf,null))[_0xe926('0x2a')](handleError(_0x2329cf,null));};var interaction_log=require(_0xe926('0x13'))(_0xe926('0x7a'));exports[_0xe926('0x32')]=function(_0x3b6e61,_0x3e0ede,_0x13ca5c){var _0x5af6d6={'agent':{},'channel':'openchannel'};if(_0x3b6e61[_0xe926('0x57')]['id']){delete _0x3b6e61[_0xe926('0x57')]['id'];}_0x3b6e61[_0xe926('0x57')][_0xe926('0x5e')]=_0x3b6e61[_0xe926('0x57')][_0xe926('0x5e')]||_0x3b6e61[_0xe926('0x66')]['id'];_0x5af6d6[_0xe926('0x5f')]['id']=_0x3b6e61[_0xe926('0x57')][_0xe926('0x5e')];return db['OpenchannelMessage'][_0xe926('0x58')]({'where':{'id':_0x3b6e61[_0xe926('0x54')]['id'],'UserId':null}})[_0xe926('0x1f')](handleEntityNotFound(_0x3e0ede,null))[_0xe926('0x1f')](function(_0x470e6b){if(_0x470e6b){_0x5af6d6[_0xe926('0x28')]=_0x470e6b[_0xe926('0x60')]({'plain':!![]});return db[_0xe926('0x61')][_0xe926('0x58')]({'where':{'id':_0x470e6b[_0xe926('0x7b')]}});}return null;})['then'](handleEntityNotFound(_0x3e0ede,null))['then'](function(_0x79dce5){if(_0x79dce5){_0x5af6d6['interaction']=_0x79dce5['get']({'plain':!![]});interaction_log[_0xe926('0x20')](_0xe926('0x7c'),_0x3b6e61[_0xe926('0x66')]['id'],_0x3b6e61['user']['name'],_0x3b6e61[_0xe926('0x66')][_0xe926('0x67')],_0x5af6d6['interaction']['id'],_0x3b6e61[_0xe926('0x57')]?JSON['stringify'](_0x3b6e61[_0xe926('0x57')]):_0xe926('0x68'));return respondWithRpcPromise('RejectMessage',_0xe926('0x7d'),_0x5af6d6);}return null;})[_0xe926('0x1f')](function(_0x4af4a8){var _0x319f3d=_0xe926('0x6b')+_0x4af4a8[_0xe926('0x28')][_0xe926('0x6c')];return db[_0xe926('0x6d')][_0xe926('0x40')](_0x319f3d,{'type':db[_0xe926('0x7e')][_0xe926('0x6e')][_0xe926('0x6f')],'raw':!![]})[_0xe926('0x1f')](function(_0x477508){return _0x477508;});})[_0xe926('0x1f')](function(_0x4a1b7f){if(_0x4a1b7f){_0x5af6d6[_0xe926('0x28')][_0xe926('0x7f')]=_0x4a1b7f[0x0];if(!_0x3b6e61[_0xe926('0x57')][_0xe926('0x5e')])return;return db[_0xe926('0x70')][_0xe926('0x58')]({'where':{'id':_0x3b6e61[_0xe926('0x57')][_0xe926('0x5e')],'role':'agent'},'attributes':['id',_0xe926('0x38'),_0xe926('0x80'),_0xe926('0x81'),_0xe926('0x71')],'raw':!![]});}return null;})[_0xe926('0x1f')](function(_0x5cca89){if(!_0x5cca89)return null;_0x5af6d6[_0xe926('0x28')][_0xe926('0x5f')]=_0x5cca89;return _0x5af6d6;})['then'](function(_0x4dd9cf){if(_0x4dd9cf){_0x4dd9cf[_0xe926('0x28')][_0xe926('0x72')]=util['format'](_0xe926('0x73'),_0x3b6e61[_0xe926('0x66')][_0xe926('0x38')]);_0x4dd9cf[_0xe926('0x28')]['channel']=_0x5af6d6[_0xe926('0x74')];_0x4dd9cf['message']['motionChannel']=_0x5af6d6['channel'];_0x4dd9cf[_0xe926('0x28')][_0xe926('0x76')]=_0xe926('0x32');respondWithRpcPromise(_0xe926('0x78'),_0xe926('0x78'),{'event':_0xe926('0x82'),'message':_0x4dd9cf[_0xe926('0x28')]},client9002);return _0x5af6d6;}return null;})[_0xe926('0x1f')](respondWithResult(_0x3e0ede,null))[_0xe926('0x2a')](handleError(_0x3e0ede,null));}; \ No newline at end of file +var _0x7100=['send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','show','params','options','find','create','body','describe','../../config/logger','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','manual','interface','SIP/%s','motionChannel','channel','event','accept','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','sequelize','User','fullname','email','internal','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','register','jayson/promise','client','http','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','destroy','end','stack','name'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x7100,0x15e));var _0x0710=function(_0x217ff6,_0x36f75d){_0x217ff6=_0x217ff6-0x0;var _0x417c93=_0x7100[_0x217ff6];return _0x417c93;};'use strict';var emlformat=require(_0x0710('0x0'));var rimraf=require(_0x0710('0x1'));var zipdir=require(_0x0710('0x2'));var jsonpatch=require(_0x0710('0x3'));var rp=require(_0x0710('0x4'));var moment=require(_0x0710('0x5'));var BPromise=require(_0x0710('0x6'));var Mustache=require('mustache');var util=require(_0x0710('0x7'));var path=require(_0x0710('0x8'));var sox=require('sox');var csv=require(_0x0710('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0710('0xa'));var _=require(_0x0710('0xb'));var squel=require('squel');var crypto=require(_0x0710('0xc'));var jsforce=require(_0x0710('0xd'));var deskjs=require(_0x0710('0xe'));var toCsv=require(_0x0710('0x9'));var querystring=require(_0x0710('0xf'));var Papa=require(_0x0710('0x10'));var Redis=require(_0x0710('0x11'));var authService=require(_0x0710('0x12'));var qs=require(_0x0710('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0710('0x14'));var logger=require('../../config/logger')(_0x0710('0x15'));var utils=require(_0x0710('0x16'));var config=require(_0x0710('0x17'));var licenseUtil=require(_0x0710('0x18'));var db=require(_0x0710('0x19'))['db'];config[_0x0710('0x1a')]=_[_0x0710('0x1b')](config['redis'],{'host':_0x0710('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0710('0x1a')]));require(_0x0710('0x1d'))[_0x0710('0x1e')](socket);var jayson=require(_0x0710('0x1f'));var client=jayson[_0x0710('0x20')][_0x0710('0x21')]({'port':0x232c});var client9002=jayson[_0x0710('0x20')][_0x0710('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x11a5cd,_0x45eb3e,_0xdf422f,_0xeb5ff9){return new BPromise(function(_0x577bcf,_0x139ea2){var _0x3b60a4=_0xeb5ff9||client;return _0x3b60a4['request'](_0x11a5cd,_0xdf422f)[_0x0710('0x22')](function(_0x375f71){logger['info'](_0x0710('0x23'),_0x45eb3e,_0x0710('0x24'));logger[_0x0710('0x25')](_0x0710('0x26'),_0x45eb3e,_0x0710('0x24'),JSON[_0x0710('0x27')](_0x375f71));if(_0x375f71[_0x0710('0x28')]){if(_0x375f71[_0x0710('0x28')][_0x0710('0x29')]===0x1f4){logger[_0x0710('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x45eb3e,_0x375f71['error'][_0x0710('0x2a')]);return _0x139ea2(_0x375f71['error'][_0x0710('0x2a')]);}logger[_0x0710('0x28')](_0x0710('0x23'),_0x45eb3e,_0x375f71[_0x0710('0x28')]['message']);return _0x577bcf(_0x375f71[_0x0710('0x28')][_0x0710('0x2a')]);}else{logger[_0x0710('0x2b')](_0x0710('0x23'),_0x45eb3e,_0x0710('0x24'));_0x577bcf(_0x375f71[_0x0710('0x2c')][_0x0710('0x2a')]);}})[_0x0710('0x2d')](function(_0x458383){logger[_0x0710('0x28')](_0x0710('0x23'),_0x45eb3e,_0x458383);_0x139ea2(_0x458383);});});}function respondWithStatusCode(_0x43419d,_0x5ba872){_0x5ba872=_0x5ba872||0xcc;return function(_0x3e0a3e){if(_0x3e0a3e){return _0x43419d[_0x0710('0x2e')](_0x5ba872);}return _0x43419d['status'](_0x5ba872)['end']();};}function respondWithResult(_0x1bd527,_0x352999){_0x352999=_0x352999||0xc8;return function(_0x26e13c){if(_0x26e13c){return _0x1bd527[_0x0710('0x2f')](_0x352999)[_0x0710('0x30')](_0x26e13c);}};}function respondWithFilteredResult(_0x2e35df,_0x2329a0){return function(_0x18e673){if(_0x18e673){var _0x79b558=typeof _0x2329a0[_0x0710('0x31')]===_0x0710('0x32')&&typeof _0x2329a0[_0x0710('0x33')]===_0x0710('0x32');var _0x17b7c0=_0x18e673['count'];var _0x41f62a=_0x79b558?0x0:_0x2329a0[_0x0710('0x31')];var _0x267267=_0x79b558?_0x18e673['count']:_0x2329a0[_0x0710('0x31')]+_0x2329a0[_0x0710('0x33')];var _0x3f0e85;if(_0x267267>=_0x17b7c0){_0x267267=_0x17b7c0;_0x3f0e85=0xc8;}else{_0x3f0e85=0xce;}_0x2e35df['status'](_0x3f0e85);return _0x2e35df[_0x0710('0x34')](_0x0710('0x35'),_0x41f62a+'-'+_0x267267+'/'+_0x17b7c0)[_0x0710('0x30')](_0x18e673);}return null;};}function patchUpdates(_0x460f2f){return function(_0xd03881){try{jsonpatch[_0x0710('0x36')](_0xd03881,_0x460f2f,!![]);}catch(_0x3a9d2e){return BPromise[_0x0710('0x37')](_0x3a9d2e);}return _0xd03881['save']();};}function saveUpdates(_0x8c0c7f,_0xc85db8){return function(_0xbf35ec){if(_0xbf35ec){return _0xbf35ec[_0x0710('0x38')](_0x8c0c7f)[_0x0710('0x22')](function(_0x21f0f3){return _0x21f0f3;});}return null;};}function removeEntity(_0x24a54,_0x2fbff2){return function(_0x33b232){if(_0x33b232){return _0x33b232[_0x0710('0x39')]()['then'](function(){_0x24a54[_0x0710('0x2f')](0xcc)[_0x0710('0x3a')]();});}};}function handleEntityNotFound(_0x34a74f,_0x399307){return function(_0x183405){if(!_0x183405){_0x34a74f[_0x0710('0x2e')](0x194);}return _0x183405;};}function handleError(_0x17d549,_0x4b22bc){_0x4b22bc=_0x4b22bc||0x1f4;return function(_0x4fba9b){logger[_0x0710('0x28')](_0x4fba9b[_0x0710('0x3b')]);if(_0x4fba9b['name']){delete _0x4fba9b[_0x0710('0x3c')];}_0x17d549['status'](_0x4b22bc)[_0x0710('0x3d')](_0x4fba9b);};}exports[_0x0710('0x3e')]=function(_0x38f246,_0x1711b3){var _0x53cda2={},_0x197bd7={},_0x4cb122={'count':0x0,'rows':[]};var _0x3dbc15=_[_0x0710('0x3f')](db[_0x0710('0x40')][_0x0710('0x41')],function(_0x4a077c){return{'name':_0x4a077c[_0x0710('0x42')],'type':_0x4a077c[_0x0710('0x43')][_0x0710('0x44')]};});_0x197bd7[_0x0710('0x45')]=_['map'](_0x3dbc15,_0x0710('0x3c'));_0x197bd7[_0x0710('0x46')]=_[_0x0710('0x47')](_0x38f246['query']);_0x197bd7[_0x0710('0x48')]=_[_0x0710('0x49')](_0x197bd7[_0x0710('0x45')],_0x197bd7[_0x0710('0x46')]);_0x53cda2[_0x0710('0x4a')]=_[_0x0710('0x49')](_0x197bd7[_0x0710('0x45')],qs[_0x0710('0x4b')](_0x38f246[_0x0710('0x46')][_0x0710('0x4b')]));_0x53cda2[_0x0710('0x4a')]=_0x53cda2[_0x0710('0x4a')][_0x0710('0x4c')]?_0x53cda2[_0x0710('0x4a')]:_0x197bd7['model'];if(!_0x38f246[_0x0710('0x46')]['hasOwnProperty']('nolimit')){_0x53cda2[_0x0710('0x33')]=qs[_0x0710('0x33')](_0x38f246['query']['limit']);_0x53cda2['offset']=qs[_0x0710('0x31')](_0x38f246['query'][_0x0710('0x31')]);}_0x53cda2[_0x0710('0x4d')]=qs[_0x0710('0x4e')](_0x38f246[_0x0710('0x46')][_0x0710('0x4e')]);_0x53cda2[_0x0710('0x4f')]=qs[_0x0710('0x48')](_[_0x0710('0x50')](_0x38f246[_0x0710('0x46')],_0x197bd7[_0x0710('0x48')]),_0x3dbc15);if(_0x38f246[_0x0710('0x46')][_0x0710('0x51')]){_0x53cda2[_0x0710('0x4f')]=_[_0x0710('0x52')](_0x53cda2[_0x0710('0x4f')],{'$or':_['map'](_0x3dbc15,function(_0x59c896){if(_0x59c896[_0x0710('0x43')]!==_0x0710('0x53')){var _0x4a763b={};_0x4a763b[_0x59c896[_0x0710('0x3c')]]={'$like':'%'+_0x38f246[_0x0710('0x46')]['filter']+'%'};return _0x4a763b;}})});}_0x53cda2=_[_0x0710('0x52')]({},_0x53cda2,_0x38f246['options']);var _0x393203={'where':_0x53cda2['where']};return db[_0x0710('0x40')]['count'](_0x393203)[_0x0710('0x22')](function(_0x391ee7){_0x4cb122[_0x0710('0x54')]=_0x391ee7;if(_0x38f246[_0x0710('0x46')][_0x0710('0x55')]){_0x53cda2[_0x0710('0x56')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x0710('0x57')](_0x53cda2);})['then'](function(_0x58c9a0){_0x4cb122[_0x0710('0x58')]=_0x58c9a0;return _0x4cb122;})[_0x0710('0x22')](respondWithFilteredResult(_0x1711b3,_0x53cda2))['catch'](handleError(_0x1711b3,null));};exports[_0x0710('0x59')]=function(_0xa675fa,_0x1a38a3){var _0x447cae={'raw':!![],'where':{'id':_0xa675fa[_0x0710('0x5a')]['id']}},_0x55c6a5={};_0x55c6a5[_0x0710('0x45')]=_[_0x0710('0x47')](db[_0x0710('0x40')][_0x0710('0x41')]);_0x55c6a5['query']=_['keys'](_0xa675fa['query']);_0x55c6a5[_0x0710('0x48')]=_[_0x0710('0x49')](_0x55c6a5[_0x0710('0x45')],_0x55c6a5[_0x0710('0x46')]);_0x447cae['attributes']=_[_0x0710('0x49')](_0x55c6a5['model'],qs['fields'](_0xa675fa[_0x0710('0x46')][_0x0710('0x4b')]));_0x447cae['attributes']=_0x447cae[_0x0710('0x4a')]['length']?_0x447cae[_0x0710('0x4a')]:_0x55c6a5[_0x0710('0x45')];if(_0xa675fa[_0x0710('0x46')][_0x0710('0x55')]){_0x447cae['include']=[{'all':!![]}];}_0x447cae=_[_0x0710('0x52')]({},_0x447cae,_0xa675fa[_0x0710('0x5b')]);return db[_0x0710('0x40')][_0x0710('0x5c')](_0x447cae)['then'](handleEntityNotFound(_0x1a38a3,null))[_0x0710('0x22')](respondWithResult(_0x1a38a3,null))['catch'](handleError(_0x1a38a3,null));};exports[_0x0710('0x5d')]=function(_0x171a0d,_0xf68205){return db[_0x0710('0x40')][_0x0710('0x5d')](_0x171a0d['body'],{})[_0x0710('0x22')](respondWithResult(_0xf68205,0xc9))['catch'](handleError(_0xf68205,null));};exports[_0x0710('0x38')]=function(_0x5a6cf9,_0x24e5f6){if(_0x5a6cf9[_0x0710('0x5e')]['id']){delete _0x5a6cf9[_0x0710('0x5e')]['id'];}return db[_0x0710('0x40')][_0x0710('0x5c')]({'where':{'id':_0x5a6cf9[_0x0710('0x5a')]['id']}})[_0x0710('0x22')](handleEntityNotFound(_0x24e5f6,null))[_0x0710('0x22')](saveUpdates(_0x5a6cf9[_0x0710('0x5e')],null))[_0x0710('0x22')](respondWithResult(_0x24e5f6,null))['catch'](handleError(_0x24e5f6,null));};exports[_0x0710('0x39')]=function(_0x3f044b,_0x14952c){return db[_0x0710('0x40')]['find']({'where':{'id':_0x3f044b['params']['id']}})[_0x0710('0x22')](handleEntityNotFound(_0x14952c,null))[_0x0710('0x22')](removeEntity(_0x14952c,null))[_0x0710('0x2d')](handleError(_0x14952c,null));};exports[_0x0710('0x5f')]=function(_0xefb560,_0x1886c0){return db[_0x0710('0x40')][_0x0710('0x5f')]()[_0x0710('0x22')](respondWithResult(_0x1886c0,null))['catch'](handleError(_0x1886c0,null));};var interaction_log=require(_0x0710('0x60'))('openchannel-interactions');exports['accept']=function(_0x273a76,_0x1694f9,_0x216dee){var _0x32a560={'agent':{},'channel':_0x0710('0x61')};if(_0x273a76[_0x0710('0x5e')]['id']){delete _0x273a76['body']['id'];}_0x273a76['body'][_0x0710('0x62')]=!![];_0x273a76[_0x0710('0x5e')]['readAt']=moment()[_0x0710('0x63')](_0x0710('0x64'));_0x273a76[_0x0710('0x5e')]['UserId']=_0x273a76[_0x0710('0x5e')][_0x0710('0x65')]||_0x273a76[_0x0710('0x66')]['id'];_0x32a560[_0x0710('0x67')]['id']=_0x273a76[_0x0710('0x5e')]['UserId'];return db[_0x0710('0x40')]['find']({'where':{'id':_0x273a76['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1694f9,null))[_0x0710('0x22')](saveUpdates(_0x273a76[_0x0710('0x5e')],null))[_0x0710('0x22')](function(_0x55bb0c){if(_0x55bb0c){_0x32a560['message']=_0x55bb0c[_0x0710('0x68')]({'plain':!![]});return db[_0x0710('0x69')][_0x0710('0x5c')]({'where':{'id':_0x55bb0c[_0x0710('0x6a')]}});}return null;})[_0x0710('0x22')](handleEntityNotFound(_0x1694f9,null))['then'](function(_0x561494){if(_0x561494){return _0x561494[_0x0710('0x38')]({'UserId':_0x273a76[_0x0710('0x5e')][_0x0710('0x65')],'read1stAt':_['isNil'](_0x561494[_0x0710('0x6b')])?moment()['format'](_0x0710('0x64')):undefined});}return null;})[_0x0710('0x22')](function(_0x55fce8){if(_0x55fce8){_0x32a560['interaction']=_0x55fce8[_0x0710('0x68')]({'plain':!![]});interaction_log[_0x0710('0x2b')](_0x0710('0x6c'),_0x273a76[_0x0710('0x66')]['id'],_0x273a76[_0x0710('0x66')]['name'],_0x273a76[_0x0710('0x66')]['role'],_0x32a560[_0x0710('0x6d')]['id'],_0x273a76[_0x0710('0x5e')]?JSON[_0x0710('0x27')](_0x273a76[_0x0710('0x5e')]):_0x0710('0x6e'));return respondWithRpcPromise('AcceptMessage',_0x0710('0x6f'),_0x32a560);}return null;})[_0x0710('0x22')](function(_0x334a28){var _0x251529=_0x0710('0x70')+_0x334a28[_0x0710('0x2a')][_0x0710('0x71')];return db['sequelize']['query'](_0x251529,{'type':db[_0x0710('0x72')][_0x0710('0x73')][_0x0710('0x74')],'raw':!![]})[_0x0710('0x22')](function(_0x4aab84){return _0x4aab84;});})[_0x0710('0x22')](function(_0x22111c){if(_0x22111c){_0x32a560[_0x0710('0x2a')][_0x0710('0x75')]=_0x22111c[0x0];if(!_0x273a76[_0x0710('0x5e')][_0x0710('0x65')])return;return db['User'][_0x0710('0x5c')]({'where':{'id':_0x273a76['body']['UserId'],'role':'agent'},'attributes':['id',_0x0710('0x3c'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x0710('0x22')](function(_0x2f773d){if(!_0x2f773d)return null;_0x32a560[_0x0710('0x2a')][_0x0710('0x67')]=_0x2f773d;return _0x32a560;})[_0x0710('0x22')](function(_0x4cf101){if(_0x4cf101){if(_0x273a76[_0x0710('0x5e')][_0x0710('0x76')]){_0x32a560[_0x0710('0x2a')][_0x0710('0x77')]=util[_0x0710('0x63')](_0x0710('0x78'),_0x273a76[_0x0710('0x66')][_0x0710('0x3c')]);_0x32a560['message']['channel']=_0x32a560['channel'];_0x32a560[_0x0710('0x2a')][_0x0710('0x79')]=_0x32a560[_0x0710('0x7a')];_0x32a560[_0x0710('0x2a')][_0x0710('0x7b')]=_0x0710('0x7c');return respondWithRpcPromise(_0x0710('0x7d'),_0x0710('0x7d'),{'event':_0x0710('0x7e'),'message':_0x32a560[_0x0710('0x2a')]},client9002)[_0x0710('0x22')](function(){return _0x32a560;});}return _0x32a560;}return null;})[_0x0710('0x22')](respondWithResult(_0x1694f9,null))['catch'](handleError(_0x1694f9,null));};var interaction_log=require(_0x0710('0x60'))('openchannel-interactions');exports[_0x0710('0x37')]=function(_0x41f066,_0x151524,_0x84f41a){var _0x40058e={'agent':{},'channel':'openchannel'};if(_0x41f066[_0x0710('0x5e')]['id']){delete _0x41f066['body']['id'];}_0x41f066['body'][_0x0710('0x65')]=_0x41f066[_0x0710('0x5e')][_0x0710('0x65')]||_0x41f066['user']['id'];_0x40058e['agent']['id']=_0x41f066[_0x0710('0x5e')]['UserId'];return db[_0x0710('0x40')][_0x0710('0x5c')]({'where':{'id':_0x41f066[_0x0710('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x151524,null))[_0x0710('0x22')](function(_0x109b4c){if(_0x109b4c){_0x40058e[_0x0710('0x2a')]=_0x109b4c[_0x0710('0x68')]({'plain':!![]});return db[_0x0710('0x69')][_0x0710('0x5c')]({'where':{'id':_0x109b4c[_0x0710('0x6a')]}});}return null;})[_0x0710('0x22')](handleEntityNotFound(_0x151524,null))[_0x0710('0x22')](function(_0xdf0739){if(_0xdf0739){_0x40058e['interaction']=_0xdf0739[_0x0710('0x68')]({'plain':!![]});interaction_log[_0x0710('0x2b')](_0x0710('0x7f'),_0x41f066['user']['id'],_0x41f066[_0x0710('0x66')][_0x0710('0x3c')],_0x41f066[_0x0710('0x66')][_0x0710('0x80')],_0x40058e[_0x0710('0x6d')]['id'],_0x41f066[_0x0710('0x5e')]?JSON[_0x0710('0x27')](_0x41f066[_0x0710('0x5e')]):'null');return respondWithRpcPromise(_0x0710('0x81'),_0x0710('0x82'),_0x40058e);}return null;})[_0x0710('0x22')](function(_0x9dbfa3){var _0x3111f7=_0x0710('0x70')+_0x9dbfa3[_0x0710('0x2a')]['ContactId'];return db[_0x0710('0x83')][_0x0710('0x46')](_0x3111f7,{'type':db[_0x0710('0x72')][_0x0710('0x73')][_0x0710('0x74')],'raw':!![]})[_0x0710('0x22')](function(_0x9c2a27){return _0x9c2a27;});})[_0x0710('0x22')](function(_0x318861){if(_0x318861){_0x40058e[_0x0710('0x2a')][_0x0710('0x75')]=_0x318861[0x0];if(!_0x41f066['body'][_0x0710('0x65')])return;return db[_0x0710('0x84')][_0x0710('0x5c')]({'where':{'id':_0x41f066['body'][_0x0710('0x65')],'role':'agent'},'attributes':['id','name',_0x0710('0x85'),_0x0710('0x86'),_0x0710('0x87')],'raw':!![]});}return null;})[_0x0710('0x22')](function(_0x1ea624){if(!_0x1ea624)return null;_0x40058e[_0x0710('0x2a')]['agent']=_0x1ea624;return _0x40058e;})['then'](function(_0x61936){if(_0x61936){_0x61936[_0x0710('0x2a')]['interface']=util[_0x0710('0x63')](_0x0710('0x78'),_0x41f066[_0x0710('0x66')][_0x0710('0x3c')]);_0x61936[_0x0710('0x2a')][_0x0710('0x7a')]=_0x40058e[_0x0710('0x7a')];_0x61936[_0x0710('0x2a')][_0x0710('0x79')]=_0x40058e[_0x0710('0x7a')];_0x61936['message'][_0x0710('0x7b')]=_0x0710('0x37');respondWithRpcPromise('EventManager','EventManager',{'event':_0x0710('0x88'),'message':_0x61936[_0x0710('0x2a')]},client9002);return _0x40058e;}return null;})[_0x0710('0x22')](respondWithResult(_0x151524,null))[_0x0710('0x2d')](handleError(_0x151524,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index d81d0f4..db8af0d 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 _0x9403=['OpenchannelMessage','setMaxListeners','save','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x8bcfdc,_0xc7415){var _0x388c47=function(_0x1aac51){while(--_0x1aac51){_0x8bcfdc['push'](_0x8bcfdc['shift']());}};_0x388c47(++_0xc7415);}(_0x9403,0xa6));var _0x3940=function(_0x16987d,_0x566f27){_0x16987d=_0x16987d-0x0;var _0x48b8a4=_0x9403[_0x16987d];return _0x48b8a4;};'use strict';var EventEmitter=require(_0x3940('0x0'));var OpenchannelMessage=require(_0x3940('0x1'))['db'][_0x3940('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x3940('0x3')](0x0);var events={'afterCreate':_0x3940('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x26de44){return function(_0xe31b7f,_0x4edde8,_0x59423e){OpenchannelMessageEvents['emit'](_0x26de44+':'+_0xe31b7f['id'],_0xe31b7f);OpenchannelMessageEvents['emit'](_0x26de44,_0xe31b7f);_0x59423e(null);};}for(var e in events){if(events[_0x3940('0x5')](e)){var event=events[e];OpenchannelMessage[_0x3940('0x6')](e,emitEvent(event));}}module[_0x3940('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x0428=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage'];(function(_0x320a3d,_0x1476d1){var _0xfbd8a8=function(_0x4e5215){while(--_0x4e5215){_0x320a3d['push'](_0x320a3d['shift']());}};_0xfbd8a8(++_0x1476d1);}(_0x0428,0x1ee));var _0x8042=function(_0x4bf21d,_0x10087d){_0x4bf21d=_0x4bf21d-0x0;var _0x4c91b3=_0x0428[_0x4bf21d];return _0x4c91b3;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x8042('0x0'))['db'][_0x8042('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8042('0x2'),'afterUpdate':_0x8042('0x3'),'afterDestroy':'remove'};function emitEvent(_0x59d430){return function(_0xe070fe,_0x598399,_0x3c3299){OpenchannelMessageEvents[_0x8042('0x4')](_0x59d430+':'+_0xe070fe['id'],_0xe070fe);OpenchannelMessageEvents['emit'](_0x59d430,_0xe070fe);_0x3c3299(null);};}for(var e in events){if(events[_0x8042('0x5')](e)){var event=events[e];OpenchannelMessage[_0x8042('0x6')](e,emitEvent(event));}}module[_0x8042('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 1a59610..cfcfd56 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 _0x36ee=['request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','catch','error','CmContact','then','find','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','POST','method','GET','body','format','threadId','update','Interaction','inspect','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird'];(function(_0x2a7dc3,_0xdc9508){var _0x4bad68=function(_0x47ad4c){while(--_0x47ad4c){_0x2a7dc3['push'](_0x2a7dc3['shift']());}};_0x4bad68(++_0xdc9508);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe36e('0x0'))('api');var moment=require(_0xe36e('0x1'));var BPromise=require(_0xe36e('0x2'));var rp=require(_0xe36e('0x3'));var fs=require('fs');var path=require(_0xe36e('0x4'));var rimraf=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var attributes=require(_0xe36e('0x7'));module[_0xe36e('0x8')]=function(_0x25a07d,_0x190404){return _0x25a07d[_0xe36e('0x9')](_0xe36e('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xe36e('0xb'),'fields':['body'],'type':_0xe36e('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x123c16,_0x46f239,_0x47ce3a){var _0xf119e4=_0x25a07d['models'];var _0x2e968d=_0x123c16[_0xe36e('0xd')]({'plain':!![]});if(_0x2e968d[_0xe36e('0xe')][_0xe36e('0xf')]()==='in'||_0x2e968d[_0xe36e('0xe')][_0xe36e('0xf')]()===_0xe36e('0x10')&&!_0x2e968d[_0xe36e('0x11')]&&!_['isNil'](_0x2e968d[_0xe36e('0x12')])){_0xf119e4[_0xe36e('0x13')][_0xe36e('0x14')]({'where':{'id':_0x2e968d[_0xe36e('0x15')]}})['then'](function(_0x3e264a){if(_0x3e264a){_0x3e264a['update']({'lastMsgAt':_0x2e968d['createdAt'],'lastMsgDirection':_0x2e968d[_0xe36e('0xe')][_0xe36e('0xf')]()});}})[_0xe36e('0x16')](function(_0x278135){console[_0xe36e('0x17')](_0x278135);});}if(_0x2e968d[_0xe36e('0xe')]===_0xe36e('0x10')&&!_0x2e968d[_0xe36e('0x11')]){var _0x387c37;_0xf119e4[_0xe36e('0x18')]['describe']()[_0xe36e('0x19')](function(_0x2184ae){return _0xf119e4['OpenchannelAccount'][_0xe36e('0x1a')]({'where':{'id':_0x2e968d['OpenchannelAccountId']},'include':[{'model':_0xf119e4[_0xe36e('0x13')],'as':_0xe36e('0x1b'),'where':{'id':_0x2e968d['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0xf119e4[_0xe36e('0x18')],'as':_0xe36e('0x1c'),'attributes':_[_0xe36e('0x1d')](_0x2184ae)}]}]});})['then'](function(_0x21e95e){_0x387c37=_0x21e95e[_0xe36e('0xd')]({'plain':!![]});if(_0x387c37&&_0x387c37[_0xe36e('0x1e')]){logger[_0xe36e('0x1f')](_0xe36e('0x20'),_0xe36e('0x21'),util['format'](_0xe36e('0x22'),_0x2e968d['id'],_0x387c37[_0xe36e('0x1e')]));if(_0x387c37[_0xe36e('0x1b')]&&_0x387c37[_0xe36e('0x1b')][_0xe36e('0x23')]){_0x2e968d['Interaction']=_['omit'](_0x387c37[_0xe36e('0x1b')][0x0],_0xe36e('0x1c'));_0x2e968d[_0xe36e('0x1c')]=_0x387c37[_0xe36e('0x1b')][0x0][_0xe36e('0x1c')];}var _0x46f239={'method':_0xe36e('0x24'),'uri':encodeURI(_0x387c37['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x46f239[_0xe36e('0x25')]){case _0xe36e('0x26'):_0x46f239['qs']=_0x2e968d;break;case _0xe36e('0x24'):_0x46f239[_0xe36e('0x27')]=_0x2e968d;break;}return rp(_0x46f239)['then'](function(_0x2d757c){logger['info'](_0xe36e('0x20'),'afterCreate',util[_0xe36e('0x28')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x2e968d['id'],_0x387c37[_0xe36e('0x1e')]));if(_0x2d757c['body'][_0xe36e('0x29')]&&_0x2d757c['body']['threadId']!=_0x2e968d['Interaction']['threadId']){return _0xf119e4[_0xe36e('0x13')][_0xe36e('0x2a')]({'threadId':_0x2d757c['body']['threadId']},{'logging':!![],'where':{'id':_0x2e968d[_0xe36e('0x2b')]['id']}});}else{return;}})[_0xe36e('0x19')](function(){return _0x123c16[_0xe36e('0x2a')]({'read':!![]});})[_0xe36e('0x16')](function(_0x3d826e){logger[_0xe36e('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xe36e('0x21'),util[_0xe36e('0x2c')](_0x3d826e,{'showHidden':![],'depth':null}));_0x47ce3a();});}else{_0x47ce3a();}})['finally'](function(){_0x47ce3a();});}else{_0x47ce3a();}}},'charset':_0xe36e('0x2d'),'collate':_0xe36e('0x2e')});}; \ No newline at end of file +var _0xea28=['moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','update','createdAt','catch','error','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','Interactions','get','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','Contact','POST','GET','afterCreate','threadId','finally','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x2d63f9,_0x36d662){var _0x23633d=function(_0x3aa920){while(--_0x3aa920){_0x2d63f9['push'](_0x2d63f9['shift']());}};_0x23633d(++_0x36d662);}(_0xea28,0x13a));var _0x8ea2=function(_0x54d318,_0x47751b){_0x54d318=_0x54d318-0x0;var _0x144d9e=_0xea28[_0x54d318];return _0x144d9e;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var logger=require(_0x8ea2('0x2'))(_0x8ea2('0x3'));var moment=require(_0x8ea2('0x4'));var BPromise=require(_0x8ea2('0x5'));var rp=require(_0x8ea2('0x6'));var fs=require('fs');var path=require(_0x8ea2('0x7'));var rimraf=require('rimraf');var config=require(_0x8ea2('0x8'));var attributes=require(_0x8ea2('0x9'));module[_0x8ea2('0xa')]=function(_0x513a0d,_0x29b82b){return _0x513a0d[_0x8ea2('0xb')](_0x8ea2('0xc'),attributes,{'tableName':_0x8ea2('0xd'),'paranoid':![],'indexes':[{'name':_0x8ea2('0xe'),'fields':[_0x8ea2('0xf')],'type':_0x8ea2('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x320750,_0x3de4a1,_0x3000f9){var _0x3d0b35=_0x513a0d[_0x8ea2('0x11')];var _0x500b82=_0x320750['get']({'plain':!![]});if(_0x500b82[_0x8ea2('0x12')][_0x8ea2('0x13')]()==='in'||_0x500b82[_0x8ea2('0x12')]['toLowerCase']()===_0x8ea2('0x14')&&!_0x500b82[_0x8ea2('0x15')]&&!_[_0x8ea2('0x16')](_0x500b82[_0x8ea2('0x17')])){_0x3d0b35[_0x8ea2('0x18')]['findOne']({'where':{'id':_0x500b82[_0x8ea2('0x19')]}})['then'](function(_0x4b2192){if(_0x4b2192){_0x4b2192[_0x8ea2('0x1a')]({'lastMsgAt':_0x500b82[_0x8ea2('0x1b')],'lastMsgDirection':_0x500b82[_0x8ea2('0x12')][_0x8ea2('0x13')]()});}})[_0x8ea2('0x1c')](function(_0xbb9bd1){console[_0x8ea2('0x1d')](_0xbb9bd1);});}if(_0x500b82[_0x8ea2('0x12')]===_0x8ea2('0x14')&&!_0x500b82[_0x8ea2('0x15')]){var _0x2dfa7c;_0x3d0b35[_0x8ea2('0x1e')][_0x8ea2('0x1f')]()[_0x8ea2('0x20')](function(_0x1b64cf){return _0x3d0b35[_0x8ea2('0x21')][_0x8ea2('0x22')]({'where':{'id':_0x500b82[_0x8ea2('0x23')]},'include':[{'model':_0x3d0b35[_0x8ea2('0x18')],'as':_0x8ea2('0x24'),'where':{'id':_0x500b82[_0x8ea2('0x19')]},'limit':0x1,'include':[{'model':_0x3d0b35[_0x8ea2('0x1e')],'as':'Contact','attributes':_['keys'](_0x1b64cf)}]}]});})[_0x8ea2('0x20')](function(_0x248c18){_0x2dfa7c=_0x248c18[_0x8ea2('0x25')]({'plain':!![]});if(_0x2dfa7c&&_0x2dfa7c['replyUri']){logger[_0x8ea2('0x26')](_0x8ea2('0x27'),'afterCreate',util[_0x8ea2('0x28')](_0x8ea2('0x29'),_0x500b82['id'],_0x2dfa7c[_0x8ea2('0x2a')]));if(_0x2dfa7c[_0x8ea2('0x24')]&&_0x2dfa7c[_0x8ea2('0x24')][_0x8ea2('0x2b')]){_0x500b82[_0x8ea2('0x2c')]=_[_0x8ea2('0x2d')](_0x2dfa7c[_0x8ea2('0x24')][0x0],'Contact');_0x500b82[_0x8ea2('0x2e')]=_0x2dfa7c['Interactions'][0x0][_0x8ea2('0x2e')];}var _0x3de4a1={'method':_0x8ea2('0x2f'),'uri':encodeURI(_0x2dfa7c['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3de4a1['method']){case _0x8ea2('0x30'):_0x3de4a1['qs']=_0x500b82;break;case'POST':_0x3de4a1[_0x8ea2('0xf')]=_0x500b82;break;}return rp(_0x3de4a1)['then'](function(_0x3be291){logger[_0x8ea2('0x26')](_0x8ea2('0x27'),_0x8ea2('0x31'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x500b82['id'],_0x2dfa7c[_0x8ea2('0x2a')]));if(_0x3be291['body'][_0x8ea2('0x32')]&&_0x3be291[_0x8ea2('0xf')][_0x8ea2('0x32')]!=_0x500b82[_0x8ea2('0x2c')][_0x8ea2('0x32')]){return _0x3d0b35[_0x8ea2('0x18')][_0x8ea2('0x1a')]({'threadId':_0x3be291[_0x8ea2('0xf')][_0x8ea2('0x32')]},{'logging':!![],'where':{'id':_0x500b82[_0x8ea2('0x2c')]['id']}});}else{return;}})['then'](function(){return _0x320750['update']({'read':!![]});})[_0x8ea2('0x1c')](function(_0x188553){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x8ea2('0x31'),util['inspect'](_0x188553,{'showHidden':![],'depth':null}));_0x3000f9();});}else{_0x3000f9();}})[_0x8ea2('0x33')](function(){_0x3000f9();});}else{_0x3000f9();}}},'charset':_0x8ea2('0x34'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 0e06729..21dc4d2 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 _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4ad811,_0xa2eac4){var _0x4dad9c=function(_0x58a7e){while(--_0x58a7e){_0x4ad811['push'](_0x4ad811['shift']());}};_0x4dad9c(++_0xa2eac4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x33962f,_0x544082){_0x33962f=_0x33962f-0x0;var _0x322d23=_0x5f2f[_0x33962f];return _0x322d23;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x4a4057,_0x160e32){var _0x4fba54=function(_0x527bb2){while(--_0x527bb2){_0x4a4057['push'](_0x4a4057['shift']());}};_0x4fba54(++_0x160e32);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'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});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 13b7efa..4bcc212 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 _0x5fc3=['./openchannelMessage.events','save','update','emit','removeListener','register','openchannelMessage:'];(function(_0x381412,_0x5518a0){var _0x46b37b=function(_0x195710){while(--_0x195710){_0x381412['push'](_0x381412['shift']());}};_0x46b37b(++_0x5518a0);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1c8cc6,_0x411e5c){_0x1c8cc6=_0x1c8cc6-0x0;var _0x522936=_0x5fc3[_0x1c8cc6];return _0x522936;};'use strict';var OpenchannelMessageEvents=require(_0x35fc('0x0'));var events=[_0x35fc('0x1'),'remove',_0x35fc('0x2')];function createListener(_0x2ac6da,_0x196bc2){return function(_0x91d024){_0x196bc2[_0x35fc('0x3')](_0x2ac6da,_0x91d024);};}function removeListener(_0x5e75e6,_0x2d1404){return function(){OpenchannelMessageEvents[_0x35fc('0x4')](_0x5e75e6,_0x2d1404);};}exports[_0x35fc('0x5')]=function(_0x5b85ad){for(var _0x5754be=0x0,_0x19a0d1=events['length'];_0x5754be<_0x19a0d1;_0x5754be++){var _0x16e153=events[_0x5754be];var _0x27524f=createListener(_0x35fc('0x6')+_0x16e153,_0x5b85ad);OpenchannelMessageEvents['on'](_0x16e153,_0x27524f);}}; \ No newline at end of file +var _0x71d1=['remove','update','length','./openchannelMessage.events'];(function(_0x134b6e,_0x21b5ca){var _0x2229a9=function(_0x3fd3f5){while(--_0x3fd3f5){_0x134b6e['push'](_0x134b6e['shift']());}};_0x2229a9(++_0x21b5ca);}(_0x71d1,0x107));var _0x171d=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0x71d1[_0xbb9dbf];return _0x30223c;};'use strict';var OpenchannelMessageEvents=require(_0x171d('0x0'));var events=['save',_0x171d('0x1'),_0x171d('0x2')];function createListener(_0x41023e,_0x2652fb){return function(_0x3a353d){_0x2652fb['emit'](_0x41023e,_0x3a353d);};}function removeListener(_0x3a89c8,_0x1a01e4){return function(){OpenchannelMessageEvents['removeListener'](_0x3a89c8,_0x1a01e4);};}exports['register']=function(_0x261786){for(var _0x1b8dd7=0x0,_0x31ea5a=events[_0x171d('0x3')];_0x1b8dd7<_0x31ea5a;_0x1b8dd7++){var _0x5648c9=events[_0x1b8dd7];var _0x2dece6=createListener('openchannelMessage:'+_0x5648c9,_0x261786);OpenchannelMessageEvents['on'](_0x5648c9,_0x2dece6);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index a8f8f1f..6de525f 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 _0xb186=['create','addTeams','addAgents','put','/:id','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xb186,0x12a));var _0x6b18=function(_0x434f2e,_0x68493e){_0x434f2e=_0x434f2e-0x0;var _0x76c0b9=_0xb186[_0x434f2e];return _0x76c0b9;};'use strict';var multer=require(_0x6b18('0x0'));var util=require(_0x6b18('0x1'));var path=require(_0x6b18('0x2'));var timeout=require(_0x6b18('0x3'));var express=require('express');var router=express[_0x6b18('0x4')]();var fs_extra=require(_0x6b18('0x5'));var auth=require(_0x6b18('0x6'));var interaction=require(_0x6b18('0x7'));var config=require(_0x6b18('0x8'));var controller=require('./openchannelQueue.controller');router[_0x6b18('0x9')]('/',auth[_0x6b18('0xa')](),controller[_0x6b18('0xb')]);router[_0x6b18('0x9')](_0x6b18('0xc'),auth['isAuthenticated'](),controller[_0x6b18('0xd')]);router[_0x6b18('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6b18('0xe')]);router[_0x6b18('0x9')](_0x6b18('0xf'),auth[_0x6b18('0xa')](),controller[_0x6b18('0x10')]);router[_0x6b18('0x9')](_0x6b18('0x11'),auth['isAuthenticated'](),controller[_0x6b18('0x12')]);router[_0x6b18('0x9')](_0x6b18('0x13'),auth[_0x6b18('0xa')](),controller[_0x6b18('0x14')]);router[_0x6b18('0x15')]('/',auth[_0x6b18('0xa')](),controller[_0x6b18('0x16')]);router['post'](_0x6b18('0x11'),auth[_0x6b18('0xa')](),controller[_0x6b18('0x17')]);router[_0x6b18('0x15')]('/:id/users',auth[_0x6b18('0xa')](),controller[_0x6b18('0x18')]);router[_0x6b18('0x19')](_0x6b18('0x1a'),auth['isAuthenticated'](),controller['update']);router[_0x6b18('0x1b')](_0x6b18('0x1a'),auth[_0x6b18('0xa')](),controller[_0x6b18('0x1c')]);router[_0x6b18('0x1b')](_0x6b18('0x11'),auth[_0x6b18('0xa')](),controller[_0x6b18('0x1d')]);router[_0x6b18('0x1b')](_0x6b18('0x13'),auth[_0x6b18('0xa')](),controller[_0x6b18('0x1e')]);module[_0x6b18('0x1f')]=router; \ No newline at end of file +var _0xfb68=['getMembers','getTeams','post','addTeams','/:id/users','put','/:id','update','delete','/:id/teams','removeTeams','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','show','/:id/members'];(function(_0x490257,_0x2ce183){var _0x1fc34c=function(_0x2699b5){while(--_0x2699b5){_0x490257['push'](_0x490257['shift']());}};_0x1fc34c(++_0x2ce183);}(_0xfb68,0x15d));var _0x8fb6=function(_0x46a8c5,_0x361669){_0x46a8c5=_0x46a8c5-0x0;var _0x3d2c67=_0xfb68[_0x46a8c5];return _0x3d2c67;};'use strict';var multer=require(_0x8fb6('0x0'));var util=require(_0x8fb6('0x1'));var path=require(_0x8fb6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8fb6('0x3')]();var fs_extra=require(_0x8fb6('0x4'));var auth=require(_0x8fb6('0x5'));var interaction=require(_0x8fb6('0x6'));var config=require(_0x8fb6('0x7'));var controller=require(_0x8fb6('0x8'));router[_0x8fb6('0x9')]('/',auth[_0x8fb6('0xa')](),controller[_0x8fb6('0xb')]);router[_0x8fb6('0x9')](_0x8fb6('0xc'),auth[_0x8fb6('0xa')](),controller['describe']);router[_0x8fb6('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x8fb6('0xd')]);router['get'](_0x8fb6('0xe'),auth['isAuthenticated'](),controller[_0x8fb6('0xf')]);router[_0x8fb6('0x9')]('/:id/teams',auth[_0x8fb6('0xa')](),controller[_0x8fb6('0x10')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x8fb6('0x11')]('/',auth[_0x8fb6('0xa')](),controller['create']);router[_0x8fb6('0x11')]('/:id/teams',auth[_0x8fb6('0xa')](),controller[_0x8fb6('0x12')]);router[_0x8fb6('0x11')](_0x8fb6('0x13'),auth[_0x8fb6('0xa')](),controller['addAgents']);router[_0x8fb6('0x14')](_0x8fb6('0x15'),auth[_0x8fb6('0xa')](),controller[_0x8fb6('0x16')]);router[_0x8fb6('0x17')](_0x8fb6('0x15'),auth[_0x8fb6('0xa')](),controller['destroy']);router[_0x8fb6('0x17')](_0x8fb6('0x18'),auth['isAuthenticated'](),controller[_0x8fb6('0x19')]);router[_0x8fb6('0x17')](_0x8fb6('0x13'),auth[_0x8fb6('0xa')](),controller[_0x8fb6('0x1a')]);module[_0x8fb6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index bfda578..799f251 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 _0xef88=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xef88,0xe7));var _0x8ef8=function(_0x26d398,_0x22f9b0){_0x26d398=_0x26d398-0x0;var _0x3e65f2=_0xef88[_0x26d398];return _0x3e65f2;};'use strict';var Sequelize=require(_0x8ef8('0x0'));module['exports']={'name':{'type':Sequelize[_0x8ef8('0x1')],'unique':_0x8ef8('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x8ef8('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8ef8('0x4')](_0x8ef8('0x5'),_0x8ef8('0x6'),_0x8ef8('0x7'))}}; \ No newline at end of file +var _0xa1a8=['roundrobin','exports','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x15c956,_0x1304a5){var _0x26901d=function(_0x5e5fea){while(--_0x5e5fea){_0x15c956['push'](_0x15c956['shift']());}};_0x26901d(++_0x1304a5);}(_0xa1a8,0x86));var _0x8a1a=function(_0x526f7d,_0x21ea8f){_0x526f7d=_0x526f7d-0x0;var _0x5c39aa=_0xa1a8[_0x526f7d];return _0x5c39aa;};'use strict';var Sequelize=require('sequelize');module[_0x8a1a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x8a1a('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8a1a('0x2')]},'timeout':{'type':Sequelize[_0x8a1a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8a1a('0x4')](_0x8a1a('0x5'),'beepall',_0x8a1a('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index dfab337..552b67c 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 _0x304c=['map','OpenchannelQueue','rawAttributes','fieldName','type','query','filters','attributes','intersection','model','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','findAll','rows','show','params','keys','fields','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserOpenchannelQueue','order','pick','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','openchannelPause','getTeams','addTeams','ids','Team','Agents','voicePause','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','json','limit','undefined','offset','count','status','set','apply','reject','update','destroy','then','get','UserProfileResource','end','error','stack','name','send','index'];(function(_0x2ec818,_0x5933cb){var _0x12cf49=function(_0x9ea788){while(--_0x9ea788){_0x2ec818['push'](_0x2ec818['shift']());}};_0x12cf49(++_0x5933cb);}(_0x304c,0x170));var _0xc304=function(_0x3b8d8f,_0xfe696b){_0x3b8d8f=_0x3b8d8f-0x0;var _0x473013=_0x304c[_0x3b8d8f];return _0x473013;};'use strict';var emlformat=require(_0xc304('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc304('0x1'));var jsonpatch=require(_0xc304('0x2'));var rp=require(_0xc304('0x3'));var moment=require(_0xc304('0x4'));var BPromise=require(_0xc304('0x5'));var Mustache=require(_0xc304('0x6'));var util=require('util');var path=require(_0xc304('0x7'));var sox=require(_0xc304('0x8'));var csv=require('to-csv');var ejs=require(_0xc304('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc304('0xa'));var squel=require(_0xc304('0xb'));var crypto=require(_0xc304('0xc'));var jsforce=require(_0xc304('0xd'));var deskjs=require(_0xc304('0xe'));var toCsv=require(_0xc304('0xf'));var querystring=require(_0xc304('0x10'));var Papa=require(_0xc304('0x11'));var Redis=require(_0xc304('0x12'));var authService=require(_0xc304('0x13'));var qs=require(_0xc304('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc304('0x15'));var logger=require('../../config/logger')(_0xc304('0x16'));var utils=require(_0xc304('0x17'));var config=require(_0xc304('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc304('0x19'))['db'];config[_0xc304('0x1a')]=_[_0xc304('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc304('0x1c'))(new Redis(config[_0xc304('0x1a')]));require(_0xc304('0x1d'))[_0xc304('0x1e')](socket);function respondWithStatusCode(_0x28d605,_0x5353cb){_0x5353cb=_0x5353cb||0xcc;return function(_0x38dc20){if(_0x38dc20){return _0x28d605[_0xc304('0x1f')](_0x5353cb);}return _0x28d605['status'](_0x5353cb)['end']();};}function respondWithResult(_0x1f041c,_0x11d737){_0x11d737=_0x11d737||0xc8;return function(_0x309e09){if(_0x309e09){return _0x1f041c['status'](_0x11d737)[_0xc304('0x20')](_0x309e09);}};}function respondWithFilteredResult(_0x41fe48,_0x49a068){return function(_0x27d739){if(_0x27d739){var _0x495ea8=typeof _0x49a068['offset']==='undefined'&&typeof _0x49a068[_0xc304('0x21')]===_0xc304('0x22');var _0x3dcb18=_0x27d739['count'];var _0x67e501=_0x495ea8?0x0:_0x49a068[_0xc304('0x23')];var _0xf71853=_0x495ea8?_0x27d739[_0xc304('0x24')]:_0x49a068[_0xc304('0x23')]+_0x49a068['limit'];var _0x510e1c;if(_0xf71853>=_0x3dcb18){_0xf71853=_0x3dcb18;_0x510e1c=0xc8;}else{_0x510e1c=0xce;}_0x41fe48[_0xc304('0x25')](_0x510e1c);return _0x41fe48[_0xc304('0x26')]('Content-Range',_0x67e501+'-'+_0xf71853+'/'+_0x3dcb18)[_0xc304('0x20')](_0x27d739);}return null;};}function patchUpdates(_0x209bf1){return function(_0x9d7d7f){try{jsonpatch[_0xc304('0x27')](_0x9d7d7f,_0x209bf1,!![]);}catch(_0x34c192){return BPromise[_0xc304('0x28')](_0x34c192);}return _0x9d7d7f['save']();};}function saveUpdates(_0x86c7fa,_0x481c47){return function(_0x49a189){if(_0x49a189){return _0x49a189[_0xc304('0x29')](_0x86c7fa)['then'](function(_0x2b1c08){return _0x2b1c08;});}return null;};}function removeEntity(_0x3b014e,_0x301833){return function(_0x4508b6){if(_0x4508b6){return _0x4508b6[_0xc304('0x2a')]()[_0xc304('0x2b')](function(){var _0x521d8f=_0x4508b6[_0xc304('0x2c')]({'plain':!![]});var _0x582d4f='OpenchannelQueues';return db[_0xc304('0x2d')][_0xc304('0x2a')]({'where':{'type':_0x582d4f,'resourceId':_0x521d8f['id']}})[_0xc304('0x2b')](function(){return _0x4508b6;});})['then'](function(){_0x3b014e['status'](0xcc)[_0xc304('0x2e')]();});}};}function handleEntityNotFound(_0x190b42,_0x4d522f){return function(_0x53b57d){if(!_0x53b57d){_0x190b42['sendStatus'](0x194);}return _0x53b57d;};}function handleError(_0x3adddd,_0x1267d){_0x1267d=_0x1267d||0x1f4;return function(_0x8cb683){logger[_0xc304('0x2f')](_0x8cb683[_0xc304('0x30')]);if(_0x8cb683[_0xc304('0x31')]){delete _0x8cb683[_0xc304('0x31')];}_0x3adddd[_0xc304('0x25')](_0x1267d)[_0xc304('0x32')](_0x8cb683);};}exports[_0xc304('0x33')]=function(_0x9fd259,_0x2e3090){var _0x8eec04={},_0x17d4e0={},_0x5225e4={'count':0x0,'rows':[]};var _0x1c4f22=_[_0xc304('0x34')](db[_0xc304('0x35')][_0xc304('0x36')],function(_0x56f6f4){return{'name':_0x56f6f4[_0xc304('0x37')],'type':_0x56f6f4[_0xc304('0x38')]['key']};});_0x17d4e0['model']=_[_0xc304('0x34')](_0x1c4f22,_0xc304('0x31'));_0x17d4e0[_0xc304('0x39')]=_['keys'](_0x9fd259[_0xc304('0x39')]);_0x17d4e0[_0xc304('0x3a')]=_['intersection'](_0x17d4e0['model'],_0x17d4e0[_0xc304('0x39')]);_0x8eec04[_0xc304('0x3b')]=_[_0xc304('0x3c')](_0x17d4e0[_0xc304('0x3d')],qs['fields'](_0x9fd259[_0xc304('0x39')]['fields']));_0x8eec04[_0xc304('0x3b')]=_0x8eec04['attributes'][_0xc304('0x3e')]?_0x8eec04[_0xc304('0x3b')]:_0x17d4e0[_0xc304('0x3d')];if(!_0x9fd259[_0xc304('0x39')][_0xc304('0x3f')](_0xc304('0x40'))){_0x8eec04['limit']=qs['limit'](_0x9fd259[_0xc304('0x39')][_0xc304('0x21')]);_0x8eec04['offset']=qs[_0xc304('0x23')](_0x9fd259[_0xc304('0x39')][_0xc304('0x23')]);}_0x8eec04['order']=qs[_0xc304('0x41')](_0x9fd259[_0xc304('0x39')][_0xc304('0x41')]);_0x8eec04[_0xc304('0x42')]=qs['filters'](_['pick'](_0x9fd259[_0xc304('0x39')],_0x17d4e0['filters']),_0x1c4f22);if(_0x9fd259[_0xc304('0x39')][_0xc304('0x43')]){_0x8eec04['where']=_['merge'](_0x8eec04[_0xc304('0x42')],{'$or':_[_0xc304('0x34')](_0x1c4f22,function(_0x299f0f){if(_0x299f0f['type']!=='VIRTUAL'){var _0x5e09c3={};_0x5e09c3[_0x299f0f[_0xc304('0x31')]]={'$like':'%'+_0x9fd259[_0xc304('0x39')]['filter']+'%'};return _0x5e09c3;}})});}_0x8eec04=_[_0xc304('0x44')]({},_0x8eec04,_0x9fd259[_0xc304('0x45')]);var _0x3fc343={'where':_0x8eec04[_0xc304('0x42')]};return db['OpenchannelQueue']['count'](_0x3fc343)[_0xc304('0x2b')](function(_0x417ba1){_0x5225e4[_0xc304('0x24')]=_0x417ba1;if(_0x9fd259[_0xc304('0x39')][_0xc304('0x46')]){_0x8eec04['include']=[{'all':!![]}];}return db[_0xc304('0x35')][_0xc304('0x47')](_0x8eec04);})['then'](function(_0x214bad){_0x5225e4[_0xc304('0x48')]=_0x214bad;return _0x5225e4;})[_0xc304('0x2b')](respondWithFilteredResult(_0x2e3090,_0x8eec04))['catch'](handleError(_0x2e3090,null));};exports[_0xc304('0x49')]=function(_0x52b9c4,_0x56f33f){var _0x36fd24={'raw':!![],'where':{'id':_0x52b9c4[_0xc304('0x4a')]['id']}},_0x21c361={};_0x21c361[_0xc304('0x3d')]=_[_0xc304('0x4b')](db[_0xc304('0x35')][_0xc304('0x36')]);_0x21c361['query']=_[_0xc304('0x4b')](_0x52b9c4[_0xc304('0x39')]);_0x21c361[_0xc304('0x3a')]=_['intersection'](_0x21c361[_0xc304('0x3d')],_0x21c361[_0xc304('0x39')]);_0x36fd24[_0xc304('0x3b')]=_['intersection'](_0x21c361[_0xc304('0x3d')],qs[_0xc304('0x4c')](_0x52b9c4[_0xc304('0x39')][_0xc304('0x4c')]));_0x36fd24['attributes']=_0x36fd24['attributes'][_0xc304('0x3e')]?_0x36fd24[_0xc304('0x3b')]:_0x21c361[_0xc304('0x3d')];if(_0x52b9c4[_0xc304('0x39')]['includeAll']){_0x36fd24['include']=[{'all':!![]}];}_0x36fd24=_[_0xc304('0x44')]({},_0x36fd24,_0x52b9c4[_0xc304('0x45')]);return db[_0xc304('0x35')][_0xc304('0x4d')](_0x36fd24)[_0xc304('0x2b')](handleEntityNotFound(_0x56f33f,null))[_0xc304('0x2b')](respondWithResult(_0x56f33f,null))[_0xc304('0x4e')](handleError(_0x56f33f,null));};exports[_0xc304('0x4f')]=function(_0x3c6c45,_0x4dff0a){return db[_0xc304('0x35')][_0xc304('0x4f')](_0x3c6c45[_0xc304('0x50')],{})[_0xc304('0x2b')](function(_0x475eda){var _0x1b1380=_0x3c6c45[_0xc304('0x51')][_0xc304('0x2c')]({'plain':!![]});if(!_0x1b1380)throw new Error(_0xc304('0x52'));if(_0x1b1380['role']==='user'){var _0x1ae026=_0x475eda[_0xc304('0x2c')]({'plain':!![]});var _0x1bcecc=_0xc304('0x53');return db[_0xc304('0x54')][_0xc304('0x4d')]({'where':{'name':_0x1bcecc,'userProfileId':_0x1b1380[_0xc304('0x55')]},'raw':!![]})[_0xc304('0x2b')](function(_0x4c5b24){if(_0x4c5b24&&_0x4c5b24['autoAssociation']===0x0){return db[_0xc304('0x2d')][_0xc304('0x4f')]({'name':_0x1ae026[_0xc304('0x31')],'resourceId':_0x1ae026['id'],'type':_0x4c5b24[_0xc304('0x31')],'sectionId':_0x4c5b24['id']},{})[_0xc304('0x2b')](function(){return _0x475eda;});}else{return _0x475eda;}})[_0xc304('0x4e')](function(_0x229d1c){logger[_0xc304('0x2f')](_0xc304('0x56'),_0x229d1c);throw _0x229d1c;});}return _0x475eda;})[_0xc304('0x2b')](respondWithResult(_0x4dff0a,0xc9))['catch'](handleError(_0x4dff0a,null));};exports[_0xc304('0x29')]=function(_0x4d31bb,_0x38afd3){if(_0x4d31bb['body']['id']){delete _0x4d31bb[_0xc304('0x50')]['id'];}return db['OpenchannelQueue'][_0xc304('0x4d')]({'where':{'id':_0x4d31bb[_0xc304('0x4a')]['id']}})['then'](handleEntityNotFound(_0x38afd3,null))[_0xc304('0x2b')](saveUpdates(_0x4d31bb['body'],null))[_0xc304('0x2b')](respondWithResult(_0x38afd3,null))['catch'](handleError(_0x38afd3,null));};exports[_0xc304('0x2a')]=function(_0xbd668f,_0x387b2e){return db['OpenchannelQueue'][_0xc304('0x4d')]({'where':{'id':_0xbd668f[_0xc304('0x4a')]['id']}})['then'](handleEntityNotFound(_0x387b2e,null))['then'](removeEntity(_0x387b2e,null))[_0xc304('0x4e')](handleError(_0x387b2e,null));};exports[_0xc304('0x57')]=function(_0x3db8f0,_0x5c5902){return db[_0xc304('0x35')][_0xc304('0x57')]()[_0xc304('0x2b')](respondWithResult(_0x5c5902,null))[_0xc304('0x4e')](handleError(_0x5c5902,null));};exports['getMembers']=function(_0x2bcbb1,_0x48c7d9,_0x5aa2d1){var _0x44d799={'raw':!![],'where':{}},_0x7c2333={},_0x567740;return db[_0xc304('0x35')][_0xc304('0x58')]({'where':{'id':_0x2bcbb1['params']['id']}})['then'](handleEntityNotFound(_0x48c7d9,null))[_0xc304('0x2b')](function(_0x3e1ae9){if(_0x3e1ae9){_0x567740=_0x3e1ae9['get']({'plain':!![]});_0x7c2333[_0xc304('0x3d')]=_['keys'](db[_0xc304('0x59')]['rawAttributes']);_0x7c2333[_0xc304('0x39')]=_[_0xc304('0x4b')](_0x2bcbb1[_0xc304('0x39')]);_0x7c2333[_0xc304('0x3a')]=_['intersection'](_0x7c2333[_0xc304('0x3d')],_0x7c2333[_0xc304('0x39')]);_0x44d799[_0xc304('0x3b')]=_['intersection'](_0x7c2333[_0xc304('0x3d')],qs[_0xc304('0x4c')](_0x2bcbb1[_0xc304('0x39')][_0xc304('0x4c')]));_0x44d799[_0xc304('0x3b')]=_0x44d799[_0xc304('0x3b')][_0xc304('0x3e')]?_0x44d799['attributes']:_0x7c2333[_0xc304('0x3d')];if(!_0x2bcbb1[_0xc304('0x39')][_0xc304('0x3f')](_0xc304('0x40'))){_0x44d799[_0xc304('0x21')]=qs[_0xc304('0x21')](_0x2bcbb1[_0xc304('0x39')][_0xc304('0x21')]);_0x44d799['offset']=qs[_0xc304('0x23')](_0x2bcbb1['query'][_0xc304('0x23')]);}_0x44d799[_0xc304('0x5a')]=qs[_0xc304('0x41')](_0x2bcbb1[_0xc304('0x39')][_0xc304('0x41')]);_0x44d799[_0xc304('0x42')]=qs[_0xc304('0x3a')](_[_0xc304('0x5b')](_0x2bcbb1[_0xc304('0x39')],_0x7c2333[_0xc304('0x3a')]));_0x44d799[_0xc304('0x42')]['OpenchannelQueueId']=_0x3e1ae9['id'];if(_0x2bcbb1['query'][_0xc304('0x43')]){_0x44d799[_0xc304('0x42')]=_[_0xc304('0x44')](_0x44d799[_0xc304('0x42')],{'$or':_[_0xc304('0x34')](_0x44d799['attributes'],function(_0x2e09b5){var _0x2d0fb7={};_0x2d0fb7[_0x2e09b5]={'$like':'%'+_0x2bcbb1[_0xc304('0x39')][_0xc304('0x43')]+'%'};return _0x2d0fb7;})});}_0x44d799=_[_0xc304('0x44')]({},_0x44d799,_0x2bcbb1[_0xc304('0x45')]);return db['UserOpenchannelQueue']['findAll'](_0x44d799);}})['then'](function(_0x1b8d26){if(_0x1b8d26){return db[_0xc304('0x5c')][_0xc304('0x5d')]({'where':{'id':_[_0xc304('0x34')](_0x1b8d26,_0xc304('0x5e')),'role':_0xc304('0x5f')},'attributes':['id',_0xc304('0x31'),'openchannelPause',_0xc304('0x60'),_0xc304('0x61')]});}})[_0xc304('0x2b')](function(_0x41dd33){if(_0x41dd33){return{'count':_0x41dd33['count'],'rows':_['map'](_0x41dd33['rows'],function(_0x434199){return{'membername':_0x434199[_0xc304('0x31')],'UserId':_0x434199['id'],'queue_name':_0x567740[_0xc304('0x31')],'OpenchannelQueueId':_0x567740['id'],'interface':util[_0xc304('0x62')]('%s/%s','SIP',_0x434199[_0xc304('0x31')]),'penalty':0x0,'paused':_0x434199[_0xc304('0x63')],'createdAt':_0x434199[_0xc304('0x61')],'updatedAt':_0x434199['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xc304('0x2b')](respondWithFilteredResult(_0x48c7d9,_0x44d799))[_0xc304('0x4e')](handleError(_0x48c7d9,null));};exports[_0xc304('0x64')]=function(_0x309bc3,_0x11739d,_0x5929b2){var _0x2bed3a={};var _0x32e367={};var _0x34d731;var _0x1ff690;return db[_0xc304('0x35')][_0xc304('0x58')]({'where':{'id':_0x309bc3['params']['id']}})['then'](handleEntityNotFound(_0x11739d,null))['then'](function(_0x219950){if(_0x219950){_0x34d731=_0x219950;_0x32e367[_0xc304('0x3d')]=_[_0xc304('0x4b')](db['Team'][_0xc304('0x36')]);_0x32e367['query']=_[_0xc304('0x4b')](_0x309bc3['query']);_0x32e367['filters']=_[_0xc304('0x3c')](_0x32e367[_0xc304('0x3d')],_0x32e367[_0xc304('0x39')]);_0x2bed3a[_0xc304('0x3b')]=_[_0xc304('0x3c')](_0x32e367[_0xc304('0x3d')],qs[_0xc304('0x4c')](_0x309bc3[_0xc304('0x39')][_0xc304('0x4c')]));_0x2bed3a[_0xc304('0x3b')]=_0x2bed3a['attributes'][_0xc304('0x3e')]?_0x2bed3a[_0xc304('0x3b')]:_0x32e367['model'];_0x2bed3a[_0xc304('0x5a')]=qs[_0xc304('0x41')](_0x309bc3[_0xc304('0x39')][_0xc304('0x41')]);_0x2bed3a['where']=qs[_0xc304('0x3a')](_[_0xc304('0x5b')](_0x309bc3[_0xc304('0x39')],_0x32e367['filters']));if(_0x309bc3[_0xc304('0x39')][_0xc304('0x43')]){_0x2bed3a[_0xc304('0x42')]=_[_0xc304('0x44')](_0x2bed3a[_0xc304('0x42')],{'$or':_['map'](_0x2bed3a[_0xc304('0x3b')],function(_0x2874cd){var _0x130539={};_0x130539[_0x2874cd]={'$like':'%'+_0x309bc3[_0xc304('0x39')][_0xc304('0x43')]+'%'};return _0x130539;})});}_0x2bed3a=_[_0xc304('0x44')]({},_0x2bed3a,_0x309bc3[_0xc304('0x45')]);return _0x34d731['getTeams'](_0x2bed3a);}})[_0xc304('0x2b')](function(_0x150fe5){if(_0x150fe5){_0x1ff690=_0x150fe5[_0xc304('0x3e')];if(!_0x309bc3[_0xc304('0x39')]['hasOwnProperty']('nolimit')){_0x2bed3a[_0xc304('0x21')]=qs[_0xc304('0x21')](_0x309bc3[_0xc304('0x39')][_0xc304('0x21')]);_0x2bed3a[_0xc304('0x23')]=qs[_0xc304('0x23')](_0x309bc3[_0xc304('0x39')][_0xc304('0x23')]);}return _0x34d731['getTeams'](_0x2bed3a);}})['then'](function(_0x2b35ed){if(_0x2b35ed){return _0x2b35ed?{'count':_0x1ff690,'rows':_0x2b35ed}:null;}})['then'](respondWithResult(_0x11739d,null))[_0xc304('0x4e')](handleError(_0x11739d,null));};exports[_0xc304('0x65')]=function(_0x496579,_0xf92cfc,_0x4f332e){var _0x535670=_0x496579[_0xc304('0x50')][_0xc304('0x66')];return db[_0xc304('0x67')][_0xc304('0x47')]({'where':{'id':_0x535670},'attributes':['id'],'include':[{'model':db[_0xc304('0x5c')],'as':_0xc304('0x68'),'attributes':['id',_0xc304('0x31'),'online',_0xc304('0x69'),'interface'],'raw':!![]}]})[_0xc304('0x2b')](function(_0x456dcb){if(_0x456dcb){var _0x2b0ba1=_['flatMap'](_0x456dcb,function(_0x500a0f){var _0x43fc72=_0x500a0f[_0xc304('0x2c')]({'plain':!![]});return _0x43fc72[_0xc304('0x68')];});return db[_0xc304('0x35')]['find']({'where':{'id':_0x496579[_0xc304('0x4a')]['id']}})[_0xc304('0x2b')](function(_0x34bb74){return db[_0xc304('0x6a')][_0xc304('0x6b')](function(_0x179072){return _0x34bb74[_0xc304('0x65')](_0x535670,{'transaction':_0x179072})['then'](function(){return BPromise[_0xc304('0x6c')](_0x2b0ba1,function(_0x2baec7){return db['UserOpenchannelQueue'][_0xc304('0x6d')]({'where':{'UserId':_0x2baec7['id'],'OpenchannelQueueId':_0x496579[_0xc304('0x4a')]['id']},'transaction':_0x179072});});})[_0xc304('0x2b')](function(){_0x2b0ba1[_0xc304('0x6e')](function(_0x24b35d){socket[_0xc304('0x6f')](_0xc304('0x70'),{'UserId':_0x24b35d['id'],'OpenchannelQueueId':_0x34bb74['id']});});});});});}})['then'](respondWithStatusCode(_0xf92cfc,null))['catch'](handleError(_0xf92cfc,null));};exports[_0xc304('0x71')]=function(_0x50913e,_0x231c70,_0x2c3efb){return db[_0xc304('0x67')]['findAll']({'where':{'id':_0x50913e[_0xc304('0x39')][_0xc304('0x66')]},'attributes':['id'],'include':[{'model':db[_0xc304('0x5c')],'as':_0xc304('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x231c70,null))['then'](function(_0x5187ea){var _0x49e262=_[_0xc304('0x34')](_0x5187ea,'id');var _0x243024=[];var _0x4897bd=[];var _0x298c83=squel[_0xc304('0x72')]();_0x298c83[_0xc304('0x73')](_0xc304('0x74'))[_0xc304('0x75')](_0xc304('0x76'),'tq')[_0xc304('0x77')](_0xc304('0x78'),'ut',_0xc304('0x79'))[_0xc304('0x42')](_0xc304('0x7a'),_0x50913e[_0xc304('0x4a')]['id']);for(var _0x1cbd8c=0x0;_0x1cbd8c<_0x5187ea[_0xc304('0x3e')];_0x1cbd8c+=0x1){let _0x2cd3ee=_0x5187ea[_0x1cbd8c];for(var _0x2f76bb=0x0;_0x2f76bb<_0x2cd3ee['Agents'][_0xc304('0x3e')];_0x2f76bb+=0x1){let _0x402664=_0x2cd3ee['Agents'][_0x2f76bb];var _0x1c5a49=_0x298c83[_0xc304('0x7b')]();_0x1c5a49[_0xc304('0x42')]('ut.UserId\x20=\x20?',_0x402664['id']);_0x4897bd[_0xc304('0x7c')](db[_0xc304('0x6a')][_0xc304('0x39')](_0x1c5a49[_0xc304('0x7d')](),{'type':db[_0xc304('0x6a')][_0xc304('0x7e')][_0xc304('0x7f')]})[_0xc304('0x2b')](function(_0x27d6b7){if(_0x27d6b7['length']===0x1){return _0x402664['id'];}else{var _0x265e86=_[_0xc304('0x80')](_[_0xc304('0x34')](_0x27d6b7,'TeamId'),function(_0x1bacbc){return _[_0xc304('0x81')](_0x49e262,_0x1bacbc);});if(_0x265e86){return _0x402664['id'];}}}));}}return BPromise[_0xc304('0x82')](_0x4897bd)[_0xc304('0x2b')](function(_0x542c1b){_0x243024=_(_0x243024)[_0xc304('0x83')](_0x542c1b)[_0xc304('0x84')]()['value']();return db[_0xc304('0x35')][_0xc304('0x4d')]({'where':{'id':_0x50913e[_0xc304('0x4a')]['id']}})[_0xc304('0x2b')](function(_0x2b86cd){return db['sequelize'][_0xc304('0x6b')](function(_0x479dbc){return _0x2b86cd[_0xc304('0x71')](_0x50913e[_0xc304('0x39')][_0xc304('0x66')],{'transaction':_0x479dbc})['then'](function(){if(!_['isEmpty'](_0x243024)){return _0x2b86cd['removeAgents'](_0x243024,{'transaction':_0x479dbc});}})[_0xc304('0x2b')](function(){_0x243024[_0xc304('0x6e')](function(_0x46137c){socket[_0xc304('0x6f')](_0xc304('0x85'),{'UserId':_0x46137c,'OpenchannelQueueId':_0x2b86cd['id']});});});});});});})['then'](respondWithStatusCode(_0x231c70,null))['catch'](handleError(_0x231c70,null));};exports[_0xc304('0x86')]=function(_0x561483,_0x324905,_0x45e575){return db['OpenchannelQueue'][_0xc304('0x4d')]({'where':{'id':_0x561483[_0xc304('0x4a')]['id']}})['then'](handleEntityNotFound(_0x324905,null))[_0xc304('0x2b')](function(_0x535439){if(_0x535439){return _0x535439[_0xc304('0x86')](_0x561483[_0xc304('0x50')][_0xc304('0x66')],_[_0xc304('0x87')](_0x561483['body'],[_0xc304('0x66'),'id'])||{})[_0xc304('0x88')](function(_0x343000){for(var _0x547f08=0x0;_0x547f08<_0x561483[_0xc304('0x50')][_0xc304('0x66')][_0xc304('0x3e')];_0x547f08+=0x1){socket[_0xc304('0x6f')](_0xc304('0x70'),{'UserId':Number(_0x561483[_0xc304('0x50')][_0xc304('0x66')][_0x547f08]),'OpenchannelQueueId':Number(_0x561483[_0xc304('0x4a')]['id'])});}return _0x343000;});}})['then'](respondWithResult(_0x324905,null))[_0xc304('0x4e')](handleError(_0x324905,null));};exports[_0xc304('0x89')]=function(_0x254c1a,_0x355ba5,_0x5ee48d){return db[_0xc304('0x35')]['find']({'where':{'id':_0x254c1a['params']['id']}})['then'](handleEntityNotFound(_0x355ba5,null))['then'](function(_0x2bba6f){if(_0x2bba6f){return _0x2bba6f['removeAgents'](_0x254c1a['query'][_0xc304('0x66')])[_0xc304('0x2b')](function(){if(_[_0xc304('0x8a')](_0x254c1a[_0xc304('0x39')][_0xc304('0x66')])){for(var _0x27ab39=0x0;_0x27ab39<_0x254c1a[_0xc304('0x39')][_0xc304('0x66')][_0xc304('0x3e')];_0x27ab39+=0x1){socket[_0xc304('0x6f')](_0xc304('0x85'),{'UserId':Number(_0x254c1a[_0xc304('0x39')][_0xc304('0x66')][_0x27ab39]),'OpenchannelQueueId':Number(_0x254c1a[_0xc304('0x4a')]['id'])});}}else{socket[_0xc304('0x6f')]('userOpenchannelQueue:remove',{'UserId':Number(_0x254c1a['query'][_0xc304('0x66')]),'OpenchannelQueueId':Number(_0x254c1a[_0xc304('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x355ba5,null))['catch'](handleError(_0x355ba5,null));};exports[_0xc304('0x8b')]=function(_0x396a22,_0x20841c,_0x1474f8){var _0x2c604a={};var _0x26a96b={};var _0x2a6a41;var _0x460610;return db[_0xc304('0x35')][_0xc304('0x58')]({'where':{'id':_0x396a22[_0xc304('0x4a')]['id']}})[_0xc304('0x2b')](handleEntityNotFound(_0x20841c,null))[_0xc304('0x2b')](function(_0x45dc6f){if(_0x45dc6f){_0x2a6a41=_0x45dc6f;_0x26a96b[_0xc304('0x3d')]=_[_0xc304('0x4b')](db[_0xc304('0x5c')]['rawAttributes']);_0x26a96b[_0xc304('0x39')]=_[_0xc304('0x4b')](_0x396a22[_0xc304('0x39')]);_0x26a96b[_0xc304('0x3a')]=_[_0xc304('0x3c')](_0x26a96b['model'],_0x26a96b[_0xc304('0x39')]);_0x2c604a['attributes']=_['intersection'](_0x26a96b[_0xc304('0x3d')],qs['fields'](_0x396a22['query'][_0xc304('0x4c')]));_0x2c604a[_0xc304('0x3b')]=_0x2c604a['attributes']['length']?_0x2c604a['attributes']:_0x26a96b['model'];_0x2c604a['order']=qs[_0xc304('0x41')](_0x396a22[_0xc304('0x39')][_0xc304('0x41')]);_0x2c604a[_0xc304('0x42')]=qs['filters'](_[_0xc304('0x5b')](_0x396a22[_0xc304('0x39')],_0x26a96b['filters']));if(_0x396a22[_0xc304('0x39')]['filter']){_0x2c604a[_0xc304('0x42')]=_[_0xc304('0x44')](_0x2c604a[_0xc304('0x42')],{'$or':_[_0xc304('0x34')](_0x2c604a[_0xc304('0x3b')],function(_0x5e6366){var _0x5ef9e2={};_0x5ef9e2[_0x5e6366]={'$like':'%'+_0x396a22[_0xc304('0x39')][_0xc304('0x43')]+'%'};return _0x5ef9e2;})});}_0x2c604a=_['merge']({},_0x2c604a,_0x396a22[_0xc304('0x45')]);return _0x2a6a41[_0xc304('0x8b')](_0x2c604a);}})[_0xc304('0x2b')](function(_0x485c9d){if(_0x485c9d){_0x460610=_0x485c9d[_0xc304('0x3e')];if(!_0x396a22[_0xc304('0x39')][_0xc304('0x3f')](_0xc304('0x40'))){_0x2c604a['limit']=qs[_0xc304('0x21')](_0x396a22[_0xc304('0x39')]['limit']);_0x2c604a[_0xc304('0x23')]=qs[_0xc304('0x23')](_0x396a22[_0xc304('0x39')]['offset']);}return _0x2a6a41[_0xc304('0x8b')](_0x2c604a);}})[_0xc304('0x2b')](function(_0x559a17){if(_0x559a17){return _0x559a17?{'count':_0x460610,'rows':_0x559a17}:null;}})[_0xc304('0x2b')](respondWithResult(_0x20841c,null))[_0xc304('0x4e')](handleError(_0x20841c,null));}; \ No newline at end of file +var _0xab26=['save','update','get','OpenchannelQueues','UserProfileResource','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','OpenchannelQueue','count','includeAll','include','findAll','catch','show','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','OpenchannelQueueId','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','rows','%s/%s','SIP','getTeams','addTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','offset','undefined','limit','Content-Range','json','apply'];(function(_0x520db8,_0x4606b5){var _0x4e658b=function(_0x7453d0){while(--_0x7453d0){_0x520db8['push'](_0x520db8['shift']());}};_0x4e658b(++_0x4606b5);}(_0xab26,0x67));var _0x6ab2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xab26[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6ab2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6ab2('0x1'));var rp=require('request-promise');var moment=require(_0x6ab2('0x2'));var BPromise=require(_0x6ab2('0x3'));var Mustache=require(_0x6ab2('0x4'));var util=require(_0x6ab2('0x5'));var path=require(_0x6ab2('0x6'));var sox=require(_0x6ab2('0x7'));var csv=require(_0x6ab2('0x8'));var ejs=require(_0x6ab2('0x9'));var fs=require('fs');var fs_extra=require(_0x6ab2('0xa'));var _=require(_0x6ab2('0xb'));var squel=require(_0x6ab2('0xc'));var crypto=require(_0x6ab2('0xd'));var jsforce=require(_0x6ab2('0xe'));var deskjs=require(_0x6ab2('0xf'));var toCsv=require(_0x6ab2('0x8'));var querystring=require(_0x6ab2('0x10'));var Papa=require('papaparse');var Redis=require(_0x6ab2('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ab2('0x12'));var logger=require(_0x6ab2('0x13'))(_0x6ab2('0x14'));var utils=require('../../config/utils');var config=require(_0x6ab2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ab2('0x16'))['db'];config[_0x6ab2('0x17')]=_[_0x6ab2('0x18')](config[_0x6ab2('0x17')],{'host':_0x6ab2('0x19'),'port':0x18eb});var socket=require(_0x6ab2('0x1a'))(new Redis(config[_0x6ab2('0x17')]));require('./openchannelQueue.socket')[_0x6ab2('0x1b')](socket);function respondWithStatusCode(_0x61371a,_0x42dcbc){_0x42dcbc=_0x42dcbc||0xcc;return function(_0x48c650){if(_0x48c650){return _0x61371a['sendStatus'](_0x42dcbc);}return _0x61371a[_0x6ab2('0x1c')](_0x42dcbc)['end']();};}function respondWithResult(_0x392379,_0x1a4a31){_0x1a4a31=_0x1a4a31||0xc8;return function(_0x36d2c3){if(_0x36d2c3){return _0x392379['status'](_0x1a4a31)['json'](_0x36d2c3);}};}function respondWithFilteredResult(_0xb7b9e9,_0x401c28){return function(_0x22bacb){if(_0x22bacb){var _0xacabb1=typeof _0x401c28[_0x6ab2('0x1d')]===_0x6ab2('0x1e')&&typeof _0x401c28[_0x6ab2('0x1f')]===_0x6ab2('0x1e');var _0x2dbb97=_0x22bacb['count'];var _0x2f7dce=_0xacabb1?0x0:_0x401c28[_0x6ab2('0x1d')];var _0x47a367=_0xacabb1?_0x22bacb['count']:_0x401c28[_0x6ab2('0x1d')]+_0x401c28[_0x6ab2('0x1f')];var _0x206743;if(_0x47a367>=_0x2dbb97){_0x47a367=_0x2dbb97;_0x206743=0xc8;}else{_0x206743=0xce;}_0xb7b9e9['status'](_0x206743);return _0xb7b9e9['set'](_0x6ab2('0x20'),_0x2f7dce+'-'+_0x47a367+'/'+_0x2dbb97)[_0x6ab2('0x21')](_0x22bacb);}return null;};}function patchUpdates(_0x1a9bde){return function(_0x2af130){try{jsonpatch[_0x6ab2('0x22')](_0x2af130,_0x1a9bde,!![]);}catch(_0x2a0e9d){return BPromise['reject'](_0x2a0e9d);}return _0x2af130[_0x6ab2('0x23')]();};}function saveUpdates(_0x503de2,_0x3a2b66){return function(_0x3d407c){if(_0x3d407c){return _0x3d407c[_0x6ab2('0x24')](_0x503de2)['then'](function(_0x843f03){return _0x843f03;});}return null;};}function removeEntity(_0x54143d,_0x11f9f1){return function(_0x1faf6a){if(_0x1faf6a){return _0x1faf6a['destroy']()['then'](function(){var _0x2ae9a9=_0x1faf6a[_0x6ab2('0x25')]({'plain':!![]});var _0x8753f6=_0x6ab2('0x26');return db[_0x6ab2('0x27')][_0x6ab2('0x28')]({'where':{'type':_0x8753f6,'resourceId':_0x2ae9a9['id']}})[_0x6ab2('0x29')](function(){return _0x1faf6a;});})[_0x6ab2('0x29')](function(){_0x54143d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x124e01,_0x4acb4d){return function(_0x4bebdc){if(!_0x4bebdc){_0x124e01[_0x6ab2('0x2a')](0x194);}return _0x4bebdc;};}function handleError(_0x2d0e3e,_0x9f797b){_0x9f797b=_0x9f797b||0x1f4;return function(_0xd19d39){logger[_0x6ab2('0x2b')](_0xd19d39[_0x6ab2('0x2c')]);if(_0xd19d39[_0x6ab2('0x2d')]){delete _0xd19d39[_0x6ab2('0x2d')];}_0x2d0e3e['status'](_0x9f797b)[_0x6ab2('0x2e')](_0xd19d39);};}exports[_0x6ab2('0x2f')]=function(_0x4e76fe,_0x1d8741){var _0x384278={},_0x306742={},_0x299c76={'count':0x0,'rows':[]};var _0x551c06=_[_0x6ab2('0x30')](db['OpenchannelQueue'][_0x6ab2('0x31')],function(_0xfb2299){return{'name':_0xfb2299[_0x6ab2('0x32')],'type':_0xfb2299[_0x6ab2('0x33')][_0x6ab2('0x34')]};});_0x306742[_0x6ab2('0x35')]=_[_0x6ab2('0x30')](_0x551c06,'name');_0x306742[_0x6ab2('0x36')]=_[_0x6ab2('0x37')](_0x4e76fe[_0x6ab2('0x36')]);_0x306742[_0x6ab2('0x38')]=_['intersection'](_0x306742[_0x6ab2('0x35')],_0x306742['query']);_0x384278[_0x6ab2('0x39')]=_[_0x6ab2('0x3a')](_0x306742[_0x6ab2('0x35')],qs[_0x6ab2('0x3b')](_0x4e76fe[_0x6ab2('0x36')][_0x6ab2('0x3b')]));_0x384278[_0x6ab2('0x39')]=_0x384278[_0x6ab2('0x39')][_0x6ab2('0x3c')]?_0x384278['attributes']:_0x306742['model'];if(!_0x4e76fe[_0x6ab2('0x36')]['hasOwnProperty'](_0x6ab2('0x3d'))){_0x384278[_0x6ab2('0x1f')]=qs[_0x6ab2('0x1f')](_0x4e76fe['query'][_0x6ab2('0x1f')]);_0x384278[_0x6ab2('0x1d')]=qs[_0x6ab2('0x1d')](_0x4e76fe[_0x6ab2('0x36')][_0x6ab2('0x1d')]);}_0x384278[_0x6ab2('0x3e')]=qs[_0x6ab2('0x3f')](_0x4e76fe[_0x6ab2('0x36')][_0x6ab2('0x3f')]);_0x384278[_0x6ab2('0x40')]=qs[_0x6ab2('0x38')](_[_0x6ab2('0x41')](_0x4e76fe[_0x6ab2('0x36')],_0x306742['filters']),_0x551c06);if(_0x4e76fe[_0x6ab2('0x36')]['filter']){_0x384278[_0x6ab2('0x40')]=_[_0x6ab2('0x42')](_0x384278['where'],{'$or':_[_0x6ab2('0x30')](_0x551c06,function(_0x2f148b){if(_0x2f148b['type']!==_0x6ab2('0x43')){var _0x2499fd={};_0x2499fd[_0x2f148b[_0x6ab2('0x2d')]]={'$like':'%'+_0x4e76fe['query'][_0x6ab2('0x44')]+'%'};return _0x2499fd;}})});}_0x384278=_[_0x6ab2('0x42')]({},_0x384278,_0x4e76fe[_0x6ab2('0x45')]);var _0x4a7701={'where':_0x384278[_0x6ab2('0x40')]};return db[_0x6ab2('0x46')][_0x6ab2('0x47')](_0x4a7701)[_0x6ab2('0x29')](function(_0x1c2524){_0x299c76[_0x6ab2('0x47')]=_0x1c2524;if(_0x4e76fe[_0x6ab2('0x36')][_0x6ab2('0x48')]){_0x384278[_0x6ab2('0x49')]=[{'all':!![]}];}return db[_0x6ab2('0x46')][_0x6ab2('0x4a')](_0x384278);})['then'](function(_0x1e5bcb){_0x299c76['rows']=_0x1e5bcb;return _0x299c76;})['then'](respondWithFilteredResult(_0x1d8741,_0x384278))[_0x6ab2('0x4b')](handleError(_0x1d8741,null));};exports[_0x6ab2('0x4c')]=function(_0x4f7865,_0x45e555){var _0x520d13={'raw':!![],'where':{'id':_0x4f7865['params']['id']}},_0x4d5b71={};_0x4d5b71['model']=_[_0x6ab2('0x37')](db[_0x6ab2('0x46')][_0x6ab2('0x31')]);_0x4d5b71['query']=_[_0x6ab2('0x37')](_0x4f7865[_0x6ab2('0x36')]);_0x4d5b71[_0x6ab2('0x38')]=_[_0x6ab2('0x3a')](_0x4d5b71[_0x6ab2('0x35')],_0x4d5b71[_0x6ab2('0x36')]);_0x520d13['attributes']=_[_0x6ab2('0x3a')](_0x4d5b71[_0x6ab2('0x35')],qs[_0x6ab2('0x3b')](_0x4f7865[_0x6ab2('0x36')][_0x6ab2('0x3b')]));_0x520d13[_0x6ab2('0x39')]=_0x520d13['attributes'][_0x6ab2('0x3c')]?_0x520d13['attributes']:_0x4d5b71[_0x6ab2('0x35')];if(_0x4f7865[_0x6ab2('0x36')]['includeAll']){_0x520d13[_0x6ab2('0x49')]=[{'all':!![]}];}_0x520d13=_[_0x6ab2('0x42')]({},_0x520d13,_0x4f7865[_0x6ab2('0x45')]);return db[_0x6ab2('0x46')][_0x6ab2('0x4d')](_0x520d13)[_0x6ab2('0x29')](handleEntityNotFound(_0x45e555,null))[_0x6ab2('0x29')](respondWithResult(_0x45e555,null))[_0x6ab2('0x4b')](handleError(_0x45e555,null));};exports[_0x6ab2('0x4e')]=function(_0x44e11e,_0x23fdd2){return db['OpenchannelQueue'][_0x6ab2('0x4e')](_0x44e11e['body'],{})[_0x6ab2('0x29')](function(_0x169b2f){var _0x2eb197=_0x44e11e[_0x6ab2('0x4f')][_0x6ab2('0x25')]({'plain':!![]});if(!_0x2eb197)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2eb197[_0x6ab2('0x50')]===_0x6ab2('0x4f')){var _0x5e6f43=_0x169b2f['get']({'plain':!![]});var _0x37ece2=_0x6ab2('0x26');return db[_0x6ab2('0x51')][_0x6ab2('0x4d')]({'where':{'name':_0x37ece2,'userProfileId':_0x2eb197[_0x6ab2('0x52')]},'raw':!![]})[_0x6ab2('0x29')](function(_0x21b5cd){if(_0x21b5cd&&_0x21b5cd[_0x6ab2('0x53')]===0x0){return db['UserProfileResource'][_0x6ab2('0x4e')]({'name':_0x5e6f43[_0x6ab2('0x2d')],'resourceId':_0x5e6f43['id'],'type':_0x21b5cd['name'],'sectionId':_0x21b5cd['id']},{})[_0x6ab2('0x29')](function(){return _0x169b2f;});}else{return _0x169b2f;}})['catch'](function(_0x941c47){logger[_0x6ab2('0x2b')](_0x6ab2('0x54'),_0x941c47);throw _0x941c47;});}return _0x169b2f;})[_0x6ab2('0x29')](respondWithResult(_0x23fdd2,0xc9))[_0x6ab2('0x4b')](handleError(_0x23fdd2,null));};exports['update']=function(_0x590e23,_0x46c8fe){if(_0x590e23['body']['id']){delete _0x590e23[_0x6ab2('0x55')]['id'];}return db[_0x6ab2('0x46')][_0x6ab2('0x4d')]({'where':{'id':_0x590e23[_0x6ab2('0x56')]['id']}})[_0x6ab2('0x29')](handleEntityNotFound(_0x46c8fe,null))['then'](saveUpdates(_0x590e23[_0x6ab2('0x55')],null))[_0x6ab2('0x29')](respondWithResult(_0x46c8fe,null))['catch'](handleError(_0x46c8fe,null));};exports[_0x6ab2('0x28')]=function(_0x65c1e,_0x226f9a){return db[_0x6ab2('0x46')][_0x6ab2('0x4d')]({'where':{'id':_0x65c1e[_0x6ab2('0x56')]['id']}})[_0x6ab2('0x29')](handleEntityNotFound(_0x226f9a,null))[_0x6ab2('0x29')](removeEntity(_0x226f9a,null))[_0x6ab2('0x4b')](handleError(_0x226f9a,null));};exports[_0x6ab2('0x57')]=function(_0x4bc757,_0x46e91d){return db['OpenchannelQueue'][_0x6ab2('0x57')]()[_0x6ab2('0x29')](respondWithResult(_0x46e91d,null))[_0x6ab2('0x4b')](handleError(_0x46e91d,null));};exports[_0x6ab2('0x58')]=function(_0x4f508f,_0x2a5286,_0x58316e){var _0x44d2df={'raw':!![],'where':{}},_0x391e48={},_0x1d509a;return db[_0x6ab2('0x46')][_0x6ab2('0x59')]({'where':{'id':_0x4f508f[_0x6ab2('0x56')]['id']}})['then'](handleEntityNotFound(_0x2a5286,null))[_0x6ab2('0x29')](function(_0x5e2ea8){if(_0x5e2ea8){_0x1d509a=_0x5e2ea8[_0x6ab2('0x25')]({'plain':!![]});_0x391e48[_0x6ab2('0x35')]=_[_0x6ab2('0x37')](db[_0x6ab2('0x5a')][_0x6ab2('0x31')]);_0x391e48[_0x6ab2('0x36')]=_[_0x6ab2('0x37')](_0x4f508f[_0x6ab2('0x36')]);_0x391e48[_0x6ab2('0x38')]=_[_0x6ab2('0x3a')](_0x391e48[_0x6ab2('0x35')],_0x391e48[_0x6ab2('0x36')]);_0x44d2df[_0x6ab2('0x39')]=_[_0x6ab2('0x3a')](_0x391e48[_0x6ab2('0x35')],qs[_0x6ab2('0x3b')](_0x4f508f[_0x6ab2('0x36')]['fields']));_0x44d2df[_0x6ab2('0x39')]=_0x44d2df[_0x6ab2('0x39')]['length']?_0x44d2df[_0x6ab2('0x39')]:_0x391e48['model'];if(!_0x4f508f[_0x6ab2('0x36')][_0x6ab2('0x5b')](_0x6ab2('0x3d'))){_0x44d2df[_0x6ab2('0x1f')]=qs[_0x6ab2('0x1f')](_0x4f508f[_0x6ab2('0x36')][_0x6ab2('0x1f')]);_0x44d2df[_0x6ab2('0x1d')]=qs[_0x6ab2('0x1d')](_0x4f508f[_0x6ab2('0x36')]['offset']);}_0x44d2df[_0x6ab2('0x3e')]=qs[_0x6ab2('0x3f')](_0x4f508f[_0x6ab2('0x36')][_0x6ab2('0x3f')]);_0x44d2df[_0x6ab2('0x40')]=qs['filters'](_[_0x6ab2('0x41')](_0x4f508f['query'],_0x391e48[_0x6ab2('0x38')]));_0x44d2df[_0x6ab2('0x40')][_0x6ab2('0x5c')]=_0x5e2ea8['id'];if(_0x4f508f[_0x6ab2('0x36')]['filter']){_0x44d2df[_0x6ab2('0x40')]=_['merge'](_0x44d2df['where'],{'$or':_['map'](_0x44d2df[_0x6ab2('0x39')],function(_0x522208){var _0x20873c={};_0x20873c[_0x522208]={'$like':'%'+_0x4f508f[_0x6ab2('0x36')]['filter']+'%'};return _0x20873c;})});}_0x44d2df=_[_0x6ab2('0x42')]({},_0x44d2df,_0x4f508f[_0x6ab2('0x45')]);return db[_0x6ab2('0x5a')][_0x6ab2('0x4a')](_0x44d2df);}})[_0x6ab2('0x29')](function(_0x22c2f7){if(_0x22c2f7){return db[_0x6ab2('0x5d')][_0x6ab2('0x5e')]({'where':{'id':_[_0x6ab2('0x30')](_0x22c2f7,'UserId'),'role':_0x6ab2('0x5f')},'attributes':['id',_0x6ab2('0x2d'),_0x6ab2('0x60'),_0x6ab2('0x61'),_0x6ab2('0x62')]});}})['then'](function(_0x4b5f91){if(_0x4b5f91){return{'count':_0x4b5f91[_0x6ab2('0x47')],'rows':_[_0x6ab2('0x30')](_0x4b5f91[_0x6ab2('0x63')],function(_0x5bfdfc){return{'membername':_0x5bfdfc[_0x6ab2('0x2d')],'UserId':_0x5bfdfc['id'],'queue_name':_0x1d509a[_0x6ab2('0x2d')],'OpenchannelQueueId':_0x1d509a['id'],'interface':util['format'](_0x6ab2('0x64'),_0x6ab2('0x65'),_0x5bfdfc['name']),'penalty':0x0,'paused':_0x5bfdfc[_0x6ab2('0x60')],'createdAt':_0x5bfdfc[_0x6ab2('0x62')],'updatedAt':_0x5bfdfc[_0x6ab2('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6ab2('0x29')](respondWithFilteredResult(_0x2a5286,_0x44d2df))[_0x6ab2('0x4b')](handleError(_0x2a5286,null));};exports[_0x6ab2('0x66')]=function(_0x1a21f9,_0x2b0559,_0x238522){var _0x9808a={};var _0xaa3a6={};var _0x496c24;var _0x58ed90;return db[_0x6ab2('0x46')][_0x6ab2('0x59')]({'where':{'id':_0x1a21f9[_0x6ab2('0x56')]['id']}})[_0x6ab2('0x29')](handleEntityNotFound(_0x2b0559,null))['then'](function(_0x15ca2f){if(_0x15ca2f){_0x496c24=_0x15ca2f;_0xaa3a6[_0x6ab2('0x35')]=_['keys'](db['Team'][_0x6ab2('0x31')]);_0xaa3a6[_0x6ab2('0x36')]=_[_0x6ab2('0x37')](_0x1a21f9[_0x6ab2('0x36')]);_0xaa3a6['filters']=_[_0x6ab2('0x3a')](_0xaa3a6[_0x6ab2('0x35')],_0xaa3a6[_0x6ab2('0x36')]);_0x9808a[_0x6ab2('0x39')]=_[_0x6ab2('0x3a')](_0xaa3a6[_0x6ab2('0x35')],qs['fields'](_0x1a21f9[_0x6ab2('0x36')][_0x6ab2('0x3b')]));_0x9808a[_0x6ab2('0x39')]=_0x9808a['attributes'][_0x6ab2('0x3c')]?_0x9808a['attributes']:_0xaa3a6[_0x6ab2('0x35')];_0x9808a[_0x6ab2('0x3e')]=qs[_0x6ab2('0x3f')](_0x1a21f9[_0x6ab2('0x36')][_0x6ab2('0x3f')]);_0x9808a[_0x6ab2('0x40')]=qs[_0x6ab2('0x38')](_[_0x6ab2('0x41')](_0x1a21f9['query'],_0xaa3a6[_0x6ab2('0x38')]));if(_0x1a21f9[_0x6ab2('0x36')][_0x6ab2('0x44')]){_0x9808a[_0x6ab2('0x40')]=_[_0x6ab2('0x42')](_0x9808a[_0x6ab2('0x40')],{'$or':_[_0x6ab2('0x30')](_0x9808a[_0x6ab2('0x39')],function(_0x4d2a65){var _0x5b15dd={};_0x5b15dd[_0x4d2a65]={'$like':'%'+_0x1a21f9[_0x6ab2('0x36')][_0x6ab2('0x44')]+'%'};return _0x5b15dd;})});}_0x9808a=_['merge']({},_0x9808a,_0x1a21f9[_0x6ab2('0x45')]);return _0x496c24[_0x6ab2('0x66')](_0x9808a);}})[_0x6ab2('0x29')](function(_0x2d22e4){if(_0x2d22e4){_0x58ed90=_0x2d22e4[_0x6ab2('0x3c')];if(!_0x1a21f9['query'][_0x6ab2('0x5b')](_0x6ab2('0x3d'))){_0x9808a[_0x6ab2('0x1f')]=qs['limit'](_0x1a21f9[_0x6ab2('0x36')][_0x6ab2('0x1f')]);_0x9808a[_0x6ab2('0x1d')]=qs[_0x6ab2('0x1d')](_0x1a21f9[_0x6ab2('0x36')]['offset']);}return _0x496c24[_0x6ab2('0x66')](_0x9808a);}})[_0x6ab2('0x29')](function(_0x4383e1){if(_0x4383e1){return _0x4383e1?{'count':_0x58ed90,'rows':_0x4383e1}:null;}})[_0x6ab2('0x29')](respondWithResult(_0x2b0559,null))[_0x6ab2('0x4b')](handleError(_0x2b0559,null));};exports[_0x6ab2('0x67')]=function(_0x4bde2c,_0x4ea88f,_0x1c3e21){var _0x5ae513=_0x4bde2c[_0x6ab2('0x55')]['ids'];return db[_0x6ab2('0x68')][_0x6ab2('0x4a')]({'where':{'id':_0x5ae513},'attributes':['id'],'include':[{'model':db[_0x6ab2('0x5d')],'as':_0x6ab2('0x69'),'attributes':['id',_0x6ab2('0x2d'),_0x6ab2('0x6a'),_0x6ab2('0x6b'),_0x6ab2('0x6c')],'raw':!![]}]})['then'](function(_0x25c269){if(_0x25c269){var _0x5c6bbc=_[_0x6ab2('0x6d')](_0x25c269,function(_0x3b24a5){var _0x4d54f2=_0x3b24a5[_0x6ab2('0x25')]({'plain':!![]});return _0x4d54f2['Agents'];});return db[_0x6ab2('0x46')][_0x6ab2('0x4d')]({'where':{'id':_0x4bde2c['params']['id']}})[_0x6ab2('0x29')](function(_0x513324){return db[_0x6ab2('0x6e')][_0x6ab2('0x6f')](function(_0x3f5fc2){return _0x513324[_0x6ab2('0x67')](_0x5ae513,{'transaction':_0x3f5fc2})['then'](function(){return BPromise['each'](_0x5c6bbc,function(_0x174cf3){return db[_0x6ab2('0x5a')][_0x6ab2('0x70')]({'where':{'UserId':_0x174cf3['id'],'OpenchannelQueueId':_0x4bde2c[_0x6ab2('0x56')]['id']},'transaction':_0x3f5fc2});});})[_0x6ab2('0x29')](function(){_0x5c6bbc[_0x6ab2('0x71')](function(_0xcb6e51){socket['emit'](_0x6ab2('0x72'),{'UserId':_0xcb6e51['id'],'OpenchannelQueueId':_0x513324['id']});});});});});}})[_0x6ab2('0x29')](respondWithStatusCode(_0x4ea88f,null))[_0x6ab2('0x4b')](handleError(_0x4ea88f,null));};exports[_0x6ab2('0x73')]=function(_0x3caae7,_0x3a49a7,_0x27ead2){return db[_0x6ab2('0x68')][_0x6ab2('0x4a')]({'where':{'id':_0x3caae7[_0x6ab2('0x36')][_0x6ab2('0x74')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6ab2('0x69'),'attributes':['id'],'raw':!![]}]})[_0x6ab2('0x29')](handleEntityNotFound(_0x3a49a7,null))[_0x6ab2('0x29')](function(_0x3d75ba){var _0x1d145f=_['map'](_0x3d75ba,'id');var _0x1ffc16=[];var _0x2953c8=[];var _0x4f6f9d=squel['select']();_0x4f6f9d[_0x6ab2('0x75')](_0x6ab2('0x76'))[_0x6ab2('0x77')](_0x6ab2('0x78'),'tq')['join'](_0x6ab2('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6ab2('0x40')]('OpenchannelQueueId\x20=\x20?',_0x3caae7[_0x6ab2('0x56')]['id']);for(var _0x1361ae=0x0;_0x1361ae<_0x3d75ba['length'];_0x1361ae+=0x1){let _0x4dba17=_0x3d75ba[_0x1361ae];for(var _0x50c719=0x0;_0x50c719<_0x4dba17['Agents'][_0x6ab2('0x3c')];_0x50c719+=0x1){let _0x1e50ca=_0x4dba17[_0x6ab2('0x69')][_0x50c719];var _0x3ed1e3=_0x4f6f9d['clone']();_0x3ed1e3[_0x6ab2('0x40')]('ut.UserId\x20=\x20?',_0x1e50ca['id']);_0x2953c8[_0x6ab2('0x7a')](db[_0x6ab2('0x6e')]['query'](_0x3ed1e3[_0x6ab2('0x7b')](),{'type':db[_0x6ab2('0x6e')][_0x6ab2('0x7c')][_0x6ab2('0x7d')]})[_0x6ab2('0x29')](function(_0x118ae7){if(_0x118ae7[_0x6ab2('0x3c')]===0x1){return _0x1e50ca['id'];}else{var _0x30ea67=_['every'](_[_0x6ab2('0x30')](_0x118ae7,_0x6ab2('0x7e')),function(_0x48d9ba){return _[_0x6ab2('0x7f')](_0x1d145f,_0x48d9ba);});if(_0x30ea67){return _0x1e50ca['id'];}}}));}}return BPromise[_0x6ab2('0x80')](_0x2953c8)[_0x6ab2('0x29')](function(_0x885e89){_0x1ffc16=_(_0x1ffc16)[_0x6ab2('0x81')](_0x885e89)['compact']()['value']();return db['OpenchannelQueue'][_0x6ab2('0x4d')]({'where':{'id':_0x3caae7[_0x6ab2('0x56')]['id']}})['then'](function(_0x3e0cf4){return db['sequelize']['transaction'](function(_0x2ad037){return _0x3e0cf4['removeTeams'](_0x3caae7[_0x6ab2('0x36')]['ids'],{'transaction':_0x2ad037})[_0x6ab2('0x29')](function(){if(!_['isEmpty'](_0x1ffc16)){return _0x3e0cf4[_0x6ab2('0x82')](_0x1ffc16,{'transaction':_0x2ad037});}})[_0x6ab2('0x29')](function(){_0x1ffc16[_0x6ab2('0x71')](function(_0x18dfd6){socket[_0x6ab2('0x83')](_0x6ab2('0x84'),{'UserId':_0x18dfd6,'OpenchannelQueueId':_0x3e0cf4['id']});});});});});});})[_0x6ab2('0x29')](respondWithStatusCode(_0x3a49a7,null))[_0x6ab2('0x4b')](handleError(_0x3a49a7,null));};exports['addAgents']=function(_0x282ed9,_0x225d85,_0x526ee0){return db[_0x6ab2('0x46')][_0x6ab2('0x4d')]({'where':{'id':_0x282ed9['params']['id']}})[_0x6ab2('0x29')](handleEntityNotFound(_0x225d85,null))['then'](function(_0x18fe78){if(_0x18fe78){return _0x18fe78[_0x6ab2('0x85')](_0x282ed9['body'][_0x6ab2('0x74')],_[_0x6ab2('0x86')](_0x282ed9[_0x6ab2('0x55')],[_0x6ab2('0x74'),'id'])||{})[_0x6ab2('0x87')](function(_0x3c88c3){for(var _0x153fe0=0x0;_0x153fe0<_0x282ed9[_0x6ab2('0x55')]['ids'][_0x6ab2('0x3c')];_0x153fe0+=0x1){socket[_0x6ab2('0x83')](_0x6ab2('0x72'),{'UserId':Number(_0x282ed9['body']['ids'][_0x153fe0]),'OpenchannelQueueId':Number(_0x282ed9['params']['id'])});}return _0x3c88c3;});}})[_0x6ab2('0x29')](respondWithResult(_0x225d85,null))[_0x6ab2('0x4b')](handleError(_0x225d85,null));};exports[_0x6ab2('0x82')]=function(_0x5de179,_0x14f8e3,_0x367f8a){return db[_0x6ab2('0x46')]['find']({'where':{'id':_0x5de179[_0x6ab2('0x56')]['id']}})[_0x6ab2('0x29')](handleEntityNotFound(_0x14f8e3,null))[_0x6ab2('0x29')](function(_0x28a0f9){if(_0x28a0f9){return _0x28a0f9[_0x6ab2('0x82')](_0x5de179[_0x6ab2('0x36')][_0x6ab2('0x74')])[_0x6ab2('0x29')](function(){if(_[_0x6ab2('0x88')](_0x5de179[_0x6ab2('0x36')][_0x6ab2('0x74')])){for(var _0x22fc2d=0x0;_0x22fc2d<_0x5de179[_0x6ab2('0x36')]['ids'][_0x6ab2('0x3c')];_0x22fc2d+=0x1){socket[_0x6ab2('0x83')](_0x6ab2('0x84'),{'UserId':Number(_0x5de179[_0x6ab2('0x36')]['ids'][_0x22fc2d]),'OpenchannelQueueId':Number(_0x5de179['params']['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x5de179[_0x6ab2('0x36')]['ids']),'OpenchannelQueueId':Number(_0x5de179[_0x6ab2('0x56')]['id'])});}});}})[_0x6ab2('0x29')](respondWithStatusCode(_0x14f8e3,null))[_0x6ab2('0x4b')](handleError(_0x14f8e3,null));};exports['getAgents']=function(_0x5d37c2,_0x51b1d6,_0x3993cd){var _0x2c4e4d={};var _0x24e1ff={};var _0xcd1833;var _0x54bf7f;return db['OpenchannelQueue'][_0x6ab2('0x59')]({'where':{'id':_0x5d37c2['params']['id']}})[_0x6ab2('0x29')](handleEntityNotFound(_0x51b1d6,null))['then'](function(_0xd0554e){if(_0xd0554e){_0xcd1833=_0xd0554e;_0x24e1ff['model']=_[_0x6ab2('0x37')](db[_0x6ab2('0x5d')][_0x6ab2('0x31')]);_0x24e1ff['query']=_[_0x6ab2('0x37')](_0x5d37c2[_0x6ab2('0x36')]);_0x24e1ff[_0x6ab2('0x38')]=_['intersection'](_0x24e1ff[_0x6ab2('0x35')],_0x24e1ff[_0x6ab2('0x36')]);_0x2c4e4d[_0x6ab2('0x39')]=_['intersection'](_0x24e1ff[_0x6ab2('0x35')],qs[_0x6ab2('0x3b')](_0x5d37c2['query'][_0x6ab2('0x3b')]));_0x2c4e4d[_0x6ab2('0x39')]=_0x2c4e4d[_0x6ab2('0x39')][_0x6ab2('0x3c')]?_0x2c4e4d[_0x6ab2('0x39')]:_0x24e1ff[_0x6ab2('0x35')];_0x2c4e4d[_0x6ab2('0x3e')]=qs[_0x6ab2('0x3f')](_0x5d37c2[_0x6ab2('0x36')]['sort']);_0x2c4e4d['where']=qs['filters'](_['pick'](_0x5d37c2[_0x6ab2('0x36')],_0x24e1ff['filters']));if(_0x5d37c2[_0x6ab2('0x36')]['filter']){_0x2c4e4d[_0x6ab2('0x40')]=_[_0x6ab2('0x42')](_0x2c4e4d[_0x6ab2('0x40')],{'$or':_[_0x6ab2('0x30')](_0x2c4e4d[_0x6ab2('0x39')],function(_0x425688){var _0x599964={};_0x599964[_0x425688]={'$like':'%'+_0x5d37c2['query'][_0x6ab2('0x44')]+'%'};return _0x599964;})});}_0x2c4e4d=_['merge']({},_0x2c4e4d,_0x5d37c2[_0x6ab2('0x45')]);return _0xcd1833[_0x6ab2('0x89')](_0x2c4e4d);}})[_0x6ab2('0x29')](function(_0x5cac0b){if(_0x5cac0b){_0x54bf7f=_0x5cac0b[_0x6ab2('0x3c')];if(!_0x5d37c2[_0x6ab2('0x36')][_0x6ab2('0x5b')](_0x6ab2('0x3d'))){_0x2c4e4d[_0x6ab2('0x1f')]=qs[_0x6ab2('0x1f')](_0x5d37c2[_0x6ab2('0x36')]['limit']);_0x2c4e4d[_0x6ab2('0x1d')]=qs[_0x6ab2('0x1d')](_0x5d37c2[_0x6ab2('0x36')][_0x6ab2('0x1d')]);}return _0xcd1833['getAgents'](_0x2c4e4d);}})[_0x6ab2('0x29')](function(_0x5a76f2){if(_0x5a76f2){return _0x5a76f2?{'count':_0x54bf7f,'rows':_0x5a76f2}:null;}})[_0x6ab2('0x29')](respondWithResult(_0x51b1d6,null))[_0x6ab2('0x4b')](handleError(_0x51b1d6,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 9eae6f6..d9abd36 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 _0x18a7=['emit','hasOwnProperty','exports','events','../../mysqldb','save','update','remove'];(function(_0x2b2f6c,_0x58e9d1){var _0x44de82=function(_0x4754f1){while(--_0x4754f1){_0x2b2f6c['push'](_0x2b2f6c['shift']());}};_0x44de82(++_0x58e9d1);}(_0x18a7,0x19b));var _0x718a=function(_0x429e44,_0x100f67){_0x429e44=_0x429e44-0x0;var _0x574b2b=_0x18a7[_0x429e44];return _0x574b2b;};'use strict';var EventEmitter=require(_0x718a('0x0'));var OpenchannelQueue=require(_0x718a('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x718a('0x2'),'afterUpdate':_0x718a('0x3'),'afterDestroy':_0x718a('0x4')};function emitEvent(_0x457512){return function(_0x296f63,_0x5d98d2,_0x25a3ce){OpenchannelQueueEvents[_0x718a('0x5')](_0x457512+':'+_0x296f63['id'],_0x296f63);OpenchannelQueueEvents[_0x718a('0x5')](_0x457512,_0x296f63);_0x25a3ce(null);};}for(var e in events){if(events[_0x718a('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x718a('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x4493=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x4493,0x180));var _0x3449=function(_0x58dba0,_0x29e889){_0x58dba0=_0x58dba0-0x0;var _0x220933=_0x4493[_0x58dba0];return _0x220933;};'use strict';var EventEmitter=require(_0x3449('0x0'));var OpenchannelQueue=require(_0x3449('0x1'))['db'][_0x3449('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x3449('0x3')](0x0);var events={'afterCreate':_0x3449('0x4'),'afterUpdate':_0x3449('0x5'),'afterDestroy':_0x3449('0x6')};function emitEvent(_0x3bcbbd){return function(_0x4bb5d2,_0x4f025e,_0x5567a1){OpenchannelQueueEvents[_0x3449('0x7')](_0x3bcbbd+':'+_0x4bb5d2['id'],_0x4bb5d2);OpenchannelQueueEvents[_0x3449('0x7')](_0x3bcbbd,_0x4bb5d2);_0x5567a1(null);};}for(var e in events){if(events[_0x3449('0x8')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x3449('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 629deac..3baf40d 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 _0xfc73=['openchannel_queues','../../config/logger','api','bluebird','request-promise','../../config/environment','./openchannelQueue.attributes','exports','define'];(function(_0x518f3c,_0x2f53ad){var _0x3cd553=function(_0x4c30fd){while(--_0x4c30fd){_0x518f3c['push'](_0x518f3c['shift']());}};_0x3cd553(++_0x2f53ad);}(_0xfc73,0x64));var _0x3fc7=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xfc73[_0x5f3f88];return _0xd08119;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3fc7('0x0'))(_0x3fc7('0x1'));var moment=require('moment');var BPromise=require(_0x3fc7('0x2'));var rp=require(_0x3fc7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3fc7('0x4'));var attributes=require(_0x3fc7('0x5'));module[_0x3fc7('0x6')]=function(_0x228674,_0x191401){return _0x228674[_0x3fc7('0x7')]('OpenchannelQueue',attributes,{'tableName':_0x3fc7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51c6=['openchannel_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define'];(function(_0x2d7d0d,_0x3234db){var _0x375747=function(_0x3517d0){while(--_0x3517d0){_0x2d7d0d['push'](_0x2d7d0d['shift']());}};_0x375747(++_0x3234db);}(_0x51c6,0x199));var _0x651c=function(_0x3f4c63,_0x30bc1e){_0x3f4c63=_0x3f4c63-0x0;var _0x4d4cdd=_0x51c6[_0x3f4c63];return _0x4d4cdd;};'use strict';var _=require(_0x651c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x651c('0x1'));var moment=require(_0x651c('0x2'));var BPromise=require(_0x651c('0x3'));var rp=require(_0x651c('0x4'));var fs=require('fs');var path=require(_0x651c('0x5'));var rimraf=require(_0x651c('0x6'));var config=require(_0x651c('0x7'));var attributes=require(_0x651c('0x8'));module[_0x651c('0x9')]=function(_0x45ce5c,_0x4023d8){return _0x45ce5c[_0x651c('0xa')]('OpenchannelQueue',attributes,{'tableName':_0x651c('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 5fccbba..adeba48 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 _0xef3b=['../../config/environment','jayson/promise','client','http','defaults','redis','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueue','options','raw','where','limit','include','map','attributes','model','GetOpenchannelQueue','ShowOpenchannelQueue','util','randomstring','ioredis','../../config/utils','rpc'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0xef3b,0xd3));var _0xbef3=function(_0x4cc152,_0x3fba8d){_0x4cc152=_0x4cc152-0x0;var _0x16ccee=_0xef3b[_0x4cc152];return _0x16ccee;};'use strict';var _=require('lodash');var util=require(_0xbef3('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbef3('0x1'));var fs=require('fs');var Redis=require(_0xbef3('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xbef3('0x3'));var logger=require('../../config/logger')(_0xbef3('0x4'));var config=require(_0xbef3('0x5'));var jayson=require(_0xbef3('0x6'));var client=jayson[_0xbef3('0x7')][_0xbef3('0x8')]({'port':0x232a});config['redis']=_[_0xbef3('0x9')](config[_0xbef3('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbef3('0xa')]));require(_0xbef3('0xb'))[_0xbef3('0xc')](socket);function respondWithRpcPromise(_0x3c9164,_0x45c84f,_0xa8ddf9){return new BPromise(function(_0x233163,_0x378fae){return client['request'](_0x3c9164,_0xa8ddf9)[_0xbef3('0xd')](function(_0xe0cee){logger[_0xbef3('0xe')](_0xbef3('0xf'),_0x45c84f,_0xbef3('0x10'));logger[_0xbef3('0x11')](_0xbef3('0x12'),_0x45c84f,_0xbef3('0x10'),JSON[_0xbef3('0x13')](_0xe0cee));if(_0xe0cee[_0xbef3('0x14')]){if(_0xe0cee['error'][_0xbef3('0x15')]===0x1f4){logger[_0xbef3('0x14')](_0xbef3('0xf'),_0x45c84f,_0xe0cee['error']['message']);return _0x378fae(_0xe0cee[_0xbef3('0x14')][_0xbef3('0x16')]);}logger[_0xbef3('0x14')](_0xbef3('0xf'),_0x45c84f,_0xe0cee['error'][_0xbef3('0x16')]);return _0x233163(_0xe0cee[_0xbef3('0x14')][_0xbef3('0x16')]);}else{logger[_0xbef3('0xe')](_0xbef3('0xf'),_0x45c84f,_0xbef3('0x10'));_0x233163(_0xe0cee[_0xbef3('0x17')]['message']);}})[_0xbef3('0x18')](function(_0x11bf15){logger[_0xbef3('0x14')](_0xbef3('0xf'),_0x45c84f,_0x11bf15);_0x378fae(_0x11bf15);});});}exports['GetOpenchannelQueue']=function(_0x323cb3){var _0x45cec5=this;return new Promise(function(_0x259535,_0x359465){return db[_0xbef3('0x19')]['findAll']({'raw':_0x323cb3[_0xbef3('0x1a')]?_0x323cb3[_0xbef3('0x1a')][_0xbef3('0x1b')]===undefined?!![]:![]:!![],'where':_0x323cb3['options']?_0x323cb3[_0xbef3('0x1a')][_0xbef3('0x1c')]||null:null,'attributes':_0x323cb3[_0xbef3('0x1a')]?_0x323cb3['options']['attributes']||null:null,'limit':_0x323cb3[_0xbef3('0x1a')]?_0x323cb3[_0xbef3('0x1a')][_0xbef3('0x1d')]||null:null,'include':_0x323cb3['options']?_0x323cb3[_0xbef3('0x1a')][_0xbef3('0x1e')]?_[_0xbef3('0x1f')](_0x323cb3[_0xbef3('0x1a')][_0xbef3('0x1e')],function(_0x1a8c5a){return{'model':db[_0x1a8c5a['model']],'as':_0x1a8c5a['as'],'attributes':_0x1a8c5a[_0xbef3('0x20')],'include':_0x1a8c5a[_0xbef3('0x1e')]?_[_0xbef3('0x1f')](_0x1a8c5a[_0xbef3('0x1e')],function(_0x190c56){return{'model':db[_0x190c56[_0xbef3('0x21')]],'as':_0x190c56['as'],'attributes':_0x190c56[_0xbef3('0x20')],'include':_0x190c56['include']?_[_0xbef3('0x1f')](_0x190c56[_0xbef3('0x1e')],function(_0x29dd90){return{'model':db[_0x29dd90[_0xbef3('0x21')]],'as':_0x29dd90['as'],'attributes':_0x29dd90[_0xbef3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bcb8e){logger[_0xbef3('0xe')]('GetOpenchannelQueue',_0x323cb3);logger[_0xbef3('0x11')](_0xbef3('0x22'),_0x323cb3,JSON[_0xbef3('0x13')](_0x2bcb8e));_0x259535(_0x2bcb8e);})['catch'](function(_0x3c8db3){logger[_0xbef3('0x14')](_0xbef3('0x22'),_0x3c8db3[_0xbef3('0x16')],_0x323cb3);_0x359465(_0x45cec5[_0xbef3('0x14')](0x1f4,_0x3c8db3['message']));});});};exports[_0xbef3('0x23')]=function(_0x5e813e){var _0x5752fd=this;return new Promise(function(_0x337087,_0x1c94f0){return db['OpenchannelQueue']['find']({'raw':_0x5e813e['options']?_0x5e813e[_0xbef3('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5e813e['options']?_0x5e813e[_0xbef3('0x1a')]['where']||null:null,'attributes':_0x5e813e['options']?_0x5e813e[_0xbef3('0x1a')][_0xbef3('0x20')]||null:null,'include':_0x5e813e['options']?_0x5e813e[_0xbef3('0x1a')]['include']?_[_0xbef3('0x1f')](_0x5e813e['options'][_0xbef3('0x1e')],function(_0x1bcbdd){return{'model':db[_0x1bcbdd['model']],'as':_0x1bcbdd['as'],'attributes':_0x1bcbdd[_0xbef3('0x20')],'include':_0x1bcbdd[_0xbef3('0x1e')]?_[_0xbef3('0x1f')](_0x1bcbdd[_0xbef3('0x1e')],function(_0x1ed962){return{'model':db[_0x1ed962[_0xbef3('0x21')]],'as':_0x1ed962['as'],'attributes':_0x1ed962[_0xbef3('0x20')],'include':_0x1ed962['include']?_[_0xbef3('0x1f')](_0x1ed962[_0xbef3('0x1e')],function(_0x23da63){return{'model':db[_0x23da63[_0xbef3('0x21')]],'as':_0x23da63['as'],'attributes':_0x23da63[_0xbef3('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbef3('0xd')](function(_0x21977b){logger[_0xbef3('0xe')](_0xbef3('0x23'),_0x5e813e);logger[_0xbef3('0x11')](_0xbef3('0x23'),_0x5e813e,JSON[_0xbef3('0x13')](_0x21977b));_0x337087(_0x21977b);})[_0xbef3('0x18')](function(_0x393394){logger['error'](_0xbef3('0x23'),_0x393394['message'],_0x5e813e);_0x1c94f0(_0x5752fd['error'](0x1f4,_0x393394['message']));});});}; \ No newline at end of file +var _0xa188=['./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','limit','include','map','model','ShowOpenchannelQueue','util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x3dd991,_0x4bef12){var _0x251609=function(_0x371481){while(--_0x371481){_0x3dd991['push'](_0x3dd991['shift']());}};_0x251609(++_0x4bef12);}(_0xa188,0xf7));var _0x8a18=function(_0x528c24,_0x5a276b){_0x528c24=_0x528c24-0x0;var _0x8383bc=_0xa188[_0x528c24];return _0x8383bc;};'use strict';var _=require('lodash');var util=require(_0x8a18('0x0'));var moment=require(_0x8a18('0x1'));var BPromise=require('bluebird');var rs=require(_0x8a18('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8a18('0x3'));var logger=require(_0x8a18('0x4'))(_0x8a18('0x5'));var config=require('../../config/environment');var jayson=require(_0x8a18('0x6'));var client=jayson[_0x8a18('0x7')][_0x8a18('0x8')]({'port':0x232a});config[_0x8a18('0x9')]=_['defaults'](config['redis'],{'host':_0x8a18('0xa'),'port':0x18eb});var socket=require(_0x8a18('0xb'))(new Redis(config[_0x8a18('0x9')]));require(_0x8a18('0xc'))[_0x8a18('0xd')](socket);function respondWithRpcPromise(_0xb5279a,_0x30b630,_0x2ada20){return new BPromise(function(_0x3f6033,_0x2b82f3){return client[_0x8a18('0xe')](_0xb5279a,_0x2ada20)[_0x8a18('0xf')](function(_0x4e125a){logger[_0x8a18('0x10')](_0x8a18('0x11'),_0x30b630,_0x8a18('0x12'));logger[_0x8a18('0x13')](_0x8a18('0x14'),_0x30b630,_0x8a18('0x12'),JSON[_0x8a18('0x15')](_0x4e125a));if(_0x4e125a[_0x8a18('0x16')]){if(_0x4e125a[_0x8a18('0x16')]['code']===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x30b630,_0x4e125a[_0x8a18('0x16')][_0x8a18('0x17')]);return _0x2b82f3(_0x4e125a[_0x8a18('0x16')]['message']);}logger[_0x8a18('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x30b630,_0x4e125a[_0x8a18('0x16')][_0x8a18('0x17')]);return _0x3f6033(_0x4e125a[_0x8a18('0x16')][_0x8a18('0x17')]);}else{logger[_0x8a18('0x10')](_0x8a18('0x11'),_0x30b630,'request\x20sent');_0x3f6033(_0x4e125a[_0x8a18('0x18')][_0x8a18('0x17')]);}})[_0x8a18('0x19')](function(_0x4e54c0){logger[_0x8a18('0x16')](_0x8a18('0x11'),_0x30b630,_0x4e54c0);_0x2b82f3(_0x4e54c0);});});}exports[_0x8a18('0x1a')]=function(_0x2ae02b){var _0x8fb322=this;return new Promise(function(_0x91356,_0x45a83f){return db[_0x8a18('0x1b')]['findAll']({'raw':_0x2ae02b[_0x8a18('0x1c')]?_0x2ae02b[_0x8a18('0x1c')][_0x8a18('0x1d')]===undefined?!![]:![]:!![],'where':_0x2ae02b[_0x8a18('0x1c')]?_0x2ae02b[_0x8a18('0x1c')][_0x8a18('0x1e')]||null:null,'attributes':_0x2ae02b[_0x8a18('0x1c')]?_0x2ae02b[_0x8a18('0x1c')][_0x8a18('0x1f')]||null:null,'limit':_0x2ae02b['options']?_0x2ae02b[_0x8a18('0x1c')][_0x8a18('0x20')]||null:null,'include':_0x2ae02b[_0x8a18('0x1c')]?_0x2ae02b[_0x8a18('0x1c')][_0x8a18('0x21')]?_[_0x8a18('0x22')](_0x2ae02b[_0x8a18('0x1c')]['include'],function(_0x964eb0){return{'model':db[_0x964eb0[_0x8a18('0x23')]],'as':_0x964eb0['as'],'attributes':_0x964eb0[_0x8a18('0x1f')],'include':_0x964eb0[_0x8a18('0x21')]?_[_0x8a18('0x22')](_0x964eb0['include'],function(_0x163d52){return{'model':db[_0x163d52[_0x8a18('0x23')]],'as':_0x163d52['as'],'attributes':_0x163d52[_0x8a18('0x1f')],'include':_0x163d52[_0x8a18('0x21')]?_[_0x8a18('0x22')](_0x163d52[_0x8a18('0x21')],function(_0x21283c){return{'model':db[_0x21283c[_0x8a18('0x23')]],'as':_0x21283c['as'],'attributes':_0x21283c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d3a8d){logger['info'](_0x8a18('0x1a'),_0x2ae02b);logger['debug'](_0x8a18('0x1a'),_0x2ae02b,JSON[_0x8a18('0x15')](_0x1d3a8d));_0x91356(_0x1d3a8d);})[_0x8a18('0x19')](function(_0x469fe7){logger[_0x8a18('0x16')]('GetOpenchannelQueue',_0x469fe7[_0x8a18('0x17')],_0x2ae02b);_0x45a83f(_0x8fb322[_0x8a18('0x16')](0x1f4,_0x469fe7[_0x8a18('0x17')]));});});};exports[_0x8a18('0x24')]=function(_0x5f3fa1){var _0x517793=this;return new Promise(function(_0x2434f2,_0x456bd5){return db[_0x8a18('0x1b')]['find']({'raw':_0x5f3fa1['options']?_0x5f3fa1['options'][_0x8a18('0x1d')]===undefined?!![]:![]:!![],'where':_0x5f3fa1['options']?_0x5f3fa1[_0x8a18('0x1c')][_0x8a18('0x1e')]||null:null,'attributes':_0x5f3fa1['options']?_0x5f3fa1[_0x8a18('0x1c')][_0x8a18('0x1f')]||null:null,'include':_0x5f3fa1[_0x8a18('0x1c')]?_0x5f3fa1[_0x8a18('0x1c')][_0x8a18('0x21')]?_[_0x8a18('0x22')](_0x5f3fa1[_0x8a18('0x1c')][_0x8a18('0x21')],function(_0x32a6e3){return{'model':db[_0x32a6e3['model']],'as':_0x32a6e3['as'],'attributes':_0x32a6e3[_0x8a18('0x1f')],'include':_0x32a6e3[_0x8a18('0x21')]?_[_0x8a18('0x22')](_0x32a6e3[_0x8a18('0x21')],function(_0x182590){return{'model':db[_0x182590['model']],'as':_0x182590['as'],'attributes':_0x182590[_0x8a18('0x1f')],'include':_0x182590[_0x8a18('0x21')]?_[_0x8a18('0x22')](_0x182590[_0x8a18('0x21')],function(_0x1bfe55){return{'model':db[_0x1bfe55[_0x8a18('0x23')]],'as':_0x1bfe55['as'],'attributes':_0x1bfe55[_0x8a18('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8a18('0xf')](function(_0x7419d0){logger[_0x8a18('0x10')](_0x8a18('0x24'),_0x5f3fa1);logger[_0x8a18('0x13')](_0x8a18('0x24'),_0x5f3fa1,JSON[_0x8a18('0x15')](_0x7419d0));_0x2434f2(_0x7419d0);})[_0x8a18('0x19')](function(_0x1de31f){logger[_0x8a18('0x16')](_0x8a18('0x24'),_0x1de31f[_0x8a18('0x17')],_0x5f3fa1);_0x456bd5(_0x517793[_0x8a18('0x16')](0x1f4,_0x1de31f[_0x8a18('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index aea0600..4bc6faa 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 _0x90da=['emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x4dcf3a,_0xa0d121){var _0x31cc5f=function(_0x4d2b32){while(--_0x4d2b32){_0x4dcf3a['push'](_0x4dcf3a['shift']());}};_0x31cc5f(++_0xa0d121);}(_0x90da,0x17d));var _0xa90d=function(_0x351056,_0x4a65fa){_0x351056=_0x351056-0x0;var _0x236a39=_0x90da[_0x351056];return _0x236a39;};'use strict';var OpenchannelQueueEvents=require(_0xa90d('0x0'));var events=[_0xa90d('0x1'),_0xa90d('0x2'),'update'];function createListener(_0x2bd3f0,_0x56fa8c){return function(_0x132852){_0x56fa8c[_0xa90d('0x3')](_0x2bd3f0,_0x132852);};}function removeListener(_0x2860b5,_0x6490a4){return function(){OpenchannelQueueEvents[_0xa90d('0x4')](_0x2860b5,_0x6490a4);};}exports[_0xa90d('0x5')]=function(_0x329d45){for(var _0x2bdab9=0x0,_0x1c3d8d=events[_0xa90d('0x6')];_0x2bdab9<_0x1c3d8d;_0x2bdab9++){var _0x70dc6a=events[_0x2bdab9];var _0x3e655b=createListener(_0xa90d('0x7')+_0x70dc6a,_0x329d45);OpenchannelQueueEvents['on'](_0x70dc6a,_0x3e655b);}}; \ No newline at end of file +var _0x2a14=['remove','update','emit','removeListener','register','length','./openchannelQueue.events'];(function(_0x3d16b1,_0x175145){var _0x801218=function(_0x2b0db1){while(--_0x2b0db1){_0x3d16b1['push'](_0x3d16b1['shift']());}};_0x801218(++_0x175145);}(_0x2a14,0xa0));var _0x42a1=function(_0x4e01a4,_0x560291){_0x4e01a4=_0x4e01a4-0x0;var _0x1ccc80=_0x2a14[_0x4e01a4];return _0x1ccc80;};'use strict';var OpenchannelQueueEvents=require(_0x42a1('0x0'));var events=['save',_0x42a1('0x1'),_0x42a1('0x2')];function createListener(_0x1572ce,_0x154851){return function(_0x548500){_0x154851[_0x42a1('0x3')](_0x1572ce,_0x548500);};}function removeListener(_0x322a31,_0x1bff8f){return function(){OpenchannelQueueEvents[_0x42a1('0x4')](_0x322a31,_0x1bff8f);};}exports[_0x42a1('0x5')]=function(_0x31e5e7){for(var _0x5b3dee=0x0,_0x3ddab9=events[_0x42a1('0x6')];_0x5b3dee<_0x3ddab9;_0x5b3dee++){var _0x834622=events[_0x5b3dee];var _0x2c6cc7=createListener('openchannelQueue:'+_0x834622,_0x31e5e7);OpenchannelQueueEvents['on'](_0x834622,_0x2c6cc7);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 256767a..d765e7f 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 _0xa0aa=['show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','describe','/:id'];(function(_0x2838f7,_0x5d9f31){var _0x21e219=function(_0x1dbf8c){while(--_0x1dbf8c){_0x2838f7['push'](_0x2838f7['shift']());}};_0x21e219(++_0x5d9f31);}(_0xa0aa,0x78));var _0xaa0a=function(_0x11af1a,_0x5cbea2){_0x11af1a=_0x11af1a-0x0;var _0x2c0735=_0xa0aa[_0x11af1a];return _0x2c0735;};'use strict';var multer=require(_0xaa0a('0x0'));var util=require(_0xaa0a('0x1'));var path=require(_0xaa0a('0x2'));var timeout=require(_0xaa0a('0x3'));var express=require(_0xaa0a('0x4'));var router=express[_0xaa0a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xaa0a('0x6'));var interaction=require(_0xaa0a('0x7'));var config=require('../../config/environment');var controller=require(_0xaa0a('0x8'));router[_0xaa0a('0x9')]('/',auth[_0xaa0a('0xa')](),controller['index']);router[_0xaa0a('0x9')]('/describe',auth[_0xaa0a('0xa')](),controller[_0xaa0a('0xb')]);router[_0xaa0a('0x9')](_0xaa0a('0xc'),auth[_0xaa0a('0xa')](),controller[_0xaa0a('0xd')]);router['post']('/',auth[_0xaa0a('0xa')](),controller[_0xaa0a('0xe')]);router[_0xaa0a('0xf')](_0xaa0a('0xc'),auth['isAuthenticated'](),controller[_0xaa0a('0x10')]);router[_0xaa0a('0x11')](_0xaa0a('0xc'),auth[_0xaa0a('0xa')](),controller['destroy']);module[_0xaa0a('0x12')]=router; \ No newline at end of file +var _0xc8a3=['post','create','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','index','get','isAuthenticated','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc8a3,0xa9));var _0x3c8a=function(_0x10a473,_0x2240d0){_0x10a473=_0x10a473-0x0;var _0x4079ea=_0xc8a3[_0x10a473];return _0x4079ea;};'use strict';var multer=require(_0x3c8a('0x0'));var util=require(_0x3c8a('0x1'));var path=require(_0x3c8a('0x2'));var timeout=require('connect-timeout');var express=require(_0x3c8a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3c8a('0x4'));var interaction=require(_0x3c8a('0x5'));var config=require('../../config/environment');var controller=require(_0x3c8a('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x3c8a('0x7')]);router[_0x3c8a('0x8')]('/describe',auth[_0x3c8a('0x9')](),controller['describe']);router[_0x3c8a('0x8')](_0x3c8a('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x3c8a('0xb')]('/',auth[_0x3c8a('0x9')](),controller[_0x3c8a('0xc')]);router[_0x3c8a('0xd')](_0x3c8a('0xa'),auth[_0x3c8a('0x9')](),controller[_0x3c8a('0xe')]);router[_0x3c8a('0xf')](_0x3c8a('0xa'),auth[_0x3c8a('0x9')](),controller[_0x3c8a('0x10')]);module[_0x3c8a('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index c87e185..c289118 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 _0x799d=['DATE','sequelize','exports','STRING'];(function(_0x29dc54,_0x2cc32e){var _0xaabea6=function(_0x172357){while(--_0x172357){_0x29dc54['push'](_0x29dc54['shift']());}};_0xaabea6(++_0x2cc32e);}(_0x799d,0x16d));var _0xd799=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x799d[_0x3e5086];return _0xfeb102;};'use strict';var moment=require('moment');var Sequelize=require(_0xd799('0x0'));module[_0xd799('0x1')]={'uniqueid':{'type':Sequelize[_0xd799('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd799('0x2')]},'joinAt':{'type':Sequelize[_0xd799('0x3')]},'leaveAt':{'type':Sequelize[_0xd799('0x3')]},'acceptAt':{'type':Sequelize[_0xd799('0x3')]},'exitAt':{'type':Sequelize[_0xd799('0x3')]},'reason':{'type':Sequelize[_0xd799('0x2')]}}; \ No newline at end of file +var _0x579b=['STRING','DATE','sequelize'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x579b,0xbc));var _0xb579=function(_0x1b4c04,_0x8d961d){_0x1b4c04=_0x1b4c04-0x0;var _0x374f5d=_0x579b[_0x1b4c04];return _0x374f5d;};'use strict';var moment=require('moment');var Sequelize=require(_0xb579('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb579('0x1')]},'joinAt':{'type':Sequelize[_0xb579('0x2')]},'leaveAt':{'type':Sequelize[_0xb579('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xb579('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 13f6bcb..769b6ce 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 _0x39ad=['zip-dir','fast-json-patch','request-promise','moment','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','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','length','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','params','fields','find','catch','create','body','destroy','describe','eml-format','rimraf'];(function(_0x106ee8,_0xbc1c59){var _0xad24e4=function(_0x4f1cfb){while(--_0x4f1cfb){_0x106ee8['push'](_0x106ee8['shift']());}};_0xad24e4(++_0xbc1c59);}(_0x39ad,0xe8));var _0xd39a=function(_0x1c2eb1,_0x2fab8f){_0x1c2eb1=_0x1c2eb1-0x0;var _0x3b3e63=_0x39ad[_0x1c2eb1];return _0x3b3e63;};'use strict';var emlformat=require(_0xd39a('0x0'));var rimraf=require(_0xd39a('0x1'));var zipdir=require(_0xd39a('0x2'));var jsonpatch=require(_0xd39a('0x3'));var rp=require(_0xd39a('0x4'));var moment=require(_0xd39a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd39a('0x6'));var path=require(_0xd39a('0x7'));var sox=require(_0xd39a('0x8'));var csv=require(_0xd39a('0x9'));var ejs=require(_0xd39a('0xa'));var fs=require('fs');var fs_extra=require(_0xd39a('0xb'));var _=require(_0xd39a('0xc'));var squel=require(_0xd39a('0xd'));var crypto=require(_0xd39a('0xe'));var jsforce=require(_0xd39a('0xf'));var deskjs=require(_0xd39a('0x10'));var toCsv=require('to-csv');var querystring=require(_0xd39a('0x11'));var Papa=require('papaparse');var Redis=require(_0xd39a('0x12'));var authService=require(_0xd39a('0x13'));var qs=require(_0xd39a('0x14'));var as=require(_0xd39a('0x15'));var hardwareService=require(_0xd39a('0x16'));var logger=require(_0xd39a('0x17'))(_0xd39a('0x18'));var utils=require(_0xd39a('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xd39a('0x1a'));var db=require(_0xd39a('0x1b'))['db'];function respondWithStatusCode(_0x52d653,_0x238ee5){_0x238ee5=_0x238ee5||0xcc;return function(_0xe7c973){if(_0xe7c973){return _0x52d653[_0xd39a('0x1c')](_0x238ee5);}return _0x52d653['status'](_0x238ee5)[_0xd39a('0x1d')]();};}function respondWithResult(_0x4dc0dc,_0x210235){_0x210235=_0x210235||0xc8;return function(_0x558b6f){if(_0x558b6f){return _0x4dc0dc[_0xd39a('0x1e')](_0x210235)[_0xd39a('0x1f')](_0x558b6f);}};}function respondWithFilteredResult(_0x5e121f,_0x65cfd4){return function(_0x1e40c9){if(_0x1e40c9){var _0x21f416=typeof _0x65cfd4[_0xd39a('0x20')]===_0xd39a('0x21')&&typeof _0x65cfd4[_0xd39a('0x22')]===_0xd39a('0x21');var _0x344b5b=_0x1e40c9[_0xd39a('0x23')];var _0x2876d9=_0x21f416?0x0:_0x65cfd4[_0xd39a('0x20')];var _0x549a15=_0x21f416?_0x1e40c9[_0xd39a('0x23')]:_0x65cfd4[_0xd39a('0x20')]+_0x65cfd4[_0xd39a('0x22')];var _0x2b02cb;if(_0x549a15>=_0x344b5b){_0x549a15=_0x344b5b;_0x2b02cb=0xc8;}else{_0x2b02cb=0xce;}_0x5e121f[_0xd39a('0x1e')](_0x2b02cb);return _0x5e121f[_0xd39a('0x24')]('Content-Range',_0x2876d9+'-'+_0x549a15+'/'+_0x344b5b)[_0xd39a('0x1f')](_0x1e40c9);}return null;};}function patchUpdates(_0x34f403){return function(_0x30f7bb){try{jsonpatch[_0xd39a('0x25')](_0x30f7bb,_0x34f403,!![]);}catch(_0xd5f305){return BPromise[_0xd39a('0x26')](_0xd5f305);}return _0x30f7bb['save']();};}function saveUpdates(_0x157811,_0x46fb69){return function(_0x3443ed){if(_0x3443ed){return _0x3443ed[_0xd39a('0x27')](_0x157811)[_0xd39a('0x28')](function(_0x363960){return _0x363960;});}return null;};}function removeEntity(_0x44dad4,_0x46a888){return function(_0x13101e){if(_0x13101e){return _0x13101e['destroy']()['then'](function(){_0x44dad4[_0xd39a('0x1e')](0xcc)[_0xd39a('0x1d')]();});}};}function handleEntityNotFound(_0x2db221,_0x40d586){return function(_0x4dc9b5){if(!_0x4dc9b5){_0x2db221[_0xd39a('0x1c')](0x194);}return _0x4dc9b5;};}function handleError(_0x1a17a6,_0x2e2505){_0x2e2505=_0x2e2505||0x1f4;return function(_0x285eca){logger[_0xd39a('0x29')](_0x285eca[_0xd39a('0x2a')]);if(_0x285eca[_0xd39a('0x2b')]){delete _0x285eca['name'];}_0x1a17a6[_0xd39a('0x1e')](_0x2e2505)[_0xd39a('0x2c')](_0x285eca);};}exports[_0xd39a('0x2d')]=function(_0x14e516,_0x2cc727){var _0x3d52e6={},_0x2a31d6={},_0x23c0f9={'count':0x0,'rows':[]};var _0x9b6f0b=_[_0xd39a('0x2e')](db[_0xd39a('0x2f')][_0xd39a('0x30')],function(_0x274f7e){return{'name':_0x274f7e[_0xd39a('0x31')],'type':_0x274f7e['type']['key']};});_0x2a31d6[_0xd39a('0x32')]=_['map'](_0x9b6f0b,'name');_0x2a31d6[_0xd39a('0x33')]=_[_0xd39a('0x34')](_0x14e516[_0xd39a('0x33')]);_0x2a31d6[_0xd39a('0x35')]=_['intersection'](_0x2a31d6[_0xd39a('0x32')],_0x2a31d6['query']);_0x3d52e6[_0xd39a('0x36')]=_[_0xd39a('0x37')](_0x2a31d6[_0xd39a('0x32')],qs['fields'](_0x14e516[_0xd39a('0x33')]['fields']));_0x3d52e6[_0xd39a('0x36')]=_0x3d52e6[_0xd39a('0x36')][_0xd39a('0x38')]?_0x3d52e6[_0xd39a('0x36')]:_0x2a31d6['model'];if(!_0x14e516[_0xd39a('0x33')]['hasOwnProperty']('nolimit')){_0x3d52e6[_0xd39a('0x22')]=qs['limit'](_0x14e516[_0xd39a('0x33')]['limit']);_0x3d52e6['offset']=qs[_0xd39a('0x20')](_0x14e516[_0xd39a('0x33')][_0xd39a('0x20')]);}_0x3d52e6[_0xd39a('0x39')]=qs[_0xd39a('0x3a')](_0x14e516[_0xd39a('0x33')][_0xd39a('0x3a')]);_0x3d52e6[_0xd39a('0x3b')]=qs[_0xd39a('0x35')](_[_0xd39a('0x3c')](_0x14e516[_0xd39a('0x33')],_0x2a31d6[_0xd39a('0x35')]),_0x9b6f0b);if(_0x14e516[_0xd39a('0x33')][_0xd39a('0x3d')]){_0x3d52e6[_0xd39a('0x3b')]=_[_0xd39a('0x3e')](_0x3d52e6[_0xd39a('0x3b')],{'$or':_['map'](_0x9b6f0b,function(_0x4ec5f7){if(_0x4ec5f7[_0xd39a('0x3f')]!=='VIRTUAL'){var _0x56234a={};_0x56234a[_0x4ec5f7['name']]={'$like':'%'+_0x14e516[_0xd39a('0x33')][_0xd39a('0x3d')]+'%'};return _0x56234a;}})});}_0x3d52e6=_[_0xd39a('0x3e')]({},_0x3d52e6,_0x14e516[_0xd39a('0x40')]);var _0x363a45={'where':_0x3d52e6[_0xd39a('0x3b')]};return db['OpenchannelQueueReport']['count'](_0x363a45)[_0xd39a('0x28')](function(_0x1e98b8){_0x23c0f9[_0xd39a('0x23')]=_0x1e98b8;if(_0x14e516[_0xd39a('0x33')][_0xd39a('0x41')]){_0x3d52e6[_0xd39a('0x42')]=[{'all':!![]}];}return db[_0xd39a('0x2f')][_0xd39a('0x43')](_0x3d52e6);})[_0xd39a('0x28')](function(_0x39e609){_0x23c0f9[_0xd39a('0x44')]=_0x39e609;return _0x23c0f9;})[_0xd39a('0x28')](respondWithFilteredResult(_0x2cc727,_0x3d52e6))['catch'](handleError(_0x2cc727,null));};exports[_0xd39a('0x45')]=function(_0x1c4f27,_0x4192d9){var _0x262426={'raw':!![],'where':{'id':_0x1c4f27[_0xd39a('0x46')]['id']}},_0x2957de={};_0x2957de[_0xd39a('0x32')]=_[_0xd39a('0x34')](db[_0xd39a('0x2f')][_0xd39a('0x30')]);_0x2957de[_0xd39a('0x33')]=_[_0xd39a('0x34')](_0x1c4f27[_0xd39a('0x33')]);_0x2957de['filters']=_[_0xd39a('0x37')](_0x2957de[_0xd39a('0x32')],_0x2957de[_0xd39a('0x33')]);_0x262426['attributes']=_[_0xd39a('0x37')](_0x2957de[_0xd39a('0x32')],qs[_0xd39a('0x47')](_0x1c4f27['query']['fields']));_0x262426[_0xd39a('0x36')]=_0x262426[_0xd39a('0x36')][_0xd39a('0x38')]?_0x262426[_0xd39a('0x36')]:_0x2957de[_0xd39a('0x32')];if(_0x1c4f27[_0xd39a('0x33')][_0xd39a('0x41')]){_0x262426[_0xd39a('0x42')]=[{'all':!![]}];}_0x262426=_[_0xd39a('0x3e')]({},_0x262426,_0x1c4f27[_0xd39a('0x40')]);return db[_0xd39a('0x2f')][_0xd39a('0x48')](_0x262426)[_0xd39a('0x28')](handleEntityNotFound(_0x4192d9,null))[_0xd39a('0x28')](respondWithResult(_0x4192d9,null))[_0xd39a('0x49')](handleError(_0x4192d9,null));};exports['create']=function(_0x3e7600,_0x2f939d){return db[_0xd39a('0x2f')][_0xd39a('0x4a')](_0x3e7600[_0xd39a('0x4b')],{})[_0xd39a('0x28')](respondWithResult(_0x2f939d,0xc9))[_0xd39a('0x49')](handleError(_0x2f939d,null));};exports[_0xd39a('0x27')]=function(_0x569cec,_0x4d8d48){if(_0x569cec[_0xd39a('0x4b')]['id']){delete _0x569cec['body']['id'];}return db[_0xd39a('0x2f')][_0xd39a('0x48')]({'where':{'id':_0x569cec[_0xd39a('0x46')]['id']}})['then'](handleEntityNotFound(_0x4d8d48,null))[_0xd39a('0x28')](saveUpdates(_0x569cec[_0xd39a('0x4b')],null))[_0xd39a('0x28')](respondWithResult(_0x4d8d48,null))[_0xd39a('0x49')](handleError(_0x4d8d48,null));};exports[_0xd39a('0x4c')]=function(_0x36df59,_0x4cdbc7){return db[_0xd39a('0x2f')][_0xd39a('0x48')]({'where':{'id':_0x36df59['params']['id']}})[_0xd39a('0x28')](handleEntityNotFound(_0x4cdbc7,null))['then'](removeEntity(_0x4cdbc7,null))[_0xd39a('0x49')](handleError(_0x4cdbc7,null));};exports['describe']=function(_0x59d303,_0x6384c1){return db[_0xd39a('0x2f')][_0xd39a('0x4d')]()['then'](respondWithResult(_0x6384c1,null))['catch'](handleError(_0x6384c1,null));}; \ No newline at end of file +var _0xc322=['reject','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','OpenchannelQueueReport','findAll','rows','catch','show','keys','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xc322,0x1e0));var _0x2c32=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xc322[_0x2d8fc2];return _0x3a9e53;};'use strict';var emlformat=require(_0x2c32('0x0'));var rimraf=require(_0x2c32('0x1'));var zipdir=require(_0x2c32('0x2'));var jsonpatch=require(_0x2c32('0x3'));var rp=require('request-promise');var moment=require(_0x2c32('0x4'));var BPromise=require(_0x2c32('0x5'));var Mustache=require(_0x2c32('0x6'));var util=require(_0x2c32('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c32('0x8'));var squel=require(_0x2c32('0x9'));var crypto=require(_0x2c32('0xa'));var jsforce=require(_0x2c32('0xb'));var deskjs=require(_0x2c32('0xc'));var toCsv=require(_0x2c32('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2c32('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2c32('0xf'));var hardwareService=require(_0x2c32('0x10'));var logger=require(_0x2c32('0x11'))(_0x2c32('0x12'));var utils=require(_0x2c32('0x13'));var config=require(_0x2c32('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2c32('0x15'))['db'];function respondWithStatusCode(_0x127d5c,_0x9725c5){_0x9725c5=_0x9725c5||0xcc;return function(_0x3b7750){if(_0x3b7750){return _0x127d5c['sendStatus'](_0x9725c5);}return _0x127d5c[_0x2c32('0x16')](_0x9725c5)[_0x2c32('0x17')]();};}function respondWithResult(_0x3c141e,_0x166cd5){_0x166cd5=_0x166cd5||0xc8;return function(_0x455d6c){if(_0x455d6c){return _0x3c141e['status'](_0x166cd5)[_0x2c32('0x18')](_0x455d6c);}};}function respondWithFilteredResult(_0x512786,_0x1c24d0){return function(_0x1f0ff4){if(_0x1f0ff4){var _0x32a23c=typeof _0x1c24d0[_0x2c32('0x19')]===_0x2c32('0x1a')&&typeof _0x1c24d0[_0x2c32('0x1b')]===_0x2c32('0x1a');var _0x126226=_0x1f0ff4[_0x2c32('0x1c')];var _0x1079cd=_0x32a23c?0x0:_0x1c24d0['offset'];var _0x4636ec=_0x32a23c?_0x1f0ff4[_0x2c32('0x1c')]:_0x1c24d0[_0x2c32('0x19')]+_0x1c24d0[_0x2c32('0x1b')];var _0x162a8e;if(_0x4636ec>=_0x126226){_0x4636ec=_0x126226;_0x162a8e=0xc8;}else{_0x162a8e=0xce;}_0x512786[_0x2c32('0x16')](_0x162a8e);return _0x512786[_0x2c32('0x1d')](_0x2c32('0x1e'),_0x1079cd+'-'+_0x4636ec+'/'+_0x126226)[_0x2c32('0x18')](_0x1f0ff4);}return null;};}function patchUpdates(_0xdf8961){return function(_0x6dd4d1){try{jsonpatch['apply'](_0x6dd4d1,_0xdf8961,!![]);}catch(_0x4ec8a5){return BPromise[_0x2c32('0x1f')](_0x4ec8a5);}return _0x6dd4d1['save']();};}function saveUpdates(_0x1fc946,_0x3a65fe){return function(_0x438be){if(_0x438be){return _0x438be[_0x2c32('0x20')](_0x1fc946)[_0x2c32('0x21')](function(_0x5d011d){return _0x5d011d;});}return null;};}function removeEntity(_0x4c4c58,_0x427202){return function(_0x1c4b9f){if(_0x1c4b9f){return _0x1c4b9f[_0x2c32('0x22')]()[_0x2c32('0x21')](function(){_0x4c4c58['status'](0xcc)[_0x2c32('0x17')]();});}};}function handleEntityNotFound(_0x25794d,_0x5074f2){return function(_0x1626dd){if(!_0x1626dd){_0x25794d[_0x2c32('0x23')](0x194);}return _0x1626dd;};}function handleError(_0x2859a0,_0x3e9fb6){_0x3e9fb6=_0x3e9fb6||0x1f4;return function(_0x32a865){logger['error'](_0x32a865[_0x2c32('0x24')]);if(_0x32a865[_0x2c32('0x25')]){delete _0x32a865['name'];}_0x2859a0[_0x2c32('0x16')](_0x3e9fb6)[_0x2c32('0x26')](_0x32a865);};}exports[_0x2c32('0x27')]=function(_0x1baea9,_0x4f1735){var _0x1bd6f8={},_0x83c295={},_0x5c34c2={'count':0x0,'rows':[]};var _0x3611b3=_[_0x2c32('0x28')](db['OpenchannelQueueReport'][_0x2c32('0x29')],function(_0x55a81a){return{'name':_0x55a81a[_0x2c32('0x2a')],'type':_0x55a81a[_0x2c32('0x2b')][_0x2c32('0x2c')]};});_0x83c295[_0x2c32('0x2d')]=_['map'](_0x3611b3,_0x2c32('0x25'));_0x83c295[_0x2c32('0x2e')]=_['keys'](_0x1baea9['query']);_0x83c295[_0x2c32('0x2f')]=_['intersection'](_0x83c295['model'],_0x83c295[_0x2c32('0x2e')]);_0x1bd6f8[_0x2c32('0x30')]=_[_0x2c32('0x31')](_0x83c295[_0x2c32('0x2d')],qs[_0x2c32('0x32')](_0x1baea9['query']['fields']));_0x1bd6f8[_0x2c32('0x30')]=_0x1bd6f8[_0x2c32('0x30')][_0x2c32('0x33')]?_0x1bd6f8[_0x2c32('0x30')]:_0x83c295[_0x2c32('0x2d')];if(!_0x1baea9['query']['hasOwnProperty'](_0x2c32('0x34'))){_0x1bd6f8[_0x2c32('0x1b')]=qs['limit'](_0x1baea9[_0x2c32('0x2e')][_0x2c32('0x1b')]);_0x1bd6f8[_0x2c32('0x19')]=qs[_0x2c32('0x19')](_0x1baea9['query'][_0x2c32('0x19')]);}_0x1bd6f8[_0x2c32('0x35')]=qs[_0x2c32('0x36')](_0x1baea9[_0x2c32('0x2e')][_0x2c32('0x36')]);_0x1bd6f8[_0x2c32('0x37')]=qs[_0x2c32('0x2f')](_[_0x2c32('0x38')](_0x1baea9[_0x2c32('0x2e')],_0x83c295[_0x2c32('0x2f')]),_0x3611b3);if(_0x1baea9['query']['filter']){_0x1bd6f8[_0x2c32('0x37')]=_[_0x2c32('0x39')](_0x1bd6f8[_0x2c32('0x37')],{'$or':_[_0x2c32('0x28')](_0x3611b3,function(_0x5ab5b5){if(_0x5ab5b5[_0x2c32('0x2b')]!==_0x2c32('0x3a')){var _0x5f0d48={};_0x5f0d48[_0x5ab5b5[_0x2c32('0x25')]]={'$like':'%'+_0x1baea9[_0x2c32('0x2e')][_0x2c32('0x3b')]+'%'};return _0x5f0d48;}})});}_0x1bd6f8=_['merge']({},_0x1bd6f8,_0x1baea9[_0x2c32('0x3c')]);var _0x5bb2f8={'where':_0x1bd6f8['where']};return db['OpenchannelQueueReport']['count'](_0x5bb2f8)[_0x2c32('0x21')](function(_0x2ff8c8){_0x5c34c2[_0x2c32('0x1c')]=_0x2ff8c8;if(_0x1baea9[_0x2c32('0x2e')][_0x2c32('0x3d')]){_0x1bd6f8['include']=[{'all':!![]}];}return db[_0x2c32('0x3e')][_0x2c32('0x3f')](_0x1bd6f8);})[_0x2c32('0x21')](function(_0x5984f7){_0x5c34c2[_0x2c32('0x40')]=_0x5984f7;return _0x5c34c2;})[_0x2c32('0x21')](respondWithFilteredResult(_0x4f1735,_0x1bd6f8))[_0x2c32('0x41')](handleError(_0x4f1735,null));};exports[_0x2c32('0x42')]=function(_0x8b1ebe,_0x30cca3){var _0xd8972={'raw':!![],'where':{'id':_0x8b1ebe['params']['id']}},_0x5dc259={};_0x5dc259[_0x2c32('0x2d')]=_[_0x2c32('0x43')](db['OpenchannelQueueReport'][_0x2c32('0x29')]);_0x5dc259[_0x2c32('0x2e')]=_[_0x2c32('0x43')](_0x8b1ebe[_0x2c32('0x2e')]);_0x5dc259['filters']=_[_0x2c32('0x31')](_0x5dc259[_0x2c32('0x2d')],_0x5dc259[_0x2c32('0x2e')]);_0xd8972[_0x2c32('0x30')]=_[_0x2c32('0x31')](_0x5dc259[_0x2c32('0x2d')],qs['fields'](_0x8b1ebe[_0x2c32('0x2e')][_0x2c32('0x32')]));_0xd8972[_0x2c32('0x30')]=_0xd8972['attributes'][_0x2c32('0x33')]?_0xd8972[_0x2c32('0x30')]:_0x5dc259['model'];if(_0x8b1ebe['query']['includeAll']){_0xd8972['include']=[{'all':!![]}];}_0xd8972=_[_0x2c32('0x39')]({},_0xd8972,_0x8b1ebe[_0x2c32('0x3c')]);return db[_0x2c32('0x3e')][_0x2c32('0x44')](_0xd8972)[_0x2c32('0x21')](handleEntityNotFound(_0x30cca3,null))[_0x2c32('0x21')](respondWithResult(_0x30cca3,null))[_0x2c32('0x41')](handleError(_0x30cca3,null));};exports[_0x2c32('0x45')]=function(_0x34a5f3,_0x56b0f8){return db[_0x2c32('0x3e')][_0x2c32('0x45')](_0x34a5f3['body'],{})[_0x2c32('0x21')](respondWithResult(_0x56b0f8,0xc9))['catch'](handleError(_0x56b0f8,null));};exports['update']=function(_0x2f0bd2,_0x26ac71){if(_0x2f0bd2[_0x2c32('0x46')]['id']){delete _0x2f0bd2['body']['id'];}return db[_0x2c32('0x3e')][_0x2c32('0x44')]({'where':{'id':_0x2f0bd2[_0x2c32('0x47')]['id']}})[_0x2c32('0x21')](handleEntityNotFound(_0x26ac71,null))[_0x2c32('0x21')](saveUpdates(_0x2f0bd2[_0x2c32('0x46')],null))[_0x2c32('0x21')](respondWithResult(_0x26ac71,null))['catch'](handleError(_0x26ac71,null));};exports['destroy']=function(_0x4c0fab,_0x204dcc){return db[_0x2c32('0x3e')][_0x2c32('0x44')]({'where':{'id':_0x4c0fab[_0x2c32('0x47')]['id']}})['then'](handleEntityNotFound(_0x204dcc,null))['then'](removeEntity(_0x204dcc,null))[_0x2c32('0x41')](handleError(_0x204dcc,null));};exports[_0x2c32('0x48')]=function(_0x3d5874,_0x41370e){return db[_0x2c32('0x3e')][_0x2c32('0x48')]()['then'](respondWithResult(_0x41370e,null))[_0x2c32('0x41')](handleError(_0x41370e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 288f80e..6a471ac 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 _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x5065b6,_0x3e51ff){var _0x56d397=function(_0x877186){while(--_0x877186){_0x5065b6['push'](_0x5065b6['shift']());}};_0x56d397(++_0x3e51ff);}(_0x7a54,0x106));var _0x47a5=function(_0x18ff7a,_0x4ee7a6){_0x18ff7a=_0x18ff7a-0x0;var _0x1edbef=_0x7a54[_0x18ff7a];return _0x1edbef;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x568c64,_0x13e66f){var _0x504239=function(_0x2062f2){while(--_0x2062f2){_0x568c64['push'](_0x568c64['shift']());}};_0x504239(++_0x13e66f);}(_0x2ef3,0xba));var _0x32ef=function(_0x3aae2c,_0x7c6a9e){_0x3aae2c=_0x3aae2c-0x0;var _0x206b02=_0x2ef3[_0x3aae2c];return _0x206b02;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('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 8c9f0ae..ef86d6f 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 _0xcf2f=['rpc','../../config/environment','jayson/promise','client','http','request','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','then','debug','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1de38d,_0x1199b7){var _0x34a86f=function(_0x517e7b){while(--_0x517e7b){_0x1de38d['push'](_0x1de38d['shift']());}};_0x34a86f(++_0x1199b7);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x1326cc,_0x46fa7c){_0x1326cc=_0x1326cc-0x0;var _0x54889f=_0xcf2f[_0x1326cc];return _0x54889f;};'use strict';var _=require(_0xfcf2('0x0'));var util=require(_0xfcf2('0x1'));var moment=require(_0xfcf2('0x2'));var BPromise=require(_0xfcf2('0x3'));var rs=require(_0xfcf2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfcf2('0x5'))['db'];var utils=require(_0xfcf2('0x6'));var logger=require(_0xfcf2('0x7'))(_0xfcf2('0x8'));var config=require(_0xfcf2('0x9'));var jayson=require(_0xfcf2('0xa'));var client=jayson[_0xfcf2('0xb')][_0xfcf2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41d4bd,_0x157f48,_0x16b6b2){return new BPromise(function(_0x34f444,_0xb4c510){return client[_0xfcf2('0xd')](_0x41d4bd,_0x16b6b2)['then'](function(_0x575f33){logger['info'](_0xfcf2('0xe'),_0x157f48,_0xfcf2('0xf'));logger['debug'](_0xfcf2('0x10'),_0x157f48,_0xfcf2('0xf'),JSON[_0xfcf2('0x11')](_0x575f33));if(_0x575f33[_0xfcf2('0x12')]){if(_0x575f33['error']['code']===0x1f4){logger[_0xfcf2('0x12')](_0xfcf2('0xe'),_0x157f48,_0x575f33[_0xfcf2('0x12')][_0xfcf2('0x13')]);return _0xb4c510(_0x575f33['error'][_0xfcf2('0x13')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x157f48,_0x575f33['error'][_0xfcf2('0x13')]);return _0x34f444(_0x575f33['error'][_0xfcf2('0x13')]);}else{logger[_0xfcf2('0x14')](_0xfcf2('0xe'),_0x157f48,_0xfcf2('0xf'));_0x34f444(_0x575f33[_0xfcf2('0x15')][_0xfcf2('0x13')]);}})[_0xfcf2('0x16')](function(_0x4d64ce){logger[_0xfcf2('0x12')](_0xfcf2('0xe'),_0x157f48,_0x4d64ce);_0xb4c510(_0x4d64ce);});});}exports[_0xfcf2('0x17')]=function(_0x581d78){var _0xd87472=this;return new Promise(function(_0x1b3c89,_0x33eaa7){return db[_0xfcf2('0x18')][_0xfcf2('0x19')](_0x581d78['body'],{'raw':_0x581d78[_0xfcf2('0x1a')]?_0x581d78[_0xfcf2('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xfcf2('0x1b')](function(_0x23c079){logger[_0xfcf2('0x14')](_0xfcf2('0x17'),_0x581d78);logger[_0xfcf2('0x1c')](_0xfcf2('0x17'),_0x581d78,JSON[_0xfcf2('0x11')](_0x23c079));_0x1b3c89(_0x23c079);})[_0xfcf2('0x16')](function(_0x1eeebd){logger['error'](_0xfcf2('0x17'),_0x1eeebd[_0xfcf2('0x13')],_0x581d78);_0x33eaa7(_0xd87472[_0xfcf2('0x12')](0x1f4,_0x1eeebd['message']));});});};exports[_0xfcf2('0x1d')]=function(_0x151aa8){var _0x5ddea1=this;return new Promise(function(_0x3c3774,_0xbc8722){return db['OpenchannelQueueReport'][_0xfcf2('0x1e')](_0x151aa8[_0xfcf2('0x1f')],{'raw':_0x151aa8[_0xfcf2('0x1a')]?_0x151aa8[_0xfcf2('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x151aa8[_0xfcf2('0x1a')]?_0x151aa8[_0xfcf2('0x1a')][_0xfcf2('0x20')]||null:null,'attributes':_0x151aa8[_0xfcf2('0x1a')]?_0x151aa8[_0xfcf2('0x1a')][_0xfcf2('0x21')]||null:null,'limit':_0x151aa8[_0xfcf2('0x1a')]?_0x151aa8[_0xfcf2('0x1a')][_0xfcf2('0x22')]||null:null})['then'](function(_0x4c2935){logger[_0xfcf2('0x14')](_0xfcf2('0x1d'),_0x151aa8);logger[_0xfcf2('0x1c')]('UpdateOpenchannelQueueReport',_0x151aa8,JSON[_0xfcf2('0x11')](_0x4c2935));_0x3c3774(_0x4c2935);})['catch'](function(_0x3ce9f8){logger[_0xfcf2('0x12')](_0xfcf2('0x1d'),_0x3ce9f8[_0xfcf2('0x13')],_0x151aa8);_0xbc8722(_0x5ddea1[_0xfcf2('0x12')](0x1f4,_0x3ce9f8[_0xfcf2('0x13')]));});});}; \ No newline at end of file +var _0xf7b4=['OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','OpenchannelQueueReport','create','body','options','then','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','raw','attributes','limit','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x226fc7,_0xba4287){var _0x56b969=function(_0x235173){while(--_0x235173){_0x226fc7['push'](_0x226fc7['shift']());}};_0x56b969(++_0xba4287);}(_0xf7b4,0x152));var _0x4f7b=function(_0x3425a9,_0x1add93){_0x3425a9=_0x3425a9-0x0;var _0x34a159=_0xf7b4[_0x3425a9];return _0x34a159;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4f7b('0x1'));var rs=require(_0x4f7b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4f7b('0x3'));var logger=require(_0x4f7b('0x4'))(_0x4f7b('0x5'));var config=require(_0x4f7b('0x6'));var jayson=require(_0x4f7b('0x7'));var client=jayson[_0x4f7b('0x8')][_0x4f7b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ad135,_0x173784,_0x351036){return new BPromise(function(_0x36ea9c,_0x3ef6e1){return client[_0x4f7b('0xa')](_0x3ad135,_0x351036)['then'](function(_0x433563){logger[_0x4f7b('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x173784,_0x4f7b('0xc'));logger[_0x4f7b('0xd')](_0x4f7b('0xe'),_0x173784,_0x4f7b('0xc'),JSON[_0x4f7b('0xf')](_0x433563));if(_0x433563['error']){if(_0x433563[_0x4f7b('0x10')]['code']===0x1f4){logger['error'](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x3ef6e1(_0x433563[_0x4f7b('0x10')]['message']);}logger[_0x4f7b('0x10')](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x36ea9c(_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);}else{logger[_0x4f7b('0xb')](_0x4f7b('0x11'),_0x173784,_0x4f7b('0xc'));_0x36ea9c(_0x433563[_0x4f7b('0x13')][_0x4f7b('0x12')]);}})[_0x4f7b('0x14')](function(_0x50a161){logger[_0x4f7b('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x173784,_0x50a161);_0x3ef6e1(_0x50a161);});});}exports['CreateOpenchannelQueueReport']=function(_0x24e5cf){var _0x3813da=this;return new Promise(function(_0x519d90,_0x2b34c9){return db[_0x4f7b('0x15')][_0x4f7b('0x16')](_0x24e5cf[_0x4f7b('0x17')],{'raw':_0x24e5cf['options']?_0x24e5cf[_0x4f7b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x4f7b('0x19')](function(_0x12374b){logger[_0x4f7b('0xb')](_0x4f7b('0x1a'),_0x24e5cf);logger[_0x4f7b('0xd')](_0x4f7b('0x1a'),_0x24e5cf,JSON[_0x4f7b('0xf')](_0x12374b));_0x519d90(_0x12374b);})[_0x4f7b('0x14')](function(_0x2a8b50){logger['error'](_0x4f7b('0x1a'),_0x2a8b50[_0x4f7b('0x12')],_0x24e5cf);_0x2b34c9(_0x3813da[_0x4f7b('0x10')](0x1f4,_0x2a8b50['message']));});});};exports[_0x4f7b('0x1b')]=function(_0x4610a4){var _0x5d22f4=this;return new Promise(function(_0x15dbec,_0x59ec24){return db[_0x4f7b('0x15')][_0x4f7b('0x1c')](_0x4610a4[_0x4f7b('0x17')],{'raw':_0x4610a4[_0x4f7b('0x18')]?_0x4610a4[_0x4f7b('0x18')][_0x4f7b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4610a4[_0x4f7b('0x18')]?_0x4610a4[_0x4f7b('0x18')]['where']||null:null,'attributes':_0x4610a4[_0x4f7b('0x18')]?_0x4610a4[_0x4f7b('0x18')][_0x4f7b('0x1e')]||null:null,'limit':_0x4610a4['options']?_0x4610a4[_0x4f7b('0x18')][_0x4f7b('0x1f')]||null:null})[_0x4f7b('0x19')](function(_0x3a56ff){logger[_0x4f7b('0xb')]('UpdateOpenchannelQueueReport',_0x4610a4);logger[_0x4f7b('0xd')](_0x4f7b('0x1b'),_0x4610a4,JSON[_0x4f7b('0xf')](_0x3a56ff));_0x15dbec(_0x3a56ff);})['catch'](function(_0x7de561){logger['error']('UpdateOpenchannelQueueReport',_0x7de561[_0x4f7b('0x12')],_0x4610a4);_0x59ec24(_0x5d22f4['error'](0x1f4,_0x7de561[_0x4f7b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 64a36f4..33ff9db 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 _0x13ee=['fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','index','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','multer','path','express','Router'];(function(_0x348db2,_0x132d00){var _0x148204=function(_0x34627f){while(--_0x34627f){_0x348db2['push'](_0x348db2['shift']());}};_0x148204(++_0x132d00);}(_0x13ee,0x164));var _0xe13e=function(_0x4fb1b8,_0x32d98d){_0x4fb1b8=_0x4fb1b8-0x0;var _0x146c71=_0x13ee[_0x4fb1b8];return _0x146c71;};'use strict';var multer=require(_0xe13e('0x0'));var util=require('util');var path=require(_0xe13e('0x1'));var timeout=require('connect-timeout');var express=require(_0xe13e('0x2'));var router=express[_0xe13e('0x3')]();var fs_extra=require(_0xe13e('0x4'));var auth=require(_0xe13e('0x5'));var interaction=require(_0xe13e('0x6'));var config=require('../../config/environment');var controller=require(_0xe13e('0x7'));router[_0xe13e('0x8')]('/',auth['isAuthenticated'](),controller[_0xe13e('0x9')]);router['get']('/describe',auth[_0xe13e('0xa')](),controller[_0xe13e('0xb')]);router[_0xe13e('0x8')](_0xe13e('0xc'),auth[_0xe13e('0xa')](),controller[_0xe13e('0xd')]);router[_0xe13e('0xe')]('/',auth[_0xe13e('0xa')](),controller[_0xe13e('0xf')]);router[_0xe13e('0x10')](_0xe13e('0xc'),auth[_0xe13e('0xa')](),controller[_0xe13e('0x11')]);router[_0xe13e('0x12')](_0xe13e('0xc'),auth[_0xe13e('0xa')](),controller['destroy']);module[_0xe13e('0x13')]=router; \ No newline at end of file +var _0x8524=['get','/describe','describe','/:id','post','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated'];(function(_0x5786b9,_0x4e27da){var _0x32884a=function(_0x3183d2){while(--_0x3183d2){_0x5786b9['push'](_0x5786b9['shift']());}};_0x32884a(++_0x4e27da);}(_0x8524,0x1a6));var _0x4852=function(_0x3054de,_0x1e9c72){_0x3054de=_0x3054de-0x0;var _0x2aa6ca=_0x8524[_0x3054de];return _0x2aa6ca;};'use strict';var multer=require(_0x4852('0x0'));var util=require(_0x4852('0x1'));var path=require(_0x4852('0x2'));var timeout=require(_0x4852('0x3'));var express=require(_0x4852('0x4'));var router=express[_0x4852('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4852('0x6'));var config=require(_0x4852('0x7'));var controller=require(_0x4852('0x8'));router['get']('/',auth[_0x4852('0x9')](),controller['index']);router[_0x4852('0xa')](_0x4852('0xb'),auth['isAuthenticated'](),controller[_0x4852('0xc')]);router[_0x4852('0xa')](_0x4852('0xd'),auth[_0x4852('0x9')](),controller['show']);router[_0x4852('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x4852('0xd'),auth[_0x4852('0x9')](),controller[_0x4852('0xf')]);router['delete'](_0x4852('0xd'),auth['isAuthenticated'](),controller[_0x4852('0x10')]);module[_0x4852('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 3932258..30e8284 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x56e0e5,_0x2e3937){var _0x27bb15=function(_0x186336){while(--_0x186336){_0x56e0e5['push'](_0x56e0e5['shift']());}};_0x27bb15(++_0x2e3937);}(_0x34e8,0x12c));var _0x834e=function(_0x3bfbd7,_0x4198c6){_0x3bfbd7=_0x3bfbd7-0x0;var _0x1ab8a4=_0x34e8[_0x3bfbd7];return _0x1ab8a4;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x5cc613,_0x30cf85){var _0x11bcd9=function(_0x5dc982){while(--_0x5dc982){_0x5cc613['push'](_0x5cc613['shift']());}};_0x11bcd9(++_0x30cf85);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x00bb[_0x5447fd];return _0x15b28a;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index c204f46..68f1506 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 _0xd60f=['util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x1e928b,_0x7cb412){var _0x3e26c3=function(_0x1c41f8){while(--_0x1c41f8){_0x1e928b['push'](_0x1e928b['shift']());}};_0x3e26c3(++_0x7cb412);}(_0xd60f,0x1c2));var _0xfd60=function(_0x53f274,_0x15eed1){_0x53f274=_0x53f274-0x0;var _0x18efbb=_0xd60f[_0x53f274];return _0x18efbb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfd60('0x0'));var zipdir=require(_0xfd60('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfd60('0x2'));var moment=require(_0xfd60('0x3'));var BPromise=require(_0xfd60('0x4'));var Mustache=require(_0xfd60('0x5'));var util=require(_0xfd60('0x6'));var path=require(_0xfd60('0x7'));var sox=require('sox');var csv=require(_0xfd60('0x8'));var ejs=require(_0xfd60('0x9'));var fs=require('fs');var fs_extra=require(_0xfd60('0xa'));var _=require(_0xfd60('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfd60('0xc'));var deskjs=require(_0xfd60('0xd'));var toCsv=require(_0xfd60('0x8'));var querystring=require(_0xfd60('0xe'));var Papa=require(_0xfd60('0xf'));var Redis=require(_0xfd60('0x10'));var authService=require(_0xfd60('0x11'));var qs=require(_0xfd60('0x12'));var as=require(_0xfd60('0x13'));var hardwareService=require(_0xfd60('0x14'));var logger=require('../../config/logger')(_0xfd60('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfd60('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ec840,_0x32c5af){_0x32c5af=_0x32c5af||0xcc;return function(_0x1783e0){if(_0x1783e0){return _0x2ec840['sendStatus'](_0x32c5af);}return _0x2ec840['status'](_0x32c5af)['end']();};}function respondWithResult(_0x189438,_0x249167){_0x249167=_0x249167||0xc8;return function(_0x47fadd){if(_0x47fadd){return _0x189438[_0xfd60('0x17')](_0x249167)['json'](_0x47fadd);}};}function respondWithFilteredResult(_0x1c3e2e,_0x288d33){return function(_0x1e4bea){if(_0x1e4bea){var _0xda8914=typeof _0x288d33[_0xfd60('0x18')]===_0xfd60('0x19')&&typeof _0x288d33[_0xfd60('0x1a')]==='undefined';var _0x295a77=_0x1e4bea['count'];var _0x1aad99=_0xda8914?0x0:_0x288d33[_0xfd60('0x18')];var _0x590392=_0xda8914?_0x1e4bea[_0xfd60('0x1b')]:_0x288d33[_0xfd60('0x18')]+_0x288d33[_0xfd60('0x1a')];var _0x18abfa;if(_0x590392>=_0x295a77){_0x590392=_0x295a77;_0x18abfa=0xc8;}else{_0x18abfa=0xce;}_0x1c3e2e[_0xfd60('0x17')](_0x18abfa);return _0x1c3e2e[_0xfd60('0x1c')](_0xfd60('0x1d'),_0x1aad99+'-'+_0x590392+'/'+_0x295a77)[_0xfd60('0x1e')](_0x1e4bea);}return null;};}function patchUpdates(_0x199379){return function(_0x32fbac){try{jsonpatch[_0xfd60('0x1f')](_0x32fbac,_0x199379,!![]);}catch(_0x1d4ea5){return BPromise[_0xfd60('0x20')](_0x1d4ea5);}return _0x32fbac[_0xfd60('0x21')]();};}function saveUpdates(_0x79b400,_0x226cf6){return function(_0x4a0e26){if(_0x4a0e26){return _0x4a0e26[_0xfd60('0x22')](_0x79b400)['then'](function(_0x1e1c66){return _0x1e1c66;});}return null;};}function removeEntity(_0x1bfe6e,_0x334f29){return function(_0x1a499e){if(_0x1a499e){return _0x1a499e[_0xfd60('0x23')]()[_0xfd60('0x24')](function(){_0x1bfe6e[_0xfd60('0x17')](0xcc)[_0xfd60('0x25')]();});}};}function handleEntityNotFound(_0x2c5217,_0x35b5be){return function(_0x121f7e){if(!_0x121f7e){_0x2c5217[_0xfd60('0x26')](0x194);}return _0x121f7e;};}function handleError(_0x13a673,_0x41058b){_0x41058b=_0x41058b||0x1f4;return function(_0x13697f){logger[_0xfd60('0x27')](_0x13697f['stack']);if(_0x13697f[_0xfd60('0x28')]){delete _0x13697f[_0xfd60('0x28')];}_0x13a673[_0xfd60('0x17')](_0x41058b)[_0xfd60('0x29')](_0x13697f);};}exports[_0xfd60('0x2a')]=function(_0x145c8d,_0x55a250){var _0x29d862={},_0x54c97b={},_0x4397fe={'count':0x0,'rows':[]};var _0x204af5=_[_0xfd60('0x2b')](db[_0xfd60('0x2c')][_0xfd60('0x2d')],function(_0xeea1eb){return{'name':_0xeea1eb[_0xfd60('0x2e')],'type':_0xeea1eb[_0xfd60('0x2f')][_0xfd60('0x30')]};});_0x54c97b[_0xfd60('0x31')]=_[_0xfd60('0x2b')](_0x204af5,'name');_0x54c97b[_0xfd60('0x32')]=_[_0xfd60('0x33')](_0x145c8d[_0xfd60('0x32')]);_0x54c97b['filters']=_['intersection'](_0x54c97b[_0xfd60('0x31')],_0x54c97b['query']);_0x29d862[_0xfd60('0x34')]=_[_0xfd60('0x35')](_0x54c97b[_0xfd60('0x31')],qs[_0xfd60('0x36')](_0x145c8d[_0xfd60('0x32')]['fields']));_0x29d862[_0xfd60('0x34')]=_0x29d862['attributes']['length']?_0x29d862[_0xfd60('0x34')]:_0x54c97b[_0xfd60('0x31')];if(!_0x145c8d[_0xfd60('0x32')][_0xfd60('0x37')]('nolimit')){_0x29d862['limit']=qs['limit'](_0x145c8d[_0xfd60('0x32')][_0xfd60('0x1a')]);_0x29d862['offset']=qs['offset'](_0x145c8d[_0xfd60('0x32')][_0xfd60('0x18')]);}_0x29d862[_0xfd60('0x38')]=qs[_0xfd60('0x39')](_0x145c8d['query'][_0xfd60('0x39')]);_0x29d862[_0xfd60('0x3a')]=qs[_0xfd60('0x3b')](_[_0xfd60('0x3c')](_0x145c8d[_0xfd60('0x32')],_0x54c97b[_0xfd60('0x3b')]),_0x204af5);if(_0x145c8d[_0xfd60('0x32')][_0xfd60('0x3d')]){_0x29d862[_0xfd60('0x3a')]=_['merge'](_0x29d862[_0xfd60('0x3a')],{'$or':_[_0xfd60('0x2b')](_0x204af5,function(_0x41fc7e){if(_0x41fc7e[_0xfd60('0x2f')]!=='VIRTUAL'){var _0x366b44={};_0x366b44[_0x41fc7e['name']]={'$like':'%'+_0x145c8d[_0xfd60('0x32')][_0xfd60('0x3d')]+'%'};return _0x366b44;}})});}_0x29d862=_[_0xfd60('0x3e')]({},_0x29d862,_0x145c8d[_0xfd60('0x3f')]);var _0xffc256={'where':_0x29d862[_0xfd60('0x3a')]};return db[_0xfd60('0x2c')][_0xfd60('0x1b')](_0xffc256)[_0xfd60('0x24')](function(_0x4d4559){_0x4397fe[_0xfd60('0x1b')]=_0x4d4559;if(_0x145c8d['query'][_0xfd60('0x40')]){_0x29d862[_0xfd60('0x41')]=[{'all':!![]}];}return db[_0xfd60('0x2c')][_0xfd60('0x42')](_0x29d862);})[_0xfd60('0x24')](function(_0x47628f){_0x4397fe[_0xfd60('0x43')]=_0x47628f;return _0x4397fe;})[_0xfd60('0x24')](respondWithFilteredResult(_0x55a250,_0x29d862))[_0xfd60('0x44')](handleError(_0x55a250,null));};exports[_0xfd60('0x45')]=function(_0xc46c28,_0x3d9f80){var _0x33f674={'raw':!![],'where':{'id':_0xc46c28['params']['id']}},_0x5940f5={};_0x5940f5[_0xfd60('0x31')]=_[_0xfd60('0x33')](db['OpenchannelTransferReport'][_0xfd60('0x2d')]);_0x5940f5['query']=_[_0xfd60('0x33')](_0xc46c28[_0xfd60('0x32')]);_0x5940f5[_0xfd60('0x3b')]=_[_0xfd60('0x35')](_0x5940f5[_0xfd60('0x31')],_0x5940f5[_0xfd60('0x32')]);_0x33f674['attributes']=_['intersection'](_0x5940f5[_0xfd60('0x31')],qs[_0xfd60('0x36')](_0xc46c28[_0xfd60('0x32')][_0xfd60('0x36')]));_0x33f674['attributes']=_0x33f674[_0xfd60('0x34')][_0xfd60('0x46')]?_0x33f674['attributes']:_0x5940f5[_0xfd60('0x31')];if(_0xc46c28[_0xfd60('0x32')][_0xfd60('0x40')]){_0x33f674[_0xfd60('0x41')]=[{'all':!![]}];}_0x33f674=_[_0xfd60('0x3e')]({},_0x33f674,_0xc46c28[_0xfd60('0x3f')]);return db[_0xfd60('0x2c')][_0xfd60('0x47')](_0x33f674)[_0xfd60('0x24')](handleEntityNotFound(_0x3d9f80,null))[_0xfd60('0x24')](respondWithResult(_0x3d9f80,null))[_0xfd60('0x44')](handleError(_0x3d9f80,null));};exports['create']=function(_0x3c5cc2,_0x3f937){return db[_0xfd60('0x2c')][_0xfd60('0x48')](_0x3c5cc2[_0xfd60('0x49')],{})[_0xfd60('0x24')](respondWithResult(_0x3f937,0xc9))[_0xfd60('0x44')](handleError(_0x3f937,null));};exports['update']=function(_0x2dd3c8,_0x17599c){if(_0x2dd3c8[_0xfd60('0x49')]['id']){delete _0x2dd3c8['body']['id'];}return db['OpenchannelTransferReport'][_0xfd60('0x47')]({'where':{'id':_0x2dd3c8[_0xfd60('0x4a')]['id']}})['then'](handleEntityNotFound(_0x17599c,null))['then'](saveUpdates(_0x2dd3c8[_0xfd60('0x49')],null))['then'](respondWithResult(_0x17599c,null))[_0xfd60('0x44')](handleError(_0x17599c,null));};exports[_0xfd60('0x23')]=function(_0x1b3875,_0x2ebf96){return db[_0xfd60('0x2c')]['find']({'where':{'id':_0x1b3875[_0xfd60('0x4a')]['id']}})[_0xfd60('0x24')](handleEntityNotFound(_0x2ebf96,null))[_0xfd60('0x24')](removeEntity(_0x2ebf96,null))[_0xfd60('0x44')](handleError(_0x2ebf96,null));};exports[_0xfd60('0x4b')]=function(_0x4a7915,_0x168a06){return db[_0xfd60('0x2c')][_0xfd60('0x4b')]()[_0xfd60('0x24')](respondWithResult(_0x168a06,null))['catch'](handleError(_0x168a06,null));}; \ No newline at end of file +var _0xdd9e=['index','map','OpenchannelTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','body','find','describe','eml-format','fast-json-patch','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name'];(function(_0x130c43,_0x4b4fa8){var _0x1951e0=function(_0x535068){while(--_0x535068){_0x130c43['push'](_0x130c43['shift']());}};_0x1951e0(++_0x4b4fa8);}(_0xdd9e,0x1e2));var _0xedd9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd9e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xedd9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xedd9('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xedd9('0x2'));var Mustache=require(_0xedd9('0x3'));var util=require('util');var path=require(_0xedd9('0x4'));var sox=require(_0xedd9('0x5'));var csv=require('to-csv');var ejs=require(_0xedd9('0x6'));var fs=require('fs');var fs_extra=require(_0xedd9('0x7'));var _=require(_0xedd9('0x8'));var squel=require(_0xedd9('0x9'));var crypto=require(_0xedd9('0xa'));var jsforce=require(_0xedd9('0xb'));var deskjs=require(_0xedd9('0xc'));var toCsv=require(_0xedd9('0xd'));var querystring=require(_0xedd9('0xe'));var Papa=require(_0xedd9('0xf'));var Redis=require('ioredis');var authService=require(_0xedd9('0x10'));var qs=require(_0xedd9('0x11'));var as=require(_0xedd9('0x12'));var hardwareService=require(_0xedd9('0x13'));var logger=require(_0xedd9('0x14'))(_0xedd9('0x15'));var utils=require(_0xedd9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xedd9('0x17'));var db=require(_0xedd9('0x18'))['db'];function respondWithStatusCode(_0x15e950,_0x5de16d){_0x5de16d=_0x5de16d||0xcc;return function(_0x5037a1){if(_0x5037a1){return _0x15e950[_0xedd9('0x19')](_0x5de16d);}return _0x15e950[_0xedd9('0x1a')](_0x5de16d)[_0xedd9('0x1b')]();};}function respondWithResult(_0x52859c,_0xa6bf09){_0xa6bf09=_0xa6bf09||0xc8;return function(_0x1e93c4){if(_0x1e93c4){return _0x52859c[_0xedd9('0x1a')](_0xa6bf09)[_0xedd9('0x1c')](_0x1e93c4);}};}function respondWithFilteredResult(_0x38dd3c,_0x2142b1){return function(_0x50f9d2){if(_0x50f9d2){var _0x2178d9=typeof _0x2142b1['offset']===_0xedd9('0x1d')&&typeof _0x2142b1[_0xedd9('0x1e')]==='undefined';var _0x3fcd78=_0x50f9d2[_0xedd9('0x1f')];var _0xbe0094=_0x2178d9?0x0:_0x2142b1[_0xedd9('0x20')];var _0x24cc35=_0x2178d9?_0x50f9d2[_0xedd9('0x1f')]:_0x2142b1['offset']+_0x2142b1[_0xedd9('0x1e')];var _0x50b456;if(_0x24cc35>=_0x3fcd78){_0x24cc35=_0x3fcd78;_0x50b456=0xc8;}else{_0x50b456=0xce;}_0x38dd3c[_0xedd9('0x1a')](_0x50b456);return _0x38dd3c[_0xedd9('0x21')](_0xedd9('0x22'),_0xbe0094+'-'+_0x24cc35+'/'+_0x3fcd78)[_0xedd9('0x1c')](_0x50f9d2);}return null;};}function patchUpdates(_0x95f576){return function(_0x3660bf){try{jsonpatch[_0xedd9('0x23')](_0x3660bf,_0x95f576,!![]);}catch(_0xf794a4){return BPromise[_0xedd9('0x24')](_0xf794a4);}return _0x3660bf['save']();};}function saveUpdates(_0x5f4371,_0x5e2509){return function(_0x49c3b8){if(_0x49c3b8){return _0x49c3b8[_0xedd9('0x25')](_0x5f4371)[_0xedd9('0x26')](function(_0x3f0ad9){return _0x3f0ad9;});}return null;};}function removeEntity(_0x2efca0,_0x4247e3){return function(_0x1aea60){if(_0x1aea60){return _0x1aea60[_0xedd9('0x27')]()['then'](function(){_0x2efca0[_0xedd9('0x1a')](0xcc)[_0xedd9('0x1b')]();});}};}function handleEntityNotFound(_0x1b4e01,_0x1acdf4){return function(_0xa93eac){if(!_0xa93eac){_0x1b4e01[_0xedd9('0x19')](0x194);}return _0xa93eac;};}function handleError(_0x70166d,_0x367b1e){_0x367b1e=_0x367b1e||0x1f4;return function(_0x29ef3a){logger[_0xedd9('0x28')](_0x29ef3a[_0xedd9('0x29')]);if(_0x29ef3a[_0xedd9('0x2a')]){delete _0x29ef3a[_0xedd9('0x2a')];}_0x70166d[_0xedd9('0x1a')](_0x367b1e)['send'](_0x29ef3a);};}exports[_0xedd9('0x2b')]=function(_0x58a08a,_0x3fd360){var _0x57131d={},_0x569773={},_0x37cebd={'count':0x0,'rows':[]};var _0x16d19a=_[_0xedd9('0x2c')](db[_0xedd9('0x2d')]['rawAttributes'],function(_0x192061){return{'name':_0x192061[_0xedd9('0x2e')],'type':_0x192061[_0xedd9('0x2f')][_0xedd9('0x30')]};});_0x569773[_0xedd9('0x31')]=_['map'](_0x16d19a,_0xedd9('0x2a'));_0x569773[_0xedd9('0x32')]=_[_0xedd9('0x33')](_0x58a08a[_0xedd9('0x32')]);_0x569773[_0xedd9('0x34')]=_[_0xedd9('0x35')](_0x569773[_0xedd9('0x31')],_0x569773['query']);_0x57131d[_0xedd9('0x36')]=_[_0xedd9('0x35')](_0x569773['model'],qs[_0xedd9('0x37')](_0x58a08a[_0xedd9('0x32')][_0xedd9('0x37')]));_0x57131d['attributes']=_0x57131d[_0xedd9('0x36')]['length']?_0x57131d[_0xedd9('0x36')]:_0x569773['model'];if(!_0x58a08a[_0xedd9('0x32')][_0xedd9('0x38')](_0xedd9('0x39'))){_0x57131d[_0xedd9('0x1e')]=qs[_0xedd9('0x1e')](_0x58a08a[_0xedd9('0x32')]['limit']);_0x57131d[_0xedd9('0x20')]=qs[_0xedd9('0x20')](_0x58a08a[_0xedd9('0x32')][_0xedd9('0x20')]);}_0x57131d[_0xedd9('0x3a')]=qs[_0xedd9('0x3b')](_0x58a08a[_0xedd9('0x32')]['sort']);_0x57131d[_0xedd9('0x3c')]=qs[_0xedd9('0x34')](_['pick'](_0x58a08a[_0xedd9('0x32')],_0x569773['filters']),_0x16d19a);if(_0x58a08a[_0xedd9('0x32')][_0xedd9('0x3d')]){_0x57131d[_0xedd9('0x3c')]=_[_0xedd9('0x3e')](_0x57131d[_0xedd9('0x3c')],{'$or':_[_0xedd9('0x2c')](_0x16d19a,function(_0x4d1b15){if(_0x4d1b15[_0xedd9('0x2f')]!==_0xedd9('0x3f')){var _0x4f6154={};_0x4f6154[_0x4d1b15[_0xedd9('0x2a')]]={'$like':'%'+_0x58a08a[_0xedd9('0x32')][_0xedd9('0x3d')]+'%'};return _0x4f6154;}})});}_0x57131d=_[_0xedd9('0x3e')]({},_0x57131d,_0x58a08a[_0xedd9('0x40')]);var _0x1595bd={'where':_0x57131d[_0xedd9('0x3c')]};return db[_0xedd9('0x2d')][_0xedd9('0x1f')](_0x1595bd)[_0xedd9('0x26')](function(_0x36e573){_0x37cebd[_0xedd9('0x1f')]=_0x36e573;if(_0x58a08a[_0xedd9('0x32')][_0xedd9('0x41')]){_0x57131d[_0xedd9('0x42')]=[{'all':!![]}];}return db[_0xedd9('0x2d')][_0xedd9('0x43')](_0x57131d);})[_0xedd9('0x26')](function(_0x2e1e9b){_0x37cebd[_0xedd9('0x44')]=_0x2e1e9b;return _0x37cebd;})[_0xedd9('0x26')](respondWithFilteredResult(_0x3fd360,_0x57131d))[_0xedd9('0x45')](handleError(_0x3fd360,null));};exports[_0xedd9('0x46')]=function(_0xab4c43,_0x44d15a){var _0x5498b4={'raw':!![],'where':{'id':_0xab4c43[_0xedd9('0x47')]['id']}},_0x5ba530={};_0x5ba530[_0xedd9('0x31')]=_[_0xedd9('0x33')](db[_0xedd9('0x2d')]['rawAttributes']);_0x5ba530[_0xedd9('0x32')]=_[_0xedd9('0x33')](_0xab4c43['query']);_0x5ba530['filters']=_['intersection'](_0x5ba530['model'],_0x5ba530[_0xedd9('0x32')]);_0x5498b4[_0xedd9('0x36')]=_[_0xedd9('0x35')](_0x5ba530[_0xedd9('0x31')],qs['fields'](_0xab4c43[_0xedd9('0x32')][_0xedd9('0x37')]));_0x5498b4[_0xedd9('0x36')]=_0x5498b4[_0xedd9('0x36')]['length']?_0x5498b4[_0xedd9('0x36')]:_0x5ba530[_0xedd9('0x31')];if(_0xab4c43[_0xedd9('0x32')][_0xedd9('0x41')]){_0x5498b4[_0xedd9('0x42')]=[{'all':!![]}];}_0x5498b4=_['merge']({},_0x5498b4,_0xab4c43[_0xedd9('0x40')]);return db[_0xedd9('0x2d')]['find'](_0x5498b4)['then'](handleEntityNotFound(_0x44d15a,null))['then'](respondWithResult(_0x44d15a,null))[_0xedd9('0x45')](handleError(_0x44d15a,null));};exports['create']=function(_0x582219,_0x1c4d11){return db['OpenchannelTransferReport']['create'](_0x582219['body'],{})[_0xedd9('0x26')](respondWithResult(_0x1c4d11,0xc9))[_0xedd9('0x45')](handleError(_0x1c4d11,null));};exports[_0xedd9('0x25')]=function(_0x26f07c,_0x808f69){if(_0x26f07c['body']['id']){delete _0x26f07c[_0xedd9('0x48')]['id'];}return db['OpenchannelTransferReport'][_0xedd9('0x49')]({'where':{'id':_0x26f07c[_0xedd9('0x47')]['id']}})[_0xedd9('0x26')](handleEntityNotFound(_0x808f69,null))['then'](saveUpdates(_0x26f07c[_0xedd9('0x48')],null))[_0xedd9('0x26')](respondWithResult(_0x808f69,null))[_0xedd9('0x45')](handleError(_0x808f69,null));};exports[_0xedd9('0x27')]=function(_0x53f001,_0x5ab393){return db[_0xedd9('0x2d')][_0xedd9('0x49')]({'where':{'id':_0x53f001[_0xedd9('0x47')]['id']}})[_0xedd9('0x26')](handleEntityNotFound(_0x5ab393,null))[_0xedd9('0x26')](removeEntity(_0x5ab393,null))[_0xedd9('0x45')](handleError(_0x5ab393,null));};exports['describe']=function(_0x79a56f,_0x438e8e){return db[_0xedd9('0x2d')][_0xedd9('0x4a')]()['then'](respondWithResult(_0x438e8e,null))[_0xedd9('0x45')](handleError(_0x438e8e,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index b39d9ee..a8fdcbb 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 _0xe614=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport'];(function(_0x59c86e,_0x38ce57){var _0x48a50e=function(_0x1eeda5){while(--_0x1eeda5){_0x59c86e['push'](_0x59c86e['shift']());}};_0x48a50e(++_0x38ce57);}(_0xe614,0x139));var _0x4e61=function(_0x3c0efa,_0x192410){_0x3c0efa=_0x3c0efa-0x0;var _0x1ffe91=_0xe614[_0x3c0efa];return _0x1ffe91;};'use strict';var _=require(_0x4e61('0x0'));var util=require(_0x4e61('0x1'));var logger=require(_0x4e61('0x2'))(_0x4e61('0x3'));var moment=require(_0x4e61('0x4'));var BPromise=require(_0x4e61('0x5'));var rp=require(_0x4e61('0x6'));var fs=require('fs');var path=require(_0x4e61('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4e61('0x8'));module[_0x4e61('0x9')]=function(_0x206e71,_0xc753bf){return _0x206e71[_0x4e61('0xa')](_0x4e61('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x4e61('0xc'),'fields':[_0x4e61('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6528=['request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid','lodash','../../config/logger','moment'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6528,0xef));var _0x8652=function(_0x5cdb9f,_0xf05ef4){_0x5cdb9f=_0x5cdb9f-0x0;var _0x48db33=_0x6528[_0x5cdb9f];return _0x48db33;};'use strict';var _=require(_0x8652('0x0'));var util=require('util');var logger=require(_0x8652('0x1'))('api');var moment=require(_0x8652('0x2'));var BPromise=require('bluebird');var rp=require(_0x8652('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8652('0x4'));var config=require(_0x8652('0x5'));var attributes=require(_0x8652('0x6'));module[_0x8652('0x7')]=function(_0x1c7aa9,_0x5172d8){return _0x1c7aa9[_0x8652('0x8')]('OpenchannelTransferReport',attributes,{'tableName':_0x8652('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8652('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 4c19710..30ea071 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 _0x7fbe=['request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x500152,_0x2da81c){var _0x442938=function(_0x434400){while(--_0x434400){_0x500152['push'](_0x500152['shift']());}};_0x442938(++_0x2da81c);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xdb576,_0x13705e){_0xdb576=_0xdb576-0x0;var _0x98a94b=_0x7fbe[_0xdb576];return _0x98a94b;};'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);});});} \ No newline at end of file +var _0xa41a=['rpc','../../config/environment','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x314b14,_0x340c7f){var _0x2c9f44=function(_0x3e8cc1){while(--_0x3e8cc1){_0x314b14['push'](_0x314b14['shift']());}};_0x2c9f44(++_0x340c7f);}(_0xa41a,0x6b));var _0xaa41=function(_0x4a30f8,_0x2fa1a9){_0x4a30f8=_0x4a30f8-0x0;var _0x315e58=_0xa41a[_0x4a30f8];return _0x315e58;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 8e8ae12..abddd97 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 _0xf6b3=['fs-extra','../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','util','path','express','Router'];(function(_0x6ab30c,_0x2c713b){var _0x36e953=function(_0x1aea9a){while(--_0x1aea9a){_0x6ab30c['push'](_0x6ab30c['shift']());}};_0x36e953(++_0x2c713b);}(_0xf6b3,0x177));var _0x3f6b=function(_0x53084c,_0x4a10a7){_0x53084c=_0x53084c-0x0;var _0x3725c5=_0xf6b3[_0x53084c];return _0x3725c5;};'use strict';var multer=require(_0x3f6b('0x0'));var util=require(_0x3f6b('0x1'));var path=require(_0x3f6b('0x2'));var timeout=require('connect-timeout');var express=require(_0x3f6b('0x3'));var router=express[_0x3f6b('0x4')]();var fs_extra=require(_0x3f6b('0x5'));var auth=require(_0x3f6b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3f6b('0x7'));var controller=require(_0x3f6b('0x8'));router[_0x3f6b('0x9')]('/',auth[_0x3f6b('0xa')](),controller[_0x3f6b('0xb')]);router['get'](_0x3f6b('0xc'),auth[_0x3f6b('0xa')](),controller['show']);router[_0x3f6b('0xd')]('/',auth['isAuthenticated'](),controller[_0x3f6b('0xe')]);router[_0x3f6b('0xf')](_0x3f6b('0xc'),auth[_0x3f6b('0xa')](),controller[_0x3f6b('0x10')]);router[_0x3f6b('0x11')](_0x3f6b('0xc'),auth[_0x3f6b('0xa')](),controller['destroy']);module[_0x3f6b('0x12')]=router; \ No newline at end of file +var _0x1dbf=['fs-extra','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','show','create','put','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x3a0839,_0x47d337){var _0x149e74=function(_0x1ad6c2){while(--_0x1ad6c2){_0x3a0839['push'](_0x3a0839['shift']());}};_0x149e74(++_0x47d337);}(_0x1dbf,0xfb));var _0xf1db=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x1dbf[_0x346737];return _0x1ade2e;};'use strict';var multer=require('multer');var util=require(_0xf1db('0x0'));var path=require('path');var timeout=require(_0xf1db('0x1'));var express=require(_0xf1db('0x2'));var router=express[_0xf1db('0x3')]();var fs_extra=require(_0xf1db('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf1db('0x5'));var controller=require(_0xf1db('0x6'));router['get']('/',auth[_0xf1db('0x7')](),controller[_0xf1db('0x8')]);router[_0xf1db('0x9')](_0xf1db('0xa'),auth[_0xf1db('0x7')](),controller[_0xf1db('0xb')]);router['post']('/',auth[_0xf1db('0x7')](),controller[_0xf1db('0xc')]);router[_0xf1db('0xd')](_0xf1db('0xa'),auth[_0xf1db('0x7')](),controller['update']);router[_0xf1db('0xe')]('/:id',auth[_0xf1db('0x7')](),controller[_0xf1db('0xf')]);module[_0xf1db('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index f074942..5f986f3 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 _0x837b=['name','exports','STRING'];(function(_0x5c34d2,_0xca044){var _0x2cb67c=function(_0x11f4ee){while(--_0x11f4ee){_0x5c34d2['push'](_0x5c34d2['shift']());}};_0x2cb67c(++_0xca044);}(_0x837b,0x13f));var _0xb837=function(_0x5524e9,_0x1c53e7){_0x5524e9=_0x5524e9-0x0;var _0x2db558=_0x837b[_0x5524e9];return _0x2db558;};'use strict';var Sequelize=require('sequelize');module[_0xb837('0x0')]={'name':{'type':Sequelize[_0xb837('0x1')],'unique':_0xb837('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6468=['name','STRING','sequelize','exports'];(function(_0x48e165,_0x5bd57e){var _0x230518=function(_0x5b764e){while(--_0x5b764e){_0x48e165['push'](_0x48e165['shift']());}};_0x230518(++_0x5bd57e);}(_0x6468,0x116));var _0x8646=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x6468[_0xdc37a1];return _0x99b4fe;};'use strict';var Sequelize=require(_0x8646('0x0'));module[_0x8646('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8646('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x8646('0x3')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index e5dd1d2..e5ba0d9 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 _0x8984=['include','findAll','rows','catch','show','fields','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','get','Pauses','UserProfileResource','error','stack','name','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options'];(function(_0x59ca4f,_0x1d5b1e){var _0x13e9da=function(_0x3b140e){while(--_0x3b140e){_0x59ca4f['push'](_0x59ca4f['shift']());}};_0x13e9da(++_0x1d5b1e);}(_0x8984,0xbd));var _0x4898=function(_0x3702b5,_0x131f1d){_0x3702b5=_0x3702b5-0x0;var _0x37f1d9=_0x8984[_0x3702b5];return _0x37f1d9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4898('0x0'));var jsonpatch=require(_0x4898('0x1'));var rp=require(_0x4898('0x2'));var moment=require('moment');var BPromise=require(_0x4898('0x3'));var Mustache=require('mustache');var util=require(_0x4898('0x4'));var path=require(_0x4898('0x5'));var sox=require(_0x4898('0x6'));var csv=require(_0x4898('0x7'));var ejs=require(_0x4898('0x8'));var fs=require('fs');var fs_extra=require(_0x4898('0x9'));var _=require(_0x4898('0xa'));var squel=require(_0x4898('0xb'));var crypto=require(_0x4898('0xc'));var jsforce=require(_0x4898('0xd'));var deskjs=require(_0x4898('0xe'));var toCsv=require(_0x4898('0x7'));var querystring=require(_0x4898('0xf'));var Papa=require(_0x4898('0x10'));var Redis=require(_0x4898('0x11'));var authService=require(_0x4898('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4898('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4898('0x14'))(_0x4898('0x15'));var utils=require(_0x4898('0x16'));var config=require(_0x4898('0x17'));var licenseUtil=require(_0x4898('0x18'));var db=require(_0x4898('0x19'))['db'];function respondWithStatusCode(_0x3265de,_0x116b21){_0x116b21=_0x116b21||0xcc;return function(_0x1d8f02){if(_0x1d8f02){return _0x3265de[_0x4898('0x1a')](_0x116b21);}return _0x3265de['status'](_0x116b21)[_0x4898('0x1b')]();};}function respondWithResult(_0x461cf3,_0x4352d0){_0x4352d0=_0x4352d0||0xc8;return function(_0x28c313){if(_0x28c313){return _0x461cf3['status'](_0x4352d0)[_0x4898('0x1c')](_0x28c313);}};}function respondWithFilteredResult(_0x850e5b,_0xda7bea){return function(_0x2deb31){if(_0x2deb31){var _0x943f63=typeof _0xda7bea['offset']==='undefined'&&typeof _0xda7bea[_0x4898('0x1d')]===_0x4898('0x1e');var _0x4ede3c=_0x2deb31[_0x4898('0x1f')];var _0xaf515e=_0x943f63?0x0:_0xda7bea[_0x4898('0x20')];var _0xc03bca=_0x943f63?_0x2deb31['count']:_0xda7bea[_0x4898('0x20')]+_0xda7bea[_0x4898('0x1d')];var _0x4787de;if(_0xc03bca>=_0x4ede3c){_0xc03bca=_0x4ede3c;_0x4787de=0xc8;}else{_0x4787de=0xce;}_0x850e5b['status'](_0x4787de);return _0x850e5b[_0x4898('0x21')](_0x4898('0x22'),_0xaf515e+'-'+_0xc03bca+'/'+_0x4ede3c)[_0x4898('0x1c')](_0x2deb31);}return null;};}function patchUpdates(_0x8758a3){return function(_0x14cabc){try{jsonpatch[_0x4898('0x23')](_0x14cabc,_0x8758a3,!![]);}catch(_0x226a44){return BPromise[_0x4898('0x24')](_0x226a44);}return _0x14cabc[_0x4898('0x25')]();};}function saveUpdates(_0x8eaacb,_0x241b7c){return function(_0x66ae6b){if(_0x66ae6b){return _0x66ae6b['update'](_0x8eaacb)[_0x4898('0x26')](function(_0x5b3caa){return _0x5b3caa;});}return null;};}function removeEntity(_0x230b43,_0x262455){return function(_0x11be79){if(_0x11be79){return _0x11be79['destroy']()[_0x4898('0x26')](function(){var _0x108c72=_0x11be79[_0x4898('0x27')]({'plain':!![]});var _0x897ff8=_0x4898('0x28');return db[_0x4898('0x29')]['destroy']({'where':{'type':_0x897ff8,'resourceId':_0x108c72['id']}})[_0x4898('0x26')](function(){return _0x11be79;});})['then'](function(){_0x230b43['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48ac3d,_0x10c5a3){return function(_0x229de1){if(!_0x229de1){_0x48ac3d['sendStatus'](0x194);}return _0x229de1;};}function handleError(_0x56d8b3,_0x303746){_0x303746=_0x303746||0x1f4;return function(_0x197902){logger[_0x4898('0x2a')](_0x197902[_0x4898('0x2b')]);if(_0x197902[_0x4898('0x2c')]){delete _0x197902['name'];}_0x56d8b3['status'](_0x303746)['send'](_0x197902);};}exports['index']=function(_0x48150a,_0x5d0f44){var _0x179af2={},_0x39c15a={},_0x41d339={'count':0x0,'rows':[]};var _0x3fd303=_[_0x4898('0x2d')](db[_0x4898('0x2e')][_0x4898('0x2f')],function(_0x38c4be){return{'name':_0x38c4be[_0x4898('0x30')],'type':_0x38c4be[_0x4898('0x31')][_0x4898('0x32')]};});_0x39c15a[_0x4898('0x33')]=_[_0x4898('0x2d')](_0x3fd303,'name');_0x39c15a[_0x4898('0x34')]=_[_0x4898('0x35')](_0x48150a[_0x4898('0x34')]);_0x39c15a[_0x4898('0x36')]=_[_0x4898('0x37')](_0x39c15a[_0x4898('0x33')],_0x39c15a[_0x4898('0x34')]);_0x179af2[_0x4898('0x38')]=_[_0x4898('0x37')](_0x39c15a[_0x4898('0x33')],qs['fields'](_0x48150a[_0x4898('0x34')]['fields']));_0x179af2[_0x4898('0x38')]=_0x179af2[_0x4898('0x38')][_0x4898('0x39')]?_0x179af2[_0x4898('0x38')]:_0x39c15a[_0x4898('0x33')];if(!_0x48150a[_0x4898('0x34')][_0x4898('0x3a')](_0x4898('0x3b'))){_0x179af2[_0x4898('0x1d')]=qs[_0x4898('0x1d')](_0x48150a['query'][_0x4898('0x1d')]);_0x179af2[_0x4898('0x20')]=qs['offset'](_0x48150a[_0x4898('0x34')][_0x4898('0x20')]);}_0x179af2['order']=qs['sort'](_0x48150a[_0x4898('0x34')]['sort']);_0x179af2[_0x4898('0x3c')]=qs[_0x4898('0x36')](_[_0x4898('0x3d')](_0x48150a['query'],_0x39c15a[_0x4898('0x36')]),_0x3fd303);if(_0x48150a['query'][_0x4898('0x3e')]){_0x179af2[_0x4898('0x3c')]=_[_0x4898('0x3f')](_0x179af2[_0x4898('0x3c')],{'$or':_['map'](_0x3fd303,function(_0x149a95){if(_0x149a95[_0x4898('0x31')]!==_0x4898('0x40')){var _0x43dce8={};_0x43dce8[_0x149a95[_0x4898('0x2c')]]={'$like':'%'+_0x48150a[_0x4898('0x34')]['filter']+'%'};return _0x43dce8;}})});}_0x179af2=_['merge']({},_0x179af2,_0x48150a[_0x4898('0x41')]);var _0x30ad72={'where':_0x179af2['where']};return db[_0x4898('0x2e')][_0x4898('0x1f')](_0x30ad72)['then'](function(_0x2c6709){_0x41d339['count']=_0x2c6709;if(_0x48150a[_0x4898('0x34')]['includeAll']){_0x179af2[_0x4898('0x42')]=[{'all':!![]}];}return db[_0x4898('0x2e')][_0x4898('0x43')](_0x179af2);})[_0x4898('0x26')](function(_0x14bbae){_0x41d339[_0x4898('0x44')]=_0x14bbae;return _0x41d339;})['then'](respondWithFilteredResult(_0x5d0f44,_0x179af2))[_0x4898('0x45')](handleError(_0x5d0f44,null));};exports[_0x4898('0x46')]=function(_0x4b9afe,_0x308c28){var _0x4001bb={'raw':!![],'where':{'id':_0x4b9afe['params']['id']}},_0x32be58={};_0x32be58['model']=_[_0x4898('0x35')](db['Pause'][_0x4898('0x2f')]);_0x32be58[_0x4898('0x34')]=_[_0x4898('0x35')](_0x4b9afe[_0x4898('0x34')]);_0x32be58['filters']=_['intersection'](_0x32be58[_0x4898('0x33')],_0x32be58[_0x4898('0x34')]);_0x4001bb['attributes']=_['intersection'](_0x32be58[_0x4898('0x33')],qs[_0x4898('0x47')](_0x4b9afe['query'][_0x4898('0x47')]));_0x4001bb[_0x4898('0x38')]=_0x4001bb['attributes'][_0x4898('0x39')]?_0x4001bb[_0x4898('0x38')]:_0x32be58[_0x4898('0x33')];if(_0x4b9afe[_0x4898('0x34')][_0x4898('0x48')]){_0x4001bb['include']=[{'all':!![]}];}_0x4001bb=_[_0x4898('0x3f')]({},_0x4001bb,_0x4b9afe['options']);return db['Pause'][_0x4898('0x49')](_0x4001bb)[_0x4898('0x26')](handleEntityNotFound(_0x308c28,null))[_0x4898('0x26')](respondWithResult(_0x308c28,null))['catch'](handleError(_0x308c28,null));};exports[_0x4898('0x4a')]=function(_0x4f2c1a,_0x560ee1){return db['Pause'][_0x4898('0x4a')](_0x4f2c1a['body'],{})[_0x4898('0x26')](function(_0x368178){var _0x12f24f=_0x4f2c1a[_0x4898('0x4b')][_0x4898('0x27')]({'plain':!![]});if(!_0x12f24f)throw new Error(_0x4898('0x4c'));if(_0x12f24f[_0x4898('0x4d')]==='user'){var _0x129d1f=_0x368178[_0x4898('0x27')]({'plain':!![]});var _0x20fbef=_0x4898('0x28');return db[_0x4898('0x4e')][_0x4898('0x49')]({'where':{'name':_0x20fbef,'userProfileId':_0x12f24f[_0x4898('0x4f')]},'raw':!![]})[_0x4898('0x26')](function(_0x3b4e3d){if(_0x3b4e3d&&_0x3b4e3d[_0x4898('0x50')]===0x0){return db[_0x4898('0x29')][_0x4898('0x4a')]({'name':_0x129d1f[_0x4898('0x2c')],'resourceId':_0x129d1f['id'],'type':_0x3b4e3d[_0x4898('0x2c')],'sectionId':_0x3b4e3d['id']},{})['then'](function(){return _0x368178;});}else{return _0x368178;}})[_0x4898('0x45')](function(_0x16ee49){logger[_0x4898('0x2a')](_0x4898('0x51'),_0x16ee49);throw _0x16ee49;});}return _0x368178;})[_0x4898('0x26')](respondWithResult(_0x560ee1,0xc9))['catch'](handleError(_0x560ee1,null));};exports['update']=function(_0x35ca2a,_0xbab873){if(_0x35ca2a[_0x4898('0x52')]['id']){delete _0x35ca2a[_0x4898('0x52')]['id'];}return db[_0x4898('0x2e')]['find']({'where':{'id':_0x35ca2a[_0x4898('0x53')]['id']}})['then'](handleEntityNotFound(_0xbab873,null))['then'](saveUpdates(_0x35ca2a[_0x4898('0x52')],null))[_0x4898('0x26')](respondWithResult(_0xbab873,null))[_0x4898('0x45')](handleError(_0xbab873,null));};exports[_0x4898('0x54')]=function(_0xce1ba0,_0xecd313){return db[_0x4898('0x2e')][_0x4898('0x49')]({'where':{'id':_0xce1ba0[_0x4898('0x53')]['id']}})[_0x4898('0x26')](handleEntityNotFound(_0xecd313,null))[_0x4898('0x26')](removeEntity(_0xecd313,null))[_0x4898('0x45')](handleError(_0xecd313,null));}; \ No newline at end of file +var _0x47df=['error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','Pause','attributes','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Pauses','UserProfileResource'];(function(_0x51c726,_0x332b95){var _0x23fe86=function(_0x3145c8){while(--_0x3145c8){_0x51c726['push'](_0x51c726['shift']());}};_0x23fe86(++_0x332b95);}(_0x47df,0x124));var _0xf47d=function(_0x18b1fd,_0x31f706){_0x18b1fd=_0x18b1fd-0x0;var _0x1bca91=_0x47df[_0x18b1fd];return _0x1bca91;};'use strict';var emlformat=require(_0xf47d('0x0'));var rimraf=require(_0xf47d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf47d('0x2'));var rp=require(_0xf47d('0x3'));var moment=require('moment');var BPromise=require(_0xf47d('0x4'));var Mustache=require(_0xf47d('0x5'));var util=require(_0xf47d('0x6'));var path=require(_0xf47d('0x7'));var sox=require(_0xf47d('0x8'));var csv=require(_0xf47d('0x9'));var ejs=require(_0xf47d('0xa'));var fs=require('fs');var fs_extra=require(_0xf47d('0xb'));var _=require(_0xf47d('0xc'));var squel=require('squel');var crypto=require(_0xf47d('0xd'));var jsforce=require(_0xf47d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf47d('0x9'));var querystring=require('querystring');var Papa=require(_0xf47d('0xf'));var Redis=require(_0xf47d('0x10'));var authService=require(_0xf47d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf47d('0x12'))(_0xf47d('0x13'));var utils=require('../../config/utils');var config=require(_0xf47d('0x14'));var licenseUtil=require(_0xf47d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20e188,_0x4197cc){_0x4197cc=_0x4197cc||0xcc;return function(_0x36ff05){if(_0x36ff05){return _0x20e188[_0xf47d('0x16')](_0x4197cc);}return _0x20e188[_0xf47d('0x17')](_0x4197cc)[_0xf47d('0x18')]();};}function respondWithResult(_0x460bb3,_0x2c5658){_0x2c5658=_0x2c5658||0xc8;return function(_0x1ff226){if(_0x1ff226){return _0x460bb3[_0xf47d('0x17')](_0x2c5658)[_0xf47d('0x19')](_0x1ff226);}};}function respondWithFilteredResult(_0x26a515,_0x486510){return function(_0x112b4e){if(_0x112b4e){var _0x42f9bc=typeof _0x486510[_0xf47d('0x1a')]===_0xf47d('0x1b')&&typeof _0x486510[_0xf47d('0x1c')]===_0xf47d('0x1b');var _0x10a3b0=_0x112b4e[_0xf47d('0x1d')];var _0x42e1d5=_0x42f9bc?0x0:_0x486510[_0xf47d('0x1a')];var _0x4c0f98=_0x42f9bc?_0x112b4e[_0xf47d('0x1d')]:_0x486510['offset']+_0x486510['limit'];var _0x170437;if(_0x4c0f98>=_0x10a3b0){_0x4c0f98=_0x10a3b0;_0x170437=0xc8;}else{_0x170437=0xce;}_0x26a515[_0xf47d('0x17')](_0x170437);return _0x26a515[_0xf47d('0x1e')](_0xf47d('0x1f'),_0x42e1d5+'-'+_0x4c0f98+'/'+_0x10a3b0)[_0xf47d('0x19')](_0x112b4e);}return null;};}function patchUpdates(_0x18299d){return function(_0x413d3b){try{jsonpatch[_0xf47d('0x20')](_0x413d3b,_0x18299d,!![]);}catch(_0xdc6797){return BPromise[_0xf47d('0x21')](_0xdc6797);}return _0x413d3b[_0xf47d('0x22')]();};}function saveUpdates(_0x10a12e,_0x5ef534){return function(_0x5958b4){if(_0x5958b4){return _0x5958b4[_0xf47d('0x23')](_0x10a12e)[_0xf47d('0x24')](function(_0x48e677){return _0x48e677;});}return null;};}function removeEntity(_0x150d2d,_0xfd197d){return function(_0x10409b){if(_0x10409b){return _0x10409b[_0xf47d('0x25')]()[_0xf47d('0x24')](function(){var _0x11c22c=_0x10409b['get']({'plain':!![]});var _0x4e232f=_0xf47d('0x26');return db[_0xf47d('0x27')][_0xf47d('0x25')]({'where':{'type':_0x4e232f,'resourceId':_0x11c22c['id']}})[_0xf47d('0x24')](function(){return _0x10409b;});})['then'](function(){_0x150d2d[_0xf47d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bd750,_0x47fc9a){return function(_0x7b7ad6){if(!_0x7b7ad6){_0x1bd750[_0xf47d('0x16')](0x194);}return _0x7b7ad6;};}function handleError(_0x43b69e,_0x4fd025){_0x4fd025=_0x4fd025||0x1f4;return function(_0xdf1bd2){logger[_0xf47d('0x28')](_0xdf1bd2[_0xf47d('0x29')]);if(_0xdf1bd2['name']){delete _0xdf1bd2[_0xf47d('0x2a')];}_0x43b69e['status'](_0x4fd025)[_0xf47d('0x2b')](_0xdf1bd2);};}exports['index']=function(_0x596bc3,_0x39cec6){var _0x756742={},_0x22f8d5={},_0x5222cd={'count':0x0,'rows':[]};var _0xe19a5f=_['map'](db['Pause'][_0xf47d('0x2c')],function(_0x5d58da){return{'name':_0x5d58da[_0xf47d('0x2d')],'type':_0x5d58da[_0xf47d('0x2e')][_0xf47d('0x2f')]};});_0x22f8d5[_0xf47d('0x30')]=_[_0xf47d('0x31')](_0xe19a5f,_0xf47d('0x2a'));_0x22f8d5[_0xf47d('0x32')]=_[_0xf47d('0x33')](_0x596bc3[_0xf47d('0x32')]);_0x22f8d5[_0xf47d('0x34')]=_[_0xf47d('0x35')](_0x22f8d5[_0xf47d('0x30')],_0x22f8d5[_0xf47d('0x32')]);_0x756742['attributes']=_[_0xf47d('0x35')](_0x22f8d5[_0xf47d('0x30')],qs['fields'](_0x596bc3[_0xf47d('0x32')][_0xf47d('0x36')]));_0x756742['attributes']=_0x756742['attributes'][_0xf47d('0x37')]?_0x756742['attributes']:_0x22f8d5[_0xf47d('0x30')];if(!_0x596bc3['query'][_0xf47d('0x38')]('nolimit')){_0x756742['limit']=qs[_0xf47d('0x1c')](_0x596bc3['query'][_0xf47d('0x1c')]);_0x756742[_0xf47d('0x1a')]=qs[_0xf47d('0x1a')](_0x596bc3[_0xf47d('0x32')][_0xf47d('0x1a')]);}_0x756742[_0xf47d('0x39')]=qs[_0xf47d('0x3a')](_0x596bc3[_0xf47d('0x32')][_0xf47d('0x3a')]);_0x756742['where']=qs[_0xf47d('0x34')](_[_0xf47d('0x3b')](_0x596bc3[_0xf47d('0x32')],_0x22f8d5[_0xf47d('0x34')]),_0xe19a5f);if(_0x596bc3[_0xf47d('0x32')][_0xf47d('0x3c')]){_0x756742[_0xf47d('0x3d')]=_[_0xf47d('0x3e')](_0x756742['where'],{'$or':_[_0xf47d('0x31')](_0xe19a5f,function(_0x5ba9c6){if(_0x5ba9c6[_0xf47d('0x2e')]!==_0xf47d('0x3f')){var _0x2bbc13={};_0x2bbc13[_0x5ba9c6[_0xf47d('0x2a')]]={'$like':'%'+_0x596bc3[_0xf47d('0x32')][_0xf47d('0x3c')]+'%'};return _0x2bbc13;}})});}_0x756742=_['merge']({},_0x756742,_0x596bc3[_0xf47d('0x40')]);var _0x565ed3={'where':_0x756742[_0xf47d('0x3d')]};return db['Pause'][_0xf47d('0x1d')](_0x565ed3)[_0xf47d('0x24')](function(_0x2359f9){_0x5222cd[_0xf47d('0x1d')]=_0x2359f9;if(_0x596bc3[_0xf47d('0x32')][_0xf47d('0x41')]){_0x756742[_0xf47d('0x42')]=[{'all':!![]}];}return db['Pause']['findAll'](_0x756742);})[_0xf47d('0x24')](function(_0x1a95ce){_0x5222cd['rows']=_0x1a95ce;return _0x5222cd;})[_0xf47d('0x24')](respondWithFilteredResult(_0x39cec6,_0x756742))[_0xf47d('0x43')](handleError(_0x39cec6,null));};exports[_0xf47d('0x44')]=function(_0x4b027e,_0x3f56c5){var _0x2600d1={'raw':!![],'where':{'id':_0x4b027e[_0xf47d('0x45')]['id']}},_0x4872f9={};_0x4872f9[_0xf47d('0x30')]=_['keys'](db[_0xf47d('0x46')][_0xf47d('0x2c')]);_0x4872f9['query']=_['keys'](_0x4b027e[_0xf47d('0x32')]);_0x4872f9['filters']=_['intersection'](_0x4872f9[_0xf47d('0x30')],_0x4872f9[_0xf47d('0x32')]);_0x2600d1['attributes']=_[_0xf47d('0x35')](_0x4872f9['model'],qs[_0xf47d('0x36')](_0x4b027e['query'][_0xf47d('0x36')]));_0x2600d1[_0xf47d('0x47')]=_0x2600d1[_0xf47d('0x47')][_0xf47d('0x37')]?_0x2600d1[_0xf47d('0x47')]:_0x4872f9[_0xf47d('0x30')];if(_0x4b027e[_0xf47d('0x32')][_0xf47d('0x41')]){_0x2600d1[_0xf47d('0x42')]=[{'all':!![]}];}_0x2600d1=_[_0xf47d('0x3e')]({},_0x2600d1,_0x4b027e[_0xf47d('0x40')]);return db[_0xf47d('0x46')][_0xf47d('0x48')](_0x2600d1)[_0xf47d('0x24')](handleEntityNotFound(_0x3f56c5,null))[_0xf47d('0x24')](respondWithResult(_0x3f56c5,null))[_0xf47d('0x43')](handleError(_0x3f56c5,null));};exports[_0xf47d('0x49')]=function(_0x5e2993,_0x1bef4b){return db[_0xf47d('0x46')][_0xf47d('0x49')](_0x5e2993[_0xf47d('0x4a')],{})[_0xf47d('0x24')](function(_0x1f6977){var _0x40c9ad=_0x5e2993['user'][_0xf47d('0x4b')]({'plain':!![]});if(!_0x40c9ad)throw new Error(_0xf47d('0x4c'));if(_0x40c9ad[_0xf47d('0x4d')]===_0xf47d('0x4e')){var _0x2d1d83=_0x1f6977[_0xf47d('0x4b')]({'plain':!![]});var _0x446136=_0xf47d('0x26');return db[_0xf47d('0x4f')][_0xf47d('0x48')]({'where':{'name':_0x446136,'userProfileId':_0x40c9ad[_0xf47d('0x50')]},'raw':!![]})[_0xf47d('0x24')](function(_0x4a6ca2){if(_0x4a6ca2&&_0x4a6ca2[_0xf47d('0x51')]===0x0){return db[_0xf47d('0x27')][_0xf47d('0x49')]({'name':_0x2d1d83['name'],'resourceId':_0x2d1d83['id'],'type':_0x4a6ca2[_0xf47d('0x2a')],'sectionId':_0x4a6ca2['id']},{})[_0xf47d('0x24')](function(){return _0x1f6977;});}else{return _0x1f6977;}})[_0xf47d('0x43')](function(_0x4a35fd){logger[_0xf47d('0x28')](_0xf47d('0x52'),_0x4a35fd);throw _0x4a35fd;});}return _0x1f6977;})[_0xf47d('0x24')](respondWithResult(_0x1bef4b,0xc9))['catch'](handleError(_0x1bef4b,null));};exports['update']=function(_0x503521,_0x74ee2c){if(_0x503521[_0xf47d('0x4a')]['id']){delete _0x503521[_0xf47d('0x4a')]['id'];}return db[_0xf47d('0x46')][_0xf47d('0x48')]({'where':{'id':_0x503521[_0xf47d('0x45')]['id']}})['then'](handleEntityNotFound(_0x74ee2c,null))['then'](saveUpdates(_0x503521[_0xf47d('0x4a')],null))[_0xf47d('0x24')](respondWithResult(_0x74ee2c,null))[_0xf47d('0x43')](handleError(_0x74ee2c,null));};exports[_0xf47d('0x25')]=function(_0x3557ff,_0xbb36dd){return db[_0xf47d('0x46')]['find']({'where':{'id':_0x3557ff[_0xf47d('0x45')]['id']}})[_0xf47d('0x24')](handleEntityNotFound(_0xbb36dd,null))[_0xf47d('0x24')](removeEntity(_0xbb36dd,null))[_0xf47d('0x43')](handleError(_0xbb36dd,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 5a4921d..99797ef 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 _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x112fae,_0x5ecfaf){var _0x3eed96=function(_0x3c66de){while(--_0x3c66de){_0x112fae['push'](_0x112fae['shift']());}};_0x3eed96(++_0x5ecfaf);}(_0x814b,0x1a2));var _0xb814=function(_0x119e7a,_0x3949d3){_0x119e7a=_0x119e7a-0x0;var _0x1fb90a=_0x814b[_0x119e7a];return _0x1fb90a;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x2f410f,_0x442534){var _0x1fd083=function(_0x1cd8da){while(--_0x1cd8da){_0x2f410f['push'](_0x2f410f['shift']());}};_0x1fd083(++_0x442534);}(_0x1cb9,0x14e));var _0x91cb=function(_0x24f5f6,_0x1773ae){_0x24f5f6=_0x24f5f6-0x0;var _0x421209=_0x1cb9[_0x24f5f6];return _0x421209;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('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 e798d65..84b446e 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x8f0b5d,_0x1d801f){var _0x33615a=function(_0x523c71){while(--_0x523c71){_0x8f0b5d['push'](_0x8f0b5d['shift']());}};_0x33615a(++_0x1d801f);}(_0x7a54,0x106));var _0x47a5=function(_0xcfba0e,_0x35a7db){_0xcfba0e=_0xcfba0e-0x0;var _0x4420f9=_0x7a54[_0xcfba0e];return _0x4420f9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x2a3fad,_0x44ddcc){var _0xe930dc=function(_0x444eb4){while(--_0x444eb4){_0x2a3fad['push'](_0x2a3fad['shift']());}};_0xe930dc(++_0x44ddcc);}(_0x7a54,0x106));var _0x47a5=function(_0xb748c,_0x1058c1){_0xb748c=_0xb748c-0x0;var _0x407af5=_0x7a54[_0xb748c];return _0x407af5;};'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 e6bd258..f4d74fa 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 _0x9c44=['index','get','/webhook','webhookGet','/:id','show','download','diskStorage','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./plugin.controller','isAuthenticated'];(function(_0x40c894,_0x39921f){var _0x22430f=function(_0x19055){while(--_0x19055){_0x40c894['push'](_0x40c894['shift']());}};_0x22430f(++_0x39921f);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'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'),controller[_0x49c4('0xb')]);router['get'](_0x49c4('0xc'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router[_0x49c4('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x49c4('0xe')]);var upload=multer({'storage':multer[_0x49c4('0xf')]({'destination':function(_0x58cad7,_0xb611a1,_0x459d09){_0x459d09(null,path['join'](config['root'],_0x49c4('0x10')));},'filename':function(_0x6d1b08,_0x5487cd,_0x7df3a9){_0x5487cd[_0x49c4('0x11')]=_0x5487cd['originalname'][_0x49c4('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x7df3a9(null,util[_0x49c4('0x13')](_0x49c4('0x14'),path[_0x49c4('0x15')](_0x5487cd[_0x49c4('0x11')],path[_0x49c4('0x16')](_0x5487cd[_0x49c4('0x11')])),Date[_0x49c4('0x17')](),path['extname'](_0x5487cd[_0x49c4('0x11')])));}})});router[_0x49c4('0x18')]('/',upload[_0x49c4('0x19')](_0x49c4('0x1a')),controller[_0x49c4('0x1b')]);router['post'](_0x49c4('0xa'),controller[_0x49c4('0x1c')]);router['put']('/:id',auth[_0x49c4('0x7')](),controller[_0x49c4('0x1d')]);router[_0x49c4('0x1e')]('/:id',auth[_0x49c4('0x7')](),controller['delete']);module[_0x49c4('0x1f')]=router; \ No newline at end of file +var _0xb7c8=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','originalname','replace','format','basename','extname','now','post','single','file','upload','webhookPost','put','update','delete'];(function(_0x50edc1,_0x42d8de){var _0x1b083e=function(_0x44bd3d){while(--_0x44bd3d){_0x50edc1['push'](_0x50edc1['shift']());}};_0x1b083e(++_0x42d8de);}(_0xb7c8,0x119));var _0x8b7c=function(_0x22c929,_0x22bacc){_0x22c929=_0x22c929-0x0;var _0x418cd6=_0xb7c8[_0x22c929];return _0x418cd6;};'use strict';var multer=require('multer');var util=require(_0x8b7c('0x0'));var path=require(_0x8b7c('0x1'));var timeout=require(_0x8b7c('0x2'));var express=require(_0x8b7c('0x3'));var router=express[_0x8b7c('0x4')]();var fs_extra=require(_0x8b7c('0x5'));var auth=require(_0x8b7c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8b7c('0x7'));var controller=require(_0x8b7c('0x8'));router[_0x8b7c('0x9')]('/',auth[_0x8b7c('0xa')](),controller[_0x8b7c('0xb')]);router[_0x8b7c('0x9')](_0x8b7c('0xc'),controller[_0x8b7c('0xd')]);router[_0x8b7c('0x9')](_0x8b7c('0xe'),auth[_0x8b7c('0xa')](),controller[_0x8b7c('0xf')]);router['get'](_0x8b7c('0x10'),auth['isAuthenticated'](),controller[_0x8b7c('0x11')]);var upload=multer({'storage':multer[_0x8b7c('0x12')]({'destination':function(_0x5868ec,_0x189a25,_0x452e83){_0x452e83(null,path[_0x8b7c('0x13')](config['root'],'server/files/plugins'));},'filename':function(_0x1c7471,_0x33c5aa,_0x297c39){_0x33c5aa[_0x8b7c('0x14')]=_0x33c5aa[_0x8b7c('0x14')][_0x8b7c('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x297c39(null,util[_0x8b7c('0x16')]('%s-%s%s',path[_0x8b7c('0x17')](_0x33c5aa[_0x8b7c('0x14')],path[_0x8b7c('0x18')](_0x33c5aa['originalname'])),Date[_0x8b7c('0x19')](),path[_0x8b7c('0x18')](_0x33c5aa['originalname'])));}})});router[_0x8b7c('0x1a')]('/',upload[_0x8b7c('0x1b')](_0x8b7c('0x1c')),controller[_0x8b7c('0x1d')]);router[_0x8b7c('0x1a')]('/webhook',controller[_0x8b7c('0x1e')]);router[_0x8b7c('0x1f')](_0x8b7c('0xe'),auth[_0x8b7c('0xa')](),controller[_0x8b7c('0x20')]);router['delete'](_0x8b7c('0xe'),auth[_0x8b7c('0xa')](),controller[_0x8b7c('0x21')]);module[_0x8b7c('0x22')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 8337c31..a5a6b2c 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 _0x35a0=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','ENUM','html','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','always','never'];(function(_0x3535d0,_0x4b85bd){var _0x45b51e=function(_0x5c1833){while(--_0x5c1833){_0x3535d0['push'](_0x3535d0['shift']());}};_0x45b51e(++_0x4b85bd);}(_0x35a0,0x85));var _0x035a=function(_0x41ac07,_0x3b7b7a){_0x41ac07=_0x41ac07-0x0;var _0x523e12=_0x35a0[_0x41ac07];return _0x523e12;};'use strict';var Sequelize=require('sequelize');module[_0x035a('0x0')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x035a('0x1')](_0x035a('0x2'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x035a('0x3')]},'path':{'type':Sequelize[_0x035a('0x4')],'comment':_0x035a('0x5')},'active':{'type':Sequelize[_0x035a('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x035a('0x1')](_0x035a('0x7'),_0x035a('0x8'),_0x035a('0x9'),_0x035a('0xa')),'defaultValue':_0x035a('0x9'),'comment':_0x035a('0xb')},'icon':{'type':Sequelize[_0x035a('0x4')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x035a('0x4')]},'scriptPath':{'type':Sequelize[_0x035a('0x4')]}}; \ No newline at end of file +var _0xa317=['ENUM','html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa317,0xde));var _0x7a31=function(_0x387f3a,_0x288a2e){_0x387f3a=_0x387f3a-0x0;var _0x30d5ce=_0xa317[_0x387f3a];return _0x30d5ce;};'use strict';var Sequelize=require(_0x7a31('0x0'));module[_0x7a31('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7a31('0x2')](_0x7a31('0x3'),_0x7a31('0x4'))},'description':{'type':Sequelize[_0x7a31('0x5')]},'version':{'type':Sequelize[_0x7a31('0x5')]},'path':{'type':Sequelize[_0x7a31('0x6')],'comment':_0x7a31('0x7')},'active':{'type':Sequelize[_0x7a31('0x8')],'defaultValue':0x0,'comment':_0x7a31('0x9')},'sidebar':{'type':Sequelize[_0x7a31('0x2')](_0x7a31('0xa'),_0x7a31('0xb'),'always',_0x7a31('0xc')),'defaultValue':'always','comment':_0x7a31('0xd')},'icon':{'type':Sequelize[_0x7a31('0x6')]},'adminUrl':{'type':Sequelize[_0x7a31('0x6')]},'agentUrl':{'type':Sequelize[_0x7a31('0x6')]},'scriptName':{'type':Sequelize[_0x7a31('0x6')]},'scriptPath':{'type':Sequelize[_0x7a31('0x6')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 3c622ef..b59487a 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 _0x6a2d=['plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','dirname','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','encoding','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','update','then','get','Plugins','UserProfileResource','destroy','stack','name','send','index','map','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','Plugin','includeAll','include','findAll','rows','show','params','rawAttributes','length','options','catch','download','find','join','root','format','%s.zip','basename','createWriteStream','warning','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','upload','extname','file','filename','info','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','admin','test'];(function(_0x3e69e2,_0x6f8cbd){var _0x4ebbf2=function(_0x1ce91b){while(--_0x1ce91b){_0x3e69e2['push'](_0x3e69e2['shift']());}};_0x4ebbf2(++_0x6f8cbd);}(_0x6a2d,0xcc));var _0xd6a2=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6a2d[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xd6a2('0x0'));var rimraf=require(_0xd6a2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd6a2('0x2'));var rp=require(_0xd6a2('0x3'));var moment=require(_0xd6a2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd6a2('0x5'));var util=require(_0xd6a2('0x6'));var path=require(_0xd6a2('0x7'));var sox=require(_0xd6a2('0x8'));var csv=require(_0xd6a2('0x9'));var ejs=require(_0xd6a2('0xa'));var fs=require('fs');var fs_extra=require(_0xd6a2('0xb'));var _=require(_0xd6a2('0xc'));var squel=require('squel');var crypto=require(_0xd6a2('0xd'));var jsforce=require(_0xd6a2('0xe'));var deskjs=require(_0xd6a2('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd6a2('0x10'));var Papa=require(_0xd6a2('0x11'));var extract=require(_0xd6a2('0x12'));var rimraf=require('rimraf');var archiver=require(_0xd6a2('0x13'));var Redis=require('ioredis');var authService=require(_0xd6a2('0x14'));var qs=require(_0xd6a2('0x15'));var as=require(_0xd6a2('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd6a2('0x17'));var config=require(_0xd6a2('0x18'));var licenseUtil=require(_0xd6a2('0x19'));var db=require('../../mysqldb')['db'];config[_0xd6a2('0x1a')]=_[_0xd6a2('0x1b')](config[_0xd6a2('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xd6a2('0x1c'))(new Redis(config[_0xd6a2('0x1a')]));require(_0xd6a2('0x1d'))[_0xd6a2('0x1e')](socket);function respondWithStatusCode(_0x28af8c,_0x5cc29f){_0x5cc29f=_0x5cc29f||0xcc;return function(_0x51d05a){if(_0x51d05a){return _0x28af8c[_0xd6a2('0x1f')](_0x5cc29f);}return _0x28af8c[_0xd6a2('0x20')](_0x5cc29f)[_0xd6a2('0x21')]();};}function respondWithResult(_0x1da53e,_0x292ef7){_0x292ef7=_0x292ef7||0xc8;return function(_0x49b4f8){if(_0x49b4f8){return _0x1da53e[_0xd6a2('0x20')](_0x292ef7)['json'](_0x49b4f8);}};}function respondWithFilteredResult(_0x49d152,_0xaeb827){return function(_0x1b2d9d){if(_0x1b2d9d){var _0x3f9d33=typeof _0xaeb827[_0xd6a2('0x22')]===_0xd6a2('0x23')&&typeof _0xaeb827[_0xd6a2('0x24')]===_0xd6a2('0x23');var _0x1ccbbb=_0x1b2d9d[_0xd6a2('0x25')];var _0x14cdea=_0x3f9d33?0x0:_0xaeb827[_0xd6a2('0x22')];var _0x4b85f6=_0x3f9d33?_0x1b2d9d[_0xd6a2('0x25')]:_0xaeb827[_0xd6a2('0x22')]+_0xaeb827[_0xd6a2('0x24')];var _0x25398b;if(_0x4b85f6>=_0x1ccbbb){_0x4b85f6=_0x1ccbbb;_0x25398b=0xc8;}else{_0x25398b=0xce;}_0x49d152[_0xd6a2('0x20')](_0x25398b);return _0x49d152[_0xd6a2('0x26')]('Content-Range',_0x14cdea+'-'+_0x4b85f6+'/'+_0x1ccbbb)[_0xd6a2('0x27')](_0x1b2d9d);}return null;};}function patchUpdates(_0x4ac3e2){return function(_0x39fa99){try{jsonpatch['apply'](_0x39fa99,_0x4ac3e2,!![]);}catch(_0x3dd951){return BPromise[_0xd6a2('0x28')](_0x3dd951);}return _0x39fa99['save']();};}function saveUpdates(_0x329293,_0x19cc2a){return function(_0x44efce){if(_0x44efce){return _0x44efce[_0xd6a2('0x29')](_0x329293)[_0xd6a2('0x2a')](function(_0x79f13b){return _0x79f13b;});}return null;};}function removeEntity(_0x34382e,_0x2e1e1b){return function(_0x5a8c73){if(_0x5a8c73){return _0x5a8c73['destroy']()[_0xd6a2('0x2a')](function(){var _0x57aa99=_0x5a8c73[_0xd6a2('0x2b')]({'plain':!![]});var _0x53e1b4=_0xd6a2('0x2c');return db[_0xd6a2('0x2d')][_0xd6a2('0x2e')]({'where':{'type':_0x53e1b4,'resourceId':_0x57aa99['id']}})[_0xd6a2('0x2a')](function(){return _0x5a8c73;});})[_0xd6a2('0x2a')](function(){_0x34382e['status'](0xcc)[_0xd6a2('0x21')]();});}};}function handleEntityNotFound(_0x566d5a,_0x28f781){return function(_0x1ca5c7){if(!_0x1ca5c7){_0x566d5a[_0xd6a2('0x1f')](0x194);}return _0x1ca5c7;};}function handleError(_0x4a88c4,_0x2e2930){_0x2e2930=_0x2e2930||0x1f4;return function(_0x1843c6){logger['error'](_0x1843c6[_0xd6a2('0x2f')]);if(_0x1843c6[_0xd6a2('0x30')]){delete _0x1843c6[_0xd6a2('0x30')];}_0x4a88c4['status'](_0x2e2930)[_0xd6a2('0x31')](_0x1843c6);};}exports[_0xd6a2('0x32')]=function(_0x2e5622,_0x105cef){var _0x18aac0={},_0x399f44={},_0x4c10d8={'count':0x0,'rows':[]};var _0x4d9727=_[_0xd6a2('0x33')](db['Plugin']['rawAttributes'],function(_0xb77b38){return{'name':_0xb77b38['fieldName'],'type':_0xb77b38[_0xd6a2('0x34')][_0xd6a2('0x35')]};});_0x399f44[_0xd6a2('0x36')]=_[_0xd6a2('0x33')](_0x4d9727,'name');_0x399f44[_0xd6a2('0x37')]=_[_0xd6a2('0x38')](_0x2e5622['query']);_0x399f44['filters']=_[_0xd6a2('0x39')](_0x399f44[_0xd6a2('0x36')],_0x399f44[_0xd6a2('0x37')]);_0x18aac0[_0xd6a2('0x3a')]=_[_0xd6a2('0x39')](_0x399f44['model'],qs[_0xd6a2('0x3b')](_0x2e5622['query'][_0xd6a2('0x3b')]));_0x18aac0[_0xd6a2('0x3a')]=_0x18aac0[_0xd6a2('0x3a')]['length']?_0x18aac0[_0xd6a2('0x3a')]:_0x399f44['model'];if(!_0x2e5622[_0xd6a2('0x37')]['hasOwnProperty'](_0xd6a2('0x3c'))){_0x18aac0[_0xd6a2('0x24')]=qs[_0xd6a2('0x24')](_0x2e5622['query'][_0xd6a2('0x24')]);_0x18aac0[_0xd6a2('0x22')]=qs[_0xd6a2('0x22')](_0x2e5622['query']['offset']);}_0x18aac0[_0xd6a2('0x3d')]=qs['sort'](_0x2e5622['query']['sort']);_0x18aac0[_0xd6a2('0x3e')]=qs[_0xd6a2('0x3f')](_[_0xd6a2('0x40')](_0x2e5622[_0xd6a2('0x37')],_0x399f44['filters']),_0x4d9727);if(_0x2e5622[_0xd6a2('0x37')][_0xd6a2('0x41')]){_0x18aac0['where']=_[_0xd6a2('0x42')](_0x18aac0[_0xd6a2('0x3e')],{'$or':_[_0xd6a2('0x33')](_0x4d9727,function(_0x5296c9){if(_0x5296c9[_0xd6a2('0x34')]!==_0xd6a2('0x43')){var _0x3f38fe={};_0x3f38fe[_0x5296c9['name']]={'$like':'%'+_0x2e5622[_0xd6a2('0x37')]['filter']+'%'};return _0x3f38fe;}})});}_0x18aac0=_['merge']({},_0x18aac0,_0x2e5622['options']);var _0x5ece30={'where':_0x18aac0[_0xd6a2('0x3e')]};return db[_0xd6a2('0x44')][_0xd6a2('0x25')](_0x5ece30)[_0xd6a2('0x2a')](function(_0x578f33){_0x4c10d8[_0xd6a2('0x25')]=_0x578f33;if(_0x2e5622[_0xd6a2('0x37')][_0xd6a2('0x45')]){_0x18aac0[_0xd6a2('0x46')]=[{'all':!![]}];}return db['Plugin'][_0xd6a2('0x47')](_0x18aac0);})[_0xd6a2('0x2a')](function(_0x506339){_0x4c10d8[_0xd6a2('0x48')]=_0x506339;return _0x4c10d8;})[_0xd6a2('0x2a')](respondWithFilteredResult(_0x105cef,_0x18aac0))['catch'](handleError(_0x105cef,null));};exports[_0xd6a2('0x49')]=function(_0x15dc31,_0x492c6c){var _0x545ba1={'raw':!![],'where':{'id':_0x15dc31[_0xd6a2('0x4a')]['id']}},_0x4a0c3f={};_0x4a0c3f[_0xd6a2('0x36')]=_['keys'](db[_0xd6a2('0x44')][_0xd6a2('0x4b')]);_0x4a0c3f[_0xd6a2('0x37')]=_[_0xd6a2('0x38')](_0x15dc31[_0xd6a2('0x37')]);_0x4a0c3f[_0xd6a2('0x3f')]=_['intersection'](_0x4a0c3f['model'],_0x4a0c3f[_0xd6a2('0x37')]);_0x545ba1[_0xd6a2('0x3a')]=_[_0xd6a2('0x39')](_0x4a0c3f['model'],qs[_0xd6a2('0x3b')](_0x15dc31[_0xd6a2('0x37')][_0xd6a2('0x3b')]));_0x545ba1[_0xd6a2('0x3a')]=_0x545ba1[_0xd6a2('0x3a')][_0xd6a2('0x4c')]?_0x545ba1[_0xd6a2('0x3a')]:_0x4a0c3f['model'];if(_0x15dc31[_0xd6a2('0x37')][_0xd6a2('0x45')]){_0x545ba1['include']=[{'all':!![]}];}_0x545ba1=_[_0xd6a2('0x42')]({},_0x545ba1,_0x15dc31[_0xd6a2('0x4d')]);return db[_0xd6a2('0x44')]['find'](_0x545ba1)[_0xd6a2('0x2a')](handleEntityNotFound(_0x492c6c,null))[_0xd6a2('0x2a')](respondWithResult(_0x492c6c,null))[_0xd6a2('0x4e')](handleError(_0x492c6c,null));};exports[_0xd6a2('0x4f')]=function(_0x30ac3b,_0x3aa43f,_0xaab390){return db[_0xd6a2('0x44')][_0xd6a2('0x50')]({'where':{'id':_0x30ac3b[_0xd6a2('0x4a')]['id']},'attributes':[_0xd6a2('0x30'),'path'],'raw':!![]})['then'](handleEntityNotFound(_0x3aa43f,null))[_0xd6a2('0x2a')](function(_0x3d5756){if(_0x3d5756){var _0x18837c=path[_0xd6a2('0x51')](config[_0xd6a2('0x52')],'server/files/plugins',util[_0xd6a2('0x53')](_0xd6a2('0x54'),path[_0xd6a2('0x55')](_0x3d5756[_0xd6a2('0x7')])));var _0x4b6d83=fs[_0xd6a2('0x56')](_0x18837c);var _0x39198b=archiver('zip',{'zlib':{'level':0x9}});_0x39198b['on'](_0xd6a2('0x57'),function(_0x2b1f12){if(_0x2b1f12['code']===_0xd6a2('0x58')){logger[_0xd6a2('0x59')](_0x2b1f12);}else{throw new db[(_0xd6a2('0x5a'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x39198b['on'](_0xd6a2('0x59'),function(_0x4eb66b){throw new db[(_0xd6a2('0x5a'))][(_0xd6a2('0x5b'))](_0xd6a2('0x5c'));});_0x39198b[_0xd6a2('0x5d')](_0x4b6d83);_0x39198b[_0xd6a2('0x5e')](_0xd6a2('0x5f'),{'cwd':path[_0xd6a2('0x51')](config[_0xd6a2('0x52')],_0xd6a2('0x60'),path['dirname'](_0x3d5756[_0xd6a2('0x7')])),'ignore':[path[_0xd6a2('0x51')](path[_0xd6a2('0x55')](_0x3d5756[_0xd6a2('0x7')]),'node_modules/**/*'),path[_0xd6a2('0x51')](path[_0xd6a2('0x55')](_0x3d5756['path']),_0xd6a2('0x61'))],'nodir':!![]})[_0xd6a2('0x62')]();_0x4b6d83['on'](_0xd6a2('0x63'),function(){if(!fs[_0xd6a2('0x64')](_0x18837c)){throw new db['Sequelize']['Error'](_0xd6a2('0x65'));}return _0x3aa43f[_0xd6a2('0x4f')](_0x18837c,util[_0xd6a2('0x53')](_0xd6a2('0x54'),path[_0xd6a2('0x55')](_0x3d5756[_0xd6a2('0x7')])),function(_0x1c2b34){if(_0x1c2b34){throw new db[(_0xd6a2('0x5a'))][(_0xd6a2('0x5b'))](_0xd6a2('0x66'));}fs['unlinkSync'](_0x18837c);logger['info'](_0xd6a2('0x67'));logger['info']('Temporary\x20file\x20removed');});});}return null;})[_0xd6a2('0x4e')](handleError(_0x3aa43f,null));};exports[_0xd6a2('0x68')]=function(_0x12ae61,_0x2d3993,_0xe2dd90){var _0xab9ce9=path[_0xd6a2('0x55')](_0x12ae61['file']['filename'],path[_0xd6a2('0x69')](_0x12ae61[_0xd6a2('0x6a')][_0xd6a2('0x6b')]));var _0x143f21=path[_0xd6a2('0x51')](config[_0xd6a2('0x52')],_0xd6a2('0x60'),_0x12ae61[_0xd6a2('0x6a')][_0xd6a2('0x6b')]);var _0x427c5c=path[_0xd6a2('0x51')](config[_0xd6a2('0x52')],'server/files/plugins',_0xab9ce9);logger[_0xd6a2('0x6c')](_0xd6a2('0x6d'),_0x143f21);logger['info'](_0xd6a2('0x6e'),_0x427c5c);try{fs['chmodSync'](_0x143f21,parseInt('0777',0x8));extract(_0x143f21,{'dir':_0x427c5c},function(_0x449e39){if(_0x449e39){logger[_0xd6a2('0x59')](_0x449e39);handleError(_0x449e39,!![]);};var _0x3d2e33=fs['readdirSync'](_0x427c5c);if(_0x3d2e33[_0xd6a2('0x4c')]>0x1){removeReferences(_0x143f21,_0x427c5c);logger['error']('Invalid\x20plugin\x20structure');return _0xe2dd90(new Error(_0xd6a2('0x6f')));}var _0x3e79bd=fs[_0xd6a2('0x70')](path[_0xd6a2('0x51')](_0x427c5c,_0x3d2e33[0x0]));if(_0x3e79bd[_0xd6a2('0x71')]()){removeReferences(_0x143f21,_0x427c5c);logger[_0xd6a2('0x59')](_0xd6a2('0x6f'));return _0xe2dd90(new Error(_0xd6a2('0x6f')));}if(_0x3e79bd[_0xd6a2('0x72')]()){var _0x458b18=fs[_0xd6a2('0x73')](path[_0xd6a2('0x51')](_0x427c5c,_0x3d2e33[0x0]));if(_0x458b18[_0xd6a2('0x4c')]===0x0){removeReferences(_0x143f21,_0x427c5c);logger[_0xd6a2('0x59')](_0xd6a2('0x6f'));return _0xe2dd90(new Error(_0xd6a2('0x6f')));}var _0x302a6a=_0x458b18[_0xd6a2('0x74')](function(_0x486898){return _0x486898===_0xd6a2('0x75');});if(!_0x302a6a){return _0xe2dd90(new Error(_0xd6a2('0x76')));}var _0x4c6347=fs['readFileSync'](path[_0xd6a2('0x51')](_0x427c5c,_0x3d2e33[0x0],'manifest.json'));var _0x328954=JSON[_0xd6a2('0x77')](_0x4c6347);if(_0xd6a2('0x23')==typeof _0x328954[_0xd6a2('0x30')]){return _0xe2dd90(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xd6a2('0x23')==typeof _0x328954[_0xd6a2('0x34')]){return _0xe2dd90(new Error(_0xd6a2('0x78')));}if(_0xd6a2('0x23')==typeof _0x328954['version']){return _0xe2dd90(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xd6a2('0x23')==typeof _0x328954['parameters']){return _0xe2dd90(new Error(_0xd6a2('0x79')));}if(_0x328954[_0xd6a2('0x34')]===_0xd6a2('0x7a')){if('undefined'==typeof _0x328954[_0xd6a2('0x7b')][_0xd6a2('0x7c')]){return _0xe2dd90(new Error(_0xd6a2('0x7d')));}if(_0xd6a2('0x23')==typeof _0x328954['parameters'][_0xd6a2('0x7c')]['admin']&&_0xd6a2('0x23')==typeof _0x328954['parameters'][_0xd6a2('0x7c')]['agent']){return _0xe2dd90(new Error(_0xd6a2('0x7e')));}}else if(_0x328954['type']==='script'){if(_0xd6a2('0x23')==typeof _0x328954[_0xd6a2('0x7b')][_0xd6a2('0x7f')]){return _0xe2dd90(new Error(_0xd6a2('0x80')));}if('undefined'==typeof _0x328954[_0xd6a2('0x7b')][_0xd6a2('0x81')]){return _0xe2dd90(new Error(_0xd6a2('0x82')));}}else{return _0xe2dd90(new Error(_0xd6a2('0x83')));}var _0x3a49d6=_0x328954[_0xd6a2('0x30')];var _0x6c3d82=_0x328954[_0xd6a2('0x84')];var _0x26a6fa=_0x328954['type'];var _0xdb3678=_0x328954[_0xd6a2('0x85')]?_0x328954['sidebar']:_0xd6a2('0x86');var _0x3690ea=_0x328954[_0xd6a2('0x87')]?_0x328954[_0xd6a2('0x87')]:_0xd6a2('0x88');var _0x152657='';var _0x57b738='';var _0x5c983e='';var _0x8e5506='';var _0x413356=_0x328954[_0xd6a2('0x89')];if(_0x26a6fa==='html'){if(_0xd6a2('0x23')!=typeof _0x328954['parameters'][_0xd6a2('0x7c')]['admin']){var _0x4db1d8=_0x328954[_0xd6a2('0x7b')][_0xd6a2('0x7c')][_0xd6a2('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0xd6a2('0x8b')](_0x4db1d8)){_0x152657=path[_0xd6a2('0x51')](_0xd6a2('0x8c'),_0xab9ce9,_0x3d2e33[0x0],_0x4db1d8);}else{_0x152657=_0x4db1d8;}}else{logger[_0xd6a2('0x6c')](_0xd6a2('0x8d'));}if(_0xd6a2('0x23')!=typeof _0x328954[_0xd6a2('0x7b')][_0xd6a2('0x7c')]['agent']){var _0x4de030=_0x328954[_0xd6a2('0x7b')][_0xd6a2('0x7c')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x4de030)){_0x57b738=path['join'](_0xd6a2('0x8c'),_0xab9ce9,_0x3d2e33[0x0],_0x4de030);}else{_0x57b738=_0x4de030;}}else{logger[_0xd6a2('0x6c')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x26a6fa==='script'){_0x5c983e=_0x328954[_0xd6a2('0x7b')][_0xd6a2('0x7f')];_0x8e5506=_0x328954[_0xd6a2('0x7b')][_0xd6a2('0x81')];if(_0xd6a2('0x23')!=typeof _0x328954[_0xd6a2('0x7b')]['views']){if(_0xd6a2('0x23')!=typeof _0x328954[_0xd6a2('0x7b')][_0xd6a2('0x7c')][_0xd6a2('0x8a')]){var _0x4db1d8=_0x328954[_0xd6a2('0x7b')][_0xd6a2('0x7c')][_0xd6a2('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0xd6a2('0x8b')](_0x4db1d8)){_0x152657=path['join'](_0xd6a2('0x8c'),_0xab9ce9,_0x3d2e33[0x0],_0x4db1d8);}else{_0x152657=_0x4db1d8;}}if(_0xd6a2('0x23')!=typeof _0x328954[_0xd6a2('0x7b')][_0xd6a2('0x7c')][_0xd6a2('0x8e')]){var _0x4de030=_0x328954[_0xd6a2('0x7b')][_0xd6a2('0x7c')][_0xd6a2('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0xd6a2('0x8b')](_0x4de030)){_0x57b738=path['join'](_0xd6a2('0x8c'),_0xab9ce9,_0x3d2e33[0x0],_0x4de030);}else{_0x57b738=_0x4de030;}}}}var _0x4cf436={'name':_0x3a49d6,'description':_0x6c3d82,'path':path[_0xd6a2('0x51')](_0xab9ce9,_0x3d2e33[0x0]),'type':_0x26a6fa,'sidebar':_0xdb3678,'icon':_0x3690ea,'adminUrl':_0x152657,'agentUrl':_0x57b738,'scriptName':_0x5c983e,'scriptPath':_0x8e5506,'version':_0x413356};removeReferences(_0x143f21,null);return db['Plugin'][_0xd6a2('0x8f')](_0x4cf436)['then'](function(_0x384534){var _0x34cd6c={'role':_0x12ae61[_0xd6a2('0x90')]['role'],'userProfileId':_0x12ae61[_0xd6a2('0x90')][_0xd6a2('0x91')]};if(!_0x34cd6c)throw new Error(_0xd6a2('0x92'));if(_0x34cd6c[_0xd6a2('0x93')]===_0xd6a2('0x94')){var _0x10e424=_0x384534['get']({'plain':!![]});return db['UserProfileSection'][_0xd6a2('0x50')]({'where':{'name':'Plugins','userProfileId':_0x34cd6c[_0xd6a2('0x91')]},'raw':!![]})[_0xd6a2('0x2a')](function(_0x413315){if(_0x413315&&_0x413315[_0xd6a2('0x95')]===0x0){return db[_0xd6a2('0x2d')][_0xd6a2('0x8f')]({'name':_0x10e424[_0xd6a2('0x30')],'resourceId':_0x10e424['id'],'type':_0x413315[_0xd6a2('0x30')],'sectionId':_0x413315['id']},{})[_0xd6a2('0x2a')](function(){return _0x384534;});}else{return _0x384534;}})['catch'](function(_0x339cac){logger[_0xd6a2('0x59')](_0xd6a2('0x96'),_0x339cac);throw _0x339cac;});}return _0x384534;})[_0xd6a2('0x2a')](respondWithResult(_0x2d3993,null))[_0xd6a2('0x4e')](handleError(_0x2d3993,null));}});}catch(_0x313cb3){_0x2d3993[_0xd6a2('0x20')](0x1f4)['send'](_0x313cb3);}};function removeReferences(_0x317839,_0x13c1c0){try{if(_0x317839){fs[_0xd6a2('0x97')](_0x317839);logger['info'](_0xd6a2('0x98'));}if(_0x13c1c0){rimraf(_0x13c1c0,function(){});logger[_0xd6a2('0x6c')](_0xd6a2('0x99'));}}catch(_0xa420ba){logger['error'](_0xa420ba);}}exports[_0xd6a2('0x29')]=function(_0x905637,_0x30fe4c,_0x556091){return db[_0xd6a2('0x44')][_0xd6a2('0x50')]({'where':{'id':_0x905637[_0xd6a2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x30fe4c,null))[_0xd6a2('0x2a')](saveUpdates(_0x905637[_0xd6a2('0x90')],null))['then'](respondWithResult(_0x30fe4c,null))[_0xd6a2('0x4e')](handleError(_0x30fe4c,null));};exports[_0xd6a2('0x9a')]=function(_0x4a1b00,_0x4f22d1,_0x22065d){return db[_0xd6a2('0x44')][_0xd6a2('0x50')]({'where':{'id':_0x4a1b00[_0xd6a2('0x4a')]['id']}})[_0xd6a2('0x2a')](function(_0x373315){if(_0x373315){return _0x373315[_0xd6a2('0x2e')]();}})[_0xd6a2('0x2a')](function(_0x2d0699){rimraf(path[_0xd6a2('0x51')](config[_0xd6a2('0x52')],'server/files/plugins',path[_0xd6a2('0x9b')](_0x2d0699[_0xd6a2('0x7')])),function(){});return _0x2d0699;})[_0xd6a2('0x2a')](handleEntityNotFound(_0x4f22d1,null))[_0xd6a2('0x2a')](respondWithStatusCode(_0x4f22d1,null))[_0xd6a2('0x4e')](handleError(_0x4f22d1,null));};exports[_0xd6a2('0x9c')]=function(_0x28b0f7,_0x142bec,_0x199407){return BPromise[_0xd6a2('0x9d')]()[_0xd6a2('0x2a')](function(){if(!_0x28b0f7[_0xd6a2('0x37')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x28b0f7[_0xd6a2('0x37')][_0xd6a2('0x9e')]){throw new Error(_0xd6a2('0x9f'));}var _0x395de6=_0x28b0f7[_0xd6a2('0x37')]['hostname']?_0x28b0f7[_0xd6a2('0x37')][_0xd6a2('0xa0')]+':'+_0x28b0f7[_0xd6a2('0x37')][_0xd6a2('0x9e')]:_0xd6a2('0xa1')+_0x28b0f7['query'][_0xd6a2('0x9e')];var _0x51a535=_0x28b0f7[_0xd6a2('0x37')][_0xd6a2('0x27')]?_0x28b0f7[_0xd6a2('0x37')][_0xd6a2('0x27')]:!![];var _0x360fa0=_0x28b0f7['query']['encoding']?_0x28b0f7[_0xd6a2('0x37')]['encoding']:null;var _0x8bd4c9={'method':_0x28b0f7[_0xd6a2('0xa2')],'uri':util[_0xd6a2('0x53')](_0xd6a2('0xa3'),_0x395de6,_0x28b0f7[_0xd6a2('0x37')][_0xd6a2('0x7')]),'json':_0x51a535,'resolveWithFullResponse':!![],'encoding':_0x360fa0,'qs':_0x28b0f7[_0xd6a2('0x37')]};if(_0x28b0f7[_0xd6a2('0xa4')]){_0x8bd4c9[_0xd6a2('0xa4')]=_0x28b0f7[_0xd6a2('0xa4')];if(_0x8bd4c9[_0xd6a2('0xa4')][_0xd6a2('0xa5')]){delete _0x8bd4c9[_0xd6a2('0xa4')][_0xd6a2('0xa5')];}}if(_0x8bd4c9[_0xd6a2('0xa4')][_0xd6a2('0xa6')]){delete _0x8bd4c9[_0xd6a2('0xa4')][_0xd6a2('0xa6')];}return rp(_0x8bd4c9);})[_0xd6a2('0x2a')](function(_0x1d5239){if(_0x1d5239){_0x142bec[_0xd6a2('0x26')](_0x1d5239[_0xd6a2('0xa4')]);logger[_0xd6a2('0x6c')](_0x1d5239['body']);if(_[_0xd6a2('0xa7')](_0x28b0f7[_0xd6a2('0x37')][_0xd6a2('0x7')],_0xd6a2('0x4f'))&&_0x1d5239[_0xd6a2('0xa8')]==0x1f4){return _0x142bec[_0xd6a2('0x1f')](_0x1d5239[_0xd6a2('0xa8')]);}else{return _0x142bec['status'](_0x1d5239[_0xd6a2('0xa8')])['send'](_0x1d5239[_0xd6a2('0x90')]);}}else{return _0x142bec[_0xd6a2('0x1f')](0xc8);}})[_0xd6a2('0x4e')](handleError(_0x142bec,null));};exports[_0xd6a2('0xa9')]=function(_0x664663,_0x12fe07,_0x3065af){return BPromise[_0xd6a2('0x9d')]()['then'](function(){if(!_0x664663[_0xd6a2('0x37')][_0xd6a2('0x7')]){throw new Error(_0xd6a2('0xaa'));}if(!_0x664663[_0xd6a2('0x37')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x31ecb0=_0x664663[_0xd6a2('0x37')]['hostname']?_0x664663['query'][_0xd6a2('0xa0')]+':'+_0x664663[_0xd6a2('0x37')][_0xd6a2('0x9e')]:_0xd6a2('0xa1')+_0x664663[_0xd6a2('0x37')][_0xd6a2('0x9e')];var _0x443605=_0x664663[_0xd6a2('0x37')][_0xd6a2('0x27')]?_0x664663['query']['json']:!![];var _0x482f15=_0x664663[_0xd6a2('0x37')][_0xd6a2('0xab')]?_0x664663[_0xd6a2('0x37')]['encoding']:null;var _0x386b63={'method':_0x664663[_0xd6a2('0xa2')],'uri':util[_0xd6a2('0x53')](_0xd6a2('0xa3'),_0x31ecb0,_0x664663['query'][_0xd6a2('0x7')]),'json':_0x443605,'resolveWithFullResponse':!![],'encoding':_0x482f15,'body':_0x664663[_0xd6a2('0x90')]};if(_0x664663[_0xd6a2('0xa4')]){_0x386b63[_0xd6a2('0xa4')]=_0x664663['headers'];if(_0x386b63[_0xd6a2('0xa4')][_0xd6a2('0xa5')]){delete _0x386b63[_0xd6a2('0xa4')][_0xd6a2('0xa5')];}}if(_0x386b63[_0xd6a2('0xa4')][_0xd6a2('0xa6')]){delete _0x386b63[_0xd6a2('0xa4')][_0xd6a2('0xa6')];}return rp(_0x386b63);})[_0xd6a2('0x2a')](function(_0x5ae3b4){if(_0x5ae3b4){_0x12fe07[_0xd6a2('0x26')](_0x5ae3b4[_0xd6a2('0xa4')]);logger[_0xd6a2('0x6c')](_0x5ae3b4['body']);return _0x12fe07[_0xd6a2('0x20')](_0x5ae3b4['statusCode'])[_0xd6a2('0x31')](_0x5ae3b4['body']);}else{return _0x12fe07[_0xd6a2('0x1f')](0xc8);}})[_0xd6a2('0x4e')](handleError(_0x12fe07,null));}; \ No newline at end of file +var _0x9349=['desk.js','querystring','extract-zip','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Plugins','UserProfileResource','error','name','send','map','Plugin','rawAttributes','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','where','filter','type','merge','options','includeAll','include','rows','keys','download','find','params','join','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','warning','code','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','glob','**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','catch','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','icon','icon-apps','test','agent','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','content-type','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x190e94,_0x587c83){var _0x32c82e=function(_0x427398){while(--_0x427398){_0x190e94['push'](_0x190e94['shift']());}};_0x32c82e(++_0x587c83);}(_0x9349,0x12e));var _0x9934=function(_0x39bf29,_0x48ac90){_0x39bf29=_0x39bf29-0x0;var _0x44ec09=_0x9349[_0x39bf29];return _0x44ec09;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9934('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9934('0x1'));var moment=require('moment');var BPromise=require(_0x9934('0x2'));var Mustache=require(_0x9934('0x3'));var util=require(_0x9934('0x4'));var path=require(_0x9934('0x5'));var sox=require('sox');var csv=require(_0x9934('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9934('0x7'));var _=require(_0x9934('0x8'));var squel=require(_0x9934('0x9'));var crypto=require(_0x9934('0xa'));var jsforce=require(_0x9934('0xb'));var deskjs=require(_0x9934('0xc'));var toCsv=require(_0x9934('0x6'));var querystring=require(_0x9934('0xd'));var Papa=require('papaparse');var extract=require(_0x9934('0xe'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0x9934('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9934('0x10'))('api');var utils=require(_0x9934('0x11'));var config=require(_0x9934('0x12'));var licenseUtil=require(_0x9934('0x13'));var db=require(_0x9934('0x14'))['db'];config['redis']=_[_0x9934('0x15')](config[_0x9934('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x9934('0x17'))(new Redis(config['redis']));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x42d1fa,_0x3839fb){_0x3839fb=_0x3839fb||0xcc;return function(_0x4898a6){if(_0x4898a6){return _0x42d1fa[_0x9934('0x18')](_0x3839fb);}return _0x42d1fa[_0x9934('0x19')](_0x3839fb)[_0x9934('0x1a')]();};}function respondWithResult(_0x116210,_0xd4389b){_0xd4389b=_0xd4389b||0xc8;return function(_0x23483e){if(_0x23483e){return _0x116210[_0x9934('0x19')](_0xd4389b)[_0x9934('0x1b')](_0x23483e);}};}function respondWithFilteredResult(_0x1ed2e1,_0x5ab29c){return function(_0x53d625){if(_0x53d625){var _0x4c3fd2=typeof _0x5ab29c['offset']===_0x9934('0x1c')&&typeof _0x5ab29c[_0x9934('0x1d')]===_0x9934('0x1c');var _0x121c4a=_0x53d625[_0x9934('0x1e')];var _0x1a0c4e=_0x4c3fd2?0x0:_0x5ab29c['offset'];var _0x2dda85=_0x4c3fd2?_0x53d625[_0x9934('0x1e')]:_0x5ab29c[_0x9934('0x1f')]+_0x5ab29c[_0x9934('0x1d')];var _0x1861ff;if(_0x2dda85>=_0x121c4a){_0x2dda85=_0x121c4a;_0x1861ff=0xc8;}else{_0x1861ff=0xce;}_0x1ed2e1['status'](_0x1861ff);return _0x1ed2e1[_0x9934('0x20')](_0x9934('0x21'),_0x1a0c4e+'-'+_0x2dda85+'/'+_0x121c4a)[_0x9934('0x1b')](_0x53d625);}return null;};}function patchUpdates(_0x329e87){return function(_0x19ae72){try{jsonpatch[_0x9934('0x22')](_0x19ae72,_0x329e87,!![]);}catch(_0x249232){return BPromise[_0x9934('0x23')](_0x249232);}return _0x19ae72[_0x9934('0x24')]();};}function saveUpdates(_0xa44012,_0x504b4b){return function(_0x32b510){if(_0x32b510){return _0x32b510['update'](_0xa44012)[_0x9934('0x25')](function(_0x584e98){return _0x584e98;});}return null;};}function removeEntity(_0x586e94,_0x16f1e1){return function(_0x356950){if(_0x356950){return _0x356950[_0x9934('0x26')]()[_0x9934('0x25')](function(){var _0x38f6f4=_0x356950[_0x9934('0x27')]({'plain':!![]});var _0x3d27cf=_0x9934('0x28');return db[_0x9934('0x29')][_0x9934('0x26')]({'where':{'type':_0x3d27cf,'resourceId':_0x38f6f4['id']}})[_0x9934('0x25')](function(){return _0x356950;});})[_0x9934('0x25')](function(){_0x586e94['status'](0xcc)[_0x9934('0x1a')]();});}};}function handleEntityNotFound(_0x3ea1a1,_0x417905){return function(_0x4fcf38){if(!_0x4fcf38){_0x3ea1a1['sendStatus'](0x194);}return _0x4fcf38;};}function handleError(_0xc978c7,_0x37e71d){_0x37e71d=_0x37e71d||0x1f4;return function(_0x46cfa9){logger[_0x9934('0x2a')](_0x46cfa9['stack']);if(_0x46cfa9['name']){delete _0x46cfa9[_0x9934('0x2b')];}_0xc978c7[_0x9934('0x19')](_0x37e71d)[_0x9934('0x2c')](_0x46cfa9);};}exports['index']=function(_0x2b4c26,_0x44b891){var _0x59a3a5={},_0x45e079={},_0x54e43b={'count':0x0,'rows':[]};var _0x289b77=_[_0x9934('0x2d')](db[_0x9934('0x2e')][_0x9934('0x2f')],function(_0xd7eeed){return{'name':_0xd7eeed['fieldName'],'type':_0xd7eeed['type'][_0x9934('0x30')]};});_0x45e079['model']=_[_0x9934('0x2d')](_0x289b77,_0x9934('0x2b'));_0x45e079['query']=_['keys'](_0x2b4c26[_0x9934('0x31')]);_0x45e079[_0x9934('0x32')]=_[_0x9934('0x33')](_0x45e079['model'],_0x45e079[_0x9934('0x31')]);_0x59a3a5[_0x9934('0x34')]=_[_0x9934('0x33')](_0x45e079[_0x9934('0x35')],qs['fields'](_0x2b4c26[_0x9934('0x31')][_0x9934('0x36')]));_0x59a3a5['attributes']=_0x59a3a5[_0x9934('0x34')][_0x9934('0x37')]?_0x59a3a5[_0x9934('0x34')]:_0x45e079[_0x9934('0x35')];if(!_0x2b4c26[_0x9934('0x31')][_0x9934('0x38')](_0x9934('0x39'))){_0x59a3a5['limit']=qs[_0x9934('0x1d')](_0x2b4c26[_0x9934('0x31')]['limit']);_0x59a3a5[_0x9934('0x1f')]=qs[_0x9934('0x1f')](_0x2b4c26[_0x9934('0x31')]['offset']);}_0x59a3a5[_0x9934('0x3a')]=qs['sort'](_0x2b4c26[_0x9934('0x31')]['sort']);_0x59a3a5[_0x9934('0x3b')]=qs['filters'](_['pick'](_0x2b4c26[_0x9934('0x31')],_0x45e079['filters']),_0x289b77);if(_0x2b4c26[_0x9934('0x31')][_0x9934('0x3c')]){_0x59a3a5[_0x9934('0x3b')]=_['merge'](_0x59a3a5[_0x9934('0x3b')],{'$or':_['map'](_0x289b77,function(_0x1cf55c){if(_0x1cf55c[_0x9934('0x3d')]!=='VIRTUAL'){var _0x1d8fea={};_0x1d8fea[_0x1cf55c[_0x9934('0x2b')]]={'$like':'%'+_0x2b4c26[_0x9934('0x31')]['filter']+'%'};return _0x1d8fea;}})});}_0x59a3a5=_[_0x9934('0x3e')]({},_0x59a3a5,_0x2b4c26[_0x9934('0x3f')]);var _0x3abdcb={'where':_0x59a3a5[_0x9934('0x3b')]};return db[_0x9934('0x2e')][_0x9934('0x1e')](_0x3abdcb)[_0x9934('0x25')](function(_0x51ad39){_0x54e43b[_0x9934('0x1e')]=_0x51ad39;if(_0x2b4c26[_0x9934('0x31')][_0x9934('0x40')]){_0x59a3a5[_0x9934('0x41')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x59a3a5);})[_0x9934('0x25')](function(_0x35c247){_0x54e43b[_0x9934('0x42')]=_0x35c247;return _0x54e43b;})[_0x9934('0x25')](respondWithFilteredResult(_0x44b891,_0x59a3a5))['catch'](handleError(_0x44b891,null));};exports['show']=function(_0x287629,_0x5bd1b6){var _0x3eb3fd={'raw':!![],'where':{'id':_0x287629['params']['id']}},_0x40d495={};_0x40d495['model']=_[_0x9934('0x43')](db[_0x9934('0x2e')][_0x9934('0x2f')]);_0x40d495[_0x9934('0x31')]=_[_0x9934('0x43')](_0x287629[_0x9934('0x31')]);_0x40d495[_0x9934('0x32')]=_[_0x9934('0x33')](_0x40d495[_0x9934('0x35')],_0x40d495[_0x9934('0x31')]);_0x3eb3fd['attributes']=_[_0x9934('0x33')](_0x40d495[_0x9934('0x35')],qs[_0x9934('0x36')](_0x287629[_0x9934('0x31')][_0x9934('0x36')]));_0x3eb3fd['attributes']=_0x3eb3fd['attributes'][_0x9934('0x37')]?_0x3eb3fd[_0x9934('0x34')]:_0x40d495['model'];if(_0x287629[_0x9934('0x31')][_0x9934('0x40')]){_0x3eb3fd['include']=[{'all':!![]}];}_0x3eb3fd=_[_0x9934('0x3e')]({},_0x3eb3fd,_0x287629[_0x9934('0x3f')]);return db[_0x9934('0x2e')]['find'](_0x3eb3fd)['then'](handleEntityNotFound(_0x5bd1b6,null))[_0x9934('0x25')](respondWithResult(_0x5bd1b6,null))['catch'](handleError(_0x5bd1b6,null));};exports[_0x9934('0x44')]=function(_0x4ed087,_0x35d0bc,_0x3f10c3){return db[_0x9934('0x2e')][_0x9934('0x45')]({'where':{'id':_0x4ed087[_0x9934('0x46')]['id']},'attributes':['name',_0x9934('0x5')],'raw':!![]})[_0x9934('0x25')](handleEntityNotFound(_0x35d0bc,null))['then'](function(_0x25fb0b){if(_0x25fb0b){var _0x13e573=path[_0x9934('0x47')](config[_0x9934('0x48')],_0x9934('0x49'),util['format'](_0x9934('0x4a'),path[_0x9934('0x4b')](_0x25fb0b[_0x9934('0x5')])));var _0x5b4a5e=fs[_0x9934('0x4c')](_0x13e573);var _0x396ee4=archiver(_0x9934('0x4d'),{'zlib':{'level':0x9}});_0x396ee4['on'](_0x9934('0x4e'),function(_0x294b57){if(_0x294b57[_0x9934('0x4f')]==='ENOENT'){logger[_0x9934('0x2a')](_0x294b57);}else{throw new db[(_0x9934('0x50'))]['Error'](_0x9934('0x51'));}});_0x396ee4['on'](_0x9934('0x2a'),function(_0x30f200){throw new db[(_0x9934('0x50'))][(_0x9934('0x52'))](_0x9934('0x51'));});_0x396ee4['pipe'](_0x5b4a5e);_0x396ee4[_0x9934('0x53')](_0x9934('0x54'),{'cwd':path['join'](config[_0x9934('0x48')],'server/files/plugins',path['dirname'](_0x25fb0b['path'])),'ignore':[path[_0x9934('0x47')](path[_0x9934('0x4b')](_0x25fb0b[_0x9934('0x5')]),'node_modules/**/*'),path['join'](path['basename'](_0x25fb0b[_0x9934('0x5')]),_0x9934('0x55'))],'nodir':!![]})[_0x9934('0x56')]();_0x5b4a5e['on']('close',function(){if(!fs[_0x9934('0x57')](_0x13e573)){throw new db[(_0x9934('0x50'))][(_0x9934('0x52'))](_0x9934('0x58'));}return _0x35d0bc[_0x9934('0x44')](_0x13e573,util[_0x9934('0x59')](_0x9934('0x4a'),path['basename'](_0x25fb0b['path'])),function(_0x1e8a8d){if(_0x1e8a8d){throw new db[(_0x9934('0x50'))][(_0x9934('0x52'))](_0x9934('0x5a'));}fs[_0x9934('0x5b')](_0x13e573);logger[_0x9934('0x5c')]('Download\x20completed');logger[_0x9934('0x5c')]('Temporary\x20file\x20removed');});});}return null;})[_0x9934('0x5d')](handleError(_0x35d0bc,null));};exports[_0x9934('0x5e')]=function(_0x342e9b,_0x3ecf36,_0x46d95a){var _0x6339ef=path['basename'](_0x342e9b[_0x9934('0x5f')][_0x9934('0x60')],path['extname'](_0x342e9b[_0x9934('0x5f')][_0x9934('0x60')]));var _0xb24e3a=path[_0x9934('0x47')](config[_0x9934('0x48')],_0x9934('0x49'),_0x342e9b[_0x9934('0x5f')][_0x9934('0x60')]);var _0x115987=path[_0x9934('0x47')](config[_0x9934('0x48')],'server/files/plugins',_0x6339ef);logger[_0x9934('0x5c')](_0x9934('0x61'),_0xb24e3a);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x115987);try{fs[_0x9934('0x62')](_0xb24e3a,parseInt(_0x9934('0x63'),0x8));extract(_0xb24e3a,{'dir':_0x115987},function(_0x51beec){if(_0x51beec){logger[_0x9934('0x2a')](_0x51beec);handleError(_0x51beec,!![]);};var _0x200729=fs[_0x9934('0x64')](_0x115987);if(_0x200729[_0x9934('0x37')]>0x1){removeReferences(_0xb24e3a,_0x115987);logger[_0x9934('0x2a')](_0x9934('0x65'));return _0x46d95a(new Error(_0x9934('0x65')));}var _0x531d79=fs[_0x9934('0x66')](path[_0x9934('0x47')](_0x115987,_0x200729[0x0]));if(_0x531d79[_0x9934('0x67')]()){removeReferences(_0xb24e3a,_0x115987);logger[_0x9934('0x2a')]('Invalid\x20plugin\x20structure');return _0x46d95a(new Error('Invalid\x20plugin\x20structure'));}if(_0x531d79[_0x9934('0x68')]()){var _0x512673=fs[_0x9934('0x64')](path['join'](_0x115987,_0x200729[0x0]));if(_0x512673['length']===0x0){removeReferences(_0xb24e3a,_0x115987);logger[_0x9934('0x2a')](_0x9934('0x65'));return _0x46d95a(new Error(_0x9934('0x65')));}var _0x385d4f=_0x512673[_0x9934('0x69')](function(_0x2d2bee){return _0x2d2bee==='manifest.json';});if(!_0x385d4f){return _0x46d95a(new Error(_0x9934('0x6a')));}var _0x5e38a2=fs[_0x9934('0x6b')](path[_0x9934('0x47')](_0x115987,_0x200729[0x0],_0x9934('0x6c')));var _0x9d26c8=JSON['parse'](_0x5e38a2);if(_0x9934('0x1c')==typeof _0x9d26c8['name']){return _0x46d95a(new Error(_0x9934('0x6d')));}if(_0x9934('0x1c')==typeof _0x9d26c8[_0x9934('0x3d')]){return _0x46d95a(new Error(_0x9934('0x6e')));}if(_0x9934('0x1c')==typeof _0x9d26c8[_0x9934('0x6f')]){return _0x46d95a(new Error(_0x9934('0x70')));}if(_0x9934('0x1c')==typeof _0x9d26c8[_0x9934('0x71')]){return _0x46d95a(new Error(_0x9934('0x72')));}if(_0x9d26c8[_0x9934('0x3d')]===_0x9934('0x73')){if('undefined'==typeof _0x9d26c8[_0x9934('0x71')][_0x9934('0x74')]){return _0x46d95a(new Error(_0x9934('0x75')));}if(_0x9934('0x1c')==typeof _0x9d26c8[_0x9934('0x71')]['views'][_0x9934('0x76')]&&'undefined'==typeof _0x9d26c8['parameters']['views']['agent']){return _0x46d95a(new Error(_0x9934('0x77')));}}else if(_0x9d26c8[_0x9934('0x3d')]===_0x9934('0x78')){if(_0x9934('0x1c')==typeof _0x9d26c8[_0x9934('0x71')][_0x9934('0x79')]){return _0x46d95a(new Error(_0x9934('0x7a')));}if(_0x9934('0x1c')==typeof _0x9d26c8[_0x9934('0x71')][_0x9934('0x7b')]){return _0x46d95a(new Error(_0x9934('0x7c')));}}else{return _0x46d95a(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x26ff63=_0x9d26c8[_0x9934('0x2b')];var _0x275567=_0x9d26c8[_0x9934('0x7d')];var _0x5eba4b=_0x9d26c8[_0x9934('0x3d')];var _0x2f3676=_0x9d26c8['sidebar']?_0x9d26c8['sidebar']:'always';var _0x287167=_0x9d26c8[_0x9934('0x7e')]?_0x9d26c8[_0x9934('0x7e')]:_0x9934('0x7f');var _0x43eb45='';var _0xae80f6='';var _0x373b0a='';var _0x4083a4='';var _0x499468=_0x9d26c8[_0x9934('0x6f')];if(_0x5eba4b===_0x9934('0x73')){if(_0x9934('0x1c')!=typeof _0x9d26c8[_0x9934('0x71')][_0x9934('0x74')][_0x9934('0x76')]){var _0x4d1e05=_0x9d26c8[_0x9934('0x71')][_0x9934('0x74')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x9934('0x80')](_0x4d1e05)){_0x43eb45=path[_0x9934('0x47')]('plugins',_0x6339ef,_0x200729[0x0],_0x4d1e05);}else{_0x43eb45=_0x4d1e05;}}else{logger[_0x9934('0x5c')]('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x9d26c8[_0x9934('0x71')][_0x9934('0x74')][_0x9934('0x81')]){var _0x37fb19=_0x9d26c8[_0x9934('0x71')]['views'][_0x9934('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x9934('0x80')](_0x37fb19)){_0xae80f6=path[_0x9934('0x47')](_0x9934('0x82'),_0x6339ef,_0x200729[0x0],_0x37fb19);}else{_0xae80f6=_0x37fb19;}}else{logger[_0x9934('0x5c')](_0x9934('0x83'));}}else if(_0x5eba4b==='script'){_0x373b0a=_0x9d26c8[_0x9934('0x71')][_0x9934('0x79')];_0x4083a4=_0x9d26c8['parameters']['scriptPath'];if(_0x9934('0x1c')!=typeof _0x9d26c8[_0x9934('0x71')][_0x9934('0x74')]){if(_0x9934('0x1c')!=typeof _0x9d26c8[_0x9934('0x71')][_0x9934('0x74')][_0x9934('0x76')]){var _0x4d1e05=_0x9d26c8[_0x9934('0x71')][_0x9934('0x74')][_0x9934('0x76')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4d1e05)){_0x43eb45=path[_0x9934('0x47')](_0x9934('0x82'),_0x6339ef,_0x200729[0x0],_0x4d1e05);}else{_0x43eb45=_0x4d1e05;}}if('undefined'!=typeof _0x9d26c8[_0x9934('0x71')][_0x9934('0x74')]['agent']){var _0x37fb19=_0x9d26c8['parameters'][_0x9934('0x74')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x9934('0x80')](_0x37fb19)){_0xae80f6=path[_0x9934('0x47')](_0x9934('0x82'),_0x6339ef,_0x200729[0x0],_0x37fb19);}else{_0xae80f6=_0x37fb19;}}}}var _0x52a41a={'name':_0x26ff63,'description':_0x275567,'path':path[_0x9934('0x47')](_0x6339ef,_0x200729[0x0]),'type':_0x5eba4b,'sidebar':_0x2f3676,'icon':_0x287167,'adminUrl':_0x43eb45,'agentUrl':_0xae80f6,'scriptName':_0x373b0a,'scriptPath':_0x4083a4,'version':_0x499468};removeReferences(_0xb24e3a,null);return db[_0x9934('0x2e')][_0x9934('0x84')](_0x52a41a)[_0x9934('0x25')](function(_0x4dc808){var _0x2d0702={'role':_0x342e9b[_0x9934('0x85')][_0x9934('0x86')],'userProfileId':_0x342e9b[_0x9934('0x85')][_0x9934('0x87')]};if(!_0x2d0702)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d0702[_0x9934('0x86')]==='user'){var _0x1f07fd=_0x4dc808[_0x9934('0x27')]({'plain':!![]});return db[_0x9934('0x88')]['find']({'where':{'name':_0x9934('0x28'),'userProfileId':_0x2d0702[_0x9934('0x87')]},'raw':!![]})[_0x9934('0x25')](function(_0x4e715d){if(_0x4e715d&&_0x4e715d[_0x9934('0x89')]===0x0){return db[_0x9934('0x29')]['create']({'name':_0x1f07fd['name'],'resourceId':_0x1f07fd['id'],'type':_0x4e715d[_0x9934('0x2b')],'sectionId':_0x4e715d['id']},{})['then'](function(){return _0x4dc808;});}else{return _0x4dc808;}})[_0x9934('0x5d')](function(_0x447d60){logger[_0x9934('0x2a')](_0x9934('0x8a'),_0x447d60);throw _0x447d60;});}return _0x4dc808;})['then'](respondWithResult(_0x3ecf36,null))['catch'](handleError(_0x3ecf36,null));}});}catch(_0x3c1662){_0x3ecf36[_0x9934('0x19')](0x1f4)['send'](_0x3c1662);}};function removeReferences(_0x18d4cf,_0x3022d1){try{if(_0x18d4cf){fs[_0x9934('0x5b')](_0x18d4cf);logger[_0x9934('0x5c')](_0x9934('0x8b'));}if(_0x3022d1){rimraf(_0x3022d1,function(){});logger[_0x9934('0x5c')](_0x9934('0x8c'));}}catch(_0x2a0bec){logger[_0x9934('0x2a')](_0x2a0bec);}}exports[_0x9934('0x8d')]=function(_0x50938e,_0x55a959,_0x7ff59){return db[_0x9934('0x2e')]['find']({'where':{'id':_0x50938e[_0x9934('0x46')]['id']}})[_0x9934('0x25')](handleEntityNotFound(_0x55a959,null))[_0x9934('0x25')](saveUpdates(_0x50938e[_0x9934('0x85')],null))[_0x9934('0x25')](respondWithResult(_0x55a959,null))['catch'](handleError(_0x55a959,null));};exports[_0x9934('0x8e')]=function(_0x30c857,_0x6aed6e,_0xc8492a){return db[_0x9934('0x2e')]['find']({'where':{'id':_0x30c857[_0x9934('0x46')]['id']}})[_0x9934('0x25')](function(_0x1aefe0){if(_0x1aefe0){return _0x1aefe0[_0x9934('0x26')]();}})['then'](function(_0x18c4c6){rimraf(path[_0x9934('0x47')](config['root'],'server/files/plugins',path['dirname'](_0x18c4c6[_0x9934('0x5')])),function(){});return _0x18c4c6;})['then'](handleEntityNotFound(_0x6aed6e,null))[_0x9934('0x25')](respondWithStatusCode(_0x6aed6e,null))[_0x9934('0x5d')](handleError(_0x6aed6e,null));};exports['webhookGet']=function(_0x3a1507,_0x183f00,_0x13ed3d){return BPromise['resolve']()['then'](function(){if(!_0x3a1507['query'][_0x9934('0x5')]){throw new Error(_0x9934('0x8f'));}if(!_0x3a1507[_0x9934('0x31')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x4f9192=_0x3a1507[_0x9934('0x31')][_0x9934('0x90')]?_0x3a1507[_0x9934('0x31')][_0x9934('0x90')]+':'+_0x3a1507[_0x9934('0x31')][_0x9934('0x91')]:_0x9934('0x92')+_0x3a1507[_0x9934('0x31')]['port'];var _0x542282=_0x3a1507['query'][_0x9934('0x1b')]?_0x3a1507[_0x9934('0x31')][_0x9934('0x1b')]:!![];var _0x2f2974=_0x3a1507[_0x9934('0x31')][_0x9934('0x93')]?_0x3a1507[_0x9934('0x31')]['encoding']:null;var _0x1ea40e={'method':_0x3a1507[_0x9934('0x94')],'uri':util[_0x9934('0x59')](_0x9934('0x95'),_0x4f9192,_0x3a1507['query'][_0x9934('0x5')]),'json':_0x542282,'resolveWithFullResponse':!![],'encoding':_0x2f2974,'qs':_0x3a1507['query']};if(_0x3a1507['headers']){_0x1ea40e[_0x9934('0x96')]=_0x3a1507[_0x9934('0x96')];if(_0x1ea40e[_0x9934('0x96')][_0x9934('0x97')]){delete _0x1ea40e[_0x9934('0x96')]['content-length'];}}if(_0x1ea40e[_0x9934('0x96')]['content-type']){delete _0x1ea40e[_0x9934('0x96')]['content-type'];}return rp(_0x1ea40e);})['then'](function(_0x5dc125){if(_0x5dc125){_0x183f00['set'](_0x5dc125[_0x9934('0x96')]);logger[_0x9934('0x5c')](_0x5dc125[_0x9934('0x85')]);if(_[_0x9934('0x98')](_0x3a1507['query'][_0x9934('0x5')],_0x9934('0x44'))&&_0x5dc125[_0x9934('0x99')]==0x1f4){return _0x183f00[_0x9934('0x18')](_0x5dc125['statusCode']);}else{return _0x183f00[_0x9934('0x19')](_0x5dc125[_0x9934('0x99')])[_0x9934('0x2c')](_0x5dc125[_0x9934('0x85')]);}}else{return _0x183f00[_0x9934('0x18')](0xc8);}})[_0x9934('0x5d')](handleError(_0x183f00,null));};exports[_0x9934('0x9a')]=function(_0x3001b1,_0x51b822,_0x13048d){return BPromise['resolve']()[_0x9934('0x25')](function(){if(!_0x3001b1[_0x9934('0x31')]['path']){throw new Error(_0x9934('0x8f'));}if(!_0x3001b1[_0x9934('0x31')][_0x9934('0x91')]){throw new Error(_0x9934('0x9b'));}var _0x3eefbe=_0x3001b1[_0x9934('0x31')]['hostname']?_0x3001b1[_0x9934('0x31')][_0x9934('0x90')]+':'+_0x3001b1[_0x9934('0x31')]['port']:'http://localhost:'+_0x3001b1[_0x9934('0x31')][_0x9934('0x91')];var _0x5ef868=_0x3001b1['query'][_0x9934('0x1b')]?_0x3001b1['query'][_0x9934('0x1b')]:!![];var _0x1759c4=_0x3001b1[_0x9934('0x31')][_0x9934('0x93')]?_0x3001b1[_0x9934('0x31')][_0x9934('0x93')]:null;var _0x2a3ee1={'method':_0x3001b1[_0x9934('0x94')],'uri':util[_0x9934('0x59')]('%s%s',_0x3eefbe,_0x3001b1[_0x9934('0x31')][_0x9934('0x5')]),'json':_0x5ef868,'resolveWithFullResponse':!![],'encoding':_0x1759c4,'body':_0x3001b1[_0x9934('0x85')]};if(_0x3001b1[_0x9934('0x96')]){_0x2a3ee1[_0x9934('0x96')]=_0x3001b1['headers'];if(_0x2a3ee1[_0x9934('0x96')][_0x9934('0x97')]){delete _0x2a3ee1['headers'][_0x9934('0x97')];}}if(_0x2a3ee1[_0x9934('0x96')][_0x9934('0x9c')]){delete _0x2a3ee1['headers'][_0x9934('0x9c')];}return rp(_0x2a3ee1);})[_0x9934('0x25')](function(_0x7933fd){if(_0x7933fd){_0x51b822[_0x9934('0x20')](_0x7933fd[_0x9934('0x96')]);logger['info'](_0x7933fd[_0x9934('0x85')]);return _0x51b822[_0x9934('0x19')](_0x7933fd[_0x9934('0x99')])['send'](_0x7933fd['body']);}else{return _0x51b822['sendStatus'](0xc8);}})['catch'](handleError(_0x51b822,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 2048575..7d749aa 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 _0x282a=['hook','exports','../../mysqldb','Plugin','setMaxListeners','save','update','emit'];(function(_0x114a4c,_0x102e95){var _0x52a131=function(_0x5b8429){while(--_0x5b8429){_0x114a4c['push'](_0x114a4c['shift']());}};_0x52a131(++_0x102e95);}(_0x282a,0xa2));var _0xa282=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x282a[_0x138adb];return _0x1b27f2;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xa282('0x0'))['db'][_0xa282('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xa282('0x2')](0x0);var events={'afterCreate':_0xa282('0x3'),'afterUpdate':_0xa282('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3a51f8){return function(_0x3344f0,_0x5af988,_0xde1168){PluginEvents['emit'](_0x3a51f8+':'+_0x3344f0['id'],_0x3344f0);PluginEvents[_0xa282('0x5')](_0x3a51f8,_0x3344f0);_0xde1168(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xa282('0x6')](e,emitEvent(event));}}module[_0xa282('0x7')]=PluginEvents; \ No newline at end of file +var _0x4489=['update','remove','emit','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0xadea70,_0x21dd30){var _0x72334f=function(_0x14d74b){while(--_0x14d74b){_0xadea70['push'](_0xadea70['shift']());}};_0x72334f(++_0x21dd30);}(_0x4489,0x164));var _0x9448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4489[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x9448('0x0'));var Plugin=require(_0x9448('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x9448('0x2')](0x0);var events={'afterCreate':_0x9448('0x3'),'afterUpdate':_0x9448('0x4'),'afterDestroy':_0x9448('0x5')};function emitEvent(_0x4f7c08){return function(_0x49f6d5,_0x4bf96c,_0x5333bf){PluginEvents['emit'](_0x4f7c08+':'+_0x49f6d5['id'],_0x49f6d5);PluginEvents[_0x9448('0x6')](_0x4f7c08,_0x49f6d5);_0x5333bf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x9448('0x7')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index b20a2d2..ae5a34e 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 _0xe9a1=['./plugin.attributes','exports','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2c567a,_0x1ee5e1){var _0x61f78f=function(_0x4107db){while(--_0x4107db){_0x2c567a['push'](_0x2c567a['shift']());}};_0x61f78f(++_0x1ee5e1);}(_0xe9a1,0xc7));var _0x1e9a=function(_0x8fd7b5,_0x2a05ce){_0x8fd7b5=_0x8fd7b5-0x0;var _0x4c7412=_0xe9a1[_0x8fd7b5];return _0x4c7412;};'use strict';var _=require(_0x1e9a('0x0'));var util=require(_0x1e9a('0x1'));var logger=require(_0x1e9a('0x2'))(_0x1e9a('0x3'));var moment=require(_0x1e9a('0x4'));var BPromise=require(_0x1e9a('0x5'));var rp=require(_0x1e9a('0x6'));var fs=require('fs');var path=require(_0x1e9a('0x7'));var rimraf=require('rimraf');var config=require(_0x1e9a('0x8'));var attributes=require(_0x1e9a('0x9'));module[_0x1e9a('0xa')]=function(_0x41199f,_0x589d2c){return _0x41199f['define'](_0x1e9a('0xb'),attributes,{'tableName':_0x1e9a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ae9=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','define','Plugin','plugins'];(function(_0x557939,_0x5e4cfc){var _0x33d365=function(_0x1f21cd){while(--_0x1f21cd){_0x557939['push'](_0x557939['shift']());}};_0x33d365(++_0x5e4cfc);}(_0x7ae9,0x1b8));var _0x97ae=function(_0x676e90,_0x426275){_0x676e90=_0x676e90-0x0;var _0x46532e=_0x7ae9[_0x676e90];return _0x46532e;};'use strict';var _=require(_0x97ae('0x0'));var util=require('util');var logger=require(_0x97ae('0x1'))(_0x97ae('0x2'));var moment=require(_0x97ae('0x3'));var BPromise=require(_0x97ae('0x4'));var rp=require(_0x97ae('0x5'));var fs=require('fs');var path=require(_0x97ae('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./plugin.attributes');module['exports']=function(_0x3df5db,_0x3639dc){return _0x3df5db[_0x97ae('0x7')](_0x97ae('0x8'),attributes,{'tableName':_0x97ae('0x9'),'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 89ef32d..2b6cbe0 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 _0x7529=['Plugin','create','options','raw','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CreatePlugin'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x7529,0x1c6));var _0x9752=function(_0x5466e0,_0x166357){_0x5466e0=_0x5466e0-0x0;var _0x5a34ca=_0x7529[_0x5466e0];return _0x5a34ca;};'use strict';var _=require(_0x9752('0x0'));var util=require(_0x9752('0x1'));var moment=require(_0x9752('0x2'));var BPromise=require(_0x9752('0x3'));var rs=require(_0x9752('0x4'));var fs=require('fs');var Redis=require(_0x9752('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9752('0x6'));var logger=require(_0x9752('0x7'))(_0x9752('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9752('0x9')][_0x9752('0xa')]({'port':0x232a});config[_0x9752('0xb')]=_[_0x9752('0xc')](config[_0x9752('0xb')],{'host':_0x9752('0xd'),'port':0x18eb});var socket=require(_0x9752('0xe'))(new Redis(config[_0x9752('0xb')]));require(_0x9752('0xf'))['register'](socket);function respondWithRpcPromise(_0x33ebd9,_0x5478fa,_0x49c4bf){return new BPromise(function(_0x1f3bc3,_0x24f9d6){return client[_0x9752('0x10')](_0x33ebd9,_0x49c4bf)[_0x9752('0x11')](function(_0x7221ec){logger[_0x9752('0x12')](_0x9752('0x13'),_0x5478fa,_0x9752('0x14'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x5478fa,'request\x20sent',JSON[_0x9752('0x15')](_0x7221ec));if(_0x7221ec[_0x9752('0x16')]){if(_0x7221ec[_0x9752('0x16')][_0x9752('0x17')]===0x1f4){logger[_0x9752('0x16')](_0x9752('0x13'),_0x5478fa,_0x7221ec[_0x9752('0x16')][_0x9752('0x18')]);return _0x24f9d6(_0x7221ec[_0x9752('0x16')][_0x9752('0x18')]);}logger[_0x9752('0x16')](_0x9752('0x13'),_0x5478fa,_0x7221ec[_0x9752('0x16')][_0x9752('0x18')]);return _0x1f3bc3(_0x7221ec[_0x9752('0x16')][_0x9752('0x18')]);}else{logger[_0x9752('0x12')](_0x9752('0x13'),_0x5478fa,'request\x20sent');_0x1f3bc3(_0x7221ec['result'][_0x9752('0x18')]);}})['catch'](function(_0x54ebfc){logger[_0x9752('0x16')](_0x9752('0x13'),_0x5478fa,_0x54ebfc);_0x24f9d6(_0x54ebfc);});});}exports[_0x9752('0x19')]=function(_0xf67573){var _0x1a0b7f=this;return new Promise(function(_0x2d4c06,_0x55595f){return db[_0x9752('0x1a')][_0x9752('0x1b')](_0xf67573['body'],{'raw':_0xf67573['options']?_0xf67573[_0x9752('0x1c')][_0x9752('0x1d')]===undefined?!![]:![]:!![]})[_0x9752('0x11')](function(_0x3834a3){logger['info'](_0x9752('0x19'),_0xf67573);logger[_0x9752('0x1e')](_0x9752('0x19'),_0xf67573,JSON[_0x9752('0x15')](_0x3834a3));_0x2d4c06(_0x3834a3);})[_0x9752('0x1f')](function(_0x88f3a5){logger['error'](_0x9752('0x19'),_0x88f3a5[_0x9752('0x18')],_0xf67573);_0x55595f(_0x1a0b7f[_0x9752('0x16')](0x1f4,_0x88f3a5['message']));});});}; \ No newline at end of file +var _0xd09d=['register','request','then','Plugin,\x20%s,\x20%s','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','Plugin','create','options','raw','CreatePlugin','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./plugin.socket'];(function(_0x462084,_0x11fd2b){var _0x2477bb=function(_0x18390b){while(--_0x18390b){_0x462084['push'](_0x462084['shift']());}};_0x2477bb(++_0x11fd2b);}(_0xd09d,0x6d));var _0xdd09=function(_0x52aec3,_0x174bc){_0x52aec3=_0x52aec3-0x0;var _0x3bd540=_0xd09d[_0x52aec3];return _0x3bd540;};'use strict';var _=require('lodash');var util=require(_0xdd09('0x0'));var moment=require(_0xdd09('0x1'));var BPromise=require(_0xdd09('0x2'));var rs=require(_0xdd09('0x3'));var fs=require('fs');var Redis=require(_0xdd09('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdd09('0x5'))(_0xdd09('0x6'));var config=require(_0xdd09('0x7'));var jayson=require(_0xdd09('0x8'));var client=jayson[_0xdd09('0x9')]['http']({'port':0x232a});config[_0xdd09('0xa')]=_[_0xdd09('0xb')](config[_0xdd09('0xa')],{'host':_0xdd09('0xc'),'port':0x18eb});var socket=require(_0xdd09('0xd'))(new Redis(config['redis']));require(_0xdd09('0xe'))[_0xdd09('0xf')](socket);function respondWithRpcPromise(_0x11655f,_0x210038,_0x47b7da){return new BPromise(function(_0xb3a936,_0x373710){return client[_0xdd09('0x10')](_0x11655f,_0x47b7da)[_0xdd09('0x11')](function(_0x147f9a){logger['info'](_0xdd09('0x12'),_0x210038,'request\x20sent');logger['debug'](_0xdd09('0x13'),_0x210038,'request\x20sent',JSON[_0xdd09('0x14')](_0x147f9a));if(_0x147f9a[_0xdd09('0x15')]){if(_0x147f9a[_0xdd09('0x15')]['code']===0x1f4){logger[_0xdd09('0x15')](_0xdd09('0x12'),_0x210038,_0x147f9a[_0xdd09('0x15')][_0xdd09('0x16')]);return _0x373710(_0x147f9a[_0xdd09('0x15')][_0xdd09('0x16')]);}logger[_0xdd09('0x15')]('Plugin,\x20%s,\x20%s',_0x210038,_0x147f9a[_0xdd09('0x15')][_0xdd09('0x16')]);return _0xb3a936(_0x147f9a[_0xdd09('0x15')]['message']);}else{logger[_0xdd09('0x17')](_0xdd09('0x12'),_0x210038,'request\x20sent');_0xb3a936(_0x147f9a[_0xdd09('0x18')][_0xdd09('0x16')]);}})[_0xdd09('0x19')](function(_0x3aef38){logger[_0xdd09('0x15')](_0xdd09('0x12'),_0x210038,_0x3aef38);_0x373710(_0x3aef38);});});}exports['CreatePlugin']=function(_0x1f4da9){var _0x1c7119=this;return new Promise(function(_0x14dee6,_0x44718f){return db[_0xdd09('0x1a')][_0xdd09('0x1b')](_0x1f4da9['body'],{'raw':_0x1f4da9[_0xdd09('0x1c')]?_0x1f4da9['options'][_0xdd09('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x7773fe){logger[_0xdd09('0x17')]('CreatePlugin',_0x1f4da9);logger['debug'](_0xdd09('0x1e'),_0x1f4da9,JSON['stringify'](_0x7773fe));_0x14dee6(_0x7773fe);})['catch'](function(_0x543625){logger[_0xdd09('0x15')](_0xdd09('0x1e'),_0x543625[_0xdd09('0x16')],_0x1f4da9);_0x44718f(_0x1c7119['error'](0x1f4,_0x543625['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 1261311..e566eff 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 _0xfae4=['emit','removeListener','register','plugin:','./plugin.events','save','remove','update'];(function(_0x21b36c,_0x543483){var _0x236627=function(_0x174f99){while(--_0x174f99){_0x21b36c['push'](_0x21b36c['shift']());}};_0x236627(++_0x543483);}(_0xfae4,0x144));var _0x4fae=function(_0x5dfe27,_0x48ce4a){_0x5dfe27=_0x5dfe27-0x0;var _0x3137ae=_0xfae4[_0x5dfe27];return _0x3137ae;};'use strict';var PluginEvents=require(_0x4fae('0x0'));var events=[_0x4fae('0x1'),_0x4fae('0x2'),_0x4fae('0x3')];function createListener(_0x38a6c5,_0x12fb48){return function(_0x485d59){_0x12fb48[_0x4fae('0x4')](_0x38a6c5,_0x485d59);};}function removeListener(_0x237cd1,_0x239b2a){return function(){PluginEvents[_0x4fae('0x5')](_0x237cd1,_0x239b2a);};}exports[_0x4fae('0x6')]=function(_0x4497fe){for(var _0x192110=0x0,_0x37de0b=events['length'];_0x192110<_0x37de0b;_0x192110++){var _0x5655eb=events[_0x192110];var _0x1b25ed=createListener(_0x4fae('0x7')+_0x5655eb,_0x4497fe);PluginEvents['on'](_0x5655eb,_0x1b25ed);}}; \ No newline at end of file +var _0xefb4=['update','emit','removeListener','register','length','./plugin.events','save'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xefb4,0x19b));var _0x4efb=function(_0x654c80,_0x22c054){_0x654c80=_0x654c80-0x0;var _0x112dc0=_0xefb4[_0x654c80];return _0x112dc0;};'use strict';var PluginEvents=require(_0x4efb('0x0'));var events=[_0x4efb('0x1'),'remove',_0x4efb('0x2')];function createListener(_0x3a679c,_0x33fcc3){return function(_0x3a0703){_0x33fcc3[_0x4efb('0x3')](_0x3a679c,_0x3a0703);};}function removeListener(_0x15dc80,_0x107869){return function(){PluginEvents[_0x4efb('0x4')](_0x15dc80,_0x107869);};}exports[_0x4efb('0x5')]=function(_0x901861){for(var _0x3df464=0x0,_0x8ea76=events[_0x4efb('0x6')];_0x3df464<_0x8ea76;_0x3df464++){var _0x1b4c6a=events[_0x3df464];var _0x5f45a4=createListener('plugin:'+_0x1b4c6a,_0x901861);PluginEvents['on'](_0x1b4c6a,_0x5f45a4);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 0015141..457e1e3 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(_0x3d8007,_0x577637){var _0x26e2e0=function(_0x4c0f29){while(--_0x4c0f29){_0x3d8007['push'](_0x3d8007['shift']());}};_0x26e2e0(++_0x577637);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0x3ad4fd,_0x4d1fd9){var _0x284de2=function(_0x38d62e){while(--_0x38d62e){_0x3ad4fd['push'](_0x3ad4fd['shift']());}};_0x284de2(++_0x4d1fd9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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 354cfe1..079fda4 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 _0x39cb=['create','body','join','../../files/plugins','cwd','chdir','start','send','Missing\x20name\x20and/or\x20path','restart','hasOwnProperty','Unknown\x20status','destroy','delete','dump','Unknown\x20id','../../config/pm2','../../config/logger','path','child_process','bluebird','sendStatus','status','json','error','stack','name','npm\x20install','info','index','then','reject','express','motion2','length','catch','show','describe','params'];(function(_0x565e49,_0x3bc386){var _0x3f1bd9=function(_0x3ada7a){while(--_0x3ada7a){_0x565e49['push'](_0x565e49['shift']());}};_0x3f1bd9(++_0x3bc386);}(_0x39cb,0x1bd));var _0xb39c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x39cb[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var pm2=require(_0xb39c('0x0'));var logger=require(_0xb39c('0x1'))('api');var path=require(_0xb39c('0x2'));var exec=require(_0xb39c('0x3'))['exec'];var BPromise=require(_0xb39c('0x4'));function handleEntityNotFound(_0x285eca,_0x398d07){return function(_0x2bca14){if(!_0x2bca14){_0x285eca[_0xb39c('0x5')](0x194);;}return _0x2bca14;};}function respondWithResult(_0x4ae4cf,_0x32cdcd){_0x32cdcd=_0x32cdcd||0xc8;return function(_0x2fc868){if(_0x2fc868){return _0x4ae4cf[_0xb39c('0x6')](_0x32cdcd)[_0xb39c('0x7')](_0x2fc868);}return null;};}function handleError(_0x47d6d7,_0x5ae14a){_0x5ae14a=_0x5ae14a||0x1f4;return function(_0x41557b){logger[_0xb39c('0x8')](_0x41557b[_0xb39c('0x9')]);if(_0x41557b[_0xb39c('0xa')]){delete _0x41557b['name'];}_0x47d6d7['status'](_0x5ae14a)['send'](_0x41557b);};}function execChildProcess(){return new BPromise(function(_0x1de94f,_0x497ffc){exec(_0xb39c('0xb'),function(_0x1088ee,_0x433ee8,_0x340622){logger[_0xb39c('0xc')](_0x433ee8);logger[_0xb39c('0xc')](_0x340622);if(_0x1088ee){logger['error'](_0x1088ee);return _0x497ffc(_0x1088ee);}return _0x1de94f(_0x433ee8);});});}exports[_0xb39c('0xd')]=function(_0x468995,_0x2620cd){return pm2['list']()[_0xb39c('0xe')](function(_0x40a6d3){if(_0x40a6d3){var _0x42a203=_[_0xb39c('0xf')](_0x40a6d3,function(_0x469fa9){return _0x469fa9[_0xb39c('0xa')]===_0xb39c('0x10')||_0x469fa9['name']===_0xb39c('0x11');});return{'rows':_0x42a203,'count':_0x42a203[_0xb39c('0x12')]};}return null;})[_0xb39c('0xe')](respondWithResult(_0x2620cd,null))[_0xb39c('0x13')](handleError(_0x2620cd,null));};exports[_0xb39c('0x14')]=function(_0x3b7fad,_0x1a2f48){return pm2[_0xb39c('0x15')](_0x3b7fad[_0xb39c('0x16')]['id'])[_0xb39c('0xe')](respondWithResult(_0x1a2f48,null))['then'](handleEntityNotFound(_0x1a2f48,null))[_0xb39c('0x13')](handleError(_0x1a2f48,null));};exports[_0xb39c('0x17')]=function(_0x28bbe1,_0x447352){if(_0x28bbe1['body'][_0xb39c('0xa')]&&_0x28bbe1[_0xb39c('0x18')]['script']){var _0x2d8e93=path[_0xb39c('0x19')](__dirname,_0xb39c('0x1a'),_0x28bbe1['body']['script']);var _0x2789fd=process[_0xb39c('0x1b')]();process[_0xb39c('0x1c')](path['dirname'](_0x2d8e93));return execChildProcess()[_0xb39c('0xe')](function(_0x438207){process[_0xb39c('0x1c')](_0x2789fd);return pm2[_0xb39c('0x1d')]({'name':_0x28bbe1[_0xb39c('0x18')]['name'],'script':_0x2d8e93});})[_0xb39c('0xe')](function(_0xbeab7e){pm2['dump']();return _0xbeab7e[0x0];})[_0xb39c('0xe')](respondWithResult(_0x447352,0xc9))[_0xb39c('0x13')](handleError(_0x447352,null));}else{return _0x447352[_0xb39c('0x6')](0x1f4)[_0xb39c('0x1e')]({'message':_0xb39c('0x1f')});}};exports['update']=function(_0x23a2f1,_0x299c27){if(_0x23a2f1[_0xb39c('0x18')]['id']){delete _0x23a2f1['body']['id'];}var _0x41fff2={'online':_0xb39c('0x20'),'stopped':'stop'};if(_0x41fff2[_0xb39c('0x21')](_0x23a2f1[_0xb39c('0x18')][_0xb39c('0x6')])){return pm2[_0x41fff2[_0x23a2f1['body'][_0xb39c('0x6')]]](_0x23a2f1[_0xb39c('0x16')]['id'])['then'](respondWithResult(_0x299c27,0xc8))[_0xb39c('0x13')](handleError(_0x299c27,null));}else{return _0x299c27['status'](0x1f4)[_0xb39c('0x1e')]({'message':_0xb39c('0x22')});}};exports[_0xb39c('0x23')]=function(_0x7339b4,_0x17eb7b){if(_0x7339b4['body']['id']){delete _0x7339b4[_0xb39c('0x18')]['id'];}if(_0x7339b4['params']['id']){return pm2[_0xb39c('0x24')](_0x7339b4['params']['id'])[_0xb39c('0xe')](function(_0xe2111a){pm2[_0xb39c('0x25')]();return _0xe2111a[0x0];})[_0xb39c('0xe')](respondWithResult(_0x17eb7b,null))['catch'](handleError(_0x17eb7b,null));}else{return _0x17eb7b['status'](0x1f4)[_0xb39c('0x1e')]({'message':_0xb39c('0x26')});}}; \ No newline at end of file +var _0xb821=['params','then','create','body','script','join','../../files/plugins','cwd','chdir','start','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','dump','../../config/pm2','../../config/logger','child_process','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','reject','express','length','catch','show'];(function(_0x277945,_0x19230e){var _0x14f504=function(_0x52fa08){while(--_0x52fa08){_0x277945['push'](_0x277945['shift']());}};_0x14f504(++_0x19230e);}(_0xb821,0xa7));var _0x1b82=function(_0xd9522c,_0x17072a){_0xd9522c=_0xd9522c-0x0;var _0x4b5dc3=_0xb821[_0xd9522c];return _0x4b5dc3;};'use strict';var _=require('lodash');var pm2=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var path=require('path');var exec=require(_0x1b82('0x2'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x3b1d14,_0x1403ab){return function(_0x3fadf0){if(!_0x3fadf0){_0x3b1d14[_0x1b82('0x3')](0x194);;}return _0x3fadf0;};}function respondWithResult(_0x597ca7,_0x3e27c4){_0x3e27c4=_0x3e27c4||0xc8;return function(_0x192434){if(_0x192434){return _0x597ca7[_0x1b82('0x4')](_0x3e27c4)[_0x1b82('0x5')](_0x192434);}return null;};}function handleError(_0x18f45f,_0x7b87e8){_0x7b87e8=_0x7b87e8||0x1f4;return function(_0x161155){logger[_0x1b82('0x6')](_0x161155[_0x1b82('0x7')]);if(_0x161155['name']){delete _0x161155[_0x1b82('0x8')];}_0x18f45f[_0x1b82('0x4')](_0x7b87e8)[_0x1b82('0x9')](_0x161155);};}function execChildProcess(){return new BPromise(function(_0x14c57a,_0xcffb87){exec(_0x1b82('0xa'),function(_0x739f99,_0x1ce719,_0x5f521f){logger[_0x1b82('0xb')](_0x1ce719);logger[_0x1b82('0xb')](_0x5f521f);if(_0x739f99){logger[_0x1b82('0x6')](_0x739f99);return _0xcffb87(_0x739f99);}return _0x14c57a(_0x1ce719);});});}exports[_0x1b82('0xc')]=function(_0x50aed7,_0x1a6285){return pm2['list']()['then'](function(_0x1e553a){if(_0x1e553a){var _0x4bf75b=_[_0x1b82('0xd')](_0x1e553a,function(_0xe1d608){return _0xe1d608['name']===_0x1b82('0xe')||_0xe1d608['name']==='motion2';});return{'rows':_0x4bf75b,'count':_0x4bf75b[_0x1b82('0xf')]};}return null;})['then'](respondWithResult(_0x1a6285,null))[_0x1b82('0x10')](handleError(_0x1a6285,null));};exports[_0x1b82('0x11')]=function(_0xf42818,_0x4a09a2){return pm2['describe'](_0xf42818[_0x1b82('0x12')]['id'])['then'](respondWithResult(_0x4a09a2,null))[_0x1b82('0x13')](handleEntityNotFound(_0x4a09a2,null))[_0x1b82('0x10')](handleError(_0x4a09a2,null));};exports[_0x1b82('0x14')]=function(_0x594a63,_0x352426){if(_0x594a63[_0x1b82('0x15')][_0x1b82('0x8')]&&_0x594a63[_0x1b82('0x15')][_0x1b82('0x16')]){var _0x47e99b=path[_0x1b82('0x17')](__dirname,_0x1b82('0x18'),_0x594a63[_0x1b82('0x15')][_0x1b82('0x16')]);var _0x26e481=process[_0x1b82('0x19')]();process[_0x1b82('0x1a')](path['dirname'](_0x47e99b));return execChildProcess()[_0x1b82('0x13')](function(_0x233740){process['chdir'](_0x26e481);return pm2[_0x1b82('0x1b')]({'name':_0x594a63[_0x1b82('0x15')][_0x1b82('0x8')],'script':_0x47e99b});})['then'](function(_0x3a1226){pm2['dump']();return _0x3a1226[0x0];})['then'](respondWithResult(_0x352426,0xc9))['catch'](handleError(_0x352426,null));}else{return _0x352426[_0x1b82('0x4')](0x1f4)[_0x1b82('0x9')]({'message':_0x1b82('0x1c')});}};exports[_0x1b82('0x1d')]=function(_0x548a3b,_0x222483){if(_0x548a3b[_0x1b82('0x15')]['id']){delete _0x548a3b[_0x1b82('0x15')]['id'];}var _0x7455e8={'online':_0x1b82('0x1e'),'stopped':_0x1b82('0x1f')};if(_0x7455e8[_0x1b82('0x20')](_0x548a3b[_0x1b82('0x15')][_0x1b82('0x4')])){return pm2[_0x7455e8[_0x548a3b[_0x1b82('0x15')][_0x1b82('0x4')]]](_0x548a3b[_0x1b82('0x12')]['id'])[_0x1b82('0x13')](respondWithResult(_0x222483,0xc8))['catch'](handleError(_0x222483,null));}else{return _0x222483[_0x1b82('0x4')](0x1f4)[_0x1b82('0x9')]({'message':_0x1b82('0x21')});}};exports[_0x1b82('0x22')]=function(_0x18e4ff,_0x115ce7){if(_0x18e4ff[_0x1b82('0x15')]['id']){delete _0x18e4ff[_0x1b82('0x15')]['id'];}if(_0x18e4ff[_0x1b82('0x12')]['id']){return pm2[_0x1b82('0x23')](_0x18e4ff['params']['id'])[_0x1b82('0x13')](function(_0x29a31e){pm2[_0x1b82('0x24')]();return _0x29a31e[0x0];})[_0x1b82('0x13')](respondWithResult(_0x115ce7,null))['catch'](handleError(_0x115ce7,null));}else{return _0x115ce7[_0x1b82('0x4')](0x1f4)[_0x1b82('0x9')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 1d47da1..e7f40e4 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 _0x8a23=['/agents','isAuthenticated','/queues','express','Router','../../components/auth/service','./realtime.controller','get'];(function(_0x5a27e8,_0x492a2f){var _0x4e38f7=function(_0x2a4048){while(--_0x2a4048){_0x5a27e8['push'](_0x5a27e8['shift']());}};_0x4e38f7(++_0x492a2f);}(_0x8a23,0x143));var _0x38a2=function(_0x5a7618,_0x3f44c2){_0x5a7618=_0x5a7618-0x0;var _0x12dc65=_0x8a23[_0x5a7618];return _0x12dc65;};'use strict';var express=require(_0x38a2('0x0'));var router=express[_0x38a2('0x1')]();var auth=require(_0x38a2('0x2'));var controller=require(_0x38a2('0x3'));router[_0x38a2('0x4')](_0x38a2('0x5'),auth[_0x38a2('0x6')](),controller['getAgents']);router[_0x38a2('0x4')](_0x38a2('0x7'),auth[_0x38a2('0x6')](),controller['getQueues']);module['exports']=router; \ No newline at end of file +var _0xb2e7=['get','isAuthenticated','getAgents','getQueues','exports','express','Router'];(function(_0x467e61,_0x47b292){var _0x38bcbe=function(_0x3f4b90){while(--_0x3f4b90){_0x467e61['push'](_0x467e61['shift']());}};_0x38bcbe(++_0x47b292);}(_0xb2e7,0x1b0));var _0x7b2e=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb2e7[_0x167cc1];return _0x10bc4b;};'use strict';var express=require(_0x7b2e('0x0'));var router=express[_0x7b2e('0x1')]();var auth=require('../../components/auth/service');var controller=require('./realtime.controller');router[_0x7b2e('0x2')]('/agents',auth[_0x7b2e('0x3')](),controller[_0x7b2e('0x4')]);router[_0x7b2e('0x2')]('/queues',auth['isAuthenticated'](),controller[_0x7b2e('0x5')]);module[_0x7b2e('0x6')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 00fce73..2a88882 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 _0x9536=['talking','busy','pick','filter','queue','length','some','connectedlinenum','internal','toString','find','UserId','accountcode','online','voiceStatus','agents','push','Pause','findAll','loggedInDb','idle','unknown','unavailable','isNil','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','pause','chatStatus','faxStatus','whatsappStatus','*pause','userpic','lastPauseAt','pauseType','chatCapacity','smsCapacity','whatsappCapacity','faxCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','mailStatus','smsStatus','openchannelStatusTime','mailStatusTime','smsStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','routealias','resolve','rawAttributes','fieldName','type','key','agent','getOptions','raw','user','userProfileId','query','nolimit','sort','UserProfile','getResources','User','rows','globalStatusFilter','globalStatus','pauseTypeFilter','mail','sms','openchannel','fax','whatsapp','channel','includes','toLowerCase','Queue','role','QueueCampaigns','Queues','findAndCountAll','all','util','lodash','jayson/promise','../../components/parsers/qs','api','client','http','offset','undefined','limit','count','status','set','Content-Range','json','error','stack','name','send','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','startCase','format','VoiceQueuesChannels','loggedIn','waiting','paused','voice','outbound','pTalking','originated','message','dialMethod','Trunk','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','available'];(function(_0x5e109f,_0x5dcb2f){var _0x36af5b=function(_0x416205){while(--_0x416205){_0x5e109f['push'](_0x5e109f['shift']());}};_0x36af5b(++_0x5dcb2f);}(_0x9536,0x179));var _0x6953=function(_0x39fd11,_0x5d7883){_0x39fd11=_0x39fd11-0x0;var _0x302799=_0x9536[_0x39fd11];return _0x302799;};'use strict';var util=require(_0x6953('0x0'));var _=require(_0x6953('0x1'));var jayson=require(_0x6953('0x2'));var qs=require(_0x6953('0x3'));var logger=require('../../config/logger')(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x6953('0x5')][_0x6953('0x6')]({'port':0x232a});var routingClient=jayson[_0x6953('0x5')][_0x6953('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x2f3cc3,_0x494ac2){return function(_0x2b273e){if(_0x2b273e){var _0x2bb026=typeof _0x494ac2[_0x6953('0x7')]===_0x6953('0x8')&&typeof _0x494ac2[_0x6953('0x9')]==='undefined';var _0x3e8786=_0x2b273e[_0x6953('0xa')];var _0x449acb=_0x2bb026?0x0:_0x494ac2['offset'];var _0x41f41b=_0x2bb026?_0x2b273e[_0x6953('0xa')]:_0x494ac2[_0x6953('0x7')]+_0x494ac2[_0x6953('0x9')];var _0x448c89;if(_0x41f41b>=_0x3e8786){_0x41f41b=_0x3e8786;_0x448c89=0xc8;}else{_0x448c89=0xce;}_0x2f3cc3[_0x6953('0xb')](_0x448c89);return _0x2f3cc3[_0x6953('0xc')](_0x6953('0xd'),_0x449acb+'-'+_0x41f41b+'/'+_0x3e8786)[_0x6953('0xe')](_0x2b273e);}return null;};}function handleError(_0x57652e,_0x358388){_0x358388=_0x358388||0x1f4;return function(_0x513dd0){logger[_0x6953('0xf')](_0x513dd0[_0x6953('0x10')]);if(_0x513dd0[_0x6953('0x11')]){delete _0x513dd0[_0x6953('0x11')];}_0x57652e[_0x6953('0xb')](_0x358388)[_0x6953('0x12')](_0x513dd0);};}function getRealtimeAgents(){return new Promise(function(_0x175fa9,_0x27a57c){return amiClient[_0x6953('0x13')](_0x6953('0x14'),{})[_0x6953('0x15')](function(_0x548473){if(_0x548473['error'])throw new Error(_0x6953('0x16'));var _0x44e8a2=_0x548473[_0x6953('0x17')];return routingClient[_0x6953('0x13')]('Agents',{})[_0x6953('0x15')](function(_0x2da771){if(_0x2da771['error'])throw new Error(_0x6953('0x18'));var _0x3207dd=_0x2da771[_0x6953('0x17')];return _0x175fa9(_[_0x6953('0x19')]({},_0x44e8a2,_0x3207dd));});})[_0x6953('0x1a')](function(_0x4a450c){_0x27a57c(_0x4a450c);});});}function getRealtimeQueues(_0x3a93e1,_0x1b7123){return new Promise(function(_0x31d5fd,_0x2ba433){var _0x41f021=_0x1b7123==='voice'?amiClient:routingClient;return _0x41f021[_0x6953('0x13')](_[_0x6953('0x1b')](_0x1b7123)+'Queues',_0x3a93e1)[_0x6953('0x15')](function(_0x40c9d1){if(_0x40c9d1[_0x6953('0xf')])throw new Error(util[_0x6953('0x1c')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x1b7123));return _0x31d5fd(_0x40c9d1[_0x6953('0x17')]);})[_0x6953('0x1a')](function(_0x2a7f6a){_0x2ba433(_0x2a7f6a);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x508ea7,_0x495ebd){return amiClient['request'](_0x6953('0x1d'),{})[_0x6953('0x15')](function(_0x550be4){if(_0x550be4[_0x6953('0xf')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x508ea7(_0x550be4[_0x6953('0x17')]);})[_0x6953('0x1a')](function(_0xcdbce8){_0x495ebd(_0xcdbce8);});});}function initializeQueues(_0x2cc01e,_0x191d80,_0x1497e3,_0x53d3dc){var _0x3dd890=[_0x6953('0x1e'),'available',_0x6953('0x1f'),'talking',_0x6953('0x20')];if(_0x1497e3===_0x6953('0x21')&&_0x53d3dc===_0x6953('0x22')){_0x3dd890['push'](_0x6953('0x23'),_0x6953('0x24'),_0x6953('0x25'),'dialActive',_0x6953('0x26'),_0x6953('0x27'),'startPredictive','startProgressive',_0x6953('0x28'),_0x6953('0x29'),_0x6953('0x2a'),_0x6953('0x2b'),_0x6953('0x2c'),'dialPredictiveIntervalMaxThreshold',_0x6953('0x2d'),'predictiveIntervalAvailable',_0x6953('0x2e'),_0x6953('0x2f'),'predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit',_0x6953('0x30'),_0x6953('0x31'));}return _0x2cc01e[_0x6953('0x32')](function(_0x4ffa69){var _0x28cb92=_0x4ffa69['get']({'plain':!![]});_0x28cb92['agents']=[];_0x28cb92['paused']=0x0;_0x28cb92['loggedInDb']=0x0;_0x28cb92[_0x6953('0x1e')]=0x0;_0x28cb92[_0x6953('0x33')]=0x0;_0x28cb92[_0x6953('0x1f')]=0x0;if(_0x1497e3===_0x6953('0x21')){_0x28cb92[_0x6953('0x34')]=0x0;_0x28cb92[_0x6953('0x35')]=0x0;if(_0x53d3dc==='outbound'){_0x28cb92[_0x6953('0x23')]=0x0;_0x28cb92['originated']=0x0;}}var _0x199c67=_['find'](_0x191d80,['id',_0x28cb92['id']]);if(_0x199c67)_[_0x6953('0x19')](_0x28cb92,_[_0x6953('0x36')](_0x199c67,_0x3dd890));return _0x28cb92;});}function updateAgentVoiceStatus(_0xd81149,_0x248fe7,_0x562792){var _0x13c677=_[_0x6953('0x37')](_0x562792,[_0x6953('0x38'),_0x248fe7[_0x6953('0x11')]]);if(_0x13c677[_0x6953('0x39')]===0x0)return _0xd81149[_0x6953('0x35')]=!![];if(_[_0x6953('0x3a')](_0x13c677,[_0x6953('0x3b'),_0xd81149[_0x6953('0x3c')][_0x6953('0x3d')]()]))return _0xd81149[_0x6953('0x34')]=!![];if(!_0xd81149['talking'])return _0xd81149[_0x6953('0x35')]=!![];}function getVoiceQueueAgents(_0x3c03ab,_0x1f6571,_0x5dff18,_0x47e7e7){var _0x44faff=_['find'](_0x1f6571,['id',_0x3c03ab['id']]);if(!_0x44faff)return _0x3c03ab;return _0x44faff['getMembers']({'raw':!![]})[_0x6953('0x15')](function(_0x7e7b68){for(var _0x4b5e1c=0x0;_0x4b5e1c<_0x7e7b68[_0x6953('0x39')];_0x4b5e1c++){var _0x263728=_[_0x6953('0x3e')](_0x5dff18,['id',_0x7e7b68[_0x4b5e1c][_0x6953('0x3f')]]);if(!_0x263728){_0x263728={'id':_0x7e7b68[_0x4b5e1c][_0x6953('0x3f')],'name':_0x7e7b68[_0x4b5e1c][_0x6953('0x3f')],'accountcode':'','online':![]};}var _0x51137b={'id':_0x263728['id'],'name':_0x263728[_0x6953('0x11')],'internal':_0x263728[_0x6953('0x40')],'online':Boolean(_0x263728[_0x6953('0x41')]),'paused':Boolean(_0x7e7b68[_0x4b5e1c][_0x6953('0x20')])};if(_0x263728[_0x6953('0x42')]===_0x6953('0x34'))updateAgentVoiceStatus(_0x51137b,_0x3c03ab,_0x47e7e7);if(_0x51137b['online'])_0x3c03ab['loggedInDb']++;if(_0x51137b[_0x6953('0x35')])_0x3c03ab['busy']++;if(_0x51137b['paused']&&!_0x51137b[_0x6953('0x35')]&&!_0x51137b[_0x6953('0x34')])_0x3c03ab[_0x6953('0x20')]++;_0x3c03ab[_0x6953('0x43')][_0x6953('0x44')](_0x51137b);}return _0x3c03ab;});}function getQueueAgents(_0x5ac8f7,_0x4d43fd,_0x1de4e4){var _0x452b69='User'+_[_0x6953('0x1b')](_0x1de4e4)+'Queue';var _0x166b13=_0x1de4e4+_0x6953('0x45');return db[_0x452b69][_0x6953('0x46')]({'where':{[_[_0x6953('0x1b')](_0x1de4e4)+'QueueId']:_0x5ac8f7['id']},'raw':!![]})[_0x6953('0x15')](function(_0x424621){for(var _0x4d3868=0x0;_0x4d3868<_0x424621[_0x6953('0x39')];_0x4d3868++){var _0x296d81=_[_0x6953('0x3e')](_0x4d43fd,['id',_0x424621[_0x4d3868][_0x6953('0x3f')]]);if(!_0x296d81){_0x296d81={'id':_0x424621[_0x4d3868][_0x6953('0x3f')],'name':_0x424621[_0x4d3868][_0x6953('0x3f')],'online':![],['pauseField']:![]};}var _0x13d1a6={'id':_0x296d81['id'],'name':_0x296d81[_0x6953('0x11')],'online':Boolean(_0x296d81[_0x6953('0x41')]),'paused':Boolean(_0x296d81[_0x166b13])};if(_0x13d1a6[_0x6953('0x41')])_0x5ac8f7[_0x6953('0x47')]++;_0x5ac8f7['agents'][_0x6953('0x44')](_0x13d1a6);}return _0x5ac8f7;});}function isIdle(_0x4c9d36){return _0x4c9d36===_0x6953('0x48')||_0x4c9d36===_0x6953('0x49')||_0x4c9d36===_0x6953('0x4a')||_0x4c9d36==='ringing'||_[_0x6953('0x4b')](_0x4c9d36);}function isAgentPaused(_0x2a4e54,_0x506561){var _0x525145=[_0x2a4e54[_0x6953('0x4c')],_0x2a4e54[_0x6953('0x4d')],_0x2a4e54[_0x6953('0x4e')],_0x2a4e54[_0x6953('0x4f')],_0x2a4e54[_0x6953('0x50')],_0x2a4e54[_0x6953('0x51')],_0x2a4e54[_0x6953('0x52')]];if(!_0x506561)return _[_0x6953('0x53')](_0x525145);var _0x2baf90=_[_0x6953('0x37')](_0x525145);return _0x2baf90[_0x6953('0x39')]>0x0&&_0x2baf90['length']<_0x525145['length']?!![]:![];}function isAgentIdle(_0x14a7bf){if(_0x14a7bf[_0x6953('0x42')]!==_0x6953('0x48')&&_0x14a7bf[_0x6953('0x51')]){_0x14a7bf[_0x6953('0x42')]=_0x6953('0x54');return![];}return _[_0x6953('0x53')]([_0x14a7bf[_0x6953('0x55')],_0x14a7bf[_0x6953('0x56')],_0x14a7bf['mailStatus'],_0x14a7bf['openchannelStatus'],_0x14a7bf['smsStatus'],_0x14a7bf['voiceStatus'],_0x14a7bf[_0x6953('0x57')]],isIdle);}function getAgentStatus(_0x20ceda){var _0x51372b='unknown';if(isAgentPaused(_0x20ceda))_0x51372b='pause';else if(isAgentPaused(_0x20ceda,!![]))_0x51372b=_0x6953('0x58');else if(isAgentIdle(_0x20ceda))_0x51372b=_0x6953('0x48');else _0x51372b=_0x6953('0x35');return _0x51372b;}exports['getAgents']=function(_0x5b696e,_0x400486){var _0x40033a={'count':0x0,'rows':[]},_0x53e631={},_0x58fcb3,_0x29937b,_0xafbd35=[_0x6953('0x59'),_0x6953('0x41'),'lastLoginAt',_0x6953('0x5a'),_0x6953('0x5b'),'lastPauseAt',_0x6953('0x3c'),'address',_0x6953('0x4c'),_0x6953('0x4f'),_0x6953('0x4e'),_0x6953('0x50'),'whatsappPause',_0x6953('0x4d'),_0x6953('0x51'),_0x6953('0x5c'),'openchannelCapacity','mailCapacity',_0x6953('0x5d'),_0x6953('0x5e'),_0x6953('0x5f'),'chatCurrentCapacity','openchannelCurrentCapacity',_0x6953('0x60'),_0x6953('0x61'),'whatsappCurrentCapacity',_0x6953('0x62'),_0x6953('0x55'),'openchannelStatus',_0x6953('0x63'),_0x6953('0x64'),_0x6953('0x57'),_0x6953('0x56'),_0x6953('0x42'),'chatStatusTime',_0x6953('0x65'),_0x6953('0x66'),_0x6953('0x67'),'whatsappStatusTime','faxStatusTime',_0x6953('0x68'),_0x6953('0x38'),_0x6953('0x69'),_0x6953('0x6a'),_0x6953('0x6b'),'phoneBarEnableAutomaticScreenRecording',_0x6953('0x6c')],_0x414096=[_0x6953('0x4c'),_0x6953('0x4f'),_0x6953('0x4e'),_0x6953('0x50'),_0x6953('0x52'),_0x6953('0x4d'),_0x6953('0x51'),_0x6953('0x41')];Promise[_0x6953('0x6d')]()[_0x6953('0x15')](function(){var _0x390ba0=_[_0x6953('0x32')](db['User'][_0x6953('0x6e')],function(_0x1d264a){return{'name':_0x1d264a[_0x6953('0x6f')],'type':_0x1d264a[_0x6953('0x70')][_0x6953('0x71')]};});_0x5b696e['query']['role']=_0x6953('0x72');_0x5b696e['query'][_0x6953('0x41')]=!![];_0x53e631=qs[_0x6953('0x73')](_0x390ba0,_0x5b696e);_0x53e631[_0x6953('0x74')]=!![];if(_0x5b696e[_0x6953('0x75')]['role']===_0x6953('0x75')){var _0x3091fc={'params':{'id':_0x5b696e[_0x6953('0x75')][_0x6953('0x76')]},'query':{'section':_0x6953('0x14'),'role':_0x6953('0x72'),'online':!![],'nolimit':_0x5b696e[_0x6953('0x77')][_0x6953('0x78')],'sort':_0x5b696e[_0x6953('0x77')][_0x6953('0x79')],'filter':_0x5b696e[_0x6953('0x77')][_0x6953('0x37')],'raw':!![]}};return db[_0x6953('0x7a')][_0x6953('0x7b')](_0x3091fc);}return db[_0x6953('0x7c')]['findAndCountAll'](_0x53e631);})[_0x6953('0x15')](function(_0x3624fc){_0x40033a[_0x6953('0xa')]=_0x3624fc[_0x6953('0xa')];_0x58fcb3=_0x3624fc[_0x6953('0x7d')];return getRealtimeAgents();})[_0x6953('0x15')](function(_0x3e19f1){_0x29937b=_0x3e19f1['rows'];return _0x58fcb3[_0x6953('0x32')](function(_0x403d81){var _0x4eba55=_[_0x6953('0x3e')](_0x29937b,['id',_0x403d81['id']]);if(_0x4eba55)_[_0x6953('0x19')](_0x403d81,_[_0x6953('0x36')](_['omit'](_0x4eba55,_0x414096),_0xafbd35));_0x403d81['globalStatus']=getAgentStatus(_0x403d81);return _0x403d81;});})[_0x6953('0x15')](function(_0x12987e){if(_0x5b696e[_0x6953('0x77')][_0x6953('0x7e')]){var _0x1ad883=_[_0x6953('0x37')](_0x12987e,[_0x6953('0x7f'),_0x5b696e[_0x6953('0x77')][_0x6953('0x7e')]]);if(_0x5b696e['query'][_0x6953('0x80')]){_0x1ad883=_[_0x6953('0x37')](_0x1ad883,[_0x6953('0x5b'),_0x5b696e[_0x6953('0x77')]['pauseTypeFilter']]);}}_0x40033a[_0x6953('0x7d')]=_0x1ad883||_0x12987e;return _0x40033a;})[_0x6953('0x15')](respondWithFilteredResult(_0x400486,_0x53e631))[_0x6953('0x1a')](handleError(_0x400486,null));};exports['getQueues']=function(_0x16898a,_0x12285e){var _0x208038=[_0x6953('0x81'),'chat',_0x6953('0x82'),_0x6953('0x83'),_0x6953('0x84'),_0x6953('0x85'),'voice'];var _0x4eaebb={'count':0x0,'rows':[]},_0x513495={},_0x2310b2,_0x5c9f02,_0x5a7607,_0x3ebd20,_0x147cd4;Promise[_0x6953('0x6d')]()[_0x6953('0x15')](function(){if(_0x16898a['query'][_0x6953('0x86')]){if(!_[_0x6953('0x87')](_0x208038,_0x16898a['query'][_0x6953('0x86')][_0x6953('0x88')]()))throw new Error('Invalid\x20channel');_0x2310b2=_0x16898a['query']['channel'][_0x6953('0x88')]();}var _0x1cdee0=_[_0x6953('0x1b')](_0x2310b2)+_0x6953('0x89');var _0x1efbb9=_[_0x6953('0x32')](db[_0x1cdee0][_0x6953('0x6e')],function(_0x24b888){return{'name':_0x24b888['fieldName'],'type':_0x24b888[_0x6953('0x70')][_0x6953('0x71')]};});_0x513495=qs[_0x6953('0x73')](_0x1efbb9,_0x16898a);if(_0x16898a[_0x6953('0x75')][_0x6953('0x8a')]===_0x6953('0x75')){var _0x481102={'params':{'id':_0x16898a[_0x6953('0x75')]['userProfileId']},'query':{'section':_0x2310b2===_0x6953('0x21')&&_0x16898a['query'][_0x6953('0x70')]===_0x6953('0x22')?_0x6953('0x8b'):_['startCase'](_0x2310b2)+_0x6953('0x8c'),'type':_0x16898a[_0x6953('0x77')][_0x6953('0x70')],'nolimit':!![],'sort':_0x6953('0x11'),'filter':_0x16898a[_0x6953('0x77')][_0x6953('0x37')]}};return db['UserProfile'][_0x6953('0x7b')](_0x481102);}return db[_0x1cdee0][_0x6953('0x8d')](_0x513495);})[_0x6953('0x15')](function(_0x4464d1){_0x4eaebb[_0x6953('0xa')]=_0x4464d1[_0x6953('0xa')];_0x5c9f02=_0x4464d1[_0x6953('0x7d')];return getRealtimeQueues(_0x16898a,_0x2310b2);})[_0x6953('0x15')](function(_0xefb593){_0x3ebd20=_0xefb593[_0x6953('0x7d')];return getRealtimeAgents();})[_0x6953('0x15')](function(_0x47c935){_0x5a7607=_0x47c935[_0x6953('0x7d')];if(_0x2310b2!=_0x6953('0x21'))return;return getRealtimeVoiceQueueChannels();})[_0x6953('0x15')](function(_0x396a9f){_0x147cd4=_0x396a9f?_0x396a9f[_0x6953('0x7d')]:[];return initializeQueues(_0x5c9f02,_0x3ebd20,_0x2310b2,_0x16898a[_0x6953('0x77')][_0x6953('0x70')]);})[_0x6953('0x15')](function(_0x384021){var _0x39dd70=_0x384021[_0x6953('0x32')](function(_0x590d1f){if(_0x2310b2===_0x6953('0x21'))return getVoiceQueueAgents(_0x590d1f,_0x5c9f02,_0x5a7607,_0x147cd4);else return getQueueAgents(_0x590d1f,_0x5a7607,_0x2310b2);});return Promise[_0x6953('0x8e')](_0x39dd70);})[_0x6953('0x15')](function(_0x5a74ab){_0x4eaebb[_0x6953('0x7d')]=_0x5a74ab;return _0x4eaebb;})['then'](respondWithFilteredResult(_0x12285e,_0x513495))['catch'](handleError(_0x12285e,null));}; \ No newline at end of file +var _0xd197=['queue','some','connectedlinenum','internal','toString','length','UserId','accountcode','online','User','Queue','Pause','findAll','find','idle','ringing','isNil','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','every','voiceStatus','pause','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','unknown','*pause','getAgents','userpic','lastLoginAt','pauseType','lastPauseAt','address','whatsappPause','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','openchannelCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','chatStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','resolve','rawAttributes','fieldName','type','role','agent','raw','user','userProfileId','query','sort','UserProfile','getResources','rows','globalStatusFilter','globalStatus','pauseTypeFilter','mail','chat','sms','openchannel','fax','whatsapp','channel','includes','Invalid\x20channel','toLowerCase','key','getOptions','QueueCampaigns','findAndCountAll','all','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','http','client','undefined','limit','count','offset','status','set','Content-Range','json','stack','name','send','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','paused','outbound','push','pTalking','dialActive','dialMethod','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','map','get','agents','loggedInDb','voice','talking','busy','originated','pick','filter'];(function(_0x4f19be,_0x5bcf41){var _0x351122=function(_0x28268e){while(--_0x28268e){_0x4f19be['push'](_0x4f19be['shift']());}};_0x351122(++_0x5bcf41);}(_0xd197,0x18b));var _0x7d19=function(_0x325bc0,_0x606ee0){_0x325bc0=_0x325bc0-0x0;var _0x535311=_0xd197[_0x325bc0];return _0x535311;};'use strict';var util=require(_0x7d19('0x0'));var _=require(_0x7d19('0x1'));var jayson=require(_0x7d19('0x2'));var qs=require(_0x7d19('0x3'));var logger=require(_0x7d19('0x4'))(_0x7d19('0x5'));var db=require(_0x7d19('0x6'))['db'];var amiClient=jayson['client'][_0x7d19('0x7')]({'port':0x232a});var routingClient=jayson[_0x7d19('0x8')][_0x7d19('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x2ac8bc,_0x1d4c52){return function(_0xdaba93){if(_0xdaba93){var _0x353b72=typeof _0x1d4c52['offset']===_0x7d19('0x9')&&typeof _0x1d4c52[_0x7d19('0xa')]===_0x7d19('0x9');var _0x175d8e=_0xdaba93[_0x7d19('0xb')];var _0x5d34d1=_0x353b72?0x0:_0x1d4c52[_0x7d19('0xc')];var _0x386396=_0x353b72?_0xdaba93[_0x7d19('0xb')]:_0x1d4c52[_0x7d19('0xc')]+_0x1d4c52[_0x7d19('0xa')];var _0x355df5;if(_0x386396>=_0x175d8e){_0x386396=_0x175d8e;_0x355df5=0xc8;}else{_0x355df5=0xce;}_0x2ac8bc[_0x7d19('0xd')](_0x355df5);return _0x2ac8bc[_0x7d19('0xe')](_0x7d19('0xf'),_0x5d34d1+'-'+_0x386396+'/'+_0x175d8e)[_0x7d19('0x10')](_0xdaba93);}return null;};}function handleError(_0x30a7f2,_0x46d263){_0x46d263=_0x46d263||0x1f4;return function(_0x17e18c){logger['error'](_0x17e18c[_0x7d19('0x11')]);if(_0x17e18c['name']){delete _0x17e18c[_0x7d19('0x12')];}_0x30a7f2[_0x7d19('0xd')](_0x46d263)[_0x7d19('0x13')](_0x17e18c);};}function getRealtimeAgents(){return new Promise(function(_0x1e9951,_0x1e7000){return amiClient['request'](_0x7d19('0x14'),{})[_0x7d19('0x15')](function(_0x4cd0c9){if(_0x4cd0c9[_0x7d19('0x16')])throw new Error(_0x7d19('0x17'));var _0x5b2818=_0x4cd0c9[_0x7d19('0x18')];return routingClient[_0x7d19('0x19')](_0x7d19('0x14'),{})[_0x7d19('0x15')](function(_0x21fb08){if(_0x21fb08[_0x7d19('0x16')])throw new Error(_0x7d19('0x1a'));var _0x5365ee=_0x21fb08[_0x7d19('0x18')];return _0x1e9951(_[_0x7d19('0x1b')]({},_0x5b2818,_0x5365ee));});})['catch'](function(_0x16422e){_0x1e7000(_0x16422e);});});}function getRealtimeQueues(_0x46826b,_0x5b392e){return new Promise(function(_0x24ed4b,_0x3f6ab2){var _0xf2e624=_0x5b392e==='voice'?amiClient:routingClient;return _0xf2e624[_0x7d19('0x19')](_[_0x7d19('0x1c')](_0x5b392e)+_0x7d19('0x1d'),_0x46826b)['then'](function(_0x1d95c5){if(_0x1d95c5['error'])throw new Error(util[_0x7d19('0x1e')](_0x7d19('0x1f'),_0x5b392e));return _0x24ed4b(_0x1d95c5[_0x7d19('0x18')]);})[_0x7d19('0x20')](function(_0x3071b2){_0x3f6ab2(_0x3071b2);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x1c05b6,_0x375590){return amiClient['request'](_0x7d19('0x21'),{})['then'](function(_0x37de3c){if(_0x37de3c[_0x7d19('0x16')])throw new Error(_0x7d19('0x22'));return _0x1c05b6(_0x37de3c[_0x7d19('0x18')]);})[_0x7d19('0x20')](function(_0x2950b3){_0x375590(_0x2950b3);});});}function initializeQueues(_0x2a6e47,_0x5cdec9,_0x345b4d,_0x336e0e){var _0x17a1b8=[_0x7d19('0x23'),_0x7d19('0x24'),_0x7d19('0x25'),'talking',_0x7d19('0x26')];if(_0x345b4d==='voice'&&_0x336e0e===_0x7d19('0x27')){_0x17a1b8[_0x7d19('0x28')](_0x7d19('0x29'),'originated','message',_0x7d19('0x2a'),_0x7d19('0x2b'),'Trunk','startPredictive',_0x7d19('0x2c'),'erlangCalls',_0x7d19('0x2d'),_0x7d19('0x2e'),_0x7d19('0x2f'),_0x7d19('0x30'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x7d19('0x31'),'predictiveIntervalTotalCalls',_0x7d19('0x32'),_0x7d19('0x33'),_0x7d19('0x34'),_0x7d19('0x35'),'predictiveIntervalAvgTalktime');}return _0x2a6e47[_0x7d19('0x36')](function(_0x3ba050){var _0x28160f=_0x3ba050[_0x7d19('0x37')]({'plain':!![]});_0x28160f[_0x7d19('0x38')]=[];_0x28160f['paused']=0x0;_0x28160f[_0x7d19('0x39')]=0x0;_0x28160f[_0x7d19('0x23')]=0x0;_0x28160f['available']=0x0;_0x28160f['waiting']=0x0;if(_0x345b4d===_0x7d19('0x3a')){_0x28160f[_0x7d19('0x3b')]=0x0;_0x28160f[_0x7d19('0x3c')]=0x0;if(_0x336e0e===_0x7d19('0x27')){_0x28160f[_0x7d19('0x29')]=0x0;_0x28160f[_0x7d19('0x3d')]=0x0;}}var _0x56d55f=_['find'](_0x5cdec9,['id',_0x28160f['id']]);if(_0x56d55f)_[_0x7d19('0x1b')](_0x28160f,_[_0x7d19('0x3e')](_0x56d55f,_0x17a1b8));return _0x28160f;});}function updateAgentVoiceStatus(_0x29d5df,_0x4bdc1f,_0x505993){var _0x215583=_[_0x7d19('0x3f')](_0x505993,[_0x7d19('0x40'),_0x4bdc1f[_0x7d19('0x12')]]);if(_0x215583['length']===0x0)return _0x29d5df[_0x7d19('0x3c')]=!![];if(_[_0x7d19('0x41')](_0x215583,[_0x7d19('0x42'),_0x29d5df[_0x7d19('0x43')][_0x7d19('0x44')]()]))return _0x29d5df[_0x7d19('0x3b')]=!![];if(!_0x29d5df[_0x7d19('0x3b')])return _0x29d5df['busy']=!![];}function getVoiceQueueAgents(_0x2901ff,_0x289613,_0x1f0d38,_0x4be947){var _0x46aed1=_['find'](_0x289613,['id',_0x2901ff['id']]);if(!_0x46aed1)return _0x2901ff;return _0x46aed1['getMembers']({'raw':!![]})[_0x7d19('0x15')](function(_0x14ed77){for(var _0x2342c6=0x0;_0x2342c6<_0x14ed77[_0x7d19('0x45')];_0x2342c6++){var _0x18f798=_['find'](_0x1f0d38,['id',_0x14ed77[_0x2342c6][_0x7d19('0x46')]]);if(!_0x18f798){_0x18f798={'id':_0x14ed77[_0x2342c6][_0x7d19('0x46')],'name':_0x14ed77[_0x2342c6][_0x7d19('0x46')],'accountcode':'','online':![]};}var _0x4eb5ce={'id':_0x18f798['id'],'name':_0x18f798[_0x7d19('0x12')],'internal':_0x18f798[_0x7d19('0x47')],'online':Boolean(_0x18f798[_0x7d19('0x48')]),'paused':Boolean(_0x14ed77[_0x2342c6][_0x7d19('0x26')])};if(_0x18f798['voiceStatus']===_0x7d19('0x3b'))updateAgentVoiceStatus(_0x4eb5ce,_0x2901ff,_0x4be947);if(_0x4eb5ce[_0x7d19('0x48')])_0x2901ff[_0x7d19('0x39')]++;if(_0x4eb5ce[_0x7d19('0x3c')])_0x2901ff['busy']++;if(_0x4eb5ce[_0x7d19('0x26')]&&!_0x4eb5ce[_0x7d19('0x3c')]&&!_0x4eb5ce[_0x7d19('0x3b')])_0x2901ff[_0x7d19('0x26')]++;_0x2901ff[_0x7d19('0x38')][_0x7d19('0x28')](_0x4eb5ce);}return _0x2901ff;});}function getQueueAgents(_0x5c7974,_0x3bd130,_0x2b263c){var _0x101a1c=_0x7d19('0x49')+_[_0x7d19('0x1c')](_0x2b263c)+_0x7d19('0x4a');var _0x2fb19a=_0x2b263c+_0x7d19('0x4b');return db[_0x101a1c][_0x7d19('0x4c')]({'where':{[_[_0x7d19('0x1c')](_0x2b263c)+'QueueId']:_0x5c7974['id']},'raw':!![]})[_0x7d19('0x15')](function(_0x8298e8){for(var _0x38c7c7=0x0;_0x38c7c7<_0x8298e8[_0x7d19('0x45')];_0x38c7c7++){var _0x4681e3=_[_0x7d19('0x4d')](_0x3bd130,['id',_0x8298e8[_0x38c7c7][_0x7d19('0x46')]]);if(!_0x4681e3){_0x4681e3={'id':_0x8298e8[_0x38c7c7][_0x7d19('0x46')],'name':_0x8298e8[_0x38c7c7]['UserId'],'online':![],['pauseField']:![]};}var _0x4c7fe9={'id':_0x4681e3['id'],'name':_0x4681e3[_0x7d19('0x12')],'online':Boolean(_0x4681e3[_0x7d19('0x48')]),'paused':Boolean(_0x4681e3[_0x2fb19a])};if(_0x4c7fe9[_0x7d19('0x48')])_0x5c7974['loggedInDb']++;_0x5c7974[_0x7d19('0x38')][_0x7d19('0x28')](_0x4c7fe9);}return _0x5c7974;});}function isIdle(_0x380546){return _0x380546===_0x7d19('0x4e')||_0x380546==='unknown'||_0x380546==='unavailable'||_0x380546===_0x7d19('0x4f')||_[_0x7d19('0x50')](_0x380546);}function isAgentPaused(_0x2ed8bd,_0x1ecb60){var _0x4da7b7=[_0x2ed8bd[_0x7d19('0x51')],_0x2ed8bd[_0x7d19('0x52')],_0x2ed8bd[_0x7d19('0x53')],_0x2ed8bd[_0x7d19('0x54')],_0x2ed8bd[_0x7d19('0x55')],_0x2ed8bd[_0x7d19('0x56')],_0x2ed8bd['whatsappPause']];if(!_0x1ecb60)return _[_0x7d19('0x57')](_0x4da7b7);var _0x57a4f9=_[_0x7d19('0x3f')](_0x4da7b7);return _0x57a4f9['length']>0x0&&_0x57a4f9['length']<_0x4da7b7['length']?!![]:![];}function isAgentIdle(_0x34cd43){if(_0x34cd43[_0x7d19('0x58')]!=='idle'&&_0x34cd43[_0x7d19('0x56')]){_0x34cd43['voiceStatus']=_0x7d19('0x59');return![];}return _[_0x7d19('0x57')]([_0x34cd43['chatStatus'],_0x34cd43[_0x7d19('0x5a')],_0x34cd43[_0x7d19('0x5b')],_0x34cd43[_0x7d19('0x5c')],_0x34cd43[_0x7d19('0x5d')],_0x34cd43[_0x7d19('0x58')],_0x34cd43[_0x7d19('0x5e')]],isIdle);}function getAgentStatus(_0x27d1e4){var _0x28c2b4=_0x7d19('0x5f');if(isAgentPaused(_0x27d1e4))_0x28c2b4='pause';else if(isAgentPaused(_0x27d1e4,!![]))_0x28c2b4=_0x7d19('0x60');else if(isAgentIdle(_0x27d1e4))_0x28c2b4=_0x7d19('0x4e');else _0x28c2b4=_0x7d19('0x3c');return _0x28c2b4;}exports[_0x7d19('0x61')]=function(_0x3fbdc2,_0x389b2f){var _0x5010ae={'count':0x0,'rows':[]},_0x187144={},_0x4b18bc,_0x34c9fa,_0x55c5ce=[_0x7d19('0x62'),_0x7d19('0x48'),_0x7d19('0x63'),'lastPauseAt',_0x7d19('0x64'),_0x7d19('0x65'),'internal',_0x7d19('0x66'),_0x7d19('0x51'),_0x7d19('0x54'),_0x7d19('0x53'),_0x7d19('0x55'),_0x7d19('0x67'),_0x7d19('0x52'),'voicePause',_0x7d19('0x68'),_0x7d19('0x69'),_0x7d19('0x6a'),'smsCapacity',_0x7d19('0x6b'),'faxCapacity','chatCurrentCapacity',_0x7d19('0x6c'),'mailCurrentCapacity',_0x7d19('0x6d'),_0x7d19('0x6e'),'faxCurrentCapacity',_0x7d19('0x6f'),_0x7d19('0x5c'),_0x7d19('0x5b'),_0x7d19('0x5d'),'whatsappStatus',_0x7d19('0x5a'),_0x7d19('0x58'),_0x7d19('0x70'),_0x7d19('0x71'),_0x7d19('0x72'),'smsStatusTime',_0x7d19('0x73'),_0x7d19('0x74'),_0x7d19('0x75'),_0x7d19('0x40'),'destconnectedlinenum',_0x7d19('0x76'),_0x7d19('0x77'),_0x7d19('0x78'),'routealias'],_0x273a57=[_0x7d19('0x51'),_0x7d19('0x54'),_0x7d19('0x53'),_0x7d19('0x55'),_0x7d19('0x67'),_0x7d19('0x52'),_0x7d19('0x56'),_0x7d19('0x48')];Promise[_0x7d19('0x79')]()[_0x7d19('0x15')](function(){var _0x5cf8f9=_[_0x7d19('0x36')](db[_0x7d19('0x49')][_0x7d19('0x7a')],function(_0x227aa8){return{'name':_0x227aa8[_0x7d19('0x7b')],'type':_0x227aa8[_0x7d19('0x7c')]['key']};});_0x3fbdc2['query'][_0x7d19('0x7d')]=_0x7d19('0x7e');_0x3fbdc2['query'][_0x7d19('0x48')]=!![];_0x187144=qs['getOptions'](_0x5cf8f9,_0x3fbdc2);_0x187144[_0x7d19('0x7f')]=!![];if(_0x3fbdc2[_0x7d19('0x80')][_0x7d19('0x7d')]===_0x7d19('0x80')){var _0x17478e={'params':{'id':_0x3fbdc2[_0x7d19('0x80')][_0x7d19('0x81')]},'query':{'section':_0x7d19('0x14'),'role':_0x7d19('0x7e'),'online':!![],'nolimit':_0x3fbdc2[_0x7d19('0x82')]['nolimit'],'sort':_0x3fbdc2[_0x7d19('0x82')][_0x7d19('0x83')],'filter':_0x3fbdc2[_0x7d19('0x82')]['filter']},'raw':!![]};return db[_0x7d19('0x84')][_0x7d19('0x85')](_0x17478e);}return db[_0x7d19('0x49')]['findAndCountAll'](_0x187144);})[_0x7d19('0x15')](function(_0x5f0dc2){_0x5010ae[_0x7d19('0xb')]=_0x5f0dc2[_0x7d19('0xb')];_0x4b18bc=_0x5f0dc2[_0x7d19('0x86')];return getRealtimeAgents();})['then'](function(_0xcacbda){_0x34c9fa=_0xcacbda[_0x7d19('0x86')];return _0x4b18bc[_0x7d19('0x36')](function(_0x228f8f){var _0x59d562=_[_0x7d19('0x4d')](_0x34c9fa,['id',_0x228f8f['id']]);if(_0x59d562)_[_0x7d19('0x1b')](_0x228f8f,_[_0x7d19('0x3e')](_['omit'](_0x59d562,_0x273a57),_0x55c5ce));_0x228f8f['globalStatus']=getAgentStatus(_0x228f8f);return _0x228f8f;});})['then'](function(_0x32fa8d){if(_0x3fbdc2[_0x7d19('0x82')][_0x7d19('0x87')]){var _0x3682e8=_[_0x7d19('0x3f')](_0x32fa8d,[_0x7d19('0x88'),_0x3fbdc2[_0x7d19('0x82')]['globalStatusFilter']]);if(_0x3fbdc2[_0x7d19('0x82')][_0x7d19('0x89')]){_0x3682e8=_[_0x7d19('0x3f')](_0x3682e8,[_0x7d19('0x64'),_0x3fbdc2[_0x7d19('0x82')][_0x7d19('0x89')]]);}}_0x5010ae['rows']=_0x3682e8||_0x32fa8d;return _0x5010ae;})[_0x7d19('0x15')](respondWithFilteredResult(_0x389b2f,_0x187144))[_0x7d19('0x20')](handleError(_0x389b2f,null));};exports['getQueues']=function(_0x336dd1,_0xb26d0){var _0x440eef=[_0x7d19('0x8a'),_0x7d19('0x8b'),_0x7d19('0x8c'),_0x7d19('0x8d'),_0x7d19('0x8e'),_0x7d19('0x8f'),'voice'];var _0x5158ff={'count':0x0,'rows':[]},_0xe71121={},_0x370c32,_0x1ab712,_0x15b315,_0x3670e9,_0x5e29f9;Promise[_0x7d19('0x79')]()[_0x7d19('0x15')](function(){if(_0x336dd1[_0x7d19('0x82')][_0x7d19('0x90')]){if(!_[_0x7d19('0x91')](_0x440eef,_0x336dd1[_0x7d19('0x82')][_0x7d19('0x90')]['toLowerCase']()))throw new Error(_0x7d19('0x92'));_0x370c32=_0x336dd1['query'][_0x7d19('0x90')][_0x7d19('0x93')]();}var _0x36fa10=_[_0x7d19('0x1c')](_0x370c32)+_0x7d19('0x4a');var _0x5eda46=_['map'](db[_0x36fa10][_0x7d19('0x7a')],function(_0x6c6aa0){return{'name':_0x6c6aa0[_0x7d19('0x7b')],'type':_0x6c6aa0[_0x7d19('0x7c')][_0x7d19('0x94')]};});_0xe71121=qs[_0x7d19('0x95')](_0x5eda46,_0x336dd1);if(_0x336dd1[_0x7d19('0x80')][_0x7d19('0x7d')]===_0x7d19('0x80')){var _0x2a3a07={'params':{'id':_0x336dd1[_0x7d19('0x80')][_0x7d19('0x81')]},'query':{'section':_0x370c32===_0x7d19('0x3a')&&_0x336dd1[_0x7d19('0x82')]['type']===_0x7d19('0x27')?_0x7d19('0x96'):_[_0x7d19('0x1c')](_0x370c32)+_0x7d19('0x1d'),'type':_0x336dd1[_0x7d19('0x82')][_0x7d19('0x7c')],'nolimit':!![],'sort':_0x7d19('0x12'),'filter':_0x336dd1['query'][_0x7d19('0x3f')]}};return db[_0x7d19('0x84')]['getResources'](_0x2a3a07);}return db[_0x36fa10][_0x7d19('0x97')](_0xe71121);})['then'](function(_0x5d17fe){_0x5158ff[_0x7d19('0xb')]=_0x5d17fe[_0x7d19('0xb')];_0x1ab712=_0x5d17fe['rows'];return getRealtimeQueues(_0x336dd1,_0x370c32);})['then'](function(_0x530084){_0x3670e9=_0x530084['rows'];return getRealtimeAgents();})['then'](function(_0x47adf3){_0x15b315=_0x47adf3[_0x7d19('0x86')];if(_0x370c32!='voice')return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x3cbaae){_0x5e29f9=_0x3cbaae?_0x3cbaae[_0x7d19('0x86')]:[];return initializeQueues(_0x1ab712,_0x3670e9,_0x370c32,_0x336dd1[_0x7d19('0x82')][_0x7d19('0x7c')]);})[_0x7d19('0x15')](function(_0x542faf){var _0x13edcf=_0x542faf[_0x7d19('0x36')](function(_0x2088cc){if(_0x370c32===_0x7d19('0x3a'))return getVoiceQueueAgents(_0x2088cc,_0x1ab712,_0x15b315,_0x5e29f9);else return getQueueAgents(_0x2088cc,_0x15b315,_0x370c32);});return Promise[_0x7d19('0x98')](_0x13edcf);})[_0x7d19('0x15')](function(_0x297c59){_0x5158ff['rows']=_0x297c59;return _0x5158ff;})[_0x7d19('0x15')](respondWithFilteredResult(_0xb26d0,_0xe71121))[_0x7d19('0x20')](handleError(_0xb26d0,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 6ad22a0..f0313b9 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(_0xf39ffa,_0x240fa9){var _0x551b6e=function(_0x36f55a){while(--_0x36f55a){_0xf39ffa['push'](_0xf39ffa['shift']());}};_0x551b6e(++_0x240fa9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x39a67b,_0x45936a){var _0x57de98=function(_0x851078){while(--_0x851078){_0x39a67b['push'](_0x39a67b['shift']());}};_0x57de98(++_0x45936a);}(_0x70e0,0x17b));var _0x070e=function(_0x1e22eb,_0x2ea530){_0x1e22eb=_0x1e22eb-0x0;var _0x1ca88d=_0x70e0[_0x1e22eb];return _0x1ca88d;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 23d3726..92a5465 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 _0x4cff=['sequelize','exports','STRING','DATE','INTEGER'];(function(_0x223fc7,_0x44fa1f){var _0xc58a9a=function(_0x33e085){while(--_0x33e085){_0x223fc7['push'](_0x223fc7['shift']());}};_0xc58a9a(++_0x44fa1f);}(_0x4cff,0x14a));var _0xf4cf=function(_0x303d3c,_0x51e735){_0x303d3c=_0x303d3c-0x0;var _0x556bd6=_0x4cff[_0x303d3c];return _0x556bd6;};'use strict';var Sequelize=require(_0xf4cf('0x0'));module[_0xf4cf('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xf4cf('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xf4cf('0x2')]},'starttime':{'type':Sequelize[_0xf4cf('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xf4cf('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xf4cf('0x2')]},'campaigntype':{'type':Sequelize[_0xf4cf('0x2')]},'membername':{'type':Sequelize[_0xf4cf('0x2')]}}; \ No newline at end of file +var _0x0f9f=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x17994e,_0x5c39ff){var _0x41e272=function(_0x5746c8){while(--_0x5746c8){_0x17994e['push'](_0x17994e['shift']());}};_0x41e272(++_0x5c39ff);}(_0x0f9f,0xae));var _0xf0f9=function(_0x1ae78f,_0x122ed2){_0x1ae78f=_0x1ae78f-0x0;var _0x5baf80=_0x0f9f[_0x1ae78f];return _0x5baf80;};'use strict';var Sequelize=require(_0xf0f9('0x0'));module[_0xf0f9('0x1')]={'state':{'type':Sequelize[_0xf0f9('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf0f9('0x3')]},'scheduledat':{'type':Sequelize[_0xf0f9('0x4')]},'uniqueid':{'type':Sequelize[_0xf0f9('0x3')]},'starttime':{'type':Sequelize[_0xf0f9('0x4')]},'responsetime':{'type':Sequelize[_0xf0f9('0x4')]},'ringtime':{'type':Sequelize[_0xf0f9('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xf0f9('0x3')]},'campaigntype':{'type':Sequelize[_0xf0f9('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 26cd010..bdfe977 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 _0xae07=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','define','report_agent_preview'];(function(_0x5e6e8f,_0x424bb9){var _0x1ec538=function(_0x3213a5){while(--_0x3213a5){_0x5e6e8f['push'](_0x5e6e8f['shift']());}};_0x1ec538(++_0x424bb9);}(_0xae07,0x16b));var _0x7ae0=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xae07[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x7ae0('0x0'));var util=require('util');var logger=require(_0x7ae0('0x1'))(_0x7ae0('0x2'));var moment=require(_0x7ae0('0x3'));var BPromise=require(_0x7ae0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ae0('0x5'));var rimraf=require(_0x7ae0('0x6'));var config=require(_0x7ae0('0x7'));var attributes=require(_0x7ae0('0x8'));module['exports']=function(_0xd1a629,_0x4bb385){return _0xd1a629[_0x7ae0('0x9')]('ReportAgentPreview',attributes,{'tableName':_0x7ae0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb55e=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','ReportAgentPreview','report_agent_preview','lodash'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb55e,0x6d));var _0xeb55=function(_0x291ae6,_0x256f7e){_0x291ae6=_0x291ae6-0x0;var _0x532557=_0xb55e[_0x291ae6];return _0x532557;};'use strict';var _=require(_0xeb55('0x0'));var util=require(_0xeb55('0x1'));var logger=require(_0xeb55('0x2'))('api');var moment=require('moment');var BPromise=require(_0xeb55('0x3'));var rp=require(_0xeb55('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb55('0x5'));var config=require(_0xeb55('0x6'));var attributes=require('./reportAgentPreview.attributes');module[_0xeb55('0x7')]=function(_0x235278,_0x58be61){return _0x235278['define'](_0xeb55('0x8'),attributes,{'tableName':_0xeb55('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 8e91ff4..8cc2520 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 _0x96aa=['client','http','request','then','info','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','ReportAgentPreview','create','body','options','raw','CreateReportAgentPreview','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x96aa,0x67));var _0xa96a=function(_0x2f0baa,_0x10e6a7){_0x2f0baa=_0x2f0baa-0x0;var _0x27d64b=_0x96aa[_0x2f0baa];return _0x27d64b;};'use strict';var _=require(_0xa96a('0x0'));var util=require(_0xa96a('0x1'));var moment=require('moment');var BPromise=require(_0xa96a('0x2'));var rs=require(_0xa96a('0x3'));var fs=require('fs');var Redis=require(_0xa96a('0x4'));var db=require(_0xa96a('0x5'))['db'];var utils=require(_0xa96a('0x6'));var logger=require('../../config/logger')(_0xa96a('0x7'));var config=require(_0xa96a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa96a('0x9')][_0xa96a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x282c8c,_0x3f391e,_0x44fb9d){return new BPromise(function(_0x3c7329,_0x160c16){return client[_0xa96a('0xb')](_0x282c8c,_0x44fb9d)[_0xa96a('0xc')](function(_0x134f9c){logger[_0xa96a('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x3f391e,_0xa96a('0xe'));logger['debug'](_0xa96a('0xf'),_0x3f391e,_0xa96a('0xe'),JSON['stringify'](_0x134f9c));if(_0x134f9c[_0xa96a('0x10')]){if(_0x134f9c[_0xa96a('0x10')][_0xa96a('0x11')]===0x1f4){logger[_0xa96a('0x10')](_0xa96a('0x12'),_0x3f391e,_0x134f9c[_0xa96a('0x10')][_0xa96a('0x13')]);return _0x160c16(_0x134f9c[_0xa96a('0x10')][_0xa96a('0x13')]);}logger[_0xa96a('0x10')](_0xa96a('0x12'),_0x3f391e,_0x134f9c[_0xa96a('0x10')]['message']);return _0x3c7329(_0x134f9c['error'][_0xa96a('0x13')]);}else{logger['info'](_0xa96a('0x12'),_0x3f391e,'request\x20sent');_0x3c7329(_0x134f9c[_0xa96a('0x14')][_0xa96a('0x13')]);}})[_0xa96a('0x15')](function(_0x3372f9){logger[_0xa96a('0x10')](_0xa96a('0x12'),_0x3f391e,_0x3372f9);_0x160c16(_0x3372f9);});});}exports['CreateReportAgentPreview']=function(_0x8d32c0){var _0xbcc80a=this;return new Promise(function(_0x48ca06,_0xf0dd61){return db[_0xa96a('0x16')][_0xa96a('0x17')](_0x8d32c0[_0xa96a('0x18')],{'raw':_0x8d32c0[_0xa96a('0x19')]?_0x8d32c0[_0xa96a('0x19')][_0xa96a('0x1a')]===undefined?!![]:![]:!![]})[_0xa96a('0xc')](function(_0x3f41ad){logger['info'](_0xa96a('0x1b'),_0x8d32c0);logger['debug'](_0xa96a('0x1b'),_0x8d32c0,JSON['stringify'](_0x3f41ad));_0x48ca06(_0x3f41ad);})[_0xa96a('0x15')](function(_0x96a6b2){logger['error']('CreateReportAgentPreview',_0x96a6b2[_0xa96a('0x13')],_0x8d32c0);_0xf0dd61(_0xbcc80a[_0xa96a('0x10')](0x1f4,_0x96a6b2[_0xa96a('0x13')]));});});}; \ No newline at end of file +var _0x8bcf=['message','result','catch','ReportAgentPreview','create','options','raw','CreateReportAgentPreview','debug','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8bcf,0x132));var _0xf8bc=function(_0x4dfc40,_0x21f915){_0x4dfc40=_0x4dfc40-0x0;var _0x297500=_0x8bcf[_0x4dfc40];return _0x297500;};'use strict';var _=require(_0xf8bc('0x0'));var util=require(_0xf8bc('0x1'));var moment=require('moment');var BPromise=require(_0xf8bc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf8bc('0x3'));var logger=require(_0xf8bc('0x4'))(_0xf8bc('0x5'));var config=require(_0xf8bc('0x6'));var jayson=require(_0xf8bc('0x7'));var client=jayson[_0xf8bc('0x8')][_0xf8bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31c1ba,_0x5a462f,_0xb3eba6){return new BPromise(function(_0x561d,_0x37175f){return client[_0xf8bc('0xa')](_0x31c1ba,_0xb3eba6)[_0xf8bc('0xb')](function(_0x106197){logger[_0xf8bc('0xc')](_0xf8bc('0xd'),_0x5a462f,'request\x20sent');logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x5a462f,_0xf8bc('0xe'),JSON[_0xf8bc('0xf')](_0x106197));if(_0x106197[_0xf8bc('0x10')]){if(_0x106197['error'][_0xf8bc('0x11')]===0x1f4){logger['error'](_0xf8bc('0xd'),_0x5a462f,_0x106197[_0xf8bc('0x10')]['message']);return _0x37175f(_0x106197[_0xf8bc('0x10')][_0xf8bc('0x12')]);}logger[_0xf8bc('0x10')](_0xf8bc('0xd'),_0x5a462f,_0x106197[_0xf8bc('0x10')][_0xf8bc('0x12')]);return _0x561d(_0x106197[_0xf8bc('0x10')][_0xf8bc('0x12')]);}else{logger[_0xf8bc('0xc')](_0xf8bc('0xd'),_0x5a462f,_0xf8bc('0xe'));_0x561d(_0x106197[_0xf8bc('0x13')][_0xf8bc('0x12')]);}})[_0xf8bc('0x14')](function(_0xfa970d){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x5a462f,_0xfa970d);_0x37175f(_0xfa970d);});});}exports['CreateReportAgentPreview']=function(_0xd100fa){var _0x51cd8f=this;return new Promise(function(_0x168539,_0x412696){return db[_0xf8bc('0x15')][_0xf8bc('0x16')](_0xd100fa['body'],{'raw':_0xd100fa[_0xf8bc('0x17')]?_0xd100fa['options'][_0xf8bc('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x5b65e3){logger[_0xf8bc('0xc')](_0xf8bc('0x19'),_0xd100fa);logger[_0xf8bc('0x1a')](_0xf8bc('0x19'),_0xd100fa,JSON[_0xf8bc('0xf')](_0x5b65e3));_0x168539(_0x5b65e3);})[_0xf8bc('0x14')](function(_0x2cc450){logger[_0xf8bc('0x10')]('CreateReportAgentPreview',_0x2cc450['message'],_0xd100fa);_0x412696(_0x51cd8f[_0xf8bc('0x10')](0x1f4,_0x2cc450['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 5fc4d74..3a52051 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 _0xde72=['/chat/queues/:id/notify','queueNotify','chat','showChatQueues','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','/telephones','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','mail','/mail/queues/:id','showMailQueues'];(function(_0x375837,_0x5bf426){var _0x3603cc=function(_0x15b1bc){while(--_0x15b1bc){_0x375837['push'](_0x375837['shift']());}};_0x3603cc(++_0x5bf426);}(_0xde72,0x1ac));var _0x2de7=function(_0x1ff1ee,_0x59a600){_0x1ff1ee=_0x1ff1ee-0x0;var _0xc541ba=_0xde72[_0x1ff1ee];return _0xc541ba;};'use strict';var multer=require(_0x2de7('0x0'));var util=require(_0x2de7('0x1'));var path=require(_0x2de7('0x2'));var express=require(_0x2de7('0x3'));var router=express[_0x2de7('0x4')]();var auth=require(_0x2de7('0x5'));var controller=require(_0x2de7('0x6'));router[_0x2de7('0x7')]('/voice/channels',auth[_0x2de7('0x8')](),controller[_0x2de7('0x9')]);router[_0x2de7('0x7')](_0x2de7('0xa'),auth[_0x2de7('0x8')](),controller[_0x2de7('0xb')]);router[_0x2de7('0x7')](_0x2de7('0xc'),auth[_0x2de7('0x8')](),controller[_0x2de7('0xd')]);router[_0x2de7('0x7')](_0x2de7('0xe'),auth[_0x2de7('0x8')](),controller[_0x2de7('0xf')]);router['get'](_0x2de7('0x10'),auth['isAuthenticated'](),controller['chatQueues']);router[_0x2de7('0x7')](_0x2de7('0x11'),auth[_0x2de7('0x8')](),controller[_0x2de7('0x12')]);router[_0x2de7('0x7')](_0x2de7('0x13'),auth[_0x2de7('0x8')](),controller['mailAccounts']);router[_0x2de7('0x7')](_0x2de7('0x14'),auth[_0x2de7('0x8')](),controller[_0x2de7('0x15')]);router[_0x2de7('0x7')](_0x2de7('0x16'),auth['isAuthenticated'](),controller[_0x2de7('0x17')]);router[_0x2de7('0x7')](_0x2de7('0x18'),auth[_0x2de7('0x8')](),controller['whatsappQueues']);router[_0x2de7('0x7')]('/fax/queues',auth[_0x2de7('0x8')](),controller[_0x2de7('0x19')]);router[_0x2de7('0x7')](_0x2de7('0x1a'),auth['isAuthenticated'](),controller[_0x2de7('0x1b')]);router[_0x2de7('0x7')](_0x2de7('0x1c'),auth[_0x2de7('0x8')](),controller[_0x2de7('0x1d')]);router[_0x2de7('0x7')](_0x2de7('0x1e'),auth[_0x2de7('0x8')](),controller['voiceQueuesChannel']);router[_0x2de7('0x7')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x2de7('0x8')](),controller[_0x2de7('0x1f')]);router[_0x2de7('0x7')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0x2de7('0x20')]);router[_0x2de7('0x7')](_0x2de7('0x21'),auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0x2de7('0x22')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x2de7('0x23')]);router[_0x2de7('0x7')]('/outbound',auth[_0x2de7('0x8')](),controller[_0x2de7('0x24')]);router[_0x2de7('0x7')](_0x2de7('0x25'),auth[_0x2de7('0x8')](),controller[_0x2de7('0x26')]);router['get'](_0x2de7('0x27'),auth[_0x2de7('0x8')](),controller['agents']);router[_0x2de7('0x22')](_0x2de7('0x28'),auth['isAuthenticated'](),controller['agentCapacity']);router['get'](_0x2de7('0x29'),auth[_0x2de7('0x8')](),controller[_0x2de7('0x2a')]);router[_0x2de7('0x7')]('/trunks',auth[_0x2de7('0x8')](),controller[_0x2de7('0x2b')]);router[_0x2de7('0x7')](_0x2de7('0x2c'),auth[_0x2de7('0x8')](),controller[_0x2de7('0x2d')]);router[_0x2de7('0x7')](_0x2de7('0x2e'),auth[_0x2de7('0x8')](),controller[_0x2de7('0x2f')]);router[_0x2de7('0x7')](_0x2de7('0x30'),auth[_0x2de7('0x8')](),controller[_0x2de7('0x31')]);router[_0x2de7('0x7')](_0x2de7('0x32'),auth[_0x2de7('0x8')](),controller['mailQueuesWaitingInteractions']);router[_0x2de7('0x7')](_0x2de7('0x33'),auth[_0x2de7('0x8')](),controller[_0x2de7('0x34')]);router[_0x2de7('0x7')]('/openchannel/queues/:id/waitinginteractions',auth[_0x2de7('0x8')](),controller[_0x2de7('0x35')]);router[_0x2de7('0x7')](_0x2de7('0x36'),auth[_0x2de7('0x8')](),controller[_0x2de7('0x37')]);router[_0x2de7('0x7')](_0x2de7('0x38'),auth[_0x2de7('0x8')](),controller[_0x2de7('0x39')]);router[_0x2de7('0x7')](_0x2de7('0x3a'),auth['isAuthenticated'](),controller[_0x2de7('0x3b')]);router[_0x2de7('0x3c')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x2de7('0x3d')));router['get'](_0x2de7('0x3e'),auth[_0x2de7('0x8')](),controller[_0x2de7('0x3f')]);router['post'](_0x2de7('0x40'),auth['isAuthenticated'](),controller[_0x2de7('0x41')](_0x2de7('0x42')));router[_0x2de7('0x7')]('/chat/queues/:id',auth[_0x2de7('0x8')](),controller[_0x2de7('0x43')]);router[_0x2de7('0x3c')]('/fax/queues/:id/notify',auth[_0x2de7('0x8')](),controller[_0x2de7('0x41')](_0x2de7('0x44')));router[_0x2de7('0x7')]('/fax/queues/:id',auth[_0x2de7('0x8')](),controller[_0x2de7('0x45')]);router[_0x2de7('0x3c')](_0x2de7('0x46'),auth[_0x2de7('0x8')](),controller['queueNotify'](_0x2de7('0x47')));router[_0x2de7('0x7')](_0x2de7('0x48'),auth['isAuthenticated'](),controller[_0x2de7('0x49')]);router['post'](_0x2de7('0x4a'),auth[_0x2de7('0x8')](),controller[_0x2de7('0x41')](_0x2de7('0x4b')));router['post'](_0x2de7('0x4c'),auth[_0x2de7('0x8')](),controller[_0x2de7('0x41')](_0x2de7('0x4d')));router[_0x2de7('0x7')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0x2de7('0x4e')]);router[_0x2de7('0x7')](_0x2de7('0x4f'),auth[_0x2de7('0x8')](),controller[_0x2de7('0x50')]);router[_0x2de7('0x3c')](_0x2de7('0x51'),auth['isAuthenticated'](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0x913e=['/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','util','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/chat/queues','chatQueues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions'];(function(_0x20eca8,_0x5cf63f){var _0x1dd774=function(_0x85e754){while(--_0x85e754){_0x20eca8['push'](_0x20eca8['shift']());}};_0x1dd774(++_0x5cf63f);}(_0x913e,0x1b2));var _0xe913=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x913e[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require(_0xe913('0x0'));var path=require('path');var express=require(_0xe913('0x1'));var router=express[_0xe913('0x2')]();var auth=require(_0xe913('0x3'));var controller=require(_0xe913('0x4'));router[_0xe913('0x5')](_0xe913('0x6'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0xe913('0x5')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xe913('0x7')](),controller[_0xe913('0x8')]);router[_0xe913('0x5')](_0xe913('0x9'),auth[_0xe913('0x7')](),controller[_0xe913('0xa')]);router[_0xe913('0x5')]('/voice/queues',auth[_0xe913('0x7')](),controller['voiceQueues']);router[_0xe913('0x5')](_0xe913('0xb'),auth[_0xe913('0x7')](),controller[_0xe913('0xc')]);router[_0xe913('0x5')]('/mail/queues',auth['isAuthenticated'](),controller[_0xe913('0xd')]);router[_0xe913('0x5')]('/mail/accounts',auth[_0xe913('0x7')](),controller[_0xe913('0xe')]);router[_0xe913('0x5')](_0xe913('0xf'),auth[_0xe913('0x7')](),controller[_0xe913('0x10')]);router[_0xe913('0x5')](_0xe913('0x11'),auth['isAuthenticated'](),controller['smsQueues']);router[_0xe913('0x5')](_0xe913('0x12'),auth['isAuthenticated'](),controller[_0xe913('0x13')]);router['get'](_0xe913('0x14'),auth[_0xe913('0x7')](),controller['faxQueues']);router[_0xe913('0x5')](_0xe913('0x15'),auth[_0xe913('0x7')](),controller[_0xe913('0x16')]);router['get'](_0xe913('0x17'),auth[_0xe913('0x7')](),controller[_0xe913('0x18')]);router[_0xe913('0x5')](_0xe913('0x19'),auth[_0xe913('0x7')](),controller[_0xe913('0x1a')]);router[_0xe913('0x5')](_0xe913('0x1b'),auth[_0xe913('0x7')](),controller[_0xe913('0x1c')]);router[_0xe913('0x5')](_0xe913('0x1d'),auth[_0xe913('0x7')](),controller[_0xe913('0x1e')]);router[_0xe913('0x5')](_0xe913('0x1f'),auth['isAuthenticated'](),controller[_0xe913('0x20')]);router[_0xe913('0x21')]('/voice/queues/:id',auth[_0xe913('0x7')](),controller['updateVoiceQueue']);router['get'](_0xe913('0x22'),auth[_0xe913('0x7')](),controller['outbound']);router['get'](_0xe913('0x23'),auth[_0xe913('0x7')](),controller['outboundChannels']);router['get'](_0xe913('0x24'),auth[_0xe913('0x7')](),controller[_0xe913('0x25')]);router[_0xe913('0x21')](_0xe913('0x26'),auth['isAuthenticated'](),controller[_0xe913('0x27')]);router[_0xe913('0x5')](_0xe913('0x28'),auth['isAuthenticated'](),controller[_0xe913('0x29')]);router[_0xe913('0x5')](_0xe913('0x2a'),auth[_0xe913('0x7')](),controller[_0xe913('0x2b')]);router['get'](_0xe913('0x2c'),auth[_0xe913('0x7')](),controller[_0xe913('0x2d')]);router['get'](_0xe913('0x2e'),auth['isAuthenticated'](),controller[_0xe913('0x2f')]);router[_0xe913('0x5')](_0xe913('0x30'),auth[_0xe913('0x7')](),controller[_0xe913('0x31')]);router[_0xe913('0x5')](_0xe913('0x32'),auth[_0xe913('0x7')](),controller['mailQueuesWaitingInteractions']);router['get'](_0xe913('0x33'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0xe913('0x5')](_0xe913('0x34'),auth[_0xe913('0x7')](),controller[_0xe913('0x35')]);router['get']('/sms/queues/waitinginteractions',auth[_0xe913('0x7')](),controller[_0xe913('0x36')]);router[_0xe913('0x5')]('/whatsapp/queues/waitinginteractions',auth[_0xe913('0x7')](),controller[_0xe913('0x37')]);router[_0xe913('0x5')]('/fax/queues/waitinginteractions',auth[_0xe913('0x7')](),controller[_0xe913('0x38')]);router[_0xe913('0x39')](_0xe913('0x3a'),auth[_0xe913('0x7')](),controller[_0xe913('0x3b')](_0xe913('0x3c')));router[_0xe913('0x5')]('/mail/queues/:id',auth[_0xe913('0x7')](),controller['showMailQueues']);router[_0xe913('0x39')](_0xe913('0x3d'),auth[_0xe913('0x7')](),controller[_0xe913('0x3b')](_0xe913('0x3e')));router[_0xe913('0x5')](_0xe913('0x3f'),auth[_0xe913('0x7')](),controller[_0xe913('0x40')]);router[_0xe913('0x39')](_0xe913('0x41'),auth['isAuthenticated'](),controller[_0xe913('0x3b')](_0xe913('0x42')));router[_0xe913('0x5')](_0xe913('0x43'),auth[_0xe913('0x7')](),controller[_0xe913('0x44')]);router[_0xe913('0x39')](_0xe913('0x45'),auth[_0xe913('0x7')](),controller[_0xe913('0x3b')](_0xe913('0x46')));router[_0xe913('0x5')]('/openchannel/queues/:id',auth[_0xe913('0x7')](),controller[_0xe913('0x47')]);router[_0xe913('0x39')](_0xe913('0x48'),auth['isAuthenticated'](),controller[_0xe913('0x3b')](_0xe913('0x49')));router[_0xe913('0x39')](_0xe913('0x4a'),auth[_0xe913('0x7')](),controller[_0xe913('0x3b')](_0xe913('0x4b')));router[_0xe913('0x5')](_0xe913('0x4c'),auth['isAuthenticated'](),controller[_0xe913('0x4d')]);router[_0xe913('0x5')](_0xe913('0x4e'),auth[_0xe913('0x7')](),controller[_0xe913('0x4f')]);router[_0xe913('0x39')](_0xe913('0x50'),auth[_0xe913('0x7')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 3d1c3f6..800227f 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 _0x5fc3=['openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','value','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','chat','User','\x20Message\x20not\x20found','Start','agentTransferTimeout','bluebird','moment','util','../../mysqldb','../../config/logger','api','jayson/promise','http','client','request','then','error','code','message','result','catch','status','json','sendStatus','name','send','isNil','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','format','length','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions'];(function(_0x2f6aeb,_0x2e9c4b){var _0x418c36=function(_0xbb6a4d){while(--_0xbb6a4d){_0x2f6aeb['push'](_0x2f6aeb['shift']());}};_0x418c36(++_0x2e9c4b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x5fc3[_0x397cfb];return _0x15fed9;};'use strict';var BPromise=require(_0x35fc('0x0'));var moment=require(_0x35fc('0x1'));var _=require('lodash');var util=require(_0x35fc('0x2'));var db=require(_0x35fc('0x3'))['db'];var logger=require(_0x35fc('0x4'))(_0x35fc('0x5'));var jayson=require(_0x35fc('0x6'));var amiClient=jayson['client'][_0x35fc('0x7')]({'port':0x232a});var mailClient=jayson[_0x35fc('0x8')][_0x35fc('0x7')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){var _0x1e5f90=_0x16e153?_0x16e153:amiClient;return _0x1e5f90[_0x35fc('0x9')](_0x19a0d1,_0x508b32)[_0x35fc('0xa')](function(_0x2051ab){if(_0x2051ab['error']){if(_0x2051ab[_0x35fc('0xb')][_0x35fc('0xc')]===0x1f4){return _0xc72d93(_0x2051ab['error'][_0x35fc('0xd')]);}return _0x27524f(_0x2051ab[_0x35fc('0xb')]['message']);}else{_0x27524f(_0x2051ab[_0x35fc('0xe')]);}})[_0x35fc('0xf')](function(_0x5469f5){_0xc72d93(_0x5469f5);});});}function respondWithResult(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xc8;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x10')](_0x409357)[_0x35fc('0x11')](_0x5d462a);}return _0x4cbe74[_0x35fc('0x12')](0x194);};}function handleError(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0x1f4;return function(_0x5cfe94){logger['error'](_0x5cfe94['stack']);if(_0x5cfe94['name']){delete _0x5cfe94[_0x35fc('0x13')];}_0x29730f[_0x35fc('0x10')](_0x38d9f2)[_0x35fc('0x14')](_0x5cfe94);};}function findById(_0x154958){return function(_0x227a49){if(!_[_0x35fc('0x15')](_0x154958)&&!_['isNil'](_0x227a49)&&!_[_0x35fc('0x15')](_0x227a49[_0x35fc('0x16')])){return _['find'](_0x227a49[_0x35fc('0x16')],function(_0x363e47){return _0x363e47['id']==_0x154958;});}return null;};}exports[_0x35fc('0x17')]=function(_0x5f56c6,_0x1a86e9){return respondWithRpcPromise(_0x35fc('0x18'),_0x5f56c6[_0x35fc('0x19')])['then'](respondWithResult(_0x1a86e9,null))[_0x35fc('0xf')](handleError(_0x1a86e9,null));};exports[_0x35fc('0x1a')]=function(_0x3229d1,_0x251a1f){return respondWithRpcPromise(_0x35fc('0x1b'),_[_0x35fc('0x1c')](_0x3229d1[_0x35fc('0x19')],_0x3229d1[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x251a1f,null))[_0x35fc('0xf')](handleError(_0x251a1f,null));};exports['voiceChannelStopMixMonitor']=function(_0x323aee,_0xd5399f){return respondWithRpcPromise(_0x35fc('0x1e'),_[_0x35fc('0x1c')](_0x323aee[_0x35fc('0x19')],_0x323aee['params']))[_0x35fc('0xa')](respondWithResult(_0xd5399f,null))[_0x35fc('0xf')](handleError(_0xd5399f,null));};exports['voiceQueues']=function(_0x265324,_0x5a93df){return respondWithRpcPromise(_0x35fc('0x1f'),_0x265324['query'])[_0x35fc('0xa')](respondWithResult(_0x5a93df,null))['catch'](handleError(_0x5a93df,null));};exports[_0x35fc('0x20')]=function(_0xdfab9f,_0x5cb986){return respondWithRpcPromise('VoiceQueues',_0xdfab9f[_0x35fc('0x19')])['then'](findById(_0xdfab9f[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x5cb986,null))['catch'](handleError(_0x5cb986,null));};exports[_0x35fc('0x21')]=function(_0x645eac,_0x383837){return respondWithRpcPromise(_0x35fc('0x22'),_[_0x35fc('0x1c')](_0x645eac[_0x35fc('0x23')],_0x645eac[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x383837,null))['catch'](handleError(_0x383837,null));};exports[_0x35fc('0x24')]=function(_0x220931,_0x22af18){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x35fc('0x1c')](_0x220931[_0x35fc('0x19')],_0x220931[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x22af18,null))[_0x35fc('0xf')](handleError(_0x22af18,null));};exports[_0x35fc('0x25')]=function(_0x222ddb,_0x37b435){return respondWithRpcPromise(_0x35fc('0x26'),_0x222ddb[_0x35fc('0x19')])['then'](respondWithResult(_0x37b435,null))['catch'](handleError(_0x37b435,null));};exports[_0x35fc('0x27')]=function(_0x4af5fe,_0x37b394){return respondWithRpcPromise(_0x35fc('0x28'),_[_0x35fc('0x1c')](_0x4af5fe[_0x35fc('0x19')],_0x4af5fe[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x37b394,null))['catch'](handleError(_0x37b394,null));};exports[_0x35fc('0x29')]=function(_0x330a14,_0x46b9ef){return respondWithRpcPromise(_0x35fc('0x2a'),_[_0x35fc('0x1c')](_0x330a14[_0x35fc('0x19')],_0x330a14['params']))[_0x35fc('0xa')](respondWithResult(_0x46b9ef,null))[_0x35fc('0xf')](handleError(_0x46b9ef,null));};exports[_0x35fc('0x2b')]=function(_0x52f53d,_0x2c657d){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x35fc('0x1c')](_0x52f53d[_0x35fc('0x19')],_0x52f53d[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x2c657d,null))['catch'](handleError(_0x2c657d,null));};exports['outbound']=function(_0x59e4fb,_0x20f5fe){return respondWithRpcPromise('Outbound',_0x59e4fb[_0x35fc('0x19')])['then'](respondWithResult(_0x20f5fe,null))[_0x35fc('0xf')](handleError(_0x20f5fe,null));};exports[_0x35fc('0x2c')]=function(_0x2ca9ac,_0x22b724){return respondWithRpcPromise(_0x35fc('0x2d'),_0x2ca9ac[_0x35fc('0x19')])[_0x35fc('0xa')](respondWithResult(_0x22b724,null))['catch'](handleError(_0x22b724,null));};exports[_0x35fc('0x2e')]=function(_0x16087d,_0x4e0ce3){var _0x1feda5;return respondWithRpcPromise(_0x35fc('0x2f'),_0x16087d[_0x35fc('0x19')])[_0x35fc('0xa')](function(_0x813866){_0x1feda5=_0x813866;return respondWithRpcPromise(_0x35fc('0x2f'),_0x16087d['query'],routingClient);})[_0x35fc('0xa')](function(_0x267858){return _[_0x35fc('0x1c')]({},_0x267858,_0x1feda5);})['then'](respondWithResult(_0x4e0ce3,null))[_0x35fc('0xf')](handleError(_0x4e0ce3,null));};exports[_0x35fc('0x30')]=function(_0x596919,_0x237548){if(_0x596919[_0x35fc('0x23')]&&_0x596919[_0x35fc('0x23')][_0x35fc('0x31')]&&_0x596919[_0x35fc('0x32')]&&_0x596919[_0x35fc('0x32')][_0x35fc('0x13')]){for(var _0x3ec51f in _0x596919['body']['interaction']){if(_0x596919[_0x35fc('0x23')][_0x35fc('0x31')]['hasOwnProperty'](_0x3ec51f)){db['MemberReport']['findAll']({'where':{'channel':_0x3ec51f,'membername':_0x596919[_0x35fc('0x32')][_0x35fc('0x13')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f]&&_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f]['length']?{'$notIn':_0x596919['body']['interaction'][_0x3ec51f]}:{'$ne':null}}})['then'](function(_0x56bdb9){var _0xb26e3f=moment()[_0x35fc('0x33')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x119925=0x0,_0x56cf1f=_0x56bdb9[_0x35fc('0x34')];_0x119925<_0x56cf1f;_0x119925+=0x1){_0x56bdb9[_0x119925][_0x35fc('0x35')]({'exitAt':_0xb26e3f});}});for(var _0x350237=0x0;_0x350237<_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f]['length'];_0x350237+=0x1){db[_0x35fc('0x36')][_0x35fc('0x37')]({'where':{'channel':_0x3ec51f,'membername':_0x596919['user'][_0x35fc('0x13')],'type':_0x35fc('0x38'),'uniqueid':_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f][_0x350237],'exitAt':null},'defaults':{'channel':_0x3ec51f,'membername':_0x596919['user'][_0x35fc('0x13')],'interface':_['isNil'](_0x596919['user'][_0x35fc('0x39')])?util[_0x35fc('0x33')](_0x35fc('0x3a'),_0x596919[_0x35fc('0x32')][_0x35fc('0x13')]):_0x596919[_0x35fc('0x32')][_0x35fc('0x39')],'type':_0x35fc('0x38'),'enterAt':moment()['format'](_0x35fc('0x3b')),'role':_0x35fc('0x3c'),'internal':_0x596919[_0x35fc('0x32')][_0x35fc('0x3d')],'uniqueid':_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f][_0x350237]}});}}}}return respondWithRpcPromise(_0x35fc('0x3e'),{'id':_0x596919[_0x35fc('0x1d')]['id'],'capacity':_0x596919[_0x35fc('0x23')][_0x35fc('0x3f')]},routingClient)[_0x35fc('0xa')](respondWithResult(_0x237548,null))[_0x35fc('0xf')](handleError(_0x237548,null));};exports[_0x35fc('0x40')]=function(_0x3146e2,_0x59c666){return respondWithRpcPromise('Telephones',_0x3146e2[_0x35fc('0x19')])[_0x35fc('0xa')](respondWithResult(_0x59c666,null))[_0x35fc('0xf')](handleError(_0x59c666,null));};exports[_0x35fc('0x41')]=function(_0x3ee296,_0x3e6494){return respondWithRpcPromise('Trunks',_0x3ee296['query'])[_0x35fc('0xa')](respondWithResult(_0x3e6494,null))[_0x35fc('0xf')](handleError(_0x3e6494,null));};exports[_0x35fc('0x42')]=function(_0x38bc78,_0x5b2595){return respondWithRpcPromise(_0x35fc('0x43'),_0x38bc78[_0x35fc('0x19')])['then'](respondWithResult(_0x5b2595,null))[_0x35fc('0xf')](handleError(_0x5b2595,null));};exports[_0x35fc('0x44')]=function(_0x590faa,_0x3e12e4){return respondWithRpcPromise(_0x35fc('0x45'),_0x590faa[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x3e12e4,null))['catch'](handleError(_0x3e12e4,null));};exports['showChatQueues']=function(_0x502a15,_0x240338){return respondWithRpcPromise(_0x35fc('0x45'),_0x502a15['query'],routingClient)[_0x35fc('0xa')](findById(_0x502a15[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x240338,null))[_0x35fc('0xf')](handleError(_0x240338,null));};exports[_0x35fc('0x46')]=function(_0x538be0,_0x2d9d45){return respondWithRpcPromise(_0x35fc('0x47'),_0x538be0[_0x35fc('0x19')],routingClient)['then'](respondWithResult(_0x2d9d45,null))[_0x35fc('0xf')](handleError(_0x2d9d45,null));};exports[_0x35fc('0x48')]=function(_0x47fb1a,_0x35a676){return respondWithRpcPromise(_0x35fc('0x47'),_0x47fb1a[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](findById(_0x47fb1a[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x35a676,null))[_0x35fc('0xf')](handleError(_0x35a676,null));};exports[_0x35fc('0x49')]=function(_0x53a79d,_0x10a5b8){return respondWithRpcPromise(_0x35fc('0x4a'),_0x53a79d[_0x35fc('0x19')],mailClient)['then'](respondWithResult(_0x10a5b8,null))[_0x35fc('0xf')](handleError(_0x10a5b8,null));};exports['openchannelQueues']=function(_0x4ceacc,_0x5d4a39){return respondWithRpcPromise(_0x35fc('0x4b'),_0x4ceacc[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x5d4a39,null))[_0x35fc('0xf')](handleError(_0x5d4a39,null));};exports[_0x35fc('0x4c')]=function(_0x4bbea0,_0x579f5a){return respondWithRpcPromise('OpenchannelQueues',_0x4bbea0['query'],routingClient)['then'](findById(_0x4bbea0[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x579f5a,null))[_0x35fc('0xf')](handleError(_0x579f5a,null));};exports[_0x35fc('0x4d')]=function(_0x511e8b,_0x458eb8){return respondWithRpcPromise(_0x35fc('0x4e'),_0x511e8b[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x458eb8,null))[_0x35fc('0xf')](handleError(_0x458eb8,null));};exports[_0x35fc('0x4f')]=function(_0x27071b,_0x2127e0){return respondWithRpcPromise(_0x35fc('0x4e'),_0x27071b['query'],routingClient)[_0x35fc('0xa')](findById(_0x27071b['params']['id']))[_0x35fc('0xa')](respondWithResult(_0x2127e0,null))[_0x35fc('0xf')](handleError(_0x2127e0,null));};exports[_0x35fc('0x50')]=function(_0x2bc76c,_0x4bdde7){return respondWithRpcPromise(_0x35fc('0x51'),_0x2bc76c['query'],routingClient)['then'](respondWithResult(_0x4bdde7,null))['catch'](handleError(_0x4bdde7,null));};exports[_0x35fc('0x52')]=function(_0x5dfeb7,_0x3c9027){return respondWithRpcPromise('WhatsappQueues',_0x5dfeb7[_0x35fc('0x19')],routingClient)['then'](findById(_0x5dfeb7[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x3c9027,null))[_0x35fc('0xf')](handleError(_0x3c9027,null));};exports[_0x35fc('0x53')]=function(_0x5c2ec0,_0x3d0ecc){return respondWithRpcPromise(_0x35fc('0x54'),_0x5c2ec0[_0x35fc('0x19')],routingClient)['then'](respondWithResult(_0x3d0ecc,null))[_0x35fc('0xf')](handleError(_0x3d0ecc,null));};exports[_0x35fc('0x55')]=function(_0x37764b,_0x3c1b56){return respondWithRpcPromise(_0x35fc('0x54'),_0x37764b[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](findById(_0x37764b[_0x35fc('0x1d')]['id']))['then'](respondWithResult(_0x3c1b56,null))[_0x35fc('0xf')](handleError(_0x3c1b56,null));};exports[_0x35fc('0x56')]=function(_0x2600d2,_0x4a926d){return respondWithRpcPromise(_0x35fc('0x57'),_0x2600d2[_0x35fc('0x19')])['then'](respondWithResult(_0x4a926d,null))['catch'](handleError(_0x4a926d,null));};exports[_0x35fc('0x58')]=function(_0x4835c2,_0x223ad3){return respondWithRpcPromise(_0x35fc('0x59'),_0x4835c2[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x223ad3,null))[_0x35fc('0xf')](handleError(_0x223ad3,null));};exports[_0x35fc('0x5a')]=function(_0x13f602,_0x104b1d){return respondWithRpcPromise(_0x35fc('0x5b'),_0x13f602[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x104b1d,null))[_0x35fc('0xf')](handleError(_0x104b1d,null));};exports[_0x35fc('0x5c')]=function(_0x9f034e,_0x184f28){return respondWithRpcPromise(_0x35fc('0x5d'),_0x9f034e[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x184f28,null))[_0x35fc('0xf')](handleError(_0x184f28,null));};exports[_0x35fc('0x5e')]=function(_0x4ba1b0,_0x1797d0){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4ba1b0[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](function(_0x2185ce){if(_0x4ba1b0[_0x35fc('0x19')][_0x35fc('0x5f')]!==undefined){var _0x3f56f4=_(_0x2185ce[_0x35fc('0x16')])[_0x35fc('0x60')]([_0x4ba1b0[_0x35fc('0x19')][_0x35fc('0x5f')],_0x4ba1b0[_0x35fc('0x1d')]['id']])['map'](_0x35fc('0x61'))[_0x35fc('0x62')]()[_0x35fc('0x63')]();return _0x2185ce[_0x35fc('0x16')][_0x35fc('0x60')](function(_0x41a6de){return _0x3f56f4['indexOf'](_0x41a6de[_0x35fc('0x61')])>-0x1;});}else{return _0x2185ce[_0x35fc('0x16')][_0x35fc('0x60')](function(_0x23206d){return _0x23206d[_0x35fc('0x61')]===parseInt(_0x4ba1b0[_0x35fc('0x1d')]['id']);});}})[_0x35fc('0xa')](respondWithResult(_0x1797d0,null))[_0x35fc('0xf')](handleError(_0x1797d0,null));};exports[_0x35fc('0x64')]=function(_0x5f23d8,_0x28f02b){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x5f23d8[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x28f02b,null))['catch'](handleError(_0x28f02b,null));};exports[_0x35fc('0x65')]=function(_0x41002a,_0xcaa49){return respondWithRpcPromise(_0x35fc('0x66'),_0x41002a[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0xcaa49,null))[_0x35fc('0xf')](handleError(_0xcaa49,null));};exports[_0x35fc('0x67')]=function(_0x25ee61,_0x5806bf){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x25ee61['query'],routingClient)['then'](respondWithResult(_0x5806bf,null))[_0x35fc('0xf')](handleError(_0x5806bf,null));};exports[_0x35fc('0x68')]=function(_0x8fc410){return function(_0x1f5cbc,_0x35ef53){var _0x4f535a,_0x226fdf;var _0x19682e=_[_0x35fc('0x69')](_0x8fc410);var _0x169ea2=_0x8fc410==='chat'?_0x35fc('0x6a'):_0x35fc('0x6b');return db[_0x19682e+_0x35fc('0x6c')]['findOne']({'raw':!![],'where':{'id':_0x1f5cbc[_0x35fc('0x1d')]['id']}})[_0x35fc('0xa')](function(_0x319033){if(_[_0x35fc('0x15')](_0x319033)){throw new Error(_0x19682e+_0x35fc('0x6d'));}_0x4f535a=_0x319033;return db[_0x19682e+_0x35fc('0x6e')][_0x35fc('0x6f')]({'where':{'id':_0x1f5cbc[_0x35fc('0x23')]['messageId']},'include':[{'model':db[_0x19682e+_0x35fc('0x70')],'as':_0x35fc('0x70')},{'model':db[_0x19682e+_0x169ea2],'as':_0x35fc('0x6b')}]});})[_0x35fc('0xa')](function(_0x221c5b){if(_[_0x35fc('0x15')](_0x221c5b)){throw new Error(_0x19682e+'\x20Message\x20not\x20found');}_0x226fdf=_0x221c5b;return _0x221c5b[_0x35fc('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x4855ee={'uniqueid':_0x8fc410+'.'+_0x226fdf['id']+'.'+_0x226fdf[_0x35fc('0x70')]['id'],'FromUserId':_0x1f5cbc['user']['id'],'type':_0x35fc('0x72')};_0x4855ee[_0x19682e+_0x35fc('0x73')]=_0x226fdf['id'];_0x4855ee[_0x19682e+_0x35fc('0x74')]=_0x226fdf['Interaction']['id'];_0x4855ee[_0x35fc('0x75')+_0x19682e+_0x169ea2+'Id']=_0x226fdf[_0x35fc('0x6b')]['id'];_0x4855ee['To'+_0x19682e+_0x35fc('0x76')]=_0x4f535a['id'];return db[_0x19682e+_0x35fc('0x77')][_0x35fc('0x78')](_0x4855ee);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x8fc410,'interaction':_0x226fdf['Interaction'],'message':_0x226fdf,'account':_0x226fdf[_0x35fc('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4f535a[_0x35fc('0x13')]+','+(_0x226fdf[_0x35fc('0x6b')][_0x35fc('0x79')]||0x12c),'interval':_0x35fc('0x7a')}]},routingClient);})['then'](respondWithResult(_0x35ef53,null))[_0x35fc('0xf')](handleError(_0x35ef53,null));};};exports[_0x35fc('0x7b')]=function(_0x312827,_0x47c507){var _0x128286,_0x175cc7;if(_[_0x35fc('0x15')](_0x312827['body']['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x32b9e1=_0x312827[_0x35fc('0x23')][_0x35fc('0x7c')];var _0x3858a9=_['capitalize'](_0x32b9e1);var _0x3ead4e=_0x32b9e1===_0x35fc('0x7d')?'Website':'Account';return db[_0x35fc('0x7e')][_0x35fc('0x6f')]({'raw':!![],'where':{'id':_0x312827[_0x35fc('0x1d')]['id'],'role':'agent'}})['then'](function(_0x134e60){if(_[_0x35fc('0x15')](_0x134e60)){throw new Error('Agent\x20not\x20found');}_0x128286=_0x134e60;return db[_0x3858a9+_0x35fc('0x6e')][_0x35fc('0x6f')]({'where':{'id':_0x312827[_0x35fc('0x23')]['messageId']},'include':[{'model':db[_0x3858a9+_0x35fc('0x70')],'as':_0x35fc('0x70')},{'model':db[_0x3858a9+_0x3ead4e],'as':_0x35fc('0x6b')}]});})[_0x35fc('0xa')](function(_0x4fd676){if(_[_0x35fc('0x15')](_0x4fd676)){throw new Error(_0x3858a9+_0x35fc('0x7f'));}_0x175cc7=_0x4fd676;return _0x4fd676[_0x35fc('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x96dfc={'uniqueid':_0x32b9e1+'.'+_0x175cc7['id']+'.'+_0x175cc7[_0x35fc('0x70')]['id'],'FromUserId':_0x312827[_0x35fc('0x32')]['id'],'type':'queue','ToUserId':_0x128286['id']};_0x96dfc[_0x3858a9+_0x35fc('0x73')]=_0x175cc7['id'];_0x96dfc[_0x3858a9+_0x35fc('0x74')]=_0x175cc7['Interaction']['id'];_0x96dfc[_0x35fc('0x75')+_0x3858a9+_0x3ead4e+'Id']=_0x175cc7[_0x35fc('0x6b')]['id'];return db[_0x3858a9+_0x35fc('0x77')][_0x35fc('0x78')](_0x96dfc);})[_0x35fc('0xa')](function(){return respondWithRpcPromise(_0x35fc('0x80'),{'channel':_0x32b9e1,'interaction':_0x175cc7[_0x35fc('0x70')],'message':_0x175cc7,'account':_0x175cc7[_0x35fc('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x35fc('0x3c'),'appdata':_0x128286['name']+','+(_0x175cc7[_0x35fc('0x6b')][_0x35fc('0x81')]||0x12c),'interval':_0x35fc('0x7a')}]},routingClient);})[_0x35fc('0xa')](respondWithResult(_0x47c507,null))['catch'](handleError(_0x47c507,null));}; \ No newline at end of file +var _0x6f47=['voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','interface','agent','internal','telephones','trunks','Trunks','Campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','Start','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','User','create','moment','lodash','../../mysqldb','api','client','http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel'];(function(_0x3ac965,_0xf22b6){var _0xf1c409=function(_0x278e5f){while(--_0x278e5f){_0x3ac965['push'](_0x3ac965['shift']());}};_0xf1c409(++_0xf22b6);}(_0x6f47,0xc7));var _0x76f4=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x6f47[_0x341e0f];return _0x59555a;};'use strict';var BPromise=require('bluebird');var moment=require(_0x76f4('0x0'));var _=require(_0x76f4('0x1'));var util=require('util');var db=require(_0x76f4('0x2'))['db'];var logger=require('../../config/logger')(_0x76f4('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x76f4('0x4')][_0x76f4('0x5')]({'port':0x232a});var mailClient=jayson[_0x76f4('0x4')][_0x76f4('0x5')]({'port':0x232b});var routingClient=jayson['client'][_0x76f4('0x5')]({'port':0x232c});function respondWithRpcPromise(_0xfc2405,_0x2176a7,_0x497f99){return new BPromise(function(_0x1a3172,_0x25656d){var _0x65d2c7=_0x497f99?_0x497f99:amiClient;return _0x65d2c7[_0x76f4('0x6')](_0xfc2405,_0x2176a7)[_0x76f4('0x7')](function(_0x4c6b5c){if(_0x4c6b5c['error']){if(_0x4c6b5c[_0x76f4('0x8')][_0x76f4('0x9')]===0x1f4){return _0x25656d(_0x4c6b5c['error']['message']);}return _0x1a3172(_0x4c6b5c[_0x76f4('0x8')][_0x76f4('0xa')]);}else{_0x1a3172(_0x4c6b5c[_0x76f4('0xb')]);}})[_0x76f4('0xc')](function(_0x1aee7f){_0x25656d(_0x1aee7f);});});}function respondWithResult(_0xafd21e,_0xf7e347){_0xf7e347=_0xf7e347||0xc8;return function(_0x3ec740){if(_0x3ec740){return _0xafd21e[_0x76f4('0xd')](_0xf7e347)['json'](_0x3ec740);}return _0xafd21e[_0x76f4('0xe')](0x194);};}function handleError(_0x30dabf,_0x5da1ff){_0x5da1ff=_0x5da1ff||0x1f4;return function(_0x4b6021){logger['error'](_0x4b6021[_0x76f4('0xf')]);if(_0x4b6021[_0x76f4('0x10')]){delete _0x4b6021[_0x76f4('0x10')];}_0x30dabf[_0x76f4('0xd')](_0x5da1ff)[_0x76f4('0x11')](_0x4b6021);};}function findById(_0x2b5e23){return function(_0x46ba51){if(!_[_0x76f4('0x12')](_0x2b5e23)&&!_[_0x76f4('0x12')](_0x46ba51)&&!_[_0x76f4('0x12')](_0x46ba51[_0x76f4('0x13')])){return _[_0x76f4('0x14')](_0x46ba51[_0x76f4('0x13')],function(_0x38450e){return _0x38450e['id']==_0x2b5e23;});}return null;};}exports[_0x76f4('0x15')]=function(_0x397360,_0xfedbe4){return respondWithRpcPromise(_0x76f4('0x16'),_0x397360[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0xfedbe4,null))[_0x76f4('0xc')](handleError(_0xfedbe4,null));};exports[_0x76f4('0x18')]=function(_0x5bf3d5,_0x262937){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x76f4('0x19')](_0x5bf3d5[_0x76f4('0x17')],_0x5bf3d5[_0x76f4('0x1a')]))['then'](respondWithResult(_0x262937,null))['catch'](handleError(_0x262937,null));};exports['voiceChannelStopMixMonitor']=function(_0x465240,_0x681d67){return respondWithRpcPromise(_0x76f4('0x1b'),_[_0x76f4('0x19')](_0x465240[_0x76f4('0x17')],_0x465240[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x681d67,null))['catch'](handleError(_0x681d67,null));};exports['voiceQueues']=function(_0x3794fa,_0x497913){return respondWithRpcPromise(_0x76f4('0x1c'),_0x3794fa['query'])['then'](respondWithResult(_0x497913,null))['catch'](handleError(_0x497913,null));};exports[_0x76f4('0x1d')]=function(_0x38300d,_0xd368a2){return respondWithRpcPromise(_0x76f4('0x1c'),_0x38300d[_0x76f4('0x17')])[_0x76f4('0x7')](findById(_0x38300d['params']['id']))[_0x76f4('0x7')](respondWithResult(_0xd368a2,null))['catch'](handleError(_0xd368a2,null));};exports['updateVoiceQueue']=function(_0x5b3f07,_0x10ddb4){return respondWithRpcPromise(_0x76f4('0x1e'),_[_0x76f4('0x19')](_0x5b3f07[_0x76f4('0x1f')],_0x5b3f07['params']))[_0x76f4('0x7')](respondWithResult(_0x10ddb4,null))['catch'](handleError(_0x10ddb4,null));};exports[_0x76f4('0x20')]=function(_0x3c7513,_0x43ac4a){return respondWithRpcPromise(_0x76f4('0x21'),_[_0x76f4('0x19')](_0x3c7513['query'],_0x3c7513['params']))[_0x76f4('0x7')](respondWithResult(_0x43ac4a,null))[_0x76f4('0xc')](handleError(_0x43ac4a,null));};exports[_0x76f4('0x22')]=function(_0x281db6,_0x1f2adf){return respondWithRpcPromise(_0x76f4('0x23'),_0x281db6[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x1f2adf,null))[_0x76f4('0xc')](handleError(_0x1f2adf,null));};exports[_0x76f4('0x24')]=function(_0x308af2,_0x2527a6){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x308af2['query'],_0x308af2['params']))[_0x76f4('0x7')](respondWithResult(_0x2527a6,null))[_0x76f4('0xc')](handleError(_0x2527a6,null));};exports[_0x76f4('0x25')]=function(_0x456b1f,_0x26fdd6){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x76f4('0x19')](_0x456b1f[_0x76f4('0x17')],_0x456b1f[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x26fdd6,null))[_0x76f4('0xc')](handleError(_0x26fdd6,null));};exports[_0x76f4('0x26')]=function(_0xb806cc,_0x28d9d6){return respondWithRpcPromise(_0x76f4('0x27'),_[_0x76f4('0x19')](_0xb806cc[_0x76f4('0x17')],_0xb806cc[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x28d9d6,null))[_0x76f4('0xc')](handleError(_0x28d9d6,null));};exports[_0x76f4('0x28')]=function(_0x88506b,_0x3308e3){return respondWithRpcPromise(_0x76f4('0x29'),_0x88506b['query'])[_0x76f4('0x7')](respondWithResult(_0x3308e3,null))[_0x76f4('0xc')](handleError(_0x3308e3,null));};exports[_0x76f4('0x2a')]=function(_0x589637,_0x597e83){return respondWithRpcPromise(_0x76f4('0x2b'),_0x589637['query'])[_0x76f4('0x7')](respondWithResult(_0x597e83,null))['catch'](handleError(_0x597e83,null));};exports[_0x76f4('0x2c')]=function(_0x16f36d,_0x312243){var _0x378675;return respondWithRpcPromise(_0x76f4('0x2d'),_0x16f36d[_0x76f4('0x17')])[_0x76f4('0x7')](function(_0x109ad9){_0x378675=_0x109ad9;return respondWithRpcPromise(_0x76f4('0x2d'),_0x16f36d[_0x76f4('0x17')],routingClient);})['then'](function(_0x5b8d2d){return _[_0x76f4('0x19')]({},_0x5b8d2d,_0x378675);})[_0x76f4('0x7')](respondWithResult(_0x312243,null))[_0x76f4('0xc')](handleError(_0x312243,null));};exports[_0x76f4('0x2e')]=function(_0x2b7dc8,_0x2d6068){if(_0x2b7dc8[_0x76f4('0x1f')]&&_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')]&&_0x2b7dc8['user']&&_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')]){for(var _0x4f0d1a in _0x2b7dc8['body'][_0x76f4('0x2f')]){if(_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x76f4('0x31')](_0x4f0d1a)){db[_0x76f4('0x32')]['findAll']({'where':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'type':_0x76f4('0x33'),'exitAt':null,'uniqueid':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a]&&_0x2b7dc8[_0x76f4('0x1f')]['interaction'][_0x4f0d1a][_0x76f4('0x34')]?{'$notIn':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a]}:{'$ne':null}}})['then'](function(_0x571261){var _0x11ea58=moment()[_0x76f4('0x35')](_0x76f4('0x36'));for(var _0x2bea6d=0x0,_0x36fa03=_0x571261['length'];_0x2bea6d<_0x36fa03;_0x2bea6d+=0x1){_0x571261[_0x2bea6d]['updateAttributes']({'exitAt':_0x11ea58});}});for(var _0x8e5b60=0x0;_0x8e5b60<_0x2b7dc8['body'][_0x76f4('0x2f')][_0x4f0d1a][_0x76f4('0x34')];_0x8e5b60+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'type':_0x76f4('0x33'),'uniqueid':_0x2b7dc8[_0x76f4('0x1f')]['interaction'][_0x4f0d1a][_0x8e5b60],'exitAt':null},'defaults':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'interface':_[_0x76f4('0x12')](_0x2b7dc8['user'][_0x76f4('0x37')])?util[_0x76f4('0x35')]('SIP/%s',_0x2b7dc8['user'][_0x76f4('0x10')]):_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x37')],'type':_0x76f4('0x33'),'enterAt':moment()[_0x76f4('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x76f4('0x38'),'internal':_0x2b7dc8['user'][_0x76f4('0x39')],'uniqueid':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a][_0x8e5b60]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b7dc8[_0x76f4('0x1a')]['id'],'capacity':_0x2b7dc8[_0x76f4('0x1f')]['capacity']},routingClient)[_0x76f4('0x7')](respondWithResult(_0x2d6068,null))[_0x76f4('0xc')](handleError(_0x2d6068,null));};exports[_0x76f4('0x3a')]=function(_0x1c658c,_0x40ff20){return respondWithRpcPromise('Telephones',_0x1c658c[_0x76f4('0x17')])['then'](respondWithResult(_0x40ff20,null))[_0x76f4('0xc')](handleError(_0x40ff20,null));};exports[_0x76f4('0x3b')]=function(_0x154ba,_0x5121ec){return respondWithRpcPromise(_0x76f4('0x3c'),_0x154ba[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x5121ec,null))[_0x76f4('0xc')](handleError(_0x5121ec,null));};exports['campaigns']=function(_0x2028e9,_0xf11e07){return respondWithRpcPromise(_0x76f4('0x3d'),_0x2028e9[_0x76f4('0x17')])['then'](respondWithResult(_0xf11e07,null))[_0x76f4('0xc')](handleError(_0xf11e07,null));};exports['chatQueues']=function(_0x129048,_0x190c8d){return respondWithRpcPromise('ChatQueues',_0x129048['query'],routingClient)[_0x76f4('0x7')](respondWithResult(_0x190c8d,null))[_0x76f4('0xc')](handleError(_0x190c8d,null));};exports[_0x76f4('0x3e')]=function(_0x596b51,_0x27ba06){return respondWithRpcPromise(_0x76f4('0x3f'),_0x596b51[_0x76f4('0x17')],routingClient)['then'](findById(_0x596b51['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x27ba06,null))[_0x76f4('0xc')](handleError(_0x27ba06,null));};exports['mailQueues']=function(_0x490ced,_0x3f1840){return respondWithRpcPromise(_0x76f4('0x40'),_0x490ced[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x3f1840,null))[_0x76f4('0xc')](handleError(_0x3f1840,null));};exports[_0x76f4('0x41')]=function(_0x97be11,_0x36a52a){return respondWithRpcPromise(_0x76f4('0x40'),_0x97be11['query'],routingClient)['then'](findById(_0x97be11['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x36a52a,null))[_0x76f4('0xc')](handleError(_0x36a52a,null));};exports[_0x76f4('0x42')]=function(_0x3b6c16,_0x4c9d64){return respondWithRpcPromise('MailAccounts',_0x3b6c16[_0x76f4('0x17')],mailClient)['then'](respondWithResult(_0x4c9d64,null))[_0x76f4('0xc')](handleError(_0x4c9d64,null));};exports['openchannelQueues']=function(_0x4285dd,_0x25e510){return respondWithRpcPromise(_0x76f4('0x43'),_0x4285dd[_0x76f4('0x17')],routingClient)['then'](respondWithResult(_0x25e510,null))[_0x76f4('0xc')](handleError(_0x25e510,null));};exports[_0x76f4('0x44')]=function(_0x22a0cc,_0x40c170){return respondWithRpcPromise(_0x76f4('0x43'),_0x22a0cc[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](findById(_0x22a0cc['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x40c170,null))[_0x76f4('0xc')](handleError(_0x40c170,null));};exports[_0x76f4('0x45')]=function(_0x320a87,_0x28cf4c){return respondWithRpcPromise(_0x76f4('0x46'),_0x320a87[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x28cf4c,null))['catch'](handleError(_0x28cf4c,null));};exports['showSmsQueues']=function(_0xa3091a,_0x617924){return respondWithRpcPromise(_0x76f4('0x46'),_0xa3091a['query'],routingClient)[_0x76f4('0x7')](findById(_0xa3091a['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x617924,null))[_0x76f4('0xc')](handleError(_0x617924,null));};exports['whatsappQueues']=function(_0xda0ac2,_0x37b7f7){return respondWithRpcPromise(_0x76f4('0x47'),_0xda0ac2[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x37b7f7,null))[_0x76f4('0xc')](handleError(_0x37b7f7,null));};exports[_0x76f4('0x48')]=function(_0x410d83,_0x1f7257){return respondWithRpcPromise('WhatsappQueues',_0x410d83[_0x76f4('0x17')],routingClient)['then'](findById(_0x410d83[_0x76f4('0x1a')]['id']))[_0x76f4('0x7')](respondWithResult(_0x1f7257,null))[_0x76f4('0xc')](handleError(_0x1f7257,null));};exports[_0x76f4('0x49')]=function(_0xfbb52c,_0x8de630){return respondWithRpcPromise(_0x76f4('0x4a'),_0xfbb52c[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x8de630,null))[_0x76f4('0xc')](handleError(_0x8de630,null));};exports['showFaxQueues']=function(_0x30f3de,_0x6f874d){return respondWithRpcPromise('FaxQueues',_0x30f3de[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](findById(_0x30f3de[_0x76f4('0x1a')]['id']))['then'](respondWithResult(_0x6f874d,null))[_0x76f4('0xc')](handleError(_0x6f874d,null));};exports[_0x76f4('0x4b')]=function(_0x3e829f,_0x52610a){return respondWithRpcPromise(_0x76f4('0x4c'),_0x3e829f[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x52610a,null))[_0x76f4('0xc')](handleError(_0x52610a,null));};exports[_0x76f4('0x4d')]=function(_0x10ee07,_0x19b99c){return respondWithRpcPromise(_0x76f4('0x4e'),_0x10ee07[_0x76f4('0x17')],routingClient)['then'](respondWithResult(_0x19b99c,null))[_0x76f4('0xc')](handleError(_0x19b99c,null));};exports[_0x76f4('0x4f')]=function(_0x19fdc3,_0x39c9af){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x19fdc3[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x39c9af,null))[_0x76f4('0xc')](handleError(_0x39c9af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x43b44d,_0x1375d5){return respondWithRpcPromise(_0x76f4('0x50'),_0x43b44d[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x1375d5,null))['catch'](handleError(_0x1375d5,null));};exports[_0x76f4('0x51')]=function(_0x4dd41f,_0x2b8467){return respondWithRpcPromise(_0x76f4('0x50'),_0x4dd41f['query'],routingClient)['then'](function(_0x58251e){if(_0x4dd41f[_0x76f4('0x17')][_0x76f4('0x52')]!==undefined){var _0x1e7b6=_(_0x58251e[_0x76f4('0x13')])[_0x76f4('0x53')]([_0x4dd41f[_0x76f4('0x17')]['type'],_0x4dd41f[_0x76f4('0x1a')]['id']])[_0x76f4('0x54')](_0x76f4('0x55'))[_0x76f4('0x56')]()[_0x76f4('0x57')]();return _0x58251e[_0x76f4('0x13')][_0x76f4('0x53')](function(_0x202fc8){return _0x1e7b6['indexOf'](_0x202fc8[_0x76f4('0x55')])>-0x1;});}else{return _0x58251e['rows'][_0x76f4('0x53')](function(_0x30358a){return _0x30358a[_0x76f4('0x55')]===parseInt(_0x4dd41f[_0x76f4('0x1a')]['id']);});}})[_0x76f4('0x7')](respondWithResult(_0x2b8467,null))[_0x76f4('0xc')](handleError(_0x2b8467,null));};exports[_0x76f4('0x58')]=function(_0x2a0491,_0x54729b){return respondWithRpcPromise(_0x76f4('0x59'),_0x2a0491['query'],routingClient)['then'](respondWithResult(_0x54729b,null))['catch'](handleError(_0x54729b,null));};exports[_0x76f4('0x5a')]=function(_0x402209,_0x279040){return respondWithRpcPromise(_0x76f4('0x5b'),_0x402209['query'],routingClient)[_0x76f4('0x7')](respondWithResult(_0x279040,null))[_0x76f4('0xc')](handleError(_0x279040,null));};exports[_0x76f4('0x5c')]=function(_0x5f5c24,_0x12f16e){return respondWithRpcPromise(_0x76f4('0x5d'),_0x5f5c24[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x12f16e,null))[_0x76f4('0xc')](handleError(_0x12f16e,null));};exports[_0x76f4('0x5e')]=function(_0x3b5e15){return function(_0x4b562c,_0x2e991e){var _0xa49e2a,_0x4c7307;var _0x3bc914=_[_0x76f4('0x5f')](_0x3b5e15);var _0x5e6393=_0x3b5e15===_0x76f4('0x60')?_0x76f4('0x61'):_0x76f4('0x62');return db[_0x3bc914+_0x76f4('0x63')][_0x76f4('0x64')]({'raw':!![],'where':{'id':_0x4b562c[_0x76f4('0x1a')]['id']}})['then'](function(_0x2dac86){if(_[_0x76f4('0x12')](_0x2dac86)){throw new Error(_0x3bc914+_0x76f4('0x65'));}_0xa49e2a=_0x2dac86;return db[_0x3bc914+_0x76f4('0x66')]['findOne']({'where':{'id':_0x4b562c[_0x76f4('0x1f')]['messageId']},'include':[{'model':db[_0x3bc914+_0x76f4('0x67')],'as':'Interaction'},{'model':db[_0x3bc914+_0x5e6393],'as':_0x76f4('0x62')}]});})[_0x76f4('0x7')](function(_0x59e9ed){if(_['isNil'](_0x59e9ed)){throw new Error(_0x3bc914+_0x76f4('0x68'));}_0x4c7307=_0x59e9ed;return _0x59e9ed[_0x76f4('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x76f4('0x7')](function(){var _0x4a2969={'uniqueid':_0x3b5e15+'.'+_0x4c7307['id']+'.'+_0x4c7307['Interaction']['id'],'FromUserId':_0x4b562c[_0x76f4('0x30')]['id'],'type':_0x76f4('0x6a')};_0x4a2969[_0x3bc914+_0x76f4('0x6b')]=_0x4c7307['id'];_0x4a2969[_0x3bc914+_0x76f4('0x6c')]=_0x4c7307[_0x76f4('0x67')]['id'];_0x4a2969[_0x76f4('0x6d')+_0x3bc914+_0x5e6393+'Id']=_0x4c7307[_0x76f4('0x62')]['id'];_0x4a2969['To'+_0x3bc914+_0x76f4('0x6e')]=_0xa49e2a['id'];return db[_0x3bc914+'TransferReport']['create'](_0x4a2969);})[_0x76f4('0x7')](function(){return respondWithRpcPromise(_0x76f4('0x6f'),{'channel':_0x3b5e15,'interaction':_0x4c7307[_0x76f4('0x67')],'message':_0x4c7307,'account':_0x4c7307['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x76f4('0x6a'),'appdata':_0xa49e2a[_0x76f4('0x10')]+','+(_0x4c7307[_0x76f4('0x62')][_0x76f4('0x70')]||0x12c),'interval':_0x76f4('0x71')}]},routingClient);})[_0x76f4('0x7')](respondWithResult(_0x2e991e,null))[_0x76f4('0xc')](handleError(_0x2e991e,null));};};exports['agentNotify']=function(_0x13cf2a,_0x316f86){var _0x3e537b,_0x53252e;if(_[_0x76f4('0x12')](_0x13cf2a[_0x76f4('0x1f')][_0x76f4('0x72')])){throw new Error(_0x76f4('0x73'));}var _0x5080a9=_0x13cf2a[_0x76f4('0x1f')]['channel'];var _0xc80d4c=_['capitalize'](_0x5080a9);var _0x238df3=_0x5080a9===_0x76f4('0x60')?_0x76f4('0x61'):'Account';return db[_0x76f4('0x74')][_0x76f4('0x64')]({'raw':!![],'where':{'id':_0x13cf2a[_0x76f4('0x1a')]['id'],'role':'agent'}})[_0x76f4('0x7')](function(_0x460867){if(_['isNil'](_0x460867)){throw new Error('Agent\x20not\x20found');}_0x3e537b=_0x460867;return db[_0xc80d4c+_0x76f4('0x66')][_0x76f4('0x64')]({'where':{'id':_0x13cf2a['body']['messageId']},'include':[{'model':db[_0xc80d4c+_0x76f4('0x67')],'as':_0x76f4('0x67')},{'model':db[_0xc80d4c+_0x238df3],'as':'Account'}]});})[_0x76f4('0x7')](function(_0x54ae6c){if(_['isNil'](_0x54ae6c)){throw new Error(_0xc80d4c+'\x20Message\x20not\x20found');}_0x53252e=_0x54ae6c;return _0x54ae6c[_0x76f4('0x69')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x59265d={'uniqueid':_0x5080a9+'.'+_0x53252e['id']+'.'+_0x53252e[_0x76f4('0x67')]['id'],'FromUserId':_0x13cf2a['user']['id'],'type':'queue','ToUserId':_0x3e537b['id']};_0x59265d[_0xc80d4c+_0x76f4('0x6b')]=_0x53252e['id'];_0x59265d[_0xc80d4c+'InteractionId']=_0x53252e[_0x76f4('0x67')]['id'];_0x59265d[_0x76f4('0x6d')+_0xc80d4c+_0x238df3+'Id']=_0x53252e['Account']['id'];return db[_0xc80d4c+'TransferReport'][_0x76f4('0x75')](_0x59265d);})[_0x76f4('0x7')](function(){return respondWithRpcPromise(_0x76f4('0x6f'),{'channel':_0x5080a9,'interaction':_0x53252e['Interaction'],'message':_0x53252e,'account':_0x53252e[_0x76f4('0x62')],'applications':[{'id':0x0,'priority':0x1,'app':_0x76f4('0x38'),'appdata':_0x3e537b[_0x76f4('0x10')]+','+(_0x53252e[_0x76f4('0x62')]['agentTransferTimeout']||0x12c),'interval':_0x76f4('0x71')}]},routingClient);})[_0x76f4('0x7')](respondWithResult(_0x316f86,null))[_0x76f4('0xc')](handleError(_0x316f86,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index b854e2a..83edb40 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 _0xd014=['../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id/run','run','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x18f396,_0x174d17){var _0x3ba532=function(_0x2bc92f){while(--_0x2bc92f){_0x18f396['push'](_0x18f396['shift']());}};_0x3ba532(++_0x174d17);}(_0xd014,0x10c));var _0x4d01=function(_0x243fd3,_0x25e8d3){_0x243fd3=_0x243fd3-0x0;var _0x1575b7=_0xd014[_0x243fd3];return _0x1575b7;};'use strict';var multer=require(_0x4d01('0x0'));var util=require('util');var path=require(_0x4d01('0x1'));var timeout=require(_0x4d01('0x2'));var express=require('express');var router=express[_0x4d01('0x3')]();var fs_extra=require(_0x4d01('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4d01('0x5'));var config=require(_0x4d01('0x6'));var controller=require(_0x4d01('0x7'));router[_0x4d01('0x8')]('/',auth[_0x4d01('0x9')](),controller[_0x4d01('0xa')]);router[_0x4d01('0x8')]('/:id',auth[_0x4d01('0x9')](),controller['show']);router[_0x4d01('0x8')](_0x4d01('0xb'),auth[_0x4d01('0x9')](),controller[_0x4d01('0xc')]);router[_0x4d01('0xd')]('/',auth[_0x4d01('0x9')](),controller[_0x4d01('0xe')]);router[_0x4d01('0xf')](_0x4d01('0x10'),auth['isAuthenticated'](),controller[_0x4d01('0x11')]);router[_0x4d01('0x12')](_0x4d01('0x10'),auth['isAuthenticated'](),controller[_0x4d01('0x13')]);module[_0x4d01('0x14')]=router; \ No newline at end of file +var _0xaba5=['path','express','Router','fs-extra','../../components/auth/service','./schedule.controller','get','isAuthenticated','index','run','/:id','update','destroy','exports','multer','util'];(function(_0x369c91,_0x47d79c){var _0x22e01a=function(_0x193380){while(--_0x193380){_0x369c91['push'](_0x369c91['shift']());}};_0x22e01a(++_0x47d79c);}(_0xaba5,0xce));var _0x5aba=function(_0x2c2db4,_0x47a4fc){_0x2c2db4=_0x2c2db4-0x0;var _0x452be2=_0xaba5[_0x2c2db4];return _0x452be2;};'use strict';var multer=require(_0x5aba('0x0'));var util=require(_0x5aba('0x1'));var path=require(_0x5aba('0x2'));var timeout=require('connect-timeout');var express=require(_0x5aba('0x3'));var router=express[_0x5aba('0x4')]();var fs_extra=require(_0x5aba('0x5'));var auth=require(_0x5aba('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5aba('0x7'));router[_0x5aba('0x8')]('/',auth[_0x5aba('0x9')](),controller[_0x5aba('0xa')]);router[_0x5aba('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5aba('0x8')]('/:id/run',auth[_0x5aba('0x9')](),controller[_0x5aba('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x5aba('0xc'),auth[_0x5aba('0x9')](),controller[_0x5aba('0xd')]);router['delete']('/:id',auth[_0x5aba('0x9')](),controller[_0x5aba('0xe')]);module[_0x5aba('0xf')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 31f6ca4..d1a95fe 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 _0x0bec=['BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months','weeks','days','hours','csv','pdf','xlsx','custom','TEXT','sequelize','exports','STRING'];(function(_0xc46b2b,_0x39a6c2){var _0x5d7d80=function(_0xa2ebb7){while(--_0xa2ebb7){_0xc46b2b['push'](_0xc46b2b['shift']());}};_0x5d7d80(++_0x39a6c2);}(_0x0bec,0x153));var _0xc0be=function(_0x5b0629,_0x1520d1){_0x5b0629=_0x5b0629-0x0;var _0x14faa2=_0x0bec[_0x5b0629];return _0x14faa2;};'use strict';var Sequelize=require(_0xc0be('0x0'));module[_0xc0be('0x1')]={'name':{'type':Sequelize[_0xc0be('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc0be('0x2')]},'active':{'type':Sequelize[_0xc0be('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xc0be('0x2')],'allowNull':![],'defaultValue':_0xc0be('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xc0be('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xc0be('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xc0be('0x7')]('years',_0xc0be('0x8'),_0xc0be('0x9'),_0xc0be('0xa'),_0xc0be('0xb'),_0xc0be('0xc'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM'](_0xc0be('0xd'),_0xc0be('0xe'),_0xc0be('0xf')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xc0be('0x7')](_0xc0be('0x10'),'default'),'allowNull':![],'defaultValue':_0xc0be('0x10')},'sendMail':{'type':Sequelize[_0xc0be('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xc0be('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xc0be('0x11')]},'sendIfEmpty':{'type':Sequelize[_0xc0be('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5610=['days','hours','minutes','pdf','custom','default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','months','weeks'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5610,0xc2));var _0x0561=function(_0x8d2cab,_0x5d7c90){_0x8d2cab=_0x8d2cab-0x0;var _0x31aaf8=_0x5610[_0x8d2cab];return _0x31aaf8;};'use strict';var Sequelize=require('sequelize');module[_0x0561('0x0')]={'name':{'type':Sequelize[_0x0561('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x0561('0x1')]},'active':{'type':Sequelize[_0x0561('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0561('0x3')},'startAt':{'type':Sequelize[_0x0561('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x0561('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x0561('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x0561('0x6')](_0x0561('0x7'),'quarters',_0x0561('0x8'),_0x0561('0x9'),_0x0561('0xa'),_0x0561('0xb'),_0x0561('0xc')),'allowNull':![],'defaultValue':_0x0561('0xa')},'output':{'type':Sequelize[_0x0561('0x6')]('csv',_0x0561('0xd'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x0561('0x6')](_0x0561('0xe'),_0x0561('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x0561('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x0561('0x1')]},'cc':{'type':Sequelize[_0x0561('0x10')]},'bcc':{'type':Sequelize[_0x0561('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x0561('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 04b3565..3893f8c 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 _0xd986=['reject','save','update','then','Scheduler','UserProfileResource','destroy','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','intersection','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','../../config/schedule','params','run','eml-format','rimraf','zip-dir','fast-json-patch','moment','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x1748f0,_0x8028f5){var _0x4438e0=function(_0x51f4ab){while(--_0x51f4ab){_0x1748f0['push'](_0x1748f0['shift']());}};_0x4438e0(++_0x8028f5);}(_0xd986,0xe6));var _0x6d98=function(_0x1d5f43,_0x1cb249){_0x1d5f43=_0x1d5f43-0x0;var _0x3fcf08=_0xd986[_0x1d5f43];return _0x3fcf08;};'use strict';var emlformat=require(_0x6d98('0x0'));var rimraf=require(_0x6d98('0x1'));var zipdir=require(_0x6d98('0x2'));var jsonpatch=require(_0x6d98('0x3'));var rp=require('request-promise');var moment=require(_0x6d98('0x4'));var BPromise=require(_0x6d98('0x5'));var Mustache=require(_0x6d98('0x6'));var util=require(_0x6d98('0x7'));var path=require(_0x6d98('0x8'));var sox=require(_0x6d98('0x9'));var csv=require(_0x6d98('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6d98('0xb'));var squel=require(_0x6d98('0xc'));var crypto=require(_0x6d98('0xd'));var jsforce=require(_0x6d98('0xe'));var deskjs=require(_0x6d98('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6d98('0x10'));var Papa=require(_0x6d98('0x11'));var Redis=require(_0x6d98('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6d98('0x13'));var as=require(_0x6d98('0x14'));var hardwareService=require(_0x6d98('0x15'));var logger=require('../../config/logger')(_0x6d98('0x16'));var utils=require(_0x6d98('0x17'));var config=require(_0x6d98('0x18'));var licenseUtil=require(_0x6d98('0x19'));var db=require(_0x6d98('0x1a'))['db'];function respondWithStatusCode(_0x3495d6,_0x291f2c){_0x291f2c=_0x291f2c||0xcc;return function(_0x3635e6){if(_0x3635e6){return _0x3495d6[_0x6d98('0x1b')](_0x291f2c);}return _0x3495d6[_0x6d98('0x1c')](_0x291f2c)[_0x6d98('0x1d')]();};}function respondWithResult(_0x6b6bf0,_0x4583dd){_0x4583dd=_0x4583dd||0xc8;return function(_0x1fbbee){if(_0x1fbbee){return _0x6b6bf0[_0x6d98('0x1c')](_0x4583dd)[_0x6d98('0x1e')](_0x1fbbee);}};}function respondWithFilteredResult(_0x466909,_0x4e8d14){return function(_0xc4cf72){if(_0xc4cf72){var _0xf5d8e8=typeof _0x4e8d14[_0x6d98('0x1f')]===_0x6d98('0x20')&&typeof _0x4e8d14[_0x6d98('0x21')]==='undefined';var _0x5da4d7=_0xc4cf72[_0x6d98('0x22')];var _0x5ba1b7=_0xf5d8e8?0x0:_0x4e8d14[_0x6d98('0x1f')];var _0x4192d7=_0xf5d8e8?_0xc4cf72[_0x6d98('0x22')]:_0x4e8d14[_0x6d98('0x1f')]+_0x4e8d14[_0x6d98('0x21')];var _0x119391;if(_0x4192d7>=_0x5da4d7){_0x4192d7=_0x5da4d7;_0x119391=0xc8;}else{_0x119391=0xce;}_0x466909[_0x6d98('0x1c')](_0x119391);return _0x466909[_0x6d98('0x23')](_0x6d98('0x24'),_0x5ba1b7+'-'+_0x4192d7+'/'+_0x5da4d7)[_0x6d98('0x1e')](_0xc4cf72);}return null;};}function patchUpdates(_0x112b0e){return function(_0x4ae8e8){try{jsonpatch['apply'](_0x4ae8e8,_0x112b0e,!![]);}catch(_0x387f4a){return BPromise[_0x6d98('0x25')](_0x387f4a);}return _0x4ae8e8[_0x6d98('0x26')]();};}function saveUpdates(_0x34683f,_0x5c6501){return function(_0xeea4f5){if(_0xeea4f5){return _0xeea4f5[_0x6d98('0x27')](_0x34683f)[_0x6d98('0x28')](function(_0x2f0ad9){return _0x2f0ad9;});}return null;};}function removeEntity(_0x4ac5aa,_0x474ac4){return function(_0x13921c){if(_0x13921c){return _0x13921c['destroy']()[_0x6d98('0x28')](function(){var _0xf79e95=_0x13921c['get']({'plain':!![]});var _0x278731=_0x6d98('0x29');return db[_0x6d98('0x2a')][_0x6d98('0x2b')]({'where':{'type':_0x278731,'resourceId':_0xf79e95['id']}})[_0x6d98('0x28')](function(){return _0x13921c;});})[_0x6d98('0x28')](function(){_0x4ac5aa[_0x6d98('0x1c')](0xcc)[_0x6d98('0x1d')]();});}};}function handleEntityNotFound(_0x17df7c,_0x1d90d5){return function(_0x51d709){if(!_0x51d709){_0x17df7c[_0x6d98('0x1b')](0x194);}return _0x51d709;};}function handleError(_0x24cb0c,_0x5de887){_0x5de887=_0x5de887||0x1f4;return function(_0x42d71c){logger[_0x6d98('0x2c')](_0x42d71c[_0x6d98('0x2d')]);if(_0x42d71c[_0x6d98('0x2e')]){delete _0x42d71c[_0x6d98('0x2e')];}_0x24cb0c[_0x6d98('0x1c')](_0x5de887)[_0x6d98('0x2f')](_0x42d71c);};}exports[_0x6d98('0x30')]=function(_0x1aeaaf,_0x23abaf){var _0x4336ca={},_0xa3d1a3={},_0x206ef4={'count':0x0,'rows':[]};var _0x4cca51=_[_0x6d98('0x31')](db[_0x6d98('0x32')][_0x6d98('0x33')],function(_0xe4e494){return{'name':_0xe4e494[_0x6d98('0x34')],'type':_0xe4e494[_0x6d98('0x35')][_0x6d98('0x36')]};});_0xa3d1a3[_0x6d98('0x37')]=_['map'](_0x4cca51,_0x6d98('0x2e'));_0xa3d1a3[_0x6d98('0x38')]=_[_0x6d98('0x39')](_0x1aeaaf['query']);_0xa3d1a3['filters']=_['intersection'](_0xa3d1a3[_0x6d98('0x37')],_0xa3d1a3[_0x6d98('0x38')]);_0x4336ca[_0x6d98('0x3a')]=_['intersection'](_0xa3d1a3[_0x6d98('0x37')],qs['fields'](_0x1aeaaf[_0x6d98('0x38')][_0x6d98('0x3b')]));_0x4336ca[_0x6d98('0x3a')]=_0x4336ca['attributes'][_0x6d98('0x3c')]?_0x4336ca[_0x6d98('0x3a')]:_0xa3d1a3[_0x6d98('0x37')];if(!_0x1aeaaf['query']['hasOwnProperty'](_0x6d98('0x3d'))){_0x4336ca[_0x6d98('0x21')]=qs['limit'](_0x1aeaaf['query'][_0x6d98('0x21')]);_0x4336ca['offset']=qs['offset'](_0x1aeaaf[_0x6d98('0x38')][_0x6d98('0x1f')]);}_0x4336ca[_0x6d98('0x3e')]=qs['sort'](_0x1aeaaf[_0x6d98('0x38')][_0x6d98('0x3f')]);_0x4336ca[_0x6d98('0x40')]=qs[_0x6d98('0x41')](_[_0x6d98('0x42')](_0x1aeaaf[_0x6d98('0x38')],_0xa3d1a3[_0x6d98('0x41')]),_0x4cca51);if(_0x1aeaaf[_0x6d98('0x38')][_0x6d98('0x43')]){_0x4336ca[_0x6d98('0x40')]=_[_0x6d98('0x44')](_0x4336ca['where'],{'$or':_[_0x6d98('0x31')](_0x4cca51,function(_0x324061){if(_0x324061[_0x6d98('0x35')]!==_0x6d98('0x45')){var _0x233932={};_0x233932[_0x324061[_0x6d98('0x2e')]]={'$like':'%'+_0x1aeaaf['query'][_0x6d98('0x43')]+'%'};return _0x233932;}})});}_0x4336ca=_[_0x6d98('0x44')]({},_0x4336ca,_0x1aeaaf[_0x6d98('0x46')]);var _0x326a3d={'where':_0x4336ca[_0x6d98('0x40')]};return db['Schedule'][_0x6d98('0x22')](_0x326a3d)[_0x6d98('0x28')](function(_0x521f4f){_0x206ef4[_0x6d98('0x22')]=_0x521f4f;if(_0x1aeaaf[_0x6d98('0x38')][_0x6d98('0x47')]){_0x4336ca[_0x6d98('0x48')]=[{'all':!![]}];}return db[_0x6d98('0x32')][_0x6d98('0x49')](_0x4336ca);})[_0x6d98('0x28')](function(_0x28f865){_0x206ef4['rows']=_0x28f865;return _0x206ef4;})[_0x6d98('0x28')](respondWithFilteredResult(_0x23abaf,_0x4336ca))[_0x6d98('0x4a')](handleError(_0x23abaf,null));};exports['show']=function(_0x427d87,_0xf5c795){var _0x3a8c63={'raw':![],'where':{'id':_0x427d87['params']['id']}},_0x431247={};_0x431247[_0x6d98('0x37')]=_['keys'](db[_0x6d98('0x32')]['rawAttributes']);_0x431247['query']=_[_0x6d98('0x39')](_0x427d87['query']);_0x431247[_0x6d98('0x41')]=_[_0x6d98('0x4b')](_0x431247[_0x6d98('0x37')],_0x431247[_0x6d98('0x38')]);_0x3a8c63[_0x6d98('0x3a')]=_[_0x6d98('0x4b')](_0x431247[_0x6d98('0x37')],qs[_0x6d98('0x3b')](_0x427d87[_0x6d98('0x38')]['fields']));_0x3a8c63['attributes']=_0x3a8c63[_0x6d98('0x3a')][_0x6d98('0x3c')]?_0x3a8c63[_0x6d98('0x3a')]:_0x431247[_0x6d98('0x37')];if(_0x427d87[_0x6d98('0x38')][_0x6d98('0x47')]){_0x3a8c63[_0x6d98('0x48')]=[{'all':!![]}];}_0x3a8c63=_['merge']({},_0x3a8c63,_0x427d87['options']);return db[_0x6d98('0x32')]['find'](_0x3a8c63)[_0x6d98('0x28')](handleEntityNotFound(_0xf5c795,null))[_0x6d98('0x28')](respondWithResult(_0xf5c795,null))[_0x6d98('0x4a')](handleError(_0xf5c795,null));};exports[_0x6d98('0x4c')]=function(_0xeecf4c,_0x2e0d46){return db[_0x6d98('0x32')][_0x6d98('0x4c')](_0xeecf4c['body'],{})[_0x6d98('0x28')](function(_0x3e665e){var _0x5f4143=_0xeecf4c[_0x6d98('0x4d')][_0x6d98('0x4e')]({'plain':!![]});if(!_0x5f4143)throw new Error(_0x6d98('0x4f'));if(_0x5f4143[_0x6d98('0x50')]==='user'){var _0x4673f5=_0x3e665e[_0x6d98('0x4e')]({'plain':!![]});var _0x288f05=_0x6d98('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x288f05,'userProfileId':_0x5f4143[_0x6d98('0x51')]},'raw':!![]})['then'](function(_0x4c1720){if(_0x4c1720&&_0x4c1720[_0x6d98('0x52')]===0x0){return db[_0x6d98('0x2a')]['create']({'name':_0x4673f5[_0x6d98('0x2e')],'resourceId':_0x4673f5['id'],'type':_0x4c1720[_0x6d98('0x2e')],'sectionId':_0x4c1720['id']},{})[_0x6d98('0x28')](function(){return _0x3e665e;});}else{return _0x3e665e;}})[_0x6d98('0x4a')](function(_0x290837){logger[_0x6d98('0x2c')](_0x6d98('0x53'),_0x290837);throw _0x290837;});}return _0x3e665e;})[_0x6d98('0x28')](respondWithResult(_0x2e0d46,0xc9))[_0x6d98('0x4a')](handleError(_0x2e0d46,null));};exports['update']=function(_0x2dd95b,_0x2effe9){if(_0x2dd95b[_0x6d98('0x54')]['id']){delete _0x2dd95b[_0x6d98('0x54')]['id'];}return db[_0x6d98('0x32')]['find']({'where':{'id':_0x2dd95b['params']['id']}})[_0x6d98('0x28')](handleEntityNotFound(_0x2effe9,null))['then'](saveUpdates(_0x2dd95b[_0x6d98('0x54')],null))[_0x6d98('0x28')](respondWithResult(_0x2effe9,null))[_0x6d98('0x4a')](handleError(_0x2effe9,null));};exports[_0x6d98('0x2b')]=function(_0x2bb85b,_0x12d5b0){return db[_0x6d98('0x32')][_0x6d98('0x55')]({'where':{'id':_0x2bb85b['params']['id']}})[_0x6d98('0x28')](handleEntityNotFound(_0x12d5b0,null))[_0x6d98('0x28')](removeEntity(_0x12d5b0,null))[_0x6d98('0x4a')](handleError(_0x12d5b0,null));};exports['run']=function(_0x2a7c81,_0x24b4d8,_0x414d90){var _0x5132f2=require(_0x6d98('0x56'));return db[_0x6d98('0x32')][_0x6d98('0x55')]({'where':{'id':_0x2a7c81[_0x6d98('0x57')]['id']},'raw':!![]})[_0x6d98('0x28')](handleEntityNotFound(_0x24b4d8,null))[_0x6d98('0x28')](function(){_0x5132f2[_0x6d98('0x58')](_0x2a7c81[_0x6d98('0x57')]['id']);})['then'](respondWithStatusCode(_0x24b4d8,null))[_0x6d98('0x4a')](handleError(_0x24b4d8,null));}; \ No newline at end of file +var _0x4721=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','get','Scheduler','UserProfileResource','end','error','stack','name','send','index','map','Schedule','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','run','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash'];(function(_0x2a3ae1,_0x428663){var _0x247dd6=function(_0x295dd3){while(--_0x295dd3){_0x2a3ae1['push'](_0x2a3ae1['shift']());}};_0x247dd6(++_0x428663);}(_0x4721,0xf7));var _0x1472=function(_0xd21fe7,_0x225a39){_0xd21fe7=_0xd21fe7-0x0;var _0x14d570=_0x4721[_0xd21fe7];return _0x14d570;};'use strict';var emlformat=require(_0x1472('0x0'));var rimraf=require(_0x1472('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1472('0x2'));var rp=require(_0x1472('0x3'));var moment=require(_0x1472('0x4'));var BPromise=require(_0x1472('0x5'));var Mustache=require('mustache');var util=require(_0x1472('0x6'));var path=require('path');var sox=require(_0x1472('0x7'));var csv=require(_0x1472('0x8'));var ejs=require(_0x1472('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1472('0xa'));var squel=require(_0x1472('0xb'));var crypto=require(_0x1472('0xc'));var jsforce=require(_0x1472('0xd'));var deskjs=require(_0x1472('0xe'));var toCsv=require(_0x1472('0x8'));var querystring=require(_0x1472('0xf'));var Papa=require(_0x1472('0x10'));var Redis=require(_0x1472('0x11'));var authService=require(_0x1472('0x12'));var qs=require(_0x1472('0x13'));var as=require(_0x1472('0x14'));var hardwareService=require(_0x1472('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x1472('0x16'));var config=require(_0x1472('0x17'));var licenseUtil=require(_0x1472('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ab607,_0x36c1ab){_0x36c1ab=_0x36c1ab||0xcc;return function(_0x432333){if(_0x432333){return _0x2ab607[_0x1472('0x19')](_0x36c1ab);}return _0x2ab607['status'](_0x36c1ab)['end']();};}function respondWithResult(_0x2c84d9,_0x3c99a9){_0x3c99a9=_0x3c99a9||0xc8;return function(_0x4ca54a){if(_0x4ca54a){return _0x2c84d9[_0x1472('0x1a')](_0x3c99a9)['json'](_0x4ca54a);}};}function respondWithFilteredResult(_0x51558c,_0xd8df2e){return function(_0x18bf1f){if(_0x18bf1f){var _0x27ffff=typeof _0xd8df2e[_0x1472('0x1b')]===_0x1472('0x1c')&&typeof _0xd8df2e[_0x1472('0x1d')]==='undefined';var _0x2d7ace=_0x18bf1f[_0x1472('0x1e')];var _0x1bb979=_0x27ffff?0x0:_0xd8df2e[_0x1472('0x1b')];var _0x2b759f=_0x27ffff?_0x18bf1f[_0x1472('0x1e')]:_0xd8df2e[_0x1472('0x1b')]+_0xd8df2e[_0x1472('0x1d')];var _0x51f44b;if(_0x2b759f>=_0x2d7ace){_0x2b759f=_0x2d7ace;_0x51f44b=0xc8;}else{_0x51f44b=0xce;}_0x51558c[_0x1472('0x1a')](_0x51f44b);return _0x51558c[_0x1472('0x1f')](_0x1472('0x20'),_0x1bb979+'-'+_0x2b759f+'/'+_0x2d7ace)[_0x1472('0x21')](_0x18bf1f);}return null;};}function patchUpdates(_0x35ea14){return function(_0x301067){try{jsonpatch['apply'](_0x301067,_0x35ea14,!![]);}catch(_0xe1e3b2){return BPromise['reject'](_0xe1e3b2);}return _0x301067[_0x1472('0x22')]();};}function saveUpdates(_0x20fe92,_0x2fd381){return function(_0x5f39f5){if(_0x5f39f5){return _0x5f39f5[_0x1472('0x23')](_0x20fe92)[_0x1472('0x24')](function(_0x2d44e5){return _0x2d44e5;});}return null;};}function removeEntity(_0x457660,_0x4ae99a){return function(_0x23cd46){if(_0x23cd46){return _0x23cd46[_0x1472('0x25')]()[_0x1472('0x24')](function(){var _0x233957=_0x23cd46[_0x1472('0x26')]({'plain':!![]});var _0x44f601=_0x1472('0x27');return db[_0x1472('0x28')][_0x1472('0x25')]({'where':{'type':_0x44f601,'resourceId':_0x233957['id']}})[_0x1472('0x24')](function(){return _0x23cd46;});})[_0x1472('0x24')](function(){_0x457660[_0x1472('0x1a')](0xcc)[_0x1472('0x29')]();});}};}function handleEntityNotFound(_0x538583,_0x43296f){return function(_0x30f988){if(!_0x30f988){_0x538583['sendStatus'](0x194);}return _0x30f988;};}function handleError(_0x308aff,_0x288629){_0x288629=_0x288629||0x1f4;return function(_0x95086d){logger[_0x1472('0x2a')](_0x95086d[_0x1472('0x2b')]);if(_0x95086d[_0x1472('0x2c')]){delete _0x95086d[_0x1472('0x2c')];}_0x308aff['status'](_0x288629)[_0x1472('0x2d')](_0x95086d);};}exports[_0x1472('0x2e')]=function(_0x1a9abe,_0x182225){var _0x10a7b9={},_0x2ac3e9={},_0x29c19f={'count':0x0,'rows':[]};var _0x4ae982=_[_0x1472('0x2f')](db[_0x1472('0x30')]['rawAttributes'],function(_0x334ae0){return{'name':_0x334ae0['fieldName'],'type':_0x334ae0[_0x1472('0x31')][_0x1472('0x32')]};});_0x2ac3e9[_0x1472('0x33')]=_[_0x1472('0x2f')](_0x4ae982,_0x1472('0x2c'));_0x2ac3e9[_0x1472('0x34')]=_[_0x1472('0x35')](_0x1a9abe['query']);_0x2ac3e9['filters']=_[_0x1472('0x36')](_0x2ac3e9['model'],_0x2ac3e9[_0x1472('0x34')]);_0x10a7b9[_0x1472('0x37')]=_[_0x1472('0x36')](_0x2ac3e9[_0x1472('0x33')],qs[_0x1472('0x38')](_0x1a9abe['query']['fields']));_0x10a7b9['attributes']=_0x10a7b9[_0x1472('0x37')][_0x1472('0x39')]?_0x10a7b9[_0x1472('0x37')]:_0x2ac3e9[_0x1472('0x33')];if(!_0x1a9abe[_0x1472('0x34')]['hasOwnProperty'](_0x1472('0x3a'))){_0x10a7b9[_0x1472('0x1d')]=qs[_0x1472('0x1d')](_0x1a9abe[_0x1472('0x34')][_0x1472('0x1d')]);_0x10a7b9[_0x1472('0x1b')]=qs['offset'](_0x1a9abe[_0x1472('0x34')][_0x1472('0x1b')]);}_0x10a7b9[_0x1472('0x3b')]=qs[_0x1472('0x3c')](_0x1a9abe[_0x1472('0x34')]['sort']);_0x10a7b9[_0x1472('0x3d')]=qs[_0x1472('0x3e')](_[_0x1472('0x3f')](_0x1a9abe[_0x1472('0x34')],_0x2ac3e9['filters']),_0x4ae982);if(_0x1a9abe[_0x1472('0x34')][_0x1472('0x40')]){_0x10a7b9[_0x1472('0x3d')]=_['merge'](_0x10a7b9[_0x1472('0x3d')],{'$or':_[_0x1472('0x2f')](_0x4ae982,function(_0x78ac9b){if(_0x78ac9b[_0x1472('0x31')]!==_0x1472('0x41')){var _0x3a843f={};_0x3a843f[_0x78ac9b[_0x1472('0x2c')]]={'$like':'%'+_0x1a9abe[_0x1472('0x34')][_0x1472('0x40')]+'%'};return _0x3a843f;}})});}_0x10a7b9=_[_0x1472('0x42')]({},_0x10a7b9,_0x1a9abe[_0x1472('0x43')]);var _0x10e6c5={'where':_0x10a7b9['where']};return db[_0x1472('0x30')][_0x1472('0x1e')](_0x10e6c5)[_0x1472('0x24')](function(_0x290f70){_0x29c19f['count']=_0x290f70;if(_0x1a9abe['query'][_0x1472('0x44')]){_0x10a7b9[_0x1472('0x45')]=[{'all':!![]}];}return db[_0x1472('0x30')][_0x1472('0x46')](_0x10a7b9);})[_0x1472('0x24')](function(_0x580687){_0x29c19f[_0x1472('0x47')]=_0x580687;return _0x29c19f;})[_0x1472('0x24')](respondWithFilteredResult(_0x182225,_0x10a7b9))[_0x1472('0x48')](handleError(_0x182225,null));};exports[_0x1472('0x49')]=function(_0x421ab6,_0x8c4c38){var _0x338e59={'raw':![],'where':{'id':_0x421ab6[_0x1472('0x4a')]['id']}},_0x141975={};_0x141975[_0x1472('0x33')]=_[_0x1472('0x35')](db[_0x1472('0x30')][_0x1472('0x4b')]);_0x141975[_0x1472('0x34')]=_[_0x1472('0x35')](_0x421ab6[_0x1472('0x34')]);_0x141975['filters']=_[_0x1472('0x36')](_0x141975['model'],_0x141975[_0x1472('0x34')]);_0x338e59[_0x1472('0x37')]=_['intersection'](_0x141975[_0x1472('0x33')],qs['fields'](_0x421ab6[_0x1472('0x34')][_0x1472('0x38')]));_0x338e59[_0x1472('0x37')]=_0x338e59[_0x1472('0x37')]['length']?_0x338e59[_0x1472('0x37')]:_0x141975[_0x1472('0x33')];if(_0x421ab6[_0x1472('0x34')][_0x1472('0x44')]){_0x338e59[_0x1472('0x45')]=[{'all':!![]}];}_0x338e59=_[_0x1472('0x42')]({},_0x338e59,_0x421ab6['options']);return db[_0x1472('0x30')][_0x1472('0x4c')](_0x338e59)[_0x1472('0x24')](handleEntityNotFound(_0x8c4c38,null))[_0x1472('0x24')](respondWithResult(_0x8c4c38,null))['catch'](handleError(_0x8c4c38,null));};exports[_0x1472('0x4d')]=function(_0x4ea0ed,_0x35855c){return db[_0x1472('0x30')][_0x1472('0x4d')](_0x4ea0ed[_0x1472('0x4e')],{})['then'](function(_0x46043c){var _0xec8e60=_0x4ea0ed['user'][_0x1472('0x26')]({'plain':!![]});if(!_0xec8e60)throw new Error(_0x1472('0x4f'));if(_0xec8e60[_0x1472('0x50')]===_0x1472('0x51')){var _0x4d95f1=_0x46043c['get']({'plain':!![]});var _0x439388=_0x1472('0x27');return db[_0x1472('0x52')][_0x1472('0x4c')]({'where':{'name':_0x439388,'userProfileId':_0xec8e60['userProfileId']},'raw':!![]})[_0x1472('0x24')](function(_0x53cbed){if(_0x53cbed&&_0x53cbed[_0x1472('0x53')]===0x0){return db[_0x1472('0x28')][_0x1472('0x4d')]({'name':_0x4d95f1['name'],'resourceId':_0x4d95f1['id'],'type':_0x53cbed[_0x1472('0x2c')],'sectionId':_0x53cbed['id']},{})[_0x1472('0x24')](function(){return _0x46043c;});}else{return _0x46043c;}})[_0x1472('0x48')](function(_0x8325cb){logger[_0x1472('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8325cb);throw _0x8325cb;});}return _0x46043c;})[_0x1472('0x24')](respondWithResult(_0x35855c,0xc9))[_0x1472('0x48')](handleError(_0x35855c,null));};exports[_0x1472('0x23')]=function(_0x2a1b9f,_0x5236cf){if(_0x2a1b9f[_0x1472('0x4e')]['id']){delete _0x2a1b9f['body']['id'];}return db[_0x1472('0x30')]['find']({'where':{'id':_0x2a1b9f[_0x1472('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5236cf,null))[_0x1472('0x24')](saveUpdates(_0x2a1b9f[_0x1472('0x4e')],null))[_0x1472('0x24')](respondWithResult(_0x5236cf,null))[_0x1472('0x48')](handleError(_0x5236cf,null));};exports[_0x1472('0x25')]=function(_0x30f884,_0x40eb75){return db[_0x1472('0x30')][_0x1472('0x4c')]({'where':{'id':_0x30f884[_0x1472('0x4a')]['id']}})[_0x1472('0x24')](handleEntityNotFound(_0x40eb75,null))[_0x1472('0x24')](removeEntity(_0x40eb75,null))[_0x1472('0x48')](handleError(_0x40eb75,null));};exports[_0x1472('0x54')]=function(_0x4e6ad9,_0x20aa54,_0xf0e241){var _0x325211=require(_0x1472('0x55'));return db[_0x1472('0x30')][_0x1472('0x4c')]({'where':{'id':_0x4e6ad9[_0x1472('0x4a')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x20aa54,null))[_0x1472('0x24')](function(){_0x325211[_0x1472('0x54')](_0x4e6ad9['params']['id']);})['then'](respondWithStatusCode(_0x20aa54,null))['catch'](handleError(_0x20aa54,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 74862e4..5182ab7 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 _0x05b9=['tools_schedules','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./schedule.attributes','exports','define'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x05b9,0xb1));var _0x905b=function(_0x3d8591,_0xcfed37){_0x3d8591=_0x3d8591-0x0;var _0x4f1203=_0x05b9[_0x3d8591];return _0x4f1203;};'use strict';var _=require(_0x905b('0x0'));var util=require('util');var logger=require(_0x905b('0x1'))(_0x905b('0x2'));var moment=require(_0x905b('0x3'));var BPromise=require(_0x905b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x905b('0x5'));var config=require(_0x905b('0x6'));var attributes=require(_0x905b('0x7'));module[_0x905b('0x8')]=function(_0x2b5503,_0x6afd19){return _0x2b5503[_0x905b('0x9')]('Schedule',attributes,{'tableName':_0x905b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x709f=['lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./schedule.attributes','define','tools_schedules'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x709f,0x140));var _0xf709=function(_0x817d9b,_0x3c37e3){_0x817d9b=_0x817d9b-0x0;var _0x2752e1=_0x709f[_0x817d9b];return _0x2752e1;};'use strict';var _=require(_0xf709('0x0'));var util=require(_0xf709('0x1'));var logger=require(_0xf709('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf709('0x3'));var fs=require('fs');var path=require(_0xf709('0x4'));var rimraf=require(_0xf709('0x5'));var config=require(_0xf709('0x6'));var attributes=require(_0xf709('0x7'));module['exports']=function(_0x10f5c9,_0x339d87){return _0x10f5c9[_0xf709('0x8')]('Schedule',attributes,{'tableName':_0xf709('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 961ffec..40c6d2c 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 _0xf8ef=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash'];(function(_0x29a0d5,_0x130423){var _0x58d4db=function(_0x51fef5){while(--_0x51fef5){_0x29a0d5['push'](_0x29a0d5['shift']());}};_0x58d4db(++_0x130423);}(_0xf8ef,0x7d));var _0xff8e=function(_0x4e67cc,_0x2454cc){_0x4e67cc=_0x4e67cc-0x0;var _0x226efd=_0xf8ef[_0x4e67cc];return _0x226efd;};'use strict';var _=require(_0xff8e('0x0'));var util=require('util');var moment=require(_0xff8e('0x1'));var BPromise=require('bluebird');var rs=require(_0xff8e('0x2'));var fs=require('fs');var Redis=require(_0xff8e('0x3'));var db=require(_0xff8e('0x4'))['db'];var utils=require(_0xff8e('0x5'));var logger=require(_0xff8e('0x6'))(_0xff8e('0x7'));var config=require('../../config/environment');var jayson=require(_0xff8e('0x8'));var client=jayson[_0xff8e('0x9')][_0xff8e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4672bd,_0x15edd0,_0x1a1fd8){return new BPromise(function(_0x3ddcc4,_0x110528){return client['request'](_0x4672bd,_0x1a1fd8)[_0xff8e('0xb')](function(_0x45d00d){logger[_0xff8e('0xc')](_0xff8e('0xd'),_0x15edd0,_0xff8e('0xe'));logger[_0xff8e('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x15edd0,_0xff8e('0xe'),JSON['stringify'](_0x45d00d));if(_0x45d00d[_0xff8e('0x10')]){if(_0x45d00d[_0xff8e('0x10')][_0xff8e('0x11')]===0x1f4){logger[_0xff8e('0x10')]('Schedule,\x20%s,\x20%s',_0x15edd0,_0x45d00d[_0xff8e('0x10')][_0xff8e('0x12')]);return _0x110528(_0x45d00d['error']['message']);}logger[_0xff8e('0x10')](_0xff8e('0xd'),_0x15edd0,_0x45d00d['error'][_0xff8e('0x12')]);return _0x3ddcc4(_0x45d00d[_0xff8e('0x10')][_0xff8e('0x12')]);}else{logger[_0xff8e('0xc')](_0xff8e('0xd'),_0x15edd0,'request\x20sent');_0x3ddcc4(_0x45d00d[_0xff8e('0x13')][_0xff8e('0x12')]);}})[_0xff8e('0x14')](function(_0x3dd337){logger['error'](_0xff8e('0xd'),_0x15edd0,_0x3dd337);_0x110528(_0x3dd337);});});} \ No newline at end of file +var _0x164f=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x26ed63,_0x623433){var _0x26c3a8=function(_0x7348ed){while(--_0x7348ed){_0x26ed63['push'](_0x26ed63['shift']());}};_0x26c3a8(++_0x623433);}(_0x164f,0xf6));var _0xf164=function(_0x1d861c,_0x21b746){_0x1d861c=_0x1d861c-0x0;var _0x33ff70=_0x164f[_0x1d861c];return _0x33ff70;};'use strict';var _=require(_0xf164('0x0'));var util=require(_0xf164('0x1'));var moment=require(_0xf164('0x2'));var BPromise=require(_0xf164('0x3'));var rs=require(_0xf164('0x4'));var fs=require('fs');var Redis=require(_0xf164('0x5'));var db=require(_0xf164('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf164('0x7'))(_0xf164('0x8'));var config=require('../../config/environment');var jayson=require(_0xf164('0x9'));var client=jayson[_0xf164('0xa')][_0xf164('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37d45e,_0x435e37,_0x3e4356){return new BPromise(function(_0x47956e,_0x216d32){return client[_0xf164('0xc')](_0x37d45e,_0x3e4356)['then'](function(_0x397c44){logger[_0xf164('0xd')](_0xf164('0xe'),_0x435e37,_0xf164('0xf'));logger['debug'](_0xf164('0x10'),_0x435e37,_0xf164('0xf'),JSON[_0xf164('0x11')](_0x397c44));if(_0x397c44['error']){if(_0x397c44[_0xf164('0x12')]['code']===0x1f4){logger[_0xf164('0x12')](_0xf164('0xe'),_0x435e37,_0x397c44[_0xf164('0x12')][_0xf164('0x13')]);return _0x216d32(_0x397c44[_0xf164('0x12')][_0xf164('0x13')]);}logger[_0xf164('0x12')](_0xf164('0xe'),_0x435e37,_0x397c44['error'][_0xf164('0x13')]);return _0x47956e(_0x397c44[_0xf164('0x12')][_0xf164('0x13')]);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x435e37,'request\x20sent');_0x47956e(_0x397c44['result'][_0xf164('0x13')]);}})[_0xf164('0x14')](function(_0x5b3d05){logger[_0xf164('0x12')]('Schedule,\x20%s,\x20%s',_0x435e37,_0x5b3d05);_0x216d32(_0x5b3d05);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index b9a6a50..8fead9a 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 _0x6616=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6616,0x13d));var _0x6661=function(_0x1f22ef,_0x3b5223){_0x1f22ef=_0x1f22ef-0x0;var _0x135ad4=_0x6616[_0x1f22ef];return _0x135ad4;};'use strict';var multer=require(_0x6661('0x0'));var util=require(_0x6661('0x1'));var path=require('path');var timeout=require(_0x6661('0x2'));var express=require(_0x6661('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6661('0x4'));var interaction=require(_0x6661('0x5'));var config=require(_0x6661('0x6'));var controller=require(_0x6661('0x7'));router[_0x6661('0x8')]('/',auth[_0x6661('0x9')](),controller[_0x6661('0xa')]);router[_0x6661('0x8')](_0x6661('0xb'),auth[_0x6661('0x9')](),controller[_0x6661('0xc')]);router['get'](_0x6661('0xd'),auth[_0x6661('0x9')](),controller[_0x6661('0xe')]);router[_0x6661('0x8')](_0x6661('0xf'),auth[_0x6661('0x9')](),controller[_0x6661('0x10')]);router[_0x6661('0x11')]('/',auth[_0x6661('0x9')](),controller[_0x6661('0x12')]);router[_0x6661('0x13')]('/:id',auth[_0x6661('0x9')](),controller[_0x6661('0x14')]);router[_0x6661('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x6661('0x16')]);module[_0x6661('0x17')]=router; \ No newline at end of file +var _0x5b73=['destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','/describe','isAuthenticated','describe','get','/:id','download','post','create','update','delete'];(function(_0x207c33,_0x3224a9){var _0x52af6e=function(_0x4c9a1f){while(--_0x4c9a1f){_0x207c33['push'](_0x207c33['shift']());}};_0x52af6e(++_0x3224a9);}(_0x5b73,0x132));var _0x35b7=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x5b73[_0x2112d4];return _0x434972;};'use strict';var multer=require(_0x35b7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x35b7('0x1'));var router=express[_0x35b7('0x2')]();var fs_extra=require(_0x35b7('0x3'));var auth=require(_0x35b7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x35b7('0x5'));var controller=require('./screenRecording.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x35b7('0x6')]);router['get'](_0x35b7('0x7'),auth[_0x35b7('0x8')](),controller[_0x35b7('0x9')]);router[_0x35b7('0xa')](_0x35b7('0xb'),auth[_0x35b7('0x8')](),controller['show']);router[_0x35b7('0xa')]('/:id/download',auth[_0x35b7('0x8')](),controller[_0x35b7('0xc')]);router[_0x35b7('0xd')]('/',auth[_0x35b7('0x8')](),controller[_0x35b7('0xe')]);router['put'](_0x35b7('0xb'),auth[_0x35b7('0x8')](),controller[_0x35b7('0xf')]);router[_0x35b7('0x10')](_0x35b7('0xb'),auth[_0x35b7('0x8')](),controller[_0x35b7('0x11')]);module[_0x35b7('0x12')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 83d5d2c..20bfc65 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 _0xb515=['path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration','DATE','MM-DD-YYYY\x20HH:mm','toString','format','createdAt','updatedAt','sequelize'];(function(_0x51b245,_0x446175){var _0x36402a=function(_0x2b9d26){while(--_0x2b9d26){_0x51b245['push'](_0x51b245['shift']());}};_0x36402a(++_0x446175);}(_0xb515,0x1b8));var _0x5b51=function(_0x148879,_0x5b4c11){_0x148879=_0x148879-0x0;var _0x4f7027=_0xb515[_0x148879];return _0x4f7027;};'use strict';var Sequelize=require(_0x5b51('0x0'));var moment=require('moment');var path=require(_0x5b51('0x1'));var config=require(_0x5b51('0x2'));module[_0x5b51('0x3')]={'format':{'type':Sequelize[_0x5b51('0x4')],'get':function(){return this[_0x5b51('0x5')](_0x5b51('0x6'))?path[_0x5b51('0x7')](this[_0x5b51('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x5b51('0x8')]},'channel':{'type':Sequelize[_0x5b51('0x8')]},'value':{'type':Sequelize[_0x5b51('0x8')],'set':function(_0x293d82){var _0x396b3f=_0x293d82[_0x5b51('0x9')](/\\/g,'/');this[_0x5b51('0xa')](_0x5b51('0x6'),_0x396b3f);}},'rating':{'type':Sequelize[_0x5b51('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x5b51('0xb')],'set':function(_0x1085e6){this[_0x5b51('0xa')]('startedAt',moment()[_0x5b51('0xc')](_0x1085e6,'ms'));this[_0x5b51('0xa')](_0x5b51('0xd'),moment());this[_0x5b51('0xa')](_0x5b51('0xe'),_0x1085e6);}},'startedAt':{'type':Sequelize[_0x5b51('0xf')],'get':function(){return moment(this['getDataValue']('startedAt'))['format'](_0x5b51('0x10'))[_0x5b51('0x11')]();}},'closedAt':{'type':Sequelize[_0x5b51('0xf')],'get':function(){return moment(this[_0x5b51('0x5')]('closedAt'))[_0x5b51('0x12')](_0x5b51('0x10'))[_0x5b51('0x11')]();}},'createdAt':{'type':Sequelize[_0x5b51('0xf')],'get':function(){return moment(this[_0x5b51('0x5')](_0x5b51('0x13')))[_0x5b51('0x12')](_0x5b51('0x10'))[_0x5b51('0x11')]();}},'updatedAt':{'type':Sequelize[_0x5b51('0xf')],'get':function(){return moment(this[_0x5b51('0x5')](_0x5b51('0x14')))['format'](_0x5b51('0x10'))['toString']();}}}; \ No newline at end of file +var _0x1d11=['MM-DD-YYYY\x20HH:mm','toString','closedAt','DATE','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','INTEGER','setDataValue','startedAt','subtract','duration','format'];(function(_0xf0330b,_0x814253){var _0x538518=function(_0x9c7d43){while(--_0x9c7d43){_0xf0330b['push'](_0xf0330b['shift']());}};_0x538518(++_0x814253);}(_0x1d11,0xb6));var _0x11d1=function(_0x275a4e,_0x201ffc){_0x275a4e=_0x275a4e-0x0;var _0x1de482=_0x1d11[_0x275a4e];return _0x1de482;};'use strict';var Sequelize=require(_0x11d1('0x0'));var moment=require(_0x11d1('0x1'));var path=require(_0x11d1('0x2'));var config=require(_0x11d1('0x3'));module[_0x11d1('0x4')]={'format':{'type':Sequelize[_0x11d1('0x5')],'get':function(){return this[_0x11d1('0x6')](_0x11d1('0x7'))?path[_0x11d1('0x8')](this[_0x11d1('0x6')](_0x11d1('0x7'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x11d1('0x9')]},'value':{'type':Sequelize['STRING'],'set':function(_0x92f75a){var _0x46c298=_0x92f75a['replace'](/\\/g,'/');this['setDataValue'](_0x11d1('0x7'),_0x46c298);}},'rating':{'type':Sequelize[_0x11d1('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x4dbc69){this[_0x11d1('0xb')](_0x11d1('0xc'),moment()[_0x11d1('0xd')](_0x4dbc69,'ms'));this['setDataValue']('closedAt',moment());this[_0x11d1('0xb')](_0x11d1('0xe'),_0x4dbc69);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x11d1('0xc')))[_0x11d1('0xf')](_0x11d1('0x10'))[_0x11d1('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x11d1('0x6')](_0x11d1('0x12')))[_0x11d1('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x11d1('0x11')]();}},'createdAt':{'type':Sequelize[_0x11d1('0x13')],'get':function(){return moment(this[_0x11d1('0x6')](_0x11d1('0x14')))[_0x11d1('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x11d1('0x11')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x11d1('0x6')](_0x11d1('0x15')))[_0x11d1('0xf')](_0x11d1('0x10'))[_0x11d1('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index b9f63ab..e0758c9 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 _0x0e85=['duration','createdAt','closedAt','params','describe','download','uniqueid','join','root','value','existsSync','secrets','recording','server/files/screen_recordings','filename','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','key','model','format','query','filters','intersection','attributes','length','nolimit','sort','filter','where','merge','type','options','include','findAll','rows','catch','keys','fields','find','create','body'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x0e85,0x7c));var _0x50e8=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x0e85[_0x39e84d];return _0x1991bc;};'use strict';var emlformat=require(_0x50e8('0x0'));var rimraf=require(_0x50e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50e8('0x2'));var rp=require(_0x50e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x50e8('0x4'));var path=require('path');var sox=require(_0x50e8('0x5'));var csv=require(_0x50e8('0x6'));var ejs=require(_0x50e8('0x7'));var fs=require('fs');var fs_extra=require(_0x50e8('0x8'));var _=require('lodash');var squel=require(_0x50e8('0x9'));var crypto=require(_0x50e8('0xa'));var jsforce=require(_0x50e8('0xb'));var deskjs=require(_0x50e8('0xc'));var toCsv=require(_0x50e8('0x6'));var querystring=require(_0x50e8('0xd'));var Papa=require('papaparse');var Redis=require(_0x50e8('0xe'));var authService=require(_0x50e8('0xf'));var qs=require(_0x50e8('0x10'));var as=require(_0x50e8('0x11'));var hardwareService=require(_0x50e8('0x12'));var logger=require(_0x50e8('0x13'))(_0x50e8('0x14'));var utils=require(_0x50e8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50e8('0x16'))['db'];function respondWithStatusCode(_0x24d381,_0x508377){_0x508377=_0x508377||0xcc;return function(_0x49e02f){if(_0x49e02f){return _0x24d381[_0x50e8('0x17')](_0x508377);}return _0x24d381[_0x50e8('0x18')](_0x508377)[_0x50e8('0x19')]();};}function respondWithResult(_0x473aa7,_0x54efd3){_0x54efd3=_0x54efd3||0xc8;return function(_0x18596f){if(_0x18596f){return _0x473aa7[_0x50e8('0x18')](_0x54efd3)[_0x50e8('0x1a')](_0x18596f);}};}function respondWithFilteredResult(_0x5c3baa,_0x5524a3){return function(_0x30a872){if(_0x30a872){var _0xf02b48=typeof _0x5524a3[_0x50e8('0x1b')]===_0x50e8('0x1c')&&typeof _0x5524a3[_0x50e8('0x1d')]===_0x50e8('0x1c');var _0x5642bf=_0x30a872['count'];var _0x441f25=_0xf02b48?0x0:_0x5524a3[_0x50e8('0x1b')];var _0x40d060=_0xf02b48?_0x30a872[_0x50e8('0x1e')]:_0x5524a3[_0x50e8('0x1b')]+_0x5524a3[_0x50e8('0x1d')];var _0x1a451d;if(_0x40d060>=_0x5642bf){_0x40d060=_0x5642bf;_0x1a451d=0xc8;}else{_0x1a451d=0xce;}_0x5c3baa['status'](_0x1a451d);return _0x5c3baa[_0x50e8('0x1f')]('Content-Range',_0x441f25+'-'+_0x40d060+'/'+_0x5642bf)[_0x50e8('0x1a')](_0x30a872);}return null;};}function patchUpdates(_0xe04a5c){return function(_0xd263d){try{jsonpatch[_0x50e8('0x20')](_0xd263d,_0xe04a5c,!![]);}catch(_0x46af8e){return BPromise['reject'](_0x46af8e);}return _0xd263d[_0x50e8('0x21')]();};}function saveUpdates(_0x1e4e0d,_0x58110d){return function(_0x31d23c){if(_0x31d23c){return _0x31d23c[_0x50e8('0x22')](_0x1e4e0d)['then'](function(_0x1ce7fc){return _0x1ce7fc;});}return null;};}function removeEntity(_0xe7e56c,_0x4f56b7){return function(_0x47a3d8){if(_0x47a3d8){return _0x47a3d8['destroy']()[_0x50e8('0x23')](function(){_0xe7e56c[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();});}};}function handleEntityNotFound(_0x371a1f,_0xc2f832){return function(_0x13b6e9){if(!_0x13b6e9){_0x371a1f['sendStatus'](0x194);}return _0x13b6e9;};}function handleError(_0x3a6442,_0x396611){_0x396611=_0x396611||0x1f4;return function(_0x4b3a09){logger[_0x50e8('0x24')](_0x4b3a09[_0x50e8('0x25')]);if(_0x4b3a09[_0x50e8('0x26')]){delete _0x4b3a09[_0x50e8('0x26')];}_0x3a6442['status'](_0x396611)[_0x50e8('0x27')](_0x4b3a09);};}exports['index']=function(_0x30fedf,_0x39c0c6){var _0x42bbef={},_0x4f0b88={},_0x1041b9={'count':0x0,'rows':[]};var _0x126c99=_[_0x50e8('0x28')](db[_0x50e8('0x29')][_0x50e8('0x2a')],function(_0x18aa31){return{'name':_0x18aa31[_0x50e8('0x2b')],'type':_0x18aa31['type'][_0x50e8('0x2c')]};});_0x4f0b88[_0x50e8('0x2d')]=_['differenceBy'](_['map'](_0x126c99,_0x50e8('0x26')),[_0x50e8('0x2e')]);_0x4f0b88[_0x50e8('0x2f')]=_['keys'](_0x30fedf['query']);_0x4f0b88[_0x50e8('0x30')]=_[_0x50e8('0x31')](_0x4f0b88['model'],_0x4f0b88[_0x50e8('0x2f')]);_0x42bbef[_0x50e8('0x32')]=_[_0x50e8('0x31')](_0x4f0b88[_0x50e8('0x2d')],qs['fields'](_0x30fedf[_0x50e8('0x2f')]['fields']));_0x42bbef[_0x50e8('0x32')]=_0x42bbef[_0x50e8('0x32')][_0x50e8('0x33')]?_0x42bbef['attributes']:_0x4f0b88[_0x50e8('0x2d')];if(!_0x30fedf[_0x50e8('0x2f')]['hasOwnProperty'](_0x50e8('0x34'))){_0x42bbef[_0x50e8('0x1d')]=qs[_0x50e8('0x1d')](_0x30fedf[_0x50e8('0x2f')]['limit']);_0x42bbef[_0x50e8('0x1b')]=qs[_0x50e8('0x1b')](_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x1b')]);}_0x42bbef['order']=qs[_0x50e8('0x35')](_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x35')]);_0x42bbef['where']=qs['filters'](_['pick'](_0x30fedf[_0x50e8('0x2f')],_0x4f0b88[_0x50e8('0x30')]),_0x126c99);if(_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x36')]){_0x42bbef[_0x50e8('0x37')]=_[_0x50e8('0x38')](_0x42bbef[_0x50e8('0x37')],{'$or':_[_0x50e8('0x28')](_0x126c99,function(_0x35f802){if(_0x35f802[_0x50e8('0x39')]!=='VIRTUAL'){var _0x3371a4={};_0x3371a4[_0x35f802[_0x50e8('0x26')]]={'$like':'%'+_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x36')]+'%'};return _0x3371a4;}})});}_0x42bbef=_['merge']({},_0x42bbef,_0x30fedf[_0x50e8('0x3a')]);var _0x944e46={'where':_0x42bbef[_0x50e8('0x37')]};return db[_0x50e8('0x29')][_0x50e8('0x1e')](_0x944e46)['then'](function(_0x53b198){_0x1041b9[_0x50e8('0x1e')]=_0x53b198;if(_0x30fedf[_0x50e8('0x2f')]['includeAll']){_0x42bbef[_0x50e8('0x3b')]=[{'all':!![]}];}return db[_0x50e8('0x29')][_0x50e8('0x3c')](_0x42bbef);})[_0x50e8('0x23')](function(_0x251e1c){_0x1041b9[_0x50e8('0x3d')]=_0x251e1c;return _0x1041b9;})[_0x50e8('0x23')](respondWithFilteredResult(_0x39c0c6,_0x42bbef))[_0x50e8('0x3e')](handleError(_0x39c0c6,null));};exports['show']=function(_0x3d26bd,_0x44e0ca){var _0x3ea251={'raw':![],'where':{'id':_0x3d26bd['params']['id']}},_0x2adae0={};_0x2adae0[_0x50e8('0x2d')]=_[_0x50e8('0x3f')](db[_0x50e8('0x29')][_0x50e8('0x2a')]);_0x2adae0['query']=_[_0x50e8('0x3f')](_0x3d26bd['query']);_0x2adae0['filters']=_['intersection'](_0x2adae0[_0x50e8('0x2d')],_0x2adae0[_0x50e8('0x2f')]);_0x3ea251['attributes']=_[_0x50e8('0x31')](_0x2adae0[_0x50e8('0x2d')],qs[_0x50e8('0x40')](_0x3d26bd[_0x50e8('0x2f')][_0x50e8('0x40')]));_0x3ea251[_0x50e8('0x32')]=_0x3ea251['attributes'][_0x50e8('0x33')]?_0x3ea251['attributes']:_0x2adae0[_0x50e8('0x2d')];if(_0x3d26bd[_0x50e8('0x2f')]['includeAll']){_0x3ea251[_0x50e8('0x3b')]=[{'all':!![]}];}_0x3ea251=_['merge']({},_0x3ea251,_0x3d26bd[_0x50e8('0x3a')]);return db[_0x50e8('0x29')][_0x50e8('0x41')](_0x3ea251)[_0x50e8('0x23')](handleEntityNotFound(_0x44e0ca,null))[_0x50e8('0x23')](respondWithResult(_0x44e0ca,null))[_0x50e8('0x3e')](handleError(_0x44e0ca,null));};exports[_0x50e8('0x42')]=function(_0x3e52b3,_0x141bd4){return db[_0x50e8('0x29')][_0x50e8('0x42')](_0x3e52b3['body'],{})[_0x50e8('0x23')](respondWithResult(_0x141bd4,0xc9))[_0x50e8('0x3e')](handleError(_0x141bd4,null));};exports['update']=function(_0x3692ba,_0x58f14e){if(_0x3692ba[_0x50e8('0x43')]['id']){delete _0x3692ba['body']['id'];}delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x44')];delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x45')];delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x46')];delete _0x3692ba[_0x50e8('0x43')]['value'];return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':{'id':_0x3692ba[_0x50e8('0x47')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x58f14e,null))[_0x50e8('0x23')](saveUpdates(_0x3692ba[_0x50e8('0x43')],null))['then'](respondWithResult(_0x58f14e,null))[_0x50e8('0x3e')](handleError(_0x58f14e,null));};exports[_0x50e8('0x48')]=function(_0xff2e24,_0x27c80a){return db['ScreenRecording'][_0x50e8('0x48')]()[_0x50e8('0x23')](respondWithResult(_0x27c80a,null))[_0x50e8('0x3e')](handleError(_0x27c80a,null));};exports[_0x50e8('0x49')]=function(_0x207f06,_0x1372e3,_0x320b00){var _0x5f5220=require('../../components/encryptor');var _0x55083e=![];var _0x2b54ad={};if(_0x207f06[_0x50e8('0x2f')][_0x50e8('0x39')]&&_0x207f06[_0x50e8('0x2f')][_0x50e8('0x39')]===_0x50e8('0x4a')){_0x2b54ad['uniqueid']=_0x207f06[_0x50e8('0x47')]['id'];}else{_0x2b54ad['id']=_0x207f06[_0x50e8('0x47')]['id'];}return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':_0x2b54ad,'attributes':['id','value'],'raw':!![]})[_0x50e8('0x23')](handleEntityNotFound(_0x1372e3,null))[_0x50e8('0x23')](function(_0x373b41){if(_0x373b41){var _0x1cc5ba=path[_0x50e8('0x4b')](config[_0x50e8('0x4c')],'server/files/screen_recordings',_0x373b41[_0x50e8('0x4d')]);var _0x5d0d54=util['format']('%s.cypher',_0x1cc5ba);if(fs[_0x50e8('0x4e')](_0x5d0d54)){_0x55083e=!![];return _0x5f5220['decryptFile'](_0x5d0d54,_0x1cc5ba,config[_0x50e8('0x4f')][_0x50e8('0x50')])[_0x50e8('0x23')](function(){return _0x373b41;});}return _0x373b41;}})[_0x50e8('0x23')](function(_0x279cf4){if(_0x279cf4){var _0x12224d=path[_0x50e8('0x4b')](config['root'],_0x50e8('0x51'),_0x279cf4[_0x50e8('0x4d')]);if(!fs[_0x50e8('0x4e')](_0x12224d)){throw new db['Sequelize']['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x279cf4[_0x50e8('0x52')]){return _0x1372e3[_0x50e8('0x49')](_0x12224d,_0x279cf4[_0x50e8('0x52')]+path[_0x50e8('0x53')](_0x12224d),function(){if(_0x55083e){fs[_0x50e8('0x54')](_0x12224d);}});}else{return _0x1372e3[_0x50e8('0x49')](_0x12224d,function(_0x583d6a){if(_0x55083e){fs[_0x50e8('0x54')](_0x12224d);}});}}})['catch'](function(_0x255b48){if(_0x255b48[_0x50e8('0x55')]==='ScreenRecording\x20not\x20found'){_0x1372e3['status'](0x194)['send'](_0x50e8('0x56'));}else{return handleError(_0x1372e3,null);}});};exports[_0x50e8('0x57')]=function(_0x5d1fc8,_0x351047){return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':{'id':_0x5d1fc8[_0x50e8('0x47')]['id']}})[_0x50e8('0x23')](function(_0x47b428){if(_[_0x50e8('0x58')](_0x47b428)){throw new ReferenceError(_0x50e8('0x59'));}return _0x47b428;})[_0x50e8('0x23')](function(_0x4b80ac){var _0x583e58=path[_0x50e8('0x4b')](config[_0x50e8('0x4c')],_0x50e8('0x51'),_0x4b80ac[_0x50e8('0x4d')]);logger[_0x50e8('0x5a')](_0x50e8('0x5b'),_0x583e58);if(!_['isNil'](_0x4b80ac['value'])&&fs[_0x50e8('0x4e')](_0x583e58)){logger['info'](_0x50e8('0x5c')+_0x583e58+_0x50e8('0x5d'));fs['unlinkSync'](_0x583e58);}_0x583e58=_0x583e58+_0x50e8('0x5e');if(!_['isNil'](_0x4b80ac['value'])&&fs['existsSync'](_0x583e58)){logger[_0x50e8('0x5a')](_0x50e8('0x5c')+_0x583e58+_0x50e8('0x5d'));fs[_0x50e8('0x5f')](_0x583e58);}return _0x4b80ac;})['then'](function(_0x480362){if(!_0x480362)throw new InternalError();return _0x480362[_0x50e8('0x57')]();})[_0x50e8('0x23')](function(){_0x351047[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();})[_0x50e8('0x3e')](handleError(_0x351047,null));}; \ No newline at end of file +var _0xb138=['format','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','merge','options','findAll','rows','catch','params','keys','includeAll','include','find','create','body','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model'];(function(_0x275fbb,_0x52bdd9){var _0x1a1699=function(_0x2ded23){while(--_0x2ded23){_0x275fbb['push'](_0x275fbb['shift']());}};_0x1a1699(++_0x52bdd9);}(_0xb138,0x1dd));var _0x8b13=function(_0x28d279,_0x3d277d){_0x28d279=_0x28d279-0x0;var _0x5be83a=_0xb138[_0x28d279];return _0x5be83a;};'use strict';var emlformat=require(_0x8b13('0x0'));var rimraf=require(_0x8b13('0x1'));var zipdir=require(_0x8b13('0x2'));var jsonpatch=require(_0x8b13('0x3'));var rp=require(_0x8b13('0x4'));var moment=require(_0x8b13('0x5'));var BPromise=require(_0x8b13('0x6'));var Mustache=require('mustache');var util=require(_0x8b13('0x7'));var path=require(_0x8b13('0x8'));var sox=require(_0x8b13('0x9'));var csv=require('to-csv');var ejs=require(_0x8b13('0xa'));var fs=require('fs');var fs_extra=require(_0x8b13('0xb'));var _=require('lodash');var squel=require(_0x8b13('0xc'));var crypto=require(_0x8b13('0xd'));var jsforce=require(_0x8b13('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8b13('0xf'));var querystring=require(_0x8b13('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b13('0x11'));var qs=require(_0x8b13('0x12'));var as=require(_0x8b13('0x13'));var hardwareService=require(_0x8b13('0x14'));var logger=require(_0x8b13('0x15'))('api');var utils=require(_0x8b13('0x16'));var config=require(_0x8b13('0x17'));var licenseUtil=require(_0x8b13('0x18'));var db=require(_0x8b13('0x19'))['db'];function respondWithStatusCode(_0xb227e0,_0x1893b1){_0x1893b1=_0x1893b1||0xcc;return function(_0x58f97e){if(_0x58f97e){return _0xb227e0['sendStatus'](_0x1893b1);}return _0xb227e0[_0x8b13('0x1a')](_0x1893b1)[_0x8b13('0x1b')]();};}function respondWithResult(_0x5f12b5,_0x51a935){_0x51a935=_0x51a935||0xc8;return function(_0x479773){if(_0x479773){return _0x5f12b5[_0x8b13('0x1a')](_0x51a935)[_0x8b13('0x1c')](_0x479773);}};}function respondWithFilteredResult(_0xf29086,_0x2c615a){return function(_0x13f956){if(_0x13f956){var _0x542357=typeof _0x2c615a[_0x8b13('0x1d')]===_0x8b13('0x1e')&&typeof _0x2c615a[_0x8b13('0x1f')]===_0x8b13('0x1e');var _0x3eed21=_0x13f956[_0x8b13('0x20')];var _0x10fbde=_0x542357?0x0:_0x2c615a[_0x8b13('0x1d')];var _0x4989d3=_0x542357?_0x13f956['count']:_0x2c615a[_0x8b13('0x1d')]+_0x2c615a[_0x8b13('0x1f')];var _0x14a8ac;if(_0x4989d3>=_0x3eed21){_0x4989d3=_0x3eed21;_0x14a8ac=0xc8;}else{_0x14a8ac=0xce;}_0xf29086[_0x8b13('0x1a')](_0x14a8ac);return _0xf29086[_0x8b13('0x21')](_0x8b13('0x22'),_0x10fbde+'-'+_0x4989d3+'/'+_0x3eed21)['json'](_0x13f956);}return null;};}function patchUpdates(_0x1e8a48){return function(_0x3c4d4f){try{jsonpatch[_0x8b13('0x23')](_0x3c4d4f,_0x1e8a48,!![]);}catch(_0x54a309){return BPromise['reject'](_0x54a309);}return _0x3c4d4f[_0x8b13('0x24')]();};}function saveUpdates(_0xcb7621,_0x4f9902){return function(_0x3187ed){if(_0x3187ed){return _0x3187ed[_0x8b13('0x25')](_0xcb7621)[_0x8b13('0x26')](function(_0x213280){return _0x213280;});}return null;};}function removeEntity(_0xc05d5c,_0x583639){return function(_0x339271){if(_0x339271){return _0x339271[_0x8b13('0x27')]()['then'](function(){_0xc05d5c[_0x8b13('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x420772,_0x325d68){return function(_0x54786a){if(!_0x54786a){_0x420772[_0x8b13('0x28')](0x194);}return _0x54786a;};}function handleError(_0x3223d8,_0x4f8e58){_0x4f8e58=_0x4f8e58||0x1f4;return function(_0x134c5e){logger[_0x8b13('0x29')](_0x134c5e[_0x8b13('0x2a')]);if(_0x134c5e[_0x8b13('0x2b')]){delete _0x134c5e[_0x8b13('0x2b')];}_0x3223d8['status'](_0x4f8e58)[_0x8b13('0x2c')](_0x134c5e);};}exports[_0x8b13('0x2d')]=function(_0x3475d8,_0x1511bf){var _0x114b01={},_0x2bb51d={},_0x5ab161={'count':0x0,'rows':[]};var _0x35fdca=_[_0x8b13('0x2e')](db[_0x8b13('0x2f')][_0x8b13('0x30')],function(_0x23fde7){return{'name':_0x23fde7[_0x8b13('0x31')],'type':_0x23fde7[_0x8b13('0x32')][_0x8b13('0x33')]};});_0x2bb51d[_0x8b13('0x34')]=_['differenceBy'](_[_0x8b13('0x2e')](_0x35fdca,_0x8b13('0x2b')),[_0x8b13('0x35')]);_0x2bb51d[_0x8b13('0x36')]=_['keys'](_0x3475d8['query']);_0x2bb51d[_0x8b13('0x37')]=_['intersection'](_0x2bb51d['model'],_0x2bb51d[_0x8b13('0x36')]);_0x114b01['attributes']=_[_0x8b13('0x38')](_0x2bb51d[_0x8b13('0x34')],qs[_0x8b13('0x39')](_0x3475d8[_0x8b13('0x36')][_0x8b13('0x39')]));_0x114b01[_0x8b13('0x3a')]=_0x114b01[_0x8b13('0x3a')][_0x8b13('0x3b')]?_0x114b01[_0x8b13('0x3a')]:_0x2bb51d[_0x8b13('0x34')];if(!_0x3475d8['query'][_0x8b13('0x3c')](_0x8b13('0x3d'))){_0x114b01[_0x8b13('0x1f')]=qs[_0x8b13('0x1f')](_0x3475d8[_0x8b13('0x36')][_0x8b13('0x1f')]);_0x114b01[_0x8b13('0x1d')]=qs[_0x8b13('0x1d')](_0x3475d8['query'][_0x8b13('0x1d')]);}_0x114b01['order']=qs[_0x8b13('0x3e')](_0x3475d8[_0x8b13('0x36')][_0x8b13('0x3e')]);_0x114b01[_0x8b13('0x3f')]=qs[_0x8b13('0x37')](_[_0x8b13('0x40')](_0x3475d8['query'],_0x2bb51d['filters']),_0x35fdca);if(_0x3475d8[_0x8b13('0x36')]['filter']){_0x114b01[_0x8b13('0x3f')]=_['merge'](_0x114b01[_0x8b13('0x3f')],{'$or':_[_0x8b13('0x2e')](_0x35fdca,function(_0x29a359){if(_0x29a359[_0x8b13('0x32')]!==_0x8b13('0x41')){var _0x4e16e7={};_0x4e16e7[_0x29a359['name']]={'$like':'%'+_0x3475d8[_0x8b13('0x36')]['filter']+'%'};return _0x4e16e7;}})});}_0x114b01=_[_0x8b13('0x42')]({},_0x114b01,_0x3475d8[_0x8b13('0x43')]);var _0x4dc268={'where':_0x114b01[_0x8b13('0x3f')]};return db[_0x8b13('0x2f')][_0x8b13('0x20')](_0x4dc268)[_0x8b13('0x26')](function(_0x2f4e7f){_0x5ab161[_0x8b13('0x20')]=_0x2f4e7f;if(_0x3475d8[_0x8b13('0x36')]['includeAll']){_0x114b01['include']=[{'all':!![]}];}return db['ScreenRecording'][_0x8b13('0x44')](_0x114b01);})[_0x8b13('0x26')](function(_0x27cfe5){_0x5ab161[_0x8b13('0x45')]=_0x27cfe5;return _0x5ab161;})[_0x8b13('0x26')](respondWithFilteredResult(_0x1511bf,_0x114b01))[_0x8b13('0x46')](handleError(_0x1511bf,null));};exports['show']=function(_0x4342db,_0x50e535){var _0x13d0ef={'raw':![],'where':{'id':_0x4342db[_0x8b13('0x47')]['id']}},_0x5ce9c8={};_0x5ce9c8[_0x8b13('0x34')]=_[_0x8b13('0x48')](db[_0x8b13('0x2f')][_0x8b13('0x30')]);_0x5ce9c8[_0x8b13('0x36')]=_[_0x8b13('0x48')](_0x4342db['query']);_0x5ce9c8['filters']=_['intersection'](_0x5ce9c8[_0x8b13('0x34')],_0x5ce9c8[_0x8b13('0x36')]);_0x13d0ef[_0x8b13('0x3a')]=_[_0x8b13('0x38')](_0x5ce9c8['model'],qs['fields'](_0x4342db[_0x8b13('0x36')]['fields']));_0x13d0ef[_0x8b13('0x3a')]=_0x13d0ef[_0x8b13('0x3a')][_0x8b13('0x3b')]?_0x13d0ef[_0x8b13('0x3a')]:_0x5ce9c8[_0x8b13('0x34')];if(_0x4342db['query'][_0x8b13('0x49')]){_0x13d0ef[_0x8b13('0x4a')]=[{'all':!![]}];}_0x13d0ef=_[_0x8b13('0x42')]({},_0x13d0ef,_0x4342db[_0x8b13('0x43')]);return db[_0x8b13('0x2f')][_0x8b13('0x4b')](_0x13d0ef)[_0x8b13('0x26')](handleEntityNotFound(_0x50e535,null))[_0x8b13('0x26')](respondWithResult(_0x50e535,null))[_0x8b13('0x46')](handleError(_0x50e535,null));};exports['create']=function(_0x46d096,_0x59d863){return db[_0x8b13('0x2f')][_0x8b13('0x4c')](_0x46d096[_0x8b13('0x4d')],{})['then'](respondWithResult(_0x59d863,0xc9))[_0x8b13('0x46')](handleError(_0x59d863,null));};exports[_0x8b13('0x25')]=function(_0x257107,_0x4129c0){if(_0x257107[_0x8b13('0x4d')]['id']){delete _0x257107[_0x8b13('0x4d')]['id'];}delete _0x257107[_0x8b13('0x4d')]['duration'];delete _0x257107[_0x8b13('0x4d')]['createdAt'];delete _0x257107[_0x8b13('0x4d')][_0x8b13('0x4e')];delete _0x257107[_0x8b13('0x4d')][_0x8b13('0x4f')];return db[_0x8b13('0x2f')][_0x8b13('0x4b')]({'where':{'id':_0x257107[_0x8b13('0x47')]['id']}})[_0x8b13('0x26')](handleEntityNotFound(_0x4129c0,null))[_0x8b13('0x26')](saveUpdates(_0x257107[_0x8b13('0x4d')],null))[_0x8b13('0x26')](respondWithResult(_0x4129c0,null))[_0x8b13('0x46')](handleError(_0x4129c0,null));};exports[_0x8b13('0x50')]=function(_0x2bdfae,_0x42c29d){return db[_0x8b13('0x2f')][_0x8b13('0x50')]()['then'](respondWithResult(_0x42c29d,null))[_0x8b13('0x46')](handleError(_0x42c29d,null));};exports[_0x8b13('0x51')]=function(_0x4c19f6,_0x342fff,_0x328373){var _0x2fc00c=require(_0x8b13('0x52'));var _0x25cb45=![];var _0x12549b={};if(_0x4c19f6[_0x8b13('0x36')][_0x8b13('0x32')]&&_0x4c19f6[_0x8b13('0x36')][_0x8b13('0x32')]===_0x8b13('0x53')){_0x12549b[_0x8b13('0x53')]=_0x4c19f6[_0x8b13('0x47')]['id'];}else{_0x12549b['id']=_0x4c19f6[_0x8b13('0x47')]['id'];}return db[_0x8b13('0x2f')]['find']({'where':_0x12549b,'attributes':['id',_0x8b13('0x4f')],'raw':!![]})[_0x8b13('0x26')](handleEntityNotFound(_0x342fff,null))['then'](function(_0x11e8af){if(_0x11e8af){var _0x73aba5=path[_0x8b13('0x54')](config[_0x8b13('0x55')],_0x8b13('0x56'),_0x11e8af['value']);var _0x1fd105=util[_0x8b13('0x35')](_0x8b13('0x57'),_0x73aba5);if(fs['existsSync'](_0x1fd105)){_0x25cb45=!![];return _0x2fc00c[_0x8b13('0x58')](_0x1fd105,_0x73aba5,config[_0x8b13('0x59')]['recording'])[_0x8b13('0x26')](function(){return _0x11e8af;});}return _0x11e8af;}})[_0x8b13('0x26')](function(_0x475c8d){if(_0x475c8d){var _0xd29067=path['join'](config[_0x8b13('0x55')],_0x8b13('0x56'),_0x475c8d['value']);if(!fs[_0x8b13('0x5a')](_0xd29067)){throw new db[(_0x8b13('0x5b'))][(_0x8b13('0x5c'))](_0x8b13('0x5d'));}if(_0x475c8d['filename']){return _0x342fff[_0x8b13('0x51')](_0xd29067,_0x475c8d[_0x8b13('0x5e')]+path[_0x8b13('0x5f')](_0xd29067),function(){if(_0x25cb45){fs[_0x8b13('0x60')](_0xd29067);}});}else{return _0x342fff[_0x8b13('0x51')](_0xd29067,function(_0x2fff4e){if(_0x25cb45){fs['unlink'](_0xd29067);}});}}})[_0x8b13('0x46')](function(_0x1082d9){if(_0x1082d9[_0x8b13('0x61')]==='ScreenRecording\x20not\x20found'){_0x342fff[_0x8b13('0x1a')](0x194)[_0x8b13('0x2c')](_0x8b13('0x62'));}else{return handleError(_0x342fff,null);}});};exports[_0x8b13('0x27')]=function(_0x4d8f23,_0x59a6b3){return db['ScreenRecording']['find']({'where':{'id':_0x4d8f23['params']['id']}})[_0x8b13('0x26')](function(_0x1bc936){if(_['isNil'](_0x1bc936)){throw new ReferenceError(_0x8b13('0x63'));}return _0x1bc936;})['then'](function(_0x274bad){var _0x2d2fa3=path[_0x8b13('0x54')](config[_0x8b13('0x55')],_0x8b13('0x56'),_0x274bad[_0x8b13('0x4f')]);logger[_0x8b13('0x64')]('cancellazione\x20fisica\x20documento\x20%s',_0x2d2fa3);if(!_[_0x8b13('0x65')](_0x274bad['value'])&&fs[_0x8b13('0x5a')](_0x2d2fa3)){logger[_0x8b13('0x64')](_0x8b13('0x66')+_0x2d2fa3+_0x8b13('0x67'));fs[_0x8b13('0x68')](_0x2d2fa3);}_0x2d2fa3=_0x2d2fa3+_0x8b13('0x69');if(!_[_0x8b13('0x65')](_0x274bad['value'])&&fs[_0x8b13('0x5a')](_0x2d2fa3)){logger['info'](_0x8b13('0x66')+_0x2d2fa3+_0x8b13('0x67'));fs[_0x8b13('0x68')](_0x2d2fa3);}return _0x274bad;})[_0x8b13('0x26')](function(_0x177a64){if(!_0x177a64)throw new InternalError();return _0x177a64['destroy']();})['then'](function(){_0x59a6b3[_0x8b13('0x1a')](0xcc)[_0x8b13('0x1b')]();})['catch'](handleError(_0x59a6b3,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index d323989..08f3972 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 _0x1a38=['bluebird','request-promise','path','./screenRecording.attributes','exports','define','ScreenRecording','interactionid','util','../../config/logger','api','moment'];(function(_0x3ed1ab,_0x5896b8){var _0xc317be=function(_0x5d3fc5){while(--_0x5d3fc5){_0x3ed1ab['push'](_0x3ed1ab['shift']());}};_0xc317be(++_0x5896b8);}(_0x1a38,0xe0));var _0x81a3=function(_0x3a1ea5,_0x349f01){_0x3a1ea5=_0x3a1ea5-0x0;var _0xfac9b2=_0x1a38[_0x3a1ea5];return _0xfac9b2;};'use strict';var _=require('lodash');var util=require(_0x81a3('0x0'));var logger=require(_0x81a3('0x1'))(_0x81a3('0x2'));var moment=require(_0x81a3('0x3'));var BPromise=require(_0x81a3('0x4'));var rp=require(_0x81a3('0x5'));var fs=require('fs');var path=require(_0x81a3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x81a3('0x7'));module[_0x81a3('0x8')]=function(_0x1d3ab8,_0x98c392){return _0x1d3ab8[_0x81a3('0x9')](_0x81a3('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x81a3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x40fa=['interactionid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ScreenRecording','screen_recordings'];(function(_0x484485,_0x3035e3){var _0x334374=function(_0x26dfb2){while(--_0x26dfb2){_0x484485['push'](_0x484485['shift']());}};_0x334374(++_0x3035e3);}(_0x40fa,0xaa));var _0xa40f=function(_0x189ada,_0x1ec750){_0x189ada=_0x189ada-0x0;var _0x5a82d0=_0x40fa[_0x189ada];return _0x5a82d0;};'use strict';var _=require(_0xa40f('0x0'));var util=require('util');var logger=require(_0xa40f('0x1'))(_0xa40f('0x2'));var moment=require(_0xa40f('0x3'));var BPromise=require(_0xa40f('0x4'));var rp=require(_0xa40f('0x5'));var fs=require('fs');var path=require(_0xa40f('0x6'));var rimraf=require('rimraf');var config=require(_0xa40f('0x7'));var attributes=require('./screenRecording.attributes');module[_0xa40f('0x8')]=function(_0x4806c1,_0x5dece3){return _0x4806c1[_0xa40f('0x9')](_0xa40f('0xa'),attributes,{'tableName':_0xa40f('0xb'),'paranoid':![],'indexes':[{'name':_0xa40f('0xc'),'fields':[_0xa40f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 8b2d289..55540ce 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 _0x6398=['then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request'];(function(_0x4ac8e1,_0x20796f){var _0x26a3cc=function(_0x135ea0){while(--_0x135ea0){_0x4ac8e1['push'](_0x4ac8e1['shift']());}};_0x26a3cc(++_0x20796f);}(_0x6398,0x1ad));var _0x8639=function(_0x347ffb,_0x156d2b){_0x347ffb=_0x347ffb-0x0;var _0x330474=_0x6398[_0x347ffb];return _0x330474;};'use strict';var _=require('lodash');var util=require(_0x8639('0x0'));var moment=require(_0x8639('0x1'));var BPromise=require(_0x8639('0x2'));var rs=require(_0x8639('0x3'));var fs=require('fs');var Redis=require(_0x8639('0x4'));var db=require(_0x8639('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8639('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8639('0x7'));var client=jayson[_0x8639('0x8')][_0x8639('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28a4c4,_0x232f2c,_0x3009a4){return new BPromise(function(_0x4e88e7,_0x5f26aa){return client[_0x8639('0xa')](_0x28a4c4,_0x3009a4)[_0x8639('0xb')](function(_0x52a52e){logger[_0x8639('0xc')](_0x8639('0xd'),_0x232f2c,'request\x20sent');logger[_0x8639('0xe')](_0x8639('0xf'),_0x232f2c,_0x8639('0x10'),JSON[_0x8639('0x11')](_0x52a52e));if(_0x52a52e['error']){if(_0x52a52e[_0x8639('0x12')][_0x8639('0x13')]===0x1f4){logger[_0x8639('0x12')](_0x8639('0xd'),_0x232f2c,_0x52a52e[_0x8639('0x12')][_0x8639('0x14')]);return _0x5f26aa(_0x52a52e[_0x8639('0x12')][_0x8639('0x14')]);}logger[_0x8639('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x232f2c,_0x52a52e[_0x8639('0x12')]['message']);return _0x4e88e7(_0x52a52e[_0x8639('0x12')][_0x8639('0x14')]);}else{logger[_0x8639('0xc')](_0x8639('0xd'),_0x232f2c,_0x8639('0x10'));_0x4e88e7(_0x52a52e['result'][_0x8639('0x14')]);}})[_0x8639('0x15')](function(_0x5578be){logger['error'](_0x8639('0xd'),_0x232f2c,_0x5578be);_0x5f26aa(_0x5578be);});});} \ No newline at end of file +var _0xdaa7=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0xdaa7,0xcc));var _0x7daa=function(_0x4bcf38,_0x3c12be){_0x4bcf38=_0x4bcf38-0x0;var _0x4a89be=_0xdaa7[_0x4bcf38];return _0x4a89be;};'use strict';var _=require('lodash');var util=require(_0x7daa('0x0'));var moment=require('moment');var BPromise=require(_0x7daa('0x1'));var rs=require(_0x7daa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7daa('0x3'))['db'];var utils=require(_0x7daa('0x4'));var logger=require(_0x7daa('0x5'))(_0x7daa('0x6'));var config=require('../../config/environment');var jayson=require(_0x7daa('0x7'));var client=jayson[_0x7daa('0x8')][_0x7daa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6ff59b,_0x4a2344,_0x337f24){return new BPromise(function(_0x3c93aa,_0x14a64b){return client[_0x7daa('0xa')](_0x6ff59b,_0x337f24)[_0x7daa('0xb')](function(_0x3798bf){logger[_0x7daa('0xc')](_0x7daa('0xd'),_0x4a2344,_0x7daa('0xe'));logger[_0x7daa('0xf')](_0x7daa('0x10'),_0x4a2344,_0x7daa('0xe'),JSON[_0x7daa('0x11')](_0x3798bf));if(_0x3798bf[_0x7daa('0x12')]){if(_0x3798bf['error'][_0x7daa('0x13')]===0x1f4){logger['error'](_0x7daa('0xd'),_0x4a2344,_0x3798bf[_0x7daa('0x12')][_0x7daa('0x14')]);return _0x14a64b(_0x3798bf['error']['message']);}logger[_0x7daa('0x12')](_0x7daa('0xd'),_0x4a2344,_0x3798bf['error'][_0x7daa('0x14')]);return _0x3c93aa(_0x3798bf[_0x7daa('0x12')]['message']);}else{logger[_0x7daa('0xc')](_0x7daa('0xd'),_0x4a2344,_0x7daa('0xe'));_0x3c93aa(_0x3798bf[_0x7daa('0x15')][_0x7daa('0x14')]);}})[_0x7daa('0x16')](function(_0x546bc2){logger[_0x7daa('0x12')](_0x7daa('0xd'),_0x4a2344,_0x546bc2);_0x14a64b(_0x546bc2);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 82d1d6c..d4f51a3 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 _0xf04d=['addFavicon','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','extname','originalname','post','single','file','addLogo','logologin'];(function(_0x4e3be6,_0xb86bfc){var _0x5a6d69=function(_0x27609e){while(--_0x27609e){_0x4e3be6['push'](_0x4e3be6['shift']());}};_0x5a6d69(++_0xb86bfc);}(_0xf04d,0x193));var _0xdf04=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0xf04d[_0x1a7550];return _0x426e22;};'use strict';var multer=require(_0xdf04('0x0'));var util=require(_0xdf04('0x1'));var path=require(_0xdf04('0x2'));var timeout=require(_0xdf04('0x3'));var express=require(_0xdf04('0x4'));var router=express[_0xdf04('0x5')]();var fs_extra=require(_0xdf04('0x6'));var auth=require(_0xdf04('0x7'));var interaction=require(_0xdf04('0x8'));var config=require(_0xdf04('0x9'));var controller=require(_0xdf04('0xa'));router['get']('/',auth[_0xdf04('0xb')](),controller[_0xdf04('0xc')]);router[_0xdf04('0xd')](_0xdf04('0xe'),controller[_0xdf04('0xf')]);router[_0xdf04('0xd')](_0xdf04('0x10'),controller[_0xdf04('0x11')]);router[_0xdf04('0xd')](_0xdf04('0x12'),controller[_0xdf04('0x13')]);router[_0xdf04('0xd')]('/:id/logo_login',controller['getLogoLogin']);router['get'](_0xdf04('0x14'),controller['gdpr']);router[_0xdf04('0xd')](_0xdf04('0x15'),controller[_0xdf04('0x16')]);router[_0xdf04('0xd')](_0xdf04('0x17'),controller['getFavicon']);var upload=multer({'storage':multer[_0xdf04('0x18')]({'destination':function(_0xc65e35,_0xcbd70f,_0xee6310){_0xee6310(null,path[_0xdf04('0x19')](config[_0xdf04('0x1a')],_0xdf04('0x1b')));},'filename':function(_0x4b1068,_0xd67d57,_0x4d0d87){_0x4d0d87(null,util[_0xdf04('0x1c')](_0xdf04('0x1d'),'logo',path[_0xdf04('0x1e')](_0xd67d57[_0xdf04('0x1f')])));}})});router[_0xdf04('0x20')]('/:id/logo',upload[_0xdf04('0x21')](_0xdf04('0x22')),controller[_0xdf04('0x23')]);var upload=multer({'storage':multer[_0xdf04('0x18')]({'destination':function(_0xffb8e2,_0x35b4e1,_0x46c67c){_0x46c67c(null,path[_0xdf04('0x19')](config[_0xdf04('0x1a')],_0xdf04('0x1b')));},'filename':function(_0x3e71ef,_0x25d01c,_0x2dc3d2){_0x2dc3d2(null,util[_0xdf04('0x1c')](_0xdf04('0x1d'),_0xdf04('0x24'),path['extname'](_0x25d01c[_0xdf04('0x1f')])));}})});router[_0xdf04('0x20')]('/:id/logo_login',upload[_0xdf04('0x21')](_0xdf04('0x22')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xdf04('0x18')]({'destination':function(_0x3a0576,_0x5ac0c3,_0xc707b1){_0xc707b1(null,path[_0xdf04('0x19')](config[_0xdf04('0x1a')],_0xdf04('0x1b')));},'filename':function(_0x3a9cee,_0x5d37a5,_0x52990f){_0x52990f(null,util[_0xdf04('0x1c')](_0xdf04('0x1d'),'preferred',path['extname'](_0x5d37a5[_0xdf04('0x1f')])));}})});router[_0xdf04('0x20')]('/:id/preferred',upload[_0xdf04('0x21')](_0xdf04('0x22')),controller['addPreferred']);var upload=multer({'storage':multer[_0xdf04('0x18')]({'destination':function(_0x36897a,_0x4fdc5c,_0x235c0b){_0x235c0b(null,path[_0xdf04('0x19')](config[_0xdf04('0x1a')],_0xdf04('0x1b')));},'filename':function(_0x1ea8bc,_0xa13540,_0x41aaf5){_0x41aaf5(null,util[_0xdf04('0x1c')]('%s%s','favicon',path['extname'](_0xa13540[_0xdf04('0x1f')])));}})});router[_0xdf04('0x20')](_0xdf04('0x17'),upload['single'](_0xdf04('0x22')),controller[_0xdf04('0x25')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xdf04('0x26')]);module[_0xdf04('0x27')]=router; \ No newline at end of file +var _0x596a=['../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','getDate','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','originalname','single','file','addLogo','addLogoLogin','preferred','extname','post','addPreferred','favicon','addFavicon','put','/:id','update','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x730865,_0x1a4a95){var _0x50c992=function(_0x283907){while(--_0x283907){_0x730865['push'](_0x730865['shift']());}};_0x50c992(++_0x1a4a95);}(_0x596a,0x1c8));var _0xa596=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x596a[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa596('0x0'));var timeout=require(_0xa596('0x1'));var express=require(_0xa596('0x2'));var router=express[_0xa596('0x3')]();var fs_extra=require(_0xa596('0x4'));var auth=require(_0xa596('0x5'));var interaction=require(_0xa596('0x6'));var config=require(_0xa596('0x7'));var controller=require(_0xa596('0x8'));router[_0xa596('0x9')]('/',auth[_0xa596('0xa')](),controller['index']);router['get']('/now',controller[_0xa596('0xb')]);router[_0xa596('0x9')]('/:id',controller[_0xa596('0xc')]);router['get'](_0xa596('0xd'),controller[_0xa596('0xe')]);router[_0xa596('0x9')]('/:id/logo_login',controller[_0xa596('0xf')]);router['get'](_0xa596('0x10'),controller['gdpr']);router[_0xa596('0x9')](_0xa596('0x11'),controller['getPreferred']);router[_0xa596('0x9')](_0xa596('0x12'),controller[_0xa596('0x13')]);var upload=multer({'storage':multer[_0xa596('0x14')]({'destination':function(_0x4f453b,_0x96e4ed,_0x4f37c5){_0x4f37c5(null,path[_0xa596('0x15')](config[_0xa596('0x16')],_0xa596('0x17')));},'filename':function(_0x2af5d8,_0x5b4bf6,_0x3dad4c){_0x3dad4c(null,util[_0xa596('0x18')](_0xa596('0x19'),_0xa596('0x1a'),path['extname'](_0x5b4bf6[_0xa596('0x1b')])));}})});router['post']('/:id/logo',upload[_0xa596('0x1c')](_0xa596('0x1d')),controller[_0xa596('0x1e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x294ff0,_0x169d56,_0x54df22){_0x54df22(null,path[_0xa596('0x15')](config[_0xa596('0x16')],_0xa596('0x17')));},'filename':function(_0x15b8c1,_0x20e3d7,_0x5abe28){_0x5abe28(null,util['format'](_0xa596('0x19'),'logologin',path['extname'](_0x20e3d7[_0xa596('0x1b')])));}})});router['post']('/:id/logo_login',upload[_0xa596('0x1c')](_0xa596('0x1d')),controller[_0xa596('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x23ec27,_0xc002ae,_0xe4235f){_0xe4235f(null,path[_0xa596('0x15')](config[_0xa596('0x16')],_0xa596('0x17')));},'filename':function(_0x36beff,_0x58f72d,_0x55af08){_0x55af08(null,util['format'](_0xa596('0x19'),_0xa596('0x20'),path[_0xa596('0x21')](_0x58f72d[_0xa596('0x1b')])));}})});router[_0xa596('0x22')](_0xa596('0x11'),upload['single'](_0xa596('0x1d')),controller[_0xa596('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4966aa,_0x20511d,_0xb4fc19){_0xb4fc19(null,path[_0xa596('0x15')](config['root'],_0xa596('0x17')));},'filename':function(_0x3bd5c5,_0xe50649,_0x16a82c){_0x16a82c(null,util[_0xa596('0x18')](_0xa596('0x19'),_0xa596('0x24'),path[_0xa596('0x21')](_0xe50649[_0xa596('0x1b')])));}})});router[_0xa596('0x22')]('/:id/favicon',upload[_0xa596('0x1c')]('file'),controller[_0xa596('0x25')]);router[_0xa596('0x26')](_0xa596('0x27'),auth[_0xa596('0xa')](),controller[_0xa596('0x28')]);module[_0xa596('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index c6be1e5..2384844 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(_0x482914,_0x3fe08e){var _0x151f6a=function(_0x1fc08e){while(--_0x1fc08e){_0x482914['push'](_0x482914['shift']());}};_0x151f6a(++_0x3fe08e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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':!![]}}; \ No newline at end of file +var _0x34e8=['https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0xa56b53,_0x53dbb7){var _0x19849f=function(_0x503946){while(--_0x503946){_0xa56b53['push'](_0xa56b53['shift']());}};_0x19849f(++_0x53dbb7);}(_0x34e8,0x12c));var _0x834e=function(_0xda1f40,_0xbd11fc){_0xda1f40=_0xda1f40-0x0;var _0x397a72=_0x34e8[_0xda1f40];return _0x397a72;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'min_internal':{'type':Sequelize[_0x834e('0x2')](0xb),'unique':_0x834e('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x834e('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x834e('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x834e('0x5')],'defaultValue':_0x834e('0x6')},'logo':{'type':Sequelize[_0x834e('0x5')]},'defaultLogo':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x834e('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x834e('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x834e('0x5')]},'turnaddr':{'type':Sequelize[_0x834e('0x5')]},'turnusername':{'type':Sequelize[_0x834e('0x5')]},'turnpassword':{'type':Sequelize[_0x834e('0x5')]},'pageTitle':{'type':Sequelize[_0x834e('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x834e('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x834e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x834e('0x5')],'defaultValue':_0x834e('0x8')},'enableEmailPreview':{'type':Sequelize[_0x834e('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x834e('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x834e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x834e('0x5')],'defaultValue':_0x834e('0x9')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x834e('0x5')]},'defaultPreferred':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x834e('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x834e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x834e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x834e('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x834e('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x834e('0x5')]},'sentiment':{'type':Sequelize[_0x834e('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x834e('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x834e('0x5')]},'language':{'type':Sequelize[_0x834e('0x5')]},'bucket':{'type':Sequelize[_0x834e('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x834e('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x834e('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x834e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x834e('0x2')](0x2)[_0x834e('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x834e('0x2')](0x2)[_0x834e('0xa')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x834e('0xa')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x834e('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x834e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x834e('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 0dbaaff..26fca0b 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 _0x3021=['Sequelize','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','Setting','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','body','find','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','toLower','join','root','default','upperFirst','custom','default_logo.svg','existsSync','\x20not\x20found','download','getLogoLogin','defaultLogo','default_loginLogo.svg','ValidationError','gdpr','getPreferred','addFavicon','getFavicon'];(function(_0x3ff424,_0x23ceef){var _0x43a1f5=function(_0x4ed54f){while(--_0x4ed54f){_0x3ff424['push'](_0x3ff424['shift']());}};_0x43a1f5(++_0x23ceef);}(_0x3021,0x179));var _0x1302=function(_0x1f0046,_0x3dcfd3){_0x1f0046=_0x1f0046-0x0;var _0x34d65b=_0x3021[_0x1f0046];return _0x34d65b;};'use strict';var emlformat=require(_0x1302('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1302('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1302('0x2'));var moment=require(_0x1302('0x3'));var BPromise=require(_0x1302('0x4'));var Mustache=require('mustache');var util=require(_0x1302('0x5'));var path=require(_0x1302('0x6'));var sox=require(_0x1302('0x7'));var csv=require(_0x1302('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1302('0x9'));var _=require(_0x1302('0xa'));var squel=require(_0x1302('0xb'));var crypto=require(_0x1302('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1302('0xd'));var toCsv=require(_0x1302('0x8'));var querystring=require(_0x1302('0xe'));var Papa=require(_0x1302('0xf'));var Redis=require(_0x1302('0x10'));var authService=require(_0x1302('0x11'));var qs=require(_0x1302('0x12'));var as=require(_0x1302('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1302('0x14'))('api');var utils=require(_0x1302('0x15'));var config=require(_0x1302('0x16'));var licenseUtil=require(_0x1302('0x17'));var db=require(_0x1302('0x18'))['db'];var jayson=require(_0x1302('0x19'));var client=jayson['client'][_0x1302('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1c6cde,_0x10bb09,_0x2d54e0,_0x139a34){return new BPromise(function(_0x203c0a,_0x5f00d2){var _0x25a1d4=_0x139a34||client;return _0x25a1d4[_0x1302('0x1b')](_0x1c6cde,_0x2d54e0)['then'](function(_0x360b17){logger[_0x1302('0x1c')](_0x1302('0x1d'),_0x10bb09,_0x1302('0x1e'));logger[_0x1302('0x1f')](_0x1302('0x20'),_0x10bb09,_0x1302('0x1e'),JSON[_0x1302('0x21')](_0x360b17));if(_0x360b17[_0x1302('0x22')]){if(_0x360b17[_0x1302('0x22')]['code']===0x1f4){logger[_0x1302('0x22')](_0x1302('0x1d'),_0x10bb09,_0x360b17[_0x1302('0x22')][_0x1302('0x23')]);return _0x5f00d2(_0x360b17[_0x1302('0x22')][_0x1302('0x23')]);}logger[_0x1302('0x22')]('Setting,\x20%s,\x20%s',_0x10bb09,_0x360b17[_0x1302('0x22')][_0x1302('0x23')]);return _0x203c0a(_0x360b17['error'][_0x1302('0x23')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x10bb09,_0x1302('0x1e'));_0x203c0a(_0x360b17['result'][_0x1302('0x23')]);}})[_0x1302('0x24')](function(_0x215962){logger[_0x1302('0x22')]('Setting,\x20%s,\x20%s',_0x10bb09,_0x215962);_0x5f00d2(_0x215962);});});}function respondWithStatusCode(_0x821241,_0x4b5a71){_0x4b5a71=_0x4b5a71||0xcc;return function(_0x463ce1){if(_0x463ce1){return _0x821241[_0x1302('0x25')](_0x4b5a71);}return _0x821241[_0x1302('0x26')](_0x4b5a71)[_0x1302('0x27')]();};}function respondWithResult(_0x1d8f76,_0x152c0f){_0x152c0f=_0x152c0f||0xc8;return function(_0x154ee3){if(_0x154ee3){return _0x1d8f76[_0x1302('0x26')](_0x152c0f)[_0x1302('0x28')](_0x154ee3);}};}function respondWithFilteredResult(_0x41d745,_0x2f21f2){return function(_0x44b073){if(_0x44b073){var _0x21aa2d=typeof _0x2f21f2['offset']===_0x1302('0x29')&&typeof _0x2f21f2[_0x1302('0x2a')]===_0x1302('0x29');var _0x5bbfd3=_0x44b073[_0x1302('0x2b')];var _0x3df766=_0x21aa2d?0x0:_0x2f21f2[_0x1302('0x2c')];var _0x2dd968=_0x21aa2d?_0x44b073[_0x1302('0x2b')]:_0x2f21f2[_0x1302('0x2c')]+_0x2f21f2[_0x1302('0x2a')];var _0x48b3cb;if(_0x2dd968>=_0x5bbfd3){_0x2dd968=_0x5bbfd3;_0x48b3cb=0xc8;}else{_0x48b3cb=0xce;}_0x41d745[_0x1302('0x26')](_0x48b3cb);return _0x41d745['set'](_0x1302('0x2d'),_0x3df766+'-'+_0x2dd968+'/'+_0x5bbfd3)[_0x1302('0x28')](_0x44b073);}return null;};}function patchUpdates(_0x56513b){return function(_0x166f50){try{jsonpatch[_0x1302('0x2e')](_0x166f50,_0x56513b,!![]);}catch(_0x3a5ff8){return BPromise[_0x1302('0x2f')](_0x3a5ff8);}return _0x166f50[_0x1302('0x30')]();};}function saveUpdates(_0x5e8120,_0x43b5be){return function(_0x22fa77){if(_0x22fa77){return _0x22fa77[_0x1302('0x31')](_0x5e8120)[_0x1302('0x32')](function(_0x32b215){return _0x32b215;});}return null;};}function removeEntity(_0x1431ba,_0x4c8b55){return function(_0x4e0358){if(_0x4e0358){return _0x4e0358[_0x1302('0x33')]()[_0x1302('0x32')](function(){_0x1431ba[_0x1302('0x26')](0xcc)[_0x1302('0x27')]();});}};}function handleEntityNotFound(_0x3be40,_0x10b907){return function(_0xe72688){if(!_0xe72688){_0x3be40[_0x1302('0x25')](0x194);}return _0xe72688;};}function handleError(_0x5d35a2,_0xee9b4b){_0xee9b4b=_0xee9b4b||0x1f4;return function(_0x4b3d9b){logger[_0x1302('0x22')](_0x4b3d9b[_0x1302('0x34')]);if(_0x4b3d9b['name']){delete _0x4b3d9b[_0x1302('0x35')];}_0x5d35a2[_0x1302('0x26')](_0xee9b4b)[_0x1302('0x36')](_0x4b3d9b);};}exports[_0x1302('0x37')]=function(_0x275013,_0xabea7c){var _0x379baa={},_0x11129a={},_0x5b44c1={'count':0x0,'rows':[]};var _0x2600bd=_[_0x1302('0x38')](db[_0x1302('0x39')]['rawAttributes'],function(_0x55ff58){return{'name':_0x55ff58[_0x1302('0x3a')],'type':_0x55ff58[_0x1302('0x3b')][_0x1302('0x3c')]};});_0x11129a[_0x1302('0x3d')]=_[_0x1302('0x38')](_0x2600bd,_0x1302('0x35'));_0x11129a[_0x1302('0x3e')]=_[_0x1302('0x3f')](_0x275013[_0x1302('0x3e')]);_0x11129a[_0x1302('0x40')]=_[_0x1302('0x41')](_0x11129a[_0x1302('0x3d')],_0x11129a[_0x1302('0x3e')]);_0x379baa[_0x1302('0x42')]=_['intersection'](_0x11129a['model'],qs[_0x1302('0x43')](_0x275013[_0x1302('0x3e')][_0x1302('0x43')]));_0x379baa[_0x1302('0x42')]=_0x379baa[_0x1302('0x42')][_0x1302('0x44')]?_0x379baa[_0x1302('0x42')]:_0x11129a['model'];if(!_0x275013[_0x1302('0x3e')][_0x1302('0x45')](_0x1302('0x46'))){_0x379baa[_0x1302('0x2a')]=qs[_0x1302('0x2a')](_0x275013[_0x1302('0x3e')]['limit']);_0x379baa[_0x1302('0x2c')]=qs[_0x1302('0x2c')](_0x275013[_0x1302('0x3e')][_0x1302('0x2c')]);}_0x379baa[_0x1302('0x47')]=qs[_0x1302('0x48')](_0x275013[_0x1302('0x3e')][_0x1302('0x48')]);_0x379baa['where']=qs[_0x1302('0x40')](_[_0x1302('0x49')](_0x275013['query'],_0x11129a[_0x1302('0x40')]),_0x2600bd);if(_0x275013[_0x1302('0x3e')]['filter']){_0x379baa[_0x1302('0x4a')]=_[_0x1302('0x4b')](_0x379baa[_0x1302('0x4a')],{'$or':_['map'](_0x2600bd,function(_0x53b04a){if(_0x53b04a[_0x1302('0x3b')]!==_0x1302('0x4c')){var _0x5ab774={};_0x5ab774[_0x53b04a['name']]={'$like':'%'+_0x275013[_0x1302('0x3e')][_0x1302('0x4d')]+'%'};return _0x5ab774;}})});}_0x379baa=_[_0x1302('0x4b')]({},_0x379baa,_0x275013[_0x1302('0x4e')]);var _0x579b1c={'where':_0x379baa['where']};return db[_0x1302('0x39')][_0x1302('0x2b')](_0x579b1c)[_0x1302('0x32')](function(_0xbe5b0f){_0x5b44c1[_0x1302('0x2b')]=_0xbe5b0f;if(_0x275013[_0x1302('0x3e')][_0x1302('0x4f')]){_0x379baa[_0x1302('0x50')]=[{'all':!![]}];}return db['Setting'][_0x1302('0x51')](_0x379baa);})[_0x1302('0x32')](function(_0x22cd67){_0x5b44c1[_0x1302('0x52')]=_0x22cd67;return _0x5b44c1;})[_0x1302('0x32')](respondWithFilteredResult(_0xabea7c,_0x379baa))[_0x1302('0x24')](handleError(_0xabea7c,null));};exports[_0x1302('0x53')]=function(_0x14b964,_0x202e03){var _0xba9808={'raw':![],'where':{'id':_0x14b964[_0x1302('0x54')]['id']}},_0x2c51b0={};_0x2c51b0[_0x1302('0x3d')]=_[_0x1302('0x3f')](db[_0x1302('0x39')][_0x1302('0x55')]);_0x2c51b0['query']=_['keys'](_0x14b964['query']);_0x2c51b0[_0x1302('0x40')]=_[_0x1302('0x41')](_0x2c51b0['model'],_0x2c51b0[_0x1302('0x3e')]);_0xba9808[_0x1302('0x42')]=_[_0x1302('0x41')](_0x2c51b0[_0x1302('0x3d')],qs[_0x1302('0x43')](_0x14b964['query'][_0x1302('0x43')]));_0xba9808[_0x1302('0x42')]=_0xba9808['attributes'][_0x1302('0x44')]?_0xba9808[_0x1302('0x42')]:_0x2c51b0[_0x1302('0x3d')];if(_0x14b964['query']['includeAll']){_0xba9808[_0x1302('0x50')]=[{'all':!![]}];}_0xba9808=_[_0x1302('0x4b')]({},_0xba9808,_0x14b964[_0x1302('0x4e')]);return db[_0x1302('0x39')]['find'](_0xba9808)['then'](handleEntityNotFound(_0x202e03,null))[_0x1302('0x32')](respondWithResult(_0x202e03,null))['catch'](handleError(_0x202e03,null));};exports[_0x1302('0x31')]=function(_0x6fad4c,_0x49f2ce){if(_0x6fad4c['body']['id']){delete _0x6fad4c[_0x1302('0x56')]['id'];}return db['Setting'][_0x1302('0x57')]({'where':{'id':_0x6fad4c['params']['id']}})[_0x1302('0x32')](handleEntityNotFound(_0x49f2ce,null))[_0x1302('0x32')](saveUpdates(_0x6fad4c[_0x1302('0x56')],null))['then'](respondWithResult(_0x49f2ce,null))[_0x1302('0x24')](handleError(_0x49f2ce,null));};exports['addLogo']=function(_0x3492ed,_0x4063d7,_0x51be10){if(_0x3492ed[_0x1302('0x58')]&&_0x3492ed[_0x1302('0x58')][_0x1302('0x59')]){_0x3492ed[_0x1302('0x56')][_0x1302('0x5a')]=_0x3492ed[_0x1302('0x58')][_0x1302('0x59')];}return db[_0x1302('0x39')][_0x1302('0x57')]({'where':{'id':_0x3492ed['params']['id']}})[_0x1302('0x32')](handleEntityNotFound(_0x4063d7,null))[_0x1302('0x32')](saveUpdates(_0x3492ed['body'],null))[_0x1302('0x32')](respondWithResult(_0x4063d7,null))[_0x1302('0x24')](handleError(_0x4063d7,null));};exports[_0x1302('0x5b')]=function(_0x5cf679,_0x454ba3,_0x4489d5){if(_0x5cf679[_0x1302('0x58')]&&_0x5cf679[_0x1302('0x58')]['filename']){_0x5cf679[_0x1302('0x56')][_0x1302('0x5c')]=_0x5cf679[_0x1302('0x58')][_0x1302('0x59')];}return db[_0x1302('0x39')][_0x1302('0x57')]({'where':{'id':_0x5cf679[_0x1302('0x54')]['id']}})[_0x1302('0x32')](handleEntityNotFound(_0x454ba3,null))[_0x1302('0x32')](saveUpdates(_0x5cf679[_0x1302('0x56')],null))[_0x1302('0x32')](respondWithResult(_0x454ba3,null))[_0x1302('0x24')](handleError(_0x454ba3,null));};var utilLicense=require(_0x1302('0x17'));exports[_0x1302('0x5d')]=function(_0x274e11,_0x5845eb,_0x484eea){var _0x5f18c6=_0x1302('0x5e');var _0x505ccf={'custom':![]};return utilLicense[_0x1302('0x5f')]()[_0x1302('0x32')](function(_0x4544b9){if(_0x4544b9){_0x505ccf=_0x4544b9;}return db['Setting'][_0x1302('0x57')]({'where':{'id':_0x274e11[_0x1302('0x54')]['id']},'attributes':['logo',_0x1302('0x5c'),_0x1302('0x60'),_0x1302('0x61'),'defaultLogo',_0x1302('0x62'),_0x1302('0x63'),_0x1302('0x64')],'raw':!![]});})[_0x1302('0x32')](handleEntityNotFound(_0x5845eb,null))[_0x1302('0x32')](function(_0x9f5d9a){if(_0x9f5d9a){var _0x48a002=_0x9f5d9a['logo']&&fs['existsSync'](path['join'](config['root'],_0x5f18c6,_[_0x1302('0x65')](_0x9f5d9a[_0x1302('0x5a')])))?path['join'](config['root'],_0x5f18c6,_[_0x1302('0x65')](_0x9f5d9a['logo'])):path[_0x1302('0x66')](config[_0x1302('0x67')],_0x5f18c6,_[_0x1302('0x65')]('default_logo.svg'));var _0x4e1e28=_0x1302('0x68')+_[_0x1302('0x69')](_0x1302('0x5a'));if(_0x9f5d9a[_0x4e1e28]||!_0x505ccf[_0x1302('0x6a')]){_0x48a002=path[_0x1302('0x66')](config[_0x1302('0x67')],_0x5f18c6,_[_0x1302('0x65')](_0x1302('0x6b')));}if(!fs[_0x1302('0x6c')](_0x48a002)){throw new db['Sequelize']['ValidationError'](_[_0x1302('0x69')](_0x1302('0x5a'))+_0x1302('0x6d'));}return _0x5845eb[_0x1302('0x6e')](_0x48a002);}})['catch'](handleError(_0x5845eb,null));};var utilLicense=require(_0x1302('0x17'));exports[_0x1302('0x6f')]=function(_0x11ffa9,_0x1fd081,_0x1b576d){var _0x2c89ae=_0x1302('0x5e');var _0x55fb7a={'custom':![]};return utilLicense['getLicense']()[_0x1302('0x32')](function(_0x521504){if(_0x521504){_0x55fb7a=_0x521504;}return db['Setting'][_0x1302('0x57')]({'where':{'id':_0x11ffa9[_0x1302('0x54')]['id']},'attributes':[_0x1302('0x5a'),'loginLogo','preferred',_0x1302('0x61'),_0x1302('0x70'),'defaultLoginLogo','defaultPreferred',_0x1302('0x64')],'raw':!![]});})['then'](handleEntityNotFound(_0x1fd081,null))[_0x1302('0x32')](function(_0x31fb71){if(_0x31fb71){var _0x1a187d=_0x31fb71[_0x1302('0x5c')]&&fs[_0x1302('0x6c')](path[_0x1302('0x66')](config['root'],_0x2c89ae,_['toLower'](_0x31fb71[_0x1302('0x5c')])))?path[_0x1302('0x66')](config[_0x1302('0x67')],_0x2c89ae,_[_0x1302('0x65')](_0x31fb71[_0x1302('0x5c')])):path[_0x1302('0x66')](config[_0x1302('0x67')],_0x2c89ae,_['toLower'](_0x1302('0x71')));var _0x1a1824=_0x1302('0x68')+_[_0x1302('0x69')](_0x1302('0x5c'));if(_0x31fb71[_0x1a1824]||!_0x55fb7a[_0x1302('0x6a')]){_0x1a187d=path[_0x1302('0x66')](config[_0x1302('0x67')],_0x2c89ae,_[_0x1302('0x65')](_0x1302('0x71')));}if(!fs[_0x1302('0x6c')](_0x1a187d)){throw new db['Sequelize'][(_0x1302('0x72'))](_[_0x1302('0x69')](_0x1302('0x5c'))+_0x1302('0x6d'));}return _0x1fd081[_0x1302('0x6e')](_0x1a187d);}})[_0x1302('0x24')](handleError(_0x1fd081,null));};exports[_0x1302('0x73')]=function(_0x2bb2a7,_0xb30098){return db[_0x1302('0x39')]['find']({'where':{'id':_0x2bb2a7['params']['id']},'attributes':['securePassword']})[_0x1302('0x32')](respondWithResult(_0xb30098,null))[_0x1302('0x24')](handleError(_0xb30098,null));};exports['addPreferred']=function(_0x5be0a9,_0x2de86a,_0x203a03){if(_0x5be0a9[_0x1302('0x58')]&&_0x5be0a9[_0x1302('0x58')][_0x1302('0x59')]){_0x5be0a9[_0x1302('0x56')][_0x1302('0x60')]=_0x5be0a9[_0x1302('0x58')]['filename'];}return db[_0x1302('0x39')][_0x1302('0x57')]({'where':{'id':_0x5be0a9['params']['id']}})[_0x1302('0x32')](handleEntityNotFound(_0x2de86a,null))['then'](saveUpdates(_0x5be0a9['body'],null))[_0x1302('0x32')](respondWithResult(_0x2de86a,null))['catch'](handleError(_0x2de86a,null));};var utilLicense=require(_0x1302('0x17'));exports[_0x1302('0x74')]=function(_0x2b9d8f,_0x7ee785,_0x345afa){var _0x4597e9=_0x1302('0x5e');var _0x5d8af4={'custom':![]};return utilLicense[_0x1302('0x5f')]()[_0x1302('0x32')](function(_0x28fa58){if(_0x28fa58){_0x5d8af4=_0x28fa58;}return db[_0x1302('0x39')][_0x1302('0x57')]({'where':{'id':_0x2b9d8f[_0x1302('0x54')]['id']},'attributes':[_0x1302('0x5a'),_0x1302('0x5c'),_0x1302('0x60'),_0x1302('0x61'),_0x1302('0x70'),_0x1302('0x62'),_0x1302('0x63'),_0x1302('0x64')],'raw':!![]});})['then'](handleEntityNotFound(_0x7ee785,null))[_0x1302('0x32')](function(_0x2b856b){if(_0x2b856b){var _0x5706c2=_0x2b856b[_0x1302('0x60')]&&fs['existsSync'](path['join'](config['root'],_0x4597e9,_['toLower'](_0x2b856b[_0x1302('0x60')])))?path['join'](config[_0x1302('0x67')],_0x4597e9,_['toLower'](_0x2b856b[_0x1302('0x60')])):path['join'](config['root'],_0x4597e9,_[_0x1302('0x65')]('default_preferred.png'));var _0x331a67=_0x1302('0x68')+_[_0x1302('0x69')]('preferred');if(_0x2b856b[_0x331a67]||!_0x5d8af4[_0x1302('0x6a')]||!_0x5d8af4[_0x1302('0x60')]){_0x5706c2=path[_0x1302('0x66')](config[_0x1302('0x67')],_0x4597e9,_['toLower']('default_preferred.png'));}if(!fs[_0x1302('0x6c')](_0x5706c2)){throw new db['Sequelize'][(_0x1302('0x72'))](_[_0x1302('0x69')](_0x1302('0x60'))+_0x1302('0x6d'));}return _0x7ee785[_0x1302('0x6e')](_0x5706c2);}})[_0x1302('0x24')](handleError(_0x7ee785,null));};exports[_0x1302('0x75')]=function(_0x4724eb,_0x15bfc5,_0x4b777d){if(_0x4724eb[_0x1302('0x58')]&&_0x4724eb['file'][_0x1302('0x59')]){_0x4724eb[_0x1302('0x56')][_0x1302('0x61')]=_0x4724eb['file']['filename'];}return db[_0x1302('0x39')][_0x1302('0x57')]({'where':{'id':_0x4724eb[_0x1302('0x54')]['id']}})['then'](handleEntityNotFound(_0x15bfc5,null))[_0x1302('0x32')](saveUpdates(_0x4724eb['body'],null))[_0x1302('0x32')](respondWithResult(_0x15bfc5,null))['catch'](handleError(_0x15bfc5,null));};var utilLicense=require('../../config/license/util');exports[_0x1302('0x76')]=function(_0x5bb2c0,_0x58061f,_0x4e66a6){var _0x1d9b6f=_0x1302('0x5e');var _0x5576e6={'custom':![]};return utilLicense['getLicense']()[_0x1302('0x32')](function(_0x4327bf){if(_0x4327bf){_0x5576e6=_0x4327bf;}return db['Setting'][_0x1302('0x57')]({'where':{'id':_0x5bb2c0['params']['id']},'attributes':[_0x1302('0x5a'),_0x1302('0x5c'),_0x1302('0x60'),_0x1302('0x61'),'defaultLogo',_0x1302('0x62'),_0x1302('0x63'),_0x1302('0x64')],'raw':!![]});})[_0x1302('0x32')](handleEntityNotFound(_0x58061f,null))[_0x1302('0x32')](function(_0x2157b1){if(_0x2157b1){var _0x12b4e3=_0x2157b1[_0x1302('0x61')]&&fs[_0x1302('0x6c')](path[_0x1302('0x66')](config[_0x1302('0x67')],_0x1d9b6f,_[_0x1302('0x65')](_0x2157b1['favicon'])))?path['join'](config[_0x1302('0x67')],_0x1d9b6f,_[_0x1302('0x65')](_0x2157b1[_0x1302('0x61')])):path['join'](config[_0x1302('0x67')],_0x1d9b6f,_[_0x1302('0x65')]('default_favicon.ico'));var _0x5ec3be='default'+_['upperFirst']('favicon');if(_0x2157b1[_0x5ec3be]||!_0x5576e6[_0x1302('0x6a')]){_0x12b4e3=path['join'](config[_0x1302('0x67')],_0x1d9b6f,_[_0x1302('0x65')]('default_favicon.ico'));}if(!fs[_0x1302('0x6c')](_0x12b4e3)){throw new db[(_0x1302('0x77'))][(_0x1302('0x72'))](_['upperFirst'](_0x1302('0x61'))+_0x1302('0x6d'));}return _0x58061f[_0x1302('0x6e')](_0x12b4e3);}})['catch'](handleError(_0x58061f,null));};exports[_0x1302('0x78')]=function(_0x589a15,_0x3a1757){var _0x2a3b43={'offset':moment()[_0x1302('0x79')]()};_0x2a3b43[_0x1302('0x7a')]=moment()[_0x1302('0x79')](_0x2a3b43['offset'])['format'](_0x1302('0x7b'));return _0x3a1757['status'](0xc8)[_0x1302('0x36')](_0x2a3b43);}; \ No newline at end of file +var _0x76cd=['set','Content-Range','apply','reject','update','destroy','sendStatus','name','send','index','map','rawAttributes','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','Setting','findAll','show','params','keys','find','body','addLogo','file','filename','logo','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','existsSync','join','root','toLower','default_logo.svg','upperFirst','custom','Sequelize','\x20not\x20found','download','getLogoLogin','defaultPreferred','defaultFavicon','default_loginLogo.svg','default','ValidationError','gdpr','securePassword','addPreferred','default_preferred.png','addFavicon','getFavicon','getDate','utcOffset','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','undefined','limit','offset','count'];(function(_0x2a9a60,_0x122aeb){var _0x4cb84d=function(_0x573874){while(--_0x573874){_0x2a9a60['push'](_0x2a9a60['shift']());}};_0x4cb84d(++_0x122aeb);}(_0x76cd,0x1b7));var _0xd76c=function(_0x15ad23,_0x2d858f){_0x15ad23=_0x15ad23-0x0;var _0x1f538c=_0x76cd[_0x15ad23];return _0x1f538c;};'use strict';var emlformat=require(_0xd76c('0x0'));var rimraf=require(_0xd76c('0x1'));var zipdir=require(_0xd76c('0x2'));var jsonpatch=require(_0xd76c('0x3'));var rp=require(_0xd76c('0x4'));var moment=require(_0xd76c('0x5'));var BPromise=require(_0xd76c('0x6'));var Mustache=require(_0xd76c('0x7'));var util=require(_0xd76c('0x8'));var path=require(_0xd76c('0x9'));var sox=require(_0xd76c('0xa'));var csv=require('to-csv');var ejs=require(_0xd76c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd76c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd76c('0xd'));var deskjs=require(_0xd76c('0xe'));var toCsv=require(_0xd76c('0xf'));var querystring=require('querystring');var Papa=require(_0xd76c('0x10'));var Redis=require(_0xd76c('0x11'));var authService=require(_0xd76c('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd76c('0x13'));var logger=require(_0xd76c('0x14'))('api');var utils=require(_0xd76c('0x15'));var config=require(_0xd76c('0x16'));var licenseUtil=require(_0xd76c('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xd76c('0x18')][_0xd76c('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x366311,_0x107d14,_0x340175,_0x26a194){return new BPromise(function(_0x16e81b,_0x478e3f){var _0x41bed3=_0x26a194||client;return _0x41bed3[_0xd76c('0x1a')](_0x366311,_0x340175)[_0xd76c('0x1b')](function(_0x2b235b){logger[_0xd76c('0x1c')](_0xd76c('0x1d'),_0x107d14,_0xd76c('0x1e'));logger[_0xd76c('0x1f')](_0xd76c('0x20'),_0x107d14,_0xd76c('0x1e'),JSON[_0xd76c('0x21')](_0x2b235b));if(_0x2b235b['error']){if(_0x2b235b[_0xd76c('0x22')]['code']===0x1f4){logger[_0xd76c('0x22')]('Setting,\x20%s,\x20%s',_0x107d14,_0x2b235b[_0xd76c('0x22')][_0xd76c('0x23')]);return _0x478e3f(_0x2b235b[_0xd76c('0x22')][_0xd76c('0x23')]);}logger['error'](_0xd76c('0x1d'),_0x107d14,_0x2b235b['error']['message']);return _0x16e81b(_0x2b235b[_0xd76c('0x22')][_0xd76c('0x23')]);}else{logger[_0xd76c('0x1c')](_0xd76c('0x1d'),_0x107d14,_0xd76c('0x1e'));_0x16e81b(_0x2b235b[_0xd76c('0x24')][_0xd76c('0x23')]);}})[_0xd76c('0x25')](function(_0x58c76b){logger[_0xd76c('0x22')](_0xd76c('0x1d'),_0x107d14,_0x58c76b);_0x478e3f(_0x58c76b);});});}function respondWithStatusCode(_0xb3c607,_0x2d9dc3){_0x2d9dc3=_0x2d9dc3||0xcc;return function(_0x20ce6c){if(_0x20ce6c){return _0xb3c607['sendStatus'](_0x2d9dc3);}return _0xb3c607[_0xd76c('0x26')](_0x2d9dc3)[_0xd76c('0x27')]();};}function respondWithResult(_0x48e49e,_0x112f8c){_0x112f8c=_0x112f8c||0xc8;return function(_0x273ece){if(_0x273ece){return _0x48e49e['status'](_0x112f8c)[_0xd76c('0x28')](_0x273ece);}};}function respondWithFilteredResult(_0x2ab6e1,_0x13e1a8){return function(_0x1fd771){if(_0x1fd771){var _0x37ee24=typeof _0x13e1a8['offset']===_0xd76c('0x29')&&typeof _0x13e1a8[_0xd76c('0x2a')]===_0xd76c('0x29');var _0x1bd1b6=_0x1fd771['count'];var _0x1d7729=_0x37ee24?0x0:_0x13e1a8[_0xd76c('0x2b')];var _0x382b4c=_0x37ee24?_0x1fd771[_0xd76c('0x2c')]:_0x13e1a8['offset']+_0x13e1a8[_0xd76c('0x2a')];var _0x1db641;if(_0x382b4c>=_0x1bd1b6){_0x382b4c=_0x1bd1b6;_0x1db641=0xc8;}else{_0x1db641=0xce;}_0x2ab6e1['status'](_0x1db641);return _0x2ab6e1[_0xd76c('0x2d')](_0xd76c('0x2e'),_0x1d7729+'-'+_0x382b4c+'/'+_0x1bd1b6)[_0xd76c('0x28')](_0x1fd771);}return null;};}function patchUpdates(_0xa5a529){return function(_0x2f7ef2){try{jsonpatch[_0xd76c('0x2f')](_0x2f7ef2,_0xa5a529,!![]);}catch(_0x18aa8d){return BPromise[_0xd76c('0x30')](_0x18aa8d);}return _0x2f7ef2['save']();};}function saveUpdates(_0x514b09,_0x7a5479){return function(_0x553e33){if(_0x553e33){return _0x553e33[_0xd76c('0x31')](_0x514b09)[_0xd76c('0x1b')](function(_0x3ce046){return _0x3ce046;});}return null;};}function removeEntity(_0x471891,_0x18fb74){return function(_0x12617b){if(_0x12617b){return _0x12617b[_0xd76c('0x32')]()['then'](function(){_0x471891[_0xd76c('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1939dc,_0x446463){return function(_0x14c768){if(!_0x14c768){_0x1939dc[_0xd76c('0x33')](0x194);}return _0x14c768;};}function handleError(_0x48a3a8,_0x57f058){_0x57f058=_0x57f058||0x1f4;return function(_0x491cb8){logger[_0xd76c('0x22')](_0x491cb8['stack']);if(_0x491cb8[_0xd76c('0x34')]){delete _0x491cb8[_0xd76c('0x34')];}_0x48a3a8['status'](_0x57f058)[_0xd76c('0x35')](_0x491cb8);};}exports[_0xd76c('0x36')]=function(_0x2abcb6,_0x526b83){var _0x209a84={},_0x4de1fc={},_0x43fd0b={'count':0x0,'rows':[]};var _0x54b32a=_[_0xd76c('0x37')](db['Setting'][_0xd76c('0x38')],function(_0x321037){return{'name':_0x321037['fieldName'],'type':_0x321037[_0xd76c('0x39')][_0xd76c('0x3a')]};});_0x4de1fc[_0xd76c('0x3b')]=_['map'](_0x54b32a,'name');_0x4de1fc['query']=_['keys'](_0x2abcb6[_0xd76c('0x3c')]);_0x4de1fc['filters']=_[_0xd76c('0x3d')](_0x4de1fc[_0xd76c('0x3b')],_0x4de1fc['query']);_0x209a84['attributes']=_[_0xd76c('0x3d')](_0x4de1fc[_0xd76c('0x3b')],qs[_0xd76c('0x3e')](_0x2abcb6[_0xd76c('0x3c')][_0xd76c('0x3e')]));_0x209a84[_0xd76c('0x3f')]=_0x209a84[_0xd76c('0x3f')][_0xd76c('0x40')]?_0x209a84['attributes']:_0x4de1fc[_0xd76c('0x3b')];if(!_0x2abcb6['query']['hasOwnProperty'](_0xd76c('0x41'))){_0x209a84[_0xd76c('0x2a')]=qs['limit'](_0x2abcb6[_0xd76c('0x3c')]['limit']);_0x209a84[_0xd76c('0x2b')]=qs[_0xd76c('0x2b')](_0x2abcb6[_0xd76c('0x3c')][_0xd76c('0x2b')]);}_0x209a84[_0xd76c('0x42')]=qs[_0xd76c('0x43')](_0x2abcb6[_0xd76c('0x3c')]['sort']);_0x209a84[_0xd76c('0x44')]=qs[_0xd76c('0x45')](_[_0xd76c('0x46')](_0x2abcb6['query'],_0x4de1fc[_0xd76c('0x45')]),_0x54b32a);if(_0x2abcb6[_0xd76c('0x3c')]['filter']){_0x209a84[_0xd76c('0x44')]=_[_0xd76c('0x47')](_0x209a84[_0xd76c('0x44')],{'$or':_[_0xd76c('0x37')](_0x54b32a,function(_0x2b2f2a){if(_0x2b2f2a[_0xd76c('0x39')]!==_0xd76c('0x48')){var _0xbf5cb3={};_0xbf5cb3[_0x2b2f2a[_0xd76c('0x34')]]={'$like':'%'+_0x2abcb6[_0xd76c('0x3c')][_0xd76c('0x49')]+'%'};return _0xbf5cb3;}})});}_0x209a84=_['merge']({},_0x209a84,_0x2abcb6[_0xd76c('0x4a')]);var _0x35e1a5={'where':_0x209a84[_0xd76c('0x44')]};return db['Setting'][_0xd76c('0x2c')](_0x35e1a5)[_0xd76c('0x1b')](function(_0x480afe){_0x43fd0b[_0xd76c('0x2c')]=_0x480afe;if(_0x2abcb6[_0xd76c('0x3c')][_0xd76c('0x4b')]){_0x209a84[_0xd76c('0x4c')]=[{'all':!![]}];}return db[_0xd76c('0x4d')][_0xd76c('0x4e')](_0x209a84);})[_0xd76c('0x1b')](function(_0x33d633){_0x43fd0b['rows']=_0x33d633;return _0x43fd0b;})[_0xd76c('0x1b')](respondWithFilteredResult(_0x526b83,_0x209a84))['catch'](handleError(_0x526b83,null));};exports[_0xd76c('0x4f')]=function(_0x164031,_0x50e1bf){var _0x507f9b={'raw':![],'where':{'id':_0x164031[_0xd76c('0x50')]['id']}},_0x242028={};_0x242028[_0xd76c('0x3b')]=_[_0xd76c('0x51')](db['Setting'][_0xd76c('0x38')]);_0x242028[_0xd76c('0x3c')]=_[_0xd76c('0x51')](_0x164031[_0xd76c('0x3c')]);_0x242028['filters']=_[_0xd76c('0x3d')](_0x242028[_0xd76c('0x3b')],_0x242028[_0xd76c('0x3c')]);_0x507f9b[_0xd76c('0x3f')]=_[_0xd76c('0x3d')](_0x242028[_0xd76c('0x3b')],qs['fields'](_0x164031['query'][_0xd76c('0x3e')]));_0x507f9b[_0xd76c('0x3f')]=_0x507f9b[_0xd76c('0x3f')]['length']?_0x507f9b[_0xd76c('0x3f')]:_0x242028[_0xd76c('0x3b')];if(_0x164031[_0xd76c('0x3c')][_0xd76c('0x4b')]){_0x507f9b['include']=[{'all':!![]}];}_0x507f9b=_[_0xd76c('0x47')]({},_0x507f9b,_0x164031['options']);return db[_0xd76c('0x4d')][_0xd76c('0x52')](_0x507f9b)[_0xd76c('0x1b')](handleEntityNotFound(_0x50e1bf,null))['then'](respondWithResult(_0x50e1bf,null))[_0xd76c('0x25')](handleError(_0x50e1bf,null));};exports[_0xd76c('0x31')]=function(_0x96c444,_0x479ab6){if(_0x96c444[_0xd76c('0x53')]['id']){delete _0x96c444[_0xd76c('0x53')]['id'];}return db[_0xd76c('0x4d')][_0xd76c('0x52')]({'where':{'id':_0x96c444[_0xd76c('0x50')]['id']}})['then'](handleEntityNotFound(_0x479ab6,null))[_0xd76c('0x1b')](saveUpdates(_0x96c444['body'],null))[_0xd76c('0x1b')](respondWithResult(_0x479ab6,null))[_0xd76c('0x25')](handleError(_0x479ab6,null));};exports[_0xd76c('0x54')]=function(_0x4513fe,_0x2c4d86,_0x2be1f8){if(_0x4513fe[_0xd76c('0x55')]&&_0x4513fe[_0xd76c('0x55')][_0xd76c('0x56')]){_0x4513fe[_0xd76c('0x53')][_0xd76c('0x57')]=_0x4513fe['file']['filename'];}return db[_0xd76c('0x4d')][_0xd76c('0x52')]({'where':{'id':_0x4513fe['params']['id']}})[_0xd76c('0x1b')](handleEntityNotFound(_0x2c4d86,null))['then'](saveUpdates(_0x4513fe[_0xd76c('0x53')],null))[_0xd76c('0x1b')](respondWithResult(_0x2c4d86,null))['catch'](handleError(_0x2c4d86,null));};exports['addLogoLogin']=function(_0x2909a5,_0x2259d4,_0x55e0f2){if(_0x2909a5['file']&&_0x2909a5[_0xd76c('0x55')][_0xd76c('0x56')]){_0x2909a5[_0xd76c('0x53')][_0xd76c('0x58')]=_0x2909a5[_0xd76c('0x55')][_0xd76c('0x56')];}return db['Setting'][_0xd76c('0x52')]({'where':{'id':_0x2909a5['params']['id']}})[_0xd76c('0x1b')](handleEntityNotFound(_0x2259d4,null))['then'](saveUpdates(_0x2909a5[_0xd76c('0x53')],null))[_0xd76c('0x1b')](respondWithResult(_0x2259d4,null))[_0xd76c('0x25')](handleError(_0x2259d4,null));};var utilLicense=require(_0xd76c('0x17'));exports[_0xd76c('0x59')]=function(_0x5cc3ac,_0x56ac79,_0x507e6a){var _0x60276=_0xd76c('0x5a');var _0x4d4968={'custom':![]};return utilLicense[_0xd76c('0x5b')]()[_0xd76c('0x1b')](function(_0x5b2c9d){if(_0x5b2c9d){_0x4d4968=_0x5b2c9d;}return db[_0xd76c('0x4d')][_0xd76c('0x52')]({'where':{'id':_0x5cc3ac[_0xd76c('0x50')]['id']},'attributes':[_0xd76c('0x57'),_0xd76c('0x58'),_0xd76c('0x5c'),_0xd76c('0x5d'),_0xd76c('0x5e'),_0xd76c('0x5f'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xd76c('0x1b')](handleEntityNotFound(_0x56ac79,null))[_0xd76c('0x1b')](function(_0x409eb3){if(_0x409eb3){var _0x4079a0=_0x409eb3[_0xd76c('0x57')]&&fs[_0xd76c('0x60')](path[_0xd76c('0x61')](config[_0xd76c('0x62')],_0x60276,_[_0xd76c('0x63')](_0x409eb3[_0xd76c('0x57')])))?path[_0xd76c('0x61')](config[_0xd76c('0x62')],_0x60276,_[_0xd76c('0x63')](_0x409eb3['logo'])):path[_0xd76c('0x61')](config[_0xd76c('0x62')],_0x60276,_[_0xd76c('0x63')](_0xd76c('0x64')));var _0x16fb1b='default'+_[_0xd76c('0x65')](_0xd76c('0x57'));if(_0x409eb3[_0x16fb1b]||!_0x4d4968[_0xd76c('0x66')]){_0x4079a0=path[_0xd76c('0x61')](config[_0xd76c('0x62')],_0x60276,_[_0xd76c('0x63')](_0xd76c('0x64')));}if(!fs['existsSync'](_0x4079a0)){throw new db[(_0xd76c('0x67'))]['ValidationError'](_[_0xd76c('0x65')](_0xd76c('0x57'))+_0xd76c('0x68'));}return _0x56ac79[_0xd76c('0x69')](_0x4079a0);}})['catch'](handleError(_0x56ac79,null));};var utilLicense=require('../../config/license/util');exports[_0xd76c('0x6a')]=function(_0x4e93b8,_0x15bcba,_0x5c6a19){var _0x73176a=_0xd76c('0x5a');var _0x42e38e={'custom':![]};return utilLicense['getLicense']()[_0xd76c('0x1b')](function(_0x2b420b){if(_0x2b420b){_0x42e38e=_0x2b420b;}return db[_0xd76c('0x4d')][_0xd76c('0x52')]({'where':{'id':_0x4e93b8[_0xd76c('0x50')]['id']},'attributes':[_0xd76c('0x57'),_0xd76c('0x58'),_0xd76c('0x5c'),_0xd76c('0x5d'),_0xd76c('0x5e'),'defaultLoginLogo',_0xd76c('0x6b'),_0xd76c('0x6c')],'raw':!![]});})[_0xd76c('0x1b')](handleEntityNotFound(_0x15bcba,null))['then'](function(_0x4b749b){if(_0x4b749b){var _0x561f41=_0x4b749b['loginLogo']&&fs[_0xd76c('0x60')](path[_0xd76c('0x61')](config[_0xd76c('0x62')],_0x73176a,_[_0xd76c('0x63')](_0x4b749b[_0xd76c('0x58')])))?path[_0xd76c('0x61')](config['root'],_0x73176a,_[_0xd76c('0x63')](_0x4b749b[_0xd76c('0x58')])):path[_0xd76c('0x61')](config[_0xd76c('0x62')],_0x73176a,_[_0xd76c('0x63')](_0xd76c('0x6d')));var _0x365412=_0xd76c('0x6e')+_[_0xd76c('0x65')]('loginLogo');if(_0x4b749b[_0x365412]||!_0x42e38e[_0xd76c('0x66')]){_0x561f41=path[_0xd76c('0x61')](config[_0xd76c('0x62')],_0x73176a,_[_0xd76c('0x63')](_0xd76c('0x6d')));}if(!fs[_0xd76c('0x60')](_0x561f41)){throw new db[(_0xd76c('0x67'))][(_0xd76c('0x6f'))](_[_0xd76c('0x65')]('loginLogo')+'\x20not\x20found');}return _0x15bcba['download'](_0x561f41);}})[_0xd76c('0x25')](handleError(_0x15bcba,null));};exports[_0xd76c('0x70')]=function(_0x4c4467,_0x54eaf8){return db[_0xd76c('0x4d')][_0xd76c('0x52')]({'where':{'id':_0x4c4467[_0xd76c('0x50')]['id']},'attributes':[_0xd76c('0x71')]})[_0xd76c('0x1b')](respondWithResult(_0x54eaf8,null))[_0xd76c('0x25')](handleError(_0x54eaf8,null));};exports[_0xd76c('0x72')]=function(_0x80940b,_0x5738d0,_0x2d208e){if(_0x80940b[_0xd76c('0x55')]&&_0x80940b[_0xd76c('0x55')][_0xd76c('0x56')]){_0x80940b[_0xd76c('0x53')][_0xd76c('0x5c')]=_0x80940b[_0xd76c('0x55')][_0xd76c('0x56')];}return db['Setting']['find']({'where':{'id':_0x80940b[_0xd76c('0x50')]['id']}})['then'](handleEntityNotFound(_0x5738d0,null))[_0xd76c('0x1b')](saveUpdates(_0x80940b[_0xd76c('0x53')],null))[_0xd76c('0x1b')](respondWithResult(_0x5738d0,null))[_0xd76c('0x25')](handleError(_0x5738d0,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x1d07f4,_0x4fa79d,_0x304a17){var _0x49ee2e=_0xd76c('0x5a');var _0x213a48={'custom':![]};return utilLicense[_0xd76c('0x5b')]()[_0xd76c('0x1b')](function(_0x4c0b5e){if(_0x4c0b5e){_0x213a48=_0x4c0b5e;}return db[_0xd76c('0x4d')][_0xd76c('0x52')]({'where':{'id':_0x1d07f4[_0xd76c('0x50')]['id']},'attributes':[_0xd76c('0x57'),'loginLogo',_0xd76c('0x5c'),_0xd76c('0x5d'),_0xd76c('0x5e'),_0xd76c('0x5f'),_0xd76c('0x6b'),_0xd76c('0x6c')],'raw':!![]});})['then'](handleEntityNotFound(_0x4fa79d,null))[_0xd76c('0x1b')](function(_0x2326c4){if(_0x2326c4){var _0x351278=_0x2326c4[_0xd76c('0x5c')]&&fs[_0xd76c('0x60')](path[_0xd76c('0x61')](config[_0xd76c('0x62')],_0x49ee2e,_['toLower'](_0x2326c4['preferred'])))?path[_0xd76c('0x61')](config[_0xd76c('0x62')],_0x49ee2e,_[_0xd76c('0x63')](_0x2326c4[_0xd76c('0x5c')])):path[_0xd76c('0x61')](config[_0xd76c('0x62')],_0x49ee2e,_['toLower'](_0xd76c('0x73')));var _0xfc0709=_0xd76c('0x6e')+_[_0xd76c('0x65')](_0xd76c('0x5c'));if(_0x2326c4[_0xfc0709]||!_0x213a48['custom']||!_0x213a48['preferred']){_0x351278=path['join'](config[_0xd76c('0x62')],_0x49ee2e,_[_0xd76c('0x63')](_0xd76c('0x73')));}if(!fs[_0xd76c('0x60')](_0x351278)){throw new db[(_0xd76c('0x67'))]['ValidationError'](_['upperFirst'](_0xd76c('0x5c'))+'\x20not\x20found');}return _0x4fa79d['download'](_0x351278);}})[_0xd76c('0x25')](handleError(_0x4fa79d,null));};exports[_0xd76c('0x74')]=function(_0x504a38,_0x3d6f48,_0xfe3d73){if(_0x504a38[_0xd76c('0x55')]&&_0x504a38[_0xd76c('0x55')][_0xd76c('0x56')]){_0x504a38[_0xd76c('0x53')][_0xd76c('0x5d')]=_0x504a38[_0xd76c('0x55')][_0xd76c('0x56')];}return db[_0xd76c('0x4d')][_0xd76c('0x52')]({'where':{'id':_0x504a38['params']['id']}})['then'](handleEntityNotFound(_0x3d6f48,null))[_0xd76c('0x1b')](saveUpdates(_0x504a38[_0xd76c('0x53')],null))[_0xd76c('0x1b')](respondWithResult(_0x3d6f48,null))['catch'](handleError(_0x3d6f48,null));};var utilLicense=require(_0xd76c('0x17'));exports[_0xd76c('0x75')]=function(_0x5f1ea1,_0x18fa8b,_0x1e3e2d){var _0x581ea1=_0xd76c('0x5a');var _0x5099f6={'custom':![]};return utilLicense[_0xd76c('0x5b')]()[_0xd76c('0x1b')](function(_0x2434ad){if(_0x2434ad){_0x5099f6=_0x2434ad;}return db['Setting'][_0xd76c('0x52')]({'where':{'id':_0x5f1ea1['params']['id']},'attributes':['logo',_0xd76c('0x58'),_0xd76c('0x5c'),_0xd76c('0x5d'),_0xd76c('0x5e'),'defaultLoginLogo',_0xd76c('0x6b'),_0xd76c('0x6c')],'raw':!![]});})[_0xd76c('0x1b')](handleEntityNotFound(_0x18fa8b,null))[_0xd76c('0x1b')](function(_0x19f6f1){if(_0x19f6f1){var _0x5c877c=_0x19f6f1[_0xd76c('0x5d')]&&fs[_0xd76c('0x60')](path['join'](config['root'],_0x581ea1,_['toLower'](_0x19f6f1[_0xd76c('0x5d')])))?path[_0xd76c('0x61')](config[_0xd76c('0x62')],_0x581ea1,_[_0xd76c('0x63')](_0x19f6f1['favicon'])):path[_0xd76c('0x61')](config['root'],_0x581ea1,_['toLower']('default_favicon.ico'));var _0x116132=_0xd76c('0x6e')+_[_0xd76c('0x65')](_0xd76c('0x5d'));if(_0x19f6f1[_0x116132]||!_0x5099f6[_0xd76c('0x66')]){_0x5c877c=path[_0xd76c('0x61')](config[_0xd76c('0x62')],_0x581ea1,_[_0xd76c('0x63')]('default_favicon.ico'));}if(!fs[_0xd76c('0x60')](_0x5c877c)){throw new db[(_0xd76c('0x67'))]['ValidationError'](_[_0xd76c('0x65')]('favicon')+_0xd76c('0x68'));}return _0x18fa8b[_0xd76c('0x69')](_0x5c877c);}})['catch'](handleError(_0x18fa8b,null));};exports[_0xd76c('0x76')]=function(_0x13de33,_0x3e7208){var _0x15032c={'offset':moment()[_0xd76c('0x77')]()};_0x15032c['now']=moment()['utcOffset'](_0x15032c[_0xd76c('0x2b')])[_0xd76c('0x78')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x3e7208[_0xd76c('0x26')](0xc8)[_0xd76c('0x35')](_0x15032c);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 258144e..26f6c09 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 _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x40d816,_0x2c6bce){var _0x1f96cc=function(_0x37d197){while(--_0x37d197){_0x40d816['push'](_0x40d816['shift']());}};_0x1f96cc(++_0x2c6bce);}(_0xe14b,0x93));var _0xbe14=function(_0x3d5bc4,_0x2551c7){_0x3d5bc4=_0x3d5bc4-0x0;var _0x1caf65=_0xe14b[_0x3d5bc4];return _0x1caf65;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x4b0084,_0x426306){var _0x36f1c2=function(_0x160d35){while(--_0x160d35){_0x4b0084['push'](_0x4b0084['shift']());}};_0x36f1c2(++_0x426306);}(_0xe14b,0x93));var _0xbe14=function(_0x58e2d0,_0x36aa5e){_0x58e2d0=_0x58e2d0-0x0;var _0x58761b=_0xe14b[_0x58e2d0];return _0x58761b;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 0da4687..3e676ee 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 _0x9d72=['result','catch','Setting','options','where','include','model','map','attributes','then','ShowSetting','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','request\x20sent'];(function(_0x418ae0,_0xb01efb){var _0x12c0a3=function(_0x4233b4){while(--_0x4233b4){_0x418ae0['push'](_0x418ae0['shift']());}};_0x12c0a3(++_0xb01efb);}(_0x9d72,0x1dc));var _0x29d7=function(_0x20a0fc,_0x517aa3){_0x20a0fc=_0x20a0fc-0x0;var _0x551f1d=_0x9d72[_0x20a0fc];return _0x551f1d;};'use strict';var _=require(_0x29d7('0x0'));var util=require('util');var moment=require(_0x29d7('0x1'));var BPromise=require(_0x29d7('0x2'));var rs=require(_0x29d7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x29d7('0x4'))['db'];var utils=require(_0x29d7('0x5'));var logger=require(_0x29d7('0x6'))(_0x29d7('0x7'));var config=require(_0x29d7('0x8'));var jayson=require(_0x29d7('0x9'));var client=jayson[_0x29d7('0xa')][_0x29d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe6ab28,_0x3f3096,_0x2058cf){return new BPromise(function(_0x297d32,_0x2c2dd6){return client['request'](_0xe6ab28,_0x2058cf)['then'](function(_0x26ac2f){logger[_0x29d7('0xc')]('Setting,\x20%s,\x20%s',_0x3f3096,'request\x20sent');logger['debug'](_0x29d7('0xd'),_0x3f3096,'request\x20sent',JSON[_0x29d7('0xe')](_0x26ac2f));if(_0x26ac2f[_0x29d7('0xf')]){if(_0x26ac2f[_0x29d7('0xf')][_0x29d7('0x10')]===0x1f4){logger['error'](_0x29d7('0x11'),_0x3f3096,_0x26ac2f[_0x29d7('0xf')][_0x29d7('0x12')]);return _0x2c2dd6(_0x26ac2f['error']['message']);}logger[_0x29d7('0xf')](_0x29d7('0x11'),_0x3f3096,_0x26ac2f[_0x29d7('0xf')][_0x29d7('0x12')]);return _0x297d32(_0x26ac2f['error']['message']);}else{logger[_0x29d7('0xc')](_0x29d7('0x11'),_0x3f3096,_0x29d7('0x13'));_0x297d32(_0x26ac2f[_0x29d7('0x14')]['message']);}})[_0x29d7('0x15')](function(_0x1b2ee3){logger[_0x29d7('0xf')]('Setting,\x20%s,\x20%s',_0x3f3096,_0x1b2ee3);_0x2c2dd6(_0x1b2ee3);});});}exports['ShowSetting']=function(_0x28859a){var _0x1c3f51=this;return new Promise(function(_0x552375,_0x353e28){return db[_0x29d7('0x16')]['find']({'raw':_0x28859a[_0x29d7('0x17')]?_0x28859a[_0x29d7('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x28859a[_0x29d7('0x17')]?_0x28859a['options'][_0x29d7('0x18')]||null:null,'attributes':_0x28859a[_0x29d7('0x17')]?_0x28859a[_0x29d7('0x17')]['attributes']||null:null,'include':_0x28859a['options']?_0x28859a[_0x29d7('0x17')][_0x29d7('0x19')]?_['map'](_0x28859a[_0x29d7('0x17')][_0x29d7('0x19')],function(_0x7a35cd){return{'model':db[_0x7a35cd[_0x29d7('0x1a')]],'as':_0x7a35cd['as'],'attributes':_0x7a35cd['attributes'],'include':_0x7a35cd['include']?_[_0x29d7('0x1b')](_0x7a35cd[_0x29d7('0x19')],function(_0xc90db1){return{'model':db[_0xc90db1[_0x29d7('0x1a')]],'as':_0xc90db1['as'],'attributes':_0xc90db1['attributes'],'include':_0xc90db1[_0x29d7('0x19')]?_['map'](_0xc90db1[_0x29d7('0x19')],function(_0x4f2251){return{'model':db[_0x4f2251['model']],'as':_0x4f2251['as'],'attributes':_0x4f2251[_0x29d7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x29d7('0x1d')](function(_0x34fc0e){logger['info'](_0x29d7('0x1e'),_0x28859a);logger['debug']('ShowSetting',_0x28859a,JSON[_0x29d7('0xe')](_0x34fc0e));_0x552375(_0x34fc0e);})[_0x29d7('0x15')](function(_0x56db1c){logger[_0x29d7('0xf')](_0x29d7('0x1e'),_0x56db1c[_0x29d7('0x12')],_0x28859a);_0x353e28(_0x1c3f51[_0x29d7('0xf')](0x1f4,_0x56db1c[_0x29d7('0x12')]));});});}; \ No newline at end of file +var _0xab84=['include','map','model','ShowSetting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Setting','find','options','raw','where','attributes'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xab84,0x1ee));var _0x4ab8=function(_0x360580,_0x3d0666){_0x360580=_0x360580-0x0;var _0x4f3b3a=_0xab84[_0x360580];return _0x4f3b3a;};'use strict';var _=require(_0x4ab8('0x0'));var util=require(_0x4ab8('0x1'));var moment=require(_0x4ab8('0x2'));var BPromise=require(_0x4ab8('0x3'));var rs=require(_0x4ab8('0x4'));var fs=require('fs');var Redis=require(_0x4ab8('0x5'));var db=require(_0x4ab8('0x6'))['db'];var utils=require(_0x4ab8('0x7'));var logger=require(_0x4ab8('0x8'))(_0x4ab8('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4ab8('0xa')][_0x4ab8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49fafc,_0x36032f,_0x1751e7){return new BPromise(function(_0x438fef,_0x58ed73){return client[_0x4ab8('0xc')](_0x49fafc,_0x1751e7)[_0x4ab8('0xd')](function(_0x5c6feb){logger[_0x4ab8('0xe')](_0x4ab8('0xf'),_0x36032f,_0x4ab8('0x10'));logger[_0x4ab8('0x11')](_0x4ab8('0x12'),_0x36032f,'request\x20sent',JSON[_0x4ab8('0x13')](_0x5c6feb));if(_0x5c6feb[_0x4ab8('0x14')]){if(_0x5c6feb[_0x4ab8('0x14')][_0x4ab8('0x15')]===0x1f4){logger['error'](_0x4ab8('0xf'),_0x36032f,_0x5c6feb[_0x4ab8('0x14')][_0x4ab8('0x16')]);return _0x58ed73(_0x5c6feb[_0x4ab8('0x14')][_0x4ab8('0x16')]);}logger[_0x4ab8('0x14')]('Setting,\x20%s,\x20%s',_0x36032f,_0x5c6feb[_0x4ab8('0x14')]['message']);return _0x438fef(_0x5c6feb[_0x4ab8('0x14')][_0x4ab8('0x16')]);}else{logger[_0x4ab8('0xe')](_0x4ab8('0xf'),_0x36032f,_0x4ab8('0x10'));_0x438fef(_0x5c6feb[_0x4ab8('0x17')][_0x4ab8('0x16')]);}})[_0x4ab8('0x18')](function(_0x345cf1){logger['error'](_0x4ab8('0xf'),_0x36032f,_0x345cf1);_0x58ed73(_0x345cf1);});});}exports['ShowSetting']=function(_0x5309b4){var _0x36495d=this;return new Promise(function(_0x5b85fb,_0x15aab8){return db[_0x4ab8('0x19')][_0x4ab8('0x1a')]({'raw':_0x5309b4[_0x4ab8('0x1b')]?_0x5309b4['options'][_0x4ab8('0x1c')]===undefined?!![]:![]:!![],'where':_0x5309b4['options']?_0x5309b4[_0x4ab8('0x1b')][_0x4ab8('0x1d')]||null:null,'attributes':_0x5309b4['options']?_0x5309b4[_0x4ab8('0x1b')][_0x4ab8('0x1e')]||null:null,'include':_0x5309b4[_0x4ab8('0x1b')]?_0x5309b4['options'][_0x4ab8('0x1f')]?_[_0x4ab8('0x20')](_0x5309b4['options']['include'],function(_0x37eb3d){return{'model':db[_0x37eb3d[_0x4ab8('0x21')]],'as':_0x37eb3d['as'],'attributes':_0x37eb3d[_0x4ab8('0x1e')],'include':_0x37eb3d['include']?_[_0x4ab8('0x20')](_0x37eb3d['include'],function(_0x4b1a86){return{'model':db[_0x4b1a86[_0x4ab8('0x21')]],'as':_0x4b1a86['as'],'attributes':_0x4b1a86[_0x4ab8('0x1e')],'include':_0x4b1a86[_0x4ab8('0x1f')]?_[_0x4ab8('0x20')](_0x4b1a86['include'],function(_0x589e7a){return{'model':db[_0x589e7a['model']],'as':_0x589e7a['as'],'attributes':_0x589e7a[_0x4ab8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4ab8('0xd')](function(_0x3afc51){logger[_0x4ab8('0xe')]('ShowSetting',_0x5309b4);logger['debug'](_0x4ab8('0x22'),_0x5309b4,JSON[_0x4ab8('0x13')](_0x3afc51));_0x5b85fb(_0x3afc51);})['catch'](function(_0x506e6d){logger[_0x4ab8('0x14')](_0x4ab8('0x22'),_0x506e6d[_0x4ab8('0x16')],_0x5309b4);_0x15aab8(_0x36495d[_0x4ab8('0x14')](0x1f4,_0x506e6d['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 39de63a..174651d 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 _0x814b=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/send','status','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated'];(function(_0x5ae350,_0x24edc7){var _0x4e3073=function(_0x22cfed){while(--_0x22cfed){_0x5ae350['push'](_0x5ae350['shift']());}};_0x4e3073(++_0x24edc7);}(_0x814b,0x1a2));var _0xb814=function(_0x14915a,_0x222f6b){_0x14915a=_0x14915a-0x0;var _0x2f683c=_0x814b[_0x14915a];return _0x2f683c;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0xa')](_0xb814('0x16'),auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0xa')](_0xb814('0x18'),controller[_0xb814('0x19')]);router[_0xb814('0xa')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router[_0xb814('0x1c')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x1e')]);router['post'](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x1f')]);router[_0xb814('0x1c')]('/:id/notify',controller['notify']);router['post'](_0xb814('0x14'),auth['isAuthenticated'](),controller['addApplications']);router[_0xb814('0x1c')](_0xb814('0x20'),auth[_0xb814('0xb')](),controller['send']);router[_0xb814('0x1c')]('/:id/status',controller[_0xb814('0x21')]);router[_0xb814('0x1c')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x22')]);router[_0xb814('0x23')](_0xb814('0xe'),auth['isAuthenticated'](),controller[_0xb814('0x24')]);router['delete'](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x25')]);router[_0xb814('0x26')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x27')]);router['delete'](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x28')]);router[_0xb814('0x26')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x29')]);module[_0xb814('0x2a')]=router; \ No newline at end of file +var _0x5fc3=['/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getInteractions','/:id/status','statusGet','post','create','/:id/dispositions','addAnswer','/:id/notify','/:id/send','send','status','/:id/users','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','describe'];(function(_0x527a85,_0x36146a){var _0xec589d=function(_0x4bd7a3){while(--_0x4bd7a3){_0x527a85['push'](_0x527a85['shift']());}};_0xec589d(++_0x36146a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0x5fc3[_0x2ec2bf];return _0x2c279c;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/dispositions',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getAnswers']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getApplications']);router[_0x35fc('0x9')]('/:id/interactions',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router[_0x35fc('0x9')](_0x35fc('0x12'),controller[_0x35fc('0x13')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x14')]('/',auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x14')](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller['addDisposition']);router[_0x35fc('0x14')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x14')](_0x35fc('0x18'),controller['notify']);router[_0x35fc('0x14')](_0x35fc('0x10'),auth[_0x35fc('0xa')](),controller['addApplications']);router[_0x35fc('0x14')](_0x35fc('0x19'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1a')]);router[_0x35fc('0x14')](_0x35fc('0x12'),controller[_0x35fc('0x1b')]);router[_0x35fc('0x14')](_0x35fc('0x1c'),auth[_0x35fc('0xa')](),controller['addAgents']);router[_0x35fc('0x1d')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1e')]);router[_0x35fc('0x1f')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x20')]);router['delete'](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x21')]);router['delete'](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x22')]);router[_0x35fc('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x35fc('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 2da92fd..dc6f836 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 _0x194f=['name','generate','twilio','skebby','clicksend','clickatell','csc','ENUM','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','exports','STRING'];(function(_0x4f07f3,_0x3bd5f6){var _0x186861=function(_0xc5dc0a){while(--_0xc5dc0a){_0x4f07f3['push'](_0x4f07f3['shift']());}};_0x186861(++_0x3bd5f6);}(_0x194f,0x1c9));var _0xf194=function(_0x40dcb9,_0x46af75){_0x40dcb9=_0x40dcb9-0x0;var _0x4116d5=_0x194f[_0x40dcb9];return _0x4116d5;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xf194('0x0')]={'name':{'type':Sequelize[_0xf194('0x1')],'unique':_0xf194('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xf194('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xf194('0x1')],'defaultValue':function(){return rs[_0xf194('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xf194('0x4'),_0xf194('0x5'),'connectel',_0xf194('0x6'),'plivo',_0xf194('0x7'),'bandwidth',_0xf194('0x8'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0xf194('0x1')]},'authId':{'type':Sequelize[_0xf194('0x1')]},'authToken':{'type':Sequelize[_0xf194('0x1')]},'smsMethod':{'type':Sequelize[_0xf194('0x9')]('SI','TI','GP')},'username':{'type':Sequelize[_0xf194('0x1')]},'password':{'type':Sequelize[_0xf194('0x1')]},'apiKey':{'type':Sequelize[_0xf194('0x1')]},'applicationId':{'type':Sequelize[_0xf194('0x1')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xf194('0x1')]},'deliveryReport':{'type':Sequelize[_0xf194('0xa')],'defaultValue':![]},'description':{'type':Sequelize[_0xf194('0x1')]},'notificationTemplate':{'type':Sequelize[_0xf194('0xb')],'defaultValue':function(){return _0xf194('0xc');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf194('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf194('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf194('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf194('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf194('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xf194('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf194('0xe'),'set':function(_0x4ab62d){if(!_0x4ab62d)this[_0xf194('0xf')](_0xf194('0x10'),null);this[_0xf194('0xf')]('mandatoryDisposition',_0x4ab62d);}}}; \ No newline at end of file +var _0x7ddb=['csc','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth'];(function(_0x43aa13,_0x1a7006){var _0x436522=function(_0x2bc8b5){while(--_0x2bc8b5){_0x43aa13['push'](_0x43aa13['shift']());}};_0x436522(++_0x1a7006);}(_0x7ddb,0x11a));var _0xb7dd=function(_0x46a1ae,_0x218dc3){_0x46a1ae=_0x46a1ae-0x0;var _0x9946af=_0x7ddb[_0x46a1ae];return _0x9946af;};'use strict';var Sequelize=require(_0xb7dd('0x0'));var rs=require(_0xb7dd('0x1'));module[_0xb7dd('0x2')]={'name':{'type':Sequelize[_0xb7dd('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xb7dd('0x3')],'defaultValue':function(){return rs[_0xb7dd('0x4')]();}},'phone':{'type':Sequelize[_0xb7dd('0x3')]},'type':{'type':Sequelize['ENUM'](_0xb7dd('0x5'),_0xb7dd('0x6'),_0xb7dd('0x7'),_0xb7dd('0x8'),_0xb7dd('0x9'),_0xb7dd('0xa'),_0xb7dd('0xb'),_0xb7dd('0xc'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0xb7dd('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xb7dd('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xb7dd('0x3')]},'apiKey':{'type':Sequelize[_0xb7dd('0x3')]},'applicationId':{'type':Sequelize[_0xb7dd('0x3')]},'accountId':{'type':Sequelize[_0xb7dd('0x3')]},'senderString':{'type':Sequelize[_0xb7dd('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xb7dd('0xd')],'defaultValue':function(){return _0xb7dd('0xe');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb7dd('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb7dd('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb7dd('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb7dd('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb7dd('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb7dd('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xb7dd('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xb7dd('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xb7dd('0xf')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x45d290){if(!_0x45d290)this['setDataValue'](_0xb7dd('0x12'),null);this[_0xb7dd('0x13')](_0xb7dd('0x14'),_0x45d290);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 052ba77..82f1354 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 _0x392f=['spread','interaction','created','applications','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','stack','finally','getApplications','pick','Contact','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','Messages','dataValues','push','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','DELIVERED','groupName','bandwidth','redif','inspect','error_code','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','User','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./smsAccount.socket','jayson/promise','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','update','destroy','get','SmsAccounts','UserProfileResource','sendStatus','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','rows','show','params','length','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','SmsAccountId','Disposition','getDispositions','keys','nolimit','findAll','removeDispositions','ids','CannedAnswer','getAnswers','findOne','include','removeAnswers','sms','account','priority','asc','Applications','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','Body','MessageSid','skebby','from','sender','text','connectel','clicksend','messageId','message_id','plivo','Text','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','fromNumber','intelepeer','refid','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','DESC','list','omit','Contacts','contact','SmsInteraction'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x392f,0x12d));var _0xf392=function(_0x2be1ab,_0x2fe1fc){_0x2be1ab=_0x2be1ab-0x0;var _0x4c616d=_0x392f[_0x2be1ab];return _0x4c616d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf392('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf392('0x1'));var rp=require(_0xf392('0x2'));var moment=require(_0xf392('0x3'));var BPromise=require(_0xf392('0x4'));var Mustache=require(_0xf392('0x5'));var util=require(_0xf392('0x6'));var path=require(_0xf392('0x7'));var sox=require(_0xf392('0x8'));var csv=require('to-csv');var ejs=require(_0xf392('0x9'));var fs=require('fs');var fs_extra=require(_0xf392('0xa'));var _=require(_0xf392('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf392('0xc'));var deskjs=require(_0xf392('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf392('0xe'));var Redis=require(_0xf392('0xf'));var authService=require(_0xf392('0x10'));var qs=require(_0xf392('0x11'));var as=require(_0xf392('0x12'));var hardwareService=require(_0xf392('0x13'));var logger=require(_0xf392('0x14'))(_0xf392('0x15'));var utils=require(_0xf392('0x16'));var config=require(_0xf392('0x17'));var licenseUtil=require(_0xf392('0x18'));var db=require(_0xf392('0x19'))['db'];config['redis']=_[_0xf392('0x1a')](config[_0xf392('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xf392('0x1c'))(new Redis(config[_0xf392('0x1b')]));require(_0xf392('0x1d'))['register'](socket);var jayson=require(_0xf392('0x1e'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x2e57a8,_0x3ab2cb,_0x21d2e3,_0x40396d){return new BPromise(function(_0x250305,_0x4fae8b){var _0x328c3a=_0x40396d||client;return _0x328c3a[_0xf392('0x1f')](_0x2e57a8,_0x21d2e3)[_0xf392('0x20')](function(_0x4cad5b){logger[_0xf392('0x21')](_0xf392('0x22'),_0x3ab2cb,_0xf392('0x23'));logger[_0xf392('0x24')](_0xf392('0x25'),_0x3ab2cb,'request\x20sent',JSON[_0xf392('0x26')](_0x4cad5b));if(_0x4cad5b[_0xf392('0x27')]){if(_0x4cad5b[_0xf392('0x27')][_0xf392('0x28')]===0x1f4){logger[_0xf392('0x27')](_0xf392('0x22'),_0x3ab2cb,_0x4cad5b[_0xf392('0x27')][_0xf392('0x29')]);return _0x4fae8b(_0x4cad5b[_0xf392('0x27')][_0xf392('0x29')]);}logger[_0xf392('0x27')](_0xf392('0x22'),_0x3ab2cb,_0x4cad5b[_0xf392('0x27')][_0xf392('0x29')]);return _0x250305(_0x4cad5b[_0xf392('0x27')][_0xf392('0x29')]);}else{logger['info'](_0xf392('0x22'),_0x3ab2cb,_0xf392('0x23'));_0x250305(_0x4cad5b[_0xf392('0x2a')][_0xf392('0x29')]);}})[_0xf392('0x2b')](function(_0x16f77d){logger['error'](_0xf392('0x22'),_0x3ab2cb,_0x16f77d);_0x4fae8b(_0x16f77d);});});}function respondWithStatusCode(_0x838632,_0x243466){_0x243466=_0x243466||0xcc;return function(_0x3b916d){if(_0x3b916d){return _0x838632['sendStatus'](_0x243466);}return _0x838632['status'](_0x243466)[_0xf392('0x2c')]();};}function respondWithResult(_0x48e88e,_0x25696b){_0x25696b=_0x25696b||0xc8;return function(_0x1a7524){if(_0x1a7524){return _0x48e88e['status'](_0x25696b)[_0xf392('0x2d')](_0x1a7524);}};}function respondWithFilteredResult(_0x3de27d,_0x744ce7){return function(_0x36c3d6){if(_0x36c3d6){var _0x11cc66=typeof _0x744ce7[_0xf392('0x2e')]===_0xf392('0x2f')&&typeof _0x744ce7['limit']===_0xf392('0x2f');var _0x2c5a46=_0x36c3d6[_0xf392('0x30')];var _0x5391cf=_0x11cc66?0x0:_0x744ce7[_0xf392('0x2e')];var _0x89bf5e=_0x11cc66?_0x36c3d6[_0xf392('0x30')]:_0x744ce7[_0xf392('0x2e')]+_0x744ce7[_0xf392('0x31')];var _0x432ebd;if(_0x89bf5e>=_0x2c5a46){_0x89bf5e=_0x2c5a46;_0x432ebd=0xc8;}else{_0x432ebd=0xce;}_0x3de27d[_0xf392('0x32')](_0x432ebd);return _0x3de27d[_0xf392('0x33')](_0xf392('0x34'),_0x5391cf+'-'+_0x89bf5e+'/'+_0x2c5a46)['json'](_0x36c3d6);}return null;};}function patchUpdates(_0x49c4ad){return function(_0x351548){try{jsonpatch[_0xf392('0x35')](_0x351548,_0x49c4ad,!![]);}catch(_0x560705){return BPromise[_0xf392('0x36')](_0x560705);}return _0x351548['save']();};}function saveUpdates(_0x1f40ac,_0x4a5985){return function(_0x1cd5b9){if(_0x1cd5b9){return _0x1cd5b9[_0xf392('0x37')](_0x1f40ac)[_0xf392('0x20')](function(_0x7c6a5a){return _0x7c6a5a;});}return null;};}function removeEntity(_0x425354,_0x424654){return function(_0x3f99d6){if(_0x3f99d6){return _0x3f99d6[_0xf392('0x38')]()['then'](function(){var _0x2972ec=_0x3f99d6[_0xf392('0x39')]({'plain':!![]});var _0x4d16a1=_0xf392('0x3a');return db[_0xf392('0x3b')][_0xf392('0x38')]({'where':{'type':_0x4d16a1,'resourceId':_0x2972ec['id']}})['then'](function(){return _0x3f99d6;});})[_0xf392('0x20')](function(){_0x425354[_0xf392('0x32')](0xcc)[_0xf392('0x2c')]();});}};}function handleEntityNotFound(_0x157883,_0x537a9c){return function(_0x51a1a8){if(!_0x51a1a8){_0x157883[_0xf392('0x3c')](0x194);}return _0x51a1a8;};}function handleError(_0x3eae77,_0x452c89){_0x452c89=_0x452c89||0x1f4;return function(_0x4d050a){logger[_0xf392('0x27')](_0x4d050a['stack']);if(_0x4d050a['name']){delete _0x4d050a[_0xf392('0x3d')];}_0x3eae77[_0xf392('0x32')](_0x452c89)[_0xf392('0x3e')](_0x4d050a);};}exports['index']=function(_0x98068c,_0x43561e){var _0x3d2037={'include':[{'model':db[_0xf392('0x3f')],'as':_0xf392('0x40')}]},_0xbcfebb={},_0x44ef4c={'count':0x0,'rows':[]};var _0x3545be=_[_0xf392('0x41')](db[_0xf392('0x42')][_0xf392('0x43')],function(_0x575ee2){return{'name':_0x575ee2[_0xf392('0x44')],'type':_0x575ee2[_0xf392('0x45')][_0xf392('0x46')]};});_0xbcfebb[_0xf392('0x47')]=_[_0xf392('0x41')](_0x3545be,'name');_0xbcfebb[_0xf392('0x48')]=_['keys'](_0x98068c['query']);_0xbcfebb[_0xf392('0x49')]=_[_0xf392('0x4a')](_0xbcfebb[_0xf392('0x47')],_0xbcfebb[_0xf392('0x48')]);_0x3d2037['attributes']=_[_0xf392('0x4a')](_0xbcfebb[_0xf392('0x47')],qs['fields'](_0x98068c[_0xf392('0x48')][_0xf392('0x4b')]));_0x3d2037[_0xf392('0x4c')]=_0x3d2037['attributes']['length']?_0x3d2037[_0xf392('0x4c')]:_0xbcfebb[_0xf392('0x47')];if(!_0x98068c['query'][_0xf392('0x4d')]('nolimit')){_0x3d2037[_0xf392('0x31')]=qs['limit'](_0x98068c[_0xf392('0x48')][_0xf392('0x31')]);_0x3d2037[_0xf392('0x2e')]=qs['offset'](_0x98068c['query'][_0xf392('0x2e')]);}_0x3d2037[_0xf392('0x4e')]=qs[_0xf392('0x4f')](_0x98068c['query']['sort']);_0x3d2037[_0xf392('0x50')]=qs[_0xf392('0x49')](_['pick'](_0x98068c[_0xf392('0x48')],_0xbcfebb[_0xf392('0x49')]),_0x3545be);if(_0x98068c['query'][_0xf392('0x51')]){_0x3d2037[_0xf392('0x50')]=_[_0xf392('0x52')](_0x3d2037[_0xf392('0x50')],{'$or':_[_0xf392('0x41')](_0x3545be,function(_0x4e0c60){if(_0x4e0c60[_0xf392('0x45')]!=='VIRTUAL'){var _0x2ff15a={};_0x2ff15a[_0x4e0c60['name']]={'$like':'%'+_0x98068c[_0xf392('0x48')][_0xf392('0x51')]+'%'};return _0x2ff15a;}})});}_0x3d2037=_['merge']({},_0x3d2037,_0x98068c[_0xf392('0x53')]);var _0x2a1f7c={'where':_0x3d2037['where']};return db[_0xf392('0x42')]['count'](_0x2a1f7c)[_0xf392('0x20')](function(_0x553e4e){_0x44ef4c[_0xf392('0x30')]=_0x553e4e;if(_0x98068c[_0xf392('0x48')][_0xf392('0x54')]){_0x3d2037['include']=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x3d2037);})[_0xf392('0x20')](function(_0x5119fe){_0x44ef4c[_0xf392('0x55')]=_0x5119fe;return _0x44ef4c;})['then'](respondWithFilteredResult(_0x43561e,_0x3d2037))[_0xf392('0x2b')](handleError(_0x43561e,null));};exports[_0xf392('0x56')]=function(_0x18e677,_0x22d570){var _0x5ddb8e={'raw':![],'where':{'id':_0x18e677[_0xf392('0x57')]['id']},'include':[{'model':db[_0xf392('0x3f')],'as':_0xf392('0x40')}]},_0x4deaec={};_0x4deaec[_0xf392('0x47')]=_['keys'](db[_0xf392('0x42')][_0xf392('0x43')]);_0x4deaec[_0xf392('0x48')]=_['keys'](_0x18e677[_0xf392('0x48')]);_0x4deaec['filters']=_['intersection'](_0x4deaec['model'],_0x4deaec[_0xf392('0x48')]);_0x5ddb8e[_0xf392('0x4c')]=_['intersection'](_0x4deaec[_0xf392('0x47')],qs[_0xf392('0x4b')](_0x18e677[_0xf392('0x48')]['fields']));_0x5ddb8e[_0xf392('0x4c')]=_0x5ddb8e[_0xf392('0x4c')][_0xf392('0x58')]?_0x5ddb8e[_0xf392('0x4c')]:_0x4deaec[_0xf392('0x47')];if(_0x18e677[_0xf392('0x48')][_0xf392('0x54')]){_0x5ddb8e['include']=[{'all':!![]}];}_0x5ddb8e=_['merge']({},_0x5ddb8e,_0x18e677[_0xf392('0x53')]);return db[_0xf392('0x42')][_0xf392('0x59')](_0x5ddb8e)['then'](handleEntityNotFound(_0x22d570,null))['then'](respondWithResult(_0x22d570,null))['catch'](handleError(_0x22d570,null));};exports[_0xf392('0x5a')]=function(_0x19a2aa,_0x40213c){return db['SmsAccount'][_0xf392('0x5a')](_0x19a2aa[_0xf392('0x5b')],{})[_0xf392('0x20')](function(_0x5a8402){var _0x2baff3=_0x19a2aa[_0xf392('0x5c')][_0xf392('0x39')]({'plain':!![]});if(!_0x2baff3)throw new Error(_0xf392('0x5d'));if(_0x2baff3[_0xf392('0x5e')]===_0xf392('0x5c')){var _0x154295=_0x5a8402[_0xf392('0x39')]({'plain':!![]});var _0x11a3ee='SmsAccounts';return db[_0xf392('0x5f')]['find']({'where':{'name':_0x11a3ee,'userProfileId':_0x2baff3[_0xf392('0x60')]},'raw':!![]})['then'](function(_0x5bea90){if(_0x5bea90&&_0x5bea90[_0xf392('0x61')]===0x0){return db[_0xf392('0x3b')][_0xf392('0x5a')]({'name':_0x154295[_0xf392('0x3d')],'resourceId':_0x154295['id'],'type':_0x5bea90['name'],'sectionId':_0x5bea90['id']},{})[_0xf392('0x20')](function(){return _0x5a8402;});}else{return _0x5a8402;}})[_0xf392('0x2b')](function(_0x3edf05){logger[_0xf392('0x27')](_0xf392('0x62'),_0x3edf05);throw _0x3edf05;});}return _0x5a8402;})['then'](respondWithResult(_0x40213c,0xc9))[_0xf392('0x2b')](handleError(_0x40213c,null));};exports[_0xf392('0x37')]=function(_0x3650c8,_0x81cf81){if(_0x3650c8['body']['id']){delete _0x3650c8[_0xf392('0x5b')]['id'];}return db[_0xf392('0x42')]['find']({'where':{'id':_0x3650c8[_0xf392('0x57')]['id']},'include':[{'model':db[_0xf392('0x3f')],'as':_0xf392('0x40')}]})[_0xf392('0x20')](handleEntityNotFound(_0x81cf81,null))['then'](saveUpdates(_0x3650c8[_0xf392('0x5b')],null))[_0xf392('0x20')](respondWithResult(_0x81cf81,null))[_0xf392('0x2b')](handleError(_0x81cf81,null));};exports['destroy']=function(_0x1aebfb,_0x18c4d6){return db[_0xf392('0x42')]['find']({'where':{'id':_0x1aebfb[_0xf392('0x57')]['id']}})['then'](handleEntityNotFound(_0x18c4d6,null))['then'](removeEntity(_0x18c4d6,null))['catch'](handleError(_0x18c4d6,null));};exports[_0xf392('0x63')]=function(_0x3bdf9c,_0x4d2d41){return db['SmsAccount']['describe']()[_0xf392('0x20')](respondWithResult(_0x4d2d41,null))[_0xf392('0x2b')](handleError(_0x4d2d41,null));};exports['addDisposition']=function(_0x4f0f38,_0x42a829,_0x4e26af){if(_0x4f0f38['body']['id']){delete _0x4f0f38[_0xf392('0x5b')]['id'];}return db['SmsAccount'][_0xf392('0x59')]({'where':{'id':_0x4f0f38[_0xf392('0x57')]['id']}})[_0xf392('0x20')](handleEntityNotFound(_0x42a829,null))['then'](function(_0x1a8128){if(_0x1a8128){_0x4f0f38[_0xf392('0x5b')][_0xf392('0x64')]=_0x1a8128['id'];return db[_0xf392('0x65')][_0xf392('0x5a')](_0x4f0f38['body']);}})[_0xf392('0x20')](respondWithResult(_0x42a829,null))[_0xf392('0x2b')](handleError(_0x42a829,null));};exports[_0xf392('0x66')]=function(_0x1ed748,_0xb7c72,_0x1388b){var _0x138c20={'raw':![],'where':{}};var _0xa852f2={};var _0x169e8a={'count':0x0,'rows':[]};return db[_0xf392('0x42')]['findOne']({'where':{'id':_0x1ed748[_0xf392('0x57')]['id']}})[_0xf392('0x20')](handleEntityNotFound(_0xb7c72,null))[_0xf392('0x20')](function(_0x5d18a1){if(_0x5d18a1){_0xa852f2[_0xf392('0x47')]=_[_0xf392('0x67')](db['Disposition']['rawAttributes']);_0xa852f2[_0xf392('0x48')]=_[_0xf392('0x67')](_0x1ed748[_0xf392('0x48')]);_0xa852f2[_0xf392('0x49')]=_['intersection'](_0xa852f2[_0xf392('0x47')],_0xa852f2[_0xf392('0x48')]);_0x138c20[_0xf392('0x4c')]=_[_0xf392('0x4a')](_0xa852f2[_0xf392('0x47')],qs[_0xf392('0x4b')](_0x1ed748[_0xf392('0x48')]['fields']));_0x138c20['attributes']=_0x138c20['attributes'][_0xf392('0x58')]?_0x138c20[_0xf392('0x4c')]:_0xa852f2[_0xf392('0x47')];if(!_0x1ed748[_0xf392('0x48')][_0xf392('0x4d')](_0xf392('0x68'))){_0x138c20[_0xf392('0x31')]=qs[_0xf392('0x31')](_0x1ed748[_0xf392('0x48')][_0xf392('0x31')]);_0x138c20['offset']=qs[_0xf392('0x2e')](_0x1ed748[_0xf392('0x48')][_0xf392('0x2e')]);}_0x138c20[_0xf392('0x4e')]=qs[_0xf392('0x4f')](_0x1ed748[_0xf392('0x48')][_0xf392('0x4f')]);_0x138c20[_0xf392('0x50')]=qs[_0xf392('0x49')](_['pick'](_0x1ed748[_0xf392('0x48')],_0xa852f2[_0xf392('0x49')]));_0x138c20['where']['SmsAccountId']=_0x5d18a1['id'];if(_0x1ed748[_0xf392('0x48')]['filter']){_0x138c20[_0xf392('0x50')]=_[_0xf392('0x52')](_0x138c20[_0xf392('0x50')],{'$or':_[_0xf392('0x41')](_0x138c20['attributes'],function(_0x4f2416){var _0x1be4ef={};_0x1be4ef[_0x4f2416]={'$like':'%'+_0x1ed748[_0xf392('0x48')]['filter']+'%'};return _0x1be4ef;})});}_0x138c20=_[_0xf392('0x52')]({},_0x138c20,_0x1ed748[_0xf392('0x53')]);return db[_0xf392('0x65')][_0xf392('0x30')]({'where':_0x138c20[_0xf392('0x50')]})[_0xf392('0x20')](function(_0x52b164){_0x169e8a[_0xf392('0x30')]=_0x52b164;if(_0x1ed748['query'][_0xf392('0x54')]){_0x138c20['include']=[{'all':!![]}];}return db[_0xf392('0x65')][_0xf392('0x69')](_0x138c20);})[_0xf392('0x20')](function(_0x74d0e4){_0x169e8a[_0xf392('0x55')]=_0x74d0e4;return _0x169e8a;});}})['then'](respondWithFilteredResult(_0xb7c72,_0x138c20))['catch'](handleError(_0xb7c72,null));};exports[_0xf392('0x6a')]=function(_0x235945,_0x26dcac,_0x44920d){return db[_0xf392('0x42')][_0xf392('0x59')]({'where':{'id':_0x235945[_0xf392('0x57')]['id']}})['then'](handleEntityNotFound(_0x26dcac,null))['then'](function(_0x1ffa65){if(_0x1ffa65){return _0x1ffa65['removeDispositions'](_0x235945[_0xf392('0x48')][_0xf392('0x6b')]);}})[_0xf392('0x20')](respondWithStatusCode(_0x26dcac,null))[_0xf392('0x2b')](handleError(_0x26dcac,null));};exports['addAnswer']=function(_0x493846,_0x31265b,_0x4b1732){if(_0x493846[_0xf392('0x5b')]['id']){delete _0x493846[_0xf392('0x5b')]['id'];}return db['SmsAccount'][_0xf392('0x59')]({'where':{'id':_0x493846['params']['id']}})[_0xf392('0x20')](handleEntityNotFound(_0x31265b,null))[_0xf392('0x20')](function(_0x3caea7){if(_0x3caea7){_0x493846[_0xf392('0x5b')][_0xf392('0x64')]=_0x3caea7['id'];return db[_0xf392('0x6c')][_0xf392('0x5a')](_0x493846[_0xf392('0x5b')]);}})[_0xf392('0x20')](respondWithResult(_0x31265b,null))[_0xf392('0x2b')](handleError(_0x31265b,null));};exports[_0xf392('0x6d')]=function(_0x1519a1,_0x1f49a4,_0x373d70){var _0x39b67b={'raw':![],'where':{}};var _0x1d65cd={};var _0x1748c7={'count':0x0,'rows':[]};return db[_0xf392('0x42')][_0xf392('0x6e')]({'where':{'id':_0x1519a1[_0xf392('0x57')]['id']}})['then'](handleEntityNotFound(_0x1f49a4,null))[_0xf392('0x20')](function(_0x2200e7){if(_0x2200e7){_0x1d65cd[_0xf392('0x47')]=_[_0xf392('0x67')](db[_0xf392('0x6c')][_0xf392('0x43')]);_0x1d65cd[_0xf392('0x48')]=_['keys'](_0x1519a1[_0xf392('0x48')]);_0x1d65cd[_0xf392('0x49')]=_['intersection'](_0x1d65cd[_0xf392('0x47')],_0x1d65cd['query']);_0x39b67b[_0xf392('0x4c')]=_[_0xf392('0x4a')](_0x1d65cd[_0xf392('0x47')],qs['fields'](_0x1519a1[_0xf392('0x48')][_0xf392('0x4b')]));_0x39b67b['attributes']=_0x39b67b[_0xf392('0x4c')][_0xf392('0x58')]?_0x39b67b[_0xf392('0x4c')]:_0x1d65cd[_0xf392('0x47')];if(!_0x1519a1[_0xf392('0x48')][_0xf392('0x4d')](_0xf392('0x68'))){_0x39b67b[_0xf392('0x31')]=qs[_0xf392('0x31')](_0x1519a1['query']['limit']);_0x39b67b[_0xf392('0x2e')]=qs[_0xf392('0x2e')](_0x1519a1[_0xf392('0x48')]['offset']);}_0x39b67b[_0xf392('0x4e')]=qs['sort'](_0x1519a1[_0xf392('0x48')][_0xf392('0x4f')]);_0x39b67b['where']=qs[_0xf392('0x49')](_['pick'](_0x1519a1[_0xf392('0x48')],_0x1d65cd['filters']));_0x39b67b[_0xf392('0x50')][_0xf392('0x64')]=_0x2200e7['id'];if(_0x1519a1[_0xf392('0x48')][_0xf392('0x51')]){_0x39b67b['where']=_['merge'](_0x39b67b[_0xf392('0x50')],{'$or':_[_0xf392('0x41')](_0x39b67b[_0xf392('0x4c')],function(_0x487bf0){var _0x526677={};_0x526677[_0x487bf0]={'$like':'%'+_0x1519a1['query'][_0xf392('0x51')]+'%'};return _0x526677;})});}_0x39b67b=_[_0xf392('0x52')]({},_0x39b67b,_0x1519a1[_0xf392('0x53')]);return db[_0xf392('0x6c')][_0xf392('0x30')]({'where':_0x39b67b[_0xf392('0x50')]})['then'](function(_0x2f0d17){_0x1748c7[_0xf392('0x30')]=_0x2f0d17;if(_0x1519a1[_0xf392('0x48')]['includeAll']){_0x39b67b[_0xf392('0x6f')]=[{'all':!![]}];}return db[_0xf392('0x6c')][_0xf392('0x69')](_0x39b67b);})[_0xf392('0x20')](function(_0x1cc590){_0x1748c7[_0xf392('0x55')]=_0x1cc590;return _0x1748c7;});}})[_0xf392('0x20')](respondWithFilteredResult(_0x1f49a4,_0x39b67b))[_0xf392('0x2b')](handleError(_0x1f49a4,null));};exports['removeAnswers']=function(_0x6f3432,_0x17b07a,_0x341857){return db[_0xf392('0x42')][_0xf392('0x59')]({'where':{'id':_0x6f3432['params']['id']}})[_0xf392('0x20')](handleEntityNotFound(_0x17b07a,null))[_0xf392('0x20')](function(_0x544bac){if(_0x544bac){return _0x544bac[_0xf392('0x70')](_0x6f3432[_0xf392('0x48')][_0xf392('0x6b')]);}})[_0xf392('0x20')](respondWithStatusCode(_0x17b07a,null))[_0xf392('0x2b')](handleError(_0x17b07a,null));};exports['notify']=function(_0x1ac035,_0x29b517,_0x57e8f2){var _0x51499b={'channel':_0xf392('0x71')};var _0x39f64c=[];var _0x236434=[];var _0x9f9129={};return db[_0xf392('0x42')][_0xf392('0x59')]({'where':{'id':_0x1ac035[_0xf392('0x57')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})[_0xf392('0x20')](handleEntityNotFound(_0x29b517,null))['then'](function(_0x504ead){_0x51499b[_0xf392('0x72')]=_0x504ead;_0x51499b['applications']=_['orderBy'](_0x504ead['Applications'],[_0xf392('0x73')],[_0xf392('0x74')]);if(_0x51499b[_0xf392('0x72')][_0xf392('0x75')]){delete _0x51499b[_0xf392('0x72')][_0xf392('0x75')];}return db['CmContact'][_0xf392('0x63')]();})[_0xf392('0x20')](function(_0xdf1d4){if(!_0xdf1d4){throw new db[(_0xf392('0x76'))][(_0xf392('0x77'))](_0xf392('0x78'));}_0x39f64c=_[_0xf392('0x79')](_[_0xf392('0x67')](_0xdf1d4),[_0xf392('0x7a'),_0xf392('0x7b')]);_0x236434=_['difference'](_['keys'](_0xdf1d4),[_0xf392('0x7a'),_0xf392('0x7b'),_0xf392('0x7c'),_0xf392('0x7d')]);_0x51499b[_0xf392('0x5b')]={'mapKey':_0xf392('0x7e')};if(_0x51499b[_0xf392('0x72')][_0xf392('0x45')]){switch(_0x51499b['account'][_0xf392('0x45')]){case _0xf392('0x7f'):_0x51499b[_0xf392('0x5b')]['from']=_0x1ac035['body'][_0xf392('0x80')];_0x51499b['body']['body']=_0x1ac035[_0xf392('0x5b')][_0xf392('0x81')];_0x51499b[_0xf392('0x5b')]['messageId']=_0x1ac035[_0xf392('0x5b')][_0xf392('0x82')];break;case _0xf392('0x83'):_0x51499b[_0xf392('0x5b')][_0xf392('0x84')]='+'+_0x1ac035['body'][_0xf392('0x85')];_0x51499b[_0xf392('0x5b')]['body']=_0x1ac035['body'][_0xf392('0x86')];break;case _0xf392('0x87'):_0x51499b[_0xf392('0x5b')][_0xf392('0x84')]=_0x1ac035[_0xf392('0x5b')][_0xf392('0x84')];_0x51499b['body'][_0xf392('0x5b')]=_0x1ac035[_0xf392('0x5b')][_0xf392('0x29')];break;case _0xf392('0x88'):_0x51499b[_0xf392('0x5b')][_0xf392('0x84')]=_0x1ac035['body'][_0xf392('0x84')];_0x51499b['body'][_0xf392('0x5b')]=_0x1ac035[_0xf392('0x5b')]['body'];_0x51499b[_0xf392('0x5b')][_0xf392('0x89')]=_0x1ac035[_0xf392('0x5b')][_0xf392('0x8a')];break;case _0xf392('0x8b'):_0x51499b[_0xf392('0x5b')]['from']=_0x1ac035[_0xf392('0x5b')][_0xf392('0x80')];_0x51499b[_0xf392('0x5b')][_0xf392('0x5b')]=_0x1ac035[_0xf392('0x5b')][_0xf392('0x8c')];_0x51499b[_0xf392('0x5b')][_0xf392('0x89')]=_0x1ac035[_0xf392('0x5b')][_0xf392('0x8d')];break;case _0xf392('0x8e'):_0x51499b[_0xf392('0x5b')][_0xf392('0x84')]='+'+_0x1ac035[_0xf392('0x5b')]['results'][0x0][_0xf392('0x84')];_0x51499b[_0xf392('0x5b')][_0xf392('0x5b')]=_0x1ac035[_0xf392('0x5b')][_0xf392('0x8f')][0x0][_0xf392('0x86')];_0x51499b[_0xf392('0x5b')][_0xf392('0x89')]=_0x1ac035[_0xf392('0x5b')][_0xf392('0x8f')][0x0][_0xf392('0x89')];break;case _0xf392('0x90'):_0x51499b['body']['from']=_0x1ac035['body']['originatingAddress'];_0x51499b[_0xf392('0x5b')][_0xf392('0x5b')]=_0x1ac035[_0xf392('0x5b')][_0xf392('0x91')]['message'];break;case _0xf392('0x92'):_0x51499b[_0xf392('0x5b')][_0xf392('0x84')]=_0x1ac035[_0xf392('0x5b')][_0xf392('0x93')];_0x51499b['body']['body']=_0x1ac035['body'][_0xf392('0x86')];_0x51499b[_0xf392('0x5b')][_0xf392('0x89')]=_0x1ac035[_0xf392('0x5b')]['replyMessageId'];break;case'bandwidth':_0x51499b[_0xf392('0x5b')][_0xf392('0x89')]=_0x1ac035[_0xf392('0x5b')][0x0][_0xf392('0x29')]['id'];_0x51499b[_0xf392('0x5b')][_0xf392('0x84')]=_0x1ac035[_0xf392('0x5b')][0x0][_0xf392('0x29')][_0xf392('0x84')];_0x51499b[_0xf392('0x5b')][_0xf392('0x5b')]=_0x1ac035[_0xf392('0x5b')][0x0][_0xf392('0x29')][_0xf392('0x86')];break;case _0xf392('0x94'):_0x51499b[_0xf392('0x5b')]['from']=_0x1ac035[_0xf392('0x5b')]['from'];_0x51499b[_0xf392('0x5b')]['body']=_0x1ac035['body'][_0xf392('0x29')];_0x51499b[_0xf392('0x5b')][_0xf392('0x89')]=_0x1ac035[_0xf392('0x5b')][_0xf392('0x95')];break;}}if(_0x51499b[_0xf392('0x5b')]['id']){delete _0x51499b['body']['id'];}if(_[_0xf392('0x96')](_0x51499b[_0xf392('0x5b')][_0xf392('0x84')])){throw new db[(_0xf392('0x76'))][(_0xf392('0x77'))]('from\x20is\x20mandatory');}if(_[_0xf392('0x96')](_0x51499b[_0xf392('0x5b')][_0xf392('0x5b')])||_0x51499b['body'][_0xf392('0x5b')]===''){throw new db[(_0xf392('0x76'))][(_0xf392('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf392('0x96')](_0x51499b[_0xf392('0x5b')][_0xf392('0x97')])){throw new db['Sequelize'][(_0xf392('0x77'))](_0xf392('0x98')+_0x236434);}if(!_['includes'](_0x236434,_0x51499b[_0xf392('0x5b')][_0xf392('0x97')])){throw new db[(_0xf392('0x76'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x236434);}_0x9f9129[_0x51499b[_0xf392('0x5b')]['mapKey']]=_0x51499b[_0xf392('0x5b')][_0xf392('0x84')];return db[_0xf392('0x99')][_0xf392('0x59')]({'where':{'id':_0x51499b[_0xf392('0x72')][_0xf392('0x7d')]},'include':[{'model':db[_0xf392('0x9a')],'as':'Contacts','where':_0x9f9129,'limit':0x1,'order':[[_0xf392('0x7b'),_0xf392('0x9b')]]}]});})['then'](handleEntityNotFound(_0x29b517,null))[_0xf392('0x20')](function(_0x258c23){if(_0x258c23){_0x51499b[_0xf392('0x9c')]=_[_0xf392('0x9d')](_0x258c23,[_0xf392('0x9e')]);if(_0x258c23[_0xf392('0x9e')]['length']){return _0x258c23[_0xf392('0x9e')][0x0];}var _0xb7f9ef=_['defaults'](_0x51499b['body'],{'firstName':_0x51499b['body'][_0xf392('0x84')],'ListId':_0x258c23['id']});_0xb7f9ef[_0x51499b[_0xf392('0x5b')][_0xf392('0x97')]]=_0x51499b[_0xf392('0x5b')]['from'];return db['CmContact'][_0xf392('0x5a')](_0xb7f9ef,{'fields':_0x39f64c,'raw':!![]});}})[_0xf392('0x20')](handleEntityNotFound(_0x29b517,null))[_0xf392('0x20')](function(_0x2ea038){if(_0x2ea038){_0x51499b[_0xf392('0x9f')]=_0x2ea038;var _0x5735d3={'ContactId':_0x2ea038['id'],'phone':_0x51499b['body'][_0xf392('0x84')],'SmsAccountId':_0x1ac035['params']['id']};var _0x183fb8={'ContactId':_0x2ea038['id'],'SmsAccountId':_0x1ac035['params']['id'],'closed':![]};return db['SmsInteraction'][_0xf392('0x59')]({'where':_0x183fb8})[_0xf392('0x20')](function(_0x2ffa3c){if(_0x2ffa3c){return[_0x2ffa3c,![]];}return db[_0xf392('0xa0')][_0xf392('0x5a')](_0x5735d3)['then'](function(_0xe54df1){return[_0xe54df1,!![]];});});}})[_0xf392('0xa1')](function(_0x363126,_0xc41bee){_0x51499b[_0xf392('0xa2')]=_0x363126[_0xf392('0x39')]({'plain':!![]});_0x51499b[_0xf392('0xa2')][_0xf392('0xa3')]=![];if(_0xc41bee){if(_0x51499b[_0xf392('0x72')]['autoclose']){_0x51499b['applications']['push']({'id':0x0,'priority':_0x51499b[_0xf392('0xa4')][_0xf392('0x58')]+0x1,'app':_0xf392('0xa5'),'appdata':'unmanaged','interval':_0xf392('0xa6')});}_0x51499b[_0xf392('0xa2')][_0xf392('0xa3')]=!![];}return db[_0xf392('0xa7')][_0xf392('0x5a')]({'phone':_0x51499b[_0xf392('0x5b')][_0xf392('0x84')],'messageId':_0x51499b[_0xf392('0x5b')][_0xf392('0x89')],'body':_0x51499b['body']['body'],'SmsAccountId':_0x1ac035[_0xf392('0x57')]['id'],'SmsInteractionId':_0x363126['id'],'direction':'in','ContactId':_0x363126[_0xf392('0xa8')],'AttachmentId':_0x51499b[_0xf392('0x5b')][_0xf392('0xa9')]});})[_0xf392('0x20')](function(_0x47476f){_0x51499b[_0xf392('0x29')]=_0x47476f;if(_0x51499b[_0xf392('0xa2')][_0xf392('0xaa')]){return db['User'][_0xf392('0x59')]({'attributes':['id',_0xf392('0x3d')],'where':{'id':_0x51499b[_0xf392('0xa2')]['UserId']}})[_0xf392('0x20')](function(_0x21efb1){if(_0x21efb1){_0x51499b[_0xf392('0xa4')][_0xf392('0xab')]({'id':0x0,'priority':0x0,'app':_0xf392('0xac'),'appdata':_0x21efb1[_0xf392('0x3d')]+','+(_0x51499b[_0xf392('0x72')][_0xf392('0xad')]||0xa),'interval':_0xf392('0xa6')});}return respondWithRpcPromise(_0xf392('0xae'),_0xf392('0xaf'),_0x51499b);});}return respondWithRpcPromise('Start',_0xf392('0xaf'),_0x51499b);})[_0xf392('0x20')](function(_0x4bc0ef){if(_0x4bc0ef){var _0x3dd839=0xc8;var _0x368f67=_0xf392('0xb0');logger[_0xf392('0x21')](_0xf392('0x25'),_0x368f67,_0x3dd839,_0xf392('0xb1'));logger[_0xf392('0x24')](_0xf392('0xb2'),_0x368f67,_0x3dd839,_0xf392('0xb1'),JSON[_0xf392('0x26')](_0x4bc0ef));if(_0x51499b[_0xf392('0x72')][_0xf392('0x45')]===_0xf392('0x7f')){return _0x29b517[_0xf392('0x32')](_0x3dd839)['set'](_0xf392('0xb3'),_0xf392('0xb4'))[_0xf392('0x3e')](_0xf392('0xb5'));}else{return _0x29b517['status'](_0x3dd839)[_0xf392('0x2d')](_0x4bc0ef);}}})[_0xf392('0x2b')](handleError(_0x29b517,null));};exports['addApplications']=function(_0x54efe5,_0x9f7685){var _0x35c0cd=_0x54efe5[_0xf392('0x57')]['id'];var _0x506579=_0x54efe5[_0xf392('0x5b')];var _0x35ed14=0xc8;var _0x59fc4b=null;return db[_0xf392('0xb6')][_0xf392('0xb7')]({'isolationLevel':db[_0xf392('0xb6')][_0xf392('0xb8')][_0xf392('0xb9')][_0xf392('0xba')]},function(_0x25d224){return db[_0xf392('0x42')]['findOne']({'where':{'id':_0x35c0cd},'transaction':_0x25d224})['then'](function(_0x54cd77){if(_0x54cd77){return db[_0xf392('0xbb')][_0xf392('0x38')]({'where':{'SmsAccountId':_0x35c0cd},'transaction':_0x25d224})['then'](function(){var _0x4d55fc=_['map'](_0x506579,function(_0x4467fc){_0x4467fc[_0xf392('0x64')]=_0x35c0cd;return _0x4467fc;});return db[_0xf392('0xbb')][_0xf392('0xbc')](_0x4d55fc,{'transaction':_0x25d224});});}else{_0x35ed14=0x194;_0x59fc4b=[];}});})[_0xf392('0x20')](function(){if(_0x35ed14!==0x194){return db[_0xf392('0xbb')][_0xf392('0xbd')]({'where':{'SmsAccountId':_0x35c0cd},'order':_0xf392('0x73')})[_0xf392('0x20')](function(_0x594a55){_0x59fc4b=_0x594a55;});}})[_0xf392('0x2b')](function(_0x3e835d){_0x35ed14=0x1f4;logger[_0xf392('0x27')](_0x3e835d[_0xf392('0xbe')]);if(_0x3e835d[_0xf392('0x3d')]){delete _0x3e835d['name'];}_0x59fc4b=_0x3e835d;})[_0xf392('0xbf')](function(){if(_0x59fc4b===null){_0x9f7685['sendStatus'](_0x35ed14);}else{if(_0x35ed14===0x1f4){_0x9f7685[_0xf392('0x32')](_0x35ed14)[_0xf392('0x3e')](_0x59fc4b);}else{_0x9f7685['status'](_0x35ed14)[_0xf392('0x2d')](_0x59fc4b);}}});};exports[_0xf392('0xc0')]=function(_0x174220,_0xa034bb,_0x2ff93e){var _0x2d00ff={};var _0x172734={};var _0x49823e;var _0x40e757;return db[_0xf392('0x42')]['findOne']({'where':{'id':_0x174220['params']['id']}})['then'](handleEntityNotFound(_0xa034bb,null))[_0xf392('0x20')](function(_0x46e12d){if(_0x46e12d){_0x49823e=_0x46e12d;_0x172734[_0xf392('0x47')]=_[_0xf392('0x67')](db[_0xf392('0xbb')][_0xf392('0x43')]);_0x172734[_0xf392('0x48')]=_[_0xf392('0x67')](_0x174220[_0xf392('0x48')]);_0x172734[_0xf392('0x49')]=_[_0xf392('0x4a')](_0x172734['model'],_0x172734[_0xf392('0x48')]);_0x2d00ff[_0xf392('0x4c')]=_[_0xf392('0x4a')](_0x172734['model'],qs['fields'](_0x174220[_0xf392('0x48')]['fields']));_0x2d00ff[_0xf392('0x4c')]=_0x2d00ff[_0xf392('0x4c')]['length']?_0x2d00ff['attributes']:_0x172734['model'];_0x2d00ff[_0xf392('0x4e')]=qs['sort'](_0x174220['query'][_0xf392('0x4f')]);_0x2d00ff[_0xf392('0x50')]=qs['filters'](_[_0xf392('0xc1')](_0x174220[_0xf392('0x48')],_0x172734[_0xf392('0x49')]));if(_0x174220[_0xf392('0x48')][_0xf392('0x51')]){_0x2d00ff[_0xf392('0x50')]=_[_0xf392('0x52')](_0x2d00ff[_0xf392('0x50')],{'$or':_[_0xf392('0x41')](_0x2d00ff[_0xf392('0x4c')],function(_0x2deb3d){var _0x109407={};_0x109407[_0x2deb3d]={'$like':'%'+_0x174220['query'][_0xf392('0x51')]+'%'};return _0x109407;})});}_0x2d00ff=_[_0xf392('0x52')]({},_0x2d00ff,_0x174220[_0xf392('0x53')]);return _0x49823e[_0xf392('0xc0')](_0x2d00ff);}})[_0xf392('0x20')](function(_0x31c441){if(_0x31c441){_0x40e757=_0x31c441[_0xf392('0x58')];if(!_0x174220[_0xf392('0x48')][_0xf392('0x4d')]('nolimit')){_0x2d00ff[_0xf392('0x31')]=qs['limit'](_0x174220[_0xf392('0x48')]['limit']);_0x2d00ff[_0xf392('0x2e')]=qs['offset'](_0x174220[_0xf392('0x48')][_0xf392('0x2e')]);}return _0x49823e['getApplications'](_0x2d00ff);}})[_0xf392('0x20')](function(_0x863c4a){if(_0x863c4a){return _0x863c4a?{'count':_0x40e757,'rows':_0x863c4a}:null;}})[_0xf392('0x20')](respondWithResult(_0xa034bb,null))[_0xf392('0x2b')](handleError(_0xa034bb,null));};exports['getInteractions']=function(_0x17370a,_0x49356a,_0x34242e){var _0x261b60={'raw':![],'where':{}};var _0x3eecb7={};var _0x45edf0={'count':0x0,'rows':[]};return db[_0xf392('0x42')][_0xf392('0x6e')]({'where':{'id':_0x17370a['params']['id']}})[_0xf392('0x20')](handleEntityNotFound(_0x49356a,null))['then'](function(_0x4be9b2){if(_0x4be9b2){_0x3eecb7[_0xf392('0x47')]=_['keys'](db[_0xf392('0xa0')][_0xf392('0x43')]);_0x3eecb7['query']=_['keys'](_0x17370a[_0xf392('0x48')]);_0x3eecb7[_0xf392('0x49')]=_['intersection'](_0x3eecb7[_0xf392('0x47')],_0x3eecb7[_0xf392('0x48')]);_0x261b60['attributes']=_['intersection'](_0x3eecb7[_0xf392('0x47')],qs[_0xf392('0x4b')](_0x17370a['query']['fields']));_0x261b60[_0xf392('0x4c')]=_0x261b60['attributes'][_0xf392('0x58')]?_0x261b60[_0xf392('0x4c')]:_0x3eecb7[_0xf392('0x47')];if(!_0x17370a[_0xf392('0x48')]['hasOwnProperty'](_0xf392('0x68'))){_0x261b60[_0xf392('0x31')]=qs[_0xf392('0x31')](_0x17370a['query'][_0xf392('0x31')]);_0x261b60[_0xf392('0x2e')]=qs[_0xf392('0x2e')](_0x17370a[_0xf392('0x48')][_0xf392('0x2e')]);}_0x261b60[_0xf392('0x4e')]=qs[_0xf392('0x4f')](_0x17370a[_0xf392('0x48')]['sort']);_0x261b60[_0xf392('0x50')]=qs[_0xf392('0x49')](_[_0xf392('0xc1')](_0x17370a['query'],_0x3eecb7[_0xf392('0x49')]));_0x261b60['where'][_0xf392('0x64')]=_0x4be9b2['id'];if(_0x17370a[_0xf392('0x48')][_0xf392('0x51')]){_0x261b60[_0xf392('0x50')]=_['merge'](_0x261b60[_0xf392('0x50')],{'$or':_['map'](_0x261b60['attributes'],function(_0x29bc02){var _0x4761e6={};_0x4761e6[_0x29bc02]={'$like':'%'+_0x17370a[_0xf392('0x48')][_0xf392('0x51')]+'%'};return _0x4761e6;})});}_0x261b60=_[_0xf392('0x52')]({},_0x261b60,_0x17370a['options']);return db[_0xf392('0xa0')][_0xf392('0x30')]({'where':_0x261b60[_0xf392('0x50')]})[_0xf392('0x20')](function(_0x53d1e7){_0x45edf0['count']=_0x53d1e7;if(_0x17370a[_0xf392('0x48')]['includeAll']){_0x261b60[_0xf392('0x6f')]=[{'model':db[_0xf392('0x9a')],'as':_0xf392('0xc2'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xf392('0x3d'),_0xf392('0xc3'),_0xf392('0xc4')],'required':![]},{'model':db[_0xf392('0xc5')],'as':_0xf392('0xc6'),'attributes':['id',_0xf392('0x3d'),_0xf392('0xc7')],'where':_0x17370a[_0xf392('0x48')][_0xf392('0xc8')]?{'id':_0x17370a['query'][_0xf392('0xc8')]}:undefined,'required':_0x17370a[_0xf392('0x48')][_0xf392('0xc8')]?!![]:![]}];}return db['SmsInteraction'][_0xf392('0x69')](_0x261b60);})[_0xf392('0x20')](function(_0x3ea43b){_0x45edf0[_0xf392('0x55')]=_0x3ea43b;return _0x45edf0;});}})[_0xf392('0x20')](respondWithFilteredResult(_0x49356a,_0x261b60))[_0xf392('0x2b')](handleError(_0x49356a,null));};exports[_0xf392('0x3e')]=function(_0x26a27e,_0x40438a,_0x1dc267){var _0x14501c,_0xb6c662,_0x3d3be9;if(_[_0xf392('0x96')](_0x26a27e['body'][_0xf392('0x5b')])||_0x26a27e[_0xf392('0x5b')][_0xf392('0x5b')]===''){throw new db[(_0xf392('0x76'))][(_0xf392('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x26a27e[_0xf392('0x5b')]['to'])){throw new db[(_0xf392('0x76'))][(_0xf392('0x77'))](_0xf392('0xc9'));}_0x14501c=_0x26a27e[_0xf392('0x5b')]['to'];return db['SmsAccount'][_0xf392('0x59')]({'where':{'id':_0x26a27e[_0xf392('0x57')]['id']},'include':[{'model':db[_0xf392('0x99')],'as':'List','include':[{'model':db['CmContact'],'as':_0xf392('0x9e'),'where':{'mobile':_0x14501c},'limit':0x1,'order':[[_0xf392('0x7b'),_0xf392('0x9b')]]}]}]})[_0xf392('0x20')](handleEntityNotFound(_0x40438a,null))['then'](function(_0x231b09){if(_0x231b09&&_0x231b09[_0xf392('0xca')]){_0xb6c662=_0x231b09['get']({'plain':!![]});if(_0xb6c662[_0xf392('0xca')]&&_0xb6c662['List']['Contacts']['length']){return _0xb6c662[_0xf392('0xca')][_0xf392('0x9e')][0x0];}return db[_0xf392('0x9a')][_0xf392('0x5a')](_['defaults'](_0x26a27e['body'],{'firstName':_0x14501c,'mobile':_0x14501c,'phone':_0x14501c,'ListId':_0xb6c662[_0xf392('0x7d')]}));}})['then'](handleEntityNotFound(_0x40438a,null))[_0xf392('0x20')](function(_0x49ffe4){if(_0x49ffe4){_0x3d3be9=_0x49ffe4;return db[_0xf392('0xa0')][_0xf392('0x59')]({'where':{'ContactId':_0x3d3be9['id'],'closed':![],'SmsAccountId':_0xb6c662['id']}})[_0xf392('0x20')](function(_0xc60e2f){if(_0xc60e2f){return[_0xc60e2f,![]];}return db[_0xf392('0xa0')][_0xf392('0x5a')]({'UserId':_0x26a27e[_0xf392('0x5c')]['id'],'ContactId':_0x3d3be9['id'],'SmsAccountId':_0xb6c662['id'],'phone':_0x14501c,'firstMsgDirection':'out','Messages':[_[_0xf392('0x52')](_0x26a27e[_0xf392('0x5b')],{'read':![],'body':_0x26a27e[_0xf392('0x5b')][_0xf392('0x5b')],'phone':_0x14501c,'SmsAccountId':_0xb6c662['id'],'UserId':_0x26a27e[_0xf392('0x5c')]['id'],'ContactId':_0x3d3be9['id']})]},{'include':[{'model':db[_0xf392('0xa7')],'as':_0xf392('0xcb')}]})[_0xf392('0x20')](function(_0x2c080d){return[_0x2c080d,!![]];});});}})[_0xf392('0xa1')](function(_0x4794df,_0x279a43){if(_0x279a43){return _0x4794df;}return db['SmsMessage'][_0xf392('0x5a')](_[_0xf392('0x52')](_0x26a27e[_0xf392('0x5b')],{'read':![],'body':_0x26a27e[_0xf392('0x5b')][_0xf392('0x5b')],'phone':_0x14501c,'SmsAccountId':_0xb6c662['id'],'SmsInteractionId':_0x4794df['id'],'UserId':_0x26a27e[_0xf392('0x5c')]['id'],'ContactId':_0x3d3be9['id']}))[_0xf392('0x20')](function(_0x1ac3fc){_0x4794df[_0xf392('0xcc')]['Messages']=[];_0x4794df[_0xf392('0xcc')][_0xf392('0xcb')][_0xf392('0xcd')](_0x1ac3fc['dataValues']);return _0x4794df;});})[_0xf392('0x20')](respondWithResult(_0x40438a,null))[_0xf392('0x2b')](handleError(_0x40438a,null));};exports[_0xf392('0x32')]=function(_0x18d1c3,_0x16f8a8,_0x52c23a){if(_0x18d1c3[_0xf392('0x5b')]['id']){delete _0x18d1c3[_0xf392('0x5b')]['id'];}var _0x2ed2ce,_0x317378,_0x504fbd;return db[_0xf392('0x42')]['find']({'where':{'id':_0x18d1c3[_0xf392('0x57')]['id']}})[_0xf392('0x20')](handleEntityNotFound(_0x16f8a8,null))['then'](function(_0x17d83c){if(_0x17d83c){_0x504fbd=_0x17d83c;logger[_0xf392('0x24')](_0xf392('0x25'),_0xf392('0x32'),_0xf392('0xce'),_0x17d83c['type'],util['inspect'](_0x18d1c3['body'],{'showHidden':![],'depth':null}));switch(_0x17d83c[_0xf392('0x45')]){case _0xf392('0x83'):if(_0x18d1c3['body'][_0xf392('0xcf')]&&_0x18d1c3['body']['status']){_0x317378=_0x18d1c3[_0xf392('0x5b')][_0xf392('0x32')];return db[_0xf392('0xa7')][_0xf392('0x59')]({'where':{'messageId':_0x18d1c3['body'][_0xf392('0xcf')]}});}break;case _0xf392('0x87'):if(_0x18d1c3['body'][_0xf392('0xd0')]&&_0x18d1c3[_0xf392('0x5b')][_0xf392('0xd1')]){_0x317378=_0x18d1c3['body'][_0xf392('0xd1')];return db[_0xf392('0xa7')][_0xf392('0x59')]({'where':{'messageId':_0x18d1c3[_0xf392('0x5b')][_0xf392('0xd0')]}});}break;case'clicksend':if(_0x18d1c3['body'][_0xf392('0x8a')]&&_0x18d1c3[_0xf392('0x5b')][_0xf392('0xd2')]){_0x317378=_0x18d1c3[_0xf392('0x5b')][_0xf392('0xd2')];return db['SmsMessage'][_0xf392('0x59')]({'where':{'messageId':_0x18d1c3[_0xf392('0x5b')]['message_id']}});}break;case'infobip':var _0x1ac7c3=_0x18d1c3[_0xf392('0x5b')][_0xf392('0x8f')][0x0];if(_0x1ac7c3[_0xf392('0x89')]&&_0x1ac7c3[_0xf392('0x32')]['groupName']===_0xf392('0xd3')){_0x317378=_0x1ac7c3[_0xf392('0x32')][_0xf392('0xd4')];return db[_0xf392('0xa7')][_0xf392('0x59')]({'where':{'messageId':_0x1ac7c3['messageId']}});}break;case _0xf392('0x92'):if(_0x18d1c3[_0xf392('0x5b')]['messageId']&&_0x18d1c3[_0xf392('0x5b')][_0xf392('0x32')]){_0x317378=_0x18d1c3[_0xf392('0x5b')][_0xf392('0x32')];return db[_0xf392('0xa7')][_0xf392('0x59')]({'where':{'messageId':_0x18d1c3[_0xf392('0x5b')][_0xf392('0x89')]}});}break;case _0xf392('0xd5'):if(_0x18d1c3[_0xf392('0x5b')][0x0][_0xf392('0x29')]['id']){_0x317378=_0x18d1c3[_0xf392('0x5b')][0x0][_0xf392('0x45')];return db[_0xf392('0xa7')][_0xf392('0x59')]({'where':{'messageId':_0x18d1c3[_0xf392('0x5b')][0x0][_0xf392('0x29')]['id']}});}break;case _0xf392('0x94'):if(_0x18d1c3['body'][_0xf392('0xd6')]&&_0x18d1c3[_0xf392('0x5b')]['status']){_0x317378=_0x18d1c3[_0xf392('0x5b')]['status'];return db[_0xf392('0xa7')][_0xf392('0x59')]({'where':{'messageId':_0x18d1c3['body']['redif']}});}break;}}})['then'](handleEntityNotFound(_0x16f8a8,null))[_0xf392('0x20')](function(_0x1931e3){if(_0x1931e3){_0x2ed2ce=_0x1931e3;switch(_0x504fbd[_0xf392('0x45')]){case _0xf392('0x83'):if(_0x317378===_0xf392('0xd3')){return _0x2ed2ce['update']({'read':!![]});}else{logger['error'](_0xf392('0x25'),_0xf392('0x32'),_0xf392('0x83'),util[_0xf392('0xd7')](_0x18d1c3[_0xf392('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xf392('0x87'):if(_0x317378==='1'){return _0x2ed2ce[_0xf392('0x37')]({'read':!![]});}else{logger[_0xf392('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf392('0x32'),_0xf392('0x83'),util[_0xf392('0xd7')](_0x18d1c3[_0xf392('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xf392('0x88'):if(!_0x18d1c3[_0xf392('0x5b')][_0xf392('0xd8')]&&_0x317378>=0xc8&&_0x317378<=0xce){return _0x2ed2ce[_0xf392('0x37')]({'read':!![]});}else{logger[_0xf392('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf392('0x32'),_0xf392('0x88'),util[_0xf392('0xd7')](_0x18d1c3['body'],{'showHidden':![],'depth':null}));}break;case _0xf392('0x8e'):var _0x532fc8=_0x18d1c3[_0xf392('0x5b')]['results'][0x0];if(_0x532fc8[_0xf392('0x32')][_0xf392('0xd4')]==='DELIVERED'){return _0x2ed2ce[_0xf392('0x37')]({'read':!![]});}else{logger[_0xf392('0x27')](_0xf392('0x25'),_0xf392('0x32'),_0xf392('0x8e'),util[_0xf392('0xd7')](_0x18d1c3[_0xf392('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xf392('0x92'):if(_0x317378=='DELIVERED_TO_GATEWAY'||_0x317378==_0xf392('0xd9')){return _0x2ed2ce[_0xf392('0x37')]({'read':!![]});}else{logger['error'](_0xf392('0x25'),_0xf392('0x32'),_0xf392('0x92'),util['inspect'](_0x18d1c3[_0xf392('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xf392('0xd5'):if(_0x317378==_0xf392('0xda')){return _0x2ed2ce[_0xf392('0x37')]({'read':!![]});}else{logger[_0xf392('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf392('0x32'),_0xf392('0xd5'),util[_0xf392('0xd7')](_0x18d1c3[_0xf392('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xf392('0x94'):if(_0x317378===_0xf392('0xdb')||_0x317378==='ACCEPTD'){return _0x2ed2ce[_0xf392('0x37')]({'read':!![]});}else{logger[_0xf392('0x27')](_0xf392('0x25'),_0xf392('0x32'),_0xf392('0x94'),util[_0xf392('0xd7')](_0x18d1c3[_0xf392('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x2ed2ce;}})['then'](respondWithResult(_0x16f8a8,null))['catch'](handleError(_0x16f8a8,null));};exports[_0xf392('0xdc')]=function(_0x472464,_0xf5db6b,_0x4c6f70){var _0x27c39c,_0x111c24,_0x14c2aa;return db[_0xf392('0x42')][_0xf392('0x59')]({'where':{'id':_0x472464[_0xf392('0x57')]['id']}})[_0xf392('0x20')](handleEntityNotFound(_0xf5db6b,null))[_0xf392('0x20')](function(_0x26ea68){if(_0x26ea68){_0x14c2aa=_0x26ea68;logger[_0xf392('0x24')](_0xf392('0x25'),'status',_0xf392('0xce'),_0x26ea68[_0xf392('0x45')],util[_0xf392('0xd7')](_0x472464[_0xf392('0x48')],{'showHidden':![],'depth':null}));switch(_0x26ea68[_0xf392('0x45')]){case _0xf392('0x90'):if(_0x472464[_0xf392('0x48')][_0xf392('0xdd')]&&_0x472464[_0xf392('0x48')][_0xf392('0xde')]){_0x111c24=_0x472464[_0xf392('0x48')]['state'];return db[_0xf392('0xa7')][_0xf392('0x59')]({'where':{'messageId':_0x472464[_0xf392('0x48')][_0xf392('0xdd')]}});}break;}}})[_0xf392('0x20')](handleEntityNotFound(_0xf5db6b,null))['then'](function(_0x3b1b9f){if(_0x3b1b9f){_0x27c39c=_0x3b1b9f;switch(_0x14c2aa[_0xf392('0x45')]){case _0xf392('0x90'):if(_0x111c24==='2'||_0x111c24==='6'){return _0x27c39c[_0xf392('0x37')]({'read':!![]});}else{logger[_0xf392('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf392('0x32'),_0xf392('0x90'),util[_0xf392('0xd7')](_0x472464[_0xf392('0x48')],{'showHidden':![],'depth':null}));};break;}return _0x27c39c;}})[_0xf392('0x20')](respondWithResult(_0xf5db6b,null))['catch'](handleError(_0xf5db6b,null));};exports[_0xf392('0xdf')]=function(_0x550728,_0x9295bb,_0x531926){return db[_0xf392('0x42')][_0xf392('0x59')]({'where':{'id':_0x550728[_0xf392('0x57')]['id']}})['then'](handleEntityNotFound(_0x9295bb,null))['then'](function(_0x39ac64){if(_0x39ac64){return _0x39ac64[_0xf392('0xdf')](_0x550728[_0xf392('0x5b')][_0xf392('0x6b')],_[_0xf392('0x9d')](_0x550728[_0xf392('0x5b')],[_0xf392('0x6b'),'id'])||{})[_0xf392('0xa1')](function(_0x579792){for(var _0x2fe964=0x0;_0x2fe964<_0x550728['body']['ids'][_0xf392('0x58')];_0x2fe964+=0x1){socket[_0xf392('0xe0')](_0xf392('0xe1'),{'UserId':Number(_0x550728[_0xf392('0x5b')][_0xf392('0x6b')][_0x2fe964]),'SmsAccountId':Number(_0x550728[_0xf392('0x57')]['id'])});}return _0x579792;});}})[_0xf392('0x20')](respondWithResult(_0x9295bb,null))['catch'](handleError(_0x9295bb,null));};exports[_0xf392('0xe2')]=function(_0x158751,_0x508a53,_0x36ceb4){return db[_0xf392('0x42')][_0xf392('0x59')]({'where':{'id':_0x158751[_0xf392('0x57')]['id']}})[_0xf392('0x20')](handleEntityNotFound(_0x508a53,null))[_0xf392('0x20')](function(_0xdc5dd8){if(_0xdc5dd8){return _0xdc5dd8['removeAgents'](_0x158751[_0xf392('0x48')][_0xf392('0x6b')])[_0xf392('0x20')](function(){if(_[_0xf392('0xe3')](_0x158751[_0xf392('0x48')][_0xf392('0x6b')])){for(var _0x41937b=0x0;_0x41937b<_0x158751[_0xf392('0x48')]['ids']['length'];_0x41937b+=0x1){socket[_0xf392('0xe0')](_0xf392('0xe4'),{'UserId':Number(_0x158751[_0xf392('0x48')][_0xf392('0x6b')][_0x41937b]),'SmsAccountId':Number(_0x158751[_0xf392('0x57')]['id'])});}}else{socket[_0xf392('0xe0')](_0xf392('0xe4'),{'UserId':Number(_0x158751['query'][_0xf392('0x6b')]),'SmsAccountId':Number(_0x158751[_0xf392('0x57')]['id'])});}});}})[_0xf392('0x20')](respondWithStatusCode(_0x508a53,null))[_0xf392('0x2b')](handleError(_0x508a53,null));};exports[_0xf392('0xe5')]=function(_0x6a59cc,_0x4da48e,_0x33454f){var _0x33185b={};var _0x2f1264={};var _0x4cc682;var _0x2afd9f;return db['SmsAccount'][_0xf392('0x6e')]({'where':{'id':_0x6a59cc[_0xf392('0x57')]['id']}})[_0xf392('0x20')](handleEntityNotFound(_0x4da48e,null))[_0xf392('0x20')](function(_0x49ac8d){if(_0x49ac8d){_0x4cc682=_0x49ac8d;_0x2f1264[_0xf392('0x47')]=_[_0xf392('0x67')](db[_0xf392('0xe6')][_0xf392('0x43')]);_0x2f1264[_0xf392('0x48')]=_['keys'](_0x6a59cc[_0xf392('0x48')]);_0x2f1264['filters']=_[_0xf392('0x4a')](_0x2f1264['model'],_0x2f1264[_0xf392('0x48')]);_0x33185b[_0xf392('0x4c')]=_[_0xf392('0x4a')](_0x2f1264[_0xf392('0x47')],qs[_0xf392('0x4b')](_0x6a59cc[_0xf392('0x48')][_0xf392('0x4b')]));_0x33185b[_0xf392('0x4c')]=_0x33185b[_0xf392('0x4c')][_0xf392('0x58')]?_0x33185b[_0xf392('0x4c')]:_0x2f1264['model'];_0x33185b[_0xf392('0x4e')]=qs[_0xf392('0x4f')](_0x6a59cc[_0xf392('0x48')][_0xf392('0x4f')]);_0x33185b[_0xf392('0x50')]=qs[_0xf392('0x49')](_['pick'](_0x6a59cc['query'],_0x2f1264[_0xf392('0x49')]));if(_0x6a59cc[_0xf392('0x48')]['filter']){_0x33185b['where']=_[_0xf392('0x52')](_0x33185b[_0xf392('0x50')],{'$or':_[_0xf392('0x41')](_0x33185b[_0xf392('0x4c')],function(_0x2bcde4){var _0x4c3416={};_0x4c3416[_0x2bcde4]={'$like':'%'+_0x6a59cc[_0xf392('0x48')][_0xf392('0x51')]+'%'};return _0x4c3416;})});}_0x33185b=_[_0xf392('0x52')]({},_0x33185b,_0x6a59cc[_0xf392('0x53')]);return _0x4cc682[_0xf392('0xe5')](_0x33185b);}})[_0xf392('0x20')](function(_0x422ffe){if(_0x422ffe){_0x2afd9f=_0x422ffe[_0xf392('0x58')];if(!_0x6a59cc[_0xf392('0x48')][_0xf392('0x4d')](_0xf392('0x68'))){_0x33185b['limit']=qs[_0xf392('0x31')](_0x6a59cc[_0xf392('0x48')][_0xf392('0x31')]);_0x33185b['offset']=qs[_0xf392('0x2e')](_0x6a59cc[_0xf392('0x48')][_0xf392('0x2e')]);}return _0x4cc682[_0xf392('0xe5')](_0x33185b);}})[_0xf392('0x20')](function(_0x1f136f){if(_0x1f136f){return _0x1f136f?{'count':_0x2afd9f,'rows':_0x1f136f}:null;}})['then'](respondWithResult(_0x4da48e,null))[_0xf392('0x2b')](handleError(_0x4da48e,null));}; \ No newline at end of file +var _0x4b49=['Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','getInteractions','User','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','infobip','groupName','clickatell','redif','DELIVERED','inspect','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','message-id','state','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','SmsAccounts','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','key','keys','filters','intersection','attributes','model','fields','query','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','rows','show','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','SmsAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','ValidationError','updatedAt','ListId','mobile','twilio','From','Body','messageId','skebby','from','sender','text','connectel','message_id','plivo','Text','MessageUUID','results','csc','originatingAddress','segmentedMessage','bandwidth','intelepeer','refid','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList'];(function(_0x5546e4,_0xeecd9f){var _0x4ccd4c=function(_0x148cc0){while(--_0x148cc0){_0x5546e4['push'](_0x5546e4['shift']());}};_0x4ccd4c(++_0xeecd9f);}(_0x4b49,0x130));var _0x94b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b49[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x94b4('0x0'));var rimraf=require(_0x94b4('0x1'));var zipdir=require(_0x94b4('0x2'));var jsonpatch=require(_0x94b4('0x3'));var rp=require(_0x94b4('0x4'));var moment=require('moment');var BPromise=require(_0x94b4('0x5'));var Mustache=require('mustache');var util=require(_0x94b4('0x6'));var path=require(_0x94b4('0x7'));var sox=require('sox');var csv=require(_0x94b4('0x8'));var ejs=require(_0x94b4('0x9'));var fs=require('fs');var fs_extra=require(_0x94b4('0xa'));var _=require('lodash');var squel=require(_0x94b4('0xb'));var crypto=require(_0x94b4('0xc'));var jsforce=require(_0x94b4('0xd'));var deskjs=require(_0x94b4('0xe'));var toCsv=require(_0x94b4('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x94b4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x94b4('0x10'));var as=require(_0x94b4('0x11'));var hardwareService=require(_0x94b4('0x12'));var logger=require(_0x94b4('0x13'))(_0x94b4('0x14'));var utils=require('../../config/utils');var config=require(_0x94b4('0x15'));var licenseUtil=require(_0x94b4('0x16'));var db=require(_0x94b4('0x17'))['db'];config[_0x94b4('0x18')]=_[_0x94b4('0x19')](config[_0x94b4('0x18')],{'host':_0x94b4('0x1a'),'port':0x18eb});var socket=require(_0x94b4('0x1b'))(new Redis(config['redis']));require(_0x94b4('0x1c'))[_0x94b4('0x1d')](socket);var jayson=require(_0x94b4('0x1e'));var client=jayson['client'][_0x94b4('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x3d4da4,_0x400e4d,_0x40e00d,_0x50a9dc){return new BPromise(function(_0x50a085,_0x15d2c2){var _0x81152c=_0x50a9dc||client;return _0x81152c['request'](_0x3d4da4,_0x40e00d)['then'](function(_0x32a347){logger[_0x94b4('0x20')](_0x94b4('0x21'),_0x400e4d,'request\x20sent');logger['debug'](_0x94b4('0x22'),_0x400e4d,_0x94b4('0x23'),JSON[_0x94b4('0x24')](_0x32a347));if(_0x32a347[_0x94b4('0x25')]){if(_0x32a347[_0x94b4('0x25')][_0x94b4('0x26')]===0x1f4){logger['error'](_0x94b4('0x21'),_0x400e4d,_0x32a347[_0x94b4('0x25')][_0x94b4('0x27')]);return _0x15d2c2(_0x32a347[_0x94b4('0x25')][_0x94b4('0x27')]);}logger[_0x94b4('0x25')](_0x94b4('0x21'),_0x400e4d,_0x32a347[_0x94b4('0x25')][_0x94b4('0x27')]);return _0x50a085(_0x32a347[_0x94b4('0x25')][_0x94b4('0x27')]);}else{logger[_0x94b4('0x20')](_0x94b4('0x21'),_0x400e4d,_0x94b4('0x23'));_0x50a085(_0x32a347['result'][_0x94b4('0x27')]);}})[_0x94b4('0x28')](function(_0x481397){logger[_0x94b4('0x25')](_0x94b4('0x21'),_0x400e4d,_0x481397);_0x15d2c2(_0x481397);});});}function respondWithStatusCode(_0x3be498,_0x4ffd1c){_0x4ffd1c=_0x4ffd1c||0xcc;return function(_0x4793b0){if(_0x4793b0){return _0x3be498[_0x94b4('0x29')](_0x4ffd1c);}return _0x3be498[_0x94b4('0x2a')](_0x4ffd1c)['end']();};}function respondWithResult(_0x5e1ad4,_0x182a7a){_0x182a7a=_0x182a7a||0xc8;return function(_0x4285a9){if(_0x4285a9){return _0x5e1ad4['status'](_0x182a7a)[_0x94b4('0x2b')](_0x4285a9);}};}function respondWithFilteredResult(_0x5b96c8,_0x2b75a0){return function(_0x66aeba){if(_0x66aeba){var _0x31d770=typeof _0x2b75a0[_0x94b4('0x2c')]===_0x94b4('0x2d')&&typeof _0x2b75a0['limit']===_0x94b4('0x2d');var _0x51d456=_0x66aeba[_0x94b4('0x2e')];var _0x5d55c8=_0x31d770?0x0:_0x2b75a0[_0x94b4('0x2c')];var _0xe6d265=_0x31d770?_0x66aeba[_0x94b4('0x2e')]:_0x2b75a0[_0x94b4('0x2c')]+_0x2b75a0[_0x94b4('0x2f')];var _0x9da3cb;if(_0xe6d265>=_0x51d456){_0xe6d265=_0x51d456;_0x9da3cb=0xc8;}else{_0x9da3cb=0xce;}_0x5b96c8[_0x94b4('0x2a')](_0x9da3cb);return _0x5b96c8[_0x94b4('0x30')](_0x94b4('0x31'),_0x5d55c8+'-'+_0xe6d265+'/'+_0x51d456)[_0x94b4('0x2b')](_0x66aeba);}return null;};}function patchUpdates(_0x443cba){return function(_0x43072b){try{jsonpatch[_0x94b4('0x32')](_0x43072b,_0x443cba,!![]);}catch(_0x5bd83f){return BPromise[_0x94b4('0x33')](_0x5bd83f);}return _0x43072b['save']();};}function saveUpdates(_0x1b259e,_0x2800d5){return function(_0x5e301d){if(_0x5e301d){return _0x5e301d[_0x94b4('0x34')](_0x1b259e)[_0x94b4('0x35')](function(_0x26a0be){return _0x26a0be;});}return null;};}function removeEntity(_0x2f8e97,_0x59fb9e){return function(_0x47c614){if(_0x47c614){return _0x47c614[_0x94b4('0x36')]()[_0x94b4('0x35')](function(){var _0x7075ff=_0x47c614[_0x94b4('0x37')]({'plain':!![]});var _0x455794=_0x94b4('0x38');return db[_0x94b4('0x39')]['destroy']({'where':{'type':_0x455794,'resourceId':_0x7075ff['id']}})['then'](function(){return _0x47c614;});})['then'](function(){_0x2f8e97[_0x94b4('0x2a')](0xcc)[_0x94b4('0x3a')]();});}};}function handleEntityNotFound(_0x3dfab7,_0x311f38){return function(_0x22561e){if(!_0x22561e){_0x3dfab7[_0x94b4('0x29')](0x194);}return _0x22561e;};}function handleError(_0x168ae5,_0x14fcee){_0x14fcee=_0x14fcee||0x1f4;return function(_0x1f3a5d){logger['error'](_0x1f3a5d[_0x94b4('0x3b')]);if(_0x1f3a5d[_0x94b4('0x3c')]){delete _0x1f3a5d[_0x94b4('0x3c')];}_0x168ae5['status'](_0x14fcee)[_0x94b4('0x3d')](_0x1f3a5d);};}exports[_0x94b4('0x3e')]=function(_0x57ba43,_0x567856){var _0x106ad6={'include':[{'model':db[_0x94b4('0x3f')],'as':_0x94b4('0x40')}]},_0x3cd564={},_0x371dd5={'count':0x0,'rows':[]};var _0x453ee5=_[_0x94b4('0x41')](db[_0x94b4('0x42')][_0x94b4('0x43')],function(_0x1f0491){return{'name':_0x1f0491[_0x94b4('0x44')],'type':_0x1f0491['type'][_0x94b4('0x45')]};});_0x3cd564['model']=_['map'](_0x453ee5,_0x94b4('0x3c'));_0x3cd564['query']=_[_0x94b4('0x46')](_0x57ba43['query']);_0x3cd564[_0x94b4('0x47')]=_[_0x94b4('0x48')](_0x3cd564['model'],_0x3cd564['query']);_0x106ad6[_0x94b4('0x49')]=_[_0x94b4('0x48')](_0x3cd564[_0x94b4('0x4a')],qs[_0x94b4('0x4b')](_0x57ba43[_0x94b4('0x4c')][_0x94b4('0x4b')]));_0x106ad6['attributes']=_0x106ad6[_0x94b4('0x49')][_0x94b4('0x4d')]?_0x106ad6[_0x94b4('0x49')]:_0x3cd564[_0x94b4('0x4a')];if(!_0x57ba43[_0x94b4('0x4c')][_0x94b4('0x4e')](_0x94b4('0x4f'))){_0x106ad6[_0x94b4('0x2f')]=qs[_0x94b4('0x2f')](_0x57ba43[_0x94b4('0x4c')][_0x94b4('0x2f')]);_0x106ad6[_0x94b4('0x2c')]=qs[_0x94b4('0x2c')](_0x57ba43[_0x94b4('0x4c')][_0x94b4('0x2c')]);}_0x106ad6[_0x94b4('0x50')]=qs[_0x94b4('0x51')](_0x57ba43[_0x94b4('0x4c')][_0x94b4('0x51')]);_0x106ad6['where']=qs['filters'](_[_0x94b4('0x52')](_0x57ba43[_0x94b4('0x4c')],_0x3cd564['filters']),_0x453ee5);if(_0x57ba43[_0x94b4('0x4c')][_0x94b4('0x53')]){_0x106ad6[_0x94b4('0x54')]=_[_0x94b4('0x55')](_0x106ad6['where'],{'$or':_[_0x94b4('0x41')](_0x453ee5,function(_0xed2e74){if(_0xed2e74[_0x94b4('0x56')]!=='VIRTUAL'){var _0x40e07c={};_0x40e07c[_0xed2e74[_0x94b4('0x3c')]]={'$like':'%'+_0x57ba43[_0x94b4('0x4c')][_0x94b4('0x53')]+'%'};return _0x40e07c;}})});}_0x106ad6=_['merge']({},_0x106ad6,_0x57ba43[_0x94b4('0x57')]);var _0x16a9ec={'where':_0x106ad6[_0x94b4('0x54')]};return db['SmsAccount'][_0x94b4('0x2e')](_0x16a9ec)['then'](function(_0x48ebe8){_0x371dd5[_0x94b4('0x2e')]=_0x48ebe8;if(_0x57ba43[_0x94b4('0x4c')][_0x94b4('0x58')]){_0x106ad6['include']=[{'all':!![]}];}return db[_0x94b4('0x42')]['findAll'](_0x106ad6);})[_0x94b4('0x35')](function(_0x9c52f3){_0x371dd5[_0x94b4('0x59')]=_0x9c52f3;return _0x371dd5;})[_0x94b4('0x35')](respondWithFilteredResult(_0x567856,_0x106ad6))[_0x94b4('0x28')](handleError(_0x567856,null));};exports[_0x94b4('0x5a')]=function(_0x3553eb,_0x2cfea8){var _0x226d91={'raw':![],'where':{'id':_0x3553eb['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3dc89={};_0x3dc89[_0x94b4('0x4a')]=_['keys'](db[_0x94b4('0x42')][_0x94b4('0x43')]);_0x3dc89['query']=_[_0x94b4('0x46')](_0x3553eb[_0x94b4('0x4c')]);_0x3dc89['filters']=_[_0x94b4('0x48')](_0x3dc89[_0x94b4('0x4a')],_0x3dc89[_0x94b4('0x4c')]);_0x226d91[_0x94b4('0x49')]=_[_0x94b4('0x48')](_0x3dc89[_0x94b4('0x4a')],qs[_0x94b4('0x4b')](_0x3553eb['query'][_0x94b4('0x4b')]));_0x226d91[_0x94b4('0x49')]=_0x226d91[_0x94b4('0x49')][_0x94b4('0x4d')]?_0x226d91[_0x94b4('0x49')]:_0x3dc89[_0x94b4('0x4a')];if(_0x3553eb[_0x94b4('0x4c')][_0x94b4('0x58')]){_0x226d91[_0x94b4('0x5b')]=[{'all':!![]}];}_0x226d91=_[_0x94b4('0x55')]({},_0x226d91,_0x3553eb[_0x94b4('0x57')]);return db[_0x94b4('0x42')][_0x94b4('0x5c')](_0x226d91)['then'](handleEntityNotFound(_0x2cfea8,null))['then'](respondWithResult(_0x2cfea8,null))[_0x94b4('0x28')](handleError(_0x2cfea8,null));};exports['create']=function(_0x1d7626,_0x3bfdbf){return db[_0x94b4('0x42')][_0x94b4('0x5d')](_0x1d7626['body'],{})[_0x94b4('0x35')](function(_0x3e06ad){var _0xe598ad=_0x1d7626[_0x94b4('0x5e')][_0x94b4('0x37')]({'plain':!![]});if(!_0xe598ad)throw new Error(_0x94b4('0x5f'));if(_0xe598ad[_0x94b4('0x60')]===_0x94b4('0x5e')){var _0x564b7e=_0x3e06ad[_0x94b4('0x37')]({'plain':!![]});var _0x462bed=_0x94b4('0x38');return db[_0x94b4('0x61')]['find']({'where':{'name':_0x462bed,'userProfileId':_0xe598ad['userProfileId']},'raw':!![]})[_0x94b4('0x35')](function(_0x1b1718){if(_0x1b1718&&_0x1b1718[_0x94b4('0x62')]===0x0){return db[_0x94b4('0x39')]['create']({'name':_0x564b7e[_0x94b4('0x3c')],'resourceId':_0x564b7e['id'],'type':_0x1b1718[_0x94b4('0x3c')],'sectionId':_0x1b1718['id']},{})[_0x94b4('0x35')](function(){return _0x3e06ad;});}else{return _0x3e06ad;}})[_0x94b4('0x28')](function(_0x22e9b3){logger[_0x94b4('0x25')](_0x94b4('0x63'),_0x22e9b3);throw _0x22e9b3;});}return _0x3e06ad;})['then'](respondWithResult(_0x3bfdbf,0xc9))[_0x94b4('0x28')](handleError(_0x3bfdbf,null));};exports[_0x94b4('0x34')]=function(_0x47b57e,_0x215da9){if(_0x47b57e[_0x94b4('0x64')]['id']){delete _0x47b57e[_0x94b4('0x64')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x47b57e[_0x94b4('0x65')]['id']},'include':[{'model':db['Pause'],'as':_0x94b4('0x40')}]})[_0x94b4('0x35')](handleEntityNotFound(_0x215da9,null))[_0x94b4('0x35')](saveUpdates(_0x47b57e[_0x94b4('0x64')],null))[_0x94b4('0x35')](respondWithResult(_0x215da9,null))['catch'](handleError(_0x215da9,null));};exports[_0x94b4('0x36')]=function(_0x20262b,_0xedf16c){return db[_0x94b4('0x42')][_0x94b4('0x5c')]({'where':{'id':_0x20262b['params']['id']}})[_0x94b4('0x35')](handleEntityNotFound(_0xedf16c,null))[_0x94b4('0x35')](removeEntity(_0xedf16c,null))[_0x94b4('0x28')](handleError(_0xedf16c,null));};exports[_0x94b4('0x66')]=function(_0xcb1e7f,_0x523b83){return db['SmsAccount'][_0x94b4('0x66')]()[_0x94b4('0x35')](respondWithResult(_0x523b83,null))[_0x94b4('0x28')](handleError(_0x523b83,null));};exports['addDisposition']=function(_0x4ddfd5,_0x285863,_0x4018ce){if(_0x4ddfd5[_0x94b4('0x64')]['id']){delete _0x4ddfd5[_0x94b4('0x64')]['id'];}return db[_0x94b4('0x42')][_0x94b4('0x5c')]({'where':{'id':_0x4ddfd5[_0x94b4('0x65')]['id']}})[_0x94b4('0x35')](handleEntityNotFound(_0x285863,null))[_0x94b4('0x35')](function(_0x2bc1b7){if(_0x2bc1b7){_0x4ddfd5[_0x94b4('0x64')][_0x94b4('0x67')]=_0x2bc1b7['id'];return db[_0x94b4('0x68')][_0x94b4('0x5d')](_0x4ddfd5[_0x94b4('0x64')]);}})['then'](respondWithResult(_0x285863,null))[_0x94b4('0x28')](handleError(_0x285863,null));};exports[_0x94b4('0x69')]=function(_0x5b300d,_0x1f1966,_0x31e79d){var _0x4f25c2={'raw':![],'where':{}};var _0x7412ae={};var _0x576950={'count':0x0,'rows':[]};return db['SmsAccount'][_0x94b4('0x6a')]({'where':{'id':_0x5b300d[_0x94b4('0x65')]['id']}})[_0x94b4('0x35')](handleEntityNotFound(_0x1f1966,null))[_0x94b4('0x35')](function(_0x18f8fe){if(_0x18f8fe){_0x7412ae[_0x94b4('0x4a')]=_['keys'](db['Disposition'][_0x94b4('0x43')]);_0x7412ae[_0x94b4('0x4c')]=_[_0x94b4('0x46')](_0x5b300d['query']);_0x7412ae[_0x94b4('0x47')]=_[_0x94b4('0x48')](_0x7412ae[_0x94b4('0x4a')],_0x7412ae[_0x94b4('0x4c')]);_0x4f25c2['attributes']=_[_0x94b4('0x48')](_0x7412ae['model'],qs[_0x94b4('0x4b')](_0x5b300d[_0x94b4('0x4c')][_0x94b4('0x4b')]));_0x4f25c2[_0x94b4('0x49')]=_0x4f25c2[_0x94b4('0x49')][_0x94b4('0x4d')]?_0x4f25c2[_0x94b4('0x49')]:_0x7412ae[_0x94b4('0x4a')];if(!_0x5b300d[_0x94b4('0x4c')][_0x94b4('0x4e')](_0x94b4('0x4f'))){_0x4f25c2['limit']=qs[_0x94b4('0x2f')](_0x5b300d['query'][_0x94b4('0x2f')]);_0x4f25c2['offset']=qs[_0x94b4('0x2c')](_0x5b300d['query']['offset']);}_0x4f25c2[_0x94b4('0x50')]=qs[_0x94b4('0x51')](_0x5b300d[_0x94b4('0x4c')][_0x94b4('0x51')]);_0x4f25c2[_0x94b4('0x54')]=qs[_0x94b4('0x47')](_['pick'](_0x5b300d[_0x94b4('0x4c')],_0x7412ae[_0x94b4('0x47')]));_0x4f25c2[_0x94b4('0x54')][_0x94b4('0x67')]=_0x18f8fe['id'];if(_0x5b300d[_0x94b4('0x4c')]['filter']){_0x4f25c2[_0x94b4('0x54')]=_[_0x94b4('0x55')](_0x4f25c2['where'],{'$or':_['map'](_0x4f25c2['attributes'],function(_0x3252bc){var _0x12c49a={};_0x12c49a[_0x3252bc]={'$like':'%'+_0x5b300d[_0x94b4('0x4c')][_0x94b4('0x53')]+'%'};return _0x12c49a;})});}_0x4f25c2=_[_0x94b4('0x55')]({},_0x4f25c2,_0x5b300d[_0x94b4('0x57')]);return db['Disposition'][_0x94b4('0x2e')]({'where':_0x4f25c2[_0x94b4('0x54')]})[_0x94b4('0x35')](function(_0x37a9b0){_0x576950[_0x94b4('0x2e')]=_0x37a9b0;if(_0x5b300d['query'][_0x94b4('0x58')]){_0x4f25c2[_0x94b4('0x5b')]=[{'all':!![]}];}return db[_0x94b4('0x68')][_0x94b4('0x6b')](_0x4f25c2);})[_0x94b4('0x35')](function(_0x22c60a){_0x576950['rows']=_0x22c60a;return _0x576950;});}})[_0x94b4('0x35')](respondWithFilteredResult(_0x1f1966,_0x4f25c2))[_0x94b4('0x28')](handleError(_0x1f1966,null));};exports[_0x94b4('0x6c')]=function(_0x270ad4,_0x113088,_0x2342a0){return db[_0x94b4('0x42')][_0x94b4('0x5c')]({'where':{'id':_0x270ad4[_0x94b4('0x65')]['id']}})['then'](handleEntityNotFound(_0x113088,null))[_0x94b4('0x35')](function(_0x14a9f4){if(_0x14a9f4){return _0x14a9f4[_0x94b4('0x6c')](_0x270ad4['query'][_0x94b4('0x6d')]);}})[_0x94b4('0x35')](respondWithStatusCode(_0x113088,null))['catch'](handleError(_0x113088,null));};exports[_0x94b4('0x6e')]=function(_0x3a9ae3,_0xb00471,_0xddbdac){if(_0x3a9ae3[_0x94b4('0x64')]['id']){delete _0x3a9ae3[_0x94b4('0x64')]['id'];}return db['SmsAccount'][_0x94b4('0x5c')]({'where':{'id':_0x3a9ae3[_0x94b4('0x65')]['id']}})['then'](handleEntityNotFound(_0xb00471,null))[_0x94b4('0x35')](function(_0x15542a){if(_0x15542a){_0x3a9ae3[_0x94b4('0x64')]['SmsAccountId']=_0x15542a['id'];return db[_0x94b4('0x6f')][_0x94b4('0x5d')](_0x3a9ae3[_0x94b4('0x64')]);}})[_0x94b4('0x35')](respondWithResult(_0xb00471,null))[_0x94b4('0x28')](handleError(_0xb00471,null));};exports[_0x94b4('0x70')]=function(_0x17d4a4,_0x4ff95a,_0x5280bd){var _0x23c055={'raw':![],'where':{}};var _0x53fe24={};var _0x3ee073={'count':0x0,'rows':[]};return db[_0x94b4('0x42')][_0x94b4('0x6a')]({'where':{'id':_0x17d4a4[_0x94b4('0x65')]['id']}})[_0x94b4('0x35')](handleEntityNotFound(_0x4ff95a,null))[_0x94b4('0x35')](function(_0x4e9e54){if(_0x4e9e54){_0x53fe24[_0x94b4('0x4a')]=_[_0x94b4('0x46')](db[_0x94b4('0x6f')][_0x94b4('0x43')]);_0x53fe24[_0x94b4('0x4c')]=_[_0x94b4('0x46')](_0x17d4a4[_0x94b4('0x4c')]);_0x53fe24[_0x94b4('0x47')]=_[_0x94b4('0x48')](_0x53fe24[_0x94b4('0x4a')],_0x53fe24[_0x94b4('0x4c')]);_0x23c055[_0x94b4('0x49')]=_[_0x94b4('0x48')](_0x53fe24[_0x94b4('0x4a')],qs['fields'](_0x17d4a4[_0x94b4('0x4c')]['fields']));_0x23c055['attributes']=_0x23c055['attributes'][_0x94b4('0x4d')]?_0x23c055['attributes']:_0x53fe24[_0x94b4('0x4a')];if(!_0x17d4a4['query']['hasOwnProperty'](_0x94b4('0x4f'))){_0x23c055[_0x94b4('0x2f')]=qs[_0x94b4('0x2f')](_0x17d4a4[_0x94b4('0x4c')][_0x94b4('0x2f')]);_0x23c055['offset']=qs[_0x94b4('0x2c')](_0x17d4a4[_0x94b4('0x4c')][_0x94b4('0x2c')]);}_0x23c055[_0x94b4('0x50')]=qs[_0x94b4('0x51')](_0x17d4a4[_0x94b4('0x4c')][_0x94b4('0x51')]);_0x23c055[_0x94b4('0x54')]=qs['filters'](_[_0x94b4('0x52')](_0x17d4a4['query'],_0x53fe24[_0x94b4('0x47')]));_0x23c055[_0x94b4('0x54')][_0x94b4('0x67')]=_0x4e9e54['id'];if(_0x17d4a4['query']['filter']){_0x23c055[_0x94b4('0x54')]=_[_0x94b4('0x55')](_0x23c055[_0x94b4('0x54')],{'$or':_['map'](_0x23c055[_0x94b4('0x49')],function(_0x2d7270){var _0xe967f2={};_0xe967f2[_0x2d7270]={'$like':'%'+_0x17d4a4[_0x94b4('0x4c')][_0x94b4('0x53')]+'%'};return _0xe967f2;})});}_0x23c055=_[_0x94b4('0x55')]({},_0x23c055,_0x17d4a4[_0x94b4('0x57')]);return db[_0x94b4('0x6f')][_0x94b4('0x2e')]({'where':_0x23c055[_0x94b4('0x54')]})['then'](function(_0x3c1b4e){_0x3ee073[_0x94b4('0x2e')]=_0x3c1b4e;if(_0x17d4a4[_0x94b4('0x4c')]['includeAll']){_0x23c055[_0x94b4('0x5b')]=[{'all':!![]}];}return db[_0x94b4('0x6f')]['findAll'](_0x23c055);})[_0x94b4('0x35')](function(_0x118903){_0x3ee073[_0x94b4('0x59')]=_0x118903;return _0x3ee073;});}})[_0x94b4('0x35')](respondWithFilteredResult(_0x4ff95a,_0x23c055))[_0x94b4('0x28')](handleError(_0x4ff95a,null));};exports[_0x94b4('0x71')]=function(_0x1b3ee8,_0x471da7,_0x549ac2){return db[_0x94b4('0x42')][_0x94b4('0x5c')]({'where':{'id':_0x1b3ee8[_0x94b4('0x65')]['id']}})[_0x94b4('0x35')](handleEntityNotFound(_0x471da7,null))[_0x94b4('0x35')](function(_0xabb7a5){if(_0xabb7a5){return _0xabb7a5[_0x94b4('0x71')](_0x1b3ee8['query'][_0x94b4('0x6d')]);}})[_0x94b4('0x35')](respondWithStatusCode(_0x471da7,null))[_0x94b4('0x28')](handleError(_0x471da7,null));};exports[_0x94b4('0x72')]=function(_0x112c2b,_0x565b45,_0x22d8ec){var _0x1e5d1b={'channel':_0x94b4('0x73')};var _0x276ca6=[];var _0x8b3fb6=[];var _0xc8fae9={};return db[_0x94b4('0x42')]['find']({'where':{'id':_0x112c2b[_0x94b4('0x65')]['id']},'include':[{'model':db[_0x94b4('0x74')],'as':_0x94b4('0x75')}]})[_0x94b4('0x35')](handleEntityNotFound(_0x565b45,null))['then'](function(_0x4d9872){_0x1e5d1b[_0x94b4('0x76')]=_0x4d9872;_0x1e5d1b[_0x94b4('0x77')]=_[_0x94b4('0x78')](_0x4d9872['Applications'],[_0x94b4('0x79')],[_0x94b4('0x7a')]);if(_0x1e5d1b[_0x94b4('0x76')][_0x94b4('0x75')]){delete _0x1e5d1b[_0x94b4('0x76')][_0x94b4('0x75')];}return db[_0x94b4('0x7b')]['describe']();})[_0x94b4('0x35')](function(_0x303739){if(!_0x303739){throw new db['Sequelize'][(_0x94b4('0x7c'))]('no\x20available\x20attributes');}_0x276ca6=_['difference'](_[_0x94b4('0x46')](_0x303739),['createdAt','updatedAt']);_0x8b3fb6=_['difference'](_[_0x94b4('0x46')](_0x303739),['createdAt',_0x94b4('0x7d'),'CompanyId',_0x94b4('0x7e')]);_0x1e5d1b[_0x94b4('0x64')]={'mapKey':_0x94b4('0x7f')};if(_0x1e5d1b[_0x94b4('0x76')][_0x94b4('0x56')]){switch(_0x1e5d1b[_0x94b4('0x76')][_0x94b4('0x56')]){case _0x94b4('0x80'):_0x1e5d1b['body']['from']=_0x112c2b['body'][_0x94b4('0x81')];_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x64')]=_0x112c2b[_0x94b4('0x64')][_0x94b4('0x82')];_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x83')]=_0x112c2b['body']['MessageSid'];break;case _0x94b4('0x84'):_0x1e5d1b['body'][_0x94b4('0x85')]='+'+_0x112c2b[_0x94b4('0x64')][_0x94b4('0x86')];_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x64')]=_0x112c2b[_0x94b4('0x64')][_0x94b4('0x87')];break;case _0x94b4('0x88'):_0x1e5d1b[_0x94b4('0x64')]['from']=_0x112c2b[_0x94b4('0x64')][_0x94b4('0x85')];_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x64')]=_0x112c2b[_0x94b4('0x64')][_0x94b4('0x27')];break;case'clicksend':_0x1e5d1b['body'][_0x94b4('0x85')]=_0x112c2b[_0x94b4('0x64')][_0x94b4('0x85')];_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x64')]=_0x112c2b[_0x94b4('0x64')][_0x94b4('0x64')];_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x83')]=_0x112c2b[_0x94b4('0x64')][_0x94b4('0x89')];break;case _0x94b4('0x8a'):_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x85')]=_0x112c2b['body'][_0x94b4('0x81')];_0x1e5d1b['body'][_0x94b4('0x64')]=_0x112c2b[_0x94b4('0x64')][_0x94b4('0x8b')];_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x83')]=_0x112c2b[_0x94b4('0x64')][_0x94b4('0x8c')];break;case'infobip':_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x85')]='+'+_0x112c2b[_0x94b4('0x64')][_0x94b4('0x8d')][0x0][_0x94b4('0x85')];_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x64')]=_0x112c2b[_0x94b4('0x64')][_0x94b4('0x8d')][0x0][_0x94b4('0x87')];_0x1e5d1b[_0x94b4('0x64')]['messageId']=_0x112c2b[_0x94b4('0x64')][_0x94b4('0x8d')][0x0][_0x94b4('0x83')];break;case _0x94b4('0x8e'):_0x1e5d1b['body']['from']=_0x112c2b[_0x94b4('0x64')][_0x94b4('0x8f')];_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x64')]=_0x112c2b[_0x94b4('0x64')][_0x94b4('0x90')][_0x94b4('0x27')];break;case'clickatell':_0x1e5d1b[_0x94b4('0x64')]['from']=_0x112c2b[_0x94b4('0x64')]['fromNumber'];_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x64')]=_0x112c2b[_0x94b4('0x64')][_0x94b4('0x87')];_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x83')]=_0x112c2b[_0x94b4('0x64')]['replyMessageId'];break;case _0x94b4('0x91'):_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x83')]=_0x112c2b['body'][0x0]['message']['id'];_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x85')]=_0x112c2b[_0x94b4('0x64')][0x0][_0x94b4('0x27')][_0x94b4('0x85')];_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x64')]=_0x112c2b[_0x94b4('0x64')][0x0]['message'][_0x94b4('0x87')];break;case _0x94b4('0x92'):_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x85')]=_0x112c2b['body'][_0x94b4('0x85')];_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x64')]=_0x112c2b[_0x94b4('0x64')][_0x94b4('0x27')];_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x83')]=_0x112c2b[_0x94b4('0x64')][_0x94b4('0x93')];break;}}if(_0x1e5d1b[_0x94b4('0x64')]['id']){delete _0x1e5d1b[_0x94b4('0x64')]['id'];}if(_[_0x94b4('0x94')](_0x1e5d1b['body'][_0x94b4('0x85')])){throw new db[(_0x94b4('0x95'))][(_0x94b4('0x7c'))]('from\x20is\x20mandatory');}if(_[_0x94b4('0x94')](_0x1e5d1b[_0x94b4('0x64')]['body'])||_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x64')]===''){throw new db[(_0x94b4('0x95'))]['ValidationError'](_0x94b4('0x96'));}if(_['isNil'](_0x1e5d1b['body']['mapKey'])){throw new db[(_0x94b4('0x95'))]['ValidationError'](_0x94b4('0x97')+_0x8b3fb6);}if(!_[_0x94b4('0x98')](_0x8b3fb6,_0x1e5d1b[_0x94b4('0x64')]['mapKey'])){throw new db['Sequelize'][(_0x94b4('0x7c'))](_0x94b4('0x99')+_0x8b3fb6);}_0xc8fae9[_0x1e5d1b['body'][_0x94b4('0x9a')]]=_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x85')];return db[_0x94b4('0x9b')][_0x94b4('0x5c')]({'where':{'id':_0x1e5d1b[_0x94b4('0x76')][_0x94b4('0x7e')]},'include':[{'model':db[_0x94b4('0x7b')],'as':_0x94b4('0x9c'),'where':_0xc8fae9,'limit':0x1,'order':[[_0x94b4('0x7d'),_0x94b4('0x9d')]]}]});})[_0x94b4('0x35')](handleEntityNotFound(_0x565b45,null))['then'](function(_0x54be8d){if(_0x54be8d){_0x1e5d1b[_0x94b4('0x9e')]=_[_0x94b4('0x9f')](_0x54be8d,[_0x94b4('0x9c')]);if(_0x54be8d[_0x94b4('0x9c')][_0x94b4('0x4d')]){return _0x54be8d['Contacts'][0x0];}var _0x347276=_[_0x94b4('0x19')](_0x1e5d1b[_0x94b4('0x64')],{'firstName':_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x85')],'ListId':_0x54be8d['id']});_0x347276[_0x1e5d1b[_0x94b4('0x64')]['mapKey']]=_0x1e5d1b[_0x94b4('0x64')]['from'];return db[_0x94b4('0x7b')]['create'](_0x347276,{'fields':_0x276ca6,'raw':!![]});}})['then'](handleEntityNotFound(_0x565b45,null))[_0x94b4('0x35')](function(_0x5bfaa7){if(_0x5bfaa7){_0x1e5d1b[_0x94b4('0xa0')]=_0x5bfaa7;var _0x2b2806={'ContactId':_0x5bfaa7['id'],'phone':_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x85')],'SmsAccountId':_0x112c2b[_0x94b4('0x65')]['id']};var _0x688466={'ContactId':_0x5bfaa7['id'],'SmsAccountId':_0x112c2b['params']['id'],'closed':![]};return db[_0x94b4('0xa1')][_0x94b4('0x5c')]({'where':_0x688466})['then'](function(_0x7c46ca){if(_0x7c46ca){return[_0x7c46ca,![]];}return db[_0x94b4('0xa1')][_0x94b4('0x5d')](_0x2b2806)[_0x94b4('0x35')](function(_0x269f75){return[_0x269f75,!![]];});});}})[_0x94b4('0xa2')](function(_0x1eb70c,_0x1710a3){_0x1e5d1b[_0x94b4('0xa3')]=_0x1eb70c[_0x94b4('0x37')]({'plain':!![]});_0x1e5d1b[_0x94b4('0xa3')][_0x94b4('0xa4')]=![];if(_0x1710a3){if(_0x1e5d1b[_0x94b4('0x76')][_0x94b4('0xa5')]){_0x1e5d1b[_0x94b4('0x77')][_0x94b4('0xa6')]({'id':0x0,'priority':_0x1e5d1b[_0x94b4('0x77')][_0x94b4('0x4d')]+0x1,'app':_0x94b4('0xa7'),'appdata':_0x94b4('0xa8'),'interval':_0x94b4('0xa9')});}_0x1e5d1b[_0x94b4('0xa3')][_0x94b4('0xa4')]=!![];}return db[_0x94b4('0xaa')][_0x94b4('0x5d')]({'phone':_0x1e5d1b['body'][_0x94b4('0x85')],'messageId':_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x83')],'body':_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0x64')],'SmsAccountId':_0x112c2b[_0x94b4('0x65')]['id'],'SmsInteractionId':_0x1eb70c['id'],'direction':'in','ContactId':_0x1eb70c[_0x94b4('0xab')],'AttachmentId':_0x1e5d1b[_0x94b4('0x64')][_0x94b4('0xac')]});})[_0x94b4('0x35')](function(_0x27b946){_0x1e5d1b[_0x94b4('0x27')]=_0x27b946;if(_0x1e5d1b[_0x94b4('0xa3')][_0x94b4('0xad')]){return db['User'][_0x94b4('0x5c')]({'attributes':['id',_0x94b4('0x3c')],'where':{'id':_0x1e5d1b[_0x94b4('0xa3')][_0x94b4('0xad')]}})[_0x94b4('0x35')](function(_0x206d42){if(_0x206d42){_0x1e5d1b['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x94b4('0xae'),'appdata':_0x206d42[_0x94b4('0x3c')]+','+(_0x1e5d1b['account'][_0x94b4('0xaf')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x94b4('0xb0'),_0x94b4('0xb1'),_0x1e5d1b);});}return respondWithRpcPromise(_0x94b4('0xb0'),_0x94b4('0xb1'),_0x1e5d1b);})[_0x94b4('0x35')](function(_0xaddc0b){if(_0xaddc0b){var _0x2c9eb5=0xc8;var _0x204ad3='receiveMessage';logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x204ad3,_0x2c9eb5,_0x94b4('0xb2'));logger[_0x94b4('0xb3')](_0x94b4('0xb4'),_0x204ad3,_0x2c9eb5,_0x94b4('0xb2'),JSON['stringify'](_0xaddc0b));if(_0x1e5d1b[_0x94b4('0x76')][_0x94b4('0x56')]===_0x94b4('0x80')){return _0x565b45[_0x94b4('0x2a')](_0x2c9eb5)['set'](_0x94b4('0xb5'),_0x94b4('0xb6'))[_0x94b4('0x3d')](_0x94b4('0xb7'));}else{return _0x565b45['status'](_0x2c9eb5)[_0x94b4('0x2b')](_0xaddc0b);}}})[_0x94b4('0x28')](handleError(_0x565b45,null));};exports['addApplications']=function(_0x3a3f28,_0x2a8d85){var _0x2a9278=_0x3a3f28[_0x94b4('0x65')]['id'];var _0x1bdd5d=_0x3a3f28[_0x94b4('0x64')];var _0x160d5c=0xc8;var _0x372a23=null;return db[_0x94b4('0xb8')]['transaction']({'isolationLevel':db[_0x94b4('0xb8')][_0x94b4('0xb9')][_0x94b4('0xba')][_0x94b4('0xbb')]},function(_0x39b885){return db[_0x94b4('0x42')][_0x94b4('0x6a')]({'where':{'id':_0x2a9278},'transaction':_0x39b885})[_0x94b4('0x35')](function(_0x4239ef){if(_0x4239ef){return db[_0x94b4('0x74')]['destroy']({'where':{'SmsAccountId':_0x2a9278},'transaction':_0x39b885})[_0x94b4('0x35')](function(){var _0x17e9cb=_[_0x94b4('0x41')](_0x1bdd5d,function(_0x4ba71a){_0x4ba71a[_0x94b4('0x67')]=_0x2a9278;return _0x4ba71a;});return db[_0x94b4('0x74')][_0x94b4('0xbc')](_0x17e9cb,{'transaction':_0x39b885});});}else{_0x160d5c=0x194;_0x372a23=[];}});})[_0x94b4('0x35')](function(){if(_0x160d5c!==0x194){return db[_0x94b4('0x74')][_0x94b4('0xbd')]({'where':{'SmsAccountId':_0x2a9278},'order':_0x94b4('0x79')})['then'](function(_0x264167){_0x372a23=_0x264167;});}})[_0x94b4('0x28')](function(_0x22dd6a){_0x160d5c=0x1f4;logger['error'](_0x22dd6a[_0x94b4('0x3b')]);if(_0x22dd6a[_0x94b4('0x3c')]){delete _0x22dd6a[_0x94b4('0x3c')];}_0x372a23=_0x22dd6a;})['finally'](function(){if(_0x372a23===null){_0x2a8d85['sendStatus'](_0x160d5c);}else{if(_0x160d5c===0x1f4){_0x2a8d85['status'](_0x160d5c)[_0x94b4('0x3d')](_0x372a23);}else{_0x2a8d85[_0x94b4('0x2a')](_0x160d5c)[_0x94b4('0x2b')](_0x372a23);}}});};exports[_0x94b4('0xbe')]=function(_0xdb306f,_0x5e57b3,_0x225dcf){var _0x2068e5={};var _0x3ed176={};var _0x370bbb;var _0x3eff44;return db[_0x94b4('0x42')][_0x94b4('0x6a')]({'where':{'id':_0xdb306f[_0x94b4('0x65')]['id']}})[_0x94b4('0x35')](handleEntityNotFound(_0x5e57b3,null))[_0x94b4('0x35')](function(_0x592696){if(_0x592696){_0x370bbb=_0x592696;_0x3ed176['model']=_[_0x94b4('0x46')](db[_0x94b4('0x74')][_0x94b4('0x43')]);_0x3ed176['query']=_[_0x94b4('0x46')](_0xdb306f[_0x94b4('0x4c')]);_0x3ed176[_0x94b4('0x47')]=_[_0x94b4('0x48')](_0x3ed176[_0x94b4('0x4a')],_0x3ed176[_0x94b4('0x4c')]);_0x2068e5[_0x94b4('0x49')]=_['intersection'](_0x3ed176[_0x94b4('0x4a')],qs[_0x94b4('0x4b')](_0xdb306f['query']['fields']));_0x2068e5[_0x94b4('0x49')]=_0x2068e5[_0x94b4('0x49')][_0x94b4('0x4d')]?_0x2068e5[_0x94b4('0x49')]:_0x3ed176[_0x94b4('0x4a')];_0x2068e5[_0x94b4('0x50')]=qs[_0x94b4('0x51')](_0xdb306f[_0x94b4('0x4c')][_0x94b4('0x51')]);_0x2068e5[_0x94b4('0x54')]=qs[_0x94b4('0x47')](_[_0x94b4('0x52')](_0xdb306f['query'],_0x3ed176[_0x94b4('0x47')]));if(_0xdb306f[_0x94b4('0x4c')]['filter']){_0x2068e5[_0x94b4('0x54')]=_['merge'](_0x2068e5[_0x94b4('0x54')],{'$or':_['map'](_0x2068e5[_0x94b4('0x49')],function(_0x178ee5){var _0x281262={};_0x281262[_0x178ee5]={'$like':'%'+_0xdb306f['query'][_0x94b4('0x53')]+'%'};return _0x281262;})});}_0x2068e5=_[_0x94b4('0x55')]({},_0x2068e5,_0xdb306f[_0x94b4('0x57')]);return _0x370bbb[_0x94b4('0xbe')](_0x2068e5);}})['then'](function(_0x586f6a){if(_0x586f6a){_0x3eff44=_0x586f6a[_0x94b4('0x4d')];if(!_0xdb306f[_0x94b4('0x4c')][_0x94b4('0x4e')]('nolimit')){_0x2068e5[_0x94b4('0x2f')]=qs['limit'](_0xdb306f[_0x94b4('0x4c')]['limit']);_0x2068e5[_0x94b4('0x2c')]=qs[_0x94b4('0x2c')](_0xdb306f[_0x94b4('0x4c')][_0x94b4('0x2c')]);}return _0x370bbb[_0x94b4('0xbe')](_0x2068e5);}})['then'](function(_0x147e7d){if(_0x147e7d){return _0x147e7d?{'count':_0x3eff44,'rows':_0x147e7d}:null;}})['then'](respondWithResult(_0x5e57b3,null))[_0x94b4('0x28')](handleError(_0x5e57b3,null));};exports[_0x94b4('0xbf')]=function(_0x4eb1b2,_0x38fa6a,_0x1c3184){var _0x554961={'raw':![],'where':{}};var _0x2e4178={};var _0x12c147={'count':0x0,'rows':[]};return db[_0x94b4('0x42')][_0x94b4('0x6a')]({'where':{'id':_0x4eb1b2[_0x94b4('0x65')]['id']}})['then'](handleEntityNotFound(_0x38fa6a,null))[_0x94b4('0x35')](function(_0x437d49){if(_0x437d49){_0x2e4178[_0x94b4('0x4a')]=_['keys'](db['SmsInteraction'][_0x94b4('0x43')]);_0x2e4178[_0x94b4('0x4c')]=_['keys'](_0x4eb1b2[_0x94b4('0x4c')]);_0x2e4178[_0x94b4('0x47')]=_[_0x94b4('0x48')](_0x2e4178[_0x94b4('0x4a')],_0x2e4178[_0x94b4('0x4c')]);_0x554961[_0x94b4('0x49')]=_['intersection'](_0x2e4178['model'],qs[_0x94b4('0x4b')](_0x4eb1b2[_0x94b4('0x4c')][_0x94b4('0x4b')]));_0x554961[_0x94b4('0x49')]=_0x554961[_0x94b4('0x49')][_0x94b4('0x4d')]?_0x554961[_0x94b4('0x49')]:_0x2e4178['model'];if(!_0x4eb1b2[_0x94b4('0x4c')][_0x94b4('0x4e')](_0x94b4('0x4f'))){_0x554961['limit']=qs['limit'](_0x4eb1b2[_0x94b4('0x4c')][_0x94b4('0x2f')]);_0x554961['offset']=qs[_0x94b4('0x2c')](_0x4eb1b2['query']['offset']);}_0x554961['order']=qs[_0x94b4('0x51')](_0x4eb1b2[_0x94b4('0x4c')]['sort']);_0x554961['where']=qs[_0x94b4('0x47')](_[_0x94b4('0x52')](_0x4eb1b2[_0x94b4('0x4c')],_0x2e4178[_0x94b4('0x47')]));_0x554961[_0x94b4('0x54')]['SmsAccountId']=_0x437d49['id'];if(_0x4eb1b2['query']['filter']){_0x554961[_0x94b4('0x54')]=_['merge'](_0x554961['where'],{'$or':_[_0x94b4('0x41')](_0x554961['attributes'],function(_0x38097b){var _0x4dcfad={};_0x4dcfad[_0x38097b]={'$like':'%'+_0x4eb1b2[_0x94b4('0x4c')][_0x94b4('0x53')]+'%'};return _0x4dcfad;})});}_0x554961=_['merge']({},_0x554961,_0x4eb1b2['options']);return db[_0x94b4('0xa1')]['count']({'where':_0x554961[_0x94b4('0x54')]})[_0x94b4('0x35')](function(_0x3924bd){_0x12c147[_0x94b4('0x2e')]=_0x3924bd;if(_0x4eb1b2[_0x94b4('0x4c')]['includeAll']){_0x554961[_0x94b4('0x5b')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x94b4('0xc0')],'as':_0x94b4('0xc1'),'attributes':['name',_0x94b4('0xc2'),_0x94b4('0xc3')],'required':![]},{'model':db[_0x94b4('0xc4')],'as':_0x94b4('0xc5'),'attributes':['id',_0x94b4('0x3c'),_0x94b4('0xc6')],'where':_0x4eb1b2[_0x94b4('0x4c')]['tag']?{'id':_0x4eb1b2['query'][_0x94b4('0xc7')]}:undefined,'required':_0x4eb1b2[_0x94b4('0x4c')][_0x94b4('0xc7')]?!![]:![]}];}return db[_0x94b4('0xa1')][_0x94b4('0x6b')](_0x554961);})[_0x94b4('0x35')](function(_0x437f91){_0x12c147[_0x94b4('0x59')]=_0x437f91;return _0x12c147;});}})[_0x94b4('0x35')](respondWithFilteredResult(_0x38fa6a,_0x554961))[_0x94b4('0x28')](handleError(_0x38fa6a,null));};exports['send']=function(_0x49a143,_0x3de338,_0x42815c){var _0x165606,_0x58f556,_0x2b2507;if(_[_0x94b4('0x94')](_0x49a143[_0x94b4('0x64')][_0x94b4('0x64')])||_0x49a143[_0x94b4('0x64')][_0x94b4('0x64')]===''){throw new db[(_0x94b4('0x95'))]['ValidationError'](_0x94b4('0x96'));}if(_[_0x94b4('0x94')](_0x49a143[_0x94b4('0x64')]['to'])){throw new db[(_0x94b4('0x95'))][(_0x94b4('0x7c'))](_0x94b4('0xc8'));}_0x165606=_0x49a143[_0x94b4('0x64')]['to'];return db[_0x94b4('0x42')][_0x94b4('0x5c')]({'where':{'id':_0x49a143[_0x94b4('0x65')]['id']},'include':[{'model':db['CmList'],'as':_0x94b4('0xc9'),'include':[{'model':db['CmContact'],'as':_0x94b4('0x9c'),'where':{'mobile':_0x165606},'limit':0x1,'order':[[_0x94b4('0x7d'),_0x94b4('0x9d')]]}]}]})[_0x94b4('0x35')](handleEntityNotFound(_0x3de338,null))['then'](function(_0x36265e){if(_0x36265e&&_0x36265e[_0x94b4('0xc9')]){_0x58f556=_0x36265e[_0x94b4('0x37')]({'plain':!![]});if(_0x58f556[_0x94b4('0xc9')]&&_0x58f556[_0x94b4('0xc9')]['Contacts'][_0x94b4('0x4d')]){return _0x58f556[_0x94b4('0xc9')][_0x94b4('0x9c')][0x0];}return db[_0x94b4('0x7b')][_0x94b4('0x5d')](_[_0x94b4('0x19')](_0x49a143[_0x94b4('0x64')],{'firstName':_0x165606,'mobile':_0x165606,'phone':_0x165606,'ListId':_0x58f556[_0x94b4('0x7e')]}));}})['then'](handleEntityNotFound(_0x3de338,null))['then'](function(_0xe848a8){if(_0xe848a8){_0x2b2507=_0xe848a8;return db[_0x94b4('0xa1')]['find']({'where':{'ContactId':_0x2b2507['id'],'closed':![],'SmsAccountId':_0x58f556['id']}})[_0x94b4('0x35')](function(_0xf3788b){if(_0xf3788b){return[_0xf3788b,![]];}return db['SmsInteraction'][_0x94b4('0x5d')]({'UserId':_0x49a143[_0x94b4('0x5e')]['id'],'ContactId':_0x2b2507['id'],'SmsAccountId':_0x58f556['id'],'phone':_0x165606,'firstMsgDirection':_0x94b4('0xca'),'Messages':[_[_0x94b4('0x55')](_0x49a143[_0x94b4('0x64')],{'read':![],'body':_0x49a143[_0x94b4('0x64')][_0x94b4('0x64')],'phone':_0x165606,'SmsAccountId':_0x58f556['id'],'UserId':_0x49a143[_0x94b4('0x5e')]['id'],'ContactId':_0x2b2507['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x94b4('0xcb')}]})['then'](function(_0x2a0d26){return[_0x2a0d26,!![]];});});}})[_0x94b4('0xa2')](function(_0xdd34b3,_0x56797f){if(_0x56797f){return _0xdd34b3;}return db['SmsMessage']['create'](_['merge'](_0x49a143['body'],{'read':![],'body':_0x49a143['body'][_0x94b4('0x64')],'phone':_0x165606,'SmsAccountId':_0x58f556['id'],'SmsInteractionId':_0xdd34b3['id'],'UserId':_0x49a143[_0x94b4('0x5e')]['id'],'ContactId':_0x2b2507['id']}))[_0x94b4('0x35')](function(_0xae38ac){_0xdd34b3['dataValues'][_0x94b4('0xcb')]=[];_0xdd34b3[_0x94b4('0xcc')][_0x94b4('0xcb')][_0x94b4('0xa6')](_0xae38ac['dataValues']);return _0xdd34b3;});})[_0x94b4('0x35')](respondWithResult(_0x3de338,null))[_0x94b4('0x28')](handleError(_0x3de338,null));};exports[_0x94b4('0x2a')]=function(_0x1e1873,_0x2749f8,_0x3f5834){if(_0x1e1873['body']['id']){delete _0x1e1873['body']['id'];}var _0x4f656e,_0x4f2813,_0x2e16a6;return db[_0x94b4('0x42')][_0x94b4('0x5c')]({'where':{'id':_0x1e1873[_0x94b4('0x65')]['id']}})['then'](handleEntityNotFound(_0x2749f8,null))[_0x94b4('0x35')](function(_0x15680c){if(_0x15680c){_0x2e16a6=_0x15680c;logger[_0x94b4('0xb3')](_0x94b4('0x22'),_0x94b4('0x2a'),_0x94b4('0xcd'),_0x15680c[_0x94b4('0x56')],util['inspect'](_0x1e1873[_0x94b4('0x64')],{'showHidden':![],'depth':null}));switch(_0x15680c['type']){case _0x94b4('0x84'):if(_0x1e1873[_0x94b4('0x64')][_0x94b4('0xce')]&&_0x1e1873['body'][_0x94b4('0x2a')]){_0x4f2813=_0x1e1873[_0x94b4('0x64')]['status'];return db[_0x94b4('0xaa')][_0x94b4('0x5c')]({'where':{'messageId':_0x1e1873[_0x94b4('0x64')][_0x94b4('0xce')]}});}break;case _0x94b4('0x88'):if(_0x1e1873['body'][_0x94b4('0xcf')]&&_0x1e1873[_0x94b4('0x64')][_0x94b4('0xd0')]){_0x4f2813=_0x1e1873['body'][_0x94b4('0xd0')];return db[_0x94b4('0xaa')][_0x94b4('0x5c')]({'where':{'messageId':_0x1e1873[_0x94b4('0x64')]['requestid']}});}break;case _0x94b4('0xd1'):if(_0x1e1873[_0x94b4('0x64')]['message_id']&&_0x1e1873[_0x94b4('0x64')][_0x94b4('0xd2')]){_0x4f2813=_0x1e1873[_0x94b4('0x64')][_0x94b4('0xd2')];return db[_0x94b4('0xaa')][_0x94b4('0x5c')]({'where':{'messageId':_0x1e1873['body'][_0x94b4('0x89')]}});}break;case _0x94b4('0xd3'):var _0x77af98=_0x1e1873[_0x94b4('0x64')][_0x94b4('0x8d')][0x0];if(_0x77af98[_0x94b4('0x83')]&&_0x77af98[_0x94b4('0x2a')][_0x94b4('0xd4')]==='DELIVERED'){_0x4f2813=_0x77af98[_0x94b4('0x2a')][_0x94b4('0xd4')];return db[_0x94b4('0xaa')]['find']({'where':{'messageId':_0x77af98[_0x94b4('0x83')]}});}break;case _0x94b4('0xd5'):if(_0x1e1873[_0x94b4('0x64')][_0x94b4('0x83')]&&_0x1e1873[_0x94b4('0x64')][_0x94b4('0x2a')]){_0x4f2813=_0x1e1873[_0x94b4('0x64')][_0x94b4('0x2a')];return db[_0x94b4('0xaa')][_0x94b4('0x5c')]({'where':{'messageId':_0x1e1873[_0x94b4('0x64')][_0x94b4('0x83')]}});}break;case _0x94b4('0x91'):if(_0x1e1873[_0x94b4('0x64')][0x0][_0x94b4('0x27')]['id']){_0x4f2813=_0x1e1873[_0x94b4('0x64')][0x0][_0x94b4('0x56')];return db[_0x94b4('0xaa')][_0x94b4('0x5c')]({'where':{'messageId':_0x1e1873['body'][0x0][_0x94b4('0x27')]['id']}});}break;case _0x94b4('0x92'):if(_0x1e1873['body']['redif']&&_0x1e1873[_0x94b4('0x64')][_0x94b4('0x2a')]){_0x4f2813=_0x1e1873[_0x94b4('0x64')]['status'];return db[_0x94b4('0xaa')][_0x94b4('0x5c')]({'where':{'messageId':_0x1e1873[_0x94b4('0x64')][_0x94b4('0xd6')]}});}break;}}})[_0x94b4('0x35')](handleEntityNotFound(_0x2749f8,null))[_0x94b4('0x35')](function(_0x17e703){if(_0x17e703){_0x4f656e=_0x17e703;switch(_0x2e16a6['type']){case _0x94b4('0x84'):if(_0x4f2813===_0x94b4('0xd7')){return _0x4f656e[_0x94b4('0x34')]({'read':!![]});}else{logger['error'](_0x94b4('0x22'),_0x94b4('0x2a'),'skebby',util[_0x94b4('0xd8')](_0x1e1873[_0x94b4('0x64')],{'showHidden':![],'depth':null}));}break;case _0x94b4('0x88'):if(_0x4f2813==='1'){return _0x4f656e[_0x94b4('0x34')]({'read':!![]});}else{logger[_0x94b4('0x25')](_0x94b4('0x22'),_0x94b4('0x2a'),'skebby',util[_0x94b4('0xd8')](_0x1e1873[_0x94b4('0x64')],{'showHidden':![],'depth':null}));}break;case _0x94b4('0xd1'):if(!_0x1e1873[_0x94b4('0x64')]['error_code']&&_0x4f2813>=0xc8&&_0x4f2813<=0xce){return _0x4f656e[_0x94b4('0x34')]({'read':!![]});}else{logger['error'](_0x94b4('0x22'),'status','clicksend',util['inspect'](_0x1e1873['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1183f8=_0x1e1873[_0x94b4('0x64')][_0x94b4('0x8d')][0x0];if(_0x1183f8[_0x94b4('0x2a')][_0x94b4('0xd4')]===_0x94b4('0xd7')){return _0x4f656e[_0x94b4('0x34')]({'read':!![]});}else{logger[_0x94b4('0x25')](_0x94b4('0x22'),'status',_0x94b4('0xd3'),util['inspect'](_0x1e1873['body'],{'showHidden':![],'depth':null}));}break;case _0x94b4('0xd5'):if(_0x4f2813==_0x94b4('0xd9')||_0x4f2813==_0x94b4('0xda')){return _0x4f656e[_0x94b4('0x34')]({'read':!![]});}else{logger[_0x94b4('0x25')](_0x94b4('0x22'),'status',_0x94b4('0xd5'),util[_0x94b4('0xd8')](_0x1e1873[_0x94b4('0x64')],{'showHidden':![],'depth':null}));}break;case _0x94b4('0x91'):if(_0x4f2813==_0x94b4('0xdb')){return _0x4f656e[_0x94b4('0x34')]({'read':!![]});}else{logger[_0x94b4('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x94b4('0x2a'),_0x94b4('0x91'),util[_0x94b4('0xd8')](_0x1e1873[_0x94b4('0x64')],{'showHidden':![],'depth':null}));}break;case _0x94b4('0x92'):if(_0x4f2813===_0x94b4('0xdc')||_0x4f2813==='ACCEPTD'){return _0x4f656e[_0x94b4('0x34')]({'read':!![]});}else{logger['error'](_0x94b4('0x22'),_0x94b4('0x2a'),'intelepeer',util['inspect'](_0x1e1873['body'],{'showHidden':![],'depth':null}));}break;}return _0x4f656e;}})[_0x94b4('0x35')](respondWithResult(_0x2749f8,null))['catch'](handleError(_0x2749f8,null));};exports[_0x94b4('0xdd')]=function(_0x267ca9,_0x35a2fc,_0x34587b){var _0x56a080,_0xe416ce,_0x532198;return db[_0x94b4('0x42')][_0x94b4('0x5c')]({'where':{'id':_0x267ca9[_0x94b4('0x65')]['id']}})[_0x94b4('0x35')](handleEntityNotFound(_0x35a2fc,null))['then'](function(_0x3b3e39){if(_0x3b3e39){_0x532198=_0x3b3e39;logger[_0x94b4('0xb3')](_0x94b4('0x22'),'status',_0x94b4('0xcd'),_0x3b3e39[_0x94b4('0x56')],util[_0x94b4('0xd8')](_0x267ca9[_0x94b4('0x4c')],{'showHidden':![],'depth':null}));switch(_0x3b3e39['type']){case'csc':if(_0x267ca9[_0x94b4('0x4c')][_0x94b4('0xde')]&&_0x267ca9['query'][_0x94b4('0xdf')]){_0xe416ce=_0x267ca9['query'][_0x94b4('0xdf')];return db['SmsMessage']['find']({'where':{'messageId':_0x267ca9['query'][_0x94b4('0xde')]}});}break;}}})[_0x94b4('0x35')](handleEntityNotFound(_0x35a2fc,null))['then'](function(_0x448232){if(_0x448232){_0x56a080=_0x448232;switch(_0x532198[_0x94b4('0x56')]){case _0x94b4('0x8e'):if(_0xe416ce==='2'||_0xe416ce==='6'){return _0x56a080[_0x94b4('0x34')]({'read':!![]});}else{logger[_0x94b4('0x25')](_0x94b4('0x22'),_0x94b4('0x2a'),'csc',util['inspect'](_0x267ca9[_0x94b4('0x4c')],{'showHidden':![],'depth':null}));};break;}return _0x56a080;}})[_0x94b4('0x35')](respondWithResult(_0x35a2fc,null))[_0x94b4('0x28')](handleError(_0x35a2fc,null));};exports[_0x94b4('0xe0')]=function(_0x21cd20,_0x36a04d,_0x1653a7){return db[_0x94b4('0x42')][_0x94b4('0x5c')]({'where':{'id':_0x21cd20[_0x94b4('0x65')]['id']}})['then'](handleEntityNotFound(_0x36a04d,null))['then'](function(_0x54c7e1){if(_0x54c7e1){return _0x54c7e1[_0x94b4('0xe0')](_0x21cd20['body'][_0x94b4('0x6d')],_[_0x94b4('0x9f')](_0x21cd20[_0x94b4('0x64')],[_0x94b4('0x6d'),'id'])||{})[_0x94b4('0xa2')](function(_0x38f305){for(var _0x1b0bec=0x0;_0x1b0bec<_0x21cd20['body']['ids'][_0x94b4('0x4d')];_0x1b0bec+=0x1){socket[_0x94b4('0xe1')]('userSmsAccount:save',{'UserId':Number(_0x21cd20['body'][_0x94b4('0x6d')][_0x1b0bec]),'SmsAccountId':Number(_0x21cd20[_0x94b4('0x65')]['id'])});}return _0x38f305;});}})[_0x94b4('0x35')](respondWithResult(_0x36a04d,null))[_0x94b4('0x28')](handleError(_0x36a04d,null));};exports['removeAgents']=function(_0x272fc5,_0x1bdd61,_0x3c7151){return db[_0x94b4('0x42')][_0x94b4('0x5c')]({'where':{'id':_0x272fc5[_0x94b4('0x65')]['id']}})[_0x94b4('0x35')](handleEntityNotFound(_0x1bdd61,null))[_0x94b4('0x35')](function(_0x5e654b){if(_0x5e654b){return _0x5e654b[_0x94b4('0xe2')](_0x272fc5[_0x94b4('0x4c')][_0x94b4('0x6d')])[_0x94b4('0x35')](function(){if(_[_0x94b4('0xe3')](_0x272fc5[_0x94b4('0x4c')]['ids'])){for(var _0x2a807e=0x0;_0x2a807e<_0x272fc5[_0x94b4('0x4c')]['ids'][_0x94b4('0x4d')];_0x2a807e+=0x1){socket[_0x94b4('0xe1')](_0x94b4('0xe4'),{'UserId':Number(_0x272fc5[_0x94b4('0x4c')][_0x94b4('0x6d')][_0x2a807e]),'SmsAccountId':Number(_0x272fc5[_0x94b4('0x65')]['id'])});}}else{socket[_0x94b4('0xe1')]('userSmsAccount:remove',{'UserId':Number(_0x272fc5['query'][_0x94b4('0x6d')]),'SmsAccountId':Number(_0x272fc5[_0x94b4('0x65')]['id'])});}});}})[_0x94b4('0x35')](respondWithStatusCode(_0x1bdd61,null))['catch'](handleError(_0x1bdd61,null));};exports[_0x94b4('0xe5')]=function(_0x119da8,_0x4b8fe3,_0x2e191a){var _0x413102={};var _0x16b1b5={};var _0x3becd6;var _0x5aac52;return db[_0x94b4('0x42')][_0x94b4('0x6a')]({'where':{'id':_0x119da8[_0x94b4('0x65')]['id']}})[_0x94b4('0x35')](handleEntityNotFound(_0x4b8fe3,null))[_0x94b4('0x35')](function(_0x5f268d){if(_0x5f268d){_0x3becd6=_0x5f268d;_0x16b1b5['model']=_[_0x94b4('0x46')](db[_0x94b4('0xc0')][_0x94b4('0x43')]);_0x16b1b5['query']=_[_0x94b4('0x46')](_0x119da8['query']);_0x16b1b5[_0x94b4('0x47')]=_[_0x94b4('0x48')](_0x16b1b5['model'],_0x16b1b5['query']);_0x413102[_0x94b4('0x49')]=_[_0x94b4('0x48')](_0x16b1b5[_0x94b4('0x4a')],qs[_0x94b4('0x4b')](_0x119da8[_0x94b4('0x4c')]['fields']));_0x413102[_0x94b4('0x49')]=_0x413102[_0x94b4('0x49')][_0x94b4('0x4d')]?_0x413102[_0x94b4('0x49')]:_0x16b1b5['model'];_0x413102[_0x94b4('0x50')]=qs[_0x94b4('0x51')](_0x119da8['query'][_0x94b4('0x51')]);_0x413102['where']=qs[_0x94b4('0x47')](_[_0x94b4('0x52')](_0x119da8[_0x94b4('0x4c')],_0x16b1b5[_0x94b4('0x47')]));if(_0x119da8[_0x94b4('0x4c')][_0x94b4('0x53')]){_0x413102['where']=_[_0x94b4('0x55')](_0x413102['where'],{'$or':_['map'](_0x413102[_0x94b4('0x49')],function(_0x3f5ff3){var _0x4b0c8b={};_0x4b0c8b[_0x3f5ff3]={'$like':'%'+_0x119da8[_0x94b4('0x4c')][_0x94b4('0x53')]+'%'};return _0x4b0c8b;})});}_0x413102=_[_0x94b4('0x55')]({},_0x413102,_0x119da8[_0x94b4('0x57')]);return _0x3becd6[_0x94b4('0xe5')](_0x413102);}})[_0x94b4('0x35')](function(_0x122dde){if(_0x122dde){_0x5aac52=_0x122dde[_0x94b4('0x4d')];if(!_0x119da8[_0x94b4('0x4c')][_0x94b4('0x4e')](_0x94b4('0x4f'))){_0x413102[_0x94b4('0x2f')]=qs[_0x94b4('0x2f')](_0x119da8[_0x94b4('0x4c')]['limit']);_0x413102['offset']=qs[_0x94b4('0x2c')](_0x119da8[_0x94b4('0x4c')][_0x94b4('0x2c')]);}return _0x3becd6[_0x94b4('0xe5')](_0x413102);}})[_0x94b4('0x35')](function(_0x252f6f){if(_0x252f6f){return _0x252f6f?{'count':_0x5aac52,'rows':_0x252f6f}:null;}})[_0x94b4('0x35')](respondWithResult(_0x4b8fe3,null))['catch'](handleError(_0x4b8fe3,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 88bac61..31f412d 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 _0x3218=['save','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x280ae7,_0x456fb1){var _0x418b9e=function(_0x4d730d){while(--_0x4d730d){_0x280ae7['push'](_0x280ae7['shift']());}};_0x418b9e(++_0x456fb1);}(_0x3218,0xed));var _0x8321=function(_0x3aeb36,_0x312dc9){_0x3aeb36=_0x3aeb36-0x0;var _0xa2ef21=_0x3218[_0x3aeb36];return _0xa2ef21;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x8321('0x0'))['db'][_0x8321('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x8321('0x2')](0x0);var events={'afterCreate':_0x8321('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4e07b6){return function(_0x94dc8,_0x2e466a,_0x2d6927){SmsAccountEvents[_0x8321('0x4')](_0x4e07b6+':'+_0x94dc8['id'],_0x94dc8);SmsAccountEvents['emit'](_0x4e07b6,_0x94dc8);_0x2d6927(null);};}for(var e in events){if(events[_0x8321('0x5')](e)){var event=events[e];SmsAccount[_0x8321('0x6')](e,emitEvent(event));}}module[_0x8321('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x1903=['save','update','emit','exports','events','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x118044,_0x4cdd67){var _0x3042d2=function(_0x293bd3){while(--_0x293bd3){_0x118044['push'](_0x118044['shift']());}};_0x3042d2(++_0x4cdd67);}(_0x1903,0x104));var _0x3190=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1903[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x3190('0x0'));var SmsAccount=require(_0x3190('0x1'))['db'][_0x3190('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x3190('0x3')](0x0);var events={'afterCreate':_0x3190('0x4'),'afterUpdate':_0x3190('0x5'),'afterDestroy':'remove'};function emitEvent(_0x19c0b6){return function(_0x358ee6,_0x205937,_0x1258ca){SmsAccountEvents[_0x3190('0x6')](_0x19c0b6+':'+_0x358ee6['id'],_0x358ee6);SmsAccountEvents['emit'](_0x19c0b6,_0x358ee6);_0x1258ca(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x3190('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index e7e2ab0..0fe3584 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 _0xa30d=['sms_accounts','lodash','../../config/logger','moment','request-promise','../../config/environment','./smsAccount.attributes','exports','SmsAccount'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa30d,0x64));var _0xda30=function(_0x33c8ea,_0x4c2ec3){_0x33c8ea=_0x33c8ea-0x0;var _0x33c390=_0xa30d[_0x33c8ea];return _0x33c390;};'use strict';var _=require(_0xda30('0x0'));var util=require('util');var logger=require(_0xda30('0x1'))('api');var moment=require(_0xda30('0x2'));var BPromise=require('bluebird');var rp=require(_0xda30('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xda30('0x4'));var attributes=require(_0xda30('0x5'));module[_0xda30('0x6')]=function(_0x1a3f47,_0x41e210){return _0x1a3f47['define'](_0xda30('0x7'),attributes,{'tableName':_0xda30('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d6a=['request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','sms_accounts','util','moment','bluebird'];(function(_0x230632,_0x582fc6){var _0x43d9b5=function(_0x42888a){while(--_0x42888a){_0x230632['push'](_0x230632['shift']());}};_0x43d9b5(++_0x582fc6);}(_0x9d6a,0x189));var _0xa9d6=function(_0xb69de9,_0x85925f){_0xb69de9=_0xb69de9-0x0;var _0x3f89bb=_0x9d6a[_0xb69de9];return _0x3f89bb;};'use strict';var _=require('lodash');var util=require(_0xa9d6('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa9d6('0x1'));var BPromise=require(_0xa9d6('0x2'));var rp=require(_0xa9d6('0x3'));var fs=require('fs');var path=require(_0xa9d6('0x4'));var rimraf=require(_0xa9d6('0x5'));var config=require(_0xa9d6('0x6'));var attributes=require(_0xa9d6('0x7'));module[_0xa9d6('0x8')]=function(_0x417973,_0x32bf87){return _0x417973[_0xa9d6('0x9')]('SmsAccount',attributes,{'tableName':_0xa9d6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 22d7df7..2734bb9 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 _0x5c04=['request','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','SmsAccount','find','options','where','attributes','map','include','model','then','ShowSmsAccount','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','./smsAccount.socket'];(function(_0x558d7a,_0x40f16b){var _0x3ba1d1=function(_0x1cafbe){while(--_0x1cafbe){_0x558d7a['push'](_0x558d7a['shift']());}};_0x3ba1d1(++_0x40f16b);}(_0x5c04,0x11d));var _0x45c0=function(_0x5edd03,_0x5f31ea){_0x5edd03=_0x5edd03-0x0;var _0x131dc9=_0x5c04[_0x5edd03];return _0x131dc9;};'use strict';var _=require(_0x45c0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x45c0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x45c0('0x2'))['db'];var utils=require(_0x45c0('0x3'));var logger=require(_0x45c0('0x4'))('rpc');var config=require(_0x45c0('0x5'));var jayson=require(_0x45c0('0x6'));var client=jayson[_0x45c0('0x7')][_0x45c0('0x8')]({'port':0x232a});config['redis']=_[_0x45c0('0x9')](config[_0x45c0('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x45c0('0xa')]));require(_0x45c0('0xb'))['register'](socket);function respondWithRpcPromise(_0x538a20,_0x3f31dc,_0x157f33){return new BPromise(function(_0xb2ac1e,_0xbac26){return client[_0x45c0('0xc')](_0x538a20,_0x157f33)['then'](function(_0x258819){logger['info'](_0x45c0('0xd'),_0x3f31dc,_0x45c0('0xe'));logger[_0x45c0('0xf')](_0x45c0('0x10'),_0x3f31dc,_0x45c0('0xe'),JSON[_0x45c0('0x11')](_0x258819));if(_0x258819[_0x45c0('0x12')]){if(_0x258819[_0x45c0('0x12')][_0x45c0('0x13')]===0x1f4){logger[_0x45c0('0x12')](_0x45c0('0xd'),_0x3f31dc,_0x258819[_0x45c0('0x12')]['message']);return _0xbac26(_0x258819[_0x45c0('0x12')][_0x45c0('0x14')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x3f31dc,_0x258819[_0x45c0('0x12')][_0x45c0('0x14')]);return _0xb2ac1e(_0x258819[_0x45c0('0x12')]['message']);}else{logger[_0x45c0('0x15')]('SmsAccount,\x20%s,\x20%s',_0x3f31dc,_0x45c0('0xe'));_0xb2ac1e(_0x258819['result'][_0x45c0('0x14')]);}})[_0x45c0('0x16')](function(_0x13cdbe){logger[_0x45c0('0x12')]('SmsAccount,\x20%s,\x20%s',_0x3f31dc,_0x13cdbe);_0xbac26(_0x13cdbe);});});}exports['ShowSmsAccount']=function(_0x1ff36d){var _0x492faf=this;return new Promise(function(_0xcfd9dd,_0x3d466a){return db[_0x45c0('0x17')][_0x45c0('0x18')]({'raw':_0x1ff36d[_0x45c0('0x19')]?_0x1ff36d[_0x45c0('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1ff36d[_0x45c0('0x19')]?_0x1ff36d[_0x45c0('0x19')][_0x45c0('0x1a')]||null:null,'attributes':_0x1ff36d[_0x45c0('0x19')]?_0x1ff36d[_0x45c0('0x19')][_0x45c0('0x1b')]||null:null,'include':_0x1ff36d[_0x45c0('0x19')]?_0x1ff36d[_0x45c0('0x19')]['include']?_[_0x45c0('0x1c')](_0x1ff36d[_0x45c0('0x19')][_0x45c0('0x1d')],function(_0x42d6f9){return{'model':db[_0x42d6f9[_0x45c0('0x1e')]],'as':_0x42d6f9['as'],'attributes':_0x42d6f9[_0x45c0('0x1b')],'include':_0x42d6f9['include']?_['map'](_0x42d6f9[_0x45c0('0x1d')],function(_0x3bcf52){return{'model':db[_0x3bcf52[_0x45c0('0x1e')]],'as':_0x3bcf52['as'],'attributes':_0x3bcf52['attributes'],'include':_0x3bcf52[_0x45c0('0x1d')]?_['map'](_0x3bcf52['include'],function(_0x15b1c7){return{'model':db[_0x15b1c7['model']],'as':_0x15b1c7['as'],'attributes':_0x15b1c7[_0x45c0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x45c0('0x1f')](function(_0x5b56ba){logger[_0x45c0('0x15')](_0x45c0('0x20'),_0x1ff36d);logger[_0x45c0('0xf')](_0x45c0('0x20'),_0x1ff36d,JSON[_0x45c0('0x11')](_0x5b56ba));_0xcfd9dd(_0x5b56ba);})[_0x45c0('0x16')](function(_0x3cdfc9){logger[_0x45c0('0x12')]('ShowSmsAccount',_0x3cdfc9['message'],_0x1ff36d);_0x3d466a(_0x492faf['error'](0x1f4,_0x3cdfc9[_0x45c0('0x14')]));});});}; \ No newline at end of file +var _0x9dd7=['include','map','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes'];(function(_0x3a340f,_0x5a0b68){var _0x55389a=function(_0x36eb2d){while(--_0x36eb2d){_0x3a340f['push'](_0x3a340f['shift']());}};_0x55389a(++_0x5a0b68);}(_0x9dd7,0x19e));var _0x79dd=function(_0x10485d,_0x3cfe54){_0x10485d=_0x10485d-0x0;var _0x197157=_0x9dd7[_0x10485d];return _0x197157;};'use strict';var _=require(_0x79dd('0x0'));var util=require(_0x79dd('0x1'));var moment=require(_0x79dd('0x2'));var BPromise=require(_0x79dd('0x3'));var rs=require(_0x79dd('0x4'));var fs=require('fs');var Redis=require(_0x79dd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x79dd('0x6'));var logger=require(_0x79dd('0x7'))(_0x79dd('0x8'));var config=require(_0x79dd('0x9'));var jayson=require(_0x79dd('0xa'));var client=jayson[_0x79dd('0xb')][_0x79dd('0xc')]({'port':0x232a});config[_0x79dd('0xd')]=_['defaults'](config[_0x79dd('0xd')],{'host':_0x79dd('0xe'),'port':0x18eb});var socket=require(_0x79dd('0xf'))(new Redis(config[_0x79dd('0xd')]));require(_0x79dd('0x10'))[_0x79dd('0x11')](socket);function respondWithRpcPromise(_0x588eb7,_0x41e8e7,_0x125267){return new BPromise(function(_0x882ff2,_0x262d79){return client[_0x79dd('0x12')](_0x588eb7,_0x125267)[_0x79dd('0x13')](function(_0x21c656){logger[_0x79dd('0x14')](_0x79dd('0x15'),_0x41e8e7,_0x79dd('0x16'));logger['debug'](_0x79dd('0x17'),_0x41e8e7,_0x79dd('0x16'),JSON[_0x79dd('0x18')](_0x21c656));if(_0x21c656['error']){if(_0x21c656['error'][_0x79dd('0x19')]===0x1f4){logger[_0x79dd('0x1a')]('SmsAccount,\x20%s,\x20%s',_0x41e8e7,_0x21c656['error'][_0x79dd('0x1b')]);return _0x262d79(_0x21c656['error'][_0x79dd('0x1b')]);}logger[_0x79dd('0x1a')](_0x79dd('0x15'),_0x41e8e7,_0x21c656[_0x79dd('0x1a')][_0x79dd('0x1b')]);return _0x882ff2(_0x21c656[_0x79dd('0x1a')][_0x79dd('0x1b')]);}else{logger[_0x79dd('0x14')](_0x79dd('0x15'),_0x41e8e7,_0x79dd('0x16'));_0x882ff2(_0x21c656[_0x79dd('0x1c')][_0x79dd('0x1b')]);}})[_0x79dd('0x1d')](function(_0x35ecd5){logger[_0x79dd('0x1a')](_0x79dd('0x15'),_0x41e8e7,_0x35ecd5);_0x262d79(_0x35ecd5);});});}exports[_0x79dd('0x1e')]=function(_0x370034){var _0x19fdd3=this;return new Promise(function(_0x4522a6,_0x1d09a4){return db[_0x79dd('0x1f')][_0x79dd('0x20')]({'raw':_0x370034['options']?_0x370034[_0x79dd('0x21')][_0x79dd('0x22')]===undefined?!![]:![]:!![],'where':_0x370034[_0x79dd('0x21')]?_0x370034[_0x79dd('0x21')][_0x79dd('0x23')]||null:null,'attributes':_0x370034[_0x79dd('0x21')]?_0x370034[_0x79dd('0x21')][_0x79dd('0x24')]||null:null,'include':_0x370034[_0x79dd('0x21')]?_0x370034['options'][_0x79dd('0x25')]?_[_0x79dd('0x26')](_0x370034[_0x79dd('0x21')][_0x79dd('0x25')],function(_0x103eb9){return{'model':db[_0x103eb9[_0x79dd('0x27')]],'as':_0x103eb9['as'],'attributes':_0x103eb9[_0x79dd('0x24')],'include':_0x103eb9[_0x79dd('0x25')]?_[_0x79dd('0x26')](_0x103eb9[_0x79dd('0x25')],function(_0x24cfd2){return{'model':db[_0x24cfd2[_0x79dd('0x27')]],'as':_0x24cfd2['as'],'attributes':_0x24cfd2[_0x79dd('0x24')],'include':_0x24cfd2[_0x79dd('0x25')]?_['map'](_0x24cfd2[_0x79dd('0x25')],function(_0x4b2df3){return{'model':db[_0x4b2df3[_0x79dd('0x27')]],'as':_0x4b2df3['as'],'attributes':_0x4b2df3[_0x79dd('0x24')]};}):[]};}):[]};}):[]:[]})[_0x79dd('0x13')](function(_0x4f0e31){logger[_0x79dd('0x14')](_0x79dd('0x1e'),_0x370034);logger[_0x79dd('0x28')](_0x79dd('0x1e'),_0x370034,JSON[_0x79dd('0x18')](_0x4f0e31));_0x4522a6(_0x4f0e31);})['catch'](function(_0x202b7e){logger[_0x79dd('0x1a')](_0x79dd('0x1e'),_0x202b7e[_0x79dd('0x1b')],_0x370034);_0x1d09a4(_0x19fdd3[_0x79dd('0x1a')](0x1f4,_0x202b7e['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 5736b17..cc93689 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 5cf2840..0e578e4 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x5ef224,_0x1f531f){var _0x4a6ff9=function(_0x25bd2e){while(--_0x25bd2e){_0x5ef224['push'](_0x5ef224['shift']());}};_0x4a6ff9(++_0x1f531f);}(_0x3e74,0x175));var _0x43e7=function(_0x4ca14f,_0x33f543){_0x4ca14f=_0x4ca14f-0x0;var _0x4db4b2=_0x3e74[_0x4ca14f];return _0x4db4b2;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 517069c..40ab32f 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 _0x7d0a=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x5e3cb4,_0x1ad3df){var _0x297079=function(_0x341ee9){while(--_0x341ee9){_0x5e3cb4['push'](_0x5e3cb4['shift']());}};_0x297079(++_0x1ad3df);}(_0x7d0a,0x1a3));var _0xa7d0=function(_0x2f4d41,_0x104d39){_0x2f4d41=_0x2f4d41-0x0;var _0x2197d1=_0x7d0a[_0x2f4d41];return _0x2197d1;};'use strict';var Sequelize=require(_0xa7d0('0x0'));module[_0xa7d0('0x1')]={'priority':{'type':Sequelize[_0xa7d0('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa7d0('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa7d0('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa7d0('0x3')],'defaultValue':_0xa7d0('0x5')}}; \ No newline at end of file +var _0x7923=['INTEGER','STRING','noop','TEXT','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7923,0x9a));var _0x3792=function(_0x31d874,_0x37786b){_0x31d874=_0x31d874-0x0;var _0x591e50=_0x7923[_0x31d874];return _0x591e50;};'use strict';var Sequelize=require('sequelize');module[_0x3792('0x0')]={'priority':{'type':Sequelize[_0x3792('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x3792('0x2')],'allowNull':![],'defaultValue':_0x3792('0x3')},'appdata':{'type':Sequelize[_0x3792('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 5d981d9..910282f 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 _0x6966=['offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','SmsApplication','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filters','merge','VIRTUAL','filter','options','where','include','findAll','params','rawAttributes','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','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/environment','sendStatus','end','status','json'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0x6966,0x155));var _0x6696=function(_0x17d7ec,_0x2dce33){_0x17d7ec=_0x17d7ec-0x0;var _0x84c4a=_0x6966[_0x17d7ec];return _0x84c4a;};'use strict';var emlformat=require(_0x6696('0x0'));var rimraf=require(_0x6696('0x1'));var zipdir=require(_0x6696('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6696('0x3'));var moment=require(_0x6696('0x4'));var BPromise=require(_0x6696('0x5'));var Mustache=require(_0x6696('0x6'));var util=require(_0x6696('0x7'));var path=require(_0x6696('0x8'));var sox=require(_0x6696('0x9'));var csv=require(_0x6696('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6696('0xb'));var _=require(_0x6696('0xc'));var squel=require(_0x6696('0xd'));var crypto=require(_0x6696('0xe'));var jsforce=require(_0x6696('0xf'));var deskjs=require(_0x6696('0x10'));var toCsv=require(_0x6696('0xa'));var querystring=require(_0x6696('0x11'));var Papa=require('papaparse');var Redis=require(_0x6696('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6696('0x13'));var as=require(_0x6696('0x14'));var hardwareService=require(_0x6696('0x15'));var logger=require(_0x6696('0x16'))(_0x6696('0x17'));var utils=require('../../config/utils');var config=require(_0x6696('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e1ca0,_0x5e4358){_0x5e4358=_0x5e4358||0xcc;return function(_0x3c393a){if(_0x3c393a){return _0x3e1ca0[_0x6696('0x19')](_0x5e4358);}return _0x3e1ca0['status'](_0x5e4358)[_0x6696('0x1a')]();};}function respondWithResult(_0x17271d,_0x313c8e){_0x313c8e=_0x313c8e||0xc8;return function(_0x5e670c){if(_0x5e670c){return _0x17271d[_0x6696('0x1b')](_0x313c8e)[_0x6696('0x1c')](_0x5e670c);}};}function respondWithFilteredResult(_0x45773b,_0x5d2dd3){return function(_0x2b35e9){if(_0x2b35e9){var _0x2b91fa=typeof _0x5d2dd3[_0x6696('0x1d')]===_0x6696('0x1e')&&typeof _0x5d2dd3['limit']==='undefined';var _0x7d247f=_0x2b35e9[_0x6696('0x1f')];var _0x193257=_0x2b91fa?0x0:_0x5d2dd3['offset'];var _0x1ceebd=_0x2b91fa?_0x2b35e9['count']:_0x5d2dd3['offset']+_0x5d2dd3['limit'];var _0x59c57b;if(_0x1ceebd>=_0x7d247f){_0x1ceebd=_0x7d247f;_0x59c57b=0xc8;}else{_0x59c57b=0xce;}_0x45773b['status'](_0x59c57b);return _0x45773b[_0x6696('0x20')](_0x6696('0x21'),_0x193257+'-'+_0x1ceebd+'/'+_0x7d247f)['json'](_0x2b35e9);}return null;};}function patchUpdates(_0x3a599d){return function(_0x4ac35c){try{jsonpatch[_0x6696('0x22')](_0x4ac35c,_0x3a599d,!![]);}catch(_0x52cec6){return BPromise[_0x6696('0x23')](_0x52cec6);}return _0x4ac35c[_0x6696('0x24')]();};}function saveUpdates(_0x27dc64,_0x20f29f){return function(_0x2a6491){if(_0x2a6491){return _0x2a6491['update'](_0x27dc64)[_0x6696('0x25')](function(_0x368530){return _0x368530;});}return null;};}function removeEntity(_0x1793b9,_0x2a5621){return function(_0x4fcd14){if(_0x4fcd14){return _0x4fcd14[_0x6696('0x26')]()['then'](function(){_0x1793b9[_0x6696('0x1b')](0xcc)[_0x6696('0x1a')]();});}};}function handleEntityNotFound(_0x4b5aa7,_0x579b9f){return function(_0xb22029){if(!_0xb22029){_0x4b5aa7[_0x6696('0x19')](0x194);}return _0xb22029;};}function handleError(_0x39aa2c,_0x8fd032){_0x8fd032=_0x8fd032||0x1f4;return function(_0x2625ff){logger[_0x6696('0x27')](_0x2625ff[_0x6696('0x28')]);if(_0x2625ff[_0x6696('0x29')]){delete _0x2625ff[_0x6696('0x29')];}_0x39aa2c['status'](_0x8fd032)[_0x6696('0x2a')](_0x2625ff);};}exports['index']=function(_0x2d3ec6,_0x1edfde){var _0x159d15={},_0x39ee5a={},_0x302899={'count':0x0,'rows':[]};var _0x1b8363=_[_0x6696('0x2b')](db[_0x6696('0x2c')]['rawAttributes'],function(_0x3018d9){return{'name':_0x3018d9[_0x6696('0x2d')],'type':_0x3018d9[_0x6696('0x2e')][_0x6696('0x2f')]};});_0x39ee5a[_0x6696('0x30')]=_[_0x6696('0x2b')](_0x1b8363,'name');_0x39ee5a[_0x6696('0x31')]=_[_0x6696('0x32')](_0x2d3ec6[_0x6696('0x31')]);_0x39ee5a['filters']=_[_0x6696('0x33')](_0x39ee5a[_0x6696('0x30')],_0x39ee5a[_0x6696('0x31')]);_0x159d15[_0x6696('0x34')]=_[_0x6696('0x33')](_0x39ee5a[_0x6696('0x30')],qs['fields'](_0x2d3ec6[_0x6696('0x31')][_0x6696('0x35')]));_0x159d15['attributes']=_0x159d15['attributes'][_0x6696('0x36')]?_0x159d15['attributes']:_0x39ee5a[_0x6696('0x30')];if(!_0x2d3ec6[_0x6696('0x31')][_0x6696('0x37')](_0x6696('0x38'))){_0x159d15[_0x6696('0x39')]=qs[_0x6696('0x39')](_0x2d3ec6['query'][_0x6696('0x39')]);_0x159d15[_0x6696('0x1d')]=qs[_0x6696('0x1d')](_0x2d3ec6[_0x6696('0x31')]['offset']);}_0x159d15['order']=qs[_0x6696('0x3a')](_0x2d3ec6['query'][_0x6696('0x3a')]);_0x159d15['where']=qs[_0x6696('0x3b')](_['pick'](_0x2d3ec6['query'],_0x39ee5a['filters']),_0x1b8363);if(_0x2d3ec6['query']['filter']){_0x159d15['where']=_[_0x6696('0x3c')](_0x159d15['where'],{'$or':_[_0x6696('0x2b')](_0x1b8363,function(_0x29eb9c){if(_0x29eb9c[_0x6696('0x2e')]!==_0x6696('0x3d')){var _0x48e69d={};_0x48e69d[_0x29eb9c[_0x6696('0x29')]]={'$like':'%'+_0x2d3ec6[_0x6696('0x31')][_0x6696('0x3e')]+'%'};return _0x48e69d;}})});}_0x159d15=_[_0x6696('0x3c')]({},_0x159d15,_0x2d3ec6[_0x6696('0x3f')]);var _0x324e7d={'where':_0x159d15[_0x6696('0x40')]};return db[_0x6696('0x2c')][_0x6696('0x1f')](_0x324e7d)[_0x6696('0x25')](function(_0xdd1986){_0x302899[_0x6696('0x1f')]=_0xdd1986;if(_0x2d3ec6['query']['includeAll']){_0x159d15[_0x6696('0x41')]=[{'all':!![]}];}return db[_0x6696('0x2c')][_0x6696('0x42')](_0x159d15);})[_0x6696('0x25')](function(_0x5a5c1e){_0x302899['rows']=_0x5a5c1e;return _0x302899;})['then'](respondWithFilteredResult(_0x1edfde,_0x159d15))['catch'](handleError(_0x1edfde,null));};exports['show']=function(_0x3328e1,_0x1e4e6f){var _0x1a75eb={'raw':!![],'where':{'id':_0x3328e1[_0x6696('0x43')]['id']}},_0x157a0f={};_0x157a0f[_0x6696('0x30')]=_[_0x6696('0x32')](db[_0x6696('0x2c')][_0x6696('0x44')]);_0x157a0f[_0x6696('0x31')]=_[_0x6696('0x32')](_0x3328e1[_0x6696('0x31')]);_0x157a0f[_0x6696('0x3b')]=_['intersection'](_0x157a0f[_0x6696('0x30')],_0x157a0f[_0x6696('0x31')]);_0x1a75eb[_0x6696('0x34')]=_[_0x6696('0x33')](_0x157a0f[_0x6696('0x30')],qs['fields'](_0x3328e1[_0x6696('0x31')][_0x6696('0x35')]));_0x1a75eb[_0x6696('0x34')]=_0x1a75eb[_0x6696('0x34')][_0x6696('0x36')]?_0x1a75eb['attributes']:_0x157a0f[_0x6696('0x30')];if(_0x3328e1[_0x6696('0x31')][_0x6696('0x45')]){_0x1a75eb['include']=[{'all':!![]}];}_0x1a75eb=_[_0x6696('0x3c')]({},_0x1a75eb,_0x3328e1[_0x6696('0x3f')]);return db['SmsApplication'][_0x6696('0x46')](_0x1a75eb)[_0x6696('0x25')](handleEntityNotFound(_0x1e4e6f,null))[_0x6696('0x25')](respondWithResult(_0x1e4e6f,null))[_0x6696('0x47')](handleError(_0x1e4e6f,null));};exports[_0x6696('0x48')]=function(_0x34f562,_0x5351bf){return db[_0x6696('0x2c')][_0x6696('0x48')](_0x34f562[_0x6696('0x49')],{})[_0x6696('0x25')](respondWithResult(_0x5351bf,0xc9))[_0x6696('0x47')](handleError(_0x5351bf,null));};exports['update']=function(_0x3eb7a5,_0x5486c4){if(_0x3eb7a5[_0x6696('0x49')]['id']){delete _0x3eb7a5[_0x6696('0x49')]['id'];}return db['SmsApplication']['find']({'where':{'id':_0x3eb7a5['params']['id']}})['then'](handleEntityNotFound(_0x5486c4,null))[_0x6696('0x25')](saveUpdates(_0x3eb7a5[_0x6696('0x49')],null))[_0x6696('0x25')](respondWithResult(_0x5486c4,null))[_0x6696('0x47')](handleError(_0x5486c4,null));};exports[_0x6696('0x26')]=function(_0x973909,_0x357333){return db[_0x6696('0x2c')]['find']({'where':{'id':_0x973909['params']['id']}})[_0x6696('0x25')](handleEntityNotFound(_0x357333,null))[_0x6696('0x25')](removeEntity(_0x357333,null))[_0x6696('0x47')](handleError(_0x357333,null));}; \ No newline at end of file +var _0xe9cb=['find','create','body','eml-format','request-promise','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','fields'];(function(_0x5446a2,_0x14d93c){var _0x1a0478=function(_0x8f8398){while(--_0x8f8398){_0x5446a2['push'](_0x5446a2['shift']());}};_0x1a0478(++_0x14d93c);}(_0xe9cb,0x1a1));var _0xbe9c=function(_0x4ae1c8,_0x3f18c1){_0x4ae1c8=_0x4ae1c8-0x0;var _0x2eb247=_0xe9cb[_0x4ae1c8];return _0x2eb247;};'use strict';var emlformat=require(_0xbe9c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe9c('0x1'));var moment=require('moment');var BPromise=require(_0xbe9c('0x2'));var Mustache=require(_0xbe9c('0x3'));var util=require(_0xbe9c('0x4'));var path=require(_0xbe9c('0x5'));var sox=require(_0xbe9c('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbe9c('0x7'));var squel=require(_0xbe9c('0x8'));var crypto=require('crypto');var jsforce=require(_0xbe9c('0x9'));var deskjs=require(_0xbe9c('0xa'));var toCsv=require(_0xbe9c('0xb'));var querystring=require(_0xbe9c('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbe9c('0xd'));var qs=require(_0xbe9c('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe9c('0xf'));var logger=require(_0xbe9c('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xbe9c('0x11'));var licenseUtil=require(_0xbe9c('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8c8b80,_0x3cdb6e){_0x3cdb6e=_0x3cdb6e||0xcc;return function(_0xf891fe){if(_0xf891fe){return _0x8c8b80[_0xbe9c('0x13')](_0x3cdb6e);}return _0x8c8b80[_0xbe9c('0x14')](_0x3cdb6e)['end']();};}function respondWithResult(_0x198402,_0x3ebe0c){_0x3ebe0c=_0x3ebe0c||0xc8;return function(_0x5cd37b){if(_0x5cd37b){return _0x198402['status'](_0x3ebe0c)[_0xbe9c('0x15')](_0x5cd37b);}};}function respondWithFilteredResult(_0x55c6b0,_0x502d54){return function(_0x25ee3d){if(_0x25ee3d){var _0xb0e4c5=typeof _0x502d54[_0xbe9c('0x16')]==='undefined'&&typeof _0x502d54[_0xbe9c('0x17')]==='undefined';var _0x51a372=_0x25ee3d[_0xbe9c('0x18')];var _0x5e2f31=_0xb0e4c5?0x0:_0x502d54[_0xbe9c('0x16')];var _0x25871a=_0xb0e4c5?_0x25ee3d['count']:_0x502d54['offset']+_0x502d54[_0xbe9c('0x17')];var _0xded07e;if(_0x25871a>=_0x51a372){_0x25871a=_0x51a372;_0xded07e=0xc8;}else{_0xded07e=0xce;}_0x55c6b0[_0xbe9c('0x14')](_0xded07e);return _0x55c6b0['set'](_0xbe9c('0x19'),_0x5e2f31+'-'+_0x25871a+'/'+_0x51a372)['json'](_0x25ee3d);}return null;};}function patchUpdates(_0x39e130){return function(_0x3715b8){try{jsonpatch['apply'](_0x3715b8,_0x39e130,!![]);}catch(_0x123cb4){return BPromise[_0xbe9c('0x1a')](_0x123cb4);}return _0x3715b8[_0xbe9c('0x1b')]();};}function saveUpdates(_0x15f5c1,_0x580707){return function(_0x509188){if(_0x509188){return _0x509188[_0xbe9c('0x1c')](_0x15f5c1)[_0xbe9c('0x1d')](function(_0x2b650a){return _0x2b650a;});}return null;};}function removeEntity(_0x23f123,_0x5f1d18){return function(_0x5f3a57){if(_0x5f3a57){return _0x5f3a57[_0xbe9c('0x1e')]()[_0xbe9c('0x1d')](function(){_0x23f123[_0xbe9c('0x14')](0xcc)[_0xbe9c('0x1f')]();});}};}function handleEntityNotFound(_0xc82aeb,_0x3b0b1a){return function(_0x17564e){if(!_0x17564e){_0xc82aeb[_0xbe9c('0x13')](0x194);}return _0x17564e;};}function handleError(_0x18c800,_0x30fb36){_0x30fb36=_0x30fb36||0x1f4;return function(_0x432d2c){logger[_0xbe9c('0x20')](_0x432d2c[_0xbe9c('0x21')]);if(_0x432d2c['name']){delete _0x432d2c[_0xbe9c('0x22')];}_0x18c800['status'](_0x30fb36)['send'](_0x432d2c);};}exports[_0xbe9c('0x23')]=function(_0x3c7563,_0xf0dacd){var _0x43499e={},_0xc82534={},_0x4e3192={'count':0x0,'rows':[]};var _0x233023=_[_0xbe9c('0x24')](db[_0xbe9c('0x25')][_0xbe9c('0x26')],function(_0x5acb62){return{'name':_0x5acb62[_0xbe9c('0x27')],'type':_0x5acb62[_0xbe9c('0x28')][_0xbe9c('0x29')]};});_0xc82534[_0xbe9c('0x2a')]=_[_0xbe9c('0x24')](_0x233023,'name');_0xc82534[_0xbe9c('0x2b')]=_[_0xbe9c('0x2c')](_0x3c7563[_0xbe9c('0x2b')]);_0xc82534[_0xbe9c('0x2d')]=_['intersection'](_0xc82534['model'],_0xc82534[_0xbe9c('0x2b')]);_0x43499e[_0xbe9c('0x2e')]=_['intersection'](_0xc82534[_0xbe9c('0x2a')],qs['fields'](_0x3c7563[_0xbe9c('0x2b')]['fields']));_0x43499e[_0xbe9c('0x2e')]=_0x43499e['attributes'][_0xbe9c('0x2f')]?_0x43499e[_0xbe9c('0x2e')]:_0xc82534['model'];if(!_0x3c7563['query'][_0xbe9c('0x30')](_0xbe9c('0x31'))){_0x43499e[_0xbe9c('0x17')]=qs[_0xbe9c('0x17')](_0x3c7563[_0xbe9c('0x2b')]['limit']);_0x43499e[_0xbe9c('0x16')]=qs['offset'](_0x3c7563[_0xbe9c('0x2b')][_0xbe9c('0x16')]);}_0x43499e['order']=qs[_0xbe9c('0x32')](_0x3c7563['query'][_0xbe9c('0x32')]);_0x43499e[_0xbe9c('0x33')]=qs[_0xbe9c('0x2d')](_[_0xbe9c('0x34')](_0x3c7563[_0xbe9c('0x2b')],_0xc82534[_0xbe9c('0x2d')]),_0x233023);if(_0x3c7563[_0xbe9c('0x2b')][_0xbe9c('0x35')]){_0x43499e[_0xbe9c('0x33')]=_[_0xbe9c('0x36')](_0x43499e['where'],{'$or':_[_0xbe9c('0x24')](_0x233023,function(_0x4ae643){if(_0x4ae643[_0xbe9c('0x28')]!==_0xbe9c('0x37')){var _0x627d0d={};_0x627d0d[_0x4ae643[_0xbe9c('0x22')]]={'$like':'%'+_0x3c7563[_0xbe9c('0x2b')][_0xbe9c('0x35')]+'%'};return _0x627d0d;}})});}_0x43499e=_[_0xbe9c('0x36')]({},_0x43499e,_0x3c7563[_0xbe9c('0x38')]);var _0x515f47={'where':_0x43499e[_0xbe9c('0x33')]};return db[_0xbe9c('0x25')][_0xbe9c('0x18')](_0x515f47)[_0xbe9c('0x1d')](function(_0x5ecc61){_0x4e3192[_0xbe9c('0x18')]=_0x5ecc61;if(_0x3c7563[_0xbe9c('0x2b')][_0xbe9c('0x39')]){_0x43499e[_0xbe9c('0x3a')]=[{'all':!![]}];}return db[_0xbe9c('0x25')][_0xbe9c('0x3b')](_0x43499e);})[_0xbe9c('0x1d')](function(_0x5a9b15){_0x4e3192[_0xbe9c('0x3c')]=_0x5a9b15;return _0x4e3192;})[_0xbe9c('0x1d')](respondWithFilteredResult(_0xf0dacd,_0x43499e))[_0xbe9c('0x3d')](handleError(_0xf0dacd,null));};exports[_0xbe9c('0x3e')]=function(_0xd80b49,_0x2fdd3e){var _0x23083b={'raw':!![],'where':{'id':_0xd80b49[_0xbe9c('0x3f')]['id']}},_0xaabd03={};_0xaabd03[_0xbe9c('0x2a')]=_[_0xbe9c('0x2c')](db[_0xbe9c('0x25')]['rawAttributes']);_0xaabd03[_0xbe9c('0x2b')]=_[_0xbe9c('0x2c')](_0xd80b49['query']);_0xaabd03['filters']=_[_0xbe9c('0x40')](_0xaabd03[_0xbe9c('0x2a')],_0xaabd03[_0xbe9c('0x2b')]);_0x23083b[_0xbe9c('0x2e')]=_[_0xbe9c('0x40')](_0xaabd03[_0xbe9c('0x2a')],qs['fields'](_0xd80b49[_0xbe9c('0x2b')][_0xbe9c('0x41')]));_0x23083b[_0xbe9c('0x2e')]=_0x23083b['attributes'][_0xbe9c('0x2f')]?_0x23083b[_0xbe9c('0x2e')]:_0xaabd03['model'];if(_0xd80b49[_0xbe9c('0x2b')][_0xbe9c('0x39')]){_0x23083b[_0xbe9c('0x3a')]=[{'all':!![]}];}_0x23083b=_[_0xbe9c('0x36')]({},_0x23083b,_0xd80b49[_0xbe9c('0x38')]);return db['SmsApplication'][_0xbe9c('0x42')](_0x23083b)['then'](handleEntityNotFound(_0x2fdd3e,null))['then'](respondWithResult(_0x2fdd3e,null))['catch'](handleError(_0x2fdd3e,null));};exports[_0xbe9c('0x43')]=function(_0x4133d5,_0x5c3ff2){return db[_0xbe9c('0x25')][_0xbe9c('0x43')](_0x4133d5[_0xbe9c('0x44')],{})['then'](respondWithResult(_0x5c3ff2,0xc9))['catch'](handleError(_0x5c3ff2,null));};exports[_0xbe9c('0x1c')]=function(_0x9c637a,_0x22778a){if(_0x9c637a[_0xbe9c('0x44')]['id']){delete _0x9c637a[_0xbe9c('0x44')]['id'];}return db[_0xbe9c('0x25')][_0xbe9c('0x42')]({'where':{'id':_0x9c637a[_0xbe9c('0x3f')]['id']}})[_0xbe9c('0x1d')](handleEntityNotFound(_0x22778a,null))[_0xbe9c('0x1d')](saveUpdates(_0x9c637a['body'],null))['then'](respondWithResult(_0x22778a,null))[_0xbe9c('0x3d')](handleError(_0x22778a,null));};exports[_0xbe9c('0x1e')]=function(_0x1335a2,_0x20e252){return db['SmsApplication'][_0xbe9c('0x42')]({'where':{'id':_0x1335a2[_0xbe9c('0x3f')]['id']}})[_0xbe9c('0x1d')](handleEntityNotFound(_0x20e252,null))[_0xbe9c('0x1d')](removeEntity(_0x20e252,null))[_0xbe9c('0x3d')](handleError(_0x20e252,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 3029870..4c28671 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 _0xaf55=['sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./smsApplication.attributes','exports','define','SmsApplication'];(function(_0x14e75e,_0x43a34d){var _0x5fc83b=function(_0x37bcb1){while(--_0x37bcb1){_0x14e75e['push'](_0x14e75e['shift']());}};_0x5fc83b(++_0x43a34d);}(_0xaf55,0x1a2));var _0x5af5=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xaf55[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x5af5('0x0'));var util=require(_0x5af5('0x1'));var logger=require(_0x5af5('0x2'))('api');var moment=require(_0x5af5('0x3'));var BPromise=require(_0x5af5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5af5('0x5'));var rimraf=require(_0x5af5('0x6'));var config=require('../../config/environment');var attributes=require(_0x5af5('0x7'));module[_0x5af5('0x8')]=function(_0x9ee90d,_0xeeb1fc){return _0x9ee90d[_0x5af5('0x9')](_0x5af5('0xa'),attributes,{'tableName':_0x5af5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5af5('0xc')});}; \ No newline at end of file +var _0xd94d=['utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','SmsApplication','utf8mb4'];(function(_0x29cf3c,_0x2c6c93){var _0x2efd9b=function(_0x1d00a6){while(--_0x1d00a6){_0x29cf3c['push'](_0x29cf3c['shift']());}};_0x2efd9b(++_0x2c6c93);}(_0xd94d,0x1eb));var _0xdd94=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd94d[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xdd94('0x0'));var util=require(_0xdd94('0x1'));var logger=require('../../config/logger')(_0xdd94('0x2'));var moment=require(_0xdd94('0x3'));var BPromise=require(_0xdd94('0x4'));var rp=require(_0xdd94('0x5'));var fs=require('fs');var path=require(_0xdd94('0x6'));var rimraf=require(_0xdd94('0x7'));var config=require(_0xdd94('0x8'));var attributes=require(_0xdd94('0x9'));module[_0xdd94('0xa')]=function(_0x2bb71f,_0x37f44d){return _0x2bb71f['define'](_0xdd94('0xb'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdd94('0xc'),'collate':_0xdd94('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index e8d3121..4fc1adc 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 _0x6a95=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x51222f,_0x379704){var _0x5bc30e=function(_0x5bc694){while(--_0x5bc694){_0x51222f['push'](_0x51222f['shift']());}};_0x5bc30e(++_0x379704);}(_0x6a95,0x1db));var _0x56a9=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x6a95[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var moment=require(_0x56a9('0x2'));var BPromise=require(_0x56a9('0x3'));var rs=require(_0x56a9('0x4'));var fs=require('fs');var Redis=require(_0x56a9('0x5'));var db=require(_0x56a9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x56a9('0x7'));var config=require(_0x56a9('0x8'));var jayson=require(_0x56a9('0x9'));var client=jayson[_0x56a9('0xa')][_0x56a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x365093,_0xd8aa7c,_0x5d3e80){return new BPromise(function(_0x5f0dcb,_0x3ac626){return client[_0x56a9('0xc')](_0x365093,_0x5d3e80)['then'](function(_0xe4b98c){logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));logger[_0x56a9('0x10')](_0x56a9('0x11'),_0xd8aa7c,_0x56a9('0xf'),JSON[_0x56a9('0x12')](_0xe4b98c));if(_0xe4b98c[_0x56a9('0x13')]){if(_0xe4b98c['error'][_0x56a9('0x14')]===0x1f4){logger['error'](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x3ac626(_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);}logger[_0x56a9('0x13')](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x5f0dcb(_0xe4b98c['error']['message']);}else{logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));_0x5f0dcb(_0xe4b98c[_0x56a9('0x16')]['message']);}})[_0x56a9('0x17')](function(_0x4853a3){logger['error']('SmsApplication,\x20%s,\x20%s',_0xd8aa7c,_0x4853a3);_0x3ac626(_0x4853a3);});});} \ No newline at end of file +var _0x8a9a=['rpc','../../config/environment','jayson/promise','client','request','then','info','SmsApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x16d015,_0x51f14f){var _0x36e944=function(_0x37bc86){while(--_0x37bc86){_0x16d015['push'](_0x16d015['shift']());}};_0x36e944(++_0x51f14f);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x8a9a[_0x2064e5];return _0x21a233;};'use strict';var _=require('lodash');var util=require(_0xa8a9('0x0'));var moment=require(_0xa8a9('0x1'));var BPromise=require(_0xa8a9('0x2'));var rs=require(_0xa8a9('0x3'));var fs=require('fs');var Redis=require(_0xa8a9('0x4'));var db=require(_0xa8a9('0x5'))['db'];var utils=require(_0xa8a9('0x6'));var logger=require(_0xa8a9('0x7'))(_0xa8a9('0x8'));var config=require(_0xa8a9('0x9'));var jayson=require(_0xa8a9('0xa'));var client=jayson[_0xa8a9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24a2bc,_0x4a091d,_0x1b4873){return new BPromise(function(_0x129e9f,_0x1477b0){return client[_0xa8a9('0xc')](_0x24a2bc,_0x1b4873)[_0xa8a9('0xd')](function(_0x4ebe24){logger[_0xa8a9('0xe')](_0xa8a9('0xf'),_0x4a091d,'request\x20sent');logger[_0xa8a9('0x10')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x4a091d,_0xa8a9('0x11'),JSON[_0xa8a9('0x12')](_0x4ebe24));if(_0x4ebe24['error']){if(_0x4ebe24[_0xa8a9('0x13')][_0xa8a9('0x14')]===0x1f4){logger[_0xa8a9('0x13')](_0xa8a9('0xf'),_0x4a091d,_0x4ebe24[_0xa8a9('0x13')][_0xa8a9('0x15')]);return _0x1477b0(_0x4ebe24['error'][_0xa8a9('0x15')]);}logger[_0xa8a9('0x13')](_0xa8a9('0xf'),_0x4a091d,_0x4ebe24['error']['message']);return _0x129e9f(_0x4ebe24[_0xa8a9('0x13')][_0xa8a9('0x15')]);}else{logger[_0xa8a9('0xe')]('SmsApplication,\x20%s,\x20%s',_0x4a091d,_0xa8a9('0x11'));_0x129e9f(_0x4ebe24[_0xa8a9('0x16')]['message']);}})['catch'](function(_0x1039c9){logger[_0xa8a9('0x13')](_0xa8a9('0xf'),_0x4a091d,_0x1039c9);_0x1477b0(_0x1039c9);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 6c8b7c5..90df4c8 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 _0x1eba=['put','/:id','update','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','download','post','create','/:id/tags','tracked','sms','smsinteraction:addtags','addTags'];(function(_0x56b083,_0x29476f){var _0x1b01e6=function(_0x560697){while(--_0x560697){_0x56b083['push'](_0x56b083['shift']());}};_0x1b01e6(++_0x29476f);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x4ed1d4,_0x512d9a){_0x4ed1d4=_0x4ed1d4-0x0;var _0x28e363=_0x1eba[_0x4ed1d4];return _0x28e363;};'use strict';var multer=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var path=require(_0xa1eb('0x2'));var timeout=require(_0xa1eb('0x3'));var express=require(_0xa1eb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa1eb('0x5'));var interaction=require(_0xa1eb('0x6'));var config=require(_0xa1eb('0x7'));var controller=require(_0xa1eb('0x8'));router[_0xa1eb('0x9')]('/',auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xb')]);router[_0xa1eb('0x9')](_0xa1eb('0xc'),auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xd')]);router[_0xa1eb('0x9')]('/:id',auth[_0xa1eb('0xa')](),controller['show']);router[_0xa1eb('0x9')]('/:id/messages',auth[_0xa1eb('0xa')](),controller['getMessages']);router[_0xa1eb('0x9')]('/:id/download',auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xe')]);router[_0xa1eb('0xf')]('/',auth['isAuthenticated'](),controller[_0xa1eb('0x10')]);router[_0xa1eb('0xf')]('/:id/messages',auth[_0xa1eb('0xa')](),controller['addMessage']);router['post'](_0xa1eb('0x11'),auth['isAuthenticated'](),interaction[_0xa1eb('0x12')](_0xa1eb('0x13'),_0xa1eb('0x14')),controller[_0xa1eb('0x15')]);router[_0xa1eb('0x16')](_0xa1eb('0x17'),auth[_0xa1eb('0xa')](),interaction[_0xa1eb('0x12')](_0xa1eb('0x13'),'smsinteraction:update'),controller[_0xa1eb('0x18')]);router['delete'](_0xa1eb('0x17'),auth[_0xa1eb('0xa')](),interaction[_0xa1eb('0x12')](_0xa1eb('0x13'),'smsinteraction:destroy'),controller[_0xa1eb('0x19')]);router[_0xa1eb('0x1a')](_0xa1eb('0x11'),auth[_0xa1eb('0xa')](),controller[_0xa1eb('0x1b')]);module[_0xa1eb('0x1c')]=router; \ No newline at end of file +var _0x4cf8=['/:id','/:id/messages','getMessages','/:id/download','create','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','describe'];(function(_0x294775,_0x4ed224){var _0x4d3257=function(_0x201513){while(--_0x201513){_0x294775['push'](_0x294775['shift']());}};_0x4d3257(++_0x4ed224);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x3bceea,_0x58af75){_0x3bceea=_0x3bceea-0x0;var _0x30a8d3=_0x4cf8[_0x3bceea];return _0x30a8d3;};'use strict';var multer=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var path=require(_0x84cf('0x2'));var timeout=require(_0x84cf('0x3'));var express=require(_0x84cf('0x4'));var router=express[_0x84cf('0x5')]();var fs_extra=require(_0x84cf('0x6'));var auth=require(_0x84cf('0x7'));var interaction=require(_0x84cf('0x8'));var config=require(_0x84cf('0x9'));var controller=require(_0x84cf('0xa'));router[_0x84cf('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x84cf('0xb')]('/describe',auth[_0x84cf('0xc')](),controller[_0x84cf('0xd')]);router['get'](_0x84cf('0xe'),auth[_0x84cf('0xc')](),controller['show']);router[_0x84cf('0xb')](_0x84cf('0xf'),auth[_0x84cf('0xc')](),controller[_0x84cf('0x10')]);router['get'](_0x84cf('0x11'),auth[_0x84cf('0xc')](),controller['download']);router['post']('/',auth[_0x84cf('0xc')](),controller[_0x84cf('0x12')]);router[_0x84cf('0x13')](_0x84cf('0xf'),auth[_0x84cf('0xc')](),controller[_0x84cf('0x14')]);router[_0x84cf('0x13')](_0x84cf('0x15'),auth[_0x84cf('0xc')](),interaction[_0x84cf('0x16')](_0x84cf('0x17'),_0x84cf('0x18')),controller[_0x84cf('0x19')]);router[_0x84cf('0x1a')](_0x84cf('0xe'),auth[_0x84cf('0xc')](),interaction[_0x84cf('0x16')](_0x84cf('0x17'),_0x84cf('0x1b')),controller['update']);router[_0x84cf('0x1c')](_0x84cf('0xe'),auth[_0x84cf('0xc')](),interaction[_0x84cf('0x16')](_0x84cf('0x17'),_0x84cf('0x1d')),controller[_0x84cf('0x1e')]);router['delete']('/:id/tags',auth[_0x84cf('0xc')](),controller[_0x84cf('0x1f')]);module[_0x84cf('0x20')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 79e8549..5225455 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 _0x1766=['STRING','ENUM','out','sequelize','BOOLEAN','DATE'];(function(_0x544e8e,_0x480a7d){var _0x186ad4=function(_0x4f6212){while(--_0x4f6212){_0x544e8e['push'](_0x544e8e['shift']());}};_0x186ad4(++_0x480a7d);}(_0x1766,0x17d));var _0x6176=function(_0x17edd5,_0x171428){_0x17edd5=_0x17edd5-0x0;var _0x13bfac=_0x1766[_0x17edd5];return _0x13bfac;};'use strict';var Sequelize=require(_0x6176('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0x6176('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6176('0x2')]},'disposition':{'type':Sequelize[_0x6176('0x3')]},'secondDisposition':{'type':Sequelize[_0x6176('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6176('0x3')]},'note':{'type':Sequelize[_0x6176('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x6176('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x6176('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6176('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x6176('0x4')]('in',_0x6176('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6176('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x6bac=['DATE','STRING','out','ENUM','sequelize','exports','BOOLEAN'];(function(_0x2c5ba6,_0x538557){var _0x504247=function(_0x303109){while(--_0x303109){_0x2c5ba6['push'](_0x2c5ba6['shift']());}};_0x504247(++_0x538557);}(_0x6bac,0xa5));var _0xc6ba=function(_0x14f51d,_0x70ec61){_0x14f51d=_0x14f51d-0x0;var _0x2dc345=_0x6bac[_0x14f51d];return _0x2dc345;};'use strict';var Sequelize=require(_0xc6ba('0x0'));var moment=require('moment');module[_0xc6ba('0x1')]={'closed':{'type':Sequelize[_0xc6ba('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc6ba('0x3')]},'disposition':{'type':Sequelize[_0xc6ba('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xc6ba('0x4')]},'read1stAt':{'type':Sequelize[_0xc6ba('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc6ba('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc6ba('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc6ba('0x6')]('in',_0xc6ba('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc6ba('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index fcf434b..9f5d4c3 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 _0xf1b6=['redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','end','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','SmsInteraction','rawAttributes','fieldName','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','select','field','from','tools_tags','u.id','u.fullname','left_join','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','getFullTextValue','ContactId','buildExpression','type','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','keys','some','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','$gte','parse','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','sequelize','toString','keyBy','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','all','rows','params','options','create','body','destroy','describe','addMessage','ids','omit','findOne','SmsMessage','merge','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','color','emit','removeTags','download','unix','join','root','server','files','CmContact','createdAt','direction','secret','SmsAccount','Account','Owner','mkdirSync','Sms','closedAt','Messages','System','firstName','lastName','out','renderFile','downloadInteraction.ejs','.pdf','log','err','unlinkSync','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x263e2a,_0x1013ff){var _0x504dde=function(_0x50f3f8){while(--_0x50f3f8){_0x263e2a['push'](_0x263e2a['shift']());}};_0x504dde(++_0x1013ff);}(_0xf1b6,0xd1));var _0x6f1b=function(_0x400df8,_0x22af95){_0x400df8=_0x400df8-0x0;var _0x1fe28d=_0xf1b6[_0x400df8];return _0x1fe28d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6f1b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f1b('0x1'));var rp=require(_0x6f1b('0x2'));var moment=require(_0x6f1b('0x3'));var BPromise=require(_0x6f1b('0x4'));var Mustache=require(_0x6f1b('0x5'));var util=require('util');var path=require(_0x6f1b('0x6'));var sox=require(_0x6f1b('0x7'));var csv=require(_0x6f1b('0x8'));var ejs=require(_0x6f1b('0x9'));var fs=require('fs');var fs_extra=require(_0x6f1b('0xa'));var _=require(_0x6f1b('0xb'));var squel=require(_0x6f1b('0xc'));var crypto=require(_0x6f1b('0xd'));var jsforce=require(_0x6f1b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6f1b('0x8'));var querystring=require('querystring');var Papa=require(_0x6f1b('0xf'));var Redis=require('ioredis');var authService=require(_0x6f1b('0x10'));var qs=require(_0x6f1b('0x11'));var as=require(_0x6f1b('0x12'));var pdf=require(_0x6f1b('0x13'));var hardwareService=require(_0x6f1b('0x14'));var logger=require(_0x6f1b('0x15'))('api');var utils=require(_0x6f1b('0x16'));var config=require(_0x6f1b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f1b('0x18'))['db'];config[_0x6f1b('0x19')]=_[_0x6f1b('0x1a')](config[_0x6f1b('0x19')],{'host':_0x6f1b('0x1b'),'port':0x18eb});var socket=require(_0x6f1b('0x1c'))(new Redis(config[_0x6f1b('0x19')]));require(_0x6f1b('0x1d'))[_0x6f1b('0x1e')](socket);function respondWithStatusCode(_0x46f4ad,_0x52c662){_0x52c662=_0x52c662||0xcc;return function(_0x177b16){if(_0x177b16){return _0x46f4ad[_0x6f1b('0x1f')](_0x52c662);}return _0x46f4ad[_0x6f1b('0x20')](_0x52c662)['end']();};}function respondWithResult(_0x28e6fe,_0x101f17){_0x101f17=_0x101f17||0xc8;return function(_0x1acf0c){if(_0x1acf0c){return _0x28e6fe[_0x6f1b('0x20')](_0x101f17)[_0x6f1b('0x21')](_0x1acf0c);}};}function respondWithFilteredResult(_0x32b4e8,_0x360fae){return function(_0x18c97d){if(_0x18c97d){var _0x311395=typeof _0x360fae[_0x6f1b('0x22')]===_0x6f1b('0x23')&&typeof _0x360fae[_0x6f1b('0x24')]===_0x6f1b('0x23');var _0x2c99f7=_0x18c97d[_0x6f1b('0x25')];var _0x100b5f=_0x311395?0x0:_0x360fae[_0x6f1b('0x22')];var _0x2ab6e4=_0x311395?_0x18c97d[_0x6f1b('0x25')]:_0x360fae['offset']+_0x360fae[_0x6f1b('0x24')];var _0x3966f5;if(_0x2ab6e4>=_0x2c99f7){_0x2ab6e4=_0x2c99f7;_0x3966f5=0xc8;}else{_0x3966f5=0xce;}_0x32b4e8[_0x6f1b('0x20')](_0x3966f5);return _0x32b4e8['set'](_0x6f1b('0x26'),_0x100b5f+'-'+_0x2ab6e4+'/'+_0x2c99f7)['json'](_0x18c97d);}return null;};}function patchUpdates(_0x5a0ec4){return function(_0x2be32e){try{jsonpatch[_0x6f1b('0x27')](_0x2be32e,_0x5a0ec4,!![]);}catch(_0x2a2555){return BPromise[_0x6f1b('0x28')](_0x2a2555);}return _0x2be32e[_0x6f1b('0x29')]();};}function saveUpdates(_0x5a9404,_0x250a97){return function(_0x62d0ef){if(_0x62d0ef){return _0x62d0ef['update'](_0x5a9404)[_0x6f1b('0x2a')](function(_0x2ac93b){return _0x2ac93b;});}return null;};}function removeEntity(_0x4219fd,_0x1c16ca){return function(_0x5d5b6d){if(_0x5d5b6d){return _0x5d5b6d['destroy']()[_0x6f1b('0x2a')](function(){_0x4219fd['status'](0xcc)[_0x6f1b('0x2b')]();});}};}function handleEntityNotFound(_0x5c8275,_0x1f68c3){return function(_0x1f8901){if(!_0x1f8901){_0x5c8275[_0x6f1b('0x1f')](0x194);}return _0x1f8901;};}function handleError(_0x1c7bde,_0x359ef1){_0x359ef1=_0x359ef1||0x1f4;return function(_0x1204c3){logger['error'](_0x1204c3[_0x6f1b('0x2c')]);if(_0x1204c3['name']){delete _0x1204c3[_0x6f1b('0x2d')];}_0x1c7bde[_0x6f1b('0x20')](_0x359ef1)[_0x6f1b('0x2e')](_0x1204c3);};}function getInteractionUsers(_0x264957,_0x5f1a8b){return new BPromise(function(_0x1d0ea3,_0x118a9d){try{if(_0x5f1a8b[_0x264957['id']]){_0x264957[_0x6f1b('0x2f')]=_[_0x6f1b('0x30')](_0x5f1a8b[_0x264957['id']],function(_0x5e3228){return{'id':_0x5e3228['id'],'fullname':_0x5e3228[_0x6f1b('0x31')]};});}}catch(_0x4e015f){_0x118a9d(_0x4e015f);}_0x1d0ea3(_0x264957);});}function getInteractionTags(_0x5ba25a,_0x5c1ac0){return new BPromise(function(_0x3cc09b,_0x1123bd){try{if(_0x5ba25a[_0x6f1b('0x32')]){_0x5ba25a['Tags']=[];_0x5ba25a[_0x6f1b('0x32')][_0x6f1b('0x33')](',')[_0x6f1b('0x34')](function(_0x522612){_0x5ba25a[_0x6f1b('0x35')][_0x6f1b('0x36')](_0x5c1ac0[_0x522612]);});}delete _0x5ba25a[_0x6f1b('0x32')];}catch(_0xb866d8){_0x1123bd(_0xb866d8);}_0x3cc09b(_0x5ba25a);});}function updateSmsInteraction(_0x159b6b,_0x181099,_0x439875){return new BPromise(function(_0x3f8cf1,_0x3a7bc1){return getInteractionUsers(_0x159b6b,_0x439875)['then'](function(_0x584b00){return getInteractionTags(_0x584b00,_0x181099);})[_0x6f1b('0x2a')](function(_0x5dd332){return getStateInteraction(_0x5dd332);})[_0x6f1b('0x2a')](function(_0x524a53){_0x3f8cf1(_0x524a53);})[_0x6f1b('0x37')](function(_0x110379){_0x3a7bc1(_0x110379);});});}function getStateInteraction(_0x191626){return new BPromise(function(_0x1c657e){_0x191626[_0x6f1b('0x38')]=0x0;_0x191626[_0x6f1b('0x39')]=0x0;_0x191626[_0x6f1b('0x3a')]=0x0;_0x191626[_0x6f1b('0x3b')]=0x0;_0x191626[_0x6f1b('0x3c')]=0x0;if(!_0x191626[_0x6f1b('0x3d')]&&!_0x191626[_0x6f1b('0x3e')]){_0x191626[_0x6f1b('0x38')]+=0x1;}if(!_0x191626[_0x6f1b('0x3d')]&&_0x191626[_0x6f1b('0x3e')]){_0x191626[_0x6f1b('0x39')]+=0x1;if(_0x191626[_0x6f1b('0x38')]){_0x191626[_0x6f1b('0x38')]-=0x1;}}if(_0x191626[_0x6f1b('0x3d')]&&_0x191626[_0x6f1b('0x3e')]){_0x191626[_0x6f1b('0x3a')]+=0x1;if(_0x191626[_0x6f1b('0x39')]){_0x191626['talking']-=0x1;}}if(_0x191626['closed']&&!_0x191626['UserId']){_0x191626[_0x6f1b('0x3b')]+=0x1;if(_0x191626['waiting']){_0x191626[_0x6f1b('0x38')]-=0x1;}}_0x191626['total']+=0x1;_0x1c657e(_0x191626);});}exports[_0x6f1b('0x3f')]=function(_0x3b19db,_0x48bac4){var _0x165e21={},_0x5388cc={},_0x5a1e84={'count':0x0,'rows':[]};var _0x47e428=_[_0x6f1b('0x30')](db[_0x6f1b('0x40')][_0x6f1b('0x41')],function(_0x11b1a8){return{'name':_0x11b1a8[_0x6f1b('0x42')],'type':_0x11b1a8['type']['key']};});_0x5388cc[_0x6f1b('0x43')]=_[_0x6f1b('0x30')](_0x47e428,_0x6f1b('0x2d'));_0x5388cc['query']=_['keys'](_0x3b19db[_0x6f1b('0x44')]);_0x5388cc[_0x6f1b('0x45')]=_[_0x6f1b('0x46')](_0x5388cc[_0x6f1b('0x43')],_0x5388cc[_0x6f1b('0x44')]);_0x165e21[_0x6f1b('0x47')]=_[_0x6f1b('0x46')](_0x5388cc['model'],qs['fields'](_0x3b19db[_0x6f1b('0x44')]['fields']));_0x165e21[_0x6f1b('0x47')]=_0x165e21[_0x6f1b('0x47')][_0x6f1b('0x48')]?_0x165e21[_0x6f1b('0x47')]:_0x5388cc[_0x6f1b('0x43')];if(!_0x3b19db['query'][_0x6f1b('0x49')](_0x6f1b('0x4a'))){_0x165e21[_0x6f1b('0x24')]=qs[_0x6f1b('0x24')](_0x3b19db[_0x6f1b('0x44')]['limit']);_0x165e21['offset']=qs[_0x6f1b('0x22')](_0x3b19db[_0x6f1b('0x44')][_0x6f1b('0x22')]);}_0x165e21[_0x6f1b('0x4b')]=qs['sort'](_0x3b19db[_0x6f1b('0x44')][_0x6f1b('0x4c')]);_0x165e21['where']=qs['filters'](_[_0x6f1b('0x4d')](_0x3b19db['query'],_0x5388cc[_0x6f1b('0x45')]),_0x47e428);var _0x3c5120=[];var _0x1ed7e0=squel[_0x6f1b('0x4e')]()['field']('id')['field']('name')[_0x6f1b('0x4f')]('color')[_0x6f1b('0x50')](_0x6f1b('0x51'));var _0x5b868d=squel[_0x6f1b('0x4e')]()[_0x6f1b('0x4f')](_0x6f1b('0x52'))[_0x6f1b('0x4f')](_0x6f1b('0x53'))[_0x6f1b('0x4f')]('ui.SmsInteractionId')[_0x6f1b('0x50')]('user_has_sms_interactions','ui')[_0x6f1b('0x54')]('users','u',_0x6f1b('0x55'));var _0x38f356=squel[_0x6f1b('0x4e')]()[_0x6f1b('0x50')](_0x6f1b('0x56'),'i')[_0x6f1b('0x54')](_0x6f1b('0x57'),'c',_0x6f1b('0x58'))[_0x6f1b('0x54')](_0x6f1b('0x59'),'o',_0x6f1b('0x5a'))[_0x6f1b('0x54')](_0x6f1b('0x5b'),'a',_0x6f1b('0x5c'))['left_join'](_0x6f1b('0x5d'),'me',_0x6f1b('0x5e'))[_0x6f1b('0x54')]('sms_interaction_has_tags','it',_0x6f1b('0x5f'))['left_join']('tools_tags','t',_0x6f1b('0x60'));var _0x5b10e9=squel['expr']();var _0x2373d8=[];var _0x540655=squel[_0x6f1b('0x61')]();var _0x435257;if(_0x3b19db[_0x6f1b('0x44')][_0x6f1b('0x62')]){_0x435257=as[_0x6f1b('0x63')](_0x3b19db[_0x6f1b('0x44')][_0x6f1b('0x62')]);var _0x5d419e=_0x435257[_0x6f1b('0x64')];for(var _0x570b0e=0x0;_0x570b0e<_0x435257[_0x6f1b('0x65')][_0x6f1b('0x48')];_0x570b0e++){var _0x416432=_0x435257[_0x6f1b('0x65')][_0x570b0e];var _0x5f2ddf='i';var _0xbc29c5=_[_0x6f1b('0x66')](_0x47e428,[_0x6f1b('0x2d'),_0x416432[_0x6f1b('0x4f')]]);if(!_0xbc29c5){switch(_0x416432[_0x6f1b('0x4f')]){case _0x6f1b('0x67'):if(_0x416432[_0x6f1b('0x68')]==0x1){_0x38f356[_0x6f1b('0x69')]('`'+_0x416432[_0x6f1b('0x4f')]+_0x6f1b('0x6a'));}else{_0x38f356[_0x6f1b('0x69')]('`'+_0x416432[_0x6f1b('0x4f')]+_0x6f1b('0x6b'));}break;case _0x6f1b('0x6c'):if(_0x416432['operator']===_0x6f1b('0x6d')){if(_0x416432[_0x6f1b('0x68')][_0x6f1b('0x33')]('\x20')['length']>0x1){_0x5b10e9[_0x5d419e]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6f1b('0x6e')](_0x416432[_0x6f1b('0x68')]),null);}else{var _0x5d83fd='%'+_0x416432['value']+'%';_0x5b10e9[_0x5d419e]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5d83fd,_0x5d83fd,_0x5d83fd);}}else{_0xbc29c5=_[_0x6f1b('0x66')](_0x47e428,['name',_0x6f1b('0x6f')]);_0x416432[_0x6f1b('0x4f')]=_0x6f1b('0x6f');_0x17c0f4=as[_0x6f1b('0x70')](_0x5f2ddf,_0xbc29c5[_0x6f1b('0x71')],_0x416432);_0x5b10e9[_0x5d419e](_0x17c0f4['text'],_0x17c0f4[_0x6f1b('0x68')][_0x6f1b('0x72')],_0x17c0f4[_0x6f1b('0x68')]['end']);}break;case _0x6f1b('0x73'):var _0x4d3db0=_0x416432['value'][_0x6f1b('0x33')](',')[_0x6f1b('0x30')](function(_0x3ca153){return Number(_0x3ca153);});_0x4d3db0[_0x6f1b('0x34')](function(_0x37e78a){_0x540655['or'](_0x6f1b('0x74'),'%,'+_0x37e78a+',%');});_0x2373d8=_['union'](_0x2373d8,_0x4d3db0);break;case _0x6f1b('0x75'):if(_0x416432['operator']===_0x6f1b('0x6d')){_0x5b10e9[_0x5d419e](_0x6f1b('0x76'),'%'+_0x416432[_0x6f1b('0x68')]+'%',null);}else{_0xbc29c5=_[_0x6f1b('0x66')](_0x47e428,[_0x6f1b('0x2d'),_0x6f1b('0x3e')]);_0x416432['field']='UserId';_0x17c0f4=as['buildExpression'](_0x5f2ddf,_0xbc29c5[_0x6f1b('0x71')],_0x416432);_0x5b10e9[_0x5d419e](_0x17c0f4['text'],_0x17c0f4[_0x6f1b('0x68')]['start'],_0x17c0f4[_0x6f1b('0x68')]['end']);}break;case'body':_0x17c0f4=as[_0x6f1b('0x70')]('me',null,_0x416432);_0x5b10e9[_0x5d419e](_0x17c0f4[_0x6f1b('0x77')],_0x17c0f4[_0x6f1b('0x68')][_0x6f1b('0x72')],_0x17c0f4[_0x6f1b('0x68')]['end']);break;}}else{var _0x17c0f4=as['buildExpression'](_0x5f2ddf,_0xbc29c5[_0x6f1b('0x71')],_0x416432);_0x5b10e9[_0x5d419e](_0x17c0f4[_0x6f1b('0x77')],_0x17c0f4[_0x6f1b('0x68')][_0x6f1b('0x72')],_0x17c0f4['value']['end']);}}}else{var _0x489796=_(_0x3b19db[_0x6f1b('0x44')])[_0x6f1b('0x78')]()[_0x6f1b('0x30')](function(_0x50e902){return _[_0x6f1b('0x79')](_0x47e428,['name',_0x50e902])?_0x50e902:undefined;})[_0x6f1b('0x7a')]()[_0x6f1b('0x68')]();if(!_['isEmpty'](_0x489796)){_0x489796[_0x6f1b('0x34')](function(_0x402841){if(_0x402841===_0x6f1b('0x7b')){_0x38f356['where'](_0x6f1b('0x7c'),[][_0x6f1b('0x7d')](_0x3b19db[_0x6f1b('0x44')][_0x402841]));}else if(_0x402841==='createdAt'){var _0x1f1f76=JSON['parse'](_0x3b19db['query'][_0x402841])[_0x6f1b('0x7e')];var _0xa254c1=JSON[_0x6f1b('0x7f')](_0x3b19db[_0x6f1b('0x44')][_0x402841])[_0x6f1b('0x80')];_0x38f356[_0x6f1b('0x81')](_0x6f1b('0x82'),_0x1f1f76,_0xa254c1);}else{if(_0x3b19db[_0x6f1b('0x44')][_0x402841]===_0x6f1b('0x83')){_0x38f356[_0x6f1b('0x81')]('i.'+_0x402841+'\x20IS\x20NULL');}else{_0x38f356[_0x6f1b('0x81')]('i.'+_0x402841+_0x6f1b('0x84'),_0x3b19db[_0x6f1b('0x44')][_0x402841]);}}});}if(_0x3b19db[_0x6f1b('0x44')][_0x6f1b('0x85')]){if(_0x3b19db['query'][_0x6f1b('0x85')]==0x1){_0x38f356[_0x6f1b('0x69')](_0x6f1b('0x86'));}else{_0x38f356['having']('`unreadMessages`\x20>\x200');}}if(_0x3b19db['query'][_0x6f1b('0x87')]){_0x2373d8=_['isArray'](_0x3b19db['query'][_0x6f1b('0x87')])?_0x3b19db[_0x6f1b('0x44')][_0x6f1b('0x87')]:new Array(_0x3b19db['query'][_0x6f1b('0x87')]);_0x2373d8[_0x6f1b('0x34')](function(_0x1feb5a){_0x540655['or'](_0x6f1b('0x74'),'%,'+_0x1feb5a+',%');});}if(_0x3b19db['query'][_0x6f1b('0x88')]){var _0x355253=_0x3b19db[_0x6f1b('0x44')][_0x6f1b('0x88')][_0x6f1b('0x89')]('\x5c','\x5c\x5c')[_0x6f1b('0x89')](/'/g,'\x27\x27');if(qs[_0x6f1b('0x8a')](_0x355253)){_0x5b10e9['or'](_0x6f1b('0x8b'),_0x355253+'%')['or'](_0x6f1b('0x8c'),_0x355253+'%');}else{_0x5b10e9['or'](_0x6f1b('0x8d'),qs[_0x6f1b('0x6e')](_0x355253))['or'](_0x6f1b('0x8e'),_0x355253+'%');}}}_0x38f356['where'](_0x5b10e9);_0x38f356['group'](_0x6f1b('0x8f'));var _0x11adb6={'type':db[_0x6f1b('0x90')][_0x6f1b('0x91')][_0x6f1b('0x92')],'raw':!![]};var _0x54f453=_0x38f356[_0x6f1b('0x93')]();_0x54f453[_0x6f1b('0x4f')](_0x6f1b('0x8f'));_0x54f453[_0x6f1b('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x6f1b('0x67'));if(_0x165e21[_0x6f1b('0x4b')]){_0x165e21[_0x6f1b('0x4b')][_0x6f1b('0x34')](function(_0x3556f8){var _0x30fbf9=_0x3556f8[0x0]==='contactName'?_0x3556f8[0x0]:'i.'+_0x3556f8[0x0];_0x38f356[_0x6f1b('0x4b')](_0x30fbf9,_0x3556f8[0x1]==='DESC'?![]:!![]);});}if(!_[_0x6f1b('0x94')](_0x2373d8)){_0x38f356[_0x6f1b('0x69')](_0x540655);_0x54f453[_0x6f1b('0x81')](_0x6f1b('0x95'),_0x2373d8);}BPromise[_0x6f1b('0x96')]()[_0x6f1b('0x2a')](function(){if(!_0x435257){if(_0x3b19db[_0x6f1b('0x44')][_0x6f1b('0x7b')])return;_0x54f453['where'](_0x6f1b('0x97'));_0x38f356[_0x6f1b('0x81')](_0x6f1b('0x97'));return;}if(_0x3b19db[_0x6f1b('0x98')][_0x6f1b('0x99')]!==_0x6f1b('0x9a'))return;return _0x3b19db['user'][_0x6f1b('0x9b')]({'attributes':['id'],'raw':!![]})[_0x6f1b('0x2a')](function(_0x3069b9){if(_[_0x6f1b('0x94')](_0x3069b9)){_0x54f453[_0x6f1b('0x81')]('i.SmsAccountId\x20IS\x20NULL');_0x38f356[_0x6f1b('0x81')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x54f453[_0x6f1b('0x81')](_0x6f1b('0x7c'),_[_0x6f1b('0x30')](_0x3069b9,'id'));_0x38f356[_0x6f1b('0x81')](_0x6f1b('0x7c'),_[_0x6f1b('0x30')](_0x3069b9,'id'));}});})[_0x6f1b('0x2a')](function(){if(_0x3b19db[_0x6f1b('0x98')][_0x6f1b('0x99')]===_0x6f1b('0x9a')&&!_0x435257&&!_0x3b19db['query'][_0x6f1b('0x7b')])return[];return db[_0x6f1b('0x9c')]['query'](_0x54f453[_0x6f1b('0x9d')](),_0x11adb6);})['then'](function(_0x3d9805){_0x5a1e84[_0x6f1b('0x25')]=_0x3d9805['length'];if(_0x5a1e84[_0x6f1b('0x25')]===0x0)return[];return db['sequelize'][_0x6f1b('0x44')](_0x1ed7e0[_0x6f1b('0x9d')](),_0x11adb6)[_0x6f1b('0x2a')](function(_0x509e3c){_0x3c5120=_[_0x6f1b('0x9e')](_0x509e3c,'id');_0x11adb6=_['merge'](_0x11adb6,{'model':db[_0x6f1b('0x40')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3b19db[_0x6f1b('0x44')][_0x6f1b('0x9f')]){_0x165e21[_0x6f1b('0x47')][_0x6f1b('0x34')](function(_0x10f251){_0x38f356[_0x6f1b('0x4f')]('i.'+_0x10f251);});}else{_0x38f356[_0x6f1b('0x4f')](_0x6f1b('0xa0'),'unreadMessages');_0x38f356[_0x6f1b('0x4f')](_0x6f1b('0xa1'),_0x6f1b('0xa2'));_0x38f356[_0x6f1b('0x4f')]('a.mandatoryDisposition',_0x6f1b('0xa3'));_0x38f356[_0x6f1b('0x4f')]('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',_0x6f1b('0xa4'));_0x38f356[_0x6f1b('0x4f')](_0x6f1b('0xa5'));_0x38f356['field'](_0x6f1b('0xa6'),_0x6f1b('0xa7'));_0x38f356[_0x6f1b('0x4f')](_0x6f1b('0xa8'),_0x6f1b('0xa9'));_0x38f356[_0x6f1b('0x4f')]('c.email',_0x6f1b('0xaa'));_0x38f356[_0x6f1b('0x4f')](_0x6f1b('0xab'),_0x6f1b('0xac'));_0x38f356[_0x6f1b('0x4f')](_0x6f1b('0xad'),_0x6f1b('0xae'));_0x38f356[_0x6f1b('0x4f')](_0x6f1b('0xaf'),_0x6f1b('0xb0'));_0x38f356[_0x6f1b('0x4f')](_0x6f1b('0xb1'),'Owner.fullname');_0x38f356['field'](_0x6f1b('0xb2'),_0x6f1b('0xb3'));_0x38f356[_0x6f1b('0x4f')](_0x6f1b('0xb4'),_0x6f1b('0x32'));}if(_0x165e21[_0x6f1b('0x24')])_0x38f356[_0x6f1b('0x24')](_0x165e21[_0x6f1b('0x24')]);if(_0x165e21['offset'])_0x38f356['offset'](_0x165e21[_0x6f1b('0x22')]);return db[_0x6f1b('0x9c')][_0x6f1b('0x44')](_0x38f356[_0x6f1b('0x9d')](),_0x11adb6);})[_0x6f1b('0x2a')](function(_0x774478){if(_0x774478[_0x6f1b('0x48')]>0x0)_0x5b868d['where'](_0x6f1b('0xb5'),_[_0x6f1b('0x30')](_0x774478,'id'));return db['sequelize']['query'](_0x5b868d['toString'](),_0x11adb6)[_0x6f1b('0x2a')](function(_0x5681e0){var _0x23522a=_['groupBy'](_0x5681e0,_0x6f1b('0xb6'));var _0x540e26=[];_0x774478[_0x6f1b('0x34')](function(_0x5c9367){_0x540e26[_0x6f1b('0x36')](updateSmsInteraction(_0x5c9367,_0x3c5120,_0x23522a));});return BPromise[_0x6f1b('0xb7')](_0x540e26);});});})[_0x6f1b('0x2a')](function(_0x1bbec1){_0x5a1e84[_0x6f1b('0xb8')]=_0x1bbec1;return _0x5a1e84;})[_0x6f1b('0x2a')](respondWithFilteredResult(_0x48bac4,_0x165e21))['catch'](handleError(_0x48bac4,null));};exports['show']=function(_0x7ea36f,_0x5d9f71){var _0x1481f3={'raw':![],'where':{'id':_0x7ea36f[_0x6f1b('0xb9')]['id']}},_0x4bd5a7={};_0x4bd5a7[_0x6f1b('0x43')]=_[_0x6f1b('0x78')](db[_0x6f1b('0x40')][_0x6f1b('0x41')]);_0x4bd5a7['query']=_[_0x6f1b('0x78')](_0x7ea36f[_0x6f1b('0x44')]);_0x4bd5a7['filters']=_[_0x6f1b('0x46')](_0x4bd5a7[_0x6f1b('0x43')],_0x4bd5a7[_0x6f1b('0x44')]);_0x1481f3['attributes']=_[_0x6f1b('0x46')](_0x4bd5a7[_0x6f1b('0x43')],qs[_0x6f1b('0x9f')](_0x7ea36f[_0x6f1b('0x44')][_0x6f1b('0x9f')]));_0x1481f3[_0x6f1b('0x47')]=_0x1481f3[_0x6f1b('0x47')]['length']?_0x1481f3[_0x6f1b('0x47')]:_0x4bd5a7[_0x6f1b('0x43')];if(_0x7ea36f[_0x6f1b('0x44')]['includeAll']){_0x1481f3['include']=[{'all':!![]}];}_0x1481f3=_['merge']({},_0x1481f3,_0x7ea36f[_0x6f1b('0xba')]);return db['SmsInteraction']['find'](_0x1481f3)['then'](handleEntityNotFound(_0x5d9f71,null))['then'](respondWithResult(_0x5d9f71,null))[_0x6f1b('0x37')](handleError(_0x5d9f71,null));};exports[_0x6f1b('0xbb')]=function(_0x201760,_0x5ab4fc){return db[_0x6f1b('0x40')][_0x6f1b('0xbb')](_0x201760[_0x6f1b('0xbc')],{})[_0x6f1b('0x2a')](respondWithResult(_0x5ab4fc,0xc9))[_0x6f1b('0x37')](handleError(_0x5ab4fc,null));};exports['update']=function(_0x444ba0,_0x8980d1){if(_0x444ba0[_0x6f1b('0xbc')]['id']){delete _0x444ba0[_0x6f1b('0xbc')]['id'];}return db[_0x6f1b('0x40')]['find']({'where':{'id':_0x444ba0[_0x6f1b('0xb9')]['id']}})[_0x6f1b('0x2a')](handleEntityNotFound(_0x8980d1,null))[_0x6f1b('0x2a')](saveUpdates(_0x444ba0['body'],null))[_0x6f1b('0x2a')](respondWithResult(_0x8980d1,null))['catch'](handleError(_0x8980d1,null));};exports[_0x6f1b('0xbd')]=function(_0x1df45d,_0x5dda87){return db[_0x6f1b('0x40')][_0x6f1b('0x66')]({'where':{'id':_0x1df45d[_0x6f1b('0xb9')]['id']}})[_0x6f1b('0x2a')](handleEntityNotFound(_0x5dda87,null))['then'](removeEntity(_0x5dda87,null))[_0x6f1b('0x37')](handleError(_0x5dda87,null));};exports['describe']=function(_0x27dd97,_0x220651){return db[_0x6f1b('0x40')][_0x6f1b('0xbe')]()['then'](respondWithResult(_0x220651,null))[_0x6f1b('0x37')](handleError(_0x220651,null));};exports['addMessage']=function(_0x425acc,_0x38adbb,_0x1e86ea){return db['SmsMessage']['find']({'where':{'id':_0x425acc[_0x6f1b('0xb9')]['id']}})[_0x6f1b('0x2a')](handleEntityNotFound(_0x38adbb,null))['then'](function(_0x15f9cc){if(_0x15f9cc){return _0x15f9cc[_0x6f1b('0xbf')](_0x425acc[_0x6f1b('0xbc')][_0x6f1b('0xc0')],_[_0x6f1b('0xc1')](_0x425acc[_0x6f1b('0xbc')],[_0x6f1b('0xc0'),'id'])||{});}})[_0x6f1b('0x2a')](respondWithResult(_0x38adbb,null))[_0x6f1b('0x37')](handleError(_0x38adbb,null));};exports['getMessages']=function(_0x5ed117,_0x127ad9,_0x10d589){var _0x4bc2ea={'raw':![],'where':{}};var _0x2330bc={};var _0x513401={'count':0x0,'rows':[]};return db[_0x6f1b('0x40')][_0x6f1b('0xc2')]({'where':{'id':_0x5ed117[_0x6f1b('0xb9')]['id']}})[_0x6f1b('0x2a')](handleEntityNotFound(_0x127ad9,null))[_0x6f1b('0x2a')](function(_0x3eff13){if(_0x3eff13){_0x2330bc[_0x6f1b('0x43')]=_[_0x6f1b('0x78')](db[_0x6f1b('0xc3')]['rawAttributes']);_0x2330bc[_0x6f1b('0x44')]=_['keys'](_0x5ed117[_0x6f1b('0x44')]);_0x2330bc[_0x6f1b('0x45')]=_[_0x6f1b('0x46')](_0x2330bc['model'],_0x2330bc[_0x6f1b('0x44')]);_0x4bc2ea[_0x6f1b('0x47')]=_[_0x6f1b('0x46')](_0x2330bc['model'],qs['fields'](_0x5ed117[_0x6f1b('0x44')]['fields']));_0x4bc2ea[_0x6f1b('0x47')]=_0x4bc2ea[_0x6f1b('0x47')][_0x6f1b('0x48')]?_0x4bc2ea[_0x6f1b('0x47')]:_0x2330bc['model'];if(!_0x5ed117[_0x6f1b('0x44')]['hasOwnProperty'](_0x6f1b('0x4a'))){_0x4bc2ea[_0x6f1b('0x24')]=qs[_0x6f1b('0x24')](_0x5ed117['query'][_0x6f1b('0x24')]);_0x4bc2ea[_0x6f1b('0x22')]=qs['offset'](_0x5ed117[_0x6f1b('0x44')][_0x6f1b('0x22')]);}_0x4bc2ea['order']=qs['sort'](_0x5ed117[_0x6f1b('0x44')]['sort']);_0x4bc2ea[_0x6f1b('0x81')]=qs['filters'](_[_0x6f1b('0x4d')](_0x5ed117[_0x6f1b('0x44')],_0x2330bc[_0x6f1b('0x45')]));_0x4bc2ea[_0x6f1b('0x81')]['SmsInteractionId']=_0x3eff13['id'];if(_0x5ed117[_0x6f1b('0x44')][_0x6f1b('0x88')]){_0x4bc2ea[_0x6f1b('0x81')]=_[_0x6f1b('0xc4')](_0x4bc2ea[_0x6f1b('0x81')],{'$or':_[_0x6f1b('0x30')](_0x4bc2ea[_0x6f1b('0x47')],function(_0x2f2a81){var _0x115f9a={};_0x115f9a[_0x2f2a81]={'$like':'%'+_0x5ed117[_0x6f1b('0x44')][_0x6f1b('0x88')]+'%'};return _0x115f9a;})});}if(_0x5ed117[_0x6f1b('0x44')][_0x6f1b('0x7e')]){var _0x42d868=_0x5ed117[_0x6f1b('0x44')][_0x6f1b('0x7e')][_0x6f1b('0x33')](',');var _0x39f4d7={};_0x39f4d7[_0x42d868[0x0]]={'$gte':moment(_0x42d868[0x1])[_0x6f1b('0xc5')](_0x6f1b('0xc6'))};_0x4bc2ea['where']=_[_0x6f1b('0xc4')](_0x4bc2ea[_0x6f1b('0x81')],_0x39f4d7);}_0x4bc2ea=_['merge']({},_0x4bc2ea,_0x5ed117[_0x6f1b('0xba')]);return db['SmsMessage'][_0x6f1b('0x25')]({'where':_0x4bc2ea[_0x6f1b('0x81')]})['then'](function(_0x5a02ef){_0x513401['count']=_0x5a02ef;if(_0x5ed117[_0x6f1b('0x44')]['includeAll']){_0x4bc2ea[_0x6f1b('0xc7')]=[{'all':!![]}];}return db['SmsMessage'][_0x6f1b('0xc8')](_0x4bc2ea);})[_0x6f1b('0x2a')](function(_0x57df8d){_0x513401[_0x6f1b('0xb8')]=_0x57df8d;return _0x513401;});}})[_0x6f1b('0x2a')](respondWithFilteredResult(_0x127ad9,_0x4bc2ea))[_0x6f1b('0x37')](handleError(_0x127ad9,null));};exports[_0x6f1b('0xc9')]=function(_0x5bdfe1,_0xb168e2,_0xb6e137){return db[_0x6f1b('0x40')][_0x6f1b('0x66')]({'where':{'id':_0x5bdfe1['params']['id']}})['then'](handleEntityNotFound(_0xb168e2,null))[_0x6f1b('0x2a')](function(_0x3a77fe){if(_0x3a77fe){return _0x3a77fe[_0x6f1b('0xca')](_0x5bdfe1['body'][_0x6f1b('0xc0')],_[_0x6f1b('0xc1')](_0x5bdfe1['body'],[_0x6f1b('0xc0'),'id'])||{})[_0x6f1b('0xcb')](function(){return db['Tag']['findAll']({'attributes':['id',_0x6f1b('0x2d'),_0x6f1b('0xcc')],'where':{'id':_0x5bdfe1[_0x6f1b('0xbc')][_0x6f1b('0xc0')]}});})[_0x6f1b('0x2a')](function(_0x35434c){socket[_0x6f1b('0xcd')]('smsInteractionTags:save',{'id':Number(_0x5bdfe1['params']['id']),'tags':_0x35434c||[]});return{'id':Number(_0x5bdfe1['params']['id']),'tags':_0x35434c||[]};});}})[_0x6f1b('0x2a')](respondWithResult(_0xb168e2,null))[_0x6f1b('0x37')](handleError(_0xb168e2,null));};exports[_0x6f1b('0xce')]=function(_0x17cf3c,_0x304fa5,_0x3fe695){return db[_0x6f1b('0x40')][_0x6f1b('0x66')]({'where':{'id':_0x17cf3c['params']['id']}})[_0x6f1b('0x2a')](handleEntityNotFound(_0x304fa5,null))[_0x6f1b('0x2a')](function(_0x4e4fb2){if(_0x4e4fb2){return _0x4e4fb2[_0x6f1b('0xce')](_0x17cf3c[_0x6f1b('0x44')][_0x6f1b('0xc0')]);}})[_0x6f1b('0x2a')](respondWithStatusCode(_0x304fa5,null))[_0x6f1b('0x37')](handleError(_0x304fa5,null));};exports[_0x6f1b('0xcf')]=function(_0x3629fd,_0x573ac9){var _0x157533=moment()[_0x6f1b('0xd0')]()[_0x6f1b('0x9d')]();var _0x28c732=path[_0x6f1b('0xd1')](config[_0x6f1b('0xd2')],_0x6f1b('0xd3'),_0x6f1b('0xd4'),'tmp');var _0x46aed6=path[_0x6f1b('0xd1')](config['root'],'server',_0x6f1b('0xd4'),'attachments');var _0x46be00=path['join'](_0x28c732,_0x157533);var _0x55ff44=util[_0x6f1b('0xc5')]('transcript-%d-%s.zip',_0x3629fd[_0x6f1b('0xb9')]['id'],_0x157533);var _0x11ed04=path[_0x6f1b('0xd1')](_0x28c732,_0x55ff44);var _0x115632=[];_0x115632[_0x6f1b('0x36')]({'model':db[_0x6f1b('0x75')],'as':_0x6f1b('0x75'),'attributes':['id',_0x6f1b('0x31')],'raw':!![]});_0x115632[_0x6f1b('0x36')]({'model':db[_0x6f1b('0xd5')],'as':_0x6f1b('0x6c'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x3eeedc=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id','body',_0x6f1b('0xd6'),_0x6f1b('0xd7'),_0x6f1b('0xd8'),'read'],'include':_0x115632}];_0x3eeedc[_0x6f1b('0x36')]({'model':db[_0x6f1b('0xd9')],'as':_0x6f1b('0xda'),'attributes':['id',_0x6f1b('0x2d')]});_0x3eeedc[_0x6f1b('0x36')]({'model':db[_0x6f1b('0x75')],'as':_0x6f1b('0xdb'),'attributes':['id','fullname']});return db[_0x6f1b('0x40')][_0x6f1b('0x66')]({'where':{'id':_0x3629fd['params']['id']},'include':_0x3eeedc})['then'](handleEntityNotFound(_0x573ac9,null))[_0x6f1b('0x2a')](function(_0x2640f6){if(_0x2640f6){var _0x2aff92=_0x2640f6['get']({'plain':!![]});fs[_0x6f1b('0xdc')](_0x46be00);var _0x37882c={'channel':_0x6f1b('0xdd'),'account':_0x2aff92[_0x6f1b('0xda')]['name'],'agent':_0x2aff92['Owner']?_0x2aff92[_0x6f1b('0xdb')][_0x6f1b('0x31')]:'N.A.','createdAt':moment(_0x2aff92[_0x6f1b('0xd6')])[_0x6f1b('0xc5')](_0x6f1b('0xc6'))[_0x6f1b('0x9d')](),'closedAt':_0x2aff92[_0x6f1b('0x3d')]?moment(_0x2aff92[_0x6f1b('0xde')])[_0x6f1b('0xc5')](_0x6f1b('0xc6'))['toString']():'','disposition':_0x2aff92['disposition'],'messages':_(_0x2aff92[_0x6f1b('0xdf')])[_0x6f1b('0x88')]({'secret':![]})[_0x6f1b('0x30')](function(_0x14408f){return{'date':moment(_0x14408f['createdAt'])[_0x6f1b('0xc5')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x14408f[_0x6f1b('0xd7')]==='out'?_0x14408f['User']?_0x14408f['User'][_0x6f1b('0x31')]:_0x6f1b('0xe0'):_0x14408f[_0x6f1b('0x6c')][_0x6f1b('0xe1')]+(_0x14408f[_0x6f1b('0x6c')][_0x6f1b('0xe2')]?'\x20'+_0x14408f[_0x6f1b('0x6c')][_0x6f1b('0xe2')]:''),'body':_0x14408f[_0x6f1b('0xbc')],'direction':_0x14408f[_0x6f1b('0xd7')]===_0x6f1b('0xe3')?'A':'C','secret':_0x14408f['secret'],'read':_0x14408f['read']};})['value']()};return ejs[_0x6f1b('0xe4')](path[_0x6f1b('0xd1')](config['root'],_0x6f1b('0xd3'),'views',_0x6f1b('0xe5')),{'interaction':_0x37882c})[_0x6f1b('0x2a')](function(_0x58d3d0){var _0x2d99f9=path[_0x6f1b('0xd1')](_0x46be00,'transcript-'+_0x2aff92['id']+'-'+_0x157533+_0x6f1b('0xe6'));var _0x257f3a={'path':_0x2d99f9,'channel':_0x6f1b('0xdd'),'interactionId':_0x2aff92['id']};return pdf['createPdfFromHTML'](_0x58d3d0,_0x257f3a);})[_0x6f1b('0x2a')](function(){return new BPromise(function(_0x1f4b8b,_0x570c00){zipdir(_0x46be00,{'saveTo':_0x11ed04},function(_0xa80898,_0x21b9bc){if(_0xa80898)return _0x570c00(_0xa80898);return _0x1f4b8b(_0x21b9bc);});})[_0x6f1b('0x2a')](function(){return new BPromise(function(_0x1ca53e,_0x582d37){rimraf(_0x46be00,function(_0xa75a79){if(_0xa75a79)_0x582d37(_0xa75a79);return _0x1ca53e();});});})[_0x6f1b('0x2a')](function(){return _0x573ac9['download'](_0x11ed04,_0x55ff44,function(_0x22947b){if(_0x22947b){console[_0x6f1b('0xe7')](_0x6f1b('0xe8'),_0x22947b);}else{fs[_0x6f1b('0xe9')](_0x11ed04);}});});});}else{return _0x573ac9[_0x6f1b('0x1f')](0xc8);}})[_0x6f1b('0x37')](handleError(_0x573ac9,null));}; \ No newline at end of file +var _0x805c=['i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','show','params','includeAll','include','options','create','update','addMessage','SmsMessage','omit','ids','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','attachments','firstName','lastName','Messages','direction','secret','SmsAccount','Account','Owner','get','Sms','N.A.','closedAt','out','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','eml-format','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','end','offset','limit','undefined','count','status','set','json','apply','save','then','destroy','sendStatus','error','stack','name','send','Users','map','fullname','Tags','TagIds','push','catch','waiting','talking','answered','total','UserId','closed','unmanaged','SmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','select','field','color','from','tools_tags','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END'];(function(_0x42b25e,_0x2e20bd){var _0x402345=function(_0x48ff2e){while(--_0x48ff2e){_0x42b25e['push'](_0x42b25e['shift']());}};_0x402345(++_0x2e20bd);}(_0x805c,0x12d));var _0xc805=function(_0x278220,_0x10499c){_0x278220=_0x278220-0x0;var _0x373c5f=_0x805c[_0x278220];return _0x373c5f;};'use strict';var emlformat=require(_0xc805('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc805('0x1'));var moment=require(_0xc805('0x2'));var BPromise=require(_0xc805('0x3'));var Mustache=require(_0xc805('0x4'));var util=require(_0xc805('0x5'));var path=require('path');var sox=require(_0xc805('0x6'));var csv=require('to-csv');var ejs=require(_0xc805('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc805('0x8'));var squel=require(_0xc805('0x9'));var crypto=require(_0xc805('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc805('0xb'));var querystring=require(_0xc805('0xc'));var Papa=require('papaparse');var Redis=require(_0xc805('0xd'));var authService=require(_0xc805('0xe'));var qs=require(_0xc805('0xf'));var as=require(_0xc805('0x10'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc805('0x11'))('api');var utils=require(_0xc805('0x12'));var config=require(_0xc805('0x13'));var licenseUtil=require(_0xc805('0x14'));var db=require(_0xc805('0x15'))['db'];config[_0xc805('0x16')]=_[_0xc805('0x17')](config[_0xc805('0x16')],{'host':_0xc805('0x18'),'port':0x18eb});var socket=require(_0xc805('0x19'))(new Redis(config[_0xc805('0x16')]));require(_0xc805('0x1a'))['register'](socket);function respondWithStatusCode(_0x4e6718,_0x3decf2){_0x3decf2=_0x3decf2||0xcc;return function(_0x134d1e){if(_0x134d1e){return _0x4e6718['sendStatus'](_0x3decf2);}return _0x4e6718['status'](_0x3decf2)[_0xc805('0x1b')]();};}function respondWithResult(_0x243902,_0x58552f){_0x58552f=_0x58552f||0xc8;return function(_0x2620bd){if(_0x2620bd){return _0x243902['status'](_0x58552f)['json'](_0x2620bd);}};}function respondWithFilteredResult(_0x388179,_0x4fd970){return function(_0x4ac374){if(_0x4ac374){var _0x434965=typeof _0x4fd970[_0xc805('0x1c')]==='undefined'&&typeof _0x4fd970[_0xc805('0x1d')]===_0xc805('0x1e');var _0x1f925f=_0x4ac374[_0xc805('0x1f')];var _0x591979=_0x434965?0x0:_0x4fd970[_0xc805('0x1c')];var _0x38e9b0=_0x434965?_0x4ac374[_0xc805('0x1f')]:_0x4fd970['offset']+_0x4fd970[_0xc805('0x1d')];var _0x479c36;if(_0x38e9b0>=_0x1f925f){_0x38e9b0=_0x1f925f;_0x479c36=0xc8;}else{_0x479c36=0xce;}_0x388179[_0xc805('0x20')](_0x479c36);return _0x388179[_0xc805('0x21')]('Content-Range',_0x591979+'-'+_0x38e9b0+'/'+_0x1f925f)[_0xc805('0x22')](_0x4ac374);}return null;};}function patchUpdates(_0x2d5b5a){return function(_0x1bc6ea){try{jsonpatch[_0xc805('0x23')](_0x1bc6ea,_0x2d5b5a,!![]);}catch(_0x1c7810){return BPromise['reject'](_0x1c7810);}return _0x1bc6ea[_0xc805('0x24')]();};}function saveUpdates(_0x3841e0,_0x33703b){return function(_0x6aa00e){if(_0x6aa00e){return _0x6aa00e['update'](_0x3841e0)[_0xc805('0x25')](function(_0xc811c9){return _0xc811c9;});}return null;};}function removeEntity(_0x309676,_0x33fc86){return function(_0xeccf90){if(_0xeccf90){return _0xeccf90[_0xc805('0x26')]()[_0xc805('0x25')](function(){_0x309676[_0xc805('0x20')](0xcc)[_0xc805('0x1b')]();});}};}function handleEntityNotFound(_0x356ce6,_0x53c6d0){return function(_0x4592bb){if(!_0x4592bb){_0x356ce6[_0xc805('0x27')](0x194);}return _0x4592bb;};}function handleError(_0x17c055,_0x59a6d0){_0x59a6d0=_0x59a6d0||0x1f4;return function(_0x55f22e){logger[_0xc805('0x28')](_0x55f22e[_0xc805('0x29')]);if(_0x55f22e[_0xc805('0x2a')]){delete _0x55f22e[_0xc805('0x2a')];}_0x17c055[_0xc805('0x20')](_0x59a6d0)[_0xc805('0x2b')](_0x55f22e);};}function getInteractionUsers(_0x33eeba,_0x420340){return new BPromise(function(_0x1518f8,_0x5c85e9){try{if(_0x420340[_0x33eeba['id']]){_0x33eeba[_0xc805('0x2c')]=_[_0xc805('0x2d')](_0x420340[_0x33eeba['id']],function(_0x4fd31e){return{'id':_0x4fd31e['id'],'fullname':_0x4fd31e[_0xc805('0x2e')]};});}}catch(_0x17d2af){_0x5c85e9(_0x17d2af);}_0x1518f8(_0x33eeba);});}function getInteractionTags(_0x57e653,_0x2c7826){return new BPromise(function(_0x2d1d4e,_0x4af4a4){try{if(_0x57e653['TagIds']){_0x57e653[_0xc805('0x2f')]=[];_0x57e653[_0xc805('0x30')]['split'](',')['forEach'](function(_0x2b12de){_0x57e653[_0xc805('0x2f')][_0xc805('0x31')](_0x2c7826[_0x2b12de]);});}delete _0x57e653[_0xc805('0x30')];}catch(_0x44aa92){_0x4af4a4(_0x44aa92);}_0x2d1d4e(_0x57e653);});}function updateSmsInteraction(_0x9fa1e1,_0x266b7e,_0x184cf9){return new BPromise(function(_0x136be4,_0xbd6f3){return getInteractionUsers(_0x9fa1e1,_0x184cf9)['then'](function(_0x12c8a0){return getInteractionTags(_0x12c8a0,_0x266b7e);})[_0xc805('0x25')](function(_0x296760){return getStateInteraction(_0x296760);})[_0xc805('0x25')](function(_0x1ac805){_0x136be4(_0x1ac805);})[_0xc805('0x32')](function(_0x226403){_0xbd6f3(_0x226403);});});}function getStateInteraction(_0x56cd61){return new BPromise(function(_0xac8049){_0x56cd61[_0xc805('0x33')]=0x0;_0x56cd61[_0xc805('0x34')]=0x0;_0x56cd61[_0xc805('0x35')]=0x0;_0x56cd61['unmanaged']=0x0;_0x56cd61[_0xc805('0x36')]=0x0;if(!_0x56cd61['closed']&&!_0x56cd61[_0xc805('0x37')]){_0x56cd61['waiting']+=0x1;}if(!_0x56cd61[_0xc805('0x38')]&&_0x56cd61[_0xc805('0x37')]){_0x56cd61['talking']+=0x1;if(_0x56cd61[_0xc805('0x33')]){_0x56cd61[_0xc805('0x33')]-=0x1;}}if(_0x56cd61[_0xc805('0x38')]&&_0x56cd61[_0xc805('0x37')]){_0x56cd61['answered']+=0x1;if(_0x56cd61[_0xc805('0x34')]){_0x56cd61['talking']-=0x1;}}if(_0x56cd61[_0xc805('0x38')]&&!_0x56cd61[_0xc805('0x37')]){_0x56cd61[_0xc805('0x39')]+=0x1;if(_0x56cd61['waiting']){_0x56cd61[_0xc805('0x33')]-=0x1;}}_0x56cd61['total']+=0x1;_0xac8049(_0x56cd61);});}exports['index']=function(_0x879a95,_0x314528){var _0xe4ce07={},_0x4b2bf7={},_0x27e078={'count':0x0,'rows':[]};var _0x6b51b3=_[_0xc805('0x2d')](db[_0xc805('0x3a')][_0xc805('0x3b')],function(_0x3ab2fb){return{'name':_0x3ab2fb[_0xc805('0x3c')],'type':_0x3ab2fb[_0xc805('0x3d')][_0xc805('0x3e')]};});_0x4b2bf7[_0xc805('0x3f')]=_[_0xc805('0x2d')](_0x6b51b3,_0xc805('0x2a'));_0x4b2bf7[_0xc805('0x40')]=_[_0xc805('0x41')](_0x879a95['query']);_0x4b2bf7['filters']=_['intersection'](_0x4b2bf7[_0xc805('0x3f')],_0x4b2bf7[_0xc805('0x40')]);_0xe4ce07[_0xc805('0x42')]=_[_0xc805('0x43')](_0x4b2bf7[_0xc805('0x3f')],qs[_0xc805('0x44')](_0x879a95['query'][_0xc805('0x44')]));_0xe4ce07[_0xc805('0x42')]=_0xe4ce07[_0xc805('0x42')][_0xc805('0x45')]?_0xe4ce07[_0xc805('0x42')]:_0x4b2bf7[_0xc805('0x3f')];if(!_0x879a95[_0xc805('0x40')][_0xc805('0x46')](_0xc805('0x47'))){_0xe4ce07[_0xc805('0x1d')]=qs['limit'](_0x879a95['query'][_0xc805('0x1d')]);_0xe4ce07[_0xc805('0x1c')]=qs[_0xc805('0x1c')](_0x879a95[_0xc805('0x40')][_0xc805('0x1c')]);}_0xe4ce07[_0xc805('0x48')]=qs[_0xc805('0x49')](_0x879a95['query'][_0xc805('0x49')]);_0xe4ce07['where']=qs[_0xc805('0x4a')](_[_0xc805('0x4b')](_0x879a95[_0xc805('0x40')],_0x4b2bf7['filters']),_0x6b51b3);var _0x2795b0=[];var _0x1e3bc0=squel[_0xc805('0x4c')]()[_0xc805('0x4d')]('id')[_0xc805('0x4d')](_0xc805('0x2a'))[_0xc805('0x4d')](_0xc805('0x4e'))[_0xc805('0x4f')](_0xc805('0x50'));var _0x2e46ae=squel[_0xc805('0x4c')]()[_0xc805('0x4d')]('u.id')['field'](_0xc805('0x51'))[_0xc805('0x4d')](_0xc805('0x52'))[_0xc805('0x4f')](_0xc805('0x53'),'ui')[_0xc805('0x54')](_0xc805('0x55'),'u',_0xc805('0x56'));var _0x544a07=squel[_0xc805('0x4c')]()[_0xc805('0x4f')](_0xc805('0x57'),'i')['left_join'](_0xc805('0x58'),'c',_0xc805('0x59'))[_0xc805('0x54')]('users','o',_0xc805('0x5a'))['left_join'](_0xc805('0x5b'),'a','a.id\x20=\x20i.SmsAccountId')['left_join'](_0xc805('0x5c'),'me',_0xc805('0x5d'))['left_join'](_0xc805('0x5e'),'it','it.SmsInteractionId\x20=\x20i.id')[_0xc805('0x54')](_0xc805('0x50'),'t',_0xc805('0x5f'));var _0x5dd8e9=squel[_0xc805('0x60')]();var _0x13c53a=[];var _0x40d9bf=squel['expr']();var _0x5947c3;if(_0x879a95[_0xc805('0x40')]['search']){_0x5947c3=as['parseSearch'](_0x879a95[_0xc805('0x40')]['search']);var _0x10fff2=_0x5947c3[_0xc805('0x61')];for(var _0x256ad0=0x0;_0x256ad0<_0x5947c3[_0xc805('0x62')][_0xc805('0x45')];_0x256ad0++){var _0x4b2c60=_0x5947c3['conditions'][_0x256ad0];var _0x2ad1f3='i';var _0x2a9682=_[_0xc805('0x63')](_0x6b51b3,[_0xc805('0x2a'),_0x4b2c60[_0xc805('0x4d')]]);if(!_0x2a9682){switch(_0x4b2c60[_0xc805('0x4d')]){case _0xc805('0x64'):if(_0x4b2c60['value']==0x1){_0x544a07[_0xc805('0x65')]('`'+_0x4b2c60[_0xc805('0x4d')]+_0xc805('0x66'));}else{_0x544a07[_0xc805('0x65')]('`'+_0x4b2c60['field']+_0xc805('0x67'));}break;case _0xc805('0x68'):if(_0x4b2c60[_0xc805('0x69')]===_0xc805('0x6a')){if(_0x4b2c60['value'][_0xc805('0x6b')]('\x20')['length']>0x1){_0x5dd8e9[_0x10fff2](_0xc805('0x6c'),qs[_0xc805('0x6d')](_0x4b2c60[_0xc805('0x6e')]),null);}else{var _0xa8743f='%'+_0x4b2c60['value']+'%';_0x5dd8e9[_0x10fff2](_0xc805('0x6f'),_0xa8743f,_0xa8743f,_0xa8743f);}}else{_0x2a9682=_['find'](_0x6b51b3,[_0xc805('0x2a'),_0xc805('0x70')]);_0x4b2c60[_0xc805('0x4d')]=_0xc805('0x70');_0x4af0c2=as[_0xc805('0x71')](_0x2ad1f3,_0x2a9682[_0xc805('0x3d')],_0x4b2c60);_0x5dd8e9[_0x10fff2](_0x4af0c2[_0xc805('0x72')],_0x4af0c2['value'][_0xc805('0x73')],_0x4af0c2[_0xc805('0x6e')][_0xc805('0x1b')]);}break;case _0xc805('0x74'):var _0x10128b=_0x4b2c60[_0xc805('0x6e')][_0xc805('0x6b')](',')[_0xc805('0x2d')](function(_0x4c5d50){return Number(_0x4c5d50);});_0x10128b[_0xc805('0x75')](function(_0x10cd23){_0x40d9bf['or'](_0xc805('0x76'),'%,'+_0x10cd23+',%');});_0x13c53a=_['union'](_0x13c53a,_0x10128b);break;case _0xc805('0x77'):if(_0x4b2c60[_0xc805('0x69')]==='$substring'){_0x5dd8e9[_0x10fff2](_0xc805('0x78'),'%'+_0x4b2c60[_0xc805('0x6e')]+'%',null);}else{_0x2a9682=_[_0xc805('0x63')](_0x6b51b3,[_0xc805('0x2a'),_0xc805('0x37')]);_0x4b2c60[_0xc805('0x4d')]=_0xc805('0x37');_0x4af0c2=as[_0xc805('0x71')](_0x2ad1f3,_0x2a9682[_0xc805('0x3d')],_0x4b2c60);_0x5dd8e9[_0x10fff2](_0x4af0c2[_0xc805('0x72')],_0x4af0c2[_0xc805('0x6e')][_0xc805('0x73')],_0x4af0c2[_0xc805('0x6e')]['end']);}break;case _0xc805('0x79'):_0x4af0c2=as[_0xc805('0x71')]('me',null,_0x4b2c60);_0x5dd8e9[_0x10fff2](_0x4af0c2[_0xc805('0x72')],_0x4af0c2[_0xc805('0x6e')][_0xc805('0x73')],_0x4af0c2['value'][_0xc805('0x1b')]);break;}}else{var _0x4af0c2=as['buildExpression'](_0x2ad1f3,_0x2a9682[_0xc805('0x3d')],_0x4b2c60);_0x5dd8e9[_0x10fff2](_0x4af0c2[_0xc805('0x72')],_0x4af0c2[_0xc805('0x6e')][_0xc805('0x73')],_0x4af0c2[_0xc805('0x6e')][_0xc805('0x1b')]);}}}else{var _0x556e80=_(_0x879a95[_0xc805('0x40')])[_0xc805('0x41')]()[_0xc805('0x2d')](function(_0x4dc1fe){return _[_0xc805('0x7a')](_0x6b51b3,[_0xc805('0x2a'),_0x4dc1fe])?_0x4dc1fe:undefined;})[_0xc805('0x7b')]()[_0xc805('0x6e')]();if(!_['isEmpty'](_0x556e80)){_0x556e80['forEach'](function(_0x50e867){if(_0x50e867===_0xc805('0x7c')){_0x544a07[_0xc805('0x7d')](_0xc805('0x7e'),[]['concat'](_0x879a95['query'][_0x50e867]));}else if(_0x50e867===_0xc805('0x7f')){var _0x474bde=JSON[_0xc805('0x80')](_0x879a95[_0xc805('0x40')][_0x50e867])['$gte'];var _0x134fb7=JSON['parse'](_0x879a95[_0xc805('0x40')][_0x50e867])[_0xc805('0x81')];_0x544a07[_0xc805('0x7d')](_0xc805('0x82'),_0x474bde,_0x134fb7);}else{if(_0x879a95[_0xc805('0x40')][_0x50e867]==='null'){_0x544a07[_0xc805('0x7d')]('i.'+_0x50e867+_0xc805('0x83'));}else{_0x544a07[_0xc805('0x7d')]('i.'+_0x50e867+_0xc805('0x84'),_0x879a95[_0xc805('0x40')][_0x50e867]);}}});}if(_0x879a95[_0xc805('0x40')][_0xc805('0x85')]){if(_0x879a95[_0xc805('0x40')]['read']==0x1){_0x544a07[_0xc805('0x65')]('`unreadMessages`\x20=\x200');}else{_0x544a07[_0xc805('0x65')]('`unreadMessages`\x20>\x200');}}if(_0x879a95[_0xc805('0x40')][_0xc805('0x86')]){_0x13c53a=_[_0xc805('0x87')](_0x879a95[_0xc805('0x40')][_0xc805('0x86')])?_0x879a95['query'][_0xc805('0x86')]:new Array(_0x879a95[_0xc805('0x40')][_0xc805('0x86')]);_0x13c53a[_0xc805('0x75')](function(_0x59f8e5){_0x40d9bf['or'](_0xc805('0x76'),'%,'+_0x59f8e5+',%');});}if(_0x879a95[_0xc805('0x40')][_0xc805('0x88')]){var _0x2a0f6a=_0x879a95[_0xc805('0x40')][_0xc805('0x88')][_0xc805('0x89')]('\x5c','\x5c\x5c')[_0xc805('0x89')](/'/g,'\x27\x27');if(qs[_0xc805('0x8a')](_0x2a0f6a)){_0x5dd8e9['or'](_0xc805('0x8b'),_0x2a0f6a+'%')['or']('i.phone\x20LIKE\x20?',_0x2a0f6a+'%');}else{_0x5dd8e9['or'](_0xc805('0x8c'),qs[_0xc805('0x6d')](_0x2a0f6a))['or'](_0xc805('0x8d'),_0x2a0f6a+'%');}}}_0x544a07['where'](_0x5dd8e9);_0x544a07[_0xc805('0x8e')](_0xc805('0x8f'));var _0x4772e2={'type':db[_0xc805('0x90')][_0xc805('0x91')][_0xc805('0x92')],'raw':!![]};var _0x27e611=_0x544a07[_0xc805('0x93')]();_0x27e611[_0xc805('0x4d')]('i.id');_0x27e611[_0xc805('0x4d')](_0xc805('0x94'),_0xc805('0x64'));if(_0xe4ce07[_0xc805('0x48')]){_0xe4ce07[_0xc805('0x48')]['forEach'](function(_0x738ea1){var _0xc60719=_0x738ea1[0x0]===_0xc805('0x95')?_0x738ea1[0x0]:'i.'+_0x738ea1[0x0];_0x544a07[_0xc805('0x48')](_0xc60719,_0x738ea1[0x1]===_0xc805('0x96')?![]:!![]);});}if(!_[_0xc805('0x97')](_0x13c53a)){_0x544a07[_0xc805('0x65')](_0x40d9bf);_0x27e611[_0xc805('0x7d')](_0xc805('0x98'),_0x13c53a);}BPromise[_0xc805('0x99')]()['then'](function(){if(!_0x5947c3){if(_0x879a95[_0xc805('0x40')][_0xc805('0x7c')])return;_0x27e611[_0xc805('0x7d')](_0xc805('0x9a'));_0x544a07[_0xc805('0x7d')](_0xc805('0x9a'));return;}if(_0x879a95[_0xc805('0x9b')][_0xc805('0x9c')]!==_0xc805('0x9d'))return;return _0x879a95[_0xc805('0x9b')][_0xc805('0x9e')]({'attributes':['id'],'raw':!![]})[_0xc805('0x25')](function(_0x573e32){if(_[_0xc805('0x97')](_0x573e32)){_0x27e611[_0xc805('0x7d')](_0xc805('0x9f'));_0x544a07[_0xc805('0x7d')](_0xc805('0x9f'));}else{_0x27e611[_0xc805('0x7d')](_0xc805('0x7e'),_['map'](_0x573e32,'id'));_0x544a07['where'](_0xc805('0x7e'),_[_0xc805('0x2d')](_0x573e32,'id'));}});})[_0xc805('0x25')](function(){if(_0x879a95[_0xc805('0x9b')][_0xc805('0x9c')]===_0xc805('0x9d')&&!_0x5947c3&&!_0x879a95[_0xc805('0x40')][_0xc805('0x7c')])return[];return db[_0xc805('0xa0')]['query'](_0x27e611[_0xc805('0xa1')](),_0x4772e2);})[_0xc805('0x25')](function(_0x3bdb00){_0x27e078[_0xc805('0x1f')]=_0x3bdb00[_0xc805('0x45')];if(_0x27e078[_0xc805('0x1f')]===0x0)return[];return db[_0xc805('0xa0')][_0xc805('0x40')](_0x1e3bc0[_0xc805('0xa1')](),_0x4772e2)[_0xc805('0x25')](function(_0xb351c0){_0x2795b0=_['keyBy'](_0xb351c0,'id');_0x4772e2=_[_0xc805('0xa2')](_0x4772e2,{'model':db[_0xc805('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x879a95['query'][_0xc805('0x44')]){_0xe4ce07[_0xc805('0x42')][_0xc805('0x75')](function(_0xbeb805){_0x544a07[_0xc805('0x4d')]('i.'+_0xbeb805);});}else{_0x544a07['field'](_0xc805('0x94'),'unreadMessages');_0x544a07['field']('a.key',_0xc805('0xa3'));_0x544a07[_0xc805('0x4d')](_0xc805('0xa4'),_0xc805('0xa5'));_0x544a07['field'](_0xc805('0xa6'),_0xc805('0x95'));_0x544a07[_0xc805('0x4d')](_0xc805('0xa7'));_0x544a07['field'](_0xc805('0xa8'),'Contact.firstName');_0x544a07['field'](_0xc805('0xa9'),_0xc805('0xaa'));_0x544a07[_0xc805('0x4d')](_0xc805('0xab'),_0xc805('0xac'));_0x544a07[_0xc805('0x4d')](_0xc805('0xad'),_0xc805('0xae'));_0x544a07[_0xc805('0x4d')](_0xc805('0xaf'),'Contact.mobile');_0x544a07[_0xc805('0x4d')](_0xc805('0xb0'),'Contact.fax');_0x544a07[_0xc805('0x4d')]('o.fullname',_0xc805('0xb1'));_0x544a07[_0xc805('0x4d')]('o.internal','Owner.internal');_0x544a07['field'](_0xc805('0xb2'),_0xc805('0x30'));}if(_0xe4ce07[_0xc805('0x1d')])_0x544a07['limit'](_0xe4ce07['limit']);if(_0xe4ce07[_0xc805('0x1c')])_0x544a07[_0xc805('0x1c')](_0xe4ce07[_0xc805('0x1c')]);return db['sequelize'][_0xc805('0x40')](_0x544a07[_0xc805('0xa1')](),_0x4772e2);})[_0xc805('0x25')](function(_0x51e495){if(_0x51e495[_0xc805('0x45')]>0x0)_0x2e46ae[_0xc805('0x7d')](_0xc805('0xb3'),_[_0xc805('0x2d')](_0x51e495,'id'));return db[_0xc805('0xa0')]['query'](_0x2e46ae[_0xc805('0xa1')](),_0x4772e2)[_0xc805('0x25')](function(_0x108429){var _0x13bf89=_[_0xc805('0xb4')](_0x108429,_0xc805('0xb5'));var _0x3d388c=[];_0x51e495[_0xc805('0x75')](function(_0x56d854){_0x3d388c[_0xc805('0x31')](updateSmsInteraction(_0x56d854,_0x2795b0,_0x13bf89));});return BPromise['all'](_0x3d388c);});});})['then'](function(_0x57e3be){_0x27e078['rows']=_0x57e3be;return _0x27e078;})[_0xc805('0x25')](respondWithFilteredResult(_0x314528,_0xe4ce07))['catch'](handleError(_0x314528,null));};exports[_0xc805('0xb6')]=function(_0x360739,_0x4e4e98){var _0x36f9ed={'raw':![],'where':{'id':_0x360739[_0xc805('0xb7')]['id']}},_0x36b533={};_0x36b533[_0xc805('0x3f')]=_[_0xc805('0x41')](db[_0xc805('0x3a')]['rawAttributes']);_0x36b533[_0xc805('0x40')]=_[_0xc805('0x41')](_0x360739[_0xc805('0x40')]);_0x36b533[_0xc805('0x4a')]=_['intersection'](_0x36b533[_0xc805('0x3f')],_0x36b533['query']);_0x36f9ed[_0xc805('0x42')]=_[_0xc805('0x43')](_0x36b533[_0xc805('0x3f')],qs['fields'](_0x360739[_0xc805('0x40')][_0xc805('0x44')]));_0x36f9ed[_0xc805('0x42')]=_0x36f9ed[_0xc805('0x42')]['length']?_0x36f9ed[_0xc805('0x42')]:_0x36b533[_0xc805('0x3f')];if(_0x360739['query'][_0xc805('0xb8')]){_0x36f9ed[_0xc805('0xb9')]=[{'all':!![]}];}_0x36f9ed=_[_0xc805('0xa2')]({},_0x36f9ed,_0x360739[_0xc805('0xba')]);return db[_0xc805('0x3a')][_0xc805('0x63')](_0x36f9ed)[_0xc805('0x25')](handleEntityNotFound(_0x4e4e98,null))['then'](respondWithResult(_0x4e4e98,null))['catch'](handleError(_0x4e4e98,null));};exports[_0xc805('0xbb')]=function(_0x1c5bb3,_0x13610a){return db[_0xc805('0x3a')][_0xc805('0xbb')](_0x1c5bb3[_0xc805('0x79')],{})[_0xc805('0x25')](respondWithResult(_0x13610a,0xc9))['catch'](handleError(_0x13610a,null));};exports[_0xc805('0xbc')]=function(_0x3a2b88,_0x3731de){if(_0x3a2b88[_0xc805('0x79')]['id']){delete _0x3a2b88[_0xc805('0x79')]['id'];}return db[_0xc805('0x3a')][_0xc805('0x63')]({'where':{'id':_0x3a2b88[_0xc805('0xb7')]['id']}})[_0xc805('0x25')](handleEntityNotFound(_0x3731de,null))[_0xc805('0x25')](saveUpdates(_0x3a2b88['body'],null))[_0xc805('0x25')](respondWithResult(_0x3731de,null))[_0xc805('0x32')](handleError(_0x3731de,null));};exports[_0xc805('0x26')]=function(_0x192e77,_0x822e08){return db[_0xc805('0x3a')][_0xc805('0x63')]({'where':{'id':_0x192e77[_0xc805('0xb7')]['id']}})[_0xc805('0x25')](handleEntityNotFound(_0x822e08,null))[_0xc805('0x25')](removeEntity(_0x822e08,null))[_0xc805('0x32')](handleError(_0x822e08,null));};exports['describe']=function(_0x4a5453,_0x421768){return db['SmsInteraction']['describe']()[_0xc805('0x25')](respondWithResult(_0x421768,null))[_0xc805('0x32')](handleError(_0x421768,null));};exports[_0xc805('0xbd')]=function(_0x1a0deb,_0x35fdc4,_0x1a8226){return db[_0xc805('0xbe')][_0xc805('0x63')]({'where':{'id':_0x1a0deb[_0xc805('0xb7')]['id']}})[_0xc805('0x25')](handleEntityNotFound(_0x35fdc4,null))[_0xc805('0x25')](function(_0x3d7ef5){if(_0x3d7ef5){return _0x3d7ef5['addMessage'](_0x1a0deb[_0xc805('0x79')]['ids'],_[_0xc805('0xbf')](_0x1a0deb['body'],[_0xc805('0xc0'),'id'])||{});}})[_0xc805('0x25')](respondWithResult(_0x35fdc4,null))[_0xc805('0x32')](handleError(_0x35fdc4,null));};exports[_0xc805('0xc1')]=function(_0x415cf0,_0x37b285,_0x1cbc1c){var _0x24c995={'raw':![],'where':{}};var _0x3ab597={};var _0x23ea0a={'count':0x0,'rows':[]};return db[_0xc805('0x3a')][_0xc805('0xc2')]({'where':{'id':_0x415cf0['params']['id']}})['then'](handleEntityNotFound(_0x37b285,null))['then'](function(_0x5260f9){if(_0x5260f9){_0x3ab597['model']=_[_0xc805('0x41')](db['SmsMessage'][_0xc805('0x3b')]);_0x3ab597[_0xc805('0x40')]=_[_0xc805('0x41')](_0x415cf0['query']);_0x3ab597[_0xc805('0x4a')]=_[_0xc805('0x43')](_0x3ab597[_0xc805('0x3f')],_0x3ab597['query']);_0x24c995[_0xc805('0x42')]=_[_0xc805('0x43')](_0x3ab597[_0xc805('0x3f')],qs['fields'](_0x415cf0[_0xc805('0x40')][_0xc805('0x44')]));_0x24c995['attributes']=_0x24c995[_0xc805('0x42')][_0xc805('0x45')]?_0x24c995['attributes']:_0x3ab597[_0xc805('0x3f')];if(!_0x415cf0[_0xc805('0x40')][_0xc805('0x46')]('nolimit')){_0x24c995[_0xc805('0x1d')]=qs[_0xc805('0x1d')](_0x415cf0[_0xc805('0x40')][_0xc805('0x1d')]);_0x24c995[_0xc805('0x1c')]=qs['offset'](_0x415cf0[_0xc805('0x40')][_0xc805('0x1c')]);}_0x24c995[_0xc805('0x48')]=qs[_0xc805('0x49')](_0x415cf0[_0xc805('0x40')][_0xc805('0x49')]);_0x24c995['where']=qs[_0xc805('0x4a')](_[_0xc805('0x4b')](_0x415cf0[_0xc805('0x40')],_0x3ab597[_0xc805('0x4a')]));_0x24c995['where']['SmsInteractionId']=_0x5260f9['id'];if(_0x415cf0['query']['filter']){_0x24c995[_0xc805('0x7d')]=_[_0xc805('0xa2')](_0x24c995[_0xc805('0x7d')],{'$or':_['map'](_0x24c995[_0xc805('0x42')],function(_0x4ccc8c){var _0x5d16e9={};_0x5d16e9[_0x4ccc8c]={'$like':'%'+_0x415cf0[_0xc805('0x40')]['filter']+'%'};return _0x5d16e9;})});}if(_0x415cf0[_0xc805('0x40')][_0xc805('0xc3')]){var _0x1b3c8f=_0x415cf0[_0xc805('0x40')][_0xc805('0xc3')][_0xc805('0x6b')](',');var _0x1bc5a2={};_0x1bc5a2[_0x1b3c8f[0x0]]={'$gte':moment(_0x1b3c8f[0x1])[_0xc805('0xc4')](_0xc805('0xc5'))};_0x24c995[_0xc805('0x7d')]=_[_0xc805('0xa2')](_0x24c995[_0xc805('0x7d')],_0x1bc5a2);}_0x24c995=_['merge']({},_0x24c995,_0x415cf0[_0xc805('0xba')]);return db['SmsMessage'][_0xc805('0x1f')]({'where':_0x24c995['where']})[_0xc805('0x25')](function(_0x471902){_0x23ea0a[_0xc805('0x1f')]=_0x471902;if(_0x415cf0[_0xc805('0x40')]['includeAll']){_0x24c995[_0xc805('0xb9')]=[{'all':!![]}];}return db[_0xc805('0xbe')][_0xc805('0xc6')](_0x24c995);})[_0xc805('0x25')](function(_0x45f245){_0x23ea0a[_0xc805('0xc7')]=_0x45f245;return _0x23ea0a;});}})[_0xc805('0x25')](respondWithFilteredResult(_0x37b285,_0x24c995))[_0xc805('0x32')](handleError(_0x37b285,null));};exports[_0xc805('0xc8')]=function(_0x3d3c58,_0xae7373,_0x18a29c){return db[_0xc805('0x3a')][_0xc805('0x63')]({'where':{'id':_0x3d3c58[_0xc805('0xb7')]['id']}})[_0xc805('0x25')](handleEntityNotFound(_0xae7373,null))[_0xc805('0x25')](function(_0x4bbc65){if(_0x4bbc65){return _0x4bbc65['setTags'](_0x3d3c58[_0xc805('0x79')][_0xc805('0xc0')],_[_0xc805('0xbf')](_0x3d3c58[_0xc805('0x79')],[_0xc805('0xc0'),'id'])||{})[_0xc805('0xc9')](function(){return db[_0xc805('0x74')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x3d3c58[_0xc805('0x79')][_0xc805('0xc0')]}});})[_0xc805('0x25')](function(_0x46b4c9){socket[_0xc805('0xca')](_0xc805('0xcb'),{'id':Number(_0x3d3c58[_0xc805('0xb7')]['id']),'tags':_0x46b4c9||[]});return{'id':Number(_0x3d3c58[_0xc805('0xb7')]['id']),'tags':_0x46b4c9||[]};});}})[_0xc805('0x25')](respondWithResult(_0xae7373,null))[_0xc805('0x32')](handleError(_0xae7373,null));};exports[_0xc805('0xcc')]=function(_0x4d038b,_0x410d69,_0x1ff44d){return db[_0xc805('0x3a')]['find']({'where':{'id':_0x4d038b['params']['id']}})['then'](handleEntityNotFound(_0x410d69,null))[_0xc805('0x25')](function(_0xaa805f){if(_0xaa805f){return _0xaa805f['removeTags'](_0x4d038b[_0xc805('0x40')]['ids']);}})[_0xc805('0x25')](respondWithStatusCode(_0x410d69,null))[_0xc805('0x32')](handleError(_0x410d69,null));};exports[_0xc805('0xcd')]=function(_0x349386,_0x371b99){var _0x229afa=moment()[_0xc805('0xce')]()[_0xc805('0xa1')]();var _0x522e04=path[_0xc805('0xcf')](config[_0xc805('0xd0')],'server',_0xc805('0xd1'),_0xc805('0xd2'));var _0x425a27=path[_0xc805('0xcf')](config[_0xc805('0xd0')],_0xc805('0xd3'),_0xc805('0xd1'),_0xc805('0xd4'));var _0x527302=path[_0xc805('0xcf')](_0x522e04,_0x229afa);var _0x5559c4=util['format']('transcript-%d-%s.zip',_0x349386[_0xc805('0xb7')]['id'],_0x229afa);var _0x4695c0=path[_0xc805('0xcf')](_0x522e04,_0x5559c4);var _0x5474f1=[];_0x5474f1[_0xc805('0x31')]({'model':db[_0xc805('0x77')],'as':_0xc805('0x77'),'attributes':['id','fullname'],'raw':!![]});_0x5474f1[_0xc805('0x31')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xc805('0xd5'),_0xc805('0xd6')],'raw':!![]});var _0x1a6a8e=[{'model':db[_0xc805('0xbe')],'as':_0xc805('0xd7'),'attributes':['id','body',_0xc805('0x7f'),_0xc805('0xd8'),_0xc805('0xd9'),_0xc805('0x85')],'include':_0x5474f1}];_0x1a6a8e[_0xc805('0x31')]({'model':db[_0xc805('0xda')],'as':_0xc805('0xdb'),'attributes':['id','name']});_0x1a6a8e['push']({'model':db[_0xc805('0x77')],'as':_0xc805('0xdc'),'attributes':['id',_0xc805('0x2e')]});return db[_0xc805('0x3a')]['find']({'where':{'id':_0x349386['params']['id']},'include':_0x1a6a8e})[_0xc805('0x25')](handleEntityNotFound(_0x371b99,null))['then'](function(_0xee98c0){if(_0xee98c0){var _0x33f70c=_0xee98c0[_0xc805('0xdd')]({'plain':!![]});fs['mkdirSync'](_0x527302);var _0x3788ac={'channel':_0xc805('0xde'),'account':_0x33f70c[_0xc805('0xdb')][_0xc805('0x2a')],'agent':_0x33f70c[_0xc805('0xdc')]?_0x33f70c[_0xc805('0xdc')][_0xc805('0x2e')]:_0xc805('0xdf'),'createdAt':moment(_0x33f70c[_0xc805('0x7f')])[_0xc805('0xc4')](_0xc805('0xc5'))['toString'](),'closedAt':_0x33f70c['closed']?moment(_0x33f70c[_0xc805('0xe0')])[_0xc805('0xc4')](_0xc805('0xc5'))[_0xc805('0xa1')]():'','disposition':_0x33f70c['disposition'],'messages':_(_0x33f70c[_0xc805('0xd7')])['filter']({'secret':![]})[_0xc805('0x2d')](function(_0x216f9b){return{'date':moment(_0x216f9b[_0xc805('0x7f')])[_0xc805('0xc4')](_0xc805('0xc5'))[_0xc805('0xa1')](),'sender':_0x216f9b[_0xc805('0xd8')]===_0xc805('0xe1')?_0x216f9b[_0xc805('0x77')]?_0x216f9b[_0xc805('0x77')][_0xc805('0x2e')]:'System':_0x216f9b[_0xc805('0x68')][_0xc805('0xd5')]+(_0x216f9b['Contact'][_0xc805('0xd6')]?'\x20'+_0x216f9b[_0xc805('0x68')]['lastName']:''),'body':_0x216f9b[_0xc805('0x79')],'direction':_0x216f9b[_0xc805('0xd8')]==='out'?'A':'C','secret':_0x216f9b[_0xc805('0xd9')],'read':_0x216f9b['read']};})['value']()};return ejs[_0xc805('0xe2')](path[_0xc805('0xcf')](config[_0xc805('0xd0')],_0xc805('0xd3'),_0xc805('0xe3'),_0xc805('0xe4')),{'interaction':_0x3788ac})['then'](function(_0x17ed37){var _0x363f03=path['join'](_0x527302,_0xc805('0xe5')+_0x33f70c['id']+'-'+_0x229afa+'.pdf');var _0x2eb444={'path':_0x363f03,'channel':_0xc805('0xde'),'interactionId':_0x33f70c['id']};return pdf[_0xc805('0xe6')](_0x17ed37,_0x2eb444);})[_0xc805('0x25')](function(){return new BPromise(function(_0xce564a,_0x21bffe){zipdir(_0x527302,{'saveTo':_0x4695c0},function(_0x1a46ed,_0x51f4a7){if(_0x1a46ed)return _0x21bffe(_0x1a46ed);return _0xce564a(_0x51f4a7);});})[_0xc805('0x25')](function(){return new BPromise(function(_0x23df41,_0xd15fa){rimraf(_0x527302,function(_0x2770c6){if(_0x2770c6)_0xd15fa(_0x2770c6);return _0x23df41();});});})[_0xc805('0x25')](function(){return _0x371b99[_0xc805('0xcd')](_0x4695c0,_0x5559c4,function(_0x403c3b){if(_0x403c3b){console[_0xc805('0xe7')](_0xc805('0xe8'),_0x403c3b);}else{fs[_0xc805('0xe9')](_0x4695c0);}});});});}else{return _0x371b99['sendStatus'](0xc8);}})[_0xc805('0x32')](handleError(_0x371b99,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index c0eb381..b816a36 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 _0x1c7c=['../../mysqldb','SmsInteraction','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','events'];(function(_0x194135,_0x14f9bc){var _0x2c050f=function(_0x545e2e){while(--_0x545e2e){_0x194135['push'](_0x194135['shift']());}};_0x2c050f(++_0x14f9bc);}(_0x1c7c,0x164));var _0xc1c7=function(_0x1aeab8,_0x58dac7){_0x1aeab8=_0x1aeab8-0x0;var _0x1ce4db=_0x1c7c[_0x1aeab8];return _0x1ce4db;};'use strict';var EventEmitter=require(_0xc1c7('0x0'));var SmsInteraction=require(_0xc1c7('0x1'))['db'][_0xc1c7('0x2')];var SmsMessage=require(_0xc1c7('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc1c7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc1c7('0x4'),'afterDestroy':_0xc1c7('0x5')};function emitEvent(_0xbb9da0){return function(_0x2a0383,_0x42e930,_0x364dde){_0x2a0383[_0xc1c7('0x6')]({'attributes':['id'],'raw':!![]})[_0xc1c7('0x7')](function(_0xce5bcd){_0x2a0383[_0xc1c7('0x8')](_0xc1c7('0x9'),_0xce5bcd[_0xc1c7('0xa')](function(_0x92e892){return{'id':_0x92e892['id']};}));return SmsMessage[_0xc1c7('0xb')]({'where':{'SmsInteractionId':_0x2a0383['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc1c7('0x7')](function(_0x301abf){_0x2a0383[_0xc1c7('0x8')]('unreadMessages',_0x301abf[_0xc1c7('0xc')]);SmsInteractionEvents[_0xc1c7('0xd')](_0xbb9da0+':'+_0x2a0383['id'],_0x2a0383);SmsInteractionEvents['emit'](_0xbb9da0,_0x2a0383);_0x364dde(null);})[_0xc1c7('0xe')](_0x364dde(null));};}for(var e in events){if(events[_0xc1c7('0xf')](e)){var event=events[e];SmsInteraction[_0xc1c7('0x10')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x7708=['hook','exports','events','../../mysqldb','remove','getUsers','then','setDataValue','Users','map','length','emit','catch'];(function(_0x3be5bd,_0x2f4503){var _0x44dc15=function(_0x115d85){while(--_0x115d85){_0x3be5bd['push'](_0x3be5bd['shift']());}};_0x44dc15(++_0x2f4503);}(_0x7708,0x188));var _0x8770=function(_0x3522c8,_0x1e7c82){_0x3522c8=_0x3522c8-0x0;var _0x22f498=_0x7708[_0x3522c8];return _0x22f498;};'use strict';var EventEmitter=require(_0x8770('0x0'));var SmsInteraction=require(_0x8770('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x8770('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8770('0x2')};function emitEvent(_0x1a796d){return function(_0x577b13,_0x40d401,_0x50bab7){_0x577b13[_0x8770('0x3')]({'attributes':['id'],'raw':!![]})[_0x8770('0x4')](function(_0x2b0295){_0x577b13[_0x8770('0x5')](_0x8770('0x6'),_0x2b0295[_0x8770('0x7')](function(_0x2d4a1d){return{'id':_0x2d4a1d['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x577b13['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8770('0x4')](function(_0x2ca830){_0x577b13[_0x8770('0x5')]('unreadMessages',_0x2ca830[_0x8770('0x8')]);SmsInteractionEvents[_0x8770('0x9')](_0x1a796d+':'+_0x577b13['id'],_0x577b13);SmsInteractionEvents[_0x8770('0x9')](_0x1a796d,_0x577b13);_0x50bab7(null);})[_0x8770('0xa')](_0x50bab7(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x8770('0xb')](e,emitEvent(event));}}module[_0x8770('0xc')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 35f88f0..bd40a62 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 _0x99be=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed'];(function(_0x580862,_0x3464e3){var _0x9d2725=function(_0x33d1c4){while(--_0x33d1c4){_0x580862['push'](_0x580862['shift']());}};_0x9d2725(++_0x3464e3);}(_0x99be,0x148));var _0xe99b=function(_0x57be1c,_0x115fde){_0x57be1c=_0x57be1c-0x0;var _0x42ccea=_0x99be[_0x57be1c];return _0x42ccea;};'use strict';var _=require(_0xe99b('0x0'));var util=require(_0xe99b('0x1'));var logger=require(_0xe99b('0x2'))('api');var moment=require(_0xe99b('0x3'));var BPromise=require('bluebird');var rp=require(_0xe99b('0x4'));var fs=require('fs');var path=require(_0xe99b('0x5'));var rimraf=require(_0xe99b('0x6'));var config=require(_0xe99b('0x7'));var attributes=require(_0xe99b('0x8'));module[_0xe99b('0x9')]=function(_0xdcc839,_0x33145a){return _0xdcc839[_0xe99b('0xa')](_0xe99b('0xb'),attributes,{'tableName':_0xe99b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd57376,_0x1073b4,_0x55b4e7){if(_0xd57376[_0xe99b('0xd')](_0xe99b('0xe'))){_0xd57376[_0xe99b('0xf')]=moment()[_0xe99b('0x10')](_0xe99b('0x11'));}_0x55b4e7(null,_0xd57376);}}});}; \ No newline at end of file +var _0xef01=['sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction'];(function(_0x5c25f7,_0x3a69dc){var _0x1d51d1=function(_0x284c00){while(--_0x284c00){_0x5c25f7['push'](_0x5c25f7['shift']());}};_0x1d51d1(++_0x3a69dc);}(_0xef01,0x126));var _0x1ef0=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xef01[_0x5f309e];return _0x487b5e;};'use strict';var _=require('lodash');var util=require(_0x1ef0('0x0'));var logger=require(_0x1ef0('0x1'))('api');var moment=require(_0x1ef0('0x2'));var BPromise=require(_0x1ef0('0x3'));var rp=require(_0x1ef0('0x4'));var fs=require('fs');var path=require(_0x1ef0('0x5'));var rimraf=require(_0x1ef0('0x6'));var config=require(_0x1ef0('0x7'));var attributes=require(_0x1ef0('0x8'));module[_0x1ef0('0x9')]=function(_0x55f640,_0x26b7f3){return _0x55f640[_0x1ef0('0xa')](_0x1ef0('0xb'),attributes,{'tableName':_0x1ef0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xe6f54c,_0x579afe,_0x11b5f1){if(_0xe6f54c[_0x1ef0('0xd')](_0x1ef0('0xe'))){_0xe6f54c[_0x1ef0('0xf')]=moment()[_0x1ef0('0x10')](_0x1ef0('0x11'));}_0x11b5f1(null,_0xe6f54c);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 6dae5c7..2457957 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 _0x6c69=['redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateSmsInteraction','update','options','raw','where','attributes','SmsInteraction','find','addTags','body','ids','omit','AddTags','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x2b2653,_0x19f0ae){var _0x55820e=function(_0x269925){while(--_0x269925){_0x2b2653['push'](_0x2b2653['shift']());}};_0x55820e(++_0x19f0ae);}(_0x6c69,0xf1));var _0x96c6=function(_0x150fd1,_0x5b314b){_0x150fd1=_0x150fd1-0x0;var _0x52538a=_0x6c69[_0x150fd1];return _0x52538a;};'use strict';var _=require(_0x96c6('0x0'));var util=require(_0x96c6('0x1'));var moment=require(_0x96c6('0x2'));var BPromise=require('bluebird');var rs=require(_0x96c6('0x3'));var fs=require('fs');var Redis=require(_0x96c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x96c6('0x5'));var logger=require(_0x96c6('0x6'))(_0x96c6('0x7'));var config=require(_0x96c6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x96c6('0x9')][_0x96c6('0xa')]({'port':0x232a});config[_0x96c6('0xb')]=_[_0x96c6('0xc')](config[_0x96c6('0xb')],{'host':_0x96c6('0xd'),'port':0x18eb});var socket=require(_0x96c6('0xe'))(new Redis(config[_0x96c6('0xb')]));require(_0x96c6('0xf'))[_0x96c6('0x10')](socket);function respondWithRpcPromise(_0xb51398,_0x365709,_0x4a9e54){return new BPromise(function(_0x4281ff,_0x5d057b){return client[_0x96c6('0x11')](_0xb51398,_0x4a9e54)[_0x96c6('0x12')](function(_0x575f9a){logger[_0x96c6('0x13')](_0x96c6('0x14'),_0x365709,_0x96c6('0x15'));logger[_0x96c6('0x16')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x365709,'request\x20sent',JSON[_0x96c6('0x17')](_0x575f9a));if(_0x575f9a[_0x96c6('0x18')]){if(_0x575f9a[_0x96c6('0x18')][_0x96c6('0x19')]===0x1f4){logger[_0x96c6('0x18')](_0x96c6('0x14'),_0x365709,_0x575f9a[_0x96c6('0x18')][_0x96c6('0x1a')]);return _0x5d057b(_0x575f9a[_0x96c6('0x18')][_0x96c6('0x1a')]);}logger['error'](_0x96c6('0x14'),_0x365709,_0x575f9a[_0x96c6('0x18')][_0x96c6('0x1a')]);return _0x4281ff(_0x575f9a[_0x96c6('0x18')][_0x96c6('0x1a')]);}else{logger[_0x96c6('0x13')](_0x96c6('0x14'),_0x365709,_0x96c6('0x15'));_0x4281ff(_0x575f9a[_0x96c6('0x1b')][_0x96c6('0x1a')]);}})[_0x96c6('0x1c')](function(_0x3c9449){logger[_0x96c6('0x18')]('SmsInteraction,\x20%s,\x20%s',_0x365709,_0x3c9449);_0x5d057b(_0x3c9449);});});}exports[_0x96c6('0x1d')]=function(_0x547ff7){var _0x48efc7=this;return new Promise(function(_0x1d8cdc,_0x1899b5){return db['SmsInteraction'][_0x96c6('0x1e')](_0x547ff7['body'],{'raw':_0x547ff7[_0x96c6('0x1f')]?_0x547ff7[_0x96c6('0x1f')][_0x96c6('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x547ff7[_0x96c6('0x1f')]?_0x547ff7[_0x96c6('0x1f')][_0x96c6('0x21')]||null:null,'attributes':_0x547ff7[_0x96c6('0x1f')]?_0x547ff7['options'][_0x96c6('0x22')]||null:null,'limit':_0x547ff7[_0x96c6('0x1f')]?_0x547ff7[_0x96c6('0x1f')]['limit']||null:null})[_0x96c6('0x12')](function(_0x15fa13){logger['info']('UpdateSmsInteraction',_0x547ff7);logger[_0x96c6('0x16')](_0x96c6('0x1d'),_0x547ff7,JSON[_0x96c6('0x17')](_0x15fa13));_0x1d8cdc(_0x15fa13);})['catch'](function(_0x2623fe){logger[_0x96c6('0x18')](_0x96c6('0x1d'),_0x2623fe[_0x96c6('0x1a')],_0x547ff7);_0x1899b5(_0x48efc7['error'](0x1f4,_0x2623fe['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x3aa7bf){return new Promise(function(_0x5d974c,_0x4ea4fe){return db[_0x96c6('0x23')][_0x96c6('0x24')]({'where':_0x3aa7bf[_0x96c6('0x1f')]?_0x3aa7bf[_0x96c6('0x1f')][_0x96c6('0x21')]||null:null})[_0x96c6('0x12')](function(_0x544979){if(_0x544979){return _0x544979[_0x96c6('0x25')](_0x3aa7bf[_0x96c6('0x26')][_0x96c6('0x27')],_[_0x96c6('0x28')](_0x3aa7bf[_0x96c6('0x26')],[_0x96c6('0x27'),'id'])||{});}})['spread'](function(_0x5be64b){logger[_0x96c6('0x13')](_0x96c6('0x29'),_0x3aa7bf);logger[_0x96c6('0x16')](_0x96c6('0x29'),_0x3aa7bf,JSON['stringify'](_0x5be64b));_0x5d974c(_0x5be64b);})[_0x96c6('0x1c')](function(_0x4e1a01){logger[_0x96c6('0x18')]('AddTags',_0x4e1a01[_0x96c6('0x1a')],_0x3aa7bf);_0x4ea4fe(_this[_0x96c6('0x18')](0x1f4,_0x4e1a01['message']));});});}; \ No newline at end of file +var _0xe667=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','socket.io-emitter','redis','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SmsInteraction','update','body','options','raw','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','where','omit','ids','info','AddTags','util','moment'];(function(_0x3881e9,_0x37c4ed){var _0x5b6e64=function(_0x4477ce){while(--_0x4477ce){_0x3881e9['push'](_0x3881e9['shift']());}};_0x5b6e64(++_0x37c4ed);}(_0xe667,0x124));var _0x7e66=function(_0x3126ab,_0x4db9e9){_0x3126ab=_0x3126ab-0x0;var _0x20b831=_0xe667[_0x3126ab];return _0x20b831;};'use strict';var _=require('lodash');var util=require(_0x7e66('0x0'));var moment=require(_0x7e66('0x1'));var BPromise=require(_0x7e66('0x2'));var rs=require(_0x7e66('0x3'));var fs=require('fs');var Redis=require(_0x7e66('0x4'));var db=require(_0x7e66('0x5'))['db'];var utils=require(_0x7e66('0x6'));var logger=require(_0x7e66('0x7'))(_0x7e66('0x8'));var config=require('../../config/environment');var jayson=require(_0x7e66('0x9'));var client=jayson[_0x7e66('0xa')][_0x7e66('0xb')]({'port':0x232a});config['redis']=_[_0x7e66('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7e66('0xd'))(new Redis(config[_0x7e66('0xe')]));require(_0x7e66('0xf'))[_0x7e66('0x10')](socket);function respondWithRpcPromise(_0x2c1393,_0xa4da1,_0x153bba){return new BPromise(function(_0x27658d,_0x52321f){return client[_0x7e66('0x11')](_0x2c1393,_0x153bba)[_0x7e66('0x12')](function(_0x4696a7){logger['info'](_0x7e66('0x13'),_0xa4da1,_0x7e66('0x14'));logger[_0x7e66('0x15')](_0x7e66('0x16'),_0xa4da1,_0x7e66('0x14'),JSON[_0x7e66('0x17')](_0x4696a7));if(_0x4696a7[_0x7e66('0x18')]){if(_0x4696a7['error'][_0x7e66('0x19')]===0x1f4){logger[_0x7e66('0x18')](_0x7e66('0x13'),_0xa4da1,_0x4696a7[_0x7e66('0x18')][_0x7e66('0x1a')]);return _0x52321f(_0x4696a7[_0x7e66('0x18')][_0x7e66('0x1a')]);}logger['error'](_0x7e66('0x13'),_0xa4da1,_0x4696a7['error'][_0x7e66('0x1a')]);return _0x27658d(_0x4696a7[_0x7e66('0x18')][_0x7e66('0x1a')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0xa4da1,_0x7e66('0x14'));_0x27658d(_0x4696a7['result'][_0x7e66('0x1a')]);}})[_0x7e66('0x1b')](function(_0x140819){logger[_0x7e66('0x18')](_0x7e66('0x13'),_0xa4da1,_0x140819);_0x52321f(_0x140819);});});}exports['UpdateSmsInteraction']=function(_0x5944bf){var _0x33c222=this;return new Promise(function(_0x494086,_0x1c92ab){return db[_0x7e66('0x1c')][_0x7e66('0x1d')](_0x5944bf[_0x7e66('0x1e')],{'raw':_0x5944bf['options']?_0x5944bf[_0x7e66('0x1f')][_0x7e66('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5944bf['options']?_0x5944bf[_0x7e66('0x1f')]['where']||null:null,'attributes':_0x5944bf[_0x7e66('0x1f')]?_0x5944bf[_0x7e66('0x1f')][_0x7e66('0x21')]||null:null,'limit':_0x5944bf[_0x7e66('0x1f')]?_0x5944bf[_0x7e66('0x1f')][_0x7e66('0x22')]||null:null})[_0x7e66('0x12')](function(_0x2e64d8){logger['info'](_0x7e66('0x23'),_0x5944bf);logger[_0x7e66('0x15')](_0x7e66('0x23'),_0x5944bf,JSON[_0x7e66('0x17')](_0x2e64d8));_0x494086(_0x2e64d8);})[_0x7e66('0x1b')](function(_0x1fbc12){logger['error'](_0x7e66('0x23'),_0x1fbc12['message'],_0x5944bf);_0x1c92ab(_0x33c222[_0x7e66('0x18')](0x1f4,_0x1fbc12['message']));});});};exports[_0x7e66('0x24')]=function(_0xdae1d9){return new Promise(function(_0x1cf1b3,_0x57288a){return db['SmsInteraction']['find']({'where':_0xdae1d9['options']?_0xdae1d9['options'][_0x7e66('0x25')]||null:null})[_0x7e66('0x12')](function(_0x1017d6){if(_0x1017d6){return _0x1017d6['addTags'](_0xdae1d9[_0x7e66('0x1e')]['ids'],_[_0x7e66('0x26')](_0xdae1d9[_0x7e66('0x1e')],[_0x7e66('0x27'),'id'])||{});}})['spread'](function(_0x1bfcee){logger[_0x7e66('0x28')](_0x7e66('0x29'),_0xdae1d9);logger[_0x7e66('0x15')](_0x7e66('0x29'),_0xdae1d9,JSON[_0x7e66('0x17')](_0x1bfcee));_0x1cf1b3(_0x1bfcee);})[_0x7e66('0x1b')](function(_0x87d3b1){logger[_0x7e66('0x18')](_0x7e66('0x29'),_0x87d3b1[_0x7e66('0x1a')],_0xdae1d9);_0x57288a(_this[_0x7e66('0x18')](0x1f4,_0x87d3b1['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index e6a8b67..26ce0e5 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 _0xfef0=['remove','update','emit','removeListener','register','smsInteraction:','./smsInteraction.events','save'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfef0,0xde));var _0x0fef=function(_0x2ea637,_0x390a23){_0x2ea637=_0x2ea637-0x0;var _0x1bc048=_0xfef0[_0x2ea637];return _0x1bc048;};'use strict';var SmsInteractionEvents=require(_0x0fef('0x0'));var events=[_0x0fef('0x1'),_0x0fef('0x2'),_0x0fef('0x3')];function createListener(_0x36a4e9,_0x4ed801){return function(_0x1a6cf7){_0x4ed801[_0x0fef('0x4')](_0x36a4e9,_0x1a6cf7);};}function removeListener(_0x1e9474,_0x366d29){return function(){SmsInteractionEvents[_0x0fef('0x5')](_0x1e9474,_0x366d29);};}exports[_0x0fef('0x6')]=function(_0x2a406d){for(var _0x550de5=0x0,_0x3ba1e0=events['length'];_0x550de5<_0x3ba1e0;_0x550de5++){var _0x59921f=events[_0x550de5];var _0x2df0fb=createListener(_0x0fef('0x7')+_0x59921f,_0x2a406d);SmsInteractionEvents['on'](_0x59921f,_0x2df0fb);}}; \ No newline at end of file +var _0x8827=['register','length','smsInteraction:','./smsInteraction.events','save','remove','update','emit'];(function(_0x6c9ac2,_0x35886a){var _0x4d9f44=function(_0xd6faa){while(--_0xd6faa){_0x6c9ac2['push'](_0x6c9ac2['shift']());}};_0x4d9f44(++_0x35886a);}(_0x8827,0xeb));var _0x7882=function(_0x14f420,_0x1e2282){_0x14f420=_0x14f420-0x0;var _0x8b32f7=_0x8827[_0x14f420];return _0x8b32f7;};'use strict';var SmsInteractionEvents=require(_0x7882('0x0'));var events=[_0x7882('0x1'),_0x7882('0x2'),_0x7882('0x3')];function createListener(_0x40705a,_0x3865b1){return function(_0x373982){_0x3865b1[_0x7882('0x4')](_0x40705a,_0x373982);};}function removeListener(_0x4c5077,_0x49bcf5){return function(){SmsInteractionEvents['removeListener'](_0x4c5077,_0x49bcf5);};}exports[_0x7882('0x5')]=function(_0x6ba7ef){for(var _0x13bbc6=0x0,_0x1b588c=events[_0x7882('0x6')];_0x13bbc6<_0x1b588c;_0x13bbc6++){var _0x555fc7=events[_0x13bbc6];var _0x295e7a=createListener(_0x7882('0x7')+_0x555fc7,_0x6ba7ef);SmsInteractionEvents['on'](_0x555fc7,_0x295e7a);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index a17a185..d8cea09 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 _0xcdb9=['isAuthenticated','get','describe','/:id','post','tracked','sms','smsmessage:create','/:id/status','status','put','update','/:id/reject','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x29e63d,_0x4e46ce){var _0x2298b8=function(_0x2fd8a5){while(--_0x2fd8a5){_0x29e63d['push'](_0x29e63d['shift']());}};_0x2298b8(++_0x4e46ce);}(_0xcdb9,0x82));var _0x9cdb=function(_0x323d62,_0x28416f){_0x323d62=_0x323d62-0x0;var _0x33738c=_0xcdb9[_0x323d62];return _0x33738c;};'use strict';var multer=require('multer');var util=require(_0x9cdb('0x0'));var path=require(_0x9cdb('0x1'));var timeout=require(_0x9cdb('0x2'));var express=require('express');var router=express[_0x9cdb('0x3')]();var fs_extra=require(_0x9cdb('0x4'));var auth=require(_0x9cdb('0x5'));var interaction=require(_0x9cdb('0x6'));var config=require(_0x9cdb('0x7'));var controller=require('./smsMessage.controller');router['get']('/',auth[_0x9cdb('0x8')](),controller['index']);router[_0x9cdb('0x9')]('/describe',auth[_0x9cdb('0x8')](),controller[_0x9cdb('0xa')]);router[_0x9cdb('0x9')](_0x9cdb('0xb'),auth[_0x9cdb('0x8')](),controller['show']);router[_0x9cdb('0xc')]('/',auth['isAuthenticated'](),interaction[_0x9cdb('0xd')](_0x9cdb('0xe'),_0x9cdb('0xf')),controller['create']);router['post'](_0x9cdb('0x10'),controller[_0x9cdb('0x11')]);router[_0x9cdb('0x12')](_0x9cdb('0xb'),auth[_0x9cdb('0x8')](),controller[_0x9cdb('0x13')]);router[_0x9cdb('0x12')]('/:id/accept',auth[_0x9cdb('0x8')](),controller['accept']);router[_0x9cdb('0x12')](_0x9cdb('0x14'),auth[_0x9cdb('0x8')](),controller['reject']);router[_0x9cdb('0x15')](_0x9cdb('0xb'),auth[_0x9cdb('0x8')](),controller[_0x9cdb('0x16')]);module['exports']=router; \ No newline at end of file +var _0xb32f=['/:id/status','status','put','update','/:id/accept','reject','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show','sms','smsmessage:create','create'];(function(_0x5c768b,_0x5e88a6){var _0x335af8=function(_0x39b04f){while(--_0x39b04f){_0x5c768b['push'](_0x5c768b['shift']());}};_0x335af8(++_0x5e88a6);}(_0xb32f,0x1c2));var _0xfb32=function(_0x3b4515,_0x354ed1){_0x3b4515=_0x3b4515-0x0;var _0x1b1d2f=_0xb32f[_0x3b4515];return _0x1b1d2f;};'use strict';var multer=require(_0xfb32('0x0'));var util=require('util');var path=require(_0xfb32('0x1'));var timeout=require(_0xfb32('0x2'));var express=require(_0xfb32('0x3'));var router=express[_0xfb32('0x4')]();var fs_extra=require(_0xfb32('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfb32('0x6'));var config=require(_0xfb32('0x7'));var controller=require('./smsMessage.controller');router['get']('/',auth[_0xfb32('0x8')](),controller[_0xfb32('0x9')]);router['get'](_0xfb32('0xa'),auth[_0xfb32('0x8')](),controller[_0xfb32('0xb')]);router[_0xfb32('0xc')](_0xfb32('0xd'),auth[_0xfb32('0x8')](),controller[_0xfb32('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0xfb32('0xf'),_0xfb32('0x10')),controller[_0xfb32('0x11')]);router['post'](_0xfb32('0x12'),controller[_0xfb32('0x13')]);router[_0xfb32('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xfb32('0x15')]);router[_0xfb32('0x14')](_0xfb32('0x16'),auth[_0xfb32('0x8')](),controller['accept']);router[_0xfb32('0x14')]('/:id/reject',auth['isAuthenticated'](),controller[_0xfb32('0x17')]);router[_0xfb32('0x18')](_0xfb32('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xfb32('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 18a4303..a1954c1 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 _0x2af3=['TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0xe5bf5f,_0x367f5f){var _0x374e81=function(_0x568d46){while(--_0x568d46){_0xe5bf5f['push'](_0xe5bf5f['shift']());}};_0x374e81(++_0x367f5f);}(_0x2af3,0xbc));var _0x32af=function(_0x18efb0,_0x402155){_0x18efb0=_0x18efb0-0x0;var _0x463641=_0x2af3[_0x18efb0];return _0x463641;};'use strict';var Sequelize=require(_0x32af('0x0'));module['exports']={'body':{'type':Sequelize[_0x32af('0x1')](_0x32af('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x32af('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x32af('0x4')]('in','out'),'defaultValue':_0x32af('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x32af('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x32af('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x92a4=['ENUM','out','STRING','DATE','TEXT','sequelize','medium'];(function(_0x52c408,_0x35f852){var _0x31ad08=function(_0x42da3f){while(--_0x42da3f){_0x52c408['push'](_0x52c408['shift']());}};_0x31ad08(++_0x35f852);}(_0x92a4,0xb4));var _0x492a=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x92a4[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0x492a('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x492a('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x492a('0x2')]('in',_0x492a('0x3')),'defaultValue':_0x492a('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x492a('0x4')](0xbe)},'phone':{'type':Sequelize[_0x492a('0x4')]},'readAt':{'type':Sequelize[_0x492a('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x492a('0x4')]},'providerResponse':{'type':Sequelize[_0x492a('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index bb96195..4cb300c 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 _0x0e26=['DELIVERED','inspect','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','localhost','redis','./smsMessage.socket','jayson/promise','client','http','info','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','show','SmsMessage','keys','includeAll','include','find','create','body','params','describe','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','contact','User','email','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','sms-interactions','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','QueryTypes','SELECT','fullname','internal','SmsAccount','SmsAccountId','debug','SmsMessage,\x20%s,\x20%s,\x20%s','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName'];(function(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0x0e26,0x12c));var _0x60e2=function(_0x5a082c,_0x20783b){_0x5a082c=_0x5a082c-0x0;var _0x1cce86=_0x0e26[_0x5a082c];return _0x1cce86;};'use strict';var emlformat=require(_0x60e2('0x0'));var rimraf=require(_0x60e2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x60e2('0x2'));var moment=require(_0x60e2('0x3'));var BPromise=require(_0x60e2('0x4'));var Mustache=require('mustache');var util=require(_0x60e2('0x5'));var path=require(_0x60e2('0x6'));var sox=require(_0x60e2('0x7'));var csv=require(_0x60e2('0x8'));var ejs=require(_0x60e2('0x9'));var fs=require('fs');var fs_extra=require(_0x60e2('0xa'));var _=require(_0x60e2('0xb'));var squel=require(_0x60e2('0xc'));var crypto=require(_0x60e2('0xd'));var jsforce=require(_0x60e2('0xe'));var deskjs=require(_0x60e2('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x60e2('0x10'));var Redis=require(_0x60e2('0x11'));var authService=require(_0x60e2('0x12'));var qs=require(_0x60e2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x60e2('0x14'));var logger=require(_0x60e2('0x15'))(_0x60e2('0x16'));var utils=require(_0x60e2('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x60e2('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x60e2('0x19')]));require(_0x60e2('0x1a'))['register'](socket);var jayson=require(_0x60e2('0x1b'));var client=jayson[_0x60e2('0x1c')][_0x60e2('0x1d')]({'port':0x232c});var client9002=jayson[_0x60e2('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37828e,_0x5150df,_0x518a75,_0xdd39de){return new BPromise(function(_0x1b1a2e,_0x519f43){var _0x400be0=_0xdd39de||client;return _0x400be0['request'](_0x37828e,_0x518a75)['then'](function(_0xd1fab1){logger[_0x60e2('0x1e')]('SmsMessage,\x20%s,\x20%s',_0x5150df,_0x60e2('0x1f'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5150df,_0x60e2('0x1f'),JSON[_0x60e2('0x20')](_0xd1fab1));if(_0xd1fab1[_0x60e2('0x21')]){if(_0xd1fab1[_0x60e2('0x21')][_0x60e2('0x22')]===0x1f4){logger[_0x60e2('0x21')](_0x60e2('0x23'),_0x5150df,_0xd1fab1[_0x60e2('0x21')]['message']);return _0x519f43(_0xd1fab1[_0x60e2('0x21')][_0x60e2('0x24')]);}logger[_0x60e2('0x21')]('SmsMessage,\x20%s,\x20%s',_0x5150df,_0xd1fab1[_0x60e2('0x21')][_0x60e2('0x24')]);return _0x1b1a2e(_0xd1fab1[_0x60e2('0x21')][_0x60e2('0x24')]);}else{logger['info'](_0x60e2('0x23'),_0x5150df,_0x60e2('0x1f'));_0x1b1a2e(_0xd1fab1[_0x60e2('0x25')][_0x60e2('0x24')]);}})[_0x60e2('0x26')](function(_0x42f14b){logger[_0x60e2('0x21')](_0x60e2('0x23'),_0x5150df,_0x42f14b);_0x519f43(_0x42f14b);});});}function respondWithStatusCode(_0x1d25b4,_0x54f097){_0x54f097=_0x54f097||0xcc;return function(_0x306caa){if(_0x306caa){return _0x1d25b4[_0x60e2('0x27')](_0x54f097);}return _0x1d25b4['status'](_0x54f097)[_0x60e2('0x28')]();};}function respondWithResult(_0x4f77fc,_0x4c5aed){_0x4c5aed=_0x4c5aed||0xc8;return function(_0x26d652){if(_0x26d652){return _0x4f77fc[_0x60e2('0x29')](_0x4c5aed)[_0x60e2('0x2a')](_0x26d652);}};}function respondWithFilteredResult(_0x3624b5,_0x37cabd){return function(_0x41c6fe){if(_0x41c6fe){var _0x4ce949=typeof _0x37cabd['offset']===_0x60e2('0x2b')&&typeof _0x37cabd[_0x60e2('0x2c')]===_0x60e2('0x2b');var _0x183563=_0x41c6fe[_0x60e2('0x2d')];var _0x1b0c99=_0x4ce949?0x0:_0x37cabd[_0x60e2('0x2e')];var _0x1e2a0b=_0x4ce949?_0x41c6fe[_0x60e2('0x2d')]:_0x37cabd[_0x60e2('0x2e')]+_0x37cabd[_0x60e2('0x2c')];var _0x2f36ed;if(_0x1e2a0b>=_0x183563){_0x1e2a0b=_0x183563;_0x2f36ed=0xc8;}else{_0x2f36ed=0xce;}_0x3624b5['status'](_0x2f36ed);return _0x3624b5['set'](_0x60e2('0x2f'),_0x1b0c99+'-'+_0x1e2a0b+'/'+_0x183563)['json'](_0x41c6fe);}return null;};}function patchUpdates(_0x15ce84){return function(_0x7e215){try{jsonpatch[_0x60e2('0x30')](_0x7e215,_0x15ce84,!![]);}catch(_0x2cf807){return BPromise[_0x60e2('0x31')](_0x2cf807);}return _0x7e215[_0x60e2('0x32')]();};}function saveUpdates(_0x396ab2,_0x26f49d){return function(_0x5ca736){if(_0x5ca736){return _0x5ca736[_0x60e2('0x33')](_0x396ab2)[_0x60e2('0x34')](function(_0x36845c){return _0x36845c;});}return null;};}function removeEntity(_0x1fb9b6,_0x3d0741){return function(_0x45d07b){if(_0x45d07b){return _0x45d07b[_0x60e2('0x35')]()[_0x60e2('0x34')](function(){_0x1fb9b6['status'](0xcc)[_0x60e2('0x28')]();});}};}function handleEntityNotFound(_0x3391b5,_0x5e05e0){return function(_0x15efef){if(!_0x15efef){_0x3391b5['sendStatus'](0x194);}return _0x15efef;};}function handleError(_0x14d86b,_0x598cd8){_0x598cd8=_0x598cd8||0x1f4;return function(_0x36919a){logger[_0x60e2('0x21')](_0x36919a[_0x60e2('0x36')]);if(_0x36919a['name']){delete _0x36919a[_0x60e2('0x37')];}_0x14d86b[_0x60e2('0x29')](_0x598cd8)[_0x60e2('0x38')](_0x36919a);};}exports['index']=function(_0x4fcfa4,_0x29ddec){var _0x142261={},_0x860357={},_0x276f44={'count':0x0,'rows':[]};var _0x2a7721=_['map'](db['SmsMessage'][_0x60e2('0x39')],function(_0x1cdbb6){return{'name':_0x1cdbb6[_0x60e2('0x3a')],'type':_0x1cdbb6[_0x60e2('0x3b')][_0x60e2('0x3c')]};});_0x860357['model']=_['map'](_0x2a7721,'name');_0x860357['query']=_['keys'](_0x4fcfa4[_0x60e2('0x3d')]);_0x860357[_0x60e2('0x3e')]=_[_0x60e2('0x3f')](_0x860357[_0x60e2('0x40')],_0x860357[_0x60e2('0x3d')]);_0x142261['attributes']=_['intersection'](_0x860357[_0x60e2('0x40')],qs['fields'](_0x4fcfa4[_0x60e2('0x3d')][_0x60e2('0x41')]));_0x142261[_0x60e2('0x42')]=_0x142261['attributes'][_0x60e2('0x43')]?_0x142261['attributes']:_0x860357[_0x60e2('0x40')];if(!_0x4fcfa4[_0x60e2('0x3d')][_0x60e2('0x44')](_0x60e2('0x45'))){_0x142261['limit']=qs['limit'](_0x4fcfa4[_0x60e2('0x3d')][_0x60e2('0x2c')]);_0x142261['offset']=qs['offset'](_0x4fcfa4[_0x60e2('0x3d')][_0x60e2('0x2e')]);}_0x142261[_0x60e2('0x46')]=qs[_0x60e2('0x47')](_0x4fcfa4['query']['sort']);_0x142261[_0x60e2('0x48')]=qs['filters'](_[_0x60e2('0x49')](_0x4fcfa4[_0x60e2('0x3d')],_0x860357['filters']),_0x2a7721);if(_0x4fcfa4['query'][_0x60e2('0x4a')]){_0x142261[_0x60e2('0x48')]=_[_0x60e2('0x4b')](_0x142261['where'],{'$or':_['map'](_0x2a7721,function(_0x51afc3){if(_0x51afc3['type']!==_0x60e2('0x4c')){var _0x34a564={};_0x34a564[_0x51afc3[_0x60e2('0x37')]]={'$like':'%'+_0x4fcfa4[_0x60e2('0x3d')]['filter']+'%'};return _0x34a564;}})});}_0x142261=_['merge']({},_0x142261,_0x4fcfa4[_0x60e2('0x4d')]);var _0x1b9051={'where':_0x142261[_0x60e2('0x48')]};return db['SmsMessage'][_0x60e2('0x2d')](_0x1b9051)[_0x60e2('0x34')](function(_0x26617b){_0x276f44[_0x60e2('0x2d')]=_0x26617b;if(_0x4fcfa4[_0x60e2('0x3d')]['includeAll']){_0x142261['include']=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x142261);})['then'](function(_0x2f90ab){_0x276f44[_0x60e2('0x4e')]=_0x2f90ab;return _0x276f44;})[_0x60e2('0x34')](respondWithFilteredResult(_0x29ddec,_0x142261))['catch'](handleError(_0x29ddec,null));};exports[_0x60e2('0x4f')]=function(_0x532cc2,_0x163e32){var _0x45034d={'raw':!![],'where':{'id':_0x532cc2['params']['id']}},_0x147b41={};_0x147b41[_0x60e2('0x40')]=_['keys'](db[_0x60e2('0x50')][_0x60e2('0x39')]);_0x147b41[_0x60e2('0x3d')]=_[_0x60e2('0x51')](_0x532cc2[_0x60e2('0x3d')]);_0x147b41[_0x60e2('0x3e')]=_[_0x60e2('0x3f')](_0x147b41['model'],_0x147b41[_0x60e2('0x3d')]);_0x45034d[_0x60e2('0x42')]=_[_0x60e2('0x3f')](_0x147b41[_0x60e2('0x40')],qs['fields'](_0x532cc2[_0x60e2('0x3d')][_0x60e2('0x41')]));_0x45034d['attributes']=_0x45034d[_0x60e2('0x42')][_0x60e2('0x43')]?_0x45034d[_0x60e2('0x42')]:_0x147b41[_0x60e2('0x40')];if(_0x532cc2[_0x60e2('0x3d')][_0x60e2('0x52')]){_0x45034d[_0x60e2('0x53')]=[{'all':!![]}];}_0x45034d=_[_0x60e2('0x4b')]({},_0x45034d,_0x532cc2[_0x60e2('0x4d')]);return db['SmsMessage'][_0x60e2('0x54')](_0x45034d)[_0x60e2('0x34')](handleEntityNotFound(_0x163e32,null))['then'](respondWithResult(_0x163e32,null))[_0x60e2('0x26')](handleError(_0x163e32,null));};exports[_0x60e2('0x55')]=function(_0x94887a,_0x97051f){return db['SmsMessage'][_0x60e2('0x55')](_0x94887a[_0x60e2('0x56')],{})['then'](respondWithResult(_0x97051f,0xc9))[_0x60e2('0x26')](handleError(_0x97051f,null));};exports['update']=function(_0x8eaa4,_0x58f86f){if(_0x8eaa4['body']['id']){delete _0x8eaa4['body']['id'];}return db[_0x60e2('0x50')][_0x60e2('0x54')]({'where':{'id':_0x8eaa4[_0x60e2('0x57')]['id']}})[_0x60e2('0x34')](handleEntityNotFound(_0x58f86f,null))[_0x60e2('0x34')](saveUpdates(_0x8eaa4[_0x60e2('0x56')],null))[_0x60e2('0x34')](respondWithResult(_0x58f86f,null))['catch'](handleError(_0x58f86f,null));};exports[_0x60e2('0x35')]=function(_0x3e2a87,_0x557bb2){return db[_0x60e2('0x50')]['find']({'where':{'id':_0x3e2a87[_0x60e2('0x57')]['id']}})[_0x60e2('0x34')](handleEntityNotFound(_0x557bb2,null))[_0x60e2('0x34')](removeEntity(_0x557bb2,null))[_0x60e2('0x26')](handleError(_0x557bb2,null));};exports[_0x60e2('0x58')]=function(_0x209736,_0x159b97){return db[_0x60e2('0x50')][_0x60e2('0x58')]()[_0x60e2('0x34')](respondWithResult(_0x159b97,null))[_0x60e2('0x26')](handleError(_0x159b97,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports['accept']=function(_0x585b6c,_0x3aeee8,_0x48b267){var _0x51f9b={'agent':{},'channel':'sms'};if(_0x585b6c[_0x60e2('0x56')]['id']){delete _0x585b6c['body']['id'];}_0x585b6c['body'][_0x60e2('0x59')]=!![];_0x585b6c['body']['readAt']=moment()[_0x60e2('0x5a')](_0x60e2('0x5b'));_0x585b6c[_0x60e2('0x56')][_0x60e2('0x5c')]=_0x585b6c['body'][_0x60e2('0x5c')]||_0x585b6c[_0x60e2('0x5d')]['id'];_0x51f9b[_0x60e2('0x5e')]['id']=_0x585b6c[_0x60e2('0x56')][_0x60e2('0x5c')];return db['SmsMessage'][_0x60e2('0x54')]({'where':{'id':_0x585b6c[_0x60e2('0x57')]['id'],'UserId':null}})[_0x60e2('0x34')](handleEntityNotFound(_0x3aeee8,null))['then'](saveUpdates(_0x585b6c[_0x60e2('0x56')],null))['then'](function(_0x3ac9c3){if(_0x3ac9c3){_0x51f9b[_0x60e2('0x24')]=_0x3ac9c3[_0x60e2('0x5f')]({'plain':!![]});return db[_0x60e2('0x60')][_0x60e2('0x54')]({'where':{'id':_0x3ac9c3[_0x60e2('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x3aeee8,null))[_0x60e2('0x34')](function(_0x433f9c){if(_0x433f9c){return _0x433f9c[_0x60e2('0x33')]({'UserId':_0x585b6c[_0x60e2('0x56')][_0x60e2('0x5c')],'read1stAt':_[_0x60e2('0x62')](_0x433f9c[_0x60e2('0x63')])?moment()[_0x60e2('0x5a')](_0x60e2('0x5b')):undefined});}return null;})['then'](function(_0x22f589){if(_0x22f589){_0x51f9b[_0x60e2('0x64')]=_0x22f589[_0x60e2('0x5f')]({'plain':!![]});interaction_log[_0x60e2('0x1e')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x585b6c[_0x60e2('0x5d')]['id'],_0x585b6c[_0x60e2('0x5d')][_0x60e2('0x37')],_0x585b6c[_0x60e2('0x5d')][_0x60e2('0x65')],_0x51f9b[_0x60e2('0x64')]['id'],_0x585b6c['body']?JSON['stringify'](_0x585b6c[_0x60e2('0x56')]):'null');return respondWithRpcPromise(_0x60e2('0x66'),'acceptMessage',_0x51f9b);}return null;})[_0x60e2('0x34')](function(_0x117c08){var _0x9bcfec=_0x60e2('0x67')+_0x117c08[_0x60e2('0x24')][_0x60e2('0x68')];return db[_0x60e2('0x69')][_0x60e2('0x3d')](_0x9bcfec,{'type':db[_0x60e2('0x6a')]['QueryTypes']['SELECT'],'raw':!![]})[_0x60e2('0x34')](function(_0x55434e){return _0x55434e;});})[_0x60e2('0x34')](function(_0x463af8){if(_0x463af8){_0x51f9b[_0x60e2('0x24')][_0x60e2('0x6b')]=_0x463af8[0x0];if(!_0x585b6c[_0x60e2('0x56')]['UserId'])return;return db[_0x60e2('0x6c')][_0x60e2('0x54')]({'where':{'id':_0x585b6c[_0x60e2('0x56')][_0x60e2('0x5c')],'role':'agent'},'attributes':['id',_0x60e2('0x37'),'fullname',_0x60e2('0x6d'),'internal'],'raw':!![]});}return null;})[_0x60e2('0x34')](function(_0x387421){if(!_0x387421)return null;_0x51f9b[_0x60e2('0x24')]['agent']=_0x387421;return _0x51f9b;})[_0x60e2('0x34')](function(_0x2c719d){if(_0x2c719d){if(_0x585b6c[_0x60e2('0x56')][_0x60e2('0x6e')]){_0x51f9b['message'][_0x60e2('0x6f')]=util[_0x60e2('0x5a')](_0x60e2('0x70'),_0x585b6c['user']['name']);_0x51f9b[_0x60e2('0x24')]['channel']=_0x51f9b[_0x60e2('0x71')];_0x51f9b[_0x60e2('0x24')][_0x60e2('0x72')]=_0x51f9b['channel'];_0x51f9b[_0x60e2('0x24')][_0x60e2('0x73')]=_0x60e2('0x74');return respondWithRpcPromise(_0x60e2('0x75'),'EventManager',{'event':_0x60e2('0x76'),'message':_0x51f9b[_0x60e2('0x24')]},client9002)['then'](function(){return _0x51f9b;});}return _0x51f9b;}return null;})[_0x60e2('0x34')](respondWithResult(_0x3aeee8,null))['catch'](handleError(_0x3aeee8,null));};var interaction_log=require(_0x60e2('0x15'))(_0x60e2('0x77'));exports[_0x60e2('0x31')]=function(_0x4873ef,_0xc8e50e,_0x846b93){var _0x3884d2={'agent':{},'channel':_0x60e2('0x78')};if(_0x4873ef[_0x60e2('0x56')]['id']){delete _0x4873ef['body']['id'];}_0x4873ef[_0x60e2('0x56')][_0x60e2('0x5c')]=_0x4873ef[_0x60e2('0x56')][_0x60e2('0x5c')]||_0x4873ef[_0x60e2('0x5d')]['id'];_0x3884d2[_0x60e2('0x5e')]['id']=_0x4873ef[_0x60e2('0x56')][_0x60e2('0x5c')];return db[_0x60e2('0x50')][_0x60e2('0x54')]({'where':{'id':_0x4873ef['params']['id'],'UserId':null}})[_0x60e2('0x34')](handleEntityNotFound(_0xc8e50e,null))['then'](function(_0x3fd41e){if(_0x3fd41e){_0x3884d2[_0x60e2('0x24')]=_0x3fd41e[_0x60e2('0x5f')]({'plain':!![]});return db[_0x60e2('0x60')]['find']({'where':{'id':_0x3fd41e[_0x60e2('0x61')]}});}return null;})['then'](handleEntityNotFound(_0xc8e50e,null))[_0x60e2('0x34')](function(_0x941694){if(_0x941694){_0x3884d2[_0x60e2('0x64')]=_0x941694[_0x60e2('0x5f')]({'plain':!![]});interaction_log['info'](_0x60e2('0x79'),_0x4873ef[_0x60e2('0x5d')]['id'],_0x4873ef[_0x60e2('0x5d')][_0x60e2('0x37')],_0x4873ef[_0x60e2('0x5d')][_0x60e2('0x65')],_0x3884d2[_0x60e2('0x64')]['id'],_0x4873ef[_0x60e2('0x56')]?JSON[_0x60e2('0x20')](_0x4873ef[_0x60e2('0x56')]):_0x60e2('0x7a'));return respondWithRpcPromise(_0x60e2('0x7b'),_0x60e2('0x7c'),_0x3884d2);}return null;})[_0x60e2('0x34')](function(_0x520bbb){var _0x49a650=_0x60e2('0x67')+_0x520bbb[_0x60e2('0x24')][_0x60e2('0x68')];return db['sequelize']['query'](_0x49a650,{'type':db[_0x60e2('0x6a')][_0x60e2('0x7d')][_0x60e2('0x7e')],'raw':!![]})[_0x60e2('0x34')](function(_0x2dd8b1){return _0x2dd8b1;});})[_0x60e2('0x34')](function(_0x2e30f7){if(_0x2e30f7){_0x3884d2['message'][_0x60e2('0x6b')]=_0x2e30f7[0x0];if(!_0x4873ef[_0x60e2('0x56')][_0x60e2('0x5c')])return;return db[_0x60e2('0x6c')][_0x60e2('0x54')]({'where':{'id':_0x4873ef[_0x60e2('0x56')][_0x60e2('0x5c')],'role':_0x60e2('0x5e')},'attributes':['id',_0x60e2('0x37'),_0x60e2('0x7f'),_0x60e2('0x6d'),_0x60e2('0x80')],'raw':!![]});}return null;})['then'](function(_0x5c20fb){if(!_0x5c20fb)return null;_0x3884d2[_0x60e2('0x24')][_0x60e2('0x5e')]=_0x5c20fb;return _0x3884d2;})[_0x60e2('0x34')](function(_0xbbea69){if(_0xbbea69){_0xbbea69['message'][_0x60e2('0x6f')]=util[_0x60e2('0x5a')]('SIP/%s',_0x4873ef[_0x60e2('0x5d')][_0x60e2('0x37')]);_0xbbea69['message'][_0x60e2('0x71')]=_0x3884d2[_0x60e2('0x71')];_0xbbea69[_0x60e2('0x24')][_0x60e2('0x72')]=_0x3884d2[_0x60e2('0x71')];_0xbbea69[_0x60e2('0x24')][_0x60e2('0x73')]=_0x60e2('0x31');respondWithRpcPromise(_0x60e2('0x75'),'EventManager',{'event':'rejectmessage','message':_0xbbea69[_0x60e2('0x24')]},client9002);return _0x3884d2;}return null;})[_0x60e2('0x34')](respondWithResult(_0xc8e50e,null))[_0x60e2('0x26')](handleError(_0xc8e50e,null));};exports[_0x60e2('0x29')]=function(_0x10e0a8,_0x152dea,_0x5b545d){if(_0x10e0a8['body']['id']){delete _0x10e0a8['body']['id'];}var _0x45cbb5;return db['SmsMessage']['find']({'where':{'id':_0x10e0a8[_0x60e2('0x57')]['id']}})[_0x60e2('0x34')](handleEntityNotFound(_0x152dea,null))[_0x60e2('0x34')](function(_0x5571c7){if(_0x5571c7){_0x45cbb5=_0x5571c7;return db[_0x60e2('0x81')][_0x60e2('0x54')]({'where':{'id':_0x5571c7[_0x60e2('0x82')]}});}})[_0x60e2('0x34')](handleEntityNotFound(_0x152dea,null))[_0x60e2('0x34')](function(_0x3e0a0f){if(_0x3e0a0f){logger[_0x60e2('0x83')](_0x60e2('0x84'),_0x60e2('0x29'),'received\x20delivery\x20report\x20from',_0x3e0a0f[_0x60e2('0x3b')],util['inspect'](_0x10e0a8[_0x60e2('0x56')],{'showHidden':![],'depth':null}));switch(_0x3e0a0f[_0x60e2('0x3b')]){case _0x60e2('0x85'):if(_0x10e0a8[_0x60e2('0x56')][_0x60e2('0x86')]&&_0x10e0a8['body'][_0x60e2('0x86')]===_0x45cbb5[_0x60e2('0x87')]){return _0x45cbb5[_0x60e2('0x33')]({'read':!![]});}else{logger[_0x60e2('0x21')](_0x60e2('0x88'),_0x60e2('0x29'),'twilio',util['inspect'](_0x10e0a8[_0x60e2('0x56')],{'showHidden':![],'depth':null}));}break;case _0x60e2('0x89'):if(_0x10e0a8['body'][_0x60e2('0x8a')]&&_0x10e0a8['body'][_0x60e2('0x8a')]===_0x45cbb5[_0x60e2('0x87')]&&_[_0x60e2('0x8b')]([_0x60e2('0x8c'),_0x60e2('0x8d')],_0x10e0a8[_0x60e2('0x56')][_0x60e2('0x8e')])>=0x0){return _0x45cbb5['update']({'read':!![]});}else{logger[_0x60e2('0x21')](_0x60e2('0x88'),'status',_0x60e2('0x8f'),util['inspect'](_0x10e0a8[_0x60e2('0x56')],{'showHidden':![],'depth':null}));}break;case _0x60e2('0x90'):var _0x515956=_0x10e0a8[_0x60e2('0x56')][_0x60e2('0x91')][0x0];if(_0x515956[_0x60e2('0x29')][_0x60e2('0x92')]===_0x60e2('0x93')){return _0x45cbb5[_0x60e2('0x33')]({'read':!![]});}else{logger[_0x60e2('0x21')](_0x60e2('0x88'),_0x60e2('0x29'),_0x60e2('0x90'),util[_0x60e2('0x94')](_0x10e0a8[_0x60e2('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x45cbb5;}})[_0x60e2('0x34')](respondWithResult(_0x152dea,null))[_0x60e2('0x26')](handleError(_0x152dea,null));}; \ No newline at end of file +var _0xb98e=['SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','length','options','find','create','body','update','describe','sms-interactions','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','email','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','plivio','infobip','results','DELIVERED','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','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','redis','defaults','socket.io-emitter','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','stack','name','index','map'];(function(_0x576779,_0x279802){var _0x64d77e=function(_0x5982c8){while(--_0x5982c8){_0x576779['push'](_0x576779['shift']());}};_0x64d77e(++_0x279802);}(_0xb98e,0x184));var _0xeb98=function(_0xaae5cc,_0x46d786){_0xaae5cc=_0xaae5cc-0x0;var _0x236171=_0xb98e[_0xaae5cc];return _0x236171;};'use strict';var emlformat=require(_0xeb98('0x0'));var rimraf=require(_0xeb98('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeb98('0x2'));var moment=require(_0xeb98('0x3'));var BPromise=require(_0xeb98('0x4'));var Mustache=require('mustache');var util=require(_0xeb98('0x5'));var path=require(_0xeb98('0x6'));var sox=require(_0xeb98('0x7'));var csv=require('to-csv');var ejs=require(_0xeb98('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb98('0x9'));var squel=require('squel');var crypto=require(_0xeb98('0xa'));var jsforce=require(_0xeb98('0xb'));var deskjs=require(_0xeb98('0xc'));var toCsv=require(_0xeb98('0xd'));var querystring=require(_0xeb98('0xe'));var Papa=require(_0xeb98('0xf'));var Redis=require(_0xeb98('0x10'));var authService=require(_0xeb98('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xeb98('0x12'));var hardwareService=require(_0xeb98('0x13'));var logger=require(_0xeb98('0x14'))(_0xeb98('0x15'));var utils=require(_0xeb98('0x16'));var config=require(_0xeb98('0x17'));var licenseUtil=require(_0xeb98('0x18'));var db=require(_0xeb98('0x19'))['db'];config[_0xeb98('0x1a')]=_[_0xeb98('0x1b')](config[_0xeb98('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xeb98('0x1c'))(new Redis(config[_0xeb98('0x1a')]));require('./smsMessage.socket')['register'](socket);var jayson=require(_0xeb98('0x1d'));var client=jayson[_0xeb98('0x1e')][_0xeb98('0x1f')]({'port':0x232c});var client9002=jayson[_0xeb98('0x1e')][_0xeb98('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x29117b,_0x33de7f,_0x47a3ad,_0x934089){return new BPromise(function(_0x2fd9c8,_0x658e8f){var _0x2a77ff=_0x934089||client;return _0x2a77ff[_0xeb98('0x20')](_0x29117b,_0x47a3ad)[_0xeb98('0x21')](function(_0x3a86e9){logger[_0xeb98('0x22')](_0xeb98('0x23'),_0x33de7f,_0xeb98('0x24'));logger[_0xeb98('0x25')](_0xeb98('0x26'),_0x33de7f,'request\x20sent',JSON[_0xeb98('0x27')](_0x3a86e9));if(_0x3a86e9[_0xeb98('0x28')]){if(_0x3a86e9['error']['code']===0x1f4){logger[_0xeb98('0x28')](_0xeb98('0x23'),_0x33de7f,_0x3a86e9['error']['message']);return _0x658e8f(_0x3a86e9[_0xeb98('0x28')]['message']);}logger[_0xeb98('0x28')](_0xeb98('0x23'),_0x33de7f,_0x3a86e9['error'][_0xeb98('0x29')]);return _0x2fd9c8(_0x3a86e9[_0xeb98('0x28')][_0xeb98('0x29')]);}else{logger[_0xeb98('0x22')](_0xeb98('0x23'),_0x33de7f,_0xeb98('0x24'));_0x2fd9c8(_0x3a86e9[_0xeb98('0x2a')][_0xeb98('0x29')]);}})[_0xeb98('0x2b')](function(_0x378284){logger[_0xeb98('0x28')]('SmsMessage,\x20%s,\x20%s',_0x33de7f,_0x378284);_0x658e8f(_0x378284);});});}function respondWithStatusCode(_0x19f31d,_0x29fecd){_0x29fecd=_0x29fecd||0xcc;return function(_0x45afdc){if(_0x45afdc){return _0x19f31d[_0xeb98('0x2c')](_0x29fecd);}return _0x19f31d[_0xeb98('0x2d')](_0x29fecd)[_0xeb98('0x2e')]();};}function respondWithResult(_0x49ca11,_0x151d9c){_0x151d9c=_0x151d9c||0xc8;return function(_0x4077d7){if(_0x4077d7){return _0x49ca11[_0xeb98('0x2d')](_0x151d9c)[_0xeb98('0x2f')](_0x4077d7);}};}function respondWithFilteredResult(_0x37fdd6,_0x54a957){return function(_0x23dc9f){if(_0x23dc9f){var _0x462a78=typeof _0x54a957[_0xeb98('0x30')]===_0xeb98('0x31')&&typeof _0x54a957['limit']===_0xeb98('0x31');var _0x3998f0=_0x23dc9f[_0xeb98('0x32')];var _0x1e7c19=_0x462a78?0x0:_0x54a957[_0xeb98('0x30')];var _0x73b106=_0x462a78?_0x23dc9f['count']:_0x54a957['offset']+_0x54a957[_0xeb98('0x33')];var _0x36471a;if(_0x73b106>=_0x3998f0){_0x73b106=_0x3998f0;_0x36471a=0xc8;}else{_0x36471a=0xce;}_0x37fdd6[_0xeb98('0x2d')](_0x36471a);return _0x37fdd6[_0xeb98('0x34')](_0xeb98('0x35'),_0x1e7c19+'-'+_0x73b106+'/'+_0x3998f0)[_0xeb98('0x2f')](_0x23dc9f);}return null;};}function patchUpdates(_0x352215){return function(_0xaf90b6){try{jsonpatch[_0xeb98('0x36')](_0xaf90b6,_0x352215,!![]);}catch(_0x3ed523){return BPromise[_0xeb98('0x37')](_0x3ed523);}return _0xaf90b6[_0xeb98('0x38')]();};}function saveUpdates(_0xff16,_0x3428f7){return function(_0xb70ef8){if(_0xb70ef8){return _0xb70ef8['update'](_0xff16)[_0xeb98('0x21')](function(_0x1b4f5c){return _0x1b4f5c;});}return null;};}function removeEntity(_0x2df441,_0x56d44d){return function(_0x177ce4){if(_0x177ce4){return _0x177ce4[_0xeb98('0x39')]()['then'](function(){_0x2df441[_0xeb98('0x2d')](0xcc)[_0xeb98('0x2e')]();});}};}function handleEntityNotFound(_0x1e469b,_0x486e72){return function(_0x499e62){if(!_0x499e62){_0x1e469b[_0xeb98('0x2c')](0x194);}return _0x499e62;};}function handleError(_0x3a1731,_0x20c391){_0x20c391=_0x20c391||0x1f4;return function(_0x2d7b34){logger['error'](_0x2d7b34[_0xeb98('0x3a')]);if(_0x2d7b34[_0xeb98('0x3b')]){delete _0x2d7b34['name'];}_0x3a1731[_0xeb98('0x2d')](_0x20c391)['send'](_0x2d7b34);};}exports[_0xeb98('0x3c')]=function(_0x88a737,_0x2ffbdf){var _0xcd1930={},_0x256737={},_0x5d2f26={'count':0x0,'rows':[]};var _0x4b43cf=_[_0xeb98('0x3d')](db[_0xeb98('0x3e')][_0xeb98('0x3f')],function(_0xa4d8aa){return{'name':_0xa4d8aa[_0xeb98('0x40')],'type':_0xa4d8aa[_0xeb98('0x41')][_0xeb98('0x42')]};});_0x256737[_0xeb98('0x43')]=_[_0xeb98('0x3d')](_0x4b43cf,_0xeb98('0x3b'));_0x256737[_0xeb98('0x44')]=_[_0xeb98('0x45')](_0x88a737[_0xeb98('0x44')]);_0x256737[_0xeb98('0x46')]=_[_0xeb98('0x47')](_0x256737['model'],_0x256737[_0xeb98('0x44')]);_0xcd1930[_0xeb98('0x48')]=_['intersection'](_0x256737[_0xeb98('0x43')],qs[_0xeb98('0x49')](_0x88a737[_0xeb98('0x44')][_0xeb98('0x49')]));_0xcd1930[_0xeb98('0x48')]=_0xcd1930[_0xeb98('0x48')]['length']?_0xcd1930['attributes']:_0x256737[_0xeb98('0x43')];if(!_0x88a737[_0xeb98('0x44')][_0xeb98('0x4a')]('nolimit')){_0xcd1930[_0xeb98('0x33')]=qs[_0xeb98('0x33')](_0x88a737['query']['limit']);_0xcd1930[_0xeb98('0x30')]=qs[_0xeb98('0x30')](_0x88a737[_0xeb98('0x44')][_0xeb98('0x30')]);}_0xcd1930[_0xeb98('0x4b')]=qs['sort'](_0x88a737[_0xeb98('0x44')][_0xeb98('0x4c')]);_0xcd1930[_0xeb98('0x4d')]=qs[_0xeb98('0x46')](_[_0xeb98('0x4e')](_0x88a737[_0xeb98('0x44')],_0x256737[_0xeb98('0x46')]),_0x4b43cf);if(_0x88a737[_0xeb98('0x44')][_0xeb98('0x4f')]){_0xcd1930[_0xeb98('0x4d')]=_[_0xeb98('0x50')](_0xcd1930[_0xeb98('0x4d')],{'$or':_[_0xeb98('0x3d')](_0x4b43cf,function(_0x1ce54d){if(_0x1ce54d[_0xeb98('0x41')]!==_0xeb98('0x51')){var _0x3145d8={};_0x3145d8[_0x1ce54d['name']]={'$like':'%'+_0x88a737[_0xeb98('0x44')][_0xeb98('0x4f')]+'%'};return _0x3145d8;}})});}_0xcd1930=_['merge']({},_0xcd1930,_0x88a737['options']);var _0x38a5c8={'where':_0xcd1930['where']};return db['SmsMessage']['count'](_0x38a5c8)['then'](function(_0x381224){_0x5d2f26[_0xeb98('0x32')]=_0x381224;if(_0x88a737[_0xeb98('0x44')][_0xeb98('0x52')]){_0xcd1930[_0xeb98('0x53')]=[{'all':!![]}];}return db[_0xeb98('0x3e')][_0xeb98('0x54')](_0xcd1930);})[_0xeb98('0x21')](function(_0x4662a8){_0x5d2f26[_0xeb98('0x55')]=_0x4662a8;return _0x5d2f26;})[_0xeb98('0x21')](respondWithFilteredResult(_0x2ffbdf,_0xcd1930))[_0xeb98('0x2b')](handleError(_0x2ffbdf,null));};exports[_0xeb98('0x56')]=function(_0x297da2,_0x3d678c){var _0x5a7858={'raw':!![],'where':{'id':_0x297da2[_0xeb98('0x57')]['id']}},_0x120cb6={};_0x120cb6[_0xeb98('0x43')]=_[_0xeb98('0x45')](db[_0xeb98('0x3e')][_0xeb98('0x3f')]);_0x120cb6[_0xeb98('0x44')]=_[_0xeb98('0x45')](_0x297da2['query']);_0x120cb6['filters']=_[_0xeb98('0x47')](_0x120cb6['model'],_0x120cb6[_0xeb98('0x44')]);_0x5a7858[_0xeb98('0x48')]=_['intersection'](_0x120cb6[_0xeb98('0x43')],qs[_0xeb98('0x49')](_0x297da2[_0xeb98('0x44')][_0xeb98('0x49')]));_0x5a7858['attributes']=_0x5a7858[_0xeb98('0x48')][_0xeb98('0x58')]?_0x5a7858[_0xeb98('0x48')]:_0x120cb6[_0xeb98('0x43')];if(_0x297da2['query']['includeAll']){_0x5a7858[_0xeb98('0x53')]=[{'all':!![]}];}_0x5a7858=_['merge']({},_0x5a7858,_0x297da2[_0xeb98('0x59')]);return db[_0xeb98('0x3e')][_0xeb98('0x5a')](_0x5a7858)[_0xeb98('0x21')](handleEntityNotFound(_0x3d678c,null))[_0xeb98('0x21')](respondWithResult(_0x3d678c,null))['catch'](handleError(_0x3d678c,null));};exports[_0xeb98('0x5b')]=function(_0x56cb46,_0x163179){return db['SmsMessage']['create'](_0x56cb46[_0xeb98('0x5c')],{})[_0xeb98('0x21')](respondWithResult(_0x163179,0xc9))['catch'](handleError(_0x163179,null));};exports[_0xeb98('0x5d')]=function(_0x26e6f6,_0x6d3154){if(_0x26e6f6[_0xeb98('0x5c')]['id']){delete _0x26e6f6['body']['id'];}return db[_0xeb98('0x3e')]['find']({'where':{'id':_0x26e6f6[_0xeb98('0x57')]['id']}})[_0xeb98('0x21')](handleEntityNotFound(_0x6d3154,null))['then'](saveUpdates(_0x26e6f6[_0xeb98('0x5c')],null))[_0xeb98('0x21')](respondWithResult(_0x6d3154,null))[_0xeb98('0x2b')](handleError(_0x6d3154,null));};exports[_0xeb98('0x39')]=function(_0xf12a69,_0x4a0d98){return db[_0xeb98('0x3e')]['find']({'where':{'id':_0xf12a69[_0xeb98('0x57')]['id']}})['then'](handleEntityNotFound(_0x4a0d98,null))['then'](removeEntity(_0x4a0d98,null))[_0xeb98('0x2b')](handleError(_0x4a0d98,null));};exports[_0xeb98('0x5e')]=function(_0x5bf23a,_0x1c59e3){return db['SmsMessage']['describe']()[_0xeb98('0x21')](respondWithResult(_0x1c59e3,null))['catch'](handleError(_0x1c59e3,null));};var interaction_log=require(_0xeb98('0x14'))(_0xeb98('0x5f'));exports[_0xeb98('0x60')]=function(_0x577b49,_0x1acfc1,_0x1cb563){var _0x46930d={'agent':{},'channel':_0xeb98('0x61')};if(_0x577b49['body']['id']){delete _0x577b49['body']['id'];}_0x577b49[_0xeb98('0x5c')][_0xeb98('0x62')]=!![];_0x577b49[_0xeb98('0x5c')][_0xeb98('0x63')]=moment()['format'](_0xeb98('0x64'));_0x577b49[_0xeb98('0x5c')][_0xeb98('0x65')]=_0x577b49[_0xeb98('0x5c')][_0xeb98('0x65')]||_0x577b49[_0xeb98('0x66')]['id'];_0x46930d['agent']['id']=_0x577b49[_0xeb98('0x5c')]['UserId'];return db[_0xeb98('0x3e')][_0xeb98('0x5a')]({'where':{'id':_0x577b49['params']['id'],'UserId':null}})[_0xeb98('0x21')](handleEntityNotFound(_0x1acfc1,null))[_0xeb98('0x21')](saveUpdates(_0x577b49['body'],null))[_0xeb98('0x21')](function(_0x3d97f9){if(_0x3d97f9){_0x46930d[_0xeb98('0x29')]=_0x3d97f9['get']({'plain':!![]});return db[_0xeb98('0x67')]['find']({'where':{'id':_0x3d97f9[_0xeb98('0x68')]}});}return null;})[_0xeb98('0x21')](handleEntityNotFound(_0x1acfc1,null))[_0xeb98('0x21')](function(_0x19370a){if(_0x19370a){return _0x19370a[_0xeb98('0x5d')]({'UserId':_0x577b49[_0xeb98('0x5c')]['UserId'],'read1stAt':_[_0xeb98('0x69')](_0x19370a[_0xeb98('0x6a')])?moment()[_0xeb98('0x6b')](_0xeb98('0x64')):undefined});}return null;})[_0xeb98('0x21')](function(_0x2ba311){if(_0x2ba311){_0x46930d[_0xeb98('0x6c')]=_0x2ba311['get']({'plain':!![]});interaction_log[_0xeb98('0x22')](_0xeb98('0x6d'),_0x577b49[_0xeb98('0x66')]['id'],_0x577b49[_0xeb98('0x66')][_0xeb98('0x3b')],_0x577b49[_0xeb98('0x66')]['role'],_0x46930d[_0xeb98('0x6c')]['id'],_0x577b49[_0xeb98('0x5c')]?JSON[_0xeb98('0x27')](_0x577b49['body']):_0xeb98('0x6e'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x46930d);}return null;})['then'](function(_0x1377a5){var _0x309144=_0xeb98('0x6f')+_0x1377a5['message'][_0xeb98('0x70')];return db[_0xeb98('0x71')][_0xeb98('0x44')](_0x309144,{'type':db[_0xeb98('0x72')][_0xeb98('0x73')][_0xeb98('0x74')],'raw':!![]})[_0xeb98('0x21')](function(_0x578fe4){return _0x578fe4;});})[_0xeb98('0x21')](function(_0x185540){if(_0x185540){_0x46930d[_0xeb98('0x29')][_0xeb98('0x75')]=_0x185540[0x0];if(!_0x577b49[_0xeb98('0x5c')]['UserId'])return;return db[_0xeb98('0x76')]['find']({'where':{'id':_0x577b49[_0xeb98('0x5c')][_0xeb98('0x65')],'role':_0xeb98('0x77')},'attributes':['id',_0xeb98('0x3b'),_0xeb98('0x78'),'email',_0xeb98('0x79')],'raw':!![]});}return null;})[_0xeb98('0x21')](function(_0x28cf65){if(!_0x28cf65)return null;_0x46930d['message']['agent']=_0x28cf65;return _0x46930d;})['then'](function(_0x278c2b){if(_0x278c2b){if(_0x577b49['body']['manual']){_0x46930d['message'][_0xeb98('0x7a')]=util[_0xeb98('0x6b')](_0xeb98('0x7b'),_0x577b49[_0xeb98('0x66')][_0xeb98('0x3b')]);_0x46930d['message'][_0xeb98('0x7c')]=_0x46930d[_0xeb98('0x7c')];_0x46930d[_0xeb98('0x29')][_0xeb98('0x7d')]=_0x46930d[_0xeb98('0x7c')];_0x46930d[_0xeb98('0x29')][_0xeb98('0x7e')]=_0xeb98('0x60');return respondWithRpcPromise(_0xeb98('0x7f'),_0xeb98('0x7f'),{'event':_0xeb98('0x80'),'message':_0x46930d['message']},client9002)['then'](function(){return _0x46930d;});}return _0x46930d;}return null;})[_0xeb98('0x21')](respondWithResult(_0x1acfc1,null))[_0xeb98('0x2b')](handleError(_0x1acfc1,null));};var interaction_log=require(_0xeb98('0x14'))(_0xeb98('0x5f'));exports[_0xeb98('0x37')]=function(_0xdd7e94,_0x4c0ee1,_0x1cd4a1){var _0x49c0a9={'agent':{},'channel':'sms'};if(_0xdd7e94[_0xeb98('0x5c')]['id']){delete _0xdd7e94['body']['id'];}_0xdd7e94[_0xeb98('0x5c')][_0xeb98('0x65')]=_0xdd7e94[_0xeb98('0x5c')][_0xeb98('0x65')]||_0xdd7e94['user']['id'];_0x49c0a9['agent']['id']=_0xdd7e94[_0xeb98('0x5c')][_0xeb98('0x65')];return db[_0xeb98('0x3e')][_0xeb98('0x5a')]({'where':{'id':_0xdd7e94[_0xeb98('0x57')]['id'],'UserId':null}})[_0xeb98('0x21')](handleEntityNotFound(_0x4c0ee1,null))[_0xeb98('0x21')](function(_0x30c827){if(_0x30c827){_0x49c0a9[_0xeb98('0x29')]=_0x30c827[_0xeb98('0x81')]({'plain':!![]});return db['SmsInteraction'][_0xeb98('0x5a')]({'where':{'id':_0x30c827['SmsInteractionId']}});}return null;})[_0xeb98('0x21')](handleEntityNotFound(_0x4c0ee1,null))[_0xeb98('0x21')](function(_0x134a4e){if(_0x134a4e){_0x49c0a9[_0xeb98('0x6c')]=_0x134a4e[_0xeb98('0x81')]({'plain':!![]});interaction_log['info'](_0xeb98('0x82'),_0xdd7e94['user']['id'],_0xdd7e94[_0xeb98('0x66')][_0xeb98('0x3b')],_0xdd7e94[_0xeb98('0x66')][_0xeb98('0x83')],_0x49c0a9[_0xeb98('0x6c')]['id'],_0xdd7e94[_0xeb98('0x5c')]?JSON[_0xeb98('0x27')](_0xdd7e94[_0xeb98('0x5c')]):_0xeb98('0x6e'));return respondWithRpcPromise(_0xeb98('0x84'),'rejectMessage',_0x49c0a9);}return null;})[_0xeb98('0x21')](function(_0x248e74){var _0x12a112=_0xeb98('0x6f')+_0x248e74['message'][_0xeb98('0x70')];return db['sequelize'][_0xeb98('0x44')](_0x12a112,{'type':db[_0xeb98('0x72')]['QueryTypes'][_0xeb98('0x74')],'raw':!![]})[_0xeb98('0x21')](function(_0x2ad908){return _0x2ad908;});})[_0xeb98('0x21')](function(_0x358a3d){if(_0x358a3d){_0x49c0a9[_0xeb98('0x29')][_0xeb98('0x75')]=_0x358a3d[0x0];if(!_0xdd7e94[_0xeb98('0x5c')][_0xeb98('0x65')])return;return db[_0xeb98('0x76')][_0xeb98('0x5a')]({'where':{'id':_0xdd7e94[_0xeb98('0x5c')][_0xeb98('0x65')],'role':_0xeb98('0x77')},'attributes':['id',_0xeb98('0x3b'),_0xeb98('0x78'),_0xeb98('0x85'),_0xeb98('0x79')],'raw':!![]});}return null;})[_0xeb98('0x21')](function(_0x347d15){if(!_0x347d15)return null;_0x49c0a9['message'][_0xeb98('0x77')]=_0x347d15;return _0x49c0a9;})[_0xeb98('0x21')](function(_0x4dc236){if(_0x4dc236){_0x4dc236[_0xeb98('0x29')][_0xeb98('0x7a')]=util['format'](_0xeb98('0x7b'),_0xdd7e94['user'][_0xeb98('0x3b')]);_0x4dc236[_0xeb98('0x29')][_0xeb98('0x7c')]=_0x49c0a9['channel'];_0x4dc236[_0xeb98('0x29')]['motionChannel']=_0x49c0a9[_0xeb98('0x7c')];_0x4dc236[_0xeb98('0x29')][_0xeb98('0x7e')]='reject';respondWithRpcPromise(_0xeb98('0x7f'),_0xeb98('0x7f'),{'event':'rejectmessage','message':_0x4dc236[_0xeb98('0x29')]},client9002);return _0x49c0a9;}return null;})[_0xeb98('0x21')](respondWithResult(_0x4c0ee1,null))['catch'](handleError(_0x4c0ee1,null));};exports[_0xeb98('0x2d')]=function(_0x24795a,_0x34313a,_0xe37e15){if(_0x24795a[_0xeb98('0x5c')]['id']){delete _0x24795a[_0xeb98('0x5c')]['id'];}var _0x34ba14;return db[_0xeb98('0x3e')]['find']({'where':{'id':_0x24795a[_0xeb98('0x57')]['id']}})[_0xeb98('0x21')](handleEntityNotFound(_0x34313a,null))['then'](function(_0x3d06a9){if(_0x3d06a9){_0x34ba14=_0x3d06a9;return db[_0xeb98('0x86')]['find']({'where':{'id':_0x3d06a9[_0xeb98('0x87')]}});}})[_0xeb98('0x21')](handleEntityNotFound(_0x34313a,null))[_0xeb98('0x21')](function(_0x4d8382){if(_0x4d8382){logger[_0xeb98('0x25')](_0xeb98('0x26'),_0xeb98('0x2d'),_0xeb98('0x88'),_0x4d8382['type'],util['inspect'](_0x24795a['body'],{'showHidden':![],'depth':null}));switch(_0x4d8382[_0xeb98('0x41')]){case _0xeb98('0x89'):if(_0x24795a[_0xeb98('0x5c')][_0xeb98('0x8a')]&&_0x24795a[_0xeb98('0x5c')][_0xeb98('0x8a')]===_0x34ba14[_0xeb98('0x8b')]){return _0x34ba14[_0xeb98('0x5d')]({'read':!![]});}else{logger['error'](_0xeb98('0x8c'),_0xeb98('0x2d'),'twilio',util[_0xeb98('0x8d')](_0x24795a[_0xeb98('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xeb98('0x8e'):if(_0x24795a[_0xeb98('0x5c')]['MessageUUID']&&_0x24795a[_0xeb98('0x5c')][_0xeb98('0x8f')]===_0x34ba14[_0xeb98('0x8b')]&&_[_0xeb98('0x90')]([_0xeb98('0x91'),'delivered'],_0x24795a[_0xeb98('0x5c')]['Status'])>=0x0){return _0x34ba14[_0xeb98('0x5d')]({'read':!![]});}else{logger['error'](_0xeb98('0x8c'),_0xeb98('0x2d'),_0xeb98('0x92'),util['inspect'](_0x24795a[_0xeb98('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xeb98('0x93'):var _0x48d23b=_0x24795a['body'][_0xeb98('0x94')][0x0];if(_0x48d23b[_0xeb98('0x2d')]['groupName']===_0xeb98('0x95')){return _0x34ba14['update']({'read':!![]});}else{logger[_0xeb98('0x28')](_0xeb98('0x8c'),_0xeb98('0x2d'),_0xeb98('0x93'),util[_0xeb98('0x8d')](_0x24795a['body'],{'showHidden':![],'depth':null}));}break;}return _0x34ba14;}})[_0xeb98('0x21')](respondWithResult(_0x34313a,null))['catch'](handleError(_0x34313a,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index cc6120b..a932807 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 _0x123c=['emit','hook','exports','events','../../mysqldb','SmsMessage','save','remove'];(function(_0x2b0a86,_0x2ecebd){var _0x955940=function(_0x1988f8){while(--_0x1988f8){_0x2b0a86['push'](_0x2b0a86['shift']());}};_0x955940(++_0x2ecebd);}(_0x123c,0x1a3));var _0xc123=function(_0x1ca6ea,_0x4f2229){_0x1ca6ea=_0x1ca6ea-0x0;var _0x207d42=_0x123c[_0x1ca6ea];return _0x207d42;};'use strict';var EventEmitter=require(_0xc123('0x0'));var SmsMessage=require(_0xc123('0x1'))['db'][_0xc123('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc123('0x3'),'afterUpdate':'update','afterDestroy':_0xc123('0x4')};function emitEvent(_0x1a863c){return function(_0xa58f2a,_0x3d5d5f,_0x5d7709){SmsMessageEvents[_0xc123('0x5')](_0x1a863c+':'+_0xa58f2a['id'],_0xa58f2a);SmsMessageEvents[_0xc123('0x5')](_0x1a863c,_0xa58f2a);_0x5d7709(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xc123('0x6')](e,emitEvent(event));}}module[_0xc123('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x3c88=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','update'];(function(_0x5826da,_0x4ffb7f){var _0x127236=function(_0x5c2f74){while(--_0x5c2f74){_0x5826da['push'](_0x5826da['shift']());}};_0x127236(++_0x4ffb7f);}(_0x3c88,0x105));var _0x83c8=function(_0x80c919,_0x4bda96){_0x80c919=_0x80c919-0x0;var _0x2c1f72=_0x3c88[_0x80c919];return _0x2c1f72;};'use strict';var EventEmitter=require(_0x83c8('0x0'));var SmsMessage=require(_0x83c8('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x83c8('0x2'),'afterDestroy':_0x83c8('0x3')};function emitEvent(_0x1ac085){return function(_0x32cbde,_0x24f145,_0x392294){SmsMessageEvents['emit'](_0x1ac085+':'+_0x32cbde['id'],_0x32cbde);SmsMessageEvents[_0x83c8('0x4')](_0x1ac085,_0x32cbde);_0x392294(null);};}for(var e in events){if(events[_0x83c8('0x5')](e)){var event=events[e];SmsMessage[_0x83c8('0x6')](e,emitEvent(event));}}module[_0x83c8('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 1c177c3..b1ede98 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 _0x333f=['messages','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','body','smsMethod','sender','login?username=','username','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','senderString','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','keys','sort','createHash','md5','signature=','/external/get/send.php?','clickatell','apiKey','UTF-8','Missing\x20parameters:\x20apiKey','bandwidth','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','isNil','SmsInteractionId','SmsInteraction','findOne','update','catch','error','SmsAccount','find','SmsAccountId','then','type','twilio','authToken','phone','accountSid'];(function(_0x4b6a16,_0x19a660){var _0xa87539=function(_0x1937f4){while(--_0x1937f4){_0x4b6a16['push'](_0x4b6a16['shift']());}};_0xa87539(++_0x19a660);}(_0x333f,0xd7));var _0xf333=function(_0x58f811,_0x327a18){_0x58f811=_0x58f811-0x0;var _0x286f14=_0x333f[_0x58f811];return _0x286f14;};'use strict';var _=require('lodash');var util=require(_0xf333('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf333('0x1'));var BPromise=require(_0xf333('0x2'));var rp=require(_0xf333('0x3'));var fs=require('fs');var path=require(_0xf333('0x4'));var rimraf=require(_0xf333('0x5'));var config=require(_0xf333('0x6'));var attributes=require('./smsMessage.attributes');module[_0xf333('0x7')]=function(_0x3c6b48,_0xc51b71){return _0x3c6b48['define'](_0xf333('0x8'),attributes,{'tableName':_0xf333('0x9'),'paranoid':![],'indexes':[{'name':_0xf333('0xa'),'fields':[_0xf333('0xa')]},{'name':_0xf333('0xb'),'fields':['body'],'type':_0xf333('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x8eb303,_0x4d1f5c,_0xd2c791){var _0x48891b=_0x3c6b48[_0xf333('0xd')];var _0x4460b8=_0x8eb303['get']({'plain':!![]});if(_0x4460b8[_0xf333('0xe')][_0xf333('0xf')]()==='in'||_0x4460b8[_0xf333('0xe')][_0xf333('0xf')]()===_0xf333('0x10')&&!_0x4460b8[_0xf333('0x11')]&&!_['isNil'](_0x4460b8[_0xf333('0x12')])&&!_[_0xf333('0x13')](_0x4460b8[_0xf333('0x14')])){_0x48891b[_0xf333('0x15')][_0xf333('0x16')]({'where':{'id':_0x4460b8['SmsInteractionId']}})['then'](function(_0x3499e0){if(_0x3499e0){_0x3499e0[_0xf333('0x17')]({'lastMsgAt':_0x4460b8['createdAt'],'lastMsgDirection':_0x4460b8[_0xf333('0xe')][_0xf333('0xf')]()});}})[_0xf333('0x18')](function(_0x40346b){console[_0xf333('0x19')](_0x40346b);});}if(_0x4460b8[_0xf333('0xe')]===_0xf333('0x10')&&!_0x4460b8['secret']){var _0xd3b60c;_0x48891b[_0xf333('0x1a')][_0xf333('0x1b')]({'where':{'id':_0x4460b8[_0xf333('0x1c')]},'raw':!![]})[_0xf333('0x1d')](function(_0x4cb02e){_0xd3b60c=_0x4cb02e;if(_0xd3b60c&&_0xd3b60c['type']){switch(_0xd3b60c[_0xf333('0x1e')]){case'twilio':var _0x13b787=require(_0xf333('0x1f'));if(_0xd3b60c['accountSid']&&_0xd3b60c[_0xf333('0x20')]&&_0xd3b60c[_0xf333('0x21')]){var _0x45f223=new _0x13b787(_0xd3b60c[_0xf333('0x22')],_0xd3b60c[_0xf333('0x20')]);_0x45f223[_0xf333('0x23')][_0xf333('0x24')]({'body':_0x4460b8['body'],'to':_0x4460b8[_0xf333('0x21')],'from':_0xd3b60c[_0xf333('0x21')],'statusCallback':_0xd3b60c[_0xf333('0x25')]+_0xf333('0x26')+_0x4460b8['id']+_0xf333('0x27')+_0xd3b60c[_0xf333('0x28')]})[_0xf333('0x1d')](function(_0x29f9c6){if(_0x29f9c6[_0xf333('0x29')]){return _0x8eb303[_0xf333('0x17')]({'messageId':_0x29f9c6[_0xf333('0x29')]});}})['catch'](function(_0x819f88){logger[_0xf333('0x19')](_0xf333('0x2a'),_0xf333('0x2b'),_0xf333('0x1f'),util['inspect'](_0x819f88,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf333('0x2b'),'twilio',_0xf333('0x2c'));}break;case _0xf333('0x2d'):var _0x454681=_0xf333('0x2e');if(_0xd3b60c['username']&&_0xd3b60c[_0xf333('0x2f')]){var _0x59ac5e={'recipient':[_0x4460b8[_0xf333('0x21')]],'message':_0x4460b8[_0xf333('0x30')],'message_type':_0xd3b60c[_0xf333('0x31')]};if(_0xd3b60c['smsMethod']&&_0xd3b60c[_0xf333('0x31')]!=='SI'){_0x59ac5e[_0xf333('0x32')]=_0xd3b60c[_0xf333('0x21')];}var _0x952136={'url':_0x454681+_0xf333('0x33')+_0xd3b60c[_0xf333('0x34')]+_0xf333('0x35')+_0xd3b60c[_0xf333('0x2f')],'method':_0xf333('0x36')};rp(_0x952136)[_0xf333('0x1d')](function(_0x10565c){var _0x4c6d70=_0x10565c[_0xf333('0x37')](';');var _0x3109d1={'user_key':_0x4c6d70[0x0],'session_key':_0x4c6d70[0x1]};_0x952136={'url':_0x454681+_0xf333('0x38'),'method':_0xf333('0x39'),'headers':{'user_key':_0x3109d1[_0xf333('0x3a')],'Session_key':_0x3109d1[_0xf333('0x3b')]},'json':!![],'body':_0x59ac5e};return rp(_0x952136);})[_0xf333('0x1d')](function(_0x590dd9){if(_0x590dd9[_0xf333('0x3c')]>=0x1){var _0x509b54={'messageId':_0x590dd9[_0xf333('0x3d')]};if(_0xd3b60c[_0xf333('0x31')]!=='GP'||!_0xd3b60c[_0xf333('0x3e')]){_0x509b54[_0xf333('0x3f')]=!![];}return _0x8eb303[_0xf333('0x17')](_0x509b54);}else{return logger[_0xf333('0x19')](_0xf333('0x2a'),_0xf333('0x2b'),_0xf333('0x2d'),util['inspect'](_0x590dd9,{'showHidden':![],'depth':null}));}})[_0xf333('0x18')](function(_0x5dbb3b){return logger[_0xf333('0x19')](_0xf333('0x2a'),_0xf333('0x2b'),'skebby',util[_0xf333('0x40')](_0x5dbb3b,{'showHidden':![],'depth':null}));});}else{logger[_0xf333('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf333('0x2b'),_0xf333('0x2d'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xf333('0x41'):if(_0xd3b60c[_0xf333('0x20')]){var _0x197b49={'recipient':_0x4460b8['phone'],'message':_0x4460b8['body'],'sender':_0xd3b60c['senderString']||_0xd3b60c[_0xf333('0x21')],'authorization':_0xd3b60c[_0xf333('0x20')]};var _0x4d1f5c={'method':_0xf333('0x39'),'uri':_0xf333('0x42'),'body':_0x197b49,'json':!![]};rp(_0x4d1f5c)[_0xf333('0x1d')](function(_0x58de4e){var _0x5484c6={'messageId':_0x58de4e[_0xf333('0x43')]};if(!_0xd3b60c['deliveryReport']){_0x5484c6[_0xf333('0x3f')]=!![];}return _0x8eb303['update'](_0x5484c6);})[_0xf333('0x18')](function(_0x29fbb4){logger[_0xf333('0x19')](_0xf333('0x2a'),'afterCreate',_0xf333('0x41'),util[_0xf333('0x40')](_0x29fbb4,{'showHidden':![],'depth':null}));});}else{logger[_0xf333('0x19')](_0xf333('0x2a'),'afterCreate','connectel',_0xf333('0x44'));}break;case'clicksend':if(_0xd3b60c[_0xf333('0x34')]&&_0xd3b60c[_0xf333('0x2f')]){var _0x197b49={'messages':[{'source':_0xf333('0x45'),'to':_0x4460b8['phone'],'body':_0x4460b8['body'],'from':_0xd3b60c['senderString']||_0xd3b60c['phone']}]};var _0xb81815=util[_0xf333('0x46')](_0xf333('0x47'),_0xd3b60c[_0xf333('0x34')],_0xd3b60c[_0xf333('0x2f')]);var _0x4d1f5c={'method':'POST','uri':_0xf333('0x48'),'body':_0x197b49,'headers':{'Authorization':util[_0xf333('0x46')](_0xf333('0x49'),new Buffer(_0xb81815)[_0xf333('0x4a')](_0xf333('0x4b')))},'json':!![]};rp(_0x4d1f5c)[_0xf333('0x1d')](function(_0xce4915){if(_0xce4915['http_code']>=0xc8&&_0xce4915['http_code']<=0xce){if(_0xce4915[_0xf333('0x4c')]&&_0xce4915[_0xf333('0x4c')][_0xf333('0x4d')]>0x0){var _0xd41299=_[_0xf333('0x4e')](_0xce4915[_0xf333('0x4c')][_0xf333('0x23')]);var _0x2476b5={'messageId':_0xd41299[_0xf333('0x4f')]};if(!_0xd3b60c[_0xf333('0x3e')]){_0x2476b5['read']=!![];}return _0x8eb303[_0xf333('0x17')](_0x2476b5);}else{logger[_0xf333('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf333('0x50'),util['inspect'](_0xce4915,{'showHidden':![],'depth':null}));}}else{logger[_0xf333('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',util['inspect'](_0xce4915,{'showHidden':![],'depth':null}));}})[_0xf333('0x18')](function(_0x5573ca){logger[_0xf333('0x19')](_0xf333('0x2a'),_0xf333('0x2b'),_0xf333('0x50'),util[_0xf333('0x40')](_0x5573ca,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf333('0x2a'),_0xf333('0x2b'),_0xf333('0x50'),_0xf333('0x51'));}break;case _0xf333('0x52'):if(_0xd3b60c[_0xf333('0x53')]&&_0xd3b60c[_0xf333('0x20')]){var _0x197b49={'dst':_0x4460b8[_0xf333('0x21')],'text':_0x4460b8[_0xf333('0x30')],'src':_0xd3b60c[_0xf333('0x54')]||_0xd3b60c[_0xf333('0x21')],'url':_0xd3b60c[_0xf333('0x25')]+'/api/sms/messages/'+_0x4460b8['id']+_0xf333('0x27')+_0xd3b60c[_0xf333('0x28')]};var _0xb81815=util[_0xf333('0x46')](_0xf333('0x47'),_0xd3b60c[_0xf333('0x53')],_0xd3b60c[_0xf333('0x20')]);var _0x4d1f5c={'method':_0xf333('0x39'),'uri':util[_0xf333('0x46')](_0xf333('0x55'),_0xd3b60c[_0xf333('0x53')]),'body':_0x197b49,'headers':{'Authorization':util[_0xf333('0x46')](_0xf333('0x49'),new Buffer(_0xb81815)['toString'](_0xf333('0x4b')))},'json':!![]};rp(_0x4d1f5c)[_0xf333('0x1d')](function(_0x4a66eb){var _0x27d62b={'messageId':_0x4a66eb[_0xf333('0x56')][0x0]};return _0x8eb303[_0xf333('0x17')](_0x27d62b);})['catch'](function(_0x329497){logger[_0xf333('0x19')](_0xf333('0x2a'),_0xf333('0x2b'),_0xf333('0x52'),util['inspect'](_0x329497,{'showHidden':![],'depth':null}));});}else{logger[_0xf333('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf333('0x52'),_0xf333('0x57'));}break;case _0xf333('0x58'):if(_0xd3b60c[_0xf333('0x34')]&&_0xd3b60c[_0xf333('0x2f')]){if(_0xd3b60c[_0xf333('0x59')]){var _0x544172={'method':'POST','uri':_0xd3b60c[_0xf333('0x59')]+_0xf333('0x5a'),'body':{'username':_0xd3b60c[_0xf333('0x34')],'password':_0xd3b60c['password']},'json':!![]};return rp(_0x544172)[_0xf333('0x1d')](function(_0x5d46b6){var _0x54baed={'method':_0xf333('0x39'),'uri':_0xd3b60c['baseUrl']+_0xf333('0x5b'),'body':{'messages':[{'from':_0xd3b60c[_0xf333('0x21')],'destinations':[{'to':_0x4460b8[_0xf333('0x21')]}],'text':_0x4460b8[_0xf333('0x30')],'notifyUrl':_0xd3b60c[_0xf333('0x25')]+_0xf333('0x26')+_0x4460b8['id']+'/status?token='+_0xd3b60c['token'],'notifyContentType':_0xf333('0x5c'),'callbackData':_0xd3b60c[_0xf333('0x21')]+';'+_0x4460b8[_0xf333('0x30')]}]},'headers':{'Authorization':_0xf333('0x5d')+_0x5d46b6[_0xf333('0x28')]},'json':!![]};return rp(_0x54baed)[_0xf333('0x1d')](function(_0x155562){if(_0x155562[_0xf333('0x23')]){var _0x47c477={'messageId':_0x155562[_0xf333('0x23')][0x0]['messageId']};if(!_0xd3b60c[_0xf333('0x3e')]){_0x47c477[_0xf333('0x3f')]=!![];}return _0x8eb303[_0xf333('0x17')](_0x47c477);}else{return logger['error'](_0xf333('0x2a'),_0xf333('0x2b'),_0xf333('0x58'),util[_0xf333('0x40')](_0x155562,{'showHidden':![],'depth':null}));}});})[_0xf333('0x18')](function(_0x15888d){return logger[_0xf333('0x19')](_0xf333('0x2a'),'afterCreate',_0xf333('0x58'),util[_0xf333('0x40')](_0x15888d,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf333('0x2b'),_0xf333('0x58'),_0xf333('0x5e'));}}else{logger[_0xf333('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf333('0x2b'),_0xf333('0x58'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xf333('0x5f'):var _0x2a2281=require(_0xf333('0x60'));if(_0xd3b60c['apiKey']){var _0x2a9a9c={};_0x2a9a9c[_0xf333('0x61')]=_0xd3b60c[_0xf333('0x34')];_0x2a9a9c[_0xf333('0x21')]=_0x4460b8[_0xf333('0x21')];_0x2a9a9c['sender']=_0xd3b60c[_0xf333('0x21')];_0x2a9a9c[_0xf333('0x62')]=_0x4460b8[_0xf333('0x30')];_0x2a9a9c[_0xf333('0x63')]=+new Date();var _0x4f0d7f='';var _0x455894='';var _0x13b563=Object[_0xf333('0x64')](_0x2a9a9c);_0x13b563[_0xf333('0x65')]();for(var _0x35d23e=0x0;_0x35d23e<_0x13b563['length'];_0x35d23e++){if(_0x4f0d7f!=''){_0x4f0d7f+='&';}_0x4f0d7f+=_0x13b563[_0x35d23e]+'='+encodeURIComponent(_0x2a9a9c[_0x13b563[_0x35d23e]]);_0x455894+=_0x2a9a9c[_0x13b563[_0x35d23e]];}_0x455894+=_0xd3b60c['apiKey'];_0x455894=_0x2a2281[_0xf333('0x66')](_0xf333('0x67'))['update'](_0x455894)['digest']('hex');if(_0x4f0d7f!==''){_0x4f0d7f+='&';}_0x4f0d7f+=_0xf333('0x68')+_0x455894;var _0x952136={'method':_0xf333('0x36'),'uri':_0xd3b60c[_0xf333('0x59')]+_0xf333('0x69')+_0x4f0d7f,'json':!![]};return rp(_0x952136)[_0xf333('0x1d')](function(_0x30e677){var _0x590050=Object[_0xf333('0x64')](_0x30e677);if(_0x30e677[_0x590050[0x0]]['error']&&parseInt(_0x30e677[_0x590050[0x0]][_0xf333('0x19')])===0x0){var _0x232026={'messageId':_0x30e677[_0x590050[0x0]]['id_sms']};if(!_0xd3b60c[_0xf333('0x3e')]){_0x232026[_0xf333('0x3f')]=!![];}return _0x8eb303[_0xf333('0x17')](_0x232026);}else{return logger['error'](_0xf333('0x2a'),_0xf333('0x2b'),_0xf333('0x5f'),util[_0xf333('0x40')](_0x30e677[_0xf333('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x5049ad){return logger[_0xf333('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf333('0x2b'),_0xf333('0x5f'),util['inspect'](_0x5049ad,{'showHidden':![],'depth':null}));});}else{logger[_0xf333('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf333('0x2b'),_0xf333('0x5f'),'Missing\x20parameters:\x20apiKey');}break;case _0xf333('0x6a'):if(_0xd3b60c['apiKey']){var _0x39dc99={'method':_0xf333('0x39'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0xd3b60c[_0xf333('0x6b')]},'body':{'content':_0x4460b8[_0xf333('0x30')],'to':[_0x4460b8[_0xf333('0x21')]],'from':_0xd3b60c['phone'],'binary':![],'clientMessageId':'uuid','charset':_0xf333('0x6c')},'json':!![]};rp(_0x39dc99)[_0xf333('0x1d')](function(_0x57f4ba){if(!_0x57f4ba[_0xf333('0x19')]){var _0x5a5bc9={'messageId':_0x57f4ba[_0xf333('0x23')][0x0]['apiMessageId']};if(!_0xd3b60c[_0xf333('0x3e')]){_0x5a5bc9['read']=!![];}return _0x8eb303[_0xf333('0x17')](_0x5a5bc9);}else{return logger[_0xf333('0x19')](_0xf333('0x2a'),_0xf333('0x2b'),'clickatell',util[_0xf333('0x40')](_0x57f4ba['error'],{'showHidden':![],'depth':null}));}})[_0xf333('0x18')](function(_0x56fb62){return logger[_0xf333('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf333('0x6a'),util[_0xf333('0x40')](_0x56fb62,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf333('0x2a'),_0xf333('0x2b'),_0xf333('0x6a'),_0xf333('0x6d'));}break;case _0xf333('0x6e'):if(_0xd3b60c[_0xf333('0x34')]&&_0xd3b60c[_0xf333('0x2f')]){var _0xb81815=util[_0xf333('0x46')](_0xf333('0x47'),_0xd3b60c[_0xf333('0x34')],_0xd3b60c[_0xf333('0x2f')]);var _0x4d1f5c={'method':'POST','uri':'https://messaging.bandwidth.com/api/v2/users/'+_0xd3b60c[_0xf333('0x6f')]+_0xf333('0x70'),'body':{'to':[_0x4460b8[_0xf333('0x21')]],'text':_0x4460b8[_0xf333('0x30')],'from':_0xd3b60c['phone'],'applicationId':_0xd3b60c[_0xf333('0x71')]},'headers':{'Authorization':util[_0xf333('0x46')]('Basic\x20%s',new Buffer(_0xb81815)[_0xf333('0x4a')]('base64'))},'json':!![]};rp(_0x4d1f5c)['then'](function(_0x4761f1){if(_0x4761f1['id']){var _0x233b72={'messageId':_0x4761f1['id']};return _0x8eb303['update'](_0x233b72);}else{logger[_0xf333('0x19')](_0xf333('0x2a'),_0xf333('0x2b'),'bandwidth',util[_0xf333('0x40')](_0x4761f1,{'showHidden':![],'depth':null}));}})[_0xf333('0x18')](function(_0x56baa7){logger[_0xf333('0x19')](_0xf333('0x2a'),_0xf333('0x2b'),_0xf333('0x6e'),util[_0xf333('0x40')](_0x56baa7,{'showHidden':![],'depth':null}));});}else{logger[_0xf333('0x19')](_0xf333('0x2a'),_0xf333('0x2b'),_0xf333('0x6e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xf333('0x72'):if(_0xd3b60c[_0xf333('0x6b')]){var _0x2f6628={};var _0x952136={'method':_0xf333('0x39'),'uri':_0xf333('0x73'),'headers':{'Authorization':_0xf333('0x74')+_0xd3b60c['apiKey'],'Content-Type':_0xf333('0x5c')},'body':{'from':_0xd3b60c[_0xf333('0x21')],'to':_0x4460b8[_0xf333('0x21')],'text':_0x4460b8[_0xf333('0x30')]},'json':!![]};return rp(_0x952136)[_0xf333('0x1d')](function(_0xf8c0b3){if(_0xf8c0b3[_0xf333('0x75')]==0xca){_0x2f6628[_0xf333('0x76')]=_0xf8c0b3;var _0x3707ac={'method':_0xf333('0x39'),'uri':_0xf333('0x77'),'headers':{'Authorization':_0xf333('0x74')+_0xd3b60c[_0xf333('0x6b')],'Content-Type':_0xf333('0x5c')},'body':{'refid':_0x2f6628[_0xf333('0x76')][_0xf333('0x78')]},'json':!![]};return rp(_0x3707ac)[_0xf333('0x1d')](function(_0x3e3909){_0x2f6628[_0xf333('0x79')]=_0x3e3909;var _0x559200={'messageId':_0x2f6628['message'][_0xf333('0x78')],'read':!![]};return _0x8eb303[_0xf333('0x17')](_0x559200);});}else{return logger[_0xf333('0x19')](_0xf333('0x2a'),_0xf333('0x2b'),_0xf333('0x72'),util[_0xf333('0x40')](_0xf8c0b3,{'showHidden':![],'depth':null}));}})[_0xf333('0x18')](function(_0x5ec298){return logger[_0xf333('0x19')](_0xf333('0x2a'),'afterCreate',_0xf333('0x72'),util[_0xf333('0x40')](_0x5ec298,{'showHidden':![],'depth':null}));});}else{return logger[_0xf333('0x19')](_0xf333('0x2a'),_0xf333('0x2b'),_0xf333('0x72'),'Token\x20not\x20received');}break;}}})[_0xf333('0x7a')](function(){_0xd2c791();});}else{_0xd2c791();}}},'charset':_0xf333('0x7b'),'collate':_0xf333('0x7c')});}; \ No newline at end of file +var _0x58e7=['SmsInteraction','findOne','then','update','catch','secret','SmsAccount','type','twilio','accountSid','authToken','messages','create','phone','remote','/api/sms/messages/','sid','afterCreate','inspect','error','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','GET','split','sms','POST','user_key','session_key','total_sent','deliveryReport','read','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','data','queued_count','head','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','/status?token=','token','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','crypto','apiKey','login','sender','text','timestamp','sort','length','createHash','md5','digest','signature=','/external/get/send.php?','keys','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','clickatell','bandwidth','accountId','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','SmsInteractionId'];(function(_0x348050,_0x3bb779){var _0x128f8b=function(_0x12be70){while(--_0x12be70){_0x348050['push'](_0x348050['shift']());}};_0x128f8b(++_0x3bb779);}(_0x58e7,0x65));var _0x758e=function(_0x575414,_0x2d4759){_0x575414=_0x575414-0x0;var _0x251f38=_0x58e7[_0x575414];return _0x251f38;};'use strict';var _=require(_0x758e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x758e('0x1'));var moment=require(_0x758e('0x2'));var BPromise=require(_0x758e('0x3'));var rp=require(_0x758e('0x4'));var fs=require('fs');var path=require(_0x758e('0x5'));var rimraf=require(_0x758e('0x6'));var config=require(_0x758e('0x7'));var attributes=require(_0x758e('0x8'));module[_0x758e('0x9')]=function(_0x3cb890,_0x1a07ed){return _0x3cb890[_0x758e('0xa')](_0x758e('0xb'),attributes,{'tableName':_0x758e('0xc'),'paranoid':![],'indexes':[{'name':_0x758e('0xd'),'fields':[_0x758e('0xd')]},{'name':_0x758e('0xe'),'fields':[_0x758e('0xf')],'type':_0x758e('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4423a4,_0x22f785,_0x30e39c){var _0x248594=_0x3cb890['models'];var _0x37b6a4=_0x4423a4[_0x758e('0x11')]({'plain':!![]});if(_0x37b6a4[_0x758e('0x12')][_0x758e('0x13')]()==='in'||_0x37b6a4[_0x758e('0x12')][_0x758e('0x13')]()===_0x758e('0x14')&&!_0x37b6a4['secret']&&!_[_0x758e('0x15')](_0x37b6a4[_0x758e('0x16')])&&!_[_0x758e('0x15')](_0x37b6a4[_0x758e('0x17')])){_0x248594[_0x758e('0x18')][_0x758e('0x19')]({'where':{'id':_0x37b6a4[_0x758e('0x17')]}})[_0x758e('0x1a')](function(_0x476c30){if(_0x476c30){_0x476c30[_0x758e('0x1b')]({'lastMsgAt':_0x37b6a4['createdAt'],'lastMsgDirection':_0x37b6a4[_0x758e('0x12')][_0x758e('0x13')]()});}})[_0x758e('0x1c')](function(_0x3e04a8){console['error'](_0x3e04a8);});}if(_0x37b6a4[_0x758e('0x12')]===_0x758e('0x14')&&!_0x37b6a4[_0x758e('0x1d')]){var _0x1e6dbf;_0x248594[_0x758e('0x1e')]['find']({'where':{'id':_0x37b6a4['SmsAccountId']},'raw':!![]})['then'](function(_0x1edebb){_0x1e6dbf=_0x1edebb;if(_0x1e6dbf&&_0x1e6dbf[_0x758e('0x1f')]){switch(_0x1e6dbf[_0x758e('0x1f')]){case _0x758e('0x20'):var _0x272858=require(_0x758e('0x20'));if(_0x1e6dbf[_0x758e('0x21')]&&_0x1e6dbf[_0x758e('0x22')]&&_0x1e6dbf['phone']){var _0x38cd6a=new _0x272858(_0x1e6dbf[_0x758e('0x21')],_0x1e6dbf['authToken']);_0x38cd6a[_0x758e('0x23')][_0x758e('0x24')]({'body':_0x37b6a4['body'],'to':_0x37b6a4[_0x758e('0x25')],'from':_0x1e6dbf[_0x758e('0x25')],'statusCallback':_0x1e6dbf[_0x758e('0x26')]+_0x758e('0x27')+_0x37b6a4['id']+'/status?token='+_0x1e6dbf['token']})[_0x758e('0x1a')](function(_0x594d6e){if(_0x594d6e['sid']){return _0x4423a4[_0x758e('0x1b')]({'messageId':_0x594d6e[_0x758e('0x28')]});}})[_0x758e('0x1c')](function(_0x32e6c9){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x758e('0x29'),_0x758e('0x20'),util[_0x758e('0x2a')](_0x32e6c9,{'showHidden':![],'depth':null}));});}else{logger[_0x758e('0x2b')](_0x758e('0x2c'),_0x758e('0x29'),_0x758e('0x20'),_0x758e('0x2d'));}break;case _0x758e('0x2e'):var _0x2eb00b=_0x758e('0x2f');if(_0x1e6dbf[_0x758e('0x30')]&&_0x1e6dbf[_0x758e('0x31')]){var _0x534ed6={'recipient':[_0x37b6a4['phone']],'message':_0x37b6a4[_0x758e('0xf')],'message_type':_0x1e6dbf[_0x758e('0x32')]};if(_0x1e6dbf[_0x758e('0x32')]&&_0x1e6dbf[_0x758e('0x32')]!=='SI'){_0x534ed6['sender']=_0x1e6dbf[_0x758e('0x25')];}var _0x3f2440={'url':_0x2eb00b+_0x758e('0x33')+_0x1e6dbf[_0x758e('0x30')]+_0x758e('0x34')+_0x1e6dbf[_0x758e('0x31')],'method':_0x758e('0x35')};rp(_0x3f2440)[_0x758e('0x1a')](function(_0x1c97f6){var _0x36d8e1=_0x1c97f6[_0x758e('0x36')](';');var _0x4bc0d5={'user_key':_0x36d8e1[0x0],'session_key':_0x36d8e1[0x1]};_0x3f2440={'url':_0x2eb00b+_0x758e('0x37'),'method':_0x758e('0x38'),'headers':{'user_key':_0x4bc0d5[_0x758e('0x39')],'Session_key':_0x4bc0d5[_0x758e('0x3a')]},'json':!![],'body':_0x534ed6};return rp(_0x3f2440);})['then'](function(_0x363710){if(_0x363710[_0x758e('0x3b')]>=0x1){var _0x49dbe4={'messageId':_0x363710['internal_order_id']};if(_0x1e6dbf[_0x758e('0x32')]!=='GP'||!_0x1e6dbf[_0x758e('0x3c')]){_0x49dbe4[_0x758e('0x3d')]=!![];}return _0x4423a4[_0x758e('0x1b')](_0x49dbe4);}else{return logger[_0x758e('0x2b')](_0x758e('0x2c'),'afterCreate',_0x758e('0x2e'),util['inspect'](_0x363710,{'showHidden':![],'depth':null}));}})['catch'](function(_0x34427d){return logger['error'](_0x758e('0x2c'),_0x758e('0x29'),_0x758e('0x2e'),util[_0x758e('0x2a')](_0x34427d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x758e('0x2c'),_0x758e('0x29'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0x758e('0x3e'):if(_0x1e6dbf[_0x758e('0x22')]){var _0x2509c4={'recipient':_0x37b6a4[_0x758e('0x25')],'message':_0x37b6a4[_0x758e('0xf')],'sender':_0x1e6dbf[_0x758e('0x3f')]||_0x1e6dbf[_0x758e('0x25')],'authorization':_0x1e6dbf[_0x758e('0x22')]};var _0x22f785={'method':_0x758e('0x38'),'uri':_0x758e('0x40'),'body':_0x2509c4,'json':!![]};rp(_0x22f785)[_0x758e('0x1a')](function(_0x17e463){var _0x8b1fc1={'messageId':_0x17e463[_0x758e('0x41')]};if(!_0x1e6dbf[_0x758e('0x3c')]){_0x8b1fc1[_0x758e('0x3d')]=!![];}return _0x4423a4['update'](_0x8b1fc1);})['catch'](function(_0x244f4c){logger[_0x758e('0x2b')](_0x758e('0x2c'),_0x758e('0x29'),'connectel',util[_0x758e('0x2a')](_0x244f4c,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x758e('0x3e'),_0x758e('0x42'));}break;case _0x758e('0x43'):if(_0x1e6dbf[_0x758e('0x30')]&&_0x1e6dbf[_0x758e('0x31')]){var _0x2509c4={'messages':[{'source':_0x758e('0x44'),'to':_0x37b6a4[_0x758e('0x25')],'body':_0x37b6a4[_0x758e('0xf')],'from':_0x1e6dbf[_0x758e('0x3f')]||_0x1e6dbf[_0x758e('0x25')]}]};var _0x432418=util[_0x758e('0x45')](_0x758e('0x46'),_0x1e6dbf[_0x758e('0x30')],_0x1e6dbf[_0x758e('0x31')]);var _0x22f785={'method':_0x758e('0x38'),'uri':_0x758e('0x47'),'body':_0x2509c4,'headers':{'Authorization':util['format'](_0x758e('0x48'),new Buffer(_0x432418)[_0x758e('0x49')]('base64'))},'json':!![]};rp(_0x22f785)[_0x758e('0x1a')](function(_0x378580){if(_0x378580['http_code']>=0xc8&&_0x378580['http_code']<=0xce){if(_0x378580[_0x758e('0x4a')]&&_0x378580[_0x758e('0x4a')][_0x758e('0x4b')]>0x0){var _0x4f21fb=_[_0x758e('0x4c')](_0x378580[_0x758e('0x4a')][_0x758e('0x23')]);var _0x4859ca={'messageId':_0x4f21fb['message_id']};if(!_0x1e6dbf[_0x758e('0x3c')]){_0x4859ca[_0x758e('0x3d')]=!![];}return _0x4423a4[_0x758e('0x1b')](_0x4859ca);}else{logger['error'](_0x758e('0x2c'),_0x758e('0x29'),_0x758e('0x4d'),util[_0x758e('0x2a')](_0x378580,{'showHidden':![],'depth':null}));}}else{logger[_0x758e('0x2b')](_0x758e('0x2c'),_0x758e('0x29'),_0x758e('0x4d'),util['inspect'](_0x378580,{'showHidden':![],'depth':null}));}})[_0x758e('0x1c')](function(_0x101971){logger[_0x758e('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',util[_0x758e('0x2a')](_0x101971,{'showHidden':![],'depth':null}));});}else{logger[_0x758e('0x2b')](_0x758e('0x2c'),_0x758e('0x29'),_0x758e('0x4d'),_0x758e('0x4e'));}break;case _0x758e('0x4f'):if(_0x1e6dbf[_0x758e('0x50')]&&_0x1e6dbf[_0x758e('0x22')]){var _0x2509c4={'dst':_0x37b6a4[_0x758e('0x25')],'text':_0x37b6a4[_0x758e('0xf')],'src':_0x1e6dbf['senderString']||_0x1e6dbf[_0x758e('0x25')],'url':_0x1e6dbf[_0x758e('0x26')]+_0x758e('0x27')+_0x37b6a4['id']+_0x758e('0x51')+_0x1e6dbf[_0x758e('0x52')]};var _0x432418=util[_0x758e('0x45')](_0x758e('0x46'),_0x1e6dbf[_0x758e('0x50')],_0x1e6dbf['authToken']);var _0x22f785={'method':_0x758e('0x38'),'uri':util[_0x758e('0x45')](_0x758e('0x53'),_0x1e6dbf[_0x758e('0x50')]),'body':_0x2509c4,'headers':{'Authorization':util[_0x758e('0x45')](_0x758e('0x48'),new Buffer(_0x432418)[_0x758e('0x49')](_0x758e('0x54')))},'json':!![]};rp(_0x22f785)[_0x758e('0x1a')](function(_0x3fb0bb){var _0x58c063={'messageId':_0x3fb0bb[_0x758e('0x55')][0x0]};return _0x4423a4[_0x758e('0x1b')](_0x58c063);})[_0x758e('0x1c')](function(_0x88dc7b){logger[_0x758e('0x2b')](_0x758e('0x2c'),_0x758e('0x29'),_0x758e('0x4f'),util[_0x758e('0x2a')](_0x88dc7b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x758e('0x2c'),_0x758e('0x29'),_0x758e('0x4f'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x758e('0x56'):if(_0x1e6dbf[_0x758e('0x30')]&&_0x1e6dbf[_0x758e('0x31')]){if(_0x1e6dbf[_0x758e('0x57')]){var _0x175091={'method':'POST','uri':_0x1e6dbf[_0x758e('0x57')]+_0x758e('0x58'),'body':{'username':_0x1e6dbf[_0x758e('0x30')],'password':_0x1e6dbf['password']},'json':!![]};return rp(_0x175091)[_0x758e('0x1a')](function(_0x176ff2){var _0x3853dd={'method':_0x758e('0x38'),'uri':_0x1e6dbf[_0x758e('0x57')]+_0x758e('0x59'),'body':{'messages':[{'from':_0x1e6dbf['phone'],'destinations':[{'to':_0x37b6a4[_0x758e('0x25')]}],'text':_0x37b6a4[_0x758e('0xf')],'notifyUrl':_0x1e6dbf[_0x758e('0x26')]+_0x758e('0x27')+_0x37b6a4['id']+_0x758e('0x51')+_0x1e6dbf[_0x758e('0x52')],'notifyContentType':_0x758e('0x5a'),'callbackData':_0x1e6dbf[_0x758e('0x25')]+';'+_0x37b6a4[_0x758e('0xf')]}]},'headers':{'Authorization':_0x758e('0x5b')+_0x176ff2[_0x758e('0x52')]},'json':!![]};return rp(_0x3853dd)['then'](function(_0x33b240){if(_0x33b240[_0x758e('0x23')]){var _0xa63a41={'messageId':_0x33b240[_0x758e('0x23')][0x0]['messageId']};if(!_0x1e6dbf[_0x758e('0x3c')]){_0xa63a41[_0x758e('0x3d')]=!![];}return _0x4423a4[_0x758e('0x1b')](_0xa63a41);}else{return logger[_0x758e('0x2b')](_0x758e('0x2c'),'afterCreate',_0x758e('0x56'),util[_0x758e('0x2a')](_0x33b240,{'showHidden':![],'depth':null}));}});})[_0x758e('0x1c')](function(_0x2c3ec9){return logger[_0x758e('0x2b')](_0x758e('0x2c'),_0x758e('0x29'),_0x758e('0x56'),util[_0x758e('0x2a')](_0x2c3ec9,{'showHidden':![],'depth':null}));});}else{logger[_0x758e('0x2b')](_0x758e('0x2c'),_0x758e('0x29'),_0x758e('0x56'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x758e('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x758e('0x29'),_0x758e('0x56'),_0x758e('0x4e'));}break;case'csc':var _0x46f292=require(_0x758e('0x5c'));if(_0x1e6dbf[_0x758e('0x5d')]){var _0x3cba76={};_0x3cba76[_0x758e('0x5e')]=_0x1e6dbf['username'];_0x3cba76[_0x758e('0x25')]=_0x37b6a4[_0x758e('0x25')];_0x3cba76[_0x758e('0x5f')]=_0x1e6dbf[_0x758e('0x25')];_0x3cba76[_0x758e('0x60')]=_0x37b6a4[_0x758e('0xf')];_0x3cba76[_0x758e('0x61')]=+new Date();var _0x50bbe0='';var _0x169a68='';var _0x2462af=Object['keys'](_0x3cba76);_0x2462af[_0x758e('0x62')]();for(var _0x377a7f=0x0;_0x377a7f<_0x2462af[_0x758e('0x63')];_0x377a7f++){if(_0x50bbe0!=''){_0x50bbe0+='&';}_0x50bbe0+=_0x2462af[_0x377a7f]+'='+encodeURIComponent(_0x3cba76[_0x2462af[_0x377a7f]]);_0x169a68+=_0x3cba76[_0x2462af[_0x377a7f]];}_0x169a68+=_0x1e6dbf[_0x758e('0x5d')];_0x169a68=_0x46f292[_0x758e('0x64')](_0x758e('0x65'))['update'](_0x169a68)[_0x758e('0x66')]('hex');if(_0x50bbe0!==''){_0x50bbe0+='&';}_0x50bbe0+=_0x758e('0x67')+_0x169a68;var _0x3f2440={'method':_0x758e('0x35'),'uri':_0x1e6dbf[_0x758e('0x57')]+_0x758e('0x68')+_0x50bbe0,'json':!![]};return rp(_0x3f2440)['then'](function(_0x40d30a){var _0x456b6b=Object[_0x758e('0x69')](_0x40d30a);if(_0x40d30a[_0x456b6b[0x0]][_0x758e('0x2b')]&&parseInt(_0x40d30a[_0x456b6b[0x0]][_0x758e('0x2b')])===0x0){var _0x560ce8={'messageId':_0x40d30a[_0x456b6b[0x0]]['id_sms']};if(!_0x1e6dbf['deliveryReport']){_0x560ce8[_0x758e('0x3d')]=!![];}return _0x4423a4[_0x758e('0x1b')](_0x560ce8);}else{return logger[_0x758e('0x2b')](_0x758e('0x2c'),_0x758e('0x29'),'csc',util[_0x758e('0x2a')](_0x40d30a[_0x758e('0x2b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x5a95b8){return logger[_0x758e('0x2b')](_0x758e('0x2c'),'afterCreate','csc',util['inspect'](_0x5a95b8,{'showHidden':![],'depth':null}));});}else{logger[_0x758e('0x2b')](_0x758e('0x2c'),'afterCreate','csc',_0x758e('0x6a'));}break;case'clickatell':if(_0x1e6dbf[_0x758e('0x5d')]){var _0x235e6f={'method':'POST','uri':_0x758e('0x6b'),'headers':{'Authorization':_0x1e6dbf['apiKey']},'body':{'content':_0x37b6a4[_0x758e('0xf')],'to':[_0x37b6a4[_0x758e('0x25')]],'from':_0x1e6dbf['phone'],'binary':![],'clientMessageId':_0x758e('0x6c'),'charset':_0x758e('0x6d')},'json':!![]};rp(_0x235e6f)[_0x758e('0x1a')](function(_0x3c2e28){if(!_0x3c2e28['error']){var _0x5e4dac={'messageId':_0x3c2e28[_0x758e('0x23')][0x0]['apiMessageId']};if(!_0x1e6dbf[_0x758e('0x3c')]){_0x5e4dac[_0x758e('0x3d')]=!![];}return _0x4423a4[_0x758e('0x1b')](_0x5e4dac);}else{return logger['error'](_0x758e('0x2c'),'afterCreate',_0x758e('0x6e'),util[_0x758e('0x2a')](_0x3c2e28[_0x758e('0x2b')],{'showHidden':![],'depth':null}));}})[_0x758e('0x1c')](function(_0x5f112d){return logger[_0x758e('0x2b')](_0x758e('0x2c'),'afterCreate','clickatell',util[_0x758e('0x2a')](_0x5f112d,{'showHidden':![],'depth':null}));});}else{logger[_0x758e('0x2b')](_0x758e('0x2c'),_0x758e('0x29'),_0x758e('0x6e'),_0x758e('0x6a'));}break;case _0x758e('0x6f'):if(_0x1e6dbf[_0x758e('0x30')]&&_0x1e6dbf['password']){var _0x432418=util[_0x758e('0x45')](_0x758e('0x46'),_0x1e6dbf[_0x758e('0x30')],_0x1e6dbf['password']);var _0x22f785={'method':'POST','uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x1e6dbf[_0x758e('0x70')]+_0x758e('0x71'),'body':{'to':[_0x37b6a4[_0x758e('0x25')]],'text':_0x37b6a4[_0x758e('0xf')],'from':_0x1e6dbf[_0x758e('0x25')],'applicationId':_0x1e6dbf[_0x758e('0x72')]},'headers':{'Authorization':util[_0x758e('0x45')](_0x758e('0x48'),new Buffer(_0x432418)[_0x758e('0x49')](_0x758e('0x54')))},'json':!![]};rp(_0x22f785)[_0x758e('0x1a')](function(_0x261ebf){if(_0x261ebf['id']){var _0x57d08b={'messageId':_0x261ebf['id']};return _0x4423a4[_0x758e('0x1b')](_0x57d08b);}else{logger[_0x758e('0x2b')](_0x758e('0x2c'),_0x758e('0x29'),_0x758e('0x6f'),util['inspect'](_0x261ebf,{'showHidden':![],'depth':null}));}})[_0x758e('0x1c')](function(_0x29af7c){logger[_0x758e('0x2b')](_0x758e('0x2c'),'afterCreate',_0x758e('0x6f'),util[_0x758e('0x2a')](_0x29af7c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x758e('0x2c'),'afterCreate',_0x758e('0x6f'),'Missing\x20parameters:\x20username,\x20password');}break;case'intelepeer':if(_0x1e6dbf[_0x758e('0x5d')]){var _0x2bf51a={};var _0x3f2440={'method':_0x758e('0x38'),'uri':_0x758e('0x73'),'headers':{'Authorization':_0x758e('0x74')+_0x1e6dbf[_0x758e('0x5d')],'Content-Type':'application/json'},'body':{'from':_0x1e6dbf['phone'],'to':_0x37b6a4[_0x758e('0x25')],'text':_0x37b6a4[_0x758e('0xf')]},'json':!![]};return rp(_0x3f2440)[_0x758e('0x1a')](function(_0x168236){if(_0x168236[_0x758e('0x75')]==0xca){_0x2bf51a[_0x758e('0x76')]=_0x168236;var _0x2b03c0={'method':_0x758e('0x38'),'uri':_0x758e('0x77'),'headers':{'Authorization':_0x758e('0x74')+_0x1e6dbf[_0x758e('0x5d')],'Content-Type':_0x758e('0x5a')},'body':{'refid':_0x2bf51a[_0x758e('0x76')][_0x758e('0x78')]},'json':!![]};return rp(_0x2b03c0)[_0x758e('0x1a')](function(_0x1bb55a){_0x2bf51a[_0x758e('0x79')]=_0x1bb55a;var _0xad806b={'messageId':_0x2bf51a[_0x758e('0x76')][_0x758e('0x78')],'read':!![]};return _0x4423a4[_0x758e('0x1b')](_0xad806b);});}else{return logger[_0x758e('0x2b')](_0x758e('0x2c'),'afterCreate',_0x758e('0x7a'),util[_0x758e('0x2a')](_0x168236,{'showHidden':![],'depth':null}));}})[_0x758e('0x1c')](function(_0x1012e9){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x758e('0x29'),'intelepeer',util[_0x758e('0x2a')](_0x1012e9,{'showHidden':![],'depth':null}));});}else{return logger[_0x758e('0x2b')](_0x758e('0x2c'),'afterCreate',_0x758e('0x7a'),_0x758e('0x7b'));}break;}}})[_0x758e('0x7c')](function(){_0x30e39c();});}else{_0x30e39c();}}},'charset':'utf8mb4','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 4d51612..8b165fb 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 _0xc607=['error','code','SmsMessage,\x20%s,\x20%s','message','info','result','create','options','raw','CreateSmsMessage','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','register','then','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0xc607,0xdd));var _0x7c60=function(_0x19562e,_0x4b1a2e){_0x19562e=_0x19562e-0x0;var _0x1492d3=_0xc607[_0x19562e];return _0x1492d3;};'use strict';var _=require(_0x7c60('0x0'));var util=require(_0x7c60('0x1'));var moment=require(_0x7c60('0x2'));var BPromise=require(_0x7c60('0x3'));var rs=require(_0x7c60('0x4'));var fs=require('fs');var Redis=require(_0x7c60('0x5'));var db=require(_0x7c60('0x6'))['db'];var utils=require(_0x7c60('0x7'));var logger=require(_0x7c60('0x8'))(_0x7c60('0x9'));var config=require(_0x7c60('0xa'));var jayson=require(_0x7c60('0xb'));var client=jayson[_0x7c60('0xc')][_0x7c60('0xd')]({'port':0x232a});config[_0x7c60('0xe')]=_['defaults'](config[_0x7c60('0xe')],{'host':_0x7c60('0xf'),'port':0x18eb});var socket=require(_0x7c60('0x10'))(new Redis(config[_0x7c60('0xe')]));require(_0x7c60('0x11'))[_0x7c60('0x12')](socket);function respondWithRpcPromise(_0xc46ed8,_0x48b1ad,_0x12672f){return new BPromise(function(_0x342e92,_0x3752b2){return client['request'](_0xc46ed8,_0x12672f)[_0x7c60('0x13')](function(_0x2ce110){logger['info']('SmsMessage,\x20%s,\x20%s',_0x48b1ad,_0x7c60('0x14'));logger[_0x7c60('0x15')](_0x7c60('0x16'),_0x48b1ad,_0x7c60('0x14'),JSON[_0x7c60('0x17')](_0x2ce110));if(_0x2ce110[_0x7c60('0x18')]){if(_0x2ce110['error'][_0x7c60('0x19')]===0x1f4){logger[_0x7c60('0x18')](_0x7c60('0x1a'),_0x48b1ad,_0x2ce110['error'][_0x7c60('0x1b')]);return _0x3752b2(_0x2ce110[_0x7c60('0x18')][_0x7c60('0x1b')]);}logger[_0x7c60('0x18')](_0x7c60('0x1a'),_0x48b1ad,_0x2ce110[_0x7c60('0x18')][_0x7c60('0x1b')]);return _0x342e92(_0x2ce110[_0x7c60('0x18')]['message']);}else{logger[_0x7c60('0x1c')](_0x7c60('0x1a'),_0x48b1ad,_0x7c60('0x14'));_0x342e92(_0x2ce110[_0x7c60('0x1d')][_0x7c60('0x1b')]);}})['catch'](function(_0x15791f){logger[_0x7c60('0x18')](_0x7c60('0x1a'),_0x48b1ad,_0x15791f);_0x3752b2(_0x15791f);});});}exports['CreateSmsMessage']=function(_0x1bdd4e){var _0x3cace2=this;return new Promise(function(_0x1fb49b,_0x1834f2){return db['SmsMessage'][_0x7c60('0x1e')](_0x1bdd4e['body'],{'raw':_0x1bdd4e[_0x7c60('0x1f')]?_0x1bdd4e[_0x7c60('0x1f')][_0x7c60('0x20')]===undefined?!![]:![]:!![]})[_0x7c60('0x13')](function(_0xdd1935){logger['info']('CreateSmsMessage',_0x1bdd4e);logger[_0x7c60('0x15')](_0x7c60('0x21'),_0x1bdd4e,JSON[_0x7c60('0x17')](_0xdd1935));_0x1fb49b(_0xdd1935);})[_0x7c60('0x22')](function(_0x44e06d){logger[_0x7c60('0x18')](_0x7c60('0x21'),_0x44e06d[_0x7c60('0x1b')],_0x1bdd4e);_0x1834f2(_0x3cace2[_0x7c60('0x18')](0x1f4,_0x44e06d[_0x7c60('0x1b')]));});});}; \ No newline at end of file +var _0x4cd7=['body','options','raw','then','CreateSmsMessage','util','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','catch','SmsMessage','create'];(function(_0x24e771,_0x4a5d49){var _0x53dce2=function(_0x1df5a8){while(--_0x1df5a8){_0x24e771['push'](_0x24e771['shift']());}};_0x53dce2(++_0x4a5d49);}(_0x4cd7,0xad));var _0x74cd=function(_0x5140c8,_0x59cc59){_0x5140c8=_0x5140c8-0x0;var _0xc1ad08=_0x4cd7[_0x5140c8];return _0xc1ad08;};'use strict';var _=require('lodash');var util=require(_0x74cd('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x74cd('0x1'));var fs=require('fs');var Redis=require(_0x74cd('0x2'));var db=require(_0x74cd('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x74cd('0x4'));var jayson=require(_0x74cd('0x5'));var client=jayson[_0x74cd('0x6')][_0x74cd('0x7')]({'port':0x232a});config[_0x74cd('0x8')]=_[_0x74cd('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x74cd('0xa'))(new Redis(config['redis']));require('./smsMessage.socket')[_0x74cd('0xb')](socket);function respondWithRpcPromise(_0x475d29,_0x10af0e,_0x822883){return new BPromise(function(_0x5872cb,_0x563179){return client['request'](_0x475d29,_0x822883)['then'](function(_0x172a0d){logger[_0x74cd('0xc')]('SmsMessage,\x20%s,\x20%s',_0x10af0e,_0x74cd('0xd'));logger['debug'](_0x74cd('0xe'),_0x10af0e,_0x74cd('0xd'),JSON[_0x74cd('0xf')](_0x172a0d));if(_0x172a0d[_0x74cd('0x10')]){if(_0x172a0d[_0x74cd('0x10')][_0x74cd('0x11')]===0x1f4){logger['error'](_0x74cd('0x12'),_0x10af0e,_0x172a0d[_0x74cd('0x10')][_0x74cd('0x13')]);return _0x563179(_0x172a0d[_0x74cd('0x10')][_0x74cd('0x13')]);}logger[_0x74cd('0x10')](_0x74cd('0x12'),_0x10af0e,_0x172a0d[_0x74cd('0x10')][_0x74cd('0x13')]);return _0x5872cb(_0x172a0d[_0x74cd('0x10')]['message']);}else{logger[_0x74cd('0xc')](_0x74cd('0x12'),_0x10af0e,_0x74cd('0xd'));_0x5872cb(_0x172a0d['result'][_0x74cd('0x13')]);}})[_0x74cd('0x14')](function(_0x224fda){logger[_0x74cd('0x10')]('SmsMessage,\x20%s,\x20%s',_0x10af0e,_0x224fda);_0x563179(_0x224fda);});});}exports['CreateSmsMessage']=function(_0x568868){var _0x507aa5=this;return new Promise(function(_0x7276ed,_0x32a969){return db[_0x74cd('0x15')][_0x74cd('0x16')](_0x568868[_0x74cd('0x17')],{'raw':_0x568868[_0x74cd('0x18')]?_0x568868[_0x74cd('0x18')][_0x74cd('0x19')]===undefined?!![]:![]:!![]})[_0x74cd('0x1a')](function(_0x2bff7f){logger[_0x74cd('0xc')](_0x74cd('0x1b'),_0x568868);logger['debug']('CreateSmsMessage',_0x568868,JSON[_0x74cd('0xf')](_0x2bff7f));_0x7276ed(_0x2bff7f);})[_0x74cd('0x14')](function(_0x3a198c){logger[_0x74cd('0x10')](_0x74cd('0x1b'),_0x3a198c[_0x74cd('0x13')],_0x568868);_0x32a969(_0x507aa5[_0x74cd('0x10')](0x1f4,_0x3a198c[_0x74cd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index a3b8875..f72b256 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 _0xf2d0=['update','emit','removeListener','register','length','smsMessage:','remove'];(function(_0x4ac424,_0x554b5d){var _0xe1b890=function(_0x5e85c4){while(--_0x5e85c4){_0x4ac424['push'](_0x4ac424['shift']());}};_0xe1b890(++_0x554b5d);}(_0xf2d0,0x109));var _0x0f2d=function(_0x2f870f,_0x46de86){_0x2f870f=_0x2f870f-0x0;var _0x436c61=_0xf2d0[_0x2f870f];return _0x436c61;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save',_0x0f2d('0x0'),_0x0f2d('0x1')];function createListener(_0x3c9ffe,_0x6cd27b){return function(_0x18c298){_0x6cd27b[_0x0f2d('0x2')](_0x3c9ffe,_0x18c298);};}function removeListener(_0x3c7fa7,_0x4e57a4){return function(){SmsMessageEvents[_0x0f2d('0x3')](_0x3c7fa7,_0x4e57a4);};}exports[_0x0f2d('0x4')]=function(_0x4574e7){for(var _0x40980f=0x0,_0x2fd774=events[_0x0f2d('0x5')];_0x40980f<_0x2fd774;_0x40980f++){var _0x38e0dc=events[_0x40980f];var _0x11085c=createListener(_0x0f2d('0x6')+_0x38e0dc,_0x4574e7);SmsMessageEvents['on'](_0x38e0dc,_0x11085c);}}; \ No newline at end of file +var _0x5320=['emit','removeListener','register','length','./smsMessage.events','save','remove','update'];(function(_0x4c8ac7,_0x12934b){var _0x4d0f56=function(_0x433058){while(--_0x433058){_0x4c8ac7['push'](_0x4c8ac7['shift']());}};_0x4d0f56(++_0x12934b);}(_0x5320,0x18c));var _0x0532=function(_0x3fbab4,_0x443ce2){_0x3fbab4=_0x3fbab4-0x0;var _0x5ccfc8=_0x5320[_0x3fbab4];return _0x5ccfc8;};'use strict';var SmsMessageEvents=require(_0x0532('0x0'));var events=[_0x0532('0x1'),_0x0532('0x2'),_0x0532('0x3')];function createListener(_0x14887a,_0x1f2ecf){return function(_0x346d95){_0x1f2ecf[_0x0532('0x4')](_0x14887a,_0x346d95);};}function removeListener(_0x255b25,_0x22e8a9){return function(){SmsMessageEvents[_0x0532('0x5')](_0x255b25,_0x22e8a9);};}exports[_0x0532('0x6')]=function(_0x479573){for(var _0x56667d=0x0,_0x9667c5=events[_0x0532('0x7')];_0x56667d<_0x9667c5;_0x56667d++){var _0x10df85=events[_0x56667d];var _0x1049ab=createListener('smsMessage:'+_0x10df85,_0x479573);SmsMessageEvents['on'](_0x10df85,_0x1049ab);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index de87603..e192c0d 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 _0x09af=['post','create','/:id/teams','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents'];(function(_0x13a5ff,_0x38685c){var _0x39dea4=function(_0x2556a3){while(--_0x2556a3){_0x13a5ff['push'](_0x13a5ff['shift']());}};_0x39dea4(++_0x38685c);}(_0x09af,0x68));var _0xf09a=function(_0x41533f,_0x113152){_0x41533f=_0x41533f-0x0;var _0x4bfb9f=_0x09af[_0x41533f];return _0x4bfb9f;};'use strict';var multer=require(_0xf09a('0x0'));var util=require(_0xf09a('0x1'));var path=require(_0xf09a('0x2'));var timeout=require(_0xf09a('0x3'));var express=require(_0xf09a('0x4'));var router=express[_0xf09a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf09a('0x6'));var config=require(_0xf09a('0x7'));var controller=require(_0xf09a('0x8'));router[_0xf09a('0x9')]('/',auth[_0xf09a('0xa')](),controller['index']);router[_0xf09a('0x9')](_0xf09a('0xb'),auth['isAuthenticated'](),controller[_0xf09a('0xc')]);router['get'](_0xf09a('0xd'),auth[_0xf09a('0xa')](),controller[_0xf09a('0xe')]);router[_0xf09a('0x9')](_0xf09a('0xf'),auth[_0xf09a('0xa')](),controller[_0xf09a('0x10')]);router[_0xf09a('0x9')]('/:id/teams',auth[_0xf09a('0xa')](),controller[_0xf09a('0x11')]);router[_0xf09a('0x9')](_0xf09a('0x12'),auth[_0xf09a('0xa')](),controller[_0xf09a('0x13')]);router[_0xf09a('0x14')]('/',auth[_0xf09a('0xa')](),controller[_0xf09a('0x15')]);router['post'](_0xf09a('0x16'),auth[_0xf09a('0xa')](),controller[_0xf09a('0x17')]);router[_0xf09a('0x14')]('/:id/users',auth[_0xf09a('0xa')](),controller['addAgents']);router[_0xf09a('0x18')]('/:id',auth[_0xf09a('0xa')](),controller[_0xf09a('0x19')]);router[_0xf09a('0x1a')](_0xf09a('0xd'),auth[_0xf09a('0xa')](),controller[_0xf09a('0x1b')]);router['delete'](_0xf09a('0x16'),auth[_0xf09a('0xa')](),controller[_0xf09a('0x1c')]);router['delete'](_0xf09a('0x12'),auth['isAuthenticated'](),controller[_0xf09a('0x1d')]);module[_0xf09a('0x1e')]=router; \ No newline at end of file +var _0x0ed9=['addTeams','put','/:id','update','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','describe','show','getMembers','/:id/teams','/:id/users','getAgents','post'];(function(_0x9613fc,_0x406af9){var _0x2d8f20=function(_0x5d7c2f){while(--_0x5d7c2f){_0x9613fc['push'](_0x9613fc['shift']());}};_0x2d8f20(++_0x406af9);}(_0x0ed9,0xbd));var _0x90ed=function(_0x565c4e,_0x1e77f9){_0x565c4e=_0x565c4e-0x0;var _0x4a167f=_0x0ed9[_0x565c4e];return _0x4a167f;};'use strict';var multer=require(_0x90ed('0x0'));var util=require(_0x90ed('0x1'));var path=require(_0x90ed('0x2'));var timeout=require(_0x90ed('0x3'));var express=require(_0x90ed('0x4'));var router=express[_0x90ed('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x90ed('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x90ed('0x7'));var controller=require(_0x90ed('0x8'));router[_0x90ed('0x9')]('/',auth[_0x90ed('0xa')](),controller[_0x90ed('0xb')]);router[_0x90ed('0x9')]('/describe',auth[_0x90ed('0xa')](),controller[_0x90ed('0xc')]);router['get']('/:id',auth[_0x90ed('0xa')](),controller[_0x90ed('0xd')]);router[_0x90ed('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0x90ed('0xe')]);router[_0x90ed('0x9')](_0x90ed('0xf'),auth[_0x90ed('0xa')](),controller['getTeams']);router[_0x90ed('0x9')](_0x90ed('0x10'),auth[_0x90ed('0xa')](),controller[_0x90ed('0x11')]);router[_0x90ed('0x12')]('/',auth[_0x90ed('0xa')](),controller['create']);router[_0x90ed('0x12')](_0x90ed('0xf'),auth['isAuthenticated'](),controller[_0x90ed('0x13')]);router['post'](_0x90ed('0x10'),auth[_0x90ed('0xa')](),controller['addAgents']);router[_0x90ed('0x14')](_0x90ed('0x15'),auth[_0x90ed('0xa')](),controller[_0x90ed('0x16')]);router[_0x90ed('0x17')](_0x90ed('0x15'),auth[_0x90ed('0xa')](),controller['destroy']);router[_0x90ed('0x17')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0x90ed('0x17')](_0x90ed('0x10'),auth[_0x90ed('0xa')](),controller[_0x90ed('0x18')]);module[_0x90ed('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index fe8971d..e2ac2fe 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 _0x17e7=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x17e7,0x174));var _0x717e=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x17e7[_0x4b174a];return _0x3cd7bf;};'use strict';var Sequelize=require(_0x717e('0x0'));module[_0x717e('0x1')]={'name':{'type':Sequelize[_0x717e('0x2')],'unique':_0x717e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x717e('0x4')](_0x717e('0x5'),_0x717e('0x6'),_0x717e('0x7'))}}; \ No newline at end of file +var _0xf087=['name','INTEGER','beepall','roundrobin','sequelize','STRING'];(function(_0x4f2741,_0x48e2a0){var _0x5bb700=function(_0x498104){while(--_0x498104){_0x4f2741['push'](_0x4f2741['shift']());}};_0x5bb700(++_0x48e2a0);}(_0xf087,0x1d8));var _0x7f08=function(_0x51b47b,_0x2b7e69){_0x51b47b=_0x51b47b-0x0;var _0xf57f7e=_0xf087[_0x51b47b];return _0xf57f7e;};'use strict';var Sequelize=require(_0x7f08('0x0'));module['exports']={'name':{'type':Sequelize[_0x7f08('0x1')],'unique':_0x7f08('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x7f08('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x7f08('0x4'),_0x7f08('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index e6475a6..2bb06be 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 _0x2272=['filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','include','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','order','pick','SmsQueueId','User','findAndCountAll','agent','createdAt','rows','format','%s/%s','SIP','updatedAt','getTeams','addTeams','Agents','interface','each','UserSmsQueue','findOrCreate','forEach','userSmsQueue:save','removeTeams','Team','ids','select','field','tq.TeamId','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','includes','all','union','compact','value','transaction','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./smsQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','stack','name','send','map','SmsQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x23600c,_0x31d165){var _0x57f2a2=function(_0x591ded){while(--_0x591ded){_0x23600c['push'](_0x23600c['shift']());}};_0x57f2a2(++_0x31d165);}(_0x2272,0xd8));var _0x2227=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2272[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x2227('0x0'));var rimraf=require(_0x2227('0x1'));var zipdir=require(_0x2227('0x2'));var jsonpatch=require(_0x2227('0x3'));var rp=require(_0x2227('0x4'));var moment=require('moment');var BPromise=require(_0x2227('0x5'));var Mustache=require(_0x2227('0x6'));var util=require(_0x2227('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2227('0x8'));var ejs=require(_0x2227('0x9'));var fs=require('fs');var fs_extra=require(_0x2227('0xa'));var _=require(_0x2227('0xb'));var squel=require(_0x2227('0xc'));var crypto=require(_0x2227('0xd'));var jsforce=require(_0x2227('0xe'));var deskjs=require(_0x2227('0xf'));var toCsv=require(_0x2227('0x8'));var querystring=require(_0x2227('0x10'));var Papa=require('papaparse');var Redis=require(_0x2227('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2227('0x12'));var as=require(_0x2227('0x13'));var hardwareService=require(_0x2227('0x14'));var logger=require(_0x2227('0x15'))(_0x2227('0x16'));var utils=require('../../config/utils');var config=require(_0x2227('0x17'));var licenseUtil=require(_0x2227('0x18'));var db=require(_0x2227('0x19'))['db'];config[_0x2227('0x1a')]=_[_0x2227('0x1b')](config[_0x2227('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2227('0x1c'))['register'](socket);function respondWithStatusCode(_0x42f60b,_0xb631b0){_0xb631b0=_0xb631b0||0xcc;return function(_0x510b09){if(_0x510b09){return _0x42f60b[_0x2227('0x1d')](_0xb631b0);}return _0x42f60b[_0x2227('0x1e')](_0xb631b0)[_0x2227('0x1f')]();};}function respondWithResult(_0x43e174,_0x42a93c){_0x42a93c=_0x42a93c||0xc8;return function(_0x1e78a8){if(_0x1e78a8){return _0x43e174['status'](_0x42a93c)[_0x2227('0x20')](_0x1e78a8);}};}function respondWithFilteredResult(_0x1cf016,_0x162723){return function(_0x531f75){if(_0x531f75){var _0x11bf80=typeof _0x162723[_0x2227('0x21')]===_0x2227('0x22')&&typeof _0x162723[_0x2227('0x23')]===_0x2227('0x22');var _0x28e642=_0x531f75[_0x2227('0x24')];var _0x4e0bba=_0x11bf80?0x0:_0x162723[_0x2227('0x21')];var _0x59f988=_0x11bf80?_0x531f75[_0x2227('0x24')]:_0x162723[_0x2227('0x21')]+_0x162723[_0x2227('0x23')];var _0x1f28ef;if(_0x59f988>=_0x28e642){_0x59f988=_0x28e642;_0x1f28ef=0xc8;}else{_0x1f28ef=0xce;}_0x1cf016[_0x2227('0x1e')](_0x1f28ef);return _0x1cf016[_0x2227('0x25')](_0x2227('0x26'),_0x4e0bba+'-'+_0x59f988+'/'+_0x28e642)[_0x2227('0x20')](_0x531f75);}return null;};}function patchUpdates(_0x3299fd){return function(_0x34c090){try{jsonpatch[_0x2227('0x27')](_0x34c090,_0x3299fd,!![]);}catch(_0x5a454f){return BPromise[_0x2227('0x28')](_0x5a454f);}return _0x34c090[_0x2227('0x29')]();};}function saveUpdates(_0x5b3a09,_0x2cef4b){return function(_0xbfdce1){if(_0xbfdce1){return _0xbfdce1['update'](_0x5b3a09)['then'](function(_0x17c7a4){return _0x17c7a4;});}return null;};}function removeEntity(_0xa4d18b,_0x35333f){return function(_0x1f30c3){if(_0x1f30c3){return _0x1f30c3['destroy']()[_0x2227('0x2a')](function(){var _0x301304=_0x1f30c3[_0x2227('0x2b')]({'plain':!![]});var _0x1957ee='SmsQueues';return db[_0x2227('0x2c')][_0x2227('0x2d')]({'where':{'type':_0x1957ee,'resourceId':_0x301304['id']}})[_0x2227('0x2a')](function(){return _0x1f30c3;});})[_0x2227('0x2a')](function(){_0xa4d18b[_0x2227('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55015e,_0x5d1d56){return function(_0x2dc38d){if(!_0x2dc38d){_0x55015e['sendStatus'](0x194);}return _0x2dc38d;};}function handleError(_0x2ba581,_0x1979d8){_0x1979d8=_0x1979d8||0x1f4;return function(_0x58609e){logger['error'](_0x58609e[_0x2227('0x2e')]);if(_0x58609e[_0x2227('0x2f')]){delete _0x58609e[_0x2227('0x2f')];}_0x2ba581['status'](_0x1979d8)[_0x2227('0x30')](_0x58609e);};}exports['index']=function(_0xaa2bbb,_0x3f108b){var _0x28ad1c={},_0xfa2140={},_0x155095={'count':0x0,'rows':[]};var _0x256b7b=_[_0x2227('0x31')](db[_0x2227('0x32')][_0x2227('0x33')],function(_0x781f79){return{'name':_0x781f79[_0x2227('0x34')],'type':_0x781f79['type'][_0x2227('0x35')]};});_0xfa2140[_0x2227('0x36')]=_[_0x2227('0x31')](_0x256b7b,_0x2227('0x2f'));_0xfa2140['query']=_[_0x2227('0x37')](_0xaa2bbb[_0x2227('0x38')]);_0xfa2140[_0x2227('0x39')]=_[_0x2227('0x3a')](_0xfa2140['model'],_0xfa2140[_0x2227('0x38')]);_0x28ad1c[_0x2227('0x3b')]=_[_0x2227('0x3a')](_0xfa2140['model'],qs['fields'](_0xaa2bbb[_0x2227('0x38')][_0x2227('0x3c')]));_0x28ad1c['attributes']=_0x28ad1c[_0x2227('0x3b')][_0x2227('0x3d')]?_0x28ad1c['attributes']:_0xfa2140[_0x2227('0x36')];if(!_0xaa2bbb['query'][_0x2227('0x3e')](_0x2227('0x3f'))){_0x28ad1c[_0x2227('0x23')]=qs[_0x2227('0x23')](_0xaa2bbb['query'][_0x2227('0x23')]);_0x28ad1c['offset']=qs[_0x2227('0x21')](_0xaa2bbb[_0x2227('0x38')][_0x2227('0x21')]);}_0x28ad1c['order']=qs[_0x2227('0x40')](_0xaa2bbb[_0x2227('0x38')][_0x2227('0x40')]);_0x28ad1c[_0x2227('0x41')]=qs[_0x2227('0x39')](_['pick'](_0xaa2bbb['query'],_0xfa2140[_0x2227('0x39')]),_0x256b7b);if(_0xaa2bbb['query'][_0x2227('0x42')]){_0x28ad1c[_0x2227('0x41')]=_[_0x2227('0x43')](_0x28ad1c[_0x2227('0x41')],{'$or':_[_0x2227('0x31')](_0x256b7b,function(_0xd08cd8){if(_0xd08cd8[_0x2227('0x44')]!==_0x2227('0x45')){var _0x5688b5={};_0x5688b5[_0xd08cd8[_0x2227('0x2f')]]={'$like':'%'+_0xaa2bbb['query'][_0x2227('0x42')]+'%'};return _0x5688b5;}})});}_0x28ad1c=_['merge']({},_0x28ad1c,_0xaa2bbb[_0x2227('0x46')]);var _0x59afc0={'where':_0x28ad1c[_0x2227('0x41')]};return db['SmsQueue'][_0x2227('0x24')](_0x59afc0)[_0x2227('0x2a')](function(_0x46eb0f){_0x155095[_0x2227('0x24')]=_0x46eb0f;if(_0xaa2bbb[_0x2227('0x38')][_0x2227('0x47')]){_0x28ad1c['include']=[{'all':!![]}];}return db['SmsQueue'][_0x2227('0x48')](_0x28ad1c);})['then'](function(_0x3552db){_0x155095['rows']=_0x3552db;return _0x155095;})[_0x2227('0x2a')](respondWithFilteredResult(_0x3f108b,_0x28ad1c))[_0x2227('0x49')](handleError(_0x3f108b,null));};exports[_0x2227('0x4a')]=function(_0xa3ae06,_0x3f9787){var _0x2871a6={'raw':!![],'where':{'id':_0xa3ae06[_0x2227('0x4b')]['id']}},_0x5f5880={};_0x5f5880[_0x2227('0x36')]=_[_0x2227('0x37')](db[_0x2227('0x32')][_0x2227('0x33')]);_0x5f5880[_0x2227('0x38')]=_[_0x2227('0x37')](_0xa3ae06[_0x2227('0x38')]);_0x5f5880['filters']=_[_0x2227('0x3a')](_0x5f5880[_0x2227('0x36')],_0x5f5880[_0x2227('0x38')]);_0x2871a6[_0x2227('0x3b')]=_['intersection'](_0x5f5880[_0x2227('0x36')],qs[_0x2227('0x3c')](_0xa3ae06['query'][_0x2227('0x3c')]));_0x2871a6[_0x2227('0x3b')]=_0x2871a6[_0x2227('0x3b')][_0x2227('0x3d')]?_0x2871a6[_0x2227('0x3b')]:_0x5f5880[_0x2227('0x36')];if(_0xa3ae06[_0x2227('0x38')]['includeAll']){_0x2871a6[_0x2227('0x4c')]=[{'all':!![]}];}_0x2871a6=_[_0x2227('0x43')]({},_0x2871a6,_0xa3ae06['options']);return db[_0x2227('0x32')]['find'](_0x2871a6)[_0x2227('0x2a')](handleEntityNotFound(_0x3f9787,null))[_0x2227('0x2a')](respondWithResult(_0x3f9787,null))[_0x2227('0x49')](handleError(_0x3f9787,null));};exports[_0x2227('0x4d')]=function(_0x5387fc,_0x4e12c7){return db['SmsQueue'][_0x2227('0x4d')](_0x5387fc[_0x2227('0x4e')],{})['then'](function(_0x3ab28b){var _0x3e5e7b=_0x5387fc[_0x2227('0x4f')][_0x2227('0x2b')]({'plain':!![]});if(!_0x3e5e7b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e5e7b['role']===_0x2227('0x4f')){var _0x1f1f1f=_0x3ab28b[_0x2227('0x2b')]({'plain':!![]});var _0xc13872='SmsQueues';return db[_0x2227('0x50')][_0x2227('0x51')]({'where':{'name':_0xc13872,'userProfileId':_0x3e5e7b[_0x2227('0x52')]},'raw':!![]})[_0x2227('0x2a')](function(_0x125fa8){if(_0x125fa8&&_0x125fa8[_0x2227('0x53')]===0x0){return db[_0x2227('0x2c')][_0x2227('0x4d')]({'name':_0x1f1f1f[_0x2227('0x2f')],'resourceId':_0x1f1f1f['id'],'type':_0x125fa8[_0x2227('0x2f')],'sectionId':_0x125fa8['id']},{})[_0x2227('0x2a')](function(){return _0x3ab28b;});}else{return _0x3ab28b;}})[_0x2227('0x49')](function(_0x7b6319){logger[_0x2227('0x54')](_0x2227('0x55'),_0x7b6319);throw _0x7b6319;});}return _0x3ab28b;})[_0x2227('0x2a')](respondWithResult(_0x4e12c7,0xc9))['catch'](handleError(_0x4e12c7,null));};exports[_0x2227('0x56')]=function(_0x12f1e7,_0x560b3c){if(_0x12f1e7[_0x2227('0x4e')]['id']){delete _0x12f1e7[_0x2227('0x4e')]['id'];}return db[_0x2227('0x32')]['find']({'where':{'id':_0x12f1e7['params']['id']}})['then'](handleEntityNotFound(_0x560b3c,null))[_0x2227('0x2a')](saveUpdates(_0x12f1e7[_0x2227('0x4e')],null))['then'](respondWithResult(_0x560b3c,null))[_0x2227('0x49')](handleError(_0x560b3c,null));};exports[_0x2227('0x2d')]=function(_0xc1114a,_0x496026){return db[_0x2227('0x32')][_0x2227('0x51')]({'where':{'id':_0xc1114a['params']['id']}})[_0x2227('0x2a')](handleEntityNotFound(_0x496026,null))[_0x2227('0x2a')](removeEntity(_0x496026,null))['catch'](handleError(_0x496026,null));};exports[_0x2227('0x57')]=function(_0x235352,_0x30b004){return db[_0x2227('0x32')][_0x2227('0x57')]()[_0x2227('0x2a')](respondWithResult(_0x30b004,null))['catch'](handleError(_0x30b004,null));};exports['getMembers']=function(_0x3af2b3,_0x478b1b,_0x149c03){var _0x5d0135={'raw':!![],'where':{}},_0x34b44f={},_0x13d3c6;return db[_0x2227('0x32')][_0x2227('0x58')]({'where':{'id':_0x3af2b3['params']['id']}})[_0x2227('0x2a')](handleEntityNotFound(_0x478b1b,null))[_0x2227('0x2a')](function(_0x10df84){if(_0x10df84){_0x13d3c6=_0x10df84[_0x2227('0x2b')]({'plain':!![]});_0x34b44f[_0x2227('0x36')]=_['keys'](db['UserSmsQueue'][_0x2227('0x33')]);_0x34b44f['query']=_[_0x2227('0x37')](_0x3af2b3[_0x2227('0x38')]);_0x34b44f['filters']=_['intersection'](_0x34b44f[_0x2227('0x36')],_0x34b44f[_0x2227('0x38')]);_0x5d0135[_0x2227('0x3b')]=_[_0x2227('0x3a')](_0x34b44f[_0x2227('0x36')],qs[_0x2227('0x3c')](_0x3af2b3[_0x2227('0x38')][_0x2227('0x3c')]));_0x5d0135[_0x2227('0x3b')]=_0x5d0135['attributes'][_0x2227('0x3d')]?_0x5d0135[_0x2227('0x3b')]:_0x34b44f['model'];if(!_0x3af2b3[_0x2227('0x38')][_0x2227('0x3e')](_0x2227('0x3f'))){_0x5d0135['limit']=qs[_0x2227('0x23')](_0x3af2b3[_0x2227('0x38')][_0x2227('0x23')]);_0x5d0135[_0x2227('0x21')]=qs[_0x2227('0x21')](_0x3af2b3[_0x2227('0x38')][_0x2227('0x21')]);}_0x5d0135[_0x2227('0x59')]=qs[_0x2227('0x40')](_0x3af2b3[_0x2227('0x38')][_0x2227('0x40')]);_0x5d0135[_0x2227('0x41')]=qs[_0x2227('0x39')](_[_0x2227('0x5a')](_0x3af2b3['query'],_0x34b44f[_0x2227('0x39')]));_0x5d0135[_0x2227('0x41')][_0x2227('0x5b')]=_0x10df84['id'];if(_0x3af2b3[_0x2227('0x38')][_0x2227('0x42')]){_0x5d0135[_0x2227('0x41')]=_[_0x2227('0x43')](_0x5d0135[_0x2227('0x41')],{'$or':_['map'](_0x5d0135[_0x2227('0x3b')],function(_0x406b42){var _0x220445={};_0x220445[_0x406b42]={'$like':'%'+_0x3af2b3['query'][_0x2227('0x42')]+'%'};return _0x220445;})});}_0x5d0135=_[_0x2227('0x43')]({},_0x5d0135,_0x3af2b3[_0x2227('0x46')]);return db['UserSmsQueue'][_0x2227('0x48')](_0x5d0135);}})['then'](function(_0xb35937){if(_0xb35937){return db[_0x2227('0x5c')][_0x2227('0x5d')]({'where':{'id':_[_0x2227('0x31')](_0xb35937,'UserId'),'role':_0x2227('0x5e')},'attributes':['id',_0x2227('0x2f'),'smsPause','updatedAt',_0x2227('0x5f')]});}})[_0x2227('0x2a')](function(_0x35ebf5){if(_0x35ebf5){return{'count':_0x35ebf5[_0x2227('0x24')],'rows':_[_0x2227('0x31')](_0x35ebf5[_0x2227('0x60')],function(_0x21d840){return{'membername':_0x21d840[_0x2227('0x2f')],'UserId':_0x21d840['id'],'queue_name':_0x13d3c6['name'],'SmsQueueId':_0x13d3c6['id'],'interface':util[_0x2227('0x61')](_0x2227('0x62'),_0x2227('0x63'),_0x21d840['name']),'penalty':0x0,'paused':_0x21d840['smsPause'],'createdAt':_0x21d840['createdAt'],'updatedAt':_0x21d840[_0x2227('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x478b1b,_0x5d0135))[_0x2227('0x49')](handleError(_0x478b1b,null));};exports[_0x2227('0x65')]=function(_0x13146a,_0x2ad7b7,_0x279941){var _0x2435d0={};var _0x28aeb8={};var _0x7f0b8e;var _0x293bc9;return db['SmsQueue'][_0x2227('0x58')]({'where':{'id':_0x13146a[_0x2227('0x4b')]['id']}})[_0x2227('0x2a')](handleEntityNotFound(_0x2ad7b7,null))['then'](function(_0x22a30f){if(_0x22a30f){_0x7f0b8e=_0x22a30f;_0x28aeb8[_0x2227('0x36')]=_['keys'](db['Team'][_0x2227('0x33')]);_0x28aeb8['query']=_[_0x2227('0x37')](_0x13146a[_0x2227('0x38')]);_0x28aeb8[_0x2227('0x39')]=_[_0x2227('0x3a')](_0x28aeb8[_0x2227('0x36')],_0x28aeb8['query']);_0x2435d0[_0x2227('0x3b')]=_[_0x2227('0x3a')](_0x28aeb8[_0x2227('0x36')],qs[_0x2227('0x3c')](_0x13146a['query'][_0x2227('0x3c')]));_0x2435d0[_0x2227('0x3b')]=_0x2435d0['attributes']['length']?_0x2435d0[_0x2227('0x3b')]:_0x28aeb8[_0x2227('0x36')];_0x2435d0[_0x2227('0x59')]=qs['sort'](_0x13146a['query'][_0x2227('0x40')]);_0x2435d0[_0x2227('0x41')]=qs[_0x2227('0x39')](_[_0x2227('0x5a')](_0x13146a['query'],_0x28aeb8['filters']));if(_0x13146a[_0x2227('0x38')]['filter']){_0x2435d0[_0x2227('0x41')]=_[_0x2227('0x43')](_0x2435d0[_0x2227('0x41')],{'$or':_['map'](_0x2435d0[_0x2227('0x3b')],function(_0x5111aa){var _0x18f7df={};_0x18f7df[_0x5111aa]={'$like':'%'+_0x13146a[_0x2227('0x38')][_0x2227('0x42')]+'%'};return _0x18f7df;})});}_0x2435d0=_[_0x2227('0x43')]({},_0x2435d0,_0x13146a[_0x2227('0x46')]);return _0x7f0b8e[_0x2227('0x65')](_0x2435d0);}})[_0x2227('0x2a')](function(_0x9364ec){if(_0x9364ec){_0x293bc9=_0x9364ec['length'];if(!_0x13146a[_0x2227('0x38')][_0x2227('0x3e')](_0x2227('0x3f'))){_0x2435d0['limit']=qs['limit'](_0x13146a[_0x2227('0x38')][_0x2227('0x23')]);_0x2435d0[_0x2227('0x21')]=qs['offset'](_0x13146a[_0x2227('0x38')]['offset']);}return _0x7f0b8e[_0x2227('0x65')](_0x2435d0);}})['then'](function(_0x154e94){if(_0x154e94){return _0x154e94?{'count':_0x293bc9,'rows':_0x154e94}:null;}})[_0x2227('0x2a')](respondWithResult(_0x2ad7b7,null))['catch'](handleError(_0x2ad7b7,null));};exports[_0x2227('0x66')]=function(_0x249bd9,_0x172583,_0x29a504){var _0x2ae3e0=_0x249bd9[_0x2227('0x4e')]['ids'];return db['Team'][_0x2227('0x48')]({'where':{'id':_0x2ae3e0},'attributes':['id'],'include':[{'model':db[_0x2227('0x5c')],'as':_0x2227('0x67'),'attributes':['id',_0x2227('0x2f'),'online','voicePause',_0x2227('0x68')],'raw':!![]}]})[_0x2227('0x2a')](function(_0x2a116c){if(_0x2a116c){var _0x49bdd5=_['flatMap'](_0x2a116c,function(_0x2a5390){var _0x182ff3=_0x2a5390[_0x2227('0x2b')]({'plain':!![]});return _0x182ff3[_0x2227('0x67')];});return db[_0x2227('0x32')][_0x2227('0x51')]({'where':{'id':_0x249bd9[_0x2227('0x4b')]['id']}})[_0x2227('0x2a')](function(_0x41e8ca){return db['sequelize']['transaction'](function(_0x3ccb35){return _0x41e8ca['addTeams'](_0x2ae3e0,{'transaction':_0x3ccb35})[_0x2227('0x2a')](function(){return BPromise[_0x2227('0x69')](_0x49bdd5,function(_0x595884){return db[_0x2227('0x6a')][_0x2227('0x6b')]({'where':{'UserId':_0x595884['id'],'SmsQueueId':_0x249bd9['params']['id']},'transaction':_0x3ccb35});});})[_0x2227('0x2a')](function(){_0x49bdd5[_0x2227('0x6c')](function(_0x292a0e){socket['emit'](_0x2227('0x6d'),{'UserId':_0x292a0e['id'],'SmsQueueId':_0x41e8ca['id']});});});});});}})['then'](respondWithStatusCode(_0x172583,null))['catch'](handleError(_0x172583,null));};exports[_0x2227('0x6e')]=function(_0x5b0d82,_0x4044a8,_0x1b2b58){return db[_0x2227('0x6f')]['findAll']({'where':{'id':_0x5b0d82[_0x2227('0x38')][_0x2227('0x70')]},'attributes':['id'],'include':[{'model':db[_0x2227('0x5c')],'as':_0x2227('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4044a8,null))['then'](function(_0x1c6f54){var _0x3b653f=_[_0x2227('0x31')](_0x1c6f54,'id');var _0x2e4a1b=[];var _0x4cd27e=[];var _0x1a2852=squel[_0x2227('0x71')]();_0x1a2852[_0x2227('0x72')](_0x2227('0x73'))[_0x2227('0x74')](_0x2227('0x75'),'tq')[_0x2227('0x76')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x2227('0x41')](_0x2227('0x77'),_0x5b0d82['params']['id']);for(var _0x3f1a5f=0x0;_0x3f1a5f<_0x1c6f54[_0x2227('0x3d')];_0x3f1a5f+=0x1){let _0x15764e=_0x1c6f54[_0x3f1a5f];for(var _0x192e2a=0x0;_0x192e2a<_0x15764e['Agents'][_0x2227('0x3d')];_0x192e2a+=0x1){let _0x4dc651=_0x15764e['Agents'][_0x192e2a];var _0x3f6fe2=_0x1a2852[_0x2227('0x78')]();_0x3f6fe2[_0x2227('0x41')](_0x2227('0x79'),_0x4dc651['id']);_0x4cd27e[_0x2227('0x7a')](db[_0x2227('0x7b')][_0x2227('0x38')](_0x3f6fe2[_0x2227('0x7c')](),{'type':db[_0x2227('0x7b')]['QueryTypes'][_0x2227('0x7d')]})[_0x2227('0x2a')](function(_0x2fb403){if(_0x2fb403[_0x2227('0x3d')]===0x1){return _0x4dc651['id'];}else{var _0x8a3926=_['every'](_[_0x2227('0x31')](_0x2fb403,'TeamId'),function(_0x2eb4a2){return _[_0x2227('0x7e')](_0x3b653f,_0x2eb4a2);});if(_0x8a3926){return _0x4dc651['id'];}}}));}}return BPromise[_0x2227('0x7f')](_0x4cd27e)[_0x2227('0x2a')](function(_0xf88d4){_0x2e4a1b=_(_0x2e4a1b)[_0x2227('0x80')](_0xf88d4)[_0x2227('0x81')]()[_0x2227('0x82')]();return db['SmsQueue'][_0x2227('0x51')]({'where':{'id':_0x5b0d82[_0x2227('0x4b')]['id']}})[_0x2227('0x2a')](function(_0x5e020e){return db[_0x2227('0x7b')][_0x2227('0x83')](function(_0x57fc94){return _0x5e020e[_0x2227('0x6e')](_0x5b0d82[_0x2227('0x38')]['ids'],{'transaction':_0x57fc94})[_0x2227('0x2a')](function(){if(!_[_0x2227('0x84')](_0x2e4a1b)){return _0x5e020e[_0x2227('0x85')](_0x2e4a1b,{'transaction':_0x57fc94});}})[_0x2227('0x2a')](function(){_0x2e4a1b[_0x2227('0x6c')](function(_0x3c0d44){socket[_0x2227('0x86')](_0x2227('0x87'),{'UserId':_0x3c0d44,'SmsQueueId':_0x5e020e['id']});});});});});});})['then'](respondWithStatusCode(_0x4044a8,null))[_0x2227('0x49')](handleError(_0x4044a8,null));};exports[_0x2227('0x88')]=function(_0x176b65,_0x1a33a2,_0x172b34){return db[_0x2227('0x32')]['find']({'where':{'id':_0x176b65[_0x2227('0x4b')]['id']}})[_0x2227('0x2a')](handleEntityNotFound(_0x1a33a2,null))[_0x2227('0x2a')](function(_0x20def8){if(_0x20def8){return _0x20def8[_0x2227('0x88')](_0x176b65[_0x2227('0x4e')][_0x2227('0x70')],_[_0x2227('0x89')](_0x176b65[_0x2227('0x4e')],[_0x2227('0x70'),'id'])||{})[_0x2227('0x8a')](function(_0x9d9ea2){for(var _0x59060f=0x0;_0x59060f<_0x176b65[_0x2227('0x4e')][_0x2227('0x70')][_0x2227('0x3d')];_0x59060f+=0x1){socket[_0x2227('0x86')](_0x2227('0x6d'),{'UserId':Number(_0x176b65[_0x2227('0x4e')][_0x2227('0x70')][_0x59060f]),'SmsQueueId':Number(_0x176b65[_0x2227('0x4b')]['id'])});}return _0x9d9ea2;});}})[_0x2227('0x2a')](respondWithResult(_0x1a33a2,null))[_0x2227('0x49')](handleError(_0x1a33a2,null));};exports['removeAgents']=function(_0x23826c,_0x1e84a,_0x467865){return db[_0x2227('0x32')][_0x2227('0x51')]({'where':{'id':_0x23826c[_0x2227('0x4b')]['id']}})[_0x2227('0x2a')](handleEntityNotFound(_0x1e84a,null))[_0x2227('0x2a')](function(_0x59dcdc){if(_0x59dcdc){return _0x59dcdc[_0x2227('0x85')](_0x23826c[_0x2227('0x38')][_0x2227('0x70')])['then'](function(){if(_[_0x2227('0x8b')](_0x23826c[_0x2227('0x38')]['ids'])){for(var _0x109f17=0x0;_0x109f17<_0x23826c[_0x2227('0x38')][_0x2227('0x70')][_0x2227('0x3d')];_0x109f17+=0x1){socket[_0x2227('0x86')]('userSmsQueue:remove',{'UserId':Number(_0x23826c[_0x2227('0x38')][_0x2227('0x70')][_0x109f17]),'SmsQueueId':Number(_0x23826c[_0x2227('0x4b')]['id'])});}}else{socket[_0x2227('0x86')](_0x2227('0x87'),{'UserId':Number(_0x23826c['query']['ids']),'SmsQueueId':Number(_0x23826c[_0x2227('0x4b')]['id'])});}});}})[_0x2227('0x2a')](respondWithStatusCode(_0x1e84a,null))[_0x2227('0x49')](handleError(_0x1e84a,null));};exports['getAgents']=function(_0x566d32,_0x57280e,_0x2a6d65){var _0x63a98={};var _0x439080={};var _0x26ec4b;var _0x32d155;return db[_0x2227('0x32')][_0x2227('0x58')]({'where':{'id':_0x566d32['params']['id']}})[_0x2227('0x2a')](handleEntityNotFound(_0x57280e,null))[_0x2227('0x2a')](function(_0x2824b1){if(_0x2824b1){_0x26ec4b=_0x2824b1;_0x439080[_0x2227('0x36')]=_[_0x2227('0x37')](db[_0x2227('0x5c')][_0x2227('0x33')]);_0x439080[_0x2227('0x38')]=_[_0x2227('0x37')](_0x566d32['query']);_0x439080[_0x2227('0x39')]=_[_0x2227('0x3a')](_0x439080[_0x2227('0x36')],_0x439080[_0x2227('0x38')]);_0x63a98[_0x2227('0x3b')]=_[_0x2227('0x3a')](_0x439080[_0x2227('0x36')],qs['fields'](_0x566d32[_0x2227('0x38')][_0x2227('0x3c')]));_0x63a98[_0x2227('0x3b')]=_0x63a98[_0x2227('0x3b')][_0x2227('0x3d')]?_0x63a98[_0x2227('0x3b')]:_0x439080[_0x2227('0x36')];_0x63a98['order']=qs[_0x2227('0x40')](_0x566d32[_0x2227('0x38')][_0x2227('0x40')]);_0x63a98[_0x2227('0x41')]=qs[_0x2227('0x39')](_['pick'](_0x566d32[_0x2227('0x38')],_0x439080[_0x2227('0x39')]));if(_0x566d32['query']['filter']){_0x63a98[_0x2227('0x41')]=_[_0x2227('0x43')](_0x63a98[_0x2227('0x41')],{'$or':_[_0x2227('0x31')](_0x63a98[_0x2227('0x3b')],function(_0xd2156f){var _0x1d1955={};_0x1d1955[_0xd2156f]={'$like':'%'+_0x566d32['query']['filter']+'%'};return _0x1d1955;})});}_0x63a98=_[_0x2227('0x43')]({},_0x63a98,_0x566d32['options']);return _0x26ec4b['getAgents'](_0x63a98);}})[_0x2227('0x2a')](function(_0x2151d6){if(_0x2151d6){_0x32d155=_0x2151d6[_0x2227('0x3d')];if(!_0x566d32[_0x2227('0x38')][_0x2227('0x3e')](_0x2227('0x3f'))){_0x63a98['limit']=qs[_0x2227('0x23')](_0x566d32[_0x2227('0x38')]['limit']);_0x63a98[_0x2227('0x21')]=qs[_0x2227('0x21')](_0x566d32[_0x2227('0x38')][_0x2227('0x21')]);}return _0x26ec4b[_0x2227('0x8c')](_0x63a98);}})[_0x2227('0x2a')](function(_0x66aa39){if(_0x66aa39){return _0x66aa39?{'count':_0x32d155,'rows':_0x66aa39}:null;}})[_0x2227('0x2a')](respondWithResult(_0x57280e,null))[_0x2227('0x49')](handleError(_0x57280e,null));}; \ No newline at end of file +var _0x6e9b=['name','send','index','map','SmsQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','error','destroy','describe','getMembers','findOne','hasOwnProperty','nolimit','order','SmsQueueId','UserSmsQueue','findAll','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','smsPause','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','each','findOrCreate','removeTeams','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','every','includes','all','union','value','transaction','isEmpty','removeAgents','emit','addAgents','omit','spread','userSmsQueue:save','isArray','userSmsQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/license/util','redis','defaults','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','get','SmsQueues'];(function(_0x24b933,_0x136b87){var _0xce75ed=function(_0x591703){while(--_0x591703){_0x24b933['push'](_0x24b933['shift']());}};_0xce75ed(++_0x136b87);}(_0x6e9b,0xea));var _0xb6e9=function(_0x1cfd3b,_0xf63d70){_0x1cfd3b=_0x1cfd3b-0x0;var _0x274311=_0x6e9b[_0x1cfd3b];return _0x274311;};'use strict';var emlformat=require(_0xb6e9('0x0'));var rimraf=require(_0xb6e9('0x1'));var zipdir=require(_0xb6e9('0x2'));var jsonpatch=require(_0xb6e9('0x3'));var rp=require(_0xb6e9('0x4'));var moment=require('moment');var BPromise=require(_0xb6e9('0x5'));var Mustache=require(_0xb6e9('0x6'));var util=require(_0xb6e9('0x7'));var path=require('path');var sox=require(_0xb6e9('0x8'));var csv=require(_0xb6e9('0x9'));var ejs=require(_0xb6e9('0xa'));var fs=require('fs');var fs_extra=require(_0xb6e9('0xb'));var _=require(_0xb6e9('0xc'));var squel=require(_0xb6e9('0xd'));var crypto=require(_0xb6e9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb6e9('0xf'));var toCsv=require(_0xb6e9('0x9'));var querystring=require(_0xb6e9('0x10'));var Papa=require(_0xb6e9('0x11'));var Redis=require(_0xb6e9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb6e9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb6e9('0x14'));var utils=require(_0xb6e9('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb6e9('0x16'));var db=require('../../mysqldb')['db'];config[_0xb6e9('0x17')]=_[_0xb6e9('0x18')](config[_0xb6e9('0x17')],{'host':_0xb6e9('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb6e9('0x17')]));require('./smsQueue.socket')[_0xb6e9('0x1a')](socket);function respondWithStatusCode(_0xb14b72,_0x36bbe3){_0x36bbe3=_0x36bbe3||0xcc;return function(_0x2a33ec){if(_0x2a33ec){return _0xb14b72[_0xb6e9('0x1b')](_0x36bbe3);}return _0xb14b72[_0xb6e9('0x1c')](_0x36bbe3)[_0xb6e9('0x1d')]();};}function respondWithResult(_0x2777b8,_0x3e59b1){_0x3e59b1=_0x3e59b1||0xc8;return function(_0x389010){if(_0x389010){return _0x2777b8[_0xb6e9('0x1c')](_0x3e59b1)[_0xb6e9('0x1e')](_0x389010);}};}function respondWithFilteredResult(_0x2c1f07,_0x5ceecf){return function(_0xca2aaa){if(_0xca2aaa){var _0x30b16c=typeof _0x5ceecf[_0xb6e9('0x1f')]===_0xb6e9('0x20')&&typeof _0x5ceecf[_0xb6e9('0x21')]==='undefined';var _0xb59de7=_0xca2aaa['count'];var _0x532d0f=_0x30b16c?0x0:_0x5ceecf[_0xb6e9('0x1f')];var _0x24f757=_0x30b16c?_0xca2aaa[_0xb6e9('0x22')]:_0x5ceecf['offset']+_0x5ceecf[_0xb6e9('0x21')];var _0x32736f;if(_0x24f757>=_0xb59de7){_0x24f757=_0xb59de7;_0x32736f=0xc8;}else{_0x32736f=0xce;}_0x2c1f07[_0xb6e9('0x1c')](_0x32736f);return _0x2c1f07[_0xb6e9('0x23')](_0xb6e9('0x24'),_0x532d0f+'-'+_0x24f757+'/'+_0xb59de7)['json'](_0xca2aaa);}return null;};}function patchUpdates(_0x449567){return function(_0x1040b1){try{jsonpatch[_0xb6e9('0x25')](_0x1040b1,_0x449567,!![]);}catch(_0x2f28e0){return BPromise['reject'](_0x2f28e0);}return _0x1040b1['save']();};}function saveUpdates(_0x535531,_0x476c7c){return function(_0x244fa7){if(_0x244fa7){return _0x244fa7[_0xb6e9('0x26')](_0x535531)[_0xb6e9('0x27')](function(_0x63f7b9){return _0x63f7b9;});}return null;};}function removeEntity(_0x39bdf0,_0x1d3e56){return function(_0x4601b9){if(_0x4601b9){return _0x4601b9['destroy']()[_0xb6e9('0x27')](function(){var _0x4d20f9=_0x4601b9[_0xb6e9('0x28')]({'plain':!![]});var _0x1f9f47=_0xb6e9('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x1f9f47,'resourceId':_0x4d20f9['id']}})[_0xb6e9('0x27')](function(){return _0x4601b9;});})[_0xb6e9('0x27')](function(){_0x39bdf0[_0xb6e9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9da66c,_0x2abb3b){return function(_0x548b6c){if(!_0x548b6c){_0x9da66c[_0xb6e9('0x1b')](0x194);}return _0x548b6c;};}function handleError(_0x197a9d,_0x1ad27c){_0x1ad27c=_0x1ad27c||0x1f4;return function(_0x2442fb){logger['error'](_0x2442fb['stack']);if(_0x2442fb[_0xb6e9('0x2a')]){delete _0x2442fb[_0xb6e9('0x2a')];}_0x197a9d[_0xb6e9('0x1c')](_0x1ad27c)[_0xb6e9('0x2b')](_0x2442fb);};}exports[_0xb6e9('0x2c')]=function(_0x3f934a,_0xb00e9d){var _0x48c4cf={},_0x332f47={},_0xfc8b7d={'count':0x0,'rows':[]};var _0x5e7b94=_[_0xb6e9('0x2d')](db[_0xb6e9('0x2e')][_0xb6e9('0x2f')],function(_0x3bdb2c){return{'name':_0x3bdb2c['fieldName'],'type':_0x3bdb2c[_0xb6e9('0x30')][_0xb6e9('0x31')]};});_0x332f47[_0xb6e9('0x32')]=_[_0xb6e9('0x2d')](_0x5e7b94,_0xb6e9('0x2a'));_0x332f47[_0xb6e9('0x33')]=_[_0xb6e9('0x34')](_0x3f934a[_0xb6e9('0x33')]);_0x332f47[_0xb6e9('0x35')]=_[_0xb6e9('0x36')](_0x332f47[_0xb6e9('0x32')],_0x332f47[_0xb6e9('0x33')]);_0x48c4cf[_0xb6e9('0x37')]=_[_0xb6e9('0x36')](_0x332f47['model'],qs[_0xb6e9('0x38')](_0x3f934a[_0xb6e9('0x33')][_0xb6e9('0x38')]));_0x48c4cf[_0xb6e9('0x37')]=_0x48c4cf[_0xb6e9('0x37')][_0xb6e9('0x39')]?_0x48c4cf[_0xb6e9('0x37')]:_0x332f47[_0xb6e9('0x32')];if(!_0x3f934a['query']['hasOwnProperty']('nolimit')){_0x48c4cf['limit']=qs[_0xb6e9('0x21')](_0x3f934a[_0xb6e9('0x33')]['limit']);_0x48c4cf[_0xb6e9('0x1f')]=qs['offset'](_0x3f934a[_0xb6e9('0x33')]['offset']);}_0x48c4cf['order']=qs[_0xb6e9('0x3a')](_0x3f934a[_0xb6e9('0x33')][_0xb6e9('0x3a')]);_0x48c4cf[_0xb6e9('0x3b')]=qs[_0xb6e9('0x35')](_[_0xb6e9('0x3c')](_0x3f934a[_0xb6e9('0x33')],_0x332f47[_0xb6e9('0x35')]),_0x5e7b94);if(_0x3f934a[_0xb6e9('0x33')][_0xb6e9('0x3d')]){_0x48c4cf['where']=_['merge'](_0x48c4cf[_0xb6e9('0x3b')],{'$or':_[_0xb6e9('0x2d')](_0x5e7b94,function(_0xddbe0f){if(_0xddbe0f[_0xb6e9('0x30')]!==_0xb6e9('0x3e')){var _0x26b681={};_0x26b681[_0xddbe0f[_0xb6e9('0x2a')]]={'$like':'%'+_0x3f934a[_0xb6e9('0x33')][_0xb6e9('0x3d')]+'%'};return _0x26b681;}})});}_0x48c4cf=_[_0xb6e9('0x3f')]({},_0x48c4cf,_0x3f934a[_0xb6e9('0x40')]);var _0x517278={'where':_0x48c4cf[_0xb6e9('0x3b')]};return db[_0xb6e9('0x2e')][_0xb6e9('0x22')](_0x517278)[_0xb6e9('0x27')](function(_0x5e0bb4){_0xfc8b7d['count']=_0x5e0bb4;if(_0x3f934a[_0xb6e9('0x33')][_0xb6e9('0x41')]){_0x48c4cf[_0xb6e9('0x42')]=[{'all':!![]}];}return db[_0xb6e9('0x2e')]['findAll'](_0x48c4cf);})[_0xb6e9('0x27')](function(_0x337814){_0xfc8b7d[_0xb6e9('0x43')]=_0x337814;return _0xfc8b7d;})['then'](respondWithFilteredResult(_0xb00e9d,_0x48c4cf))[_0xb6e9('0x44')](handleError(_0xb00e9d,null));};exports[_0xb6e9('0x45')]=function(_0x5a32e1,_0x5e4698){var _0x516d96={'raw':!![],'where':{'id':_0x5a32e1[_0xb6e9('0x46')]['id']}},_0x5f02ad={};_0x5f02ad['model']=_[_0xb6e9('0x34')](db[_0xb6e9('0x2e')][_0xb6e9('0x2f')]);_0x5f02ad['query']=_[_0xb6e9('0x34')](_0x5a32e1['query']);_0x5f02ad['filters']=_[_0xb6e9('0x36')](_0x5f02ad[_0xb6e9('0x32')],_0x5f02ad['query']);_0x516d96[_0xb6e9('0x37')]=_[_0xb6e9('0x36')](_0x5f02ad[_0xb6e9('0x32')],qs[_0xb6e9('0x38')](_0x5a32e1[_0xb6e9('0x33')][_0xb6e9('0x38')]));_0x516d96[_0xb6e9('0x37')]=_0x516d96[_0xb6e9('0x37')][_0xb6e9('0x39')]?_0x516d96[_0xb6e9('0x37')]:_0x5f02ad['model'];if(_0x5a32e1[_0xb6e9('0x33')][_0xb6e9('0x41')]){_0x516d96[_0xb6e9('0x42')]=[{'all':!![]}];}_0x516d96=_[_0xb6e9('0x3f')]({},_0x516d96,_0x5a32e1[_0xb6e9('0x40')]);return db['SmsQueue']['find'](_0x516d96)['then'](handleEntityNotFound(_0x5e4698,null))[_0xb6e9('0x27')](respondWithResult(_0x5e4698,null))[_0xb6e9('0x44')](handleError(_0x5e4698,null));};exports[_0xb6e9('0x47')]=function(_0x8b0cef,_0x16296b){return db[_0xb6e9('0x2e')][_0xb6e9('0x47')](_0x8b0cef[_0xb6e9('0x48')],{})['then'](function(_0x318608){var _0x5f00cd=_0x8b0cef[_0xb6e9('0x49')][_0xb6e9('0x28')]({'plain':!![]});if(!_0x5f00cd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f00cd[_0xb6e9('0x4a')]==='user'){var _0x7005d1=_0x318608[_0xb6e9('0x28')]({'plain':!![]});var _0x2fdad3=_0xb6e9('0x29');return db[_0xb6e9('0x4b')][_0xb6e9('0x4c')]({'where':{'name':_0x2fdad3,'userProfileId':_0x5f00cd[_0xb6e9('0x4d')]},'raw':!![]})[_0xb6e9('0x27')](function(_0x28dda0){if(_0x28dda0&&_0x28dda0[_0xb6e9('0x4e')]===0x0){return db['UserProfileResource'][_0xb6e9('0x47')]({'name':_0x7005d1[_0xb6e9('0x2a')],'resourceId':_0x7005d1['id'],'type':_0x28dda0[_0xb6e9('0x2a')],'sectionId':_0x28dda0['id']},{})[_0xb6e9('0x27')](function(){return _0x318608;});}else{return _0x318608;}})[_0xb6e9('0x44')](function(_0x226572){logger[_0xb6e9('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x226572);throw _0x226572;});}return _0x318608;})[_0xb6e9('0x27')](respondWithResult(_0x16296b,0xc9))['catch'](handleError(_0x16296b,null));};exports[_0xb6e9('0x26')]=function(_0x2c5c89,_0x39eb23){if(_0x2c5c89['body']['id']){delete _0x2c5c89[_0xb6e9('0x48')]['id'];}return db['SmsQueue'][_0xb6e9('0x4c')]({'where':{'id':_0x2c5c89[_0xb6e9('0x46')]['id']}})[_0xb6e9('0x27')](handleEntityNotFound(_0x39eb23,null))['then'](saveUpdates(_0x2c5c89[_0xb6e9('0x48')],null))[_0xb6e9('0x27')](respondWithResult(_0x39eb23,null))['catch'](handleError(_0x39eb23,null));};exports[_0xb6e9('0x50')]=function(_0x360636,_0x244401){return db[_0xb6e9('0x2e')]['find']({'where':{'id':_0x360636[_0xb6e9('0x46')]['id']}})['then'](handleEntityNotFound(_0x244401,null))[_0xb6e9('0x27')](removeEntity(_0x244401,null))['catch'](handleError(_0x244401,null));};exports['describe']=function(_0x6bde,_0x341a87){return db[_0xb6e9('0x2e')][_0xb6e9('0x51')]()[_0xb6e9('0x27')](respondWithResult(_0x341a87,null))[_0xb6e9('0x44')](handleError(_0x341a87,null));};exports[_0xb6e9('0x52')]=function(_0x524b2c,_0x326df3,_0x40818a){var _0x4cc7fd={'raw':!![],'where':{}},_0x4a53d4={},_0x2e6b37;return db[_0xb6e9('0x2e')][_0xb6e9('0x53')]({'where':{'id':_0x524b2c[_0xb6e9('0x46')]['id']}})['then'](handleEntityNotFound(_0x326df3,null))[_0xb6e9('0x27')](function(_0x44d276){if(_0x44d276){_0x2e6b37=_0x44d276[_0xb6e9('0x28')]({'plain':!![]});_0x4a53d4[_0xb6e9('0x32')]=_['keys'](db['UserSmsQueue']['rawAttributes']);_0x4a53d4[_0xb6e9('0x33')]=_['keys'](_0x524b2c[_0xb6e9('0x33')]);_0x4a53d4['filters']=_['intersection'](_0x4a53d4['model'],_0x4a53d4['query']);_0x4cc7fd[_0xb6e9('0x37')]=_[_0xb6e9('0x36')](_0x4a53d4[_0xb6e9('0x32')],qs[_0xb6e9('0x38')](_0x524b2c[_0xb6e9('0x33')]['fields']));_0x4cc7fd[_0xb6e9('0x37')]=_0x4cc7fd[_0xb6e9('0x37')]['length']?_0x4cc7fd['attributes']:_0x4a53d4['model'];if(!_0x524b2c[_0xb6e9('0x33')][_0xb6e9('0x54')](_0xb6e9('0x55'))){_0x4cc7fd[_0xb6e9('0x21')]=qs['limit'](_0x524b2c[_0xb6e9('0x33')][_0xb6e9('0x21')]);_0x4cc7fd[_0xb6e9('0x1f')]=qs[_0xb6e9('0x1f')](_0x524b2c['query'][_0xb6e9('0x1f')]);}_0x4cc7fd[_0xb6e9('0x56')]=qs[_0xb6e9('0x3a')](_0x524b2c[_0xb6e9('0x33')][_0xb6e9('0x3a')]);_0x4cc7fd[_0xb6e9('0x3b')]=qs['filters'](_[_0xb6e9('0x3c')](_0x524b2c[_0xb6e9('0x33')],_0x4a53d4[_0xb6e9('0x35')]));_0x4cc7fd[_0xb6e9('0x3b')][_0xb6e9('0x57')]=_0x44d276['id'];if(_0x524b2c[_0xb6e9('0x33')]['filter']){_0x4cc7fd[_0xb6e9('0x3b')]=_[_0xb6e9('0x3f')](_0x4cc7fd[_0xb6e9('0x3b')],{'$or':_[_0xb6e9('0x2d')](_0x4cc7fd['attributes'],function(_0x21b99d){var _0x1c8888={};_0x1c8888[_0x21b99d]={'$like':'%'+_0x524b2c[_0xb6e9('0x33')][_0xb6e9('0x3d')]+'%'};return _0x1c8888;})});}_0x4cc7fd=_['merge']({},_0x4cc7fd,_0x524b2c['options']);return db[_0xb6e9('0x58')][_0xb6e9('0x59')](_0x4cc7fd);}})[_0xb6e9('0x27')](function(_0x3d10fb){if(_0x3d10fb){return db['User'][_0xb6e9('0x5a')]({'where':{'id':_[_0xb6e9('0x2d')](_0x3d10fb,_0xb6e9('0x5b')),'role':_0xb6e9('0x5c')},'attributes':['id','name','smsPause',_0xb6e9('0x5d'),_0xb6e9('0x5e')]});}})[_0xb6e9('0x27')](function(_0x6fe6e5){if(_0x6fe6e5){return{'count':_0x6fe6e5[_0xb6e9('0x22')],'rows':_[_0xb6e9('0x2d')](_0x6fe6e5['rows'],function(_0x3e9d7d){return{'membername':_0x3e9d7d[_0xb6e9('0x2a')],'UserId':_0x3e9d7d['id'],'queue_name':_0x2e6b37[_0xb6e9('0x2a')],'SmsQueueId':_0x2e6b37['id'],'interface':util[_0xb6e9('0x5f')](_0xb6e9('0x60'),_0xb6e9('0x61'),_0x3e9d7d[_0xb6e9('0x2a')]),'penalty':0x0,'paused':_0x3e9d7d[_0xb6e9('0x62')],'createdAt':_0x3e9d7d['createdAt'],'updatedAt':_0x3e9d7d[_0xb6e9('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x326df3,_0x4cc7fd))[_0xb6e9('0x44')](handleError(_0x326df3,null));};exports[_0xb6e9('0x63')]=function(_0x424460,_0x4ec69e,_0x52b160){var _0x26332b={};var _0x2b2535={};var _0x1fa262;var _0x1c4f56;return db[_0xb6e9('0x2e')][_0xb6e9('0x53')]({'where':{'id':_0x424460[_0xb6e9('0x46')]['id']}})[_0xb6e9('0x27')](handleEntityNotFound(_0x4ec69e,null))['then'](function(_0xe22824){if(_0xe22824){_0x1fa262=_0xe22824;_0x2b2535[_0xb6e9('0x32')]=_['keys'](db[_0xb6e9('0x64')][_0xb6e9('0x2f')]);_0x2b2535['query']=_[_0xb6e9('0x34')](_0x424460[_0xb6e9('0x33')]);_0x2b2535[_0xb6e9('0x35')]=_[_0xb6e9('0x36')](_0x2b2535[_0xb6e9('0x32')],_0x2b2535[_0xb6e9('0x33')]);_0x26332b['attributes']=_[_0xb6e9('0x36')](_0x2b2535[_0xb6e9('0x32')],qs[_0xb6e9('0x38')](_0x424460[_0xb6e9('0x33')][_0xb6e9('0x38')]));_0x26332b['attributes']=_0x26332b['attributes'][_0xb6e9('0x39')]?_0x26332b[_0xb6e9('0x37')]:_0x2b2535['model'];_0x26332b[_0xb6e9('0x56')]=qs[_0xb6e9('0x3a')](_0x424460['query'][_0xb6e9('0x3a')]);_0x26332b['where']=qs[_0xb6e9('0x35')](_[_0xb6e9('0x3c')](_0x424460['query'],_0x2b2535[_0xb6e9('0x35')]));if(_0x424460[_0xb6e9('0x33')]['filter']){_0x26332b['where']=_['merge'](_0x26332b[_0xb6e9('0x3b')],{'$or':_['map'](_0x26332b[_0xb6e9('0x37')],function(_0x41f573){var _0x5c1be7={};_0x5c1be7[_0x41f573]={'$like':'%'+_0x424460['query'][_0xb6e9('0x3d')]+'%'};return _0x5c1be7;})});}_0x26332b=_[_0xb6e9('0x3f')]({},_0x26332b,_0x424460[_0xb6e9('0x40')]);return _0x1fa262[_0xb6e9('0x63')](_0x26332b);}})['then'](function(_0x4ee803){if(_0x4ee803){_0x1c4f56=_0x4ee803[_0xb6e9('0x39')];if(!_0x424460['query']['hasOwnProperty'](_0xb6e9('0x55'))){_0x26332b['limit']=qs[_0xb6e9('0x21')](_0x424460[_0xb6e9('0x33')]['limit']);_0x26332b[_0xb6e9('0x1f')]=qs['offset'](_0x424460[_0xb6e9('0x33')][_0xb6e9('0x1f')]);}return _0x1fa262['getTeams'](_0x26332b);}})[_0xb6e9('0x27')](function(_0x21001e){if(_0x21001e){return _0x21001e?{'count':_0x1c4f56,'rows':_0x21001e}:null;}})[_0xb6e9('0x27')](respondWithResult(_0x4ec69e,null))['catch'](handleError(_0x4ec69e,null));};exports[_0xb6e9('0x65')]=function(_0x4eadb5,_0xda5c3a,_0x545fe9){var _0x325442=_0x4eadb5['body'][_0xb6e9('0x66')];return db[_0xb6e9('0x64')]['findAll']({'where':{'id':_0x325442},'attributes':['id'],'include':[{'model':db[_0xb6e9('0x67')],'as':_0xb6e9('0x68'),'attributes':['id',_0xb6e9('0x2a'),_0xb6e9('0x69'),_0xb6e9('0x6a'),_0xb6e9('0x6b')],'raw':!![]}]})[_0xb6e9('0x27')](function(_0x32d6af){if(_0x32d6af){var _0x47b558=_[_0xb6e9('0x6c')](_0x32d6af,function(_0x2d086f){var _0x1ce44d=_0x2d086f['get']({'plain':!![]});return _0x1ce44d[_0xb6e9('0x68')];});return db[_0xb6e9('0x2e')]['find']({'where':{'id':_0x4eadb5[_0xb6e9('0x46')]['id']}})[_0xb6e9('0x27')](function(_0xc3ab92){return db['sequelize']['transaction'](function(_0x3464c7){return _0xc3ab92[_0xb6e9('0x65')](_0x325442,{'transaction':_0x3464c7})[_0xb6e9('0x27')](function(){return BPromise[_0xb6e9('0x6d')](_0x47b558,function(_0x17dd59){return db[_0xb6e9('0x58')][_0xb6e9('0x6e')]({'where':{'UserId':_0x17dd59['id'],'SmsQueueId':_0x4eadb5[_0xb6e9('0x46')]['id']},'transaction':_0x3464c7});});})[_0xb6e9('0x27')](function(){_0x47b558['forEach'](function(_0x3dcad5){socket['emit']('userSmsQueue:save',{'UserId':_0x3dcad5['id'],'SmsQueueId':_0xc3ab92['id']});});});});});}})[_0xb6e9('0x27')](respondWithStatusCode(_0xda5c3a,null))['catch'](handleError(_0xda5c3a,null));};exports[_0xb6e9('0x6f')]=function(_0x21fa9e,_0x3a894a,_0x2aa13c){return db[_0xb6e9('0x64')][_0xb6e9('0x59')]({'where':{'id':_0x21fa9e['query'][_0xb6e9('0x66')]},'attributes':['id'],'include':[{'model':db[_0xb6e9('0x67')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb6e9('0x27')](handleEntityNotFound(_0x3a894a,null))['then'](function(_0x53492c){var _0x39aad9=_[_0xb6e9('0x2d')](_0x53492c,'id');var _0x4c2b4f=[];var _0x1167e9=[];var _0x1364d5=squel['select']();_0x1364d5['field']('tq.TeamId')['from'](_0xb6e9('0x70'),'tq')[_0xb6e9('0x71')](_0xb6e9('0x72'),'ut',_0xb6e9('0x73'))[_0xb6e9('0x3b')]('SmsQueueId\x20=\x20?',_0x21fa9e[_0xb6e9('0x46')]['id']);for(var _0x3f621c=0x0;_0x3f621c<_0x53492c[_0xb6e9('0x39')];_0x3f621c+=0x1){let _0xe2215b=_0x53492c[_0x3f621c];for(var _0x1543b2=0x0;_0x1543b2<_0xe2215b['Agents'][_0xb6e9('0x39')];_0x1543b2+=0x1){let _0x498709=_0xe2215b[_0xb6e9('0x68')][_0x1543b2];var _0x35d957=_0x1364d5[_0xb6e9('0x74')]();_0x35d957[_0xb6e9('0x3b')](_0xb6e9('0x75'),_0x498709['id']);_0x1167e9[_0xb6e9('0x76')](db['sequelize'][_0xb6e9('0x33')](_0x35d957[_0xb6e9('0x77')](),{'type':db[_0xb6e9('0x78')][_0xb6e9('0x79')]['SELECT']})['then'](function(_0x23d78f){if(_0x23d78f['length']===0x1){return _0x498709['id'];}else{var _0xb5882e=_[_0xb6e9('0x7a')](_[_0xb6e9('0x2d')](_0x23d78f,'TeamId'),function(_0x5a449c){return _[_0xb6e9('0x7b')](_0x39aad9,_0x5a449c);});if(_0xb5882e){return _0x498709['id'];}}}));}}return BPromise[_0xb6e9('0x7c')](_0x1167e9)[_0xb6e9('0x27')](function(_0x3039a6){_0x4c2b4f=_(_0x4c2b4f)[_0xb6e9('0x7d')](_0x3039a6)['compact']()[_0xb6e9('0x7e')]();return db[_0xb6e9('0x2e')][_0xb6e9('0x4c')]({'where':{'id':_0x21fa9e[_0xb6e9('0x46')]['id']}})['then'](function(_0xb4f6d8){return db[_0xb6e9('0x78')][_0xb6e9('0x7f')](function(_0x11ea98){return _0xb4f6d8[_0xb6e9('0x6f')](_0x21fa9e[_0xb6e9('0x33')][_0xb6e9('0x66')],{'transaction':_0x11ea98})[_0xb6e9('0x27')](function(){if(!_[_0xb6e9('0x80')](_0x4c2b4f)){return _0xb4f6d8[_0xb6e9('0x81')](_0x4c2b4f,{'transaction':_0x11ea98});}})[_0xb6e9('0x27')](function(){_0x4c2b4f['forEach'](function(_0x89efda){socket[_0xb6e9('0x82')]('userSmsQueue:remove',{'UserId':_0x89efda,'SmsQueueId':_0xb4f6d8['id']});});});});});});})[_0xb6e9('0x27')](respondWithStatusCode(_0x3a894a,null))[_0xb6e9('0x44')](handleError(_0x3a894a,null));};exports[_0xb6e9('0x83')]=function(_0x7b7020,_0x494318,_0x3f3b95){return db[_0xb6e9('0x2e')][_0xb6e9('0x4c')]({'where':{'id':_0x7b7020[_0xb6e9('0x46')]['id']}})[_0xb6e9('0x27')](handleEntityNotFound(_0x494318,null))[_0xb6e9('0x27')](function(_0x46899b){if(_0x46899b){return _0x46899b['addAgents'](_0x7b7020['body'][_0xb6e9('0x66')],_[_0xb6e9('0x84')](_0x7b7020['body'],[_0xb6e9('0x66'),'id'])||{})[_0xb6e9('0x85')](function(_0xce668f){for(var _0x4401d1=0x0;_0x4401d1<_0x7b7020[_0xb6e9('0x48')][_0xb6e9('0x66')][_0xb6e9('0x39')];_0x4401d1+=0x1){socket['emit'](_0xb6e9('0x86'),{'UserId':Number(_0x7b7020[_0xb6e9('0x48')]['ids'][_0x4401d1]),'SmsQueueId':Number(_0x7b7020[_0xb6e9('0x46')]['id'])});}return _0xce668f;});}})[_0xb6e9('0x27')](respondWithResult(_0x494318,null))[_0xb6e9('0x44')](handleError(_0x494318,null));};exports[_0xb6e9('0x81')]=function(_0x33d82e,_0x35a55c,_0x11d66e){return db[_0xb6e9('0x2e')]['find']({'where':{'id':_0x33d82e['params']['id']}})['then'](handleEntityNotFound(_0x35a55c,null))['then'](function(_0x437401){if(_0x437401){return _0x437401[_0xb6e9('0x81')](_0x33d82e[_0xb6e9('0x33')][_0xb6e9('0x66')])[_0xb6e9('0x27')](function(){if(_[_0xb6e9('0x87')](_0x33d82e['query'][_0xb6e9('0x66')])){for(var _0x4b32f7=0x0;_0x4b32f7<_0x33d82e[_0xb6e9('0x33')][_0xb6e9('0x66')][_0xb6e9('0x39')];_0x4b32f7+=0x1){socket['emit'](_0xb6e9('0x88'),{'UserId':Number(_0x33d82e[_0xb6e9('0x33')][_0xb6e9('0x66')][_0x4b32f7]),'SmsQueueId':Number(_0x33d82e[_0xb6e9('0x46')]['id'])});}}else{socket[_0xb6e9('0x82')](_0xb6e9('0x88'),{'UserId':Number(_0x33d82e[_0xb6e9('0x33')][_0xb6e9('0x66')]),'SmsQueueId':Number(_0x33d82e[_0xb6e9('0x46')]['id'])});}});}})[_0xb6e9('0x27')](respondWithStatusCode(_0x35a55c,null))[_0xb6e9('0x44')](handleError(_0x35a55c,null));};exports[_0xb6e9('0x89')]=function(_0x32387d,_0xf3e903,_0x4dcaed){var _0x237e73={};var _0x485c6d={};var _0x3b2e62;var _0x52fb79;return db['SmsQueue'][_0xb6e9('0x53')]({'where':{'id':_0x32387d[_0xb6e9('0x46')]['id']}})[_0xb6e9('0x27')](handleEntityNotFound(_0xf3e903,null))[_0xb6e9('0x27')](function(_0x3a01e1){if(_0x3a01e1){_0x3b2e62=_0x3a01e1;_0x485c6d[_0xb6e9('0x32')]=_['keys'](db[_0xb6e9('0x67')][_0xb6e9('0x2f')]);_0x485c6d['query']=_[_0xb6e9('0x34')](_0x32387d[_0xb6e9('0x33')]);_0x485c6d[_0xb6e9('0x35')]=_[_0xb6e9('0x36')](_0x485c6d[_0xb6e9('0x32')],_0x485c6d[_0xb6e9('0x33')]);_0x237e73[_0xb6e9('0x37')]=_[_0xb6e9('0x36')](_0x485c6d[_0xb6e9('0x32')],qs[_0xb6e9('0x38')](_0x32387d[_0xb6e9('0x33')][_0xb6e9('0x38')]));_0x237e73[_0xb6e9('0x37')]=_0x237e73['attributes']['length']?_0x237e73[_0xb6e9('0x37')]:_0x485c6d[_0xb6e9('0x32')];_0x237e73['order']=qs[_0xb6e9('0x3a')](_0x32387d[_0xb6e9('0x33')][_0xb6e9('0x3a')]);_0x237e73[_0xb6e9('0x3b')]=qs[_0xb6e9('0x35')](_[_0xb6e9('0x3c')](_0x32387d[_0xb6e9('0x33')],_0x485c6d[_0xb6e9('0x35')]));if(_0x32387d[_0xb6e9('0x33')][_0xb6e9('0x3d')]){_0x237e73[_0xb6e9('0x3b')]=_[_0xb6e9('0x3f')](_0x237e73[_0xb6e9('0x3b')],{'$or':_[_0xb6e9('0x2d')](_0x237e73[_0xb6e9('0x37')],function(_0x4848e7){var _0x3830af={};_0x3830af[_0x4848e7]={'$like':'%'+_0x32387d[_0xb6e9('0x33')][_0xb6e9('0x3d')]+'%'};return _0x3830af;})});}_0x237e73=_[_0xb6e9('0x3f')]({},_0x237e73,_0x32387d[_0xb6e9('0x40')]);return _0x3b2e62[_0xb6e9('0x89')](_0x237e73);}})[_0xb6e9('0x27')](function(_0x4e8876){if(_0x4e8876){_0x52fb79=_0x4e8876[_0xb6e9('0x39')];if(!_0x32387d[_0xb6e9('0x33')][_0xb6e9('0x54')]('nolimit')){_0x237e73[_0xb6e9('0x21')]=qs[_0xb6e9('0x21')](_0x32387d[_0xb6e9('0x33')]['limit']);_0x237e73['offset']=qs[_0xb6e9('0x1f')](_0x32387d['query']['offset']);}return _0x3b2e62[_0xb6e9('0x89')](_0x237e73);}})['then'](function(_0x518afb){if(_0x518afb){return _0x518afb?{'count':_0x52fb79,'rows':_0x518afb}:null;}})[_0xb6e9('0x27')](respondWithResult(_0xf3e903,null))['catch'](handleError(_0xf3e903,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 358a3bd..f0d6bb5 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 _0x53d8=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x53d8,0x148));var _0x853d=function(_0x442f61,_0x3e77e1){_0x442f61=_0x442f61-0x0;var _0x3c31f1=_0x53d8[_0x442f61];return _0x3c31f1;};'use strict';var EventEmitter=require(_0x853d('0x0'));var SmsQueue=require(_0x853d('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x853d('0x2'),'afterUpdate':_0x853d('0x3'),'afterDestroy':_0x853d('0x4')};function emitEvent(_0x17de88){return function(_0x33e282,_0x168d60,_0x294ea2){SmsQueueEvents[_0x853d('0x5')](_0x17de88+':'+_0x33e282['id'],_0x33e282);SmsQueueEvents[_0x853d('0x5')](_0x17de88,_0x33e282);_0x294ea2(null);};}for(var e in events){if(events[_0x853d('0x6')](e)){var event=events[e];SmsQueue[_0x853d('0x7')](e,emitEvent(event));}}module[_0x853d('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0xd757=['remove','emit','hasOwnProperty','exports','events','SmsQueue','setMaxListeners','save'];(function(_0x13eec4,_0x1530ac){var _0x47301a=function(_0x585b7e){while(--_0x585b7e){_0x13eec4['push'](_0x13eec4['shift']());}};_0x47301a(++_0x1530ac);}(_0xd757,0x18c));var _0x7d75=function(_0x3e9eac,_0x4c5c7e){_0x3e9eac=_0x3e9eac-0x0;var _0x5eb2c3=_0xd757[_0x3e9eac];return _0x5eb2c3;};'use strict';var EventEmitter=require(_0x7d75('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x7d75('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x7d75('0x2')](0x0);var events={'afterCreate':_0x7d75('0x3'),'afterUpdate':'update','afterDestroy':_0x7d75('0x4')};function emitEvent(_0x18d196){return function(_0x3f82a5,_0x55934d,_0x1e7da5){SmsQueueEvents[_0x7d75('0x5')](_0x18d196+':'+_0x3f82a5['id'],_0x3f82a5);SmsQueueEvents['emit'](_0x18d196,_0x3f82a5);_0x1e7da5(null);};}for(var e in events){if(events[_0x7d75('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x7d75('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 3f5fabc..0a02553 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 _0x287f=['bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','SmsQueue','sms_queues','lodash','util','../../config/logger','moment'];(function(_0x2891d1,_0x2ddd3e){var _0x486948=function(_0x13fa0f){while(--_0x13fa0f){_0x2891d1['push'](_0x2891d1['shift']());}};_0x486948(++_0x2ddd3e);}(_0x287f,0x1a9));var _0xf287=function(_0xe38c3d,_0x5d4c2c){_0xe38c3d=_0xe38c3d-0x0;var _0x453676=_0x287f[_0xe38c3d];return _0x453676;};'use strict';var _=require(_0xf287('0x0'));var util=require(_0xf287('0x1'));var logger=require(_0xf287('0x2'))('api');var moment=require(_0xf287('0x3'));var BPromise=require(_0xf287('0x4'));var rp=require(_0xf287('0x5'));var fs=require('fs');var path=require(_0xf287('0x6'));var rimraf=require(_0xf287('0x7'));var config=require(_0xf287('0x8'));var attributes=require(_0xf287('0x9'));module[_0xf287('0xa')]=function(_0x4147f2,_0x508be6){return _0x4147f2['define'](_0xf287('0xb'),attributes,{'tableName':_0xf287('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2427=['rimraf','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2427,0x1b6));var _0x7242=function(_0x129c02,_0x11b13f){_0x129c02=_0x129c02-0x0;var _0x1eb079=_0x2427[_0x129c02];return _0x1eb079;};'use strict';var _=require('lodash');var util=require(_0x7242('0x0'));var logger=require(_0x7242('0x1'))('api');var moment=require(_0x7242('0x2'));var BPromise=require(_0x7242('0x3'));var rp=require(_0x7242('0x4'));var fs=require('fs');var path=require(_0x7242('0x5'));var rimraf=require(_0x7242('0x6'));var config=require('../../config/environment');var attributes=require(_0x7242('0x7'));module[_0x7242('0x8')]=function(_0x52370b,_0x210fb2){return _0x52370b[_0x7242('0x9')](_0x7242('0xa'),attributes,{'tableName':_0x7242('0xb'),'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 3a7a7e0..ed36623 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 _0x0280=['attributes','limit','include','map','model','ShowSmsQueue','find','where','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw'];(function(_0x558ff7,_0x2dc4a5){var _0x18158f=function(_0x53b6fb){while(--_0x53b6fb){_0x558ff7['push'](_0x558ff7['shift']());}};_0x18158f(++_0x2dc4a5);}(_0x0280,0xa0));var _0x0028=function(_0x4bd240,_0x9750cd){_0x4bd240=_0x4bd240-0x0;var _0x46a0bc=_0x0280[_0x4bd240];return _0x46a0bc;};'use strict';var _=require('lodash');var util=require(_0x0028('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0028('0x1'));var fs=require('fs');var Redis=require(_0x0028('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0028('0x3'));var logger=require(_0x0028('0x4'))(_0x0028('0x5'));var config=require('../../config/environment');var jayson=require(_0x0028('0x6'));var client=jayson[_0x0028('0x7')][_0x0028('0x8')]({'port':0x232a});config[_0x0028('0x9')]=_[_0x0028('0xa')](config[_0x0028('0x9')],{'host':_0x0028('0xb'),'port':0x18eb});var socket=require(_0x0028('0xc'))(new Redis(config['redis']));require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0xd8ae29,_0x4697db,_0x5a3eb6){return new BPromise(function(_0x7befb3,_0x3219af){return client[_0x0028('0xd')](_0xd8ae29,_0x5a3eb6)[_0x0028('0xe')](function(_0x8684a3){logger['info'](_0x0028('0xf'),_0x4697db,_0x0028('0x10'));logger[_0x0028('0x11')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x4697db,_0x0028('0x10'),JSON[_0x0028('0x12')](_0x8684a3));if(_0x8684a3['error']){if(_0x8684a3[_0x0028('0x13')][_0x0028('0x14')]===0x1f4){logger[_0x0028('0x13')](_0x0028('0xf'),_0x4697db,_0x8684a3[_0x0028('0x13')][_0x0028('0x15')]);return _0x3219af(_0x8684a3[_0x0028('0x13')][_0x0028('0x15')]);}logger[_0x0028('0x13')]('SmsQueue,\x20%s,\x20%s',_0x4697db,_0x8684a3[_0x0028('0x13')]['message']);return _0x7befb3(_0x8684a3[_0x0028('0x13')][_0x0028('0x15')]);}else{logger[_0x0028('0x16')](_0x0028('0xf'),_0x4697db,'request\x20sent');_0x7befb3(_0x8684a3[_0x0028('0x17')]['message']);}})[_0x0028('0x18')](function(_0x1f0e74){logger[_0x0028('0x13')](_0x0028('0xf'),_0x4697db,_0x1f0e74);_0x3219af(_0x1f0e74);});});}exports[_0x0028('0x19')]=function(_0xcafc23){var _0x3d9e99=this;return new Promise(function(_0x473257,_0x43565c){return db[_0x0028('0x1a')][_0x0028('0x1b')]({'raw':_0xcafc23[_0x0028('0x1c')]?_0xcafc23[_0x0028('0x1c')][_0x0028('0x1d')]===undefined?!![]:![]:!![],'where':_0xcafc23[_0x0028('0x1c')]?_0xcafc23['options']['where']||null:null,'attributes':_0xcafc23[_0x0028('0x1c')]?_0xcafc23[_0x0028('0x1c')][_0x0028('0x1e')]||null:null,'limit':_0xcafc23['options']?_0xcafc23[_0x0028('0x1c')][_0x0028('0x1f')]||null:null,'include':_0xcafc23[_0x0028('0x1c')]?_0xcafc23[_0x0028('0x1c')][_0x0028('0x20')]?_[_0x0028('0x21')](_0xcafc23[_0x0028('0x1c')]['include'],function(_0x5af558){return{'model':db[_0x5af558[_0x0028('0x22')]],'as':_0x5af558['as'],'attributes':_0x5af558['attributes'],'include':_0x5af558[_0x0028('0x20')]?_[_0x0028('0x21')](_0x5af558[_0x0028('0x20')],function(_0xbd193b){return{'model':db[_0xbd193b[_0x0028('0x22')]],'as':_0xbd193b['as'],'attributes':_0xbd193b['attributes'],'include':_0xbd193b[_0x0028('0x20')]?_[_0x0028('0x21')](_0xbd193b[_0x0028('0x20')],function(_0x5063d6){return{'model':db[_0x5063d6[_0x0028('0x22')]],'as':_0x5063d6['as'],'attributes':_0x5063d6[_0x0028('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb0d2cb){logger[_0x0028('0x16')](_0x0028('0x19'),_0xcafc23);logger[_0x0028('0x11')]('GetSmsQueue',_0xcafc23,JSON[_0x0028('0x12')](_0xb0d2cb));_0x473257(_0xb0d2cb);})[_0x0028('0x18')](function(_0x5bc6d8){logger[_0x0028('0x13')](_0x0028('0x19'),_0x5bc6d8['message'],_0xcafc23);_0x43565c(_0x3d9e99[_0x0028('0x13')](0x1f4,_0x5bc6d8[_0x0028('0x15')]));});});};exports[_0x0028('0x23')]=function(_0x518366){var _0x47e594=this;return new Promise(function(_0x152033,_0x33048f){return db['SmsQueue'][_0x0028('0x24')]({'raw':_0x518366[_0x0028('0x1c')]?_0x518366[_0x0028('0x1c')][_0x0028('0x1d')]===undefined?!![]:![]:!![],'where':_0x518366['options']?_0x518366['options'][_0x0028('0x25')]||null:null,'attributes':_0x518366['options']?_0x518366[_0x0028('0x1c')]['attributes']||null:null,'include':_0x518366[_0x0028('0x1c')]?_0x518366[_0x0028('0x1c')][_0x0028('0x20')]?_[_0x0028('0x21')](_0x518366[_0x0028('0x1c')]['include'],function(_0x4907e3){return{'model':db[_0x4907e3[_0x0028('0x22')]],'as':_0x4907e3['as'],'attributes':_0x4907e3['attributes'],'include':_0x4907e3['include']?_['map'](_0x4907e3[_0x0028('0x20')],function(_0x1ba787){return{'model':db[_0x1ba787[_0x0028('0x22')]],'as':_0x1ba787['as'],'attributes':_0x1ba787[_0x0028('0x1e')],'include':_0x1ba787[_0x0028('0x20')]?_[_0x0028('0x21')](_0x1ba787[_0x0028('0x20')],function(_0x1640df){return{'model':db[_0x1640df[_0x0028('0x22')]],'as':_0x1640df['as'],'attributes':_0x1640df[_0x0028('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0028('0xe')](function(_0x5601bd){logger[_0x0028('0x16')](_0x0028('0x23'),_0x518366);logger[_0x0028('0x11')](_0x0028('0x23'),_0x518366,JSON[_0x0028('0x12')](_0x5601bd));_0x152033(_0x5601bd);})[_0x0028('0x18')](function(_0x2f9fb5){logger[_0x0028('0x13')]('ShowSmsQueue',_0x2f9fb5[_0x0028('0x15')],_0x518366);_0x33048f(_0x47e594[_0x0028('0x13')](0x1f4,_0x2f9fb5[_0x0028('0x15')]));});});}; \ No newline at end of file +var _0x9ccb=['localhost','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','limit','include','map','model','ShowSmsQueue','find','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x32e193,_0x421666){var _0x2ba20a=function(_0x1bd6bf){while(--_0x1bd6bf){_0x32e193['push'](_0x32e193['shift']());}};_0x2ba20a(++_0x421666);}(_0x9ccb,0x1ea));var _0xb9cc=function(_0x1f5249,_0x5c4c86){_0x1f5249=_0x1f5249-0x0;var _0x20e223=_0x9ccb[_0x1f5249];return _0x20e223;};'use strict';var _=require('lodash');var util=require(_0xb9cc('0x0'));var moment=require(_0xb9cc('0x1'));var BPromise=require(_0xb9cc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb9cc('0x3'));var db=require(_0xb9cc('0x4'))['db'];var utils=require(_0xb9cc('0x5'));var logger=require(_0xb9cc('0x6'))(_0xb9cc('0x7'));var config=require(_0xb9cc('0x8'));var jayson=require(_0xb9cc('0x9'));var client=jayson[_0xb9cc('0xa')][_0xb9cc('0xb')]({'port':0x232a});config[_0xb9cc('0xc')]=_[_0xb9cc('0xd')](config[_0xb9cc('0xc')],{'host':_0xb9cc('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb9cc('0xc')]));require(_0xb9cc('0xf'))[_0xb9cc('0x10')](socket);function respondWithRpcPromise(_0xc05a73,_0x4e116b,_0x4a07f2){return new BPromise(function(_0x1b6e11,_0x51fb1b){return client[_0xb9cc('0x11')](_0xc05a73,_0x4a07f2)[_0xb9cc('0x12')](function(_0x1ac2fc){logger[_0xb9cc('0x13')](_0xb9cc('0x14'),_0x4e116b,_0xb9cc('0x15'));logger['debug'](_0xb9cc('0x16'),_0x4e116b,_0xb9cc('0x15'),JSON[_0xb9cc('0x17')](_0x1ac2fc));if(_0x1ac2fc[_0xb9cc('0x18')]){if(_0x1ac2fc[_0xb9cc('0x18')][_0xb9cc('0x19')]===0x1f4){logger['error'](_0xb9cc('0x14'),_0x4e116b,_0x1ac2fc[_0xb9cc('0x18')][_0xb9cc('0x1a')]);return _0x51fb1b(_0x1ac2fc[_0xb9cc('0x18')][_0xb9cc('0x1a')]);}logger[_0xb9cc('0x18')]('SmsQueue,\x20%s,\x20%s',_0x4e116b,_0x1ac2fc[_0xb9cc('0x18')][_0xb9cc('0x1a')]);return _0x1b6e11(_0x1ac2fc[_0xb9cc('0x18')][_0xb9cc('0x1a')]);}else{logger[_0xb9cc('0x13')](_0xb9cc('0x14'),_0x4e116b,_0xb9cc('0x15'));_0x1b6e11(_0x1ac2fc[_0xb9cc('0x1b')]['message']);}})[_0xb9cc('0x1c')](function(_0x14b459){logger[_0xb9cc('0x18')](_0xb9cc('0x14'),_0x4e116b,_0x14b459);_0x51fb1b(_0x14b459);});});}exports[_0xb9cc('0x1d')]=function(_0x54bdf4){var _0xf84e6f=this;return new Promise(function(_0x590a4d,_0x462dd5){return db[_0xb9cc('0x1e')][_0xb9cc('0x1f')]({'raw':_0x54bdf4[_0xb9cc('0x20')]?_0x54bdf4['options'][_0xb9cc('0x21')]===undefined?!![]:![]:!![],'where':_0x54bdf4['options']?_0x54bdf4[_0xb9cc('0x20')]['where']||null:null,'attributes':_0x54bdf4[_0xb9cc('0x20')]?_0x54bdf4[_0xb9cc('0x20')][_0xb9cc('0x22')]||null:null,'limit':_0x54bdf4[_0xb9cc('0x20')]?_0x54bdf4[_0xb9cc('0x20')][_0xb9cc('0x23')]||null:null,'include':_0x54bdf4[_0xb9cc('0x20')]?_0x54bdf4[_0xb9cc('0x20')][_0xb9cc('0x24')]?_[_0xb9cc('0x25')](_0x54bdf4[_0xb9cc('0x20')][_0xb9cc('0x24')],function(_0x2abc5c){return{'model':db[_0x2abc5c[_0xb9cc('0x26')]],'as':_0x2abc5c['as'],'attributes':_0x2abc5c[_0xb9cc('0x22')],'include':_0x2abc5c[_0xb9cc('0x24')]?_[_0xb9cc('0x25')](_0x2abc5c['include'],function(_0x967adb){return{'model':db[_0x967adb[_0xb9cc('0x26')]],'as':_0x967adb['as'],'attributes':_0x967adb[_0xb9cc('0x22')],'include':_0x967adb[_0xb9cc('0x24')]?_['map'](_0x967adb[_0xb9cc('0x24')],function(_0x27f4a5){return{'model':db[_0x27f4a5['model']],'as':_0x27f4a5['as'],'attributes':_0x27f4a5['attributes']};}):[]};}):[]};}):[]:[]})[_0xb9cc('0x12')](function(_0x2dab2d){logger['info'](_0xb9cc('0x1d'),_0x54bdf4);logger['debug'](_0xb9cc('0x1d'),_0x54bdf4,JSON['stringify'](_0x2dab2d));_0x590a4d(_0x2dab2d);})[_0xb9cc('0x1c')](function(_0x376ed8){logger[_0xb9cc('0x18')](_0xb9cc('0x1d'),_0x376ed8[_0xb9cc('0x1a')],_0x54bdf4);_0x462dd5(_0xf84e6f[_0xb9cc('0x18')](0x1f4,_0x376ed8[_0xb9cc('0x1a')]));});});};exports[_0xb9cc('0x27')]=function(_0x26d1f3){var _0xefa815=this;return new Promise(function(_0xc0371b,_0x4910cd){return db[_0xb9cc('0x1e')][_0xb9cc('0x28')]({'raw':_0x26d1f3[_0xb9cc('0x20')]?_0x26d1f3[_0xb9cc('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x26d1f3['options']?_0x26d1f3['options'][_0xb9cc('0x29')]||null:null,'attributes':_0x26d1f3[_0xb9cc('0x20')]?_0x26d1f3['options'][_0xb9cc('0x22')]||null:null,'include':_0x26d1f3[_0xb9cc('0x20')]?_0x26d1f3[_0xb9cc('0x20')][_0xb9cc('0x24')]?_[_0xb9cc('0x25')](_0x26d1f3[_0xb9cc('0x20')]['include'],function(_0x2d7345){return{'model':db[_0x2d7345[_0xb9cc('0x26')]],'as':_0x2d7345['as'],'attributes':_0x2d7345['attributes'],'include':_0x2d7345[_0xb9cc('0x24')]?_[_0xb9cc('0x25')](_0x2d7345['include'],function(_0x2c7f5f){return{'model':db[_0x2c7f5f['model']],'as':_0x2c7f5f['as'],'attributes':_0x2c7f5f['attributes'],'include':_0x2c7f5f[_0xb9cc('0x24')]?_[_0xb9cc('0x25')](_0x2c7f5f[_0xb9cc('0x24')],function(_0x30fcf6){return{'model':db[_0x30fcf6[_0xb9cc('0x26')]],'as':_0x30fcf6['as'],'attributes':_0x30fcf6[_0xb9cc('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb9cc('0x12')](function(_0x183851){logger[_0xb9cc('0x13')](_0xb9cc('0x27'),_0x26d1f3);logger['debug'](_0xb9cc('0x27'),_0x26d1f3,JSON[_0xb9cc('0x17')](_0x183851));_0xc0371b(_0x183851);})[_0xb9cc('0x1c')](function(_0x54db24){logger[_0xb9cc('0x18')]('ShowSmsQueue',_0x54db24['message'],_0x26d1f3);_0x4910cd(_0xefa815['error'](0x1f4,_0x54db24['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 2822e99..25d7f47 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 _0x77da=['save','remove','update','emit','removeListener','length','smsQueue:'];(function(_0x5a8461,_0x5ec595){var _0x394399=function(_0x201f48){while(--_0x201f48){_0x5a8461['push'](_0x5a8461['shift']());}};_0x394399(++_0x5ec595);}(_0x77da,0x1ce));var _0xa77d=function(_0x52e023,_0x3ac3c0){_0x52e023=_0x52e023-0x0;var _0x490da7=_0x77da[_0x52e023];return _0x490da7;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xa77d('0x0'),_0xa77d('0x1'),_0xa77d('0x2')];function createListener(_0x52f16f,_0x2d74ce){return function(_0x4c2493){_0x2d74ce[_0xa77d('0x3')](_0x52f16f,_0x4c2493);};}function removeListener(_0x2cddc2,_0x5e3b76){return function(){SmsQueueEvents[_0xa77d('0x4')](_0x2cddc2,_0x5e3b76);};}exports['register']=function(_0x4974da){for(var _0x2b5f83=0x0,_0x5d85b5=events[_0xa77d('0x5')];_0x2b5f83<_0x5d85b5;_0x2b5f83++){var _0x6f5ef4=events[_0x2b5f83];var _0x4f5a0c=createListener(_0xa77d('0x6')+_0x6f5ef4,_0x4974da);SmsQueueEvents['on'](_0x6f5ef4,_0x4f5a0c);}}; \ No newline at end of file +var _0x4966=['save','remove','update','emit','removeListener','register','length','smsQueue:'];(function(_0x3789e7,_0xec9a48){var _0x233332=function(_0x18148f){while(--_0x18148f){_0x3789e7['push'](_0x3789e7['shift']());}};_0x233332(++_0xec9a48);}(_0x4966,0x90));var _0x6496=function(_0x1879a4,_0x581a4a){_0x1879a4=_0x1879a4-0x0;var _0x38e837=_0x4966[_0x1879a4];return _0x38e837;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x6496('0x0'),_0x6496('0x1'),_0x6496('0x2')];function createListener(_0x266147,_0x30531a){return function(_0x2da1c5){_0x30531a[_0x6496('0x3')](_0x266147,_0x2da1c5);};}function removeListener(_0x2553df,_0x37f95b){return function(){SmsQueueEvents[_0x6496('0x4')](_0x2553df,_0x37f95b);};}exports[_0x6496('0x5')]=function(_0x76662d){for(var _0x2d0a5d=0x0,_0x539cd2=events[_0x6496('0x6')];_0x2d0a5d<_0x539cd2;_0x2d0a5d++){var _0x28ab68=events[_0x2d0a5d];var _0x5d2127=createListener(_0x6496('0x7')+_0x28ab68,_0x76662d);SmsQueueEvents['on'](_0x28ab68,_0x5d2127);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 380d5a5..9051a0e 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 _0x9055=['update','delete','/:id','destroy','exports','multer','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','post','create','put'];(function(_0x340535,_0x35992e){var _0x51b584=function(_0x2e4cfa){while(--_0x2e4cfa){_0x340535['push'](_0x340535['shift']());}};_0x51b584(++_0x35992e);}(_0x9055,0x1eb));var _0x5905=function(_0xf63d4e,_0xbc63d6){_0xf63d4e=_0xf63d4e-0x0;var _0x4aa0d3=_0x9055[_0xf63d4e];return _0x4aa0d3;};'use strict';var multer=require(_0x5905('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5905('0x1')]();var fs_extra=require(_0x5905('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x5905('0x3'));var config=require(_0x5905('0x4'));var controller=require(_0x5905('0x5'));router[_0x5905('0x6')]('/',auth[_0x5905('0x7')](),controller[_0x5905('0x8')]);router[_0x5905('0x6')](_0x5905('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x5905('0x6')]('/:id',auth[_0x5905('0x7')](),controller['show']);router[_0x5905('0xa')]('/',auth['isAuthenticated'](),controller[_0x5905('0xb')]);router[_0x5905('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x5905('0xd')]);router[_0x5905('0xe')](_0x5905('0xf'),auth['isAuthenticated'](),controller[_0x5905('0x10')]);module[_0x5905('0x11')]=router; \ No newline at end of file +var _0x9d36=['put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','/describe','isAuthenticated','/:id','show','post','create'];(function(_0x5c4777,_0x3022fe){var _0x3e9643=function(_0x2c9594){while(--_0x2c9594){_0x5c4777['push'](_0x5c4777['shift']());}};_0x3e9643(++_0x3022fe);}(_0x9d36,0x68));var _0x69d3=function(_0x5b2160,_0x345745){_0x5b2160=_0x5b2160-0x0;var _0x4a6bc1=_0x9d36[_0x5b2160];return _0x4a6bc1;};'use strict';var multer=require(_0x69d3('0x0'));var util=require(_0x69d3('0x1'));var path=require(_0x69d3('0x2'));var timeout=require('connect-timeout');var express=require(_0x69d3('0x3'));var router=express[_0x69d3('0x4')]();var fs_extra=require(_0x69d3('0x5'));var auth=require(_0x69d3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x69d3('0x7'));var controller=require(_0x69d3('0x8'));router[_0x69d3('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x69d3('0x9')](_0x69d3('0xa'),auth[_0x69d3('0xb')](),controller['describe']);router[_0x69d3('0x9')](_0x69d3('0xc'),auth[_0x69d3('0xb')](),controller[_0x69d3('0xd')]);router[_0x69d3('0xe')]('/',auth[_0x69d3('0xb')](),controller[_0x69d3('0xf')]);router[_0x69d3('0x10')](_0x69d3('0xc'),auth[_0x69d3('0xb')](),controller[_0x69d3('0x11')]);router['delete'](_0x69d3('0xc'),auth[_0x69d3('0xb')](),controller[_0x69d3('0x12')]);module[_0x69d3('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 0fc0f79..5721f2c 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 _0x7c40=['moment','sequelize','exports','STRING','DATE'];(function(_0x4cd21d,_0x51db37){var _0x229b1=function(_0x2e1410){while(--_0x2e1410){_0x4cd21d['push'](_0x4cd21d['shift']());}};_0x229b1(++_0x51db37);}(_0x7c40,0x12c));var _0x07c4=function(_0x4c391a,_0x28b3d0){_0x4c391a=_0x4c391a-0x0;var _0x2930b9=_0x7c40[_0x4c391a];return _0x2930b9;};'use strict';var moment=require(_0x07c4('0x0'));var Sequelize=require(_0x07c4('0x1'));module[_0x07c4('0x2')]={'uniqueid':{'type':Sequelize[_0x07c4('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x07c4('0x3')]},'joinAt':{'type':Sequelize[_0x07c4('0x4')]},'leaveAt':{'type':Sequelize[_0x07c4('0x4')]},'acceptAt':{'type':Sequelize[_0x07c4('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x07c4('0x3')]}}; \ No newline at end of file +var _0x277c=['exports','STRING','DATE','moment'];(function(_0x23159d,_0x2785fa){var _0x31d0b5=function(_0x213c0f){while(--_0x213c0f){_0x23159d['push'](_0x23159d['shift']());}};_0x31d0b5(++_0x2785fa);}(_0x277c,0x153));var _0xc277=function(_0x397e41,_0x48b621){_0x397e41=_0x397e41-0x0;var _0x2f9cd0=_0x277c[_0x397e41];return _0x2f9cd0;};'use strict';var moment=require(_0xc277('0x0'));var Sequelize=require('sequelize');module[_0xc277('0x1')]={'uniqueid':{'type':Sequelize[_0xc277('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc277('0x2')]},'joinAt':{'type':Sequelize[_0xc277('0x3')]},'leaveAt':{'type':Sequelize[_0xc277('0x3')]},'acceptAt':{'type':Sequelize[_0xc277('0x3')]},'exitAt':{'type':Sequelize[_0xc277('0x3')]},'reason':{'type':Sequelize[_0xc277('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 6e8bbce..f79f15d 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 _0xbeb6=['fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SmsQueueReport','catch','show','keys','include','create','body','find','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','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/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes'];(function(_0x35d8af,_0x14fd75){var _0x1d08b0=function(_0x36b437){while(--_0x36b437){_0x35d8af['push'](_0x35d8af['shift']());}};_0x1d08b0(++_0x14fd75);}(_0xbeb6,0x196));var _0x6beb=function(_0x231400,_0x1c271b){_0x231400=_0x231400-0x0;var _0xb3bd2e=_0xbeb6[_0x231400];return _0xb3bd2e;};'use strict';var emlformat=require(_0x6beb('0x0'));var rimraf=require(_0x6beb('0x1'));var zipdir=require(_0x6beb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6beb('0x3'));var BPromise=require(_0x6beb('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6beb('0x5'));var ejs=require(_0x6beb('0x6'));var fs=require('fs');var fs_extra=require(_0x6beb('0x7'));var _=require(_0x6beb('0x8'));var squel=require('squel');var crypto=require(_0x6beb('0x9'));var jsforce=require(_0x6beb('0xa'));var deskjs=require(_0x6beb('0xb'));var toCsv=require(_0x6beb('0x5'));var querystring=require(_0x6beb('0xc'));var Papa=require(_0x6beb('0xd'));var Redis=require(_0x6beb('0xe'));var authService=require(_0x6beb('0xf'));var qs=require(_0x6beb('0x10'));var as=require(_0x6beb('0x11'));var hardwareService=require(_0x6beb('0x12'));var logger=require(_0x6beb('0x13'))(_0x6beb('0x14'));var utils=require(_0x6beb('0x15'));var config=require(_0x6beb('0x16'));var licenseUtil=require(_0x6beb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f0f6e,_0x4b7683){_0x4b7683=_0x4b7683||0xcc;return function(_0x1a6f41){if(_0x1a6f41){return _0x3f0f6e['sendStatus'](_0x4b7683);}return _0x3f0f6e[_0x6beb('0x18')](_0x4b7683)[_0x6beb('0x19')]();};}function respondWithResult(_0x57877e,_0xb39fe3){_0xb39fe3=_0xb39fe3||0xc8;return function(_0x1ef5cb){if(_0x1ef5cb){return _0x57877e[_0x6beb('0x18')](_0xb39fe3)[_0x6beb('0x1a')](_0x1ef5cb);}};}function respondWithFilteredResult(_0x5d6a53,_0x2840d3){return function(_0x2738e7){if(_0x2738e7){var _0x41b0ee=typeof _0x2840d3[_0x6beb('0x1b')]===_0x6beb('0x1c')&&typeof _0x2840d3[_0x6beb('0x1d')]===_0x6beb('0x1c');var _0x3ec4e2=_0x2738e7['count'];var _0x513441=_0x41b0ee?0x0:_0x2840d3[_0x6beb('0x1b')];var _0x76269=_0x41b0ee?_0x2738e7[_0x6beb('0x1e')]:_0x2840d3[_0x6beb('0x1b')]+_0x2840d3['limit'];var _0x59c775;if(_0x76269>=_0x3ec4e2){_0x76269=_0x3ec4e2;_0x59c775=0xc8;}else{_0x59c775=0xce;}_0x5d6a53[_0x6beb('0x18')](_0x59c775);return _0x5d6a53[_0x6beb('0x1f')](_0x6beb('0x20'),_0x513441+'-'+_0x76269+'/'+_0x3ec4e2)[_0x6beb('0x1a')](_0x2738e7);}return null;};}function patchUpdates(_0x513bee){return function(_0xf135db){try{jsonpatch[_0x6beb('0x21')](_0xf135db,_0x513bee,!![]);}catch(_0x1e1e3c){return BPromise[_0x6beb('0x22')](_0x1e1e3c);}return _0xf135db[_0x6beb('0x23')]();};}function saveUpdates(_0x2b898a,_0x30bb8b){return function(_0x466268){if(_0x466268){return _0x466268[_0x6beb('0x24')](_0x2b898a)[_0x6beb('0x25')](function(_0x28a76d){return _0x28a76d;});}return null;};}function removeEntity(_0x403f6e,_0x27faa0){return function(_0x5a13e2){if(_0x5a13e2){return _0x5a13e2[_0x6beb('0x26')]()[_0x6beb('0x25')](function(){_0x403f6e[_0x6beb('0x18')](0xcc)[_0x6beb('0x19')]();});}};}function handleEntityNotFound(_0x22c83f,_0x395a1d){return function(_0x1304c3){if(!_0x1304c3){_0x22c83f['sendStatus'](0x194);}return _0x1304c3;};}function handleError(_0x53867e,_0x1ee0d6){_0x1ee0d6=_0x1ee0d6||0x1f4;return function(_0x4005c9){logger[_0x6beb('0x27')](_0x4005c9['stack']);if(_0x4005c9[_0x6beb('0x28')]){delete _0x4005c9[_0x6beb('0x28')];}_0x53867e[_0x6beb('0x18')](_0x1ee0d6)[_0x6beb('0x29')](_0x4005c9);};}exports[_0x6beb('0x2a')]=function(_0xd052b5,_0x49e80a){var _0x40a79e={},_0x276384={},_0x49ba5e={'count':0x0,'rows':[]};var _0x453ab5=_['map'](db['SmsQueueReport'][_0x6beb('0x2b')],function(_0x5ab7c7){return{'name':_0x5ab7c7[_0x6beb('0x2c')],'type':_0x5ab7c7[_0x6beb('0x2d')][_0x6beb('0x2e')]};});_0x276384[_0x6beb('0x2f')]=_[_0x6beb('0x30')](_0x453ab5,'name');_0x276384[_0x6beb('0x31')]=_['keys'](_0xd052b5[_0x6beb('0x31')]);_0x276384[_0x6beb('0x32')]=_['intersection'](_0x276384[_0x6beb('0x2f')],_0x276384[_0x6beb('0x31')]);_0x40a79e[_0x6beb('0x33')]=_[_0x6beb('0x34')](_0x276384[_0x6beb('0x2f')],qs['fields'](_0xd052b5[_0x6beb('0x31')][_0x6beb('0x35')]));_0x40a79e[_0x6beb('0x33')]=_0x40a79e[_0x6beb('0x33')][_0x6beb('0x36')]?_0x40a79e[_0x6beb('0x33')]:_0x276384[_0x6beb('0x2f')];if(!_0xd052b5['query'][_0x6beb('0x37')](_0x6beb('0x38'))){_0x40a79e[_0x6beb('0x1d')]=qs[_0x6beb('0x1d')](_0xd052b5['query']['limit']);_0x40a79e[_0x6beb('0x1b')]=qs[_0x6beb('0x1b')](_0xd052b5[_0x6beb('0x31')][_0x6beb('0x1b')]);}_0x40a79e[_0x6beb('0x39')]=qs[_0x6beb('0x3a')](_0xd052b5[_0x6beb('0x31')]['sort']);_0x40a79e[_0x6beb('0x3b')]=qs[_0x6beb('0x32')](_[_0x6beb('0x3c')](_0xd052b5['query'],_0x276384[_0x6beb('0x32')]),_0x453ab5);if(_0xd052b5[_0x6beb('0x31')][_0x6beb('0x3d')]){_0x40a79e[_0x6beb('0x3b')]=_[_0x6beb('0x3e')](_0x40a79e[_0x6beb('0x3b')],{'$or':_['map'](_0x453ab5,function(_0x3d5e59){if(_0x3d5e59[_0x6beb('0x2d')]!==_0x6beb('0x3f')){var _0x1b3889={};_0x1b3889[_0x3d5e59[_0x6beb('0x28')]]={'$like':'%'+_0xd052b5['query']['filter']+'%'};return _0x1b3889;}})});}_0x40a79e=_[_0x6beb('0x3e')]({},_0x40a79e,_0xd052b5[_0x6beb('0x40')]);var _0x16e763={'where':_0x40a79e['where']};return db['SmsQueueReport'][_0x6beb('0x1e')](_0x16e763)[_0x6beb('0x25')](function(_0x53636c){_0x49ba5e[_0x6beb('0x1e')]=_0x53636c;if(_0xd052b5[_0x6beb('0x31')]['includeAll']){_0x40a79e['include']=[{'all':!![]}];}return db[_0x6beb('0x41')]['findAll'](_0x40a79e);})[_0x6beb('0x25')](function(_0x8a1faf){_0x49ba5e['rows']=_0x8a1faf;return _0x49ba5e;})[_0x6beb('0x25')](respondWithFilteredResult(_0x49e80a,_0x40a79e))[_0x6beb('0x42')](handleError(_0x49e80a,null));};exports[_0x6beb('0x43')]=function(_0x3fc30a,_0x237277){var _0x14fd11={'raw':!![],'where':{'id':_0x3fc30a['params']['id']}},_0x1fe7ff={};_0x1fe7ff['model']=_[_0x6beb('0x44')](db[_0x6beb('0x41')][_0x6beb('0x2b')]);_0x1fe7ff[_0x6beb('0x31')]=_[_0x6beb('0x44')](_0x3fc30a[_0x6beb('0x31')]);_0x1fe7ff['filters']=_['intersection'](_0x1fe7ff[_0x6beb('0x2f')],_0x1fe7ff[_0x6beb('0x31')]);_0x14fd11['attributes']=_[_0x6beb('0x34')](_0x1fe7ff[_0x6beb('0x2f')],qs[_0x6beb('0x35')](_0x3fc30a[_0x6beb('0x31')][_0x6beb('0x35')]));_0x14fd11[_0x6beb('0x33')]=_0x14fd11[_0x6beb('0x33')][_0x6beb('0x36')]?_0x14fd11[_0x6beb('0x33')]:_0x1fe7ff[_0x6beb('0x2f')];if(_0x3fc30a[_0x6beb('0x31')]['includeAll']){_0x14fd11[_0x6beb('0x45')]=[{'all':!![]}];}_0x14fd11=_[_0x6beb('0x3e')]({},_0x14fd11,_0x3fc30a['options']);return db['SmsQueueReport']['find'](_0x14fd11)[_0x6beb('0x25')](handleEntityNotFound(_0x237277,null))['then'](respondWithResult(_0x237277,null))['catch'](handleError(_0x237277,null));};exports['create']=function(_0x2c51c3,_0x5870b9){return db[_0x6beb('0x41')][_0x6beb('0x46')](_0x2c51c3[_0x6beb('0x47')],{})[_0x6beb('0x25')](respondWithResult(_0x5870b9,0xc9))[_0x6beb('0x42')](handleError(_0x5870b9,null));};exports[_0x6beb('0x24')]=function(_0x32684a,_0x425540){if(_0x32684a[_0x6beb('0x47')]['id']){delete _0x32684a['body']['id'];}return db[_0x6beb('0x41')][_0x6beb('0x48')]({'where':{'id':_0x32684a[_0x6beb('0x49')]['id']}})['then'](handleEntityNotFound(_0x425540,null))[_0x6beb('0x25')](saveUpdates(_0x32684a[_0x6beb('0x47')],null))[_0x6beb('0x25')](respondWithResult(_0x425540,null))[_0x6beb('0x42')](handleError(_0x425540,null));};exports[_0x6beb('0x26')]=function(_0x4a93ba,_0x40ea73){return db[_0x6beb('0x41')][_0x6beb('0x48')]({'where':{'id':_0x4a93ba[_0x6beb('0x49')]['id']}})['then'](handleEntityNotFound(_0x40ea73,null))[_0x6beb('0x25')](removeEntity(_0x40ea73,null))[_0x6beb('0x42')](handleError(_0x40ea73,null));};exports['describe']=function(_0x1c83e3,_0x44c7c7){return db[_0x6beb('0x41')][_0x6beb('0x4a')]()[_0x6beb('0x25')](respondWithResult(_0x44c7c7,null))[_0x6beb('0x42')](handleError(_0x44c7c7,null));}; \ No newline at end of file +var _0x6015=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SmsQueueReport','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','params','find','catch','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x6015,0x1d3));var _0x5601=function(_0x4bc87e,_0x3e7293){_0x4bc87e=_0x4bc87e-0x0;var _0x12eb29=_0x6015[_0x4bc87e];return _0x12eb29;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5601('0x0'));var zipdir=require(_0x5601('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5601('0x2'));var moment=require(_0x5601('0x3'));var BPromise=require(_0x5601('0x4'));var Mustache=require('mustache');var util=require(_0x5601('0x5'));var path=require(_0x5601('0x6'));var sox=require(_0x5601('0x7'));var csv=require(_0x5601('0x8'));var ejs=require(_0x5601('0x9'));var fs=require('fs');var fs_extra=require(_0x5601('0xa'));var _=require(_0x5601('0xb'));var squel=require(_0x5601('0xc'));var crypto=require(_0x5601('0xd'));var jsforce=require(_0x5601('0xe'));var deskjs=require(_0x5601('0xf'));var toCsv=require(_0x5601('0x8'));var querystring=require(_0x5601('0x10'));var Papa=require(_0x5601('0x11'));var Redis=require(_0x5601('0x12'));var authService=require(_0x5601('0x13'));var qs=require(_0x5601('0x14'));var as=require(_0x5601('0x15'));var hardwareService=require(_0x5601('0x16'));var logger=require(_0x5601('0x17'))(_0x5601('0x18'));var utils=require(_0x5601('0x19'));var config=require(_0x5601('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x5601('0x1b'))['db'];function respondWithStatusCode(_0x2e3eaf,_0x372054){_0x372054=_0x372054||0xcc;return function(_0x42ac38){if(_0x42ac38){return _0x2e3eaf[_0x5601('0x1c')](_0x372054);}return _0x2e3eaf[_0x5601('0x1d')](_0x372054)[_0x5601('0x1e')]();};}function respondWithResult(_0x3d4770,_0x5714f7){_0x5714f7=_0x5714f7||0xc8;return function(_0x6721aa){if(_0x6721aa){return _0x3d4770[_0x5601('0x1d')](_0x5714f7)[_0x5601('0x1f')](_0x6721aa);}};}function respondWithFilteredResult(_0x1f4e8,_0x2dbf70){return function(_0x35f685){if(_0x35f685){var _0x3eb3dc=typeof _0x2dbf70[_0x5601('0x20')]===_0x5601('0x21')&&typeof _0x2dbf70['limit']==='undefined';var _0x189159=_0x35f685[_0x5601('0x22')];var _0x2be999=_0x3eb3dc?0x0:_0x2dbf70[_0x5601('0x20')];var _0x38dfb1=_0x3eb3dc?_0x35f685[_0x5601('0x22')]:_0x2dbf70[_0x5601('0x20')]+_0x2dbf70['limit'];var _0x288d69;if(_0x38dfb1>=_0x189159){_0x38dfb1=_0x189159;_0x288d69=0xc8;}else{_0x288d69=0xce;}_0x1f4e8['status'](_0x288d69);return _0x1f4e8[_0x5601('0x23')](_0x5601('0x24'),_0x2be999+'-'+_0x38dfb1+'/'+_0x189159)[_0x5601('0x1f')](_0x35f685);}return null;};}function patchUpdates(_0x5b87ae){return function(_0xe496e8){try{jsonpatch[_0x5601('0x25')](_0xe496e8,_0x5b87ae,!![]);}catch(_0x388a8c){return BPromise[_0x5601('0x26')](_0x388a8c);}return _0xe496e8[_0x5601('0x27')]();};}function saveUpdates(_0xb8724b,_0x2e2934){return function(_0x573951){if(_0x573951){return _0x573951[_0x5601('0x28')](_0xb8724b)[_0x5601('0x29')](function(_0x9194f6){return _0x9194f6;});}return null;};}function removeEntity(_0x336038,_0x1cd1c3){return function(_0x416806){if(_0x416806){return _0x416806[_0x5601('0x2a')]()[_0x5601('0x29')](function(){_0x336038[_0x5601('0x1d')](0xcc)[_0x5601('0x1e')]();});}};}function handleEntityNotFound(_0x4165bc,_0x1f35f7){return function(_0x56a0e2){if(!_0x56a0e2){_0x4165bc[_0x5601('0x1c')](0x194);}return _0x56a0e2;};}function handleError(_0x3095b3,_0x2be3f9){_0x2be3f9=_0x2be3f9||0x1f4;return function(_0x3df4a5){logger[_0x5601('0x2b')](_0x3df4a5[_0x5601('0x2c')]);if(_0x3df4a5['name']){delete _0x3df4a5[_0x5601('0x2d')];}_0x3095b3['status'](_0x2be3f9)[_0x5601('0x2e')](_0x3df4a5);};}exports[_0x5601('0x2f')]=function(_0x39305c,_0x2d5071){var _0x29ff6b={},_0x539efa={},_0x23455e={'count':0x0,'rows':[]};var _0x5b3942=_['map'](db[_0x5601('0x30')][_0x5601('0x31')],function(_0x38769c){return{'name':_0x38769c[_0x5601('0x32')],'type':_0x38769c['type'][_0x5601('0x33')]};});_0x539efa['model']=_[_0x5601('0x34')](_0x5b3942,_0x5601('0x2d'));_0x539efa['query']=_[_0x5601('0x35')](_0x39305c[_0x5601('0x36')]);_0x539efa[_0x5601('0x37')]=_[_0x5601('0x38')](_0x539efa[_0x5601('0x39')],_0x539efa[_0x5601('0x36')]);_0x29ff6b[_0x5601('0x3a')]=_[_0x5601('0x38')](_0x539efa[_0x5601('0x39')],qs[_0x5601('0x3b')](_0x39305c[_0x5601('0x36')][_0x5601('0x3b')]));_0x29ff6b[_0x5601('0x3a')]=_0x29ff6b[_0x5601('0x3a')][_0x5601('0x3c')]?_0x29ff6b[_0x5601('0x3a')]:_0x539efa[_0x5601('0x39')];if(!_0x39305c[_0x5601('0x36')][_0x5601('0x3d')](_0x5601('0x3e'))){_0x29ff6b[_0x5601('0x3f')]=qs[_0x5601('0x3f')](_0x39305c[_0x5601('0x36')][_0x5601('0x3f')]);_0x29ff6b[_0x5601('0x20')]=qs[_0x5601('0x20')](_0x39305c[_0x5601('0x36')][_0x5601('0x20')]);}_0x29ff6b[_0x5601('0x40')]=qs[_0x5601('0x41')](_0x39305c[_0x5601('0x36')]['sort']);_0x29ff6b[_0x5601('0x42')]=qs['filters'](_[_0x5601('0x43')](_0x39305c[_0x5601('0x36')],_0x539efa['filters']),_0x5b3942);if(_0x39305c[_0x5601('0x36')]['filter']){_0x29ff6b[_0x5601('0x42')]=_[_0x5601('0x44')](_0x29ff6b['where'],{'$or':_[_0x5601('0x34')](_0x5b3942,function(_0x967455){if(_0x967455['type']!==_0x5601('0x45')){var _0x47f10a={};_0x47f10a[_0x967455[_0x5601('0x2d')]]={'$like':'%'+_0x39305c[_0x5601('0x36')][_0x5601('0x46')]+'%'};return _0x47f10a;}})});}_0x29ff6b=_[_0x5601('0x44')]({},_0x29ff6b,_0x39305c[_0x5601('0x47')]);var _0x5b31a8={'where':_0x29ff6b[_0x5601('0x42')]};return db[_0x5601('0x30')][_0x5601('0x22')](_0x5b31a8)[_0x5601('0x29')](function(_0x50d8f6){_0x23455e[_0x5601('0x22')]=_0x50d8f6;if(_0x39305c[_0x5601('0x36')][_0x5601('0x48')]){_0x29ff6b[_0x5601('0x49')]=[{'all':!![]}];}return db[_0x5601('0x30')]['findAll'](_0x29ff6b);})[_0x5601('0x29')](function(_0x16f3f2){_0x23455e[_0x5601('0x4a')]=_0x16f3f2;return _0x23455e;})[_0x5601('0x29')](respondWithFilteredResult(_0x2d5071,_0x29ff6b))['catch'](handleError(_0x2d5071,null));};exports['show']=function(_0x2944b7,_0x3fa7f5){var _0x2064fa={'raw':!![],'where':{'id':_0x2944b7[_0x5601('0x4b')]['id']}},_0x5a5542={};_0x5a5542[_0x5601('0x39')]=_[_0x5601('0x35')](db[_0x5601('0x30')][_0x5601('0x31')]);_0x5a5542[_0x5601('0x36')]=_[_0x5601('0x35')](_0x2944b7[_0x5601('0x36')]);_0x5a5542[_0x5601('0x37')]=_[_0x5601('0x38')](_0x5a5542[_0x5601('0x39')],_0x5a5542[_0x5601('0x36')]);_0x2064fa['attributes']=_[_0x5601('0x38')](_0x5a5542['model'],qs[_0x5601('0x3b')](_0x2944b7['query'][_0x5601('0x3b')]));_0x2064fa[_0x5601('0x3a')]=_0x2064fa['attributes'][_0x5601('0x3c')]?_0x2064fa[_0x5601('0x3a')]:_0x5a5542[_0x5601('0x39')];if(_0x2944b7['query'][_0x5601('0x48')]){_0x2064fa[_0x5601('0x49')]=[{'all':!![]}];}_0x2064fa=_[_0x5601('0x44')]({},_0x2064fa,_0x2944b7[_0x5601('0x47')]);return db[_0x5601('0x30')][_0x5601('0x4c')](_0x2064fa)['then'](handleEntityNotFound(_0x3fa7f5,null))[_0x5601('0x29')](respondWithResult(_0x3fa7f5,null))[_0x5601('0x4d')](handleError(_0x3fa7f5,null));};exports[_0x5601('0x4e')]=function(_0x2aba94,_0x42c3ed){return db[_0x5601('0x30')][_0x5601('0x4e')](_0x2aba94[_0x5601('0x4f')],{})['then'](respondWithResult(_0x42c3ed,0xc9))[_0x5601('0x4d')](handleError(_0x42c3ed,null));};exports['update']=function(_0x40d85d,_0x57e110){if(_0x40d85d[_0x5601('0x4f')]['id']){delete _0x40d85d[_0x5601('0x4f')]['id'];}return db[_0x5601('0x30')][_0x5601('0x4c')]({'where':{'id':_0x40d85d[_0x5601('0x4b')]['id']}})[_0x5601('0x29')](handleEntityNotFound(_0x57e110,null))['then'](saveUpdates(_0x40d85d[_0x5601('0x4f')],null))['then'](respondWithResult(_0x57e110,null))[_0x5601('0x4d')](handleError(_0x57e110,null));};exports[_0x5601('0x2a')]=function(_0x57b9ee,_0x22c94e){return db[_0x5601('0x30')][_0x5601('0x4c')]({'where':{'id':_0x57b9ee[_0x5601('0x4b')]['id']}})[_0x5601('0x29')](handleEntityNotFound(_0x22c94e,null))[_0x5601('0x29')](removeEntity(_0x22c94e,null))[_0x5601('0x4d')](handleError(_0x22c94e,null));};exports[_0x5601('0x50')]=function(_0x2d7800,_0x224abd){return db[_0x5601('0x30')][_0x5601('0x50')]()[_0x5601('0x29')](respondWithResult(_0x224abd,null))[_0x5601('0x4d')](handleError(_0x224abd,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 89ebf74..4d163f9 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 _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_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':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 27dc0ae..e94f0bb 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 _0xe524=['catch','UpdateSmsQueueReport','where','attributes','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw'];(function(_0x16c778,_0xc98931){var _0x11bbdf=function(_0x42d480){while(--_0x42d480){_0x16c778['push'](_0x16c778['shift']());}};_0x11bbdf(++_0xc98931);}(_0xe524,0x112));var _0x4e52=function(_0x8bad9a,_0x136d0a){_0x8bad9a=_0x8bad9a-0x0;var _0x291fe2=_0xe524[_0x8bad9a];return _0x291fe2;};'use strict';var _=require(_0x4e52('0x0'));var util=require(_0x4e52('0x1'));var moment=require(_0x4e52('0x2'));var BPromise=require('bluebird');var rs=require(_0x4e52('0x3'));var fs=require('fs');var Redis=require(_0x4e52('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e52('0x5'));var logger=require(_0x4e52('0x6'))('rpc');var config=require(_0x4e52('0x7'));var jayson=require(_0x4e52('0x8'));var client=jayson[_0x4e52('0x9')][_0x4e52('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25a179,_0x2f87c6,_0x580e48){return new BPromise(function(_0x4efb1c,_0x19e2de){return client['request'](_0x25a179,_0x580e48)[_0x4e52('0xb')](function(_0x5ab675){logger[_0x4e52('0xc')](_0x4e52('0xd'),_0x2f87c6,_0x4e52('0xe'));logger[_0x4e52('0xf')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x2f87c6,_0x4e52('0xe'),JSON[_0x4e52('0x10')](_0x5ab675));if(_0x5ab675['error']){if(_0x5ab675[_0x4e52('0x11')]['code']===0x1f4){logger[_0x4e52('0x11')](_0x4e52('0xd'),_0x2f87c6,_0x5ab675[_0x4e52('0x11')][_0x4e52('0x12')]);return _0x19e2de(_0x5ab675[_0x4e52('0x11')][_0x4e52('0x12')]);}logger[_0x4e52('0x11')](_0x4e52('0xd'),_0x2f87c6,_0x5ab675[_0x4e52('0x11')][_0x4e52('0x12')]);return _0x4efb1c(_0x5ab675[_0x4e52('0x11')]['message']);}else{logger[_0x4e52('0xc')](_0x4e52('0xd'),_0x2f87c6,_0x4e52('0xe'));_0x4efb1c(_0x5ab675[_0x4e52('0x13')][_0x4e52('0x12')]);}})['catch'](function(_0x2e1622){logger[_0x4e52('0x11')](_0x4e52('0xd'),_0x2f87c6,_0x2e1622);_0x19e2de(_0x2e1622);});});}exports[_0x4e52('0x14')]=function(_0x4177b9){var _0x4c2dfd=this;return new Promise(function(_0x48aca7,_0x499565){return db[_0x4e52('0x15')][_0x4e52('0x16')](_0x4177b9[_0x4e52('0x17')],{'raw':_0x4177b9[_0x4e52('0x18')]?_0x4177b9[_0x4e52('0x18')][_0x4e52('0x19')]===undefined?!![]:![]:!![]})[_0x4e52('0xb')](function(_0x5c15f7){logger[_0x4e52('0xc')]('CreateSmsQueueReport',_0x4177b9);logger[_0x4e52('0xf')](_0x4e52('0x14'),_0x4177b9,JSON[_0x4e52('0x10')](_0x5c15f7));_0x48aca7(_0x5c15f7);})[_0x4e52('0x1a')](function(_0x44e936){logger['error']('CreateSmsQueueReport',_0x44e936[_0x4e52('0x12')],_0x4177b9);_0x499565(_0x4c2dfd['error'](0x1f4,_0x44e936[_0x4e52('0x12')]));});});};exports[_0x4e52('0x1b')]=function(_0x4b01ce){var _0x43b77a=this;return new Promise(function(_0x4c6649,_0x2181bd){return db[_0x4e52('0x15')]['update'](_0x4b01ce[_0x4e52('0x17')],{'raw':_0x4b01ce['options']?_0x4b01ce['options'][_0x4e52('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b01ce[_0x4e52('0x18')]?_0x4b01ce[_0x4e52('0x18')][_0x4e52('0x1c')]||null:null,'attributes':_0x4b01ce[_0x4e52('0x18')]?_0x4b01ce[_0x4e52('0x18')][_0x4e52('0x1d')]||null:null,'limit':_0x4b01ce[_0x4e52('0x18')]?_0x4b01ce['options']['limit']||null:null})[_0x4e52('0xb')](function(_0x55d54f){logger[_0x4e52('0xc')]('UpdateSmsQueueReport',_0x4b01ce);logger['debug'](_0x4e52('0x1b'),_0x4b01ce,JSON[_0x4e52('0x10')](_0x55d54f));_0x4c6649(_0x55d54f);})[_0x4e52('0x1a')](function(_0x36c428){logger[_0x4e52('0x11')](_0x4e52('0x1b'),_0x36c428[_0x4e52('0x12')],_0x4b01ce);_0x2181bd(_0x43b77a['error'](0x1f4,_0x36c428[_0x4e52('0x12')]));});});}; \ No newline at end of file +var _0xf49d=['UpdateSmsQueueReport','update','raw','attributes','limit','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','CreateSmsQueueReport','SmsQueueReport','body','options','debug'];(function(_0x5cbcb7,_0x5e7f04){var _0x324c1e=function(_0xec5825){while(--_0xec5825){_0x5cbcb7['push'](_0x5cbcb7['shift']());}};_0x324c1e(++_0x5e7f04);}(_0xf49d,0xa6));var _0xdf49=function(_0x40275b,_0x5a3c3b){_0x40275b=_0x40275b-0x0;var _0x423969=_0xf49d[_0x40275b];return _0x423969;};'use strict';var _=require(_0xdf49('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdf49('0x1'));var rs=require(_0xdf49('0x2'));var fs=require('fs');var Redis=require(_0xdf49('0x3'));var db=require(_0xdf49('0x4'))['db'];var utils=require(_0xdf49('0x5'));var logger=require(_0xdf49('0x6'))(_0xdf49('0x7'));var config=require(_0xdf49('0x8'));var jayson=require(_0xdf49('0x9'));var client=jayson[_0xdf49('0xa')][_0xdf49('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e9bd7,_0x5acd29,_0x511c21){return new BPromise(function(_0x3607f0,_0x1df21f){return client[_0xdf49('0xc')](_0x1e9bd7,_0x511c21)[_0xdf49('0xd')](function(_0x44e402){logger[_0xdf49('0xe')](_0xdf49('0xf'),_0x5acd29,'request\x20sent');logger['debug'](_0xdf49('0x10'),_0x5acd29,_0xdf49('0x11'),JSON['stringify'](_0x44e402));if(_0x44e402[_0xdf49('0x12')]){if(_0x44e402[_0xdf49('0x12')]['code']===0x1f4){logger['error'](_0xdf49('0xf'),_0x5acd29,_0x44e402[_0xdf49('0x12')][_0xdf49('0x13')]);return _0x1df21f(_0x44e402[_0xdf49('0x12')][_0xdf49('0x13')]);}logger[_0xdf49('0x12')](_0xdf49('0xf'),_0x5acd29,_0x44e402[_0xdf49('0x12')][_0xdf49('0x13')]);return _0x3607f0(_0x44e402[_0xdf49('0x12')][_0xdf49('0x13')]);}else{logger[_0xdf49('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x5acd29,_0xdf49('0x11'));_0x3607f0(_0x44e402['result'][_0xdf49('0x13')]);}})[_0xdf49('0x14')](function(_0x25798d){logger[_0xdf49('0x12')](_0xdf49('0xf'),_0x5acd29,_0x25798d);_0x1df21f(_0x25798d);});});}exports[_0xdf49('0x15')]=function(_0x2a4334){var _0x4baddd=this;return new Promise(function(_0x24b58c,_0x1f8605){return db[_0xdf49('0x16')]['create'](_0x2a4334[_0xdf49('0x17')],{'raw':_0x2a4334[_0xdf49('0x18')]?_0x2a4334[_0xdf49('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xdf49('0xd')](function(_0x31dd01){logger[_0xdf49('0xe')]('CreateSmsQueueReport',_0x2a4334);logger[_0xdf49('0x19')]('CreateSmsQueueReport',_0x2a4334,JSON['stringify'](_0x31dd01));_0x24b58c(_0x31dd01);})[_0xdf49('0x14')](function(_0x51f271){logger[_0xdf49('0x12')]('CreateSmsQueueReport',_0x51f271[_0xdf49('0x13')],_0x2a4334);_0x1f8605(_0x4baddd[_0xdf49('0x12')](0x1f4,_0x51f271[_0xdf49('0x13')]));});});};exports[_0xdf49('0x1a')]=function(_0x52e5d3){var _0x4723de=this;return new Promise(function(_0x2c3552,_0xe7446c){return db[_0xdf49('0x16')][_0xdf49('0x1b')](_0x52e5d3[_0xdf49('0x17')],{'raw':_0x52e5d3[_0xdf49('0x18')]?_0x52e5d3[_0xdf49('0x18')][_0xdf49('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52e5d3[_0xdf49('0x18')]?_0x52e5d3[_0xdf49('0x18')]['where']||null:null,'attributes':_0x52e5d3[_0xdf49('0x18')]?_0x52e5d3[_0xdf49('0x18')][_0xdf49('0x1d')]||null:null,'limit':_0x52e5d3[_0xdf49('0x18')]?_0x52e5d3[_0xdf49('0x18')][_0xdf49('0x1e')]||null:null})[_0xdf49('0xd')](function(_0x3dafe0){logger['info'](_0xdf49('0x1a'),_0x52e5d3);logger['debug'](_0xdf49('0x1a'),_0x52e5d3,JSON[_0xdf49('0x1f')](_0x3dafe0));_0x2c3552(_0x3dafe0);})[_0xdf49('0x14')](function(_0x1ec41c){logger['error'](_0xdf49('0x1a'),_0x1ec41c['message'],_0x52e5d3);_0xe7446c(_0x4723de[_0xdf49('0x12')](0x1f4,_0x1ec41c[_0xdf49('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 1764539..bfe540c 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 _0xf006=['post','create','put','update','destroy','exports','path','connect-timeout','Router','../../components/auth/service','./smsTransferReport.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0xf006,0x146));var _0x6f00=function(_0x341dd9,_0x4a8a5c){_0x341dd9=_0x341dd9-0x0;var _0x11cd86=_0xf006[_0x341dd9];return _0x11cd86;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f00('0x0'));var timeout=require(_0x6f00('0x1'));var express=require('express');var router=express[_0x6f00('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6f00('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6f00('0x4'));router[_0x6f00('0x5')]('/',auth[_0x6f00('0x6')](),controller['index']);router[_0x6f00('0x5')]('/describe',auth[_0x6f00('0x6')](),controller[_0x6f00('0x7')]);router[_0x6f00('0x5')](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0x9')]);router[_0x6f00('0xa')]('/',auth[_0x6f00('0x6')](),controller[_0x6f00('0xb')]);router[_0x6f00('0xc')](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0xd')]);router['delete'](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0xe')]);module[_0x6f00('0xf')]=router; \ No newline at end of file +var _0x7bae=['isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get'];(function(_0x3ddf7f,_0x4fda35){var _0x36189f=function(_0x2e13bd){while(--_0x2e13bd){_0x3ddf7f['push'](_0x3ddf7f['shift']());}};_0x36189f(++_0x4fda35);}(_0x7bae,0x13b));var _0xe7ba=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x7bae[_0x4baae2];return _0x1a2285;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7ba('0x0'));var timeout=require(_0xe7ba('0x1'));var express=require('express');var router=express[_0xe7ba('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe7ba('0x3'));var interaction=require(_0xe7ba('0x4'));var config=require(_0xe7ba('0x5'));var controller=require(_0xe7ba('0x6'));router[_0xe7ba('0x7')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x9')]);router[_0xe7ba('0x7')](_0xe7ba('0xa'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xb')]);router[_0xe7ba('0x7')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller['show']);router[_0xe7ba('0xd')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xe')]);router[_0xe7ba('0xf')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x10')]);router[_0xe7ba('0x11')](_0xe7ba('0xc'),auth['isAuthenticated'](),controller[_0xe7ba('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 6ddab50..33954fc 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x3c4b69,_0x8e55c7){var _0x47abd4=function(_0x1a9d46){while(--_0x1a9d46){_0x3c4b69['push'](_0x3c4b69['shift']());}};_0x47abd4(++_0x8e55c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x144db7,_0x592719){var _0x3efe6a=function(_0x4ed8da){while(--_0x4ed8da){_0x144db7['push'](_0x144db7['shift']());}};_0x3efe6a(++_0x592719);}(_0x008c,0x188));var _0xc008=function(_0xfe328a,_0x40602a){_0xfe328a=_0xfe328a-0x0;var _0x54d9a4=_0x008c[_0xfe328a];return _0x54d9a4;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 008a9ef..11ff26d 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 _0xcbb4=['rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','findAll','rows','catch','show','params','keys','include','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','update','error','stack','name','send','index','SmsTransferReport'];(function(_0x5cdad6,_0xb85c49){var _0x1fdfb3=function(_0x13033c){while(--_0x13033c){_0x5cdad6['push'](_0x5cdad6['shift']());}};_0x1fdfb3(++_0xb85c49);}(_0xcbb4,0xb1));var _0x4cbb=function(_0x384412,_0x6ad830){_0x384412=_0x384412-0x0;var _0x4c3e4f=_0xcbb4[_0x384412];return _0x4c3e4f;};'use strict';var emlformat=require(_0x4cbb('0x0'));var rimraf=require(_0x4cbb('0x1'));var zipdir=require(_0x4cbb('0x2'));var jsonpatch=require(_0x4cbb('0x3'));var rp=require('request-promise');var moment=require(_0x4cbb('0x4'));var BPromise=require(_0x4cbb('0x5'));var Mustache=require(_0x4cbb('0x6'));var util=require(_0x4cbb('0x7'));var path=require(_0x4cbb('0x8'));var sox=require(_0x4cbb('0x9'));var csv=require(_0x4cbb('0xa'));var ejs=require(_0x4cbb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4cbb('0xc'));var squel=require(_0x4cbb('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4cbb('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4cbb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4cbb('0x10'));var as=require(_0x4cbb('0x11'));var hardwareService=require(_0x4cbb('0x12'));var logger=require(_0x4cbb('0x13'))(_0x4cbb('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4cbb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36f46f,_0x487ee9){_0x487ee9=_0x487ee9||0xcc;return function(_0x56de5d){if(_0x56de5d){return _0x36f46f[_0x4cbb('0x16')](_0x487ee9);}return _0x36f46f[_0x4cbb('0x17')](_0x487ee9)[_0x4cbb('0x18')]();};}function respondWithResult(_0x4c128c,_0x1ff1dd){_0x1ff1dd=_0x1ff1dd||0xc8;return function(_0x23253d){if(_0x23253d){return _0x4c128c['status'](_0x1ff1dd)[_0x4cbb('0x19')](_0x23253d);}};}function respondWithFilteredResult(_0x7c236e,_0x79cb52){return function(_0x5b84fa){if(_0x5b84fa){var _0x1f0c12=typeof _0x79cb52[_0x4cbb('0x1a')]==='undefined'&&typeof _0x79cb52['limit']===_0x4cbb('0x1b');var _0x5e89b7=_0x5b84fa['count'];var _0x230f08=_0x1f0c12?0x0:_0x79cb52[_0x4cbb('0x1a')];var _0x51f225=_0x1f0c12?_0x5b84fa[_0x4cbb('0x1c')]:_0x79cb52['offset']+_0x79cb52[_0x4cbb('0x1d')];var _0x4ac4ba;if(_0x51f225>=_0x5e89b7){_0x51f225=_0x5e89b7;_0x4ac4ba=0xc8;}else{_0x4ac4ba=0xce;}_0x7c236e[_0x4cbb('0x17')](_0x4ac4ba);return _0x7c236e[_0x4cbb('0x1e')]('Content-Range',_0x230f08+'-'+_0x51f225+'/'+_0x5e89b7)[_0x4cbb('0x19')](_0x5b84fa);}return null;};}function patchUpdates(_0xb25e9){return function(_0x105bd6){try{jsonpatch[_0x4cbb('0x1f')](_0x105bd6,_0xb25e9,!![]);}catch(_0x4bf4ff){return BPromise['reject'](_0x4bf4ff);}return _0x105bd6['save']();};}function saveUpdates(_0x595b12,_0x539ed8){return function(_0x43a5fe){if(_0x43a5fe){return _0x43a5fe[_0x4cbb('0x20')](_0x595b12)['then'](function(_0x5e8b7e){return _0x5e8b7e;});}return null;};}function removeEntity(_0x5bc446,_0x1c4cfd){return function(_0x3707d5){if(_0x3707d5){return _0x3707d5['destroy']()['then'](function(){_0x5bc446[_0x4cbb('0x17')](0xcc)[_0x4cbb('0x18')]();});}};}function handleEntityNotFound(_0x34afbb,_0xd368e7){return function(_0xaaedee){if(!_0xaaedee){_0x34afbb[_0x4cbb('0x16')](0x194);}return _0xaaedee;};}function handleError(_0x2d6c1a,_0x179478){_0x179478=_0x179478||0x1f4;return function(_0x1c8c34){logger[_0x4cbb('0x21')](_0x1c8c34[_0x4cbb('0x22')]);if(_0x1c8c34['name']){delete _0x1c8c34[_0x4cbb('0x23')];}_0x2d6c1a[_0x4cbb('0x17')](_0x179478)[_0x4cbb('0x24')](_0x1c8c34);};}exports[_0x4cbb('0x25')]=function(_0x50ddfb,_0x278904){var _0x3b256f={},_0x5ab78d={},_0x53b626={'count':0x0,'rows':[]};var _0x5752ad=_['map'](db[_0x4cbb('0x26')][_0x4cbb('0x27')],function(_0x1aecd2){return{'name':_0x1aecd2[_0x4cbb('0x28')],'type':_0x1aecd2[_0x4cbb('0x29')]['key']};});_0x5ab78d[_0x4cbb('0x2a')]=_[_0x4cbb('0x2b')](_0x5752ad,_0x4cbb('0x23'));_0x5ab78d[_0x4cbb('0x2c')]=_['keys'](_0x50ddfb[_0x4cbb('0x2c')]);_0x5ab78d[_0x4cbb('0x2d')]=_[_0x4cbb('0x2e')](_0x5ab78d[_0x4cbb('0x2a')],_0x5ab78d[_0x4cbb('0x2c')]);_0x3b256f[_0x4cbb('0x2f')]=_[_0x4cbb('0x2e')](_0x5ab78d['model'],qs[_0x4cbb('0x30')](_0x50ddfb[_0x4cbb('0x2c')][_0x4cbb('0x30')]));_0x3b256f['attributes']=_0x3b256f['attributes'][_0x4cbb('0x31')]?_0x3b256f[_0x4cbb('0x2f')]:_0x5ab78d[_0x4cbb('0x2a')];if(!_0x50ddfb['query']['hasOwnProperty']('nolimit')){_0x3b256f['limit']=qs[_0x4cbb('0x1d')](_0x50ddfb[_0x4cbb('0x2c')]['limit']);_0x3b256f[_0x4cbb('0x1a')]=qs['offset'](_0x50ddfb[_0x4cbb('0x2c')][_0x4cbb('0x1a')]);}_0x3b256f[_0x4cbb('0x32')]=qs[_0x4cbb('0x33')](_0x50ddfb[_0x4cbb('0x2c')][_0x4cbb('0x33')]);_0x3b256f[_0x4cbb('0x34')]=qs['filters'](_[_0x4cbb('0x35')](_0x50ddfb['query'],_0x5ab78d['filters']),_0x5752ad);if(_0x50ddfb[_0x4cbb('0x2c')][_0x4cbb('0x36')]){_0x3b256f[_0x4cbb('0x34')]=_[_0x4cbb('0x37')](_0x3b256f[_0x4cbb('0x34')],{'$or':_[_0x4cbb('0x2b')](_0x5752ad,function(_0x31ce09){if(_0x31ce09['type']!==_0x4cbb('0x38')){var _0x22699f={};_0x22699f[_0x31ce09['name']]={'$like':'%'+_0x50ddfb[_0x4cbb('0x2c')]['filter']+'%'};return _0x22699f;}})});}_0x3b256f=_[_0x4cbb('0x37')]({},_0x3b256f,_0x50ddfb['options']);var _0x55d927={'where':_0x3b256f[_0x4cbb('0x34')]};return db['SmsTransferReport'][_0x4cbb('0x1c')](_0x55d927)[_0x4cbb('0x39')](function(_0x9a48b8){_0x53b626[_0x4cbb('0x1c')]=_0x9a48b8;if(_0x50ddfb[_0x4cbb('0x2c')][_0x4cbb('0x3a')]){_0x3b256f['include']=[{'all':!![]}];}return db[_0x4cbb('0x26')][_0x4cbb('0x3b')](_0x3b256f);})[_0x4cbb('0x39')](function(_0xbd728b){_0x53b626[_0x4cbb('0x3c')]=_0xbd728b;return _0x53b626;})['then'](respondWithFilteredResult(_0x278904,_0x3b256f))[_0x4cbb('0x3d')](handleError(_0x278904,null));};exports[_0x4cbb('0x3e')]=function(_0x5b89f6,_0x32a105){var _0x4681a0={'raw':!![],'where':{'id':_0x5b89f6[_0x4cbb('0x3f')]['id']}},_0x554639={};_0x554639[_0x4cbb('0x2a')]=_[_0x4cbb('0x40')](db[_0x4cbb('0x26')]['rawAttributes']);_0x554639[_0x4cbb('0x2c')]=_[_0x4cbb('0x40')](_0x5b89f6[_0x4cbb('0x2c')]);_0x554639['filters']=_[_0x4cbb('0x2e')](_0x554639[_0x4cbb('0x2a')],_0x554639[_0x4cbb('0x2c')]);_0x4681a0[_0x4cbb('0x2f')]=_[_0x4cbb('0x2e')](_0x554639[_0x4cbb('0x2a')],qs[_0x4cbb('0x30')](_0x5b89f6['query'][_0x4cbb('0x30')]));_0x4681a0[_0x4cbb('0x2f')]=_0x4681a0[_0x4cbb('0x2f')][_0x4cbb('0x31')]?_0x4681a0[_0x4cbb('0x2f')]:_0x554639[_0x4cbb('0x2a')];if(_0x5b89f6[_0x4cbb('0x2c')][_0x4cbb('0x3a')]){_0x4681a0[_0x4cbb('0x41')]=[{'all':!![]}];}_0x4681a0=_['merge']({},_0x4681a0,_0x5b89f6[_0x4cbb('0x42')]);return db[_0x4cbb('0x26')][_0x4cbb('0x43')](_0x4681a0)[_0x4cbb('0x39')](handleEntityNotFound(_0x32a105,null))[_0x4cbb('0x39')](respondWithResult(_0x32a105,null))[_0x4cbb('0x3d')](handleError(_0x32a105,null));};exports[_0x4cbb('0x44')]=function(_0x2a33bf,_0x4a9c20){return db['SmsTransferReport'][_0x4cbb('0x44')](_0x2a33bf[_0x4cbb('0x45')],{})[_0x4cbb('0x39')](respondWithResult(_0x4a9c20,0xc9))[_0x4cbb('0x3d')](handleError(_0x4a9c20,null));};exports['update']=function(_0x284b68,_0x1c8832){if(_0x284b68[_0x4cbb('0x45')]['id']){delete _0x284b68[_0x4cbb('0x45')]['id'];}return db[_0x4cbb('0x26')][_0x4cbb('0x43')]({'where':{'id':_0x284b68['params']['id']}})[_0x4cbb('0x39')](handleEntityNotFound(_0x1c8832,null))[_0x4cbb('0x39')](saveUpdates(_0x284b68[_0x4cbb('0x45')],null))[_0x4cbb('0x39')](respondWithResult(_0x1c8832,null))[_0x4cbb('0x3d')](handleError(_0x1c8832,null));};exports[_0x4cbb('0x46')]=function(_0x55caca,_0x2637d5){return db[_0x4cbb('0x26')][_0x4cbb('0x43')]({'where':{'id':_0x55caca[_0x4cbb('0x3f')]['id']}})[_0x4cbb('0x39')](handleEntityNotFound(_0x2637d5,null))[_0x4cbb('0x39')](removeEntity(_0x2637d5,null))['catch'](handleError(_0x2637d5,null));};exports[_0x4cbb('0x47')]=function(_0x2cd097,_0x1507b8){return db[_0x4cbb('0x26')][_0x4cbb('0x47')]()[_0x4cbb('0x39')](respondWithResult(_0x1507b8,null))[_0x4cbb('0x3d')](handleError(_0x1507b8,null));}; \ No newline at end of file +var _0x1e3b=['moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../config/license/hardware','../../config/logger','../../config/environment','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','update','then','sendStatus','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x1e3b,0x111));var _0xb1e3=function(_0x42b1d1,_0x21f052){_0x42b1d1=_0x42b1d1-0x0;var _0x3aca3e=_0x1e3b[_0x42b1d1];return _0x3aca3e;};'use strict';var emlformat=require(_0xb1e3('0x0'));var rimraf=require(_0xb1e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb1e3('0x2'));var rp=require('request-promise');var moment=require(_0xb1e3('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb1e3('0x4'));var path=require(_0xb1e3('0x5'));var sox=require(_0xb1e3('0x6'));var csv=require(_0xb1e3('0x7'));var ejs=require(_0xb1e3('0x8'));var fs=require('fs');var fs_extra=require(_0xb1e3('0x9'));var _=require(_0xb1e3('0xa'));var squel=require(_0xb1e3('0xb'));var crypto=require(_0xb1e3('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb1e3('0xd'));var Papa=require(_0xb1e3('0xe'));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(_0xb1e3('0xf'));var logger=require(_0xb1e3('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xb1e3('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x229e07,_0x506e94){_0x506e94=_0x506e94||0xcc;return function(_0x5eada2){if(_0x5eada2){return _0x229e07['sendStatus'](_0x506e94);}return _0x229e07[_0xb1e3('0x12')](_0x506e94)[_0xb1e3('0x13')]();};}function respondWithResult(_0x11c2d0,_0x422fc6){_0x422fc6=_0x422fc6||0xc8;return function(_0x2ad686){if(_0x2ad686){return _0x11c2d0[_0xb1e3('0x12')](_0x422fc6)[_0xb1e3('0x14')](_0x2ad686);}};}function respondWithFilteredResult(_0x59c933,_0x8d449a){return function(_0x537d03){if(_0x537d03){var _0x161e4e=typeof _0x8d449a['offset']===_0xb1e3('0x15')&&typeof _0x8d449a['limit']==='undefined';var _0x257e5d=_0x537d03['count'];var _0x4d272a=_0x161e4e?0x0:_0x8d449a[_0xb1e3('0x16')];var _0x4a5658=_0x161e4e?_0x537d03[_0xb1e3('0x17')]:_0x8d449a[_0xb1e3('0x16')]+_0x8d449a[_0xb1e3('0x18')];var _0x1663b2;if(_0x4a5658>=_0x257e5d){_0x4a5658=_0x257e5d;_0x1663b2=0xc8;}else{_0x1663b2=0xce;}_0x59c933['status'](_0x1663b2);return _0x59c933[_0xb1e3('0x19')](_0xb1e3('0x1a'),_0x4d272a+'-'+_0x4a5658+'/'+_0x257e5d)[_0xb1e3('0x14')](_0x537d03);}return null;};}function patchUpdates(_0x7c63b0){return function(_0x58caa0){try{jsonpatch[_0xb1e3('0x1b')](_0x58caa0,_0x7c63b0,!![]);}catch(_0x5284fd){return BPromise[_0xb1e3('0x1c')](_0x5284fd);}return _0x58caa0['save']();};}function saveUpdates(_0x244b8f,_0x4b065e){return function(_0x2c6f03){if(_0x2c6f03){return _0x2c6f03[_0xb1e3('0x1d')](_0x244b8f)[_0xb1e3('0x1e')](function(_0x567f14){return _0x567f14;});}return null;};}function removeEntity(_0xf130ef,_0x4df13d){return function(_0x48db08){if(_0x48db08){return _0x48db08['destroy']()[_0xb1e3('0x1e')](function(){_0xf130ef[_0xb1e3('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d25ac,_0x33cd91){return function(_0x1043ab){if(!_0x1043ab){_0x5d25ac[_0xb1e3('0x1f')](0x194);}return _0x1043ab;};}function handleError(_0x28ac8e,_0x3f7d3b){_0x3f7d3b=_0x3f7d3b||0x1f4;return function(_0x5d68bc){logger['error'](_0x5d68bc[_0xb1e3('0x20')]);if(_0x5d68bc['name']){delete _0x5d68bc[_0xb1e3('0x21')];}_0x28ac8e[_0xb1e3('0x12')](_0x3f7d3b)[_0xb1e3('0x22')](_0x5d68bc);};}exports[_0xb1e3('0x23')]=function(_0x3e1ae8,_0x8fadd0){var _0x105542={},_0x2c19af={},_0x2ae8a7={'count':0x0,'rows':[]};var _0xef68e2=_[_0xb1e3('0x24')](db[_0xb1e3('0x25')][_0xb1e3('0x26')],function(_0x3cb561){return{'name':_0x3cb561[_0xb1e3('0x27')],'type':_0x3cb561[_0xb1e3('0x28')][_0xb1e3('0x29')]};});_0x2c19af[_0xb1e3('0x2a')]=_[_0xb1e3('0x24')](_0xef68e2,'name');_0x2c19af[_0xb1e3('0x2b')]=_[_0xb1e3('0x2c')](_0x3e1ae8[_0xb1e3('0x2b')]);_0x2c19af['filters']=_[_0xb1e3('0x2d')](_0x2c19af[_0xb1e3('0x2a')],_0x2c19af[_0xb1e3('0x2b')]);_0x105542['attributes']=_[_0xb1e3('0x2d')](_0x2c19af[_0xb1e3('0x2a')],qs[_0xb1e3('0x2e')](_0x3e1ae8[_0xb1e3('0x2b')]['fields']));_0x105542[_0xb1e3('0x2f')]=_0x105542[_0xb1e3('0x2f')][_0xb1e3('0x30')]?_0x105542[_0xb1e3('0x2f')]:_0x2c19af['model'];if(!_0x3e1ae8[_0xb1e3('0x2b')]['hasOwnProperty']('nolimit')){_0x105542[_0xb1e3('0x18')]=qs['limit'](_0x3e1ae8[_0xb1e3('0x2b')][_0xb1e3('0x18')]);_0x105542[_0xb1e3('0x16')]=qs[_0xb1e3('0x16')](_0x3e1ae8['query']['offset']);}_0x105542[_0xb1e3('0x31')]=qs[_0xb1e3('0x32')](_0x3e1ae8[_0xb1e3('0x2b')][_0xb1e3('0x32')]);_0x105542['where']=qs['filters'](_['pick'](_0x3e1ae8[_0xb1e3('0x2b')],_0x2c19af[_0xb1e3('0x33')]),_0xef68e2);if(_0x3e1ae8[_0xb1e3('0x2b')][_0xb1e3('0x34')]){_0x105542[_0xb1e3('0x35')]=_[_0xb1e3('0x36')](_0x105542[_0xb1e3('0x35')],{'$or':_['map'](_0xef68e2,function(_0x7d2ac8){if(_0x7d2ac8[_0xb1e3('0x28')]!==_0xb1e3('0x37')){var _0x59ab38={};_0x59ab38[_0x7d2ac8[_0xb1e3('0x21')]]={'$like':'%'+_0x3e1ae8[_0xb1e3('0x2b')][_0xb1e3('0x34')]+'%'};return _0x59ab38;}})});}_0x105542=_['merge']({},_0x105542,_0x3e1ae8[_0xb1e3('0x38')]);var _0x35e203={'where':_0x105542[_0xb1e3('0x35')]};return db['SmsTransferReport']['count'](_0x35e203)[_0xb1e3('0x1e')](function(_0x4384fe){_0x2ae8a7[_0xb1e3('0x17')]=_0x4384fe;if(_0x3e1ae8[_0xb1e3('0x2b')][_0xb1e3('0x39')]){_0x105542[_0xb1e3('0x3a')]=[{'all':!![]}];}return db[_0xb1e3('0x25')][_0xb1e3('0x3b')](_0x105542);})[_0xb1e3('0x1e')](function(_0x59490e){_0x2ae8a7[_0xb1e3('0x3c')]=_0x59490e;return _0x2ae8a7;})[_0xb1e3('0x1e')](respondWithFilteredResult(_0x8fadd0,_0x105542))[_0xb1e3('0x3d')](handleError(_0x8fadd0,null));};exports[_0xb1e3('0x3e')]=function(_0x7013f5,_0x40b667){var _0x2fb93a={'raw':!![],'where':{'id':_0x7013f5[_0xb1e3('0x3f')]['id']}},_0x5dc40f={};_0x5dc40f['model']=_[_0xb1e3('0x2c')](db[_0xb1e3('0x25')][_0xb1e3('0x26')]);_0x5dc40f[_0xb1e3('0x2b')]=_[_0xb1e3('0x2c')](_0x7013f5[_0xb1e3('0x2b')]);_0x5dc40f['filters']=_[_0xb1e3('0x2d')](_0x5dc40f[_0xb1e3('0x2a')],_0x5dc40f[_0xb1e3('0x2b')]);_0x2fb93a['attributes']=_[_0xb1e3('0x2d')](_0x5dc40f[_0xb1e3('0x2a')],qs['fields'](_0x7013f5[_0xb1e3('0x2b')][_0xb1e3('0x2e')]));_0x2fb93a['attributes']=_0x2fb93a[_0xb1e3('0x2f')][_0xb1e3('0x30')]?_0x2fb93a[_0xb1e3('0x2f')]:_0x5dc40f['model'];if(_0x7013f5[_0xb1e3('0x2b')][_0xb1e3('0x39')]){_0x2fb93a[_0xb1e3('0x3a')]=[{'all':!![]}];}_0x2fb93a=_[_0xb1e3('0x36')]({},_0x2fb93a,_0x7013f5[_0xb1e3('0x38')]);return db[_0xb1e3('0x25')][_0xb1e3('0x40')](_0x2fb93a)[_0xb1e3('0x1e')](handleEntityNotFound(_0x40b667,null))[_0xb1e3('0x1e')](respondWithResult(_0x40b667,null))['catch'](handleError(_0x40b667,null));};exports[_0xb1e3('0x41')]=function(_0x5af355,_0x3e407f){return db[_0xb1e3('0x25')][_0xb1e3('0x41')](_0x5af355[_0xb1e3('0x42')],{})[_0xb1e3('0x1e')](respondWithResult(_0x3e407f,0xc9))[_0xb1e3('0x3d')](handleError(_0x3e407f,null));};exports[_0xb1e3('0x1d')]=function(_0x4d4f80,_0x30a79d){if(_0x4d4f80[_0xb1e3('0x42')]['id']){delete _0x4d4f80[_0xb1e3('0x42')]['id'];}return db[_0xb1e3('0x25')]['find']({'where':{'id':_0x4d4f80['params']['id']}})[_0xb1e3('0x1e')](handleEntityNotFound(_0x30a79d,null))[_0xb1e3('0x1e')](saveUpdates(_0x4d4f80[_0xb1e3('0x42')],null))['then'](respondWithResult(_0x30a79d,null))[_0xb1e3('0x3d')](handleError(_0x30a79d,null));};exports[_0xb1e3('0x43')]=function(_0x1b693d,_0x4861c4){return db[_0xb1e3('0x25')][_0xb1e3('0x40')]({'where':{'id':_0x1b693d[_0xb1e3('0x3f')]['id']}})[_0xb1e3('0x1e')](handleEntityNotFound(_0x4861c4,null))['then'](removeEntity(_0x4861c4,null))[_0xb1e3('0x3d')](handleError(_0x4861c4,null));};exports[_0xb1e3('0x44')]=function(_0x1dfed9,_0x2f805e){return db['SmsTransferReport'][_0xb1e3('0x44')]()[_0xb1e3('0x1e')](respondWithResult(_0x2f805e,null))[_0xb1e3('0x3d')](handleError(_0x2f805e,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 13d6dc1..78f188c 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 _0x9438=['api','moment','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','define','uniqueid','lodash','util'];(function(_0x19c975,_0x45e3c9){var _0xe81425=function(_0x414f3c){while(--_0x414f3c){_0x19c975['push'](_0x19c975['shift']());}};_0xe81425(++_0x45e3c9);}(_0x9438,0x8d));var _0x8943=function(_0x1eb9bc,_0x50d5a2){_0x1eb9bc=_0x1eb9bc-0x0;var _0x3df238=_0x9438[_0x1eb9bc];return _0x3df238;};'use strict';var _=require(_0x8943('0x0'));var util=require(_0x8943('0x1'));var logger=require('../../config/logger')(_0x8943('0x2'));var moment=require(_0x8943('0x3'));var BPromise=require('bluebird');var rp=require(_0x8943('0x4'));var fs=require('fs');var path=require(_0x8943('0x5'));var rimraf=require(_0x8943('0x6'));var config=require(_0x8943('0x7'));var attributes=require(_0x8943('0x8'));module['exports']=function(_0x24d5cd,_0x276e66){return _0x24d5cd[_0x8943('0x9')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x8943('0xa'),'fields':[_0x8943('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa7dc=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer','uniqueid','lodash'];(function(_0x304bf7,_0x4fcafc){var _0x5036cd=function(_0x39e810){while(--_0x39e810){_0x304bf7['push'](_0x304bf7['shift']());}};_0x5036cd(++_0x4fcafc);}(_0xa7dc,0x11d));var _0xca7d=function(_0x106c20,_0x1f6f48){_0x106c20=_0x106c20-0x0;var _0x2a0cee=_0xa7dc[_0x106c20];return _0x2a0cee;};'use strict';var _=require(_0xca7d('0x0'));var util=require(_0xca7d('0x1'));var logger=require(_0xca7d('0x2'))('api');var moment=require(_0xca7d('0x3'));var BPromise=require('bluebird');var rp=require(_0xca7d('0x4'));var fs=require('fs');var path=require(_0xca7d('0x5'));var rimraf=require(_0xca7d('0x6'));var config=require(_0xca7d('0x7'));var attributes=require(_0xca7d('0x8'));module[_0xca7d('0x9')]=function(_0xa6beee,_0x47e415){return _0xa6beee['define'](_0xca7d('0xa'),attributes,{'tableName':_0xca7d('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xca7d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 57fe13c..ae326fd 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 _0xf3a7=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','debug','error','code','SmsTransferReport,\x20%s,\x20%s','message','info','result','catch','util'];(function(_0x33d1db,_0x3f99dc){var _0x4266a1=function(_0x39e592){while(--_0x39e592){_0x33d1db['push'](_0x33d1db['shift']());}};_0x4266a1(++_0x3f99dc);}(_0xf3a7,0x99));var _0x7f3a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf3a7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x7f3a('0x0'));var moment=require(_0x7f3a('0x1'));var BPromise=require(_0x7f3a('0x2'));var rs=require(_0x7f3a('0x3'));var fs=require('fs');var Redis=require(_0x7f3a('0x4'));var db=require(_0x7f3a('0x5'))['db'];var utils=require(_0x7f3a('0x6'));var logger=require(_0x7f3a('0x7'))(_0x7f3a('0x8'));var config=require(_0x7f3a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7f3a('0xa')][_0x7f3a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a7d66,_0x2c6b8b,_0x1dd804){return new BPromise(function(_0x36beee,_0x25db47){return client['request'](_0x2a7d66,_0x1dd804)[_0x7f3a('0xc')](function(_0x4654df){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x2c6b8b,_0x7f3a('0xd'));logger[_0x7f3a('0xe')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x2c6b8b,_0x7f3a('0xd'),JSON['stringify'](_0x4654df));if(_0x4654df[_0x7f3a('0xf')]){if(_0x4654df['error'][_0x7f3a('0x10')]===0x1f4){logger[_0x7f3a('0xf')](_0x7f3a('0x11'),_0x2c6b8b,_0x4654df[_0x7f3a('0xf')][_0x7f3a('0x12')]);return _0x25db47(_0x4654df[_0x7f3a('0xf')][_0x7f3a('0x12')]);}logger[_0x7f3a('0xf')](_0x7f3a('0x11'),_0x2c6b8b,_0x4654df['error'][_0x7f3a('0x12')]);return _0x36beee(_0x4654df['error'][_0x7f3a('0x12')]);}else{logger[_0x7f3a('0x13')](_0x7f3a('0x11'),_0x2c6b8b,_0x7f3a('0xd'));_0x36beee(_0x4654df[_0x7f3a('0x14')][_0x7f3a('0x12')]);}})[_0x7f3a('0x15')](function(_0x4bb60a){logger[_0x7f3a('0xf')](_0x7f3a('0x11'),_0x2c6b8b,_0x4bb60a);_0x25db47(_0x4bb60a);});});} \ No newline at end of file +var _0x2427=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','bluebird','ioredis'];(function(_0x1b9da2,_0x4d145b){var _0x156a67=function(_0x40f6d0){while(--_0x40f6d0){_0x1b9da2['push'](_0x1b9da2['shift']());}};_0x156a67(++_0x4d145b);}(_0x2427,0x165));var _0x7242=function(_0x4ebf02,_0xaca8fc){_0x4ebf02=_0x4ebf02-0x0;var _0x30386a=_0x2427[_0x4ebf02];return _0x30386a;};'use strict';var _=require(_0x7242('0x0'));var util=require(_0x7242('0x1'));var moment=require('moment');var BPromise=require(_0x7242('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7242('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7242('0x4'));var logger=require(_0x7242('0x5'))(_0x7242('0x6'));var config=require('../../config/environment');var jayson=require(_0x7242('0x7'));var client=jayson['client'][_0x7242('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26f0a9,_0x21792a,_0x10a830){return new BPromise(function(_0x5c640f,_0x465ac8){return client[_0x7242('0x9')](_0x26f0a9,_0x10a830)['then'](function(_0x26f36c){logger[_0x7242('0xa')](_0x7242('0xb'),_0x21792a,'request\x20sent');logger[_0x7242('0xc')](_0x7242('0xd'),_0x21792a,_0x7242('0xe'),JSON[_0x7242('0xf')](_0x26f36c));if(_0x26f36c['error']){if(_0x26f36c[_0x7242('0x10')][_0x7242('0x11')]===0x1f4){logger['error'](_0x7242('0xb'),_0x21792a,_0x26f36c[_0x7242('0x10')][_0x7242('0x12')]);return _0x465ac8(_0x26f36c['error']['message']);}logger[_0x7242('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x21792a,_0x26f36c[_0x7242('0x10')][_0x7242('0x12')]);return _0x5c640f(_0x26f36c[_0x7242('0x10')][_0x7242('0x12')]);}else{logger[_0x7242('0xa')](_0x7242('0xb'),_0x21792a,_0x7242('0xe'));_0x5c640f(_0x26f36c['result'][_0x7242('0x12')]);}})['catch'](function(_0x988f40){logger[_0x7242('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x21792a,_0x988f40);_0x465ac8(_0x988f40);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 87023f5..a58e965 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 _0x7bb2=['show','/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','basename','extname','now','post','single','create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','isAuthenticated','index','get','/:id'];(function(_0x5a92ad,_0x2219a6){var _0x2466f8=function(_0x4ad04e){while(--_0x4ad04e){_0x5a92ad['push'](_0x5a92ad['shift']());}};_0x2466f8(++_0x2219a6);}(_0x7bb2,0x148));var _0x27bb=function(_0x2d3676,_0x51edca){_0x2d3676=_0x2d3676-0x0;var _0x30242c=_0x7bb2[_0x2d3676];return _0x30242c;};'use strict';var multer=require(_0x27bb('0x0'));var util=require(_0x27bb('0x1'));var path=require('path');var timeout=require(_0x27bb('0x2'));var express=require(_0x27bb('0x3'));var router=express[_0x27bb('0x4')]();var fs_extra=require(_0x27bb('0x5'));var auth=require(_0x27bb('0x6'));var interaction=require(_0x27bb('0x7'));var config=require('../../config/environment');var controller=require(_0x27bb('0x8'));router['get']('/',auth[_0x27bb('0x9')](),controller[_0x27bb('0xa')]);router[_0x27bb('0xb')](_0x27bb('0xc'),auth[_0x27bb('0x9')](),controller[_0x27bb('0xd')]);router[_0x27bb('0xb')](_0x27bb('0xe'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x27bb('0xf')]({'destination':function(_0x4696c8,_0x50b489,_0x8392fd){_0x8392fd(null,path[_0x27bb('0x10')](config[_0x27bb('0x11')],_0x27bb('0x12')));},'filename':function(_0x3a818b,_0x23e71d,_0xbc6dac){_0x23e71d[_0x27bb('0x13')]=_0x23e71d[_0x27bb('0x13')][_0x27bb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xbc6dac(null,util[_0x27bb('0x15')]('%s-%s%s',path[_0x27bb('0x16')](_0x23e71d[_0x27bb('0x13')],path[_0x27bb('0x17')](_0x23e71d[_0x27bb('0x13')])),Date[_0x27bb('0x18')](),path[_0x27bb('0x17')](_0x23e71d[_0x27bb('0x13')])));}})});router[_0x27bb('0x19')]('/',upload[_0x27bb('0x1a')]('file'),controller[_0x27bb('0x1b')]);router[_0x27bb('0x1c')](_0x27bb('0xc'),auth[_0x27bb('0x9')](),controller['update']);router[_0x27bb('0x1d')](_0x27bb('0xc'),auth[_0x27bb('0x9')](),controller[_0x27bb('0x1d')]);module[_0x27bb('0x1e')]=router; \ No newline at end of file +var _0x550f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','show','diskStorage','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','now','extname','post','file','update','delete','exports','multer','path','connect-timeout'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x550f,0x15c));var _0xf550=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x550f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf550('0x0'));var util=require('util');var path=require(_0xf550('0x1'));var timeout=require(_0xf550('0x2'));var express=require(_0xf550('0x3'));var router=express[_0xf550('0x4')]();var fs_extra=require(_0xf550('0x5'));var auth=require(_0xf550('0x6'));var interaction=require(_0xf550('0x7'));var config=require('../../config/environment');var controller=require('./sound.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf550('0x8')]);router[_0xf550('0x9')](_0xf550('0xa'),auth[_0xf550('0xb')](),controller[_0xf550('0xc')]);router[_0xf550('0x9')]('/:id/download',auth[_0xf550('0xb')](),controller['download']);var upload=multer({'storage':multer[_0xf550('0xd')]({'destination':function(_0xaaee2b,_0x2932d6,_0x1b2843){_0x1b2843(null,path['join'](config['root'],_0xf550('0xe')));},'filename':function(_0x881d43,_0x4ba7fc,_0x36e2ff){_0x4ba7fc[_0xf550('0xf')]=_0x4ba7fc[_0xf550('0xf')][_0xf550('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x36e2ff(null,util[_0xf550('0x11')](_0xf550('0x12'),path[_0xf550('0x13')](_0x4ba7fc[_0xf550('0xf')],path['extname'](_0x4ba7fc[_0xf550('0xf')])),Date[_0xf550('0x14')](),path[_0xf550('0x15')](_0x4ba7fc['originalname'])));}})});router[_0xf550('0x16')]('/',upload['single'](_0xf550('0x17')),controller['create']);router['put'](_0xf550('0xa'),auth[_0xf550('0xb')](),controller[_0xf550('0x18')]);router['delete'](_0xf550('0xa'),auth['isAuthenticated'](),controller[_0xf550('0x19')]);module[_0xf550('0x1a')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 03e2b45..ed70eb5 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 _0xa2ae=['BIGINT','INTEGER','sequelize','exports','name','STRING','FLOAT'];(function(_0x529480,_0x1a6a21){var _0x572f46=function(_0x32f0b6){while(--_0x32f0b6){_0x529480['push'](_0x529480['shift']());}};_0x572f46(++_0x1a6a21);}(_0xa2ae,0x95));var _0xea2a=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0xa2ae[_0x11a220];return _0x20d8fe;};'use strict';var Sequelize=require(_0xea2a('0x0'));module[_0xea2a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xea2a('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xea2a('0x3')]},'display_name':{'type':Sequelize[_0xea2a('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0xea2a('0x3')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xea2a('0x4')]},'original_sampleCount':{'type':Sequelize[_0xea2a('0x5')]},'original_channelCount':{'type':Sequelize[_0xea2a('0x6')]},'original_bitRate':{'type':Sequelize[_0xea2a('0x5')]},'original_sampleRate':{'type':Sequelize[_0xea2a('0x6')]},'converted_format':{'type':Sequelize[_0xea2a('0x3')]},'converted_duration':{'type':Sequelize[_0xea2a('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xea2a('0x5')]},'converted_channelCount':{'type':Sequelize[_0xea2a('0x6')]},'converted_bitRate':{'type':Sequelize[_0xea2a('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xea2a('0x6')]}}; \ No newline at end of file +var _0xed58=['INTEGER','FLOAT','exports','STRING','BIGINT'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xed58,0x1e7));var _0x8ed5=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xed58[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x8ed5('0x0')]={'name':{'type':Sequelize[_0x8ed5('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x8ed5('0x1')]},'display_name':{'type':Sequelize[_0x8ed5('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x8ed5('0x1')]},'original_format':{'type':Sequelize[_0x8ed5('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x8ed5('0x2')]},'original_channelCount':{'type':Sequelize[_0x8ed5('0x3')]},'original_bitRate':{'type':Sequelize[_0x8ed5('0x2')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x8ed5('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x8ed5('0x2')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x8ed5('0x3')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 8bbd071..39b1785 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 _0xffc7=['0777','transcode','wav','src','original_duration','duration','sampleCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','start','description','delete','server/files/sounds/original','original_format','unlinkSync','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','includeAll','options','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','format','%s.%s','create','file','originalname','basename','extname','filename','substring','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync'];(function(_0x52b016,_0x33ec6e){var _0x13e797=function(_0x40f31b){while(--_0x40f31b){_0x52b016['push'](_0x52b016['shift']());}};_0x13e797(++_0x33ec6e);}(_0xffc7,0x11e));var _0x7ffc=function(_0x5d417a,_0x587867){_0x5d417a=_0x5d417a-0x0;var _0x601762=_0xffc7[_0x5d417a];return _0x601762;};'use strict';var emlformat=require(_0x7ffc('0x0'));var rimraf=require(_0x7ffc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7ffc('0x2'));var moment=require(_0x7ffc('0x3'));var BPromise=require(_0x7ffc('0x4'));var Mustache=require(_0x7ffc('0x5'));var util=require(_0x7ffc('0x6'));var path=require('path');var sox=require(_0x7ffc('0x7'));var csv=require(_0x7ffc('0x8'));var ejs=require(_0x7ffc('0x9'));var fs=require('fs');var fs_extra=require(_0x7ffc('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7ffc('0x8'));var querystring=require(_0x7ffc('0xb'));var Papa=require(_0x7ffc('0xc'));var Redis=require(_0x7ffc('0xd'));var authService=require(_0x7ffc('0xe'));var qs=require(_0x7ffc('0xf'));var as=require(_0x7ffc('0x10'));var hardwareService=require(_0x7ffc('0x11'));var logger=require(_0x7ffc('0x12'))(_0x7ffc('0x13'));var utils=require(_0x7ffc('0x14'));var config=require(_0x7ffc('0x15'));var licenseUtil=require(_0x7ffc('0x16'));var db=require(_0x7ffc('0x17'))['db'];function respondWithStatusCode(_0xd999e2,_0x3c8a74){_0x3c8a74=_0x3c8a74||0xcc;return function(_0x3587a0){if(_0x3587a0){return _0xd999e2[_0x7ffc('0x18')](_0x3c8a74);}return _0xd999e2[_0x7ffc('0x19')](_0x3c8a74)[_0x7ffc('0x1a')]();};}function respondWithResult(_0x161139,_0x5d869d){_0x5d869d=_0x5d869d||0xc8;return function(_0xf94d00){if(_0xf94d00){return _0x161139[_0x7ffc('0x19')](_0x5d869d)[_0x7ffc('0x1b')](_0xf94d00);}};}function respondWithFilteredResult(_0x222720,_0x18ae08){return function(_0x449958){if(_0x449958){var _0x3863bb=typeof _0x18ae08['offset']===_0x7ffc('0x1c')&&typeof _0x18ae08[_0x7ffc('0x1d')]===_0x7ffc('0x1c');var _0x261d1f=_0x449958['count'];var _0x34f2b3=_0x3863bb?0x0:_0x18ae08[_0x7ffc('0x1e')];var _0x4063c2=_0x3863bb?_0x449958[_0x7ffc('0x1f')]:_0x18ae08['offset']+_0x18ae08[_0x7ffc('0x1d')];var _0x516c3d;if(_0x4063c2>=_0x261d1f){_0x4063c2=_0x261d1f;_0x516c3d=0xc8;}else{_0x516c3d=0xce;}_0x222720[_0x7ffc('0x19')](_0x516c3d);return _0x222720['set'](_0x7ffc('0x20'),_0x34f2b3+'-'+_0x4063c2+'/'+_0x261d1f)[_0x7ffc('0x1b')](_0x449958);}return null;};}function patchUpdates(_0x4a0439){return function(_0x121454){try{jsonpatch[_0x7ffc('0x21')](_0x121454,_0x4a0439,!![]);}catch(_0x21c124){return BPromise[_0x7ffc('0x22')](_0x21c124);}return _0x121454[_0x7ffc('0x23')]();};}function saveUpdates(_0x42688c,_0x13c9a0){return function(_0x2f6002){if(_0x2f6002){return _0x2f6002['update'](_0x42688c)[_0x7ffc('0x24')](function(_0x12d5df){return _0x12d5df;});}return null;};}function removeEntity(_0x34b2a9,_0x387840){return function(_0x5b40e2){if(_0x5b40e2){return _0x5b40e2[_0x7ffc('0x25')]()['then'](function(){var _0x570050=_0x5b40e2[_0x7ffc('0x26')]({'plain':!![]});var _0x353c58=_0x7ffc('0x27');return db[_0x7ffc('0x28')]['destroy']({'where':{'type':_0x353c58,'resourceId':_0x570050['id']}})[_0x7ffc('0x24')](function(){return _0x5b40e2;});})['then'](function(){_0x34b2a9[_0x7ffc('0x19')](0xcc)[_0x7ffc('0x1a')]();});}};}function handleEntityNotFound(_0x1d7ff9,_0xc1af9d){return function(_0x52c17f){if(!_0x52c17f){_0x1d7ff9[_0x7ffc('0x18')](0x194);}return _0x52c17f;};}function handleError(_0x8af051,_0x5738b0){_0x5738b0=_0x5738b0||0x1f4;return function(_0x1f7093){logger[_0x7ffc('0x29')](_0x1f7093[_0x7ffc('0x2a')]);if(_0x1f7093[_0x7ffc('0x2b')]){delete _0x1f7093['name'];}_0x8af051['status'](_0x5738b0)[_0x7ffc('0x2c')](_0x1f7093);};}exports[_0x7ffc('0x2d')]=function(_0xa118d1,_0x47dfeb){var _0x41874e={},_0x2a6914={},_0xd9354a={'count':0x0,'rows':[]};var _0x1d7d45=_[_0x7ffc('0x2e')](db[_0x7ffc('0x2f')][_0x7ffc('0x30')],function(_0x4b20d3){return{'name':_0x4b20d3[_0x7ffc('0x31')],'type':_0x4b20d3[_0x7ffc('0x32')][_0x7ffc('0x33')]};});_0x2a6914['model']=_['map'](_0x1d7d45,_0x7ffc('0x2b'));_0x2a6914[_0x7ffc('0x34')]=_[_0x7ffc('0x35')](_0xa118d1[_0x7ffc('0x34')]);_0x2a6914['filters']=_['intersection'](_0x2a6914[_0x7ffc('0x36')],_0x2a6914['query']);_0x41874e[_0x7ffc('0x37')]=_[_0x7ffc('0x38')](_0x2a6914[_0x7ffc('0x36')],qs[_0x7ffc('0x39')](_0xa118d1['query'][_0x7ffc('0x39')]));_0x41874e[_0x7ffc('0x37')]=_0x41874e[_0x7ffc('0x37')][_0x7ffc('0x3a')]?_0x41874e[_0x7ffc('0x37')]:_0x2a6914[_0x7ffc('0x36')];if(!_0xa118d1[_0x7ffc('0x34')][_0x7ffc('0x3b')]('nolimit')){_0x41874e['limit']=qs['limit'](_0xa118d1[_0x7ffc('0x34')][_0x7ffc('0x1d')]);_0x41874e[_0x7ffc('0x1e')]=qs[_0x7ffc('0x1e')](_0xa118d1[_0x7ffc('0x34')][_0x7ffc('0x1e')]);}_0x41874e[_0x7ffc('0x3c')]=qs[_0x7ffc('0x3d')](_0xa118d1[_0x7ffc('0x34')][_0x7ffc('0x3d')]);_0x41874e[_0x7ffc('0x3e')]=qs[_0x7ffc('0x3f')](_[_0x7ffc('0x40')](_0xa118d1['query'],_0x2a6914['filters']),_0x1d7d45);if(_0xa118d1[_0x7ffc('0x34')][_0x7ffc('0x41')]){_0x41874e[_0x7ffc('0x3e')]=_[_0x7ffc('0x42')](_0x41874e['where'],{'$or':_['map'](_0x1d7d45,function(_0x3fd0f1){if(_0x3fd0f1[_0x7ffc('0x32')]!==_0x7ffc('0x43')){var _0x107d5f={};_0x107d5f[_0x3fd0f1[_0x7ffc('0x2b')]]={'$like':'%'+_0xa118d1[_0x7ffc('0x34')]['filter']+'%'};return _0x107d5f;}})});}_0x41874e=_['merge']({},_0x41874e,_0xa118d1['options']);var _0x46c0eb={'where':_0x41874e[_0x7ffc('0x3e')]};return db['Sound'][_0x7ffc('0x1f')](_0x46c0eb)[_0x7ffc('0x24')](function(_0x42f439){_0xd9354a[_0x7ffc('0x1f')]=_0x42f439;if(_0xa118d1[_0x7ffc('0x34')]['includeAll']){_0x41874e[_0x7ffc('0x44')]=[{'all':!![]}];}return db[_0x7ffc('0x2f')]['findAll'](_0x41874e);})[_0x7ffc('0x24')](function(_0xba1d96){_0xd9354a[_0x7ffc('0x45')]=_0xba1d96;return _0xd9354a;})[_0x7ffc('0x24')](respondWithFilteredResult(_0x47dfeb,_0x41874e))[_0x7ffc('0x46')](handleError(_0x47dfeb,null));};exports[_0x7ffc('0x47')]=function(_0x3ad263,_0x578e6b){var _0x31c0b0={'raw':!![],'where':{'id':_0x3ad263[_0x7ffc('0x48')]['id']}},_0x8cc31b={};_0x8cc31b[_0x7ffc('0x36')]=_[_0x7ffc('0x35')](db[_0x7ffc('0x2f')][_0x7ffc('0x30')]);_0x8cc31b[_0x7ffc('0x34')]=_[_0x7ffc('0x35')](_0x3ad263[_0x7ffc('0x34')]);_0x8cc31b[_0x7ffc('0x3f')]=_[_0x7ffc('0x38')](_0x8cc31b['model'],_0x8cc31b['query']);_0x31c0b0['attributes']=_[_0x7ffc('0x38')](_0x8cc31b[_0x7ffc('0x36')],qs[_0x7ffc('0x39')](_0x3ad263['query'][_0x7ffc('0x39')]));_0x31c0b0[_0x7ffc('0x37')]=_0x31c0b0[_0x7ffc('0x37')][_0x7ffc('0x3a')]?_0x31c0b0[_0x7ffc('0x37')]:_0x8cc31b[_0x7ffc('0x36')];if(_0x3ad263['query'][_0x7ffc('0x49')]){_0x31c0b0[_0x7ffc('0x44')]=[{'all':!![]}];}_0x31c0b0=_['merge']({},_0x31c0b0,_0x3ad263[_0x7ffc('0x4a')]);return db['Sound'][_0x7ffc('0x4b')](_0x31c0b0)['then'](handleEntityNotFound(_0x578e6b,null))[_0x7ffc('0x24')](respondWithResult(_0x578e6b,null))[_0x7ffc('0x46')](handleError(_0x578e6b,null));};exports[_0x7ffc('0x4c')]=function(_0x3a6674,_0x22ea50,_0x40ac4f){return db[_0x7ffc('0x2f')][_0x7ffc('0x4b')]({'where':{'id':_0x3a6674[_0x7ffc('0x48')]['id']},'attributes':['name',_0x7ffc('0x4d'),_0x7ffc('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x22ea50,null))[_0x7ffc('0x24')](function(_0x126eb9){if(_0x126eb9){if(!fs[_0x7ffc('0x4f')](path[_0x7ffc('0x50')](config[_0x7ffc('0x51')],_0x7ffc('0x52'),_0x126eb9[_0x7ffc('0x4d')]+'.'+_0x126eb9[_0x7ffc('0x4e')]))){throw new db['Sequelize'][(_0x7ffc('0x53'))](_0x7ffc('0x54'));}return _0x22ea50['download'](path[_0x7ffc('0x50')](config[_0x7ffc('0x51')],_0x7ffc('0x52'),util[_0x7ffc('0x55')](_0x7ffc('0x56'),_0x126eb9[_0x7ffc('0x4d')],_0x126eb9[_0x7ffc('0x4e')])),util[_0x7ffc('0x55')](_0x7ffc('0x56'),_0x126eb9[_0x7ffc('0x2b')],_0x126eb9['converted_format']));}return null;})[_0x7ffc('0x46')](handleError(_0x22ea50,null));};exports[_0x7ffc('0x57')]=function(_0x4f5683,_0x5bc53c,_0x49026a){var _0x10b307={'name':path['basename'](_0x4f5683[_0x7ffc('0x58')][_0x7ffc('0x59')],path['extname'](_0x4f5683['file'][_0x7ffc('0x59')])),'save_name':path[_0x7ffc('0x5a')](_0x4f5683[_0x7ffc('0x58')]['filename'],path[_0x7ffc('0x5b')](_0x4f5683[_0x7ffc('0x58')][_0x7ffc('0x5c')])),'original_format':path['extname'](_0x4f5683['file']['originalname'])[_0x7ffc('0x5d')](0x1),'converted_format':'wav'};var _0x4ff3c6=path['join'](config[_0x7ffc('0x51')],'server/files/sounds/original',_0x4f5683[_0x7ffc('0x58')]['filename']);var _0x31c056=path[_0x7ffc('0x50')](config['root'],_0x7ffc('0x52'),util[_0x7ffc('0x55')](_0x7ffc('0x56'),path['basename'](_0x4f5683[_0x7ffc('0x58')]['filename'],path[_0x7ffc('0x5b')](_0x4f5683['file'][_0x7ffc('0x5c')])),_0x10b307['converted_format']));logger[_0x7ffc('0x5e')](_0x7ffc('0x5f'),_0x4ff3c6);logger[_0x7ffc('0x5e')](_0x7ffc('0x60'),_0x31c056);try{fs[_0x7ffc('0x61')](_0x4ff3c6,parseInt(_0x7ffc('0x62'),0x8));var _0x50d896=sox[_0x7ffc('0x63')](_0x4ff3c6,_0x31c056,{'sampleRate':0x1f40,'format':_0x7ffc('0x64'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x50d896['on'](_0x7ffc('0x29'),function(_0x56dd85){fs['unlinkSync'](_0x4ff3c6);_0x5bc53c['status'](0x1f4)[_0x7ffc('0x2c')](_0x56dd85);});_0x50d896['on'](_0x7ffc('0x65'),function(_0x54e879){_0x10b307[_0x7ffc('0x66')]=isNaN(_0x54e879[_0x7ffc('0x67')])?null:_0x54e879[_0x7ffc('0x67')]*0x3e8;_0x10b307['original_sampleCount']=isNaN(_0x54e879['sampleCount'])?null:_0x54e879[_0x7ffc('0x68')];_0x10b307['original_channelCount']=isNaN(_0x54e879['channelCount'])?null:_0x54e879[_0x7ffc('0x69')];_0x10b307['original_bitRate']=isNaN(_0x54e879['bitRate'])?null:_0x54e879[_0x7ffc('0x6a')];_0x10b307[_0x7ffc('0x6b')]=isNaN(_0x54e879['sampleRate'])?null:_0x54e879[_0x7ffc('0x6c')];});_0x50d896['on'](_0x7ffc('0x6d'),function(_0x705ab2){_0x10b307[_0x7ffc('0x6e')]=isNaN(_0x705ab2[_0x7ffc('0x67')])?null:_0x705ab2['duration']*0x3e8;_0x10b307[_0x7ffc('0x6f')]=isNaN(_0x705ab2[_0x7ffc('0x68')])?null:_0x705ab2['sampleCount'];_0x10b307[_0x7ffc('0x70')]=isNaN(_0x705ab2[_0x7ffc('0x69')])?null:_0x705ab2[_0x7ffc('0x69')];_0x10b307[_0x7ffc('0x71')]=isNaN(_0x705ab2['bitRate'])?null:_0x705ab2[_0x7ffc('0x6a')];_0x10b307[_0x7ffc('0x72')]=isNaN(_0x705ab2[_0x7ffc('0x6c')])?null:_0x705ab2[_0x7ffc('0x6c')];});_0x50d896['on']('end',function(){fs[_0x7ffc('0x61')](_0x31c056,parseInt(_0x7ffc('0x62'),0x8));return db[_0x7ffc('0x2f')][_0x7ffc('0x57')](_0x10b307)['then'](function(_0xacf866){var _0x4799fc={'role':_0x4f5683[_0x7ffc('0x73')][_0x7ffc('0x74')],'userProfileId':_0x4f5683[_0x7ffc('0x73')][_0x7ffc('0x75')]};if(!_0x4799fc)throw new Error(_0x7ffc('0x76'));if(_0x4799fc['role']===_0x7ffc('0x77')){var _0x9e79fe=_0xacf866[_0x7ffc('0x26')]({'plain':!![]});return db[_0x7ffc('0x78')][_0x7ffc('0x4b')]({'where':{'name':_0x7ffc('0x27'),'userProfileId':_0x4799fc[_0x7ffc('0x75')]},'raw':!![]})[_0x7ffc('0x24')](function(_0x2b1b2e){if(_0x2b1b2e&&_0x2b1b2e[_0x7ffc('0x79')]===0x0){return db[_0x7ffc('0x28')]['create']({'name':_0x9e79fe[_0x7ffc('0x2b')],'resourceId':_0x9e79fe['id'],'type':_0x2b1b2e['name'],'sectionId':_0x2b1b2e['id']},{})['then'](function(){return _0xacf866;});}else{return _0xacf866;}})['catch'](function(_0xc93b3e){logger[_0x7ffc('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc93b3e);throw _0xc93b3e;});}return _0xacf866;})[_0x7ffc('0x24')](respondWithResult(_0x5bc53c,null))[_0x7ffc('0x46')](handleError(_0x5bc53c,null));});_0x50d896[_0x7ffc('0x7a')]();}catch(_0x114680){_0x5bc53c[_0x7ffc('0x19')](0x1f4)[_0x7ffc('0x2c')](_0x114680);}};exports['update']=function(_0x2c9161,_0x1c101c,_0xe57b0c){return db['Sound'][_0x7ffc('0x4b')]({'where':{'id':_0x2c9161[_0x7ffc('0x48')]['id']}})[_0x7ffc('0x24')](handleEntityNotFound(_0x1c101c,null))['then'](saveUpdates(_[_0x7ffc('0x40')](_0x2c9161['body'],[_0x7ffc('0x2b'),_0x7ffc('0x7b')]),null))[_0x7ffc('0x24')](respondWithResult(_0x1c101c,null))['catch'](handleError(_0x1c101c,null));};exports[_0x7ffc('0x7c')]=function(_0x604f73,_0x469579,_0x504ca2){return db['Sound'][_0x7ffc('0x4b')]({'where':{'id':_0x604f73[_0x7ffc('0x48')]['id']}})[_0x7ffc('0x24')](function(_0xcf994e){if(_0xcf994e){return _0xcf994e[_0x7ffc('0x25')]();}})['then'](function(_0x1556ae){var _0x3dbd3f=path[_0x7ffc('0x50')](config[_0x7ffc('0x51')],_0x7ffc('0x7d'),util[_0x7ffc('0x55')](_0x7ffc('0x56'),_0x1556ae[_0x7ffc('0x4d')],_0x1556ae[_0x7ffc('0x7e')]));var _0x4653a3=path[_0x7ffc('0x50')](config['root'],_0x7ffc('0x52'),util[_0x7ffc('0x55')]('%s.%s',_0x1556ae[_0x7ffc('0x4d')],_0x1556ae['converted_format']));fs[_0x7ffc('0x7f')](_0x3dbd3f);fs[_0x7ffc('0x7f')](_0x4653a3);return _0x1556ae;})[_0x7ffc('0x24')](function(_0x4697fd){if(_0x4697fd){return _0x469579[_0x7ffc('0x19')](0xcc)[_0x7ffc('0x1a')]();}})[_0x7ffc('0x24')](handleEntityNotFound(_0x469579,null))[_0x7ffc('0x46')](handleError(_0x469579,null));}; \ No newline at end of file +var _0x3cf2=['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','end','status','json','offset','undefined','count','set','reject','update','then','destroy','get','Sounds','UserProfileResource','error','name','send','index','map','Sound','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','merge','download','find','converted_format','existsSync','join','root','save_name','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','originalname','extname','file','filename','substring','wav','server/files/sounds/original','server/files/sounds/converted','info','Sound\x20upload\x20destination:\x20%s','0777','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_sampleRate','chmodSync','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x5c0979,_0x287854){var _0x309972=function(_0x17defd){while(--_0x17defd){_0x5c0979['push'](_0x5c0979['shift']());}};_0x309972(++_0x287854);}(_0x3cf2,0x72));var _0x23cf=function(_0x230d39,_0x4a26db){_0x230d39=_0x230d39-0x0;var _0x2dcce6=_0x3cf2[_0x230d39];return _0x2dcce6;};'use strict';var emlformat=require(_0x23cf('0x0'));var rimraf=require(_0x23cf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x23cf('0x2'));var rp=require(_0x23cf('0x3'));var moment=require(_0x23cf('0x4'));var BPromise=require(_0x23cf('0x5'));var Mustache=require('mustache');var util=require(_0x23cf('0x6'));var path=require(_0x23cf('0x7'));var sox=require(_0x23cf('0x8'));var csv=require(_0x23cf('0x9'));var ejs=require(_0x23cf('0xa'));var fs=require('fs');var fs_extra=require(_0x23cf('0xb'));var _=require(_0x23cf('0xc'));var squel=require(_0x23cf('0xd'));var crypto=require(_0x23cf('0xe'));var jsforce=require(_0x23cf('0xf'));var deskjs=require(_0x23cf('0x10'));var toCsv=require(_0x23cf('0x9'));var querystring=require('querystring');var Papa=require(_0x23cf('0x11'));var Redis=require(_0x23cf('0x12'));var authService=require(_0x23cf('0x13'));var qs=require(_0x23cf('0x14'));var as=require(_0x23cf('0x15'));var hardwareService=require(_0x23cf('0x16'));var logger=require('../../config/logger')(_0x23cf('0x17'));var utils=require(_0x23cf('0x18'));var config=require(_0x23cf('0x19'));var licenseUtil=require(_0x23cf('0x1a'));var db=require(_0x23cf('0x1b'))['db'];function respondWithStatusCode(_0x34efb8,_0x2b5d84){_0x2b5d84=_0x2b5d84||0xcc;return function(_0x33d18b){if(_0x33d18b){return _0x34efb8[_0x23cf('0x1c')](_0x2b5d84);}return _0x34efb8['status'](_0x2b5d84)[_0x23cf('0x1d')]();};}function respondWithResult(_0xdcfd1a,_0x213e29){_0x213e29=_0x213e29||0xc8;return function(_0x24645d){if(_0x24645d){return _0xdcfd1a[_0x23cf('0x1e')](_0x213e29)[_0x23cf('0x1f')](_0x24645d);}};}function respondWithFilteredResult(_0xf85fa2,_0x591370){return function(_0xdcc3a1){if(_0xdcc3a1){var _0x4ef48c=typeof _0x591370[_0x23cf('0x20')]===_0x23cf('0x21')&&typeof _0x591370['limit']===_0x23cf('0x21');var _0x50f4bd=_0xdcc3a1[_0x23cf('0x22')];var _0xc4349=_0x4ef48c?0x0:_0x591370[_0x23cf('0x20')];var _0x553136=_0x4ef48c?_0xdcc3a1[_0x23cf('0x22')]:_0x591370[_0x23cf('0x20')]+_0x591370['limit'];var _0x218475;if(_0x553136>=_0x50f4bd){_0x553136=_0x50f4bd;_0x218475=0xc8;}else{_0x218475=0xce;}_0xf85fa2[_0x23cf('0x1e')](_0x218475);return _0xf85fa2[_0x23cf('0x23')]('Content-Range',_0xc4349+'-'+_0x553136+'/'+_0x50f4bd)[_0x23cf('0x1f')](_0xdcc3a1);}return null;};}function patchUpdates(_0x2ac2d8){return function(_0x4740a5){try{jsonpatch['apply'](_0x4740a5,_0x2ac2d8,!![]);}catch(_0xfdfb23){return BPromise[_0x23cf('0x24')](_0xfdfb23);}return _0x4740a5['save']();};}function saveUpdates(_0xdbf547,_0x3d5350){return function(_0x1714df){if(_0x1714df){return _0x1714df[_0x23cf('0x25')](_0xdbf547)[_0x23cf('0x26')](function(_0x26e59c){return _0x26e59c;});}return null;};}function removeEntity(_0x4f11fa,_0x29d479){return function(_0x24cf4f){if(_0x24cf4f){return _0x24cf4f[_0x23cf('0x27')]()[_0x23cf('0x26')](function(){var _0xa714aa=_0x24cf4f[_0x23cf('0x28')]({'plain':!![]});var _0x100f09=_0x23cf('0x29');return db[_0x23cf('0x2a')][_0x23cf('0x27')]({'where':{'type':_0x100f09,'resourceId':_0xa714aa['id']}})[_0x23cf('0x26')](function(){return _0x24cf4f;});})[_0x23cf('0x26')](function(){_0x4f11fa[_0x23cf('0x1e')](0xcc)[_0x23cf('0x1d')]();});}};}function handleEntityNotFound(_0x31713e,_0x6b1d46){return function(_0x40e271){if(!_0x40e271){_0x31713e[_0x23cf('0x1c')](0x194);}return _0x40e271;};}function handleError(_0x333429,_0x476cc3){_0x476cc3=_0x476cc3||0x1f4;return function(_0xa97481){logger[_0x23cf('0x2b')](_0xa97481['stack']);if(_0xa97481['name']){delete _0xa97481[_0x23cf('0x2c')];}_0x333429[_0x23cf('0x1e')](_0x476cc3)[_0x23cf('0x2d')](_0xa97481);};}exports[_0x23cf('0x2e')]=function(_0x13fb27,_0x22f4d7){var _0x229add={},_0x37aaac={},_0x179d24={'count':0x0,'rows':[]};var _0x51af0d=_[_0x23cf('0x2f')](db[_0x23cf('0x30')]['rawAttributes'],function(_0x1319bb){return{'name':_0x1319bb[_0x23cf('0x31')],'type':_0x1319bb[_0x23cf('0x32')][_0x23cf('0x33')]};});_0x37aaac[_0x23cf('0x34')]=_[_0x23cf('0x2f')](_0x51af0d,_0x23cf('0x2c'));_0x37aaac[_0x23cf('0x35')]=_['keys'](_0x13fb27[_0x23cf('0x35')]);_0x37aaac['filters']=_[_0x23cf('0x36')](_0x37aaac['model'],_0x37aaac[_0x23cf('0x35')]);_0x229add[_0x23cf('0x37')]=_['intersection'](_0x37aaac[_0x23cf('0x34')],qs[_0x23cf('0x38')](_0x13fb27[_0x23cf('0x35')][_0x23cf('0x38')]));_0x229add[_0x23cf('0x37')]=_0x229add[_0x23cf('0x37')][_0x23cf('0x39')]?_0x229add['attributes']:_0x37aaac['model'];if(!_0x13fb27[_0x23cf('0x35')][_0x23cf('0x3a')]('nolimit')){_0x229add[_0x23cf('0x3b')]=qs[_0x23cf('0x3b')](_0x13fb27['query'][_0x23cf('0x3b')]);_0x229add[_0x23cf('0x20')]=qs[_0x23cf('0x20')](_0x13fb27[_0x23cf('0x35')][_0x23cf('0x20')]);}_0x229add[_0x23cf('0x3c')]=qs['sort'](_0x13fb27['query'][_0x23cf('0x3d')]);_0x229add[_0x23cf('0x3e')]=qs[_0x23cf('0x3f')](_[_0x23cf('0x40')](_0x13fb27[_0x23cf('0x35')],_0x37aaac[_0x23cf('0x3f')]),_0x51af0d);if(_0x13fb27['query']['filter']){_0x229add[_0x23cf('0x3e')]=_['merge'](_0x229add[_0x23cf('0x3e')],{'$or':_[_0x23cf('0x2f')](_0x51af0d,function(_0x3339f2){if(_0x3339f2[_0x23cf('0x32')]!==_0x23cf('0x41')){var _0x5df09c={};_0x5df09c[_0x3339f2[_0x23cf('0x2c')]]={'$like':'%'+_0x13fb27[_0x23cf('0x35')]['filter']+'%'};return _0x5df09c;}})});}_0x229add=_['merge']({},_0x229add,_0x13fb27[_0x23cf('0x42')]);var _0x9262fe={'where':_0x229add[_0x23cf('0x3e')]};return db[_0x23cf('0x30')][_0x23cf('0x22')](_0x9262fe)[_0x23cf('0x26')](function(_0x59dc83){_0x179d24[_0x23cf('0x22')]=_0x59dc83;if(_0x13fb27['query'][_0x23cf('0x43')]){_0x229add[_0x23cf('0x44')]=[{'all':!![]}];}return db[_0x23cf('0x30')][_0x23cf('0x45')](_0x229add);})[_0x23cf('0x26')](function(_0x3bb22a){_0x179d24[_0x23cf('0x46')]=_0x3bb22a;return _0x179d24;})['then'](respondWithFilteredResult(_0x22f4d7,_0x229add))[_0x23cf('0x47')](handleError(_0x22f4d7,null));};exports['show']=function(_0x232255,_0x502c72){var _0x8f2ee7={'raw':!![],'where':{'id':_0x232255[_0x23cf('0x48')]['id']}},_0x1a3b19={};_0x1a3b19[_0x23cf('0x34')]=_[_0x23cf('0x49')](db['Sound']['rawAttributes']);_0x1a3b19[_0x23cf('0x35')]=_['keys'](_0x232255['query']);_0x1a3b19[_0x23cf('0x3f')]=_[_0x23cf('0x36')](_0x1a3b19[_0x23cf('0x34')],_0x1a3b19[_0x23cf('0x35')]);_0x8f2ee7[_0x23cf('0x37')]=_[_0x23cf('0x36')](_0x1a3b19[_0x23cf('0x34')],qs['fields'](_0x232255['query'][_0x23cf('0x38')]));_0x8f2ee7[_0x23cf('0x37')]=_0x8f2ee7[_0x23cf('0x37')][_0x23cf('0x39')]?_0x8f2ee7[_0x23cf('0x37')]:_0x1a3b19[_0x23cf('0x34')];if(_0x232255[_0x23cf('0x35')][_0x23cf('0x43')]){_0x8f2ee7['include']=[{'all':!![]}];}_0x8f2ee7=_[_0x23cf('0x4a')]({},_0x8f2ee7,_0x232255['options']);return db[_0x23cf('0x30')]['find'](_0x8f2ee7)[_0x23cf('0x26')](handleEntityNotFound(_0x502c72,null))['then'](respondWithResult(_0x502c72,null))[_0x23cf('0x47')](handleError(_0x502c72,null));};exports[_0x23cf('0x4b')]=function(_0x4c7dfd,_0x3a2765,_0x864b42){return db[_0x23cf('0x30')][_0x23cf('0x4c')]({'where':{'id':_0x4c7dfd['params']['id']},'attributes':[_0x23cf('0x2c'),'save_name',_0x23cf('0x4d')],'raw':!![]})[_0x23cf('0x26')](handleEntityNotFound(_0x3a2765,null))[_0x23cf('0x26')](function(_0x32effa){if(_0x32effa){if(!fs[_0x23cf('0x4e')](path[_0x23cf('0x4f')](config[_0x23cf('0x50')],'server/files/sounds/converted',_0x32effa[_0x23cf('0x51')]+'.'+_0x32effa[_0x23cf('0x4d')]))){throw new db[(_0x23cf('0x52'))][(_0x23cf('0x53'))](_0x23cf('0x54'));}return _0x3a2765[_0x23cf('0x4b')](path[_0x23cf('0x4f')](config['root'],'server/files/sounds/converted',util[_0x23cf('0x55')]('%s.%s',_0x32effa[_0x23cf('0x51')],_0x32effa[_0x23cf('0x4d')])),util[_0x23cf('0x55')](_0x23cf('0x56'),_0x32effa[_0x23cf('0x2c')],_0x32effa[_0x23cf('0x4d')]));}return null;})[_0x23cf('0x47')](handleError(_0x3a2765,null));};exports[_0x23cf('0x57')]=function(_0x19ead7,_0x394ca3,_0x41d24a){var _0x24c52c={'name':path[_0x23cf('0x58')](_0x19ead7['file'][_0x23cf('0x59')],path[_0x23cf('0x5a')](_0x19ead7[_0x23cf('0x5b')][_0x23cf('0x59')])),'save_name':path['basename'](_0x19ead7[_0x23cf('0x5b')][_0x23cf('0x5c')],path['extname'](_0x19ead7[_0x23cf('0x5b')][_0x23cf('0x5c')])),'original_format':path[_0x23cf('0x5a')](_0x19ead7[_0x23cf('0x5b')][_0x23cf('0x59')])[_0x23cf('0x5d')](0x1),'converted_format':_0x23cf('0x5e')};var _0x545e4a=path[_0x23cf('0x4f')](config[_0x23cf('0x50')],_0x23cf('0x5f'),_0x19ead7[_0x23cf('0x5b')][_0x23cf('0x5c')]);var _0x2cfbd5=path[_0x23cf('0x4f')](config[_0x23cf('0x50')],_0x23cf('0x60'),util[_0x23cf('0x55')](_0x23cf('0x56'),path[_0x23cf('0x58')](_0x19ead7[_0x23cf('0x5b')]['filename'],path[_0x23cf('0x5a')](_0x19ead7['file']['filename'])),_0x24c52c[_0x23cf('0x4d')]));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x545e4a);logger[_0x23cf('0x61')](_0x23cf('0x62'),_0x2cfbd5);try{fs['chmodSync'](_0x545e4a,parseInt(_0x23cf('0x63'),0x8));var _0x259368=sox['transcode'](_0x545e4a,_0x2cfbd5,{'sampleRate':0x1f40,'format':_0x23cf('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x259368['on']('error',function(_0x3644b1){fs[_0x23cf('0x64')](_0x545e4a);_0x394ca3[_0x23cf('0x1e')](0x1f4)[_0x23cf('0x2d')](_0x3644b1);});_0x259368['on'](_0x23cf('0x65'),function(_0x3b5051){_0x24c52c[_0x23cf('0x66')]=isNaN(_0x3b5051[_0x23cf('0x67')])?null:_0x3b5051[_0x23cf('0x67')]*0x3e8;_0x24c52c[_0x23cf('0x68')]=isNaN(_0x3b5051[_0x23cf('0x69')])?null:_0x3b5051[_0x23cf('0x69')];_0x24c52c[_0x23cf('0x6a')]=isNaN(_0x3b5051['channelCount'])?null:_0x3b5051[_0x23cf('0x6b')];_0x24c52c[_0x23cf('0x6c')]=isNaN(_0x3b5051[_0x23cf('0x6d')])?null:_0x3b5051[_0x23cf('0x6d')];_0x24c52c[_0x23cf('0x6e')]=isNaN(_0x3b5051[_0x23cf('0x6f')])?null:_0x3b5051[_0x23cf('0x6f')];});_0x259368['on'](_0x23cf('0x70'),function(_0x13df13){_0x24c52c['converted_duration']=isNaN(_0x13df13[_0x23cf('0x67')])?null:_0x13df13['duration']*0x3e8;_0x24c52c[_0x23cf('0x71')]=isNaN(_0x13df13[_0x23cf('0x69')])?null:_0x13df13[_0x23cf('0x69')];_0x24c52c['converted_channelCount']=isNaN(_0x13df13[_0x23cf('0x6b')])?null:_0x13df13[_0x23cf('0x6b')];_0x24c52c['converted_bitRate']=isNaN(_0x13df13[_0x23cf('0x6d')])?null:_0x13df13[_0x23cf('0x6d')];_0x24c52c[_0x23cf('0x72')]=isNaN(_0x13df13[_0x23cf('0x6f')])?null:_0x13df13[_0x23cf('0x6f')];});_0x259368['on'](_0x23cf('0x1d'),function(){fs[_0x23cf('0x73')](_0x2cfbd5,parseInt('0777',0x8));return db[_0x23cf('0x30')][_0x23cf('0x57')](_0x24c52c)[_0x23cf('0x26')](function(_0x7d2061){var _0x41048b={'role':_0x19ead7[_0x23cf('0x74')]['role'],'userProfileId':_0x19ead7[_0x23cf('0x74')][_0x23cf('0x75')]};if(!_0x41048b)throw new Error(_0x23cf('0x76'));if(_0x41048b[_0x23cf('0x77')]==='user'){var _0x50c479=_0x7d2061[_0x23cf('0x28')]({'plain':!![]});return db[_0x23cf('0x78')][_0x23cf('0x4c')]({'where':{'name':_0x23cf('0x29'),'userProfileId':_0x41048b[_0x23cf('0x75')]},'raw':!![]})[_0x23cf('0x26')](function(_0x5260ef){if(_0x5260ef&&_0x5260ef[_0x23cf('0x79')]===0x0){return db[_0x23cf('0x2a')][_0x23cf('0x57')]({'name':_0x50c479['name'],'resourceId':_0x50c479['id'],'type':_0x5260ef[_0x23cf('0x2c')],'sectionId':_0x5260ef['id']},{})[_0x23cf('0x26')](function(){return _0x7d2061;});}else{return _0x7d2061;}})[_0x23cf('0x47')](function(_0x1d9e93){logger[_0x23cf('0x2b')](_0x23cf('0x7a'),_0x1d9e93);throw _0x1d9e93;});}return _0x7d2061;})[_0x23cf('0x26')](respondWithResult(_0x394ca3,null))['catch'](handleError(_0x394ca3,null));});_0x259368[_0x23cf('0x7b')]();}catch(_0x162562){_0x394ca3['status'](0x1f4)[_0x23cf('0x2d')](_0x162562);}};exports['update']=function(_0x359786,_0x51905d,_0x21ba45){return db['Sound']['find']({'where':{'id':_0x359786[_0x23cf('0x48')]['id']}})[_0x23cf('0x26')](handleEntityNotFound(_0x51905d,null))[_0x23cf('0x26')](saveUpdates(_['pick'](_0x359786[_0x23cf('0x74')],[_0x23cf('0x2c'),'description']),null))[_0x23cf('0x26')](respondWithResult(_0x51905d,null))[_0x23cf('0x47')](handleError(_0x51905d,null));};exports[_0x23cf('0x7c')]=function(_0x1eee67,_0x3b5ab7,_0x25245c){return db[_0x23cf('0x30')][_0x23cf('0x4c')]({'where':{'id':_0x1eee67['params']['id']}})[_0x23cf('0x26')](function(_0x26e313){if(_0x26e313){return _0x26e313[_0x23cf('0x27')]();}})['then'](function(_0x420025){var _0x3a94a6=path[_0x23cf('0x4f')](config['root'],_0x23cf('0x5f'),util[_0x23cf('0x55')](_0x23cf('0x56'),_0x420025['save_name'],_0x420025[_0x23cf('0x7d')]));var _0x544dc9=path[_0x23cf('0x4f')](config[_0x23cf('0x50')],_0x23cf('0x60'),util[_0x23cf('0x55')](_0x23cf('0x56'),_0x420025[_0x23cf('0x51')],_0x420025[_0x23cf('0x4d')]));fs['unlinkSync'](_0x3a94a6);fs[_0x23cf('0x64')](_0x544dc9);return _0x420025;})['then'](function(_0x26f7e4){if(_0x26f7e4){return _0x3b5ab7[_0x23cf('0x1e')](0xcc)[_0x23cf('0x1d')]();}})['then'](handleEntityNotFound(_0x3b5ab7,null))[_0x23cf('0x47')](handleError(_0x3b5ab7,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 27456f3..dad6017 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 _0xf683=['api','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','define','Sound','tools_sounds','lodash','../../config/logger'];(function(_0x1385f0,_0x5550bb){var _0x36ca00=function(_0x1bc769){while(--_0x1bc769){_0x1385f0['push'](_0x1385f0['shift']());}};_0x36ca00(++_0x5550bb);}(_0xf683,0x14e));var _0x3f68=function(_0x26de50,_0x141c8a){_0x26de50=_0x26de50-0x0;var _0x450ea9=_0xf683[_0x26de50];return _0x450ea9;};'use strict';var _=require(_0x3f68('0x0'));var util=require('util');var logger=require(_0x3f68('0x1'))(_0x3f68('0x2'));var moment=require('moment');var BPromise=require(_0x3f68('0x3'));var rp=require(_0x3f68('0x4'));var fs=require('fs');var path=require(_0x3f68('0x5'));var rimraf=require(_0x3f68('0x6'));var config=require(_0x3f68('0x7'));var attributes=require(_0x3f68('0x8'));module['exports']=function(_0x2f59c7,_0x14c50e){return _0x2f59c7[_0x3f68('0x9')](_0x3f68('0xa'),attributes,{'tableName':_0x3f68('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x571c=['path','rimraf','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x54c58f,_0x625f89){var _0x27481e=function(_0x3908be){while(--_0x3908be){_0x54c58f['push'](_0x54c58f['shift']());}};_0x27481e(++_0x625f89);}(_0x571c,0xca));var _0xc571=function(_0x465b8d,_0x2bd0cd){_0x465b8d=_0x465b8d-0x0;var _0x18aa47=_0x571c[_0x465b8d];return _0x18aa47;};'use strict';var _=require(_0xc571('0x0'));var util=require(_0xc571('0x1'));var logger=require(_0xc571('0x2'))(_0xc571('0x3'));var moment=require(_0xc571('0x4'));var BPromise=require(_0xc571('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc571('0x6'));var rimraf=require(_0xc571('0x7'));var config=require('../../config/environment');var attributes=require(_0xc571('0x8'));module[_0xc571('0x9')]=function(_0x2ba3cf,_0x20fc62){return _0x2ba3cf[_0xc571('0xa')](_0xc571('0xb'),attributes,{'tableName':_0xc571('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 1364302..1e26022 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 _0xf3ed=['Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ShowSound','find','options','raw','where','include','map','model','attributes','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1c8f52,_0x87cbeb){var _0x3d0653=function(_0x340f4a){while(--_0x340f4a){_0x1c8f52['push'](_0x1c8f52['shift']());}};_0x3d0653(++_0x87cbeb);}(_0xf3ed,0x78));var _0xdf3e=function(_0x2a4bc4,_0x438f4b){_0x2a4bc4=_0x2a4bc4-0x0;var _0xaa0301=_0xf3ed[_0x2a4bc4];return _0xaa0301;};'use strict';var _=require(_0xdf3e('0x0'));var util=require(_0xdf3e('0x1'));var moment=require(_0xdf3e('0x2'));var BPromise=require(_0xdf3e('0x3'));var rs=require(_0xdf3e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf3e('0x5'))['db'];var utils=require(_0xdf3e('0x6'));var logger=require(_0xdf3e('0x7'))(_0xdf3e('0x8'));var config=require(_0xdf3e('0x9'));var jayson=require(_0xdf3e('0xa'));var client=jayson[_0xdf3e('0xb')][_0xdf3e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1695d1,_0x5530ba,_0x10a15a){return new BPromise(function(_0x3bf89d,_0x47a5be){return client[_0xdf3e('0xd')](_0x1695d1,_0x10a15a)[_0xdf3e('0xe')](function(_0x560a3a){logger[_0xdf3e('0xf')](_0xdf3e('0x10'),_0x5530ba,'request\x20sent');logger[_0xdf3e('0x11')](_0xdf3e('0x12'),_0x5530ba,_0xdf3e('0x13'),JSON[_0xdf3e('0x14')](_0x560a3a));if(_0x560a3a[_0xdf3e('0x15')]){if(_0x560a3a[_0xdf3e('0x15')][_0xdf3e('0x16')]===0x1f4){logger[_0xdf3e('0x15')]('Sound,\x20%s,\x20%s',_0x5530ba,_0x560a3a[_0xdf3e('0x15')][_0xdf3e('0x17')]);return _0x47a5be(_0x560a3a[_0xdf3e('0x15')][_0xdf3e('0x17')]);}logger[_0xdf3e('0x15')](_0xdf3e('0x10'),_0x5530ba,_0x560a3a['error'][_0xdf3e('0x17')]);return _0x3bf89d(_0x560a3a[_0xdf3e('0x15')]['message']);}else{logger[_0xdf3e('0xf')](_0xdf3e('0x10'),_0x5530ba,'request\x20sent');_0x3bf89d(_0x560a3a['result']['message']);}})['catch'](function(_0x539014){logger[_0xdf3e('0x15')](_0xdf3e('0x10'),_0x5530ba,_0x539014);_0x47a5be(_0x539014);});});}exports[_0xdf3e('0x18')]=function(_0x2c1608){var _0x39ac9a=this;return new Promise(function(_0x1781f6,_0x5dfd64){return db['Sound'][_0xdf3e('0x19')]({'raw':_0x2c1608[_0xdf3e('0x1a')]?_0x2c1608[_0xdf3e('0x1a')][_0xdf3e('0x1b')]===undefined?!![]:![]:!![],'where':_0x2c1608[_0xdf3e('0x1a')]?_0x2c1608[_0xdf3e('0x1a')][_0xdf3e('0x1c')]||null:null,'attributes':_0x2c1608[_0xdf3e('0x1a')]?_0x2c1608[_0xdf3e('0x1a')]['attributes']||null:null,'include':_0x2c1608['options']?_0x2c1608[_0xdf3e('0x1a')][_0xdf3e('0x1d')]?_[_0xdf3e('0x1e')](_0x2c1608[_0xdf3e('0x1a')][_0xdf3e('0x1d')],function(_0x1afbd6){return{'model':db[_0x1afbd6[_0xdf3e('0x1f')]],'as':_0x1afbd6['as'],'attributes':_0x1afbd6[_0xdf3e('0x20')],'include':_0x1afbd6[_0xdf3e('0x1d')]?_['map'](_0x1afbd6[_0xdf3e('0x1d')],function(_0x429f2e){return{'model':db[_0x429f2e[_0xdf3e('0x1f')]],'as':_0x429f2e['as'],'attributes':_0x429f2e['attributes'],'include':_0x429f2e[_0xdf3e('0x1d')]?_['map'](_0x429f2e[_0xdf3e('0x1d')],function(_0x55bafd){return{'model':db[_0x55bafd[_0xdf3e('0x1f')]],'as':_0x55bafd['as'],'attributes':_0x55bafd[_0xdf3e('0x20')]};}):[]};}):[]};}):[]:[]})[_0xdf3e('0xe')](function(_0x1aee33){logger[_0xdf3e('0xf')](_0xdf3e('0x18'),_0x2c1608);logger[_0xdf3e('0x11')](_0xdf3e('0x18'),_0x2c1608,JSON[_0xdf3e('0x14')](_0x1aee33));_0x1781f6(_0x1aee33);})[_0xdf3e('0x21')](function(_0x23cbf7){logger[_0xdf3e('0x15')](_0xdf3e('0x18'),_0x23cbf7[_0xdf3e('0x17')],_0x2c1608);_0x5dfd64(_0x39ac9a[_0xdf3e('0x15')](0x1f4,_0x23cbf7['message']));});});}; \ No newline at end of file +var _0x95cd=['map','model','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSound','Sound','options','raw','attributes','include'];(function(_0x4e4a6e,_0x974108){var _0x2ae3fa=function(_0x1fb4f7){while(--_0x1fb4f7){_0x4e4a6e['push'](_0x4e4a6e['shift']());}};_0x2ae3fa(++_0x974108);}(_0x95cd,0x177));var _0xd95c=function(_0x40abc3,_0x255fea){_0x40abc3=_0x40abc3-0x0;var _0x2d559b=_0x95cd[_0x40abc3];return _0x2d559b;};'use strict';var _=require(_0xd95c('0x0'));var util=require(_0xd95c('0x1'));var moment=require(_0xd95c('0x2'));var BPromise=require(_0xd95c('0x3'));var rs=require(_0xd95c('0x4'));var fs=require('fs');var Redis=require(_0xd95c('0x5'));var db=require(_0xd95c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd95c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd95c('0x8'));var client=jayson['client'][_0xd95c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51d6c6,_0x30f0e1,_0x537593){return new BPromise(function(_0x41bb82,_0x475734){return client[_0xd95c('0xa')](_0x51d6c6,_0x537593)[_0xd95c('0xb')](function(_0x22e684){logger[_0xd95c('0xc')](_0xd95c('0xd'),_0x30f0e1,_0xd95c('0xe'));logger[_0xd95c('0xf')](_0xd95c('0x10'),_0x30f0e1,_0xd95c('0xe'),JSON[_0xd95c('0x11')](_0x22e684));if(_0x22e684[_0xd95c('0x12')]){if(_0x22e684[_0xd95c('0x12')][_0xd95c('0x13')]===0x1f4){logger['error'](_0xd95c('0xd'),_0x30f0e1,_0x22e684[_0xd95c('0x12')]['message']);return _0x475734(_0x22e684[_0xd95c('0x12')][_0xd95c('0x14')]);}logger[_0xd95c('0x12')]('Sound,\x20%s,\x20%s',_0x30f0e1,_0x22e684[_0xd95c('0x12')]['message']);return _0x41bb82(_0x22e684['error']['message']);}else{logger[_0xd95c('0xc')](_0xd95c('0xd'),_0x30f0e1,'request\x20sent');_0x41bb82(_0x22e684[_0xd95c('0x15')]['message']);}})['catch'](function(_0x51bae9){logger['error'](_0xd95c('0xd'),_0x30f0e1,_0x51bae9);_0x475734(_0x51bae9);});});}exports[_0xd95c('0x16')]=function(_0x1e02c8){var _0x40f6aa=this;return new Promise(function(_0x5947e4,_0x17cba9){return db[_0xd95c('0x17')]['find']({'raw':_0x1e02c8['options']?_0x1e02c8[_0xd95c('0x18')][_0xd95c('0x19')]===undefined?!![]:![]:!![],'where':_0x1e02c8[_0xd95c('0x18')]?_0x1e02c8[_0xd95c('0x18')]['where']||null:null,'attributes':_0x1e02c8['options']?_0x1e02c8[_0xd95c('0x18')][_0xd95c('0x1a')]||null:null,'include':_0x1e02c8[_0xd95c('0x18')]?_0x1e02c8[_0xd95c('0x18')][_0xd95c('0x1b')]?_[_0xd95c('0x1c')](_0x1e02c8[_0xd95c('0x18')][_0xd95c('0x1b')],function(_0x3159e1){return{'model':db[_0x3159e1[_0xd95c('0x1d')]],'as':_0x3159e1['as'],'attributes':_0x3159e1['attributes'],'include':_0x3159e1[_0xd95c('0x1b')]?_[_0xd95c('0x1c')](_0x3159e1[_0xd95c('0x1b')],function(_0xba7ec1){return{'model':db[_0xba7ec1['model']],'as':_0xba7ec1['as'],'attributes':_0xba7ec1[_0xd95c('0x1a')],'include':_0xba7ec1[_0xd95c('0x1b')]?_[_0xd95c('0x1c')](_0xba7ec1[_0xd95c('0x1b')],function(_0x31e65d){return{'model':db[_0x31e65d['model']],'as':_0x31e65d['as'],'attributes':_0x31e65d[_0xd95c('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5bc754){logger[_0xd95c('0xc')](_0xd95c('0x16'),_0x1e02c8);logger[_0xd95c('0xf')](_0xd95c('0x16'),_0x1e02c8,JSON['stringify'](_0x5bc754));_0x5947e4(_0x5bc754);})[_0xd95c('0x1e')](function(_0x23ac5c){logger[_0xd95c('0x12')](_0xd95c('0x16'),_0x23ac5c[_0xd95c('0x14')],_0x1e02c8);_0x17cba9(_0x40f6aa[_0xd95c('0x12')](0x1f4,_0x23ac5c[_0xd95c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 2bbd0c8..f89a62d 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 _0x757a=['destroy','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0x30adb5,_0x9d980a){var _0x4430b3=function(_0x300743){while(--_0x300743){_0x30adb5['push'](_0x30adb5['shift']());}};_0x4430b3(++_0x9d980a);}(_0x757a,0xde));var _0xa757=function(_0x1b699e,_0x47809f){_0x1b699e=_0x1b699e-0x0;var _0x3dcc9b=_0x757a[_0x1b699e];return _0x3dcc9b;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0xb')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xc')]);router['put'](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x2c944e,_0x26f659){var _0x2cc529=function(_0x3fbc4b){while(--_0x3fbc4b){_0x2c944e['push'](_0x2c944e['shift']());}};_0x2cc529(++_0x26f659);}(_0x8603,0x190));var _0x3860=function(_0x4c8ce8,_0x10aeee){_0x4c8ce8=_0x4c8ce8-0x0;var _0x1013d6=_0x8603[_0x4c8ce8];return _0x1013d6;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 01c7344..60b082a 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 _0xa270=['sequelize','ENUM','out','STRING'];(function(_0x561935,_0x5a6071){var _0x4f01b2=function(_0x45a82f){while(--_0x45a82f){_0x561935['push'](_0x561935['shift']());}};_0x4f01b2(++_0x5a6071);}(_0xa270,0x1a8));var _0x0a27=function(_0xf6aa80,_0xe9a060){_0xf6aa80=_0xf6aa80-0x0;var _0x44d84e=_0xa270[_0xf6aa80];return _0x44d84e;};'use strict';var Sequelize=require(_0x0a27('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x0a27('0x1')]('in',_0x0a27('0x2')),'defaultValue':_0x0a27('0x2'),'allowNull':![]},'providerName':{'type':Sequelize[_0x0a27('0x3')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9efd=['out','sequelize','exports','STRING','TEXT','medium','ENUM'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x9efd,0x1cf));var _0xd9ef=function(_0x14f449,_0x15d9e0){_0x14f449=_0x14f449-0x0;var _0x51f8=_0x9efd[_0x14f449];return _0x51f8;};'use strict';var Sequelize=require(_0xd9ef('0x0'));module[_0xd9ef('0x1')]={'uniqueid':{'type':Sequelize[_0xd9ef('0x2')]},'body':{'type':Sequelize[_0xd9ef('0x3')](_0xd9ef('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xd9ef('0x5')]('in',_0xd9ef('0x6')),'defaultValue':_0xd9ef('0x6'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xd9ef('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 04accbc..c90809e 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 _0x81b7=['params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','SquareMessage','fieldName','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','rawAttributes','options','find','catch','create','body'];(function(_0x81498c,_0x5846d9){var _0x18bc08=function(_0x286199){while(--_0x286199){_0x81498c['push'](_0x81498c['shift']());}};_0x18bc08(++_0x5846d9);}(_0x81b7,0x1f2));var _0x781b=function(_0x45130e,_0x3cf22a){_0x45130e=_0x45130e-0x0;var _0x512b7d=_0x81b7[_0x45130e];return _0x512b7d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x781b('0x0'));var zipdir=require(_0x781b('0x1'));var jsonpatch=require(_0x781b('0x2'));var rp=require(_0x781b('0x3'));var moment=require('moment');var BPromise=require(_0x781b('0x4'));var Mustache=require('mustache');var util=require(_0x781b('0x5'));var path=require(_0x781b('0x6'));var sox=require(_0x781b('0x7'));var csv=require(_0x781b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x781b('0x9'));var _=require(_0x781b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x781b('0xb'));var deskjs=require(_0x781b('0xc'));var toCsv=require(_0x781b('0x8'));var querystring=require(_0x781b('0xd'));var Papa=require('papaparse');var Redis=require(_0x781b('0xe'));var authService=require(_0x781b('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x781b('0x10'));var logger=require('../../config/logger')(_0x781b('0x11'));var utils=require('../../config/utils');var config=require(_0x781b('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x781b('0x13'))['db'];function respondWithStatusCode(_0x5d1dcb,_0xfb736f){_0xfb736f=_0xfb736f||0xcc;return function(_0x17242f){if(_0x17242f){return _0x5d1dcb[_0x781b('0x14')](_0xfb736f);}return _0x5d1dcb[_0x781b('0x15')](_0xfb736f)[_0x781b('0x16')]();};}function respondWithResult(_0x52bbe4,_0x2bca7f){_0x2bca7f=_0x2bca7f||0xc8;return function(_0x335e7b){if(_0x335e7b){return _0x52bbe4[_0x781b('0x15')](_0x2bca7f)[_0x781b('0x17')](_0x335e7b);}};}function respondWithFilteredResult(_0x587d56,_0x35503a){return function(_0x533377){if(_0x533377){var _0x176e91=typeof _0x35503a[_0x781b('0x18')]===_0x781b('0x19')&&typeof _0x35503a['limit']===_0x781b('0x19');var _0x554ff5=_0x533377['count'];var _0x2c62e5=_0x176e91?0x0:_0x35503a[_0x781b('0x18')];var _0x22d0da=_0x176e91?_0x533377[_0x781b('0x1a')]:_0x35503a[_0x781b('0x18')]+_0x35503a['limit'];var _0x58b961;if(_0x22d0da>=_0x554ff5){_0x22d0da=_0x554ff5;_0x58b961=0xc8;}else{_0x58b961=0xce;}_0x587d56['status'](_0x58b961);return _0x587d56[_0x781b('0x1b')](_0x781b('0x1c'),_0x2c62e5+'-'+_0x22d0da+'/'+_0x554ff5)[_0x781b('0x17')](_0x533377);}return null;};}function patchUpdates(_0x23c239){return function(_0x2aaa43){try{jsonpatch[_0x781b('0x1d')](_0x2aaa43,_0x23c239,!![]);}catch(_0x5b659b){return BPromise[_0x781b('0x1e')](_0x5b659b);}return _0x2aaa43[_0x781b('0x1f')]();};}function saveUpdates(_0xce8565,_0x4ab3c4){return function(_0x13d2e4){if(_0x13d2e4){return _0x13d2e4[_0x781b('0x20')](_0xce8565)[_0x781b('0x21')](function(_0x882cff){return _0x882cff;});}return null;};}function removeEntity(_0x5e4862,_0x28dcfc){return function(_0x359f72){if(_0x359f72){return _0x359f72[_0x781b('0x22')]()[_0x781b('0x21')](function(){_0x5e4862[_0x781b('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x226d68,_0x3ecd1c){return function(_0x31795d){if(!_0x31795d){_0x226d68[_0x781b('0x14')](0x194);}return _0x31795d;};}function handleError(_0x38ba8f,_0x398bfa){_0x398bfa=_0x398bfa||0x1f4;return function(_0x48624d){logger['error'](_0x48624d[_0x781b('0x23')]);if(_0x48624d[_0x781b('0x24')]){delete _0x48624d['name'];}_0x38ba8f[_0x781b('0x15')](_0x398bfa)[_0x781b('0x25')](_0x48624d);};}exports[_0x781b('0x26')]=function(_0x33561e,_0xbde04f){var _0x3d3d4c={},_0x1957c4={},_0x1cd983={'count':0x0,'rows':[]};var _0x416c75=_[_0x781b('0x27')](db[_0x781b('0x28')]['rawAttributes'],function(_0x27488a){return{'name':_0x27488a[_0x781b('0x29')],'type':_0x27488a['type']['key']};});_0x1957c4[_0x781b('0x2a')]=_[_0x781b('0x27')](_0x416c75,_0x781b('0x24'));_0x1957c4[_0x781b('0x2b')]=_[_0x781b('0x2c')](_0x33561e[_0x781b('0x2b')]);_0x1957c4[_0x781b('0x2d')]=_[_0x781b('0x2e')](_0x1957c4['model'],_0x1957c4[_0x781b('0x2b')]);_0x3d3d4c['attributes']=_[_0x781b('0x2e')](_0x1957c4['model'],qs[_0x781b('0x2f')](_0x33561e[_0x781b('0x2b')]['fields']));_0x3d3d4c[_0x781b('0x30')]=_0x3d3d4c[_0x781b('0x30')][_0x781b('0x31')]?_0x3d3d4c[_0x781b('0x30')]:_0x1957c4[_0x781b('0x2a')];if(!_0x33561e[_0x781b('0x2b')]['hasOwnProperty'](_0x781b('0x32'))){_0x3d3d4c[_0x781b('0x33')]=qs[_0x781b('0x33')](_0x33561e[_0x781b('0x2b')][_0x781b('0x33')]);_0x3d3d4c[_0x781b('0x18')]=qs[_0x781b('0x18')](_0x33561e[_0x781b('0x2b')][_0x781b('0x18')]);}_0x3d3d4c[_0x781b('0x34')]=qs[_0x781b('0x35')](_0x33561e[_0x781b('0x2b')]['sort']);_0x3d3d4c[_0x781b('0x36')]=qs[_0x781b('0x2d')](_[_0x781b('0x37')](_0x33561e['query'],_0x1957c4[_0x781b('0x2d')]),_0x416c75);if(_0x33561e['query']['filter']){_0x3d3d4c[_0x781b('0x36')]=_[_0x781b('0x38')](_0x3d3d4c[_0x781b('0x36')],{'$or':_['map'](_0x416c75,function(_0x3ff120){if(_0x3ff120['type']!==_0x781b('0x39')){var _0x130b21={};_0x130b21[_0x3ff120[_0x781b('0x24')]]={'$like':'%'+_0x33561e[_0x781b('0x2b')][_0x781b('0x3a')]+'%'};return _0x130b21;}})});}_0x3d3d4c=_['merge']({},_0x3d3d4c,_0x33561e['options']);var _0x2d797e={'where':_0x3d3d4c['where']};return db[_0x781b('0x28')]['count'](_0x2d797e)[_0x781b('0x21')](function(_0x54b9ae){_0x1cd983[_0x781b('0x1a')]=_0x54b9ae;if(_0x33561e[_0x781b('0x2b')][_0x781b('0x3b')]){_0x3d3d4c[_0x781b('0x3c')]=[{'all':!![]}];}return db[_0x781b('0x28')][_0x781b('0x3d')](_0x3d3d4c);})['then'](function(_0x15ecad){_0x1cd983[_0x781b('0x3e')]=_0x15ecad;return _0x1cd983;})[_0x781b('0x21')](respondWithFilteredResult(_0xbde04f,_0x3d3d4c))['catch'](handleError(_0xbde04f,null));};exports[_0x781b('0x3f')]=function(_0xb3081b,_0x528def){var _0x4de160={'raw':!![],'where':{'id':_0xb3081b['params']['id']}},_0x16f520={};_0x16f520[_0x781b('0x2a')]=_['keys'](db[_0x781b('0x28')][_0x781b('0x40')]);_0x16f520[_0x781b('0x2b')]=_[_0x781b('0x2c')](_0xb3081b[_0x781b('0x2b')]);_0x16f520[_0x781b('0x2d')]=_[_0x781b('0x2e')](_0x16f520['model'],_0x16f520[_0x781b('0x2b')]);_0x4de160['attributes']=_[_0x781b('0x2e')](_0x16f520['model'],qs[_0x781b('0x2f')](_0xb3081b['query'][_0x781b('0x2f')]));_0x4de160[_0x781b('0x30')]=_0x4de160[_0x781b('0x30')][_0x781b('0x31')]?_0x4de160[_0x781b('0x30')]:_0x16f520[_0x781b('0x2a')];if(_0xb3081b[_0x781b('0x2b')][_0x781b('0x3b')]){_0x4de160[_0x781b('0x3c')]=[{'all':!![]}];}_0x4de160=_[_0x781b('0x38')]({},_0x4de160,_0xb3081b[_0x781b('0x41')]);return db['SquareMessage'][_0x781b('0x42')](_0x4de160)[_0x781b('0x21')](handleEntityNotFound(_0x528def,null))[_0x781b('0x21')](respondWithResult(_0x528def,null))[_0x781b('0x43')](handleError(_0x528def,null));};exports[_0x781b('0x44')]=function(_0xf9d425,_0x585020){return db['SquareMessage']['create'](_0xf9d425['body'],{})[_0x781b('0x21')](respondWithResult(_0x585020,0xc9))[_0x781b('0x43')](handleError(_0x585020,null));};exports[_0x781b('0x20')]=function(_0x1caa51,_0x53522b){if(_0x1caa51[_0x781b('0x45')]['id']){delete _0x1caa51[_0x781b('0x45')]['id'];}return db[_0x781b('0x28')]['find']({'where':{'id':_0x1caa51[_0x781b('0x46')]['id']}})['then'](handleEntityNotFound(_0x53522b,null))[_0x781b('0x21')](saveUpdates(_0x1caa51[_0x781b('0x45')],null))[_0x781b('0x21')](respondWithResult(_0x53522b,null))[_0x781b('0x43')](handleError(_0x53522b,null));};exports[_0x781b('0x22')]=function(_0x320087,_0x320d9e){return db[_0x781b('0x28')][_0x781b('0x42')]({'where':{'id':_0x320087[_0x781b('0x46')]['id']}})[_0x781b('0x21')](handleEntityNotFound(_0x320d9e,null))['then'](removeEntity(_0x320d9e,null))['catch'](handleError(_0x320d9e,null));}; \ No newline at end of file +var _0x5b0a=['rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','destroy','then','error','name','send','SquareMessage','rawAttributes','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','create','body','update','find','params','eml-format'];(function(_0x1c3f8f,_0x4d704d){var _0x31076b=function(_0x3fb70d){while(--_0x3fb70d){_0x1c3f8f['push'](_0x1c3f8f['shift']());}};_0x31076b(++_0x4d704d);}(_0x5b0a,0x1af));var _0xa5b0=function(_0x5e3397,_0x1055b4){_0x5e3397=_0x5e3397-0x0;var _0x14e03d=_0x5b0a[_0x5e3397];return _0x14e03d;};'use strict';var emlformat=require(_0xa5b0('0x0'));var rimraf=require(_0xa5b0('0x1'));var zipdir=require(_0xa5b0('0x2'));var jsonpatch=require(_0xa5b0('0x3'));var rp=require('request-promise');var moment=require(_0xa5b0('0x4'));var BPromise=require(_0xa5b0('0x5'));var Mustache=require('mustache');var util=require(_0xa5b0('0x6'));var path=require(_0xa5b0('0x7'));var sox=require(_0xa5b0('0x8'));var csv=require('to-csv');var ejs=require(_0xa5b0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa5b0('0xa'));var crypto=require('crypto');var jsforce=require(_0xa5b0('0xb'));var deskjs=require(_0xa5b0('0xc'));var toCsv=require(_0xa5b0('0xd'));var querystring=require(_0xa5b0('0xe'));var Papa=require(_0xa5b0('0xf'));var Redis=require(_0xa5b0('0x10'));var authService=require(_0xa5b0('0x11'));var qs=require(_0xa5b0('0x12'));var as=require(_0xa5b0('0x13'));var hardwareService=require(_0xa5b0('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xa5b0('0x15'));var config=require(_0xa5b0('0x16'));var licenseUtil=require(_0xa5b0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12e7d8,_0x121401){_0x121401=_0x121401||0xcc;return function(_0x5d97d4){if(_0x5d97d4){return _0x12e7d8[_0xa5b0('0x18')](_0x121401);}return _0x12e7d8[_0xa5b0('0x19')](_0x121401)['end']();};}function respondWithResult(_0x1bc521,_0x1c00af){_0x1c00af=_0x1c00af||0xc8;return function(_0x500b65){if(_0x500b65){return _0x1bc521[_0xa5b0('0x19')](_0x1c00af)[_0xa5b0('0x1a')](_0x500b65);}};}function respondWithFilteredResult(_0x40ec50,_0xcffcf2){return function(_0x499378){if(_0x499378){var _0x364de9=typeof _0xcffcf2[_0xa5b0('0x1b')]==='undefined'&&typeof _0xcffcf2[_0xa5b0('0x1c')]===_0xa5b0('0x1d');var _0x485060=_0x499378[_0xa5b0('0x1e')];var _0x426240=_0x364de9?0x0:_0xcffcf2[_0xa5b0('0x1b')];var _0x4d24fc=_0x364de9?_0x499378[_0xa5b0('0x1e')]:_0xcffcf2['offset']+_0xcffcf2[_0xa5b0('0x1c')];var _0x329621;if(_0x4d24fc>=_0x485060){_0x4d24fc=_0x485060;_0x329621=0xc8;}else{_0x329621=0xce;}_0x40ec50['status'](_0x329621);return _0x40ec50[_0xa5b0('0x1f')](_0xa5b0('0x20'),_0x426240+'-'+_0x4d24fc+'/'+_0x485060)[_0xa5b0('0x1a')](_0x499378);}return null;};}function patchUpdates(_0x1b614c){return function(_0x5627de){try{jsonpatch[_0xa5b0('0x21')](_0x5627de,_0x1b614c,!![]);}catch(_0x4cb54d){return BPromise['reject'](_0x4cb54d);}return _0x5627de[_0xa5b0('0x22')]();};}function saveUpdates(_0x2aeb0f,_0x462e15){return function(_0x358ef7){if(_0x358ef7){return _0x358ef7['update'](_0x2aeb0f)['then'](function(_0x483a26){return _0x483a26;});}return null;};}function removeEntity(_0x2a4c11,_0x19559b){return function(_0x13b7c0){if(_0x13b7c0){return _0x13b7c0[_0xa5b0('0x23')]()[_0xa5b0('0x24')](function(){_0x2a4c11[_0xa5b0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14ca25,_0x676748){return function(_0x3f266c){if(!_0x3f266c){_0x14ca25[_0xa5b0('0x18')](0x194);}return _0x3f266c;};}function handleError(_0x36622b,_0x3a7ac6){_0x3a7ac6=_0x3a7ac6||0x1f4;return function(_0x820835){logger[_0xa5b0('0x25')](_0x820835['stack']);if(_0x820835[_0xa5b0('0x26')]){delete _0x820835[_0xa5b0('0x26')];}_0x36622b[_0xa5b0('0x19')](_0x3a7ac6)[_0xa5b0('0x27')](_0x820835);};}exports['index']=function(_0x3d14db,_0x551155){var _0x5ec1e7={},_0x931ca6={},_0x29b3db={'count':0x0,'rows':[]};var _0x1c23fc=_['map'](db[_0xa5b0('0x28')][_0xa5b0('0x29')],function(_0xae21e1){return{'name':_0xae21e1['fieldName'],'type':_0xae21e1[_0xa5b0('0x2a')]['key']};});_0x931ca6['model']=_[_0xa5b0('0x2b')](_0x1c23fc,'name');_0x931ca6[_0xa5b0('0x2c')]=_[_0xa5b0('0x2d')](_0x3d14db[_0xa5b0('0x2c')]);_0x931ca6[_0xa5b0('0x2e')]=_[_0xa5b0('0x2f')](_0x931ca6[_0xa5b0('0x30')],_0x931ca6[_0xa5b0('0x2c')]);_0x5ec1e7[_0xa5b0('0x31')]=_['intersection'](_0x931ca6[_0xa5b0('0x30')],qs[_0xa5b0('0x32')](_0x3d14db[_0xa5b0('0x2c')][_0xa5b0('0x32')]));_0x5ec1e7['attributes']=_0x5ec1e7['attributes'][_0xa5b0('0x33')]?_0x5ec1e7[_0xa5b0('0x31')]:_0x931ca6[_0xa5b0('0x30')];if(!_0x3d14db[_0xa5b0('0x2c')][_0xa5b0('0x34')]('nolimit')){_0x5ec1e7[_0xa5b0('0x1c')]=qs[_0xa5b0('0x1c')](_0x3d14db['query'][_0xa5b0('0x1c')]);_0x5ec1e7[_0xa5b0('0x1b')]=qs[_0xa5b0('0x1b')](_0x3d14db[_0xa5b0('0x2c')]['offset']);}_0x5ec1e7[_0xa5b0('0x35')]=qs[_0xa5b0('0x36')](_0x3d14db[_0xa5b0('0x2c')][_0xa5b0('0x36')]);_0x5ec1e7[_0xa5b0('0x37')]=qs[_0xa5b0('0x2e')](_[_0xa5b0('0x38')](_0x3d14db[_0xa5b0('0x2c')],_0x931ca6[_0xa5b0('0x2e')]),_0x1c23fc);if(_0x3d14db[_0xa5b0('0x2c')][_0xa5b0('0x39')]){_0x5ec1e7['where']=_[_0xa5b0('0x3a')](_0x5ec1e7['where'],{'$or':_[_0xa5b0('0x2b')](_0x1c23fc,function(_0x222f78){if(_0x222f78['type']!==_0xa5b0('0x3b')){var _0x18cdbd={};_0x18cdbd[_0x222f78[_0xa5b0('0x26')]]={'$like':'%'+_0x3d14db[_0xa5b0('0x2c')][_0xa5b0('0x39')]+'%'};return _0x18cdbd;}})});}_0x5ec1e7=_[_0xa5b0('0x3a')]({},_0x5ec1e7,_0x3d14db['options']);var _0x43b87a={'where':_0x5ec1e7['where']};return db[_0xa5b0('0x28')][_0xa5b0('0x1e')](_0x43b87a)[_0xa5b0('0x24')](function(_0x39e147){_0x29b3db[_0xa5b0('0x1e')]=_0x39e147;if(_0x3d14db['query'][_0xa5b0('0x3c')]){_0x5ec1e7[_0xa5b0('0x3d')]=[{'all':!![]}];}return db[_0xa5b0('0x28')][_0xa5b0('0x3e')](_0x5ec1e7);})[_0xa5b0('0x24')](function(_0x196b80){_0x29b3db[_0xa5b0('0x3f')]=_0x196b80;return _0x29b3db;})[_0xa5b0('0x24')](respondWithFilteredResult(_0x551155,_0x5ec1e7))[_0xa5b0('0x40')](handleError(_0x551155,null));};exports[_0xa5b0('0x41')]=function(_0x421146,_0x428d6f){var _0x3cb7cd={'raw':!![],'where':{'id':_0x421146['params']['id']}},_0x3510c5={};_0x3510c5['model']=_[_0xa5b0('0x2d')](db['SquareMessage'][_0xa5b0('0x29')]);_0x3510c5['query']=_[_0xa5b0('0x2d')](_0x421146['query']);_0x3510c5[_0xa5b0('0x2e')]=_['intersection'](_0x3510c5['model'],_0x3510c5[_0xa5b0('0x2c')]);_0x3cb7cd[_0xa5b0('0x31')]=_[_0xa5b0('0x2f')](_0x3510c5[_0xa5b0('0x30')],qs['fields'](_0x421146[_0xa5b0('0x2c')]['fields']));_0x3cb7cd[_0xa5b0('0x31')]=_0x3cb7cd[_0xa5b0('0x31')][_0xa5b0('0x33')]?_0x3cb7cd[_0xa5b0('0x31')]:_0x3510c5[_0xa5b0('0x30')];if(_0x421146[_0xa5b0('0x2c')][_0xa5b0('0x3c')]){_0x3cb7cd['include']=[{'all':!![]}];}_0x3cb7cd=_['merge']({},_0x3cb7cd,_0x421146[_0xa5b0('0x42')]);return db[_0xa5b0('0x28')]['find'](_0x3cb7cd)[_0xa5b0('0x24')](handleEntityNotFound(_0x428d6f,null))[_0xa5b0('0x24')](respondWithResult(_0x428d6f,null))[_0xa5b0('0x40')](handleError(_0x428d6f,null));};exports['create']=function(_0x439d1f,_0x57ef9f){return db[_0xa5b0('0x28')][_0xa5b0('0x43')](_0x439d1f[_0xa5b0('0x44')],{})[_0xa5b0('0x24')](respondWithResult(_0x57ef9f,0xc9))['catch'](handleError(_0x57ef9f,null));};exports[_0xa5b0('0x45')]=function(_0x51d1c1,_0x488869){if(_0x51d1c1[_0xa5b0('0x44')]['id']){delete _0x51d1c1[_0xa5b0('0x44')]['id'];}return db[_0xa5b0('0x28')][_0xa5b0('0x46')]({'where':{'id':_0x51d1c1[_0xa5b0('0x47')]['id']}})[_0xa5b0('0x24')](handleEntityNotFound(_0x488869,null))[_0xa5b0('0x24')](saveUpdates(_0x51d1c1[_0xa5b0('0x44')],null))[_0xa5b0('0x24')](respondWithResult(_0x488869,null))[_0xa5b0('0x40')](handleError(_0x488869,null));};exports[_0xa5b0('0x23')]=function(_0x20f4cd,_0x17eed5){return db[_0xa5b0('0x28')][_0xa5b0('0x46')]({'where':{'id':_0x20f4cd['params']['id']}})[_0xa5b0('0x24')](handleEntityNotFound(_0x17eed5,null))[_0xa5b0('0x24')](removeEntity(_0x17eed5,null))['catch'](handleError(_0x17eed5,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index d4339e0..3062b14 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 _0x465f=['rimraf','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x4a29f9,_0x11c6c7){var _0x3352fc=function(_0x262d57){while(--_0x262d57){_0x4a29f9['push'](_0x4a29f9['shift']());}};_0x3352fc(++_0x11c6c7);}(_0x465f,0x7b));var _0xf465=function(_0x1715fc,_0x3ecc59){_0x1715fc=_0x1715fc-0x0;var _0x3515aa=_0x465f[_0x1715fc];return _0x3515aa;};'use strict';var _=require(_0xf465('0x0'));var util=require(_0xf465('0x1'));var logger=require(_0xf465('0x2'))(_0xf465('0x3'));var moment=require(_0xf465('0x4'));var BPromise=require(_0xf465('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf465('0x6'));var rimraf=require(_0xf465('0x7'));var config=require('../../config/environment');var attributes=require(_0xf465('0x8'));module[_0xf465('0x9')]=function(_0x341d5c,_0x293e94){return _0x341d5c[_0xf465('0xa')](_0xf465('0xb'),attributes,{'tableName':_0xf465('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44e5=['square_messages','lodash','../../config/logger','api','bluebird','path','rimraf','./squareMessage.attributes','exports','define'];(function(_0x287905,_0x7f56e7){var _0x4fc915=function(_0xe1d331){while(--_0xe1d331){_0x287905['push'](_0x287905['shift']());}};_0x4fc915(++_0x7f56e7);}(_0x44e5,0x97));var _0x544e=function(_0x458dd7,_0xe5602b){_0x458dd7=_0x458dd7-0x0;var _0x2a12f3=_0x44e5[_0x458dd7];return _0x2a12f3;};'use strict';var _=require(_0x544e('0x0'));var util=require('util');var logger=require(_0x544e('0x1'))(_0x544e('0x2'));var moment=require('moment');var BPromise=require(_0x544e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x544e('0x4'));var rimraf=require(_0x544e('0x5'));var config=require('../../config/environment');var attributes=require(_0x544e('0x6'));module[_0x544e('0x7')]=function(_0x6ced59,_0x2d1363){return _0x6ced59[_0x544e('0x8')]('SquareMessage',attributes,{'tableName':_0x544e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index eb7e088..08562ea 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 _0x3cbf=['CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch'];(function(_0x581e88,_0x5ece7b){var _0x4acf47=function(_0x2bd357){while(--_0x2bd357){_0x581e88['push'](_0x581e88['shift']());}};_0x4acf47(++_0x5ece7b);}(_0x3cbf,0x1aa));var _0xf3cb=function(_0x18f64a,_0x1c8248){_0x18f64a=_0x18f64a-0x0;var _0x44687f=_0x3cbf[_0x18f64a];return _0x44687f;};'use strict';var _=require(_0xf3cb('0x0'));var util=require(_0xf3cb('0x1'));var moment=require(_0xf3cb('0x2'));var BPromise=require(_0xf3cb('0x3'));var rs=require(_0xf3cb('0x4'));var fs=require('fs');var Redis=require(_0xf3cb('0x5'));var db=require(_0xf3cb('0x6'))['db'];var utils=require(_0xf3cb('0x7'));var logger=require(_0xf3cb('0x8'))(_0xf3cb('0x9'));var config=require(_0xf3cb('0xa'));var jayson=require(_0xf3cb('0xb'));var client=jayson[_0xf3cb('0xc')][_0xf3cb('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x10ca51,_0x5eb777,_0x5662c0){return new BPromise(function(_0x5019be,_0x1f6ab6){return client[_0xf3cb('0xe')](_0x10ca51,_0x5662c0)[_0xf3cb('0xf')](function(_0x1c6f24){logger[_0xf3cb('0x10')](_0xf3cb('0x11'),_0x5eb777,_0xf3cb('0x12'));logger[_0xf3cb('0x13')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x5eb777,_0xf3cb('0x12'),JSON[_0xf3cb('0x14')](_0x1c6f24));if(_0x1c6f24['error']){if(_0x1c6f24[_0xf3cb('0x15')]['code']===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x5eb777,_0x1c6f24[_0xf3cb('0x15')][_0xf3cb('0x16')]);return _0x1f6ab6(_0x1c6f24[_0xf3cb('0x15')][_0xf3cb('0x16')]);}logger[_0xf3cb('0x15')](_0xf3cb('0x11'),_0x5eb777,_0x1c6f24[_0xf3cb('0x15')]['message']);return _0x5019be(_0x1c6f24[_0xf3cb('0x15')][_0xf3cb('0x16')]);}else{logger[_0xf3cb('0x10')](_0xf3cb('0x11'),_0x5eb777,_0xf3cb('0x12'));_0x5019be(_0x1c6f24['result'][_0xf3cb('0x16')]);}})[_0xf3cb('0x17')](function(_0x2f5f4b){logger['error']('SquareMessage,\x20%s,\x20%s',_0x5eb777,_0x2f5f4b);_0x1f6ab6(_0x2f5f4b);});});}exports[_0xf3cb('0x18')]=function(_0x3fb204){var _0x2598cb=this;return new Promise(function(_0x5854fe,_0x3e32c3){return db[_0xf3cb('0x19')][_0xf3cb('0x1a')](_0x3fb204[_0xf3cb('0x1b')],{'raw':_0x3fb204['options']?_0x3fb204[_0xf3cb('0x1c')][_0xf3cb('0x1d')]===undefined?!![]:![]:!![]})[_0xf3cb('0xf')](function(_0x35f34e){logger['info']('CreateSquareMessage',_0x3fb204);logger[_0xf3cb('0x13')]('CreateSquareMessage',_0x3fb204,JSON[_0xf3cb('0x14')](_0x35f34e));_0x5854fe(_0x35f34e);})[_0xf3cb('0x17')](function(_0x4b99d9){logger[_0xf3cb('0x15')](_0xf3cb('0x18'),_0x4b99d9[_0xf3cb('0x16')],_0x3fb204);_0x3e32c3(_0x2598cb[_0xf3cb('0x15')](0x1f4,_0x4b99d9[_0xf3cb('0x16')]));});});}; \ No newline at end of file +var _0xc27f=['SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','then','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info'];(function(_0x2a8860,_0x2da926){var _0x2f47a4=function(_0x3b7f54){while(--_0x3b7f54){_0x2a8860['push'](_0x2a8860['shift']());}};_0x2f47a4(++_0x2da926);}(_0xc27f,0x128));var _0xfc27=function(_0x14b209,_0x3b4bc4){_0x14b209=_0x14b209-0x0;var _0x3c9e28=_0xc27f[_0x14b209];return _0x3c9e28;};'use strict';var _=require('lodash');var util=require(_0xfc27('0x0'));var moment=require(_0xfc27('0x1'));var BPromise=require(_0xfc27('0x2'));var rs=require(_0xfc27('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc27('0x4'))['db'];var utils=require(_0xfc27('0x5'));var logger=require(_0xfc27('0x6'))('rpc');var config=require(_0xfc27('0x7'));var jayson=require(_0xfc27('0x8'));var client=jayson['client'][_0xfc27('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a8c25,_0x1fd4e1,_0x3b5a76){return new BPromise(function(_0x40fc83,_0x611881){return client[_0xfc27('0xa')](_0x1a8c25,_0x3b5a76)['then'](function(_0x229e3b){logger[_0xfc27('0xb')](_0xfc27('0xc'),_0x1fd4e1,_0xfc27('0xd'));logger[_0xfc27('0xe')](_0xfc27('0xf'),_0x1fd4e1,'request\x20sent',JSON[_0xfc27('0x10')](_0x229e3b));if(_0x229e3b['error']){if(_0x229e3b[_0xfc27('0x11')][_0xfc27('0x12')]===0x1f4){logger[_0xfc27('0x11')](_0xfc27('0xc'),_0x1fd4e1,_0x229e3b['error'][_0xfc27('0x13')]);return _0x611881(_0x229e3b[_0xfc27('0x11')]['message']);}logger[_0xfc27('0x11')]('SquareMessage,\x20%s,\x20%s',_0x1fd4e1,_0x229e3b[_0xfc27('0x11')][_0xfc27('0x13')]);return _0x40fc83(_0x229e3b[_0xfc27('0x11')][_0xfc27('0x13')]);}else{logger[_0xfc27('0xb')]('SquareMessage,\x20%s,\x20%s',_0x1fd4e1,_0xfc27('0xd'));_0x40fc83(_0x229e3b[_0xfc27('0x14')]['message']);}})[_0xfc27('0x15')](function(_0x5da29c){logger['error']('SquareMessage,\x20%s,\x20%s',_0x1fd4e1,_0x5da29c);_0x611881(_0x5da29c);});});}exports[_0xfc27('0x16')]=function(_0x497d7c){var _0x183c29=this;return new Promise(function(_0x44a488,_0x17b1ca){return db[_0xfc27('0x17')][_0xfc27('0x18')](_0x497d7c[_0xfc27('0x19')],{'raw':_0x497d7c[_0xfc27('0x1a')]?_0x497d7c[_0xfc27('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xfc27('0x1b')](function(_0x566da4){logger[_0xfc27('0xb')](_0xfc27('0x16'),_0x497d7c);logger[_0xfc27('0xe')](_0xfc27('0x16'),_0x497d7c,JSON[_0xfc27('0x10')](_0x566da4));_0x44a488(_0x566da4);})[_0xfc27('0x15')](function(_0xe2c778){logger[_0xfc27('0x11')](_0xfc27('0x16'),_0xe2c778[_0xfc27('0x13')],_0x497d7c);_0x17b1ca(_0x183c29[_0xfc27('0x11')](0x1f4,_0xe2c778[_0xfc27('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 3124ca6..ccc15ac 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 _0x765b=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','index','/:id','isAuthenticated','get','/:id/test','15s','test','post','create','put'];(function(_0x111fbb,_0x581da4){var _0x253ff4=function(_0x3fe120){while(--_0x3fe120){_0x111fbb['push'](_0x111fbb['shift']());}};_0x253ff4(++_0x581da4);}(_0x765b,0x118));var _0xb765=function(_0x336ca2,_0x1a813a){_0x336ca2=_0x336ca2-0x0;var _0xda59a6=_0x765b[_0x336ca2];return _0xda59a6;};'use strict';var multer=require(_0xb765('0x0'));var util=require(_0xb765('0x1'));var path=require(_0xb765('0x2'));var timeout=require(_0xb765('0x3'));var express=require(_0xb765('0x4'));var router=express['Router']();var fs_extra=require(_0xb765('0x5'));var auth=require(_0xb765('0x6'));var interaction=require(_0xb765('0x7'));var config=require('../../config/environment');var controller=require(_0xb765('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb765('0x9')]);router['get'](_0xb765('0xa'),auth[_0xb765('0xb')](),controller['show']);router[_0xb765('0xc')](_0xb765('0xd'),auth[_0xb765('0xb')](),timeout(_0xb765('0xe')),controller[_0xb765('0xf')]);router[_0xb765('0x10')]('/',auth[_0xb765('0xb')](),controller[_0xb765('0x11')]);router[_0xb765('0x12')](_0xb765('0xa'),auth[_0xb765('0xb')](),controller[_0xb765('0x13')]);router[_0xb765('0x14')](_0xb765('0xa'),auth[_0xb765('0xb')](),controller[_0xb765('0x15')]);module[_0xb765('0x16')]=router; \ No newline at end of file +var _0xe552=['index','/:id','show','test','post','create','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated'];(function(_0x148efc,_0x75a87f){var _0xba2e06=function(_0x41dd0c){while(--_0x41dd0c){_0x148efc['push'](_0x148efc['shift']());}};_0xba2e06(++_0x75a87f);}(_0xe552,0x199));var _0x2e55=function(_0x158c5b,_0x12db1d){_0x158c5b=_0x158c5b-0x0;var _0x2a8031=_0xe552[_0x158c5b];return _0x2a8031;};'use strict';var multer=require('multer');var util=require(_0x2e55('0x0'));var path=require(_0x2e55('0x1'));var timeout=require(_0x2e55('0x2'));var express=require('express');var router=express[_0x2e55('0x3')]();var fs_extra=require(_0x2e55('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2e55('0x5'));var config=require('../../config/environment');var controller=require(_0x2e55('0x6'));router[_0x2e55('0x7')]('/',auth[_0x2e55('0x8')](),controller[_0x2e55('0x9')]);router['get'](_0x2e55('0xa'),auth[_0x2e55('0x8')](),controller[_0x2e55('0xb')]);router[_0x2e55('0x7')]('/:id/test',auth['isAuthenticated'](),timeout('15s'),controller[_0x2e55('0xc')]);router[_0x2e55('0xd')]('/',auth[_0x2e55('0x8')](),controller[_0x2e55('0xe')]);router[_0x2e55('0xf')]('/:id',auth[_0x2e55('0x8')](),controller[_0x2e55('0x10')]);router['delete'](_0x2e55('0xa'),auth[_0x2e55('0x8')](),controller[_0x2e55('0x11')]);module[_0x2e55('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 751ac80..c3d8ffd 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 _0xc3a1=['sequelize','exports','STRING'];(function(_0x32f1d5,_0x404d2e){var _0xe5abe6=function(_0x11a70f){while(--_0x11a70f){_0x32f1d5['push'](_0x32f1d5['shift']());}};_0xe5abe6(++_0x404d2e);}(_0xc3a1,0x171));var _0x1c3a=function(_0x12d3fe,_0x1bce9c){_0x12d3fe=_0x12d3fe-0x0;var _0x26f5be=_0xc3a1[_0x12d3fe];return _0x26f5be;};'use strict';var Sequelize=require(_0x1c3a('0x0'));module[_0x1c3a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x1c3a('0x2')]},'description':{'type':Sequelize[_0x1c3a('0x2')]}}; \ No newline at end of file +var _0x35f7=['exports','STRING','sequelize'];(function(_0x3ea6d5,_0x34744d){var _0x4ea426=function(_0xce0107){while(--_0xce0107){_0x3ea6d5['push'](_0x3ea6d5['shift']());}};_0x4ea426(++_0x34744d);}(_0x35f7,0x137));var _0x735f=function(_0x304d2e,_0x3aa67f){_0x304d2e=_0x304d2e-0x0;var _0x5de410=_0x35f7[_0x304d2e];return _0x5de410;};'use strict';var Sequelize=require(_0x735f('0x0'));module[_0x735f('0x1')]={'name':{'type':Sequelize[_0x735f('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x735f('0x2')]},'description':{'type':Sequelize[_0x735f('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 20b499d..517645a 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 _0x3374=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','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','apply','reject','save','update','then','get','ODBC','error','stack','send','index','map','SquareOdbc','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','name'];(function(_0x34e752,_0x32e2a2){var _0x7c6347=function(_0x4db671){while(--_0x4db671){_0x34e752['push'](_0x34e752['shift']());}};_0x7c6347(++_0x32e2a2);}(_0x3374,0xb7));var _0x4337=function(_0x56812d,_0x5c0038){_0x56812d=_0x56812d-0x0;var _0x588e29=_0x3374[_0x56812d];return _0x588e29;};'use strict';var emlformat=require(_0x4337('0x0'));var rimraf=require(_0x4337('0x1'));var zipdir=require(_0x4337('0x2'));var jsonpatch=require(_0x4337('0x3'));var rp=require(_0x4337('0x4'));var moment=require(_0x4337('0x5'));var BPromise=require(_0x4337('0x6'));var Mustache=require(_0x4337('0x7'));var util=require(_0x4337('0x8'));var path=require(_0x4337('0x9'));var sox=require(_0x4337('0xa'));var csv=require('to-csv');var ejs=require(_0x4337('0xb'));var fs=require('fs');var fs_extra=require(_0x4337('0xc'));var _=require(_0x4337('0xd'));var squel=require(_0x4337('0xe'));var crypto=require(_0x4337('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x4337('0x10'));var toCsv=require(_0x4337('0x11'));var querystring=require(_0x4337('0x12'));var Papa=require(_0x4337('0x13'));var Redis=require(_0x4337('0x14'));var authService=require(_0x4337('0x15'));var qs=require(_0x4337('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4337('0x17'))(_0x4337('0x18'));var utils=require('../../config/utils');var config=require(_0x4337('0x19'));var licenseUtil=require(_0x4337('0x1a'));var db=require(_0x4337('0x1b'))['db'];function respondWithStatusCode(_0x3e6d15,_0x43d418){_0x43d418=_0x43d418||0xcc;return function(_0x55b506){if(_0x55b506){return _0x3e6d15[_0x4337('0x1c')](_0x43d418);}return _0x3e6d15[_0x4337('0x1d')](_0x43d418)[_0x4337('0x1e')]();};}function respondWithResult(_0x3385f8,_0x34db1e){_0x34db1e=_0x34db1e||0xc8;return function(_0x2e109d){if(_0x2e109d){return _0x3385f8[_0x4337('0x1d')](_0x34db1e)[_0x4337('0x1f')](_0x2e109d);}};}function respondWithFilteredResult(_0x18d7c8,_0x274a43){return function(_0x448365){if(_0x448365){var _0x96d1eb=typeof _0x274a43[_0x4337('0x20')]===_0x4337('0x21')&&typeof _0x274a43[_0x4337('0x22')]===_0x4337('0x21');var _0x2b953a=_0x448365[_0x4337('0x23')];var _0x1504e2=_0x96d1eb?0x0:_0x274a43[_0x4337('0x20')];var _0x1378c2=_0x96d1eb?_0x448365[_0x4337('0x23')]:_0x274a43[_0x4337('0x20')]+_0x274a43[_0x4337('0x22')];var _0x2d68a0;if(_0x1378c2>=_0x2b953a){_0x1378c2=_0x2b953a;_0x2d68a0=0xc8;}else{_0x2d68a0=0xce;}_0x18d7c8[_0x4337('0x1d')](_0x2d68a0);return _0x18d7c8[_0x4337('0x24')]('Content-Range',_0x1504e2+'-'+_0x1378c2+'/'+_0x2b953a)[_0x4337('0x1f')](_0x448365);}return null;};}function patchUpdates(_0x138d0e){return function(_0x5956ea){try{jsonpatch[_0x4337('0x25')](_0x5956ea,_0x138d0e,!![]);}catch(_0x4f0fe7){return BPromise[_0x4337('0x26')](_0x4f0fe7);}return _0x5956ea[_0x4337('0x27')]();};}function saveUpdates(_0x566868,_0x2cb404){return function(_0x3a6357){if(_0x3a6357){return _0x3a6357[_0x4337('0x28')](_0x566868)[_0x4337('0x29')](function(_0x4f0f86){return _0x4f0f86;});}return null;};}function removeEntity(_0x4ded16,_0x2ca0c1){return function(_0xdd0cb3){if(_0xdd0cb3){return _0xdd0cb3['destroy']()['then'](function(){var _0xb3db9f=_0xdd0cb3[_0x4337('0x2a')]({'plain':!![]});var _0x1a0a83=_0x4337('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x1a0a83,'resourceId':_0xb3db9f['id']}})[_0x4337('0x29')](function(){return _0xdd0cb3;});})[_0x4337('0x29')](function(){_0x4ded16['status'](0xcc)[_0x4337('0x1e')]();});}};}function handleEntityNotFound(_0xb19fae,_0x1c7076){return function(_0x3a6157){if(!_0x3a6157){_0xb19fae[_0x4337('0x1c')](0x194);}return _0x3a6157;};}function handleError(_0x3a5a8c,_0x161349){_0x161349=_0x161349||0x1f4;return function(_0x2b7eeb){logger[_0x4337('0x2c')](_0x2b7eeb[_0x4337('0x2d')]);if(_0x2b7eeb['name']){delete _0x2b7eeb['name'];}_0x3a5a8c[_0x4337('0x1d')](_0x161349)[_0x4337('0x2e')](_0x2b7eeb);};}exports[_0x4337('0x2f')]=function(_0x4fcc5e,_0x32eec6){var _0x11a73e={},_0x2f76fa={},_0x721be2={'count':0x0,'rows':[]};var _0x5f3232=_[_0x4337('0x30')](db[_0x4337('0x31')][_0x4337('0x32')],function(_0xa5bf7d){return{'name':_0xa5bf7d['fieldName'],'type':_0xa5bf7d[_0x4337('0x33')]['key']};});_0x2f76fa[_0x4337('0x34')]=_[_0x4337('0x30')](_0x5f3232,'name');_0x2f76fa[_0x4337('0x35')]=_[_0x4337('0x36')](_0x4fcc5e[_0x4337('0x35')]);_0x2f76fa[_0x4337('0x37')]=_[_0x4337('0x38')](_0x2f76fa[_0x4337('0x34')],_0x2f76fa['query']);_0x11a73e[_0x4337('0x39')]=_[_0x4337('0x38')](_0x2f76fa[_0x4337('0x34')],qs['fields'](_0x4fcc5e[_0x4337('0x35')][_0x4337('0x3a')]));_0x11a73e[_0x4337('0x39')]=_0x11a73e['attributes'][_0x4337('0x3b')]?_0x11a73e[_0x4337('0x39')]:_0x2f76fa[_0x4337('0x34')];if(!_0x4fcc5e['query'][_0x4337('0x3c')]('nolimit')){_0x11a73e[_0x4337('0x22')]=qs[_0x4337('0x22')](_0x4fcc5e[_0x4337('0x35')][_0x4337('0x22')]);_0x11a73e[_0x4337('0x20')]=qs[_0x4337('0x20')](_0x4fcc5e[_0x4337('0x35')][_0x4337('0x20')]);}_0x11a73e['order']=qs[_0x4337('0x3d')](_0x4fcc5e[_0x4337('0x35')][_0x4337('0x3d')]);_0x11a73e[_0x4337('0x3e')]=qs[_0x4337('0x37')](_[_0x4337('0x3f')](_0x4fcc5e['query'],_0x2f76fa[_0x4337('0x37')]),_0x5f3232);if(_0x4fcc5e[_0x4337('0x35')][_0x4337('0x40')]){_0x11a73e['where']=_[_0x4337('0x41')](_0x11a73e['where'],{'$or':_[_0x4337('0x30')](_0x5f3232,function(_0x31fd74){if(_0x31fd74[_0x4337('0x33')]!=='VIRTUAL'){var _0x2a671d={};_0x2a671d[_0x31fd74['name']]={'$like':'%'+_0x4fcc5e['query']['filter']+'%'};return _0x2a671d;}})});}_0x11a73e=_[_0x4337('0x41')]({},_0x11a73e,_0x4fcc5e[_0x4337('0x42')]);var _0x542393={'where':_0x11a73e[_0x4337('0x3e')]};return db[_0x4337('0x31')][_0x4337('0x23')](_0x542393)['then'](function(_0x18edd6){_0x721be2[_0x4337('0x23')]=_0x18edd6;if(_0x4fcc5e[_0x4337('0x35')][_0x4337('0x43')]){_0x11a73e[_0x4337('0x44')]=[{'all':!![]}];}return db['SquareOdbc'][_0x4337('0x45')](_0x11a73e);})[_0x4337('0x29')](function(_0x5cf802){_0x721be2[_0x4337('0x46')]=_0x5cf802;return _0x721be2;})[_0x4337('0x29')](respondWithFilteredResult(_0x32eec6,_0x11a73e))[_0x4337('0x47')](handleError(_0x32eec6,null));};exports[_0x4337('0x48')]=function(_0x19bd25,_0x297a1c){var _0x53b339={'raw':!![],'where':{'id':_0x19bd25[_0x4337('0x49')]['id']}},_0x237974={};_0x237974[_0x4337('0x34')]=_[_0x4337('0x36')](db[_0x4337('0x31')]['rawAttributes']);_0x237974[_0x4337('0x35')]=_[_0x4337('0x36')](_0x19bd25[_0x4337('0x35')]);_0x237974[_0x4337('0x37')]=_['intersection'](_0x237974[_0x4337('0x34')],_0x237974[_0x4337('0x35')]);_0x53b339['attributes']=_['intersection'](_0x237974[_0x4337('0x34')],qs[_0x4337('0x3a')](_0x19bd25[_0x4337('0x35')][_0x4337('0x3a')]));_0x53b339['attributes']=_0x53b339[_0x4337('0x39')][_0x4337('0x3b')]?_0x53b339[_0x4337('0x39')]:_0x237974[_0x4337('0x34')];if(_0x19bd25[_0x4337('0x35')][_0x4337('0x43')]){_0x53b339[_0x4337('0x44')]=[{'all':!![]}];}_0x53b339=_[_0x4337('0x41')]({},_0x53b339,_0x19bd25[_0x4337('0x42')]);return db[_0x4337('0x31')][_0x4337('0x4a')](_0x53b339)['then'](handleEntityNotFound(_0x297a1c,null))[_0x4337('0x29')](respondWithResult(_0x297a1c,null))[_0x4337('0x47')](handleError(_0x297a1c,null));};exports[_0x4337('0x4b')]=function(_0x306a69,_0x3c5bc0){return db[_0x4337('0x31')][_0x4337('0x4b')](_0x306a69[_0x4337('0x4c')],{})[_0x4337('0x29')](function(_0x11502c){var _0x116a9a=_0x306a69[_0x4337('0x4d')]['get']({'plain':!![]});if(!_0x116a9a)throw new Error(_0x4337('0x4e'));if(_0x116a9a['role']===_0x4337('0x4d')){var _0x22ecad=_0x11502c['get']({'plain':!![]});var _0x36c2d3=_0x4337('0x2b');return db[_0x4337('0x4f')]['find']({'where':{'name':_0x36c2d3,'userProfileId':_0x116a9a[_0x4337('0x50')]},'raw':!![]})[_0x4337('0x29')](function(_0x47b1d6){if(_0x47b1d6&&_0x47b1d6[_0x4337('0x51')]===0x0){return db[_0x4337('0x52')][_0x4337('0x4b')]({'name':_0x22ecad['name'],'resourceId':_0x22ecad['id'],'type':_0x47b1d6[_0x4337('0x53')],'sectionId':_0x47b1d6['id']},{})[_0x4337('0x29')](function(){return _0x11502c;});}else{return _0x11502c;}})[_0x4337('0x47')](function(_0x179cd0){logger['error'](_0x4337('0x54'),_0x179cd0);throw _0x179cd0;});}return _0x11502c;})[_0x4337('0x29')](respondWithResult(_0x3c5bc0,0xc9))[_0x4337('0x47')](handleError(_0x3c5bc0,null));};exports[_0x4337('0x28')]=function(_0x410b4a,_0x1f6f1e){if(_0x410b4a[_0x4337('0x4c')]['id']){delete _0x410b4a['body']['id'];}return db[_0x4337('0x31')]['find']({'where':{'id':_0x410b4a[_0x4337('0x49')]['id']}})[_0x4337('0x29')](handleEntityNotFound(_0x1f6f1e,null))['then'](saveUpdates(_0x410b4a['body'],null))[_0x4337('0x29')](respondWithResult(_0x1f6f1e,null))[_0x4337('0x47')](handleError(_0x1f6f1e,null));};exports['destroy']=function(_0x5ca9cf,_0xccbf3b){return db['SquareOdbc'][_0x4337('0x4a')]({'where':{'id':_0x5ca9cf[_0x4337('0x49')]['id']}})[_0x4337('0x29')](handleEntityNotFound(_0xccbf3b,null))[_0x4337('0x29')](removeEntity(_0xccbf3b,null))[_0x4337('0x47')](handleError(_0xccbf3b,null));};exports[_0x4337('0x55')]=function(_0x33d05e,_0x455b31,_0x3562bc){var _0x51f15e;return db[_0x4337('0x31')]['find']({'where':{'id':_0x33d05e[_0x4337('0x49')]['id']},'attributes':['id',_0x4337('0x56')]})[_0x4337('0x29')](handleEntityNotFound(_0x455b31,null))[_0x4337('0x29')](function(_0x239554){if(_0x239554){var _0x377f5b=require(_0x4337('0x57'))();_0x377f5b['openSync'](_0x239554['dsn']);_0x377f5b[_0x4337('0x58')]();return _0x239554;}})[_0x4337('0x29')](respondWithResult(_0x455b31,null))[_0x4337('0x47')](handleError(_0x455b31,null));}; \ No newline at end of file +var _0xc850=['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','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','get','ODBC','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','rows','catch','show','SquareOdbc','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId'];(function(_0x590dae,_0x4ce795){var _0x1da82c=function(_0x4a60a6){while(--_0x4a60a6){_0x590dae['push'](_0x590dae['shift']());}};_0x1da82c(++_0x4ce795);}(_0xc850,0x170));var _0x0c85=function(_0x5edef8,_0x7af9a9){_0x5edef8=_0x5edef8-0x0;var _0x5438f6=_0xc850[_0x5edef8];return _0x5438f6;};'use strict';var emlformat=require(_0x0c85('0x0'));var rimraf=require(_0x0c85('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c85('0x2'));var rp=require(_0x0c85('0x3'));var moment=require(_0x0c85('0x4'));var BPromise=require(_0x0c85('0x5'));var Mustache=require(_0x0c85('0x6'));var util=require(_0x0c85('0x7'));var path=require('path');var sox=require(_0x0c85('0x8'));var csv=require(_0x0c85('0x9'));var ejs=require(_0x0c85('0xa'));var fs=require('fs');var fs_extra=require(_0x0c85('0xb'));var _=require(_0x0c85('0xc'));var squel=require(_0x0c85('0xd'));var crypto=require(_0x0c85('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0c85('0x9'));var querystring=require('querystring');var Papa=require(_0x0c85('0xf'));var Redis=require(_0x0c85('0x10'));var authService=require(_0x0c85('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0c85('0x12'));var hardwareService=require(_0x0c85('0x13'));var logger=require(_0x0c85('0x14'))(_0x0c85('0x15'));var utils=require(_0x0c85('0x16'));var config=require(_0x0c85('0x17'));var licenseUtil=require(_0x0c85('0x18'));var db=require(_0x0c85('0x19'))['db'];function respondWithStatusCode(_0x26d656,_0x2b9e4b){_0x2b9e4b=_0x2b9e4b||0xcc;return function(_0x4a49e1){if(_0x4a49e1){return _0x26d656[_0x0c85('0x1a')](_0x2b9e4b);}return _0x26d656['status'](_0x2b9e4b)[_0x0c85('0x1b')]();};}function respondWithResult(_0x50cf98,_0x52d9b3){_0x52d9b3=_0x52d9b3||0xc8;return function(_0x5778f8){if(_0x5778f8){return _0x50cf98[_0x0c85('0x1c')](_0x52d9b3)[_0x0c85('0x1d')](_0x5778f8);}};}function respondWithFilteredResult(_0x17ba43,_0xe68d77){return function(_0x6ad55c){if(_0x6ad55c){var _0x48eafe=typeof _0xe68d77[_0x0c85('0x1e')]===_0x0c85('0x1f')&&typeof _0xe68d77[_0x0c85('0x20')]===_0x0c85('0x1f');var _0x5efabf=_0x6ad55c[_0x0c85('0x21')];var _0x2104d6=_0x48eafe?0x0:_0xe68d77[_0x0c85('0x1e')];var _0x52d87f=_0x48eafe?_0x6ad55c[_0x0c85('0x21')]:_0xe68d77[_0x0c85('0x1e')]+_0xe68d77[_0x0c85('0x20')];var _0x317033;if(_0x52d87f>=_0x5efabf){_0x52d87f=_0x5efabf;_0x317033=0xc8;}else{_0x317033=0xce;}_0x17ba43[_0x0c85('0x1c')](_0x317033);return _0x17ba43[_0x0c85('0x22')](_0x0c85('0x23'),_0x2104d6+'-'+_0x52d87f+'/'+_0x5efabf)[_0x0c85('0x1d')](_0x6ad55c);}return null;};}function patchUpdates(_0x368efe){return function(_0x5591a5){try{jsonpatch['apply'](_0x5591a5,_0x368efe,!![]);}catch(_0x3d9044){return BPromise[_0x0c85('0x24')](_0x3d9044);}return _0x5591a5[_0x0c85('0x25')]();};}function saveUpdates(_0x549bcf,_0x305058){return function(_0xd27780){if(_0xd27780){return _0xd27780[_0x0c85('0x26')](_0x549bcf)['then'](function(_0xa367b9){return _0xa367b9;});}return null;};}function removeEntity(_0x3bdb75,_0x20ffa8){return function(_0x5eb033){if(_0x5eb033){return _0x5eb033[_0x0c85('0x27')]()[_0x0c85('0x28')](function(){var _0x1e9084=_0x5eb033[_0x0c85('0x29')]({'plain':!![]});var _0x4b3c81=_0x0c85('0x2a');return db[_0x0c85('0x2b')][_0x0c85('0x27')]({'where':{'type':_0x4b3c81,'resourceId':_0x1e9084['id']}})[_0x0c85('0x28')](function(){return _0x5eb033;});})[_0x0c85('0x28')](function(){_0x3bdb75[_0x0c85('0x1c')](0xcc)[_0x0c85('0x1b')]();});}};}function handleEntityNotFound(_0x3af580,_0x19a6e8){return function(_0x20a044){if(!_0x20a044){_0x3af580[_0x0c85('0x1a')](0x194);}return _0x20a044;};}function handleError(_0x288c80,_0x565e81){_0x565e81=_0x565e81||0x1f4;return function(_0xd5123e){logger[_0x0c85('0x2c')](_0xd5123e[_0x0c85('0x2d')]);if(_0xd5123e['name']){delete _0xd5123e['name'];}_0x288c80['status'](_0x565e81)[_0x0c85('0x2e')](_0xd5123e);};}exports[_0x0c85('0x2f')]=function(_0x203a66,_0x4f5404){var _0xe3c325={},_0x3c2e5e={},_0x162b03={'count':0x0,'rows':[]};var _0x5a2b2d=_[_0x0c85('0x30')](db['SquareOdbc'][_0x0c85('0x31')],function(_0x1be37d){return{'name':_0x1be37d[_0x0c85('0x32')],'type':_0x1be37d[_0x0c85('0x33')]['key']};});_0x3c2e5e[_0x0c85('0x34')]=_[_0x0c85('0x30')](_0x5a2b2d,_0x0c85('0x35'));_0x3c2e5e[_0x0c85('0x36')]=_[_0x0c85('0x37')](_0x203a66[_0x0c85('0x36')]);_0x3c2e5e[_0x0c85('0x38')]=_[_0x0c85('0x39')](_0x3c2e5e[_0x0c85('0x34')],_0x3c2e5e['query']);_0xe3c325[_0x0c85('0x3a')]=_[_0x0c85('0x39')](_0x3c2e5e['model'],qs[_0x0c85('0x3b')](_0x203a66['query'][_0x0c85('0x3b')]));_0xe3c325[_0x0c85('0x3a')]=_0xe3c325[_0x0c85('0x3a')][_0x0c85('0x3c')]?_0xe3c325[_0x0c85('0x3a')]:_0x3c2e5e[_0x0c85('0x34')];if(!_0x203a66['query']['hasOwnProperty'](_0x0c85('0x3d'))){_0xe3c325['limit']=qs[_0x0c85('0x20')](_0x203a66[_0x0c85('0x36')][_0x0c85('0x20')]);_0xe3c325[_0x0c85('0x1e')]=qs[_0x0c85('0x1e')](_0x203a66[_0x0c85('0x36')][_0x0c85('0x1e')]);}_0xe3c325[_0x0c85('0x3e')]=qs[_0x0c85('0x3f')](_0x203a66[_0x0c85('0x36')][_0x0c85('0x3f')]);_0xe3c325[_0x0c85('0x40')]=qs['filters'](_[_0x0c85('0x41')](_0x203a66[_0x0c85('0x36')],_0x3c2e5e[_0x0c85('0x38')]),_0x5a2b2d);if(_0x203a66[_0x0c85('0x36')]['filter']){_0xe3c325[_0x0c85('0x40')]=_[_0x0c85('0x42')](_0xe3c325[_0x0c85('0x40')],{'$or':_[_0x0c85('0x30')](_0x5a2b2d,function(_0x90e76c){if(_0x90e76c[_0x0c85('0x33')]!==_0x0c85('0x43')){var _0x164bf8={};_0x164bf8[_0x90e76c['name']]={'$like':'%'+_0x203a66[_0x0c85('0x36')]['filter']+'%'};return _0x164bf8;}})});}_0xe3c325=_['merge']({},_0xe3c325,_0x203a66[_0x0c85('0x44')]);var _0x40bccb={'where':_0xe3c325[_0x0c85('0x40')]};return db['SquareOdbc'][_0x0c85('0x21')](_0x40bccb)[_0x0c85('0x28')](function(_0x2974b4){_0x162b03[_0x0c85('0x21')]=_0x2974b4;if(_0x203a66[_0x0c85('0x36')]['includeAll']){_0xe3c325[_0x0c85('0x45')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0xe3c325);})[_0x0c85('0x28')](function(_0x3c1eb6){_0x162b03[_0x0c85('0x46')]=_0x3c1eb6;return _0x162b03;})[_0x0c85('0x28')](respondWithFilteredResult(_0x4f5404,_0xe3c325))[_0x0c85('0x47')](handleError(_0x4f5404,null));};exports[_0x0c85('0x48')]=function(_0x448d67,_0x4df5df){var _0x1782bd={'raw':!![],'where':{'id':_0x448d67['params']['id']}},_0x2ede91={};_0x2ede91[_0x0c85('0x34')]=_[_0x0c85('0x37')](db[_0x0c85('0x49')][_0x0c85('0x31')]);_0x2ede91[_0x0c85('0x36')]=_[_0x0c85('0x37')](_0x448d67[_0x0c85('0x36')]);_0x2ede91['filters']=_['intersection'](_0x2ede91['model'],_0x2ede91[_0x0c85('0x36')]);_0x1782bd[_0x0c85('0x3a')]=_['intersection'](_0x2ede91['model'],qs[_0x0c85('0x3b')](_0x448d67['query'][_0x0c85('0x3b')]));_0x1782bd['attributes']=_0x1782bd[_0x0c85('0x3a')][_0x0c85('0x3c')]?_0x1782bd[_0x0c85('0x3a')]:_0x2ede91[_0x0c85('0x34')];if(_0x448d67['query'][_0x0c85('0x4a')]){_0x1782bd[_0x0c85('0x45')]=[{'all':!![]}];}_0x1782bd=_[_0x0c85('0x42')]({},_0x1782bd,_0x448d67[_0x0c85('0x44')]);return db['SquareOdbc']['find'](_0x1782bd)['then'](handleEntityNotFound(_0x4df5df,null))['then'](respondWithResult(_0x4df5df,null))[_0x0c85('0x47')](handleError(_0x4df5df,null));};exports[_0x0c85('0x4b')]=function(_0x34ea25,_0x3fc20e){return db['SquareOdbc'][_0x0c85('0x4b')](_0x34ea25[_0x0c85('0x4c')],{})['then'](function(_0x1dc50b){var _0x49c887=_0x34ea25[_0x0c85('0x4d')][_0x0c85('0x29')]({'plain':!![]});if(!_0x49c887)throw new Error(_0x0c85('0x4e'));if(_0x49c887[_0x0c85('0x4f')]==='user'){var _0x48eb7c=_0x1dc50b[_0x0c85('0x29')]({'plain':!![]});var _0x60c937=_0x0c85('0x2a');return db['UserProfileSection'][_0x0c85('0x50')]({'where':{'name':_0x60c937,'userProfileId':_0x49c887[_0x0c85('0x51')]},'raw':!![]})[_0x0c85('0x28')](function(_0x1c669a){if(_0x1c669a&&_0x1c669a[_0x0c85('0x52')]===0x0){return db['UserProfileResource'][_0x0c85('0x4b')]({'name':_0x48eb7c[_0x0c85('0x35')],'resourceId':_0x48eb7c['id'],'type':_0x1c669a[_0x0c85('0x35')],'sectionId':_0x1c669a['id']},{})[_0x0c85('0x28')](function(){return _0x1dc50b;});}else{return _0x1dc50b;}})['catch'](function(_0x5a4d9c){logger[_0x0c85('0x2c')](_0x0c85('0x53'),_0x5a4d9c);throw _0x5a4d9c;});}return _0x1dc50b;})[_0x0c85('0x28')](respondWithResult(_0x3fc20e,0xc9))[_0x0c85('0x47')](handleError(_0x3fc20e,null));};exports[_0x0c85('0x26')]=function(_0x2abf10,_0xd9744e){if(_0x2abf10[_0x0c85('0x4c')]['id']){delete _0x2abf10[_0x0c85('0x4c')]['id'];}return db[_0x0c85('0x49')]['find']({'where':{'id':_0x2abf10[_0x0c85('0x54')]['id']}})[_0x0c85('0x28')](handleEntityNotFound(_0xd9744e,null))[_0x0c85('0x28')](saveUpdates(_0x2abf10[_0x0c85('0x4c')],null))[_0x0c85('0x28')](respondWithResult(_0xd9744e,null))[_0x0c85('0x47')](handleError(_0xd9744e,null));};exports[_0x0c85('0x27')]=function(_0x5e06d8,_0x6e2a98){return db['SquareOdbc'][_0x0c85('0x50')]({'where':{'id':_0x5e06d8[_0x0c85('0x54')]['id']}})[_0x0c85('0x28')](handleEntityNotFound(_0x6e2a98,null))[_0x0c85('0x28')](removeEntity(_0x6e2a98,null))[_0x0c85('0x47')](handleError(_0x6e2a98,null));};exports[_0x0c85('0x55')]=function(_0x3672ea,_0x3a997d,_0xb06b19){var _0xd34200;return db['SquareOdbc'][_0x0c85('0x50')]({'where':{'id':_0x3672ea[_0x0c85('0x54')]['id']},'attributes':['id',_0x0c85('0x56')]})['then'](handleEntityNotFound(_0x3a997d,null))[_0x0c85('0x28')](function(_0x34996e){if(_0x34996e){var _0x25d646=require(_0x0c85('0x57'))();_0x25d646[_0x0c85('0x58')](_0x34996e[_0x0c85('0x56')]);_0x25d646[_0x0c85('0x59')]();return _0x34996e;}})[_0x0c85('0x28')](respondWithResult(_0x3a997d,null))['catch'](handleError(_0x3a997d,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index fcc8764..60aa28c 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 _0x8569=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./squareOdbc.attributes','exports','define','square_odbc','lodash'];(function(_0x29488c,_0x740e41){var _0x1b0656=function(_0x23c512){while(--_0x23c512){_0x29488c['push'](_0x29488c['shift']());}};_0x1b0656(++_0x740e41);}(_0x8569,0x17f));var _0x9856=function(_0x5c811c,_0x313b25){_0x5c811c=_0x5c811c-0x0;var _0x5df3af=_0x8569[_0x5c811c];return _0x5df3af;};'use strict';var _=require(_0x9856('0x0'));var util=require(_0x9856('0x1'));var logger=require(_0x9856('0x2'))(_0x9856('0x3'));var moment=require(_0x9856('0x4'));var BPromise=require(_0x9856('0x5'));var rp=require(_0x9856('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9856('0x7'));var config=require('../../config/environment');var attributes=require(_0x9856('0x8'));module[_0x9856('0x9')]=function(_0x21a979,_0x9c6af0){return _0x21a979[_0x9856('0xa')]('SquareOdbc',attributes,{'tableName':_0x9856('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7597=['api','moment','bluebird','request-promise','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','lodash','util','../../config/logger'];(function(_0x2e3b30,_0x4cdaa3){var _0x3547d9=function(_0x1fa20c){while(--_0x1fa20c){_0x2e3b30['push'](_0x2e3b30['shift']());}};_0x3547d9(++_0x4cdaa3);}(_0x7597,0x105));var _0x7759=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x7597[_0x29d94e];return _0x106237;};'use strict';var _=require(_0x7759('0x0'));var util=require(_0x7759('0x1'));var logger=require(_0x7759('0x2'))(_0x7759('0x3'));var moment=require(_0x7759('0x4'));var BPromise=require(_0x7759('0x5'));var rp=require(_0x7759('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7759('0x7'));var attributes=require(_0x7759('0x8'));module[_0x7759('0x9')]=function(_0x5127dd,_0x27d7aa){return _0x5127dd[_0x7759('0xa')](_0x7759('0xb'),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 bb6b0d7..38327c4 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 _0x0f17=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','ShowSquareOdbc','find','options','where','attributes','include','map','model'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x0f17,0x18d));var _0x70f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f17[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x70f1('0x0'));var util=require(_0x70f1('0x1'));var moment=require(_0x70f1('0x2'));var BPromise=require(_0x70f1('0x3'));var rs=require(_0x70f1('0x4'));var fs=require('fs');var Redis=require(_0x70f1('0x5'));var db=require(_0x70f1('0x6'))['db'];var utils=require(_0x70f1('0x7'));var logger=require('../../config/logger')(_0x70f1('0x8'));var config=require(_0x70f1('0x9'));var jayson=require(_0x70f1('0xa'));var client=jayson[_0x70f1('0xb')][_0x70f1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1257fa,_0xddcb80,_0x4ae6d1){return new BPromise(function(_0x1464b4,_0x4014a6){return client[_0x70f1('0xd')](_0x1257fa,_0x4ae6d1)[_0x70f1('0xe')](function(_0x20a408){logger[_0x70f1('0xf')](_0x70f1('0x10'),_0xddcb80,_0x70f1('0x11'));logger[_0x70f1('0x12')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0xddcb80,'request\x20sent',JSON[_0x70f1('0x13')](_0x20a408));if(_0x20a408[_0x70f1('0x14')]){if(_0x20a408[_0x70f1('0x14')][_0x70f1('0x15')]===0x1f4){logger[_0x70f1('0x14')](_0x70f1('0x10'),_0xddcb80,_0x20a408[_0x70f1('0x14')]['message']);return _0x4014a6(_0x20a408[_0x70f1('0x14')]['message']);}logger[_0x70f1('0x14')]('SquareOdbc,\x20%s,\x20%s',_0xddcb80,_0x20a408[_0x70f1('0x14')][_0x70f1('0x16')]);return _0x1464b4(_0x20a408[_0x70f1('0x14')][_0x70f1('0x16')]);}else{logger[_0x70f1('0xf')]('SquareOdbc,\x20%s,\x20%s',_0xddcb80,_0x70f1('0x11'));_0x1464b4(_0x20a408[_0x70f1('0x17')]['message']);}})['catch'](function(_0x4a39bb){logger[_0x70f1('0x14')](_0x70f1('0x10'),_0xddcb80,_0x4a39bb);_0x4014a6(_0x4a39bb);});});}exports[_0x70f1('0x18')]=function(_0x55131d){var _0x32862f=this;return new Promise(function(_0x5175fb,_0x258f52){return db['SquareOdbc'][_0x70f1('0x19')]({'raw':_0x55131d['options']?_0x55131d[_0x70f1('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x55131d['options']?_0x55131d[_0x70f1('0x1a')][_0x70f1('0x1b')]||null:null,'attributes':_0x55131d[_0x70f1('0x1a')]?_0x55131d[_0x70f1('0x1a')][_0x70f1('0x1c')]||null:null,'include':_0x55131d[_0x70f1('0x1a')]?_0x55131d['options'][_0x70f1('0x1d')]?_[_0x70f1('0x1e')](_0x55131d['options']['include'],function(_0x3b47d3){return{'model':db[_0x3b47d3[_0x70f1('0x1f')]],'as':_0x3b47d3['as'],'attributes':_0x3b47d3['attributes'],'include':_0x3b47d3['include']?_[_0x70f1('0x1e')](_0x3b47d3['include'],function(_0x133dd8){return{'model':db[_0x133dd8[_0x70f1('0x1f')]],'as':_0x133dd8['as'],'attributes':_0x133dd8[_0x70f1('0x1c')],'include':_0x133dd8[_0x70f1('0x1d')]?_['map'](_0x133dd8[_0x70f1('0x1d')],function(_0x4fa55e){return{'model':db[_0x4fa55e['model']],'as':_0x4fa55e['as'],'attributes':_0x4fa55e[_0x70f1('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3428ad){logger['info'](_0x70f1('0x18'),_0x55131d);logger[_0x70f1('0x12')](_0x70f1('0x18'),_0x55131d,JSON[_0x70f1('0x13')](_0x3428ad));_0x5175fb(_0x3428ad);})[_0x70f1('0x20')](function(_0x2481fa){logger['error'](_0x70f1('0x18'),_0x2481fa['message'],_0x55131d);_0x258f52(_0x32862f[_0x70f1('0x14')](0x1f4,_0x2481fa['message']));});});}; \ No newline at end of file +var _0x1482=['attributes','include','model','map','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareOdbc,\x20%s,\x20%s','message','result','catch','ShowSquareOdbc','SquareOdbc','find','raw','options'];(function(_0x20e51b,_0x3e9eb6){var _0x4e12a8=function(_0x271b0d){while(--_0x271b0d){_0x20e51b['push'](_0x20e51b['shift']());}};_0x4e12a8(++_0x3e9eb6);}(_0x1482,0xcc));var _0x2148=function(_0x32c0b7,_0x520453){_0x32c0b7=_0x32c0b7-0x0;var _0x1e087c=_0x1482[_0x32c0b7];return _0x1e087c;};'use strict';var _=require(_0x2148('0x0'));var util=require(_0x2148('0x1'));var moment=require(_0x2148('0x2'));var BPromise=require(_0x2148('0x3'));var rs=require(_0x2148('0x4'));var fs=require('fs');var Redis=require(_0x2148('0x5'));var db=require(_0x2148('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2148('0x7'))('rpc');var config=require(_0x2148('0x8'));var jayson=require(_0x2148('0x9'));var client=jayson[_0x2148('0xa')][_0x2148('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57ecde,_0x2451e1,_0x1c6359){return new BPromise(function(_0x204909,_0x34af1f){return client[_0x2148('0xc')](_0x57ecde,_0x1c6359)['then'](function(_0x5f9bfa){logger[_0x2148('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x2451e1,'request\x20sent');logger['debug'](_0x2148('0xe'),_0x2451e1,_0x2148('0xf'),JSON['stringify'](_0x5f9bfa));if(_0x5f9bfa[_0x2148('0x10')]){if(_0x5f9bfa['error'][_0x2148('0x11')]===0x1f4){logger['error'](_0x2148('0x12'),_0x2451e1,_0x5f9bfa[_0x2148('0x10')][_0x2148('0x13')]);return _0x34af1f(_0x5f9bfa[_0x2148('0x10')][_0x2148('0x13')]);}logger[_0x2148('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x2451e1,_0x5f9bfa['error'][_0x2148('0x13')]);return _0x204909(_0x5f9bfa[_0x2148('0x10')][_0x2148('0x13')]);}else{logger[_0x2148('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x2451e1,'request\x20sent');_0x204909(_0x5f9bfa[_0x2148('0x14')]['message']);}})[_0x2148('0x15')](function(_0x153145){logger[_0x2148('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x2451e1,_0x153145);_0x34af1f(_0x153145);});});}exports[_0x2148('0x16')]=function(_0x26d3dc){var _0x170cea=this;return new Promise(function(_0x37e0eb,_0x4647b8){return db[_0x2148('0x17')][_0x2148('0x18')]({'raw':_0x26d3dc['options']?_0x26d3dc['options'][_0x2148('0x19')]===undefined?!![]:![]:!![],'where':_0x26d3dc[_0x2148('0x1a')]?_0x26d3dc['options']['where']||null:null,'attributes':_0x26d3dc[_0x2148('0x1a')]?_0x26d3dc[_0x2148('0x1a')][_0x2148('0x1b')]||null:null,'include':_0x26d3dc[_0x2148('0x1a')]?_0x26d3dc[_0x2148('0x1a')][_0x2148('0x1c')]?_['map'](_0x26d3dc[_0x2148('0x1a')][_0x2148('0x1c')],function(_0x53bdaa){return{'model':db[_0x53bdaa[_0x2148('0x1d')]],'as':_0x53bdaa['as'],'attributes':_0x53bdaa[_0x2148('0x1b')],'include':_0x53bdaa[_0x2148('0x1c')]?_[_0x2148('0x1e')](_0x53bdaa[_0x2148('0x1c')],function(_0x25d876){return{'model':db[_0x25d876[_0x2148('0x1d')]],'as':_0x25d876['as'],'attributes':_0x25d876[_0x2148('0x1b')],'include':_0x25d876[_0x2148('0x1c')]?_[_0x2148('0x1e')](_0x25d876[_0x2148('0x1c')],function(_0x4d59c2){return{'model':db[_0x4d59c2[_0x2148('0x1d')]],'as':_0x4d59c2['as'],'attributes':_0x4d59c2[_0x2148('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2148('0x1f')](function(_0x50e821){logger[_0x2148('0xd')](_0x2148('0x16'),_0x26d3dc);logger['debug'](_0x2148('0x16'),_0x26d3dc,JSON[_0x2148('0x20')](_0x50e821));_0x37e0eb(_0x50e821);})[_0x2148('0x15')](function(_0x34cc96){logger[_0x2148('0x10')](_0x2148('0x16'),_0x34cc96['message'],_0x26d3dc);_0x4647b8(_0x170cea[_0x2148('0x10')](0x1f4,_0x34cc96[_0x2148('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 6fa86b0..2bae440 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 _0xc6a2=['get','isAuthenticated','index','/:id','/:id/users','getUsers','post','create','addUsers','put','destroy','removeUsers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xc6a2,0x69));var _0x2c6a=function(_0x417cc9,_0x2085b9){_0x417cc9=_0x417cc9-0x0;var _0x28c964=_0xc6a2[_0x417cc9];return _0x28c964;};'use strict';var multer=require(_0x2c6a('0x0'));var util=require(_0x2c6a('0x1'));var path=require('path');var timeout=require(_0x2c6a('0x2'));var express=require(_0x2c6a('0x3'));var router=express[_0x2c6a('0x4')]();var fs_extra=require(_0x2c6a('0x5'));var auth=require(_0x2c6a('0x6'));var interaction=require(_0x2c6a('0x7'));var config=require(_0x2c6a('0x8'));var controller=require(_0x2c6a('0x9'));router[_0x2c6a('0xa')]('/',auth[_0x2c6a('0xb')](),controller[_0x2c6a('0xc')]);router[_0x2c6a('0xa')](_0x2c6a('0xd'),auth[_0x2c6a('0xb')](),controller['show']);router[_0x2c6a('0xa')](_0x2c6a('0xe'),auth[_0x2c6a('0xb')](),controller[_0x2c6a('0xf')]);router[_0x2c6a('0x10')]('/',auth[_0x2c6a('0xb')](),controller[_0x2c6a('0x11')]);router[_0x2c6a('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0x2c6a('0x12')]);router[_0x2c6a('0x13')](_0x2c6a('0xd'),auth[_0x2c6a('0xb')](),controller['update']);router['delete'](_0x2c6a('0xd'),auth[_0x2c6a('0xb')](),controller[_0x2c6a('0x14')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x2c6a('0x15')]);module[_0x2c6a('0x16')]=router; \ No newline at end of file +var _0xb574=['post','create','addUsers','put','update','delete','/:id','destroy','removeUsers','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','index','get','/:id/users','isAuthenticated','getUsers'];(function(_0x3f00b5,_0x307e37){var _0x490819=function(_0x4c1f85){while(--_0x4c1f85){_0x3f00b5['push'](_0x3f00b5['shift']());}};_0x490819(++_0x307e37);}(_0xb574,0x106));var _0x4b57=function(_0x159149,_0x211818){_0x159149=_0x159149-0x0;var _0x151040=_0xb574[_0x159149];return _0x151040;};'use strict';var multer=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var path=require('path');var timeout=require(_0x4b57('0x2'));var express=require(_0x4b57('0x3'));var router=express['Router']();var fs_extra=require(_0x4b57('0x4'));var auth=require(_0x4b57('0x5'));var interaction=require(_0x4b57('0x6'));var config=require(_0x4b57('0x7'));var controller=require(_0x4b57('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4b57('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4b57('0xa')](_0x4b57('0xb'),auth[_0x4b57('0xc')](),controller[_0x4b57('0xd')]);router[_0x4b57('0xe')]('/',auth[_0x4b57('0xc')](),controller[_0x4b57('0xf')]);router[_0x4b57('0xe')]('/:id/users',auth[_0x4b57('0xc')](),controller[_0x4b57('0x10')]);router[_0x4b57('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x4b57('0x12')]);router[_0x4b57('0x13')](_0x4b57('0x14'),auth[_0x4b57('0xc')](),controller[_0x4b57('0x15')]);router[_0x4b57('0x13')](_0x4b57('0xb'),auth[_0x4b57('0xc')](),controller[_0x4b57('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index fc26898..00af4cf 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 _0xa35e=['TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','STRING','name'];(function(_0x28407a,_0x2a7269){var _0x8bd6ef=function(_0x3c886f){while(--_0x3c886f){_0x28407a['push'](_0x28407a['shift']());}};_0x8bd6ef(++_0x2a7269);}(_0xa35e,0x111));var _0xea35=function(_0x24459f,_0x2e13c4){_0x24459f=_0x24459f-0x0;var _0x2a489d=_0xa35e[_0x24459f];return _0x2a489d;};'use strict';var Sequelize=require(_0xea35('0x0'));module['exports']={'name':{'type':Sequelize[_0xea35('0x1')],'unique':_0xea35('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xea35('0x1')]},'notes':{'type':Sequelize[_0xea35('0x3')]},'preproduction':{'type':Sequelize[_0xea35('0x4')](_0xea35('0x5')),'get':function(){if(this[_0xea35('0x6')](_0xea35('0x7'))){return this[_0xea35('0x6')](_0xea35('0x7'))[_0xea35('0x8')](_0xea35('0x9'));}}},'production':{'type':Sequelize[_0xea35('0x4')](_0xea35('0x5')),'get':function(){if(this['getDataValue'](_0xea35('0xa'))){return this[_0xea35('0x6')](_0xea35('0xa'))['toString'](_0xea35('0x9'));}}},'savedAt':{'type':Sequelize[_0xea35('0xb')]},'publishedAt':{'type':Sequelize[_0xea35('0xb')]}}; \ No newline at end of file +var _0x5c17=['exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize'];(function(_0x1a9218,_0x27b999){var _0x8fb407=function(_0x104782){while(--_0x104782){_0x1a9218['push'](_0x1a9218['shift']());}};_0x8fb407(++_0x27b999);}(_0x5c17,0x178));var _0x75c1=function(_0x4f17a1,_0x439414){_0x4f17a1=_0x4f17a1-0x0;var _0x4e3dfa=_0x5c17[_0x4f17a1];return _0x4e3dfa;};'use strict';var Sequelize=require(_0x75c1('0x0'));module[_0x75c1('0x1')]={'name':{'type':Sequelize[_0x75c1('0x2')],'unique':_0x75c1('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x75c1('0x4')]},'preproduction':{'type':Sequelize[_0x75c1('0x5')](_0x75c1('0x6')),'get':function(){if(this[_0x75c1('0x7')](_0x75c1('0x8'))){return this[_0x75c1('0x7')](_0x75c1('0x8'))[_0x75c1('0x9')](_0x75c1('0xa'));}}},'production':{'type':Sequelize[_0x75c1('0x5')]('long'),'get':function(){if(this[_0x75c1('0x7')](_0x75c1('0xb'))){return this[_0x75c1('0x7')](_0x75c1('0xb'))[_0x75c1('0x9')](_0x75c1('0xa'));}}},'savedAt':{'type':Sequelize[_0x75c1('0xc')]},'publishedAt':{'type':Sequelize[_0x75c1('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 247e84e..47d1210 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 _0xc9f0=['fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','reject','update','then','get','SquareProjects','UserProfileResource','destroy','end','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','findOne','User','filter','getUsers','eml-format','rimraf','zip-dir'];(function(_0x2c0bc3,_0x19ae20){var _0x549261=function(_0x3b48ac){while(--_0x3b48ac){_0x2c0bc3['push'](_0x2c0bc3['shift']());}};_0x549261(++_0x19ae20);}(_0xc9f0,0x126));var _0x0c9f=function(_0x3af9e4,_0x4362a0){_0x3af9e4=_0x3af9e4-0x0;var _0x1b1248=_0xc9f0[_0x3af9e4];return _0x1b1248;};'use strict';var emlformat=require(_0x0c9f('0x0'));var rimraf=require(_0x0c9f('0x1'));var zipdir=require(_0x0c9f('0x2'));var jsonpatch=require(_0x0c9f('0x3'));var rp=require(_0x0c9f('0x4'));var moment=require(_0x0c9f('0x5'));var BPromise=require(_0x0c9f('0x6'));var Mustache=require('mustache');var util=require(_0x0c9f('0x7'));var path=require('path');var sox=require(_0x0c9f('0x8'));var csv=require(_0x0c9f('0x9'));var ejs=require(_0x0c9f('0xa'));var fs=require('fs');var fs_extra=require(_0x0c9f('0xb'));var _=require(_0x0c9f('0xc'));var squel=require(_0x0c9f('0xd'));var crypto=require(_0x0c9f('0xe'));var jsforce=require(_0x0c9f('0xf'));var deskjs=require(_0x0c9f('0x10'));var toCsv=require(_0x0c9f('0x9'));var querystring=require(_0x0c9f('0x11'));var Papa=require(_0x0c9f('0x12'));var Redis=require(_0x0c9f('0x13'));var authService=require(_0x0c9f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x0c9f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c9f('0x16'))(_0x0c9f('0x17'));var utils=require(_0x0c9f('0x18'));var config=require(_0x0c9f('0x19'));var licenseUtil=require(_0x0c9f('0x1a'));var db=require(_0x0c9f('0x1b'))['db'];config['redis']=_['defaults'](config[_0x0c9f('0x1c')],{'host':_0x0c9f('0x1d'),'port':0x18eb});var socket=require(_0x0c9f('0x1e'))(new Redis(config[_0x0c9f('0x1c')]));require('./squareProject.socket')[_0x0c9f('0x1f')](socket);function respondWithStatusCode(_0x4ec79a,_0x5a868c){_0x5a868c=_0x5a868c||0xcc;return function(_0x5f59f1){if(_0x5f59f1){return _0x4ec79a[_0x0c9f('0x20')](_0x5a868c);}return _0x4ec79a[_0x0c9f('0x21')](_0x5a868c)['end']();};}function respondWithResult(_0x5c24d1,_0x42d976){_0x42d976=_0x42d976||0xc8;return function(_0x20050f){if(_0x20050f){return _0x5c24d1[_0x0c9f('0x21')](_0x42d976)[_0x0c9f('0x22')](_0x20050f);}};}function respondWithFilteredResult(_0xbda046,_0x3cb493){return function(_0x59bc72){if(_0x59bc72){var _0xc918e7=typeof _0x3cb493[_0x0c9f('0x23')]===_0x0c9f('0x24')&&typeof _0x3cb493[_0x0c9f('0x25')]===_0x0c9f('0x24');var _0x21cc1a=_0x59bc72[_0x0c9f('0x26')];var _0x3e88ab=_0xc918e7?0x0:_0x3cb493[_0x0c9f('0x23')];var _0x20ac9b=_0xc918e7?_0x59bc72[_0x0c9f('0x26')]:_0x3cb493[_0x0c9f('0x23')]+_0x3cb493['limit'];var _0xc3adc7;if(_0x20ac9b>=_0x21cc1a){_0x20ac9b=_0x21cc1a;_0xc3adc7=0xc8;}else{_0xc3adc7=0xce;}_0xbda046[_0x0c9f('0x21')](_0xc3adc7);return _0xbda046[_0x0c9f('0x27')]('Content-Range',_0x3e88ab+'-'+_0x20ac9b+'/'+_0x21cc1a)[_0x0c9f('0x22')](_0x59bc72);}return null;};}function patchUpdates(_0x4e72d4){return function(_0x5bc6a9){try{jsonpatch['apply'](_0x5bc6a9,_0x4e72d4,!![]);}catch(_0x4a0f90){return BPromise[_0x0c9f('0x28')](_0x4a0f90);}return _0x5bc6a9['save']();};}function saveUpdates(_0x334070,_0x1cc7e7){return function(_0x577e2b){if(_0x577e2b){return _0x577e2b[_0x0c9f('0x29')](_0x334070)[_0x0c9f('0x2a')](function(_0x88b793){return _0x88b793;});}return null;};}function removeEntity(_0x56d70,_0x531882){return function(_0x288908){if(_0x288908){return _0x288908['destroy']()[_0x0c9f('0x2a')](function(){var _0x3df0cd=_0x288908[_0x0c9f('0x2b')]({'plain':!![]});var _0x24aeae=_0x0c9f('0x2c');return db[_0x0c9f('0x2d')][_0x0c9f('0x2e')]({'where':{'type':_0x24aeae,'resourceId':_0x3df0cd['id']}})[_0x0c9f('0x2a')](function(){return _0x288908;});})[_0x0c9f('0x2a')](function(){_0x56d70[_0x0c9f('0x21')](0xcc)[_0x0c9f('0x2f')]();});}};}function handleEntityNotFound(_0x20a254,_0x68e8da){return function(_0x158ae2){if(!_0x158ae2){_0x20a254['sendStatus'](0x194);}return _0x158ae2;};}function handleError(_0x460514,_0x594b33){_0x594b33=_0x594b33||0x1f4;return function(_0x53cd53){logger['error'](_0x53cd53[_0x0c9f('0x30')]);if(_0x53cd53[_0x0c9f('0x31')]){delete _0x53cd53['name'];}_0x460514['status'](_0x594b33)[_0x0c9f('0x32')](_0x53cd53);};}exports[_0x0c9f('0x33')]=function(_0x230d2f,_0x14218d){var _0x1db02d={},_0x233ff6={},_0x3e08b3={'count':0x0,'rows':[]};var _0x3fb20a=_[_0x0c9f('0x34')](db[_0x0c9f('0x35')][_0x0c9f('0x36')],function(_0x199dc0){return{'name':_0x199dc0[_0x0c9f('0x37')],'type':_0x199dc0[_0x0c9f('0x38')][_0x0c9f('0x39')]};});_0x233ff6[_0x0c9f('0x3a')]=_['map'](_0x3fb20a,_0x0c9f('0x31'));_0x233ff6['query']=_[_0x0c9f('0x3b')](_0x230d2f['query']);_0x233ff6['filters']=_[_0x0c9f('0x3c')](_0x233ff6[_0x0c9f('0x3a')],_0x233ff6[_0x0c9f('0x3d')]);_0x1db02d[_0x0c9f('0x3e')]=_['intersection'](_0x233ff6['model'],qs[_0x0c9f('0x3f')](_0x230d2f['query']['fields']));_0x1db02d[_0x0c9f('0x3e')]=_0x1db02d[_0x0c9f('0x3e')][_0x0c9f('0x40')]?_0x1db02d['attributes']:_0x233ff6[_0x0c9f('0x3a')];if(!_0x230d2f[_0x0c9f('0x3d')][_0x0c9f('0x41')]('nolimit')){_0x1db02d[_0x0c9f('0x25')]=qs['limit'](_0x230d2f['query'][_0x0c9f('0x25')]);_0x1db02d[_0x0c9f('0x23')]=qs[_0x0c9f('0x23')](_0x230d2f[_0x0c9f('0x3d')][_0x0c9f('0x23')]);}_0x1db02d[_0x0c9f('0x42')]=qs[_0x0c9f('0x43')](_0x230d2f[_0x0c9f('0x3d')][_0x0c9f('0x43')]);_0x1db02d[_0x0c9f('0x44')]=qs[_0x0c9f('0x45')](_[_0x0c9f('0x46')](_0x230d2f[_0x0c9f('0x3d')],_0x233ff6[_0x0c9f('0x45')]),_0x3fb20a);if(_0x230d2f[_0x0c9f('0x3d')]['filter']){_0x1db02d[_0x0c9f('0x44')]=_[_0x0c9f('0x47')](_0x1db02d[_0x0c9f('0x44')],{'$or':_[_0x0c9f('0x34')](_0x3fb20a,function(_0xe86a97){if(_0xe86a97['type']!==_0x0c9f('0x48')){var _0x1f8f64={};_0x1f8f64[_0xe86a97['name']]={'$like':'%'+_0x230d2f[_0x0c9f('0x3d')]['filter']+'%'};return _0x1f8f64;}})});}_0x1db02d=_[_0x0c9f('0x47')]({},_0x1db02d,_0x230d2f[_0x0c9f('0x49')]);var _0x19db6c={'where':_0x1db02d[_0x0c9f('0x44')]};return db[_0x0c9f('0x35')][_0x0c9f('0x26')](_0x19db6c)['then'](function(_0x2eecba){_0x3e08b3[_0x0c9f('0x26')]=_0x2eecba;if(_0x230d2f[_0x0c9f('0x3d')][_0x0c9f('0x4a')]){_0x1db02d['include']=[{'all':!![]}];}return db['SquareProject'][_0x0c9f('0x4b')](_0x1db02d);})[_0x0c9f('0x2a')](function(_0x39f77d){_0x3e08b3[_0x0c9f('0x4c')]=_0x39f77d;return _0x3e08b3;})[_0x0c9f('0x2a')](respondWithFilteredResult(_0x14218d,_0x1db02d))[_0x0c9f('0x4d')](handleError(_0x14218d,null));};exports[_0x0c9f('0x4e')]=function(_0x1de160,_0x38434e){var _0x4d87dc={'raw':![],'where':{'id':_0x1de160[_0x0c9f('0x4f')]['id']}},_0x133fed={};_0x133fed[_0x0c9f('0x3a')]=_[_0x0c9f('0x3b')](db['SquareProject'][_0x0c9f('0x36')]);_0x133fed[_0x0c9f('0x3d')]=_[_0x0c9f('0x3b')](_0x1de160['query']);_0x133fed[_0x0c9f('0x45')]=_['intersection'](_0x133fed[_0x0c9f('0x3a')],_0x133fed[_0x0c9f('0x3d')]);_0x4d87dc[_0x0c9f('0x3e')]=_[_0x0c9f('0x3c')](_0x133fed[_0x0c9f('0x3a')],qs[_0x0c9f('0x3f')](_0x1de160[_0x0c9f('0x3d')][_0x0c9f('0x3f')]));_0x4d87dc[_0x0c9f('0x3e')]=_0x4d87dc[_0x0c9f('0x3e')][_0x0c9f('0x40')]?_0x4d87dc['attributes']:_0x133fed[_0x0c9f('0x3a')];if(_0x1de160[_0x0c9f('0x3d')]['includeAll']){_0x4d87dc[_0x0c9f('0x50')]=[{'all':!![]}];}_0x4d87dc=_[_0x0c9f('0x47')]({},_0x4d87dc,_0x1de160[_0x0c9f('0x49')]);return db[_0x0c9f('0x35')][_0x0c9f('0x51')](_0x4d87dc)[_0x0c9f('0x2a')](handleEntityNotFound(_0x38434e,null))[_0x0c9f('0x2a')](respondWithResult(_0x38434e,null))['catch'](handleError(_0x38434e,null));};exports[_0x0c9f('0x52')]=function(_0x5528fc,_0x51d133){return db['SquareProject'][_0x0c9f('0x52')](_0x5528fc[_0x0c9f('0x53')],{})[_0x0c9f('0x2a')](function(_0x2123df){var _0x1a68a8=_0x5528fc[_0x0c9f('0x54')][_0x0c9f('0x2b')]({'plain':!![]});if(!_0x1a68a8)throw new Error(_0x0c9f('0x55'));if(_0x1a68a8['role']==='user'){var _0x4746b6=_0x2123df[_0x0c9f('0x2b')]({'plain':!![]});var _0x1e1c5f='SquareProjects';return db[_0x0c9f('0x56')][_0x0c9f('0x51')]({'where':{'name':_0x1e1c5f,'userProfileId':_0x1a68a8['userProfileId']},'raw':!![]})[_0x0c9f('0x2a')](function(_0x52772e){if(_0x52772e&&_0x52772e['autoAssociation']===0x0){return db[_0x0c9f('0x2d')][_0x0c9f('0x52')]({'name':_0x4746b6[_0x0c9f('0x31')],'resourceId':_0x4746b6['id'],'type':_0x52772e[_0x0c9f('0x31')],'sectionId':_0x52772e['id']},{})[_0x0c9f('0x2a')](function(){return _0x2123df;});}else{return _0x2123df;}})[_0x0c9f('0x4d')](function(_0x2232d8){logger[_0x0c9f('0x57')](_0x0c9f('0x58'),_0x2232d8);throw _0x2232d8;});}return _0x2123df;})[_0x0c9f('0x2a')](respondWithResult(_0x51d133,0xc9))[_0x0c9f('0x4d')](handleError(_0x51d133,null));};exports[_0x0c9f('0x29')]=function(_0x14d46c,_0x1d902b){if(_0x14d46c[_0x0c9f('0x53')]['id']){delete _0x14d46c[_0x0c9f('0x53')]['id'];}return db[_0x0c9f('0x35')][_0x0c9f('0x51')]({'where':{'id':_0x14d46c['params']['id']}})[_0x0c9f('0x2a')](handleEntityNotFound(_0x1d902b,null))[_0x0c9f('0x2a')](saveUpdates(_0x14d46c[_0x0c9f('0x53')],null))[_0x0c9f('0x2a')](respondWithResult(_0x1d902b,null))['catch'](handleError(_0x1d902b,null));};exports[_0x0c9f('0x2e')]=function(_0x21b9fb,_0x48bc1e){return db[_0x0c9f('0x35')]['find']({'where':{'id':_0x21b9fb['params']['id']}})[_0x0c9f('0x2a')](handleEntityNotFound(_0x48bc1e,null))[_0x0c9f('0x2a')](removeEntity(_0x48bc1e,null))[_0x0c9f('0x4d')](handleError(_0x48bc1e,null));};exports[_0x0c9f('0x59')]=function(_0x46e9f2,_0xc9b597,_0x529f79){return db['SquareProject'][_0x0c9f('0x51')]({'where':{'id':_0x46e9f2[_0x0c9f('0x4f')]['id']}})[_0x0c9f('0x2a')](handleEntityNotFound(_0xc9b597,null))['then'](function(_0x230d6b){if(_0x230d6b){return _0x230d6b[_0x0c9f('0x59')](_0x46e9f2['body'][_0x0c9f('0x5a')],_['omit'](_0x46e9f2['body'],[_0x0c9f('0x5a'),'id'])||{});}})[_0x0c9f('0x2a')](respondWithResult(_0xc9b597,null))[_0x0c9f('0x4d')](handleError(_0xc9b597,null));};exports[_0x0c9f('0x5b')]=function(_0x38ccdf,_0x55f52a,_0x50fae1){return db[_0x0c9f('0x35')][_0x0c9f('0x51')]({'where':{'id':_0x38ccdf[_0x0c9f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x55f52a,null))['then'](function(_0x315130){if(_0x315130){return _0x315130[_0x0c9f('0x5b')](_0x38ccdf[_0x0c9f('0x3d')]['ids'])[_0x0c9f('0x2a')](function(){if(_[_0x0c9f('0x5c')](_0x38ccdf[_0x0c9f('0x3d')][_0x0c9f('0x5a')])){for(var _0x42ead5=0x0;_0x42ead5<_0x38ccdf[_0x0c9f('0x3d')]['ids'][_0x0c9f('0x40')];_0x42ead5+=0x1){socket[_0x0c9f('0x5d')](_0x0c9f('0x5e'),{'UserId':Number(_0x38ccdf[_0x0c9f('0x3d')][_0x0c9f('0x5a')][_0x42ead5]),'SquareProjectId':Number(_0x38ccdf[_0x0c9f('0x4f')]['id'])});}}else{socket['emit'](_0x0c9f('0x5e'),{'UserId':Number(_0x38ccdf[_0x0c9f('0x3d')][_0x0c9f('0x5a')]),'SquareProjectId':Number(_0x38ccdf[_0x0c9f('0x4f')]['id'])});}});}})[_0x0c9f('0x2a')](respondWithStatusCode(_0x55f52a,null))[_0x0c9f('0x4d')](handleError(_0x55f52a,null));};exports['getUsers']=function(_0x541c65,_0x1e97f7,_0x5682c8){var _0x950950={};var _0x191834={};var _0x2b1263;var _0x5b1425;return db[_0x0c9f('0x35')][_0x0c9f('0x5f')]({'where':{'id':_0x541c65['params']['id']}})[_0x0c9f('0x2a')](handleEntityNotFound(_0x1e97f7,null))['then'](function(_0xec9bb0){if(_0xec9bb0){_0x2b1263=_0xec9bb0;_0x191834[_0x0c9f('0x3a')]=_[_0x0c9f('0x3b')](db[_0x0c9f('0x60')][_0x0c9f('0x36')]);_0x191834[_0x0c9f('0x3d')]=_[_0x0c9f('0x3b')](_0x541c65[_0x0c9f('0x3d')]);_0x191834['filters']=_[_0x0c9f('0x3c')](_0x191834[_0x0c9f('0x3a')],_0x191834[_0x0c9f('0x3d')]);_0x950950[_0x0c9f('0x3e')]=_[_0x0c9f('0x3c')](_0x191834[_0x0c9f('0x3a')],qs[_0x0c9f('0x3f')](_0x541c65['query']['fields']));_0x950950[_0x0c9f('0x3e')]=_0x950950[_0x0c9f('0x3e')]['length']?_0x950950[_0x0c9f('0x3e')]:_0x191834[_0x0c9f('0x3a')];_0x950950[_0x0c9f('0x42')]=qs['sort'](_0x541c65[_0x0c9f('0x3d')][_0x0c9f('0x43')]);_0x950950['where']=qs[_0x0c9f('0x45')](_[_0x0c9f('0x46')](_0x541c65['query'],_0x191834[_0x0c9f('0x45')]));if(_0x541c65['query'][_0x0c9f('0x61')]){_0x950950[_0x0c9f('0x44')]=_['merge'](_0x950950[_0x0c9f('0x44')],{'$or':_[_0x0c9f('0x34')](_0x950950[_0x0c9f('0x3e')],function(_0x150275){var _0x43ab8f={};_0x43ab8f[_0x150275]={'$like':'%'+_0x541c65[_0x0c9f('0x3d')][_0x0c9f('0x61')]+'%'};return _0x43ab8f;})});}_0x950950=_[_0x0c9f('0x47')]({},_0x950950,_0x541c65['options']);return _0x2b1263['getUsers'](_0x950950);}})[_0x0c9f('0x2a')](function(_0x3376f7){if(_0x3376f7){_0x5b1425=_0x3376f7[_0x0c9f('0x40')];if(!_0x541c65[_0x0c9f('0x3d')]['hasOwnProperty']('nolimit')){_0x950950[_0x0c9f('0x25')]=qs[_0x0c9f('0x25')](_0x541c65[_0x0c9f('0x3d')]['limit']);_0x950950['offset']=qs['offset'](_0x541c65[_0x0c9f('0x3d')][_0x0c9f('0x23')]);}return _0x2b1263[_0x0c9f('0x62')](_0x950950);}})[_0x0c9f('0x2a')](function(_0x464448){if(_0x464448){return _0x464448?{'count':_0x5b1425,'rows':_0x464448}:null;}})[_0x0c9f('0x2a')](respondWithResult(_0x1e97f7,null))[_0x0c9f('0x4d')](handleError(_0x1e97f7,null));}; \ No newline at end of file +var _0x461f=['type','key','model','query','keys','attributes','intersection','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','rawAttributes','fields','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','ids','removeUsers','userSquareProject:remove','getUsers','findOne','User','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','sendStatus','error','stack','name','send','index','map','SquareProject','fieldName'];(function(_0x5d342f,_0x3d5d85){var _0x47dd6c=function(_0xd822f8){while(--_0xd822f8){_0x5d342f['push'](_0x5d342f['shift']());}};_0x47dd6c(++_0x3d5d85);}(_0x461f,0x151));var _0xf461=function(_0x8f82df,_0x4ad0e9){_0x8f82df=_0x8f82df-0x0;var _0x19212a=_0x461f[_0x8f82df];return _0x19212a;};'use strict';var emlformat=require(_0xf461('0x0'));var rimraf=require(_0xf461('0x1'));var zipdir=require(_0xf461('0x2'));var jsonpatch=require(_0xf461('0x3'));var rp=require(_0xf461('0x4'));var moment=require(_0xf461('0x5'));var BPromise=require(_0xf461('0x6'));var Mustache=require('mustache');var util=require(_0xf461('0x7'));var path=require(_0xf461('0x8'));var sox=require('sox');var csv=require(_0xf461('0x9'));var ejs=require(_0xf461('0xa'));var fs=require('fs');var fs_extra=require(_0xf461('0xb'));var _=require('lodash');var squel=require(_0xf461('0xc'));var crypto=require('crypto');var jsforce=require(_0xf461('0xd'));var deskjs=require(_0xf461('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf461('0xf'));var Papa=require('papaparse');var Redis=require(_0xf461('0x10'));var authService=require(_0xf461('0x11'));var qs=require(_0xf461('0x12'));var as=require(_0xf461('0x13'));var hardwareService=require(_0xf461('0x14'));var logger=require(_0xf461('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf461('0x16'));var db=require(_0xf461('0x17'))['db'];config[_0xf461('0x18')]=_[_0xf461('0x19')](config[_0xf461('0x18')],{'host':_0xf461('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf461('0x1b'))[_0xf461('0x1c')](socket);function respondWithStatusCode(_0x53c5d9,_0x5527d8){_0x5527d8=_0x5527d8||0xcc;return function(_0x372cee){if(_0x372cee){return _0x53c5d9['sendStatus'](_0x5527d8);}return _0x53c5d9[_0xf461('0x1d')](_0x5527d8)[_0xf461('0x1e')]();};}function respondWithResult(_0x2bc03c,_0x570526){_0x570526=_0x570526||0xc8;return function(_0x4b5c78){if(_0x4b5c78){return _0x2bc03c[_0xf461('0x1d')](_0x570526)[_0xf461('0x1f')](_0x4b5c78);}};}function respondWithFilteredResult(_0x6392c6,_0x365c57){return function(_0x40d466){if(_0x40d466){var _0x56d639=typeof _0x365c57[_0xf461('0x20')]==='undefined'&&typeof _0x365c57[_0xf461('0x21')]===_0xf461('0x22');var _0x15887e=_0x40d466[_0xf461('0x23')];var _0x5681af=_0x56d639?0x0:_0x365c57[_0xf461('0x20')];var _0x4b8c2b=_0x56d639?_0x40d466['count']:_0x365c57[_0xf461('0x20')]+_0x365c57[_0xf461('0x21')];var _0xbadd60;if(_0x4b8c2b>=_0x15887e){_0x4b8c2b=_0x15887e;_0xbadd60=0xc8;}else{_0xbadd60=0xce;}_0x6392c6[_0xf461('0x1d')](_0xbadd60);return _0x6392c6[_0xf461('0x24')](_0xf461('0x25'),_0x5681af+'-'+_0x4b8c2b+'/'+_0x15887e)[_0xf461('0x1f')](_0x40d466);}return null;};}function patchUpdates(_0x138c14){return function(_0x83ea6f){try{jsonpatch['apply'](_0x83ea6f,_0x138c14,!![]);}catch(_0xebd6c8){return BPromise[_0xf461('0x26')](_0xebd6c8);}return _0x83ea6f[_0xf461('0x27')]();};}function saveUpdates(_0x51c822,_0x1fb9dd){return function(_0x4f8a57){if(_0x4f8a57){return _0x4f8a57[_0xf461('0x28')](_0x51c822)[_0xf461('0x29')](function(_0x9ec936){return _0x9ec936;});}return null;};}function removeEntity(_0x200359,_0x1e984e){return function(_0x412360){if(_0x412360){return _0x412360[_0xf461('0x2a')]()[_0xf461('0x29')](function(){var _0x271a12=_0x412360[_0xf461('0x2b')]({'plain':!![]});var _0x2a07fb=_0xf461('0x2c');return db[_0xf461('0x2d')][_0xf461('0x2a')]({'where':{'type':_0x2a07fb,'resourceId':_0x271a12['id']}})['then'](function(){return _0x412360;});})['then'](function(){_0x200359[_0xf461('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe392be,_0x2974de){return function(_0x36f7f3){if(!_0x36f7f3){_0xe392be[_0xf461('0x2e')](0x194);}return _0x36f7f3;};}function handleError(_0x4354a9,_0x51134b){_0x51134b=_0x51134b||0x1f4;return function(_0x2f9eca){logger[_0xf461('0x2f')](_0x2f9eca[_0xf461('0x30')]);if(_0x2f9eca[_0xf461('0x31')]){delete _0x2f9eca[_0xf461('0x31')];}_0x4354a9[_0xf461('0x1d')](_0x51134b)[_0xf461('0x32')](_0x2f9eca);};}exports[_0xf461('0x33')]=function(_0x375fb3,_0x4c033b){var _0x2960ae={},_0x2c8138={},_0x4235bf={'count':0x0,'rows':[]};var _0x1621b9=_[_0xf461('0x34')](db[_0xf461('0x35')]['rawAttributes'],function(_0xe13303){return{'name':_0xe13303[_0xf461('0x36')],'type':_0xe13303[_0xf461('0x37')][_0xf461('0x38')]};});_0x2c8138[_0xf461('0x39')]=_['map'](_0x1621b9,_0xf461('0x31'));_0x2c8138[_0xf461('0x3a')]=_[_0xf461('0x3b')](_0x375fb3[_0xf461('0x3a')]);_0x2c8138['filters']=_['intersection'](_0x2c8138['model'],_0x2c8138[_0xf461('0x3a')]);_0x2960ae[_0xf461('0x3c')]=_[_0xf461('0x3d')](_0x2c8138[_0xf461('0x39')],qs['fields'](_0x375fb3[_0xf461('0x3a')]['fields']));_0x2960ae[_0xf461('0x3c')]=_0x2960ae[_0xf461('0x3c')][_0xf461('0x3e')]?_0x2960ae[_0xf461('0x3c')]:_0x2c8138['model'];if(!_0x375fb3[_0xf461('0x3a')][_0xf461('0x3f')]('nolimit')){_0x2960ae[_0xf461('0x21')]=qs[_0xf461('0x21')](_0x375fb3[_0xf461('0x3a')][_0xf461('0x21')]);_0x2960ae[_0xf461('0x20')]=qs[_0xf461('0x20')](_0x375fb3['query'][_0xf461('0x20')]);}_0x2960ae[_0xf461('0x40')]=qs[_0xf461('0x41')](_0x375fb3['query'][_0xf461('0x41')]);_0x2960ae[_0xf461('0x42')]=qs['filters'](_[_0xf461('0x43')](_0x375fb3[_0xf461('0x3a')],_0x2c8138[_0xf461('0x44')]),_0x1621b9);if(_0x375fb3[_0xf461('0x3a')][_0xf461('0x45')]){_0x2960ae[_0xf461('0x42')]=_[_0xf461('0x46')](_0x2960ae['where'],{'$or':_[_0xf461('0x34')](_0x1621b9,function(_0x5dfe39){if(_0x5dfe39['type']!==_0xf461('0x47')){var _0xff6dae={};_0xff6dae[_0x5dfe39[_0xf461('0x31')]]={'$like':'%'+_0x375fb3[_0xf461('0x3a')][_0xf461('0x45')]+'%'};return _0xff6dae;}})});}_0x2960ae=_[_0xf461('0x46')]({},_0x2960ae,_0x375fb3[_0xf461('0x48')]);var _0xdb0894={'where':_0x2960ae[_0xf461('0x42')]};return db[_0xf461('0x35')]['count'](_0xdb0894)[_0xf461('0x29')](function(_0x357834){_0x4235bf[_0xf461('0x23')]=_0x357834;if(_0x375fb3[_0xf461('0x3a')][_0xf461('0x49')]){_0x2960ae['include']=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x2960ae);})['then'](function(_0x3f005e){_0x4235bf[_0xf461('0x4a')]=_0x3f005e;return _0x4235bf;})[_0xf461('0x29')](respondWithFilteredResult(_0x4c033b,_0x2960ae))[_0xf461('0x4b')](handleError(_0x4c033b,null));};exports['show']=function(_0x2a0ee4,_0x2c83c1){var _0x179ce5={'raw':![],'where':{'id':_0x2a0ee4[_0xf461('0x4c')]['id']}},_0x5871dd={};_0x5871dd[_0xf461('0x39')]=_[_0xf461('0x3b')](db[_0xf461('0x35')][_0xf461('0x4d')]);_0x5871dd[_0xf461('0x3a')]=_['keys'](_0x2a0ee4[_0xf461('0x3a')]);_0x5871dd[_0xf461('0x44')]=_[_0xf461('0x3d')](_0x5871dd[_0xf461('0x39')],_0x5871dd[_0xf461('0x3a')]);_0x179ce5[_0xf461('0x3c')]=_[_0xf461('0x3d')](_0x5871dd['model'],qs[_0xf461('0x4e')](_0x2a0ee4[_0xf461('0x3a')][_0xf461('0x4e')]));_0x179ce5[_0xf461('0x3c')]=_0x179ce5['attributes'][_0xf461('0x3e')]?_0x179ce5['attributes']:_0x5871dd[_0xf461('0x39')];if(_0x2a0ee4['query'][_0xf461('0x49')]){_0x179ce5[_0xf461('0x4f')]=[{'all':!![]}];}_0x179ce5=_['merge']({},_0x179ce5,_0x2a0ee4[_0xf461('0x48')]);return db[_0xf461('0x35')][_0xf461('0x50')](_0x179ce5)[_0xf461('0x29')](handleEntityNotFound(_0x2c83c1,null))[_0xf461('0x29')](respondWithResult(_0x2c83c1,null))[_0xf461('0x4b')](handleError(_0x2c83c1,null));};exports['create']=function(_0x5f36f3,_0x48670){return db['SquareProject'][_0xf461('0x51')](_0x5f36f3['body'],{})[_0xf461('0x29')](function(_0x180ba7){var _0x1c9118=_0x5f36f3[_0xf461('0x52')][_0xf461('0x2b')]({'plain':!![]});if(!_0x1c9118)throw new Error(_0xf461('0x53'));if(_0x1c9118[_0xf461('0x54')]===_0xf461('0x52')){var _0x5265cc=_0x180ba7[_0xf461('0x2b')]({'plain':!![]});var _0x40dbea='SquareProjects';return db[_0xf461('0x55')][_0xf461('0x50')]({'where':{'name':_0x40dbea,'userProfileId':_0x1c9118[_0xf461('0x56')]},'raw':!![]})[_0xf461('0x29')](function(_0x283820){if(_0x283820&&_0x283820[_0xf461('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x5265cc[_0xf461('0x31')],'resourceId':_0x5265cc['id'],'type':_0x283820[_0xf461('0x31')],'sectionId':_0x283820['id']},{})[_0xf461('0x29')](function(){return _0x180ba7;});}else{return _0x180ba7;}})['catch'](function(_0x2ff5ad){logger[_0xf461('0x2f')](_0xf461('0x58'),_0x2ff5ad);throw _0x2ff5ad;});}return _0x180ba7;})[_0xf461('0x29')](respondWithResult(_0x48670,0xc9))['catch'](handleError(_0x48670,null));};exports[_0xf461('0x28')]=function(_0xb4a055,_0x25d08f){if(_0xb4a055[_0xf461('0x59')]['id']){delete _0xb4a055[_0xf461('0x59')]['id'];}return db[_0xf461('0x35')]['find']({'where':{'id':_0xb4a055[_0xf461('0x4c')]['id']}})[_0xf461('0x29')](handleEntityNotFound(_0x25d08f,null))[_0xf461('0x29')](saveUpdates(_0xb4a055[_0xf461('0x59')],null))[_0xf461('0x29')](respondWithResult(_0x25d08f,null))[_0xf461('0x4b')](handleError(_0x25d08f,null));};exports['destroy']=function(_0x4209f4,_0x523aa6){return db[_0xf461('0x35')][_0xf461('0x50')]({'where':{'id':_0x4209f4[_0xf461('0x4c')]['id']}})[_0xf461('0x29')](handleEntityNotFound(_0x523aa6,null))[_0xf461('0x29')](removeEntity(_0x523aa6,null))[_0xf461('0x4b')](handleError(_0x523aa6,null));};exports['addUsers']=function(_0x1964b8,_0x5ea6d5,_0x1f3ba1){return db[_0xf461('0x35')][_0xf461('0x50')]({'where':{'id':_0x1964b8[_0xf461('0x4c')]['id']}})[_0xf461('0x29')](handleEntityNotFound(_0x5ea6d5,null))[_0xf461('0x29')](function(_0x47b714){if(_0x47b714){return _0x47b714[_0xf461('0x5a')](_0x1964b8[_0xf461('0x59')][_0xf461('0x5b')],_['omit'](_0x1964b8[_0xf461('0x59')],[_0xf461('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x5ea6d5,null))[_0xf461('0x4b')](handleError(_0x5ea6d5,null));};exports[_0xf461('0x5c')]=function(_0x58e8f4,_0x272954,_0xb13dea){return db[_0xf461('0x35')][_0xf461('0x50')]({'where':{'id':_0x58e8f4[_0xf461('0x4c')]['id']}})['then'](handleEntityNotFound(_0x272954,null))[_0xf461('0x29')](function(_0x3b427c){if(_0x3b427c){return _0x3b427c[_0xf461('0x5c')](_0x58e8f4[_0xf461('0x3a')][_0xf461('0x5b')])[_0xf461('0x29')](function(){if(_['isArray'](_0x58e8f4[_0xf461('0x3a')][_0xf461('0x5b')])){for(var _0x12b0d0=0x0;_0x12b0d0<_0x58e8f4['query'][_0xf461('0x5b')][_0xf461('0x3e')];_0x12b0d0+=0x1){socket['emit'](_0xf461('0x5d'),{'UserId':Number(_0x58e8f4[_0xf461('0x3a')][_0xf461('0x5b')][_0x12b0d0]),'SquareProjectId':Number(_0x58e8f4[_0xf461('0x4c')]['id'])});}}else{socket['emit'](_0xf461('0x5d'),{'UserId':Number(_0x58e8f4[_0xf461('0x3a')][_0xf461('0x5b')]),'SquareProjectId':Number(_0x58e8f4[_0xf461('0x4c')]['id'])});}});}})[_0xf461('0x29')](respondWithStatusCode(_0x272954,null))['catch'](handleError(_0x272954,null));};exports[_0xf461('0x5e')]=function(_0x36d1d6,_0x33dd20,_0x1d6724){var _0x15d675={};var _0x52f1a0={};var _0x452f31;var _0x112a85;return db[_0xf461('0x35')][_0xf461('0x5f')]({'where':{'id':_0x36d1d6[_0xf461('0x4c')]['id']}})['then'](handleEntityNotFound(_0x33dd20,null))['then'](function(_0x50658c){if(_0x50658c){_0x452f31=_0x50658c;_0x52f1a0[_0xf461('0x39')]=_['keys'](db[_0xf461('0x60')][_0xf461('0x4d')]);_0x52f1a0[_0xf461('0x3a')]=_[_0xf461('0x3b')](_0x36d1d6[_0xf461('0x3a')]);_0x52f1a0['filters']=_[_0xf461('0x3d')](_0x52f1a0[_0xf461('0x39')],_0x52f1a0[_0xf461('0x3a')]);_0x15d675[_0xf461('0x3c')]=_[_0xf461('0x3d')](_0x52f1a0[_0xf461('0x39')],qs[_0xf461('0x4e')](_0x36d1d6['query'][_0xf461('0x4e')]));_0x15d675[_0xf461('0x3c')]=_0x15d675[_0xf461('0x3c')][_0xf461('0x3e')]?_0x15d675[_0xf461('0x3c')]:_0x52f1a0[_0xf461('0x39')];_0x15d675[_0xf461('0x40')]=qs[_0xf461('0x41')](_0x36d1d6[_0xf461('0x3a')]['sort']);_0x15d675[_0xf461('0x42')]=qs[_0xf461('0x44')](_[_0xf461('0x43')](_0x36d1d6[_0xf461('0x3a')],_0x52f1a0[_0xf461('0x44')]));if(_0x36d1d6['query'][_0xf461('0x45')]){_0x15d675[_0xf461('0x42')]=_[_0xf461('0x46')](_0x15d675[_0xf461('0x42')],{'$or':_[_0xf461('0x34')](_0x15d675['attributes'],function(_0x5d6537){var _0x4763e1={};_0x4763e1[_0x5d6537]={'$like':'%'+_0x36d1d6[_0xf461('0x3a')]['filter']+'%'};return _0x4763e1;})});}_0x15d675=_[_0xf461('0x46')]({},_0x15d675,_0x36d1d6[_0xf461('0x48')]);return _0x452f31['getUsers'](_0x15d675);}})[_0xf461('0x29')](function(_0x29f474){if(_0x29f474){_0x112a85=_0x29f474[_0xf461('0x3e')];if(!_0x36d1d6[_0xf461('0x3a')][_0xf461('0x3f')](_0xf461('0x61'))){_0x15d675[_0xf461('0x21')]=qs[_0xf461('0x21')](_0x36d1d6['query']['limit']);_0x15d675[_0xf461('0x20')]=qs[_0xf461('0x20')](_0x36d1d6[_0xf461('0x3a')][_0xf461('0x20')]);}return _0x452f31['getUsers'](_0x15d675);}})[_0xf461('0x29')](function(_0x929479){if(_0x929479){return _0x929479?{'count':_0x112a85,'rows':_0x929479}:null;}})[_0xf461('0x29')](respondWithResult(_0x33dd20,null))[_0xf461('0x4b')](handleError(_0x33dd20,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index dfec166..4c8924f 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 _0x2eb1=['hook','exports','../../mysqldb','SquareProject','update','emit','hasOwnProperty'];(function(_0x298397,_0x357e91){var _0x509d46=function(_0x26dc77){while(--_0x26dc77){_0x298397['push'](_0x298397['shift']());}};_0x509d46(++_0x357e91);}(_0x2eb1,0x64));var _0x12eb=function(_0x2a1bea,_0x4ab264){_0x2a1bea=_0x2a1bea-0x0;var _0x4872d9=_0x2eb1[_0x2a1bea];return _0x4872d9;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x12eb('0x0'))['db'][_0x12eb('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x12eb('0x2'),'afterDestroy':'remove'};function emitEvent(_0x42f160){return function(_0x11d414,_0xa8c5c,_0x5a0ffd){SquareProjectEvents['emit'](_0x42f160+':'+_0x11d414['id'],_0x11d414);SquareProjectEvents[_0x12eb('0x3')](_0x42f160,_0x11d414);_0x5a0ffd(null);};}for(var e in events){if(events[_0x12eb('0x4')](e)){var event=events[e];SquareProject[_0x12eb('0x5')](e,emitEvent(event));}}module[_0x12eb('0x6')]=SquareProjectEvents; \ No newline at end of file +var _0x46ed=['events','../../mysqldb','SquareProject','setMaxListeners','remove'];(function(_0x4666d0,_0x157766){var _0x486a43=function(_0xe882b1){while(--_0xe882b1){_0x4666d0['push'](_0x4666d0['shift']());}};_0x486a43(++_0x157766);}(_0x46ed,0xc3));var _0xd46e=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x46ed[_0x178e48];return _0x440d7e;};'use strict';var EventEmitter=require(_0xd46e('0x0'));var SquareProject=require(_0xd46e('0x1'))['db'][_0xd46e('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xd46e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd46e('0x4')};function emitEvent(_0x26628c){return function(_0x3bf7da,_0x53ed77,_0x538ae3){SquareProjectEvents['emit'](_0x26628c+':'+_0x3bf7da['id'],_0x3bf7da);SquareProjectEvents['emit'](_0x26628c,_0x3bf7da);_0x538ae3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](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 cd8ebeb..48a9695 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 _0xe656=['YYYY-MM-DD\x20HH:mm:ss','production','util','api','request-promise','path','../../config/environment','exports','define','SquareProject','square_projects','changed','savedAt','format'];(function(_0x15cdcb,_0x4340e9){var _0x37b069=function(_0x304cfb){while(--_0x304cfb){_0x15cdcb['push'](_0x15cdcb['shift']());}};_0x37b069(++_0x4340e9);}(_0xe656,0x1ec));var _0x6e65=function(_0x3e11d1,_0xb8e6d0){_0x3e11d1=_0x3e11d1-0x0;var _0x2467a3=_0xe656[_0x3e11d1];return _0x2467a3;};'use strict';var _=require('lodash');var util=require(_0x6e65('0x0'));var logger=require('../../config/logger')(_0x6e65('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6e65('0x2'));var fs=require('fs');var path=require(_0x6e65('0x3'));var rimraf=require('rimraf');var config=require(_0x6e65('0x4'));var attributes=require('./squareProject.attributes');module[_0x6e65('0x5')]=function(_0x13aeba,_0x43de74){return _0x13aeba[_0x6e65('0x6')](_0x6e65('0x7'),attributes,{'tableName':_0x6e65('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4adc86,_0x66e536,_0x141499){if(_0x4adc86[_0x6e65('0x9')]('preproduction')){_0x4adc86[_0x6e65('0xa')]=moment()[_0x6e65('0xb')](_0x6e65('0xc'));}if(_0x4adc86[_0x6e65('0x9')](_0x6e65('0xd'))){_0x4adc86['publishedAt']=moment()[_0x6e65('0xb')](_0x6e65('0xc'));}_0x141499(null,_0x4adc86);}}});}; \ No newline at end of file +var _0x9021=['util','../../config/logger','api','path','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','lodash'];(function(_0x20ddc4,_0x427254){var _0x4d7e1b=function(_0x38b8ec){while(--_0x38b8ec){_0x20ddc4['push'](_0x20ddc4['shift']());}};_0x4d7e1b(++_0x427254);}(_0x9021,0x87));var _0x1902=function(_0x12dfeb,_0x3fe94f){_0x12dfeb=_0x12dfeb-0x0;var _0x3f2fb8=_0x9021[_0x12dfeb];return _0x3f2fb8;};'use strict';var _=require(_0x1902('0x0'));var util=require(_0x1902('0x1'));var logger=require(_0x1902('0x2'))(_0x1902('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1902('0x4'));var rimraf=require(_0x1902('0x5'));var config=require(_0x1902('0x6'));var attributes=require(_0x1902('0x7'));module['exports']=function(_0x5187ae,_0x174a60){return _0x5187ae[_0x1902('0x8')](_0x1902('0x9'),attributes,{'tableName':_0x1902('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5f0ce3,_0x2df03f,_0x5995c9){if(_0x5f0ce3['changed'](_0x1902('0xb'))){_0x5f0ce3[_0x1902('0xc')]=moment()[_0x1902('0xd')](_0x1902('0xe'));}if(_0x5f0ce3[_0x1902('0xf')](_0x1902('0x10'))){_0x5f0ce3['publishedAt']=moment()['format'](_0x1902('0xe'));}_0x5995c9(null,_0x5f0ce3);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 37c4b21..087b284 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 _0x2b37=['rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','info','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','SquareProject,\x20%s,\x20%s','message','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1442bb,_0x1f994e){var _0x1d9b35=function(_0x2c925e){while(--_0x2c925e){_0x1442bb['push'](_0x1442bb['shift']());}};_0x1d9b35(++_0x1f994e);}(_0x2b37,0x130));var _0x72b3=function(_0x1b2cd4,_0x220d18){_0x1b2cd4=_0x1b2cd4-0x0;var _0x3e2ff5=_0x2b37[_0x1b2cd4];return _0x3e2ff5;};'use strict';var _=require(_0x72b3('0x0'));var util=require(_0x72b3('0x1'));var moment=require(_0x72b3('0x2'));var BPromise=require('bluebird');var rs=require(_0x72b3('0x3'));var fs=require('fs');var Redis=require(_0x72b3('0x4'));var db=require(_0x72b3('0x5'))['db'];var utils=require(_0x72b3('0x6'));var logger=require(_0x72b3('0x7'))(_0x72b3('0x8'));var config=require(_0x72b3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x72b3('0xa')][_0x72b3('0xb')]({'port':0x232a});config[_0x72b3('0xc')]=_[_0x72b3('0xd')](config[_0x72b3('0xc')],{'host':_0x72b3('0xe'),'port':0x18eb});var socket=require(_0x72b3('0xf'))(new Redis(config[_0x72b3('0xc')]));require(_0x72b3('0x10'))[_0x72b3('0x11')](socket);function respondWithRpcPromise(_0x109487,_0x4c2f2a,_0xe9cf97){return new BPromise(function(_0xa1ab90,_0x3cf85d){return client[_0x72b3('0x12')](_0x109487,_0xe9cf97)['then'](function(_0x46ea47){logger[_0x72b3('0x13')]('SquareProject,\x20%s,\x20%s',_0x4c2f2a,_0x72b3('0x14'));logger[_0x72b3('0x15')](_0x72b3('0x16'),_0x4c2f2a,_0x72b3('0x14'),JSON['stringify'](_0x46ea47));if(_0x46ea47[_0x72b3('0x17')]){if(_0x46ea47[_0x72b3('0x17')][_0x72b3('0x18')]===0x1f4){logger[_0x72b3('0x17')](_0x72b3('0x19'),_0x4c2f2a,_0x46ea47[_0x72b3('0x17')][_0x72b3('0x1a')]);return _0x3cf85d(_0x46ea47[_0x72b3('0x17')]['message']);}logger[_0x72b3('0x17')]('SquareProject,\x20%s,\x20%s',_0x4c2f2a,_0x46ea47['error']['message']);return _0xa1ab90(_0x46ea47[_0x72b3('0x17')][_0x72b3('0x1a')]);}else{logger[_0x72b3('0x13')](_0x72b3('0x19'),_0x4c2f2a,_0x72b3('0x14'));_0xa1ab90(_0x46ea47['result'][_0x72b3('0x1a')]);}})[_0x72b3('0x1b')](function(_0xd1170d){logger['error']('SquareProject,\x20%s,\x20%s',_0x4c2f2a,_0xd1170d);_0x3cf85d(_0xd1170d);});});}exports[_0x72b3('0x1c')]=function(_0x2bee76){var _0x3d7427=this;return new Promise(function(_0x427953,_0x938350){return db[_0x72b3('0x1d')][_0x72b3('0x1e')]({'raw':_0x2bee76[_0x72b3('0x1f')]?_0x2bee76[_0x72b3('0x1f')][_0x72b3('0x20')]===undefined?!![]:![]:!![],'where':_0x2bee76[_0x72b3('0x1f')]?_0x2bee76['options'][_0x72b3('0x21')]||null:null,'attributes':_0x2bee76[_0x72b3('0x1f')]?_0x2bee76[_0x72b3('0x1f')][_0x72b3('0x22')]||null:null,'include':_0x2bee76[_0x72b3('0x1f')]?_0x2bee76[_0x72b3('0x1f')]['include']?_[_0x72b3('0x23')](_0x2bee76[_0x72b3('0x1f')][_0x72b3('0x24')],function(_0x4f3b5e){return{'model':db[_0x4f3b5e[_0x72b3('0x25')]],'as':_0x4f3b5e['as'],'attributes':_0x4f3b5e[_0x72b3('0x22')],'include':_0x4f3b5e['include']?_[_0x72b3('0x23')](_0x4f3b5e[_0x72b3('0x24')],function(_0x2e1996){return{'model':db[_0x2e1996[_0x72b3('0x25')]],'as':_0x2e1996['as'],'attributes':_0x2e1996['attributes'],'include':_0x2e1996['include']?_[_0x72b3('0x23')](_0x2e1996['include'],function(_0x3017fd){return{'model':db[_0x3017fd[_0x72b3('0x25')]],'as':_0x3017fd['as'],'attributes':_0x3017fd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3db399){logger[_0x72b3('0x13')](_0x72b3('0x1c'),_0x2bee76);logger[_0x72b3('0x15')](_0x72b3('0x1c'),_0x2bee76,JSON[_0x72b3('0x26')](_0x3db399));_0x427953(_0x3db399);})[_0x72b3('0x1b')](function(_0x3ebe54){logger[_0x72b3('0x17')]('ShowSquareProject',_0x3ebe54['message'],_0x2bee76);_0x938350(_0x3d7427['error'](0x1f4,_0x3ebe54[_0x72b3('0x1a')]));});});}; \ No newline at end of file +var _0xb511=['../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./squareProject.socket','then','info','request\x20sent','debug','stringify','error','SquareProject,\x20%s,\x20%s','message','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x28e2cd,_0x153b42){var _0x11fd46=function(_0x50df13){while(--_0x50df13){_0x28e2cd['push'](_0x28e2cd['shift']());}};_0x11fd46(++_0x153b42);}(_0xb511,0x166));var _0x1b51=function(_0x3ec6f4,_0x42f1ad){_0x3ec6f4=_0x3ec6f4-0x0;var _0x19af76=_0xb511[_0x3ec6f4];return _0x19af76;};'use strict';var _=require(_0x1b51('0x0'));var util=require('util');var moment=require(_0x1b51('0x1'));var BPromise=require('bluebird');var rs=require(_0x1b51('0x2'));var fs=require('fs');var Redis=require(_0x1b51('0x3'));var db=require(_0x1b51('0x4'))['db'];var utils=require(_0x1b51('0x5'));var logger=require('../../config/logger')(_0x1b51('0x6'));var config=require(_0x1b51('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1b51('0x8')][_0x1b51('0x9')]({'port':0x232a});config[_0x1b51('0xa')]=_[_0x1b51('0xb')](config[_0x1b51('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1b51('0xc'))(new Redis(config[_0x1b51('0xa')]));require(_0x1b51('0xd'))['register'](socket);function respondWithRpcPromise(_0x407768,_0x130505,_0x2ae030){return new BPromise(function(_0x44fc12,_0x540340){return client['request'](_0x407768,_0x2ae030)[_0x1b51('0xe')](function(_0x3ced7d){logger[_0x1b51('0xf')]('SquareProject,\x20%s,\x20%s',_0x130505,_0x1b51('0x10'));logger[_0x1b51('0x11')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x130505,'request\x20sent',JSON[_0x1b51('0x12')](_0x3ced7d));if(_0x3ced7d[_0x1b51('0x13')]){if(_0x3ced7d['error']['code']===0x1f4){logger[_0x1b51('0x13')](_0x1b51('0x14'),_0x130505,_0x3ced7d[_0x1b51('0x13')][_0x1b51('0x15')]);return _0x540340(_0x3ced7d[_0x1b51('0x13')][_0x1b51('0x15')]);}logger['error']('SquareProject,\x20%s,\x20%s',_0x130505,_0x3ced7d[_0x1b51('0x13')][_0x1b51('0x15')]);return _0x44fc12(_0x3ced7d[_0x1b51('0x13')][_0x1b51('0x15')]);}else{logger[_0x1b51('0xf')](_0x1b51('0x14'),_0x130505,'request\x20sent');_0x44fc12(_0x3ced7d['result']['message']);}})[_0x1b51('0x16')](function(_0x53314b){logger[_0x1b51('0x13')](_0x1b51('0x14'),_0x130505,_0x53314b);_0x540340(_0x53314b);});});}exports[_0x1b51('0x17')]=function(_0x27fd67){var _0x476c49=this;return new Promise(function(_0x1f888e,_0x2f495e){return db[_0x1b51('0x18')][_0x1b51('0x19')]({'raw':_0x27fd67['options']?_0x27fd67[_0x1b51('0x1a')][_0x1b51('0x1b')]===undefined?!![]:![]:!![],'where':_0x27fd67['options']?_0x27fd67[_0x1b51('0x1a')][_0x1b51('0x1c')]||null:null,'attributes':_0x27fd67['options']?_0x27fd67[_0x1b51('0x1a')][_0x1b51('0x1d')]||null:null,'include':_0x27fd67['options']?_0x27fd67[_0x1b51('0x1a')][_0x1b51('0x1e')]?_[_0x1b51('0x1f')](_0x27fd67[_0x1b51('0x1a')][_0x1b51('0x1e')],function(_0x4436e9){return{'model':db[_0x4436e9['model']],'as':_0x4436e9['as'],'attributes':_0x4436e9[_0x1b51('0x1d')],'include':_0x4436e9[_0x1b51('0x1e')]?_[_0x1b51('0x1f')](_0x4436e9[_0x1b51('0x1e')],function(_0x18726a){return{'model':db[_0x18726a[_0x1b51('0x20')]],'as':_0x18726a['as'],'attributes':_0x18726a[_0x1b51('0x1d')],'include':_0x18726a['include']?_[_0x1b51('0x1f')](_0x18726a[_0x1b51('0x1e')],function(_0xf327ce){return{'model':db[_0xf327ce[_0x1b51('0x20')]],'as':_0xf327ce['as'],'attributes':_0xf327ce[_0x1b51('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1b51('0xe')](function(_0x3de21b){logger[_0x1b51('0xf')](_0x1b51('0x17'),_0x27fd67);logger[_0x1b51('0x11')]('ShowSquareProject',_0x27fd67,JSON[_0x1b51('0x12')](_0x3de21b));_0x1f888e(_0x3de21b);})['catch'](function(_0x375379){logger[_0x1b51('0x13')](_0x1b51('0x17'),_0x375379[_0x1b51('0x15')],_0x27fd67);_0x2f495e(_0x476c49[_0x1b51('0x13')](0x1f4,_0x375379['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index fa4ed4c..a65b38c 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 _0x908f=['remove','update','emit','removeListener','length','save'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x908f,0x179));var _0xf908=function(_0x15eed8,_0x5b60fa){_0x15eed8=_0x15eed8-0x0;var _0x3f8e62=_0x908f[_0x15eed8];return _0x3f8e62;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xf908('0x0'),_0xf908('0x1'),_0xf908('0x2')];function createListener(_0x152bc1,_0x58a6d6){return function(_0x4807ae){_0x58a6d6[_0xf908('0x3')](_0x152bc1,_0x4807ae);};}function removeListener(_0x28411a,_0x3394f4){return function(){SquareProjectEvents[_0xf908('0x4')](_0x28411a,_0x3394f4);};}exports['register']=function(_0x3b234b){for(var _0x5d3334=0x0,_0x2ce7db=events[_0xf908('0x5')];_0x5d3334<_0x2ce7db;_0x5d3334++){var _0x4c752d=events[_0x5d3334];var _0x3a64c2=createListener('squareProject:'+_0x4c752d,_0x3b234b);SquareProjectEvents['on'](_0x4c752d,_0x3a64c2);}}; \ No newline at end of file +var _0xea39=['emit','removeListener','register','length','./squareProject.events','save','update'];(function(_0x5cdacf,_0x7c82b1){var _0xa68a8b=function(_0x4b3818){while(--_0x4b3818){_0x5cdacf['push'](_0x5cdacf['shift']());}};_0xa68a8b(++_0x7c82b1);}(_0xea39,0x146));var _0x9ea3=function(_0x1170cb,_0x336f39){_0x1170cb=_0x1170cb-0x0;var _0x34baf1=_0xea39[_0x1170cb];return _0x34baf1;};'use strict';var SquareProjectEvents=require(_0x9ea3('0x0'));var events=[_0x9ea3('0x1'),'remove',_0x9ea3('0x2')];function createListener(_0x2fa259,_0x3fc6b0){return function(_0x4b94e1){_0x3fc6b0[_0x9ea3('0x3')](_0x2fa259,_0x4b94e1);};}function removeListener(_0x36b049,_0x57a92a){return function(){SquareProjectEvents[_0x9ea3('0x4')](_0x36b049,_0x57a92a);};}exports[_0x9ea3('0x5')]=function(_0x4981d9){for(var _0x3705ce=0x0,_0x173dbb=events[_0x9ea3('0x6')];_0x3705ce<_0x173dbb;_0x3705ce++){var _0x532fc3=events[_0x3705ce];var _0x4eb54f=createListener('squareProject:'+_0x532fc3,_0x4981d9);SquareProjectEvents['on'](_0x532fc3,_0x4eb54f);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index e4b795e..a2f7df9 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 _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x4c0827,_0x3cc903){var _0x1d7937=function(_0x455407){while(--_0x455407){_0x4c0827['push'](_0x4c0827['shift']());}};_0x1d7937(++_0x3cc903);}(_0x5fab,0x177));var _0xb5fa=function(_0x38b643,_0x14dc0d){_0x38b643=_0x38b643-0x0;var _0x23cf24=_0x5fab[_0x38b643];return _0x23cf24;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file +var _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0x60cd41,_0x3c9963){var _0x3db175=function(_0x2b2fe2){while(--_0x2b2fe2){_0x60cd41['push'](_0x60cd41['shift']());}};_0x3db175(++_0x3c9963);}(_0x53ec,0x192));var _0xc53e=function(_0xabe145,_0x2ef96d){_0xabe145=_0xabe145-0x0;var _0x433e19=_0x53ec[_0xabe145];return _0x433e19;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 24bf09f..e110936 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 _0xe14b=['VIRTUAL','lastIndexOf','sequelize','exports','STRING'];(function(_0x1ce8e4,_0x68e410){var _0x58e579=function(_0x308861){while(--_0x308861){_0x1ce8e4['push'](_0x1ce8e4['shift']());}};_0x58e579(++_0x68e410);}(_0xe14b,0x93));var _0xbe14=function(_0x163c88,_0x207b42){_0x163c88=_0x163c88-0x0;var _0x409b71=_0xe14b[_0x163c88];return _0x409b71;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbe14('0x2')]},'context':{'type':Sequelize[_0xbe14('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xbe14('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xbe14('0x2')]},'saveName':{'type':Sequelize[_0xbe14('0x2')]},'filename':{'type':Sequelize[_0xbe14('0x2')]},'savePath':{'type':Sequelize[_0xbe14('0x2')]},'format':{'type':Sequelize[_0xbe14('0x3')],'get':function(){var _0x39387e='';var _0x196fca=this['getDataValue']('savePath');if(_0x196fca){_0x39387e=_0x196fca['substring'](_0x196fca[_0xbe14('0x4')]('.'));}return _0x39387e;}}}; \ No newline at end of file +var _0xdbf5=['lastIndexOf','exports','STRING','VIRTUAL','savePath'];(function(_0x2f8487,_0x1fd7dd){var _0x14046b=function(_0x164398){while(--_0x164398){_0x2f8487['push'](_0x2f8487['shift']());}};_0x14046b(++_0x1fd7dd);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x46dda3,_0x1482ce){_0x46dda3=_0x46dda3-0x0;var _0xdcbef=_0xdbf5[_0x46dda3];return _0xdcbef;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5dbf('0x1')]},'context':{'type':Sequelize[_0x5dbf('0x1')]},'extension':{'type':Sequelize[_0x5dbf('0x1')]},'priority':{'type':Sequelize[_0x5dbf('0x1')]},'accountcode':{'type':Sequelize[_0x5dbf('0x1')]},'dnid':{'type':Sequelize[_0x5dbf('0x1')]},'projectName':{'type':Sequelize[_0x5dbf('0x1')]},'saveName':{'type':Sequelize[_0x5dbf('0x1')]},'filename':{'type':Sequelize[_0x5dbf('0x1')]},'savePath':{'type':Sequelize[_0x5dbf('0x1')]},'format':{'type':Sequelize[_0x5dbf('0x2')],'get':function(){var _0x88128e='';var _0x93e657=this['getDataValue'](_0x5dbf('0x3'));if(_0x93e657){_0x88128e=_0x93e657['substring'](_0x93e657[_0x5dbf('0x4')]('.'));}return _0x88128e;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index e5e3179..6b6736b 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 _0x6d61=['secrets','recording','Sequelize','SquareRecording\x20not\x20found','extname','unlink','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','SquareRecording','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','catch','show','params','rawAttributes','length','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync'];(function(_0x1f3611,_0x1a555a){var _0x5d7187=function(_0x2f17ff){while(--_0x2f17ff){_0x1f3611['push'](_0x1f3611['shift']());}};_0x5d7187(++_0x1a555a);}(_0x6d61,0xca));var _0x16d6=function(_0x2c9d04,_0x198f67){_0x2c9d04=_0x2c9d04-0x0;var _0x2884e9=_0x6d61[_0x2c9d04];return _0x2884e9;};'use strict';var emlformat=require(_0x16d6('0x0'));var rimraf=require(_0x16d6('0x1'));var zipdir=require(_0x16d6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x16d6('0x3'));var BPromise=require(_0x16d6('0x4'));var Mustache=require(_0x16d6('0x5'));var util=require(_0x16d6('0x6'));var path=require(_0x16d6('0x7'));var sox=require(_0x16d6('0x8'));var csv=require(_0x16d6('0x9'));var ejs=require(_0x16d6('0xa'));var fs=require('fs');var fs_extra=require(_0x16d6('0xb'));var _=require('lodash');var squel=require(_0x16d6('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x16d6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x16d6('0xe'));var Papa=require(_0x16d6('0xf'));var Redis=require(_0x16d6('0x10'));var authService=require(_0x16d6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x16d6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x16d6('0x13'))(_0x16d6('0x14'));var utils=require('../../config/utils');var config=require(_0x16d6('0x15'));var licenseUtil=require(_0x16d6('0x16'));var db=require(_0x16d6('0x17'))['db'];function respondWithStatusCode(_0x22da0f,_0x43df16){_0x43df16=_0x43df16||0xcc;return function(_0x1359c9){if(_0x1359c9){return _0x22da0f[_0x16d6('0x18')](_0x43df16);}return _0x22da0f[_0x16d6('0x19')](_0x43df16)[_0x16d6('0x1a')]();};}function respondWithResult(_0x50bae2,_0x2bee0c){_0x2bee0c=_0x2bee0c||0xc8;return function(_0x8cebb){if(_0x8cebb){return _0x50bae2[_0x16d6('0x19')](_0x2bee0c)[_0x16d6('0x1b')](_0x8cebb);}};}function respondWithFilteredResult(_0x33ffc2,_0x4bf167){return function(_0x29a76a){if(_0x29a76a){var _0x3924a1=typeof _0x4bf167[_0x16d6('0x1c')]==='undefined'&&typeof _0x4bf167['limit']===_0x16d6('0x1d');var _0x29d004=_0x29a76a[_0x16d6('0x1e')];var _0x5ef2cd=_0x3924a1?0x0:_0x4bf167[_0x16d6('0x1c')];var _0x4b466a=_0x3924a1?_0x29a76a[_0x16d6('0x1e')]:_0x4bf167[_0x16d6('0x1c')]+_0x4bf167[_0x16d6('0x1f')];var _0x5ef6bb;if(_0x4b466a>=_0x29d004){_0x4b466a=_0x29d004;_0x5ef6bb=0xc8;}else{_0x5ef6bb=0xce;}_0x33ffc2[_0x16d6('0x19')](_0x5ef6bb);return _0x33ffc2[_0x16d6('0x20')](_0x16d6('0x21'),_0x5ef2cd+'-'+_0x4b466a+'/'+_0x29d004)['json'](_0x29a76a);}return null;};}function patchUpdates(_0x230e81){return function(_0x3c8f37){try{jsonpatch[_0x16d6('0x22')](_0x3c8f37,_0x230e81,!![]);}catch(_0x356c7f){return BPromise[_0x16d6('0x23')](_0x356c7f);}return _0x3c8f37[_0x16d6('0x24')]();};}function saveUpdates(_0x243898,_0x1b9747){return function(_0x2a0dbb){if(_0x2a0dbb){return _0x2a0dbb[_0x16d6('0x25')](_0x243898)[_0x16d6('0x26')](function(_0x1f209b){return _0x1f209b;});}return null;};}function removeEntity(_0x1781c6,_0x4040d3){return function(_0x3da59d){if(_0x3da59d){return _0x3da59d[_0x16d6('0x27')]()['then'](function(){_0x1781c6[_0x16d6('0x19')](0xcc)[_0x16d6('0x1a')]();});}};}function handleEntityNotFound(_0x69b875,_0x53d766){return function(_0x4317e2){if(!_0x4317e2){_0x69b875[_0x16d6('0x18')](0x194);}return _0x4317e2;};}function handleError(_0x348b6f,_0x2dacfa){_0x2dacfa=_0x2dacfa||0x1f4;return function(_0x45d435){logger[_0x16d6('0x28')](_0x45d435['stack']);if(_0x45d435['name']){delete _0x45d435[_0x16d6('0x29')];}_0x348b6f['status'](_0x2dacfa)[_0x16d6('0x2a')](_0x45d435);};}exports[_0x16d6('0x2b')]=function(_0x485482,_0x593fdd){var _0xdb39bd={},_0x4ce0ac={},_0x3a1a22={'count':0x0,'rows':[]};var _0x4199d4=_['map'](db[_0x16d6('0x2c')]['rawAttributes'],function(_0x3df768){return{'name':_0x3df768['fieldName'],'type':_0x3df768['type']['key']};});_0x4ce0ac[_0x16d6('0x2d')]=_[_0x16d6('0x2e')](_0x4199d4,_0x16d6('0x29'));_0x4ce0ac['query']=_[_0x16d6('0x2f')](_0x485482[_0x16d6('0x30')]);_0x4ce0ac[_0x16d6('0x31')]=_[_0x16d6('0x32')](_0x4ce0ac[_0x16d6('0x2d')],_0x4ce0ac[_0x16d6('0x30')]);_0xdb39bd[_0x16d6('0x33')]=_[_0x16d6('0x32')](_0x4ce0ac[_0x16d6('0x2d')],qs[_0x16d6('0x34')](_0x485482['query']['fields']));_0xdb39bd[_0x16d6('0x33')]=_0xdb39bd[_0x16d6('0x33')]['length']?_0xdb39bd[_0x16d6('0x33')]:_0x4ce0ac[_0x16d6('0x2d')];if(!_0x485482[_0x16d6('0x30')][_0x16d6('0x35')](_0x16d6('0x36'))){_0xdb39bd['limit']=qs[_0x16d6('0x1f')](_0x485482[_0x16d6('0x30')][_0x16d6('0x1f')]);_0xdb39bd[_0x16d6('0x1c')]=qs[_0x16d6('0x1c')](_0x485482[_0x16d6('0x30')][_0x16d6('0x1c')]);}_0xdb39bd[_0x16d6('0x37')]=qs[_0x16d6('0x38')](_0x485482['query'][_0x16d6('0x38')]);_0xdb39bd[_0x16d6('0x39')]=qs[_0x16d6('0x31')](_[_0x16d6('0x3a')](_0x485482[_0x16d6('0x30')],_0x4ce0ac[_0x16d6('0x31')]),_0x4199d4);if(_0x485482[_0x16d6('0x30')][_0x16d6('0x3b')]){_0xdb39bd[_0x16d6('0x39')]=_[_0x16d6('0x3c')](_0xdb39bd[_0x16d6('0x39')],{'$or':_[_0x16d6('0x2e')](_0x4199d4,function(_0x381c57){if(_0x381c57[_0x16d6('0x3d')]!==_0x16d6('0x3e')){var _0x15e982={};_0x15e982[_0x381c57[_0x16d6('0x29')]]={'$like':'%'+_0x485482['query'][_0x16d6('0x3b')]+'%'};return _0x15e982;}})});}_0xdb39bd=_[_0x16d6('0x3c')]({},_0xdb39bd,_0x485482['options']);var _0x5f8fd6={'where':_0xdb39bd['where']};return db[_0x16d6('0x2c')][_0x16d6('0x1e')](_0x5f8fd6)[_0x16d6('0x26')](function(_0x51541b){_0x3a1a22[_0x16d6('0x1e')]=_0x51541b;if(_0x485482[_0x16d6('0x30')][_0x16d6('0x3f')]){_0xdb39bd['include']=[{'all':!![]}];}return db[_0x16d6('0x2c')]['findAll'](_0xdb39bd);})[_0x16d6('0x26')](function(_0x424799){_0x3a1a22['rows']=_0x424799;return _0x3a1a22;})[_0x16d6('0x26')](respondWithFilteredResult(_0x593fdd,_0xdb39bd))[_0x16d6('0x40')](handleError(_0x593fdd,null));};exports[_0x16d6('0x41')]=function(_0x3e4ffd,_0x1ffc40){var _0x4522ca={'raw':!![],'where':{'id':_0x3e4ffd[_0x16d6('0x42')]['id']}},_0x496d2e={};_0x496d2e['model']=_['keys'](db[_0x16d6('0x2c')][_0x16d6('0x43')]);_0x496d2e[_0x16d6('0x30')]=_['keys'](_0x3e4ffd[_0x16d6('0x30')]);_0x496d2e['filters']=_['intersection'](_0x496d2e[_0x16d6('0x2d')],_0x496d2e[_0x16d6('0x30')]);_0x4522ca[_0x16d6('0x33')]=_['intersection'](_0x496d2e[_0x16d6('0x2d')],qs[_0x16d6('0x34')](_0x3e4ffd['query']['fields']));_0x4522ca[_0x16d6('0x33')]=_0x4522ca[_0x16d6('0x33')][_0x16d6('0x44')]?_0x4522ca[_0x16d6('0x33')]:_0x496d2e[_0x16d6('0x2d')];if(_0x3e4ffd['query']['includeAll']){_0x4522ca['include']=[{'all':!![]}];}_0x4522ca=_[_0x16d6('0x3c')]({},_0x4522ca,_0x3e4ffd['options']);return db['SquareRecording'][_0x16d6('0x45')](_0x4522ca)[_0x16d6('0x26')](handleEntityNotFound(_0x1ffc40,null))[_0x16d6('0x26')](respondWithResult(_0x1ffc40,null))[_0x16d6('0x40')](handleError(_0x1ffc40,null));};exports[_0x16d6('0x46')]=function(_0x36a785,_0x5d477d){return db[_0x16d6('0x2c')][_0x16d6('0x46')](_0x36a785['body'],{})[_0x16d6('0x26')](respondWithResult(_0x5d477d,0xc9))[_0x16d6('0x40')](handleError(_0x5d477d,null));};exports[_0x16d6('0x25')]=function(_0x159f93,_0x20f122){if(_0x159f93[_0x16d6('0x47')]['id']){delete _0x159f93['body']['id'];}return db[_0x16d6('0x2c')][_0x16d6('0x45')]({'where':{'id':_0x159f93[_0x16d6('0x42')]['id']}})[_0x16d6('0x26')](handleEntityNotFound(_0x20f122,null))[_0x16d6('0x26')](saveUpdates(_0x159f93[_0x16d6('0x47')],null))[_0x16d6('0x26')](respondWithResult(_0x20f122,null))['catch'](handleError(_0x20f122,null));};exports[_0x16d6('0x48')]=function(_0x4ed817,_0x30a157,_0x9a712a){var _0x9e5a81=require(_0x16d6('0x49'));var _0x4c2c36=![];var _0x3230a8={};if(_0x4ed817[_0x16d6('0x30')][_0x16d6('0x3d')]&&_0x4ed817[_0x16d6('0x30')][_0x16d6('0x3d')]===_0x16d6('0x4a')){_0x3230a8['uniqueid']=_0x4ed817[_0x16d6('0x42')]['id'];}else{_0x3230a8['id']=_0x4ed817['params']['id'];}return db[_0x16d6('0x2c')][_0x16d6('0x45')]({'where':_0x3230a8,'attributes':['id',_0x16d6('0x4b'),_0x16d6('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x30a157,null))[_0x16d6('0x26')](function(_0x4c0f0c){if(_0x4c0f0c){var _0x574c13=_0x4c0f0c[_0x16d6('0x4b')];var _0x916ca4=util[_0x16d6('0x4d')](_0x16d6('0x4e'),_0x574c13);if(fs[_0x16d6('0x4f')](_0x916ca4)){_0x4c2c36=!![];return _0x9e5a81['decryptFile'](_0x916ca4,_0x574c13,config[_0x16d6('0x50')][_0x16d6('0x51')])[_0x16d6('0x26')](function(){return _0x4c0f0c;});}return _0x4c0f0c;}})[_0x16d6('0x26')](function(_0x457061){if(_0x457061){var _0x41ca00=_0x457061['savePath'];if(!fs['existsSync'](_0x41ca00)){throw new db[(_0x16d6('0x52'))]['ValidationError'](_0x16d6('0x53'));}if(_0x457061[_0x16d6('0x4c')]){return _0x30a157[_0x16d6('0x48')](_0x41ca00,_0x457061['filename']+path[_0x16d6('0x54')](_0x41ca00),function(){if(_0x4c2c36){fs[_0x16d6('0x55')](_0x41ca00);}});}else{return _0x30a157[_0x16d6('0x48')](_0x41ca00,function(_0x41392a){if(_0x4c2c36){fs[_0x16d6('0x55')](_0x41ca00);}});}}})['catch'](function(_0x1a0938){if(_0x1a0938['message']==='SquareRecording\x20not\x20found'){_0x30a157[_0x16d6('0x19')](0x194)[_0x16d6('0x2a')]('Not\x20found');}else{return handleError(_0x30a157,null);}});};exports['destroy']=function(_0x2532d8,_0x5818df){return db['SquareRecording'][_0x16d6('0x45')]({'where':{'id':_0x2532d8['params']['id']}})['then'](function(_0x22d018){if(_['isNil'](_0x22d018)){throw new ReferenceError(_0x16d6('0x56'));}return _0x22d018;})['then'](function(_0x324184){var _0x55673c=_0x324184[_0x16d6('0x4b')];logger[_0x16d6('0x57')](_0x16d6('0x58'),_0x55673c);if(!_[_0x16d6('0x59')](_0x324184['savePath'])&&fs[_0x16d6('0x4f')](_0x55673c)){logger[_0x16d6('0x57')](_0x16d6('0x5a')+_0x55673c+_0x16d6('0x5b'));fs[_0x16d6('0x5c')](_0x55673c);}_0x55673c=_0x55673c+_0x16d6('0x5d');if(!_[_0x16d6('0x59')](_0x324184[_0x16d6('0x4b')])&&fs[_0x16d6('0x4f')](_0x55673c)){logger[_0x16d6('0x57')](_0x16d6('0x5a')+_0x55673c+_0x16d6('0x5b'));fs['unlinkSync'](_0x55673c);}return _0x324184;})[_0x16d6('0x26')](function(_0xb4e69c){if(!_0xb4e69c)throw new InternalError();return _0xb4e69c[_0x16d6('0x27')]();})['then'](function(){_0x5818df['status'](0xcc)[_0x16d6('0x1a')]();})['catch'](handleError(_0x5818df,null));}; \ No newline at end of file +var _0x80a1=['body','download','../../components/encryptor','uniqueid','savePath','filename','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','name','send','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x80a1,0xd1));var _0x180a=function(_0xf3c8a4,_0x2bd868){_0xf3c8a4=_0xf3c8a4-0x0;var _0x4f5a9f=_0x80a1[_0xf3c8a4];return _0x4f5a9f;};'use strict';var emlformat=require(_0x180a('0x0'));var rimraf=require(_0x180a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x180a('0x2'));var moment=require(_0x180a('0x3'));var BPromise=require(_0x180a('0x4'));var Mustache=require(_0x180a('0x5'));var util=require(_0x180a('0x6'));var path=require(_0x180a('0x7'));var sox=require(_0x180a('0x8'));var csv=require('to-csv');var ejs=require(_0x180a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x180a('0xa'));var squel=require(_0x180a('0xb'));var crypto=require(_0x180a('0xc'));var jsforce=require(_0x180a('0xd'));var deskjs=require(_0x180a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x180a('0xf'));var Papa=require(_0x180a('0x10'));var Redis=require('ioredis');var authService=require(_0x180a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x180a('0x12'))('api');var utils=require(_0x180a('0x13'));var config=require(_0x180a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x180a('0x15'))['db'];function respondWithStatusCode(_0x53bffd,_0x53feeb){_0x53feeb=_0x53feeb||0xcc;return function(_0x51c1b8){if(_0x51c1b8){return _0x53bffd[_0x180a('0x16')](_0x53feeb);}return _0x53bffd[_0x180a('0x17')](_0x53feeb)[_0x180a('0x18')]();};}function respondWithResult(_0x285e08,_0x2b3658){_0x2b3658=_0x2b3658||0xc8;return function(_0x29db9b){if(_0x29db9b){return _0x285e08['status'](_0x2b3658)[_0x180a('0x19')](_0x29db9b);}};}function respondWithFilteredResult(_0x14307b,_0x49f901){return function(_0x35382f){if(_0x35382f){var _0x3e80e0=typeof _0x49f901[_0x180a('0x1a')]===_0x180a('0x1b')&&typeof _0x49f901[_0x180a('0x1c')]===_0x180a('0x1b');var _0x1ecabb=_0x35382f[_0x180a('0x1d')];var _0x223b11=_0x3e80e0?0x0:_0x49f901['offset'];var _0x1d6bb1=_0x3e80e0?_0x35382f[_0x180a('0x1d')]:_0x49f901[_0x180a('0x1a')]+_0x49f901[_0x180a('0x1c')];var _0x5c74b9;if(_0x1d6bb1>=_0x1ecabb){_0x1d6bb1=_0x1ecabb;_0x5c74b9=0xc8;}else{_0x5c74b9=0xce;}_0x14307b[_0x180a('0x17')](_0x5c74b9);return _0x14307b['set'](_0x180a('0x1e'),_0x223b11+'-'+_0x1d6bb1+'/'+_0x1ecabb)[_0x180a('0x19')](_0x35382f);}return null;};}function patchUpdates(_0x2c5a52){return function(_0x4daf70){try{jsonpatch[_0x180a('0x1f')](_0x4daf70,_0x2c5a52,!![]);}catch(_0x4e75d2){return BPromise['reject'](_0x4e75d2);}return _0x4daf70[_0x180a('0x20')]();};}function saveUpdates(_0x529572,_0x46693c){return function(_0x14adc3){if(_0x14adc3){return _0x14adc3[_0x180a('0x21')](_0x529572)[_0x180a('0x22')](function(_0x47ed58){return _0x47ed58;});}return null;};}function removeEntity(_0x4e2c8b,_0x691766){return function(_0x4380e5){if(_0x4380e5){return _0x4380e5[_0x180a('0x23')]()[_0x180a('0x22')](function(){_0x4e2c8b['status'](0xcc)[_0x180a('0x18')]();});}};}function handleEntityNotFound(_0x3aae84,_0x20b028){return function(_0x3b6ce4){if(!_0x3b6ce4){_0x3aae84[_0x180a('0x16')](0x194);}return _0x3b6ce4;};}function handleError(_0x2ba083,_0xe8e35c){_0xe8e35c=_0xe8e35c||0x1f4;return function(_0x8f0742){logger['error'](_0x8f0742['stack']);if(_0x8f0742[_0x180a('0x24')]){delete _0x8f0742['name'];}_0x2ba083['status'](_0xe8e35c)[_0x180a('0x25')](_0x8f0742);};}exports['index']=function(_0x51d133,_0x4cba06){var _0x59ae03={},_0x15aa1f={},_0x448bf3={'count':0x0,'rows':[]};var _0x122857=_[_0x180a('0x26')](db[_0x180a('0x27')][_0x180a('0x28')],function(_0x586df2){return{'name':_0x586df2[_0x180a('0x29')],'type':_0x586df2[_0x180a('0x2a')][_0x180a('0x2b')]};});_0x15aa1f[_0x180a('0x2c')]=_[_0x180a('0x26')](_0x122857,'name');_0x15aa1f[_0x180a('0x2d')]=_[_0x180a('0x2e')](_0x51d133['query']);_0x15aa1f[_0x180a('0x2f')]=_['intersection'](_0x15aa1f[_0x180a('0x2c')],_0x15aa1f['query']);_0x59ae03[_0x180a('0x30')]=_[_0x180a('0x31')](_0x15aa1f[_0x180a('0x2c')],qs[_0x180a('0x32')](_0x51d133[_0x180a('0x2d')][_0x180a('0x32')]));_0x59ae03[_0x180a('0x30')]=_0x59ae03[_0x180a('0x30')]['length']?_0x59ae03[_0x180a('0x30')]:_0x15aa1f[_0x180a('0x2c')];if(!_0x51d133[_0x180a('0x2d')][_0x180a('0x33')](_0x180a('0x34'))){_0x59ae03[_0x180a('0x1c')]=qs[_0x180a('0x1c')](_0x51d133[_0x180a('0x2d')][_0x180a('0x1c')]);_0x59ae03[_0x180a('0x1a')]=qs[_0x180a('0x1a')](_0x51d133['query'][_0x180a('0x1a')]);}_0x59ae03[_0x180a('0x35')]=qs['sort'](_0x51d133[_0x180a('0x2d')][_0x180a('0x36')]);_0x59ae03[_0x180a('0x37')]=qs['filters'](_['pick'](_0x51d133[_0x180a('0x2d')],_0x15aa1f[_0x180a('0x2f')]),_0x122857);if(_0x51d133[_0x180a('0x2d')][_0x180a('0x38')]){_0x59ae03[_0x180a('0x37')]=_[_0x180a('0x39')](_0x59ae03[_0x180a('0x37')],{'$or':_[_0x180a('0x26')](_0x122857,function(_0x4dd5fa){if(_0x4dd5fa[_0x180a('0x2a')]!==_0x180a('0x3a')){var _0x17b34f={};_0x17b34f[_0x4dd5fa['name']]={'$like':'%'+_0x51d133[_0x180a('0x2d')][_0x180a('0x38')]+'%'};return _0x17b34f;}})});}_0x59ae03=_[_0x180a('0x39')]({},_0x59ae03,_0x51d133[_0x180a('0x3b')]);var _0x269aeb={'where':_0x59ae03[_0x180a('0x37')]};return db[_0x180a('0x27')][_0x180a('0x1d')](_0x269aeb)[_0x180a('0x22')](function(_0x394c7a){_0x448bf3[_0x180a('0x1d')]=_0x394c7a;if(_0x51d133[_0x180a('0x2d')]['includeAll']){_0x59ae03[_0x180a('0x3c')]=[{'all':!![]}];}return db['SquareRecording'][_0x180a('0x3d')](_0x59ae03);})[_0x180a('0x22')](function(_0x47c54b){_0x448bf3[_0x180a('0x3e')]=_0x47c54b;return _0x448bf3;})[_0x180a('0x22')](respondWithFilteredResult(_0x4cba06,_0x59ae03))[_0x180a('0x3f')](handleError(_0x4cba06,null));};exports[_0x180a('0x40')]=function(_0x5f58ac,_0x355411){var _0x5eb909={'raw':!![],'where':{'id':_0x5f58ac[_0x180a('0x41')]['id']}},_0x1cbe17={};_0x1cbe17[_0x180a('0x2c')]=_[_0x180a('0x2e')](db['SquareRecording'][_0x180a('0x28')]);_0x1cbe17[_0x180a('0x2d')]=_[_0x180a('0x2e')](_0x5f58ac['query']);_0x1cbe17[_0x180a('0x2f')]=_['intersection'](_0x1cbe17[_0x180a('0x2c')],_0x1cbe17[_0x180a('0x2d')]);_0x5eb909[_0x180a('0x30')]=_[_0x180a('0x31')](_0x1cbe17[_0x180a('0x2c')],qs[_0x180a('0x32')](_0x5f58ac[_0x180a('0x2d')][_0x180a('0x32')]));_0x5eb909[_0x180a('0x30')]=_0x5eb909[_0x180a('0x30')][_0x180a('0x42')]?_0x5eb909[_0x180a('0x30')]:_0x1cbe17[_0x180a('0x2c')];if(_0x5f58ac['query'][_0x180a('0x43')]){_0x5eb909[_0x180a('0x3c')]=[{'all':!![]}];}_0x5eb909=_[_0x180a('0x39')]({},_0x5eb909,_0x5f58ac[_0x180a('0x3b')]);return db[_0x180a('0x27')][_0x180a('0x44')](_0x5eb909)[_0x180a('0x22')](handleEntityNotFound(_0x355411,null))[_0x180a('0x22')](respondWithResult(_0x355411,null))['catch'](handleError(_0x355411,null));};exports[_0x180a('0x45')]=function(_0x1f00b1,_0x5929c9){return db[_0x180a('0x27')][_0x180a('0x45')](_0x1f00b1[_0x180a('0x46')],{})[_0x180a('0x22')](respondWithResult(_0x5929c9,0xc9))[_0x180a('0x3f')](handleError(_0x5929c9,null));};exports['update']=function(_0x5aaadb,_0x4dfa4b){if(_0x5aaadb[_0x180a('0x46')]['id']){delete _0x5aaadb['body']['id'];}return db['SquareRecording'][_0x180a('0x44')]({'where':{'id':_0x5aaadb['params']['id']}})[_0x180a('0x22')](handleEntityNotFound(_0x4dfa4b,null))[_0x180a('0x22')](saveUpdates(_0x5aaadb['body'],null))[_0x180a('0x22')](respondWithResult(_0x4dfa4b,null))['catch'](handleError(_0x4dfa4b,null));};exports[_0x180a('0x47')]=function(_0x24622e,_0x26b55d,_0x32baad){var _0x507254=require(_0x180a('0x48'));var _0x2000ab=![];var _0x13d458={};if(_0x24622e[_0x180a('0x2d')][_0x180a('0x2a')]&&_0x24622e[_0x180a('0x2d')][_0x180a('0x2a')]===_0x180a('0x49')){_0x13d458['uniqueid']=_0x24622e['params']['id'];}else{_0x13d458['id']=_0x24622e[_0x180a('0x41')]['id'];}return db[_0x180a('0x27')][_0x180a('0x44')]({'where':_0x13d458,'attributes':['id',_0x180a('0x4a'),_0x180a('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x26b55d,null))[_0x180a('0x22')](function(_0x5c7b6a){if(_0x5c7b6a){var _0xcb8e67=_0x5c7b6a[_0x180a('0x4a')];var _0x37b68c=util['format']('%s.cypher',_0xcb8e67);if(fs[_0x180a('0x4c')](_0x37b68c)){_0x2000ab=!![];return _0x507254[_0x180a('0x4d')](_0x37b68c,_0xcb8e67,config[_0x180a('0x4e')][_0x180a('0x4f')])[_0x180a('0x22')](function(){return _0x5c7b6a;});}return _0x5c7b6a;}})[_0x180a('0x22')](function(_0x479a12){if(_0x479a12){var _0x25a574=_0x479a12[_0x180a('0x4a')];if(!fs[_0x180a('0x4c')](_0x25a574)){throw new db[(_0x180a('0x50'))][(_0x180a('0x51'))](_0x180a('0x52'));}if(_0x479a12['filename']){return _0x26b55d[_0x180a('0x47')](_0x25a574,_0x479a12[_0x180a('0x4b')]+path[_0x180a('0x53')](_0x25a574),function(){if(_0x2000ab){fs[_0x180a('0x54')](_0x25a574);}});}else{return _0x26b55d[_0x180a('0x47')](_0x25a574,function(_0x4ff285){if(_0x2000ab){fs[_0x180a('0x54')](_0x25a574);}});}}})[_0x180a('0x3f')](function(_0x276da5){if(_0x276da5['message']===_0x180a('0x52')){_0x26b55d[_0x180a('0x17')](0x194)[_0x180a('0x25')](_0x180a('0x55'));}else{return handleError(_0x26b55d,null);}});};exports['destroy']=function(_0x1ba317,_0xd61cd8){return db[_0x180a('0x27')][_0x180a('0x44')]({'where':{'id':_0x1ba317[_0x180a('0x41')]['id']}})[_0x180a('0x22')](function(_0x164e38){if(_[_0x180a('0x56')](_0x164e38)){throw new ReferenceError('Entity\x20not\x20found');}return _0x164e38;})[_0x180a('0x22')](function(_0x41820d){var _0x104ebf=_0x41820d['savePath'];logger[_0x180a('0x57')](_0x180a('0x58'),_0x104ebf);if(!_['isNil'](_0x41820d['savePath'])&&fs[_0x180a('0x4c')](_0x104ebf)){logger[_0x180a('0x57')](_0x180a('0x59')+_0x104ebf+_0x180a('0x5a'));fs['unlinkSync'](_0x104ebf);}_0x104ebf=_0x104ebf+_0x180a('0x5b');if(!_[_0x180a('0x56')](_0x41820d['savePath'])&&fs[_0x180a('0x4c')](_0x104ebf)){logger['info'](_0x180a('0x59')+_0x104ebf+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x180a('0x5c')](_0x104ebf);}return _0x41820d;})[_0x180a('0x22')](function(_0x30d891){if(!_0x30d891)throw new InternalError();return _0x30d891[_0x180a('0x23')]();})[_0x180a('0x22')](function(){_0xd61cd8[_0x180a('0x17')](0xcc)[_0x180a('0x18')]();})[_0x180a('0x3f')](handleError(_0xd61cd8,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index ba78897..963c953 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 _0x7669=['square_recordings','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x513cfd,_0xef344e){var _0x3a3012=function(_0x1ddc0a){while(--_0x1ddc0a){_0x513cfd['push'](_0x513cfd['shift']());}};_0x3a3012(++_0xef344e);}(_0x7669,0xe5));var _0x9766=function(_0x12842b,_0xf7ee85){_0x12842b=_0x12842b-0x0;var _0x55b0d0=_0x7669[_0x12842b];return _0x55b0d0;};'use strict';var _=require(_0x9766('0x0'));var util=require(_0x9766('0x1'));var logger=require(_0x9766('0x2'))('api');var moment=require(_0x9766('0x3'));var BPromise=require(_0x9766('0x4'));var rp=require(_0x9766('0x5'));var fs=require('fs');var path=require(_0x9766('0x6'));var rimraf=require(_0x9766('0x7'));var config=require(_0x9766('0x8'));var attributes=require('./squareRecording.attributes');module[_0x9766('0x9')]=function(_0x1f49b5,_0x245178){return _0x1f49b5[_0x9766('0xa')]('SquareRecording',attributes,{'tableName':_0x9766('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed1c=['exports','SquareRecording','square_recordings','lodash','util','request-promise','path','rimraf','./squareRecording.attributes'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xed1c,0xe4));var _0xced1=function(_0x4689c6,_0x3ad9ee){_0x4689c6=_0x4689c6-0x0;var _0x1628ad=_0xed1c[_0x4689c6];return _0x1628ad;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xced1('0x2'));var fs=require('fs');var path=require(_0xced1('0x3'));var rimraf=require(_0xced1('0x4'));var config=require('../../config/environment');var attributes=require(_0xced1('0x5'));module[_0xced1('0x6')]=function(_0x466657,_0x37b22b){return _0x466657['define'](_0xced1('0x7'),attributes,{'tableName':_0xced1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 7704216..2a73607 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 _0x4d04=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateSquareRecording','SquareRecording','create','body','options','raw','info','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1274f0,_0x5389b0){var _0x5260c0=function(_0x5a7c20){while(--_0x5a7c20){_0x1274f0['push'](_0x1274f0['shift']());}};_0x5260c0(++_0x5389b0);}(_0x4d04,0x130));var _0x44d0=function(_0x18f0d1,_0x5868ad){_0x18f0d1=_0x18f0d1-0x0;var _0x5d7b49=_0x4d04[_0x18f0d1];return _0x5d7b49;};'use strict';var _=require(_0x44d0('0x0'));var util=require(_0x44d0('0x1'));var moment=require(_0x44d0('0x2'));var BPromise=require(_0x44d0('0x3'));var rs=require(_0x44d0('0x4'));var fs=require('fs');var Redis=require(_0x44d0('0x5'));var db=require(_0x44d0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x44d0('0x7'))(_0x44d0('0x8'));var config=require(_0x44d0('0x9'));var jayson=require(_0x44d0('0xa'));var client=jayson[_0x44d0('0xb')][_0x44d0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x323353,_0x1baebf,_0x1d5a3d){return new BPromise(function(_0x36c256,_0x3177a3){return client[_0x44d0('0xd')](_0x323353,_0x1d5a3d)[_0x44d0('0xe')](function(_0x3f2668){logger['info'](_0x44d0('0xf'),_0x1baebf,_0x44d0('0x10'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x1baebf,'request\x20sent',JSON[_0x44d0('0x11')](_0x3f2668));if(_0x3f2668[_0x44d0('0x12')]){if(_0x3f2668['error'][_0x44d0('0x13')]===0x1f4){logger['error'](_0x44d0('0xf'),_0x1baebf,_0x3f2668[_0x44d0('0x12')][_0x44d0('0x14')]);return _0x3177a3(_0x3f2668[_0x44d0('0x12')][_0x44d0('0x14')]);}logger[_0x44d0('0x12')]('SquareRecording,\x20%s,\x20%s',_0x1baebf,_0x3f2668[_0x44d0('0x12')]['message']);return _0x36c256(_0x3f2668['error'][_0x44d0('0x14')]);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x1baebf,_0x44d0('0x10'));_0x36c256(_0x3f2668[_0x44d0('0x15')][_0x44d0('0x14')]);}})['catch'](function(_0x2bf029){logger['error'](_0x44d0('0xf'),_0x1baebf,_0x2bf029);_0x3177a3(_0x2bf029);});});}exports[_0x44d0('0x16')]=function(_0x2f219a){var _0x5bb007=this;return new Promise(function(_0x1f61e5,_0x2884ed){return db[_0x44d0('0x17')][_0x44d0('0x18')](_0x2f219a[_0x44d0('0x19')],{'raw':_0x2f219a[_0x44d0('0x1a')]?_0x2f219a['options'][_0x44d0('0x1b')]===undefined?!![]:![]:!![]})[_0x44d0('0xe')](function(_0x54265b){logger[_0x44d0('0x1c')](_0x44d0('0x16'),_0x2f219a);logger[_0x44d0('0x1d')]('CreateSquareRecording',_0x2f219a,JSON[_0x44d0('0x11')](_0x54265b));_0x1f61e5(_0x54265b);})[_0x44d0('0x1e')](function(_0x151080){logger[_0x44d0('0x12')](_0x44d0('0x16'),_0x151080['message'],_0x2f219a);_0x2884ed(_0x5bb007[_0x44d0('0x12')](0x1f4,_0x151080[_0x44d0('0x14')]));});});}; \ No newline at end of file +var _0x2df9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareRecording','create','body','raw','debug','catch','lodash'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2df9,0xdf));var _0x92df=function(_0x4eab9a,_0x442123){_0x4eab9a=_0x4eab9a-0x0;var _0x2861cd=_0x2df9[_0x4eab9a];return _0x2861cd;};'use strict';var _=require(_0x92df('0x0'));var util=require(_0x92df('0x1'));var moment=require(_0x92df('0x2'));var BPromise=require(_0x92df('0x3'));var rs=require(_0x92df('0x4'));var fs=require('fs');var Redis=require(_0x92df('0x5'));var db=require(_0x92df('0x6'))['db'];var utils=require(_0x92df('0x7'));var logger=require('../../config/logger')(_0x92df('0x8'));var config=require(_0x92df('0x9'));var jayson=require(_0x92df('0xa'));var client=jayson[_0x92df('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x374009,_0x4b3798,_0x57d3c3){return new BPromise(function(_0x5116e6,_0x568f82){return client[_0x92df('0xc')](_0x374009,_0x57d3c3)['then'](function(_0x3c9e9c){logger[_0x92df('0xd')](_0x92df('0xe'),_0x4b3798,_0x92df('0xf'));logger['debug'](_0x92df('0x10'),_0x4b3798,_0x92df('0xf'),JSON[_0x92df('0x11')](_0x3c9e9c));if(_0x3c9e9c[_0x92df('0x12')]){if(_0x3c9e9c[_0x92df('0x12')][_0x92df('0x13')]===0x1f4){logger[_0x92df('0x12')](_0x92df('0xe'),_0x4b3798,_0x3c9e9c[_0x92df('0x12')][_0x92df('0x14')]);return _0x568f82(_0x3c9e9c[_0x92df('0x12')][_0x92df('0x14')]);}logger['error'](_0x92df('0xe'),_0x4b3798,_0x3c9e9c[_0x92df('0x12')][_0x92df('0x14')]);return _0x5116e6(_0x3c9e9c[_0x92df('0x12')][_0x92df('0x14')]);}else{logger[_0x92df('0xd')](_0x92df('0xe'),_0x4b3798,'request\x20sent');_0x5116e6(_0x3c9e9c[_0x92df('0x15')][_0x92df('0x14')]);}})['catch'](function(_0x31d11b){logger[_0x92df('0x12')](_0x92df('0xe'),_0x4b3798,_0x31d11b);_0x568f82(_0x31d11b);});});}exports[_0x92df('0x16')]=function(_0xf6ee40){var _0x2c7617=this;return new Promise(function(_0x27eeeb,_0x49bfdc){return db['SquareRecording'][_0x92df('0x17')](_0xf6ee40[_0x92df('0x18')],{'raw':_0xf6ee40['options']?_0xf6ee40['options'][_0x92df('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x16d2d9){logger['info'](_0x92df('0x16'),_0xf6ee40);logger[_0x92df('0x1a')]('CreateSquareRecording',_0xf6ee40,JSON[_0x92df('0x11')](_0x16d2d9));_0x27eeeb(_0x16d2d9);})[_0x92df('0x1b')](function(_0x3645f3){logger[_0x92df('0x12')]('CreateSquareRecording',_0x3645f3[_0x92df('0x14')],_0xf6ee40);_0x49bfdc(_0x2c7617[_0x92df('0x12')](0x1f4,_0x3645f3[_0x92df('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index d038804..e2524c1 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x2d23e5,_0x32495a){var _0x38823a=function(_0x21809b){while(--_0x21809b){_0x2d23e5['push'](_0x2d23e5['shift']());}};_0x38823a(++_0x32495a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x3026bc,_0x6568b0){var _0x526c29=function(_0x1d5cf0){while(--_0x1d5cf0){_0x3026bc['push'](_0x3026bc['shift']());}};_0x526c29(++_0x6568b0);}(_0xe706,0xa3));var _0x6e70=function(_0xd308f,_0x3d0a33){_0xd308f=_0xd308f-0x0;var _0x24595c=_0xe706[_0xd308f];return _0x24595c;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index c06c9c8..efbd613 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 _0xb279=['exports','STRING','DATE','BOOLEAN'];(function(_0x7aba00,_0xcbacbf){var _0x1b540f=function(_0x137761){while(--_0x137761){_0x7aba00['push'](_0x7aba00['shift']());}};_0x1b540f(++_0xcbacbf);}(_0xb279,0x1d0));var _0x9b27=function(_0xdb7fe9,_0x42965d){_0xdb7fe9=_0xdb7fe9-0x0;var _0x59f871=_0xb279[_0xdb7fe9];return _0x59f871;};'use strict';var Sequelize=require('sequelize');module[_0x9b27('0x0')]={'network':{'type':Sequelize[_0x9b27('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9b27('0x1')]},'language':{'type':Sequelize[_0x9b27('0x1')]},'type':{'type':Sequelize[_0x9b27('0x1')]},'uniqueid':{'type':Sequelize[_0x9b27('0x1')]},'version':{'type':Sequelize[_0x9b27('0x1')]},'callerid':{'type':Sequelize[_0x9b27('0x1')]},'calleridname':{'type':Sequelize[_0x9b27('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x9b27('0x1')]},'callington':{'type':Sequelize[_0x9b27('0x1')]},'callingtns':{'type':Sequelize[_0x9b27('0x1')]},'dnid':{'type':Sequelize[_0x9b27('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x9b27('0x1')]},'extension':{'type':Sequelize[_0x9b27('0x1')]},'priority':{'type':Sequelize[_0x9b27('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9b27('0x1')]},'threadid':{'type':Sequelize[_0x9b27('0x1')]},'project_name':{'type':Sequelize[_0x9b27('0x1')]},'joinAt':{'type':Sequelize[_0x9b27('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x9b27('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x3cb6=['BOOLEAN','exports','STRING','DATE'];(function(_0x181348,_0x38a53f){var _0x1e1a7a=function(_0xe4b8bd){while(--_0xe4b8bd){_0x181348['push'](_0x181348['shift']());}};_0x1e1a7a(++_0x38a53f);}(_0x3cb6,0x121));var _0x63cb=function(_0x36eb52,_0x371099){_0x36eb52=_0x36eb52-0x0;var _0x1db6cc=_0x3cb6[_0x36eb52];return _0x1db6cc;};'use strict';var Sequelize=require('sequelize');module[_0x63cb('0x0')]={'network':{'type':Sequelize[_0x63cb('0x1')]},'network_script':{'type':Sequelize[_0x63cb('0x1')]},'request':{'type':Sequelize[_0x63cb('0x1')]},'channel':{'type':Sequelize[_0x63cb('0x1')]},'language':{'type':Sequelize[_0x63cb('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x63cb('0x1')]},'version':{'type':Sequelize[_0x63cb('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x63cb('0x1')]},'callingpres':{'type':Sequelize[_0x63cb('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x63cb('0x1')]},'callingtns':{'type':Sequelize[_0x63cb('0x1')]},'dnid':{'type':Sequelize[_0x63cb('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x63cb('0x1')]},'priority':{'type':Sequelize[_0x63cb('0x1')]},'enhanced':{'type':Sequelize[_0x63cb('0x1')]},'accountcode':{'type':Sequelize[_0x63cb('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x63cb('0x1')]},'joinAt':{'type':Sequelize[_0x63cb('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x63cb('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 5799540..21554c8 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 _0x1a68=['reject','save','update','then','destroy','end','stack','name','send','index','map','SquareReport','fieldName','key','model','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','keys','rawAttributes','length','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x542592,_0x131a21){var _0x16f582=function(_0x1019ae){while(--_0x1019ae){_0x542592['push'](_0x542592['shift']());}};_0x16f582(++_0x131a21);}(_0x1a68,0x1a2));var _0x81a6=function(_0x2af7bf,_0x1b710a){_0x2af7bf=_0x2af7bf-0x0;var _0x4ecdab=_0x1a68[_0x2af7bf];return _0x4ecdab;};'use strict';var emlformat=require(_0x81a6('0x0'));var rimraf=require(_0x81a6('0x1'));var zipdir=require(_0x81a6('0x2'));var jsonpatch=require(_0x81a6('0x3'));var rp=require(_0x81a6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x81a6('0x5'));var util=require('util');var path=require('path');var sox=require(_0x81a6('0x6'));var csv=require(_0x81a6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x81a6('0x8'));var _=require(_0x81a6('0x9'));var squel=require(_0x81a6('0xa'));var crypto=require(_0x81a6('0xb'));var jsforce=require(_0x81a6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x81a6('0xd'));var Redis=require('ioredis');var authService=require(_0x81a6('0xe'));var qs=require(_0x81a6('0xf'));var as=require(_0x81a6('0x10'));var hardwareService=require(_0x81a6('0x11'));var logger=require('../../config/logger')(_0x81a6('0x12'));var utils=require('../../config/utils');var config=require(_0x81a6('0x13'));var licenseUtil=require(_0x81a6('0x14'));var db=require(_0x81a6('0x15'))['db'];function respondWithStatusCode(_0x11fb1a,_0x500aae){_0x500aae=_0x500aae||0xcc;return function(_0x2463fd){if(_0x2463fd){return _0x11fb1a[_0x81a6('0x16')](_0x500aae);}return _0x11fb1a[_0x81a6('0x17')](_0x500aae)['end']();};}function respondWithResult(_0x5b7580,_0x5658c4){_0x5658c4=_0x5658c4||0xc8;return function(_0x4d8803){if(_0x4d8803){return _0x5b7580[_0x81a6('0x17')](_0x5658c4)[_0x81a6('0x18')](_0x4d8803);}};}function respondWithFilteredResult(_0x58f38e,_0x567ad5){return function(_0xaa5804){if(_0xaa5804){var _0x1d1995=typeof _0x567ad5[_0x81a6('0x19')]===_0x81a6('0x1a')&&typeof _0x567ad5['limit']===_0x81a6('0x1a');var _0x202b35=_0xaa5804['count'];var _0x52261e=_0x1d1995?0x0:_0x567ad5[_0x81a6('0x19')];var _0x24e308=_0x1d1995?_0xaa5804[_0x81a6('0x1b')]:_0x567ad5[_0x81a6('0x19')]+_0x567ad5[_0x81a6('0x1c')];var _0xfa1574;if(_0x24e308>=_0x202b35){_0x24e308=_0x202b35;_0xfa1574=0xc8;}else{_0xfa1574=0xce;}_0x58f38e[_0x81a6('0x17')](_0xfa1574);return _0x58f38e[_0x81a6('0x1d')](_0x81a6('0x1e'),_0x52261e+'-'+_0x24e308+'/'+_0x202b35)[_0x81a6('0x18')](_0xaa5804);}return null;};}function patchUpdates(_0x2534e6){return function(_0x11742a){try{jsonpatch[_0x81a6('0x1f')](_0x11742a,_0x2534e6,!![]);}catch(_0x16f089){return BPromise[_0x81a6('0x20')](_0x16f089);}return _0x11742a[_0x81a6('0x21')]();};}function saveUpdates(_0x320d43,_0x28ca48){return function(_0x2780a4){if(_0x2780a4){return _0x2780a4[_0x81a6('0x22')](_0x320d43)[_0x81a6('0x23')](function(_0x5c9b53){return _0x5c9b53;});}return null;};}function removeEntity(_0x379917,_0x3c7d57){return function(_0x2ab1c1){if(_0x2ab1c1){return _0x2ab1c1[_0x81a6('0x24')]()['then'](function(){_0x379917[_0x81a6('0x17')](0xcc)[_0x81a6('0x25')]();});}};}function handleEntityNotFound(_0x1e1c68,_0x4a9905){return function(_0x29a940){if(!_0x29a940){_0x1e1c68[_0x81a6('0x16')](0x194);}return _0x29a940;};}function handleError(_0x56b384,_0x2fae07){_0x2fae07=_0x2fae07||0x1f4;return function(_0x3a5373){logger['error'](_0x3a5373[_0x81a6('0x26')]);if(_0x3a5373['name']){delete _0x3a5373[_0x81a6('0x27')];}_0x56b384[_0x81a6('0x17')](_0x2fae07)[_0x81a6('0x28')](_0x3a5373);};}exports[_0x81a6('0x29')]=function(_0x1fdd3f,_0x1e3643){var _0x449558={},_0x142582={},_0x1bbc67={'count':0x0,'rows':[]};var _0xfa31d5=_[_0x81a6('0x2a')](db[_0x81a6('0x2b')]['rawAttributes'],function(_0x7361d){return{'name':_0x7361d[_0x81a6('0x2c')],'type':_0x7361d['type'][_0x81a6('0x2d')]};});_0x142582[_0x81a6('0x2e')]=_[_0x81a6('0x2a')](_0xfa31d5,_0x81a6('0x27'));_0x142582[_0x81a6('0x2f')]=_['keys'](_0x1fdd3f[_0x81a6('0x2f')]);_0x142582['filters']=_[_0x81a6('0x30')](_0x142582[_0x81a6('0x2e')],_0x142582[_0x81a6('0x2f')]);_0x449558['attributes']=_['intersection'](_0x142582[_0x81a6('0x2e')],qs[_0x81a6('0x31')](_0x1fdd3f['query'][_0x81a6('0x31')]));_0x449558[_0x81a6('0x32')]=_0x449558['attributes']['length']?_0x449558[_0x81a6('0x32')]:_0x142582[_0x81a6('0x2e')];if(!_0x1fdd3f[_0x81a6('0x2f')][_0x81a6('0x33')]('nolimit')){_0x449558[_0x81a6('0x1c')]=qs[_0x81a6('0x1c')](_0x1fdd3f['query'][_0x81a6('0x1c')]);_0x449558[_0x81a6('0x19')]=qs[_0x81a6('0x19')](_0x1fdd3f[_0x81a6('0x2f')]['offset']);}_0x449558[_0x81a6('0x34')]=qs[_0x81a6('0x35')](_0x1fdd3f['query']['sort']);_0x449558[_0x81a6('0x36')]=qs['filters'](_[_0x81a6('0x37')](_0x1fdd3f[_0x81a6('0x2f')],_0x142582[_0x81a6('0x38')]),_0xfa31d5);if(_0x1fdd3f[_0x81a6('0x2f')][_0x81a6('0x39')]){_0x449558[_0x81a6('0x36')]=_[_0x81a6('0x3a')](_0x449558[_0x81a6('0x36')],{'$or':_[_0x81a6('0x2a')](_0xfa31d5,function(_0x2fa848){if(_0x2fa848[_0x81a6('0x3b')]!==_0x81a6('0x3c')){var _0x584658={};_0x584658[_0x2fa848['name']]={'$like':'%'+_0x1fdd3f['query'][_0x81a6('0x39')]+'%'};return _0x584658;}})});}_0x449558=_['merge']({},_0x449558,_0x1fdd3f[_0x81a6('0x3d')]);var _0x913863={'where':_0x449558[_0x81a6('0x36')]};return db[_0x81a6('0x2b')][_0x81a6('0x1b')](_0x913863)[_0x81a6('0x23')](function(_0x4b4e7f){_0x1bbc67[_0x81a6('0x1b')]=_0x4b4e7f;if(_0x1fdd3f[_0x81a6('0x2f')]['includeAll']){_0x449558[_0x81a6('0x3e')]=[{'all':!![]}];}return db[_0x81a6('0x2b')][_0x81a6('0x3f')](_0x449558);})[_0x81a6('0x23')](function(_0x937802){_0x1bbc67[_0x81a6('0x40')]=_0x937802;return _0x1bbc67;})[_0x81a6('0x23')](respondWithFilteredResult(_0x1e3643,_0x449558))[_0x81a6('0x41')](handleError(_0x1e3643,null));};exports['show']=function(_0x49e489,_0x542080){var _0x4beb6f={'raw':!![],'where':{'id':_0x49e489[_0x81a6('0x42')]['id']}},_0x18e060={};_0x18e060[_0x81a6('0x2e')]=_[_0x81a6('0x43')](db[_0x81a6('0x2b')][_0x81a6('0x44')]);_0x18e060[_0x81a6('0x2f')]=_['keys'](_0x49e489[_0x81a6('0x2f')]);_0x18e060[_0x81a6('0x38')]=_['intersection'](_0x18e060[_0x81a6('0x2e')],_0x18e060[_0x81a6('0x2f')]);_0x4beb6f['attributes']=_[_0x81a6('0x30')](_0x18e060['model'],qs['fields'](_0x49e489[_0x81a6('0x2f')][_0x81a6('0x31')]));_0x4beb6f[_0x81a6('0x32')]=_0x4beb6f[_0x81a6('0x32')][_0x81a6('0x45')]?_0x4beb6f[_0x81a6('0x32')]:_0x18e060['model'];if(_0x49e489[_0x81a6('0x2f')][_0x81a6('0x46')]){_0x4beb6f[_0x81a6('0x3e')]=[{'all':!![]}];}_0x4beb6f=_[_0x81a6('0x3a')]({},_0x4beb6f,_0x49e489[_0x81a6('0x3d')]);return db[_0x81a6('0x2b')][_0x81a6('0x47')](_0x4beb6f)[_0x81a6('0x23')](handleEntityNotFound(_0x542080,null))[_0x81a6('0x23')](respondWithResult(_0x542080,null))['catch'](handleError(_0x542080,null));};exports['create']=function(_0x24f251,_0x148591){return db['SquareReport'][_0x81a6('0x48')](_0x24f251[_0x81a6('0x49')],{})[_0x81a6('0x23')](respondWithResult(_0x148591,0xc9))[_0x81a6('0x41')](handleError(_0x148591,null));};exports[_0x81a6('0x22')]=function(_0x5dbf1f,_0xd4c06e){if(_0x5dbf1f['body']['id']){delete _0x5dbf1f[_0x81a6('0x49')]['id'];}return db[_0x81a6('0x2b')]['find']({'where':{'id':_0x5dbf1f[_0x81a6('0x42')]['id']}})['then'](handleEntityNotFound(_0xd4c06e,null))[_0x81a6('0x23')](saveUpdates(_0x5dbf1f['body'],null))[_0x81a6('0x23')](respondWithResult(_0xd4c06e,null))[_0x81a6('0x41')](handleError(_0xd4c06e,null));};exports[_0x81a6('0x24')]=function(_0x401079,_0x17ee3a){return db['SquareReport']['find']({'where':{'id':_0x401079['params']['id']}})[_0x81a6('0x23')](handleEntityNotFound(_0x17ee3a,null))[_0x81a6('0x23')](removeEntity(_0x17ee3a,null))[_0x81a6('0x41')](handleError(_0x17ee3a,null));};exports['describe']=function(_0x4186a0,_0x278647){return db[_0x81a6('0x2b')][_0x81a6('0x4a')]()[_0x81a6('0x23')](respondWithResult(_0x278647,null))[_0x81a6('0x41')](handleError(_0x278647,null));}; \ No newline at end of file +var _0x78ef=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','count','limit','Content-Range','apply','reject','save','then','name','send','index','SquareReport','rawAttributes','key','model','map','query','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','type','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x78ef,0x1dd));var _0xf78e=function(_0x58e3b8,_0x2087f2){_0x58e3b8=_0x58e3b8-0x0;var _0x1634bf=_0x78ef[_0x58e3b8];return _0x1634bf;};'use strict';var emlformat=require(_0xf78e('0x0'));var rimraf=require(_0xf78e('0x1'));var zipdir=require(_0xf78e('0x2'));var jsonpatch=require(_0xf78e('0x3'));var rp=require(_0xf78e('0x4'));var moment=require(_0xf78e('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf78e('0x6'));var path=require(_0xf78e('0x7'));var sox=require(_0xf78e('0x8'));var csv=require(_0xf78e('0x9'));var ejs=require(_0xf78e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf78e('0xb'));var squel=require(_0xf78e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf78e('0xd'));var deskjs=require(_0xf78e('0xe'));var toCsv=require(_0xf78e('0x9'));var querystring=require('querystring');var Papa=require(_0xf78e('0xf'));var Redis=require(_0xf78e('0x10'));var authService=require(_0xf78e('0x11'));var qs=require(_0xf78e('0x12'));var as=require(_0xf78e('0x13'));var hardwareService=require(_0xf78e('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xf78e('0x15'));var config=require(_0xf78e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf78e('0x17'))['db'];function respondWithStatusCode(_0x33a334,_0xf1b245){_0xf1b245=_0xf1b245||0xcc;return function(_0x4a0bae){if(_0x4a0bae){return _0x33a334[_0xf78e('0x18')](_0xf1b245);}return _0x33a334[_0xf78e('0x19')](_0xf1b245)[_0xf78e('0x1a')]();};}function respondWithResult(_0x2ffb0d,_0x2bde17){_0x2bde17=_0x2bde17||0xc8;return function(_0x599fca){if(_0x599fca){return _0x2ffb0d[_0xf78e('0x19')](_0x2bde17)[_0xf78e('0x1b')](_0x599fca);}};}function respondWithFilteredResult(_0x327d9a,_0x18ea01){return function(_0xeabf9d){if(_0xeabf9d){var _0x47c206=typeof _0x18ea01[_0xf78e('0x1c')]==='undefined'&&typeof _0x18ea01['limit']==='undefined';var _0x3906bd=_0xeabf9d[_0xf78e('0x1d')];var _0x81fc6=_0x47c206?0x0:_0x18ea01['offset'];var _0x335aff=_0x47c206?_0xeabf9d[_0xf78e('0x1d')]:_0x18ea01[_0xf78e('0x1c')]+_0x18ea01[_0xf78e('0x1e')];var _0x13f4fb;if(_0x335aff>=_0x3906bd){_0x335aff=_0x3906bd;_0x13f4fb=0xc8;}else{_0x13f4fb=0xce;}_0x327d9a[_0xf78e('0x19')](_0x13f4fb);return _0x327d9a['set'](_0xf78e('0x1f'),_0x81fc6+'-'+_0x335aff+'/'+_0x3906bd)[_0xf78e('0x1b')](_0xeabf9d);}return null;};}function patchUpdates(_0x121984){return function(_0x6bcb99){try{jsonpatch[_0xf78e('0x20')](_0x6bcb99,_0x121984,!![]);}catch(_0x1c2d57){return BPromise[_0xf78e('0x21')](_0x1c2d57);}return _0x6bcb99[_0xf78e('0x22')]();};}function saveUpdates(_0x4d051e,_0x4f81af){return function(_0x364921){if(_0x364921){return _0x364921['update'](_0x4d051e)[_0xf78e('0x23')](function(_0x4133c4){return _0x4133c4;});}return null;};}function removeEntity(_0x1c0c42,_0x37d4e9){return function(_0x497d4e){if(_0x497d4e){return _0x497d4e['destroy']()[_0xf78e('0x23')](function(){_0x1c0c42[_0xf78e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bf71e,_0x1386b3){return function(_0x4e9ec7){if(!_0x4e9ec7){_0x5bf71e['sendStatus'](0x194);}return _0x4e9ec7;};}function handleError(_0xcfb8f0,_0x27542f){_0x27542f=_0x27542f||0x1f4;return function(_0x28cbb0){logger['error'](_0x28cbb0['stack']);if(_0x28cbb0[_0xf78e('0x24')]){delete _0x28cbb0['name'];}_0xcfb8f0['status'](_0x27542f)[_0xf78e('0x25')](_0x28cbb0);};}exports[_0xf78e('0x26')]=function(_0x387d21,_0x5c069f){var _0x52d15a={},_0x457fae={},_0x2f7884={'count':0x0,'rows':[]};var _0x5edd47=_['map'](db[_0xf78e('0x27')][_0xf78e('0x28')],function(_0xf02769){return{'name':_0xf02769['fieldName'],'type':_0xf02769['type'][_0xf78e('0x29')]};});_0x457fae[_0xf78e('0x2a')]=_[_0xf78e('0x2b')](_0x5edd47,_0xf78e('0x24'));_0x457fae['query']=_['keys'](_0x387d21[_0xf78e('0x2c')]);_0x457fae['filters']=_[_0xf78e('0x2d')](_0x457fae['model'],_0x457fae[_0xf78e('0x2c')]);_0x52d15a[_0xf78e('0x2e')]=_['intersection'](_0x457fae['model'],qs[_0xf78e('0x2f')](_0x387d21['query'][_0xf78e('0x2f')]));_0x52d15a[_0xf78e('0x2e')]=_0x52d15a[_0xf78e('0x2e')][_0xf78e('0x30')]?_0x52d15a[_0xf78e('0x2e')]:_0x457fae[_0xf78e('0x2a')];if(!_0x387d21[_0xf78e('0x2c')]['hasOwnProperty'](_0xf78e('0x31'))){_0x52d15a[_0xf78e('0x1e')]=qs[_0xf78e('0x1e')](_0x387d21[_0xf78e('0x2c')][_0xf78e('0x1e')]);_0x52d15a['offset']=qs['offset'](_0x387d21['query'][_0xf78e('0x1c')]);}_0x52d15a['order']=qs[_0xf78e('0x32')](_0x387d21[_0xf78e('0x2c')][_0xf78e('0x32')]);_0x52d15a[_0xf78e('0x33')]=qs[_0xf78e('0x34')](_[_0xf78e('0x35')](_0x387d21[_0xf78e('0x2c')],_0x457fae['filters']),_0x5edd47);if(_0x387d21[_0xf78e('0x2c')][_0xf78e('0x36')]){_0x52d15a[_0xf78e('0x33')]=_['merge'](_0x52d15a[_0xf78e('0x33')],{'$or':_[_0xf78e('0x2b')](_0x5edd47,function(_0x3086d5){if(_0x3086d5[_0xf78e('0x37')]!==_0xf78e('0x38')){var _0xd12dbb={};_0xd12dbb[_0x3086d5[_0xf78e('0x24')]]={'$like':'%'+_0x387d21[_0xf78e('0x2c')]['filter']+'%'};return _0xd12dbb;}})});}_0x52d15a=_['merge']({},_0x52d15a,_0x387d21[_0xf78e('0x39')]);var _0x64f6c1={'where':_0x52d15a[_0xf78e('0x33')]};return db[_0xf78e('0x27')]['count'](_0x64f6c1)[_0xf78e('0x23')](function(_0x54e24e){_0x2f7884[_0xf78e('0x1d')]=_0x54e24e;if(_0x387d21[_0xf78e('0x2c')][_0xf78e('0x3a')]){_0x52d15a['include']=[{'all':!![]}];}return db[_0xf78e('0x27')][_0xf78e('0x3b')](_0x52d15a);})[_0xf78e('0x23')](function(_0x1d4195){_0x2f7884['rows']=_0x1d4195;return _0x2f7884;})[_0xf78e('0x23')](respondWithFilteredResult(_0x5c069f,_0x52d15a))[_0xf78e('0x3c')](handleError(_0x5c069f,null));};exports[_0xf78e('0x3d')]=function(_0x5419bf,_0x3bf444){var _0x4c4821={'raw':!![],'where':{'id':_0x5419bf[_0xf78e('0x3e')]['id']}},_0x7e4f0f={};_0x7e4f0f[_0xf78e('0x2a')]=_[_0xf78e('0x3f')](db['SquareReport'][_0xf78e('0x28')]);_0x7e4f0f[_0xf78e('0x2c')]=_[_0xf78e('0x3f')](_0x5419bf[_0xf78e('0x2c')]);_0x7e4f0f[_0xf78e('0x34')]=_[_0xf78e('0x2d')](_0x7e4f0f[_0xf78e('0x2a')],_0x7e4f0f['query']);_0x4c4821[_0xf78e('0x2e')]=_['intersection'](_0x7e4f0f[_0xf78e('0x2a')],qs[_0xf78e('0x2f')](_0x5419bf[_0xf78e('0x2c')][_0xf78e('0x2f')]));_0x4c4821[_0xf78e('0x2e')]=_0x4c4821[_0xf78e('0x2e')][_0xf78e('0x30')]?_0x4c4821[_0xf78e('0x2e')]:_0x7e4f0f['model'];if(_0x5419bf[_0xf78e('0x2c')]['includeAll']){_0x4c4821[_0xf78e('0x40')]=[{'all':!![]}];}_0x4c4821=_['merge']({},_0x4c4821,_0x5419bf[_0xf78e('0x39')]);return db[_0xf78e('0x27')][_0xf78e('0x41')](_0x4c4821)['then'](handleEntityNotFound(_0x3bf444,null))[_0xf78e('0x23')](respondWithResult(_0x3bf444,null))[_0xf78e('0x3c')](handleError(_0x3bf444,null));};exports[_0xf78e('0x42')]=function(_0x30d1a3,_0x103af7){return db[_0xf78e('0x27')]['create'](_0x30d1a3[_0xf78e('0x43')],{})[_0xf78e('0x23')](respondWithResult(_0x103af7,0xc9))['catch'](handleError(_0x103af7,null));};exports[_0xf78e('0x44')]=function(_0x3cae15,_0x2fd290){if(_0x3cae15[_0xf78e('0x43')]['id']){delete _0x3cae15[_0xf78e('0x43')]['id'];}return db['SquareReport'][_0xf78e('0x41')]({'where':{'id':_0x3cae15[_0xf78e('0x3e')]['id']}})[_0xf78e('0x23')](handleEntityNotFound(_0x2fd290,null))['then'](saveUpdates(_0x3cae15[_0xf78e('0x43')],null))[_0xf78e('0x23')](respondWithResult(_0x2fd290,null))[_0xf78e('0x3c')](handleError(_0x2fd290,null));};exports['destroy']=function(_0x271dba,_0x37f839){return db[_0xf78e('0x27')][_0xf78e('0x41')]({'where':{'id':_0x271dba[_0xf78e('0x3e')]['id']}})[_0xf78e('0x23')](handleEntityNotFound(_0x37f839,null))[_0xf78e('0x23')](removeEntity(_0x37f839,null))[_0xf78e('0x3c')](handleError(_0x37f839,null));};exports[_0xf78e('0x45')]=function(_0x4e2e30,_0xc630e9){return db[_0xf78e('0x27')][_0xf78e('0x45')]()['then'](respondWithResult(_0xc630e9,null))[_0xf78e('0x3c')](handleError(_0xc630e9,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index b40ea61..d1bb6b2 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 _0x90cb=['leaveAt','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./squareReport.attributes','report_square','uniqueid'];(function(_0x52741f,_0x310235){var _0x5b6ca2=function(_0x27e53b){while(--_0x27e53b){_0x52741f['push'](_0x52741f['shift']());}};_0x5b6ca2(++_0x310235);}(_0x90cb,0x90));var _0xb90c=function(_0x585f40,_0x4a3091){_0x585f40=_0x585f40-0x0;var _0x44fc86=_0x90cb[_0x585f40];return _0x44fc86;};'use strict';var _=require('lodash');var util=require(_0xb90c('0x0'));var logger=require(_0xb90c('0x1'))(_0xb90c('0x2'));var moment=require(_0xb90c('0x3'));var BPromise=require('bluebird');var rp=require(_0xb90c('0x4'));var fs=require('fs');var path=require(_0xb90c('0x5'));var rimraf=require('rimraf');var config=require(_0xb90c('0x6'));var attributes=require(_0xb90c('0x7'));module['exports']=function(_0x1e8bb1,_0x542dba){return _0x1e8bb1['define']('SquareReport',attributes,{'tableName':_0xb90c('0x8'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xb90c('0x9'),'project_name']},{'name':'leaveAt','fields':[_0xb90c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf4e5=['exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes'];(function(_0x466adf,_0xb2bcc5){var _0x59f41d=function(_0x116621){while(--_0x116621){_0x466adf['push'](_0x466adf['shift']());}};_0x59f41d(++_0xb2bcc5);}(_0xf4e5,0xd9));var _0x5f4e=function(_0x3dc774,_0x56d3cd){_0x3dc774=_0x3dc774-0x0;var _0x202129=_0xf4e5[_0x3dc774];return _0x202129;};'use strict';var _=require(_0x5f4e('0x0'));var util=require(_0x5f4e('0x1'));var logger=require(_0x5f4e('0x2'))(_0x5f4e('0x3'));var moment=require(_0x5f4e('0x4'));var BPromise=require(_0x5f4e('0x5'));var rp=require(_0x5f4e('0x6'));var fs=require('fs');var path=require(_0x5f4e('0x7'));var rimraf=require(_0x5f4e('0x8'));var config=require(_0x5f4e('0x9'));var attributes=require(_0x5f4e('0xa'));module[_0x5f4e('0xb')]=function(_0x63e74f,_0x2749ab){return _0x63e74f[_0x5f4e('0xc')](_0x5f4e('0xd'),attributes,{'tableName':_0x5f4e('0xe'),'paranoid':![],'indexes':[{'name':_0x5f4e('0xf'),'fields':[_0x5f4e('0x10'),_0x5f4e('0x11')]},{'name':_0x5f4e('0x12'),'fields':[_0x5f4e('0x12')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 292d2e7..214c3ee 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 _0x166e=['stringify','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update','where','limit'];(function(_0x3fdcf6,_0x2fc65c){var _0x6348fd=function(_0x107b40){while(--_0x107b40){_0x3fdcf6['push'](_0x3fdcf6['shift']());}};_0x6348fd(++_0x2fc65c);}(_0x166e,0xa1));var _0xe166=function(_0x13559e,_0x5d1c82){_0x13559e=_0x13559e-0x0;var _0xbb0cf5=_0x166e[_0x13559e];return _0xbb0cf5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe166('0x0'));var BPromise=require('bluebird');var rs=require(_0xe166('0x1'));var fs=require('fs');var Redis=require(_0xe166('0x2'));var db=require(_0xe166('0x3'))['db'];var utils=require(_0xe166('0x4'));var logger=require(_0xe166('0x5'))(_0xe166('0x6'));var config=require(_0xe166('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe166('0x8')][_0xe166('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11c88f,_0x3e39bb,_0x15d1c6){return new BPromise(function(_0x5be71c,_0x1b27d1){return client[_0xe166('0xa')](_0x11c88f,_0x15d1c6)[_0xe166('0xb')](function(_0x3f92e2){logger[_0xe166('0xc')](_0xe166('0xd'),_0x3e39bb,_0xe166('0xe'));logger[_0xe166('0xf')](_0xe166('0x10'),_0x3e39bb,'request\x20sent',JSON['stringify'](_0x3f92e2));if(_0x3f92e2[_0xe166('0x11')]){if(_0x3f92e2[_0xe166('0x11')]['code']===0x1f4){logger[_0xe166('0x11')](_0xe166('0xd'),_0x3e39bb,_0x3f92e2['error'][_0xe166('0x12')]);return _0x1b27d1(_0x3f92e2[_0xe166('0x11')]['message']);}logger[_0xe166('0x11')](_0xe166('0xd'),_0x3e39bb,_0x3f92e2[_0xe166('0x11')][_0xe166('0x12')]);return _0x5be71c(_0x3f92e2[_0xe166('0x11')][_0xe166('0x12')]);}else{logger[_0xe166('0xc')]('SquareReport,\x20%s,\x20%s',_0x3e39bb,_0xe166('0xe'));_0x5be71c(_0x3f92e2[_0xe166('0x13')]['message']);}})[_0xe166('0x14')](function(_0x9ef99){logger['error'](_0xe166('0xd'),_0x3e39bb,_0x9ef99);_0x1b27d1(_0x9ef99);});});}exports[_0xe166('0x15')]=function(_0x8327a4){var _0x25283d=this;return new Promise(function(_0x3e51bd,_0x2d9bf5){return db[_0xe166('0x16')][_0xe166('0x17')](_0x8327a4[_0xe166('0x18')],{'raw':_0x8327a4[_0xe166('0x19')]?_0x8327a4[_0xe166('0x19')][_0xe166('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5e37e2){logger[_0xe166('0xc')](_0xe166('0x15'),_0x8327a4);logger[_0xe166('0xf')](_0xe166('0x15'),_0x8327a4,JSON['stringify'](_0x5e37e2));_0x3e51bd(_0x5e37e2);})[_0xe166('0x14')](function(_0x4b6e4b){logger[_0xe166('0x11')](_0xe166('0x15'),_0x4b6e4b[_0xe166('0x12')],_0x8327a4);_0x2d9bf5(_0x25283d['error'](0x1f4,_0x4b6e4b['message']));});});};exports[_0xe166('0x1b')]=function(_0x491811){var _0x4e5127=this;return new Promise(function(_0x20e980,_0x1e1228){return db[_0xe166('0x16')][_0xe166('0x1c')](_0x491811[_0xe166('0x18')],{'raw':_0x491811[_0xe166('0x19')]?_0x491811[_0xe166('0x19')][_0xe166('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x491811['options']?_0x491811[_0xe166('0x19')][_0xe166('0x1d')]||null:null,'attributes':_0x491811[_0xe166('0x19')]?_0x491811[_0xe166('0x19')]['attributes']||null:null,'limit':_0x491811['options']?_0x491811[_0xe166('0x19')][_0xe166('0x1e')]||null:null})[_0xe166('0xb')](function(_0x57efb4){logger['info'](_0xe166('0x1b'),_0x491811);logger['debug'](_0xe166('0x1b'),_0x491811,JSON[_0xe166('0x1f')](_0x57efb4));_0x20e980(_0x57efb4);})[_0xe166('0x14')](function(_0xc480de){logger[_0xe166('0x11')](_0xe166('0x1b'),_0xc480de[_0xe166('0x12')],_0x491811);_0x1e1228(_0x4e5127[_0xe166('0x11')](0x1f4,_0xc480de['message']));});});}; \ No newline at end of file +var _0x60a7=['stringify','update','where','attributes','limit','UpdateSquareReport','lodash','util','ioredis','../../config/logger','client','debug','request\x20sent','error','code','SquareReport,\x20%s,\x20%s','message','info','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','then'];(function(_0xd15f49,_0x29fa75){var _0x3f1224=function(_0x23fc56){while(--_0x23fc56){_0xd15f49['push'](_0xd15f49['shift']());}};_0x3f1224(++_0x29fa75);}(_0x60a7,0x180));var _0x760a=function(_0x2b8c90,_0x5b0981){_0x2b8c90=_0x2b8c90-0x0;var _0x1c0d08=_0x60a7[_0x2b8c90];return _0x1c0d08;};'use strict';var _=require(_0x760a('0x0'));var util=require(_0x760a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x760a('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x760a('0x3'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x760a('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f2691,_0x58e173,_0x5362bf){return new BPromise(function(_0x33bb7d,_0x32282d){return client['request'](_0x4f2691,_0x5362bf)['then'](function(_0x5cdea2){logger['info']('SquareReport,\x20%s,\x20%s',_0x58e173,'request\x20sent');logger[_0x760a('0x5')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x58e173,_0x760a('0x6'),JSON['stringify'](_0x5cdea2));if(_0x5cdea2['error']){if(_0x5cdea2[_0x760a('0x7')][_0x760a('0x8')]===0x1f4){logger[_0x760a('0x7')](_0x760a('0x9'),_0x58e173,_0x5cdea2[_0x760a('0x7')][_0x760a('0xa')]);return _0x32282d(_0x5cdea2['error']['message']);}logger[_0x760a('0x7')](_0x760a('0x9'),_0x58e173,_0x5cdea2[_0x760a('0x7')][_0x760a('0xa')]);return _0x33bb7d(_0x5cdea2[_0x760a('0x7')]['message']);}else{logger[_0x760a('0xb')](_0x760a('0x9'),_0x58e173,_0x760a('0x6'));_0x33bb7d(_0x5cdea2[_0x760a('0xc')][_0x760a('0xa')]);}})[_0x760a('0xd')](function(_0x956d9d){logger[_0x760a('0x7')](_0x760a('0x9'),_0x58e173,_0x956d9d);_0x32282d(_0x956d9d);});});}exports[_0x760a('0xe')]=function(_0x5ed221){var _0x5b4125=this;return new Promise(function(_0x3501dd,_0x340925){return db[_0x760a('0xf')][_0x760a('0x10')](_0x5ed221[_0x760a('0x11')],{'raw':_0x5ed221[_0x760a('0x12')]?_0x5ed221['options'][_0x760a('0x13')]===undefined?!![]:![]:!![]})[_0x760a('0x14')](function(_0x4f975c){logger[_0x760a('0xb')](_0x760a('0xe'),_0x5ed221);logger[_0x760a('0x5')](_0x760a('0xe'),_0x5ed221,JSON[_0x760a('0x15')](_0x4f975c));_0x3501dd(_0x4f975c);})[_0x760a('0xd')](function(_0x7848a8){logger[_0x760a('0x7')](_0x760a('0xe'),_0x7848a8[_0x760a('0xa')],_0x5ed221);_0x340925(_0x5b4125[_0x760a('0x7')](0x1f4,_0x7848a8[_0x760a('0xa')]));});});};exports['UpdateSquareReport']=function(_0x1ba4f8){var _0x4ef4bd=this;return new Promise(function(_0x4d5c18,_0x14eac3){return db[_0x760a('0xf')][_0x760a('0x16')](_0x1ba4f8[_0x760a('0x11')],{'raw':_0x1ba4f8[_0x760a('0x12')]?_0x1ba4f8['options'][_0x760a('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ba4f8[_0x760a('0x12')]?_0x1ba4f8[_0x760a('0x12')][_0x760a('0x17')]||null:null,'attributes':_0x1ba4f8[_0x760a('0x12')]?_0x1ba4f8['options'][_0x760a('0x18')]||null:null,'limit':_0x1ba4f8[_0x760a('0x12')]?_0x1ba4f8[_0x760a('0x12')][_0x760a('0x19')]||null:null})[_0x760a('0x14')](function(_0xce146d){logger[_0x760a('0xb')](_0x760a('0x1a'),_0x1ba4f8);logger[_0x760a('0x5')](_0x760a('0x1a'),_0x1ba4f8,JSON[_0x760a('0x15')](_0xce146d));_0x4d5c18(_0xce146d);})[_0x760a('0xd')](function(_0x51ee7f){logger[_0x760a('0x7')](_0x760a('0x1a'),_0x51ee7f[_0x760a('0xa')],_0x1ba4f8);_0x14eac3(_0x4ef4bd[_0x760a('0x7')](0x1f4,_0x51ee7f[_0x760a('0xa')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 9084a03..cda23ad 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 _0xa0a4=['put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','isAuthenticated','index','get','describe','/:id','post','create'];(function(_0x9388c8,_0x2cdf84){var _0x6f1d3a=function(_0x6a3073){while(--_0x6a3073){_0x9388c8['push'](_0x9388c8['shift']());}};_0x6f1d3a(++_0x2cdf84);}(_0xa0a4,0x16d));var _0x4a0a=function(_0x139c59,_0x20c0d4){_0x139c59=_0x139c59-0x0;var _0x409ad4=_0xa0a4[_0x139c59];return _0x409ad4;};'use strict';var multer=require('multer');var util=require(_0x4a0a('0x0'));var path=require(_0x4a0a('0x1'));var timeout=require(_0x4a0a('0x2'));var express=require(_0x4a0a('0x3'));var router=express[_0x4a0a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4a0a('0x5'));var interaction=require(_0x4a0a('0x6'));var config=require('../../config/environment');var controller=require(_0x4a0a('0x7'));router['get']('/',auth[_0x4a0a('0x8')](),controller[_0x4a0a('0x9')]);router[_0x4a0a('0xa')]('/describe',auth[_0x4a0a('0x8')](),controller[_0x4a0a('0xb')]);router[_0x4a0a('0xa')](_0x4a0a('0xc'),auth[_0x4a0a('0x8')](),controller['show']);router[_0x4a0a('0xd')]('/',auth['isAuthenticated'](),controller[_0x4a0a('0xe')]);router[_0x4a0a('0xf')]('/:id',auth[_0x4a0a('0x8')](),controller['update']);router[_0x4a0a('0x10')](_0x4a0a('0xc'),auth[_0x4a0a('0x8')](),controller[_0x4a0a('0x11')]);module[_0x4a0a('0x12')]=router; \ No newline at end of file +var _0x26ca=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1a49c7,_0x2ab443){var _0x3f5f00=function(_0x5503b7){while(--_0x5503b7){_0x1a49c7['push'](_0x1a49c7['shift']());}};_0x3f5f00(++_0x2ab443);}(_0x26ca,0x94));var _0xa26c=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x26ca[_0x4ae6ef];return _0x3cbb4e;};'use strict';var multer=require(_0xa26c('0x0'));var util=require(_0xa26c('0x1'));var path=require(_0xa26c('0x2'));var timeout=require(_0xa26c('0x3'));var express=require(_0xa26c('0x4'));var router=express[_0xa26c('0x5')]();var fs_extra=require(_0xa26c('0x6'));var auth=require(_0xa26c('0x7'));var interaction=require(_0xa26c('0x8'));var config=require(_0xa26c('0x9'));var controller=require(_0xa26c('0xa'));router[_0xa26c('0xb')]('/',auth[_0xa26c('0xc')](),controller[_0xa26c('0xd')]);router['get'](_0xa26c('0xe'),auth[_0xa26c('0xc')](),controller[_0xa26c('0xf')]);router[_0xa26c('0xb')](_0xa26c('0x10'),auth[_0xa26c('0xc')](),controller[_0xa26c('0x11')]);router[_0xa26c('0x12')]('/',auth[_0xa26c('0xc')](),controller['create']);router['put'](_0xa26c('0x10'),auth[_0xa26c('0xc')](),controller[_0xa26c('0x13')]);router['delete'](_0xa26c('0x10'),auth[_0xa26c('0xc')](),controller[_0xa26c('0x14')]);module[_0xa26c('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 7874ef4..67744a5 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 _0xd237=['STRING','TEXT','sequelize','exports'];(function(_0x220799,_0x4ee5e7){var _0x186464=function(_0x85d965){while(--_0x85d965){_0x220799['push'](_0x220799['shift']());}};_0x186464(++_0x4ee5e7);}(_0xd237,0x136));var _0x7d23=function(_0x32aac9,_0x5eb63d){_0x32aac9=_0x32aac9-0x0;var _0x51bafd=_0xd237[_0x32aac9];return _0x51bafd;};'use strict';var Sequelize=require(_0x7d23('0x0'));module[_0x7d23('0x1')]={'uniqueid':{'type':Sequelize[_0x7d23('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x7d23('0x2')]},'data':{'type':Sequelize[_0x7d23('0x3')]},'project_name':{'type':Sequelize[_0x7d23('0x2')]},'callerid':{'type':Sequelize[_0x7d23('0x2')]}}; \ No newline at end of file +var _0x870d=['sequelize','exports','STRING','TEXT'];(function(_0x166a35,_0x4b575a){var _0x13a866=function(_0x1528a4){while(--_0x1528a4){_0x166a35['push'](_0x166a35['shift']());}};_0x13a866(++_0x4b575a);}(_0x870d,0x124));var _0xd870=function(_0x19802f,_0x5d1d7c){_0x19802f=_0x19802f-0x0;var _0xc5176f=_0x870d[_0x19802f];return _0xc5176f;};'use strict';var Sequelize=require(_0xd870('0x0'));module[_0xd870('0x1')]={'uniqueid':{'type':Sequelize[_0xd870('0x2')]},'node':{'type':Sequelize[_0xd870('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xd870('0x3')]},'project_name':{'type':Sequelize['STRING']},'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 9907708..a143cfb 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 _0xd574=['ioredis','../../components/auth/service','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','then','error','name','send','index','map','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','filters','pick','filter','merge','VIRTUAL','options','SquareDetailsReport','rows','catch','keys','includeAll','include','create','body','update','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0xd574,0xfb));var _0x4d57=function(_0x12ca88,_0x4ec784){_0x12ca88=_0x12ca88-0x0;var _0x1da849=_0xd574[_0x12ca88];return _0x1da849;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4d57('0x0'));var zipdir=require(_0x4d57('0x1'));var jsonpatch=require(_0x4d57('0x2'));var rp=require(_0x4d57('0x3'));var moment=require('moment');var BPromise=require(_0x4d57('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4d57('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4d57('0x6'));var _=require('lodash');var squel=require(_0x4d57('0x7'));var crypto=require(_0x4d57('0x8'));var jsforce=require(_0x4d57('0x9'));var deskjs=require(_0x4d57('0xa'));var toCsv=require(_0x4d57('0xb'));var querystring=require('querystring');var Papa=require(_0x4d57('0xc'));var Redis=require(_0x4d57('0xd'));var authService=require(_0x4d57('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4d57('0xf'))(_0x4d57('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4d57('0x11'));var db=require(_0x4d57('0x12'))['db'];function respondWithStatusCode(_0x5b0a37,_0x391278){_0x391278=_0x391278||0xcc;return function(_0xc4958c){if(_0xc4958c){return _0x5b0a37[_0x4d57('0x13')](_0x391278);}return _0x5b0a37[_0x4d57('0x14')](_0x391278)[_0x4d57('0x15')]();};}function respondWithResult(_0x536b09,_0x3cdbb4){_0x3cdbb4=_0x3cdbb4||0xc8;return function(_0x510fbb){if(_0x510fbb){return _0x536b09[_0x4d57('0x14')](_0x3cdbb4)[_0x4d57('0x16')](_0x510fbb);}};}function respondWithFilteredResult(_0x1cd5f5,_0x41482d){return function(_0xd46a6d){if(_0xd46a6d){var _0x313eb3=typeof _0x41482d[_0x4d57('0x17')]===_0x4d57('0x18')&&typeof _0x41482d[_0x4d57('0x19')]===_0x4d57('0x18');var _0x1e1f90=_0xd46a6d['count'];var _0x83781d=_0x313eb3?0x0:_0x41482d[_0x4d57('0x17')];var _0x333562=_0x313eb3?_0xd46a6d['count']:_0x41482d['offset']+_0x41482d['limit'];var _0x45eba0;if(_0x333562>=_0x1e1f90){_0x333562=_0x1e1f90;_0x45eba0=0xc8;}else{_0x45eba0=0xce;}_0x1cd5f5[_0x4d57('0x14')](_0x45eba0);return _0x1cd5f5[_0x4d57('0x1a')](_0x4d57('0x1b'),_0x83781d+'-'+_0x333562+'/'+_0x1e1f90)[_0x4d57('0x16')](_0xd46a6d);}return null;};}function patchUpdates(_0x50a8bd){return function(_0x178e79){try{jsonpatch[_0x4d57('0x1c')](_0x178e79,_0x50a8bd,!![]);}catch(_0x5aaee8){return BPromise['reject'](_0x5aaee8);}return _0x178e79[_0x4d57('0x1d')]();};}function saveUpdates(_0x333849,_0x3213b8){return function(_0x390687){if(_0x390687){return _0x390687['update'](_0x333849)[_0x4d57('0x1e')](function(_0x5d8a26){return _0x5d8a26;});}return null;};}function removeEntity(_0x5c84b0,_0x516d27){return function(_0x88f6ce){if(_0x88f6ce){return _0x88f6ce['destroy']()[_0x4d57('0x1e')](function(){_0x5c84b0[_0x4d57('0x14')](0xcc)[_0x4d57('0x15')]();});}};}function handleEntityNotFound(_0x9c5bf8,_0x1afd84){return function(_0x595990){if(!_0x595990){_0x9c5bf8[_0x4d57('0x13')](0x194);}return _0x595990;};}function handleError(_0x14d978,_0x5adab5){_0x5adab5=_0x5adab5||0x1f4;return function(_0x467224){logger[_0x4d57('0x1f')](_0x467224['stack']);if(_0x467224['name']){delete _0x467224[_0x4d57('0x20')];}_0x14d978[_0x4d57('0x14')](_0x5adab5)[_0x4d57('0x21')](_0x467224);};}exports[_0x4d57('0x22')]=function(_0x176c19,_0x5adf2d){var _0x1e5414={},_0x52302b={},_0x5f3ab7={'count':0x0,'rows':[]};var _0x5ec24b=_[_0x4d57('0x23')](db['SquareDetailsReport']['rawAttributes'],function(_0x32b8ed){return{'name':_0x32b8ed[_0x4d57('0x24')],'type':_0x32b8ed[_0x4d57('0x25')][_0x4d57('0x26')]};});_0x52302b['model']=_[_0x4d57('0x23')](_0x5ec24b,_0x4d57('0x20'));_0x52302b[_0x4d57('0x27')]=_['keys'](_0x176c19['query']);_0x52302b['filters']=_[_0x4d57('0x28')](_0x52302b[_0x4d57('0x29')],_0x52302b[_0x4d57('0x27')]);_0x1e5414['attributes']=_[_0x4d57('0x28')](_0x52302b[_0x4d57('0x29')],qs[_0x4d57('0x2a')](_0x176c19[_0x4d57('0x27')]['fields']));_0x1e5414['attributes']=_0x1e5414[_0x4d57('0x2b')][_0x4d57('0x2c')]?_0x1e5414['attributes']:_0x52302b['model'];if(!_0x176c19[_0x4d57('0x27')][_0x4d57('0x2d')](_0x4d57('0x2e'))){_0x1e5414[_0x4d57('0x19')]=qs[_0x4d57('0x19')](_0x176c19[_0x4d57('0x27')][_0x4d57('0x19')]);_0x1e5414[_0x4d57('0x17')]=qs[_0x4d57('0x17')](_0x176c19[_0x4d57('0x27')][_0x4d57('0x17')]);}_0x1e5414[_0x4d57('0x2f')]=qs['sort'](_0x176c19[_0x4d57('0x27')]['sort']);_0x1e5414['where']=qs[_0x4d57('0x30')](_[_0x4d57('0x31')](_0x176c19[_0x4d57('0x27')],_0x52302b[_0x4d57('0x30')]),_0x5ec24b);if(_0x176c19[_0x4d57('0x27')][_0x4d57('0x32')]){_0x1e5414['where']=_[_0x4d57('0x33')](_0x1e5414['where'],{'$or':_['map'](_0x5ec24b,function(_0x54c0c5){if(_0x54c0c5['type']!==_0x4d57('0x34')){var _0x419b7a={};_0x419b7a[_0x54c0c5[_0x4d57('0x20')]]={'$like':'%'+_0x176c19[_0x4d57('0x27')]['filter']+'%'};return _0x419b7a;}})});}_0x1e5414=_[_0x4d57('0x33')]({},_0x1e5414,_0x176c19[_0x4d57('0x35')]);var _0x64e3c6={'where':_0x1e5414['where']};return db['SquareDetailsReport']['count'](_0x64e3c6)[_0x4d57('0x1e')](function(_0x538647){_0x5f3ab7['count']=_0x538647;if(_0x176c19['query']['includeAll']){_0x1e5414['include']=[{'all':!![]}];}return db[_0x4d57('0x36')]['findAll'](_0x1e5414);})[_0x4d57('0x1e')](function(_0x24be5d){_0x5f3ab7[_0x4d57('0x37')]=_0x24be5d;return _0x5f3ab7;})[_0x4d57('0x1e')](respondWithFilteredResult(_0x5adf2d,_0x1e5414))[_0x4d57('0x38')](handleError(_0x5adf2d,null));};exports['show']=function(_0x1a617e,_0x6502ba){var _0x923e19={'raw':!![],'where':{'id':_0x1a617e['params']['id']}},_0x4f0522={};_0x4f0522[_0x4d57('0x29')]=_[_0x4d57('0x39')](db[_0x4d57('0x36')]['rawAttributes']);_0x4f0522['query']=_[_0x4d57('0x39')](_0x1a617e[_0x4d57('0x27')]);_0x4f0522['filters']=_[_0x4d57('0x28')](_0x4f0522[_0x4d57('0x29')],_0x4f0522[_0x4d57('0x27')]);_0x923e19['attributes']=_[_0x4d57('0x28')](_0x4f0522[_0x4d57('0x29')],qs[_0x4d57('0x2a')](_0x1a617e[_0x4d57('0x27')][_0x4d57('0x2a')]));_0x923e19[_0x4d57('0x2b')]=_0x923e19['attributes']['length']?_0x923e19['attributes']:_0x4f0522['model'];if(_0x1a617e['query'][_0x4d57('0x3a')]){_0x923e19[_0x4d57('0x3b')]=[{'all':!![]}];}_0x923e19=_['merge']({},_0x923e19,_0x1a617e['options']);return db[_0x4d57('0x36')]['find'](_0x923e19)[_0x4d57('0x1e')](handleEntityNotFound(_0x6502ba,null))['then'](respondWithResult(_0x6502ba,null))[_0x4d57('0x38')](handleError(_0x6502ba,null));};exports['create']=function(_0xeb9422,_0x2dc968){return db[_0x4d57('0x36')][_0x4d57('0x3c')](_0xeb9422[_0x4d57('0x3d')],{})[_0x4d57('0x1e')](respondWithResult(_0x2dc968,0xc9))[_0x4d57('0x38')](handleError(_0x2dc968,null));};exports[_0x4d57('0x3e')]=function(_0x7c009d,_0x4a74c0){if(_0x7c009d['body']['id']){delete _0x7c009d[_0x4d57('0x3d')]['id'];}return db[_0x4d57('0x36')][_0x4d57('0x3f')]({'where':{'id':_0x7c009d[_0x4d57('0x40')]['id']}})[_0x4d57('0x1e')](handleEntityNotFound(_0x4a74c0,null))['then'](saveUpdates(_0x7c009d[_0x4d57('0x3d')],null))['then'](respondWithResult(_0x4a74c0,null))[_0x4d57('0x38')](handleError(_0x4a74c0,null));};exports['destroy']=function(_0x28935f,_0x53431e){return db[_0x4d57('0x36')]['find']({'where':{'id':_0x28935f['params']['id']}})[_0x4d57('0x1e')](handleEntityNotFound(_0x53431e,null))['then'](removeEntity(_0x53431e,null))['catch'](handleError(_0x53431e,null));};exports[_0x4d57('0x41')]=function(_0xc0c724,_0x4abfad){return db['SquareDetailsReport'][_0x4d57('0x41')]()[_0x4d57('0x1e')](respondWithResult(_0x4abfad,null))[_0x4d57('0x38')](handleError(_0x4abfad,null));}; \ No newline at end of file +var _0x3da7=['describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','SquareDetailsReport','rawAttributes','fieldName','type','key','map','query','keys','intersection','attributes','model','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','params'];(function(_0x4ad543,_0x33bf13){var _0xee5496=function(_0x35bd13){while(--_0x35bd13){_0x4ad543['push'](_0x4ad543['shift']());}};_0xee5496(++_0x33bf13);}(_0x3da7,0xe2));var _0x73da=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0x3da7[_0x504df1];return _0x1063b5;};'use strict';var emlformat=require(_0x73da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x73da('0x1'));var jsonpatch=require(_0x73da('0x2'));var rp=require(_0x73da('0x3'));var moment=require(_0x73da('0x4'));var BPromise=require(_0x73da('0x5'));var Mustache=require(_0x73da('0x6'));var util=require('util');var path=require(_0x73da('0x7'));var sox=require(_0x73da('0x8'));var csv=require(_0x73da('0x9'));var ejs=require(_0x73da('0xa'));var fs=require('fs');var fs_extra=require(_0x73da('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x73da('0xc'));var jsforce=require(_0x73da('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x73da('0x9'));var querystring=require(_0x73da('0xe'));var Papa=require(_0x73da('0xf'));var Redis=require('ioredis');var authService=require(_0x73da('0x10'));var qs=require(_0x73da('0x11'));var as=require(_0x73da('0x12'));var hardwareService=require(_0x73da('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x73da('0x14'));var licenseUtil=require(_0x73da('0x15'));var db=require(_0x73da('0x16'))['db'];function respondWithStatusCode(_0x448601,_0x1fa038){_0x1fa038=_0x1fa038||0xcc;return function(_0x48c063){if(_0x48c063){return _0x448601[_0x73da('0x17')](_0x1fa038);}return _0x448601[_0x73da('0x18')](_0x1fa038)[_0x73da('0x19')]();};}function respondWithResult(_0x19edfa,_0x4fb682){_0x4fb682=_0x4fb682||0xc8;return function(_0x5b26e2){if(_0x5b26e2){return _0x19edfa[_0x73da('0x18')](_0x4fb682)['json'](_0x5b26e2);}};}function respondWithFilteredResult(_0x269b7a,_0x123c8d){return function(_0x3cf5a8){if(_0x3cf5a8){var _0x2780e7=typeof _0x123c8d['offset']===_0x73da('0x1a')&&typeof _0x123c8d[_0x73da('0x1b')]===_0x73da('0x1a');var _0x1a1aa3=_0x3cf5a8[_0x73da('0x1c')];var _0x1626f5=_0x2780e7?0x0:_0x123c8d[_0x73da('0x1d')];var _0x16aa5e=_0x2780e7?_0x3cf5a8[_0x73da('0x1c')]:_0x123c8d[_0x73da('0x1d')]+_0x123c8d[_0x73da('0x1b')];var _0x9b0620;if(_0x16aa5e>=_0x1a1aa3){_0x16aa5e=_0x1a1aa3;_0x9b0620=0xc8;}else{_0x9b0620=0xce;}_0x269b7a[_0x73da('0x18')](_0x9b0620);return _0x269b7a['set'](_0x73da('0x1e'),_0x1626f5+'-'+_0x16aa5e+'/'+_0x1a1aa3)[_0x73da('0x1f')](_0x3cf5a8);}return null;};}function patchUpdates(_0x682a99){return function(_0x43f4a9){try{jsonpatch[_0x73da('0x20')](_0x43f4a9,_0x682a99,!![]);}catch(_0x3e0dce){return BPromise[_0x73da('0x21')](_0x3e0dce);}return _0x43f4a9['save']();};}function saveUpdates(_0x534623,_0x613755){return function(_0x237d4a){if(_0x237d4a){return _0x237d4a[_0x73da('0x22')](_0x534623)[_0x73da('0x23')](function(_0x507101){return _0x507101;});}return null;};}function removeEntity(_0x21168d,_0x7b9c03){return function(_0x5bf139){if(_0x5bf139){return _0x5bf139[_0x73da('0x24')]()[_0x73da('0x23')](function(){_0x21168d[_0x73da('0x18')](0xcc)[_0x73da('0x19')]();});}};}function handleEntityNotFound(_0x5ab89c,_0x4d090a){return function(_0x1da158){if(!_0x1da158){_0x5ab89c['sendStatus'](0x194);}return _0x1da158;};}function handleError(_0x45df89,_0x1db5f3){_0x1db5f3=_0x1db5f3||0x1f4;return function(_0x4c3682){logger[_0x73da('0x25')](_0x4c3682[_0x73da('0x26')]);if(_0x4c3682[_0x73da('0x27')]){delete _0x4c3682[_0x73da('0x27')];}_0x45df89['status'](_0x1db5f3)[_0x73da('0x28')](_0x4c3682);};}exports['index']=function(_0x154653,_0x5ef582){var _0x46c13c={},_0x201170={},_0x28d106={'count':0x0,'rows':[]};var _0x3b75d8=_['map'](db[_0x73da('0x29')][_0x73da('0x2a')],function(_0x51f97f){return{'name':_0x51f97f[_0x73da('0x2b')],'type':_0x51f97f[_0x73da('0x2c')][_0x73da('0x2d')]};});_0x201170['model']=_[_0x73da('0x2e')](_0x3b75d8,_0x73da('0x27'));_0x201170[_0x73da('0x2f')]=_[_0x73da('0x30')](_0x154653[_0x73da('0x2f')]);_0x201170['filters']=_[_0x73da('0x31')](_0x201170['model'],_0x201170[_0x73da('0x2f')]);_0x46c13c[_0x73da('0x32')]=_['intersection'](_0x201170[_0x73da('0x33')],qs[_0x73da('0x34')](_0x154653[_0x73da('0x2f')][_0x73da('0x34')]));_0x46c13c[_0x73da('0x32')]=_0x46c13c['attributes'][_0x73da('0x35')]?_0x46c13c['attributes']:_0x201170[_0x73da('0x33')];if(!_0x154653[_0x73da('0x2f')]['hasOwnProperty'](_0x73da('0x36'))){_0x46c13c[_0x73da('0x1b')]=qs[_0x73da('0x1b')](_0x154653[_0x73da('0x2f')]['limit']);_0x46c13c[_0x73da('0x1d')]=qs[_0x73da('0x1d')](_0x154653['query'][_0x73da('0x1d')]);}_0x46c13c[_0x73da('0x37')]=qs[_0x73da('0x38')](_0x154653['query'][_0x73da('0x38')]);_0x46c13c[_0x73da('0x39')]=qs[_0x73da('0x3a')](_[_0x73da('0x3b')](_0x154653[_0x73da('0x2f')],_0x201170[_0x73da('0x3a')]),_0x3b75d8);if(_0x154653['query'][_0x73da('0x3c')]){_0x46c13c['where']=_[_0x73da('0x3d')](_0x46c13c[_0x73da('0x39')],{'$or':_[_0x73da('0x2e')](_0x3b75d8,function(_0x3231b1){if(_0x3231b1[_0x73da('0x2c')]!==_0x73da('0x3e')){var _0x34bce5={};_0x34bce5[_0x3231b1[_0x73da('0x27')]]={'$like':'%'+_0x154653[_0x73da('0x2f')][_0x73da('0x3c')]+'%'};return _0x34bce5;}})});}_0x46c13c=_[_0x73da('0x3d')]({},_0x46c13c,_0x154653[_0x73da('0x3f')]);var _0x3913e7={'where':_0x46c13c[_0x73da('0x39')]};return db[_0x73da('0x29')][_0x73da('0x1c')](_0x3913e7)[_0x73da('0x23')](function(_0x3bc010){_0x28d106[_0x73da('0x1c')]=_0x3bc010;if(_0x154653[_0x73da('0x2f')][_0x73da('0x40')]){_0x46c13c[_0x73da('0x41')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x73da('0x42')](_0x46c13c);})[_0x73da('0x23')](function(_0x246179){_0x28d106[_0x73da('0x43')]=_0x246179;return _0x28d106;})[_0x73da('0x23')](respondWithFilteredResult(_0x5ef582,_0x46c13c))['catch'](handleError(_0x5ef582,null));};exports[_0x73da('0x44')]=function(_0x5f178c,_0x1c462e){var _0x414445={'raw':!![],'where':{'id':_0x5f178c['params']['id']}},_0x98bd56={};_0x98bd56[_0x73da('0x33')]=_[_0x73da('0x30')](db['SquareDetailsReport'][_0x73da('0x2a')]);_0x98bd56[_0x73da('0x2f')]=_[_0x73da('0x30')](_0x5f178c[_0x73da('0x2f')]);_0x98bd56['filters']=_[_0x73da('0x31')](_0x98bd56[_0x73da('0x33')],_0x98bd56[_0x73da('0x2f')]);_0x414445[_0x73da('0x32')]=_['intersection'](_0x98bd56[_0x73da('0x33')],qs[_0x73da('0x34')](_0x5f178c[_0x73da('0x2f')][_0x73da('0x34')]));_0x414445[_0x73da('0x32')]=_0x414445['attributes'][_0x73da('0x35')]?_0x414445[_0x73da('0x32')]:_0x98bd56['model'];if(_0x5f178c[_0x73da('0x2f')][_0x73da('0x40')]){_0x414445['include']=[{'all':!![]}];}_0x414445=_['merge']({},_0x414445,_0x5f178c[_0x73da('0x3f')]);return db['SquareDetailsReport'][_0x73da('0x45')](_0x414445)[_0x73da('0x23')](handleEntityNotFound(_0x1c462e,null))[_0x73da('0x23')](respondWithResult(_0x1c462e,null))[_0x73da('0x46')](handleError(_0x1c462e,null));};exports[_0x73da('0x47')]=function(_0x11a7f6,_0x44f814){return db['SquareDetailsReport'][_0x73da('0x47')](_0x11a7f6['body'],{})[_0x73da('0x23')](respondWithResult(_0x44f814,0xc9))[_0x73da('0x46')](handleError(_0x44f814,null));};exports[_0x73da('0x22')]=function(_0x24209d,_0x21fd62){if(_0x24209d[_0x73da('0x48')]['id']){delete _0x24209d[_0x73da('0x48')]['id'];}return db[_0x73da('0x29')][_0x73da('0x45')]({'where':{'id':_0x24209d[_0x73da('0x49')]['id']}})[_0x73da('0x23')](handleEntityNotFound(_0x21fd62,null))[_0x73da('0x23')](saveUpdates(_0x24209d[_0x73da('0x48')],null))[_0x73da('0x23')](respondWithResult(_0x21fd62,null))[_0x73da('0x46')](handleError(_0x21fd62,null));};exports['destroy']=function(_0xb11ce1,_0xe02c37){return db['SquareDetailsReport'][_0x73da('0x45')]({'where':{'id':_0xb11ce1[_0x73da('0x49')]['id']}})[_0x73da('0x23')](handleEntityNotFound(_0xe02c37,null))[_0x73da('0x23')](removeEntity(_0xe02c37,null))[_0x73da('0x46')](handleError(_0xe02c37,null));};exports['describe']=function(_0xfad3b3,_0x50ecd4){return db['SquareDetailsReport'][_0x73da('0x4a')]()['then'](respondWithResult(_0x50ecd4,null))[_0x73da('0x46')](handleError(_0x50ecd4,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index ebe4482..2cb25fd 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 _0x7d25=['SquareDetailsReport','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define'];(function(_0x393aed,_0x484a11){var _0x3a84a9=function(_0x223d13){while(--_0x223d13){_0x393aed['push'](_0x393aed['shift']());}};_0x3a84a9(++_0x484a11);}(_0x7d25,0x1ed));var _0x57d2=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x7d25[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x57d2('0x0'));var util=require(_0x57d2('0x1'));var logger=require(_0x57d2('0x2'))(_0x57d2('0x3'));var moment=require(_0x57d2('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x57d2('0x5'));var rimraf=require(_0x57d2('0x6'));var config=require(_0x57d2('0x7'));var attributes=require(_0x57d2('0x8'));module[_0x57d2('0x9')]=function(_0x1b655f,_0x5ce929){return _0x1b655f[_0x57d2('0xa')](_0x57d2('0xb'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb2a=['SquareDetailsReport','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReportDetail.attributes','define'];(function(_0x55bf29,_0x42915f){var _0x3bcec5=function(_0x469cf8){while(--_0x469cf8){_0x55bf29['push'](_0x55bf29['shift']());}};_0x3bcec5(++_0x42915f);}(_0xbb2a,0x90));var _0xabb2=function(_0x9b485a,_0x2f81af){_0x9b485a=_0x9b485a-0x0;var _0x46c808=_0xbb2a[_0x9b485a];return _0x46c808;};'use strict';var _=require(_0xabb2('0x0'));var util=require(_0xabb2('0x1'));var logger=require(_0xabb2('0x2'))('api');var moment=require(_0xabb2('0x3'));var BPromise=require(_0xabb2('0x4'));var rp=require(_0xabb2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xabb2('0x6'));var config=require(_0xabb2('0x7'));var attributes=require(_0xabb2('0x8'));module['exports']=function(_0x4a193c,_0x124150){return _0x4a193c[_0xabb2('0x9')](_0xabb2('0xa'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 40f746a..a6f7f7a 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 _0x1c9a=['catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x1c9a,0x98));var _0xa1c9=function(_0x1f43f3,_0xb131b0){_0x1f43f3=_0x1f43f3-0x0;var _0x5956ad=_0x1c9a[_0x1f43f3];return _0x5956ad;};'use strict';var _=require(_0xa1c9('0x0'));var util=require('util');var moment=require(_0xa1c9('0x1'));var BPromise=require('bluebird');var rs=require(_0xa1c9('0x2'));var fs=require('fs');var Redis=require(_0xa1c9('0x3'));var db=require(_0xa1c9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1c9('0x5'))(_0xa1c9('0x6'));var config=require(_0xa1c9('0x7'));var jayson=require(_0xa1c9('0x8'));var client=jayson['client'][_0xa1c9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5448f2,_0x222624,_0x463c9c){return new BPromise(function(_0x3f07c2,_0x5059df){return client[_0xa1c9('0xa')](_0x5448f2,_0x463c9c)[_0xa1c9('0xb')](function(_0x24136d){logger[_0xa1c9('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x222624,_0xa1c9('0xd'));logger[_0xa1c9('0xe')](_0xa1c9('0xf'),_0x222624,_0xa1c9('0xd'),JSON[_0xa1c9('0x10')](_0x24136d));if(_0x24136d[_0xa1c9('0x11')]){if(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x12')]===0x1f4){logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x222624,_0x24136d['error'][_0xa1c9('0x14')]);return _0x5059df(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x14')]);}logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x222624,_0x24136d['error'][_0xa1c9('0x14')]);return _0x3f07c2(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x14')]);}else{logger[_0xa1c9('0xc')](_0xa1c9('0x13'),_0x222624,_0xa1c9('0xd'));_0x3f07c2(_0x24136d[_0xa1c9('0x15')][_0xa1c9('0x14')]);}})[_0xa1c9('0x16')](function(_0x373f5d){logger['error'](_0xa1c9('0x13'),_0x222624,_0x373f5d);_0x5059df(_0x373f5d);});});}exports[_0xa1c9('0x17')]=function(_0x224ae4){var _0x50db9b=this;return new Promise(function(_0x2fb81e,_0x5ab911){return db[_0xa1c9('0x18')][_0xa1c9('0x19')](_0x224ae4[_0xa1c9('0x1a')],{'raw':_0x224ae4['options']?_0x224ae4[_0xa1c9('0x1b')][_0xa1c9('0x1c')]===undefined?!![]:![]:!![]})[_0xa1c9('0xb')](function(_0x4edf37){logger[_0xa1c9('0xc')](_0xa1c9('0x17'),_0x224ae4);logger['debug'](_0xa1c9('0x17'),_0x224ae4,JSON[_0xa1c9('0x10')](_0x4edf37));_0x2fb81e(_0x4edf37);})[_0xa1c9('0x16')](function(_0x4d05d0){logger[_0xa1c9('0x11')](_0xa1c9('0x17'),_0x4d05d0[_0xa1c9('0x14')],_0x224ae4);_0x5ab911(_0x50db9b[_0xa1c9('0x11')](0x1f4,_0x4d05d0[_0xa1c9('0x14')]));});});}; \ No newline at end of file +var _0x7462=['request\x20sent','debug','stringify','error','code','message','catch','CreateSquareDetailsReport','create','options','raw','info','lodash','util','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','SquareDetailsReport,\x20%s,\x20%s'];(function(_0x28f76b,_0x357734){var _0x19c11e=function(_0x48d0ca){while(--_0x48d0ca){_0x28f76b['push'](_0x28f76b['shift']());}};_0x19c11e(++_0x357734);}(_0x7462,0x165));var _0x2746=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x7462[_0x934425];return _0x31d596;};'use strict';var _=require(_0x2746('0x0'));var util=require(_0x2746('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2746('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2746('0x3'));var logger=require(_0x2746('0x4'))('rpc');var config=require(_0x2746('0x5'));var jayson=require(_0x2746('0x6'));var client=jayson[_0x2746('0x7')][_0x2746('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a2f42,_0x2940d8,_0x1447bc){return new BPromise(function(_0x40ad2b,_0x283327){return client['request'](_0x2a2f42,_0x1447bc)[_0x2746('0x9')](function(_0x2e4713){logger['info'](_0x2746('0xa'),_0x2940d8,_0x2746('0xb'));logger[_0x2746('0xc')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x2940d8,_0x2746('0xb'),JSON[_0x2746('0xd')](_0x2e4713));if(_0x2e4713[_0x2746('0xe')]){if(_0x2e4713[_0x2746('0xe')][_0x2746('0xf')]===0x1f4){logger[_0x2746('0xe')](_0x2746('0xa'),_0x2940d8,_0x2e4713[_0x2746('0xe')][_0x2746('0x10')]);return _0x283327(_0x2e4713[_0x2746('0xe')][_0x2746('0x10')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x2940d8,_0x2e4713[_0x2746('0xe')][_0x2746('0x10')]);return _0x40ad2b(_0x2e4713[_0x2746('0xe')][_0x2746('0x10')]);}else{logger['info'](_0x2746('0xa'),_0x2940d8,_0x2746('0xb'));_0x40ad2b(_0x2e4713['result']['message']);}})[_0x2746('0x11')](function(_0x43f06c){logger[_0x2746('0xe')](_0x2746('0xa'),_0x2940d8,_0x43f06c);_0x283327(_0x43f06c);});});}exports[_0x2746('0x12')]=function(_0x232108){var _0x3556b5=this;return new Promise(function(_0x6102f3,_0x25c122){return db['SquareDetailsReport'][_0x2746('0x13')](_0x232108['body'],{'raw':_0x232108[_0x2746('0x14')]?_0x232108[_0x2746('0x14')][_0x2746('0x15')]===undefined?!![]:![]:!![]})[_0x2746('0x9')](function(_0xa64e76){logger[_0x2746('0x16')](_0x2746('0x12'),_0x232108);logger[_0x2746('0xc')](_0x2746('0x12'),_0x232108,JSON['stringify'](_0xa64e76));_0x6102f3(_0xa64e76);})['catch'](function(_0x7390b3){logger[_0x2746('0xe')](_0x2746('0x12'),_0x7390b3['message'],_0x232108);_0x25c122(_0x3556b5[_0x2746('0xe')](0x1f4,_0x7390b3[_0x2746('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 5ed5dd4..28690b4 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 _0xa942=['isAuthenticated','index','/process/:pid/kill','exports','express','../../components/auth/service','get'];(function(_0x2b4201,_0x383749){var _0x3887f5=function(_0x2cfd0f){while(--_0x2cfd0f){_0x2b4201['push'](_0x2b4201['shift']());}};_0x3887f5(++_0x383749);}(_0xa942,0xc1));var _0x2a94=function(_0x4738b1,_0x2b576d){_0x4738b1=_0x4738b1-0x0;var _0x2732ae=_0xa942[_0x4738b1];return _0x2732ae;};'use strict';var express=require(_0x2a94('0x0'));var router=express['Router']();var auth=require(_0x2a94('0x1'));var controller=require('./system.controller');router[_0x2a94('0x2')]('/',auth[_0x2a94('0x3')](),controller[_0x2a94('0x4')]);router[_0x2a94('0x2')](_0x2a94('0x5'),auth[_0x2a94('0x3')](),controller['killProcess']);module[_0x2a94('0x6')]=router; \ No newline at end of file +var _0x5e81=['Router','../../components/auth/service','isAuthenticated','index','get','/process/:pid/kill','killProcess','exports'];(function(_0x209c05,_0x111ae4){var _0x289583=function(_0x12e0cf){while(--_0x12e0cf){_0x209c05['push'](_0x209c05['shift']());}};_0x289583(++_0x111ae4);}(_0x5e81,0x140));var _0x15e8=function(_0x83b366,_0x28482a){_0x83b366=_0x83b366-0x0;var _0x20ecfb=_0x5e81[_0x83b366];return _0x20ecfb;};'use strict';var express=require('express');var router=express[_0x15e8('0x0')]();var auth=require(_0x15e8('0x1'));var controller=require('./system.controller');router['get']('/',auth[_0x15e8('0x2')](),controller[_0x15e8('0x3')]);router[_0x15e8('0x4')](_0x15e8('0x5'),auth[_0x15e8('0x2')](),controller[_0x15e8('0x6')]);module[_0x15e8('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 955f085..b5f28bc 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 _0xa649=['then','json','status','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','send','index'];(function(_0x31f12e,_0x3192dd){var _0x404f1e=function(_0x4b8c3b){while(--_0x4b8c3b){_0x31f12e['push'](_0x31f12e['shift']());}};_0x404f1e(++_0x3192dd);}(_0xa649,0xde));var _0x9a64=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xa649[_0x199572];return _0x13cfa3;};'use strict';var info=require(_0x9a64('0x0'));var exec=require(_0x9a64('0x1'))[_0x9a64('0x2')];var logger=require(_0x9a64('0x3'))('api');var util=require(_0x9a64('0x4'));var BPromise=require(_0x9a64('0x5'));var _=require(_0x9a64('0x6'));function handleError(_0x26d20c,_0x551c29,_0x56588e){_0x551c29=_0x551c29||0x1f4;return function(_0xb832e6){logger[_0x9a64('0x7')](_0x9a64('0x8'),_0x56588e,_0x551c29,util[_0x9a64('0x9')](_0xb832e6,{'showHidden':![],'depth':null}));delete _0xb832e6['name'];_0x26d20c['status'](_0x551c29)[_0x9a64('0xa')](_0xb832e6);};}exports[_0x9a64('0xb')]=function(_0x52a4d3,_0x15f82f){return info['getAllData']()[_0x9a64('0xc')](function(_0x123e76){return _0x15f82f['status'](0xc8)[_0x9a64('0xd')](_0x123e76);})['catch'](function(_0x459916){return _0x15f82f[_0x9a64('0xe')](0x1f4)['json'](_0x459916);});};exports['killProcess']=function(_0x210e75,_0xf8ae66){var _0x26c8aa=[_0x9a64('0xf')];return new BPromise(function(_0x4bd24a,_0xb64c15){return exec(util['format'](_0x9a64('0x10'),_0x210e75[_0x9a64('0x11')][_0x9a64('0x12')]),function(_0xc86403,_0xc29be6,_0x1be982){if(_0xc86403){return _0xb64c15(_0xc86403);}return _0x4bd24a(_0xc29be6);});})[_0x9a64('0xc')](function(_0x32fc4c){var _0x49f3c9=![];var _0x275814=_0x32fc4c['split'](/\n/);for(var _0x1a898e=0x0,_0x58d1c6=_0x26c8aa[_0x9a64('0x13')];_0x1a898e<_0x58d1c6,_0x49f3c9===![];_0x1a898e+=0x1){if(_0x32fc4c[_0x9a64('0x14')](_0x26c8aa[_0x1a898e])>=0x0){_0x49f3c9=!![];}}if(!_0x49f3c9){throw new Error(util[_0x9a64('0x15')](_0x9a64('0x16'),_0x210e75[_0x9a64('0x11')][_0x9a64('0x12')]));}process[_0x9a64('0x17')](_0x210e75[_0x9a64('0x11')][_0x9a64('0x12')],_0x9a64('0x18'));return _0xf8ae66[_0x9a64('0xe')](0xc8)[_0x9a64('0xd')]({'message':util[_0x9a64('0x15')](_0x9a64('0x19'),_0x210e75[_0x9a64('0x11')][_0x9a64('0x12')])});})['catch'](handleError(_0xf8ae66,null,'killProcess'));}; \ No newline at end of file +var _0x2aaf=['systeminformation','child_process','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','catch','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2aaf,0x168));var _0xf2aa=function(_0x18edf7,_0x282834){_0x18edf7=_0x18edf7-0x0;var _0x1c14a9=_0x2aaf[_0x18edf7];return _0x1c14a9;};'use strict';var info=require(_0xf2aa('0x0'));var exec=require(_0xf2aa('0x1'))['exec'];var logger=require(_0xf2aa('0x2'))(_0xf2aa('0x3'));var util=require('util');var BPromise=require(_0xf2aa('0x4'));var _=require(_0xf2aa('0x5'));function handleError(_0x7fda5c,_0x3e0bc8,_0x42a9cf){_0x3e0bc8=_0x3e0bc8||0x1f4;return function(_0x10c1a9){logger[_0xf2aa('0x6')](_0xf2aa('0x7'),_0x42a9cf,_0x3e0bc8,util[_0xf2aa('0x8')](_0x10c1a9,{'showHidden':![],'depth':null}));delete _0x10c1a9[_0xf2aa('0x9')];_0x7fda5c[_0xf2aa('0xa')](_0x3e0bc8)[_0xf2aa('0xb')](_0x10c1a9);};}exports[_0xf2aa('0xc')]=function(_0x34c9c3,_0x1a870b){return info[_0xf2aa('0xd')]()[_0xf2aa('0xe')](function(_0x543b66){return _0x1a870b[_0xf2aa('0xa')](0xc8)['json'](_0x543b66);})[_0xf2aa('0xf')](function(_0x5473f6){return _0x1a870b['status'](0x1f4)[_0xf2aa('0x10')](_0x5473f6);});};exports[_0xf2aa('0x11')]=function(_0x29e5ee,_0x2cccb8){var _0xbe989=[_0xf2aa('0x12')];return new BPromise(function(_0x5cb723,_0x5c49a3){return exec(util[_0xf2aa('0x13')](_0xf2aa('0x14'),_0x29e5ee[_0xf2aa('0x15')]['pid']),function(_0x2b2a13,_0x55c820,_0x13d485){if(_0x2b2a13){return _0x5c49a3(_0x2b2a13);}return _0x5cb723(_0x55c820);});})['then'](function(_0x20ecb6){var _0x488a0c=![];var _0x45ffa0=_0x20ecb6[_0xf2aa('0x16')](/\n/);for(var _0x194e3b=0x0,_0x184b27=_0xbe989[_0xf2aa('0x17')];_0x194e3b<_0x184b27,_0x488a0c===![];_0x194e3b+=0x1){if(_0x20ecb6[_0xf2aa('0x18')](_0xbe989[_0x194e3b])>=0x0){_0x488a0c=!![];}}if(!_0x488a0c){throw new Error(util[_0xf2aa('0x13')](_0xf2aa('0x19'),_0x29e5ee[_0xf2aa('0x15')][_0xf2aa('0x1a')]));}process[_0xf2aa('0x1b')](_0x29e5ee[_0xf2aa('0x15')][_0xf2aa('0x1a')],_0xf2aa('0x1c'));return _0x2cccb8[_0xf2aa('0xa')](0xc8)['json']({'message':util[_0xf2aa('0x13')](_0xf2aa('0x1d'),_0x29e5ee[_0xf2aa('0x15')]['pid'])});})['catch'](handleError(_0x2cccb8,null,_0xf2aa('0x11')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index f52d8c1..869ea04 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 _0x8611=['put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/:id','show','post','create'];(function(_0x225a78,_0x4fc4cb){var _0x51efae=function(_0x12417a){while(--_0x12417a){_0x225a78['push'](_0x225a78['shift']());}};_0x51efae(++_0x4fc4cb);}(_0x8611,0x143));var _0x1861=function(_0x10b2bd,_0x19c284){_0x10b2bd=_0x10b2bd-0x0;var _0x5b027e=_0x8611[_0x10b2bd];return _0x5b027e;};'use strict';var multer=require(_0x1861('0x0'));var util=require(_0x1861('0x1'));var path=require(_0x1861('0x2'));var timeout=require(_0x1861('0x3'));var express=require('express');var router=express[_0x1861('0x4')]();var fs_extra=require(_0x1861('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1861('0x6'));var config=require('../../config/environment');var controller=require('./tag.controller');router[_0x1861('0x7')]('/',auth[_0x1861('0x8')](),controller['index']);router[_0x1861('0x7')](_0x1861('0x9'),auth[_0x1861('0x8')](),controller[_0x1861('0xa')]);router[_0x1861('0xb')]('/',auth['isAuthenticated'](),controller[_0x1861('0xc')]);router[_0x1861('0xd')]('/:id',auth[_0x1861('0x8')](),controller[_0x1861('0xe')]);router['delete'](_0x1861('0x9'),auth[_0x1861('0x8')](),controller['destroy']);module[_0x1861('0xf')]=router; \ No newline at end of file +var _0x9568=['../../components/auth/service','../../components/interaction/service','./tag.controller','isAuthenticated','index','get','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x498d7d,_0x55601d){var _0x161d65=function(_0x34c71d){while(--_0x34c71d){_0x498d7d['push'](_0x498d7d['shift']());}};_0x161d65(++_0x55601d);}(_0x9568,0xc7));var _0x8956=function(_0x36147b,_0x57f40b){_0x36147b=_0x36147b-0x0;var _0x141351=_0x9568[_0x36147b];return _0x141351;};'use strict';var multer=require(_0x8956('0x0'));var util=require(_0x8956('0x1'));var path=require(_0x8956('0x2'));var timeout=require(_0x8956('0x3'));var express=require(_0x8956('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8956('0x5'));var interaction=require(_0x8956('0x6'));var config=require('../../config/environment');var controller=require(_0x8956('0x7'));router['get']('/',auth[_0x8956('0x8')](),controller[_0x8956('0x9')]);router[_0x8956('0xa')]('/:id',auth[_0x8956('0x8')](),controller['show']);router[_0x8956('0xb')]('/',auth[_0x8956('0x8')](),controller[_0x8956('0xc')]);router[_0x8956('0xd')]('/:id',auth[_0x8956('0x8')](),controller[_0x8956('0xe')]);router[_0x8956('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8956('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index bcd02c3..b9f517c 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 _0x486e=['name','STRING','#0091EA','sequelize','exports'];(function(_0x148943,_0x365376){var _0x54aef4=function(_0x12c03b){while(--_0x12c03b){_0x148943['push'](_0x148943['shift']());}};_0x54aef4(++_0x365376);}(_0x486e,0xb2));var _0xe486=function(_0x41e5ee,_0x5433fd){_0x41e5ee=_0x41e5ee-0x0;var _0x4c9c7b=_0x486e[_0x41e5ee];return _0x4c9c7b;};'use strict';var Sequelize=require(_0xe486('0x0'));module[_0xe486('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xe486('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xe486('0x3')],'defaultValue':_0xe486('0x4')},'description':{'type':Sequelize[_0xe486('0x3')]}}; \ No newline at end of file +var _0xbfcc=['#0091EA','sequelize','name','STRING'];(function(_0x30fcc0,_0x469194){var _0x52ccdf=function(_0x564d78){while(--_0x564d78){_0x30fcc0['push'](_0x30fcc0['shift']());}};_0x52ccdf(++_0x469194);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x13b392,_0x3481f2){_0x13b392=_0x13b392-0x0;var _0x39db24=_0xbfcc[_0x13b392];return _0x39db24;};'use strict';var Sequelize=require(_0xcbfc('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xcbfc('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xcbfc('0x2')],'defaultValue':_0xcbfc('0x3')},'description':{'type':Sequelize[_0xcbfc('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index f99691f..e585f04 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 _0xbb53=['sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','get','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x194fe7,_0x3f9efb){var _0x15787b=function(_0x570ad4){while(--_0x570ad4){_0x194fe7['push'](_0x194fe7['shift']());}};_0x15787b(++_0x3f9efb);}(_0xbb53,0x121));var _0x3bb5=function(_0x2acbce,_0x1bba43){_0x2acbce=_0x2acbce-0x0;var _0x5f0461=_0xbb53[_0x2acbce];return _0x5f0461;};'use strict';var emlformat=require(_0x3bb5('0x0'));var rimraf=require(_0x3bb5('0x1'));var zipdir=require(_0x3bb5('0x2'));var jsonpatch=require(_0x3bb5('0x3'));var rp=require(_0x3bb5('0x4'));var moment=require(_0x3bb5('0x5'));var BPromise=require(_0x3bb5('0x6'));var Mustache=require(_0x3bb5('0x7'));var util=require(_0x3bb5('0x8'));var path=require(_0x3bb5('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3bb5('0xa'));var fs=require('fs');var fs_extra=require(_0x3bb5('0xb'));var _=require(_0x3bb5('0xc'));var squel=require(_0x3bb5('0xd'));var crypto=require(_0x3bb5('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3bb5('0xf'));var Papa=require(_0x3bb5('0x10'));var Redis=require(_0x3bb5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3bb5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3bb5('0x13'))(_0x3bb5('0x14'));var utils=require('../../config/utils');var config=require(_0x3bb5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3bb5('0x16'))['db'];function respondWithStatusCode(_0x511bd8,_0x526bf0){_0x526bf0=_0x526bf0||0xcc;return function(_0x223356){if(_0x223356){return _0x511bd8[_0x3bb5('0x17')](_0x526bf0);}return _0x511bd8[_0x3bb5('0x18')](_0x526bf0)['end']();};}function respondWithResult(_0xd578fc,_0x12e409){_0x12e409=_0x12e409||0xc8;return function(_0x519123){if(_0x519123){return _0xd578fc[_0x3bb5('0x18')](_0x12e409)[_0x3bb5('0x19')](_0x519123);}};}function respondWithFilteredResult(_0x5cec77,_0x5ca99f){return function(_0x50617f){if(_0x50617f){var _0x42ef1b=typeof _0x5ca99f[_0x3bb5('0x1a')]==='undefined'&&typeof _0x5ca99f[_0x3bb5('0x1b')]===_0x3bb5('0x1c');var _0x4656c4=_0x50617f[_0x3bb5('0x1d')];var _0x48bc25=_0x42ef1b?0x0:_0x5ca99f[_0x3bb5('0x1a')];var _0x1109d0=_0x42ef1b?_0x50617f[_0x3bb5('0x1d')]:_0x5ca99f['offset']+_0x5ca99f['limit'];var _0x19b177;if(_0x1109d0>=_0x4656c4){_0x1109d0=_0x4656c4;_0x19b177=0xc8;}else{_0x19b177=0xce;}_0x5cec77[_0x3bb5('0x18')](_0x19b177);return _0x5cec77[_0x3bb5('0x1e')]('Content-Range',_0x48bc25+'-'+_0x1109d0+'/'+_0x4656c4)[_0x3bb5('0x19')](_0x50617f);}return null;};}function patchUpdates(_0x2afe6e){return function(_0x3f94ad){try{jsonpatch[_0x3bb5('0x1f')](_0x3f94ad,_0x2afe6e,!![]);}catch(_0x21a3ff){return BPromise[_0x3bb5('0x20')](_0x21a3ff);}return _0x3f94ad['save']();};}function saveUpdates(_0x37444e,_0x3eae85){return function(_0x438a8d){if(_0x438a8d){return _0x438a8d[_0x3bb5('0x21')](_0x37444e)[_0x3bb5('0x22')](function(_0xfb9e8){return _0xfb9e8;});}return null;};}function removeEntity(_0x341a3f,_0x58c10f){return function(_0x1d2a24){if(_0x1d2a24){return _0x1d2a24[_0x3bb5('0x23')]()['then'](function(){var _0x4fc81b=_0x1d2a24[_0x3bb5('0x24')]({'plain':!![]});var _0x36cfda='Tags';return db['UserProfileResource'][_0x3bb5('0x23')]({'where':{'type':_0x36cfda,'resourceId':_0x4fc81b['id']}})[_0x3bb5('0x22')](function(){return _0x1d2a24;});})[_0x3bb5('0x22')](function(){_0x341a3f[_0x3bb5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5baf9a,_0x33e943){return function(_0x4e8c65){if(!_0x4e8c65){_0x5baf9a[_0x3bb5('0x17')](0x194);}return _0x4e8c65;};}function handleError(_0x2d65ec,_0x2e67f7){_0x2e67f7=_0x2e67f7||0x1f4;return function(_0x534b15){logger['error'](_0x534b15[_0x3bb5('0x25')]);if(_0x534b15[_0x3bb5('0x26')]){delete _0x534b15[_0x3bb5('0x26')];}_0x2d65ec[_0x3bb5('0x18')](_0x2e67f7)[_0x3bb5('0x27')](_0x534b15);};}exports[_0x3bb5('0x28')]=function(_0x3ed2cc,_0x5ce225){var _0x1b429e={},_0xa643c9={},_0x5ebd0a={'count':0x0,'rows':[]};var _0x2ba5f4=_[_0x3bb5('0x29')](db[_0x3bb5('0x2a')][_0x3bb5('0x2b')],function(_0x52cd46){return{'name':_0x52cd46[_0x3bb5('0x2c')],'type':_0x52cd46[_0x3bb5('0x2d')]['key']};});_0xa643c9[_0x3bb5('0x2e')]=_[_0x3bb5('0x29')](_0x2ba5f4,_0x3bb5('0x26'));_0xa643c9[_0x3bb5('0x2f')]=_[_0x3bb5('0x30')](_0x3ed2cc['query']);_0xa643c9[_0x3bb5('0x31')]=_[_0x3bb5('0x32')](_0xa643c9[_0x3bb5('0x2e')],_0xa643c9[_0x3bb5('0x2f')]);_0x1b429e['attributes']=_['intersection'](_0xa643c9[_0x3bb5('0x2e')],qs[_0x3bb5('0x33')](_0x3ed2cc[_0x3bb5('0x2f')][_0x3bb5('0x33')]));_0x1b429e[_0x3bb5('0x34')]=_0x1b429e[_0x3bb5('0x34')][_0x3bb5('0x35')]?_0x1b429e[_0x3bb5('0x34')]:_0xa643c9[_0x3bb5('0x2e')];if(!_0x3ed2cc['query'][_0x3bb5('0x36')](_0x3bb5('0x37'))){_0x1b429e['limit']=qs['limit'](_0x3ed2cc[_0x3bb5('0x2f')][_0x3bb5('0x1b')]);_0x1b429e[_0x3bb5('0x1a')]=qs[_0x3bb5('0x1a')](_0x3ed2cc['query']['offset']);}_0x1b429e[_0x3bb5('0x38')]=qs['sort'](_0x3ed2cc[_0x3bb5('0x2f')]['sort']);_0x1b429e['where']=qs[_0x3bb5('0x31')](_['pick'](_0x3ed2cc['query'],_0xa643c9[_0x3bb5('0x31')]),_0x2ba5f4);if(_0x3ed2cc[_0x3bb5('0x2f')][_0x3bb5('0x39')]){_0x1b429e['where']=_[_0x3bb5('0x3a')](_0x1b429e['where'],{'$or':_[_0x3bb5('0x29')](_0x2ba5f4,function(_0x47c663){if(_0x47c663[_0x3bb5('0x2d')]!==_0x3bb5('0x3b')){var _0x4209d2={};_0x4209d2[_0x47c663[_0x3bb5('0x26')]]={'$like':'%'+_0x3ed2cc[_0x3bb5('0x2f')][_0x3bb5('0x39')]+'%'};return _0x4209d2;}})});}_0x1b429e=_['merge']({},_0x1b429e,_0x3ed2cc[_0x3bb5('0x3c')]);var _0x7c1b7b={'where':_0x1b429e['where']};return db[_0x3bb5('0x2a')][_0x3bb5('0x1d')](_0x7c1b7b)[_0x3bb5('0x22')](function(_0x5cfb72){_0x5ebd0a[_0x3bb5('0x1d')]=_0x5cfb72;if(_0x3ed2cc[_0x3bb5('0x2f')]['includeAll']){_0x1b429e[_0x3bb5('0x3d')]=[{'all':!![]}];}return db[_0x3bb5('0x2a')][_0x3bb5('0x3e')](_0x1b429e);})[_0x3bb5('0x22')](function(_0x663685){_0x5ebd0a[_0x3bb5('0x3f')]=_0x663685;return _0x5ebd0a;})[_0x3bb5('0x22')](respondWithFilteredResult(_0x5ce225,_0x1b429e))[_0x3bb5('0x40')](handleError(_0x5ce225,null));};exports[_0x3bb5('0x41')]=function(_0x42676d,_0x2539e4){var _0x64e6e7={'raw':!![],'where':{'id':_0x42676d[_0x3bb5('0x42')]['id']}},_0x20478a={};_0x20478a['model']=_[_0x3bb5('0x30')](db[_0x3bb5('0x2a')]['rawAttributes']);_0x20478a['query']=_[_0x3bb5('0x30')](_0x42676d[_0x3bb5('0x2f')]);_0x20478a[_0x3bb5('0x31')]=_[_0x3bb5('0x32')](_0x20478a[_0x3bb5('0x2e')],_0x20478a[_0x3bb5('0x2f')]);_0x64e6e7[_0x3bb5('0x34')]=_[_0x3bb5('0x32')](_0x20478a['model'],qs['fields'](_0x42676d[_0x3bb5('0x2f')][_0x3bb5('0x33')]));_0x64e6e7[_0x3bb5('0x34')]=_0x64e6e7['attributes'][_0x3bb5('0x35')]?_0x64e6e7['attributes']:_0x20478a[_0x3bb5('0x2e')];if(_0x42676d[_0x3bb5('0x2f')][_0x3bb5('0x43')]){_0x64e6e7[_0x3bb5('0x3d')]=[{'all':!![]}];}_0x64e6e7=_[_0x3bb5('0x3a')]({},_0x64e6e7,_0x42676d[_0x3bb5('0x3c')]);return db['Tag'][_0x3bb5('0x44')](_0x64e6e7)[_0x3bb5('0x22')](handleEntityNotFound(_0x2539e4,null))['then'](respondWithResult(_0x2539e4,null))[_0x3bb5('0x40')](handleError(_0x2539e4,null));};exports[_0x3bb5('0x45')]=function(_0x5075bd,_0x41edf7){return db[_0x3bb5('0x2a')][_0x3bb5('0x45')](_0x5075bd[_0x3bb5('0x46')],{})[_0x3bb5('0x22')](function(_0x5b2e46){var _0x40f47c=_0x5075bd[_0x3bb5('0x47')]['get']({'plain':!![]});if(!_0x40f47c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40f47c[_0x3bb5('0x48')]===_0x3bb5('0x47')){var _0x1e5b64=_0x5b2e46[_0x3bb5('0x24')]({'plain':!![]});var _0x1e4edd='Tags';return db[_0x3bb5('0x49')][_0x3bb5('0x44')]({'where':{'name':_0x1e4edd,'userProfileId':_0x40f47c[_0x3bb5('0x4a')]},'raw':!![]})[_0x3bb5('0x22')](function(_0x2d03c0){if(_0x2d03c0&&_0x2d03c0[_0x3bb5('0x4b')]===0x0){return db[_0x3bb5('0x4c')]['create']({'name':_0x1e5b64[_0x3bb5('0x26')],'resourceId':_0x1e5b64['id'],'type':_0x2d03c0[_0x3bb5('0x26')],'sectionId':_0x2d03c0['id']},{})[_0x3bb5('0x22')](function(){return _0x5b2e46;});}else{return _0x5b2e46;}})[_0x3bb5('0x40')](function(_0x29e695){logger['error'](_0x3bb5('0x4d'),_0x29e695);throw _0x29e695;});}return _0x5b2e46;})[_0x3bb5('0x22')](respondWithResult(_0x41edf7,0xc9))[_0x3bb5('0x40')](handleError(_0x41edf7,null));};exports[_0x3bb5('0x21')]=function(_0x168aae,_0x3f9133){if(_0x168aae[_0x3bb5('0x46')]['id']){delete _0x168aae[_0x3bb5('0x46')]['id'];}return db['Tag'][_0x3bb5('0x44')]({'where':{'id':_0x168aae[_0x3bb5('0x42')]['id']}})[_0x3bb5('0x22')](handleEntityNotFound(_0x3f9133,null))[_0x3bb5('0x22')](saveUpdates(_0x168aae['body'],null))[_0x3bb5('0x22')](respondWithResult(_0x3f9133,null))['catch'](handleError(_0x3f9133,null));};exports[_0x3bb5('0x23')]=function(_0x26f66d,_0xe04576){return db[_0x3bb5('0x2a')][_0x3bb5('0x44')]({'where':{'id':_0x26f66d['params']['id']}})[_0x3bb5('0x22')](handleEntityNotFound(_0xe04576,null))[_0x3bb5('0x22')](removeEntity(_0xe04576,null))[_0x3bb5('0x40')](handleError(_0xe04576,null));}; \ No newline at end of file +var _0x76dc=['where','pick','filter','merge','map','type','VIRTUAL','options','findAll','rows','catch','show','params','intersection','includeAll','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','json','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','error','name','send','Tag','fieldName','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x4070fe,_0x4f253b){var _0x430c8b=function(_0x408c31){while(--_0x408c31){_0x4070fe['push'](_0x4070fe['shift']());}};_0x430c8b(++_0x4f253b);}(_0x76dc,0x1f2));var _0xc76d=function(_0x2967c1,_0x202a72){_0x2967c1=_0x2967c1-0x0;var _0x103397=_0x76dc[_0x2967c1];return _0x103397;};'use strict';var emlformat=require(_0xc76d('0x0'));var rimraf=require(_0xc76d('0x1'));var zipdir=require(_0xc76d('0x2'));var jsonpatch=require(_0xc76d('0x3'));var rp=require('request-promise');var moment=require(_0xc76d('0x4'));var BPromise=require(_0xc76d('0x5'));var Mustache=require('mustache');var util=require(_0xc76d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc76d('0x7'));var ejs=require(_0xc76d('0x8'));var fs=require('fs');var fs_extra=require(_0xc76d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc76d('0xa'));var jsforce=require(_0xc76d('0xb'));var deskjs=require(_0xc76d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc76d('0xd'));var Redis=require(_0xc76d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc76d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc76d('0x10'));var logger=require(_0xc76d('0x11'))(_0xc76d('0x12'));var utils=require(_0xc76d('0x13'));var config=require(_0xc76d('0x14'));var licenseUtil=require(_0xc76d('0x15'));var db=require(_0xc76d('0x16'))['db'];function respondWithStatusCode(_0x2e02e9,_0x1722b3){_0x1722b3=_0x1722b3||0xcc;return function(_0x311814){if(_0x311814){return _0x2e02e9[_0xc76d('0x17')](_0x1722b3);}return _0x2e02e9[_0xc76d('0x18')](_0x1722b3)[_0xc76d('0x19')]();};}function respondWithResult(_0x3ed1bd,_0x5cda20){_0x5cda20=_0x5cda20||0xc8;return function(_0x8696db){if(_0x8696db){return _0x3ed1bd[_0xc76d('0x18')](_0x5cda20)['json'](_0x8696db);}};}function respondWithFilteredResult(_0x4741a4,_0x2d23d2){return function(_0x47a4ee){if(_0x47a4ee){var _0x6f94e=typeof _0x2d23d2['offset']===_0xc76d('0x1a')&&typeof _0x2d23d2['limit']==='undefined';var _0x45a83e=_0x47a4ee[_0xc76d('0x1b')];var _0x339623=_0x6f94e?0x0:_0x2d23d2[_0xc76d('0x1c')];var _0xd1d16f=_0x6f94e?_0x47a4ee['count']:_0x2d23d2[_0xc76d('0x1c')]+_0x2d23d2[_0xc76d('0x1d')];var _0xa0c5b6;if(_0xd1d16f>=_0x45a83e){_0xd1d16f=_0x45a83e;_0xa0c5b6=0xc8;}else{_0xa0c5b6=0xce;}_0x4741a4[_0xc76d('0x18')](_0xa0c5b6);return _0x4741a4[_0xc76d('0x1e')]('Content-Range',_0x339623+'-'+_0xd1d16f+'/'+_0x45a83e)[_0xc76d('0x1f')](_0x47a4ee);}return null;};}function patchUpdates(_0x324db7){return function(_0x5dffde){try{jsonpatch[_0xc76d('0x20')](_0x5dffde,_0x324db7,!![]);}catch(_0x777f22){return BPromise[_0xc76d('0x21')](_0x777f22);}return _0x5dffde[_0xc76d('0x22')]();};}function saveUpdates(_0x18f546,_0x3d357b){return function(_0x42b89c){if(_0x42b89c){return _0x42b89c[_0xc76d('0x23')](_0x18f546)[_0xc76d('0x24')](function(_0x20e09c){return _0x20e09c;});}return null;};}function removeEntity(_0x15328d,_0x5de11f){return function(_0x11b42f){if(_0x11b42f){return _0x11b42f[_0xc76d('0x25')]()['then'](function(){var _0x637d68=_0x11b42f[_0xc76d('0x26')]({'plain':!![]});var _0x55ca79=_0xc76d('0x27');return db[_0xc76d('0x28')][_0xc76d('0x25')]({'where':{'type':_0x55ca79,'resourceId':_0x637d68['id']}})[_0xc76d('0x24')](function(){return _0x11b42f;});})[_0xc76d('0x24')](function(){_0x15328d[_0xc76d('0x18')](0xcc)[_0xc76d('0x19')]();});}};}function handleEntityNotFound(_0x59ebd1,_0x59dabf){return function(_0x285430){if(!_0x285430){_0x59ebd1[_0xc76d('0x17')](0x194);}return _0x285430;};}function handleError(_0x5069ea,_0x31501a){_0x31501a=_0x31501a||0x1f4;return function(_0x52a79a){logger[_0xc76d('0x29')](_0x52a79a['stack']);if(_0x52a79a[_0xc76d('0x2a')]){delete _0x52a79a['name'];}_0x5069ea[_0xc76d('0x18')](_0x31501a)[_0xc76d('0x2b')](_0x52a79a);};}exports['index']=function(_0x3d4076,_0x1c68f3){var _0x9ab96c={},_0x2cf501={},_0x4feeda={'count':0x0,'rows':[]};var _0x283e16=_['map'](db[_0xc76d('0x2c')]['rawAttributes'],function(_0x30769f){return{'name':_0x30769f[_0xc76d('0x2d')],'type':_0x30769f['type']['key']};});_0x2cf501['model']=_['map'](_0x283e16,_0xc76d('0x2a'));_0x2cf501[_0xc76d('0x2e')]=_[_0xc76d('0x2f')](_0x3d4076[_0xc76d('0x2e')]);_0x2cf501[_0xc76d('0x30')]=_['intersection'](_0x2cf501[_0xc76d('0x31')],_0x2cf501['query']);_0x9ab96c[_0xc76d('0x32')]=_['intersection'](_0x2cf501[_0xc76d('0x31')],qs[_0xc76d('0x33')](_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x33')]));_0x9ab96c[_0xc76d('0x32')]=_0x9ab96c['attributes'][_0xc76d('0x34')]?_0x9ab96c[_0xc76d('0x32')]:_0x2cf501[_0xc76d('0x31')];if(!_0x3d4076['query'][_0xc76d('0x35')](_0xc76d('0x36'))){_0x9ab96c[_0xc76d('0x1d')]=qs['limit'](_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x1d')]);_0x9ab96c[_0xc76d('0x1c')]=qs[_0xc76d('0x1c')](_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x1c')]);}_0x9ab96c['order']=qs['sort'](_0x3d4076[_0xc76d('0x2e')]['sort']);_0x9ab96c[_0xc76d('0x37')]=qs[_0xc76d('0x30')](_[_0xc76d('0x38')](_0x3d4076[_0xc76d('0x2e')],_0x2cf501['filters']),_0x283e16);if(_0x3d4076['query'][_0xc76d('0x39')]){_0x9ab96c[_0xc76d('0x37')]=_[_0xc76d('0x3a')](_0x9ab96c[_0xc76d('0x37')],{'$or':_[_0xc76d('0x3b')](_0x283e16,function(_0x58c724){if(_0x58c724[_0xc76d('0x3c')]!==_0xc76d('0x3d')){var _0x321989={};_0x321989[_0x58c724[_0xc76d('0x2a')]]={'$like':'%'+_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x39')]+'%'};return _0x321989;}})});}_0x9ab96c=_[_0xc76d('0x3a')]({},_0x9ab96c,_0x3d4076[_0xc76d('0x3e')]);var _0x305f7d={'where':_0x9ab96c[_0xc76d('0x37')]};return db['Tag']['count'](_0x305f7d)[_0xc76d('0x24')](function(_0x2a0759){_0x4feeda[_0xc76d('0x1b')]=_0x2a0759;if(_0x3d4076[_0xc76d('0x2e')]['includeAll']){_0x9ab96c['include']=[{'all':!![]}];}return db[_0xc76d('0x2c')][_0xc76d('0x3f')](_0x9ab96c);})[_0xc76d('0x24')](function(_0x15eb42){_0x4feeda[_0xc76d('0x40')]=_0x15eb42;return _0x4feeda;})[_0xc76d('0x24')](respondWithFilteredResult(_0x1c68f3,_0x9ab96c))[_0xc76d('0x41')](handleError(_0x1c68f3,null));};exports[_0xc76d('0x42')]=function(_0x50e922,_0x7bf0){var _0x95193f={'raw':!![],'where':{'id':_0x50e922[_0xc76d('0x43')]['id']}},_0x1bf8a0={};_0x1bf8a0['model']=_['keys'](db['Tag']['rawAttributes']);_0x1bf8a0['query']=_['keys'](_0x50e922['query']);_0x1bf8a0[_0xc76d('0x30')]=_[_0xc76d('0x44')](_0x1bf8a0[_0xc76d('0x31')],_0x1bf8a0[_0xc76d('0x2e')]);_0x95193f[_0xc76d('0x32')]=_[_0xc76d('0x44')](_0x1bf8a0[_0xc76d('0x31')],qs[_0xc76d('0x33')](_0x50e922['query'][_0xc76d('0x33')]));_0x95193f[_0xc76d('0x32')]=_0x95193f[_0xc76d('0x32')][_0xc76d('0x34')]?_0x95193f[_0xc76d('0x32')]:_0x1bf8a0[_0xc76d('0x31')];if(_0x50e922[_0xc76d('0x2e')][_0xc76d('0x45')]){_0x95193f[_0xc76d('0x46')]=[{'all':!![]}];}_0x95193f=_['merge']({},_0x95193f,_0x50e922['options']);return db[_0xc76d('0x2c')][_0xc76d('0x47')](_0x95193f)[_0xc76d('0x24')](handleEntityNotFound(_0x7bf0,null))[_0xc76d('0x24')](respondWithResult(_0x7bf0,null))[_0xc76d('0x41')](handleError(_0x7bf0,null));};exports['create']=function(_0x25fc9d,_0x1ede13){return db['Tag']['create'](_0x25fc9d[_0xc76d('0x48')],{})[_0xc76d('0x24')](function(_0x48cad0){var _0xe44a25=_0x25fc9d[_0xc76d('0x49')][_0xc76d('0x26')]({'plain':!![]});if(!_0xe44a25)throw new Error(_0xc76d('0x4a'));if(_0xe44a25[_0xc76d('0x4b')]===_0xc76d('0x49')){var _0x25a549=_0x48cad0[_0xc76d('0x26')]({'plain':!![]});var _0x4452a8=_0xc76d('0x27');return db['UserProfileSection'][_0xc76d('0x47')]({'where':{'name':_0x4452a8,'userProfileId':_0xe44a25[_0xc76d('0x4c')]},'raw':!![]})[_0xc76d('0x24')](function(_0x55e3af){if(_0x55e3af&&_0x55e3af[_0xc76d('0x4d')]===0x0){return db[_0xc76d('0x28')]['create']({'name':_0x25a549[_0xc76d('0x2a')],'resourceId':_0x25a549['id'],'type':_0x55e3af['name'],'sectionId':_0x55e3af['id']},{})[_0xc76d('0x24')](function(){return _0x48cad0;});}else{return _0x48cad0;}})[_0xc76d('0x41')](function(_0x316978){logger[_0xc76d('0x29')](_0xc76d('0x4e'),_0x316978);throw _0x316978;});}return _0x48cad0;})['then'](respondWithResult(_0x1ede13,0xc9))['catch'](handleError(_0x1ede13,null));};exports['update']=function(_0x320483,_0x746759){if(_0x320483[_0xc76d('0x48')]['id']){delete _0x320483[_0xc76d('0x48')]['id'];}return db[_0xc76d('0x2c')][_0xc76d('0x47')]({'where':{'id':_0x320483['params']['id']}})[_0xc76d('0x24')](handleEntityNotFound(_0x746759,null))[_0xc76d('0x24')](saveUpdates(_0x320483[_0xc76d('0x48')],null))[_0xc76d('0x24')](respondWithResult(_0x746759,null))[_0xc76d('0x41')](handleError(_0x746759,null));};exports['destroy']=function(_0x275dfd,_0x463cbe){return db[_0xc76d('0x2c')][_0xc76d('0x47')]({'where':{'id':_0x275dfd[_0xc76d('0x43')]['id']}})[_0xc76d('0x24')](handleEntityNotFound(_0x463cbe,null))['then'](removeEntity(_0x463cbe,null))[_0xc76d('0x41')](handleError(_0x463cbe,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 1e00ad4..fdc0067 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 _0xa943=['define','Tag','tools_tags','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xa943,0x12f));var _0x3a94=function(_0xc6971f,_0x53138a){_0xc6971f=_0xc6971f-0x0;var _0x28ca53=_0xa943[_0xc6971f];return _0x28ca53;};'use strict';var _=require('lodash');var util=require(_0x3a94('0x0'));var logger=require(_0x3a94('0x1'))('api');var moment=require(_0x3a94('0x2'));var BPromise=require('bluebird');var rp=require(_0x3a94('0x3'));var fs=require('fs');var path=require(_0x3a94('0x4'));var rimraf=require(_0x3a94('0x5'));var config=require(_0x3a94('0x6'));var attributes=require(_0x3a94('0x7'));module[_0x3a94('0x8')]=function(_0x484f6b,_0x271d54){return _0x484f6b[_0x3a94('0x9')](_0x3a94('0xa'),attributes,{'tableName':_0x3a94('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe332=['util','api','moment','rimraf','../../config/environment','./tag.attributes','exports','tools_tags','lodash'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xe332,0x143));var _0x2e33=function(_0x448721,_0x45ff24){_0x448721=_0x448721-0x0;var _0x649ebc=_0xe332[_0x448721];return _0x649ebc;};'use strict';var _=require(_0x2e33('0x0'));var util=require(_0x2e33('0x1'));var logger=require('../../config/logger')(_0x2e33('0x2'));var moment=require(_0x2e33('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2e33('0x4'));var config=require(_0x2e33('0x5'));var attributes=require(_0x2e33('0x6'));module[_0x2e33('0x7')]=function(_0x18d80f,_0x50edde){return _0x18d80f['define']('Tag',attributes,{'tableName':_0x2e33('0x8'),'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 07fc87a..4db29da 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 _0x2123=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Tag,\x20%s,\x20%s','message','catch'];(function(_0x111494,_0x1d73da){var _0x1d0d8b=function(_0x344935){while(--_0x344935){_0x111494['push'](_0x111494['shift']());}};_0x1d0d8b(++_0x1d73da);}(_0x2123,0x190));var _0x3212=function(_0x410d5b,_0x131b10){_0x410d5b=_0x410d5b-0x0;var _0x3cf136=_0x2123[_0x410d5b];return _0x3cf136;};'use strict';var _=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var moment=require(_0x3212('0x2'));var BPromise=require(_0x3212('0x3'));var rs=require(_0x3212('0x4'));var fs=require('fs');var Redis=require(_0x3212('0x5'));var db=require(_0x3212('0x6'))['db'];var utils=require(_0x3212('0x7'));var logger=require(_0x3212('0x8'))(_0x3212('0x9'));var config=require(_0x3212('0xa'));var jayson=require(_0x3212('0xb'));var client=jayson['client'][_0x3212('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b1302,_0x1fec5d,_0x4b35e9){return new BPromise(function(_0x3e17a3,_0x56c38f){return client[_0x3212('0xd')](_0x2b1302,_0x4b35e9)[_0x3212('0xe')](function(_0x8ca483){logger[_0x3212('0xf')]('Tag,\x20%s,\x20%s',_0x1fec5d,'request\x20sent');logger[_0x3212('0x10')](_0x3212('0x11'),_0x1fec5d,_0x3212('0x12'),JSON[_0x3212('0x13')](_0x8ca483));if(_0x8ca483[_0x3212('0x14')]){if(_0x8ca483[_0x3212('0x14')][_0x3212('0x15')]===0x1f4){logger[_0x3212('0x14')](_0x3212('0x16'),_0x1fec5d,_0x8ca483[_0x3212('0x14')][_0x3212('0x17')]);return _0x56c38f(_0x8ca483[_0x3212('0x14')][_0x3212('0x17')]);}logger[_0x3212('0x14')](_0x3212('0x16'),_0x1fec5d,_0x8ca483[_0x3212('0x14')][_0x3212('0x17')]);return _0x3e17a3(_0x8ca483[_0x3212('0x14')][_0x3212('0x17')]);}else{logger[_0x3212('0xf')](_0x3212('0x16'),_0x1fec5d,_0x3212('0x12'));_0x3e17a3(_0x8ca483['result'][_0x3212('0x17')]);}})[_0x3212('0x18')](function(_0x2720c6){logger[_0x3212('0x14')](_0x3212('0x16'),_0x1fec5d,_0x2720c6);_0x56c38f(_0x2720c6);});});} \ No newline at end of file +var _0x4fdb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x51652a,_0x5144fc){var _0xae7099=function(_0x4b239b){while(--_0x4b239b){_0x51652a['push'](_0x51652a['shift']());}};_0xae7099(++_0x5144fc);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x77e1f4,_0x1f4a2e){_0x77e1f4=_0x77e1f4-0x0;var _0x383ece=_0x4fdb[_0x77e1f4];return _0x383ece;};'use strict';var _=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var moment=require(_0xb4fd('0x2'));var BPromise=require(_0xb4fd('0x3'));var rs=require(_0xb4fd('0x4'));var fs=require('fs');var Redis=require(_0xb4fd('0x5'));var db=require(_0xb4fd('0x6'))['db'];var utils=require(_0xb4fd('0x7'));var logger=require(_0xb4fd('0x8'))('rpc');var config=require(_0xb4fd('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb4fd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53273f,_0x299bff,_0x3af8e3){return new BPromise(function(_0x1151b5,_0x52dca2){return client['request'](_0x53273f,_0x3af8e3)[_0xb4fd('0xb')](function(_0x4f9d18){logger[_0xb4fd('0xc')]('Tag,\x20%s,\x20%s',_0x299bff,_0xb4fd('0xd'));logger[_0xb4fd('0xe')](_0xb4fd('0xf'),_0x299bff,_0xb4fd('0xd'),JSON[_0xb4fd('0x10')](_0x4f9d18));if(_0x4f9d18['error']){if(_0x4f9d18[_0xb4fd('0x11')][_0xb4fd('0x12')]===0x1f4){logger[_0xb4fd('0x11')](_0xb4fd('0x13'),_0x299bff,_0x4f9d18['error'][_0xb4fd('0x14')]);return _0x52dca2(_0x4f9d18[_0xb4fd('0x11')][_0xb4fd('0x14')]);}logger['error'](_0xb4fd('0x13'),_0x299bff,_0x4f9d18[_0xb4fd('0x11')][_0xb4fd('0x14')]);return _0x1151b5(_0x4f9d18[_0xb4fd('0x11')][_0xb4fd('0x14')]);}else{logger[_0xb4fd('0xc')](_0xb4fd('0x13'),_0x299bff,'request\x20sent');_0x1151b5(_0x4f9d18[_0xb4fd('0x15')][_0xb4fd('0x14')]);}})[_0xb4fd('0x16')](function(_0x2d4701){logger[_0xb4fd('0x11')](_0xb4fd('0x13'),_0x299bff,_0x2d4701);_0x52dca2(_0x2d4701);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 6805901..47a9d84 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(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 e8059f9..d0f772c 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 _0xb10b=['name','sequelize','STRING'];(function(_0x5aae40,_0x3fa0a5){var _0x2e6f0f=function(_0x170621){while(--_0x170621){_0x5aae40['push'](_0x5aae40['shift']());}};_0x2e6f0f(++_0x3fa0a5);}(_0xb10b,0x12a));var _0xbb10=function(_0x72ee00,_0x4f9a0c){_0x72ee00=_0x72ee00-0x0;var _0x4da881=_0xb10b[_0x72ee00];return _0x4da881;};'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 _0xe706=['STRING','sequelize','exports'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xe706,0xa3));var _0x6e70=function(_0x31d03c,_0x158cef){_0x31d03c=_0x31d03c-0x0;var _0x420e61=_0xe706[_0x31d03c];return _0x420e61;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index fa9246b..7474710 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 _0xdf88=['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','update','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','findOne','channel','ValidationError','capitalize','Queue','order','toLowerCase','Queues','Unknown\x20channel','add','ids','isValidChannel','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','through','penalty','QueueId','defaults','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','voicePause','UserVoiceQueueRt','isNil','format','SIP/%s','interface','all','upsert','removeAgents','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','./team.socket','register','end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','sendStatus','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','Team','includeAll','findAll','rows','catch','show','params','include'];(function(_0x56daff,_0xadca9a){var _0x132c82=function(_0x19e0d7){while(--_0x19e0d7){_0x56daff['push'](_0x56daff['shift']());}};_0x132c82(++_0xadca9a);}(_0xdf88,0xea));var _0x8df8=function(_0x27ee1c,_0x5d93b7){_0x27ee1c=_0x27ee1c-0x0;var _0x226db3=_0xdf88[_0x27ee1c];return _0x226db3;};'use strict';var emlformat=require(_0x8df8('0x0'));var rimraf=require(_0x8df8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8df8('0x2'));var rp=require(_0x8df8('0x3'));var moment=require('moment');var BPromise=require(_0x8df8('0x4'));var Mustache=require('mustache');var util=require(_0x8df8('0x5'));var path=require(_0x8df8('0x6'));var sox=require(_0x8df8('0x7'));var csv=require(_0x8df8('0x8'));var ejs=require(_0x8df8('0x9'));var fs=require('fs');var fs_extra=require(_0x8df8('0xa'));var _=require(_0x8df8('0xb'));var squel=require(_0x8df8('0xc'));var crypto=require(_0x8df8('0xd'));var jsforce=require(_0x8df8('0xe'));var deskjs=require(_0x8df8('0xf'));var toCsv=require(_0x8df8('0x8'));var querystring=require(_0x8df8('0x10'));var Papa=require(_0x8df8('0x11'));var Redis=require(_0x8df8('0x12'));var authService=require(_0x8df8('0x13'));var qs=require(_0x8df8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8df8('0x15'));var logger=require(_0x8df8('0x16'))(_0x8df8('0x17'));var utils=require(_0x8df8('0x18'));var config=require(_0x8df8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8df8('0x1a'))['db'];config[_0x8df8('0x1b')]=_['defaults'](config[_0x8df8('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8df8('0x1b')]));require(_0x8df8('0x1c'))[_0x8df8('0x1d')](socket);function respondWithStatusCode(_0xa89d94,_0xf87011){_0xf87011=_0xf87011||0xcc;return function(_0xf7c167){if(_0xf7c167){return _0xa89d94['sendStatus'](_0xf87011);}return _0xa89d94['status'](_0xf87011)[_0x8df8('0x1e')]();};}function respondWithResult(_0x116a17,_0x5e17c6){_0x5e17c6=_0x5e17c6||0xc8;return function(_0x5c47c2){if(_0x5c47c2){return _0x116a17[_0x8df8('0x1f')](_0x5e17c6)[_0x8df8('0x20')](_0x5c47c2);}};}function respondWithFilteredResult(_0x120c29,_0x910bc4){return function(_0x57e73e){if(_0x57e73e){var _0x41d616=typeof _0x910bc4[_0x8df8('0x21')]===_0x8df8('0x22')&&typeof _0x910bc4[_0x8df8('0x23')]==='undefined';var _0x534227=_0x57e73e[_0x8df8('0x24')];var _0x1e6b02=_0x41d616?0x0:_0x910bc4[_0x8df8('0x21')];var _0x41f8d7=_0x41d616?_0x57e73e[_0x8df8('0x24')]:_0x910bc4['offset']+_0x910bc4[_0x8df8('0x23')];var _0x4d21d1;if(_0x41f8d7>=_0x534227){_0x41f8d7=_0x534227;_0x4d21d1=0xc8;}else{_0x4d21d1=0xce;}_0x120c29[_0x8df8('0x1f')](_0x4d21d1);return _0x120c29[_0x8df8('0x25')]('Content-Range',_0x1e6b02+'-'+_0x41f8d7+'/'+_0x534227)[_0x8df8('0x20')](_0x57e73e);}return null;};}function patchUpdates(_0x122b72){return function(_0x2390c3){try{jsonpatch[_0x8df8('0x26')](_0x2390c3,_0x122b72,!![]);}catch(_0x1fb6cf){return BPromise[_0x8df8('0x27')](_0x1fb6cf);}return _0x2390c3[_0x8df8('0x28')]();};}function saveUpdates(_0x5db118,_0x240b0d){return function(_0x267dd9){if(_0x267dd9){return _0x267dd9['update'](_0x5db118)[_0x8df8('0x29')](function(_0x6a2715){return _0x6a2715;});}return null;};}function handleEntityNotFound(_0x1b92c7,_0x5c5c04){return function(_0x138766){if(!_0x138766){_0x1b92c7[_0x8df8('0x2a')](0x194);}return _0x138766;};}function handleError(_0x27e6c4,_0x13e781){_0x13e781=_0x13e781||0x1f4;return function(_0x167d2b){logger['error'](_0x167d2b[_0x8df8('0x2b')]);if(_0x167d2b['name']){delete _0x167d2b[_0x8df8('0x2c')];}_0x27e6c4['status'](_0x13e781)[_0x8df8('0x2d')](_0x167d2b);};}exports[_0x8df8('0x2e')]=function(_0x1cd860,_0x15141c){var _0x5e17e2={},_0x4ab369={},_0x72a4ef={'count':0x0,'rows':[]};var _0x8a9d80=_[_0x8df8('0x2f')](db['Team'][_0x8df8('0x30')],function(_0x5dc359){return{'name':_0x5dc359['fieldName'],'type':_0x5dc359[_0x8df8('0x31')][_0x8df8('0x32')]};});_0x4ab369[_0x8df8('0x33')]=_['map'](_0x8a9d80,_0x8df8('0x2c'));_0x4ab369[_0x8df8('0x34')]=_[_0x8df8('0x35')](_0x1cd860['query']);_0x4ab369['filters']=_[_0x8df8('0x36')](_0x4ab369[_0x8df8('0x33')],_0x4ab369[_0x8df8('0x34')]);_0x5e17e2[_0x8df8('0x37')]=_[_0x8df8('0x36')](_0x4ab369[_0x8df8('0x33')],qs[_0x8df8('0x38')](_0x1cd860[_0x8df8('0x34')][_0x8df8('0x38')]));_0x5e17e2[_0x8df8('0x37')]=_0x5e17e2[_0x8df8('0x37')][_0x8df8('0x39')]?_0x5e17e2[_0x8df8('0x37')]:_0x4ab369[_0x8df8('0x33')];if(!_0x1cd860[_0x8df8('0x34')][_0x8df8('0x3a')](_0x8df8('0x3b'))){_0x5e17e2['limit']=qs[_0x8df8('0x23')](_0x1cd860['query'][_0x8df8('0x23')]);_0x5e17e2[_0x8df8('0x21')]=qs[_0x8df8('0x21')](_0x1cd860[_0x8df8('0x34')][_0x8df8('0x21')]);}_0x5e17e2['order']=qs[_0x8df8('0x3c')](_0x1cd860['query']['sort']);_0x5e17e2[_0x8df8('0x3d')]=qs[_0x8df8('0x3e')](_[_0x8df8('0x3f')](_0x1cd860[_0x8df8('0x34')],_0x4ab369['filters']),_0x8a9d80);if(_0x1cd860['query'][_0x8df8('0x40')]){_0x5e17e2[_0x8df8('0x3d')]=_[_0x8df8('0x41')](_0x5e17e2[_0x8df8('0x3d')],{'$or':_[_0x8df8('0x2f')](_0x8a9d80,function(_0x4191b9){if(_0x4191b9[_0x8df8('0x31')]!==_0x8df8('0x42')){var _0x34d5c4={};_0x34d5c4[_0x4191b9['name']]={'$like':'%'+_0x1cd860[_0x8df8('0x34')]['filter']+'%'};return _0x34d5c4;}})});}_0x5e17e2=_[_0x8df8('0x41')]({},_0x5e17e2,_0x1cd860[_0x8df8('0x43')]);var _0x356ee0={'where':_0x5e17e2[_0x8df8('0x3d')]};return db[_0x8df8('0x44')][_0x8df8('0x24')](_0x356ee0)[_0x8df8('0x29')](function(_0x362f6b){_0x72a4ef[_0x8df8('0x24')]=_0x362f6b;if(_0x1cd860[_0x8df8('0x34')][_0x8df8('0x45')]){_0x5e17e2['include']=[{'all':!![]}];}return db[_0x8df8('0x44')][_0x8df8('0x46')](_0x5e17e2);})[_0x8df8('0x29')](function(_0x548a49){_0x72a4ef[_0x8df8('0x47')]=_0x548a49;return _0x72a4ef;})[_0x8df8('0x29')](respondWithFilteredResult(_0x15141c,_0x5e17e2))[_0x8df8('0x48')](handleError(_0x15141c,null));};exports[_0x8df8('0x49')]=function(_0x4431c4,_0x4b937b){var _0x572b32={'raw':![],'where':{'id':_0x4431c4[_0x8df8('0x4a')]['id']}},_0x14456f={};_0x14456f[_0x8df8('0x33')]=_['keys'](db[_0x8df8('0x44')][_0x8df8('0x30')]);_0x14456f[_0x8df8('0x34')]=_[_0x8df8('0x35')](_0x4431c4[_0x8df8('0x34')]);_0x14456f[_0x8df8('0x3e')]=_[_0x8df8('0x36')](_0x14456f[_0x8df8('0x33')],_0x14456f[_0x8df8('0x34')]);_0x572b32[_0x8df8('0x37')]=_[_0x8df8('0x36')](_0x14456f[_0x8df8('0x33')],qs[_0x8df8('0x38')](_0x4431c4['query'][_0x8df8('0x38')]));_0x572b32[_0x8df8('0x37')]=_0x572b32['attributes']['length']?_0x572b32[_0x8df8('0x37')]:_0x14456f[_0x8df8('0x33')];if(_0x4431c4[_0x8df8('0x34')][_0x8df8('0x45')]){_0x572b32[_0x8df8('0x4b')]=[{'all':!![]}];}_0x572b32=_['merge']({},_0x572b32,_0x4431c4['options']);return db['Team'][_0x8df8('0x4c')](_0x572b32)[_0x8df8('0x29')](handleEntityNotFound(_0x4b937b,null))[_0x8df8('0x29')](respondWithResult(_0x4b937b,null))['catch'](handleError(_0x4b937b,null));};exports[_0x8df8('0x4d')]=function(_0x1a6c07,_0x1fe273){return db[_0x8df8('0x44')][_0x8df8('0x4d')](_0x1a6c07[_0x8df8('0x4e')],{})['then'](function(_0xa71cc0){var _0x5ac25e=_0x1a6c07[_0x8df8('0x4f')][_0x8df8('0x50')]({'plain':!![]});if(!_0x5ac25e)throw new Error(_0x8df8('0x51'));if(_0x5ac25e[_0x8df8('0x52')]===_0x8df8('0x4f')){var _0x43cccb=_0xa71cc0[_0x8df8('0x50')]({'plain':!![]});var _0x117964='Teams';return db[_0x8df8('0x53')][_0x8df8('0x4c')]({'where':{'name':_0x117964,'userProfileId':_0x5ac25e[_0x8df8('0x54')]},'raw':!![]})['then'](function(_0x190502){if(_0x190502&&_0x190502[_0x8df8('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x43cccb['name'],'resourceId':_0x43cccb['id'],'type':_0x190502[_0x8df8('0x2c')],'sectionId':_0x190502['id']},{})[_0x8df8('0x29')](function(){return _0xa71cc0;});}else{return _0xa71cc0;}})[_0x8df8('0x48')](function(_0x3c9446){logger['error'](_0x8df8('0x56'),_0x3c9446);throw _0x3c9446;});}return _0xa71cc0;})[_0x8df8('0x29')](respondWithResult(_0x1fe273,0xc9))[_0x8df8('0x48')](handleError(_0x1fe273,null));};exports[_0x8df8('0x57')]=function(_0x4e66b3,_0x35351d){if(_0x4e66b3[_0x8df8('0x4e')]['id']){delete _0x4e66b3[_0x8df8('0x4e')]['id'];}return db[_0x8df8('0x44')][_0x8df8('0x4c')]({'where':{'id':_0x4e66b3[_0x8df8('0x4a')]['id']}})[_0x8df8('0x29')](handleEntityNotFound(_0x35351d,null))['then'](saveUpdates(_0x4e66b3[_0x8df8('0x4e')],null))['then'](respondWithResult(_0x35351d,null))[_0x8df8('0x48')](handleError(_0x35351d,null));};exports['destroy']=function(_0x527217,_0x5b3503){var _0x50c689=_0x527217[_0x8df8('0x4a')]['id'];var _0x55ab26=[];return db['sequelize'][_0x8df8('0x58')](function(_0x53f071){var _0xafde5c=_0x8df8('0x59')+_0x50c689;return db[_0x8df8('0x5a')]['query'](_0xafde5c,{'type':db[_0x8df8('0x5b')][_0x8df8('0x5c')][_0x8df8('0x5d')],'raw':!![],'transaction':_0x53f071})[_0x8df8('0x29')](function(_0x53d299){_0x55ab26=_['map'](_0x53d299,function(_0x85d21e){return Number(_0x85d21e[_0x8df8('0x5e')]);});})['then'](function(){var _0x575007=_0x8df8('0x5f')+_0x50c689;return db[_0x8df8('0x5a')][_0x8df8('0x34')](_0x575007,{'type':db[_0x8df8('0x5b')][_0x8df8('0x5c')][_0x8df8('0x5d')],'raw':!![],'transaction':_0x53f071});})['then'](function(_0x5207c5){var _0x2b3f65=_[_0x8df8('0x2f')](_0x5207c5,function(_0x901240){return Number(_0x901240[_0x8df8('0x60')]);});return db[_0x8df8('0x61')][_0x8df8('0x62')]({'where':{'UserId':{'$in':_0x55ab26},'VoiceQueueId':{'$in':_0x2b3f65}},'transaction':_0x53f071});})[_0x8df8('0x29')](function(){var _0x562eba=_0x8df8('0x63')+_0x50c689;return db[_0x8df8('0x5a')][_0x8df8('0x34')](_0x562eba,{'type':db[_0x8df8('0x5b')][_0x8df8('0x5c')][_0x8df8('0x5d')],'raw':!![],'transaction':_0x53f071});})[_0x8df8('0x29')](function(_0x3caed0){var _0x53d71d=_[_0x8df8('0x2f')](_0x3caed0,function(_0x403223){return Number(_0x403223[_0x8df8('0x64')]);});return db['UserMailQueue'][_0x8df8('0x62')]({'where':{'UserId':{'$in':_0x55ab26},'MailQueueId':{'$in':_0x53d71d}},'transaction':_0x53f071});})[_0x8df8('0x29')](function(){var _0x5c36fb=_0x8df8('0x65')+_0x50c689;return db[_0x8df8('0x5a')]['query'](_0x5c36fb,{'type':db['Sequelize'][_0x8df8('0x5c')][_0x8df8('0x5d')],'raw':!![],'transaction':_0x53f071});})[_0x8df8('0x29')](function(_0x2edb09){var _0xd8693d=_['map'](_0x2edb09,function(_0x198084){return Number(_0x198084['SmsQueueId']);});return db['UserSmsQueue'][_0x8df8('0x62')]({'where':{'UserId':{'$in':_0x55ab26},'SmsQueueId':{'$in':_0xd8693d}},'transaction':_0x53f071});})[_0x8df8('0x29')](function(){var _0x412be9=_0x8df8('0x66')+_0x50c689;return db[_0x8df8('0x5a')][_0x8df8('0x34')](_0x412be9,{'type':db[_0x8df8('0x5b')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x53f071});})[_0x8df8('0x29')](function(_0x8800b5){var _0x3f8a95=_['map'](_0x8800b5,function(_0x7da70b){return Number(_0x7da70b['ChatQueueId']);});return db['UserChatQueue'][_0x8df8('0x62')]({'where':{'UserId':{'$in':_0x55ab26},'ChatQueueId':{'$in':_0x3f8a95}},'transaction':_0x53f071});})[_0x8df8('0x29')](function(){var _0x5eee97='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x50c689;return db[_0x8df8('0x5a')][_0x8df8('0x34')](_0x5eee97,{'type':db[_0x8df8('0x5b')][_0x8df8('0x5c')][_0x8df8('0x5d')],'raw':!![],'transaction':_0x53f071});})[_0x8df8('0x29')](function(_0x1b988c){var _0x11b608=_[_0x8df8('0x2f')](_0x1b988c,function(_0xd651f1){return Number(_0xd651f1[_0x8df8('0x67')]);});return db['UserFaxQueue'][_0x8df8('0x62')]({'where':{'UserId':{'$in':_0x55ab26},'FaxQueueId':{'$in':_0x11b608}},'transaction':_0x53f071});})['then'](function(){var _0x1ae117=_0x8df8('0x68')+_0x50c689;return db[_0x8df8('0x5a')]['query'](_0x1ae117,{'type':db['Sequelize'][_0x8df8('0x5c')][_0x8df8('0x5d')],'raw':!![],'transaction':_0x53f071});})[_0x8df8('0x29')](function(_0x48678a){var _0x3e063e=_[_0x8df8('0x2f')](_0x48678a,function(_0x50fbd8){return Number(_0x50fbd8[_0x8df8('0x69')]);});return db[_0x8df8('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x55ab26},'OpenchannelQueueId':{'$in':_0x3e063e}},'transaction':_0x53f071});})['then'](function(){var _0x244108='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x50c689;return db[_0x8df8('0x5a')][_0x8df8('0x34')](_0x244108,{'type':db[_0x8df8('0x5b')]['QueryTypes'][_0x8df8('0x5d')],'raw':!![],'transaction':_0x53f071});})['then'](function(_0x2ea097){var _0x57320a=_[_0x8df8('0x2f')](_0x2ea097,function(_0x14e3c8){return Number(_0x14e3c8[_0x8df8('0x6b')]);});return db['UserWhatsappQueue'][_0x8df8('0x62')]({'where':{'UserId':{'$in':_0x55ab26},'WhatsappQueueId':{'$in':_0x57320a}},'transaction':_0x53f071});})[_0x8df8('0x29')](function(){return db[_0x8df8('0x6c')]['find']({'where':{'TeamId':_0x50c689}});})[_0x8df8('0x29')](function(_0x47a856){if(_0x47a856===null){return;}return db[_0x8df8('0x6d')][_0x8df8('0x62')]({'where':{'UserId':{'$in':_0x55ab26},'VoicePrefixId':_0x47a856[_0x8df8('0x6e')]},'transaction':_0x53f071});})['then'](function(){return db[_0x8df8('0x44')][_0x8df8('0x62')]({'where':{'id':_0x50c689},'cascade':!![],'transaction':_0x53f071});})[_0x8df8('0x29')](function(_0x6d3dd9){if(_0x6d3dd9===0x0){_0x5b3503['sendStatus'](0x194);}else{return db[_0x8df8('0x6f')][_0x8df8('0x62')]({'where':{'type':'Teams','resourceId':_0x50c689},'cascade':!![],'transaction':_0x53f071})[_0x8df8('0x29')](function(){_0x5b3503[_0x8df8('0x1f')](0xcc)[_0x8df8('0x1e')]();});}})[_0x8df8('0x48')](function(_0x4e22b4){_0x5b3503['status'](0x1f4)[_0x8df8('0x2d')](_0x4e22b4);});});};exports[_0x8df8('0x70')]=function(_0x1dd6af,_0x113c05,_0x4b0ec6){return db[_0x8df8('0x44')][_0x8df8('0x71')]({'where':{'id':_0x1dd6af[_0x8df8('0x4a')]['id']}})[_0x8df8('0x29')](handleEntityNotFound(_0x113c05,null))[_0x8df8('0x29')](function(_0x421676){if(!_0x1dd6af[_0x8df8('0x34')][_0x8df8('0x72')]||!utils['isValidChannel'](_0x1dd6af['query'][_0x8df8('0x72')])){throw new db['Sequelize'][(_0x8df8('0x73'))]('Unknown\x20channel');}var _0x759778={};var _0x3a34c1={};_0x3a34c1[_0x8df8('0x33')]=_[_0x8df8('0x35')](db[_[_0x8df8('0x74')](_0x1dd6af[_0x8df8('0x34')][_0x8df8('0x72')]['toLowerCase']())+_0x8df8('0x75')][_0x8df8('0x30')]);_0x3a34c1['query']=_['keys'](_0x1dd6af[_0x8df8('0x34')]);_0x3a34c1[_0x8df8('0x3e')]=_[_0x8df8('0x36')](_0x3a34c1[_0x8df8('0x33')],_0x3a34c1[_0x8df8('0x34')]);_0x759778[_0x8df8('0x37')]=_[_0x8df8('0x36')](_0x3a34c1['model'],qs[_0x8df8('0x38')](_0x1dd6af['query']['fields']));_0x759778[_0x8df8('0x37')]=_0x759778[_0x8df8('0x37')]['length']?_0x759778['attributes']:_0x3a34c1[_0x8df8('0x33')];_0x759778['limit']=qs[_0x8df8('0x23')](_0x1dd6af[_0x8df8('0x34')][_0x8df8('0x23')]);_0x759778[_0x8df8('0x21')]=qs['offset'](_0x1dd6af[_0x8df8('0x34')][_0x8df8('0x21')]);_0x759778[_0x8df8('0x76')]=qs[_0x8df8('0x3c')](_0x1dd6af[_0x8df8('0x34')]['sort']);_0x759778[_0x8df8('0x3d')]=qs[_0x8df8('0x3e')](_[_0x8df8('0x3f')](_0x1dd6af[_0x8df8('0x34')],_0x3a34c1[_0x8df8('0x3e')]));_0x759778=_[_0x8df8('0x41')]({},_0x759778,_0x1dd6af[_0x8df8('0x43')]);return _0x421676[_0x8df8('0x50')+_[_0x8df8('0x74')](_0x1dd6af[_0x8df8('0x34')]['channel'][_0x8df8('0x77')]())+_0x8df8('0x78')](_0x759778);})[_0x8df8('0x29')](respondWithResult(_0x113c05,null))[_0x8df8('0x48')](handleError(_0x113c05,null));};exports['addQueues']=function(_0x42e7fa,_0x1334a3,_0x17bcff){return db[_0x8df8('0x44')][_0x8df8('0x71')]({'where':{'id':_0x42e7fa[_0x8df8('0x4a')]['id']}})[_0x8df8('0x29')](function(_0x7fab13){if(_0x7fab13){if(!_0x42e7fa[_0x8df8('0x4e')]['channel']||!utils['isValidChannel'](_0x42e7fa['body'][_0x8df8('0x72')])){throw new db[(_0x8df8('0x5b'))][(_0x8df8('0x73'))](_0x8df8('0x79'));}return _0x7fab13[_0x8df8('0x7a')+_['capitalize'](_0x42e7fa[_0x8df8('0x4e')][_0x8df8('0x72')]['toLowerCase']())+_0x8df8('0x78')](_0x42e7fa[_0x8df8('0x4e')][_0x8df8('0x7b')]);}return null;})['then'](handleEntityNotFound(_0x1334a3,null))[_0x8df8('0x29')](respondWithStatusCode(_0x1334a3,null))[_0x8df8('0x48')](handleError(_0x1334a3,null));};exports['removeQueues']=function(_0x11258c,_0xf967a6,_0x365ebc){return db[_0x8df8('0x44')][_0x8df8('0x71')]({'where':{'id':_0x11258c[_0x8df8('0x4a')]['id']}})[_0x8df8('0x29')](function(_0x32304d){if(_0x32304d){if(!_0x11258c[_0x8df8('0x34')][_0x8df8('0x72')]||!utils[_0x8df8('0x7c')](_0x11258c[_0x8df8('0x34')][_0x8df8('0x72')])){throw new db[(_0x8df8('0x5b'))][(_0x8df8('0x73'))](_0x8df8('0x79'));}return _0x32304d[_0x8df8('0x7d')+_['capitalize'](_0x11258c[_0x8df8('0x34')][_0x8df8('0x72')][_0x8df8('0x77')]())+_0x8df8('0x78')](_0x11258c[_0x8df8('0x34')][_0x8df8('0x7b')]);}return null;})['then'](handleEntityNotFound(_0xf967a6,null))[_0x8df8('0x29')](respondWithStatusCode(_0xf967a6,null))[_0x8df8('0x48')](handleError(_0xf967a6,null));};exports[_0x8df8('0x7e')]=function(_0x39b289,_0xbe39c8){var _0x3c0306=_[_0x8df8('0x7f')](_0x39b289[_0x8df8('0x4e')]['ids'])?_0x39b289[_0x8df8('0x4e')]['ids']:[_0x39b289[_0x8df8('0x4e')][_0x8df8('0x7b')]];var _0x20f288=_0x39b289[_0x8df8('0x4a')]['id'];return db['Team'][_0x8df8('0x4c')]({'where':{'id':_0x20f288}})['then'](handleEntityNotFound(_0xbe39c8,null))[_0x8df8('0x29')](function(_0x64cd8c){if(_0x64cd8c){var _0x4c6156=[_0x8df8('0x80'),_0x8df8('0x81'),_0x8df8('0x82'),_0x8df8('0x83'),_0x8df8('0x84'),_0x8df8('0x85'),_0x8df8('0x86')];return db[_0x8df8('0x5a')][_0x8df8('0x58')](function(_0xaec0e3){var _0x705b28=_[_0x8df8('0x2f')](_0x4c6156,function(_0x1643f9){var _0x528352={'attributes':['id',_0x8df8('0x2c')]};if(_0x1643f9==='Voice'){_0x528352[_0x8df8('0x87')]={'attributes':[_0x8df8('0x88')]};}return _0x64cd8c[_0x8df8('0x50')+_0x1643f9+_0x8df8('0x78')](_0x528352)['then'](function(_0x4861b1){var _0xb7b2f4=_['map'](_0x4861b1,function(_0x214549){var _0xe5965e=_[_0x8df8('0x2f')](_0x3c0306,function(_0xaca709){var _0x58be6a={'where':{'UserId':_0xaca709,[_0x1643f9+_0x8df8('0x89')]:_0x214549['id']},'transaction':_0xaec0e3};if(_0x1643f9==='Voice'){_0x58be6a[_0x8df8('0x8a')]={'penalty':_0x214549[_0x8df8('0x8b')]['penalty']};}return db[_0x8df8('0x8c')+_0x1643f9+_0x8df8('0x75')][_0x8df8('0x8d')](_0x58be6a)[_0x8df8('0x29')](function(){socket[_0x8df8('0x8e')]('user'+_0x1643f9+_0x8df8('0x8f'),{'UserId':_0xaca709,[_0x1643f9+_0x8df8('0x89')]:_0x214549['id']});if(_0x1643f9!=='Voice'){return;}return db[_0x8df8('0x8c')]['findAll']({'where':{'id':_0x3c0306,'online':0x1},'attributes':['id',_0x8df8('0x2c'),_0x8df8('0x90'),_0x8df8('0x91'),'interface'],'raw':!![]})[_0x8df8('0x29')](function(_0x25ce65){var _0x51a928=_[_0x8df8('0x2f')](_0x25ce65,function(_0x48d2ac){return db[_0x8df8('0x92')]['upsert']({'membername':_0x48d2ac['name'],'UserId':_0x48d2ac['id'],'queue_name':_0x214549[_0x8df8('0x2c')],'VoiceQueueId':_0x214549['id'],'interface':_[_0x8df8('0x93')](_0x48d2ac['interface'])?util[_0x8df8('0x94')](_0x8df8('0x95'),_0x48d2ac['name']):_0x48d2ac[_0x8df8('0x96')],'paused':_0x48d2ac[_0x8df8('0x91')]||![],'penalty':_0x214549[_0x8df8('0x8b')][_0x8df8('0x88')]},{'transaction':_0xaec0e3});});return Promise[_0x8df8('0x97')](_0x51a928);});});});return Promise['all'](_0xe5965e);});return Promise[_0x8df8('0x97')](_0xb7b2f4);})['then'](function(){return db[_0x8df8('0x6c')][_0x8df8('0x71')]({'where':{'teamId':_0x20f288}})[_0x8df8('0x29')](function(_0x401295){if(_0x401295){var _0x24699f=_[_0x8df8('0x2f')](_0x3c0306,function(_0x458e2f){db[_0x8df8('0x6d')][_0x8df8('0x98')]({'UserId':_0x458e2f,'VoicePrefixId':_0x401295[_0x8df8('0x6e')]});});return Promise[_0x8df8('0x97')](_0x24699f);}});});});return Promise['all'](_0x705b28)[_0x8df8('0x29')](function(){return _0x64cd8c[_0x8df8('0x7e')](_0x3c0306,{'transaction':_0xaec0e3})['spread'](function(_0x575423){return _0x575423;});});});}})[_0x8df8('0x29')](respondWithResult(_0xbe39c8,null))[_0x8df8('0x48')](handleError(_0xbe39c8,null));};exports[_0x8df8('0x99')]=function(_0x4701a8,_0x4eafe8){var _0x33ef2f=_['isArray'](_0x4701a8[_0x8df8('0x34')][_0x8df8('0x7b')])?_0x4701a8[_0x8df8('0x34')]['ids']:[_0x4701a8[_0x8df8('0x34')][_0x8df8('0x7b')]];var _0x25181b=_0x4701a8['params']['id'];return db[_0x8df8('0x44')][_0x8df8('0x4c')]({'where':{'id':_0x25181b}})[_0x8df8('0x29')](handleEntityNotFound(_0x4eafe8,null))[_0x8df8('0x29')](function(_0x317bc1){if(_0x317bc1){var _0x848e0f=['Voice',_0x8df8('0x81'),'Mail',_0x8df8('0x83'),_0x8df8('0x84'),_0x8df8('0x85'),'Whatsapp'];return db[_0x8df8('0x5a')][_0x8df8('0x58')](function(_0xc7c01f){var _0x41956b=_[_0x8df8('0x2f')](_0x848e0f,function(_0x346b52){var _0x2b65f4={'attributes':['id',_0x8df8('0x2c')]};return _0x317bc1[_0x8df8('0x50')+_0x346b52+_0x8df8('0x78')](_0x2b65f4)[_0x8df8('0x29')](function(_0x1038dc){var _0x3bbf0c=_[_0x8df8('0x2f')](_0x1038dc,function(_0x26aa12){return _0x26aa12[_0x8df8('0x99')](_0x33ef2f,{'transaction':_0xc7c01f})[_0x8df8('0x29')](function(){var _0x5091d0=_[_0x8df8('0x2f')](_0x33ef2f,function(_0x24eb1a){socket[_0x8df8('0x8e')](_0x8df8('0x4f')+_0x346b52+'Queue:remove',{'UserId':Number(_0x24eb1a),[_0x346b52+_0x8df8('0x89')]:_0x26aa12['id']});if(_0x346b52!==_0x8df8('0x80')){return;}return db['UserVoiceQueueRt'][_0x8df8('0x62')]({'where':{'VoiceQueueId':_0x26aa12['id'],'UserId':_0x24eb1a},'transaction':_0xc7c01f});});return Promise['all'](_0x5091d0);});});return Promise[_0x8df8('0x97')](_0x3bbf0c);});});return Promise[_0x8df8('0x97')](_0x41956b)[_0x8df8('0x29')](function(){return _0x317bc1[_0x8df8('0x99')](_0x33ef2f,{'transaction':_0xc7c01f});})[_0x8df8('0x29')](function(){return db[_0x8df8('0x6c')][_0x8df8('0x71')]({'where':{'teamId':_0x25181b}})[_0x8df8('0x29')](function(_0x44cf42){if(_0x44cf42){var _0x4d0073=_[_0x8df8('0x2f')](_0x33ef2f,function(_0xf2e71f){db[_0x8df8('0x6d')][_0x8df8('0x62')]({'where':{'UserId':_0xf2e71f,'VoicePrefixId':_0x44cf42[_0x8df8('0x6e')]}});});return Promise[_0x8df8('0x97')](_0x4d0073);}});});});}})[_0x8df8('0x29')](respondWithStatusCode(_0x4eafe8,null))[_0x8df8('0x48')](handleError(_0x4eafe8,null));};exports['getAgents']=function(_0x3ca8f7,_0x36d862,_0x38b382){var _0x4a6c78={};var _0xda2523={};var _0x32ea32;var _0x407aea;return db[_0x8df8('0x44')]['findOne']({'where':{'id':_0x3ca8f7['params']['id']}})[_0x8df8('0x29')](handleEntityNotFound(_0x36d862,null))[_0x8df8('0x29')](function(_0xbfb0f1){if(_0xbfb0f1){_0x32ea32=_0xbfb0f1;_0xda2523[_0x8df8('0x33')]=_[_0x8df8('0x35')](db[_0x8df8('0x8c')][_0x8df8('0x30')]);_0xda2523[_0x8df8('0x34')]=_[_0x8df8('0x35')](_0x3ca8f7[_0x8df8('0x34')]);_0xda2523[_0x8df8('0x3e')]=_['intersection'](_0xda2523['model'],_0xda2523['query']);_0x4a6c78['attributes']=_['intersection'](_0xda2523['model'],qs[_0x8df8('0x38')](_0x3ca8f7['query'][_0x8df8('0x38')]));_0x4a6c78[_0x8df8('0x37')]=_0x4a6c78[_0x8df8('0x37')][_0x8df8('0x39')]?_0x4a6c78[_0x8df8('0x37')]:_0xda2523[_0x8df8('0x33')];_0x4a6c78['order']=qs[_0x8df8('0x3c')](_0x3ca8f7[_0x8df8('0x34')]['sort']);_0x4a6c78['where']=qs[_0x8df8('0x3e')](_[_0x8df8('0x3f')](_0x3ca8f7[_0x8df8('0x34')],_0xda2523[_0x8df8('0x3e')]));if(_0x3ca8f7[_0x8df8('0x34')][_0x8df8('0x40')]){_0x4a6c78['where']=_[_0x8df8('0x41')](_0x4a6c78['where'],{'$or':_['map'](_0x4a6c78[_0x8df8('0x37')],function(_0x1b4615){var _0x341a4d={};_0x341a4d[_0x1b4615]={'$like':'%'+_0x3ca8f7['query']['filter']+'%'};return _0x341a4d;})});}_0x4a6c78=_[_0x8df8('0x41')]({},_0x4a6c78,_0x3ca8f7['options']);return _0x32ea32['getAgents'](_0x4a6c78);}})[_0x8df8('0x29')](function(_0x2d8fb1){if(_0x2d8fb1){_0x407aea=_0x2d8fb1['length'];if(!_0x3ca8f7[_0x8df8('0x34')][_0x8df8('0x3a')](_0x8df8('0x3b'))){_0x4a6c78[_0x8df8('0x23')]=qs['limit'](_0x3ca8f7[_0x8df8('0x34')][_0x8df8('0x23')]);_0x4a6c78[_0x8df8('0x21')]=qs[_0x8df8('0x21')](_0x3ca8f7['query'][_0x8df8('0x21')]);}return _0x32ea32[_0x8df8('0x9a')](_0x4a6c78);}})[_0x8df8('0x29')](function(_0x496dbe){if(_0x496dbe){return _0x496dbe?{'count':_0x407aea,'rows':_0x496dbe}:null;}})[_0x8df8('0x29')](respondWithResult(_0x36d862,null))[_0x8df8('0x48')](handleError(_0x36d862,null));}; \ No newline at end of file +var _0x459e=['merge','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','userProfileId','autoAssociation','UserProfileResource','destroy','sequelize','transaction','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','toLowerCase','length','capitalize','Queues','addQueues','Unknown\x20channel','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Fax','Whatsapp','through','TeamVoiceQueue','penalty','Queue','findOrCreate','emit','Queue:save','QueueId','User','online','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','all','spread','removeAgents','Sms','Queue:remove','getAgents','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./team.socket','register','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','error','name','send','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','options','then','includeAll','include','Team','findAll','rows','catch','params'];(function(_0x23d789,_0x450ee9){var _0x43db8d=function(_0x57771d){while(--_0x57771d){_0x23d789['push'](_0x23d789['shift']());}};_0x43db8d(++_0x450ee9);}(_0x459e,0xee));var _0xe459=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x459e[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe459('0x0'));var jsonpatch=require(_0xe459('0x1'));var rp=require(_0xe459('0x2'));var moment=require('moment');var BPromise=require(_0xe459('0x3'));var Mustache=require('mustache');var util=require(_0xe459('0x4'));var path=require(_0xe459('0x5'));var sox=require(_0xe459('0x6'));var csv=require(_0xe459('0x7'));var ejs=require(_0xe459('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe459('0x9'));var squel=require(_0xe459('0xa'));var crypto=require(_0xe459('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe459('0x7'));var querystring=require(_0xe459('0xc'));var Papa=require(_0xe459('0xd'));var Redis=require(_0xe459('0xe'));var authService=require(_0xe459('0xf'));var qs=require(_0xe459('0x10'));var as=require(_0xe459('0x11'));var hardwareService=require(_0xe459('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xe459('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe459('0x14'));var db=require(_0xe459('0x15'))['db'];config['redis']=_[_0xe459('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe459('0x17'))(new Redis(config[_0xe459('0x18')]));require(_0xe459('0x19'))[_0xe459('0x1a')](socket);function respondWithStatusCode(_0x19a639,_0x5c1e5f){_0x5c1e5f=_0x5c1e5f||0xcc;return function(_0x192054){if(_0x192054){return _0x19a639[_0xe459('0x1b')](_0x5c1e5f);}return _0x19a639[_0xe459('0x1c')](_0x5c1e5f)[_0xe459('0x1d')]();};}function respondWithResult(_0x3b7ae6,_0xcbacee){_0xcbacee=_0xcbacee||0xc8;return function(_0x2254b2){if(_0x2254b2){return _0x3b7ae6[_0xe459('0x1c')](_0xcbacee)['json'](_0x2254b2);}};}function respondWithFilteredResult(_0x5831dc,_0x4441c8){return function(_0x4190ca){if(_0x4190ca){var _0x2c07f7=typeof _0x4441c8['offset']===_0xe459('0x1e')&&typeof _0x4441c8[_0xe459('0x1f')]===_0xe459('0x1e');var _0x18394a=_0x4190ca[_0xe459('0x20')];var _0x22390b=_0x2c07f7?0x0:_0x4441c8[_0xe459('0x21')];var _0x1b0d00=_0x2c07f7?_0x4190ca['count']:_0x4441c8[_0xe459('0x21')]+_0x4441c8[_0xe459('0x1f')];var _0x93a1dc;if(_0x1b0d00>=_0x18394a){_0x1b0d00=_0x18394a;_0x93a1dc=0xc8;}else{_0x93a1dc=0xce;}_0x5831dc[_0xe459('0x1c')](_0x93a1dc);return _0x5831dc['set'](_0xe459('0x22'),_0x22390b+'-'+_0x1b0d00+'/'+_0x18394a)[_0xe459('0x23')](_0x4190ca);}return null;};}function patchUpdates(_0x55baf1){return function(_0x402742){try{jsonpatch[_0xe459('0x24')](_0x402742,_0x55baf1,!![]);}catch(_0x1ea876){return BPromise[_0xe459('0x25')](_0x1ea876);}return _0x402742[_0xe459('0x26')]();};}function saveUpdates(_0x123ce9,_0xe8ef38){return function(_0x359b69){if(_0x359b69){return _0x359b69[_0xe459('0x27')](_0x123ce9)['then'](function(_0x340d55){return _0x340d55;});}return null;};}function handleEntityNotFound(_0x3a8148,_0x10ec32){return function(_0x56e1f3){if(!_0x56e1f3){_0x3a8148[_0xe459('0x1b')](0x194);}return _0x56e1f3;};}function handleError(_0x501e19,_0x42149d){_0x42149d=_0x42149d||0x1f4;return function(_0x513106){logger[_0xe459('0x28')](_0x513106['stack']);if(_0x513106[_0xe459('0x29')]){delete _0x513106[_0xe459('0x29')];}_0x501e19['status'](_0x42149d)[_0xe459('0x2a')](_0x513106);};}exports[_0xe459('0x2b')]=function(_0x352bdb,_0x413799){var _0x5046f0={},_0x444b12={},_0x1a38c5={'count':0x0,'rows':[]};var _0x16e61e=_[_0xe459('0x2c')](db['Team'][_0xe459('0x2d')],function(_0x15993f){return{'name':_0x15993f[_0xe459('0x2e')],'type':_0x15993f['type']['key']};});_0x444b12[_0xe459('0x2f')]=_[_0xe459('0x2c')](_0x16e61e,_0xe459('0x29'));_0x444b12[_0xe459('0x30')]=_[_0xe459('0x31')](_0x352bdb[_0xe459('0x30')]);_0x444b12['filters']=_[_0xe459('0x32')](_0x444b12[_0xe459('0x2f')],_0x444b12[_0xe459('0x30')]);_0x5046f0[_0xe459('0x33')]=_[_0xe459('0x32')](_0x444b12[_0xe459('0x2f')],qs[_0xe459('0x34')](_0x352bdb['query'][_0xe459('0x34')]));_0x5046f0['attributes']=_0x5046f0[_0xe459('0x33')]['length']?_0x5046f0[_0xe459('0x33')]:_0x444b12['model'];if(!_0x352bdb['query'][_0xe459('0x35')](_0xe459('0x36'))){_0x5046f0[_0xe459('0x1f')]=qs[_0xe459('0x1f')](_0x352bdb[_0xe459('0x30')][_0xe459('0x1f')]);_0x5046f0['offset']=qs[_0xe459('0x21')](_0x352bdb[_0xe459('0x30')][_0xe459('0x21')]);}_0x5046f0[_0xe459('0x37')]=qs[_0xe459('0x38')](_0x352bdb[_0xe459('0x30')][_0xe459('0x38')]);_0x5046f0[_0xe459('0x39')]=qs[_0xe459('0x3a')](_[_0xe459('0x3b')](_0x352bdb[_0xe459('0x30')],_0x444b12[_0xe459('0x3a')]),_0x16e61e);if(_0x352bdb['query'][_0xe459('0x3c')]){_0x5046f0[_0xe459('0x39')]=_['merge'](_0x5046f0['where'],{'$or':_[_0xe459('0x2c')](_0x16e61e,function(_0x580070){if(_0x580070[_0xe459('0x3d')]!==_0xe459('0x3e')){var _0x3d1af8={};_0x3d1af8[_0x580070[_0xe459('0x29')]]={'$like':'%'+_0x352bdb['query'][_0xe459('0x3c')]+'%'};return _0x3d1af8;}})});}_0x5046f0=_['merge']({},_0x5046f0,_0x352bdb[_0xe459('0x3f')]);var _0x37188e={'where':_0x5046f0[_0xe459('0x39')]};return db['Team'][_0xe459('0x20')](_0x37188e)[_0xe459('0x40')](function(_0x14901f){_0x1a38c5[_0xe459('0x20')]=_0x14901f;if(_0x352bdb[_0xe459('0x30')][_0xe459('0x41')]){_0x5046f0[_0xe459('0x42')]=[{'all':!![]}];}return db[_0xe459('0x43')][_0xe459('0x44')](_0x5046f0);})['then'](function(_0x3fae69){_0x1a38c5[_0xe459('0x45')]=_0x3fae69;return _0x1a38c5;})[_0xe459('0x40')](respondWithFilteredResult(_0x413799,_0x5046f0))[_0xe459('0x46')](handleError(_0x413799,null));};exports['show']=function(_0x426111,_0x3ee745){var _0x19f2cf={'raw':![],'where':{'id':_0x426111[_0xe459('0x47')]['id']}},_0x4c261f={};_0x4c261f['model']=_['keys'](db[_0xe459('0x43')][_0xe459('0x2d')]);_0x4c261f['query']=_['keys'](_0x426111[_0xe459('0x30')]);_0x4c261f['filters']=_['intersection'](_0x4c261f[_0xe459('0x2f')],_0x4c261f[_0xe459('0x30')]);_0x19f2cf['attributes']=_['intersection'](_0x4c261f[_0xe459('0x2f')],qs[_0xe459('0x34')](_0x426111[_0xe459('0x30')]['fields']));_0x19f2cf[_0xe459('0x33')]=_0x19f2cf[_0xe459('0x33')]['length']?_0x19f2cf[_0xe459('0x33')]:_0x4c261f['model'];if(_0x426111['query']['includeAll']){_0x19f2cf[_0xe459('0x42')]=[{'all':!![]}];}_0x19f2cf=_[_0xe459('0x48')]({},_0x19f2cf,_0x426111[_0xe459('0x3f')]);return db[_0xe459('0x43')][_0xe459('0x49')](_0x19f2cf)['then'](handleEntityNotFound(_0x3ee745,null))[_0xe459('0x40')](respondWithResult(_0x3ee745,null))['catch'](handleError(_0x3ee745,null));};exports[_0xe459('0x4a')]=function(_0x93f28,_0x34efa8){return db['Team'][_0xe459('0x4a')](_0x93f28[_0xe459('0x4b')],{})['then'](function(_0xa0a919){var _0x83e5c1=_0x93f28['user'][_0xe459('0x4c')]({'plain':!![]});if(!_0x83e5c1)throw new Error(_0xe459('0x4d'));if(_0x83e5c1[_0xe459('0x4e')]===_0xe459('0x4f')){var _0x250eef=_0xa0a919[_0xe459('0x4c')]({'plain':!![]});var _0x3af704=_0xe459('0x50');return db['UserProfileSection'][_0xe459('0x49')]({'where':{'name':_0x3af704,'userProfileId':_0x83e5c1[_0xe459('0x51')]},'raw':!![]})['then'](function(_0x4d56b5){if(_0x4d56b5&&_0x4d56b5[_0xe459('0x52')]===0x0){return db[_0xe459('0x53')][_0xe459('0x4a')]({'name':_0x250eef[_0xe459('0x29')],'resourceId':_0x250eef['id'],'type':_0x4d56b5['name'],'sectionId':_0x4d56b5['id']},{})[_0xe459('0x40')](function(){return _0xa0a919;});}else{return _0xa0a919;}})[_0xe459('0x46')](function(_0x187f42){logger[_0xe459('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x187f42);throw _0x187f42;});}return _0xa0a919;})[_0xe459('0x40')](respondWithResult(_0x34efa8,0xc9))[_0xe459('0x46')](handleError(_0x34efa8,null));};exports[_0xe459('0x27')]=function(_0x2dc81c,_0x2a12ae){if(_0x2dc81c[_0xe459('0x4b')]['id']){delete _0x2dc81c['body']['id'];}return db['Team'][_0xe459('0x49')]({'where':{'id':_0x2dc81c[_0xe459('0x47')]['id']}})['then'](handleEntityNotFound(_0x2a12ae,null))['then'](saveUpdates(_0x2dc81c[_0xe459('0x4b')],null))[_0xe459('0x40')](respondWithResult(_0x2a12ae,null))[_0xe459('0x46')](handleError(_0x2a12ae,null));};exports[_0xe459('0x54')]=function(_0x1d2516,_0x49226b){var _0x1d3655=_0x1d2516[_0xe459('0x47')]['id'];var _0x5e2306=[];return db[_0xe459('0x55')][_0xe459('0x56')](function(_0x12d529){var _0x594801='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x1d3655;return db[_0xe459('0x55')][_0xe459('0x30')](_0x594801,{'type':db[_0xe459('0x57')][_0xe459('0x58')][_0xe459('0x59')],'raw':!![],'transaction':_0x12d529})['then'](function(_0x4b20f2){_0x5e2306=_[_0xe459('0x2c')](_0x4b20f2,function(_0x3eb252){return Number(_0x3eb252[_0xe459('0x5a')]);});})[_0xe459('0x40')](function(){var _0x446a61=_0xe459('0x5b')+_0x1d3655;return db['sequelize']['query'](_0x446a61,{'type':db['Sequelize'][_0xe459('0x58')][_0xe459('0x59')],'raw':!![],'transaction':_0x12d529});})['then'](function(_0x4c783f){var _0x414257=_[_0xe459('0x2c')](_0x4c783f,function(_0x448ad9){return Number(_0x448ad9[_0xe459('0x5c')]);});return db[_0xe459('0x5d')][_0xe459('0x54')]({'where':{'UserId':{'$in':_0x5e2306},'VoiceQueueId':{'$in':_0x414257}},'transaction':_0x12d529});})[_0xe459('0x40')](function(){var _0x44dcb4=_0xe459('0x5e')+_0x1d3655;return db['sequelize'][_0xe459('0x30')](_0x44dcb4,{'type':db['Sequelize'][_0xe459('0x58')][_0xe459('0x59')],'raw':!![],'transaction':_0x12d529});})[_0xe459('0x40')](function(_0x39e801){var _0x366c37=_[_0xe459('0x2c')](_0x39e801,function(_0x1709d2){return Number(_0x1709d2[_0xe459('0x5f')]);});return db[_0xe459('0x60')][_0xe459('0x54')]({'where':{'UserId':{'$in':_0x5e2306},'MailQueueId':{'$in':_0x366c37}},'transaction':_0x12d529});})[_0xe459('0x40')](function(){var _0x4dc777=_0xe459('0x61')+_0x1d3655;return db[_0xe459('0x55')][_0xe459('0x30')](_0x4dc777,{'type':db[_0xe459('0x57')]['QueryTypes'][_0xe459('0x59')],'raw':!![],'transaction':_0x12d529});})['then'](function(_0x588199){var _0x354d71=_[_0xe459('0x2c')](_0x588199,function(_0x444890){return Number(_0x444890['SmsQueueId']);});return db['UserSmsQueue'][_0xe459('0x54')]({'where':{'UserId':{'$in':_0x5e2306},'SmsQueueId':{'$in':_0x354d71}},'transaction':_0x12d529});})[_0xe459('0x40')](function(){var _0x5cbcd3='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1d3655;return db[_0xe459('0x55')][_0xe459('0x30')](_0x5cbcd3,{'type':db['Sequelize'][_0xe459('0x58')][_0xe459('0x59')],'raw':!![],'transaction':_0x12d529});})[_0xe459('0x40')](function(_0xf86dc2){var _0x34f44a=_[_0xe459('0x2c')](_0xf86dc2,function(_0x523b0a){return Number(_0x523b0a[_0xe459('0x62')]);});return db[_0xe459('0x63')][_0xe459('0x54')]({'where':{'UserId':{'$in':_0x5e2306},'ChatQueueId':{'$in':_0x34f44a}},'transaction':_0x12d529});})['then'](function(){var _0x2ef081=_0xe459('0x64')+_0x1d3655;return db[_0xe459('0x55')][_0xe459('0x30')](_0x2ef081,{'type':db['Sequelize'][_0xe459('0x58')]['SELECT'],'raw':!![],'transaction':_0x12d529});})[_0xe459('0x40')](function(_0xb0a669){var _0x15e9fe=_[_0xe459('0x2c')](_0xb0a669,function(_0x411322){return Number(_0x411322[_0xe459('0x65')]);});return db[_0xe459('0x66')]['destroy']({'where':{'UserId':{'$in':_0x5e2306},'FaxQueueId':{'$in':_0x15e9fe}},'transaction':_0x12d529});})['then'](function(){var _0x3fe618='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1d3655;return db['sequelize']['query'](_0x3fe618,{'type':db[_0xe459('0x57')][_0xe459('0x58')]['SELECT'],'raw':!![],'transaction':_0x12d529});})[_0xe459('0x40')](function(_0x1936f2){var _0x3d3b3d=_['map'](_0x1936f2,function(_0x53a178){return Number(_0x53a178[_0xe459('0x67')]);});return db[_0xe459('0x68')]['destroy']({'where':{'UserId':{'$in':_0x5e2306},'OpenchannelQueueId':{'$in':_0x3d3b3d}},'transaction':_0x12d529});})[_0xe459('0x40')](function(){var _0x46de4e=_0xe459('0x69')+_0x1d3655;return db[_0xe459('0x55')][_0xe459('0x30')](_0x46de4e,{'type':db[_0xe459('0x57')]['QueryTypes'][_0xe459('0x59')],'raw':!![],'transaction':_0x12d529});})[_0xe459('0x40')](function(_0x17d6a4){var _0x43930a=_[_0xe459('0x2c')](_0x17d6a4,function(_0x4b0b56){return Number(_0x4b0b56[_0xe459('0x6a')]);});return db['UserWhatsappQueue'][_0xe459('0x54')]({'where':{'UserId':{'$in':_0x5e2306},'WhatsappQueueId':{'$in':_0x43930a}},'transaction':_0x12d529});})[_0xe459('0x40')](function(){return db[_0xe459('0x6b')][_0xe459('0x49')]({'where':{'TeamId':_0x1d3655}});})[_0xe459('0x40')](function(_0x1a0aa4){if(_0x1a0aa4===null){return;}return db[_0xe459('0x6c')]['destroy']({'where':{'UserId':{'$in':_0x5e2306},'VoicePrefixId':_0x1a0aa4[_0xe459('0x6d')]},'transaction':_0x12d529});})[_0xe459('0x40')](function(){return db[_0xe459('0x43')]['destroy']({'where':{'id':_0x1d3655},'cascade':!![],'transaction':_0x12d529});})[_0xe459('0x40')](function(_0x1c1309){if(_0x1c1309===0x0){_0x49226b[_0xe459('0x1b')](0x194);}else{return db[_0xe459('0x53')][_0xe459('0x54')]({'where':{'type':_0xe459('0x50'),'resourceId':_0x1d3655},'cascade':!![],'transaction':_0x12d529})['then'](function(){_0x49226b['status'](0xcc)[_0xe459('0x1d')]();});}})[_0xe459('0x46')](function(_0x57fe9a){_0x49226b['status'](0x1f4)[_0xe459('0x2a')](_0x57fe9a);});});};exports[_0xe459('0x6e')]=function(_0x40e4bc,_0x78f921,_0x292b7e){return db['Team'][_0xe459('0x6f')]({'where':{'id':_0x40e4bc['params']['id']}})['then'](handleEntityNotFound(_0x78f921,null))[_0xe459('0x40')](function(_0x4f02c3){if(!_0x40e4bc[_0xe459('0x30')][_0xe459('0x70')]||!utils[_0xe459('0x71')](_0x40e4bc[_0xe459('0x30')][_0xe459('0x70')])){throw new db[(_0xe459('0x57'))][(_0xe459('0x72'))]('Unknown\x20channel');}var _0xdf65d0={};var _0x236ad2={};_0x236ad2[_0xe459('0x2f')]=_[_0xe459('0x31')](db[_['capitalize'](_0x40e4bc[_0xe459('0x30')][_0xe459('0x70')][_0xe459('0x73')]())+'Queue'][_0xe459('0x2d')]);_0x236ad2[_0xe459('0x30')]=_[_0xe459('0x31')](_0x40e4bc[_0xe459('0x30')]);_0x236ad2[_0xe459('0x3a')]=_[_0xe459('0x32')](_0x236ad2[_0xe459('0x2f')],_0x236ad2[_0xe459('0x30')]);_0xdf65d0['attributes']=_[_0xe459('0x32')](_0x236ad2['model'],qs['fields'](_0x40e4bc[_0xe459('0x30')][_0xe459('0x34')]));_0xdf65d0[_0xe459('0x33')]=_0xdf65d0[_0xe459('0x33')][_0xe459('0x74')]?_0xdf65d0[_0xe459('0x33')]:_0x236ad2[_0xe459('0x2f')];_0xdf65d0['limit']=qs[_0xe459('0x1f')](_0x40e4bc[_0xe459('0x30')]['limit']);_0xdf65d0[_0xe459('0x21')]=qs['offset'](_0x40e4bc[_0xe459('0x30')]['offset']);_0xdf65d0[_0xe459('0x37')]=qs[_0xe459('0x38')](_0x40e4bc['query'][_0xe459('0x38')]);_0xdf65d0['where']=qs[_0xe459('0x3a')](_['pick'](_0x40e4bc[_0xe459('0x30')],_0x236ad2[_0xe459('0x3a')]));_0xdf65d0=_['merge']({},_0xdf65d0,_0x40e4bc[_0xe459('0x3f')]);return _0x4f02c3[_0xe459('0x4c')+_[_0xe459('0x75')](_0x40e4bc[_0xe459('0x30')][_0xe459('0x70')][_0xe459('0x73')]())+_0xe459('0x76')](_0xdf65d0);})[_0xe459('0x40')](respondWithResult(_0x78f921,null))[_0xe459('0x46')](handleError(_0x78f921,null));};exports[_0xe459('0x77')]=function(_0x28e32a,_0x52399f,_0x5035d8){return db['Team'][_0xe459('0x6f')]({'where':{'id':_0x28e32a[_0xe459('0x47')]['id']}})[_0xe459('0x40')](function(_0xe91e3b){if(_0xe91e3b){if(!_0x28e32a['body'][_0xe459('0x70')]||!utils[_0xe459('0x71')](_0x28e32a[_0xe459('0x4b')][_0xe459('0x70')])){throw new db['Sequelize'][(_0xe459('0x72'))](_0xe459('0x78'));}return _0xe91e3b[_0xe459('0x79')+_['capitalize'](_0x28e32a['body']['channel'][_0xe459('0x73')]())+_0xe459('0x76')](_0x28e32a[_0xe459('0x4b')][_0xe459('0x7a')]);}return null;})[_0xe459('0x40')](handleEntityNotFound(_0x52399f,null))[_0xe459('0x40')](respondWithStatusCode(_0x52399f,null))['catch'](handleError(_0x52399f,null));};exports[_0xe459('0x7b')]=function(_0x12f69d,_0xc9d524,_0x11b400){return db[_0xe459('0x43')][_0xe459('0x6f')]({'where':{'id':_0x12f69d[_0xe459('0x47')]['id']}})[_0xe459('0x40')](function(_0x278a59){if(_0x278a59){if(!_0x12f69d[_0xe459('0x30')][_0xe459('0x70')]||!utils[_0xe459('0x71')](_0x12f69d['query'][_0xe459('0x70')])){throw new db[(_0xe459('0x57'))]['ValidationError']('Unknown\x20channel');}return _0x278a59[_0xe459('0x7c')+_[_0xe459('0x75')](_0x12f69d[_0xe459('0x30')][_0xe459('0x70')][_0xe459('0x73')]())+_0xe459('0x76')](_0x12f69d[_0xe459('0x30')][_0xe459('0x7a')]);}return null;})[_0xe459('0x40')](handleEntityNotFound(_0xc9d524,null))['then'](respondWithStatusCode(_0xc9d524,null))[_0xe459('0x46')](handleError(_0xc9d524,null));};exports[_0xe459('0x7d')]=function(_0x2bc2d8,_0x6a96a7){var _0x1294fd=_[_0xe459('0x7e')](_0x2bc2d8[_0xe459('0x4b')]['ids'])?_0x2bc2d8[_0xe459('0x4b')]['ids']:[_0x2bc2d8[_0xe459('0x4b')][_0xe459('0x7a')]];var _0x3360d3=_0x2bc2d8[_0xe459('0x47')]['id'];return db[_0xe459('0x43')][_0xe459('0x49')]({'where':{'id':_0x3360d3}})[_0xe459('0x40')](handleEntityNotFound(_0x6a96a7,null))[_0xe459('0x40')](function(_0xc2c62c){if(_0xc2c62c){var _0x14a472=[_0xe459('0x7f'),_0xe459('0x80'),_0xe459('0x81'),'Sms',_0xe459('0x82'),'Openchannel',_0xe459('0x83')];return db[_0xe459('0x55')][_0xe459('0x56')](function(_0xd022a6){var _0x1b1919=_[_0xe459('0x2c')](_0x14a472,function(_0x1d6cca){var _0x46cabf={'attributes':['id',_0xe459('0x29')]};if(_0x1d6cca===_0xe459('0x7f')){_0x46cabf[_0xe459('0x84')]={'attributes':['penalty']};}return _0xc2c62c['get'+_0x1d6cca+_0xe459('0x76')](_0x46cabf)[_0xe459('0x40')](function(_0xb0f5f4){var _0x194ae6=_['map'](_0xb0f5f4,function(_0x5d428a){var _0x550bea=_[_0xe459('0x2c')](_0x1294fd,function(_0x44b2c3){var _0xbd8183={'where':{'UserId':_0x44b2c3,[_0x1d6cca+'QueueId']:_0x5d428a['id']},'transaction':_0xd022a6};if(_0x1d6cca===_0xe459('0x7f')){_0xbd8183[_0xe459('0x16')]={'penalty':_0x5d428a[_0xe459('0x85')][_0xe459('0x86')]};}return db['User'+_0x1d6cca+_0xe459('0x87')][_0xe459('0x88')](_0xbd8183)[_0xe459('0x40')](function(){socket[_0xe459('0x89')](_0xe459('0x4f')+_0x1d6cca+_0xe459('0x8a'),{'UserId':_0x44b2c3,[_0x1d6cca+_0xe459('0x8b')]:_0x5d428a['id']});if(_0x1d6cca!==_0xe459('0x7f')){return;}return db[_0xe459('0x8c')][_0xe459('0x44')]({'where':{'id':_0x1294fd,'online':0x1},'attributes':['id','name',_0xe459('0x8d'),_0xe459('0x8e'),'interface'],'raw':!![]})['then'](function(_0x36295c){var _0x35d788=_[_0xe459('0x2c')](_0x36295c,function(_0x21aebb){return db[_0xe459('0x8f')][_0xe459('0x90')]({'membername':_0x21aebb[_0xe459('0x29')],'UserId':_0x21aebb['id'],'queue_name':_0x5d428a[_0xe459('0x29')],'VoiceQueueId':_0x5d428a['id'],'interface':_[_0xe459('0x91')](_0x21aebb[_0xe459('0x92')])?util[_0xe459('0x93')](_0xe459('0x94'),_0x21aebb['name']):_0x21aebb[_0xe459('0x92')],'paused':_0x21aebb[_0xe459('0x8e')]||![],'penalty':_0x5d428a[_0xe459('0x85')]['penalty']},{'transaction':_0xd022a6});});return Promise[_0xe459('0x95')](_0x35d788);});});});return Promise[_0xe459('0x95')](_0x550bea);});return Promise['all'](_0x194ae6);})[_0xe459('0x40')](function(){return db[_0xe459('0x6b')]['findOne']({'where':{'teamId':_0x3360d3}})[_0xe459('0x40')](function(_0x33e474){if(_0x33e474){var _0x489177=_[_0xe459('0x2c')](_0x1294fd,function(_0x5ba7d4){db['UserVoicePrefix'][_0xe459('0x90')]({'UserId':_0x5ba7d4,'VoicePrefixId':_0x33e474[_0xe459('0x6d')]});});return Promise[_0xe459('0x95')](_0x489177);}});});});return Promise[_0xe459('0x95')](_0x1b1919)[_0xe459('0x40')](function(){return _0xc2c62c[_0xe459('0x7d')](_0x1294fd,{'transaction':_0xd022a6})[_0xe459('0x96')](function(_0x2d7ef4){return _0x2d7ef4;});});});}})[_0xe459('0x40')](respondWithResult(_0x6a96a7,null))[_0xe459('0x46')](handleError(_0x6a96a7,null));};exports[_0xe459('0x97')]=function(_0x4de889,_0x1584f7){var _0x369afa=_[_0xe459('0x7e')](_0x4de889['query'][_0xe459('0x7a')])?_0x4de889[_0xe459('0x30')][_0xe459('0x7a')]:[_0x4de889[_0xe459('0x30')][_0xe459('0x7a')]];var _0x53d594=_0x4de889[_0xe459('0x47')]['id'];return db[_0xe459('0x43')][_0xe459('0x49')]({'where':{'id':_0x53d594}})['then'](handleEntityNotFound(_0x1584f7,null))[_0xe459('0x40')](function(_0x5044a4){if(_0x5044a4){var _0x239166=[_0xe459('0x7f'),'Chat','Mail',_0xe459('0x98'),_0xe459('0x82'),'Openchannel',_0xe459('0x83')];return db[_0xe459('0x55')]['transaction'](function(_0x384b46){var _0x3b2906=_[_0xe459('0x2c')](_0x239166,function(_0x10242b){var _0x55a776={'attributes':['id',_0xe459('0x29')]};return _0x5044a4['get'+_0x10242b+_0xe459('0x76')](_0x55a776)[_0xe459('0x40')](function(_0x37fbae){var _0x28d03d=_[_0xe459('0x2c')](_0x37fbae,function(_0x490cc5){return _0x490cc5[_0xe459('0x97')](_0x369afa,{'transaction':_0x384b46})[_0xe459('0x40')](function(){var _0xd420f8=_['map'](_0x369afa,function(_0x7d8ee2){socket['emit']('user'+_0x10242b+_0xe459('0x99'),{'UserId':Number(_0x7d8ee2),[_0x10242b+_0xe459('0x8b')]:_0x490cc5['id']});if(_0x10242b!==_0xe459('0x7f')){return;}return db[_0xe459('0x8f')]['destroy']({'where':{'VoiceQueueId':_0x490cc5['id'],'UserId':_0x7d8ee2},'transaction':_0x384b46});});return Promise[_0xe459('0x95')](_0xd420f8);});});return Promise[_0xe459('0x95')](_0x28d03d);});});return Promise['all'](_0x3b2906)[_0xe459('0x40')](function(){return _0x5044a4['removeAgents'](_0x369afa,{'transaction':_0x384b46});})[_0xe459('0x40')](function(){return db['TeamVoicePrefix'][_0xe459('0x6f')]({'where':{'teamId':_0x53d594}})[_0xe459('0x40')](function(_0x2dae5b){if(_0x2dae5b){var _0x403db4=_[_0xe459('0x2c')](_0x369afa,function(_0xc1351d){db['UserVoicePrefix'][_0xe459('0x54')]({'where':{'UserId':_0xc1351d,'VoicePrefixId':_0x2dae5b['VoicePrefixId']}});});return Promise['all'](_0x403db4);}});});});}})[_0xe459('0x40')](respondWithStatusCode(_0x1584f7,null))[_0xe459('0x46')](handleError(_0x1584f7,null));};exports[_0xe459('0x9a')]=function(_0x1aaf49,_0x191ead,_0x180b5e){var _0x5f3b8b={};var _0x73416f={};var _0x257405;var _0x3ea360;return db['Team'][_0xe459('0x6f')]({'where':{'id':_0x1aaf49[_0xe459('0x47')]['id']}})[_0xe459('0x40')](handleEntityNotFound(_0x191ead,null))['then'](function(_0x43419){if(_0x43419){_0x257405=_0x43419;_0x73416f[_0xe459('0x2f')]=_[_0xe459('0x31')](db[_0xe459('0x8c')][_0xe459('0x2d')]);_0x73416f['query']=_[_0xe459('0x31')](_0x1aaf49[_0xe459('0x30')]);_0x73416f['filters']=_['intersection'](_0x73416f[_0xe459('0x2f')],_0x73416f[_0xe459('0x30')]);_0x5f3b8b[_0xe459('0x33')]=_[_0xe459('0x32')](_0x73416f[_0xe459('0x2f')],qs['fields'](_0x1aaf49['query']['fields']));_0x5f3b8b[_0xe459('0x33')]=_0x5f3b8b[_0xe459('0x33')]['length']?_0x5f3b8b[_0xe459('0x33')]:_0x73416f['model'];_0x5f3b8b[_0xe459('0x37')]=qs['sort'](_0x1aaf49[_0xe459('0x30')][_0xe459('0x38')]);_0x5f3b8b[_0xe459('0x39')]=qs[_0xe459('0x3a')](_[_0xe459('0x3b')](_0x1aaf49[_0xe459('0x30')],_0x73416f[_0xe459('0x3a')]));if(_0x1aaf49[_0xe459('0x30')][_0xe459('0x3c')]){_0x5f3b8b[_0xe459('0x39')]=_['merge'](_0x5f3b8b[_0xe459('0x39')],{'$or':_[_0xe459('0x2c')](_0x5f3b8b['attributes'],function(_0x4b9a2a){var _0x364e1a={};_0x364e1a[_0x4b9a2a]={'$like':'%'+_0x1aaf49[_0xe459('0x30')]['filter']+'%'};return _0x364e1a;})});}_0x5f3b8b=_[_0xe459('0x48')]({},_0x5f3b8b,_0x1aaf49['options']);return _0x257405['getAgents'](_0x5f3b8b);}})[_0xe459('0x40')](function(_0x4798dc){if(_0x4798dc){_0x3ea360=_0x4798dc[_0xe459('0x74')];if(!_0x1aaf49[_0xe459('0x30')]['hasOwnProperty'](_0xe459('0x36'))){_0x5f3b8b[_0xe459('0x1f')]=qs[_0xe459('0x1f')](_0x1aaf49[_0xe459('0x30')][_0xe459('0x1f')]);_0x5f3b8b['offset']=qs['offset'](_0x1aaf49['query']['offset']);}return _0x257405[_0xe459('0x9a')](_0x5f3b8b);}})[_0xe459('0x40')](function(_0x200b56){if(_0x200b56){return _0x200b56?{'count':_0x3ea360,'rows':_0x200b56}:null;}})['then'](respondWithResult(_0x191ead,null))[_0xe459('0x46')](handleError(_0x191ead,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 24e4cd8..b4c605d 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 _0x61bd=['update','remove','emit','hook','events','Team','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x61bd,0x1a4));var _0xd61b=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x61bd[_0x3511d3];return _0x5d6321;};'use strict';var EventEmitter=require(_0xd61b('0x0'));var Team=require('../../mysqldb')['db'][_0xd61b('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xd61b('0x2')](0x0);var events={'afterCreate':_0xd61b('0x3'),'afterUpdate':_0xd61b('0x4'),'afterDestroy':_0xd61b('0x5')};function emitEvent(_0x283071){return function(_0x4305d8,_0x11df5c,_0x496d41){TeamEvents[_0xd61b('0x6')](_0x283071+':'+_0x4305d8['id'],_0x4305d8);TeamEvents[_0xd61b('0x6')](_0x283071,_0x4305d8);_0x496d41(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xd61b('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x7435=['save','remove','emit','hasOwnProperty','hook','exports','events','Team','setMaxListeners'];(function(_0x5bce21,_0x3cb3a3){var _0x46ec8e=function(_0x50e1bd){while(--_0x50e1bd){_0x5bce21['push'](_0x5bce21['shift']());}};_0x46ec8e(++_0x3cb3a3);}(_0x7435,0xf0));var _0x5743=function(_0x4cc670,_0x55536d){_0x4cc670=_0x4cc670-0x0;var _0x4d0628=_0x7435[_0x4cc670];return _0x4d0628;};'use strict';var EventEmitter=require(_0x5743('0x0'));var Team=require('../../mysqldb')['db'][_0x5743('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x5743('0x2')](0x0);var events={'afterCreate':_0x5743('0x3'),'afterUpdate':'update','afterDestroy':_0x5743('0x4')};function emitEvent(_0x508737){return function(_0x4f2fde,_0x2dd48f,_0x2b4ef1){TeamEvents[_0x5743('0x5')](_0x508737+':'+_0x4f2fde['id'],_0x4f2fde);TeamEvents[_0x5743('0x5')](_0x508737,_0x4f2fde);_0x2b4ef1(null);};}for(var e in events){if(events[_0x5743('0x6')](e)){var event=events[e];Team[_0x5743('0x7')](e,emitEvent(event));}}module[_0x5743('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 7b9e634..ed1fc14 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 _0x6d61=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./team.attributes','exports','define','Team','lodash','util'];(function(_0x243d9c,_0x1b18b9){var _0x569deb=function(_0x46f12a){while(--_0x46f12a){_0x243d9c['push'](_0x243d9c['shift']());}};_0x569deb(++_0x1b18b9);}(_0x6d61,0x112));var _0x16d6=function(_0x541224,_0x512e8a){_0x541224=_0x541224-0x0;var _0x395585=_0x6d61[_0x541224];return _0x395585;};'use strict';var _=require(_0x16d6('0x0'));var util=require(_0x16d6('0x1'));var logger=require(_0x16d6('0x2'))(_0x16d6('0x3'));var moment=require(_0x16d6('0x4'));var BPromise=require(_0x16d6('0x5'));var rp=require(_0x16d6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x16d6('0x7'));var attributes=require(_0x16d6('0x8'));module[_0x16d6('0x9')]=function(_0x25cb57,_0x40ca48){return _0x25cb57[_0x16d6('0xa')](_0x16d6('0xb'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x793d=['moment','request-promise','path','rimraf','../../config/environment','./team.attributes','exports','define','Team','teams','util','api'];(function(_0x257758,_0x5ef6ee){var _0x4d6533=function(_0x3144a2){while(--_0x3144a2){_0x257758['push'](_0x257758['shift']());}};_0x4d6533(++_0x5ef6ee);}(_0x793d,0x106));var _0xd793=function(_0x10a271,_0x24a230){_0x10a271=_0x10a271-0x0;var _0x53d4bb=_0x793d[_0x10a271];return _0x53d4bb;};'use strict';var _=require('lodash');var util=require(_0xd793('0x0'));var logger=require('../../config/logger')(_0xd793('0x1'));var moment=require(_0xd793('0x2'));var BPromise=require('bluebird');var rp=require(_0xd793('0x3'));var fs=require('fs');var path=require(_0xd793('0x4'));var rimraf=require(_0xd793('0x5'));var config=require(_0xd793('0x6'));var attributes=require(_0xd793('0x7'));module[_0xd793('0x8')]=function(_0x5efb54,_0x159f8a){return _0x5efb54[_0xd793('0x9')](_0xd793('0xa'),attributes,{'tableName':_0xd793('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 6647c53..31d34ac 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 _0x25b8=['debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent'];(function(_0x3a36e6,_0x155068){var _0x2b9379=function(_0x2628ce){while(--_0x2628ce){_0x3a36e6['push'](_0x3a36e6['shift']());}};_0x2b9379(++_0x155068);}(_0x25b8,0x8d));var _0x825b=function(_0x55ff3e,_0x41077f){_0x55ff3e=_0x55ff3e-0x0;var _0x2709eb=_0x25b8[_0x55ff3e];return _0x2709eb;};'use strict';var _=require(_0x825b('0x0'));var util=require(_0x825b('0x1'));var moment=require(_0x825b('0x2'));var BPromise=require('bluebird');var rs=require(_0x825b('0x3'));var fs=require('fs');var Redis=require(_0x825b('0x4'));var db=require(_0x825b('0x5'))['db'];var utils=require(_0x825b('0x6'));var logger=require(_0x825b('0x7'))(_0x825b('0x8'));var config=require('../../config/environment');var jayson=require(_0x825b('0x9'));var client=jayson['client'][_0x825b('0xa')]({'port':0x232a});config[_0x825b('0xb')]=_['defaults'](config['redis'],{'host':_0x825b('0xc'),'port':0x18eb});var socket=require(_0x825b('0xd'))(new Redis(config[_0x825b('0xb')]));require(_0x825b('0xe'))[_0x825b('0xf')](socket);function respondWithRpcPromise(_0x5c1787,_0x553438,_0x718543){return new BPromise(function(_0x2aa785,_0x2cc76f){return client[_0x825b('0x10')](_0x5c1787,_0x718543)[_0x825b('0x11')](function(_0x56ea80){logger[_0x825b('0x12')](_0x825b('0x13'),_0x553438,_0x825b('0x14'));logger[_0x825b('0x15')](_0x825b('0x16'),_0x553438,'request\x20sent',JSON['stringify'](_0x56ea80));if(_0x56ea80[_0x825b('0x17')]){if(_0x56ea80[_0x825b('0x17')][_0x825b('0x18')]===0x1f4){logger[_0x825b('0x17')]('Team,\x20%s,\x20%s',_0x553438,_0x56ea80[_0x825b('0x17')][_0x825b('0x19')]);return _0x2cc76f(_0x56ea80[_0x825b('0x17')][_0x825b('0x19')]);}logger[_0x825b('0x17')](_0x825b('0x13'),_0x553438,_0x56ea80[_0x825b('0x17')]['message']);return _0x2aa785(_0x56ea80[_0x825b('0x17')]['message']);}else{logger[_0x825b('0x12')](_0x825b('0x13'),_0x553438,_0x825b('0x14'));_0x2aa785(_0x56ea80['result']['message']);}})[_0x825b('0x1a')](function(_0x3e68db){logger['error'](_0x825b('0x13'),_0x553438,_0x3e68db);_0x2cc76f(_0x3e68db);});});} \ No newline at end of file +var _0x7839=['Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./team.socket','request','then'];(function(_0x206487,_0x28eec1){var _0x2714c7=function(_0x298179){while(--_0x298179){_0x206487['push'](_0x206487['shift']());}};_0x2714c7(++_0x28eec1);}(_0x7839,0x159));var _0x9783=function(_0xf8d7c3,_0x1bac2d){_0xf8d7c3=_0xf8d7c3-0x0;var _0x32833e=_0x7839[_0xf8d7c3];return _0x32833e;};'use strict';var _=require(_0x9783('0x0'));var util=require(_0x9783('0x1'));var moment=require('moment');var BPromise=require(_0x9783('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9783('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9783('0x4'));var logger=require(_0x9783('0x5'))(_0x9783('0x6'));var config=require(_0x9783('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9783('0x8')]['http']({'port':0x232a});config[_0x9783('0x9')]=_['defaults'](config[_0x9783('0x9')],{'host':_0x9783('0xa'),'port':0x18eb});var socket=require(_0x9783('0xb'))(new Redis(config['redis']));require(_0x9783('0xc'))['register'](socket);function respondWithRpcPromise(_0x2f3776,_0x5212c0,_0x57dae1){return new BPromise(function(_0x3f5b7f,_0x2eaecf){return client[_0x9783('0xd')](_0x2f3776,_0x57dae1)[_0x9783('0xe')](function(_0x3706f5){logger['info'](_0x9783('0xf'),_0x5212c0,_0x9783('0x10'));logger[_0x9783('0x11')](_0x9783('0x12'),_0x5212c0,_0x9783('0x10'),JSON[_0x9783('0x13')](_0x3706f5));if(_0x3706f5[_0x9783('0x14')]){if(_0x3706f5['error']['code']===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x5212c0,_0x3706f5[_0x9783('0x14')][_0x9783('0x15')]);return _0x2eaecf(_0x3706f5[_0x9783('0x14')]['message']);}logger['error'](_0x9783('0xf'),_0x5212c0,_0x3706f5[_0x9783('0x14')][_0x9783('0x15')]);return _0x3f5b7f(_0x3706f5[_0x9783('0x14')][_0x9783('0x15')]);}else{logger[_0x9783('0x16')](_0x9783('0xf'),_0x5212c0,_0x9783('0x10'));_0x3f5b7f(_0x3706f5[_0x9783('0x17')]['message']);}})['catch'](function(_0x21efca){logger[_0x9783('0x14')]('Team,\x20%s,\x20%s',_0x5212c0,_0x21efca);_0x2eaecf(_0x21efca);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 2861cfd..633fb12 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 _0xa45b=['team:','save','remove','emit','register','length'];(function(_0x135508,_0x18e3c5){var _0x5589ce=function(_0x46391e){while(--_0x46391e){_0x135508['push'](_0x135508['shift']());}};_0x5589ce(++_0x18e3c5);}(_0xa45b,0x199));var _0xba45=function(_0x570187,_0x297593){_0x570187=_0x570187-0x0;var _0x15cca1=_0xa45b[_0x570187];return _0x15cca1;};'use strict';var TeamEvents=require('./team.events');var events=[_0xba45('0x0'),_0xba45('0x1'),'update'];function createListener(_0x4be628,_0x5390e4){return function(_0x22c95a){_0x5390e4[_0xba45('0x2')](_0x4be628,_0x22c95a);};}function removeListener(_0xfe4200,_0x35008a){return function(){TeamEvents['removeListener'](_0xfe4200,_0x35008a);};}exports[_0xba45('0x3')]=function(_0x14ee6c){for(var _0x330e53=0x0,_0x298bfc=events[_0xba45('0x4')];_0x330e53<_0x298bfc;_0x330e53++){var _0x20905f=events[_0x330e53];var _0x1a7a40=createListener(_0xba45('0x5')+_0x20905f,_0x14ee6c);TeamEvents['on'](_0x20905f,_0x1a7a40);}}; \ No newline at end of file +var _0x2357=['team:','save','remove','update','emit','removeListener'];(function(_0x3ec1da,_0x1e36f5){var _0x472358=function(_0x1d41b1){while(--_0x1d41b1){_0x3ec1da['push'](_0x3ec1da['shift']());}};_0x472358(++_0x1e36f5);}(_0x2357,0xa9));var _0x7235=function(_0x49e6d7,_0x3e3270){_0x49e6d7=_0x49e6d7-0x0;var _0x14c021=_0x2357[_0x49e6d7];return _0x14c021;};'use strict';var TeamEvents=require('./team.events');var events=[_0x7235('0x0'),_0x7235('0x1'),_0x7235('0x2')];function createListener(_0x11e89d,_0x7a430){return function(_0x24989b){_0x7a430[_0x7235('0x3')](_0x11e89d,_0x24989b);};}function removeListener(_0x39b704,_0x58a857){return function(){TeamEvents[_0x7235('0x4')](_0x39b704,_0x58a857);};}exports['register']=function(_0x5adc4a){for(var _0x1afb72=0x0,_0x3a9a37=events['length'];_0x1afb72<_0x3a9a37;_0x1afb72++){var _0x5f15ae=events[_0x1afb72];var _0x3f379c=createListener(_0x7235('0x5')+_0x5f15ae,_0x5adc4a);TeamEvents['on'](_0x5f15ae,_0x3f379c);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 1792c13..29a9965 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 _0x0cee=['sequelize','exports','INTEGER'];(function(_0x27904a,_0x471c27){var _0x2c16fc=function(_0x5db6f8){while(--_0x5db6f8){_0x27904a['push'](_0x27904a['shift']());}};_0x2c16fc(++_0x471c27);}(_0x0cee,0x12f));var _0xe0ce=function(_0x5d031a,_0x1dee60){_0x5d031a=_0x5d031a-0x0;var _0x39c779=_0x0cee[_0x5d031a];return _0x39c779;};'use strict';var Sequelize=require(_0xe0ce('0x0'));module[_0xe0ce('0x1')]={'TeamId':{'type':Sequelize[_0xe0ce('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xe0ce('0x2')]}}; \ No newline at end of file +var _0xc36d=['exports','INTEGER','sequelize'];(function(_0x18c4a8,_0x96c52e){var _0x189ff1=function(_0x4a3ea8){while(--_0x4a3ea8){_0x18c4a8['push'](_0x18c4a8['shift']());}};_0x189ff1(++_0x96c52e);}(_0xc36d,0x7d));var _0xdc36=function(_0xb36843,_0x57c1f4){_0xb36843=_0xb36843-0x0;var _0x227b83=_0xc36d[_0xb36843];return _0x227b83;};'use strict';var Sequelize=require(_0xdc36('0x0'));module[_0xdc36('0x1')]={'TeamId':{'type':Sequelize[_0xdc36('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xdc36('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 0176b08..d596e9d 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 _0x39aa=['moment','bluebird','request-promise','path','rimraf','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','api'];(function(_0x40b423,_0x14b27f){var _0x3d144e=function(_0x2e718d){while(--_0x2e718d){_0x40b423['push'](_0x40b423['shift']());}};_0x3d144e(++_0x14b27f);}(_0x39aa,0x11b));var _0xa39a=function(_0x2c94a5,_0x128193){_0x2c94a5=_0x2c94a5-0x0;var _0x472eac=_0x39aa[_0x2c94a5];return _0x472eac;};'use strict';var _=require(_0xa39a('0x0'));var util=require(_0xa39a('0x1'));var logger=require('../../config/logger')(_0xa39a('0x2'));var moment=require(_0xa39a('0x3'));var BPromise=require(_0xa39a('0x4'));var rp=require(_0xa39a('0x5'));var fs=require('fs');var path=require(_0xa39a('0x6'));var rimraf=require(_0xa39a('0x7'));var config=require('../../config/environment');var attributes=require('./teamVoicePrefix.attributes');module['exports']=function(_0x3dba2c,_0x911d67){return _0x3dba2c[_0xa39a('0x8')](_0xa39a('0x9'),attributes,{'tableName':_0xa39a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30d3=['api','moment','bluebird','request-promise','path','rimraf','./teamVoicePrefix.attributes','exports','team_has_voice_prefixes','../../config/logger'];(function(_0x4ad023,_0x225a7a){var _0x4b07db=function(_0x27ed84){while(--_0x27ed84){_0x4ad023['push'](_0x4ad023['shift']());}};_0x4b07db(++_0x225a7a);}(_0x30d3,0x9f));var _0x330d=function(_0x287e47,_0x5e38a3){_0x287e47=_0x287e47-0x0;var _0x3a8d42=_0x30d3[_0x287e47];return _0x3a8d42;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x330d('0x0'))(_0x330d('0x1'));var moment=require(_0x330d('0x2'));var BPromise=require(_0x330d('0x3'));var rp=require(_0x330d('0x4'));var fs=require('fs');var path=require(_0x330d('0x5'));var rimraf=require(_0x330d('0x6'));var config=require('../../config/environment');var attributes=require(_0x330d('0x7'));module[_0x330d('0x8')]=function(_0xd8503,_0x2a330f){return _0xd8503['define']('TeamVoicePrefix',attributes,{'tableName':_0x330d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 987cfbe..802b228 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x172191,_0x266ce4){var _0x412d99=function(_0x110635){while(--_0x110635){_0x172191['push'](_0x172191['shift']());}};_0x412d99(++_0x266ce4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xc11179,_0x4ba32b){var _0x198575=function(_0x1fbc23){while(--_0x1fbc23){_0xc11179['push'](_0xc11179['shift']());}};_0x198575(++_0x4ba32b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x336264,_0x32e1d9){_0x336264=_0x336264-0x0;var _0x53cf91=_0xcb91[_0x336264];return _0x53cf91;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 268f34b..fc36fd6 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 _0x67a2=['exports','sequelize'];(function(_0x2c2fbe,_0x5187a3){var _0x5275a4=function(_0x2f1ea3){while(--_0x2f1ea3){_0x2c2fbe['push'](_0x2c2fbe['shift']());}};_0x5275a4(++_0x5187a3);}(_0x67a2,0xd3));var _0x267a=function(_0x223995,_0x44debf){_0x223995=_0x223995-0x0;var _0x154c28=_0x67a2[_0x223995];return _0x154c28;};'use strict';var Sequelize=require(_0x267a('0x0'));module[_0x267a('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x895e=['INTEGER','sequelize'];(function(_0x2c69a1,_0x201903){var _0x24bb91=function(_0x3131ac){while(--_0x3131ac){_0x2c69a1['push'](_0x2c69a1['shift']());}};_0x24bb91(++_0x201903);}(_0x895e,0x153));var _0xe895=function(_0xed2582,_0x31e118){_0xed2582=_0xed2582-0x0;var _0x5a1c5d=_0x895e[_0xed2582];return _0x5a1c5d;};'use strict';var Sequelize=require(_0xe895('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xe895('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index e591992..ed0523b 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 _0x385b=['../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x378ae1,_0x289272){var _0x8bed6b=function(_0x2f4481){while(--_0x2f4481){_0x378ae1['push'](_0x378ae1['shift']());}};_0x8bed6b(++_0x289272);}(_0x385b,0x1a7));var _0xb385=function(_0x20a590,_0x1e8a6d){_0x20a590=_0x20a590-0x0;var _0x2e1b41=_0x385b[_0x20a590];return _0x2e1b41;};'use strict';var _=require('lodash');var util=require(_0xb385('0x0'));var logger=require('../../config/logger')(_0xb385('0x1'));var moment=require(_0xb385('0x2'));var BPromise=require(_0xb385('0x3'));var rp=require(_0xb385('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb385('0x5'));var config=require(_0xb385('0x6'));var attributes=require(_0xb385('0x7'));module[_0xb385('0x8')]=function(_0x3268bc,_0x576d81){return _0x3268bc[_0xb385('0x9')](_0xb385('0xa'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0eec=['exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x390cea,_0x43c078){var _0x14bf80=function(_0x196f3c){while(--_0x196f3c){_0x390cea['push'](_0x390cea['shift']());}};_0x14bf80(++_0x43c078);}(_0x0eec,0xac));var _0xc0ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0eec[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc0ee('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc0ee('0x1'));var moment=require(_0xc0ee('0x2'));var BPromise=require(_0xc0ee('0x3'));var rp=require(_0xc0ee('0x4'));var fs=require('fs');var path=require(_0xc0ee('0x5'));var rimraf=require(_0xc0ee('0x6'));var config=require(_0xc0ee('0x7'));var attributes=require('./teamVoiceQueue.attributes');module[_0xc0ee('0x8')]=function(_0x4db3d6,_0x218797){return _0x4db3d6[_0xc0ee('0x9')](_0xc0ee('0xa'),attributes,{'tableName':_0xc0ee('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 a9ce87d..c077097 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 _0xc737=['http','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x8e411,_0x4208cb){var _0x5d55df=function(_0x4c312d){while(--_0x4c312d){_0x8e411['push'](_0x8e411['shift']());}};_0x5d55df(++_0x4208cb);}(_0xc737,0x8e));var _0x7c73=function(_0x384470,_0x574338){_0x384470=_0x384470-0x0;var _0x383c51=_0xc737[_0x384470];return _0x383c51;};'use strict';var _=require(_0x7c73('0x0'));var util=require(_0x7c73('0x1'));var moment=require('moment');var BPromise=require(_0x7c73('0x2'));var rs=require(_0x7c73('0x3'));var fs=require('fs');var Redis=require(_0x7c73('0x4'));var db=require(_0x7c73('0x5'))['db'];var utils=require(_0x7c73('0x6'));var logger=require(_0x7c73('0x7'))(_0x7c73('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7c73('0x9')][_0x7c73('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd61255,_0x33bcbd,_0x4c0b1c){return new BPromise(function(_0x575a80,_0x4f9b28){return client['request'](_0xd61255,_0x4c0b1c)['then'](function(_0x155604){logger[_0x7c73('0xb')](_0x7c73('0xc'),_0x33bcbd,_0x7c73('0xd'));logger['debug'](_0x7c73('0xe'),_0x33bcbd,'request\x20sent',JSON[_0x7c73('0xf')](_0x155604));if(_0x155604[_0x7c73('0x10')]){if(_0x155604[_0x7c73('0x10')]['code']===0x1f4){logger[_0x7c73('0x10')](_0x7c73('0xc'),_0x33bcbd,_0x155604[_0x7c73('0x10')][_0x7c73('0x11')]);return _0x4f9b28(_0x155604[_0x7c73('0x10')][_0x7c73('0x11')]);}logger[_0x7c73('0x10')](_0x7c73('0xc'),_0x33bcbd,_0x155604['error'][_0x7c73('0x11')]);return _0x575a80(_0x155604[_0x7c73('0x10')]['message']);}else{logger['info'](_0x7c73('0xc'),_0x33bcbd,_0x7c73('0xd'));_0x575a80(_0x155604['result'][_0x7c73('0x11')]);}})[_0x7c73('0x12')](function(_0x26463c){logger[_0x7c73('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x33bcbd,_0x26463c);_0x4f9b28(_0x26463c);});});} \ No newline at end of file +var _0xee6e=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','randomstring'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xee6e,0x128));var _0xeee6=function(_0x243f96,_0x4d6766){_0x243f96=_0x243f96-0x0;var _0x1161d9=_0xee6e[_0x243f96];return _0x1161d9;};'use strict';var _=require(_0xeee6('0x0'));var util=require('util');var moment=require(_0xeee6('0x1'));var BPromise=require(_0xeee6('0x2'));var rs=require(_0xeee6('0x3'));var fs=require('fs');var Redis=require(_0xeee6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xeee6('0x5'));var logger=require(_0xeee6('0x6'))(_0xeee6('0x7'));var config=require(_0xeee6('0x8'));var jayson=require(_0xeee6('0x9'));var client=jayson['client'][_0xeee6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x121049,_0x30a928,_0x118a66){return new BPromise(function(_0x2a8227,_0x7aa501){return client['request'](_0x121049,_0x118a66)[_0xeee6('0xb')](function(_0x2fdb4b){logger['info'](_0xeee6('0xc'),_0x30a928,_0xeee6('0xd'));logger[_0xeee6('0xe')](_0xeee6('0xf'),_0x30a928,_0xeee6('0xd'),JSON['stringify'](_0x2fdb4b));if(_0x2fdb4b['error']){if(_0x2fdb4b[_0xeee6('0x10')][_0xeee6('0x11')]===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x30a928,_0x2fdb4b[_0xeee6('0x10')][_0xeee6('0x12')]);return _0x7aa501(_0x2fdb4b['error'][_0xeee6('0x12')]);}logger[_0xeee6('0x10')](_0xeee6('0xc'),_0x30a928,_0x2fdb4b[_0xeee6('0x10')][_0xeee6('0x12')]);return _0x2a8227(_0x2fdb4b[_0xeee6('0x10')][_0xeee6('0x12')]);}else{logger['info'](_0xeee6('0xc'),_0x30a928,'request\x20sent');_0x2a8227(_0x2fdb4b['result']['message']);}})[_0xeee6('0x13')](function(_0x4e0c7e){logger[_0xeee6('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x30a928,_0x4e0c7e);_0x7aa501(_0x4e0c7e);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 7465310..fef4d0c 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 _0x556a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./template.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','multer','util','path'];(function(_0xe51672,_0xc3ab7a){var _0x139fa1=function(_0x48cd92){while(--_0x48cd92){_0xe51672['push'](_0xe51672['shift']());}};_0x139fa1(++_0xc3ab7a);}(_0x556a,0x1dd));var _0xa556=function(_0x4e8cb3,_0x1fbb7e){_0x4e8cb3=_0x4e8cb3-0x0;var _0x2d4673=_0x556a[_0x4e8cb3];return _0x2d4673;};'use strict';var multer=require(_0xa556('0x0'));var util=require(_0xa556('0x1'));var path=require(_0xa556('0x2'));var timeout=require(_0xa556('0x3'));var express=require(_0xa556('0x4'));var router=express[_0xa556('0x5')]();var fs_extra=require(_0xa556('0x6'));var auth=require(_0xa556('0x7'));var interaction=require(_0xa556('0x8'));var config=require('../../config/environment');var controller=require(_0xa556('0x9'));router[_0xa556('0xa')]('/',auth[_0xa556('0xb')](),controller[_0xa556('0xc')]);router[_0xa556('0xa')]('/:id',auth[_0xa556('0xb')](),controller[_0xa556('0xd')]);router[_0xa556('0xe')]('/',auth[_0xa556('0xb')](),controller['create']);router[_0xa556('0xf')](_0xa556('0x10'),auth[_0xa556('0xb')](),controller[_0xa556('0x11')]);router[_0xa556('0x12')](_0xa556('0x10'),auth[_0xa556('0xb')](),controller[_0xa556('0x13')]);module['exports']=router; \ No newline at end of file +var _0xdcd5=['/:id','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xdcd5,0x110));var _0x5dcd=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xdcd5[_0x487b0c];return _0x1adbdc;};'use strict';var multer=require(_0x5dcd('0x0'));var util=require(_0x5dcd('0x1'));var path=require(_0x5dcd('0x2'));var timeout=require(_0x5dcd('0x3'));var express=require(_0x5dcd('0x4'));var router=express[_0x5dcd('0x5')]();var fs_extra=require(_0x5dcd('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5dcd('0x7'));var config=require(_0x5dcd('0x8'));var controller=require(_0x5dcd('0x9'));router[_0x5dcd('0xa')]('/',auth[_0x5dcd('0xb')](),controller[_0x5dcd('0xc')]);router[_0x5dcd('0xa')](_0x5dcd('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x5dcd('0xe')]('/',auth[_0x5dcd('0xb')](),controller[_0x5dcd('0xf')]);router['put'](_0x5dcd('0xd'),auth[_0x5dcd('0xb')](),controller[_0x5dcd('0x10')]);router[_0x5dcd('0x11')](_0x5dcd('0xd'),auth[_0x5dcd('0xb')](),controller[_0x5dcd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index da2af54..f400139 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 _0x523e=['STRING','TEXT','sequelize'];(function(_0x187f71,_0xf40f00){var _0xdf027a=function(_0x127e87){while(--_0x127e87){_0x187f71['push'](_0x187f71['shift']());}};_0xdf027a(++_0xf40f00);}(_0x523e,0x95));var _0xe523=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x523e[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xe523('0x0'));module['exports']={'name':{'type':Sequelize[_0xe523('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xe523('0x2')]}}; \ No newline at end of file +var _0x48bf=['exports','STRING','TEXT'];(function(_0x112638,_0x5e7b60){var _0x479b88=function(_0x61860){while(--_0x61860){_0x112638['push'](_0x112638['shift']());}};_0x479b88(++_0x5e7b60);}(_0x48bf,0xc9));var _0xf48b=function(_0x255a63,_0x2b8f0c){_0x255a63=_0x255a63-0x0;var _0xf6a438=_0x48bf[_0x255a63];return _0xf6a438;};'use strict';var Sequelize=require('sequelize');module[_0xf48b('0x0')]={'name':{'type':Sequelize[_0xf48b('0x1')]},'description':{'type':Sequelize[_0xf48b('0x1')]},'html':{'type':Sequelize[_0xf48b('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index aa290c1..118a423 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 _0x9e3e=['query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','options','Template','findAll','rows','catch','show','params','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','update','then','get','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map'];(function(_0x10dffa,_0x39d92e){var _0x24f7ef=function(_0x59879d){while(--_0x59879d){_0x10dffa['push'](_0x10dffa['shift']());}};_0x24f7ef(++_0x39d92e);}(_0x9e3e,0x1c4));var _0xe9e3=function(_0x57b7f9,_0x45a8e4){_0x57b7f9=_0x57b7f9-0x0;var _0x2cc4fe=_0x9e3e[_0x57b7f9];return _0x2cc4fe;};'use strict';var emlformat=require(_0xe9e3('0x0'));var rimraf=require(_0xe9e3('0x1'));var zipdir=require(_0xe9e3('0x2'));var jsonpatch=require(_0xe9e3('0x3'));var rp=require(_0xe9e3('0x4'));var moment=require(_0xe9e3('0x5'));var BPromise=require(_0xe9e3('0x6'));var Mustache=require(_0xe9e3('0x7'));var util=require('util');var path=require(_0xe9e3('0x8'));var sox=require(_0xe9e3('0x9'));var csv=require(_0xe9e3('0xa'));var ejs=require(_0xe9e3('0xb'));var fs=require('fs');var fs_extra=require(_0xe9e3('0xc'));var _=require(_0xe9e3('0xd'));var squel=require(_0xe9e3('0xe'));var crypto=require(_0xe9e3('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe9e3('0xa'));var querystring=require(_0xe9e3('0x10'));var Papa=require(_0xe9e3('0x11'));var Redis=require('ioredis');var authService=require(_0xe9e3('0x12'));var qs=require(_0xe9e3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9e3('0x14'));var logger=require(_0xe9e3('0x15'))(_0xe9e3('0x16'));var utils=require(_0xe9e3('0x17'));var config=require(_0xe9e3('0x18'));var licenseUtil=require(_0xe9e3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b608e,_0x27c427){_0x27c427=_0x27c427||0xcc;return function(_0x37b630){if(_0x37b630){return _0x3b608e[_0xe9e3('0x1a')](_0x27c427);}return _0x3b608e[_0xe9e3('0x1b')](_0x27c427)[_0xe9e3('0x1c')]();};}function respondWithResult(_0x834d22,_0x5d00df){_0x5d00df=_0x5d00df||0xc8;return function(_0x29fc47){if(_0x29fc47){return _0x834d22[_0xe9e3('0x1b')](_0x5d00df)[_0xe9e3('0x1d')](_0x29fc47);}};}function respondWithFilteredResult(_0x4043b9,_0x3d7868){return function(_0x1b8ac2){if(_0x1b8ac2){var _0x9cf262=typeof _0x3d7868[_0xe9e3('0x1e')]==='undefined'&&typeof _0x3d7868['limit']==='undefined';var _0x530cd7=_0x1b8ac2[_0xe9e3('0x1f')];var _0x597636=_0x9cf262?0x0:_0x3d7868['offset'];var _0x364b2a=_0x9cf262?_0x1b8ac2[_0xe9e3('0x1f')]:_0x3d7868[_0xe9e3('0x1e')]+_0x3d7868[_0xe9e3('0x20')];var _0x255b3d;if(_0x364b2a>=_0x530cd7){_0x364b2a=_0x530cd7;_0x255b3d=0xc8;}else{_0x255b3d=0xce;}_0x4043b9[_0xe9e3('0x1b')](_0x255b3d);return _0x4043b9[_0xe9e3('0x21')](_0xe9e3('0x22'),_0x597636+'-'+_0x364b2a+'/'+_0x530cd7)[_0xe9e3('0x1d')](_0x1b8ac2);}return null;};}function patchUpdates(_0x1b3c16){return function(_0x27c37c){try{jsonpatch[_0xe9e3('0x23')](_0x27c37c,_0x1b3c16,!![]);}catch(_0x250c59){return BPromise[_0xe9e3('0x24')](_0x250c59);}return _0x27c37c['save']();};}function saveUpdates(_0x14123f,_0x55dcca){return function(_0x573eda){if(_0x573eda){return _0x573eda[_0xe9e3('0x25')](_0x14123f)[_0xe9e3('0x26')](function(_0x2ba1fc){return _0x2ba1fc;});}return null;};}function removeEntity(_0x1a0484,_0x430a06){return function(_0x59d95f){if(_0x59d95f){return _0x59d95f['destroy']()[_0xe9e3('0x26')](function(){var _0x4db04b=_0x59d95f[_0xe9e3('0x27')]({'plain':!![]});var _0x34d589='Templates';return db['UserProfileResource'][_0xe9e3('0x28')]({'where':{'type':_0x34d589,'resourceId':_0x4db04b['id']}})[_0xe9e3('0x26')](function(){return _0x59d95f;});})[_0xe9e3('0x26')](function(){_0x1a0484['status'](0xcc)[_0xe9e3('0x1c')]();});}};}function handleEntityNotFound(_0x2fb462,_0x11afec){return function(_0x292172){if(!_0x292172){_0x2fb462[_0xe9e3('0x1a')](0x194);}return _0x292172;};}function handleError(_0x16716e,_0x5b6ebf){_0x5b6ebf=_0x5b6ebf||0x1f4;return function(_0x15c480){logger[_0xe9e3('0x29')](_0x15c480[_0xe9e3('0x2a')]);if(_0x15c480['name']){delete _0x15c480[_0xe9e3('0x2b')];}_0x16716e[_0xe9e3('0x1b')](_0x5b6ebf)[_0xe9e3('0x2c')](_0x15c480);};}exports[_0xe9e3('0x2d')]=function(_0x53d610,_0x2df41d){var _0x20f194={},_0x2d257b={},_0x23a30e={'count':0x0,'rows':[]};var _0x4f6926=_['map'](db['Template'][_0xe9e3('0x2e')],function(_0x11ef69){return{'name':_0x11ef69[_0xe9e3('0x2f')],'type':_0x11ef69[_0xe9e3('0x30')][_0xe9e3('0x31')]};});_0x2d257b[_0xe9e3('0x32')]=_[_0xe9e3('0x33')](_0x4f6926,_0xe9e3('0x2b'));_0x2d257b[_0xe9e3('0x34')]=_['keys'](_0x53d610[_0xe9e3('0x34')]);_0x2d257b[_0xe9e3('0x35')]=_['intersection'](_0x2d257b[_0xe9e3('0x32')],_0x2d257b[_0xe9e3('0x34')]);_0x20f194['attributes']=_[_0xe9e3('0x36')](_0x2d257b[_0xe9e3('0x32')],qs[_0xe9e3('0x37')](_0x53d610['query'][_0xe9e3('0x37')]));_0x20f194[_0xe9e3('0x38')]=_0x20f194[_0xe9e3('0x38')][_0xe9e3('0x39')]?_0x20f194[_0xe9e3('0x38')]:_0x2d257b['model'];if(!_0x53d610['query'][_0xe9e3('0x3a')](_0xe9e3('0x3b'))){_0x20f194[_0xe9e3('0x20')]=qs[_0xe9e3('0x20')](_0x53d610[_0xe9e3('0x34')][_0xe9e3('0x20')]);_0x20f194[_0xe9e3('0x1e')]=qs[_0xe9e3('0x1e')](_0x53d610[_0xe9e3('0x34')][_0xe9e3('0x1e')]);}_0x20f194[_0xe9e3('0x3c')]=qs[_0xe9e3('0x3d')](_0x53d610[_0xe9e3('0x34')][_0xe9e3('0x3d')]);_0x20f194['where']=qs[_0xe9e3('0x35')](_[_0xe9e3('0x3e')](_0x53d610[_0xe9e3('0x34')],_0x2d257b['filters']),_0x4f6926);if(_0x53d610[_0xe9e3('0x34')]['filter']){_0x20f194[_0xe9e3('0x3f')]=_[_0xe9e3('0x40')](_0x20f194[_0xe9e3('0x3f')],{'$or':_[_0xe9e3('0x33')](_0x4f6926,function(_0x4e3751){if(_0x4e3751[_0xe9e3('0x30')]!=='VIRTUAL'){var _0xbff463={};_0xbff463[_0x4e3751['name']]={'$like':'%'+_0x53d610[_0xe9e3('0x34')]['filter']+'%'};return _0xbff463;}})});}_0x20f194=_[_0xe9e3('0x40')]({},_0x20f194,_0x53d610[_0xe9e3('0x41')]);var _0x2d470c={'where':_0x20f194[_0xe9e3('0x3f')]};return db[_0xe9e3('0x42')][_0xe9e3('0x1f')](_0x2d470c)[_0xe9e3('0x26')](function(_0x471180){_0x23a30e['count']=_0x471180;if(_0x53d610['query']['includeAll']){_0x20f194['include']=[{'all':!![]}];}return db['Template'][_0xe9e3('0x43')](_0x20f194);})['then'](function(_0x1430aa){_0x23a30e[_0xe9e3('0x44')]=_0x1430aa;return _0x23a30e;})[_0xe9e3('0x26')](respondWithFilteredResult(_0x2df41d,_0x20f194))[_0xe9e3('0x45')](handleError(_0x2df41d,null));};exports[_0xe9e3('0x46')]=function(_0x3bdfd4,_0xaa3e8a){var _0x249efe={'raw':!![],'where':{'id':_0x3bdfd4[_0xe9e3('0x47')]['id']}},_0x4b7a81={};_0x4b7a81[_0xe9e3('0x32')]=_[_0xe9e3('0x48')](db[_0xe9e3('0x42')][_0xe9e3('0x2e')]);_0x4b7a81[_0xe9e3('0x34')]=_[_0xe9e3('0x48')](_0x3bdfd4[_0xe9e3('0x34')]);_0x4b7a81[_0xe9e3('0x35')]=_[_0xe9e3('0x36')](_0x4b7a81[_0xe9e3('0x32')],_0x4b7a81[_0xe9e3('0x34')]);_0x249efe[_0xe9e3('0x38')]=_[_0xe9e3('0x36')](_0x4b7a81[_0xe9e3('0x32')],qs[_0xe9e3('0x37')](_0x3bdfd4['query'][_0xe9e3('0x37')]));_0x249efe[_0xe9e3('0x38')]=_0x249efe[_0xe9e3('0x38')]['length']?_0x249efe['attributes']:_0x4b7a81[_0xe9e3('0x32')];if(_0x3bdfd4[_0xe9e3('0x34')]['includeAll']){_0x249efe[_0xe9e3('0x49')]=[{'all':!![]}];}_0x249efe=_[_0xe9e3('0x40')]({},_0x249efe,_0x3bdfd4[_0xe9e3('0x41')]);return db[_0xe9e3('0x42')]['find'](_0x249efe)['then'](handleEntityNotFound(_0xaa3e8a,null))[_0xe9e3('0x26')](respondWithResult(_0xaa3e8a,null))[_0xe9e3('0x45')](handleError(_0xaa3e8a,null));};exports[_0xe9e3('0x4a')]=function(_0x2c014f,_0x423176){return db[_0xe9e3('0x42')]['create'](_0x2c014f[_0xe9e3('0x4b')],{})[_0xe9e3('0x26')](function(_0x25237b){var _0x5ae3de=_0x2c014f[_0xe9e3('0x4c')]['get']({'plain':!![]});if(!_0x5ae3de)throw new Error(_0xe9e3('0x4d'));if(_0x5ae3de[_0xe9e3('0x4e')]==='user'){var _0xa1f68a=_0x25237b[_0xe9e3('0x27')]({'plain':!![]});var _0x1870f6=_0xe9e3('0x4f');return db[_0xe9e3('0x50')]['find']({'where':{'name':_0x1870f6,'userProfileId':_0x5ae3de[_0xe9e3('0x51')]},'raw':!![]})[_0xe9e3('0x26')](function(_0x38e6a1){if(_0x38e6a1&&_0x38e6a1['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xa1f68a[_0xe9e3('0x2b')],'resourceId':_0xa1f68a['id'],'type':_0x38e6a1[_0xe9e3('0x2b')],'sectionId':_0x38e6a1['id']},{})[_0xe9e3('0x26')](function(){return _0x25237b;});}else{return _0x25237b;}})['catch'](function(_0x208f13){logger[_0xe9e3('0x29')](_0xe9e3('0x52'),_0x208f13);throw _0x208f13;});}return _0x25237b;})[_0xe9e3('0x26')](respondWithResult(_0x423176,0xc9))[_0xe9e3('0x45')](handleError(_0x423176,null));};exports['update']=function(_0x24a618,_0x5c6e73){if(_0x24a618['body']['id']){delete _0x24a618[_0xe9e3('0x4b')]['id'];}return db[_0xe9e3('0x42')]['find']({'where':{'id':_0x24a618['params']['id']}})[_0xe9e3('0x26')](handleEntityNotFound(_0x5c6e73,null))[_0xe9e3('0x26')](saveUpdates(_0x24a618[_0xe9e3('0x4b')],null))['then'](respondWithResult(_0x5c6e73,null))[_0xe9e3('0x45')](handleError(_0x5c6e73,null));};exports[_0xe9e3('0x28')]=function(_0x3ab9b1,_0x307385){return db[_0xe9e3('0x42')][_0xe9e3('0x53')]({'where':{'id':_0x3ab9b1[_0xe9e3('0x47')]['id']}})['then'](handleEntityNotFound(_0x307385,null))[_0xe9e3('0x26')](removeEntity(_0x307385,null))[_0xe9e3('0x45')](handleError(_0x307385,null));}; \ No newline at end of file +var _0xbfe9=['Template','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','count','limit','set','save','update','destroy','then','get','Templates','UserProfileResource','end','sendStatus','error','name','send','map','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge'];(function(_0x270913,_0xb25fb4){var _0x1e1dba=function(_0x1bbe82){while(--_0x1bbe82){_0x270913['push'](_0x270913['shift']());}};_0x1e1dba(++_0xb25fb4);}(_0xbfe9,0x1ec));var _0x9bfe=function(_0x41d862,_0x6c9e78){_0x41d862=_0x41d862-0x0;var _0x51bef4=_0xbfe9[_0x41d862];return _0x51bef4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9bfe('0x0'));var zipdir=require(_0x9bfe('0x1'));var jsonpatch=require(_0x9bfe('0x2'));var rp=require(_0x9bfe('0x3'));var moment=require('moment');var BPromise=require(_0x9bfe('0x4'));var Mustache=require(_0x9bfe('0x5'));var util=require('util');var path=require(_0x9bfe('0x6'));var sox=require(_0x9bfe('0x7'));var csv=require(_0x9bfe('0x8'));var ejs=require(_0x9bfe('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9bfe('0xa'));var squel=require('squel');var crypto=require(_0x9bfe('0xb'));var jsforce=require(_0x9bfe('0xc'));var deskjs=require(_0x9bfe('0xd'));var toCsv=require(_0x9bfe('0x8'));var querystring=require(_0x9bfe('0xe'));var Papa=require(_0x9bfe('0xf'));var Redis=require(_0x9bfe('0x10'));var authService=require(_0x9bfe('0x11'));var qs=require(_0x9bfe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9bfe('0x13'));var logger=require(_0x9bfe('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x9bfe('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9bfe('0x16'))['db'];function respondWithStatusCode(_0x32cdf4,_0x35d606){_0x35d606=_0x35d606||0xcc;return function(_0x4a9bcd){if(_0x4a9bcd){return _0x32cdf4['sendStatus'](_0x35d606);}return _0x32cdf4['status'](_0x35d606)['end']();};}function respondWithResult(_0x1cb9e3,_0x1c5740){_0x1c5740=_0x1c5740||0xc8;return function(_0x483a18){if(_0x483a18){return _0x1cb9e3[_0x9bfe('0x17')](_0x1c5740)[_0x9bfe('0x18')](_0x483a18);}};}function respondWithFilteredResult(_0x197cb8,_0x424e43){return function(_0x1438eb){if(_0x1438eb){var _0x47bbee=typeof _0x424e43[_0x9bfe('0x19')]==='undefined'&&typeof _0x424e43['limit']==='undefined';var _0x399ca4=_0x1438eb[_0x9bfe('0x1a')];var _0x4a9bd0=_0x47bbee?0x0:_0x424e43['offset'];var _0x591178=_0x47bbee?_0x1438eb[_0x9bfe('0x1a')]:_0x424e43[_0x9bfe('0x19')]+_0x424e43[_0x9bfe('0x1b')];var _0x256415;if(_0x591178>=_0x399ca4){_0x591178=_0x399ca4;_0x256415=0xc8;}else{_0x256415=0xce;}_0x197cb8[_0x9bfe('0x17')](_0x256415);return _0x197cb8[_0x9bfe('0x1c')]('Content-Range',_0x4a9bd0+'-'+_0x591178+'/'+_0x399ca4)[_0x9bfe('0x18')](_0x1438eb);}return null;};}function patchUpdates(_0x115d70){return function(_0x60878d){try{jsonpatch['apply'](_0x60878d,_0x115d70,!![]);}catch(_0x3e0d9a){return BPromise['reject'](_0x3e0d9a);}return _0x60878d[_0x9bfe('0x1d')]();};}function saveUpdates(_0x598c3a,_0x327647){return function(_0x6707e9){if(_0x6707e9){return _0x6707e9[_0x9bfe('0x1e')](_0x598c3a)['then'](function(_0x313878){return _0x313878;});}return null;};}function removeEntity(_0x4682b1,_0x3ba699){return function(_0xbb447){if(_0xbb447){return _0xbb447[_0x9bfe('0x1f')]()[_0x9bfe('0x20')](function(){var _0x21c68f=_0xbb447[_0x9bfe('0x21')]({'plain':!![]});var _0x5dcd8b=_0x9bfe('0x22');return db[_0x9bfe('0x23')][_0x9bfe('0x1f')]({'where':{'type':_0x5dcd8b,'resourceId':_0x21c68f['id']}})[_0x9bfe('0x20')](function(){return _0xbb447;});})[_0x9bfe('0x20')](function(){_0x4682b1[_0x9bfe('0x17')](0xcc)[_0x9bfe('0x24')]();});}};}function handleEntityNotFound(_0x18b778,_0x210844){return function(_0xb47baa){if(!_0xb47baa){_0x18b778[_0x9bfe('0x25')](0x194);}return _0xb47baa;};}function handleError(_0x5d6107,_0x323207){_0x323207=_0x323207||0x1f4;return function(_0x57c9c2){logger[_0x9bfe('0x26')](_0x57c9c2['stack']);if(_0x57c9c2[_0x9bfe('0x27')]){delete _0x57c9c2[_0x9bfe('0x27')];}_0x5d6107[_0x9bfe('0x17')](_0x323207)[_0x9bfe('0x28')](_0x57c9c2);};}exports['index']=function(_0x1b3c98,_0x10f48f){var _0x59174f={},_0x432d0d={},_0x132a3b={'count':0x0,'rows':[]};var _0x4cc6f0=_[_0x9bfe('0x29')](db['Template'][_0x9bfe('0x2a')],function(_0x543f94){return{'name':_0x543f94[_0x9bfe('0x2b')],'type':_0x543f94[_0x9bfe('0x2c')]['key']};});_0x432d0d[_0x9bfe('0x2d')]=_[_0x9bfe('0x29')](_0x4cc6f0,_0x9bfe('0x27'));_0x432d0d['query']=_[_0x9bfe('0x2e')](_0x1b3c98[_0x9bfe('0x2f')]);_0x432d0d['filters']=_[_0x9bfe('0x30')](_0x432d0d[_0x9bfe('0x2d')],_0x432d0d[_0x9bfe('0x2f')]);_0x59174f['attributes']=_['intersection'](_0x432d0d[_0x9bfe('0x2d')],qs['fields'](_0x1b3c98[_0x9bfe('0x2f')][_0x9bfe('0x31')]));_0x59174f[_0x9bfe('0x32')]=_0x59174f['attributes'][_0x9bfe('0x33')]?_0x59174f[_0x9bfe('0x32')]:_0x432d0d[_0x9bfe('0x2d')];if(!_0x1b3c98[_0x9bfe('0x2f')][_0x9bfe('0x34')](_0x9bfe('0x35'))){_0x59174f['limit']=qs['limit'](_0x1b3c98[_0x9bfe('0x2f')][_0x9bfe('0x1b')]);_0x59174f['offset']=qs[_0x9bfe('0x19')](_0x1b3c98['query'][_0x9bfe('0x19')]);}_0x59174f[_0x9bfe('0x36')]=qs[_0x9bfe('0x37')](_0x1b3c98[_0x9bfe('0x2f')]['sort']);_0x59174f[_0x9bfe('0x38')]=qs[_0x9bfe('0x39')](_[_0x9bfe('0x3a')](_0x1b3c98['query'],_0x432d0d[_0x9bfe('0x39')]),_0x4cc6f0);if(_0x1b3c98[_0x9bfe('0x2f')][_0x9bfe('0x3b')]){_0x59174f[_0x9bfe('0x38')]=_[_0x9bfe('0x3c')](_0x59174f['where'],{'$or':_['map'](_0x4cc6f0,function(_0x47dea0){if(_0x47dea0[_0x9bfe('0x2c')]!=='VIRTUAL'){var _0x194e05={};_0x194e05[_0x47dea0['name']]={'$like':'%'+_0x1b3c98['query'][_0x9bfe('0x3b')]+'%'};return _0x194e05;}})});}_0x59174f=_[_0x9bfe('0x3c')]({},_0x59174f,_0x1b3c98['options']);var _0x33ca50={'where':_0x59174f[_0x9bfe('0x38')]};return db[_0x9bfe('0x3d')][_0x9bfe('0x1a')](_0x33ca50)[_0x9bfe('0x20')](function(_0x323b7a){_0x132a3b[_0x9bfe('0x1a')]=_0x323b7a;if(_0x1b3c98[_0x9bfe('0x2f')][_0x9bfe('0x3e')]){_0x59174f[_0x9bfe('0x3f')]=[{'all':!![]}];}return db[_0x9bfe('0x3d')][_0x9bfe('0x40')](_0x59174f);})[_0x9bfe('0x20')](function(_0x58e505){_0x132a3b[_0x9bfe('0x41')]=_0x58e505;return _0x132a3b;})[_0x9bfe('0x20')](respondWithFilteredResult(_0x10f48f,_0x59174f))[_0x9bfe('0x42')](handleError(_0x10f48f,null));};exports[_0x9bfe('0x43')]=function(_0x4246de,_0x513738){var _0x4f40ae={'raw':!![],'where':{'id':_0x4246de[_0x9bfe('0x44')]['id']}},_0x2889d6={};_0x2889d6['model']=_['keys'](db[_0x9bfe('0x3d')][_0x9bfe('0x2a')]);_0x2889d6[_0x9bfe('0x2f')]=_[_0x9bfe('0x2e')](_0x4246de[_0x9bfe('0x2f')]);_0x2889d6[_0x9bfe('0x39')]=_['intersection'](_0x2889d6['model'],_0x2889d6[_0x9bfe('0x2f')]);_0x4f40ae[_0x9bfe('0x32')]=_['intersection'](_0x2889d6[_0x9bfe('0x2d')],qs[_0x9bfe('0x31')](_0x4246de['query'][_0x9bfe('0x31')]));_0x4f40ae[_0x9bfe('0x32')]=_0x4f40ae[_0x9bfe('0x32')][_0x9bfe('0x33')]?_0x4f40ae[_0x9bfe('0x32')]:_0x2889d6['model'];if(_0x4246de[_0x9bfe('0x2f')]['includeAll']){_0x4f40ae[_0x9bfe('0x3f')]=[{'all':!![]}];}_0x4f40ae=_[_0x9bfe('0x3c')]({},_0x4f40ae,_0x4246de[_0x9bfe('0x45')]);return db[_0x9bfe('0x3d')][_0x9bfe('0x46')](_0x4f40ae)['then'](handleEntityNotFound(_0x513738,null))[_0x9bfe('0x20')](respondWithResult(_0x513738,null))[_0x9bfe('0x42')](handleError(_0x513738,null));};exports[_0x9bfe('0x47')]=function(_0x476ee1,_0x34f68d){return db[_0x9bfe('0x3d')][_0x9bfe('0x47')](_0x476ee1[_0x9bfe('0x48')],{})['then'](function(_0x3abe4d){var _0xf2f003=_0x476ee1[_0x9bfe('0x49')][_0x9bfe('0x21')]({'plain':!![]});if(!_0xf2f003)throw new Error(_0x9bfe('0x4a'));if(_0xf2f003['role']===_0x9bfe('0x49')){var _0x23daf6=_0x3abe4d['get']({'plain':!![]});var _0x595c4b='Templates';return db[_0x9bfe('0x4b')][_0x9bfe('0x46')]({'where':{'name':_0x595c4b,'userProfileId':_0xf2f003[_0x9bfe('0x4c')]},'raw':!![]})[_0x9bfe('0x20')](function(_0x49ad2d){if(_0x49ad2d&&_0x49ad2d[_0x9bfe('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x23daf6[_0x9bfe('0x27')],'resourceId':_0x23daf6['id'],'type':_0x49ad2d[_0x9bfe('0x27')],'sectionId':_0x49ad2d['id']},{})[_0x9bfe('0x20')](function(){return _0x3abe4d;});}else{return _0x3abe4d;}})['catch'](function(_0x5815cc){logger[_0x9bfe('0x26')](_0x9bfe('0x4e'),_0x5815cc);throw _0x5815cc;});}return _0x3abe4d;})['then'](respondWithResult(_0x34f68d,0xc9))['catch'](handleError(_0x34f68d,null));};exports[_0x9bfe('0x1e')]=function(_0x29c977,_0x2a17d8){if(_0x29c977[_0x9bfe('0x48')]['id']){delete _0x29c977[_0x9bfe('0x48')]['id'];}return db[_0x9bfe('0x3d')][_0x9bfe('0x46')]({'where':{'id':_0x29c977[_0x9bfe('0x44')]['id']}})[_0x9bfe('0x20')](handleEntityNotFound(_0x2a17d8,null))['then'](saveUpdates(_0x29c977[_0x9bfe('0x48')],null))[_0x9bfe('0x20')](respondWithResult(_0x2a17d8,null))[_0x9bfe('0x42')](handleError(_0x2a17d8,null));};exports['destroy']=function(_0xf5f186,_0x3d4b58){return db[_0x9bfe('0x3d')]['find']({'where':{'id':_0xf5f186[_0x9bfe('0x44')]['id']}})[_0x9bfe('0x20')](handleEntityNotFound(_0x3d4b58,null))[_0x9bfe('0x20')](removeEntity(_0x3d4b58,null))['catch'](handleError(_0x3d4b58,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 0e11506..54c6d21 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 _0xc68d=['exports','define','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x14e277,_0x36c856){var _0x27d9c9=function(_0x3458c2){while(--_0x3458c2){_0x14e277['push'](_0x14e277['shift']());}};_0x27d9c9(++_0x36c856);}(_0xc68d,0x1d8));var _0xdc68=function(_0x4663e1,_0x2de4ca){_0x4663e1=_0x4663e1-0x0;var _0x33064f=_0xc68d[_0x4663e1];return _0x33064f;};'use strict';var _=require(_0xdc68('0x0'));var util=require(_0xdc68('0x1'));var logger=require('../../config/logger')(_0xdc68('0x2'));var moment=require(_0xdc68('0x3'));var BPromise=require('bluebird');var rp=require(_0xdc68('0x4'));var fs=require('fs');var path=require(_0xdc68('0x5'));var rimraf=require(_0xdc68('0x6'));var config=require(_0xdc68('0x7'));var attributes=require('./template.attributes');module[_0xdc68('0x8')]=function(_0x2b887a,_0x1ff9c4){return _0x2b887a[_0xdc68('0x9')]('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0824=['Template','tools_templates','lodash','util','api','bluebird','request-promise','path','exports'];(function(_0x5ef5c0,_0x4e10c6){var _0x5c990e=function(_0x4b3ec9){while(--_0x4b3ec9){_0x5ef5c0['push'](_0x5ef5c0['shift']());}};_0x5c990e(++_0x4e10c6);}(_0x0824,0x1bb));var _0x4082=function(_0x45ae92,_0x12150e){_0x45ae92=_0x45ae92-0x0;var _0x1843d2=_0x0824[_0x45ae92];return _0x1843d2;};'use strict';var _=require(_0x4082('0x0'));var util=require(_0x4082('0x1'));var logger=require('../../config/logger')(_0x4082('0x2'));var moment=require('moment');var BPromise=require(_0x4082('0x3'));var rp=require(_0x4082('0x4'));var fs=require('fs');var path=require(_0x4082('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./template.attributes');module[_0x4082('0x6')]=function(_0x3b085c,_0x2f9264){return _0x3b085c['define'](_0x4082('0x7'),attributes,{'tableName':_0x4082('0x8'),'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 abd346e..8c3778c 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 _0xb0f6=['map','model','attributes','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','result','GetTemplate','findAll','options','raw','where','limit','include'];(function(_0x3be793,_0x592814){var _0x41b54f=function(_0xed1820){while(--_0xed1820){_0x3be793['push'](_0x3be793['shift']());}};_0x41b54f(++_0x592814);}(_0xb0f6,0x1bf));var _0x6b0f=function(_0x4ed6a2,_0x40f760){_0x4ed6a2=_0x4ed6a2-0x0;var _0x3cb0c7=_0xb0f6[_0x4ed6a2];return _0x3cb0c7;};'use strict';var _=require(_0x6b0f('0x0'));var util=require(_0x6b0f('0x1'));var moment=require(_0x6b0f('0x2'));var BPromise=require(_0x6b0f('0x3'));var rs=require(_0x6b0f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b0f('0x5'))['db'];var utils=require(_0x6b0f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6b0f('0x7'));var jayson=require(_0x6b0f('0x8'));var client=jayson[_0x6b0f('0x9')][_0x6b0f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b1acd,_0x40e919,_0x341b7c){return new BPromise(function(_0x39eca3,_0xf6741f){return client[_0x6b0f('0xb')](_0x4b1acd,_0x341b7c)[_0x6b0f('0xc')](function(_0x4aafdf){logger['info']('Template,\x20%s,\x20%s',_0x40e919,_0x6b0f('0xd'));logger[_0x6b0f('0xe')](_0x6b0f('0xf'),_0x40e919,_0x6b0f('0xd'),JSON[_0x6b0f('0x10')](_0x4aafdf));if(_0x4aafdf[_0x6b0f('0x11')]){if(_0x4aafdf[_0x6b0f('0x11')][_0x6b0f('0x12')]===0x1f4){logger[_0x6b0f('0x11')](_0x6b0f('0x13'),_0x40e919,_0x4aafdf['error'][_0x6b0f('0x14')]);return _0xf6741f(_0x4aafdf[_0x6b0f('0x11')][_0x6b0f('0x14')]);}logger[_0x6b0f('0x11')]('Template,\x20%s,\x20%s',_0x40e919,_0x4aafdf[_0x6b0f('0x11')][_0x6b0f('0x14')]);return _0x39eca3(_0x4aafdf['error'][_0x6b0f('0x14')]);}else{logger['info'](_0x6b0f('0x13'),_0x40e919,_0x6b0f('0xd'));_0x39eca3(_0x4aafdf[_0x6b0f('0x15')][_0x6b0f('0x14')]);}})['catch'](function(_0x128580){logger[_0x6b0f('0x11')](_0x6b0f('0x13'),_0x40e919,_0x128580);_0xf6741f(_0x128580);});});}exports[_0x6b0f('0x16')]=function(_0x573efa){var _0x37d057=this;return new Promise(function(_0x4a0792,_0x282e0b){return db['Template'][_0x6b0f('0x17')]({'raw':_0x573efa[_0x6b0f('0x18')]?_0x573efa[_0x6b0f('0x18')][_0x6b0f('0x19')]===undefined?!![]:![]:!![],'where':_0x573efa['options']?_0x573efa[_0x6b0f('0x18')][_0x6b0f('0x1a')]||null:null,'attributes':_0x573efa['options']?_0x573efa[_0x6b0f('0x18')]['attributes']||null:null,'limit':_0x573efa[_0x6b0f('0x18')]?_0x573efa[_0x6b0f('0x18')][_0x6b0f('0x1b')]||null:null,'include':_0x573efa[_0x6b0f('0x18')]?_0x573efa[_0x6b0f('0x18')][_0x6b0f('0x1c')]?_[_0x6b0f('0x1d')](_0x573efa[_0x6b0f('0x18')][_0x6b0f('0x1c')],function(_0x4b8927){return{'model':db[_0x4b8927['model']],'as':_0x4b8927['as'],'attributes':_0x4b8927['attributes'],'include':_0x4b8927[_0x6b0f('0x1c')]?_[_0x6b0f('0x1d')](_0x4b8927['include'],function(_0x5ebc3c){return{'model':db[_0x5ebc3c[_0x6b0f('0x1e')]],'as':_0x5ebc3c['as'],'attributes':_0x5ebc3c[_0x6b0f('0x1f')],'include':_0x5ebc3c[_0x6b0f('0x1c')]?_[_0x6b0f('0x1d')](_0x5ebc3c[_0x6b0f('0x1c')],function(_0x29dcdd){return{'model':db[_0x29dcdd[_0x6b0f('0x1e')]],'as':_0x29dcdd['as'],'attributes':_0x29dcdd['attributes']};}):[]};}):[]};}):[]:[]})[_0x6b0f('0xc')](function(_0x44a1f5){logger[_0x6b0f('0x20')](_0x6b0f('0x16'),_0x573efa);logger[_0x6b0f('0xe')](_0x6b0f('0x16'),_0x573efa,JSON[_0x6b0f('0x10')](_0x44a1f5));_0x4a0792(_0x44a1f5);})[_0x6b0f('0x21')](function(_0x3efa93){logger[_0x6b0f('0x11')]('GetTemplate',_0x3efa93[_0x6b0f('0x14')],_0x573efa);_0x282e0b(_0x37d057[_0x6b0f('0x11')](0x1f4,_0x3efa93[_0x6b0f('0x14')]));});});}; \ No newline at end of file +var _0x065d=['http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTemplate','Template','findAll','options','where','attributes','limit','include','map','model','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x1d6e21,_0x74504f){var _0x24b7df=function(_0x369c9e){while(--_0x369c9e){_0x1d6e21['push'](_0x1d6e21['shift']());}};_0x24b7df(++_0x74504f);}(_0x065d,0x1e5));var _0xd065=function(_0x1daca0,_0x26ab00){_0x1daca0=_0x1daca0-0x0;var _0x448b4f=_0x065d[_0x1daca0];return _0x448b4f;};'use strict';var _=require('lodash');var util=require(_0xd065('0x0'));var moment=require(_0xd065('0x1'));var BPromise=require('bluebird');var rs=require(_0xd065('0x2'));var fs=require('fs');var Redis=require(_0xd065('0x3'));var db=require(_0xd065('0x4'))['db'];var utils=require(_0xd065('0x5'));var logger=require(_0xd065('0x6'))(_0xd065('0x7'));var config=require(_0xd065('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd065('0x9')][_0xd065('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42cd63,_0x2b0db6,_0x18cdf3){return new BPromise(function(_0x144aef,_0x5afca0){return client[_0xd065('0xb')](_0x42cd63,_0x18cdf3)[_0xd065('0xc')](function(_0x1999e9){logger[_0xd065('0xd')](_0xd065('0xe'),_0x2b0db6,_0xd065('0xf'));logger[_0xd065('0x10')](_0xd065('0x11'),_0x2b0db6,_0xd065('0xf'),JSON[_0xd065('0x12')](_0x1999e9));if(_0x1999e9[_0xd065('0x13')]){if(_0x1999e9[_0xd065('0x13')][_0xd065('0x14')]===0x1f4){logger[_0xd065('0x13')](_0xd065('0xe'),_0x2b0db6,_0x1999e9[_0xd065('0x13')][_0xd065('0x15')]);return _0x5afca0(_0x1999e9['error']['message']);}logger['error'](_0xd065('0xe'),_0x2b0db6,_0x1999e9[_0xd065('0x13')][_0xd065('0x15')]);return _0x144aef(_0x1999e9[_0xd065('0x13')]['message']);}else{logger[_0xd065('0xd')](_0xd065('0xe'),_0x2b0db6,'request\x20sent');_0x144aef(_0x1999e9['result'][_0xd065('0x15')]);}})[_0xd065('0x16')](function(_0x5cccc0){logger[_0xd065('0x13')](_0xd065('0xe'),_0x2b0db6,_0x5cccc0);_0x5afca0(_0x5cccc0);});});}exports[_0xd065('0x17')]=function(_0x22e561){var _0x4313b3=this;return new Promise(function(_0x1bdea2,_0x305164){return db[_0xd065('0x18')][_0xd065('0x19')]({'raw':_0x22e561[_0xd065('0x1a')]?_0x22e561[_0xd065('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x22e561[_0xd065('0x1a')]?_0x22e561[_0xd065('0x1a')][_0xd065('0x1b')]||null:null,'attributes':_0x22e561[_0xd065('0x1a')]?_0x22e561['options'][_0xd065('0x1c')]||null:null,'limit':_0x22e561[_0xd065('0x1a')]?_0x22e561['options'][_0xd065('0x1d')]||null:null,'include':_0x22e561[_0xd065('0x1a')]?_0x22e561[_0xd065('0x1a')][_0xd065('0x1e')]?_[_0xd065('0x1f')](_0x22e561[_0xd065('0x1a')][_0xd065('0x1e')],function(_0x591023){return{'model':db[_0x591023[_0xd065('0x20')]],'as':_0x591023['as'],'attributes':_0x591023[_0xd065('0x1c')],'include':_0x591023[_0xd065('0x1e')]?_[_0xd065('0x1f')](_0x591023[_0xd065('0x1e')],function(_0x49036a){return{'model':db[_0x49036a[_0xd065('0x20')]],'as':_0x49036a['as'],'attributes':_0x49036a['attributes'],'include':_0x49036a[_0xd065('0x1e')]?_['map'](_0x49036a[_0xd065('0x1e')],function(_0x343ff5){return{'model':db[_0x343ff5[_0xd065('0x20')]],'as':_0x343ff5['as'],'attributes':_0x343ff5[_0xd065('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd065('0xc')](function(_0x1d31aa){logger['info'](_0xd065('0x17'),_0x22e561);logger[_0xd065('0x10')](_0xd065('0x17'),_0x22e561,JSON[_0xd065('0x12')](_0x1d31aa));_0x1bdea2(_0x1d31aa);})[_0xd065('0x16')](function(_0xd9c0db){logger[_0xd065('0x13')](_0xd065('0x17'),_0xd9c0db[_0xd065('0x15')],_0x22e561);_0x305164(_0x4313b3['error'](0x1f4,_0xd9c0db[_0xd065('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index b9e1b0a..2a30603 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 _0x5ed0=['addAction','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','index','get','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','getActions','post','create','/:id/any_conditions'];(function(_0x4866dd,_0x285df1){var _0x48baf7=function(_0x5750de){while(--_0x5750de){_0x4866dd['push'](_0x4866dd['shift']());}};_0x48baf7(++_0x285df1);}(_0x5ed0,0xcb));var _0x05ed=function(_0x2e10aa,_0x5dabf6){_0x2e10aa=_0x2e10aa-0x0;var _0x1d612d=_0x5ed0[_0x2e10aa];return _0x1d612d;};'use strict';var multer=require('multer');var util=require(_0x05ed('0x0'));var path=require(_0x05ed('0x1'));var timeout=require(_0x05ed('0x2'));var express=require(_0x05ed('0x3'));var router=express[_0x05ed('0x4')]();var fs_extra=require(_0x05ed('0x5'));var auth=require(_0x05ed('0x6'));var interaction=require(_0x05ed('0x7'));var config=require('../../config/environment');var controller=require(_0x05ed('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x05ed('0x9')]);router[_0x05ed('0xa')](_0x05ed('0xb'),auth[_0x05ed('0xc')](),controller[_0x05ed('0xd')]);router['get'](_0x05ed('0xe'),auth['isAuthenticated'](),controller[_0x05ed('0xf')]);router[_0x05ed('0xa')]('/:id/any_conditions',auth[_0x05ed('0xc')](),controller[_0x05ed('0x10')]);router['get'](_0x05ed('0x11'),auth[_0x05ed('0xc')](),controller[_0x05ed('0x12')]);router[_0x05ed('0x13')]('/',auth[_0x05ed('0xc')](),controller[_0x05ed('0x14')]);router[_0x05ed('0x13')]('/:id/all_conditions',auth['isAuthenticated'](),controller['addAllCondition']);router[_0x05ed('0x13')](_0x05ed('0x15'),auth[_0x05ed('0xc')](),controller['addAnyCondition']);router[_0x05ed('0x13')](_0x05ed('0x11'),auth[_0x05ed('0xc')](),controller[_0x05ed('0x16')]);router['put'](_0x05ed('0xb'),auth[_0x05ed('0xc')](),controller[_0x05ed('0x17')]);router['delete'](_0x05ed('0xb'),auth[_0x05ed('0xc')](),controller['destroy']);module[_0x05ed('0x18')]=router; \ No newline at end of file +var _0x4f3d=['addAction','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x4f3d,0x171));var _0xd4f3=function(_0x303b99,_0x13c87a){_0x303b99=_0x303b99-0x0;var _0x42ab80=_0x4f3d[_0x303b99];return _0x42ab80;};'use strict';var multer=require(_0xd4f3('0x0'));var util=require('util');var path=require(_0xd4f3('0x1'));var timeout=require(_0xd4f3('0x2'));var express=require(_0xd4f3('0x3'));var router=express[_0xd4f3('0x4')]();var fs_extra=require(_0xd4f3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd4f3('0x6'));var config=require(_0xd4f3('0x7'));var controller=require(_0xd4f3('0x8'));router[_0xd4f3('0x9')]('/',auth[_0xd4f3('0xa')](),controller[_0xd4f3('0xb')]);router[_0xd4f3('0x9')](_0xd4f3('0xc'),auth['isAuthenticated'](),controller[_0xd4f3('0xd')]);router[_0xd4f3('0x9')](_0xd4f3('0xe'),auth[_0xd4f3('0xa')](),controller[_0xd4f3('0xf')]);router[_0xd4f3('0x9')](_0xd4f3('0x10'),auth[_0xd4f3('0xa')](),controller['getAnyConditions']);router[_0xd4f3('0x9')](_0xd4f3('0x11'),auth['isAuthenticated'](),controller[_0xd4f3('0x12')]);router[_0xd4f3('0x13')]('/',auth['isAuthenticated'](),controller[_0xd4f3('0x14')]);router[_0xd4f3('0x13')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xd4f3('0x15')]);router[_0xd4f3('0x13')]('/:id/any_conditions',auth[_0xd4f3('0xa')](),controller[_0xd4f3('0x16')]);router[_0xd4f3('0x13')](_0xd4f3('0x11'),auth['isAuthenticated'](),controller[_0xd4f3('0x17')]);router[_0xd4f3('0x18')](_0xd4f3('0xc'),auth[_0xd4f3('0xa')](),controller[_0xd4f3('0x19')]);router[_0xd4f3('0x1a')](_0xd4f3('0xc'),auth[_0xd4f3('0xa')](),controller[_0xd4f3('0x1b')]);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 f3233bd..55928ab 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 _0x1b06=['exports','STRING','sequelize'];(function(_0x2300f2,_0x315c5f){var _0x6bd508=function(_0x2fa0f6){while(--_0x2fa0f6){_0x2300f2['push'](_0x2300f2['shift']());}};_0x6bd508(++_0x315c5f);}(_0x1b06,0x15e));var _0x61b0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1b06[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x61b0('0x0'));module[_0x61b0('0x1')]={'name':{'type':Sequelize[_0x61b0('0x2')]},'channel':{'type':Sequelize[_0x61b0('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8fc2=['BOOLEAN','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8fc2,0x8e));var _0x28fc=function(_0x2733fe,_0x45e029){_0x2733fe=_0x2733fe-0x0;var _0x1a13c4=_0x8fc2[_0x2733fe];return _0x1a13c4;};'use strict';var Sequelize=require('sequelize');module[_0x28fc('0x0')]={'name':{'type':Sequelize[_0x28fc('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x28fc('0x1')]},'status':{'type':Sequelize[_0x28fc('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 8052395..0be817b 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 _0xfa68=['undefined','limit','apply','reject','save','update','then','Triggers','UserProfileResource','end','error','stack','name','index','map','fieldName','type','key','keys','filters','intersection','query','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','Trigger','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','attributes','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','find','addAllCondition','TriggerAllId','Condition','getAllConditions','findOne','getAnyConditions','addAction','Action','getActions','rimraf','request-promise','util','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x1247ef,_0x92a2c4){var _0x28b838=function(_0x428100){while(--_0x428100){_0x1247ef['push'](_0x1247ef['shift']());}};_0x28b838(++_0x92a2c4);}(_0xfa68,0x19e));var _0x8fa6=function(_0x4d37ea,_0x3cc595){_0x4d37ea=_0x4d37ea-0x0;var _0x13390e=_0xfa68[_0x4d37ea];return _0x13390e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8fa6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8fa6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8fa6('0x2'));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(_0x8fa6('0x3'));var _=require(_0x8fa6('0x4'));var squel=require('squel');var crypto=require(_0x8fa6('0x5'));var jsforce=require(_0x8fa6('0x6'));var deskjs=require(_0x8fa6('0x7'));var toCsv=require(_0x8fa6('0x8'));var querystring=require(_0x8fa6('0x9'));var Papa=require(_0x8fa6('0xa'));var Redis=require(_0x8fa6('0xb'));var authService=require(_0x8fa6('0xc'));var qs=require(_0x8fa6('0xd'));var as=require(_0x8fa6('0xe'));var hardwareService=require(_0x8fa6('0xf'));var logger=require(_0x8fa6('0x10'))(_0x8fa6('0x11'));var utils=require(_0x8fa6('0x12'));var config=require(_0x8fa6('0x13'));var licenseUtil=require(_0x8fa6('0x14'));var db=require(_0x8fa6('0x15'))['db'];function respondWithStatusCode(_0x2cd162,_0x4ca24e){_0x4ca24e=_0x4ca24e||0xcc;return function(_0x5cde50){if(_0x5cde50){return _0x2cd162[_0x8fa6('0x16')](_0x4ca24e);}return _0x2cd162[_0x8fa6('0x17')](_0x4ca24e)['end']();};}function respondWithResult(_0x4aebe9,_0x28a574){_0x28a574=_0x28a574||0xc8;return function(_0x293f8f){if(_0x293f8f){return _0x4aebe9[_0x8fa6('0x17')](_0x28a574)[_0x8fa6('0x18')](_0x293f8f);}};}function respondWithFilteredResult(_0x49fc71,_0x1d4686){return function(_0x11c6ae){if(_0x11c6ae){var _0x33c760=typeof _0x1d4686[_0x8fa6('0x19')]===_0x8fa6('0x1a')&&typeof _0x1d4686[_0x8fa6('0x1b')]===_0x8fa6('0x1a');var _0xf1bdda=_0x11c6ae['count'];var _0x5836b3=_0x33c760?0x0:_0x1d4686[_0x8fa6('0x19')];var _0x366390=_0x33c760?_0x11c6ae['count']:_0x1d4686[_0x8fa6('0x19')]+_0x1d4686[_0x8fa6('0x1b')];var _0x21e6eb;if(_0x366390>=_0xf1bdda){_0x366390=_0xf1bdda;_0x21e6eb=0xc8;}else{_0x21e6eb=0xce;}_0x49fc71[_0x8fa6('0x17')](_0x21e6eb);return _0x49fc71['set']('Content-Range',_0x5836b3+'-'+_0x366390+'/'+_0xf1bdda)[_0x8fa6('0x18')](_0x11c6ae);}return null;};}function patchUpdates(_0x39c273){return function(_0x572a04){try{jsonpatch[_0x8fa6('0x1c')](_0x572a04,_0x39c273,!![]);}catch(_0x3cba19){return BPromise[_0x8fa6('0x1d')](_0x3cba19);}return _0x572a04[_0x8fa6('0x1e')]();};}function saveUpdates(_0x2078e9,_0x1e2e73){return function(_0x2edcbc){if(_0x2edcbc){return _0x2edcbc[_0x8fa6('0x1f')](_0x2078e9)[_0x8fa6('0x20')](function(_0x1e1b31){return _0x1e1b31;});}return null;};}function removeEntity(_0x1d2751,_0x50447c){return function(_0x64f384){if(_0x64f384){return _0x64f384['destroy']()[_0x8fa6('0x20')](function(){var _0x408dc8=_0x64f384['get']({'plain':!![]});var _0x1bbe4e=_0x8fa6('0x21');return db[_0x8fa6('0x22')]['destroy']({'where':{'type':_0x1bbe4e,'resourceId':_0x408dc8['id']}})[_0x8fa6('0x20')](function(){return _0x64f384;});})[_0x8fa6('0x20')](function(){_0x1d2751[_0x8fa6('0x17')](0xcc)[_0x8fa6('0x23')]();});}};}function handleEntityNotFound(_0x58165b,_0x1aba58){return function(_0x1af792){if(!_0x1af792){_0x58165b[_0x8fa6('0x16')](0x194);}return _0x1af792;};}function handleError(_0x5ae1f3,_0x2da0a3){_0x2da0a3=_0x2da0a3||0x1f4;return function(_0x2c4850){logger[_0x8fa6('0x24')](_0x2c4850[_0x8fa6('0x25')]);if(_0x2c4850[_0x8fa6('0x26')]){delete _0x2c4850[_0x8fa6('0x26')];}_0x5ae1f3[_0x8fa6('0x17')](_0x2da0a3)['send'](_0x2c4850);};}exports[_0x8fa6('0x27')]=function(_0x374514,_0x1861a7){var _0x6bc3f={},_0x3cb1d9={},_0x220179={'count':0x0,'rows':[]};var _0x46dea7=_[_0x8fa6('0x28')](db['Trigger']['rawAttributes'],function(_0x2ab85a){return{'name':_0x2ab85a[_0x8fa6('0x29')],'type':_0x2ab85a[_0x8fa6('0x2a')][_0x8fa6('0x2b')]};});_0x3cb1d9['model']=_[_0x8fa6('0x28')](_0x46dea7,'name');_0x3cb1d9['query']=_[_0x8fa6('0x2c')](_0x374514['query']);_0x3cb1d9[_0x8fa6('0x2d')]=_[_0x8fa6('0x2e')](_0x3cb1d9['model'],_0x3cb1d9[_0x8fa6('0x2f')]);_0x6bc3f['attributes']=_[_0x8fa6('0x2e')](_0x3cb1d9[_0x8fa6('0x30')],qs[_0x8fa6('0x31')](_0x374514[_0x8fa6('0x2f')]['fields']));_0x6bc3f['attributes']=_0x6bc3f['attributes'][_0x8fa6('0x32')]?_0x6bc3f['attributes']:_0x3cb1d9[_0x8fa6('0x30')];if(!_0x374514[_0x8fa6('0x2f')][_0x8fa6('0x33')](_0x8fa6('0x34'))){_0x6bc3f[_0x8fa6('0x1b')]=qs[_0x8fa6('0x1b')](_0x374514[_0x8fa6('0x2f')][_0x8fa6('0x1b')]);_0x6bc3f[_0x8fa6('0x19')]=qs['offset'](_0x374514['query'][_0x8fa6('0x19')]);}_0x6bc3f[_0x8fa6('0x35')]=qs[_0x8fa6('0x36')](_0x374514['query'][_0x8fa6('0x36')]);_0x6bc3f['where']=qs[_0x8fa6('0x2d')](_[_0x8fa6('0x37')](_0x374514['query'],_0x3cb1d9[_0x8fa6('0x2d')]),_0x46dea7);if(_0x374514[_0x8fa6('0x2f')][_0x8fa6('0x38')]){_0x6bc3f[_0x8fa6('0x39')]=_[_0x8fa6('0x3a')](_0x6bc3f[_0x8fa6('0x39')],{'$or':_['map'](_0x46dea7,function(_0x26dad6){if(_0x26dad6['type']!=='VIRTUAL'){var _0x481ade={};_0x481ade[_0x26dad6[_0x8fa6('0x26')]]={'$like':'%'+_0x374514[_0x8fa6('0x2f')]['filter']+'%'};return _0x481ade;}})});}_0x6bc3f=_['merge']({},_0x6bc3f,_0x374514[_0x8fa6('0x3b')]);var _0x59b298={'where':_0x6bc3f[_0x8fa6('0x39')]};return db[_0x8fa6('0x3c')][_0x8fa6('0x3d')](_0x59b298)[_0x8fa6('0x20')](function(_0x107e63){_0x220179[_0x8fa6('0x3d')]=_0x107e63;if(_0x374514[_0x8fa6('0x2f')][_0x8fa6('0x3e')]){_0x6bc3f[_0x8fa6('0x3f')]=[{'all':!![]}];}return db[_0x8fa6('0x3c')][_0x8fa6('0x40')](_0x6bc3f);})[_0x8fa6('0x20')](function(_0xd4b1b7){_0x220179[_0x8fa6('0x41')]=_0xd4b1b7;return _0x220179;})[_0x8fa6('0x20')](respondWithFilteredResult(_0x1861a7,_0x6bc3f))[_0x8fa6('0x42')](handleError(_0x1861a7,null));};exports[_0x8fa6('0x43')]=function(_0x3c8345,_0x35be30){var _0x142d59={'raw':![],'where':{'id':_0x3c8345[_0x8fa6('0x44')]['id']}},_0x2f1515={};_0x2f1515[_0x8fa6('0x30')]=_['keys'](db[_0x8fa6('0x3c')][_0x8fa6('0x45')]);_0x2f1515[_0x8fa6('0x2f')]=_[_0x8fa6('0x2c')](_0x3c8345[_0x8fa6('0x2f')]);_0x2f1515[_0x8fa6('0x2d')]=_[_0x8fa6('0x2e')](_0x2f1515[_0x8fa6('0x30')],_0x2f1515[_0x8fa6('0x2f')]);_0x142d59[_0x8fa6('0x46')]=_[_0x8fa6('0x2e')](_0x2f1515['model'],qs[_0x8fa6('0x31')](_0x3c8345['query'][_0x8fa6('0x31')]));_0x142d59['attributes']=_0x142d59[_0x8fa6('0x46')][_0x8fa6('0x32')]?_0x142d59[_0x8fa6('0x46')]:_0x2f1515[_0x8fa6('0x30')];if(_0x3c8345[_0x8fa6('0x2f')][_0x8fa6('0x3e')]){_0x142d59['include']=[{'all':!![]}];}_0x142d59=_[_0x8fa6('0x3a')]({},_0x142d59,_0x3c8345[_0x8fa6('0x3b')]);return db[_0x8fa6('0x3c')]['find'](_0x142d59)[_0x8fa6('0x20')](handleEntityNotFound(_0x35be30,null))[_0x8fa6('0x20')](respondWithResult(_0x35be30,null))[_0x8fa6('0x42')](handleError(_0x35be30,null));};exports[_0x8fa6('0x47')]=function(_0x4000b2,_0x4c8abf){return db[_0x8fa6('0x3c')][_0x8fa6('0x47')](_0x4000b2[_0x8fa6('0x48')],{})[_0x8fa6('0x20')](function(_0x3110df){var _0x111fe5=_0x4000b2[_0x8fa6('0x49')][_0x8fa6('0x4a')]({'plain':!![]});if(!_0x111fe5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x111fe5['role']===_0x8fa6('0x49')){var _0x4bf696=_0x3110df[_0x8fa6('0x4a')]({'plain':!![]});var _0x618ea=_0x8fa6('0x21');return db[_0x8fa6('0x4b')]['find']({'where':{'name':_0x618ea,'userProfileId':_0x111fe5[_0x8fa6('0x4c')]},'raw':!![]})[_0x8fa6('0x20')](function(_0x537974){if(_0x537974&&_0x537974[_0x8fa6('0x4d')]===0x0){return db[_0x8fa6('0x22')]['create']({'name':_0x4bf696[_0x8fa6('0x26')],'resourceId':_0x4bf696['id'],'type':_0x537974[_0x8fa6('0x26')],'sectionId':_0x537974['id']},{})[_0x8fa6('0x20')](function(){return _0x3110df;});}else{return _0x3110df;}})[_0x8fa6('0x42')](function(_0x13d8fc){logger[_0x8fa6('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13d8fc);throw _0x13d8fc;});}return _0x3110df;})[_0x8fa6('0x20')](respondWithResult(_0x4c8abf,0xc9))['catch'](handleError(_0x4c8abf,null));};exports['update']=function(_0x50a667,_0xd7b67f){if(_0x50a667[_0x8fa6('0x48')]['id']){delete _0x50a667[_0x8fa6('0x48')]['id'];}return db[_0x8fa6('0x3c')]['find']({'where':{'id':_0x50a667['params']['id']}})[_0x8fa6('0x20')](handleEntityNotFound(_0xd7b67f,null))[_0x8fa6('0x20')](saveUpdates(_0x50a667[_0x8fa6('0x48')],null))[_0x8fa6('0x20')](respondWithResult(_0xd7b67f,null))['catch'](handleError(_0xd7b67f,null));};exports['destroy']=function(_0x2103f8,_0x4eb60a){return db[_0x8fa6('0x3c')][_0x8fa6('0x4e')]({'where':{'id':_0x2103f8[_0x8fa6('0x44')]['id']}})[_0x8fa6('0x20')](handleEntityNotFound(_0x4eb60a,null))[_0x8fa6('0x20')](removeEntity(_0x4eb60a,null))[_0x8fa6('0x42')](handleError(_0x4eb60a,null));};exports[_0x8fa6('0x4f')]=function(_0x3bae1f,_0x3b7b9e,_0x56475e){if(_0x3bae1f[_0x8fa6('0x48')]['id']){delete _0x3bae1f[_0x8fa6('0x48')]['id'];}return db[_0x8fa6('0x3c')]['find']({'where':{'id':_0x3bae1f[_0x8fa6('0x44')]['id']}})['then'](handleEntityNotFound(_0x3b7b9e,null))[_0x8fa6('0x20')](function(_0xc9e4de){if(_0xc9e4de){_0x3bae1f[_0x8fa6('0x48')][_0x8fa6('0x50')]=_0xc9e4de['id'];return db[_0x8fa6('0x51')][_0x8fa6('0x47')](_0x3bae1f[_0x8fa6('0x48')]);}})['then'](respondWithResult(_0x3b7b9e,null))[_0x8fa6('0x42')](handleError(_0x3b7b9e,null));};exports['addAnyCondition']=function(_0x283350,_0x5054d3,_0x1f00ed){if(_0x283350[_0x8fa6('0x48')]['id']){delete _0x283350[_0x8fa6('0x48')]['id'];}return db['Trigger'][_0x8fa6('0x4e')]({'where':{'id':_0x283350[_0x8fa6('0x44')]['id']}})[_0x8fa6('0x20')](handleEntityNotFound(_0x5054d3,null))[_0x8fa6('0x20')](function(_0x4a4eb7){if(_0x4a4eb7){_0x283350['body']['TriggerAnyId']=_0x4a4eb7['id'];return db['Condition']['create'](_0x283350[_0x8fa6('0x48')]);}})[_0x8fa6('0x20')](respondWithResult(_0x5054d3,null))[_0x8fa6('0x42')](handleError(_0x5054d3,null));};exports[_0x8fa6('0x52')]=function(_0x2d9118,_0x220093,_0xcfeac9){var _0x2c519e={};var _0x353884={};var _0x2acf2e;var _0x3dcb46;return db['Trigger'][_0x8fa6('0x53')]({'where':{'id':_0x2d9118[_0x8fa6('0x44')]['id']}})[_0x8fa6('0x20')](handleEntityNotFound(_0x220093,null))['then'](function(_0x309f0f){if(_0x309f0f){_0x2acf2e=_0x309f0f;_0x353884['model']=_[_0x8fa6('0x2c')](db['Condition'][_0x8fa6('0x45')]);_0x353884[_0x8fa6('0x2f')]=_[_0x8fa6('0x2c')](_0x2d9118['query']);_0x353884[_0x8fa6('0x2d')]=_[_0x8fa6('0x2e')](_0x353884[_0x8fa6('0x30')],_0x353884[_0x8fa6('0x2f')]);_0x2c519e[_0x8fa6('0x46')]=_[_0x8fa6('0x2e')](_0x353884['model'],qs[_0x8fa6('0x31')](_0x2d9118[_0x8fa6('0x2f')][_0x8fa6('0x31')]));_0x2c519e[_0x8fa6('0x46')]=_0x2c519e[_0x8fa6('0x46')][_0x8fa6('0x32')]?_0x2c519e[_0x8fa6('0x46')]:_0x353884[_0x8fa6('0x30')];_0x2c519e[_0x8fa6('0x35')]=qs[_0x8fa6('0x36')](_0x2d9118['query'][_0x8fa6('0x36')]);_0x2c519e['where']=qs[_0x8fa6('0x2d')](_['pick'](_0x2d9118[_0x8fa6('0x2f')],_0x353884[_0x8fa6('0x2d')]));if(_0x2d9118[_0x8fa6('0x2f')][_0x8fa6('0x38')]){_0x2c519e['where']=_[_0x8fa6('0x3a')](_0x2c519e['where'],{'$or':_['map'](_0x2c519e[_0x8fa6('0x46')],function(_0x193d68){var _0x151da0={};_0x151da0[_0x193d68]={'$like':'%'+_0x2d9118['query'][_0x8fa6('0x38')]+'%'};return _0x151da0;})});}_0x2c519e=_[_0x8fa6('0x3a')]({},_0x2c519e,_0x2d9118[_0x8fa6('0x3b')]);return _0x2acf2e[_0x8fa6('0x52')](_0x2c519e);}})[_0x8fa6('0x20')](function(_0x1b2e35){if(_0x1b2e35){_0x3dcb46=_0x1b2e35[_0x8fa6('0x32')];if(!_0x2d9118['query'][_0x8fa6('0x33')](_0x8fa6('0x34'))){_0x2c519e[_0x8fa6('0x1b')]=qs['limit'](_0x2d9118['query'][_0x8fa6('0x1b')]);_0x2c519e[_0x8fa6('0x19')]=qs[_0x8fa6('0x19')](_0x2d9118[_0x8fa6('0x2f')][_0x8fa6('0x19')]);}return _0x2acf2e[_0x8fa6('0x52')](_0x2c519e);}})[_0x8fa6('0x20')](function(_0x162b4b){if(_0x162b4b){return _0x162b4b?{'count':_0x3dcb46,'rows':_0x162b4b}:null;}})[_0x8fa6('0x20')](respondWithResult(_0x220093,null))['catch'](handleError(_0x220093,null));};exports['getAnyConditions']=function(_0x2d35be,_0x48a797,_0x3ad5b7){var _0xb1da23={};var _0x5044b8={};var _0x41792f;var _0x4d2d86;return db[_0x8fa6('0x3c')][_0x8fa6('0x53')]({'where':{'id':_0x2d35be[_0x8fa6('0x44')]['id']}})[_0x8fa6('0x20')](handleEntityNotFound(_0x48a797,null))[_0x8fa6('0x20')](function(_0x438fb8){if(_0x438fb8){_0x41792f=_0x438fb8;_0x5044b8[_0x8fa6('0x30')]=_[_0x8fa6('0x2c')](db[_0x8fa6('0x51')][_0x8fa6('0x45')]);_0x5044b8[_0x8fa6('0x2f')]=_[_0x8fa6('0x2c')](_0x2d35be['query']);_0x5044b8['filters']=_[_0x8fa6('0x2e')](_0x5044b8[_0x8fa6('0x30')],_0x5044b8[_0x8fa6('0x2f')]);_0xb1da23['attributes']=_[_0x8fa6('0x2e')](_0x5044b8[_0x8fa6('0x30')],qs[_0x8fa6('0x31')](_0x2d35be[_0x8fa6('0x2f')][_0x8fa6('0x31')]));_0xb1da23[_0x8fa6('0x46')]=_0xb1da23[_0x8fa6('0x46')]['length']?_0xb1da23[_0x8fa6('0x46')]:_0x5044b8[_0x8fa6('0x30')];_0xb1da23[_0x8fa6('0x35')]=qs[_0x8fa6('0x36')](_0x2d35be[_0x8fa6('0x2f')][_0x8fa6('0x36')]);_0xb1da23['where']=qs[_0x8fa6('0x2d')](_['pick'](_0x2d35be[_0x8fa6('0x2f')],_0x5044b8['filters']));if(_0x2d35be[_0x8fa6('0x2f')][_0x8fa6('0x38')]){_0xb1da23[_0x8fa6('0x39')]=_['merge'](_0xb1da23['where'],{'$or':_[_0x8fa6('0x28')](_0xb1da23[_0x8fa6('0x46')],function(_0x3a2d8b){var _0x324539={};_0x324539[_0x3a2d8b]={'$like':'%'+_0x2d35be[_0x8fa6('0x2f')]['filter']+'%'};return _0x324539;})});}_0xb1da23=_['merge']({},_0xb1da23,_0x2d35be['options']);return _0x41792f[_0x8fa6('0x54')](_0xb1da23);}})[_0x8fa6('0x20')](function(_0x48502e){if(_0x48502e){_0x4d2d86=_0x48502e['length'];if(!_0x2d35be[_0x8fa6('0x2f')][_0x8fa6('0x33')](_0x8fa6('0x34'))){_0xb1da23[_0x8fa6('0x1b')]=qs[_0x8fa6('0x1b')](_0x2d35be[_0x8fa6('0x2f')]['limit']);_0xb1da23['offset']=qs[_0x8fa6('0x19')](_0x2d35be[_0x8fa6('0x2f')][_0x8fa6('0x19')]);}return _0x41792f['getAnyConditions'](_0xb1da23);}})[_0x8fa6('0x20')](function(_0x3252a7){if(_0x3252a7){return _0x3252a7?{'count':_0x4d2d86,'rows':_0x3252a7}:null;}})[_0x8fa6('0x20')](respondWithResult(_0x48a797,null))['catch'](handleError(_0x48a797,null));};exports[_0x8fa6('0x55')]=function(_0x364b44,_0x5c0ce7,_0x4f6be3){if(_0x364b44[_0x8fa6('0x48')]['id']){delete _0x364b44[_0x8fa6('0x48')]['id'];}return db['Trigger'][_0x8fa6('0x4e')]({'where':{'id':_0x364b44['params']['id']}})[_0x8fa6('0x20')](handleEntityNotFound(_0x5c0ce7,null))[_0x8fa6('0x20')](function(_0x7ded6d){if(_0x7ded6d){_0x364b44[_0x8fa6('0x48')]['TriggerId']=_0x7ded6d['id'];return db[_0x8fa6('0x56')][_0x8fa6('0x47')](_0x364b44[_0x8fa6('0x48')]);}})[_0x8fa6('0x20')](respondWithResult(_0x5c0ce7,null))[_0x8fa6('0x42')](handleError(_0x5c0ce7,null));};exports[_0x8fa6('0x57')]=function(_0x3a7417,_0x190a1d,_0x3f5666){var _0x140c55={};var _0x272a56={};var _0x55fd00;var _0x4682f0;return db['Trigger'][_0x8fa6('0x53')]({'where':{'id':_0x3a7417[_0x8fa6('0x44')]['id']}})[_0x8fa6('0x20')](handleEntityNotFound(_0x190a1d,null))[_0x8fa6('0x20')](function(_0x31a726){if(_0x31a726){_0x55fd00=_0x31a726;_0x272a56['model']=_[_0x8fa6('0x2c')](db[_0x8fa6('0x56')][_0x8fa6('0x45')]);_0x272a56[_0x8fa6('0x2f')]=_['keys'](_0x3a7417[_0x8fa6('0x2f')]);_0x272a56[_0x8fa6('0x2d')]=_['intersection'](_0x272a56[_0x8fa6('0x30')],_0x272a56[_0x8fa6('0x2f')]);_0x140c55[_0x8fa6('0x46')]=_[_0x8fa6('0x2e')](_0x272a56[_0x8fa6('0x30')],qs[_0x8fa6('0x31')](_0x3a7417[_0x8fa6('0x2f')]['fields']));_0x140c55[_0x8fa6('0x46')]=_0x140c55['attributes'][_0x8fa6('0x32')]?_0x140c55[_0x8fa6('0x46')]:_0x272a56[_0x8fa6('0x30')];_0x140c55['order']=qs[_0x8fa6('0x36')](_0x3a7417[_0x8fa6('0x2f')][_0x8fa6('0x36')]);_0x140c55['where']=qs['filters'](_[_0x8fa6('0x37')](_0x3a7417[_0x8fa6('0x2f')],_0x272a56[_0x8fa6('0x2d')]));if(_0x3a7417[_0x8fa6('0x2f')][_0x8fa6('0x38')]){_0x140c55['where']=_[_0x8fa6('0x3a')](_0x140c55['where'],{'$or':_['map'](_0x140c55['attributes'],function(_0x16604e){var _0x5dcfea={};_0x5dcfea[_0x16604e]={'$like':'%'+_0x3a7417['query'][_0x8fa6('0x38')]+'%'};return _0x5dcfea;})});}_0x140c55=_['merge']({},_0x140c55,_0x3a7417[_0x8fa6('0x3b')]);return _0x55fd00['getActions'](_0x140c55);}})[_0x8fa6('0x20')](function(_0x15761a){if(_0x15761a){_0x4682f0=_0x15761a[_0x8fa6('0x32')];if(!_0x3a7417[_0x8fa6('0x2f')][_0x8fa6('0x33')](_0x8fa6('0x34'))){_0x140c55[_0x8fa6('0x1b')]=qs[_0x8fa6('0x1b')](_0x3a7417[_0x8fa6('0x2f')][_0x8fa6('0x1b')]);_0x140c55[_0x8fa6('0x19')]=qs[_0x8fa6('0x19')](_0x3a7417['query'][_0x8fa6('0x19')]);}return _0x55fd00[_0x8fa6('0x57')](_0x140c55);}})['then'](function(_0x3ae567){if(_0x3ae567){return _0x3ae567?{'count':_0x4682f0,'rows':_0x3ae567}:null;}})[_0x8fa6('0x20')](respondWithResult(_0x190a1d,null))[_0x8fa6('0x42')](handleError(_0x190a1d,null));}; \ No newline at end of file +var _0xe169=['name','send','index','Trigger','fieldName','key','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','count','includeAll','findAll','rows','show','params','rawAttributes','fields','include','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','body','TriggerAllId','Condition','addAnyCondition','getAllConditions','getAnyConditions','findOne','addAction','TriggerId','Action','getActions','fast-json-patch','moment','bluebird','util','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','status','end','offset','undefined','limit','set','Content-Range','json','reject','save','update','then','destroy','get','Triggers','UserProfileResource','sendStatus','error','stack'];(function(_0x6d64be,_0xb02cba){var _0x24fdbf=function(_0x499664){while(--_0x499664){_0x6d64be['push'](_0x6d64be['shift']());}};_0x24fdbf(++_0xb02cba);}(_0xe169,0xf3));var _0x9e16=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe169[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9e16('0x0'));var rp=require('request-promise');var moment=require(_0x9e16('0x1'));var BPromise=require(_0x9e16('0x2'));var Mustache=require('mustache');var util=require(_0x9e16('0x3'));var path=require('path');var sox=require(_0x9e16('0x4'));var csv=require(_0x9e16('0x5'));var ejs=require(_0x9e16('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9e16('0x7'));var squel=require(_0x9e16('0x8'));var crypto=require(_0x9e16('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x9e16('0xa'));var toCsv=require(_0x9e16('0x5'));var querystring=require(_0x9e16('0xb'));var Papa=require(_0x9e16('0xc'));var Redis=require(_0x9e16('0xd'));var authService=require(_0x9e16('0xe'));var qs=require(_0x9e16('0xf'));var as=require(_0x9e16('0x10'));var hardwareService=require(_0x9e16('0x11'));var logger=require(_0x9e16('0x12'))(_0x9e16('0x13'));var utils=require(_0x9e16('0x14'));var config=require(_0x9e16('0x15'));var licenseUtil=require(_0x9e16('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38dd27,_0x259ab4){_0x259ab4=_0x259ab4||0xcc;return function(_0x50148f){if(_0x50148f){return _0x38dd27['sendStatus'](_0x259ab4);}return _0x38dd27[_0x9e16('0x17')](_0x259ab4)[_0x9e16('0x18')]();};}function respondWithResult(_0x434be7,_0x30e631){_0x30e631=_0x30e631||0xc8;return function(_0x4c84c0){if(_0x4c84c0){return _0x434be7[_0x9e16('0x17')](_0x30e631)['json'](_0x4c84c0);}};}function respondWithFilteredResult(_0x5ad6d7,_0x285acf){return function(_0x5750fc){if(_0x5750fc){var _0x3453b0=typeof _0x285acf[_0x9e16('0x19')]===_0x9e16('0x1a')&&typeof _0x285acf[_0x9e16('0x1b')]==='undefined';var _0x4d3437=_0x5750fc['count'];var _0x338675=_0x3453b0?0x0:_0x285acf[_0x9e16('0x19')];var _0x52ffd2=_0x3453b0?_0x5750fc['count']:_0x285acf[_0x9e16('0x19')]+_0x285acf[_0x9e16('0x1b')];var _0x1a9fcc;if(_0x52ffd2>=_0x4d3437){_0x52ffd2=_0x4d3437;_0x1a9fcc=0xc8;}else{_0x1a9fcc=0xce;}_0x5ad6d7[_0x9e16('0x17')](_0x1a9fcc);return _0x5ad6d7[_0x9e16('0x1c')](_0x9e16('0x1d'),_0x338675+'-'+_0x52ffd2+'/'+_0x4d3437)[_0x9e16('0x1e')](_0x5750fc);}return null;};}function patchUpdates(_0x42861b){return function(_0x3743d1){try{jsonpatch['apply'](_0x3743d1,_0x42861b,!![]);}catch(_0x1a8769){return BPromise[_0x9e16('0x1f')](_0x1a8769);}return _0x3743d1[_0x9e16('0x20')]();};}function saveUpdates(_0x3c1196,_0x578459){return function(_0x3d4464){if(_0x3d4464){return _0x3d4464[_0x9e16('0x21')](_0x3c1196)[_0x9e16('0x22')](function(_0x5bcbe7){return _0x5bcbe7;});}return null;};}function removeEntity(_0x4e1d65,_0x55cb6f){return function(_0x258333){if(_0x258333){return _0x258333[_0x9e16('0x23')]()[_0x9e16('0x22')](function(){var _0x4e0b06=_0x258333[_0x9e16('0x24')]({'plain':!![]});var _0x457b01=_0x9e16('0x25');return db[_0x9e16('0x26')][_0x9e16('0x23')]({'where':{'type':_0x457b01,'resourceId':_0x4e0b06['id']}})[_0x9e16('0x22')](function(){return _0x258333;});})[_0x9e16('0x22')](function(){_0x4e1d65[_0x9e16('0x17')](0xcc)[_0x9e16('0x18')]();});}};}function handleEntityNotFound(_0x308c50,_0xff55a2){return function(_0x2fb1dc){if(!_0x2fb1dc){_0x308c50[_0x9e16('0x27')](0x194);}return _0x2fb1dc;};}function handleError(_0x3c73b5,_0x1ab0fb){_0x1ab0fb=_0x1ab0fb||0x1f4;return function(_0x286280){logger[_0x9e16('0x28')](_0x286280[_0x9e16('0x29')]);if(_0x286280[_0x9e16('0x2a')]){delete _0x286280[_0x9e16('0x2a')];}_0x3c73b5[_0x9e16('0x17')](_0x1ab0fb)[_0x9e16('0x2b')](_0x286280);};}exports[_0x9e16('0x2c')]=function(_0x10cff0,_0x10122d){var _0x86a0e5={},_0x49211e={},_0x3d9ecc={'count':0x0,'rows':[]};var _0x2db9aa=_['map'](db[_0x9e16('0x2d')]['rawAttributes'],function(_0x1ed892){return{'name':_0x1ed892[_0x9e16('0x2e')],'type':_0x1ed892['type'][_0x9e16('0x2f')]};});_0x49211e['model']=_[_0x9e16('0x30')](_0x2db9aa,'name');_0x49211e[_0x9e16('0x31')]=_[_0x9e16('0x32')](_0x10cff0[_0x9e16('0x31')]);_0x49211e[_0x9e16('0x33')]=_[_0x9e16('0x34')](_0x49211e[_0x9e16('0x35')],_0x49211e['query']);_0x86a0e5[_0x9e16('0x36')]=_[_0x9e16('0x34')](_0x49211e[_0x9e16('0x35')],qs['fields'](_0x10cff0[_0x9e16('0x31')]['fields']));_0x86a0e5[_0x9e16('0x36')]=_0x86a0e5['attributes'][_0x9e16('0x37')]?_0x86a0e5[_0x9e16('0x36')]:_0x49211e[_0x9e16('0x35')];if(!_0x10cff0['query'][_0x9e16('0x38')](_0x9e16('0x39'))){_0x86a0e5[_0x9e16('0x1b')]=qs[_0x9e16('0x1b')](_0x10cff0['query']['limit']);_0x86a0e5['offset']=qs['offset'](_0x10cff0['query']['offset']);}_0x86a0e5[_0x9e16('0x3a')]=qs['sort'](_0x10cff0[_0x9e16('0x31')][_0x9e16('0x3b')]);_0x86a0e5['where']=qs[_0x9e16('0x33')](_[_0x9e16('0x3c')](_0x10cff0[_0x9e16('0x31')],_0x49211e['filters']),_0x2db9aa);if(_0x10cff0[_0x9e16('0x31')][_0x9e16('0x3d')]){_0x86a0e5[_0x9e16('0x3e')]=_[_0x9e16('0x3f')](_0x86a0e5[_0x9e16('0x3e')],{'$or':_[_0x9e16('0x30')](_0x2db9aa,function(_0x7f9bf2){if(_0x7f9bf2[_0x9e16('0x40')]!==_0x9e16('0x41')){var _0x3c8755={};_0x3c8755[_0x7f9bf2[_0x9e16('0x2a')]]={'$like':'%'+_0x10cff0['query']['filter']+'%'};return _0x3c8755;}})});}_0x86a0e5=_[_0x9e16('0x3f')]({},_0x86a0e5,_0x10cff0[_0x9e16('0x42')]);var _0x29a576={'where':_0x86a0e5[_0x9e16('0x3e')]};return db[_0x9e16('0x2d')][_0x9e16('0x43')](_0x29a576)[_0x9e16('0x22')](function(_0xdfba0a){_0x3d9ecc['count']=_0xdfba0a;if(_0x10cff0[_0x9e16('0x31')][_0x9e16('0x44')]){_0x86a0e5['include']=[{'all':!![]}];}return db[_0x9e16('0x2d')][_0x9e16('0x45')](_0x86a0e5);})['then'](function(_0x3e32e9){_0x3d9ecc[_0x9e16('0x46')]=_0x3e32e9;return _0x3d9ecc;})[_0x9e16('0x22')](respondWithFilteredResult(_0x10122d,_0x86a0e5))['catch'](handleError(_0x10122d,null));};exports[_0x9e16('0x47')]=function(_0x2003cd,_0x244969){var _0xb70c7e={'raw':![],'where':{'id':_0x2003cd[_0x9e16('0x48')]['id']}},_0x4108fb={};_0x4108fb[_0x9e16('0x35')]=_[_0x9e16('0x32')](db['Trigger'][_0x9e16('0x49')]);_0x4108fb[_0x9e16('0x31')]=_['keys'](_0x2003cd[_0x9e16('0x31')]);_0x4108fb[_0x9e16('0x33')]=_[_0x9e16('0x34')](_0x4108fb[_0x9e16('0x35')],_0x4108fb[_0x9e16('0x31')]);_0xb70c7e['attributes']=_[_0x9e16('0x34')](_0x4108fb['model'],qs[_0x9e16('0x4a')](_0x2003cd[_0x9e16('0x31')][_0x9e16('0x4a')]));_0xb70c7e['attributes']=_0xb70c7e[_0x9e16('0x36')]['length']?_0xb70c7e[_0x9e16('0x36')]:_0x4108fb[_0x9e16('0x35')];if(_0x2003cd[_0x9e16('0x31')][_0x9e16('0x44')]){_0xb70c7e[_0x9e16('0x4b')]=[{'all':!![]}];}_0xb70c7e=_[_0x9e16('0x3f')]({},_0xb70c7e,_0x2003cd[_0x9e16('0x42')]);return db[_0x9e16('0x2d')]['find'](_0xb70c7e)[_0x9e16('0x22')](handleEntityNotFound(_0x244969,null))[_0x9e16('0x22')](respondWithResult(_0x244969,null))[_0x9e16('0x4c')](handleError(_0x244969,null));};exports[_0x9e16('0x4d')]=function(_0x37110a,_0x52140c){return db[_0x9e16('0x2d')][_0x9e16('0x4d')](_0x37110a['body'],{})[_0x9e16('0x22')](function(_0x20dbb0){var _0x36cd4d=_0x37110a[_0x9e16('0x4e')][_0x9e16('0x24')]({'plain':!![]});if(!_0x36cd4d)throw new Error(_0x9e16('0x4f'));if(_0x36cd4d[_0x9e16('0x50')]===_0x9e16('0x4e')){var _0x22524d=_0x20dbb0[_0x9e16('0x24')]({'plain':!![]});var _0x1246fe=_0x9e16('0x25');return db['UserProfileSection'][_0x9e16('0x51')]({'where':{'name':_0x1246fe,'userProfileId':_0x36cd4d[_0x9e16('0x52')]},'raw':!![]})[_0x9e16('0x22')](function(_0xaaff2d){if(_0xaaff2d&&_0xaaff2d[_0x9e16('0x53')]===0x0){return db[_0x9e16('0x26')]['create']({'name':_0x22524d['name'],'resourceId':_0x22524d['id'],'type':_0xaaff2d['name'],'sectionId':_0xaaff2d['id']},{})[_0x9e16('0x22')](function(){return _0x20dbb0;});}else{return _0x20dbb0;}})[_0x9e16('0x4c')](function(_0x344132){logger[_0x9e16('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x344132);throw _0x344132;});}return _0x20dbb0;})['then'](respondWithResult(_0x52140c,0xc9))[_0x9e16('0x4c')](handleError(_0x52140c,null));};exports['update']=function(_0x5a3ed7,_0xc22c0a){if(_0x5a3ed7[_0x9e16('0x54')]['id']){delete _0x5a3ed7[_0x9e16('0x54')]['id'];}return db[_0x9e16('0x2d')][_0x9e16('0x51')]({'where':{'id':_0x5a3ed7[_0x9e16('0x48')]['id']}})[_0x9e16('0x22')](handleEntityNotFound(_0xc22c0a,null))[_0x9e16('0x22')](saveUpdates(_0x5a3ed7[_0x9e16('0x54')],null))['then'](respondWithResult(_0xc22c0a,null))[_0x9e16('0x4c')](handleError(_0xc22c0a,null));};exports['destroy']=function(_0x46cff3,_0x3c9e09){return db[_0x9e16('0x2d')][_0x9e16('0x51')]({'where':{'id':_0x46cff3[_0x9e16('0x48')]['id']}})[_0x9e16('0x22')](handleEntityNotFound(_0x3c9e09,null))[_0x9e16('0x22')](removeEntity(_0x3c9e09,null))[_0x9e16('0x4c')](handleError(_0x3c9e09,null));};exports['addAllCondition']=function(_0x51c10b,_0x2d45f6,_0x1e4e83){if(_0x51c10b['body']['id']){delete _0x51c10b['body']['id'];}return db['Trigger'][_0x9e16('0x51')]({'where':{'id':_0x51c10b[_0x9e16('0x48')]['id']}})['then'](handleEntityNotFound(_0x2d45f6,null))[_0x9e16('0x22')](function(_0x4cbc4d){if(_0x4cbc4d){_0x51c10b['body'][_0x9e16('0x55')]=_0x4cbc4d['id'];return db[_0x9e16('0x56')][_0x9e16('0x4d')](_0x51c10b[_0x9e16('0x54')]);}})[_0x9e16('0x22')](respondWithResult(_0x2d45f6,null))[_0x9e16('0x4c')](handleError(_0x2d45f6,null));};exports[_0x9e16('0x57')]=function(_0x25f20d,_0x226346,_0x12fce7){if(_0x25f20d[_0x9e16('0x54')]['id']){delete _0x25f20d[_0x9e16('0x54')]['id'];}return db[_0x9e16('0x2d')][_0x9e16('0x51')]({'where':{'id':_0x25f20d[_0x9e16('0x48')]['id']}})['then'](handleEntityNotFound(_0x226346,null))['then'](function(_0x5750ca){if(_0x5750ca){_0x25f20d[_0x9e16('0x54')]['TriggerAnyId']=_0x5750ca['id'];return db[_0x9e16('0x56')][_0x9e16('0x4d')](_0x25f20d[_0x9e16('0x54')]);}})[_0x9e16('0x22')](respondWithResult(_0x226346,null))[_0x9e16('0x4c')](handleError(_0x226346,null));};exports[_0x9e16('0x58')]=function(_0x5b1563,_0x1ad7ef,_0xc13f09){var _0x32e911={};var _0x3b8996={};var _0x5e4b1b;var _0x30937a;return db[_0x9e16('0x2d')]['findOne']({'where':{'id':_0x5b1563[_0x9e16('0x48')]['id']}})[_0x9e16('0x22')](handleEntityNotFound(_0x1ad7ef,null))[_0x9e16('0x22')](function(_0x516855){if(_0x516855){_0x5e4b1b=_0x516855;_0x3b8996[_0x9e16('0x35')]=_['keys'](db['Condition'][_0x9e16('0x49')]);_0x3b8996[_0x9e16('0x31')]=_[_0x9e16('0x32')](_0x5b1563[_0x9e16('0x31')]);_0x3b8996[_0x9e16('0x33')]=_['intersection'](_0x3b8996['model'],_0x3b8996[_0x9e16('0x31')]);_0x32e911[_0x9e16('0x36')]=_[_0x9e16('0x34')](_0x3b8996['model'],qs[_0x9e16('0x4a')](_0x5b1563['query'][_0x9e16('0x4a')]));_0x32e911['attributes']=_0x32e911[_0x9e16('0x36')][_0x9e16('0x37')]?_0x32e911[_0x9e16('0x36')]:_0x3b8996[_0x9e16('0x35')];_0x32e911[_0x9e16('0x3a')]=qs[_0x9e16('0x3b')](_0x5b1563['query'][_0x9e16('0x3b')]);_0x32e911[_0x9e16('0x3e')]=qs[_0x9e16('0x33')](_[_0x9e16('0x3c')](_0x5b1563['query'],_0x3b8996[_0x9e16('0x33')]));if(_0x5b1563[_0x9e16('0x31')]['filter']){_0x32e911[_0x9e16('0x3e')]=_[_0x9e16('0x3f')](_0x32e911[_0x9e16('0x3e')],{'$or':_[_0x9e16('0x30')](_0x32e911[_0x9e16('0x36')],function(_0x51b0d3){var _0x2ad7c7={};_0x2ad7c7[_0x51b0d3]={'$like':'%'+_0x5b1563[_0x9e16('0x31')][_0x9e16('0x3d')]+'%'};return _0x2ad7c7;})});}_0x32e911=_[_0x9e16('0x3f')]({},_0x32e911,_0x5b1563[_0x9e16('0x42')]);return _0x5e4b1b[_0x9e16('0x58')](_0x32e911);}})[_0x9e16('0x22')](function(_0x537719){if(_0x537719){_0x30937a=_0x537719['length'];if(!_0x5b1563['query'][_0x9e16('0x38')](_0x9e16('0x39'))){_0x32e911[_0x9e16('0x1b')]=qs[_0x9e16('0x1b')](_0x5b1563[_0x9e16('0x31')][_0x9e16('0x1b')]);_0x32e911[_0x9e16('0x19')]=qs[_0x9e16('0x19')](_0x5b1563[_0x9e16('0x31')][_0x9e16('0x19')]);}return _0x5e4b1b['getAllConditions'](_0x32e911);}})[_0x9e16('0x22')](function(_0x53161c){if(_0x53161c){return _0x53161c?{'count':_0x30937a,'rows':_0x53161c}:null;}})[_0x9e16('0x22')](respondWithResult(_0x1ad7ef,null))[_0x9e16('0x4c')](handleError(_0x1ad7ef,null));};exports[_0x9e16('0x59')]=function(_0x359dd9,_0xd7e9b9,_0x4cd7bc){var _0x3350f8={};var _0x1b8dfb={};var _0x354a24;var _0x5e09d9;return db['Trigger'][_0x9e16('0x5a')]({'where':{'id':_0x359dd9['params']['id']}})[_0x9e16('0x22')](handleEntityNotFound(_0xd7e9b9,null))['then'](function(_0x563413){if(_0x563413){_0x354a24=_0x563413;_0x1b8dfb['model']=_[_0x9e16('0x32')](db[_0x9e16('0x56')][_0x9e16('0x49')]);_0x1b8dfb['query']=_['keys'](_0x359dd9[_0x9e16('0x31')]);_0x1b8dfb[_0x9e16('0x33')]=_[_0x9e16('0x34')](_0x1b8dfb[_0x9e16('0x35')],_0x1b8dfb[_0x9e16('0x31')]);_0x3350f8['attributes']=_['intersection'](_0x1b8dfb['model'],qs[_0x9e16('0x4a')](_0x359dd9[_0x9e16('0x31')]['fields']));_0x3350f8[_0x9e16('0x36')]=_0x3350f8['attributes'][_0x9e16('0x37')]?_0x3350f8['attributes']:_0x1b8dfb[_0x9e16('0x35')];_0x3350f8[_0x9e16('0x3a')]=qs[_0x9e16('0x3b')](_0x359dd9['query'][_0x9e16('0x3b')]);_0x3350f8[_0x9e16('0x3e')]=qs[_0x9e16('0x33')](_[_0x9e16('0x3c')](_0x359dd9['query'],_0x1b8dfb[_0x9e16('0x33')]));if(_0x359dd9['query'][_0x9e16('0x3d')]){_0x3350f8[_0x9e16('0x3e')]=_[_0x9e16('0x3f')](_0x3350f8[_0x9e16('0x3e')],{'$or':_[_0x9e16('0x30')](_0x3350f8['attributes'],function(_0x59bd35){var _0x544f0f={};_0x544f0f[_0x59bd35]={'$like':'%'+_0x359dd9['query'][_0x9e16('0x3d')]+'%'};return _0x544f0f;})});}_0x3350f8=_['merge']({},_0x3350f8,_0x359dd9[_0x9e16('0x42')]);return _0x354a24[_0x9e16('0x59')](_0x3350f8);}})[_0x9e16('0x22')](function(_0xc5f632){if(_0xc5f632){_0x5e09d9=_0xc5f632[_0x9e16('0x37')];if(!_0x359dd9['query'][_0x9e16('0x38')](_0x9e16('0x39'))){_0x3350f8[_0x9e16('0x1b')]=qs[_0x9e16('0x1b')](_0x359dd9[_0x9e16('0x31')]['limit']);_0x3350f8['offset']=qs[_0x9e16('0x19')](_0x359dd9[_0x9e16('0x31')][_0x9e16('0x19')]);}return _0x354a24[_0x9e16('0x59')](_0x3350f8);}})['then'](function(_0x4b9674){if(_0x4b9674){return _0x4b9674?{'count':_0x5e09d9,'rows':_0x4b9674}:null;}})['then'](respondWithResult(_0xd7e9b9,null))[_0x9e16('0x4c')](handleError(_0xd7e9b9,null));};exports[_0x9e16('0x5b')]=function(_0x4d6907,_0x331b77,_0x38bc89){if(_0x4d6907[_0x9e16('0x54')]['id']){delete _0x4d6907['body']['id'];}return db[_0x9e16('0x2d')]['find']({'where':{'id':_0x4d6907[_0x9e16('0x48')]['id']}})[_0x9e16('0x22')](handleEntityNotFound(_0x331b77,null))[_0x9e16('0x22')](function(_0x48bdcf){if(_0x48bdcf){_0x4d6907[_0x9e16('0x54')][_0x9e16('0x5c')]=_0x48bdcf['id'];return db[_0x9e16('0x5d')][_0x9e16('0x4d')](_0x4d6907[_0x9e16('0x54')]);}})[_0x9e16('0x22')](respondWithResult(_0x331b77,null))[_0x9e16('0x4c')](handleError(_0x331b77,null));};exports[_0x9e16('0x5e')]=function(_0x268962,_0x20cfb3,_0x342fd1){var _0x50f43e={};var _0x150262={};var _0x2616d1;var _0x1a4974;return db[_0x9e16('0x2d')][_0x9e16('0x5a')]({'where':{'id':_0x268962[_0x9e16('0x48')]['id']}})[_0x9e16('0x22')](handleEntityNotFound(_0x20cfb3,null))['then'](function(_0x3b382a){if(_0x3b382a){_0x2616d1=_0x3b382a;_0x150262['model']=_[_0x9e16('0x32')](db[_0x9e16('0x5d')][_0x9e16('0x49')]);_0x150262[_0x9e16('0x31')]=_[_0x9e16('0x32')](_0x268962[_0x9e16('0x31')]);_0x150262['filters']=_[_0x9e16('0x34')](_0x150262[_0x9e16('0x35')],_0x150262['query']);_0x50f43e[_0x9e16('0x36')]=_[_0x9e16('0x34')](_0x150262['model'],qs['fields'](_0x268962['query'][_0x9e16('0x4a')]));_0x50f43e[_0x9e16('0x36')]=_0x50f43e['attributes']['length']?_0x50f43e['attributes']:_0x150262[_0x9e16('0x35')];_0x50f43e['order']=qs[_0x9e16('0x3b')](_0x268962['query'][_0x9e16('0x3b')]);_0x50f43e['where']=qs['filters'](_[_0x9e16('0x3c')](_0x268962[_0x9e16('0x31')],_0x150262[_0x9e16('0x33')]));if(_0x268962[_0x9e16('0x31')][_0x9e16('0x3d')]){_0x50f43e[_0x9e16('0x3e')]=_[_0x9e16('0x3f')](_0x50f43e['where'],{'$or':_[_0x9e16('0x30')](_0x50f43e['attributes'],function(_0x5775f1){var _0x438b59={};_0x438b59[_0x5775f1]={'$like':'%'+_0x268962['query'][_0x9e16('0x3d')]+'%'};return _0x438b59;})});}_0x50f43e=_[_0x9e16('0x3f')]({},_0x50f43e,_0x268962[_0x9e16('0x42')]);return _0x2616d1[_0x9e16('0x5e')](_0x50f43e);}})[_0x9e16('0x22')](function(_0x4f0e78){if(_0x4f0e78){_0x1a4974=_0x4f0e78[_0x9e16('0x37')];if(!_0x268962[_0x9e16('0x31')][_0x9e16('0x38')]('nolimit')){_0x50f43e[_0x9e16('0x1b')]=qs['limit'](_0x268962[_0x9e16('0x31')]['limit']);_0x50f43e[_0x9e16('0x19')]=qs[_0x9e16('0x19')](_0x268962[_0x9e16('0x31')][_0x9e16('0x19')]);}return _0x2616d1[_0x9e16('0x5e')](_0x50f43e);}})[_0x9e16('0x22')](function(_0x45607b){if(_0x45607b){return _0x45607b?{'count':_0x1a4974,'rows':_0x45607b}:null;}})[_0x9e16('0x22')](respondWithResult(_0x20cfb3,null))['catch'](handleError(_0x20cfb3,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index df0c330..05a6c36 100644 --- a/server/api/trigger/trigger.model.js +++ b/server/api/trigger/trigger.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe630=['util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','Trigger','lodash'];(function(_0x106466,_0xe55a0){var _0x4ae2aa=function(_0x201332){while(--_0x201332){_0x106466['push'](_0x106466['shift']());}};_0x4ae2aa(++_0xe55a0);}(_0xe630,0x149));var _0x0e63=function(_0x42f3a5,_0x3a4470){_0x42f3a5=_0x42f3a5-0x0;var _0x1a7d74=_0xe630[_0x42f3a5];return _0x1a7d74;};'use strict';var _=require(_0x0e63('0x0'));var util=require(_0x0e63('0x1'));var logger=require('../../config/logger')(_0x0e63('0x2'));var moment=require(_0x0e63('0x3'));var BPromise=require(_0x0e63('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e63('0x5'));var rimraf=require(_0x0e63('0x6'));var config=require(_0x0e63('0x7'));var attributes=require('./trigger.attributes');module[_0x0e63('0x8')]=function(_0x308039,_0x356abb){return _0x308039[_0x0e63('0x9')](_0x0e63('0xa'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc560=['../../config/environment','./trigger.attributes','define','Trigger','lodash','../../config/logger','moment','path','rimraf'];(function(_0x39ce7d,_0x36e76b){var _0x25cbec=function(_0x2ccbda){while(--_0x2ccbda){_0x39ce7d['push'](_0x39ce7d['shift']());}};_0x25cbec(++_0x36e76b);}(_0xc560,0x82));var _0x0c56=function(_0x207aa9,_0x3fff2e){_0x207aa9=_0x207aa9-0x0;var _0x512b9b=_0xc560[_0x207aa9];return _0x512b9b;};'use strict';var _=require(_0x0c56('0x0'));var util=require('util');var logger=require(_0x0c56('0x1'))('api');var moment=require(_0x0c56('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c56('0x3'));var rimraf=require(_0x0c56('0x4'));var config=require(_0x0c56('0x5'));var attributes=require(_0x0c56('0x6'));module['exports']=function(_0x2b5654,_0x2bc0a0){return _0x2b5654[_0x0c56('0x7')](_0x0c56('0x8'),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 a7d475b..c681c28 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 _0x62fd=['http','request','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','ShowTrigger','find','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x402c3,_0x576c42){var _0x607dad=function(_0xf2e578){while(--_0xf2e578){_0x402c3['push'](_0x402c3['shift']());}};_0x607dad(++_0x576c42);}(_0x62fd,0x14b));var _0xd62f=function(_0x1ba6c8,_0x5d42b0){_0x1ba6c8=_0x1ba6c8-0x0;var _0x40390b=_0x62fd[_0x1ba6c8];return _0x40390b;};'use strict';var _=require(_0xd62f('0x0'));var util=require('util');var moment=require(_0xd62f('0x1'));var BPromise=require('bluebird');var rs=require(_0xd62f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd62f('0x3'))['db'];var utils=require(_0xd62f('0x4'));var logger=require(_0xd62f('0x5'))(_0xd62f('0x6'));var config=require('../../config/environment');var jayson=require(_0xd62f('0x7'));var client=jayson[_0xd62f('0x8')][_0xd62f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34fa02,_0x3e8b62,_0x3f396e){return new BPromise(function(_0x29f44f,_0x1109be){return client[_0xd62f('0xa')](_0x34fa02,_0x3f396e)[_0xd62f('0xb')](function(_0x2e10a7){logger['info'](_0xd62f('0xc'),_0x3e8b62,_0xd62f('0xd'));logger[_0xd62f('0xe')]('Trigger,\x20%s,\x20%s,\x20%s',_0x3e8b62,_0xd62f('0xd'),JSON[_0xd62f('0xf')](_0x2e10a7));if(_0x2e10a7['error']){if(_0x2e10a7[_0xd62f('0x10')]['code']===0x1f4){logger['error'](_0xd62f('0xc'),_0x3e8b62,_0x2e10a7[_0xd62f('0x10')]['message']);return _0x1109be(_0x2e10a7[_0xd62f('0x10')][_0xd62f('0x11')]);}logger[_0xd62f('0x10')]('Trigger,\x20%s,\x20%s',_0x3e8b62,_0x2e10a7['error']['message']);return _0x29f44f(_0x2e10a7['error'][_0xd62f('0x11')]);}else{logger[_0xd62f('0x12')](_0xd62f('0xc'),_0x3e8b62,'request\x20sent');_0x29f44f(_0x2e10a7[_0xd62f('0x13')][_0xd62f('0x11')]);}})[_0xd62f('0x14')](function(_0x25ce2c){logger[_0xd62f('0x10')](_0xd62f('0xc'),_0x3e8b62,_0x25ce2c);_0x1109be(_0x25ce2c);});});}exports[_0xd62f('0x15')]=function(_0x435893){var _0x55d3f0=this;return new Promise(function(_0x5b306a,_0x107a53){return db[_0xd62f('0x16')][_0xd62f('0x17')]({'raw':_0x435893[_0xd62f('0x18')]?_0x435893[_0xd62f('0x18')][_0xd62f('0x19')]===undefined?!![]:![]:!![],'where':_0x435893['options']?_0x435893[_0xd62f('0x18')][_0xd62f('0x1a')]||null:null,'attributes':_0x435893[_0xd62f('0x18')]?_0x435893[_0xd62f('0x18')][_0xd62f('0x1b')]||null:null,'limit':_0x435893['options']?_0x435893[_0xd62f('0x18')][_0xd62f('0x1c')]||null:null,'include':_0x435893[_0xd62f('0x18')]?_0x435893['options'][_0xd62f('0x1d')]?_[_0xd62f('0x1e')](_0x435893[_0xd62f('0x18')][_0xd62f('0x1d')],function(_0x5a1c69){return{'model':db[_0x5a1c69[_0xd62f('0x1f')]],'as':_0x5a1c69['as'],'attributes':_0x5a1c69[_0xd62f('0x1b')],'include':_0x5a1c69[_0xd62f('0x1d')]?_[_0xd62f('0x1e')](_0x5a1c69[_0xd62f('0x1d')],function(_0x376d9b){return{'model':db[_0x376d9b[_0xd62f('0x1f')]],'as':_0x376d9b['as'],'attributes':_0x376d9b['attributes'],'include':_0x376d9b[_0xd62f('0x1d')]?_[_0xd62f('0x1e')](_0x376d9b[_0xd62f('0x1d')],function(_0x4c1a40){return{'model':db[_0x4c1a40['model']],'as':_0x4c1a40['as'],'attributes':_0x4c1a40[_0xd62f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd62f('0xb')](function(_0x4ad4ba){logger['info']('GetTrigger',_0x435893);logger[_0xd62f('0xe')](_0xd62f('0x15'),_0x435893,JSON[_0xd62f('0xf')](_0x4ad4ba));_0x5b306a(_0x4ad4ba);})[_0xd62f('0x14')](function(_0x5ac9e0){logger['error'](_0xd62f('0x15'),_0x5ac9e0[_0xd62f('0x11')],_0x435893);_0x107a53(_0x55d3f0['error'](0x1f4,_0x5ac9e0[_0xd62f('0x11')]));});});};exports[_0xd62f('0x20')]=function(_0xa9ae48){var _0x50fd1b=this;return new Promise(function(_0x5b0fdd,_0x317de8){return db[_0xd62f('0x16')][_0xd62f('0x21')]({'raw':_0xa9ae48[_0xd62f('0x18')]?_0xa9ae48['options'][_0xd62f('0x19')]===undefined?!![]:![]:!![],'where':_0xa9ae48[_0xd62f('0x18')]?_0xa9ae48['options'][_0xd62f('0x1a')]||null:null,'attributes':_0xa9ae48['options']?_0xa9ae48[_0xd62f('0x18')]['attributes']||null:null,'include':_0xa9ae48[_0xd62f('0x18')]?_0xa9ae48['options']['include']?_[_0xd62f('0x1e')](_0xa9ae48[_0xd62f('0x18')][_0xd62f('0x1d')],function(_0x523309){return{'model':db[_0x523309['model']],'as':_0x523309['as'],'attributes':_0x523309[_0xd62f('0x1b')],'include':_0x523309[_0xd62f('0x1d')]?_[_0xd62f('0x1e')](_0x523309['include'],function(_0x53b5ed){return{'model':db[_0x53b5ed[_0xd62f('0x1f')]],'as':_0x53b5ed['as'],'attributes':_0x53b5ed[_0xd62f('0x1b')],'include':_0x53b5ed['include']?_[_0xd62f('0x1e')](_0x53b5ed['include'],function(_0x5c65a0){return{'model':db[_0x5c65a0[_0xd62f('0x1f')]],'as':_0x5c65a0['as'],'attributes':_0x5c65a0['attributes']};}):[]};}):[]};}):[]:[]})[_0xd62f('0xb')](function(_0x3dc8d9){logger[_0xd62f('0x12')]('ShowTrigger',_0xa9ae48);logger[_0xd62f('0xe')](_0xd62f('0x20'),_0xa9ae48,JSON[_0xd62f('0xf')](_0x3dc8d9));_0x5b0fdd(_0x3dc8d9);})[_0xd62f('0x14')](function(_0x2df749){logger[_0xd62f('0x10')](_0xd62f('0x20'),_0x2df749[_0xd62f('0x11')],_0xa9ae48);_0x317de8(_0x50fd1b[_0xd62f('0x10')](0x1f4,_0x2df749['message']));});});}; \ No newline at end of file +var _0x7370=['http','request','then','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Trigger,\x20%s,\x20%s','message','info','result','catch','GetTrigger','findAll','options','raw','where','attributes','limit','include','map','model','find','debug','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x296607,_0x58dcee){var _0x2531a2=function(_0x536720){while(--_0x536720){_0x296607['push'](_0x296607['shift']());}};_0x2531a2(++_0x58dcee);}(_0x7370,0x1e2));var _0x0737=function(_0x267be3,_0x18ef5f){_0x267be3=_0x267be3-0x0;var _0x57fe29=_0x7370[_0x267be3];return _0x57fe29;};'use strict';var _=require(_0x0737('0x0'));var util=require(_0x0737('0x1'));var moment=require(_0x0737('0x2'));var BPromise=require(_0x0737('0x3'));var rs=require(_0x0737('0x4'));var fs=require('fs');var Redis=require(_0x0737('0x5'));var db=require(_0x0737('0x6'))['db'];var utils=require(_0x0737('0x7'));var logger=require(_0x0737('0x8'))(_0x0737('0x9'));var config=require(_0x0737('0xa'));var jayson=require(_0x0737('0xb'));var client=jayson['client'][_0x0737('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb44b81,_0x3e424a,_0x11f6c8){return new BPromise(function(_0x57909f,_0x61bc0e){return client[_0x0737('0xd')](_0xb44b81,_0x11f6c8)[_0x0737('0xe')](function(_0xd89bb2){logger['info']('Trigger,\x20%s,\x20%s',_0x3e424a,'request\x20sent');logger['debug'](_0x0737('0xf'),_0x3e424a,_0x0737('0x10'),JSON[_0x0737('0x11')](_0xd89bb2));if(_0xd89bb2[_0x0737('0x12')]){if(_0xd89bb2[_0x0737('0x12')][_0x0737('0x13')]===0x1f4){logger[_0x0737('0x12')](_0x0737('0x14'),_0x3e424a,_0xd89bb2['error']['message']);return _0x61bc0e(_0xd89bb2[_0x0737('0x12')][_0x0737('0x15')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x3e424a,_0xd89bb2[_0x0737('0x12')][_0x0737('0x15')]);return _0x57909f(_0xd89bb2[_0x0737('0x12')][_0x0737('0x15')]);}else{logger[_0x0737('0x16')](_0x0737('0x14'),_0x3e424a,_0x0737('0x10'));_0x57909f(_0xd89bb2[_0x0737('0x17')][_0x0737('0x15')]);}})[_0x0737('0x18')](function(_0x5c6f9f){logger[_0x0737('0x12')](_0x0737('0x14'),_0x3e424a,_0x5c6f9f);_0x61bc0e(_0x5c6f9f);});});}exports[_0x0737('0x19')]=function(_0x17c441){var _0x3bc633=this;return new Promise(function(_0x5cca1b,_0x2cadd2){return db['Trigger'][_0x0737('0x1a')]({'raw':_0x17c441[_0x0737('0x1b')]?_0x17c441['options'][_0x0737('0x1c')]===undefined?!![]:![]:!![],'where':_0x17c441[_0x0737('0x1b')]?_0x17c441[_0x0737('0x1b')][_0x0737('0x1d')]||null:null,'attributes':_0x17c441[_0x0737('0x1b')]?_0x17c441['options'][_0x0737('0x1e')]||null:null,'limit':_0x17c441['options']?_0x17c441[_0x0737('0x1b')][_0x0737('0x1f')]||null:null,'include':_0x17c441[_0x0737('0x1b')]?_0x17c441['options'][_0x0737('0x20')]?_[_0x0737('0x21')](_0x17c441[_0x0737('0x1b')][_0x0737('0x20')],function(_0x5ef450){return{'model':db[_0x5ef450[_0x0737('0x22')]],'as':_0x5ef450['as'],'attributes':_0x5ef450['attributes'],'include':_0x5ef450[_0x0737('0x20')]?_['map'](_0x5ef450[_0x0737('0x20')],function(_0x463874){return{'model':db[_0x463874[_0x0737('0x22')]],'as':_0x463874['as'],'attributes':_0x463874[_0x0737('0x1e')],'include':_0x463874[_0x0737('0x20')]?_[_0x0737('0x21')](_0x463874[_0x0737('0x20')],function(_0x367015){return{'model':db[_0x367015[_0x0737('0x22')]],'as':_0x367015['as'],'attributes':_0x367015[_0x0737('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0737('0xe')](function(_0x4d1997){logger['info']('GetTrigger',_0x17c441);logger['debug'](_0x0737('0x19'),_0x17c441,JSON['stringify'](_0x4d1997));_0x5cca1b(_0x4d1997);})[_0x0737('0x18')](function(_0x233f42){logger['error']('GetTrigger',_0x233f42[_0x0737('0x15')],_0x17c441);_0x2cadd2(_0x3bc633[_0x0737('0x12')](0x1f4,_0x233f42[_0x0737('0x15')]));});});};exports['ShowTrigger']=function(_0x458005){var _0x476bad=this;return new Promise(function(_0x5bd766,_0x563364){return db['Trigger'][_0x0737('0x23')]({'raw':_0x458005[_0x0737('0x1b')]?_0x458005[_0x0737('0x1b')][_0x0737('0x1c')]===undefined?!![]:![]:!![],'where':_0x458005['options']?_0x458005[_0x0737('0x1b')][_0x0737('0x1d')]||null:null,'attributes':_0x458005[_0x0737('0x1b')]?_0x458005[_0x0737('0x1b')]['attributes']||null:null,'include':_0x458005['options']?_0x458005[_0x0737('0x1b')][_0x0737('0x20')]?_[_0x0737('0x21')](_0x458005['options'][_0x0737('0x20')],function(_0x45e55c){return{'model':db[_0x45e55c[_0x0737('0x22')]],'as':_0x45e55c['as'],'attributes':_0x45e55c[_0x0737('0x1e')],'include':_0x45e55c['include']?_['map'](_0x45e55c[_0x0737('0x20')],function(_0x558abb){return{'model':db[_0x558abb['model']],'as':_0x558abb['as'],'attributes':_0x558abb[_0x0737('0x1e')],'include':_0x558abb['include']?_['map'](_0x558abb[_0x0737('0x20')],function(_0x252a46){return{'model':db[_0x252a46[_0x0737('0x22')]],'as':_0x252a46['as'],'attributes':_0x252a46[_0x0737('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0737('0xe')](function(_0x2ff2b5){logger[_0x0737('0x16')]('ShowTrigger',_0x458005);logger[_0x0737('0x24')]('ShowTrigger',_0x458005,JSON['stringify'](_0x2ff2b5));_0x5bd766(_0x2ff2b5);})[_0x0737('0x18')](function(_0x322ff8){logger[_0x0737('0x12')](_0x0737('0x25'),_0x322ff8[_0x0737('0x15')],_0x458005);_0x563364(_0x476bad[_0x0737('0x12')](0x1f4,_0x322ff8['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index e692b7f..8b06179 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 _0xf1a0=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','create','put','update','delete','destroy','multer','util'];(function(_0x5f42f1,_0x956be5){var _0x5534ee=function(_0x532333){while(--_0x532333){_0x5f42f1['push'](_0x5f42f1['shift']());}};_0x5534ee(++_0x956be5);}(_0xf1a0,0x157));var _0x0f1a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf1a0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0f1a('0x0'));var util=require(_0x0f1a('0x1'));var path=require(_0x0f1a('0x2'));var timeout=require('connect-timeout');var express=require(_0x0f1a('0x3'));var router=express[_0x0f1a('0x4')]();var fs_extra=require(_0x0f1a('0x5'));var auth=require(_0x0f1a('0x6'));var interaction=require(_0x0f1a('0x7'));var config=require(_0x0f1a('0x8'));var controller=require(_0x0f1a('0x9'));router[_0x0f1a('0xa')]('/',auth[_0x0f1a('0xb')](),controller[_0x0f1a('0xc')]);router[_0x0f1a('0xa')](_0x0f1a('0xd'),auth[_0x0f1a('0xb')](),controller[_0x0f1a('0xe')]);router[_0x0f1a('0xf')](_0x0f1a('0x10'),auth[_0x0f1a('0xb')](),controller[_0x0f1a('0x11')]);router[_0x0f1a('0xf')]('/',auth[_0x0f1a('0xb')](),controller[_0x0f1a('0x12')]);router[_0x0f1a('0x13')](_0x0f1a('0xd'),auth[_0x0f1a('0xb')](),controller[_0x0f1a('0x14')]);router[_0x0f1a('0x15')](_0x0f1a('0xd'),auth[_0x0f1a('0xb')](),controller[_0x0f1a('0x16')]);module['exports']=router; \ No newline at end of file +var _0x5d70=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','post','/:id/clone','create','put','update','delete','destroy','exports','multer'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5d70,0x83));var _0x05d7=function(_0x125f19,_0x2bb9d3){_0x125f19=_0x125f19-0x0;var _0x1eeb16=_0x5d70[_0x125f19];return _0x1eeb16;};'use strict';var multer=require(_0x05d7('0x0'));var util=require(_0x05d7('0x1'));var path=require(_0x05d7('0x2'));var timeout=require(_0x05d7('0x3'));var express=require(_0x05d7('0x4'));var router=express[_0x05d7('0x5')]();var fs_extra=require(_0x05d7('0x6'));var auth=require(_0x05d7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x05d7('0x8'));var controller=require(_0x05d7('0x9'));router[_0x05d7('0xa')]('/',auth[_0x05d7('0xb')](),controller[_0x05d7('0xc')]);router[_0x05d7('0xa')](_0x05d7('0xd'),auth[_0x05d7('0xb')](),controller['show']);router[_0x05d7('0xe')](_0x05d7('0xf'),auth[_0x05d7('0xb')](),controller['clone']);router[_0x05d7('0xe')]('/',auth[_0x05d7('0xb')](),controller[_0x05d7('0x10')]);router[_0x05d7('0x11')](_0x05d7('0xd'),auth['isAuthenticated'](),controller[_0x05d7('0x12')]);router[_0x05d7('0x13')](_0x05d7('0xd'),auth['isAuthenticated'](),controller[_0x05d7('0x14')]);module[_0x05d7('0x15')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 264ac84..03d664b 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 _0x9b2f=['ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','originate','uas','pai','fingerprint','active','actpass','dynamic','nonat','update,nonat','BOOLEAN','exports','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','update','outgoing','setDataValue','nat','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow'];(function(_0x1e426c,_0x499bd5){var _0x24bf99=function(_0x5bbc49){while(--_0x5bbc49){_0x1e426c['push'](_0x1e426c['shift']());}};_0x24bf99(++_0x499bd5);}(_0x9b2f,0x1cd));var _0xf9b2=function(_0x2d0d9f,_0x22c0d8){_0x2d0d9f=_0x2d0d9f-0x0;var _0x30243d=_0x9b2f[_0x2d0d9f];return _0x30243d;};'use strict';var Sequelize=require('sequelize');module[_0xf9b2('0x0')]={'name':{'type':Sequelize[_0xf9b2('0x1')],'allowNull':![],'unique':_0xf9b2('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf9b2('0x3')](_0xf9b2('0x4'),_0xf9b2('0x5'),'peer'),'allowNull':![],'defaultValue':_0xf9b2('0x4')},'context':{'type':Sequelize[_0xf9b2('0x1')],'allowNull':![],'defaultValue':_0xf9b2('0x6')},'callingpres':{'type':Sequelize[_0xf9b2('0x3')](_0xf9b2('0x7'),'ALLOWED_PASSED_SCREEN',_0xf9b2('0x8'),'ALLOWED',_0xf9b2('0x9'),_0xf9b2('0xa'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0xf9b2('0x1')]},'permit':{'type':Sequelize[_0xf9b2('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xf9b2('0x1')]},'remotesecret':{'type':Sequelize[_0xf9b2('0x1')]},'transport':{'type':Sequelize[_0xf9b2('0x1')],'defaultValue':'udp','set':function(_0x2f5580){this['setDataValue'](_0xf9b2('0xb'),_0x2f5580?_0x2f5580[_0xf9b2('0xc')](','):null);},'get':function(){return this['getDataValue'](_0xf9b2('0xb'))?this['getDataValue'](_0xf9b2('0xb'))[_0xf9b2('0xd')](','):null;},'comment':_0xf9b2('0xe')},'dtmfmode':{'type':Sequelize[_0xf9b2('0x3')]('rfc2833',_0xf9b2('0xf'),_0xf9b2('0x10'),_0xf9b2('0x11'),_0xf9b2('0x12')),'defaultValue':_0xf9b2('0x13')},'directmedia':{'type':Sequelize[_0xf9b2('0x3')](_0xf9b2('0x14'),'no','nonat',_0xf9b2('0x15'),_0xf9b2('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf9b2('0x3')](_0xf9b2('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf9b2('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xf9b2('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x158d85){this[_0xf9b2('0x17')](_0xf9b2('0x18'),_0x158d85?_0x158d85[_0xf9b2('0xc')](','):null);},'get':function(){return this[_0xf9b2('0x19')](_0xf9b2('0x18'))?this[_0xf9b2('0x19')]('nat')[_0xf9b2('0xd')](','):null;},'comment':_0xf9b2('0x1a')},'callgroup':{'type':Sequelize[_0xf9b2('0x1')]},'namedcallgroup':{'type':Sequelize[_0xf9b2('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf9b2('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xf9b2('0x1')],'defaultValue':_0xf9b2('0x1b')},'allow':{'type':Sequelize[_0xf9b2('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x11c86e){this[_0xf9b2('0x17')](_0xf9b2('0x1c'),_0x11c86e?_0x11c86e['join'](';'):_0xf9b2('0x1d'));},'get':function(){return this[_0xf9b2('0x19')]('allow')?this[_0xf9b2('0x19')](_0xf9b2('0x1c'))[_0xf9b2('0xd')](';'):null;},'comment':_0xf9b2('0x1e')},'autoframing':{'type':Sequelize[_0xf9b2('0x3')](_0xf9b2('0x14'),'no')},'insecure':{'type':Sequelize[_0xf9b2('0x1')],'defaultValue':_0xf9b2('0x1f'),'set':function(_0x43aa3a){this[_0xf9b2('0x17')](_0xf9b2('0x20'),_0x43aa3a?_0x43aa3a[_0xf9b2('0xc')](','):null);},'get':function(){return this[_0xf9b2('0x19')](_0xf9b2('0x20'))?this[_0xf9b2('0x19')](_0xf9b2('0x20'))['split'](','):null;},'comment':_0xf9b2('0x21')},'trustrpid':{'type':Sequelize[_0xf9b2('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf9b2('0x3')](_0xf9b2('0x14'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf9b2('0x3')](_0xf9b2('0x14'),'no',_0xf9b2('0x22'))},'promiscredir':{'type':Sequelize[_0xf9b2('0x3')](_0xf9b2('0x14'),'no')},'useclientcode':{'type':Sequelize[_0xf9b2('0x3')](_0xf9b2('0x14'),'no')},'accountcode':{'type':Sequelize[_0xf9b2('0x23')](0xb)},'setvar':{'type':Sequelize[_0xf9b2('0x1')]},'callerid':{'type':Sequelize[_0xf9b2('0x1')],'defaultValue':_0xf9b2('0x24')},'amaflags':{'type':Sequelize[_0xf9b2('0x1')]},'callcounter':{'type':Sequelize[_0xf9b2('0x3')](_0xf9b2('0x14'),'no'),'defaultValue':_0xf9b2('0x14')},'busylevel':{'type':Sequelize[_0xf9b2('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0xf9b2('0x3')](_0xf9b2('0x14'),'no')},'allowsubscribe':{'type':Sequelize[_0xf9b2('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xf9b2('0x3')](_0xf9b2('0x14'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xf9b2('0x14'),'no')},'subscribecontext':{'type':Sequelize[_0xf9b2('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xf9b2('0x3')](_0xf9b2('0x14'),'no',_0xf9b2('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf9b2('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xf9b2('0x3')](_0xf9b2('0x14'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xf9b2('0x3')](_0xf9b2('0x26'),'refuse',_0xf9b2('0x27'))},'session_expires':{'type':Sequelize[_0xf9b2('0x23')](0xb)},'session_minse':{'type':Sequelize[_0xf9b2('0x23')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac','uas'),'defaultValue':_0xf9b2('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0xf9b2('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xf9b2('0x1')]},'port':{'type':Sequelize[_0xf9b2('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xf9b2('0x14'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xf9b2('0x23')](0xb)},'defaultip':{'type':Sequelize[_0xf9b2('0x1')]},'defaultuser':{'type':Sequelize[_0xf9b2('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xf9b2('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xf9b2('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0xf9b2('0x3')](_0xf9b2('0x14'),'no',_0xf9b2('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xf9b2('0x1')]},'timert1':{'type':Sequelize[_0xf9b2('0x23')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xf9b2('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0xf9b2('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xf9b2('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xf9b2('0x1')]},'maxforwards':{'type':Sequelize[_0xf9b2('0x23')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xf9b2('0x14'),'no')},'force_avp':{'type':Sequelize[_0xf9b2('0x3')]('yes','no')},'icesupport':{'type':Sequelize[_0xf9b2('0x3')](_0xf9b2('0x14'),'no')},'dtlsenable':{'type':Sequelize[_0xf9b2('0x3')](_0xf9b2('0x14'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xf9b2('0x14'),'no',_0xf9b2('0x2a'),'certificate')},'dtlsrekey':{'type':Sequelize[_0xf9b2('0x23')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xf9b2('0x1')]},'dtlscipher':{'type':Sequelize[_0xf9b2('0x1')]},'dtlscafile':{'type':Sequelize[_0xf9b2('0x1')]},'dtlscapath':{'type':Sequelize[_0xf9b2('0x1')]},'dtlssetup':{'type':Sequelize[_0xf9b2('0x3')](_0xf9b2('0x2b'),'passive',_0xf9b2('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xf9b2('0x1')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xf9b2('0x3')](_0xf9b2('0x14'),'no')},'subscribemwi':{'type':Sequelize[_0xf9b2('0x3')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xf9b2('0x1')]},'mohsuggest':{'type':Sequelize[_0xf9b2('0x1')]},'parkinglot':{'type':Sequelize[_0xf9b2('0x1')]},'description':{'type':Sequelize[_0xf9b2('0x1')]},'host':{'type':Sequelize[_0xf9b2('0x1')],'defaultValue':_0xf9b2('0x2d')},'canreinvite':{'type':Sequelize['ENUM'](_0xf9b2('0x14'),'no',_0xf9b2('0x2e'),'update',_0xf9b2('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xf9b2('0x1')]},'otherFields':{'type':Sequelize[_0xf9b2('0x1')]},'active':{'type':Sequelize[_0xf9b2('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xf9b2('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x4fbc=['peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','port,invite','insecure','never','INTEGER','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','update,nonat','BOOLEAN','STRING','ENUM','friend'];(function(_0x257017,_0x330627){var _0x38536d=function(_0xdf92e){while(--_0xdf92e){_0x257017['push'](_0x257017['shift']());}};_0x38536d(++_0x330627);}(_0x4fbc,0x1c9));var _0xc4fb=function(_0x386dea,_0xbd662e){_0x386dea=_0x386dea-0x0;var _0x11450d=_0x4fbc[_0x386dea];return _0x11450d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc4fb('0x0')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc4fb('0x1')](_0xc4fb('0x2'),'user',_0xc4fb('0x3')),'allowNull':![],'defaultValue':_0xc4fb('0x2')},'context':{'type':Sequelize[_0xc4fb('0x0')],'allowNull':![],'defaultValue':_0xc4fb('0x4')},'callingpres':{'type':Sequelize[_0xc4fb('0x1')](_0xc4fb('0x5'),_0xc4fb('0x6'),_0xc4fb('0x7'),'ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xc4fb('0x8'),_0xc4fb('0x9'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xc4fb('0x0')]},'md5secret':{'type':Sequelize[_0xc4fb('0x0')]},'remotesecret':{'type':Sequelize[_0xc4fb('0x0')]},'transport':{'type':Sequelize[_0xc4fb('0x0')],'defaultValue':_0xc4fb('0xa'),'set':function(_0x585ccf){this['setDataValue']('transport',_0x585ccf?_0x585ccf[_0xc4fb('0xb')](','):null);},'get':function(){return this[_0xc4fb('0xc')](_0xc4fb('0xd'))?this[_0xc4fb('0xc')](_0xc4fb('0xd'))[_0xc4fb('0xe')](','):null;},'comment':_0xc4fb('0xf')},'dtmfmode':{'type':Sequelize[_0xc4fb('0x1')](_0xc4fb('0x10'),'info',_0xc4fb('0x11'),_0xc4fb('0x12'),_0xc4fb('0x13')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0xc4fb('0x14'),'no',_0xc4fb('0x15'),_0xc4fb('0x16'),_0xc4fb('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc4fb('0x1')](_0xc4fb('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc4fb('0x0')]},'directmediadeny':{'type':Sequelize[_0xc4fb('0x0')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xc4fb('0x18'),'set':function(_0x2c7624){this[_0xc4fb('0x19')](_0xc4fb('0x1a'),_0x2c7624?_0x2c7624[_0xc4fb('0xb')](','):null);},'get':function(){return this[_0xc4fb('0xc')](_0xc4fb('0x1a'))?this[_0xc4fb('0xc')](_0xc4fb('0x1a'))[_0xc4fb('0xe')](','):null;},'comment':_0xc4fb('0x1b')},'callgroup':{'type':Sequelize[_0xc4fb('0x0')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xc4fb('0x0')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc4fb('0x0')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc4fb('0x0')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xc4fb('0x0')],'defaultValue':_0xc4fb('0x1c')},'allow':{'type':Sequelize[_0xc4fb('0x0')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x44c373){this[_0xc4fb('0x19')](_0xc4fb('0x1d'),_0x44c373?_0x44c373['join'](';'):_0xc4fb('0x1e'));},'get':function(){return this[_0xc4fb('0xc')](_0xc4fb('0x1d'))?this[_0xc4fb('0xc')](_0xc4fb('0x1d'))[_0xc4fb('0xe')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xc4fb('0x1')](_0xc4fb('0x14'),'no')},'insecure':{'type':Sequelize[_0xc4fb('0x0')],'defaultValue':_0xc4fb('0x1f'),'set':function(_0x47178f){this[_0xc4fb('0x19')](_0xc4fb('0x20'),_0x47178f?_0x47178f['join'](','):null);},'get':function(){return this[_0xc4fb('0xc')](_0xc4fb('0x20'))?this[_0xc4fb('0xc')]('insecure')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0xc4fb('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc4fb('0x1')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc4fb('0x1')](_0xc4fb('0x14'),'no',_0xc4fb('0x21'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0xc4fb('0x1')](_0xc4fb('0x14'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xc4fb('0x0')]},'callerid':{'type':Sequelize[_0xc4fb('0x0')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xc4fb('0x0')]},'callcounter':{'type':Sequelize[_0xc4fb('0x1')](_0xc4fb('0x14'),'no'),'defaultValue':_0xc4fb('0x14')},'busylevel':{'type':Sequelize[_0xc4fb('0x22')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xc4fb('0x14'),'no')},'allowtransfer':{'type':Sequelize[_0xc4fb('0x1')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xc4fb('0x1')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xc4fb('0x0')]},'template':{'type':Sequelize[_0xc4fb('0x0')]},'videosupport':{'type':Sequelize[_0xc4fb('0x1')]('yes','no',_0xc4fb('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc4fb('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xc4fb('0x1')](_0xc4fb('0x14'),'no')},'mailbox':{'type':Sequelize[_0xc4fb('0x0')]},'session_timers':{'type':Sequelize[_0xc4fb('0x1')](_0xc4fb('0x24'),_0xc4fb('0x25'),_0xc4fb('0x26'))},'session_expires':{'type':Sequelize[_0xc4fb('0x22')](0xb)},'session_minse':{'type':Sequelize[_0xc4fb('0x22')](0xb)},'session_refresher':{'type':Sequelize[_0xc4fb('0x1')](_0xc4fb('0x27'),_0xc4fb('0x28')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xc4fb('0x0')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xc4fb('0x0')]},'port':{'type':Sequelize[_0xc4fb('0x22')](0x5)},'qualify':{'type':Sequelize[_0xc4fb('0x1')](_0xc4fb('0x14'),'no'),'defaultValue':_0xc4fb('0x14')},'keepalive':{'type':Sequelize[_0xc4fb('0x22')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xc4fb('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xc4fb('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xc4fb('0x22')](0xb)},'sendrpid':{'type':Sequelize[_0xc4fb('0x1')](_0xc4fb('0x14'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc4fb('0x0')]},'callbackextension':{'type':Sequelize[_0xc4fb('0x0')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xc4fb('0x22')](0xb)},'qualifyfreq':{'type':Sequelize[_0xc4fb('0x22')](0xb)},'contactpermit':{'type':Sequelize[_0xc4fb('0x0')]},'contactdeny':{'type':Sequelize[_0xc4fb('0x0')]},'contactacl':{'type':Sequelize[_0xc4fb('0x0')]},'unsolicited_mailbox':{'type':Sequelize[_0xc4fb('0x0')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xc4fb('0x22')](0xb)},'encryption':{'type':Sequelize[_0xc4fb('0x1')](_0xc4fb('0x14'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc4fb('0x1')](_0xc4fb('0x14'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xc4fb('0x14'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xc4fb('0x14'),'no')},'dtlsenable':{'type':Sequelize[_0xc4fb('0x1')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xc4fb('0x1')](_0xc4fb('0x14'),'no',_0xc4fb('0x29'),_0xc4fb('0x2a'))},'dtlsrekey':{'type':Sequelize[_0xc4fb('0x22')](0xb)},'dtlscertfile':{'type':Sequelize[_0xc4fb('0x0')]},'dtlsprivatekey':{'type':Sequelize[_0xc4fb('0x0')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xc4fb('0x0')]},'dtlscapath':{'type':Sequelize[_0xc4fb('0x0')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xc4fb('0x2b'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc4fb('0x0')]},'usereqphone':{'type':Sequelize[_0xc4fb('0x1')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc4fb('0x0')]},'recordofffeature':{'type':Sequelize[_0xc4fb('0x0')]},'call_limit':{'type':Sequelize[_0xc4fb('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xc4fb('0x1')]('yes','no')},'subscribemwi':{'type':Sequelize[_0xc4fb('0x1')]('yes','no')},'vmexten':{'type':Sequelize[_0xc4fb('0x0')]},'mohinterpret':{'type':Sequelize[_0xc4fb('0x0')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xc4fb('0x0')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xc4fb('0x0')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0xc4fb('0x14'),'no','nonat',_0xc4fb('0x16'),_0xc4fb('0x2c')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc4fb('0x0')]},'otherFields':{'type':Sequelize[_0xc4fb('0x0')]},'active':{'type':Sequelize[_0xc4fb('0x2d')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xc4fb('0x0')],'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 87cf2af..022c335 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(_0x169355,_0x4f188b){var _0x3054ee=function(_0x154881){while(--_0x154881){_0x169355['push'](_0x169355['shift']());}};_0x3054ee(++_0x4f188b);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x1e73fc,_0x533750){_0x1e73fc=_0x1e73fc-0x0;var _0xeceac4=_0xf2ca[_0x1e73fc];return _0xeceac4;};'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 _0xe5b3=['then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','clone','find','omit','createdAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request'];(function(_0x2383bc,_0x2d5ec9){var _0x283573=function(_0x157171){while(--_0x157171){_0x2383bc['push'](_0x2383bc['shift']());}};_0x283573(++_0x2d5ec9);}(_0xe5b3,0x133));var _0x3e5b=function(_0x31571e,_0x4ea2aa){_0x31571e=_0x31571e-0x0;var _0x1714a9=_0xe5b3[_0x31571e];return _0x1714a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];var jayson=require(_0x3e5b('0x19'));var client=jayson[_0x3e5b('0x1a')][_0x3e5b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x405e70,_0x560010,_0x39a2a1,_0x5f2f9c){return new BPromise(function(_0x51a188,_0x4d71a3){var _0x3754e3=_0x5f2f9c||client;return _0x3754e3[_0x3e5b('0x1c')](_0x405e70,_0x39a2a1)[_0x3e5b('0x1d')](function(_0x4fb471){logger[_0x3e5b('0x1e')]('Trunk,\x20%s,\x20%s',_0x560010,'request\x20sent');logger[_0x3e5b('0x1f')](_0x3e5b('0x20'),_0x560010,'request\x20sent',JSON[_0x3e5b('0x21')](_0x4fb471));if(_0x4fb471[_0x3e5b('0x22')]){if(_0x4fb471['error'][_0x3e5b('0x23')]===0x1f4){logger[_0x3e5b('0x22')]('Trunk,\x20%s,\x20%s',_0x560010,_0x4fb471['error'][_0x3e5b('0x24')]);return _0x4d71a3(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);return _0x51a188(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}else{logger[_0x3e5b('0x1e')](_0x3e5b('0x25'),_0x560010,_0x3e5b('0x26'));_0x51a188(_0x4fb471[_0x3e5b('0x27')][_0x3e5b('0x24')]);}})['catch'](function(_0x433f9c){logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x433f9c);_0x4d71a3(_0x433f9c);});});}function respondWithStatusCode(_0x150674,_0x50039b){_0x50039b=_0x50039b||0xcc;return function(_0x1eb80f){if(_0x1eb80f){return _0x150674['sendStatus'](_0x50039b);}return _0x150674[_0x3e5b('0x28')](_0x50039b)[_0x3e5b('0x29')]();};}function respondWithResult(_0x4d5e61,_0x41b684){_0x41b684=_0x41b684||0xc8;return function(_0x2f6368){if(_0x2f6368){return _0x4d5e61[_0x3e5b('0x28')](_0x41b684)[_0x3e5b('0x2a')](_0x2f6368);}};}function respondWithFilteredResult(_0x3bb749,_0x26c7f2){return function(_0x160e87){if(_0x160e87){var _0x2ddf57=typeof _0x26c7f2['offset']===_0x3e5b('0x2b')&&typeof _0x26c7f2['limit']===_0x3e5b('0x2b');var _0x4fd64b=_0x160e87[_0x3e5b('0x2c')];var _0x1f6473=_0x2ddf57?0x0:_0x26c7f2[_0x3e5b('0x2d')];var _0x475b39=_0x2ddf57?_0x160e87[_0x3e5b('0x2c')]:_0x26c7f2[_0x3e5b('0x2d')]+_0x26c7f2[_0x3e5b('0x2e')];var _0x9c2123;if(_0x475b39>=_0x4fd64b){_0x475b39=_0x4fd64b;_0x9c2123=0xc8;}else{_0x9c2123=0xce;}_0x3bb749[_0x3e5b('0x28')](_0x9c2123);return _0x3bb749[_0x3e5b('0x2f')](_0x3e5b('0x30'),_0x1f6473+'-'+_0x475b39+'/'+_0x4fd64b)['json'](_0x160e87);}return null;};}function patchUpdates(_0x21bc10){return function(_0x1882aa){try{jsonpatch[_0x3e5b('0x31')](_0x1882aa,_0x21bc10,!![]);}catch(_0x2a14eb){return BPromise[_0x3e5b('0x32')](_0x2a14eb);}return _0x1882aa[_0x3e5b('0x33')]();};}function saveUpdates(_0x345927,_0x4c4e01){return function(_0x33f089){if(_0x33f089){return _0x33f089['update'](_0x345927)['then'](function(_0x32c6b0){return _0x32c6b0;});}return null;};}function removeEntity(_0x78d68a,_0x51ea0d){return function(_0x40e37d){if(_0x40e37d){return _0x40e37d[_0x3e5b('0x34')]()[_0x3e5b('0x1d')](function(){var _0x33e356=_0x40e37d[_0x3e5b('0x35')]({'plain':!![]});var _0x26f842=_0x3e5b('0x36');return db[_0x3e5b('0x37')][_0x3e5b('0x34')]({'where':{'type':_0x26f842,'resourceId':_0x33e356['id']}})[_0x3e5b('0x1d')](function(){return _0x40e37d;});})[_0x3e5b('0x1d')](function(){_0x78d68a[_0x3e5b('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x141b7e,_0xec45c5){return function(_0x53caa2){if(!_0x53caa2){_0x141b7e['sendStatus'](0x194);}return _0x53caa2;};}function handleError(_0x471196,_0x56d7ef){_0x56d7ef=_0x56d7ef||0x1f4;return function(_0x2939da){logger[_0x3e5b('0x22')](_0x2939da[_0x3e5b('0x38')]);if(_0x2939da[_0x3e5b('0x39')]){delete _0x2939da['name'];}_0x471196[_0x3e5b('0x28')](_0x56d7ef)['send'](_0x2939da);};}exports[_0x3e5b('0x3a')]=function(_0x5ec841,_0x47f7c8){var _0x48f414={},_0x10c202={},_0x174ebf={'count':0x0,'rows':[]};var _0x2eaa30=_[_0x3e5b('0x3b')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')],function(_0x5466ac){return{'name':_0x5466ac['fieldName'],'type':_0x5466ac['type']['key']};});_0x10c202['model']=_['map'](_0x2eaa30,'name');_0x10c202[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x5ec841[_0x3e5b('0x3e')]);_0x10c202[_0x3e5b('0x40')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],_0x10c202[_0x3e5b('0x3e')]);_0x48f414[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x5ec841['query'][_0x3e5b('0x44')]));_0x48f414[_0x3e5b('0x43')]=_0x48f414[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x48f414[_0x3e5b('0x43')]:_0x10c202[_0x3e5b('0x42')];if(!_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x46')](_0x3e5b('0x47'))){_0x48f414[_0x3e5b('0x2e')]=qs[_0x3e5b('0x2e')](_0x5ec841['query']['limit']);_0x48f414['offset']=qs['offset'](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x2d')]);}_0x48f414[_0x3e5b('0x48')]=qs[_0x3e5b('0x49')](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x49')]);_0x48f414[_0x3e5b('0x4a')]=qs[_0x3e5b('0x40')](_[_0x3e5b('0x4b')](_0x5ec841[_0x3e5b('0x3e')],_0x10c202['filters']),_0x2eaa30);if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x4c')]){_0x48f414[_0x3e5b('0x4a')]=_[_0x3e5b('0x4d')](_0x48f414[_0x3e5b('0x4a')],{'$or':_['map'](_0x2eaa30,function(_0x588ee7){if(_0x588ee7['type']!==_0x3e5b('0x4e')){var _0x20af6a={};_0x20af6a[_0x588ee7[_0x3e5b('0x39')]]={'$like':'%'+_0x5ec841['query']['filter']+'%'};return _0x20af6a;}})});}_0x48f414=_[_0x3e5b('0x4d')]({},_0x48f414,_0x5ec841[_0x3e5b('0x4f')]);var _0x123947={'where':_0x48f414['where']};return db['Trunk'][_0x3e5b('0x2c')](_0x123947)['then'](function(_0x14b62a){_0x174ebf[_0x3e5b('0x2c')]=_0x14b62a;if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x48f414[_0x3e5b('0x51')]=[{'all':!![]}];}return db[_0x3e5b('0x3c')][_0x3e5b('0x52')](_0x48f414);})[_0x3e5b('0x1d')](function(_0x339852){_0x174ebf['rows']=_0x339852;return _0x174ebf;})[_0x3e5b('0x1d')](respondWithFilteredResult(_0x47f7c8,_0x48f414))['catch'](handleError(_0x47f7c8,null));};exports[_0x3e5b('0x53')]=function(_0x2e7047,_0x26e11e){var _0x3d51fa={'raw':![],'where':{'id':_0x2e7047[_0x3e5b('0x54')]['id']}},_0x291e4d={};_0x291e4d[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x291e4d[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x2e7047[_0x3e5b('0x3e')]);_0x291e4d['filters']=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],_0x291e4d[_0x3e5b('0x3e')]);_0x3d51fa[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],qs['fields'](_0x2e7047[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x3d51fa[_0x3e5b('0x43')]=_0x3d51fa[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x3d51fa[_0x3e5b('0x43')]:_0x291e4d[_0x3e5b('0x42')];if(_0x2e7047[_0x3e5b('0x3e')]['includeAll']){_0x3d51fa[_0x3e5b('0x51')]=[{'all':!![]}];}_0x3d51fa=_['merge']({},_0x3d51fa,_0x2e7047['options']);return db[_0x3e5b('0x3c')]['find'](_0x3d51fa)[_0x3e5b('0x1d')](handleEntityNotFound(_0x26e11e,null))[_0x3e5b('0x1d')](respondWithResult(_0x26e11e,null))[_0x3e5b('0x55')](handleError(_0x26e11e,null));};exports[_0x3e5b('0x56')]=function(_0x4a492b,_0x5ddeee){var _0x545712={'where':{'id':_0x4a492b[_0x3e5b('0x54')]['id']}},_0x581b94={};_0x581b94[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x545712['attributes']=_['intersection'](_0x581b94[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x545712[_0x3e5b('0x43')]=_0x545712['attributes']['length']?_0x545712['attributes']:_0x581b94['model'];if(_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x545712[_0x3e5b('0x51')]=[{'all':!![]}];}_0x545712=_[_0x3e5b('0x4d')]({},_0x545712,_0x4a492b[_0x3e5b('0x4f')]);return db[_0x3e5b('0x3c')][_0x3e5b('0x57')](_0x545712)[_0x3e5b('0x1d')](handleEntityNotFound(_0x5ddeee,null))['then'](function(_0x285db6){if(_0x285db6){var _0x29897b=_0x285db6[_0x3e5b('0x35')]({'plain':!![]});_0x29897b=qs[_0x3e5b('0x58')](_0x29897b,['id',_0x3e5b('0x59'),'updatedAt']);_0x4a492b[_0x3e5b('0x5a')]=_['omit'](_0x4a492b[_0x3e5b('0x5a')],['id',_0x3e5b('0x59'),'updatedAt']);return db['Trunk']['create'](_[_0x3e5b('0x4d')](_0x29897b,_0x4a492b['body']),{'include':_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]?[{'all':!![]}]:undefined})[_0x3e5b('0x1d')](function(_0x40197c){var _0x14f187=_0x4a492b['user']['get']({'plain':!![]});if(!_0x14f187)throw new Error(_0x3e5b('0x5b'));if(_0x14f187[_0x3e5b('0x5c')]===_0x3e5b('0x5d')){var _0x4dfb45=_0x40197c[_0x3e5b('0x35')]({'plain':!![]});var _0x3c5293=_0x3e5b('0x36');return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3c5293,'userProfileId':_0x14f187[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x4a1ce3){if(_0x4a1ce3&&_0x4a1ce3[_0x3e5b('0x60')]===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x4dfb45[_0x3e5b('0x39')],'resourceId':_0x4dfb45['id'],'type':_0x4a1ce3[_0x3e5b('0x39')],'sectionId':_0x4a1ce3['id']},{})[_0x3e5b('0x1d')](function(){return _0x40197c;});}else{return _0x40197c;}})[_0x3e5b('0x55')](function(_0x2411c3){logger[_0x3e5b('0x22')](_0x3e5b('0x62'),_0x2411c3);throw _0x2411c3;});}return _0x40197c;});}})['then'](respondWithResult(_0x5ddeee,0xc9))[_0x3e5b('0x55')](handleError(_0x5ddeee,null));};exports[_0x3e5b('0x61')]=function(_0x5af305,_0x177144,_0x31ef31){var _0x561c78;return db['Trunk']['create'](_0x5af305[_0x3e5b('0x5a')],{'raw':!![]})[_0x3e5b('0x1d')](function(_0x498e6d){_0x561c78=_0x498e6d;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});})['then'](function(_0x3d3bf2){var _0x17f60f=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0x410c7a=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x40103e=ejs[_0x3e5b('0x69')](_0x17f60f,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x40103e);if(_0x561c78['registry']){var _0x590f0c=ejs[_0x3e5b('0x69')](_0x410c7a,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x590f0c);}})[_0x3e5b('0x1d')](function(){return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x61'),{'module':_0x3e5b('0x6d')});})[_0x3e5b('0x1d')](function(){var _0x9deb09=_0x5af305[_0x3e5b('0x5d')]['get']({'plain':!![]});if(!_0x9deb09)throw new Error(_0x3e5b('0x5b'));if(_0x9deb09[_0x3e5b('0x5c')]==='user'){var _0x577747=_0x561c78['get']({'plain':!![]});return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3e5b('0x36'),'userProfileId':_0x9deb09[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x1ba550){if(_0x1ba550&&_0x1ba550['autoAssociation']===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x577747['name'],'resourceId':_0x577747['id'],'type':_0x1ba550[_0x3e5b('0x39')],'sectionId':_0x1ba550['id']},{})['then'](function(){return _0x561c78;});}else{return _0x561c78;}})['catch'](function(_0x211e73){logger[_0x3e5b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211e73);throw _0x211e73;});}return _0x561c78;})[_0x3e5b('0x1d')](respondWithResult(_0x177144,0xc9))[_0x3e5b('0x55')](handleError(_0x177144,null));};exports['update']=function(_0x2e36af,_0x185640,_0x14baa9){var _0x1425eb;return db[_0x3e5b('0x3c')][_0x3e5b('0x57')]({'where':{'id':_0x2e36af['params']['id']}})['then'](handleEntityNotFound(_0x185640,null))[_0x3e5b('0x1d')](saveUpdates(_0x2e36af['body'],null))['then'](function(_0x25d3d8){if(_0x25d3d8){_0x1425eb=_0x25d3d8;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});}})['then'](function(_0x2e5fa3){if(_0x2e5fa3){var _0x4b8d19=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0xdf2677=fs['readFileSync'](path[_0x3e5b('0x64')](config['root'],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x58ccf3=ejs[_0x3e5b('0x69')](_0x4b8d19,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x58ccf3);var _0x5ad011=ejs[_0x3e5b('0x69')](_0xdf2677,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5ad011);return respondWithRpcPromise('Reload',_0x3e5b('0x6f'),{'module':_0x3e5b('0x6d')});}return null;})['then'](function(_0xd9d941){if(_0xd9d941){return _0x1425eb;}})[_0x3e5b('0x1d')](respondWithResult(_0x185640,null))[_0x3e5b('0x55')](handleError(_0x185640,null));};exports['destroy']=function(_0x3b3306,_0x30e079,_0x352f7e){var _0x1d7c05;return db['Trunk'][_0x3e5b('0x57')]({'where':{'id':_0x3b3306['params']['id']}})[_0x3e5b('0x1d')](handleEntityNotFound(_0x30e079,null))['then'](removeEntity(_0x30e079,null))[_0x3e5b('0x1d')](function(){return db[_0x3e5b('0x3c')]['findAll']({'raw':!![]});})[_0x3e5b('0x1d')](function(_0x2299b9){var _0x56ff9d=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),'utf8');var _0x53328b=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x3d1193=ejs['render'](_0x56ff9d,{'trunks':_0x2299b9});var _0x5d6aae=ejs[_0x3e5b('0x69')](_0x53328b,{'trunks':_0x2299b9});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x3d1193);fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5d6aae);return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x34'),{'module':_0x3e5b('0x6d')});})['catch'](handleError(_0x30e079,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index cbf3f15..c2181c1 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 _0xb661=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','lodash'];(function(_0x405be3,_0x3df60f){var _0x4aae63=function(_0x46e1bd){while(--_0x46e1bd){_0x405be3['push'](_0x405be3['shift']());}};_0x4aae63(++_0x3df60f);}(_0xb661,0x14f));var _0x1b66=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xb661[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x1b66('0x0'));var util=require('util');var logger=require(_0x1b66('0x1'))(_0x1b66('0x2'));var moment=require(_0x1b66('0x3'));var BPromise=require(_0x1b66('0x4'));var rp=require(_0x1b66('0x5'));var fs=require('fs');var path=require(_0x1b66('0x6'));var rimraf=require('rimraf');var config=require(_0x1b66('0x7'));var attributes=require('./trunk.attributes');module['exports']=function(_0x4999ba,_0x26dc52){return _0x4999ba['define']('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74e7=['util','../../config/logger','request-promise','rimraf','exports','Trunk','tools_trunks','lodash'];(function(_0x4bf3cb,_0x37d397){var _0x2de163=function(_0x1b0f45){while(--_0x1b0f45){_0x4bf3cb['push'](_0x4bf3cb['shift']());}};_0x2de163(++_0x37d397);}(_0x74e7,0x97));var _0x774e=function(_0x29bab6,_0xbc6b1b){_0x29bab6=_0x29bab6-0x0;var _0x460a07=_0x74e7[_0x29bab6];return _0x460a07;};'use strict';var _=require(_0x774e('0x0'));var util=require(_0x774e('0x1'));var logger=require(_0x774e('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x774e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x774e('0x4'));var config=require('../../config/environment');var attributes=require('./trunk.attributes');module[_0x774e('0x5')]=function(_0x1d6b14,_0x43e151){return _0x1d6b14['define'](_0x774e('0x6'),attributes,{'tableName':_0x774e('0x7'),'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 df51fd6..8dd8edd 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 _0xe462=['include','model','map','attributes','then','ShowTrunk','find','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrunk','Trunk','options','raw'];(function(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0xe462,0x167));var _0x2e46=function(_0x390ef6,_0x1d401c){_0x390ef6=_0x390ef6-0x0;var _0x2fdaac=_0xe462[_0x390ef6];return _0x2fdaac;};'use strict';var _=require(_0x2e46('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2e46('0x1'));var rs=require(_0x2e46('0x2'));var fs=require('fs');var Redis=require(_0x2e46('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e46('0x4'));var logger=require('../../config/logger')(_0x2e46('0x5'));var config=require(_0x2e46('0x6'));var jayson=require(_0x2e46('0x7'));var client=jayson[_0x2e46('0x8')][_0x2e46('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xce7e89,_0x41f15f,_0x3a1353){return new BPromise(function(_0x4eb7cd,_0x44944b){return client[_0x2e46('0xa')](_0xce7e89,_0x3a1353)['then'](function(_0x1f84ea){logger[_0x2e46('0xb')](_0x2e46('0xc'),_0x41f15f,_0x2e46('0xd'));logger[_0x2e46('0xe')](_0x2e46('0xf'),_0x41f15f,_0x2e46('0xd'),JSON[_0x2e46('0x10')](_0x1f84ea));if(_0x1f84ea['error']){if(_0x1f84ea[_0x2e46('0x11')][_0x2e46('0x12')]===0x1f4){logger[_0x2e46('0x11')](_0x2e46('0xc'),_0x41f15f,_0x1f84ea[_0x2e46('0x11')]['message']);return _0x44944b(_0x1f84ea[_0x2e46('0x11')][_0x2e46('0x13')]);}logger['error'](_0x2e46('0xc'),_0x41f15f,_0x1f84ea[_0x2e46('0x11')][_0x2e46('0x13')]);return _0x4eb7cd(_0x1f84ea['error'][_0x2e46('0x13')]);}else{logger['info'](_0x2e46('0xc'),_0x41f15f,'request\x20sent');_0x4eb7cd(_0x1f84ea['result'][_0x2e46('0x13')]);}})[_0x2e46('0x14')](function(_0x14be4b){logger['error'](_0x2e46('0xc'),_0x41f15f,_0x14be4b);_0x44944b(_0x14be4b);});});}exports[_0x2e46('0x15')]=function(_0x36d1d0){var _0x23cef7=this;return new Promise(function(_0x307273,_0x521427){return db[_0x2e46('0x16')]['findAll']({'raw':_0x36d1d0[_0x2e46('0x17')]?_0x36d1d0['options'][_0x2e46('0x18')]===undefined?!![]:![]:!![],'where':_0x36d1d0['options']?_0x36d1d0[_0x2e46('0x17')]['where']||null:null,'attributes':_0x36d1d0[_0x2e46('0x17')]?_0x36d1d0[_0x2e46('0x17')]['attributes']||null:null,'limit':_0x36d1d0[_0x2e46('0x17')]?_0x36d1d0[_0x2e46('0x17')]['limit']||null:null,'include':_0x36d1d0[_0x2e46('0x17')]?_0x36d1d0['options'][_0x2e46('0x19')]?_['map'](_0x36d1d0[_0x2e46('0x17')]['include'],function(_0x176683){return{'model':db[_0x176683[_0x2e46('0x1a')]],'as':_0x176683['as'],'attributes':_0x176683['attributes'],'include':_0x176683['include']?_[_0x2e46('0x1b')](_0x176683['include'],function(_0x4ea251){return{'model':db[_0x4ea251[_0x2e46('0x1a')]],'as':_0x4ea251['as'],'attributes':_0x4ea251[_0x2e46('0x1c')],'include':_0x4ea251['include']?_[_0x2e46('0x1b')](_0x4ea251[_0x2e46('0x19')],function(_0x214800){return{'model':db[_0x214800['model']],'as':_0x214800['as'],'attributes':_0x214800[_0x2e46('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2e46('0x1d')](function(_0x579965){logger[_0x2e46('0xb')]('GetTrunk',_0x36d1d0);logger[_0x2e46('0xe')](_0x2e46('0x15'),_0x36d1d0,JSON['stringify'](_0x579965));_0x307273(_0x579965);})[_0x2e46('0x14')](function(_0x4f52a6){logger[_0x2e46('0x11')]('GetTrunk',_0x4f52a6[_0x2e46('0x13')],_0x36d1d0);_0x521427(_0x23cef7[_0x2e46('0x11')](0x1f4,_0x4f52a6[_0x2e46('0x13')]));});});};exports[_0x2e46('0x1e')]=function(_0x4c48b9){var _0x574b61=this;return new Promise(function(_0x197418,_0x2996c7){return db['Trunk'][_0x2e46('0x1f')]({'raw':_0x4c48b9[_0x2e46('0x17')]?_0x4c48b9[_0x2e46('0x17')][_0x2e46('0x18')]===undefined?!![]:![]:!![],'where':_0x4c48b9[_0x2e46('0x17')]?_0x4c48b9[_0x2e46('0x17')]['where']||null:null,'attributes':_0x4c48b9[_0x2e46('0x17')]?_0x4c48b9[_0x2e46('0x17')]['attributes']||null:null,'include':_0x4c48b9[_0x2e46('0x17')]?_0x4c48b9[_0x2e46('0x17')][_0x2e46('0x19')]?_[_0x2e46('0x1b')](_0x4c48b9[_0x2e46('0x17')][_0x2e46('0x19')],function(_0x636b41){return{'model':db[_0x636b41[_0x2e46('0x1a')]],'as':_0x636b41['as'],'attributes':_0x636b41[_0x2e46('0x1c')],'include':_0x636b41[_0x2e46('0x19')]?_[_0x2e46('0x1b')](_0x636b41[_0x2e46('0x19')],function(_0x57353f){return{'model':db[_0x57353f[_0x2e46('0x1a')]],'as':_0x57353f['as'],'attributes':_0x57353f[_0x2e46('0x1c')],'include':_0x57353f['include']?_[_0x2e46('0x1b')](_0x57353f[_0x2e46('0x19')],function(_0x5b8f2c){return{'model':db[_0x5b8f2c['model']],'as':_0x5b8f2c['as'],'attributes':_0x5b8f2c[_0x2e46('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2e46('0x1d')](function(_0x3f7a50){logger['info'](_0x2e46('0x1e'),_0x4c48b9);logger['debug'](_0x2e46('0x1e'),_0x4c48b9,JSON[_0x2e46('0x10')](_0x3f7a50));_0x197418(_0x3f7a50);})['catch'](function(_0x251f73){logger['error'](_0x2e46('0x1e'),_0x251f73[_0x2e46('0x13')],_0x4c48b9);_0x2996c7(_0x574b61[_0x2e46('0x11')](0x1f4,_0x251f73[_0x2e46('0x13')]));});});}; \ No newline at end of file +var _0x1f96=['jayson/promise','client','http','request','then','info','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','Trunk,\x20%s,\x20%s','message','result','GetTrunk','Trunk','findAll','options','raw','where','attributes','include','map','model','debug','find','ShowTrunk','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x334ad2,_0xcd1829){var _0x1560eb=function(_0x99e5a3){while(--_0x99e5a3){_0x334ad2['push'](_0x334ad2['shift']());}};_0x1560eb(++_0xcd1829);}(_0x1f96,0xed));var _0x61f9=function(_0x2cacba,_0x54f021){_0x2cacba=_0x2cacba-0x0;var _0x6d18e9=_0x1f96[_0x2cacba];return _0x6d18e9;};'use strict';var _=require('lodash');var util=require(_0x61f9('0x0'));var moment=require(_0x61f9('0x1'));var BPromise=require(_0x61f9('0x2'));var rs=require(_0x61f9('0x3'));var fs=require('fs');var Redis=require(_0x61f9('0x4'));var db=require(_0x61f9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x61f9('0x6'))(_0x61f9('0x7'));var config=require('../../config/environment');var jayson=require(_0x61f9('0x8'));var client=jayson[_0x61f9('0x9')][_0x61f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x412d83,_0x5358fb,_0x2d994e){return new BPromise(function(_0x1cc87a,_0xc4221b){return client[_0x61f9('0xb')](_0x412d83,_0x2d994e)[_0x61f9('0xc')](function(_0x46176e){logger[_0x61f9('0xd')]('Trunk,\x20%s,\x20%s',_0x5358fb,_0x61f9('0xe'));logger['debug'](_0x61f9('0xf'),_0x5358fb,_0x61f9('0xe'),JSON[_0x61f9('0x10')](_0x46176e));if(_0x46176e[_0x61f9('0x11')]){if(_0x46176e[_0x61f9('0x11')]['code']===0x1f4){logger[_0x61f9('0x11')](_0x61f9('0x12'),_0x5358fb,_0x46176e[_0x61f9('0x11')][_0x61f9('0x13')]);return _0xc4221b(_0x46176e[_0x61f9('0x11')][_0x61f9('0x13')]);}logger['error'](_0x61f9('0x12'),_0x5358fb,_0x46176e[_0x61f9('0x11')][_0x61f9('0x13')]);return _0x1cc87a(_0x46176e['error'][_0x61f9('0x13')]);}else{logger[_0x61f9('0xd')](_0x61f9('0x12'),_0x5358fb,_0x61f9('0xe'));_0x1cc87a(_0x46176e[_0x61f9('0x14')][_0x61f9('0x13')]);}})['catch'](function(_0x16e32f){logger[_0x61f9('0x11')]('Trunk,\x20%s,\x20%s',_0x5358fb,_0x16e32f);_0xc4221b(_0x16e32f);});});}exports[_0x61f9('0x15')]=function(_0x2ee717){var _0x4bbfee=this;return new Promise(function(_0x46236f,_0x4d66a1){return db[_0x61f9('0x16')][_0x61f9('0x17')]({'raw':_0x2ee717['options']?_0x2ee717[_0x61f9('0x18')][_0x61f9('0x19')]===undefined?!![]:![]:!![],'where':_0x2ee717['options']?_0x2ee717[_0x61f9('0x18')][_0x61f9('0x1a')]||null:null,'attributes':_0x2ee717[_0x61f9('0x18')]?_0x2ee717['options'][_0x61f9('0x1b')]||null:null,'limit':_0x2ee717[_0x61f9('0x18')]?_0x2ee717[_0x61f9('0x18')]['limit']||null:null,'include':_0x2ee717[_0x61f9('0x18')]?_0x2ee717['options'][_0x61f9('0x1c')]?_[_0x61f9('0x1d')](_0x2ee717[_0x61f9('0x18')][_0x61f9('0x1c')],function(_0x165d5e){return{'model':db[_0x165d5e['model']],'as':_0x165d5e['as'],'attributes':_0x165d5e['attributes'],'include':_0x165d5e[_0x61f9('0x1c')]?_[_0x61f9('0x1d')](_0x165d5e[_0x61f9('0x1c')],function(_0x276da3){return{'model':db[_0x276da3[_0x61f9('0x1e')]],'as':_0x276da3['as'],'attributes':_0x276da3[_0x61f9('0x1b')],'include':_0x276da3['include']?_[_0x61f9('0x1d')](_0x276da3[_0x61f9('0x1c')],function(_0x10b73d){return{'model':db[_0x10b73d[_0x61f9('0x1e')]],'as':_0x10b73d['as'],'attributes':_0x10b73d[_0x61f9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x61f9('0xc')](function(_0x57778a){logger['info'](_0x61f9('0x15'),_0x2ee717);logger[_0x61f9('0x1f')](_0x61f9('0x15'),_0x2ee717,JSON[_0x61f9('0x10')](_0x57778a));_0x46236f(_0x57778a);})['catch'](function(_0x168c74){logger[_0x61f9('0x11')](_0x61f9('0x15'),_0x168c74[_0x61f9('0x13')],_0x2ee717);_0x4d66a1(_0x4bbfee[_0x61f9('0x11')](0x1f4,_0x168c74[_0x61f9('0x13')]));});});};exports['ShowTrunk']=function(_0x260e37){var _0x3aadf4=this;return new Promise(function(_0x1f59c7,_0x450d62){return db[_0x61f9('0x16')][_0x61f9('0x20')]({'raw':_0x260e37[_0x61f9('0x18')]?_0x260e37[_0x61f9('0x18')][_0x61f9('0x19')]===undefined?!![]:![]:!![],'where':_0x260e37[_0x61f9('0x18')]?_0x260e37[_0x61f9('0x18')][_0x61f9('0x1a')]||null:null,'attributes':_0x260e37[_0x61f9('0x18')]?_0x260e37[_0x61f9('0x18')][_0x61f9('0x1b')]||null:null,'include':_0x260e37[_0x61f9('0x18')]?_0x260e37[_0x61f9('0x18')][_0x61f9('0x1c')]?_[_0x61f9('0x1d')](_0x260e37[_0x61f9('0x18')][_0x61f9('0x1c')],function(_0xa5455){return{'model':db[_0xa5455[_0x61f9('0x1e')]],'as':_0xa5455['as'],'attributes':_0xa5455[_0x61f9('0x1b')],'include':_0xa5455[_0x61f9('0x1c')]?_['map'](_0xa5455[_0x61f9('0x1c')],function(_0x5cbd3d){return{'model':db[_0x5cbd3d[_0x61f9('0x1e')]],'as':_0x5cbd3d['as'],'attributes':_0x5cbd3d['attributes'],'include':_0x5cbd3d[_0x61f9('0x1c')]?_['map'](_0x5cbd3d[_0x61f9('0x1c')],function(_0x53b602){return{'model':db[_0x53b602[_0x61f9('0x1e')]],'as':_0x53b602['as'],'attributes':_0x53b602['attributes']};}):[]};}):[]};}):[]:[]})[_0x61f9('0xc')](function(_0x22f8c4){logger[_0x61f9('0xd')](_0x61f9('0x21'),_0x260e37);logger[_0x61f9('0x1f')](_0x61f9('0x21'),_0x260e37,JSON[_0x61f9('0x10')](_0x22f8c4));_0x1f59c7(_0x22f8c4);})[_0x61f9('0x22')](function(_0x2789c0){logger[_0x61f9('0x11')](_0x61f9('0x21'),_0x2789c0[_0x61f9('0x13')],_0x260e37);_0x450d62(_0x3aadf4['error'](0x1f4,_0x2789c0['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 8ebe33b..15cfe26 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 _0x8b5d=['addQueues','diskStorage','join','root','originalname','file','addAvatar','/:id/login','login','logout','/:id/pause','pause','unpause','/:id/teams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','put','delete','removeQueues','destroy','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/:id','show','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/whatsapp/interactions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts'];(function(_0x504d02,_0x57b9f8){var _0x28e1b1=function(_0x559ed6){while(--_0x559ed6){_0x504d02['push'](_0x504d02['shift']());}};_0x28e1b1(++_0x57b9f8);}(_0x8b5d,0x179));var _0xd8b5=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0x8b5d[_0x5a2d95];return _0x2c3986;};'use strict';var multer=require(_0xd8b5('0x0'));var util=require(_0xd8b5('0x1'));var path=require(_0xd8b5('0x2'));var timeout=require('connect-timeout');var express=require(_0xd8b5('0x3'));var router=express[_0xd8b5('0x4')]();var fs_extra=require(_0xd8b5('0x5'));var auth=require(_0xd8b5('0x6'));var interaction=require(_0xd8b5('0x7'));var config=require(_0xd8b5('0x8'));var controller=require(_0xd8b5('0x9'));router[_0xd8b5('0xa')]('/',auth[_0xd8b5('0xb')](),controller[_0xd8b5('0xc')]);router[_0xd8b5('0xa')](_0xd8b5('0xd'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0xe')]);router[_0xd8b5('0xa')](_0xd8b5('0xf'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x10')]);router[_0xd8b5('0xa')]('/presence',auth['isAuthenticated'](),controller['getPresence']);router['get'](_0xd8b5('0x11'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x12')]);router['get']('/:id/avatar',controller['getAvatar']);router[_0xd8b5('0xa')](_0xd8b5('0x13'),auth['isAuthenticated'](),controller[_0xd8b5('0x14')]);router[_0xd8b5('0xa')](_0xd8b5('0x15'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x16')]);router[_0xd8b5('0xa')](_0xd8b5('0x17'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x18')]);router['get'](_0xd8b5('0x19'),auth['isAuthenticated'](),controller[_0xd8b5('0x1a')]);router[_0xd8b5('0xa')](_0xd8b5('0x1b'),auth['isAuthenticated'](),controller[_0xd8b5('0x1c')]);router[_0xd8b5('0xa')](_0xd8b5('0x1d'),auth['isAuthenticated'](),controller[_0xd8b5('0x1e')]);router['get'](_0xd8b5('0x1f'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x20')]);router['get'](_0xd8b5('0x21'),auth[_0xd8b5('0xb')](),controller['getChatInteractions']);router[_0xd8b5('0xa')]('/:id/openchannel/interactions',auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x22')]);router[_0xd8b5('0xa')]('/:id/mail/interactions',auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x23')]);router[_0xd8b5('0xa')](_0xd8b5('0x24'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x25')]);router[_0xd8b5('0xa')]('/:id/fax/interactions',auth[_0xd8b5('0xb')](),controller['getFaxInteractions']);router[_0xd8b5('0xa')](_0xd8b5('0x26'),auth[_0xd8b5('0xb')](),controller['getWhatsappInteractions']);router[_0xd8b5('0xa')]('/:id/teams',auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x27')]);router[_0xd8b5('0xa')](_0xd8b5('0x28'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x29')]);router['get'](_0xd8b5('0x2a'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x2b')]);router[_0xd8b5('0xa')](_0xd8b5('0x2c'),auth['isAuthenticated'](),controller[_0xd8b5('0x2d')]);router[_0xd8b5('0xa')](_0xd8b5('0x2e'),auth['isAuthenticated'](),controller[_0xd8b5('0x2f')]);router[_0xd8b5('0xa')](_0xd8b5('0x30'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x31')]);router[_0xd8b5('0xa')](_0xd8b5('0x32'),auth['isAuthenticated'](),controller[_0xd8b5('0x33')]);router[_0xd8b5('0xa')](_0xd8b5('0x34'),auth[_0xd8b5('0xb')](),controller['getSmsAccounts']);router[_0xd8b5('0xa')](_0xd8b5('0x35'),auth['isAuthenticated'](),controller['getChatWebsites']);router[_0xd8b5('0xa')](_0xd8b5('0x36'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x37')]);router['get'](_0xd8b5('0x38'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x39')]);router[_0xd8b5('0xa')](_0xd8b5('0x3a'),auth['isAuthenticated'](),controller[_0xd8b5('0x3b')]);router[_0xd8b5('0xa')]('/:id/api_key',auth['isAuthenticated'](),controller[_0xd8b5('0x3c')]);router[_0xd8b5('0x3d')](_0xd8b5('0x15'),auth['isAuthenticated'](),controller[_0xd8b5('0x3e')]);router[_0xd8b5('0x3d')]('/',auth[_0xd8b5('0xb')](),controller['create']);router[_0xd8b5('0x3d')]('/create_many',auth[_0xd8b5('0xb')](),controller['bulkCreate']);router['post'](_0xd8b5('0x17'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x3f')]);var upload=multer({'storage':multer[_0xd8b5('0x40')]({'destination':function(_0x49f0c6,_0x3c1476,_0x224b20){_0x224b20(null,path[_0xd8b5('0x41')](config[_0xd8b5('0x42')],'server/files/images/'));},'filename':function(_0x3a9055,_0x285700,_0x1cfb48){_0x1cfb48(null,util['format']('%s-%s',Date['now'](),_0x285700[_0xd8b5('0x43')]));}})});router['post']('/:id/avatar',upload['single'](_0xd8b5('0x44')),controller[_0xd8b5('0x45')]);router[_0xd8b5('0x3d')](_0xd8b5('0x46'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x47')]);router[_0xd8b5('0x3d')]('/:id/logout',auth['isAuthenticated'](),controller[_0xd8b5('0x48')]);router['post'](_0xd8b5('0x49'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x4a')]);router['post']('/:id/unpause',auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x4b')]);router[_0xd8b5('0x3d')](_0xd8b5('0x4c'),auth['isAuthenticated'](),controller['addTeams']);router[_0xd8b5('0x3d')](_0xd8b5('0x4d'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x4e')]);router[_0xd8b5('0x3d')]('/:id/mail_interactions',auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x4f')]);router[_0xd8b5('0x3d')](_0xd8b5('0x50'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x51')]);router['post'](_0xd8b5('0x52'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0xd8b5('0x3d')](_0xd8b5('0x53'),auth['isAuthenticated'](),controller[_0xd8b5('0x54')]);router[_0xd8b5('0x3d')](_0xd8b5('0x55'),auth['isAuthenticated'](),controller[_0xd8b5('0x56')]);router[_0xd8b5('0x3d')]('/:id/fax_accounts',auth[_0xd8b5('0xb')](),controller['addFaxAccounts']);router['post'](_0xd8b5('0x30'),auth['isAuthenticated'](),controller['addMailAccounts']);router['post']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xd8b5('0x57')]);router[_0xd8b5('0x3d')](_0xd8b5('0x34'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x58')]);router[_0xd8b5('0x3d')](_0xd8b5('0x35'),auth['isAuthenticated'](),controller[_0xd8b5('0x59')]);router[_0xd8b5('0x3d')](_0xd8b5('0x36'),auth['isAuthenticated'](),controller[_0xd8b5('0x5a')]);router[_0xd8b5('0x3d')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0xd8b5('0x5b')]);router[_0xd8b5('0x3d')](_0xd8b5('0x5c'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x5d')]);router['put'](_0xd8b5('0x11'),auth['isAuthenticated'](),controller['update']);router[_0xd8b5('0x5e')]('/:id/password',auth[_0xd8b5('0xb')](),controller['changePassword']);router[_0xd8b5('0x5f')](_0xd8b5('0x17'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x60')]);router[_0xd8b5('0x5f')](_0xd8b5('0x4c'),auth[_0xd8b5('0xb')](),controller['removeTeams']);router['delete'](_0xd8b5('0x11'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x61')]);router['delete']('/:id/chat_interactions',auth[_0xd8b5('0xb')](),controller['removeChatInteractions']);router['delete'](_0xd8b5('0x62'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x63')]);router['delete']('/:id/fax_interactions',auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x64')]);router[_0xd8b5('0x5f')]('/:id/sms_interactions',auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x65')]);router[_0xd8b5('0x5f')]('/:id/openchannel_interactions',auth[_0xd8b5('0xb')](),controller['removeOpenchannelInteractions']);router[_0xd8b5('0x5f')](_0xd8b5('0x55'),auth['isAuthenticated'](),controller[_0xd8b5('0x66')]);router[_0xd8b5('0x5f')](_0xd8b5('0x2e'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x67')]);router[_0xd8b5('0x5f')](_0xd8b5('0x30'),auth[_0xd8b5('0xb')](),controller['removeMailAccounts']);router['delete'](_0xd8b5('0x32'),auth['isAuthenticated'](),controller[_0xd8b5('0x68')]);router[_0xd8b5('0x5f')](_0xd8b5('0x34'),auth['isAuthenticated'](),controller[_0xd8b5('0x69')]);router[_0xd8b5('0x5f')](_0xd8b5('0x35'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x6a')]);router['delete'](_0xd8b5('0x36'),auth[_0xd8b5('0xb')](),controller[_0xd8b5('0x6b')]);router[_0xd8b5('0x5f')](_0xd8b5('0x38'),auth['isAuthenticated'](),controller[_0xd8b5('0x6c')]);router['delete']('/:id/api_key',auth['isAuthenticated'](),controller[_0xd8b5('0x6d')]);module['exports']=router; \ No newline at end of file +var _0x988f=['put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/openchannel_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','exports','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','/describe','isAuthenticated','describe','whoami','/presence','getPresence','/:id','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/groups','getGroups','/:id/recordings','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','addContacts','post','create','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','/:id/avatar','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x988f,0x15a));var _0xf988=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x988f[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf988('0x0'));var express=require(_0xf988('0x1'));var router=express['Router']();var fs_extra=require(_0xf988('0x2'));var auth=require(_0xf988('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf988('0x4'));var controller=require(_0xf988('0x5'));router[_0xf988('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf988('0x6')](_0xf988('0x7'),auth[_0xf988('0x8')](),controller[_0xf988('0x9')]);router[_0xf988('0x6')]('/whoami',auth[_0xf988('0x8')](),controller[_0xf988('0xa')]);router[_0xf988('0x6')](_0xf988('0xb'),auth[_0xf988('0x8')](),controller[_0xf988('0xc')]);router[_0xf988('0x6')](_0xf988('0xd'),auth[_0xf988('0x8')](),controller['show']);router[_0xf988('0x6')]('/:id/avatar',controller['getAvatar']);router['get'](_0xf988('0xe'),auth['isAuthenticated'](),controller[_0xf988('0xf')]);router['get'](_0xf988('0x10'),auth[_0xf988('0x8')](),controller[_0xf988('0x11')]);router['get'](_0xf988('0x12'),auth['isAuthenticated'](),controller['getQueues']);router[_0xf988('0x6')]('/:id/queues_rt',auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0xf988('0x6')](_0xf988('0x13'),auth[_0xf988('0x8')](),controller[_0xf988('0x14')]);router['get'](_0xf988('0x15'),auth['isAuthenticated'](),controller['getRecordings']);router['get']('/:id/screen_recordings',auth[_0xf988('0x8')](),controller['getScreenRecordings']);router[_0xf988('0x6')]('/:id/chat/interactions',auth[_0xf988('0x8')](),controller[_0xf988('0x16')]);router[_0xf988('0x6')]('/:id/openchannel/interactions',auth[_0xf988('0x8')](),controller[_0xf988('0x17')]);router[_0xf988('0x6')](_0xf988('0x18'),auth['isAuthenticated'](),controller[_0xf988('0x19')]);router[_0xf988('0x6')](_0xf988('0x1a'),auth[_0xf988('0x8')](),controller[_0xf988('0x1b')]);router[_0xf988('0x6')]('/:id/fax/interactions',auth[_0xf988('0x8')](),controller[_0xf988('0x1c')]);router[_0xf988('0x6')]('/:id/whatsapp/interactions',auth[_0xf988('0x8')](),controller[_0xf988('0x1d')]);router[_0xf988('0x6')](_0xf988('0x1e'),auth['isAuthenticated'](),controller[_0xf988('0x1f')]);router[_0xf988('0x6')](_0xf988('0x20'),auth[_0xf988('0x8')](),controller['getLists']);router[_0xf988('0x6')](_0xf988('0x21'),auth[_0xf988('0x8')](),controller[_0xf988('0x22')]);router['get'](_0xf988('0x23'),auth[_0xf988('0x8')](),controller[_0xf988('0x24')]);router[_0xf988('0x6')](_0xf988('0x25'),auth[_0xf988('0x8')](),controller['getFaxAccounts']);router['get']('/:id/mail_accounts',auth[_0xf988('0x8')](),controller[_0xf988('0x26')]);router[_0xf988('0x6')](_0xf988('0x27'),auth[_0xf988('0x8')](),controller[_0xf988('0x28')]);router[_0xf988('0x6')](_0xf988('0x29'),auth['isAuthenticated'](),controller[_0xf988('0x2a')]);router[_0xf988('0x6')](_0xf988('0x2b'),auth['isAuthenticated'](),controller[_0xf988('0x2c')]);router[_0xf988('0x6')](_0xf988('0x2d'),auth['isAuthenticated'](),controller['getWhatsappAccounts']);router[_0xf988('0x6')](_0xf988('0x2e'),auth[_0xf988('0x8')](),controller[_0xf988('0x2f')]);router[_0xf988('0x6')]('/:id/scheduled_calls',auth[_0xf988('0x8')](),controller[_0xf988('0x30')]);router[_0xf988('0x6')](_0xf988('0x31'),auth['isAuthenticated'](),controller[_0xf988('0x32')]);router['post'](_0xf988('0x10'),auth[_0xf988('0x8')](),controller[_0xf988('0x33')]);router[_0xf988('0x34')]('/',auth['isAuthenticated'](),controller[_0xf988('0x35')]);router['post']('/create_many',auth['isAuthenticated'](),controller[_0xf988('0x36')]);router[_0xf988('0x34')](_0xf988('0x12'),auth[_0xf988('0x8')](),controller[_0xf988('0x37')]);var upload=multer({'storage':multer[_0xf988('0x38')]({'destination':function(_0x3f9860,_0x37b99b,_0x123631){_0x123631(null,path[_0xf988('0x39')](config[_0xf988('0x3a')],_0xf988('0x3b')));},'filename':function(_0x53fa7f,_0x2aece6,_0x2e86f3){_0x2e86f3(null,util[_0xf988('0x3c')](_0xf988('0x3d'),Date[_0xf988('0x3e')](),_0x2aece6['originalname']));}})});router[_0xf988('0x34')](_0xf988('0x3f'),upload[_0xf988('0x40')](_0xf988('0x41')),controller[_0xf988('0x42')]);router[_0xf988('0x34')](_0xf988('0x43'),auth['isAuthenticated'](),controller[_0xf988('0x44')]);router[_0xf988('0x34')](_0xf988('0x45'),auth['isAuthenticated'](),controller[_0xf988('0x46')]);router[_0xf988('0x34')]('/:id/pause',auth[_0xf988('0x8')](),controller['pause']);router['post'](_0xf988('0x47'),auth[_0xf988('0x8')](),controller[_0xf988('0x48')]);router[_0xf988('0x34')](_0xf988('0x1e'),auth[_0xf988('0x8')](),controller[_0xf988('0x49')]);router['post'](_0xf988('0x4a'),auth['isAuthenticated'](),controller[_0xf988('0x4b')]);router[_0xf988('0x34')](_0xf988('0x4c'),auth[_0xf988('0x8')](),controller[_0xf988('0x4d')]);router[_0xf988('0x34')](_0xf988('0x4e'),auth['isAuthenticated'](),controller[_0xf988('0x4f')]);router['post'](_0xf988('0x50'),auth[_0xf988('0x8')](),controller[_0xf988('0x51')]);router[_0xf988('0x34')]('/:id/openchannel_interactions',auth[_0xf988('0x8')](),controller[_0xf988('0x52')]);router['post'](_0xf988('0x53'),auth[_0xf988('0x8')](),controller[_0xf988('0x54')]);router[_0xf988('0x34')](_0xf988('0x25'),auth[_0xf988('0x8')](),controller[_0xf988('0x55')]);router[_0xf988('0x34')](_0xf988('0x56'),auth[_0xf988('0x8')](),controller[_0xf988('0x57')]);router[_0xf988('0x34')]('/:id/openchannel_accounts',auth[_0xf988('0x8')](),controller[_0xf988('0x58')]);router[_0xf988('0x34')](_0xf988('0x29'),auth['isAuthenticated'](),controller[_0xf988('0x59')]);router['post'](_0xf988('0x2b'),auth[_0xf988('0x8')](),controller['addChatWebsites']);router[_0xf988('0x34')]('/:id/whatsapp_accounts',auth[_0xf988('0x8')](),controller['addWhatsappAccounts']);router['post'](_0xf988('0x2e'),auth['isAuthenticated'](),controller['addSquareProjects']);router[_0xf988('0x34')](_0xf988('0x31'),auth['isAuthenticated'](),controller['createApiKey']);router[_0xf988('0x5a')]('/:id',auth['isAuthenticated'](),controller[_0xf988('0x5b')]);router[_0xf988('0x5a')](_0xf988('0x5c'),auth[_0xf988('0x8')](),controller[_0xf988('0x5d')]);router[_0xf988('0x5e')](_0xf988('0x12'),auth[_0xf988('0x8')](),controller[_0xf988('0x5f')]);router['delete']('/:id/teams',auth[_0xf988('0x8')](),controller[_0xf988('0x60')]);router[_0xf988('0x5e')](_0xf988('0xd'),auth[_0xf988('0x8')](),controller[_0xf988('0x61')]);router[_0xf988('0x5e')]('/:id/chat_interactions',auth[_0xf988('0x8')](),controller[_0xf988('0x62')]);router[_0xf988('0x5e')](_0xf988('0x4c'),auth[_0xf988('0x8')](),controller[_0xf988('0x63')]);router['delete'](_0xf988('0x4e'),auth[_0xf988('0x8')](),controller['removeFaxInteractions']);router[_0xf988('0x5e')](_0xf988('0x50'),auth[_0xf988('0x8')](),controller['removeSmsInteractions']);router['delete'](_0xf988('0x64'),auth[_0xf988('0x8')](),controller['removeOpenchannelInteractions']);router[_0xf988('0x5e')](_0xf988('0x53'),auth[_0xf988('0x8')](),controller[_0xf988('0x65')]);router[_0xf988('0x5e')]('/:id/fax_accounts',auth[_0xf988('0x8')](),controller[_0xf988('0x66')]);router['delete'](_0xf988('0x56'),auth['isAuthenticated'](),controller[_0xf988('0x67')]);router[_0xf988('0x5e')](_0xf988('0x27'),auth['isAuthenticated'](),controller[_0xf988('0x68')]);router[_0xf988('0x5e')](_0xf988('0x29'),auth[_0xf988('0x8')](),controller[_0xf988('0x69')]);router[_0xf988('0x5e')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xf988('0x6a')]);router[_0xf988('0x5e')](_0xf988('0x2d'),auth[_0xf988('0x8')](),controller[_0xf988('0x6b')]);router[_0xf988('0x5e')](_0xf988('0x2e'),auth[_0xf988('0x8')](),controller['removeSquareProjects']);router['delete'](_0xf988('0x31'),auth[_0xf988('0x8')](),controller['removeApiKey']);module[_0xf988('0x6c')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 4832a5b..23d7590 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 _0x4773=['dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','update','outgoing','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','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]','\x22\x22\x20<>','always','refuse','uac','uas','fingerprint','certificate','passive','actpass','update,nonat','TEXT','showWebBar','get','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE'];(function(_0xa54425,_0x3c80a4){var _0x3eeb7a=function(_0x4b8a4e){while(--_0x4b8a4e){_0xa54425['push'](_0xa54425['shift']());}};_0x3eeb7a(++_0x3c80a4);}(_0x4773,0xf9));var _0x3477=function(_0x5b24ac,_0xc1ab43){_0x5b24ac=_0x5b24ac-0x0;var _0x5f1910=_0x4773[_0x5b24ac];return _0x5f1910;};'use strict';var Sequelize=require(_0x3477('0x0'));var moment=require(_0x3477('0x1'));var util=require(_0x3477('0x2'));var _=require(_0x3477('0x3'));module[_0x3477('0x4')]={'name':{'type':Sequelize[_0x3477('0x5')],'allowNull':![],'unique':_0x3477('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3821a2){this[_0x3477('0x7')](_0x3477('0x6'),_0x3821a2);this[_0x3477('0x7')](_0x3477('0x8'),_0x3821a2);},'comment':_0x3477('0x9')},'fullname':{'type':Sequelize[_0x3477('0x5')],'allowNull':![],'set':function(_0x29f247){this[_0x3477('0x7')](_0x3477('0xa'),_0x29f247);this[_0x3477('0x7')](_0x3477('0xb'),util[_0x3477('0xc')](_0x3477('0xd'),_0x29f247,this[_0x3477('0xe')](_0x3477('0xf'))));}},'alias':{'type':Sequelize[_0x3477('0x5')]},'email':{'type':Sequelize[_0x3477('0x5')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x16c9ad){if(_0x16c9ad){this['setDataValue'](_0x3477('0x10'),_0x16c9ad[_0x3477('0x11')]());}}},'role':{'type':Sequelize[_0x3477('0x12')](_0x3477('0x13'),'user','agent',_0x3477('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0x3477('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x3477('0x15')},'internal':{'type':Sequelize[_0x3477('0x16')](0xb),'allowNull':![],'unique':_0x3477('0xf'),'set':function(_0x457d3d){this[_0x3477('0x7')]('internal',_0x457d3d);this[_0x3477('0x7')](_0x3477('0x17'),_0x457d3d);this[_0x3477('0x7')]('callerid',util[_0x3477('0xc')](_0x3477('0xd'),this[_0x3477('0xe')](_0x3477('0xa')),_0x457d3d));}},'salt':{'type':Sequelize[_0x3477('0x5')]},'phone':{'type':Sequelize[_0x3477('0x5')]},'mobile':{'type':Sequelize[_0x3477('0x5')]},'address':{'type':Sequelize[_0x3477('0x5')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x3477('0x5')]},'city':{'type':Sequelize[_0x3477('0x5')]},'country':{'type':Sequelize[_0x3477('0x5')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x3477('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x3477('0x18')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x3477('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x3477('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x3477('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x3477('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x3477('0x5')],'defaultValue':_0x3477('0x19')},'lastPauseAt':{'type':Sequelize[_0x3477('0x1a')]},'chatCapacity':{'type':Sequelize[_0x3477('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x3477('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x3477('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x3477('0x18')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x3477('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x3477('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x3477('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x3477('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x3477('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x3477('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![],'defaultValue':_0x3477('0x1b')},'ipaddr':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x3477('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x3477('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x3477('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x3477('0x1c'),'user',_0x3477('0x1d')),'allowNull':!![],'defaultValue':_0x3477('0x1c')},'context':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![],'defaultValue':_0x3477('0x1e')},'callingpres':{'type':Sequelize['ENUM'](_0x3477('0x1f'),_0x3477('0x20'),_0x3477('0x21'),_0x3477('0x22'),_0x3477('0x23'),_0x3477('0x24'),_0x3477('0x25'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![],'defaultValue':_0x3477('0x26'),'set':function(_0x3d278e){this['setDataValue']('transport',_0x3d278e?_0x3d278e[_0x3477('0x27')](','):null);},'get':function(){return this[_0x3477('0xe')](_0x3477('0x28'))?this[_0x3477('0xe')](_0x3477('0x28'))['split'](','):null;},'comment':_0x3477('0x29')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x3477('0x2a'),_0x3477('0x2b'),_0x3477('0x2c'),_0x3477('0x2d')),'allowNull':!![],'defaultValue':_0x3477('0x2e')},'directmedia':{'type':Sequelize[_0x3477('0x12')](_0x3477('0x2f'),'no','nonat',_0x3477('0x30'),_0x3477('0x31')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3477('0x12')](_0x3477('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x140bdb){this[_0x3477('0x7')]('nat',_0x140bdb?_0x140bdb[_0x3477('0x27')](','):null);},'get':function(){return this[_0x3477('0xe')](_0x3477('0x32'))?this[_0x3477('0xe')](_0x3477('0x32'))[_0x3477('0x33')](','):null;},'comment':_0x3477('0x34')},'callgroup':{'type':Sequelize[_0x3477('0x5')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x3477('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3477('0x5')]},'disallow':{'type':Sequelize[_0x3477('0x5')],'allowNull':![],'defaultValue':_0x3477('0x35')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4b1ca8){this[_0x3477('0x7')](_0x3477('0x36'),_0x4b1ca8?_0x4b1ca8['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x3477('0xe')]('allow')?this['getDataValue'](_0x3477('0x36'))[_0x3477('0x33')](';'):null;},'comment':_0x3477('0x37')},'autoframing':{'type':Sequelize[_0x3477('0x12')](_0x3477('0x2f'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![],'set':function(_0x31f2cc){this['setDataValue']('insecure',_0x31f2cc?_0x31f2cc[_0x3477('0x27')](','):null);},'get':function(){return this[_0x3477('0xe')](_0x3477('0x38'))?this[_0x3477('0xe')](_0x3477('0x38'))['split'](','):null;},'comment':_0x3477('0x39')},'trustrpid':{'type':Sequelize[_0x3477('0x12')](_0x3477('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3477('0x12')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3477('0x12')](_0x3477('0x2f'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x3477('0x12')](_0x3477('0x2f'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x3477('0x12')](_0x3477('0x2f'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x3477('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![],'defaultValue':_0x3477('0x3a')},'amaflags':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x3477('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x3477('0x2f')},'busylevel':{'type':Sequelize[_0x3477('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x3477('0x12')](_0x3477('0x2f'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x3477('0x12')](_0x3477('0x2f'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x3477('0x12')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x3477('0x12')](_0x3477('0x2f'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x3477('0x2f'),'no',_0x3477('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x3477('0x12')](_0x3477('0x2f'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x3477('0x12')]('accept',_0x3477('0x3c'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x3477('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x3477('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x3477('0x12')](_0x3477('0x3d'),_0x3477('0x3e')),'allowNull':!![],'defaultValue':_0x3477('0x3e')},'t38pt_usertpsource':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x3477('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x3477('0x2f')},'keepalive':{'type':Sequelize[_0x3477('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x3477('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x3477('0x12')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x3477('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x3477('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x3477('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x3477('0x12')](_0x3477('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3477('0x12')](_0x3477('0x2f'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x3477('0x12')](_0x3477('0x2f'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x3477('0x12')](_0x3477('0x2f'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x3477('0x12')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x3477('0x3f'),_0x3477('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x3477('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x3477('0x12')]('active',_0x3477('0x41'),_0x3477('0x42')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x3477('0x12')](_0x3477('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x3477('0x16')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x3477('0x12')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x3477('0x2f'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x3477('0x2f'),'no','nonat',_0x3477('0x30'),_0x3477('0x43')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x3477('0x5')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x3477('0x44')]},'showWebBar':{'type':Sequelize[_0x3477('0x16')],'defaultValue':0x0,'set':function(_0x4307d8){this[_0x3477('0x7')](_0x3477('0x45'),_0x4307d8);var _0x12939b=this[_0x3477('0x46')]({'plain':!![]});switch(_0x4307d8){case 0x0:case 0x1:var _0x324971=_0x12939b[_0x3477('0x28')]?_['isArray'](_0x12939b[_0x3477('0x28')])?_0x12939b['transport']['join']():_0x12939b['transport']:_0x3477('0x26');if(_0x324971===_0x3477('0x47')){_0x324971=_0x3477('0x26');}this['setDataValue'](_0x3477('0x28'),_0x324971);this[_0x3477('0x7')](_0x3477('0x48'),'no');this['setDataValue'](_0x3477('0x49'),null);this['setDataValue'](_0x3477('0x4a'),null);this[_0x3477('0x7')](_0x3477('0x4b'),null);this[_0x3477('0x7')](_0x3477('0x4c'),null);this[_0x3477('0x7')](_0x3477('0x4d'),null);this[_0x3477('0x7')](_0x3477('0x4e'),null);this[_0x3477('0x7')](_0x3477('0x4f'),null);this[_0x3477('0x7')](_0x3477('0x50'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0x3477('0x7')](_0x3477('0x28'),_0x3477('0x47'));this[_0x3477('0x7')](_0x3477('0x48'),_0x3477('0x2f'));this[_0x3477('0x7')](_0x3477('0x49'),_0x3477('0x2f'));this[_0x3477('0x7')]('force_avp',_0x3477('0x2f'));this['setDataValue'](_0x3477('0x4b'),_0x3477('0x2f'));this[_0x3477('0x7')](_0x3477('0x4c'),_0x3477('0x2f'));this[_0x3477('0x7')]('dtlsverify','no');this[_0x3477('0x7')](_0x3477('0x4e'),'actpass');this[_0x3477('0x7')](_0x3477('0x4f'),_0x12939b[_0x3477('0x4f')]||'/etc/pki/tls/certs/motion.crt');this[_0x3477('0x7')](_0x3477('0x50'),_0x12939b[_0x3477('0x50')]||'/etc/pki/tls/private/motion.key');this[_0x3477('0x7')](_0x3477('0x51'),_0x3477('0x2f'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x28ab2a){this[_0x3477('0x7')](_0x3477('0x52'),_0x28ab2a?_0x28ab2a['join'](','):[]);},'get':function(){return this[_0x3477('0xe')]('permissions')?_['map'](this[_0x3477('0xe')](_0x3477('0x52'))[_0x3477('0x33')](','),function(_0x3f9983){return parseInt(_0x3f9983,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x3477('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x3477('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x3477('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x3477('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x3477('0x18')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x3477('0x18')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x3477('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x3477('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x3477('0x12')](_0x3477('0x2f'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x3477('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x3477('0x53')],'get':function(){return this['getDataValue'](_0x3477('0x54'))?this['getDataValue'](_0x3477('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x3477('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x3477('0x18')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x3477('0x18')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x3477('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x3477('0x18')],'defaultValue':![],'set':function(_0x4d168c){if(typeof _0x4d168c===_0x3477('0x55')){var _0xb17a7d=_0x4d168c==='1'?!![]:_0x4d168c==='0'?![]:_0x4d168c===_0x3477('0x56')?!![]:_0x4d168c==='false'?![]:![];this[_0x3477('0x7')](_0x3477('0x57'),_0xb17a7d);}else{this[_0x3477('0x7')](_0x3477('0x57'),_0x4d168c);}}},'blocked':{'type':Sequelize[_0x3477('0x18')],'defaultValue':![],'set':function(_0xf48b02){this[_0x3477('0x7')](_0x3477('0x58'),_0xf48b02);if(_0xf48b02===!![]){this[_0x3477('0x7')]('blockedAt',moment());this[_0x3477('0x7')](_0x3477('0x59'),0x0);}else{this['setDataValue'](_0x3477('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0x3477('0x1a')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x3477('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x3477('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x3477('0x18')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0x3477('0x5b')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x3477('0x18')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x3477('0x18')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x3477('0x18')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x3477('0x18')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd6d7=['active','actpass','TEXT','showWebBar','isArray','wss','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','encryption','dtlsverify','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','INTEGER','accountcode','format','\x22%s\x22\x20<%s>','BOOLEAN','DATE','dynamic','user','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','auto','yes','nonat','update','outgoing','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uas','fingerprint','certificate'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd6d7,0xd4));var _0x7d6d=function(_0x4b0c3e,_0x50754a){_0x4b0c3e=_0x4b0c3e-0x0;var _0xa99d4e=_0xd6d7[_0x4b0c3e];return _0xa99d4e;};'use strict';var Sequelize=require(_0x7d6d('0x0'));var moment=require(_0x7d6d('0x1'));var util=require(_0x7d6d('0x2'));var _=require('lodash');module[_0x7d6d('0x3')]={'name':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':![],'unique':_0x7d6d('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0xafda1d){this[_0x7d6d('0x6')](_0x7d6d('0x5'),_0xafda1d);this[_0x7d6d('0x6')](_0x7d6d('0x7'),_0xafda1d);},'comment':_0x7d6d('0x8')},'fullname':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':![],'set':function(_0x9fb1ff){this['setDataValue'](_0x7d6d('0x9'),_0x9fb1ff);this[_0x7d6d('0x6')](_0x7d6d('0xa'),util['format']('\x22%s\x22\x20<%s>',_0x9fb1ff,this[_0x7d6d('0xb')](_0x7d6d('0xc'))));}},'alias':{'type':Sequelize[_0x7d6d('0x4')]},'email':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':![],'unique':_0x7d6d('0xd'),'validate':{'isEmail':!![]},'set':function(_0x3a7da7){if(_0x3a7da7){this[_0x7d6d('0x6')](_0x7d6d('0xd'),_0x3a7da7[_0x7d6d('0xe')]());}}},'role':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x10'),'user',_0x7d6d('0x11'),_0x7d6d('0x12')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x7d6d('0x4')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x7d6d('0x13')](0xb),'allowNull':![],'unique':_0x7d6d('0xc'),'set':function(_0x352a68){this['setDataValue'](_0x7d6d('0xc'),_0x352a68);this[_0x7d6d('0x6')](_0x7d6d('0x14'),_0x352a68);this[_0x7d6d('0x6')](_0x7d6d('0xa'),util[_0x7d6d('0x15')](_0x7d6d('0x16'),this['getDataValue']('fullname'),_0x352a68));}},'salt':{'type':Sequelize[_0x7d6d('0x4')]},'phone':{'type':Sequelize[_0x7d6d('0x4')]},'mobile':{'type':Sequelize[_0x7d6d('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x7d6d('0x4')]},'userpic':{'type':Sequelize[_0x7d6d('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x7d6d('0x18')]},'voicePause':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x7d6d('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x7d6d('0x18')]},'chatCapacity':{'type':Sequelize[_0x7d6d('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x7d6d('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x7d6d('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x7d6d('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x7d6d('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![],'defaultValue':_0x7d6d('0x19')},'ipaddr':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x7d6d('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x7d6d('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x7d6d('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x7d6d('0xf')]('friend',_0x7d6d('0x1a'),_0x7d6d('0x1b')),'allowNull':!![],'defaultValue':_0x7d6d('0x1c')},'context':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![],'defaultValue':_0x7d6d('0x1d')},'callingpres':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x1e'),'ALLOWED_PASSED_SCREEN',_0x7d6d('0x1f'),_0x7d6d('0x20'),'PROHIB_NOT_SCREENED',_0x7d6d('0x21'),_0x7d6d('0x22'),_0x7d6d('0x23')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![],'defaultValue':_0x7d6d('0x24'),'set':function(_0x2421dc){this[_0x7d6d('0x6')](_0x7d6d('0x25'),_0x2421dc?_0x2421dc['join'](','):null);},'get':function(){return this[_0x7d6d('0xb')](_0x7d6d('0x25'))?this[_0x7d6d('0xb')](_0x7d6d('0x25'))[_0x7d6d('0x26')](','):null;},'comment':_0x7d6d('0x27')},'dtmfmode':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x28'),_0x7d6d('0x29'),'shortinfo','inband',_0x7d6d('0x2a')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x2b'),'no',_0x7d6d('0x2c'),_0x7d6d('0x2d'),_0x7d6d('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x7d6d('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x34e6b0){this[_0x7d6d('0x6')](_0x7d6d('0x2f'),_0x34e6b0?_0x34e6b0[_0x7d6d('0x30')](','):null);},'get':function(){return this[_0x7d6d('0xb')](_0x7d6d('0x2f'))?this['getDataValue'](_0x7d6d('0x2f'))[_0x7d6d('0x26')](','):null;},'comment':_0x7d6d('0x31')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x7d6d('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x7d6d('0x4')]},'language':{'type':Sequelize[_0x7d6d('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7d6d('0x4')]},'disallow':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':![],'defaultValue':_0x7d6d('0x32')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7d6d('0x33'),'set':function(_0xecaa23){this[_0x7d6d('0x6')](_0x7d6d('0x34'),_0xecaa23?_0xecaa23[_0x7d6d('0x30')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x7d6d('0xb')](_0x7d6d('0x34'))?this[_0x7d6d('0xb')]('allow')['split'](';'):null;},'comment':_0x7d6d('0x35')},'autoframing':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0xa73ffa){this[_0x7d6d('0x6')](_0x7d6d('0x36'),_0xa73ffa?_0xa73ffa[_0x7d6d('0x30')](','):null);},'get':function(){return this[_0x7d6d('0xb')](_0x7d6d('0x36'))?this[_0x7d6d('0xb')](_0x7d6d('0x36'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x2b'),'no',_0x7d6d('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x7d6d('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x7d6d('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x7d6d('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x7d6d('0x38')},'amaflags':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x7d6d('0x2b')},'busylevel':{'type':Sequelize[_0x7d6d('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x7d6d('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x7d6d('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x2b'),'no',_0x7d6d('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x7d6d('0x3a'),_0x7d6d('0x3b'),_0x7d6d('0x3c')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x7d6d('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x7d6d('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x7d6d('0xf')]('uac',_0x7d6d('0x3d')),'allowNull':!![],'defaultValue':_0x7d6d('0x3d')},'t38pt_usertpsource':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x7d6d('0x2b')},'keepalive':{'type':Sequelize[_0x7d6d('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x7d6d('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x7d6d('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x7d6d('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x7d6d('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x7d6d('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x2b'),'no',_0x7d6d('0x3e'),_0x7d6d('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x7d6d('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x40'),'passive',_0x7d6d('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x7d6d('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x7d6d('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x2b'),'no',_0x7d6d('0x2c'),_0x7d6d('0x2d'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x7d6d('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x7d6d('0x18')]},'passwordResetAt':{'type':Sequelize[_0x7d6d('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x7d6d('0x42')]},'showWebBar':{'type':Sequelize[_0x7d6d('0x13')],'defaultValue':0x0,'set':function(_0x19942f){this['setDataValue'](_0x7d6d('0x43'),_0x19942f);var _0x2f42a5=this['get']({'plain':!![]});switch(_0x19942f){case 0x0:case 0x1:var _0x2d3eb3=_0x2f42a5['transport']?_[_0x7d6d('0x44')](_0x2f42a5[_0x7d6d('0x25')])?_0x2f42a5['transport']['join']():_0x2f42a5['transport']:_0x7d6d('0x24');if(_0x2d3eb3===_0x7d6d('0x45')){_0x2d3eb3='udp';}this[_0x7d6d('0x6')](_0x7d6d('0x25'),_0x2d3eb3);this[_0x7d6d('0x6')]('encryption','no');this['setDataValue']('avpf',null);this[_0x7d6d('0x6')](_0x7d6d('0x46'),null);this[_0x7d6d('0x6')](_0x7d6d('0x47'),null);this[_0x7d6d('0x6')](_0x7d6d('0x48'),null);this[_0x7d6d('0x6')]('dtlsverify',null);this['setDataValue'](_0x7d6d('0x49'),null);this[_0x7d6d('0x6')](_0x7d6d('0x4a'),null);this[_0x7d6d('0x6')](_0x7d6d('0x4b'),null);this['setDataValue'](_0x7d6d('0x4c'),'no');break;case 0x2:this[_0x7d6d('0x6')](_0x7d6d('0x25'),_0x7d6d('0x45'));this[_0x7d6d('0x6')](_0x7d6d('0x4d'),_0x7d6d('0x2b'));this[_0x7d6d('0x6')]('avpf','yes');this['setDataValue'](_0x7d6d('0x46'),_0x7d6d('0x2b'));this[_0x7d6d('0x6')](_0x7d6d('0x47'),_0x7d6d('0x2b'));this[_0x7d6d('0x6')](_0x7d6d('0x48'),'yes');this[_0x7d6d('0x6')](_0x7d6d('0x4e'),'no');this[_0x7d6d('0x6')]('dtlssetup',_0x7d6d('0x41'));this['setDataValue']('dtlscertfile',_0x2f42a5['dtlscertfile']||_0x7d6d('0x4f'));this[_0x7d6d('0x6')](_0x7d6d('0x4b'),_0x2f42a5[_0x7d6d('0x4b')]||_0x7d6d('0x50'));this[_0x7d6d('0x6')](_0x7d6d('0x4c'),_0x7d6d('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0x7d6d('0x42')],'set':function(_0xa9976c){this[_0x7d6d('0x6')](_0x7d6d('0x51'),_0xa9976c?_0xa9976c[_0x7d6d('0x30')](','):[]);},'get':function(){return this['getDataValue'](_0x7d6d('0x51'))?_[_0x7d6d('0x52')](this[_0x7d6d('0xb')](_0x7d6d('0x51'))[_0x7d6d('0x26')](','),function(_0xe0f3b8){return parseInt(_0xe0f3b8,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x7d6d('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x7d6d('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x7d6d('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x7d6d('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x7d6d('0xf')](_0x7d6d('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x7d6d('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x7d6d('0x53')],'get':function(){return this[_0x7d6d('0xb')](_0x7d6d('0x54'))?this[_0x7d6d('0xb')](_0x7d6d('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x7d6d('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x7d6d('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x36eb40){if(typeof _0x36eb40===_0x7d6d('0x55')){var _0x277601=_0x36eb40==='1'?!![]:_0x36eb40==='0'?![]:_0x36eb40===_0x7d6d('0x56')?!![]:_0x36eb40===_0x7d6d('0x57')?![]:![];this['setDataValue'](_0x7d6d('0x58'),_0x277601);}else{this[_0x7d6d('0x6')](_0x7d6d('0x58'),_0x36eb40);}}},'blocked':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':![],'set':function(_0x267db4){this['setDataValue']('blocked',_0x267db4);if(_0x267db4===!![]){this[_0x7d6d('0x6')](_0x7d6d('0x59'),moment());this[_0x7d6d('0x6')](_0x7d6d('0x5a'),0x0);}else{this[_0x7d6d('0x6')](_0x7d6d('0x59'),null);}}},'blockedAt':{'type':Sequelize[_0x7d6d('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x7d6d('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x7d6d('0x13')](0x5)[_0x7d6d('0x5b')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x7d6d('0x17')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 6c76493..7bc4eb8 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 _0x2a07=['removeAgent','TeamVoicePrefix','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','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','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gte','$lt','$eq','$not','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','firstName','lastName','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','apiKeyIat','API\x20key\x20not\x20available','whoami','getPresence','teams','queues','isEmpty','inbound','lower','col','toString','asc','desc','substring','orderBy','offline','idle','unknown','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','select','field','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','bluebird','util','path','lodash','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','request','then','info','User,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','role','Users','user','Agents','agent','Telephones','telephone','ignore','map','value','includes','find','name','UserProfileResource','stack','send','index','User','rawAttributes','fieldName','key','password','getOptions','includeAll','include','attributes','push','findAll','rows','openTabs','length','chat','dataValues','sms','mail','openchannel','all','params','model','differenceBy','keys','query','filters','intersection','fields','merge','options','true','fax','body','describe','addContacts','omit','ids','Setting','validatePasswordPattern','internal','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','fullname','email','permissions','101','103','113','110','104','105','106','108','100','111','114','115','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','each','some','compact','changePassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','oldPassword','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','newPassword','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','securePassword','previousPasswords','validatePasswordHistory','passwordHistoryLimit','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','QueueId','emit','Queue:save','voice','VoiceQueue','format','SIP/%s','penalty','UserVoiceQueueRt','removeQueues','Queues','isArray','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','server/files/images/logos/default_profile.png','existsSync','root','server/files/images/','download','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','CmContact','sort','where','pick','filter','getContacts','CmList','List','Tag','tag','hasOwnProperty','nolimit','Unknown\x20role','Queue','getVoiceQueuesRt','ChatGroup','order','getGroups','VoiceRecording','ScreenRecording','UserId','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','intrf','user:forcelogout','headers','x-forwarded-for','remoteAddress','connection','socket','getVoiceQueues','UserVoiceQueue.penalty','upsert','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','concat','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','type','unpause','mailPause','chatPause','faxPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','whatsapp','%s%s','Pause','getTeams','Team','addTeams','Voice','setDataValue','getMailQueues','getSmsQueues','Sms','getWhatsappQueues','getFaxQueues','Fax','getOpenchannelQueues','flatten','transaction','getDataValue','UserVoicePrefix','VoicePrefixId','removeTeams','getChatQueues','Chat','Whatsapp'];(function(_0x49b819,_0x4aec60){var _0x93a3a8=function(_0x2ef535){while(--_0x2ef535){_0x49b819['push'](_0x49b819['shift']());}};_0x93a3a8(++_0x4aec60);}(_0x2a07,0x74));var _0x72a0=function(_0x427cce,_0x718314){_0x427cce=_0x427cce-0x0;var _0x283078=_0x2a07[_0x427cce];return _0x283078;};'use strict';var moment=require(_0x72a0('0x0'));var BPromise=require(_0x72a0('0x1'));var util=require(_0x72a0('0x2'));var path=require(_0x72a0('0x3'));var fs=require('fs');var _=require(_0x72a0('0x4'));var squel=require('squel');var jayson=require(_0x72a0('0x5'));var Redis=require(_0x72a0('0x6'));var authService=require(_0x72a0('0x7'));var qs=require(_0x72a0('0x8'));var logger=require(_0x72a0('0x9'))(_0x72a0('0xa'));var utils=require(_0x72a0('0xb'));var config=require(_0x72a0('0xc'));var licenseUtil=require(_0x72a0('0xd'));var db=require(_0x72a0('0xe'))['db'];var socket=require(_0x72a0('0xf'))(new Redis(config[_0x72a0('0x10')]));require(_0x72a0('0x11'))[_0x72a0('0x12')](socket);config[_0x72a0('0x10')]=_[_0x72a0('0x13')](config['redis'],{'host':_0x72a0('0x14'),'port':0x18eb});var client=jayson[_0x72a0('0x15')]['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x46fb8a,_0x194488,_0x1b85b1,_0x44d7cf){return new BPromise(function(_0x975c27,_0x516c08){var _0x130797=_0x44d7cf||client;return _0x130797[_0x72a0('0x16')](_0x46fb8a,_0x1b85b1)[_0x72a0('0x17')](function(_0xf91a82){logger[_0x72a0('0x18')](_0x72a0('0x19'),_0x194488,_0x72a0('0x1a'));logger['debug']('User,\x20%s,\x20%s,\x20%s',_0x194488,_0x72a0('0x1a'),JSON[_0x72a0('0x1b')](_0xf91a82));if(_0xf91a82[_0x72a0('0x1c')]){if(_0xf91a82[_0x72a0('0x1c')][_0x72a0('0x1d')]===0x1f4){logger[_0x72a0('0x1c')]('User,\x20%s,\x20%s',_0x194488,_0xf91a82[_0x72a0('0x1c')][_0x72a0('0x1e')]);return _0x516c08(_0xf91a82[_0x72a0('0x1c')][_0x72a0('0x1e')]);}logger[_0x72a0('0x1c')]('User,\x20%s,\x20%s',_0x194488,_0xf91a82[_0x72a0('0x1c')][_0x72a0('0x1e')]);return _0x975c27(_0xf91a82[_0x72a0('0x1c')]['message']);}else{logger[_0x72a0('0x18')](_0x72a0('0x19'),_0x194488,_0x72a0('0x1a'));_0x975c27(_0xf91a82[_0x72a0('0x1f')]['message']);}})[_0x72a0('0x20')](function(_0x5b8f2c){logger[_0x72a0('0x1c')](_0x72a0('0x19'),_0x194488,_0x5b8f2c);_0x516c08(_0x5b8f2c);});});}function respondWithStatusCode(_0xde058c,_0x5c7479){_0x5c7479=_0x5c7479||0xcc;return function(_0x35da77){if(_0x35da77){return _0xde058c[_0x72a0('0x21')](_0x5c7479);}return _0xde058c[_0x72a0('0x22')](_0x5c7479)[_0x72a0('0x23')]();};}function respondWithResult(_0x5d6145,_0x38a7ba){_0x38a7ba=_0x38a7ba||0xc8;return function(_0x390464){if(_0x390464){return _0x5d6145[_0x72a0('0x22')](_0x38a7ba)[_0x72a0('0x24')](_0x390464);}};}function respondWithFilteredResult(_0x3022b0,_0x174b1b){return function(_0x5c4daf){if(_0x5c4daf){var _0x4dd1a6=typeof _0x174b1b[_0x72a0('0x25')]===_0x72a0('0x26')&&typeof _0x174b1b[_0x72a0('0x27')]===_0x72a0('0x26');var _0xf5cb49=_0x5c4daf[_0x72a0('0x28')];var _0xa5bda0=_0x4dd1a6?0x0:_0x174b1b[_0x72a0('0x25')];var _0xee99e2=_0x4dd1a6?_0x5c4daf[_0x72a0('0x28')]:_0x174b1b['offset']+_0x174b1b[_0x72a0('0x27')];var _0x553641;if(_0xee99e2>=_0xf5cb49){_0xee99e2=_0xf5cb49;_0x553641=0xc8;}else{_0x553641=0xce;}_0x3022b0[_0x72a0('0x22')](_0x553641);return _0x3022b0[_0x72a0('0x29')](_0x72a0('0x2a'),_0xa5bda0+'-'+_0xee99e2+'/'+_0xf5cb49)[_0x72a0('0x24')](_0x5c4daf);}return null;};}function saveUpdates(_0x432179){return function(_0x12eda2){if(_0x12eda2){return _0x12eda2[_0x72a0('0x2b')](_0x432179)[_0x72a0('0x17')](function(_0x4ba037){return _0x4ba037;});}return null;};}function removeEntity(_0x41efc1){return function(_0x17e955){if(_0x17e955){return _0x17e955[_0x72a0('0x2c')]()[_0x72a0('0x17')](function(){var _0x13c04=_0x17e955[_0x72a0('0x2d')]({'plain':!![]});if(_0x13c04[_0x72a0('0x2e')]==='admin')return;var _0x30878e=[{'name':_0x72a0('0x2f'),'value':_0x72a0('0x30'),'ignore':!![]},{'name':_0x72a0('0x31'),'value':_0x72a0('0x32'),'ignore':![]},{'name':_0x72a0('0x33'),'value':_0x72a0('0x34'),'ignore':![]}];var _0x313287=_(_0x30878e)['filter'](_0x72a0('0x35'))[_0x72a0('0x36')](_0x72a0('0x37'))['value']();if(_[_0x72a0('0x38')](_0x313287,_0x13c04['role'])){return;}var _0x4b2b44=_[_0x72a0('0x39')](_0x30878e,[_0x72a0('0x37'),_0x13c04[_0x72a0('0x2e')]])[_0x72a0('0x3a')];return db[_0x72a0('0x3b')][_0x72a0('0x2c')]({'where':{'type':_0x4b2b44,'resourceId':_0x13c04['id']}})[_0x72a0('0x17')](function(){return _0x17e955;});})[_0x72a0('0x17')](function(){_0x41efc1[_0x72a0('0x22')](0xcc)[_0x72a0('0x23')]();});}};}function handleEntityNotFound(_0x3ff191){return function(_0x5b6326){if(!_0x5b6326){_0x3ff191[_0x72a0('0x21')](0x194);}return _0x5b6326;};}function handleError(_0x5eb8f1,_0x1d0fa8){_0x1d0fa8=_0x1d0fa8||0x1f4;return function(_0x13c251){logger[_0x72a0('0x1c')](_0x13c251[_0x72a0('0x3c')]);if(_0x13c251[_0x72a0('0x3a')]){delete _0x13c251[_0x72a0('0x3a')];}_0x5eb8f1[_0x72a0('0x22')](_0x1d0fa8)[_0x72a0('0x3d')](_0x13c251);};}exports[_0x72a0('0x3e')]=function(_0x4c1f43,_0x4a973a){var _0x41cfc3={},_0x1d9403={'count':0x0,'rows':[]};var _0x332051=_(db[_0x72a0('0x3f')][_0x72a0('0x40')])['map'](function(_0x3bdd4e){return{'name':_0x3bdd4e[_0x72a0('0x41')],'type':_0x3bdd4e['type'][_0x72a0('0x42')]};})['filter'](function(_0x582c84){return!_['includes']([_0x72a0('0x43'),'salt'],_0x582c84[_0x72a0('0x3a')]);})[_0x72a0('0x37')]();_0x41cfc3=qs[_0x72a0('0x44')](_0x332051,_0x4c1f43);var _0x1d0827={'where':_0x41cfc3['where']};return db['User']['count'](_0x1d0827)['then'](function(_0x106828){_0x1d9403[_0x72a0('0x28')]=_0x106828;if(_0x4c1f43['query'][_0x72a0('0x45')]){_0x41cfc3[_0x72a0('0x46')]=[{'all':!![]}];}if(!_['includes'](_0x41cfc3[_0x72a0('0x47')],'id')){_0x41cfc3[_0x72a0('0x47')][_0x72a0('0x48')]('id');}return db[_0x72a0('0x3f')][_0x72a0('0x49')](_0x41cfc3);})[_0x72a0('0x17')](function(_0x50eb7f){_0x1d9403[_0x72a0('0x4a')]=_0x50eb7f;if(_0x4c1f43['query'][_0x72a0('0x4b')]==='true'){var _0x2266e4=[];for(var _0x3bd306=0x0;_0x3bd306<_0x1d9403['rows'][_0x72a0('0x4c')];_0x3bd306++){_0x2266e4['push'](get_open_tabs(_0x72a0('0x4d'),_0x1d9403[_0x72a0('0x4a')][_0x3bd306][_0x72a0('0x4e')]));_0x2266e4['push'](get_open_tabs(_0x72a0('0x4f'),_0x1d9403[_0x72a0('0x4a')][_0x3bd306][_0x72a0('0x4e')]));_0x2266e4['push'](get_open_tabs('fax',_0x1d9403[_0x72a0('0x4a')][_0x3bd306]['dataValues']));_0x2266e4[_0x72a0('0x48')](get_open_tabs(_0x72a0('0x50'),_0x1d9403[_0x72a0('0x4a')][_0x3bd306][_0x72a0('0x4e')]));_0x2266e4[_0x72a0('0x48')](get_open_tabs(_0x72a0('0x51'),_0x1d9403[_0x72a0('0x4a')][_0x3bd306][_0x72a0('0x4e')]));_0x2266e4[_0x72a0('0x48')](get_open_tabs('whatsapp',_0x1d9403[_0x72a0('0x4a')][_0x3bd306][_0x72a0('0x4e')]));}return BPromise[_0x72a0('0x52')](_0x2266e4)[_0x72a0('0x17')](function(_0x3a669d){return _0x1d9403;});}else{return _0x1d9403;}})[_0x72a0('0x17')](respondWithFilteredResult(_0x4a973a,_0x41cfc3))[_0x72a0('0x20')](handleError(_0x4a973a,null));};exports['show']=function(_0x4f9091,_0x409095){var _0x2161a3={'raw':![],'where':{'id':_0x4f9091[_0x72a0('0x53')]['id']}},_0xe38fb3={};_0xe38fb3[_0x72a0('0x54')]=_[_0x72a0('0x55')](_[_0x72a0('0x56')](db[_0x72a0('0x3f')][_0x72a0('0x40')]),[_0x72a0('0x43'),'salt']);_0xe38fb3[_0x72a0('0x57')]=_[_0x72a0('0x56')](_0x4f9091[_0x72a0('0x57')]);_0xe38fb3[_0x72a0('0x58')]=_[_0x72a0('0x59')](_0xe38fb3['model'],_0xe38fb3[_0x72a0('0x57')]);_0x2161a3['attributes']=_['intersection'](_0xe38fb3[_0x72a0('0x54')],qs[_0x72a0('0x5a')](_0x4f9091[_0x72a0('0x57')][_0x72a0('0x5a')]));_0x2161a3[_0x72a0('0x47')]=_0x2161a3['attributes'][_0x72a0('0x4c')]?_0x2161a3[_0x72a0('0x47')]:_0xe38fb3['model'];if(_0x4f9091['query'][_0x72a0('0x45')]){_0x2161a3[_0x72a0('0x46')]=[{'all':!![]}];}_0x2161a3=_[_0x72a0('0x5b')]({},_0x2161a3,_0x4f9091[_0x72a0('0x5c')]);if(!_[_0x72a0('0x38')](_0x2161a3[_0x72a0('0x47')],'id')){_0x2161a3[_0x72a0('0x47')][_0x72a0('0x48')]('id');}return db['User'][_0x72a0('0x39')](_0x2161a3)['then'](handleEntityNotFound(_0x409095,null))['then'](function(_0x591dbc){var _0x1f30e0=[];values=_0x591dbc;if(_0x4f9091[_0x72a0('0x57')]['openTabs']===_0x72a0('0x5d')){_0x1f30e0['push'](get_open_tabs(_0x72a0('0x4d'),_0x591dbc['dataValues']));_0x1f30e0['push'](get_open_tabs(_0x72a0('0x4f'),_0x591dbc[_0x72a0('0x4e')]));_0x1f30e0['push'](get_open_tabs(_0x72a0('0x51'),_0x591dbc['dataValues']));_0x1f30e0[_0x72a0('0x48')](get_open_tabs('whatsapp',_0x591dbc['dataValues']));_0x1f30e0[_0x72a0('0x48')](get_open_tabs(_0x72a0('0x5e'),_0x591dbc[_0x72a0('0x4e')]));_0x1f30e0['push'](get_open_tabs('mail',_0x591dbc[_0x72a0('0x4e')]));return BPromise['all'](_0x1f30e0);}else{return values;}})[_0x72a0('0x17')](function(_0x36d604){return values;})[_0x72a0('0x17')](respondWithResult(_0x409095,null))[_0x72a0('0x20')](handleError(_0x409095,null));};exports[_0x72a0('0x2b')]=function(_0x2628dd,_0x41f7f6){if(_0x2628dd[_0x72a0('0x5f')]['id']){delete _0x2628dd[_0x72a0('0x5f')]['id'];}delete _0x2628dd[_0x72a0('0x5f')][_0x72a0('0x2e')];return db[_0x72a0('0x3f')]['find']({'where':{'id':_0x2628dd[_0x72a0('0x53')]['id']}})['then'](handleEntityNotFound(_0x41f7f6,null))['then'](saveUpdates(_0x2628dd['body'],null))['then'](respondWithResult(_0x41f7f6,null))[_0x72a0('0x20')](handleError(_0x41f7f6,null));};exports[_0x72a0('0x60')]=function(_0xc805a7,_0x4a2f94){return db[_0x72a0('0x3f')]['describe']()[_0x72a0('0x17')](respondWithResult(_0x4a2f94,null))[_0x72a0('0x20')](handleError(_0x4a2f94,null));};exports['addContacts']=function(_0xea9337,_0x24e211){return db[_0x72a0('0x3f')][_0x72a0('0x39')]({'where':{'id':_0xea9337['params']['id']}})[_0x72a0('0x17')](handleEntityNotFound(_0x24e211,null))['then'](function(_0x29fc67){if(_0x29fc67){return _0x29fc67[_0x72a0('0x61')](_0xea9337[_0x72a0('0x5f')]['ids'],_[_0x72a0('0x62')](_0xea9337[_0x72a0('0x5f')],[_0x72a0('0x63'),'id'])||{});}})[_0x72a0('0x17')](respondWithResult(_0x24e211,null))[_0x72a0('0x20')](handleError(_0x24e211,null));};function validateUser(_0x599e4c){return new BPromise(function(_0x5707e9,_0xa65d14){if(_0x599e4c['internal'])return _0x5707e9(_0x599e4c);return db[_0x72a0('0x64')]['findById'](0x1)[_0x72a0('0x17')](function(_0xd9ae1a){if(_0xd9ae1a['securePassword'])authService[_0x72a0('0x65')](_0x599e4c[_0x72a0('0x43')]);db[_0x72a0('0x3f')]['max'](_0x72a0('0x66'))['then'](function(_0x2ea1bb){if(_[_0x72a0('0x67')](_0x2ea1bb)){_0x599e4c['internal']=_0xd9ae1a[_0x72a0('0x68')]||0x1;return;}if(_['isNil'](_0xd9ae1a['min_internal'])||_0xd9ae1a['min_internal']===_0x2ea1bb){_0x599e4c[_0x72a0('0x66')]=_0x2ea1bb+0x1;return;}if(_0xd9ae1a['min_internal']>_0x2ea1bb){_0x599e4c[_0x72a0('0x66')]=_0xd9ae1a['min_internal'];return;}return db[_0x72a0('0x69')][_0x72a0('0x57')](_0x72a0('0x6a'),{'type':db['sequelize'][_0x72a0('0x6b')][_0x72a0('0x6c')]})[_0x72a0('0x17')](function(_0x28551a){if(_0x28551a&&_0x28551a[_0x72a0('0x4c')]){for(var _0x58ef97=0x0,_0x54e925=_0x28551a[_0x72a0('0x4c')];_0x58ef97<_0x54e925&&_[_0x72a0('0x67')](_0x599e4c[_0x72a0('0x66')]);_0x58ef97++){if(_0xd9ae1a['min_internal']<=_0x28551a[_0x58ef97][_0x72a0('0x6d')]){_0x599e4c[_0x72a0('0x66')]=_0x28551a[_0x58ef97]['from'];}else if(_0xd9ae1a[_0x72a0('0x68')]>_0x28551a[_0x58ef97]['from']&&_0xd9ae1a[_0x72a0('0x68')]<=_0x28551a[_0x58ef97]['to']){_0x599e4c[_0x72a0('0x66')]=_0xd9ae1a[_0x72a0('0x68')];}}}if(_[_0x72a0('0x67')](_0x599e4c[_0x72a0('0x66')])){_0x599e4c[_0x72a0('0x66')]=_0x2ea1bb+0x1;}return _0x5707e9(_0x599e4c);});});})[_0x72a0('0x20')](function(_0x5e3e81){_0xa65d14(_0x5e3e81);});});}function updateUser(_0x5b0dfd){return new BPromise(function(_0x5676e3,_0x1ab2db){try{if(_0x5b0dfd[_0x72a0('0x6e')]){_0x5b0dfd[_0x72a0('0x6f')]=_0x5b0dfd[_0x72a0('0x66')];_0x5b0dfd[_0x72a0('0x70')]={'mailbox':_0x5b0dfd[_0x72a0('0x66')],'password':_0x5b0dfd['password'],'fullname':_0x5b0dfd[_0x72a0('0x71')],'email':_0x5b0dfd[_0x72a0('0x72')]};}if(_0x5b0dfd[_0x72a0('0x2e')]===_0x72a0('0x32')){if(!_0x5b0dfd[_0x72a0('0x73')])_0x5b0dfd[_0x72a0('0x73')]=[_0x72a0('0x74'),'102',_0x72a0('0x75'),_0x72a0('0x76'),_0x72a0('0x77'),_0x72a0('0x78'),_0x72a0('0x79'),_0x72a0('0x7a'),'107',_0x72a0('0x7b'),'109',_0x72a0('0x7c'),_0x72a0('0x7d'),_0x72a0('0x7e'),_0x72a0('0x7f')];}_0x5676e3(_0x5b0dfd);}catch(_0xed6c1b){_0x1ab2db(_0xed6c1b);}});}exports['create']=function(_0x361f8f,_0x46a306){if(_0x361f8f['user'][_0x72a0('0x2e')]===_0x72a0('0x32'))throw new Error(_0x72a0('0x80'));if(_0x361f8f[_0x72a0('0x5f')]['role']===_0x72a0('0x30')&&_0x361f8f[_0x72a0('0x30')][_0x72a0('0x2e')]!==_0x72a0('0x81')){throw new Error(_0x72a0('0x82'));}if(_0x361f8f[_0x72a0('0x5f')][_0x72a0('0x2e')]===_0x72a0('0x81')&&_0x361f8f[_0x72a0('0x30')][_0x72a0('0x2e')]!==_0x72a0('0x81')){throw new Error(_0x72a0('0x83'));}return licenseUtil['checkUserLimits']([_0x361f8f[_0x72a0('0x5f')]])[_0x72a0('0x17')](function(){return validateUser(_0x361f8f[_0x72a0('0x5f')]);})[_0x72a0('0x17')](function(_0xada6ad){return updateUser(_0xada6ad)[_0x72a0('0x17')](function(_0x20281b){if(_0x20281b[_0x72a0('0x2e')]==='admin'){_0x20281b[_0x72a0('0x84')]=_0x361f8f['user']['settingsEnabled'];delete _0x20281b[_0x72a0('0x85')];}return _0x20281b;});})['then'](function(_0x5b9fed){return db[_0x72a0('0x3f')]['create'](_0x5b9fed,{'include':[{'model':db[_0x72a0('0x70')],'as':_0x72a0('0x70')}]});})[_0x72a0('0x17')](function(_0x599a97){if(_0x361f8f[_0x72a0('0x5f')][_0x72a0('0x2e')]===_0x72a0('0x30'))return _0x599a97;if(_0x361f8f[_0x72a0('0x30')][_0x72a0('0x2e')]!=='user')return _0x599a97;return db[_0x72a0('0x86')][_0x72a0('0x39')]({'where':{'name':_0x599a97[_0x72a0('0x2e')]==='agent'?_0x72a0('0x31'):_0x72a0('0x33'),'userProfileId':_0x361f8f[_0x72a0('0x30')]['userProfileId']},'raw':!![]})[_0x72a0('0x17')](function(_0x23b959){if(!_0x23b959||_0x23b959[_0x72a0('0x87')]!=0x0)return _0x599a97;return db[_0x72a0('0x3b')][_0x72a0('0x88')]({'name':_0x599a97[_0x72a0('0x3a')],'resourceId':_0x599a97['id'],'type':_0x23b959[_0x72a0('0x3a')],'sectionId':_0x23b959['id']},{})[_0x72a0('0x17')](function(){return _0x599a97;});})[_0x72a0('0x20')](function(_0x5ca360){logger[_0x72a0('0x1c')](_0x72a0('0x89'),_0x5ca360);throw _0x5ca360;});})[_0x72a0('0x17')](respondWithResult(_0x46a306,0xc9))[_0x72a0('0x20')](handleError(_0x46a306,null));};exports[_0x72a0('0x8a')]=function(_0x5b72b7,_0x311dcd){var _0x2c72fd=_0x5b72b7[_0x72a0('0x5f')];var _0x4124e7=[];if(_0x5b72b7['user'][_0x72a0('0x2e')]===_0x72a0('0x32'))throw new Error(_0x72a0('0x80'));if(_['some'](_0x2c72fd,['role',_0x72a0('0x30')])&&_0x5b72b7[_0x72a0('0x30')][_0x72a0('0x2e')]!==_0x72a0('0x81')){throw new Error(_0x72a0('0x82'));}if(_['some'](_0x2c72fd,['role','admin'])&&_0x5b72b7[_0x72a0('0x30')]['role']!==_0x72a0('0x81')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil['checkUserLimits'](_0x2c72fd)['then'](function(){return validateUser(_0x2c72fd[0x0]);})['then'](function(){for(var _0x33c9dd=0x1;_0x33c9dd<_0x2c72fd[_0x72a0('0x4c')];_0x33c9dd++){var _0x153802=_0x2c72fd[_0x33c9dd-0x1][_0x72a0('0x66')];if(!_0x2c72fd[_0x33c9dd]['internal'])_0x2c72fd[_0x33c9dd][_0x72a0('0x66')]=_0x153802+0x1;_0x4124e7[_0x72a0('0x48')](validateUser(_0x2c72fd[_0x33c9dd]));}return BPromise['all'](_0x4124e7);})[_0x72a0('0x17')](function(){_0x4124e7=[];for(var _0x5c30f9=0x0;_0x5c30f9<_0x2c72fd['length'];_0x5c30f9++){_0x4124e7[_0x72a0('0x48')](updateUser(_0x2c72fd[_0x5c30f9]));}return BPromise[_0x72a0('0x52')](_0x4124e7);})[_0x72a0('0x17')](function(){return BPromise[_0x72a0('0x8b')](_0x2c72fd,function(_0x5e1638){return db['User'][_0x72a0('0x88')](_0x5e1638,{'include':[{'model':db[_0x72a0('0x70')],'as':_0x72a0('0x70')}]})[_0x72a0('0x17')](function(_0x2ac5b0){_0x5e1638['id']=_0x2ac5b0['id'];return _0x5e1638;});});})[_0x72a0('0x17')](function(_0x5d0b4c){if(_0x5b72b7['body'][_0x72a0('0x2e')]===_0x72a0('0x30'))return _0x5d0b4c;if(_0x5b72b7['user'][_0x72a0('0x2e')]!==_0x72a0('0x30'))return _0x5d0b4c;var _0xec7717=_[_0x72a0('0x8c')](_0x5d0b4c,function(_0x328c84){return _0x328c84[_0x72a0('0x2e')]===_0x72a0('0x32')||_0x328c84['role']===_0x72a0('0x34');});if(!_0xec7717)return _0x5d0b4c;return db[_0x72a0('0x86')][_0x72a0('0x49')]({'where':{'name':{'$or':['Agents',_0x72a0('0x33')]},'userProfileId':_0x5b72b7[_0x72a0('0x30')][_0x72a0('0x85')]},'raw':!![]})[_0x72a0('0x17')](function(_0x249e5c){if(_['isEmpty'](_0x249e5c)||!_[_0x72a0('0x8c')](_0x249e5c,[_0x72a0('0x87'),0x0]))return _0x5d0b4c;_0x4124e7=[];var _0x1f6d7d=_(_0x249e5c)[_0x72a0('0x36')](function(_0xfe62a1){if(_0xfe62a1[_0x72a0('0x87')]===0x1)return;return _0xfe62a1['name']===_0x72a0('0x31')?_0x72a0('0x32'):_0x72a0('0x34');})[_0x72a0('0x8d')]()[_0x72a0('0x37')]();for(var _0x3ada9c=0x0;_0x3ada9c<_0x5d0b4c[_0x72a0('0x4c')];_0x3ada9c++){if(!_[_0x72a0('0x38')](_0x1f6d7d,_0x5d0b4c[_0x3ada9c][_0x72a0('0x2e')]))return;var _0x49b0e8=_0x5d0b4c[_0x3ada9c][_0x72a0('0x2e')]==='agent'?_0x72a0('0x31'):_0x72a0('0x33');_0x4124e7[_0x72a0('0x48')](db[_0x72a0('0x3b')][_0x72a0('0x88')]({'name':_0x5d0b4c[_0x3ada9c][_0x72a0('0x3a')],'resourceId':_0x5d0b4c[_0x3ada9c]['id'],'type':_0x49b0e8,'sectionId':_['find'](_0x249e5c,['name',_0x49b0e8])['id']},{}));}return BPromise[_0x72a0('0x52')](_0x4124e7);});})[_0x72a0('0x17')](respondWithResult(_0x311dcd,0xc9))[_0x72a0('0x20')](handleError(_0x311dcd,null));};exports[_0x72a0('0x8e')]=function(_0x453201,_0x3657e2){if(_0x453201[_0x72a0('0x5f')]['id']){delete _0x453201[_0x72a0('0x5f')]['id'];}return db[_0x72a0('0x3f')][_0x72a0('0x39')]({'where':{'id':_0x453201[_0x72a0('0x53')]['id']}})[_0x72a0('0x17')](function(_0x1fb03c){if(!_0x1fb03c)return null;if(_0x1fb03c['id']===_0x453201[_0x72a0('0x30')]['id']){if(!_0x453201[_0x72a0('0x5f')]['oldPassword']||!_0x453201[_0x72a0('0x5f')]['newPassword']){throw new db[(_0x72a0('0x8f'))]['ValidationError'](_0x72a0('0x90'));}if(!_0x1fb03c['authenticate'](_0x453201[_0x72a0('0x5f')][_0x72a0('0x91')])){throw new db[(_0x72a0('0x8f'))][(_0x72a0('0x92'))](_0x72a0('0x93'));}if(_0x453201[_0x72a0('0x5f')]['oldPassword']===_0x453201[_0x72a0('0x5f')]['newPassword']){throw new db[(_0x72a0('0x8f'))][(_0x72a0('0x92'))](_0x72a0('0x94'));}}else if(_0x453201[_0x72a0('0x30')][_0x72a0('0x2e')]===_0x72a0('0x81')){if(!_0x453201['body'][_0x72a0('0x95')]){throw new db[(_0x72a0('0x8f'))][(_0x72a0('0x92'))](_0x72a0('0x96'));}}else if(_0x453201[_0x72a0('0x30')][_0x72a0('0x2e')]===_0x72a0('0x30')){if(!_0x453201[_0x72a0('0x5f')][_0x72a0('0x95')]){throw new db['Sequelize'][(_0x72a0('0x92'))](_0x72a0('0x96'));}if(_0x1fb03c[_0x72a0('0x2e')]!==_0x72a0('0x32')){throw new db[(_0x72a0('0x8f'))][(_0x72a0('0x92'))](_0x72a0('0x80'));}}else{throw new db[(_0x72a0('0x8f'))]['ValidationError']('Unauthorized');}return _0x1fb03c;})['then'](handleEntityNotFound(_0x3657e2,null))['then'](function(_0x528f71){return db['Setting'][_0x72a0('0x97')]({'attributes':['id','securePassword',_0x72a0('0x98'),'passwordHistoryLimit']})[_0x72a0('0x17')](function(_0x4f2632){if(_0x4f2632[_0x72a0('0x99')])authService[_0x72a0('0x65')](_0x453201['body'][_0x72a0('0x95')]);if(!_0x4f2632['enforcePasswordHistory']||!_0x528f71[_0x72a0('0x9a')])return _0x528f71;authService[_0x72a0('0x9b')](_0x453201['body'][_0x72a0('0x95')],_0x528f71['previousPasswords'],_0x4f2632[_0x72a0('0x9c')]);return _0x528f71;})[_0x72a0('0x17')](saveUpdates({'password':_0x453201[_0x72a0('0x5f')][_0x72a0('0x95')],'passwordResetAt':_0x453201['user']['id']==_0x453201[_0x72a0('0x53')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x453201[_0x72a0('0x5f')][_0x72a0('0x95')],_0x528f71[_0x72a0('0x9a')])},null));})[_0x72a0('0x17')](respondWithResult(_0x3657e2,null))[_0x72a0('0x20')](handleError(_0x3657e2,null));};exports[_0x72a0('0x9d')]=function(_0x495e78,_0x38fb73){var _0x308f02=_0x495e78['body'][_0x72a0('0x9e')];return db[_0x72a0('0x3f')][_0x72a0('0x39')]({'where':{'id':_0x495e78[_0x72a0('0x53')]['id']},'attributes':['id','name',_0x72a0('0x2e'),_0x72a0('0x9f'),_0x72a0('0xa0'),_0x72a0('0xa1'),_0x72a0('0xa2')]})[_0x72a0('0x17')](handleEntityNotFound(_0x38fb73,null))['then'](function(_0x404c03){if(_0x404c03){if(!utils[_0x72a0('0xa3')](_0x308f02)){throw new db[(_0x72a0('0x8f'))][(_0x72a0('0x92'))](_0x72a0('0xa4'));}return _0x404c03['add'+_[_0x72a0('0xa5')](_0x308f02[_0x72a0('0xa6')]())+'Queues'](_0x495e78[_0x72a0('0x5f')][_0x72a0('0x63')],{'penalty':_0x495e78[_0x72a0('0x5f')]['penalty']||0x0})['spread'](function(_0x418c52){for(var _0x4592d1=0x0;_0x4592d1<_0x495e78[_0x72a0('0x5f')]['ids']['length'];_0x4592d1+=0x1){var _0x1beace={'UserId':Number(_0x495e78['params']['id'])};_0x1beace[_[_0x72a0('0xa5')](_0x308f02[_0x72a0('0xa6')]())+_0x72a0('0xa7')]=Number(_0x495e78[_0x72a0('0x5f')][_0x72a0('0x63')][_0x4592d1]);socket[_0x72a0('0xa8')]('user'+_[_0x72a0('0xa5')](_0x308f02[_0x72a0('0xa6')]())+_0x72a0('0xa9'),_0x1beace);}return _0x418c52;})[_0x72a0('0x17')](function(){if(_0x308f02===_0x72a0('0xaa')){return db[_0x72a0('0xab')][_0x72a0('0x49')]({'where':{'id':_0x495e78[_0x72a0('0x5f')][_0x72a0('0x63')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x72a0('0x17')](function(_0x1f5df8){var _0x1e17dc=_0x404c03[_0x72a0('0x2d')]({'plain':!![]});var _0x1473cf=[];if(_0x308f02===_0x72a0('0xaa')&&_0x1e17dc[_0x72a0('0x2e')]==='agent'&&_0x1e17dc[_0x72a0('0x9f')]){for(var _0x37d831=0x0;_0x37d831<_0x1f5df8['length'];_0x37d831+=0x1){_0x1473cf[_0x72a0('0x48')]({'membername':_0x1e17dc[_0x72a0('0x3a')],'UserId':_0x1e17dc['id'],'queue_name':_0x1f5df8[_0x37d831][_0x72a0('0x3a')],'VoiceQueueId':_0x1f5df8[_0x37d831]['id'],'interface':_[_0x72a0('0x67')](_0x1e17dc[_0x72a0('0xa2')])?util[_0x72a0('0xac')](_0x72a0('0xad'),_0x1e17dc[_0x72a0('0x3a')]):_0x1e17dc[_0x72a0('0xa2')],'paused':_0x1e17dc[_0x72a0('0xa1')]||![],'penalty':_0x495e78[_0x72a0('0x5f')][_0x72a0('0xae')]||0x0});}return BPromise['each'](_0x1473cf,function(_0xff9f7f){return db[_0x72a0('0xaf')]['upsert'](_0xff9f7f);});}return _0x404c03;});}})[_0x72a0('0x17')](respondWithStatusCode(_0x38fb73,null))[_0x72a0('0x20')](handleError(_0x38fb73,null));};exports[_0x72a0('0xb0')]=function(_0x4d2227,_0x34552b){var _0x468b61;return db[_0x72a0('0x3f')][_0x72a0('0x39')]({'where':{'id':_0x4d2227[_0x72a0('0x53')]['id']},'attributes':['id',_0x72a0('0x3a'),'role']})[_0x72a0('0x17')](handleEntityNotFound(_0x34552b,null))[_0x72a0('0x17')](function(_0x4d4dc6){if(_0x4d4dc6){_0x468b61=_0x4d4dc6;if(!_0x4d2227[_0x72a0('0x57')]['channel']||!utils['isValidChannel'](_0x4d2227['query']['channel'])){throw new db[(_0x72a0('0x8f'))][(_0x72a0('0x92'))](_0x72a0('0xa4'));}return _0x4d4dc6['remove'+_[_0x72a0('0xa5')](_0x4d2227['query'][_0x72a0('0x9e')]['toLowerCase']())+_0x72a0('0xb1')](_0x4d2227[_0x72a0('0x57')]['ids']);}})['then'](function(_0x5aa326){if(_[_0x72a0('0xb2')](_0x4d2227['query'][_0x72a0('0x63')])){for(var _0x127b9f=0x0;_0x127b9f<_0x4d2227[_0x72a0('0x57')][_0x72a0('0x63')][_0x72a0('0x4c')];_0x127b9f+=0x1){var _0x4f5fc={'UserId':Number(_0x4d2227[_0x72a0('0x53')]['id'])};_0x4f5fc[_[_0x72a0('0xa5')](_0x4d2227[_0x72a0('0x57')]['channel'][_0x72a0('0xa6')]())+_0x72a0('0xa7')]=Number(_0x4d2227[_0x72a0('0x57')][_0x72a0('0x63')][_0x127b9f]);socket[_0x72a0('0xa8')](_0x72a0('0x30')+_[_0x72a0('0xa5')](_0x4d2227[_0x72a0('0x57')]['channel'][_0x72a0('0xa6')]())+_0x72a0('0xb3'),_0x4f5fc);}}else{var _0x4f5fc={'UserId':Number(_0x4d2227['params']['id'])};_0x4f5fc[_[_0x72a0('0xa5')](_0x4d2227[_0x72a0('0x57')][_0x72a0('0x9e')]['toLowerCase']())+_0x72a0('0xa7')]=Number(_0x4d2227[_0x72a0('0x57')][_0x72a0('0x63')]);socket[_0x72a0('0xa8')](_0x72a0('0x30')+_[_0x72a0('0xa5')](_0x4d2227[_0x72a0('0x57')]['channel'][_0x72a0('0xa6')]())+'Queue:remove',_0x4f5fc);}return _0x5aa326;})[_0x72a0('0x17')](function(){if(_0x4d2227[_0x72a0('0x57')][_0x72a0('0x9e')]==='voice'){return db[_0x72a0('0xaf')]['destroy']({'where':{'UserId':_0x4d2227[_0x72a0('0x53')]['id'],'VoiceQueueId':_0x4d2227[_0x72a0('0x57')][_0x72a0('0x63')]},'individualHooks':!![]})[_0x72a0('0x17')](function(){return _0x468b61;});}return _0x468b61;})[_0x72a0('0x17')](respondWithStatusCode(_0x34552b,null))['catch'](handleError(_0x34552b,null));};exports[_0x72a0('0xb4')]=function(_0x2f37eb,_0x5eca23){_0x2f37eb[_0x72a0('0x5f')][_0x72a0('0xb5')]=_0x2f37eb[_0x72a0('0xb6')][_0x72a0('0xb7')];return db[_0x72a0('0x3f')][_0x72a0('0x39')]({'where':{'id':_0x2f37eb['params']['id']}})[_0x72a0('0x17')](handleEntityNotFound(_0x5eca23,null))[_0x72a0('0x17')](saveUpdates(_0x2f37eb[_0x72a0('0x5f')],null))[_0x72a0('0x17')](respondWithResult(_0x5eca23,null))[_0x72a0('0x20')](handleError(_0x5eca23,null));};exports[_0x72a0('0xb8')]=function(_0x1292a8,_0x197b61){var _0x51c6fe=path[_0x72a0('0xb9')](config['root'],_0x72a0('0xba'));return db[_0x72a0('0x3f')][_0x72a0('0x39')]({'where':{'id':_0x1292a8[_0x72a0('0x53')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x72a0('0x17')](handleEntityNotFound(_0x197b61,null))[_0x72a0('0x17')](function(_0x56344f){if(_0x56344f){if(_['isNil'](_0x56344f[_0x72a0('0xb5')])){return _0x197b61['download'](_0x51c6fe);}else{if(!fs[_0x72a0('0xbb')](path[_0x72a0('0xb9')](config[_0x72a0('0xbc')],_0x72a0('0xbd'),_0x56344f[_0x72a0('0xb5')]))){return _0x197b61[_0x72a0('0xbe')](_0x51c6fe);}return _0x197b61[_0x72a0('0xbe')](path[_0x72a0('0xb9')](config['root'],_0x72a0('0xbd'),_0x56344f[_0x72a0('0xb5')]));}}})[_0x72a0('0x20')](handleError(_0x197b61,null));};exports[_0x72a0('0xbf')]=function(_0x378586,_0x4e5279){return db[_0x72a0('0x3f')][_0x72a0('0x39')]({'where':{'id':_0x378586[_0x72a0('0x53')]['id']},'attributes':['id']})[_0x72a0('0x17')](handleEntityNotFound(_0x4e5279,null))[_0x72a0('0x17')](function(_0x112e00){var _0x1522ba=[];values=_0x112e00[_0x72a0('0x4e')];_0x1522ba[_0x72a0('0x48')](get_open_tabs(_0x72a0('0x4d'),_0x112e00[_0x72a0('0x4e')]));_0x1522ba[_0x72a0('0x48')](get_open_tabs(_0x72a0('0x4f'),_0x112e00['dataValues']));_0x1522ba[_0x72a0('0x48')](get_open_tabs('openchannel',_0x112e00[_0x72a0('0x4e')]));_0x1522ba[_0x72a0('0x48')](get_open_tabs('whatsapp',_0x112e00[_0x72a0('0x4e')]));_0x1522ba[_0x72a0('0x48')](get_open_tabs('fax',_0x112e00[_0x72a0('0x4e')]));_0x1522ba[_0x72a0('0x48')](get_open_tabs(_0x72a0('0x50'),_0x112e00[_0x72a0('0x4e')]));return BPromise[_0x72a0('0x52')](_0x1522ba);})[_0x72a0('0x17')](function(_0x56f1a6){var _0x23273e=[];if(_0x56f1a6){for(var _0x3b543f=0x0;_0x3b543f=_0x598aa4){_0xeff822=_0x598aa4;_0x2a20ed=0xc8;}else{_0x2a20ed=0xce;}_0x145771[_0xd187('0x21')](_0x2a20ed);return _0x145771['set'](_0xd187('0x25'),_0x4eac6a+'-'+_0xeff822+'/'+_0x598aa4)[_0xd187('0x26')](_0x1047f4);}return null;};}function saveUpdates(_0x34febe){return function(_0x4c50a5){if(_0x4c50a5){return _0x4c50a5[_0xd187('0x27')](_0x34febe)['then'](function(_0x263e31){return _0x263e31;});}return null;};}function removeEntity(_0x19e75f){return function(_0x1e7750){if(_0x1e7750){return _0x1e7750[_0xd187('0x28')]()['then'](function(){var _0x140e54=_0x1e7750[_0xd187('0x29')]({'plain':!![]});if(_0x140e54['role']==='admin')return;var _0x1a1922=[{'name':_0xd187('0x2a'),'value':_0xd187('0x2b'),'ignore':!![]},{'name':_0xd187('0x2c'),'value':_0xd187('0x2d'),'ignore':![]},{'name':_0xd187('0x2e'),'value':_0xd187('0x2f'),'ignore':![]}];var _0x4713df=_(_0x1a1922)['filter'](_0xd187('0x30'))[_0xd187('0x31')](_0xd187('0x32'))['value']();if(_[_0xd187('0x33')](_0x4713df,_0x140e54['role'])){return;}var _0xb3efa3=_[_0xd187('0x34')](_0x1a1922,[_0xd187('0x32'),_0x140e54['role']])['name'];return db[_0xd187('0x35')][_0xd187('0x28')]({'where':{'type':_0xb3efa3,'resourceId':_0x140e54['id']}})['then'](function(){return _0x1e7750;});})[_0xd187('0x16')](function(){_0x19e75f[_0xd187('0x21')](0xcc)[_0xd187('0x20')]();});}};}function handleEntityNotFound(_0x54abed){return function(_0x527c6f){if(!_0x527c6f){_0x54abed[_0xd187('0x36')](0x194);}return _0x527c6f;};}function handleError(_0xf32da2,_0x556146){_0x556146=_0x556146||0x1f4;return function(_0x51f5bf){logger['error'](_0x51f5bf[_0xd187('0x37')]);if(_0x51f5bf['name']){delete _0x51f5bf[_0xd187('0x38')];}_0xf32da2[_0xd187('0x21')](_0x556146)['send'](_0x51f5bf);};}exports[_0xd187('0x39')]=function(_0x5674ca,_0x293ce9){var _0x2db36e={},_0x4af59f={'count':0x0,'rows':[]};var _0x1a6256=_(db[_0xd187('0x3a')]['rawAttributes'])[_0xd187('0x31')](function(_0x5ec6cd){return{'name':_0x5ec6cd['fieldName'],'type':_0x5ec6cd[_0xd187('0x3b')][_0xd187('0x3c')]};})[_0xd187('0x3d')](function(_0x1a8f54){return!_[_0xd187('0x33')](['password',_0xd187('0x3e')],_0x1a8f54[_0xd187('0x38')]);})[_0xd187('0x32')]();_0x2db36e=qs['getOptions'](_0x1a6256,_0x5674ca);var _0x4b121c={'where':_0x2db36e['where']};return db['User'][_0xd187('0x24')](_0x4b121c)[_0xd187('0x16')](function(_0x3d74cc){_0x4af59f[_0xd187('0x24')]=_0x3d74cc;if(_0x5674ca[_0xd187('0x3f')][_0xd187('0x40')]){_0x2db36e[_0xd187('0x41')]=[{'all':!![]}];}if(!_[_0xd187('0x33')](_0x2db36e['attributes'],'id')){_0x2db36e[_0xd187('0x42')][_0xd187('0x43')]('id');}return db[_0xd187('0x3a')]['findAll'](_0x2db36e);})[_0xd187('0x16')](function(_0x48c100){_0x4af59f[_0xd187('0x44')]=_0x48c100;if(_0x5674ca[_0xd187('0x3f')][_0xd187('0x45')]===_0xd187('0x46')){var _0x3cea48=[];for(var _0x49c26e=0x0;_0x49c26e<_0x4af59f[_0xd187('0x44')][_0xd187('0x47')];_0x49c26e++){_0x3cea48[_0xd187('0x43')](get_open_tabs(_0xd187('0x48'),_0x4af59f['rows'][_0x49c26e][_0xd187('0x49')]));_0x3cea48[_0xd187('0x43')](get_open_tabs('sms',_0x4af59f[_0xd187('0x44')][_0x49c26e][_0xd187('0x49')]));_0x3cea48['push'](get_open_tabs('fax',_0x4af59f[_0xd187('0x44')][_0x49c26e][_0xd187('0x49')]));_0x3cea48['push'](get_open_tabs('mail',_0x4af59f['rows'][_0x49c26e][_0xd187('0x49')]));_0x3cea48[_0xd187('0x43')](get_open_tabs(_0xd187('0x4a'),_0x4af59f[_0xd187('0x44')][_0x49c26e][_0xd187('0x49')]));_0x3cea48[_0xd187('0x43')](get_open_tabs(_0xd187('0x4b'),_0x4af59f['rows'][_0x49c26e][_0xd187('0x49')]));}return BPromise[_0xd187('0x4c')](_0x3cea48)[_0xd187('0x16')](function(_0x3ce4a1){return _0x4af59f;});}else{return _0x4af59f;}})[_0xd187('0x16')](respondWithFilteredResult(_0x293ce9,_0x2db36e))[_0xd187('0x1f')](handleError(_0x293ce9,null));};exports[_0xd187('0x4d')]=function(_0x3400a0,_0x4e4a32){var _0x368348={'raw':![],'where':{'id':_0x3400a0[_0xd187('0x4e')]['id']}},_0x2657be={};_0x2657be[_0xd187('0x4f')]=_[_0xd187('0x50')](_['keys'](db[_0xd187('0x3a')][_0xd187('0x51')]),['password',_0xd187('0x3e')]);_0x2657be[_0xd187('0x3f')]=_['keys'](_0x3400a0['query']);_0x2657be['filters']=_['intersection'](_0x2657be[_0xd187('0x4f')],_0x2657be[_0xd187('0x3f')]);_0x368348[_0xd187('0x42')]=_[_0xd187('0x52')](_0x2657be[_0xd187('0x4f')],qs[_0xd187('0x53')](_0x3400a0[_0xd187('0x3f')]['fields']));_0x368348[_0xd187('0x42')]=_0x368348[_0xd187('0x42')][_0xd187('0x47')]?_0x368348[_0xd187('0x42')]:_0x2657be['model'];if(_0x3400a0[_0xd187('0x3f')]['includeAll']){_0x368348['include']=[{'all':!![]}];}_0x368348=_[_0xd187('0x54')]({},_0x368348,_0x3400a0['options']);if(!_[_0xd187('0x33')](_0x368348[_0xd187('0x42')],'id')){_0x368348[_0xd187('0x42')][_0xd187('0x43')]('id');}return db[_0xd187('0x3a')][_0xd187('0x34')](_0x368348)[_0xd187('0x16')](handleEntityNotFound(_0x4e4a32,null))[_0xd187('0x16')](function(_0x1649a2){var _0x55e954=[];values=_0x1649a2;if(_0x3400a0[_0xd187('0x3f')][_0xd187('0x45')]==='true'){_0x55e954[_0xd187('0x43')](get_open_tabs(_0xd187('0x48'),_0x1649a2[_0xd187('0x49')]));_0x55e954['push'](get_open_tabs(_0xd187('0x55'),_0x1649a2[_0xd187('0x49')]));_0x55e954['push'](get_open_tabs(_0xd187('0x4a'),_0x1649a2[_0xd187('0x49')]));_0x55e954['push'](get_open_tabs(_0xd187('0x4b'),_0x1649a2['dataValues']));_0x55e954[_0xd187('0x43')](get_open_tabs(_0xd187('0x56'),_0x1649a2[_0xd187('0x49')]));_0x55e954[_0xd187('0x43')](get_open_tabs(_0xd187('0x57'),_0x1649a2[_0xd187('0x49')]));return BPromise[_0xd187('0x4c')](_0x55e954);}else{return values;}})['then'](function(_0xcef6ca){return values;})[_0xd187('0x16')](respondWithResult(_0x4e4a32,null))[_0xd187('0x1f')](handleError(_0x4e4a32,null));};exports['update']=function(_0x374e30,_0x23428f){if(_0x374e30[_0xd187('0x58')]['id']){delete _0x374e30[_0xd187('0x58')]['id'];}delete _0x374e30[_0xd187('0x58')][_0xd187('0x59')];return db[_0xd187('0x3a')][_0xd187('0x34')]({'where':{'id':_0x374e30[_0xd187('0x4e')]['id']}})[_0xd187('0x16')](handleEntityNotFound(_0x23428f,null))[_0xd187('0x16')](saveUpdates(_0x374e30[_0xd187('0x58')],null))[_0xd187('0x16')](respondWithResult(_0x23428f,null))[_0xd187('0x1f')](handleError(_0x23428f,null));};exports[_0xd187('0x5a')]=function(_0xaff1e6,_0x42fb32){return db[_0xd187('0x3a')][_0xd187('0x5a')]()[_0xd187('0x16')](respondWithResult(_0x42fb32,null))['catch'](handleError(_0x42fb32,null));};exports[_0xd187('0x5b')]=function(_0x48c82d,_0x13d118){return db[_0xd187('0x3a')][_0xd187('0x34')]({'where':{'id':_0x48c82d[_0xd187('0x4e')]['id']}})['then'](handleEntityNotFound(_0x13d118,null))[_0xd187('0x16')](function(_0x2eda30){if(_0x2eda30){return _0x2eda30['addContacts'](_0x48c82d['body'][_0xd187('0x5c')],_[_0xd187('0x5d')](_0x48c82d[_0xd187('0x58')],[_0xd187('0x5c'),'id'])||{});}})['then'](respondWithResult(_0x13d118,null))[_0xd187('0x1f')](handleError(_0x13d118,null));};function validateUser(_0x49543f){return new BPromise(function(_0x1971b2,_0x2f6a72){if(_0x49543f[_0xd187('0x5e')])return _0x1971b2(_0x49543f);return db[_0xd187('0x5f')]['findById'](0x1)[_0xd187('0x16')](function(_0xaea7e0){if(_0xaea7e0[_0xd187('0x60')])authService[_0xd187('0x61')](_0x49543f[_0xd187('0x62')]);db['User']['max'](_0xd187('0x5e'))[_0xd187('0x16')](function(_0x167eaf){if(_[_0xd187('0x63')](_0x167eaf)){_0x49543f[_0xd187('0x5e')]=_0xaea7e0[_0xd187('0x64')]||0x1;return;}if(_[_0xd187('0x63')](_0xaea7e0[_0xd187('0x64')])||_0xaea7e0[_0xd187('0x64')]===_0x167eaf){_0x49543f[_0xd187('0x5e')]=_0x167eaf+0x1;return;}if(_0xaea7e0[_0xd187('0x64')]>_0x167eaf){_0x49543f[_0xd187('0x5e')]=_0xaea7e0['min_internal'];return;}return db[_0xd187('0x65')][_0xd187('0x3f')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0xd187('0x65')][_0xd187('0x66')]['SELECT']})['then'](function(_0x32ba2a){if(_0x32ba2a&&_0x32ba2a[_0xd187('0x47')]){for(var _0x2ac56f=0x0,_0x2f743b=_0x32ba2a['length'];_0x2ac56f<_0x2f743b&&_[_0xd187('0x63')](_0x49543f[_0xd187('0x5e')]);_0x2ac56f++){if(_0xaea7e0['min_internal']<=_0x32ba2a[_0x2ac56f]['from']){_0x49543f[_0xd187('0x5e')]=_0x32ba2a[_0x2ac56f]['from'];}else if(_0xaea7e0[_0xd187('0x64')]>_0x32ba2a[_0x2ac56f][_0xd187('0x67')]&&_0xaea7e0['min_internal']<=_0x32ba2a[_0x2ac56f]['to']){_0x49543f[_0xd187('0x5e')]=_0xaea7e0['min_internal'];}}}if(_[_0xd187('0x63')](_0x49543f['internal'])){_0x49543f['internal']=_0x167eaf+0x1;}return _0x1971b2(_0x49543f);});});})['catch'](function(_0x16d9ea){_0x2f6a72(_0x16d9ea);});});}function updateUser(_0x243063){return new BPromise(function(_0x421585,_0x216829){try{if(_0x243063[_0xd187('0x68')]){_0x243063[_0xd187('0x69')]=_0x243063[_0xd187('0x5e')];_0x243063[_0xd187('0x6a')]={'mailbox':_0x243063['internal'],'password':_0x243063[_0xd187('0x62')],'fullname':_0x243063[_0xd187('0x6b')],'email':_0x243063[_0xd187('0x6c')]};}if(_0x243063['role']===_0xd187('0x2d')){if(!_0x243063[_0xd187('0x6d')])_0x243063[_0xd187('0x6d')]=[_0xd187('0x6e'),'102',_0xd187('0x6f'),_0xd187('0x70'),'110',_0xd187('0x71'),_0xd187('0x72'),_0xd187('0x73'),_0xd187('0x74'),'108',_0xd187('0x75'),_0xd187('0x76'),'111',_0xd187('0x77'),'115'];}_0x421585(_0x243063);}catch(_0x47c27c){_0x216829(_0x47c27c);}});}exports['create']=function(_0x7cbbac,_0x28472d){if(_0x7cbbac[_0xd187('0x2b')][_0xd187('0x59')]===_0xd187('0x2d'))throw new Error(_0xd187('0x78'));if(_0x7cbbac['body'][_0xd187('0x59')]===_0xd187('0x2b')&&_0x7cbbac['user']['role']!==_0xd187('0x79')){throw new Error(_0xd187('0x7a'));}if(_0x7cbbac[_0xd187('0x58')][_0xd187('0x59')]===_0xd187('0x79')&&_0x7cbbac[_0xd187('0x2b')]['role']!==_0xd187('0x79')){throw new Error(_0xd187('0x7b'));}return licenseUtil[_0xd187('0x7c')]([_0x7cbbac[_0xd187('0x58')]])[_0xd187('0x16')](function(){return validateUser(_0x7cbbac[_0xd187('0x58')]);})[_0xd187('0x16')](function(_0x1e58d4){return updateUser(_0x1e58d4)[_0xd187('0x16')](function(_0xf31fac){if(_0xf31fac[_0xd187('0x59')]===_0xd187('0x79')){_0xf31fac['settingsEnabled']=_0x7cbbac['user'][_0xd187('0x7d')];delete _0xf31fac[_0xd187('0x7e')];}return _0xf31fac;});})[_0xd187('0x16')](function(_0x147c96){return db[_0xd187('0x3a')][_0xd187('0x7f')](_0x147c96,{'include':[{'model':db['VoiceMail'],'as':_0xd187('0x6a')}]});})['then'](function(_0x2b2df3){if(_0x7cbbac['body']['role']===_0xd187('0x2b'))return _0x2b2df3;if(_0x7cbbac['user'][_0xd187('0x59')]!==_0xd187('0x2b'))return _0x2b2df3;return db[_0xd187('0x80')][_0xd187('0x34')]({'where':{'name':_0x2b2df3[_0xd187('0x59')]===_0xd187('0x2d')?_0xd187('0x2c'):_0xd187('0x2e'),'userProfileId':_0x7cbbac[_0xd187('0x2b')][_0xd187('0x7e')]},'raw':!![]})[_0xd187('0x16')](function(_0x3ae931){if(!_0x3ae931||_0x3ae931[_0xd187('0x81')]!=0x0)return _0x2b2df3;return db[_0xd187('0x35')][_0xd187('0x7f')]({'name':_0x2b2df3['name'],'resourceId':_0x2b2df3['id'],'type':_0x3ae931[_0xd187('0x38')],'sectionId':_0x3ae931['id']},{})[_0xd187('0x16')](function(){return _0x2b2df3;});})[_0xd187('0x1f')](function(_0x43563b){logger['error'](_0xd187('0x82'),_0x43563b);throw _0x43563b;});})[_0xd187('0x16')](respondWithResult(_0x28472d,0xc9))['catch'](handleError(_0x28472d,null));};exports['bulkCreate']=function(_0x20b680,_0x3c993a){var _0x7fdb14=_0x20b680[_0xd187('0x58')];var _0x371869=[];if(_0x20b680[_0xd187('0x2b')]['role']===_0xd187('0x2d'))throw new Error(_0xd187('0x78'));if(_['some'](_0x7fdb14,[_0xd187('0x59'),_0xd187('0x2b')])&&_0x20b680[_0xd187('0x2b')][_0xd187('0x59')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0xd187('0x83')](_0x7fdb14,[_0xd187('0x59'),_0xd187('0x79')])&&_0x20b680['user'][_0xd187('0x59')]!==_0xd187('0x79')){throw new Error(_0xd187('0x84'));}return licenseUtil[_0xd187('0x7c')](_0x7fdb14)['then'](function(){return validateUser(_0x7fdb14[0x0]);})[_0xd187('0x16')](function(){for(var _0x4efb9f=0x1;_0x4efb9f<_0x7fdb14['length'];_0x4efb9f++){var _0x4a9310=_0x7fdb14[_0x4efb9f-0x1]['internal'];if(!_0x7fdb14[_0x4efb9f]['internal'])_0x7fdb14[_0x4efb9f]['internal']=_0x4a9310+0x1;_0x371869['push'](validateUser(_0x7fdb14[_0x4efb9f]));}return BPromise[_0xd187('0x4c')](_0x371869);})[_0xd187('0x16')](function(){_0x371869=[];for(var _0x4c5879=0x0;_0x4c5879<_0x7fdb14[_0xd187('0x47')];_0x4c5879++){_0x371869[_0xd187('0x43')](updateUser(_0x7fdb14[_0x4c5879]));}return BPromise[_0xd187('0x4c')](_0x371869);})[_0xd187('0x16')](function(){return BPromise[_0xd187('0x85')](_0x7fdb14,function(_0x4a1189){return db[_0xd187('0x3a')]['create'](_0x4a1189,{'include':[{'model':db[_0xd187('0x6a')],'as':_0xd187('0x6a')}]})[_0xd187('0x16')](function(_0x36e6ae){_0x4a1189['id']=_0x36e6ae['id'];return _0x4a1189;});});})[_0xd187('0x16')](function(_0x18690e){if(_0x20b680[_0xd187('0x58')]['role']===_0xd187('0x2b'))return _0x18690e;if(_0x20b680[_0xd187('0x2b')]['role']!==_0xd187('0x2b'))return _0x18690e;var _0x3720f1=_['some'](_0x18690e,function(_0x348b73){return _0x348b73[_0xd187('0x59')]===_0xd187('0x2d')||_0x348b73[_0xd187('0x59')]===_0xd187('0x2f');});if(!_0x3720f1)return _0x18690e;return db[_0xd187('0x80')][_0xd187('0x86')]({'where':{'name':{'$or':[_0xd187('0x2c'),'Telephones']},'userProfileId':_0x20b680[_0xd187('0x2b')][_0xd187('0x7e')]},'raw':!![]})[_0xd187('0x16')](function(_0x44ac47){if(_[_0xd187('0x87')](_0x44ac47)||!_[_0xd187('0x83')](_0x44ac47,['autoAssociation',0x0]))return _0x18690e;_0x371869=[];var _0x4fcf43=_(_0x44ac47)[_0xd187('0x31')](function(_0x3c9248){if(_0x3c9248['autoAssociation']===0x1)return;return _0x3c9248[_0xd187('0x38')]===_0xd187('0x2c')?_0xd187('0x2d'):_0xd187('0x2f');})[_0xd187('0x88')]()[_0xd187('0x32')]();for(var _0x578de9=0x0;_0x578de9<_0x18690e[_0xd187('0x47')];_0x578de9++){if(!_[_0xd187('0x33')](_0x4fcf43,_0x18690e[_0x578de9][_0xd187('0x59')]))return;var _0x23e30b=_0x18690e[_0x578de9][_0xd187('0x59')]===_0xd187('0x2d')?_0xd187('0x2c'):_0xd187('0x2e');_0x371869[_0xd187('0x43')](db['UserProfileResource'][_0xd187('0x7f')]({'name':_0x18690e[_0x578de9][_0xd187('0x38')],'resourceId':_0x18690e[_0x578de9]['id'],'type':_0x23e30b,'sectionId':_[_0xd187('0x34')](_0x44ac47,['name',_0x23e30b])['id']},{}));}return BPromise[_0xd187('0x4c')](_0x371869);});})[_0xd187('0x16')](respondWithResult(_0x3c993a,0xc9))[_0xd187('0x1f')](handleError(_0x3c993a,null));};exports[_0xd187('0x89')]=function(_0x1e0e80,_0xec0779){if(_0x1e0e80['body']['id']){delete _0x1e0e80[_0xd187('0x58')]['id'];}return db[_0xd187('0x3a')][_0xd187('0x34')]({'where':{'id':_0x1e0e80['params']['id']}})[_0xd187('0x16')](function(_0xd39f2a){if(!_0xd39f2a)return null;if(_0xd39f2a['id']===_0x1e0e80[_0xd187('0x2b')]['id']){if(!_0x1e0e80[_0xd187('0x58')][_0xd187('0x8a')]||!_0x1e0e80[_0xd187('0x58')]['newPassword']){throw new db[(_0xd187('0x8b'))][(_0xd187('0x8c'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0xd39f2a[_0xd187('0x8d')](_0x1e0e80[_0xd187('0x58')]['oldPassword'])){throw new db[(_0xd187('0x8b'))][(_0xd187('0x8c'))]('Wrong\x20credentials');}if(_0x1e0e80[_0xd187('0x58')][_0xd187('0x8a')]===_0x1e0e80['body'][_0xd187('0x8e')]){throw new db['Sequelize'][(_0xd187('0x8c'))](_0xd187('0x8f'));}}else if(_0x1e0e80[_0xd187('0x2b')][_0xd187('0x59')]===_0xd187('0x79')){if(!_0x1e0e80['body']['newPassword']){throw new db[(_0xd187('0x8b'))][(_0xd187('0x8c'))](_0xd187('0x90'));}}else if(_0x1e0e80[_0xd187('0x2b')][_0xd187('0x59')]===_0xd187('0x2b')){if(!_0x1e0e80[_0xd187('0x58')]['newPassword']){throw new db[(_0xd187('0x8b'))][(_0xd187('0x8c'))](_0xd187('0x90'));}if(_0xd39f2a[_0xd187('0x59')]!==_0xd187('0x2d')){throw new db[(_0xd187('0x8b'))]['ValidationError'](_0xd187('0x78'));}}else{throw new db[(_0xd187('0x8b'))][(_0xd187('0x8c'))](_0xd187('0x78'));}return _0xd39f2a;})[_0xd187('0x16')](handleEntityNotFound(_0xec0779,null))[_0xd187('0x16')](function(_0x1c6433){return db[_0xd187('0x5f')]['findOne']({'attributes':['id',_0xd187('0x60'),'enforcePasswordHistory',_0xd187('0x91')]})[_0xd187('0x16')](function(_0x4853a8){if(_0x4853a8[_0xd187('0x60')])authService[_0xd187('0x61')](_0x1e0e80['body'][_0xd187('0x8e')]);if(!_0x4853a8['enforcePasswordHistory']||!_0x1c6433[_0xd187('0x92')])return _0x1c6433;authService['validatePasswordHistory'](_0x1e0e80['body'][_0xd187('0x8e')],_0x1c6433[_0xd187('0x92')],_0x4853a8[_0xd187('0x91')]);return _0x1c6433;})[_0xd187('0x16')](saveUpdates({'password':_0x1e0e80['body'][_0xd187('0x8e')],'passwordResetAt':_0x1e0e80[_0xd187('0x2b')]['id']==_0x1e0e80[_0xd187('0x4e')]['id']?moment():null,'previousPasswords':authService[_0xd187('0x93')](_0x1e0e80[_0xd187('0x58')][_0xd187('0x8e')],_0x1c6433[_0xd187('0x92')])},null));})[_0xd187('0x16')](respondWithResult(_0xec0779,null))[_0xd187('0x1f')](handleError(_0xec0779,null));};exports[_0xd187('0x94')]=function(_0x52f520,_0x74f8d7){var _0x8c3b2a=_0x52f520[_0xd187('0x58')]['channel'];return db['User'][_0xd187('0x34')]({'where':{'id':_0x52f520[_0xd187('0x4e')]['id']},'attributes':['id',_0xd187('0x38'),'role','online',_0xd187('0x95'),_0xd187('0x96'),'interface']})[_0xd187('0x16')](handleEntityNotFound(_0x74f8d7,null))[_0xd187('0x16')](function(_0x361f8b){if(_0x361f8b){if(!utils[_0xd187('0x97')](_0x8c3b2a)){throw new db['Sequelize'][(_0xd187('0x8c'))](_0xd187('0x98'));}return _0x361f8b[_0xd187('0x99')+_[_0xd187('0x9a')](_0x8c3b2a[_0xd187('0x9b')]())+_0xd187('0x9c')](_0x52f520[_0xd187('0x58')]['ids'],{'penalty':_0x52f520[_0xd187('0x58')]['penalty']||0x0})[_0xd187('0x9d')](function(_0x4f50a8){for(var _0x3a1101=0x0;_0x3a1101<_0x52f520['body'][_0xd187('0x5c')][_0xd187('0x47')];_0x3a1101+=0x1){var _0x388797={'UserId':Number(_0x52f520['params']['id'])};_0x388797[_[_0xd187('0x9a')](_0x8c3b2a[_0xd187('0x9b')]())+_0xd187('0x9e')]=Number(_0x52f520[_0xd187('0x58')][_0xd187('0x5c')][_0x3a1101]);socket[_0xd187('0x9f')](_0xd187('0x2b')+_[_0xd187('0x9a')](_0x8c3b2a['toLowerCase']())+_0xd187('0xa0'),_0x388797);}return _0x4f50a8;})[_0xd187('0x16')](function(){if(_0x8c3b2a===_0xd187('0xa1')){return db['VoiceQueue'][_0xd187('0x86')]({'where':{'id':_0x52f520[_0xd187('0x58')][_0xd187('0x5c')]||[]},'raw':!![],'attributes':['id',_0xd187('0x38')]});}})[_0xd187('0x16')](function(_0x28bc14){var _0x2e4db4=_0x361f8b[_0xd187('0x29')]({'plain':!![]});var _0xbb4a68=[];if(_0x8c3b2a===_0xd187('0xa1')&&_0x2e4db4[_0xd187('0x59')]==='agent'&&_0x2e4db4[_0xd187('0xa2')]){for(var _0x7960ed=0x0;_0x7960ed<_0x28bc14[_0xd187('0x47')];_0x7960ed+=0x1){_0xbb4a68[_0xd187('0x43')]({'membername':_0x2e4db4['name'],'UserId':_0x2e4db4['id'],'queue_name':_0x28bc14[_0x7960ed][_0xd187('0x38')],'VoiceQueueId':_0x28bc14[_0x7960ed]['id'],'interface':_['isNil'](_0x2e4db4[_0xd187('0xa3')])?util[_0xd187('0xa4')](_0xd187('0xa5'),_0x2e4db4[_0xd187('0x38')]):_0x2e4db4[_0xd187('0xa3')],'paused':_0x2e4db4['voicePause']||![],'penalty':_0x52f520[_0xd187('0x58')][_0xd187('0xa6')]||0x0});}return BPromise[_0xd187('0x85')](_0xbb4a68,function(_0x31c17b){return db[_0xd187('0xa7')]['upsert'](_0x31c17b);});}return _0x361f8b;});}})[_0xd187('0x16')](respondWithStatusCode(_0x74f8d7,null))[_0xd187('0x1f')](handleError(_0x74f8d7,null));};exports[_0xd187('0xa8')]=function(_0x4fce90,_0x4dcd41){var _0x38e2af;return db[_0xd187('0x3a')][_0xd187('0x34')]({'where':{'id':_0x4fce90[_0xd187('0x4e')]['id']},'attributes':['id','name',_0xd187('0x59')]})[_0xd187('0x16')](handleEntityNotFound(_0x4dcd41,null))[_0xd187('0x16')](function(_0x1721c2){if(_0x1721c2){_0x38e2af=_0x1721c2;if(!_0x4fce90['query'][_0xd187('0xa9')]||!utils['isValidChannel'](_0x4fce90[_0xd187('0x3f')][_0xd187('0xa9')])){throw new db[(_0xd187('0x8b'))][(_0xd187('0x8c'))](_0xd187('0x98'));}return _0x1721c2['remove'+_[_0xd187('0x9a')](_0x4fce90[_0xd187('0x3f')][_0xd187('0xa9')][_0xd187('0x9b')]())+'Queues'](_0x4fce90[_0xd187('0x3f')][_0xd187('0x5c')]);}})[_0xd187('0x16')](function(_0x474a9f){if(_[_0xd187('0xaa')](_0x4fce90[_0xd187('0x3f')][_0xd187('0x5c')])){for(var _0x12e3ca=0x0;_0x12e3ca<_0x4fce90[_0xd187('0x3f')][_0xd187('0x5c')][_0xd187('0x47')];_0x12e3ca+=0x1){var _0x943fc1={'UserId':Number(_0x4fce90[_0xd187('0x4e')]['id'])};_0x943fc1[_['capitalize'](_0x4fce90[_0xd187('0x3f')]['channel'][_0xd187('0x9b')]())+'QueueId']=Number(_0x4fce90[_0xd187('0x3f')][_0xd187('0x5c')][_0x12e3ca]);socket[_0xd187('0x9f')](_0xd187('0x2b')+_['capitalize'](_0x4fce90['query'][_0xd187('0xa9')][_0xd187('0x9b')]())+_0xd187('0xab'),_0x943fc1);}}else{var _0x943fc1={'UserId':Number(_0x4fce90[_0xd187('0x4e')]['id'])};_0x943fc1[_[_0xd187('0x9a')](_0x4fce90['query']['channel'][_0xd187('0x9b')]())+_0xd187('0x9e')]=Number(_0x4fce90[_0xd187('0x3f')]['ids']);socket[_0xd187('0x9f')](_0xd187('0x2b')+_[_0xd187('0x9a')](_0x4fce90['query'][_0xd187('0xa9')]['toLowerCase']())+_0xd187('0xab'),_0x943fc1);}return _0x474a9f;})['then'](function(){if(_0x4fce90['query']['channel']===_0xd187('0xa1')){return db[_0xd187('0xa7')][_0xd187('0x28')]({'where':{'UserId':_0x4fce90[_0xd187('0x4e')]['id'],'VoiceQueueId':_0x4fce90[_0xd187('0x3f')][_0xd187('0x5c')]},'individualHooks':!![]})['then'](function(){return _0x38e2af;});}return _0x38e2af;})[_0xd187('0x16')](respondWithStatusCode(_0x4dcd41,null))['catch'](handleError(_0x4dcd41,null));};exports[_0xd187('0xac')]=function(_0x3ee43e,_0x3c71f3){_0x3ee43e[_0xd187('0x58')][_0xd187('0xad')]=_0x3ee43e[_0xd187('0xae')]['filename'];return db[_0xd187('0x3a')][_0xd187('0x34')]({'where':{'id':_0x3ee43e[_0xd187('0x4e')]['id']}})[_0xd187('0x16')](handleEntityNotFound(_0x3c71f3,null))['then'](saveUpdates(_0x3ee43e[_0xd187('0x58')],null))[_0xd187('0x16')](respondWithResult(_0x3c71f3,null))['catch'](handleError(_0x3c71f3,null));};exports[_0xd187('0xaf')]=function(_0x305023,_0xc926a1){var _0x18c8e4=path['join'](config[_0xd187('0xb0')],'server/files/images/logos/default_profile.png');return db['User']['find']({'where':{'id':_0x305023[_0xd187('0x4e')]['id']},'attributes':['id',_0xd187('0xad')],'raw':!![]})[_0xd187('0x16')](handleEntityNotFound(_0xc926a1,null))[_0xd187('0x16')](function(_0x7d8eb5){if(_0x7d8eb5){if(_[_0xd187('0x63')](_0x7d8eb5[_0xd187('0xad')])){return _0xc926a1[_0xd187('0xb1')](_0x18c8e4);}else{if(!fs['existsSync'](path[_0xd187('0xb2')](config[_0xd187('0xb0')],_0xd187('0xb3'),_0x7d8eb5['userpic']))){return _0xc926a1[_0xd187('0xb1')](_0x18c8e4);}return _0xc926a1[_0xd187('0xb1')](path[_0xd187('0xb2')](config[_0xd187('0xb0')],_0xd187('0xb3'),_0x7d8eb5['userpic']));}}})[_0xd187('0x1f')](handleError(_0xc926a1,null));};exports[_0xd187('0xb4')]=function(_0x1ac714,_0x5ac21a){return db[_0xd187('0x3a')][_0xd187('0x34')]({'where':{'id':_0x1ac714[_0xd187('0x4e')]['id']},'attributes':['id']})[_0xd187('0x16')](handleEntityNotFound(_0x5ac21a,null))['then'](function(_0x476b70){var _0x3cf76c=[];values=_0x476b70[_0xd187('0x49')];_0x3cf76c[_0xd187('0x43')](get_open_tabs('chat',_0x476b70[_0xd187('0x49')]));_0x3cf76c[_0xd187('0x43')](get_open_tabs('sms',_0x476b70[_0xd187('0x49')]));_0x3cf76c['push'](get_open_tabs(_0xd187('0x4a'),_0x476b70['dataValues']));_0x3cf76c['push'](get_open_tabs(_0xd187('0x4b'),_0x476b70['dataValues']));_0x3cf76c[_0xd187('0x43')](get_open_tabs('fax',_0x476b70[_0xd187('0x49')]));_0x3cf76c[_0xd187('0x43')](get_open_tabs('mail',_0x476b70[_0xd187('0x49')]));return BPromise[_0xd187('0x4c')](_0x3cf76c);})[_0xd187('0x16')](function(_0x450bf6){var _0x1751ee=[];if(_0x450bf6){for(var _0x17a1d6=0x0;_0x17a1d6=_0x42d17a[_0xad7f('0x50')]){throw new Error(_0xad7f('0x51'));}})['then'](function(){if(_0x3cd581){return db['UserVoiceQueueRt'][_0xad7f('0x4b')]({'where':{'membername':_0x3cd581[_0xad7f('0x2c')]},'individualHooks':!![]});}})[_0xad7f('0xf')](function(){if(_0x3cd581){return _0x3cd581['getVoiceQueues']({'raw':!![]});}})[_0xad7f('0xf')](function(_0x53f800){if(_0x3cd581){if(_0x53f800){var _0xff767d=[];_0x57c7e3=_0x53f800;if(_0x57c7e3[_0xad7f('0x2e')]){for(var _0x46d0d8=0x0;_0x46d0d8<_0x57c7e3['length'];_0x46d0d8++){_0xff767d[_0xad7f('0x33')](db['UserVoiceQueueRt'][_0xad7f('0x52')]({'membername':_0x3cd581[_0xad7f('0x2c')],'UserId':_0x3cd581['id'],'queue_name':_0x57c7e3[_0x46d0d8][_0xad7f('0x2c')],'VoiceQueueId':_0x57c7e3[_0x46d0d8]['id'],'interface':_0x2fd91c,'paused':_0x3cd581['loginInPause']||![],'penalty':_0x57c7e3[_0x46d0d8]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0xff767d);}}}})[_0xad7f('0xf')](function(){if(_0x3cd581){return db['MemberReport'][_0xad7f('0x1a')]({'where':{'membername':_0x3cd581['name'],'exitAt':null}});}})[_0xad7f('0xf')](function(_0x3dda89){if(_0x3cd581){if(_0x3dda89&&_0x3dda89[_0xad7f('0x2e')]){var _0x5b6823=[];_0x3dda89[_0xad7f('0x32')](function(_0x4c1363){_0x5b6823[_0xad7f('0x33')](_0x4c1363[_0xad7f('0x2a')]({'exitAt':moment()[_0xad7f('0x35')](_0xad7f('0x2f'))}));});return BPromise[_0xad7f('0x49')](_0x5b6823);}}})[_0xad7f('0xf')](function(_0x471ccd){if(_0x3cd581){var _0x2b1b1e=[];var _0x10b914=[];var _0x2993b4=utils[_0xad7f('0x31')]();var _0x30626b={'membername':_0x3cd581[_0xad7f('0x2c')],'interface':_0x2fd91c,'enterAt':moment()[_0xad7f('0x35')](_0xad7f('0x2f')),'role':_0x3cd581[_0xad7f('0x27')],'internal':_0x3cd581['internal']};_0x2993b4[_0xad7f('0x32')](function(_0x4ae1bc){_0x2b1b1e[_0xad7f('0x33')](_['merge']({'channel':_0x4ae1bc,'type':'LOGIN','data1':'callysquare','data2':_0x2fd91c},_0x30626b));if(_0x3cd581[_0xad7f('0x53')]){_0x10b914[_0xad7f('0x33')](_[_0xad7f('0x54')]({'channel':_0x4ae1bc,'type':_0xad7f('0x2d'),'data1':_0xad7f('0x55')},_0x30626b));}});return db[_0xad7f('0x2b')][_0xad7f('0x3c')](_0x2b1b1e[_0xad7f('0x56')](_0x10b914),{'individualHooks':!![]});}})['then'](function(){if(_0x3cd581){return _0x3cd581[_0xad7f('0x2a')]({'online':!![],'lastLoginAt':moment()[_0xad7f('0x35')](_0xad7f('0x2f')),'voicePause':_0x3cd581[_0xad7f('0x53')]||![],'mailPause':_0x3cd581[_0xad7f('0x53')]||![],'chatPause':_0x3cd581[_0xad7f('0x53')]||![],'faxPause':_0x3cd581[_0xad7f('0x53')]||![],'smsPause':_0x3cd581[_0xad7f('0x53')]||![],'openchannelPause':_0x3cd581[_0xad7f('0x53')]||![],'pauseType':_0x3cd581['loginInPause']?_0xad7f('0x55'):null,'lastPauseAt':moment()[_0xad7f('0x35')](_0xad7f('0x2f')),'interface':_0x2fd91c});}})[_0xad7f('0xf')](function(_0xcb6e08){_0x165a92(_0xcb6e08);})[_0xad7f('0x17')](function(_0x487260){_0x206145(_0x44e86c[_0xad7f('0x13')](0x1f4,_0x487260[_0xad7f('0x15')]));});});}; \ No newline at end of file +var _0x224d=['catch','User','find','ShowUser','PauseUser','name','internal','interface','update','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','PAUSE','body','type','DEFAULT\x20PAUSE','role','bulkCreate','UnpauseUser','findOne','isValidChannel','channel','UserVoiceQueueRt','system','mail','chat','fax','sms','whatsapp','set','Pause','all','LogoutUser','destroy','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetUser','findAll','options','raw','where','attributes','limit','map','include','model'];(function(_0x447d80,_0xf1b84c){var _0x4f13f5=function(_0x3406e8){while(--_0x3406e8){_0x447d80['push'](_0x447d80['shift']());}};_0x4f13f5(++_0xf1b84c);}(_0x224d,0x151));var _0xd224=function(_0x3041ce,_0x382f98){_0x3041ce=_0x3041ce-0x0;var _0x68a7f9=_0x224d[_0x3041ce];return _0x68a7f9;};'use strict';var _=require(_0xd224('0x0'));var util=require(_0xd224('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd224('0x2'));var fs=require('fs');var Redis=require(_0xd224('0x3'));var db=require(_0xd224('0x4'))['db'];var utils=require(_0xd224('0x5'));var logger=require(_0xd224('0x6'))(_0xd224('0x7'));var config=require('../../config/environment');var jayson=require(_0xd224('0x8'));var client=jayson['client'][_0xd224('0x9')]({'port':0x232a});config[_0xd224('0xa')]=_[_0xd224('0xb')](config[_0xd224('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xd224('0xc'))(new Redis(config[_0xd224('0xa')]));require('./user.socket')['register'](socket);function respondWithRpcPromise(_0x355c1d,_0x48c025,_0x1b2e51){return new BPromise(function(_0x4b0c9c,_0x21bdf2){return client[_0xd224('0xd')](_0x355c1d,_0x1b2e51)[_0xd224('0xe')](function(_0x134ab1){logger[_0xd224('0xf')](_0xd224('0x10'),_0x48c025,_0xd224('0x11'));logger[_0xd224('0x12')](_0xd224('0x13'),_0x48c025,_0xd224('0x11'),JSON[_0xd224('0x14')](_0x134ab1));if(_0x134ab1[_0xd224('0x15')]){if(_0x134ab1[_0xd224('0x15')][_0xd224('0x16')]===0x1f4){logger[_0xd224('0x15')](_0xd224('0x10'),_0x48c025,_0x134ab1['error'][_0xd224('0x17')]);return _0x21bdf2(_0x134ab1[_0xd224('0x15')][_0xd224('0x17')]);}logger[_0xd224('0x15')](_0xd224('0x10'),_0x48c025,_0x134ab1['error'][_0xd224('0x17')]);return _0x4b0c9c(_0x134ab1[_0xd224('0x15')][_0xd224('0x17')]);}else{logger[_0xd224('0xf')](_0xd224('0x10'),_0x48c025,_0xd224('0x11'));_0x4b0c9c(_0x134ab1[_0xd224('0x18')]['message']);}})['catch'](function(_0x3a5956){logger[_0xd224('0x15')]('User,\x20%s,\x20%s',_0x48c025,_0x3a5956);_0x21bdf2(_0x3a5956);});});}exports[_0xd224('0x19')]=function(_0x460201){var _0x2b0ef7=this;return new Promise(function(_0x85dca7,_0x1c1261){return db['User'][_0xd224('0x1a')]({'raw':_0x460201['options']?_0x460201[_0xd224('0x1b')][_0xd224('0x1c')]===undefined?!![]:![]:!![],'where':_0x460201['options']?_0x460201[_0xd224('0x1b')][_0xd224('0x1d')]||null:null,'attributes':_0x460201['options']?_0x460201[_0xd224('0x1b')][_0xd224('0x1e')]||null:null,'limit':_0x460201[_0xd224('0x1b')]?_0x460201[_0xd224('0x1b')][_0xd224('0x1f')]||null:null,'include':_0x460201[_0xd224('0x1b')]?_0x460201['options']['include']?_[_0xd224('0x20')](_0x460201[_0xd224('0x1b')][_0xd224('0x21')],function(_0x57e511){return{'model':db[_0x57e511[_0xd224('0x22')]],'as':_0x57e511['as'],'attributes':_0x57e511[_0xd224('0x1e')],'include':_0x57e511[_0xd224('0x21')]?_[_0xd224('0x20')](_0x57e511[_0xd224('0x21')],function(_0x471c88){return{'model':db[_0x471c88[_0xd224('0x22')]],'as':_0x471c88['as'],'attributes':_0x471c88['attributes'],'include':_0x471c88[_0xd224('0x21')]?_['map'](_0x471c88[_0xd224('0x21')],function(_0x40d945){return{'model':db[_0x40d945['model']],'as':_0x40d945['as'],'attributes':_0x40d945[_0xd224('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd224('0xe')](function(_0x5d13d6){logger[_0xd224('0xf')]('GetUser',_0x460201);logger[_0xd224('0x12')](_0xd224('0x19'),_0x460201,JSON[_0xd224('0x14')](_0x5d13d6));_0x85dca7(_0x5d13d6);})[_0xd224('0x23')](function(_0x7bfef2){logger['error']('GetUser',_0x7bfef2[_0xd224('0x17')],_0x460201);_0x1c1261(_0x2b0ef7[_0xd224('0x15')](0x1f4,_0x7bfef2[_0xd224('0x17')]));});});};exports['ShowUser']=function(_0x1c33c0){var _0xdc23=this;return new Promise(function(_0x21d139,_0x1c8a78){return db[_0xd224('0x24')][_0xd224('0x25')]({'raw':_0x1c33c0[_0xd224('0x1b')]?_0x1c33c0[_0xd224('0x1b')][_0xd224('0x1c')]===undefined?!![]:![]:!![],'where':_0x1c33c0[_0xd224('0x1b')]?_0x1c33c0[_0xd224('0x1b')][_0xd224('0x1d')]||null:null,'attributes':_0x1c33c0[_0xd224('0x1b')]?_0x1c33c0[_0xd224('0x1b')][_0xd224('0x1e')]||null:null,'include':_0x1c33c0['options']?_0x1c33c0[_0xd224('0x1b')][_0xd224('0x21')]?_['map'](_0x1c33c0['options'][_0xd224('0x21')],function(_0x19cb6e){return{'model':db[_0x19cb6e[_0xd224('0x22')]],'as':_0x19cb6e['as'],'attributes':_0x19cb6e[_0xd224('0x1e')],'include':_0x19cb6e[_0xd224('0x21')]?_[_0xd224('0x20')](_0x19cb6e[_0xd224('0x21')],function(_0x5d5192){return{'model':db[_0x5d5192[_0xd224('0x22')]],'as':_0x5d5192['as'],'attributes':_0x5d5192[_0xd224('0x1e')],'include':_0x5d5192[_0xd224('0x21')]?_['map'](_0x5d5192['include'],function(_0x155975){return{'model':db[_0x155975['model']],'as':_0x155975['as'],'attributes':_0x155975[_0xd224('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd224('0xe')](function(_0x12fb70){logger[_0xd224('0xf')](_0xd224('0x26'),_0x1c33c0);logger[_0xd224('0x12')]('ShowUser',_0x1c33c0,JSON['stringify'](_0x12fb70));_0x21d139(_0x12fb70);})[_0xd224('0x23')](function(_0x243d76){logger['error']('ShowUser',_0x243d76[_0xd224('0x17')],_0x1c33c0);_0x1c8a78(_0xdc23['error'](0x1f4,_0x243d76[_0xd224('0x17')]));});});};exports[_0xd224('0x27')]=function(_0x1d45f7){var _0x47fed7=this;return new Promise(function(_0x423055,_0x2f2253){var _0x200a0d;return db[_0xd224('0x24')][_0xd224('0x25')]({'where':_0x1d45f7[_0xd224('0x1b')]['where']||{},'attributes':['id',_0xd224('0x28'),'role',_0xd224('0x29'),_0xd224('0x2a')]})['then'](function(_0x212dd0){if(_0x212dd0){_0x200a0d=_0x212dd0;return db['UserVoiceQueueRt'][_0xd224('0x2b')]({'paused':0x1},{'where':{'UserId':_0x200a0d['id']},'individualHooks':!![]});}})[_0xd224('0xe')](function(){if(_0x200a0d){return db[_0xd224('0x2c')][_0xd224('0x1a')]({'where':{'membername':_0x200a0d[_0xd224('0x28')],'type':'PAUSE','exitAt':null}});}})[_0xd224('0xe')](function(_0x172b71){if(_0x200a0d){if(_0x172b71&&_0x172b71[_0xd224('0x2d')]){var _0x470cf5=moment()[_0xd224('0x2e')](_0xd224('0x2f'));for(var _0x567f53=0x0,_0x55a290=_0x172b71[_0xd224('0x2d')];_0x567f53<_0x55a290;_0x567f53++){_0x172b71[_0x567f53][_0xd224('0x30')]({'exitAt':_0x470cf5});}}}})[_0xd224('0xe')](function(){if(_0x200a0d){var _0x2da5ac=[];var _0x395a6f=utils[_0xd224('0x31')]();_0x395a6f[_0xd224('0x32')](function(_0x2f466a){_0x2da5ac[_0xd224('0x33')]({'channel':_0x2f466a,'membername':_0x200a0d['name'],'interface':_[_0xd224('0x34')](_0x200a0d[_0xd224('0x2a')])?util['format'](_0xd224('0x35'),_0x200a0d['name']):_0x200a0d[_0xd224('0x2a')],'type':_0xd224('0x36'),'enterAt':moment()[_0xd224('0x2e')](_0xd224('0x2f')),'data1':_0x1d45f7[_0xd224('0x37')][_0xd224('0x38')]||_0xd224('0x39'),'role':_0x200a0d[_0xd224('0x3a')],'internal':_0x200a0d[_0xd224('0x29')],'uniqueid':_0x1d45f7[_0xd224('0x37')]['uniqueid']||null});});return db[_0xd224('0x2c')][_0xd224('0x3b')](_0x2da5ac,{'individualHooks':!![]});}})['then'](function(){if(_0x200a0d){return _0x200a0d[_0xd224('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x1d45f7[_0xd224('0x37')][_0xd224('0x38')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xd224('0x2e')](_0xd224('0x2f'))});}})['then'](function(_0x2044ef){_0x423055(_0x2044ef);})[_0xd224('0x23')](function(_0x9a8ede){_0x2f2253(_0x47fed7[_0xd224('0x15')](0x1f4,_0x9a8ede[_0xd224('0x17')]));});});};exports[_0xd224('0x3c')]=function(_0x584d57){var _0x4dd0d4=this;return new Promise(function(_0x505a46,_0x29636a){var _0x5a57d2;return db[_0xd224('0x24')][_0xd224('0x3d')]({'where':_0x584d57[_0xd224('0x1b')]['where']||{},'attributes':['id',_0xd224('0x28')]})['then'](function(_0x349fad){if(_0x349fad){_0x5a57d2=_0x349fad;if(_0x584d57[_0xd224('0x37')]['channel']&&!utils[_0xd224('0x3e')](_0x584d57[_0xd224('0x37')]['channel'])){throw new Error('Unknown\x20channel');}switch(_0x584d57[_0xd224('0x37')][_0xd224('0x3f')]){case'voice':return db[_0xd224('0x40')]['update']({'paused':0x0},{'where':{'UserId':_0x5a57d2['id']}})['then'](function(){return db[_0xd224('0x2c')][_0xd224('0x25')]({'where':{'channel':_0x584d57['body'][_0xd224('0x3f')],'membername':_0x5a57d2[_0xd224('0x28')],'type':_0xd224('0x36'),'exitAt':null}});})[_0xd224('0xe')](function(_0x2bde39){if(_0x2bde39){return _0x2bde39['update']({'exitAt':moment()[_0xd224('0x2e')](_0xd224('0x2f')),'data2':_0xd224('0x41')},{'individualHooks':!![]});}return null;})[_0xd224('0xe')](function(){return _0x5a57d2[_0xd224('0x2b')]({'voicePause':![]});});case _0xd224('0x42'):case _0xd224('0x43'):case _0xd224('0x44'):case _0xd224('0x45'):case'openchannel':case _0xd224('0x46'):return db[_0xd224('0x2c')]['find']({'where':{'channel':_0x584d57['body'][_0xd224('0x3f')],'membername':_0x5a57d2[_0xd224('0x28')],'type':_0xd224('0x36'),'exitAt':null}})[_0xd224('0xe')](function(_0x10a79e){return _0x10a79e[_0xd224('0x2b')]({'exitAt':moment()[_0xd224('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xd224('0x41')},{'individualHooks':!![]});})[_0xd224('0xe')](function(){var _0x1eda48={};_[_0xd224('0x47')](_0x1eda48,util[_0xd224('0x2e')]('%s%s',_0x584d57[_0xd224('0x37')]['channel'],_0xd224('0x48')),![]);return _0x5a57d2['update'](_0x1eda48);});default:return db[_0xd224('0x40')]['update']({'paused':0x0},{'where':{'UserId':_0x5a57d2['id']}})[_0xd224('0xe')](function(){return db[_0xd224('0x2c')][_0xd224('0x1a')]({'where':{'membername':_0x5a57d2['name'],'type':_0xd224('0x36'),'exitAt':null}});})[_0xd224('0xe')](function(_0x133726){var _0x5972ed=[];_0x133726[_0xd224('0x32')](function(_0x1564a9){_0x5972ed['push'](_0x1564a9[_0xd224('0x2b')]({'exitAt':moment()['format'](_0xd224('0x2f')),'data2':_0xd224('0x41')}));});return BPromise[_0xd224('0x49')](_0x5972ed);})['then'](function(){return _0x5a57d2[_0xd224('0x2b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xd224('0xe')](function(_0x48279b){_0x505a46(_0x48279b);})[_0xd224('0x23')](function(_0xec2568){_0x29636a(_0x4dd0d4[_0xd224('0x15')](0x1f4,_0xec2568[_0xd224('0x17')]));});});};exports[_0xd224('0x4a')]=function(_0x483985){var _0x4dd298=this;return new Promise(function(_0x5722a5,_0x470e2b){var _0x341d4a;return db[_0xd224('0x24')]['findOne']({'where':_0x483985[_0xd224('0x1b')][_0xd224('0x1d')]||{},'attributes':['id',_0xd224('0x28')]})[_0xd224('0xe')](function(_0x35e927){if(_0x35e927){_0x341d4a=_0x35e927;return db[_0xd224('0x40')][_0xd224('0x4b')]({'where':{'membername':_0x341d4a[_0xd224('0x28')]},'individualHooks':!![]});}})[_0xd224('0xe')](function(){if(_0x341d4a){return db[_0xd224('0x2c')]['findAll']({'where':{'membername':_0x341d4a['name'],'exitAt':null}});}})['then'](function(_0x4efbc3){if(_0x341d4a){if(_0x4efbc3&&_0x4efbc3[_0xd224('0x2d')]){var _0x3a9d33=[];_0x4efbc3['forEach'](function(_0x30caa3){_0x3a9d33[_0xd224('0x33')](_0x30caa3[_0xd224('0x2b')]({'exitAt':moment()['format'](_0xd224('0x2f'))}));});return BPromise[_0xd224('0x49')](_0x3a9d33);}}})[_0xd224('0xe')](function(){if(_0x341d4a){return _0x341d4a[_0xd224('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x5a2983){_0x5722a5(_0x5a2983);})[_0xd224('0x23')](function(_0x559105){_0x470e2b(_0x4dd298[_0xd224('0x15')](0x1f4,_0x559105[_0xd224('0x17')]));});});};exports[_0xd224('0x4c')]=function(_0xe19716){var _0xe78a9b=this;return new Promise(function(_0x61f631,_0x40a677){var _0x5be567;var _0x309b23;var _0x454abd;var _0x2c2770;return db['User']['findOne']({'where':_0xe19716[_0xd224('0x1b')][_0xd224('0x1d')]||{},'attributes':['id','name',_0xd224('0x3a'),_0xd224('0x4d'),_0xd224('0x4e'),_0xd224('0x29'),_0xd224('0x4f'),_0xd224('0x2a')]})[_0xd224('0xe')](function(_0x3c7469){if(_0x3c7469){_0x5be567=_0x3c7469;_0x2c2770=_0xe19716[_0xd224('0x37')]['interface']?_0xe19716[_0xd224('0x37')][_0xd224('0x2a')]:util['format']('SIP/%s',_0x5be567['name']);return db[_0xd224('0x24')][_0xd224('0x50')]({'where':{'role':_0xd224('0x51'),'online':!![],'id':{'$ne':_0x5be567['id']}}});}})[_0xd224('0xe')](function(_0x20217f){if(_0x20217f){_0x454abd=_0x20217f;return require(_0xd224('0x52'))[_0xd224('0x53')]();}})[_0xd224('0xe')](function(_0x47b554){if(_0x47b554&&_0x47b554[_0xd224('0x54')]&&_0x454abd>=_0x47b554[_0xd224('0x54')]){throw new Error(_0xd224('0x55'));}})[_0xd224('0xe')](function(){if(_0x5be567){return db[_0xd224('0x40')]['destroy']({'where':{'membername':_0x5be567['name']},'individualHooks':!![]});}})[_0xd224('0xe')](function(){if(_0x5be567){return _0x5be567['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x23a557){if(_0x5be567){if(_0x23a557){var _0x4dd422=[];_0x309b23=_0x23a557;if(_0x309b23[_0xd224('0x2d')]){for(var _0x194a7a=0x0;_0x194a7a<_0x309b23[_0xd224('0x2d')];_0x194a7a++){_0x4dd422[_0xd224('0x33')](db[_0xd224('0x40')][_0xd224('0x56')]({'membername':_0x5be567['name'],'UserId':_0x5be567['id'],'queue_name':_0x309b23[_0x194a7a][_0xd224('0x28')],'VoiceQueueId':_0x309b23[_0x194a7a]['id'],'interface':_0x2c2770,'paused':_0x5be567[_0xd224('0x4f')]||![],'penalty':_0x309b23[_0x194a7a][_0xd224('0x57')]||0x0}));}return BPromise[_0xd224('0x49')](_0x4dd422);}}}})[_0xd224('0xe')](function(){if(_0x5be567){return db[_0xd224('0x2c')][_0xd224('0x1a')]({'where':{'membername':_0x5be567[_0xd224('0x28')],'exitAt':null}});}})[_0xd224('0xe')](function(_0x1fff0e){if(_0x5be567){if(_0x1fff0e&&_0x1fff0e[_0xd224('0x2d')]){var _0x5435be=[];_0x1fff0e[_0xd224('0x32')](function(_0x1db1c3){_0x5435be[_0xd224('0x33')](_0x1db1c3[_0xd224('0x2b')]({'exitAt':moment()[_0xd224('0x2e')](_0xd224('0x2f'))}));});return BPromise['all'](_0x5435be);}}})['then'](function(_0x2a7d61){if(_0x5be567){var _0x5825dc=[];var _0x3abd1b=[];var _0x230e84=utils[_0xd224('0x31')]();var _0x4978b8={'membername':_0x5be567[_0xd224('0x28')],'interface':_0x2c2770,'enterAt':moment()['format'](_0xd224('0x2f')),'role':_0x5be567[_0xd224('0x3a')],'internal':_0x5be567[_0xd224('0x29')]};_0x230e84[_0xd224('0x32')](function(_0x116c0a){_0x5825dc[_0xd224('0x33')](_[_0xd224('0x58')]({'channel':_0x116c0a,'type':_0xd224('0x59'),'data1':_0xd224('0x5a'),'data2':_0x2c2770},_0x4978b8));if(_0x5be567[_0xd224('0x4f')]){_0x3abd1b[_0xd224('0x33')](_[_0xd224('0x58')]({'channel':_0x116c0a,'type':_0xd224('0x36'),'data1':_0xd224('0x5b')},_0x4978b8));}});return db['MemberReport'][_0xd224('0x3b')](_0x5825dc[_0xd224('0x5c')](_0x3abd1b),{'individualHooks':!![]});}})[_0xd224('0xe')](function(){if(_0x5be567){return _0x5be567['update']({'online':!![],'lastLoginAt':moment()[_0xd224('0x2e')](_0xd224('0x2f')),'voicePause':_0x5be567['loginInPause']||![],'mailPause':_0x5be567[_0xd224('0x4f')]||![],'chatPause':_0x5be567[_0xd224('0x4f')]||![],'faxPause':_0x5be567['loginInPause']||![],'smsPause':_0x5be567['loginInPause']||![],'openchannelPause':_0x5be567['loginInPause']||![],'pauseType':_0x5be567['loginInPause']?_0xd224('0x5b'):null,'lastPauseAt':moment()[_0xd224('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x2c2770});}})[_0xd224('0xe')](function(_0xd0736){_0x61f631(_0xd0736);})[_0xd224('0x23')](function(_0xaefdd7){_0x40a677(_0xe78a9b[_0xd224('0x15')](0x1f4,_0xaefdd7[_0xd224('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 980629a..67c2847 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 _0x6f89=['removeListener','length','save','remove','update'];(function(_0x5499ab,_0x4c1128){var _0x344478=function(_0x5d767e){while(--_0x5d767e){_0x5499ab['push'](_0x5499ab['shift']());}};_0x344478(++_0x4c1128);}(_0x6f89,0x11f));var _0x96f8=function(_0x5f3c11,_0x6dd90d){_0x5f3c11=_0x5f3c11-0x0;var _0xa18c27=_0x6f89[_0x5f3c11];return _0xa18c27;};'use strict';var UserEvents=require('./user.events');var events=[_0x96f8('0x0'),_0x96f8('0x1'),_0x96f8('0x2')];function createListener(_0x1a4e24,_0x3970c8){return function(_0x45ad59){_0x3970c8['emit'](_0x1a4e24,_0x45ad59);};}function removeListener(_0x57e707,_0x10367b){return function(){UserEvents[_0x96f8('0x3')](_0x57e707,_0x10367b);};}exports['register']=function(_0x2d3d95){for(var _0x104343=0x0,_0x2598b7=events[_0x96f8('0x4')];_0x104343<_0x2598b7;_0x104343++){var _0x371411=events[_0x104343];var _0xaf63f1=createListener('user:'+_0x371411,_0x2d3d95);UserEvents['on'](_0x371411,_0xaf63f1);}}; \ No newline at end of file +var _0xb79a=['user:','./user.events','save','update','emit','removeListener','length'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0xb79a,0xef));var _0xab79=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb79a[_0x2641f9];return _0x585741;};'use strict';var UserEvents=require(_0xab79('0x0'));var events=[_0xab79('0x1'),'remove',_0xab79('0x2')];function createListener(_0x53016d,_0x4c2d67){return function(_0x2d1d64){_0x4c2d67[_0xab79('0x3')](_0x53016d,_0x2d1d64);};}function removeListener(_0x167ab1,_0x2ab971){return function(){UserEvents[_0xab79('0x4')](_0x167ab1,_0x2ab971);};}exports['register']=function(_0x500e68){for(var _0xed8fa2=0x0,_0x5c7828=events[_0xab79('0x5')];_0xed8fa2<_0x5c7828;_0xed8fa2++){var _0x4aea9d=events[_0xed8fa2];var _0x4e0ca6=createListener(_0xab79('0x6')+_0x4aea9d,_0x500e68);UserEvents['on'](_0x4aea9d,_0x4e0ca6);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 72f1676..aad1c67 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5da9e1,_0xc580f8){var _0x21a139=function(_0x35b0cd){while(--_0x35b0cd){_0x5da9e1['push'](_0x5da9e1['shift']());}};_0x21a139(++_0xc580f8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x4ed009,_0x5e63b9){var _0x33e8e7=function(_0x12f297){while(--_0x12f297){_0x4ed009['push'](_0x4ed009['shift']());}};_0x33e8e7(++_0x5e63b9);}(_0xedd9,0xfc));var _0x9edd=function(_0x5b8330,_0x57059d){_0x5b8330=_0x5b8330-0x0;var _0x1ce363=_0xedd9[_0x5b8330];return _0x1ce363;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 97decb8..59f6169 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 _0xda84=['exports','INTEGER','sequelize'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xda84,0x1a6));var _0x4da8=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xda84[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x4da8('0x0'));module[_0x4da8('0x1')]={'penalty':{'type':Sequelize[_0x4da8('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x535f=['INTEGER','exports'];(function(_0xbcbe16,_0x13937d){var _0x499dce=function(_0x56efd0){while(--_0x56efd0){_0xbcbe16['push'](_0xbcbe16['shift']());}};_0x499dce(++_0x13937d);}(_0x535f,0x111));var _0xf535=function(_0xbf414,_0x150f82){_0xbf414=_0xbf414-0x0;var _0x388768=_0x535f[_0xbf414];return _0x388768;};'use strict';var Sequelize=require('sequelize');module[_0xf535('0x0')]={'penalty':{'type':Sequelize[_0xf535('0x1')],'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 191ff28..64bd9bc 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 _0x77ba=['../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x23ba58,_0x2b07c4){var _0x495f94=function(_0x5768a0){while(--_0x5768a0){_0x23ba58['push'](_0x23ba58['shift']());}};_0x495f94(++_0x2b07c4);}(_0x77ba,0xd6));var _0xa77b=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0x77ba[_0x2fee96];return _0x2e6ad1;};'use strict';var _=require(_0xa77b('0x0'));var util=require(_0xa77b('0x1'));var logger=require(_0xa77b('0x2'))('api');var moment=require(_0xa77b('0x3'));var BPromise=require('bluebird');var rp=require(_0xa77b('0x4'));var fs=require('fs');var path=require(_0xa77b('0x5'));var rimraf=require(_0xa77b('0x6'));var config=require(_0xa77b('0x7'));var attributes=require(_0xa77b('0x8'));module[_0xa77b('0x9')]=function(_0x1530c3,_0x18af16){return _0x1530c3[_0xa77b('0xa')](_0xa77b('0xb'),attributes,{'tableName':_0xa77b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde27=['./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x449ddd,_0x3f6cf2){var _0x2d0929=function(_0x193121){while(--_0x193121){_0x449ddd['push'](_0x449ddd['shift']());}};_0x2d0929(++_0x3f6cf2);}(_0xde27,0x89));var _0x7de2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xde27[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7de2('0x0'));var util=require('util');var logger=require(_0x7de2('0x1'))(_0x7de2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7de2('0x3'));var rimraf=require(_0x7de2('0x4'));var config=require(_0x7de2('0x5'));var attributes=require(_0x7de2('0x6'));module[_0x7de2('0x7')]=function(_0x4062c3,_0x4cba1a){return _0x4062c3[_0x7de2('0x8')](_0x7de2('0x9'),attributes,{'tableName':_0x7de2('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 401319a..d2c1683 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 _0x981c=['stringify','error','code','message','result','catch','lodash','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x981c,0x180));var _0xc981=function(_0x272c4c,_0x4c8127){_0x272c4c=_0x272c4c-0x0;var _0x11837a=_0x981c[_0x272c4c];return _0x11837a;};'use strict';var _=require(_0xc981('0x0'));var util=require('util');var moment=require(_0xc981('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc981('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc981('0x3'));var logger=require('../../config/logger')(_0xc981('0x4'));var config=require(_0xc981('0x5'));var jayson=require(_0xc981('0x6'));var client=jayson[_0xc981('0x7')][_0xc981('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b5c67,_0x3b4f94,_0x4fc9fe){return new BPromise(function(_0x51bc8e,_0x215fdd){return client[_0xc981('0x9')](_0x5b5c67,_0x4fc9fe)[_0xc981('0xa')](function(_0x524627){logger[_0xc981('0xb')](_0xc981('0xc'),_0x3b4f94,'request\x20sent');logger['debug'](_0xc981('0xd'),_0x3b4f94,_0xc981('0xe'),JSON[_0xc981('0xf')](_0x524627));if(_0x524627['error']){if(_0x524627[_0xc981('0x10')][_0xc981('0x11')]===0x1f4){logger[_0xc981('0x10')](_0xc981('0xc'),_0x3b4f94,_0x524627[_0xc981('0x10')]['message']);return _0x215fdd(_0x524627[_0xc981('0x10')][_0xc981('0x12')]);}logger[_0xc981('0x10')](_0xc981('0xc'),_0x3b4f94,_0x524627['error'][_0xc981('0x12')]);return _0x51bc8e(_0x524627['error']['message']);}else{logger['info'](_0xc981('0xc'),_0x3b4f94,'request\x20sent');_0x51bc8e(_0x524627[_0xc981('0x13')][_0xc981('0x12')]);}})[_0xc981('0x14')](function(_0x5f0857){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x3b4f94,_0x5f0857);_0x215fdd(_0x5f0857);});});} \ No newline at end of file +var _0x5d4d=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x5d4d,0x18d));var _0xd5d4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d4d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd5d4('0x0'));var util=require(_0xd5d4('0x1'));var moment=require(_0xd5d4('0x2'));var BPromise=require(_0xd5d4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd5d4('0x4'));var db=require(_0xd5d4('0x5'))['db'];var utils=require(_0xd5d4('0x6'));var logger=require(_0xd5d4('0x7'))(_0xd5d4('0x8'));var config=require(_0xd5d4('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x15fea2,_0x2feeba,_0x3ad02f){return new BPromise(function(_0x23ee5,_0x2cd92f){return client['request'](_0x15fea2,_0x3ad02f)[_0xd5d4('0xa')](function(_0x246998){logger[_0xd5d4('0xb')](_0xd5d4('0xc'),_0x2feeba,_0xd5d4('0xd'));logger[_0xd5d4('0xe')](_0xd5d4('0xf'),_0x2feeba,'request\x20sent',JSON[_0xd5d4('0x10')](_0x246998));if(_0x246998[_0xd5d4('0x11')]){if(_0x246998[_0xd5d4('0x11')][_0xd5d4('0x12')]===0x1f4){logger[_0xd5d4('0x11')](_0xd5d4('0xc'),_0x2feeba,_0x246998['error'][_0xd5d4('0x13')]);return _0x2cd92f(_0x246998[_0xd5d4('0x11')][_0xd5d4('0x13')]);}logger[_0xd5d4('0x11')](_0xd5d4('0xc'),_0x2feeba,_0x246998['error'][_0xd5d4('0x13')]);return _0x23ee5(_0x246998[_0xd5d4('0x11')][_0xd5d4('0x13')]);}else{logger[_0xd5d4('0xb')](_0xd5d4('0xc'),_0x2feeba,_0xd5d4('0xd'));_0x23ee5(_0x246998[_0xd5d4('0x14')][_0xd5d4('0x13')]);}})['catch'](function(_0x472328){logger[_0xd5d4('0x11')](_0xd5d4('0xc'),_0x2feeba,_0x472328);_0x2cd92f(_0x472328);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 2a10ce6..bb6defe 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(_0x32ca78,_0x1f1451){var _0x3cadda=function(_0x320463){while(--_0x320463){_0x32ca78['push'](_0x32ca78['shift']());}};_0x3cadda(++_0x1f1451);}(_0x70e0,0x17b));var _0x070e=function(_0x49be61,_0x1f068a){_0x49be61=_0x49be61-0x0;var _0x4ab56b=_0x70e0[_0x49be61];return _0x4ab56b;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index eb47d49..82dd2fd 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 _0x19e6=['exports','INTEGER','STRING','sequelize'];(function(_0xf7ac63,_0xf52456){var _0x25b50d=function(_0x2aaa0a){while(--_0x2aaa0a){_0xf7ac63['push'](_0xf7ac63['shift']());}};_0x25b50d(++_0xf52456);}(_0x19e6,0x103));var _0x619e=function(_0x5ebc4a,_0x3a4b2a){_0x5ebc4a=_0x5ebc4a-0x0;var _0x198a4a=_0x19e6[_0x5ebc4a];return _0x198a4a;};'use strict';var Sequelize=require(_0x619e('0x0'));module[_0x619e('0x1')]={'penalty':{'type':Sequelize[_0x619e('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x619e('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x619e('0x3')]}}; \ No newline at end of file +var _0x8872=['INTEGER','sequelize','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8872,0x142));var _0x2887=function(_0x3441b9,_0x1754ee){_0x3441b9=_0x3441b9-0x0;var _0x4defbc=_0x8872[_0x3441b9];return _0x4defbc;};'use strict';var Sequelize=require(_0x2887('0x0'));module[_0x2887('0x1')]={'penalty':{'type':Sequelize[_0x2887('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2887('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 28f9141..d483cac 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 _0x0389=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','define','lodash'];(function(_0x125af9,_0x41ed83){var _0x1a8dd2=function(_0x4028c7){while(--_0x4028c7){_0x125af9['push'](_0x125af9['shift']());}};_0x1a8dd2(++_0x41ed83);}(_0x0389,0x15f));var _0x9038=function(_0x40aaa4,_0x3b22f4){_0x40aaa4=_0x40aaa4-0x0;var _0x4e21e5=_0x0389[_0x40aaa4];return _0x4e21e5;};'use strict';var _=require(_0x9038('0x0'));var util=require(_0x9038('0x1'));var logger=require(_0x9038('0x2'))('api');var moment=require(_0x9038('0x3'));var BPromise=require(_0x9038('0x4'));var rp=require(_0x9038('0x5'));var fs=require('fs');var path=require(_0x9038('0x6'));var rimraf=require(_0x9038('0x7'));var config=require(_0x9038('0x8'));var attributes=require(_0x9038('0x9'));module['exports']=function(_0x2b4fd1,_0x71f02e){return _0x2b4fd1[_0x9038('0xa')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c6a=['../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x491247,_0x2a98a0){var _0x52d68d=function(_0x17d800){while(--_0x17d800){_0x491247['push'](_0x491247['shift']());}};_0x52d68d(++_0x2a98a0);}(_0x6c6a,0xe2));var _0xa6c6=function(_0x4336af,_0xd49818){_0x4336af=_0x4336af-0x0;var _0x213e5d=_0x6c6a[_0x4336af];return _0x213e5d;};'use strict';var _=require(_0xa6c6('0x0'));var util=require(_0xa6c6('0x1'));var logger=require(_0xa6c6('0x2'))('api');var moment=require(_0xa6c6('0x3'));var BPromise=require(_0xa6c6('0x4'));var rp=require(_0xa6c6('0x5'));var fs=require('fs');var path=require(_0xa6c6('0x6'));var rimraf=require(_0xa6c6('0x7'));var config=require(_0xa6c6('0x8'));var attributes=require(_0xa6c6('0x9'));module[_0xa6c6('0xa')]=function(_0x3c0a45,_0x31fba3){return _0x3c0a45[_0xa6c6('0xb')](_0xa6c6('0xc'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 0768415..77682fb 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 _0xb6f9=['../../config/environment','http','request','info','request\x20sent','error','UserFaxQueue,\x20%s,\x20%s','message','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x1ca90d,_0x176266){var _0x1eb090=function(_0x504575){while(--_0x504575){_0x1ca90d['push'](_0x1ca90d['shift']());}};_0x1eb090(++_0x176266);}(_0xb6f9,0x97));var _0x9b6f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb6f9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9b6f('0x0'));var util=require('util');var moment=require(_0x9b6f('0x1'));var BPromise=require('bluebird');var rs=require(_0x9b6f('0x2'));var fs=require('fs');var Redis=require(_0x9b6f('0x3'));var db=require(_0x9b6f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9b6f('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9b6f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5bba95,_0x2369b9,_0x20b933){return new BPromise(function(_0x24522c,_0x1d1078){return client[_0x9b6f('0x7')](_0x5bba95,_0x20b933)['then'](function(_0x36eb86){logger[_0x9b6f('0x8')]('UserFaxQueue,\x20%s,\x20%s',_0x2369b9,_0x9b6f('0x9'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x2369b9,_0x9b6f('0x9'),JSON['stringify'](_0x36eb86));if(_0x36eb86['error']){if(_0x36eb86[_0x9b6f('0xa')]['code']===0x1f4){logger[_0x9b6f('0xa')](_0x9b6f('0xb'),_0x2369b9,_0x36eb86[_0x9b6f('0xa')][_0x9b6f('0xc')]);return _0x1d1078(_0x36eb86['error'][_0x9b6f('0xc')]);}logger[_0x9b6f('0xa')](_0x9b6f('0xb'),_0x2369b9,_0x36eb86['error']['message']);return _0x24522c(_0x36eb86[_0x9b6f('0xa')][_0x9b6f('0xc')]);}else{logger[_0x9b6f('0x8')](_0x9b6f('0xb'),_0x2369b9,_0x9b6f('0x9'));_0x24522c(_0x36eb86['result'][_0x9b6f('0xc')]);}})['catch'](function(_0x24a182){logger[_0x9b6f('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x2369b9,_0x24a182);_0x1d1078(_0x24a182);});});} \ No newline at end of file +var _0xc006=['../../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','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x31cf2f,_0x1dcb38){var _0x494a66=function(_0x6ba3ed){while(--_0x6ba3ed){_0x31cf2f['push'](_0x31cf2f['shift']());}};_0x494a66(++_0x1dcb38);}(_0xc006,0x124));var _0x6c00=function(_0x39c684,_0x1e0093){_0x39c684=_0x39c684-0x0;var _0x3da800=_0xc006[_0x39c684];return _0x3da800;};'use strict';var _=require('lodash');var util=require(_0x6c00('0x0'));var moment=require(_0x6c00('0x1'));var BPromise=require(_0x6c00('0x2'));var rs=require(_0x6c00('0x3'));var fs=require('fs');var Redis=require(_0x6c00('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6c00('0x5'))(_0x6c00('0x6'));var config=require(_0x6c00('0x7'));var jayson=require(_0x6c00('0x8'));var client=jayson[_0x6c00('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d8223,_0x3f2ab7,_0x3690f9){return new BPromise(function(_0x2c40d0,_0x4825d5){return client[_0x6c00('0xa')](_0x4d8223,_0x3690f9)[_0x6c00('0xb')](function(_0x542e98){logger[_0x6c00('0xc')](_0x6c00('0xd'),_0x3f2ab7,_0x6c00('0xe'));logger[_0x6c00('0xf')](_0x6c00('0x10'),_0x3f2ab7,_0x6c00('0xe'),JSON[_0x6c00('0x11')](_0x542e98));if(_0x542e98[_0x6c00('0x12')]){if(_0x542e98[_0x6c00('0x12')][_0x6c00('0x13')]===0x1f4){logger[_0x6c00('0x12')](_0x6c00('0xd'),_0x3f2ab7,_0x542e98['error'][_0x6c00('0x14')]);return _0x4825d5(_0x542e98[_0x6c00('0x12')][_0x6c00('0x14')]);}logger[_0x6c00('0x12')](_0x6c00('0xd'),_0x3f2ab7,_0x542e98[_0x6c00('0x12')][_0x6c00('0x14')]);return _0x2c40d0(_0x542e98[_0x6c00('0x12')][_0x6c00('0x14')]);}else{logger[_0x6c00('0xc')](_0x6c00('0xd'),_0x3f2ab7,_0x6c00('0xe'));_0x2c40d0(_0x542e98[_0x6c00('0x15')][_0x6c00('0x14')]);}})[_0x6c00('0x16')](function(_0x44243f){logger[_0x6c00('0x12')](_0x6c00('0xd'),_0x3f2ab7,_0x44243f);_0x4825d5(_0x44243f);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 82ac7f1..e49e936 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x43fe43,_0x40a903){var _0x3f5541=function(_0x1e6254){while(--_0x1e6254){_0x43fe43['push'](_0x43fe43['shift']());}};_0x3f5541(++_0x40a903);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1e3f70,_0x56c036){var _0x48cf1b=function(_0x40e65e){while(--_0x40e65e){_0x1e3f70['push'](_0x1e3f70['shift']());}};_0x48cf1b(++_0x56c036);}(_0xedd9,0xfc));var _0x9edd=function(_0x3847f2,_0x5cc638){_0x3847f2=_0x3847f2-0x0;var _0x53a203=_0xedd9[_0x3847f2];return _0x53a203;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index e96e101..f9b1fde 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 _0xc83b=['exports','INTEGER','sequelize'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc83b,0xa4));var _0xbc83=function(_0x21e696,_0x4a67b0){_0x21e696=_0x21e696-0x0;var _0x2c5b3f=_0xc83b[_0x21e696];return _0x2c5b3f;};'use strict';var Sequelize=require(_0xbc83('0x0'));module[_0xbc83('0x1')]={'penalty':{'type':Sequelize[_0xbc83('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1323=['INTEGER','sequelize'];(function(_0x1ee797,_0x49f578){var _0xff9e2=function(_0x4dc9c0){while(--_0x4dc9c0){_0x1ee797['push'](_0x1ee797['shift']());}};_0xff9e2(++_0x49f578);}(_0x1323,0x1f3));var _0x3132=function(_0x5f1630,_0x3e263d){_0x5f1630=_0x5f1630-0x0;var _0x5e52c7=_0x1323[_0x5f1630];return _0x5e52c7;};'use strict';var Sequelize=require(_0x3132('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x3132('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 6dae75d..5f0036b 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 _0x55c1=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','lodash'];(function(_0x214213,_0x5c1ffa){var _0xdc6699=function(_0x32fef3){while(--_0x32fef3){_0x214213['push'](_0x214213['shift']());}};_0xdc6699(++_0x5c1ffa);}(_0x55c1,0x13e));var _0x155c=function(_0x484bf4,_0x2b975c){_0x484bf4=_0x484bf4-0x0;var _0x31c683=_0x55c1[_0x484bf4];return _0x31c683;};'use strict';var _=require(_0x155c('0x0'));var util=require(_0x155c('0x1'));var logger=require(_0x155c('0x2'))(_0x155c('0x3'));var moment=require(_0x155c('0x4'));var BPromise=require(_0x155c('0x5'));var rp=require(_0x155c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x155c('0x7'));var config=require(_0x155c('0x8'));var attributes=require('./userMailQueue.attributes');module[_0x155c('0x9')]=function(_0xe67ce3,_0x4da7d4){return _0xe67ce3[_0x155c('0xa')]('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd950=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','define','UserMailQueue','util'];(function(_0x5792a6,_0x44ae5c){var _0x596417=function(_0x4d6b56){while(--_0x4d6b56){_0x5792a6['push'](_0x5792a6['shift']());}};_0x596417(++_0x44ae5c);}(_0xd950,0x15f));var _0x0d95=function(_0x4930e6,_0x11254f){_0x4930e6=_0x4930e6-0x0;var _0xedc409=_0xd950[_0x4930e6];return _0xedc409;};'use strict';var _=require('lodash');var util=require(_0x0d95('0x0'));var logger=require(_0x0d95('0x1'))(_0x0d95('0x2'));var moment=require(_0x0d95('0x3'));var BPromise=require('bluebird');var rp=require(_0x0d95('0x4'));var fs=require('fs');var path=require(_0x0d95('0x5'));var rimraf=require(_0x0d95('0x6'));var config=require(_0x0d95('0x7'));var attributes=require(_0x0d95('0x8'));module['exports']=function(_0x149e8f,_0x39af8e){return _0x149e8f[_0x0d95('0x9')](_0x0d95('0xa'),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 880aeea..067ce00 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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3009f1,_0x5a5a55){var _0x4fe712=function(_0x33596e){while(--_0x33596e){_0x3009f1['push'](_0x3009f1['shift']());}};_0x4fe712(++_0x5a5a55);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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']('UserMailQueue,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7fbe=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x54dbb6,_0x265138){var _0x46b5c9=function(_0xe99b0a){while(--_0xe99b0a){_0x54dbb6['push'](_0x54dbb6['shift']());}};_0x46b5c9(++_0x265138);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0x7fbe[_0x581af1];return _0x54c22e;};'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);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 9d09329..28ca6d7 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 _0x751f=['isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./userNotification.controller'];(function(_0x48f371,_0x43069a){var _0x89d83c=function(_0x243d1c){while(--_0x243d1c){_0x48f371['push'](_0x48f371['shift']());}};_0x89d83c(++_0x43069a);}(_0x751f,0xea));var _0xf751=function(_0x179f58,_0x40f432){_0x179f58=_0x179f58-0x0;var _0x1b7e31=_0x751f[_0x179f58];return _0x1b7e31;};'use strict';var multer=require(_0xf751('0x0'));var util=require(_0xf751('0x1'));var path=require(_0xf751('0x2'));var timeout=require(_0xf751('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf751('0x4'));var auth=require(_0xf751('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf751('0x6'));var controller=require(_0xf751('0x7'));router['post']('/',auth[_0xf751('0x8')](),controller[_0xf751('0x9')]);module[_0xf751('0xa')]=router; \ No newline at end of file +var _0xa315=['../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x591cfd,_0x501204){var _0x4d0100=function(_0xb9ff0c){while(--_0xb9ff0c){_0x591cfd['push'](_0x591cfd['shift']());}};_0x4d0100(++_0x501204);}(_0xa315,0x1b3));var _0x5a31=function(_0x216428,_0x5d20ea){_0x216428=_0x216428-0x0;var _0x313dd4=_0xa315[_0x216428];return _0x313dd4;};'use strict';var multer=require(_0x5a31('0x0'));var util=require('util');var path=require(_0x5a31('0x1'));var timeout=require(_0x5a31('0x2'));var express=require(_0x5a31('0x3'));var router=express[_0x5a31('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5a31('0x5'));var interaction=require(_0x5a31('0x6'));var config=require(_0x5a31('0x7'));var controller=require(_0x5a31('0x8'));router[_0x5a31('0x9')]('/',auth[_0x5a31('0xa')](),controller[_0x5a31('0xb')]);module[_0x5a31('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index d9fdabd..ddef3b2 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 _0xefa2=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x450ab1,_0x56d4b6){var _0xb04952=function(_0x3f7014){while(--_0x3f7014){_0x450ab1['push'](_0x450ab1['shift']());}};_0xb04952(++_0x56d4b6);}(_0xefa2,0x1e9));var _0x2efa=function(_0x591375,_0x15ac6e){_0x591375=_0x591375-0x0;var _0x34df4f=_0xefa2[_0x591375];return _0x34df4f;};'use strict';var Sequelize=require(_0x2efa('0x0'));module[_0x2efa('0x1')]={'body':{'type':Sequelize[_0x2efa('0x2')]},'senderName':{'type':Sequelize[_0x2efa('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x2efa('0x4')]}}; \ No newline at end of file +var _0x2e24=['exports','TEXT','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2e24,0x1e2));var _0x42e2=function(_0x53faf9,_0x488c31){_0x53faf9=_0x53faf9-0x0;var _0x1dba46=_0x2e24[_0x53faf9];return _0x1dba46;};'use strict';var Sequelize=require(_0x42e2('0x0'));module[_0x42e2('0x1')]={'body':{'type':Sequelize[_0x42e2('0x2')]},'senderName':{'type':Sequelize['STRING']},'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 d79ab1c..a441d5f 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 _0xa3c7=['sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','recipients','Invalid\x20\x27recipients\x27\x20object','smsqueue','voicequeue','whatsappqueue','team','user','includes','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','recipientsId','sortBy','join','sequelize','UserNotification','create','forEach','emit','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','html','catch','startCase','model','toLowerCase','User','union','queue','replace','Queue','ids','push','all','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send'];(function(_0x96fbfd,_0x2c5cbf){var _0x53f6d1=function(_0x5f2040){while(--_0x5f2040){_0x96fbfd['push'](_0x96fbfd['shift']());}};_0x53f6d1(++_0x2c5cbf);}(_0xa3c7,0xef));var _0x7a3c=function(_0x5e89d8,_0x30a21a){_0x5e89d8=_0x5e89d8-0x0;var _0x5c1153=_0xa3c7[_0x5e89d8];return _0x5c1153;};'use strict';var emlformat=require(_0x7a3c('0x0'));var rimraf=require(_0x7a3c('0x1'));var zipdir=require(_0x7a3c('0x2'));var jsonpatch=require(_0x7a3c('0x3'));var rp=require('request-promise');var moment=require(_0x7a3c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7a3c('0x5'));var sox=require(_0x7a3c('0x6'));var csv=require(_0x7a3c('0x7'));var ejs=require(_0x7a3c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7a3c('0x9'));var crypto=require('crypto');var jsforce=require(_0x7a3c('0xa'));var deskjs=require(_0x7a3c('0xb'));var toCsv=require(_0x7a3c('0x7'));var querystring=require(_0x7a3c('0xc'));var Papa=require('papaparse');var Redis=require(_0x7a3c('0xd'));var authService=require(_0x7a3c('0xe'));var qs=require(_0x7a3c('0xf'));var as=require(_0x7a3c('0x10'));var hardwareService=require(_0x7a3c('0x11'));var logger=require(_0x7a3c('0x12'))(_0x7a3c('0x13'));var utils=require('../../config/utils');var config=require(_0x7a3c('0x14'));var licenseUtil=require(_0x7a3c('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x7a3c('0x16')](config[_0x7a3c('0x17')],{'host':_0x7a3c('0x18'),'port':0x18eb});var socket=require(_0x7a3c('0x19'))(new Redis(config[_0x7a3c('0x17')]));require('./userNotification.socket')[_0x7a3c('0x1a')](socket);function respondWithStatusCode(_0x1f62c5,_0x1090ed){_0x1090ed=_0x1090ed||0xcc;return function(_0x42050f){if(_0x42050f){return _0x1f62c5[_0x7a3c('0x1b')](_0x1090ed);}return _0x1f62c5[_0x7a3c('0x1c')](_0x1090ed)[_0x7a3c('0x1d')]();};}function respondWithResult(_0x576d39,_0x3c36ab){_0x3c36ab=_0x3c36ab||0xc8;return function(_0xcf9932){if(_0xcf9932){return _0x576d39[_0x7a3c('0x1c')](_0x3c36ab)[_0x7a3c('0x1e')](_0xcf9932);}};}function respondWithFilteredResult(_0x347e4c,_0x389217){return function(_0x414ebd){if(_0x414ebd){var _0x445198=typeof _0x389217['offset']==='undefined'&&typeof _0x389217[_0x7a3c('0x1f')]===_0x7a3c('0x20');var _0x101c26=_0x414ebd[_0x7a3c('0x21')];var _0x12f1c5=_0x445198?0x0:_0x389217['offset'];var _0x40517a=_0x445198?_0x414ebd[_0x7a3c('0x21')]:_0x389217[_0x7a3c('0x22')]+_0x389217[_0x7a3c('0x1f')];var _0x40bb25;if(_0x40517a>=_0x101c26){_0x40517a=_0x101c26;_0x40bb25=0xc8;}else{_0x40bb25=0xce;}_0x347e4c[_0x7a3c('0x1c')](_0x40bb25);return _0x347e4c[_0x7a3c('0x23')](_0x7a3c('0x24'),_0x12f1c5+'-'+_0x40517a+'/'+_0x101c26)[_0x7a3c('0x1e')](_0x414ebd);}return null;};}function patchUpdates(_0x40dd98){return function(_0x352a6b){try{jsonpatch[_0x7a3c('0x25')](_0x352a6b,_0x40dd98,!![]);}catch(_0x1b596c){return BPromise[_0x7a3c('0x26')](_0x1b596c);}return _0x352a6b[_0x7a3c('0x27')]();};}function saveUpdates(_0x1bb9a8,_0x3cf0a6){return function(_0x102730){if(_0x102730){return _0x102730['update'](_0x1bb9a8)[_0x7a3c('0x28')](function(_0x235dd2){return _0x235dd2;});}return null;};}function removeEntity(_0x71534b,_0x35f30c){return function(_0x258fa3){if(_0x258fa3){return _0x258fa3[_0x7a3c('0x29')]()[_0x7a3c('0x28')](function(){_0x71534b[_0x7a3c('0x1c')](0xcc)[_0x7a3c('0x1d')]();});}};}function handleEntityNotFound(_0x417c4f,_0x50b3a7){return function(_0x127aff){if(!_0x127aff){_0x417c4f[_0x7a3c('0x1b')](0x194);}return _0x127aff;};}function handleError(_0x137739,_0x2ebe68){_0x2ebe68=_0x2ebe68||0x1f4;return function(_0x29c1c8){logger[_0x7a3c('0x2a')](_0x29c1c8[_0x7a3c('0x2b')]);if(_0x29c1c8[_0x7a3c('0x2c')]){delete _0x29c1c8['name'];}_0x137739[_0x7a3c('0x1c')](_0x2ebe68)[_0x7a3c('0x2d')](_0x29c1c8);};}exports[_0x7a3c('0x2e')]=function(_0x3d7bcf,_0x188ec0,_0x2cb580){if(!_0x3d7bcf[_0x7a3c('0x2f')][_0x7a3c('0x30')](_0x7a3c('0x31'))&&!_0x3d7bcf[_0x7a3c('0x2f')][_0x7a3c('0x30')](_0x7a3c('0x32'))){throw new db[(_0x7a3c('0x33'))][(_0x7a3c('0x34'))](_0x7a3c('0x35'));}else{if(_0x3d7bcf['body'][_0x7a3c('0x30')](_0x7a3c('0x32'))&&!_0x3d7bcf[_0x7a3c('0x2f')][_0x7a3c('0x30')](_0x7a3c('0x36'))){throw new db[(_0x7a3c('0x33'))][(_0x7a3c('0x34'))](_0x7a3c('0x37'));}if(!_0x3d7bcf[_0x7a3c('0x2f')][_0x7a3c('0x30')]('recipients')){throw new db[(_0x7a3c('0x33'))][(_0x7a3c('0x34'))](_0x7a3c('0x38'));}else{try{var _0x1344b2=JSON['parse'](_0x3d7bcf['body'][_0x7a3c('0x39')]);}catch(_0x27adc7){logger[_0x7a3c('0x2a')](_0x27adc7);throw new db['Sequelize'][(_0x7a3c('0x34'))](_0x7a3c('0x3a'));}var _0x5e59b6=['chatqueue','faxqueue','mailqueue','openchannelqueue',_0x7a3c('0x3b'),_0x7a3c('0x3c'),_0x7a3c('0x3d'),_0x7a3c('0x3e'),_0x7a3c('0x3f')];if(_['some'](_0x1344b2,function(_0x1b5767){return!_[_0x7a3c('0x40')](_0x5e59b6,_0x1b5767['model']['toLowerCase']());})){throw new db[(_0x7a3c('0x33'))]['ValidationError'](_0x7a3c('0x41'));}}}var _0x3e8a11={};_0x3e8a11['senderName']=_0x3d7bcf[_0x7a3c('0x2f')][_0x7a3c('0x30')](_0x7a3c('0x42'))?_0x3d7bcf[_0x7a3c('0x2f')]['senderName']:_0x3d7bcf['user'][_0x7a3c('0x43')];_0x3e8a11['recipientsDescription']=_['isEmpty'](_0x3d7bcf[_0x7a3c('0x2f')]['recipientsDescription'])?null:_0x3d7bcf[_0x7a3c('0x2f')][_0x7a3c('0x44')];_0x3e8a11['beep']=_0x3d7bcf['body'][_0x7a3c('0x45')]||![];_0x3e8a11['SenderId']=_0x3d7bcf[_0x7a3c('0x3f')]['id'];return getContent(_0x3d7bcf[_0x7a3c('0x2f')])[_0x7a3c('0x28')](function(_0x2651ee){_0x3e8a11[_0x7a3c('0x2f')]=_0x2651ee;return getRecipients(_0x1344b2);})[_0x7a3c('0x28')](function(_0x380f80){_0x3e8a11[_0x7a3c('0x46')]=_[_0x7a3c('0x47')](_0x380f80)[_0x7a3c('0x48')](',');return db[_0x7a3c('0x49')]['transaction'](function(_0x48048e){return db[_0x7a3c('0x4a')][_0x7a3c('0x4b')](_0x3e8a11,{'raw':!![],'transaction':_0x48048e})[_0x7a3c('0x28')](function(_0x4e9f53){var _0x4dda9e={'sender':_0x3e8a11[_0x7a3c('0x42')],'description':_0x3e8a11[_0x7a3c('0x44')],'content':_0x3e8a11[_0x7a3c('0x2f')],'beep':_0x3e8a11[_0x7a3c('0x45')]};_0x380f80[_0x7a3c('0x4c')](function(_0x5a39ad){_0x4dda9e['recipient']=_0x5a39ad;socket[_0x7a3c('0x4d')]('userNotification:send',_0x4dda9e);});return _0x4e9f53;});});})['then'](respondWithResult(_0x188ec0,0xc9))['catch'](handleError(_0x188ec0,null));};function getContent(_0x526340){return new BPromise(function(_0x225f52,_0x4e2a19){if(_0x526340[_0x7a3c('0x31')]){_0x225f52(_0x526340[_0x7a3c('0x31')]);return;}return db[_0x7a3c('0x4e')][_0x7a3c('0x4f')]({'attributes':['html'],'where':{'id':_0x526340[_0x7a3c('0x32')]},'raw':!![]})[_0x7a3c('0x28')](function(_0x32f8c1){if(!_0x32f8c1)throw new db[(_0x7a3c('0x33'))][(_0x7a3c('0x34'))](_0x7a3c('0x50'));var _0x28fae6=Mustache['render'](_0x32f8c1[_0x7a3c('0x51')],_0x526340[_0x7a3c('0x36')]);_0x225f52(_0x28fae6);})[_0x7a3c('0x52')](function(_0x35278e){_0x4e2a19(_0x35278e);});});}function getRecipients(_0x2a812e){return new BPromise(function(_0x30709b,_0x71aff3){var _0x2d1453=[];var _0x378d4e=[];_0x2a812e['forEach'](function(_0x524849){var _0x59276d=_[_0x7a3c('0x53')](_0x524849[_0x7a3c('0x54')][_0x7a3c('0x55')]());if(_0x59276d===_0x7a3c('0x56')){_0x2d1453=_[_0x7a3c('0x57')](_0x2d1453,_0x524849['ids']);}else{if(_[_0x7a3c('0x40')](_0x59276d,_0x7a3c('0x58')))_0x59276d=_0x59276d[_0x7a3c('0x59')](_0x7a3c('0x58'),_0x7a3c('0x5a'));_0x524849[_0x7a3c('0x5b')][_0x7a3c('0x4c')](function(_0x2c6041){_0x378d4e[_0x7a3c('0x5c')](getAgents(_0x59276d,_0x2c6041));});}});return BPromise[_0x7a3c('0x5d')](_0x378d4e)[_0x7a3c('0x28')](function(_0x1f0922){_0x2d1453=_[_0x7a3c('0x57')](_0x2d1453,_['flatten'](_0x1f0922));_0x30709b(_0x2d1453);})[_0x7a3c('0x52')](function(_0xbce7d1){_0x71aff3(_0xbce7d1);});});}function getAgents(_0x30dc08,_0x28a373){return new BPromise(function(_0x4a11a2,_0x1d7e18){return db[_0x30dc08]['findOne']({'where':{'id':_0x28a373}})['then'](function(_0x2e2e67){return _0x2e2e67[_0x7a3c('0x5e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x25f193){var _0x4dfdb9=_['map'](_0x25f193,'id');_0x4a11a2(_0x4dfdb9);});})[_0x7a3c('0x52')](function(_0x1455cf){_0x1d7e18(_0x1455cf);});});} \ No newline at end of file +var _0xd136=['sendUserNotification','body','hasOwnProperty','text','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','SenderId','recipientsId','join','sequelize','transaction','UserNotification','beep','forEach','recipient','emit','userNotification:send','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','model','User','union','queue','replace','Queue','ids','push','all','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./userNotification.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','error','stack','name'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xd136,0x9c));var _0x6d13=function(_0x5684a0,_0x54c215){_0x5684a0=_0x5684a0-0x0;var _0x30858a=_0xd136[_0x5684a0];return _0x30858a;};'use strict';var emlformat=require(_0x6d13('0x0'));var rimraf=require(_0x6d13('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d13('0x2'));var rp=require(_0x6d13('0x3'));var moment=require('moment');var BPromise=require(_0x6d13('0x4'));var Mustache=require(_0x6d13('0x5'));var util=require(_0x6d13('0x6'));var path=require(_0x6d13('0x7'));var sox=require('sox');var csv=require(_0x6d13('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d13('0x9'));var _=require(_0x6d13('0xa'));var squel=require(_0x6d13('0xb'));var crypto=require(_0x6d13('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6d13('0xd'));var toCsv=require(_0x6d13('0x8'));var querystring=require('querystring');var Papa=require(_0x6d13('0xe'));var Redis=require(_0x6d13('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6d13('0x10'));var as=require(_0x6d13('0x11'));var hardwareService=require(_0x6d13('0x12'));var logger=require(_0x6d13('0x13'))(_0x6d13('0x14'));var utils=require(_0x6d13('0x15'));var config=require(_0x6d13('0x16'));var licenseUtil=require(_0x6d13('0x17'));var db=require(_0x6d13('0x18'))['db'];config['redis']=_[_0x6d13('0x19')](config[_0x6d13('0x1a')],{'host':_0x6d13('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6d13('0x1c'))[_0x6d13('0x1d')](socket);function respondWithStatusCode(_0x4bb0a8,_0x569669){_0x569669=_0x569669||0xcc;return function(_0x194841){if(_0x194841){return _0x4bb0a8[_0x6d13('0x1e')](_0x569669);}return _0x4bb0a8[_0x6d13('0x1f')](_0x569669)[_0x6d13('0x20')]();};}function respondWithResult(_0x436e2,_0x1c560b){_0x1c560b=_0x1c560b||0xc8;return function(_0x574840){if(_0x574840){return _0x436e2['status'](_0x1c560b)['json'](_0x574840);}};}function respondWithFilteredResult(_0x22ef4f,_0x50b8d0){return function(_0x2fd9c9){if(_0x2fd9c9){var _0x3aa273=typeof _0x50b8d0[_0x6d13('0x21')]===_0x6d13('0x22')&&typeof _0x50b8d0[_0x6d13('0x23')]===_0x6d13('0x22');var _0x4a38f3=_0x2fd9c9['count'];var _0x4aff53=_0x3aa273?0x0:_0x50b8d0[_0x6d13('0x21')];var _0x11bc09=_0x3aa273?_0x2fd9c9[_0x6d13('0x24')]:_0x50b8d0[_0x6d13('0x21')]+_0x50b8d0[_0x6d13('0x23')];var _0x580c75;if(_0x11bc09>=_0x4a38f3){_0x11bc09=_0x4a38f3;_0x580c75=0xc8;}else{_0x580c75=0xce;}_0x22ef4f[_0x6d13('0x1f')](_0x580c75);return _0x22ef4f[_0x6d13('0x25')](_0x6d13('0x26'),_0x4aff53+'-'+_0x11bc09+'/'+_0x4a38f3)[_0x6d13('0x27')](_0x2fd9c9);}return null;};}function patchUpdates(_0x57a27a){return function(_0x9627bc){try{jsonpatch[_0x6d13('0x28')](_0x9627bc,_0x57a27a,!![]);}catch(_0x5d04a2){return BPromise[_0x6d13('0x29')](_0x5d04a2);}return _0x9627bc[_0x6d13('0x2a')]();};}function saveUpdates(_0x4c31d9,_0x304d26){return function(_0x4c83b8){if(_0x4c83b8){return _0x4c83b8['update'](_0x4c31d9)['then'](function(_0x13900d){return _0x13900d;});}return null;};}function removeEntity(_0x4b1c2c,_0x16a5c4){return function(_0x40aefe){if(_0x40aefe){return _0x40aefe[_0x6d13('0x2b')]()[_0x6d13('0x2c')](function(){_0x4b1c2c[_0x6d13('0x1f')](0xcc)[_0x6d13('0x20')]();});}};}function handleEntityNotFound(_0x5a780a,_0x48bf29){return function(_0x4fc1f1){if(!_0x4fc1f1){_0x5a780a[_0x6d13('0x1e')](0x194);}return _0x4fc1f1;};}function handleError(_0x48ec83,_0x46e92b){_0x46e92b=_0x46e92b||0x1f4;return function(_0x5a8970){logger[_0x6d13('0x2d')](_0x5a8970[_0x6d13('0x2e')]);if(_0x5a8970['name']){delete _0x5a8970[_0x6d13('0x2f')];}_0x48ec83[_0x6d13('0x1f')](_0x46e92b)['send'](_0x5a8970);};}exports[_0x6d13('0x30')]=function(_0x241559,_0x38a3c0,_0xde425a){if(!_0x241559[_0x6d13('0x31')][_0x6d13('0x32')](_0x6d13('0x33'))&&!_0x241559[_0x6d13('0x31')][_0x6d13('0x32')]('TemplateId')){throw new db[(_0x6d13('0x34'))][(_0x6d13('0x35'))](_0x6d13('0x36'));}else{if(_0x241559[_0x6d13('0x31')][_0x6d13('0x32')](_0x6d13('0x37'))&&!_0x241559[_0x6d13('0x31')][_0x6d13('0x32')](_0x6d13('0x38'))){throw new db[(_0x6d13('0x34'))][(_0x6d13('0x35'))](_0x6d13('0x39'));}if(!_0x241559[_0x6d13('0x31')][_0x6d13('0x32')](_0x6d13('0x3a'))){throw new db[(_0x6d13('0x34'))]['ValidationError'](_0x6d13('0x3b'));}else{try{var _0x2848fa=JSON[_0x6d13('0x3c')](_0x241559[_0x6d13('0x31')][_0x6d13('0x3a')]);}catch(_0x55133b){logger[_0x6d13('0x2d')](_0x55133b);throw new db['Sequelize'][(_0x6d13('0x35'))](_0x6d13('0x3d'));}var _0x3241ca=[_0x6d13('0x3e'),_0x6d13('0x3f'),'mailqueue',_0x6d13('0x40'),_0x6d13('0x41'),_0x6d13('0x42'),_0x6d13('0x43'),_0x6d13('0x44'),_0x6d13('0x45')];if(_[_0x6d13('0x46')](_0x2848fa,function(_0x44a0dd){return!_[_0x6d13('0x47')](_0x3241ca,_0x44a0dd['model']['toLowerCase']());})){throw new db[(_0x6d13('0x34'))][(_0x6d13('0x35'))](_0x6d13('0x48'));}}}var _0x59a0b8={};_0x59a0b8['senderName']=_0x241559[_0x6d13('0x31')][_0x6d13('0x32')](_0x6d13('0x49'))?_0x241559['body'][_0x6d13('0x49')]:_0x241559[_0x6d13('0x45')]['fullname'];_0x59a0b8[_0x6d13('0x4a')]=_[_0x6d13('0x4b')](_0x241559[_0x6d13('0x31')][_0x6d13('0x4a')])?null:_0x241559['body'][_0x6d13('0x4a')];_0x59a0b8['beep']=_0x241559[_0x6d13('0x31')]['beep']||![];_0x59a0b8[_0x6d13('0x4c')]=_0x241559['user']['id'];return getContent(_0x241559[_0x6d13('0x31')])[_0x6d13('0x2c')](function(_0x51beef){_0x59a0b8[_0x6d13('0x31')]=_0x51beef;return getRecipients(_0x2848fa);})[_0x6d13('0x2c')](function(_0x12b5e9){_0x59a0b8[_0x6d13('0x4d')]=_['sortBy'](_0x12b5e9)[_0x6d13('0x4e')](',');return db[_0x6d13('0x4f')][_0x6d13('0x50')](function(_0x5588b1){return db[_0x6d13('0x51')]['create'](_0x59a0b8,{'raw':!![],'transaction':_0x5588b1})[_0x6d13('0x2c')](function(_0x4e7fb0){var _0x357200={'sender':_0x59a0b8['senderName'],'description':_0x59a0b8[_0x6d13('0x4a')],'content':_0x59a0b8[_0x6d13('0x31')],'beep':_0x59a0b8[_0x6d13('0x52')]};_0x12b5e9[_0x6d13('0x53')](function(_0x4e94a9){_0x357200[_0x6d13('0x54')]=_0x4e94a9;socket[_0x6d13('0x55')](_0x6d13('0x56'),_0x357200);});return _0x4e7fb0;});});})[_0x6d13('0x2c')](respondWithResult(_0x38a3c0,0xc9))[_0x6d13('0x57')](handleError(_0x38a3c0,null));};function getContent(_0x2b5576){return new BPromise(function(_0x13592b,_0xaf31ad){if(_0x2b5576[_0x6d13('0x33')]){_0x13592b(_0x2b5576[_0x6d13('0x33')]);return;}return db['Template'][_0x6d13('0x58')]({'attributes':[_0x6d13('0x59')],'where':{'id':_0x2b5576[_0x6d13('0x37')]},'raw':!![]})[_0x6d13('0x2c')](function(_0x301210){if(!_0x301210)throw new db[(_0x6d13('0x34'))][(_0x6d13('0x35'))](_0x6d13('0x5a'));var _0x47deac=Mustache[_0x6d13('0x5b')](_0x301210[_0x6d13('0x59')],_0x2b5576['view']);_0x13592b(_0x47deac);})[_0x6d13('0x57')](function(_0x2a5302){_0xaf31ad(_0x2a5302);});});}function getRecipients(_0x416dff){return new BPromise(function(_0x57c6b3,_0x3a6aa6){var _0x31bab9=[];var _0x2bba78=[];_0x416dff[_0x6d13('0x53')](function(_0x1bbd19){var _0x48cc18=_[_0x6d13('0x5c')](_0x1bbd19[_0x6d13('0x5d')]['toLowerCase']());if(_0x48cc18===_0x6d13('0x5e')){_0x31bab9=_[_0x6d13('0x5f')](_0x31bab9,_0x1bbd19['ids']);}else{if(_[_0x6d13('0x47')](_0x48cc18,_0x6d13('0x60')))_0x48cc18=_0x48cc18[_0x6d13('0x61')]('queue',_0x6d13('0x62'));_0x1bbd19[_0x6d13('0x63')][_0x6d13('0x53')](function(_0x53bf16){_0x2bba78[_0x6d13('0x64')](getAgents(_0x48cc18,_0x53bf16));});}});return BPromise[_0x6d13('0x65')](_0x2bba78)[_0x6d13('0x2c')](function(_0x2d1e86){_0x31bab9=_['union'](_0x31bab9,_['flatten'](_0x2d1e86));_0x57c6b3(_0x31bab9);})[_0x6d13('0x57')](function(_0x5c6cf6){_0x3a6aa6(_0x5c6cf6);});});}function getAgents(_0x26fd32,_0x1a157e){return new BPromise(function(_0x48b848,_0x108c15){return db[_0x26fd32]['findOne']({'where':{'id':_0x1a157e}})['then'](function(_0x310f51){return _0x310f51['getAgents']({'attributes':['id'],'raw':!![]})[_0x6d13('0x2c')](function(_0x26d634){var _0x42b8c2=_['map'](_0x26d634,'id');_0x48b848(_0x42b8c2);});})[_0x6d13('0x57')](function(_0x1000be){_0x108c15(_0x1000be);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 932582e..562bf18 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 _0x0a52=['save','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0a52,0x16e));var _0x20a5=function(_0x23656e,_0x12b07e){_0x23656e=_0x23656e-0x0;var _0x30a11a=_0x0a52[_0x23656e];return _0x30a11a;};'use strict';var EventEmitter=require(_0x20a5('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x20a5('0x1')](0x0);var events={'afterCreate':_0x20a5('0x2'),'afterUpdate':'update','afterDestroy':_0x20a5('0x3')};function emitEvent(_0x577b8d){return function(_0x4f67aa,_0x88baa3,_0x4d9a0a){UserNotificationEvents[_0x20a5('0x4')](_0x577b8d+':'+_0x4f67aa['id'],_0x4f67aa);UserNotificationEvents[_0x20a5('0x4')](_0x577b8d,_0x4f67aa);_0x4d9a0a(null);};}for(var e in events){if(events[_0x20a5('0x5')](e)){var event=events[e];UserNotification[_0x20a5('0x6')](e,emitEvent(event));}}module[_0x20a5('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0xa191=['hasOwnProperty','hook','exports','UserNotification','save','update','remove'];(function(_0x222ec5,_0x1a12bd){var _0x462a6c=function(_0x47ba1d){while(--_0x47ba1d){_0x222ec5['push'](_0x222ec5['shift']());}};_0x462a6c(++_0x1a12bd);}(_0xa191,0x17d));var _0x1a19=function(_0x45a2c5,_0x22e07c){_0x45a2c5=_0x45a2c5-0x0;var _0x10157b=_0xa191[_0x45a2c5];return _0x10157b;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db'][_0x1a19('0x0')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1a19('0x1'),'afterUpdate':_0x1a19('0x2'),'afterDestroy':_0x1a19('0x3')};function emitEvent(_0x276daf){return function(_0x3754b9,_0x1bcd45,_0x5e06f9){UserNotificationEvents['emit'](_0x276daf+':'+_0x3754b9['id'],_0x3754b9);UserNotificationEvents['emit'](_0x276daf,_0x3754b9);_0x5e06f9(null);};}for(var e in events){if(events[_0x1a19('0x4')](e)){var event=events[e];UserNotification[_0x1a19('0x5')](e,emitEvent(event));}}module[_0x1a19('0x6')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 813cf0c..ae189ec 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 _0x27a6=['define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x27a6,0x1bf));var _0x627a=function(_0x3ea022,_0x2d5328){_0x3ea022=_0x3ea022-0x0;var _0x3b97a2=_0x27a6[_0x3ea022];return _0x3b97a2;};'use strict';var _=require(_0x627a('0x0'));var util=require(_0x627a('0x1'));var logger=require(_0x627a('0x2'))(_0x627a('0x3'));var moment=require(_0x627a('0x4'));var BPromise=require(_0x627a('0x5'));var rp=require(_0x627a('0x6'));var fs=require('fs');var path=require(_0x627a('0x7'));var rimraf=require(_0x627a('0x8'));var config=require(_0x627a('0x9'));var attributes=require(_0x627a('0xa'));module[_0x627a('0xb')]=function(_0xa2dce2,_0x409a5a){return _0xa2dce2[_0x627a('0xc')](_0x627a('0xd'),attributes,{'tableName':_0x627a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x627a('0xf'),'collate':_0x627a('0x10')});}; \ No newline at end of file +var _0x7903=['api','moment','request-promise','rimraf','./userNotification.attributes','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x7903,0xbe));var _0x3790=function(_0x8afd21,_0x1c6deb){_0x8afd21=_0x8afd21-0x0;var _0x592d82=_0x7903[_0x8afd21];return _0x592d82;};'use strict';var _=require(_0x3790('0x0'));var util=require(_0x3790('0x1'));var logger=require('../../config/logger')(_0x3790('0x2'));var moment=require(_0x3790('0x3'));var BPromise=require('bluebird');var rp=require(_0x3790('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3790('0x5'));var config=require('../../config/environment');var attributes=require(_0x3790('0x6'));module['exports']=function(_0x869207,_0x232aad){return _0x869207[_0x3790('0x7')](_0x3790('0x8'),attributes,{'tableName':_0x3790('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3790('0xa'),'collate':_0x3790('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 96f8abe..a429dd3 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 _0xd77b=['defaults','localhost','socket.io-emitter','./userNotification.socket','register','then','info','debug','error','code','UserNotification,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis'];(function(_0x11a7dd,_0x345735){var _0x4828fe=function(_0x5d3ed3){while(--_0x5d3ed3){_0x11a7dd['push'](_0x11a7dd['shift']());}};_0x4828fe(++_0x345735);}(_0xd77b,0x17b));var _0xbd77=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xd77b[_0x35885a];return _0xe86249;};'use strict';var _=require(_0xbd77('0x0'));var util=require(_0xbd77('0x1'));var moment=require('moment');var BPromise=require(_0xbd77('0x2'));var rs=require(_0xbd77('0x3'));var fs=require('fs');var Redis=require(_0xbd77('0x4'));var db=require(_0xbd77('0x5'))['db'];var utils=require(_0xbd77('0x6'));var logger=require(_0xbd77('0x7'))('rpc');var config=require(_0xbd77('0x8'));var jayson=require(_0xbd77('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xbd77('0xa')]=_[_0xbd77('0xb')](config['redis'],{'host':_0xbd77('0xc'),'port':0x18eb});var socket=require(_0xbd77('0xd'))(new Redis(config['redis']));require(_0xbd77('0xe'))[_0xbd77('0xf')](socket);function respondWithRpcPromise(_0x578bca,_0x541fc8,_0x230117){return new BPromise(function(_0x17ac5e,_0x138d20){return client['request'](_0x578bca,_0x230117)[_0xbd77('0x10')](function(_0x544bc9){logger[_0xbd77('0x11')]('UserNotification,\x20%s,\x20%s',_0x541fc8,'request\x20sent');logger[_0xbd77('0x12')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x541fc8,'request\x20sent',JSON['stringify'](_0x544bc9));if(_0x544bc9['error']){if(_0x544bc9[_0xbd77('0x13')][_0xbd77('0x14')]===0x1f4){logger[_0xbd77('0x13')](_0xbd77('0x15'),_0x541fc8,_0x544bc9[_0xbd77('0x13')]['message']);return _0x138d20(_0x544bc9[_0xbd77('0x13')][_0xbd77('0x16')]);}logger['error']('UserNotification,\x20%s,\x20%s',_0x541fc8,_0x544bc9[_0xbd77('0x13')]['message']);return _0x17ac5e(_0x544bc9[_0xbd77('0x13')][_0xbd77('0x16')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x541fc8,_0xbd77('0x17'));_0x17ac5e(_0x544bc9[_0xbd77('0x18')][_0xbd77('0x16')]);}})[_0xbd77('0x19')](function(_0x1f9b07){logger['error'](_0xbd77('0x15'),_0x541fc8,_0x1f9b07);_0x138d20(_0x1f9b07);});});} \ No newline at end of file +var _0x5ad8=['request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./userNotification.socket','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0x59c479,_0x2e1545){var _0x681d72=function(_0x154d7c){while(--_0x154d7c){_0x59c479['push'](_0x59c479['shift']());}};_0x681d72(++_0x2e1545);}(_0x5ad8,0xa2));var _0x85ad=function(_0x31daa8,_0x291f42){_0x31daa8=_0x31daa8-0x0;var _0x379d4c=_0x5ad8[_0x31daa8];return _0x379d4c;};'use strict';var _=require(_0x85ad('0x0'));var util=require(_0x85ad('0x1'));var moment=require(_0x85ad('0x2'));var BPromise=require(_0x85ad('0x3'));var rs=require(_0x85ad('0x4'));var fs=require('fs');var Redis=require(_0x85ad('0x5'));var db=require(_0x85ad('0x6'))['db'];var utils=require(_0x85ad('0x7'));var logger=require(_0x85ad('0x8'))(_0x85ad('0x9'));var config=require(_0x85ad('0xa'));var jayson=require(_0x85ad('0xb'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x85ad('0xc')],{'host':_0x85ad('0xd'),'port':0x18eb});var socket=require(_0x85ad('0xe'))(new Redis(config['redis']));require(_0x85ad('0xf'))['register'](socket);function respondWithRpcPromise(_0x4271d1,_0x272a7e,_0x3513d6){return new BPromise(function(_0x230df9,_0x3e72ff){return client['request'](_0x4271d1,_0x3513d6)['then'](function(_0x7d0a37){logger[_0x85ad('0x10')](_0x85ad('0x11'),_0x272a7e,'request\x20sent');logger[_0x85ad('0x12')](_0x85ad('0x13'),_0x272a7e,_0x85ad('0x14'),JSON[_0x85ad('0x15')](_0x7d0a37));if(_0x7d0a37['error']){if(_0x7d0a37[_0x85ad('0x16')][_0x85ad('0x17')]===0x1f4){logger['error'](_0x85ad('0x11'),_0x272a7e,_0x7d0a37['error'][_0x85ad('0x18')]);return _0x3e72ff(_0x7d0a37[_0x85ad('0x16')][_0x85ad('0x18')]);}logger[_0x85ad('0x16')](_0x85ad('0x11'),_0x272a7e,_0x7d0a37[_0x85ad('0x16')][_0x85ad('0x18')]);return _0x230df9(_0x7d0a37[_0x85ad('0x16')]['message']);}else{logger[_0x85ad('0x10')](_0x85ad('0x11'),_0x272a7e,_0x85ad('0x14'));_0x230df9(_0x7d0a37[_0x85ad('0x19')][_0x85ad('0x18')]);}})['catch'](function(_0x40fe25){logger[_0x85ad('0x16')](_0x85ad('0x11'),_0x272a7e,_0x40fe25);_0x3e72ff(_0x40fe25);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 25dae5f..1aafea4 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 _0xd45e=['length','save','remove','update','emit','register'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xd45e,0x97));var _0xed45=function(_0x79eebe,_0x2073f1){_0x79eebe=_0x79eebe-0x0;var _0x10ec34=_0xd45e[_0x79eebe];return _0x10ec34;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xed45('0x0'),_0xed45('0x1'),_0xed45('0x2')];function createListener(_0x21471f,_0x266387){return function(_0x166aed){_0x266387[_0xed45('0x3')](_0x21471f,_0x166aed);};}function removeListener(_0x4a8f48,_0x55132f){return function(){UserNotificationEvents['removeListener'](_0x4a8f48,_0x55132f);};}exports[_0xed45('0x4')]=function(_0x4e0550){for(var _0x57edf5=0x0,_0x4b8c13=events[_0xed45('0x5')];_0x57edf5<_0x4b8c13;_0x57edf5++){var _0x53a2b2=events[_0x57edf5];var _0x16fcbc=createListener('userNotification:'+_0x53a2b2,_0x4e0550);UserNotificationEvents['on'](_0x53a2b2,_0x16fcbc);}}; \ No newline at end of file +var _0xf575=['update','emit','register','length','userNotification:','./userNotification.events','remove'];(function(_0x5b4ecb,_0x20ea97){var _0x13a2f7=function(_0x4b001c){while(--_0x4b001c){_0x5b4ecb['push'](_0x5b4ecb['shift']());}};_0x13a2f7(++_0x20ea97);}(_0xf575,0x17f));var _0x5f57=function(_0x3ee798,_0x343673){_0x3ee798=_0x3ee798-0x0;var _0x2874da=_0xf575[_0x3ee798];return _0x2874da;};'use strict';var UserNotificationEvents=require(_0x5f57('0x0'));var events=['save',_0x5f57('0x1'),_0x5f57('0x2')];function createListener(_0x1067e6,_0x3e9459){return function(_0x149311){_0x3e9459[_0x5f57('0x3')](_0x1067e6,_0x149311);};}function removeListener(_0x421b4e,_0x229d37){return function(){UserNotificationEvents['removeListener'](_0x421b4e,_0x229d37);};}exports[_0x5f57('0x4')]=function(_0x11d26c){for(var _0x3477a2=0x0,_0x595c6c=events[_0x5f57('0x5')];_0x3477a2<_0x595c6c;_0x3477a2++){var _0x3f3cf7=events[_0x3477a2];var _0x3cab33=createListener(_0x5f57('0x6')+_0x3f3cf7,_0x11d26c);UserNotificationEvents['on'](_0x3f3cf7,_0x3cab33);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 0375e59..1c38f30 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(_0x23242a,_0x5c14d0){var _0x42aee9=function(_0x579ce0){while(--_0x579ce0){_0x23242a['push'](_0x23242a['shift']());}};_0x42aee9(++_0x5c14d0);}(_0xe706,0xa3));var _0x6e70=function(_0x1b09e8,_0x5c9627){_0x1b09e8=_0x1b09e8-0x0;var _0x158835=_0xe706[_0x1b09e8];return _0x158835;};'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(_0x5b812c,_0x37c1d9){var _0xfcf77b=function(_0x1f978d){while(--_0x1f978d){_0x5b812c['push'](_0x5b812c['shift']());}};_0xfcf77b(++_0x37c1d9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1d3577,_0x17a32e){_0x1d3577=_0x1d3577-0x0;var _0x277d9a=_0xcb91[_0x1d3577];return _0x277d9a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index e9589da..3bd1de4 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 _0x7118=['INTEGER'];(function(_0x172e1a,_0x17c8d0){var _0x1665cb=function(_0x541378){while(--_0x541378){_0x172e1a['push'](_0x172e1a['shift']());}};_0x1665cb(++_0x17c8d0);}(_0x7118,0x159));var _0x8711=function(_0xc07ad3,_0x23822e){_0xc07ad3=_0xc07ad3-0x0;var _0x4b3c07=_0x7118[_0xc07ad3];return _0x4b3c07;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x8711('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6f1e=['sequelize','exports'];(function(_0x954b3a,_0x10a7c1){var _0x3a313e=function(_0x1070ad){while(--_0x1070ad){_0x954b3a['push'](_0x954b3a['shift']());}};_0x3a313e(++_0x10a7c1);}(_0x6f1e,0x84));var _0xe6f1=function(_0x16e2ca,_0x46cd79){_0x16e2ca=_0x16e2ca-0x0;var _0x5388b7=_0x6f1e[_0x16e2ca];return _0x5388b7;};'use strict';var Sequelize=require(_0xe6f1('0x0'));module[_0xe6f1('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 2a546d3..51b3bda 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 _0x8bbd=['define','UserOpenchannelQueue','util','api','moment','bluebird','request-promise','rimraf','./userOpenchannelQueue.attributes'];(function(_0x53785b,_0x14b386){var _0x2ae6da=function(_0x262d6b){while(--_0x262d6b){_0x53785b['push'](_0x53785b['shift']());}};_0x2ae6da(++_0x14b386);}(_0x8bbd,0x1c4));var _0xd8bb=function(_0x3144c2,_0x5601fa){_0x3144c2=_0x3144c2-0x0;var _0x2ecc4a=_0x8bbd[_0x3144c2];return _0x2ecc4a;};'use strict';var _=require('lodash');var util=require(_0xd8bb('0x0'));var logger=require('../../config/logger')(_0xd8bb('0x1'));var moment=require(_0xd8bb('0x2'));var BPromise=require(_0xd8bb('0x3'));var rp=require(_0xd8bb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd8bb('0x5'));var config=require('../../config/environment');var attributes=require(_0xd8bb('0x6'));module['exports']=function(_0x1dbd04,_0x158d78){return _0x1dbd04[_0xd8bb('0x7')](_0xd8bb('0x8'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x829a=['path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3be001,_0x8b69e8){var _0xfc610f=function(_0x1741e9){while(--_0x1741e9){_0x3be001['push'](_0x3be001['shift']());}};_0xfc610f(++_0x8b69e8);}(_0x829a,0x14a));var _0xa829=function(_0x37192f,_0x596c39){_0x37192f=_0x37192f-0x0;var _0x508e86=_0x829a[_0x37192f];return _0x508e86;};'use strict';var _=require(_0xa829('0x0'));var util=require(_0xa829('0x1'));var logger=require(_0xa829('0x2'))('api');var moment=require(_0xa829('0x3'));var BPromise=require(_0xa829('0x4'));var rp=require(_0xa829('0x5'));var fs=require('fs');var path=require(_0xa829('0x6'));var rimraf=require(_0xa829('0x7'));var config=require(_0xa829('0x8'));var attributes=require(_0xa829('0x9'));module[_0xa829('0xa')]=function(_0x4450d3,_0x8c389b){return _0x4450d3[_0xa829('0xb')](_0xa829('0xc'),attributes,{'tableName':_0xa829('0xd'),'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 a01624c..e6881fc 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 _0xee48=['../../config/logger','rpc','../../config/environment','jayson/promise','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xee48,0xa7));var _0x8ee4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xee48[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0x8ee4('0x0'));var util=require(_0x8ee4('0x1'));var moment=require(_0x8ee4('0x2'));var BPromise=require(_0x8ee4('0x3'));var rs=require(_0x8ee4('0x4'));var fs=require('fs');var Redis=require(_0x8ee4('0x5'));var db=require(_0x8ee4('0x6'))['db'];var utils=require(_0x8ee4('0x7'));var logger=require(_0x8ee4('0x8'))(_0x8ee4('0x9'));var config=require(_0x8ee4('0xa'));var jayson=require(_0x8ee4('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xf52afd,_0x5c7654,_0x4341cb){return new BPromise(function(_0x535151,_0x56c551){return client[_0x8ee4('0xc')](_0xf52afd,_0x4341cb)[_0x8ee4('0xd')](function(_0x2feca7){logger['info'](_0x8ee4('0xe'),_0x5c7654,_0x8ee4('0xf'));logger[_0x8ee4('0x10')](_0x8ee4('0x11'),_0x5c7654,_0x8ee4('0xf'),JSON[_0x8ee4('0x12')](_0x2feca7));if(_0x2feca7[_0x8ee4('0x13')]){if(_0x2feca7['error'][_0x8ee4('0x14')]===0x1f4){logger[_0x8ee4('0x13')](_0x8ee4('0xe'),_0x5c7654,_0x2feca7['error'][_0x8ee4('0x15')]);return _0x56c551(_0x2feca7[_0x8ee4('0x13')]['message']);}logger[_0x8ee4('0x13')](_0x8ee4('0xe'),_0x5c7654,_0x2feca7[_0x8ee4('0x13')]['message']);return _0x535151(_0x2feca7[_0x8ee4('0x13')]['message']);}else{logger[_0x8ee4('0x16')](_0x8ee4('0xe'),_0x5c7654,_0x8ee4('0xf'));_0x535151(_0x2feca7[_0x8ee4('0x17')]['message']);}})[_0x8ee4('0x18')](function(_0x583d87){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x5c7654,_0x583d87);_0x56c551(_0x583d87);});});} \ No newline at end of file +var _0x849e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','../../mysqldb'];(function(_0x4c276e,_0x3e0629){var _0x5f4cb5=function(_0x304d98){while(--_0x304d98){_0x4c276e['push'](_0x4c276e['shift']());}};_0x5f4cb5(++_0x3e0629);}(_0x849e,0xf4));var _0xe849=function(_0x4222de,_0x567252){_0x4222de=_0x4222de-0x0;var _0x1ff142=_0x849e[_0x4222de];return _0x1ff142;};'use strict';var _=require(_0xe849('0x0'));var util=require(_0xe849('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe849('0x2'))['db'];var utils=require(_0xe849('0x3'));var logger=require(_0xe849('0x4'))(_0xe849('0x5'));var config=require(_0xe849('0x6'));var jayson=require(_0xe849('0x7'));var client=jayson[_0xe849('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19965f,_0x316fda,_0x527092){return new BPromise(function(_0x254c1d,_0x1a666e){return client[_0xe849('0x9')](_0x19965f,_0x527092)['then'](function(_0x5154e2){logger[_0xe849('0xa')](_0xe849('0xb'),_0x316fda,_0xe849('0xc'));logger[_0xe849('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x316fda,_0xe849('0xc'),JSON[_0xe849('0xe')](_0x5154e2));if(_0x5154e2[_0xe849('0xf')]){if(_0x5154e2[_0xe849('0xf')][_0xe849('0x10')]===0x1f4){logger[_0xe849('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x316fda,_0x5154e2['error'][_0xe849('0x11')]);return _0x1a666e(_0x5154e2[_0xe849('0xf')][_0xe849('0x11')]);}logger[_0xe849('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x316fda,_0x5154e2[_0xe849('0xf')][_0xe849('0x11')]);return _0x254c1d(_0x5154e2[_0xe849('0xf')][_0xe849('0x11')]);}else{logger[_0xe849('0xa')](_0xe849('0xb'),_0x316fda,_0xe849('0xc'));_0x254c1d(_0x5154e2['result'][_0xe849('0x11')]);}})[_0xe849('0x12')](function(_0x26db49){logger[_0xe849('0xf')](_0xe849('0xb'),_0x316fda,_0x26db49);_0x1a666e(_0x26db49);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 37186e9..1d8760c 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 _0x0923=['describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','removeResources','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated'];(function(_0x32d537,_0x580e46){var _0x2ec857=function(_0x38ff38){while(--_0x38ff38){_0x32d537['push'](_0x32d537['shift']());}};_0x2ec857(++_0x580e46);}(_0x0923,0x13c));var _0x3092=function(_0xe62f1f,_0x49e82c){_0xe62f1f=_0xe62f1f-0x0;var _0x106901=_0x0923[_0xe62f1f];return _0x106901;};'use strict';var multer=require(_0x3092('0x0'));var util=require(_0x3092('0x1'));var path=require('path');var timeout=require(_0x3092('0x2'));var express=require(_0x3092('0x3'));var router=express[_0x3092('0x4')]();var fs_extra=require(_0x3092('0x5'));var auth=require(_0x3092('0x6'));var interaction=require(_0x3092('0x7'));var config=require(_0x3092('0x8'));var controller=require(_0x3092('0x9'));router[_0x3092('0xa')]('/',auth['isAuthenticated'](),controller[_0x3092('0xb')]);router[_0x3092('0xa')](_0x3092('0xc'),auth[_0x3092('0xd')](),controller[_0x3092('0xe')]);router[_0x3092('0xa')](_0x3092('0xf'),auth[_0x3092('0xd')](),controller[_0x3092('0x10')]);router[_0x3092('0xa')](_0x3092('0x11'),auth['isAuthenticated'](),controller[_0x3092('0x12')]);router[_0x3092('0xa')](_0x3092('0x13'),auth['isAuthenticated'](),controller[_0x3092('0x14')]);router[_0x3092('0x15')]('/',auth[_0x3092('0xd')](),controller[_0x3092('0x16')]);router[_0x3092('0x15')](_0x3092('0x17'),auth[_0x3092('0xd')](),controller[_0x3092('0x18')]);router[_0x3092('0x15')]('/:id/sections',auth[_0x3092('0xd')](),controller[_0x3092('0x19')]);router[_0x3092('0x15')](_0x3092('0x13'),auth[_0x3092('0xd')](),controller[_0x3092('0x1a')]);router[_0x3092('0x1b')](_0x3092('0xf'),auth[_0x3092('0xd')](),controller[_0x3092('0x1c')]);router[_0x3092('0x1d')](_0x3092('0xf'),auth[_0x3092('0xd')](),controller[_0x3092('0x1e')]);router['delete'](_0x3092('0x11'),auth[_0x3092('0xd')](),controller['removeSections']);router[_0x3092('0x1d')]('/:id/resources',auth['isAuthenticated'](),controller[_0x3092('0x1f')]);module[_0x3092('0x20')]=router; \ No newline at end of file +var _0x881b=['getSections','/:id/resources','getResources','post','create','/:id/clone','/:id/sections','addSections','addResources','/:id','update','delete','destroy','removeSections','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show'];(function(_0x26060c,_0x234ac6){var _0x22544e=function(_0x2308cd){while(--_0x2308cd){_0x26060c['push'](_0x26060c['shift']());}};_0x22544e(++_0x234ac6);}(_0x881b,0x102));var _0xb881=function(_0x21d888,_0xb1d5e3){_0x21d888=_0x21d888-0x0;var _0xc0f70b=_0x881b[_0x21d888];return _0xc0f70b;};'use strict';var multer=require(_0xb881('0x0'));var util=require('util');var path=require(_0xb881('0x1'));var timeout=require('connect-timeout');var express=require(_0xb881('0x2'));var router=express[_0xb881('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb881('0x4'));var config=require(_0xb881('0x5'));var controller=require('./userProfile.controller');router[_0xb881('0x6')]('/',auth[_0xb881('0x7')](),controller[_0xb881('0x8')]);router[_0xb881('0x6')](_0xb881('0x9'),auth[_0xb881('0x7')](),controller[_0xb881('0xa')]);router[_0xb881('0x6')]('/:id',auth[_0xb881('0x7')](),controller[_0xb881('0xb')]);router[_0xb881('0x6')]('/:id/sections',auth[_0xb881('0x7')](),controller[_0xb881('0xc')]);router['get'](_0xb881('0xd'),auth[_0xb881('0x7')](),controller[_0xb881('0xe')]);router[_0xb881('0xf')]('/',auth[_0xb881('0x7')](),controller[_0xb881('0x10')]);router[_0xb881('0xf')](_0xb881('0x11'),auth[_0xb881('0x7')](),controller['clone']);router[_0xb881('0xf')](_0xb881('0x12'),auth['isAuthenticated'](),controller[_0xb881('0x13')]);router['post'](_0xb881('0xd'),auth[_0xb881('0x7')](),controller[_0xb881('0x14')]);router['put'](_0xb881('0x15'),auth[_0xb881('0x7')](),controller[_0xb881('0x16')]);router[_0xb881('0x17')]('/:id',auth[_0xb881('0x7')](),controller[_0xb881('0x18')]);router['delete'](_0xb881('0x12'),auth[_0xb881('0x7')](),controller[_0xb881('0x19')]);router['delete']('/:id/resources',auth[_0xb881('0x7')](),controller['removeResources']);module[_0xb881('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 9789e05..f84ac8e 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 _0x75d2=['setDataValue','crudPermissions','getDataValue','split','BOOLEAN','sequelize','STRING','name'];(function(_0x3833e5,_0x4b6945){var _0x51c833=function(_0x24307c){while(--_0x24307c){_0x3833e5['push'](_0x3833e5['shift']());}};_0x51c833(++_0x4b6945);}(_0x75d2,0x1ed));var _0x275d=function(_0x37e886,_0x17d0ad){_0x37e886=_0x37e886-0x0;var _0x57c5cd=_0x75d2[_0x37e886];return _0x57c5cd;};'use strict';var Sequelize=require(_0x275d('0x0'));module['exports']={'name':{'type':Sequelize[_0x275d('0x1')],'allowNull':![],'unique':_0x275d('0x2')},'crudPermissions':{'type':Sequelize[_0x275d('0x1')],'set':function(_0x2f5aa7){this[_0x275d('0x3')](_0x275d('0x4'),_0x2f5aa7?_0x2f5aa7['join'](''):[]);},'get':function(){return this[_0x275d('0x5')]('crudPermissions')?this[_0x275d('0x5')](_0x275d('0x4'))[_0x275d('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x275d('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x275d('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x275d('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x275d('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x275d('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x275d('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5136=['crudPermissions','split','BOOLEAN','sequelize','exports','name','STRING','join','getDataValue'];(function(_0x4eb69b,_0x135246){var _0x517afb=function(_0x1606a5){while(--_0x1606a5){_0x4eb69b['push'](_0x4eb69b['shift']());}};_0x517afb(++_0x135246);}(_0x5136,0x186));var _0x6513=function(_0x9f85a2,_0x3e1ccd){_0x9f85a2=_0x9f85a2-0x0;var _0x380b8f=_0x5136[_0x9f85a2];return _0x380b8f;};'use strict';var Sequelize=require(_0x6513('0x0'));module[_0x6513('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6513('0x2')},'crudPermissions':{'type':Sequelize[_0x6513('0x3')],'set':function(_0x53684b){this['setDataValue']('crudPermissions',_0x53684b?_0x53684b[_0x6513('0x4')](''):[]);},'get':function(){return this[_0x6513('0x5')](_0x6513('0x6'))?this[_0x6513('0x5')](_0x6513('0x6'))[_0x6513('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x6513('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x6513('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x6513('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x6513('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x6513('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x6513('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x6513('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x6513('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 14a0d93..e2a01c8 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 _0xc19f=['addSections','transaction','getSections','enabled','includes','isEmpty','subsections','push','findOne','Dashboard','forEach','Plugin','resourceId','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','UserProfile','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','map','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','create','body','clone','get','omit','createdAt','updatedAt','crudPermissions','UserProfileSection','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','describe'];(function(_0x20beae,_0x5eac6d){var _0xf5725=function(_0x926a3b){while(--_0x926a3b){_0x20beae['push'](_0x20beae['shift']());}};_0xf5725(++_0x5eac6d);}(_0xc19f,0x164));var _0xfc19=function(_0x8f270,_0x2f435f){_0x8f270=_0x8f270-0x0;var _0x5446cb=_0xc19f[_0x8f270];return _0x5446cb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfc19('0x0'));var jsonpatch=require(_0xfc19('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfc19('0x2'));var Mustache=require(_0xfc19('0x3'));var util=require(_0xfc19('0x4'));var path=require(_0xfc19('0x5'));var sox=require(_0xfc19('0x6'));var csv=require(_0xfc19('0x7'));var ejs=require(_0xfc19('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xfc19('0x9'));var jsforce=require(_0xfc19('0xa'));var deskjs=require(_0xfc19('0xb'));var toCsv=require(_0xfc19('0x7'));var querystring=require(_0xfc19('0xc'));var Papa=require(_0xfc19('0xd'));var Redis=require(_0xfc19('0xe'));var authService=require(_0xfc19('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc19('0x10'));var logger=require(_0xfc19('0x11'))('api');var utils=require(_0xfc19('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xfc19('0x13'));var db=require(_0xfc19('0x14'))['db'];config['redis']=_[_0xfc19('0x15')](config[_0xfc19('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xfc19('0x17'))(new Redis(config[_0xfc19('0x16')]));require(_0xfc19('0x18'))[_0xfc19('0x19')](socket);function respondWithStatusCode(_0x158b36,_0x4f4b84){_0x4f4b84=_0x4f4b84||0xcc;return function(_0x36b527){if(_0x36b527){return _0x158b36[_0xfc19('0x1a')](_0x4f4b84);}return _0x158b36[_0xfc19('0x1b')](_0x4f4b84)[_0xfc19('0x1c')]();};}function respondWithResult(_0x414011,_0x3201b2){_0x3201b2=_0x3201b2||0xc8;return function(_0x30a3af){if(_0x30a3af){return _0x414011[_0xfc19('0x1b')](_0x3201b2)[_0xfc19('0x1d')](_0x30a3af);}};}function respondWithFilteredResult(_0x22e648,_0x28e5f2){return function(_0x2f3143){if(_0x2f3143){var _0x17ebed=typeof _0x28e5f2[_0xfc19('0x1e')]===_0xfc19('0x1f')&&typeof _0x28e5f2[_0xfc19('0x20')]===_0xfc19('0x1f');var _0x4383a8=_0x2f3143[_0xfc19('0x21')];var _0x222177=_0x17ebed?0x0:_0x28e5f2[_0xfc19('0x1e')];var _0x539a4d=_0x17ebed?_0x2f3143[_0xfc19('0x21')]:_0x28e5f2['offset']+_0x28e5f2[_0xfc19('0x20')];var _0x538f19;if(_0x539a4d>=_0x4383a8){_0x539a4d=_0x4383a8;_0x538f19=0xc8;}else{_0x538f19=0xce;}_0x22e648[_0xfc19('0x1b')](_0x538f19);return _0x22e648['set'](_0xfc19('0x22'),_0x222177+'-'+_0x539a4d+'/'+_0x4383a8)[_0xfc19('0x1d')](_0x2f3143);}return null;};}function patchUpdates(_0x4f8fef){return function(_0x4236eb){try{jsonpatch[_0xfc19('0x23')](_0x4236eb,_0x4f8fef,!![]);}catch(_0x4be83d){return BPromise['reject'](_0x4be83d);}return _0x4236eb[_0xfc19('0x24')]();};}function saveUpdates(_0x4e7c72,_0x2f9b20){return function(_0x479756){if(_0x479756){return _0x479756[_0xfc19('0x25')](_0x4e7c72)[_0xfc19('0x26')](function(_0x3a433a){return _0x3a433a;});}return null;};}function removeEntity(_0x4883f1,_0xe77f34){return function(_0xc302a8){if(_0xc302a8){return _0xc302a8[_0xfc19('0x27')]()[_0xfc19('0x26')](function(){_0x4883f1[_0xfc19('0x1b')](0xcc)[_0xfc19('0x1c')]();});}};}function handleEntityNotFound(_0x40c66d,_0x17078a){return function(_0x15b7ca){if(!_0x15b7ca){_0x40c66d['sendStatus'](0x194);}return _0x15b7ca;};}function handleError(_0x3eac40,_0x126a5b){_0x126a5b=_0x126a5b||0x1f4;return function(_0x55803d){logger[_0xfc19('0x28')](_0x55803d[_0xfc19('0x29')]);if(_0x55803d[_0xfc19('0x2a')]){delete _0x55803d[_0xfc19('0x2a')];}_0x3eac40['status'](_0x126a5b)[_0xfc19('0x2b')](_0x55803d);};}exports[_0xfc19('0x2c')]=function(_0x2932bd,_0x548486){var _0x42e868={},_0x1b38ae={},_0x54a8d9={'count':0x0,'rows':[]};var _0x3af5d5=_['map'](db[_0xfc19('0x2d')]['rawAttributes'],function(_0x2db913){return{'name':_0x2db913[_0xfc19('0x2e')],'type':_0x2db913[_0xfc19('0x2f')][_0xfc19('0x30')]};});_0x1b38ae[_0xfc19('0x31')]=_['map'](_0x3af5d5,'name');_0x1b38ae[_0xfc19('0x32')]=_['keys'](_0x2932bd[_0xfc19('0x32')]);_0x1b38ae[_0xfc19('0x33')]=_[_0xfc19('0x34')](_0x1b38ae[_0xfc19('0x31')],_0x1b38ae[_0xfc19('0x32')]);_0x42e868[_0xfc19('0x35')]=_[_0xfc19('0x34')](_0x1b38ae[_0xfc19('0x31')],qs[_0xfc19('0x36')](_0x2932bd[_0xfc19('0x32')][_0xfc19('0x36')]));_0x42e868[_0xfc19('0x35')]=_0x42e868[_0xfc19('0x35')][_0xfc19('0x37')]?_0x42e868[_0xfc19('0x35')]:_0x1b38ae[_0xfc19('0x31')];if(!_0x2932bd[_0xfc19('0x32')][_0xfc19('0x38')](_0xfc19('0x39'))){_0x42e868[_0xfc19('0x20')]=qs['limit'](_0x2932bd['query'][_0xfc19('0x20')]);_0x42e868[_0xfc19('0x1e')]=qs[_0xfc19('0x1e')](_0x2932bd[_0xfc19('0x32')]['offset']);}_0x42e868[_0xfc19('0x3a')]=qs[_0xfc19('0x3b')](_0x2932bd[_0xfc19('0x32')][_0xfc19('0x3b')]);_0x42e868['where']=qs[_0xfc19('0x33')](_[_0xfc19('0x3c')](_0x2932bd[_0xfc19('0x32')],_0x1b38ae[_0xfc19('0x33')]),_0x3af5d5);if(_0x2932bd['query']['filter']){_0x42e868['where']=_['merge'](_0x42e868[_0xfc19('0x3d')],{'$or':_[_0xfc19('0x3e')](_0x3af5d5,function(_0x131b17){if(_0x131b17[_0xfc19('0x2f')]!==_0xfc19('0x3f')){var _0xffc422={};_0xffc422[_0x131b17[_0xfc19('0x2a')]]={'$like':'%'+_0x2932bd[_0xfc19('0x32')][_0xfc19('0x40')]+'%'};return _0xffc422;}})});}_0x42e868=_[_0xfc19('0x41')]({},_0x42e868,_0x2932bd[_0xfc19('0x42')]);var _0x563e32={'where':_0x42e868[_0xfc19('0x3d')]};return db[_0xfc19('0x2d')]['count'](_0x563e32)[_0xfc19('0x26')](function(_0x2bd524){_0x54a8d9[_0xfc19('0x21')]=_0x2bd524;if(_0x2932bd[_0xfc19('0x32')][_0xfc19('0x43')]){_0x42e868[_0xfc19('0x44')]=[{'all':!![]}];}return db[_0xfc19('0x2d')][_0xfc19('0x45')](_0x42e868);})[_0xfc19('0x26')](function(_0x2594c5){_0x54a8d9[_0xfc19('0x46')]=_0x2594c5;return _0x54a8d9;})[_0xfc19('0x26')](respondWithFilteredResult(_0x548486,_0x42e868))[_0xfc19('0x47')](handleError(_0x548486,null));};exports['show']=function(_0x2e6f05,_0x53f7e6){var _0xf83dfc={'raw':![],'where':{'id':_0x2e6f05[_0xfc19('0x48')]['id']}},_0x138ba2={};_0x138ba2[_0xfc19('0x31')]=_[_0xfc19('0x49')](db[_0xfc19('0x2d')][_0xfc19('0x4a')]);_0x138ba2[_0xfc19('0x32')]=_[_0xfc19('0x49')](_0x2e6f05['query']);_0x138ba2[_0xfc19('0x33')]=_[_0xfc19('0x34')](_0x138ba2['model'],_0x138ba2[_0xfc19('0x32')]);_0xf83dfc['attributes']=_[_0xfc19('0x34')](_0x138ba2[_0xfc19('0x31')],qs[_0xfc19('0x36')](_0x2e6f05[_0xfc19('0x32')][_0xfc19('0x36')]));_0xf83dfc[_0xfc19('0x35')]=_0xf83dfc[_0xfc19('0x35')][_0xfc19('0x37')]?_0xf83dfc['attributes']:_0x138ba2['model'];if(_0x2e6f05[_0xfc19('0x32')][_0xfc19('0x43')]){_0xf83dfc[_0xfc19('0x44')]=[{'all':!![]}];}_0xf83dfc=_[_0xfc19('0x41')]({},_0xf83dfc,_0x2e6f05[_0xfc19('0x42')]);return db[_0xfc19('0x2d')][_0xfc19('0x4b')](_0xf83dfc)['then'](handleEntityNotFound(_0x53f7e6,null))[_0xfc19('0x26')](respondWithResult(_0x53f7e6,null))[_0xfc19('0x47')](handleError(_0x53f7e6,null));};exports[_0xfc19('0x4c')]=function(_0x5acfad,_0x585ec2){return db[_0xfc19('0x2d')][_0xfc19('0x4c')](_0x5acfad[_0xfc19('0x4d')],{})[_0xfc19('0x26')](respondWithResult(_0x585ec2,0xc9))[_0xfc19('0x47')](handleError(_0x585ec2,null));};exports[_0xfc19('0x4e')]=function(_0x7b4f8a,_0xf9cde4){var _0x484f02={'where':{'id':_0x7b4f8a[_0xfc19('0x48')]['id']}},_0x54a04e={};_0x54a04e['model']=_[_0xfc19('0x49')](db[_0xfc19('0x2d')]['rawAttributes']);_0x484f02[_0xfc19('0x35')]=_[_0xfc19('0x34')](_0x54a04e[_0xfc19('0x31')],qs['fields'](_0x7b4f8a[_0xfc19('0x32')][_0xfc19('0x36')]));_0x484f02['attributes']=_0x484f02['attributes'][_0xfc19('0x37')]?_0x484f02[_0xfc19('0x35')]:_0x54a04e[_0xfc19('0x31')];if(_0x7b4f8a[_0xfc19('0x32')][_0xfc19('0x43')]){_0x484f02[_0xfc19('0x44')]=[{'all':!![]}];}_0x484f02=_[_0xfc19('0x41')]({},_0x484f02,_0x7b4f8a[_0xfc19('0x42')]);return db[_0xfc19('0x2d')][_0xfc19('0x4b')](_0x484f02)['then'](handleEntityNotFound(_0xf9cde4,null))[_0xfc19('0x26')](function(_0x572c38){if(_0x572c38){var _0xf6832e=_0x572c38[_0xfc19('0x4f')]({'plain':!![]});_0xf6832e=qs[_0xfc19('0x50')](_0xf6832e,['id',_0xfc19('0x51'),_0xfc19('0x52'),_0xfc19('0x53')]);_0x7b4f8a[_0xfc19('0x4d')]=_[_0xfc19('0x50')](_0x7b4f8a[_0xfc19('0x4d')],['id',_0xfc19('0x51'),_0xfc19('0x52')]);return db['sequelize']['transaction'](function(_0x4dfaaa){return db[_0xfc19('0x2d')]['create'](_[_0xfc19('0x41')](_0xf6832e,_0x7b4f8a[_0xfc19('0x4d')]),{'include':_0x7b4f8a[_0xfc19('0x32')][_0xfc19('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x4dfaaa})[_0xfc19('0x26')](function(_0x5f22d2){var _0x498212=_0x5f22d2[_0xfc19('0x4f')]({'plain':!![]});return db[_0xfc19('0x54')][_0xfc19('0x45')]({'where':{'userProfileId':_0x7b4f8a[_0xfc19('0x48')]['id']},'raw':!![]})[_0xfc19('0x26')](function(_0x4eb73b){if(_0x4eb73b){return BPromise[_0xfc19('0x55')](_0x4eb73b,function(_0x446f0a){return new BPromise(function(_0x5e847a,_0x583bc9){if(_0x446f0a[_0xfc19('0x56')]===null||_0x446f0a[_0xfc19('0x56')]===0x1)_0x5e847a(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x446f0a['id']},'raw':!![]})[_0xfc19('0x26')](function(_0x5682da){var _0x4034e=_[_0xfc19('0x3e')](_0x5682da,function(_0x598d7c){return qs[_0xfc19('0x50')](_0x598d7c,['id','createdAt',_0xfc19('0x52'),_0xfc19('0x57')]);});_0x5e847a(_0x4034e);})[_0xfc19('0x47')](function(_0x47dff5){_0x583bc9(_0x47dff5);});})[_0xfc19('0x26')](function(_0x110055){var _0x4c70d2=qs['omit'](_0x446f0a,['id',_0xfc19('0x51'),_0xfc19('0x52')]);_0x4c70d2[_0xfc19('0x58')]=_0x498212['id'];if(_0x110055)_0x4c70d2[_0xfc19('0x59')]=_0x110055;return _0x4c70d2;})[_0xfc19('0x26')](function(_0x23b690){return db[_0xfc19('0x54')][_0xfc19('0x4c')](_0x23b690,{'include':[{'model':db[_0xfc19('0x5a')],'as':_0xfc19('0x59')}],'raw':!![],'transaction':_0x4dfaaa});});})[_0xfc19('0x26')](function(){return _0x498212;});}});});});}})[_0xfc19('0x26')](respondWithResult(_0xf9cde4,0xc9))[_0xfc19('0x47')](handleError(_0xf9cde4,null));};exports[_0xfc19('0x25')]=function(_0x1c21a5,_0xe2512d){if(_0x1c21a5[_0xfc19('0x4d')]['id']){delete _0x1c21a5['body']['id'];}return db['UserProfile'][_0xfc19('0x4b')]({'where':{'id':_0x1c21a5[_0xfc19('0x48')]['id']}})[_0xfc19('0x26')](handleEntityNotFound(_0xe2512d,null))[_0xfc19('0x26')](saveUpdates(_0x1c21a5[_0xfc19('0x4d')],null))[_0xfc19('0x26')](respondWithResult(_0xe2512d,null))[_0xfc19('0x47')](handleError(_0xe2512d,null));};exports[_0xfc19('0x27')]=function(_0x13085a,_0x32a1b0){return db[_0xfc19('0x2d')][_0xfc19('0x4b')]({'where':{'id':_0x13085a[_0xfc19('0x48')]['id']}})['then'](handleEntityNotFound(_0x32a1b0,null))[_0xfc19('0x26')](removeEntity(_0x32a1b0,null))['catch'](handleError(_0x32a1b0,null));};exports[_0xfc19('0x5b')]=function(_0x243b88,_0x5d0f0e){return db['UserProfile'][_0xfc19('0x5b')]()[_0xfc19('0x26')](respondWithResult(_0x5d0f0e,null))[_0xfc19('0x47')](handleError(_0x5d0f0e,null));};exports[_0xfc19('0x5c')]=function(_0x27fedf,_0x7e0a6d){var _0x51de0b=_0x27fedf['body'];return db['UserProfile'][_0xfc19('0x4b')]({'where':{'id':_0x27fedf[_0xfc19('0x48')]['id']}})[_0xfc19('0x26')](handleEntityNotFound(_0x7e0a6d,null))[_0xfc19('0x26')](function(_0x1a7f3e){if(_0x1a7f3e){return db['sequelize'][_0xfc19('0x5d')](function(_0x47fb9e){return db[_0xfc19('0x54')][_0xfc19('0x27')]({'where':{'userProfileId':_0x27fedf[_0xfc19('0x48')]['id'],'sectionId':_[_0xfc19('0x3e')](_0x51de0b,function(_0x4f1c53){return _0x4f1c53['sectionId'];})},'transaction':_0x47fb9e})[_0xfc19('0x26')](function(){var _0x454541=_[_0xfc19('0x3e')](_0x51de0b,function(_0x2c9256){_0x2c9256[_0xfc19('0x58')]=_0x27fedf[_0xfc19('0x48')]['id'];return _0x2c9256;});var _0x52b11c=[];return BPromise[_0xfc19('0x55')](_0x454541,function(_0xbb5174){return db[_0xfc19('0x54')][_0xfc19('0x4c')](_0xbb5174,{'include':[{'model':db[_0xfc19('0x5a')],'as':'Resources'}],'raw':!![],'transaction':_0x47fb9e})['then'](function(_0xadf8f1){_0x52b11c['push'](_0xadf8f1[_0xfc19('0x4f')]({'plain':!![]}));});})[_0xfc19('0x26')](function(){return _0x52b11c;});});});}})[_0xfc19('0x26')](function(_0x1bb1e0){return _0x1bb1e0;})[_0xfc19('0x26')](respondWithResult(_0x7e0a6d,null))['catch'](handleError(_0x7e0a6d,null));};exports['removeSections']=function(_0x343972,_0x3d92fd){var _0x7af69a;return db[_0xfc19('0x2d')][_0xfc19('0x4b')]({'where':{'id':_0x343972[_0xfc19('0x48')]['id']},'attributes':['id',_0xfc19('0x2a')]})[_0xfc19('0x26')](handleEntityNotFound(_0x3d92fd,null))[_0xfc19('0x26')](function(_0x4b3465){if(_0x4b3465){_0x7af69a=_0x4b3465;return db[_0xfc19('0x54')][_0xfc19('0x27')]({'where':{'userProfileId':_0x343972[_0xfc19('0x48')]['id'],'sectionId':_0x343972[_0xfc19('0x32')]['ids']}});}})[_0xfc19('0x26')](function(){return _0x7af69a;})[_0xfc19('0x26')](respondWithStatusCode(_0x3d92fd,null))[_0xfc19('0x47')](handleError(_0x3d92fd,null));};exports[_0xfc19('0x5e')]=function(_0x2f2d93,_0x47c34b){var _0x18126d=[];var _0x949537=[];return db['UserProfileSection'][_0xfc19('0x45')]({'where':{'userProfileId':_0x2f2d93[_0xfc19('0x48')]['id']},'raw':!![]})['then'](function(_0x321684){_0x18126d=_['filter'](_0x321684,function(_0x15bc6f){return _0x15bc6f[_0xfc19('0x5f')]===0x1||_[_0xfc19('0x60')]([0x3eb,0x709],_0x15bc6f['sectionId']);});if(!_[_0xfc19('0x61')](_0x18126d)){return _[_0xfc19('0x3e')](_0x18126d,function(_0x32ff99){return _0x32ff99['sectionId'];});}else{return;}})[_0xfc19('0x26')](function(_0x1665ca){if(_0x1665ca)_0x949537=_0x1665ca;if(_[_0xfc19('0x60')](_0x949537,0x64)){var _0x367e7b=_[_0xfc19('0x4b')](_0x18126d,{'sectionId':0x64});return hasDefaultDashboard(_0x367e7b)[_0xfc19('0x26')](function(_0x3322c7){return _['map'](_0x18126d,function(_0x501fa4){if(_0x501fa4['sectionId']===0x64){_0x501fa4[_0xfc19('0x62')]=_0x3322c7;}return _0x501fa4;});});}else{return;}})[_0xfc19('0x26')](function(_0x52aacf){if(_0x52aacf)_0x18126d=_0x52aacf;if(_[_0xfc19('0x60')](_0x949537,0x3eb)){var _0x5cde48=_[_0xfc19('0x4b')](_0x18126d,{'sectionId':0x3eb});return getCustomDashboards(_0x5cde48)[_0xfc19('0x26')](function(_0x1cc436){return _[_0xfc19('0x3e')](_0x18126d,function(_0x51c9a1){if(_0x5cde48['enabled']){if(_0x51c9a1[_0xfc19('0x57')]===0x3eb){_0x51c9a1[_0xfc19('0x62')]=_0x1cc436;}}else{if(_0x51c9a1[_0xfc19('0x57')]===0x64){_0x51c9a1[_0xfc19('0x62')]=_0x1cc436;}}return _0x51c9a1;});});}else{return;}})[_0xfc19('0x26')](function(_0x140258){if(_0x140258)_0x18126d=_0x140258;if(_['includes'](_0x949537,0x709)){var _0x499223=_[_0xfc19('0x4b')](_0x18126d,{'sectionId':0x709});return getPlugins(_0x499223)[_0xfc19('0x26')](function(_0x25d313){if(_0x499223[_0xfc19('0x5f')]){return _[_0xfc19('0x3e')](_0x18126d,function(_0x723c26){if(_0x723c26[_0xfc19('0x57')]===0x709){_0x723c26[_0xfc19('0x62')]=_0x25d313;}return _0x723c26;});}else{var _0x2411ca={'sectionId':0x76c,'enabled':0x1,'subsections':_0x25d313};var _0x3fa4dc=_['map'](_0x18126d);_0x3fa4dc[_0xfc19('0x63')](_0x2411ca);return _0x3fa4dc;}});}else{return;}})[_0xfc19('0x26')](function(_0x36b7f3){if(_0x36b7f3)_0x18126d=_0x36b7f3;return _[_0xfc19('0x40')](_0x18126d,[_0xfc19('0x5f'),0x1]);})[_0xfc19('0x26')](respondWithResult(_0x47c34b,null))['catch'](handleError(_0x47c34b,null));};function hasDefaultDashboard(_0x4370a8){var _0x46a10b=[0x65];return new BPromise(function(_0x431053,_0xeacfb5){try{if(_0x4370a8[_0xfc19('0x56')]){_0x431053(_0x46a10b);}else{return db[_0xfc19('0x5a')][_0xfc19('0x64')]({'where':{'sectionId':_0x4370a8['id']},'raw':!![]})['then'](function(_0x28330b){_0x28330b?_0x431053(_0x46a10b):_0x431053();});}}catch(_0x1205f0){_0xeacfb5(_0x1205f0);}});}function getCustomDashboards(_0x5adf77){var _0x23d496=[];return new BPromise(function(_0x1e9241,_0x582156){try{if(_0x5adf77[_0xfc19('0x56')]){return db[_0xfc19('0x65')]['findAll']({'raw':!![]})['then'](function(_0x538d39){_0x538d39[_0xfc19('0x66')](function(_0x20d385){_0x23d496[_0xfc19('0x63')](_0x20d385['id']+0x1869f);});_0x1e9241(_0x23d496);});}else{return db['UserProfileResource'][_0xfc19('0x45')]({'where':{'sectionId':_0x5adf77['id']},'raw':!![]})[_0xfc19('0x26')](function(_0xedb5e6){_0xedb5e6[_0xfc19('0x66')](function(_0x139cb5){_0x23d496[_0xfc19('0x63')](_0x139cb5['resourceId']+0x1869f);});_0x1e9241(_0x23d496);});}}catch(_0x26a734){_0x582156(_0x26a734);}});}function getPlugins(_0x238227){var _0x7797b5=[];return new BPromise(function(_0x2e6e24,_0x23eb55){try{if(_0x238227[_0xfc19('0x56')]){return db[_0xfc19('0x67')][_0xfc19('0x45')]({'raw':!![]})['then'](function(_0x9a1874){_0x9a1874[_0xfc19('0x66')](function(_0x3a87ca){_0x7797b5[_0xfc19('0x63')](_0x3a87ca['id']+0x15b38);});_0x2e6e24(_0x7797b5);});}else{return db['UserProfileResource'][_0xfc19('0x45')]({'where':{'sectionId':_0x238227['id']},'raw':!![]})[_0xfc19('0x26')](function(_0x5c2429){_0x5c2429['forEach'](function(_0x1b9889){_0x7797b5[_0xfc19('0x63')](_0x1b9889[_0xfc19('0x68')]+0x15b38);});_0x2e6e24(_0x7797b5);});}}catch(_0x4d5da3){_0x23eb55(_0x4d5da3);}});}exports['addResources']=function(_0x2c4d56,_0x4d2e9c){return db[_0xfc19('0x2d')][_0xfc19('0x4b')]({'where':{'id':_0x2c4d56[_0xfc19('0x48')]['id']}})[_0xfc19('0x26')](handleEntityNotFound(_0x4d2e9c,null))[_0xfc19('0x26')](function(_0x3d44c3){if(_0x3d44c3){return db['sequelize'][_0xfc19('0x5d')](function(_0x10236c){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x2c4d56[_0xfc19('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0xfc19('0x26')](function(_0x447a91){if(_0x447a91){return db[_0xfc19('0x54')]['destroy']({'where':{'userProfileId':_0x2c4d56[_0xfc19('0x48')]['id'],'id':_['map'](_0x447a91,function(_0x2e1204){return _0x2e1204['id'];})},'transaction':_0x10236c});}})[_0xfc19('0x26')](function(_0x5402f9){var _0x74c9a0=_[_0xfc19('0x3e')](_0x2c4d56[_0xfc19('0x4d')],function(_0x37a56e){_0x37a56e[_0xfc19('0x58')]=_0x2c4d56[_0xfc19('0x48')]['id'];return _0x37a56e;});return db[_0xfc19('0x54')][_0xfc19('0x69')](_0x74c9a0,{'raw':!![],'transaction':_0x10236c});})[_0xfc19('0x26')](function(_0x1c57f8){var _0x33455b=_[_0xfc19('0x40')](_[_0xfc19('0x3e')](_0x1c57f8,function(_0x1c6886){return _0x1c6886[_0xfc19('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x33455b){return db[_0xfc19('0x54')][_0xfc19('0x45')]({'where':{'userProfileId':_0x2c4d56[_0xfc19('0x48')]['id'],'sectionId':_['map'](_0x33455b,function(_0x542702){return _0x542702[_0xfc19('0x57')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xfc19('0x26')](function(_0x190ac4){var _0x16140e=_['map'](_0x2c4d56[_0xfc19('0x4d')],function(_0x2ff29c){_0x2ff29c['userProfileId']=_0x2c4d56[_0xfc19('0x48')]['id'];return _0x2ff29c;});return db['UserProfileResource']['bulkCreate'](_0x16140e,{'raw':!![],'transaction':_0x10236c});});}})[_0xfc19('0x47')](handleError(_0x4d2e9c,null));});}})[_0xfc19('0x26')](function(_0x6347d3){var _0x36f0e7=_['map'](_0x6347d3,function(_0x421781){return _0x421781[_0xfc19('0x4f')]({'plain':!![]});});})[_0xfc19('0x26')](respondWithResult(_0x4d2e9c,null))['catch'](handleError(_0x4d2e9c,null));};exports[_0xfc19('0x6a')]=function(_0x127ffb,_0x26f7e8,_0xe351f3){return db[_0xfc19('0x2d')][_0xfc19('0x4b')]({'where':{'id':_0x127ffb[_0xfc19('0x48')]['id']}})[_0xfc19('0x26')](handleEntityNotFound(_0x26f7e8,null))[_0xfc19('0x26')](function(_0x4da08f){if(_0x4da08f){return _0x4da08f['removeResources'](_0x127ffb[_0xfc19('0x32')][_0xfc19('0x6b')]);}})[_0xfc19('0x26')](respondWithStatusCode(_0x26f7e8,null))[_0xfc19('0x47')](handleError(_0x26f7e8,null));};exports[_0xfc19('0x6c')]=function(_0x59fc0c,_0x8cc2d4){var _0x24f1a={};if(!_0x59fc0c['query'][_0xfc19('0x6d')])throw new Error(_0xfc19('0x6e'));if(!_0x59fc0c[_0xfc19('0x32')][_0xfc19('0x38')](_0xfc19('0x39'))){_0x24f1a[_0xfc19('0x20')]=qs[_0xfc19('0x20')](_0x59fc0c['query'][_0xfc19('0x20')]);_0x24f1a[_0xfc19('0x1e')]=qs[_0xfc19('0x1e')](_0x59fc0c['query']['offset']);}return db[_0xfc19('0x2d')]['find']({'where':{'id':_0x59fc0c[_0xfc19('0x48')]['id']}})[_0xfc19('0x26')](function(_0x96b24c){if(!_0x96b24c)throw new Error(_0xfc19('0x6f')+_0x59fc0c[_0xfc19('0x48')]['id']);return db[_0xfc19('0x2d')]['getResources'](_0x59fc0c);})['then'](respondWithFilteredResult(_0x8cc2d4,_0x24f1a))[_0xfc19('0x47')](handleError(_0x8cc2d4,null));}; \ No newline at end of file +var _0xc4d8=['order','sort','where','pick','filter','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','clone','merge','createdAt','omit','updatedAt','sequelize','transaction','get','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','push','removeSections','ids','getSections','enabled','includes','subsections','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','UserProfile','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x39ccfd,_0x2c2047){var _0x5c5093=function(_0x126151){while(--_0x126151){_0x39ccfd['push'](_0x39ccfd['shift']());}};_0x5c5093(++_0x2c2047);}(_0xc4d8,0xa6));var _0x8c4d=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xc4d8[_0x125ff8];return _0x2d9ef;};'use strict';var emlformat=require(_0x8c4d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c4d('0x1'));var jsonpatch=require(_0x8c4d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8c4d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8c4d('0x4'));var sox=require(_0x8c4d('0x5'));var csv=require(_0x8c4d('0x6'));var ejs=require(_0x8c4d('0x7'));var fs=require('fs');var fs_extra=require(_0x8c4d('0x8'));var _=require(_0x8c4d('0x9'));var squel=require(_0x8c4d('0xa'));var crypto=require(_0x8c4d('0xb'));var jsforce=require(_0x8c4d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8c4d('0x6'));var querystring=require(_0x8c4d('0xd'));var Papa=require(_0x8c4d('0xe'));var Redis=require(_0x8c4d('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8c4d('0x10'));var hardwareService=require(_0x8c4d('0x11'));var logger=require(_0x8c4d('0x12'))(_0x8c4d('0x13'));var utils=require(_0x8c4d('0x14'));var config=require(_0x8c4d('0x15'));var licenseUtil=require(_0x8c4d('0x16'));var db=require(_0x8c4d('0x17'))['db'];config['redis']=_[_0x8c4d('0x18')](config[_0x8c4d('0x19')],{'host':_0x8c4d('0x1a'),'port':0x18eb});var socket=require(_0x8c4d('0x1b'))(new Redis(config[_0x8c4d('0x19')]));require(_0x8c4d('0x1c'))[_0x8c4d('0x1d')](socket);function respondWithStatusCode(_0x220cfa,_0x51eb2e){_0x51eb2e=_0x51eb2e||0xcc;return function(_0x512f85){if(_0x512f85){return _0x220cfa[_0x8c4d('0x1e')](_0x51eb2e);}return _0x220cfa[_0x8c4d('0x1f')](_0x51eb2e)['end']();};}function respondWithResult(_0x355345,_0xe74783){_0xe74783=_0xe74783||0xc8;return function(_0x3e9b4c){if(_0x3e9b4c){return _0x355345['status'](_0xe74783)[_0x8c4d('0x20')](_0x3e9b4c);}};}function respondWithFilteredResult(_0x3d082f,_0xc906f2){return function(_0x3a9321){if(_0x3a9321){var _0x443030=typeof _0xc906f2['offset']===_0x8c4d('0x21')&&typeof _0xc906f2[_0x8c4d('0x22')]==='undefined';var _0x409568=_0x3a9321[_0x8c4d('0x23')];var _0x2ad16e=_0x443030?0x0:_0xc906f2[_0x8c4d('0x24')];var _0x1fcc76=_0x443030?_0x3a9321[_0x8c4d('0x23')]:_0xc906f2[_0x8c4d('0x24')]+_0xc906f2[_0x8c4d('0x22')];var _0x17708c;if(_0x1fcc76>=_0x409568){_0x1fcc76=_0x409568;_0x17708c=0xc8;}else{_0x17708c=0xce;}_0x3d082f['status'](_0x17708c);return _0x3d082f[_0x8c4d('0x25')](_0x8c4d('0x26'),_0x2ad16e+'-'+_0x1fcc76+'/'+_0x409568)[_0x8c4d('0x20')](_0x3a9321);}return null;};}function patchUpdates(_0x663624){return function(_0x1540e4){try{jsonpatch[_0x8c4d('0x27')](_0x1540e4,_0x663624,!![]);}catch(_0x54d835){return BPromise[_0x8c4d('0x28')](_0x54d835);}return _0x1540e4[_0x8c4d('0x29')]();};}function saveUpdates(_0x52114f,_0x20704b){return function(_0x5463cf){if(_0x5463cf){return _0x5463cf[_0x8c4d('0x2a')](_0x52114f)['then'](function(_0x2a0d83){return _0x2a0d83;});}return null;};}function removeEntity(_0x292602,_0x3f428b){return function(_0x34353a){if(_0x34353a){return _0x34353a[_0x8c4d('0x2b')]()[_0x8c4d('0x2c')](function(){_0x292602[_0x8c4d('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e63fb,_0x505385){return function(_0x13e772){if(!_0x13e772){_0x4e63fb[_0x8c4d('0x1e')](0x194);}return _0x13e772;};}function handleError(_0x4e2b2f,_0x3a4d88){_0x3a4d88=_0x3a4d88||0x1f4;return function(_0x2c829b){logger[_0x8c4d('0x2d')](_0x2c829b['stack']);if(_0x2c829b[_0x8c4d('0x2e')]){delete _0x2c829b[_0x8c4d('0x2e')];}_0x4e2b2f[_0x8c4d('0x1f')](_0x3a4d88)[_0x8c4d('0x2f')](_0x2c829b);};}exports[_0x8c4d('0x30')]=function(_0x2a973c,_0x5b35b6){var _0x45a417={},_0x36f9fe={},_0x50a353={'count':0x0,'rows':[]};var _0x47ea16=_['map'](db[_0x8c4d('0x31')][_0x8c4d('0x32')],function(_0xfbc382){return{'name':_0xfbc382[_0x8c4d('0x33')],'type':_0xfbc382[_0x8c4d('0x34')]['key']};});_0x36f9fe['model']=_['map'](_0x47ea16,_0x8c4d('0x2e'));_0x36f9fe[_0x8c4d('0x35')]=_[_0x8c4d('0x36')](_0x2a973c['query']);_0x36f9fe[_0x8c4d('0x37')]=_['intersection'](_0x36f9fe[_0x8c4d('0x38')],_0x36f9fe[_0x8c4d('0x35')]);_0x45a417[_0x8c4d('0x39')]=_[_0x8c4d('0x3a')](_0x36f9fe['model'],qs[_0x8c4d('0x3b')](_0x2a973c[_0x8c4d('0x35')][_0x8c4d('0x3b')]));_0x45a417[_0x8c4d('0x39')]=_0x45a417[_0x8c4d('0x39')][_0x8c4d('0x3c')]?_0x45a417[_0x8c4d('0x39')]:_0x36f9fe[_0x8c4d('0x38')];if(!_0x2a973c['query'][_0x8c4d('0x3d')]('nolimit')){_0x45a417[_0x8c4d('0x22')]=qs[_0x8c4d('0x22')](_0x2a973c[_0x8c4d('0x35')][_0x8c4d('0x22')]);_0x45a417[_0x8c4d('0x24')]=qs['offset'](_0x2a973c[_0x8c4d('0x35')][_0x8c4d('0x24')]);}_0x45a417[_0x8c4d('0x3e')]=qs[_0x8c4d('0x3f')](_0x2a973c[_0x8c4d('0x35')][_0x8c4d('0x3f')]);_0x45a417[_0x8c4d('0x40')]=qs[_0x8c4d('0x37')](_[_0x8c4d('0x41')](_0x2a973c[_0x8c4d('0x35')],_0x36f9fe[_0x8c4d('0x37')]),_0x47ea16);if(_0x2a973c['query'][_0x8c4d('0x42')]){_0x45a417[_0x8c4d('0x40')]=_['merge'](_0x45a417['where'],{'$or':_[_0x8c4d('0x43')](_0x47ea16,function(_0x2b032a){if(_0x2b032a[_0x8c4d('0x34')]!==_0x8c4d('0x44')){var _0x319f33={};_0x319f33[_0x2b032a[_0x8c4d('0x2e')]]={'$like':'%'+_0x2a973c[_0x8c4d('0x35')][_0x8c4d('0x42')]+'%'};return _0x319f33;}})});}_0x45a417=_['merge']({},_0x45a417,_0x2a973c[_0x8c4d('0x45')]);var _0x379c5e={'where':_0x45a417[_0x8c4d('0x40')]};return db['UserProfile'][_0x8c4d('0x23')](_0x379c5e)[_0x8c4d('0x2c')](function(_0x5d930c){_0x50a353[_0x8c4d('0x23')]=_0x5d930c;if(_0x2a973c['query'][_0x8c4d('0x46')]){_0x45a417[_0x8c4d('0x47')]=[{'all':!![]}];}return db[_0x8c4d('0x31')][_0x8c4d('0x48')](_0x45a417);})['then'](function(_0x3d95fd){_0x50a353[_0x8c4d('0x49')]=_0x3d95fd;return _0x50a353;})[_0x8c4d('0x2c')](respondWithFilteredResult(_0x5b35b6,_0x45a417))[_0x8c4d('0x4a')](handleError(_0x5b35b6,null));};exports['show']=function(_0x5b80df,_0x47a1b2){var _0x12f000={'raw':![],'where':{'id':_0x5b80df[_0x8c4d('0x4b')]['id']}},_0x4167d8={};_0x4167d8['model']=_['keys'](db[_0x8c4d('0x31')][_0x8c4d('0x32')]);_0x4167d8[_0x8c4d('0x35')]=_['keys'](_0x5b80df[_0x8c4d('0x35')]);_0x4167d8[_0x8c4d('0x37')]=_[_0x8c4d('0x3a')](_0x4167d8[_0x8c4d('0x38')],_0x4167d8[_0x8c4d('0x35')]);_0x12f000['attributes']=_[_0x8c4d('0x3a')](_0x4167d8['model'],qs['fields'](_0x5b80df[_0x8c4d('0x35')]['fields']));_0x12f000['attributes']=_0x12f000[_0x8c4d('0x39')][_0x8c4d('0x3c')]?_0x12f000[_0x8c4d('0x39')]:_0x4167d8[_0x8c4d('0x38')];if(_0x5b80df['query'][_0x8c4d('0x46')]){_0x12f000[_0x8c4d('0x47')]=[{'all':!![]}];}_0x12f000=_['merge']({},_0x12f000,_0x5b80df[_0x8c4d('0x45')]);return db[_0x8c4d('0x31')][_0x8c4d('0x4c')](_0x12f000)[_0x8c4d('0x2c')](handleEntityNotFound(_0x47a1b2,null))[_0x8c4d('0x2c')](respondWithResult(_0x47a1b2,null))['catch'](handleError(_0x47a1b2,null));};exports[_0x8c4d('0x4d')]=function(_0x1b7801,_0x3018e2){return db[_0x8c4d('0x31')]['create'](_0x1b7801[_0x8c4d('0x4e')],{})[_0x8c4d('0x2c')](respondWithResult(_0x3018e2,0xc9))[_0x8c4d('0x4a')](handleError(_0x3018e2,null));};exports[_0x8c4d('0x4f')]=function(_0x3887bf,_0x2a25ed){var _0x232fbe={'where':{'id':_0x3887bf[_0x8c4d('0x4b')]['id']}},_0x273864={};_0x273864[_0x8c4d('0x38')]=_[_0x8c4d('0x36')](db[_0x8c4d('0x31')][_0x8c4d('0x32')]);_0x232fbe[_0x8c4d('0x39')]=_[_0x8c4d('0x3a')](_0x273864[_0x8c4d('0x38')],qs[_0x8c4d('0x3b')](_0x3887bf[_0x8c4d('0x35')][_0x8c4d('0x3b')]));_0x232fbe[_0x8c4d('0x39')]=_0x232fbe['attributes'][_0x8c4d('0x3c')]?_0x232fbe[_0x8c4d('0x39')]:_0x273864['model'];if(_0x3887bf[_0x8c4d('0x35')][_0x8c4d('0x46')]){_0x232fbe[_0x8c4d('0x47')]=[{'all':!![]}];}_0x232fbe=_[_0x8c4d('0x50')]({},_0x232fbe,_0x3887bf[_0x8c4d('0x45')]);return db[_0x8c4d('0x31')]['find'](_0x232fbe)['then'](handleEntityNotFound(_0x2a25ed,null))['then'](function(_0x503bb6){if(_0x503bb6){var _0x5add43=_0x503bb6['get']({'plain':!![]});_0x5add43=qs['omit'](_0x5add43,['id',_0x8c4d('0x51'),'updatedAt','crudPermissions']);_0x3887bf[_0x8c4d('0x4e')]=_[_0x8c4d('0x52')](_0x3887bf[_0x8c4d('0x4e')],['id','createdAt',_0x8c4d('0x53')]);return db[_0x8c4d('0x54')][_0x8c4d('0x55')](function(_0x3b94b2){return db[_0x8c4d('0x31')][_0x8c4d('0x4d')](_['merge'](_0x5add43,_0x3887bf['body']),{'include':_0x3887bf[_0x8c4d('0x35')][_0x8c4d('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x3b94b2})[_0x8c4d('0x2c')](function(_0x9b7e0c){var _0x40fc8c=_0x9b7e0c[_0x8c4d('0x56')]({'plain':!![]});return db[_0x8c4d('0x57')][_0x8c4d('0x48')]({'where':{'userProfileId':_0x3887bf['params']['id']},'raw':!![]})[_0x8c4d('0x2c')](function(_0x4ecc28){if(_0x4ecc28){return BPromise[_0x8c4d('0x58')](_0x4ecc28,function(_0x529e85){return new BPromise(function(_0x3e3607,_0x5afbe1){if(_0x529e85[_0x8c4d('0x59')]===null||_0x529e85['autoAssociation']===0x1)_0x3e3607(null);return db[_0x8c4d('0x5a')][_0x8c4d('0x48')]({'where':{'sectionId':_0x529e85['id']},'raw':!![]})[_0x8c4d('0x2c')](function(_0x301beb){var _0x33e142=_[_0x8c4d('0x43')](_0x301beb,function(_0x4aa4df){return qs[_0x8c4d('0x52')](_0x4aa4df,['id',_0x8c4d('0x51'),_0x8c4d('0x53'),_0x8c4d('0x5b')]);});_0x3e3607(_0x33e142);})[_0x8c4d('0x4a')](function(_0x2e5465){_0x5afbe1(_0x2e5465);});})['then'](function(_0x344345){var _0xdf133e=qs[_0x8c4d('0x52')](_0x529e85,['id',_0x8c4d('0x51'),'updatedAt']);_0xdf133e[_0x8c4d('0x5c')]=_0x40fc8c['id'];if(_0x344345)_0xdf133e['Resources']=_0x344345;return _0xdf133e;})['then'](function(_0x4c6530){return db[_0x8c4d('0x57')][_0x8c4d('0x4d')](_0x4c6530,{'include':[{'model':db[_0x8c4d('0x5a')],'as':_0x8c4d('0x5d')}],'raw':!![],'transaction':_0x3b94b2});});})['then'](function(){return _0x40fc8c;});}});});});}})[_0x8c4d('0x2c')](respondWithResult(_0x2a25ed,0xc9))[_0x8c4d('0x4a')](handleError(_0x2a25ed,null));};exports['update']=function(_0x914dbc,_0x289d5d){if(_0x914dbc[_0x8c4d('0x4e')]['id']){delete _0x914dbc[_0x8c4d('0x4e')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x914dbc[_0x8c4d('0x4b')]['id']}})[_0x8c4d('0x2c')](handleEntityNotFound(_0x289d5d,null))['then'](saveUpdates(_0x914dbc[_0x8c4d('0x4e')],null))[_0x8c4d('0x2c')](respondWithResult(_0x289d5d,null))[_0x8c4d('0x4a')](handleError(_0x289d5d,null));};exports[_0x8c4d('0x2b')]=function(_0x47df6a,_0x45147){return db['UserProfile'][_0x8c4d('0x4c')]({'where':{'id':_0x47df6a[_0x8c4d('0x4b')]['id']}})[_0x8c4d('0x2c')](handleEntityNotFound(_0x45147,null))[_0x8c4d('0x2c')](removeEntity(_0x45147,null))[_0x8c4d('0x4a')](handleError(_0x45147,null));};exports[_0x8c4d('0x5e')]=function(_0x25aec4,_0xbfbc1b){return db['UserProfile'][_0x8c4d('0x5e')]()[_0x8c4d('0x2c')](respondWithResult(_0xbfbc1b,null))['catch'](handleError(_0xbfbc1b,null));};exports['addSections']=function(_0x553e76,_0x29dc89){var _0x1bf919=_0x553e76[_0x8c4d('0x4e')];return db['UserProfile']['find']({'where':{'id':_0x553e76[_0x8c4d('0x4b')]['id']}})[_0x8c4d('0x2c')](handleEntityNotFound(_0x29dc89,null))['then'](function(_0x53105d){if(_0x53105d){return db[_0x8c4d('0x54')][_0x8c4d('0x55')](function(_0x503f18){return db[_0x8c4d('0x57')][_0x8c4d('0x2b')]({'where':{'userProfileId':_0x553e76[_0x8c4d('0x4b')]['id'],'sectionId':_[_0x8c4d('0x43')](_0x1bf919,function(_0xbd026c){return _0xbd026c[_0x8c4d('0x5b')];})},'transaction':_0x503f18})[_0x8c4d('0x2c')](function(){var _0x4c5821=_[_0x8c4d('0x43')](_0x1bf919,function(_0x3e96aa){_0x3e96aa[_0x8c4d('0x5c')]=_0x553e76[_0x8c4d('0x4b')]['id'];return _0x3e96aa;});var _0x1cde9f=[];return BPromise[_0x8c4d('0x58')](_0x4c5821,function(_0x3f2b0e){return db[_0x8c4d('0x57')]['create'](_0x3f2b0e,{'include':[{'model':db[_0x8c4d('0x5a')],'as':'Resources'}],'raw':!![],'transaction':_0x503f18})['then'](function(_0x9e6cb8){_0x1cde9f[_0x8c4d('0x5f')](_0x9e6cb8[_0x8c4d('0x56')]({'plain':!![]}));});})[_0x8c4d('0x2c')](function(){return _0x1cde9f;});});});}})[_0x8c4d('0x2c')](function(_0x3f9612){return _0x3f9612;})[_0x8c4d('0x2c')](respondWithResult(_0x29dc89,null))[_0x8c4d('0x4a')](handleError(_0x29dc89,null));};exports[_0x8c4d('0x60')]=function(_0x25af6c,_0x137ee5){var _0x4f9bb8;return db['UserProfile']['find']({'where':{'id':_0x25af6c['params']['id']},'attributes':['id',_0x8c4d('0x2e')]})['then'](handleEntityNotFound(_0x137ee5,null))[_0x8c4d('0x2c')](function(_0x3d4f68){if(_0x3d4f68){_0x4f9bb8=_0x3d4f68;return db[_0x8c4d('0x57')][_0x8c4d('0x2b')]({'where':{'userProfileId':_0x25af6c[_0x8c4d('0x4b')]['id'],'sectionId':_0x25af6c[_0x8c4d('0x35')][_0x8c4d('0x61')]}});}})[_0x8c4d('0x2c')](function(){return _0x4f9bb8;})[_0x8c4d('0x2c')](respondWithStatusCode(_0x137ee5,null))[_0x8c4d('0x4a')](handleError(_0x137ee5,null));};exports[_0x8c4d('0x62')]=function(_0x195344,_0x4f3471){var _0x1db5ea=[];var _0xf24fdf=[];return db['UserProfileSection'][_0x8c4d('0x48')]({'where':{'userProfileId':_0x195344['params']['id']},'raw':!![]})[_0x8c4d('0x2c')](function(_0x32e9a6){_0x1db5ea=_[_0x8c4d('0x42')](_0x32e9a6,function(_0x422566){return _0x422566[_0x8c4d('0x63')]===0x1||_[_0x8c4d('0x64')]([0x3eb,0x709],_0x422566[_0x8c4d('0x5b')]);});if(!_['isEmpty'](_0x1db5ea)){return _[_0x8c4d('0x43')](_0x1db5ea,function(_0x3b982d){return _0x3b982d[_0x8c4d('0x5b')];});}else{return;}})[_0x8c4d('0x2c')](function(_0x40e2f2){if(_0x40e2f2)_0xf24fdf=_0x40e2f2;if(_['includes'](_0xf24fdf,0x64)){var _0x774189=_[_0x8c4d('0x4c')](_0x1db5ea,{'sectionId':0x64});return hasDefaultDashboard(_0x774189)[_0x8c4d('0x2c')](function(_0x30a38b){return _[_0x8c4d('0x43')](_0x1db5ea,function(_0x4458f4){if(_0x4458f4[_0x8c4d('0x5b')]===0x64){_0x4458f4[_0x8c4d('0x65')]=_0x30a38b;}return _0x4458f4;});});}else{return;}})[_0x8c4d('0x2c')](function(_0x2b28e5){if(_0x2b28e5)_0x1db5ea=_0x2b28e5;if(_[_0x8c4d('0x64')](_0xf24fdf,0x3eb)){var _0x121667=_['find'](_0x1db5ea,{'sectionId':0x3eb});return getCustomDashboards(_0x121667)[_0x8c4d('0x2c')](function(_0x38bd1e){return _['map'](_0x1db5ea,function(_0x264a82){if(_0x121667['enabled']){if(_0x264a82[_0x8c4d('0x5b')]===0x3eb){_0x264a82[_0x8c4d('0x65')]=_0x38bd1e;}}else{if(_0x264a82[_0x8c4d('0x5b')]===0x64){_0x264a82[_0x8c4d('0x65')]=_0x38bd1e;}}return _0x264a82;});});}else{return;}})[_0x8c4d('0x2c')](function(_0x27c235){if(_0x27c235)_0x1db5ea=_0x27c235;if(_['includes'](_0xf24fdf,0x709)){var _0x27214d=_[_0x8c4d('0x4c')](_0x1db5ea,{'sectionId':0x709});return getPlugins(_0x27214d)[_0x8c4d('0x2c')](function(_0x37c558){if(_0x27214d['enabled']){return _[_0x8c4d('0x43')](_0x1db5ea,function(_0x868cd3){if(_0x868cd3[_0x8c4d('0x5b')]===0x709){_0x868cd3['subsections']=_0x37c558;}return _0x868cd3;});}else{var _0x32c2ea={'sectionId':0x76c,'enabled':0x1,'subsections':_0x37c558};var _0x1b8ff0=_[_0x8c4d('0x43')](_0x1db5ea);_0x1b8ff0[_0x8c4d('0x5f')](_0x32c2ea);return _0x1b8ff0;}});}else{return;}})[_0x8c4d('0x2c')](function(_0xe2203a){if(_0xe2203a)_0x1db5ea=_0xe2203a;return _['filter'](_0x1db5ea,[_0x8c4d('0x63'),0x1]);})['then'](respondWithResult(_0x4f3471,null))[_0x8c4d('0x4a')](handleError(_0x4f3471,null));};function hasDefaultDashboard(_0x83dbda){var _0x5d3471=[0x65];return new BPromise(function(_0x12b6d9,_0x26f6ed){try{if(_0x83dbda[_0x8c4d('0x59')]){_0x12b6d9(_0x5d3471);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x83dbda['id']},'raw':!![]})[_0x8c4d('0x2c')](function(_0x509f4){_0x509f4?_0x12b6d9(_0x5d3471):_0x12b6d9();});}}catch(_0x232388){_0x26f6ed(_0x232388);}});}function getCustomDashboards(_0x5d45ec){var _0x40e3ac=[];return new BPromise(function(_0x5a41de,_0x3dbc35){try{if(_0x5d45ec[_0x8c4d('0x59')]){return db[_0x8c4d('0x66')][_0x8c4d('0x48')]({'raw':!![]})[_0x8c4d('0x2c')](function(_0x1ef244){_0x1ef244[_0x8c4d('0x67')](function(_0xd265ce){_0x40e3ac['push'](_0xd265ce['id']+0x1869f);});_0x5a41de(_0x40e3ac);});}else{return db[_0x8c4d('0x5a')]['findAll']({'where':{'sectionId':_0x5d45ec['id']},'raw':!![]})[_0x8c4d('0x2c')](function(_0xf80fad){_0xf80fad[_0x8c4d('0x67')](function(_0x4d851f){_0x40e3ac['push'](_0x4d851f['resourceId']+0x1869f);});_0x5a41de(_0x40e3ac);});}}catch(_0xebd33a){_0x3dbc35(_0xebd33a);}});}function getPlugins(_0x43a5df){var _0x1a6bf3=[];return new BPromise(function(_0x2ebdec,_0x3c0128){try{if(_0x43a5df['autoAssociation']){return db[_0x8c4d('0x68')][_0x8c4d('0x48')]({'raw':!![]})[_0x8c4d('0x2c')](function(_0x5e2c4a){_0x5e2c4a[_0x8c4d('0x67')](function(_0x336070){_0x1a6bf3[_0x8c4d('0x5f')](_0x336070['id']+0x15b38);});_0x2ebdec(_0x1a6bf3);});}else{return db[_0x8c4d('0x5a')][_0x8c4d('0x48')]({'where':{'sectionId':_0x43a5df['id']},'raw':!![]})[_0x8c4d('0x2c')](function(_0x42ee4a){_0x42ee4a[_0x8c4d('0x67')](function(_0xedbe53){_0x1a6bf3[_0x8c4d('0x5f')](_0xedbe53[_0x8c4d('0x69')]+0x15b38);});_0x2ebdec(_0x1a6bf3);});}}catch(_0x5159c2){_0x3c0128(_0x5159c2);}});}exports[_0x8c4d('0x6a')]=function(_0x44d815,_0x2a1961){return db[_0x8c4d('0x31')]['find']({'where':{'id':_0x44d815[_0x8c4d('0x4b')]['id']}})[_0x8c4d('0x2c')](handleEntityNotFound(_0x2a1961,null))['then'](function(_0x1fb279){if(_0x1fb279){return db['sequelize'][_0x8c4d('0x55')](function(_0xf29d7e){return db[_0x8c4d('0x57')][_0x8c4d('0x48')]({'where':{'userProfileId':_0x44d815[_0x8c4d('0x4b')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x342a16){if(_0x342a16){return db[_0x8c4d('0x57')][_0x8c4d('0x2b')]({'where':{'userProfileId':_0x44d815[_0x8c4d('0x4b')]['id'],'id':_['map'](_0x342a16,function(_0x2da2b9){return _0x2da2b9['id'];})},'transaction':_0xf29d7e});}})[_0x8c4d('0x2c')](function(_0x16e315){var _0x29f13d=_[_0x8c4d('0x43')](_0x44d815['body'],function(_0x43d5df){_0x43d5df[_0x8c4d('0x5c')]=_0x44d815['params']['id'];return _0x43d5df;});return db[_0x8c4d('0x57')][_0x8c4d('0x6b')](_0x29f13d,{'raw':!![],'transaction':_0xf29d7e});})[_0x8c4d('0x2c')](function(_0x4d3ca2){var _0x13fc1e=_[_0x8c4d('0x42')](_[_0x8c4d('0x43')](_0x4d3ca2,function(_0x329bfe){return _0x329bfe['get']({'plain':!![]});}),{'includeAll':![]});if(_0x13fc1e){return db[_0x8c4d('0x57')][_0x8c4d('0x48')]({'where':{'userProfileId':_0x44d815['params']['id'],'sectionId':_[_0x8c4d('0x43')](_0x13fc1e,function(_0x288ce5){return _0x288ce5[_0x8c4d('0x5b')];})},'attributes':['id',_0x8c4d('0x5b')],'raw':!![]})[_0x8c4d('0x2c')](function(_0xe386e7){var _0x31d484=_[_0x8c4d('0x43')](_0x44d815[_0x8c4d('0x4e')],function(_0x41447c){_0x41447c[_0x8c4d('0x5c')]=_0x44d815[_0x8c4d('0x4b')]['id'];return _0x41447c;});return db[_0x8c4d('0x5a')]['bulkCreate'](_0x31d484,{'raw':!![],'transaction':_0xf29d7e});});}})['catch'](handleError(_0x2a1961,null));});}})['then'](function(_0x29c4db){var _0x15eec6=_[_0x8c4d('0x43')](_0x29c4db,function(_0x2d26f2){return _0x2d26f2['get']({'plain':!![]});});})[_0x8c4d('0x2c')](respondWithResult(_0x2a1961,null))['catch'](handleError(_0x2a1961,null));};exports['removeResources']=function(_0x1199e8,_0x2cd8c7,_0x3d1f1d){return db['UserProfile'][_0x8c4d('0x4c')]({'where':{'id':_0x1199e8['params']['id']}})[_0x8c4d('0x2c')](handleEntityNotFound(_0x2cd8c7,null))['then'](function(_0x4199d7){if(_0x4199d7){return _0x4199d7[_0x8c4d('0x6c')](_0x1199e8[_0x8c4d('0x35')]['ids']);}})[_0x8c4d('0x2c')](respondWithStatusCode(_0x2cd8c7,null))[_0x8c4d('0x4a')](handleError(_0x2cd8c7,null));};exports['getResources']=function(_0x2e1732,_0x995ba9){var _0x1c9f93={};if(!_0x2e1732[_0x8c4d('0x35')][_0x8c4d('0x6d')])throw new Error(_0x8c4d('0x6e'));if(!_0x2e1732['query'][_0x8c4d('0x3d')](_0x8c4d('0x6f'))){_0x1c9f93[_0x8c4d('0x22')]=qs['limit'](_0x2e1732['query']['limit']);_0x1c9f93['offset']=qs['offset'](_0x2e1732['query'][_0x8c4d('0x24')]);}return db[_0x8c4d('0x31')][_0x8c4d('0x4c')]({'where':{'id':_0x2e1732[_0x8c4d('0x4b')]['id']}})['then'](function(_0x1786b6){if(!_0x1786b6)throw new Error(_0x8c4d('0x70')+_0x2e1732['params']['id']);return db['UserProfile'][_0x8c4d('0x71')](_0x2e1732);})[_0x8c4d('0x2c')](respondWithFilteredResult(_0x995ba9,_0x1c9f93))[_0x8c4d('0x4a')](handleError(_0x995ba9,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 5d8c8b4..7388744 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 _0xc0d7=['save','update','remove','emit','hasOwnProperty','hook','exports','setMaxListeners'];(function(_0x19e5e0,_0x330a80){var _0x1b3b53=function(_0x50a9bf){while(--_0x50a9bf){_0x19e5e0['push'](_0x19e5e0['shift']());}};_0x1b3b53(++_0x330a80);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x4d49a9,_0x4c2dff){_0x4d49a9=_0x4d49a9-0x0;var _0x4fd2d1=_0xc0d7[_0x4d49a9];return _0x4fd2d1;};'use strict';var EventEmitter=require('events');var UserProfile=require('../../mysqldb')['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x7c0d('0x0')](0x0);var events={'afterCreate':_0x7c0d('0x1'),'afterUpdate':_0x7c0d('0x2'),'afterDestroy':_0x7c0d('0x3')};function emitEvent(_0x2c03ef){return function(_0x2e1cc8,_0xfbd3c8,_0x276b49){UserProfileEvents[_0x7c0d('0x4')](_0x2c03ef+':'+_0x2e1cc8['id'],_0x2e1cc8);UserProfileEvents['emit'](_0x2c03ef,_0x2e1cc8);_0x276b49(null);};}for(var e in events){if(events[_0x7c0d('0x5')](e)){var event=events[e];UserProfile[_0x7c0d('0x6')](e,emitEvent(event));}}module[_0x7c0d('0x7')]=UserProfileEvents; \ No newline at end of file +var _0xdf55=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x24a72f,_0x2d8498){var _0x35f0e6=function(_0x80354a){while(--_0x80354a){_0x24a72f['push'](_0x24a72f['shift']());}};_0x35f0e6(++_0x2d8498);}(_0xdf55,0x83));var _0x5df5=function(_0x3014a4,_0x56b5aa){_0x3014a4=_0x3014a4-0x0;var _0x4ff3da=_0xdf55[_0x3014a4];return _0x4ff3da;};'use strict';var EventEmitter=require(_0x5df5('0x0'));var UserProfile=require(_0x5df5('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x5df5('0x2')](0x0);var events={'afterCreate':_0x5df5('0x3'),'afterUpdate':'update','afterDestroy':_0x5df5('0x4')};function emitEvent(_0x773e15){return function(_0x381a4c,_0x521007,_0x289af4){UserProfileEvents[_0x5df5('0x5')](_0x773e15+':'+_0x381a4c['id'],_0x381a4c);UserProfileEvents[_0x5df5('0x5')](_0x773e15,_0x381a4c);_0x289af4(null);};}for(var e in events){if(events[_0x5df5('0x6')](e)){var event=events[e];UserProfile[_0x5df5('0x7')](e,emitEvent(event));}}module[_0x5df5('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 3770c74..38b34ca 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 _0xbd0e=['attributes','fields','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','includeAll','include','forEach','reportType','custom','CustomReports','rows','count','Tags','tag','ThroughTags','color','openTabs','true','dataValues','sms','fax','mail','openchannel','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','associatedResources','map','model','then','name','catch','resolve','resourceId','toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','parentSections','projectName','projects','JscriptyProject','Lists','ListId','lists','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','Telephones','VoiceQueues','queue','type','inbound','VoiceQueue','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','QueueCampaigns','telephones','User','Users','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','CannedAnswer','Disposition','customdashboards','Dashboard','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Trigger','variables','Variable','plugins','Plugin','AnalyticExtractedReport','Reports','reportId','AnalyticMetric','charAt','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','define','UserProfile','user_profiles','raw','query','section','mergeResources','isEmpty','length','UserProfileSection','find','params','ignore','union','push','all','rawAttributes','keys','filters','intersection'];(function(_0x477a31,_0x4fba69){var _0x8bdd2b=function(_0x34e5e1){while(--_0x34e5e1){_0x477a31['push'](_0x477a31['shift']());}};_0x8bdd2b(++_0x4fba69);}(_0xbd0e,0x187));var _0xebd0=function(_0x2b2e8c,_0x54f172){_0x2b2e8c=_0x2b2e8c-0x0;var _0x4e8fac=_0xbd0e[_0x2b2e8c];return _0x4e8fac;};'use strict';var _=require('lodash');var attributes=require(_0xebd0('0x0'));var qs=require('../../components/parsers/qs');var squel=require(_0xebd0('0x1'));module[_0xebd0('0x2')]=function(_0xa363c8){var _0x21dc43=_0xa363c8[_0xebd0('0x3')];function _0x811ddd(_0x4df56d,_0x54075a){return new Promise(function(_0x273e32,_0x3ce784){if(!_0x54075a)return _0x273e32(null);var _0x2f0192=_0x54075a[_0xebd0('0x4')]?{[_0x54075a[_0xebd0('0x4')][_0xebd0('0x5')]]:_0x54075a[_0xebd0('0x4')][_0xebd0('0x6')]}:undefined;return _0x21dc43[_0x4df56d][_0xebd0('0x7')]({'where':_0x2f0192,'raw':!![]})['then'](function(_0xb1010d){_0x54075a[_0xebd0('0x8')]=_[_0xebd0('0x9')](_0xb1010d,'id');_0x273e32(_0x54075a);})['catch'](function(_0xbec226){_0x3ce784(_0xbec226);});});}function _0x1346d1(_0x50cf8a,_0x510100){return new Promise(function(_0xb15b3e,_0x1b5b51){var _0x24f22a=_0x50cf8a[_0xebd0('0x4')]?{[_0x50cf8a[_0xebd0('0x4')]['field']]:_0x50cf8a[_0xebd0('0x4')][_0xebd0('0x6')]}:undefined;return _0x21dc43[_0x50cf8a[_0xebd0('0xa')]]['findAll']({'where':_0x24f22a,'raw':!![]})[_0xebd0('0xb')](function(_0x22c014){_0x510100[_0xebd0('0x8')]=_[_0xebd0('0x9')](_0x22c014,function(_0x248ad0){return _0x248ad0[_0xebd0('0xc')];});_0xb15b3e(_0x510100);})[_0xebd0('0xd')](function(_0x44822c){_0x1b5b51(_0x44822c);});});}function _0x25097c(_0x426f14,_0x21bef5,_0x20b5f4){if(!_0x21bef5)return Promise[_0xebd0('0xe')](null);return new Promise(function(_0x20244d,_0x3a58e0){return _0x21dc43['UserProfileResource'][_0xebd0('0x7')]({'where':{'sectionId':_0x21bef5['id']},'raw':!![]})[_0xebd0('0xb')](function(_0xb9309b){if(_0x426f14[_0xebd0('0x5')]&&_0x426f14['field']!=='id'){_0x21bef5[_0xebd0('0x8')]=_[_0xebd0('0x9')](_0xb9309b,function(_0x51774c){return _0x51774c[_0x426f14[_0xebd0('0x5')]];});}else{if(_0x20b5f4==='AnalyticExtractedReport'){_0x21bef5[_0xebd0('0x8')]=_[_0xebd0('0x9')](_0xb9309b,function(_0x287c68){return{'id':_0x287c68[_0xebd0('0xf')],'type':_0x287c68['type']};});}else{_0x21bef5[_0xebd0('0x8')]=_['map'](_0xb9309b,function(_0x2970e7){return _0x2970e7[_0xebd0('0xf')];});}}_0x20244d(_0x21bef5);})[_0xebd0('0xd')](function(_0x54725d){_0x3a58e0(_0x54725d);});});}function _0x234548(_0x47fe4,_0x254979){var _0x507343={'parentSections':[]};switch(_0x47fe4[_0xebd0('0x10')]()){case _0xebd0('0x11'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x13');break;case'odbc':_0x507343['childModel']=_0xebd0('0x14');break;case _0xebd0('0x15'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x16');_0x507343[_0xebd0('0x17')]=[{'name':'SquareProjects','field':_0xebd0('0xc'),'foreignKey':_0xebd0('0x18')}];break;case _0xebd0('0x19'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x1a');break;case'contacts':_0x507343['childModel']='CmContact';_0x507343['parentSections']=[{'name':_0xebd0('0x1b'),'field':'id','foreignKey':_0xebd0('0x1c')}];break;case _0xebd0('0x1d'):_0x507343['childModel']='CmList';break;case'companies':_0x507343[_0xebd0('0x12')]=_0xebd0('0x1e');break;case _0xebd0('0x1f'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x20');break;case _0xebd0('0x21'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x22');break;case'chatwebsites':_0x507343[_0xebd0('0x12')]=_0xebd0('0x23');break;case _0xebd0('0x24'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x25');break;case _0xebd0('0x26'):_0x507343['childModel']=_0xebd0('0x27');break;case'inboundroutes':case'internalroutes':case'outboundroutes':_0x507343[_0xebd0('0x12')]=_0xebd0('0x28');break;case _0xebd0('0x29'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x2a');break;case'voicemails':_0x507343[_0xebd0('0x12')]=_0xebd0('0x2b');break;case _0xebd0('0x2c'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x2d');_0x507343[_0xebd0('0x17')]=[{'name':_0xebd0('0x2e'),'field':_0xebd0('0xc'),'foreignKey':_0xebd0('0x2f'),'model':'User','filter':{'field':_0xebd0('0x30'),'value':['agent']}},{'name':_0xebd0('0x31'),'field':_0xebd0('0xc'),'foreignKey':_0xebd0('0x2f'),'model':'User','filter':{'field':_0xebd0('0x30'),'value':['telephone']}},{'name':_0xebd0('0x32'),'field':_0xebd0('0xc'),'foreignKey':_0xebd0('0x33'),'model':'VoiceQueue','filter':{'field':_0xebd0('0x34'),'value':[_0xebd0('0x35')]}},{'name':'QueueCampaigns','field':_0xebd0('0xc'),'foreignKey':_0xebd0('0x33'),'model':_0xebd0('0x36'),'filter':{'field':_0xebd0('0x34'),'value':['outbound']}}];break;case _0xebd0('0x37'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x38');break;case _0xebd0('0x39'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x3a');break;case _0xebd0('0x3b'):_0x507343[_0xebd0('0x12')]='VoicePrefix';break;case'ivrcampaigns':_0x507343[_0xebd0('0x12')]='Campaign';break;case'mailqueues':_0x507343['childModel']='MailQueue';break;case _0xebd0('0x3c'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x3d');break;case _0xebd0('0x3e'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x3f');break;case _0xebd0('0x40'):_0x507343['childModel']=_0xebd0('0x41');break;case _0xebd0('0x42'):_0x507343[_0xebd0('0x12')]='OpenchannelAccount';break;case'smsqueues':_0x507343[_0xebd0('0x12')]='SmsQueue';break;case _0xebd0('0x43'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x44');break;case _0xebd0('0x45'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x46');break;case _0xebd0('0x47'):_0x507343['childModel']=_0xebd0('0x48');break;case _0xebd0('0x49'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x4a');break;case _0xebd0('0x4b'):case _0xebd0('0x4c'):_0x507343['childModel']=_0xebd0('0x36');if(_0x254979){_0x507343['parentSections']=[{'name':'VoiceQueues'},{'name':_0xebd0('0x4d')}];}break;case'users':case'agents':case _0xebd0('0x4e'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x4f');if(_0x254979){_0x507343[_0xebd0('0x17')]=[{'name':_0xebd0('0x50'),'filter':{'field':'role','value':[_0xebd0('0x51'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0xebd0('0x31')}];}break;case _0xebd0('0x52'):_0x507343['childModel']=_0xebd0('0x53');break;case _0xebd0('0x54'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x55');break;case _0xebd0('0x56'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x57');break;case _0xebd0('0x58'):_0x507343[_0xebd0('0x12')]='SugarcrmAccount';break;case _0xebd0('0x59'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x5a');break;case _0xebd0('0x5b'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x5c');break;case'vtigeraccounts':_0x507343[_0xebd0('0x12')]=_0xebd0('0x4f');break;case'cannedanswers':_0x507343[_0xebd0('0x12')]=_0xebd0('0x5d');break;case'dispositions':_0x507343[_0xebd0('0x12')]=_0xebd0('0x5e');break;case _0xebd0('0x5f'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x60');break;case'intervals':_0x507343['childModel']=_0xebd0('0x61');break;case _0xebd0('0x62'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x63');break;case _0xebd0('0x64'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x65');break;case _0xebd0('0x66'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x67');break;case _0xebd0('0x68'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x69');break;case _0xebd0('0x6a'):_0x507343['childModel']='Template';break;case'triggers':_0x507343[_0xebd0('0x12')]=_0xebd0('0x6b');break;case'trunks':_0x507343['childModel']='Trunk';break;case _0xebd0('0x6c'):_0x507343['childModel']=_0xebd0('0x6d');break;case _0xebd0('0x6e'):_0x507343[_0xebd0('0x12')]=_0xebd0('0x6f');break;case'extractedreports':_0x507343[_0xebd0('0x12')]=_0xebd0('0x70');_0x507343[_0xebd0('0x17')]=[{'name':_0xebd0('0x71'),'field':'id','foreignKey':_0xebd0('0x72')}];break;case'metrics':_0x507343[_0xebd0('0x12')]=_0xebd0('0x73');break;}return _0x507343;}function _0x53e1f3(_0x1b0c3e,_0x6b041){var _0x1ae070=_0x1b0c3e[_0xebd0('0x74')](0x0)['toUpperCase']()+_0x1b0c3e['slice'](0x1);var _0x1918e7={'type':_0x21dc43[_0xebd0('0x75')][_0xebd0('0x76')][_0xebd0('0x77')],'raw':!![]};return new Promise(function(_0x1216fd,_0x229902){var _0xaffeef=squel[_0xebd0('0x78')]()[_0xebd0('0x5')](_0xebd0('0x79')+_0x1ae070+_0xebd0('0x7a'),'id')['field']('ui.createdAt')['from'](_0xebd0('0x7b')+_0x1b0c3e+_0xebd0('0x7c'),'ui')[_0xebd0('0x7d')](_0xebd0('0x7e'),_0x6b041['id']);return _0x21dc43[_0xebd0('0x7f')]['query'](_0xaffeef[_0xebd0('0x80')](),_0x1918e7)['then'](function(_0x2492b5){_0x6b041[_0x1ae070+'OpenTabs']=_0x2492b5;_0x1216fd(_0x2492b5);})[_0xebd0('0xd')](function(_0x38a865){_0x229902(_0x38a865);});});}return _0xa363c8[_0xebd0('0x81')](_0xebd0('0x82'),attributes,{'tableName':_0xebd0('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x32010c){var _0x346c1d={'raw':_0x32010c['query'][_0xebd0('0x84')],'where':{}};var _0x3b1e3e={};var _0x2e054d={'count':0x0,'rows':[]};var _0x363ba3=_0x32010c[_0xebd0('0x85')][_0xebd0('0x86')];var _0x1bf156=_0x32010c['query'][_0xebd0('0x87')]||![];var _0x2fa15d=_0x234548(_0x363ba3,_0x1bf156);if(!_0x2fa15d['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x363ba3+'\x27');var _0x4ca302=[{'name':_0x363ba3}];if(!_[_0xebd0('0x88')](_0x2fa15d[_0xebd0('0x17')]))_0x4ca302=_0x2fa15d[_0xebd0('0x17')];var _0x1f520f=[];for(var _0x2b854b=0x0;_0x2b854b<_0x4ca302[_0xebd0('0x89')];_0x2b854b++){_0x1f520f['push'](_0x21dc43[_0xebd0('0x8a')][_0xebd0('0x8b')]({'where':{'userProfileId':_0x32010c[_0xebd0('0x8c')]['id'],'name':_0x4ca302[_0x2b854b][_0xebd0('0xc')]},'raw':!![]}));}return Promise['all'](_0x1f520f)['then'](function(_0x106d9d){var _0x11de1b=_[_0xebd0('0x4')](_0x106d9d,function(_0x222143){return _0x222143?_0x222143:undefined;});var _0x1416dc=_[_0xebd0('0x4')](_0x4ca302,[_0xebd0('0x8d'),!![]]);var _0x3a4758=_[_0xebd0('0x88')](_0x11de1b)&&_[_0xebd0('0x88')](_0x1416dc)?null:_[_0xebd0('0x8e')](_0x1416dc,_0x11de1b);if(!_0x3a4758)return null;var _0x134320=[];for(var _0x5e6e4d=0x0;_0x5e6e4d<_0x3a4758[_0xebd0('0x89')];_0x5e6e4d++){var _0x291978=_[_0xebd0('0x8b')](_0x4ca302,function(_0x1c460a){return _0x3a4758[_0x5e6e4d]?_0x1c460a[_0xebd0('0xc')]===_0x3a4758[_0x5e6e4d][_0xebd0('0xc')]:null;});if(_0x291978){if(_0x3a4758[_0x5e6e4d]['ignore']){_0x134320[_0xebd0('0x8f')](_0x811ddd(_0x2fa15d['childModel'],_0x3a4758[_0x5e6e4d]));}else{if(!_0x3a4758[_0x5e6e4d]['autoAssociation']){_0x134320[_0xebd0('0x8f')](_0x25097c(_0x291978,_0x3a4758[_0x5e6e4d],_0x2fa15d['childModel']));}else{if(_0x291978[_0xebd0('0xa')]){_0x134320['push'](_0x1346d1(_0x291978,_0x3a4758[_0x5e6e4d]));}}}}}return Promise[_0xebd0('0x90')](_0x134320);})['then'](function(_0x3c326f){var _0x3b29fe=_0x3c326f;var _0x30ad47=null;if(_0x3b29fe){_0x30ad47=_0x3b29fe['length']===0x1?_0x3b29fe[0x0]:null;}if(!_0x30ad47&&!_0x3b29fe)return _0x2e054d;var _0x10471b=_0x21dc43[_0x2fa15d[_0xebd0('0x12')]][_0xebd0('0x91')];_0x3b1e3e[_0xebd0('0xa')]=_[_0xebd0('0x92')](_0x10471b);_0x3b1e3e[_0xebd0('0x85')]=_[_0xebd0('0x92')](_0x32010c[_0xebd0('0x85')]);_0x3b1e3e[_0xebd0('0x93')]=_[_0xebd0('0x94')](_0x3b1e3e[_0xebd0('0xa')],_0x3b1e3e[_0xebd0('0x85')]);_0x346c1d[_0xebd0('0x95')]=_[_0xebd0('0x94')](_0x3b1e3e[_0xebd0('0xa')],qs[_0xebd0('0x96')](_0x32010c[_0xebd0('0x85')][_0xebd0('0x96')]));_0x346c1d[_0xebd0('0x95')]=_0x346c1d[_0xebd0('0x95')][_0xebd0('0x89')]?_0x346c1d[_0xebd0('0x95')]:_0x3b1e3e[_0xebd0('0xa')];if(!_0x32010c[_0xebd0('0x85')]['hasOwnProperty'](_0xebd0('0x97'))){_0x346c1d[_0xebd0('0x98')]=qs[_0xebd0('0x98')](_0x32010c[_0xebd0('0x85')][_0xebd0('0x98')]);_0x346c1d['offset']=qs[_0xebd0('0x99')](_0x32010c[_0xebd0('0x85')]['offset']);}_0x346c1d[_0xebd0('0x9a')]=qs[_0xebd0('0x9b')](_0x32010c[_0xebd0('0x85')][_0xebd0('0x9b')]);_0x346c1d[_0xebd0('0x7d')]=qs[_0xebd0('0x93')](_[_0xebd0('0x9c')](_0x32010c['query'],_0x3b1e3e[_0xebd0('0x93')]));if(_0x32010c['query'][_0xebd0('0x4')]){_0x346c1d[_0xebd0('0x7d')]=_[_0xebd0('0x9d')](_0x346c1d['where'],{'$or':_[_0xebd0('0x9')](_0x10471b,function(_0x146fd6){if(_0x146fd6['type'][_0xebd0('0x9e')]!==_0xebd0('0x9f')){var _0x8f7684={};_0x8f7684[_0x146fd6[_0xebd0('0x5')]]={'$like':'%'+_0x32010c[_0xebd0('0x85')][_0xebd0('0x4')]+'%'};return _0x8f7684;}})});}var _0x69d2af=[];var _0x162b91=null;var _0xfad21d={};if(_0x30ad47){_0x162b91=_['find'](_0x4ca302,[_0xebd0('0xc'),_0x30ad47[_0xebd0('0xc')]]);if(_0x162b91[_0xebd0('0x5')]){_0xfad21d={};if(_0x2fa15d[_0xebd0('0x12')]==='AnalyticExtractedReport'){_0xfad21d[_0x162b91[_0xebd0('0xa0')]]=_[_0xebd0('0x9')](_0x30ad47['associatedResources'],'id');}else{_0xfad21d[_0x162b91['foreignKey']]=_0x30ad47[_0xebd0('0x8')];}_0x69d2af[_0xebd0('0x8f')](_0xfad21d);}else{_0x346c1d[_0xebd0('0x7d')]['id']=_0x30ad47[_0xebd0('0x8')];}}else{for(var _0x43255d=0x0;_0x43255d<_0x3b29fe[_0xebd0('0x89')];_0x43255d++){_0x162b91=_[_0xebd0('0x8b')](_0x4ca302,[_0xebd0('0xc'),_0x3b29fe[_0x43255d]['name']]);if(_0x162b91['field']){_0xfad21d={};_0xfad21d[_0x162b91[_0xebd0('0xa0')]]=_0x3b29fe[_0x43255d][_0xebd0('0x8')];_0x69d2af[_0xebd0('0x8f')](_0xfad21d);}else{if(!_0x346c1d[_0xebd0('0x7d')]['id'])_0x346c1d[_0xebd0('0x7d')]['id']=[];_0x3b29fe[_0x43255d][_0xebd0('0x8')]['forEach'](function(_0x39c116){_0x346c1d[_0xebd0('0x7d')]['id'][_0xebd0('0x8f')](_0x39c116);});}}}if(!_[_0xebd0('0x88')](_0x69d2af)){_0x346c1d[_0xebd0('0x7d')]=_[_0xebd0('0x9d')](_0x346c1d[_0xebd0('0x7d')],{'$and':{'$or':_0x69d2af}});}_0x346c1d=_[_0xebd0('0x9d')]({},_0x346c1d,_0x32010c['options']);if(_0x30ad47&&!_0x30ad47['autoAssociation']&&_0x2fa15d[_0xebd0('0x12')]==='AnalyticExtractedReport'){if(_0x32010c[_0xebd0('0x85')][_0xebd0('0xa1')]){_0x346c1d[_0xebd0('0xa2')]=[{'all':!![]}];}return _0x21dc43[_0x2fa15d[_0xebd0('0x12')]][_0xebd0('0x7')](_0x346c1d)[_0xebd0('0xb')](function(_0x1ed7e9){var _0x5a5e11=[];_0x1ed7e9[_0xebd0('0xa3')](function(_0xaef9f8){var _0x11f982;switch(_0xaef9f8[_0xebd0('0xa4')]){case'default':_0x11f982=_['find'](_0x30ad47['associatedResources'],function(_0xfdd5eb){return _0xfdd5eb['id']===_0xaef9f8[_0xebd0('0x72')]&&_0xfdd5eb[_0xebd0('0x34')]==='DefaultReports';});break;case _0xebd0('0xa5'):_0x11f982=_[_0xebd0('0x8b')](_0x30ad47[_0xebd0('0x8')],function(_0x585aca){return _0x585aca['id']===_0xaef9f8[_0xebd0('0x72')]&&_0x585aca[_0xebd0('0x34')]===_0xebd0('0xa6');});break;}if(_0x11f982)_0x5a5e11['push'](_0xaef9f8);});_0x2e054d['count']=_0x5a5e11['length'];_0x2e054d[_0xebd0('0xa7')]=_0x5a5e11;return _0x2e054d;});}else{return _0x21dc43[_0x2fa15d['childModel']][_0xebd0('0xa8')]({'where':_0x346c1d[_0xebd0('0x7d')]})[_0xebd0('0xb')](function(_0x536398){_0x2e054d['count']=_0x536398;if(_0x32010c['query']['includeAll']){if(_0x2fa15d['childModel']==='CmContact'){_0x346c1d['include']=[{'model':_0x21dc43[_0xebd0('0x69')],'as':_0xebd0('0xa9'),'attributes':['id',_0xebd0('0xc'),'color'],'required':_0x32010c[_0xebd0('0x85')][_0xebd0('0xaa')]?!![]:![]},{'model':_0x21dc43[_0xebd0('0x69')],'as':_0xebd0('0xab'),'attributes':['id','name',_0xebd0('0xac')],'through':_0x32010c['query']['tag']?{'attributes':[],'where':{'TagId':_0x32010c[_0xebd0('0x85')][_0xebd0('0xaa')]||undefined}}:{},'required':_0x32010c[_0xebd0('0x85')][_0xebd0('0xaa')]?!![]:![]}];}else{_0x346c1d[_0xebd0('0xa2')]=[{'all':!![]}];}}return _0x21dc43[_0x2fa15d['childModel']][_0xebd0('0x7')](_0x346c1d);})[_0xebd0('0xb')](function(_0x28bcaf){_0x2e054d[_0xebd0('0xa7')]=_0x28bcaf;if(_0x363ba3===_0xebd0('0x2e')&&_0x32010c[_0xebd0('0x85')][_0xebd0('0xad')]===_0xebd0('0xae')){var _0x474b64=[];for(var _0x3ee7aa=0x0;_0x3ee7aa<_0x2e054d[_0xebd0('0xa7')][_0xebd0('0x89')];_0x3ee7aa++){_0x474b64['push'](_0x53e1f3('chat',_0x2e054d[_0xebd0('0xa7')][_0x3ee7aa][_0xebd0('0xaf')]));_0x474b64[_0xebd0('0x8f')](_0x53e1f3(_0xebd0('0xb0'),_0x2e054d[_0xebd0('0xa7')][_0x3ee7aa]['dataValues']));_0x474b64['push'](_0x53e1f3(_0xebd0('0xb1'),_0x2e054d[_0xebd0('0xa7')][_0x3ee7aa]['dataValues']));_0x474b64[_0xebd0('0x8f')](_0x53e1f3(_0xebd0('0xb2'),_0x2e054d['rows'][_0x3ee7aa][_0xebd0('0xaf')]));_0x474b64[_0xebd0('0x8f')](_0x53e1f3(_0xebd0('0xb3'),_0x2e054d[_0xebd0('0xa7')][_0x3ee7aa]['dataValues']));_0x474b64[_0xebd0('0x8f')](_0x53e1f3('whatsapp',_0x2e054d[_0xebd0('0xa7')][_0x3ee7aa][_0xebd0('0xaf')]));}return Promise[_0xebd0('0x90')](_0x474b64)[_0xebd0('0xb')](function(){return _0x2e054d;});}return _0x2e054d;});}});}}});}; \ No newline at end of file +var _0x7bd0=['sounds','tags','Tag','templates','Template','Trigger','Trunk','variables','plugins','Plugin','extractedreports','Reports','reportId','charAt','slice','Sequelize','QueryTypes','select','ui.','InteractionId','ui.createdAt','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','define','UserProfile','query','mergeResources','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','rawAttributes','model','keys','filters','intersection','attributes','fields','nolimit','limit','offset','sort','merge','key','VIRTUAL','foreignKey','options','includeAll','include','forEach','reportType','default','DefaultReports','custom','CustomReports','count','rows','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','findAll','then','map','catch','field','associatedResources','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatWebsite','faxqueues','FaxQueue','faxaccounts','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','role','Telephones','membername','User','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','agents','telephones','Users','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Schedule'];(function(_0xe92350,_0x26ed9a){var _0x20d3b8=function(_0xdc5cdf){while(--_0xdc5cdf){_0xe92350['push'](_0xe92350['shift']());}};_0x20d3b8(++_0x26ed9a);}(_0x7bd0,0x111));var _0x07bd=function(_0x58a4ac,_0x43fd42){_0x58a4ac=_0x58a4ac-0x0;var _0x545810=_0x7bd0[_0x58a4ac];return _0x545810;};'use strict';var _=require(_0x07bd('0x0'));var attributes=require(_0x07bd('0x1'));var qs=require(_0x07bd('0x2'));var squel=require(_0x07bd('0x3'));module[_0x07bd('0x4')]=function(_0x1b76fd){var _0x38f4d1=_0x1b76fd[_0x07bd('0x5')];function _0x5beba7(_0x2d7245,_0x3b4f4f){return new Promise(function(_0x38f3f1,_0x313548){if(!_0x3b4f4f)return _0x38f3f1(null);var _0x3e8349=_0x3b4f4f[_0x07bd('0x6')]?{[_0x3b4f4f[_0x07bd('0x6')]['field']]:_0x3b4f4f[_0x07bd('0x6')]['value']}:undefined;return _0x38f4d1[_0x2d7245][_0x07bd('0x7')]({'where':_0x3e8349,'raw':!![]})[_0x07bd('0x8')](function(_0x323724){_0x3b4f4f['associatedResources']=_[_0x07bd('0x9')](_0x323724,'id');_0x38f3f1(_0x3b4f4f);})[_0x07bd('0xa')](function(_0x324a46){_0x313548(_0x324a46);});});}function _0x169b07(_0x489311,_0x3a45f3){return new Promise(function(_0x313ca5,_0x1b067a){var _0x222efa=_0x489311[_0x07bd('0x6')]?{[_0x489311[_0x07bd('0x6')][_0x07bd('0xb')]]:_0x489311[_0x07bd('0x6')]['value']}:undefined;return _0x38f4d1[_0x489311['model']][_0x07bd('0x7')]({'where':_0x222efa,'raw':!![]})[_0x07bd('0x8')](function(_0x1c59c2){_0x3a45f3[_0x07bd('0xc')]=_[_0x07bd('0x9')](_0x1c59c2,function(_0x2406b0){return _0x2406b0[_0x07bd('0xd')];});_0x313ca5(_0x3a45f3);})['catch'](function(_0x418444){_0x1b067a(_0x418444);});});}function _0x505839(_0x229bf1,_0x2dd97b,_0x31655a){if(!_0x2dd97b)return Promise[_0x07bd('0xe')](null);return new Promise(function(_0x8aa645,_0x4929d6){return _0x38f4d1[_0x07bd('0xf')][_0x07bd('0x7')]({'where':{'sectionId':_0x2dd97b['id']},'raw':!![]})['then'](function(_0x3e8ec4){if(_0x229bf1[_0x07bd('0xb')]&&_0x229bf1[_0x07bd('0xb')]!=='id'){_0x2dd97b[_0x07bd('0xc')]=_[_0x07bd('0x9')](_0x3e8ec4,function(_0x109dbc){return _0x109dbc[_0x229bf1[_0x07bd('0xb')]];});}else{if(_0x31655a===_0x07bd('0x10')){_0x2dd97b[_0x07bd('0xc')]=_['map'](_0x3e8ec4,function(_0x15c0b8){return{'id':_0x15c0b8[_0x07bd('0x11')],'type':_0x15c0b8[_0x07bd('0x12')]};});}else{_0x2dd97b[_0x07bd('0xc')]=_[_0x07bd('0x9')](_0x3e8ec4,function(_0x47bd50){return _0x47bd50['resourceId'];});}}_0x8aa645(_0x2dd97b);})[_0x07bd('0xa')](function(_0x51ca22){_0x4929d6(_0x51ca22);});});}function _0x2b0dee(_0x480c9c,_0x50bd12){var _0x4165bc={'parentSections':[]};switch(_0x480c9c[_0x07bd('0x13')]()){case _0x07bd('0x14'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x16');break;case _0x07bd('0x17'):_0x4165bc['childModel']=_0x07bd('0x18');break;case _0x07bd('0x19'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x1a');_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x1c'),'field':'name','foreignKey':'projectName'}];break;case'projects':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x1d');break;case _0x07bd('0x1e'):_0x4165bc['childModel']=_0x07bd('0x1f');_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x20'),'field':'id','foreignKey':_0x07bd('0x21')}];break;case _0x07bd('0x22'):_0x4165bc[_0x07bd('0x15')]='CmList';break;case _0x07bd('0x23'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x24');break;case _0x07bd('0x25'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x26');break;case _0x07bd('0x27'):_0x4165bc[_0x07bd('0x15')]='ChatQueue';break;case'chatwebsites':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x28');break;case _0x07bd('0x29'):_0x4165bc['childModel']=_0x07bd('0x2a');break;case _0x07bd('0x2b'):_0x4165bc[_0x07bd('0x15')]='FaxAccount';break;case'inboundroutes':case _0x07bd('0x2c'):case _0x07bd('0x2d'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x2e');break;case'contexts':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x2f');break;case _0x07bd('0x30'):_0x4165bc['childModel']=_0x07bd('0x31');break;case _0x07bd('0x32'):_0x4165bc['childModel']=_0x07bd('0x33');_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x34'),'field':_0x07bd('0xd'),'foreignKey':'membername','model':'User','filter':{'field':_0x07bd('0x35'),'value':['agent']}},{'name':_0x07bd('0x36'),'field':_0x07bd('0xd'),'foreignKey':_0x07bd('0x37'),'model':_0x07bd('0x38'),'filter':{'field':_0x07bd('0x35'),'value':[_0x07bd('0x39')]}},{'name':_0x07bd('0x3a'),'field':_0x07bd('0xd'),'foreignKey':_0x07bd('0x3b'),'model':_0x07bd('0x3c'),'filter':{'field':_0x07bd('0x12'),'value':[_0x07bd('0x3d')]}},{'name':_0x07bd('0x3e'),'field':'name','foreignKey':_0x07bd('0x3b'),'model':_0x07bd('0x3c'),'filter':{'field':_0x07bd('0x12'),'value':[_0x07bd('0x3f')]}}];break;case'musiconholds':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x40');break;case _0x07bd('0x41'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x42');break;case'voiceprefixes':_0x4165bc['childModel']=_0x07bd('0x43');break;case _0x07bd('0x44'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x45');break;case'mailqueues':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x46');break;case _0x07bd('0x47'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x48');break;case _0x07bd('0x49'):_0x4165bc[_0x07bd('0x15')]='MailSubstatus';break;case _0x07bd('0x4a'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x4b');break;case _0x07bd('0x4c'):_0x4165bc[_0x07bd('0x15')]='OpenchannelAccount';break;case _0x07bd('0x4d'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x4e');break;case _0x07bd('0x4f'):_0x4165bc[_0x07bd('0x15')]='SmsAccount';break;case _0x07bd('0x50'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x51');break;case _0x07bd('0x52'):_0x4165bc['childModel']='WhatsappAccount';break;case _0x07bd('0x53'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x54');break;case _0x07bd('0x55'):case _0x07bd('0x56'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x3c');if(_0x50bd12){_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x3a')},{'name':'QueueCampaigns'}];}break;case'users':case _0x07bd('0x57'):case _0x07bd('0x58'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x38');if(_0x50bd12){_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x59'),'filter':{'field':'role','value':[_0x07bd('0x5a'),_0x07bd('0x5b')]},'ignore':!![]},{'name':_0x07bd('0x34')},{'name':_0x07bd('0x36')}];}break;case _0x07bd('0x5c'):_0x4165bc[_0x07bd('0x15')]='ZendeskAccount';break;case _0x07bd('0x5d'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x5e');break;case _0x07bd('0x5f'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x60');break;case _0x07bd('0x61'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x62');break;case _0x07bd('0x63'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x64');break;case'zohoaccounts':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x65');break;case _0x07bd('0x66'):_0x4165bc['childModel']='User';break;case _0x07bd('0x67'):_0x4165bc['childModel']=_0x07bd('0x68');break;case _0x07bd('0x69'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x6a');break;case _0x07bd('0x6b'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x6c');break;case _0x07bd('0x6d'):_0x4165bc['childModel']=_0x07bd('0x6e');break;case _0x07bd('0x6f'):_0x4165bc[_0x07bd('0x15')]='Pause';break;case'scheduler':_0x4165bc['childModel']=_0x07bd('0x70');break;case _0x07bd('0x71'):_0x4165bc[_0x07bd('0x15')]='Sound';break;case _0x07bd('0x72'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x73');break;case _0x07bd('0x74'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x75');break;case'triggers':_0x4165bc['childModel']=_0x07bd('0x76');break;case'trunks':_0x4165bc['childModel']=_0x07bd('0x77');break;case _0x07bd('0x78'):_0x4165bc[_0x07bd('0x15')]='Variable';break;case _0x07bd('0x79'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x7a');break;case _0x07bd('0x7b'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x10');_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x7c'),'field':'id','foreignKey':_0x07bd('0x7d')}];break;case'metrics':_0x4165bc[_0x07bd('0x15')]='AnalyticMetric';break;}return _0x4165bc;}function _0x304796(_0x41fa36,_0x2b7907){var _0x4944e3=_0x41fa36[_0x07bd('0x7e')](0x0)['toUpperCase']()+_0x41fa36[_0x07bd('0x7f')](0x1);var _0x2ff31c={'type':_0x38f4d1[_0x07bd('0x80')][_0x07bd('0x81')]['SELECT'],'raw':!![]};return new Promise(function(_0x5dc6f6,_0x135e4e){var _0x5e4670=squel[_0x07bd('0x82')]()[_0x07bd('0xb')](_0x07bd('0x83')+_0x4944e3+_0x07bd('0x84'),'id')[_0x07bd('0xb')](_0x07bd('0x85'))['from'](_0x07bd('0x86')+_0x41fa36+_0x07bd('0x87'),'ui')[_0x07bd('0x88')](_0x07bd('0x89'),_0x2b7907['id']);return _0x38f4d1[_0x07bd('0x8a')]['query'](_0x5e4670[_0x07bd('0x8b')](),_0x2ff31c)[_0x07bd('0x8')](function(_0x278df2){_0x2b7907[_0x4944e3+'OpenTabs']=_0x278df2;_0x5dc6f6(_0x278df2);})[_0x07bd('0xa')](function(_0x585f90){_0x135e4e(_0x585f90);});});}return _0x1b76fd[_0x07bd('0x8c')](_0x07bd('0x8d'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x598367){var _0x34005e={'raw':![],'where':{}};var _0x1b5b4b={};var _0x2986c2={'count':0x0,'rows':[]};var _0x7c7408=_0x598367[_0x07bd('0x8e')]['section'];var _0x145482=_0x598367['query'][_0x07bd('0x8f')]||![];var _0x53b975=_0x2b0dee(_0x7c7408,_0x145482);if(!_0x53b975[_0x07bd('0x15')])throw new Error('Invalid\x20section\x20\x27'+_0x7c7408+'\x27');var _0x5419d1=[{'name':_0x7c7408}];if(!_[_0x07bd('0x90')](_0x53b975[_0x07bd('0x1b')]))_0x5419d1=_0x53b975[_0x07bd('0x1b')];var _0x14bcaf=[];for(var _0x475039=0x0;_0x475039<_0x5419d1[_0x07bd('0x91')];_0x475039++){_0x14bcaf[_0x07bd('0x92')](_0x38f4d1[_0x07bd('0x93')][_0x07bd('0x94')]({'where':{'userProfileId':_0x598367[_0x07bd('0x95')]['id'],'name':_0x5419d1[_0x475039]['name']},'raw':!![]}));}return Promise[_0x07bd('0x96')](_0x14bcaf)['then'](function(_0x43bcec){var _0x39360b=_[_0x07bd('0x6')](_0x43bcec,function(_0x5855e7){return _0x5855e7?_0x5855e7:undefined;});var _0x523cb0=_[_0x07bd('0x6')](_0x5419d1,[_0x07bd('0x97'),!![]]);var _0x3f7194=_[_0x07bd('0x90')](_0x39360b)&&_[_0x07bd('0x90')](_0x523cb0)?null:_[_0x07bd('0x98')](_0x523cb0,_0x39360b);if(!_0x3f7194)return null;var _0x4e630c=[];for(var _0xf256e1=0x0;_0xf256e1<_0x3f7194[_0x07bd('0x91')];_0xf256e1++){var _0x6bf34b=_['find'](_0x5419d1,function(_0x29a452){return _0x3f7194[_0xf256e1]?_0x29a452[_0x07bd('0xd')]===_0x3f7194[_0xf256e1][_0x07bd('0xd')]:null;});if(_0x6bf34b){if(_0x3f7194[_0xf256e1][_0x07bd('0x97')]){_0x4e630c['push'](_0x5beba7(_0x53b975[_0x07bd('0x15')],_0x3f7194[_0xf256e1]));}else{if(!_0x3f7194[_0xf256e1][_0x07bd('0x99')]){_0x4e630c[_0x07bd('0x92')](_0x505839(_0x6bf34b,_0x3f7194[_0xf256e1],_0x53b975[_0x07bd('0x15')]));}else{if(_0x6bf34b['model']){_0x4e630c[_0x07bd('0x92')](_0x169b07(_0x6bf34b,_0x3f7194[_0xf256e1]));}}}}}return Promise['all'](_0x4e630c);})[_0x07bd('0x8')](function(_0x15be68){var _0x128c30=_0x15be68;var _0x1968cd=null;if(_0x128c30){_0x1968cd=_0x128c30['length']===0x1?_0x128c30[0x0]:null;}if(!_0x1968cd&&!_0x128c30)return _0x2986c2;var _0x3e512e=_0x38f4d1[_0x53b975[_0x07bd('0x15')]][_0x07bd('0x9a')];_0x1b5b4b[_0x07bd('0x9b')]=_[_0x07bd('0x9c')](_0x3e512e);_0x1b5b4b[_0x07bd('0x8e')]=_[_0x07bd('0x9c')](_0x598367['query']);_0x1b5b4b[_0x07bd('0x9d')]=_[_0x07bd('0x9e')](_0x1b5b4b[_0x07bd('0x9b')],_0x1b5b4b[_0x07bd('0x8e')]);_0x34005e[_0x07bd('0x9f')]=_['intersection'](_0x1b5b4b[_0x07bd('0x9b')],qs[_0x07bd('0xa0')](_0x598367[_0x07bd('0x8e')]['fields']));_0x34005e[_0x07bd('0x9f')]=_0x34005e[_0x07bd('0x9f')][_0x07bd('0x91')]?_0x34005e[_0x07bd('0x9f')]:_0x1b5b4b[_0x07bd('0x9b')];if(!_0x598367['query']['hasOwnProperty'](_0x07bd('0xa1'))){_0x34005e[_0x07bd('0xa2')]=qs[_0x07bd('0xa2')](_0x598367[_0x07bd('0x8e')][_0x07bd('0xa2')]);_0x34005e[_0x07bd('0xa3')]=qs[_0x07bd('0xa3')](_0x598367[_0x07bd('0x8e')][_0x07bd('0xa3')]);}_0x34005e['order']=qs[_0x07bd('0xa4')](_0x598367[_0x07bd('0x8e')][_0x07bd('0xa4')]);_0x34005e[_0x07bd('0x88')]=qs[_0x07bd('0x9d')](_['pick'](_0x598367[_0x07bd('0x8e')],_0x1b5b4b['filters']));if(_0x598367[_0x07bd('0x8e')][_0x07bd('0x6')]){_0x34005e['where']=_[_0x07bd('0xa5')](_0x34005e['where'],{'$or':_['map'](_0x3e512e,function(_0x18a2b0){if(_0x18a2b0[_0x07bd('0x12')][_0x07bd('0xa6')]!==_0x07bd('0xa7')){var _0x1d64b0={};_0x1d64b0[_0x18a2b0['field']]={'$like':'%'+_0x598367[_0x07bd('0x8e')][_0x07bd('0x6')]+'%'};return _0x1d64b0;}})});}var _0x193c87=[];var _0x591fc3=null;var _0x9b9402={};if(_0x1968cd){_0x591fc3=_[_0x07bd('0x94')](_0x5419d1,['name',_0x1968cd[_0x07bd('0xd')]]);if(_0x591fc3[_0x07bd('0xb')]){_0x9b9402={};if(_0x53b975['childModel']===_0x07bd('0x10')){_0x9b9402[_0x591fc3[_0x07bd('0xa8')]]=_[_0x07bd('0x9')](_0x1968cd[_0x07bd('0xc')],'id');}else{_0x9b9402[_0x591fc3[_0x07bd('0xa8')]]=_0x1968cd[_0x07bd('0xc')];}_0x193c87[_0x07bd('0x92')](_0x9b9402);}else{_0x34005e[_0x07bd('0x88')]['id']=_0x1968cd['associatedResources'];}}else{for(var _0x780517=0x0;_0x780517<_0x128c30[_0x07bd('0x91')];_0x780517++){_0x591fc3=_['find'](_0x5419d1,[_0x07bd('0xd'),_0x128c30[_0x780517][_0x07bd('0xd')]]);if(_0x591fc3[_0x07bd('0xb')]){_0x9b9402={};_0x9b9402[_0x591fc3[_0x07bd('0xa8')]]=_0x128c30[_0x780517]['associatedResources'];_0x193c87[_0x07bd('0x92')](_0x9b9402);}else{if(!_0x34005e[_0x07bd('0x88')]['id'])_0x34005e[_0x07bd('0x88')]['id']=[];_0x128c30[_0x780517][_0x07bd('0xc')]['forEach'](function(_0x15a175){_0x34005e[_0x07bd('0x88')]['id'][_0x07bd('0x92')](_0x15a175);});}}}if(!_[_0x07bd('0x90')](_0x193c87)){_0x34005e[_0x07bd('0x88')]=_[_0x07bd('0xa5')](_0x34005e[_0x07bd('0x88')],{'$and':{'$or':_0x193c87}});}_0x34005e=_[_0x07bd('0xa5')]({},_0x34005e,_0x598367[_0x07bd('0xa9')]);if(_0x1968cd&&!_0x1968cd[_0x07bd('0x99')]&&_0x53b975[_0x07bd('0x15')]===_0x07bd('0x10')){if(_0x598367[_0x07bd('0x8e')][_0x07bd('0xaa')]){_0x34005e[_0x07bd('0xab')]=[{'all':!![]}];}return _0x38f4d1[_0x53b975[_0x07bd('0x15')]][_0x07bd('0x7')](_0x34005e)[_0x07bd('0x8')](function(_0x5811ef){var _0x578808=[];_0x5811ef[_0x07bd('0xac')](function(_0x2aeceb){var _0x2704c7;switch(_0x2aeceb[_0x07bd('0xad')]){case _0x07bd('0xae'):_0x2704c7=_[_0x07bd('0x94')](_0x1968cd[_0x07bd('0xc')],function(_0x3727d7){return _0x3727d7['id']===_0x2aeceb[_0x07bd('0x7d')]&&_0x3727d7['type']===_0x07bd('0xaf');});break;case _0x07bd('0xb0'):_0x2704c7=_[_0x07bd('0x94')](_0x1968cd[_0x07bd('0xc')],function(_0x25658e){return _0x25658e['id']===_0x2aeceb[_0x07bd('0x7d')]&&_0x25658e[_0x07bd('0x12')]===_0x07bd('0xb1');});break;}if(_0x2704c7)_0x578808[_0x07bd('0x92')](_0x2aeceb);});_0x2986c2[_0x07bd('0xb2')]=_0x578808[_0x07bd('0x91')];_0x2986c2[_0x07bd('0xb3')]=_0x578808;return _0x2986c2;});}else{return _0x38f4d1[_0x53b975[_0x07bd('0x15')]][_0x07bd('0xb2')]({'where':_0x34005e[_0x07bd('0x88')]})[_0x07bd('0x8')](function(_0x28b036){_0x2986c2[_0x07bd('0xb2')]=_0x28b036;if(_0x598367[_0x07bd('0x8e')][_0x07bd('0xaa')]){if(_0x53b975[_0x07bd('0x15')]===_0x07bd('0x1f')){_0x34005e['include']=[{'model':_0x38f4d1[_0x07bd('0x73')],'as':_0x07bd('0xb4'),'attributes':['id','name',_0x07bd('0xb5')],'required':_0x598367['query'][_0x07bd('0xb6')]?!![]:![]},{'model':_0x38f4d1['Tag'],'as':_0x07bd('0xb7'),'attributes':['id',_0x07bd('0xd'),'color'],'through':_0x598367[_0x07bd('0x8e')][_0x07bd('0xb6')]?{'attributes':[],'where':{'TagId':_0x598367['query'][_0x07bd('0xb6')]||undefined}}:{},'required':_0x598367['query'][_0x07bd('0xb6')]?!![]:![]}];}else{_0x34005e[_0x07bd('0xab')]=[{'all':!![]}];}}return _0x38f4d1[_0x53b975[_0x07bd('0x15')]][_0x07bd('0x7')](_0x34005e);})[_0x07bd('0x8')](function(_0x3f8539){_0x2986c2[_0x07bd('0xb3')]=_0x3f8539;if(_0x7c7408==='Agents'&&_0x598367['query'][_0x07bd('0xb8')]===_0x07bd('0xb9')){var _0x3bf215=[];for(var _0x1c2766=0x0;_0x1c2766<_0x2986c2[_0x07bd('0xb3')][_0x07bd('0x91')];_0x1c2766++){_0x3bf215['push'](_0x304796(_0x07bd('0xba'),_0x2986c2['rows'][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215['push'](_0x304796(_0x07bd('0xbc'),_0x2986c2[_0x07bd('0xb3')][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215[_0x07bd('0x92')](_0x304796(_0x07bd('0xbd'),_0x2986c2['rows'][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215[_0x07bd('0x92')](_0x304796(_0x07bd('0xbe'),_0x2986c2[_0x07bd('0xb3')][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215[_0x07bd('0x92')](_0x304796(_0x07bd('0xbf'),_0x2986c2[_0x07bd('0xb3')][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215['push'](_0x304796(_0x07bd('0xc0'),_0x2986c2[_0x07bd('0xb3')][_0x1c2766][_0x07bd('0xbb')]));}return Promise['all'](_0x3bf215)[_0x07bd('0x8')](function(){return _0x2986c2;});}return _0x2986c2;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index e9e968b..19132cc 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 _0xc4d8=['info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userProfile.socket','register','request','then'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xc4d8,0xa6));var _0x8c4d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc4d8[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x8c4d('0x0'));var util=require('util');var moment=require(_0x8c4d('0x1'));var BPromise=require(_0x8c4d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c4d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8c4d('0x4'));var config=require(_0x8c4d('0x5'));var jayson=require(_0x8c4d('0x6'));var client=jayson[_0x8c4d('0x7')][_0x8c4d('0x8')]({'port':0x232a});config[_0x8c4d('0x9')]=_[_0x8c4d('0xa')](config[_0x8c4d('0x9')],{'host':_0x8c4d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8c4d('0x9')]));require(_0x8c4d('0xc'))[_0x8c4d('0xd')](socket);function respondWithRpcPromise(_0x3ccfda,_0x4d9e0c,_0x4d510b){return new BPromise(function(_0x9c3f3c,_0x3701cb){return client[_0x8c4d('0xe')](_0x3ccfda,_0x4d510b)[_0x8c4d('0xf')](function(_0x2ec085){logger[_0x8c4d('0x10')](_0x8c4d('0x11'),_0x4d9e0c,_0x8c4d('0x12'));logger['debug'](_0x8c4d('0x13'),_0x4d9e0c,_0x8c4d('0x12'),JSON[_0x8c4d('0x14')](_0x2ec085));if(_0x2ec085[_0x8c4d('0x15')]){if(_0x2ec085[_0x8c4d('0x15')][_0x8c4d('0x16')]===0x1f4){logger[_0x8c4d('0x15')](_0x8c4d('0x11'),_0x4d9e0c,_0x2ec085['error']['message']);return _0x3701cb(_0x2ec085[_0x8c4d('0x15')][_0x8c4d('0x17')]);}logger['error'](_0x8c4d('0x11'),_0x4d9e0c,_0x2ec085[_0x8c4d('0x15')][_0x8c4d('0x17')]);return _0x9c3f3c(_0x2ec085['error'][_0x8c4d('0x17')]);}else{logger[_0x8c4d('0x10')](_0x8c4d('0x11'),_0x4d9e0c,_0x8c4d('0x12'));_0x9c3f3c(_0x2ec085[_0x8c4d('0x18')]['message']);}})[_0x8c4d('0x19')](function(_0x1427e3){logger['error'](_0x8c4d('0x11'),_0x4d9e0c,_0x1427e3);_0x3701cb(_0x1427e3);});});} \ No newline at end of file +var _0xf19c=['UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xb2a1a0,_0x9d4995){var _0x9cc550=function(_0x4b6c67){while(--_0x4b6c67){_0xb2a1a0['push'](_0xb2a1a0['shift']());}};_0x9cc550(++_0x9d4995);}(_0xf19c,0x10b));var _0xcf19=function(_0x17475d,_0x39131b){_0x17475d=_0x17475d-0x0;var _0x5d4c6b=_0xf19c[_0x17475d];return _0x5d4c6b;};'use strict';var _=require(_0xcf19('0x0'));var util=require(_0xcf19('0x1'));var moment=require(_0xcf19('0x2'));var BPromise=require('bluebird');var rs=require(_0xcf19('0x3'));var fs=require('fs');var Redis=require(_0xcf19('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcf19('0x5'));var logger=require(_0xcf19('0x6'))(_0xcf19('0x7'));var config=require(_0xcf19('0x8'));var jayson=require(_0xcf19('0x9'));var client=jayson['client'][_0xcf19('0xa')]({'port':0x232a});config[_0xcf19('0xb')]=_[_0xcf19('0xc')](config[_0xcf19('0xb')],{'host':_0xcf19('0xd'),'port':0x18eb});var socket=require(_0xcf19('0xe'))(new Redis(config['redis']));require(_0xcf19('0xf'))[_0xcf19('0x10')](socket);function respondWithRpcPromise(_0xde8967,_0x257184,_0x87afe6){return new BPromise(function(_0x3141eb,_0x3c9355){return client[_0xcf19('0x11')](_0xde8967,_0x87afe6)[_0xcf19('0x12')](function(_0x547a0b){logger[_0xcf19('0x13')](_0xcf19('0x14'),_0x257184,_0xcf19('0x15'));logger[_0xcf19('0x16')](_0xcf19('0x17'),_0x257184,_0xcf19('0x15'),JSON[_0xcf19('0x18')](_0x547a0b));if(_0x547a0b[_0xcf19('0x19')]){if(_0x547a0b[_0xcf19('0x19')][_0xcf19('0x1a')]===0x1f4){logger[_0xcf19('0x19')](_0xcf19('0x14'),_0x257184,_0x547a0b[_0xcf19('0x19')][_0xcf19('0x1b')]);return _0x3c9355(_0x547a0b[_0xcf19('0x19')][_0xcf19('0x1b')]);}logger['error']('UserProfile,\x20%s,\x20%s',_0x257184,_0x547a0b[_0xcf19('0x19')][_0xcf19('0x1b')]);return _0x3141eb(_0x547a0b[_0xcf19('0x19')][_0xcf19('0x1b')]);}else{logger[_0xcf19('0x13')](_0xcf19('0x14'),_0x257184,'request\x20sent');_0x3141eb(_0x547a0b[_0xcf19('0x1c')][_0xcf19('0x1b')]);}})['catch'](function(_0x289799){logger['error'](_0xcf19('0x14'),_0x257184,_0x289799);_0x3c9355(_0x289799);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 2e6afb6..db8e6f3 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 _0x48a6=['userProfile:','./userProfile.events','save','update','emit','register','length'];(function(_0x5698b6,_0x8831dd){var _0x561ce8=function(_0x342285){while(--_0x342285){_0x5698b6['push'](_0x5698b6['shift']());}};_0x561ce8(++_0x8831dd);}(_0x48a6,0x135));var _0x648a=function(_0xdafc1b,_0x2e33a2){_0xdafc1b=_0xdafc1b-0x0;var _0x31de5b=_0x48a6[_0xdafc1b];return _0x31de5b;};'use strict';var UserProfileEvents=require(_0x648a('0x0'));var events=[_0x648a('0x1'),'remove',_0x648a('0x2')];function createListener(_0x17845b,_0x22630d){return function(_0x95cbfe){_0x22630d[_0x648a('0x3')](_0x17845b,_0x95cbfe);};}function removeListener(_0x2f8c3e,_0x5c2f98){return function(){UserProfileEvents['removeListener'](_0x2f8c3e,_0x5c2f98);};}exports[_0x648a('0x4')]=function(_0x4e7071){for(var _0x186503=0x0,_0x296b4d=events[_0x648a('0x5')];_0x186503<_0x296b4d;_0x186503++){var _0x20f6a4=events[_0x186503];var _0x40f5c2=createListener(_0x648a('0x6')+_0x20f6a4,_0x4e7071);UserProfileEvents['on'](_0x20f6a4,_0x40f5c2);}}; \ No newline at end of file +var _0x8bac=['remove','update','emit','removeListener','length','./userProfile.events','save'];(function(_0x280cf8,_0x3eaee6){var _0x24a1d8=function(_0x450f46){while(--_0x450f46){_0x280cf8['push'](_0x280cf8['shift']());}};_0x24a1d8(++_0x3eaee6);}(_0x8bac,0x8a));var _0xc8ba=function(_0x10d341,_0x57ff35){_0x10d341=_0x10d341-0x0;var _0xddc36d=_0x8bac[_0x10d341];return _0xddc36d;};'use strict';var UserProfileEvents=require(_0xc8ba('0x0'));var events=[_0xc8ba('0x1'),_0xc8ba('0x2'),_0xc8ba('0x3')];function createListener(_0x126f21,_0xf0493e){return function(_0x38e32f){_0xf0493e[_0xc8ba('0x4')](_0x126f21,_0x38e32f);};}function removeListener(_0x27f945,_0x558796){return function(){UserProfileEvents[_0xc8ba('0x5')](_0x27f945,_0x558796);};}exports['register']=function(_0x145de4){for(var _0x65609f=0x0,_0x27a1ad=events[_0xc8ba('0x6')];_0x65609f<_0x27a1ad;_0x65609f++){var _0x2c662e=events[_0x65609f];var _0x2bf2a7=createListener('userProfile:'+_0x2c662e,_0x145de4);UserProfileEvents['on'](_0x2c662e,_0x2bf2a7);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index cb69418..e10e2aa 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 _0x1a61=['index','/describe','describe','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x1a61,0x7c));var _0x11a6=function(_0x15f3c1,_0x48d9c0){_0x15f3c1=_0x15f3c1-0x0;var _0x646081=_0x1a61[_0x15f3c1];return _0x646081;};'use strict';var multer=require(_0x11a6('0x0'));var util=require(_0x11a6('0x1'));var path=require(_0x11a6('0x2'));var timeout=require(_0x11a6('0x3'));var express=require('express');var router=express[_0x11a6('0x4')]();var fs_extra=require(_0x11a6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x11a6('0x6'));var controller=require('./userProfileResource.controller');router[_0x11a6('0x7')]('/',auth[_0x11a6('0x8')](),controller[_0x11a6('0x9')]);router[_0x11a6('0x7')](_0x11a6('0xa'),auth[_0x11a6('0x8')](),controller[_0x11a6('0xb')]);router[_0x11a6('0x7')](_0x11a6('0xc'),auth[_0x11a6('0x8')](),controller['show']);router[_0x11a6('0xd')]('/',auth[_0x11a6('0x8')](),controller[_0x11a6('0xe')]);router[_0x11a6('0xf')](_0x11a6('0xc'),auth[_0x11a6('0x8')](),controller[_0x11a6('0x10')]);router[_0x11a6('0x11')]('/:id',auth[_0x11a6('0x8')](),controller[_0x11a6('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd8a2=['describe','show','create','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','/describe'];(function(_0x5ba9a3,_0x5c8c3f){var _0x2d7aa6=function(_0x3cb978){while(--_0x3cb978){_0x5ba9a3['push'](_0x5ba9a3['shift']());}};_0x2d7aa6(++_0x5c8c3f);}(_0xd8a2,0x1da));var _0x2d8a=function(_0x3ec59d,_0x59813e){_0x3ec59d=_0x3ec59d-0x0;var _0x13c887=_0xd8a2[_0x3ec59d];return _0x13c887;};'use strict';var multer=require(_0x2d8a('0x0'));var util=require(_0x2d8a('0x1'));var path=require(_0x2d8a('0x2'));var timeout=require(_0x2d8a('0x3'));var express=require('express');var router=express[_0x2d8a('0x4')]();var fs_extra=require(_0x2d8a('0x5'));var auth=require(_0x2d8a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2d8a('0x7'));var controller=require(_0x2d8a('0x8'));router['get']('/',auth[_0x2d8a('0x9')](),controller[_0x2d8a('0xa')]);router['get'](_0x2d8a('0xb'),auth[_0x2d8a('0x9')](),controller[_0x2d8a('0xc')]);router['get']('/:id',auth[_0x2d8a('0x9')](),controller[_0x2d8a('0xd')]);router['post']('/',auth[_0x2d8a('0x9')](),controller[_0x2d8a('0xe')]);router['put']('/:id',auth[_0x2d8a('0x9')](),controller[_0x2d8a('0xf')]);router['delete']('/:id',auth[_0x2d8a('0x9')](),controller[_0x2d8a('0x10')]);module[_0x2d8a('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 5ec7524..81ea18e 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 _0x4212=['INTEGER','sequelize','STRING'];(function(_0x2b0102,_0xe3da2e){var _0x22e6e1=function(_0x5c18fb){while(--_0x5c18fb){_0x2b0102['push'](_0x2b0102['shift']());}};_0x22e6e1(++_0xe3da2e);}(_0x4212,0x100));var _0x2421=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0x4212[_0x3f0b30];return _0x2748a5;};'use strict';var Sequelize=require(_0x2421('0x0'));module['exports']={'name':{'type':Sequelize[_0x2421('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x2421('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2421('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x9045=['INTEGER','sequelize','exports','STRING'];(function(_0xb2ed24,_0x3a8620){var _0x3f8e30=function(_0x33fc5f){while(--_0x33fc5f){_0xb2ed24['push'](_0xb2ed24['shift']());}};_0x3f8e30(++_0x3a8620);}(_0x9045,0x15d));var _0x5904=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x9045[_0x4c7fb5];return _0x2e10ac;};'use strict';var Sequelize=require(_0x5904('0x0'));module[_0x5904('0x1')]={'name':{'type':Sequelize[_0x5904('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5904('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x5904('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 07336f9..a672a6f 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 _0x9582=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','offset','count','set','json','reject','save','update','then','destroy','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir'];(function(_0x2fcb89,_0x49b946){var _0x4ab14a=function(_0x239b0d){while(--_0x239b0d){_0x2fcb89['push'](_0x2fcb89['shift']());}};_0x4ab14a(++_0x49b946);}(_0x9582,0x95));var _0x2958=function(_0x5f73b5,_0x4cbe14){_0x5f73b5=_0x5f73b5-0x0;var _0x1d14ce=_0x9582[_0x5f73b5];return _0x1d14ce;};'use strict';var emlformat=require(_0x2958('0x0'));var rimraf=require(_0x2958('0x1'));var zipdir=require(_0x2958('0x2'));var jsonpatch=require(_0x2958('0x3'));var rp=require(_0x2958('0x4'));var moment=require(_0x2958('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2958('0x6'));var util=require(_0x2958('0x7'));var path=require(_0x2958('0x8'));var sox=require(_0x2958('0x9'));var csv=require(_0x2958('0xa'));var ejs=require(_0x2958('0xb'));var fs=require('fs');var fs_extra=require(_0x2958('0xc'));var _=require(_0x2958('0xd'));var squel=require(_0x2958('0xe'));var crypto=require(_0x2958('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2958('0xa'));var querystring=require('querystring');var Papa=require(_0x2958('0x10'));var Redis=require('ioredis');var authService=require(_0x2958('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2958('0x12'));var hardwareService=require(_0x2958('0x13'));var logger=require(_0x2958('0x14'))(_0x2958('0x15'));var utils=require(_0x2958('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2958('0x17'));var db=require(_0x2958('0x18'))['db'];function respondWithStatusCode(_0x33a13a,_0x20e06a){_0x20e06a=_0x20e06a||0xcc;return function(_0x47067d){if(_0x47067d){return _0x33a13a[_0x2958('0x19')](_0x20e06a);}return _0x33a13a[_0x2958('0x1a')](_0x20e06a)[_0x2958('0x1b')]();};}function respondWithResult(_0x5bd520,_0x42e976){_0x42e976=_0x42e976||0xc8;return function(_0x2e12d4){if(_0x2e12d4){return _0x5bd520['status'](_0x42e976)['json'](_0x2e12d4);}};}function respondWithFilteredResult(_0x21ed6c,_0x38e724){return function(_0x5f06b1){if(_0x5f06b1){var _0x3bef50=typeof _0x38e724['offset']==='undefined'&&typeof _0x38e724[_0x2958('0x1c')]===_0x2958('0x1d');var _0x55e261=_0x5f06b1['count'];var _0x28a92c=_0x3bef50?0x0:_0x38e724[_0x2958('0x1e')];var _0x310d07=_0x3bef50?_0x5f06b1[_0x2958('0x1f')]:_0x38e724[_0x2958('0x1e')]+_0x38e724['limit'];var _0x19a614;if(_0x310d07>=_0x55e261){_0x310d07=_0x55e261;_0x19a614=0xc8;}else{_0x19a614=0xce;}_0x21ed6c[_0x2958('0x1a')](_0x19a614);return _0x21ed6c[_0x2958('0x20')]('Content-Range',_0x28a92c+'-'+_0x310d07+'/'+_0x55e261)[_0x2958('0x21')](_0x5f06b1);}return null;};}function patchUpdates(_0x53b100){return function(_0x1da684){try{jsonpatch['apply'](_0x1da684,_0x53b100,!![]);}catch(_0x5eaf36){return BPromise[_0x2958('0x22')](_0x5eaf36);}return _0x1da684[_0x2958('0x23')]();};}function saveUpdates(_0x2a02a4,_0x26c5a5){return function(_0x2202f8){if(_0x2202f8){return _0x2202f8[_0x2958('0x24')](_0x2a02a4)[_0x2958('0x25')](function(_0x2b9818){return _0x2b9818;});}return null;};}function removeEntity(_0x330763,_0x2aa514){return function(_0xaf5547){if(_0xaf5547){return _0xaf5547[_0x2958('0x26')]()[_0x2958('0x25')](function(){_0x330763[_0x2958('0x1a')](0xcc)[_0x2958('0x1b')]();});}};}function handleEntityNotFound(_0x4f811a,_0x574df5){return function(_0x3c1155){if(!_0x3c1155){_0x4f811a[_0x2958('0x19')](0x194);}return _0x3c1155;};}function handleError(_0x28c1f5,_0x43cf73){_0x43cf73=_0x43cf73||0x1f4;return function(_0x52bd32){logger[_0x2958('0x27')](_0x52bd32['stack']);if(_0x52bd32[_0x2958('0x28')]){delete _0x52bd32[_0x2958('0x28')];}_0x28c1f5[_0x2958('0x1a')](_0x43cf73)[_0x2958('0x29')](_0x52bd32);};}exports[_0x2958('0x2a')]=function(_0x36e2a5,_0x153958){var _0x5d1dfc={},_0x21b919={},_0x5053d0={'count':0x0,'rows':[]};var _0x48650d=_[_0x2958('0x2b')](db[_0x2958('0x2c')][_0x2958('0x2d')],function(_0x34e56e){return{'name':_0x34e56e[_0x2958('0x2e')],'type':_0x34e56e[_0x2958('0x2f')][_0x2958('0x30')]};});_0x21b919[_0x2958('0x31')]=_['map'](_0x48650d,_0x2958('0x28'));_0x21b919[_0x2958('0x32')]=_['keys'](_0x36e2a5[_0x2958('0x32')]);_0x21b919['filters']=_[_0x2958('0x33')](_0x21b919['model'],_0x21b919[_0x2958('0x32')]);_0x5d1dfc['attributes']=_[_0x2958('0x33')](_0x21b919[_0x2958('0x31')],qs[_0x2958('0x34')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x34')]));_0x5d1dfc[_0x2958('0x35')]=_0x5d1dfc[_0x2958('0x35')][_0x2958('0x36')]?_0x5d1dfc[_0x2958('0x35')]:_0x21b919['model'];if(!_0x36e2a5[_0x2958('0x32')]['hasOwnProperty'](_0x2958('0x37'))){_0x5d1dfc['limit']=qs[_0x2958('0x1c')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1c')]);_0x5d1dfc[_0x2958('0x1e')]=qs[_0x2958('0x1e')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1e')]);}_0x5d1dfc[_0x2958('0x38')]=qs[_0x2958('0x39')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x39')]);_0x5d1dfc[_0x2958('0x3a')]=qs[_0x2958('0x3b')](_['pick'](_0x36e2a5[_0x2958('0x32')],_0x21b919[_0x2958('0x3b')]),_0x48650d);if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]){_0x5d1dfc['where']=_[_0x2958('0x3d')](_0x5d1dfc[_0x2958('0x3a')],{'$or':_[_0x2958('0x2b')](_0x48650d,function(_0x3f7e27){if(_0x3f7e27[_0x2958('0x2f')]!==_0x2958('0x3e')){var _0x1ed89b={};_0x1ed89b[_0x3f7e27[_0x2958('0x28')]]={'$like':'%'+_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]+'%'};return _0x1ed89b;}})});}_0x5d1dfc=_[_0x2958('0x3d')]({},_0x5d1dfc,_0x36e2a5[_0x2958('0x3f')]);var _0x319243={'where':_0x5d1dfc['where']};return db[_0x2958('0x2c')][_0x2958('0x1f')](_0x319243)['then'](function(_0x4fe061){_0x5053d0[_0x2958('0x1f')]=_0x4fe061;if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x40')]){_0x5d1dfc[_0x2958('0x41')]=[{'all':!![]}];}return db[_0x2958('0x2c')][_0x2958('0x42')](_0x5d1dfc);})[_0x2958('0x25')](function(_0x13be6d){_0x5053d0[_0x2958('0x43')]=_0x13be6d;return _0x5053d0;})[_0x2958('0x25')](respondWithFilteredResult(_0x153958,_0x5d1dfc))[_0x2958('0x44')](handleError(_0x153958,null));};exports[_0x2958('0x45')]=function(_0xe33c56,_0x5a58ea){var _0x645b66={'raw':![],'where':{'id':_0xe33c56[_0x2958('0x46')]['id']}},_0x112256={};_0x112256[_0x2958('0x31')]=_['keys'](db[_0x2958('0x2c')]['rawAttributes']);_0x112256['query']=_[_0x2958('0x47')](_0xe33c56[_0x2958('0x32')]);_0x112256[_0x2958('0x3b')]=_[_0x2958('0x33')](_0x112256[_0x2958('0x31')],_0x112256[_0x2958('0x32')]);_0x645b66['attributes']=_[_0x2958('0x33')](_0x112256['model'],qs['fields'](_0xe33c56[_0x2958('0x32')]['fields']));_0x645b66[_0x2958('0x35')]=_0x645b66[_0x2958('0x35')][_0x2958('0x36')]?_0x645b66[_0x2958('0x35')]:_0x112256[_0x2958('0x31')];if(_0xe33c56[_0x2958('0x32')][_0x2958('0x40')]){_0x645b66[_0x2958('0x41')]=[{'all':!![]}];}_0x645b66=_['merge']({},_0x645b66,_0xe33c56[_0x2958('0x3f')]);return db[_0x2958('0x2c')][_0x2958('0x48')](_0x645b66)[_0x2958('0x25')](handleEntityNotFound(_0x5a58ea,null))['then'](respondWithResult(_0x5a58ea,null))[_0x2958('0x44')](handleError(_0x5a58ea,null));};exports[_0x2958('0x49')]=function(_0x4a51b1,_0x1b6829){return db[_0x2958('0x2c')][_0x2958('0x49')](_0x4a51b1[_0x2958('0x4a')],{})[_0x2958('0x25')](respondWithResult(_0x1b6829,0xc9))[_0x2958('0x44')](handleError(_0x1b6829,null));};exports['update']=function(_0x1fff2a,_0x38b551){if(_0x1fff2a[_0x2958('0x4a')]['id']){delete _0x1fff2a[_0x2958('0x4a')]['id'];}return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x1fff2a[_0x2958('0x46')]['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x38b551,null))[_0x2958('0x25')](saveUpdates(_0x1fff2a[_0x2958('0x4a')],null))[_0x2958('0x25')](respondWithResult(_0x38b551,null))[_0x2958('0x44')](handleError(_0x38b551,null));};exports[_0x2958('0x26')]=function(_0x3f7bc1,_0x1bb780){return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x3f7bc1['params']['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x1bb780,null))['then'](removeEntity(_0x1bb780,null))[_0x2958('0x44')](handleError(_0x1bb780,null));};exports[_0x2958('0x4b')]=function(_0x1db8b1,_0x534677){return db['UserProfileResource'][_0x2958('0x4b')]()[_0x2958('0x25')](respondWithResult(_0x534677,null))[_0x2958('0x44')](handleError(_0x534677,null));}; \ No newline at end of file +var _0x5496=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','UserProfileResource','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0xa9b74a,_0x12c321){var _0x52d227=function(_0x3ad492){while(--_0x3ad492){_0xa9b74a['push'](_0xa9b74a['shift']());}};_0x52d227(++_0x12c321);}(_0x5496,0x175));var _0x6549=function(_0x252f1f,_0x2e2836){_0x252f1f=_0x252f1f-0x0;var _0x14d6b5=_0x5496[_0x252f1f];return _0x14d6b5;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['create'](_0x41d675[_0x6549('0x4c')],{})[_0x6549('0x26')](respondWithResult(_0x1712f3,0xc9))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0xa4c650,_0x25a6ee){if(_0xa4c650[_0x6549('0x4c')]['id']){delete _0xa4c650[_0x6549('0x4c')]['id'];}return db['UserProfileResource'][_0x6549('0x4a')]({'where':{'id':_0xa4c650['params']['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x25a6ee,null))[_0x6549('0x26')](saveUpdates(_0xa4c650[_0x6549('0x4c')],null))['then'](respondWithResult(_0x25a6ee,null))[_0x6549('0x43')](handleError(_0x25a6ee,null));};exports[_0x6549('0x4d')]=function(_0x2ef4d2,_0x5300c8){return db[_0x6549('0x2b')][_0x6549('0x4a')]({'where':{'id':_0x2ef4d2[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x5300c8,null))[_0x6549('0x26')](removeEntity(_0x5300c8,null))[_0x6549('0x43')](handleError(_0x5300c8,null));};exports['describe']=function(_0x28af00,_0x4bbc61){return db[_0x6549('0x2b')][_0x6549('0x4e')]()[_0x6549('0x26')](respondWithResult(_0x4bbc61,null))[_0x6549('0x43')](handleError(_0x4bbc61,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 5731302..ae60329 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 _0x8640=['compositeIndex','resourceId','sectionId','lodash','util','api','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource'];(function(_0x3cf4b2,_0x2f0ac6){var _0x3a2005=function(_0x4606b1){while(--_0x4606b1){_0x3cf4b2['push'](_0x3cf4b2['shift']());}};_0x3a2005(++_0x2f0ac6);}(_0x8640,0x9d));var _0x0864=function(_0x1bfd6b,_0x59a3a2){_0x1bfd6b=_0x1bfd6b-0x0;var _0xbe2a60=_0x8640[_0x1bfd6b];return _0xbe2a60;};'use strict';var _=require(_0x0864('0x0'));var util=require(_0x0864('0x1'));var logger=require('../../config/logger')(_0x0864('0x2'));var moment=require('moment');var BPromise=require(_0x0864('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0864('0x4'));var rimraf=require(_0x0864('0x5'));var config=require(_0x0864('0x6'));var attributes=require(_0x0864('0x7'));module[_0x0864('0x8')]=function(_0x12d16f,_0x50d4e5){return _0x12d16f[_0x0864('0x9')](_0x0864('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x0864('0xb'),'fields':[_0x0864('0xc'),_0x0864('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4653=['UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileResource.attributes'];(function(_0x1521f0,_0x21966f){var _0x54b5c9=function(_0x2040a0){while(--_0x2040a0){_0x1521f0['push'](_0x1521f0['shift']());}};_0x54b5c9(++_0x21966f);}(_0x4653,0xac));var _0x3465=function(_0x9a5afd,_0x266e87){_0x9a5afd=_0x9a5afd-0x0;var _0x5bbb98=_0x4653[_0x9a5afd];return _0x5bbb98;};'use strict';var _=require(_0x3465('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3465('0x1'));var moment=require(_0x3465('0x2'));var BPromise=require(_0x3465('0x3'));var rp=require(_0x3465('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3465('0x5'));var config=require(_0x3465('0x6'));var attributes=require(_0x3465('0x7'));module['exports']=function(_0x933df9,_0x1c8b9b){return _0x933df9['define'](_0x3465('0x8'),attributes,{'tableName':_0x3465('0x9'),'paranoid':![],'indexes':[{'name':_0x3465('0xa'),'fields':['resourceId',_0x3465('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 73f7046..4cac102 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 _0xc84b=['info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x4c4a57,_0x5b4e80){var _0x325218=function(_0x38da2d){while(--_0x38da2d){_0x4c4a57['push'](_0x4c4a57['shift']());}};_0x325218(++_0x5b4e80);}(_0xc84b,0x1d8));var _0xbc84=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xc84b[_0x1b6186];return _0x186121;};'use strict';var _=require(_0xbc84('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbc84('0x1'));var rs=require(_0xbc84('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc84('0x3'))['db'];var utils=require(_0xbc84('0x4'));var logger=require(_0xbc84('0x5'))(_0xbc84('0x6'));var config=require(_0xbc84('0x7'));var jayson=require(_0xbc84('0x8'));var client=jayson[_0xbc84('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f5d4b,_0x1a38dd,_0x1ae2a3){return new BPromise(function(_0x1ce0fd,_0x28c9aa){return client[_0xbc84('0xa')](_0x4f5d4b,_0x1ae2a3)[_0xbc84('0xb')](function(_0x5ae701){logger[_0xbc84('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x1a38dd,_0xbc84('0xd'));logger[_0xbc84('0xe')](_0xbc84('0xf'),_0x1a38dd,_0xbc84('0xd'),JSON['stringify'](_0x5ae701));if(_0x5ae701[_0xbc84('0x10')]){if(_0x5ae701[_0xbc84('0x10')][_0xbc84('0x11')]===0x1f4){logger[_0xbc84('0x10')](_0xbc84('0x12'),_0x1a38dd,_0x5ae701[_0xbc84('0x10')][_0xbc84('0x13')]);return _0x28c9aa(_0x5ae701[_0xbc84('0x10')][_0xbc84('0x13')]);}logger[_0xbc84('0x10')](_0xbc84('0x12'),_0x1a38dd,_0x5ae701[_0xbc84('0x10')][_0xbc84('0x13')]);return _0x1ce0fd(_0x5ae701['error']['message']);}else{logger[_0xbc84('0xc')](_0xbc84('0x12'),_0x1a38dd,_0xbc84('0xd'));_0x1ce0fd(_0x5ae701[_0xbc84('0x14')][_0xbc84('0x13')]);}})[_0xbc84('0x15')](function(_0x44b81e){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x1a38dd,_0x44b81e);_0x28c9aa(_0x44b81e);});});} \ No newline at end of file +var _0xd1af=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','UserProfileResource,\x20%s,\x20%s','message','info','result'];(function(_0x23316f,_0xb435dc){var _0x54c399=function(_0x309bdc){while(--_0x309bdc){_0x23316f['push'](_0x23316f['shift']());}};_0x54c399(++_0xb435dc);}(_0xd1af,0x1e1));var _0xfd1a=function(_0xdebacb,_0x6a5a94){_0xdebacb=_0xdebacb-0x0;var _0x1b8c10=_0xd1af[_0xdebacb];return _0x1b8c10;};'use strict';var _=require(_0xfd1a('0x0'));var util=require(_0xfd1a('0x1'));var moment=require(_0xfd1a('0x2'));var BPromise=require('bluebird');var rs=require(_0xfd1a('0x3'));var fs=require('fs');var Redis=require(_0xfd1a('0x4'));var db=require(_0xfd1a('0x5'))['db'];var utils=require(_0xfd1a('0x6'));var logger=require(_0xfd1a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfd1a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x12a56e,_0x1fd0e7,_0x4c0f2d){return new BPromise(function(_0x538b4d,_0x59c530){return client[_0xfd1a('0x9')](_0x12a56e,_0x4c0f2d)[_0xfd1a('0xa')](function(_0x38ff4f){logger['info']('UserProfileResource,\x20%s,\x20%s',_0x1fd0e7,_0xfd1a('0xb'));logger['debug'](_0xfd1a('0xc'),_0x1fd0e7,_0xfd1a('0xb'),JSON[_0xfd1a('0xd')](_0x38ff4f));if(_0x38ff4f[_0xfd1a('0xe')]){if(_0x38ff4f[_0xfd1a('0xe')]['code']===0x1f4){logger[_0xfd1a('0xe')](_0xfd1a('0xf'),_0x1fd0e7,_0x38ff4f['error'][_0xfd1a('0x10')]);return _0x59c530(_0x38ff4f[_0xfd1a('0xe')]['message']);}logger[_0xfd1a('0xe')](_0xfd1a('0xf'),_0x1fd0e7,_0x38ff4f['error'][_0xfd1a('0x10')]);return _0x538b4d(_0x38ff4f[_0xfd1a('0xe')][_0xfd1a('0x10')]);}else{logger[_0xfd1a('0x11')](_0xfd1a('0xf'),_0x1fd0e7,_0xfd1a('0xb'));_0x538b4d(_0x38ff4f[_0xfd1a('0x12')][_0xfd1a('0x10')]);}})[_0xfd1a('0x13')](function(_0x30cebf){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x1fd0e7,_0x30cebf);_0x59c530(_0x30cebf);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 398e16d..71ee87f 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 _0x48d1=['create','put','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x48d1,0xd6));var _0x148d=function(_0x3d3961,_0x2de3f1){_0x3d3961=_0x3d3961-0x0;var _0x490ad3=_0x48d1[_0x3d3961];return _0x490ad3;};'use strict';var multer=require(_0x148d('0x0'));var util=require(_0x148d('0x1'));var path=require('path');var timeout=require(_0x148d('0x2'));var express=require('express');var router=express[_0x148d('0x3')]();var fs_extra=require(_0x148d('0x4'));var auth=require(_0x148d('0x5'));var interaction=require(_0x148d('0x6'));var config=require(_0x148d('0x7'));var controller=require(_0x148d('0x8'));router[_0x148d('0x9')]('/',auth[_0x148d('0xa')](),controller[_0x148d('0xb')]);router[_0x148d('0x9')](_0x148d('0xc'),auth[_0x148d('0xa')](),controller[_0x148d('0xd')]);router[_0x148d('0x9')](_0x148d('0xe'),auth[_0x148d('0xa')](),controller[_0x148d('0xf')]);router[_0x148d('0x10')]('/',auth[_0x148d('0xa')](),controller[_0x148d('0x11')]);router[_0x148d('0x12')](_0x148d('0xe'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x148d('0x13')]);module[_0x148d('0x14')]=router; \ No newline at end of file +var _0xbf8c=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userProfileSection.controller','isAuthenticated','index','get','describe','/:id','post','put','update','destroy','exports','multer','util'];(function(_0x10ddee,_0x50ef8d){var _0x4b8bc8=function(_0x2a510d){while(--_0x2a510d){_0x10ddee['push'](_0x10ddee['shift']());}};_0x4b8bc8(++_0x50ef8d);}(_0xbf8c,0x154));var _0xcbf8=function(_0x52085a,_0x3717ca){_0x52085a=_0x52085a-0x0;var _0x5afc1a=_0xbf8c[_0x52085a];return _0x5afc1a;};'use strict';var multer=require(_0xcbf8('0x0'));var util=require(_0xcbf8('0x1'));var path=require(_0xcbf8('0x2'));var timeout=require(_0xcbf8('0x3'));var express=require(_0xcbf8('0x4'));var router=express[_0xcbf8('0x5')]();var fs_extra=require(_0xcbf8('0x6'));var auth=require(_0xcbf8('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcbf8('0x8'));router['get']('/',auth[_0xcbf8('0x9')](),controller[_0xcbf8('0xa')]);router[_0xcbf8('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xcbf8('0xc')]);router[_0xcbf8('0xb')](_0xcbf8('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xcbf8('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcbf8('0xf')](_0xcbf8('0xd'),auth[_0xcbf8('0x9')](),controller[_0xcbf8('0x10')]);router['delete'](_0xcbf8('0xd'),auth['isAuthenticated'](),controller[_0xcbf8('0x11')]);module[_0xcbf8('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 78c3b14..9c37e4b 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 _0x5eb8=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x5911c4,_0x2e9f6c){var _0x24243d=function(_0x285f37){while(--_0x285f37){_0x5911c4['push'](_0x5911c4['shift']());}};_0x24243d(++_0x2e9f6c);}(_0x5eb8,0xb0));var _0x85eb=function(_0x33e4a7,_0x2e80a2){_0x33e4a7=_0x33e4a7-0x0;var _0x598620=_0x5eb8[_0x33e4a7];return _0x598620;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x85eb('0x0')],'allowNull':![]},'category':{'type':Sequelize[_0x85eb('0x0')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x85eb('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0x85eb('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x85eb('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x85eb('0x0')],'set':function(_0x13b1df){this[_0x85eb('0x3')](_0x85eb('0x4'),_0x13b1df?_0x13b1df[_0x85eb('0x5')](''):[]);},'get':function(){return this[_0x85eb('0x6')](_0x85eb('0x4'))?this['getDataValue'](_0x85eb('0x4'))[_0x85eb('0x7')](''):[];}}}; \ No newline at end of file +var _0xb9a7=['getDataValue','split','exports','BOOLEAN','STRING','setDataValue','crudPermissions','join'];(function(_0x48601d,_0x45d5c3){var _0x282d75=function(_0x462c04){while(--_0x462c04){_0x48601d['push'](_0x48601d['shift']());}};_0x282d75(++_0x45d5c3);}(_0xb9a7,0x112));var _0x7b9a=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xb9a7[_0x29d94e];return _0x106237;};'use strict';var Sequelize=require('sequelize');module[_0x7b9a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x7b9a('0x1')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x7b9a('0x2')],'set':function(_0x40ef7d){this[_0x7b9a('0x3')](_0x7b9a('0x4'),_0x40ef7d?_0x40ef7d[_0x7b9a('0x5')](''):[]);},'get':function(){return this[_0x7b9a('0x6')](_0x7b9a('0x4'))?this[_0x7b9a('0x6')](_0x7b9a('0x4'))[_0x7b9a('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 030dffc..878bb3c 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 _0xdba0=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','index','UserProfileSection','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','then','include','findAll','rows','catch','show','rawAttributes','fields','includeAll','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdba0,0x116));var _0x0dba=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xdba0[_0x24237f];return _0x48298e;};'use strict';var emlformat=require(_0x0dba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0dba('0x1'));var jsonpatch=require(_0x0dba('0x2'));var rp=require(_0x0dba('0x3'));var moment=require(_0x0dba('0x4'));var BPromise=require(_0x0dba('0x5'));var Mustache=require(_0x0dba('0x6'));var util=require(_0x0dba('0x7'));var path=require(_0x0dba('0x8'));var sox=require('sox');var csv=require(_0x0dba('0x9'));var ejs=require(_0x0dba('0xa'));var fs=require('fs');var fs_extra=require(_0x0dba('0xb'));var _=require(_0x0dba('0xc'));var squel=require('squel');var crypto=require(_0x0dba('0xd'));var jsforce=require(_0x0dba('0xe'));var deskjs=require(_0x0dba('0xf'));var toCsv=require(_0x0dba('0x9'));var querystring=require(_0x0dba('0x10'));var Papa=require('papaparse');var Redis=require(_0x0dba('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0dba('0x12'));var as=require(_0x0dba('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0dba('0x14'))(_0x0dba('0x15'));var utils=require(_0x0dba('0x16'));var config=require(_0x0dba('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5edec4,_0x378488){_0x378488=_0x378488||0xcc;return function(_0x5d7a34){if(_0x5d7a34){return _0x5edec4[_0x0dba('0x18')](_0x378488);}return _0x5edec4[_0x0dba('0x19')](_0x378488)['end']();};}function respondWithResult(_0x1f5c2c,_0x45d869){_0x45d869=_0x45d869||0xc8;return function(_0x58677d){if(_0x58677d){return _0x1f5c2c[_0x0dba('0x19')](_0x45d869)[_0x0dba('0x1a')](_0x58677d);}};}function respondWithFilteredResult(_0x33df2c,_0x21d3de){return function(_0x34174f){if(_0x34174f){var _0x1bc7b6=typeof _0x21d3de['offset']===_0x0dba('0x1b')&&typeof _0x21d3de['limit']===_0x0dba('0x1b');var _0x3ebdc7=_0x34174f[_0x0dba('0x1c')];var _0x10a9bf=_0x1bc7b6?0x0:_0x21d3de[_0x0dba('0x1d')];var _0x3b1286=_0x1bc7b6?_0x34174f[_0x0dba('0x1c')]:_0x21d3de['offset']+_0x21d3de[_0x0dba('0x1e')];var _0x3ed5bd;if(_0x3b1286>=_0x3ebdc7){_0x3b1286=_0x3ebdc7;_0x3ed5bd=0xc8;}else{_0x3ed5bd=0xce;}_0x33df2c['status'](_0x3ed5bd);return _0x33df2c[_0x0dba('0x1f')](_0x0dba('0x20'),_0x10a9bf+'-'+_0x3b1286+'/'+_0x3ebdc7)[_0x0dba('0x1a')](_0x34174f);}return null;};}function patchUpdates(_0x3851c5){return function(_0x3eff8){try{jsonpatch[_0x0dba('0x21')](_0x3eff8,_0x3851c5,!![]);}catch(_0x482606){return BPromise[_0x0dba('0x22')](_0x482606);}return _0x3eff8[_0x0dba('0x23')]();};}function saveUpdates(_0x133683,_0x2a7630){return function(_0x17cbda){if(_0x17cbda){return _0x17cbda[_0x0dba('0x24')](_0x133683)['then'](function(_0x13049a){return _0x13049a;});}return null;};}function removeEntity(_0x4a914c,_0x2f0df1){return function(_0x48fc84){if(_0x48fc84){return _0x48fc84[_0x0dba('0x25')]()['then'](function(){_0x4a914c[_0x0dba('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f0bcf,_0x5963a3){return function(_0x55eb85){if(!_0x55eb85){_0x2f0bcf[_0x0dba('0x18')](0x194);}return _0x55eb85;};}function handleError(_0x107aa5,_0x4f3878){_0x4f3878=_0x4f3878||0x1f4;return function(_0x4c30c7){logger[_0x0dba('0x26')](_0x4c30c7[_0x0dba('0x27')]);if(_0x4c30c7[_0x0dba('0x28')]){delete _0x4c30c7[_0x0dba('0x28')];}_0x107aa5[_0x0dba('0x19')](_0x4f3878)['send'](_0x4c30c7);};}exports[_0x0dba('0x29')]=function(_0x4802bc,_0x319081){var _0x393c2a={},_0x65d018={},_0x29d62f={'count':0x0,'rows':[]};var _0x235a32=_['map'](db[_0x0dba('0x2a')]['rawAttributes'],function(_0x417de8){return{'name':_0x417de8[_0x0dba('0x2b')],'type':_0x417de8[_0x0dba('0x2c')][_0x0dba('0x2d')]};});_0x65d018['model']=_[_0x0dba('0x2e')](_0x235a32,_0x0dba('0x28'));_0x65d018['query']=_[_0x0dba('0x2f')](_0x4802bc[_0x0dba('0x30')]);_0x65d018[_0x0dba('0x31')]=_[_0x0dba('0x32')](_0x65d018[_0x0dba('0x33')],_0x65d018[_0x0dba('0x30')]);_0x393c2a[_0x0dba('0x34')]=_[_0x0dba('0x32')](_0x65d018[_0x0dba('0x33')],qs['fields'](_0x4802bc[_0x0dba('0x30')]['fields']));_0x393c2a[_0x0dba('0x34')]=_0x393c2a['attributes'][_0x0dba('0x35')]?_0x393c2a[_0x0dba('0x34')]:_0x65d018['model'];if(!_0x4802bc[_0x0dba('0x30')][_0x0dba('0x36')](_0x0dba('0x37'))){_0x393c2a['limit']=qs[_0x0dba('0x1e')](_0x4802bc[_0x0dba('0x30')][_0x0dba('0x1e')]);_0x393c2a['offset']=qs[_0x0dba('0x1d')](_0x4802bc[_0x0dba('0x30')]['offset']);}_0x393c2a[_0x0dba('0x38')]=qs[_0x0dba('0x39')](_0x4802bc[_0x0dba('0x30')][_0x0dba('0x39')]);_0x393c2a[_0x0dba('0x3a')]=qs[_0x0dba('0x31')](_['pick'](_0x4802bc[_0x0dba('0x30')],_0x65d018[_0x0dba('0x31')]),_0x235a32);if(_0x4802bc[_0x0dba('0x30')]['filter']){_0x393c2a[_0x0dba('0x3a')]=_[_0x0dba('0x3b')](_0x393c2a[_0x0dba('0x3a')],{'$or':_['map'](_0x235a32,function(_0x42c0f3){if(_0x42c0f3[_0x0dba('0x2c')]!=='VIRTUAL'){var _0xe1bd81={};_0xe1bd81[_0x42c0f3['name']]={'$like':'%'+_0x4802bc['query'][_0x0dba('0x3c')]+'%'};return _0xe1bd81;}})});}_0x393c2a=_['merge']({},_0x393c2a,_0x4802bc['options']);var _0x56846f={'where':_0x393c2a[_0x0dba('0x3a')]};return db['UserProfileSection'][_0x0dba('0x1c')](_0x56846f)[_0x0dba('0x3d')](function(_0x452c6d){_0x29d62f[_0x0dba('0x1c')]=_0x452c6d;if(_0x4802bc[_0x0dba('0x30')]['includeAll']){_0x393c2a[_0x0dba('0x3e')]=[{'all':!![]}];}return db[_0x0dba('0x2a')][_0x0dba('0x3f')](_0x393c2a);})[_0x0dba('0x3d')](function(_0x593f23){_0x29d62f[_0x0dba('0x40')]=_0x593f23;return _0x29d62f;})[_0x0dba('0x3d')](respondWithFilteredResult(_0x319081,_0x393c2a))[_0x0dba('0x41')](handleError(_0x319081,null));};exports[_0x0dba('0x42')]=function(_0x17db83,_0xbe4c86){var _0x3e9e93={'raw':![],'where':{'id':_0x17db83['params']['id']}},_0x3b7704={};_0x3b7704[_0x0dba('0x33')]=_[_0x0dba('0x2f')](db[_0x0dba('0x2a')][_0x0dba('0x43')]);_0x3b7704[_0x0dba('0x30')]=_[_0x0dba('0x2f')](_0x17db83[_0x0dba('0x30')]);_0x3b7704[_0x0dba('0x31')]=_[_0x0dba('0x32')](_0x3b7704[_0x0dba('0x33')],_0x3b7704[_0x0dba('0x30')]);_0x3e9e93['attributes']=_[_0x0dba('0x32')](_0x3b7704[_0x0dba('0x33')],qs[_0x0dba('0x44')](_0x17db83[_0x0dba('0x30')]['fields']));_0x3e9e93[_0x0dba('0x34')]=_0x3e9e93[_0x0dba('0x34')][_0x0dba('0x35')]?_0x3e9e93[_0x0dba('0x34')]:_0x3b7704[_0x0dba('0x33')];if(_0x17db83['query'][_0x0dba('0x45')]){_0x3e9e93[_0x0dba('0x3e')]=[{'all':!![]}];}_0x3e9e93=_['merge']({},_0x3e9e93,_0x17db83['options']);return db[_0x0dba('0x2a')]['find'](_0x3e9e93)[_0x0dba('0x3d')](handleEntityNotFound(_0xbe4c86,null))['then'](respondWithResult(_0xbe4c86,null))['catch'](handleError(_0xbe4c86,null));};exports['create']=function(_0x2b91a6,_0x49595c){return db[_0x0dba('0x2a')]['create'](_0x2b91a6[_0x0dba('0x46')],{})[_0x0dba('0x3d')](respondWithResult(_0x49595c,0xc9))[_0x0dba('0x41')](handleError(_0x49595c,null));};exports[_0x0dba('0x24')]=function(_0x47eb2a,_0x5522ef){if(_0x47eb2a[_0x0dba('0x46')]['id']){delete _0x47eb2a[_0x0dba('0x46')]['id'];}return db[_0x0dba('0x2a')][_0x0dba('0x47')]({'where':{'id':_0x47eb2a[_0x0dba('0x48')]['id']}})['then'](handleEntityNotFound(_0x5522ef,null))['then'](saveUpdates(_0x47eb2a[_0x0dba('0x46')],null))[_0x0dba('0x3d')](respondWithResult(_0x5522ef,null))[_0x0dba('0x41')](handleError(_0x5522ef,null));};exports[_0x0dba('0x25')]=function(_0x3ef81f,_0x39c30d){return db['UserProfileSection'][_0x0dba('0x47')]({'where':{'id':_0x3ef81f[_0x0dba('0x48')]['id']}})[_0x0dba('0x3d')](handleEntityNotFound(_0x39c30d,null))[_0x0dba('0x3d')](removeEntity(_0x39c30d,null))[_0x0dba('0x41')](handleError(_0x39c30d,null));};exports[_0x0dba('0x49')]=function(_0x491cc0,_0x570dcf){return db[_0x0dba('0x2a')][_0x0dba('0x49')]()['then'](respondWithResult(_0x570dcf,null))[_0x0dba('0x41')](handleError(_0x570dcf,null));}; \ No newline at end of file +var _0x2137=['order','sort','where','pick','filter','merge','VIRTUAL','includeAll','show','params','length','include','options','find','create','body','catch','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','UserProfileSection','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit'];(function(_0x2e01ff,_0x537855){var _0x29b485=function(_0xd58840){while(--_0xd58840){_0x2e01ff['push'](_0x2e01ff['shift']());}};_0x29b485(++_0x537855);}(_0x2137,0xf9));var _0x7213=function(_0x4f6513,_0x1a6ce7){_0x4f6513=_0x4f6513-0x0;var _0x5086f1=_0x2137[_0x4f6513];return _0x5086f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7213('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7213('0x1'));var rp=require(_0x7213('0x2'));var moment=require('moment');var BPromise=require(_0x7213('0x3'));var Mustache=require(_0x7213('0x4'));var util=require(_0x7213('0x5'));var path=require(_0x7213('0x6'));var sox=require(_0x7213('0x7'));var csv=require(_0x7213('0x8'));var ejs=require(_0x7213('0x9'));var fs=require('fs');var fs_extra=require(_0x7213('0xa'));var _=require(_0x7213('0xb'));var squel=require(_0x7213('0xc'));var crypto=require('crypto');var jsforce=require(_0x7213('0xd'));var deskjs=require(_0x7213('0xe'));var toCsv=require(_0x7213('0x8'));var querystring=require(_0x7213('0xf'));var Papa=require(_0x7213('0x10'));var Redis=require('ioredis');var authService=require(_0x7213('0x11'));var qs=require(_0x7213('0x12'));var as=require(_0x7213('0x13'));var hardwareService=require(_0x7213('0x14'));var logger=require(_0x7213('0x15'))(_0x7213('0x16'));var utils=require(_0x7213('0x17'));var config=require(_0x7213('0x18'));var licenseUtil=require(_0x7213('0x19'));var db=require(_0x7213('0x1a'))['db'];function respondWithStatusCode(_0xd33243,_0x37d93f){_0x37d93f=_0x37d93f||0xcc;return function(_0x3ff204){if(_0x3ff204){return _0xd33243['sendStatus'](_0x37d93f);}return _0xd33243[_0x7213('0x1b')](_0x37d93f)['end']();};}function respondWithResult(_0x12a53f,_0x35d065){_0x35d065=_0x35d065||0xc8;return function(_0x2cbe83){if(_0x2cbe83){return _0x12a53f['status'](_0x35d065)[_0x7213('0x1c')](_0x2cbe83);}};}function respondWithFilteredResult(_0x16b4ac,_0x3ca14b){return function(_0xdd29a0){if(_0xdd29a0){var _0x31f741=typeof _0x3ca14b[_0x7213('0x1d')]===_0x7213('0x1e')&&typeof _0x3ca14b['limit']==='undefined';var _0x5cd695=_0xdd29a0[_0x7213('0x1f')];var _0x295ea7=_0x31f741?0x0:_0x3ca14b[_0x7213('0x1d')];var _0xfe7371=_0x31f741?_0xdd29a0[_0x7213('0x1f')]:_0x3ca14b[_0x7213('0x1d')]+_0x3ca14b[_0x7213('0x20')];var _0x32ff24;if(_0xfe7371>=_0x5cd695){_0xfe7371=_0x5cd695;_0x32ff24=0xc8;}else{_0x32ff24=0xce;}_0x16b4ac[_0x7213('0x1b')](_0x32ff24);return _0x16b4ac['set'](_0x7213('0x21'),_0x295ea7+'-'+_0xfe7371+'/'+_0x5cd695)[_0x7213('0x1c')](_0xdd29a0);}return null;};}function patchUpdates(_0x579b99){return function(_0xeb2061){try{jsonpatch[_0x7213('0x22')](_0xeb2061,_0x579b99,!![]);}catch(_0x11e998){return BPromise[_0x7213('0x23')](_0x11e998);}return _0xeb2061[_0x7213('0x24')]();};}function saveUpdates(_0x4e6174,_0x8d0f67){return function(_0x2c5d76){if(_0x2c5d76){return _0x2c5d76[_0x7213('0x25')](_0x4e6174)[_0x7213('0x26')](function(_0x5858ce){return _0x5858ce;});}return null;};}function removeEntity(_0x59803c,_0x2bfed5){return function(_0x40e52e){if(_0x40e52e){return _0x40e52e[_0x7213('0x27')]()[_0x7213('0x26')](function(){_0x59803c[_0x7213('0x1b')](0xcc)[_0x7213('0x28')]();});}};}function handleEntityNotFound(_0x6e06ea,_0x26fe75){return function(_0x51c564){if(!_0x51c564){_0x6e06ea[_0x7213('0x29')](0x194);}return _0x51c564;};}function handleError(_0x405bf3,_0x4cbfe1){_0x4cbfe1=_0x4cbfe1||0x1f4;return function(_0x3e5615){logger[_0x7213('0x2a')](_0x3e5615['stack']);if(_0x3e5615[_0x7213('0x2b')]){delete _0x3e5615['name'];}_0x405bf3['status'](_0x4cbfe1)[_0x7213('0x2c')](_0x3e5615);};}exports[_0x7213('0x2d')]=function(_0x135171,_0x473a20){var _0x32bfb3={},_0x2ebdf7={},_0x405f32={'count':0x0,'rows':[]};var _0x5140d4=_['map'](db[_0x7213('0x2e')][_0x7213('0x2f')],function(_0x5293c5){return{'name':_0x5293c5[_0x7213('0x30')],'type':_0x5293c5[_0x7213('0x31')]['key']};});_0x2ebdf7['model']=_['map'](_0x5140d4,'name');_0x2ebdf7['query']=_[_0x7213('0x32')](_0x135171[_0x7213('0x33')]);_0x2ebdf7[_0x7213('0x34')]=_[_0x7213('0x35')](_0x2ebdf7[_0x7213('0x36')],_0x2ebdf7[_0x7213('0x33')]);_0x32bfb3[_0x7213('0x37')]=_['intersection'](_0x2ebdf7['model'],qs['fields'](_0x135171[_0x7213('0x33')][_0x7213('0x38')]));_0x32bfb3['attributes']=_0x32bfb3['attributes']['length']?_0x32bfb3[_0x7213('0x37')]:_0x2ebdf7[_0x7213('0x36')];if(!_0x135171['query'][_0x7213('0x39')](_0x7213('0x3a'))){_0x32bfb3[_0x7213('0x20')]=qs[_0x7213('0x20')](_0x135171[_0x7213('0x33')][_0x7213('0x20')]);_0x32bfb3['offset']=qs[_0x7213('0x1d')](_0x135171[_0x7213('0x33')][_0x7213('0x1d')]);}_0x32bfb3[_0x7213('0x3b')]=qs[_0x7213('0x3c')](_0x135171[_0x7213('0x33')][_0x7213('0x3c')]);_0x32bfb3[_0x7213('0x3d')]=qs[_0x7213('0x34')](_[_0x7213('0x3e')](_0x135171[_0x7213('0x33')],_0x2ebdf7[_0x7213('0x34')]),_0x5140d4);if(_0x135171[_0x7213('0x33')][_0x7213('0x3f')]){_0x32bfb3[_0x7213('0x3d')]=_[_0x7213('0x40')](_0x32bfb3[_0x7213('0x3d')],{'$or':_['map'](_0x5140d4,function(_0x233ed1){if(_0x233ed1[_0x7213('0x31')]!==_0x7213('0x41')){var _0x372c9f={};_0x372c9f[_0x233ed1[_0x7213('0x2b')]]={'$like':'%'+_0x135171['query'][_0x7213('0x3f')]+'%'};return _0x372c9f;}})});}_0x32bfb3=_[_0x7213('0x40')]({},_0x32bfb3,_0x135171['options']);var _0x536f66={'where':_0x32bfb3['where']};return db['UserProfileSection'][_0x7213('0x1f')](_0x536f66)['then'](function(_0x19f4fd){_0x405f32[_0x7213('0x1f')]=_0x19f4fd;if(_0x135171[_0x7213('0x33')][_0x7213('0x42')]){_0x32bfb3['include']=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x32bfb3);})['then'](function(_0x57ce64){_0x405f32['rows']=_0x57ce64;return _0x405f32;})['then'](respondWithFilteredResult(_0x473a20,_0x32bfb3))['catch'](handleError(_0x473a20,null));};exports[_0x7213('0x43')]=function(_0x597d1e,_0x2829c7){var _0x5a1a13={'raw':![],'where':{'id':_0x597d1e[_0x7213('0x44')]['id']}},_0x5a2436={};_0x5a2436['model']=_[_0x7213('0x32')](db[_0x7213('0x2e')][_0x7213('0x2f')]);_0x5a2436[_0x7213('0x33')]=_[_0x7213('0x32')](_0x597d1e[_0x7213('0x33')]);_0x5a2436[_0x7213('0x34')]=_['intersection'](_0x5a2436[_0x7213('0x36')],_0x5a2436[_0x7213('0x33')]);_0x5a1a13['attributes']=_[_0x7213('0x35')](_0x5a2436[_0x7213('0x36')],qs[_0x7213('0x38')](_0x597d1e[_0x7213('0x33')]['fields']));_0x5a1a13[_0x7213('0x37')]=_0x5a1a13['attributes'][_0x7213('0x45')]?_0x5a1a13[_0x7213('0x37')]:_0x5a2436[_0x7213('0x36')];if(_0x597d1e['query']['includeAll']){_0x5a1a13[_0x7213('0x46')]=[{'all':!![]}];}_0x5a1a13=_[_0x7213('0x40')]({},_0x5a1a13,_0x597d1e[_0x7213('0x47')]);return db[_0x7213('0x2e')][_0x7213('0x48')](_0x5a1a13)[_0x7213('0x26')](handleEntityNotFound(_0x2829c7,null))[_0x7213('0x26')](respondWithResult(_0x2829c7,null))['catch'](handleError(_0x2829c7,null));};exports[_0x7213('0x49')]=function(_0x414b4c,_0x3de528){return db[_0x7213('0x2e')][_0x7213('0x49')](_0x414b4c[_0x7213('0x4a')],{})[_0x7213('0x26')](respondWithResult(_0x3de528,0xc9))[_0x7213('0x4b')](handleError(_0x3de528,null));};exports[_0x7213('0x25')]=function(_0x2b4d51,_0x1cea63){if(_0x2b4d51[_0x7213('0x4a')]['id']){delete _0x2b4d51[_0x7213('0x4a')]['id'];}return db[_0x7213('0x2e')]['find']({'where':{'id':_0x2b4d51[_0x7213('0x44')]['id']}})['then'](handleEntityNotFound(_0x1cea63,null))['then'](saveUpdates(_0x2b4d51[_0x7213('0x4a')],null))[_0x7213('0x26')](respondWithResult(_0x1cea63,null))[_0x7213('0x4b')](handleError(_0x1cea63,null));};exports[_0x7213('0x27')]=function(_0x4d7608,_0x2a28e7){return db[_0x7213('0x2e')][_0x7213('0x48')]({'where':{'id':_0x4d7608[_0x7213('0x44')]['id']}})[_0x7213('0x26')](handleEntityNotFound(_0x2a28e7,null))[_0x7213('0x26')](removeEntity(_0x2a28e7,null))['catch'](handleError(_0x2a28e7,null));};exports['describe']=function(_0x4005a6,_0x5d1511){return db[_0x7213('0x2e')][_0x7213('0x4c')]()['then'](respondWithResult(_0x5d1511,null))['catch'](handleError(_0x5d1511,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index acf4b27..2487064 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 _0xf567=['sectionId','userProfileId','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex'];(function(_0x3451c2,_0x16fe00){var _0x49dfd5=function(_0x4eec85){while(--_0x4eec85){_0x3451c2['push'](_0x3451c2['shift']());}};_0x49dfd5(++_0x16fe00);}(_0xf567,0x98));var _0x7f56=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf567[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x7f56('0x0'));var logger=require(_0x7f56('0x1'))(_0x7f56('0x2'));var moment=require(_0x7f56('0x3'));var BPromise=require('bluebird');var rp=require(_0x7f56('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f56('0x5'));var config=require(_0x7f56('0x6'));var attributes=require(_0x7f56('0x7'));module[_0x7f56('0x8')]=function(_0x1658fa,_0x5540b7){return _0x1658fa[_0x7f56('0x9')](_0x7f56('0xa'),attributes,{'tableName':_0x7f56('0xb'),'paranoid':![],'indexes':[{'name':_0x7f56('0xc'),'fields':[_0x7f56('0xd'),_0x7f56('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x31b8=['../../config/environment','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x31b8,0xd7));var _0x831b=function(_0x5923bc,_0x19ae81){_0x5923bc=_0x5923bc-0x0;var _0x1a873f=_0x31b8[_0x5923bc];return _0x1a873f;};'use strict';var _=require('lodash');var util=require(_0x831b('0x0'));var logger=require(_0x831b('0x1'))(_0x831b('0x2'));var moment=require('moment');var BPromise=require(_0x831b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x831b('0x4'));var rimraf=require(_0x831b('0x5'));var config=require(_0x831b('0x6'));var attributes=require(_0x831b('0x7'));module['exports']=function(_0x3a652f,_0x4cd681){return _0x3a652f[_0x831b('0x8')](_0x831b('0x9'),attributes,{'tableName':_0x831b('0xa'),'paranoid':![],'indexes':[{'name':_0x831b('0xb'),'fields':[_0x831b('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 2d0d56c..f92b771 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 _0x861d=['client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1eb4ed,_0x253cc4){var _0x27ff8c=function(_0x3551a2){while(--_0x3551a2){_0x1eb4ed['push'](_0x1eb4ed['shift']());}};_0x27ff8c(++_0x253cc4);}(_0x861d,0x19a));var _0xd861=function(_0x587a82,_0x571786){_0x587a82=_0x587a82-0x0;var _0xd9e8c4=_0x861d[_0x587a82];return _0xd9e8c4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd861('0x0'));var BPromise=require(_0xd861('0x1'));var rs=require(_0xd861('0x2'));var fs=require('fs');var Redis=require(_0xd861('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd861('0x4'))(_0xd861('0x5'));var config=require(_0xd861('0x6'));var jayson=require(_0xd861('0x7'));var client=jayson[_0xd861('0x8')][_0xd861('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x376e1e,_0x567282,_0x2d84c0){return new BPromise(function(_0x18404a,_0x2b98f6){return client[_0xd861('0xa')](_0x376e1e,_0x2d84c0)[_0xd861('0xb')](function(_0x55e19c){logger[_0xd861('0xc')](_0xd861('0xd'),_0x567282,_0xd861('0xe'));logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x567282,_0xd861('0xe'),JSON['stringify'](_0x55e19c));if(_0x55e19c[_0xd861('0xf')]){if(_0x55e19c[_0xd861('0xf')][_0xd861('0x10')]===0x1f4){logger[_0xd861('0xf')](_0xd861('0xd'),_0x567282,_0x55e19c[_0xd861('0xf')][_0xd861('0x11')]);return _0x2b98f6(_0x55e19c[_0xd861('0xf')][_0xd861('0x11')]);}logger[_0xd861('0xf')](_0xd861('0xd'),_0x567282,_0x55e19c['error'][_0xd861('0x11')]);return _0x18404a(_0x55e19c[_0xd861('0xf')][_0xd861('0x11')]);}else{logger['info'](_0xd861('0xd'),_0x567282,'request\x20sent');_0x18404a(_0x55e19c['result'][_0xd861('0x11')]);}})[_0xd861('0x12')](function(_0x24ac52){logger[_0xd861('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x567282,_0x24ac52);_0x2b98f6(_0x24ac52);});});} \ No newline at end of file +var _0x13a6=['http','request','then','UserProfileSection,\x20%s,\x20%s','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4d0cc9,_0x3f84b9){var _0x1ab447=function(_0x5ca128){while(--_0x5ca128){_0x4d0cc9['push'](_0x4d0cc9['shift']());}};_0x1ab447(++_0x3f84b9);}(_0x13a6,0x9c));var _0x613a=function(_0x259e18,_0xd51b6f){_0x259e18=_0x259e18-0x0;var _0x2558c=_0x13a6[_0x259e18];return _0x2558c;};'use strict';var _=require(_0x613a('0x0'));var util=require('util');var moment=require(_0x613a('0x1'));var BPromise=require(_0x613a('0x2'));var rs=require(_0x613a('0x3'));var fs=require('fs');var Redis=require(_0x613a('0x4'));var db=require(_0x613a('0x5'))['db'];var utils=require(_0x613a('0x6'));var logger=require(_0x613a('0x7'))(_0x613a('0x8'));var config=require(_0x613a('0x9'));var jayson=require(_0x613a('0xa'));var client=jayson[_0x613a('0xb')][_0x613a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa7a33f,_0x3aa6ec,_0x5f0f73){return new BPromise(function(_0x47b356,_0x40c09b){return client[_0x613a('0xd')](_0xa7a33f,_0x5f0f73)[_0x613a('0xe')](function(_0x2e3f41){logger['info'](_0x613a('0xf'),_0x3aa6ec,'request\x20sent');logger['debug'](_0x613a('0x10'),_0x3aa6ec,_0x613a('0x11'),JSON['stringify'](_0x2e3f41));if(_0x2e3f41[_0x613a('0x12')]){if(_0x2e3f41[_0x613a('0x12')]['code']===0x1f4){logger[_0x613a('0x12')](_0x613a('0xf'),_0x3aa6ec,_0x2e3f41['error'][_0x613a('0x13')]);return _0x40c09b(_0x2e3f41['error']['message']);}logger[_0x613a('0x12')](_0x613a('0xf'),_0x3aa6ec,_0x2e3f41[_0x613a('0x12')][_0x613a('0x13')]);return _0x47b356(_0x2e3f41[_0x613a('0x12')][_0x613a('0x13')]);}else{logger['info'](_0x613a('0xf'),_0x3aa6ec,_0x613a('0x11'));_0x47b356(_0x2e3f41[_0x613a('0x14')][_0x613a('0x13')]);}})['catch'](function(_0x24c215){logger[_0x613a('0x12')](_0x613a('0xf'),_0x3aa6ec,_0x24c215);_0x40c09b(_0x24c215);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 82d6b19..d551383 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4383e9,_0xa4b307){var _0x355405=function(_0x545b5b){while(--_0x545b5b){_0x4383e9['push'](_0x4383e9['shift']());}};_0x355405(++_0xa4b307);}(_0x9c44,0x178));var _0x49c4=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x55c307,_0x22b2ce){var _0xcca0a9=function(_0x1a2fa9){while(--_0x1a2fa9){_0x55c307['push'](_0x55c307['shift']());}};_0xcca0a9(++_0x22b2ce);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 5d5eac0..a01d54d 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 _0x5c6e=['exports','INTEGER','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5c6e,0x11c));var _0xe5c6=function(_0x10c51f,_0x11270f){_0x10c51f=_0x10c51f-0x0;var _0x56a0cd=_0x5c6e[_0x10c51f];return _0x56a0cd;};'use strict';var Sequelize=require(_0xe5c6('0x0'));module[_0xe5c6('0x1')]={'penalty':{'type':Sequelize[_0xe5c6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb6a6=['INTEGER','exports'];(function(_0x2731f0,_0x126b1b){var _0x36a180=function(_0x44d1a9){while(--_0x44d1a9){_0x2731f0['push'](_0x2731f0['shift']());}};_0x36a180(++_0x126b1b);}(_0xb6a6,0x1ed));var _0x6b6a=function(_0x10782b,_0x29a649){_0x10782b=_0x10782b-0x0;var _0x4863db=_0xb6a6[_0x10782b];return _0x4863db;};'use strict';var Sequelize=require('sequelize');module[_0x6b6a('0x0')]={'penalty':{'type':Sequelize[_0x6b6a('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 91978c6..e6fc118 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 _0x3f8a=['rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x406c76,_0x551839){var _0x43af6f=function(_0x5a7f5e){while(--_0x5a7f5e){_0x406c76['push'](_0x406c76['shift']());}};_0x43af6f(++_0x551839);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x598e5e,_0x125f00){_0x598e5e=_0x598e5e-0x0;var _0x23746c=_0x3f8a[_0x598e5e];return _0x23746c;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));module[_0xa3f8('0xa')]=function(_0x471464,_0x1f160a){return _0x471464[_0xa3f8('0xb')](_0xa3f8('0xc'),attributes,{'tableName':_0xa3f8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe61c=['api','moment','path','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe61c,0xee));var _0xce61=function(_0x134d5e,_0x2a47d8){_0x134d5e=_0x134d5e-0x0;var _0x1e166a=_0xe61c[_0x134d5e];return _0x1e166a;};'use strict';var _=require(_0xce61('0x0'));var util=require('util');var logger=require(_0xce61('0x1'))(_0xce61('0x2'));var moment=require(_0xce61('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xce61('0x4'));var rimraf=require('rimraf');var config=require(_0xce61('0x5'));var attributes=require(_0xce61('0x6'));module[_0xce61('0x7')]=function(_0x200b9a,_0x239319){return _0x200b9a[_0xce61('0x8')](_0xce61('0x9'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index e24e4a5..8b995bd 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 _0xe47a=['UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x3ec333,_0x26bcbe){var _0x15ccb8=function(_0x2c4d0c){while(--_0x2c4d0c){_0x3ec333['push'](_0x3ec333['shift']());}};_0x15ccb8(++_0x26bcbe);}(_0xe47a,0x1d1));var _0xae47=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xe47a[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0xae47('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xae47('0x1'));var rs=require(_0xae47('0x2'));var fs=require('fs');var Redis=require(_0xae47('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xae47('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xae47('0x5'));var client=jayson['client'][_0xae47('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4cc19d,_0x3ae962,_0x5bf08f){return new BPromise(function(_0x585ff3,_0x668316){return client[_0xae47('0x7')](_0x4cc19d,_0x5bf08f)['then'](function(_0x5318a4){logger[_0xae47('0x8')](_0xae47('0x9'),_0x3ae962,_0xae47('0xa'));logger['debug'](_0xae47('0xb'),_0x3ae962,_0xae47('0xa'),JSON[_0xae47('0xc')](_0x5318a4));if(_0x5318a4[_0xae47('0xd')]){if(_0x5318a4['error']['code']===0x1f4){logger[_0xae47('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x3ae962,_0x5318a4[_0xae47('0xd')][_0xae47('0xe')]);return _0x668316(_0x5318a4[_0xae47('0xd')]['message']);}logger[_0xae47('0xd')](_0xae47('0x9'),_0x3ae962,_0x5318a4[_0xae47('0xd')][_0xae47('0xe')]);return _0x585ff3(_0x5318a4[_0xae47('0xd')][_0xae47('0xe')]);}else{logger[_0xae47('0x8')](_0xae47('0x9'),_0x3ae962,'request\x20sent');_0x585ff3(_0x5318a4[_0xae47('0xf')][_0xae47('0xe')]);}})[_0xae47('0x10')](function(_0x183301){logger[_0xae47('0xd')](_0xae47('0x9'),_0x3ae962,_0x183301);_0x668316(_0x183301);});});} \ No newline at end of file +var _0x6832=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4871a9,_0x8e0e9e){var _0x43279e=function(_0x25b154){while(--_0x25b154){_0x4871a9['push'](_0x4871a9['shift']());}};_0x43279e(++_0x8e0e9e);}(_0x6832,0xfd));var _0x2683=function(_0x1b6e1c,_0x375371){_0x1b6e1c=_0x1b6e1c-0x0;var _0x1fb1cd=_0x6832[_0x1b6e1c];return _0x1fb1cd;};'use strict';var _=require(_0x2683('0x0'));var util=require(_0x2683('0x1'));var moment=require(_0x2683('0x2'));var BPromise=require(_0x2683('0x3'));var rs=require(_0x2683('0x4'));var fs=require('fs');var Redis=require(_0x2683('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2683('0x6'));var logger=require(_0x2683('0x7'))(_0x2683('0x8'));var config=require(_0x2683('0x9'));var jayson=require(_0x2683('0xa'));var client=jayson[_0x2683('0xb')][_0x2683('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b35d8,_0x4c6a67,_0x25616a){return new BPromise(function(_0x2f03b0,_0x4c7129){return client['request'](_0x3b35d8,_0x25616a)['then'](function(_0x3e4d3e){logger['info'](_0x2683('0xd'),_0x4c6a67,_0x2683('0xe'));logger[_0x2683('0xf')](_0x2683('0x10'),_0x4c6a67,_0x2683('0xe'),JSON[_0x2683('0x11')](_0x3e4d3e));if(_0x3e4d3e['error']){if(_0x3e4d3e[_0x2683('0x12')][_0x2683('0x13')]===0x1f4){logger['error'](_0x2683('0xd'),_0x4c6a67,_0x3e4d3e[_0x2683('0x12')][_0x2683('0x14')]);return _0x4c7129(_0x3e4d3e[_0x2683('0x12')][_0x2683('0x14')]);}logger[_0x2683('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x4c6a67,_0x3e4d3e['error'][_0x2683('0x14')]);return _0x2f03b0(_0x3e4d3e[_0x2683('0x12')][_0x2683('0x14')]);}else{logger['info'](_0x2683('0xd'),_0x4c6a67,_0x2683('0xe'));_0x2f03b0(_0x3e4d3e[_0x2683('0x15')][_0x2683('0x14')]);}})[_0x2683('0x16')](function(_0x391ce8){logger[_0x2683('0x12')](_0x2683('0xd'),_0x4c6a67,_0x391ce8);_0x4c7129(_0x391ce8);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index a95f875..48d5330 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 _0x5056=['exports','INTEGER','sequelize'];(function(_0x1a7edf,_0x5c4e04){var _0x56c1d9=function(_0x23947e){while(--_0x23947e){_0x1a7edf['push'](_0x1a7edf['shift']());}};_0x56c1d9(++_0x5c4e04);}(_0x5056,0xcb));var _0x6505=function(_0xfd3178,_0x2fc431){_0xfd3178=_0xfd3178-0x0;var _0x4aa916=_0x5056[_0xfd3178];return _0x4aa916;};'use strict';var Sequelize=require(_0x6505('0x0'));module[_0x6505('0x1')]={'UserId':{'type':Sequelize[_0x6505('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa7da=['exports','INTEGER'];(function(_0x566c50,_0x500ab1){var _0x1167dd=function(_0x1e6adb){while(--_0x1e6adb){_0x566c50['push'](_0x566c50['shift']());}};_0x1167dd(++_0x500ab1);}(_0xa7da,0x1f4));var _0xaa7d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7da[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xaa7d('0x0')]={'UserId':{'type':Sequelize[_0xaa7d('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xaa7d('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 3b6d959..44d21bd 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(_0x5dfd7d,_0x27a64b){var _0xe4d80=function(_0x1f03ec){while(--_0x1f03ec){_0x5dfd7d['push'](_0x5dfd7d['shift']());}};_0xe4d80(++_0x27a64b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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(_0x1e52ee,_0x466f1c){var _0x423e1b=function(_0x57b9c7){while(--_0x57b9c7){_0x1e52ee['push'](_0x1e52ee['shift']());}};_0x423e1b(++_0x466f1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 8d8adf7..d58017f 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xb119da,_0x42d325){var _0x3ecb48=function(_0x361539){while(--_0x361539){_0xb119da['push'](_0xb119da['shift']());}};_0x3ecb48(++_0x42d325);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xe9f4a2,_0x50f0c4){var _0x25e066=function(_0x32557f){while(--_0x32557f){_0xe9f4a2['push'](_0xe9f4a2['shift']());}};_0x25e066(++_0x50f0c4);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 618aad0..9006424 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 _0xdb94=['INTEGER','exports'];(function(_0x12adca,_0x49371d){var _0x4d3d61=function(_0x2979fe){while(--_0x2979fe){_0x12adca['push'](_0x12adca['shift']());}};_0x4d3d61(++_0x49371d);}(_0xdb94,0xe5));var _0x4db9=function(_0xde585b,_0x4fd5dd){_0xde585b=_0xde585b-0x0;var _0x2ad4b9=_0xdb94[_0xde585b];return _0x2ad4b9;};'use strict';var Sequelize=require('sequelize');module[_0x4db9('0x0')]={'penalty':{'type':Sequelize[_0x4db9('0x1')],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index f0b4689..0369e99 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 _0xc25e=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','UserVoiceQueue','user_has_voice_queues'];(function(_0x5f12c9,_0x999e31){var _0x53cbaf=function(_0x2a47c7){while(--_0x2a47c7){_0x5f12c9['push'](_0x5f12c9['shift']());}};_0x53cbaf(++_0x999e31);}(_0xc25e,0x145));var _0xec25=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc25e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xec25('0x0'));var util=require(_0xec25('0x1'));var logger=require(_0xec25('0x2'))(_0xec25('0x3'));var moment=require(_0xec25('0x4'));var BPromise=require(_0xec25('0x5'));var rp=require(_0xec25('0x6'));var fs=require('fs');var path=require(_0xec25('0x7'));var rimraf=require(_0xec25('0x8'));var config=require(_0xec25('0x9'));var attributes=require(_0xec25('0xa'));module['exports']=function(_0x44c690,_0x385112){return _0x44c690['define'](_0xec25('0xb'),attributes,{'tableName':_0xec25('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7072=['exports','define','UserVoiceQueue','user_has_voice_queues','util','../../config/logger','api','moment','bluebird','rimraf','./userVoiceQueue.attributes'];(function(_0x51ec64,_0x279fca){var _0x3d4b73=function(_0x25fa64){while(--_0x25fa64){_0x51ec64['push'](_0x51ec64['shift']());}};_0x3d4b73(++_0x279fca);}(_0x7072,0x138));var _0x2707=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x7072[_0x15c421];return _0x5e5ed5;};'use strict';var _=require('lodash');var util=require(_0x2707('0x0'));var logger=require(_0x2707('0x1'))(_0x2707('0x2'));var moment=require(_0x2707('0x3'));var BPromise=require(_0x2707('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2707('0x5'));var config=require('../../config/environment');var attributes=require(_0x2707('0x6'));module[_0x2707('0x7')]=function(_0x1e86f2,_0x194132){return _0x1e86f2[_0x2707('0x8')](_0x2707('0x9'),attributes,{'tableName':_0x2707('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 b4b80f0..9097f00 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 _0x5ea7=['code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5ea7,0x1e7));var _0x75ea=function(_0x2d982d,_0x121028){_0x2d982d=_0x2d982d-0x0;var _0x4f36b0=_0x5ea7[_0x2d982d];return _0x4f36b0;};'use strict';var _=require(_0x75ea('0x0'));var util=require(_0x75ea('0x1'));var moment=require(_0x75ea('0x2'));var BPromise=require(_0x75ea('0x3'));var rs=require(_0x75ea('0x4'));var fs=require('fs');var Redis=require(_0x75ea('0x5'));var db=require(_0x75ea('0x6'))['db'];var utils=require(_0x75ea('0x7'));var logger=require(_0x75ea('0x8'))(_0x75ea('0x9'));var config=require(_0x75ea('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x75ea('0xb')][_0x75ea('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a508c,_0x3d9f09,_0x3d088f){return new BPromise(function(_0x57f0f4,_0x35efe8){return client['request'](_0x4a508c,_0x3d088f)['then'](function(_0x1f320d){logger['info'](_0x75ea('0xd'),_0x3d9f09,_0x75ea('0xe'));logger[_0x75ea('0xf')](_0x75ea('0x10'),_0x3d9f09,_0x75ea('0xe'),JSON[_0x75ea('0x11')](_0x1f320d));if(_0x1f320d[_0x75ea('0x12')]){if(_0x1f320d[_0x75ea('0x12')][_0x75ea('0x13')]===0x1f4){logger[_0x75ea('0x12')](_0x75ea('0xd'),_0x3d9f09,_0x1f320d[_0x75ea('0x12')]['message']);return _0x35efe8(_0x1f320d['error']['message']);}logger[_0x75ea('0x12')](_0x75ea('0xd'),_0x3d9f09,_0x1f320d['error'][_0x75ea('0x14')]);return _0x57f0f4(_0x1f320d['error']['message']);}else{logger[_0x75ea('0x15')](_0x75ea('0xd'),_0x3d9f09,_0x75ea('0xe'));_0x57f0f4(_0x1f320d[_0x75ea('0x16')]['message']);}})['catch'](function(_0x37665c){logger[_0x75ea('0x12')](_0x75ea('0xd'),_0x3d9f09,_0x37665c);_0x35efe8(_0x37665c);});});} \ No newline at end of file +var _0xc849=['message','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x1055d3,_0x5dce87){var _0x55b24a=function(_0x559f0a){while(--_0x559f0a){_0x1055d3['push'](_0x1055d3['shift']());}};_0x55b24a(++_0x5dce87);}(_0xc849,0x1cc));var _0x9c84=function(_0x549a87,_0x2ad7a4){_0x549a87=_0x549a87-0x0;var _0x2ef281=_0xc849[_0x549a87];return _0x2ef281;};'use strict';var _=require(_0x9c84('0x0'));var util=require(_0x9c84('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9c84('0x2'));var fs=require('fs');var Redis=require(_0x9c84('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c84('0x4'));var logger=require(_0x9c84('0x5'))(_0x9c84('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9c84('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x54564b,_0x278728,_0x127589){return new BPromise(function(_0x48a59d,_0x24bd66){return client['request'](_0x54564b,_0x127589)[_0x9c84('0x8')](function(_0x1fbe3e){logger[_0x9c84('0x9')](_0x9c84('0xa'),_0x278728,_0x9c84('0xb'));logger[_0x9c84('0xc')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x278728,_0x9c84('0xb'),JSON[_0x9c84('0xd')](_0x1fbe3e));if(_0x1fbe3e[_0x9c84('0xe')]){if(_0x1fbe3e[_0x9c84('0xe')][_0x9c84('0xf')]===0x1f4){logger[_0x9c84('0xe')](_0x9c84('0xa'),_0x278728,_0x1fbe3e[_0x9c84('0xe')][_0x9c84('0x10')]);return _0x24bd66(_0x1fbe3e[_0x9c84('0xe')][_0x9c84('0x10')]);}logger[_0x9c84('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x278728,_0x1fbe3e['error'][_0x9c84('0x10')]);return _0x48a59d(_0x1fbe3e[_0x9c84('0xe')][_0x9c84('0x10')]);}else{logger[_0x9c84('0x9')](_0x9c84('0xa'),_0x278728,_0x9c84('0xb'));_0x48a59d(_0x1fbe3e['result'][_0x9c84('0x10')]);}})['catch'](function(_0x487482){logger[_0x9c84('0xe')](_0x9c84('0xa'),_0x278728,_0x487482);_0x24bd66(_0x487482);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 60cb370..1b26ad0 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4caade,_0x549ce1){var _0x2041ff=function(_0x402f3a){while(--_0x402f3a){_0x4caade['push'](_0x4caade['shift']());}};_0x2041ff(++_0x549ce1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x52023d,_0x72808f){var _0x46e5db=function(_0x38d789){while(--_0x38d789){_0x52023d['push'](_0x52023d['shift']());}};_0x46e5db(++_0x72808f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5f5cce,_0x138cc5){_0x5f5cce=_0x5f5cce-0x0;var _0x705ecf=_0xcb91[_0x5f5cce];return _0x705ecf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 54f30bd..d9def03 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 _0x6e06=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x4ad003,_0x133d12){var _0x1aab2f=function(_0x2b1d46){while(--_0x2b1d46){_0x4ad003['push'](_0x4ad003['shift']());}};_0x1aab2f(++_0x133d12);}(_0x6e06,0x9a));var _0x66e0=function(_0x25e708,_0x465bcf){_0x25e708=_0x25e708-0x0;var _0x5d9d76=_0x6e06[_0x25e708];return _0x5d9d76;};'use strict';var Sequelize=require(_0x66e0('0x0'));module[_0x66e0('0x1')]={'uniqueid':{'type':Sequelize[_0x66e0('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x66e0('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x66e0('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x66e0('0x4')],'allowNull':![],'unique':_0x66e0('0x5'),'comment':_0x66e0('0x3')},'VoiceQueueId':{'type':Sequelize[_0x66e0('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x66e0('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x66e0('0x3')},'paused':{'type':Sequelize[_0x66e0('0x2')](0xb),'defaultValue':0x0,'comment':_0x66e0('0x3')}}; \ No newline at end of file +var _0xc4b7=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x2e2f70,_0x4af55f){var _0x2521f3=function(_0x2810c4){while(--_0x2810c4){_0x2e2f70['push'](_0x2e2f70['shift']());}};_0x2521f3(++_0x4af55f);}(_0xc4b7,0x129));var _0x7c4b=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xc4b7[_0x565ed7];return _0x183ad7;};'use strict';var Sequelize=require(_0x7c4b('0x0'));module[_0x7c4b('0x1')]={'uniqueid':{'type':Sequelize[_0x7c4b('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x7c4b('0x3')},'membername':{'type':Sequelize[_0x7c4b('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x7c4b('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x7c4b('0x4')],'allowNull':![],'unique':_0x7c4b('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x7c4b('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x7c4b('0x4')],'allowNull':![],'unique':_0x7c4b('0x5'),'comment':_0x7c4b('0x3')},'penalty':{'type':Sequelize[_0x7c4b('0x2')](0xb),'defaultValue':0x0,'comment':_0x7c4b('0x3')},'paused':{'type':Sequelize[_0x7c4b('0x2')](0xb),'defaultValue':0x0,'comment':_0x7c4b('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 3da4def..0fe08a7 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 _0x98cd=['remove','emit','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x6e0605,_0x7c35a5){var _0x273e24=function(_0x4150da){while(--_0x4150da){_0x6e0605['push'](_0x6e0605['shift']());}};_0x273e24(++_0x7c35a5);}(_0x98cd,0xa6));var _0xd98c=function(_0x4c7f94,_0x405ae3){_0x4c7f94=_0x4c7f94-0x0;var _0x43b6fb=_0x98cd[_0x4c7f94];return _0x43b6fb;};'use strict';var EventEmitter=require(_0xd98c('0x0'));var UserVoiceQueueRt=require(_0xd98c('0x1'))['db'][_0xd98c('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xd98c('0x3')](0x0);var events={'afterCreate':_0xd98c('0x4'),'afterUpdate':'update','afterDestroy':_0xd98c('0x5')};function emitEvent(_0x4ff239){return function(_0x593f95,_0x14b8aa,_0xe12362){UserVoiceQueueRtEvents[_0xd98c('0x6')](_0x4ff239+':'+_0x593f95['id'],_0x593f95);UserVoiceQueueRtEvents[_0xd98c('0x6')](_0x4ff239,_0x593f95);_0xe12362(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xd98c('0x7')](e,emitEvent(event));}}module[_0xd98c('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x9536=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt'];(function(_0xf6a90c,_0x61e7b7){var _0xf0faf4=function(_0x1e6479){while(--_0x1e6479){_0xf6a90c['push'](_0xf6a90c['shift']());}};_0xf0faf4(++_0x61e7b7);}(_0x9536,0x115));var _0x6953=function(_0x191154,_0x56f74c){_0x191154=_0x191154-0x0;var _0x3dcd73=_0x9536[_0x191154];return _0x3dcd73;};'use strict';var EventEmitter=require(_0x6953('0x0'));var UserVoiceQueueRt=require(_0x6953('0x1'))['db'][_0x6953('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x6953('0x3')](0x0);var events={'afterCreate':_0x6953('0x4'),'afterUpdate':'update','afterDestroy':_0x6953('0x5')};function emitEvent(_0x3cae2e){return function(_0x2ccd7d,_0x584d8d,_0x7630c2){UserVoiceQueueRtEvents[_0x6953('0x6')](_0x3cae2e+':'+_0x2ccd7d['id'],_0x2ccd7d);UserVoiceQueueRtEvents[_0x6953('0x6')](_0x3cae2e,_0x2ccd7d);_0x7630c2(null);};}for(var e in events){if(events[_0x6953('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x6953('0x8')](e,emitEvent(event));}}module[_0x6953('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 539f92e..ce46a4f 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 _0x4e82=['lodash','util','bluebird','path','rimraf','./userVoiceQueueRt.attributes','define','user_has_voice_queues_rt'];(function(_0x444f32,_0xc9e2f5){var _0x5b4e2a=function(_0x40ce7){while(--_0x40ce7){_0x444f32['push'](_0x444f32['shift']());}};_0x5b4e2a(++_0xc9e2f5);}(_0x4e82,0x180));var _0x24e8=function(_0xfc1adc,_0x16009e){_0xfc1adc=_0xfc1adc-0x0;var _0x1d9510=_0x4e82[_0xfc1adc];return _0x1d9510;};'use strict';var _=require(_0x24e8('0x0'));var util=require(_0x24e8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x24e8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x24e8('0x3'));var rimraf=require(_0x24e8('0x4'));var config=require('../../config/environment');var attributes=require(_0x24e8('0x5'));module['exports']=function(_0x1e98e8,_0x5ac21c){return _0x1e98e8[_0x24e8('0x6')]('UserVoiceQueueRt',attributes,{'tableName':_0x24e8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa80c=['../../config/environment','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa80c,0xdd));var _0xca80=function(_0x4d99f7,_0x3db232){_0x4d99f7=_0x4d99f7-0x0;var _0x293ee3=_0xa80c[_0x4d99f7];return _0x293ee3;};'use strict';var _=require(_0xca80('0x0'));var util=require('util');var logger=require(_0xca80('0x1'))('api');var moment=require(_0xca80('0x2'));var BPromise=require(_0xca80('0x3'));var rp=require(_0xca80('0x4'));var fs=require('fs');var path=require(_0xca80('0x5'));var rimraf=require(_0xca80('0x6'));var config=require(_0xca80('0x7'));var attributes=require('./userVoiceQueueRt.attributes');module[_0xca80('0x8')]=function(_0x33e325,_0x17695f){return _0x33e325[_0xca80('0x9')](_0xca80('0xa'),attributes,{'tableName':_0xca80('0xb'),'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 cf31991..d0b44ef 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 _0x74e9=['catch','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','client','http','defaults','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x2e5d81,_0x1740cc){var _0x40c4ce=function(_0x42054f){while(--_0x42054f){_0x2e5d81['push'](_0x2e5d81['shift']());}};_0x40c4ce(++_0x1740cc);}(_0x74e9,0x100));var _0x974e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x74e9[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x974e('0x0'));var util=require(_0x974e('0x1'));var moment=require(_0x974e('0x2'));var BPromise=require('bluebird');var rs=require(_0x974e('0x3'));var fs=require('fs');var Redis=require(_0x974e('0x4'));var db=require(_0x974e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x974e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x974e('0x7')][_0x974e('0x8')]({'port':0x232a});config['redis']=_[_0x974e('0x9')](config[_0x974e('0xa')],{'host':_0x974e('0xb'),'port':0x18eb});var socket=require(_0x974e('0xc'))(new Redis(config['redis']));require(_0x974e('0xd'))[_0x974e('0xe')](socket);function respondWithRpcPromise(_0x3fa525,_0x4ab165,_0x2e072b){return new BPromise(function(_0x3222fb,_0x56e3b3){return client[_0x974e('0xf')](_0x3fa525,_0x2e072b)[_0x974e('0x10')](function(_0x896f84){logger['info'](_0x974e('0x11'),_0x4ab165,_0x974e('0x12'));logger[_0x974e('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x4ab165,_0x974e('0x12'),JSON[_0x974e('0x14')](_0x896f84));if(_0x896f84['error']){if(_0x896f84[_0x974e('0x15')]['code']===0x1f4){logger[_0x974e('0x15')](_0x974e('0x11'),_0x4ab165,_0x896f84[_0x974e('0x15')][_0x974e('0x16')]);return _0x56e3b3(_0x896f84[_0x974e('0x15')]['message']);}logger[_0x974e('0x15')](_0x974e('0x11'),_0x4ab165,_0x896f84['error'][_0x974e('0x16')]);return _0x3222fb(_0x896f84[_0x974e('0x15')][_0x974e('0x16')]);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x4ab165,_0x974e('0x12'));_0x3222fb(_0x896f84[_0x974e('0x17')][_0x974e('0x16')]);}})[_0x974e('0x18')](function(_0x4b162c){logger[_0x974e('0x15')](_0x974e('0x11'),_0x4ab165,_0x4b162c);_0x56e3b3(_0x4b162c);});});}exports[_0x974e('0x19')]=function(_0x78129c){var _0x25daca=this;return new Promise(function(_0x185233,_0x49bd80){return db['UserVoiceQueueRt'][_0x974e('0x1a')]({'raw':_0x78129c[_0x974e('0x1b')]?_0x78129c[_0x974e('0x1b')][_0x974e('0x1c')]===undefined?!![]:![]:!![],'where':_0x78129c['options']?_0x78129c[_0x974e('0x1b')][_0x974e('0x1d')]||null:null,'attributes':[[db[_0x974e('0x1e')]['fn'](_0x974e('0x1f'),db[_0x974e('0x1e')]['fn']('IF',db[_0x974e('0x1e')][_0x974e('0x20')](_0x974e('0x21')))),_0x974e('0x22')]]})[_0x974e('0x10')](function(_0x330d66){logger['info'](_0x974e('0x19'),_0x78129c);logger[_0x974e('0x13')]('GetVoiceQueueRtPauses',_0x78129c,JSON[_0x974e('0x14')](_0x330d66));_0x185233(_0x330d66);})['catch'](function(_0x249e19){logger[_0x974e('0x15')](_0x974e('0x19'),_0x249e19[_0x974e('0x16')],_0x78129c);_0x49bd80(_0x25daca[_0x974e('0x15')](0x1f4,_0x249e19['message']));});});}; \ No newline at end of file +var _0xe0e7=['where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueueRtPauses','findAll','options','raw'];(function(_0x38fb0d,_0x52b5db){var _0x30a5d6=function(_0x31eba6){while(--_0x31eba6){_0x38fb0d['push'](_0x38fb0d['shift']());}};_0x30a5d6(++_0x52b5db);}(_0xe0e7,0x18c));var _0x7e0e=function(_0x5afbd5,_0x48a693){_0x5afbd5=_0x5afbd5-0x0;var _0x298511=_0xe0e7[_0x5afbd5];return _0x298511;};'use strict';var _=require(_0x7e0e('0x0'));var util=require(_0x7e0e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7e0e('0x2'));var fs=require('fs');var Redis=require(_0x7e0e('0x3'));var db=require(_0x7e0e('0x4'))['db'];var utils=require(_0x7e0e('0x5'));var logger=require(_0x7e0e('0x6'))(_0x7e0e('0x7'));var config=require(_0x7e0e('0x8'));var jayson=require(_0x7e0e('0x9'));var client=jayson[_0x7e0e('0xa')][_0x7e0e('0xb')]({'port':0x232a});config[_0x7e0e('0xc')]=_[_0x7e0e('0xd')](config[_0x7e0e('0xc')],{'host':_0x7e0e('0xe'),'port':0x18eb});var socket=require(_0x7e0e('0xf'))(new Redis(config[_0x7e0e('0xc')]));require(_0x7e0e('0x10'))[_0x7e0e('0x11')](socket);function respondWithRpcPromise(_0x559984,_0x55f6aa,_0x2cbf5d){return new BPromise(function(_0x29fa4c,_0x57d49e){return client['request'](_0x559984,_0x2cbf5d)[_0x7e0e('0x12')](function(_0xb89c55){logger[_0x7e0e('0x13')](_0x7e0e('0x14'),_0x55f6aa,_0x7e0e('0x15'));logger[_0x7e0e('0x16')](_0x7e0e('0x17'),_0x55f6aa,'request\x20sent',JSON['stringify'](_0xb89c55));if(_0xb89c55[_0x7e0e('0x18')]){if(_0xb89c55[_0x7e0e('0x18')][_0x7e0e('0x19')]===0x1f4){logger['error'](_0x7e0e('0x14'),_0x55f6aa,_0xb89c55[_0x7e0e('0x18')]['message']);return _0x57d49e(_0xb89c55['error'][_0x7e0e('0x1a')]);}logger[_0x7e0e('0x18')](_0x7e0e('0x14'),_0x55f6aa,_0xb89c55[_0x7e0e('0x18')][_0x7e0e('0x1a')]);return _0x29fa4c(_0xb89c55[_0x7e0e('0x18')][_0x7e0e('0x1a')]);}else{logger['info'](_0x7e0e('0x14'),_0x55f6aa,'request\x20sent');_0x29fa4c(_0xb89c55[_0x7e0e('0x1b')][_0x7e0e('0x1a')]);}})[_0x7e0e('0x1c')](function(_0x11559d){logger[_0x7e0e('0x18')](_0x7e0e('0x14'),_0x55f6aa,_0x11559d);_0x57d49e(_0x11559d);});});}exports[_0x7e0e('0x1d')]=function(_0x1ac5c7){var _0x44b89a=this;return new Promise(function(_0x1f1a6c,_0x1939ec){return db['UserVoiceQueueRt'][_0x7e0e('0x1e')]({'raw':_0x1ac5c7[_0x7e0e('0x1f')]?_0x1ac5c7['options'][_0x7e0e('0x20')]===undefined?!![]:![]:!![],'where':_0x1ac5c7[_0x7e0e('0x1f')]?_0x1ac5c7[_0x7e0e('0x1f')][_0x7e0e('0x21')]||null:null,'attributes':[[db[_0x7e0e('0x22')]['fn'](_0x7e0e('0x23'),db[_0x7e0e('0x22')]['fn']('IF',db[_0x7e0e('0x22')][_0x7e0e('0x24')](_0x7e0e('0x25')))),_0x7e0e('0x26')]]})['then'](function(_0x4bc836){logger[_0x7e0e('0x13')](_0x7e0e('0x1d'),_0x1ac5c7);logger[_0x7e0e('0x16')](_0x7e0e('0x1d'),_0x1ac5c7,JSON['stringify'](_0x4bc836));_0x1f1a6c(_0x4bc836);})[_0x7e0e('0x1c')](function(_0x3ea8dc){logger[_0x7e0e('0x18')]('GetVoiceQueueRtPauses',_0x3ea8dc[_0x7e0e('0x1a')],_0x1ac5c7);_0x1939ec(_0x44b89a[_0x7e0e('0x18')](0x1f4,_0x3ea8dc[_0x7e0e('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index d3c17a0..59709f7 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 _0x7e02=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','register','length'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0x7e02,0x71));var _0x27e0=function(_0x3ae812,_0x104449){_0x3ae812=_0x3ae812-0x0;var _0x4dd965=_0x7e02[_0x3ae812];return _0x4dd965;};'use strict';var UserVoiceQueueRtEvents=require(_0x27e0('0x0'));var events=[_0x27e0('0x1'),_0x27e0('0x2'),_0x27e0('0x3')];function createListener(_0x6daf9e,_0x3bfa3b){return function(_0x310a36){_0x3bfa3b['emit'](_0x6daf9e,_0x310a36);};}function removeListener(_0x4fa613,_0x3d4f41){return function(){UserVoiceQueueRtEvents['removeListener'](_0x4fa613,_0x3d4f41);};}exports[_0x27e0('0x4')]=function(_0x1f98c5){for(var _0x3ddcd2=0x0,_0x1cc944=events[_0x27e0('0x5')];_0x3ddcd2<_0x1cc944;_0x3ddcd2++){var _0x2dff51=events[_0x3ddcd2];var _0x44ae54=createListener(_0x27e0('0x6')+_0x2dff51,_0x1f98c5);UserVoiceQueueRtEvents['on'](_0x2dff51,_0x44ae54);}}; \ No newline at end of file +var _0xe700=['update','emit','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove'];(function(_0x1d5759,_0x417e09){var _0x51ddcd=function(_0x4e3f43){while(--_0x4e3f43){_0x1d5759['push'](_0x1d5759['shift']());}};_0x51ddcd(++_0x417e09);}(_0xe700,0x75));var _0x0e70=function(_0x46c2c5,_0x3abb57){_0x46c2c5=_0x46c2c5-0x0;var _0x18769e=_0xe700[_0x46c2c5];return _0x18769e;};'use strict';var UserVoiceQueueRtEvents=require(_0x0e70('0x0'));var events=[_0x0e70('0x1'),_0x0e70('0x2'),_0x0e70('0x3')];function createListener(_0x22ef20,_0x162ace){return function(_0x3f212c){_0x162ace[_0x0e70('0x4')](_0x22ef20,_0x3f212c);};}function removeListener(_0x27ba59,_0xb9349a){return function(){UserVoiceQueueRtEvents['removeListener'](_0x27ba59,_0xb9349a);};}exports[_0x0e70('0x5')]=function(_0x5e1b28){for(var _0x44a1ee=0x0,_0x30303a=events[_0x0e70('0x6')];_0x44a1ee<_0x30303a;_0x44a1ee++){var _0x28fcf2=events[_0x44a1ee];var _0x235881=createListener(_0x0e70('0x7')+_0x28fcf2,_0x5e1b28);UserVoiceQueueRtEvents['on'](_0x28fcf2,_0x235881);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index f2b3a88..7a1e46a 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x51a004,_0xe2122b){var _0x54a79b=function(_0x469e23){while(--_0x469e23){_0x51a004['push'](_0x51a004['shift']());}};_0x54a79b(++_0xe2122b);}(_0xe706,0xa3));var _0x6e70=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xe706[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2b6d46,_0x11867e){var _0x555bdb=function(_0x11122d){while(--_0x11122d){_0x2b6d46['push'](_0x2b6d46['shift']());}};_0x555bdb(++_0x11867e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 7088d1d..9b87e3d 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 _0x0a2a=['sequelize','exports','INTEGER'];(function(_0x5894ab,_0x18c6fd){var _0x1af2f8=function(_0x4c6a87){while(--_0x4c6a87){_0x5894ab['push'](_0x5894ab['shift']());}};_0x1af2f8(++_0x18c6fd);}(_0x0a2a,0x186));var _0xa0a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0a2a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa0a2('0x0'));module[_0xa0a2('0x1')]={'penalty':{'type':Sequelize[_0xa0a2('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x32c4=['INTEGER','exports'];(function(_0x43c18f,_0x502d7e){var _0x2e3d60=function(_0x28ae1c){while(--_0x28ae1c){_0x43c18f['push'](_0x43c18f['shift']());}};_0x2e3d60(++_0x502d7e);}(_0x32c4,0x71));var _0x432c=function(_0x31b60f,_0x59e5a5){_0x31b60f=_0x31b60f-0x0;var _0x8ff0a8=_0x32c4[_0x31b60f];return _0x8ff0a8;};'use strict';var Sequelize=require('sequelize');module[_0x432c('0x0')]={'penalty':{'type':Sequelize[_0x432c('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 b299258..4ab291d 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 _0x1691=['rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4c5454,_0x11c560){var _0x557651=function(_0x1f0582){while(--_0x1f0582){_0x4c5454['push'](_0x4c5454['shift']());}};_0x557651(++_0x11c560);}(_0x1691,0x133));var _0x1169=function(_0x3dcaea,_0x2e7222){_0x3dcaea=_0x3dcaea-0x0;var _0xb6f875=_0x1691[_0x3dcaea];return _0xb6f875;};'use strict';var _=require(_0x1169('0x0'));var util=require(_0x1169('0x1'));var logger=require(_0x1169('0x2'))(_0x1169('0x3'));var moment=require(_0x1169('0x4'));var BPromise=require(_0x1169('0x5'));var rp=require(_0x1169('0x6'));var fs=require('fs');var path=require(_0x1169('0x7'));var rimraf=require(_0x1169('0x8'));var config=require(_0x1169('0x9'));var attributes=require(_0x1169('0xa'));module[_0x1169('0xb')]=function(_0x3118e0,_0x3ac00c){return _0x3118e0[_0x1169('0xc')](_0x1169('0xd'),attributes,{'tableName':_0x1169('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x152a=['rimraf','../../config/environment','./userWhatsappQueue.attributes','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','bluebird','request-promise','path'];(function(_0x2d02bc,_0x2f09fe){var _0x3a5237=function(_0x3cb09b){while(--_0x3cb09b){_0x2d02bc['push'](_0x2d02bc['shift']());}};_0x3a5237(++_0x2f09fe);}(_0x152a,0x1d1));var _0xa152=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x152a[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0xa152('0x0'));var util=require(_0xa152('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa152('0x2'));var rp=require(_0xa152('0x3'));var fs=require('fs');var path=require(_0xa152('0x4'));var rimraf=require(_0xa152('0x5'));var config=require(_0xa152('0x6'));var attributes=require(_0xa152('0x7'));module['exports']=function(_0x2f44fb,_0x29e20f){return _0x2f44fb['define'](_0xa152('0x8'),attributes,{'tableName':_0xa152('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 10186c3..4e7e872 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 _0xa149=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring'];(function(_0x3a329f,_0x5db8b8){var _0xad1b27=function(_0x143ca4){while(--_0x143ca4){_0x3a329f['push'](_0x3a329f['shift']());}};_0xad1b27(++_0x5db8b8);}(_0xa149,0x1c9));var _0x9a14=function(_0x26214f,_0x1e1d7f){_0x26214f=_0x26214f-0x0;var _0x45e5e4=_0xa149[_0x26214f];return _0x45e5e4;};'use strict';var _=require(_0x9a14('0x0'));var util=require(_0x9a14('0x1'));var moment=require(_0x9a14('0x2'));var BPromise=require(_0x9a14('0x3'));var rs=require(_0x9a14('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a14('0x6'))(_0x9a14('0x7'));var config=require(_0x9a14('0x8'));var jayson=require(_0x9a14('0x9'));var client=jayson[_0x9a14('0xa')][_0x9a14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10a8fc,_0x59b2ed,_0x5a09d2){return new BPromise(function(_0x35ae78,_0x4ff9cf){return client['request'](_0x10a8fc,_0x5a09d2)['then'](function(_0x4b1d96){logger['info'](_0x9a14('0xc'),_0x59b2ed,'request\x20sent');logger[_0x9a14('0xd')](_0x9a14('0xe'),_0x59b2ed,'request\x20sent',JSON[_0x9a14('0xf')](_0x4b1d96));if(_0x4b1d96['error']){if(_0x4b1d96[_0x9a14('0x10')][_0x9a14('0x11')]===0x1f4){logger[_0x9a14('0x10')](_0x9a14('0xc'),_0x59b2ed,_0x4b1d96['error'][_0x9a14('0x12')]);return _0x4ff9cf(_0x4b1d96[_0x9a14('0x10')]['message']);}logger[_0x9a14('0x10')](_0x9a14('0xc'),_0x59b2ed,_0x4b1d96[_0x9a14('0x10')][_0x9a14('0x12')]);return _0x35ae78(_0x4b1d96[_0x9a14('0x10')][_0x9a14('0x12')]);}else{logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x59b2ed,_0x9a14('0x13'));_0x35ae78(_0x4b1d96[_0x9a14('0x14')][_0x9a14('0x12')]);}})['catch'](function(_0x2e4712){logger[_0x9a14('0x10')](_0x9a14('0xc'),_0x59b2ed,_0x2e4712);_0x4ff9cf(_0x2e4712);});});} \ No newline at end of file +var _0x6fe4=['../../config/environment','jayson/promise','http','request','info','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UserWhatsappQueue,\x20%s,\x20%s','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x43d0dd,_0x1bd3d2){var _0x233879=function(_0x4461ef){while(--_0x4461ef){_0x43d0dd['push'](_0x43d0dd['shift']());}};_0x233879(++_0x1bd3d2);}(_0x6fe4,0xca));var _0x46fe=function(_0x5b5636,_0x170c2b){_0x5b5636=_0x5b5636-0x0;var _0x516b49=_0x6fe4[_0x5b5636];return _0x516b49;};'use strict';var _=require(_0x46fe('0x0'));var util=require(_0x46fe('0x1'));var moment=require(_0x46fe('0x2'));var BPromise=require(_0x46fe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46fe('0x4'));var db=require(_0x46fe('0x5'))['db'];var utils=require(_0x46fe('0x6'));var logger=require('../../config/logger')(_0x46fe('0x7'));var config=require(_0x46fe('0x8'));var jayson=require(_0x46fe('0x9'));var client=jayson['client'][_0x46fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb8e5d9,_0x485d19,_0x2dbd55){return new BPromise(function(_0x31fdac,_0x267132){return client[_0x46fe('0xb')](_0xb8e5d9,_0x2dbd55)['then'](function(_0x29bcea){logger[_0x46fe('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x485d19,_0x46fe('0xd'));logger['debug'](_0x46fe('0xe'),_0x485d19,_0x46fe('0xd'),JSON[_0x46fe('0xf')](_0x29bcea));if(_0x29bcea[_0x46fe('0x10')]){if(_0x29bcea[_0x46fe('0x10')][_0x46fe('0x11')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x485d19,_0x29bcea[_0x46fe('0x10')]['message']);return _0x267132(_0x29bcea['error'][_0x46fe('0x12')]);}logger[_0x46fe('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x485d19,_0x29bcea['error']['message']);return _0x31fdac(_0x29bcea['error']['message']);}else{logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x485d19,'request\x20sent');_0x31fdac(_0x29bcea['result']['message']);}})[_0x46fe('0x13')](function(_0x3af42f){logger[_0x46fe('0x10')](_0x46fe('0x14'),_0x485d19,_0x3af42f);_0x267132(_0x3af42f);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 5028548..25b2b6a 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 _0x54ef=['../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','index','get','/:id','show','isAuthenticated','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x54ef,0x112));var _0xf54e=function(_0x344a44,_0x2a53c8){_0x344a44=_0x344a44-0x0;var _0x569447=_0x54ef[_0x344a44];return _0x569447;};'use strict';var multer=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var path=require(_0xf54e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf54e('0x3'));var router=express[_0xf54e('0x4')]();var fs_extra=require(_0xf54e('0x5'));var auth=require(_0xf54e('0x6'));var interaction=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var controller=require(_0xf54e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf54e('0xa')]);router[_0xf54e('0xb')](_0xf54e('0xc'),auth['isAuthenticated'](),controller[_0xf54e('0xd')]);router['post']('/',auth[_0xf54e('0xe')](),controller[_0xf54e('0xf')]);router['put'](_0xf54e('0xc'),auth[_0xf54e('0xe')](),controller[_0xf54e('0x10')]);router[_0xf54e('0x11')]('/:id',auth[_0xf54e('0xe')](),controller[_0xf54e('0x12')]);module[_0xf54e('0x13')]=router; \ No newline at end of file +var _0xd82a=['index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated'];(function(_0x1fab94,_0x50e113){var _0x4dc581=function(_0x83dea4){while(--_0x83dea4){_0x1fab94['push'](_0x1fab94['shift']());}};_0x4dc581(++_0x50e113);}(_0xd82a,0xbd));var _0xad82=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xd82a[_0x36c5b0];return _0xf19333;};'use strict';var multer=require(_0xad82('0x0'));var util=require(_0xad82('0x1'));var path=require(_0xad82('0x2'));var timeout=require(_0xad82('0x3'));var express=require('express');var router=express[_0xad82('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xad82('0x5'));var interaction=require(_0xad82('0x6'));var config=require(_0xad82('0x7'));var controller=require(_0xad82('0x8'));router[_0xad82('0x9')]('/',auth[_0xad82('0xa')](),controller[_0xad82('0xb')]);router[_0xad82('0x9')](_0xad82('0xc'),auth[_0xad82('0xa')](),controller['show']);router[_0xad82('0xd')]('/',auth[_0xad82('0xa')](),controller[_0xad82('0xe')]);router[_0xad82('0xf')](_0xad82('0xc'),auth[_0xad82('0xa')](),controller[_0xad82('0x10')]);router[_0xad82('0x11')](_0xad82('0xc'),auth[_0xad82('0xa')](),controller[_0xad82('0x12')]);module[_0xad82('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 4543e27..bbc648d 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 _0x9d9d=['exports','STRING','name'];(function(_0x274730,_0x2879c3){var _0x5c5ee3=function(_0x40a569){while(--_0x40a569){_0x274730['push'](_0x274730['shift']());}};_0x5c5ee3(++_0x2879c3);}(_0x9d9d,0x129));var _0xd9d9=function(_0x33d2eb,_0x364d1c){_0x33d2eb=_0x33d2eb-0x0;var _0x596230=_0x9d9d[_0x33d2eb];return _0x596230;};'use strict';var Sequelize=require('sequelize');module[_0xd9d9('0x0')]={'name':{'type':Sequelize[_0xd9d9('0x1')],'unique':_0xd9d9('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd9d9('0x1')]}}; \ No newline at end of file +var _0x7df1=['sequelize','exports','STRING'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7df1,0xe4));var _0x17df=function(_0x55dae0,_0x19a83b){_0x55dae0=_0x55dae0-0x0;var _0x477039=_0x7df1[_0x55dae0];return _0x477039;};'use strict';var Sequelize=require(_0x17df('0x0'));module[_0x17df('0x1')]={'name':{'type':Sequelize[_0x17df('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x17df('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 68b8846..8cb14d0 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 _0xbbe5=['query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','fieldName','type','key'];(function(_0x4e1c7d,_0x4b0cb1){var _0x5aae82=function(_0xa8c761){while(--_0xa8c761){_0x4e1c7d['push'](_0x4e1c7d['shift']());}};_0x5aae82(++_0x4b0cb1);}(_0xbbe5,0x6f));var _0x5bbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbe5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5bbe('0x0'));var rimraf=require(_0x5bbe('0x1'));var zipdir=require(_0x5bbe('0x2'));var jsonpatch=require(_0x5bbe('0x3'));var rp=require(_0x5bbe('0x4'));var moment=require('moment');var BPromise=require(_0x5bbe('0x5'));var Mustache=require(_0x5bbe('0x6'));var util=require(_0x5bbe('0x7'));var path=require(_0x5bbe('0x8'));var sox=require(_0x5bbe('0x9'));var csv=require(_0x5bbe('0xa'));var ejs=require(_0x5bbe('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5bbe('0xc'));var squel=require('squel');var crypto=require(_0x5bbe('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5bbe('0xa'));var querystring=require(_0x5bbe('0xe'));var Papa=require(_0x5bbe('0xf'));var Redis=require(_0x5bbe('0x10'));var authService=require(_0x5bbe('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bbe('0x12'));var logger=require(_0x5bbe('0x13'))('api');var utils=require(_0x5bbe('0x14'));var config=require(_0x5bbe('0x15'));var licenseUtil=require(_0x5bbe('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2457e9,_0x4abd2a){_0x4abd2a=_0x4abd2a||0xcc;return function(_0xf8de15){if(_0xf8de15){return _0x2457e9[_0x5bbe('0x17')](_0x4abd2a);}return _0x2457e9[_0x5bbe('0x18')](_0x4abd2a)[_0x5bbe('0x19')]();};}function respondWithResult(_0x42d464,_0x2025ca){_0x2025ca=_0x2025ca||0xc8;return function(_0x66f079){if(_0x66f079){return _0x42d464[_0x5bbe('0x18')](_0x2025ca)['json'](_0x66f079);}};}function respondWithFilteredResult(_0x3974c9,_0x3609e7){return function(_0x495d62){if(_0x495d62){var _0x58c331=typeof _0x3609e7['offset']==='undefined'&&typeof _0x3609e7['limit']==='undefined';var _0x279485=_0x495d62[_0x5bbe('0x1a')];var _0x502436=_0x58c331?0x0:_0x3609e7[_0x5bbe('0x1b')];var _0x232f93=_0x58c331?_0x495d62[_0x5bbe('0x1a')]:_0x3609e7[_0x5bbe('0x1b')]+_0x3609e7[_0x5bbe('0x1c')];var _0x2e4104;if(_0x232f93>=_0x279485){_0x232f93=_0x279485;_0x2e4104=0xc8;}else{_0x2e4104=0xce;}_0x3974c9[_0x5bbe('0x18')](_0x2e4104);return _0x3974c9[_0x5bbe('0x1d')](_0x5bbe('0x1e'),_0x502436+'-'+_0x232f93+'/'+_0x279485)['json'](_0x495d62);}return null;};}function patchUpdates(_0x30d1a2){return function(_0x1228e2){try{jsonpatch[_0x5bbe('0x1f')](_0x1228e2,_0x30d1a2,!![]);}catch(_0x59620f){return BPromise[_0x5bbe('0x20')](_0x59620f);}return _0x1228e2['save']();};}function saveUpdates(_0x40003b,_0x1cc069){return function(_0x181bac){if(_0x181bac){return _0x181bac[_0x5bbe('0x21')](_0x40003b)[_0x5bbe('0x22')](function(_0x41844c){return _0x41844c;});}return null;};}function removeEntity(_0x47cbf5,_0xf45501){return function(_0x361d0e){if(_0x361d0e){return _0x361d0e[_0x5bbe('0x23')]()['then'](function(){var _0x52434a=_0x361d0e[_0x5bbe('0x24')]({'plain':!![]});var _0x1d2a11=_0x5bbe('0x25');return db[_0x5bbe('0x26')][_0x5bbe('0x23')]({'where':{'type':_0x1d2a11,'resourceId':_0x52434a['id']}})['then'](function(){return _0x361d0e;});})[_0x5bbe('0x22')](function(){_0x47cbf5[_0x5bbe('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a0bb8,_0x450049){return function(_0x59175f){if(!_0x59175f){_0x5a0bb8['sendStatus'](0x194);}return _0x59175f;};}function handleError(_0x963cdb,_0x268e3b){_0x268e3b=_0x268e3b||0x1f4;return function(_0x16f9a5){logger[_0x5bbe('0x27')](_0x16f9a5[_0x5bbe('0x28')]);if(_0x16f9a5['name']){delete _0x16f9a5[_0x5bbe('0x29')];}_0x963cdb[_0x5bbe('0x18')](_0x268e3b)[_0x5bbe('0x2a')](_0x16f9a5);};}exports[_0x5bbe('0x2b')]=function(_0x35e50a,_0xc538bd){var _0x4a79c7={},_0x4323fd={},_0x4a9c4c={'count':0x0,'rows':[]};var _0x107fdb=_[_0x5bbe('0x2c')](db[_0x5bbe('0x2d')]['rawAttributes'],function(_0x19abd8){return{'name':_0x19abd8[_0x5bbe('0x2e')],'type':_0x19abd8[_0x5bbe('0x2f')][_0x5bbe('0x30')]};});_0x4323fd['model']=_[_0x5bbe('0x2c')](_0x107fdb,'name');_0x4323fd[_0x5bbe('0x31')]=_['keys'](_0x35e50a['query']);_0x4323fd['filters']=_[_0x5bbe('0x32')](_0x4323fd[_0x5bbe('0x33')],_0x4323fd[_0x5bbe('0x31')]);_0x4a79c7[_0x5bbe('0x34')]=_['intersection'](_0x4323fd[_0x5bbe('0x33')],qs[_0x5bbe('0x35')](_0x35e50a['query'][_0x5bbe('0x35')]));_0x4a79c7['attributes']=_0x4a79c7[_0x5bbe('0x34')][_0x5bbe('0x36')]?_0x4a79c7['attributes']:_0x4323fd[_0x5bbe('0x33')];if(!_0x35e50a[_0x5bbe('0x31')][_0x5bbe('0x37')](_0x5bbe('0x38'))){_0x4a79c7['limit']=qs[_0x5bbe('0x1c')](_0x35e50a[_0x5bbe('0x31')][_0x5bbe('0x1c')]);_0x4a79c7[_0x5bbe('0x1b')]=qs['offset'](_0x35e50a[_0x5bbe('0x31')][_0x5bbe('0x1b')]);}_0x4a79c7[_0x5bbe('0x39')]=qs[_0x5bbe('0x3a')](_0x35e50a[_0x5bbe('0x31')]['sort']);_0x4a79c7['where']=qs[_0x5bbe('0x3b')](_[_0x5bbe('0x3c')](_0x35e50a['query'],_0x4323fd['filters']),_0x107fdb);if(_0x35e50a[_0x5bbe('0x31')][_0x5bbe('0x3d')]){_0x4a79c7[_0x5bbe('0x3e')]=_[_0x5bbe('0x3f')](_0x4a79c7[_0x5bbe('0x3e')],{'$or':_['map'](_0x107fdb,function(_0x262f1d){if(_0x262f1d['type']!=='VIRTUAL'){var _0x293f19={};_0x293f19[_0x262f1d[_0x5bbe('0x29')]]={'$like':'%'+_0x35e50a[_0x5bbe('0x31')]['filter']+'%'};return _0x293f19;}})});}_0x4a79c7=_[_0x5bbe('0x3f')]({},_0x4a79c7,_0x35e50a[_0x5bbe('0x40')]);var _0x24c7b1={'where':_0x4a79c7[_0x5bbe('0x3e')]};return db[_0x5bbe('0x2d')][_0x5bbe('0x1a')](_0x24c7b1)[_0x5bbe('0x22')](function(_0x2e1220){_0x4a9c4c['count']=_0x2e1220;if(_0x35e50a['query'][_0x5bbe('0x41')]){_0x4a79c7[_0x5bbe('0x42')]=[{'all':!![]}];}return db[_0x5bbe('0x2d')][_0x5bbe('0x43')](_0x4a79c7);})[_0x5bbe('0x22')](function(_0x44fe88){_0x4a9c4c[_0x5bbe('0x44')]=_0x44fe88;return _0x4a9c4c;})[_0x5bbe('0x22')](respondWithFilteredResult(_0xc538bd,_0x4a79c7))[_0x5bbe('0x45')](handleError(_0xc538bd,null));};exports['show']=function(_0x363ec0,_0x4051bb){var _0x199ccb={'raw':!![],'where':{'id':_0x363ec0[_0x5bbe('0x46')]['id']}},_0x235414={};_0x235414['model']=_[_0x5bbe('0x47')](db[_0x5bbe('0x2d')][_0x5bbe('0x48')]);_0x235414[_0x5bbe('0x31')]=_[_0x5bbe('0x47')](_0x363ec0[_0x5bbe('0x31')]);_0x235414[_0x5bbe('0x3b')]=_['intersection'](_0x235414[_0x5bbe('0x33')],_0x235414[_0x5bbe('0x31')]);_0x199ccb['attributes']=_[_0x5bbe('0x32')](_0x235414[_0x5bbe('0x33')],qs[_0x5bbe('0x35')](_0x363ec0['query'][_0x5bbe('0x35')]));_0x199ccb[_0x5bbe('0x34')]=_0x199ccb['attributes'][_0x5bbe('0x36')]?_0x199ccb['attributes']:_0x235414['model'];if(_0x363ec0[_0x5bbe('0x31')][_0x5bbe('0x41')]){_0x199ccb['include']=[{'all':!![]}];}_0x199ccb=_['merge']({},_0x199ccb,_0x363ec0[_0x5bbe('0x40')]);return db[_0x5bbe('0x2d')][_0x5bbe('0x49')](_0x199ccb)[_0x5bbe('0x22')](handleEntityNotFound(_0x4051bb,null))[_0x5bbe('0x22')](respondWithResult(_0x4051bb,null))['catch'](handleError(_0x4051bb,null));};exports[_0x5bbe('0x4a')]=function(_0x187d80,_0x543434){return db['Variable']['create'](_0x187d80[_0x5bbe('0x4b')],{})[_0x5bbe('0x22')](function(_0x1671f0){var _0x5adc09=_0x187d80['user'][_0x5bbe('0x24')]({'plain':!![]});if(!_0x5adc09)throw new Error(_0x5bbe('0x4c'));if(_0x5adc09['role']===_0x5bbe('0x4d')){var _0x120821=_0x1671f0[_0x5bbe('0x24')]({'plain':!![]});var _0x5c37ef=_0x5bbe('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x5c37ef,'userProfileId':_0x5adc09['userProfileId']},'raw':!![]})[_0x5bbe('0x22')](function(_0xc4cd1){if(_0xc4cd1&&_0xc4cd1[_0x5bbe('0x4e')]===0x0){return db['UserProfileResource'][_0x5bbe('0x4a')]({'name':_0x120821['name'],'resourceId':_0x120821['id'],'type':_0xc4cd1[_0x5bbe('0x29')],'sectionId':_0xc4cd1['id']},{})['then'](function(){return _0x1671f0;});}else{return _0x1671f0;}})[_0x5bbe('0x45')](function(_0x3f19b3){logger[_0x5bbe('0x27')](_0x5bbe('0x4f'),_0x3f19b3);throw _0x3f19b3;});}return _0x1671f0;})['then'](respondWithResult(_0x543434,0xc9))[_0x5bbe('0x45')](handleError(_0x543434,null));};exports[_0x5bbe('0x21')]=function(_0xdb719b,_0x21edab){if(_0xdb719b[_0x5bbe('0x4b')]['id']){delete _0xdb719b[_0x5bbe('0x4b')]['id'];}return db[_0x5bbe('0x2d')][_0x5bbe('0x49')]({'where':{'id':_0xdb719b[_0x5bbe('0x46')]['id']}})[_0x5bbe('0x22')](handleEntityNotFound(_0x21edab,null))[_0x5bbe('0x22')](saveUpdates(_0xdb719b[_0x5bbe('0x4b')],null))[_0x5bbe('0x22')](respondWithResult(_0x21edab,null))[_0x5bbe('0x45')](handleError(_0x21edab,null));};exports[_0x5bbe('0x23')]=function(_0x3a751b,_0x4f435a){return db['Variable'][_0x5bbe('0x49')]({'where':{'id':_0x3a751b[_0x5bbe('0x46')]['id']}})['then'](handleEntityNotFound(_0x4f435a,null))[_0x5bbe('0x22')](removeEntity(_0x4f435a,null))['catch'](handleError(_0x4f435a,null));}; \ No newline at end of file +var _0x332c=['VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','Variables','error','stack','name','send','index','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','map'];(function(_0x554340,_0x4787ae){var _0x579a53=function(_0x2a6ac3){while(--_0x2a6ac3){_0x554340['push'](_0x554340['shift']());}};_0x579a53(++_0x4787ae);}(_0x332c,0x67));var _0xc332=function(_0x1ee7cd,_0x1a314b){_0x1ee7cd=_0x1ee7cd-0x0;var _0x4e0136=_0x332c[_0x1ee7cd];return _0x4e0136;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc332('0x0'));var zipdir=require(_0xc332('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc332('0x2'));var moment=require(_0xc332('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc332('0x4'));var util=require(_0xc332('0x5'));var path=require(_0xc332('0x6'));var sox=require(_0xc332('0x7'));var csv=require(_0xc332('0x8'));var ejs=require(_0xc332('0x9'));var fs=require('fs');var fs_extra=require(_0xc332('0xa'));var _=require('lodash');var squel=require(_0xc332('0xb'));var crypto=require(_0xc332('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc332('0xd'));var Papa=require(_0xc332('0xe'));var Redis=require('ioredis');var authService=require(_0xc332('0xf'));var qs=require(_0xc332('0x10'));var as=require(_0xc332('0x11'));var hardwareService=require(_0xc332('0x12'));var logger=require(_0xc332('0x13'))(_0xc332('0x14'));var utils=require(_0xc332('0x15'));var config=require(_0xc332('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc332('0x17'))['db'];function respondWithStatusCode(_0x42bef9,_0x33a9e5){_0x33a9e5=_0x33a9e5||0xcc;return function(_0x11561b){if(_0x11561b){return _0x42bef9[_0xc332('0x18')](_0x33a9e5);}return _0x42bef9[_0xc332('0x19')](_0x33a9e5)[_0xc332('0x1a')]();};}function respondWithResult(_0x16596c,_0x77ee31){_0x77ee31=_0x77ee31||0xc8;return function(_0x7b3cb5){if(_0x7b3cb5){return _0x16596c[_0xc332('0x19')](_0x77ee31)[_0xc332('0x1b')](_0x7b3cb5);}};}function respondWithFilteredResult(_0x5405ac,_0x560ec4){return function(_0x1efd8d){if(_0x1efd8d){var _0x4b6428=typeof _0x560ec4[_0xc332('0x1c')]===_0xc332('0x1d')&&typeof _0x560ec4[_0xc332('0x1e')]==='undefined';var _0x217437=_0x1efd8d[_0xc332('0x1f')];var _0x5de810=_0x4b6428?0x0:_0x560ec4[_0xc332('0x1c')];var _0x12fb54=_0x4b6428?_0x1efd8d[_0xc332('0x1f')]:_0x560ec4[_0xc332('0x1c')]+_0x560ec4['limit'];var _0x2b68fb;if(_0x12fb54>=_0x217437){_0x12fb54=_0x217437;_0x2b68fb=0xc8;}else{_0x2b68fb=0xce;}_0x5405ac[_0xc332('0x19')](_0x2b68fb);return _0x5405ac['set'](_0xc332('0x20'),_0x5de810+'-'+_0x12fb54+'/'+_0x217437)[_0xc332('0x1b')](_0x1efd8d);}return null;};}function patchUpdates(_0x57da7a){return function(_0x2441ef){try{jsonpatch[_0xc332('0x21')](_0x2441ef,_0x57da7a,!![]);}catch(_0x4e45a7){return BPromise[_0xc332('0x22')](_0x4e45a7);}return _0x2441ef['save']();};}function saveUpdates(_0x11111d,_0x450bf2){return function(_0x45b5db){if(_0x45b5db){return _0x45b5db[_0xc332('0x23')](_0x11111d)['then'](function(_0x52257d){return _0x52257d;});}return null;};}function removeEntity(_0x314f5c,_0x3a3c93){return function(_0x5c1653){if(_0x5c1653){return _0x5c1653[_0xc332('0x24')]()[_0xc332('0x25')](function(){var _0x2204de=_0x5c1653['get']({'plain':!![]});var _0x30344e=_0xc332('0x26');return db['UserProfileResource'][_0xc332('0x24')]({'where':{'type':_0x30344e,'resourceId':_0x2204de['id']}})[_0xc332('0x25')](function(){return _0x5c1653;});})[_0xc332('0x25')](function(){_0x314f5c[_0xc332('0x19')](0xcc)[_0xc332('0x1a')]();});}};}function handleEntityNotFound(_0x562d5d,_0x2a857f){return function(_0x32e22b){if(!_0x32e22b){_0x562d5d[_0xc332('0x18')](0x194);}return _0x32e22b;};}function handleError(_0x3a1454,_0x2b024e){_0x2b024e=_0x2b024e||0x1f4;return function(_0x35f1c3){logger[_0xc332('0x27')](_0x35f1c3[_0xc332('0x28')]);if(_0x35f1c3[_0xc332('0x29')]){delete _0x35f1c3['name'];}_0x3a1454[_0xc332('0x19')](_0x2b024e)[_0xc332('0x2a')](_0x35f1c3);};}exports[_0xc332('0x2b')]=function(_0xe60804,_0x1f7e72){var _0x312688={},_0x361a5d={},_0x255593={'count':0x0,'rows':[]};var _0x13fe11=_['map'](db[_0xc332('0x2c')][_0xc332('0x2d')],function(_0x5245ac){return{'name':_0x5245ac[_0xc332('0x2e')],'type':_0x5245ac[_0xc332('0x2f')][_0xc332('0x30')]};});_0x361a5d[_0xc332('0x31')]=_['map'](_0x13fe11,_0xc332('0x29'));_0x361a5d[_0xc332('0x32')]=_[_0xc332('0x33')](_0xe60804['query']);_0x361a5d[_0xc332('0x34')]=_[_0xc332('0x35')](_0x361a5d[_0xc332('0x31')],_0x361a5d[_0xc332('0x32')]);_0x312688[_0xc332('0x36')]=_[_0xc332('0x35')](_0x361a5d[_0xc332('0x31')],qs['fields'](_0xe60804[_0xc332('0x32')]['fields']));_0x312688['attributes']=_0x312688['attributes'][_0xc332('0x37')]?_0x312688[_0xc332('0x36')]:_0x361a5d[_0xc332('0x31')];if(!_0xe60804[_0xc332('0x32')][_0xc332('0x38')](_0xc332('0x39'))){_0x312688[_0xc332('0x1e')]=qs[_0xc332('0x1e')](_0xe60804[_0xc332('0x32')]['limit']);_0x312688[_0xc332('0x1c')]=qs['offset'](_0xe60804[_0xc332('0x32')][_0xc332('0x1c')]);}_0x312688['order']=qs['sort'](_0xe60804[_0xc332('0x32')]['sort']);_0x312688[_0xc332('0x3a')]=qs[_0xc332('0x34')](_[_0xc332('0x3b')](_0xe60804[_0xc332('0x32')],_0x361a5d[_0xc332('0x34')]),_0x13fe11);if(_0xe60804['query'][_0xc332('0x3c')]){_0x312688[_0xc332('0x3a')]=_[_0xc332('0x3d')](_0x312688[_0xc332('0x3a')],{'$or':_[_0xc332('0x3e')](_0x13fe11,function(_0x4df9d4){if(_0x4df9d4[_0xc332('0x2f')]!==_0xc332('0x3f')){var _0x2e1a8a={};_0x2e1a8a[_0x4df9d4[_0xc332('0x29')]]={'$like':'%'+_0xe60804[_0xc332('0x32')][_0xc332('0x3c')]+'%'};return _0x2e1a8a;}})});}_0x312688=_[_0xc332('0x3d')]({},_0x312688,_0xe60804[_0xc332('0x40')]);var _0x1ffa8d={'where':_0x312688[_0xc332('0x3a')]};return db['Variable']['count'](_0x1ffa8d)[_0xc332('0x25')](function(_0x1084a9){_0x255593[_0xc332('0x1f')]=_0x1084a9;if(_0xe60804['query'][_0xc332('0x41')]){_0x312688['include']=[{'all':!![]}];}return db[_0xc332('0x2c')][_0xc332('0x42')](_0x312688);})[_0xc332('0x25')](function(_0x15c686){_0x255593[_0xc332('0x43')]=_0x15c686;return _0x255593;})[_0xc332('0x25')](respondWithFilteredResult(_0x1f7e72,_0x312688))[_0xc332('0x44')](handleError(_0x1f7e72,null));};exports['show']=function(_0x192327,_0x22bd3d){var _0x449755={'raw':!![],'where':{'id':_0x192327[_0xc332('0x45')]['id']}},_0x5763f9={};_0x5763f9[_0xc332('0x31')]=_[_0xc332('0x33')](db[_0xc332('0x2c')][_0xc332('0x2d')]);_0x5763f9[_0xc332('0x32')]=_[_0xc332('0x33')](_0x192327[_0xc332('0x32')]);_0x5763f9[_0xc332('0x34')]=_['intersection'](_0x5763f9[_0xc332('0x31')],_0x5763f9[_0xc332('0x32')]);_0x449755[_0xc332('0x36')]=_['intersection'](_0x5763f9[_0xc332('0x31')],qs['fields'](_0x192327[_0xc332('0x32')]['fields']));_0x449755['attributes']=_0x449755[_0xc332('0x36')][_0xc332('0x37')]?_0x449755['attributes']:_0x5763f9[_0xc332('0x31')];if(_0x192327[_0xc332('0x32')]['includeAll']){_0x449755[_0xc332('0x46')]=[{'all':!![]}];}_0x449755=_['merge']({},_0x449755,_0x192327['options']);return db[_0xc332('0x2c')][_0xc332('0x47')](_0x449755)[_0xc332('0x25')](handleEntityNotFound(_0x22bd3d,null))[_0xc332('0x25')](respondWithResult(_0x22bd3d,null))[_0xc332('0x44')](handleError(_0x22bd3d,null));};exports['create']=function(_0x13ff9a,_0x33d9bf){return db['Variable'][_0xc332('0x48')](_0x13ff9a[_0xc332('0x49')],{})[_0xc332('0x25')](function(_0x16ae64){var _0x7d9601=_0x13ff9a[_0xc332('0x4a')]['get']({'plain':!![]});if(!_0x7d9601)throw new Error(_0xc332('0x4b'));if(_0x7d9601[_0xc332('0x4c')]==='user'){var _0x4642e7=_0x16ae64[_0xc332('0x4d')]({'plain':!![]});var _0x493842=_0xc332('0x26');return db[_0xc332('0x4e')]['find']({'where':{'name':_0x493842,'userProfileId':_0x7d9601[_0xc332('0x4f')]},'raw':!![]})[_0xc332('0x25')](function(_0x1723f5){if(_0x1723f5&&_0x1723f5[_0xc332('0x50')]===0x0){return db[_0xc332('0x51')][_0xc332('0x48')]({'name':_0x4642e7[_0xc332('0x29')],'resourceId':_0x4642e7['id'],'type':_0x1723f5[_0xc332('0x29')],'sectionId':_0x1723f5['id']},{})[_0xc332('0x25')](function(){return _0x16ae64;});}else{return _0x16ae64;}})[_0xc332('0x44')](function(_0x2d4824){logger[_0xc332('0x27')](_0xc332('0x52'),_0x2d4824);throw _0x2d4824;});}return _0x16ae64;})[_0xc332('0x25')](respondWithResult(_0x33d9bf,0xc9))[_0xc332('0x44')](handleError(_0x33d9bf,null));};exports[_0xc332('0x23')]=function(_0x236274,_0xb4dd7e){if(_0x236274['body']['id']){delete _0x236274[_0xc332('0x49')]['id'];}return db[_0xc332('0x2c')][_0xc332('0x47')]({'where':{'id':_0x236274[_0xc332('0x45')]['id']}})[_0xc332('0x25')](handleEntityNotFound(_0xb4dd7e,null))[_0xc332('0x25')](saveUpdates(_0x236274['body'],null))[_0xc332('0x25')](respondWithResult(_0xb4dd7e,null))[_0xc332('0x44')](handleError(_0xb4dd7e,null));};exports[_0xc332('0x24')]=function(_0x837955,_0x3afd78){return db['Variable'][_0xc332('0x47')]({'where':{'id':_0x837955[_0xc332('0x45')]['id']}})[_0xc332('0x25')](handleEntityNotFound(_0x3afd78,null))['then'](removeEntity(_0x3afd78,null))[_0xc332('0x44')](handleError(_0x3afd78,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 6b2b773..dc30a52 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 _0x3645=['rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3fb150,_0x5e32ed){var _0x56f4a8=function(_0x57924c){while(--_0x57924c){_0x3fb150['push'](_0x3fb150['shift']());}};_0x56f4a8(++_0x5e32ed);}(_0x3645,0x1ab));var _0x5364=function(_0x1ff2ec,_0x386e86){_0x1ff2ec=_0x1ff2ec-0x0;var _0x405683=_0x3645[_0x1ff2ec];return _0x405683;};'use strict';var _=require(_0x5364('0x0'));var util=require(_0x5364('0x1'));var logger=require(_0x5364('0x2'))(_0x5364('0x3'));var moment=require(_0x5364('0x4'));var BPromise=require(_0x5364('0x5'));var rp=require(_0x5364('0x6'));var fs=require('fs');var path=require(_0x5364('0x7'));var rimraf=require(_0x5364('0x8'));var config=require(_0x5364('0x9'));var attributes=require(_0x5364('0xa'));module[_0x5364('0xb')]=function(_0x3b8888,_0x202245){return _0x3b8888[_0x5364('0xc')](_0x5364('0xd'),attributes,{'tableName':_0x5364('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5bd=['request-promise','path','./variable.attributes','define','Variable','tools_variables','lodash','bluebird'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd5bd,0xfe));var _0xdd5b=function(_0xf39273,_0x15899a){_0xf39273=_0xf39273-0x0;var _0x27cc53=_0xd5bd[_0xf39273];return _0x27cc53;};'use strict';var _=require(_0xdd5b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xdd5b('0x1'));var rp=require(_0xdd5b('0x2'));var fs=require('fs');var path=require(_0xdd5b('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdd5b('0x4'));module['exports']=function(_0x1525a6,_0x411398){return _0x1525a6[_0xdd5b('0x5')](_0xdd5b('0x6'),attributes,{'tableName':_0xdd5b('0x7'),'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 e6ad209..3512dfb 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 _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x3ad5e8,_0x49cd96){var _0xdd51a4=function(_0x4dfff7){while(--_0x4dfff7){_0x3ad5e8['push'](_0x3ad5e8['shift']());}};_0xdd51a4(++_0x49cd96);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1a8e2a,_0x1bce1f){_0x1a8e2a=_0x1a8e2a-0x0;var _0x2df4ae=_0x1cb9[_0x1a8e2a];return _0x2df4ae;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file +var _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x4649c5,_0x44ed48){var _0x28a2b5=function(_0x221c65){while(--_0x221c65){_0x4649c5['push'](_0x4649c5['shift']());}};_0x28a2b5(++_0x44ed48);}(_0xabce,0x103));var _0xeabc=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xabce[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 5327f00..b981ac1 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 _0x8675=['migrations','exports','express','./version.controller','get','index','isAuthenticated','canUpdate','fetch','/reset','reset','pull','/restart','/migrations'];(function(_0x5b4e33,_0x28787d){var _0x3eb278=function(_0xdf9dc7){while(--_0xdf9dc7){_0x5b4e33['push'](_0x5b4e33['shift']());}};_0x3eb278(++_0x28787d);}(_0x8675,0xf0));var _0x5867=function(_0x5c1de9,_0x16b37a){_0x5c1de9=_0x5c1de9-0x0;var _0x452529=_0x8675[_0x5c1de9];return _0x452529;};'use strict';var express=require(_0x5867('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x5867('0x1'));router[_0x5867('0x2')]('/',controller[_0x5867('0x3')]);router[_0x5867('0x2')]('/fetch',auth[_0x5867('0x4')](),auth[_0x5867('0x5')](),controller[_0x5867('0x6')]);router[_0x5867('0x2')](_0x5867('0x7'),auth['isAuthenticated'](),auth[_0x5867('0x5')](),controller[_0x5867('0x8')]);router[_0x5867('0x2')]('/pull',auth[_0x5867('0x4')](),auth['canUpdate'](),controller[_0x5867('0x9')]);router['get'](_0x5867('0xa'),auth[_0x5867('0x4')](),controller['restart']);router['get'](_0x5867('0xb'),controller[_0x5867('0xc')]);module[_0x5867('0xd')]=router; \ No newline at end of file +var _0x1a1a=['reset','get','/migrations','migrations','exports','Router','../../components/auth/service','./version.controller','index','isAuthenticated','canUpdate','fetch'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x1a1a,0x19d));var _0xa1a1=function(_0x451b6a,_0xae0f7e){_0x451b6a=_0x451b6a-0x0;var _0x2e25aa=_0x1a1a[_0x451b6a];return _0x2e25aa;};'use strict';var express=require('express');var router=express[_0xa1a1('0x0')]();var auth=require(_0xa1a1('0x1'));var controller=require(_0xa1a1('0x2'));router['get']('/',controller[_0xa1a1('0x3')]);router['get']('/fetch',auth[_0xa1a1('0x4')](),auth[_0xa1a1('0x5')](),controller[_0xa1a1('0x6')]);router['get']('/reset',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xa1a1('0x7')]);router[_0xa1a1('0x8')]('/pull',auth[_0xa1a1('0x4')](),auth[_0xa1a1('0x5')](),controller['pull']);router[_0xa1a1('0x8')]('/restart',auth['isAuthenticated'](),controller['restart']);router[_0xa1a1('0x8')](_0xa1a1('0x9'),controller[_0xa1a1('0xa')]);module[_0xa1a1('0xb')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 0b0d94f..a1347cc 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 _0x5ec1=['latest','tags','exports','json','status','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','root','.js','push','length','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.','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','version','compare-versions','exec','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','query'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x5ec1,0x176));var _0x15ec=function(_0x242a4f,_0x369c57){_0x242a4f=_0x242a4f-0x0;var _0x122117=_0x5ec1[_0x242a4f];return _0x122117;};'use strict';var Umzug=require(_0x15ec('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x15ec('0x1'));var pkginfo=require('pkginfo')(module,_0x15ec('0x2'));var compareVersions=require(_0x15ec('0x3'));var exec=require('child_process')[_0x15ec('0x4')];var db=require(_0x15ec('0x5'))['db'];var config=require(_0x15ec('0x6'));var pm2=require('../../config/pm2');var logger=require(_0x15ec('0x7'))(_0x15ec('0x8'));var git=require(_0x15ec('0x9'))(config['root']);exports['index']=function(_0x33bdde,_0x940c16){var _0x53302b={'current':module['exports'][_0x15ec('0x2')],'phonebar':0x2};if(_0x33bdde['query']&&_0x33bdde[_0x15ec('0xa')][_0x15ec('0xb')]){return git['fetch']()[_0x15ec('0xc')](function(_0x57a8b9,_0x3f6acb){_0x53302b[_0x15ec('0xb')]=(_0x57a8b9?module[_0x15ec('0xd')][_0x15ec('0x2')]:_0x3f6acb[_0x15ec('0xb')])||'2.0.0';return _0x940c16['status'](0xc8)[_0x15ec('0xe')](_0x53302b);});}else{return _0x940c16[_0x15ec('0xf')](0xc8)[_0x15ec('0xe')](_0x53302b);}};exports['fetch']=function(_0xba9687,_0x1773ee){return git[_0x15ec('0x10')]([_0x15ec('0x11'),_0x15ec('0x12')],function(_0x1a4e36){if(_0x1a4e36){logger[_0x15ec('0x13')](_0x1a4e36);return _0x1773ee['status'](0x1f4)['json'](_0x1a4e36);}logger[_0x15ec('0x14')](_0x15ec('0x15'));return _0x1773ee[_0x15ec('0xf')](0xc8)['json']({'output':_0x15ec('0x16')});});};exports[_0x15ec('0x17')]=function(_0x363ce1,_0x46e263){return git['reset']([_0x15ec('0x18'),_0x15ec('0x19')],function(_0x59b462){if(_0x59b462){logger[_0x15ec('0x13')](_0x59b462);return _0x46e263[_0x15ec('0xf')](0x1f4)[_0x15ec('0xe')](_0x59b462);}logger['info'](_0x15ec('0x1a'));return _0x46e263['status'](0xc8)[_0x15ec('0xe')]({'output':_0x15ec('0x1b')});});};exports[_0x15ec('0x1c')]=function(_0x30b483,_0x60aef1){exec(_0x15ec('0x1d'),function(_0x4df421,_0x5778ce,_0x419205){logger['info'](_0x5778ce);logger[_0x15ec('0x14')](_0x419205);if(_0x4df421){logger[_0x15ec('0x13')](_0x4df421);return _0x60aef1['status'](0x1f4)['json'](_0x4df421);}return _0x60aef1[_0x15ec('0xf')](0xc8)['json']({'output':_0x5778ce});});};exports[_0x15ec('0x1e')]=function(_0x41bffa,_0x5608ed){return pm2[_0x15ec('0x1e')](_0x15ec('0x1f'))[_0x15ec('0x20')](function(_0x470760){logger[_0x15ec('0x14')](_0x15ec('0x21'),_0x470760);return _0x5608ed['status'](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x15ec('0x22')](function(_0x281e55){logger['error'](_0x281e55);return _0x5608ed[_0x15ec('0xf')](0x1f4)[_0x15ec('0xe')](_0x281e55);});};exports[_0x15ec('0x23')]=function(_0x468a82,_0x2f14b2){var _0x434e1a=fs[_0x15ec('0x24')](path[_0x15ec('0x25')](config[_0x15ec('0x26')],'server',_0x15ec('0x23')));var _0x2cb27d=[];for(var _0x4d7098=0x0;_0x4d7098<_0x434e1a['length'];_0x4d7098++){var _0x38c6f5=_0x434e1a[_0x4d7098]['replace'](_0x15ec('0x27'),'');if(compareVersions(module[_0x15ec('0xd')][_0x15ec('0x2')],_0x38c6f5)===-0x1){_0x2cb27d[_0x15ec('0x28')](_0x38c6f5);}}if(_0x2cb27d[_0x15ec('0x29')]){var _0x361500=_0x2cb27d[_0x15ec('0x2a')](compareVersions);var _0x33d933=new Umzug({'storage':_0x15ec('0x2b'),'storageOptions':{'model':db[_0x15ec('0x2c')],'modelName':_0x15ec('0x2c'),'columnName':'version'},'migrations':{'params':[db['sequelize'][_0x15ec('0x2d')](),db[_0x15ec('0x2b')][_0x15ec('0x2e')],function(){throw new Error(_0x15ec('0x2f'));}],'path':path[_0x15ec('0x25')](config[_0x15ec('0x26')],_0x15ec('0x30'),_0x15ec('0x23')),'pattern':/\.js$/}});_0x33d933['up']({'migrations':_[_0x15ec('0x31')](_0x361500,function(_0x26a5ec){return _0x26a5ec+'.js';})})[_0x15ec('0x20')](function(){return _0x2f14b2['status'](0xc8)['json']({'output':_0x15ec('0x32')+module[_0x15ec('0xd')][_0x15ec('0x2')]+_0x15ec('0x33')+_[_0x15ec('0x34')](_0x361500),'migrations':_[_0x15ec('0x25')](_0x361500)});})[_0x15ec('0x22')](function(_0x4fcaf8){if(_0x4fcaf8 instanceof db[_0x15ec('0x2b')][_0x15ec('0x35')]){return _0x2f14b2[_0x15ec('0xf')](0xc8)[_0x15ec('0xe')]({'output':_0x15ec('0x36')});}else{return _0x2f14b2['status'](0x1f4)[_0x15ec('0xe')](_0x4fcaf8);}});}else{return _0x2f14b2[_0x15ec('0xf')](0xc8)['json']({'output':_0x15ec('0x36')});}}; \ No newline at end of file +var _0xdfff=['\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','exec','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','server','length','replace','push','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20'];(function(_0x26a4c9,_0x8a586c){var _0x3ab761=function(_0x9e1099){while(--_0x9e1099){_0x26a4c9['push'](_0x26a4c9['shift']());}};_0x3ab761(++_0x8a586c);}(_0xdfff,0xed));var _0xfdff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdfff[_0x3dd15e];return _0x231fd0;};'use strict';var Umzug=require(_0xfdff('0x0'));var path=require(_0xfdff('0x1'));var fs=require('fs');var _=require(_0xfdff('0x2'));var pkginfo=require(_0xfdff('0x3'))(module,_0xfdff('0x4'));var compareVersions=require(_0xfdff('0x5'));var exec=require('child_process')[_0xfdff('0x6')];var db=require('../../mysqldb')['db'];var config=require(_0xfdff('0x7'));var pm2=require(_0xfdff('0x8'));var logger=require(_0xfdff('0x9'))(_0xfdff('0xa'));var git=require(_0xfdff('0xb'))(config[_0xfdff('0xc')]);exports[_0xfdff('0xd')]=function(_0x3296d3,_0x230ab3){var _0x1a4b6c={'current':module[_0xfdff('0xe')][_0xfdff('0x4')],'phonebar':0x2};if(_0x3296d3[_0xfdff('0xf')]&&_0x3296d3[_0xfdff('0xf')][_0xfdff('0x10')]){return git[_0xfdff('0x11')]()[_0xfdff('0x12')](function(_0x1b4631,_0x1fe0d4){_0x1a4b6c[_0xfdff('0x10')]=(_0x1b4631?module[_0xfdff('0xe')][_0xfdff('0x4')]:_0x1fe0d4['latest'])||_0xfdff('0x13');return _0x230ab3[_0xfdff('0x14')](0xc8)[_0xfdff('0x15')](_0x1a4b6c);});}else{return _0x230ab3[_0xfdff('0x14')](0xc8)[_0xfdff('0x15')](_0x1a4b6c);}};exports[_0xfdff('0x11')]=function(_0x26dc42,_0x1221ec){return git['fetch']([_0xfdff('0x16'),_0xfdff('0x17')],function(_0xc1bf0b){if(_0xc1bf0b){logger['error'](_0xc1bf0b);return _0x1221ec['status'](0x1f4)[_0xfdff('0x15')](_0xc1bf0b);}logger[_0xfdff('0x18')](_0xfdff('0x19'));return _0x1221ec[_0xfdff('0x14')](0xc8)[_0xfdff('0x15')]({'output':_0xfdff('0x1a')});});};exports['reset']=function(_0x137fa4,_0xbf3fbc){return git[_0xfdff('0x1b')](['--hard','FETCH_HEAD'],function(_0x3da239){if(_0x3da239){logger[_0xfdff('0x1c')](_0x3da239);return _0xbf3fbc[_0xfdff('0x14')](0x1f4)['json'](_0x3da239);}logger['info'](_0xfdff('0x1d'));return _0xbf3fbc[_0xfdff('0x14')](0xc8)[_0xfdff('0x15')]({'output':_0xfdff('0x1e')});});};exports[_0xfdff('0x1f')]=function(_0x2950d8,_0x5e25e8){exec(_0xfdff('0x20'),function(_0x2a1fe7,_0x313722,_0x3a7252){logger[_0xfdff('0x18')](_0x313722);logger[_0xfdff('0x18')](_0x3a7252);if(_0x2a1fe7){logger['error'](_0x2a1fe7);return _0x5e25e8[_0xfdff('0x14')](0x1f4)['json'](_0x2a1fe7);}return _0x5e25e8[_0xfdff('0x14')](0xc8)[_0xfdff('0x15')]({'output':_0x313722});});};exports[_0xfdff('0x21')]=function(_0x2c0b36,_0x4b51c1){return pm2['restart'](_0xfdff('0x22'))[_0xfdff('0x23')](function(_0x287336){logger[_0xfdff('0x18')](_0xfdff('0x24'),_0x287336);return _0x4b51c1[_0xfdff('0x14')](0xc8)[_0xfdff('0x15')]({'output':_0xfdff('0x25')});})['catch'](function(_0x2c2186){logger[_0xfdff('0x1c')](_0x2c2186);return _0x4b51c1[_0xfdff('0x14')](0x1f4)[_0xfdff('0x15')](_0x2c2186);});};exports[_0xfdff('0x26')]=function(_0x188ac8,_0x5daa6a){var _0x5d61d9=fs[_0xfdff('0x27')](path[_0xfdff('0x28')](config[_0xfdff('0xc')],_0xfdff('0x29'),_0xfdff('0x26')));var _0x305905=[];for(var _0x358312=0x0;_0x358312<_0x5d61d9[_0xfdff('0x2a')];_0x358312++){var _0x4ad85c=_0x5d61d9[_0x358312][_0xfdff('0x2b')]('.js','');if(compareVersions(module[_0xfdff('0xe')][_0xfdff('0x4')],_0x4ad85c)===-0x1){_0x305905[_0xfdff('0x2c')](_0x4ad85c);}}if(_0x305905[_0xfdff('0x2a')]){var _0x5ac0e8=_0x305905[_0xfdff('0x2d')](compareVersions);var _0x5d0bf7=new Umzug({'storage':_0xfdff('0x2e'),'storageOptions':{'model':db['Migration'],'modelName':_0xfdff('0x2f'),'columnName':_0xfdff('0x4')},'migrations':{'params':[db[_0xfdff('0x2e')]['getQueryInterface'](),db[_0xfdff('0x2e')][_0xfdff('0x30')],function(){throw new Error(_0xfdff('0x31'));}],'path':path[_0xfdff('0x28')](config[_0xfdff('0xc')],_0xfdff('0x29'),_0xfdff('0x26')),'pattern':/\.js$/}});_0x5d0bf7['up']({'migrations':_[_0xfdff('0x32')](_0x5ac0e8,function(_0x174238){return _0x174238+_0xfdff('0x33');})})[_0xfdff('0x23')](function(){return _0x5daa6a['status'](0xc8)[_0xfdff('0x15')]({'output':_0xfdff('0x34')+module['exports'][_0xfdff('0x4')]+_0xfdff('0x35')+_[_0xfdff('0x36')](_0x5ac0e8),'migrations':_['join'](_0x5ac0e8)});})[_0xfdff('0x37')](function(_0x1f69db){if(_0x1f69db instanceof db['sequelize'][_0xfdff('0x38')]){return _0x5daa6a[_0xfdff('0x14')](0xc8)[_0xfdff('0x15')]({'output':_0xfdff('0x39')});}else{return _0x5daa6a[_0xfdff('0x14')](0x1f4)[_0xfdff('0x15')](_0x1f69db);}});}else{return _0x5daa6a[_0xfdff('0x14')](0xc8)[_0xfdff('0x15')]({'output':_0xfdff('0x39')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index a7e1926..112035f 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 _0x1bcb=['../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','exports','multer','util','path','connect-timeout','Router'];(function(_0x1c5c80,_0x3a987f){var _0x7e2142=function(_0x49f71f){while(--_0x49f71f){_0x1c5c80['push'](_0x1c5c80['shift']());}};_0x7e2142(++_0x3a987f);}(_0x1bcb,0xd8));var _0xb1bc=function(_0x5e2d63,_0x586e53){_0x5e2d63=_0x5e2d63-0x0;var _0x11c373=_0x1bcb[_0x5e2d63];return _0x11c373;};'use strict';var multer=require(_0xb1bc('0x0'));var util=require(_0xb1bc('0x1'));var path=require(_0xb1bc('0x2'));var timeout=require(_0xb1bc('0x3'));var express=require('express');var router=express[_0xb1bc('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb1bc('0x5'));var controller=require(_0xb1bc('0x6'));router[_0xb1bc('0x7')]('/',auth[_0xb1bc('0x8')](),controller[_0xb1bc('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xb1bc('0xa')]);router[_0xb1bc('0x7')](_0xb1bc('0xb'),auth[_0xb1bc('0x8')](),controller['show']);router[_0xb1bc('0xc')]('/',auth[_0xb1bc('0x8')](),controller[_0xb1bc('0xd')]);router[_0xb1bc('0xe')](_0xb1bc('0xb'),auth['isAuthenticated'](),controller[_0xb1bc('0xf')]);router['delete'](_0xb1bc('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xb1bc('0x10')]=router; \ No newline at end of file +var _0xe8d5=['put','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0x243217,_0x522951){var _0x478029=function(_0x18d053){while(--_0x18d053){_0x243217['push'](_0x243217['shift']());}};_0x478029(++_0x522951);}(_0xe8d5,0x98));var _0x5e8d=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xe8d5[_0x1a36a5];return _0x746243;};'use strict';var multer=require(_0x5e8d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5e8d('0x1'));var router=express[_0x5e8d('0x2')]();var fs_extra=require(_0x5e8d('0x3'));var auth=require(_0x5e8d('0x4'));var interaction=require(_0x5e8d('0x5'));var config=require(_0x5e8d('0x6'));var controller=require(_0x5e8d('0x7'));router[_0x5e8d('0x8')]('/',auth[_0x5e8d('0x9')](),controller[_0x5e8d('0xa')]);router[_0x5e8d('0x8')](_0x5e8d('0xb'),auth['isAuthenticated'](),controller[_0x5e8d('0xc')]);router[_0x5e8d('0x8')](_0x5e8d('0xd'),auth[_0x5e8d('0x9')](),controller[_0x5e8d('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5e8d('0xf')]);router[_0x5e8d('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5e8d('0x11')]);router[_0x5e8d('0x12')](_0x5e8d('0xd'),auth[_0x5e8d('0x9')](),controller[_0x5e8d('0x13')]);module[_0x5e8d('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index e85d05b..bf6bc37 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 _0x97db=['INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x59a0c0,_0x4567ed){var _0x618f48=function(_0x148e23){while(--_0x148e23){_0x59a0c0['push'](_0x59a0c0['shift']());}};_0x618f48(++_0x4567ed);}(_0x97db,0x1b4));var _0xb97d=function(_0x52e2bc,_0x3e41df){_0x52e2bc=_0x52e2bc-0x0;var _0x11967f=_0x97db[_0x52e2bc];return _0x11967f;};'use strict';var Sequelize=require(_0xb97d('0x0'));module[_0xb97d('0x1')]={'type':{'type':Sequelize[_0xb97d('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb97d('0x2')]},'queue':{'type':Sequelize[_0xb97d('0x2')]},'interface':{'type':Sequelize[_0xb97d('0x2')]},'membername':{'type':Sequelize[_0xb97d('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xb97d('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xb97d('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xb97d('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xb97d('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xb97d('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb97d('0x5')]},'reason':{'type':Sequelize[_0xb97d('0x2')]},'lastevent':{'type':Sequelize[_0xb97d('0x2')]},'channel':{'type':Sequelize[_0xb97d('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xb97d('0x2')]},'connectedlinenum':{'type':Sequelize[_0xb97d('0x2')]},'connectedlinename':{'type':Sequelize[_0xb97d('0x2')]},'language':{'type':Sequelize[_0xb97d('0x2')]},'accountcode':{'type':Sequelize[_0xb97d('0x2')]},'context':{'type':Sequelize[_0xb97d('0x2')]},'exten':{'type':Sequelize[_0xb97d('0x2')]},'priority':{'type':Sequelize[_0xb97d('0x2')]},'destchannel':{'type':Sequelize[_0xb97d('0x2')]},'destchannelstate':{'type':Sequelize[_0xb97d('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xb97d('0x2')]},'destcalleridnum':{'type':Sequelize[_0xb97d('0x2')]},'destcalleridname':{'type':Sequelize[_0xb97d('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xb97d('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb97d('0x2')]},'destlanguage':{'type':Sequelize[_0xb97d('0x2')]},'destaccountcode':{'type':Sequelize[_0xb97d('0x2')]},'destcontext':{'type':Sequelize[_0xb97d('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb97d('0x2')]},'destuniqueid':{'type':Sequelize[_0xb97d('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xb97d('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xb97d('0x2')]},'transfer':{'type':Sequelize[_0xb97d('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xb97d('0x6')},'transferexten':{'type':Sequelize[_0xb97d('0x2')]},'transferuniqueid':{'type':Sequelize[_0xb97d('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xea5b=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xea5b,0x152));var _0xbea5=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xea5b[_0x4792c8];return _0x35edb1;};'use strict';var Sequelize=require(_0xbea5('0x0'));module[_0xbea5('0x1')]={'type':{'type':Sequelize[_0xbea5('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbea5('0x2')]},'queue':{'type':Sequelize[_0xbea5('0x2')]},'interface':{'type':Sequelize[_0xbea5('0x2')]},'membername':{'type':Sequelize[_0xbea5('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xbea5('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xbea5('0x3')]},'agentdumpAt':{'type':Sequelize[_0xbea5('0x3')]},'holdtime':{'type':Sequelize[_0xbea5('0x4')]},'agentcomplete':{'type':Sequelize[_0xbea5('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xbea5('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xbea5('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xbea5('0x4')]},'agentacw':{'type':Sequelize[_0xbea5('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xbea5('0x4')]},'reason':{'type':Sequelize[_0xbea5('0x2')]},'lastevent':{'type':Sequelize[_0xbea5('0x2')]},'channel':{'type':Sequelize[_0xbea5('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xbea5('0x2')]},'connectedlinename':{'type':Sequelize[_0xbea5('0x2')]},'language':{'type':Sequelize[_0xbea5('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xbea5('0x2')]},'exten':{'type':Sequelize[_0xbea5('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xbea5('0x2')]},'destchannelstate':{'type':Sequelize[_0xbea5('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xbea5('0x2')]},'destcalleridnum':{'type':Sequelize[_0xbea5('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xbea5('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xbea5('0x2')]},'destexten':{'type':Sequelize[_0xbea5('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xbea5('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xbea5('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xbea5('0x2')]},'transfer':{'type':Sequelize[_0xbea5('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xbea5('0x2')],'comment':_0xbea5('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xbea5('0x2')]},'agententerreason':{'type':Sequelize[_0xbea5('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 8363c3a..ee07111 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.controller.js +++ b/server/api/voiceAgentReport/voiceAgentReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 c149cfe..8c515f8 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 _0xc18a=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xc18a,0x1cf));var _0xac18=function(_0x5bc0cd,_0x5f05dc){_0x5bc0cd=_0x5bc0cd-0x0;var _0x4abf0b=_0xc18a[_0x5bc0cd];return _0x4abf0b;};'use strict';var _=require(_0xac18('0x0'));var util=require(_0xac18('0x1'));var logger=require(_0xac18('0x2'))(_0xac18('0x3'));var moment=require('moment');var BPromise=require(_0xac18('0x4'));var rp=require(_0xac18('0x5'));var fs=require('fs');var path=require(_0xac18('0x6'));var rimraf=require(_0xac18('0x7'));var config=require(_0xac18('0x8'));var attributes=require(_0xac18('0x9'));module[_0xac18('0xa')]=function(_0x395493,_0x49136f){return _0x395493[_0xac18('0xb')](_0xac18('0xc'),attributes,{'tableName':_0xac18('0xd'),'paranoid':![],'indexes':[{'fields':[_0xac18('0xe'),_0xac18('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xae30=['bluebird','request-promise','path','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','moment'];(function(_0x5825cf,_0x1fdc61){var _0x2bc6f6=function(_0x42dc41){while(--_0x42dc41){_0x5825cf['push'](_0x5825cf['shift']());}};_0x2bc6f6(++_0x1fdc61);}(_0xae30,0x10a));var _0x0ae3=function(_0x50f288,_0xfecd76){_0x50f288=_0x50f288-0x0;var _0x2a0755=_0xae30[_0x50f288];return _0x2a0755;};'use strict';var _=require(_0x0ae3('0x0'));var util=require(_0x0ae3('0x1'));var logger=require(_0x0ae3('0x2'))('api');var moment=require(_0x0ae3('0x3'));var BPromise=require(_0x0ae3('0x4'));var rp=require(_0x0ae3('0x5'));var fs=require('fs');var path=require(_0x0ae3('0x6'));var rimraf=require('rimraf');var config=require(_0x0ae3('0x7'));var attributes=require(_0x0ae3('0x8'));module[_0x0ae3('0x9')]=function(_0x7ce33e,_0x2b8c53){return _0x7ce33e[_0x0ae3('0xa')](_0x0ae3('0xb'),attributes,{'tableName':_0x0ae3('0xc'),'paranoid':![],'indexes':[{'fields':[_0x0ae3('0xd'),_0x0ae3('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 61eb7cb..7a13469 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 _0x3aff=['../../config/utils','../../config/logger','rpc','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','debug','catch','where','attributes','limit','UpdateVoiceAgentReport','stringify','lodash','randomstring'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3aff,0x16a));var _0xf3af=function(_0x6cd27c,_0x2c506e){_0x6cd27c=_0x6cd27c-0x0;var _0x13b5f7=_0x3aff[_0x6cd27c];return _0x13b5f7;};'use strict';var _=require(_0xf3af('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf3af('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf3af('0x2'));var logger=require(_0xf3af('0x3'))(_0xf3af('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf3af('0x5')][_0xf3af('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xa7671a,_0x2a8758,_0x469610){return new BPromise(function(_0x302029,_0x5d002){return client[_0xf3af('0x7')](_0xa7671a,_0x469610)[_0xf3af('0x8')](function(_0x4fac70){logger[_0xf3af('0x9')](_0xf3af('0xa'),_0x2a8758,_0xf3af('0xb'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x2a8758,_0xf3af('0xb'),JSON['stringify'](_0x4fac70));if(_0x4fac70[_0xf3af('0xc')]){if(_0x4fac70[_0xf3af('0xc')][_0xf3af('0xd')]===0x1f4){logger[_0xf3af('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x2a8758,_0x4fac70[_0xf3af('0xc')][_0xf3af('0xe')]);return _0x5d002(_0x4fac70[_0xf3af('0xc')][_0xf3af('0xe')]);}logger[_0xf3af('0xc')](_0xf3af('0xa'),_0x2a8758,_0x4fac70[_0xf3af('0xc')]['message']);return _0x302029(_0x4fac70[_0xf3af('0xc')]['message']);}else{logger[_0xf3af('0x9')](_0xf3af('0xa'),_0x2a8758,_0xf3af('0xb'));_0x302029(_0x4fac70[_0xf3af('0xf')]['message']);}})['catch'](function(_0x4e0e26){logger[_0xf3af('0xc')](_0xf3af('0xa'),_0x2a8758,_0x4e0e26);_0x5d002(_0x4e0e26);});});}exports[_0xf3af('0x10')]=function(_0x450c1b){var _0x454ace=this;return new Promise(function(_0x1b4d6f,_0x15b887){return db[_0xf3af('0x11')]['create'](_0x450c1b[_0xf3af('0x12')],{'raw':_0x450c1b[_0xf3af('0x13')]?_0x450c1b['options'][_0xf3af('0x14')]===undefined?!![]:![]:!![]})[_0xf3af('0x8')](function(_0x3505ab){logger[_0xf3af('0x9')](_0xf3af('0x10'),_0x450c1b);logger[_0xf3af('0x15')](_0xf3af('0x10'),_0x450c1b,JSON['stringify'](_0x3505ab));_0x1b4d6f(_0x3505ab);})[_0xf3af('0x16')](function(_0x2b82ff){logger[_0xf3af('0xc')](_0xf3af('0x10'),_0x2b82ff[_0xf3af('0xe')],_0x450c1b);_0x15b887(_0x454ace[_0xf3af('0xc')](0x1f4,_0x2b82ff['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x4fab8e){var _0x3ac80f=this;return new Promise(function(_0x1ece08,_0x261c29){return db[_0xf3af('0x11')]['update'](_0x4fab8e[_0xf3af('0x12')],{'raw':_0x4fab8e['options']?_0x4fab8e[_0xf3af('0x13')][_0xf3af('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fab8e[_0xf3af('0x13')]?_0x4fab8e[_0xf3af('0x13')][_0xf3af('0x17')]||null:null,'attributes':_0x4fab8e[_0xf3af('0x13')]?_0x4fab8e[_0xf3af('0x13')][_0xf3af('0x18')]||null:null,'limit':_0x4fab8e['options']?_0x4fab8e[_0xf3af('0x13')][_0xf3af('0x19')]||null:null})['then'](function(_0x218692){logger[_0xf3af('0x9')](_0xf3af('0x1a'),_0x4fab8e);logger['debug'](_0xf3af('0x1a'),_0x4fab8e,JSON[_0xf3af('0x1b')](_0x218692));_0x1ece08(_0x218692);})[_0xf3af('0x16')](function(_0x6b452d){logger[_0xf3af('0xc')](_0xf3af('0x1a'),_0x6b452d[_0xf3af('0xe')],_0x4fab8e);_0x261c29(_0x3ac80f[_0xf3af('0xc')](0x1f4,_0x6b452d[_0xf3af('0xe')]));});});}; \ No newline at end of file +var _0xff8f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','VoiceAgentReport','create','body','options','raw','then','CreateVoiceAgentReport','update','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','randomstring'];(function(_0x4f386e,_0x56ffdd){var _0x4694e2=function(_0x3d16e4){while(--_0x3d16e4){_0x4f386e['push'](_0x4f386e['shift']());}};_0x4694e2(++_0x56ffdd);}(_0xff8f,0x137));var _0xfff8=function(_0x7a88b4,_0x23feb0){_0x7a88b4=_0x7a88b4-0x0;var _0x1c198a=_0xff8f[_0x7a88b4];return _0x1c198a;};'use strict';var _=require(_0xfff8('0x0'));var util=require(_0xfff8('0x1'));var moment=require(_0xfff8('0x2'));var BPromise=require('bluebird');var rs=require(_0xfff8('0x3'));var fs=require('fs');var Redis=require(_0xfff8('0x4'));var db=require(_0xfff8('0x5'))['db'];var utils=require(_0xfff8('0x6'));var logger=require(_0xfff8('0x7'))(_0xfff8('0x8'));var config=require(_0xfff8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfff8('0xa')][_0xfff8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2db1a5,_0x14486a,_0x41f805){return new BPromise(function(_0x3f33bf,_0x714dd0){return client[_0xfff8('0xc')](_0x2db1a5,_0x41f805)['then'](function(_0x9fa8eb){logger[_0xfff8('0xd')](_0xfff8('0xe'),_0x14486a,_0xfff8('0xf'));logger[_0xfff8('0x10')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x14486a,_0xfff8('0xf'),JSON[_0xfff8('0x11')](_0x9fa8eb));if(_0x9fa8eb[_0xfff8('0x12')]){if(_0x9fa8eb['error'][_0xfff8('0x13')]===0x1f4){logger[_0xfff8('0x12')](_0xfff8('0xe'),_0x14486a,_0x9fa8eb[_0xfff8('0x12')][_0xfff8('0x14')]);return _0x714dd0(_0x9fa8eb[_0xfff8('0x12')][_0xfff8('0x14')]);}logger[_0xfff8('0x12')](_0xfff8('0xe'),_0x14486a,_0x9fa8eb[_0xfff8('0x12')]['message']);return _0x3f33bf(_0x9fa8eb[_0xfff8('0x12')][_0xfff8('0x14')]);}else{logger[_0xfff8('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x14486a,_0xfff8('0xf'));_0x3f33bf(_0x9fa8eb[_0xfff8('0x15')][_0xfff8('0x14')]);}})[_0xfff8('0x16')](function(_0x2f3819){logger[_0xfff8('0x12')](_0xfff8('0xe'),_0x14486a,_0x2f3819);_0x714dd0(_0x2f3819);});});}exports['CreateVoiceAgentReport']=function(_0x3e9ff0){var _0x52d9ec=this;return new Promise(function(_0xaa883,_0x29f4d2){return db[_0xfff8('0x17')][_0xfff8('0x18')](_0x3e9ff0[_0xfff8('0x19')],{'raw':_0x3e9ff0[_0xfff8('0x1a')]?_0x3e9ff0['options'][_0xfff8('0x1b')]===undefined?!![]:![]:!![]})[_0xfff8('0x1c')](function(_0x4c5024){logger[_0xfff8('0xd')](_0xfff8('0x1d'),_0x3e9ff0);logger['debug'](_0xfff8('0x1d'),_0x3e9ff0,JSON[_0xfff8('0x11')](_0x4c5024));_0xaa883(_0x4c5024);})[_0xfff8('0x16')](function(_0x11e4d5){logger[_0xfff8('0x12')](_0xfff8('0x1d'),_0x11e4d5['message'],_0x3e9ff0);_0x29f4d2(_0x52d9ec[_0xfff8('0x12')](0x1f4,_0x11e4d5[_0xfff8('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x4b6970){var _0x3630f0=this;return new Promise(function(_0x1cbc91,_0x42ad2f){return db[_0xfff8('0x17')][_0xfff8('0x1e')](_0x4b6970[_0xfff8('0x19')],{'raw':_0x4b6970[_0xfff8('0x1a')]?_0x4b6970[_0xfff8('0x1a')][_0xfff8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b6970[_0xfff8('0x1a')]?_0x4b6970[_0xfff8('0x1a')][_0xfff8('0x1f')]||null:null,'attributes':_0x4b6970[_0xfff8('0x1a')]?_0x4b6970[_0xfff8('0x1a')][_0xfff8('0x20')]||null:null,'limit':_0x4b6970[_0xfff8('0x1a')]?_0x4b6970[_0xfff8('0x1a')][_0xfff8('0x21')]||null:null})['then'](function(_0x52609f){logger[_0xfff8('0xd')](_0xfff8('0x22'),_0x4b6970);logger[_0xfff8('0x10')](_0xfff8('0x22'),_0x4b6970,JSON[_0xfff8('0x11')](_0x52609f));_0x1cbc91(_0x52609f);})['catch'](function(_0x176dd6){logger[_0xfff8('0x12')]('UpdateVoiceAgentReport',_0x176dd6['message'],_0x4b6970);_0x42ad2f(_0x3630f0[_0xfff8('0x12')](0x1f4,_0x176dd6[_0xfff8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 66699fd..68aac4c 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 _0xbd50=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','create','delete','exports','multer','util'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xbd50,0x196));var _0x0bd5=function(_0x1ee9a1,_0x5f1434){_0x1ee9a1=_0x1ee9a1-0x0;var _0x21270f=_0xbd50[_0x1ee9a1];return _0x21270f;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var fs_extra=require(_0x0bd5('0x5'));var auth=require(_0x0bd5('0x6'));var interaction=require(_0x0bd5('0x7'));var config=require('../../config/environment');var controller=require('./voiceCallReport.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller['describe']);router['get'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router['post']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xe')]);router['put'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['update']);router[_0x0bd5('0xf')](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['destroy']);module[_0x0bd5('0x10')]=router; \ No newline at end of file +var _0x29d4=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','destroy','exports','multer','path','connect-timeout'];(function(_0x3a1dca,_0x3cabb8){var _0x462b2a=function(_0x4f3da3){while(--_0x4f3da3){_0x3a1dca['push'](_0x3a1dca['shift']());}};_0x462b2a(++_0x3cabb8);}(_0x29d4,0x1a1));var _0x429d=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x29d4[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0x429d('0x0'));var util=require('util');var path=require(_0x429d('0x1'));var timeout=require(_0x429d('0x2'));var express=require(_0x429d('0x3'));var router=express[_0x429d('0x4')]();var fs_extra=require(_0x429d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x429d('0x6'));var config=require(_0x429d('0x7'));var controller=require(_0x429d('0x8'));router[_0x429d('0x9')]('/',auth[_0x429d('0xa')](),controller[_0x429d('0xb')]);router[_0x429d('0x9')](_0x429d('0xc'),auth['isAuthenticated'](),controller[_0x429d('0xd')]);router['get'](_0x429d('0xe'),auth[_0x429d('0xa')](),controller[_0x429d('0xf')]);router['post']('/',auth[_0x429d('0xa')](),controller[_0x429d('0x10')]);router['put'](_0x429d('0xe'),auth[_0x429d('0xa')](),controller[_0x429d('0x11')]);router['delete'](_0x429d('0xe'),auth[_0x429d('0xa')](),controller[_0x429d('0x12')]);module[_0x429d('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index d1ff941..43979eb 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 _0xe0b3=['outbound','inbound-fax','outbound-fax','dialer','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal'];(function(_0x2ef789,_0x26a493){var _0xf29e80=function(_0x392fbe){while(--_0x392fbe){_0x2ef789['push'](_0x2ef789['shift']());}};_0xf29e80(++_0x26a493);}(_0xe0b3,0x1e6));var _0x3e0b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe0b3[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x3e0b('0x0'));module[_0x3e0b('0x1')]={'uniqueid':{'type':Sequelize[_0x3e0b('0x2')]},'type':{'type':Sequelize[_0x3e0b('0x3')](_0x3e0b('0x4'),_0x3e0b('0x5'),_0x3e0b('0x6'),_0x3e0b('0x7'),_0x3e0b('0x8'),_0x3e0b('0x9'))},'tag':{'type':Sequelize[_0x3e0b('0x2')]},'accountcode':{'type':Sequelize[_0x3e0b('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x3e0b('0x2')]},'destinationcontext':{'type':Sequelize[_0x3e0b('0x2')]},'callerid':{'type':Sequelize[_0x3e0b('0x2')]},'channel':{'type':Sequelize[_0x3e0b('0x2')]},'destinationchannel':{'type':Sequelize[_0x3e0b('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x3e0b('0xa')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x3e0b('0xb')]},'mohtime':{'type':Sequelize[_0x3e0b('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x3e0b('0x2')]},'userfield':{'type':Sequelize[_0x3e0b('0x2')]},'userDisposition':{'type':Sequelize[_0x3e0b('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x3e0b('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x3e0b('0x2')]},'note':{'type':Sequelize[_0x3e0b('0x2')]},'prefix':{'type':Sequelize[_0x3e0b('0x2')]},'routeid':{'type':Sequelize[_0x3e0b('0xb')]},'sipcallid':{'type':Sequelize[_0x3e0b('0x2')]}}; \ No newline at end of file +var _0xdfa0=['STRING','inbound','internal','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports'];(function(_0x3b202d,_0x4fc802){var _0x19ea1d=function(_0x166ad9){while(--_0x166ad9){_0x3b202d['push'](_0x3b202d['shift']());}};_0x19ea1d(++_0x4fc802);}(_0xdfa0,0xc4));var _0x0dfa=function(_0x23653d,_0x10f8aa){_0x23653d=_0x23653d-0x0;var _0x34780a=_0xdfa0[_0x23653d];return _0x34780a;};'use strict';var Sequelize=require(_0x0dfa('0x0'));module[_0x0dfa('0x1')]={'uniqueid':{'type':Sequelize[_0x0dfa('0x2')]},'type':{'type':Sequelize['ENUM'](_0x0dfa('0x3'),_0x0dfa('0x4'),'outbound',_0x0dfa('0x5'),_0x0dfa('0x6'),_0x0dfa('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0dfa('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x0dfa('0x2')]},'callerid':{'type':Sequelize[_0x0dfa('0x2')]},'channel':{'type':Sequelize[_0x0dfa('0x2')]},'destinationchannel':{'type':Sequelize[_0x0dfa('0x2')]},'lastapplication':{'type':Sequelize[_0x0dfa('0x2')]},'lastdata':{'type':Sequelize[_0x0dfa('0x8')]},'starttime':{'type':Sequelize[_0x0dfa('0x9')]},'systemanswertime':{'type':Sequelize[_0x0dfa('0x9')]},'answertime':{'type':Sequelize[_0x0dfa('0x9')]},'endtime':{'type':Sequelize[_0x0dfa('0x9')]},'duration':{'type':Sequelize[_0x0dfa('0xa')]},'billableseconds':{'type':Sequelize[_0x0dfa('0xa')]},'mohtime':{'type':Sequelize[_0x0dfa('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0dfa('0x2')]},'amaflags':{'type':Sequelize[_0x0dfa('0x2')]},'userfield':{'type':Sequelize[_0x0dfa('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x0dfa('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x0dfa('0x2')]},'routeid':{'type':Sequelize[_0x0dfa('0xa')]},'sipcallid':{'type':Sequelize[_0x0dfa('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index cce02a7..9b4dd11 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 _0xb10b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','VoiceCallReport','includeAll','include','alias','User','rows','show','find','create','body','catch','params','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x4ae871,_0x1af07b){var _0x5131a6=function(_0x4dde6c){while(--_0x4dde6c){_0x4ae871['push'](_0x4ae871['shift']());}};_0x5131a6(++_0x1af07b);}(_0xb10b,0x12a));var _0xbb10=function(_0x1da7a7,_0x360d47){_0x1da7a7=_0x1da7a7-0x0;var _0x454ba0=_0xb10b[_0x1da7a7];return _0x454ba0;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['VoiceCallReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'attributes':['id',_0xbb10('0x28'),'fullname',_0xbb10('0x43')],'model':db[_0xbb10('0x44')],'as':_0xbb10('0x44')}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x331751){_0x2e0249[_0xbb10('0x45')]=_0x331751;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x46')]=function(_0x202c60,_0x54ac18){var _0x5d9a4f={'raw':!![],'where':{'id':_0x202c60['params']['id']}},_0x38d78f={};_0x38d78f[_0xbb10('0x2f')]=_[_0xbb10('0x30')](db['VoiceCallReport'][_0xbb10('0x2c')]);_0x38d78f[_0xbb10('0x31')]=_[_0xbb10('0x30')](_0x202c60['query']);_0x38d78f[_0xbb10('0x3a')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],_0x38d78f[_0xbb10('0x31')]);_0x5d9a4f[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x202c60[_0xbb10('0x31')][_0xbb10('0x34')]));_0x5d9a4f[_0xbb10('0x33')]=_0x5d9a4f[_0xbb10('0x33')]['length']?_0x5d9a4f[_0xbb10('0x33')]:_0x38d78f[_0xbb10('0x2f')];if(_0x202c60['query'][_0xbb10('0x41')]){_0x5d9a4f[_0xbb10('0x42')]=[{'all':!![]}];}_0x5d9a4f=_[_0xbb10('0x3e')]({},_0x5d9a4f,_0x202c60[_0xbb10('0x3f')]);return db[_0xbb10('0x40')][_0xbb10('0x47')](_0x5d9a4f)[_0xbb10('0x23')](handleEntityNotFound(_0x54ac18,null))['then'](respondWithResult(_0x54ac18,null))['catch'](handleError(_0x54ac18,null));};exports[_0xbb10('0x48')]=function(_0x76a208,_0x2b12bd){return db['VoiceCallReport']['create'](_0x76a208[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x2b12bd,0xc9))[_0xbb10('0x4a')](handleError(_0x2b12bd,null));};exports[_0xbb10('0x24')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x40')][_0xbb10('0x47')]({'where':{'id':_0x10159b[_0xbb10('0x4b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x22b315,null))['then'](removeEntity(_0x22b315,null))['catch'](handleError(_0x22b315,null));};exports[_0xbb10('0x4c')]=function(_0x467dba,_0x36ab7d){return db[_0xbb10('0x40')][_0xbb10('0x4c')]()[_0xbb10('0x23')](respondWithResult(_0x36ab7d,null))[_0xbb10('0x4a')](handleError(_0x36ab7d,null));};exports[_0xbb10('0x22')]=function(_0x1c0d8f,_0x1214f7){if(_0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')]){delete _0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')];}return db[_0xbb10('0x40')]['find']({'where':{'uniqueid':_0x1c0d8f[_0xbb10('0x4b')]['id'],'UserId':{'$or':[null,_0x1c0d8f['user']['id']]}}})[_0xbb10('0x23')](handleEntityNotFound(_0x1214f7,null))[_0xbb10('0x23')](saveUpdates(_0x1c0d8f[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x1214f7,null))[_0xbb10('0x4a')](handleError(_0x1214f7,null));}; \ No newline at end of file +var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x595bd1,_0xb1e7a){var _0xd0344f=function(_0x5eb2fd){while(--_0x5eb2fd){_0x595bd1['push'](_0x595bd1['shift']());}};_0xd0344f(++_0xb1e7a);}(_0xadb5,0xad));var _0x5adb=function(_0xcb83fd,_0x2824df){_0xcb83fd=_0xcb83fd-0x0;var _0x4eb919=_0xadb5[_0xcb83fd];return _0x4eb919;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 5bfdb5f..f26cd91 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 _0x6404=['exports','define','VoiceCallReport','report_call','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3960cf,_0x344cea){var _0x448dd9=function(_0x4e7b2d){while(--_0x4e7b2d){_0x3960cf['push'](_0x3960cf['shift']());}};_0x448dd9(++_0x344cea);}(_0x6404,0x87));var _0x4640=function(_0x2ecd22,_0x2016ad){_0x2ecd22=_0x2ecd22-0x0;var _0x375893=_0x6404[_0x2ecd22];return _0x375893;};'use strict';var _=require(_0x4640('0x0'));var util=require('util');var logger=require(_0x4640('0x1'))(_0x4640('0x2'));var moment=require(_0x4640('0x3'));var BPromise=require(_0x4640('0x4'));var rp=require(_0x4640('0x5'));var fs=require('fs');var path=require(_0x4640('0x6'));var rimraf=require('rimraf');var config=require(_0x4640('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0x4640('0x8')]=function(_0x557fb2,_0x58d22e){return _0x557fb2[_0x4640('0x9')](_0x4640('0xa'),attributes,{'tableName':_0x4640('0xb'),'paranoid':![],'indexes':[{'fields':[_0x4640('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd18b=['uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define','VoiceCallReport','report_call'];(function(_0x5eb5ab,_0x174406){var _0x229541=function(_0x3048e3){while(--_0x3048e3){_0x5eb5ab['push'](_0x5eb5ab['shift']());}};_0x229541(++_0x174406);}(_0xd18b,0xfd));var _0xbd18=function(_0x5b70f8,_0x4cdb16){_0x5b70f8=_0x5b70f8-0x0;var _0x441bce=_0xd18b[_0x5b70f8];return _0x441bce;};'use strict';var _=require('lodash');var util=require(_0xbd18('0x0'));var logger=require(_0xbd18('0x1'))(_0xbd18('0x2'));var moment=require(_0xbd18('0x3'));var BPromise=require(_0xbd18('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd18('0x5'));var rimraf=require(_0xbd18('0x6'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0xbd18('0x7')]=function(_0x374fad,_0x573f06){return _0x374fad[_0xbd18('0x8')](_0xbd18('0x9'),attributes,{'tableName':_0xbd18('0xa'),'paranoid':![],'indexes':[{'fields':[_0xbd18('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 21fd3b5..bba830d 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 _0x38f2=['jayson/promise','client','http','request','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','model','map','then','body','CreateVoiceCallReport','UpdateVoiceCallReport','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x2d3d1b,_0x64a003){var _0x2c3d4d=function(_0x2182b9){while(--_0x2182b9){_0x2d3d1b['push'](_0x2d3d1b['shift']());}};_0x2c3d4d(++_0x64a003);}(_0x38f2,0x146));var _0x238f=function(_0x12c803,_0x55937c){_0x12c803=_0x12c803-0x0;var _0x228a87=_0x38f2[_0x12c803];return _0x228a87;};'use strict';var _=require(_0x238f('0x0'));var util=require('util');var moment=require(_0x238f('0x1'));var BPromise=require(_0x238f('0x2'));var rs=require(_0x238f('0x3'));var fs=require('fs');var Redis=require(_0x238f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x238f('0x5'));var logger=require('../../config/logger')(_0x238f('0x6'));var config=require('../../config/environment');var jayson=require(_0x238f('0x7'));var client=jayson[_0x238f('0x8')][_0x238f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a3352,_0x6816a6,_0x50508b){return new BPromise(function(_0x50e986,_0x35cd63){return client[_0x238f('0xa')](_0x5a3352,_0x50508b)['then'](function(_0x3b8f10){logger['info'](_0x238f('0xb'),_0x6816a6,_0x238f('0xc'));logger[_0x238f('0xd')](_0x238f('0xe'),_0x6816a6,_0x238f('0xc'),JSON[_0x238f('0xf')](_0x3b8f10));if(_0x3b8f10[_0x238f('0x10')]){if(_0x3b8f10[_0x238f('0x10')][_0x238f('0x11')]===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x6816a6,_0x3b8f10[_0x238f('0x10')][_0x238f('0x12')]);return _0x35cd63(_0x3b8f10['error'][_0x238f('0x12')]);}logger[_0x238f('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x6816a6,_0x3b8f10[_0x238f('0x10')]['message']);return _0x50e986(_0x3b8f10['error'][_0x238f('0x12')]);}else{logger[_0x238f('0x13')](_0x238f('0xb'),_0x6816a6,'request\x20sent');_0x50e986(_0x3b8f10[_0x238f('0x14')][_0x238f('0x12')]);}})[_0x238f('0x15')](function(_0x48ff25){logger[_0x238f('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x6816a6,_0x48ff25);_0x35cd63(_0x48ff25);});});}exports[_0x238f('0x16')]=function(_0x462f87){var _0x114b9b=this;return new Promise(function(_0xa3b37b,_0x3ecaee){return db[_0x238f('0x17')][_0x238f('0x18')]({'raw':_0x462f87[_0x238f('0x19')]?_0x462f87['options'][_0x238f('0x1a')]===undefined?!![]:![]:!![],'where':_0x462f87['options']?_0x462f87['options'][_0x238f('0x1b')]||null:null,'attributes':_0x462f87['options']?_0x462f87['options'][_0x238f('0x1c')]||null:null,'limit':_0x462f87[_0x238f('0x19')]?_0x462f87[_0x238f('0x19')][_0x238f('0x1d')]||null:null,'include':_0x462f87[_0x238f('0x19')]?_0x462f87['options'][_0x238f('0x1e')]?_['map'](_0x462f87[_0x238f('0x19')][_0x238f('0x1e')],function(_0x27bbb3){return{'model':db[_0x27bbb3[_0x238f('0x1f')]],'as':_0x27bbb3['as'],'attributes':_0x27bbb3[_0x238f('0x1c')],'include':_0x27bbb3['include']?_[_0x238f('0x20')](_0x27bbb3[_0x238f('0x1e')],function(_0x4c6023){return{'model':db[_0x4c6023[_0x238f('0x1f')]],'as':_0x4c6023['as'],'attributes':_0x4c6023[_0x238f('0x1c')],'include':_0x4c6023[_0x238f('0x1e')]?_[_0x238f('0x20')](_0x4c6023['include'],function(_0x30cb0f){return{'model':db[_0x30cb0f[_0x238f('0x1f')]],'as':_0x30cb0f['as'],'attributes':_0x30cb0f[_0x238f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x238f('0x21')](function(_0x4addd7){logger[_0x238f('0x13')]('GetVoiceCallReport',_0x462f87);logger['debug']('GetVoiceCallReport',_0x462f87,JSON['stringify'](_0x4addd7));_0xa3b37b(_0x4addd7);})[_0x238f('0x15')](function(_0x24cb70){logger[_0x238f('0x10')](_0x238f('0x16'),_0x24cb70[_0x238f('0x12')],_0x462f87);_0x3ecaee(_0x114b9b[_0x238f('0x10')](0x1f4,_0x24cb70['message']));});});};exports['CreateVoiceCallReport']=function(_0x4edfbb){var _0x323b32=this;return new Promise(function(_0x1fa255,_0x392d08){return db[_0x238f('0x17')]['create'](_0x4edfbb[_0x238f('0x22')],{'raw':_0x4edfbb[_0x238f('0x19')]?_0x4edfbb['options'][_0x238f('0x1a')]===undefined?!![]:![]:!![]})[_0x238f('0x21')](function(_0x5231fa){logger[_0x238f('0x13')]('CreateVoiceCallReport',_0x4edfbb);logger[_0x238f('0xd')](_0x238f('0x23'),_0x4edfbb,JSON[_0x238f('0xf')](_0x5231fa));_0x1fa255(_0x5231fa);})[_0x238f('0x15')](function(_0x5587e0){logger[_0x238f('0x10')]('CreateVoiceCallReport',_0x5587e0[_0x238f('0x12')],_0x4edfbb);_0x392d08(_0x323b32[_0x238f('0x10')](0x1f4,_0x5587e0[_0x238f('0x12')]));});});};exports[_0x238f('0x24')]=function(_0x578993){var _0x1e1cbd=this;return new Promise(function(_0x4f9ec5,_0x383f8b){return db[_0x238f('0x17')]['update'](_0x578993[_0x238f('0x22')],{'raw':_0x578993[_0x238f('0x19')]?_0x578993[_0x238f('0x19')][_0x238f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x578993[_0x238f('0x19')]?_0x578993[_0x238f('0x19')][_0x238f('0x1b')]||null:null,'attributes':_0x578993['options']?_0x578993['options'][_0x238f('0x1c')]||null:null,'limit':_0x578993[_0x238f('0x19')]?_0x578993[_0x238f('0x19')][_0x238f('0x1d')]||null:null})[_0x238f('0x21')](function(_0x2dfc17){logger['info']('UpdateVoiceCallReport',_0x578993);logger['debug']('UpdateVoiceCallReport',_0x578993,JSON[_0x238f('0xf')](_0x2dfc17));_0x4f9ec5(_0x2dfc17);})[_0x238f('0x15')](function(_0x252db6){logger[_0x238f('0x10')](_0x238f('0x24'),_0x252db6[_0x238f('0x12')],_0x578993);_0x383f8b(_0x1e1cbd['error'](0x1f4,_0x252db6[_0x238f('0x12')]));});});}; \ No newline at end of file +var _0x91dd=['debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','map','model','include','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','request\x20sent'];(function(_0x144ee2,_0x28f729){var _0x10875e=function(_0x302557){while(--_0x302557){_0x144ee2['push'](_0x144ee2['shift']());}};_0x10875e(++_0x28f729);}(_0x91dd,0x13f));var _0xd91d=function(_0x3dc972,_0x4da972){_0x3dc972=_0x3dc972-0x0;var _0x2546e0=_0x91dd[_0x3dc972];return _0x2546e0;};'use strict';var _=require(_0xd91d('0x0'));var util=require(_0xd91d('0x1'));var moment=require(_0xd91d('0x2'));var BPromise=require('bluebird');var rs=require(_0xd91d('0x3'));var fs=require('fs');var Redis=require(_0xd91d('0x4'));var db=require(_0xd91d('0x5'))['db'];var utils=require(_0xd91d('0x6'));var logger=require(_0xd91d('0x7'))('rpc');var config=require(_0xd91d('0x8'));var jayson=require(_0xd91d('0x9'));var client=jayson['client'][_0xd91d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20870c,_0x5b043c,_0x3c97f2){return new BPromise(function(_0x18155b,_0x1c4155){return client['request'](_0x20870c,_0x3c97f2)[_0xd91d('0xb')](function(_0x527a92){logger[_0xd91d('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x5b043c,_0xd91d('0xd'));logger[_0xd91d('0xe')](_0xd91d('0xf'),_0x5b043c,'request\x20sent',JSON[_0xd91d('0x10')](_0x527a92));if(_0x527a92[_0xd91d('0x11')]){if(_0x527a92['error'][_0xd91d('0x12')]===0x1f4){logger[_0xd91d('0x11')](_0xd91d('0x13'),_0x5b043c,_0x527a92[_0xd91d('0x11')][_0xd91d('0x14')]);return _0x1c4155(_0x527a92[_0xd91d('0x11')][_0xd91d('0x14')]);}logger[_0xd91d('0x11')](_0xd91d('0x13'),_0x5b043c,_0x527a92['error']['message']);return _0x18155b(_0x527a92[_0xd91d('0x11')][_0xd91d('0x14')]);}else{logger[_0xd91d('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x5b043c,'request\x20sent');_0x18155b(_0x527a92[_0xd91d('0x15')][_0xd91d('0x14')]);}})[_0xd91d('0x16')](function(_0x324399){logger['error'](_0xd91d('0x13'),_0x5b043c,_0x324399);_0x1c4155(_0x324399);});});}exports[_0xd91d('0x17')]=function(_0x45a40e){var _0x36447=this;return new Promise(function(_0xc2eaea,_0x1a3c1f){return db[_0xd91d('0x18')]['findAll']({'raw':_0x45a40e[_0xd91d('0x19')]?_0x45a40e['options'][_0xd91d('0x1a')]===undefined?!![]:![]:!![],'where':_0x45a40e['options']?_0x45a40e['options'][_0xd91d('0x1b')]||null:null,'attributes':_0x45a40e['options']?_0x45a40e[_0xd91d('0x19')][_0xd91d('0x1c')]||null:null,'limit':_0x45a40e['options']?_0x45a40e[_0xd91d('0x19')][_0xd91d('0x1d')]||null:null,'include':_0x45a40e[_0xd91d('0x19')]?_0x45a40e['options']['include']?_[_0xd91d('0x1e')](_0x45a40e[_0xd91d('0x19')]['include'],function(_0x4825ee){return{'model':db[_0x4825ee[_0xd91d('0x1f')]],'as':_0x4825ee['as'],'attributes':_0x4825ee[_0xd91d('0x1c')],'include':_0x4825ee[_0xd91d('0x20')]?_[_0xd91d('0x1e')](_0x4825ee[_0xd91d('0x20')],function(_0x599c93){return{'model':db[_0x599c93[_0xd91d('0x1f')]],'as':_0x599c93['as'],'attributes':_0x599c93[_0xd91d('0x1c')],'include':_0x599c93[_0xd91d('0x20')]?_[_0xd91d('0x1e')](_0x599c93[_0xd91d('0x20')],function(_0xf2e336){return{'model':db[_0xf2e336[_0xd91d('0x1f')]],'as':_0xf2e336['as'],'attributes':_0xf2e336[_0xd91d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd91d('0xb')](function(_0x304e48){logger['info'](_0xd91d('0x17'),_0x45a40e);logger[_0xd91d('0xe')](_0xd91d('0x17'),_0x45a40e,JSON[_0xd91d('0x10')](_0x304e48));_0xc2eaea(_0x304e48);})[_0xd91d('0x16')](function(_0x2e73f7){logger[_0xd91d('0x11')](_0xd91d('0x17'),_0x2e73f7[_0xd91d('0x14')],_0x45a40e);_0x1a3c1f(_0x36447[_0xd91d('0x11')](0x1f4,_0x2e73f7['message']));});});};exports[_0xd91d('0x21')]=function(_0x495814){var _0x1e6ffd=this;return new Promise(function(_0x166d23,_0x30ef4c){return db[_0xd91d('0x18')][_0xd91d('0x22')](_0x495814[_0xd91d('0x23')],{'raw':_0x495814[_0xd91d('0x19')]?_0x495814[_0xd91d('0x19')][_0xd91d('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4ffc1d){logger[_0xd91d('0xc')]('CreateVoiceCallReport',_0x495814);logger[_0xd91d('0xe')](_0xd91d('0x21'),_0x495814,JSON[_0xd91d('0x10')](_0x4ffc1d));_0x166d23(_0x4ffc1d);})[_0xd91d('0x16')](function(_0x5b432c){logger['error']('CreateVoiceCallReport',_0x5b432c[_0xd91d('0x14')],_0x495814);_0x30ef4c(_0x1e6ffd[_0xd91d('0x11')](0x1f4,_0x5b432c['message']));});});};exports[_0xd91d('0x24')]=function(_0x147d05){var _0x4bb641=this;return new Promise(function(_0x461975,_0x587046){return db[_0xd91d('0x18')]['update'](_0x147d05['body'],{'raw':_0x147d05[_0xd91d('0x19')]?_0x147d05['options'][_0xd91d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x147d05[_0xd91d('0x19')]?_0x147d05[_0xd91d('0x19')][_0xd91d('0x1b')]||null:null,'attributes':_0x147d05[_0xd91d('0x19')]?_0x147d05['options'][_0xd91d('0x1c')]||null:null,'limit':_0x147d05[_0xd91d('0x19')]?_0x147d05[_0xd91d('0x19')][_0xd91d('0x1d')]||null:null})[_0xd91d('0xb')](function(_0x22744c){logger['info'](_0xd91d('0x24'),_0x147d05);logger['debug']('UpdateVoiceCallReport',_0x147d05,JSON[_0xd91d('0x10')](_0x22744c));_0x461975(_0x22744c);})[_0xd91d('0x16')](function(_0x4c775c){logger[_0xd91d('0x11')](_0xd91d('0x24'),_0x4c775c['message'],_0x147d05);_0x587046(_0x4bb641[_0xd91d('0x11')](0x1f4,_0x4c775c[_0xd91d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 0a97223..05df99e 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 _0xbe99=['../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','show','post','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x441af9,_0x5487de){var _0x4ae4ee=function(_0x3f7e5d){while(--_0x3f7e5d){_0x441af9['push'](_0x441af9['shift']());}};_0x4ae4ee(++_0x5487de);}(_0xbe99,0x1de));var _0x9be9=function(_0x3b4756,_0x3ee9b7){_0x3b4756=_0x3b4756-0x0;var _0x3ce1a5=_0xbe99[_0x3b4756];return _0x3ce1a5;};'use strict';var multer=require(_0x9be9('0x0'));var util=require(_0x9be9('0x1'));var path=require(_0x9be9('0x2'));var timeout=require(_0x9be9('0x3'));var express=require(_0x9be9('0x4'));var router=express[_0x9be9('0x5')]();var fs_extra=require(_0x9be9('0x6'));var auth=require(_0x9be9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9be9('0x8'));var controller=require(_0x9be9('0x9'));router[_0x9be9('0xa')]('/',auth[_0x9be9('0xb')](),controller['index']);router[_0x9be9('0xa')]('/:id',auth[_0x9be9('0xb')](),controller[_0x9be9('0xc')]);router[_0x9be9('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x9be9('0xe'),auth[_0x9be9('0xb')](),controller[_0x9be9('0xf')]);router['delete'](_0x9be9('0xe'),auth[_0x9be9('0xb')](),controller[_0x9be9('0x10')]);module[_0x9be9('0x11')]=router; \ No newline at end of file +var _0x862b=['delete','exports','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x44175b,_0x1edff8){var _0x5a5166=function(_0x19df59){while(--_0x19df59){_0x44175b['push'](_0x44175b['shift']());}};_0x5a5166(++_0x1edff8);}(_0x862b,0x102));var _0xb862=function(_0x5882a7,_0x36d3c2){_0x5882a7=_0x5882a7-0x0;var _0x4d964d=_0x862b[_0x5882a7];return _0x4d964d;};'use strict';var multer=require(_0xb862('0x0'));var util=require(_0xb862('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb862('0x2'));var router=express[_0xb862('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb862('0x4'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0xb862('0x5')]('/',auth[_0xb862('0x6')](),controller[_0xb862('0x7')]);router[_0xb862('0x5')](_0xb862('0x8'),auth['isAuthenticated'](),controller[_0xb862('0x9')]);router[_0xb862('0xa')]('/',auth[_0xb862('0x6')](),controller[_0xb862('0xb')]);router[_0xb862('0xc')]('/:id',auth[_0xb862('0x6')](),controller[_0xb862('0xd')]);router[_0xb862('0xe')](_0xb862('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xb862('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 eb34e26..1bbda70 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 _0x716f=['STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x2111d0,_0x490509){var _0x13e543=function(_0x48cc14){while(--_0x48cc14){_0x2111d0['push'](_0x2111d0['shift']());}};_0x13e543(++_0x490509);}(_0x716f,0x1de));var _0xf716=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0x716f[_0x1bc0ae];return _0x501104;};'use strict';var Sequelize=require(_0xf716('0x0'));module[_0xf716('0x1')]={'name':{'type':Sequelize[_0xf716('0x2')]},'prefix':{'type':Sequelize[_0xf716('0x2')],'unique':_0xf716('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xf716('0x2')],'set':function(_0x4131e8){this[_0xf716('0x4')](_0xf716('0x5'),_0x4131e8?_0x4131e8[_0xf716('0x6')](''):[]);},'get':function(){return this[_0xf716('0x7')]('options')?this[_0xf716('0x7')](_0xf716('0x5'))[_0xf716('0x8')](''):[];}},'auth':{'type':Sequelize[_0xf716('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0xf716('0x2')]},'record':{'type':Sequelize[_0xf716('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xf716('0x2')]},'description':{'type':Sequelize[_0xf716('0x2')]}}; \ No newline at end of file +var _0x6d9a=['setDataValue','join','getDataValue','options','split','BOOLEAN','sequelize','STRING','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6d9a,0x8d));var _0xa6d9=function(_0x5c1f9d,_0x19b4b8){_0x5c1f9d=_0x5c1f9d-0x0;var _0x1a55ad=_0x6d9a[_0x5c1f9d];return _0x1a55ad;};'use strict';var Sequelize=require(_0xa6d9('0x0'));module['exports']={'name':{'type':Sequelize[_0xa6d9('0x1')]},'prefix':{'type':Sequelize[_0xa6d9('0x1')],'unique':_0xa6d9('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xa6d9('0x1')],'set':function(_0xe9837a){this[_0xa6d9('0x3')]('options',_0xe9837a?_0xe9837a[_0xa6d9('0x4')](''):[]);},'get':function(){return this[_0xa6d9('0x5')](_0xa6d9('0x6'))?this[_0xa6d9('0x5')](_0xa6d9('0x6'))[_0xa6d9('0x7')](''):[];}},'auth':{'type':Sequelize[_0xa6d9('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xa6d9('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xa6d9('0x1')]},'description':{'type':Sequelize[_0xa6d9('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index b0e936c..1be766a 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 _0x2c6a=['include','rows','show','includeAll','catch','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','reject','update','destroy','then','UserProfileResource','error','stack','name','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','where','merge','filter','options'];(function(_0x538164,_0x242677){var _0x3b6de6=function(_0x31a10c){while(--_0x31a10c){_0x538164['push'](_0x538164['shift']());}};_0x3b6de6(++_0x242677);}(_0x2c6a,0xa7));var _0xa2c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c6a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa2c6('0x0'));var rimraf=require(_0xa2c6('0x1'));var zipdir=require(_0xa2c6('0x2'));var jsonpatch=require(_0xa2c6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa2c6('0x4'));var Mustache=require('mustache');var util=require(_0xa2c6('0x5'));var path=require(_0xa2c6('0x6'));var sox=require(_0xa2c6('0x7'));var csv=require(_0xa2c6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa2c6('0x9'));var squel=require(_0xa2c6('0xa'));var crypto=require(_0xa2c6('0xb'));var jsforce=require(_0xa2c6('0xc'));var deskjs=require(_0xa2c6('0xd'));var toCsv=require(_0xa2c6('0x8'));var querystring=require(_0xa2c6('0xe'));var Papa=require('papaparse');var Redis=require(_0xa2c6('0xf'));var authService=require(_0xa2c6('0x10'));var qs=require(_0xa2c6('0x11'));var as=require(_0xa2c6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2c6('0x13'))('api');var utils=require(_0xa2c6('0x14'));var config=require(_0xa2c6('0x15'));var licenseUtil=require(_0xa2c6('0x16'));var db=require(_0xa2c6('0x17'))['db'];function respondWithStatusCode(_0x4955be,_0x2897ee){_0x2897ee=_0x2897ee||0xcc;return function(_0x3234b6){if(_0x3234b6){return _0x4955be[_0xa2c6('0x18')](_0x2897ee);}return _0x4955be['status'](_0x2897ee)[_0xa2c6('0x19')]();};}function respondWithResult(_0x1dc749,_0x3ebb15){_0x3ebb15=_0x3ebb15||0xc8;return function(_0x1bc1dc){if(_0x1bc1dc){return _0x1dc749[_0xa2c6('0x1a')](_0x3ebb15)['json'](_0x1bc1dc);}};}function respondWithFilteredResult(_0x412229,_0x374404){return function(_0x43b97b){if(_0x43b97b){var _0x354dff=typeof _0x374404[_0xa2c6('0x1b')]===_0xa2c6('0x1c')&&typeof _0x374404['limit']===_0xa2c6('0x1c');var _0x4d49f8=_0x43b97b[_0xa2c6('0x1d')];var _0x114424=_0x354dff?0x0:_0x374404[_0xa2c6('0x1b')];var _0x2479bd=_0x354dff?_0x43b97b[_0xa2c6('0x1d')]:_0x374404[_0xa2c6('0x1b')]+_0x374404[_0xa2c6('0x1e')];var _0x2b3d6e;if(_0x2479bd>=_0x4d49f8){_0x2479bd=_0x4d49f8;_0x2b3d6e=0xc8;}else{_0x2b3d6e=0xce;}_0x412229['status'](_0x2b3d6e);return _0x412229[_0xa2c6('0x1f')](_0xa2c6('0x20'),_0x114424+'-'+_0x2479bd+'/'+_0x4d49f8)[_0xa2c6('0x21')](_0x43b97b);}return null;};}function patchUpdates(_0x21ec92){return function(_0x2a2fc9){try{jsonpatch['apply'](_0x2a2fc9,_0x21ec92,!![]);}catch(_0x35dd2a){return BPromise[_0xa2c6('0x22')](_0x35dd2a);}return _0x2a2fc9['save']();};}function saveUpdates(_0x20a86e,_0x58530d){return function(_0x8b2eea){if(_0x8b2eea){return _0x8b2eea[_0xa2c6('0x23')](_0x20a86e)['then'](function(_0x291057){return _0x291057;});}return null;};}function removeEntity(_0x5aabe2,_0x19a765){return function(_0x168de7){if(_0x168de7){return _0x168de7[_0xa2c6('0x24')]()[_0xa2c6('0x25')](function(){var _0x376967=_0x168de7['get']({'plain':!![]});var _0x2ed646='ChanSpies';return db[_0xa2c6('0x26')][_0xa2c6('0x24')]({'where':{'type':_0x2ed646,'resourceId':_0x376967['id']}})['then'](function(){return _0x168de7;});})[_0xa2c6('0x25')](function(){_0x5aabe2[_0xa2c6('0x1a')](0xcc)[_0xa2c6('0x19')]();});}};}function handleEntityNotFound(_0x32ccc9,_0x13e5a4){return function(_0x11a72c){if(!_0x11a72c){_0x32ccc9[_0xa2c6('0x18')](0x194);}return _0x11a72c;};}function handleError(_0x3892ca,_0x1f3104){_0x1f3104=_0x1f3104||0x1f4;return function(_0x57d67a){logger[_0xa2c6('0x27')](_0x57d67a[_0xa2c6('0x28')]);if(_0x57d67a[_0xa2c6('0x29')]){delete _0x57d67a[_0xa2c6('0x29')];}_0x3892ca['status'](_0x1f3104)['send'](_0x57d67a);};}exports['index']=function(_0x4f04e4,_0xa6df69){var _0x30c4e2={},_0x2d080e={},_0x2adf62={'count':0x0,'rows':[]};var _0x5263a2=_[_0xa2c6('0x2a')](db[_0xa2c6('0x2b')][_0xa2c6('0x2c')],function(_0x10e1d6){return{'name':_0x10e1d6[_0xa2c6('0x2d')],'type':_0x10e1d6[_0xa2c6('0x2e')][_0xa2c6('0x2f')]};});_0x2d080e[_0xa2c6('0x30')]=_[_0xa2c6('0x2a')](_0x5263a2,'name');_0x2d080e[_0xa2c6('0x31')]=_[_0xa2c6('0x32')](_0x4f04e4[_0xa2c6('0x31')]);_0x2d080e['filters']=_[_0xa2c6('0x33')](_0x2d080e[_0xa2c6('0x30')],_0x2d080e['query']);_0x30c4e2['attributes']=_[_0xa2c6('0x33')](_0x2d080e[_0xa2c6('0x30')],qs[_0xa2c6('0x34')](_0x4f04e4[_0xa2c6('0x31')]['fields']));_0x30c4e2[_0xa2c6('0x35')]=_0x30c4e2[_0xa2c6('0x35')][_0xa2c6('0x36')]?_0x30c4e2[_0xa2c6('0x35')]:_0x2d080e[_0xa2c6('0x30')];if(!_0x4f04e4[_0xa2c6('0x31')][_0xa2c6('0x37')]('nolimit')){_0x30c4e2[_0xa2c6('0x1e')]=qs[_0xa2c6('0x1e')](_0x4f04e4[_0xa2c6('0x31')][_0xa2c6('0x1e')]);_0x30c4e2[_0xa2c6('0x1b')]=qs[_0xa2c6('0x1b')](_0x4f04e4[_0xa2c6('0x31')]['offset']);}_0x30c4e2[_0xa2c6('0x38')]=qs[_0xa2c6('0x39')](_0x4f04e4['query'][_0xa2c6('0x39')]);_0x30c4e2['where']=qs[_0xa2c6('0x3a')](_[_0xa2c6('0x3b')](_0x4f04e4['query'],_0x2d080e[_0xa2c6('0x3a')]),_0x5263a2);if(_0x4f04e4[_0xa2c6('0x31')]['filter']){_0x30c4e2[_0xa2c6('0x3c')]=_[_0xa2c6('0x3d')](_0x30c4e2[_0xa2c6('0x3c')],{'$or':_['map'](_0x5263a2,function(_0x31fb25){if(_0x31fb25['type']!=='VIRTUAL'){var _0x12c984={};_0x12c984[_0x31fb25[_0xa2c6('0x29')]]={'$like':'%'+_0x4f04e4[_0xa2c6('0x31')][_0xa2c6('0x3e')]+'%'};return _0x12c984;}})});}_0x30c4e2=_[_0xa2c6('0x3d')]({},_0x30c4e2,_0x4f04e4[_0xa2c6('0x3f')]);var _0x47b22c={'where':_0x30c4e2['where']};return db[_0xa2c6('0x2b')][_0xa2c6('0x1d')](_0x47b22c)['then'](function(_0x2b0267){_0x2adf62['count']=_0x2b0267;if(_0x4f04e4['query']['includeAll']){_0x30c4e2[_0xa2c6('0x40')]=[{'all':!![]}];}return db[_0xa2c6('0x2b')]['findAll'](_0x30c4e2);})[_0xa2c6('0x25')](function(_0x25acce){_0x2adf62[_0xa2c6('0x41')]=_0x25acce;return _0x2adf62;})[_0xa2c6('0x25')](respondWithFilteredResult(_0xa6df69,_0x30c4e2))['catch'](handleError(_0xa6df69,null));};exports[_0xa2c6('0x42')]=function(_0x5164f5,_0x3c1b78){var _0x1294b5={'raw':![],'where':{'id':_0x5164f5['params']['id']}},_0x38a41a={};_0x38a41a['model']=_[_0xa2c6('0x32')](db[_0xa2c6('0x2b')][_0xa2c6('0x2c')]);_0x38a41a[_0xa2c6('0x31')]=_[_0xa2c6('0x32')](_0x5164f5[_0xa2c6('0x31')]);_0x38a41a[_0xa2c6('0x3a')]=_[_0xa2c6('0x33')](_0x38a41a[_0xa2c6('0x30')],_0x38a41a['query']);_0x1294b5['attributes']=_[_0xa2c6('0x33')](_0x38a41a['model'],qs[_0xa2c6('0x34')](_0x5164f5['query'][_0xa2c6('0x34')]));_0x1294b5[_0xa2c6('0x35')]=_0x1294b5[_0xa2c6('0x35')][_0xa2c6('0x36')]?_0x1294b5[_0xa2c6('0x35')]:_0x38a41a[_0xa2c6('0x30')];if(_0x5164f5['query'][_0xa2c6('0x43')]){_0x1294b5[_0xa2c6('0x40')]=[{'all':!![]}];}_0x1294b5=_['merge']({},_0x1294b5,_0x5164f5['options']);return db[_0xa2c6('0x2b')]['find'](_0x1294b5)[_0xa2c6('0x25')](handleEntityNotFound(_0x3c1b78,null))[_0xa2c6('0x25')](respondWithResult(_0x3c1b78,null))[_0xa2c6('0x44')](handleError(_0x3c1b78,null));};exports['create']=function(_0x24e819,_0x2d7341){return db[_0xa2c6('0x2b')][_0xa2c6('0x45')](_0x24e819[_0xa2c6('0x46')],{})['then'](function(_0x4fc150){var _0x1a0aa4=_0x24e819[_0xa2c6('0x47')]['get']({'plain':!![]});if(!_0x1a0aa4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a0aa4['role']===_0xa2c6('0x47')){var _0x106c29=_0x4fc150['get']({'plain':!![]});var _0x257e28='ChanSpies';return db[_0xa2c6('0x48')][_0xa2c6('0x49')]({'where':{'name':_0x257e28,'userProfileId':_0x1a0aa4[_0xa2c6('0x4a')]},'raw':!![]})[_0xa2c6('0x25')](function(_0x1355c6){if(_0x1355c6&&_0x1355c6[_0xa2c6('0x4b')]===0x0){return db[_0xa2c6('0x26')]['create']({'name':_0x106c29[_0xa2c6('0x29')],'resourceId':_0x106c29['id'],'type':_0x1355c6[_0xa2c6('0x29')],'sectionId':_0x1355c6['id']},{})[_0xa2c6('0x25')](function(){return _0x4fc150;});}else{return _0x4fc150;}})[_0xa2c6('0x44')](function(_0x540cc7){logger[_0xa2c6('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x540cc7);throw _0x540cc7;});}return _0x4fc150;})[_0xa2c6('0x25')](respondWithResult(_0x2d7341,0xc9))[_0xa2c6('0x44')](handleError(_0x2d7341,null));};exports[_0xa2c6('0x23')]=function(_0x37d9ef,_0x2b69d5){if(_0x37d9ef['body']['id']){delete _0x37d9ef['body']['id'];}return db[_0xa2c6('0x2b')][_0xa2c6('0x49')]({'where':{'id':_0x37d9ef[_0xa2c6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2b69d5,null))[_0xa2c6('0x25')](saveUpdates(_0x37d9ef[_0xa2c6('0x46')],null))[_0xa2c6('0x25')](respondWithResult(_0x2b69d5,null))[_0xa2c6('0x44')](handleError(_0x2b69d5,null));};exports[_0xa2c6('0x24')]=function(_0x14a07a,_0x5b659f){return db['VoiceChanSpy'][_0xa2c6('0x49')]({'where':{'id':_0x14a07a[_0xa2c6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5b659f,null))[_0xa2c6('0x25')](removeEntity(_0x5b659f,null))['catch'](handleError(_0x5b659f,null));}; \ No newline at end of file +var _0xda65=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','end','stack','name','send','index','map','VoiceChanSpy','fieldName','type','model','query','keys','filters','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','options','includeAll','include','findAll','rows','show','params','attributes','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xda65,0x1d0));var _0x5da6=function(_0x1af814,_0x40589f){_0x1af814=_0x1af814-0x0;var _0x56776a=_0xda65[_0x1af814];return _0x56776a;};'use strict';var emlformat=require(_0x5da6('0x0'));var rimraf=require(_0x5da6('0x1'));var zipdir=require(_0x5da6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5da6('0x3'));var moment=require(_0x5da6('0x4'));var BPromise=require(_0x5da6('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5da6('0x6'));var sox=require(_0x5da6('0x7'));var csv=require(_0x5da6('0x8'));var ejs=require(_0x5da6('0x9'));var fs=require('fs');var fs_extra=require(_0x5da6('0xa'));var _=require('lodash');var squel=require(_0x5da6('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5da6('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5da6('0xd'));var Papa=require(_0x5da6('0xe'));var Redis=require(_0x5da6('0xf'));var authService=require(_0x5da6('0x10'));var qs=require(_0x5da6('0x11'));var as=require(_0x5da6('0x12'));var hardwareService=require(_0x5da6('0x13'));var logger=require(_0x5da6('0x14'))('api');var utils=require(_0x5da6('0x15'));var config=require(_0x5da6('0x16'));var licenseUtil=require(_0x5da6('0x17'));var db=require(_0x5da6('0x18'))['db'];function respondWithStatusCode(_0x3500c6,_0x40ace1){_0x40ace1=_0x40ace1||0xcc;return function(_0x351340){if(_0x351340){return _0x3500c6[_0x5da6('0x19')](_0x40ace1);}return _0x3500c6[_0x5da6('0x1a')](_0x40ace1)['end']();};}function respondWithResult(_0x423665,_0x3e4dd6){_0x3e4dd6=_0x3e4dd6||0xc8;return function(_0xdb1066){if(_0xdb1066){return _0x423665[_0x5da6('0x1a')](_0x3e4dd6)[_0x5da6('0x1b')](_0xdb1066);}};}function respondWithFilteredResult(_0x47798b,_0x32a16a){return function(_0x1c28b7){if(_0x1c28b7){var _0x4f594e=typeof _0x32a16a[_0x5da6('0x1c')]==='undefined'&&typeof _0x32a16a['limit']===_0x5da6('0x1d');var _0x31b743=_0x1c28b7[_0x5da6('0x1e')];var _0x4c3b2d=_0x4f594e?0x0:_0x32a16a[_0x5da6('0x1c')];var _0x4b42e4=_0x4f594e?_0x1c28b7[_0x5da6('0x1e')]:_0x32a16a[_0x5da6('0x1c')]+_0x32a16a[_0x5da6('0x1f')];var _0x3c93e2;if(_0x4b42e4>=_0x31b743){_0x4b42e4=_0x31b743;_0x3c93e2=0xc8;}else{_0x3c93e2=0xce;}_0x47798b['status'](_0x3c93e2);return _0x47798b[_0x5da6('0x20')](_0x5da6('0x21'),_0x4c3b2d+'-'+_0x4b42e4+'/'+_0x31b743)[_0x5da6('0x1b')](_0x1c28b7);}return null;};}function patchUpdates(_0x24500d){return function(_0x747f9f){try{jsonpatch[_0x5da6('0x22')](_0x747f9f,_0x24500d,!![]);}catch(_0x163f8a){return BPromise[_0x5da6('0x23')](_0x163f8a);}return _0x747f9f['save']();};}function saveUpdates(_0x317cdb,_0x5ad81b){return function(_0x92171e){if(_0x92171e){return _0x92171e[_0x5da6('0x24')](_0x317cdb)[_0x5da6('0x25')](function(_0xdbaece){return _0xdbaece;});}return null;};}function removeEntity(_0x115098,_0x22b261){return function(_0x1d394e){if(_0x1d394e){return _0x1d394e[_0x5da6('0x26')]()['then'](function(){var _0x51a428=_0x1d394e[_0x5da6('0x27')]({'plain':!![]});var _0x256073='ChanSpies';return db['UserProfileResource'][_0x5da6('0x26')]({'where':{'type':_0x256073,'resourceId':_0x51a428['id']}})[_0x5da6('0x25')](function(){return _0x1d394e;});})[_0x5da6('0x25')](function(){_0x115098[_0x5da6('0x1a')](0xcc)[_0x5da6('0x28')]();});}};}function handleEntityNotFound(_0x495138,_0x471873){return function(_0x1bc214){if(!_0x1bc214){_0x495138[_0x5da6('0x19')](0x194);}return _0x1bc214;};}function handleError(_0x573b0c,_0x41dab8){_0x41dab8=_0x41dab8||0x1f4;return function(_0x2b3be1){logger['error'](_0x2b3be1[_0x5da6('0x29')]);if(_0x2b3be1[_0x5da6('0x2a')]){delete _0x2b3be1[_0x5da6('0x2a')];}_0x573b0c[_0x5da6('0x1a')](_0x41dab8)[_0x5da6('0x2b')](_0x2b3be1);};}exports[_0x5da6('0x2c')]=function(_0x26cb1a,_0x25e8ae){var _0x46541d={},_0x46ed01={},_0x24149d={'count':0x0,'rows':[]};var _0x19dc67=_[_0x5da6('0x2d')](db[_0x5da6('0x2e')]['rawAttributes'],function(_0x42af0d){return{'name':_0x42af0d[_0x5da6('0x2f')],'type':_0x42af0d[_0x5da6('0x30')]['key']};});_0x46ed01[_0x5da6('0x31')]=_[_0x5da6('0x2d')](_0x19dc67,_0x5da6('0x2a'));_0x46ed01[_0x5da6('0x32')]=_[_0x5da6('0x33')](_0x26cb1a[_0x5da6('0x32')]);_0x46ed01[_0x5da6('0x34')]=_[_0x5da6('0x35')](_0x46ed01[_0x5da6('0x31')],_0x46ed01['query']);_0x46541d['attributes']=_[_0x5da6('0x35')](_0x46ed01['model'],qs['fields'](_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x36')]));_0x46541d['attributes']=_0x46541d['attributes'][_0x5da6('0x37')]?_0x46541d['attributes']:_0x46ed01['model'];if(!_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x38')]('nolimit')){_0x46541d[_0x5da6('0x1f')]=qs[_0x5da6('0x1f')](_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x1f')]);_0x46541d['offset']=qs[_0x5da6('0x1c')](_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x1c')]);}_0x46541d['order']=qs[_0x5da6('0x39')](_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x39')]);_0x46541d[_0x5da6('0x3a')]=qs[_0x5da6('0x34')](_[_0x5da6('0x3b')](_0x26cb1a['query'],_0x46ed01[_0x5da6('0x34')]),_0x19dc67);if(_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x3c')]){_0x46541d['where']=_['merge'](_0x46541d['where'],{'$or':_[_0x5da6('0x2d')](_0x19dc67,function(_0x4ffe15){if(_0x4ffe15[_0x5da6('0x30')]!=='VIRTUAL'){var _0x2afd1e={};_0x2afd1e[_0x4ffe15['name']]={'$like':'%'+_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x3c')]+'%'};return _0x2afd1e;}})});}_0x46541d=_['merge']({},_0x46541d,_0x26cb1a[_0x5da6('0x3d')]);var _0x4255ae={'where':_0x46541d[_0x5da6('0x3a')]};return db[_0x5da6('0x2e')][_0x5da6('0x1e')](_0x4255ae)[_0x5da6('0x25')](function(_0x2de3e7){_0x24149d[_0x5da6('0x1e')]=_0x2de3e7;if(_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x3e')]){_0x46541d[_0x5da6('0x3f')]=[{'all':!![]}];}return db[_0x5da6('0x2e')][_0x5da6('0x40')](_0x46541d);})[_0x5da6('0x25')](function(_0x9d38b0){_0x24149d[_0x5da6('0x41')]=_0x9d38b0;return _0x24149d;})[_0x5da6('0x25')](respondWithFilteredResult(_0x25e8ae,_0x46541d))['catch'](handleError(_0x25e8ae,null));};exports[_0x5da6('0x42')]=function(_0x313a24,_0xf9cfa5){var _0x3cac43={'raw':![],'where':{'id':_0x313a24[_0x5da6('0x43')]['id']}},_0x5e01d2={};_0x5e01d2[_0x5da6('0x31')]=_[_0x5da6('0x33')](db[_0x5da6('0x2e')]['rawAttributes']);_0x5e01d2[_0x5da6('0x32')]=_[_0x5da6('0x33')](_0x313a24[_0x5da6('0x32')]);_0x5e01d2[_0x5da6('0x34')]=_[_0x5da6('0x35')](_0x5e01d2[_0x5da6('0x31')],_0x5e01d2[_0x5da6('0x32')]);_0x3cac43[_0x5da6('0x44')]=_[_0x5da6('0x35')](_0x5e01d2['model'],qs[_0x5da6('0x36')](_0x313a24[_0x5da6('0x32')][_0x5da6('0x36')]));_0x3cac43['attributes']=_0x3cac43['attributes'][_0x5da6('0x37')]?_0x3cac43[_0x5da6('0x44')]:_0x5e01d2[_0x5da6('0x31')];if(_0x313a24[_0x5da6('0x32')][_0x5da6('0x3e')]){_0x3cac43['include']=[{'all':!![]}];}_0x3cac43=_['merge']({},_0x3cac43,_0x313a24['options']);return db[_0x5da6('0x2e')][_0x5da6('0x45')](_0x3cac43)[_0x5da6('0x25')](handleEntityNotFound(_0xf9cfa5,null))[_0x5da6('0x25')](respondWithResult(_0xf9cfa5,null))[_0x5da6('0x46')](handleError(_0xf9cfa5,null));};exports[_0x5da6('0x47')]=function(_0x4a8da1,_0xce1fdc){return db[_0x5da6('0x2e')][_0x5da6('0x47')](_0x4a8da1['body'],{})['then'](function(_0xf77d73){var _0x375ea8=_0x4a8da1['user'][_0x5da6('0x27')]({'plain':!![]});if(!_0x375ea8)throw new Error(_0x5da6('0x48'));if(_0x375ea8[_0x5da6('0x49')]==='user'){var _0x2c90e2=_0xf77d73['get']({'plain':!![]});var _0xabf041=_0x5da6('0x4a');return db[_0x5da6('0x4b')][_0x5da6('0x45')]({'where':{'name':_0xabf041,'userProfileId':_0x375ea8[_0x5da6('0x4c')]},'raw':!![]})[_0x5da6('0x25')](function(_0x3e936a){if(_0x3e936a&&_0x3e936a[_0x5da6('0x4d')]===0x0){return db[_0x5da6('0x4e')][_0x5da6('0x47')]({'name':_0x2c90e2[_0x5da6('0x2a')],'resourceId':_0x2c90e2['id'],'type':_0x3e936a[_0x5da6('0x2a')],'sectionId':_0x3e936a['id']},{})['then'](function(){return _0xf77d73;});}else{return _0xf77d73;}})[_0x5da6('0x46')](function(_0x467b0e){logger['error'](_0x5da6('0x4f'),_0x467b0e);throw _0x467b0e;});}return _0xf77d73;})[_0x5da6('0x25')](respondWithResult(_0xce1fdc,0xc9))[_0x5da6('0x46')](handleError(_0xce1fdc,null));};exports[_0x5da6('0x24')]=function(_0x4d3141,_0x4bea76){if(_0x4d3141['body']['id']){delete _0x4d3141[_0x5da6('0x50')]['id'];}return db[_0x5da6('0x2e')][_0x5da6('0x45')]({'where':{'id':_0x4d3141['params']['id']}})[_0x5da6('0x25')](handleEntityNotFound(_0x4bea76,null))[_0x5da6('0x25')](saveUpdates(_0x4d3141[_0x5da6('0x50')],null))[_0x5da6('0x25')](respondWithResult(_0x4bea76,null))[_0x5da6('0x46')](handleError(_0x4bea76,null));};exports[_0x5da6('0x26')]=function(_0x4bc620,_0x23fe40){return db[_0x5da6('0x2e')][_0x5da6('0x45')]({'where':{'id':_0x4bc620[_0x5da6('0x43')]['id']}})[_0x5da6('0x25')](handleEntityNotFound(_0x23fe40,null))[_0x5da6('0x25')](removeEntity(_0x23fe40,null))[_0x5da6('0x46')](handleError(_0x23fe40,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 775fc42..dfa1de0 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 _0x0593=['context','from-sip','prefix','merge','format','CDR(type)=%s','chanspy','record','push','MixMonitor','recordingFormat','Authenticate','password','SIP/%s,%s','name','options','join','length','concat','internal','User','findAll','agent','then','catch','exports','models','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird'];(function(_0x4a639b,_0x504f9a){var _0x2c7324=function(_0x198652){while(--_0x198652){_0x4a639b['push'](_0x4a639b['shift']());}};_0x2c7324(++_0x504f9a);}(_0x0593,0x1e7));var _0x3059=function(_0x1d90e3,_0x549e09){_0x1d90e3=_0x1d90e3-0x0;var _0x4458be=_0x0593[_0x1d90e3];return _0x4458be;};'use strict';var _=require(_0x3059('0x0'));var util=require(_0x3059('0x1'));var BPromise=require(_0x3059('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x24875f,_0x44d628,_0x2166a1){var _0x3a17dd=0x1;var _0x309c76=[];var _0x54e789={'context':_0x44d628[_0x3059('0x3')]||_0x3059('0x4'),'exten':util['format']('%s%s',_0x24875f[_0x3059('0x5')],_0x2166a1),'type':'system','isApp':![],'ChanSpyId':_0x24875f['id'],'UserId':_0x44d628['id']};_0x309c76['push'](_[_0x3059('0x6')]({'app':'Set','appdata':util[_0x3059('0x7')](_0x3059('0x8'),_0x3059('0x9')),'priority':_0x3a17dd++},_0x54e789));if(_0x24875f[_0x3059('0xa')]){_0x309c76[_0x3059('0xb')](_[_0x3059('0x6')]({'app':_0x3059('0xc'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x24875f[_0x3059('0xd')]),'priority':_0x3a17dd++},_0x54e789));}if(_0x24875f['auth']){_0x309c76[_0x3059('0xb')](_[_0x3059('0x6')]({'app':_0x3059('0xe'),'appdata':_0x24875f[_0x3059('0xf')],'priority':_0x3a17dd++},_0x54e789));}_0x309c76[_0x3059('0xb')](_[_0x3059('0x6')]({'app':'ChanSpy','appdata':util[_0x3059('0x7')](_0x3059('0x10'),_0x44d628[_0x3059('0x11')],_0x24875f[_0x3059('0x12')]?_0x24875f[_0x3059('0x12')][_0x3059('0x13')](''):''),'priority':_0x3a17dd++},_0x54e789));if(_0x24875f['record']){_0x309c76[_0x3059('0xb')](_['merge']({'app':'StopMixMonitor','priority':_0x3a17dd++},_0x54e789));}return _0x309c76;};var getChanSpyApplications=function(_0x26beeb,_0x2956ee){var _0xaadac2=[];for(var _0x253579=0x0,_0x5e7500=0x1;_0x253579<_0x2956ee[_0x3059('0x14')];_0x253579++,_0x5e7500=0x1){_0xaadac2=_0xaadac2[_0x3059('0x15')](getUserApplications(_0x26beeb,_0x2956ee[_0x253579],_0x2956ee[_0x253579][_0x3059('0x16')]));if(_0x2956ee[_0x253579][_0x3059('0x16')]!=_0x2956ee[_0x253579][_0x3059('0x11')]){_0xaadac2=_0xaadac2[_0x3059('0x15')](getUserApplications(_0x26beeb,_0x2956ee[_0x253579],_0x2956ee[_0x253579][_0x3059('0x11')]));}}return _0xaadac2;};var getChanSpyPromise=function(_0x47596b,_0x563c4b){return new BPromise(function(_0x2f14c7,_0x24700e){return _0x47596b[_0x3059('0x17')][_0x3059('0x18')]({'attributes':['id','name',_0x3059('0x16')],'where':{'role':_0x3059('0x19'),'chanspy':!![]},'raw':!![]})[_0x3059('0x1a')](function(_0x4c591b){if(_0x4c591b){return _0x2f14c7(getChanSpyApplications(_0x563c4b,_0x4c591b));}return _0x2f14c7([]);})[_0x3059('0x1b')](function(_0x2edff6){_0x24700e(_0x2edff6);});});};module[_0x3059('0x1c')]=function(_0x389eb3,_0x4e6971){var _0x33c671=_0x389eb3[_0x3059('0x1d')];return _0x389eb3['define'](_0x3059('0x1e'),attributes,{'tableName':_0x3059('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2870a3,_0x4cd5cd,_0x2a4968){return getChanSpyPromise(_0x33c671,_0x2870a3)[_0x3059('0x1a')](function(_0x1bce66){if(_0x1bce66&&_0x1bce66[_0x3059('0x14')]){return _0x33c671[_0x3059('0x20')][_0x3059('0x21')](_0x1bce66);}})[_0x3059('0x1a')](function(){_0x2a4968();})[_0x3059('0x1b')](function(_0x9dc69a){_0x2a4968(_0x9dc69a);});},'afterUpdate':function(_0x748803,_0x41d692,_0x373d11){return _0x33c671[_0x3059('0x20')][_0x3059('0x22')]({'where':{'ChanSpyId':_0x748803['id']}})[_0x3059('0x1a')](function(){return getChanSpyPromise(_0x33c671,_0x748803);})[_0x3059('0x1a')](function(_0x2b637c){if(_0x2b637c&&_0x2b637c['length']){return _0x33c671[_0x3059('0x20')][_0x3059('0x21')](_0x2b637c);}})[_0x3059('0x1a')](function(){_0x373d11();})[_0x3059('0x1b')](function(_0x24680d){_0x373d11(_0x24680d);});},'afterDestroy':function(_0x23f675,_0xe7fe17,_0x56454e){return _0x33c671[_0x3059('0x20')][_0x3059('0x22')]({'where':{'ChanSpyId':_0x23f675['id']}})['then'](function(){_0x56454e();})[_0x3059('0x1b')](function(_0x22bede){_0x56454e(_0x22bede);});}}});}; \ No newline at end of file +var _0xc1c7=['context','from-sip','format','prefix','system','CDR(type)=%s','chanspy','record','push','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','name','options','StopMixMonitor','length','concat','internal','User','findAll','catch','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xc1c7,0x188));var _0x7c1c=function(_0x38607d,_0x5a783c){_0x38607d=_0x38607d-0x0;var _0x34a424=_0xc1c7[_0x38607d];return _0x34a424;};'use strict';var _=require(_0x7c1c('0x0'));var util=require(_0x7c1c('0x1'));var BPromise=require(_0x7c1c('0x2'));var attributes=require(_0x7c1c('0x3'));var getUserApplications=function(_0x424b29,_0x3e5119,_0x1c497d){var _0x45db1e=0x1;var _0x47c7e8=[];var _0x5023f2={'context':_0x3e5119[_0x7c1c('0x4')]||_0x7c1c('0x5'),'exten':util[_0x7c1c('0x6')]('%s%s',_0x424b29[_0x7c1c('0x7')],_0x1c497d),'type':_0x7c1c('0x8'),'isApp':![],'ChanSpyId':_0x424b29['id'],'UserId':_0x3e5119['id']};_0x47c7e8['push'](_['merge']({'app':'Set','appdata':util['format'](_0x7c1c('0x9'),_0x7c1c('0xa')),'priority':_0x45db1e++},_0x5023f2));if(_0x424b29[_0x7c1c('0xb')]){_0x47c7e8[_0x7c1c('0xc')](_[_0x7c1c('0xd')]({'app':_0x7c1c('0xe'),'appdata':util[_0x7c1c('0x6')](_0x7c1c('0xf'),_0x424b29[_0x7c1c('0x10')]),'priority':_0x45db1e++},_0x5023f2));}if(_0x424b29['auth']){_0x47c7e8['push'](_['merge']({'app':_0x7c1c('0x11'),'appdata':_0x424b29[_0x7c1c('0x12')],'priority':_0x45db1e++},_0x5023f2));}_0x47c7e8[_0x7c1c('0xc')](_[_0x7c1c('0xd')]({'app':_0x7c1c('0x13'),'appdata':util[_0x7c1c('0x6')]('SIP/%s,%s',_0x3e5119[_0x7c1c('0x14')],_0x424b29[_0x7c1c('0x15')]?_0x424b29[_0x7c1c('0x15')]['join'](''):''),'priority':_0x45db1e++},_0x5023f2));if(_0x424b29[_0x7c1c('0xb')]){_0x47c7e8['push'](_[_0x7c1c('0xd')]({'app':_0x7c1c('0x16'),'priority':_0x45db1e++},_0x5023f2));}return _0x47c7e8;};var getChanSpyApplications=function(_0x488254,_0x1d955d){var _0x4cabc3=[];for(var _0x471e39=0x0,_0x4fdb91=0x1;_0x471e39<_0x1d955d[_0x7c1c('0x17')];_0x471e39++,_0x4fdb91=0x1){_0x4cabc3=_0x4cabc3[_0x7c1c('0x18')](getUserApplications(_0x488254,_0x1d955d[_0x471e39],_0x1d955d[_0x471e39][_0x7c1c('0x19')]));if(_0x1d955d[_0x471e39][_0x7c1c('0x19')]!=_0x1d955d[_0x471e39][_0x7c1c('0x14')]){_0x4cabc3=_0x4cabc3[_0x7c1c('0x18')](getUserApplications(_0x488254,_0x1d955d[_0x471e39],_0x1d955d[_0x471e39]['name']));}}return _0x4cabc3;};var getChanSpyPromise=function(_0x552cbf,_0x331e85){return new BPromise(function(_0x2eb9a1,_0x36ce5b){return _0x552cbf[_0x7c1c('0x1a')][_0x7c1c('0x1b')]({'attributes':['id',_0x7c1c('0x14'),_0x7c1c('0x19')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x377aca){if(_0x377aca){return _0x2eb9a1(getChanSpyApplications(_0x331e85,_0x377aca));}return _0x2eb9a1([]);})[_0x7c1c('0x1c')](function(_0x220405){_0x36ce5b(_0x220405);});});};module['exports']=function(_0xb515d5,_0x37b6d7){var _0x463e48=_0xb515d5['models'];return _0xb515d5[_0x7c1c('0x1d')](_0x7c1c('0x1e'),attributes,{'tableName':_0x7c1c('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4681ac,_0x501bcb,_0x177273){return getChanSpyPromise(_0x463e48,_0x4681ac)[_0x7c1c('0x20')](function(_0x3414bf){if(_0x3414bf&&_0x3414bf[_0x7c1c('0x17')]){return _0x463e48[_0x7c1c('0x21')][_0x7c1c('0x22')](_0x3414bf);}})[_0x7c1c('0x20')](function(){_0x177273();})[_0x7c1c('0x1c')](function(_0xda1bd2){_0x177273(_0xda1bd2);});},'afterUpdate':function(_0x2240b4,_0x5e6991,_0x318112){return _0x463e48[_0x7c1c('0x21')][_0x7c1c('0x23')]({'where':{'ChanSpyId':_0x2240b4['id']}})[_0x7c1c('0x20')](function(){return getChanSpyPromise(_0x463e48,_0x2240b4);})[_0x7c1c('0x20')](function(_0x3096c2){if(_0x3096c2&&_0x3096c2[_0x7c1c('0x17')]){return _0x463e48[_0x7c1c('0x21')][_0x7c1c('0x22')](_0x3096c2);}})[_0x7c1c('0x20')](function(){_0x318112();})[_0x7c1c('0x1c')](function(_0x164aa1){_0x318112(_0x164aa1);});},'afterDestroy':function(_0x4ea33c,_0xfcd6c7,_0x199c7a){return _0x463e48['VoiceExtension'][_0x7c1c('0x23')]({'where':{'ChanSpyId':_0x4ea33c['id']}})[_0x7c1c('0x20')](function(){_0x199c7a();})[_0x7c1c('0x1c')](function(_0x380077){_0x199c7a(_0x380077);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 0819eee..4688f2b 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 _0xe28e=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x483e4a,_0x32aa45){var _0x31fba5=function(_0x345bc9){while(--_0x345bc9){_0x483e4a['push'](_0x483e4a['shift']());}};_0x31fba5(++_0x32aa45);}(_0xe28e,0x1ba));var _0xee28=function(_0x1a2b55,_0x166512){_0x1a2b55=_0x1a2b55-0x0;var _0x3eef93=_0xe28e[_0x1a2b55];return _0x3eef93;};'use strict';var _=require(_0xee28('0x0'));var util=require(_0xee28('0x1'));var moment=require(_0xee28('0x2'));var BPromise=require(_0xee28('0x3'));var rs=require(_0xee28('0x4'));var fs=require('fs');var Redis=require(_0xee28('0x5'));var db=require(_0xee28('0x6'))['db'];var utils=require(_0xee28('0x7'));var logger=require(_0xee28('0x8'))(_0xee28('0x9'));var config=require(_0xee28('0xa'));var jayson=require(_0xee28('0xb'));var client=jayson[_0xee28('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39b337,_0x30224a,_0x3f9bd9){return new BPromise(function(_0x66d0b6,_0x156aad){return client[_0xee28('0xd')](_0x39b337,_0x3f9bd9)[_0xee28('0xe')](function(_0x5d7562){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x30224a,_0xee28('0xf'));logger[_0xee28('0x10')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x30224a,_0xee28('0xf'),JSON[_0xee28('0x11')](_0x5d7562));if(_0x5d7562['error']){if(_0x5d7562[_0xee28('0x12')][_0xee28('0x13')]===0x1f4){logger[_0xee28('0x12')](_0xee28('0x14'),_0x30224a,_0x5d7562[_0xee28('0x12')][_0xee28('0x15')]);return _0x156aad(_0x5d7562[_0xee28('0x12')]['message']);}logger[_0xee28('0x12')](_0xee28('0x14'),_0x30224a,_0x5d7562[_0xee28('0x12')][_0xee28('0x15')]);return _0x66d0b6(_0x5d7562[_0xee28('0x12')]['message']);}else{logger[_0xee28('0x16')](_0xee28('0x14'),_0x30224a,_0xee28('0xf'));_0x66d0b6(_0x5d7562[_0xee28('0x17')][_0xee28('0x15')]);}})[_0xee28('0x18')](function(_0x4c0eb9){logger[_0xee28('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x30224a,_0x4c0eb9);_0x156aad(_0x4c0eb9);});});} \ No newline at end of file +var _0x684c=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis'];(function(_0x5a3abc,_0x2ff755){var _0x37c46b=function(_0x27b240){while(--_0x27b240){_0x5a3abc['push'](_0x5a3abc['shift']());}};_0x37c46b(++_0x2ff755);}(_0x684c,0x1b3));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc684('0x0'));var util=require(_0xc684('0x1'));var moment=require('moment');var BPromise=require(_0xc684('0x2'));var rs=require(_0xc684('0x3'));var fs=require('fs');var Redis=require(_0xc684('0x4'));var db=require(_0xc684('0x5'))['db'];var utils=require(_0xc684('0x6'));var logger=require('../../config/logger')(_0xc684('0x7'));var config=require(_0xc684('0x8'));var jayson=require(_0xc684('0x9'));var client=jayson[_0xc684('0xa')][_0xc684('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57a63c,_0x23bd1c,_0x1a96ea){return new BPromise(function(_0x146733,_0xccb771){return client[_0xc684('0xc')](_0x57a63c,_0x1a96ea)[_0xc684('0xd')](function(_0x3b3bc0){logger[_0xc684('0xe')](_0xc684('0xf'),_0x23bd1c,_0xc684('0x10'));logger[_0xc684('0x11')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x23bd1c,_0xc684('0x10'),JSON[_0xc684('0x12')](_0x3b3bc0));if(_0x3b3bc0[_0xc684('0x13')]){if(_0x3b3bc0[_0xc684('0x13')][_0xc684('0x14')]===0x1f4){logger[_0xc684('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x23bd1c,_0x3b3bc0[_0xc684('0x13')][_0xc684('0x15')]);return _0xccb771(_0x3b3bc0['error']['message']);}logger[_0xc684('0x13')](_0xc684('0xf'),_0x23bd1c,_0x3b3bc0[_0xc684('0x13')][_0xc684('0x15')]);return _0x146733(_0x3b3bc0[_0xc684('0x13')][_0xc684('0x15')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x23bd1c,_0xc684('0x10'));_0x146733(_0x3b3bc0['result']['message']);}})['catch'](function(_0x47a8eb){logger['error'](_0xc684('0xf'),_0x23bd1c,_0x47a8eb);_0xccb771(_0x47a8eb);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index a888f69..db414b9 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 _0x554e=['util','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','put','update','exports','multer'];(function(_0x1d7f7a,_0x27a199){var _0x16855a=function(_0x286e61){while(--_0x286e61){_0x1d7f7a['push'](_0x1d7f7a['shift']());}};_0x16855a(++_0x27a199);}(_0x554e,0x9f));var _0xe554=function(_0x44cca6,_0x5e9271){_0x44cca6=_0x44cca6-0x0;var _0x175d04=_0x554e[_0x44cca6];return _0x175d04;};'use strict';var multer=require(_0xe554('0x0'));var util=require(_0xe554('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe554('0x2'));var router=express[_0xe554('0x3')]();var fs_extra=require(_0xe554('0x4'));var auth=require(_0xe554('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe554('0x6'));var controller=require('./voiceContext.controller');router[_0xe554('0x7')]('/',auth['isAuthenticated'](),controller[_0xe554('0x8')]);router['get'](_0xe554('0x9'),auth[_0xe554('0xa')](),controller[_0xe554('0xb')]);router[_0xe554('0xc')]('/',auth[_0xe554('0xa')](),controller['create']);router[_0xe554('0xd')](_0xe554('0x9'),auth[_0xe554('0xa')](),controller[_0xe554('0xe')]);router['delete'](_0xe554('0x9'),auth[_0xe554('0xa')](),controller['destroy']);module[_0xe554('0xf')]=router; \ No newline at end of file +var _0xb2fa=['path','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','util'];(function(_0x5babd5,_0x231f1c){var _0x10e315=function(_0x3a64cc){while(--_0x3a64cc){_0x5babd5['push'](_0x5babd5['shift']());}};_0x10e315(++_0x231f1c);}(_0xb2fa,0x1d2));var _0xab2f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb2fa[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xab2f('0x0'));var util=require(_0xab2f('0x1'));var path=require(_0xab2f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xab2f('0x3')]();var fs_extra=require(_0xab2f('0x4'));var auth=require(_0xab2f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xab2f('0x6'));var controller=require(_0xab2f('0x7'));router[_0xab2f('0x8')]('/',auth[_0xab2f('0x9')](),controller[_0xab2f('0xa')]);router[_0xab2f('0x8')](_0xab2f('0xb'),auth[_0xab2f('0x9')](),controller[_0xab2f('0xc')]);router[_0xab2f('0xd')]('/',auth[_0xab2f('0x9')](),controller['create']);router[_0xab2f('0xe')](_0xab2f('0xb'),auth[_0xab2f('0x9')](),controller[_0xab2f('0xf')]);router[_0xab2f('0x10')](_0xab2f('0xb'),auth['isAuthenticated'](),controller[_0xab2f('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 451fef2..e0eb74a 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 _0xc0d6=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x2a88ee,_0x34f274){var _0x7c7702=function(_0x291181){while(--_0x291181){_0x2a88ee['push'](_0x2a88ee['shift']());}};_0x7c7702(++_0x34f274);}(_0xc0d6,0x136));var _0x6c0d=function(_0x2065ed,_0x3bf51b){_0x2065ed=_0x2065ed-0x0;var _0x309cdc=_0xc0d6[_0x2065ed];return _0x309cdc;};'use strict';var Sequelize=require(_0x6c0d('0x0'));module[_0x6c0d('0x1')]={'name':{'type':Sequelize[_0x6c0d('0x2')],'unique':_0x6c0d('0x3')},'description':{'type':Sequelize[_0x6c0d('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x6c0d('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0ed1=['exports','name','STRING','BOOLEAN','sequelize'];(function(_0x364504,_0x408a9a){var _0x2bd1cb=function(_0x4991f4){while(--_0x4991f4){_0x364504['push'](_0x364504['shift']());}};_0x2bd1cb(++_0x408a9a);}(_0x0ed1,0xb3));var _0x10ed=function(_0x3d96a7,_0x645190){_0x3d96a7=_0x3d96a7-0x0;var _0x5de8ad=_0x0ed1[_0x3d96a7];return _0x5de8ad;};'use strict';var Sequelize=require(_0x10ed('0x0'));module[_0x10ed('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x10ed('0x2')},'description':{'type':Sequelize[_0x10ed('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x10ed('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 2a4ef62..753fe94 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 _0x0c29=['nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','params','find','create','body','readFileSync','join','root','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','server/files/templates/context.ejs','render','Reload','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','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','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','result','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','destroy','get','Contexts','UserProfileResource','sendStatus','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0x5bc752,_0x3ee40d){var _0x8857eb=function(_0x212dcf){while(--_0x212dcf){_0x5bc752['push'](_0x5bc752['shift']());}};_0x8857eb(++_0x3ee40d);}(_0x0c29,0xf3));var _0x90c2=function(_0x45b1ba,_0x5a6a21){_0x45b1ba=_0x45b1ba-0x0;var _0x145ddb=_0x0c29[_0x45b1ba];return _0x145ddb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x90c2('0x0'));var zipdir=require(_0x90c2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x90c2('0x2'));var moment=require(_0x90c2('0x3'));var BPromise=require(_0x90c2('0x4'));var Mustache=require(_0x90c2('0x5'));var util=require(_0x90c2('0x6'));var path=require('path');var sox=require(_0x90c2('0x7'));var csv=require(_0x90c2('0x8'));var ejs=require(_0x90c2('0x9'));var fs=require('fs');var fs_extra=require(_0x90c2('0xa'));var _=require('lodash');var squel=require(_0x90c2('0xb'));var crypto=require(_0x90c2('0xc'));var jsforce=require(_0x90c2('0xd'));var deskjs=require(_0x90c2('0xe'));var toCsv=require(_0x90c2('0x8'));var querystring=require(_0x90c2('0xf'));var Papa=require('papaparse');var Redis=require(_0x90c2('0x10'));var authService=require(_0x90c2('0x11'));var qs=require(_0x90c2('0x12'));var as=require(_0x90c2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x90c2('0x14'));var utils=require(_0x90c2('0x15'));var config=require(_0x90c2('0x16'));var licenseUtil=require(_0x90c2('0x17'));var db=require(_0x90c2('0x18'))['db'];var jayson=require(_0x90c2('0x19'));var client=jayson[_0x90c2('0x1a')][_0x90c2('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1231d3,_0x368dc5,_0x3fe516,_0xf19779){return new BPromise(function(_0x128a36,_0x46df99){var _0x3922cb=_0xf19779||client;return _0x3922cb[_0x90c2('0x1c')](_0x1231d3,_0x3fe516)[_0x90c2('0x1d')](function(_0x1abde4){logger[_0x90c2('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x368dc5,_0x90c2('0x1f'));logger['debug'](_0x90c2('0x20'),_0x368dc5,_0x90c2('0x1f'),JSON[_0x90c2('0x21')](_0x1abde4));if(_0x1abde4[_0x90c2('0x22')]){if(_0x1abde4[_0x90c2('0x22')][_0x90c2('0x23')]===0x1f4){logger[_0x90c2('0x22')]('VoiceContext,\x20%s,\x20%s',_0x368dc5,_0x1abde4[_0x90c2('0x22')][_0x90c2('0x24')]);return _0x46df99(_0x1abde4['error']['message']);}logger[_0x90c2('0x22')]('VoiceContext,\x20%s,\x20%s',_0x368dc5,_0x1abde4[_0x90c2('0x22')][_0x90c2('0x24')]);return _0x128a36(_0x1abde4[_0x90c2('0x22')][_0x90c2('0x24')]);}else{logger[_0x90c2('0x1e')](_0x90c2('0x25'),_0x368dc5,_0x90c2('0x1f'));_0x128a36(_0x1abde4[_0x90c2('0x26')][_0x90c2('0x24')]);}})['catch'](function(_0x581415){logger[_0x90c2('0x22')](_0x90c2('0x25'),_0x368dc5,_0x581415);_0x46df99(_0x581415);});});}function respondWithStatusCode(_0x5df219,_0x2003df){_0x2003df=_0x2003df||0xcc;return function(_0x394de8){if(_0x394de8){return _0x5df219['sendStatus'](_0x2003df);}return _0x5df219['status'](_0x2003df)[_0x90c2('0x27')]();};}function respondWithResult(_0x212452,_0x48d18e){_0x48d18e=_0x48d18e||0xc8;return function(_0x59c185){if(_0x59c185){return _0x212452['status'](_0x48d18e)[_0x90c2('0x28')](_0x59c185);}};}function respondWithFilteredResult(_0x52a2fe,_0x24fb6a){return function(_0x5489d6){if(_0x5489d6){var _0x5b16a7=typeof _0x24fb6a[_0x90c2('0x29')]===_0x90c2('0x2a')&&typeof _0x24fb6a[_0x90c2('0x2b')]===_0x90c2('0x2a');var _0x3ab567=_0x5489d6[_0x90c2('0x2c')];var _0x4e92bb=_0x5b16a7?0x0:_0x24fb6a[_0x90c2('0x29')];var _0x6452bb=_0x5b16a7?_0x5489d6[_0x90c2('0x2c')]:_0x24fb6a[_0x90c2('0x29')]+_0x24fb6a[_0x90c2('0x2b')];var _0x5a3ba1;if(_0x6452bb>=_0x3ab567){_0x6452bb=_0x3ab567;_0x5a3ba1=0xc8;}else{_0x5a3ba1=0xce;}_0x52a2fe[_0x90c2('0x2d')](_0x5a3ba1);return _0x52a2fe[_0x90c2('0x2e')](_0x90c2('0x2f'),_0x4e92bb+'-'+_0x6452bb+'/'+_0x3ab567)[_0x90c2('0x28')](_0x5489d6);}return null;};}function patchUpdates(_0x703018){return function(_0x409b8d){try{jsonpatch[_0x90c2('0x30')](_0x409b8d,_0x703018,!![]);}catch(_0x44cbcb){return BPromise[_0x90c2('0x31')](_0x44cbcb);}return _0x409b8d[_0x90c2('0x32')]();};}function saveUpdates(_0x9d700e,_0x8ffeff){return function(_0xd977a0){if(_0xd977a0){return _0xd977a0['update'](_0x9d700e)[_0x90c2('0x1d')](function(_0x1db012){return _0x1db012;});}return null;};}function removeEntity(_0x482b87,_0x51d8a4){return function(_0x1a700e){if(_0x1a700e){return _0x1a700e[_0x90c2('0x33')]()[_0x90c2('0x1d')](function(){var _0x739cef=_0x1a700e[_0x90c2('0x34')]({'plain':!![]});var _0x43f738=_0x90c2('0x35');return db[_0x90c2('0x36')][_0x90c2('0x33')]({'where':{'type':_0x43f738,'resourceId':_0x739cef['id']}})[_0x90c2('0x1d')](function(){return _0x1a700e;});})[_0x90c2('0x1d')](function(){_0x482b87[_0x90c2('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23af75,_0x3a70de){return function(_0x391185){if(!_0x391185){_0x23af75[_0x90c2('0x37')](0x194);}return _0x391185;};}function handleError(_0x52fd40,_0x3175d9){_0x3175d9=_0x3175d9||0x1f4;return function(_0x246b47){logger[_0x90c2('0x22')](_0x246b47[_0x90c2('0x38')]);if(_0x246b47[_0x90c2('0x39')]){delete _0x246b47[_0x90c2('0x39')];}_0x52fd40[_0x90c2('0x2d')](_0x3175d9)[_0x90c2('0x3a')](_0x246b47);};}exports[_0x90c2('0x3b')]=function(_0x40e126,_0x20928c){var _0x32a334={},_0x2b6f10={},_0x3a416c={'count':0x0,'rows':[]};var _0x50e169=_[_0x90c2('0x3c')](db[_0x90c2('0x3d')][_0x90c2('0x3e')],function(_0x3d0bbb){return{'name':_0x3d0bbb[_0x90c2('0x3f')],'type':_0x3d0bbb[_0x90c2('0x40')][_0x90c2('0x41')]};});_0x2b6f10['model']=_['map'](_0x50e169,'name');_0x2b6f10[_0x90c2('0x42')]=_[_0x90c2('0x43')](_0x40e126['query']);_0x2b6f10[_0x90c2('0x44')]=_[_0x90c2('0x45')](_0x2b6f10[_0x90c2('0x46')],_0x2b6f10['query']);_0x32a334['attributes']=_[_0x90c2('0x45')](_0x2b6f10['model'],qs[_0x90c2('0x47')](_0x40e126['query'][_0x90c2('0x47')]));_0x32a334[_0x90c2('0x48')]=_0x32a334[_0x90c2('0x48')][_0x90c2('0x49')]?_0x32a334[_0x90c2('0x48')]:_0x2b6f10['model'];if(!_0x40e126['query'][_0x90c2('0x4a')](_0x90c2('0x4b'))){_0x32a334[_0x90c2('0x2b')]=qs['limit'](_0x40e126[_0x90c2('0x42')][_0x90c2('0x2b')]);_0x32a334[_0x90c2('0x29')]=qs[_0x90c2('0x29')](_0x40e126[_0x90c2('0x42')][_0x90c2('0x29')]);}_0x32a334[_0x90c2('0x4c')]=qs[_0x90c2('0x4d')](_0x40e126['query'][_0x90c2('0x4d')]);_0x32a334[_0x90c2('0x4e')]=qs[_0x90c2('0x44')](_[_0x90c2('0x4f')](_0x40e126[_0x90c2('0x42')],_0x2b6f10[_0x90c2('0x44')]),_0x50e169);if(_0x40e126[_0x90c2('0x42')][_0x90c2('0x50')]){_0x32a334[_0x90c2('0x4e')]=_[_0x90c2('0x51')](_0x32a334[_0x90c2('0x4e')],{'$or':_[_0x90c2('0x3c')](_0x50e169,function(_0x35b9e7){if(_0x35b9e7[_0x90c2('0x40')]!=='VIRTUAL'){var _0x56d2dd={};_0x56d2dd[_0x35b9e7['name']]={'$like':'%'+_0x40e126['query']['filter']+'%'};return _0x56d2dd;}})});}_0x32a334=_[_0x90c2('0x51')]({},_0x32a334,_0x40e126[_0x90c2('0x52')]);var _0x3eea25={'where':_0x32a334[_0x90c2('0x4e')]};return db[_0x90c2('0x3d')][_0x90c2('0x2c')](_0x3eea25)[_0x90c2('0x1d')](function(_0x1988b6){_0x3a416c[_0x90c2('0x2c')]=_0x1988b6;if(_0x40e126[_0x90c2('0x42')][_0x90c2('0x53')]){_0x32a334[_0x90c2('0x54')]=[{'all':!![]}];}return db[_0x90c2('0x3d')][_0x90c2('0x55')](_0x32a334);})[_0x90c2('0x1d')](function(_0xed22f8){_0x3a416c['rows']=_0xed22f8;return _0x3a416c;})[_0x90c2('0x1d')](respondWithFilteredResult(_0x20928c,_0x32a334))['catch'](handleError(_0x20928c,null));};exports['show']=function(_0x387b2b,_0x21aac5){var _0x1a501e={'raw':![],'where':{'id':_0x387b2b[_0x90c2('0x56')]['id']}},_0x19bd78={};_0x19bd78['model']=_[_0x90c2('0x43')](db['VoiceContext'][_0x90c2('0x3e')]);_0x19bd78[_0x90c2('0x42')]=_['keys'](_0x387b2b[_0x90c2('0x42')]);_0x19bd78[_0x90c2('0x44')]=_[_0x90c2('0x45')](_0x19bd78['model'],_0x19bd78[_0x90c2('0x42')]);_0x1a501e['attributes']=_[_0x90c2('0x45')](_0x19bd78['model'],qs[_0x90c2('0x47')](_0x387b2b['query'][_0x90c2('0x47')]));_0x1a501e[_0x90c2('0x48')]=_0x1a501e[_0x90c2('0x48')][_0x90c2('0x49')]?_0x1a501e[_0x90c2('0x48')]:_0x19bd78[_0x90c2('0x46')];if(_0x387b2b[_0x90c2('0x42')][_0x90c2('0x53')]){_0x1a501e[_0x90c2('0x54')]=[{'all':!![]}];}_0x1a501e=_['merge']({},_0x1a501e,_0x387b2b['options']);return db[_0x90c2('0x3d')][_0x90c2('0x57')](_0x1a501e)[_0x90c2('0x1d')](handleEntityNotFound(_0x21aac5,null))['then'](respondWithResult(_0x21aac5,null))['catch'](handleError(_0x21aac5,null));};exports[_0x90c2('0x58')]=function(_0x4c8035,_0x47c4d5,_0x22abcd){var _0x198703;return db[_0x90c2('0x3d')][_0x90c2('0x58')](_0x4c8035[_0x90c2('0x59')],{'raw':!![]})[_0x90c2('0x1d')](function(_0x5e7efa){_0x198703=_0x5e7efa;return db[_0x90c2('0x3d')][_0x90c2('0x55')]({'raw':!![]});})['then'](function(_0x1260ba){var _0x499f9b=fs[_0x90c2('0x5a')](path[_0x90c2('0x5b')](config[_0x90c2('0x5c')],'server/files/templates/context.ejs'),_0x90c2('0x5d'));var _0x2e4d3c=ejs['render'](_0x499f9b,{'contexts':_0x1260ba||[]});fs[_0x90c2('0x5e')](_0x90c2('0x5f'),_0x2e4d3c);})[_0x90c2('0x1d')](function(){return respondWithRpcPromise('Reload',_0x90c2('0x58'),{'module':_0x90c2('0x60')});})[_0x90c2('0x1d')](function(){var _0x4fefea=_0x4c8035['user'][_0x90c2('0x34')]({'plain':!![]});if(!_0x4fefea)throw new Error(_0x90c2('0x61'));if(_0x4fefea['role']==='user'){var _0x222f71=_0x198703[_0x90c2('0x34')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x90c2('0x35'),'userProfileId':_0x4fefea[_0x90c2('0x62')]},'raw':!![]})[_0x90c2('0x1d')](function(_0x4bbf6b){if(_0x4bbf6b&&_0x4bbf6b[_0x90c2('0x63')]===0x0){return db[_0x90c2('0x36')][_0x90c2('0x58')]({'name':_0x222f71[_0x90c2('0x39')],'resourceId':_0x222f71['id'],'type':_0x4bbf6b['name'],'sectionId':_0x4bbf6b['id']},{})[_0x90c2('0x1d')](function(){return _0x198703;});}else{return _0x198703;}})[_0x90c2('0x64')](function(_0x3a7f66){logger[_0x90c2('0x22')](_0x90c2('0x65'),_0x3a7f66);throw _0x3a7f66;});}return _0x198703;})[_0x90c2('0x1d')](respondWithResult(_0x47c4d5,0xc9))[_0x90c2('0x64')](handleError(_0x47c4d5,null));};exports[_0x90c2('0x66')]=function(_0x4fd7a0,_0x4b4549,_0x277853){var _0x2abe10;return db['VoiceContext'][_0x90c2('0x57')]({'where':{'id':_0x4fd7a0['params']['id']}})['then'](handleEntityNotFound(_0x4b4549,null))[_0x90c2('0x1d')](saveUpdates(_0x4fd7a0[_0x90c2('0x59')],null))[_0x90c2('0x1d')](function(_0x17a6de){if(_0x17a6de){_0x2abe10=_0x17a6de;return db[_0x90c2('0x3d')][_0x90c2('0x55')]({'raw':!![]});}})[_0x90c2('0x1d')](function(_0x58d2aa){var _0x41a3f8=fs[_0x90c2('0x5a')](path[_0x90c2('0x5b')](config[_0x90c2('0x5c')],_0x90c2('0x67')),_0x90c2('0x5d'));var _0x49ab70=ejs[_0x90c2('0x68')](_0x41a3f8,{'contexts':_0x58d2aa||[]});fs[_0x90c2('0x5e')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x49ab70);})['then'](function(){return respondWithRpcPromise(_0x90c2('0x69'),_0x90c2('0x66'),{'module':'chan_sip.so'});})['then'](function(){return _0x2abe10;})[_0x90c2('0x1d')](respondWithResult(_0x4b4549,null))[_0x90c2('0x64')](handleError(_0x4b4549,null));};exports[_0x90c2('0x33')]=function(_0x4546c1,_0x249d4d,_0x5c302f){var _0xf5ef37;return db[_0x90c2('0x3d')][_0x90c2('0x57')]({'where':{'id':_0x4546c1[_0x90c2('0x56')]['id']}})['then'](handleEntityNotFound(_0x249d4d,null))['then'](removeEntity(_0x249d4d,null))[_0x90c2('0x1d')](function(){return db[_0x90c2('0x3d')][_0x90c2('0x55')]({'raw':!![]});})[_0x90c2('0x1d')](function(_0x3f77b8){var _0x265a81=fs[_0x90c2('0x5a')](path[_0x90c2('0x5b')](config[_0x90c2('0x5c')],'server/files/templates/context.ejs'),_0x90c2('0x5d'));var _0x5b4a27=ejs['render'](_0x265a81,{'contexts':_0x3f77b8});fs['writeFileSync'](_0x90c2('0x5f'),_0x5b4a27);return respondWithRpcPromise(_0x90c2('0x69'),_0x90c2('0x33'),{'module':'chan_sip.so'});})['catch'](handleError(_0x249d4d,null));}; \ No newline at end of file +var _0xf2e7=['name','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','filters','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','params','keys','intersection','options','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Contexts','userProfileId','autoAssociation','render','Reload','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','get','UserProfileResource','destroy'];(function(_0x3307f7,_0x1c7c96){var _0x36306b=function(_0x410411){while(--_0x410411){_0x3307f7['push'](_0x3307f7['shift']());}};_0x36306b(++_0x1c7c96);}(_0xf2e7,0x15c));var _0x7f2e=function(_0x10d3ab,_0x58027c){_0x10d3ab=_0x10d3ab-0x0;var _0x5940a5=_0xf2e7[_0x10d3ab];return _0x5940a5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7f2e('0x0'));var moment=require('moment');var BPromise=require(_0x7f2e('0x1'));var Mustache=require(_0x7f2e('0x2'));var util=require(_0x7f2e('0x3'));var path=require(_0x7f2e('0x4'));var sox=require(_0x7f2e('0x5'));var csv=require('to-csv');var ejs=require(_0x7f2e('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7f2e('0x7'));var squel=require(_0x7f2e('0x8'));var crypto=require('crypto');var jsforce=require(_0x7f2e('0x9'));var deskjs=require(_0x7f2e('0xa'));var toCsv=require(_0x7f2e('0xb'));var querystring=require(_0x7f2e('0xc'));var Papa=require(_0x7f2e('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7f2e('0xe'));var hardwareService=require(_0x7f2e('0xf'));var logger=require(_0x7f2e('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x7f2e('0x11'));var licenseUtil=require(_0x7f2e('0x12'));var db=require(_0x7f2e('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x7f2e('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x9fad57,_0x59fa51,_0xe36c9e,_0x12c21d){return new BPromise(function(_0x36773b,_0x540894){var _0x28942c=_0x12c21d||client;return _0x28942c[_0x7f2e('0x15')](_0x9fad57,_0xe36c9e)[_0x7f2e('0x16')](function(_0x174dfe){logger[_0x7f2e('0x17')](_0x7f2e('0x18'),_0x59fa51,_0x7f2e('0x19'));logger['debug'](_0x7f2e('0x1a'),_0x59fa51,'request\x20sent',JSON[_0x7f2e('0x1b')](_0x174dfe));if(_0x174dfe[_0x7f2e('0x1c')]){if(_0x174dfe[_0x7f2e('0x1c')][_0x7f2e('0x1d')]===0x1f4){logger[_0x7f2e('0x1c')](_0x7f2e('0x18'),_0x59fa51,_0x174dfe[_0x7f2e('0x1c')][_0x7f2e('0x1e')]);return _0x540894(_0x174dfe['error'][_0x7f2e('0x1e')]);}logger[_0x7f2e('0x1c')](_0x7f2e('0x18'),_0x59fa51,_0x174dfe[_0x7f2e('0x1c')][_0x7f2e('0x1e')]);return _0x36773b(_0x174dfe[_0x7f2e('0x1c')][_0x7f2e('0x1e')]);}else{logger[_0x7f2e('0x17')]('VoiceContext,\x20%s,\x20%s',_0x59fa51,_0x7f2e('0x19'));_0x36773b(_0x174dfe[_0x7f2e('0x1f')][_0x7f2e('0x1e')]);}})[_0x7f2e('0x20')](function(_0x4fe782){logger['error']('VoiceContext,\x20%s,\x20%s',_0x59fa51,_0x4fe782);_0x540894(_0x4fe782);});});}function respondWithStatusCode(_0x2e8bf1,_0x27236a){_0x27236a=_0x27236a||0xcc;return function(_0x2d448b){if(_0x2d448b){return _0x2e8bf1['sendStatus'](_0x27236a);}return _0x2e8bf1[_0x7f2e('0x21')](_0x27236a)[_0x7f2e('0x22')]();};}function respondWithResult(_0x307d3e,_0x55ccf7){_0x55ccf7=_0x55ccf7||0xc8;return function(_0x47ed1d){if(_0x47ed1d){return _0x307d3e['status'](_0x55ccf7)['json'](_0x47ed1d);}};}function respondWithFilteredResult(_0x369b3d,_0x2447d9){return function(_0x5775a7){if(_0x5775a7){var _0x215616=typeof _0x2447d9['offset']===_0x7f2e('0x23')&&typeof _0x2447d9[_0x7f2e('0x24')]===_0x7f2e('0x23');var _0x365669=_0x5775a7[_0x7f2e('0x25')];var _0x522a2d=_0x215616?0x0:_0x2447d9[_0x7f2e('0x26')];var _0x2af95a=_0x215616?_0x5775a7['count']:_0x2447d9[_0x7f2e('0x26')]+_0x2447d9[_0x7f2e('0x24')];var _0x1c543d;if(_0x2af95a>=_0x365669){_0x2af95a=_0x365669;_0x1c543d=0xc8;}else{_0x1c543d=0xce;}_0x369b3d[_0x7f2e('0x21')](_0x1c543d);return _0x369b3d['set'](_0x7f2e('0x27'),_0x522a2d+'-'+_0x2af95a+'/'+_0x365669)[_0x7f2e('0x28')](_0x5775a7);}return null;};}function patchUpdates(_0x2fd0cf){return function(_0x522398){try{jsonpatch[_0x7f2e('0x29')](_0x522398,_0x2fd0cf,!![]);}catch(_0x51def7){return BPromise[_0x7f2e('0x2a')](_0x51def7);}return _0x522398[_0x7f2e('0x2b')]();};}function saveUpdates(_0x1eaaeb,_0x37a36d){return function(_0x5f31eb){if(_0x5f31eb){return _0x5f31eb[_0x7f2e('0x2c')](_0x1eaaeb)[_0x7f2e('0x16')](function(_0xca0845){return _0xca0845;});}return null;};}function removeEntity(_0x4a4299,_0x38b5bc){return function(_0x817111){if(_0x817111){return _0x817111['destroy']()[_0x7f2e('0x16')](function(){var _0x1f0d2b=_0x817111[_0x7f2e('0x2d')]({'plain':!![]});var _0x4d84c1='Contexts';return db[_0x7f2e('0x2e')][_0x7f2e('0x2f')]({'where':{'type':_0x4d84c1,'resourceId':_0x1f0d2b['id']}})[_0x7f2e('0x16')](function(){return _0x817111;});})['then'](function(){_0x4a4299[_0x7f2e('0x21')](0xcc)[_0x7f2e('0x22')]();});}};}function handleEntityNotFound(_0x45a12a,_0x2eaa78){return function(_0x55d459){if(!_0x55d459){_0x45a12a['sendStatus'](0x194);}return _0x55d459;};}function handleError(_0x5f5fd3,_0x42fbc7){_0x42fbc7=_0x42fbc7||0x1f4;return function(_0x242f70){logger[_0x7f2e('0x1c')](_0x242f70['stack']);if(_0x242f70[_0x7f2e('0x30')]){delete _0x242f70[_0x7f2e('0x30')];}_0x5f5fd3[_0x7f2e('0x21')](_0x42fbc7)['send'](_0x242f70);};}exports[_0x7f2e('0x31')]=function(_0x39f585,_0x302f69){var _0x5eb7e7={},_0x1a15b4={},_0x2f8e77={'count':0x0,'rows':[]};var _0xe8cb9a=_[_0x7f2e('0x32')](db[_0x7f2e('0x33')][_0x7f2e('0x34')],function(_0x47a9ed){return{'name':_0x47a9ed[_0x7f2e('0x35')],'type':_0x47a9ed[_0x7f2e('0x36')][_0x7f2e('0x37')]};});_0x1a15b4[_0x7f2e('0x38')]=_[_0x7f2e('0x32')](_0xe8cb9a,'name');_0x1a15b4['query']=_['keys'](_0x39f585['query']);_0x1a15b4[_0x7f2e('0x39')]=_['intersection'](_0x1a15b4[_0x7f2e('0x38')],_0x1a15b4['query']);_0x5eb7e7[_0x7f2e('0x3a')]=_['intersection'](_0x1a15b4[_0x7f2e('0x38')],qs[_0x7f2e('0x3b')](_0x39f585[_0x7f2e('0x3c')][_0x7f2e('0x3b')]));_0x5eb7e7[_0x7f2e('0x3a')]=_0x5eb7e7['attributes'][_0x7f2e('0x3d')]?_0x5eb7e7[_0x7f2e('0x3a')]:_0x1a15b4[_0x7f2e('0x38')];if(!_0x39f585['query'][_0x7f2e('0x3e')](_0x7f2e('0x3f'))){_0x5eb7e7[_0x7f2e('0x24')]=qs[_0x7f2e('0x24')](_0x39f585[_0x7f2e('0x3c')][_0x7f2e('0x24')]);_0x5eb7e7[_0x7f2e('0x26')]=qs[_0x7f2e('0x26')](_0x39f585[_0x7f2e('0x3c')][_0x7f2e('0x26')]);}_0x5eb7e7[_0x7f2e('0x40')]=qs[_0x7f2e('0x41')](_0x39f585['query'][_0x7f2e('0x41')]);_0x5eb7e7['where']=qs['filters'](_[_0x7f2e('0x42')](_0x39f585[_0x7f2e('0x3c')],_0x1a15b4[_0x7f2e('0x39')]),_0xe8cb9a);if(_0x39f585['query'][_0x7f2e('0x43')]){_0x5eb7e7[_0x7f2e('0x44')]=_['merge'](_0x5eb7e7[_0x7f2e('0x44')],{'$or':_[_0x7f2e('0x32')](_0xe8cb9a,function(_0x15ba83){if(_0x15ba83['type']!==_0x7f2e('0x45')){var _0x132268={};_0x132268[_0x15ba83[_0x7f2e('0x30')]]={'$like':'%'+_0x39f585[_0x7f2e('0x3c')][_0x7f2e('0x43')]+'%'};return _0x132268;}})});}_0x5eb7e7=_[_0x7f2e('0x46')]({},_0x5eb7e7,_0x39f585['options']);var _0x293a9c={'where':_0x5eb7e7['where']};return db['VoiceContext'][_0x7f2e('0x25')](_0x293a9c)['then'](function(_0x2f7ffa){_0x2f8e77[_0x7f2e('0x25')]=_0x2f7ffa;if(_0x39f585[_0x7f2e('0x3c')][_0x7f2e('0x47')]){_0x5eb7e7[_0x7f2e('0x48')]=[{'all':!![]}];}return db[_0x7f2e('0x33')][_0x7f2e('0x49')](_0x5eb7e7);})[_0x7f2e('0x16')](function(_0x4ad9cf){_0x2f8e77[_0x7f2e('0x4a')]=_0x4ad9cf;return _0x2f8e77;})[_0x7f2e('0x16')](respondWithFilteredResult(_0x302f69,_0x5eb7e7))[_0x7f2e('0x20')](handleError(_0x302f69,null));};exports['show']=function(_0x48db2d,_0x397339){var _0x192bcd={'raw':![],'where':{'id':_0x48db2d[_0x7f2e('0x4b')]['id']}},_0x18f1bb={};_0x18f1bb['model']=_[_0x7f2e('0x4c')](db[_0x7f2e('0x33')][_0x7f2e('0x34')]);_0x18f1bb[_0x7f2e('0x3c')]=_[_0x7f2e('0x4c')](_0x48db2d[_0x7f2e('0x3c')]);_0x18f1bb['filters']=_['intersection'](_0x18f1bb[_0x7f2e('0x38')],_0x18f1bb[_0x7f2e('0x3c')]);_0x192bcd['attributes']=_[_0x7f2e('0x4d')](_0x18f1bb['model'],qs['fields'](_0x48db2d[_0x7f2e('0x3c')]['fields']));_0x192bcd['attributes']=_0x192bcd[_0x7f2e('0x3a')][_0x7f2e('0x3d')]?_0x192bcd[_0x7f2e('0x3a')]:_0x18f1bb[_0x7f2e('0x38')];if(_0x48db2d[_0x7f2e('0x3c')][_0x7f2e('0x47')]){_0x192bcd['include']=[{'all':!![]}];}_0x192bcd=_[_0x7f2e('0x46')]({},_0x192bcd,_0x48db2d[_0x7f2e('0x4e')]);return db[_0x7f2e('0x33')]['find'](_0x192bcd)[_0x7f2e('0x16')](handleEntityNotFound(_0x397339,null))[_0x7f2e('0x16')](respondWithResult(_0x397339,null))[_0x7f2e('0x20')](handleError(_0x397339,null));};exports[_0x7f2e('0x4f')]=function(_0x48b128,_0x2d8059,_0x48062a){var _0x37ca81;return db[_0x7f2e('0x33')][_0x7f2e('0x4f')](_0x48b128[_0x7f2e('0x50')],{'raw':!![]})[_0x7f2e('0x16')](function(_0x4012e9){_0x37ca81=_0x4012e9;return db[_0x7f2e('0x33')]['findAll']({'raw':!![]});})['then'](function(_0xae1a73){var _0xd661e7=fs[_0x7f2e('0x51')](path[_0x7f2e('0x52')](config[_0x7f2e('0x53')],_0x7f2e('0x54')),_0x7f2e('0x55'));var _0x558c5e=ejs['render'](_0xd661e7,{'contexts':_0xae1a73||[]});fs[_0x7f2e('0x56')](_0x7f2e('0x57'),_0x558c5e);})[_0x7f2e('0x16')](function(){return respondWithRpcPromise('Reload',_0x7f2e('0x4f'),{'module':_0x7f2e('0x58')});})[_0x7f2e('0x16')](function(){var _0x2a564b=_0x48b128[_0x7f2e('0x59')][_0x7f2e('0x2d')]({'plain':!![]});if(!_0x2a564b)throw new Error(_0x7f2e('0x5a'));if(_0x2a564b[_0x7f2e('0x5b')]===_0x7f2e('0x59')){var _0x55dd65=_0x37ca81[_0x7f2e('0x2d')]({'plain':!![]});return db[_0x7f2e('0x5c')][_0x7f2e('0x5d')]({'where':{'name':_0x7f2e('0x5e'),'userProfileId':_0x2a564b[_0x7f2e('0x5f')]},'raw':!![]})[_0x7f2e('0x16')](function(_0x4800cc){if(_0x4800cc&&_0x4800cc[_0x7f2e('0x60')]===0x0){return db[_0x7f2e('0x2e')][_0x7f2e('0x4f')]({'name':_0x55dd65[_0x7f2e('0x30')],'resourceId':_0x55dd65['id'],'type':_0x4800cc['name'],'sectionId':_0x4800cc['id']},{})[_0x7f2e('0x16')](function(){return _0x37ca81;});}else{return _0x37ca81;}})['catch'](function(_0x3f173f){logger[_0x7f2e('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f173f);throw _0x3f173f;});}return _0x37ca81;})[_0x7f2e('0x16')](respondWithResult(_0x2d8059,0xc9))['catch'](handleError(_0x2d8059,null));};exports['update']=function(_0x562816,_0x28421c,_0x5da1a9){var _0x22ff46;return db[_0x7f2e('0x33')]['find']({'where':{'id':_0x562816[_0x7f2e('0x4b')]['id']}})[_0x7f2e('0x16')](handleEntityNotFound(_0x28421c,null))[_0x7f2e('0x16')](saveUpdates(_0x562816[_0x7f2e('0x50')],null))['then'](function(_0x66ae92){if(_0x66ae92){_0x22ff46=_0x66ae92;return db['VoiceContext'][_0x7f2e('0x49')]({'raw':!![]});}})[_0x7f2e('0x16')](function(_0x4659da){var _0x480082=fs[_0x7f2e('0x51')](path[_0x7f2e('0x52')](config['root'],_0x7f2e('0x54')),_0x7f2e('0x55'));var _0x305732=ejs[_0x7f2e('0x61')](_0x480082,{'contexts':_0x4659da||[]});fs[_0x7f2e('0x56')](_0x7f2e('0x57'),_0x305732);})[_0x7f2e('0x16')](function(){return respondWithRpcPromise(_0x7f2e('0x62'),_0x7f2e('0x2c'),{'module':_0x7f2e('0x58')});})[_0x7f2e('0x16')](function(){return _0x22ff46;})[_0x7f2e('0x16')](respondWithResult(_0x28421c,null))[_0x7f2e('0x20')](handleError(_0x28421c,null));};exports[_0x7f2e('0x2f')]=function(_0xf8f223,_0x502e20,_0xe77e42){var _0x5b59b0;return db['VoiceContext']['find']({'where':{'id':_0xf8f223[_0x7f2e('0x4b')]['id']}})[_0x7f2e('0x16')](handleEntityNotFound(_0x502e20,null))[_0x7f2e('0x16')](removeEntity(_0x502e20,null))[_0x7f2e('0x16')](function(){return db[_0x7f2e('0x33')][_0x7f2e('0x49')]({'raw':!![]});})[_0x7f2e('0x16')](function(_0x4046c1){var _0x2e6635=fs[_0x7f2e('0x51')](path['join'](config[_0x7f2e('0x53')],_0x7f2e('0x54')),_0x7f2e('0x55'));var _0x2880c8=ejs[_0x7f2e('0x61')](_0x2e6635,{'contexts':_0x4046c1});fs[_0x7f2e('0x56')](_0x7f2e('0x57'),_0x2880c8);return respondWithRpcPromise(_0x7f2e('0x62'),_0x7f2e('0x2f'),{'module':_0x7f2e('0x58')});})[_0x7f2e('0x20')](handleError(_0x502e20,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 709a14e..9de5d9a 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 _0x50b8=['api','request-promise','rimraf','../../config/environment','exports','VoiceContext','voice_contexts','lodash','util','../../config/logger'];(function(_0x15e030,_0x21c67e){var _0x2fd9f6=function(_0x3ec036){while(--_0x3ec036){_0x15e030['push'](_0x15e030['shift']());}};_0x2fd9f6(++_0x21c67e);}(_0x50b8,0x9d));var _0x850b=function(_0x3ca85e,_0x4cf232){_0x3ca85e=_0x3ca85e-0x0;var _0x54ce6a=_0x50b8[_0x3ca85e];return _0x54ce6a;};'use strict';var _=require(_0x850b('0x0'));var util=require(_0x850b('0x1'));var logger=require(_0x850b('0x2'))(_0x850b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x850b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x850b('0x5'));var config=require(_0x850b('0x6'));var attributes=require('./voiceContext.attributes');module[_0x850b('0x7')]=function(_0x5e29e8,_0x4e16f9){return _0x5e29e8['define'](_0x850b('0x8'),attributes,{'tableName':_0x850b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x438a=['./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5887a9,_0x2bd8a5){var _0xdae025=function(_0x115417){while(--_0x115417){_0x5887a9['push'](_0x5887a9['shift']());}};_0xdae025(++_0x2bd8a5);}(_0x438a,0x18b));var _0xa438=function(_0x54a5d1,_0x11ba96){_0x54a5d1=_0x54a5d1-0x0;var _0x24457d=_0x438a[_0x54a5d1];return _0x24457d;};'use strict';var _=require(_0xa438('0x0'));var util=require(_0xa438('0x1'));var logger=require(_0xa438('0x2'))(_0xa438('0x3'));var moment=require(_0xa438('0x4'));var BPromise=require(_0xa438('0x5'));var rp=require(_0xa438('0x6'));var fs=require('fs');var path=require(_0xa438('0x7'));var rimraf=require(_0xa438('0x8'));var config=require(_0xa438('0x9'));var attributes=require(_0xa438('0xa'));module[_0xa438('0xb')]=function(_0x41817,_0x12e2cf){return _0x41817[_0xa438('0xc')](_0xa438('0xd'),attributes,{'tableName':_0xa438('0xe'),'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 1a4fbbf..2be0dbb 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 _0x41f6=['error','message','VoiceContext,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x533aba,_0x3cc582){var _0x37bf55=function(_0x183b63){while(--_0x183b63){_0x533aba['push'](_0x533aba['shift']());}};_0x37bf55(++_0x3cc582);}(_0x41f6,0x8e));var _0x641f=function(_0x273dc5,_0x268a81){_0x273dc5=_0x273dc5-0x0;var _0x46dae7=_0x41f6[_0x273dc5];return _0x46dae7;};'use strict';var _=require(_0x641f('0x0'));var util=require('util');var moment=require(_0x641f('0x1'));var BPromise=require(_0x641f('0x2'));var rs=require(_0x641f('0x3'));var fs=require('fs');var Redis=require(_0x641f('0x4'));var db=require(_0x641f('0x5'))['db'];var utils=require(_0x641f('0x6'));var logger=require(_0x641f('0x7'))(_0x641f('0x8'));var config=require(_0x641f('0x9'));var jayson=require(_0x641f('0xa'));var client=jayson[_0x641f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x118c00,_0x48c950,_0x5448f0){return new BPromise(function(_0x3425ca,_0x116a33){return client[_0x641f('0xc')](_0x118c00,_0x5448f0)[_0x641f('0xd')](function(_0x2ec42e){logger[_0x641f('0xe')]('VoiceContext,\x20%s,\x20%s',_0x48c950,_0x641f('0xf'));logger[_0x641f('0x10')](_0x641f('0x11'),_0x48c950,_0x641f('0xf'),JSON[_0x641f('0x12')](_0x2ec42e));if(_0x2ec42e[_0x641f('0x13')]){if(_0x2ec42e[_0x641f('0x13')]['code']===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x48c950,_0x2ec42e[_0x641f('0x13')][_0x641f('0x14')]);return _0x116a33(_0x2ec42e['error'][_0x641f('0x14')]);}logger[_0x641f('0x13')](_0x641f('0x15'),_0x48c950,_0x2ec42e[_0x641f('0x13')][_0x641f('0x14')]);return _0x3425ca(_0x2ec42e[_0x641f('0x13')][_0x641f('0x14')]);}else{logger['info'](_0x641f('0x15'),_0x48c950,'request\x20sent');_0x3425ca(_0x2ec42e['result']['message']);}})[_0x641f('0x16')](function(_0x51ba91){logger[_0x641f('0x13')]('VoiceContext,\x20%s,\x20%s',_0x48c950,_0x51ba91);_0x116a33(_0x51ba91);});});} \ No newline at end of file +var _0x52b8=['message','result','util','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s'];(function(_0x2d015c,_0x31bb7e){var _0x403093=function(_0x2dc795){while(--_0x2dc795){_0x2d015c['push'](_0x2d015c['shift']());}};_0x403093(++_0x31bb7e);}(_0x52b8,0xd3));var _0x852b=function(_0x2e7a97,_0x504a31){_0x2e7a97=_0x2e7a97-0x0;var _0x334d80=_0x52b8[_0x2e7a97];return _0x334d80;};'use strict';var _=require('lodash');var util=require(_0x852b('0x0'));var moment=require('moment');var BPromise=require(_0x852b('0x1'));var rs=require(_0x852b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x852b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x852b('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x852b('0x5'));var client=jayson['client'][_0x852b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x270472,_0x4f7e7e,_0x51aaf5){return new BPromise(function(_0x480294,_0x375f86){return client[_0x852b('0x7')](_0x270472,_0x51aaf5)[_0x852b('0x8')](function(_0x2ae1e9){logger[_0x852b('0x9')]('VoiceContext,\x20%s,\x20%s',_0x4f7e7e,_0x852b('0xa'));logger[_0x852b('0xb')](_0x852b('0xc'),_0x4f7e7e,_0x852b('0xa'),JSON[_0x852b('0xd')](_0x2ae1e9));if(_0x2ae1e9['error']){if(_0x2ae1e9[_0x852b('0xe')][_0x852b('0xf')]===0x1f4){logger['error'](_0x852b('0x10'),_0x4f7e7e,_0x2ae1e9[_0x852b('0xe')]['message']);return _0x375f86(_0x2ae1e9[_0x852b('0xe')][_0x852b('0x11')]);}logger[_0x852b('0xe')]('VoiceContext,\x20%s,\x20%s',_0x4f7e7e,_0x2ae1e9[_0x852b('0xe')][_0x852b('0x11')]);return _0x480294(_0x2ae1e9[_0x852b('0xe')][_0x852b('0x11')]);}else{logger[_0x852b('0x9')](_0x852b('0x10'),_0x4f7e7e,_0x852b('0xa'));_0x480294(_0x2ae1e9[_0x852b('0x12')]['message']);}})['catch'](function(_0x2e5c4b){logger[_0x852b('0xe')](_0x852b('0x10'),_0x4f7e7e,_0x2e5c4b);_0x375f86(_0x2e5c4b);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 8a93b6b..5bdf64b 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 _0x983c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','describe','post','create','put','/:id','update','delete','destroy'];(function(_0x29f028,_0x2452dc){var _0x478837=function(_0x4c790a){while(--_0x4c790a){_0x29f028['push'](_0x29f028['shift']());}};_0x478837(++_0x2452dc);}(_0x983c,0xf3));var _0xc983=function(_0x32ce61,_0x2ba733){_0x32ce61=_0x32ce61-0x0;var _0x28eded=_0x983c[_0x32ce61];return _0x28eded;};'use strict';var multer=require(_0xc983('0x0'));var util=require(_0xc983('0x1'));var path=require(_0xc983('0x2'));var timeout=require(_0xc983('0x3'));var express=require(_0xc983('0x4'));var router=express['Router']();var fs_extra=require(_0xc983('0x5'));var auth=require(_0xc983('0x6'));var interaction=require(_0xc983('0x7'));var config=require(_0xc983('0x8'));var controller=require(_0xc983('0x9'));router[_0xc983('0xa')]('/',auth[_0xc983('0xb')](),controller['index']);router[_0xc983('0xa')](_0xc983('0xc'),auth[_0xc983('0xb')](),controller[_0xc983('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc983('0xe')]('/',auth[_0xc983('0xb')](),controller[_0xc983('0xf')]);router[_0xc983('0x10')](_0xc983('0x11'),auth[_0xc983('0xb')](),controller[_0xc983('0x12')]);router[_0xc983('0x13')](_0xc983('0x11'),auth['isAuthenticated'](),controller[_0xc983('0x14')]);module[_0xc983('0x15')]=router; \ No newline at end of file +var _0xdd89=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xdd89,0xc5));var _0x9dd8=function(_0x4e55a9,_0x241b22){_0x4e55a9=_0x4e55a9-0x0;var _0x4a9b67=_0xdd89[_0x4e55a9];return _0x4a9b67;};'use strict';var multer=require(_0x9dd8('0x0'));var util=require(_0x9dd8('0x1'));var path=require(_0x9dd8('0x2'));var timeout=require(_0x9dd8('0x3'));var express=require(_0x9dd8('0x4'));var router=express[_0x9dd8('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9dd8('0x6'));var config=require(_0x9dd8('0x7'));var controller=require(_0x9dd8('0x8'));router[_0x9dd8('0x9')]('/',auth[_0x9dd8('0xa')](),controller[_0x9dd8('0xb')]);router[_0x9dd8('0x9')](_0x9dd8('0xc'),auth[_0x9dd8('0xa')](),controller[_0x9dd8('0xd')]);router['get'](_0x9dd8('0xe'),auth[_0x9dd8('0xa')](),controller[_0x9dd8('0xf')]);router[_0x9dd8('0x10')]('/',auth[_0x9dd8('0xa')](),controller[_0x9dd8('0x11')]);router[_0x9dd8('0x12')](_0x9dd8('0xe'),auth['isAuthenticated'](),controller[_0x9dd8('0x13')]);router[_0x9dd8('0x14')](_0x9dd8('0xe'),auth['isAuthenticated'](),controller[_0x9dd8('0x15')]);module[_0x9dd8('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 2d0f050..2bf66ed 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0xdfd43e,_0x180e49){var _0x18ccb6=function(_0x417daa){while(--_0x417daa){_0xdfd43e['push'](_0xdfd43e['shift']());}};_0x18ccb6(++_0x180e49);}(_0x34e8,0x12c));var _0x834e=function(_0x202474,_0x3c94be){_0x202474=_0x202474-0x0;var _0x59d5cf=_0x34e8[_0x202474];return _0x59d5cf;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'privilege':{'type':Sequelize[_0x834e('0x2')]},'channel':{'type':Sequelize[_0x834e('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x834e('0x2')]},'calleridnum':{'type':Sequelize[_0x834e('0x2')]},'calleridname':{'type':Sequelize[_0x834e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x834e('0x2')]},'connectedlinename':{'type':Sequelize[_0x834e('0x2')]},'language':{'type':Sequelize[_0x834e('0x2')]},'accountcode':{'type':Sequelize[_0x834e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x834e('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x834e('0x2')]},'linkedid':{'type':Sequelize[_0x834e('0x2')]},'destchannel':{'type':Sequelize[_0x834e('0x2')]},'destchannelstate':{'type':Sequelize[_0x834e('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x834e('0x2')]},'destcalleridnum':{'type':Sequelize[_0x834e('0x2')]},'destcalleridname':{'type':Sequelize[_0x834e('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x834e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x834e('0x2')]},'destlanguage':{'type':Sequelize[_0x834e('0x2')]},'destaccountcode':{'type':Sequelize[_0x834e('0x2')]},'destcontext':{'type':Sequelize[_0x834e('0x2')]},'destexten':{'type':Sequelize[_0x834e('0x2')]},'destpriority':{'type':Sequelize[_0x834e('0x3')]},'destuniqueid':{'type':Sequelize[_0x834e('0x2')]},'destlinkedid':{'type':Sequelize[_0x834e('0x2')]},'dialstring':{'type':Sequelize[_0x834e('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x834e('0x4')]},'answertime':{'type':Sequelize[_0x834e('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x834e('0x2')],'comment':_0x834e('0x5')},'routeId':{'type':Sequelize[_0x834e('0x3')]},'duration':{'type':Sequelize[_0x834e('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x834e('0x3')]}}; \ No newline at end of file +var _0x425d=['sequelize','STRING','INTEGER','DATE'];(function(_0x33f39f,_0x516edd){var _0x1a1684=function(_0x204601){while(--_0x204601){_0x33f39f['push'](_0x33f39f['shift']());}};_0x1a1684(++_0x516edd);}(_0x425d,0x1e0));var _0xd425=function(_0x4c4664,_0x506a85){_0x4c4664=_0x4c4664-0x0;var _0x2920cf=_0x425d[_0x4c4664];return _0x2920cf;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xd425('0x1')]},'channel':{'type':Sequelize[_0xd425('0x1')]},'channelstate':{'type':Sequelize[_0xd425('0x2')]},'channelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'calleridnum':{'type':Sequelize[_0xd425('0x1')]},'calleridname':{'type':Sequelize[_0xd425('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd425('0x1')]},'accountcode':{'type':Sequelize[_0xd425('0x1')]},'context':{'type':Sequelize[_0xd425('0x1')]},'exten':{'type':Sequelize[_0xd425('0x1')]},'priority':{'type':Sequelize[_0xd425('0x2')]},'uniqueid':{'type':Sequelize[_0xd425('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd425('0x1')]},'destchannelstate':{'type':Sequelize[_0xd425('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd425('0x1')]},'destcalleridname':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd425('0x1')]},'destlanguage':{'type':Sequelize[_0xd425('0x1')]},'destaccountcode':{'type':Sequelize[_0xd425('0x1')]},'destcontext':{'type':Sequelize[_0xd425('0x1')]},'destexten':{'type':Sequelize[_0xd425('0x1')]},'destpriority':{'type':Sequelize[_0xd425('0x2')]},'destuniqueid':{'type':Sequelize[_0xd425('0x1')]},'destlinkedid':{'type':Sequelize[_0xd425('0x1')]},'dialstring':{'type':Sequelize[_0xd425('0x1')]},'dialstatus':{'type':Sequelize[_0xd425('0x1')]},'starttime':{'type':Sequelize[_0xd425('0x3')]},'answertime':{'type':Sequelize[_0xd425('0x3')]},'endtime':{'type':Sequelize[_0xd425('0x3')]},'lastevent':{'type':Sequelize[_0xd425('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xd425('0x2')]},'duration':{'type':Sequelize[_0xd425('0x2')]},'holdtime':{'type':Sequelize[_0xd425('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index a596964..1726e0b 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 _0x2671=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','then','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','body','params','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3307d5,_0x4c1a8c){var _0x4f654f=function(_0x10b047){while(--_0x10b047){_0x3307d5['push'](_0x3307d5['shift']());}};_0x4f654f(++_0x4c1a8c);}(_0x2671,0x1d8));var _0x1267=function(_0x3a7e01,_0x51204c){_0x3a7e01=_0x3a7e01-0x0;var _0x5b8398=_0x2671[_0x3a7e01];return _0x5b8398;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1267('0x0'));var zipdir=require(_0x1267('0x1'));var jsonpatch=require(_0x1267('0x2'));var rp=require('request-promise');var moment=require(_0x1267('0x3'));var BPromise=require(_0x1267('0x4'));var Mustache=require('mustache');var util=require(_0x1267('0x5'));var path=require(_0x1267('0x6'));var sox=require(_0x1267('0x7'));var csv=require(_0x1267('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1267('0x9'));var _=require(_0x1267('0xa'));var squel=require('squel');var crypto=require(_0x1267('0xb'));var jsforce=require(_0x1267('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1267('0x8'));var querystring=require(_0x1267('0xd'));var Papa=require('papaparse');var Redis=require(_0x1267('0xe'));var authService=require(_0x1267('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1267('0x10'));var hardwareService=require(_0x1267('0x11'));var logger=require('../../config/logger')(_0x1267('0x12'));var utils=require(_0x1267('0x13'));var config=require(_0x1267('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1267('0x15'))['db'];function respondWithStatusCode(_0x29738a,_0x15e2ab){_0x15e2ab=_0x15e2ab||0xcc;return function(_0xb7ca5b){if(_0xb7ca5b){return _0x29738a[_0x1267('0x16')](_0x15e2ab);}return _0x29738a[_0x1267('0x17')](_0x15e2ab)[_0x1267('0x18')]();};}function respondWithResult(_0x1ba791,_0x5346de){_0x5346de=_0x5346de||0xc8;return function(_0x2d26aa){if(_0x2d26aa){return _0x1ba791[_0x1267('0x17')](_0x5346de)[_0x1267('0x19')](_0x2d26aa);}};}function respondWithFilteredResult(_0x2e574b,_0x48707e){return function(_0x281dfc){if(_0x281dfc){var _0x4a4811=typeof _0x48707e[_0x1267('0x1a')]==='undefined'&&typeof _0x48707e[_0x1267('0x1b')]==='undefined';var _0xa9b68f=_0x281dfc['count'];var _0x532923=_0x4a4811?0x0:_0x48707e['offset'];var _0x323524=_0x4a4811?_0x281dfc[_0x1267('0x1c')]:_0x48707e[_0x1267('0x1a')]+_0x48707e[_0x1267('0x1b')];var _0x4d6535;if(_0x323524>=_0xa9b68f){_0x323524=_0xa9b68f;_0x4d6535=0xc8;}else{_0x4d6535=0xce;}_0x2e574b['status'](_0x4d6535);return _0x2e574b[_0x1267('0x1d')](_0x1267('0x1e'),_0x532923+'-'+_0x323524+'/'+_0xa9b68f)[_0x1267('0x19')](_0x281dfc);}return null;};}function patchUpdates(_0x2820b3){return function(_0x1e3796){try{jsonpatch['apply'](_0x1e3796,_0x2820b3,!![]);}catch(_0xf157d8){return BPromise['reject'](_0xf157d8);}return _0x1e3796['save']();};}function saveUpdates(_0x3677db,_0x112648){return function(_0x1764c8){if(_0x1764c8){return _0x1764c8['update'](_0x3677db)[_0x1267('0x1f')](function(_0x53ec7b){return _0x53ec7b;});}return null;};}function removeEntity(_0x41092d,_0x4e2ac1){return function(_0x30efe1){if(_0x30efe1){return _0x30efe1[_0x1267('0x20')]()['then'](function(){_0x41092d[_0x1267('0x17')](0xcc)[_0x1267('0x18')]();});}};}function handleEntityNotFound(_0x2f99b5,_0x1e0f48){return function(_0x12dfca){if(!_0x12dfca){_0x2f99b5[_0x1267('0x16')](0x194);}return _0x12dfca;};}function handleError(_0x58ae4f,_0x25c618){_0x25c618=_0x25c618||0x1f4;return function(_0x5e65b0){logger[_0x1267('0x21')](_0x5e65b0[_0x1267('0x22')]);if(_0x5e65b0['name']){delete _0x5e65b0[_0x1267('0x23')];}_0x58ae4f[_0x1267('0x17')](_0x25c618)[_0x1267('0x24')](_0x5e65b0);};}exports[_0x1267('0x25')]=function(_0x52d6fa,_0x5e0d1c){var _0x3877c2={},_0x28e056={},_0x336601={'count':0x0,'rows':[]};var _0x5630f7=_[_0x1267('0x26')](db[_0x1267('0x27')][_0x1267('0x28')],function(_0x472d64){return{'name':_0x472d64[_0x1267('0x29')],'type':_0x472d64[_0x1267('0x2a')][_0x1267('0x2b')]};});_0x28e056[_0x1267('0x2c')]=_[_0x1267('0x26')](_0x5630f7,_0x1267('0x23'));_0x28e056['query']=_[_0x1267('0x2d')](_0x52d6fa['query']);_0x28e056['filters']=_[_0x1267('0x2e')](_0x28e056[_0x1267('0x2c')],_0x28e056[_0x1267('0x2f')]);_0x3877c2['attributes']=_[_0x1267('0x2e')](_0x28e056[_0x1267('0x2c')],qs[_0x1267('0x30')](_0x52d6fa['query'][_0x1267('0x30')]));_0x3877c2[_0x1267('0x31')]=_0x3877c2[_0x1267('0x31')][_0x1267('0x32')]?_0x3877c2['attributes']:_0x28e056[_0x1267('0x2c')];if(!_0x52d6fa[_0x1267('0x2f')][_0x1267('0x33')](_0x1267('0x34'))){_0x3877c2['limit']=qs[_0x1267('0x1b')](_0x52d6fa[_0x1267('0x2f')][_0x1267('0x1b')]);_0x3877c2[_0x1267('0x1a')]=qs[_0x1267('0x1a')](_0x52d6fa[_0x1267('0x2f')][_0x1267('0x1a')]);}_0x3877c2[_0x1267('0x35')]=qs['sort'](_0x52d6fa[_0x1267('0x2f')][_0x1267('0x36')]);_0x3877c2[_0x1267('0x37')]=qs[_0x1267('0x38')](_['pick'](_0x52d6fa[_0x1267('0x2f')],_0x28e056['filters']),_0x5630f7);if(_0x52d6fa[_0x1267('0x2f')][_0x1267('0x39')]){_0x3877c2[_0x1267('0x37')]=_[_0x1267('0x3a')](_0x3877c2['where'],{'$or':_[_0x1267('0x26')](_0x5630f7,function(_0x2c8e47){if(_0x2c8e47['type']!==_0x1267('0x3b')){var _0x212185={};_0x212185[_0x2c8e47[_0x1267('0x23')]]={'$like':'%'+_0x52d6fa[_0x1267('0x2f')][_0x1267('0x39')]+'%'};return _0x212185;}})});}_0x3877c2=_['merge']({},_0x3877c2,_0x52d6fa[_0x1267('0x3c')]);var _0x1af589={'where':_0x3877c2['where']};return db[_0x1267('0x27')][_0x1267('0x1c')](_0x1af589)[_0x1267('0x1f')](function(_0x549770){_0x336601['count']=_0x549770;if(_0x52d6fa[_0x1267('0x2f')][_0x1267('0x3d')]){_0x3877c2[_0x1267('0x3e')]=[{'all':!![]}];}return db[_0x1267('0x27')][_0x1267('0x3f')](_0x3877c2);})[_0x1267('0x1f')](function(_0x39aaef){_0x336601['rows']=_0x39aaef;return _0x336601;})[_0x1267('0x1f')](respondWithFilteredResult(_0x5e0d1c,_0x3877c2))[_0x1267('0x40')](handleError(_0x5e0d1c,null));};exports[_0x1267('0x41')]=function(_0x4e859a,_0x27ff48){var _0x577fbe={'raw':!![],'where':{'id':_0x4e859a['params']['id']}},_0x47972f={};_0x47972f['model']=_['keys'](db[_0x1267('0x27')][_0x1267('0x28')]);_0x47972f[_0x1267('0x2f')]=_[_0x1267('0x2d')](_0x4e859a[_0x1267('0x2f')]);_0x47972f['filters']=_[_0x1267('0x2e')](_0x47972f[_0x1267('0x2c')],_0x47972f[_0x1267('0x2f')]);_0x577fbe[_0x1267('0x31')]=_[_0x1267('0x2e')](_0x47972f[_0x1267('0x2c')],qs['fields'](_0x4e859a[_0x1267('0x2f')][_0x1267('0x30')]));_0x577fbe[_0x1267('0x31')]=_0x577fbe[_0x1267('0x31')]['length']?_0x577fbe[_0x1267('0x31')]:_0x47972f['model'];if(_0x4e859a[_0x1267('0x2f')][_0x1267('0x3d')]){_0x577fbe[_0x1267('0x3e')]=[{'all':!![]}];}_0x577fbe=_[_0x1267('0x3a')]({},_0x577fbe,_0x4e859a['options']);return db[_0x1267('0x27')][_0x1267('0x42')](_0x577fbe)[_0x1267('0x1f')](handleEntityNotFound(_0x27ff48,null))['then'](respondWithResult(_0x27ff48,null))[_0x1267('0x40')](handleError(_0x27ff48,null));};exports['create']=function(_0xeced66,_0x2c0031){return db[_0x1267('0x27')]['create'](_0xeced66[_0x1267('0x43')],{})[_0x1267('0x1f')](respondWithResult(_0x2c0031,0xc9))['catch'](handleError(_0x2c0031,null));};exports['update']=function(_0xa778a4,_0x5e53f8){if(_0xa778a4[_0x1267('0x43')]['id']){delete _0xa778a4['body']['id'];}return db['VoiceDialReport'][_0x1267('0x42')]({'where':{'id':_0xa778a4['params']['id']}})[_0x1267('0x1f')](handleEntityNotFound(_0x5e53f8,null))[_0x1267('0x1f')](saveUpdates(_0xa778a4['body'],null))['then'](respondWithResult(_0x5e53f8,null))[_0x1267('0x40')](handleError(_0x5e53f8,null));};exports[_0x1267('0x20')]=function(_0x3ec720,_0x4f07f8){return db[_0x1267('0x27')][_0x1267('0x42')]({'where':{'id':_0x3ec720[_0x1267('0x44')]['id']}})[_0x1267('0x1f')](handleEntityNotFound(_0x4f07f8,null))[_0x1267('0x1f')](removeEntity(_0x4f07f8,null))[_0x1267('0x40')](handleError(_0x4f07f8,null));};exports[_0x1267('0x45')]=function(_0x4f87b2,_0x1ad0a7){return db[_0x1267('0x27')][_0x1267('0x45')]()[_0x1267('0x1f')](respondWithResult(_0x1ad0a7,null))[_0x1267('0x40')](handleError(_0x1ad0a7,null));}; \ No newline at end of file +var _0x0afd=['then','stack','name','index','rawAttributes','type','model','map','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','VoiceDialReport','include','findAll','rows','show','params','keys','includeAll','catch','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject'];(function(_0x198156,_0x2bab77){var _0x29e503=function(_0x51d3e9){while(--_0x51d3e9){_0x198156['push'](_0x198156['shift']());}};_0x29e503(++_0x2bab77);}(_0x0afd,0x182));var _0xd0af=function(_0x4c0d22,_0xf3d4eb){_0x4c0d22=_0x4c0d22-0x0;var _0x4206fe=_0x0afd[_0x4c0d22];return _0x4206fe;};'use strict';var emlformat=require(_0xd0af('0x0'));var rimraf=require(_0xd0af('0x1'));var zipdir=require(_0xd0af('0x2'));var jsonpatch=require(_0xd0af('0x3'));var rp=require(_0xd0af('0x4'));var moment=require('moment');var BPromise=require(_0xd0af('0x5'));var Mustache=require(_0xd0af('0x6'));var util=require(_0xd0af('0x7'));var path=require('path');var sox=require(_0xd0af('0x8'));var csv=require(_0xd0af('0x9'));var ejs=require(_0xd0af('0xa'));var fs=require('fs');var fs_extra=require(_0xd0af('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd0af('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd0af('0xd'));var toCsv=require(_0xd0af('0x9'));var querystring=require('querystring');var Papa=require(_0xd0af('0xe'));var Redis=require('ioredis');var authService=require(_0xd0af('0xf'));var qs=require(_0xd0af('0x10'));var as=require(_0xd0af('0x11'));var hardwareService=require(_0xd0af('0x12'));var logger=require('../../config/logger')(_0xd0af('0x13'));var utils=require(_0xd0af('0x14'));var config=require(_0xd0af('0x15'));var licenseUtil=require(_0xd0af('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ced6a,_0x37d36b){_0x37d36b=_0x37d36b||0xcc;return function(_0x583250){if(_0x583250){return _0x2ced6a[_0xd0af('0x17')](_0x37d36b);}return _0x2ced6a[_0xd0af('0x18')](_0x37d36b)[_0xd0af('0x19')]();};}function respondWithResult(_0x19483f,_0x35b890){_0x35b890=_0x35b890||0xc8;return function(_0x322906){if(_0x322906){return _0x19483f[_0xd0af('0x18')](_0x35b890)[_0xd0af('0x1a')](_0x322906);}};}function respondWithFilteredResult(_0x88baac,_0x16d2d5){return function(_0x52b54a){if(_0x52b54a){var _0x3dd041=typeof _0x16d2d5[_0xd0af('0x1b')]===_0xd0af('0x1c')&&typeof _0x16d2d5['limit']===_0xd0af('0x1c');var _0x419354=_0x52b54a[_0xd0af('0x1d')];var _0x2e2689=_0x3dd041?0x0:_0x16d2d5['offset'];var _0x19bdc6=_0x3dd041?_0x52b54a[_0xd0af('0x1d')]:_0x16d2d5[_0xd0af('0x1b')]+_0x16d2d5[_0xd0af('0x1e')];var _0xa3e016;if(_0x19bdc6>=_0x419354){_0x19bdc6=_0x419354;_0xa3e016=0xc8;}else{_0xa3e016=0xce;}_0x88baac[_0xd0af('0x18')](_0xa3e016);return _0x88baac['set'](_0xd0af('0x1f'),_0x2e2689+'-'+_0x19bdc6+'/'+_0x419354)[_0xd0af('0x1a')](_0x52b54a);}return null;};}function patchUpdates(_0x4cf1a5){return function(_0x219910){try{jsonpatch[_0xd0af('0x20')](_0x219910,_0x4cf1a5,!![]);}catch(_0x4e074e){return BPromise[_0xd0af('0x21')](_0x4e074e);}return _0x219910['save']();};}function saveUpdates(_0x32eb42,_0x4d1f43){return function(_0x5edb7d){if(_0x5edb7d){return _0x5edb7d['update'](_0x32eb42)[_0xd0af('0x22')](function(_0x5caec2){return _0x5caec2;});}return null;};}function removeEntity(_0x5dcf2f,_0x328c18){return function(_0xe99ae8){if(_0xe99ae8){return _0xe99ae8['destroy']()[_0xd0af('0x22')](function(){_0x5dcf2f[_0xd0af('0x18')](0xcc)[_0xd0af('0x19')]();});}};}function handleEntityNotFound(_0x5b80c6,_0x4cfe0c){return function(_0x1b8f90){if(!_0x1b8f90){_0x5b80c6[_0xd0af('0x17')](0x194);}return _0x1b8f90;};}function handleError(_0x2f6955,_0x322ed5){_0x322ed5=_0x322ed5||0x1f4;return function(_0x21c079){logger['error'](_0x21c079[_0xd0af('0x23')]);if(_0x21c079[_0xd0af('0x24')]){delete _0x21c079[_0xd0af('0x24')];}_0x2f6955['status'](_0x322ed5)['send'](_0x21c079);};}exports[_0xd0af('0x25')]=function(_0x5b7c0a,_0x1ccf1b){var _0x3cc887={},_0x791980={},_0x46e089={'count':0x0,'rows':[]};var _0x2b4ce6=_['map'](db['VoiceDialReport'][_0xd0af('0x26')],function(_0x349471){return{'name':_0x349471['fieldName'],'type':_0x349471[_0xd0af('0x27')]['key']};});_0x791980[_0xd0af('0x28')]=_[_0xd0af('0x29')](_0x2b4ce6,_0xd0af('0x24'));_0x791980['query']=_['keys'](_0x5b7c0a['query']);_0x791980['filters']=_[_0xd0af('0x2a')](_0x791980['model'],_0x791980[_0xd0af('0x2b')]);_0x3cc887[_0xd0af('0x2c')]=_[_0xd0af('0x2a')](_0x791980[_0xd0af('0x28')],qs[_0xd0af('0x2d')](_0x5b7c0a['query'][_0xd0af('0x2d')]));_0x3cc887[_0xd0af('0x2c')]=_0x3cc887[_0xd0af('0x2c')][_0xd0af('0x2e')]?_0x3cc887[_0xd0af('0x2c')]:_0x791980[_0xd0af('0x28')];if(!_0x5b7c0a[_0xd0af('0x2b')][_0xd0af('0x2f')](_0xd0af('0x30'))){_0x3cc887[_0xd0af('0x1e')]=qs[_0xd0af('0x1e')](_0x5b7c0a[_0xd0af('0x2b')][_0xd0af('0x1e')]);_0x3cc887[_0xd0af('0x1b')]=qs[_0xd0af('0x1b')](_0x5b7c0a[_0xd0af('0x2b')][_0xd0af('0x1b')]);}_0x3cc887['order']=qs['sort'](_0x5b7c0a['query'][_0xd0af('0x31')]);_0x3cc887[_0xd0af('0x32')]=qs[_0xd0af('0x33')](_[_0xd0af('0x34')](_0x5b7c0a['query'],_0x791980[_0xd0af('0x33')]),_0x2b4ce6);if(_0x5b7c0a[_0xd0af('0x2b')][_0xd0af('0x35')]){_0x3cc887[_0xd0af('0x32')]=_[_0xd0af('0x36')](_0x3cc887[_0xd0af('0x32')],{'$or':_[_0xd0af('0x29')](_0x2b4ce6,function(_0x113b79){if(_0x113b79[_0xd0af('0x27')]!==_0xd0af('0x37')){var _0x17710b={};_0x17710b[_0x113b79[_0xd0af('0x24')]]={'$like':'%'+_0x5b7c0a[_0xd0af('0x2b')]['filter']+'%'};return _0x17710b;}})});}_0x3cc887=_[_0xd0af('0x36')]({},_0x3cc887,_0x5b7c0a[_0xd0af('0x38')]);var _0x8b39b8={'where':_0x3cc887[_0xd0af('0x32')]};return db[_0xd0af('0x39')][_0xd0af('0x1d')](_0x8b39b8)[_0xd0af('0x22')](function(_0x1da49b){_0x46e089[_0xd0af('0x1d')]=_0x1da49b;if(_0x5b7c0a[_0xd0af('0x2b')]['includeAll']){_0x3cc887[_0xd0af('0x3a')]=[{'all':!![]}];}return db[_0xd0af('0x39')][_0xd0af('0x3b')](_0x3cc887);})['then'](function(_0x4676b4){_0x46e089[_0xd0af('0x3c')]=_0x4676b4;return _0x46e089;})[_0xd0af('0x22')](respondWithFilteredResult(_0x1ccf1b,_0x3cc887))['catch'](handleError(_0x1ccf1b,null));};exports[_0xd0af('0x3d')]=function(_0x2fa041,_0x2eecb1){var _0x1025ef={'raw':!![],'where':{'id':_0x2fa041[_0xd0af('0x3e')]['id']}},_0x58b57a={};_0x58b57a['model']=_[_0xd0af('0x3f')](db[_0xd0af('0x39')][_0xd0af('0x26')]);_0x58b57a['query']=_['keys'](_0x2fa041[_0xd0af('0x2b')]);_0x58b57a['filters']=_[_0xd0af('0x2a')](_0x58b57a[_0xd0af('0x28')],_0x58b57a['query']);_0x1025ef[_0xd0af('0x2c')]=_['intersection'](_0x58b57a[_0xd0af('0x28')],qs['fields'](_0x2fa041['query']['fields']));_0x1025ef[_0xd0af('0x2c')]=_0x1025ef[_0xd0af('0x2c')][_0xd0af('0x2e')]?_0x1025ef[_0xd0af('0x2c')]:_0x58b57a[_0xd0af('0x28')];if(_0x2fa041[_0xd0af('0x2b')][_0xd0af('0x40')]){_0x1025ef['include']=[{'all':!![]}];}_0x1025ef=_[_0xd0af('0x36')]({},_0x1025ef,_0x2fa041['options']);return db[_0xd0af('0x39')]['find'](_0x1025ef)[_0xd0af('0x22')](handleEntityNotFound(_0x2eecb1,null))[_0xd0af('0x22')](respondWithResult(_0x2eecb1,null))[_0xd0af('0x41')](handleError(_0x2eecb1,null));};exports[_0xd0af('0x42')]=function(_0x281836,_0x2aee12){return db[_0xd0af('0x39')]['create'](_0x281836['body'],{})[_0xd0af('0x22')](respondWithResult(_0x2aee12,0xc9))['catch'](handleError(_0x2aee12,null));};exports[_0xd0af('0x43')]=function(_0x5e823b,_0x537803){if(_0x5e823b[_0xd0af('0x44')]['id']){delete _0x5e823b[_0xd0af('0x44')]['id'];}return db[_0xd0af('0x39')]['find']({'where':{'id':_0x5e823b[_0xd0af('0x3e')]['id']}})[_0xd0af('0x22')](handleEntityNotFound(_0x537803,null))[_0xd0af('0x22')](saveUpdates(_0x5e823b[_0xd0af('0x44')],null))['then'](respondWithResult(_0x537803,null))[_0xd0af('0x41')](handleError(_0x537803,null));};exports['destroy']=function(_0x7ceb58,_0x383236){return db[_0xd0af('0x39')]['find']({'where':{'id':_0x7ceb58[_0xd0af('0x3e')]['id']}})[_0xd0af('0x22')](handleEntityNotFound(_0x383236,null))[_0xd0af('0x22')](removeEntity(_0x383236,null))[_0xd0af('0x41')](handleError(_0x383236,null));};exports[_0xd0af('0x45')]=function(_0x3f3da8,_0x397bbc){return db[_0xd0af('0x39')][_0xd0af('0x45')]()[_0xd0af('0x22')](respondWithResult(_0x397bbc,null))[_0xd0af('0x41')](handleError(_0x397bbc,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 32e4d62..db7de57 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 _0x4c9c=['../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3b87f4,_0x112243){var _0x63d16e=function(_0x3e7323){while(--_0x3e7323){_0x3b87f4['push'](_0x3b87f4['shift']());}};_0x63d16e(++_0x112243);}(_0x4c9c,0x180));var _0xc4c9=function(_0x1c2aeb,_0x48433c){_0x1c2aeb=_0x1c2aeb-0x0;var _0x783379=_0x4c9c[_0x1c2aeb];return _0x783379;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc4c9('0x0'))(_0xc4c9('0x1'));var moment=require(_0xc4c9('0x2'));var BPromise=require(_0xc4c9('0x3'));var rp=require(_0xc4c9('0x4'));var fs=require('fs');var path=require(_0xc4c9('0x5'));var rimraf=require('rimraf');var config=require(_0xc4c9('0x6'));var attributes=require(_0xc4c9('0x7'));module[_0xc4c9('0x8')]=function(_0x14274b,_0x419741){return _0x14274b[_0xc4c9('0x9')](_0xc4c9('0xa'),attributes,{'tableName':_0xc4c9('0xb'),'paranoid':![],'indexes':[{'fields':[_0xc4c9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2036=['../../config/environment','./voiceDialReport.attributes','exports','define','report_dial','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x594d34,_0x4eaa08){var _0x56e972=function(_0x4870ae){while(--_0x4870ae){_0x594d34['push'](_0x594d34['shift']());}};_0x56e972(++_0x4eaa08);}(_0x2036,0x11e));var _0x6203=function(_0xc2c13a,_0x1070d3){_0xc2c13a=_0xc2c13a-0x0;var _0x2b8e2f=_0x2036[_0xc2c13a];return _0x2b8e2f;};'use strict';var _=require(_0x6203('0x0'));var util=require('util');var logger=require(_0x6203('0x1'))(_0x6203('0x2'));var moment=require(_0x6203('0x3'));var BPromise=require(_0x6203('0x4'));var rp=require(_0x6203('0x5'));var fs=require('fs');var path=require(_0x6203('0x6'));var rimraf=require(_0x6203('0x7'));var config=require(_0x6203('0x8'));var attributes=require(_0x6203('0x9'));module[_0x6203('0xa')]=function(_0x25e4f6,_0x44aa30){return _0x25e4f6[_0x6203('0xb')]('VoiceDialReport',attributes,{'tableName':_0x6203('0xc'),'paranoid':![],'indexes':[{'fields':[_0x6203('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 2d25a74..ad5ee66 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 _0xcbb6=['result','catch','CreateVoiceDialReport','create','body','options','then','UpdateVoiceDialReport','VoiceDialReport','update','raw','attributes','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xcbb6,0xd2));var _0x6cbb=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xcbb6[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x6cbb('0x0'));var util=require(_0x6cbb('0x1'));var moment=require('moment');var BPromise=require(_0x6cbb('0x2'));var rs=require(_0x6cbb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6cbb('0x4'))['db'];var utils=require(_0x6cbb('0x5'));var logger=require(_0x6cbb('0x6'))(_0x6cbb('0x7'));var config=require(_0x6cbb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6cbb('0x9')][_0x6cbb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50d370,_0x4abe3f,_0x1c92f8){return new BPromise(function(_0x379149,_0x32b7c7){return client[_0x6cbb('0xb')](_0x50d370,_0x1c92f8)['then'](function(_0x3330ac){logger['info'](_0x6cbb('0xc'),_0x4abe3f,'request\x20sent');logger[_0x6cbb('0xd')](_0x6cbb('0xe'),_0x4abe3f,_0x6cbb('0xf'),JSON[_0x6cbb('0x10')](_0x3330ac));if(_0x3330ac[_0x6cbb('0x11')]){if(_0x3330ac[_0x6cbb('0x11')][_0x6cbb('0x12')]===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x4abe3f,_0x3330ac[_0x6cbb('0x11')]['message']);return _0x32b7c7(_0x3330ac[_0x6cbb('0x11')][_0x6cbb('0x13')]);}logger[_0x6cbb('0x11')](_0x6cbb('0xc'),_0x4abe3f,_0x3330ac[_0x6cbb('0x11')][_0x6cbb('0x13')]);return _0x379149(_0x3330ac[_0x6cbb('0x11')]['message']);}else{logger[_0x6cbb('0x14')](_0x6cbb('0xc'),_0x4abe3f,_0x6cbb('0xf'));_0x379149(_0x3330ac[_0x6cbb('0x15')][_0x6cbb('0x13')]);}})[_0x6cbb('0x16')](function(_0x36d83e){logger[_0x6cbb('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x4abe3f,_0x36d83e);_0x32b7c7(_0x36d83e);});});}exports[_0x6cbb('0x17')]=function(_0x1073ac){var _0x338e85=this;return new Promise(function(_0x3931a2,_0x5144cb){return db['VoiceDialReport'][_0x6cbb('0x18')](_0x1073ac[_0x6cbb('0x19')],{'raw':_0x1073ac[_0x6cbb('0x1a')]?_0x1073ac[_0x6cbb('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x6cbb('0x1b')](function(_0x4fea4e){logger['info']('CreateVoiceDialReport',_0x1073ac);logger[_0x6cbb('0xd')](_0x6cbb('0x17'),_0x1073ac,JSON[_0x6cbb('0x10')](_0x4fea4e));_0x3931a2(_0x4fea4e);})[_0x6cbb('0x16')](function(_0x456e9c){logger[_0x6cbb('0x11')]('CreateVoiceDialReport',_0x456e9c['message'],_0x1073ac);_0x5144cb(_0x338e85[_0x6cbb('0x11')](0x1f4,_0x456e9c[_0x6cbb('0x13')]));});});};exports[_0x6cbb('0x1c')]=function(_0x4f9253){var _0x5c2454=this;return new Promise(function(_0x4e56e6,_0x55c568){return db[_0x6cbb('0x1d')][_0x6cbb('0x1e')](_0x4f9253['body'],{'raw':_0x4f9253['options']?_0x4f9253[_0x6cbb('0x1a')][_0x6cbb('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f9253[_0x6cbb('0x1a')]?_0x4f9253[_0x6cbb('0x1a')]['where']||null:null,'attributes':_0x4f9253[_0x6cbb('0x1a')]?_0x4f9253['options'][_0x6cbb('0x20')]||null:null,'limit':_0x4f9253['options']?_0x4f9253['options']['limit']||null:null})[_0x6cbb('0x1b')](function(_0x5f52a0){logger['info'](_0x6cbb('0x1c'),_0x4f9253);logger[_0x6cbb('0xd')](_0x6cbb('0x1c'),_0x4f9253,JSON['stringify'](_0x5f52a0));_0x4e56e6(_0x5f52a0);})[_0x6cbb('0x16')](function(_0x4b3990){logger['error']('UpdateVoiceDialReport',_0x4b3990[_0x6cbb('0x13')],_0x4f9253);_0x55c568(_0x5c2454['error'](0x1f4,_0x4b3990[_0x6cbb('0x13')]));});});}; \ No newline at end of file +var _0x608a=['error','message','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','catch','UpdateVoiceDialReport','update','attributes','limit','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s'];(function(_0x8a5694,_0x42e4af){var _0x4b11bd=function(_0x2a1336){while(--_0x2a1336){_0x8a5694['push'](_0x8a5694['shift']());}};_0x4b11bd(++_0x42e4af);}(_0x608a,0x18f));var _0xa608=function(_0x18bf71,_0x29dfd0){_0x18bf71=_0x18bf71-0x0;var _0x928504=_0x608a[_0x18bf71];return _0x928504;};'use strict';var _=require(_0xa608('0x0'));var util=require('util');var moment=require(_0xa608('0x1'));var BPromise=require(_0xa608('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa608('0x3'));var db=require(_0xa608('0x4'))['db'];var utils=require(_0xa608('0x5'));var logger=require('../../config/logger')(_0xa608('0x6'));var config=require(_0xa608('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa608('0x8')][_0xa608('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52d9a1,_0x1a2c2f,_0x2d3e14){return new BPromise(function(_0x4417c7,_0x170824){return client[_0xa608('0xa')](_0x52d9a1,_0x2d3e14)[_0xa608('0xb')](function(_0x28ecdc){logger[_0xa608('0xc')](_0xa608('0xd'),_0x1a2c2f,_0xa608('0xe'));logger[_0xa608('0xf')](_0xa608('0x10'),_0x1a2c2f,_0xa608('0xe'),JSON['stringify'](_0x28ecdc));if(_0x28ecdc[_0xa608('0x11')]){if(_0x28ecdc[_0xa608('0x11')]['code']===0x1f4){logger[_0xa608('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x1a2c2f,_0x28ecdc['error'][_0xa608('0x12')]);return _0x170824(_0x28ecdc[_0xa608('0x11')]['message']);}logger[_0xa608('0x11')](_0xa608('0xd'),_0x1a2c2f,_0x28ecdc['error']['message']);return _0x4417c7(_0x28ecdc[_0xa608('0x11')][_0xa608('0x12')]);}else{logger['info'](_0xa608('0xd'),_0x1a2c2f,_0xa608('0xe'));_0x4417c7(_0x28ecdc[_0xa608('0x13')][_0xa608('0x12')]);}})['catch'](function(_0x3cb038){logger[_0xa608('0x11')](_0xa608('0xd'),_0x1a2c2f,_0x3cb038);_0x170824(_0x3cb038);});});}exports[_0xa608('0x14')]=function(_0x1fb69d){var _0x4ff6cf=this;return new Promise(function(_0x103818,_0x546ad9){return db[_0xa608('0x15')][_0xa608('0x16')](_0x1fb69d[_0xa608('0x17')],{'raw':_0x1fb69d[_0xa608('0x18')]?_0x1fb69d['options'][_0xa608('0x19')]===undefined?!![]:![]:!![]})[_0xa608('0xb')](function(_0x51dd5e){logger[_0xa608('0xc')]('CreateVoiceDialReport',_0x1fb69d);logger[_0xa608('0xf')](_0xa608('0x14'),_0x1fb69d,JSON['stringify'](_0x51dd5e));_0x103818(_0x51dd5e);})[_0xa608('0x1a')](function(_0x26dfac){logger['error'](_0xa608('0x14'),_0x26dfac[_0xa608('0x12')],_0x1fb69d);_0x546ad9(_0x4ff6cf[_0xa608('0x11')](0x1f4,_0x26dfac[_0xa608('0x12')]));});});};exports[_0xa608('0x1b')]=function(_0x22b679){var _0x57117d=this;return new Promise(function(_0x49f318,_0x91e548){return db[_0xa608('0x15')][_0xa608('0x1c')](_0x22b679['body'],{'raw':_0x22b679[_0xa608('0x18')]?_0x22b679['options'][_0xa608('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22b679[_0xa608('0x18')]?_0x22b679[_0xa608('0x18')]['where']||null:null,'attributes':_0x22b679[_0xa608('0x18')]?_0x22b679['options'][_0xa608('0x1d')]||null:null,'limit':_0x22b679['options']?_0x22b679[_0xa608('0x18')][_0xa608('0x1e')]||null:null})[_0xa608('0xb')](function(_0x595062){logger['info'](_0xa608('0x1b'),_0x22b679);logger[_0xa608('0xf')](_0xa608('0x1b'),_0x22b679,JSON[_0xa608('0x1f')](_0x595062));_0x49f318(_0x595062);})[_0xa608('0x1a')](function(_0x1138b6){logger[_0xa608('0x11')](_0xa608('0x1b'),_0x1138b6[_0xa608('0x12')],_0x22b679);_0x91e548(_0x57117d['error'](0x1f4,_0x1138b6[_0xa608('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 2ec637e..9e5501a 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 _0x55b8=['../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','post','create','/:id/applications','addApplications','put','update','delete','exports','multer','util','express','Router','fs-extra'];(function(_0x4bfcbe,_0x4630f5){var _0x5b65e6=function(_0x5dcfc8){while(--_0x5dcfc8){_0x4bfcbe['push'](_0x4bfcbe['shift']());}};_0x5b65e6(++_0x4630f5);}(_0x55b8,0x1e9));var _0x855b=function(_0x1ea516,_0x54d276){_0x1ea516=_0x1ea516-0x0;var _0x3763ac=_0x55b8[_0x1ea516];return _0x3763ac;};'use strict';var multer=require(_0x855b('0x0'));var util=require(_0x855b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x855b('0x2'));var router=express[_0x855b('0x3')]();var fs_extra=require(_0x855b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x855b('0x5'));var config=require('../../config/environment');var controller=require(_0x855b('0x6'));router[_0x855b('0x7')]('/',auth[_0x855b('0x8')](),controller[_0x855b('0x9')]);router[_0x855b('0x7')](_0x855b('0xa'),auth[_0x855b('0x8')](),controller['show']);router[_0x855b('0xb')]('/',auth[_0x855b('0x8')](),controller[_0x855b('0xc')]);router[_0x855b('0xb')](_0x855b('0xd'),auth['isAuthenticated'](),controller[_0x855b('0xe')]);router[_0x855b('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x855b('0x10')]);router[_0x855b('0x11')](_0x855b('0xa'),auth[_0x855b('0x8')](),controller['destroy']);module[_0x855b('0x12')]=router; \ No newline at end of file +var _0xdf9e=['/:id','show','post','/:id/applications','addApplications','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceExtension.controller','get','isAuthenticated','index'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xdf9e,0x105));var _0xedf9=function(_0x1f151a,_0x5d1eee){_0x1f151a=_0x1f151a-0x0;var _0x2caede=_0xdf9e[_0x1f151a];return _0x2caede;};'use strict';var multer=require(_0xedf9('0x0'));var util=require(_0xedf9('0x1'));var path=require(_0xedf9('0x2'));var timeout=require(_0xedf9('0x3'));var express=require(_0xedf9('0x4'));var router=express[_0xedf9('0x5')]();var fs_extra=require(_0xedf9('0x6'));var auth=require(_0xedf9('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xedf9('0x8'));router[_0xedf9('0x9')]('/',auth[_0xedf9('0xa')](),controller[_0xedf9('0xb')]);router[_0xedf9('0x9')](_0xedf9('0xc'),auth[_0xedf9('0xa')](),controller[_0xedf9('0xd')]);router[_0xedf9('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xedf9('0xe')](_0xedf9('0xf'),auth[_0xedf9('0xa')](),controller[_0xedf9('0x10')]);router[_0xedf9('0x11')](_0xedf9('0xc'),auth[_0xedf9('0xa')](),controller[_0xedf9('0x12')]);router[_0xedf9('0x13')](_0xedf9('0xc'),auth['isAuthenticated'](),controller[_0xedf9('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 40f3eb4..1c336f0 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 _0x6deb=['wav','BOOLEAN','VIRTUAL','getDataValue','sequelize','exports','compositeIndex','STRING','NoOp','ENUM','inbound','outbound','internal','outbound-fax','any','*,*,*,*','INTEGER'];(function(_0x3d0a6e,_0x39b4bc){var _0x34b8bd=function(_0x3721d6){while(--_0x3721d6){_0x3d0a6e['push'](_0x3d0a6e['shift']());}};_0x34b8bd(++_0x39b4bc);}(_0x6deb,0x169));var _0xb6de=function(_0x3a6841,_0x1d761f){_0x3a6841=_0x3a6841-0x0;var _0x29d1ba=_0x6deb[_0x3a6841];return _0x29d1ba;};'use strict';var Sequelize=require(_0xb6de('0x0'));module[_0xb6de('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb6de('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xb6de('0x3')],'allowNull':![],'unique':_0xb6de('0x2')},'priority':{'type':Sequelize[_0xb6de('0x3')],'allowNull':![],'defaultValue':'1','unique':_0xb6de('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xb6de('0x3')],'allowNull':![],'defaultValue':_0xb6de('0x4')},'appdata':{'type':Sequelize[_0xb6de('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xb6de('0x5')](_0xb6de('0x6'),_0xb6de('0x7'),_0xb6de('0x8'),'inbound-fax',_0xb6de('0x9'),'system',_0xb6de('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xb6de('0x3')]},'interval':{'type':Sequelize[_0xb6de('0x3')],'allowNull':![],'defaultValue':_0xb6de('0xb')},'IntervalId':{'type':Sequelize[_0xb6de('0xc')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xb6de('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0xb6de('0x3')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0xb6de('0x3')],'defaultValue':_0xb6de('0xd')},'answer':{'type':Sequelize[_0xb6de('0xe')],'defaultValue':!![]},'name':{'type':Sequelize[_0xb6de('0xf')],'get':function(_0x3c0bce){return this[_0xb6de('0x10')]('exten');}},'alias':{'type':Sequelize[_0xb6de('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0xd8f4=['compositeIndex','STRING','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','any','INTEGER','BOOLEAN','VIRTUAL','exten','sequelize','exports'];(function(_0x5938c8,_0x4a9ca){var _0x4353f7=function(_0x50764f){while(--_0x50764f){_0x5938c8['push'](_0x5938c8['shift']());}};_0x4353f7(++_0x4a9ca);}(_0xd8f4,0xce));var _0x4d8f=function(_0x4c649f,_0x2b376e){_0x4c649f=_0x4c649f-0x0;var _0x4afc6f=_0xd8f4[_0x4c649f];return _0x4afc6f;};'use strict';var Sequelize=require(_0x4d8f('0x0'));module[_0x4d8f('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4d8f('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4d8f('0x2')},'priority':{'type':Sequelize[_0x4d8f('0x3')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x4d8f('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x4d8f('0x3')],'allowNull':![],'defaultValue':_0x4d8f('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x4d8f('0x5')](_0x4d8f('0x6'),_0x4d8f('0x7'),_0x4d8f('0x8'),_0x4d8f('0x9'),_0x4d8f('0xa'),'system',_0x4d8f('0xb')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x4d8f('0xc')]},'isApp':{'type':Sequelize[_0x4d8f('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x4d8f('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0x4d8f('0x3')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x4d8f('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x4d8f('0xe')],'get':function(_0x353e79){return this['getDataValue'](_0x4d8f('0xf'));}},'alias':{'type':Sequelize[_0x4d8f('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 0493eb6..a57a89d 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 _0x19a3=['./voiceExtension.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','destroy','then','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','fields','length','include','create','body','exten','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','internal','UserProfileSection','userProfileId','autoAssociation','update','context','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','ISOLATION_LEVELS','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x4aef32,_0x5f5774){var _0x5dad25=function(_0x45810e){while(--_0x45810e){_0x4aef32['push'](_0x4aef32['shift']());}};_0x5dad25(++_0x5f5774);}(_0x19a3,0xb2));var _0x319a=function(_0x5f5be8,_0x56cc02){_0x5f5be8=_0x5f5be8-0x0;var _0x5a9a36=_0x19a3[_0x5f5be8];return _0x5a9a36;};'use strict';var _=require('lodash');var Redis=require(_0x319a('0x0'));var qs=require(_0x319a('0x1'));var logger=require(_0x319a('0x2'))(_0x319a('0x3'));var config=require(_0x319a('0x4'));var db=require(_0x319a('0x5'))['db'];config[_0x319a('0x6')]=_[_0x319a('0x7')](config['redis'],{'host':_0x319a('0x8'),'port':0x18eb});var socket=require(_0x319a('0x9'))(new Redis(config[_0x319a('0x6')]));require(_0x319a('0xa'))[_0x319a('0xb')](socket);function respondWithStatusCode(_0x2ff930,_0x3ddea6){_0x3ddea6=_0x3ddea6||0xcc;return function(_0x4cea95){if(_0x4cea95){return _0x2ff930['sendStatus'](_0x3ddea6);}return _0x2ff930[_0x319a('0xc')](_0x3ddea6)[_0x319a('0xd')]();};}function respondWithResult(_0x55a3cc,_0xbdb0e){_0xbdb0e=_0xbdb0e||0xc8;return function(_0x4d6452){if(_0x4d6452){return _0x55a3cc[_0x319a('0xc')](_0xbdb0e)[_0x319a('0xe')](_0x4d6452);}};}function respondWithFilteredResult(_0x15f862,_0xc0c414){return function(_0x50a6cf){if(_0x50a6cf){var _0x2c082f=typeof _0xc0c414[_0x319a('0xf')]===_0x319a('0x10')&&typeof _0xc0c414['limit']==='undefined';var _0x53f897=_0x50a6cf[_0x319a('0x11')];var _0x2ce914=_0x2c082f?0x0:_0xc0c414['offset'];var _0x5bfda9=_0x2c082f?_0x50a6cf[_0x319a('0x11')]:_0xc0c414[_0x319a('0xf')]+_0xc0c414[_0x319a('0x12')];var _0x23cf9a;if(_0x5bfda9>=_0x53f897){_0x5bfda9=_0x53f897;_0x23cf9a=0xc8;}else{_0x23cf9a=0xce;}_0x15f862['status'](_0x23cf9a);return _0x15f862[_0x319a('0x13')](_0x319a('0x14'),_0x2ce914+'-'+_0x5bfda9+'/'+_0x53f897)[_0x319a('0xe')](_0x50a6cf);}return null;};}function removeEntity(_0x3c3ae6){return function(_0x1b48b1){if(_0x1b48b1){return _0x1b48b1[_0x319a('0x15')]()[_0x319a('0x16')](function(){var _0xe75b27=_0x1b48b1['get']({'plain':!![]});var _0x201e4d=[{'name':'InboundRoutes','value':_0x319a('0x17'),'ignore':![]},{'name':_0x319a('0x18'),'value':_0x319a('0x19'),'ignore':![]},{'name':_0x319a('0x1a'),'value':'internal','ignore':![]}];var _0x19d934=_(_0x201e4d)[_0x319a('0x1b')](_0x319a('0x1c'))[_0x319a('0x1d')](_0x319a('0x1e'))['value']();if(_[_0x319a('0x1f')](_0x19d934,_0xe75b27[_0x319a('0x20')])){return;}var _0x4152ce=_[_0x319a('0x21')](_0x201e4d,[_0x319a('0x1e'),_0xe75b27[_0x319a('0x20')]])[_0x319a('0x22')];return db[_0x319a('0x23')][_0x319a('0x15')]({'where':{'type':_0x4152ce,'resourceId':_0xe75b27['id']}})[_0x319a('0x16')](function(){return _0x1b48b1;});})[_0x319a('0x16')](function(){_0x3c3ae6['status'](0xcc)[_0x319a('0xd')]();});}};}function handleEntityNotFound(_0x36fe08){return function(_0xa509f2){if(!_0xa509f2){_0x36fe08['sendStatus'](0x194);}return _0xa509f2;};}function handleError(_0x26bc17,_0x3d82a2){_0x3d82a2=_0x3d82a2||0x1f4;return function(_0x50ff28){logger[_0x319a('0x24')](_0x50ff28[_0x319a('0x25')]);if(_0x50ff28[_0x319a('0x22')]){delete _0x50ff28['name'];}_0x26bc17[_0x319a('0xc')](_0x3d82a2)[_0x319a('0x26')](_0x50ff28);};}exports[_0x319a('0x27')]=function(_0x164378,_0x151db9){var _0x4dc0ec={},_0x324b29={},_0x41d458={'count':0x0,'rows':[]};var _0x252933=_[_0x319a('0x1d')](db[_0x319a('0x28')][_0x319a('0x29')],function(_0x2ee993){return{'name':_0x2ee993[_0x319a('0x2a')],'type':_0x2ee993[_0x319a('0x20')][_0x319a('0x2b')]};});_0x324b29[_0x319a('0x2c')]=_['map'](_0x252933,_0x319a('0x22'));_0x324b29[_0x319a('0x2d')]=_[_0x319a('0x2e')](_0x164378[_0x319a('0x2d')]);_0x324b29[_0x319a('0x2f')]=_['intersection'](_0x324b29[_0x319a('0x2c')],_0x324b29[_0x319a('0x2d')]);_0x4dc0ec[_0x319a('0x30')]=_[_0x319a('0x31')](_0x324b29[_0x319a('0x2c')],qs['fields'](_0x164378[_0x319a('0x2d')]['fields']));_0x4dc0ec[_0x319a('0x30')]=_0x4dc0ec[_0x319a('0x30')]['length']?_0x4dc0ec[_0x319a('0x30')]:_0x324b29['model'];if(!_0x164378[_0x319a('0x2d')]['hasOwnProperty'](_0x319a('0x32'))){_0x4dc0ec[_0x319a('0x12')]=qs[_0x319a('0x12')](_0x164378[_0x319a('0x2d')][_0x319a('0x12')]);_0x4dc0ec[_0x319a('0xf')]=qs[_0x319a('0xf')](_0x164378['query'][_0x319a('0xf')]);}_0x4dc0ec['order']=qs[_0x319a('0x33')](_0x164378[_0x319a('0x2d')]['sort']);_0x4dc0ec[_0x319a('0x34')]=qs['filters'](_[_0x319a('0x35')](_0x164378[_0x319a('0x2d')],_0x324b29[_0x319a('0x2f')]),_0x252933);if(_0x164378[_0x319a('0x2d')][_0x319a('0x1b')]){_0x4dc0ec[_0x319a('0x34')]=_[_0x319a('0x36')](_0x4dc0ec[_0x319a('0x34')],{'$or':_[_0x319a('0x1d')](_0x252933,function(_0x19d827){if(_0x19d827[_0x319a('0x20')]!==_0x319a('0x37')){var _0x289857={};_0x289857[_0x19d827['name']]={'$like':'%'+_0x164378[_0x319a('0x2d')][_0x319a('0x1b')]+'%'};return _0x289857;}})});}_0x4dc0ec=_[_0x319a('0x36')]({},_0x4dc0ec,_0x164378[_0x319a('0x38')]);var _0x3bf62e={'where':_0x4dc0ec['where']};return db[_0x319a('0x28')][_0x319a('0x11')](_0x3bf62e)[_0x319a('0x16')](function(_0x5346da){_0x41d458[_0x319a('0x11')]=_0x5346da;if(_0x164378[_0x319a('0x2d')][_0x319a('0x39')]){_0x4dc0ec['include']=[{'all':!![]}];}return db['VoiceExtension'][_0x319a('0x3a')](_0x4dc0ec);})[_0x319a('0x16')](function(_0x172f6f){_0x41d458[_0x319a('0x3b')]=_0x172f6f;return _0x41d458;})[_0x319a('0x16')](respondWithFilteredResult(_0x151db9,_0x4dc0ec))[_0x319a('0x3c')](handleError(_0x151db9,null));};exports[_0x319a('0x3d')]=function(_0x4e6f5a,_0x4bf425){var _0x1949f1={'raw':![],'where':{'id':_0x4e6f5a[_0x319a('0x3e')]['id']}},_0x1863f1={};_0x1863f1[_0x319a('0x2c')]=_[_0x319a('0x2e')](db[_0x319a('0x28')][_0x319a('0x29')]);_0x1863f1['query']=_[_0x319a('0x2e')](_0x4e6f5a[_0x319a('0x2d')]);_0x1863f1['filters']=_[_0x319a('0x31')](_0x1863f1[_0x319a('0x2c')],_0x1863f1[_0x319a('0x2d')]);_0x1949f1[_0x319a('0x30')]=_[_0x319a('0x31')](_0x1863f1['model'],qs[_0x319a('0x3f')](_0x4e6f5a[_0x319a('0x2d')][_0x319a('0x3f')]));_0x1949f1[_0x319a('0x30')]=_0x1949f1[_0x319a('0x30')][_0x319a('0x40')]?_0x1949f1[_0x319a('0x30')]:_0x1863f1['model'];if(_0x4e6f5a[_0x319a('0x2d')][_0x319a('0x39')]){_0x1949f1[_0x319a('0x41')]=[{'all':!![]}];}_0x1949f1=_[_0x319a('0x36')]({},_0x1949f1,_0x4e6f5a['options']);return db[_0x319a('0x28')][_0x319a('0x21')](_0x1949f1)[_0x319a('0x16')](handleEntityNotFound(_0x4bf425,null))['then'](respondWithResult(_0x4bf425,null))[_0x319a('0x3c')](handleError(_0x4bf425,null));};exports[_0x319a('0x15')]=function(_0x50efed,_0x476447){return db['VoiceExtension'][_0x319a('0x21')]({'where':{'id':_0x50efed['params']['id']}})[_0x319a('0x16')](handleEntityNotFound(_0x476447,null))['then'](removeEntity(_0x476447,null))['catch'](handleError(_0x476447,null));};exports[_0x319a('0x42')]=function(_0x2b0125,_0x2359cd){if(_0x2b0125['body']['type']===_0x319a('0x19')&&!_['startsWith'](_0x2b0125[_0x319a('0x43')]['exten'],'_')){_0x2b0125[_0x319a('0x43')]['exten']='_'['concat'](_0x2b0125[_0x319a('0x43')][_0x319a('0x44')]);}return db['VoiceExtension'][_0x319a('0x42')](_0x2b0125[_0x319a('0x43')],{'raw':![]})[_0x319a('0x16')](function(_0x4993c7){var _0x495238=_0x2b0125[_0x319a('0x45')][_0x319a('0x46')]({'plain':!![]});if(!_0x495238)throw new Error(_0x319a('0x47'));if(_0x495238[_0x319a('0x48')]===_0x319a('0x45')){var _0x21b924=_0x4993c7[_0x319a('0x46')]({'plain':!![]});var _0x26bd42=[{'name':_0x319a('0x49'),'value':'inbound'},{'name':'OutboundRoutes','value':_0x319a('0x19')},{'name':_0x319a('0x1a'),'value':_0x319a('0x4a')}];var _0x4456b8=_['find'](_0x26bd42,['value',_0x21b924['type']])['name'];return db[_0x319a('0x4b')][_0x319a('0x21')]({'where':{'name':_0x4456b8,'userProfileId':_0x495238[_0x319a('0x4c')]},'raw':!![]})[_0x319a('0x16')](function(_0x3bb5c1){if(_0x3bb5c1&&_0x3bb5c1[_0x319a('0x4d')]===0x0){return db[_0x319a('0x23')][_0x319a('0x42')]({'name':_0x21b924['name'],'resourceId':_0x21b924['id'],'type':_0x3bb5c1['name'],'sectionId':_0x3bb5c1['id']},{})['then'](function(){return _0x4993c7;});}else{return _0x4993c7;}})['catch'](function(_0x1df570){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1df570);throw _0x1df570;});}return _0x4993c7;})['then'](respondWithResult(_0x2359cd,0xc9))['catch'](handleError(_0x2359cd,null));};exports[_0x319a('0x4e')]=function(_0x3d9087,_0x361574){if(_0x3d9087[_0x319a('0x43')]['id']){delete _0x3d9087['body']['id'];}return db[_0x319a('0x28')][_0x319a('0x21')]({'where':{'id':_0x3d9087[_0x319a('0x3e')]['id']}})[_0x319a('0x16')](handleEntityNotFound(_0x361574,null))['then'](function(_0x19cc81){if(_0x19cc81){return db[_0x319a('0x28')][_0x319a('0x4e')](_[_0x319a('0x35')](_0x3d9087[_0x319a('0x43')],['exten',_0x319a('0x4f'),'description',_0x319a('0x50'),_0x319a('0x51'),_0x319a('0x52'),_0x319a('0x53')]),{'where':{'context':_0x19cc81[_0x319a('0x4f')],'exten':_0x19cc81['exten']},'individualHooks':!![]})[_0x319a('0x16')](function(_0xfef87d){return _0xfef87d;});}return null;})['then'](respondWithStatusCode(_0x361574,null))[_0x319a('0x3c')](handleError(_0x361574,null));};exports[_0x319a('0x54')]=function(_0x3250df,_0x114a46){var _0x52f9de=_0x3250df[_0x319a('0x3e')]['id'];var _0x3e07ef=_0x3250df['body'];var _0x5664bb=0xc8;var _0x2d813c=null;return db[_0x319a('0x55')]['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0x319a('0x56')]['READ_COMMITTED']},function(_0x17b183){return db['VoiceExtension']['findOne']({'where':{'id':_0x52f9de},'transaction':_0x17b183})[_0x319a('0x16')](function(_0x19590e){if(_0x19590e){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x52f9de},'transaction':_0x17b183})[_0x319a('0x16')](function(){var _0x252faf=_['map'](_0x3e07ef,function(_0x4e6fcc){_0x4e6fcc[_0x319a('0x57')]=_0x52f9de;_0x4e6fcc[_0x319a('0x58')]=!![];return _0x4e6fcc;});return _0x19590e[_0x319a('0x59')](_0x252faf);})[_0x319a('0x16')](function(_0x3e6166){return db[_0x319a('0x28')][_0x319a('0x5a')](_0x3e6166,{'transaction':_0x17b183});});}else{_0x5664bb=0x194;_0x2d813c=[];}});})['then'](function(){if(_0x5664bb!==0x194){return db['VoiceExtension'][_0x319a('0x5b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x52f9de},'order':_0x319a('0x5c')})[_0x319a('0x16')](function(_0xb05b99){_0x2d813c=_0xb05b99;});}})[_0x319a('0x3c')](function(_0x103d76){_0x5664bb=0x1f4;logger[_0x319a('0x24')](_0x103d76[_0x319a('0x25')]);if(_0x103d76[_0x319a('0x22')]){delete _0x103d76[_0x319a('0x22')];}_0x2d813c=_0x103d76;})[_0x319a('0x5d')](function(){if(_0x2d813c===null){_0x114a46['sendStatus'](_0x5664bb);}else{if(_0x5664bb===0x1f4){_0x114a46[_0x319a('0xc')](_0x5664bb)[_0x319a('0x26')](_0x2d813c);}else{_0x114a46[_0x319a('0xc')](_0x5664bb)[_0x319a('0xe')](_0x2d813c);}}});}; \ No newline at end of file +var _0x9c78=['concat','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','find','type','UserProfileResource','error','stack','name','send','index','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','rawAttributes','includeAll','VoiceExtension','params','create','startsWith','body','exten'];(function(_0x4b92f4,_0x32a49a){var _0x4b2ca2=function(_0x5df795){while(--_0x5df795){_0x4b92f4['push'](_0x4b92f4['shift']());}};_0x4b2ca2(++_0x32a49a);}(_0x9c78,0x128));var _0x89c7=function(_0x134d50,_0x365a1a){_0x134d50=_0x134d50-0x0;var _0xa6399f=_0x9c78[_0x134d50];return _0xa6399f;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x89c7('0x0'));var logger=require(_0x89c7('0x1'))(_0x89c7('0x2'));var config=require('../../config/environment');var db=require(_0x89c7('0x3'))['db'];config[_0x89c7('0x4')]=_['defaults'](config[_0x89c7('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0x89c7('0x5'))(new Redis(config[_0x89c7('0x4')]));require(_0x89c7('0x6'))['register'](socket);function respondWithStatusCode(_0x36b7f8,_0x527e79){_0x527e79=_0x527e79||0xcc;return function(_0x1d7351){if(_0x1d7351){return _0x36b7f8[_0x89c7('0x7')](_0x527e79);}return _0x36b7f8[_0x89c7('0x8')](_0x527e79)[_0x89c7('0x9')]();};}function respondWithResult(_0x54dccc,_0x37092b){_0x37092b=_0x37092b||0xc8;return function(_0x4e77f1){if(_0x4e77f1){return _0x54dccc[_0x89c7('0x8')](_0x37092b)[_0x89c7('0xa')](_0x4e77f1);}};}function respondWithFilteredResult(_0x3bf77b,_0x2931d6){return function(_0x182e1c){if(_0x182e1c){var _0x46d977=typeof _0x2931d6[_0x89c7('0xb')]===_0x89c7('0xc')&&typeof _0x2931d6['limit']===_0x89c7('0xc');var _0x3bcb16=_0x182e1c[_0x89c7('0xd')];var _0x5dbf5d=_0x46d977?0x0:_0x2931d6['offset'];var _0x34fe1f=_0x46d977?_0x182e1c[_0x89c7('0xd')]:_0x2931d6[_0x89c7('0xb')]+_0x2931d6[_0x89c7('0xe')];var _0x31d295;if(_0x34fe1f>=_0x3bcb16){_0x34fe1f=_0x3bcb16;_0x31d295=0xc8;}else{_0x31d295=0xce;}_0x3bf77b[_0x89c7('0x8')](_0x31d295);return _0x3bf77b['set'](_0x89c7('0xf'),_0x5dbf5d+'-'+_0x34fe1f+'/'+_0x3bcb16)[_0x89c7('0xa')](_0x182e1c);}return null;};}function removeEntity(_0x4d9524){return function(_0x47bf74){if(_0x47bf74){return _0x47bf74[_0x89c7('0x10')]()[_0x89c7('0x11')](function(){var _0x67f6d4=_0x47bf74[_0x89c7('0x12')]({'plain':!![]});var _0x2681ee=[{'name':_0x89c7('0x13'),'value':_0x89c7('0x14'),'ignore':![]},{'name':_0x89c7('0x15'),'value':_0x89c7('0x16'),'ignore':![]},{'name':_0x89c7('0x17'),'value':_0x89c7('0x18'),'ignore':![]}];var _0x18b9ad=_(_0x2681ee)['filter'](_0x89c7('0x19'))[_0x89c7('0x1a')](_0x89c7('0x1b'))['value']();if(_[_0x89c7('0x1c')](_0x18b9ad,_0x67f6d4['type'])){return;}var _0x42dfa9=_[_0x89c7('0x1d')](_0x2681ee,[_0x89c7('0x1b'),_0x67f6d4[_0x89c7('0x1e')]])['name'];return db[_0x89c7('0x1f')][_0x89c7('0x10')]({'where':{'type':_0x42dfa9,'resourceId':_0x67f6d4['id']}})[_0x89c7('0x11')](function(){return _0x47bf74;});})['then'](function(){_0x4d9524[_0x89c7('0x8')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47476a){return function(_0xbb02ea){if(!_0xbb02ea){_0x47476a['sendStatus'](0x194);}return _0xbb02ea;};}function handleError(_0x427d02,_0x3718f2){_0x3718f2=_0x3718f2||0x1f4;return function(_0x21a3cf){logger[_0x89c7('0x20')](_0x21a3cf[_0x89c7('0x21')]);if(_0x21a3cf[_0x89c7('0x22')]){delete _0x21a3cf[_0x89c7('0x22')];}_0x427d02[_0x89c7('0x8')](_0x3718f2)[_0x89c7('0x23')](_0x21a3cf);};}exports[_0x89c7('0x24')]=function(_0x11afd2,_0x40ed23){var _0x2e0ecd={},_0x536b5c={},_0x211e43={'count':0x0,'rows':[]};var _0x5521e2=_[_0x89c7('0x1a')](db['VoiceExtension']['rawAttributes'],function(_0x418dc7){return{'name':_0x418dc7[_0x89c7('0x25')],'type':_0x418dc7[_0x89c7('0x1e')][_0x89c7('0x26')]};});_0x536b5c[_0x89c7('0x27')]=_['map'](_0x5521e2,_0x89c7('0x22'));_0x536b5c[_0x89c7('0x28')]=_[_0x89c7('0x29')](_0x11afd2[_0x89c7('0x28')]);_0x536b5c[_0x89c7('0x2a')]=_[_0x89c7('0x2b')](_0x536b5c['model'],_0x536b5c[_0x89c7('0x28')]);_0x2e0ecd[_0x89c7('0x2c')]=_[_0x89c7('0x2b')](_0x536b5c[_0x89c7('0x27')],qs[_0x89c7('0x2d')](_0x11afd2[_0x89c7('0x28')][_0x89c7('0x2d')]));_0x2e0ecd[_0x89c7('0x2c')]=_0x2e0ecd[_0x89c7('0x2c')][_0x89c7('0x2e')]?_0x2e0ecd['attributes']:_0x536b5c['model'];if(!_0x11afd2['query']['hasOwnProperty'](_0x89c7('0x2f'))){_0x2e0ecd['limit']=qs[_0x89c7('0xe')](_0x11afd2[_0x89c7('0x28')][_0x89c7('0xe')]);_0x2e0ecd[_0x89c7('0xb')]=qs[_0x89c7('0xb')](_0x11afd2[_0x89c7('0x28')]['offset']);}_0x2e0ecd[_0x89c7('0x30')]=qs[_0x89c7('0x31')](_0x11afd2['query'][_0x89c7('0x31')]);_0x2e0ecd[_0x89c7('0x32')]=qs[_0x89c7('0x2a')](_[_0x89c7('0x33')](_0x11afd2[_0x89c7('0x28')],_0x536b5c[_0x89c7('0x2a')]),_0x5521e2);if(_0x11afd2['query'][_0x89c7('0x34')]){_0x2e0ecd[_0x89c7('0x32')]=_[_0x89c7('0x35')](_0x2e0ecd[_0x89c7('0x32')],{'$or':_[_0x89c7('0x1a')](_0x5521e2,function(_0x32eab3){if(_0x32eab3[_0x89c7('0x1e')]!==_0x89c7('0x36')){var _0x15d91d={};_0x15d91d[_0x32eab3[_0x89c7('0x22')]]={'$like':'%'+_0x11afd2[_0x89c7('0x28')]['filter']+'%'};return _0x15d91d;}})});}_0x2e0ecd=_[_0x89c7('0x35')]({},_0x2e0ecd,_0x11afd2[_0x89c7('0x37')]);var _0x957e73={'where':_0x2e0ecd[_0x89c7('0x32')]};return db['VoiceExtension'][_0x89c7('0xd')](_0x957e73)[_0x89c7('0x11')](function(_0x5dbb15){_0x211e43['count']=_0x5dbb15;if(_0x11afd2['query']['includeAll']){_0x2e0ecd['include']=[{'all':!![]}];}return db['VoiceExtension'][_0x89c7('0x38')](_0x2e0ecd);})[_0x89c7('0x11')](function(_0x5a9687){_0x211e43[_0x89c7('0x39')]=_0x5a9687;return _0x211e43;})['then'](respondWithFilteredResult(_0x40ed23,_0x2e0ecd))[_0x89c7('0x3a')](handleError(_0x40ed23,null));};exports[_0x89c7('0x3b')]=function(_0x3d2d1f,_0x510cf3){var _0x3ab9bd={'raw':![],'where':{'id':_0x3d2d1f['params']['id']}},_0x2a1487={};_0x2a1487[_0x89c7('0x27')]=_[_0x89c7('0x29')](db['VoiceExtension'][_0x89c7('0x3c')]);_0x2a1487[_0x89c7('0x28')]=_[_0x89c7('0x29')](_0x3d2d1f[_0x89c7('0x28')]);_0x2a1487[_0x89c7('0x2a')]=_[_0x89c7('0x2b')](_0x2a1487[_0x89c7('0x27')],_0x2a1487[_0x89c7('0x28')]);_0x3ab9bd[_0x89c7('0x2c')]=_['intersection'](_0x2a1487[_0x89c7('0x27')],qs[_0x89c7('0x2d')](_0x3d2d1f[_0x89c7('0x28')][_0x89c7('0x2d')]));_0x3ab9bd[_0x89c7('0x2c')]=_0x3ab9bd[_0x89c7('0x2c')][_0x89c7('0x2e')]?_0x3ab9bd['attributes']:_0x2a1487[_0x89c7('0x27')];if(_0x3d2d1f[_0x89c7('0x28')][_0x89c7('0x3d')]){_0x3ab9bd['include']=[{'all':!![]}];}_0x3ab9bd=_['merge']({},_0x3ab9bd,_0x3d2d1f[_0x89c7('0x37')]);return db[_0x89c7('0x3e')][_0x89c7('0x1d')](_0x3ab9bd)[_0x89c7('0x11')](handleEntityNotFound(_0x510cf3,null))['then'](respondWithResult(_0x510cf3,null))[_0x89c7('0x3a')](handleError(_0x510cf3,null));};exports[_0x89c7('0x10')]=function(_0x28a34f,_0x51c135){return db[_0x89c7('0x3e')]['find']({'where':{'id':_0x28a34f[_0x89c7('0x3f')]['id']}})['then'](handleEntityNotFound(_0x51c135,null))['then'](removeEntity(_0x51c135,null))['catch'](handleError(_0x51c135,null));};exports[_0x89c7('0x40')]=function(_0x217905,_0x21e775){if(_0x217905['body'][_0x89c7('0x1e')]===_0x89c7('0x16')&&!_[_0x89c7('0x41')](_0x217905['body']['exten'],'_')){_0x217905[_0x89c7('0x42')][_0x89c7('0x43')]='_'[_0x89c7('0x44')](_0x217905[_0x89c7('0x42')]['exten']);}return db[_0x89c7('0x3e')][_0x89c7('0x40')](_0x217905[_0x89c7('0x42')],{'raw':![]})['then'](function(_0x422927){var _0x1ebb7c=_0x217905['user'][_0x89c7('0x12')]({'plain':!![]});if(!_0x1ebb7c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ebb7c[_0x89c7('0x45')]===_0x89c7('0x46')){var _0xe76e49=_0x422927['get']({'plain':!![]});var _0x31c7bd=[{'name':'InboundRoutes','value':_0x89c7('0x14')},{'name':_0x89c7('0x15'),'value':_0x89c7('0x16')},{'name':_0x89c7('0x17'),'value':'internal'}];var _0xc50772=_[_0x89c7('0x1d')](_0x31c7bd,['value',_0xe76e49[_0x89c7('0x1e')]])[_0x89c7('0x22')];return db['UserProfileSection'][_0x89c7('0x1d')]({'where':{'name':_0xc50772,'userProfileId':_0x1ebb7c[_0x89c7('0x47')]},'raw':!![]})[_0x89c7('0x11')](function(_0x407dc4){if(_0x407dc4&&_0x407dc4[_0x89c7('0x48')]===0x0){return db[_0x89c7('0x1f')][_0x89c7('0x40')]({'name':_0xe76e49[_0x89c7('0x22')],'resourceId':_0xe76e49['id'],'type':_0x407dc4[_0x89c7('0x22')],'sectionId':_0x407dc4['id']},{})[_0x89c7('0x11')](function(){return _0x422927;});}else{return _0x422927;}})[_0x89c7('0x3a')](function(_0xf53e0){logger[_0x89c7('0x20')](_0x89c7('0x49'),_0xf53e0);throw _0xf53e0;});}return _0x422927;})['then'](respondWithResult(_0x21e775,0xc9))[_0x89c7('0x3a')](handleError(_0x21e775,null));};exports[_0x89c7('0x4a')]=function(_0x52980b,_0x368e70){if(_0x52980b[_0x89c7('0x42')]['id']){delete _0x52980b['body']['id'];}return db[_0x89c7('0x3e')][_0x89c7('0x1d')]({'where':{'id':_0x52980b['params']['id']}})[_0x89c7('0x11')](handleEntityNotFound(_0x368e70,null))[_0x89c7('0x11')](function(_0x2cb046){if(_0x2cb046){return db[_0x89c7('0x3e')][_0x89c7('0x4a')](_['pick'](_0x52980b[_0x89c7('0x42')],['exten',_0x89c7('0x4b'),'description',_0x89c7('0x4c'),_0x89c7('0x4d'),_0x89c7('0x4e'),_0x89c7('0x4f')]),{'where':{'context':_0x2cb046[_0x89c7('0x4b')],'exten':_0x2cb046['exten']},'individualHooks':!![]})[_0x89c7('0x11')](function(_0x269b1e){return _0x269b1e;});}return null;})[_0x89c7('0x11')](respondWithStatusCode(_0x368e70,null))[_0x89c7('0x3a')](handleError(_0x368e70,null));};exports[_0x89c7('0x50')]=function(_0x56514c,_0x578a82){var _0x4f7379=_0x56514c[_0x89c7('0x3f')]['id'];var _0x278403=_0x56514c[_0x89c7('0x42')];var _0x26bdcb=0xc8;var _0x4e61f=null;return db[_0x89c7('0x51')][_0x89c7('0x52')]({'isolationLevel':db[_0x89c7('0x51')][_0x89c7('0x53')]['ISOLATION_LEVELS'][_0x89c7('0x54')]},function(_0x2f5acb){return db[_0x89c7('0x3e')]['findOne']({'where':{'id':_0x4f7379},'transaction':_0x2f5acb})[_0x89c7('0x11')](function(_0x3baa94){if(_0x3baa94){return db[_0x89c7('0x3e')][_0x89c7('0x10')]({'where':{'VoiceExtensionId':_0x4f7379},'transaction':_0x2f5acb})['then'](function(){var _0x37b1fe=_[_0x89c7('0x1a')](_0x278403,function(_0x5300a2){_0x5300a2[_0x89c7('0x55')]=_0x4f7379;_0x5300a2[_0x89c7('0x56')]=!![];return _0x5300a2;});return _0x3baa94['createRouting'](_0x37b1fe);})['then'](function(_0x39980c){return db['VoiceExtension'][_0x89c7('0x57')](_0x39980c,{'transaction':_0x2f5acb});});}else{_0x26bdcb=0x194;_0x4e61f=[];}});})['then'](function(){if(_0x26bdcb!==0x194){return db[_0x89c7('0x3e')][_0x89c7('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4f7379},'order':_0x89c7('0x59')})['then'](function(_0x14ac79){_0x4e61f=_0x14ac79;});}})[_0x89c7('0x3a')](function(_0x5170bc){_0x26bdcb=0x1f4;logger[_0x89c7('0x20')](_0x5170bc['stack']);if(_0x5170bc[_0x89c7('0x22')]){delete _0x5170bc[_0x89c7('0x22')];}_0x4e61f=_0x5170bc;})[_0x89c7('0x5a')](function(){if(_0x4e61f===null){_0x578a82[_0x89c7('0x7')](_0x26bdcb);}else{if(_0x26bdcb===0x1f4){_0x578a82[_0x89c7('0x8')](_0x26bdcb)[_0x89c7('0x23')](_0x4e61f);}else{_0x578a82[_0x89c7('0x8')](_0x26bdcb)[_0x89c7('0xa')](_0x4e61f);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 33c9dd6..fffb2ee 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 _0x6522=['emit','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x188358,_0x1bc19a){var _0x29e6ae=function(_0x167787){while(--_0x167787){_0x188358['push'](_0x188358['shift']());}};_0x29e6ae(++_0x1bc19a);}(_0x6522,0xed));var _0x2652=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6522[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x2652('0x0'));var VoiceExtension=require(_0x2652('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x2652('0x2')](0x0);var events={'afterCreate':_0x2652('0x3'),'afterUpdate':_0x2652('0x4'),'afterDestroy':_0x2652('0x5')};function emitEvent(_0x1b7c78){return function(_0x2190fb,_0x16b809,_0x278fc2){VoiceExtensionEvents[_0x2652('0x6')](_0x1b7c78+':'+_0x2190fb['id'],_0x2190fb);VoiceExtensionEvents[_0x2652('0x6')](_0x1b7c78,_0x2190fb);_0x278fc2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x2652('0x7')](e,emitEvent(event));}}module[_0x2652('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x9d22=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3f83dc,_0x5c8047){var _0x3876b8=function(_0x1f8423){while(--_0x1f8423){_0x3f83dc['push'](_0x3f83dc['shift']());}};_0x3876b8(++_0x5c8047);}(_0x9d22,0x1c6));var _0x29d2=function(_0xa1e3ca,_0x559022){_0xa1e3ca=_0xa1e3ca-0x0;var _0x5005ab=_0x9d22[_0xa1e3ca];return _0x5005ab;};'use strict';var EventEmitter=require(_0x29d2('0x0'));var VoiceExtension=require(_0x29d2('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x29d2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x29d2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5d567b){return function(_0x14cc27,_0x3fa054,_0x26930b){VoiceExtensionEvents[_0x29d2('0x4')](_0x5d567b+':'+_0x14cc27['id'],_0x14cc27);VoiceExtensionEvents[_0x29d2('0x4')](_0x5d567b,_0x14cc27);_0x26930b(null);};}for(var e in events){if(events[_0x29d2('0x5')](e)){var event=events[e];VoiceExtension[_0x29d2('0x6')](e,emitEvent(event));}}module[_0x29d2('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index a78baff..e7d26f5 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 _0x61df=['tag','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','splice',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','type','Set','CDR(type)=','context','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','length','name','param','split','phone','prefix','join','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter'];(function(_0x1d930e,_0x20d8b8){var _0x5bbd66=function(_0x3c7488){while(--_0x3c7488){_0x1d930e['push'](_0x1d930e['shift']());}};_0x5bbd66(++_0x20d8b8);}(_0x61df,0xbd));var _0xf61d=function(_0x5af27a,_0x135191){_0x5af27a=_0x5af27a-0x0;var _0x13de47=_0x61df[_0x5af27a];return _0x13de47;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x5cda8a){var _0x449fc=_0x5cda8a['models'];function _0x40127d(_0x380f27){var _0x485a55=0x2;var _0x3170e7=[{'type':_0x380f27[_0xf61d('0x0')],'app':_0xf61d('0x1'),'appdata':_0xf61d('0x2')+_0x380f27[_0xf61d('0x0')],'context':_0x380f27[_0xf61d('0x3')],'exten':_0x380f27['exten'],'priority':_0x485a55++,'VoiceExtensionId':_0x380f27['id']},{'type':_0x380f27[_0xf61d('0x0')],'app':_0x380f27['alias']?_0xf61d('0x1'):_0xf61d('0x4'),'appdata':_0x380f27[_0xf61d('0x5')]?_0xf61d('0x6')+_0x380f27[_0xf61d('0x5')]:_0xf61d('0x7'),'context':_0x380f27[_0xf61d('0x3')],'exten':_0x380f27[_0xf61d('0x8')],'priority':_0x485a55++,'VoiceExtensionId':_0x380f27['id']}];if(_0x380f27[_0xf61d('0x0')]===_0xf61d('0x9')){_0x3170e7[_0xf61d('0xa')]({'type':_0xf61d('0x9'),'app':'Set','appdata':_0xf61d('0xb')+_0x380f27['id'],'context':_0x380f27['context'],'exten':_0x380f27['exten'],'priority':_0x485a55++,'VoiceExtensionId':_0x380f27['id']});}_0x3170e7[_0xf61d('0xa')]({'type':_0x380f27['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x380f27[_0xf61d('0x3')],'exten':_0x380f27['exten'],'priority':_0x485a55++,'VoiceExtensionId':_0x380f27['id']},{'type':_0x380f27['type'],'app':_0xf61d('0x1'),'appdata':_0xf61d('0xc'),'context':_0x380f27[_0xf61d('0x3')],'exten':_0x380f27[_0xf61d('0x8')],'priority':_0x485a55++,'VoiceExtensionId':_0x380f27['id']},{'type':_0x380f27['type'],'app':_0xf61d('0x1'),'appdata':_0xf61d('0xd'),'context':_0x380f27[_0xf61d('0x3')],'exten':_0x380f27[_0xf61d('0x8')],'priority':_0x485a55++,'VoiceExtensionId':_0x380f27['id']});return _0x3170e7;}function _0x51405a(_0x4d229d){var _0x20a048=0x2;var _0x3d5b61=[{'type':_0xf61d('0xe'),'app':_0xf61d('0x1'),'appdata':_0xf61d('0xf'),'context':_0x4d229d[_0xf61d('0x3')],'exten':_0x4d229d[_0xf61d('0x8')],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']},{'type':'outbound','app':_0x4d229d['alias']?_0xf61d('0x1'):_0xf61d('0x4'),'appdata':_0x4d229d[_0xf61d('0x5')]?_0xf61d('0x6')+_0x4d229d[_0xf61d('0x5')]:_0xf61d('0x7'),'context':_0x4d229d[_0xf61d('0x3')],'exten':_0x4d229d['exten'],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']},{'type':_0xf61d('0xe'),'app':'Set','appdata':_0xf61d('0x10')+(_0x4d229d[_0xf61d('0x11')]?_0xf61d('0x12')+_0x4d229d[_0xf61d('0x11')]+'}':_0xf61d('0x13')),'context':_0x4d229d[_0xf61d('0x3')],'exten':_0x4d229d[_0xf61d('0x8')],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']},{'type':_0xf61d('0xe'),'app':'Set','appdata':'CDR(routeid)='+_0x4d229d['id'],'context':_0x4d229d['context'],'exten':_0x4d229d[_0xf61d('0x8')],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']},{'type':_0xf61d('0xe'),'app':_0xf61d('0x14'),'appdata':_0xf61d('0x15')+(_0x20a048+0x2)+'):Goto('+(_0x20a048+0x1)+')','context':_0x4d229d[_0xf61d('0x3')],'exten':_0x4d229d[_0xf61d('0x8')],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']},{'type':'outbound','app':'Set','appdata':_0x4d229d[_0xf61d('0x11')]?_0xf61d('0x16')+_0x4d229d['cutdigits']+'}':_0xf61d('0x17'),'context':_0x4d229d[_0xf61d('0x3')],'exten':_0x4d229d['exten'],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']},{'type':_0xf61d('0xe'),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4d229d[_0xf61d('0x3')],'exten':_0x4d229d[_0xf61d('0x8')],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']},{'type':'outbound','app':_0xf61d('0x1'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4d229d[_0xf61d('0x3')],'exten':_0x4d229d['exten'],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']},{'type':_0xf61d('0xe'),'app':_0xf61d('0x1'),'appdata':_0xf61d('0xd'),'context':_0x4d229d[_0xf61d('0x3')],'exten':_0x4d229d['exten'],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']},{'type':_0xf61d('0xe'),'app':_0xf61d('0x1'),'appdata':_0xf61d('0x18')+_0x4d229d['id'],'context':_0x4d229d[_0xf61d('0x3')],'exten':_0x4d229d[_0xf61d('0x8')],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']}];if(_0x4d229d[_0xf61d('0x19')](_0xf61d('0x1a'))&&_0x4d229d[_0xf61d('0x1a')]!=='none'){_0x3d5b61[_0xf61d('0xa')]({'type':_0xf61d('0xe'),'app':_0xf61d('0x1'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x4d229d[_0xf61d('0x3')],'exten':_0x4d229d[_0xf61d('0x8')],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']},{'type':'outbound','app':'Set','appdata':_0xf61d('0x1b')+_0x4d229d[_0xf61d('0x1a')]||_0xf61d('0x1c'),'context':_0x4d229d[_0xf61d('0x3')],'exten':_0x4d229d[_0xf61d('0x8')],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']});}return _0x3d5b61;}function _0x5224a5(_0x373d86,_0x310b22){var _0x1d308f=[{'name':_0xf61d('0x1d'),'param':0x0},{'name':_0xf61d('0x1e'),'param':0x1},{'name':_0xf61d('0x1f'),'param':0x2},{'name':_0xf61d('0x20'),'param':0x3}];var _0x3cd341={};var _0x353258=_0x310b22['split'](',');var _0x52b296=[];for(var _0x2f170c=0x0;_0x2f170c<_0x1d308f[_0xf61d('0x21')];_0x2f170c++){switch(_0x1d308f[_0x2f170c][_0xf61d('0x22')]){case _0xf61d('0x1d'):_0x3cd341[_0xf61d('0x1d')]=_0x353258[_0x1d308f[_0x2f170c][_0xf61d('0x23')]][_0xf61d('0x24')]('/')[0x1];_0x3cd341[_0xf61d('0x25')]=_0x353258[_0x1d308f[_0x2f170c][_0xf61d('0x23')]][_0xf61d('0x24')]('/')[0x2];_0x3cd341[_0xf61d('0x26')]=_0x3cd341[_0xf61d('0x25')]?_0x3cd341[_0xf61d('0x25')][_0xf61d('0x24')]('$')[0x0]:undefined;_0x3cd341['phone']=_0x373d86[_0xf61d('0x11')]?(_0x3cd341[_0xf61d('0x26')]||'')+'${EXTEN:'+_0x373d86['cutdigits']+'}':(_0x3cd341[_0xf61d('0x26')]||'')+'${EXTEN}';_0x52b296[_0x1d308f[_0x2f170c]['param']]=['SIP',_0x3cd341[_0xf61d('0x1d')],_0x3cd341[_0xf61d('0x25')]][_0xf61d('0x27')]('/');break;case _0xf61d('0x1f'):_0x3cd341['options']=_0x353258[_0x1d308f[_0x2f170c][_0xf61d('0x23')]];if(_0x373d86[_0xf61d('0x1a')]!==_0xf61d('0x28')){if(_0x3cd341[_0xf61d('0x1f')][_0xf61d('0x29')](_0xf61d('0x2a'))<0x0){_0x3cd341['options']+=_0xf61d('0x2a');}}else{_0x3cd341[_0xf61d('0x1f')]=_0x3cd341[_0xf61d('0x1f')][_0xf61d('0x2b')]('U(xcally-mixmonitor-context)','');}_0x52b296[_0x1d308f[_0x2f170c][_0xf61d('0x23')]]=_0x3cd341[_0xf61d('0x1f')];break;default:_0x52b296[_0x1d308f[_0x2f170c][_0xf61d('0x23')]]=_0x353258[_0x1d308f[_0x2f170c][_0xf61d('0x23')]];}}return _0x52b296['join'](',');}function _0xeabb66(_0x4407e6,_0x429188,_0x3bce4c){return new Promise(function(_0x35d118,_0x30b75b){var _0x4c2a67=[];if(_[_0xf61d('0x2c')](_0x429188))return _0x35d118(_0x4c2a67);_0x449fc[_0xf61d('0x2d')][_0xf61d('0x2e')]({'attributes':['id',_0xf61d('0x2f'),_0xf61d('0x30')],'raw':!![]})[_0xf61d('0x31')](function(_0x4a7c94){for(var _0xa2f124=0x0,_0x28a753=0x0;_0xa2f124<_0x429188['length'];_0xa2f124++,_0x28a753=0x0){var _0x5a9c19=_0x429188[_0xa2f124];var _0xc6e1c3=[];var _0x542f7a=[];delete _0x5a9c19['id'];if(_0x5a9c19[_0xf61d('0x2f')]!==_0xf61d('0x32')){_0x5a9c19['intervals']=[_0x5a9c19['interval']];}else{_0x5a9c19[_0xf61d('0x33')]=_0x5a9c19[_0xf61d('0x30')]?_[_0xf61d('0x34')](_[_0xf61d('0x35')](_0x4a7c94,{'IntervalId':_0x5a9c19[_0xf61d('0x30')]}),'interval'):[];}_0x5a9c19['context']=_0x4407e6[_0xf61d('0x3')];_0x5a9c19[_0xf61d('0x8')]=_0x4407e6[_0xf61d('0x8')];if(_0x5a9c19[_0xf61d('0x0')])_0x5a9c19['type']=_0x5a9c19[_0xf61d('0x0')]['toLowerCase']();if(_0x4407e6[_0xf61d('0x0')]==='outbound'){if(_0x5a9c19[_0xf61d('0x19')](_0xf61d('0x36'))&&_0x5a9c19[_0xf61d('0x36')]&&_0x5a9c19['tag']!=='--'){_0xc6e1c3[_0xf61d('0xa')]({'type':_0x5a9c19['type']['toLowerCase'](),'app':_0xf61d('0x1'),'appdata':'CDR(tag)='+_0x5a9c19[_0xf61d('0x36')],'context':_0x4407e6[_0xf61d('0x3')],'exten':_0x4407e6[_0xf61d('0x8')],'priority':_0x5a9c19[_0xf61d('0x33')][_0xf61d('0x21')]+_0x3bce4c+_0x28a753++,'VoiceExtensionId':_0x4407e6['id']});}_0xc6e1c3[_0xf61d('0xa')]({'type':_0x5a9c19['type'][_0xf61d('0x37')](),'app':_0xf61d('0x14'),'appdata':_0xf61d('0x38')+(_0x5a9c19[_0xf61d('0x39')]?_0xf61d('0x3a')+_0x5a9c19[_0xf61d('0x39')]+')':_0xf61d('0x3b')),'context':_0x4407e6[_0xf61d('0x3')],'exten':_0x4407e6[_0xf61d('0x8')],'priority':_0x5a9c19[_0xf61d('0x33')][_0xf61d('0x21')]+_0x3bce4c+_0x28a753++,'VoiceExtensionId':_0x4407e6['id']});}else{if(_0x5a9c19[_0xf61d('0x19')](_0xf61d('0x3c'))){if([_0xf61d('0x3d'),_0xf61d('0x3e')][_0xf61d('0x3f')](_0x5a9c19[_0xf61d('0x40')]['toLowerCase']())&&_0x5a9c19[_0xf61d('0x41')]!==_0xf61d('0x42')){if(_0x5a9c19['answer']){_0xc6e1c3[_0xf61d('0xa')]({'type':_0x5a9c19['type'][_0xf61d('0x37')](),'app':_0xf61d('0x14'),'appdata':_0xf61d('0x43'),'context':_0x4407e6['context'],'exten':_0x4407e6[_0xf61d('0x8')],'priority':_0x5a9c19['intervals'][_0xf61d('0x21')]+_0x3bce4c+_0x28a753++,'VoiceExtensionId':_0x4407e6['id']});_0xc6e1c3[_0xf61d('0xa')]({'type':_0x5a9c19[_0xf61d('0x0')][_0xf61d('0x37')](),'app':_0xf61d('0x1'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x4407e6[_0xf61d('0x3')],'exten':_0x4407e6['exten'],'priority':_0x5a9c19[_0xf61d('0x33')][_0xf61d('0x21')]+_0x3bce4c+_0x28a753++,'VoiceExtensionId':_0x4407e6['id']});}else{_0xc6e1c3[_0xf61d('0xa')]({'type':_0x5a9c19[_0xf61d('0x0')][_0xf61d('0x37')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x4407e6[_0xf61d('0x3')],'exten':_0x4407e6['exten'],'priority':_0x5a9c19[_0xf61d('0x33')][_0xf61d('0x21')]+_0x3bce4c+_0x28a753++,'VoiceExtensionId':_0x4407e6['id']});_0xc6e1c3['push']({'type':_0x5a9c19['type']['toLowerCase'](),'app':_0xf61d('0x1'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x4407e6[_0xf61d('0x3')],'exten':_0x4407e6[_0xf61d('0x8')],'priority':_0x5a9c19['intervals']['length']+_0x3bce4c+_0x28a753++,'VoiceExtensionId':_0x4407e6['id']});}}}}for(var _0x150824=0x0;_0x150824<_0x5a9c19[_0xf61d('0x33')][_0xf61d('0x21')];_0x150824++){var _0x51ca8e=_0x3bce4c+_0x5a9c19[_0xf61d('0x33')][_0xf61d('0x21')];var _0x263d6b=_0x150824===_0x5a9c19[_0xf61d('0x33')][_0xf61d('0x21')]-0x1?_0x3bce4c+_0xc6e1c3[_0xf61d('0x21')]+_0x542f7a[_0xf61d('0x21')]+0x2:_0x3bce4c+_0x150824+0x1;_0xc6e1c3[_0xf61d('0x44')](_0x150824,0x0,{'type':_0x4407e6[_0xf61d('0x0')],'app':'GotoIfTime','appdata':_0x5a9c19[_0xf61d('0x33')][_0x150824]+'?'+_0x4407e6[_0xf61d('0x3')]+_0xf61d('0x45')+_0x51ca8e+':'+_0x4407e6[_0xf61d('0x3')]+',${EXTEN},'+_0x263d6b,'exten':_0x4407e6[_0xf61d('0x8')],'context':_0x4407e6[_0xf61d('0x3')],'priority':_0x3bce4c+_0x150824,'VoiceExtensionId':_0x4407e6['id']});}if(_0x5a9c19['appType']===_0xf61d('0x46'))_0x5a9c19[_0xf61d('0x47')]=_0x5224a5(_0x4407e6,_0x5a9c19[_0xf61d('0x47')]);_0x5a9c19[_0xf61d('0x48')]=_0xc6e1c3[_0xf61d('0x21')]?_[_0xf61d('0x49')](_0xc6e1c3)[_0xf61d('0x48')]+0x1:_0x3bce4c;_0x4c2a67=_[_0xf61d('0x4a')](_0x4c2a67,_0xc6e1c3,[_0x5a9c19],_0x542f7a);_0x3bce4c=_[_0xf61d('0x49')](_0x4c2a67)[_0xf61d('0x48')]+0x1;}return _0x35d118(_0x4c2a67);})[_0xf61d('0x4b')](function(_0x3f33b2){_0x30b75b(_0x3f33b2);});});}return _0x5cda8a[_0xf61d('0x4c')](_0xf61d('0x4d'),attributes,{'tableName':_0xf61d('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x18d44e){var _0x516cc4=this[_0xf61d('0x4f')]({'plain':!![]});var _0x2ae887=_0x516cc4[_0xf61d('0x0')]===_0xf61d('0xe')?_0x51405a(_0x516cc4):_0x40127d(_0x516cc4);return _0xeabb66(_0x516cc4,_0x18d44e,_[_0xf61d('0x49')](_0x2ae887)[_0xf61d('0x48')]+0x1)[_0xf61d('0x31')](function(_0x5de308){var _0x4513ae=_[_0xf61d('0x4a')](_0x2ae887,_0x5de308);_0x4513ae[_0xf61d('0xa')]({'type':_0x516cc4[_0xf61d('0x0')],'app':_0xf61d('0x50'),'exten':_0x516cc4[_0xf61d('0x8')],'context':_0x516cc4[_0xf61d('0x3')],'priority':_[_0xf61d('0x49')](_0x4513ae)[_0xf61d('0x48')]+0x1,'VoiceExtensionId':_0x516cc4['id']});return _0x4513ae;});}}});}; \ No newline at end of file +var _0x9cfc=['models','type','CDR(type)=','exten','alias','Set','CDR(routeAlias)=','No\x20alias\x20set','context','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','NoOp','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','url','split','length','name','param','phone','prefix','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','*,*,*,*','intervals','map','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','queue','playback','includes','app','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','last','priority','concat','catch','define','VoiceExtension','voice_extensions','get','then','Hangup','lodash','./voiceExtension.attributes','exports'];(function(_0x1f75d4,_0x183581){var _0x72f2ca=function(_0x5aafee){while(--_0x5aafee){_0x1f75d4['push'](_0x1f75d4['shift']());}};_0x72f2ca(++_0x183581);}(_0x9cfc,0x1b0));var _0xc9cf=function(_0xd2660b,_0x108842){_0xd2660b=_0xd2660b-0x0;var _0x3bd3af=_0x9cfc[_0xd2660b];return _0x3bd3af;};'use strict';var _=require(_0xc9cf('0x0'));var attributes=require(_0xc9cf('0x1'));module[_0xc9cf('0x2')]=function(_0x4105d1){var _0x5ce9d7=_0x4105d1[_0xc9cf('0x3')];function _0x3b2759(_0x3d2cc8){var _0x47fc27=0x2;var _0x593cb2=[{'type':_0x3d2cc8[_0xc9cf('0x4')],'app':'Set','appdata':_0xc9cf('0x5')+_0x3d2cc8[_0xc9cf('0x4')],'context':_0x3d2cc8['context'],'exten':_0x3d2cc8[_0xc9cf('0x6')],'priority':_0x47fc27++,'VoiceExtensionId':_0x3d2cc8['id']},{'type':_0x3d2cc8[_0xc9cf('0x4')],'app':_0x3d2cc8[_0xc9cf('0x7')]?_0xc9cf('0x8'):'NoOp','appdata':_0x3d2cc8[_0xc9cf('0x7')]?_0xc9cf('0x9')+_0x3d2cc8['alias']:_0xc9cf('0xa'),'context':_0x3d2cc8[_0xc9cf('0xb')],'exten':_0x3d2cc8[_0xc9cf('0x6')],'priority':_0x47fc27++,'VoiceExtensionId':_0x3d2cc8['id']}];if(_0x3d2cc8[_0xc9cf('0x4')]===_0xc9cf('0xc')){_0x593cb2[_0xc9cf('0xd')]({'type':_0xc9cf('0xc'),'app':_0xc9cf('0x8'),'appdata':'CDR(routeid)='+_0x3d2cc8['id'],'context':_0x3d2cc8[_0xc9cf('0xb')],'exten':_0x3d2cc8[_0xc9cf('0x6')],'priority':_0x47fc27++,'VoiceExtensionId':_0x3d2cc8['id']});}_0x593cb2['push']({'type':_0x3d2cc8[_0xc9cf('0x4')],'app':_0xc9cf('0x8'),'appdata':_0xc9cf('0xe'),'context':_0x3d2cc8[_0xc9cf('0xb')],'exten':_0x3d2cc8[_0xc9cf('0x6')],'priority':_0x47fc27++,'VoiceExtensionId':_0x3d2cc8['id']},{'type':_0x3d2cc8[_0xc9cf('0x4')],'app':_0xc9cf('0x8'),'appdata':_0xc9cf('0xf'),'context':_0x3d2cc8[_0xc9cf('0xb')],'exten':_0x3d2cc8[_0xc9cf('0x6')],'priority':_0x47fc27++,'VoiceExtensionId':_0x3d2cc8['id']},{'type':_0x3d2cc8[_0xc9cf('0x4')],'app':_0xc9cf('0x8'),'appdata':_0xc9cf('0x10'),'context':_0x3d2cc8[_0xc9cf('0xb')],'exten':_0x3d2cc8[_0xc9cf('0x6')],'priority':_0x47fc27++,'VoiceExtensionId':_0x3d2cc8['id']});return _0x593cb2;}function _0x117361(_0x524d09){var _0xc68bda=0x2;var _0x4220a7=[{'type':_0xc9cf('0x11'),'app':'Set','appdata':_0xc9cf('0x12'),'context':_0x524d09[_0xc9cf('0xb')],'exten':_0x524d09['exten'],'priority':_0xc68bda++,'VoiceExtensionId':_0x524d09['id']},{'type':_0xc9cf('0x11'),'app':_0x524d09[_0xc9cf('0x7')]?_0xc9cf('0x8'):_0xc9cf('0x13'),'appdata':_0x524d09[_0xc9cf('0x7')]?_0xc9cf('0x9')+_0x524d09[_0xc9cf('0x7')]:'No\x20alias\x20set','context':_0x524d09[_0xc9cf('0xb')],'exten':_0x524d09[_0xc9cf('0x6')],'priority':_0xc68bda++,'VoiceExtensionId':_0x524d09['id']},{'type':'outbound','app':_0xc9cf('0x8'),'appdata':_0xc9cf('0x14')+(_0x524d09[_0xc9cf('0x15')]?_0xc9cf('0x16')+_0x524d09[_0xc9cf('0x15')]+'}':_0xc9cf('0x17')),'context':_0x524d09['context'],'exten':_0x524d09[_0xc9cf('0x6')],'priority':_0xc68bda++,'VoiceExtensionId':_0x524d09['id']},{'type':_0xc9cf('0x11'),'app':_0xc9cf('0x8'),'appdata':'CDR(routeid)='+_0x524d09['id'],'context':_0x524d09['context'],'exten':_0x524d09['exten'],'priority':_0xc68bda++,'VoiceExtensionId':_0x524d09['id']},{'type':'outbound','app':_0xc9cf('0x18'),'appdata':_0xc9cf('0x19')+(_0xc68bda+0x2)+_0xc9cf('0x1a')+(_0xc68bda+0x1)+')','context':_0x524d09['context'],'exten':_0x524d09['exten'],'priority':_0xc68bda++,'VoiceExtensionId':_0x524d09['id']},{'type':_0xc9cf('0x11'),'app':_0xc9cf('0x8'),'appdata':_0x524d09[_0xc9cf('0x15')]?'CDR(prefix)=${EXTEN:0:'+_0x524d09['cutdigits']+'}':_0xc9cf('0x1b'),'context':_0x524d09[_0xc9cf('0xb')],'exten':_0x524d09[_0xc9cf('0x6')],'priority':_0xc68bda++,'VoiceExtensionId':_0x524d09['id']},{'type':_0xc9cf('0x11'),'app':_0xc9cf('0x8'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x524d09[_0xc9cf('0xb')],'exten':_0x524d09[_0xc9cf('0x6')],'priority':_0xc68bda++,'VoiceExtensionId':_0x524d09['id']},{'type':_0xc9cf('0x11'),'app':_0xc9cf('0x8'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x524d09[_0xc9cf('0xb')],'exten':_0x524d09[_0xc9cf('0x6')],'priority':_0xc68bda++,'VoiceExtensionId':_0x524d09['id']},{'type':'outbound','app':_0xc9cf('0x8'),'appdata':_0xc9cf('0x10'),'context':_0x524d09[_0xc9cf('0xb')],'exten':_0x524d09['exten'],'priority':_0xc68bda++,'VoiceExtensionId':_0x524d09['id']},{'type':_0xc9cf('0x11'),'app':'Set','appdata':'outboundrouteid='+_0x524d09['id'],'context':_0x524d09[_0xc9cf('0xb')],'exten':_0x524d09['exten'],'priority':_0xc68bda++,'VoiceExtensionId':_0x524d09['id']}];if(_0x524d09['hasOwnProperty'](_0xc9cf('0x1c'))&&_0x524d09[_0xc9cf('0x1c')]!==_0xc9cf('0x1d')){_0x4220a7[_0xc9cf('0xd')]({'type':_0xc9cf('0x11'),'app':_0xc9cf('0x8'),'appdata':_0xc9cf('0x1e'),'context':_0x524d09[_0xc9cf('0xb')],'exten':_0x524d09[_0xc9cf('0x6')],'priority':_0xc68bda++,'VoiceExtensionId':_0x524d09['id']},{'type':_0xc9cf('0x11'),'app':_0xc9cf('0x8'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x524d09['recordingFormat']||_0xc9cf('0x1f'),'context':_0x524d09['context'],'exten':_0x524d09[_0xc9cf('0x6')],'priority':_0xc68bda++,'VoiceExtensionId':_0x524d09['id']});}return _0x4220a7;}function _0x424c39(_0x435c7d,_0x34c503){var _0x12b577=[{'name':_0xc9cf('0x20'),'param':0x0},{'name':_0xc9cf('0x21'),'param':0x1},{'name':_0xc9cf('0x22'),'param':0x2},{'name':_0xc9cf('0x23'),'param':0x3}];var _0xc525b0={};var _0x3e14e2=_0x34c503[_0xc9cf('0x24')](',');var _0x56558b=[];for(var _0xefbe70=0x0;_0xefbe70<_0x12b577[_0xc9cf('0x25')];_0xefbe70++){switch(_0x12b577[_0xefbe70][_0xc9cf('0x26')]){case'trunk':_0xc525b0[_0xc9cf('0x20')]=_0x3e14e2[_0x12b577[_0xefbe70][_0xc9cf('0x27')]][_0xc9cf('0x24')]('/')[0x1];_0xc525b0[_0xc9cf('0x28')]=_0x3e14e2[_0x12b577[_0xefbe70][_0xc9cf('0x27')]][_0xc9cf('0x24')]('/')[0x2];_0xc525b0[_0xc9cf('0x29')]=_0xc525b0[_0xc9cf('0x28')]?_0xc525b0[_0xc9cf('0x28')][_0xc9cf('0x24')]('$')[0x0]:undefined;_0xc525b0[_0xc9cf('0x28')]=_0x435c7d['cutdigits']?(_0xc525b0[_0xc9cf('0x29')]||'')+_0xc9cf('0x16')+_0x435c7d[_0xc9cf('0x15')]+'}':(_0xc525b0[_0xc9cf('0x29')]||'')+'${EXTEN}';_0x56558b[_0x12b577[_0xefbe70]['param']]=['SIP',_0xc525b0[_0xc9cf('0x20')],_0xc525b0[_0xc9cf('0x28')]][_0xc9cf('0x2a')]('/');break;case'options':_0xc525b0['options']=_0x3e14e2[_0x12b577[_0xefbe70]['param']];if(_0x435c7d[_0xc9cf('0x1c')]!==_0xc9cf('0x1d')){if(_0xc525b0[_0xc9cf('0x22')][_0xc9cf('0x2b')](_0xc9cf('0x2c'))<0x0){_0xc525b0['options']+=_0xc9cf('0x2c');}}else{_0xc525b0['options']=_0xc525b0[_0xc9cf('0x22')][_0xc9cf('0x2d')]('U(xcally-mixmonitor-context)','');}_0x56558b[_0x12b577[_0xefbe70][_0xc9cf('0x27')]]=_0xc525b0[_0xc9cf('0x22')];break;default:_0x56558b[_0x12b577[_0xefbe70][_0xc9cf('0x27')]]=_0x3e14e2[_0x12b577[_0xefbe70][_0xc9cf('0x27')]];}}return _0x56558b['join'](',');}function _0x46590c(_0x2dcbc0,_0x171510,_0x5c95ab){return new Promise(function(_0x267212,_0x426060){var _0x2f8a0d=[];if(_[_0xc9cf('0x2e')](_0x171510))return _0x267212(_0x2f8a0d);_0x5ce9d7[_0xc9cf('0x2f')][_0xc9cf('0x30')]({'attributes':['id',_0xc9cf('0x31'),_0xc9cf('0x32')],'raw':!![]})['then'](function(_0x4e98cb){for(var _0x1532d2=0x0,_0x3813a9=0x0;_0x1532d2<_0x171510[_0xc9cf('0x25')];_0x1532d2++,_0x3813a9=0x0){var _0x3929fc=_0x171510[_0x1532d2];var _0x12b08b=[];var _0x4c164c=[];delete _0x3929fc['id'];if(_0x3929fc['interval']!==_0xc9cf('0x33')){_0x3929fc[_0xc9cf('0x34')]=[_0x3929fc[_0xc9cf('0x31')]];}else{_0x3929fc[_0xc9cf('0x34')]=_0x3929fc[_0xc9cf('0x32')]?_[_0xc9cf('0x35')](_[_0xc9cf('0x36')](_0x4e98cb,{'IntervalId':_0x3929fc[_0xc9cf('0x32')]}),_0xc9cf('0x31')):[];}_0x3929fc[_0xc9cf('0xb')]=_0x2dcbc0[_0xc9cf('0xb')];_0x3929fc[_0xc9cf('0x6')]=_0x2dcbc0[_0xc9cf('0x6')];if(_0x3929fc[_0xc9cf('0x4')])_0x3929fc[_0xc9cf('0x4')]=_0x3929fc[_0xc9cf('0x4')][_0xc9cf('0x37')]();if(_0x2dcbc0['type']===_0xc9cf('0x11')){if(_0x3929fc[_0xc9cf('0x38')](_0xc9cf('0x39'))&&_0x3929fc[_0xc9cf('0x39')]&&_0x3929fc['tag']!=='--'){_0x12b08b['push']({'type':_0x3929fc[_0xc9cf('0x4')][_0xc9cf('0x37')](),'app':_0xc9cf('0x8'),'appdata':_0xc9cf('0x3a')+_0x3929fc[_0xc9cf('0x39')],'context':_0x2dcbc0['context'],'exten':_0x2dcbc0[_0xc9cf('0x6')],'priority':_0x3929fc[_0xc9cf('0x34')][_0xc9cf('0x25')]+_0x5c95ab+_0x3813a9++,'VoiceExtensionId':_0x2dcbc0['id']});}_0x12b08b[_0xc9cf('0xd')]({'type':_0x3929fc[_0xc9cf('0x4')][_0xc9cf('0x37')](),'app':_0xc9cf('0x18'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x3929fc['callerID']?_0xc9cf('0x3b')+_0x3929fc[_0xc9cf('0x3c')]+')':_0xc9cf('0x3d')),'context':_0x2dcbc0['context'],'exten':_0x2dcbc0[_0xc9cf('0x6')],'priority':_0x3929fc[_0xc9cf('0x34')][_0xc9cf('0x25')]+_0x5c95ab+_0x3813a9++,'VoiceExtensionId':_0x2dcbc0['id']});}else{if(_0x3929fc[_0xc9cf('0x38')]('answer')){if([_0xc9cf('0x3e'),_0xc9cf('0x3f')][_0xc9cf('0x40')](_0x3929fc[_0xc9cf('0x41')][_0xc9cf('0x37')]())&&_0x3929fc['appType']!==_0xc9cf('0x42')){if(_0x3929fc[_0xc9cf('0x43')]){_0x12b08b[_0xc9cf('0xd')]({'type':_0x3929fc[_0xc9cf('0x4')][_0xc9cf('0x37')](),'app':_0xc9cf('0x18'),'appdata':_0xc9cf('0x44'),'context':_0x2dcbc0[_0xc9cf('0xb')],'exten':_0x2dcbc0['exten'],'priority':_0x3929fc[_0xc9cf('0x34')][_0xc9cf('0x25')]+_0x5c95ab+_0x3813a9++,'VoiceExtensionId':_0x2dcbc0['id']});_0x12b08b['push']({'type':_0x3929fc[_0xc9cf('0x4')][_0xc9cf('0x37')](),'app':_0xc9cf('0x8'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x2dcbc0['context'],'exten':_0x2dcbc0[_0xc9cf('0x6')],'priority':_0x3929fc[_0xc9cf('0x34')]['length']+_0x5c95ab+_0x3813a9++,'VoiceExtensionId':_0x2dcbc0['id']});}else{_0x12b08b[_0xc9cf('0xd')]({'type':_0x3929fc[_0xc9cf('0x4')][_0xc9cf('0x37')](),'app':_0xc9cf('0x18'),'appdata':_0xc9cf('0x45'),'context':_0x2dcbc0[_0xc9cf('0xb')],'exten':_0x2dcbc0[_0xc9cf('0x6')],'priority':_0x3929fc[_0xc9cf('0x34')][_0xc9cf('0x25')]+_0x5c95ab+_0x3813a9++,'VoiceExtensionId':_0x2dcbc0['id']});_0x12b08b['push']({'type':_0x3929fc[_0xc9cf('0x4')][_0xc9cf('0x37')](),'app':_0xc9cf('0x8'),'appdata':_0xc9cf('0x46'),'context':_0x2dcbc0[_0xc9cf('0xb')],'exten':_0x2dcbc0[_0xc9cf('0x6')],'priority':_0x3929fc['intervals'][_0xc9cf('0x25')]+_0x5c95ab+_0x3813a9++,'VoiceExtensionId':_0x2dcbc0['id']});}}}}for(var _0x2a9950=0x0;_0x2a9950<_0x3929fc[_0xc9cf('0x34')][_0xc9cf('0x25')];_0x2a9950++){var _0x2d668b=_0x5c95ab+_0x3929fc['intervals'][_0xc9cf('0x25')];var _0x27aad2=_0x2a9950===_0x3929fc['intervals'][_0xc9cf('0x25')]-0x1?_0x5c95ab+_0x12b08b['length']+_0x4c164c[_0xc9cf('0x25')]+0x2:_0x5c95ab+_0x2a9950+0x1;_0x12b08b[_0xc9cf('0x47')](_0x2a9950,0x0,{'type':_0x2dcbc0[_0xc9cf('0x4')],'app':_0xc9cf('0x48'),'appdata':_0x3929fc[_0xc9cf('0x34')][_0x2a9950]+'?'+_0x2dcbc0[_0xc9cf('0xb')]+_0xc9cf('0x49')+_0x2d668b+':'+_0x2dcbc0[_0xc9cf('0xb')]+_0xc9cf('0x49')+_0x27aad2,'exten':_0x2dcbc0['exten'],'context':_0x2dcbc0[_0xc9cf('0xb')],'priority':_0x5c95ab+_0x2a9950,'VoiceExtensionId':_0x2dcbc0['id']});}if(_0x3929fc[_0xc9cf('0x4a')]===_0xc9cf('0x4b'))_0x3929fc[_0xc9cf('0x4c')]=_0x424c39(_0x2dcbc0,_0x3929fc[_0xc9cf('0x4c')]);_0x3929fc['priority']=_0x12b08b['length']?_[_0xc9cf('0x4d')](_0x12b08b)[_0xc9cf('0x4e')]+0x1:_0x5c95ab;_0x2f8a0d=_[_0xc9cf('0x4f')](_0x2f8a0d,_0x12b08b,[_0x3929fc],_0x4c164c);_0x5c95ab=_['last'](_0x2f8a0d)[_0xc9cf('0x4e')]+0x1;}return _0x267212(_0x2f8a0d);})[_0xc9cf('0x50')](function(_0xcb583a){_0x426060(_0xcb583a);});});}return _0x4105d1[_0xc9cf('0x51')](_0xc9cf('0x52'),attributes,{'tableName':_0xc9cf('0x53'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1d7a0e){var _0xd6ffd9=this[_0xc9cf('0x54')]({'plain':!![]});var _0x6197c5=_0xd6ffd9[_0xc9cf('0x4')]==='outbound'?_0x117361(_0xd6ffd9):_0x3b2759(_0xd6ffd9);return _0x46590c(_0xd6ffd9,_0x1d7a0e,_[_0xc9cf('0x4d')](_0x6197c5)[_0xc9cf('0x4e')]+0x1)[_0xc9cf('0x55')](function(_0x5895d6){var _0x45b17d=_[_0xc9cf('0x4f')](_0x6197c5,_0x5895d6);_0x45b17d['push']({'type':_0xd6ffd9[_0xc9cf('0x4')],'app':_0xc9cf('0x56'),'exten':_0xd6ffd9[_0xc9cf('0x6')],'context':_0xd6ffd9[_0xc9cf('0xb')],'priority':_[_0xc9cf('0x4d')](_0x45b17d)[_0xc9cf('0x4e')]+0x1,'VoiceExtensionId':_0xd6ffd9['id']});return _0x45b17d;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index c387d28..2510598 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 _0x7722=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','include','map','model','attributes','then','lodash','util'];(function(_0x30eb94,_0x3b4ea0){var _0x38aea8=function(_0x53919b){while(--_0x53919b){_0x30eb94['push'](_0x30eb94['shift']());}};_0x38aea8(++_0x3b4ea0);}(_0x7722,0x14e));var _0x2772=function(_0x56c381,_0x4c5e6f){_0x56c381=_0x56c381-0x0;var _0x53ec32=_0x7722[_0x56c381];return _0x53ec32;};'use strict';var _=require(_0x2772('0x0'));var util=require(_0x2772('0x1'));var moment=require(_0x2772('0x2'));var BPromise=require(_0x2772('0x3'));var rs=require(_0x2772('0x4'));var fs=require('fs');var Redis=require(_0x2772('0x5'));var db=require(_0x2772('0x6'))['db'];var utils=require(_0x2772('0x7'));var logger=require(_0x2772('0x8'))('rpc');var config=require(_0x2772('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2772('0xa')][_0x2772('0xb')]({'port':0x232a});config[_0x2772('0xc')]=_[_0x2772('0xd')](config[_0x2772('0xc')],{'host':_0x2772('0xe'),'port':0x18eb});var socket=require(_0x2772('0xf'))(new Redis(config[_0x2772('0xc')]));require(_0x2772('0x10'))[_0x2772('0x11')](socket);function respondWithRpcPromise(_0x403c9f,_0x1903cc,_0x767c03){return new BPromise(function(_0x3789e2,_0xbba75f){return client[_0x2772('0x12')](_0x403c9f,_0x767c03)['then'](function(_0xdd6347){logger[_0x2772('0x13')](_0x2772('0x14'),_0x1903cc,'request\x20sent');logger[_0x2772('0x15')](_0x2772('0x16'),_0x1903cc,_0x2772('0x17'),JSON[_0x2772('0x18')](_0xdd6347));if(_0xdd6347[_0x2772('0x19')]){if(_0xdd6347['error'][_0x2772('0x1a')]===0x1f4){logger[_0x2772('0x19')](_0x2772('0x14'),_0x1903cc,_0xdd6347[_0x2772('0x19')]['message']);return _0xbba75f(_0xdd6347[_0x2772('0x19')]['message']);}logger[_0x2772('0x19')](_0x2772('0x14'),_0x1903cc,_0xdd6347[_0x2772('0x19')][_0x2772('0x1b')]);return _0x3789e2(_0xdd6347[_0x2772('0x19')][_0x2772('0x1b')]);}else{logger[_0x2772('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x1903cc,_0x2772('0x17'));_0x3789e2(_0xdd6347[_0x2772('0x1c')][_0x2772('0x1b')]);}})[_0x2772('0x1d')](function(_0x93f04a){logger[_0x2772('0x19')](_0x2772('0x14'),_0x1903cc,_0x93f04a);_0xbba75f(_0x93f04a);});});}exports[_0x2772('0x1e')]=function(_0x704416){var _0x3ac3b5=this;return new Promise(function(_0x50b87c,_0x51beac){return db[_0x2772('0x1f')][_0x2772('0x20')]({'raw':_0x704416[_0x2772('0x21')]?_0x704416[_0x2772('0x21')][_0x2772('0x22')]===undefined?!![]:![]:!![],'where':_0x704416['options']?_0x704416[_0x2772('0x21')][_0x2772('0x23')]||null:null,'attributes':_0x704416['options']?_0x704416['options']['attributes']||null:null,'limit':_0x704416['options']?_0x704416[_0x2772('0x21')][_0x2772('0x24')]||null:null,'include':_0x704416['options']?_0x704416[_0x2772('0x21')][_0x2772('0x25')]?_[_0x2772('0x26')](_0x704416[_0x2772('0x21')][_0x2772('0x25')],function(_0x111fdd){return{'model':db[_0x111fdd[_0x2772('0x27')]],'as':_0x111fdd['as'],'attributes':_0x111fdd[_0x2772('0x28')],'include':_0x111fdd[_0x2772('0x25')]?_[_0x2772('0x26')](_0x111fdd[_0x2772('0x25')],function(_0x32ed80){return{'model':db[_0x32ed80['model']],'as':_0x32ed80['as'],'attributes':_0x32ed80[_0x2772('0x28')],'include':_0x32ed80[_0x2772('0x25')]?_[_0x2772('0x26')](_0x32ed80[_0x2772('0x25')],function(_0x3c7dda){return{'model':db[_0x3c7dda[_0x2772('0x27')]],'as':_0x3c7dda['as'],'attributes':_0x3c7dda[_0x2772('0x28')]};}):[]};}):[]};}):[]:[]})[_0x2772('0x29')](function(_0x41b89e){logger['info']('GetVoiceExtension',_0x704416);logger[_0x2772('0x15')](_0x2772('0x1e'),_0x704416,JSON[_0x2772('0x18')](_0x41b89e));_0x50b87c(_0x41b89e);})[_0x2772('0x1d')](function(_0x47eacb){logger[_0x2772('0x19')](_0x2772('0x1e'),_0x47eacb[_0x2772('0x1b')],_0x704416);_0x51beac(_0x3ac3b5['error'](0x1f4,_0x47eacb[_0x2772('0x1b')]));});});}; \ No newline at end of file +var _0x0c75=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','./voiceExtension.socket','register','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','include','map','attributes','model','then','catch','util','bluebird'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x0c75,0x6a));var _0x50c7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0c75[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x50c7('0x0'));var moment=require('moment');var BPromise=require(_0x50c7('0x1'));var rs=require(_0x50c7('0x2'));var fs=require('fs');var Redis=require(_0x50c7('0x3'));var db=require(_0x50c7('0x4'))['db'];var utils=require(_0x50c7('0x5'));var logger=require(_0x50c7('0x6'))(_0x50c7('0x7'));var config=require('../../config/environment');var jayson=require(_0x50c7('0x8'));var client=jayson['client'][_0x50c7('0x9')]({'port':0x232a});config['redis']=_[_0x50c7('0xa')](config[_0x50c7('0xb')],{'host':_0x50c7('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x50c7('0xd'))[_0x50c7('0xe')](socket);function respondWithRpcPromise(_0x1af047,_0x3fba1a,_0x3dcf76){return new BPromise(function(_0x439417,_0x1bc1d3){return client['request'](_0x1af047,_0x3dcf76)['then'](function(_0x1b68f3){logger[_0x50c7('0xf')](_0x50c7('0x10'),_0x3fba1a,'request\x20sent');logger[_0x50c7('0x11')](_0x50c7('0x12'),_0x3fba1a,_0x50c7('0x13'),JSON[_0x50c7('0x14')](_0x1b68f3));if(_0x1b68f3[_0x50c7('0x15')]){if(_0x1b68f3['error']['code']===0x1f4){logger[_0x50c7('0x15')](_0x50c7('0x10'),_0x3fba1a,_0x1b68f3['error'][_0x50c7('0x16')]);return _0x1bc1d3(_0x1b68f3[_0x50c7('0x15')][_0x50c7('0x16')]);}logger[_0x50c7('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x3fba1a,_0x1b68f3[_0x50c7('0x15')][_0x50c7('0x16')]);return _0x439417(_0x1b68f3[_0x50c7('0x15')]['message']);}else{logger[_0x50c7('0xf')](_0x50c7('0x10'),_0x3fba1a,_0x50c7('0x13'));_0x439417(_0x1b68f3['result'][_0x50c7('0x16')]);}})['catch'](function(_0xd67dee){logger[_0x50c7('0x15')](_0x50c7('0x10'),_0x3fba1a,_0xd67dee);_0x1bc1d3(_0xd67dee);});});}exports[_0x50c7('0x17')]=function(_0x525bfd){var _0x59bbba=this;return new Promise(function(_0x526053,_0x3cc394){return db[_0x50c7('0x18')][_0x50c7('0x19')]({'raw':_0x525bfd[_0x50c7('0x1a')]?_0x525bfd['options'][_0x50c7('0x1b')]===undefined?!![]:![]:!![],'where':_0x525bfd[_0x50c7('0x1a')]?_0x525bfd[_0x50c7('0x1a')][_0x50c7('0x1c')]||null:null,'attributes':_0x525bfd['options']?_0x525bfd[_0x50c7('0x1a')]['attributes']||null:null,'limit':_0x525bfd[_0x50c7('0x1a')]?_0x525bfd[_0x50c7('0x1a')][_0x50c7('0x1d')]||null:null,'include':_0x525bfd['options']?_0x525bfd['options'][_0x50c7('0x1e')]?_[_0x50c7('0x1f')](_0x525bfd[_0x50c7('0x1a')][_0x50c7('0x1e')],function(_0x324874){return{'model':db[_0x324874['model']],'as':_0x324874['as'],'attributes':_0x324874[_0x50c7('0x20')],'include':_0x324874[_0x50c7('0x1e')]?_['map'](_0x324874[_0x50c7('0x1e')],function(_0x3bd031){return{'model':db[_0x3bd031[_0x50c7('0x21')]],'as':_0x3bd031['as'],'attributes':_0x3bd031[_0x50c7('0x20')],'include':_0x3bd031['include']?_[_0x50c7('0x1f')](_0x3bd031[_0x50c7('0x1e')],function(_0x255087){return{'model':db[_0x255087[_0x50c7('0x21')]],'as':_0x255087['as'],'attributes':_0x255087[_0x50c7('0x20')]};}):[]};}):[]};}):[]:[]})[_0x50c7('0x22')](function(_0xa5c834){logger['info'](_0x50c7('0x17'),_0x525bfd);logger[_0x50c7('0x11')](_0x50c7('0x17'),_0x525bfd,JSON[_0x50c7('0x14')](_0xa5c834));_0x526053(_0xa5c834);})[_0x50c7('0x23')](function(_0x181e3e){logger['error'](_0x50c7('0x17'),_0x181e3e['message'],_0x525bfd);_0x3cc394(_0x59bbba['error'](0x1f4,_0x181e3e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index bec7878..9b4b04b 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x3f3398,_0x2f455e){var _0x497317=function(_0x3114fd){while(--_0x3114fd){_0x3f3398['push'](_0x3f3398['shift']());}};_0x497317(++_0x2f455e);}(_0x53ec,0x192));var _0xc53e=function(_0x4cc815,_0x1d6f0c){_0x4cc815=_0x4cc815-0x0;var _0x34731e=_0x53ec[_0x4cc815];return _0x34731e;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file +var _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x541eed,_0x2c4e74){var _0x31ea82=function(_0x196755){while(--_0x196755){_0x541eed['push'](_0x541eed['shift']());}};_0x31ea82(++_0x2c4e74);}(_0x1261,0x144));var _0x1126=function(_0xb6ea0a,_0x483190){_0xb6ea0a=_0xb6ea0a-0x0;var _0x397ff4=_0x1261[_0xb6ea0a];return _0x397ff4;};'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 diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index f23a4a5..eb3bf8c 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 _0x187d=['/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','get','/:id','show'];(function(_0xf59106,_0x28ef6c){var _0xa9c416=function(_0x1c00e3){while(--_0x1c00e3){_0xf59106['push'](_0xf59106['shift']());}};_0xa9c416(++_0x28ef6c);}(_0x187d,0x93));var _0xd187=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x187d[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var fs_extra=require(_0xd187('0x5'));var auth=require(_0xd187('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd187('0x7'));var controller=require(_0xd187('0x8'));router['get']('/',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')](_0xd187('0xc'),auth[_0xd187('0x9')](),controller[_0xd187('0xd')]);router[_0xd187('0xb')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0xf')]);router[_0xd187('0x10')]('/',auth[_0xd187('0x9')](),controller[_0xd187('0x11')]);router[_0xd187('0x12')](_0xd187('0xc'),auth['isAuthenticated'](),controller[_0xd187('0x13')]);router[_0xd187('0x14')](_0xd187('0xc'),auth['isAuthenticated'](),controller[_0xd187('0x15')]);module[_0xd187('0x16')]=router; \ No newline at end of file +var _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','show','getMessages','post','create','put','delete','exports'];(function(_0x59f670,_0x2a34aa){var _0x4ad264=function(_0x4a8709){while(--_0x4a8709){_0x59f670['push'](_0x59f670['shift']());}};_0x4ad264(++_0x2a34aa);}(_0x326f,0xd1));var _0xf326=function(_0x515073,_0x356325){_0x515073=_0x515073-0x0;var _0x4739ca=_0x326f[_0x515073];return _0x4739ca;};'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/messages',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/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 9c490e9..4f200cb 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 _0xe599=['central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','setDataValue','email','string','trim'];(function(_0xfb4032,_0x4240fb){var _0x46f74a=function(_0x505ab1){while(--_0x505ab1){_0xfb4032['push'](_0xfb4032['shift']());}};_0x46f74a(++_0x4240fb);}(_0xe599,0x184));var _0x9e59=function(_0x11e5c5,_0x2c3f80){_0x11e5c5=_0x11e5c5-0x0;var _0x329617=_0xe599[_0x11e5c5];return _0x329617;};'use strict';var Sequelize=require(_0x9e59('0x0'));module[_0x9e59('0x1')]={'customer_id':{'type':Sequelize[_0x9e59('0x2')]},'context':{'type':Sequelize[_0x9e59('0x2')],'defaultValue':_0x9e59('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x9e59('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x9e59('0x2')]},'email':{'type':Sequelize[_0x9e59('0x2')],'validate':{'isEmail':!![]},'set':function(_0x435114){this[_0x9e59('0x4')](_0x9e59('0x5'),typeof _0x435114===_0x9e59('0x6')&&_0x435114['trim']()?_0x435114[_0x9e59('0x7')]():null);}},'pager':{'type':Sequelize[_0x9e59('0x2')]},'tz':{'type':Sequelize[_0x9e59('0x2')],'defaultValue':_0x9e59('0x8')},'attach':{'type':Sequelize[_0x9e59('0x9')](_0x9e59('0xa'),'no'),'defaultValue':_0x9e59('0xa'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x9e59('0xa'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x9e59('0x9')](_0x9e59('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x9e59('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x9e59('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x9e59('0x9')](_0x9e59('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x9e59('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x9e59('0x9')](_0x9e59('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x9e59('0xa'),'no'),'defaultValue':_0x9e59('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x9e59('0x9')](_0x9e59('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x9e59('0x9')](_0x9e59('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x9e59('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x9e59('0xb')},'emailsubject':{'type':Sequelize[_0x9e59('0x2')]},'emailbody':{'type':Sequelize[_0x9e59('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x9e59('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9e59('0xd')],'get':function(){return this[_0x9e59('0xe')](_0x9e59('0xf'))+_0x9e59('0x10')+this['getDataValue'](_0x9e59('0x11'));}}}; \ No newline at end of file +var _0x4340=['VIRTUAL','getDataValue','fullname','\x20-\x20','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER'];(function(_0x52cfea,_0x25c328){var _0xa79d48=function(_0x37ab9c){while(--_0x37ab9c){_0x52cfea['push'](_0x52cfea['shift']());}};_0xa79d48(++_0x25c328);}(_0x4340,0x1a2));var _0x0434=function(_0x39ce72,_0x58d730){_0x39ce72=_0x39ce72-0x0;var _0x5942e7=_0x4340[_0x39ce72];return _0x5942e7;};'use strict';var Sequelize=require(_0x0434('0x0'));module[_0x0434('0x1')]={'customer_id':{'type':Sequelize[_0x0434('0x2')]},'context':{'type':Sequelize[_0x0434('0x2')],'defaultValue':_0x0434('0x3'),'unique':_0x0434('0x4')},'mailbox':{'type':Sequelize[_0x0434('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x0434('0x2')]},'fullname':{'type':Sequelize[_0x0434('0x2')]},'email':{'type':Sequelize[_0x0434('0x2')],'validate':{'isEmail':!![]},'set':function(_0x35db73){this[_0x0434('0x5')]('email',typeof _0x35db73===_0x0434('0x6')&&_0x35db73[_0x0434('0x7')]()?_0x35db73[_0x0434('0x7')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x0434('0x2')],'defaultValue':_0x0434('0x8')},'attach':{'type':Sequelize[_0x0434('0x9')](_0x0434('0xa'),'no'),'defaultValue':_0x0434('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x0434('0x9')](_0x0434('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x0434('0x2')]},'review':{'type':Sequelize['ENUM'](_0x0434('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x0434('0x9')](_0x0434('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0434('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0434('0x9')](_0x0434('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0434('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x0434('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0434('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0434('0x9')](_0x0434('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x0434('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x0434('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0434('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x0434('0xc')},'emailsubject':{'type':Sequelize[_0x0434('0x2')]},'emailbody':{'type':Sequelize[_0x0434('0x2')]},'maxsecs':{'type':Sequelize[_0x0434('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0434('0xe')],'get':function(){return this[_0x0434('0xf')](_0x0434('0x10'))+_0x0434('0x11')+this[_0x0434('0xf')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 99629b7..6479fae 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 _0x34b7=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','VoiceMailMessage','nolimit','mailbox','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','Voicemails','UserProfileResource','end','error','name','send','index','map','VoiceMail','fieldName','type','key','model','query','keys'];(function(_0x4dc44f,_0x469ca9){var _0xd2cec6=function(_0x3b4297){while(--_0x3b4297){_0x4dc44f['push'](_0x4dc44f['shift']());}};_0xd2cec6(++_0x469ca9);}(_0x34b7,0x196));var _0x734b=function(_0x511723,_0x4db8e2){_0x511723=_0x511723-0x0;var _0x25add0=_0x34b7[_0x511723];return _0x25add0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x734b('0x0'));var jsonpatch=require(_0x734b('0x1'));var rp=require(_0x734b('0x2'));var moment=require(_0x734b('0x3'));var BPromise=require(_0x734b('0x4'));var Mustache=require(_0x734b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x734b('0x6'));var csv=require(_0x734b('0x7'));var ejs=require(_0x734b('0x8'));var fs=require('fs');var fs_extra=require(_0x734b('0x9'));var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];function respondWithStatusCode(_0x1e0fca,_0x189a82){_0x189a82=_0x189a82||0xcc;return function(_0xff9ddf){if(_0xff9ddf){return _0x1e0fca[_0x734b('0x18')](_0x189a82);}return _0x1e0fca[_0x734b('0x19')](_0x189a82)['end']();};}function respondWithResult(_0x18fc18,_0x252510){_0x252510=_0x252510||0xc8;return function(_0x47791c){if(_0x47791c){return _0x18fc18[_0x734b('0x19')](_0x252510)[_0x734b('0x1a')](_0x47791c);}};}function respondWithFilteredResult(_0x2e00ad,_0x2372bd){return function(_0x2c03bd){if(_0x2c03bd){var _0xa6d111=typeof _0x2372bd[_0x734b('0x1b')]===_0x734b('0x1c')&&typeof _0x2372bd['limit']===_0x734b('0x1c');var _0x2ee290=_0x2c03bd[_0x734b('0x1d')];var _0x5edbe9=_0xa6d111?0x0:_0x2372bd['offset'];var _0x56a95c=_0xa6d111?_0x2c03bd[_0x734b('0x1d')]:_0x2372bd[_0x734b('0x1b')]+_0x2372bd[_0x734b('0x1e')];var _0x41ba87;if(_0x56a95c>=_0x2ee290){_0x56a95c=_0x2ee290;_0x41ba87=0xc8;}else{_0x41ba87=0xce;}_0x2e00ad[_0x734b('0x19')](_0x41ba87);return _0x2e00ad[_0x734b('0x1f')](_0x734b('0x20'),_0x5edbe9+'-'+_0x56a95c+'/'+_0x2ee290)[_0x734b('0x1a')](_0x2c03bd);}return null;};}function patchUpdates(_0x67eed){return function(_0x1d2b27){try{jsonpatch[_0x734b('0x21')](_0x1d2b27,_0x67eed,!![]);}catch(_0x3d0ffd){return BPromise[_0x734b('0x22')](_0x3d0ffd);}return _0x1d2b27[_0x734b('0x23')]();};}function saveUpdates(_0x56f807,_0x1e4dcc){return function(_0x7856d7){if(_0x7856d7){return _0x7856d7['update'](_0x56f807)[_0x734b('0x24')](function(_0x1f81de){return _0x1f81de;});}return null;};}function removeEntity(_0x1a7908,_0x11fb8e){return function(_0x46d432){if(_0x46d432){return _0x46d432[_0x734b('0x25')]()[_0x734b('0x24')](function(){var _0x104fff=_0x46d432[_0x734b('0x26')]({'plain':!![]});var _0x3abbe6=_0x734b('0x27');return db[_0x734b('0x28')][_0x734b('0x25')]({'where':{'type':_0x3abbe6,'resourceId':_0x104fff['id']}})['then'](function(){return _0x46d432;});})['then'](function(){_0x1a7908[_0x734b('0x19')](0xcc)[_0x734b('0x29')]();});}};}function handleEntityNotFound(_0x47a0a9,_0x32ea00){return function(_0x2dd51a){if(!_0x2dd51a){_0x47a0a9[_0x734b('0x18')](0x194);}return _0x2dd51a;};}function handleError(_0x41b501,_0x43edea){_0x43edea=_0x43edea||0x1f4;return function(_0x1b8295){logger[_0x734b('0x2a')](_0x1b8295['stack']);if(_0x1b8295[_0x734b('0x2b')]){delete _0x1b8295[_0x734b('0x2b')];}_0x41b501[_0x734b('0x19')](_0x43edea)[_0x734b('0x2c')](_0x1b8295);};}exports[_0x734b('0x2d')]=function(_0x427c36,_0x1fed72){var _0x21ed3c={},_0x371ead={},_0x3065b0={'count':0x0,'rows':[]};var _0x5dcabf=_[_0x734b('0x2e')](db[_0x734b('0x2f')]['rawAttributes'],function(_0xbbe037){return{'name':_0xbbe037[_0x734b('0x30')],'type':_0xbbe037[_0x734b('0x31')][_0x734b('0x32')]};});_0x371ead[_0x734b('0x33')]=_[_0x734b('0x2e')](_0x5dcabf,_0x734b('0x2b'));_0x371ead[_0x734b('0x34')]=_[_0x734b('0x35')](_0x427c36[_0x734b('0x34')]);_0x371ead[_0x734b('0x36')]=_[_0x734b('0x37')](_0x371ead[_0x734b('0x33')],_0x371ead[_0x734b('0x34')]);_0x21ed3c[_0x734b('0x38')]=_['intersection'](_0x371ead[_0x734b('0x33')],qs['fields'](_0x427c36[_0x734b('0x34')][_0x734b('0x39')]));_0x21ed3c[_0x734b('0x38')]=_0x21ed3c[_0x734b('0x38')][_0x734b('0x3a')]?_0x21ed3c[_0x734b('0x38')]:_0x371ead['model'];if(!_0x427c36['query'][_0x734b('0x3b')]('nolimit')){_0x21ed3c[_0x734b('0x1e')]=qs['limit'](_0x427c36[_0x734b('0x34')]['limit']);_0x21ed3c[_0x734b('0x1b')]=qs['offset'](_0x427c36[_0x734b('0x34')][_0x734b('0x1b')]);}_0x21ed3c[_0x734b('0x3c')]=qs[_0x734b('0x3d')](_0x427c36[_0x734b('0x34')][_0x734b('0x3d')]);_0x21ed3c[_0x734b('0x3e')]=qs['filters'](_[_0x734b('0x3f')](_0x427c36[_0x734b('0x34')],_0x371ead['filters']),_0x5dcabf);if(_0x427c36[_0x734b('0x34')][_0x734b('0x40')]){_0x21ed3c[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x21ed3c['where'],{'$or':_[_0x734b('0x2e')](_0x5dcabf,function(_0x352d28){if(_0x352d28['type']!==_0x734b('0x42')){var _0x1e1689={};_0x1e1689[_0x352d28['name']]={'$like':'%'+_0x427c36[_0x734b('0x34')][_0x734b('0x40')]+'%'};return _0x1e1689;}})});}_0x21ed3c=_[_0x734b('0x41')]({},_0x21ed3c,_0x427c36[_0x734b('0x43')]);var _0x56eb35={'where':_0x21ed3c['where']};return db[_0x734b('0x2f')]['count'](_0x56eb35)['then'](function(_0x121a00){_0x3065b0['count']=_0x121a00;if(_0x427c36[_0x734b('0x34')]['includeAll']){_0x21ed3c[_0x734b('0x44')]=[{'all':!![]}];}return db[_0x734b('0x2f')][_0x734b('0x45')](_0x21ed3c);})['then'](function(_0x5cf3a0){_0x3065b0[_0x734b('0x46')]=_0x5cf3a0;return _0x3065b0;})['then'](respondWithFilteredResult(_0x1fed72,_0x21ed3c))['catch'](handleError(_0x1fed72,null));};exports[_0x734b('0x47')]=function(_0x159db9,_0x58f78a){var _0x2e789e={'raw':!![],'where':{'id':_0x159db9[_0x734b('0x48')]['id']}},_0x513f07={};_0x513f07[_0x734b('0x33')]=_[_0x734b('0x35')](db['VoiceMail'][_0x734b('0x49')]);_0x513f07[_0x734b('0x34')]=_[_0x734b('0x35')](_0x159db9[_0x734b('0x34')]);_0x513f07['filters']=_['intersection'](_0x513f07['model'],_0x513f07[_0x734b('0x34')]);_0x2e789e['attributes']=_['intersection'](_0x513f07[_0x734b('0x33')],qs['fields'](_0x159db9[_0x734b('0x34')][_0x734b('0x39')]));_0x2e789e[_0x734b('0x38')]=_0x2e789e[_0x734b('0x38')]['length']?_0x2e789e[_0x734b('0x38')]:_0x513f07['model'];if(_0x159db9[_0x734b('0x34')][_0x734b('0x4a')]){_0x2e789e[_0x734b('0x44')]=[{'all':!![]}];}_0x2e789e=_['merge']({},_0x2e789e,_0x159db9[_0x734b('0x43')]);return db['VoiceMail'][_0x734b('0x4b')](_0x2e789e)[_0x734b('0x24')](handleEntityNotFound(_0x58f78a,null))['then'](respondWithResult(_0x58f78a,null))[_0x734b('0x4c')](handleError(_0x58f78a,null));};exports[_0x734b('0x4d')]=function(_0x145ced,_0x38125a){return db[_0x734b('0x2f')]['create'](_0x145ced[_0x734b('0x4e')],{})['then'](function(_0x171575){var _0x5de7b7=_0x145ced[_0x734b('0x4f')][_0x734b('0x26')]({'plain':!![]});if(!_0x5de7b7)throw new Error(_0x734b('0x50'));if(_0x5de7b7[_0x734b('0x51')]===_0x734b('0x4f')){var _0x4b70f2=_0x171575['get']({'plain':!![]});var _0x484156=_0x734b('0x27');return db[_0x734b('0x52')]['find']({'where':{'name':_0x484156,'userProfileId':_0x5de7b7[_0x734b('0x53')]},'raw':!![]})[_0x734b('0x24')](function(_0x588ceb){if(_0x588ceb&&_0x588ceb[_0x734b('0x54')]===0x0){return db[_0x734b('0x28')][_0x734b('0x4d')]({'name':_0x4b70f2['name'],'resourceId':_0x4b70f2['id'],'type':_0x588ceb[_0x734b('0x2b')],'sectionId':_0x588ceb['id']},{})[_0x734b('0x24')](function(){return _0x171575;});}else{return _0x171575;}})[_0x734b('0x4c')](function(_0xe605be){logger['error'](_0x734b('0x55'),_0xe605be);throw _0xe605be;});}return _0x171575;})[_0x734b('0x24')](respondWithResult(_0x38125a,0xc9))[_0x734b('0x4c')](handleError(_0x38125a,null));};exports[_0x734b('0x56')]=function(_0x4b65bf,_0x27f0ff){if(_0x4b65bf['body']['id']){delete _0x4b65bf[_0x734b('0x4e')]['id'];}return db[_0x734b('0x2f')][_0x734b('0x4b')]({'where':{'id':_0x4b65bf[_0x734b('0x48')]['id']}})['then'](handleEntityNotFound(_0x27f0ff,null))[_0x734b('0x24')](saveUpdates(_0x4b65bf[_0x734b('0x4e')],null))['then'](respondWithResult(_0x27f0ff,null))['catch'](handleError(_0x27f0ff,null));};exports[_0x734b('0x25')]=function(_0x577735,_0x16b461){return db[_0x734b('0x2f')][_0x734b('0x4b')]({'where':{'id':_0x577735['params']['id']}})[_0x734b('0x24')](handleEntityNotFound(_0x16b461,null))['then'](removeEntity(_0x16b461,null))[_0x734b('0x4c')](handleError(_0x16b461,null));};exports[_0x734b('0x57')]=function(_0x3c3359,_0x10660d,_0x49a43b){return db[_0x734b('0x2f')]['findOne']({'where':{'id':_0x3c3359[_0x734b('0x48')]['id']}})[_0x734b('0x24')](handleEntityNotFound(_0x10660d,null))[_0x734b('0x24')](function(_0x59b7d8){var _0x18e187;var _0x55c699={},_0x2c81a1={};_0x2c81a1[_0x734b('0x33')]=_[_0x734b('0x35')](db[_0x734b('0x58')]['rawAttributes']);_0x2c81a1[_0x734b('0x34')]=_['keys'](_0x3c3359[_0x734b('0x34')]);_0x2c81a1[_0x734b('0x36')]=_[_0x734b('0x37')](_0x2c81a1['model'],_0x2c81a1[_0x734b('0x34')]);_0x55c699[_0x734b('0x38')]=_[_0x734b('0x37')](_0x2c81a1[_0x734b('0x33')],qs[_0x734b('0x39')](_0x3c3359[_0x734b('0x34')][_0x734b('0x39')]));_0x55c699['attributes']=_0x55c699[_0x734b('0x38')][_0x734b('0x3a')]?_0x55c699[_0x734b('0x38')]:_0x2c81a1['model'];if(!_0x3c3359['query'][_0x734b('0x3b')](_0x734b('0x59'))){_0x55c699[_0x734b('0x1e')]=qs[_0x734b('0x1e')](_0x3c3359['query']['limit']);_0x55c699['offset']=qs[_0x734b('0x1b')](_0x3c3359[_0x734b('0x34')][_0x734b('0x1b')]);}_0x55c699[_0x734b('0x3c')]=qs[_0x734b('0x3d')](_0x3c3359[_0x734b('0x34')][_0x734b('0x3d')]);_0x55c699[_0x734b('0x3e')]=qs[_0x734b('0x36')](_[_0x734b('0x3f')](_0x3c3359[_0x734b('0x34')],_0x2c81a1[_0x734b('0x36')]));if(_0x3c3359[_0x734b('0x34')][_0x734b('0x40')]){_0x55c699[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x55c699[_0x734b('0x3e')],{'$or':_[_0x734b('0x2e')](_0x55c699[_0x734b('0x38')],function(_0x39d4e7){var _0x379a33={};_0x379a33[_0x39d4e7]={'$like':'%'+_0x3c3359['query'][_0x734b('0x40')]+'%'};return _0x379a33;})});}_0x55c699[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x55c699[_0x734b('0x3e')],{'mailboxuser':_0x59b7d8[_0x734b('0x5a')]});_0x55c699=_['merge']({},_0x55c699,_0x3c3359[_0x734b('0x43')]);return db[_0x734b('0x58')][_0x734b('0x5b')](_0x55c699)[_0x734b('0x24')](respondWithFilteredResult(_0x10660d,_0x55c699));})[_0x734b('0x4c')](handleError(_0x10660d,null));}; \ No newline at end of file +var _0x7072=['order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','intersection','length','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','hasOwnProperty','nolimit','mailbox','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','Voicemails','UserProfileResource','error','stack','name','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields'];(function(_0x253d64,_0x3db0e1){var _0x48e2a0=function(_0x1ffeaf){while(--_0x1ffeaf){_0x253d64['push'](_0x253d64['shift']());}};_0x48e2a0(++_0x3db0e1);}(_0x7072,0x138));var _0x2707=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x7072[_0x17b6e3];return _0x3906f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2707('0x0'));var zipdir=require(_0x2707('0x1'));var jsonpatch=require(_0x2707('0x2'));var rp=require(_0x2707('0x3'));var moment=require(_0x2707('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2707('0x5'));var path=require('path');var sox=require(_0x2707('0x6'));var csv=require(_0x2707('0x7'));var ejs=require(_0x2707('0x8'));var fs=require('fs');var fs_extra=require(_0x2707('0x9'));var _=require(_0x2707('0xa'));var squel=require(_0x2707('0xb'));var crypto=require(_0x2707('0xc'));var jsforce=require(_0x2707('0xd'));var deskjs=require(_0x2707('0xe'));var toCsv=require(_0x2707('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2707('0xf'));var authService=require(_0x2707('0x10'));var qs=require(_0x2707('0x11'));var as=require(_0x2707('0x12'));var hardwareService=require(_0x2707('0x13'));var logger=require(_0x2707('0x14'))(_0x2707('0x15'));var utils=require(_0x2707('0x16'));var config=require(_0x2707('0x17'));var licenseUtil=require(_0x2707('0x18'));var db=require(_0x2707('0x19'))['db'];function respondWithStatusCode(_0x32d4bd,_0x40d370){_0x40d370=_0x40d370||0xcc;return function(_0x5bf16e){if(_0x5bf16e){return _0x32d4bd[_0x2707('0x1a')](_0x40d370);}return _0x32d4bd['status'](_0x40d370)[_0x2707('0x1b')]();};}function respondWithResult(_0x307367,_0xfe975c){_0xfe975c=_0xfe975c||0xc8;return function(_0x3a67f2){if(_0x3a67f2){return _0x307367[_0x2707('0x1c')](_0xfe975c)['json'](_0x3a67f2);}};}function respondWithFilteredResult(_0x345774,_0x1a687a){return function(_0x2f6381){if(_0x2f6381){var _0x5d523f=typeof _0x1a687a[_0x2707('0x1d')]===_0x2707('0x1e')&&typeof _0x1a687a[_0x2707('0x1f')]===_0x2707('0x1e');var _0x7ed037=_0x2f6381[_0x2707('0x20')];var _0x4a8b7f=_0x5d523f?0x0:_0x1a687a[_0x2707('0x1d')];var _0x449a61=_0x5d523f?_0x2f6381[_0x2707('0x20')]:_0x1a687a['offset']+_0x1a687a['limit'];var _0x58a4ee;if(_0x449a61>=_0x7ed037){_0x449a61=_0x7ed037;_0x58a4ee=0xc8;}else{_0x58a4ee=0xce;}_0x345774[_0x2707('0x1c')](_0x58a4ee);return _0x345774[_0x2707('0x21')](_0x2707('0x22'),_0x4a8b7f+'-'+_0x449a61+'/'+_0x7ed037)[_0x2707('0x23')](_0x2f6381);}return null;};}function patchUpdates(_0x1a0e1a){return function(_0x3c2935){try{jsonpatch[_0x2707('0x24')](_0x3c2935,_0x1a0e1a,!![]);}catch(_0x65b6e5){return BPromise[_0x2707('0x25')](_0x65b6e5);}return _0x3c2935[_0x2707('0x26')]();};}function saveUpdates(_0x37c475,_0x119df4){return function(_0x454fde){if(_0x454fde){return _0x454fde[_0x2707('0x27')](_0x37c475)['then'](function(_0x1acf22){return _0x1acf22;});}return null;};}function removeEntity(_0x3b030a,_0x46259e){return function(_0x369e3a){if(_0x369e3a){return _0x369e3a[_0x2707('0x28')]()[_0x2707('0x29')](function(){var _0x4831ed=_0x369e3a[_0x2707('0x2a')]({'plain':!![]});var _0x3f6976=_0x2707('0x2b');return db[_0x2707('0x2c')][_0x2707('0x28')]({'where':{'type':_0x3f6976,'resourceId':_0x4831ed['id']}})['then'](function(){return _0x369e3a;});})[_0x2707('0x29')](function(){_0x3b030a['status'](0xcc)[_0x2707('0x1b')]();});}};}function handleEntityNotFound(_0x34dc4e,_0x2aa3fe){return function(_0x57da26){if(!_0x57da26){_0x34dc4e[_0x2707('0x1a')](0x194);}return _0x57da26;};}function handleError(_0x14daf8,_0x2c7047){_0x2c7047=_0x2c7047||0x1f4;return function(_0x529be8){logger[_0x2707('0x2d')](_0x529be8[_0x2707('0x2e')]);if(_0x529be8['name']){delete _0x529be8[_0x2707('0x2f')];}_0x14daf8['status'](_0x2c7047)['send'](_0x529be8);};}exports[_0x2707('0x30')]=function(_0x4e0c93,_0x2a0d24){var _0x3f153d={},_0x417a97={},_0x36b2e9={'count':0x0,'rows':[]};var _0x48832b=_[_0x2707('0x31')](db[_0x2707('0x32')][_0x2707('0x33')],function(_0x154799){return{'name':_0x154799[_0x2707('0x34')],'type':_0x154799[_0x2707('0x35')][_0x2707('0x36')]};});_0x417a97[_0x2707('0x37')]=_[_0x2707('0x31')](_0x48832b,'name');_0x417a97[_0x2707('0x38')]=_[_0x2707('0x39')](_0x4e0c93['query']);_0x417a97['filters']=_['intersection'](_0x417a97['model'],_0x417a97['query']);_0x3f153d[_0x2707('0x3a')]=_['intersection'](_0x417a97['model'],qs[_0x2707('0x3b')](_0x4e0c93[_0x2707('0x38')]['fields']));_0x3f153d[_0x2707('0x3a')]=_0x3f153d[_0x2707('0x3a')]['length']?_0x3f153d['attributes']:_0x417a97[_0x2707('0x37')];if(!_0x4e0c93[_0x2707('0x38')]['hasOwnProperty']('nolimit')){_0x3f153d[_0x2707('0x1f')]=qs[_0x2707('0x1f')](_0x4e0c93['query'][_0x2707('0x1f')]);_0x3f153d[_0x2707('0x1d')]=qs[_0x2707('0x1d')](_0x4e0c93[_0x2707('0x38')][_0x2707('0x1d')]);}_0x3f153d[_0x2707('0x3c')]=qs['sort'](_0x4e0c93[_0x2707('0x38')][_0x2707('0x3d')]);_0x3f153d[_0x2707('0x3e')]=qs[_0x2707('0x3f')](_[_0x2707('0x40')](_0x4e0c93[_0x2707('0x38')],_0x417a97[_0x2707('0x3f')]),_0x48832b);if(_0x4e0c93['query'][_0x2707('0x41')]){_0x3f153d[_0x2707('0x3e')]=_[_0x2707('0x42')](_0x3f153d[_0x2707('0x3e')],{'$or':_[_0x2707('0x31')](_0x48832b,function(_0xc7119d){if(_0xc7119d[_0x2707('0x35')]!==_0x2707('0x43')){var _0x2f06f8={};_0x2f06f8[_0xc7119d[_0x2707('0x2f')]]={'$like':'%'+_0x4e0c93[_0x2707('0x38')][_0x2707('0x41')]+'%'};return _0x2f06f8;}})});}_0x3f153d=_[_0x2707('0x42')]({},_0x3f153d,_0x4e0c93[_0x2707('0x44')]);var _0x36c8ab={'where':_0x3f153d[_0x2707('0x3e')]};return db['VoiceMail'][_0x2707('0x20')](_0x36c8ab)[_0x2707('0x29')](function(_0x5053ba){_0x36b2e9[_0x2707('0x20')]=_0x5053ba;if(_0x4e0c93['query'][_0x2707('0x45')]){_0x3f153d[_0x2707('0x46')]=[{'all':!![]}];}return db[_0x2707('0x32')][_0x2707('0x47')](_0x3f153d);})[_0x2707('0x29')](function(_0xdeec24){_0x36b2e9[_0x2707('0x48')]=_0xdeec24;return _0x36b2e9;})['then'](respondWithFilteredResult(_0x2a0d24,_0x3f153d))[_0x2707('0x49')](handleError(_0x2a0d24,null));};exports[_0x2707('0x4a')]=function(_0x4c8dbf,_0x3d25ea){var _0x6defc2={'raw':!![],'where':{'id':_0x4c8dbf['params']['id']}},_0x3b38d7={};_0x3b38d7['model']=_[_0x2707('0x39')](db[_0x2707('0x32')]['rawAttributes']);_0x3b38d7[_0x2707('0x38')]=_['keys'](_0x4c8dbf[_0x2707('0x38')]);_0x3b38d7[_0x2707('0x3f')]=_[_0x2707('0x4b')](_0x3b38d7[_0x2707('0x37')],_0x3b38d7['query']);_0x6defc2[_0x2707('0x3a')]=_[_0x2707('0x4b')](_0x3b38d7[_0x2707('0x37')],qs[_0x2707('0x3b')](_0x4c8dbf[_0x2707('0x38')][_0x2707('0x3b')]));_0x6defc2[_0x2707('0x3a')]=_0x6defc2['attributes'][_0x2707('0x4c')]?_0x6defc2[_0x2707('0x3a')]:_0x3b38d7[_0x2707('0x37')];if(_0x4c8dbf[_0x2707('0x38')][_0x2707('0x45')]){_0x6defc2['include']=[{'all':!![]}];}_0x6defc2=_[_0x2707('0x42')]({},_0x6defc2,_0x4c8dbf['options']);return db[_0x2707('0x32')][_0x2707('0x4d')](_0x6defc2)['then'](handleEntityNotFound(_0x3d25ea,null))[_0x2707('0x29')](respondWithResult(_0x3d25ea,null))[_0x2707('0x49')](handleError(_0x3d25ea,null));};exports[_0x2707('0x4e')]=function(_0x4ae196,_0x1a8034){return db['VoiceMail'][_0x2707('0x4e')](_0x4ae196[_0x2707('0x4f')],{})['then'](function(_0x2b1746){var _0xffe740=_0x4ae196[_0x2707('0x50')]['get']({'plain':!![]});if(!_0xffe740)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xffe740[_0x2707('0x51')]===_0x2707('0x50')){var _0x292b44=_0x2b1746[_0x2707('0x2a')]({'plain':!![]});var _0x463bf='Voicemails';return db['UserProfileSection']['find']({'where':{'name':_0x463bf,'userProfileId':_0xffe740[_0x2707('0x52')]},'raw':!![]})[_0x2707('0x29')](function(_0x2e11fc){if(_0x2e11fc&&_0x2e11fc[_0x2707('0x53')]===0x0){return db[_0x2707('0x2c')]['create']({'name':_0x292b44[_0x2707('0x2f')],'resourceId':_0x292b44['id'],'type':_0x2e11fc[_0x2707('0x2f')],'sectionId':_0x2e11fc['id']},{})['then'](function(){return _0x2b1746;});}else{return _0x2b1746;}})['catch'](function(_0x3b41b2){logger[_0x2707('0x2d')](_0x2707('0x54'),_0x3b41b2);throw _0x3b41b2;});}return _0x2b1746;})['then'](respondWithResult(_0x1a8034,0xc9))[_0x2707('0x49')](handleError(_0x1a8034,null));};exports[_0x2707('0x27')]=function(_0x2a2a71,_0x29a453){if(_0x2a2a71['body']['id']){delete _0x2a2a71[_0x2707('0x4f')]['id'];}return db[_0x2707('0x32')][_0x2707('0x4d')]({'where':{'id':_0x2a2a71[_0x2707('0x55')]['id']}})[_0x2707('0x29')](handleEntityNotFound(_0x29a453,null))[_0x2707('0x29')](saveUpdates(_0x2a2a71[_0x2707('0x4f')],null))[_0x2707('0x29')](respondWithResult(_0x29a453,null))[_0x2707('0x49')](handleError(_0x29a453,null));};exports[_0x2707('0x28')]=function(_0x4f2b54,_0x38acdd){return db['VoiceMail']['find']({'where':{'id':_0x4f2b54[_0x2707('0x55')]['id']}})['then'](handleEntityNotFound(_0x38acdd,null))['then'](removeEntity(_0x38acdd,null))[_0x2707('0x49')](handleError(_0x38acdd,null));};exports[_0x2707('0x56')]=function(_0x185bd3,_0x154e26,_0x3f82de){return db[_0x2707('0x32')][_0x2707('0x57')]({'where':{'id':_0x185bd3[_0x2707('0x55')]['id']}})[_0x2707('0x29')](handleEntityNotFound(_0x154e26,null))[_0x2707('0x29')](function(_0x40c333){var _0x5852bd;var _0x4c4568={},_0x4a3a35={};_0x4a3a35[_0x2707('0x37')]=_[_0x2707('0x39')](db[_0x2707('0x58')]['rawAttributes']);_0x4a3a35['query']=_[_0x2707('0x39')](_0x185bd3[_0x2707('0x38')]);_0x4a3a35[_0x2707('0x3f')]=_[_0x2707('0x4b')](_0x4a3a35[_0x2707('0x37')],_0x4a3a35['query']);_0x4c4568['attributes']=_[_0x2707('0x4b')](_0x4a3a35[_0x2707('0x37')],qs[_0x2707('0x3b')](_0x185bd3[_0x2707('0x38')][_0x2707('0x3b')]));_0x4c4568[_0x2707('0x3a')]=_0x4c4568[_0x2707('0x3a')][_0x2707('0x4c')]?_0x4c4568[_0x2707('0x3a')]:_0x4a3a35['model'];if(!_0x185bd3[_0x2707('0x38')][_0x2707('0x59')](_0x2707('0x5a'))){_0x4c4568[_0x2707('0x1f')]=qs[_0x2707('0x1f')](_0x185bd3[_0x2707('0x38')]['limit']);_0x4c4568['offset']=qs[_0x2707('0x1d')](_0x185bd3[_0x2707('0x38')]['offset']);}_0x4c4568['order']=qs['sort'](_0x185bd3['query'][_0x2707('0x3d')]);_0x4c4568[_0x2707('0x3e')]=qs['filters'](_[_0x2707('0x40')](_0x185bd3[_0x2707('0x38')],_0x4a3a35[_0x2707('0x3f')]));if(_0x185bd3['query']['filter']){_0x4c4568[_0x2707('0x3e')]=_[_0x2707('0x42')](_0x4c4568[_0x2707('0x3e')],{'$or':_[_0x2707('0x31')](_0x4c4568[_0x2707('0x3a')],function(_0xdb1de0){var _0x3973a0={};_0x3973a0[_0xdb1de0]={'$like':'%'+_0x185bd3['query'][_0x2707('0x41')]+'%'};return _0x3973a0;})});}_0x4c4568[_0x2707('0x3e')]=_[_0x2707('0x42')](_0x4c4568[_0x2707('0x3e')],{'mailboxuser':_0x40c333[_0x2707('0x5b')]});_0x4c4568=_[_0x2707('0x42')]({},_0x4c4568,_0x185bd3['options']);return db[_0x2707('0x58')][_0x2707('0x5c')](_0x4c4568)[_0x2707('0x29')](respondWithFilteredResult(_0x154e26,_0x4c4568));})[_0x2707('0x49')](handleError(_0x154e26,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 3ed7842..96e29a6 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 _0xc541=['mailbox_context','mailbox','context','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes','exports','define','VoiceMail'];(function(_0x522d2b,_0xbdcd03){var _0x36f27e=function(_0x16a410){while(--_0x16a410){_0x522d2b['push'](_0x522d2b['shift']());}};_0x36f27e(++_0xbdcd03);}(_0xc541,0xf3));var _0x1c54=function(_0x30b0d8,_0x57470c){_0x30b0d8=_0x30b0d8-0x0;var _0x459c09=_0xc541[_0x30b0d8];return _0x459c09;};'use strict';var _=require(_0x1c54('0x0'));var util=require('util');var logger=require(_0x1c54('0x1'))(_0x1c54('0x2'));var moment=require(_0x1c54('0x3'));var BPromise=require(_0x1c54('0x4'));var rp=require(_0x1c54('0x5'));var fs=require('fs');var path=require(_0x1c54('0x6'));var rimraf=require(_0x1c54('0x7'));var config=require('../../config/environment');var attributes=require(_0x1c54('0x8'));module[_0x1c54('0x9')]=function(_0x50f61c,_0x511eeb){return _0x50f61c[_0x1c54('0xa')](_0x1c54('0xb'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x1c54('0xc'),'fields':[_0x1c54('0xd'),_0x1c54('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7914=['path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context','lodash','api','moment','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7914,0xa4));var _0x4791=function(_0x51dc6f,_0x20528c){_0x51dc6f=_0x51dc6f-0x0;var _0x352c00=_0x7914[_0x51dc6f];return _0x352c00;};'use strict';var _=require(_0x4791('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4791('0x1'));var moment=require(_0x4791('0x2'));var BPromise=require(_0x4791('0x3'));var rp=require(_0x4791('0x4'));var fs=require('fs');var path=require(_0x4791('0x5'));var rimraf=require(_0x4791('0x6'));var config=require(_0x4791('0x7'));var attributes=require(_0x4791('0x8'));module[_0x4791('0x9')]=function(_0x57651d,_0x5675a7){return _0x57651d[_0x4791('0xa')]('VoiceMail',attributes,{'tableName':_0x4791('0xb'),'paranoid':![],'indexes':[{'name':_0x4791('0xc'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 60a3511..df73994 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 _0x1233=['error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x1233,0x1a8));var _0x3123=function(_0x1ac6e5,_0x40f47f){_0x1ac6e5=_0x1ac6e5-0x0;var _0x5877dc=_0x1233[_0x1ac6e5];return _0x5877dc;};'use strict';var _=require(_0x3123('0x0'));var util=require('util');var moment=require(_0x3123('0x1'));var BPromise=require(_0x3123('0x2'));var rs=require(_0x3123('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3123('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3123('0x5'))(_0x3123('0x6'));var config=require(_0x3123('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3123('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb37129,_0x59052c,_0x4d4423){return new BPromise(function(_0x36047c,_0xd7ed4c){return client[_0x3123('0x9')](_0xb37129,_0x4d4423)[_0x3123('0xa')](function(_0x352e3e){logger[_0x3123('0xb')](_0x3123('0xc'),_0x59052c,_0x3123('0xd'));logger[_0x3123('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x59052c,_0x3123('0xd'),JSON[_0x3123('0xf')](_0x352e3e));if(_0x352e3e[_0x3123('0x10')]){if(_0x352e3e[_0x3123('0x10')][_0x3123('0x11')]===0x1f4){logger[_0x3123('0x10')](_0x3123('0xc'),_0x59052c,_0x352e3e[_0x3123('0x10')][_0x3123('0x12')]);return _0xd7ed4c(_0x352e3e[_0x3123('0x10')][_0x3123('0x12')]);}logger[_0x3123('0x10')]('VoiceMail,\x20%s,\x20%s',_0x59052c,_0x352e3e['error'][_0x3123('0x12')]);return _0x36047c(_0x352e3e[_0x3123('0x10')][_0x3123('0x12')]);}else{logger['info'](_0x3123('0xc'),_0x59052c,_0x3123('0xd'));_0x36047c(_0x352e3e[_0x3123('0x13')][_0x3123('0x12')]);}})['catch'](function(_0x67b0ad){logger[_0x3123('0x10')](_0x3123('0xc'),_0x59052c,_0x67b0ad);_0xd7ed4c(_0x67b0ad);});});} \ No newline at end of file +var _0x1d36=['VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1d36,0xd8));var _0x61d3=function(_0x255a06,_0x157a00){_0x255a06=_0x255a06-0x0;var _0x56656a=_0x1d36[_0x255a06];return _0x56656a;};'use strict';var _=require(_0x61d3('0x0'));var util=require(_0x61d3('0x1'));var moment=require(_0x61d3('0x2'));var BPromise=require(_0x61d3('0x3'));var rs=require(_0x61d3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x61d3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x61d3('0x6'))('rpc');var config=require(_0x61d3('0x7'));var jayson=require(_0x61d3('0x8'));var client=jayson[_0x61d3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22a5fe,_0x2785ad,_0x1ceef4){return new BPromise(function(_0x5bd56b,_0x448a0d){return client[_0x61d3('0xa')](_0x22a5fe,_0x1ceef4)[_0x61d3('0xb')](function(_0x5562cd){logger[_0x61d3('0xc')]('VoiceMail,\x20%s,\x20%s',_0x2785ad,_0x61d3('0xd'));logger[_0x61d3('0xe')](_0x61d3('0xf'),_0x2785ad,_0x61d3('0xd'),JSON[_0x61d3('0x10')](_0x5562cd));if(_0x5562cd[_0x61d3('0x11')]){if(_0x5562cd['error'][_0x61d3('0x12')]===0x1f4){logger[_0x61d3('0x11')](_0x61d3('0x13'),_0x2785ad,_0x5562cd['error'][_0x61d3('0x14')]);return _0x448a0d(_0x5562cd[_0x61d3('0x11')]['message']);}logger[_0x61d3('0x11')](_0x61d3('0x13'),_0x2785ad,_0x5562cd['error'][_0x61d3('0x14')]);return _0x5bd56b(_0x5562cd['error'][_0x61d3('0x14')]);}else{logger['info'](_0x61d3('0x13'),_0x2785ad,_0x61d3('0xd'));_0x5bd56b(_0x5562cd['result']['message']);}})['catch'](function(_0x29ce8d){logger[_0x61d3('0x11')]('VoiceMail,\x20%s,\x20%s',_0x2785ad,_0x29ce8d);_0x448a0d(_0x29ce8d);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index faedcf4..a8d7296 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 _0xe76c=['get','index','/:id','show','isAuthenticated','download','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller'];(function(_0x774aec,_0x865dd4){var _0x3b9230=function(_0x45b87f){while(--_0x45b87f){_0x774aec['push'](_0x774aec['shift']());}};_0x3b9230(++_0x865dd4);}(_0xe76c,0xdf));var _0xce76=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe76c[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xce76('0x0'));var util=require(_0xce76('0x1'));var path=require('path');var timeout=require(_0xce76('0x2'));var express=require(_0xce76('0x3'));var router=express['Router']();var fs_extra=require(_0xce76('0x4'));var auth=require(_0xce76('0x5'));var interaction=require(_0xce76('0x6'));var config=require('../../config/environment');var controller=require(_0xce76('0x7'));router[_0xce76('0x8')]('/',auth['isAuthenticated'](),controller[_0xce76('0x9')]);router['get'](_0xce76('0xa'),auth['isAuthenticated'](),controller[_0xce76('0xb')]);router[_0xce76('0x8')]('/:id/download',auth[_0xce76('0xc')](),controller[_0xce76('0xd')]);router[_0xce76('0xe')]('/',auth['isAuthenticated'](),controller[_0xce76('0xf')]);router[_0xce76('0x10')](_0xce76('0xa'),auth['isAuthenticated'](),controller[_0xce76('0x11')]);router[_0xce76('0x12')](_0xce76('0xa'),auth[_0xce76('0xc')](),controller[_0xce76('0x13')]);module[_0xce76('0x14')]=router; \ No newline at end of file +var _0x1cea=['/:id/download','download','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get','/:id','show'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0x1cea,0x1c1));var _0xa1ce=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x1cea[_0x45d55e];return _0x29812a;};'use strict';var multer=require(_0xa1ce('0x0'));var util=require(_0xa1ce('0x1'));var path=require('path');var timeout=require(_0xa1ce('0x2'));var express=require(_0xa1ce('0x3'));var router=express['Router']();var fs_extra=require(_0xa1ce('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa1ce('0x5'));var config=require(_0xa1ce('0x6'));var controller=require(_0xa1ce('0x7'));router['get']('/',auth[_0xa1ce('0x8')](),controller[_0xa1ce('0x9')]);router[_0xa1ce('0xa')](_0xa1ce('0xb'),auth[_0xa1ce('0x8')](),controller[_0xa1ce('0xc')]);router[_0xa1ce('0xa')](_0xa1ce('0xd'),auth[_0xa1ce('0x8')](),controller[_0xa1ce('0xe')]);router[_0xa1ce('0xf')]('/',auth[_0xa1ce('0x8')](),controller[_0xa1ce('0x10')]);router[_0xa1ce('0x11')](_0xa1ce('0xb'),auth['isAuthenticated'](),controller[_0xa1ce('0x12')]);router['delete'](_0xa1ce('0xb'),auth[_0xa1ce('0x8')](),controller[_0xa1ce('0x13')]);module[_0xa1ce('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 37b74c7..b2f9b57 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 _0x593a=['TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long'];(function(_0x2e2084,_0x278521){var _0x228fd6=function(_0x3c1fd0){while(--_0x3c1fd0){_0x2e2084['push'](_0x2e2084['shift']());}};_0x228fd6(++_0x278521);}(_0x593a,0x188));var _0xa593=function(_0x30c52a,_0x28f355){_0x30c52a=_0x30c52a-0x0;var _0x2f64a1=_0x593a[_0x30c52a];return _0x2f64a1;};'use strict';var Sequelize=require(_0xa593('0x0'));module[_0xa593('0x1')]={'name':{'type':Sequelize[_0xa593('0x2')],'get':function(_0xfb1108){return this[_0xa593('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xa593('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xa593('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa593('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xa593('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa593('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xa593('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xa593('0x6')](_0xa593('0x7')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa593('0x5')],'defaultValue':''},'stamp':{'type':_0xa593('0x8'),'defaultValue':Sequelize['literal'](_0xa593('0x9'))}}; \ No newline at end of file +var _0xbabf=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','STRING','BLOB','long','TIMESTAMP','literal'];(function(_0x58e891,_0x4d3aec){var _0x518e0b=function(_0x46aba1){while(--_0x46aba1){_0x58e891['push'](_0x58e891['shift']());}};_0x518e0b(++_0x4d3aec);}(_0xbabf,0x19b));var _0xfbab=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbabf[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xfbab('0x0'));module[_0xfbab('0x1')]={'name':{'type':Sequelize[_0xfbab('0x2')],'get':function(_0x18bcd2){return this[_0xfbab('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xfbab('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xfbab('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xfbab('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xfbab('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xfbab('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xfbab('0x5')](_0xfbab('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xfbab('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xfbab('0x7'),'defaultValue':Sequelize[_0xfbab('0x8')](_0xfbab('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 8ed90b4..1ad1bf7 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 _0xb022=['msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../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','then','destroy','error','stack','name','index','map','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','params','options','create','body','update','find','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment'];(function(_0x3ca364,_0x4724d1){var _0x12981e=function(_0x1abad2){while(--_0x1abad2){_0x3ca364['push'](_0x3ca364['shift']());}};_0x12981e(++_0x4724d1);}(_0xb022,0xb5));var _0x2b02=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xb022[_0x4c12ec];return _0x3ae42c;};'use strict';var emlformat=require(_0x2b02('0x0'));var rimraf=require(_0x2b02('0x1'));var zipdir=require(_0x2b02('0x2'));var jsonpatch=require(_0x2b02('0x3'));var rp=require(_0x2b02('0x4'));var moment=require('moment');var BPromise=require(_0x2b02('0x5'));var Mustache=require(_0x2b02('0x6'));var util=require('util');var path=require(_0x2b02('0x7'));var sox=require(_0x2b02('0x8'));var csv=require('to-csv');var ejs=require(_0x2b02('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b02('0xa'));var squel=require(_0x2b02('0xb'));var crypto=require('crypto');var jsforce=require(_0x2b02('0xc'));var deskjs=require(_0x2b02('0xd'));var toCsv=require(_0x2b02('0xe'));var querystring=require(_0x2b02('0xf'));var Papa=require('papaparse');var Redis=require(_0x2b02('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2b02('0x11'));var hardwareService=require(_0x2b02('0x12'));var logger=require('../../config/logger')(_0x2b02('0x13'));var utils=require(_0x2b02('0x14'));var config=require(_0x2b02('0x15'));var licenseUtil=require(_0x2b02('0x16'));var db=require(_0x2b02('0x17'))['db'];function respondWithStatusCode(_0x1cf7e0,_0x26f830){_0x26f830=_0x26f830||0xcc;return function(_0x5f53d4){if(_0x5f53d4){return _0x1cf7e0[_0x2b02('0x18')](_0x26f830);}return _0x1cf7e0[_0x2b02('0x19')](_0x26f830)[_0x2b02('0x1a')]();};}function respondWithResult(_0x42f89b,_0x5e6b23){_0x5e6b23=_0x5e6b23||0xc8;return function(_0x4d5670){if(_0x4d5670){return _0x42f89b[_0x2b02('0x19')](_0x5e6b23)['json'](_0x4d5670);}};}function respondWithFilteredResult(_0x5a75cb,_0x50f209){return function(_0x25a1a8){if(_0x25a1a8){var _0x1cf8f3=typeof _0x50f209[_0x2b02('0x1b')]===_0x2b02('0x1c')&&typeof _0x50f209[_0x2b02('0x1d')]==='undefined';var _0x35a51f=_0x25a1a8[_0x2b02('0x1e')];var _0x40edfb=_0x1cf8f3?0x0:_0x50f209[_0x2b02('0x1b')];var _0x2262b1=_0x1cf8f3?_0x25a1a8['count']:_0x50f209[_0x2b02('0x1b')]+_0x50f209[_0x2b02('0x1d')];var _0x5d6b65;if(_0x2262b1>=_0x35a51f){_0x2262b1=_0x35a51f;_0x5d6b65=0xc8;}else{_0x5d6b65=0xce;}_0x5a75cb[_0x2b02('0x19')](_0x5d6b65);return _0x5a75cb[_0x2b02('0x1f')](_0x2b02('0x20'),_0x40edfb+'-'+_0x2262b1+'/'+_0x35a51f)[_0x2b02('0x21')](_0x25a1a8);}return null;};}function patchUpdates(_0xd89722){return function(_0x370f52){try{jsonpatch[_0x2b02('0x22')](_0x370f52,_0xd89722,!![]);}catch(_0x19c39e){return BPromise[_0x2b02('0x23')](_0x19c39e);}return _0x370f52[_0x2b02('0x24')]();};}function saveUpdates(_0x43a5e7,_0x34fbcb){return function(_0x1c0406){if(_0x1c0406){return _0x1c0406['update'](_0x43a5e7)[_0x2b02('0x25')](function(_0x34d953){return _0x34d953;});}return null;};}function removeEntity(_0x424dda,_0x36910a){return function(_0xea371c){if(_0xea371c){return _0xea371c[_0x2b02('0x26')]()[_0x2b02('0x25')](function(){_0x424dda[_0x2b02('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41e41f,_0x240d5f){return function(_0x1c40e8){if(!_0x1c40e8){_0x41e41f[_0x2b02('0x18')](0x194);}return _0x1c40e8;};}function handleError(_0x415450,_0x197a3c){_0x197a3c=_0x197a3c||0x1f4;return function(_0x21fc48){logger[_0x2b02('0x27')](_0x21fc48[_0x2b02('0x28')]);if(_0x21fc48[_0x2b02('0x29')]){delete _0x21fc48['name'];}_0x415450[_0x2b02('0x19')](_0x197a3c)['send'](_0x21fc48);};}exports[_0x2b02('0x2a')]=function(_0x301880,_0x5ab785){var _0x266a57={},_0x2361b1={},_0x44917e={'count':0x0,'rows':[]};var _0x124532=_[_0x2b02('0x2b')](db[_0x2b02('0x2c')][_0x2b02('0x2d')],function(_0x5c0295){return{'name':_0x5c0295[_0x2b02('0x2e')],'type':_0x5c0295['type'][_0x2b02('0x2f')]};});_0x2361b1[_0x2b02('0x30')]=_[_0x2b02('0x31')](_[_0x2b02('0x2b')](_0x124532,'name'),[_0x2b02('0x29')]);_0x2361b1[_0x2b02('0x32')]=_[_0x2b02('0x33')](_0x301880[_0x2b02('0x32')]);_0x2361b1[_0x2b02('0x34')]=_[_0x2b02('0x35')](_0x2361b1[_0x2b02('0x30')],_0x2361b1[_0x2b02('0x32')]);_0x266a57[_0x2b02('0x36')]=_[_0x2b02('0x35')](_0x2361b1[_0x2b02('0x30')],qs['fields'](_0x301880[_0x2b02('0x32')][_0x2b02('0x37')]));_0x266a57[_0x2b02('0x36')]=_0x266a57[_0x2b02('0x36')][_0x2b02('0x38')]?_0x266a57[_0x2b02('0x36')]:_0x2361b1['model'];if(!_0x301880['query']['hasOwnProperty'](_0x2b02('0x39'))){_0x266a57[_0x2b02('0x1d')]=qs[_0x2b02('0x1d')](_0x301880[_0x2b02('0x32')][_0x2b02('0x1d')]);_0x266a57['offset']=qs[_0x2b02('0x1b')](_0x301880[_0x2b02('0x32')][_0x2b02('0x1b')]);}_0x266a57[_0x2b02('0x3a')]=qs[_0x2b02('0x3b')](_0x301880[_0x2b02('0x32')][_0x2b02('0x3b')]);_0x266a57[_0x2b02('0x3c')]=qs[_0x2b02('0x34')](_['pick'](_0x301880[_0x2b02('0x32')],_0x2361b1[_0x2b02('0x34')]),_0x124532);if(_0x301880['query'][_0x2b02('0x3d')]){_0x266a57[_0x2b02('0x3c')]=_[_0x2b02('0x3e')](_0x266a57['where'],{'$or':_['map'](_0x124532,function(_0x565701){if(_0x565701[_0x2b02('0x3f')]!==_0x2b02('0x40')){var _0x43b12c={};_0x43b12c[_0x565701[_0x2b02('0x29')]]={'$like':'%'+_0x301880[_0x2b02('0x32')][_0x2b02('0x3d')]+'%'};return _0x43b12c;}})});}_0x266a57=_['merge']({},_0x266a57,_0x301880['options']);var _0xeed0a={'where':_0x266a57[_0x2b02('0x3c')]};return db[_0x2b02('0x2c')][_0x2b02('0x1e')](_0xeed0a)[_0x2b02('0x25')](function(_0x5bb559){_0x44917e[_0x2b02('0x1e')]=_0x5bb559;if(_0x301880['query'][_0x2b02('0x41')]){_0x266a57[_0x2b02('0x42')]=[{'all':!![]}];}return db[_0x2b02('0x2c')][_0x2b02('0x43')](_0x266a57);})[_0x2b02('0x25')](function(_0x1a09a9){_0x44917e['rows']=_0x1a09a9;return _0x44917e;})[_0x2b02('0x25')](respondWithFilteredResult(_0x5ab785,_0x266a57))[_0x2b02('0x44')](handleError(_0x5ab785,null));};exports[_0x2b02('0x45')]=function(_0x11bc11,_0x320caf){var _0x22f242={'raw':!![],'where':{'id':_0x11bc11[_0x2b02('0x46')]['id']}},_0x4e66f7={};_0x4e66f7[_0x2b02('0x30')]=_[_0x2b02('0x33')](db[_0x2b02('0x2c')][_0x2b02('0x2d')]);_0x4e66f7[_0x2b02('0x32')]=_[_0x2b02('0x33')](_0x11bc11[_0x2b02('0x32')]);_0x4e66f7[_0x2b02('0x34')]=_['intersection'](_0x4e66f7[_0x2b02('0x30')],_0x4e66f7[_0x2b02('0x32')]);_0x22f242[_0x2b02('0x36')]=_[_0x2b02('0x35')](_0x4e66f7[_0x2b02('0x30')],qs[_0x2b02('0x37')](_0x11bc11[_0x2b02('0x32')]['fields']));_0x22f242[_0x2b02('0x36')]=_0x22f242[_0x2b02('0x36')][_0x2b02('0x38')]?_0x22f242[_0x2b02('0x36')]:_0x4e66f7['model'];if(_0x11bc11[_0x2b02('0x32')][_0x2b02('0x41')]){_0x22f242[_0x2b02('0x42')]=[{'all':!![]}];}_0x22f242=_[_0x2b02('0x3e')]({},_0x22f242,_0x11bc11[_0x2b02('0x47')]);return db[_0x2b02('0x2c')]['find'](_0x22f242)[_0x2b02('0x25')](handleEntityNotFound(_0x320caf,null))[_0x2b02('0x25')](respondWithResult(_0x320caf,null))['catch'](handleError(_0x320caf,null));};exports['create']=function(_0x6e1e99,_0x183270){return db[_0x2b02('0x2c')][_0x2b02('0x48')](_0x6e1e99[_0x2b02('0x49')],{})[_0x2b02('0x25')](respondWithResult(_0x183270,0xc9))['catch'](handleError(_0x183270,null));};exports[_0x2b02('0x4a')]=function(_0xfc31ca,_0x5c8d6a){if(_0xfc31ca['body']['id']){delete _0xfc31ca[_0x2b02('0x49')]['id'];}return db[_0x2b02('0x2c')][_0x2b02('0x4b')]({'where':{'id':_0xfc31ca[_0x2b02('0x46')]['id']}})['then'](handleEntityNotFound(_0x5c8d6a,null))[_0x2b02('0x25')](saveUpdates(_0xfc31ca[_0x2b02('0x49')],null))[_0x2b02('0x25')](respondWithResult(_0x5c8d6a,null))[_0x2b02('0x44')](handleError(_0x5c8d6a,null));};exports['destroy']=function(_0x13aff9,_0x3a758c){return db[_0x2b02('0x2c')][_0x2b02('0x4b')]({'where':{'id':_0x13aff9['params']['id']}})[_0x2b02('0x25')](handleEntityNotFound(_0x3a758c,null))[_0x2b02('0x25')](removeEntity(_0x3a758c,null))[_0x2b02('0x44')](handleError(_0x3a758c,null));};exports[_0x2b02('0x4c')]=function(_0x19e947,_0x40ad10,_0x48abea){return db[_0x2b02('0x2c')][_0x2b02('0x4b')]({'where':{'id':_0x19e947[_0x2b02('0x46')]['id']},'attributes':['id',_0x2b02('0x4d'),'msg_id']})[_0x2b02('0x25')](handleEntityNotFound(_0x40ad10,null))[_0x2b02('0x25')](function(_0x3519e7){if(_0x3519e7){if(!_0x3519e7['recording']){throw new db[(_0x2b02('0x4e'))][(_0x2b02('0x4f'))](_0x2b02('0x50'));}var _0x3a6fdd={'Content-Type':_0x2b02('0x51'),'Content-Disposition':_0x2b02('0x52')};if(_0x3519e7[_0x2b02('0x53')]){_0x3a6fdd[_0x2b02('0x54')]=_0x2b02('0x55')+_0x3519e7[_0x2b02('0x53')]+_0x2b02('0x56');}_0x40ad10['set'](_0x3a6fdd);return _0x40ad10[_0x2b02('0x57')](new Buffer(_0x3519e7[_0x2b02('0x4d')]));}})['catch'](handleError(_0x40ad10,null));}; \ No newline at end of file +var _0x274c=['fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','keys','includeAll','include','create','body','find','download','recording','msg_id','ValidationError','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','reject','save','then','destroy','end','error','stack','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes'];(function(_0x49eb7f,_0x23954a){var _0x3ba51a=function(_0x55ac52){while(--_0x55ac52){_0x49eb7f['push'](_0x49eb7f['shift']());}};_0x3ba51a(++_0x23954a);}(_0x274c,0xbd));var _0xc274=function(_0x330723,_0x8de382){_0x330723=_0x330723-0x0;var _0x60c546=_0x274c[_0x330723];return _0x60c546;};'use strict';var emlformat=require(_0xc274('0x0'));var rimraf=require(_0xc274('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc274('0x2'));var rp=require(_0xc274('0x3'));var moment=require(_0xc274('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc274('0x5'));var util=require(_0xc274('0x6'));var path=require(_0xc274('0x7'));var sox=require(_0xc274('0x8'));var csv=require(_0xc274('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc274('0xa'));var squel=require(_0xc274('0xb'));var crypto=require(_0xc274('0xc'));var jsforce=require(_0xc274('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc274('0x9'));var querystring=require(_0xc274('0xe'));var Papa=require(_0xc274('0xf'));var Redis=require(_0xc274('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc274('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc274('0x12'))(_0xc274('0x13'));var utils=require(_0xc274('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc274('0x15'));var db=require(_0xc274('0x16'))['db'];function respondWithStatusCode(_0x54827e,_0x1997ec){_0x1997ec=_0x1997ec||0xcc;return function(_0x27c3a5){if(_0x27c3a5){return _0x54827e[_0xc274('0x17')](_0x1997ec);}return _0x54827e[_0xc274('0x18')](_0x1997ec)['end']();};}function respondWithResult(_0x516f23,_0x56aaf2){_0x56aaf2=_0x56aaf2||0xc8;return function(_0x37efee){if(_0x37efee){return _0x516f23[_0xc274('0x18')](_0x56aaf2)[_0xc274('0x19')](_0x37efee);}};}function respondWithFilteredResult(_0x2f8672,_0x5e3378){return function(_0x10a26d){if(_0x10a26d){var _0x38a8fd=typeof _0x5e3378[_0xc274('0x1a')]==='undefined'&&typeof _0x5e3378[_0xc274('0x1b')]===_0xc274('0x1c');var _0x52461b=_0x10a26d['count'];var _0x3ac1eb=_0x38a8fd?0x0:_0x5e3378[_0xc274('0x1a')];var _0x2f9bc1=_0x38a8fd?_0x10a26d[_0xc274('0x1d')]:_0x5e3378[_0xc274('0x1a')]+_0x5e3378[_0xc274('0x1b')];var _0x4edef9;if(_0x2f9bc1>=_0x52461b){_0x2f9bc1=_0x52461b;_0x4edef9=0xc8;}else{_0x4edef9=0xce;}_0x2f8672[_0xc274('0x18')](_0x4edef9);return _0x2f8672[_0xc274('0x1e')]('Content-Range',_0x3ac1eb+'-'+_0x2f9bc1+'/'+_0x52461b)['json'](_0x10a26d);}return null;};}function patchUpdates(_0xbc3946){return function(_0x3f5da1){try{jsonpatch['apply'](_0x3f5da1,_0xbc3946,!![]);}catch(_0x4e175d){return BPromise[_0xc274('0x1f')](_0x4e175d);}return _0x3f5da1[_0xc274('0x20')]();};}function saveUpdates(_0xe6438,_0x393314){return function(_0x356215){if(_0x356215){return _0x356215['update'](_0xe6438)[_0xc274('0x21')](function(_0x1336e9){return _0x1336e9;});}return null;};}function removeEntity(_0x2b8b1a,_0x2771db){return function(_0x2fbed4){if(_0x2fbed4){return _0x2fbed4[_0xc274('0x22')]()[_0xc274('0x21')](function(){_0x2b8b1a[_0xc274('0x18')](0xcc)[_0xc274('0x23')]();});}};}function handleEntityNotFound(_0x5213de,_0xc61b4f){return function(_0x3b3829){if(!_0x3b3829){_0x5213de[_0xc274('0x17')](0x194);}return _0x3b3829;};}function handleError(_0x3dc7be,_0xca78ec){_0xca78ec=_0xca78ec||0x1f4;return function(_0x28acc9){logger[_0xc274('0x24')](_0x28acc9[_0xc274('0x25')]);if(_0x28acc9['name']){delete _0x28acc9['name'];}_0x3dc7be[_0xc274('0x18')](_0xca78ec)['send'](_0x28acc9);};}exports[_0xc274('0x26')]=function(_0x1bec7a,_0x3c5389){var _0x58b04f={},_0x3a40cf={},_0x195860={'count':0x0,'rows':[]};var _0x135779=_[_0xc274('0x27')](db[_0xc274('0x28')][_0xc274('0x29')],function(_0x3d7593){return{'name':_0x3d7593[_0xc274('0x2a')],'type':_0x3d7593[_0xc274('0x2b')][_0xc274('0x2c')]};});_0x3a40cf[_0xc274('0x2d')]=_['differenceBy'](_[_0xc274('0x27')](_0x135779,_0xc274('0x2e')),[_0xc274('0x2e')]);_0x3a40cf[_0xc274('0x2f')]=_['keys'](_0x1bec7a[_0xc274('0x2f')]);_0x3a40cf[_0xc274('0x30')]=_[_0xc274('0x31')](_0x3a40cf[_0xc274('0x2d')],_0x3a40cf[_0xc274('0x2f')]);_0x58b04f[_0xc274('0x32')]=_['intersection'](_0x3a40cf['model'],qs['fields'](_0x1bec7a[_0xc274('0x2f')][_0xc274('0x33')]));_0x58b04f[_0xc274('0x32')]=_0x58b04f['attributes'][_0xc274('0x34')]?_0x58b04f[_0xc274('0x32')]:_0x3a40cf[_0xc274('0x2d')];if(!_0x1bec7a[_0xc274('0x2f')][_0xc274('0x35')](_0xc274('0x36'))){_0x58b04f[_0xc274('0x1b')]=qs[_0xc274('0x1b')](_0x1bec7a[_0xc274('0x2f')][_0xc274('0x1b')]);_0x58b04f[_0xc274('0x1a')]=qs[_0xc274('0x1a')](_0x1bec7a[_0xc274('0x2f')][_0xc274('0x1a')]);}_0x58b04f['order']=qs[_0xc274('0x37')](_0x1bec7a[_0xc274('0x2f')][_0xc274('0x37')]);_0x58b04f[_0xc274('0x38')]=qs['filters'](_['pick'](_0x1bec7a[_0xc274('0x2f')],_0x3a40cf['filters']),_0x135779);if(_0x1bec7a['query']['filter']){_0x58b04f[_0xc274('0x38')]=_[_0xc274('0x39')](_0x58b04f[_0xc274('0x38')],{'$or':_[_0xc274('0x27')](_0x135779,function(_0x23853e){if(_0x23853e[_0xc274('0x2b')]!==_0xc274('0x3a')){var _0x4886ed={};_0x4886ed[_0x23853e['name']]={'$like':'%'+_0x1bec7a['query'][_0xc274('0x3b')]+'%'};return _0x4886ed;}})});}_0x58b04f=_[_0xc274('0x39')]({},_0x58b04f,_0x1bec7a[_0xc274('0x3c')]);var _0x2126dd={'where':_0x58b04f['where']};return db[_0xc274('0x28')][_0xc274('0x1d')](_0x2126dd)[_0xc274('0x21')](function(_0x217e62){_0x195860['count']=_0x217e62;if(_0x1bec7a[_0xc274('0x2f')]['includeAll']){_0x58b04f['include']=[{'all':!![]}];}return db[_0xc274('0x28')][_0xc274('0x3d')](_0x58b04f);})['then'](function(_0x2bbfb1){_0x195860[_0xc274('0x3e')]=_0x2bbfb1;return _0x195860;})['then'](respondWithFilteredResult(_0x3c5389,_0x58b04f))[_0xc274('0x3f')](handleError(_0x3c5389,null));};exports[_0xc274('0x40')]=function(_0x41fd44,_0x3e4c83){var _0x19e7b1={'raw':!![],'where':{'id':_0x41fd44[_0xc274('0x41')]['id']}},_0x33ba06={};_0x33ba06[_0xc274('0x2d')]=_[_0xc274('0x42')](db[_0xc274('0x28')][_0xc274('0x29')]);_0x33ba06[_0xc274('0x2f')]=_['keys'](_0x41fd44['query']);_0x33ba06[_0xc274('0x30')]=_['intersection'](_0x33ba06[_0xc274('0x2d')],_0x33ba06[_0xc274('0x2f')]);_0x19e7b1[_0xc274('0x32')]=_[_0xc274('0x31')](_0x33ba06[_0xc274('0x2d')],qs[_0xc274('0x33')](_0x41fd44[_0xc274('0x2f')][_0xc274('0x33')]));_0x19e7b1[_0xc274('0x32')]=_0x19e7b1[_0xc274('0x32')][_0xc274('0x34')]?_0x19e7b1[_0xc274('0x32')]:_0x33ba06[_0xc274('0x2d')];if(_0x41fd44[_0xc274('0x2f')][_0xc274('0x43')]){_0x19e7b1[_0xc274('0x44')]=[{'all':!![]}];}_0x19e7b1=_[_0xc274('0x39')]({},_0x19e7b1,_0x41fd44[_0xc274('0x3c')]);return db['VoiceMailMessage']['find'](_0x19e7b1)[_0xc274('0x21')](handleEntityNotFound(_0x3e4c83,null))[_0xc274('0x21')](respondWithResult(_0x3e4c83,null))[_0xc274('0x3f')](handleError(_0x3e4c83,null));};exports[_0xc274('0x45')]=function(_0x218bb6,_0x2e747f){return db[_0xc274('0x28')][_0xc274('0x45')](_0x218bb6[_0xc274('0x46')],{})[_0xc274('0x21')](respondWithResult(_0x2e747f,0xc9))[_0xc274('0x3f')](handleError(_0x2e747f,null));};exports['update']=function(_0x2f0655,_0x422b06){if(_0x2f0655[_0xc274('0x46')]['id']){delete _0x2f0655['body']['id'];}return db[_0xc274('0x28')][_0xc274('0x47')]({'where':{'id':_0x2f0655['params']['id']}})[_0xc274('0x21')](handleEntityNotFound(_0x422b06,null))[_0xc274('0x21')](saveUpdates(_0x2f0655[_0xc274('0x46')],null))[_0xc274('0x21')](respondWithResult(_0x422b06,null))['catch'](handleError(_0x422b06,null));};exports[_0xc274('0x22')]=function(_0xce9edb,_0x50ecdc){return db['VoiceMailMessage']['find']({'where':{'id':_0xce9edb[_0xc274('0x41')]['id']}})[_0xc274('0x21')](handleEntityNotFound(_0x50ecdc,null))['then'](removeEntity(_0x50ecdc,null))[_0xc274('0x3f')](handleError(_0x50ecdc,null));};exports[_0xc274('0x48')]=function(_0x25ad2d,_0x30572b,_0x5cbe9c){return db[_0xc274('0x28')]['find']({'where':{'id':_0x25ad2d[_0xc274('0x41')]['id']},'attributes':['id',_0xc274('0x49'),_0xc274('0x4a')]})[_0xc274('0x21')](handleEntityNotFound(_0x30572b,null))[_0xc274('0x21')](function(_0x4b2349){if(_0x4b2349){if(!_0x4b2349['recording']){throw new db['Sequelize'][(_0xc274('0x4b'))]('VoiceMailMessage\x20not\x20found');}var _0x286cb4={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x4b2349[_0xc274('0x4a')]){_0x286cb4[_0xc274('0x4c')]=_0xc274('0x4d')+_0x4b2349['msg_id']+_0xc274('0x4e');}_0x30572b['set'](_0x286cb4);return _0x30572b[_0xc274('0x4f')](new Buffer(_0x4b2349['recording']));}})['catch'](handleError(_0x30572b,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 6c90283..ffe209e 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 _0x1e72=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','util','../../config/logger','api','moment'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x1e72,0xd9));var _0x21e7=function(_0x42b31e,_0x3bdef4){_0x42b31e=_0x42b31e-0x0;var _0x4b92e6=_0x1e72[_0x42b31e];return _0x4b92e6;};'use strict';var _=require('lodash');var util=require(_0x21e7('0x0'));var logger=require(_0x21e7('0x1'))(_0x21e7('0x2'));var moment=require(_0x21e7('0x3'));var BPromise=require(_0x21e7('0x4'));var rp=require(_0x21e7('0x5'));var fs=require('fs');var path=require(_0x21e7('0x6'));var rimraf=require(_0x21e7('0x7'));var config=require(_0x21e7('0x8'));var attributes=require(_0x21e7('0x9'));module['exports']=function(_0x2f5e3c,_0x1cbca0){return _0x2f5e3c[_0x21e7('0xa')](_0x21e7('0xb'),attributes,{'tableName':_0x21e7('0xc'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x258b=['dir','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage'];(function(_0x414559,_0x3a1eb8){var _0x1428fa=function(_0x39954c){while(--_0x39954c){_0x414559['push'](_0x414559['shift']());}};_0x1428fa(++_0x3a1eb8);}(_0x258b,0x139));var _0xb258=function(_0x141ea1,_0x562d74){_0x141ea1=_0x141ea1-0x0;var _0x2d8f38=_0x258b[_0x141ea1];return _0x2d8f38;};'use strict';var _=require(_0xb258('0x0'));var util=require(_0xb258('0x1'));var logger=require(_0xb258('0x2'))(_0xb258('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb258('0x4'));var fs=require('fs');var path=require(_0xb258('0x5'));var rimraf=require(_0xb258('0x6'));var config=require(_0xb258('0x7'));var attributes=require(_0xb258('0x8'));module[_0xb258('0x9')]=function(_0x3d875e,_0x5483bf){return _0x3d875e[_0xb258('0xa')](_0xb258('0xb'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xb258('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 e6f94c8..0209761 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 _0x543e=['../../config/logger','../../config/environment','jayson/promise','client','http','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4d0662,_0x145963){var _0x6eea6d=function(_0x2def06){while(--_0x2def06){_0x4d0662['push'](_0x4d0662['shift']());}};_0x6eea6d(++_0x145963);}(_0x543e,0x10b));var _0xe543=function(_0x3a369a,_0x39ec53){_0x3a369a=_0x3a369a-0x0;var _0x579192=_0x543e[_0x3a369a];return _0x579192;};'use strict';var _=require(_0xe543('0x0'));var util=require(_0xe543('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe543('0x2'));var fs=require('fs');var Redis=require(_0xe543('0x3'));var db=require(_0xe543('0x4'))['db'];var utils=require(_0xe543('0x5'));var logger=require(_0xe543('0x6'))('rpc');var config=require(_0xe543('0x7'));var jayson=require(_0xe543('0x8'));var client=jayson[_0xe543('0x9')][_0xe543('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1981af,_0x321d77,_0x458a42){return new BPromise(function(_0x34b9ca,_0x101efe){return client['request'](_0x1981af,_0x458a42)['then'](function(_0xbfa666){logger[_0xe543('0xb')](_0xe543('0xc'),_0x321d77,_0xe543('0xd'));logger[_0xe543('0xe')](_0xe543('0xf'),_0x321d77,_0xe543('0xd'),JSON[_0xe543('0x10')](_0xbfa666));if(_0xbfa666['error']){if(_0xbfa666[_0xe543('0x11')][_0xe543('0x12')]===0x1f4){logger[_0xe543('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x321d77,_0xbfa666[_0xe543('0x11')][_0xe543('0x13')]);return _0x101efe(_0xbfa666[_0xe543('0x11')][_0xe543('0x13')]);}logger[_0xe543('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x321d77,_0xbfa666['error']['message']);return _0x34b9ca(_0xbfa666['error'][_0xe543('0x13')]);}else{logger[_0xe543('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x321d77,_0xe543('0xd'));_0x34b9ca(_0xbfa666['result'][_0xe543('0x13')]);}})[_0xe543('0x14')](function(_0x3e3390){logger[_0xe543('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x321d77,_0x3e3390);_0x101efe(_0x3e3390);});});} \ No newline at end of file +var _0x813e=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x40f9a0,_0x5908b3){var _0x28bd41=function(_0x261f04){while(--_0x261f04){_0x40f9a0['push'](_0x40f9a0['shift']());}};_0x28bd41(++_0x5908b3);}(_0x813e,0x189));var _0xe813=function(_0x368726,_0x4a651d){_0x368726=_0x368726-0x0;var _0x3fc2e7=_0x813e[_0x368726];return _0x3fc2e7;};'use strict';var _=require(_0xe813('0x0'));var util=require(_0xe813('0x1'));var moment=require(_0xe813('0x2'));var BPromise=require(_0xe813('0x3'));var rs=require(_0xe813('0x4'));var fs=require('fs');var Redis=require(_0xe813('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe813('0x6'));var logger=require(_0xe813('0x7'))(_0xe813('0x8'));var config=require(_0xe813('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe813('0xa')][_0xe813('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41e22f,_0x5a28dc,_0xbd6c9c){return new BPromise(function(_0x4edcc3,_0x3e543e){return client[_0xe813('0xc')](_0x41e22f,_0xbd6c9c)['then'](function(_0x2abb75){logger['info'](_0xe813('0xd'),_0x5a28dc,_0xe813('0xe'));logger['debug'](_0xe813('0xf'),_0x5a28dc,_0xe813('0xe'),JSON[_0xe813('0x10')](_0x2abb75));if(_0x2abb75[_0xe813('0x11')]){if(_0x2abb75[_0xe813('0x11')][_0xe813('0x12')]===0x1f4){logger[_0xe813('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x5a28dc,_0x2abb75[_0xe813('0x11')][_0xe813('0x13')]);return _0x3e543e(_0x2abb75[_0xe813('0x11')][_0xe813('0x13')]);}logger[_0xe813('0x11')](_0xe813('0xd'),_0x5a28dc,_0x2abb75[_0xe813('0x11')][_0xe813('0x13')]);return _0x4edcc3(_0x2abb75[_0xe813('0x11')][_0xe813('0x13')]);}else{logger[_0xe813('0x14')](_0xe813('0xd'),_0x5a28dc,_0xe813('0xe'));_0x4edcc3(_0x2abb75[_0xe813('0x15')][_0xe813('0x13')]);}})[_0xe813('0x16')](function(_0x3988a1){logger['error'](_0xe813('0xd'),_0x5a28dc,_0x3988a1);_0x3e543e(_0x3988a1);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 8380251..9ff0aba 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 _0x43dc=['/:id/sounds/:id2','removeSound','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','/:id/sounds','post','create','addSound','put','delete','destroy'];(function(_0x54b283,_0x5eb8a6){var _0x2462b3=function(_0x13fca7){while(--_0x13fca7){_0x54b283['push'](_0x54b283['shift']());}};_0x2462b3(++_0x5eb8a6);}(_0x43dc,0xab));var _0xc43d=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x43dc[_0x4c445a];return _0x2f611c;};'use strict';var multer=require(_0xc43d('0x0'));var util=require('util');var path=require(_0xc43d('0x1'));var timeout=require('connect-timeout');var express=require(_0xc43d('0x2'));var router=express['Router']();var fs_extra=require(_0xc43d('0x3'));var auth=require(_0xc43d('0x4'));var interaction=require(_0xc43d('0x5'));var config=require(_0xc43d('0x6'));var controller=require(_0xc43d('0x7'));router[_0xc43d('0x8')]('/',auth[_0xc43d('0x9')](),controller['index']);router[_0xc43d('0x8')](_0xc43d('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xc43d('0x8')](_0xc43d('0xb'),auth[_0xc43d('0x9')](),controller['getSounds']);router[_0xc43d('0xc')]('/',auth[_0xc43d('0x9')](),controller[_0xc43d('0xd')]);router['post']('/:id/sounds',auth[_0xc43d('0x9')](),controller[_0xc43d('0xe')]);router[_0xc43d('0xf')](_0xc43d('0xa'),auth[_0xc43d('0x9')](),controller['update']);router[_0xc43d('0x10')](_0xc43d('0xa'),auth['isAuthenticated'](),controller[_0xc43d('0x11')]);router['delete'](_0xc43d('0x12'),auth[_0xc43d('0x9')](),controller[_0xc43d('0x13')]);module[_0xc43d('0x14')]=router; \ No newline at end of file +var _0xc55f=['/:id/sounds','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getSounds','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc55f,0xef));var _0xfc55=function(_0x373462,_0x595406){_0x373462=_0x373462-0x0;var _0x1efdc7=_0xc55f[_0x373462];return _0x1efdc7;};'use strict';var multer=require(_0xfc55('0x0'));var util=require('util');var path=require(_0xfc55('0x1'));var timeout=require(_0xfc55('0x2'));var express=require(_0xfc55('0x3'));var router=express[_0xfc55('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfc55('0x5'));var config=require(_0xfc55('0x6'));var controller=require('./voiceMusicOnHold.controller');router[_0xfc55('0x7')]('/',auth[_0xfc55('0x8')](),controller[_0xfc55('0x9')]);router[_0xfc55('0x7')](_0xfc55('0xa'),auth['isAuthenticated'](),controller[_0xfc55('0xb')]);router['get']('/:id/sounds',auth['isAuthenticated'](),controller[_0xfc55('0xc')]);router['post']('/',auth[_0xfc55('0x8')](),controller['create']);router[_0xfc55('0xd')](_0xfc55('0xe'),auth['isAuthenticated'](),controller[_0xfc55('0xf')]);router[_0xfc55('0x10')](_0xfc55('0xa'),auth[_0xfc55('0x8')](),controller[_0xfc55('0x11')]);router[_0xfc55('0x12')](_0xfc55('0xa'),auth[_0xfc55('0x8')](),controller[_0xfc55('0x13')]);router[_0xfc55('0x12')](_0xfc55('0x14'),auth['isAuthenticated'](),controller[_0xfc55('0x15')]);module[_0xfc55('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 174350b..90fe449 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 _0xdf8a=['STRING','alpha','TIMESTAMP','sequelize','name','ENUM','quietmp3','files'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xdf8a,0x7b));var _0xadf8=function(_0x257b0e,_0x563d7e){_0x257b0e=_0x257b0e-0x0;var _0x27ac2a=_0xdf8a[_0x257b0e];return _0x27ac2a;};'use strict';var Sequelize=require(_0xadf8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xadf8('0x1')},'mode':{'type':Sequelize[_0xadf8('0x2')]('custom','files','mp3nb','quietmp3nb',_0xadf8('0x3'),'mp3'),'allowNull':!![],'defaultValue':_0xadf8('0x4')},'directory':{'type':Sequelize[_0xadf8('0x5')],'allowNull':!![]},'application':{'type':Sequelize[_0xadf8('0x5')],'allowNull':!![]},'digit':{'type':Sequelize[_0xadf8('0x5')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xadf8('0x6')},'format':{'type':Sequelize[_0xadf8('0x5')],'allowNull':!![]},'stamp':{'type':_0xadf8('0x7')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5d14=['TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3','mp3','alpha'];(function(_0x3e8670,_0x5d39a7){var _0x1c3f6f=function(_0x32c547){while(--_0x32c547){_0x3e8670['push'](_0x3e8670['shift']());}};_0x1c3f6f(++_0x5d39a7);}(_0x5d14,0x188));var _0x45d1=function(_0x100e0c,_0x5523b8){_0x100e0c=_0x100e0c-0x0;var _0x4db1aa=_0x5d14[_0x100e0c];return _0x4db1aa;};'use strict';var Sequelize=require(_0x45d1('0x0'));module[_0x45d1('0x1')]={'name':{'type':Sequelize[_0x45d1('0x2')],'allowNull':![],'unique':_0x45d1('0x3')},'mode':{'type':Sequelize[_0x45d1('0x4')](_0x45d1('0x5'),_0x45d1('0x6'),_0x45d1('0x7'),'quietmp3nb',_0x45d1('0x8'),_0x45d1('0x9')),'allowNull':!![],'defaultValue':_0x45d1('0x6')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x45d1('0x2')],'allowNull':!![],'defaultValue':_0x45d1('0xa')},'format':{'type':Sequelize[_0x45d1('0x2')],'allowNull':!![]},'stamp':{'type':_0x45d1('0xb')},'defaultEntry':{'type':Sequelize[_0x45d1('0xc')],'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 faa21e2..5d41432 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 _0x65cc=['send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','server/files/sounds/converted','format','%s.%s','symlinkSync','message','removeSound','id2','createdAt','order','pick','getSounds','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','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','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','MusicOnHolds','error','stack','name'];(function(_0x5a7ea1,_0x192405){var _0x268960=function(_0x2671ed){while(--_0x2671ed){_0x5a7ea1['push'](_0x5a7ea1['shift']());}};_0x268960(++_0x192405);}(_0x65cc,0x138));var _0xc65c=function(_0x4982a5,_0xad13ed){_0x4982a5=_0x4982a5-0x0;var _0x26f5ff=_0x65cc[_0x4982a5];return _0x26f5ff;};'use strict';var emlformat=require(_0xc65c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc65c('0x1'));var jsonpatch=require(_0xc65c('0x2'));var rp=require(_0xc65c('0x3'));var moment=require('moment');var BPromise=require(_0xc65c('0x4'));var Mustache=require(_0xc65c('0x5'));var util=require(_0xc65c('0x6'));var path=require(_0xc65c('0x7'));var sox=require(_0xc65c('0x8'));var csv=require(_0xc65c('0x9'));var ejs=require(_0xc65c('0xa'));var fs=require('fs');var fs_extra=require(_0xc65c('0xb'));var _=require(_0xc65c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc65c('0xd'));var deskjs=require(_0xc65c('0xe'));var toCsv=require(_0xc65c('0x9'));var querystring=require(_0xc65c('0xf'));var Papa=require(_0xc65c('0x10'));var Redis=require(_0xc65c('0x11'));var authService=require(_0xc65c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc65c('0x13'));var hardwareService=require(_0xc65c('0x14'));var logger=require(_0xc65c('0x15'))(_0xc65c('0x16'));var utils=require(_0xc65c('0x17'));var config=require(_0xc65c('0x18'));var licenseUtil=require(_0xc65c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x249aaa,_0x8a794d){_0x8a794d=_0x8a794d||0xcc;return function(_0x3fe8f0){if(_0x3fe8f0){return _0x249aaa[_0xc65c('0x1a')](_0x8a794d);}return _0x249aaa['status'](_0x8a794d)[_0xc65c('0x1b')]();};}function respondWithResult(_0x58c711,_0x507539){_0x507539=_0x507539||0xc8;return function(_0x3647e9){if(_0x3647e9){return _0x58c711[_0xc65c('0x1c')](_0x507539)['json'](_0x3647e9);}};}function respondWithFilteredResult(_0x86b30c,_0x134d01){return function(_0x3b7e96){if(_0x3b7e96){var _0x117194=typeof _0x134d01['offset']===_0xc65c('0x1d')&&typeof _0x134d01[_0xc65c('0x1e')]===_0xc65c('0x1d');var _0x3b3b09=_0x3b7e96[_0xc65c('0x1f')];var _0xdc1c85=_0x117194?0x0:_0x134d01[_0xc65c('0x20')];var _0x247ce3=_0x117194?_0x3b7e96[_0xc65c('0x1f')]:_0x134d01[_0xc65c('0x20')]+_0x134d01[_0xc65c('0x1e')];var _0x18cf8c;if(_0x247ce3>=_0x3b3b09){_0x247ce3=_0x3b3b09;_0x18cf8c=0xc8;}else{_0x18cf8c=0xce;}_0x86b30c[_0xc65c('0x1c')](_0x18cf8c);return _0x86b30c[_0xc65c('0x21')](_0xc65c('0x22'),_0xdc1c85+'-'+_0x247ce3+'/'+_0x3b3b09)['json'](_0x3b7e96);}return null;};}function patchUpdates(_0x4cd666){return function(_0x3d6a82){try{jsonpatch[_0xc65c('0x23')](_0x3d6a82,_0x4cd666,!![]);}catch(_0xb1175){return BPromise[_0xc65c('0x24')](_0xb1175);}return _0x3d6a82[_0xc65c('0x25')]();};}function saveUpdates(_0x1cec77,_0x33c756){return function(_0x1b7c47){if(_0x1b7c47){return _0x1b7c47[_0xc65c('0x26')](_0x1cec77)['then'](function(_0x9373b){return _0x9373b;});}return null;};}function removeEntity(_0x3fa063,_0xec1db1){return function(_0x3d5dda){if(_0x3d5dda){return _0x3d5dda[_0xc65c('0x27')]()[_0xc65c('0x28')](function(){var _0x5cec91=_0x3d5dda['get']({'plain':!![]});var _0x4db7ae=_0xc65c('0x29');return db['UserProfileResource'][_0xc65c('0x27')]({'where':{'type':_0x4db7ae,'resourceId':_0x5cec91['id']}})['then'](function(){return _0x3d5dda;});})[_0xc65c('0x28')](function(){_0x3fa063[_0xc65c('0x1c')](0xcc)[_0xc65c('0x1b')]();});}};}function handleEntityNotFound(_0x439f42,_0x4f9d8c){return function(_0x1444a8){if(!_0x1444a8){_0x439f42['sendStatus'](0x194);}return _0x1444a8;};}function handleError(_0x2ead58,_0x24e8f0){_0x24e8f0=_0x24e8f0||0x1f4;return function(_0x2bb9ae){logger[_0xc65c('0x2a')](_0x2bb9ae[_0xc65c('0x2b')]);if(_0x2bb9ae[_0xc65c('0x2c')]){delete _0x2bb9ae[_0xc65c('0x2c')];}_0x2ead58['status'](_0x24e8f0)[_0xc65c('0x2d')](_0x2bb9ae);};}exports[_0xc65c('0x2e')]=function(_0x12edf3,_0x26b3ae){var _0x4d0e88={},_0x13f1a9={},_0xef0e69={'count':0x0,'rows':[]};var _0x530219=_['map'](db[_0xc65c('0x2f')][_0xc65c('0x30')],function(_0x446b87){return{'name':_0x446b87[_0xc65c('0x31')],'type':_0x446b87[_0xc65c('0x32')][_0xc65c('0x33')]};});_0x13f1a9[_0xc65c('0x34')]=_[_0xc65c('0x35')](_0x530219,_0xc65c('0x2c'));_0x13f1a9[_0xc65c('0x36')]=_[_0xc65c('0x37')](_0x12edf3[_0xc65c('0x36')]);_0x13f1a9[_0xc65c('0x38')]=_[_0xc65c('0x39')](_0x13f1a9['model'],_0x13f1a9[_0xc65c('0x36')]);_0x4d0e88[_0xc65c('0x3a')]=_[_0xc65c('0x39')](_0x13f1a9[_0xc65c('0x34')],qs[_0xc65c('0x3b')](_0x12edf3['query'][_0xc65c('0x3b')]));_0x4d0e88[_0xc65c('0x3a')]=_0x4d0e88[_0xc65c('0x3a')][_0xc65c('0x3c')]?_0x4d0e88[_0xc65c('0x3a')]:_0x13f1a9[_0xc65c('0x34')];if(!_0x12edf3[_0xc65c('0x36')]['hasOwnProperty']('nolimit')){_0x4d0e88[_0xc65c('0x1e')]=qs[_0xc65c('0x1e')](_0x12edf3[_0xc65c('0x36')][_0xc65c('0x1e')]);_0x4d0e88[_0xc65c('0x20')]=qs[_0xc65c('0x20')](_0x12edf3[_0xc65c('0x36')][_0xc65c('0x20')]);}_0x4d0e88['order']=qs[_0xc65c('0x3d')](_0x12edf3[_0xc65c('0x36')][_0xc65c('0x3d')]);delete _0x12edf3[_0xc65c('0x36')][_0xc65c('0x3d')];_0x4d0e88['where']=qs[_0xc65c('0x38')](_['pick'](_0x12edf3[_0xc65c('0x36')],_0x13f1a9[_0xc65c('0x38')]),_0x530219);if(_0x12edf3[_0xc65c('0x36')][_0xc65c('0x3e')]){_0x4d0e88[_0xc65c('0x3f')]=_['merge'](_0x4d0e88[_0xc65c('0x3f')],{'$or':_[_0xc65c('0x35')](_0x530219,function(_0x254811){if(_0x254811[_0xc65c('0x32')]!==_0xc65c('0x40')){var _0x1aed4f={};_0x1aed4f[_0x254811[_0xc65c('0x2c')]]={'$like':'%'+_0x12edf3[_0xc65c('0x36')][_0xc65c('0x3e')]+'%'};return _0x1aed4f;}})});}_0x4d0e88=_[_0xc65c('0x41')]({},_0x4d0e88,_0x12edf3[_0xc65c('0x42')]);var _0xaeb6d6={'where':_0x4d0e88[_0xc65c('0x3f')]};return db['VoiceMusicOnHold'][_0xc65c('0x1f')](_0xaeb6d6)[_0xc65c('0x28')](function(_0x227b0e){_0xef0e69[_0xc65c('0x1f')]=_0x227b0e;if(_0x12edf3[_0xc65c('0x36')][_0xc65c('0x43')]){_0x4d0e88[_0xc65c('0x44')]=[{'all':!![]}];}return db[_0xc65c('0x2f')][_0xc65c('0x45')](_0x4d0e88);})['then'](function(_0x267919){_0xef0e69[_0xc65c('0x46')]=_0x267919;return _0xef0e69;})['then'](respondWithFilteredResult(_0x26b3ae,_0x4d0e88))[_0xc65c('0x47')](handleError(_0x26b3ae,null));};exports[_0xc65c('0x48')]=function(_0x186078,_0x38f9a4){var _0x496857={'raw':![],'where':{'id':_0x186078[_0xc65c('0x49')]['id']}},_0x5eddee={};_0x5eddee[_0xc65c('0x34')]=_['keys'](db[_0xc65c('0x2f')][_0xc65c('0x30')]);_0x5eddee['query']=_[_0xc65c('0x37')](_0x186078[_0xc65c('0x36')]);_0x5eddee['filters']=_[_0xc65c('0x39')](_0x5eddee[_0xc65c('0x34')],_0x5eddee[_0xc65c('0x36')]);_0x496857[_0xc65c('0x3a')]=_[_0xc65c('0x39')](_0x5eddee[_0xc65c('0x34')],qs[_0xc65c('0x3b')](_0x186078['query'][_0xc65c('0x3b')]));_0x496857[_0xc65c('0x3a')]=_0x496857[_0xc65c('0x3a')]['length']?_0x496857['attributes']:_0x5eddee[_0xc65c('0x34')];if(_0x186078[_0xc65c('0x36')][_0xc65c('0x43')]){_0x496857[_0xc65c('0x44')]=[{'all':!![]}];}_0x496857=_[_0xc65c('0x41')]({},_0x496857,_0x186078[_0xc65c('0x42')]);return db[_0xc65c('0x2f')][_0xc65c('0x4a')](_0x496857)['then'](handleEntityNotFound(_0x38f9a4,null))[_0xc65c('0x28')](respondWithResult(_0x38f9a4,null))['catch'](handleError(_0x38f9a4,null));};exports[_0xc65c('0x26')]=function(_0x5c75c3,_0x58571f){if(_0x5c75c3[_0xc65c('0x4b')]['id']){delete _0x5c75c3[_0xc65c('0x4b')]['id'];}return db[_0xc65c('0x2f')][_0xc65c('0x4a')]({'where':{'id':_0x5c75c3[_0xc65c('0x49')]['id']}})[_0xc65c('0x28')](handleEntityNotFound(_0x58571f,null))[_0xc65c('0x28')](saveUpdates(_0x5c75c3[_0xc65c('0x4b')],null))['then'](respondWithResult(_0x58571f,null))[_0xc65c('0x47')](handleError(_0x58571f,null));};exports[_0xc65c('0x4c')]=function(_0x49615a,_0x36cffd,_0x404d31){return db[_0xc65c('0x4d')][_0xc65c('0x4e')](function(_0x17bf46){if(_0x49615a[_0xc65c('0x4b')][_0xc65c('0x4f')]===_0xc65c('0x50')){_0x49615a[_0xc65c('0x4b')][_0xc65c('0x51')]=path[_0xc65c('0x52')](config[_0xc65c('0x53')],_0xc65c('0x54'),_0x49615a['body'][_0xc65c('0x2c')]);}return db[_0xc65c('0x2f')][_0xc65c('0x4c')](_0x49615a['body'],{'transaction':_0x17bf46})['then'](function(_0x27a51a){if(_0x49615a[_0xc65c('0x4b')][_0xc65c('0x4f')]===_0xc65c('0x50')){fs[_0xc65c('0x55')](_0x27a51a[_0xc65c('0x51')],parseInt(_0xc65c('0x56'),0x8));}var _0x26d7bb=_0x49615a['user'][_0xc65c('0x57')]({'plain':!![]});if(!_0x26d7bb)throw new Error(_0xc65c('0x58'));if(_0x26d7bb[_0xc65c('0x59')]===_0xc65c('0x5a')){var _0x5af4eb=_0x27a51a[_0xc65c('0x57')]({'plain':!![]});return db[_0xc65c('0x5b')][_0xc65c('0x4a')]({'where':{'name':_0xc65c('0x29'),'userProfileId':_0x26d7bb[_0xc65c('0x5c')]},'raw':!![]})[_0xc65c('0x28')](function(_0xac16d){if(_0xac16d&&_0xac16d[_0xc65c('0x5d')]===0x0){return db[_0xc65c('0x5e')][_0xc65c('0x4c')]({'name':_0x5af4eb['name'],'resourceId':_0x5af4eb['id'],'type':_0xac16d['name'],'sectionId':_0xac16d['id']},{})[_0xc65c('0x28')](function(){return _0x27a51a;});}else{return _0x27a51a;}})[_0xc65c('0x47')](function(_0x2c10a0){logger['error'](_0xc65c('0x5f'),_0x2c10a0);});}return _0x27a51a;});})['then'](respondWithResult(_0x36cffd,0xc9))[_0xc65c('0x47')](handleError(_0x36cffd,null));};exports[_0xc65c('0x27')]=function(_0x11c033,_0x284512,_0x5848ad){var _0x411f6c;return db[_0xc65c('0x2f')][_0xc65c('0x4a')]({'where':{'id':_0x11c033['params']['id']}})['then'](function(_0x10d6ce){if(_0x10d6ce){return db[_0xc65c('0x4d')][_0xc65c('0x4e')](function(_0x5e42d2){return _0x10d6ce['destroy']({'transaction':_0x5e42d2,'raw':!![]})[_0xc65c('0x28')](function(_0x6096c7){if(_0x6096c7[_0xc65c('0x51')]){fs[_0xc65c('0x60')](_0x6096c7[_0xc65c('0x51')])[_0xc65c('0x61')](function(_0x1b354e){fs[_0xc65c('0x62')](path[_0xc65c('0x52')](_0x6096c7[_0xc65c('0x51')],_0x1b354e));});fs[_0xc65c('0x63')](_0x6096c7[_0xc65c('0x51')]);}return _0x6096c7;});})['catch'](function(_0x315809){throw new db[(_0xc65c('0x64'))][(_0xc65c('0x65'))](_0x315809['message']);});}})[_0xc65c('0x28')](handleEntityNotFound(_0x284512,null))[_0xc65c('0x28')](removeEntity(_0x284512,null))[_0xc65c('0x47')](handleError(_0x284512,null));};exports[_0xc65c('0x66')]=function(_0x568403,_0x33aaae,_0x3df0cd){return db[_0xc65c('0x4d')][_0xc65c('0x4e')](function(_0x523abe){var _0x43aab9;return db[_0xc65c('0x2f')][_0xc65c('0x4a')]({'where':{'id':_0x568403['params']['id']}})[_0xc65c('0x28')](function(_0x67526e){if(_0x67526e){_0x43aab9=_0x67526e;return _0x67526e[_0xc65c('0x66')](_0x568403['body']['id'],{'transaction':_0x523abe});}})[_0xc65c('0x28')](function(_0x1f81e4){if(_0x1f81e4){return db[_0xc65c('0x67')][_0xc65c('0x68')]({'where':{'id':_0x568403[_0xc65c('0x4b')]['id']},'attributes':['id',_0xc65c('0x2c'),_0xc65c('0x69'),_0xc65c('0x6a'),'createdAt'],'raw':!![]});}})[_0xc65c('0x28')](function(_0x5c2644){if(_0x5c2644){var _0x5a8376=path['join'](config[_0xc65c('0x53')],_0xc65c('0x6b'),util[_0xc65c('0x6c')](_0xc65c('0x6d'),path['basename'](_0x5c2644[_0xc65c('0x69')],path['extname'](_0x5c2644['save_name'])),_0x5c2644['converted_format']));var _0x2e0d94=path[_0xc65c('0x52')](config[_0xc65c('0x53')],_0xc65c('0x54'),_0x43aab9[_0xc65c('0x2c')],util[_0xc65c('0x6c')](_0xc65c('0x6d'),_0x5c2644[_0xc65c('0x2c')],_0x5c2644[_0xc65c('0x6a')]));fs[_0xc65c('0x6e')](_0x5a8376,_0x2e0d94);return _0x5c2644;}})[_0xc65c('0x47')](function(_0x29c3c8){throw new db[(_0xc65c('0x64'))]['ValidationError'](_0x29c3c8[_0xc65c('0x6f')]);});})[_0xc65c('0x28')](handleEntityNotFound(_0x33aaae,null))[_0xc65c('0x28')](respondWithResult(_0x33aaae,0xc9))[_0xc65c('0x47')](handleError(_0x33aaae,null));};exports[_0xc65c('0x70')]=function(_0xd219da,_0x463e74,_0x13ff3c){return db[_0xc65c('0x4d')][_0xc65c('0x4e')](function(_0x1895c4){var _0x82794;return db[_0xc65c('0x2f')][_0xc65c('0x68')]({'where':{'id':_0xd219da[_0xc65c('0x49')]['id']}})['then'](handleEntityNotFound(_0x463e74,null))[_0xc65c('0x28')](function(_0xec6892){if(_0xec6892){_0x82794=_0xec6892;return _0xec6892['removeSound'](_0xd219da[_0xc65c('0x49')]['id2']);}})[_0xc65c('0x28')](function(_0x2d6fda){if(_0x2d6fda){return db[_0xc65c('0x67')][_0xc65c('0x68')]({'where':{'id':_0xd219da[_0xc65c('0x49')][_0xc65c('0x71')]},'attributes':['id',_0xc65c('0x2c'),_0xc65c('0x69'),_0xc65c('0x6a'),_0xc65c('0x72')],'raw':!![]});}})['then'](function(_0x14134e){if(_0x14134e){fs[_0xc65c('0x62')](path['join'](_0x82794['directory'],util[_0xc65c('0x6c')](_0xc65c('0x6d'),_0x14134e[_0xc65c('0x2c')],_0x14134e[_0xc65c('0x6a')])));return _0x14134e;}})[_0xc65c('0x47')](function(_0x3dc7cf){throw new db[(_0xc65c('0x64'))][(_0xc65c('0x65'))](_0x3dc7cf[_0xc65c('0x6f')]);});})[_0xc65c('0x28')](handleEntityNotFound(_0x463e74,null))[_0xc65c('0x28')](respondWithStatusCode(_0x463e74,0xcc))[_0xc65c('0x47')](handleError(_0x463e74,null));};exports['getSounds']=function(_0x317339,_0x49ce5e,_0x49d28a){var _0x439b84={};var _0x108623={};var _0x5e2474;var _0x12a1c8;return db[_0xc65c('0x2f')]['findOne']({'where':{'id':_0x317339['params']['id']}})[_0xc65c('0x28')](handleEntityNotFound(_0x49ce5e,null))[_0xc65c('0x28')](function(_0x4116d8){if(_0x4116d8){_0x5e2474=_0x4116d8;_0x108623[_0xc65c('0x34')]=_[_0xc65c('0x37')](db[_0xc65c('0x67')][_0xc65c('0x30')]);_0x108623['query']=_['keys'](_0x317339[_0xc65c('0x36')]);_0x108623['filters']=_[_0xc65c('0x39')](_0x108623[_0xc65c('0x34')],_0x108623[_0xc65c('0x36')]);_0x439b84[_0xc65c('0x3a')]=_[_0xc65c('0x39')](_0x108623['model'],qs['fields'](_0x317339['query']['fields']));_0x439b84[_0xc65c('0x3a')]=_0x439b84[_0xc65c('0x3a')][_0xc65c('0x3c')]?_0x439b84[_0xc65c('0x3a')]:_0x108623[_0xc65c('0x34')];_0x439b84[_0xc65c('0x73')]=qs[_0xc65c('0x3d')](_0x317339[_0xc65c('0x36')][_0xc65c('0x3d')]);_0x439b84[_0xc65c('0x3f')]=qs[_0xc65c('0x38')](_[_0xc65c('0x74')](_0x317339['query'],_0x108623[_0xc65c('0x38')]));if(_0x317339['query'][_0xc65c('0x3e')]){_0x439b84[_0xc65c('0x3f')]=_[_0xc65c('0x41')](_0x439b84[_0xc65c('0x3f')],{'$or':_['map'](_0x439b84[_0xc65c('0x3a')],function(_0x1bd4de){var _0x3e6249={};_0x3e6249[_0x1bd4de]={'$like':'%'+_0x317339[_0xc65c('0x36')][_0xc65c('0x3e')]+'%'};return _0x3e6249;})});}_0x439b84=_[_0xc65c('0x41')]({},_0x439b84,_0x317339[_0xc65c('0x42')]);return _0x5e2474[_0xc65c('0x75')](_0x439b84);}})[_0xc65c('0x28')](function(_0x3ad48b){if(_0x3ad48b){_0x12a1c8=_0x3ad48b[_0xc65c('0x3c')];if(!_0x317339['query']['hasOwnProperty'](_0xc65c('0x76'))){_0x439b84[_0xc65c('0x1e')]=qs['limit'](_0x317339[_0xc65c('0x36')]['limit']);_0x439b84['offset']=qs[_0xc65c('0x20')](_0x317339[_0xc65c('0x36')]['offset']);}return _0x5e2474[_0xc65c('0x75')](_0x439b84);}})['then'](function(_0x2339e8){if(_0x2339e8){return _0x2339e8?{'count':_0x12a1c8,'rows':_0x2339e8}:null;}})[_0xc65c('0x28')](respondWithResult(_0x49ce5e,null))[_0xc65c('0x47')](handleError(_0x49ce5e,null));}; \ No newline at end of file +var _0x5da6=['include','find','catch','body','create','sequelize','mode','files','join','root','mkdirSync','directory','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','transaction','readdirSync','unlinkSync','ValidationError','addSound','Sound','findOne','save_name','createdAt','server/files/sounds/converted','format','%s.%s','extname','server/files/moh','converted_format','Sequelize','message','removeSound','id2','getSounds','filters','sort','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','get','MusicOnHolds','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','options','VoiceMusicOnHold','findAll','show','params','includeAll'];(function(_0x20c312,_0x28250d){var _0x4542de=function(_0x426fee){while(--_0x426fee){_0x20c312['push'](_0x20c312['shift']());}};_0x4542de(++_0x28250d);}(_0x5da6,0x164));var _0x65da=function(_0x1f6eca,_0x34351b){_0x1f6eca=_0x1f6eca-0x0;var _0x18159b=_0x5da6[_0x1f6eca];return _0x18159b;};'use strict';var emlformat=require(_0x65da('0x0'));var rimraf=require(_0x65da('0x1'));var zipdir=require(_0x65da('0x2'));var jsonpatch=require(_0x65da('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x65da('0x4'));var Mustache=require(_0x65da('0x5'));var util=require('util');var path=require('path');var sox=require(_0x65da('0x6'));var csv=require('to-csv');var ejs=require(_0x65da('0x7'));var fs=require('fs');var fs_extra=require(_0x65da('0x8'));var _=require(_0x65da('0x9'));var squel=require(_0x65da('0xa'));var crypto=require('crypto');var jsforce=require(_0x65da('0xb'));var deskjs=require(_0x65da('0xc'));var toCsv=require(_0x65da('0xd'));var querystring=require(_0x65da('0xe'));var Papa=require(_0x65da('0xf'));var Redis=require(_0x65da('0x10'));var authService=require(_0x65da('0x11'));var qs=require(_0x65da('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x65da('0x13'));var utils=require(_0x65da('0x14'));var config=require(_0x65da('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e95aa,_0x6daaa9){_0x6daaa9=_0x6daaa9||0xcc;return function(_0x3f0639){if(_0x3f0639){return _0x4e95aa[_0x65da('0x16')](_0x6daaa9);}return _0x4e95aa[_0x65da('0x17')](_0x6daaa9)[_0x65da('0x18')]();};}function respondWithResult(_0x49969d,_0x50bdc8){_0x50bdc8=_0x50bdc8||0xc8;return function(_0x592603){if(_0x592603){return _0x49969d[_0x65da('0x17')](_0x50bdc8)[_0x65da('0x19')](_0x592603);}};}function respondWithFilteredResult(_0xdbf501,_0x2ad387){return function(_0x4debea){if(_0x4debea){var _0xd8cf3a=typeof _0x2ad387[_0x65da('0x1a')]===_0x65da('0x1b')&&typeof _0x2ad387[_0x65da('0x1c')]===_0x65da('0x1b');var _0x35d187=_0x4debea[_0x65da('0x1d')];var _0x389876=_0xd8cf3a?0x0:_0x2ad387[_0x65da('0x1a')];var _0x3a18e8=_0xd8cf3a?_0x4debea['count']:_0x2ad387[_0x65da('0x1a')]+_0x2ad387['limit'];var _0x347928;if(_0x3a18e8>=_0x35d187){_0x3a18e8=_0x35d187;_0x347928=0xc8;}else{_0x347928=0xce;}_0xdbf501[_0x65da('0x17')](_0x347928);return _0xdbf501[_0x65da('0x1e')](_0x65da('0x1f'),_0x389876+'-'+_0x3a18e8+'/'+_0x35d187)[_0x65da('0x19')](_0x4debea);}return null;};}function patchUpdates(_0x1de9d0){return function(_0x13da9a){try{jsonpatch['apply'](_0x13da9a,_0x1de9d0,!![]);}catch(_0x26cf02){return BPromise[_0x65da('0x20')](_0x26cf02);}return _0x13da9a['save']();};}function saveUpdates(_0x36a82b,_0x35ba77){return function(_0x735e6c){if(_0x735e6c){return _0x735e6c[_0x65da('0x21')](_0x36a82b)['then'](function(_0x5acc6e){return _0x5acc6e;});}return null;};}function removeEntity(_0x135506,_0x47fc57){return function(_0x9ac8f6){if(_0x9ac8f6){return _0x9ac8f6['destroy']()[_0x65da('0x22')](function(){var _0x262e6c=_0x9ac8f6[_0x65da('0x23')]({'plain':!![]});var _0x174863=_0x65da('0x24');return db[_0x65da('0x25')][_0x65da('0x26')]({'where':{'type':_0x174863,'resourceId':_0x262e6c['id']}})[_0x65da('0x22')](function(){return _0x9ac8f6;});})[_0x65da('0x22')](function(){_0x135506[_0x65da('0x17')](0xcc)[_0x65da('0x18')]();});}};}function handleEntityNotFound(_0x248557,_0x7dafd1){return function(_0x4e7e48){if(!_0x4e7e48){_0x248557['sendStatus'](0x194);}return _0x4e7e48;};}function handleError(_0x55713f,_0x1608dc){_0x1608dc=_0x1608dc||0x1f4;return function(_0x1c7ba9){logger[_0x65da('0x27')](_0x1c7ba9[_0x65da('0x28')]);if(_0x1c7ba9[_0x65da('0x29')]){delete _0x1c7ba9[_0x65da('0x29')];}_0x55713f['status'](_0x1608dc)[_0x65da('0x2a')](_0x1c7ba9);};}exports[_0x65da('0x2b')]=function(_0x221f95,_0x15eca4){var _0xbcd86d={},_0x12d528={},_0x51696e={'count':0x0,'rows':[]};var _0x352023=_[_0x65da('0x2c')](db['VoiceMusicOnHold'][_0x65da('0x2d')],function(_0x269b5a){return{'name':_0x269b5a[_0x65da('0x2e')],'type':_0x269b5a[_0x65da('0x2f')][_0x65da('0x30')]};});_0x12d528[_0x65da('0x31')]=_[_0x65da('0x2c')](_0x352023,_0x65da('0x29'));_0x12d528[_0x65da('0x32')]=_[_0x65da('0x33')](_0x221f95[_0x65da('0x32')]);_0x12d528['filters']=_[_0x65da('0x34')](_0x12d528[_0x65da('0x31')],_0x12d528[_0x65da('0x32')]);_0xbcd86d['attributes']=_[_0x65da('0x34')](_0x12d528['model'],qs[_0x65da('0x35')](_0x221f95['query']['fields']));_0xbcd86d['attributes']=_0xbcd86d[_0x65da('0x36')][_0x65da('0x37')]?_0xbcd86d[_0x65da('0x36')]:_0x12d528[_0x65da('0x31')];if(!_0x221f95[_0x65da('0x32')][_0x65da('0x38')](_0x65da('0x39'))){_0xbcd86d[_0x65da('0x1c')]=qs[_0x65da('0x1c')](_0x221f95[_0x65da('0x32')][_0x65da('0x1c')]);_0xbcd86d[_0x65da('0x1a')]=qs['offset'](_0x221f95[_0x65da('0x32')][_0x65da('0x1a')]);}_0xbcd86d['order']=qs['sort'](_0x221f95[_0x65da('0x32')]['sort']);delete _0x221f95[_0x65da('0x32')]['sort'];_0xbcd86d[_0x65da('0x3a')]=qs['filters'](_[_0x65da('0x3b')](_0x221f95[_0x65da('0x32')],_0x12d528['filters']),_0x352023);if(_0x221f95[_0x65da('0x32')][_0x65da('0x3c')]){_0xbcd86d[_0x65da('0x3a')]=_['merge'](_0xbcd86d[_0x65da('0x3a')],{'$or':_[_0x65da('0x2c')](_0x352023,function(_0x4a05e1){if(_0x4a05e1[_0x65da('0x2f')]!=='VIRTUAL'){var _0x42ad4f={};_0x42ad4f[_0x4a05e1[_0x65da('0x29')]]={'$like':'%'+_0x221f95[_0x65da('0x32')]['filter']+'%'};return _0x42ad4f;}})});}_0xbcd86d=_[_0x65da('0x3d')]({},_0xbcd86d,_0x221f95[_0x65da('0x3e')]);var _0x19183a={'where':_0xbcd86d[_0x65da('0x3a')]};return db[_0x65da('0x3f')][_0x65da('0x1d')](_0x19183a)[_0x65da('0x22')](function(_0x58030b){_0x51696e[_0x65da('0x1d')]=_0x58030b;if(_0x221f95[_0x65da('0x32')]['includeAll']){_0xbcd86d['include']=[{'all':!![]}];}return db[_0x65da('0x3f')][_0x65da('0x40')](_0xbcd86d);})[_0x65da('0x22')](function(_0x812d9f){_0x51696e['rows']=_0x812d9f;return _0x51696e;})[_0x65da('0x22')](respondWithFilteredResult(_0x15eca4,_0xbcd86d))['catch'](handleError(_0x15eca4,null));};exports[_0x65da('0x41')]=function(_0xde9316,_0x39bc8a){var _0x218e09={'raw':![],'where':{'id':_0xde9316[_0x65da('0x42')]['id']}},_0x202871={};_0x202871[_0x65da('0x31')]=_[_0x65da('0x33')](db[_0x65da('0x3f')]['rawAttributes']);_0x202871[_0x65da('0x32')]=_[_0x65da('0x33')](_0xde9316[_0x65da('0x32')]);_0x202871['filters']=_[_0x65da('0x34')](_0x202871[_0x65da('0x31')],_0x202871[_0x65da('0x32')]);_0x218e09[_0x65da('0x36')]=_[_0x65da('0x34')](_0x202871[_0x65da('0x31')],qs['fields'](_0xde9316[_0x65da('0x32')][_0x65da('0x35')]));_0x218e09[_0x65da('0x36')]=_0x218e09[_0x65da('0x36')][_0x65da('0x37')]?_0x218e09[_0x65da('0x36')]:_0x202871['model'];if(_0xde9316[_0x65da('0x32')][_0x65da('0x43')]){_0x218e09[_0x65da('0x44')]=[{'all':!![]}];}_0x218e09=_[_0x65da('0x3d')]({},_0x218e09,_0xde9316[_0x65da('0x3e')]);return db['VoiceMusicOnHold'][_0x65da('0x45')](_0x218e09)['then'](handleEntityNotFound(_0x39bc8a,null))[_0x65da('0x22')](respondWithResult(_0x39bc8a,null))[_0x65da('0x46')](handleError(_0x39bc8a,null));};exports[_0x65da('0x21')]=function(_0x31055f,_0x4bbe06){if(_0x31055f['body']['id']){delete _0x31055f[_0x65da('0x47')]['id'];}return db[_0x65da('0x3f')][_0x65da('0x45')]({'where':{'id':_0x31055f[_0x65da('0x42')]['id']}})[_0x65da('0x22')](handleEntityNotFound(_0x4bbe06,null))['then'](saveUpdates(_0x31055f[_0x65da('0x47')],null))[_0x65da('0x22')](respondWithResult(_0x4bbe06,null))[_0x65da('0x46')](handleError(_0x4bbe06,null));};exports[_0x65da('0x48')]=function(_0x333610,_0x169c39,_0x45c536){return db[_0x65da('0x49')]['transaction'](function(_0x4ac5fc){if(_0x333610[_0x65da('0x47')][_0x65da('0x4a')]===_0x65da('0x4b')){_0x333610[_0x65da('0x47')]['directory']=path[_0x65da('0x4c')](config[_0x65da('0x4d')],'server/files/moh',_0x333610[_0x65da('0x47')][_0x65da('0x29')]);}return db['VoiceMusicOnHold']['create'](_0x333610['body'],{'transaction':_0x4ac5fc})['then'](function(_0x1d309a){if(_0x333610['body'][_0x65da('0x4a')]===_0x65da('0x4b')){fs[_0x65da('0x4e')](_0x1d309a[_0x65da('0x4f')],parseInt(_0x65da('0x50'),0x8));}var _0x2841e4=_0x333610['user'][_0x65da('0x23')]({'plain':!![]});if(!_0x2841e4)throw new Error(_0x65da('0x51'));if(_0x2841e4['role']===_0x65da('0x52')){var _0x3029e4=_0x1d309a[_0x65da('0x23')]({'plain':!![]});return db['UserProfileSection'][_0x65da('0x45')]({'where':{'name':_0x65da('0x24'),'userProfileId':_0x2841e4['userProfileId']},'raw':!![]})[_0x65da('0x22')](function(_0x3488e3){if(_0x3488e3&&_0x3488e3[_0x65da('0x53')]===0x0){return db['UserProfileResource'][_0x65da('0x48')]({'name':_0x3029e4[_0x65da('0x29')],'resourceId':_0x3029e4['id'],'type':_0x3488e3[_0x65da('0x29')],'sectionId':_0x3488e3['id']},{})[_0x65da('0x22')](function(){return _0x1d309a;});}else{return _0x1d309a;}})[_0x65da('0x46')](function(_0x324d29){logger[_0x65da('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x324d29);});}return _0x1d309a;});})[_0x65da('0x22')](respondWithResult(_0x169c39,0xc9))[_0x65da('0x46')](handleError(_0x169c39,null));};exports[_0x65da('0x26')]=function(_0x45204d,_0x40b713,_0x58b846){var _0x2f1bf9;return db[_0x65da('0x3f')]['find']({'where':{'id':_0x45204d[_0x65da('0x42')]['id']}})[_0x65da('0x22')](function(_0x410fcd){if(_0x410fcd){return db[_0x65da('0x49')][_0x65da('0x54')](function(_0x328b1a){return _0x410fcd[_0x65da('0x26')]({'transaction':_0x328b1a,'raw':!![]})[_0x65da('0x22')](function(_0x3870c7){if(_0x3870c7['directory']){fs[_0x65da('0x55')](_0x3870c7['directory'])['forEach'](function(_0xbecb36){fs[_0x65da('0x56')](path['join'](_0x3870c7[_0x65da('0x4f')],_0xbecb36));});fs['rmdirSync'](_0x3870c7['directory']);}return _0x3870c7;});})[_0x65da('0x46')](function(_0x469d56){throw new db['Sequelize'][(_0x65da('0x57'))](_0x469d56['message']);});}})[_0x65da('0x22')](handleEntityNotFound(_0x40b713,null))[_0x65da('0x22')](removeEntity(_0x40b713,null))[_0x65da('0x46')](handleError(_0x40b713,null));};exports[_0x65da('0x58')]=function(_0x2ca34c,_0x89b234,_0x54b7dd){return db['sequelize'][_0x65da('0x54')](function(_0x147a6f){var _0x1c0c32;return db[_0x65da('0x3f')]['find']({'where':{'id':_0x2ca34c[_0x65da('0x42')]['id']}})['then'](function(_0x2b49c9){if(_0x2b49c9){_0x1c0c32=_0x2b49c9;return _0x2b49c9[_0x65da('0x58')](_0x2ca34c['body']['id'],{'transaction':_0x147a6f});}})[_0x65da('0x22')](function(_0x2684cb){if(_0x2684cb){return db[_0x65da('0x59')][_0x65da('0x5a')]({'where':{'id':_0x2ca34c[_0x65da('0x47')]['id']},'attributes':['id',_0x65da('0x29'),_0x65da('0x5b'),'converted_format',_0x65da('0x5c')],'raw':!![]});}})['then'](function(_0x4e30a4){if(_0x4e30a4){var _0x31211f=path[_0x65da('0x4c')](config[_0x65da('0x4d')],_0x65da('0x5d'),util[_0x65da('0x5e')](_0x65da('0x5f'),path['basename'](_0x4e30a4[_0x65da('0x5b')],path[_0x65da('0x60')](_0x4e30a4[_0x65da('0x5b')])),_0x4e30a4['converted_format']));var _0x164639=path[_0x65da('0x4c')](config[_0x65da('0x4d')],_0x65da('0x61'),_0x1c0c32[_0x65da('0x29')],util[_0x65da('0x5e')](_0x65da('0x5f'),_0x4e30a4[_0x65da('0x29')],_0x4e30a4[_0x65da('0x62')]));fs['symlinkSync'](_0x31211f,_0x164639);return _0x4e30a4;}})[_0x65da('0x46')](function(_0x5045af){throw new db[(_0x65da('0x63'))]['ValidationError'](_0x5045af[_0x65da('0x64')]);});})['then'](handleEntityNotFound(_0x89b234,null))['then'](respondWithResult(_0x89b234,0xc9))[_0x65da('0x46')](handleError(_0x89b234,null));};exports[_0x65da('0x65')]=function(_0x531165,_0x5acecb,_0x50bad2){return db[_0x65da('0x49')][_0x65da('0x54')](function(_0x56ca56){var _0x9dca82;return db[_0x65da('0x3f')]['findOne']({'where':{'id':_0x531165[_0x65da('0x42')]['id']}})[_0x65da('0x22')](handleEntityNotFound(_0x5acecb,null))[_0x65da('0x22')](function(_0x545340){if(_0x545340){_0x9dca82=_0x545340;return _0x545340[_0x65da('0x65')](_0x531165[_0x65da('0x42')]['id2']);}})[_0x65da('0x22')](function(_0x260e55){if(_0x260e55){return db['Sound'][_0x65da('0x5a')]({'where':{'id':_0x531165['params'][_0x65da('0x66')]},'attributes':['id',_0x65da('0x29'),_0x65da('0x5b'),'converted_format',_0x65da('0x5c')],'raw':!![]});}})[_0x65da('0x22')](function(_0x237d7b){if(_0x237d7b){fs[_0x65da('0x56')](path[_0x65da('0x4c')](_0x9dca82[_0x65da('0x4f')],util[_0x65da('0x5e')](_0x65da('0x5f'),_0x237d7b['name'],_0x237d7b['converted_format'])));return _0x237d7b;}})['catch'](function(_0x92c865){throw new db['Sequelize'][(_0x65da('0x57'))](_0x92c865[_0x65da('0x64')]);});})[_0x65da('0x22')](handleEntityNotFound(_0x5acecb,null))[_0x65da('0x22')](respondWithStatusCode(_0x5acecb,0xcc))['catch'](handleError(_0x5acecb,null));};exports[_0x65da('0x67')]=function(_0x45c404,_0x3a45aa,_0x293e6e){var _0x37ae72={};var _0x319c7c={};var _0x2cc5cb;var _0x46f89c;return db[_0x65da('0x3f')]['findOne']({'where':{'id':_0x45c404[_0x65da('0x42')]['id']}})['then'](handleEntityNotFound(_0x3a45aa,null))[_0x65da('0x22')](function(_0x488626){if(_0x488626){_0x2cc5cb=_0x488626;_0x319c7c[_0x65da('0x31')]=_[_0x65da('0x33')](db[_0x65da('0x59')][_0x65da('0x2d')]);_0x319c7c[_0x65da('0x32')]=_[_0x65da('0x33')](_0x45c404[_0x65da('0x32')]);_0x319c7c[_0x65da('0x68')]=_[_0x65da('0x34')](_0x319c7c['model'],_0x319c7c[_0x65da('0x32')]);_0x37ae72[_0x65da('0x36')]=_['intersection'](_0x319c7c['model'],qs['fields'](_0x45c404[_0x65da('0x32')][_0x65da('0x35')]));_0x37ae72[_0x65da('0x36')]=_0x37ae72['attributes'][_0x65da('0x37')]?_0x37ae72[_0x65da('0x36')]:_0x319c7c[_0x65da('0x31')];_0x37ae72['order']=qs['sort'](_0x45c404[_0x65da('0x32')][_0x65da('0x69')]);_0x37ae72[_0x65da('0x3a')]=qs[_0x65da('0x68')](_[_0x65da('0x3b')](_0x45c404['query'],_0x319c7c[_0x65da('0x68')]));if(_0x45c404[_0x65da('0x32')][_0x65da('0x3c')]){_0x37ae72[_0x65da('0x3a')]=_[_0x65da('0x3d')](_0x37ae72[_0x65da('0x3a')],{'$or':_[_0x65da('0x2c')](_0x37ae72['attributes'],function(_0x427e16){var _0x2a6ed4={};_0x2a6ed4[_0x427e16]={'$like':'%'+_0x45c404['query'][_0x65da('0x3c')]+'%'};return _0x2a6ed4;})});}_0x37ae72=_[_0x65da('0x3d')]({},_0x37ae72,_0x45c404[_0x65da('0x3e')]);return _0x2cc5cb[_0x65da('0x67')](_0x37ae72);}})[_0x65da('0x22')](function(_0x2dcc48){if(_0x2dcc48){_0x46f89c=_0x2dcc48[_0x65da('0x37')];if(!_0x45c404[_0x65da('0x32')][_0x65da('0x38')](_0x65da('0x39'))){_0x37ae72[_0x65da('0x1c')]=qs[_0x65da('0x1c')](_0x45c404['query'][_0x65da('0x1c')]);_0x37ae72[_0x65da('0x1a')]=qs[_0x65da('0x1a')](_0x45c404['query']['offset']);}return _0x2cc5cb[_0x65da('0x67')](_0x37ae72);}})[_0x65da('0x22')](function(_0xf66966){if(_0xf66966){return _0xf66966?{'count':_0x46f89c,'rows':_0xf66966}:null;}})['then'](respondWithResult(_0x3a45aa,null))[_0x65da('0x46')](handleError(_0x3a45aa,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index cf6268e..2cacf6a 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 _0xaaf0=['bluebird','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','moment'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xaaf0,0x1a1));var _0x0aaf=function(_0x578300,_0x1f3103){_0x578300=_0x578300-0x0;var _0x1b2682=_0xaaf0[_0x578300];return _0x1b2682;};'use strict';var _=require(_0x0aaf('0x0'));var util=require(_0x0aaf('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0aaf('0x2'));var BPromise=require(_0x0aaf('0x3'));var rp=require(_0x0aaf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0aaf('0x5'));var config=require(_0x0aaf('0x6'));var attributes=require(_0x0aaf('0x7'));module[_0x0aaf('0x8')]=function(_0x54d3d0,_0x2d12df){return _0x54d3d0[_0x0aaf('0x9')](_0x0aaf('0xa'),attributes,{'tableName':_0x0aaf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbcf6=['voice_musiconhold','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold'];(function(_0x3f0ac6,_0x1d8a3e){var _0x8a92a2=function(_0x5e198b){while(--_0x5e198b){_0x3f0ac6['push'](_0x3f0ac6['shift']());}};_0x8a92a2(++_0x1d8a3e);}(_0xbcf6,0xf8));var _0x6bcf=function(_0x23c827,_0x37332a){_0x23c827=_0x23c827-0x0;var _0x3d7f1f=_0xbcf6[_0x23c827];return _0x3d7f1f;};'use strict';var _=require(_0x6bcf('0x0'));var util=require('util');var logger=require(_0x6bcf('0x1'))(_0x6bcf('0x2'));var moment=require(_0x6bcf('0x3'));var BPromise=require(_0x6bcf('0x4'));var rp=require(_0x6bcf('0x5'));var fs=require('fs');var path=require(_0x6bcf('0x6'));var rimraf=require(_0x6bcf('0x7'));var config=require('../../config/environment');var attributes=require(_0x6bcf('0x8'));module[_0x6bcf('0x9')]=function(_0x573da1,_0x3b6ff1){return _0x573da1[_0x6bcf('0xa')](_0x6bcf('0xb'),attributes,{'tableName':_0x6bcf('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 71d92db..eefcc08 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x3a5afc,_0xa33d7f){var _0x2af814=function(_0x321c8e){while(--_0x321c8e){_0x3a5afc['push'](_0x3a5afc['shift']());}};_0x2af814(++_0xa33d7f);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xd12e56,_0x2b32bf){var _0x1d6b49=function(_0x51b677){while(--_0x51b677){_0xd12e56['push'](_0xd12e56['shift']());}};_0x1d6b49(++_0x2b32bf);}(_0xe706,0xa3));var _0x6e70=function(_0x9bcc0b,_0x120f6c){_0x9bcc0b=_0x9bcc0b-0x0;var _0x195399=_0xe706[_0x9bcc0b];return _0x195399;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 492115f..5e70b9e 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 _0x8781=['update','destroy','delete','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','addAgents','addTeams'];(function(_0x23d2e7,_0x5d84f2){var _0x3a908c=function(_0x4300d0){while(--_0x4300d0){_0x23d2e7['push'](_0x23d2e7['shift']());}};_0x3a908c(++_0x5d84f2);}(_0x8781,0x1c8));var _0x1878=function(_0x4b5518,_0x31681e){_0x4b5518=_0x4b5518-0x0;var _0x44f3b6=_0x8781[_0x4b5518];return _0x44f3b6;};'use strict';var multer=require(_0x1878('0x0'));var util=require(_0x1878('0x1'));var path=require(_0x1878('0x2'));var timeout=require(_0x1878('0x3'));var express=require(_0x1878('0x4'));var router=express[_0x1878('0x5')]();var fs_extra=require(_0x1878('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1878('0x7'));var config=require(_0x1878('0x8'));var controller=require(_0x1878('0x9'));router[_0x1878('0xa')]('/',auth[_0x1878('0xb')](),controller[_0x1878('0xc')]);router['get'](_0x1878('0xd'),auth[_0x1878('0xb')](),controller[_0x1878('0xe')]);router[_0x1878('0xa')](_0x1878('0xf'),auth[_0x1878('0xb')](),controller[_0x1878('0x10')]);router[_0x1878('0xa')](_0x1878('0x11'),auth[_0x1878('0xb')](),controller[_0x1878('0x12')]);router['get'](_0x1878('0x13'),auth[_0x1878('0xb')](),controller[_0x1878('0x14')]);router[_0x1878('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1878('0x15')](_0x1878('0x11'),auth[_0x1878('0xb')](),controller[_0x1878('0x16')]);router['post']('/:id/teams',auth[_0x1878('0xb')](),controller[_0x1878('0x17')]);router['put'](_0x1878('0xf'),auth[_0x1878('0xb')](),controller[_0x1878('0x18')]);router['delete']('/:id',auth[_0x1878('0xb')](),controller[_0x1878('0x19')]);router[_0x1878('0x1a')](_0x1878('0x11'),auth[_0x1878('0xb')](),controller[_0x1878('0x1b')]);router[_0x1878('0x1a')](_0x1878('0x13'),auth[_0x1878('0xb')](),controller[_0x1878('0x1c')]);module[_0x1878('0x1d')]=router; \ No newline at end of file +var _0x22f6=['isAuthenticated','index','/describe','describe','show','/:id/users','/:id/teams','getTeams','post','create','addAgents','addTeams','/:id','update','destroy','delete','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get'];(function(_0x57e3ec,_0x4befc5){var _0x3f5eea=function(_0x45190d){while(--_0x45190d){_0x57e3ec['push'](_0x57e3ec['shift']());}};_0x3f5eea(++_0x4befc5);}(_0x22f6,0x10e));var _0x622f=function(_0x2e68e0,_0x8733eb){_0x2e68e0=_0x2e68e0-0x0;var _0x274230=_0x22f6[_0x2e68e0];return _0x274230;};'use strict';var multer=require(_0x622f('0x0'));var util=require('util');var path=require(_0x622f('0x1'));var timeout=require('connect-timeout');var express=require(_0x622f('0x2'));var router=express[_0x622f('0x3')]();var fs_extra=require(_0x622f('0x4'));var auth=require(_0x622f('0x5'));var interaction=require(_0x622f('0x6'));var config=require(_0x622f('0x7'));var controller=require(_0x622f('0x8'));router[_0x622f('0x9')]('/',auth[_0x622f('0xa')](),controller[_0x622f('0xb')]);router['get'](_0x622f('0xc'),auth[_0x622f('0xa')](),controller[_0x622f('0xd')]);router[_0x622f('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x622f('0xe')]);router[_0x622f('0x9')](_0x622f('0xf'),auth[_0x622f('0xa')](),controller['getAgents']);router[_0x622f('0x9')](_0x622f('0x10'),auth[_0x622f('0xa')](),controller[_0x622f('0x11')]);router[_0x622f('0x12')]('/',auth[_0x622f('0xa')](),controller[_0x622f('0x13')]);router[_0x622f('0x12')](_0x622f('0xf'),auth['isAuthenticated'](),controller[_0x622f('0x14')]);router[_0x622f('0x12')](_0x622f('0x10'),auth['isAuthenticated'](),controller[_0x622f('0x15')]);router['put'](_0x622f('0x16'),auth['isAuthenticated'](),controller[_0x622f('0x17')]);router['delete']('/:id',auth[_0x622f('0xa')](),controller[_0x622f('0x18')]);router[_0x622f('0x19')]('/:id/users',auth[_0x622f('0xa')](),controller[_0x622f('0x1a')]);router[_0x622f('0x19')](_0x622f('0x10'),auth[_0x622f('0xa')](),controller['removeTeams']);module[_0x622f('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index caec518..d666a09 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 _0xfac9=['system-','name','INTEGER','sequelize','exports','STRING','VIRTUAL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfac9,0x1ae));var _0x9fac=function(_0x3be174,_0x53437b){_0x3be174=_0x3be174-0x0;var _0x1cfd96=_0xfac9[_0x3be174];return _0x1cfd96;};'use strict';var Sequelize=require(_0x9fac('0x0'));module[_0x9fac('0x1')]={'name':{'type':Sequelize[_0x9fac('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x9fac('0x3')],'get':function(_0xf6c3b9){return _0x9fac('0x4')+this['getDataValue'](_0x9fac('0x5'))+'-';}},'description':{'type':Sequelize[_0x9fac('0x2')]},'callerIdAll':{'type':Sequelize[_0x9fac('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x9fac('0x6')]}}; \ No newline at end of file +var _0xf22f=['sequelize','exports','STRING','VIRTUAL','system-','getDataValue','name','INTEGER'];(function(_0x305948,_0x3fc8b8){var _0x3de12b=function(_0x264281){while(--_0x264281){_0x305948['push'](_0x305948['shift']());}};_0x3de12b(++_0x3fc8b8);}(_0xf22f,0xa0));var _0xff22=function(_0x2b48af,_0x56a5a8){_0x2b48af=_0x2b48af-0x0;var _0x53fecf=_0xf22f[_0x2b48af];return _0x53fecf;};'use strict';var Sequelize=require(_0xff22('0x0'));module[_0xff22('0x1')]={'name':{'type':Sequelize[_0xff22('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xff22('0x3')],'get':function(_0xa00780){return _0xff22('0x4')+this[_0xff22('0x5')](_0xff22('0x6'))+'-';}},'description':{'type':Sequelize[_0xff22('0x2')]},'callerIdAll':{'type':Sequelize[_0xff22('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xff22('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index f6bf35c..30ed5ae 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 _0x5eb8=['from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','register','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','sort','where','pick','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','show','params','keys','merge','options','find','describe','transaction','create','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','NoOp','VoicePrefixId','bulkCreate','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','charAt','system-','sequelize','findById','addAgents','omit','ids','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','order','hasOwnProperty','nolimit','getTeams','addTeams','Team','User','online','voicePause','interface','flatMap','Agents','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','removeTeams','field','tq.TeamId'];(function(_0x4abfae,_0x9ad6ac){var _0x32f7fe=function(_0x18412f){while(--_0x18412f){_0x4abfae['push'](_0x4abfae['shift']());}};_0x32f7fe(++_0x9ad6ac);}(_0x5eb8,0xb0));var _0x85eb=function(_0x12a06b,_0x417b51){_0x12a06b=_0x12a06b-0x0;var _0x5d0bb8=_0x5eb8[_0x12a06b];return _0x5d0bb8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85eb('0x0'));var jsonpatch=require(_0x85eb('0x1'));var rp=require(_0x85eb('0x2'));var moment=require(_0x85eb('0x3'));var BPromise=require(_0x85eb('0x4'));var Mustache=require(_0x85eb('0x5'));var util=require(_0x85eb('0x6'));var path=require(_0x85eb('0x7'));var sox=require(_0x85eb('0x8'));var csv=require(_0x85eb('0x9'));var ejs=require(_0x85eb('0xa'));var fs=require('fs');var fs_extra=require(_0x85eb('0xb'));var _=require('lodash');var squel=require(_0x85eb('0xc'));var crypto=require(_0x85eb('0xd'));var jsforce=require(_0x85eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85eb('0x9'));var querystring=require('querystring');var Papa=require(_0x85eb('0xf'));var Redis=require(_0x85eb('0x10'));var authService=require(_0x85eb('0x11'));var qs=require(_0x85eb('0x12'));var as=require(_0x85eb('0x13'));var hardwareService=require(_0x85eb('0x14'));var logger=require(_0x85eb('0x15'))('api');var utils=require(_0x85eb('0x16'));var config=require(_0x85eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x85eb('0x18'))['db'];config[_0x85eb('0x19')]=_[_0x85eb('0x1a')](config[_0x85eb('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85eb('0x19')]));require('./voicePrefix.socket')[_0x85eb('0x1b')](socket);function respondWithStatusCode(_0x23a82a,_0x600a7f){_0x600a7f=_0x600a7f||0xcc;return function(_0x1604ba){if(_0x1604ba){return _0x23a82a[_0x85eb('0x1c')](_0x600a7f);}return _0x23a82a['status'](_0x600a7f)[_0x85eb('0x1d')]();};}function respondWithResult(_0x59237b,_0x17140b){_0x17140b=_0x17140b||0xc8;return function(_0x10c2c9){if(_0x10c2c9){return _0x59237b[_0x85eb('0x1e')](_0x17140b)[_0x85eb('0x1f')](_0x10c2c9);}};}function respondWithFilteredResult(_0x5dbeda,_0x5c5cbb){return function(_0x50d2a8){if(_0x50d2a8){var _0xe198ca=typeof _0x5c5cbb[_0x85eb('0x20')]===_0x85eb('0x21')&&typeof _0x5c5cbb[_0x85eb('0x22')]===_0x85eb('0x21');var _0x34f875=_0x50d2a8['count'];var _0x24cf28=_0xe198ca?0x0:_0x5c5cbb[_0x85eb('0x20')];var _0xd9f06d=_0xe198ca?_0x50d2a8['count']:_0x5c5cbb['offset']+_0x5c5cbb['limit'];var _0x55b9e4;if(_0xd9f06d>=_0x34f875){_0xd9f06d=_0x34f875;_0x55b9e4=0xc8;}else{_0x55b9e4=0xce;}_0x5dbeda[_0x85eb('0x1e')](_0x55b9e4);return _0x5dbeda[_0x85eb('0x23')](_0x85eb('0x24'),_0x24cf28+'-'+_0xd9f06d+'/'+_0x34f875)[_0x85eb('0x1f')](_0x50d2a8);}return null;};}function patchUpdates(_0x465c74){return function(_0x3fc6da){try{jsonpatch['apply'](_0x3fc6da,_0x465c74,!![]);}catch(_0x5491d5){return BPromise['reject'](_0x5491d5);}return _0x3fc6da[_0x85eb('0x25')]();};}function saveUpdates(_0x1426c8,_0x3f7a4d){return function(_0x28b87d){if(_0x28b87d){return _0x28b87d[_0x85eb('0x26')](_0x1426c8)[_0x85eb('0x27')](function(_0x5dfc96){return _0x5dfc96;});}return null;};}function removeEntity(_0x39d3fe,_0x3453cd){return function(_0x4709ad){if(_0x4709ad){return _0x4709ad[_0x85eb('0x28')]()[_0x85eb('0x27')](function(){var _0x57a03c=_0x4709ad[_0x85eb('0x29')]({'plain':!![]});var _0x792d3a=_0x85eb('0x2a');return db[_0x85eb('0x2b')][_0x85eb('0x28')]({'where':{'type':_0x792d3a,'resourceId':_0x57a03c['id']}})[_0x85eb('0x27')](function(){return _0x4709ad;});})['then'](function(){_0x39d3fe['status'](0xcc)[_0x85eb('0x1d')]();});}};}function handleEntityNotFound(_0x585f2a,_0xa9b14f){return function(_0x5255eb){if(!_0x5255eb){_0x585f2a[_0x85eb('0x1c')](0x194);}return _0x5255eb;};}function handleError(_0x3570f7,_0x1ba904){_0x1ba904=_0x1ba904||0x1f4;return function(_0x1d9278){logger[_0x85eb('0x2c')](_0x1d9278[_0x85eb('0x2d')]);if(_0x1d9278[_0x85eb('0x2e')]){delete _0x1d9278['name'];}_0x3570f7[_0x85eb('0x1e')](_0x1ba904)[_0x85eb('0x2f')](_0x1d9278);};}exports['index']=function(_0x197898,_0x5af2de){var _0x5439aa={},_0x3c5ecc={},_0x3a533c={'count':0x0,'rows':[]};var _0x3e6f34=_[_0x85eb('0x30')](db[_0x85eb('0x31')][_0x85eb('0x32')],function(_0x39b574){return{'name':_0x39b574[_0x85eb('0x33')],'type':_0x39b574[_0x85eb('0x34')][_0x85eb('0x35')]};});_0x3c5ecc['model']=_[_0x85eb('0x30')](_0x3e6f34,_0x85eb('0x2e'));_0x3c5ecc['query']=_['keys'](_0x197898[_0x85eb('0x36')]);_0x3c5ecc[_0x85eb('0x37')]=_[_0x85eb('0x38')](_0x3c5ecc[_0x85eb('0x39')],_0x3c5ecc[_0x85eb('0x36')]);_0x5439aa[_0x85eb('0x3a')]=_[_0x85eb('0x38')](_0x3c5ecc[_0x85eb('0x39')],qs[_0x85eb('0x3b')](_0x197898[_0x85eb('0x36')][_0x85eb('0x3b')]));_0x5439aa[_0x85eb('0x3a')]=_0x5439aa[_0x85eb('0x3a')][_0x85eb('0x3c')]?_0x5439aa['attributes']:_0x3c5ecc[_0x85eb('0x39')];if(!_0x197898[_0x85eb('0x36')]['hasOwnProperty']('nolimit')){_0x5439aa[_0x85eb('0x22')]=qs[_0x85eb('0x22')](_0x197898['query'][_0x85eb('0x22')]);_0x5439aa['offset']=qs[_0x85eb('0x20')](_0x197898['query'][_0x85eb('0x20')]);}_0x5439aa['order']=qs[_0x85eb('0x3d')](_0x197898['query'][_0x85eb('0x3d')]);_0x5439aa[_0x85eb('0x3e')]=qs['filters'](_[_0x85eb('0x3f')](_0x197898['query'],_0x3c5ecc[_0x85eb('0x37')]),_0x3e6f34);if(_0x197898[_0x85eb('0x36')]['filter']){_0x5439aa[_0x85eb('0x3e')]=_['merge'](_0x5439aa['where'],{'$or':_[_0x85eb('0x30')](_0x3e6f34,function(_0x4edb2d){if(_0x4edb2d[_0x85eb('0x34')]!==_0x85eb('0x40')){var _0x5da012={};_0x5da012[_0x4edb2d['name']]={'$like':'%'+_0x197898[_0x85eb('0x36')][_0x85eb('0x41')]+'%'};return _0x5da012;}})});}_0x5439aa=_['merge']({},_0x5439aa,_0x197898['options']);var _0x2864e2={'where':_0x5439aa[_0x85eb('0x3e')]};return db[_0x85eb('0x31')][_0x85eb('0x42')](_0x2864e2)[_0x85eb('0x27')](function(_0x5b7411){_0x3a533c[_0x85eb('0x42')]=_0x5b7411;if(_0x197898[_0x85eb('0x36')][_0x85eb('0x43')]){_0x5439aa[_0x85eb('0x44')]=[{'all':!![]}];}return db[_0x85eb('0x31')][_0x85eb('0x45')](_0x5439aa);})[_0x85eb('0x27')](function(_0x3e11a8){_0x3a533c[_0x85eb('0x46')]=_0x3e11a8;return _0x3a533c;})['then'](respondWithFilteredResult(_0x5af2de,_0x5439aa))[_0x85eb('0x47')](handleError(_0x5af2de,null));};exports[_0x85eb('0x48')]=function(_0x5d90cc,_0x1b77b3){var _0x201aed={'raw':![],'where':{'id':_0x5d90cc[_0x85eb('0x49')]['id']}},_0x2dae5b={};_0x2dae5b[_0x85eb('0x39')]=_[_0x85eb('0x4a')](db['VoicePrefix'][_0x85eb('0x32')]);_0x2dae5b[_0x85eb('0x36')]=_[_0x85eb('0x4a')](_0x5d90cc[_0x85eb('0x36')]);_0x2dae5b[_0x85eb('0x37')]=_[_0x85eb('0x38')](_0x2dae5b[_0x85eb('0x39')],_0x2dae5b[_0x85eb('0x36')]);_0x201aed['attributes']=_[_0x85eb('0x38')](_0x2dae5b[_0x85eb('0x39')],qs[_0x85eb('0x3b')](_0x5d90cc[_0x85eb('0x36')][_0x85eb('0x3b')]));_0x201aed[_0x85eb('0x3a')]=_0x201aed[_0x85eb('0x3a')][_0x85eb('0x3c')]?_0x201aed[_0x85eb('0x3a')]:_0x2dae5b[_0x85eb('0x39')];if(_0x5d90cc[_0x85eb('0x36')][_0x85eb('0x43')]){_0x201aed['include']=[{'all':!![]}];}_0x201aed=_[_0x85eb('0x4b')]({},_0x201aed,_0x5d90cc[_0x85eb('0x4c')]);return db[_0x85eb('0x31')]['find'](_0x201aed)[_0x85eb('0x27')](handleEntityNotFound(_0x1b77b3,null))[_0x85eb('0x27')](respondWithResult(_0x1b77b3,null))[_0x85eb('0x47')](handleError(_0x1b77b3,null));};exports[_0x85eb('0x28')]=function(_0xd3ff2b,_0x4a7506){return db[_0x85eb('0x31')][_0x85eb('0x4d')]({'where':{'id':_0xd3ff2b[_0x85eb('0x49')]['id']}})['then'](handleEntityNotFound(_0x4a7506,null))[_0x85eb('0x27')](removeEntity(_0x4a7506,null))[_0x85eb('0x47')](handleError(_0x4a7506,null));};exports[_0x85eb('0x4e')]=function(_0x4c06ef,_0x56f510){return db[_0x85eb('0x31')]['describe']()['then'](respondWithResult(_0x56f510,null))[_0x85eb('0x47')](handleError(_0x56f510,null));};exports['create']=function(_0x39316d,_0xfb0ac){var _0x4e3d96;return db['sequelize'][_0x85eb('0x4f')](function(_0x249511){return db[_0x85eb('0x31')][_0x85eb('0x50')](_0x39316d[_0x85eb('0x51')],{'transaction':_0x249511})['then'](function(_0x1bb9f8){_0x4e3d96=_0x1bb9f8[_0x85eb('0x29')]({'plain':!![]});return db[_0x85eb('0x52')][_0x85eb('0x4d')]({'where':{'id':_0x4e3d96[_0x85eb('0x53')]},'raw':!![]})['then'](function(_0x140919){return createVoicePrefixExtensions(_0x4e3d96,_0x140919,_0x249511);});});})['then'](function(){var _0xd2e792=_0x39316d[_0x85eb('0x54')]['get']({'plain':!![]});if(!_0xd2e792)throw new Error(_0x85eb('0x55'));if(_0xd2e792[_0x85eb('0x56')]===_0x85eb('0x54')){var _0x26e04a=_0x4e3d96;return db[_0x85eb('0x57')][_0x85eb('0x4d')]({'where':{'name':'VoicePrefixes','userProfileId':_0xd2e792[_0x85eb('0x58')]},'raw':!![]})['then'](function(_0x311857){if(_0x311857&&_0x311857[_0x85eb('0x59')]===0x0){return db['UserProfileResource'][_0x85eb('0x50')]({'name':_0x26e04a[_0x85eb('0x2e')],'resourceId':_0x26e04a['id'],'type':_0x311857['name'],'sectionId':_0x311857['id']},{})[_0x85eb('0x27')](function(){return _0x4e3d96;});}else{return _0x4e3d96;}})['catch'](function(_0x452e7e){logger[_0x85eb('0x2c')](_0x85eb('0x5a'),_0x452e7e);throw _0x452e7e;});}return _0x4e3d96;})[_0x85eb('0x27')](respondWithResult(_0xfb0ac,null))[_0x85eb('0x47')](handleError(_0xfb0ac,null));};function Extension(_0x15d4a7,_0x5a729e,_0x2227ea,_0x76a9c6){this[_0x85eb('0x5b')]=_0x85eb('0x5c');this[_0x85eb('0x5d')]=_0x15d4a7;this[_0x85eb('0x5e')]=_0x2227ea;this[_0x85eb('0x34')]=_0x85eb('0x5f');this[_0x85eb('0x60')]=_0x85eb('0x61');this[_0x85eb('0x62')]=_0x5a729e;this['appdata']=_0x76a9c6;}function createVoicePrefixExtensions(_0x271842,_0x21b873,_0x46e5d3){return new BPromise(function(_0xdaf2fe,_0x4470b3){var _0x213b64=new Extension(formatPrefixName(_0x271842['prefix']),0x1,_0x85eb('0x63'),'Voice\x20Prefix');_0x213b64[_0x85eb('0x64')]=_0x271842['id'];return db[_0x85eb('0x52')][_0x85eb('0x50')](_0x213b64,{'transaction':_0x46e5d3})[_0x85eb('0x27')](function(_0x8f8a72){var _0x4f09dc=_0x8f8a72[_0x85eb('0x29')]({'plain':!![]});var _0x143d65=_[_0x85eb('0x30')](addVoicePrefixExtensions(_0x271842,_0x21b873),function(_0x2c40f8){_0x2c40f8[_0x85eb('0x53')]=_0x4f09dc['id'];_0x2c40f8[_0x85eb('0x64')]=_0x271842['id'];return _0x2c40f8;});return db[_0x85eb('0x52')][_0x85eb('0x65')](_0x143d65,{'transaction':_0x46e5d3})['then'](function(_0x3b896a){if(!_0x3b896a){return _0x4470b3('Extensions\x20creation\x20failed');}else{return _0xdaf2fe(_0x3b896a);}})[_0x85eb('0x47')](function(_0x3ff0f9){return _0x4470b3(_0x3ff0f9);});});;});};function addVoicePrefixExtensions(_0x2ac293,_0x41960f){var _0x259ee3=[];var _0x547ccb=formatPrefixName(_0x2ac293[_0x85eb('0x66')]);_0x259ee3[_0x85eb('0x67')](new Extension(_0x547ccb,0x2,_0x85eb('0x68'),_0x85eb('0x69')+_0x2ac293[_0x85eb('0x2e')]));if(_0x2ac293[_0x85eb('0x6a')]){_0x259ee3['push'](new Extension(_0x547ccb,0x3,'Set',_0x85eb('0x6b')+_0x2ac293['callerIdAll']));}else{_0x259ee3[_0x85eb('0x67')](new Extension(_0x547ccb,0x3,_0x85eb('0x63'),_0x85eb('0x6c')));}_0x259ee3[_0x85eb('0x67')](new Extension(_0x547ccb,0x4,_0x85eb('0x6d'),_0x41960f[_0x85eb('0x5b')]+','+'${EXTEN:'+(0x8+_0x2ac293[_0x85eb('0x2e')][_0x85eb('0x3c')])+'}'+','+0x1));return _0x259ee3;}function formatPrefixName(_0x3f30e4){var _0x2e65d5='_';for(var _0x52bbdf=0x0;_0x52bbdf<_0x3f30e4[_0x85eb('0x3c')];_0x52bbdf++){if(_0x3f30e4[_0x85eb('0x6e')](_0x52bbdf)=='-'){_0x2e65d5+=_0x3f30e4[_0x85eb('0x6e')](_0x52bbdf);}else{_0x2e65d5+='['+_0x3f30e4[_0x85eb('0x6e')](_0x52bbdf)+']';}}_0x2e65d5+='.';return _0x2e65d5;}exports['update']=function(_0x459317,_0x2e6734,_0x13a040){var _0x5fcd48=_0x459317[_0x85eb('0x51')];_0x5fcd48[_0x85eb('0x66')]=_0x85eb('0x6f')+_0x5fcd48[_0x85eb('0x2e')]+'-';return db[_0x85eb('0x70')][_0x85eb('0x4f')](function(_0x170a60){return db[_0x85eb('0x31')][_0x85eb('0x26')](_0x5fcd48,{'where':{'id':_0x5fcd48['id']},'transaction':_0x170a60})[_0x85eb('0x27')](function(){return db[_0x85eb('0x52')][_0x85eb('0x28')]({'where':{'VoicePrefixId':_0x5fcd48['id']},'transaction':_0x170a60})[_0x85eb('0x27')](function(){return db[_0x85eb('0x52')][_0x85eb('0x4d')]({'where':{'id':_0x5fcd48['VoiceExtensionId']},'raw':!![]})[_0x85eb('0x27')](function(_0x4dd31e){return createVoicePrefixExtensions(_0x5fcd48,_0x4dd31e,_0x170a60);});});});})[_0x85eb('0x27')](function(){return db[_0x85eb('0x31')][_0x85eb('0x71')](_0x5fcd48['id']);})[_0x85eb('0x27')](respondWithResult(_0x2e6734,null))[_0x85eb('0x47')](handleError(_0x2e6734,null));};exports[_0x85eb('0x72')]=function(_0x9f4f,_0x3076df,_0x2ca9f9){return db['VoicePrefix'][_0x85eb('0x4d')]({'where':{'id':_0x9f4f[_0x85eb('0x49')]['id']}})[_0x85eb('0x27')](handleEntityNotFound(_0x3076df,null))[_0x85eb('0x27')](function(_0x440968){if(_0x440968){return _0x440968['addAgents'](_0x9f4f[_0x85eb('0x51')]['ids'],_[_0x85eb('0x73')](_0x9f4f[_0x85eb('0x51')],[_0x85eb('0x74'),'id'])||{})['spread'](function(_0x2daa64){for(var _0x2e358d=0x0;_0x2e358d<_0x9f4f[_0x85eb('0x51')]['ids']['length'];_0x2e358d+=0x1){socket[_0x85eb('0x75')](_0x85eb('0x76'),{'UserId':Number(_0x9f4f[_0x85eb('0x51')][_0x85eb('0x74')][_0x2e358d]),'VoicePrefixId':Number(_0x9f4f['params']['id'])});}return _0x2daa64;});}})[_0x85eb('0x27')](respondWithResult(_0x3076df,null))['catch'](handleError(_0x3076df,null));};exports[_0x85eb('0x77')]=function(_0xed99f7,_0x528d2e,_0x2fad3b){return db[_0x85eb('0x31')][_0x85eb('0x4d')]({'where':{'id':_0xed99f7['params']['id']}})[_0x85eb('0x27')](handleEntityNotFound(_0x528d2e,null))['then'](function(_0x18049b){if(_0x18049b){return _0x18049b[_0x85eb('0x77')](_0xed99f7[_0x85eb('0x36')][_0x85eb('0x74')])[_0x85eb('0x27')](function(){if(_[_0x85eb('0x78')](_0xed99f7[_0x85eb('0x36')][_0x85eb('0x74')])){for(var _0x3a471d=0x0;_0x3a471d<_0xed99f7['query'][_0x85eb('0x74')][_0x85eb('0x3c')];_0x3a471d+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0xed99f7[_0x85eb('0x36')]['ids'][_0x3a471d]),'VoicePrefixId':Number(_0xed99f7[_0x85eb('0x49')]['id'])});}}else{socket['emit'](_0x85eb('0x79'),{'UserId':Number(_0xed99f7['query'][_0x85eb('0x74')]),'VoicePrefixId':Number(_0xed99f7[_0x85eb('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x528d2e,null))[_0x85eb('0x47')](handleError(_0x528d2e,null));};exports[_0x85eb('0x7a')]=function(_0x555236,_0x888c46,_0x3b327d){var _0xf076af={};var _0x16b378={};var _0x5dd40c;var _0x1d82a4;return db['VoicePrefix'][_0x85eb('0x7b')]({'where':{'id':_0x555236[_0x85eb('0x49')]['id']}})[_0x85eb('0x27')](handleEntityNotFound(_0x888c46,null))['then'](function(_0x60e9b9){if(_0x60e9b9){_0x5dd40c=_0x60e9b9;_0x16b378[_0x85eb('0x39')]=_[_0x85eb('0x4a')](db['User'][_0x85eb('0x32')]);_0x16b378['query']=_[_0x85eb('0x4a')](_0x555236[_0x85eb('0x36')]);_0x16b378[_0x85eb('0x37')]=_['intersection'](_0x16b378['model'],_0x16b378['query']);_0xf076af[_0x85eb('0x3a')]=_[_0x85eb('0x38')](_0x16b378[_0x85eb('0x39')],qs['fields'](_0x555236[_0x85eb('0x36')][_0x85eb('0x3b')]));_0xf076af[_0x85eb('0x3a')]=_0xf076af[_0x85eb('0x3a')][_0x85eb('0x3c')]?_0xf076af['attributes']:_0x16b378['model'];_0xf076af[_0x85eb('0x7c')]=qs[_0x85eb('0x3d')](_0x555236['query'][_0x85eb('0x3d')]);_0xf076af[_0x85eb('0x3e')]=qs[_0x85eb('0x37')](_[_0x85eb('0x3f')](_0x555236[_0x85eb('0x36')],_0x16b378[_0x85eb('0x37')]));if(_0x555236[_0x85eb('0x36')][_0x85eb('0x41')]){_0xf076af[_0x85eb('0x3e')]=_[_0x85eb('0x4b')](_0xf076af[_0x85eb('0x3e')],{'$or':_[_0x85eb('0x30')](_0xf076af[_0x85eb('0x3a')],function(_0x171428){var _0x326b12={};_0x326b12[_0x171428]={'$like':'%'+_0x555236['query'][_0x85eb('0x41')]+'%'};return _0x326b12;})});}_0xf076af=_[_0x85eb('0x4b')]({},_0xf076af,_0x555236[_0x85eb('0x4c')]);return _0x5dd40c[_0x85eb('0x7a')](_0xf076af);}})[_0x85eb('0x27')](function(_0x23191c){if(_0x23191c){_0x1d82a4=_0x23191c[_0x85eb('0x3c')];if(!_0x555236[_0x85eb('0x36')][_0x85eb('0x7d')](_0x85eb('0x7e'))){_0xf076af['limit']=qs[_0x85eb('0x22')](_0x555236[_0x85eb('0x36')][_0x85eb('0x22')]);_0xf076af[_0x85eb('0x20')]=qs['offset'](_0x555236[_0x85eb('0x36')][_0x85eb('0x20')]);}return _0x5dd40c[_0x85eb('0x7a')](_0xf076af);}})[_0x85eb('0x27')](function(_0x362ba9){if(_0x362ba9){return _0x362ba9?{'count':_0x1d82a4,'rows':_0x362ba9}:null;}})[_0x85eb('0x27')](respondWithResult(_0x888c46,null))['catch'](handleError(_0x888c46,null));};exports[_0x85eb('0x7f')]=function(_0x36dbb1,_0x12c3be,_0x59fc6a){var _0x15802f={};var _0x278558={};var _0x2d0bfb;var _0x3b3b07;return db[_0x85eb('0x31')][_0x85eb('0x7b')]({'where':{'id':_0x36dbb1[_0x85eb('0x49')]['id']}})[_0x85eb('0x27')](handleEntityNotFound(_0x12c3be,null))['then'](function(_0x44af01){if(_0x44af01){_0x2d0bfb=_0x44af01;_0x278558[_0x85eb('0x39')]=_['keys'](db['Team'][_0x85eb('0x32')]);_0x278558['query']=_[_0x85eb('0x4a')](_0x36dbb1[_0x85eb('0x36')]);_0x278558[_0x85eb('0x37')]=_[_0x85eb('0x38')](_0x278558['model'],_0x278558['query']);_0x15802f[_0x85eb('0x3a')]=_['intersection'](_0x278558[_0x85eb('0x39')],qs[_0x85eb('0x3b')](_0x36dbb1[_0x85eb('0x36')][_0x85eb('0x3b')]));_0x15802f['attributes']=_0x15802f['attributes'][_0x85eb('0x3c')]?_0x15802f[_0x85eb('0x3a')]:_0x278558[_0x85eb('0x39')];_0x15802f['order']=qs['sort'](_0x36dbb1[_0x85eb('0x36')][_0x85eb('0x3d')]);_0x15802f[_0x85eb('0x3e')]=qs[_0x85eb('0x37')](_[_0x85eb('0x3f')](_0x36dbb1[_0x85eb('0x36')],_0x278558[_0x85eb('0x37')]));if(_0x36dbb1[_0x85eb('0x36')][_0x85eb('0x41')]){_0x15802f[_0x85eb('0x3e')]=_[_0x85eb('0x4b')](_0x15802f['where'],{'$or':_[_0x85eb('0x30')](_0x15802f[_0x85eb('0x3a')],function(_0x483f5f){var _0x1fe3b6={};_0x1fe3b6[_0x483f5f]={'$like':'%'+_0x36dbb1[_0x85eb('0x36')][_0x85eb('0x41')]+'%'};return _0x1fe3b6;})});}_0x15802f=_[_0x85eb('0x4b')]({},_0x15802f,_0x36dbb1[_0x85eb('0x4c')]);return _0x2d0bfb[_0x85eb('0x7f')](_0x15802f);}})['then'](function(_0x4ba2d3){if(_0x4ba2d3){_0x3b3b07=_0x4ba2d3[_0x85eb('0x3c')];if(!_0x36dbb1['query'][_0x85eb('0x7d')]('nolimit')){_0x15802f[_0x85eb('0x22')]=qs[_0x85eb('0x22')](_0x36dbb1['query']['limit']);_0x15802f[_0x85eb('0x20')]=qs[_0x85eb('0x20')](_0x36dbb1['query'][_0x85eb('0x20')]);}return _0x2d0bfb[_0x85eb('0x7f')](_0x15802f);}})[_0x85eb('0x27')](function(_0x48ed21){if(_0x48ed21){return _0x48ed21?{'count':_0x3b3b07,'rows':_0x48ed21}:null;}})['then'](respondWithResult(_0x12c3be,null))[_0x85eb('0x47')](handleError(_0x12c3be,null));};exports[_0x85eb('0x80')]=function(_0x189733,_0x422d33,_0x1d695c){var _0x4c865d=_0x189733[_0x85eb('0x51')][_0x85eb('0x74')];var _0x3b84b7;return db[_0x85eb('0x81')]['findAll']({'where':{'id':_0x4c865d},'attributes':['id'],'include':[{'model':db[_0x85eb('0x82')],'as':'Agents','attributes':['id',_0x85eb('0x2e'),_0x85eb('0x83'),_0x85eb('0x84'),_0x85eb('0x85')],'raw':!![]}]})[_0x85eb('0x27')](function(_0x52e2b9){if(_0x52e2b9){_0x3b84b7=_0x52e2b9;var _0x34c380=_[_0x85eb('0x86')](_0x52e2b9,function(_0x3bf9b4){var _0x4d3be5=_0x3bf9b4[_0x85eb('0x29')]({'plain':!![]});return _0x4d3be5[_0x85eb('0x87')];});return db[_0x85eb('0x31')][_0x85eb('0x4d')]({'where':{'id':_0x189733[_0x85eb('0x49')]['id']}})[_0x85eb('0x27')](function(_0x209800){return db[_0x85eb('0x70')][_0x85eb('0x4f')](function(_0x344711){return _0x209800[_0x85eb('0x80')](_0x4c865d,{'transaction':_0x344711})[_0x85eb('0x27')](function(){return BPromise[_0x85eb('0x88')](_0x3b84b7,function(_0xfe9f80){return db[_0x85eb('0x89')][_0x85eb('0x8a')]({'TeamId':_0xfe9f80['id'],'VoicePrefixId':_0x189733['params']['id']},{'transaction':_0x344711});});})[_0x85eb('0x27')](function(){return BPromise[_0x85eb('0x88')](_0x34c380,function(_0x1c13a9){return db[_0x85eb('0x8b')][_0x85eb('0x8c')]({'where':{'UserId':_0x1c13a9['id'],'VoicePrefixId':_0x189733[_0x85eb('0x49')]['id']},'transaction':_0x344711});});})[_0x85eb('0x27')](function(){_0x34c380['forEach'](function(_0x419f52){socket[_0x85eb('0x75')]('userVoicePrefix:save',{'UserId':_0x419f52['id'],'VoicePrefixId':_0x209800['id']});});});});});}})[_0x85eb('0x27')](respondWithStatusCode(_0x422d33,null))['catch'](handleError(_0x422d33,null));};exports[_0x85eb('0x8d')]=function(_0x29a5bd,_0x933d13,_0x41dcd3){return db[_0x85eb('0x81')][_0x85eb('0x45')]({'where':{'id':_0x29a5bd[_0x85eb('0x36')][_0x85eb('0x74')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x85eb('0x27')](handleEntityNotFound(_0x933d13,null))[_0x85eb('0x27')](function(_0x29df56){var _0x1b9d2f=_['map'](_0x29df56,'id');var _0x44de5f=[];var _0x2e2af5=[];var _0x3d2e7d=squel['select']();_0x3d2e7d[_0x85eb('0x8e')](_0x85eb('0x8f'))[_0x85eb('0x90')]('team_has_voice_prefixes','tq')[_0x85eb('0x91')](_0x85eb('0x92'),'ut',_0x85eb('0x93'))['where'](_0x85eb('0x94'),_0x29a5bd[_0x85eb('0x49')]['id']);for(var _0x404fef=0x0;_0x404fef<_0x29df56[_0x85eb('0x3c')];_0x404fef+=0x1){let _0x537ce5=_0x29df56[_0x404fef];for(var _0x1a2426=0x0;_0x1a2426<_0x537ce5[_0x85eb('0x87')][_0x85eb('0x3c')];_0x1a2426+=0x1){let _0x142a76=_0x537ce5['Agents'][_0x1a2426];var _0x3b4c70=_0x3d2e7d[_0x85eb('0x95')]();_0x3b4c70[_0x85eb('0x3e')](_0x85eb('0x96'),_0x142a76['id']);_0x2e2af5[_0x85eb('0x67')](db[_0x85eb('0x70')]['query'](_0x3b4c70['toString'](),{'type':db[_0x85eb('0x70')][_0x85eb('0x97')][_0x85eb('0x98')]})[_0x85eb('0x27')](function(_0x34e916){if(_0x34e916[_0x85eb('0x3c')]===0x1){return _0x142a76['id'];}else{var _0x37973e=_['every'](_[_0x85eb('0x30')](_0x34e916,_0x85eb('0x99')),function(_0x5af162){return _[_0x85eb('0x9a')](_0x1b9d2f,_0x5af162);});if(_0x37973e){return _0x142a76['id'];}}}));}}return BPromise[_0x85eb('0x9b')](_0x2e2af5)[_0x85eb('0x27')](function(_0x24726f){_0x44de5f=_(_0x44de5f)[_0x85eb('0x9c')](_0x24726f)[_0x85eb('0x9d')]()[_0x85eb('0x9e')]();return db[_0x85eb('0x31')][_0x85eb('0x4d')]({'where':{'id':_0x29a5bd['params']['id']}})['then'](function(_0x5ac026){return db[_0x85eb('0x70')][_0x85eb('0x4f')](function(_0x27fd58){return _0x5ac026[_0x85eb('0x8d')](_0x29a5bd[_0x85eb('0x36')][_0x85eb('0x74')],{'transaction':_0x27fd58})[_0x85eb('0x27')](function(){if(!_[_0x85eb('0x9f')](_0x44de5f)){return _0x5ac026[_0x85eb('0x77')](_0x44de5f,{'transaction':_0x27fd58});}})[_0x85eb('0x27')](function(){_0x44de5f['forEach'](function(_0xc37e2){socket[_0x85eb('0x75')](_0x85eb('0x79'),{'UserId':_0xc37e2,'VoicePrefixId':_0x5ac026['id']});});});});});});})[_0x85eb('0x27')](respondWithStatusCode(_0x933d13,null))[_0x85eb('0x47')](handleError(_0x933d13,null));}; \ No newline at end of file +var _0x7916=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','undefined','limit','count','offset','Content-Range','json','reject','then','destroy','get','UserProfileResource','end','error','name','send','index','map','VoicePrefix','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','show','params','keys','rawAttributes','length','find','catch','describe','create','sequelize','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','charAt','update','system-','transaction','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getTeams','Team','findAll','Agents','online','interface','flatMap','upsert','each','UserVoicePrefix','findOrCreate','forEach','removeTeams','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse'];(function(_0x44cd9e,_0x56d975){var _0x538512=function(_0x31cf23){while(--_0x31cf23){_0x44cd9e['push'](_0x44cd9e['shift']());}};_0x538512(++_0x56d975);}(_0x7916,0x128));var _0x6791=function(_0xa3483f,_0x2e2d5f){_0xa3483f=_0xa3483f-0x0;var _0x235bdb=_0x7916[_0xa3483f];return _0x235bdb;};'use strict';var emlformat=require(_0x6791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6791('0x1'));var jsonpatch=require(_0x6791('0x2'));var rp=require('request-promise');var moment=require(_0x6791('0x3'));var BPromise=require(_0x6791('0x4'));var Mustache=require(_0x6791('0x5'));var util=require(_0x6791('0x6'));var path=require('path');var sox=require(_0x6791('0x7'));var csv=require('to-csv');var ejs=require(_0x6791('0x8'));var fs=require('fs');var fs_extra=require(_0x6791('0x9'));var _=require('lodash');var squel=require(_0x6791('0xa'));var crypto=require('crypto');var jsforce=require(_0x6791('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6791('0xc'));var Papa=require(_0x6791('0xd'));var Redis=require('ioredis');var authService=require(_0x6791('0xe'));var qs=require(_0x6791('0xf'));var as=require(_0x6791('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6791('0x11'))(_0x6791('0x12'));var utils=require(_0x6791('0x13'));var config=require(_0x6791('0x14'));var licenseUtil=require(_0x6791('0x15'));var db=require(_0x6791('0x16'))['db'];config[_0x6791('0x17')]=_[_0x6791('0x18')](config[_0x6791('0x17')],{'host':_0x6791('0x19'),'port':0x18eb});var socket=require(_0x6791('0x1a'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x6791('0x1b')](socket);function respondWithStatusCode(_0x5122f9,_0x2a9151){_0x2a9151=_0x2a9151||0xcc;return function(_0x4c32a1){if(_0x4c32a1){return _0x5122f9[_0x6791('0x1c')](_0x2a9151);}return _0x5122f9[_0x6791('0x1d')](_0x2a9151)['end']();};}function respondWithResult(_0x3e4792,_0x4b80ed){_0x4b80ed=_0x4b80ed||0xc8;return function(_0x3856ac){if(_0x3856ac){return _0x3e4792[_0x6791('0x1d')](_0x4b80ed)['json'](_0x3856ac);}};}function respondWithFilteredResult(_0xbc35d,_0x36d7a1){return function(_0x5bec14){if(_0x5bec14){var _0x1872f5=typeof _0x36d7a1['offset']===_0x6791('0x1e')&&typeof _0x36d7a1[_0x6791('0x1f')]===_0x6791('0x1e');var _0x3a72ce=_0x5bec14[_0x6791('0x20')];var _0x2bc0ab=_0x1872f5?0x0:_0x36d7a1[_0x6791('0x21')];var _0x581d51=_0x1872f5?_0x5bec14[_0x6791('0x20')]:_0x36d7a1[_0x6791('0x21')]+_0x36d7a1['limit'];var _0x21ef16;if(_0x581d51>=_0x3a72ce){_0x581d51=_0x3a72ce;_0x21ef16=0xc8;}else{_0x21ef16=0xce;}_0xbc35d[_0x6791('0x1d')](_0x21ef16);return _0xbc35d['set'](_0x6791('0x22'),_0x2bc0ab+'-'+_0x581d51+'/'+_0x3a72ce)[_0x6791('0x23')](_0x5bec14);}return null;};}function patchUpdates(_0x15b9ab){return function(_0x12d83b){try{jsonpatch['apply'](_0x12d83b,_0x15b9ab,!![]);}catch(_0x3e17b3){return BPromise[_0x6791('0x24')](_0x3e17b3);}return _0x12d83b['save']();};}function saveUpdates(_0x53bb44,_0x4b23bc){return function(_0x372dae){if(_0x372dae){return _0x372dae['update'](_0x53bb44)[_0x6791('0x25')](function(_0x5409f1){return _0x5409f1;});}return null;};}function removeEntity(_0x54a092,_0x496273){return function(_0x5cadc){if(_0x5cadc){return _0x5cadc[_0x6791('0x26')]()[_0x6791('0x25')](function(){var _0x56a74e=_0x5cadc[_0x6791('0x27')]({'plain':!![]});var _0x30cc17='VoicePrefixes';return db[_0x6791('0x28')]['destroy']({'where':{'type':_0x30cc17,'resourceId':_0x56a74e['id']}})[_0x6791('0x25')](function(){return _0x5cadc;});})['then'](function(){_0x54a092['status'](0xcc)[_0x6791('0x29')]();});}};}function handleEntityNotFound(_0x551718,_0x2f56a2){return function(_0x34b006){if(!_0x34b006){_0x551718['sendStatus'](0x194);}return _0x34b006;};}function handleError(_0x240a9f,_0x273f79){_0x273f79=_0x273f79||0x1f4;return function(_0x234c5e){logger[_0x6791('0x2a')](_0x234c5e['stack']);if(_0x234c5e['name']){delete _0x234c5e[_0x6791('0x2b')];}_0x240a9f['status'](_0x273f79)[_0x6791('0x2c')](_0x234c5e);};}exports[_0x6791('0x2d')]=function(_0x30397e,_0x2b98b8){var _0x1d551b={},_0x127bfa={},_0x8e2101={'count':0x0,'rows':[]};var _0x14307e=_[_0x6791('0x2e')](db[_0x6791('0x2f')]['rawAttributes'],function(_0x28b3d4){return{'name':_0x28b3d4[_0x6791('0x30')],'type':_0x28b3d4[_0x6791('0x31')][_0x6791('0x32')]};});_0x127bfa[_0x6791('0x33')]=_[_0x6791('0x2e')](_0x14307e,'name');_0x127bfa['query']=_['keys'](_0x30397e[_0x6791('0x34')]);_0x127bfa[_0x6791('0x35')]=_[_0x6791('0x36')](_0x127bfa['model'],_0x127bfa['query']);_0x1d551b[_0x6791('0x37')]=_[_0x6791('0x36')](_0x127bfa[_0x6791('0x33')],qs[_0x6791('0x38')](_0x30397e['query'][_0x6791('0x38')]));_0x1d551b[_0x6791('0x37')]=_0x1d551b[_0x6791('0x37')]['length']?_0x1d551b[_0x6791('0x37')]:_0x127bfa['model'];if(!_0x30397e['query'][_0x6791('0x39')](_0x6791('0x3a'))){_0x1d551b['limit']=qs[_0x6791('0x1f')](_0x30397e[_0x6791('0x34')][_0x6791('0x1f')]);_0x1d551b[_0x6791('0x21')]=qs[_0x6791('0x21')](_0x30397e['query'][_0x6791('0x21')]);}_0x1d551b[_0x6791('0x3b')]=qs[_0x6791('0x3c')](_0x30397e['query'][_0x6791('0x3c')]);_0x1d551b[_0x6791('0x3d')]=qs[_0x6791('0x35')](_['pick'](_0x30397e[_0x6791('0x34')],_0x127bfa[_0x6791('0x35')]),_0x14307e);if(_0x30397e[_0x6791('0x34')][_0x6791('0x3e')]){_0x1d551b['where']=_[_0x6791('0x3f')](_0x1d551b[_0x6791('0x3d')],{'$or':_[_0x6791('0x2e')](_0x14307e,function(_0xd0f1c){if(_0xd0f1c[_0x6791('0x31')]!==_0x6791('0x40')){var _0x2688a9={};_0x2688a9[_0xd0f1c[_0x6791('0x2b')]]={'$like':'%'+_0x30397e[_0x6791('0x34')]['filter']+'%'};return _0x2688a9;}})});}_0x1d551b=_['merge']({},_0x1d551b,_0x30397e[_0x6791('0x41')]);var _0xe11675={'where':_0x1d551b['where']};return db[_0x6791('0x2f')][_0x6791('0x20')](_0xe11675)[_0x6791('0x25')](function(_0x3edb86){_0x8e2101[_0x6791('0x20')]=_0x3edb86;if(_0x30397e[_0x6791('0x34')][_0x6791('0x42')]){_0x1d551b['include']=[{'all':!![]}];}return db[_0x6791('0x2f')]['findAll'](_0x1d551b);})[_0x6791('0x25')](function(_0xfc170e){_0x8e2101[_0x6791('0x43')]=_0xfc170e;return _0x8e2101;})[_0x6791('0x25')](respondWithFilteredResult(_0x2b98b8,_0x1d551b))['catch'](handleError(_0x2b98b8,null));};exports[_0x6791('0x44')]=function(_0x4f0e2d,_0xeb9d45){var _0x3251e9={'raw':![],'where':{'id':_0x4f0e2d[_0x6791('0x45')]['id']}},_0x5a7fb6={};_0x5a7fb6[_0x6791('0x33')]=_[_0x6791('0x46')](db['VoicePrefix'][_0x6791('0x47')]);_0x5a7fb6[_0x6791('0x34')]=_[_0x6791('0x46')](_0x4f0e2d[_0x6791('0x34')]);_0x5a7fb6['filters']=_[_0x6791('0x36')](_0x5a7fb6[_0x6791('0x33')],_0x5a7fb6['query']);_0x3251e9[_0x6791('0x37')]=_['intersection'](_0x5a7fb6[_0x6791('0x33')],qs[_0x6791('0x38')](_0x4f0e2d[_0x6791('0x34')][_0x6791('0x38')]));_0x3251e9[_0x6791('0x37')]=_0x3251e9[_0x6791('0x37')][_0x6791('0x48')]?_0x3251e9[_0x6791('0x37')]:_0x5a7fb6[_0x6791('0x33')];if(_0x4f0e2d['query'][_0x6791('0x42')]){_0x3251e9['include']=[{'all':!![]}];}_0x3251e9=_[_0x6791('0x3f')]({},_0x3251e9,_0x4f0e2d[_0x6791('0x41')]);return db[_0x6791('0x2f')][_0x6791('0x49')](_0x3251e9)[_0x6791('0x25')](handleEntityNotFound(_0xeb9d45,null))['then'](respondWithResult(_0xeb9d45,null))[_0x6791('0x4a')](handleError(_0xeb9d45,null));};exports[_0x6791('0x26')]=function(_0x235b56,_0x3d22f3){return db[_0x6791('0x2f')]['find']({'where':{'id':_0x235b56[_0x6791('0x45')]['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x3d22f3,null))['then'](removeEntity(_0x3d22f3,null))[_0x6791('0x4a')](handleError(_0x3d22f3,null));};exports['describe']=function(_0x3d4b7e,_0x22a4d3){return db[_0x6791('0x2f')][_0x6791('0x4b')]()['then'](respondWithResult(_0x22a4d3,null))[_0x6791('0x4a')](handleError(_0x22a4d3,null));};exports[_0x6791('0x4c')]=function(_0x5655c8,_0x189b22){var _0x4370ab;return db[_0x6791('0x4d')]['transaction'](function(_0x355e97){return db[_0x6791('0x2f')]['create'](_0x5655c8[_0x6791('0x4e')],{'transaction':_0x355e97})[_0x6791('0x25')](function(_0x49d583){_0x4370ab=_0x49d583[_0x6791('0x27')]({'plain':!![]});return db[_0x6791('0x4f')][_0x6791('0x49')]({'where':{'id':_0x4370ab[_0x6791('0x50')]},'raw':!![]})['then'](function(_0x3c1076){return createVoicePrefixExtensions(_0x4370ab,_0x3c1076,_0x355e97);});});})[_0x6791('0x25')](function(){var _0x32f36b=_0x5655c8['user']['get']({'plain':!![]});if(!_0x32f36b)throw new Error(_0x6791('0x51'));if(_0x32f36b[_0x6791('0x52')]===_0x6791('0x53')){var _0x45756f=_0x4370ab;return db[_0x6791('0x54')]['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x32f36b[_0x6791('0x55')]},'raw':!![]})['then'](function(_0x51f071){if(_0x51f071&&_0x51f071[_0x6791('0x56')]===0x0){return db[_0x6791('0x28')][_0x6791('0x4c')]({'name':_0x45756f[_0x6791('0x2b')],'resourceId':_0x45756f['id'],'type':_0x51f071[_0x6791('0x2b')],'sectionId':_0x51f071['id']},{})[_0x6791('0x25')](function(){return _0x4370ab;});}else{return _0x4370ab;}})['catch'](function(_0x5a30f3){logger[_0x6791('0x2a')](_0x6791('0x57'),_0x5a30f3);throw _0x5a30f3;});}return _0x4370ab;})['then'](respondWithResult(_0x189b22,null))[_0x6791('0x4a')](handleError(_0x189b22,null));};function Extension(_0x535ecf,_0x473443,_0x15fb6c,_0x50cf85){this[_0x6791('0x58')]=_0x6791('0x59');this[_0x6791('0x5a')]=_0x535ecf;this['app']=_0x15fb6c;this[_0x6791('0x31')]=_0x6791('0x5b');this[_0x6791('0x5c')]=_0x6791('0x5d');this[_0x6791('0x5e')]=_0x473443;this['appdata']=_0x50cf85;}function createVoicePrefixExtensions(_0x54d0ba,_0x1a9acd,_0x13430e){return new BPromise(function(_0x5d2668,_0x329fc0){var _0x466a64=new Extension(formatPrefixName(_0x54d0ba[_0x6791('0x5f')]),0x1,_0x6791('0x60'),_0x6791('0x61'));_0x466a64[_0x6791('0x62')]=_0x54d0ba['id'];return db[_0x6791('0x4f')][_0x6791('0x4c')](_0x466a64,{'transaction':_0x13430e})['then'](function(_0x2c5f12){var _0x3b46bf=_0x2c5f12[_0x6791('0x27')]({'plain':!![]});var _0x1a9a2e=_['map'](addVoicePrefixExtensions(_0x54d0ba,_0x1a9acd),function(_0x16dff7){_0x16dff7[_0x6791('0x50')]=_0x3b46bf['id'];_0x16dff7[_0x6791('0x62')]=_0x54d0ba['id'];return _0x16dff7;});return db['VoiceExtension'][_0x6791('0x63')](_0x1a9a2e,{'transaction':_0x13430e})[_0x6791('0x25')](function(_0x99d4ee){if(!_0x99d4ee){return _0x329fc0(_0x6791('0x64'));}else{return _0x5d2668(_0x99d4ee);}})['catch'](function(_0x2c834f){return _0x329fc0(_0x2c834f);});});;});};function addVoicePrefixExtensions(_0x2843fb,_0x5522db){var _0x1114d4=[];var _0x901cc1=formatPrefixName(_0x2843fb[_0x6791('0x5f')]);_0x1114d4[_0x6791('0x65')](new Extension(_0x901cc1,0x2,_0x6791('0x66'),_0x6791('0x67')+_0x2843fb['name']));if(_0x2843fb[_0x6791('0x68')]){_0x1114d4[_0x6791('0x65')](new Extension(_0x901cc1,0x3,_0x6791('0x66'),'PREFIX-CALLERIDALL='+_0x2843fb[_0x6791('0x68')]));}else{_0x1114d4['push'](new Extension(_0x901cc1,0x3,_0x6791('0x60'),_0x6791('0x69')));}_0x1114d4[_0x6791('0x65')](new Extension(_0x901cc1,0x4,_0x6791('0x6a'),_0x5522db[_0x6791('0x58')]+','+'${EXTEN:'+(0x8+_0x2843fb[_0x6791('0x2b')][_0x6791('0x48')])+'}'+','+0x1));return _0x1114d4;}function formatPrefixName(_0x375062){var _0x2accfa='_';for(var _0x5f158f=0x0;_0x5f158f<_0x375062[_0x6791('0x48')];_0x5f158f++){if(_0x375062[_0x6791('0x6b')](_0x5f158f)=='-'){_0x2accfa+=_0x375062['charAt'](_0x5f158f);}else{_0x2accfa+='['+_0x375062[_0x6791('0x6b')](_0x5f158f)+']';}}_0x2accfa+='.';return _0x2accfa;}exports[_0x6791('0x6c')]=function(_0x567302,_0x201465,_0x23b9b4){var _0x113d9f=_0x567302[_0x6791('0x4e')];_0x113d9f['prefix']=_0x6791('0x6d')+_0x113d9f[_0x6791('0x2b')]+'-';return db['sequelize'][_0x6791('0x6e')](function(_0x26c2aa){return db[_0x6791('0x2f')][_0x6791('0x6c')](_0x113d9f,{'where':{'id':_0x113d9f['id']},'transaction':_0x26c2aa})[_0x6791('0x25')](function(){return db['VoiceExtension'][_0x6791('0x26')]({'where':{'VoicePrefixId':_0x113d9f['id']},'transaction':_0x26c2aa})[_0x6791('0x25')](function(){return db['VoiceExtension'][_0x6791('0x49')]({'where':{'id':_0x113d9f[_0x6791('0x50')]},'raw':!![]})[_0x6791('0x25')](function(_0x4bbf2d){return createVoicePrefixExtensions(_0x113d9f,_0x4bbf2d,_0x26c2aa);});});});})[_0x6791('0x25')](function(){return db[_0x6791('0x2f')][_0x6791('0x6f')](_0x113d9f['id']);})[_0x6791('0x25')](respondWithResult(_0x201465,null))[_0x6791('0x4a')](handleError(_0x201465,null));};exports[_0x6791('0x70')]=function(_0x367dc9,_0x30b3e6,_0x4cca28){return db[_0x6791('0x2f')][_0x6791('0x49')]({'where':{'id':_0x367dc9['params']['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x30b3e6,null))[_0x6791('0x25')](function(_0x410a66){if(_0x410a66){return _0x410a66['addAgents'](_0x367dc9[_0x6791('0x4e')]['ids'],_[_0x6791('0x71')](_0x367dc9[_0x6791('0x4e')],[_0x6791('0x72'),'id'])||{})[_0x6791('0x73')](function(_0x3a964a){for(var _0x2d15b5=0x0;_0x2d15b5<_0x367dc9[_0x6791('0x4e')][_0x6791('0x72')][_0x6791('0x48')];_0x2d15b5+=0x1){socket[_0x6791('0x74')](_0x6791('0x75'),{'UserId':Number(_0x367dc9[_0x6791('0x4e')][_0x6791('0x72')][_0x2d15b5]),'VoicePrefixId':Number(_0x367dc9[_0x6791('0x45')]['id'])});}return _0x3a964a;});}})[_0x6791('0x25')](respondWithResult(_0x30b3e6,null))[_0x6791('0x4a')](handleError(_0x30b3e6,null));};exports[_0x6791('0x76')]=function(_0x386bc7,_0xc6c959,_0x5cf7d7){return db['VoicePrefix']['find']({'where':{'id':_0x386bc7[_0x6791('0x45')]['id']}})[_0x6791('0x25')](handleEntityNotFound(_0xc6c959,null))[_0x6791('0x25')](function(_0x194a0b){if(_0x194a0b){return _0x194a0b[_0x6791('0x76')](_0x386bc7[_0x6791('0x34')][_0x6791('0x72')])[_0x6791('0x25')](function(){if(_[_0x6791('0x77')](_0x386bc7[_0x6791('0x34')][_0x6791('0x72')])){for(var _0x37ae6b=0x0;_0x37ae6b<_0x386bc7[_0x6791('0x34')][_0x6791('0x72')][_0x6791('0x48')];_0x37ae6b+=0x1){socket[_0x6791('0x74')](_0x6791('0x78'),{'UserId':Number(_0x386bc7[_0x6791('0x34')][_0x6791('0x72')][_0x37ae6b]),'VoicePrefixId':Number(_0x386bc7[_0x6791('0x45')]['id'])});}}else{socket[_0x6791('0x74')](_0x6791('0x78'),{'UserId':Number(_0x386bc7[_0x6791('0x34')][_0x6791('0x72')]),'VoicePrefixId':Number(_0x386bc7[_0x6791('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0xc6c959,null))[_0x6791('0x4a')](handleError(_0xc6c959,null));};exports['getAgents']=function(_0x8d9556,_0x11eb22,_0x4b262c){var _0x1c2864={};var _0x503041={};var _0x27e3bd;var _0x26e77c;return db['VoicePrefix'][_0x6791('0x79')]({'where':{'id':_0x8d9556[_0x6791('0x45')]['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x11eb22,null))['then'](function(_0x41fcf4){if(_0x41fcf4){_0x27e3bd=_0x41fcf4;_0x503041[_0x6791('0x33')]=_[_0x6791('0x46')](db[_0x6791('0x7a')][_0x6791('0x47')]);_0x503041[_0x6791('0x34')]=_['keys'](_0x8d9556[_0x6791('0x34')]);_0x503041[_0x6791('0x35')]=_[_0x6791('0x36')](_0x503041[_0x6791('0x33')],_0x503041[_0x6791('0x34')]);_0x1c2864[_0x6791('0x37')]=_[_0x6791('0x36')](_0x503041['model'],qs[_0x6791('0x38')](_0x8d9556['query'][_0x6791('0x38')]));_0x1c2864['attributes']=_0x1c2864[_0x6791('0x37')][_0x6791('0x48')]?_0x1c2864[_0x6791('0x37')]:_0x503041[_0x6791('0x33')];_0x1c2864[_0x6791('0x3b')]=qs[_0x6791('0x3c')](_0x8d9556['query'][_0x6791('0x3c')]);_0x1c2864['where']=qs[_0x6791('0x35')](_['pick'](_0x8d9556['query'],_0x503041['filters']));if(_0x8d9556[_0x6791('0x34')][_0x6791('0x3e')]){_0x1c2864['where']=_[_0x6791('0x3f')](_0x1c2864['where'],{'$or':_[_0x6791('0x2e')](_0x1c2864[_0x6791('0x37')],function(_0x4f52c2){var _0x494435={};_0x494435[_0x4f52c2]={'$like':'%'+_0x8d9556['query'][_0x6791('0x3e')]+'%'};return _0x494435;})});}_0x1c2864=_[_0x6791('0x3f')]({},_0x1c2864,_0x8d9556[_0x6791('0x41')]);return _0x27e3bd['getAgents'](_0x1c2864);}})[_0x6791('0x25')](function(_0x20ded4){if(_0x20ded4){_0x26e77c=_0x20ded4[_0x6791('0x48')];if(!_0x8d9556[_0x6791('0x34')][_0x6791('0x39')]('nolimit')){_0x1c2864[_0x6791('0x1f')]=qs[_0x6791('0x1f')](_0x8d9556[_0x6791('0x34')][_0x6791('0x1f')]);_0x1c2864[_0x6791('0x21')]=qs['offset'](_0x8d9556[_0x6791('0x34')][_0x6791('0x21')]);}return _0x27e3bd['getAgents'](_0x1c2864);}})[_0x6791('0x25')](function(_0x46aea7){if(_0x46aea7){return _0x46aea7?{'count':_0x26e77c,'rows':_0x46aea7}:null;}})[_0x6791('0x25')](respondWithResult(_0x11eb22,null))[_0x6791('0x4a')](handleError(_0x11eb22,null));};exports['getTeams']=function(_0x29e2a0,_0x1092d4,_0x370da4){var _0xdf1dd4={};var _0xa5eb83={};var _0x145814;var _0x5dcaab;return db[_0x6791('0x2f')]['findOne']({'where':{'id':_0x29e2a0['params']['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x1092d4,null))[_0x6791('0x25')](function(_0x313d5d){if(_0x313d5d){_0x145814=_0x313d5d;_0xa5eb83['model']=_[_0x6791('0x46')](db['Team'][_0x6791('0x47')]);_0xa5eb83[_0x6791('0x34')]=_['keys'](_0x29e2a0[_0x6791('0x34')]);_0xa5eb83[_0x6791('0x35')]=_[_0x6791('0x36')](_0xa5eb83[_0x6791('0x33')],_0xa5eb83[_0x6791('0x34')]);_0xdf1dd4['attributes']=_[_0x6791('0x36')](_0xa5eb83[_0x6791('0x33')],qs[_0x6791('0x38')](_0x29e2a0['query']['fields']));_0xdf1dd4[_0x6791('0x37')]=_0xdf1dd4[_0x6791('0x37')]['length']?_0xdf1dd4[_0x6791('0x37')]:_0xa5eb83[_0x6791('0x33')];_0xdf1dd4[_0x6791('0x3b')]=qs['sort'](_0x29e2a0[_0x6791('0x34')]['sort']);_0xdf1dd4['where']=qs[_0x6791('0x35')](_['pick'](_0x29e2a0[_0x6791('0x34')],_0xa5eb83[_0x6791('0x35')]));if(_0x29e2a0[_0x6791('0x34')][_0x6791('0x3e')]){_0xdf1dd4[_0x6791('0x3d')]=_[_0x6791('0x3f')](_0xdf1dd4['where'],{'$or':_[_0x6791('0x2e')](_0xdf1dd4['attributes'],function(_0x221fad){var _0x4d6641={};_0x4d6641[_0x221fad]={'$like':'%'+_0x29e2a0['query'][_0x6791('0x3e')]+'%'};return _0x4d6641;})});}_0xdf1dd4=_[_0x6791('0x3f')]({},_0xdf1dd4,_0x29e2a0[_0x6791('0x41')]);return _0x145814[_0x6791('0x7b')](_0xdf1dd4);}})[_0x6791('0x25')](function(_0x11089f){if(_0x11089f){_0x5dcaab=_0x11089f[_0x6791('0x48')];if(!_0x29e2a0[_0x6791('0x34')][_0x6791('0x39')](_0x6791('0x3a'))){_0xdf1dd4[_0x6791('0x1f')]=qs[_0x6791('0x1f')](_0x29e2a0[_0x6791('0x34')][_0x6791('0x1f')]);_0xdf1dd4[_0x6791('0x21')]=qs[_0x6791('0x21')](_0x29e2a0[_0x6791('0x34')][_0x6791('0x21')]);}return _0x145814[_0x6791('0x7b')](_0xdf1dd4);}})['then'](function(_0xfef30e){if(_0xfef30e){return _0xfef30e?{'count':_0x5dcaab,'rows':_0xfef30e}:null;}})[_0x6791('0x25')](respondWithResult(_0x1092d4,null))[_0x6791('0x4a')](handleError(_0x1092d4,null));};exports['addTeams']=function(_0x4c6eb1,_0x4bce1d,_0x42d7fb){var _0x257efa=_0x4c6eb1['body'][_0x6791('0x72')];var _0x17c93e;return db[_0x6791('0x7c')][_0x6791('0x7d')]({'where':{'id':_0x257efa},'attributes':['id'],'include':[{'model':db[_0x6791('0x7a')],'as':_0x6791('0x7e'),'attributes':['id',_0x6791('0x2b'),_0x6791('0x7f'),'voicePause',_0x6791('0x80')],'raw':!![]}]})['then'](function(_0xd61243){if(_0xd61243){_0x17c93e=_0xd61243;var _0x123627=_[_0x6791('0x81')](_0xd61243,function(_0x5d5963){var _0x4d36de=_0x5d5963['get']({'plain':!![]});return _0x4d36de[_0x6791('0x7e')];});return db[_0x6791('0x2f')][_0x6791('0x49')]({'where':{'id':_0x4c6eb1[_0x6791('0x45')]['id']}})['then'](function(_0x3b487a){return db[_0x6791('0x4d')][_0x6791('0x6e')](function(_0x3b0d8f){return _0x3b487a['addTeams'](_0x257efa,{'transaction':_0x3b0d8f})['then'](function(){return BPromise['each'](_0x17c93e,function(_0x3a7711){return db['TeamVoicePrefix'][_0x6791('0x82')]({'TeamId':_0x3a7711['id'],'VoicePrefixId':_0x4c6eb1[_0x6791('0x45')]['id']},{'transaction':_0x3b0d8f});});})[_0x6791('0x25')](function(){return BPromise[_0x6791('0x83')](_0x123627,function(_0x15a95b){return db[_0x6791('0x84')][_0x6791('0x85')]({'where':{'UserId':_0x15a95b['id'],'VoicePrefixId':_0x4c6eb1[_0x6791('0x45')]['id']},'transaction':_0x3b0d8f});});})['then'](function(){_0x123627[_0x6791('0x86')](function(_0x300c8b){socket['emit'](_0x6791('0x75'),{'UserId':_0x300c8b['id'],'VoicePrefixId':_0x3b487a['id']});});});});});}})[_0x6791('0x25')](respondWithStatusCode(_0x4bce1d,null))[_0x6791('0x4a')](handleError(_0x4bce1d,null));};exports[_0x6791('0x87')]=function(_0x4f88e4,_0x447ea6,_0x31a2c8){return db[_0x6791('0x7c')][_0x6791('0x7d')]({'where':{'id':_0x4f88e4[_0x6791('0x34')][_0x6791('0x72')]},'attributes':['id'],'include':[{'model':db[_0x6791('0x7a')],'as':_0x6791('0x7e'),'attributes':['id'],'raw':!![]}]})[_0x6791('0x25')](handleEntityNotFound(_0x447ea6,null))['then'](function(_0x150a13){var _0x211721=_[_0x6791('0x2e')](_0x150a13,'id');var _0xb7986d=[];var _0x19cb72=[];var _0x5aad37=squel['select']();_0x5aad37[_0x6791('0x88')](_0x6791('0x89'))['from'](_0x6791('0x8a'),'tq')[_0x6791('0x8b')](_0x6791('0x8c'),'ut',_0x6791('0x8d'))[_0x6791('0x3d')](_0x6791('0x8e'),_0x4f88e4[_0x6791('0x45')]['id']);for(var _0x21a12c=0x0;_0x21a12c<_0x150a13[_0x6791('0x48')];_0x21a12c+=0x1){let _0x54a34f=_0x150a13[_0x21a12c];for(var _0x405e1c=0x0;_0x405e1c<_0x54a34f[_0x6791('0x7e')]['length'];_0x405e1c+=0x1){let _0x303ba8=_0x54a34f['Agents'][_0x405e1c];var _0x23bed3=_0x5aad37[_0x6791('0x8f')]();_0x23bed3[_0x6791('0x3d')](_0x6791('0x90'),_0x303ba8['id']);_0x19cb72[_0x6791('0x65')](db[_0x6791('0x4d')][_0x6791('0x34')](_0x23bed3[_0x6791('0x91')](),{'type':db[_0x6791('0x4d')][_0x6791('0x92')][_0x6791('0x93')]})[_0x6791('0x25')](function(_0x1f06d8){if(_0x1f06d8[_0x6791('0x48')]===0x1){return _0x303ba8['id'];}else{var _0x46d6ff=_[_0x6791('0x94')](_[_0x6791('0x2e')](_0x1f06d8,_0x6791('0x95')),function(_0x462e03){return _['includes'](_0x211721,_0x462e03);});if(_0x46d6ff){return _0x303ba8['id'];}}}));}}return BPromise[_0x6791('0x96')](_0x19cb72)['then'](function(_0x41385c){_0xb7986d=_(_0xb7986d)[_0x6791('0x97')](_0x41385c)[_0x6791('0x98')]()[_0x6791('0x99')]();return db[_0x6791('0x2f')][_0x6791('0x49')]({'where':{'id':_0x4f88e4[_0x6791('0x45')]['id']}})[_0x6791('0x25')](function(_0x546bf7){return db[_0x6791('0x4d')]['transaction'](function(_0x54cf28){return _0x546bf7[_0x6791('0x87')](_0x4f88e4[_0x6791('0x34')][_0x6791('0x72')],{'transaction':_0x54cf28})[_0x6791('0x25')](function(){if(!_[_0x6791('0x9a')](_0xb7986d)){return _0x546bf7[_0x6791('0x76')](_0xb7986d,{'transaction':_0x54cf28});}})[_0x6791('0x25')](function(){_0xb7986d['forEach'](function(_0x3b7b0f){socket[_0x6791('0x74')](_0x6791('0x78'),{'UserId':_0x3b7b0f,'VoicePrefixId':_0x546bf7['id']});});});});});});})[_0x6791('0x25')](respondWithStatusCode(_0x447ea6,null))[_0x6791('0x4a')](handleError(_0x447ea6,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 2f7494e..8bd0651 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 _0xa7bb=['setMaxListeners','remove','emit','hasOwnProperty','hook','VoicePrefix'];(function(_0x820b17,_0xeb173d){var _0x39eb7c=function(_0x43db91){while(--_0x43db91){_0x820b17['push'](_0x820b17['shift']());}};_0x39eb7c(++_0xeb173d);}(_0xa7bb,0x179));var _0xba7b=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa7bb[_0x3635ce];return _0x97ecd0;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0xba7b('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xba7b('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xba7b('0x2')};function emitEvent(_0x336530){return function(_0x149578,_0x22d94b,_0x179e19){VoicePrefixEvents[_0xba7b('0x3')](_0x336530+':'+_0x149578['id'],_0x149578);VoicePrefixEvents['emit'](_0x336530,_0x149578);_0x179e19(null);};}for(var e in events){if(events[_0xba7b('0x4')](e)){var event=events[e];VoicePrefix[_0xba7b('0x5')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xf4da=['events','save','update','remove','emit','exports'];(function(_0xfcf5f4,_0x414890){var _0x2aea1c=function(_0xe57313){while(--_0xe57313){_0xfcf5f4['push'](_0xfcf5f4['shift']());}};_0x2aea1c(++_0x414890);}(_0xf4da,0x14a));var _0xaf4d=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xf4da[_0xae7c2f];return _0x5d7001;};'use strict';var EventEmitter=require(_0xaf4d('0x0'));var VoicePrefix=require('../../mysqldb')['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaf4d('0x1'),'afterUpdate':_0xaf4d('0x2'),'afterDestroy':_0xaf4d('0x3')};function emitEvent(_0x30f1f7){return function(_0x22b1e7,_0x450fa8,_0x182a95){VoicePrefixEvents[_0xaf4d('0x4')](_0x30f1f7+':'+_0x22b1e7['id'],_0x22b1e7);VoicePrefixEvents[_0xaf4d('0x4')](_0x30f1f7,_0x22b1e7);_0x182a95(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xaf4d('0x5')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 87153e5..af96b64 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 _0x0901=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','define','lodash','util'];(function(_0x520bf3,_0x2840c8){var _0x5d7441=function(_0x33d782){while(--_0x33d782){_0x520bf3['push'](_0x520bf3['shift']());}};_0x5d7441(++_0x2840c8);}(_0x0901,0x1ab));var _0x1090=function(_0x1bf06b,_0x1801e5){_0x1bf06b=_0x1bf06b-0x0;var _0x17e652=_0x0901[_0x1bf06b];return _0x17e652;};'use strict';var _=require(_0x1090('0x0'));var util=require(_0x1090('0x1'));var logger=require(_0x1090('0x2'))(_0x1090('0x3'));var moment=require(_0x1090('0x4'));var BPromise=require('bluebird');var rp=require(_0x1090('0x5'));var fs=require('fs');var path=require(_0x1090('0x6'));var rimraf=require(_0x1090('0x7'));var config=require(_0x1090('0x8'));var attributes=require(_0x1090('0x9'));module['exports']=function(_0x46026f,_0x26f7bb){return _0x46026f[_0x1090('0xa')]('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba68=['define','VoicePrefix','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voicePrefix.attributes','exports'];(function(_0x49ba19,_0x377732){var _0xa556c0=function(_0x23c948){while(--_0x23c948){_0x49ba19['push'](_0x49ba19['shift']());}};_0xa556c0(++_0x377732);}(_0xba68,0xb6));var _0x8ba6=function(_0xc7e1f1,_0x52168e){_0xc7e1f1=_0xc7e1f1-0x0;var _0x88efe7=_0xba68[_0xc7e1f1];return _0x88efe7;};'use strict';var _=require('lodash');var util=require(_0x8ba6('0x0'));var logger=require(_0x8ba6('0x1'))(_0x8ba6('0x2'));var moment=require(_0x8ba6('0x3'));var BPromise=require(_0x8ba6('0x4'));var rp=require(_0x8ba6('0x5'));var fs=require('fs');var path=require(_0x8ba6('0x6'));var rimraf=require(_0x8ba6('0x7'));var config=require('../../config/environment');var attributes=require(_0x8ba6('0x8'));module[_0x8ba6('0x9')]=function(_0x25544d,_0x5a27a4){return _0x25544d[_0x8ba6('0xa')](_0x8ba6('0xb'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 2f9942b..fbdf0ef 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 _0x960c=['socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','localhost'];(function(_0x35a95b,_0x155bd2){var _0x1fb702=function(_0x4adebc){while(--_0x4adebc){_0x35a95b['push'](_0x35a95b['shift']());}};_0x1fb702(++_0x155bd2);}(_0x960c,0x113));var _0xc960=function(_0x32ab69,_0x15afb1){_0x32ab69=_0x32ab69-0x0;var _0x51b8d0=_0x960c[_0x32ab69];return _0x51b8d0;};'use strict';var _=require(_0xc960('0x0'));var util=require('util');var moment=require(_0xc960('0x1'));var BPromise=require('bluebird');var rs=require(_0xc960('0x2'));var fs=require('fs');var Redis=require(_0xc960('0x3'));var db=require(_0xc960('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc960('0x5'))(_0xc960('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc960('0x7')][_0xc960('0x8')]({'port':0x232a});config[_0xc960('0x9')]=_['defaults'](config['redis'],{'host':_0xc960('0xa'),'port':0x18eb});var socket=require(_0xc960('0xb'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0xc960('0xc')](socket);function respondWithRpcPromise(_0x27b0d6,_0x1e999f,_0x465ca0){return new BPromise(function(_0x5a9ace,_0x5358d0){return client[_0xc960('0xd')](_0x27b0d6,_0x465ca0)[_0xc960('0xe')](function(_0x18d8c9){logger[_0xc960('0xf')](_0xc960('0x10'),_0x1e999f,_0xc960('0x11'));logger[_0xc960('0x12')](_0xc960('0x13'),_0x1e999f,_0xc960('0x11'),JSON[_0xc960('0x14')](_0x18d8c9));if(_0x18d8c9[_0xc960('0x15')]){if(_0x18d8c9['error'][_0xc960('0x16')]===0x1f4){logger[_0xc960('0x15')](_0xc960('0x10'),_0x1e999f,_0x18d8c9[_0xc960('0x15')]['message']);return _0x5358d0(_0x18d8c9[_0xc960('0x15')][_0xc960('0x17')]);}logger[_0xc960('0x15')](_0xc960('0x10'),_0x1e999f,_0x18d8c9[_0xc960('0x15')][_0xc960('0x17')]);return _0x5a9ace(_0x18d8c9[_0xc960('0x15')][_0xc960('0x17')]);}else{logger[_0xc960('0xf')](_0xc960('0x10'),_0x1e999f,_0xc960('0x11'));_0x5a9ace(_0x18d8c9[_0xc960('0x18')][_0xc960('0x17')]);}})[_0xc960('0x19')](function(_0x3a23b3){logger['error'](_0xc960('0x10'),_0x1e999f,_0x3a23b3);_0x5358d0(_0x3a23b3);});});} \ No newline at end of file +var _0xa498=['socket.io-emitter','./voicePrefix.socket','register','request','then','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','error','VoicePrefix,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost'];(function(_0x511a19,_0x417e36){var _0x499aa6=function(_0x270874){while(--_0x270874){_0x511a19['push'](_0x511a19['shift']());}};_0x499aa6(++_0x417e36);}(_0xa498,0x179));var _0x8a49=function(_0x3042d5,_0x349534){_0x3042d5=_0x3042d5-0x0;var _0x1acfef=_0xa498[_0x3042d5];return _0x1acfef;};'use strict';var _=require(_0x8a49('0x0'));var util=require(_0x8a49('0x1'));var moment=require(_0x8a49('0x2'));var BPromise=require('bluebird');var rs=require(_0x8a49('0x3'));var fs=require('fs');var Redis=require(_0x8a49('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a49('0x5'));var logger=require(_0x8a49('0x6'))(_0x8a49('0x7'));var config=require(_0x8a49('0x8'));var jayson=require(_0x8a49('0x9'));var client=jayson[_0x8a49('0xa')]['http']({'port':0x232a});config[_0x8a49('0xb')]=_['defaults'](config['redis'],{'host':_0x8a49('0xc'),'port':0x18eb});var socket=require(_0x8a49('0xd'))(new Redis(config[_0x8a49('0xb')]));require(_0x8a49('0xe'))[_0x8a49('0xf')](socket);function respondWithRpcPromise(_0x1e098e,_0x49dca9,_0x2ae425){return new BPromise(function(_0x224a4b,_0x19f10a){return client[_0x8a49('0x10')](_0x1e098e,_0x2ae425)[_0x8a49('0x11')](function(_0x59885a){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x49dca9,_0x8a49('0x12'));logger['debug'](_0x8a49('0x13'),_0x49dca9,'request\x20sent',JSON['stringify'](_0x59885a));if(_0x59885a[_0x8a49('0x14')]){if(_0x59885a[_0x8a49('0x14')]['code']===0x1f4){logger[_0x8a49('0x14')](_0x8a49('0x15'),_0x49dca9,_0x59885a['error'][_0x8a49('0x16')]);return _0x19f10a(_0x59885a[_0x8a49('0x14')]['message']);}logger[_0x8a49('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x49dca9,_0x59885a[_0x8a49('0x14')]['message']);return _0x224a4b(_0x59885a['error']['message']);}else{logger[_0x8a49('0x17')](_0x8a49('0x15'),_0x49dca9,'request\x20sent');_0x224a4b(_0x59885a[_0x8a49('0x18')][_0x8a49('0x16')]);}})[_0x8a49('0x19')](function(_0xc4bd0b){logger[_0x8a49('0x14')](_0x8a49('0x15'),_0x49dca9,_0xc4bd0b);_0x19f10a(_0xc4bd0b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index f5731c8..8cb9249 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 _0x8a9d=['register','length','voicePrefix:','./voicePrefix.events','save','update','removeListener'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x8a9d,0x1ed));var _0xd8a9=function(_0x295f7f,_0x561913){_0x295f7f=_0x295f7f-0x0;var _0x5cd7ab=_0x8a9d[_0x295f7f];return _0x5cd7ab;};'use strict';var VoicePrefixEvents=require(_0xd8a9('0x0'));var events=[_0xd8a9('0x1'),'remove',_0xd8a9('0x2')];function createListener(_0x91259,_0x502276){return function(_0x32b520){_0x502276['emit'](_0x91259,_0x32b520);};}function removeListener(_0x5ee117,_0x1b6f39){return function(){VoicePrefixEvents[_0xd8a9('0x3')](_0x5ee117,_0x1b6f39);};}exports[_0xd8a9('0x4')]=function(_0x5f56e6){for(var _0x2645b2=0x0,_0x37b86d=events[_0xd8a9('0x5')];_0x2645b2<_0x37b86d;_0x2645b2++){var _0x5610b7=events[_0x2645b2];var _0x5c3949=createListener(_0xd8a9('0x6')+_0x5610b7,_0x5f56e6);VoicePrefixEvents['on'](_0x5610b7,_0x5c3949);}}; \ No newline at end of file +var _0xac72=['register','length','voicePrefix:','./voicePrefix.events','save','remove','emit','removeListener'];(function(_0x24ed4c,_0x3944b0){var _0x58289a=function(_0x1b89ff){while(--_0x1b89ff){_0x24ed4c['push'](_0x24ed4c['shift']());}};_0x58289a(++_0x3944b0);}(_0xac72,0x1eb));var _0x2ac7=function(_0x190d06,_0x44da19){_0x190d06=_0x190d06-0x0;var _0x4c532f=_0xac72[_0x190d06];return _0x4c532f;};'use strict';var VoicePrefixEvents=require(_0x2ac7('0x0'));var events=[_0x2ac7('0x1'),_0x2ac7('0x2'),'update'];function createListener(_0x164d24,_0x2620d6){return function(_0x6eda17){_0x2620d6[_0x2ac7('0x3')](_0x164d24,_0x6eda17);};}function removeListener(_0x238ae5,_0x38dc98){return function(){VoicePrefixEvents[_0x2ac7('0x4')](_0x238ae5,_0x38dc98);};}exports[_0x2ac7('0x5')]=function(_0x2c56b0){for(var _0x28add9=0x0,_0x4e11a4=events[_0x2ac7('0x6')];_0x28add9<_0x4e11a4;_0x28add9++){var _0xf836e2=events[_0x28add9];var _0x5055f1=createListener(_0x2ac7('0x7')+_0xf836e2,_0x2c56b0);VoicePrefixEvents['on'](_0xf836e2,_0x5055f1);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 8374699..919e429 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(_0x4e7413,_0x5dffb1){var _0x11b6de=function(_0xd6721b){while(--_0xd6721b){_0x4e7413['push'](_0x4e7413['shift']());}};_0x11b6de(++_0x5dffb1);}(_0xb10b,0x12a));var _0xbb10=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0xb10b[_0x1bc0ae];return _0x501104;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x435b2f,_0x4c44da){var _0x181648=function(_0x3d753e){while(--_0x3d753e){_0x435b2f['push'](_0x435b2f['shift']());}};_0x181648(++_0x4c44da);}(_0xb10b,0x12a));var _0xbb10=function(_0x3145af,_0x53a1d5){_0x3145af=_0x3145af-0x0;var _0x37758a=_0xb10b[_0x3145af];return _0x37758a;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index f44c342..20ed322 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 _0x24c8=['ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','ENUM','inbound','default','ringall','leastrecent','random','rrmemory','linear','wrandom','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','BOOLEAN','DESC'];(function(_0x1952cf,_0xb9f58c){var _0x487d56=function(_0x529653){while(--_0x529653){_0x1952cf['push'](_0x1952cf['shift']());}};_0x487d56(++_0xb9f58c);}(_0x24c8,0x147));var _0x824c=function(_0x12833b,_0x26c1d2){_0x12833b=_0x12833b-0x0;var _0x3acad3=_0x24c8[_0x12833b];return _0x3acad3;};'use strict';var Sequelize=require(_0x824c('0x0'));module['exports']={'name':{'type':Sequelize[_0x824c('0x1')],'allowNull':![],'unique':_0x824c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x824c('0x3')](_0x824c('0x4'),'outbound'),'allowNull':![],'defaultValue':_0x824c('0x4')},'musiconhold':{'type':Sequelize[_0x824c('0x1')],'defaultValue':_0x824c('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x824c('0x3')]('rr',_0x824c('0x6'),_0x824c('0x7'),'fewestcalls',_0x824c('0x8'),_0x824c('0x9'),_0x824c('0xa'),_0x824c('0xb'),'rrordered'),'allowNull':![],'defaultValue':_0x824c('0x6'),'set':function(_0x3bcc8c){this[_0x824c('0xc')](_0x824c('0xd'),_0x3bcc8c?_0x3bcc8c:'rrmemory');},'get':function(){var _0x4ae376=this[_0x824c('0xe')](_0x824c('0xf'));var _0x1b4e84=this[_0x824c('0xe')](_0x824c('0x10'));var _0x59a3=this[_0x824c('0xe')]('strategy');if(_0x4ae376===_0x824c('0x4')){return _0x59a3;}if(_0x1b4e84===_0x824c('0x11')&&_0x59a3===_0x824c('0x9')||_0x1b4e84===_0x824c('0x11')&&_0x59a3===_0x824c('0x12')){return _0x59a3;}if(_0x1b4e84===_0x824c('0x13')||_0x1b4e84===_0x824c('0x14')||_0x1b4e84===_0x824c('0x15')){return _0x59a3;}return null;}},'servicelevel':{'type':Sequelize[_0x824c('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x824c('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x824c('0x16')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x824c('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x824c('0x1')]},'weight':{'type':Sequelize[_0x824c('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x824c('0x3')](_0x824c('0x17'),'no'),'defaultValue':_0x824c('0x17')},'autopause':{'type':Sequelize['ENUM'](_0x824c('0x17'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x824c('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x824c('0x3')](_0x824c('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x824c('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x824c('0x3')](_0x824c('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x824c('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x824c('0x3')](_0x824c('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x824c('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x824c('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x824c('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x824c('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x824c('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x824c('0x3')](_0x824c('0x17'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x824c('0x3')](_0x824c('0x17'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x824c('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x824c('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x824c('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x824c('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x824c('0x1')]},'queue_youarenext':{'type':Sequelize[_0x824c('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x824c('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x824c('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x824c('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x824c('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x824c('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x824c('0x1')]},'queue_quantity2':{'type':Sequelize[_0x824c('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x824c('0x1')]},'queue_less_than':{'type':Sequelize[_0x824c('0x1')]},'periodic_announce':{'type':Sequelize[_0x824c('0x18')],'set':function(_0x3e02d0){this[_0x824c('0xc')](_0x824c('0x19'),_0x3e02d0?_0x3e02d0[_0x824c('0x1a')](','):[]);},'get':function(){return this[_0x824c('0xe')](_0x824c('0x19'))?this[_0x824c('0xe')]('periodic_announce')[_0x824c('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x824c('0x1')],'defaultValue':_0x824c('0x17'),'set':function(_0x29afaf){this['setDataValue'](_0x824c('0x1c'),_0x29afaf?_0x29afaf['join'](','):undefined);},'get':function(){return this[_0x824c('0xe')](_0x824c('0x1c'))?this['getDataValue'](_0x824c('0x1c'))[_0x824c('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x824c('0x1')],'defaultValue':'no','set':function(_0x3f40f8){this[_0x824c('0xc')](_0x824c('0x1d'),_0x3f40f8?_0x3f40f8[_0x824c('0x1a')](','):undefined);},'get':function(){return this[_0x824c('0xe')]('leavewhenempty')?this[_0x824c('0xe')]('leavewhenempty')[_0x824c('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x824c('0x3')](_0x824c('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x824c('0x3')](_0x824c('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x824c('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x824c('0x3')](_0x824c('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x824c('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x1fcd5c){this[_0x824c('0xc')](_0x824c('0x1e'),_0x1fcd5c);if(_0x1fcd5c){if(this[_0x824c('0xe')]('wrapuptime')<0x2){this[_0x824c('0xc')](_0x824c('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x824c('0x20')},'dialMethod':{'type':Sequelize[_0x824c('0x3')](_0x824c('0x21'),_0x824c('0x13'),_0x824c('0x15'),_0x824c('0x14'),_0x824c('0x11')),'defaultValue':_0x824c('0x13'),'comment':_0x824c('0x22')},'dialLimitChannel':{'type':Sequelize[_0x824c('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x824c('0x23')},'dialLimitQueue':{'type':Sequelize[_0x824c('0x16')](0x4)[_0x824c('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x824c('0x25')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x824c('0x26')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x824c('0x27'),'dropRate'),'defaultValue':_0x824c('0x28'),'comment':_0x824c('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x824c('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x824c('0x16')](0x3)[_0x824c('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x824c('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x824c('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x824c('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x824c('0x1')],'defaultValue':'tTxX','comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x824c('0x16')](0x3)[_0x824c('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x824c('0x2b')},'dialQueueProject':{'type':Sequelize[_0x824c('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x824c('0x16')](0x3)[_0x824c('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x824c('0x2c')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x824c('0x16')](0x5)[_0x824c('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x824c('0x16')](0x3)[_0x824c('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x824c('0x2d')},'dialBusyRetryFrequency':{'type':Sequelize[_0x824c('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x824c('0x24')],'defaultValue':0x3,'comment':_0x824c('0x2e')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x824c('0x16')](0x5)[_0x824c('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x824c('0x2f')},'dialGlobalMaxRetry':{'type':Sequelize[_0x824c('0x16')](0x3)[_0x824c('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x824c('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x824c('0x1')],'defaultValue':_0x824c('0x30')},'dialPrefix':{'type':Sequelize[_0x824c('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x824c('0x3')](_0x824c('0x31'),_0x824c('0x32'),_0x824c('0x33')),'defaultValue':_0x824c('0x31')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x824c('0x34')},'dialAMDInitialSilence':{'type':Sequelize[_0x824c('0x16')](0x9)[_0x824c('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x824c('0x35')},'dialAMDGreeting':{'type':Sequelize[_0x824c('0x16')](0x9)[_0x824c('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x824c('0x36')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x824c('0x16')](0x9)[_0x824c('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x824c('0x37')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x824c('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x824c('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x824c('0x38')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x824c('0x16')](0x9)[_0x824c('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x824c('0x16')](0x9)[_0x824c('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x824c('0x39')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x824c('0x16')](0x5)[_0x824c('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x824c('0x3a')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x824c('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x824c('0x3b')},'dialRecallMeTimeout':{'type':Sequelize[_0x824c('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x824c('0x3c')},'dialRecallInQueue':{'type':Sequelize[_0x824c('0x3d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x824c('0x3')](_0x824c('0x3e'),_0x824c('0x3f')),'defaultValue':_0x824c('0x3e')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x824c('0x40')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x824c('0x16')](0x3)[_0x824c('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x824c('0x41')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x824c('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x824c('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x824c('0x16')](0x3)[_0x824c('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x824c('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x824c('0x16')](0x5)[_0x824c('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x824c('0x16')](0x3)[_0x824c('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x824c('0x44')},'dialDropRetryFrequency':{'type':Sequelize[_0x824c('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x824c('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x824c('0x16')](0x3)[_0x824c('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x824c('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x824c('0x16')](0x5)[_0x824c('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x824c('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0x824c('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x824c('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x824c('0x48')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x824c('0x16')](0x3)[_0x824c('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x824c('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x824c('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x824c('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0x824c('0x3d')],'defaultValue':![],'comment':_0x824c('0x4b'),'set':function(_0x35deb1){if(!_0x35deb1)this['setDataValue'](_0x824c('0x4c'),null);this[_0x824c('0xc')](_0x824c('0x4d'),_0x35deb1);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x824c('0x16')](0x3)[_0x824c('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x824c('0x3d')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6ca0=['Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\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','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','linear','wrandom','rrordered','setDataValue','strategy','rrmemory','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','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\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length'];(function(_0x43d803,_0x2cfac6){var _0x465532=function(_0x2b7c68){while(--_0x2b7c68){_0x43d803['push'](_0x43d803['shift']());}};_0x465532(++_0x2cfac6);}(_0x6ca0,0x68));var _0x06ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ca0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x06ca('0x0'));module[_0x06ca('0x1')]={'name':{'type':Sequelize[_0x06ca('0x2')],'allowNull':![],'unique':_0x06ca('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x06ca('0x4')](_0x06ca('0x5'),_0x06ca('0x6')),'allowNull':![],'defaultValue':_0x06ca('0x5')},'musiconhold':{'type':Sequelize[_0x06ca('0x2')],'defaultValue':_0x06ca('0x7')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x06ca('0x4')]('rr',_0x06ca('0x8'),_0x06ca('0x9'),_0x06ca('0xa'),_0x06ca('0xb'),'rrmemory',_0x06ca('0xc'),_0x06ca('0xd'),_0x06ca('0xe')),'allowNull':![],'defaultValue':_0x06ca('0x8'),'set':function(_0x407b72){this[_0x06ca('0xf')](_0x06ca('0x10'),_0x407b72?_0x407b72:_0x06ca('0x11'));},'get':function(){var _0xbd7195=this[_0x06ca('0x12')](_0x06ca('0x13'));var _0xfbfa49=this[_0x06ca('0x12')](_0x06ca('0x14'));var _0x38f067=this[_0x06ca('0x12')](_0x06ca('0x10'));if(_0xbd7195===_0x06ca('0x5')){return _0x38f067;}if(_0xfbfa49==='booked'&&_0x38f067===_0x06ca('0x11')||_0xfbfa49===_0x06ca('0x15')&&_0x38f067===_0x06ca('0x16')){return _0x38f067;}if(_0xfbfa49===_0x06ca('0x17')||_0xfbfa49===_0x06ca('0x18')||_0xfbfa49===_0x06ca('0x19')){return _0x38f067;}return null;}},'servicelevel':{'type':Sequelize[_0x06ca('0x1a')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x06ca('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x06ca('0x1a')](0xb)},'timeout':{'type':Sequelize[_0x06ca('0x1a')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x06ca('0x2')]},'weight':{'type':Sequelize[_0x06ca('0x1a')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x06ca('0x4')](_0x06ca('0x1b'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x06ca('0x4')](_0x06ca('0x1b'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x06ca('0x1a')](0xb)},'autopausebusy':{'type':Sequelize[_0x06ca('0x4')](_0x06ca('0x1b'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x06ca('0x4')](_0x06ca('0x1b'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x06ca('0x4')](_0x06ca('0x1b'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x06ca('0x4')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x06ca('0x1b'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x06ca('0x1b'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x06ca('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x06ca('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x06ca('0x1a')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x06ca('0x4')](_0x06ca('0x1b'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x06ca('0x4')](_0x06ca('0x1b'),'no'),'defaultValue':_0x06ca('0x1b')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x06ca('0x1b'),'no',_0x06ca('0x1c')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x06ca('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x06ca('0x4')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x06ca('0x1a')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x06ca('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x06ca('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x06ca('0x2')]},'queue_youarenext':{'type':Sequelize[_0x06ca('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x06ca('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x06ca('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x06ca('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x06ca('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x06ca('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x06ca('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x06ca('0x2')]},'queue_quantity1':{'type':Sequelize[_0x06ca('0x2')]},'queue_quantity2':{'type':Sequelize[_0x06ca('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x06ca('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x06ca('0x1d')],'set':function(_0x513a31){this[_0x06ca('0xf')](_0x06ca('0x1e'),_0x513a31?_0x513a31[_0x06ca('0x1f')](','):[]);},'get':function(){return this[_0x06ca('0x12')](_0x06ca('0x1e'))?this[_0x06ca('0x12')](_0x06ca('0x1e'))[_0x06ca('0x20')](','):[];}},'joinempty':{'type':Sequelize[_0x06ca('0x2')],'defaultValue':_0x06ca('0x1b'),'set':function(_0x4b0c92){this[_0x06ca('0xf')](_0x06ca('0x21'),_0x4b0c92?_0x4b0c92[_0x06ca('0x1f')](','):undefined);},'get':function(){return this[_0x06ca('0x12')](_0x06ca('0x21'))?this['getDataValue']('joinempty')[_0x06ca('0x20')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x06ca('0x2')],'defaultValue':'no','set':function(_0x578e79){this[_0x06ca('0xf')](_0x06ca('0x22'),_0x578e79?_0x578e79[_0x06ca('0x1f')](','):undefined);},'get':function(){return this['getDataValue'](_0x06ca('0x22'))?this['getDataValue'](_0x06ca('0x22'))[_0x06ca('0x20')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x06ca('0x4')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x06ca('0x1a')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x06ca('0x4')](_0x06ca('0x1b'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x06ca('0x2')]},'description':{'type':Sequelize[_0x06ca('0x2')]},'acw':{'type':Sequelize[_0x06ca('0x23')],'defaultValue':0x0,'set':function(_0x59dbdf){this[_0x06ca('0xf')](_0x06ca('0x24'),_0x59dbdf);if(_0x59dbdf){if(this['getDataValue'](_0x06ca('0x25'))<0x2){this[_0x06ca('0xf')](_0x06ca('0x25'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x06ca('0x26')},'dialMethod':{'type':Sequelize['ENUM'](_0x06ca('0x27'),_0x06ca('0x17'),_0x06ca('0x19'),_0x06ca('0x18'),_0x06ca('0x15')),'defaultValue':'progressive','comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x06ca('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x06ca('0x29')},'dialLimitQueue':{'type':Sequelize[_0x06ca('0x1a')](0x4)[_0x06ca('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x06ca('0x2a')},'dialPowerLevel':{'type':Sequelize[_0x06ca('0x2b')](0x2)[_0x06ca('0x28')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x06ca('0x2c')},'dialPredictiveOptimization':{'type':Sequelize[_0x06ca('0x4')](_0x06ca('0x2d'),_0x06ca('0x2e')),'defaultValue':_0x06ca('0x2e'),'comment':_0x06ca('0x2f')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x06ca('0x2b')](0x2)[_0x06ca('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x06ca('0x30')},'dialPredictiveInterval':{'type':Sequelize[_0x06ca('0x1a')](0x3)[_0x06ca('0x28')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x06ca('0x31')},'dialOriginateCallerIdName':{'type':Sequelize[_0x06ca('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x06ca('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x06ca('0x32')},'dialQueueOptions':{'type':Sequelize[_0x06ca('0x2')],'defaultValue':_0x06ca('0x33'),'comment':_0x06ca('0x34')},'dialQueueTimeout':{'type':Sequelize[_0x06ca('0x1a')](0x3)[_0x06ca('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x06ca('0x35')},'dialQueueProject':{'type':Sequelize[_0x06ca('0x2')],'comment':_0x06ca('0x36')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x06ca('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x06ca('0x37')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x06ca('0x1a')](0x5)[_0x06ca('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x06ca('0x38')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x06ca('0x39')},'dialBusyRetryFrequency':{'type':Sequelize[_0x06ca('0x1a')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x06ca('0x28')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x06ca('0x1a')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x06ca('0x3a')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x06ca('0x28')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x06ca('0x3b')},'dialTimezone':{'type':Sequelize[_0x06ca('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x06ca('0x2')],'defaultValue':_0x06ca('0x3c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0x06ca('0x3d'),_0x06ca('0x3e')),'defaultValue':_0x06ca('0x3f')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x06ca('0x40')},'dialAMDInitialSilence':{'type':Sequelize[_0x06ca('0x1a')](0x9)[_0x06ca('0x28')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x06ca('0x41')},'dialAMDGreeting':{'type':Sequelize[_0x06ca('0x1a')](0x9)[_0x06ca('0x28')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x06ca('0x42')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x06ca('0x28')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x06ca('0x43')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x06ca('0x1a')](0x9)[_0x06ca('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x06ca('0x44')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x06ca('0x28')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x06ca('0x45')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x06ca('0x1a')](0x9)[_0x06ca('0x28')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x06ca('0x46')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x06ca('0x1a')](0x9)[_0x06ca('0x28')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x06ca('0x47')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x06ca('0x1a')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x06ca('0x48')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x06ca('0x1a')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x06ca('0x49')},'dialRecallMeTimeout':{'type':Sequelize[_0x06ca('0x1a')](0x5)[_0x06ca('0x28')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x06ca('0x4a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x06ca('0x4')](_0x06ca('0x4b'),_0x06ca('0x4c')),'defaultValue':_0x06ca('0x4b')},'dialQueueProject2':{'type':Sequelize[_0x06ca('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x06ca('0x23')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x06ca('0x23')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x06ca('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x06ca('0x4d')},'dialCutDigit':{'type':Sequelize[_0x06ca('0x1a')](0x3)[_0x06ca('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x06ca('0x4e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x06ca('0x1a')](0x3)[_0x06ca('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x06ca('0x1a')](0x5)[_0x06ca('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x06ca('0x4f')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x06ca('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x06ca('0x50')},'dialDropRetryFrequency':{'type':Sequelize[_0x06ca('0x1a')](0x5)[_0x06ca('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x06ca('0x1a')](0x3)[_0x06ca('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x06ca('0x51')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x06ca('0x1a')](0x5)[_0x06ca('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x06ca('0x1a')](0x3)[_0x06ca('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x06ca('0x52')},'dialMachineRetryFrequency':{'type':Sequelize[_0x06ca('0x1a')](0x5)[_0x06ca('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x06ca('0x53')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x06ca('0x1a')](0x3)[_0x06ca('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x06ca('0x54')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x06ca('0x1a')](0x5)[_0x06ca('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x06ca('0x55')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x06ca('0x56')},'mandatoryDisposition':{'type':Sequelize[_0x06ca('0x23')],'defaultValue':![],'comment':_0x06ca('0x57'),'set':function(_0x32068d){if(!_0x32068d)this['setDataValue'](_0x06ca('0x58'),null);this[_0x06ca('0xf')]('mandatoryDisposition',_0x32068d);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x06ca('0x1a')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x06ca('0x23')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 1f8c84e..f261137 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 _0x238b=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','include','findAll','rows','params','includeAll','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','VoiceQueues','autoAssociation','update','getHoppers','findOne','CmHopper','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','Agents','online','voicePause','interface','forEach','penalty','sequelize','addTeams','each','upsert','UserVoiceQueueRt','SIP/%s','emit','removeTeams','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','SELECT','TeamId','all','union','compact','transaction','ids','isEmpty','userVoiceQueue:remove','spread','userVoiceQueue:save','isNil','format','removeAgents','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','phone','NOW()','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','push','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','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','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','then','destroy','get','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','name','UserProfileResource','sendStatus','error','stack','index','VoiceQueue','rawAttributes','key'];(function(_0x48d0c2,_0x464976){var _0x561811=function(_0x40a73a){while(--_0x40a73a){_0x48d0c2['push'](_0x48d0c2['shift']());}};_0x561811(++_0x464976);}(_0x238b,0x1f1));var _0xb238=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x238b[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xb238('0x0'));var rimraf=require(_0xb238('0x1'));var zipdir=require(_0xb238('0x2'));var jsonpatch=require(_0xb238('0x3'));var rp=require(_0xb238('0x4'));var moment=require(_0xb238('0x5'));var BPromise=require(_0xb238('0x6'));var Mustache=require('mustache');var util=require(_0xb238('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xb238('0x8'));var ejs=require(_0xb238('0x9'));var fs=require('fs');var fs_extra=require(_0xb238('0xa'));var _=require(_0xb238('0xb'));var squel=require(_0xb238('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb238('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb238('0xe'));var Papa=require(_0xb238('0xf'));var Redis=require(_0xb238('0x10'));var authService=require(_0xb238('0x11'));var qs=require(_0xb238('0x12'));var as=require(_0xb238('0x13'));var hardwareService=require(_0xb238('0x14'));var logger=require(_0xb238('0x15'))('api');var utils=require(_0xb238('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb238('0x17'));var db=require('../../mysqldb')['db'];config[_0xb238('0x18')]=_[_0xb238('0x19')](config[_0xb238('0x18')],{'host':_0xb238('0x1a'),'port':0x18eb});var socket=require(_0xb238('0x1b'))(new Redis(config[_0xb238('0x18')]));require(_0xb238('0x1c'))[_0xb238('0x1d')](socket);function respondWithStatusCode(_0x1207bc,_0x5abf28){_0x5abf28=_0x5abf28||0xcc;return function(_0x482461){if(_0x482461){return _0x1207bc['sendStatus'](_0x5abf28);}return _0x1207bc[_0xb238('0x1e')](_0x5abf28)[_0xb238('0x1f')]();};}function respondWithResult(_0x47d98a,_0x8be3de){_0x8be3de=_0x8be3de||0xc8;return function(_0x10b92f){if(_0x10b92f){return _0x47d98a[_0xb238('0x1e')](_0x8be3de)[_0xb238('0x20')](_0x10b92f);}};}function respondWithFilteredResult(_0x44a2ff,_0x99b534){return function(_0x2c42fd){if(_0x2c42fd){var _0x243ade=typeof _0x99b534['offset']==='undefined'&&typeof _0x99b534['limit']===_0xb238('0x21');var _0x5dac2c=_0x2c42fd[_0xb238('0x22')];var _0x54d030=_0x243ade?0x0:_0x99b534[_0xb238('0x23')];var _0x4f2b16=_0x243ade?_0x2c42fd['count']:_0x99b534['offset']+_0x99b534['limit'];var _0x1510b3;if(_0x4f2b16>=_0x5dac2c){_0x4f2b16=_0x5dac2c;_0x1510b3=0xc8;}else{_0x1510b3=0xce;}_0x44a2ff[_0xb238('0x1e')](_0x1510b3);return _0x44a2ff[_0xb238('0x24')](_0xb238('0x25'),_0x54d030+'-'+_0x4f2b16+'/'+_0x5dac2c)[_0xb238('0x20')](_0x2c42fd);}return null;};}function patchUpdates(_0x30ceda){return function(_0x58ca04){try{jsonpatch[_0xb238('0x26')](_0x58ca04,_0x30ceda,!![]);}catch(_0x46a06f){return BPromise[_0xb238('0x27')](_0x46a06f);}return _0x58ca04['save']();};}function saveUpdates(_0x26e62e,_0x436e8b){return function(_0x59f533){if(_0x59f533){return _0x59f533['update'](_0x26e62e)[_0xb238('0x28')](function(_0x82acdb){return _0x82acdb;});}return null;};}function removeEntity(_0x45d553,_0x306f9a){return function(_0x31aedd){if(_0x31aedd){return _0x31aedd[_0xb238('0x29')]()[_0xb238('0x28')](function(){var _0x2a5b07=_0x31aedd[_0xb238('0x2a')]({'plain':!![]});var _0x5010d3=[{'name':'VoiceQueues','value':_0xb238('0x2b'),'ignore':![]},{'name':_0xb238('0x2c'),'value':_0xb238('0x2d'),'ignore':![]}];var _0x118663=_(_0x5010d3)[_0xb238('0x2e')](_0xb238('0x2f'))[_0xb238('0x30')](_0xb238('0x31'))[_0xb238('0x31')]();if(_[_0xb238('0x32')](_0x118663,_0x2a5b07['type'])){return;}var _0x3d5a44=_['find'](_0x5010d3,['value',_0x2a5b07[_0xb238('0x33')]])[_0xb238('0x34')];return db[_0xb238('0x35')][_0xb238('0x29')]({'where':{'type':_0x3d5a44,'resourceId':_0x2a5b07['id']}})['then'](function(){return _0x31aedd;});})['then'](function(){_0x45d553['status'](0xcc)[_0xb238('0x1f')]();});}};}function handleEntityNotFound(_0x119af7,_0x337a2f){return function(_0x562fc5){if(!_0x562fc5){_0x119af7[_0xb238('0x36')](0x194);}return _0x562fc5;};}function handleError(_0x2df5d8,_0x33dfa3){_0x33dfa3=_0x33dfa3||0x1f4;return function(_0x37f53a){logger[_0xb238('0x37')](_0x37f53a[_0xb238('0x38')]);if(_0x37f53a[_0xb238('0x34')]){delete _0x37f53a[_0xb238('0x34')];}_0x2df5d8[_0xb238('0x1e')](_0x33dfa3)['send'](_0x37f53a);};}exports[_0xb238('0x39')]=function(_0x4f204,_0x535a59){var _0x516c88={},_0x4a81bd={},_0x5a1447={'count':0x0,'rows':[]};var _0x31b798=_['map'](db[_0xb238('0x3a')][_0xb238('0x3b')],function(_0x1e772e){return{'name':_0x1e772e['fieldName'],'type':_0x1e772e[_0xb238('0x33')][_0xb238('0x3c')]};});_0x4a81bd[_0xb238('0x3d')]=_[_0xb238('0x30')](_0x31b798,_0xb238('0x34'));_0x4a81bd[_0xb238('0x3e')]=_[_0xb238('0x3f')](_0x4f204['query']);_0x4a81bd[_0xb238('0x40')]=_[_0xb238('0x41')](_0x4a81bd['model'],_0x4a81bd[_0xb238('0x3e')]);_0x516c88['attributes']=_[_0xb238('0x41')](_0x4a81bd[_0xb238('0x3d')],qs['fields'](_0x4f204['query'][_0xb238('0x42')]));_0x516c88[_0xb238('0x43')]=_0x516c88[_0xb238('0x43')][_0xb238('0x44')]?_0x516c88[_0xb238('0x43')]:_0x4a81bd['model'];if(!_0x4f204['query'][_0xb238('0x45')](_0xb238('0x46'))){_0x516c88[_0xb238('0x47')]=qs[_0xb238('0x47')](_0x4f204['query'][_0xb238('0x47')]);_0x516c88['offset']=qs[_0xb238('0x23')](_0x4f204['query'][_0xb238('0x23')]);}_0x516c88[_0xb238('0x48')]=qs[_0xb238('0x49')](_0x4f204['query'][_0xb238('0x49')]);_0x516c88[_0xb238('0x4a')]=qs[_0xb238('0x40')](_['pick'](_0x4f204['query'],_0x4a81bd['filters']),_0x31b798);if(_0x4f204[_0xb238('0x3e')][_0xb238('0x2e')]){_0x516c88['where']=_[_0xb238('0x4b')](_0x516c88[_0xb238('0x4a')],{'$or':_[_0xb238('0x30')](_0x31b798,function(_0x5a278f){if(_0x5a278f['type']!==_0xb238('0x4c')){var _0xe058d0={};_0xe058d0[_0x5a278f[_0xb238('0x34')]]={'$like':'%'+_0x4f204[_0xb238('0x3e')][_0xb238('0x2e')]+'%'};return _0xe058d0;}})});}_0x516c88=_[_0xb238('0x4b')]({},_0x516c88,_0x4f204['options']);var _0x37a11e={'where':_0x516c88['where']};return db[_0xb238('0x3a')]['count'](_0x37a11e)['then'](function(_0x20ff6e){_0x5a1447['count']=_0x20ff6e;if(_0x4f204[_0xb238('0x3e')]['includeAll']){_0x516c88[_0xb238('0x4d')]=[{'all':!![]}];}return db[_0xb238('0x3a')][_0xb238('0x4e')](_0x516c88);})[_0xb238('0x28')](function(_0x2d613e){_0x5a1447[_0xb238('0x4f')]=_0x2d613e;return _0x5a1447;})[_0xb238('0x28')](respondWithFilteredResult(_0x535a59,_0x516c88))['catch'](handleError(_0x535a59,null));};exports['show']=function(_0x523fa2,_0x1573c0){var _0x2800cd={'raw':![],'where':{'id':_0x523fa2[_0xb238('0x50')]['id']}},_0x4af487={};_0x4af487['model']=_[_0xb238('0x3f')](db['VoiceQueue']['rawAttributes']);_0x4af487['query']=_[_0xb238('0x3f')](_0x523fa2['query']);_0x4af487[_0xb238('0x40')]=_[_0xb238('0x41')](_0x4af487[_0xb238('0x3d')],_0x4af487[_0xb238('0x3e')]);_0x2800cd['attributes']=_[_0xb238('0x41')](_0x4af487[_0xb238('0x3d')],qs[_0xb238('0x42')](_0x523fa2[_0xb238('0x3e')][_0xb238('0x42')]));_0x2800cd[_0xb238('0x43')]=_0x2800cd[_0xb238('0x43')]['length']?_0x2800cd[_0xb238('0x43')]:_0x4af487[_0xb238('0x3d')];if(_0x523fa2[_0xb238('0x3e')][_0xb238('0x51')]){_0x2800cd[_0xb238('0x4d')]=[{'all':!![]}];}_0x2800cd=_[_0xb238('0x4b')]({},_0x2800cd,_0x523fa2[_0xb238('0x52')]);return db[_0xb238('0x3a')][_0xb238('0x53')](_0x2800cd)['then'](handleEntityNotFound(_0x1573c0,null))['then'](respondWithResult(_0x1573c0,null))[_0xb238('0x54')](handleError(_0x1573c0,null));};exports[_0xb238('0x55')]=function(_0x101932,_0xf20adc){return db[_0xb238('0x3a')]['create'](_0x101932[_0xb238('0x56')],{})[_0xb238('0x28')](function(_0x9dfe35){var _0x52c74d=_0x101932['user'][_0xb238('0x2a')]({'plain':!![]});if(!_0x52c74d)throw new Error(_0xb238('0x57'));if(_0x52c74d[_0xb238('0x58')]===_0xb238('0x59')){var _0xf485ad=_0x9dfe35[_0xb238('0x2a')]({'plain':!![]});var _0x184543=[{'name':'VoiceQueues','value':_0xb238('0x2b')},{'name':'QueueCampaigns','value':_0xb238('0x2d')}];var _0x4400c0=_[_0xb238('0x53')](_0x184543,['value',_0xf485ad[_0xb238('0x33')]])[_0xb238('0x34')];return db['UserProfileSection'][_0xb238('0x53')]({'where':{'name':_0x4400c0,'userProfileId':_0x52c74d[_0xb238('0x5a')]},'raw':!![]})[_0xb238('0x28')](function(_0x5052b7){if(_0x5052b7&&_0x5052b7['autoAssociation']===0x0){return db[_0xb238('0x35')][_0xb238('0x55')]({'name':_0xf485ad[_0xb238('0x34')],'resourceId':_0xf485ad['id'],'type':_0x5052b7[_0xb238('0x34')],'sectionId':_0x5052b7['id']},{})[_0xb238('0x28')](function(){return _0x9dfe35;});}else{return _0x9dfe35;}})[_0xb238('0x54')](function(_0x8650f4){logger['error'](_0xb238('0x5b'),_0x8650f4);throw _0x8650f4;});}return _0x9dfe35;})[_0xb238('0x28')](respondWithResult(_0xf20adc,0xc9))[_0xb238('0x54')](handleError(_0xf20adc,null));};exports[_0xb238('0x5c')]=function(_0x2b3a88,_0x40d358){var _0x43f95f={'where':{'id':_0x2b3a88[_0xb238('0x50')]['id']}},_0x4b23db={};_0x4b23db[_0xb238('0x3d')]=_[_0xb238('0x3f')](db[_0xb238('0x3a')][_0xb238('0x3b')]);_0x43f95f[_0xb238('0x43')]=_[_0xb238('0x41')](_0x4b23db[_0xb238('0x3d')],qs[_0xb238('0x42')](_0x2b3a88[_0xb238('0x3e')][_0xb238('0x42')]));_0x43f95f[_0xb238('0x43')]=_0x43f95f['attributes'][_0xb238('0x44')]?_0x43f95f[_0xb238('0x43')]:_0x4b23db['model'];if(_0x2b3a88[_0xb238('0x3e')][_0xb238('0x51')]){_0x43f95f[_0xb238('0x4d')]=[{'all':!![]}];}_0x43f95f=_['merge']({},_0x43f95f,_0x2b3a88[_0xb238('0x52')]);return db[_0xb238('0x3a')][_0xb238('0x53')](_0x43f95f)[_0xb238('0x28')](handleEntityNotFound(_0x40d358,null))[_0xb238('0x28')](function(_0x4a4a97){if(_0x4a4a97){var _0x2b7baf=_0x4a4a97[_0xb238('0x2a')]({'plain':!![]});_0x2b7baf=qs[_0xb238('0x5d')](_0x2b7baf,['id',_0xb238('0x5e'),_0xb238('0x5f')]);_0x2b3a88[_0xb238('0x56')]=_[_0xb238('0x5d')](_0x2b3a88['body'],['id',_0xb238('0x5e'),_0xb238('0x5f')]);return db[_0xb238('0x3a')][_0xb238('0x55')](_[_0xb238('0x4b')](_0x2b7baf,_0x2b3a88[_0xb238('0x56')]),{'include':_0x2b3a88[_0xb238('0x3e')][_0xb238('0x51')]?[{'all':!![]}]:undefined})['then'](function(_0x459893){var _0xd14c3=_0x2b3a88['user']['get']({'plain':!![]});if(!_0xd14c3)throw new Error(_0xb238('0x57'));if(_0xd14c3[_0xb238('0x58')]===_0xb238('0x59')){var _0x1cec06=_0x459893[_0xb238('0x2a')]({'plain':!![]});var _0x1bde99=[{'name':_0xb238('0x60'),'value':_0xb238('0x2b')},{'name':_0xb238('0x2c'),'value':_0xb238('0x2d')}];var _0x97a114=_[_0xb238('0x53')](_0x1bde99,[_0xb238('0x31'),_0x1cec06['type']])[_0xb238('0x34')];return db['UserProfileSection'][_0xb238('0x53')]({'where':{'name':_0x97a114,'userProfileId':_0xd14c3[_0xb238('0x5a')]},'raw':!![]})[_0xb238('0x28')](function(_0x5742f4){if(_0x5742f4&&_0x5742f4[_0xb238('0x61')]===0x0){return db[_0xb238('0x35')]['create']({'name':_0x1cec06[_0xb238('0x34')],'resourceId':_0x1cec06['id'],'type':_0x5742f4[_0xb238('0x34')],'sectionId':_0x5742f4['id']},{})[_0xb238('0x28')](function(){return _0x459893;});}else{return _0x459893;}})[_0xb238('0x54')](function(_0x95d7f){logger[_0xb238('0x37')](_0xb238('0x5b'),_0x95d7f);throw _0x95d7f;});}return _0x459893;});}})[_0xb238('0x28')](respondWithResult(_0x40d358,0xc9))[_0xb238('0x54')](handleError(_0x40d358,null));};exports[_0xb238('0x62')]=function(_0x38d91f,_0x438a30){if(_0x38d91f[_0xb238('0x56')]['id']){delete _0x38d91f[_0xb238('0x56')]['id'];}return db[_0xb238('0x3a')]['find']({'where':{'id':_0x38d91f[_0xb238('0x50')]['id']}})[_0xb238('0x28')](handleEntityNotFound(_0x438a30,null))[_0xb238('0x28')](saveUpdates(_0x38d91f[_0xb238('0x56')],null))['then'](respondWithResult(_0x438a30,null))[_0xb238('0x54')](handleError(_0x438a30,null));};exports[_0xb238('0x29')]=function(_0x1056c2,_0x3d3d21){return db[_0xb238('0x3a')][_0xb238('0x53')]({'where':{'id':_0x1056c2[_0xb238('0x50')]['id']}})['then'](handleEntityNotFound(_0x3d3d21,null))[_0xb238('0x28')](removeEntity(_0x3d3d21,null))[_0xb238('0x54')](handleError(_0x3d3d21,null));};exports[_0xb238('0x63')]=function(_0x4e6d21,_0x4e56ba,_0x528afe){var _0x347625={'raw':![],'where':{}};var _0x48ecc4={};var _0x4976da={'count':0x0,'rows':[]};return db[_0xb238('0x3a')][_0xb238('0x64')]({'where':{'id':_0x4e6d21['params']['id']}})[_0xb238('0x28')](handleEntityNotFound(_0x4e56ba,null))[_0xb238('0x28')](function(_0x5954b7){if(_0x5954b7){_0x48ecc4[_0xb238('0x3d')]=_[_0xb238('0x3f')](db[_0xb238('0x65')][_0xb238('0x3b')]);_0x48ecc4[_0xb238('0x3e')]=_[_0xb238('0x3f')](_0x4e6d21['query']);_0x48ecc4['filters']=_[_0xb238('0x41')](_0x48ecc4['model'],_0x48ecc4[_0xb238('0x3e')]);_0x347625['attributes']=_[_0xb238('0x41')](_0x48ecc4[_0xb238('0x3d')],qs[_0xb238('0x42')](_0x4e6d21['query'][_0xb238('0x42')]));_0x347625['attributes']=_0x347625[_0xb238('0x43')][_0xb238('0x44')]?_0x347625[_0xb238('0x43')]:_0x48ecc4['model'];if(!_0x4e6d21[_0xb238('0x3e')][_0xb238('0x45')](_0xb238('0x46'))){_0x347625[_0xb238('0x47')]=qs[_0xb238('0x47')](_0x4e6d21[_0xb238('0x3e')][_0xb238('0x47')]);_0x347625[_0xb238('0x23')]=qs[_0xb238('0x23')](_0x4e6d21[_0xb238('0x3e')][_0xb238('0x23')]);}_0x347625[_0xb238('0x48')]=qs[_0xb238('0x49')](_0x4e6d21[_0xb238('0x3e')][_0xb238('0x49')]);_0x347625[_0xb238('0x4a')]=qs[_0xb238('0x40')](_[_0xb238('0x66')](_0x4e6d21['query'],_0x48ecc4[_0xb238('0x40')]));_0x347625[_0xb238('0x4a')][_0xb238('0x67')]=_0x5954b7['id'];if(_0x4e6d21[_0xb238('0x3e')][_0xb238('0x2e')]){_0x347625['where']=_[_0xb238('0x4b')](_0x347625['where'],{'$or':_[_0xb238('0x30')](_0x347625[_0xb238('0x43')],function(_0x1399fe){var _0x243ac3={};_0x243ac3[_0x1399fe]={'$like':'%'+_0x4e6d21['query']['filter']+'%'};return _0x243ac3;})});}_0x347625=_['merge']({},_0x347625,_0x4e6d21['options']);return db[_0xb238('0x65')][_0xb238('0x22')]({'where':_0x347625[_0xb238('0x4a')]})['then'](function(_0x1c82dc){_0x4976da[_0xb238('0x22')]=_0x1c82dc;if(_0x4e6d21[_0xb238('0x3e')][_0xb238('0x51')]){_0x347625[_0xb238('0x4d')]=[{'all':!![]}];}return db[_0xb238('0x65')]['findAll'](_0x347625);})[_0xb238('0x28')](function(_0x57b377){_0x4976da['rows']=_0x57b377;return _0x4976da;});}})[_0xb238('0x28')](respondWithFilteredResult(_0x4e56ba,_0x347625))['catch'](handleError(_0x4e56ba,null));};exports[_0xb238('0x68')]=function(_0x597c06,_0x29de66,_0x4e2d4a){var _0x5dfeae={'raw':!![],'where':{}};var _0xdb8e5e={};var _0x2fe20c={'count':0x0,'rows':[]};return db[_0xb238('0x3a')]['findOne']({'where':{'id':_0x597c06[_0xb238('0x50')]['id']}})[_0xb238('0x28')](handleEntityNotFound(_0x29de66,null))[_0xb238('0x28')](function(_0x596fcd){if(_0x596fcd){_0xdb8e5e[_0xb238('0x3d')]=_[_0xb238('0x3f')](db[_0xb238('0x69')]['rawAttributes']);_0xdb8e5e[_0xb238('0x3e')]=_[_0xb238('0x3f')](_0x597c06['query']);_0xdb8e5e[_0xb238('0x40')]=_[_0xb238('0x41')](_0xdb8e5e['model'],_0xdb8e5e[_0xb238('0x3e')]);_0x5dfeae[_0xb238('0x43')]=_[_0xb238('0x41')](_0xdb8e5e[_0xb238('0x3d')],qs[_0xb238('0x42')](_0x597c06[_0xb238('0x3e')][_0xb238('0x42')]));_0x5dfeae[_0xb238('0x43')]=_0x5dfeae['attributes']['length']?_0x5dfeae[_0xb238('0x43')]:_0xdb8e5e[_0xb238('0x3d')];if(!_0x597c06[_0xb238('0x3e')][_0xb238('0x45')](_0xb238('0x46'))){_0x5dfeae[_0xb238('0x47')]=qs[_0xb238('0x47')](_0x597c06[_0xb238('0x3e')][_0xb238('0x47')]);_0x5dfeae[_0xb238('0x23')]=qs[_0xb238('0x23')](_0x597c06[_0xb238('0x3e')][_0xb238('0x23')]);}_0x5dfeae['order']=qs[_0xb238('0x49')](_0x597c06[_0xb238('0x3e')][_0xb238('0x49')]);_0x5dfeae['where']=qs['filters'](_[_0xb238('0x66')](_0x597c06['query'],_0xdb8e5e[_0xb238('0x40')]));_0x5dfeae[_0xb238('0x4a')][_0xb238('0x67')]=_0x596fcd['id'];if(_0x597c06[_0xb238('0x3e')]['filter']){_0x5dfeae[_0xb238('0x4a')]=_[_0xb238('0x4b')](_0x5dfeae[_0xb238('0x4a')],{'$or':_['map'](_0x5dfeae[_0xb238('0x43')],function(_0x1d1069){var _0x3a3f6c={};_0x3a3f6c[_0x1d1069]={'$like':'%'+_0x597c06[_0xb238('0x3e')][_0xb238('0x2e')]+'%'};return _0x3a3f6c;})});}_0x5dfeae=_[_0xb238('0x4b')]({},_0x5dfeae,_0x597c06['options']);return db[_0xb238('0x69')][_0xb238('0x22')]({'where':_0x5dfeae[_0xb238('0x4a')]})['then'](function(_0xf27e53){_0x2fe20c[_0xb238('0x22')]=_0xf27e53;if(_0x597c06[_0xb238('0x3e')]['includeAll']){_0x5dfeae[_0xb238('0x4d')]=[{'all':!![]}];}return db[_0xb238('0x69')][_0xb238('0x4e')](_0x5dfeae);})[_0xb238('0x28')](function(_0x494f92){_0x2fe20c[_0xb238('0x4f')]=_0x494f92;return _0x2fe20c;});}})[_0xb238('0x28')](respondWithFilteredResult(_0x29de66,_0x5dfeae))[_0xb238('0x54')](handleError(_0x29de66,null));};exports[_0xb238('0x6a')]=function(_0x3d38d0,_0x17d9e1,_0x43f916){var _0x1992ff={'raw':!![],'where':{}};var _0x2c62c0={};var _0x1df20e={'count':0x0,'rows':[]};return db[_0xb238('0x3a')][_0xb238('0x64')]({'where':{'id':_0x3d38d0[_0xb238('0x50')]['id']}})[_0xb238('0x28')](handleEntityNotFound(_0x17d9e1,null))['then'](function(_0x2f8373){if(_0x2f8373){_0x2c62c0[_0xb238('0x3d')]=_[_0xb238('0x3f')](db[_0xb238('0x6b')][_0xb238('0x3b')]);_0x2c62c0[_0xb238('0x3e')]=_[_0xb238('0x3f')](_0x3d38d0[_0xb238('0x3e')]);_0x2c62c0[_0xb238('0x40')]=_[_0xb238('0x41')](_0x2c62c0['model'],_0x2c62c0[_0xb238('0x3e')]);_0x1992ff[_0xb238('0x43')]=_[_0xb238('0x41')](_0x2c62c0[_0xb238('0x3d')],qs['fields'](_0x3d38d0[_0xb238('0x3e')][_0xb238('0x42')]));_0x1992ff['attributes']=_0x1992ff[_0xb238('0x43')][_0xb238('0x44')]?_0x1992ff[_0xb238('0x43')]:_0x2c62c0[_0xb238('0x3d')];if(!_0x3d38d0[_0xb238('0x3e')]['hasOwnProperty'](_0xb238('0x46'))){_0x1992ff['limit']=qs[_0xb238('0x47')](_0x3d38d0[_0xb238('0x3e')][_0xb238('0x47')]);_0x1992ff[_0xb238('0x23')]=qs[_0xb238('0x23')](_0x3d38d0[_0xb238('0x3e')]['offset']);}_0x1992ff[_0xb238('0x48')]=qs[_0xb238('0x49')](_0x3d38d0[_0xb238('0x3e')][_0xb238('0x49')]);_0x1992ff[_0xb238('0x4a')]=qs['filters'](_[_0xb238('0x66')](_0x3d38d0[_0xb238('0x3e')],_0x2c62c0[_0xb238('0x40')]));_0x1992ff[_0xb238('0x4a')][_0xb238('0x67')]=_0x2f8373['id'];if(_0x3d38d0[_0xb238('0x3e')][_0xb238('0x2e')]){_0x1992ff[_0xb238('0x4a')]=_[_0xb238('0x4b')](_0x1992ff[_0xb238('0x4a')],{'$or':_[_0xb238('0x30')](_0x1992ff[_0xb238('0x43')],function(_0x140466){var _0x405c5d={};_0x405c5d[_0x140466]={'$like':'%'+_0x3d38d0[_0xb238('0x3e')][_0xb238('0x2e')]+'%'};return _0x405c5d;})});}_0x1992ff=_['merge']({},_0x1992ff,_0x3d38d0[_0xb238('0x52')]);return db[_0xb238('0x6b')][_0xb238('0x22')]({'where':_0x1992ff[_0xb238('0x4a')]})[_0xb238('0x28')](function(_0x26be54){_0x1df20e[_0xb238('0x22')]=_0x26be54;if(_0x3d38d0[_0xb238('0x3e')]['includeAll']){_0x1992ff['include']=[{'all':!![]}];}return db[_0xb238('0x6b')][_0xb238('0x4e')](_0x1992ff);})['then'](function(_0x871427){_0x1df20e[_0xb238('0x4f')]=_0x871427;return _0x1df20e;});}})['then'](respondWithFilteredResult(_0x17d9e1,_0x1992ff))[_0xb238('0x54')](handleError(_0x17d9e1,null));};exports[_0xb238('0x6c')]=function(_0x34c769,_0x2fe6e1,_0x108ad3){var _0x1a8ccf={'raw':!![],'where':{}};var _0x18cc96={};var _0x48efad={'count':0x0,'rows':[]};return db[_0xb238('0x3a')]['findOne']({'where':{'id':_0x34c769[_0xb238('0x50')]['id']}})[_0xb238('0x28')](handleEntityNotFound(_0x2fe6e1,null))[_0xb238('0x28')](function(_0x42c703){if(_0x42c703){_0x18cc96[_0xb238('0x3d')]=_['keys'](db['CmHopperBlack'][_0xb238('0x3b')]);_0x18cc96['query']=_[_0xb238('0x3f')](_0x34c769['query']);_0x18cc96[_0xb238('0x40')]=_['intersection'](_0x18cc96[_0xb238('0x3d')],_0x18cc96[_0xb238('0x3e')]);_0x1a8ccf[_0xb238('0x43')]=_['intersection'](_0x18cc96[_0xb238('0x3d')],qs[_0xb238('0x42')](_0x34c769[_0xb238('0x3e')]['fields']));_0x1a8ccf[_0xb238('0x43')]=_0x1a8ccf[_0xb238('0x43')]['length']?_0x1a8ccf[_0xb238('0x43')]:_0x18cc96['model'];if(!_0x34c769[_0xb238('0x3e')][_0xb238('0x45')](_0xb238('0x46'))){_0x1a8ccf[_0xb238('0x47')]=qs[_0xb238('0x47')](_0x34c769['query']['limit']);_0x1a8ccf[_0xb238('0x23')]=qs[_0xb238('0x23')](_0x34c769[_0xb238('0x3e')][_0xb238('0x23')]);}_0x1a8ccf[_0xb238('0x48')]=qs[_0xb238('0x49')](_0x34c769[_0xb238('0x3e')]['sort']);_0x1a8ccf['where']=qs['filters'](_[_0xb238('0x66')](_0x34c769['query'],_0x18cc96['filters']));_0x1a8ccf['where'][_0xb238('0x67')]=_0x42c703['id'];if(_0x34c769[_0xb238('0x3e')][_0xb238('0x2e')]){_0x1a8ccf[_0xb238('0x4a')]=_['merge'](_0x1a8ccf[_0xb238('0x4a')],{'$or':_[_0xb238('0x30')](_0x1a8ccf[_0xb238('0x43')],function(_0x4e70db){var _0x2eee78={};_0x2eee78[_0x4e70db]={'$like':'%'+_0x34c769[_0xb238('0x3e')][_0xb238('0x2e')]+'%'};return _0x2eee78;})});}_0x1a8ccf=_[_0xb238('0x4b')]({},_0x1a8ccf,_0x34c769[_0xb238('0x52')]);return db[_0xb238('0x6d')][_0xb238('0x22')]({'where':_0x1a8ccf[_0xb238('0x4a')]})['then'](function(_0x22d22e){_0x48efad['count']=_0x22d22e;if(_0x34c769['query'][_0xb238('0x51')]){_0x1a8ccf[_0xb238('0x4d')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x1a8ccf);})[_0xb238('0x28')](function(_0x1168bc){_0x48efad[_0xb238('0x4f')]=_0x1168bc;return _0x48efad;});}})[_0xb238('0x28')](respondWithFilteredResult(_0x2fe6e1,_0x1a8ccf))[_0xb238('0x54')](handleError(_0x2fe6e1,null));};exports['getTeams']=function(_0x5e6476,_0x2a4ac7,_0x14384e){var _0x7d5e9c={};var _0x2aaba9={};var _0x58c0ad;var _0x343c6b;return db[_0xb238('0x3a')][_0xb238('0x64')]({'where':{'id':_0x5e6476[_0xb238('0x50')]['id']}})['then'](handleEntityNotFound(_0x2a4ac7,null))[_0xb238('0x28')](function(_0x5f18aa){if(_0x5f18aa){_0x58c0ad=_0x5f18aa;_0x2aaba9[_0xb238('0x3d')]=_['keys'](db[_0xb238('0x6e')]['rawAttributes']);_0x2aaba9[_0xb238('0x3e')]=_[_0xb238('0x3f')](_0x5e6476[_0xb238('0x3e')]);_0x2aaba9[_0xb238('0x40')]=_[_0xb238('0x41')](_0x2aaba9[_0xb238('0x3d')],_0x2aaba9[_0xb238('0x3e')]);_0x7d5e9c['attributes']=_['intersection'](_0x2aaba9[_0xb238('0x3d')],qs[_0xb238('0x42')](_0x5e6476[_0xb238('0x3e')]['fields']));_0x7d5e9c[_0xb238('0x43')]=_0x7d5e9c['attributes'][_0xb238('0x44')]?_0x7d5e9c[_0xb238('0x43')]:_0x2aaba9[_0xb238('0x3d')];_0x7d5e9c['order']=qs[_0xb238('0x49')](_0x5e6476['query']['sort']);_0x7d5e9c[_0xb238('0x4a')]=qs[_0xb238('0x40')](_['pick'](_0x5e6476[_0xb238('0x3e')],_0x2aaba9[_0xb238('0x40')]));if(_0x5e6476['query'][_0xb238('0x2e')]){_0x7d5e9c[_0xb238('0x4a')]=_['merge'](_0x7d5e9c[_0xb238('0x4a')],{'$or':_[_0xb238('0x30')](_0x7d5e9c[_0xb238('0x43')],function(_0x47408c){var _0x5674ce={};_0x5674ce[_0x47408c]={'$like':'%'+_0x5e6476['query'][_0xb238('0x2e')]+'%'};return _0x5674ce;})});}_0x7d5e9c=_[_0xb238('0x4b')]({},_0x7d5e9c,_0x5e6476[_0xb238('0x52')]);return _0x58c0ad[_0xb238('0x6f')](_0x7d5e9c);}})['then'](function(_0x35d61d){if(_0x35d61d){_0x343c6b=_0x35d61d[_0xb238('0x44')];if(!_0x5e6476[_0xb238('0x3e')][_0xb238('0x45')](_0xb238('0x46'))){_0x7d5e9c[_0xb238('0x47')]=qs[_0xb238('0x47')](_0x5e6476[_0xb238('0x3e')]['limit']);_0x7d5e9c[_0xb238('0x23')]=qs[_0xb238('0x23')](_0x5e6476['query']['offset']);}return _0x58c0ad[_0xb238('0x6f')](_0x7d5e9c);}})[_0xb238('0x28')](function(_0x1e938a){if(_0x1e938a){return _0x1e938a?{'count':_0x343c6b,'rows':_0x1e938a}:null;}})[_0xb238('0x28')](respondWithResult(_0x2a4ac7,null))['catch'](handleError(_0x2a4ac7,null));};exports['addTeams']=function(_0x28f3f2,_0x909cf2,_0x3e987c){var _0x36738a=_0x28f3f2[_0xb238('0x56')][_0xb238('0x70')];var _0x5ac5cc=_[_0xb238('0x30')](_0x36738a,'id');return db['Team'][_0xb238('0x4e')]({'where':{'id':_0x5ac5cc},'attributes':['id'],'include':[{'model':db[_0xb238('0x71')],'as':_0xb238('0x72'),'attributes':['id',_0xb238('0x34'),_0xb238('0x73'),_0xb238('0x74'),_0xb238('0x75')],'raw':!![]}]})[_0xb238('0x28')](function(_0x4fd1ad){if(_0x4fd1ad){var _0x3ca283=_['flatMap'](_0x4fd1ad,function(_0xf9e1ab){var _0x1644f3=_0xf9e1ab[_0xb238('0x2a')]({'plain':!![]});_0x1644f3[_0xb238('0x72')][_0xb238('0x76')](function(_0x2b4fc5){_0x2b4fc5[_0xb238('0x77')]=_['find'](_0x36738a,{'id':_0x1644f3['id']})[_0xb238('0x77')];});return _0x1644f3['Agents'];});return db['VoiceQueue'][_0xb238('0x53')]({'where':{'id':_0x28f3f2[_0xb238('0x50')]['id']}})['then'](function(_0x44f9aa){return db[_0xb238('0x78')]['transaction'](function(_0x4aa944){return _0x44f9aa[_0xb238('0x79')](_0x5ac5cc,{'transaction':_0x4aa944})['then'](function(){return BPromise[_0xb238('0x7a')](_0x36738a,function(_0x14480c){return db['TeamVoiceQueue'][_0xb238('0x7b')]({'TeamId':_0x14480c['id'],'VoiceQueueId':_0x28f3f2['params']['id'],'penalty':_0x14480c[_0xb238('0x77')]},{'transaction':_0x4aa944});});})['then'](function(){return BPromise['each'](_0x3ca283,function(_0x3e47cf){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x3e47cf['id'],'VoiceQueueId':_0x28f3f2[_0xb238('0x50')]['id']},'defaults':{'penalty':_0x3e47cf[_0xb238('0x77')]},'transaction':_0x4aa944});});})[_0xb238('0x28')](function(){return BPromise['each'](_[_0xb238('0x2e')](_0x3ca283,{'online':!![]}),function(_0x3a3e01){return db[_0xb238('0x7c')][_0xb238('0x7b')]({'membername':_0x3a3e01[_0xb238('0x34')],'UserId':_0x3a3e01['id'],'queue_name':_0x44f9aa['name'],'VoiceQueueId':_0x44f9aa['id'],'interface':_['isNil'](_0x3a3e01['interface'])?util['format'](_0xb238('0x7d'),_0x3a3e01[_0xb238('0x34')]):_0x3a3e01['interface'],'paused':_0x3a3e01[_0xb238('0x74')]||![],'penalty':_0x3a3e01[_0xb238('0x77')]},{'transaction':_0x4aa944});});})[_0xb238('0x28')](function(){_0x3ca283[_0xb238('0x76')](function(_0x4c097f){socket[_0xb238('0x7e')]('userVoiceQueue:save',{'UserId':_0x4c097f['id'],'VoiceQueueId':_0x44f9aa['id']});});});});});}})[_0xb238('0x28')](respondWithStatusCode(_0x909cf2,null))[_0xb238('0x54')](handleError(_0x909cf2,null));};exports[_0xb238('0x7f')]=function(_0x5c2795,_0x2d8212,_0x3c7ac4){return db[_0xb238('0x6e')][_0xb238('0x4e')]({'where':{'id':_0x5c2795[_0xb238('0x3e')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb238('0x71')],'as':_0xb238('0x72'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2d8212,null))[_0xb238('0x28')](function(_0x32fcbd){var _0x4b6380=_[_0xb238('0x30')](_0x32fcbd,'id');var _0xa5a833=[];var _0x2677f7=[];var _0x1a205b=squel['select']();_0x1a205b[_0xb238('0x80')](_0xb238('0x81'))[_0xb238('0x82')](_0xb238('0x83'),'tq')[_0xb238('0x84')](_0xb238('0x85'),'ut',_0xb238('0x86'))['where']('VoiceQueueId\x20=\x20?',_0x5c2795[_0xb238('0x50')]['id']);for(var _0x20ee27=0x0;_0x20ee27<_0x32fcbd[_0xb238('0x44')];_0x20ee27+=0x1){let _0x4bc6ea=_0x32fcbd[_0x20ee27];for(var _0x2195f7=0x0;_0x2195f7<_0x4bc6ea['Agents'][_0xb238('0x44')];_0x2195f7+=0x1){let _0x345a12=_0x4bc6ea[_0xb238('0x72')][_0x2195f7];var _0x427368=_0x1a205b['clone']();_0x427368[_0xb238('0x4a')](_0xb238('0x87'),_0x345a12['id']);_0x2677f7['push'](db[_0xb238('0x78')][_0xb238('0x3e')](_0x427368['toString'](),{'type':db['sequelize']['QueryTypes'][_0xb238('0x88')]})[_0xb238('0x28')](function(_0x25f49c){if(_0x25f49c[_0xb238('0x44')]===0x1){return _0x345a12['id'];}else{var _0x83ebc5=_['every'](_[_0xb238('0x30')](_0x25f49c,_0xb238('0x89')),function(_0x4f6069){return _[_0xb238('0x32')](_0x4b6380,_0x4f6069);});if(_0x83ebc5){return _0x345a12['id'];}}}));}}return BPromise[_0xb238('0x8a')](_0x2677f7)[_0xb238('0x28')](function(_0xb69657){_0xa5a833=_(_0xa5a833)[_0xb238('0x8b')](_0xb69657)[_0xb238('0x8c')]()[_0xb238('0x31')]();return db[_0xb238('0x3a')][_0xb238('0x53')]({'where':{'id':_0x5c2795[_0xb238('0x50')]['id']}})['then'](function(_0x3a8e1e){return db[_0xb238('0x78')][_0xb238('0x8d')](function(_0x53c5cb){return _0x3a8e1e[_0xb238('0x7f')](_0x5c2795[_0xb238('0x3e')][_0xb238('0x8e')],{'transaction':_0x53c5cb})['then'](function(){if(!_[_0xb238('0x8f')](_0xa5a833)){return _0x3a8e1e['removeAgents'](_0xa5a833,{'transaction':_0x53c5cb})[_0xb238('0x28')](function(){return db[_0xb238('0x7c')][_0xb238('0x29')]({'where':{'VoiceQueueId':_0x5c2795[_0xb238('0x50')]['id'],'UserId':_0xa5a833},'transaction':_0x53c5cb});});}})[_0xb238('0x28')](function(){_0xa5a833[_0xb238('0x76')](function(_0x1d12f5){socket['emit'](_0xb238('0x90'),{'UserId':_0x1d12f5,'VoiceQueueId':_0x3a8e1e['id']});});});});});});})[_0xb238('0x28')](respondWithStatusCode(_0x2d8212,null))[_0xb238('0x54')](handleError(_0x2d8212,null));};exports['addAgents']=function(_0x3107d6,_0x3cf727,_0x193af9){var _0x262bf7,_0x3ed206;return db['VoiceQueue'][_0xb238('0x53')]({'where':{'id':_0x3107d6['params']['id']}})[_0xb238('0x28')](handleEntityNotFound(_0x3cf727,null))[_0xb238('0x28')](function(_0x48553f){if(_0x48553f){_0x3ed206=_0x48553f;return _0x48553f['addAgents'](_0x3107d6[_0xb238('0x56')][_0xb238('0x8e')],_['omit'](_0x3107d6[_0xb238('0x56')],[_0xb238('0x8e'),'id'])||{})[_0xb238('0x91')](function(_0xc4dfbb){for(var _0x18ee6d=0x0;_0x18ee6d<_0x3107d6[_0xb238('0x56')][_0xb238('0x8e')]['length'];_0x18ee6d+=0x1){socket[_0xb238('0x7e')](_0xb238('0x92'),{'UserId':Number(_0x3107d6[_0xb238('0x56')][_0xb238('0x8e')][_0x18ee6d]),'VoiceQueueId':Number(_0x3107d6[_0xb238('0x50')]['id'])});}return _0xc4dfbb;});}})[_0xb238('0x28')](function(_0x1cd5ff){_0x262bf7=_0x1cd5ff||[];if(_0x3ed206){return db[_0xb238('0x71')][_0xb238('0x4e')]({'where':{'id':_0x3107d6[_0xb238('0x56')]['ids']},'attributes':['id',_0xb238('0x34'),'online',_0xb238('0x74'),'interface'],'raw':!![]});}})[_0xb238('0x28')](function(_0x444f8d){if(!_[_0xb238('0x8f')](_0x444f8d)){var _0x44c39e=[];for(var _0xae56bb=0x0;_0xae56bb<_0x444f8d[_0xb238('0x44')];_0xae56bb++){if(_0x444f8d[_0xae56bb]['online']){_0x44c39e['push'](db[_0xb238('0x7c')][_0xb238('0x7b')]({'membername':_0x444f8d[_0xae56bb][_0xb238('0x34')],'UserId':_0x444f8d[_0xae56bb]['id'],'queue_name':_0x3ed206[_0xb238('0x34')],'VoiceQueueId':_0x3ed206['id'],'interface':_[_0xb238('0x93')](_0x444f8d[_0xae56bb][_0xb238('0x75')])?util[_0xb238('0x94')]('SIP/%s',_0x444f8d[_0xae56bb]['name']):_0x444f8d[_0xae56bb][_0xb238('0x75')],'paused':_0x444f8d[_0xae56bb][_0xb238('0x74')]||![],'penalty':_0x3107d6[_0xb238('0x56')][_0xb238('0x77')]||0x0}));}}return BPromise[_0xb238('0x8a')](_0x44c39e);}})[_0xb238('0x28')](function(){return _0x262bf7;})['then'](respondWithResult(_0x3cf727,null))[_0xb238('0x54')](handleError(_0x3cf727,null));};exports[_0xb238('0x95')]=function(_0x375df2,_0x3a6a40,_0x1765a5){return db[_0xb238('0x3a')][_0xb238('0x53')]({'where':{'id':_0x375df2[_0xb238('0x50')]['id']}})[_0xb238('0x28')](handleEntityNotFound(_0x3a6a40,null))[_0xb238('0x28')](function(_0x456949){if(_0x456949){return _0x456949[_0xb238('0x95')](_0x375df2[_0xb238('0x3e')][_0xb238('0x8e')])['then'](function(){if(_[_0xb238('0x96')](_0x375df2[_0xb238('0x3e')][_0xb238('0x8e')])){for(var _0x28baba=0x0;_0x28baba<_0x375df2[_0xb238('0x3e')][_0xb238('0x8e')]['length'];_0x28baba+=0x1){socket[_0xb238('0x7e')](_0xb238('0x90'),{'UserId':Number(_0x375df2[_0xb238('0x3e')][_0xb238('0x8e')][_0x28baba]),'VoiceQueueId':Number(_0x375df2[_0xb238('0x50')]['id'])});}}else{socket[_0xb238('0x7e')](_0xb238('0x90'),{'UserId':Number(_0x375df2[_0xb238('0x3e')][_0xb238('0x8e')]),'VoiceQueueId':Number(_0x375df2[_0xb238('0x50')]['id'])});}});}})['then'](function(_0x5d25b4){return db[_0xb238('0x7c')]['destroy']({'where':{'VoiceQueueId':_0x375df2['params']['id'],'UserId':_0x375df2['query'][_0xb238('0x8e')]}})[_0xb238('0x28')](function(){return _0x5d25b4;});})[_0xb238('0x28')](respondWithStatusCode(_0x3a6a40,null))[_0xb238('0x54')](handleError(_0x3a6a40,null));};exports[_0xb238('0x97')]=function(_0x5c4279,_0x5c8459,_0x5150ab){var _0x124ac5={};var _0x44cdb3={};var _0x54437a;var _0x3fb886;return db[_0xb238('0x3a')][_0xb238('0x64')]({'where':{'id':_0x5c4279[_0xb238('0x50')]['id']}})['then'](handleEntityNotFound(_0x5c8459,null))[_0xb238('0x28')](function(_0x22d39b){if(_0x22d39b){_0x54437a=_0x22d39b;_0x44cdb3[_0xb238('0x3d')]=_[_0xb238('0x3f')](db[_0xb238('0x71')][_0xb238('0x3b')]);_0x44cdb3[_0xb238('0x3e')]=_[_0xb238('0x3f')](_0x5c4279[_0xb238('0x3e')]);_0x44cdb3['filters']=_[_0xb238('0x41')](_0x44cdb3[_0xb238('0x3d')],_0x44cdb3[_0xb238('0x3e')]);_0x124ac5['attributes']=_['intersection'](_0x44cdb3[_0xb238('0x3d')],qs['fields'](_0x5c4279[_0xb238('0x3e')]['fields']));_0x124ac5['attributes']=_0x124ac5[_0xb238('0x43')][_0xb238('0x44')]?_0x124ac5[_0xb238('0x43')]:_0x44cdb3[_0xb238('0x3d')];_0x124ac5[_0xb238('0x48')]=qs['sort'](_0x5c4279[_0xb238('0x3e')][_0xb238('0x49')]);_0x124ac5[_0xb238('0x4a')]=qs['filters'](_[_0xb238('0x66')](_0x5c4279['query'],_0x44cdb3[_0xb238('0x40')]));if(_0x5c4279[_0xb238('0x3e')][_0xb238('0x2e')]){_0x124ac5['where']=_['merge'](_0x124ac5[_0xb238('0x4a')],{'$or':_[_0xb238('0x30')](_0x124ac5[_0xb238('0x43')],function(_0x565a46){var _0x254556={};_0x254556[_0x565a46]={'$like':'%'+_0x5c4279[_0xb238('0x3e')][_0xb238('0x2e')]+'%'};return _0x254556;})});}_0x124ac5=_[_0xb238('0x4b')]({},_0x124ac5,_0x5c4279['options']);return _0x54437a[_0xb238('0x97')](_0x124ac5);}})[_0xb238('0x28')](function(_0x5e607d){if(_0x5e607d){_0x3fb886=_0x5e607d[_0xb238('0x44')];if(!_0x5c4279['query'][_0xb238('0x45')](_0xb238('0x46'))){_0x124ac5[_0xb238('0x47')]=qs[_0xb238('0x47')](_0x5c4279[_0xb238('0x3e')][_0xb238('0x47')]);_0x124ac5[_0xb238('0x23')]=qs['offset'](_0x5c4279[_0xb238('0x3e')][_0xb238('0x23')]);}return _0x54437a[_0xb238('0x97')](_0x124ac5);}})[_0xb238('0x28')](function(_0x1348d1){if(_0x1348d1){return _0x1348d1?{'count':_0x3fb886,'rows':_0x1348d1}:null;}})[_0xb238('0x28')](respondWithResult(_0x5c8459,null))[_0xb238('0x54')](handleError(_0x5c8459,null));};exports[_0xb238('0x98')]=function(_0x2046c8,_0x3e50eb,_0x500bca){var _0x3800de={};var _0x3535ea={};var _0x4f509e;var _0x450897;return db[_0xb238('0x3a')][_0xb238('0x64')]({'where':{'id':_0x2046c8[_0xb238('0x50')]['id']}})['then'](handleEntityNotFound(_0x3e50eb,null))[_0xb238('0x28')](function(_0xeae5f6){if(_0xeae5f6){_0x4f509e=_0xeae5f6;_0x3535ea['model']=_['keys'](db[_0xb238('0x7c')][_0xb238('0x3b')]);_0x3535ea[_0xb238('0x3e')]=_[_0xb238('0x3f')](_0x2046c8['query']);_0x3535ea['filters']=_[_0xb238('0x41')](_0x3535ea['model'],_0x3535ea[_0xb238('0x3e')]);_0x3800de[_0xb238('0x43')]=_[_0xb238('0x41')](_0x3535ea[_0xb238('0x3d')],qs['fields'](_0x2046c8[_0xb238('0x3e')][_0xb238('0x42')]));_0x3800de[_0xb238('0x43')]=_0x3800de[_0xb238('0x43')][_0xb238('0x44')]?_0x3800de[_0xb238('0x43')]:_0x3535ea[_0xb238('0x3d')];_0x3800de[_0xb238('0x48')]=qs[_0xb238('0x49')](_0x2046c8[_0xb238('0x3e')][_0xb238('0x49')]);_0x3800de['where']=qs[_0xb238('0x40')](_[_0xb238('0x66')](_0x2046c8[_0xb238('0x3e')],_0x3535ea['filters']));if(_0x2046c8['query'][_0xb238('0x2e')]){_0x3800de[_0xb238('0x4a')]=_[_0xb238('0x4b')](_0x3800de[_0xb238('0x4a')],{'$or':_[_0xb238('0x30')](_0x3800de[_0xb238('0x43')],function(_0x45af9c){var _0x2934cf={};_0x2934cf[_0x45af9c]={'$like':'%'+_0x2046c8[_0xb238('0x3e')][_0xb238('0x2e')]+'%'};return _0x2934cf;})});}_0x3800de=_['merge']({},_0x3800de,_0x2046c8['options']);return _0x4f509e[_0xb238('0x98')](_0x3800de);}})[_0xb238('0x28')](function(_0xa82b6d){if(_0xa82b6d){_0x450897=_0xa82b6d[_0xb238('0x44')];if(!_0x2046c8[_0xb238('0x3e')][_0xb238('0x45')](_0xb238('0x46'))){_0x3800de[_0xb238('0x47')]=qs[_0xb238('0x47')](_0x2046c8[_0xb238('0x3e')]['limit']);_0x3800de[_0xb238('0x23')]=qs[_0xb238('0x23')](_0x2046c8[_0xb238('0x3e')][_0xb238('0x23')]);}return _0x4f509e[_0xb238('0x98')](_0x3800de);}})[_0xb238('0x28')](function(_0x4bb683){return _0x4bb683?{'count':_0x450897,'rows':_0x4bb683}:null;})['then'](respondWithResult(_0x3e50eb,null))[_0xb238('0x54')](handleError(_0x3e50eb,null));};exports[_0xb238('0x99')]=function(_0x211493,_0x5ef058,_0x22144b){var _0x454538={};var _0x519d96={};var _0x33bec6;var _0x5d450c;return db[_0xb238('0x3a')][_0xb238('0x64')]({'where':{'id':_0x211493[_0xb238('0x50')]['id']}})[_0xb238('0x28')](handleEntityNotFound(_0x5ef058,null))['then'](function(_0x23c821){if(_0x23c821){_0x33bec6=_0x23c821;_0x519d96['model']=_['keys'](db['CmList']['rawAttributes']);_0x519d96[_0xb238('0x3e')]=_['keys'](_0x211493[_0xb238('0x3e')]);_0x519d96[_0xb238('0x40')]=_[_0xb238('0x41')](_0x519d96[_0xb238('0x3d')],_0x519d96['query']);_0x454538[_0xb238('0x43')]=_[_0xb238('0x41')](_0x519d96['model'],qs[_0xb238('0x42')](_0x211493[_0xb238('0x3e')][_0xb238('0x42')]));_0x454538['attributes']=_0x454538[_0xb238('0x43')]['length']?_0x454538[_0xb238('0x43')]:_0x519d96[_0xb238('0x3d')];_0x454538['order']=qs[_0xb238('0x49')](_0x211493[_0xb238('0x3e')][_0xb238('0x49')]);_0x454538[_0xb238('0x4a')]=qs[_0xb238('0x40')](_[_0xb238('0x66')](_0x211493['query'],_0x519d96[_0xb238('0x40')]));if(_0x211493[_0xb238('0x3e')][_0xb238('0x2e')]){_0x454538[_0xb238('0x4a')]=_[_0xb238('0x4b')](_0x454538[_0xb238('0x4a')],{'$or':_['map'](_0x454538['attributes'],function(_0x28199f){var _0x5db568={};_0x5db568[_0x28199f]={'$like':'%'+_0x211493[_0xb238('0x3e')][_0xb238('0x2e')]+'%'};return _0x5db568;})});}_0x454538=_[_0xb238('0x4b')]({},_0x454538,_0x211493[_0xb238('0x52')]);return _0x33bec6[_0xb238('0x99')](_0x454538);}})[_0xb238('0x28')](function(_0x462234){if(_0x462234){_0x5d450c=_0x462234['length'];if(!_0x211493[_0xb238('0x3e')]['hasOwnProperty'](_0xb238('0x46'))){_0x454538[_0xb238('0x47')]=qs['limit'](_0x211493['query'][_0xb238('0x47')]);_0x454538[_0xb238('0x23')]=qs[_0xb238('0x23')](_0x211493['query'][_0xb238('0x23')]);}return _0x33bec6['getLists'](_0x454538);}})[_0xb238('0x28')](function(_0x318305){if(_0x318305){return _0x318305?{'count':_0x5d450c,'rows':_0x318305}:null;}})[_0xb238('0x28')](respondWithResult(_0x5ef058,null))[_0xb238('0x54')](handleError(_0x5ef058,null));};exports[_0xb238('0x9a')]=function(_0x59af08,_0x3f0295,_0x44e7ce){var _0x349c58,_0x406215;return db[_0xb238('0x3a')][_0xb238('0x53')]({'where':{'id':_0x59af08[_0xb238('0x50')]['id']}})[_0xb238('0x28')](handleEntityNotFound(_0x3f0295,null))[_0xb238('0x28')](function(_0x14a06e){if(_0x14a06e){_0x406215=_0x14a06e;return _0x14a06e['addLists'](_0x59af08[_0xb238('0x56')][_0xb238('0x8e')],_[_0xb238('0x5d')](_0x59af08['body'],[_0xb238('0x8e'),'id'])||{});}return null;})['spread'](function(_0xc2e0c0){var _0x1fb61c;_0x349c58=_0xc2e0c0||[];var _0x84c2e7=[];if(_0xc2e0c0){for(var _0x1b65d9=0x0;_0x1b65d9<_0xc2e0c0[_0xb238('0x44')];_0x1b65d9+=0x1){var _0x47c7d5=_0xc2e0c0[_0x1b65d9][_0xb238('0x2a')]({'plain':!![]});_0x406215[_0xb238('0x9b')]=_0x59af08['body'][_0xb238('0x9b')]?_0x59af08['body'][_0xb238('0x9b')]:_0x406215[_0xb238('0x9b')];switch(_0x406215[_0xb238('0x9b')]){case _0xb238('0x9c'):_0x1fb61c=squel[_0xb238('0x9d')]()[_0xb238('0x9e')](_0xb238('0x9f'))[_0xb238('0xa0')](['phone',_0xb238('0xa1'),_0xb238('0xa2'),_0xb238('0xa3'),_0xb238('0x67'),_0xb238('0x5e'),_0xb238('0x5f')],squel[_0xb238('0xa4')]()[_0xb238('0x80')](_0xb238('0xa5'),_0xb238('0xa5'))['field'](_0xb238('0xa6'),_0xb238('0xa1'))[_0xb238('0x80')]('id',_0xb238('0xa2'))[_0xb238('0x80')](_0x47c7d5['CmListId'][_0xb238('0xa7')](),'ListId')[_0xb238('0x80')](_0x59af08[_0xb238('0x50')]['id'][_0xb238('0xa7')](),_0xb238('0x67'))[_0xb238('0x80')](_0xb238('0xa6'),_0xb238('0x5e'))[_0xb238('0x80')](_0xb238('0xa6'),_0xb238('0x5f'))[_0xb238('0x82')](_0xb238('0xa8'))[_0xb238('0x4a')](_0xb238('0xa9'))['where'](_0xb238('0xaa'),_0x47c7d5[_0xb238('0xab')]['toString']())['where'](_0xb238('0xac'))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xb238('0x80')](_0xb238('0xad'))['from'](_0xb238('0xae'))[_0xb238('0x4a')](_0xb238('0xaf'),_0x59af08[_0xb238('0x50')]['id']['toString']()))[_0xb238('0x4a')](_0xb238('0xb0'),squel[_0xb238('0xa4')]()['field'](_0xb238('0xb1'))[_0xb238('0x82')](_0xb238('0x9f'))[_0xb238('0x4a')](_0xb238('0xaf'),_0x59af08[_0xb238('0x50')]['id'][_0xb238('0xa7')]())))['toString']();break;case _0xb238('0xb2'):_0x1fb61c=squel[_0xb238('0x9d')]()['into'](_0xb238('0x9f'))['fromQuery']([_0xb238('0xa5'),_0xb238('0xa1'),_0xb238('0xa2'),'ListId',_0xb238('0x67'),_0xb238('0x5e'),'updatedAt'],squel['select']()[_0xb238('0x80')](_0xb238('0xa5'),'phone')[_0xb238('0x80')](_0xb238('0xa6'),_0xb238('0xa1'))[_0xb238('0x80')]('id',_0xb238('0xa2'))[_0xb238('0x80')](_0x47c7d5[_0xb238('0xab')][_0xb238('0xa7')](),_0xb238('0xa3'))[_0xb238('0x80')](_0x59af08['params']['id']['toString'](),_0xb238('0x67'))[_0xb238('0x80')](_0xb238('0xa6'),_0xb238('0x5e'))[_0xb238('0x80')](_0xb238('0xa6'),_0xb238('0x5f'))[_0xb238('0x82')](_0xb238('0xa8'))[_0xb238('0x4a')]('deletedAt\x20IS\x20NULL')[_0xb238('0x4a')](_0xb238('0xaa'),_0x47c7d5[_0xb238('0xab')][_0xb238('0xa7')]())[_0xb238('0x4a')](_0xb238('0xac'))[_0xb238('0x4a')](_0xb238('0xb0'),squel[_0xb238('0xa4')]()[_0xb238('0x80')](_0xb238('0xb1'))[_0xb238('0x82')](_0xb238('0x9f'))[_0xb238('0x4a')](_0xb238('0xaf'),_0x59af08[_0xb238('0x50')]['id'][_0xb238('0xa7')]())))[_0xb238('0xa7')]();break;default:_0x1fb61c=squel[_0xb238('0x9d')]()[_0xb238('0x9e')]('cm_hopper')[_0xb238('0xa0')]([_0xb238('0xa5'),_0xb238('0xa1'),_0xb238('0xa2'),_0xb238('0xa3'),'VoiceQueueId','createdAt',_0xb238('0x5f')],squel[_0xb238('0xa4')]()['field'](_0xb238('0xa5'),_0xb238('0xa5'))[_0xb238('0x80')](_0xb238('0xa6'),'scheduledAt')[_0xb238('0x80')]('id','ContactId')['field'](_0x47c7d5[_0xb238('0xab')][_0xb238('0xa7')](),'ListId')[_0xb238('0x80')](_0x59af08[_0xb238('0x50')]['id'][_0xb238('0xa7')](),_0xb238('0x67'))[_0xb238('0x80')](_0xb238('0xa6'),_0xb238('0x5e'))['field']('NOW()',_0xb238('0x5f'))[_0xb238('0x82')]('cm_contacts')[_0xb238('0x4a')](_0xb238('0xa9'))['where'](_0xb238('0xaa'),_0x47c7d5[_0xb238('0xab')][_0xb238('0xa7')]())[_0xb238('0x4a')](_0xb238('0xac')))['toString']();}_0x84c2e7[_0xb238('0xb3')](db[_0xb238('0x78')][_0xb238('0x3e')](_0x1fb61c));}return BPromise[_0xb238('0x8a')](_0x84c2e7);}})[_0xb238('0x28')](function(){return _0x349c58;})[_0xb238('0x28')](respondWithResult(_0x3f0295,null))[_0xb238('0x54')](handleError(_0x3f0295,null));};exports[_0xb238('0xb4')]=function(_0x444b55,_0x2813df,_0x138a39){return db[_0xb238('0x3a')][_0xb238('0x53')]({'where':{'id':_0x444b55[_0xb238('0x50')]['id']}})[_0xb238('0x28')](handleEntityNotFound(_0x2813df,null))[_0xb238('0x28')](function(_0x349fcf){if(_0x349fcf){return _0x349fcf[_0xb238('0xb4')](_0x444b55[_0xb238('0x3e')][_0xb238('0x8e')]);}})[_0xb238('0x28')](function(_0x10ba1c){if(_0x10ba1c){return db[_0xb238('0x65')]['destroy']({'where':{'ListId':_0x444b55[_0xb238('0x3e')][_0xb238('0x8e')],'VoiceQueueId':_0x444b55[_0xb238('0x50')]['id']}})['then'](function(){return _0x10ba1c;});}})['then'](respondWithStatusCode(_0x2813df,null))['catch'](handleError(_0x2813df,null));};exports['getBlackLists']=function(_0x3e4585,_0x235079,_0x1207cc){var _0x1d4c4d={};var _0xcfcdcc={};var _0x30158f;var _0x9eeb08;return db['VoiceQueue'][_0xb238('0x64')]({'where':{'id':_0x3e4585['params']['id']}})[_0xb238('0x28')](handleEntityNotFound(_0x235079,null))[_0xb238('0x28')](function(_0x2b5762){if(_0x2b5762){_0x30158f=_0x2b5762;_0xcfcdcc[_0xb238('0x3d')]=_['keys'](db[_0xb238('0xb5')]['rawAttributes']);_0xcfcdcc[_0xb238('0x3e')]=_['keys'](_0x3e4585[_0xb238('0x3e')]);_0xcfcdcc[_0xb238('0x40')]=_[_0xb238('0x41')](_0xcfcdcc['model'],_0xcfcdcc[_0xb238('0x3e')]);_0x1d4c4d[_0xb238('0x43')]=_['intersection'](_0xcfcdcc['model'],qs[_0xb238('0x42')](_0x3e4585['query'][_0xb238('0x42')]));_0x1d4c4d[_0xb238('0x43')]=_0x1d4c4d[_0xb238('0x43')]['length']?_0x1d4c4d[_0xb238('0x43')]:_0xcfcdcc['model'];_0x1d4c4d[_0xb238('0x48')]=qs[_0xb238('0x49')](_0x3e4585['query']['sort']);_0x1d4c4d[_0xb238('0x4a')]=qs[_0xb238('0x40')](_['pick'](_0x3e4585[_0xb238('0x3e')],_0xcfcdcc[_0xb238('0x40')]));if(_0x3e4585['query'][_0xb238('0x2e')]){_0x1d4c4d['where']=_[_0xb238('0x4b')](_0x1d4c4d[_0xb238('0x4a')],{'$or':_[_0xb238('0x30')](_0x1d4c4d[_0xb238('0x43')],function(_0x278ba8){var _0xde06b7={};_0xde06b7[_0x278ba8]={'$like':'%'+_0x3e4585[_0xb238('0x3e')]['filter']+'%'};return _0xde06b7;})});}_0x1d4c4d=_[_0xb238('0x4b')]({},_0x1d4c4d,_0x3e4585[_0xb238('0x52')]);return _0x30158f[_0xb238('0xb6')](_0x1d4c4d);}})[_0xb238('0x28')](function(_0x32cda9){if(_0x32cda9){_0x9eeb08=_0x32cda9[_0xb238('0x44')];if(!_0x3e4585[_0xb238('0x3e')][_0xb238('0x45')](_0xb238('0x46'))){_0x1d4c4d['limit']=qs[_0xb238('0x47')](_0x3e4585[_0xb238('0x3e')]['limit']);_0x1d4c4d['offset']=qs[_0xb238('0x23')](_0x3e4585[_0xb238('0x3e')][_0xb238('0x23')]);}return _0x30158f[_0xb238('0xb6')](_0x1d4c4d);}})['then'](function(_0xa201f0){if(_0xa201f0){return _0xa201f0?{'count':_0x9eeb08,'rows':_0xa201f0}:null;}})['then'](respondWithResult(_0x235079,null))['catch'](handleError(_0x235079,null));};exports[_0xb238('0xb7')]=function(_0x3746bb,_0x44ec7f,_0x3e22be){var _0x5095b5,_0xc12315;return db[_0xb238('0x3a')][_0xb238('0x53')]({'where':{'id':_0x3746bb[_0xb238('0x50')]['id']}})['then'](handleEntityNotFound(_0x44ec7f,null))[_0xb238('0x28')](function(_0x246520){if(_0x246520){_0xc12315=_0x246520;return _0x246520['addBlackLists'](_0x3746bb[_0xb238('0x56')][_0xb238('0x8e')],_['omit'](_0x3746bb[_0xb238('0x56')],[_0xb238('0x8e'),'id'])||{});}return null;})[_0xb238('0x91')](function(_0x48984d){var _0x19bb77;_0x5095b5=_0x48984d||[];var _0x345b34=[];if(_0x48984d){for(var _0xa7fefe=0x0;_0xa7fefe<_0x48984d['length'];_0xa7fefe+=0x1){var _0x385e59=_0x48984d[_0xa7fefe][_0xb238('0x2a')]({'plain':!![]});_0x19bb77=squel[_0xb238('0x9d')]()['into'](_0xb238('0xb8'))[_0xb238('0xa0')](['phone',_0xb238('0xa2'),_0xb238('0xa3'),'VoiceQueueId',_0xb238('0x5e'),'updatedAt'],squel['select']()[_0xb238('0x80')](_0xb238('0xa5'),_0xb238('0xa5'))[_0xb238('0x80')]('id',_0xb238('0xa2'))[_0xb238('0x80')](_0x385e59['CmListId'][_0xb238('0xa7')](),_0xb238('0xa3'))[_0xb238('0x80')](_0x3746bb[_0xb238('0x50')]['id'][_0xb238('0xa7')](),_0xb238('0x67'))['field'](_0xb238('0xa6'),'createdAt')[_0xb238('0x80')](_0xb238('0xa6'),_0xb238('0x5f'))['from'](_0xb238('0xa8'))[_0xb238('0x4a')](_0xb238('0xa9'))[_0xb238('0x4a')]('ListId\x20=\x20?',_0x385e59[_0xb238('0xab')][_0xb238('0xa7')]())[_0xb238('0x4a')](_0xb238('0xac')))[_0xb238('0xa7')]();_0x345b34['push'](db[_0xb238('0x78')][_0xb238('0x3e')](_0x19bb77));}return BPromise[_0xb238('0x8a')](_0x345b34);}})[_0xb238('0x28')](function(){return _0x5095b5;})[_0xb238('0x28')](respondWithResult(_0x44ec7f,null))[_0xb238('0x54')](handleError(_0x44ec7f,null));};exports[_0xb238('0xb9')]=function(_0x5c216b,_0x152f2e,_0x59a287){return db[_0xb238('0x3a')][_0xb238('0x53')]({'where':{'id':_0x5c216b[_0xb238('0x50')]['id']}})[_0xb238('0x28')](handleEntityNotFound(_0x152f2e,null))['then'](function(_0xb3837b){if(_0xb3837b){return _0xb3837b['removeBlackLists'](_0x5c216b[_0xb238('0x3e')][_0xb238('0x8e')]);}})[_0xb238('0x28')](function(_0x10a5cb){if(_0x10a5cb){return db[_0xb238('0x6d')][_0xb238('0x29')]({'where':{'ListId':_0x5c216b['query'][_0xb238('0x8e')],'VoiceQueueId':_0x5c216b[_0xb238('0x50')]['id']}})[_0xb238('0x28')](function(){return _0x10a5cb;});}})[_0xb238('0x28')](respondWithStatusCode(_0x152f2e,null))[_0xb238('0x54')](handleError(_0x152f2e,null));}; \ No newline at end of file +var _0x10af=['interface','flatMap','forEach','penalty','sequelize','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','format','userVoiceQueue:save','User','select','field','tq.TeamId','from','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','removeTeams','ids','UserVoiceQueueRt','emit','userVoiceQueue:remove','addAgents','isEmpty','isNil','removeAgents','getAgents','getMembers','getLists','CmList','addLists','omit','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','ContactId','ListId','updatedAt','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','scheduledAt','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','VoiceQueues','filter','map','value','type','find','name','send','index','VoiceQueue','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','include','findAll','rows','keys','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','inbound','QueueCampaigns','outbound','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','UserProfileResource','params','getHoppers','findOne','pick','VoiceQueueId','options','CmHopper','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','online','voicePause'];(function(_0x35f779,_0x3f47e2){var _0x5e4684=function(_0x3e16e5){while(--_0x3e16e5){_0x35f779['push'](_0x35f779['shift']());}};_0x5e4684(++_0x3f47e2);}(_0x10af,0x1bc));var _0xf10a=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x10af[_0x38537f];return _0x141e23;};'use strict';var emlformat=require(_0xf10a('0x0'));var rimraf=require(_0xf10a('0x1'));var zipdir=require(_0xf10a('0x2'));var jsonpatch=require(_0xf10a('0x3'));var rp=require(_0xf10a('0x4'));var moment=require(_0xf10a('0x5'));var BPromise=require(_0xf10a('0x6'));var Mustache=require(_0xf10a('0x7'));var util=require('util');var path=require(_0xf10a('0x8'));var sox=require(_0xf10a('0x9'));var csv=require('to-csv');var ejs=require(_0xf10a('0xa'));var fs=require('fs');var fs_extra=require(_0xf10a('0xb'));var _=require(_0xf10a('0xc'));var squel=require(_0xf10a('0xd'));var crypto=require(_0xf10a('0xe'));var jsforce=require(_0xf10a('0xf'));var deskjs=require(_0xf10a('0x10'));var toCsv=require(_0xf10a('0x11'));var querystring=require(_0xf10a('0x12'));var Papa=require(_0xf10a('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf10a('0x14'));var as=require(_0xf10a('0x15'));var hardwareService=require(_0xf10a('0x16'));var logger=require(_0xf10a('0x17'))(_0xf10a('0x18'));var utils=require('../../config/utils');var config=require(_0xf10a('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf10a('0x1a')]=_[_0xf10a('0x1b')](config[_0xf10a('0x1a')],{'host':_0xf10a('0x1c'),'port':0x18eb});var socket=require(_0xf10a('0x1d'))(new Redis(config['redis']));require(_0xf10a('0x1e'))[_0xf10a('0x1f')](socket);function respondWithStatusCode(_0x4db08a,_0x389769){_0x389769=_0x389769||0xcc;return function(_0x50a9df){if(_0x50a9df){return _0x4db08a[_0xf10a('0x20')](_0x389769);}return _0x4db08a[_0xf10a('0x21')](_0x389769)[_0xf10a('0x22')]();};}function respondWithResult(_0x2bdf83,_0x460da4){_0x460da4=_0x460da4||0xc8;return function(_0x4f010a){if(_0x4f010a){return _0x2bdf83['status'](_0x460da4)[_0xf10a('0x23')](_0x4f010a);}};}function respondWithFilteredResult(_0x4c877b,_0x50d173){return function(_0x96d940){if(_0x96d940){var _0x3058e4=typeof _0x50d173[_0xf10a('0x24')]===_0xf10a('0x25')&&typeof _0x50d173[_0xf10a('0x26')]==='undefined';var _0x48d99d=_0x96d940[_0xf10a('0x27')];var _0x307fde=_0x3058e4?0x0:_0x50d173['offset'];var _0x44c00b=_0x3058e4?_0x96d940['count']:_0x50d173[_0xf10a('0x24')]+_0x50d173[_0xf10a('0x26')];var _0x60fe6c;if(_0x44c00b>=_0x48d99d){_0x44c00b=_0x48d99d;_0x60fe6c=0xc8;}else{_0x60fe6c=0xce;}_0x4c877b[_0xf10a('0x21')](_0x60fe6c);return _0x4c877b[_0xf10a('0x28')](_0xf10a('0x29'),_0x307fde+'-'+_0x44c00b+'/'+_0x48d99d)[_0xf10a('0x23')](_0x96d940);}return null;};}function patchUpdates(_0x185dde){return function(_0x211858){try{jsonpatch[_0xf10a('0x2a')](_0x211858,_0x185dde,!![]);}catch(_0x20110e){return BPromise['reject'](_0x20110e);}return _0x211858[_0xf10a('0x2b')]();};}function saveUpdates(_0x583829,_0x4f24f8){return function(_0x57175d){if(_0x57175d){return _0x57175d[_0xf10a('0x2c')](_0x583829)['then'](function(_0x4ce19f){return _0x4ce19f;});}return null;};}function removeEntity(_0x24dd47,_0x524990){return function(_0x319995){if(_0x319995){return _0x319995[_0xf10a('0x2d')]()[_0xf10a('0x2e')](function(){var _0x2f6b87=_0x319995['get']({'plain':!![]});var _0x2e3dbd=[{'name':_0xf10a('0x2f'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x4a12e4=_(_0x2e3dbd)[_0xf10a('0x30')]('ignore')[_0xf10a('0x31')](_0xf10a('0x32'))[_0xf10a('0x32')]();if(_['includes'](_0x4a12e4,_0x2f6b87[_0xf10a('0x33')])){return;}var _0x5aa4d1=_[_0xf10a('0x34')](_0x2e3dbd,[_0xf10a('0x32'),_0x2f6b87[_0xf10a('0x33')]])[_0xf10a('0x35')];return db['UserProfileResource']['destroy']({'where':{'type':_0x5aa4d1,'resourceId':_0x2f6b87['id']}})[_0xf10a('0x2e')](function(){return _0x319995;});})['then'](function(){_0x24dd47[_0xf10a('0x21')](0xcc)[_0xf10a('0x22')]();});}};}function handleEntityNotFound(_0xd1c57e,_0x489c21){return function(_0x49e706){if(!_0x49e706){_0xd1c57e[_0xf10a('0x20')](0x194);}return _0x49e706;};}function handleError(_0x349599,_0x2b8db2){_0x2b8db2=_0x2b8db2||0x1f4;return function(_0x4b5b8b){logger['error'](_0x4b5b8b['stack']);if(_0x4b5b8b[_0xf10a('0x35')]){delete _0x4b5b8b[_0xf10a('0x35')];}_0x349599[_0xf10a('0x21')](_0x2b8db2)[_0xf10a('0x36')](_0x4b5b8b);};}exports[_0xf10a('0x37')]=function(_0x34e59b,_0x1798d1){var _0x2e44d6={},_0x4b45b0={},_0x7120a3={'count':0x0,'rows':[]};var _0x54080f=_[_0xf10a('0x31')](db[_0xf10a('0x38')][_0xf10a('0x39')],function(_0x1f98f3){return{'name':_0x1f98f3[_0xf10a('0x3a')],'type':_0x1f98f3['type'][_0xf10a('0x3b')]};});_0x4b45b0['model']=_[_0xf10a('0x31')](_0x54080f,_0xf10a('0x35'));_0x4b45b0[_0xf10a('0x3c')]=_['keys'](_0x34e59b[_0xf10a('0x3c')]);_0x4b45b0[_0xf10a('0x3d')]=_[_0xf10a('0x3e')](_0x4b45b0[_0xf10a('0x3f')],_0x4b45b0[_0xf10a('0x3c')]);_0x2e44d6['attributes']=_[_0xf10a('0x3e')](_0x4b45b0['model'],qs[_0xf10a('0x40')](_0x34e59b[_0xf10a('0x3c')][_0xf10a('0x40')]));_0x2e44d6[_0xf10a('0x41')]=_0x2e44d6[_0xf10a('0x41')][_0xf10a('0x42')]?_0x2e44d6[_0xf10a('0x41')]:_0x4b45b0['model'];if(!_0x34e59b[_0xf10a('0x3c')][_0xf10a('0x43')](_0xf10a('0x44'))){_0x2e44d6['limit']=qs[_0xf10a('0x26')](_0x34e59b[_0xf10a('0x3c')][_0xf10a('0x26')]);_0x2e44d6[_0xf10a('0x24')]=qs[_0xf10a('0x24')](_0x34e59b['query'][_0xf10a('0x24')]);}_0x2e44d6[_0xf10a('0x45')]=qs[_0xf10a('0x46')](_0x34e59b[_0xf10a('0x3c')][_0xf10a('0x46')]);_0x2e44d6[_0xf10a('0x47')]=qs['filters'](_['pick'](_0x34e59b[_0xf10a('0x3c')],_0x4b45b0[_0xf10a('0x3d')]),_0x54080f);if(_0x34e59b[_0xf10a('0x3c')][_0xf10a('0x30')]){_0x2e44d6[_0xf10a('0x47')]=_[_0xf10a('0x48')](_0x2e44d6['where'],{'$or':_['map'](_0x54080f,function(_0x4dd801){if(_0x4dd801[_0xf10a('0x33')]!=='VIRTUAL'){var _0x5ef054={};_0x5ef054[_0x4dd801[_0xf10a('0x35')]]={'$like':'%'+_0x34e59b['query'][_0xf10a('0x30')]+'%'};return _0x5ef054;}})});}_0x2e44d6=_[_0xf10a('0x48')]({},_0x2e44d6,_0x34e59b['options']);var _0x3458c5={'where':_0x2e44d6[_0xf10a('0x47')]};return db[_0xf10a('0x38')][_0xf10a('0x27')](_0x3458c5)[_0xf10a('0x2e')](function(_0x544dba){_0x7120a3['count']=_0x544dba;if(_0x34e59b[_0xf10a('0x3c')]['includeAll']){_0x2e44d6[_0xf10a('0x49')]=[{'all':!![]}];}return db[_0xf10a('0x38')][_0xf10a('0x4a')](_0x2e44d6);})['then'](function(_0x2c992e){_0x7120a3[_0xf10a('0x4b')]=_0x2c992e;return _0x7120a3;})[_0xf10a('0x2e')](respondWithFilteredResult(_0x1798d1,_0x2e44d6))['catch'](handleError(_0x1798d1,null));};exports['show']=function(_0xe3dc1e,_0x16a759){var _0x127e03={'raw':![],'where':{'id':_0xe3dc1e['params']['id']}},_0x189a16={};_0x189a16[_0xf10a('0x3f')]=_[_0xf10a('0x4c')](db[_0xf10a('0x38')][_0xf10a('0x39')]);_0x189a16[_0xf10a('0x3c')]=_[_0xf10a('0x4c')](_0xe3dc1e[_0xf10a('0x3c')]);_0x189a16[_0xf10a('0x3d')]=_[_0xf10a('0x3e')](_0x189a16[_0xf10a('0x3f')],_0x189a16['query']);_0x127e03[_0xf10a('0x41')]=_['intersection'](_0x189a16[_0xf10a('0x3f')],qs[_0xf10a('0x40')](_0xe3dc1e[_0xf10a('0x3c')]['fields']));_0x127e03[_0xf10a('0x41')]=_0x127e03[_0xf10a('0x41')][_0xf10a('0x42')]?_0x127e03[_0xf10a('0x41')]:_0x189a16[_0xf10a('0x3f')];if(_0xe3dc1e[_0xf10a('0x3c')][_0xf10a('0x4d')]){_0x127e03[_0xf10a('0x49')]=[{'all':!![]}];}_0x127e03=_[_0xf10a('0x48')]({},_0x127e03,_0xe3dc1e['options']);return db[_0xf10a('0x38')]['find'](_0x127e03)[_0xf10a('0x2e')](handleEntityNotFound(_0x16a759,null))[_0xf10a('0x2e')](respondWithResult(_0x16a759,null))[_0xf10a('0x4e')](handleError(_0x16a759,null));};exports[_0xf10a('0x4f')]=function(_0xc421ea,_0x58a3aa){return db[_0xf10a('0x38')][_0xf10a('0x4f')](_0xc421ea[_0xf10a('0x50')],{})[_0xf10a('0x2e')](function(_0x106759){var _0x3fa894=_0xc421ea[_0xf10a('0x51')]['get']({'plain':!![]});if(!_0x3fa894)throw new Error(_0xf10a('0x52'));if(_0x3fa894[_0xf10a('0x53')]===_0xf10a('0x51')){var _0x57dd0d=_0x106759[_0xf10a('0x54')]({'plain':!![]});var _0x2689b5=[{'name':_0xf10a('0x2f'),'value':_0xf10a('0x55')},{'name':_0xf10a('0x56'),'value':_0xf10a('0x57')}];var _0x10f49a=_[_0xf10a('0x34')](_0x2689b5,[_0xf10a('0x32'),_0x57dd0d['type']])['name'];return db[_0xf10a('0x58')]['find']({'where':{'name':_0x10f49a,'userProfileId':_0x3fa894[_0xf10a('0x59')]},'raw':!![]})[_0xf10a('0x2e')](function(_0xccc58d){if(_0xccc58d&&_0xccc58d[_0xf10a('0x5a')]===0x0){return db['UserProfileResource']['create']({'name':_0x57dd0d['name'],'resourceId':_0x57dd0d['id'],'type':_0xccc58d[_0xf10a('0x35')],'sectionId':_0xccc58d['id']},{})[_0xf10a('0x2e')](function(){return _0x106759;});}else{return _0x106759;}})['catch'](function(_0x47e204){logger[_0xf10a('0x5b')](_0xf10a('0x5c'),_0x47e204);throw _0x47e204;});}return _0x106759;})[_0xf10a('0x2e')](respondWithResult(_0x58a3aa,0xc9))[_0xf10a('0x4e')](handleError(_0x58a3aa,null));};exports['clone']=function(_0x28b151,_0x1831d4){var _0x296ade={'where':{'id':_0x28b151['params']['id']}},_0x1679b3={};_0x1679b3['model']=_[_0xf10a('0x4c')](db[_0xf10a('0x38')][_0xf10a('0x39')]);_0x296ade[_0xf10a('0x41')]=_['intersection'](_0x1679b3[_0xf10a('0x3f')],qs['fields'](_0x28b151[_0xf10a('0x3c')][_0xf10a('0x40')]));_0x296ade[_0xf10a('0x41')]=_0x296ade[_0xf10a('0x41')][_0xf10a('0x42')]?_0x296ade[_0xf10a('0x41')]:_0x1679b3[_0xf10a('0x3f')];if(_0x28b151[_0xf10a('0x3c')][_0xf10a('0x4d')]){_0x296ade['include']=[{'all':!![]}];}_0x296ade=_[_0xf10a('0x48')]({},_0x296ade,_0x28b151['options']);return db[_0xf10a('0x38')][_0xf10a('0x34')](_0x296ade)[_0xf10a('0x2e')](handleEntityNotFound(_0x1831d4,null))['then'](function(_0x55376c){if(_0x55376c){var _0x534e38=_0x55376c[_0xf10a('0x54')]({'plain':!![]});_0x534e38=qs['omit'](_0x534e38,['id',_0xf10a('0x5d'),'updatedAt']);_0x28b151[_0xf10a('0x50')]=_['omit'](_0x28b151[_0xf10a('0x50')],['id',_0xf10a('0x5d'),'updatedAt']);return db[_0xf10a('0x38')]['create'](_[_0xf10a('0x48')](_0x534e38,_0x28b151[_0xf10a('0x50')]),{'include':_0x28b151[_0xf10a('0x3c')][_0xf10a('0x4d')]?[{'all':!![]}]:undefined})[_0xf10a('0x2e')](function(_0x20b94f){var _0x93d0c4=_0x28b151[_0xf10a('0x51')]['get']({'plain':!![]});if(!_0x93d0c4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x93d0c4[_0xf10a('0x53')]===_0xf10a('0x51')){var _0x1feae4=_0x20b94f[_0xf10a('0x54')]({'plain':!![]});var _0x57bb3f=[{'name':'VoiceQueues','value':'inbound'},{'name':_0xf10a('0x56'),'value':_0xf10a('0x57')}];var _0x34f7e1=_[_0xf10a('0x34')](_0x57bb3f,[_0xf10a('0x32'),_0x1feae4[_0xf10a('0x33')]])[_0xf10a('0x35')];return db[_0xf10a('0x58')][_0xf10a('0x34')]({'where':{'name':_0x34f7e1,'userProfileId':_0x93d0c4[_0xf10a('0x59')]},'raw':!![]})[_0xf10a('0x2e')](function(_0x2baeb9){if(_0x2baeb9&&_0x2baeb9[_0xf10a('0x5a')]===0x0){return db[_0xf10a('0x5e')]['create']({'name':_0x1feae4[_0xf10a('0x35')],'resourceId':_0x1feae4['id'],'type':_0x2baeb9[_0xf10a('0x35')],'sectionId':_0x2baeb9['id']},{})[_0xf10a('0x2e')](function(){return _0x20b94f;});}else{return _0x20b94f;}})['catch'](function(_0x59f846){logger[_0xf10a('0x5b')](_0xf10a('0x5c'),_0x59f846);throw _0x59f846;});}return _0x20b94f;});}})['then'](respondWithResult(_0x1831d4,0xc9))['catch'](handleError(_0x1831d4,null));};exports[_0xf10a('0x2c')]=function(_0x4528c2,_0x5d36f5){if(_0x4528c2[_0xf10a('0x50')]['id']){delete _0x4528c2['body']['id'];}return db[_0xf10a('0x38')][_0xf10a('0x34')]({'where':{'id':_0x4528c2[_0xf10a('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5d36f5,null))['then'](saveUpdates(_0x4528c2[_0xf10a('0x50')],null))[_0xf10a('0x2e')](respondWithResult(_0x5d36f5,null))[_0xf10a('0x4e')](handleError(_0x5d36f5,null));};exports[_0xf10a('0x2d')]=function(_0x36b159,_0x25e0c3){return db[_0xf10a('0x38')][_0xf10a('0x34')]({'where':{'id':_0x36b159[_0xf10a('0x5f')]['id']}})[_0xf10a('0x2e')](handleEntityNotFound(_0x25e0c3,null))[_0xf10a('0x2e')](removeEntity(_0x25e0c3,null))[_0xf10a('0x4e')](handleError(_0x25e0c3,null));};exports[_0xf10a('0x60')]=function(_0x30ba85,_0x3de2c8,_0x48f56b){var _0x5640c1={'raw':![],'where':{}};var _0x38351c={};var _0x3c0438={'count':0x0,'rows':[]};return db[_0xf10a('0x38')][_0xf10a('0x61')]({'where':{'id':_0x30ba85[_0xf10a('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3de2c8,null))[_0xf10a('0x2e')](function(_0x35f68f){if(_0x35f68f){_0x38351c['model']=_[_0xf10a('0x4c')](db['CmHopper'][_0xf10a('0x39')]);_0x38351c['query']=_[_0xf10a('0x4c')](_0x30ba85['query']);_0x38351c[_0xf10a('0x3d')]=_[_0xf10a('0x3e')](_0x38351c[_0xf10a('0x3f')],_0x38351c[_0xf10a('0x3c')]);_0x5640c1[_0xf10a('0x41')]=_[_0xf10a('0x3e')](_0x38351c[_0xf10a('0x3f')],qs[_0xf10a('0x40')](_0x30ba85[_0xf10a('0x3c')][_0xf10a('0x40')]));_0x5640c1[_0xf10a('0x41')]=_0x5640c1[_0xf10a('0x41')][_0xf10a('0x42')]?_0x5640c1['attributes']:_0x38351c[_0xf10a('0x3f')];if(!_0x30ba85[_0xf10a('0x3c')][_0xf10a('0x43')](_0xf10a('0x44'))){_0x5640c1['limit']=qs[_0xf10a('0x26')](_0x30ba85['query'][_0xf10a('0x26')]);_0x5640c1['offset']=qs['offset'](_0x30ba85['query'][_0xf10a('0x24')]);}_0x5640c1['order']=qs[_0xf10a('0x46')](_0x30ba85[_0xf10a('0x3c')][_0xf10a('0x46')]);_0x5640c1['where']=qs[_0xf10a('0x3d')](_[_0xf10a('0x62')](_0x30ba85['query'],_0x38351c[_0xf10a('0x3d')]));_0x5640c1[_0xf10a('0x47')][_0xf10a('0x63')]=_0x35f68f['id'];if(_0x30ba85[_0xf10a('0x3c')]['filter']){_0x5640c1[_0xf10a('0x47')]=_[_0xf10a('0x48')](_0x5640c1[_0xf10a('0x47')],{'$or':_[_0xf10a('0x31')](_0x5640c1[_0xf10a('0x41')],function(_0x37f7be){var _0x2d3f05={};_0x2d3f05[_0x37f7be]={'$like':'%'+_0x30ba85['query'][_0xf10a('0x30')]+'%'};return _0x2d3f05;})});}_0x5640c1=_[_0xf10a('0x48')]({},_0x5640c1,_0x30ba85[_0xf10a('0x64')]);return db[_0xf10a('0x65')]['count']({'where':_0x5640c1[_0xf10a('0x47')]})[_0xf10a('0x2e')](function(_0x4714dd){_0x3c0438[_0xf10a('0x27')]=_0x4714dd;if(_0x30ba85['query']['includeAll']){_0x5640c1[_0xf10a('0x49')]=[{'all':!![]}];}return db[_0xf10a('0x65')][_0xf10a('0x4a')](_0x5640c1);})['then'](function(_0x37c358){_0x3c0438[_0xf10a('0x4b')]=_0x37c358;return _0x3c0438;});}})[_0xf10a('0x2e')](respondWithFilteredResult(_0x3de2c8,_0x5640c1))['catch'](handleError(_0x3de2c8,null));};exports[_0xf10a('0x66')]=function(_0x4fa069,_0x6196a4,_0x4b1dc2){var _0x2e3bf9={'raw':!![],'where':{}};var _0x1e501d={};var _0x3a8e24={'count':0x0,'rows':[]};return db[_0xf10a('0x38')][_0xf10a('0x61')]({'where':{'id':_0x4fa069['params']['id']}})[_0xf10a('0x2e')](handleEntityNotFound(_0x6196a4,null))[_0xf10a('0x2e')](function(_0x51df77){if(_0x51df77){_0x1e501d['model']=_[_0xf10a('0x4c')](db['CmHopperHistory']['rawAttributes']);_0x1e501d[_0xf10a('0x3c')]=_['keys'](_0x4fa069[_0xf10a('0x3c')]);_0x1e501d[_0xf10a('0x3d')]=_['intersection'](_0x1e501d[_0xf10a('0x3f')],_0x1e501d[_0xf10a('0x3c')]);_0x2e3bf9[_0xf10a('0x41')]=_[_0xf10a('0x3e')](_0x1e501d[_0xf10a('0x3f')],qs[_0xf10a('0x40')](_0x4fa069[_0xf10a('0x3c')]['fields']));_0x2e3bf9[_0xf10a('0x41')]=_0x2e3bf9[_0xf10a('0x41')][_0xf10a('0x42')]?_0x2e3bf9[_0xf10a('0x41')]:_0x1e501d['model'];if(!_0x4fa069[_0xf10a('0x3c')]['hasOwnProperty'](_0xf10a('0x44'))){_0x2e3bf9[_0xf10a('0x26')]=qs[_0xf10a('0x26')](_0x4fa069[_0xf10a('0x3c')][_0xf10a('0x26')]);_0x2e3bf9[_0xf10a('0x24')]=qs[_0xf10a('0x24')](_0x4fa069[_0xf10a('0x3c')]['offset']);}_0x2e3bf9[_0xf10a('0x45')]=qs[_0xf10a('0x46')](_0x4fa069['query'][_0xf10a('0x46')]);_0x2e3bf9['where']=qs[_0xf10a('0x3d')](_['pick'](_0x4fa069[_0xf10a('0x3c')],_0x1e501d[_0xf10a('0x3d')]));_0x2e3bf9[_0xf10a('0x47')]['VoiceQueueId']=_0x51df77['id'];if(_0x4fa069[_0xf10a('0x3c')]['filter']){_0x2e3bf9['where']=_['merge'](_0x2e3bf9[_0xf10a('0x47')],{'$or':_['map'](_0x2e3bf9['attributes'],function(_0x3a0ea7){var _0x2100fe={};_0x2100fe[_0x3a0ea7]={'$like':'%'+_0x4fa069[_0xf10a('0x3c')][_0xf10a('0x30')]+'%'};return _0x2100fe;})});}_0x2e3bf9=_[_0xf10a('0x48')]({},_0x2e3bf9,_0x4fa069[_0xf10a('0x64')]);return db[_0xf10a('0x67')][_0xf10a('0x27')]({'where':_0x2e3bf9[_0xf10a('0x47')]})['then'](function(_0x225f99){_0x3a8e24[_0xf10a('0x27')]=_0x225f99;if(_0x4fa069[_0xf10a('0x3c')][_0xf10a('0x4d')]){_0x2e3bf9['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x2e3bf9);})['then'](function(_0x111e15){_0x3a8e24[_0xf10a('0x4b')]=_0x111e15;return _0x3a8e24;});}})[_0xf10a('0x2e')](respondWithFilteredResult(_0x6196a4,_0x2e3bf9))[_0xf10a('0x4e')](handleError(_0x6196a4,null));};exports['getHopperFinals']=function(_0x58f996,_0x34fcff,_0x1ed457){var _0x192f2e={'raw':!![],'where':{}};var _0x506394={};var _0x4e8a2d={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xf10a('0x61')]({'where':{'id':_0x58f996[_0xf10a('0x5f')]['id']}})[_0xf10a('0x2e')](handleEntityNotFound(_0x34fcff,null))[_0xf10a('0x2e')](function(_0x322b){if(_0x322b){_0x506394['model']=_[_0xf10a('0x4c')](db[_0xf10a('0x68')][_0xf10a('0x39')]);_0x506394['query']=_[_0xf10a('0x4c')](_0x58f996[_0xf10a('0x3c')]);_0x506394[_0xf10a('0x3d')]=_[_0xf10a('0x3e')](_0x506394[_0xf10a('0x3f')],_0x506394[_0xf10a('0x3c')]);_0x192f2e[_0xf10a('0x41')]=_[_0xf10a('0x3e')](_0x506394[_0xf10a('0x3f')],qs[_0xf10a('0x40')](_0x58f996[_0xf10a('0x3c')][_0xf10a('0x40')]));_0x192f2e['attributes']=_0x192f2e[_0xf10a('0x41')][_0xf10a('0x42')]?_0x192f2e[_0xf10a('0x41')]:_0x506394[_0xf10a('0x3f')];if(!_0x58f996['query'][_0xf10a('0x43')]('nolimit')){_0x192f2e[_0xf10a('0x26')]=qs[_0xf10a('0x26')](_0x58f996[_0xf10a('0x3c')]['limit']);_0x192f2e[_0xf10a('0x24')]=qs['offset'](_0x58f996[_0xf10a('0x3c')][_0xf10a('0x24')]);}_0x192f2e['order']=qs['sort'](_0x58f996[_0xf10a('0x3c')]['sort']);_0x192f2e[_0xf10a('0x47')]=qs[_0xf10a('0x3d')](_[_0xf10a('0x62')](_0x58f996[_0xf10a('0x3c')],_0x506394[_0xf10a('0x3d')]));_0x192f2e[_0xf10a('0x47')][_0xf10a('0x63')]=_0x322b['id'];if(_0x58f996[_0xf10a('0x3c')][_0xf10a('0x30')]){_0x192f2e['where']=_[_0xf10a('0x48')](_0x192f2e[_0xf10a('0x47')],{'$or':_[_0xf10a('0x31')](_0x192f2e['attributes'],function(_0x4f8241){var _0x443d61={};_0x443d61[_0x4f8241]={'$like':'%'+_0x58f996[_0xf10a('0x3c')][_0xf10a('0x30')]+'%'};return _0x443d61;})});}_0x192f2e=_['merge']({},_0x192f2e,_0x58f996[_0xf10a('0x64')]);return db[_0xf10a('0x68')][_0xf10a('0x27')]({'where':_0x192f2e[_0xf10a('0x47')]})['then'](function(_0x1beaaf){_0x4e8a2d[_0xf10a('0x27')]=_0x1beaaf;if(_0x58f996[_0xf10a('0x3c')][_0xf10a('0x4d')]){_0x192f2e[_0xf10a('0x49')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xf10a('0x4a')](_0x192f2e);})[_0xf10a('0x2e')](function(_0x1caf5b){_0x4e8a2d[_0xf10a('0x4b')]=_0x1caf5b;return _0x4e8a2d;});}})[_0xf10a('0x2e')](respondWithFilteredResult(_0x34fcff,_0x192f2e))[_0xf10a('0x4e')](handleError(_0x34fcff,null));};exports[_0xf10a('0x69')]=function(_0x5a5174,_0x38d2b9,_0x4ba307){var _0x212abb={'raw':!![],'where':{}};var _0x50031b={};var _0x510ea2={'count':0x0,'rows':[]};return db[_0xf10a('0x38')][_0xf10a('0x61')]({'where':{'id':_0x5a5174['params']['id']}})['then'](handleEntityNotFound(_0x38d2b9,null))[_0xf10a('0x2e')](function(_0x8b084c){if(_0x8b084c){_0x50031b[_0xf10a('0x3f')]=_['keys'](db[_0xf10a('0x6a')]['rawAttributes']);_0x50031b[_0xf10a('0x3c')]=_[_0xf10a('0x4c')](_0x5a5174[_0xf10a('0x3c')]);_0x50031b[_0xf10a('0x3d')]=_[_0xf10a('0x3e')](_0x50031b[_0xf10a('0x3f')],_0x50031b[_0xf10a('0x3c')]);_0x212abb[_0xf10a('0x41')]=_['intersection'](_0x50031b[_0xf10a('0x3f')],qs[_0xf10a('0x40')](_0x5a5174[_0xf10a('0x3c')][_0xf10a('0x40')]));_0x212abb[_0xf10a('0x41')]=_0x212abb['attributes'][_0xf10a('0x42')]?_0x212abb[_0xf10a('0x41')]:_0x50031b['model'];if(!_0x5a5174[_0xf10a('0x3c')][_0xf10a('0x43')](_0xf10a('0x44'))){_0x212abb[_0xf10a('0x26')]=qs['limit'](_0x5a5174[_0xf10a('0x3c')]['limit']);_0x212abb[_0xf10a('0x24')]=qs['offset'](_0x5a5174[_0xf10a('0x3c')]['offset']);}_0x212abb['order']=qs[_0xf10a('0x46')](_0x5a5174[_0xf10a('0x3c')][_0xf10a('0x46')]);_0x212abb[_0xf10a('0x47')]=qs[_0xf10a('0x3d')](_['pick'](_0x5a5174[_0xf10a('0x3c')],_0x50031b[_0xf10a('0x3d')]));_0x212abb['where'][_0xf10a('0x63')]=_0x8b084c['id'];if(_0x5a5174[_0xf10a('0x3c')][_0xf10a('0x30')]){_0x212abb[_0xf10a('0x47')]=_[_0xf10a('0x48')](_0x212abb[_0xf10a('0x47')],{'$or':_[_0xf10a('0x31')](_0x212abb[_0xf10a('0x41')],function(_0x574491){var _0x435287={};_0x435287[_0x574491]={'$like':'%'+_0x5a5174[_0xf10a('0x3c')]['filter']+'%'};return _0x435287;})});}_0x212abb=_[_0xf10a('0x48')]({},_0x212abb,_0x5a5174[_0xf10a('0x64')]);return db[_0xf10a('0x6a')][_0xf10a('0x27')]({'where':_0x212abb[_0xf10a('0x47')]})[_0xf10a('0x2e')](function(_0x2cda4a){_0x510ea2['count']=_0x2cda4a;if(_0x5a5174[_0xf10a('0x3c')][_0xf10a('0x4d')]){_0x212abb['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xf10a('0x4a')](_0x212abb);})[_0xf10a('0x2e')](function(_0x883c89){_0x510ea2[_0xf10a('0x4b')]=_0x883c89;return _0x510ea2;});}})[_0xf10a('0x2e')](respondWithFilteredResult(_0x38d2b9,_0x212abb))['catch'](handleError(_0x38d2b9,null));};exports[_0xf10a('0x6b')]=function(_0x577e0a,_0x8bfdcb,_0x3ccd01){var _0xcce31e={};var _0x29b0a0={};var _0x381322;var _0x23e0ec;return db['VoiceQueue'][_0xf10a('0x61')]({'where':{'id':_0x577e0a['params']['id']}})['then'](handleEntityNotFound(_0x8bfdcb,null))[_0xf10a('0x2e')](function(_0x11091b){if(_0x11091b){_0x381322=_0x11091b;_0x29b0a0['model']=_[_0xf10a('0x4c')](db[_0xf10a('0x6c')][_0xf10a('0x39')]);_0x29b0a0[_0xf10a('0x3c')]=_[_0xf10a('0x4c')](_0x577e0a[_0xf10a('0x3c')]);_0x29b0a0['filters']=_[_0xf10a('0x3e')](_0x29b0a0['model'],_0x29b0a0[_0xf10a('0x3c')]);_0xcce31e[_0xf10a('0x41')]=_[_0xf10a('0x3e')](_0x29b0a0[_0xf10a('0x3f')],qs[_0xf10a('0x40')](_0x577e0a['query'][_0xf10a('0x40')]));_0xcce31e[_0xf10a('0x41')]=_0xcce31e[_0xf10a('0x41')][_0xf10a('0x42')]?_0xcce31e[_0xf10a('0x41')]:_0x29b0a0['model'];_0xcce31e[_0xf10a('0x45')]=qs[_0xf10a('0x46')](_0x577e0a['query']['sort']);_0xcce31e['where']=qs['filters'](_[_0xf10a('0x62')](_0x577e0a['query'],_0x29b0a0[_0xf10a('0x3d')]));if(_0x577e0a[_0xf10a('0x3c')]['filter']){_0xcce31e['where']=_[_0xf10a('0x48')](_0xcce31e[_0xf10a('0x47')],{'$or':_['map'](_0xcce31e[_0xf10a('0x41')],function(_0x3f21ad){var _0x53846a={};_0x53846a[_0x3f21ad]={'$like':'%'+_0x577e0a[_0xf10a('0x3c')][_0xf10a('0x30')]+'%'};return _0x53846a;})});}_0xcce31e=_[_0xf10a('0x48')]({},_0xcce31e,_0x577e0a[_0xf10a('0x64')]);return _0x381322[_0xf10a('0x6b')](_0xcce31e);}})[_0xf10a('0x2e')](function(_0x37e6ce){if(_0x37e6ce){_0x23e0ec=_0x37e6ce[_0xf10a('0x42')];if(!_0x577e0a['query'][_0xf10a('0x43')](_0xf10a('0x44'))){_0xcce31e[_0xf10a('0x26')]=qs['limit'](_0x577e0a[_0xf10a('0x3c')][_0xf10a('0x26')]);_0xcce31e['offset']=qs['offset'](_0x577e0a['query'][_0xf10a('0x24')]);}return _0x381322[_0xf10a('0x6b')](_0xcce31e);}})['then'](function(_0x390e5e){if(_0x390e5e){return _0x390e5e?{'count':_0x23e0ec,'rows':_0x390e5e}:null;}})['then'](respondWithResult(_0x8bfdcb,null))[_0xf10a('0x4e')](handleError(_0x8bfdcb,null));};exports[_0xf10a('0x6d')]=function(_0x646abf,_0x4a1fcb,_0x2f29bb){var _0x1d7333=_0x646abf[_0xf10a('0x50')][_0xf10a('0x6e')];var _0x264695=_['map'](_0x1d7333,'id');return db[_0xf10a('0x6c')][_0xf10a('0x4a')]({'where':{'id':_0x264695},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf10a('0x6f'),'attributes':['id',_0xf10a('0x35'),_0xf10a('0x70'),_0xf10a('0x71'),_0xf10a('0x72')],'raw':!![]}]})[_0xf10a('0x2e')](function(_0x1a00f4){if(_0x1a00f4){var _0x7d9c3=_[_0xf10a('0x73')](_0x1a00f4,function(_0x5360f1){var _0x4913a1=_0x5360f1['get']({'plain':!![]});_0x4913a1['Agents'][_0xf10a('0x74')](function(_0x455e6f){_0x455e6f[_0xf10a('0x75')]=_[_0xf10a('0x34')](_0x1d7333,{'id':_0x4913a1['id']})[_0xf10a('0x75')];});return _0x4913a1[_0xf10a('0x6f')];});return db[_0xf10a('0x38')][_0xf10a('0x34')]({'where':{'id':_0x646abf[_0xf10a('0x5f')]['id']}})[_0xf10a('0x2e')](function(_0x5e5430){return db[_0xf10a('0x76')]['transaction'](function(_0x3157bd){return _0x5e5430[_0xf10a('0x6d')](_0x264695,{'transaction':_0x3157bd})[_0xf10a('0x2e')](function(){return BPromise[_0xf10a('0x77')](_0x1d7333,function(_0x4fc625){return db[_0xf10a('0x78')][_0xf10a('0x79')]({'TeamId':_0x4fc625['id'],'VoiceQueueId':_0x646abf[_0xf10a('0x5f')]['id'],'penalty':_0x4fc625['penalty']},{'transaction':_0x3157bd});});})[_0xf10a('0x2e')](function(){return BPromise[_0xf10a('0x77')](_0x7d9c3,function(_0x3faff6){return db[_0xf10a('0x7a')][_0xf10a('0x7b')]({'where':{'UserId':_0x3faff6['id'],'VoiceQueueId':_0x646abf[_0xf10a('0x5f')]['id']},'defaults':{'penalty':_0x3faff6['penalty']},'transaction':_0x3157bd});});})['then'](function(){return BPromise[_0xf10a('0x77')](_[_0xf10a('0x30')](_0x7d9c3,{'online':!![]}),function(_0x1d087c){return db['UserVoiceQueueRt'][_0xf10a('0x79')]({'membername':_0x1d087c['name'],'UserId':_0x1d087c['id'],'queue_name':_0x5e5430[_0xf10a('0x35')],'VoiceQueueId':_0x5e5430['id'],'interface':_['isNil'](_0x1d087c[_0xf10a('0x72')])?util[_0xf10a('0x7c')]('SIP/%s',_0x1d087c[_0xf10a('0x35')]):_0x1d087c[_0xf10a('0x72')],'paused':_0x1d087c[_0xf10a('0x71')]||![],'penalty':_0x1d087c['penalty']},{'transaction':_0x3157bd});});})['then'](function(){_0x7d9c3[_0xf10a('0x74')](function(_0x577da4){socket['emit'](_0xf10a('0x7d'),{'UserId':_0x577da4['id'],'VoiceQueueId':_0x5e5430['id']});});});});});}})[_0xf10a('0x2e')](respondWithStatusCode(_0x4a1fcb,null))[_0xf10a('0x4e')](handleError(_0x4a1fcb,null));};exports['removeTeams']=function(_0x5026bf,_0x24c1f7,_0x29e456){return db[_0xf10a('0x6c')][_0xf10a('0x4a')]({'where':{'id':_0x5026bf['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xf10a('0x7e')],'as':_0xf10a('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xf10a('0x2e')](handleEntityNotFound(_0x24c1f7,null))[_0xf10a('0x2e')](function(_0x1541a7){var _0x6bce5c=_[_0xf10a('0x31')](_0x1541a7,'id');var _0x15d064=[];var _0x23121b=[];var _0x325e04=squel[_0xf10a('0x7f')]();_0x325e04[_0xf10a('0x80')](_0xf10a('0x81'))[_0xf10a('0x82')]('team_has_voice_queues','tq')[_0xf10a('0x83')](_0xf10a('0x84'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf10a('0x47')]('VoiceQueueId\x20=\x20?',_0x5026bf[_0xf10a('0x5f')]['id']);for(var _0x1b88a1=0x0;_0x1b88a1<_0x1541a7[_0xf10a('0x42')];_0x1b88a1+=0x1){let _0x34bddb=_0x1541a7[_0x1b88a1];for(var _0x5e8590=0x0;_0x5e8590<_0x34bddb[_0xf10a('0x6f')]['length'];_0x5e8590+=0x1){let _0x18c81c=_0x34bddb[_0xf10a('0x6f')][_0x5e8590];var _0x2f58ec=_0x325e04[_0xf10a('0x85')]();_0x2f58ec[_0xf10a('0x47')](_0xf10a('0x86'),_0x18c81c['id']);_0x23121b[_0xf10a('0x87')](db[_0xf10a('0x76')]['query'](_0x2f58ec[_0xf10a('0x88')](),{'type':db[_0xf10a('0x76')][_0xf10a('0x89')][_0xf10a('0x8a')]})['then'](function(_0x427431){if(_0x427431['length']===0x1){return _0x18c81c['id'];}else{var _0x52c757=_[_0xf10a('0x8b')](_[_0xf10a('0x31')](_0x427431,'TeamId'),function(_0x348d27){return _[_0xf10a('0x8c')](_0x6bce5c,_0x348d27);});if(_0x52c757){return _0x18c81c['id'];}}}));}}return BPromise[_0xf10a('0x8d')](_0x23121b)[_0xf10a('0x2e')](function(_0x19eef7){_0x15d064=_(_0x15d064)['union'](_0x19eef7)['compact']()[_0xf10a('0x32')]();return db[_0xf10a('0x38')]['find']({'where':{'id':_0x5026bf[_0xf10a('0x5f')]['id']}})[_0xf10a('0x2e')](function(_0x30764e){return db[_0xf10a('0x76')]['transaction'](function(_0x2c8b70){return _0x30764e[_0xf10a('0x8e')](_0x5026bf['query'][_0xf10a('0x8f')],{'transaction':_0x2c8b70})['then'](function(){if(!_['isEmpty'](_0x15d064)){return _0x30764e['removeAgents'](_0x15d064,{'transaction':_0x2c8b70})[_0xf10a('0x2e')](function(){return db[_0xf10a('0x90')]['destroy']({'where':{'VoiceQueueId':_0x5026bf[_0xf10a('0x5f')]['id'],'UserId':_0x15d064},'transaction':_0x2c8b70});});}})[_0xf10a('0x2e')](function(){_0x15d064[_0xf10a('0x74')](function(_0xd42eab){socket[_0xf10a('0x91')](_0xf10a('0x92'),{'UserId':_0xd42eab,'VoiceQueueId':_0x30764e['id']});});});});});});})[_0xf10a('0x2e')](respondWithStatusCode(_0x24c1f7,null))['catch'](handleError(_0x24c1f7,null));};exports[_0xf10a('0x93')]=function(_0x5e8798,_0x4b1fdf,_0x1c4192){var _0x4592c1,_0xcf9f1b;return db['VoiceQueue']['find']({'where':{'id':_0x5e8798[_0xf10a('0x5f')]['id']}})[_0xf10a('0x2e')](handleEntityNotFound(_0x4b1fdf,null))[_0xf10a('0x2e')](function(_0x1f6357){if(_0x1f6357){_0xcf9f1b=_0x1f6357;return _0x1f6357[_0xf10a('0x93')](_0x5e8798[_0xf10a('0x50')]['ids'],_['omit'](_0x5e8798[_0xf10a('0x50')],[_0xf10a('0x8f'),'id'])||{})['spread'](function(_0xa47230){for(var _0x3a272b=0x0;_0x3a272b<_0x5e8798[_0xf10a('0x50')][_0xf10a('0x8f')][_0xf10a('0x42')];_0x3a272b+=0x1){socket[_0xf10a('0x91')](_0xf10a('0x7d'),{'UserId':Number(_0x5e8798['body'][_0xf10a('0x8f')][_0x3a272b]),'VoiceQueueId':Number(_0x5e8798[_0xf10a('0x5f')]['id'])});}return _0xa47230;});}})[_0xf10a('0x2e')](function(_0x49b358){_0x4592c1=_0x49b358||[];if(_0xcf9f1b){return db[_0xf10a('0x7e')][_0xf10a('0x4a')]({'where':{'id':_0x5e8798[_0xf10a('0x50')][_0xf10a('0x8f')]},'attributes':['id',_0xf10a('0x35'),'online',_0xf10a('0x71'),_0xf10a('0x72')],'raw':!![]});}})[_0xf10a('0x2e')](function(_0x48e1c3){if(!_[_0xf10a('0x94')](_0x48e1c3)){var _0x578d66=[];for(var _0x16428d=0x0;_0x16428d<_0x48e1c3[_0xf10a('0x42')];_0x16428d++){if(_0x48e1c3[_0x16428d][_0xf10a('0x70')]){_0x578d66[_0xf10a('0x87')](db[_0xf10a('0x90')][_0xf10a('0x79')]({'membername':_0x48e1c3[_0x16428d][_0xf10a('0x35')],'UserId':_0x48e1c3[_0x16428d]['id'],'queue_name':_0xcf9f1b[_0xf10a('0x35')],'VoiceQueueId':_0xcf9f1b['id'],'interface':_[_0xf10a('0x95')](_0x48e1c3[_0x16428d]['interface'])?util[_0xf10a('0x7c')]('SIP/%s',_0x48e1c3[_0x16428d][_0xf10a('0x35')]):_0x48e1c3[_0x16428d][_0xf10a('0x72')],'paused':_0x48e1c3[_0x16428d][_0xf10a('0x71')]||![],'penalty':_0x5e8798[_0xf10a('0x50')][_0xf10a('0x75')]||0x0}));}}return BPromise[_0xf10a('0x8d')](_0x578d66);}})[_0xf10a('0x2e')](function(){return _0x4592c1;})[_0xf10a('0x2e')](respondWithResult(_0x4b1fdf,null))[_0xf10a('0x4e')](handleError(_0x4b1fdf,null));};exports[_0xf10a('0x96')]=function(_0x57c636,_0xa534e1,_0x38598b){return db[_0xf10a('0x38')][_0xf10a('0x34')]({'where':{'id':_0x57c636[_0xf10a('0x5f')]['id']}})['then'](handleEntityNotFound(_0xa534e1,null))[_0xf10a('0x2e')](function(_0x25d54d){if(_0x25d54d){return _0x25d54d['removeAgents'](_0x57c636[_0xf10a('0x3c')]['ids'])['then'](function(){if(_['isArray'](_0x57c636['query']['ids'])){for(var _0x124fd9=0x0;_0x124fd9<_0x57c636['query'][_0xf10a('0x8f')][_0xf10a('0x42')];_0x124fd9+=0x1){socket[_0xf10a('0x91')](_0xf10a('0x92'),{'UserId':Number(_0x57c636[_0xf10a('0x3c')][_0xf10a('0x8f')][_0x124fd9]),'VoiceQueueId':Number(_0x57c636[_0xf10a('0x5f')]['id'])});}}else{socket['emit'](_0xf10a('0x92'),{'UserId':Number(_0x57c636[_0xf10a('0x3c')][_0xf10a('0x8f')]),'VoiceQueueId':Number(_0x57c636['params']['id'])});}});}})['then'](function(_0x47168e){return db[_0xf10a('0x90')]['destroy']({'where':{'VoiceQueueId':_0x57c636[_0xf10a('0x5f')]['id'],'UserId':_0x57c636[_0xf10a('0x3c')][_0xf10a('0x8f')]}})[_0xf10a('0x2e')](function(){return _0x47168e;});})[_0xf10a('0x2e')](respondWithStatusCode(_0xa534e1,null))['catch'](handleError(_0xa534e1,null));};exports[_0xf10a('0x97')]=function(_0x115a68,_0x3c0190,_0x2522db){var _0x4f158c={};var _0x1c47d0={};var _0x56a416;var _0x38c85c;return db[_0xf10a('0x38')]['findOne']({'where':{'id':_0x115a68[_0xf10a('0x5f')]['id']}})[_0xf10a('0x2e')](handleEntityNotFound(_0x3c0190,null))['then'](function(_0x20cb41){if(_0x20cb41){_0x56a416=_0x20cb41;_0x1c47d0[_0xf10a('0x3f')]=_['keys'](db['User'][_0xf10a('0x39')]);_0x1c47d0[_0xf10a('0x3c')]=_[_0xf10a('0x4c')](_0x115a68[_0xf10a('0x3c')]);_0x1c47d0[_0xf10a('0x3d')]=_[_0xf10a('0x3e')](_0x1c47d0[_0xf10a('0x3f')],_0x1c47d0['query']);_0x4f158c[_0xf10a('0x41')]=_['intersection'](_0x1c47d0[_0xf10a('0x3f')],qs[_0xf10a('0x40')](_0x115a68[_0xf10a('0x3c')][_0xf10a('0x40')]));_0x4f158c['attributes']=_0x4f158c[_0xf10a('0x41')][_0xf10a('0x42')]?_0x4f158c[_0xf10a('0x41')]:_0x1c47d0[_0xf10a('0x3f')];_0x4f158c[_0xf10a('0x45')]=qs[_0xf10a('0x46')](_0x115a68['query'][_0xf10a('0x46')]);_0x4f158c['where']=qs[_0xf10a('0x3d')](_[_0xf10a('0x62')](_0x115a68['query'],_0x1c47d0[_0xf10a('0x3d')]));if(_0x115a68[_0xf10a('0x3c')]['filter']){_0x4f158c[_0xf10a('0x47')]=_['merge'](_0x4f158c['where'],{'$or':_['map'](_0x4f158c[_0xf10a('0x41')],function(_0x10f844){var _0x2a2ec2={};_0x2a2ec2[_0x10f844]={'$like':'%'+_0x115a68[_0xf10a('0x3c')]['filter']+'%'};return _0x2a2ec2;})});}_0x4f158c=_[_0xf10a('0x48')]({},_0x4f158c,_0x115a68[_0xf10a('0x64')]);return _0x56a416[_0xf10a('0x97')](_0x4f158c);}})['then'](function(_0x228272){if(_0x228272){_0x38c85c=_0x228272[_0xf10a('0x42')];if(!_0x115a68['query'][_0xf10a('0x43')](_0xf10a('0x44'))){_0x4f158c[_0xf10a('0x26')]=qs[_0xf10a('0x26')](_0x115a68[_0xf10a('0x3c')][_0xf10a('0x26')]);_0x4f158c[_0xf10a('0x24')]=qs[_0xf10a('0x24')](_0x115a68['query']['offset']);}return _0x56a416['getAgents'](_0x4f158c);}})[_0xf10a('0x2e')](function(_0xd1277c){if(_0xd1277c){return _0xd1277c?{'count':_0x38c85c,'rows':_0xd1277c}:null;}})[_0xf10a('0x2e')](respondWithResult(_0x3c0190,null))['catch'](handleError(_0x3c0190,null));};exports[_0xf10a('0x98')]=function(_0x6f86e3,_0x2eaabd,_0x8a92a6){var _0x512b24={};var _0x120edd={};var _0x5bec22;var _0x1763c4;return db[_0xf10a('0x38')][_0xf10a('0x61')]({'where':{'id':_0x6f86e3[_0xf10a('0x5f')]['id']}})[_0xf10a('0x2e')](handleEntityNotFound(_0x2eaabd,null))[_0xf10a('0x2e')](function(_0x244c4d){if(_0x244c4d){_0x5bec22=_0x244c4d;_0x120edd[_0xf10a('0x3f')]=_[_0xf10a('0x4c')](db[_0xf10a('0x90')][_0xf10a('0x39')]);_0x120edd[_0xf10a('0x3c')]=_['keys'](_0x6f86e3[_0xf10a('0x3c')]);_0x120edd[_0xf10a('0x3d')]=_['intersection'](_0x120edd['model'],_0x120edd[_0xf10a('0x3c')]);_0x512b24[_0xf10a('0x41')]=_['intersection'](_0x120edd[_0xf10a('0x3f')],qs['fields'](_0x6f86e3['query']['fields']));_0x512b24[_0xf10a('0x41')]=_0x512b24[_0xf10a('0x41')][_0xf10a('0x42')]?_0x512b24[_0xf10a('0x41')]:_0x120edd['model'];_0x512b24[_0xf10a('0x45')]=qs['sort'](_0x6f86e3[_0xf10a('0x3c')][_0xf10a('0x46')]);_0x512b24['where']=qs['filters'](_[_0xf10a('0x62')](_0x6f86e3[_0xf10a('0x3c')],_0x120edd[_0xf10a('0x3d')]));if(_0x6f86e3['query'][_0xf10a('0x30')]){_0x512b24[_0xf10a('0x47')]=_['merge'](_0x512b24[_0xf10a('0x47')],{'$or':_['map'](_0x512b24[_0xf10a('0x41')],function(_0x323b5f){var _0x4421ec={};_0x4421ec[_0x323b5f]={'$like':'%'+_0x6f86e3['query'][_0xf10a('0x30')]+'%'};return _0x4421ec;})});}_0x512b24=_[_0xf10a('0x48')]({},_0x512b24,_0x6f86e3[_0xf10a('0x64')]);return _0x5bec22[_0xf10a('0x98')](_0x512b24);}})[_0xf10a('0x2e')](function(_0x38fd9e){if(_0x38fd9e){_0x1763c4=_0x38fd9e[_0xf10a('0x42')];if(!_0x6f86e3['query'][_0xf10a('0x43')](_0xf10a('0x44'))){_0x512b24[_0xf10a('0x26')]=qs[_0xf10a('0x26')](_0x6f86e3[_0xf10a('0x3c')]['limit']);_0x512b24[_0xf10a('0x24')]=qs['offset'](_0x6f86e3['query'][_0xf10a('0x24')]);}return _0x5bec22[_0xf10a('0x98')](_0x512b24);}})[_0xf10a('0x2e')](function(_0x7adef4){return _0x7adef4?{'count':_0x1763c4,'rows':_0x7adef4}:null;})[_0xf10a('0x2e')](respondWithResult(_0x2eaabd,null))[_0xf10a('0x4e')](handleError(_0x2eaabd,null));};exports[_0xf10a('0x99')]=function(_0x46adb9,_0x31fce6,_0x58c2c8){var _0x2a17bb={};var _0x3eaf2c={};var _0x1f8f1c;var _0x5adf82;return db[_0xf10a('0x38')][_0xf10a('0x61')]({'where':{'id':_0x46adb9[_0xf10a('0x5f')]['id']}})[_0xf10a('0x2e')](handleEntityNotFound(_0x31fce6,null))[_0xf10a('0x2e')](function(_0x24d375){if(_0x24d375){_0x1f8f1c=_0x24d375;_0x3eaf2c['model']=_[_0xf10a('0x4c')](db[_0xf10a('0x9a')][_0xf10a('0x39')]);_0x3eaf2c['query']=_['keys'](_0x46adb9[_0xf10a('0x3c')]);_0x3eaf2c[_0xf10a('0x3d')]=_[_0xf10a('0x3e')](_0x3eaf2c[_0xf10a('0x3f')],_0x3eaf2c[_0xf10a('0x3c')]);_0x2a17bb['attributes']=_[_0xf10a('0x3e')](_0x3eaf2c['model'],qs[_0xf10a('0x40')](_0x46adb9['query'][_0xf10a('0x40')]));_0x2a17bb['attributes']=_0x2a17bb[_0xf10a('0x41')][_0xf10a('0x42')]?_0x2a17bb['attributes']:_0x3eaf2c['model'];_0x2a17bb[_0xf10a('0x45')]=qs[_0xf10a('0x46')](_0x46adb9[_0xf10a('0x3c')][_0xf10a('0x46')]);_0x2a17bb[_0xf10a('0x47')]=qs[_0xf10a('0x3d')](_[_0xf10a('0x62')](_0x46adb9['query'],_0x3eaf2c[_0xf10a('0x3d')]));if(_0x46adb9[_0xf10a('0x3c')][_0xf10a('0x30')]){_0x2a17bb[_0xf10a('0x47')]=_['merge'](_0x2a17bb[_0xf10a('0x47')],{'$or':_[_0xf10a('0x31')](_0x2a17bb['attributes'],function(_0x47b33b){var _0x5993bb={};_0x5993bb[_0x47b33b]={'$like':'%'+_0x46adb9[_0xf10a('0x3c')][_0xf10a('0x30')]+'%'};return _0x5993bb;})});}_0x2a17bb=_[_0xf10a('0x48')]({},_0x2a17bb,_0x46adb9[_0xf10a('0x64')]);return _0x1f8f1c[_0xf10a('0x99')](_0x2a17bb);}})['then'](function(_0x2a6f36){if(_0x2a6f36){_0x5adf82=_0x2a6f36[_0xf10a('0x42')];if(!_0x46adb9[_0xf10a('0x3c')][_0xf10a('0x43')](_0xf10a('0x44'))){_0x2a17bb[_0xf10a('0x26')]=qs[_0xf10a('0x26')](_0x46adb9[_0xf10a('0x3c')]['limit']);_0x2a17bb['offset']=qs['offset'](_0x46adb9[_0xf10a('0x3c')][_0xf10a('0x24')]);}return _0x1f8f1c[_0xf10a('0x99')](_0x2a17bb);}})['then'](function(_0x3ca583){if(_0x3ca583){return _0x3ca583?{'count':_0x5adf82,'rows':_0x3ca583}:null;}})[_0xf10a('0x2e')](respondWithResult(_0x31fce6,null))['catch'](handleError(_0x31fce6,null));};exports[_0xf10a('0x9b')]=function(_0x424613,_0x363b46,_0x5d6b2e){var _0x38d48f,_0x4e5a47;return db[_0xf10a('0x38')]['find']({'where':{'id':_0x424613[_0xf10a('0x5f')]['id']}})[_0xf10a('0x2e')](handleEntityNotFound(_0x363b46,null))[_0xf10a('0x2e')](function(_0x28c8b8){if(_0x28c8b8){_0x4e5a47=_0x28c8b8;return _0x28c8b8[_0xf10a('0x9b')](_0x424613[_0xf10a('0x50')]['ids'],_[_0xf10a('0x9c')](_0x424613['body'],[_0xf10a('0x8f'),'id'])||{});}return null;})[_0xf10a('0x9d')](function(_0x2b43c9){var _0x258f4d;_0x38d48f=_0x2b43c9||[];var _0x389151=[];if(_0x2b43c9){for(var _0x55b539=0x0;_0x55b539<_0x2b43c9[_0xf10a('0x42')];_0x55b539+=0x1){var _0x58120d=_0x2b43c9[_0x55b539]['get']({'plain':!![]});_0x4e5a47['dialCheckDuplicateType']=_0x424613['body']['dialCheckDuplicateType']?_0x424613['body']['dialCheckDuplicateType']:_0x4e5a47[_0xf10a('0x9e')];switch(_0x4e5a47[_0xf10a('0x9e')]){case _0xf10a('0x9f'):_0x258f4d=squel['insert']()[_0xf10a('0xa0')](_0xf10a('0xa1'))[_0xf10a('0xa2')]([_0xf10a('0xa3'),'scheduledAt',_0xf10a('0xa4'),_0xf10a('0xa5'),_0xf10a('0x63'),_0xf10a('0x5d'),_0xf10a('0xa6')],squel[_0xf10a('0x7f')]()[_0xf10a('0x80')](_0xf10a('0xa3'),_0xf10a('0xa3'))[_0xf10a('0x80')](_0xf10a('0xa7'),'scheduledAt')['field']('id',_0xf10a('0xa4'))[_0xf10a('0x80')](_0x58120d[_0xf10a('0xa8')][_0xf10a('0x88')](),'ListId')['field'](_0x424613['params']['id'][_0xf10a('0x88')](),_0xf10a('0x63'))['field'](_0xf10a('0xa7'),_0xf10a('0x5d'))[_0xf10a('0x80')](_0xf10a('0xa7'),_0xf10a('0xa6'))[_0xf10a('0x82')](_0xf10a('0xa9'))['where'](_0xf10a('0xaa'))[_0xf10a('0x47')](_0xf10a('0xab'),_0x58120d[_0xf10a('0xa8')][_0xf10a('0x88')]())[_0xf10a('0x47')]('phone\x20IS\x20NOT\x20NULL')[_0xf10a('0x47')](_0xf10a('0xac'),squel['select']()[_0xf10a('0x80')](_0xf10a('0xad'))['from'](_0xf10a('0xae'))[_0xf10a('0x47')](_0xf10a('0xaf'),_0x424613[_0xf10a('0x5f')]['id']['toString']()))['where'](_0xf10a('0xac'),squel[_0xf10a('0x7f')]()[_0xf10a('0x80')](_0xf10a('0xb0'))[_0xf10a('0x82')](_0xf10a('0xa1'))[_0xf10a('0x47')]('VoiceQueueId\x20=\x20?',_0x424613[_0xf10a('0x5f')]['id'][_0xf10a('0x88')]())))[_0xf10a('0x88')]();break;case _0xf10a('0xb1'):_0x258f4d=squel[_0xf10a('0xb2')]()[_0xf10a('0xa0')]('cm_hopper')['fromQuery']([_0xf10a('0xa3'),'scheduledAt',_0xf10a('0xa4'),_0xf10a('0xa5'),_0xf10a('0x63'),_0xf10a('0x5d'),_0xf10a('0xa6')],squel[_0xf10a('0x7f')]()[_0xf10a('0x80')](_0xf10a('0xa3'),_0xf10a('0xa3'))[_0xf10a('0x80')](_0xf10a('0xa7'),_0xf10a('0xb3'))[_0xf10a('0x80')]('id',_0xf10a('0xa4'))[_0xf10a('0x80')](_0x58120d['CmListId'][_0xf10a('0x88')](),_0xf10a('0xa5'))[_0xf10a('0x80')](_0x424613[_0xf10a('0x5f')]['id'][_0xf10a('0x88')](),'VoiceQueueId')[_0xf10a('0x80')](_0xf10a('0xa7'),_0xf10a('0x5d'))['field']('NOW()','updatedAt')[_0xf10a('0x82')](_0xf10a('0xa9'))['where'](_0xf10a('0xaa'))[_0xf10a('0x47')](_0xf10a('0xab'),_0x58120d[_0xf10a('0xa8')][_0xf10a('0x88')]())[_0xf10a('0x47')](_0xf10a('0xb4'))[_0xf10a('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0xf10a('0x7f')]()[_0xf10a('0x80')](_0xf10a('0xb0'))[_0xf10a('0x82')](_0xf10a('0xa1'))[_0xf10a('0x47')](_0xf10a('0xaf'),_0x424613[_0xf10a('0x5f')]['id'][_0xf10a('0x88')]())))[_0xf10a('0x88')]();break;default:_0x258f4d=squel[_0xf10a('0xb2')]()[_0xf10a('0xa0')]('cm_hopper')[_0xf10a('0xa2')]([_0xf10a('0xa3'),'scheduledAt',_0xf10a('0xa4'),'ListId',_0xf10a('0x63'),_0xf10a('0x5d'),_0xf10a('0xa6')],squel[_0xf10a('0x7f')]()[_0xf10a('0x80')]('phone','phone')[_0xf10a('0x80')](_0xf10a('0xa7'),_0xf10a('0xb3'))['field']('id',_0xf10a('0xa4'))[_0xf10a('0x80')](_0x58120d[_0xf10a('0xa8')][_0xf10a('0x88')](),_0xf10a('0xa5'))['field'](_0x424613[_0xf10a('0x5f')]['id']['toString'](),_0xf10a('0x63'))[_0xf10a('0x80')](_0xf10a('0xa7'),_0xf10a('0x5d'))[_0xf10a('0x80')]('NOW()',_0xf10a('0xa6'))[_0xf10a('0x82')](_0xf10a('0xa9'))[_0xf10a('0x47')](_0xf10a('0xaa'))[_0xf10a('0x47')]('ListId\x20=\x20?',_0x58120d['CmListId'][_0xf10a('0x88')]())[_0xf10a('0x47')](_0xf10a('0xb4')))[_0xf10a('0x88')]();}_0x389151[_0xf10a('0x87')](db[_0xf10a('0x76')][_0xf10a('0x3c')](_0x258f4d));}return BPromise[_0xf10a('0x8d')](_0x389151);}})[_0xf10a('0x2e')](function(){return _0x38d48f;})['then'](respondWithResult(_0x363b46,null))[_0xf10a('0x4e')](handleError(_0x363b46,null));};exports['removeLists']=function(_0x56bbf1,_0x11e618,_0x4b2165){return db[_0xf10a('0x38')][_0xf10a('0x34')]({'where':{'id':_0x56bbf1['params']['id']}})[_0xf10a('0x2e')](handleEntityNotFound(_0x11e618,null))['then'](function(_0x4f0628){if(_0x4f0628){return _0x4f0628[_0xf10a('0xb5')](_0x56bbf1[_0xf10a('0x3c')][_0xf10a('0x8f')]);}})[_0xf10a('0x2e')](function(_0x4fc691){if(_0x4fc691){return db[_0xf10a('0x65')][_0xf10a('0x2d')]({'where':{'ListId':_0x56bbf1[_0xf10a('0x3c')][_0xf10a('0x8f')],'VoiceQueueId':_0x56bbf1[_0xf10a('0x5f')]['id']}})[_0xf10a('0x2e')](function(){return _0x4fc691;});}})[_0xf10a('0x2e')](respondWithStatusCode(_0x11e618,null))[_0xf10a('0x4e')](handleError(_0x11e618,null));};exports[_0xf10a('0xb6')]=function(_0xfa2c1f,_0xd3437,_0x3ec9b0){var _0x57100e={};var _0x542d0d={};var _0x35e6a5;var _0xb3faf6;return db[_0xf10a('0x38')][_0xf10a('0x61')]({'where':{'id':_0xfa2c1f['params']['id']}})['then'](handleEntityNotFound(_0xd3437,null))['then'](function(_0x2a8b62){if(_0x2a8b62){_0x35e6a5=_0x2a8b62;_0x542d0d[_0xf10a('0x3f')]=_[_0xf10a('0x4c')](db['CmList'][_0xf10a('0x39')]);_0x542d0d[_0xf10a('0x3c')]=_['keys'](_0xfa2c1f['query']);_0x542d0d[_0xf10a('0x3d')]=_[_0xf10a('0x3e')](_0x542d0d[_0xf10a('0x3f')],_0x542d0d[_0xf10a('0x3c')]);_0x57100e[_0xf10a('0x41')]=_[_0xf10a('0x3e')](_0x542d0d[_0xf10a('0x3f')],qs[_0xf10a('0x40')](_0xfa2c1f['query'][_0xf10a('0x40')]));_0x57100e[_0xf10a('0x41')]=_0x57100e[_0xf10a('0x41')][_0xf10a('0x42')]?_0x57100e[_0xf10a('0x41')]:_0x542d0d[_0xf10a('0x3f')];_0x57100e['order']=qs[_0xf10a('0x46')](_0xfa2c1f[_0xf10a('0x3c')][_0xf10a('0x46')]);_0x57100e['where']=qs[_0xf10a('0x3d')](_[_0xf10a('0x62')](_0xfa2c1f[_0xf10a('0x3c')],_0x542d0d[_0xf10a('0x3d')]));if(_0xfa2c1f['query'][_0xf10a('0x30')]){_0x57100e['where']=_[_0xf10a('0x48')](_0x57100e[_0xf10a('0x47')],{'$or':_[_0xf10a('0x31')](_0x57100e['attributes'],function(_0x37b297){var _0x57b688={};_0x57b688[_0x37b297]={'$like':'%'+_0xfa2c1f[_0xf10a('0x3c')][_0xf10a('0x30')]+'%'};return _0x57b688;})});}_0x57100e=_['merge']({},_0x57100e,_0xfa2c1f[_0xf10a('0x64')]);return _0x35e6a5[_0xf10a('0xb6')](_0x57100e);}})[_0xf10a('0x2e')](function(_0x264e88){if(_0x264e88){_0xb3faf6=_0x264e88['length'];if(!_0xfa2c1f[_0xf10a('0x3c')]['hasOwnProperty'](_0xf10a('0x44'))){_0x57100e[_0xf10a('0x26')]=qs[_0xf10a('0x26')](_0xfa2c1f['query'][_0xf10a('0x26')]);_0x57100e['offset']=qs[_0xf10a('0x24')](_0xfa2c1f[_0xf10a('0x3c')][_0xf10a('0x24')]);}return _0x35e6a5['getBlackLists'](_0x57100e);}})[_0xf10a('0x2e')](function(_0xd7fd2c){if(_0xd7fd2c){return _0xd7fd2c?{'count':_0xb3faf6,'rows':_0xd7fd2c}:null;}})['then'](respondWithResult(_0xd3437,null))[_0xf10a('0x4e')](handleError(_0xd3437,null));};exports[_0xf10a('0xb7')]=function(_0x31c410,_0x51f3ab,_0x480708){var _0x36b382,_0x27964b;return db[_0xf10a('0x38')]['find']({'where':{'id':_0x31c410[_0xf10a('0x5f')]['id']}})['then'](handleEntityNotFound(_0x51f3ab,null))[_0xf10a('0x2e')](function(_0x1f7f10){if(_0x1f7f10){_0x27964b=_0x1f7f10;return _0x1f7f10['addBlackLists'](_0x31c410[_0xf10a('0x50')]['ids'],_[_0xf10a('0x9c')](_0x31c410[_0xf10a('0x50')],[_0xf10a('0x8f'),'id'])||{});}return null;})[_0xf10a('0x9d')](function(_0x1dca0c){var _0x13dd9a;_0x36b382=_0x1dca0c||[];var _0x6d1065=[];if(_0x1dca0c){for(var _0x227a56=0x0;_0x227a56<_0x1dca0c['length'];_0x227a56+=0x1){var _0x50f886=_0x1dca0c[_0x227a56][_0xf10a('0x54')]({'plain':!![]});_0x13dd9a=squel[_0xf10a('0xb2')]()[_0xf10a('0xa0')](_0xf10a('0xb8'))['fromQuery']([_0xf10a('0xa3'),_0xf10a('0xa4'),_0xf10a('0xa5'),_0xf10a('0x63'),_0xf10a('0x5d'),_0xf10a('0xa6')],squel[_0xf10a('0x7f')]()[_0xf10a('0x80')](_0xf10a('0xa3'),_0xf10a('0xa3'))[_0xf10a('0x80')]('id',_0xf10a('0xa4'))[_0xf10a('0x80')](_0x50f886[_0xf10a('0xa8')][_0xf10a('0x88')](),_0xf10a('0xa5'))[_0xf10a('0x80')](_0x31c410[_0xf10a('0x5f')]['id']['toString'](),_0xf10a('0x63'))['field'](_0xf10a('0xa7'),'createdAt')[_0xf10a('0x80')](_0xf10a('0xa7'),'updatedAt')[_0xf10a('0x82')](_0xf10a('0xa9'))[_0xf10a('0x47')](_0xf10a('0xaa'))[_0xf10a('0x47')](_0xf10a('0xab'),_0x50f886[_0xf10a('0xa8')][_0xf10a('0x88')]())[_0xf10a('0x47')]('phone\x20IS\x20NOT\x20NULL'))[_0xf10a('0x88')]();_0x6d1065['push'](db[_0xf10a('0x76')][_0xf10a('0x3c')](_0x13dd9a));}return BPromise[_0xf10a('0x8d')](_0x6d1065);}})[_0xf10a('0x2e')](function(){return _0x36b382;})['then'](respondWithResult(_0x51f3ab,null))['catch'](handleError(_0x51f3ab,null));};exports[_0xf10a('0xb9')]=function(_0x4d6501,_0x1e6c27,_0x3aed21){return db[_0xf10a('0x38')]['find']({'where':{'id':_0x4d6501[_0xf10a('0x5f')]['id']}})[_0xf10a('0x2e')](handleEntityNotFound(_0x1e6c27,null))[_0xf10a('0x2e')](function(_0x2d02e7){if(_0x2d02e7){return _0x2d02e7['removeBlackLists'](_0x4d6501[_0xf10a('0x3c')][_0xf10a('0x8f')]);}})['then'](function(_0x1bf0cd){if(_0x1bf0cd){return db[_0xf10a('0x6a')][_0xf10a('0x2d')]({'where':{'ListId':_0x4d6501[_0xf10a('0x3c')][_0xf10a('0x8f')],'VoiceQueueId':_0x4d6501[_0xf10a('0x5f')]['id']}})['then'](function(){return _0x1bf0cd;});}})[_0xf10a('0x2e')](respondWithStatusCode(_0x1e6c27,null))['catch'](handleError(_0x1e6c27,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index ccd0d5c..281ee69 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 _0xde60=['VoiceQueue','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x2b2418,_0x42b80d){var _0x864987=function(_0x3b83da){while(--_0x3b83da){_0x2b2418['push'](_0x2b2418['shift']());}};_0x864987(++_0x42b80d);}(_0xde60,0x1c7));var _0x0de6=function(_0x3c04ef,_0x9d110c){_0x3c04ef=_0x3c04ef-0x0;var _0x6a3a69=_0xde60[_0x3c04ef];return _0x6a3a69;};'use strict';var EventEmitter=require(_0x0de6('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x0de6('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x0de6('0x2')](0x0);var events={'afterCreate':_0x0de6('0x3'),'afterUpdate':_0x0de6('0x4'),'afterDestroy':_0x0de6('0x5')};function emitEvent(_0x45500d){return function(_0x30c6d4,_0x12c9b8,_0x3391cf){VoiceQueueEvents[_0x0de6('0x6')](_0x45500d+':'+_0x30c6d4['id'],_0x30c6d4);VoiceQueueEvents[_0x0de6('0x6')](_0x45500d,_0x30c6d4);_0x3391cf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x0de6('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xd87d=['VoiceQueue','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x3d8e08,_0x13187d){var _0x4d79e2=function(_0x3f4410){while(--_0x3f4410){_0x3d8e08['push'](_0x3d8e08['shift']());}};_0x4d79e2(++_0x13187d);}(_0xd87d,0xee));var _0xdd87=function(_0xb208a7,_0x17f50a){_0xb208a7=_0xb208a7-0x0;var _0x3148cf=_0xd87d[_0xb208a7];return _0x3148cf;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db'][_0xdd87('0x0')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xdd87('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdd87('0x2'),'afterDestroy':_0xdd87('0x3')};function emitEvent(_0x2b1e4f){return function(_0x19019e,_0x55e489,_0x495829){VoiceQueueEvents[_0xdd87('0x4')](_0x2b1e4f+':'+_0x19019e['id'],_0x19019e);VoiceQueueEvents[_0xdd87('0x4')](_0x2b1e4f,_0x19019e);_0x495829(null);};}for(var e in events){if(events[_0xdd87('0x5')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xdd87('0x6')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 208e70a..85b5068 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 _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x2e948d,_0xa8f5df){var _0x4e57af=function(_0x217f4b){while(--_0x217f4b){_0x2e948d['push'](_0x2e948d['shift']());}};_0x4e57af(++_0xa8f5df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 +var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x392be3,_0xf1d603){var _0x1453b2=function(_0x5bdce8){while(--_0x5bdce8){_0x392be3['push'](_0x392be3['shift']());}};_0x1453b2(++_0xf1d603);}(_0x3e74,0x175));var _0x43e7=function(_0x49374a,_0x1f2326){_0x49374a=_0x49374a-0x0;var _0x32460b=_0x3e74[_0x49374a];return _0x32460b;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 7d44ce2..e48e324 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 _0x7442=['localhost','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','limit','include','map','model','ShowVoiceQueue','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults'];(function(_0x20cc89,_0x62e0c5){var _0x56ac33=function(_0x21a0ba){while(--_0x21a0ba){_0x20cc89['push'](_0x20cc89['shift']());}};_0x56ac33(++_0x62e0c5);}(_0x7442,0xa9));var _0x2744=function(_0x3bc61f,_0x137218){_0x3bc61f=_0x3bc61f-0x0;var _0x4e52b4=_0x7442[_0x3bc61f];return _0x4e52b4;};'use strict';var _=require(_0x2744('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2744('0x1'));var rs=require(_0x2744('0x2'));var fs=require('fs');var Redis=require(_0x2744('0x3'));var db=require(_0x2744('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2744('0x5'))(_0x2744('0x6'));var config=require(_0x2744('0x7'));var jayson=require(_0x2744('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x2744('0x9')]=_[_0x2744('0xa')](config[_0x2744('0x9')],{'host':_0x2744('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2744('0x9')]));require(_0x2744('0xc'))['register'](socket);function respondWithRpcPromise(_0x4d9a65,_0x2ff8c5,_0x401ded){return new BPromise(function(_0x3cde88,_0x3f5466){return client[_0x2744('0xd')](_0x4d9a65,_0x401ded)[_0x2744('0xe')](function(_0x17b842){logger[_0x2744('0xf')](_0x2744('0x10'),_0x2ff8c5,_0x2744('0x11'));logger[_0x2744('0x12')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x2ff8c5,_0x2744('0x11'),JSON[_0x2744('0x13')](_0x17b842));if(_0x17b842['error']){if(_0x17b842[_0x2744('0x14')][_0x2744('0x15')]===0x1f4){logger[_0x2744('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x2ff8c5,_0x17b842[_0x2744('0x14')][_0x2744('0x16')]);return _0x3f5466(_0x17b842[_0x2744('0x14')]['message']);}logger[_0x2744('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x2ff8c5,_0x17b842[_0x2744('0x14')]['message']);return _0x3cde88(_0x17b842[_0x2744('0x14')][_0x2744('0x16')]);}else{logger[_0x2744('0xf')](_0x2744('0x10'),_0x2ff8c5,_0x2744('0x11'));_0x3cde88(_0x17b842['result'][_0x2744('0x16')]);}})[_0x2744('0x17')](function(_0x545084){logger[_0x2744('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x2ff8c5,_0x545084);_0x3f5466(_0x545084);});});}exports[_0x2744('0x18')]=function(_0x3e3bf2){var _0x4749a9=this;return new Promise(function(_0x48100c,_0x58299a){return db[_0x2744('0x19')][_0x2744('0x1a')]({'raw':_0x3e3bf2[_0x2744('0x1b')]?_0x3e3bf2['options'][_0x2744('0x1c')]===undefined?!![]:![]:!![],'where':_0x3e3bf2[_0x2744('0x1b')]?_0x3e3bf2[_0x2744('0x1b')]['where']||null:null,'attributes':_0x3e3bf2[_0x2744('0x1b')]?_0x3e3bf2[_0x2744('0x1b')][_0x2744('0x1d')]||null:null,'limit':_0x3e3bf2[_0x2744('0x1b')]?_0x3e3bf2[_0x2744('0x1b')][_0x2744('0x1e')]||null:null,'include':_0x3e3bf2[_0x2744('0x1b')]?_0x3e3bf2[_0x2744('0x1b')][_0x2744('0x1f')]?_[_0x2744('0x20')](_0x3e3bf2[_0x2744('0x1b')][_0x2744('0x1f')],function(_0x24687d){return{'model':db[_0x24687d[_0x2744('0x21')]],'as':_0x24687d['as'],'attributes':_0x24687d['attributes'],'include':_0x24687d[_0x2744('0x1f')]?_[_0x2744('0x20')](_0x24687d[_0x2744('0x1f')],function(_0x550083){return{'model':db[_0x550083[_0x2744('0x21')]],'as':_0x550083['as'],'attributes':_0x550083[_0x2744('0x1d')],'include':_0x550083['include']?_[_0x2744('0x20')](_0x550083[_0x2744('0x1f')],function(_0x360cd5){return{'model':db[_0x360cd5[_0x2744('0x21')]],'as':_0x360cd5['as'],'attributes':_0x360cd5[_0x2744('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2744('0xe')](function(_0x245961){logger['info']('GetVoiceQueue',_0x3e3bf2);logger[_0x2744('0x12')](_0x2744('0x18'),_0x3e3bf2,JSON['stringify'](_0x245961));_0x48100c(_0x245961);})[_0x2744('0x17')](function(_0x1ec5ad){logger['error'](_0x2744('0x18'),_0x1ec5ad[_0x2744('0x16')],_0x3e3bf2);_0x58299a(_0x4749a9[_0x2744('0x14')](0x1f4,_0x1ec5ad[_0x2744('0x16')]));});});};exports[_0x2744('0x22')]=function(_0x5710a2){var _0x2a23b6=this;return new Promise(function(_0x2c988d,_0x191cf2){return db[_0x2744('0x19')][_0x2744('0x23')]({'raw':_0x5710a2[_0x2744('0x1b')]?_0x5710a2[_0x2744('0x1b')][_0x2744('0x1c')]===undefined?!![]:![]:!![],'where':_0x5710a2[_0x2744('0x1b')]?_0x5710a2[_0x2744('0x1b')]['where']||null:null,'attributes':_0x5710a2[_0x2744('0x1b')]?_0x5710a2[_0x2744('0x1b')][_0x2744('0x1d')]||null:null,'include':_0x5710a2[_0x2744('0x1b')]?_0x5710a2[_0x2744('0x1b')][_0x2744('0x1f')]?_['map'](_0x5710a2[_0x2744('0x1b')][_0x2744('0x1f')],function(_0x334e02){return{'model':db[_0x334e02[_0x2744('0x21')]],'as':_0x334e02['as'],'attributes':_0x334e02[_0x2744('0x1d')],'include':_0x334e02[_0x2744('0x1f')]?_[_0x2744('0x20')](_0x334e02[_0x2744('0x1f')],function(_0x1ef403){return{'model':db[_0x1ef403[_0x2744('0x21')]],'as':_0x1ef403['as'],'attributes':_0x1ef403[_0x2744('0x1d')],'include':_0x1ef403[_0x2744('0x1f')]?_['map'](_0x1ef403[_0x2744('0x1f')],function(_0x20c1b0){return{'model':db[_0x20c1b0[_0x2744('0x21')]],'as':_0x20c1b0['as'],'attributes':_0x20c1b0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d33c7){logger[_0x2744('0xf')](_0x2744('0x22'),_0x5710a2);logger[_0x2744('0x12')](_0x2744('0x22'),_0x5710a2,JSON[_0x2744('0x13')](_0x1d33c7));_0x2c988d(_0x1d33c7);})[_0x2744('0x17')](function(_0x5d51ac){logger[_0x2744('0x14')](_0x2744('0x22'),_0x5d51ac[_0x2744('0x16')],_0x5710a2);_0x191cf2(_0x2a23b6[_0x2744('0x14')](0x1f4,_0x5d51ac['message']));});});}; \ No newline at end of file +var _0x8d90=['raw','where','include','map','model','attributes','info','ShowVoiceQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options'];(function(_0x259895,_0x8ee28d){var _0x569999=function(_0x3da8bf){while(--_0x3da8bf){_0x259895['push'](_0x259895['shift']());}};_0x569999(++_0x8ee28d);}(_0x8d90,0xcb));var _0x08d9=function(_0xdb9c25,_0x308c3a){_0xdb9c25=_0xdb9c25-0x0;var _0x30c145=_0x8d90[_0xdb9c25];return _0x30c145;};'use strict';var _=require('lodash');var util=require(_0x08d9('0x0'));var moment=require(_0x08d9('0x1'));var BPromise=require(_0x08d9('0x2'));var rs=require(_0x08d9('0x3'));var fs=require('fs');var Redis=require(_0x08d9('0x4'));var db=require(_0x08d9('0x5'))['db'];var utils=require(_0x08d9('0x6'));var logger=require(_0x08d9('0x7'))('rpc');var config=require(_0x08d9('0x8'));var jayson=require(_0x08d9('0x9'));var client=jayson[_0x08d9('0xa')]['http']({'port':0x232a});config[_0x08d9('0xb')]=_[_0x08d9('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x08d9('0xd'))[_0x08d9('0xe')](socket);function respondWithRpcPromise(_0x4bd30e,_0x3298fc,_0xfa13a4){return new BPromise(function(_0x553139,_0x5a5343){return client[_0x08d9('0xf')](_0x4bd30e,_0xfa13a4)[_0x08d9('0x10')](function(_0x4211e1){logger['info'](_0x08d9('0x11'),_0x3298fc,_0x08d9('0x12'));logger[_0x08d9('0x13')](_0x08d9('0x14'),_0x3298fc,_0x08d9('0x12'),JSON[_0x08d9('0x15')](_0x4211e1));if(_0x4211e1['error']){if(_0x4211e1[_0x08d9('0x16')][_0x08d9('0x17')]===0x1f4){logger['error'](_0x08d9('0x11'),_0x3298fc,_0x4211e1[_0x08d9('0x16')][_0x08d9('0x18')]);return _0x5a5343(_0x4211e1[_0x08d9('0x16')][_0x08d9('0x18')]);}logger[_0x08d9('0x16')](_0x08d9('0x11'),_0x3298fc,_0x4211e1[_0x08d9('0x16')][_0x08d9('0x18')]);return _0x553139(_0x4211e1[_0x08d9('0x16')]['message']);}else{logger['info'](_0x08d9('0x11'),_0x3298fc,_0x08d9('0x12'));_0x553139(_0x4211e1[_0x08d9('0x19')][_0x08d9('0x18')]);}})[_0x08d9('0x1a')](function(_0x1c9423){logger[_0x08d9('0x16')](_0x08d9('0x11'),_0x3298fc,_0x1c9423);_0x5a5343(_0x1c9423);});});}exports[_0x08d9('0x1b')]=function(_0x272f47){var _0x310101=this;return new Promise(function(_0x24a257,_0x13fd1d){return db[_0x08d9('0x1c')][_0x08d9('0x1d')]({'raw':_0x272f47[_0x08d9('0x1e')]?_0x272f47[_0x08d9('0x1e')][_0x08d9('0x1f')]===undefined?!![]:![]:!![],'where':_0x272f47['options']?_0x272f47[_0x08d9('0x1e')][_0x08d9('0x20')]||null:null,'attributes':_0x272f47[_0x08d9('0x1e')]?_0x272f47[_0x08d9('0x1e')]['attributes']||null:null,'limit':_0x272f47['options']?_0x272f47[_0x08d9('0x1e')]['limit']||null:null,'include':_0x272f47['options']?_0x272f47[_0x08d9('0x1e')][_0x08d9('0x21')]?_[_0x08d9('0x22')](_0x272f47[_0x08d9('0x1e')][_0x08d9('0x21')],function(_0x193682){return{'model':db[_0x193682[_0x08d9('0x23')]],'as':_0x193682['as'],'attributes':_0x193682[_0x08d9('0x24')],'include':_0x193682['include']?_[_0x08d9('0x22')](_0x193682[_0x08d9('0x21')],function(_0x5ba3ab){return{'model':db[_0x5ba3ab[_0x08d9('0x23')]],'as':_0x5ba3ab['as'],'attributes':_0x5ba3ab[_0x08d9('0x24')],'include':_0x5ba3ab['include']?_[_0x08d9('0x22')](_0x5ba3ab[_0x08d9('0x21')],function(_0x205346){return{'model':db[_0x205346[_0x08d9('0x23')]],'as':_0x205346['as'],'attributes':_0x205346[_0x08d9('0x24')]};}):[]};}):[]};}):[]:[]})[_0x08d9('0x10')](function(_0x36b05e){logger[_0x08d9('0x25')](_0x08d9('0x1b'),_0x272f47);logger[_0x08d9('0x13')](_0x08d9('0x1b'),_0x272f47,JSON[_0x08d9('0x15')](_0x36b05e));_0x24a257(_0x36b05e);})[_0x08d9('0x1a')](function(_0x269d1e){logger['error']('GetVoiceQueue',_0x269d1e['message'],_0x272f47);_0x13fd1d(_0x310101['error'](0x1f4,_0x269d1e[_0x08d9('0x18')]));});});};exports['ShowVoiceQueue']=function(_0x1ad244){var _0x5d59d9=this;return new Promise(function(_0x53b7b8,_0x44a509){return db[_0x08d9('0x1c')]['find']({'raw':_0x1ad244['options']?_0x1ad244[_0x08d9('0x1e')][_0x08d9('0x1f')]===undefined?!![]:![]:!![],'where':_0x1ad244['options']?_0x1ad244[_0x08d9('0x1e')][_0x08d9('0x20')]||null:null,'attributes':_0x1ad244['options']?_0x1ad244[_0x08d9('0x1e')][_0x08d9('0x24')]||null:null,'include':_0x1ad244[_0x08d9('0x1e')]?_0x1ad244['options'][_0x08d9('0x21')]?_['map'](_0x1ad244[_0x08d9('0x1e')][_0x08d9('0x21')],function(_0x37660e){return{'model':db[_0x37660e['model']],'as':_0x37660e['as'],'attributes':_0x37660e[_0x08d9('0x24')],'include':_0x37660e[_0x08d9('0x21')]?_['map'](_0x37660e[_0x08d9('0x21')],function(_0x5f290a){return{'model':db[_0x5f290a['model']],'as':_0x5f290a['as'],'attributes':_0x5f290a[_0x08d9('0x24')],'include':_0x5f290a['include']?_[_0x08d9('0x22')](_0x5f290a['include'],function(_0x16c3c5){return{'model':db[_0x16c3c5[_0x08d9('0x23')]],'as':_0x16c3c5['as'],'attributes':_0x16c3c5['attributes']};}):[]};}):[]};}):[]:[]})[_0x08d9('0x10')](function(_0x336c93){logger['info'](_0x08d9('0x26'),_0x1ad244);logger[_0x08d9('0x13')](_0x08d9('0x26'),_0x1ad244,JSON[_0x08d9('0x15')](_0x336c93));_0x53b7b8(_0x336c93);})[_0x08d9('0x1a')](function(_0x290256){logger[_0x08d9('0x16')](_0x08d9('0x26'),_0x290256[_0x08d9('0x18')],_0x1ad244);_0x44a509(_0x5d59d9['error'](0x1f4,_0x290256[_0x08d9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 0b5292e..368d4ac 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 _0x4612=['remove','update','emit','removeListener','register','voiceQueue:','./voiceQueue.events','save'];(function(_0xa8f821,_0x54cfad){var _0x1d2d48=function(_0x3a5a75){while(--_0x3a5a75){_0xa8f821['push'](_0xa8f821['shift']());}};_0x1d2d48(++_0x54cfad);}(_0x4612,0x76));var _0x2461=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x4612[_0x5037ab];return _0x512adb;};'use strict';var VoiceQueueEvents=require(_0x2461('0x0'));var events=[_0x2461('0x1'),_0x2461('0x2'),_0x2461('0x3')];function createListener(_0x199993,_0x30008d){return function(_0x59ef08){_0x30008d[_0x2461('0x4')](_0x199993,_0x59ef08);};}function removeListener(_0x2be6fd,_0x147a95){return function(){VoiceQueueEvents[_0x2461('0x5')](_0x2be6fd,_0x147a95);};}exports[_0x2461('0x6')]=function(_0x2574a3){for(var _0x4c6c77=0x0,_0x188118=events['length'];_0x4c6c77<_0x188118;_0x4c6c77++){var _0x4913a6=events[_0x4c6c77];var _0xc6a6a5=createListener(_0x2461('0x7')+_0x4913a6,_0x2574a3);VoiceQueueEvents['on'](_0x4913a6,_0xc6a6a5);}}; \ No newline at end of file +var _0xd776=['./voiceQueue.events','save','remove','update','removeListener','length','voiceQueue:'];(function(_0x266e29,_0x5d3163){var _0x19246d=function(_0x324926){while(--_0x324926){_0x266e29['push'](_0x266e29['shift']());}};_0x19246d(++_0x5d3163);}(_0xd776,0xbd));var _0x6d77=function(_0x4d6571,_0x9b8870){_0x4d6571=_0x4d6571-0x0;var _0x848560=_0xd776[_0x4d6571];return _0x848560;};'use strict';var VoiceQueueEvents=require(_0x6d77('0x0'));var events=[_0x6d77('0x1'),_0x6d77('0x2'),_0x6d77('0x3')];function createListener(_0x5ddf93,_0x33f02d){return function(_0x3a41ce){_0x33f02d['emit'](_0x5ddf93,_0x3a41ce);};}function removeListener(_0x3b6184,_0x4f6e35){return function(){VoiceQueueEvents[_0x6d77('0x4')](_0x3b6184,_0x4f6e35);};}exports['register']=function(_0x3e8f73){for(var _0x5420a8=0x0,_0x301664=events[_0x6d77('0x5')];_0x5420a8<_0x301664;_0x5420a8++){var _0x1b1d61=events[_0x5420a8];var _0x159bc5=createListener(_0x6d77('0x6')+_0x1b1d61,_0x3e8f73);VoiceQueueEvents['on'](_0x1b1d61,_0x159bc5);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 31d40b0..116cc2f 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 _0x6095=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','describe','get','/index','/:id','post','create','put','update','delete','exports','multer','util'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x6095,0x1b6));var _0x5609=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x6095[_0xa148b7];return _0x51efd3;};'use strict';var multer=require(_0x5609('0x0'));var util=require(_0x5609('0x1'));var path=require(_0x5609('0x2'));var timeout=require(_0x5609('0x3'));var express=require(_0x5609('0x4'));var router=express[_0x5609('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5609('0x6'));var interaction=require(_0x5609('0x7'));var config=require(_0x5609('0x8'));var controller=require(_0x5609('0x9'));router['get']('/',auth[_0x5609('0xa')](),controller[_0x5609('0xb')]);router['get']('/describe',auth[_0x5609('0xa')](),controller[_0x5609('0xc')]);router[_0x5609('0xd')](_0x5609('0xe'),auth[_0x5609('0xa')](),controller['getVoiceQueuesReport']);router[_0x5609('0xd')](_0x5609('0xf'),auth[_0x5609('0xa')](),controller['show']);router[_0x5609('0x10')]('/',auth[_0x5609('0xa')](),controller[_0x5609('0x11')]);router[_0x5609('0x12')](_0x5609('0xf'),auth[_0x5609('0xa')](),controller[_0x5609('0x13')]);router[_0x5609('0x14')](_0x5609('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x5609('0x15')]=router; \ No newline at end of file +var _0x7a04=['isAuthenticated','index','/describe','getVoiceQueuesReport','show','post','create','put','/:id','update','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get'];(function(_0x295fa5,_0x294c63){var _0x379b11=function(_0x483005){while(--_0x483005){_0x295fa5['push'](_0x295fa5['shift']());}};_0x379b11(++_0x294c63);}(_0x7a04,0x19a));var _0x47a0=function(_0x49926e,_0x31bf24){_0x49926e=_0x49926e-0x0;var _0xfdbb1f=_0x7a04[_0x49926e];return _0xfdbb1f;};'use strict';var multer=require(_0x47a0('0x0'));var util=require(_0x47a0('0x1'));var path=require(_0x47a0('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a0('0x3'));var router=express[_0x47a0('0x4')]();var fs_extra=require(_0x47a0('0x5'));var auth=require(_0x47a0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x47a0('0x7'));var controller=require(_0x47a0('0x8'));router[_0x47a0('0x9')]('/',auth[_0x47a0('0xa')](),controller[_0x47a0('0xb')]);router['get'](_0x47a0('0xc'),auth['isAuthenticated'](),controller['describe']);router['get']('/index',auth[_0x47a0('0xa')](),controller[_0x47a0('0xd')]);router[_0x47a0('0x9')]('/:id',auth[_0x47a0('0xa')](),controller[_0x47a0('0xe')]);router[_0x47a0('0xf')]('/',auth[_0x47a0('0xa')](),controller[_0x47a0('0x10')]);router[_0x47a0('0x11')](_0x47a0('0x12'),auth['isAuthenticated'](),controller[_0x47a0('0x13')]);router['delete']('/:id',auth[_0x47a0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 66cd4f2..75e6171 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 _0xe6fc=['getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','STRING','DATE'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xe6fc,0xb4));var _0xce6f=function(_0x56c02a,_0x2bd469){_0x56c02a=_0x56c02a-0x0;var _0x4764b6=_0xe6fc[_0x56c02a];return _0x4764b6;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0xce6f('0x0')]},'uniqueid':{'type':Sequelize[_0xce6f('0x0')]},'calleridnum':{'type':Sequelize[_0xce6f('0x0')]},'calleridname':{'type':Sequelize[_0xce6f('0x0')]},'queue':{'type':Sequelize[_0xce6f('0x0')]},'queuecallerjoinAt':{'type':Sequelize[_0xce6f('0x1')]},'queuecallerleaveAt':{'type':Sequelize[_0xce6f('0x1')],'set':function(_0x515aad){var _0x3614ee=moment(_0x515aad);var _0x27faaa=moment(this[_0xce6f('0x2')](_0xce6f('0x3')))['format'](_0xce6f('0x4'));var _0x3b6b42=_0x3614ee['diff'](_0x27faaa,_0xce6f('0x5'));this[_0xce6f('0x6')](_0xce6f('0x7'),_0x515aad);this[_0xce6f('0x6')](_0xce6f('0x8'),_0x3b6b42||null);}},'position':{'type':Sequelize[_0xce6f('0x9')]},'count':{'type':Sequelize[_0xce6f('0x9')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xce6f('0x1')]},'queuecallercomplete':{'type':Sequelize[_0xce6f('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xce6f('0x1')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xce6f('0x1')]},'queuecallerexitreason':{'type':Sequelize[_0xce6f('0x0')],'comment':_0xce6f('0xb')},'originalposition':{'type':Sequelize[_0xce6f('0x9')]},'channel':{'type':Sequelize[_0xce6f('0x0')]},'connectedlinenum':{'type':Sequelize[_0xce6f('0x0')]},'connectedlinename':{'type':Sequelize[_0xce6f('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xce6f('0x0')]},'exten':{'type':Sequelize[_0xce6f('0x0')]},'priority':{'type':Sequelize[_0xce6f('0x0')]},'holdtime':{'type':Sequelize[_0xce6f('0x9')]},'mohtime':{'type':Sequelize[_0xce6f('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xce6f('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xce6f('0x0')]},'transfer':{'type':Sequelize[_0xce6f('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xce6f('0x0')],'comment':_0xce6f('0xc')},'transferexten':{'type':Sequelize[_0xce6f('0x0')]},'transferuniqueid':{'type':Sequelize[_0xce6f('0x0')]},'disposition':{'type':Sequelize[_0xce6f('0x0')]},'secondDisposition':{'type':Sequelize[_0xce6f('0x0')]},'thirdDisposition':{'type':Sequelize[_0xce6f('0x0')]},'queuecallerenterreason':{'type':Sequelize[_0xce6f('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfd1a=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','INTEGER'];(function(_0x2ce0fb,_0xbdd610){var _0x4ba759=function(_0x5091a3){while(--_0x5091a3){_0x2ce0fb['push'](_0x2ce0fb['shift']());}};_0x4ba759(++_0xbdd610);}(_0xfd1a,0x154));var _0xafd1=function(_0x5bd08b,_0x102654){_0x5bd08b=_0x5bd08b-0x0;var _0x17cbb8=_0xfd1a[_0x5bd08b];return _0x17cbb8;};'use strict';var Sequelize=require(_0xafd1('0x0'));var moment=require(_0xafd1('0x1'));module['exports']={'type':{'type':Sequelize[_0xafd1('0x2')]},'uniqueid':{'type':Sequelize[_0xafd1('0x2')]},'calleridnum':{'type':Sequelize[_0xafd1('0x2')]},'calleridname':{'type':Sequelize[_0xafd1('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xafd1('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xafd1('0x3')],'set':function(_0x11a451){var _0x5b6b14=moment(_0x11a451);var _0x260b14=moment(this[_0xafd1('0x4')](_0xafd1('0x5')))[_0xafd1('0x6')](_0xafd1('0x7'));var _0x4c4919=_0x5b6b14[_0xafd1('0x8')](_0x260b14,'seconds');this['setDataValue']('queuecallerleaveAt',_0x11a451);this[_0xafd1('0x9')]('holdtime',_0x4c4919||null);}},'position':{'type':Sequelize[_0xafd1('0xa')]},'count':{'type':Sequelize[_0xafd1('0xa')]},'queuecallerabandon':{'type':Sequelize[_0xafd1('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xafd1('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xafd1('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xafd1('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xafd1('0xa')]},'channel':{'type':Sequelize[_0xafd1('0x2')]},'connectedlinenum':{'type':Sequelize[_0xafd1('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xafd1('0x2')]},'context':{'type':Sequelize[_0xafd1('0x2')]},'exten':{'type':Sequelize[_0xafd1('0x2')]},'priority':{'type':Sequelize[_0xafd1('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xafd1('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xafd1('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xafd1('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xafd1('0x2')],'comment':_0xafd1('0xc')},'transferexten':{'type':Sequelize[_0xafd1('0x2')]},'transferuniqueid':{'type':Sequelize[_0xafd1('0x2')]},'disposition':{'type':Sequelize[_0xafd1('0x2')]},'secondDisposition':{'type':Sequelize[_0xafd1('0x2')]},'thirdDisposition':{'type':Sequelize[_0xafd1('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xafd1('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index efc77f7..075e07e 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 _0x205e=['type','key','query','keys','filters','intersection','attributes','model','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','options','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','describe','getVoiceQueuesReport','rawAttributes','hasOwnProperty','filter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./voiceQueueReport.socket','register','status','undefined','limit','count','offset','set','json','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','fieldName'];(function(_0x4c8cbb,_0x398c22){var _0x12e702=function(_0x58c90e){while(--_0x58c90e){_0x4c8cbb['push'](_0x4c8cbb['shift']());}};_0x12e702(++_0x398c22);}(_0x205e,0x75));var _0xe205=function(_0x404975,_0x234854){_0x404975=_0x404975-0x0;var _0x1191ea=_0x205e[_0x404975];return _0x1191ea;};'use strict';var emlformat=require(_0xe205('0x0'));var rimraf=require(_0xe205('0x1'));var zipdir=require(_0xe205('0x2'));var jsonpatch=require(_0xe205('0x3'));var rp=require(_0xe205('0x4'));var moment=require(_0xe205('0x5'));var BPromise=require(_0xe205('0x6'));var Mustache=require('mustache');var util=require(_0xe205('0x7'));var path=require(_0xe205('0x8'));var sox=require(_0xe205('0x9'));var csv=require(_0xe205('0xa'));var ejs=require(_0xe205('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe205('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe205('0xd'));var deskjs=require(_0xe205('0xe'));var toCsv=require(_0xe205('0xa'));var querystring=require(_0xe205('0xf'));var Papa=require('papaparse');var Redis=require(_0xe205('0x10'));var authService=require(_0xe205('0x11'));var qs=require(_0xe205('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe205('0x13'));var logger=require(_0xe205('0x14'))(_0xe205('0x15'));var utils=require(_0xe205('0x16'));var config=require(_0xe205('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe205('0x18'))['db'];config[_0xe205('0x19')]=_['defaults'](config[_0xe205('0x19')],{'host':_0xe205('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe205('0x1b'))[_0xe205('0x1c')](socket);function respondWithStatusCode(_0x496a6b,_0x49711d){_0x49711d=_0x49711d||0xcc;return function(_0x2bc477){if(_0x2bc477){return _0x496a6b['sendStatus'](_0x49711d);}return _0x496a6b[_0xe205('0x1d')](_0x49711d)['end']();};}function respondWithResult(_0x16c0ce,_0x54a4c1){_0x54a4c1=_0x54a4c1||0xc8;return function(_0x122e43){if(_0x122e43){return _0x16c0ce[_0xe205('0x1d')](_0x54a4c1)['json'](_0x122e43);}};}function respondWithFilteredResult(_0x5a2260,_0x2e294d){return function(_0x6f447c){if(_0x6f447c){var _0x32f6f3=typeof _0x2e294d['offset']===_0xe205('0x1e')&&typeof _0x2e294d[_0xe205('0x1f')]==='undefined';var _0x3136de=_0x6f447c[_0xe205('0x20')];var _0xcf0ad5=_0x32f6f3?0x0:_0x2e294d[_0xe205('0x21')];var _0x454c07=_0x32f6f3?_0x6f447c[_0xe205('0x20')]:_0x2e294d['offset']+_0x2e294d['limit'];var _0x3041c4;if(_0x454c07>=_0x3136de){_0x454c07=_0x3136de;_0x3041c4=0xc8;}else{_0x3041c4=0xce;}_0x5a2260[_0xe205('0x1d')](_0x3041c4);return _0x5a2260[_0xe205('0x22')]('Content-Range',_0xcf0ad5+'-'+_0x454c07+'/'+_0x3136de)[_0xe205('0x23')](_0x6f447c);}return null;};}function patchUpdates(_0x6d55a7){return function(_0x33b6f7){try{jsonpatch['apply'](_0x33b6f7,_0x6d55a7,!![]);}catch(_0x2b544f){return BPromise[_0xe205('0x24')](_0x2b544f);}return _0x33b6f7[_0xe205('0x25')]();};}function saveUpdates(_0xdf79f,_0xa776bc){return function(_0x2ade93){if(_0x2ade93){return _0x2ade93[_0xe205('0x26')](_0xdf79f)[_0xe205('0x27')](function(_0x6e7717){return _0x6e7717;});}return null;};}function removeEntity(_0x31903d,_0x6ff539){return function(_0x15db22){if(_0x15db22){return _0x15db22[_0xe205('0x28')]()[_0xe205('0x27')](function(){_0x31903d[_0xe205('0x1d')](0xcc)[_0xe205('0x29')]();});}};}function handleEntityNotFound(_0xa4e445,_0x541bd2){return function(_0x57ac88){if(!_0x57ac88){_0xa4e445[_0xe205('0x2a')](0x194);}return _0x57ac88;};}function handleError(_0x30d8c3,_0x1b3a0e){_0x1b3a0e=_0x1b3a0e||0x1f4;return function(_0x43ef50){logger[_0xe205('0x2b')](_0x43ef50[_0xe205('0x2c')]);if(_0x43ef50[_0xe205('0x2d')]){delete _0x43ef50['name'];}_0x30d8c3[_0xe205('0x1d')](_0x1b3a0e)['send'](_0x43ef50);};}exports[_0xe205('0x2e')]=function(_0x4bae1b,_0x2003b4){var _0x3436be={},_0xd2d3ec={},_0x49e521={'count':0x0,'rows':[]};var _0x30a2a3=_[_0xe205('0x2f')](db['VoiceQueueReport']['rawAttributes'],function(_0x2d2a7b){return{'name':_0x2d2a7b[_0xe205('0x30')],'type':_0x2d2a7b[_0xe205('0x31')][_0xe205('0x32')]};});_0xd2d3ec['model']=_[_0xe205('0x2f')](_0x30a2a3,_0xe205('0x2d'));_0xd2d3ec[_0xe205('0x33')]=_[_0xe205('0x34')](_0x4bae1b[_0xe205('0x33')]);_0xd2d3ec[_0xe205('0x35')]=_[_0xe205('0x36')](_0xd2d3ec['model'],_0xd2d3ec[_0xe205('0x33')]);_0x3436be[_0xe205('0x37')]=_[_0xe205('0x36')](_0xd2d3ec[_0xe205('0x38')],qs['fields'](_0x4bae1b['query'][_0xe205('0x39')]));_0x3436be[_0xe205('0x37')]=_0x3436be[_0xe205('0x37')]['length']?_0x3436be[_0xe205('0x37')]:_0xd2d3ec[_0xe205('0x38')];if(!_0x4bae1b[_0xe205('0x33')]['hasOwnProperty'](_0xe205('0x3a'))){_0x3436be[_0xe205('0x1f')]=qs[_0xe205('0x1f')](_0x4bae1b['query'][_0xe205('0x1f')]);_0x3436be[_0xe205('0x21')]=qs['offset'](_0x4bae1b[_0xe205('0x33')]['offset']);}_0x3436be[_0xe205('0x3b')]=qs[_0xe205('0x3c')](_0x4bae1b['query'][_0xe205('0x3c')]);_0x3436be[_0xe205('0x3d')]=qs[_0xe205('0x35')](_[_0xe205('0x3e')](_0x4bae1b[_0xe205('0x33')],_0xd2d3ec[_0xe205('0x35')]),_0x30a2a3);if(_0x4bae1b['query']['filter']){_0x3436be[_0xe205('0x3d')]=_[_0xe205('0x3f')](_0x3436be[_0xe205('0x3d')],{'$or':_[_0xe205('0x2f')](_0x30a2a3,function(_0x11f08d){if(_0x11f08d['type']!==_0xe205('0x40')){var _0x2abbe6={};_0x2abbe6[_0x11f08d['name']]={'$like':'%'+_0x4bae1b[_0xe205('0x33')]['filter']+'%'};return _0x2abbe6;}})});}_0x3436be=_[_0xe205('0x3f')]({},_0x3436be,_0x4bae1b[_0xe205('0x41')]);var _0x2cc39a={'where':_0x3436be['where']};return db[_0xe205('0x42')][_0xe205('0x20')](_0x2cc39a)[_0xe205('0x27')](function(_0x2e5186){_0x49e521[_0xe205('0x20')]=_0x2e5186;if(_0x4bae1b['query'][_0xe205('0x43')]){_0x3436be[_0xe205('0x44')]=[{'all':!![]}];}return db[_0xe205('0x42')][_0xe205('0x45')](_0x3436be);})['then'](function(_0x2038b2){_0x49e521[_0xe205('0x46')]=_0x2038b2;return _0x49e521;})[_0xe205('0x27')](respondWithFilteredResult(_0x2003b4,_0x3436be))[_0xe205('0x47')](handleError(_0x2003b4,null));};exports[_0xe205('0x48')]=function(_0x29d780,_0x379781){var _0x3611={'raw':![],'where':{'id':_0x29d780[_0xe205('0x49')]['id']}},_0x2ea9d4={};_0x2ea9d4[_0xe205('0x38')]=_[_0xe205('0x34')](db[_0xe205('0x42')]['rawAttributes']);_0x2ea9d4[_0xe205('0x33')]=_['keys'](_0x29d780[_0xe205('0x33')]);_0x2ea9d4[_0xe205('0x35')]=_[_0xe205('0x36')](_0x2ea9d4[_0xe205('0x38')],_0x2ea9d4['query']);_0x3611['attributes']=_[_0xe205('0x36')](_0x2ea9d4[_0xe205('0x38')],qs[_0xe205('0x39')](_0x29d780[_0xe205('0x33')][_0xe205('0x39')]));_0x3611[_0xe205('0x37')]=_0x3611[_0xe205('0x37')][_0xe205('0x4a')]?_0x3611[_0xe205('0x37')]:_0x2ea9d4[_0xe205('0x38')];if(_0x29d780[_0xe205('0x33')][_0xe205('0x43')]){_0x3611[_0xe205('0x44')]=[{'all':!![]}];}_0x3611=_[_0xe205('0x3f')]({},_0x3611,_0x29d780['options']);return db[_0xe205('0x42')]['find'](_0x3611)['then'](handleEntityNotFound(_0x379781,null))[_0xe205('0x27')](respondWithResult(_0x379781,null))[_0xe205('0x47')](handleError(_0x379781,null));};exports[_0xe205('0x4b')]=function(_0x685f89,_0x1c37bd){return db['VoiceQueueReport'][_0xe205('0x4b')](_0x685f89['body'],{})[_0xe205('0x27')](respondWithResult(_0x1c37bd,0xc9))[_0xe205('0x47')](handleError(_0x1c37bd,null));};exports[_0xe205('0x26')]=function(_0x57951f,_0x384056){if(_0x57951f[_0xe205('0x4c')]['id']){delete _0x57951f['body']['id'];}return db[_0xe205('0x42')][_0xe205('0x4d')]({'where':{'id':_0x57951f[_0xe205('0x49')]['id']}})[_0xe205('0x27')](handleEntityNotFound(_0x384056,null))[_0xe205('0x27')](saveUpdates(_0x57951f[_0xe205('0x4c')],null))[_0xe205('0x27')](respondWithResult(_0x384056,null))[_0xe205('0x47')](handleError(_0x384056,null));};exports[_0xe205('0x28')]=function(_0x479e0d,_0x29259f){return db[_0xe205('0x42')][_0xe205('0x4d')]({'where':{'id':_0x479e0d[_0xe205('0x49')]['id']}})[_0xe205('0x27')](handleEntityNotFound(_0x29259f,null))[_0xe205('0x27')](removeEntity(_0x29259f,null))[_0xe205('0x47')](handleError(_0x29259f,null));};exports[_0xe205('0x4e')]=function(_0x47f21a,_0x269909){return db[_0xe205('0x42')]['describe']()[_0xe205('0x27')](respondWithResult(_0x269909,null))[_0xe205('0x47')](handleError(_0x269909,null));};exports[_0xe205('0x4f')]=function(_0x7bf23f,_0x44a772){var _0x2f5318={},_0x2a03ed={},_0xd942a4={'count':0x0,'rows':[]};_0x2a03ed[_0xe205('0x38')]=_['keys'](db[_0xe205('0x42')][_0xe205('0x50')]);_0x2a03ed[_0xe205('0x33')]=_[_0xe205('0x34')](_0x7bf23f[_0xe205('0x33')]);_0x2a03ed[_0xe205('0x35')]=_[_0xe205('0x36')](_0x2a03ed[_0xe205('0x38')],_0x2a03ed['query']);_0x2f5318[_0xe205('0x37')]=_[_0xe205('0x36')](_0x2a03ed[_0xe205('0x38')],qs[_0xe205('0x39')](_0x7bf23f[_0xe205('0x33')][_0xe205('0x39')]));_0x2f5318[_0xe205('0x37')]=_0x2f5318[_0xe205('0x37')][_0xe205('0x4a')]?_0x2f5318[_0xe205('0x37')]:_0x2a03ed[_0xe205('0x38')];if(!_0x7bf23f[_0xe205('0x33')][_0xe205('0x51')](_0xe205('0x3a'))){_0x2f5318[_0xe205('0x1f')]=qs[_0xe205('0x1f')](_0x7bf23f[_0xe205('0x33')][_0xe205('0x1f')]);_0x2f5318[_0xe205('0x21')]=qs['offset'](_0x7bf23f[_0xe205('0x33')][_0xe205('0x21')]);}_0x2f5318[_0xe205('0x3b')]=qs[_0xe205('0x3c')](_0x7bf23f[_0xe205('0x33')][_0xe205('0x3c')]);_0x2f5318['where']=qs[_0xe205('0x35')](_[_0xe205('0x3e')](_0x7bf23f[_0xe205('0x33')],_0x2a03ed['filters']));if(_0x7bf23f['query'][_0xe205('0x52')]){_0x2f5318[_0xe205('0x3d')]=_[_0xe205('0x3f')](_0x2f5318[_0xe205('0x3d')],{'$or':_[_0xe205('0x2f')](_0x2f5318[_0xe205('0x37')],function(_0x320cb1){var _0x2aa040={};_0x2aa040[_0x320cb1]={'$like':'%'+_0x7bf23f[_0xe205('0x33')][_0xe205('0x52')]+'%'};return _0x2aa040;})});}_0x2f5318=_['merge']({},_0x2f5318,_0x7bf23f[_0xe205('0x41')]);var _0x3febc7={'where':_0x2f5318[_0xe205('0x3d')]};return db[_0xe205('0x42')][_0xe205('0x20')](_0x3febc7)[_0xe205('0x27')](function(_0x4ab34e){_0xd942a4['count']=_0x4ab34e;if(_0x7bf23f[_0xe205('0x33')][_0xe205('0x43')]){_0x2f5318['include']=[{'all':!![]}];}return db[_0xe205('0x42')][_0xe205('0x45')](_0x2f5318);})['then'](function(_0x36fc63){_0xd942a4[_0xe205('0x46')]=_0x36fc63;return _0xd942a4;})[_0xe205('0x27')](respondWithFilteredResult(_0x44a772,_0x2f5318,_0xe205('0x4f')))[_0xe205('0x47')](handleError(_0x44a772,null,_0xe205('0x4f')));}; \ No newline at end of file +var _0xd88e=['nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','pick','getVoiceQueuesReport','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','VoiceQueueReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0xef0ce4,_0x5c2cba){var _0x4193c3=function(_0x3aebe9){while(--_0x3aebe9){_0xef0ce4['push'](_0xef0ce4['shift']());}};_0x4193c3(++_0x5c2cba);}(_0xd88e,0x142));var _0xed88=function(_0x31a2d9,_0x376434){_0x31a2d9=_0x31a2d9-0x0;var _0x15287d=_0xd88e[_0x31a2d9];return _0x15287d;};'use strict';var emlformat=require(_0xed88('0x0'));var rimraf=require(_0xed88('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed88('0x2'));var rp=require(_0xed88('0x3'));var moment=require(_0xed88('0x4'));var BPromise=require(_0xed88('0x5'));var Mustache=require(_0xed88('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xed88('0x7'));var fs=require('fs');var fs_extra=require(_0xed88('0x8'));var _=require(_0xed88('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xed88('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xed88('0xb'));var querystring=require(_0xed88('0xc'));var Papa=require(_0xed88('0xd'));var Redis=require(_0xed88('0xe'));var authService=require(_0xed88('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xed88('0x10'))('api');var utils=require(_0xed88('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xed88('0x12'))['db'];config[_0xed88('0x13')]=_[_0xed88('0x14')](config[_0xed88('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0xed88('0x15'))(new Redis(config[_0xed88('0x13')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x48da51,_0x22ac68){_0x22ac68=_0x22ac68||0xcc;return function(_0x44eadc){if(_0x44eadc){return _0x48da51[_0xed88('0x16')](_0x22ac68);}return _0x48da51[_0xed88('0x17')](_0x22ac68)[_0xed88('0x18')]();};}function respondWithResult(_0x2f52dc,_0x540582){_0x540582=_0x540582||0xc8;return function(_0x4e00a8){if(_0x4e00a8){return _0x2f52dc[_0xed88('0x17')](_0x540582)[_0xed88('0x19')](_0x4e00a8);}};}function respondWithFilteredResult(_0x25de1f,_0x206987){return function(_0x204737){if(_0x204737){var _0x1d3da1=typeof _0x206987[_0xed88('0x1a')]===_0xed88('0x1b')&&typeof _0x206987[_0xed88('0x1c')]===_0xed88('0x1b');var _0x9babc0=_0x204737[_0xed88('0x1d')];var _0x1ed48d=_0x1d3da1?0x0:_0x206987[_0xed88('0x1a')];var _0x7f2fc9=_0x1d3da1?_0x204737['count']:_0x206987[_0xed88('0x1a')]+_0x206987[_0xed88('0x1c')];var _0x55a975;if(_0x7f2fc9>=_0x9babc0){_0x7f2fc9=_0x9babc0;_0x55a975=0xc8;}else{_0x55a975=0xce;}_0x25de1f[_0xed88('0x17')](_0x55a975);return _0x25de1f['set'](_0xed88('0x1e'),_0x1ed48d+'-'+_0x7f2fc9+'/'+_0x9babc0)[_0xed88('0x19')](_0x204737);}return null;};}function patchUpdates(_0x3a2ddf){return function(_0x2c9140){try{jsonpatch[_0xed88('0x1f')](_0x2c9140,_0x3a2ddf,!![]);}catch(_0x334406){return BPromise['reject'](_0x334406);}return _0x2c9140[_0xed88('0x20')]();};}function saveUpdates(_0x2bb07d,_0x5caffd){return function(_0x8c4f31){if(_0x8c4f31){return _0x8c4f31[_0xed88('0x21')](_0x2bb07d)[_0xed88('0x22')](function(_0x2d22ec){return _0x2d22ec;});}return null;};}function removeEntity(_0x33087a,_0x56d7a7){return function(_0x3b5872){if(_0x3b5872){return _0x3b5872[_0xed88('0x23')]()[_0xed88('0x22')](function(){_0x33087a[_0xed88('0x17')](0xcc)[_0xed88('0x18')]();});}};}function handleEntityNotFound(_0x24639d,_0x37a9f0){return function(_0x279de0){if(!_0x279de0){_0x24639d[_0xed88('0x16')](0x194);}return _0x279de0;};}function handleError(_0x18063c,_0x4d5a50){_0x4d5a50=_0x4d5a50||0x1f4;return function(_0x335598){logger[_0xed88('0x24')](_0x335598[_0xed88('0x25')]);if(_0x335598[_0xed88('0x26')]){delete _0x335598[_0xed88('0x26')];}_0x18063c[_0xed88('0x17')](_0x4d5a50)[_0xed88('0x27')](_0x335598);};}exports['index']=function(_0x4c6929,_0x5d9c9f){var _0x5f50d5={},_0x491cae={},_0x50bfa0={'count':0x0,'rows':[]};var _0x55d7de=_[_0xed88('0x28')](db[_0xed88('0x29')]['rawAttributes'],function(_0x2c04a0){return{'name':_0x2c04a0[_0xed88('0x2a')],'type':_0x2c04a0[_0xed88('0x2b')][_0xed88('0x2c')]};});_0x491cae[_0xed88('0x2d')]=_[_0xed88('0x28')](_0x55d7de,_0xed88('0x26'));_0x491cae[_0xed88('0x2e')]=_['keys'](_0x4c6929[_0xed88('0x2e')]);_0x491cae[_0xed88('0x2f')]=_[_0xed88('0x30')](_0x491cae[_0xed88('0x2d')],_0x491cae[_0xed88('0x2e')]);_0x5f50d5[_0xed88('0x31')]=_['intersection'](_0x491cae[_0xed88('0x2d')],qs[_0xed88('0x32')](_0x4c6929[_0xed88('0x2e')]['fields']));_0x5f50d5[_0xed88('0x31')]=_0x5f50d5['attributes'][_0xed88('0x33')]?_0x5f50d5[_0xed88('0x31')]:_0x491cae[_0xed88('0x2d')];if(!_0x4c6929[_0xed88('0x2e')][_0xed88('0x34')](_0xed88('0x35'))){_0x5f50d5[_0xed88('0x1c')]=qs[_0xed88('0x1c')](_0x4c6929[_0xed88('0x2e')]['limit']);_0x5f50d5[_0xed88('0x1a')]=qs['offset'](_0x4c6929[_0xed88('0x2e')][_0xed88('0x1a')]);}_0x5f50d5[_0xed88('0x36')]=qs[_0xed88('0x37')](_0x4c6929[_0xed88('0x2e')][_0xed88('0x37')]);_0x5f50d5[_0xed88('0x38')]=qs[_0xed88('0x2f')](_['pick'](_0x4c6929[_0xed88('0x2e')],_0x491cae['filters']),_0x55d7de);if(_0x4c6929[_0xed88('0x2e')][_0xed88('0x39')]){_0x5f50d5[_0xed88('0x38')]=_[_0xed88('0x3a')](_0x5f50d5['where'],{'$or':_[_0xed88('0x28')](_0x55d7de,function(_0x20b7cc){if(_0x20b7cc['type']!==_0xed88('0x3b')){var _0x102f22={};_0x102f22[_0x20b7cc[_0xed88('0x26')]]={'$like':'%'+_0x4c6929[_0xed88('0x2e')][_0xed88('0x39')]+'%'};return _0x102f22;}})});}_0x5f50d5=_[_0xed88('0x3a')]({},_0x5f50d5,_0x4c6929[_0xed88('0x3c')]);var _0x1a859a={'where':_0x5f50d5[_0xed88('0x38')]};return db[_0xed88('0x29')]['count'](_0x1a859a)[_0xed88('0x22')](function(_0x226bee){_0x50bfa0['count']=_0x226bee;if(_0x4c6929[_0xed88('0x2e')][_0xed88('0x3d')]){_0x5f50d5[_0xed88('0x3e')]=[{'all':!![]}];}return db[_0xed88('0x29')][_0xed88('0x3f')](_0x5f50d5);})[_0xed88('0x22')](function(_0x22d7fb){_0x50bfa0[_0xed88('0x40')]=_0x22d7fb;return _0x50bfa0;})['then'](respondWithFilteredResult(_0x5d9c9f,_0x5f50d5))[_0xed88('0x41')](handleError(_0x5d9c9f,null));};exports[_0xed88('0x42')]=function(_0x192537,_0x348b8e){var _0x3c3ef1={'raw':![],'where':{'id':_0x192537[_0xed88('0x43')]['id']}},_0x13f6e4={};_0x13f6e4[_0xed88('0x2d')]=_[_0xed88('0x44')](db[_0xed88('0x29')][_0xed88('0x45')]);_0x13f6e4[_0xed88('0x2e')]=_[_0xed88('0x44')](_0x192537[_0xed88('0x2e')]);_0x13f6e4[_0xed88('0x2f')]=_['intersection'](_0x13f6e4[_0xed88('0x2d')],_0x13f6e4[_0xed88('0x2e')]);_0x3c3ef1[_0xed88('0x31')]=_[_0xed88('0x30')](_0x13f6e4[_0xed88('0x2d')],qs['fields'](_0x192537[_0xed88('0x2e')][_0xed88('0x32')]));_0x3c3ef1[_0xed88('0x31')]=_0x3c3ef1[_0xed88('0x31')][_0xed88('0x33')]?_0x3c3ef1[_0xed88('0x31')]:_0x13f6e4[_0xed88('0x2d')];if(_0x192537[_0xed88('0x2e')]['includeAll']){_0x3c3ef1[_0xed88('0x3e')]=[{'all':!![]}];}_0x3c3ef1=_[_0xed88('0x3a')]({},_0x3c3ef1,_0x192537[_0xed88('0x3c')]);return db[_0xed88('0x29')][_0xed88('0x46')](_0x3c3ef1)[_0xed88('0x22')](handleEntityNotFound(_0x348b8e,null))[_0xed88('0x22')](respondWithResult(_0x348b8e,null))[_0xed88('0x41')](handleError(_0x348b8e,null));};exports[_0xed88('0x47')]=function(_0x2eebfc,_0xd3fc78){return db['VoiceQueueReport'][_0xed88('0x47')](_0x2eebfc[_0xed88('0x48')],{})[_0xed88('0x22')](respondWithResult(_0xd3fc78,0xc9))[_0xed88('0x41')](handleError(_0xd3fc78,null));};exports[_0xed88('0x21')]=function(_0x50e020,_0x28a282){if(_0x50e020[_0xed88('0x48')]['id']){delete _0x50e020['body']['id'];}return db[_0xed88('0x29')][_0xed88('0x46')]({'where':{'id':_0x50e020[_0xed88('0x43')]['id']}})[_0xed88('0x22')](handleEntityNotFound(_0x28a282,null))[_0xed88('0x22')](saveUpdates(_0x50e020['body'],null))[_0xed88('0x22')](respondWithResult(_0x28a282,null))['catch'](handleError(_0x28a282,null));};exports['destroy']=function(_0x2c965f,_0x7e9f60){return db['VoiceQueueReport'][_0xed88('0x46')]({'where':{'id':_0x2c965f[_0xed88('0x43')]['id']}})[_0xed88('0x22')](handleEntityNotFound(_0x7e9f60,null))[_0xed88('0x22')](removeEntity(_0x7e9f60,null))['catch'](handleError(_0x7e9f60,null));};exports['describe']=function(_0x5295c8,_0x42e0d1){return db[_0xed88('0x29')]['describe']()['then'](respondWithResult(_0x42e0d1,null))[_0xed88('0x41')](handleError(_0x42e0d1,null));};exports['getVoiceQueuesReport']=function(_0x503661,_0x7a17f3){var _0x4cfe05={},_0x31745a={},_0x5dbd3c={'count':0x0,'rows':[]};_0x31745a[_0xed88('0x2d')]=_[_0xed88('0x44')](db[_0xed88('0x29')]['rawAttributes']);_0x31745a[_0xed88('0x2e')]=_[_0xed88('0x44')](_0x503661['query']);_0x31745a[_0xed88('0x2f')]=_['intersection'](_0x31745a[_0xed88('0x2d')],_0x31745a[_0xed88('0x2e')]);_0x4cfe05[_0xed88('0x31')]=_['intersection'](_0x31745a[_0xed88('0x2d')],qs[_0xed88('0x32')](_0x503661[_0xed88('0x2e')][_0xed88('0x32')]));_0x4cfe05[_0xed88('0x31')]=_0x4cfe05[_0xed88('0x31')][_0xed88('0x33')]?_0x4cfe05['attributes']:_0x31745a['model'];if(!_0x503661[_0xed88('0x2e')][_0xed88('0x34')]('nolimit')){_0x4cfe05[_0xed88('0x1c')]=qs[_0xed88('0x1c')](_0x503661[_0xed88('0x2e')][_0xed88('0x1c')]);_0x4cfe05[_0xed88('0x1a')]=qs['offset'](_0x503661[_0xed88('0x2e')]['offset']);}_0x4cfe05[_0xed88('0x36')]=qs[_0xed88('0x37')](_0x503661[_0xed88('0x2e')][_0xed88('0x37')]);_0x4cfe05[_0xed88('0x38')]=qs['filters'](_[_0xed88('0x49')](_0x503661[_0xed88('0x2e')],_0x31745a[_0xed88('0x2f')]));if(_0x503661['query'][_0xed88('0x39')]){_0x4cfe05[_0xed88('0x38')]=_[_0xed88('0x3a')](_0x4cfe05[_0xed88('0x38')],{'$or':_[_0xed88('0x28')](_0x4cfe05['attributes'],function(_0x3eb392){var _0xaa6d1b={};_0xaa6d1b[_0x3eb392]={'$like':'%'+_0x503661[_0xed88('0x2e')][_0xed88('0x39')]+'%'};return _0xaa6d1b;})});}_0x4cfe05=_[_0xed88('0x3a')]({},_0x4cfe05,_0x503661['options']);var _0x57fe58={'where':_0x4cfe05[_0xed88('0x38')]};return db['VoiceQueueReport'][_0xed88('0x1d')](_0x57fe58)[_0xed88('0x22')](function(_0x550709){_0x5dbd3c[_0xed88('0x1d')]=_0x550709;if(_0x503661[_0xed88('0x2e')]['includeAll']){_0x4cfe05['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0xed88('0x3f')](_0x4cfe05);})[_0xed88('0x22')](function(_0x27a624){_0x5dbd3c[_0xed88('0x40')]=_0x27a624;return _0x5dbd3c;})[_0xed88('0x22')](respondWithFilteredResult(_0x7a17f3,_0x4cfe05,_0xed88('0x4a')))[_0xed88('0x41')](handleError(_0x7a17f3,null,_0xed88('0x4a')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index c3850d0..2fe3729 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 _0xecb4=['VoiceQueueReport','save','update','emit','hook','exports','../../mysqldb'];(function(_0x107f10,_0x5529f2){var _0x811cab=function(_0xc160ea){while(--_0xc160ea){_0x107f10['push'](_0x107f10['shift']());}};_0x811cab(++_0x5529f2);}(_0xecb4,0x14f));var _0x4ecb=function(_0x804dc,_0x39477d){_0x804dc=_0x804dc-0x0;var _0x3c3b90=_0xecb4[_0x804dc];return _0x3c3b90;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x4ecb('0x0'))['db'][_0x4ecb('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4ecb('0x2'),'afterUpdate':_0x4ecb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x54d3eb){return function(_0xf9d5a1,_0x12bdcd,_0x558fe2){VoiceQueueReportEvents['emit'](_0x54d3eb+':'+_0xf9d5a1['id'],_0xf9d5a1);VoiceQueueReportEvents[_0x4ecb('0x4')](_0x54d3eb,_0xf9d5a1);_0x558fe2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x4ecb('0x5')](e,emitEvent(event));}}module[_0x4ecb('0x6')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xff65=['VoiceQueueReport','setMaxListeners','update','remove','hasOwnProperty','hook','exports','events'];(function(_0x3917b6,_0x5b2cfe){var _0x1625d6=function(_0x5b000c){while(--_0x5b000c){_0x3917b6['push'](_0x3917b6['shift']());}};_0x1625d6(++_0x5b2cfe);}(_0xff65,0x1d7));var _0x5ff6=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0xff65[_0x220f3f];return _0x1f170e;};'use strict';var EventEmitter=require(_0x5ff6('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x5ff6('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x5ff6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5ff6('0x3'),'afterDestroy':_0x5ff6('0x4')};function emitEvent(_0x367392){return function(_0x1aa2d0,_0x1d39a6,_0x45b6f4){VoiceQueueReportEvents['emit'](_0x367392+':'+_0x1aa2d0['id'],_0x1aa2d0);VoiceQueueReportEvents['emit'](_0x367392,_0x1aa2d0);_0x45b6f4(null);};}for(var e in events){if(events[_0x5ff6('0x5')](e)){var event=events[e];VoiceQueueReport[_0x5ff6('0x6')](e,emitEvent(event));}}module[_0x5ff6('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 05c13db..bb50fdd 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 _0xb9a5=['../../config/environment','./voiceQueueReport.attributes','define','report_queue','uniqueid','calleridnum','lodash','../../config/logger','api','bluebird','path','rimraf'];(function(_0x33d9ca,_0x4111f4){var _0x2b0088=function(_0x18a102){while(--_0x18a102){_0x33d9ca['push'](_0x33d9ca['shift']());}};_0x2b0088(++_0x4111f4);}(_0xb9a5,0x186));var _0x5b9a=function(_0x256973,_0x3cdbd4){_0x256973=_0x256973-0x0;var _0x4bf1d8=_0xb9a5[_0x256973];return _0x4bf1d8;};'use strict';var _=require(_0x5b9a('0x0'));var util=require('util');var logger=require(_0x5b9a('0x1'))(_0x5b9a('0x2'));var moment=require('moment');var BPromise=require(_0x5b9a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b9a('0x4'));var rimraf=require(_0x5b9a('0x5'));var config=require(_0x5b9a('0x6'));var attributes=require(_0x5b9a('0x7'));module['exports']=function(_0x42abe2,_0x188e30){return _0x42abe2[_0x5b9a('0x8')]('VoiceQueueReport',attributes,{'tableName':_0x5b9a('0x9'),'paranoid':![],'indexes':[{'fields':[_0x5b9a('0xa')]},{'fields':[_0x5b9a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x402e=['bluebird','path','rimraf','../../config/environment','./voiceQueueReport.attributes','define','report_queue','calleridnum','lodash','util','../../config/logger','api','moment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x402e,0x1b5));var _0xe402=function(_0x7148a3,_0x1c6652){_0x7148a3=_0x7148a3-0x0;var _0x52f31d=_0x402e[_0x7148a3];return _0x52f31d;};'use strict';var _=require(_0xe402('0x0'));var util=require(_0xe402('0x1'));var logger=require(_0xe402('0x2'))(_0xe402('0x3'));var moment=require(_0xe402('0x4'));var BPromise=require(_0xe402('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe402('0x6'));var rimraf=require(_0xe402('0x7'));var config=require(_0xe402('0x8'));var attributes=require(_0xe402('0x9'));module['exports']=function(_0x450235,_0x18ef85){return _0x450235[_0xe402('0xa')]('VoiceQueueReport',attributes,{'tableName':_0xe402('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xe402('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 82ea6da..48d6344 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 _0x5363=['register','request','then','info','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceQueueReport,\x20%s,\x20%s','message','findAll','options','attributes','limit','include','map','model','GetVoiceQueueReport','debug','stringify','catch','CreateVoiceQueueReport','raw','UpdateVoiceQueueReport','VoiceQueueReport','update','body','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket'];(function(_0x380dce,_0x488b26){var _0x254628=function(_0xad8ea8){while(--_0xad8ea8){_0x380dce['push'](_0x380dce['shift']());}};_0x254628(++_0x488b26);}(_0x5363,0x149));var _0x3536=function(_0x21fe0f,_0x120417){_0x21fe0f=_0x21fe0f-0x0;var _0x58ad7a=_0x5363[_0x21fe0f];return _0x58ad7a;};'use strict';var _=require(_0x3536('0x0'));var util=require('util');var moment=require(_0x3536('0x1'));var BPromise=require(_0x3536('0x2'));var rs=require(_0x3536('0x3'));var fs=require('fs');var Redis=require(_0x3536('0x4'));var db=require(_0x3536('0x5'))['db'];var utils=require(_0x3536('0x6'));var logger=require('../../config/logger')(_0x3536('0x7'));var config=require(_0x3536('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3536('0x9')]({'port':0x232a});config['redis']=_[_0x3536('0xa')](config[_0x3536('0xb')],{'host':_0x3536('0xc'),'port':0x18eb});var socket=require(_0x3536('0xd'))(new Redis(config[_0x3536('0xb')]));require(_0x3536('0xe'))[_0x3536('0xf')](socket);function respondWithRpcPromise(_0x1afcee,_0x27600b,_0x214e70){return new BPromise(function(_0xf64144,_0x24f2b6){return client[_0x3536('0x10')](_0x1afcee,_0x214e70)[_0x3536('0x11')](function(_0xb4ce91){logger[_0x3536('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x27600b,'request\x20sent');logger['debug'](_0x3536('0x13'),_0x27600b,_0x3536('0x14'),JSON['stringify'](_0xb4ce91));if(_0xb4ce91[_0x3536('0x15')]){if(_0xb4ce91['error'][_0x3536('0x16')]===0x1f4){logger['error'](_0x3536('0x17'),_0x27600b,_0xb4ce91[_0x3536('0x15')][_0x3536('0x18')]);return _0x24f2b6(_0xb4ce91[_0x3536('0x15')][_0x3536('0x18')]);}logger[_0x3536('0x15')](_0x3536('0x17'),_0x27600b,_0xb4ce91[_0x3536('0x15')][_0x3536('0x18')]);return _0xf64144(_0xb4ce91['error'][_0x3536('0x18')]);}else{logger[_0x3536('0x12')](_0x3536('0x17'),_0x27600b,_0x3536('0x14'));_0xf64144(_0xb4ce91['result'][_0x3536('0x18')]);}})['catch'](function(_0x3dde85){logger[_0x3536('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x27600b,_0x3dde85);_0x24f2b6(_0x3dde85);});});}exports['GetVoiceQueueReport']=function(_0x411a8f){var _0x2a7a28=this;return new Promise(function(_0x9bc5ae,_0x292390){return db['VoiceQueueReport'][_0x3536('0x19')]({'raw':_0x411a8f[_0x3536('0x1a')]?_0x411a8f['options']['raw']===undefined?!![]:![]:!![],'where':_0x411a8f[_0x3536('0x1a')]?_0x411a8f[_0x3536('0x1a')]['where']||null:null,'attributes':_0x411a8f['options']?_0x411a8f[_0x3536('0x1a')][_0x3536('0x1b')]||null:null,'limit':_0x411a8f[_0x3536('0x1a')]?_0x411a8f[_0x3536('0x1a')][_0x3536('0x1c')]||null:null,'include':_0x411a8f['options']?_0x411a8f['options'][_0x3536('0x1d')]?_[_0x3536('0x1e')](_0x411a8f[_0x3536('0x1a')]['include'],function(_0x7b7f55){return{'model':db[_0x7b7f55['model']],'as':_0x7b7f55['as'],'attributes':_0x7b7f55['attributes'],'include':_0x7b7f55[_0x3536('0x1d')]?_[_0x3536('0x1e')](_0x7b7f55['include'],function(_0xebeb73){return{'model':db[_0xebeb73['model']],'as':_0xebeb73['as'],'attributes':_0xebeb73['attributes'],'include':_0xebeb73[_0x3536('0x1d')]?_[_0x3536('0x1e')](_0xebeb73[_0x3536('0x1d')],function(_0x21dd61){return{'model':db[_0x21dd61[_0x3536('0x1f')]],'as':_0x21dd61['as'],'attributes':_0x21dd61[_0x3536('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3536('0x11')](function(_0x520f32){logger[_0x3536('0x12')](_0x3536('0x20'),_0x411a8f);logger[_0x3536('0x21')](_0x3536('0x20'),_0x411a8f,JSON[_0x3536('0x22')](_0x520f32));_0x9bc5ae(_0x520f32);})[_0x3536('0x23')](function(_0x32a445){logger[_0x3536('0x15')](_0x3536('0x20'),_0x32a445[_0x3536('0x18')],_0x411a8f);_0x292390(_0x2a7a28[_0x3536('0x15')](0x1f4,_0x32a445[_0x3536('0x18')]));});});};exports[_0x3536('0x24')]=function(_0xc7a93b){var _0x4ecabe=this;return new Promise(function(_0x53a558,_0x123680){return db['VoiceQueueReport']['create'](_0xc7a93b['body'],{'raw':_0xc7a93b['options']?_0xc7a93b[_0x3536('0x1a')][_0x3536('0x25')]===undefined?!![]:![]:!![]})['then'](function(_0xe2d0bf){logger[_0x3536('0x12')](_0x3536('0x24'),_0xc7a93b);logger[_0x3536('0x21')](_0x3536('0x24'),_0xc7a93b,JSON[_0x3536('0x22')](_0xe2d0bf));_0x53a558(_0xe2d0bf);})['catch'](function(_0x3bb599){logger['error'](_0x3536('0x24'),_0x3bb599[_0x3536('0x18')],_0xc7a93b);_0x123680(_0x4ecabe[_0x3536('0x15')](0x1f4,_0x3bb599[_0x3536('0x18')]));});});};exports[_0x3536('0x26')]=function(_0x23a702){var _0x3aae9f=this;return new Promise(function(_0x4f3e07,_0x4420f3){return db[_0x3536('0x27')][_0x3536('0x28')](_0x23a702[_0x3536('0x29')],{'raw':_0x23a702[_0x3536('0x1a')]?_0x23a702['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23a702[_0x3536('0x1a')]?_0x23a702[_0x3536('0x1a')][_0x3536('0x2a')]||null:null,'attributes':_0x23a702['options']?_0x23a702['options'][_0x3536('0x1b')]||null:null,'limit':_0x23a702[_0x3536('0x1a')]?_0x23a702[_0x3536('0x1a')]['limit']||null:null})['then'](function(_0x427d12){logger['info'](_0x3536('0x26'),_0x23a702);logger[_0x3536('0x21')](_0x3536('0x26'),_0x23a702,JSON[_0x3536('0x22')](_0x427d12));_0x4f3e07(_0x427d12);})['catch'](function(_0x48f27a){logger['error']('UpdateVoiceQueueReport',_0x48f27a[_0x3536('0x18')],_0x23a702);_0x4420f3(_0x3aae9f[_0x3536('0x15')](0x1f4,_0x48f27a[_0x3536('0x18')]));});});}; \ No newline at end of file +var _0x3641=['client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','CreateVoiceQueueReport','UpdateVoiceQueueReport','body','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0x3641,0x14c));var _0x1364=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3641[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1364('0x0'));var util=require(_0x1364('0x1'));var moment=require(_0x1364('0x2'));var BPromise=require(_0x1364('0x3'));var rs=require(_0x1364('0x4'));var fs=require('fs');var Redis=require(_0x1364('0x5'));var db=require(_0x1364('0x6'))['db'];var utils=require(_0x1364('0x7'));var logger=require(_0x1364('0x8'))(_0x1364('0x9'));var config=require(_0x1364('0xa'));var jayson=require(_0x1364('0xb'));var client=jayson[_0x1364('0xc')][_0x1364('0xd')]({'port':0x232a});config[_0x1364('0xe')]=_[_0x1364('0xf')](config[_0x1364('0xe')],{'host':_0x1364('0x10'),'port':0x18eb});var socket=require(_0x1364('0x11'))(new Redis(config[_0x1364('0xe')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x55c95c,_0x1cc652,_0x11ac36){return new BPromise(function(_0x405213,_0x1f4d25){return client[_0x1364('0x12')](_0x55c95c,_0x11ac36)[_0x1364('0x13')](function(_0x284faf){logger[_0x1364('0x14')](_0x1364('0x15'),_0x1cc652,'request\x20sent');logger[_0x1364('0x16')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x1cc652,'request\x20sent',JSON[_0x1364('0x17')](_0x284faf));if(_0x284faf['error']){if(_0x284faf[_0x1364('0x18')][_0x1364('0x19')]===0x1f4){logger[_0x1364('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x1cc652,_0x284faf[_0x1364('0x18')][_0x1364('0x1a')]);return _0x1f4d25(_0x284faf[_0x1364('0x18')][_0x1364('0x1a')]);}logger[_0x1364('0x18')](_0x1364('0x15'),_0x1cc652,_0x284faf['error'][_0x1364('0x1a')]);return _0x405213(_0x284faf[_0x1364('0x18')][_0x1364('0x1a')]);}else{logger[_0x1364('0x14')](_0x1364('0x15'),_0x1cc652,_0x1364('0x1b'));_0x405213(_0x284faf['result'][_0x1364('0x1a')]);}})[_0x1364('0x1c')](function(_0x270d6e){logger[_0x1364('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x1cc652,_0x270d6e);_0x1f4d25(_0x270d6e);});});}exports[_0x1364('0x1d')]=function(_0x39f003){var _0x37b26f=this;return new Promise(function(_0x407592,_0x5d2641){return db[_0x1364('0x1e')][_0x1364('0x1f')]({'raw':_0x39f003['options']?_0x39f003[_0x1364('0x20')][_0x1364('0x21')]===undefined?!![]:![]:!![],'where':_0x39f003[_0x1364('0x20')]?_0x39f003['options'][_0x1364('0x22')]||null:null,'attributes':_0x39f003[_0x1364('0x20')]?_0x39f003['options'][_0x1364('0x23')]||null:null,'limit':_0x39f003['options']?_0x39f003[_0x1364('0x20')]['limit']||null:null,'include':_0x39f003[_0x1364('0x20')]?_0x39f003['options'][_0x1364('0x24')]?_[_0x1364('0x25')](_0x39f003['options']['include'],function(_0x3c7033){return{'model':db[_0x3c7033[_0x1364('0x26')]],'as':_0x3c7033['as'],'attributes':_0x3c7033[_0x1364('0x23')],'include':_0x3c7033[_0x1364('0x24')]?_['map'](_0x3c7033[_0x1364('0x24')],function(_0x422ff9){return{'model':db[_0x422ff9[_0x1364('0x26')]],'as':_0x422ff9['as'],'attributes':_0x422ff9['attributes'],'include':_0x422ff9[_0x1364('0x24')]?_['map'](_0x422ff9[_0x1364('0x24')],function(_0x119ef9){return{'model':db[_0x119ef9[_0x1364('0x26')]],'as':_0x119ef9['as'],'attributes':_0x119ef9[_0x1364('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52485d){logger[_0x1364('0x14')](_0x1364('0x1d'),_0x39f003);logger[_0x1364('0x16')](_0x1364('0x1d'),_0x39f003,JSON[_0x1364('0x17')](_0x52485d));_0x407592(_0x52485d);})['catch'](function(_0x1b8811){logger[_0x1364('0x18')](_0x1364('0x1d'),_0x1b8811[_0x1364('0x1a')],_0x39f003);_0x5d2641(_0x37b26f[_0x1364('0x18')](0x1f4,_0x1b8811[_0x1364('0x1a')]));});});};exports['CreateVoiceQueueReport']=function(_0xb814ec){var _0x487853=this;return new Promise(function(_0x5188da,_0x53ffdf){return db[_0x1364('0x1e')]['create'](_0xb814ec['body'],{'raw':_0xb814ec[_0x1364('0x20')]?_0xb814ec['options'][_0x1364('0x21')]===undefined?!![]:![]:!![]})[_0x1364('0x13')](function(_0x171b50){logger[_0x1364('0x14')](_0x1364('0x27'),_0xb814ec);logger[_0x1364('0x16')](_0x1364('0x27'),_0xb814ec,JSON['stringify'](_0x171b50));_0x5188da(_0x171b50);})[_0x1364('0x1c')](function(_0x1580e8){logger['error'](_0x1364('0x27'),_0x1580e8[_0x1364('0x1a')],_0xb814ec);_0x53ffdf(_0x487853[_0x1364('0x18')](0x1f4,_0x1580e8[_0x1364('0x1a')]));});});};exports[_0x1364('0x28')]=function(_0x2b1ba5){var _0x593c85=this;return new Promise(function(_0x55ba7c,_0x171bee){return db[_0x1364('0x1e')]['update'](_0x2b1ba5[_0x1364('0x29')],{'raw':_0x2b1ba5[_0x1364('0x20')]?_0x2b1ba5[_0x1364('0x20')][_0x1364('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b1ba5[_0x1364('0x20')]?_0x2b1ba5[_0x1364('0x20')][_0x1364('0x22')]||null:null,'attributes':_0x2b1ba5[_0x1364('0x20')]?_0x2b1ba5['options'][_0x1364('0x23')]||null:null,'limit':_0x2b1ba5[_0x1364('0x20')]?_0x2b1ba5[_0x1364('0x20')][_0x1364('0x2a')]||null:null})['then'](function(_0x2128b5){logger[_0x1364('0x14')](_0x1364('0x28'),_0x2b1ba5);logger['debug'](_0x1364('0x28'),_0x2b1ba5,JSON[_0x1364('0x17')](_0x2128b5));_0x55ba7c(_0x2128b5);})['catch'](function(_0x13cac4){logger[_0x1364('0x18')](_0x1364('0x28'),_0x13cac4[_0x1364('0x1a')],_0x2b1ba5);_0x171bee(_0x593c85[_0x1364('0x18')](0x1f4,_0x13cac4[_0x1364('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 0fda483..1318949 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 _0xfdb3=['length','voiceQueueReport:','./voiceQueueReport.events','save','update','removeListener','register'];(function(_0x3eb713,_0x437874){var _0x1d7128=function(_0x2b9cea){while(--_0x2b9cea){_0x3eb713['push'](_0x3eb713['shift']());}};_0x1d7128(++_0x437874);}(_0xfdb3,0x10c));var _0x3fdb=function(_0x1e67f6,_0x1d3b8e){_0x1e67f6=_0x1e67f6-0x0;var _0x3298cc=_0xfdb3[_0x1e67f6];return _0x3298cc;};'use strict';var VoiceQueueReportEvents=require(_0x3fdb('0x0'));var events=[_0x3fdb('0x1'),'remove',_0x3fdb('0x2')];function createListener(_0x5823c1,_0x5c4528){return function(_0x2c071b){_0x5c4528['emit'](_0x5823c1,_0x2c071b);};}function removeListener(_0x15c956,_0x8e594f){return function(){VoiceQueueReportEvents[_0x3fdb('0x3')](_0x15c956,_0x8e594f);};}exports[_0x3fdb('0x4')]=function(_0x20c33a){for(var _0x555450=0x0,_0x3433d8=events[_0x3fdb('0x5')];_0x555450<_0x3433d8;_0x555450++){var _0x102a21=events[_0x555450];var _0x53f026=createListener(_0x3fdb('0x6')+_0x102a21,_0x20c33a);VoiceQueueReportEvents['on'](_0x102a21,_0x53f026);}}; \ No newline at end of file +var _0x4536=['length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','removeListener'];(function(_0x44fc3f,_0x4774d1){var _0x926ba3=function(_0x2af2a9){while(--_0x2af2a9){_0x44fc3f['push'](_0x44fc3f['shift']());}};_0x926ba3(++_0x4774d1);}(_0x4536,0xe9));var _0x6453=function(_0x2438fa,_0x5c3473){_0x2438fa=_0x2438fa-0x0;var _0x113e36=_0x4536[_0x2438fa];return _0x113e36;};'use strict';var VoiceQueueReportEvents=require(_0x6453('0x0'));var events=[_0x6453('0x1'),_0x6453('0x2'),_0x6453('0x3')];function createListener(_0x51f5ce,_0x11a17c){return function(_0x1d1656){_0x11a17c['emit'](_0x51f5ce,_0x1d1656);};}function removeListener(_0x32462,_0x36d2f1){return function(){VoiceQueueReportEvents[_0x6453('0x4')](_0x32462,_0x36d2f1);};}exports['register']=function(_0x25d8f7){for(var _0x1b2359=0x0,_0x4cd062=events[_0x6453('0x5')];_0x1b2359<_0x4cd062;_0x1b2359++){var _0x2462e4=events[_0x1b2359];var _0x534576=createListener(_0x6453('0x6')+_0x2462e4,_0x25d8f7);VoiceQueueReportEvents['on'](_0x2462e4,_0x534576);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index e2650f0..29e1399 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 _0x642b=['index','/:id','post','create','put','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated'];(function(_0x1c4aba,_0x5d4419){var _0x37077b=function(_0x53ab4a){while(--_0x53ab4a){_0x1c4aba['push'](_0x1c4aba['shift']());}};_0x37077b(++_0x5d4419);}(_0x642b,0x196));var _0xb642=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x642b[_0x51020b];return _0x371e47;};'use strict';var multer=require('multer');var util=require(_0xb642('0x0'));var path=require(_0xb642('0x1'));var timeout=require(_0xb642('0x2'));var express=require(_0xb642('0x3'));var router=express[_0xb642('0x4')]();var fs_extra=require(_0xb642('0x5'));var auth=require(_0xb642('0x6'));var interaction=require(_0xb642('0x7'));var config=require(_0xb642('0x8'));var controller=require(_0xb642('0x9'));router[_0xb642('0xa')]('/',auth[_0xb642('0xb')](),controller[_0xb642('0xc')]);router['get'](_0xb642('0xd'),auth[_0xb642('0xb')](),controller['show']);router[_0xb642('0xe')]('/',auth[_0xb642('0xb')](),controller[_0xb642('0xf')]);router[_0xb642('0x10')](_0xb642('0xd'),auth[_0xb642('0xb')](),controller['update']);router[_0xb642('0x11')](_0xb642('0xd'),auth[_0xb642('0xb')](),controller['destroy']);module[_0xb642('0x12')]=router; \ No newline at end of file +var _0xa02e=['./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x31807b,_0x3f50de){var _0x485581=function(_0x30cb45){while(--_0x30cb45){_0x31807b['push'](_0x31807b['shift']());}};_0x485581(++_0x3f50de);}(_0xa02e,0xa3));var _0xea02=function(_0x2fcef5,_0x15a590){_0x2fcef5=_0x2fcef5-0x0;var _0x56faf2=_0xa02e[_0x2fcef5];return _0x56faf2;};'use strict';var multer=require('multer');var util=require(_0xea02('0x0'));var path=require('path');var timeout=require(_0xea02('0x1'));var express=require(_0xea02('0x2'));var router=express[_0xea02('0x3')]();var fs_extra=require(_0xea02('0x4'));var auth=require(_0xea02('0x5'));var interaction=require(_0xea02('0x6'));var config=require(_0xea02('0x7'));var controller=require(_0xea02('0x8'));router[_0xea02('0x9')]('/',auth[_0xea02('0xa')](),controller[_0xea02('0xb')]);router[_0xea02('0x9')](_0xea02('0xc'),auth[_0xea02('0xa')](),controller[_0xea02('0xd')]);router['post']('/',auth[_0xea02('0xa')](),controller[_0xea02('0xe')]);router[_0xea02('0xf')](_0xea02('0xc'),auth[_0xea02('0xa')](),controller[_0xea02('0x10')]);router['delete'](_0xea02('0xc'),auth[_0xea02('0xa')](),controller[_0xea02('0x11')]);module[_0xea02('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index d1dec20..8bd5452 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 _0x80f1=['STRING','DATE','sequelize'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x80f1,0x71));var _0x180f=function(_0x41671f,_0x24850d){_0x41671f=_0x41671f-0x0;var _0x437b6d=_0x80f1[_0x41671f];return _0x437b6d;};'use strict';var Sequelize=require(_0x180f('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0x180f('0x1')]},'callid':{'type':Sequelize[_0x180f('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x180f('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x180f('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x180f('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x180f('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x180f('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x180f('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x180f('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x180f('0x2')],'allowNull':![],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x09b1=['moment','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x111e94,_0x31c837){var _0x3de107=function(_0x65bd1e){while(--_0x65bd1e){_0x111e94['push'](_0x111e94['shift']());}};_0x3de107(++_0x31c837);}(_0x09b1,0xa7));var _0x109b=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x09b1[_0x62c958];return _0x57ec61;};'use strict';var Sequelize=require(_0x109b('0x0'));var moment=require(_0x109b('0x1'));module[_0x109b('0x2')]={'time':{'type':Sequelize[_0x109b('0x3')]},'callid':{'type':Sequelize[_0x109b('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x109b('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x109b('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x109b('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x109b('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x109b('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x109b('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x109b('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x109b('0x4')],'allowNull':![],'defaultValue':moment()[_0x109b('0x5')](_0x109b('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 9a2065f..3a808b8 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 _0xf7df=['save','update','then','destroy','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','keys','query','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','params','intersection','length','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject'];(function(_0x9db5d3,_0x4eea5e){var _0x477a81=function(_0x28e774){while(--_0x28e774){_0x9db5d3['push'](_0x9db5d3['shift']());}};_0x477a81(++_0x4eea5e);}(_0xf7df,0x1f0));var _0xff7d=function(_0x4202dc,_0x2ea9ec){_0x4202dc=_0x4202dc-0x0;var _0x147c1e=_0xf7df[_0x4202dc];return _0x147c1e;};'use strict';var emlformat=require(_0xff7d('0x0'));var rimraf=require(_0xff7d('0x1'));var zipdir=require(_0xff7d('0x2'));var jsonpatch=require(_0xff7d('0x3'));var rp=require(_0xff7d('0x4'));var moment=require('moment');var BPromise=require(_0xff7d('0x5'));var Mustache=require(_0xff7d('0x6'));var util=require(_0xff7d('0x7'));var path=require('path');var sox=require(_0xff7d('0x8'));var csv=require(_0xff7d('0x9'));var ejs=require(_0xff7d('0xa'));var fs=require('fs');var fs_extra=require(_0xff7d('0xb'));var _=require(_0xff7d('0xc'));var squel=require(_0xff7d('0xd'));var crypto=require(_0xff7d('0xe'));var jsforce=require(_0xff7d('0xf'));var deskjs=require(_0xff7d('0x10'));var toCsv=require(_0xff7d('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xff7d('0x11'));var qs=require(_0xff7d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff7d('0x13'));var logger=require(_0xff7d('0x14'))(_0xff7d('0x15'));var utils=require(_0xff7d('0x16'));var config=require(_0xff7d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xff7d('0x18'))['db'];function respondWithStatusCode(_0x115153,_0x555983){_0x555983=_0x555983||0xcc;return function(_0x189828){if(_0x189828){return _0x115153[_0xff7d('0x19')](_0x555983);}return _0x115153[_0xff7d('0x1a')](_0x555983)['end']();};}function respondWithResult(_0x372e9c,_0x27b50b){_0x27b50b=_0x27b50b||0xc8;return function(_0x3552a0){if(_0x3552a0){return _0x372e9c['status'](_0x27b50b)['json'](_0x3552a0);}};}function respondWithFilteredResult(_0x359a23,_0x1e45b7){return function(_0x2ea5c7){if(_0x2ea5c7){var _0x572531=typeof _0x1e45b7['offset']==='undefined'&&typeof _0x1e45b7[_0xff7d('0x1b')]===_0xff7d('0x1c');var _0x1c83b3=_0x2ea5c7[_0xff7d('0x1d')];var _0x2e2d9f=_0x572531?0x0:_0x1e45b7[_0xff7d('0x1e')];var _0x9c72ed=_0x572531?_0x2ea5c7[_0xff7d('0x1d')]:_0x1e45b7[_0xff7d('0x1e')]+_0x1e45b7[_0xff7d('0x1b')];var _0x584451;if(_0x9c72ed>=_0x1c83b3){_0x9c72ed=_0x1c83b3;_0x584451=0xc8;}else{_0x584451=0xce;}_0x359a23[_0xff7d('0x1a')](_0x584451);return _0x359a23[_0xff7d('0x1f')](_0xff7d('0x20'),_0x2e2d9f+'-'+_0x9c72ed+'/'+_0x1c83b3)[_0xff7d('0x21')](_0x2ea5c7);}return null;};}function patchUpdates(_0x3bec1f){return function(_0x53e3d6){try{jsonpatch[_0xff7d('0x22')](_0x53e3d6,_0x3bec1f,!![]);}catch(_0x128813){return BPromise[_0xff7d('0x23')](_0x128813);}return _0x53e3d6[_0xff7d('0x24')]();};}function saveUpdates(_0x3000f0,_0x736388){return function(_0x263aa4){if(_0x263aa4){return _0x263aa4[_0xff7d('0x25')](_0x3000f0)[_0xff7d('0x26')](function(_0x447460){return _0x447460;});}return null;};}function removeEntity(_0x583b86,_0x3d92ab){return function(_0x2ab1d1){if(_0x2ab1d1){return _0x2ab1d1[_0xff7d('0x27')]()[_0xff7d('0x26')](function(){_0x583b86[_0xff7d('0x1a')](0xcc)[_0xff7d('0x28')]();});}};}function handleEntityNotFound(_0x4150a3,_0x385903){return function(_0x53a52d){if(!_0x53a52d){_0x4150a3[_0xff7d('0x19')](0x194);}return _0x53a52d;};}function handleError(_0x5d36e8,_0x412f4b){_0x412f4b=_0x412f4b||0x1f4;return function(_0x51cd68){logger[_0xff7d('0x29')](_0x51cd68['stack']);if(_0x51cd68['name']){delete _0x51cd68[_0xff7d('0x2a')];}_0x5d36e8['status'](_0x412f4b)[_0xff7d('0x2b')](_0x51cd68);};}exports[_0xff7d('0x2c')]=function(_0x161ed4,_0x28abb3){var _0x46dcf0={},_0x2a52e5={},_0x296035={'count':0x0,'rows':[]};var _0x1102fa=_[_0xff7d('0x2d')](db[_0xff7d('0x2e')][_0xff7d('0x2f')],function(_0x14c8a4){return{'name':_0x14c8a4[_0xff7d('0x30')],'type':_0x14c8a4[_0xff7d('0x31')][_0xff7d('0x32')]};});_0x2a52e5[_0xff7d('0x33')]=_[_0xff7d('0x2d')](_0x1102fa,_0xff7d('0x2a'));_0x2a52e5['query']=_[_0xff7d('0x34')](_0x161ed4[_0xff7d('0x35')]);_0x2a52e5['filters']=_['intersection'](_0x2a52e5[_0xff7d('0x33')],_0x2a52e5[_0xff7d('0x35')]);_0x46dcf0[_0xff7d('0x36')]=_['intersection'](_0x2a52e5[_0xff7d('0x33')],qs[_0xff7d('0x37')](_0x161ed4['query'][_0xff7d('0x37')]));_0x46dcf0[_0xff7d('0x36')]=_0x46dcf0[_0xff7d('0x36')]['length']?_0x46dcf0[_0xff7d('0x36')]:_0x2a52e5[_0xff7d('0x33')];if(!_0x161ed4[_0xff7d('0x35')][_0xff7d('0x38')](_0xff7d('0x39'))){_0x46dcf0['limit']=qs['limit'](_0x161ed4['query']['limit']);_0x46dcf0[_0xff7d('0x1e')]=qs[_0xff7d('0x1e')](_0x161ed4[_0xff7d('0x35')][_0xff7d('0x1e')]);}_0x46dcf0['order']=qs[_0xff7d('0x3a')](_0x161ed4[_0xff7d('0x35')]['sort']);_0x46dcf0['where']=qs[_0xff7d('0x3b')](_[_0xff7d('0x3c')](_0x161ed4[_0xff7d('0x35')],_0x2a52e5[_0xff7d('0x3b')]),_0x1102fa);if(_0x161ed4[_0xff7d('0x35')][_0xff7d('0x3d')]){_0x46dcf0[_0xff7d('0x3e')]=_[_0xff7d('0x3f')](_0x46dcf0[_0xff7d('0x3e')],{'$or':_['map'](_0x1102fa,function(_0x1e6744){if(_0x1e6744[_0xff7d('0x31')]!==_0xff7d('0x40')){var _0x313da9={};_0x313da9[_0x1e6744[_0xff7d('0x2a')]]={'$like':'%'+_0x161ed4[_0xff7d('0x35')]['filter']+'%'};return _0x313da9;}})});}_0x46dcf0=_[_0xff7d('0x3f')]({},_0x46dcf0,_0x161ed4['options']);var _0x18f621={'where':_0x46dcf0[_0xff7d('0x3e')]};return db[_0xff7d('0x2e')][_0xff7d('0x1d')](_0x18f621)[_0xff7d('0x26')](function(_0x34563e){_0x296035[_0xff7d('0x1d')]=_0x34563e;if(_0x161ed4[_0xff7d('0x35')][_0xff7d('0x41')]){_0x46dcf0['include']=[{'all':!![]}];}return db[_0xff7d('0x2e')][_0xff7d('0x42')](_0x46dcf0);})[_0xff7d('0x26')](function(_0x5c8a16){_0x296035[_0xff7d('0x43')]=_0x5c8a16;return _0x296035;})[_0xff7d('0x26')](respondWithFilteredResult(_0x28abb3,_0x46dcf0))[_0xff7d('0x44')](handleError(_0x28abb3,null));};exports['show']=function(_0x2f7843,_0x1c9f8b){var _0xf74ad6={'raw':!![],'where':{'id':_0x2f7843[_0xff7d('0x45')]['id']}},_0x59d6d9={};_0x59d6d9[_0xff7d('0x33')]=_[_0xff7d('0x34')](db[_0xff7d('0x2e')][_0xff7d('0x2f')]);_0x59d6d9['query']=_[_0xff7d('0x34')](_0x2f7843[_0xff7d('0x35')]);_0x59d6d9[_0xff7d('0x3b')]=_[_0xff7d('0x46')](_0x59d6d9[_0xff7d('0x33')],_0x59d6d9['query']);_0xf74ad6[_0xff7d('0x36')]=_[_0xff7d('0x46')](_0x59d6d9[_0xff7d('0x33')],qs[_0xff7d('0x37')](_0x2f7843[_0xff7d('0x35')][_0xff7d('0x37')]));_0xf74ad6['attributes']=_0xf74ad6[_0xff7d('0x36')][_0xff7d('0x47')]?_0xf74ad6[_0xff7d('0x36')]:_0x59d6d9[_0xff7d('0x33')];if(_0x2f7843[_0xff7d('0x35')][_0xff7d('0x41')]){_0xf74ad6['include']=[{'all':!![]}];}_0xf74ad6=_['merge']({},_0xf74ad6,_0x2f7843[_0xff7d('0x48')]);return db[_0xff7d('0x2e')]['find'](_0xf74ad6)['then'](handleEntityNotFound(_0x1c9f8b,null))[_0xff7d('0x26')](respondWithResult(_0x1c9f8b,null))['catch'](handleError(_0x1c9f8b,null));};exports[_0xff7d('0x49')]=function(_0x3fd7fb,_0x21f4fd){return db[_0xff7d('0x2e')][_0xff7d('0x49')](_0x3fd7fb['body'],{})[_0xff7d('0x26')](respondWithResult(_0x21f4fd,0xc9))[_0xff7d('0x44')](handleError(_0x21f4fd,null));};exports[_0xff7d('0x25')]=function(_0x394798,_0x201608){if(_0x394798[_0xff7d('0x4a')]['id']){delete _0x394798[_0xff7d('0x4a')]['id'];}return db['VoiceQueuesLog'][_0xff7d('0x4b')]({'where':{'id':_0x394798[_0xff7d('0x45')]['id']}})[_0xff7d('0x26')](handleEntityNotFound(_0x201608,null))[_0xff7d('0x26')](saveUpdates(_0x394798[_0xff7d('0x4a')],null))['then'](respondWithResult(_0x201608,null))[_0xff7d('0x44')](handleError(_0x201608,null));};exports[_0xff7d('0x27')]=function(_0x5589c2,_0x57af32){return db[_0xff7d('0x2e')]['find']({'where':{'id':_0x5589c2['params']['id']}})[_0xff7d('0x26')](handleEntityNotFound(_0x57af32,null))[_0xff7d('0x26')](removeEntity(_0x57af32,null))[_0xff7d('0x44')](handleError(_0x57af32,null));}; \ No newline at end of file +var _0x1021=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','limit','undefined','count','offset','set','json','apply','save','update','then','end','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filters','filter','where','merge','options','includeAll','rows','catch','show','params','length','include','find','create','body','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x1021,0xc6));var _0x1102=function(_0x3391e1,_0x74d3aa){_0x3391e1=_0x3391e1-0x0;var _0x522c1e=_0x1021[_0x3391e1];return _0x522c1e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1102('0x0'));var zipdir=require(_0x1102('0x1'));var jsonpatch=require(_0x1102('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1102('0x3'));var Mustache=require(_0x1102('0x4'));var util=require(_0x1102('0x5'));var path=require(_0x1102('0x6'));var sox=require(_0x1102('0x7'));var csv=require('to-csv');var ejs=require(_0x1102('0x8'));var fs=require('fs');var fs_extra=require(_0x1102('0x9'));var _=require(_0x1102('0xa'));var squel=require(_0x1102('0xb'));var crypto=require(_0x1102('0xc'));var jsforce=require(_0x1102('0xd'));var deskjs=require(_0x1102('0xe'));var toCsv=require(_0x1102('0xf'));var querystring=require(_0x1102('0x10'));var Papa=require(_0x1102('0x11'));var Redis=require(_0x1102('0x12'));var authService=require(_0x1102('0x13'));var qs=require(_0x1102('0x14'));var as=require(_0x1102('0x15'));var hardwareService=require(_0x1102('0x16'));var logger=require(_0x1102('0x17'))(_0x1102('0x18'));var utils=require('../../config/utils');var config=require(_0x1102('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa9fa25,_0xa911fe){_0xa911fe=_0xa911fe||0xcc;return function(_0x43f49){if(_0x43f49){return _0xa9fa25['sendStatus'](_0xa911fe);}return _0xa9fa25[_0x1102('0x1a')](_0xa911fe)['end']();};}function respondWithResult(_0x41a2c1,_0x1cbb0e){_0x1cbb0e=_0x1cbb0e||0xc8;return function(_0xcb1aea){if(_0xcb1aea){return _0x41a2c1[_0x1102('0x1a')](_0x1cbb0e)['json'](_0xcb1aea);}};}function respondWithFilteredResult(_0x196f81,_0x2b007c){return function(_0x9f9aef){if(_0x9f9aef){var _0x423d35=typeof _0x2b007c['offset']==='undefined'&&typeof _0x2b007c[_0x1102('0x1b')]===_0x1102('0x1c');var _0x25140f=_0x9f9aef[_0x1102('0x1d')];var _0x4675b5=_0x423d35?0x0:_0x2b007c[_0x1102('0x1e')];var _0x5da8bc=_0x423d35?_0x9f9aef[_0x1102('0x1d')]:_0x2b007c[_0x1102('0x1e')]+_0x2b007c[_0x1102('0x1b')];var _0x5970a2;if(_0x5da8bc>=_0x25140f){_0x5da8bc=_0x25140f;_0x5970a2=0xc8;}else{_0x5970a2=0xce;}_0x196f81[_0x1102('0x1a')](_0x5970a2);return _0x196f81[_0x1102('0x1f')]('Content-Range',_0x4675b5+'-'+_0x5da8bc+'/'+_0x25140f)[_0x1102('0x20')](_0x9f9aef);}return null;};}function patchUpdates(_0x2f0925){return function(_0x44364b){try{jsonpatch[_0x1102('0x21')](_0x44364b,_0x2f0925,!![]);}catch(_0x12725d){return BPromise['reject'](_0x12725d);}return _0x44364b[_0x1102('0x22')]();};}function saveUpdates(_0xa0a0fc,_0x7ef20c){return function(_0x4dea55){if(_0x4dea55){return _0x4dea55[_0x1102('0x23')](_0xa0a0fc)['then'](function(_0x30bc15){return _0x30bc15;});}return null;};}function removeEntity(_0x2a7bf1,_0x4cf83f){return function(_0x157118){if(_0x157118){return _0x157118['destroy']()[_0x1102('0x24')](function(){_0x2a7bf1[_0x1102('0x1a')](0xcc)[_0x1102('0x25')]();});}};}function handleEntityNotFound(_0x1f7f31,_0x4a00bf){return function(_0x2e294e){if(!_0x2e294e){_0x1f7f31['sendStatus'](0x194);}return _0x2e294e;};}function handleError(_0x396c51,_0x9f6725){_0x9f6725=_0x9f6725||0x1f4;return function(_0x302342){logger[_0x1102('0x26')](_0x302342[_0x1102('0x27')]);if(_0x302342[_0x1102('0x28')]){delete _0x302342[_0x1102('0x28')];}_0x396c51['status'](_0x9f6725)[_0x1102('0x29')](_0x302342);};}exports[_0x1102('0x2a')]=function(_0x53a335,_0x6b8285){var _0x37d6ee={},_0x4da934={},_0x33ff51={'count':0x0,'rows':[]};var _0x58f7ae=_['map'](db[_0x1102('0x2b')][_0x1102('0x2c')],function(_0x1ee56a){return{'name':_0x1ee56a[_0x1102('0x2d')],'type':_0x1ee56a['type'][_0x1102('0x2e')]};});_0x4da934[_0x1102('0x2f')]=_[_0x1102('0x30')](_0x58f7ae,'name');_0x4da934[_0x1102('0x31')]=_[_0x1102('0x32')](_0x53a335[_0x1102('0x31')]);_0x4da934['filters']=_[_0x1102('0x33')](_0x4da934['model'],_0x4da934[_0x1102('0x31')]);_0x37d6ee['attributes']=_[_0x1102('0x33')](_0x4da934[_0x1102('0x2f')],qs[_0x1102('0x34')](_0x53a335[_0x1102('0x31')][_0x1102('0x34')]));_0x37d6ee[_0x1102('0x35')]=_0x37d6ee['attributes']['length']?_0x37d6ee[_0x1102('0x35')]:_0x4da934[_0x1102('0x2f')];if(!_0x53a335[_0x1102('0x31')][_0x1102('0x36')](_0x1102('0x37'))){_0x37d6ee[_0x1102('0x1b')]=qs['limit'](_0x53a335[_0x1102('0x31')][_0x1102('0x1b')]);_0x37d6ee['offset']=qs[_0x1102('0x1e')](_0x53a335[_0x1102('0x31')][_0x1102('0x1e')]);}_0x37d6ee['order']=qs[_0x1102('0x38')](_0x53a335[_0x1102('0x31')]['sort']);_0x37d6ee['where']=qs[_0x1102('0x39')](_['pick'](_0x53a335[_0x1102('0x31')],_0x4da934['filters']),_0x58f7ae);if(_0x53a335[_0x1102('0x31')][_0x1102('0x3a')]){_0x37d6ee[_0x1102('0x3b')]=_[_0x1102('0x3c')](_0x37d6ee[_0x1102('0x3b')],{'$or':_[_0x1102('0x30')](_0x58f7ae,function(_0x311bb3){if(_0x311bb3['type']!=='VIRTUAL'){var _0x40e15d={};_0x40e15d[_0x311bb3[_0x1102('0x28')]]={'$like':'%'+_0x53a335['query']['filter']+'%'};return _0x40e15d;}})});}_0x37d6ee=_[_0x1102('0x3c')]({},_0x37d6ee,_0x53a335[_0x1102('0x3d')]);var _0x536d6b={'where':_0x37d6ee[_0x1102('0x3b')]};return db['VoiceQueuesLog'][_0x1102('0x1d')](_0x536d6b)[_0x1102('0x24')](function(_0x9c515){_0x33ff51[_0x1102('0x1d')]=_0x9c515;if(_0x53a335[_0x1102('0x31')][_0x1102('0x3e')]){_0x37d6ee['include']=[{'all':!![]}];}return db[_0x1102('0x2b')]['findAll'](_0x37d6ee);})[_0x1102('0x24')](function(_0x48b5b0){_0x33ff51[_0x1102('0x3f')]=_0x48b5b0;return _0x33ff51;})[_0x1102('0x24')](respondWithFilteredResult(_0x6b8285,_0x37d6ee))[_0x1102('0x40')](handleError(_0x6b8285,null));};exports[_0x1102('0x41')]=function(_0x5b1068,_0x5bb6ad){var _0x1bca31={'raw':!![],'where':{'id':_0x5b1068[_0x1102('0x42')]['id']}},_0x1c42b0={};_0x1c42b0[_0x1102('0x2f')]=_['keys'](db['VoiceQueuesLog']['rawAttributes']);_0x1c42b0[_0x1102('0x31')]=_[_0x1102('0x32')](_0x5b1068[_0x1102('0x31')]);_0x1c42b0['filters']=_['intersection'](_0x1c42b0[_0x1102('0x2f')],_0x1c42b0[_0x1102('0x31')]);_0x1bca31[_0x1102('0x35')]=_[_0x1102('0x33')](_0x1c42b0[_0x1102('0x2f')],qs[_0x1102('0x34')](_0x5b1068[_0x1102('0x31')]['fields']));_0x1bca31[_0x1102('0x35')]=_0x1bca31['attributes'][_0x1102('0x43')]?_0x1bca31[_0x1102('0x35')]:_0x1c42b0[_0x1102('0x2f')];if(_0x5b1068[_0x1102('0x31')][_0x1102('0x3e')]){_0x1bca31[_0x1102('0x44')]=[{'all':!![]}];}_0x1bca31=_['merge']({},_0x1bca31,_0x5b1068['options']);return db['VoiceQueuesLog'][_0x1102('0x45')](_0x1bca31)[_0x1102('0x24')](handleEntityNotFound(_0x5bb6ad,null))[_0x1102('0x24')](respondWithResult(_0x5bb6ad,null))[_0x1102('0x40')](handleError(_0x5bb6ad,null));};exports['create']=function(_0x55fd59,_0x36cdcf){return db[_0x1102('0x2b')][_0x1102('0x46')](_0x55fd59[_0x1102('0x47')],{})[_0x1102('0x24')](respondWithResult(_0x36cdcf,0xc9))[_0x1102('0x40')](handleError(_0x36cdcf,null));};exports[_0x1102('0x23')]=function(_0x592c76,_0x2edae8){if(_0x592c76['body']['id']){delete _0x592c76['body']['id'];}return db[_0x1102('0x2b')][_0x1102('0x45')]({'where':{'id':_0x592c76['params']['id']}})['then'](handleEntityNotFound(_0x2edae8,null))[_0x1102('0x24')](saveUpdates(_0x592c76[_0x1102('0x47')],null))[_0x1102('0x24')](respondWithResult(_0x2edae8,null))[_0x1102('0x40')](handleError(_0x2edae8,null));};exports['destroy']=function(_0x474cab,_0x2b306f){return db[_0x1102('0x2b')][_0x1102('0x45')]({'where':{'id':_0x474cab[_0x1102('0x42')]['id']}})[_0x1102('0x24')](handleEntityNotFound(_0x2b306f,null))['then'](removeEntity(_0x2b306f,null))[_0x1102('0x40')](handleError(_0x2b306f,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index cbcd9cc..3425049 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 _0x8ba3=['define','voice_queues_log','event_dtm','event','dtm','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes'];(function(_0x160774,_0x2e3fcf){var _0x53d18d=function(_0x31938b){while(--_0x31938b){_0x160774['push'](_0x160774['shift']());}};_0x53d18d(++_0x2e3fcf);}(_0x8ba3,0x1bf));var _0x38ba=function(_0x517c2e,_0x3d4bf3){_0x517c2e=_0x517c2e-0x0;var _0x5d4029=_0x8ba3[_0x517c2e];return _0x5d4029;};'use strict';var _=require('lodash');var util=require(_0x38ba('0x0'));var logger=require('../../config/logger')(_0x38ba('0x1'));var moment=require('moment');var BPromise=require(_0x38ba('0x2'));var rp=require(_0x38ba('0x3'));var fs=require('fs');var path=require(_0x38ba('0x4'));var rimraf=require(_0x38ba('0x5'));var config=require(_0x38ba('0x6'));var attributes=require(_0x38ba('0x7'));module['exports']=function(_0x3e557d,_0x2afb75){return _0x3e557d[_0x38ba('0x8')]('VoiceQueuesLog',attributes,{'tableName':_0x38ba('0x9'),'paranoid':![],'indexes':[{'name':_0x38ba('0xa'),'fields':[_0x38ba('0xb'),_0x38ba('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xcd70=['bluebird','request-promise','rimraf','../../config/environment','exports','define','VoiceQueuesLog','event','util','../../config/logger','api'];(function(_0x455580,_0x5cd4dd){var _0x7aabc2=function(_0x10bf94){while(--_0x10bf94){_0x455580['push'](_0x455580['shift']());}};_0x7aabc2(++_0x5cd4dd);}(_0xcd70,0xb8));var _0x0cd7=function(_0x4e8e68,_0x52a7b8){_0x4e8e68=_0x4e8e68-0x0;var _0x3c1398=_0xcd70[_0x4e8e68];return _0x3c1398;};'use strict';var _=require('lodash');var util=require(_0x0cd7('0x0'));var logger=require(_0x0cd7('0x1'))(_0x0cd7('0x2'));var moment=require('moment');var BPromise=require(_0x0cd7('0x3'));var rp=require(_0x0cd7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0cd7('0x5'));var config=require(_0x0cd7('0x6'));var attributes=require('./voiceQueuesLog.attributes');module[_0x0cd7('0x7')]=function(_0x5bca74,_0x37f036){return _0x5bca74[_0x0cd7('0x8')](_0x0cd7('0x9'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x0cd7('0xa'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 5bdce8e..6ee0c03 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 _0x4134=['jayson/promise','client','request','then','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x4134,0x1ac));var _0x4413=function(_0x437927,_0x353b1c){_0x437927=_0x437927-0x0;var _0x3be533=_0x4134[_0x437927];return _0x3be533;};'use strict';var _=require(_0x4413('0x0'));var util=require(_0x4413('0x1'));var moment=require(_0x4413('0x2'));var BPromise=require(_0x4413('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4413('0x4'));var db=require(_0x4413('0x5'))['db'];var utils=require(_0x4413('0x6'));var logger=require('../../config/logger')(_0x4413('0x7'));var config=require(_0x4413('0x8'));var jayson=require(_0x4413('0x9'));var client=jayson[_0x4413('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d2f7c,_0x30307d,_0x3db8cc){return new BPromise(function(_0x3838bc,_0x2222cd){return client[_0x4413('0xb')](_0x2d2f7c,_0x3db8cc)[_0x4413('0xc')](function(_0x2787b2){logger['info'](_0x4413('0xd'),_0x30307d,'request\x20sent');logger[_0x4413('0xe')](_0x4413('0xf'),_0x30307d,_0x4413('0x10'),JSON[_0x4413('0x11')](_0x2787b2));if(_0x2787b2[_0x4413('0x12')]){if(_0x2787b2[_0x4413('0x12')][_0x4413('0x13')]===0x1f4){logger['error'](_0x4413('0xd'),_0x30307d,_0x2787b2[_0x4413('0x12')][_0x4413('0x14')]);return _0x2222cd(_0x2787b2[_0x4413('0x12')][_0x4413('0x14')]);}logger['error'](_0x4413('0xd'),_0x30307d,_0x2787b2[_0x4413('0x12')]['message']);return _0x3838bc(_0x2787b2['error'][_0x4413('0x14')]);}else{logger[_0x4413('0x15')]('VoiceQueuesLog,\x20%s,\x20%s',_0x30307d,_0x4413('0x10'));_0x3838bc(_0x2787b2['result']['message']);}})[_0x4413('0x16')](function(_0x401212){logger[_0x4413('0x12')](_0x4413('0xd'),_0x30307d,_0x401212);_0x2222cd(_0x401212);});});} \ No newline at end of file +var _0xa273=['request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','VoiceQueuesLog,\x20%s,\x20%s'];(function(_0x466350,_0x45ec49){var _0xc65577=function(_0x241591){while(--_0x241591){_0x466350['push'](_0x466350['shift']());}};_0xc65577(++_0x45ec49);}(_0xa273,0x1d5));var _0x3a27=function(_0x246be1,_0x2c7a5f){_0x246be1=_0x246be1-0x0;var _0x3c605c=_0xa273[_0x246be1];return _0x3c605c;};'use strict';var _=require(_0x3a27('0x0'));var util=require(_0x3a27('0x1'));var moment=require(_0x3a27('0x2'));var BPromise=require(_0x3a27('0x3'));var rs=require(_0x3a27('0x4'));var fs=require('fs');var Redis=require(_0x3a27('0x5'));var db=require(_0x3a27('0x6'))['db'];var utils=require(_0x3a27('0x7'));var logger=require(_0x3a27('0x8'))(_0x3a27('0x9'));var config=require('../../config/environment');var jayson=require(_0x3a27('0xa'));var client=jayson[_0x3a27('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43aa5b,_0x6240d4,_0x3c1afb){return new BPromise(function(_0x486981,_0x45b3c8){return client['request'](_0x43aa5b,_0x3c1afb)[_0x3a27('0xc')](function(_0x237f38){logger['info'](_0x3a27('0xd'),_0x6240d4,_0x3a27('0xe'));logger[_0x3a27('0xf')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x6240d4,_0x3a27('0xe'),JSON[_0x3a27('0x10')](_0x237f38));if(_0x237f38[_0x3a27('0x11')]){if(_0x237f38[_0x3a27('0x11')][_0x3a27('0x12')]===0x1f4){logger[_0x3a27('0x11')](_0x3a27('0xd'),_0x6240d4,_0x237f38[_0x3a27('0x11')]['message']);return _0x45b3c8(_0x237f38[_0x3a27('0x11')][_0x3a27('0x13')]);}logger['error'](_0x3a27('0xd'),_0x6240d4,_0x237f38[_0x3a27('0x11')][_0x3a27('0x13')]);return _0x486981(_0x237f38['error'][_0x3a27('0x13')]);}else{logger[_0x3a27('0x14')](_0x3a27('0xd'),_0x6240d4,'request\x20sent');_0x486981(_0x237f38[_0x3a27('0x15')][_0x3a27('0x13')]);}})[_0x3a27('0x16')](function(_0x421161){logger[_0x3a27('0x11')](_0x3a27('0xd'),_0x6240d4,_0x421161);_0x45b3c8(_0x421161);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 7ef0dc2..c22ebb5 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 _0x33ec=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','post','put','delete','exports','multer','path','Router'];(function(_0x14262c,_0x28c0fa){var _0x210639=function(_0x4d4914){while(--_0x4d4914){_0x14262c['push'](_0x14262c['shift']());}};_0x210639(++_0x28c0fa);}(_0x33ec,0x19b));var _0xc33e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x33ec[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc33e('0x0'));var util=require('util');var path=require(_0xc33e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc33e('0x2')]();var fs_extra=require(_0xc33e('0x3'));var auth=require(_0xc33e('0x4'));var interaction=require(_0xc33e('0x5'));var config=require(_0xc33e('0x6'));var controller=require(_0xc33e('0x7'));router[_0xc33e('0x8')]('/',auth[_0xc33e('0x9')](),controller[_0xc33e('0xa')]);router[_0xc33e('0x8')](_0xc33e('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xc33e('0x8')](_0xc33e('0xc'),auth[_0xc33e('0x9')](),controller[_0xc33e('0xd')]);router[_0xc33e('0x8')](_0xc33e('0xe'),auth[_0xc33e('0x9')](),controller[_0xc33e('0xf')]);router[_0xc33e('0x8')]('/:id/downloads',controller[_0xc33e('0x10')]);router[_0xc33e('0x8')](_0xc33e('0x11'),auth[_0xc33e('0x9')](),controller[_0xc33e('0x12')]);router[_0xc33e('0x13')]('/',auth[_0xc33e('0x9')](),controller['create']);router[_0xc33e('0x13')](_0xc33e('0x11'),auth['isAuthenticated'](),controller['runTranscribe']);router[_0xc33e('0x14')](_0xc33e('0xc'),auth[_0xc33e('0x9')](),controller['update']);router[_0xc33e('0x15')](_0xc33e('0xc'),auth[_0xc33e('0x9')](),controller['destroy']);module[_0xc33e('0x16')]=router; \ No newline at end of file +var _0xbf60=['/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','create','post','runTranscribe','put','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','describe','/:id','show','download'];(function(_0x20ac9d,_0x5a1d56){var _0x4505e0=function(_0x50523a){while(--_0x50523a){_0x20ac9d['push'](_0x20ac9d['shift']());}};_0x4505e0(++_0x5a1d56);}(_0xbf60,0x1b3));var _0x0bf6=function(_0x8ae98b,_0x155f88){_0x8ae98b=_0x8ae98b-0x0;var _0xc30bd4=_0xbf60[_0x8ae98b];return _0xc30bd4;};'use strict';var multer=require('multer');var util=require(_0x0bf6('0x0'));var path=require('path');var timeout=require(_0x0bf6('0x1'));var express=require(_0x0bf6('0x2'));var router=express['Router']();var fs_extra=require(_0x0bf6('0x3'));var auth=require(_0x0bf6('0x4'));var interaction=require(_0x0bf6('0x5'));var config=require(_0x0bf6('0x6'));var controller=require(_0x0bf6('0x7'));router['get']('/',auth[_0x0bf6('0x8')](),controller[_0x0bf6('0x9')]);router[_0x0bf6('0xa')]('/describe',auth[_0x0bf6('0x8')](),controller[_0x0bf6('0xb')]);router['get'](_0x0bf6('0xc'),auth[_0x0bf6('0x8')](),controller[_0x0bf6('0xd')]);router['get']('/:id/download',auth[_0x0bf6('0x8')](),controller[_0x0bf6('0xe')]);router[_0x0bf6('0xa')](_0x0bf6('0xf'),controller[_0x0bf6('0x10')]);router['get'](_0x0bf6('0x11'),auth[_0x0bf6('0x8')](),controller[_0x0bf6('0x12')]);router['post']('/',auth[_0x0bf6('0x8')](),controller[_0x0bf6('0x13')]);router[_0x0bf6('0x14')](_0x0bf6('0x11'),auth[_0x0bf6('0x8')](),controller[_0x0bf6('0x15')]);router[_0x0bf6('0x16')](_0x0bf6('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0bf6('0xc'),auth[_0x0bf6('0x8')](),controller[_0x0bf6('0x17')]);module[_0x0bf6('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 6e94167..77d256e 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(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 2a4d481..ab2cac6 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 _0x0f1c=['count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','describe','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','download','extname','unlink','message','VoiceRecording\x20not\x20found','send','Not\x20found','sequelize','MD5','col','token','$and','push','filename','isNil','Entity\x20not\x20found','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','createBucket','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','TranscriptionJobStatus','runTranscribe','decryptFile','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','to-csv','querystring','papaparse','aws-sdk','uuid/v4','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'];(function(_0x25e296,_0x172c5e){var _0x3cd140=function(_0x2e82c1){while(--_0x2e82c1){_0x25e296['push'](_0x25e296['shift']());}};_0x3cd140(++_0x172c5e);}(_0x0f1c,0x1bc));var _0xc0f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f1c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc0f1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc0f1('0x1'));var rp=require(_0xc0f1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc0f1('0x3'));var util=require(_0xc0f1('0x4'));var path=require(_0xc0f1('0x5'));var sox=require(_0xc0f1('0x6'));var csv=require('to-csv');var ejs=require(_0xc0f1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc0f1('0x8'));var squel=require(_0xc0f1('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc0f1('0xa'));var querystring=require(_0xc0f1('0xb'));var Papa=require(_0xc0f1('0xc'));var AWS=require(_0xc0f1('0xd'));var uuidv4=require(_0xc0f1('0xe'));var Redis=require(_0xc0f1('0xf'));var authService=require(_0xc0f1('0x10'));var qs=require(_0xc0f1('0x11'));var as=require(_0xc0f1('0x12'));var hardwareService=require(_0xc0f1('0x13'));var logger=require(_0xc0f1('0x14'))(_0xc0f1('0x15'));var utils=require(_0xc0f1('0x16'));var config=require(_0xc0f1('0x17'));var licenseUtil=require(_0xc0f1('0x18'));var db=require(_0xc0f1('0x19'))['db'];function respondWithStatusCode(_0x82bc63,_0x5bdc5f){_0x5bdc5f=_0x5bdc5f||0xcc;return function(_0xd2cf54){if(_0xd2cf54){return _0x82bc63[_0xc0f1('0x1a')](_0x5bdc5f);}return _0x82bc63[_0xc0f1('0x1b')](_0x5bdc5f)[_0xc0f1('0x1c')]();};}function respondWithResult(_0x22d42e,_0x53024a){_0x53024a=_0x53024a||0xc8;return function(_0xbc5a2e){if(_0xbc5a2e){return _0x22d42e[_0xc0f1('0x1b')](_0x53024a)[_0xc0f1('0x1d')](_0xbc5a2e);}};}function respondWithFilteredResult(_0x12e004,_0x2bf121){return function(_0x16193f){if(_0x16193f){var _0x530f05=typeof _0x2bf121[_0xc0f1('0x1e')]===_0xc0f1('0x1f')&&typeof _0x2bf121[_0xc0f1('0x20')]==='undefined';var _0x3b6a4b=_0x16193f[_0xc0f1('0x21')];var _0x452b88=_0x530f05?0x0:_0x2bf121[_0xc0f1('0x1e')];var _0x2882a8=_0x530f05?_0x16193f[_0xc0f1('0x21')]:_0x2bf121['offset']+_0x2bf121[_0xc0f1('0x20')];var _0x51943b;if(_0x2882a8>=_0x3b6a4b){_0x2882a8=_0x3b6a4b;_0x51943b=0xc8;}else{_0x51943b=0xce;}_0x12e004[_0xc0f1('0x1b')](_0x51943b);return _0x12e004[_0xc0f1('0x22')](_0xc0f1('0x23'),_0x452b88+'-'+_0x2882a8+'/'+_0x3b6a4b)[_0xc0f1('0x1d')](_0x16193f);}return null;};}function patchUpdates(_0x2d89c7){return function(_0x1dfbe0){try{jsonpatch[_0xc0f1('0x24')](_0x1dfbe0,_0x2d89c7,!![]);}catch(_0x4ddbbe){return BPromise[_0xc0f1('0x25')](_0x4ddbbe);}return _0x1dfbe0[_0xc0f1('0x26')]();};}function saveUpdates(_0x55e263,_0x5add8a){return function(_0x65f7ab){if(_0x65f7ab){return _0x65f7ab['update'](_0x55e263)['then'](function(_0x2ff67c){return _0x2ff67c;});}return null;};}function removeEntity(_0x20d7d8,_0x37f6e0){return function(_0x2593c7){if(_0x2593c7){return _0x2593c7[_0xc0f1('0x27')]()[_0xc0f1('0x28')](function(){_0x20d7d8[_0xc0f1('0x1b')](0xcc)[_0xc0f1('0x1c')]();});}};}function handleEntityNotFound(_0x1471dd,_0x33d6d3){return function(_0x168ef8){if(!_0x168ef8){_0x1471dd['sendStatus'](0x194);}return _0x168ef8;};}function handleError(_0x346bf5,_0x23ec0){_0x23ec0=_0x23ec0||0x1f4;return function(_0x2bbd5b){logger[_0xc0f1('0x29')](_0x2bbd5b[_0xc0f1('0x2a')]);if(_0x2bbd5b[_0xc0f1('0x2b')]){delete _0x2bbd5b[_0xc0f1('0x2b')];}_0x346bf5[_0xc0f1('0x1b')](_0x23ec0)['send'](_0x2bbd5b);};}exports[_0xc0f1('0x2c')]=function(_0x16046f,_0x335959){var _0x58a7ac={},_0x3426ca={},_0x173dfc={'count':0x0,'rows':[]};var _0x19c527=_['map'](db[_0xc0f1('0x2d')][_0xc0f1('0x2e')],function(_0x2d1849){return{'name':_0x2d1849[_0xc0f1('0x2f')],'type':_0x2d1849['type'][_0xc0f1('0x30')]};});_0x3426ca[_0xc0f1('0x31')]=_[_0xc0f1('0x32')](_[_0xc0f1('0x33')](_0x19c527,_0xc0f1('0x2b')),['format']);_0x3426ca[_0xc0f1('0x34')]=_[_0xc0f1('0x35')](_0x16046f[_0xc0f1('0x34')]);_0x3426ca[_0xc0f1('0x36')]=_[_0xc0f1('0x37')](_0x3426ca['model'],_0x3426ca[_0xc0f1('0x34')]);_0x58a7ac[_0xc0f1('0x38')]=_[_0xc0f1('0x37')](_0x3426ca['model'],qs[_0xc0f1('0x39')](_0x16046f[_0xc0f1('0x34')][_0xc0f1('0x39')]));_0x58a7ac[_0xc0f1('0x38')]=_0x58a7ac[_0xc0f1('0x38')][_0xc0f1('0x3a')]?_0x58a7ac[_0xc0f1('0x38')]:_0x3426ca[_0xc0f1('0x31')];if(!_0x16046f['query'][_0xc0f1('0x3b')]('nolimit')){_0x58a7ac['limit']=qs[_0xc0f1('0x20')](_0x16046f[_0xc0f1('0x34')][_0xc0f1('0x20')]);_0x58a7ac[_0xc0f1('0x1e')]=qs['offset'](_0x16046f[_0xc0f1('0x34')][_0xc0f1('0x1e')]);}_0x58a7ac[_0xc0f1('0x3c')]=qs[_0xc0f1('0x3d')](_0x16046f['query']['sort']);_0x58a7ac['where']=qs[_0xc0f1('0x36')](_[_0xc0f1('0x3e')](_0x16046f['query'],_0x3426ca[_0xc0f1('0x36')]),_0x19c527);if(_0x16046f[_0xc0f1('0x34')][_0xc0f1('0x3f')]){_0x58a7ac[_0xc0f1('0x40')]=_[_0xc0f1('0x41')](_0x58a7ac[_0xc0f1('0x40')],{'$or':_[_0xc0f1('0x33')](_0x19c527,function(_0x5b965b){if(_0x5b965b[_0xc0f1('0x42')]!==_0xc0f1('0x43')){var _0x202793={};_0x202793[_0x5b965b['name']]={'$like':'%'+_0x16046f[_0xc0f1('0x34')][_0xc0f1('0x3f')]+'%'};return _0x202793;}})});}_0x58a7ac=_[_0xc0f1('0x41')]({},_0x58a7ac,_0x16046f[_0xc0f1('0x44')]);var _0x4d17d7={'where':_0x58a7ac[_0xc0f1('0x40')]};return db['VoiceRecording'][_0xc0f1('0x21')](_0x4d17d7)[_0xc0f1('0x28')](function(_0x16ad49){_0x173dfc[_0xc0f1('0x21')]=_0x16ad49;if(_0x16046f[_0xc0f1('0x34')][_0xc0f1('0x45')]){_0x58a7ac['include']=[{'all':!![]}];}return db['VoiceRecording'][_0xc0f1('0x46')](_0x58a7ac);})[_0xc0f1('0x28')](function(_0x2261fd){_0x173dfc[_0xc0f1('0x47')]=_0x2261fd;return _0x173dfc;})['then'](respondWithFilteredResult(_0x335959,_0x58a7ac))[_0xc0f1('0x48')](handleError(_0x335959,null));};exports[_0xc0f1('0x49')]=function(_0x301588,_0x3a884c){var _0x3b10a2={'raw':![],'where':{'id':_0x301588[_0xc0f1('0x4a')]['id']}},_0x1b1bff={};_0x1b1bff[_0xc0f1('0x31')]=_[_0xc0f1('0x35')](db['VoiceRecording'][_0xc0f1('0x2e')]);_0x1b1bff[_0xc0f1('0x34')]=_[_0xc0f1('0x35')](_0x301588[_0xc0f1('0x34')]);_0x1b1bff[_0xc0f1('0x36')]=_['intersection'](_0x1b1bff[_0xc0f1('0x31')],_0x1b1bff['query']);_0x3b10a2[_0xc0f1('0x38')]=_[_0xc0f1('0x37')](_0x1b1bff[_0xc0f1('0x31')],qs['fields'](_0x301588[_0xc0f1('0x34')]['fields']));_0x3b10a2['attributes']=_0x3b10a2[_0xc0f1('0x38')][_0xc0f1('0x3a')]?_0x3b10a2[_0xc0f1('0x38')]:_0x1b1bff['model'];if(_0x301588[_0xc0f1('0x34')][_0xc0f1('0x45')]){_0x3b10a2[_0xc0f1('0x4b')]=[{'all':!![]}];}_0x3b10a2=_['merge']({},_0x3b10a2,_0x301588[_0xc0f1('0x44')]);return db[_0xc0f1('0x2d')][_0xc0f1('0x4c')](_0x3b10a2)[_0xc0f1('0x28')](handleEntityNotFound(_0x3a884c,null))[_0xc0f1('0x28')](respondWithResult(_0x3a884c,null))['catch'](handleError(_0x3a884c,null));};exports[_0xc0f1('0x4d')]=function(_0x5ed28a,_0x2de0a7){return db['VoiceRecording'][_0xc0f1('0x4d')](_0x5ed28a[_0xc0f1('0x4e')],{})[_0xc0f1('0x28')](respondWithResult(_0x2de0a7,0xc9))[_0xc0f1('0x48')](handleError(_0x2de0a7,null));};exports[_0xc0f1('0x4f')]=function(_0x591947,_0x3420c1){if(_0x591947['body']['id']){delete _0x591947[_0xc0f1('0x4e')]['id'];}return db[_0xc0f1('0x2d')][_0xc0f1('0x4c')]({'where':{'id':_0x591947[_0xc0f1('0x4a')]['id']}})[_0xc0f1('0x28')](handleEntityNotFound(_0x3420c1,null))[_0xc0f1('0x28')](saveUpdates(_0x591947[_0xc0f1('0x4e')],null))['then'](respondWithResult(_0x3420c1,null))[_0xc0f1('0x48')](handleError(_0x3420c1,null));};exports[_0xc0f1('0x50')]=function(_0x52468c,_0x5309b3){return db[_0xc0f1('0x2d')][_0xc0f1('0x50')]()['then'](respondWithResult(_0x5309b3,null))[_0xc0f1('0x48')](handleError(_0x5309b3,null));};exports['download']=function(_0x326dd2,_0x3459aa,_0x28aa6b){var _0x1d15ef=require(_0xc0f1('0x51'));var _0x2a911c=![];var _0x1cbdf6={};if(_0x326dd2[_0xc0f1('0x34')][_0xc0f1('0x42')]&&_0x326dd2[_0xc0f1('0x34')][_0xc0f1('0x42')]==='uniqueid'){_0x1cbdf6[_0xc0f1('0x52')]=_0x326dd2['params']['id'];}else{_0x1cbdf6['id']=_0x326dd2[_0xc0f1('0x4a')]['id'];}return db['VoiceRecording'][_0xc0f1('0x4c')]({'where':_0x1cbdf6,'attributes':['id',_0xc0f1('0x53')],'raw':!![]})[_0xc0f1('0x28')](handleEntityNotFound(_0x3459aa,null))['then'](function(_0x50174c){if(_0x50174c){var _0x44bf60=_0x50174c[_0xc0f1('0x53')];var _0x1e4b14=util[_0xc0f1('0x54')](_0xc0f1('0x55'),_0x44bf60);if(fs[_0xc0f1('0x56')](_0x1e4b14)){_0x2a911c=!![];return _0x1d15ef['decryptFile'](_0x1e4b14,_0x44bf60,config[_0xc0f1('0x57')][_0xc0f1('0x58')])[_0xc0f1('0x28')](function(){return _0x50174c;});}return _0x50174c;}})[_0xc0f1('0x28')](function(_0x4db461){if(_0x4db461){var _0x4c8c21=_0x4db461['value'];if(!fs[_0xc0f1('0x56')](_0x4c8c21)){throw new db[(_0xc0f1('0x59'))][(_0xc0f1('0x5a'))]('VoiceRecording\x20not\x20found');}if(_0x4db461['filename']){return _0x3459aa[_0xc0f1('0x5b')](_0x4c8c21,_0x4db461['filename']+path[_0xc0f1('0x5c')](_0x4c8c21),function(){if(_0x2a911c){fs[_0xc0f1('0x5d')](_0x4c8c21);}});}else{return _0x3459aa['download'](_0x4c8c21,function(_0x5eecce){if(_0x2a911c){fs[_0xc0f1('0x5d')](_0x4c8c21);}});}}})['catch'](function(_0x2afa07){if(_0x2afa07[_0xc0f1('0x5e')]===_0xc0f1('0x5f')){_0x3459aa['status'](0x194)[_0xc0f1('0x60')](_0xc0f1('0x61'));}else{return handleError(_0x3459aa,null);}});};exports['downloads']=function(_0x24a56d,_0x1d6040,_0x4d04c7){var _0x2d283b=require('../../components/encryptor');var _0x2820ba=![];var _0x5d228f={'$and':[db[_0xc0f1('0x62')][_0xc0f1('0x40')](db[_0xc0f1('0x62')]['fn'](_0xc0f1('0x63'),db[_0xc0f1('0x62')][_0xc0f1('0x64')]('uniqueid')),_0x24a56d[_0xc0f1('0x34')][_0xc0f1('0x65')])]};if(_0x24a56d[_0xc0f1('0x34')][_0xc0f1('0x42')]&&_0x24a56d['query'][_0xc0f1('0x42')]===_0xc0f1('0x52')){_0x5d228f[_0xc0f1('0x66')]['push']({'uniqueid':_0x24a56d['params']['id']});}else{_0x5d228f['$and'][_0xc0f1('0x67')]({'id':_0x24a56d[_0xc0f1('0x4a')]['id']});}return db[_0xc0f1('0x2d')][_0xc0f1('0x4c')]({'where':_0x5d228f,'attributes':['id',_0xc0f1('0x53')],'raw':!![]})[_0xc0f1('0x28')](handleEntityNotFound(_0x1d6040,null))[_0xc0f1('0x28')](function(_0x5698d3){if(_0x5698d3){var _0x255695=util['format']('%s.cypher',_0x5698d3[_0xc0f1('0x53')]);if(fs['existsSync'](_0x255695)){_0x2820ba=!![];return _0x2d283b['decryptFile'](_0x255695,_0x5698d3['value'],config[_0xc0f1('0x57')][_0xc0f1('0x58')])['then'](function(){return _0x5698d3;});}return _0x5698d3;}})[_0xc0f1('0x28')](function(_0x34e84e){if(_0x34e84e){if(!fs['existsSync'](_0x34e84e['value'])){throw new db[(_0xc0f1('0x59'))][(_0xc0f1('0x5a'))](_0xc0f1('0x5f'));}if(_0x34e84e[_0xc0f1('0x68')]){return _0x1d6040[_0xc0f1('0x5b')](_0x34e84e[_0xc0f1('0x53')],_0x34e84e[_0xc0f1('0x68')]+path[_0xc0f1('0x5c')](_0x34e84e['value']),function(){if(_0x2820ba){fs[_0xc0f1('0x5d')](_0x34e84e[_0xc0f1('0x53')]);}});}else{return _0x1d6040['download'](_0x34e84e[_0xc0f1('0x53')],function(_0x4d8406){if(_0x2820ba){fs[_0xc0f1('0x5d')](_0x34e84e[_0xc0f1('0x53')]);}});}}})[_0xc0f1('0x48')](handleError(_0x1d6040,null));};exports[_0xc0f1('0x27')]=function(_0x5e2544,_0x2270ab){return db[_0xc0f1('0x2d')][_0xc0f1('0x4c')]({'where':{'id':_0x5e2544['params']['id']}})[_0xc0f1('0x28')](function(_0x5a8728){if(_[_0xc0f1('0x69')](_0x5a8728)){throw new ReferenceError(_0xc0f1('0x6a'));}return _0x5a8728;})['then'](function(_0x1e8d61){var _0x421818=_0x1e8d61['value'];logger[_0xc0f1('0x6b')]('cancellazione\x20fisica\x20documento\x20%s',_0x421818);if(!_[_0xc0f1('0x69')](_0x1e8d61[_0xc0f1('0x53')])&&fs['existsSync'](_0x421818)){logger[_0xc0f1('0x6b')](_0xc0f1('0x6c')+_0x421818+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc0f1('0x6d')](_0x421818);}_0x421818=_0x421818+_0xc0f1('0x6e');if(!_[_0xc0f1('0x69')](_0x1e8d61[_0xc0f1('0x53')])&&fs['existsSync'](_0x421818)){logger[_0xc0f1('0x6b')]('File:\x20\x22'+_0x421818+_0xc0f1('0x6f'));fs[_0xc0f1('0x6d')](_0x421818);}return _0x1e8d61;})[_0xc0f1('0x28')](function(_0x698e2e){if(!_0x698e2e)throw new InternalError();return _0x698e2e[_0xc0f1('0x27')]();})[_0xc0f1('0x28')](function(){_0x2270ab[_0xc0f1('0x1b')](0xcc)['end']();})[_0xc0f1('0x48')](handleError(_0x2270ab,null));};function getBucketslist(_0x2b5725,_0x2ae8ae,_0x2cf98d){return new Promise(function(_0x178f7c,_0xd2a2d8){var _0x272f59=new AWS['S3']({'accessKeyId':_0x2ae8ae,'secretAccessKey':_0x2b5725,'region':_0x2cf98d});_0x272f59['listBuckets']({},function(_0x222b03,_0x585e53){if(_0x222b03){return _0xd2a2d8(_0x222b03);}else{return _0x178f7c(_0x585e53);}});});}function createBucket(_0x1b19ee,_0x39c589,_0x3e087f,_0x1f2b98){return new Promise(function(_0x1a1727,_0xdbf3f8){var _0x3bb5f5=new AWS['S3']({'accessKeyId':_0x39c589,'secretAccessKey':_0x1b19ee,'region':_0x3e087f});_0x3bb5f5[_0xc0f1('0x70')]({'Bucket':_0x1f2b98},function(_0x28a522,_0x55731f){if(_0x28a522){return _0xdbf3f8(_0x28a522);}else{return _0x1a1727(_0x55731f);}});});}function uploadFile(_0x354bb9,_0x3c421c,_0x287671,_0x5e8a2f,_0x5e9f1d,_0x53d6c5){return new Promise(function(_0x2471d0,_0xb120b3){var _0x261517=new AWS['S3']({'accessKeyId':_0x3c421c,'secretAccessKey':_0x354bb9,'region':_0x287671});_0x261517[_0xc0f1('0x71')]({'Bucket':_0x5e8a2f,'Key':_0x5e9f1d,'Body':_0x53d6c5},function(_0x5a8083,_0x1d0f5a){if(_0x5a8083){return _0xb120b3(_0x5a8083);}else{return _0x2471d0(_0x1d0f5a);}});});}function startTranscribe(_0xe237a4,_0x320bdd,_0x4a00af,_0x528246,_0x43d367,_0x80a22b){return new Promise(function(_0x5963d7,_0x2ebbff){var _0x19cb99=new AWS[(_0xc0f1('0x72'))]({'accessKeyId':_0x320bdd,'secretAccessKey':_0xe237a4,'region':_0x4a00af});_0x19cb99[_0xc0f1('0x73')]({'TranscriptionJobName':_0x528246,'LanguageCode':_0x43d367,'Media':{'MediaFileUri':_0x80a22b}},function(_0x26aff5,_0x427ac2){if(_0x26aff5){return _0x2ebbff(_0x26aff5);}else{return _0x5963d7(_0x427ac2);}});});}function transcribe(_0x3d1fad,_0x2a6834,_0x2f2e46,_0x5be568,_0x5add85,_0x382bd4,_0x41de5e){return new Promise(function(_0x468d55,_0x7b18c6){var _0x431439={};logger[_0xc0f1('0x6b')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x3d1fad,_0x5add85));return uploadFile(_0x2a6834,_0x2f2e46,_0x5be568,_0x5add85,path[_0xc0f1('0x74')](_0x382bd4),fs[_0xc0f1('0x75')](_0x382bd4))[_0xc0f1('0x28')](function(_0x5d1818){logger['info'](util[_0xc0f1('0x54')](_0xc0f1('0x76'),_0x3d1fad,_0x5add85,_0x5d1818[_0xc0f1('0x77')]));_0x431439[_0xc0f1('0x78')]=_0x5d1818[_0xc0f1('0x79')];_0x431439['location']=_0x5d1818[_0xc0f1('0x77')];logger[_0xc0f1('0x6b')](util[_0xc0f1('0x54')](_0xc0f1('0x7a'),_0x3d1fad));return startTranscribe(_0x2a6834,_0x2f2e46,_0x5be568,uuidv4(),_0x41de5e,_0x5d1818['Location']);})[_0xc0f1('0x28')](function(_0x4b6b19){logger['info'](util[_0xc0f1('0x54')](_0xc0f1('0x7b'),_0x3d1fad,_0x4b6b19['TranscriptionJob']['TranscriptionJobName']));_0x431439['transcribeName']=_0x4b6b19[_0xc0f1('0x7c')][_0xc0f1('0x7d')];_0x431439['transcribeStatus']=_0x4b6b19[_0xc0f1('0x7c')][_0xc0f1('0x7e')];return _0x468d55(_0x431439);})[_0xc0f1('0x48')](function(_0x162892){return _0x7b18c6(_0x162892);});});}exports[_0xc0f1('0x7f')]=function(_0x29b8d4,_0x3a2a7b,_0x36d1fc){var _0x4b57a6;var _0x20562b;var _0x288e30;var _0x50812c=require(_0xc0f1('0x51'));return db['VoiceRecording']['findOne']({'where':{'id':_0x29b8d4[_0xc0f1('0x4a')]['id']}})['then'](function(_0x37f55e){if(_0x37f55e){var _0x529305=util['format'](_0xc0f1('0x55'),_0x37f55e[_0xc0f1('0x53')]);if(fs[_0xc0f1('0x56')](_0x529305)){cypher=!![];return _0x50812c[_0xc0f1('0x80')](_0x529305,_0x37f55e[_0xc0f1('0x53')],config['secrets'][_0xc0f1('0x58')])[_0xc0f1('0x28')](function(){return _0x37f55e;});}return _0x37f55e;}})[_0xc0f1('0x28')](function(_0x33ea27){if(!_0x33ea27){throw new db[(_0xc0f1('0x59'))][(_0xc0f1('0x5a'))](_0xc0f1('0x81'));}_0x20562b=_0x33ea27;return db[_0xc0f1('0x82')][_0xc0f1('0x83')]({'where':{'id':0x1}});})[_0xc0f1('0x28')](handleEntityNotFound(_0x3a2a7b,null))[_0xc0f1('0x28')](function(_0x45b7ca){if(_0x45b7ca){_0x4b57a6=_0x45b7ca;if(!_0x4b57a6[_0xc0f1('0x84')]||!_0x4b57a6[_0xc0f1('0x85')]||!_0x4b57a6[_0xc0f1('0x86')]||!_0x4b57a6['language']||!_0x4b57a6[_0xc0f1('0x78')]){throw new db['Sequelize'][(_0xc0f1('0x5a'))](_0xc0f1('0x87'));}if(_0x29b8d4['body'][_0xc0f1('0x88')]&&(!_0x4b57a6[_0xc0f1('0x89')]||!_0x4b57a6[_0xc0f1('0x8a')]||!_0x4b57a6[_0xc0f1('0x8b')]||!_0x4b57a6[_0xc0f1('0x8c')]||!_0x4b57a6[_0xc0f1('0x78')])){throw new db['Sequelize'][(_0xc0f1('0x5a'))](_0xc0f1('0x8d'));}return db[_0xc0f1('0x8e')][_0xc0f1('0x83')]({'where':{'id':_0x4b57a6['transcribeAccountId']}});}})[_0xc0f1('0x28')](function(_0x5000fa){if(!_0x5000fa){throw new db[(_0xc0f1('0x59'))][(_0xc0f1('0x5a'))](_0xc0f1('0x8f'));}if(!_0x5000fa['data1']||!_0x5000fa[_0xc0f1('0x90')]){throw new db[(_0xc0f1('0x59'))][(_0xc0f1('0x5a'))](_0xc0f1('0x91'));}_0x288e30=_0x5000fa;return getBucketslist(_0x288e30[_0xc0f1('0x92')],_0x288e30[_0xc0f1('0x90')],_0x4b57a6['transcribeRegion']);})[_0xc0f1('0x28')](function(_0x229891){if(_0x229891&&_0x229891['Buckets']){var _0x1f9c5a=_[_0xc0f1('0x4c')](_0x229891[_0xc0f1('0x93')],function(_0x27b489){return _0x27b489[_0xc0f1('0x94')]===_0x4b57a6[_0xc0f1('0x78')];});if(!_0x1f9c5a){logger[_0xc0f1('0x6b')](util['format'](_0xc0f1('0x95'),_0x29b8d4[_0xc0f1('0x4a')]['id'],_0x4b57a6['bucket']));return createBucket(_0x288e30[_0xc0f1('0x92')],_0x288e30[_0xc0f1('0x90')],_0x4b57a6['transcribeRegion'],_0x4b57a6[_0xc0f1('0x78')]);}logger[_0xc0f1('0x6b')](util[_0xc0f1('0x54')](_0xc0f1('0x96'),_0x29b8d4['params']['id'],_0x4b57a6[_0xc0f1('0x78')]));return;}})[_0xc0f1('0x28')](function(_0x4f712a){if(_0x20562b['transcribeStatus']===_0xc0f1('0x97')){return transcribe(_0x29b8d4[_0xc0f1('0x4a')]['id'],_0x288e30[_0xc0f1('0x92')],_0x288e30[_0xc0f1('0x90')],_0x4b57a6[_0xc0f1('0x86')],_0x4b57a6[_0xc0f1('0x78')],_0x20562b[_0xc0f1('0x53')],_0x4b57a6[_0xc0f1('0x8c')]);}else{logger[_0xc0f1('0x6b')](util[_0xc0f1('0x54')](_0xc0f1('0x98'),_0x29b8d4[_0xc0f1('0x4a')]['id']));return{'transcribeStatus':_0xc0f1('0x99')};}})['then'](function(_0x326b8e){if(_0x326b8e){_0x326b8e[_0xc0f1('0x9a')]=_0x29b8d4['body'][_0xc0f1('0x88')];return _0x20562b[_0xc0f1('0x9b')](_0x326b8e);}})[_0xc0f1('0x28')](respondWithResult(_0x3a2a7b,null))[_0xc0f1('0x48')](handleError(_0x3a2a7b,null));};function writeFile(_0x3de6f4,_0x4dd1dd){return new Promise(function(_0x2d71ad,_0x1fbcc6){fs['writeFile'](_0x4dd1dd,_0x3de6f4,function(_0x41ade6,_0x41c3a0){if(_0x41ade6){return _0x1fbcc6(_0x41ade6);}else{return _0x2d71ad(_0x41c3a0);}});});}exports[_0xc0f1('0x9c')]=function(_0x1a5e86,_0x2d9b76,_0xec7a4){return db['VoiceRecording']['findOne']({'where':{'id':_0x1a5e86[_0xc0f1('0x4a')]['id']}})[_0xc0f1('0x28')](handleEntityNotFound(_0x2d9b76))[_0xc0f1('0x28')](function(_0x39ad99){if(_0x39ad99&&_0x39ad99[_0xc0f1('0x9d')]){var _0x247a2a=_0x39ad99[_0xc0f1('0x9d')];var _0x46d3b4=config['root']+_0xc0f1('0x9e')+_0x39ad99['id']+'.txt';if(fs[_0xc0f1('0x56')](_0x46d3b4)){return _0x46d3b4;}return writeFile(_0x247a2a,_0x46d3b4)['then'](function(){return _0x46d3b4;});}else{throw new db['Sequelize']['ValidationError']('Transcript\x20not\x20available');}})['then'](function(_0x43901c){return _0x2d9b76[_0xc0f1('0x5b')](_0x43901c);})[_0xc0f1('0x48')](handleError(_0x2d9b76));}; \ No newline at end of file +var _0xb0f9=['message','Not\x20found','downloads','sequelize','MD5','token','push','$and','format','secrets','extname','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','createBucket','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','aws-sdk','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','keys','include','find','catch','create','body','params','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink'];(function(_0x79b534,_0x55ee5f){var _0x52579c=function(_0x10b915){while(--_0x10b915){_0x79b534['push'](_0x79b534['shift']());}};_0x52579c(++_0x55ee5f);}(_0xb0f9,0xd9));var _0x9b0f=function(_0x18b535,_0x3ac87f){_0x18b535=_0x18b535-0x0;var _0x27dcb3=_0xb0f9[_0x18b535];return _0x27dcb3;};'use strict';var emlformat=require(_0x9b0f('0x0'));var rimraf=require(_0x9b0f('0x1'));var zipdir=require(_0x9b0f('0x2'));var jsonpatch=require(_0x9b0f('0x3'));var rp=require(_0x9b0f('0x4'));var moment=require(_0x9b0f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9b0f('0x6'));var util=require(_0x9b0f('0x7'));var path=require(_0x9b0f('0x8'));var sox=require(_0x9b0f('0x9'));var csv=require(_0x9b0f('0xa'));var ejs=require(_0x9b0f('0xb'));var fs=require('fs');var fs_extra=require(_0x9b0f('0xc'));var _=require(_0x9b0f('0xd'));var squel=require(_0x9b0f('0xe'));var crypto=require('crypto');var jsforce=require(_0x9b0f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9b0f('0xa'));var querystring=require(_0x9b0f('0x10'));var Papa=require(_0x9b0f('0x11'));var AWS=require(_0x9b0f('0x12'));var uuidv4=require('uuid/v4');var Redis=require(_0x9b0f('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9b0f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b0f('0x15'))(_0x9b0f('0x16'));var utils=require('../../config/utils');var config=require(_0x9b0f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b0f('0x18'))['db'];function respondWithStatusCode(_0x207d02,_0x1d846f){_0x1d846f=_0x1d846f||0xcc;return function(_0x237734){if(_0x237734){return _0x207d02[_0x9b0f('0x19')](_0x1d846f);}return _0x207d02[_0x9b0f('0x1a')](_0x1d846f)[_0x9b0f('0x1b')]();};}function respondWithResult(_0x385ea7,_0x438e99){_0x438e99=_0x438e99||0xc8;return function(_0x373d57){if(_0x373d57){return _0x385ea7[_0x9b0f('0x1a')](_0x438e99)[_0x9b0f('0x1c')](_0x373d57);}};}function respondWithFilteredResult(_0x206bf1,_0x33e239){return function(_0x2349a0){if(_0x2349a0){var _0x1bddbd=typeof _0x33e239['offset']==='undefined'&&typeof _0x33e239[_0x9b0f('0x1d')]===_0x9b0f('0x1e');var _0x1262fc=_0x2349a0[_0x9b0f('0x1f')];var _0x9eb872=_0x1bddbd?0x0:_0x33e239[_0x9b0f('0x20')];var _0x481d25=_0x1bddbd?_0x2349a0[_0x9b0f('0x1f')]:_0x33e239[_0x9b0f('0x20')]+_0x33e239['limit'];var _0x181597;if(_0x481d25>=_0x1262fc){_0x481d25=_0x1262fc;_0x181597=0xc8;}else{_0x181597=0xce;}_0x206bf1[_0x9b0f('0x1a')](_0x181597);return _0x206bf1[_0x9b0f('0x21')](_0x9b0f('0x22'),_0x9eb872+'-'+_0x481d25+'/'+_0x1262fc)[_0x9b0f('0x1c')](_0x2349a0);}return null;};}function patchUpdates(_0x2fec94){return function(_0x43c4ed){try{jsonpatch[_0x9b0f('0x23')](_0x43c4ed,_0x2fec94,!![]);}catch(_0x51a0ea){return BPromise[_0x9b0f('0x24')](_0x51a0ea);}return _0x43c4ed['save']();};}function saveUpdates(_0x3654e9,_0x2e20ce){return function(_0x1a99fc){if(_0x1a99fc){return _0x1a99fc[_0x9b0f('0x25')](_0x3654e9)[_0x9b0f('0x26')](function(_0x1dfb39){return _0x1dfb39;});}return null;};}function removeEntity(_0x46ae32,_0x3b358a){return function(_0x33f95e){if(_0x33f95e){return _0x33f95e['destroy']()[_0x9b0f('0x26')](function(){_0x46ae32[_0x9b0f('0x1a')](0xcc)[_0x9b0f('0x1b')]();});}};}function handleEntityNotFound(_0x142c72,_0x576fe7){return function(_0x3ad5b4){if(!_0x3ad5b4){_0x142c72[_0x9b0f('0x19')](0x194);}return _0x3ad5b4;};}function handleError(_0x3bbb1d,_0x48b35d){_0x48b35d=_0x48b35d||0x1f4;return function(_0xfad038){logger[_0x9b0f('0x27')](_0xfad038[_0x9b0f('0x28')]);if(_0xfad038[_0x9b0f('0x29')]){delete _0xfad038[_0x9b0f('0x29')];}_0x3bbb1d[_0x9b0f('0x1a')](_0x48b35d)[_0x9b0f('0x2a')](_0xfad038);};}exports[_0x9b0f('0x2b')]=function(_0x3b7731,_0x302004){var _0x3365c0={},_0x197ce8={},_0xb47c30={'count':0x0,'rows':[]};var _0x2092d8=_[_0x9b0f('0x2c')](db[_0x9b0f('0x2d')][_0x9b0f('0x2e')],function(_0x333e69){return{'name':_0x333e69[_0x9b0f('0x2f')],'type':_0x333e69['type'][_0x9b0f('0x30')]};});_0x197ce8['model']=_['differenceBy'](_['map'](_0x2092d8,_0x9b0f('0x29')),['format']);_0x197ce8['query']=_['keys'](_0x3b7731[_0x9b0f('0x31')]);_0x197ce8[_0x9b0f('0x32')]=_[_0x9b0f('0x33')](_0x197ce8[_0x9b0f('0x34')],_0x197ce8[_0x9b0f('0x31')]);_0x3365c0['attributes']=_[_0x9b0f('0x33')](_0x197ce8[_0x9b0f('0x34')],qs[_0x9b0f('0x35')](_0x3b7731[_0x9b0f('0x31')][_0x9b0f('0x35')]));_0x3365c0[_0x9b0f('0x36')]=_0x3365c0['attributes'][_0x9b0f('0x37')]?_0x3365c0['attributes']:_0x197ce8[_0x9b0f('0x34')];if(!_0x3b7731[_0x9b0f('0x31')][_0x9b0f('0x38')]('nolimit')){_0x3365c0[_0x9b0f('0x1d')]=qs[_0x9b0f('0x1d')](_0x3b7731[_0x9b0f('0x31')][_0x9b0f('0x1d')]);_0x3365c0[_0x9b0f('0x20')]=qs[_0x9b0f('0x20')](_0x3b7731[_0x9b0f('0x31')]['offset']);}_0x3365c0[_0x9b0f('0x39')]=qs['sort'](_0x3b7731['query'][_0x9b0f('0x3a')]);_0x3365c0[_0x9b0f('0x3b')]=qs[_0x9b0f('0x32')](_[_0x9b0f('0x3c')](_0x3b7731['query'],_0x197ce8[_0x9b0f('0x32')]),_0x2092d8);if(_0x3b7731[_0x9b0f('0x31')][_0x9b0f('0x3d')]){_0x3365c0[_0x9b0f('0x3b')]=_[_0x9b0f('0x3e')](_0x3365c0['where'],{'$or':_[_0x9b0f('0x2c')](_0x2092d8,function(_0x539198){if(_0x539198[_0x9b0f('0x3f')]!=='VIRTUAL'){var _0x2f970c={};_0x2f970c[_0x539198[_0x9b0f('0x29')]]={'$like':'%'+_0x3b7731[_0x9b0f('0x31')][_0x9b0f('0x3d')]+'%'};return _0x2f970c;}})});}_0x3365c0=_[_0x9b0f('0x3e')]({},_0x3365c0,_0x3b7731[_0x9b0f('0x40')]);var _0x1e3c32={'where':_0x3365c0[_0x9b0f('0x3b')]};return db[_0x9b0f('0x2d')][_0x9b0f('0x1f')](_0x1e3c32)['then'](function(_0x3080c4){_0xb47c30['count']=_0x3080c4;if(_0x3b7731[_0x9b0f('0x31')][_0x9b0f('0x41')]){_0x3365c0['include']=[{'all':!![]}];}return db[_0x9b0f('0x2d')]['findAll'](_0x3365c0);})[_0x9b0f('0x26')](function(_0x5b5c0f){_0xb47c30['rows']=_0x5b5c0f;return _0xb47c30;})[_0x9b0f('0x26')](respondWithFilteredResult(_0x302004,_0x3365c0))['catch'](handleError(_0x302004,null));};exports['show']=function(_0x29af66,_0x555f6a){var _0x3bc05e={'raw':![],'where':{'id':_0x29af66['params']['id']}},_0x3f783f={};_0x3f783f[_0x9b0f('0x34')]=_['keys'](db[_0x9b0f('0x2d')]['rawAttributes']);_0x3f783f[_0x9b0f('0x31')]=_[_0x9b0f('0x42')](_0x29af66['query']);_0x3f783f[_0x9b0f('0x32')]=_[_0x9b0f('0x33')](_0x3f783f['model'],_0x3f783f['query']);_0x3bc05e[_0x9b0f('0x36')]=_[_0x9b0f('0x33')](_0x3f783f[_0x9b0f('0x34')],qs[_0x9b0f('0x35')](_0x29af66['query']['fields']));_0x3bc05e[_0x9b0f('0x36')]=_0x3bc05e[_0x9b0f('0x36')][_0x9b0f('0x37')]?_0x3bc05e[_0x9b0f('0x36')]:_0x3f783f[_0x9b0f('0x34')];if(_0x29af66['query'][_0x9b0f('0x41')]){_0x3bc05e[_0x9b0f('0x43')]=[{'all':!![]}];}_0x3bc05e=_[_0x9b0f('0x3e')]({},_0x3bc05e,_0x29af66[_0x9b0f('0x40')]);return db['VoiceRecording'][_0x9b0f('0x44')](_0x3bc05e)['then'](handleEntityNotFound(_0x555f6a,null))[_0x9b0f('0x26')](respondWithResult(_0x555f6a,null))[_0x9b0f('0x45')](handleError(_0x555f6a,null));};exports[_0x9b0f('0x46')]=function(_0x562906,_0x2994ea){return db[_0x9b0f('0x2d')][_0x9b0f('0x46')](_0x562906[_0x9b0f('0x47')],{})[_0x9b0f('0x26')](respondWithResult(_0x2994ea,0xc9))[_0x9b0f('0x45')](handleError(_0x2994ea,null));};exports[_0x9b0f('0x25')]=function(_0x39624c,_0x454e62){if(_0x39624c[_0x9b0f('0x47')]['id']){delete _0x39624c[_0x9b0f('0x47')]['id'];}return db[_0x9b0f('0x2d')][_0x9b0f('0x44')]({'where':{'id':_0x39624c[_0x9b0f('0x48')]['id']}})['then'](handleEntityNotFound(_0x454e62,null))[_0x9b0f('0x26')](saveUpdates(_0x39624c[_0x9b0f('0x47')],null))['then'](respondWithResult(_0x454e62,null))[_0x9b0f('0x45')](handleError(_0x454e62,null));};exports[_0x9b0f('0x49')]=function(_0x4421b2,_0xf835e8){return db[_0x9b0f('0x2d')][_0x9b0f('0x49')]()[_0x9b0f('0x26')](respondWithResult(_0xf835e8,null))[_0x9b0f('0x45')](handleError(_0xf835e8,null));};exports[_0x9b0f('0x4a')]=function(_0x1ffd8d,_0x3b6af6,_0x2e3657){var _0x1978fe=require(_0x9b0f('0x4b'));var _0x26220e=![];var _0x5b2299={};if(_0x1ffd8d[_0x9b0f('0x31')][_0x9b0f('0x3f')]&&_0x1ffd8d[_0x9b0f('0x31')][_0x9b0f('0x3f')]===_0x9b0f('0x4c')){_0x5b2299[_0x9b0f('0x4c')]=_0x1ffd8d[_0x9b0f('0x48')]['id'];}else{_0x5b2299['id']=_0x1ffd8d[_0x9b0f('0x48')]['id'];}return db['VoiceRecording'][_0x9b0f('0x44')]({'where':_0x5b2299,'attributes':['id',_0x9b0f('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x3b6af6,null))[_0x9b0f('0x26')](function(_0x369c90){if(_0x369c90){var _0x1dd6a2=_0x369c90[_0x9b0f('0x4d')];var _0x3ff9ae=util['format'](_0x9b0f('0x4e'),_0x1dd6a2);if(fs[_0x9b0f('0x4f')](_0x3ff9ae)){_0x26220e=!![];return _0x1978fe[_0x9b0f('0x50')](_0x3ff9ae,_0x1dd6a2,config['secrets'][_0x9b0f('0x51')])['then'](function(){return _0x369c90;});}return _0x369c90;}})[_0x9b0f('0x26')](function(_0x4a7020){if(_0x4a7020){var _0x4d2c62=_0x4a7020['value'];if(!fs[_0x9b0f('0x4f')](_0x4d2c62)){throw new db[(_0x9b0f('0x52'))][(_0x9b0f('0x53'))](_0x9b0f('0x54'));}if(_0x4a7020[_0x9b0f('0x55')]){return _0x3b6af6['download'](_0x4d2c62,_0x4a7020['filename']+path['extname'](_0x4d2c62),function(){if(_0x26220e){fs[_0x9b0f('0x56')](_0x4d2c62);}});}else{return _0x3b6af6[_0x9b0f('0x4a')](_0x4d2c62,function(_0x68827a){if(_0x26220e){fs[_0x9b0f('0x56')](_0x4d2c62);}});}}})[_0x9b0f('0x45')](function(_0x76e33a){if(_0x76e33a[_0x9b0f('0x57')]===_0x9b0f('0x54')){_0x3b6af6[_0x9b0f('0x1a')](0x194)['send'](_0x9b0f('0x58'));}else{return handleError(_0x3b6af6,null);}});};exports[_0x9b0f('0x59')]=function(_0x325c58,_0x4fed4a,_0x2c37c8){var _0x502cb0=require(_0x9b0f('0x4b'));var _0x319039=![];var _0x218b27={'$and':[db[_0x9b0f('0x5a')]['where'](db[_0x9b0f('0x5a')]['fn'](_0x9b0f('0x5b'),db['sequelize']['col'](_0x9b0f('0x4c'))),_0x325c58[_0x9b0f('0x31')][_0x9b0f('0x5c')])]};if(_0x325c58[_0x9b0f('0x31')][_0x9b0f('0x3f')]&&_0x325c58[_0x9b0f('0x31')][_0x9b0f('0x3f')]===_0x9b0f('0x4c')){_0x218b27['$and'][_0x9b0f('0x5d')]({'uniqueid':_0x325c58['params']['id']});}else{_0x218b27[_0x9b0f('0x5e')][_0x9b0f('0x5d')]({'id':_0x325c58['params']['id']});}return db[_0x9b0f('0x2d')][_0x9b0f('0x44')]({'where':_0x218b27,'attributes':['id',_0x9b0f('0x4d')],'raw':!![]})[_0x9b0f('0x26')](handleEntityNotFound(_0x4fed4a,null))[_0x9b0f('0x26')](function(_0x1c1405){if(_0x1c1405){var _0x2acf4a=util[_0x9b0f('0x5f')](_0x9b0f('0x4e'),_0x1c1405[_0x9b0f('0x4d')]);if(fs['existsSync'](_0x2acf4a)){_0x319039=!![];return _0x502cb0[_0x9b0f('0x50')](_0x2acf4a,_0x1c1405[_0x9b0f('0x4d')],config[_0x9b0f('0x60')]['recording'])['then'](function(){return _0x1c1405;});}return _0x1c1405;}})[_0x9b0f('0x26')](function(_0x52ab48){if(_0x52ab48){if(!fs[_0x9b0f('0x4f')](_0x52ab48['value'])){throw new db[(_0x9b0f('0x52'))][(_0x9b0f('0x53'))](_0x9b0f('0x54'));}if(_0x52ab48[_0x9b0f('0x55')]){return _0x4fed4a[_0x9b0f('0x4a')](_0x52ab48[_0x9b0f('0x4d')],_0x52ab48['filename']+path[_0x9b0f('0x61')](_0x52ab48[_0x9b0f('0x4d')]),function(){if(_0x319039){fs[_0x9b0f('0x56')](_0x52ab48[_0x9b0f('0x4d')]);}});}else{return _0x4fed4a[_0x9b0f('0x4a')](_0x52ab48[_0x9b0f('0x4d')],function(_0x5d0420){if(_0x319039){fs[_0x9b0f('0x56')](_0x52ab48[_0x9b0f('0x4d')]);}});}}})[_0x9b0f('0x45')](handleError(_0x4fed4a,null));};exports[_0x9b0f('0x62')]=function(_0x3fd351,_0x178504){return db['VoiceRecording'][_0x9b0f('0x44')]({'where':{'id':_0x3fd351[_0x9b0f('0x48')]['id']}})[_0x9b0f('0x26')](function(_0x1dfb5d){if(_[_0x9b0f('0x63')](_0x1dfb5d)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1dfb5d;})[_0x9b0f('0x26')](function(_0x6f6e6b){var _0x57d54d=_0x6f6e6b['value'];logger[_0x9b0f('0x64')](_0x9b0f('0x65'),_0x57d54d);if(!_[_0x9b0f('0x63')](_0x6f6e6b[_0x9b0f('0x4d')])&&fs[_0x9b0f('0x4f')](_0x57d54d)){logger['info'](_0x9b0f('0x66')+_0x57d54d+_0x9b0f('0x67'));fs[_0x9b0f('0x68')](_0x57d54d);}_0x57d54d=_0x57d54d+'.cypher';if(!_[_0x9b0f('0x63')](_0x6f6e6b[_0x9b0f('0x4d')])&&fs[_0x9b0f('0x4f')](_0x57d54d)){logger[_0x9b0f('0x64')](_0x9b0f('0x66')+_0x57d54d+_0x9b0f('0x67'));fs['unlinkSync'](_0x57d54d);}return _0x6f6e6b;})['then'](function(_0x2173d9){if(!_0x2173d9)throw new InternalError();return _0x2173d9[_0x9b0f('0x62')]();})[_0x9b0f('0x26')](function(){_0x178504[_0x9b0f('0x1a')](0xcc)[_0x9b0f('0x1b')]();})[_0x9b0f('0x45')](handleError(_0x178504,null));};function getBucketslist(_0x53eb0b,_0x5559cc,_0x10a956){return new Promise(function(_0x165366,_0x46c08d){var _0x2bdf07=new AWS['S3']({'accessKeyId':_0x5559cc,'secretAccessKey':_0x53eb0b,'region':_0x10a956});_0x2bdf07['listBuckets']({},function(_0x59cafc,_0x2a651f){if(_0x59cafc){return _0x46c08d(_0x59cafc);}else{return _0x165366(_0x2a651f);}});});}function createBucket(_0x9073c,_0x588422,_0x48e8d4,_0xfb6fa2){return new Promise(function(_0x239902,_0x4730fe){var _0x2a135a=new AWS['S3']({'accessKeyId':_0x588422,'secretAccessKey':_0x9073c,'region':_0x48e8d4});_0x2a135a[_0x9b0f('0x69')]({'Bucket':_0xfb6fa2},function(_0x116991,_0x3bfecb){if(_0x116991){return _0x4730fe(_0x116991);}else{return _0x239902(_0x3bfecb);}});});}function uploadFile(_0x216207,_0xdcba9c,_0x4818d5,_0x4bbe44,_0x27ae68,_0x1c7cfc){return new Promise(function(_0x47e151,_0x3772bc){var _0x3399fa=new AWS['S3']({'accessKeyId':_0xdcba9c,'secretAccessKey':_0x216207,'region':_0x4818d5});_0x3399fa['upload']({'Bucket':_0x4bbe44,'Key':_0x27ae68,'Body':_0x1c7cfc},function(_0x2e8a13,_0x4c35fd){if(_0x2e8a13){return _0x3772bc(_0x2e8a13);}else{return _0x47e151(_0x4c35fd);}});});}function startTranscribe(_0x2c1d0c,_0x284064,_0x4bbf6d,_0x3dc11b,_0x42b2b0,_0x1d619d){return new Promise(function(_0x1c7711,_0x288af2){var _0x26e8e5=new AWS['TranscribeService']({'accessKeyId':_0x284064,'secretAccessKey':_0x2c1d0c,'region':_0x4bbf6d});_0x26e8e5[_0x9b0f('0x6a')]({'TranscriptionJobName':_0x3dc11b,'LanguageCode':_0x42b2b0,'Media':{'MediaFileUri':_0x1d619d}},function(_0x224de9,_0x464c38){if(_0x224de9){return _0x288af2(_0x224de9);}else{return _0x1c7711(_0x464c38);}});});}function transcribe(_0x3a43ec,_0x454fc7,_0x18c46f,_0x37c8df,_0x32102e,_0x1c8889,_0x530be6){return new Promise(function(_0x4ddd2b,_0x2b736d){var _0x226923={};logger[_0x9b0f('0x64')](util[_0x9b0f('0x5f')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x3a43ec,_0x32102e));return uploadFile(_0x454fc7,_0x18c46f,_0x37c8df,_0x32102e,path[_0x9b0f('0x6b')](_0x1c8889),fs[_0x9b0f('0x6c')](_0x1c8889))[_0x9b0f('0x26')](function(_0xa72e33){logger[_0x9b0f('0x64')](util[_0x9b0f('0x5f')](_0x9b0f('0x6d'),_0x3a43ec,_0x32102e,_0xa72e33[_0x9b0f('0x6e')]));_0x226923[_0x9b0f('0x6f')]=_0xa72e33[_0x9b0f('0x70')];_0x226923[_0x9b0f('0x71')]=_0xa72e33[_0x9b0f('0x6e')];logger[_0x9b0f('0x64')](util[_0x9b0f('0x5f')](_0x9b0f('0x72'),_0x3a43ec));return startTranscribe(_0x454fc7,_0x18c46f,_0x37c8df,uuidv4(),_0x530be6,_0xa72e33['Location']);})[_0x9b0f('0x26')](function(_0x5f4fd2){logger[_0x9b0f('0x64')](util[_0x9b0f('0x5f')](_0x9b0f('0x73'),_0x3a43ec,_0x5f4fd2[_0x9b0f('0x74')][_0x9b0f('0x75')]));_0x226923[_0x9b0f('0x76')]=_0x5f4fd2[_0x9b0f('0x74')][_0x9b0f('0x75')];_0x226923[_0x9b0f('0x77')]=_0x5f4fd2[_0x9b0f('0x74')][_0x9b0f('0x78')];return _0x4ddd2b(_0x226923);})[_0x9b0f('0x45')](function(_0x134cf3){return _0x2b736d(_0x134cf3);});});}exports[_0x9b0f('0x79')]=function(_0x1c356b,_0x4af112,_0x549476){var _0x508384;var _0x86b7d3;var _0xd52fcf;var _0x32d56a=require('../../components/encryptor');return db[_0x9b0f('0x2d')][_0x9b0f('0x7a')]({'where':{'id':_0x1c356b['params']['id']}})[_0x9b0f('0x26')](function(_0x5e64c6){if(_0x5e64c6){var _0x376449=util['format'](_0x9b0f('0x4e'),_0x5e64c6['value']);if(fs[_0x9b0f('0x4f')](_0x376449)){cypher=!![];return _0x32d56a[_0x9b0f('0x50')](_0x376449,_0x5e64c6[_0x9b0f('0x4d')],config[_0x9b0f('0x60')][_0x9b0f('0x51')])[_0x9b0f('0x26')](function(){return _0x5e64c6;});}return _0x5e64c6;}})[_0x9b0f('0x26')](function(_0x29bf65){if(!_0x29bf65){throw new db[(_0x9b0f('0x52'))][(_0x9b0f('0x53'))]('Voice\x20Recording\x20not\x20found');}_0x86b7d3=_0x29bf65;return db[_0x9b0f('0x7b')][_0x9b0f('0x7a')]({'where':{'id':0x1}});})[_0x9b0f('0x26')](handleEntityNotFound(_0x4af112,null))[_0x9b0f('0x26')](function(_0x3f7523){if(_0x3f7523){_0x508384=_0x3f7523;if(!_0x508384[_0x9b0f('0x7c')]||!_0x508384[_0x9b0f('0x7d')]||!_0x508384[_0x9b0f('0x7e')]||!_0x508384[_0x9b0f('0x7f')]||!_0x508384['bucket']){throw new db[(_0x9b0f('0x52'))][(_0x9b0f('0x53'))]('Transcribe\x20not\x20configured');}if(_0x1c356b[_0x9b0f('0x47')][_0x9b0f('0x80')]&&(!_0x508384[_0x9b0f('0x81')]||!_0x508384[_0x9b0f('0x82')]||!_0x508384['sentimentRegion']||!_0x508384[_0x9b0f('0x7f')]||!_0x508384['bucket'])){throw new db[(_0x9b0f('0x52'))][(_0x9b0f('0x53'))](_0x9b0f('0x83'));}return db[_0x9b0f('0x84')][_0x9b0f('0x7a')]({'where':{'id':_0x508384['transcribeAccountId']}});}})[_0x9b0f('0x26')](function(_0xf76b74){if(!_0xf76b74){throw new db['Sequelize']['ValidationError'](_0x9b0f('0x85'));}if(!_0xf76b74[_0x9b0f('0x86')]||!_0xf76b74['data2']){throw new db[(_0x9b0f('0x52'))][(_0x9b0f('0x53'))]('Cloud\x20Provider\x20not\x20configured');}_0xd52fcf=_0xf76b74;return getBucketslist(_0xd52fcf[_0x9b0f('0x86')],_0xd52fcf[_0x9b0f('0x87')],_0x508384[_0x9b0f('0x7e')]);})[_0x9b0f('0x26')](function(_0x1ff603){if(_0x1ff603&&_0x1ff603['Buckets']){var _0x18bd1f=_[_0x9b0f('0x44')](_0x1ff603[_0x9b0f('0x88')],function(_0x5dc46a){return _0x5dc46a[_0x9b0f('0x89')]===_0x508384[_0x9b0f('0x6f')];});if(!_0x18bd1f){logger[_0x9b0f('0x64')](util[_0x9b0f('0x5f')](_0x9b0f('0x8a'),_0x1c356b[_0x9b0f('0x48')]['id'],_0x508384[_0x9b0f('0x6f')]));return createBucket(_0xd52fcf[_0x9b0f('0x86')],_0xd52fcf['data2'],_0x508384[_0x9b0f('0x7e')],_0x508384[_0x9b0f('0x6f')]);}logger[_0x9b0f('0x64')](util['format'](_0x9b0f('0x8b'),_0x1c356b[_0x9b0f('0x48')]['id'],_0x508384['bucket']));return;}})[_0x9b0f('0x26')](function(_0x50d9af){if(_0x86b7d3['transcribeStatus']===_0x9b0f('0x8c')){return transcribe(_0x1c356b[_0x9b0f('0x48')]['id'],_0xd52fcf[_0x9b0f('0x86')],_0xd52fcf[_0x9b0f('0x87')],_0x508384[_0x9b0f('0x7e')],_0x508384[_0x9b0f('0x6f')],_0x86b7d3[_0x9b0f('0x4d')],_0x508384['language']);}else{logger[_0x9b0f('0x64')](util[_0x9b0f('0x5f')](_0x9b0f('0x8d'),_0x1c356b['params']['id']));return{'transcribeStatus':_0x9b0f('0x8e')};}})[_0x9b0f('0x26')](function(_0x3c7c54){if(_0x3c7c54){_0x3c7c54[_0x9b0f('0x8f')]=_0x1c356b['body'][_0x9b0f('0x80')];return _0x86b7d3[_0x9b0f('0x90')](_0x3c7c54);}})[_0x9b0f('0x26')](respondWithResult(_0x4af112,null))[_0x9b0f('0x45')](handleError(_0x4af112,null));};function writeFile(_0x457354,_0x5b7b7c){return new Promise(function(_0xb5840a,_0x208ec1){fs[_0x9b0f('0x91')](_0x5b7b7c,_0x457354,function(_0x53a3ac,_0x135963){if(_0x53a3ac){return _0x208ec1(_0x53a3ac);}else{return _0xb5840a(_0x135963);}});});}exports[_0x9b0f('0x92')]=function(_0xfe4f63,_0x47280e,_0x144104){return db[_0x9b0f('0x2d')][_0x9b0f('0x7a')]({'where':{'id':_0xfe4f63[_0x9b0f('0x48')]['id']}})['then'](handleEntityNotFound(_0x47280e))[_0x9b0f('0x26')](function(_0x1e8a1a){if(_0x1e8a1a&&_0x1e8a1a[_0x9b0f('0x93')]){var _0x6c1279=_0x1e8a1a[_0x9b0f('0x93')];var _0x5e5b9a=config[_0x9b0f('0x94')]+_0x9b0f('0x95')+_0x1e8a1a['id']+_0x9b0f('0x96');if(fs[_0x9b0f('0x4f')](_0x5e5b9a)){return _0x5e5b9a;}return writeFile(_0x6c1279,_0x5e5b9a)[_0x9b0f('0x26')](function(){return _0x5e5b9a;});}else{throw new db[(_0x9b0f('0x52'))]['ValidationError'](_0x9b0f('0x97'));}})['then'](function(_0x2723bb){return _0x47280e[_0x9b0f('0x4a')](_0x2723bb);})[_0x9b0f('0x45')](handleError(_0x47280e));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 6bcbe32..f1bab19 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 _0x8276=['util','moment','bluebird','path','rimraf','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash'];(function(_0x7a112,_0x2eb4a0){var _0x136dc5=function(_0x437650){while(--_0x437650){_0x7a112['push'](_0x7a112['shift']());}};_0x136dc5(++_0x2eb4a0);}(_0x8276,0xa7));var _0x6827=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8276[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6827('0x0'));var util=require(_0x6827('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6827('0x2'));var BPromise=require(_0x6827('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6827('0x4'));var rimraf=require(_0x6827('0x5'));var config=require('../../config/environment');var attributes=require(_0x6827('0x6'));module[_0x6827('0x7')]=function(_0xc96297,_0x1c7983){return _0xc96297[_0x6827('0x8')](_0x6827('0x9'),attributes,{'tableName':_0x6827('0xa'),'paranoid':![],'indexes':[{'name':_0x6827('0xb'),'fields':[_0x6827('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd868=['define','VoiceRecording','uniqueid','lodash','../../config/logger','api','bluebird','../../config/environment','./voiceRecording.attributes','exports'];(function(_0x351087,_0x2af3c5){var _0x33502e=function(_0x1eef81){while(--_0x1eef81){_0x351087['push'](_0x351087['shift']());}};_0x33502e(++_0x2af3c5);}(_0xd868,0xfd));var _0x8d86=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xd868[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x8d86('0x0'));var util=require('util');var logger=require(_0x8d86('0x1'))(_0x8d86('0x2'));var moment=require('moment');var BPromise=require(_0x8d86('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8d86('0x4'));var attributes=require(_0x8d86('0x5'));module[_0x8d86('0x6')]=function(_0x5a78c5,_0x159a83){return _0x5a78c5[_0x8d86('0x7')](_0x8d86('0x8'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x8d86('0x9'),'fields':[_0x8d86('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index e65a8ab..83da762 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 _0xa46e=['then','request\x20sent','debug','stringify','error','code','message','VoiceRecording,\x20%s,\x20%s','info','result','catch','VoiceRecording','update','options','raw','where','attributes','findOne','callRecordingEncryption','create','value','format','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','request'];(function(_0x4e4f0e,_0x1c3892){var _0x1a7219=function(_0x3821ad){while(--_0x3821ad){_0x4e4f0e['push'](_0x4e4f0e['shift']());}};_0x1a7219(++_0x1c3892);}(_0xa46e,0x8a));var _0xea46=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xa46e[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var moment=require('moment');var BPromise=require(_0xea46('0x2'));var rs=require(_0xea46('0x3'));var fs=require('fs');var Redis=require(_0xea46('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xea46('0x5'));var logger=require('../../config/logger')(_0xea46('0x6'));var config=require('../../config/environment');var jayson=require(_0xea46('0x7'));var client=jayson['client'][_0xea46('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dc26f,_0x5f1cd1,_0x2d1b30){return new BPromise(function(_0x42771a,_0xe7d428){return client[_0xea46('0x9')](_0x3dc26f,_0x2d1b30)[_0xea46('0xa')](function(_0x4cf206){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'));logger[_0xea46('0xc')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'),JSON[_0xea46('0xd')](_0x4cf206));if(_0x4cf206[_0xea46('0xe')]){if(_0x4cf206['error'][_0xea46('0xf')]===0x1f4){logger[_0xea46('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0xe7d428(_0x4cf206['error'][_0xea46('0x10')]);}logger['error'](_0xea46('0x11'),_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0x42771a(_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);}else{logger[_0xea46('0x12')](_0xea46('0x11'),_0x5f1cd1,_0xea46('0xb'));_0x42771a(_0x4cf206[_0xea46('0x13')]['message']);}})[_0xea46('0x14')](function(_0xbf225e){logger[_0xea46('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x5f1cd1,_0xbf225e);_0xe7d428(_0xbf225e);});});}exports['UpdateVoiceRecording']=function(_0x19d5c1){var _0x3f463d=this;return new Promise(function(_0x5cf5dd,_0x4b6745){return db[_0xea46('0x15')][_0xea46('0x16')](_0x19d5c1['body'],{'raw':_0x19d5c1[_0xea46('0x17')]?_0x19d5c1[_0xea46('0x17')][_0xea46('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19d5c1[_0xea46('0x17')]?_0x19d5c1['options'][_0xea46('0x19')]||null:null,'attributes':_0x19d5c1['options']?_0x19d5c1['options'][_0xea46('0x1a')]||null:null,'limit':_0x19d5c1['options']?_0x19d5c1['options']['limit']||null:null})[_0xea46('0xa')](function(_0x36f982){logger[_0xea46('0x12')]('UpdateVoiceRecording',_0x19d5c1);logger[_0xea46('0xc')]('UpdateVoiceRecording',_0x19d5c1,JSON[_0xea46('0xd')](_0x36f982));_0x5cf5dd(_0x36f982);})[_0xea46('0x14')](function(_0x528eae){logger[_0xea46('0xe')]('UpdateVoiceRecording',_0x528eae[_0xea46('0x10')],_0x19d5c1);_0x4b6745(_0x3f463d[_0xea46('0xe')](0x1f4,_0x528eae[_0xea46('0x10')]));});});};exports['CreateVoiceRecording']=function(_0x5d2de1){var _0x44e797=this;return new Promise(function(_0x38ac07,_0x4b369c){var _0x3b3928=require('../../components/encryptor');var _0x11129d;return db['Setting'][_0xea46('0x1b')]({'attributes':['id',_0xea46('0x1c')],'where':{'id':0x1},'raw':!![]})[_0xea46('0xa')](function(_0x44517d){_0x11129d=_0x44517d;return db[_0xea46('0x15')][_0xea46('0x1d')](_0x5d2de1['body']);})[_0xea46('0xa')](function(_0x338e96){if(_0x11129d[_0xea46('0x1c')]&&fs['existsSync'](_0x338e96[_0xea46('0x1e')])){var _0x3cdf96=util[_0xea46('0x1f')]('%s.cypher',_0x338e96['value']);return _0x3b3928['encryptFile'](_0x338e96[_0xea46('0x1e')],_0x3cdf96,config[_0xea46('0x20')][_0xea46('0x21')])[_0xea46('0xa')](function(){fs[_0xea46('0x22')](_0x338e96[_0xea46('0x1e')]);logger[_0xea46('0x12')](_0xea46('0x23'));return _0x338e96;});}return _0x338e96;})[_0xea46('0xa')](function(_0x1c7201){logger[_0xea46('0x12')]('CreateVoiceRecording',_0x5d2de1);logger[_0xea46('0xc')](_0xea46('0x24'),_0x5d2de1,JSON[_0xea46('0xd')](_0x1c7201));_0x38ac07(_0x1c7201);})[_0xea46('0x14')](function(_0x1472c0){logger[_0xea46('0xe')](_0xea46('0x24'),_0x1472c0['message'],_0x5d2de1);_0x4b369c(_0x44e797[_0xea46('0xe')](0x1f4,_0x1472c0[_0xea46('0x10')]));});});}; \ No newline at end of file +var _0xbff5=['catch','CreateVoiceRecording','Setting','findOne','create','callRecordingEncryption','existsSync','%s.cypher','encryptFile','value','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','update','options','raw','where','attributes','then','UpdateVoiceRecording','debug'];(function(_0x39cbe4,_0x4a7958){var _0xe76ba7=function(_0x332a08){while(--_0x332a08){_0x39cbe4['push'](_0x39cbe4['shift']());}};_0xe76ba7(++_0x4a7958);}(_0xbff5,0x1bc));var _0x5bff=function(_0x2e7429,_0x4476b9){_0x2e7429=_0x2e7429-0x0;var _0x3767a8=_0xbff5[_0x2e7429];return _0x3767a8;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var moment=require(_0x5bff('0x2'));var BPromise=require(_0x5bff('0x3'));var rs=require(_0x5bff('0x4'));var fs=require('fs');var Redis=require(_0x5bff('0x5'));var db=require(_0x5bff('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bff('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5bff('0x8'));var client=jayson[_0x5bff('0x9')][_0x5bff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa54c57,_0x43605a,_0xd4b9dc){return new BPromise(function(_0x1acb49,_0x139c99){return client[_0x5bff('0xb')](_0xa54c57,_0xd4b9dc)['then'](function(_0x20e26f){logger['info'](_0x5bff('0xc'),_0x43605a,_0x5bff('0xd'));logger['debug'](_0x5bff('0xe'),_0x43605a,'request\x20sent',JSON[_0x5bff('0xf')](_0x20e26f));if(_0x20e26f['error']){if(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x11')]===0x1f4){logger['error'](_0x5bff('0xc'),_0x43605a,_0x20e26f['error'][_0x5bff('0x12')]);return _0x139c99(_0x20e26f[_0x5bff('0x10')]['message']);}logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x20e26f['error']['message']);return _0x1acb49(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x12')]);}else{logger[_0x5bff('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x43605a,_0x5bff('0xd'));_0x1acb49(_0x20e26f[_0x5bff('0x14')][_0x5bff('0x12')]);}})['catch'](function(_0x3ffbbc){logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x3ffbbc);_0x139c99(_0x3ffbbc);});});}exports['UpdateVoiceRecording']=function(_0xc9fbc3){var _0x279c22=this;return new Promise(function(_0x36653b,_0x32cf60){return db['VoiceRecording'][_0x5bff('0x15')](_0xc9fbc3['body'],{'raw':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3['options'][_0x5bff('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x18')]||null:null,'attributes':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x19')]||null:null,'limit':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')]['limit']||null:null})[_0x5bff('0x1a')](function(_0x263cf5){logger[_0x5bff('0x13')](_0x5bff('0x1b'),_0xc9fbc3);logger[_0x5bff('0x1c')](_0x5bff('0x1b'),_0xc9fbc3,JSON[_0x5bff('0xf')](_0x263cf5));_0x36653b(_0x263cf5);})[_0x5bff('0x1d')](function(_0x5e2ae8){logger['error'](_0x5bff('0x1b'),_0x5e2ae8['message'],_0xc9fbc3);_0x32cf60(_0x279c22[_0x5bff('0x10')](0x1f4,_0x5e2ae8[_0x5bff('0x12')]));});});};exports[_0x5bff('0x1e')]=function(_0x6f18f1){var _0xfa361d=this;return new Promise(function(_0x1140eb,_0x271f3c){var _0xedba9d=require('../../components/encryptor');var _0x4df57a;return db[_0x5bff('0x1f')][_0x5bff('0x20')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x5bff('0x1a')](function(_0x588078){_0x4df57a=_0x588078;return db['VoiceRecording'][_0x5bff('0x21')](_0x6f18f1['body']);})[_0x5bff('0x1a')](function(_0x64e22){if(_0x4df57a[_0x5bff('0x22')]&&fs[_0x5bff('0x23')](_0x64e22['value'])){var _0x71783=util['format'](_0x5bff('0x24'),_0x64e22['value']);return _0xedba9d[_0x5bff('0x25')](_0x64e22[_0x5bff('0x26')],_0x71783,config[_0x5bff('0x27')][_0x5bff('0x28')])[_0x5bff('0x1a')](function(){fs[_0x5bff('0x29')](_0x64e22['value']);logger[_0x5bff('0x13')](_0x5bff('0x2a'));return _0x64e22;});}return _0x64e22;})[_0x5bff('0x1a')](function(_0x42fe4a){logger[_0x5bff('0x13')](_0x5bff('0x1e'),_0x6f18f1);logger[_0x5bff('0x1c')](_0x5bff('0x1e'),_0x6f18f1,JSON['stringify'](_0x42fe4a));_0x1140eb(_0x42fe4a);})[_0x5bff('0x1d')](function(_0x16042d){logger[_0x5bff('0x10')](_0x5bff('0x1e'),_0x16042d['message'],_0x6f18f1);_0x271f3c(_0xfa361d[_0x5bff('0x10')](0x1f4,_0x16042d[_0x5bff('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index efdc032..175b45a 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 _0xc4ec=['put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post'];(function(_0x2c10d7,_0x321676){var _0x17b4cf=function(_0x2ee0be){while(--_0x2ee0be){_0x2c10d7['push'](_0x2c10d7['shift']());}};_0x17b4cf(++_0x321676);}(_0xc4ec,0x154));var _0xcc4e=function(_0x2bf466,_0x4929a5){_0x2bf466=_0x2bf466-0x0;var _0x856885=_0xc4ec[_0x2bf466];return _0x856885;};'use strict';var multer=require(_0xcc4e('0x0'));var util=require(_0xcc4e('0x1'));var path=require(_0xcc4e('0x2'));var timeout=require(_0xcc4e('0x3'));var express=require('express');var router=express[_0xcc4e('0x4')]();var fs_extra=require(_0xcc4e('0x5'));var auth=require(_0xcc4e('0x6'));var interaction=require(_0xcc4e('0x7'));var config=require(_0xcc4e('0x8'));var controller=require(_0xcc4e('0x9'));router['get']('/',auth[_0xcc4e('0xa')](),controller['index']);router[_0xcc4e('0xb')](_0xcc4e('0xc'),auth['isAuthenticated'](),controller[_0xcc4e('0xd')]);router['get'](_0xcc4e('0xe'),auth[_0xcc4e('0xa')](),controller[_0xcc4e('0xf')]);router[_0xcc4e('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcc4e('0x11')](_0xcc4e('0xe'),auth[_0xcc4e('0xa')](),controller[_0xcc4e('0x12')]);router[_0xcc4e('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xcc4e('0x14')]=router; \ No newline at end of file +var _0x1d74=['multer','util','path','connect-timeout','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x4c403d,_0x5ef49f){var _0x5a0c35=function(_0x40ba5a){while(--_0x40ba5a){_0x4c403d['push'](_0x4c403d['shift']());}};_0x5a0c35(++_0x5ef49f);}(_0x1d74,0x18f));var _0x41d7=function(_0x8d6752,_0x460cf7){_0x8d6752=_0x8d6752-0x0;var _0x18e96e=_0x1d74[_0x8d6752];return _0x18e96e;};'use strict';var multer=require(_0x41d7('0x0'));var util=require(_0x41d7('0x1'));var path=require(_0x41d7('0x2'));var timeout=require(_0x41d7('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x41d7('0x4'));var config=require('../../config/environment');var controller=require(_0x41d7('0x5'));router[_0x41d7('0x6')]('/',auth[_0x41d7('0x7')](),controller[_0x41d7('0x8')]);router['get'](_0x41d7('0x9'),auth[_0x41d7('0x7')](),controller[_0x41d7('0xa')]);router[_0x41d7('0x6')](_0x41d7('0xb'),auth[_0x41d7('0x7')](),controller[_0x41d7('0xc')]);router[_0x41d7('0xd')]('/',auth['isAuthenticated'](),controller[_0x41d7('0xe')]);router[_0x41d7('0xf')](_0x41d7('0xb'),auth[_0x41d7('0x7')](),controller[_0x41d7('0x10')]);router[_0x41d7('0x11')](_0x41d7('0xb'),auth['isAuthenticated'](),controller[_0x41d7('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 4f7abae..f0b4cb0 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 _0x1ab4=['moment','exports','ENUM','STRING','Yes','sequelize'];(function(_0x7583bd,_0x312cb5){var _0x5d07ad=function(_0x131b47){while(--_0x131b47){_0x7583bd['push'](_0x7583bd['shift']());}};_0x5d07ad(++_0x312cb5);}(_0x1ab4,0x95));var _0x41ab=function(_0x26c60b,_0x423a18){_0x26c60b=_0x26c60b-0x0;var _0x18777f=_0x1ab4[_0x26c60b];return _0x18777f;};'use strict';var Sequelize=require(_0x41ab('0x0'));var moment=require(_0x41ab('0x1'));module[_0x41ab('0x2')]={'type':{'type':Sequelize[_0x41ab('0x3')]('blind','attended')},'result':{'type':Sequelize[_0x41ab('0x4')]},'transfererchannel':{'type':Sequelize[_0x41ab('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x41ab('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x41ab('0x4')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x41ab('0x4')]},'transferercontext':{'type':Sequelize[_0x41ab('0x4')]},'transfererexten':{'type':Sequelize[_0x41ab('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x41ab('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x41ab('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x41ab('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x41ab('0x4')]},'transfereecontext':{'type':Sequelize[_0x41ab('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0x41ab('0x5'),'No')},'context':{'type':Sequelize[_0x41ab('0x4')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9997=['STRING','Yes','sequelize','moment','exports','ENUM','blind','attended'];(function(_0x5e89d8,_0x30a21a){var _0x5c1153=function(_0x2dcba0){while(--_0x2dcba0){_0x5e89d8['push'](_0x5e89d8['shift']());}};_0x5c1153(++_0x30a21a);}(_0x9997,0x19a));var _0x7999=function(_0x2730da,_0x1098bd){_0x2730da=_0x2730da-0x0;var _0xfe9991=_0x9997[_0x2730da];return _0xfe9991;};'use strict';var Sequelize=require(_0x7999('0x0'));var moment=require(_0x7999('0x1'));module[_0x7999('0x2')]={'type':{'type':Sequelize[_0x7999('0x3')](_0x7999('0x4'),_0x7999('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x7999('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x7999('0x6')]},'transferercalleridname':{'type':Sequelize[_0x7999('0x6')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x7999('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x7999('0x6')]},'transferercontext':{'type':Sequelize[_0x7999('0x6')]},'transfererexten':{'type':Sequelize[_0x7999('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x7999('0x6')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x7999('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x7999('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x7999('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x7999('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x7999('0x6')]},'transfereecontext':{'type':Sequelize[_0x7999('0x6')]},'transfereeexten':{'type':Sequelize[_0x7999('0x6')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x7999('0x3')](_0x7999('0x7'),'No')},'context':{'type':Sequelize[_0x7999('0x6')]},'extension':{'type':Sequelize[_0x7999('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 2303bf4..9c46a76 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 _0xd922=['../../mysqldb','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','status','end','sendStatus','error','stack','name','send','rawAttributes','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','type','VIRTUAL','options','include','VoiceTransferReport','catch','show','params','keys','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x415dcb,_0x2196ce){var _0x3ae3ac=function(_0x1b4ce9){while(--_0x1b4ce9){_0x415dcb['push'](_0x415dcb['shift']());}};_0x3ae3ac(++_0x2196ce);}(_0xd922,0x79));var _0x2d92=function(_0x7d2d51,_0x5578ae){_0x7d2d51=_0x7d2d51-0x0;var _0x4861b1=_0xd922[_0x7d2d51];return _0x4861b1;};'use strict';var emlformat=require(_0x2d92('0x0'));var rimraf=require(_0x2d92('0x1'));var zipdir=require(_0x2d92('0x2'));var jsonpatch=require(_0x2d92('0x3'));var rp=require('request-promise');var moment=require(_0x2d92('0x4'));var BPromise=require(_0x2d92('0x5'));var Mustache=require('mustache');var util=require(_0x2d92('0x6'));var path=require(_0x2d92('0x7'));var sox=require('sox');var csv=require(_0x2d92('0x8'));var ejs=require(_0x2d92('0x9'));var fs=require('fs');var fs_extra=require(_0x2d92('0xa'));var _=require(_0x2d92('0xb'));var squel=require(_0x2d92('0xc'));var crypto=require(_0x2d92('0xd'));var jsforce=require(_0x2d92('0xe'));var deskjs=require(_0x2d92('0xf'));var toCsv=require(_0x2d92('0x8'));var querystring=require(_0x2d92('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2d92('0x11'));var qs=require(_0x2d92('0x12'));var as=require(_0x2d92('0x13'));var hardwareService=require(_0x2d92('0x14'));var logger=require(_0x2d92('0x15'))(_0x2d92('0x16'));var utils=require(_0x2d92('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2d92('0x18'));var db=require(_0x2d92('0x19'))['db'];function respondWithStatusCode(_0x3614d2,_0x351e20){_0x351e20=_0x351e20||0xcc;return function(_0x3bf3a0){if(_0x3bf3a0){return _0x3614d2['sendStatus'](_0x351e20);}return _0x3614d2['status'](_0x351e20)['end']();};}function respondWithResult(_0x13270d,_0x4ae83d){_0x4ae83d=_0x4ae83d||0xc8;return function(_0xd67427){if(_0xd67427){return _0x13270d['status'](_0x4ae83d)[_0x2d92('0x1a')](_0xd67427);}};}function respondWithFilteredResult(_0x5bda61,_0x5bce33){return function(_0x14c534){if(_0x14c534){var _0x5dd1f8=typeof _0x5bce33[_0x2d92('0x1b')]==='undefined'&&typeof _0x5bce33[_0x2d92('0x1c')]===_0x2d92('0x1d');var _0x4ec8fc=_0x14c534[_0x2d92('0x1e')];var _0x4d6079=_0x5dd1f8?0x0:_0x5bce33[_0x2d92('0x1b')];var _0xca4125=_0x5dd1f8?_0x14c534[_0x2d92('0x1e')]:_0x5bce33[_0x2d92('0x1b')]+_0x5bce33[_0x2d92('0x1c')];var _0x1595b2;if(_0xca4125>=_0x4ec8fc){_0xca4125=_0x4ec8fc;_0x1595b2=0xc8;}else{_0x1595b2=0xce;}_0x5bda61['status'](_0x1595b2);return _0x5bda61[_0x2d92('0x1f')]('Content-Range',_0x4d6079+'-'+_0xca4125+'/'+_0x4ec8fc)['json'](_0x14c534);}return null;};}function patchUpdates(_0xf9b032){return function(_0x153c8c){try{jsonpatch[_0x2d92('0x20')](_0x153c8c,_0xf9b032,!![]);}catch(_0xb0f85d){return BPromise['reject'](_0xb0f85d);}return _0x153c8c[_0x2d92('0x21')]();};}function saveUpdates(_0x46b786,_0x2cab8c){return function(_0x283314){if(_0x283314){return _0x283314[_0x2d92('0x22')](_0x46b786)[_0x2d92('0x23')](function(_0x2acebc){return _0x2acebc;});}return null;};}function removeEntity(_0xfb5963,_0x4d8ca1){return function(_0x44b944){if(_0x44b944){return _0x44b944[_0x2d92('0x24')]()['then'](function(){_0xfb5963[_0x2d92('0x25')](0xcc)[_0x2d92('0x26')]();});}};}function handleEntityNotFound(_0x4ac7fa,_0x37c6ec){return function(_0x3fc0a1){if(!_0x3fc0a1){_0x4ac7fa[_0x2d92('0x27')](0x194);}return _0x3fc0a1;};}function handleError(_0x4c0dea,_0x27bbab){_0x27bbab=_0x27bbab||0x1f4;return function(_0x6d645d){logger[_0x2d92('0x28')](_0x6d645d[_0x2d92('0x29')]);if(_0x6d645d[_0x2d92('0x2a')]){delete _0x6d645d[_0x2d92('0x2a')];}_0x4c0dea[_0x2d92('0x25')](_0x27bbab)[_0x2d92('0x2b')](_0x6d645d);};}exports['index']=function(_0x3c68ce,_0x2cadd3){var _0x352e07={},_0x60ff1e={},_0x14fc77={'count':0x0,'rows':[]};var _0x2b4e3a=_['map'](db['VoiceTransferReport'][_0x2d92('0x2c')],function(_0x5ac6fb){return{'name':_0x5ac6fb['fieldName'],'type':_0x5ac6fb['type'][_0x2d92('0x2d')]};});_0x60ff1e[_0x2d92('0x2e')]=_[_0x2d92('0x2f')](_0x2b4e3a,_0x2d92('0x2a'));_0x60ff1e[_0x2d92('0x30')]=_['keys'](_0x3c68ce[_0x2d92('0x30')]);_0x60ff1e[_0x2d92('0x31')]=_[_0x2d92('0x32')](_0x60ff1e['model'],_0x60ff1e['query']);_0x352e07[_0x2d92('0x33')]=_[_0x2d92('0x32')](_0x60ff1e[_0x2d92('0x2e')],qs[_0x2d92('0x34')](_0x3c68ce['query'][_0x2d92('0x34')]));_0x352e07[_0x2d92('0x33')]=_0x352e07[_0x2d92('0x33')][_0x2d92('0x35')]?_0x352e07[_0x2d92('0x33')]:_0x60ff1e[_0x2d92('0x2e')];if(!_0x3c68ce[_0x2d92('0x30')]['hasOwnProperty'](_0x2d92('0x36'))){_0x352e07['limit']=qs['limit'](_0x3c68ce['query'][_0x2d92('0x1c')]);_0x352e07['offset']=qs[_0x2d92('0x1b')](_0x3c68ce[_0x2d92('0x30')]['offset']);}_0x352e07[_0x2d92('0x37')]=qs[_0x2d92('0x38')](_0x3c68ce[_0x2d92('0x30')]['sort']);_0x352e07[_0x2d92('0x39')]=qs[_0x2d92('0x31')](_['pick'](_0x3c68ce[_0x2d92('0x30')],_0x60ff1e['filters']),_0x2b4e3a);if(_0x3c68ce[_0x2d92('0x30')]['filter']){_0x352e07[_0x2d92('0x39')]=_[_0x2d92('0x3a')](_0x352e07[_0x2d92('0x39')],{'$or':_['map'](_0x2b4e3a,function(_0x39760e){if(_0x39760e[_0x2d92('0x3b')]!==_0x2d92('0x3c')){var _0x2bc333={};_0x2bc333[_0x39760e['name']]={'$like':'%'+_0x3c68ce[_0x2d92('0x30')]['filter']+'%'};return _0x2bc333;}})});}_0x352e07=_[_0x2d92('0x3a')]({},_0x352e07,_0x3c68ce[_0x2d92('0x3d')]);var _0x4fc446={'where':_0x352e07[_0x2d92('0x39')]};return db['VoiceTransferReport'][_0x2d92('0x1e')](_0x4fc446)['then'](function(_0x168d99){_0x14fc77['count']=_0x168d99;if(_0x3c68ce['query']['includeAll']){_0x352e07[_0x2d92('0x3e')]=[{'all':!![]}];}return db[_0x2d92('0x3f')]['findAll'](_0x352e07);})['then'](function(_0x4de577){_0x14fc77['rows']=_0x4de577;return _0x14fc77;})['then'](respondWithFilteredResult(_0x2cadd3,_0x352e07))[_0x2d92('0x40')](handleError(_0x2cadd3,null));};exports[_0x2d92('0x41')]=function(_0x1038f0,_0x120e35){var _0xab8f20={'raw':!![],'where':{'id':_0x1038f0[_0x2d92('0x42')]['id']}},_0x5bf725={};_0x5bf725['model']=_['keys'](db[_0x2d92('0x3f')]['rawAttributes']);_0x5bf725[_0x2d92('0x30')]=_[_0x2d92('0x43')](_0x1038f0[_0x2d92('0x30')]);_0x5bf725[_0x2d92('0x31')]=_['intersection'](_0x5bf725['model'],_0x5bf725[_0x2d92('0x30')]);_0xab8f20[_0x2d92('0x33')]=_['intersection'](_0x5bf725[_0x2d92('0x2e')],qs[_0x2d92('0x34')](_0x1038f0[_0x2d92('0x30')][_0x2d92('0x34')]));_0xab8f20[_0x2d92('0x33')]=_0xab8f20[_0x2d92('0x33')][_0x2d92('0x35')]?_0xab8f20[_0x2d92('0x33')]:_0x5bf725[_0x2d92('0x2e')];if(_0x1038f0[_0x2d92('0x30')][_0x2d92('0x44')]){_0xab8f20[_0x2d92('0x3e')]=[{'all':!![]}];}_0xab8f20=_[_0x2d92('0x3a')]({},_0xab8f20,_0x1038f0['options']);return db[_0x2d92('0x3f')][_0x2d92('0x45')](_0xab8f20)[_0x2d92('0x23')](handleEntityNotFound(_0x120e35,null))[_0x2d92('0x23')](respondWithResult(_0x120e35,null))[_0x2d92('0x40')](handleError(_0x120e35,null));};exports[_0x2d92('0x46')]=function(_0x57df35,_0x1b67dd){return db[_0x2d92('0x3f')][_0x2d92('0x46')](_0x57df35[_0x2d92('0x47')],{})[_0x2d92('0x23')](respondWithResult(_0x1b67dd,0xc9))[_0x2d92('0x40')](handleError(_0x1b67dd,null));};exports['update']=function(_0x231629,_0x878eb4){if(_0x231629[_0x2d92('0x47')]['id']){delete _0x231629[_0x2d92('0x47')]['id'];}return db['VoiceTransferReport'][_0x2d92('0x45')]({'where':{'id':_0x231629[_0x2d92('0x42')]['id']}})[_0x2d92('0x23')](handleEntityNotFound(_0x878eb4,null))['then'](saveUpdates(_0x231629[_0x2d92('0x47')],null))[_0x2d92('0x23')](respondWithResult(_0x878eb4,null))['catch'](handleError(_0x878eb4,null));};exports[_0x2d92('0x24')]=function(_0x2fc498,_0x3b3f45){return db[_0x2d92('0x3f')][_0x2d92('0x45')]({'where':{'id':_0x2fc498['params']['id']}})['then'](handleEntityNotFound(_0x3b3f45,null))[_0x2d92('0x23')](removeEntity(_0x3b3f45,null))['catch'](handleError(_0x3b3f45,null));};exports[_0x2d92('0x48')]=function(_0x3be957,_0x9171f){return db[_0x2d92('0x3f')][_0x2d92('0x48')]()[_0x2d92('0x23')](respondWithResult(_0x9171f,null))['catch'](handleError(_0x9171f,null));}; \ No newline at end of file +var _0x3f4b=['type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','end','sendStatus','name','index','map','VoiceTransferReport','rawAttributes','fieldName'];(function(_0x2ed35d,_0x25d51c){var _0x3ca293=function(_0x5e1878){while(--_0x5e1878){_0x2ed35d['push'](_0x2ed35d['shift']());}};_0x3ca293(++_0x25d51c);}(_0x3f4b,0xf1));var _0xb3f4=function(_0x35f46b,_0x343240){_0x35f46b=_0x35f46b-0x0;var _0x54e8e0=_0x3f4b[_0x35f46b];return _0x54e8e0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb3f4('0x0'));var zipdir=require(_0xb3f4('0x1'));var jsonpatch=require(_0xb3f4('0x2'));var rp=require(_0xb3f4('0x3'));var moment=require(_0xb3f4('0x4'));var BPromise=require(_0xb3f4('0x5'));var Mustache=require('mustache');var util=require(_0xb3f4('0x6'));var path=require(_0xb3f4('0x7'));var sox=require(_0xb3f4('0x8'));var csv=require('to-csv');var ejs=require(_0xb3f4('0x9'));var fs=require('fs');var fs_extra=require(_0xb3f4('0xa'));var _=require('lodash');var squel=require(_0xb3f4('0xb'));var crypto=require('crypto');var jsforce=require(_0xb3f4('0xc'));var deskjs=require(_0xb3f4('0xd'));var toCsv=require(_0xb3f4('0xe'));var querystring=require(_0xb3f4('0xf'));var Papa=require(_0xb3f4('0x10'));var Redis=require(_0xb3f4('0x11'));var authService=require(_0xb3f4('0x12'));var qs=require(_0xb3f4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3f4('0x14'));var logger=require(_0xb3f4('0x15'))(_0xb3f4('0x16'));var utils=require(_0xb3f4('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb3f4('0x18'));var db=require(_0xb3f4('0x19'))['db'];function respondWithStatusCode(_0x2b89e8,_0x371f81){_0x371f81=_0x371f81||0xcc;return function(_0x2c31d0){if(_0x2c31d0){return _0x2b89e8['sendStatus'](_0x371f81);}return _0x2b89e8['status'](_0x371f81)['end']();};}function respondWithResult(_0x2347e3,_0x4f555f){_0x4f555f=_0x4f555f||0xc8;return function(_0x15b6c2){if(_0x15b6c2){return _0x2347e3[_0xb3f4('0x1a')](_0x4f555f)[_0xb3f4('0x1b')](_0x15b6c2);}};}function respondWithFilteredResult(_0x35289e,_0xff5fc8){return function(_0x58c06c){if(_0x58c06c){var _0x4bf193=typeof _0xff5fc8['offset']===_0xb3f4('0x1c')&&typeof _0xff5fc8[_0xb3f4('0x1d')]==='undefined';var _0x5b33de=_0x58c06c[_0xb3f4('0x1e')];var _0x376c80=_0x4bf193?0x0:_0xff5fc8[_0xb3f4('0x1f')];var _0x5aba74=_0x4bf193?_0x58c06c['count']:_0xff5fc8[_0xb3f4('0x1f')]+_0xff5fc8['limit'];var _0x33de9c;if(_0x5aba74>=_0x5b33de){_0x5aba74=_0x5b33de;_0x33de9c=0xc8;}else{_0x33de9c=0xce;}_0x35289e[_0xb3f4('0x1a')](_0x33de9c);return _0x35289e[_0xb3f4('0x20')](_0xb3f4('0x21'),_0x376c80+'-'+_0x5aba74+'/'+_0x5b33de)['json'](_0x58c06c);}return null;};}function patchUpdates(_0x4dc1c8){return function(_0x7cb106){try{jsonpatch['apply'](_0x7cb106,_0x4dc1c8,!![]);}catch(_0x3c7398){return BPromise[_0xb3f4('0x22')](_0x3c7398);}return _0x7cb106[_0xb3f4('0x23')]();};}function saveUpdates(_0x10730f,_0x5b6b90){return function(_0x581f89){if(_0x581f89){return _0x581f89[_0xb3f4('0x24')](_0x10730f)['then'](function(_0x516d18){return _0x516d18;});}return null;};}function removeEntity(_0x57cf37,_0x2307fb){return function(_0x64fba5){if(_0x64fba5){return _0x64fba5[_0xb3f4('0x25')]()[_0xb3f4('0x26')](function(){_0x57cf37[_0xb3f4('0x1a')](0xcc)[_0xb3f4('0x27')]();});}};}function handleEntityNotFound(_0x512089,_0x4a15cb){return function(_0x7411ea){if(!_0x7411ea){_0x512089[_0xb3f4('0x28')](0x194);}return _0x7411ea;};}function handleError(_0x23bb36,_0x42db5f){_0x42db5f=_0x42db5f||0x1f4;return function(_0x40f0d0){logger['error'](_0x40f0d0['stack']);if(_0x40f0d0['name']){delete _0x40f0d0[_0xb3f4('0x29')];}_0x23bb36['status'](_0x42db5f)['send'](_0x40f0d0);};}exports[_0xb3f4('0x2a')]=function(_0x1db6d8,_0x4c704c){var _0x5e71df={},_0x577df1={},_0x522f58={'count':0x0,'rows':[]};var _0x5c703e=_[_0xb3f4('0x2b')](db[_0xb3f4('0x2c')][_0xb3f4('0x2d')],function(_0x30d8e4){return{'name':_0x30d8e4[_0xb3f4('0x2e')],'type':_0x30d8e4[_0xb3f4('0x2f')]['key']};});_0x577df1[_0xb3f4('0x30')]=_[_0xb3f4('0x2b')](_0x5c703e,_0xb3f4('0x29'));_0x577df1['query']=_[_0xb3f4('0x31')](_0x1db6d8['query']);_0x577df1[_0xb3f4('0x32')]=_[_0xb3f4('0x33')](_0x577df1['model'],_0x577df1[_0xb3f4('0x34')]);_0x5e71df[_0xb3f4('0x35')]=_[_0xb3f4('0x33')](_0x577df1['model'],qs[_0xb3f4('0x36')](_0x1db6d8[_0xb3f4('0x34')]['fields']));_0x5e71df[_0xb3f4('0x35')]=_0x5e71df[_0xb3f4('0x35')][_0xb3f4('0x37')]?_0x5e71df['attributes']:_0x577df1[_0xb3f4('0x30')];if(!_0x1db6d8[_0xb3f4('0x34')][_0xb3f4('0x38')]('nolimit')){_0x5e71df[_0xb3f4('0x1d')]=qs[_0xb3f4('0x1d')](_0x1db6d8[_0xb3f4('0x34')][_0xb3f4('0x1d')]);_0x5e71df[_0xb3f4('0x1f')]=qs[_0xb3f4('0x1f')](_0x1db6d8['query']['offset']);}_0x5e71df[_0xb3f4('0x39')]=qs[_0xb3f4('0x3a')](_0x1db6d8[_0xb3f4('0x34')][_0xb3f4('0x3a')]);_0x5e71df[_0xb3f4('0x3b')]=qs[_0xb3f4('0x32')](_['pick'](_0x1db6d8[_0xb3f4('0x34')],_0x577df1[_0xb3f4('0x32')]),_0x5c703e);if(_0x1db6d8[_0xb3f4('0x34')][_0xb3f4('0x3c')]){_0x5e71df[_0xb3f4('0x3b')]=_['merge'](_0x5e71df[_0xb3f4('0x3b')],{'$or':_[_0xb3f4('0x2b')](_0x5c703e,function(_0xd6bb86){if(_0xd6bb86[_0xb3f4('0x2f')]!==_0xb3f4('0x3d')){var _0x42453a={};_0x42453a[_0xd6bb86['name']]={'$like':'%'+_0x1db6d8['query'][_0xb3f4('0x3c')]+'%'};return _0x42453a;}})});}_0x5e71df=_[_0xb3f4('0x3e')]({},_0x5e71df,_0x1db6d8['options']);var _0x3616a2={'where':_0x5e71df['where']};return db[_0xb3f4('0x2c')][_0xb3f4('0x1e')](_0x3616a2)[_0xb3f4('0x26')](function(_0x2a0a80){_0x522f58[_0xb3f4('0x1e')]=_0x2a0a80;if(_0x1db6d8[_0xb3f4('0x34')][_0xb3f4('0x3f')]){_0x5e71df['include']=[{'all':!![]}];}return db[_0xb3f4('0x2c')][_0xb3f4('0x40')](_0x5e71df);})['then'](function(_0x65b184){_0x522f58[_0xb3f4('0x41')]=_0x65b184;return _0x522f58;})[_0xb3f4('0x26')](respondWithFilteredResult(_0x4c704c,_0x5e71df))[_0xb3f4('0x42')](handleError(_0x4c704c,null));};exports[_0xb3f4('0x43')]=function(_0x54b4f9,_0x1040ce){var _0x3a5816={'raw':!![],'where':{'id':_0x54b4f9[_0xb3f4('0x44')]['id']}},_0x122c54={};_0x122c54[_0xb3f4('0x30')]=_[_0xb3f4('0x31')](db[_0xb3f4('0x2c')][_0xb3f4('0x2d')]);_0x122c54[_0xb3f4('0x34')]=_[_0xb3f4('0x31')](_0x54b4f9[_0xb3f4('0x34')]);_0x122c54[_0xb3f4('0x32')]=_[_0xb3f4('0x33')](_0x122c54[_0xb3f4('0x30')],_0x122c54[_0xb3f4('0x34')]);_0x3a5816['attributes']=_[_0xb3f4('0x33')](_0x122c54[_0xb3f4('0x30')],qs[_0xb3f4('0x36')](_0x54b4f9[_0xb3f4('0x34')]['fields']));_0x3a5816[_0xb3f4('0x35')]=_0x3a5816['attributes']['length']?_0x3a5816['attributes']:_0x122c54[_0xb3f4('0x30')];if(_0x54b4f9[_0xb3f4('0x34')]['includeAll']){_0x3a5816['include']=[{'all':!![]}];}_0x3a5816=_[_0xb3f4('0x3e')]({},_0x3a5816,_0x54b4f9['options']);return db[_0xb3f4('0x2c')]['find'](_0x3a5816)['then'](handleEntityNotFound(_0x1040ce,null))['then'](respondWithResult(_0x1040ce,null))[_0xb3f4('0x42')](handleError(_0x1040ce,null));};exports[_0xb3f4('0x45')]=function(_0x5bb924,_0x53743d){return db[_0xb3f4('0x2c')][_0xb3f4('0x45')](_0x5bb924[_0xb3f4('0x46')],{})[_0xb3f4('0x26')](respondWithResult(_0x53743d,0xc9))['catch'](handleError(_0x53743d,null));};exports[_0xb3f4('0x24')]=function(_0x21c9e8,_0x4173f9){if(_0x21c9e8[_0xb3f4('0x46')]['id']){delete _0x21c9e8[_0xb3f4('0x46')]['id'];}return db[_0xb3f4('0x2c')]['find']({'where':{'id':_0x21c9e8['params']['id']}})['then'](handleEntityNotFound(_0x4173f9,null))['then'](saveUpdates(_0x21c9e8[_0xb3f4('0x46')],null))[_0xb3f4('0x26')](respondWithResult(_0x4173f9,null))[_0xb3f4('0x42')](handleError(_0x4173f9,null));};exports[_0xb3f4('0x25')]=function(_0x3aa85a,_0x3c5cad){return db[_0xb3f4('0x2c')]['find']({'where':{'id':_0x3aa85a[_0xb3f4('0x44')]['id']}})[_0xb3f4('0x26')](handleEntityNotFound(_0x3c5cad,null))[_0xb3f4('0x26')](removeEntity(_0x3c5cad,null))[_0xb3f4('0x42')](handleError(_0x3c5cad,null));};exports[_0xb3f4('0x47')]=function(_0x1c074e,_0x592a49){return db[_0xb3f4('0x2c')][_0xb3f4('0x47')]()['then'](respondWithResult(_0x592a49,null))[_0xb3f4('0x42')](handleError(_0x592a49,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index f9e67d2..1aa843e 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 _0x6fd9=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util'];(function(_0x432c7a,_0x2c52b5){var _0x4eed0c=function(_0x398a9e){while(--_0x398a9e){_0x432c7a['push'](_0x432c7a['shift']());}};_0x4eed0c(++_0x2c52b5);}(_0x6fd9,0xb4));var _0x96fd=function(_0x4ec7a1,_0x340f98){_0x4ec7a1=_0x4ec7a1-0x0;var _0x7c04ad=_0x6fd9[_0x4ec7a1];return _0x7c04ad;};'use strict';var _=require(_0x96fd('0x0'));var util=require(_0x96fd('0x1'));var logger=require(_0x96fd('0x2'))(_0x96fd('0x3'));var moment=require(_0x96fd('0x4'));var BPromise=require(_0x96fd('0x5'));var rp=require(_0x96fd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x96fd('0x7'));var config=require(_0x96fd('0x8'));var attributes=require(_0x96fd('0x9'));module[_0x96fd('0xa')]=function(_0x258b36,_0x6ef003){return _0x258b36[_0x96fd('0xb')](_0x96fd('0xc'),attributes,{'tableName':_0x96fd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad99=['../../config/environment','./voiceTransferReport.attributes','exports','define','report_call_transfer','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x196594,_0xfb9122){var _0x413177=function(_0x319ec8){while(--_0x319ec8){_0x196594['push'](_0x196594['shift']());}};_0x413177(++_0xfb9122);}(_0xad99,0xa5));var _0x9ad9=function(_0x2baac8,_0x2eae91){_0x2baac8=_0x2baac8-0x0;var _0x5f4b44=_0xad99[_0x2baac8];return _0x5f4b44;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9ad9('0x0'))('api');var moment=require(_0x9ad9('0x1'));var BPromise=require('bluebird');var rp=require(_0x9ad9('0x2'));var fs=require('fs');var path=require(_0x9ad9('0x3'));var rimraf=require(_0x9ad9('0x4'));var config=require(_0x9ad9('0x5'));var attributes=require(_0x9ad9('0x6'));module[_0x9ad9('0x7')]=function(_0x3bd574,_0x17e7eb){return _0x3bd574[_0x9ad9('0x8')]('VoiceTransferReport',attributes,{'tableName':_0x9ad9('0x9'),'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 498f5cb..a5c8290 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 _0xf93f=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','stringify'];(function(_0x2e8b14,_0x3ca336){var _0x46c633=function(_0x33bab3){while(--_0x33bab3){_0x2e8b14['push'](_0x2e8b14['shift']());}};_0x46c633(++_0x3ca336);}(_0xf93f,0x1b0));var _0xff93=function(_0x15ab8e,_0x23c4d9){_0x15ab8e=_0x15ab8e-0x0;var _0x2e7f3a=_0xf93f[_0x15ab8e];return _0x2e7f3a;};'use strict';var _=require(_0xff93('0x0'));var util=require(_0xff93('0x1'));var moment=require(_0xff93('0x2'));var BPromise=require(_0xff93('0x3'));var rs=require(_0xff93('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff93('0x5'))['db'];var utils=require(_0xff93('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xff93('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xff93('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f66b2,_0x3e4a8d,_0x2efeb3){return new BPromise(function(_0x4f463f,_0x514c61){return client[_0xff93('0x9')](_0x1f66b2,_0x2efeb3)[_0xff93('0xa')](function(_0x4f7551){logger[_0xff93('0xb')](_0xff93('0xc'),_0x3e4a8d,_0xff93('0xd'));logger[_0xff93('0xe')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x3e4a8d,_0xff93('0xd'),JSON['stringify'](_0x4f7551));if(_0x4f7551[_0xff93('0xf')]){if(_0x4f7551['error'][_0xff93('0x10')]===0x1f4){logger[_0xff93('0xf')](_0xff93('0xc'),_0x3e4a8d,_0x4f7551[_0xff93('0xf')][_0xff93('0x11')]);return _0x514c61(_0x4f7551[_0xff93('0xf')][_0xff93('0x11')]);}logger[_0xff93('0xf')](_0xff93('0xc'),_0x3e4a8d,_0x4f7551['error'][_0xff93('0x11')]);return _0x4f463f(_0x4f7551['error']['message']);}else{logger[_0xff93('0xb')](_0xff93('0xc'),_0x3e4a8d,'request\x20sent');_0x4f463f(_0x4f7551[_0xff93('0x12')][_0xff93('0x11')]);}})[_0xff93('0x13')](function(_0x1373b9){logger[_0xff93('0xf')](_0xff93('0xc'),_0x3e4a8d,_0x1373b9);_0x514c61(_0x1373b9);});});}exports[_0xff93('0x14')]=function(_0x16c45c){var _0x275dc1=this;return new Promise(function(_0x18bd13,_0x46eaa4){return db[_0xff93('0x15')][_0xff93('0x16')](_0x16c45c[_0xff93('0x17')],{'raw':_0x16c45c[_0xff93('0x18')]?_0x16c45c[_0xff93('0x18')][_0xff93('0x19')]===undefined?!![]:![]:!![]})[_0xff93('0xa')](function(_0x539ebd){logger[_0xff93('0xb')](_0xff93('0x14'),_0x16c45c);logger[_0xff93('0xe')](_0xff93('0x14'),_0x16c45c,JSON[_0xff93('0x1a')](_0x539ebd));_0x18bd13(_0x539ebd);})['catch'](function(_0x35937a){logger[_0xff93('0xf')](_0xff93('0x14'),_0x35937a['message'],_0x16c45c);_0x46eaa4(_0x275dc1['error'](0x1f4,_0x35937a[_0xff93('0x11')]));});});}; \ No newline at end of file +var _0xf052=['../../config/environment','jayson/promise','client','http','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','stringify','util','moment','ioredis','../../config/logger','rpc'];(function(_0x1bd165,_0x59fada){var _0x587686=function(_0x53e5ba){while(--_0x53e5ba){_0x1bd165['push'](_0x1bd165['shift']());}};_0x587686(++_0x59fada);}(_0xf052,0x1cf));var _0x2f05=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xf052[_0x934425];return _0x31d596;};'use strict';var _=require('lodash');var util=require(_0x2f05('0x0'));var moment=require(_0x2f05('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f05('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2f05('0x3'))(_0x2f05('0x4'));var config=require(_0x2f05('0x5'));var jayson=require(_0x2f05('0x6'));var client=jayson[_0x2f05('0x7')][_0x2f05('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x55a28a,_0x281a70,_0x3d0bb4){return new BPromise(function(_0xc80e02,_0x4186ab){return client['request'](_0x55a28a,_0x3d0bb4)['then'](function(_0xea3dad){logger[_0x2f05('0x9')](_0x2f05('0xa'),_0x281a70,_0x2f05('0xb'));logger[_0x2f05('0xc')](_0x2f05('0xd'),_0x281a70,_0x2f05('0xb'),JSON['stringify'](_0xea3dad));if(_0xea3dad[_0x2f05('0xe')]){if(_0xea3dad['error']['code']===0x1f4){logger[_0x2f05('0xe')](_0x2f05('0xa'),_0x281a70,_0xea3dad[_0x2f05('0xe')][_0x2f05('0xf')]);return _0x4186ab(_0xea3dad[_0x2f05('0xe')][_0x2f05('0xf')]);}logger[_0x2f05('0xe')](_0x2f05('0xa'),_0x281a70,_0xea3dad[_0x2f05('0xe')]['message']);return _0xc80e02(_0xea3dad[_0x2f05('0xe')][_0x2f05('0xf')]);}else{logger[_0x2f05('0x9')](_0x2f05('0xa'),_0x281a70,_0x2f05('0xb'));_0xc80e02(_0xea3dad[_0x2f05('0x10')][_0x2f05('0xf')]);}})[_0x2f05('0x11')](function(_0x17c0e2){logger[_0x2f05('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x281a70,_0x17c0e2);_0x4186ab(_0x17c0e2);});});}exports[_0x2f05('0x12')]=function(_0x43c4ba){var _0x460b46=this;return new Promise(function(_0x207a1f,_0x12f297){return db[_0x2f05('0x13')][_0x2f05('0x14')](_0x43c4ba[_0x2f05('0x15')],{'raw':_0x43c4ba[_0x2f05('0x16')]?_0x43c4ba[_0x2f05('0x16')][_0x2f05('0x17')]===undefined?!![]:![]:!![]})[_0x2f05('0x18')](function(_0x382106){logger[_0x2f05('0x9')](_0x2f05('0x12'),_0x43c4ba);logger[_0x2f05('0xc')](_0x2f05('0x12'),_0x43c4ba,JSON[_0x2f05('0x19')](_0x382106));_0x207a1f(_0x382106);})['catch'](function(_0x472d00){logger[_0x2f05('0xe')]('CreateVoiceTransferReport',_0x472d00[_0x2f05('0xf')],_0x43c4ba);_0x12f297(_0x460b46[_0x2f05('0xe')](0x1f4,_0x472d00[_0x2f05('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 08593a4..f8a877d 100644 --- a/server/api/webbar/index.js +++ b/server/api/webbar/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['answer','hold','/unhold','unhold','calls','/transfer','exports','express','Router','../../components/auth/service','post','isAuthenticated','isWebrtcLicence','/hangup','/answer'];(function(_0x2bd6d9,_0x2071cb){var _0x4b4929=function(_0x41a57b){while(--_0x41a57b){_0x2bd6d9['push'](_0x2bd6d9['shift']());}};_0x4b4929(++_0x2071cb);}(_0x00bb,0x1d8));var _0xb00b=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x00bb[_0x55f8b4];return _0x2475f9;};'use strict';var express=require(_0xb00b('0x0'));var router=express[_0xb00b('0x1')]();var auth=require(_0xb00b('0x2'));var controller=require('./webbar.controller');router[_0xb00b('0x3')]('/originate',auth[_0xb00b('0x4')](),auth[_0xb00b('0x5')](),controller['originate']);router[_0xb00b('0x3')](_0xb00b('0x6'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller['hangup']);router[_0xb00b('0x3')](_0xb00b('0x7'),auth[_0xb00b('0x4')](),auth[_0xb00b('0x5')](),controller[_0xb00b('0x8')]);router[_0xb00b('0x3')]('/hold',auth['isAuthenticated'](),auth[_0xb00b('0x5')](),controller[_0xb00b('0x9')]);router[_0xb00b('0x3')](_0xb00b('0xa'),auth[_0xb00b('0x4')](),auth['isWebrtcLicence'](),controller[_0xb00b('0xb')]);router['post']('/calls',auth['isAuthenticated'](),auth[_0xb00b('0x5')](),controller[_0xb00b('0xc')]);router[_0xb00b('0x3')](_0xb00b('0xd'),auth[_0xb00b('0x4')](),auth[_0xb00b('0x5')](),controller['transfer']);module[_0xb00b('0xe')]=router; \ No newline at end of file +var _0x008c=['/transfer','transfer','express','Router','../../components/auth/service','./webbar.controller','post','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','answer','/calls','calls'];(function(_0x23704d,_0x255322){var _0x85c06e=function(_0x308723){while(--_0x308723){_0x23704d['push'](_0x23704d['shift']());}};_0x85c06e(++_0x255322);}(_0x008c,0x188));var _0xc008=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x008c[_0x2555d0];return _0x3bb486;};'use strict';var express=require(_0xc008('0x0'));var router=express[_0xc008('0x1')]();var auth=require(_0xc008('0x2'));var controller=require(_0xc008('0x3'));router[_0xc008('0x4')]('/originate',auth[_0xc008('0x5')](),auth[_0xc008('0x6')](),controller[_0xc008('0x7')]);router[_0xc008('0x4')](_0xc008('0x8'),auth[_0xc008('0x5')](),auth[_0xc008('0x6')](),controller[_0xc008('0x9')]);router[_0xc008('0x4')]('/answer',auth[_0xc008('0x5')](),auth['isWebrtcLicence'](),controller[_0xc008('0xa')]);router['post']('/hold',auth[_0xc008('0x5')](),auth[_0xc008('0x6')](),controller['hold']);router['post']('/unhold',auth[_0xc008('0x5')](),auth[_0xc008('0x6')](),controller['unhold']);router[_0xc008('0x4')](_0xc008('0xb'),auth[_0xc008('0x5')](),auth[_0xc008('0x6')](),controller[_0xc008('0xc')]);router[_0xc008('0x4')](_0xc008('0xd'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xc008('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index e0a896b..f05e43c 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 _0x9c5e=['webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','http','../../config/logger','ioredis','redis','defaults','socket.io-emitter','validate','number','callNumber\x20is\x20required','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','request','then','code','message','User','findOne','agent','VoiceChannels','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','webbar:hangup','answer','answer\x20executed!','hold','sessionId','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','filter','conference\x20fired:'];(function(_0x4967e3,_0xdd59ea){var _0x48a47b=function(_0x5c7b02){while(--_0x5c7b02){_0x4967e3['push'](_0x4967e3['shift']());}};_0x48a47b(++_0xdd59ea);}(_0x9c5e,0x9c));var _0xe9c5=function(_0x2a74f5,_0x542b0b){_0x2a74f5=_0x2a74f5-0x0;var _0x358258=_0x9c5e[_0x2a74f5];return _0x358258;};'use strict';var path=require(_0xe9c5('0x0'));var fs=require('fs');var _=require(_0xe9c5('0x1'));var db=require(_0xe9c5('0x2'))['db'];var config=require(_0xe9c5('0x3'));var util=require(_0xe9c5('0x4'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson['client'][_0xe9c5('0x5')]({'port':0x232a});var logger=require(_0xe9c5('0x6'))('webbarapi');var Redis=require(_0xe9c5('0x7'));config[_0xe9c5('0x8')]=_[_0xe9c5('0x9')](config[_0xe9c5('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xe9c5('0xa'))(new Redis(config[_0xe9c5('0x8')]));var Schema=require(_0xe9c5('0xb'));var originateValidation=new Schema({'userId':{'type':_0xe9c5('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0xe9c5('0xd')]},'callerId':{'type':_0xe9c5('0xe')},'callbackUrl':{'type':_0xe9c5('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0xe9c5('0xc'),'required':[!![],_0xe9c5('0xf')]},'sessionId':{'type':_0xe9c5('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xe9c5('0xc'),'required':[!![],_0xe9c5('0xf')]},'sessionId':{'type':_0xe9c5('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xe9c5('0xc'),'required':[!![],_0xe9c5('0xf')]},'sessionId':{'type':_0xe9c5('0xe'),'required':[!![],_0xe9c5('0x10')]},'transferNumber':{'type':_0xe9c5('0xe'),'required':[!![],_0xe9c5('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xe9c5('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xe9c5('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xe9c5('0xc'),'required':[!![],_0xe9c5('0xf')]},'sessionId':{'type':_0xe9c5('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xe9c5('0xc'),'required':[!![],_0xe9c5('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe9c5('0xf')]}});function emit(_0x14eb41,_0x5d5fb4,_0x3aa80b){logger[_0xe9c5('0x12')](_0x14eb41,_0x5d5fb4,JSON[_0xe9c5('0x13')](_0x3aa80b));io['to'](_0x14eb41)[_0xe9c5('0x14')](_0x5d5fb4,_0x3aa80b);}function handleError(_0x23156c){return function(_0x4d9c7d){console[_0xe9c5('0x15')](_0xe9c5('0x16'),_0x4d9c7d,_0x4d9c7d instanceof RangeError);logger[_0xe9c5('0x17')](_0x4d9c7d[_0xe9c5('0x18')]);if(_0x4d9c7d instanceof RangeError){if(_0x4d9c7d['name']){delete _0x4d9c7d[_0xe9c5('0x19')];}_0x23156c[_0xe9c5('0x1a')](0x194)[_0xe9c5('0x1b')](_0x4d9c7d);}else{if(_0x4d9c7d[_0xe9c5('0x19')]){delete _0x4d9c7d[_0xe9c5('0x19')];}_0x23156c['status'](0x1f4)['send'](_0x4d9c7d);}};}function checkError(){return function(_0xaa891){if(!_0xaa891){throw new RangeError('NotFound');}return _0xaa891;};}function respondWithRpcPromise(_0x3c3d53,_0xc4d208){return new BPromise(function(_0x21b02a,_0x4d16bc){var _0x5750ff=amiClient;return _0x5750ff[_0xe9c5('0x1c')](_0x3c3d53,_0xc4d208)[_0xe9c5('0x1d')](function(_0x37fb90){if(_0x37fb90[_0xe9c5('0x17')]){if(_0x37fb90[_0xe9c5('0x17')][_0xe9c5('0x1e')]===0x1f4){return _0x4d16bc(_0x37fb90[_0xe9c5('0x17')][_0xe9c5('0x1f')]);}return _0x21b02a(_0x37fb90[_0xe9c5('0x17')][_0xe9c5('0x1f')]);}else{_0x21b02a(_0x37fb90['result']);}})['catch'](function(_0x250e1c){_0x4d16bc(_0x250e1c);});});}function getAgent(_0x3dd39d){return db[_0xe9c5('0x20')][_0xe9c5('0x21')]({'where':{'id':_0x3dd39d,'role':_0xe9c5('0x22')}})[_0xe9c5('0x1d')](checkError());}function getAgentCheckSession(_0x493108,_0x2c3fcb){return new BPromise(function(_0x480187,_0x3fa00b){var _0x50256b=respondWithRpcPromise(_0xe9c5('0x23'));var _0x2112a6=getAgent(_0x493108);Promise['all']([_0x50256b,_0x2112a6])[_0xe9c5('0x1d')](function(_0x46d253){var _0x334f5a=_0x46d253[0x0];var _0x37cfa5=_0x46d253[0x1];var _0x1fa0f6=_['filter'](_0x334f5a[_0xe9c5('0x24')],function(_0x4fcabd){return _0x4fcabd[_0xe9c5('0x25')]==_0x37cfa5['id']&&_0x4fcabd['sessionId']==_0x2c3fcb;});if(_0x1fa0f6[_0xe9c5('0x26')]==0x1){_0x480187(_0x37cfa5);}else{_0x3fa00b(new RangeError(_0xe9c5('0x27')+_0x2c3fcb+_0xe9c5('0x28')));}});});}exports[_0xe9c5('0x29')]=function(_0x4766c8,_0x4e6043){logger[_0xe9c5('0x12')](_0xe9c5('0x2a'),_0x4766c8[_0xe9c5('0x2b')]);var _0x12ed89=originateValidation[_0xe9c5('0xb')](_0x4766c8['body']);if(_0x12ed89['length']>0x0){return _0x4e6043[_0xe9c5('0x1a')](0x190)[_0xe9c5('0x2c')](_0x12ed89);}var _0x3c409e=_0x4766c8[_0xe9c5('0x2b')][_0xe9c5('0x2d')];var _0x96753=_0x4766c8[_0xe9c5('0x2b')][_0xe9c5('0x2e')];var _0x4feba2=_0x4766c8[_0xe9c5('0x2b')][_0xe9c5('0x2f')];var _0x558277=_0x4766c8[_0xe9c5('0x2b')]['callbackUrl'];return getAgent(_0x3c409e)[_0xe9c5('0x1d')](function(_0x2642cc){logger[_0xe9c5('0x12')](_0xe9c5('0x30'),_0x2642cc[_0xe9c5('0x19')]);emit(util[_0xe9c5('0x31')](_0xe9c5('0x32'),_0x2642cc[_0xe9c5('0x19')]),_0xe9c5('0x33'),{'callNumber':_0x96753,'callerId':_0x4feba2,'callbackUrl':_0x558277});return _0x4e6043[_0xe9c5('0x1a')](0xc8)[_0xe9c5('0x2c')]({'error':![],'message':_0xe9c5('0x34')});})[_0xe9c5('0x35')](handleError(_0x4e6043));};exports[_0xe9c5('0x36')]=function(_0x312168,_0x4570e9){logger[_0xe9c5('0x12')](_0xe9c5('0x37'),_0x312168[_0xe9c5('0x2b')]);var _0x55cd00=hangupValidation[_0xe9c5('0xb')](_0x312168[_0xe9c5('0x2b')]);if(_0x55cd00[_0xe9c5('0x26')]>0x0){return _0x4570e9[_0xe9c5('0x1a')](0x190)[_0xe9c5('0x2c')](_0x55cd00);}var _0x3b85bf=_0x312168['body'][_0xe9c5('0x2d')];var _0x420558=_0x312168[_0xe9c5('0x2b')]['sessionId'];return getAgent(_0x3b85bf)[_0xe9c5('0x1d')](function(_0x1bf7c5){logger[_0xe9c5('0x12')](_0xe9c5('0x30'),_0x1bf7c5[_0xe9c5('0x19')]);emit(util[_0xe9c5('0x31')](_0xe9c5('0x32'),_0x1bf7c5[_0xe9c5('0x19')]),_0xe9c5('0x38'),{'sessionId':_0x420558});return _0x4570e9[_0xe9c5('0x1a')](0xc8)[_0xe9c5('0x2c')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x4570e9));};exports[_0xe9c5('0x39')]=function(_0xbde18b,_0x21bc80){logger[_0xe9c5('0x12')]('answer\x20fired:',_0xbde18b['body']);var _0x382405=answerValidation[_0xe9c5('0xb')](_0xbde18b['body']);if(_0x382405[_0xe9c5('0x26')]>0x0){return _0x21bc80['status'](0x190)['json'](_0x382405);}var _0x5c395d=_0xbde18b[_0xe9c5('0x2b')][_0xe9c5('0x2d')];var _0x1d081a=_0xbde18b[_0xe9c5('0x2b')]['sessionId'];return getAgent(_0x5c395d)[_0xe9c5('0x1d')](function(_0x2ae53a){logger[_0xe9c5('0x12')](_0xe9c5('0x30'),_0x2ae53a[_0xe9c5('0x19')]);emit(util[_0xe9c5('0x31')](_0xe9c5('0x32'),_0x2ae53a[_0xe9c5('0x19')]),'webbar:answer',{'sessionId':_0x1d081a});return _0x21bc80[_0xe9c5('0x1a')](0xc8)[_0xe9c5('0x2c')]({'error':![],'message':_0xe9c5('0x3a')});})[_0xe9c5('0x35')](handleError(_0x21bc80));};exports[_0xe9c5('0x3b')]=function(_0x537fcc,_0x562066){logger['info']('hold\x20fired:',_0x537fcc['body']);var _0xa5bf36=holdValidation[_0xe9c5('0xb')](_0x537fcc[_0xe9c5('0x2b')]);if(_0xa5bf36['length']>0x0){return _0x562066[_0xe9c5('0x1a')](0x190)[_0xe9c5('0x2c')](_0xa5bf36);}var _0x1ed99e=_0x537fcc[_0xe9c5('0x2b')][_0xe9c5('0x2d')];var _0x27b8db=_0x537fcc['body'][_0xe9c5('0x3c')];return getAgent(_0x1ed99e)[_0xe9c5('0x1d')](function(_0x1da6a3){logger[_0xe9c5('0x12')]('entityFound:',_0x1da6a3[_0xe9c5('0x19')]);emit(util[_0xe9c5('0x31')](_0xe9c5('0x32'),_0x1da6a3[_0xe9c5('0x19')]),_0xe9c5('0x3d'),{'sessionId':_0x27b8db});return _0x562066[_0xe9c5('0x1a')](0xc8)['json']({'error':![],'message':_0xe9c5('0x3e')});})[_0xe9c5('0x35')](handleError(_0x562066));};exports[_0xe9c5('0x3f')]=function(_0x9d0154,_0x5e7c24){logger[_0xe9c5('0x12')](_0xe9c5('0x40'),_0x9d0154[_0xe9c5('0x2b')]);var _0x284706=unholdValidation[_0xe9c5('0xb')](_0x9d0154[_0xe9c5('0x2b')]);if(_0x284706['length']>0x0){return _0x5e7c24['status'](0x190)[_0xe9c5('0x2c')](_0x284706);}var _0x15380c=_0x9d0154[_0xe9c5('0x2b')][_0xe9c5('0x2d')];var _0x30a79b=_0x9d0154[_0xe9c5('0x2b')][_0xe9c5('0x3c')];return getAgent(_0x15380c)[_0xe9c5('0x1d')](function(_0x276393){logger[_0xe9c5('0x12')](_0xe9c5('0x30'),_0x276393[_0xe9c5('0x19')]);emit(util[_0xe9c5('0x31')](_0xe9c5('0x32'),_0x276393[_0xe9c5('0x19')]),_0xe9c5('0x41'),{'sessionId':_0x30a79b});return _0x5e7c24['status'](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0xe9c5('0x35')](handleError(_0x5e7c24));};exports[_0xe9c5('0x42')]=function(_0x2b8076,_0x5504d9){logger[_0xe9c5('0x12')]('calls\x20fired:',_0x5504d9[_0xe9c5('0x2b')]);var _0xbac8ef=callsValidation[_0xe9c5('0xb')](_0x2b8076[_0xe9c5('0x2b')]);if(_0xbac8ef[_0xe9c5('0x26')]>0x0){return _0x5504d9['status'](0x190)[_0xe9c5('0x2c')](_0xbac8ef);}var _0x1b4515=_0x2b8076['body'][_0xe9c5('0x2d')];var _0x424f1d=respondWithRpcPromise(_0xe9c5('0x23'));var _0x20d8e8=getAgent(_0x1b4515);return Promise['all']([_0x424f1d,_0x20d8e8])[_0xe9c5('0x1d')](function(_0x499f4f){var _0x1f978d=_0x499f4f[0x0];var _0x40c555=_0x499f4f[0x1];var _0x277323=_[_0xe9c5('0x43')](_0x1f978d['rows'],function(_0x4439cf){return _0x4439cf[_0xe9c5('0x25')]==_0x40c555['id'];});return _0x5504d9[_0xe9c5('0x1a')](0xc8)[_0xe9c5('0x2c')]({'count':_0x277323[_0xe9c5('0x26')],'rows':_0x277323});})[_0xe9c5('0x35')](handleError(_0x5504d9));};exports['conference']=function(_0x2dd877,_0x181a9c){logger['info'](_0xe9c5('0x44'),_0x2dd877['body']);var _0x1e5603=conferenceValidation[_0xe9c5('0xb')](_0x2dd877[_0xe9c5('0x2b')]);if(_0x1e5603[_0xe9c5('0x26')]>0x0){return _0x181a9c[_0xe9c5('0x1a')](0x190)[_0xe9c5('0x2c')](_0x1e5603);}var _0xa2ba99=_0x2dd877['body'][_0xe9c5('0x2d')];return getAgent(_0xa2ba99)[_0xe9c5('0x1d')](function(_0x117e9f){logger['info'](_0xe9c5('0x30'),_0x117e9f['name']);emit(util['format'](_0xe9c5('0x32'),_0x117e9f[_0xe9c5('0x19')]),_0xe9c5('0x45'));return _0x181a9c[_0xe9c5('0x1a')](0xc8)[_0xe9c5('0x2c')]({'error':![],'message':_0xe9c5('0x46')});})[_0xe9c5('0x35')](handleError(_0x181a9c));};exports[_0xe9c5('0x47')]=function(_0x344235,_0x213be5){logger['info'](_0xe9c5('0x48'),_0x344235[_0xe9c5('0x2b')]);var _0x257a96=transferValidation[_0xe9c5('0xb')](_0x344235[_0xe9c5('0x2b')]);if(_0x257a96[_0xe9c5('0x26')]>0x0){return _0x213be5[_0xe9c5('0x1a')](0x190)[_0xe9c5('0x2c')](_0x257a96);}var _0x8b6101=_0x344235['body'][_0xe9c5('0x2d')];var _0x1caca3=_0x344235[_0xe9c5('0x2b')][_0xe9c5('0x3c')];var _0x1db82f=_0x344235[_0xe9c5('0x2b')][_0xe9c5('0x49')];return getAgent(_0x8b6101)['then'](function(_0xfe9e61){logger[_0xe9c5('0x12')](_0xe9c5('0x30'),_0xfe9e61[_0xe9c5('0x19')]);emit(util[_0xe9c5('0x31')]('user:%s',_0xfe9e61[_0xe9c5('0x19')]),'webbar:transfer',{'sessionId':_0x1caca3,'transferNumber':_0x1db82f});return _0x213be5['status'](0xc8)[_0xe9c5('0x2c')]({'error':![],'message':_0xe9c5('0x4a')});})['catch'](handleError(_0x213be5));}; \ No newline at end of file +var _0x4ded=['User','findOne','agent','VoiceChannels','all','filter','rows','length','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','hangup','sessionId','user:%s','webbar:hangup','hangup\x20executed!','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','UserId','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','defaults','redis','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','stack','name','status','send','NotFound','request','then','error','code','message','result','catch'];(function(_0x1529a3,_0x529f63){var _0x1a0d4b=function(_0x6f1058){while(--_0x6f1058){_0x1529a3['push'](_0x1529a3['shift']());}};_0x1a0d4b(++_0x529f63);}(_0x4ded,0x116));var _0xd4de=function(_0x50522a,_0x3531d3){_0x50522a=_0x50522a-0x0;var _0x3ba289=_0x4ded[_0x50522a];return _0x3ba289;};'use strict';var path=require(_0xd4de('0x0'));var fs=require('fs');var _=require(_0xd4de('0x1'));var db=require(_0xd4de('0x2'))['db'];var config=require(_0xd4de('0x3'));var util=require(_0xd4de('0x4'));var BPromise=require(_0xd4de('0x5'));var jayson=require(_0xd4de('0x6'));var amiClient=jayson[_0xd4de('0x7')][_0xd4de('0x8')]({'port':0x232a});var logger=require(_0xd4de('0x9'))(_0xd4de('0xa'));var Redis=require(_0xd4de('0xb'));config['redis']=_[_0xd4de('0xc')](config[_0xd4de('0xd')],{'host':_0xd4de('0xe'),'port':0x18eb});var io=require(_0xd4de('0xf'))(new Redis(config[_0xd4de('0xd')]));var Schema=require(_0xd4de('0x10'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xd4de('0x11')]},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0xd4de('0x12')}});var hangupValidation=new Schema({'userId':{'type':_0xd4de('0x13'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0xd4de('0x11')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xd4de('0x13'),'required':[!![],_0xd4de('0x11')]},'sessionId':{'type':_0xd4de('0x12'),'required':[!![],_0xd4de('0x14')]},'transferNumber':{'type':_0xd4de('0x12'),'required':[!![],_0xd4de('0x15')]}});var holdValidation=new Schema({'userId':{'type':_0xd4de('0x13'),'required':[!![],_0xd4de('0x11')]},'sessionId':{'type':_0xd4de('0x12'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xd4de('0x13'),'required':[!![],_0xd4de('0x11')]},'sessionId':{'type':_0xd4de('0x12'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xd4de('0x13'),'required':[!![],_0xd4de('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0xd4de('0x13'),'required':[!![],_0xd4de('0x11')]}});function emit(_0x325fba,_0x4b0a95,_0x5d0aeb){logger[_0xd4de('0x16')](_0x325fba,_0x4b0a95,JSON[_0xd4de('0x17')](_0x5d0aeb));io['to'](_0x325fba)[_0xd4de('0x18')](_0x4b0a95,_0x5d0aeb);}function handleError(_0x428aa2){return function(_0x5b1d1c){console['log'](_0xd4de('0x19'),_0x5b1d1c,_0x5b1d1c instanceof RangeError);logger['error'](_0x5b1d1c[_0xd4de('0x1a')]);if(_0x5b1d1c instanceof RangeError){if(_0x5b1d1c[_0xd4de('0x1b')]){delete _0x5b1d1c['name'];}_0x428aa2[_0xd4de('0x1c')](0x194)['send'](_0x5b1d1c);}else{if(_0x5b1d1c[_0xd4de('0x1b')]){delete _0x5b1d1c[_0xd4de('0x1b')];}_0x428aa2[_0xd4de('0x1c')](0x1f4)[_0xd4de('0x1d')](_0x5b1d1c);}};}function checkError(){return function(_0x5368f5){if(!_0x5368f5){throw new RangeError(_0xd4de('0x1e'));}return _0x5368f5;};}function respondWithRpcPromise(_0x47311c,_0x360e3d){return new BPromise(function(_0xdb3fc,_0x1c631a){var _0x2d092a=amiClient;return _0x2d092a[_0xd4de('0x1f')](_0x47311c,_0x360e3d)[_0xd4de('0x20')](function(_0x2f9de6){if(_0x2f9de6[_0xd4de('0x21')]){if(_0x2f9de6['error'][_0xd4de('0x22')]===0x1f4){return _0x1c631a(_0x2f9de6[_0xd4de('0x21')][_0xd4de('0x23')]);}return _0xdb3fc(_0x2f9de6[_0xd4de('0x21')][_0xd4de('0x23')]);}else{_0xdb3fc(_0x2f9de6[_0xd4de('0x24')]);}})[_0xd4de('0x25')](function(_0x36308c){_0x1c631a(_0x36308c);});});}function getAgent(_0x2aa82a){return db[_0xd4de('0x26')][_0xd4de('0x27')]({'where':{'id':_0x2aa82a,'role':_0xd4de('0x28')}})['then'](checkError());}function getAgentCheckSession(_0xe64e4e,_0x35e2fc){return new BPromise(function(_0x5005b0,_0x1d7d37){var _0x59b3c5=respondWithRpcPromise(_0xd4de('0x29'));var _0x32e407=getAgent(_0xe64e4e);Promise[_0xd4de('0x2a')]([_0x59b3c5,_0x32e407])['then'](function(_0xd4de93){var _0x36f2f1=_0xd4de93[0x0];var _0x17f0a=_0xd4de93[0x1];var _0x50cb73=_[_0xd4de('0x2b')](_0x36f2f1[_0xd4de('0x2c')],function(_0x55f9f9){return _0x55f9f9['UserId']==_0x17f0a['id']&&_0x55f9f9['sessionId']==_0x35e2fc;});if(_0x50cb73[_0xd4de('0x2d')]==0x1){_0x5005b0(_0x17f0a);}else{_0x1d7d37(new RangeError('sessionId\x20'+_0x35e2fc+_0xd4de('0x2e')));}});});}exports[_0xd4de('0x2f')]=function(_0x3bc54d,_0x2e08eb){logger['info'](_0xd4de('0x30'),_0x3bc54d[_0xd4de('0x31')]);var _0x4e43a1=originateValidation[_0xd4de('0x10')](_0x3bc54d[_0xd4de('0x31')]);if(_0x4e43a1['length']>0x0){return _0x2e08eb['status'](0x190)[_0xd4de('0x32')](_0x4e43a1);}var _0x40114b=_0x3bc54d[_0xd4de('0x31')][_0xd4de('0x33')];var _0x4f565b=_0x3bc54d[_0xd4de('0x31')][_0xd4de('0x34')];var _0x4def30=_0x3bc54d[_0xd4de('0x31')][_0xd4de('0x35')];var _0x1e744e=_0x3bc54d[_0xd4de('0x31')][_0xd4de('0x36')];return getAgent(_0x40114b)[_0xd4de('0x20')](function(_0x53441c){logger['info'](_0xd4de('0x37'),_0x53441c[_0xd4de('0x1b')]);emit(util[_0xd4de('0x38')]('user:%s',_0x53441c[_0xd4de('0x1b')]),_0xd4de('0x39'),{'callNumber':_0x4f565b,'callerId':_0x4def30,'callbackUrl':_0x1e744e});return _0x2e08eb['status'](0xc8)[_0xd4de('0x32')]({'error':![],'message':_0xd4de('0x3a')});})[_0xd4de('0x25')](handleError(_0x2e08eb));};exports[_0xd4de('0x3b')]=function(_0x4c5898,_0x53d7dc){logger[_0xd4de('0x16')]('hangup\x20fired:',_0x4c5898[_0xd4de('0x31')]);var _0x4de12c=hangupValidation[_0xd4de('0x10')](_0x4c5898[_0xd4de('0x31')]);if(_0x4de12c[_0xd4de('0x2d')]>0x0){return _0x53d7dc[_0xd4de('0x1c')](0x190)['json'](_0x4de12c);}var _0x21209d=_0x4c5898['body'][_0xd4de('0x33')];var _0x280f76=_0x4c5898[_0xd4de('0x31')][_0xd4de('0x3c')];return getAgent(_0x21209d)[_0xd4de('0x20')](function(_0x13c256){logger[_0xd4de('0x16')]('entityFound:',_0x13c256[_0xd4de('0x1b')]);emit(util[_0xd4de('0x38')](_0xd4de('0x3d'),_0x13c256[_0xd4de('0x1b')]),_0xd4de('0x3e'),{'sessionId':_0x280f76});return _0x53d7dc['status'](0xc8)[_0xd4de('0x32')]({'error':![],'message':_0xd4de('0x3f')});})[_0xd4de('0x25')](handleError(_0x53d7dc));};exports['answer']=function(_0x3eaa14,_0x1f2ff4){logger[_0xd4de('0x16')]('answer\x20fired:',_0x3eaa14[_0xd4de('0x31')]);var _0x10a42c=answerValidation[_0xd4de('0x10')](_0x3eaa14[_0xd4de('0x31')]);if(_0x10a42c[_0xd4de('0x2d')]>0x0){return _0x1f2ff4[_0xd4de('0x1c')](0x190)[_0xd4de('0x32')](_0x10a42c);}var _0x5ecbbd=_0x3eaa14[_0xd4de('0x31')][_0xd4de('0x33')];var _0x58082a=_0x3eaa14['body'][_0xd4de('0x3c')];return getAgent(_0x5ecbbd)[_0xd4de('0x20')](function(_0x20245a){logger['info']('entityFound:',_0x20245a[_0xd4de('0x1b')]);emit(util[_0xd4de('0x38')]('user:%s',_0x20245a[_0xd4de('0x1b')]),_0xd4de('0x40'),{'sessionId':_0x58082a});return _0x1f2ff4[_0xd4de('0x1c')](0xc8)[_0xd4de('0x32')]({'error':![],'message':'answer\x20executed!'});})[_0xd4de('0x25')](handleError(_0x1f2ff4));};exports[_0xd4de('0x41')]=function(_0x579700,_0x3745ef){logger[_0xd4de('0x16')](_0xd4de('0x42'),_0x579700['body']);var _0x2f775c=holdValidation[_0xd4de('0x10')](_0x579700[_0xd4de('0x31')]);if(_0x2f775c[_0xd4de('0x2d')]>0x0){return _0x3745ef[_0xd4de('0x1c')](0x190)[_0xd4de('0x32')](_0x2f775c);}var _0x40bf55=_0x579700[_0xd4de('0x31')][_0xd4de('0x33')];var _0x2e46b3=_0x579700['body'][_0xd4de('0x3c')];return getAgent(_0x40bf55)[_0xd4de('0x20')](function(_0x178daf){logger['info'](_0xd4de('0x37'),_0x178daf[_0xd4de('0x1b')]);emit(util[_0xd4de('0x38')](_0xd4de('0x3d'),_0x178daf[_0xd4de('0x1b')]),_0xd4de('0x43'),{'sessionId':_0x2e46b3});return _0x3745ef[_0xd4de('0x1c')](0xc8)[_0xd4de('0x32')]({'error':![],'message':_0xd4de('0x44')});})[_0xd4de('0x25')](handleError(_0x3745ef));};exports['unhold']=function(_0x3e4c7f,_0x26d032){logger[_0xd4de('0x16')](_0xd4de('0x45'),_0x3e4c7f[_0xd4de('0x31')]);var _0x584548=unholdValidation['validate'](_0x3e4c7f[_0xd4de('0x31')]);if(_0x584548[_0xd4de('0x2d')]>0x0){return _0x26d032['status'](0x190)['json'](_0x584548);}var _0x2d8589=_0x3e4c7f[_0xd4de('0x31')][_0xd4de('0x33')];var _0x199440=_0x3e4c7f[_0xd4de('0x31')][_0xd4de('0x3c')];return getAgent(_0x2d8589)[_0xd4de('0x20')](function(_0x4801de){logger[_0xd4de('0x16')](_0xd4de('0x37'),_0x4801de[_0xd4de('0x1b')]);emit(util[_0xd4de('0x38')]('user:%s',_0x4801de[_0xd4de('0x1b')]),_0xd4de('0x46'),{'sessionId':_0x199440});return _0x26d032[_0xd4de('0x1c')](0xc8)[_0xd4de('0x32')]({'error':![],'message':_0xd4de('0x47')});})[_0xd4de('0x25')](handleError(_0x26d032));};exports['calls']=function(_0x70a48b,_0x5896c5){logger['info'](_0xd4de('0x48'),_0x5896c5[_0xd4de('0x31')]);var _0x2d1e45=callsValidation[_0xd4de('0x10')](_0x70a48b['body']);if(_0x2d1e45[_0xd4de('0x2d')]>0x0){return _0x5896c5[_0xd4de('0x1c')](0x190)[_0xd4de('0x32')](_0x2d1e45);}var _0x117052=_0x70a48b[_0xd4de('0x31')]['userId'];var _0x5496f7=respondWithRpcPromise('VoiceChannels');var _0x3f6d8c=getAgent(_0x117052);return Promise[_0xd4de('0x2a')]([_0x5496f7,_0x3f6d8c])[_0xd4de('0x20')](function(_0x3c5f7a){var _0x5be7d2=_0x3c5f7a[0x0];var _0x35ba6f=_0x3c5f7a[0x1];var _0x146eaa=_[_0xd4de('0x2b')](_0x5be7d2[_0xd4de('0x2c')],function(_0x51e239){return _0x51e239[_0xd4de('0x49')]==_0x35ba6f['id'];});return _0x5896c5[_0xd4de('0x1c')](0xc8)[_0xd4de('0x32')]({'count':_0x146eaa[_0xd4de('0x2d')],'rows':_0x146eaa});})['catch'](handleError(_0x5896c5));};exports['conference']=function(_0x5aeab7,_0x42e40b){logger[_0xd4de('0x16')](_0xd4de('0x4a'),_0x5aeab7['body']);var _0x18f2c3=conferenceValidation[_0xd4de('0x10')](_0x5aeab7[_0xd4de('0x31')]);if(_0x18f2c3['length']>0x0){return _0x42e40b[_0xd4de('0x1c')](0x190)['json'](_0x18f2c3);}var _0x2ee7c1=_0x5aeab7[_0xd4de('0x31')][_0xd4de('0x33')];return getAgent(_0x2ee7c1)[_0xd4de('0x20')](function(_0x9b082d){logger[_0xd4de('0x16')](_0xd4de('0x37'),_0x9b082d[_0xd4de('0x1b')]);emit(util['format'](_0xd4de('0x3d'),_0x9b082d['name']),_0xd4de('0x4b'));return _0x42e40b[_0xd4de('0x1c')](0xc8)['json']({'error':![],'message':_0xd4de('0x4c')});})[_0xd4de('0x25')](handleError(_0x42e40b));};exports[_0xd4de('0x4d')]=function(_0x4652b9,_0x26a803){logger[_0xd4de('0x16')](_0xd4de('0x4e'),_0x4652b9[_0xd4de('0x31')]);var _0x1c2f97=transferValidation[_0xd4de('0x10')](_0x4652b9[_0xd4de('0x31')]);if(_0x1c2f97[_0xd4de('0x2d')]>0x0){return _0x26a803[_0xd4de('0x1c')](0x190)['json'](_0x1c2f97);}var _0x38d703=_0x4652b9[_0xd4de('0x31')][_0xd4de('0x33')];var _0x331f08=_0x4652b9[_0xd4de('0x31')][_0xd4de('0x3c')];var _0x26bf55=_0x4652b9[_0xd4de('0x31')]['transferNumber'];return getAgent(_0x38d703)[_0xd4de('0x20')](function(_0x538d98){logger['info']('entityFound:',_0x538d98[_0xd4de('0x1b')]);emit(util[_0xd4de('0x38')]('user:%s',_0x538d98['name']),'webbar:transfer',{'sessionId':_0x331f08,'transferNumber':_0x26bf55});return _0x26a803['status'](0xc8)[_0xd4de('0x32')]({'error':![],'message':'transfer\x20executed!'});})[_0xd4de('0x25')](handleError(_0x26a803));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index c55eb11..859c9f3 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 _0xda2d=['/:id','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','util','path','connect-timeout','express','Router','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addApplications','/:id/notify','notify','/:id/send','send','put','delete'];(function(_0x2a39fc,_0x3cadf5){var _0x22e8fd=function(_0x554270){while(--_0x554270){_0x2a39fc['push'](_0x2a39fc['shift']());}};_0x22e8fd(++_0x3cadf5);}(_0xda2d,0x102));var _0xdda2=function(_0x3f95b5,_0xf1b673){_0x3f95b5=_0x3f95b5-0x0;var _0x15a3a1=_0xda2d[_0x3f95b5];return _0x15a3a1;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0x7')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xc')]);router['get'](_0xdda2('0xd'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xe')]);router[_0xdda2('0x7')](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x10')]);router[_0xdda2('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xdda2('0x7')](_0xdda2('0x11'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x12')]);router[_0xdda2('0x13')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x14')]);router['post'](_0xdda2('0xd'),auth['isAuthenticated'](),controller[_0xdda2('0x15')]);router[_0xdda2('0x13')](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x16')]);router['post']('/:id/users',auth[_0xdda2('0x8')](),controller['addAgents']);router[_0xdda2('0x13')](_0xdda2('0x11'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x17')]);router[_0xdda2('0x13')](_0xdda2('0x18'),controller[_0xdda2('0x19')]);router[_0xdda2('0x13')](_0xdda2('0x1a'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x1b')]);router[_0xdda2('0x1c')]('/:id',auth[_0xdda2('0x8')](),controller['update']);router[_0xdda2('0x1d')](_0xdda2('0x1e'),auth[_0xdda2('0x8')](),controller['destroy']);router[_0xdda2('0x1d')]('/:id/dispositions',auth[_0xdda2('0x8')](),controller[_0xdda2('0x1f')]);router['delete'](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x20')]);router[_0xdda2('0x1d')](_0xdda2('0x21'),auth['isAuthenticated'](),controller[_0xdda2('0x22')]);module[_0xdda2('0x23')]=router; \ No newline at end of file +var _0xda2d=['/:id','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','util','path','connect-timeout','express','Router','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addApplications','/:id/notify','notify','/:id/send','send','put','delete'];(function(_0x11e888,_0x494bd9){var _0x2fe4dd=function(_0x3975c5){while(--_0x3975c5){_0x11e888['push'](_0x11e888['shift']());}};_0x2fe4dd(++_0x494bd9);}(_0xda2d,0x102));var _0xdda2=function(_0x4b53a7,_0x325efa){_0x4b53a7=_0x4b53a7-0x0;var _0x1cef5e=_0xda2d[_0x4b53a7];return _0x1cef5e;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0x7')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xc')]);router['get'](_0xdda2('0xd'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xe')]);router[_0xdda2('0x7')](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x10')]);router[_0xdda2('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xdda2('0x7')](_0xdda2('0x11'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x12')]);router[_0xdda2('0x13')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x14')]);router['post'](_0xdda2('0xd'),auth['isAuthenticated'](),controller[_0xdda2('0x15')]);router[_0xdda2('0x13')](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x16')]);router['post']('/:id/users',auth[_0xdda2('0x8')](),controller['addAgents']);router[_0xdda2('0x13')](_0xdda2('0x11'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x17')]);router[_0xdda2('0x13')](_0xdda2('0x18'),controller[_0xdda2('0x19')]);router[_0xdda2('0x13')](_0xdda2('0x1a'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x1b')]);router[_0xdda2('0x1c')]('/:id',auth[_0xdda2('0x8')](),controller['update']);router[_0xdda2('0x1d')](_0xdda2('0x1e'),auth[_0xdda2('0x8')](),controller['destroy']);router[_0xdda2('0x1d')]('/:id/dispositions',auth[_0xdda2('0x8')](),controller[_0xdda2('0x1f')]);router['delete'](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x20')]);router[_0xdda2('0x1d')](_0xdda2('0x21'),auth['isAuthenticated'](),controller[_0xdda2('0x22')]);module[_0xdda2('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index e9f0e02..6e72821 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 _0xd074=['sequelize','randomstring','exports','name','STRING','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd074,0x1cb));var _0x4d07=function(_0x51d26e,_0x5bc3ae){_0x51d26e=_0x51d26e-0x0;var _0x10c10a=_0xd074[_0x51d26e];return _0x10c10a;};'use strict';var Sequelize=require(_0x4d07('0x0'));var rs=require(_0x4d07('0x1'));module[_0x4d07('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x4d07('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x4d07('0x4')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x4d07('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4d07('0x6')](_0x4d07('0x7'),_0x4d07('0x8'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x4d07('0x4')]},'authToken':{'type':Sequelize[_0x4d07('0x4')]},'notificationTemplate':{'type':Sequelize[_0x4d07('0x9')],'defaultValue':function(){return _0x4d07('0xa');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x4d07('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4d07('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4d07('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4d07('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4d07('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4d07('0xc')],'comment':_0x4d07('0xd')},'mandatoryDisposition':{'type':Sequelize[_0x4d07('0xb')],'defaultValue':![],'comment':_0x4d07('0xe'),'set':function(_0x5dd237){if(!_0x5dd237){this[_0x4d07('0xf')]('mandatoryDispositionPauseId',null);}this[_0x4d07('0xf')](_0x4d07('0x10'),_0x5dd237);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x98ae=['ENUM','twilio','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','STRING','name','generate'];(function(_0x4657fa,_0x32b9f8){var _0x4da751=function(_0x1446cc){while(--_0x1446cc){_0x4657fa['push'](_0x4657fa['shift']());}};_0x4da751(++_0x32b9f8);}(_0x98ae,0x15a));var _0xe98a=function(_0x475663,_0x1ebe6c){_0x475663=_0x475663-0x0;var _0x42e7de=_0x98ae[_0x475663];return _0x42e7de;};'use strict';var Sequelize=require(_0xe98a('0x0'));var rs=require(_0xe98a('0x1'));module['exports']={'name':{'type':Sequelize[_0xe98a('0x2')],'unique':_0xe98a('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xe98a('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xe98a('0x4')]();}},'phone':{'type':Sequelize[_0xe98a('0x2')]},'type':{'type':Sequelize[_0xe98a('0x5')](_0xe98a('0x6'),'sinch')},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0xe98a('0x2')]},'authToken':{'type':Sequelize[_0xe98a('0x2')]},'notificationTemplate':{'type':Sequelize[_0xe98a('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xe98a('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe98a('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe98a('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe98a('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe98a('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xe98a('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xe98a('0x8')],'defaultValue':![],'comment':_0xe98a('0xb'),'set':function(_0x1621b5){if(!_0x1621b5){this[_0xe98a('0xc')]('mandatoryDispositionPauseId',null);}this[_0xe98a('0xc')]('mandatoryDisposition',_0x1621b5);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 0999f60..8518167 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 _0xb7b9=['Messages','spread','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','params','include','create','body','user','get','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','omit','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','whatsapp','Applications','account','sinch','statuses','state','WhatsappMessage','message_id','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','From','replace','whatsapp:','MessageSid','from','notifications','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','list','Contacts','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','to\x20is\x20mandatory','List'];(function(_0x478a19,_0x2ff359){var _0x7fd2fa=function(_0x2aeb50){while(--_0x2aeb50){_0x478a19['push'](_0x478a19['shift']());}};_0x7fd2fa(++_0x2ff359);}(_0xb7b9,0x180));var _0x9b7b=function(_0x4ef8ee,_0x1109b8){_0x4ef8ee=_0x4ef8ee-0x0;var _0x24614a=_0xb7b9[_0x4ef8ee];return _0x24614a;};'use strict';var emlformat=require(_0x9b7b('0x0'));var rimraf=require(_0x9b7b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9b7b('0x2'));var rp=require(_0x9b7b('0x3'));var moment=require('moment');var BPromise=require(_0x9b7b('0x4'));var Mustache=require(_0x9b7b('0x5'));var util=require(_0x9b7b('0x6'));var path=require(_0x9b7b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9b7b('0x8'));var _=require('lodash');var squel=require(_0x9b7b('0x9'));var crypto=require(_0x9b7b('0xa'));var jsforce=require(_0x9b7b('0xb'));var deskjs=require(_0x9b7b('0xc'));var toCsv=require(_0x9b7b('0xd'));var querystring=require(_0x9b7b('0xe'));var Papa=require(_0x9b7b('0xf'));var Redis=require(_0x9b7b('0x10'));var authService=require(_0x9b7b('0x11'));var qs=require(_0x9b7b('0x12'));var as=require(_0x9b7b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b7b('0x14'))('api');var utils=require(_0x9b7b('0x15'));var config=require(_0x9b7b('0x16'));var licenseUtil=require(_0x9b7b('0x17'));var db=require('../../mysqldb')['db'];config[_0x9b7b('0x18')]=_[_0x9b7b('0x19')](config['redis'],{'host':_0x9b7b('0x1a'),'port':0x18eb});var socket=require(_0x9b7b('0x1b'))(new Redis(config[_0x9b7b('0x18')]));require(_0x9b7b('0x1c'))[_0x9b7b('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9b7b('0x1e')][_0x9b7b('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x59d0e0,_0x32c219,_0x5cf068,_0x17b729){return new BPromise(function(_0x1ad7af,_0x112903){var _0x4464ff=_0x17b729||client;return _0x4464ff[_0x9b7b('0x20')](_0x59d0e0,_0x5cf068)[_0x9b7b('0x21')](function(_0x280bb7){logger[_0x9b7b('0x22')](_0x9b7b('0x23'),_0x32c219,_0x9b7b('0x24'));logger[_0x9b7b('0x25')](_0x9b7b('0x26'),_0x32c219,_0x9b7b('0x24'),JSON[_0x9b7b('0x27')](_0x280bb7));if(_0x280bb7['error']){if(_0x280bb7[_0x9b7b('0x28')]['code']===0x1f4){logger[_0x9b7b('0x28')](_0x9b7b('0x23'),_0x32c219,_0x280bb7[_0x9b7b('0x28')][_0x9b7b('0x29')]);return _0x112903(_0x280bb7['error'][_0x9b7b('0x29')]);}logger['error'](_0x9b7b('0x23'),_0x32c219,_0x280bb7[_0x9b7b('0x28')][_0x9b7b('0x29')]);return _0x1ad7af(_0x280bb7['error']['message']);}else{logger[_0x9b7b('0x22')](_0x9b7b('0x23'),_0x32c219,_0x9b7b('0x24'));_0x1ad7af(_0x280bb7[_0x9b7b('0x2a')][_0x9b7b('0x29')]);}})[_0x9b7b('0x2b')](function(_0x2439d2){logger[_0x9b7b('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x32c219,_0x2439d2);_0x112903(_0x2439d2);});});}function respondWithStatusCode(_0x5e07d0,_0x3818db){_0x3818db=_0x3818db||0xcc;return function(_0x5d7a80){if(_0x5d7a80){return _0x5e07d0[_0x9b7b('0x2c')](_0x3818db);}return _0x5e07d0[_0x9b7b('0x2d')](_0x3818db)[_0x9b7b('0x2e')]();};}function respondWithResult(_0x3352d9,_0xaec8c4){_0xaec8c4=_0xaec8c4||0xc8;return function(_0x439828){if(_0x439828){return _0x3352d9[_0x9b7b('0x2d')](_0xaec8c4)[_0x9b7b('0x2f')](_0x439828);}};}function respondWithFilteredResult(_0x3f82a8,_0x5d55d6){return function(_0x498293){if(_0x498293){var _0x538d5b=typeof _0x5d55d6['offset']===_0x9b7b('0x30')&&typeof _0x5d55d6[_0x9b7b('0x31')]===_0x9b7b('0x30');var _0x5138d0=_0x498293[_0x9b7b('0x32')];var _0x45824e=_0x538d5b?0x0:_0x5d55d6['offset'];var _0x491954=_0x538d5b?_0x498293[_0x9b7b('0x32')]:_0x5d55d6['offset']+_0x5d55d6[_0x9b7b('0x31')];var _0x32fb43;if(_0x491954>=_0x5138d0){_0x491954=_0x5138d0;_0x32fb43=0xc8;}else{_0x32fb43=0xce;}_0x3f82a8[_0x9b7b('0x2d')](_0x32fb43);return _0x3f82a8[_0x9b7b('0x33')](_0x9b7b('0x34'),_0x45824e+'-'+_0x491954+'/'+_0x5138d0)[_0x9b7b('0x2f')](_0x498293);}return null;};}function patchUpdates(_0x29bf05){return function(_0x468b65){try{jsonpatch[_0x9b7b('0x35')](_0x468b65,_0x29bf05,!![]);}catch(_0x5163e2){return BPromise[_0x9b7b('0x36')](_0x5163e2);}return _0x468b65[_0x9b7b('0x37')]();};}function saveUpdates(_0x2cce84,_0x12a47e){return function(_0x20a196){if(_0x20a196){return _0x20a196[_0x9b7b('0x38')](_0x2cce84)[_0x9b7b('0x21')](function(_0xdc082a){return _0xdc082a;});}return null;};}function removeEntity(_0x2f6623,_0x446845){return function(_0x3a7d26){if(_0x3a7d26){return _0x3a7d26[_0x9b7b('0x39')]()['then'](function(){var _0x533805=_0x3a7d26['get']({'plain':!![]});var _0x4d81b7=_0x9b7b('0x3a');return db[_0x9b7b('0x3b')][_0x9b7b('0x39')]({'where':{'type':_0x4d81b7,'resourceId':_0x533805['id']}})[_0x9b7b('0x21')](function(){return _0x3a7d26;});})[_0x9b7b('0x21')](function(){_0x2f6623[_0x9b7b('0x2d')](0xcc)[_0x9b7b('0x2e')]();});}};}function handleEntityNotFound(_0x47cf57,_0x54e95e){return function(_0x241d42){if(!_0x241d42){_0x47cf57[_0x9b7b('0x2c')](0x194);}return _0x241d42;};}function handleError(_0x20a805,_0x439f5d){_0x439f5d=_0x439f5d||0x1f4;return function(_0x5545eb){logger[_0x9b7b('0x28')](_0x5545eb[_0x9b7b('0x3c')]);if(_0x5545eb[_0x9b7b('0x3d')]){delete _0x5545eb[_0x9b7b('0x3d')];}_0x20a805['status'](_0x439f5d)[_0x9b7b('0x3e')](_0x5545eb);};}exports[_0x9b7b('0x3f')]=function(_0x57db29,_0x10c6d6){var _0x3f72fc={'include':[{'model':db[_0x9b7b('0x40')],'as':_0x9b7b('0x41')}]},_0x12442b={},_0x216c72={'count':0x0,'rows':[]};var _0x20c999=_[_0x9b7b('0x42')](db[_0x9b7b('0x43')][_0x9b7b('0x44')],function(_0x3b4419){return{'name':_0x3b4419[_0x9b7b('0x45')],'type':_0x3b4419[_0x9b7b('0x46')][_0x9b7b('0x47')]};});_0x12442b[_0x9b7b('0x48')]=_[_0x9b7b('0x42')](_0x20c999,'name');_0x12442b['query']=_[_0x9b7b('0x49')](_0x57db29['query']);_0x12442b[_0x9b7b('0x4a')]=_[_0x9b7b('0x4b')](_0x12442b['model'],_0x12442b['query']);_0x3f72fc['attributes']=_[_0x9b7b('0x4b')](_0x12442b[_0x9b7b('0x48')],qs[_0x9b7b('0x4c')](_0x57db29[_0x9b7b('0x4d')]['fields']));_0x3f72fc[_0x9b7b('0x4e')]=_0x3f72fc[_0x9b7b('0x4e')][_0x9b7b('0x4f')]?_0x3f72fc[_0x9b7b('0x4e')]:_0x12442b[_0x9b7b('0x48')];if(!_0x57db29[_0x9b7b('0x4d')][_0x9b7b('0x50')](_0x9b7b('0x51'))){_0x3f72fc[_0x9b7b('0x31')]=qs['limit'](_0x57db29['query'][_0x9b7b('0x31')]);_0x3f72fc[_0x9b7b('0x52')]=qs[_0x9b7b('0x52')](_0x57db29['query'][_0x9b7b('0x52')]);}_0x3f72fc[_0x9b7b('0x53')]=qs[_0x9b7b('0x54')](_0x57db29[_0x9b7b('0x4d')][_0x9b7b('0x54')]);_0x3f72fc[_0x9b7b('0x55')]=qs[_0x9b7b('0x4a')](_[_0x9b7b('0x56')](_0x57db29['query'],_0x12442b[_0x9b7b('0x4a')]),_0x20c999);if(_0x57db29['query'][_0x9b7b('0x57')]){_0x3f72fc[_0x9b7b('0x55')]=_[_0x9b7b('0x58')](_0x3f72fc[_0x9b7b('0x55')],{'$or':_[_0x9b7b('0x42')](_0x20c999,function(_0x3b0296){if(_0x3b0296[_0x9b7b('0x46')]!==_0x9b7b('0x59')){var _0x7204c={};_0x7204c[_0x3b0296['name']]={'$like':'%'+_0x57db29[_0x9b7b('0x4d')][_0x9b7b('0x57')]+'%'};return _0x7204c;}})});}_0x3f72fc=_['merge']({},_0x3f72fc,_0x57db29[_0x9b7b('0x5a')]);var _0xb6b8e7={'where':_0x3f72fc['where']};return db['WhatsappAccount'][_0x9b7b('0x32')](_0xb6b8e7)['then'](function(_0x648937){_0x216c72[_0x9b7b('0x32')]=_0x648937;if(_0x57db29[_0x9b7b('0x4d')][_0x9b7b('0x5b')]){_0x3f72fc['include']=[{'all':!![]}];}return db[_0x9b7b('0x43')][_0x9b7b('0x5c')](_0x3f72fc);})['then'](function(_0x363aa2){_0x216c72['rows']=_0x363aa2;return _0x216c72;})[_0x9b7b('0x21')](respondWithFilteredResult(_0x10c6d6,_0x3f72fc))[_0x9b7b('0x2b')](handleError(_0x10c6d6,null));};exports['show']=function(_0x3c6bfd,_0x29fdee){var _0x52e026={'raw':![],'where':{'id':_0x3c6bfd[_0x9b7b('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0x9b7b('0x41')}]},_0x5fd78c={};_0x5fd78c[_0x9b7b('0x48')]=_[_0x9b7b('0x49')](db[_0x9b7b('0x43')][_0x9b7b('0x44')]);_0x5fd78c['query']=_['keys'](_0x3c6bfd[_0x9b7b('0x4d')]);_0x5fd78c[_0x9b7b('0x4a')]=_[_0x9b7b('0x4b')](_0x5fd78c[_0x9b7b('0x48')],_0x5fd78c['query']);_0x52e026[_0x9b7b('0x4e')]=_[_0x9b7b('0x4b')](_0x5fd78c['model'],qs[_0x9b7b('0x4c')](_0x3c6bfd[_0x9b7b('0x4d')][_0x9b7b('0x4c')]));_0x52e026[_0x9b7b('0x4e')]=_0x52e026['attributes']['length']?_0x52e026[_0x9b7b('0x4e')]:_0x5fd78c[_0x9b7b('0x48')];if(_0x3c6bfd[_0x9b7b('0x4d')]['includeAll']){_0x52e026[_0x9b7b('0x5e')]=[{'all':!![]}];}_0x52e026=_[_0x9b7b('0x58')]({},_0x52e026,_0x3c6bfd['options']);return db[_0x9b7b('0x43')]['find'](_0x52e026)[_0x9b7b('0x21')](handleEntityNotFound(_0x29fdee,null))[_0x9b7b('0x21')](respondWithResult(_0x29fdee,null))[_0x9b7b('0x2b')](handleError(_0x29fdee,null));};exports[_0x9b7b('0x5f')]=function(_0x372e64,_0x5b1c2d){return db[_0x9b7b('0x43')][_0x9b7b('0x5f')](_0x372e64[_0x9b7b('0x60')],{})[_0x9b7b('0x21')](function(_0x15414b){var _0x4a3c2a=_0x372e64[_0x9b7b('0x61')][_0x9b7b('0x62')]({'plain':!![]});if(!_0x4a3c2a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a3c2a[_0x9b7b('0x63')]==='user'){var _0x391b0c=_0x15414b['get']({'plain':!![]});var _0x5791f4=_0x9b7b('0x3a');return db[_0x9b7b('0x64')][_0x9b7b('0x65')]({'where':{'name':_0x5791f4,'userProfileId':_0x4a3c2a['userProfileId']},'raw':!![]})['then'](function(_0x142e3d){if(_0x142e3d&&_0x142e3d['autoAssociation']===0x0){return db[_0x9b7b('0x3b')]['create']({'name':_0x391b0c[_0x9b7b('0x3d')],'resourceId':_0x391b0c['id'],'type':_0x142e3d[_0x9b7b('0x3d')],'sectionId':_0x142e3d['id']},{})[_0x9b7b('0x21')](function(){return _0x15414b;});}else{return _0x15414b;}})['catch'](function(_0x301540){logger[_0x9b7b('0x28')](_0x9b7b('0x66'),_0x301540);throw _0x301540;});}return _0x15414b;})[_0x9b7b('0x21')](respondWithResult(_0x5b1c2d,0xc9))['catch'](handleError(_0x5b1c2d,null));};exports[_0x9b7b('0x38')]=function(_0x493dd8,_0x3c2dee){if(_0x493dd8[_0x9b7b('0x60')]['id']){delete _0x493dd8[_0x9b7b('0x60')]['id'];}return db[_0x9b7b('0x43')][_0x9b7b('0x65')]({'where':{'id':_0x493dd8[_0x9b7b('0x5d')]['id']},'include':[{'model':db[_0x9b7b('0x40')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x3c2dee,null))['then'](saveUpdates(_0x493dd8[_0x9b7b('0x60')],null))['then'](respondWithResult(_0x3c2dee,null))[_0x9b7b('0x2b')](handleError(_0x3c2dee,null));};exports[_0x9b7b('0x39')]=function(_0x3286c2,_0x555165){return db[_0x9b7b('0x43')][_0x9b7b('0x65')]({'where':{'id':_0x3286c2[_0x9b7b('0x5d')]['id']}})[_0x9b7b('0x21')](handleEntityNotFound(_0x555165,null))['then'](removeEntity(_0x555165,null))['catch'](handleError(_0x555165,null));};exports[_0x9b7b('0x67')]=function(_0x2d8c92,_0x570934){return db[_0x9b7b('0x43')][_0x9b7b('0x67')]()['then'](respondWithResult(_0x570934,null))['catch'](handleError(_0x570934,null));};exports[_0x9b7b('0x68')]=function(_0x57bcea,_0x2f6fcb,_0x49417d){if(_0x57bcea[_0x9b7b('0x60')]['id']){delete _0x57bcea[_0x9b7b('0x60')]['id'];}return db[_0x9b7b('0x43')]['find']({'where':{'id':_0x57bcea[_0x9b7b('0x5d')]['id']}})[_0x9b7b('0x21')](handleEntityNotFound(_0x2f6fcb,null))['then'](function(_0x507d06){if(_0x507d06){_0x57bcea[_0x9b7b('0x60')][_0x9b7b('0x69')]=_0x507d06['id'];return db[_0x9b7b('0x6a')][_0x9b7b('0x5f')](_0x57bcea['body']);}})['then'](respondWithResult(_0x2f6fcb,null))[_0x9b7b('0x2b')](handleError(_0x2f6fcb,null));};exports[_0x9b7b('0x6b')]=function(_0x30f59e,_0x58574a,_0x216f28){var _0x2654c9={'raw':![],'where':{}};var _0x2a13f2={};var _0x182c7d={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x9b7b('0x6c')]({'where':{'id':_0x30f59e[_0x9b7b('0x5d')]['id']}})['then'](handleEntityNotFound(_0x58574a,null))[_0x9b7b('0x21')](function(_0x1bf308){if(_0x1bf308){_0x2a13f2[_0x9b7b('0x48')]=_[_0x9b7b('0x49')](db[_0x9b7b('0x6a')][_0x9b7b('0x44')]);_0x2a13f2['query']=_['keys'](_0x30f59e[_0x9b7b('0x4d')]);_0x2a13f2[_0x9b7b('0x4a')]=_['intersection'](_0x2a13f2[_0x9b7b('0x48')],_0x2a13f2[_0x9b7b('0x4d')]);_0x2654c9[_0x9b7b('0x4e')]=_['intersection'](_0x2a13f2[_0x9b7b('0x48')],qs[_0x9b7b('0x4c')](_0x30f59e[_0x9b7b('0x4d')][_0x9b7b('0x4c')]));_0x2654c9[_0x9b7b('0x4e')]=_0x2654c9[_0x9b7b('0x4e')][_0x9b7b('0x4f')]?_0x2654c9[_0x9b7b('0x4e')]:_0x2a13f2[_0x9b7b('0x48')];if(!_0x30f59e[_0x9b7b('0x4d')][_0x9b7b('0x50')](_0x9b7b('0x51'))){_0x2654c9[_0x9b7b('0x31')]=qs[_0x9b7b('0x31')](_0x30f59e['query']['limit']);_0x2654c9['offset']=qs[_0x9b7b('0x52')](_0x30f59e[_0x9b7b('0x4d')][_0x9b7b('0x52')]);}_0x2654c9[_0x9b7b('0x53')]=qs[_0x9b7b('0x54')](_0x30f59e[_0x9b7b('0x4d')][_0x9b7b('0x54')]);_0x2654c9[_0x9b7b('0x55')]=qs[_0x9b7b('0x4a')](_[_0x9b7b('0x56')](_0x30f59e[_0x9b7b('0x4d')],_0x2a13f2['filters']));_0x2654c9[_0x9b7b('0x55')][_0x9b7b('0x69')]=_0x1bf308['id'];if(_0x30f59e[_0x9b7b('0x4d')]['filter']){_0x2654c9[_0x9b7b('0x55')]=_[_0x9b7b('0x58')](_0x2654c9[_0x9b7b('0x55')],{'$or':_[_0x9b7b('0x42')](_0x2654c9[_0x9b7b('0x4e')],function(_0x4591d0){var _0x16fee8={};_0x16fee8[_0x4591d0]={'$like':'%'+_0x30f59e[_0x9b7b('0x4d')][_0x9b7b('0x57')]+'%'};return _0x16fee8;})});}_0x2654c9=_[_0x9b7b('0x58')]({},_0x2654c9,_0x30f59e[_0x9b7b('0x5a')]);return db[_0x9b7b('0x6a')][_0x9b7b('0x32')]({'where':_0x2654c9[_0x9b7b('0x55')]})[_0x9b7b('0x21')](function(_0x16f05a){_0x182c7d[_0x9b7b('0x32')]=_0x16f05a;if(_0x30f59e[_0x9b7b('0x4d')]['includeAll']){_0x2654c9[_0x9b7b('0x5e')]=[{'all':!![]}];}return db[_0x9b7b('0x6a')]['findAll'](_0x2654c9);})[_0x9b7b('0x21')](function(_0x2c237a){_0x182c7d[_0x9b7b('0x6d')]=_0x2c237a;return _0x182c7d;});}})[_0x9b7b('0x21')](respondWithFilteredResult(_0x58574a,_0x2654c9))[_0x9b7b('0x2b')](handleError(_0x58574a,null));};exports[_0x9b7b('0x6e')]=function(_0x136d65,_0x5a51b2,_0x42ebf4){return db['WhatsappAccount'][_0x9b7b('0x65')]({'where':{'id':_0x136d65['params']['id']}})[_0x9b7b('0x21')](handleEntityNotFound(_0x5a51b2,null))[_0x9b7b('0x21')](function(_0x3ea29b){if(_0x3ea29b){return _0x3ea29b[_0x9b7b('0x6e')](_0x136d65[_0x9b7b('0x4d')][_0x9b7b('0x6f')]);}})[_0x9b7b('0x21')](respondWithStatusCode(_0x5a51b2,null))[_0x9b7b('0x2b')](handleError(_0x5a51b2,null));};exports[_0x9b7b('0x70')]=function(_0x1e1719,_0xac1948,_0x45c17a){if(_0x1e1719[_0x9b7b('0x60')]['id']){delete _0x1e1719[_0x9b7b('0x60')]['id'];}return db[_0x9b7b('0x43')][_0x9b7b('0x65')]({'where':{'id':_0x1e1719[_0x9b7b('0x5d')]['id']}})[_0x9b7b('0x21')](handleEntityNotFound(_0xac1948,null))['then'](function(_0x3cd724){if(_0x3cd724){_0x1e1719['body']['WhatsappAccountId']=_0x3cd724['id'];return db[_0x9b7b('0x71')][_0x9b7b('0x5f')](_0x1e1719[_0x9b7b('0x60')]);}})[_0x9b7b('0x21')](respondWithResult(_0xac1948,null))[_0x9b7b('0x2b')](handleError(_0xac1948,null));};exports[_0x9b7b('0x72')]=function(_0x2d4c10,_0x215db0,_0x56fd50){var _0x32212a={'raw':![],'where':{}};var _0x386fd8={};var _0x3547ed={'count':0x0,'rows':[]};return db[_0x9b7b('0x43')][_0x9b7b('0x6c')]({'where':{'id':_0x2d4c10[_0x9b7b('0x5d')]['id']}})[_0x9b7b('0x21')](handleEntityNotFound(_0x215db0,null))[_0x9b7b('0x21')](function(_0x45ad3b){if(_0x45ad3b){_0x386fd8[_0x9b7b('0x48')]=_['keys'](db[_0x9b7b('0x71')]['rawAttributes']);_0x386fd8[_0x9b7b('0x4d')]=_['keys'](_0x2d4c10[_0x9b7b('0x4d')]);_0x386fd8[_0x9b7b('0x4a')]=_[_0x9b7b('0x4b')](_0x386fd8[_0x9b7b('0x48')],_0x386fd8[_0x9b7b('0x4d')]);_0x32212a['attributes']=_['intersection'](_0x386fd8[_0x9b7b('0x48')],qs[_0x9b7b('0x4c')](_0x2d4c10[_0x9b7b('0x4d')][_0x9b7b('0x4c')]));_0x32212a[_0x9b7b('0x4e')]=_0x32212a[_0x9b7b('0x4e')][_0x9b7b('0x4f')]?_0x32212a['attributes']:_0x386fd8[_0x9b7b('0x48')];if(!_0x2d4c10['query']['hasOwnProperty']('nolimit')){_0x32212a['limit']=qs[_0x9b7b('0x31')](_0x2d4c10[_0x9b7b('0x4d')][_0x9b7b('0x31')]);_0x32212a[_0x9b7b('0x52')]=qs[_0x9b7b('0x52')](_0x2d4c10[_0x9b7b('0x4d')][_0x9b7b('0x52')]);}_0x32212a[_0x9b7b('0x53')]=qs['sort'](_0x2d4c10[_0x9b7b('0x4d')][_0x9b7b('0x54')]);_0x32212a[_0x9b7b('0x55')]=qs[_0x9b7b('0x4a')](_[_0x9b7b('0x56')](_0x2d4c10['query'],_0x386fd8['filters']));_0x32212a[_0x9b7b('0x55')][_0x9b7b('0x69')]=_0x45ad3b['id'];if(_0x2d4c10[_0x9b7b('0x4d')][_0x9b7b('0x57')]){_0x32212a[_0x9b7b('0x55')]=_[_0x9b7b('0x58')](_0x32212a[_0x9b7b('0x55')],{'$or':_[_0x9b7b('0x42')](_0x32212a[_0x9b7b('0x4e')],function(_0x1c9870){var _0xc8c48b={};_0xc8c48b[_0x1c9870]={'$like':'%'+_0x2d4c10['query'][_0x9b7b('0x57')]+'%'};return _0xc8c48b;})});}_0x32212a=_['merge']({},_0x32212a,_0x2d4c10[_0x9b7b('0x5a')]);return db[_0x9b7b('0x71')]['count']({'where':_0x32212a[_0x9b7b('0x55')]})['then'](function(_0x103c4e){_0x3547ed[_0x9b7b('0x32')]=_0x103c4e;if(_0x2d4c10[_0x9b7b('0x4d')][_0x9b7b('0x5b')]){_0x32212a[_0x9b7b('0x5e')]=[{'all':!![]}];}return db[_0x9b7b('0x71')][_0x9b7b('0x5c')](_0x32212a);})[_0x9b7b('0x21')](function(_0x4ee042){_0x3547ed[_0x9b7b('0x6d')]=_0x4ee042;return _0x3547ed;});}})[_0x9b7b('0x21')](respondWithFilteredResult(_0x215db0,_0x32212a))[_0x9b7b('0x2b')](handleError(_0x215db0,null));};exports[_0x9b7b('0x73')]=function(_0x29f8c3,_0x28a8e4,_0x47c067){return db[_0x9b7b('0x43')][_0x9b7b('0x65')]({'where':{'id':_0x29f8c3['params']['id']}})[_0x9b7b('0x21')](handleEntityNotFound(_0x28a8e4,null))[_0x9b7b('0x21')](function(_0xcdb87d){if(_0xcdb87d){return _0xcdb87d['removeAnswers'](_0x29f8c3[_0x9b7b('0x4d')]['ids']);}})['then'](respondWithStatusCode(_0x28a8e4,null))[_0x9b7b('0x2b')](handleError(_0x28a8e4,null));};exports['addAgents']=function(_0x31ccfa,_0x58b443,_0x5528dc){return db[_0x9b7b('0x43')][_0x9b7b('0x65')]({'where':{'id':_0x31ccfa[_0x9b7b('0x5d')]['id']}})[_0x9b7b('0x21')](handleEntityNotFound(_0x58b443,null))[_0x9b7b('0x21')](function(_0x566cd5){if(_0x566cd5){return _0x566cd5['addAgents'](_0x31ccfa[_0x9b7b('0x60')]['ids'],_[_0x9b7b('0x74')](_0x31ccfa['body'],[_0x9b7b('0x6f'),'id'])||{})['spread'](function(_0x3724fc){for(var _0xe0d6e3=0x0;_0xe0d6e3<_0x31ccfa[_0x9b7b('0x60')][_0x9b7b('0x6f')]['length'];_0xe0d6e3+=0x1){socket['emit'](_0x9b7b('0x75'),{'UserId':Number(_0x31ccfa['body'][_0x9b7b('0x6f')][_0xe0d6e3]),'WhatsappAccountId':Number(_0x31ccfa['params']['id'])});}return _0x3724fc;});}})[_0x9b7b('0x21')](respondWithResult(_0x58b443,null))[_0x9b7b('0x2b')](handleError(_0x58b443,null));};exports['removeAgents']=function(_0x305958,_0x42a666,_0x305046){return db[_0x9b7b('0x43')][_0x9b7b('0x65')]({'where':{'id':_0x305958[_0x9b7b('0x5d')]['id']}})['then'](handleEntityNotFound(_0x42a666,null))[_0x9b7b('0x21')](function(_0x42cc73){if(_0x42cc73){return _0x42cc73[_0x9b7b('0x76')](_0x305958[_0x9b7b('0x4d')]['ids'])[_0x9b7b('0x21')](function(){if(_[_0x9b7b('0x77')](_0x305958[_0x9b7b('0x4d')][_0x9b7b('0x6f')])){for(var _0x82f209=0x0;_0x82f209<_0x305958[_0x9b7b('0x4d')][_0x9b7b('0x6f')][_0x9b7b('0x4f')];_0x82f209+=0x1){socket[_0x9b7b('0x78')](_0x9b7b('0x79'),{'UserId':Number(_0x305958[_0x9b7b('0x4d')][_0x9b7b('0x6f')][_0x82f209]),'WhatsappAccountId':Number(_0x305958[_0x9b7b('0x5d')]['id'])});}}else{socket[_0x9b7b('0x78')](_0x9b7b('0x79'),{'UserId':Number(_0x305958[_0x9b7b('0x4d')]['ids']),'WhatsappAccountId':Number(_0x305958['params']['id'])});}});}})[_0x9b7b('0x21')](respondWithStatusCode(_0x42a666,null))['catch'](handleError(_0x42a666,null));};exports[_0x9b7b('0x7a')]=function(_0x379345,_0x57b182,_0x4f9c4c){var _0x456696={};var _0x2ddfca={};var _0x12d1ed;var _0x3cc106;return db[_0x9b7b('0x43')][_0x9b7b('0x6c')]({'where':{'id':_0x379345[_0x9b7b('0x5d')]['id']}})[_0x9b7b('0x21')](handleEntityNotFound(_0x57b182,null))[_0x9b7b('0x21')](function(_0x3608eb){if(_0x3608eb){_0x12d1ed=_0x3608eb;_0x2ddfca[_0x9b7b('0x48')]=_[_0x9b7b('0x49')](db[_0x9b7b('0x7b')][_0x9b7b('0x44')]);_0x2ddfca[_0x9b7b('0x4d')]=_['keys'](_0x379345[_0x9b7b('0x4d')]);_0x2ddfca[_0x9b7b('0x4a')]=_[_0x9b7b('0x4b')](_0x2ddfca[_0x9b7b('0x48')],_0x2ddfca[_0x9b7b('0x4d')]);_0x456696[_0x9b7b('0x4e')]=_[_0x9b7b('0x4b')](_0x2ddfca[_0x9b7b('0x48')],qs[_0x9b7b('0x4c')](_0x379345[_0x9b7b('0x4d')][_0x9b7b('0x4c')]));_0x456696[_0x9b7b('0x4e')]=_0x456696[_0x9b7b('0x4e')][_0x9b7b('0x4f')]?_0x456696[_0x9b7b('0x4e')]:_0x2ddfca[_0x9b7b('0x48')];_0x456696['order']=qs['sort'](_0x379345['query'][_0x9b7b('0x54')]);_0x456696[_0x9b7b('0x55')]=qs[_0x9b7b('0x4a')](_[_0x9b7b('0x56')](_0x379345[_0x9b7b('0x4d')],_0x2ddfca['filters']));if(_0x379345['query']['filter']){_0x456696[_0x9b7b('0x55')]=_['merge'](_0x456696['where'],{'$or':_[_0x9b7b('0x42')](_0x456696['attributes'],function(_0x5f14de){var _0x1ccf68={};_0x1ccf68[_0x5f14de]={'$like':'%'+_0x379345[_0x9b7b('0x4d')]['filter']+'%'};return _0x1ccf68;})});}_0x456696=_[_0x9b7b('0x58')]({},_0x456696,_0x379345[_0x9b7b('0x5a')]);return _0x12d1ed[_0x9b7b('0x7a')](_0x456696);}})['then'](function(_0x17d306){if(_0x17d306){_0x3cc106=_0x17d306[_0x9b7b('0x4f')];if(!_0x379345['query'][_0x9b7b('0x50')](_0x9b7b('0x51'))){_0x456696[_0x9b7b('0x31')]=qs[_0x9b7b('0x31')](_0x379345['query'][_0x9b7b('0x31')]);_0x456696[_0x9b7b('0x52')]=qs[_0x9b7b('0x52')](_0x379345['query'][_0x9b7b('0x52')]);}return _0x12d1ed['getAgents'](_0x456696);}})[_0x9b7b('0x21')](function(_0x4b368d){if(_0x4b368d){return _0x4b368d?{'count':_0x3cc106,'rows':_0x4b368d}:null;}})[_0x9b7b('0x21')](respondWithResult(_0x57b182,null))[_0x9b7b('0x2b')](handleError(_0x57b182,null));};exports['addApplications']=function(_0x1895d8,_0x562127){var _0x1a42e3=_0x1895d8['params']['id'];var _0x1b1458=_0x1895d8[_0x9b7b('0x60')];var _0x3d2c9d=0xc8;var _0x4da35a=null;return db[_0x9b7b('0x7c')]['transaction']({'isolationLevel':db[_0x9b7b('0x7c')][_0x9b7b('0x7d')][_0x9b7b('0x7e')][_0x9b7b('0x7f')]},function(_0x496132){return db['WhatsappAccount']['findOne']({'where':{'id':_0x1a42e3},'transaction':_0x496132})[_0x9b7b('0x21')](function(_0x52dc28){if(_0x52dc28){return db['WhatsappApplication'][_0x9b7b('0x39')]({'where':{'WhatsappAccountId':_0x1a42e3},'transaction':_0x496132})['then'](function(){var _0x165b1d=_[_0x9b7b('0x42')](_0x1b1458,function(_0x3ed65a){_0x3ed65a[_0x9b7b('0x69')]=_0x1a42e3;return _0x3ed65a;});return db[_0x9b7b('0x80')][_0x9b7b('0x81')](_0x165b1d,{'transaction':_0x496132});});}else{_0x3d2c9d=0x194;_0x4da35a=[];}});})['then'](function(){if(_0x3d2c9d!==0x194){return db[_0x9b7b('0x80')][_0x9b7b('0x82')]({'where':{'WhatsappAccountId':_0x1a42e3},'order':'priority'})['then'](function(_0x46ed10){_0x4da35a=_0x46ed10;});}})['catch'](function(_0x419158){_0x3d2c9d=0x1f4;logger[_0x9b7b('0x28')](_0x419158[_0x9b7b('0x3c')]);if(_0x419158[_0x9b7b('0x3d')]){delete _0x419158[_0x9b7b('0x3d')];}_0x4da35a=_0x419158;})['finally'](function(){if(_0x4da35a===null){_0x562127[_0x9b7b('0x2c')](_0x3d2c9d);}else{if(_0x3d2c9d===0x1f4){_0x562127[_0x9b7b('0x2d')](_0x3d2c9d)['send'](_0x4da35a);}else{_0x562127[_0x9b7b('0x2d')](_0x3d2c9d)[_0x9b7b('0x2f')](_0x4da35a);}}});};exports[_0x9b7b('0x83')]=function(_0x38dddd,_0x44fc49,_0x1f01ae){var _0xfa386={};var _0x5976e6={};var _0x38e4a5;var _0x563d8;return db[_0x9b7b('0x43')][_0x9b7b('0x6c')]({'where':{'id':_0x38dddd[_0x9b7b('0x5d')]['id']}})[_0x9b7b('0x21')](handleEntityNotFound(_0x44fc49,null))['then'](function(_0x505051){if(_0x505051){_0x38e4a5=_0x505051;_0x5976e6[_0x9b7b('0x48')]=_[_0x9b7b('0x49')](db[_0x9b7b('0x80')]['rawAttributes']);_0x5976e6['query']=_[_0x9b7b('0x49')](_0x38dddd['query']);_0x5976e6[_0x9b7b('0x4a')]=_['intersection'](_0x5976e6[_0x9b7b('0x48')],_0x5976e6['query']);_0xfa386[_0x9b7b('0x4e')]=_[_0x9b7b('0x4b')](_0x5976e6[_0x9b7b('0x48')],qs[_0x9b7b('0x4c')](_0x38dddd[_0x9b7b('0x4d')][_0x9b7b('0x4c')]));_0xfa386[_0x9b7b('0x4e')]=_0xfa386[_0x9b7b('0x4e')][_0x9b7b('0x4f')]?_0xfa386['attributes']:_0x5976e6['model'];_0xfa386[_0x9b7b('0x53')]=qs[_0x9b7b('0x54')](_0x38dddd[_0x9b7b('0x4d')]['sort']);_0xfa386[_0x9b7b('0x55')]=qs[_0x9b7b('0x4a')](_[_0x9b7b('0x56')](_0x38dddd[_0x9b7b('0x4d')],_0x5976e6['filters']));if(_0x38dddd['query'][_0x9b7b('0x57')]){_0xfa386[_0x9b7b('0x55')]=_['merge'](_0xfa386['where'],{'$or':_[_0x9b7b('0x42')](_0xfa386['attributes'],function(_0x1bcdc5){var _0x41e233={};_0x41e233[_0x1bcdc5]={'$like':'%'+_0x38dddd[_0x9b7b('0x4d')][_0x9b7b('0x57')]+'%'};return _0x41e233;})});}_0xfa386=_[_0x9b7b('0x58')]({},_0xfa386,_0x38dddd[_0x9b7b('0x5a')]);return _0x38e4a5[_0x9b7b('0x83')](_0xfa386);}})['then'](function(_0x1a47e3){if(_0x1a47e3){_0x563d8=_0x1a47e3[_0x9b7b('0x4f')];if(!_0x38dddd[_0x9b7b('0x4d')][_0x9b7b('0x50')](_0x9b7b('0x51'))){_0xfa386[_0x9b7b('0x31')]=qs[_0x9b7b('0x31')](_0x38dddd[_0x9b7b('0x4d')][_0x9b7b('0x31')]);_0xfa386['offset']=qs['offset'](_0x38dddd[_0x9b7b('0x4d')][_0x9b7b('0x52')]);}return _0x38e4a5[_0x9b7b('0x83')](_0xfa386);}})[_0x9b7b('0x21')](function(_0x32d461){if(_0x32d461){return _0x32d461?{'count':_0x563d8,'rows':_0x32d461}:null;}})['then'](respondWithResult(_0x44fc49,null))[_0x9b7b('0x2b')](handleError(_0x44fc49,null));};exports['notify']=function(_0xd54245,_0x4a5fab,_0x57d264){var _0xe88b50={'channel':_0x9b7b('0x84')};var _0x9aca97=[];var _0x9cd7de=[];var _0x1c07f2={};return db['WhatsappAccount'][_0x9b7b('0x65')]({'where':{'id':_0xd54245[_0x9b7b('0x5d')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x9b7b('0x85')}]})['then'](handleEntityNotFound(_0x4a5fab,null))[_0x9b7b('0x21')](function(_0x3dd7b5){_0xe88b50['account']=_0x3dd7b5;if(_0xe88b50[_0x9b7b('0x86')]&&_0xe88b50['account'][_0x9b7b('0x46')]===_0x9b7b('0x87')&&_0xd54245[_0x9b7b('0x60')][_0x9b7b('0x88')]){if(_0xd54245[_0x9b7b('0x60')][_0x9b7b('0x88')][_0x9b7b('0x4f')]===0x0)return;if(_0xd54245[_0x9b7b('0x60')][_0x9b7b('0x88')][0x0][_0x9b7b('0x89')]!=='read')return;return db[_0x9b7b('0x8a')][_0x9b7b('0x38')]({'read':!![],'readAt':_0xd54245[_0x9b7b('0x60')][_0x9b7b('0x88')][0x0]['timestamp']},{'where':{'messageId':_0xd54245[_0x9b7b('0x60')][_0x9b7b('0x88')][0x0][_0x9b7b('0x8b')]},'individualHooks':!![]})[_0x9b7b('0x21')](function(_0x25681a){return _0x4a5fab[_0x9b7b('0x2d')](0xc8)[_0x9b7b('0x2f')](_0x25681a);});}_0xe88b50[_0x9b7b('0x8c')]=_[_0x9b7b('0x8d')](_0x3dd7b5[_0x9b7b('0x85')],[_0x9b7b('0x8e')],[_0x9b7b('0x8f')]);if(_0xe88b50['account'][_0x9b7b('0x85')]){delete _0xe88b50[_0x9b7b('0x86')][_0x9b7b('0x85')];}return db[_0x9b7b('0x90')][_0x9b7b('0x67')]()[_0x9b7b('0x21')](function(_0x19403a){if(!_0x19403a){throw new db[(_0x9b7b('0x91'))][(_0x9b7b('0x92'))](_0x9b7b('0x93'));}_0x9aca97=_[_0x9b7b('0x94')](_[_0x9b7b('0x49')](_0x19403a),[_0x9b7b('0x95'),_0x9b7b('0x96')]);_0x9cd7de=_[_0x9b7b('0x94')](_['keys'](_0x19403a),[_0x9b7b('0x95'),'updatedAt','CompanyId',_0x9b7b('0x97')]);_0xe88b50['body']={'mapKey':_0x9b7b('0x98')};if(_0xe88b50['account']&&_0xe88b50['account'][_0x9b7b('0x46')]===_0x9b7b('0x99')){_0xe88b50[_0x9b7b('0x60')]['from']=_0xd54245[_0x9b7b('0x60')][_0x9b7b('0x9a')][_0x9b7b('0x9b')](_0x9b7b('0x9c'),'');_0xe88b50['body'][_0x9b7b('0x60')]=_0xd54245[_0x9b7b('0x60')]['Body'];_0xe88b50['body']['messageId']=_0xd54245[_0x9b7b('0x60')][_0x9b7b('0x9d')];}if(_0xe88b50[_0x9b7b('0x86')]&&_0xe88b50[_0x9b7b('0x86')][_0x9b7b('0x46')]===_0x9b7b('0x87')){_0xe88b50[_0x9b7b('0x60')][_0x9b7b('0x9e')]=_0xd54245[_0x9b7b('0x60')][_0x9b7b('0x9f')][0x0][_0x9b7b('0x9e')];_0xe88b50['body'][_0x9b7b('0x60')]=_0xd54245[_0x9b7b('0x60')]['notifications'][0x0][_0x9b7b('0x29')]['body'];_0xe88b50['body'][_0x9b7b('0xa0')]=_0xd54245[_0x9b7b('0x60')][_0x9b7b('0x9f')][0x0][_0x9b7b('0x8b')];}if(_0xe88b50[_0x9b7b('0x60')]['id']){delete _0xe88b50[_0x9b7b('0x60')]['id'];}if(_[_0x9b7b('0xa1')](_0xe88b50['body'][_0x9b7b('0x9e')])){throw new db[(_0x9b7b('0x91'))][(_0x9b7b('0x92'))](_0x9b7b('0xa2'));}if(_['isNil'](_0xe88b50['body'][_0x9b7b('0x60')])||_0xe88b50[_0x9b7b('0x60')][_0x9b7b('0x60')]===''){throw new db['Sequelize'][(_0x9b7b('0x92'))](_0x9b7b('0xa3'));}if(_[_0x9b7b('0xa1')](_0xe88b50[_0x9b7b('0x60')][_0x9b7b('0xa4')])){throw new db[(_0x9b7b('0x91'))][(_0x9b7b('0x92'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x9cd7de);}if(!_[_0x9b7b('0xa5')](_0x9cd7de,_0xe88b50['body']['mapKey'])){throw new db['Sequelize'][(_0x9b7b('0x92'))](_0x9b7b('0xa6')+_0x9cd7de);}_0x1c07f2[_0xe88b50[_0x9b7b('0x60')][_0x9b7b('0xa4')]]=_0xe88b50['body'][_0x9b7b('0x9e')];return db[_0x9b7b('0xa7')]['find']({'where':{'id':_0xe88b50[_0x9b7b('0x86')][_0x9b7b('0x97')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x1c07f2,'limit':0x1,'order':[[_0x9b7b('0x96'),'DESC']]}]});})['then'](handleEntityNotFound(_0x4a5fab,null))[_0x9b7b('0x21')](function(_0x44c49e){if(_0x44c49e){_0xe88b50[_0x9b7b('0xa8')]=_['omit'](_0x44c49e,[_0x9b7b('0xa9')]);if(_0x44c49e[_0x9b7b('0xa9')][_0x9b7b('0x4f')]){return _0x44c49e[_0x9b7b('0xa9')][0x0];}var _0x3bd188=_['defaults'](_0xe88b50['body'],{'firstName':_0xe88b50['body'][_0x9b7b('0x9e')],'ListId':_0x44c49e['id']});_0x3bd188[_0xe88b50[_0x9b7b('0x60')][_0x9b7b('0xa4')]]=_0xe88b50[_0x9b7b('0x60')]['from'];return db['CmContact'][_0x9b7b('0x5f')](_0x3bd188,{'fields':_0x9aca97,'raw':!![]});}})[_0x9b7b('0x21')](handleEntityNotFound(_0x4a5fab,null))[_0x9b7b('0x21')](function(_0x25a955){if(_0x25a955){_0xe88b50['contact']=_0x25a955;var _0x1a3183={'ContactId':_0x25a955['id'],'phone':_0xe88b50[_0x9b7b('0x60')][_0x9b7b('0x9e')],'WhatsappAccountId':_0xd54245[_0x9b7b('0x5d')]['id']};var _0x2816b4={'ContactId':_0x25a955['id'],'WhatsappAccountId':_0xd54245[_0x9b7b('0x5d')]['id'],'closed':![]};return db[_0x9b7b('0xaa')][_0x9b7b('0x65')]({'where':_0x2816b4})[_0x9b7b('0x21')](function(_0x5ef4ea){if(_0x5ef4ea){return[_0x5ef4ea,![]];}return db[_0x9b7b('0xaa')][_0x9b7b('0x5f')](_0x1a3183)[_0x9b7b('0x21')](function(_0x2ad0de){return[_0x2ad0de,!![]];});});}})['spread'](function(_0x3ad959,_0x412656){_0xe88b50[_0x9b7b('0xab')]=_0x3ad959[_0x9b7b('0x62')]({'plain':!![]});_0xe88b50[_0x9b7b('0xab')][_0x9b7b('0xac')]=![];if(_0x412656){if(_0xe88b50[_0x9b7b('0x86')][_0x9b7b('0xad')]){_0xe88b50['applications'][_0x9b7b('0xae')]({'id':0x0,'priority':_0xe88b50[_0x9b7b('0x8c')][_0x9b7b('0x4f')]+0x1,'app':'close','appdata':_0x9b7b('0xaf'),'interval':_0x9b7b('0xb0')});}_0xe88b50[_0x9b7b('0xab')][_0x9b7b('0xac')]=!![];}return db[_0x9b7b('0x8a')][_0x9b7b('0x5f')]({'phone':_0xe88b50[_0x9b7b('0x60')]['from'],'messageId':_0xe88b50[_0x9b7b('0x60')]['messageId'],'body':_0xe88b50['body'][_0x9b7b('0x60')],'WhatsappAccountId':_0xd54245['params']['id'],'WhatsappInteractionId':_0x3ad959['id'],'direction':'in','ContactId':_0x3ad959['ContactId'],'AttachmentId':_0xe88b50[_0x9b7b('0x60')][_0x9b7b('0xb1')]});})[_0x9b7b('0x21')](function(_0xad037e){_0xe88b50[_0x9b7b('0x29')]=_0xad037e;if(_0xe88b50[_0x9b7b('0xab')][_0x9b7b('0xb2')]){return db[_0x9b7b('0x7b')][_0x9b7b('0x65')]({'attributes':['id',_0x9b7b('0x3d')],'where':{'id':_0xe88b50[_0x9b7b('0xab')]['UserId']}})[_0x9b7b('0x21')](function(_0x3516cf){if(_0x3516cf){_0xe88b50[_0x9b7b('0x8c')][_0x9b7b('0xb3')]({'id':0x0,'priority':0x0,'app':_0x9b7b('0xb4'),'appdata':_0x3516cf['name']+','+(_0xe88b50['account']['waitForTheAssignedAgent']||0xa),'interval':_0x9b7b('0xb0')});}return respondWithRpcPromise('Start',_0x9b7b('0xb5'),_0xe88b50);});}return respondWithRpcPromise('Start',_0x9b7b('0xb5'),_0xe88b50);})[_0x9b7b('0x21')](function(_0x325e07){if(_0x325e07){var _0x107163=0xc8;var _0x454d39=_0x9b7b('0xb6');logger[_0x9b7b('0x22')](_0x9b7b('0x26'),_0x454d39,_0x107163,_0x9b7b('0xb7'));logger[_0x9b7b('0x25')](_0x9b7b('0xb8'),_0x454d39,_0x107163,'entity\x20found',JSON[_0x9b7b('0x27')](_0x325e07));if(_0xe88b50['account'][_0x9b7b('0x46')]==='twilio'){return _0x4a5fab[_0x9b7b('0x2d')](_0x107163)[_0x9b7b('0x33')]('Content-Type',_0x9b7b('0xb9'))['send'](_0x9b7b('0xba'));}else{return _0x4a5fab[_0x9b7b('0x2d')](_0x107163)['json'](_0x325e07);}}});})[_0x9b7b('0x2b')](handleError(_0x4a5fab,null));};exports[_0x9b7b('0x3e')]=function(_0x4d03b3,_0x1681a4,_0x4d4161){var _0xf12e20,_0xc0025b,_0x4b5690;if(_[_0x9b7b('0xa1')](_0x4d03b3[_0x9b7b('0x60')]['body'])||_0x4d03b3['body'][_0x9b7b('0x60')]===''){throw new db[(_0x9b7b('0x91'))][(_0x9b7b('0x92'))](_0x9b7b('0xa3'));}if(_['isNil'](_0x4d03b3[_0x9b7b('0x60')]['to'])){throw new db[(_0x9b7b('0x91'))][(_0x9b7b('0x92'))](_0x9b7b('0xbb'));}_0xf12e20=_0x4d03b3[_0x9b7b('0x60')]['to'];return db[_0x9b7b('0x43')][_0x9b7b('0x65')]({'where':{'id':_0x4d03b3[_0x9b7b('0x5d')]['id']},'include':[{'model':db[_0x9b7b('0xa7')],'as':'List','include':[{'model':db[_0x9b7b('0x90')],'as':_0x9b7b('0xa9'),'where':{'mobile':_0xf12e20},'limit':0x1,'order':[[_0x9b7b('0x96'),'DESC']]}]}]})[_0x9b7b('0x21')](handleEntityNotFound(_0x1681a4,null))[_0x9b7b('0x21')](function(_0x3710a0){if(_0x3710a0&&_0x3710a0['List']){_0xc0025b=_0x3710a0[_0x9b7b('0x62')]({'plain':!![]});if(_0xc0025b[_0x9b7b('0xbc')]&&_0xc0025b[_0x9b7b('0xbc')][_0x9b7b('0xa9')][_0x9b7b('0x4f')]){return _0xc0025b[_0x9b7b('0xbc')][_0x9b7b('0xa9')][0x0];}return db['CmContact'][_0x9b7b('0x5f')](_[_0x9b7b('0x19')](_0x4d03b3[_0x9b7b('0x60')],{'firstName':_0xf12e20,'mobile':_0xf12e20,'phone':_0xf12e20,'ListId':_0xc0025b['ListId']}));}})['then'](handleEntityNotFound(_0x1681a4,null))['then'](function(_0x147d55){if(_0x147d55){_0x4b5690=_0x147d55;return db[_0x9b7b('0xaa')]['find']({'where':{'ContactId':_0x4b5690['id'],'closed':![],'WhatsappAccountId':_0xc0025b['id']}})['then'](function(_0x11f91f){if(_0x11f91f){return[_0x11f91f,![]];}return db[_0x9b7b('0xaa')][_0x9b7b('0x5f')]({'UserId':_0x4d03b3[_0x9b7b('0x61')]['id'],'ContactId':_0x4b5690['id'],'WhatsappAccountId':_0xc0025b['id'],'phone':_0xf12e20,'firstMsgDirection':'out','Messages':[_[_0x9b7b('0x58')](_0x4d03b3[_0x9b7b('0x60')],{'read':![],'body':_0x4d03b3[_0x9b7b('0x60')][_0x9b7b('0x60')],'phone':_0xf12e20,'WhatsappAccountId':_0xc0025b['id'],'UserId':_0x4d03b3[_0x9b7b('0x61')]['id'],'ContactId':_0x4b5690['id']})]},{'include':[{'model':db[_0x9b7b('0x8a')],'as':_0x9b7b('0xbd')}]})[_0x9b7b('0x21')](function(_0x1f2243){return[_0x1f2243,!![]];});});}})[_0x9b7b('0xbe')](function(_0x51ecca,_0x249be9){if(_0x249be9){return _0x51ecca;}return db[_0x9b7b('0x8a')][_0x9b7b('0x5f')](_['merge'](_0x4d03b3['body'],{'read':![],'body':_0x4d03b3[_0x9b7b('0x60')]['body'],'phone':_0xf12e20,'WhatsappAccountId':_0xc0025b['id'],'WhatsappInteractionId':_0x51ecca['id'],'UserId':_0x4d03b3[_0x9b7b('0x61')]['id'],'ContactId':_0x4b5690['id']}))['then'](function(_0x502bb3){_0x51ecca['dataValues']['Messages']=[];_0x51ecca['dataValues'][_0x9b7b('0xbd')][_0x9b7b('0xae')](_0x502bb3['dataValues']);return _0x51ecca;});})[_0x9b7b('0x21')](respondWithResult(_0x1681a4,null))[_0x9b7b('0x2b')](handleError(_0x1681a4,null));}; \ No newline at end of file +var _0x004c=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','addAgents','omit','spread','emit','removeAgents','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','statuses','read','timestamp','orderBy','asc','account','Applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','ListId','mobile','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','updatedAt','DESC','list','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','WhatsappMessage','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./whatsappAccount.socket','jayson/promise','client','request','then','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','status','json','undefined','count','offset','limit','set','Content-Range','save','update','destroy','WhatsappAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','user','get','role'];(function(_0x596c69,_0x552fba){var _0x57ee18=function(_0xf512ef){while(--_0xf512ef){_0x596c69['push'](_0x596c69['shift']());}};_0x57ee18(++_0x552fba);}(_0x004c,0x1e6));var _0xc004=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x004c[_0x5627e1];return _0x2f013f;};'use strict';var emlformat=require(_0xc004('0x0'));var rimraf=require(_0xc004('0x1'));var zipdir=require(_0xc004('0x2'));var jsonpatch=require(_0xc004('0x3'));var rp=require(_0xc004('0x4'));var moment=require(_0xc004('0x5'));var BPromise=require(_0xc004('0x6'));var Mustache=require(_0xc004('0x7'));var util=require(_0xc004('0x8'));var path=require('path');var sox=require(_0xc004('0x9'));var csv=require(_0xc004('0xa'));var ejs=require(_0xc004('0xb'));var fs=require('fs');var fs_extra=require(_0xc004('0xc'));var _=require('lodash');var squel=require(_0xc004('0xd'));var crypto=require(_0xc004('0xe'));var jsforce=require(_0xc004('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc004('0xa'));var querystring=require(_0xc004('0x10'));var Papa=require(_0xc004('0x11'));var Redis=require(_0xc004('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc004('0x13'));var as=require(_0xc004('0x14'));var hardwareService=require(_0xc004('0x15'));var logger=require(_0xc004('0x16'))(_0xc004('0x17'));var utils=require('../../config/utils');var config=require(_0xc004('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc004('0x19'))['db'];config['redis']=_[_0xc004('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc004('0x1b')]));require(_0xc004('0x1c'))['register'](socket);var jayson=require(_0xc004('0x1d'));var client=jayson[_0xc004('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0x178470,_0x445e70,_0x5936b0,_0x4f6158){return new BPromise(function(_0x150690,_0x2c36ff){var _0x4587c6=_0x4f6158||client;return _0x4587c6[_0xc004('0x1f')](_0x178470,_0x5936b0)[_0xc004('0x20')](function(_0x3daeb8){logger['info'](_0xc004('0x21'),_0x445e70,'request\x20sent');logger['debug'](_0xc004('0x22'),_0x445e70,_0xc004('0x23'),JSON[_0xc004('0x24')](_0x3daeb8));if(_0x3daeb8['error']){if(_0x3daeb8[_0xc004('0x25')][_0xc004('0x26')]===0x1f4){logger[_0xc004('0x25')](_0xc004('0x21'),_0x445e70,_0x3daeb8[_0xc004('0x25')][_0xc004('0x27')]);return _0x2c36ff(_0x3daeb8[_0xc004('0x25')][_0xc004('0x27')]);}logger[_0xc004('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x445e70,_0x3daeb8[_0xc004('0x25')]['message']);return _0x150690(_0x3daeb8[_0xc004('0x25')][_0xc004('0x27')]);}else{logger[_0xc004('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x445e70,_0xc004('0x23'));_0x150690(_0x3daeb8[_0xc004('0x29')][_0xc004('0x27')]);}})[_0xc004('0x2a')](function(_0x507673){logger['error'](_0xc004('0x21'),_0x445e70,_0x507673);_0x2c36ff(_0x507673);});});}function respondWithStatusCode(_0x324bfc,_0x11f68){_0x11f68=_0x11f68||0xcc;return function(_0x4335e6){if(_0x4335e6){return _0x324bfc['sendStatus'](_0x11f68);}return _0x324bfc[_0xc004('0x2b')](_0x11f68)['end']();};}function respondWithResult(_0x4e6f49,_0x23b93e){_0x23b93e=_0x23b93e||0xc8;return function(_0x31e28c){if(_0x31e28c){return _0x4e6f49['status'](_0x23b93e)[_0xc004('0x2c')](_0x31e28c);}};}function respondWithFilteredResult(_0x9a6b8e,_0x4c18f0){return function(_0x58ae6f){if(_0x58ae6f){var _0x1eab9b=typeof _0x4c18f0['offset']===_0xc004('0x2d')&&typeof _0x4c18f0['limit']===_0xc004('0x2d');var _0x3a337b=_0x58ae6f[_0xc004('0x2e')];var _0x4e77ae=_0x1eab9b?0x0:_0x4c18f0[_0xc004('0x2f')];var _0x59a457=_0x1eab9b?_0x58ae6f[_0xc004('0x2e')]:_0x4c18f0[_0xc004('0x2f')]+_0x4c18f0[_0xc004('0x30')];var _0x4c252f;if(_0x59a457>=_0x3a337b){_0x59a457=_0x3a337b;_0x4c252f=0xc8;}else{_0x4c252f=0xce;}_0x9a6b8e[_0xc004('0x2b')](_0x4c252f);return _0x9a6b8e[_0xc004('0x31')](_0xc004('0x32'),_0x4e77ae+'-'+_0x59a457+'/'+_0x3a337b)['json'](_0x58ae6f);}return null;};}function patchUpdates(_0x142432){return function(_0x11af7e){try{jsonpatch['apply'](_0x11af7e,_0x142432,!![]);}catch(_0x4a187d){return BPromise['reject'](_0x4a187d);}return _0x11af7e[_0xc004('0x33')]();};}function saveUpdates(_0x2e254b,_0x4336a9){return function(_0x33e709){if(_0x33e709){return _0x33e709[_0xc004('0x34')](_0x2e254b)[_0xc004('0x20')](function(_0x2ca7f1){return _0x2ca7f1;});}return null;};}function removeEntity(_0x331028,_0x1d127f){return function(_0x4a3d46){if(_0x4a3d46){return _0x4a3d46[_0xc004('0x35')]()[_0xc004('0x20')](function(){var _0x50c452=_0x4a3d46['get']({'plain':!![]});var _0x49f9e1=_0xc004('0x36');return db[_0xc004('0x37')][_0xc004('0x35')]({'where':{'type':_0x49f9e1,'resourceId':_0x50c452['id']}})['then'](function(){return _0x4a3d46;});})['then'](function(){_0x331028[_0xc004('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11f1dd,_0x462e64){return function(_0x3920d4){if(!_0x3920d4){_0x11f1dd['sendStatus'](0x194);}return _0x3920d4;};}function handleError(_0x1bebba,_0x4a08b7){_0x4a08b7=_0x4a08b7||0x1f4;return function(_0x36ffc7){logger[_0xc004('0x25')](_0x36ffc7[_0xc004('0x38')]);if(_0x36ffc7[_0xc004('0x39')]){delete _0x36ffc7[_0xc004('0x39')];}_0x1bebba[_0xc004('0x2b')](_0x4a08b7)[_0xc004('0x3a')](_0x36ffc7);};}exports['index']=function(_0x28e9c4,_0x1f46b8){var _0x2570be={'include':[{'model':db[_0xc004('0x3b')],'as':_0xc004('0x3c')}]},_0x2d048c={},_0x441bdf={'count':0x0,'rows':[]};var _0x1f54fc=_[_0xc004('0x3d')](db[_0xc004('0x3e')]['rawAttributes'],function(_0x50b32f){return{'name':_0x50b32f['fieldName'],'type':_0x50b32f['type'][_0xc004('0x3f')]};});_0x2d048c[_0xc004('0x40')]=_[_0xc004('0x3d')](_0x1f54fc,_0xc004('0x39'));_0x2d048c['query']=_[_0xc004('0x41')](_0x28e9c4['query']);_0x2d048c[_0xc004('0x42')]=_[_0xc004('0x43')](_0x2d048c[_0xc004('0x40')],_0x2d048c[_0xc004('0x44')]);_0x2570be['attributes']=_['intersection'](_0x2d048c[_0xc004('0x40')],qs[_0xc004('0x45')](_0x28e9c4[_0xc004('0x44')][_0xc004('0x45')]));_0x2570be[_0xc004('0x46')]=_0x2570be[_0xc004('0x46')][_0xc004('0x47')]?_0x2570be['attributes']:_0x2d048c[_0xc004('0x40')];if(!_0x28e9c4[_0xc004('0x44')][_0xc004('0x48')](_0xc004('0x49'))){_0x2570be['limit']=qs[_0xc004('0x30')](_0x28e9c4[_0xc004('0x44')][_0xc004('0x30')]);_0x2570be[_0xc004('0x2f')]=qs[_0xc004('0x2f')](_0x28e9c4['query'][_0xc004('0x2f')]);}_0x2570be[_0xc004('0x4a')]=qs['sort'](_0x28e9c4[_0xc004('0x44')][_0xc004('0x4b')]);_0x2570be['where']=qs[_0xc004('0x42')](_[_0xc004('0x4c')](_0x28e9c4[_0xc004('0x44')],_0x2d048c[_0xc004('0x42')]),_0x1f54fc);if(_0x28e9c4[_0xc004('0x44')][_0xc004('0x4d')]){_0x2570be[_0xc004('0x4e')]=_['merge'](_0x2570be[_0xc004('0x4e')],{'$or':_[_0xc004('0x3d')](_0x1f54fc,function(_0x5e03bb){if(_0x5e03bb[_0xc004('0x4f')]!==_0xc004('0x50')){var _0x59f485={};_0x59f485[_0x5e03bb['name']]={'$like':'%'+_0x28e9c4[_0xc004('0x44')][_0xc004('0x4d')]+'%'};return _0x59f485;}})});}_0x2570be=_[_0xc004('0x51')]({},_0x2570be,_0x28e9c4[_0xc004('0x52')]);var _0xfdedc7={'where':_0x2570be['where']};return db[_0xc004('0x3e')][_0xc004('0x2e')](_0xfdedc7)[_0xc004('0x20')](function(_0x31d1d0){_0x441bdf[_0xc004('0x2e')]=_0x31d1d0;if(_0x28e9c4[_0xc004('0x44')][_0xc004('0x53')]){_0x2570be['include']=[{'all':!![]}];}return db[_0xc004('0x3e')][_0xc004('0x54')](_0x2570be);})['then'](function(_0x3dbf53){_0x441bdf[_0xc004('0x55')]=_0x3dbf53;return _0x441bdf;})[_0xc004('0x20')](respondWithFilteredResult(_0x1f46b8,_0x2570be))['catch'](handleError(_0x1f46b8,null));};exports[_0xc004('0x56')]=function(_0x4cb55f,_0xe9d998){var _0x51f16a={'raw':![],'where':{'id':_0x4cb55f[_0xc004('0x57')]['id']},'include':[{'model':db[_0xc004('0x3b')],'as':_0xc004('0x3c')}]},_0x44d936={};_0x44d936[_0xc004('0x40')]=_[_0xc004('0x41')](db['WhatsappAccount'][_0xc004('0x58')]);_0x44d936[_0xc004('0x44')]=_['keys'](_0x4cb55f['query']);_0x44d936[_0xc004('0x42')]=_[_0xc004('0x43')](_0x44d936['model'],_0x44d936[_0xc004('0x44')]);_0x51f16a[_0xc004('0x46')]=_[_0xc004('0x43')](_0x44d936['model'],qs[_0xc004('0x45')](_0x4cb55f[_0xc004('0x44')][_0xc004('0x45')]));_0x51f16a[_0xc004('0x46')]=_0x51f16a[_0xc004('0x46')]['length']?_0x51f16a[_0xc004('0x46')]:_0x44d936['model'];if(_0x4cb55f[_0xc004('0x44')]['includeAll']){_0x51f16a[_0xc004('0x59')]=[{'all':!![]}];}_0x51f16a=_['merge']({},_0x51f16a,_0x4cb55f[_0xc004('0x52')]);return db[_0xc004('0x3e')][_0xc004('0x5a')](_0x51f16a)[_0xc004('0x20')](handleEntityNotFound(_0xe9d998,null))[_0xc004('0x20')](respondWithResult(_0xe9d998,null))['catch'](handleError(_0xe9d998,null));};exports['create']=function(_0x934275,_0x1cf62a){return db[_0xc004('0x3e')][_0xc004('0x5b')](_0x934275[_0xc004('0x5c')],{})[_0xc004('0x20')](function(_0x3cf6a6){var _0x28521c=_0x934275[_0xc004('0x5d')][_0xc004('0x5e')]({'plain':!![]});if(!_0x28521c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28521c[_0xc004('0x5f')]===_0xc004('0x5d')){var _0x294ed4=_0x3cf6a6['get']({'plain':!![]});var _0x98852d=_0xc004('0x36');return db[_0xc004('0x60')][_0xc004('0x5a')]({'where':{'name':_0x98852d,'userProfileId':_0x28521c[_0xc004('0x61')]},'raw':!![]})[_0xc004('0x20')](function(_0x242b31){if(_0x242b31&&_0x242b31[_0xc004('0x62')]===0x0){return db[_0xc004('0x37')][_0xc004('0x5b')]({'name':_0x294ed4[_0xc004('0x39')],'resourceId':_0x294ed4['id'],'type':_0x242b31[_0xc004('0x39')],'sectionId':_0x242b31['id']},{})[_0xc004('0x20')](function(){return _0x3cf6a6;});}else{return _0x3cf6a6;}})[_0xc004('0x2a')](function(_0x1d7b66){logger[_0xc004('0x25')](_0xc004('0x63'),_0x1d7b66);throw _0x1d7b66;});}return _0x3cf6a6;})[_0xc004('0x20')](respondWithResult(_0x1cf62a,0xc9))[_0xc004('0x2a')](handleError(_0x1cf62a,null));};exports[_0xc004('0x34')]=function(_0x1df34e,_0x15b3fa){if(_0x1df34e[_0xc004('0x5c')]['id']){delete _0x1df34e[_0xc004('0x5c')]['id'];}return db[_0xc004('0x3e')][_0xc004('0x5a')]({'where':{'id':_0x1df34e[_0xc004('0x57')]['id']},'include':[{'model':db[_0xc004('0x3b')],'as':_0xc004('0x3c')}]})[_0xc004('0x20')](handleEntityNotFound(_0x15b3fa,null))['then'](saveUpdates(_0x1df34e[_0xc004('0x5c')],null))[_0xc004('0x20')](respondWithResult(_0x15b3fa,null))[_0xc004('0x2a')](handleError(_0x15b3fa,null));};exports[_0xc004('0x35')]=function(_0x1bd037,_0x11b8e6){return db[_0xc004('0x3e')][_0xc004('0x5a')]({'where':{'id':_0x1bd037[_0xc004('0x57')]['id']}})[_0xc004('0x20')](handleEntityNotFound(_0x11b8e6,null))['then'](removeEntity(_0x11b8e6,null))[_0xc004('0x2a')](handleError(_0x11b8e6,null));};exports[_0xc004('0x64')]=function(_0x45788a,_0x10dcf5){return db['WhatsappAccount']['describe']()[_0xc004('0x20')](respondWithResult(_0x10dcf5,null))[_0xc004('0x2a')](handleError(_0x10dcf5,null));};exports[_0xc004('0x65')]=function(_0x1ece19,_0x660754,_0x2b1372){if(_0x1ece19[_0xc004('0x5c')]['id']){delete _0x1ece19['body']['id'];}return db[_0xc004('0x3e')]['find']({'where':{'id':_0x1ece19['params']['id']}})[_0xc004('0x20')](handleEntityNotFound(_0x660754,null))['then'](function(_0x1aa03b){if(_0x1aa03b){_0x1ece19[_0xc004('0x5c')][_0xc004('0x66')]=_0x1aa03b['id'];return db[_0xc004('0x67')][_0xc004('0x5b')](_0x1ece19[_0xc004('0x5c')]);}})[_0xc004('0x20')](respondWithResult(_0x660754,null))[_0xc004('0x2a')](handleError(_0x660754,null));};exports[_0xc004('0x68')]=function(_0x5a9858,_0x1a34be,_0x2aadd7){var _0x4b94ca={'raw':![],'where':{}};var _0x194693={};var _0x230c20={'count':0x0,'rows':[]};return db[_0xc004('0x3e')]['findOne']({'where':{'id':_0x5a9858[_0xc004('0x57')]['id']}})[_0xc004('0x20')](handleEntityNotFound(_0x1a34be,null))[_0xc004('0x20')](function(_0x1af60b){if(_0x1af60b){_0x194693[_0xc004('0x40')]=_[_0xc004('0x41')](db[_0xc004('0x67')][_0xc004('0x58')]);_0x194693[_0xc004('0x44')]=_['keys'](_0x5a9858[_0xc004('0x44')]);_0x194693['filters']=_[_0xc004('0x43')](_0x194693[_0xc004('0x40')],_0x194693[_0xc004('0x44')]);_0x4b94ca[_0xc004('0x46')]=_['intersection'](_0x194693[_0xc004('0x40')],qs[_0xc004('0x45')](_0x5a9858[_0xc004('0x44')]['fields']));_0x4b94ca[_0xc004('0x46')]=_0x4b94ca[_0xc004('0x46')][_0xc004('0x47')]?_0x4b94ca[_0xc004('0x46')]:_0x194693[_0xc004('0x40')];if(!_0x5a9858[_0xc004('0x44')][_0xc004('0x48')](_0xc004('0x49'))){_0x4b94ca[_0xc004('0x30')]=qs[_0xc004('0x30')](_0x5a9858[_0xc004('0x44')][_0xc004('0x30')]);_0x4b94ca['offset']=qs[_0xc004('0x2f')](_0x5a9858['query']['offset']);}_0x4b94ca[_0xc004('0x4a')]=qs[_0xc004('0x4b')](_0x5a9858[_0xc004('0x44')]['sort']);_0x4b94ca[_0xc004('0x4e')]=qs['filters'](_[_0xc004('0x4c')](_0x5a9858[_0xc004('0x44')],_0x194693[_0xc004('0x42')]));_0x4b94ca['where'][_0xc004('0x66')]=_0x1af60b['id'];if(_0x5a9858['query'][_0xc004('0x4d')]){_0x4b94ca['where']=_[_0xc004('0x51')](_0x4b94ca[_0xc004('0x4e')],{'$or':_['map'](_0x4b94ca[_0xc004('0x46')],function(_0x52f209){var _0x4b80d1={};_0x4b80d1[_0x52f209]={'$like':'%'+_0x5a9858[_0xc004('0x44')][_0xc004('0x4d')]+'%'};return _0x4b80d1;})});}_0x4b94ca=_[_0xc004('0x51')]({},_0x4b94ca,_0x5a9858[_0xc004('0x52')]);return db['Disposition'][_0xc004('0x2e')]({'where':_0x4b94ca['where']})[_0xc004('0x20')](function(_0x7869d1){_0x230c20[_0xc004('0x2e')]=_0x7869d1;if(_0x5a9858[_0xc004('0x44')][_0xc004('0x53')]){_0x4b94ca[_0xc004('0x59')]=[{'all':!![]}];}return db['Disposition'][_0xc004('0x54')](_0x4b94ca);})[_0xc004('0x20')](function(_0x21d097){_0x230c20[_0xc004('0x55')]=_0x21d097;return _0x230c20;});}})[_0xc004('0x20')](respondWithFilteredResult(_0x1a34be,_0x4b94ca))[_0xc004('0x2a')](handleError(_0x1a34be,null));};exports[_0xc004('0x69')]=function(_0x2f2fda,_0x328e04,_0x5ceef0){return db[_0xc004('0x3e')][_0xc004('0x5a')]({'where':{'id':_0x2f2fda[_0xc004('0x57')]['id']}})[_0xc004('0x20')](handleEntityNotFound(_0x328e04,null))[_0xc004('0x20')](function(_0x41acb2){if(_0x41acb2){return _0x41acb2[_0xc004('0x69')](_0x2f2fda[_0xc004('0x44')]['ids']);}})[_0xc004('0x20')](respondWithStatusCode(_0x328e04,null))[_0xc004('0x2a')](handleError(_0x328e04,null));};exports[_0xc004('0x6a')]=function(_0x5eaf39,_0x54bd03,_0x58baf8){if(_0x5eaf39['body']['id']){delete _0x5eaf39[_0xc004('0x5c')]['id'];}return db['WhatsappAccount'][_0xc004('0x5a')]({'where':{'id':_0x5eaf39[_0xc004('0x57')]['id']}})[_0xc004('0x20')](handleEntityNotFound(_0x54bd03,null))[_0xc004('0x20')](function(_0x33e9ea){if(_0x33e9ea){_0x5eaf39[_0xc004('0x5c')][_0xc004('0x66')]=_0x33e9ea['id'];return db[_0xc004('0x6b')][_0xc004('0x5b')](_0x5eaf39[_0xc004('0x5c')]);}})['then'](respondWithResult(_0x54bd03,null))[_0xc004('0x2a')](handleError(_0x54bd03,null));};exports[_0xc004('0x6c')]=function(_0x3617ef,_0x11c1aa,_0x589d84){var _0x2b899e={'raw':![],'where':{}};var _0x1efef={};var _0x95fbc3={'count':0x0,'rows':[]};return db[_0xc004('0x3e')][_0xc004('0x6d')]({'where':{'id':_0x3617ef[_0xc004('0x57')]['id']}})[_0xc004('0x20')](handleEntityNotFound(_0x11c1aa,null))[_0xc004('0x20')](function(_0x36610b){if(_0x36610b){_0x1efef[_0xc004('0x40')]=_[_0xc004('0x41')](db[_0xc004('0x6b')]['rawAttributes']);_0x1efef[_0xc004('0x44')]=_['keys'](_0x3617ef[_0xc004('0x44')]);_0x1efef['filters']=_[_0xc004('0x43')](_0x1efef['model'],_0x1efef[_0xc004('0x44')]);_0x2b899e[_0xc004('0x46')]=_[_0xc004('0x43')](_0x1efef['model'],qs[_0xc004('0x45')](_0x3617ef[_0xc004('0x44')][_0xc004('0x45')]));_0x2b899e[_0xc004('0x46')]=_0x2b899e[_0xc004('0x46')][_0xc004('0x47')]?_0x2b899e[_0xc004('0x46')]:_0x1efef['model'];if(!_0x3617ef[_0xc004('0x44')][_0xc004('0x48')](_0xc004('0x49'))){_0x2b899e['limit']=qs[_0xc004('0x30')](_0x3617ef[_0xc004('0x44')][_0xc004('0x30')]);_0x2b899e[_0xc004('0x2f')]=qs[_0xc004('0x2f')](_0x3617ef['query'][_0xc004('0x2f')]);}_0x2b899e[_0xc004('0x4a')]=qs[_0xc004('0x4b')](_0x3617ef[_0xc004('0x44')][_0xc004('0x4b')]);_0x2b899e[_0xc004('0x4e')]=qs[_0xc004('0x42')](_[_0xc004('0x4c')](_0x3617ef[_0xc004('0x44')],_0x1efef['filters']));_0x2b899e[_0xc004('0x4e')]['WhatsappAccountId']=_0x36610b['id'];if(_0x3617ef['query'][_0xc004('0x4d')]){_0x2b899e['where']=_[_0xc004('0x51')](_0x2b899e[_0xc004('0x4e')],{'$or':_[_0xc004('0x3d')](_0x2b899e[_0xc004('0x46')],function(_0x5bff15){var _0x136ac8={};_0x136ac8[_0x5bff15]={'$like':'%'+_0x3617ef[_0xc004('0x44')]['filter']+'%'};return _0x136ac8;})});}_0x2b899e=_['merge']({},_0x2b899e,_0x3617ef[_0xc004('0x52')]);return db[_0xc004('0x6b')]['count']({'where':_0x2b899e[_0xc004('0x4e')]})['then'](function(_0x2e835a){_0x95fbc3[_0xc004('0x2e')]=_0x2e835a;if(_0x3617ef[_0xc004('0x44')]['includeAll']){_0x2b899e[_0xc004('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc004('0x54')](_0x2b899e);})['then'](function(_0x519328){_0x95fbc3[_0xc004('0x55')]=_0x519328;return _0x95fbc3;});}})[_0xc004('0x20')](respondWithFilteredResult(_0x11c1aa,_0x2b899e))[_0xc004('0x2a')](handleError(_0x11c1aa,null));};exports[_0xc004('0x6e')]=function(_0x56f91a,_0x4f40fa,_0x38ed16){return db[_0xc004('0x3e')][_0xc004('0x5a')]({'where':{'id':_0x56f91a[_0xc004('0x57')]['id']}})[_0xc004('0x20')](handleEntityNotFound(_0x4f40fa,null))[_0xc004('0x20')](function(_0x2dbf3e){if(_0x2dbf3e){return _0x2dbf3e[_0xc004('0x6e')](_0x56f91a[_0xc004('0x44')][_0xc004('0x6f')]);}})[_0xc004('0x20')](respondWithStatusCode(_0x4f40fa,null))[_0xc004('0x2a')](handleError(_0x4f40fa,null));};exports[_0xc004('0x70')]=function(_0x599324,_0x2d9fbc,_0x29767c){return db['WhatsappAccount'][_0xc004('0x5a')]({'where':{'id':_0x599324[_0xc004('0x57')]['id']}})['then'](handleEntityNotFound(_0x2d9fbc,null))[_0xc004('0x20')](function(_0x5f28c8){if(_0x5f28c8){return _0x5f28c8['addAgents'](_0x599324[_0xc004('0x5c')][_0xc004('0x6f')],_[_0xc004('0x71')](_0x599324[_0xc004('0x5c')],[_0xc004('0x6f'),'id'])||{})[_0xc004('0x72')](function(_0x5ec200){for(var _0x2cc17f=0x0;_0x2cc17f<_0x599324[_0xc004('0x5c')][_0xc004('0x6f')][_0xc004('0x47')];_0x2cc17f+=0x1){socket[_0xc004('0x73')]('userWhatsappAccount:save',{'UserId':Number(_0x599324[_0xc004('0x5c')][_0xc004('0x6f')][_0x2cc17f]),'WhatsappAccountId':Number(_0x599324[_0xc004('0x57')]['id'])});}return _0x5ec200;});}})[_0xc004('0x20')](respondWithResult(_0x2d9fbc,null))[_0xc004('0x2a')](handleError(_0x2d9fbc,null));};exports[_0xc004('0x74')]=function(_0x5a2e21,_0x3838df,_0x30f371){return db[_0xc004('0x3e')][_0xc004('0x5a')]({'where':{'id':_0x5a2e21[_0xc004('0x57')]['id']}})[_0xc004('0x20')](handleEntityNotFound(_0x3838df,null))[_0xc004('0x20')](function(_0x2939df){if(_0x2939df){return _0x2939df[_0xc004('0x74')](_0x5a2e21[_0xc004('0x44')][_0xc004('0x6f')])['then'](function(){if(_['isArray'](_0x5a2e21[_0xc004('0x44')]['ids'])){for(var _0x2686f7=0x0;_0x2686f7<_0x5a2e21[_0xc004('0x44')][_0xc004('0x6f')][_0xc004('0x47')];_0x2686f7+=0x1){socket[_0xc004('0x73')](_0xc004('0x75'),{'UserId':Number(_0x5a2e21[_0xc004('0x44')][_0xc004('0x6f')][_0x2686f7]),'WhatsappAccountId':Number(_0x5a2e21['params']['id'])});}}else{socket[_0xc004('0x73')](_0xc004('0x75'),{'UserId':Number(_0x5a2e21[_0xc004('0x44')][_0xc004('0x6f')]),'WhatsappAccountId':Number(_0x5a2e21[_0xc004('0x57')]['id'])});}});}})[_0xc004('0x20')](respondWithStatusCode(_0x3838df,null))[_0xc004('0x2a')](handleError(_0x3838df,null));};exports['getAgents']=function(_0x25373e,_0x5255aa,_0x597005){var _0x3a9ad3={};var _0x4eb126={};var _0x349345;var _0x45ca56;return db[_0xc004('0x3e')][_0xc004('0x6d')]({'where':{'id':_0x25373e[_0xc004('0x57')]['id']}})[_0xc004('0x20')](handleEntityNotFound(_0x5255aa,null))[_0xc004('0x20')](function(_0x3db8ec){if(_0x3db8ec){_0x349345=_0x3db8ec;_0x4eb126[_0xc004('0x40')]=_['keys'](db['User'][_0xc004('0x58')]);_0x4eb126[_0xc004('0x44')]=_[_0xc004('0x41')](_0x25373e[_0xc004('0x44')]);_0x4eb126[_0xc004('0x42')]=_[_0xc004('0x43')](_0x4eb126[_0xc004('0x40')],_0x4eb126['query']);_0x3a9ad3[_0xc004('0x46')]=_['intersection'](_0x4eb126[_0xc004('0x40')],qs[_0xc004('0x45')](_0x25373e[_0xc004('0x44')][_0xc004('0x45')]));_0x3a9ad3['attributes']=_0x3a9ad3['attributes'][_0xc004('0x47')]?_0x3a9ad3[_0xc004('0x46')]:_0x4eb126[_0xc004('0x40')];_0x3a9ad3[_0xc004('0x4a')]=qs['sort'](_0x25373e[_0xc004('0x44')][_0xc004('0x4b')]);_0x3a9ad3[_0xc004('0x4e')]=qs[_0xc004('0x42')](_[_0xc004('0x4c')](_0x25373e[_0xc004('0x44')],_0x4eb126[_0xc004('0x42')]));if(_0x25373e[_0xc004('0x44')][_0xc004('0x4d')]){_0x3a9ad3[_0xc004('0x4e')]=_[_0xc004('0x51')](_0x3a9ad3[_0xc004('0x4e')],{'$or':_[_0xc004('0x3d')](_0x3a9ad3[_0xc004('0x46')],function(_0x151f3b){var _0x5b9517={};_0x5b9517[_0x151f3b]={'$like':'%'+_0x25373e['query'][_0xc004('0x4d')]+'%'};return _0x5b9517;})});}_0x3a9ad3=_[_0xc004('0x51')]({},_0x3a9ad3,_0x25373e['options']);return _0x349345[_0xc004('0x76')](_0x3a9ad3);}})['then'](function(_0x8b8a4f){if(_0x8b8a4f){_0x45ca56=_0x8b8a4f[_0xc004('0x47')];if(!_0x25373e[_0xc004('0x44')]['hasOwnProperty'](_0xc004('0x49'))){_0x3a9ad3[_0xc004('0x30')]=qs[_0xc004('0x30')](_0x25373e[_0xc004('0x44')]['limit']);_0x3a9ad3[_0xc004('0x2f')]=qs[_0xc004('0x2f')](_0x25373e[_0xc004('0x44')][_0xc004('0x2f')]);}return _0x349345[_0xc004('0x76')](_0x3a9ad3);}})[_0xc004('0x20')](function(_0x3b8abd){if(_0x3b8abd){return _0x3b8abd?{'count':_0x45ca56,'rows':_0x3b8abd}:null;}})['then'](respondWithResult(_0x5255aa,null))[_0xc004('0x2a')](handleError(_0x5255aa,null));};exports[_0xc004('0x77')]=function(_0x479638,_0x3bac94){var _0xee0b71=_0x479638[_0xc004('0x57')]['id'];var _0x42ad78=_0x479638[_0xc004('0x5c')];var _0x4da2da=0xc8;var _0xebc7d5=null;return db[_0xc004('0x78')][_0xc004('0x79')]({'isolationLevel':db[_0xc004('0x78')]['Transaction'][_0xc004('0x7a')][_0xc004('0x7b')]},function(_0x1441ab){return db['WhatsappAccount'][_0xc004('0x6d')]({'where':{'id':_0xee0b71},'transaction':_0x1441ab})[_0xc004('0x20')](function(_0x567f31){if(_0x567f31){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0xee0b71},'transaction':_0x1441ab})['then'](function(){var _0x58096c=_[_0xc004('0x3d')](_0x42ad78,function(_0x445d4a){_0x445d4a[_0xc004('0x66')]=_0xee0b71;return _0x445d4a;});return db[_0xc004('0x7c')][_0xc004('0x7d')](_0x58096c,{'transaction':_0x1441ab});});}else{_0x4da2da=0x194;_0xebc7d5=[];}});})[_0xc004('0x20')](function(){if(_0x4da2da!==0x194){return db['WhatsappApplication'][_0xc004('0x7e')]({'where':{'WhatsappAccountId':_0xee0b71},'order':_0xc004('0x7f')})['then'](function(_0x366cce){_0xebc7d5=_0x366cce;});}})[_0xc004('0x2a')](function(_0x4d853c){_0x4da2da=0x1f4;logger[_0xc004('0x25')](_0x4d853c[_0xc004('0x38')]);if(_0x4d853c['name']){delete _0x4d853c[_0xc004('0x39')];}_0xebc7d5=_0x4d853c;})[_0xc004('0x80')](function(){if(_0xebc7d5===null){_0x3bac94['sendStatus'](_0x4da2da);}else{if(_0x4da2da===0x1f4){_0x3bac94['status'](_0x4da2da)[_0xc004('0x3a')](_0xebc7d5);}else{_0x3bac94[_0xc004('0x2b')](_0x4da2da)[_0xc004('0x2c')](_0xebc7d5);}}});};exports[_0xc004('0x81')]=function(_0x48c4c6,_0x3202bd,_0x1f1c27){var _0x209358={};var _0x1391cd={};var _0x2c6174;var _0x55d2a5;return db[_0xc004('0x3e')][_0xc004('0x6d')]({'where':{'id':_0x48c4c6[_0xc004('0x57')]['id']}})['then'](handleEntityNotFound(_0x3202bd,null))['then'](function(_0x26c87a){if(_0x26c87a){_0x2c6174=_0x26c87a;_0x1391cd[_0xc004('0x40')]=_[_0xc004('0x41')](db[_0xc004('0x7c')][_0xc004('0x58')]);_0x1391cd[_0xc004('0x44')]=_[_0xc004('0x41')](_0x48c4c6[_0xc004('0x44')]);_0x1391cd[_0xc004('0x42')]=_['intersection'](_0x1391cd[_0xc004('0x40')],_0x1391cd['query']);_0x209358[_0xc004('0x46')]=_['intersection'](_0x1391cd[_0xc004('0x40')],qs[_0xc004('0x45')](_0x48c4c6[_0xc004('0x44')][_0xc004('0x45')]));_0x209358[_0xc004('0x46')]=_0x209358[_0xc004('0x46')][_0xc004('0x47')]?_0x209358[_0xc004('0x46')]:_0x1391cd['model'];_0x209358[_0xc004('0x4a')]=qs[_0xc004('0x4b')](_0x48c4c6[_0xc004('0x44')]['sort']);_0x209358['where']=qs[_0xc004('0x42')](_['pick'](_0x48c4c6[_0xc004('0x44')],_0x1391cd[_0xc004('0x42')]));if(_0x48c4c6['query'][_0xc004('0x4d')]){_0x209358[_0xc004('0x4e')]=_[_0xc004('0x51')](_0x209358[_0xc004('0x4e')],{'$or':_[_0xc004('0x3d')](_0x209358[_0xc004('0x46')],function(_0x4c4f68){var _0x5bc015={};_0x5bc015[_0x4c4f68]={'$like':'%'+_0x48c4c6['query'][_0xc004('0x4d')]+'%'};return _0x5bc015;})});}_0x209358=_['merge']({},_0x209358,_0x48c4c6[_0xc004('0x52')]);return _0x2c6174[_0xc004('0x81')](_0x209358);}})['then'](function(_0x43022f){if(_0x43022f){_0x55d2a5=_0x43022f[_0xc004('0x47')];if(!_0x48c4c6['query']['hasOwnProperty'](_0xc004('0x49'))){_0x209358[_0xc004('0x30')]=qs['limit'](_0x48c4c6[_0xc004('0x44')][_0xc004('0x30')]);_0x209358[_0xc004('0x2f')]=qs[_0xc004('0x2f')](_0x48c4c6['query']['offset']);}return _0x2c6174[_0xc004('0x81')](_0x209358);}})[_0xc004('0x20')](function(_0x22acb1){if(_0x22acb1){return _0x22acb1?{'count':_0x55d2a5,'rows':_0x22acb1}:null;}})[_0xc004('0x20')](respondWithResult(_0x3202bd,null))[_0xc004('0x2a')](handleError(_0x3202bd,null));};exports[_0xc004('0x82')]=function(_0x1a524b,_0x376e75,_0x34deba){var _0xbe4fe1={'channel':'whatsapp'};var _0x3f5d38=[];var _0x2b55ee=[];var _0x39d583={};return db[_0xc004('0x3e')][_0xc004('0x5a')]({'where':{'id':_0x1a524b[_0xc004('0x57')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x376e75,null))['then'](function(_0x36ad5d){_0xbe4fe1['account']=_0x36ad5d;if(_0xbe4fe1['account']&&_0xbe4fe1['account']['type']==='sinch'&&_0x1a524b[_0xc004('0x5c')][_0xc004('0x83')]){if(_0x1a524b[_0xc004('0x5c')]['statuses'][_0xc004('0x47')]===0x0)return;if(_0x1a524b[_0xc004('0x5c')][_0xc004('0x83')][0x0]['state']!==_0xc004('0x84'))return;return db['WhatsappMessage'][_0xc004('0x34')]({'read':!![],'readAt':_0x1a524b[_0xc004('0x5c')]['statuses'][0x0][_0xc004('0x85')]},{'where':{'messageId':_0x1a524b[_0xc004('0x5c')]['statuses'][0x0]['message_id']},'individualHooks':!![]})[_0xc004('0x20')](function(_0x3c7223){return _0x376e75[_0xc004('0x2b')](0xc8)[_0xc004('0x2c')](_0x3c7223);});}_0xbe4fe1['applications']=_[_0xc004('0x86')](_0x36ad5d['Applications'],[_0xc004('0x7f')],[_0xc004('0x87')]);if(_0xbe4fe1[_0xc004('0x88')][_0xc004('0x89')]){delete _0xbe4fe1['account'][_0xc004('0x89')];}return db[_0xc004('0x8a')]['describe']()[_0xc004('0x20')](function(_0x4f8f97){if(!_0x4f8f97){throw new db[(_0xc004('0x8b'))][(_0xc004('0x8c'))](_0xc004('0x8d'));}_0x3f5d38=_[_0xc004('0x8e')](_[_0xc004('0x41')](_0x4f8f97),['createdAt','updatedAt']);_0x2b55ee=_[_0xc004('0x8e')](_[_0xc004('0x41')](_0x4f8f97),['createdAt','updatedAt','CompanyId',_0xc004('0x8f')]);_0xbe4fe1[_0xc004('0x5c')]={'mapKey':_0xc004('0x90')};if(_0xbe4fe1[_0xc004('0x88')]&&_0xbe4fe1[_0xc004('0x88')][_0xc004('0x4f')]==='twilio'){_0xbe4fe1[_0xc004('0x5c')][_0xc004('0x91')]=_0x1a524b['body'][_0xc004('0x92')][_0xc004('0x93')](_0xc004('0x94'),'');_0xbe4fe1[_0xc004('0x5c')]['body']=_0x1a524b[_0xc004('0x5c')][_0xc004('0x95')];_0xbe4fe1['body'][_0xc004('0x96')]=_0x1a524b[_0xc004('0x5c')][_0xc004('0x97')];}if(_0xbe4fe1[_0xc004('0x88')]&&_0xbe4fe1[_0xc004('0x88')]['type']==='sinch'){_0xbe4fe1[_0xc004('0x5c')]['from']=_0x1a524b[_0xc004('0x5c')]['notifications'][0x0]['from'];_0xbe4fe1[_0xc004('0x5c')][_0xc004('0x5c')]=_0x1a524b['body'][_0xc004('0x98')][0x0][_0xc004('0x27')][_0xc004('0x5c')];_0xbe4fe1[_0xc004('0x5c')][_0xc004('0x96')]=_0x1a524b['body'][_0xc004('0x98')][0x0]['message_id'];}if(_0xbe4fe1[_0xc004('0x5c')]['id']){delete _0xbe4fe1[_0xc004('0x5c')]['id'];}if(_[_0xc004('0x99')](_0xbe4fe1[_0xc004('0x5c')][_0xc004('0x91')])){throw new db[(_0xc004('0x8b'))][(_0xc004('0x8c'))](_0xc004('0x9a'));}if(_[_0xc004('0x99')](_0xbe4fe1[_0xc004('0x5c')][_0xc004('0x5c')])||_0xbe4fe1[_0xc004('0x5c')][_0xc004('0x5c')]===''){throw new db[(_0xc004('0x8b'))]['ValidationError'](_0xc004('0x9b'));}if(_[_0xc004('0x99')](_0xbe4fe1['body']['mapKey'])){throw new db[(_0xc004('0x8b'))][(_0xc004('0x8c'))](_0xc004('0x9c')+_0x2b55ee);}if(!_[_0xc004('0x9d')](_0x2b55ee,_0xbe4fe1[_0xc004('0x5c')][_0xc004('0x9e')])){throw new db['Sequelize'][(_0xc004('0x8c'))](_0xc004('0x9f')+_0x2b55ee);}_0x39d583[_0xbe4fe1[_0xc004('0x5c')][_0xc004('0x9e')]]=_0xbe4fe1[_0xc004('0x5c')][_0xc004('0x91')];return db[_0xc004('0xa0')][_0xc004('0x5a')]({'where':{'id':_0xbe4fe1[_0xc004('0x88')]['ListId']},'include':[{'model':db[_0xc004('0x8a')],'as':'Contacts','where':_0x39d583,'limit':0x1,'order':[[_0xc004('0xa1'),_0xc004('0xa2')]]}]});})[_0xc004('0x20')](handleEntityNotFound(_0x376e75,null))['then'](function(_0x39b737){if(_0x39b737){_0xbe4fe1[_0xc004('0xa3')]=_['omit'](_0x39b737,[_0xc004('0xa4')]);if(_0x39b737[_0xc004('0xa4')][_0xc004('0x47')]){return _0x39b737[_0xc004('0xa4')][0x0];}var _0x5c107a=_[_0xc004('0x1a')](_0xbe4fe1[_0xc004('0x5c')],{'firstName':_0xbe4fe1[_0xc004('0x5c')][_0xc004('0x91')],'ListId':_0x39b737['id']});_0x5c107a[_0xbe4fe1[_0xc004('0x5c')][_0xc004('0x9e')]]=_0xbe4fe1['body'][_0xc004('0x91')];return db[_0xc004('0x8a')]['create'](_0x5c107a,{'fields':_0x3f5d38,'raw':!![]});}})[_0xc004('0x20')](handleEntityNotFound(_0x376e75,null))['then'](function(_0x30fe35){if(_0x30fe35){_0xbe4fe1[_0xc004('0xa5')]=_0x30fe35;var _0x7109c9={'ContactId':_0x30fe35['id'],'phone':_0xbe4fe1['body'][_0xc004('0x91')],'WhatsappAccountId':_0x1a524b[_0xc004('0x57')]['id']};var _0x22a1f5={'ContactId':_0x30fe35['id'],'WhatsappAccountId':_0x1a524b['params']['id'],'closed':![]};return db[_0xc004('0xa6')]['find']({'where':_0x22a1f5})[_0xc004('0x20')](function(_0x5304c2){if(_0x5304c2){return[_0x5304c2,![]];}return db[_0xc004('0xa6')]['create'](_0x7109c9)[_0xc004('0x20')](function(_0x3934b9){return[_0x3934b9,!![]];});});}})[_0xc004('0x72')](function(_0x115196,_0x14a9ce){_0xbe4fe1[_0xc004('0xa7')]=_0x115196[_0xc004('0x5e')]({'plain':!![]});_0xbe4fe1[_0xc004('0xa7')][_0xc004('0xa8')]=![];if(_0x14a9ce){if(_0xbe4fe1[_0xc004('0x88')][_0xc004('0xa9')]){_0xbe4fe1[_0xc004('0xaa')][_0xc004('0xab')]({'id':0x0,'priority':_0xbe4fe1['applications'][_0xc004('0x47')]+0x1,'app':_0xc004('0xac'),'appdata':_0xc004('0xad'),'interval':_0xc004('0xae')});}_0xbe4fe1[_0xc004('0xa7')][_0xc004('0xa8')]=!![];}return db['WhatsappMessage'][_0xc004('0x5b')]({'phone':_0xbe4fe1['body'][_0xc004('0x91')],'messageId':_0xbe4fe1[_0xc004('0x5c')][_0xc004('0x96')],'body':_0xbe4fe1[_0xc004('0x5c')]['body'],'WhatsappAccountId':_0x1a524b['params']['id'],'WhatsappInteractionId':_0x115196['id'],'direction':'in','ContactId':_0x115196['ContactId'],'AttachmentId':_0xbe4fe1[_0xc004('0x5c')][_0xc004('0xaf')]});})[_0xc004('0x20')](function(_0x4b287d){_0xbe4fe1['message']=_0x4b287d;if(_0xbe4fe1[_0xc004('0xa7')][_0xc004('0xb0')]){return db['User']['find']({'attributes':['id',_0xc004('0x39')],'where':{'id':_0xbe4fe1[_0xc004('0xa7')][_0xc004('0xb0')]}})['then'](function(_0x4dd494){if(_0x4dd494){_0xbe4fe1['applications'][_0xc004('0xb1')]({'id':0x0,'priority':0x0,'app':_0xc004('0xb2'),'appdata':_0x4dd494[_0xc004('0x39')]+','+(_0xbe4fe1[_0xc004('0x88')]['waitForTheAssignedAgent']||0xa),'interval':_0xc004('0xae')});}return respondWithRpcPromise(_0xc004('0xb3'),_0xc004('0xb4'),_0xbe4fe1);});}return respondWithRpcPromise(_0xc004('0xb3'),_0xc004('0xb4'),_0xbe4fe1);})[_0xc004('0x20')](function(_0x2a348a){if(_0x2a348a){var _0xe5ebdb=0xc8;var _0x52a5e2=_0xc004('0xb5');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x52a5e2,_0xe5ebdb,_0xc004('0xb6'));logger['debug'](_0xc004('0xb7'),_0x52a5e2,_0xe5ebdb,_0xc004('0xb6'),JSON['stringify'](_0x2a348a));if(_0xbe4fe1[_0xc004('0x88')][_0xc004('0x4f')]===_0xc004('0xb8')){return _0x376e75[_0xc004('0x2b')](_0xe5ebdb)['set'](_0xc004('0xb9'),_0xc004('0xba'))[_0xc004('0x3a')](_0xc004('0xbb'));}else{return _0x376e75['status'](_0xe5ebdb)[_0xc004('0x2c')](_0x2a348a);}}});})[_0xc004('0x2a')](handleError(_0x376e75,null));};exports[_0xc004('0x3a')]=function(_0x8efe4e,_0x7c8f1c,_0x437091){var _0x3f5887,_0x5b43fe,_0x2bd3db;if(_[_0xc004('0x99')](_0x8efe4e[_0xc004('0x5c')]['body'])||_0x8efe4e['body'][_0xc004('0x5c')]===''){throw new db['Sequelize'][(_0xc004('0x8c'))](_0xc004('0x9b'));}if(_[_0xc004('0x99')](_0x8efe4e['body']['to'])){throw new db[(_0xc004('0x8b'))][(_0xc004('0x8c'))](_0xc004('0xbc'));}_0x3f5887=_0x8efe4e[_0xc004('0x5c')]['to'];return db['WhatsappAccount'][_0xc004('0x5a')]({'where':{'id':_0x8efe4e[_0xc004('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0xc004('0xbd'),'include':[{'model':db[_0xc004('0x8a')],'as':'Contacts','where':{'mobile':_0x3f5887},'limit':0x1,'order':[[_0xc004('0xa1'),_0xc004('0xa2')]]}]}]})[_0xc004('0x20')](handleEntityNotFound(_0x7c8f1c,null))[_0xc004('0x20')](function(_0x54fd36){if(_0x54fd36&&_0x54fd36[_0xc004('0xbd')]){_0x5b43fe=_0x54fd36[_0xc004('0x5e')]({'plain':!![]});if(_0x5b43fe['List']&&_0x5b43fe[_0xc004('0xbd')][_0xc004('0xa4')][_0xc004('0x47')]){return _0x5b43fe['List']['Contacts'][0x0];}return db['CmContact'][_0xc004('0x5b')](_[_0xc004('0x1a')](_0x8efe4e['body'],{'firstName':_0x3f5887,'mobile':_0x3f5887,'phone':_0x3f5887,'ListId':_0x5b43fe[_0xc004('0x8f')]}));}})[_0xc004('0x20')](handleEntityNotFound(_0x7c8f1c,null))[_0xc004('0x20')](function(_0x3118c2){if(_0x3118c2){_0x2bd3db=_0x3118c2;return db[_0xc004('0xa6')]['find']({'where':{'ContactId':_0x2bd3db['id'],'closed':![],'WhatsappAccountId':_0x5b43fe['id']}})[_0xc004('0x20')](function(_0xb2e371){if(_0xb2e371){return[_0xb2e371,![]];}return db[_0xc004('0xa6')]['create']({'UserId':_0x8efe4e[_0xc004('0x5d')]['id'],'ContactId':_0x2bd3db['id'],'WhatsappAccountId':_0x5b43fe['id'],'phone':_0x3f5887,'firstMsgDirection':_0xc004('0xbe'),'Messages':[_[_0xc004('0x51')](_0x8efe4e[_0xc004('0x5c')],{'read':![],'body':_0x8efe4e[_0xc004('0x5c')][_0xc004('0x5c')],'phone':_0x3f5887,'WhatsappAccountId':_0x5b43fe['id'],'UserId':_0x8efe4e[_0xc004('0x5d')]['id'],'ContactId':_0x2bd3db['id']})]},{'include':[{'model':db[_0xc004('0xbf')],'as':_0xc004('0xc0')}]})[_0xc004('0x20')](function(_0x594695){return[_0x594695,!![]];});});}})[_0xc004('0x72')](function(_0x14d8bf,_0x389e56){if(_0x389e56){return _0x14d8bf;}return db[_0xc004('0xbf')][_0xc004('0x5b')](_[_0xc004('0x51')](_0x8efe4e['body'],{'read':![],'body':_0x8efe4e[_0xc004('0x5c')][_0xc004('0x5c')],'phone':_0x3f5887,'WhatsappAccountId':_0x5b43fe['id'],'WhatsappInteractionId':_0x14d8bf['id'],'UserId':_0x8efe4e[_0xc004('0x5d')]['id'],'ContactId':_0x2bd3db['id']}))['then'](function(_0x2014a1){_0x14d8bf[_0xc004('0xc1')][_0xc004('0xc0')]=[];_0x14d8bf[_0xc004('0xc1')][_0xc004('0xc0')]['push'](_0x2014a1[_0xc004('0xc1')]);return _0x14d8bf;});})[_0xc004('0x20')](respondWithResult(_0x7c8f1c,null))[_0xc004('0x2a')](handleError(_0x7c8f1c,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index a783ed3..d86446f 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 _0x19ad=['emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove'];(function(_0x21ab42,_0x8ab09a){var _0x4f6351=function(_0x50a316){while(--_0x50a316){_0x21ab42['push'](_0x21ab42['shift']());}};_0x4f6351(++_0x8ab09a);}(_0x19ad,0x194));var _0xd19a=function(_0x1b2cd4,_0x220d18){_0x1b2cd4=_0x1b2cd4-0x0;var _0x3e2ff5=_0x19ad[_0x1b2cd4];return _0x3e2ff5;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xd19a('0x0'))['db'][_0xd19a('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xd19a('0x2')](0x0);var events={'afterCreate':_0xd19a('0x3'),'afterUpdate':_0xd19a('0x4'),'afterDestroy':_0xd19a('0x5')};function emitEvent(_0x4bd624){return function(_0x41cee1,_0x52852f,_0x1d7224){WhatsappAccountEvents[_0xd19a('0x6')](_0x4bd624+':'+_0x41cee1['id'],_0x41cee1);WhatsappAccountEvents[_0xd19a('0x6')](_0x4bd624,_0x41cee1);_0x1d7224(null);};}for(var e in events){if(events[_0xd19a('0x7')](e)){var event=events[e];WhatsappAccount[_0xd19a('0x8')](e,emitEvent(event));}}module[_0xd19a('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x84f7=['setMaxListeners','save','emit','hasOwnProperty','exports'];(function(_0x38f0c7,_0x564611){var _0x4d7a2a=function(_0x283300){while(--_0x283300){_0x38f0c7['push'](_0x38f0c7['shift']());}};_0x4d7a2a(++_0x564611);}(_0x84f7,0x7d));var _0x784f=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x84f7[_0x50007c];return _0x5c1ec7;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x784f('0x0')](0x0);var events={'afterCreate':_0x784f('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4ea9d9){return function(_0x31522c,_0x101ec9,_0x55f9bc){WhatsappAccountEvents['emit'](_0x4ea9d9+':'+_0x31522c['id'],_0x31522c);WhatsappAccountEvents[_0x784f('0x2')](_0x4ea9d9,_0x31522c);_0x55f9bc(null);};}for(var e in events){if(events[_0x784f('0x3')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x784f('0x4')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 52a0bf3..2377d27 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 _0x6f70=['exports','define','WhatsappAccount','whatsapp_accounts','../../config/logger','api','moment','bluebird','request-promise','rimraf','./whatsappAccount.attributes'];(function(_0x4c03c3,_0x1c7bc1){var _0x5925e1=function(_0x7a2283){while(--_0x7a2283){_0x4c03c3['push'](_0x4c03c3['shift']());}};_0x5925e1(++_0x1c7bc1);}(_0x6f70,0x185));var _0x06f7=function(_0x5c89c4,_0x547d34){_0x5c89c4=_0x5c89c4-0x0;var _0x717381=_0x6f70[_0x5c89c4];return _0x717381;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x06f7('0x0'))(_0x06f7('0x1'));var moment=require(_0x06f7('0x2'));var BPromise=require(_0x06f7('0x3'));var rp=require(_0x06f7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x06f7('0x5'));var config=require('../../config/environment');var attributes=require(_0x06f7('0x6'));module[_0x06f7('0x7')]=function(_0x3e0233,_0x3f8edb){return _0x3e0233[_0x06f7('0x8')](_0x06f7('0x9'),attributes,{'tableName':_0x06f7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b7f=['lodash','util','../../config/logger','api','moment','bluebird','define','whatsapp_accounts'];(function(_0x1ec0cf,_0x52f0b2){var _0x5680ad=function(_0x376bbb){while(--_0x376bbb){_0x1ec0cf['push'](_0x1ec0cf['shift']());}};_0x5680ad(++_0x52f0b2);}(_0x0b7f,0xa0));var _0xf0b7=function(_0x8e6c5b,_0x33e4df){_0x8e6c5b=_0x8e6c5b-0x0;var _0x39e9d3=_0x0b7f[_0x8e6c5b];return _0x39e9d3;};'use strict';var _=require(_0xf0b7('0x0'));var util=require(_0xf0b7('0x1'));var logger=require(_0xf0b7('0x2'))(_0xf0b7('0x3'));var moment=require(_0xf0b7('0x4'));var BPromise=require(_0xf0b7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x21ebef,_0x4084aa){return _0x21ebef[_0xf0b7('0x6')]('WhatsappAccount',attributes,{'tableName':_0xf0b7('0x7'),'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 4563df6..3c720cd 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 _0x6854=['../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','ShowWhatsappAccount','find','options','raw','where','attributes','include','map','model','bluebird','ioredis','../../config/utils'];(function(_0x2604c0,_0x26500c){var _0x50b76c=function(_0x1ffdca){while(--_0x1ffdca){_0x2604c0['push'](_0x2604c0['shift']());}};_0x50b76c(++_0x26500c);}(_0x6854,0x19d));var _0x4685=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x6854[_0x397cfb];return _0x15fed9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4685('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4685('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x4685('0x2'));var logger=require(_0x4685('0x3'))(_0x4685('0x4'));var config=require('../../config/environment');var jayson=require(_0x4685('0x5'));var client=jayson[_0x4685('0x6')][_0x4685('0x7')]({'port':0x232a});config[_0x4685('0x8')]=_[_0x4685('0x9')](config[_0x4685('0x8')],{'host':_0x4685('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4685('0x8')]));require('./whatsappAccount.socket')[_0x4685('0xb')](socket);function respondWithRpcPromise(_0xf07dee,_0x74edb,_0x29155a){return new BPromise(function(_0x2838c6,_0x36d35f){return client[_0x4685('0xc')](_0xf07dee,_0x29155a)[_0x4685('0xd')](function(_0x415234){logger[_0x4685('0xe')]('WhatsappAccount,\x20%s,\x20%s',_0x74edb,_0x4685('0xf'));logger[_0x4685('0x10')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x74edb,_0x4685('0xf'),JSON[_0x4685('0x11')](_0x415234));if(_0x415234[_0x4685('0x12')]){if(_0x415234[_0x4685('0x12')][_0x4685('0x13')]===0x1f4){logger['error'](_0x4685('0x14'),_0x74edb,_0x415234['error'][_0x4685('0x15')]);return _0x36d35f(_0x415234[_0x4685('0x12')][_0x4685('0x15')]);}logger['error'](_0x4685('0x14'),_0x74edb,_0x415234[_0x4685('0x12')][_0x4685('0x15')]);return _0x2838c6(_0x415234[_0x4685('0x12')][_0x4685('0x15')]);}else{logger[_0x4685('0xe')](_0x4685('0x14'),_0x74edb,_0x4685('0xf'));_0x2838c6(_0x415234['result'][_0x4685('0x15')]);}})[_0x4685('0x16')](function(_0xf594e){logger[_0x4685('0x12')](_0x4685('0x14'),_0x74edb,_0xf594e);_0x36d35f(_0xf594e);});});}exports[_0x4685('0x17')]=function(_0x3eded6){var _0x2e2e39=this;return new Promise(function(_0x35b051,_0x2820a0){return db['WhatsappAccount'][_0x4685('0x18')]({'raw':_0x3eded6[_0x4685('0x19')]?_0x3eded6[_0x4685('0x19')][_0x4685('0x1a')]===undefined?!![]:![]:!![],'where':_0x3eded6[_0x4685('0x19')]?_0x3eded6['options'][_0x4685('0x1b')]||null:null,'attributes':_0x3eded6[_0x4685('0x19')]?_0x3eded6['options'][_0x4685('0x1c')]||null:null,'include':_0x3eded6['options']?_0x3eded6[_0x4685('0x19')][_0x4685('0x1d')]?_[_0x4685('0x1e')](_0x3eded6[_0x4685('0x19')][_0x4685('0x1d')],function(_0x3402f9){return{'model':db[_0x3402f9[_0x4685('0x1f')]],'as':_0x3402f9['as'],'attributes':_0x3402f9[_0x4685('0x1c')],'include':_0x3402f9[_0x4685('0x1d')]?_['map'](_0x3402f9[_0x4685('0x1d')],function(_0x2cc8ac){return{'model':db[_0x2cc8ac[_0x4685('0x1f')]],'as':_0x2cc8ac['as'],'attributes':_0x2cc8ac[_0x4685('0x1c')],'include':_0x2cc8ac[_0x4685('0x1d')]?_[_0x4685('0x1e')](_0x2cc8ac[_0x4685('0x1d')],function(_0x100b2e){return{'model':db[_0x100b2e[_0x4685('0x1f')]],'as':_0x100b2e['as'],'attributes':_0x100b2e[_0x4685('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4685('0xd')](function(_0x1c302c){logger['info'](_0x4685('0x17'),_0x3eded6);logger[_0x4685('0x10')](_0x4685('0x17'),_0x3eded6,JSON['stringify'](_0x1c302c));_0x35b051(_0x1c302c);})['catch'](function(_0x4ff302){logger[_0x4685('0x12')]('ShowWhatsappAccount',_0x4ff302[_0x4685('0x15')],_0x3eded6);_0x2820a0(_0x2e2e39['error'](0x1f4,_0x4ff302[_0x4685('0x15')]));});});}; \ No newline at end of file +var _0xcd78=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','ShowWhatsappAccount','find','options','where','map','include','attributes','model','then','stringify','bluebird','randomstring'];(function(_0x2d1e4e,_0x336d16){var _0x307844=function(_0x58896e){while(--_0x58896e){_0x2d1e4e['push'](_0x2d1e4e['shift']());}};_0x307844(++_0x336d16);}(_0xcd78,0x152));var _0x8cd7=function(_0x54682c,_0x2d26a8){_0x54682c=_0x54682c-0x0;var _0x440548=_0xcd78[_0x54682c];return _0x440548;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8cd7('0x0'));var rs=require(_0x8cd7('0x1'));var fs=require('fs');var Redis=require(_0x8cd7('0x2'));var db=require(_0x8cd7('0x3'))['db'];var utils=require(_0x8cd7('0x4'));var logger=require(_0x8cd7('0x5'))(_0x8cd7('0x6'));var config=require(_0x8cd7('0x7'));var jayson=require(_0x8cd7('0x8'));var client=jayson[_0x8cd7('0x9')]['http']({'port':0x232a});config[_0x8cd7('0xa')]=_[_0x8cd7('0xb')](config[_0x8cd7('0xa')],{'host':_0x8cd7('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8cd7('0xa')]));require(_0x8cd7('0xd'))[_0x8cd7('0xe')](socket);function respondWithRpcPromise(_0x37b049,_0x436c17,_0x207d7d){return new BPromise(function(_0x4dc31f,_0x3cc19a){return client[_0x8cd7('0xf')](_0x37b049,_0x207d7d)['then'](function(_0x3f7b6c){logger[_0x8cd7('0x10')](_0x8cd7('0x11'),_0x436c17,_0x8cd7('0x12'));logger[_0x8cd7('0x13')](_0x8cd7('0x14'),_0x436c17,_0x8cd7('0x12'),JSON['stringify'](_0x3f7b6c));if(_0x3f7b6c[_0x8cd7('0x15')]){if(_0x3f7b6c['error']['code']===0x1f4){logger[_0x8cd7('0x15')](_0x8cd7('0x11'),_0x436c17,_0x3f7b6c['error'][_0x8cd7('0x16')]);return _0x3cc19a(_0x3f7b6c[_0x8cd7('0x15')]['message']);}logger[_0x8cd7('0x15')](_0x8cd7('0x11'),_0x436c17,_0x3f7b6c[_0x8cd7('0x15')][_0x8cd7('0x16')]);return _0x4dc31f(_0x3f7b6c[_0x8cd7('0x15')][_0x8cd7('0x16')]);}else{logger['info'](_0x8cd7('0x11'),_0x436c17,_0x8cd7('0x12'));_0x4dc31f(_0x3f7b6c[_0x8cd7('0x17')][_0x8cd7('0x16')]);}})['catch'](function(_0x34918d){logger[_0x8cd7('0x15')](_0x8cd7('0x11'),_0x436c17,_0x34918d);_0x3cc19a(_0x34918d);});});}exports[_0x8cd7('0x18')]=function(_0x37a8f2){var _0x1b7213=this;return new Promise(function(_0x335646,_0x587f87){return db['WhatsappAccount'][_0x8cd7('0x19')]({'raw':_0x37a8f2[_0x8cd7('0x1a')]?_0x37a8f2[_0x8cd7('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x37a8f2[_0x8cd7('0x1a')]?_0x37a8f2[_0x8cd7('0x1a')][_0x8cd7('0x1b')]||null:null,'attributes':_0x37a8f2[_0x8cd7('0x1a')]?_0x37a8f2[_0x8cd7('0x1a')]['attributes']||null:null,'include':_0x37a8f2[_0x8cd7('0x1a')]?_0x37a8f2[_0x8cd7('0x1a')]['include']?_[_0x8cd7('0x1c')](_0x37a8f2[_0x8cd7('0x1a')][_0x8cd7('0x1d')],function(_0x4141b8){return{'model':db[_0x4141b8['model']],'as':_0x4141b8['as'],'attributes':_0x4141b8[_0x8cd7('0x1e')],'include':_0x4141b8['include']?_[_0x8cd7('0x1c')](_0x4141b8['include'],function(_0x3b7760){return{'model':db[_0x3b7760[_0x8cd7('0x1f')]],'as':_0x3b7760['as'],'attributes':_0x3b7760[_0x8cd7('0x1e')],'include':_0x3b7760[_0x8cd7('0x1d')]?_[_0x8cd7('0x1c')](_0x3b7760[_0x8cd7('0x1d')],function(_0x31a048){return{'model':db[_0x31a048['model']],'as':_0x31a048['as'],'attributes':_0x31a048[_0x8cd7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8cd7('0x20')](function(_0x40e6f0){logger[_0x8cd7('0x10')]('ShowWhatsappAccount',_0x37a8f2);logger['debug']('ShowWhatsappAccount',_0x37a8f2,JSON[_0x8cd7('0x21')](_0x40e6f0));_0x335646(_0x40e6f0);})['catch'](function(_0x283085){logger[_0x8cd7('0x15')](_0x8cd7('0x18'),_0x283085['message'],_0x37a8f2);_0x587f87(_0x1b7213[_0x8cd7('0x15')](0x1f4,_0x283085[_0x8cd7('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 868507b..547333c 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 _0x5015=['update','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save','remove'];(function(_0x3072eb,_0x455321){var _0x55db4b=function(_0x333eda){while(--_0x333eda){_0x3072eb['push'](_0x3072eb['shift']());}};_0x55db4b(++_0x455321);}(_0x5015,0x153));var _0x5501=function(_0x54cdb1,_0x37d18a){_0x54cdb1=_0x54cdb1-0x0;var _0x1580cb=_0x5015[_0x54cdb1];return _0x1580cb;};'use strict';var WhatsappAccountEvents=require(_0x5501('0x0'));var events=[_0x5501('0x1'),_0x5501('0x2'),_0x5501('0x3')];function createListener(_0x406c50,_0x11f1ae){return function(_0x360341){_0x11f1ae[_0x5501('0x4')](_0x406c50,_0x360341);};}function removeListener(_0x2f8e28,_0xf38d4c){return function(){WhatsappAccountEvents[_0x5501('0x5')](_0x2f8e28,_0xf38d4c);};}exports[_0x5501('0x6')]=function(_0x88c83c){for(var _0x3eb200=0x0,_0x2f5fdc=events[_0x5501('0x7')];_0x3eb200<_0x2f5fdc;_0x3eb200++){var _0xfc8c67=events[_0x3eb200];var _0x6ecbdb=createListener(_0x5501('0x8')+_0xfc8c67,_0x88c83c);WhatsappAccountEvents['on'](_0xfc8c67,_0x6ecbdb);}}; \ No newline at end of file +var _0x4036=['length','whatsappAccount:','./whatsappAccount.events','remove','update','emit','register'];(function(_0x4d0f67,_0x171eea){var _0x159d86=function(_0x38fe1c){while(--_0x38fe1c){_0x4d0f67['push'](_0x4d0f67['shift']());}};_0x159d86(++_0x171eea);}(_0x4036,0x8e));var _0x6403=function(_0x505cdd,_0x505eb3){_0x505cdd=_0x505cdd-0x0;var _0x3e95e2=_0x4036[_0x505cdd];return _0x3e95e2;};'use strict';var WhatsappAccountEvents=require(_0x6403('0x0'));var events=['save',_0x6403('0x1'),_0x6403('0x2')];function createListener(_0x11805f,_0x2f9c63){return function(_0x285b37){_0x2f9c63[_0x6403('0x3')](_0x11805f,_0x285b37);};}function removeListener(_0x1f7b04,_0x3aa75e){return function(){WhatsappAccountEvents['removeListener'](_0x1f7b04,_0x3aa75e);};}exports[_0x6403('0x4')]=function(_0xb16984){for(var _0x395c01=0x0,_0x1c8f43=events[_0x6403('0x5')];_0x395c01<_0x1c8f43;_0x395c01++){var _0xba6831=events[_0x395c01];var _0x32dcb6=createListener(_0x6403('0x6')+_0xba6831,_0xb16984);WhatsappAccountEvents['on'](_0xba6831,_0x32dcb6);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 0cc4123..324783a 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 _0xff16=['isAuthenticated','create','put','update','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','post'];(function(_0x592df3,_0x47c7e7){var _0x143353=function(_0x214eb2){while(--_0x214eb2){_0x592df3['push'](_0x592df3['shift']());}};_0x143353(++_0x47c7e7);}(_0xff16,0x1a4));var _0x6ff1=function(_0x2913cf,_0x24641d){_0x2913cf=_0x2913cf-0x0;var _0x568c89=_0xff16[_0x2913cf];return _0x568c89;};'use strict';var multer=require('multer');var util=require(_0x6ff1('0x0'));var path=require(_0x6ff1('0x1'));var timeout=require(_0x6ff1('0x2'));var express=require('express');var router=express[_0x6ff1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6ff1('0x4'));var interaction=require(_0x6ff1('0x5'));var config=require(_0x6ff1('0x6'));var controller=require(_0x6ff1('0x7'));router[_0x6ff1('0x8')]('/',auth['isAuthenticated'](),controller[_0x6ff1('0x9')]);router[_0x6ff1('0x8')](_0x6ff1('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x6ff1('0xb')]('/',auth[_0x6ff1('0xc')](),controller[_0x6ff1('0xd')]);router[_0x6ff1('0xe')]('/:id',auth[_0x6ff1('0xc')](),controller[_0x6ff1('0xf')]);router[_0x6ff1('0x10')](_0x6ff1('0xa'),auth['isAuthenticated'](),controller[_0x6ff1('0x11')]);module['exports']=router; \ No newline at end of file +var _0x37d1=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','create','put','update','delete','exports','multer','util','path'];(function(_0x35817f,_0x58ea62){var _0x2468a0=function(_0x456b02){while(--_0x456b02){_0x35817f['push'](_0x35817f['shift']());}};_0x2468a0(++_0x58ea62);}(_0x37d1,0x179));var _0x137d=function(_0x3b41f1,_0x2d66e2){_0x3b41f1=_0x3b41f1-0x0;var _0x5d8c48=_0x37d1[_0x3b41f1];return _0x5d8c48;};'use strict';var multer=require(_0x137d('0x0'));var util=require(_0x137d('0x1'));var path=require(_0x137d('0x2'));var timeout=require('connect-timeout');var express=require(_0x137d('0x3'));var router=express[_0x137d('0x4')]();var fs_extra=require(_0x137d('0x5'));var auth=require(_0x137d('0x6'));var interaction=require(_0x137d('0x7'));var config=require(_0x137d('0x8'));var controller=require('./whatsappApplication.controller');router['get']('/',auth[_0x137d('0x9')](),controller[_0x137d('0xa')]);router[_0x137d('0xb')](_0x137d('0xc'),auth[_0x137d('0x9')](),controller[_0x137d('0xd')]);router['post']('/',auth[_0x137d('0x9')](),controller[_0x137d('0xe')]);router[_0x137d('0xf')]('/:id',auth[_0x137d('0x9')](),controller[_0x137d('0x10')]);router[_0x137d('0x11')](_0x137d('0xc'),auth[_0x137d('0x9')](),controller['destroy']);module[_0x137d('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 4d82d3a..f55b3e0 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 _0x4862=['exports','STRING','noop','TEXT','*,*,*,*'];(function(_0x340756,_0xad31ae){var _0x2ef745=function(_0x59ffde){while(--_0x59ffde){_0x340756['push'](_0x340756['shift']());}};_0x2ef745(++_0xad31ae);}(_0x4862,0x19f));var _0x2486=function(_0x343e44,_0x519af9){_0x343e44=_0x343e44-0x0;var _0xa5130e=_0x4862[_0x343e44];return _0xa5130e;};'use strict';var Sequelize=require('sequelize');module[_0x2486('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2486('0x1')],'allowNull':![],'defaultValue':_0x2486('0x2')},'appdata':{'type':Sequelize[_0x2486('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x2486('0x4')}}; \ No newline at end of file +var _0x9dea=['TEXT','STRING','*,*,*,*','sequelize'];(function(_0x514b0a,_0x3d792a){var _0x52f642=function(_0x3f48a0){while(--_0x3f48a0){_0x514b0a['push'](_0x514b0a['shift']());}};_0x52f642(++_0x3d792a);}(_0x9dea,0x167));var _0xa9de=function(_0x4693f2,_0x41c58d){_0x4693f2=_0x4693f2-0x0;var _0x3ed148=_0x9dea[_0x4693f2];return _0x3ed148;};'use strict';var Sequelize=require(_0xa9de('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa9de('0x1')]()},'description':{'type':Sequelize[_0xa9de('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa9de('0x3')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 27ef194..dd28545 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 _0x2c91=['map','WhatsappApplication','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index'];(function(_0x580996,_0xafaf16){var _0x1bb0a0=function(_0x229dfc){while(--_0x229dfc){_0x580996['push'](_0x580996['shift']());}};_0x1bb0a0(++_0xafaf16);}(_0x2c91,0x158));var _0x12c9=function(_0x31a80f,_0x8149ba){_0x31a80f=_0x31a80f-0x0;var _0x245977=_0x2c91[_0x31a80f];return _0x245977;};'use strict';var emlformat=require(_0x12c9('0x0'));var rimraf=require(_0x12c9('0x1'));var zipdir=require(_0x12c9('0x2'));var jsonpatch=require(_0x12c9('0x3'));var rp=require(_0x12c9('0x4'));var moment=require(_0x12c9('0x5'));var BPromise=require(_0x12c9('0x6'));var Mustache=require(_0x12c9('0x7'));var util=require('util');var path=require(_0x12c9('0x8'));var sox=require(_0x12c9('0x9'));var csv=require(_0x12c9('0xa'));var ejs=require(_0x12c9('0xb'));var fs=require('fs');var fs_extra=require(_0x12c9('0xc'));var _=require(_0x12c9('0xd'));var squel=require(_0x12c9('0xe'));var crypto=require('crypto');var jsforce=require(_0x12c9('0xf'));var deskjs=require(_0x12c9('0x10'));var toCsv=require('to-csv');var querystring=require(_0x12c9('0x11'));var Papa=require(_0x12c9('0x12'));var Redis=require('ioredis');var authService=require(_0x12c9('0x13'));var qs=require(_0x12c9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12c9('0x15'));var logger=require(_0x12c9('0x16'))('api');var utils=require(_0x12c9('0x17'));var config=require(_0x12c9('0x18'));var licenseUtil=require(_0x12c9('0x19'));var db=require(_0x12c9('0x1a'))['db'];function respondWithStatusCode(_0x278da5,_0x2b239d){_0x2b239d=_0x2b239d||0xcc;return function(_0x5629b7){if(_0x5629b7){return _0x278da5[_0x12c9('0x1b')](_0x2b239d);}return _0x278da5[_0x12c9('0x1c')](_0x2b239d)[_0x12c9('0x1d')]();};}function respondWithResult(_0x4d0388,_0x4bf1a9){_0x4bf1a9=_0x4bf1a9||0xc8;return function(_0x490854){if(_0x490854){return _0x4d0388['status'](_0x4bf1a9)['json'](_0x490854);}};}function respondWithFilteredResult(_0x9fa35,_0x4e4cbf){return function(_0x3a83b4){if(_0x3a83b4){var _0x4460d5=typeof _0x4e4cbf[_0x12c9('0x1e')]===_0x12c9('0x1f')&&typeof _0x4e4cbf[_0x12c9('0x20')]==='undefined';var _0x2f704c=_0x3a83b4[_0x12c9('0x21')];var _0x1890d4=_0x4460d5?0x0:_0x4e4cbf[_0x12c9('0x1e')];var _0x44e9af=_0x4460d5?_0x3a83b4[_0x12c9('0x21')]:_0x4e4cbf[_0x12c9('0x1e')]+_0x4e4cbf[_0x12c9('0x20')];var _0x59b225;if(_0x44e9af>=_0x2f704c){_0x44e9af=_0x2f704c;_0x59b225=0xc8;}else{_0x59b225=0xce;}_0x9fa35[_0x12c9('0x1c')](_0x59b225);return _0x9fa35['set'](_0x12c9('0x22'),_0x1890d4+'-'+_0x44e9af+'/'+_0x2f704c)[_0x12c9('0x23')](_0x3a83b4);}return null;};}function patchUpdates(_0xd036ef){return function(_0x17675e){try{jsonpatch[_0x12c9('0x24')](_0x17675e,_0xd036ef,!![]);}catch(_0x4e767a){return BPromise[_0x12c9('0x25')](_0x4e767a);}return _0x17675e[_0x12c9('0x26')]();};}function saveUpdates(_0x2a324f,_0x36d400){return function(_0x370126){if(_0x370126){return _0x370126[_0x12c9('0x27')](_0x2a324f)[_0x12c9('0x28')](function(_0x1d7942){return _0x1d7942;});}return null;};}function removeEntity(_0x210a77,_0x2eecec){return function(_0x905751){if(_0x905751){return _0x905751['destroy']()[_0x12c9('0x28')](function(){_0x210a77[_0x12c9('0x1c')](0xcc)[_0x12c9('0x1d')]();});}};}function handleEntityNotFound(_0x1aa6a8,_0x1f0dcd){return function(_0x38e38d){if(!_0x38e38d){_0x1aa6a8[_0x12c9('0x1b')](0x194);}return _0x38e38d;};}function handleError(_0x27b338,_0x250288){_0x250288=_0x250288||0x1f4;return function(_0x3ed911){logger[_0x12c9('0x29')](_0x3ed911[_0x12c9('0x2a')]);if(_0x3ed911[_0x12c9('0x2b')]){delete _0x3ed911[_0x12c9('0x2b')];}_0x27b338[_0x12c9('0x1c')](_0x250288)[_0x12c9('0x2c')](_0x3ed911);};}exports[_0x12c9('0x2d')]=function(_0xa53d40,_0x9a8f1e){var _0x222419={},_0x5c02fb={},_0x44636d={'count':0x0,'rows':[]};var _0x117284=_[_0x12c9('0x2e')](db[_0x12c9('0x2f')][_0x12c9('0x30')],function(_0x5138cc){return{'name':_0x5138cc[_0x12c9('0x31')],'type':_0x5138cc['type'][_0x12c9('0x32')]};});_0x5c02fb[_0x12c9('0x33')]=_[_0x12c9('0x2e')](_0x117284,_0x12c9('0x2b'));_0x5c02fb[_0x12c9('0x34')]=_['keys'](_0xa53d40[_0x12c9('0x34')]);_0x5c02fb['filters']=_[_0x12c9('0x35')](_0x5c02fb[_0x12c9('0x33')],_0x5c02fb[_0x12c9('0x34')]);_0x222419[_0x12c9('0x36')]=_[_0x12c9('0x35')](_0x5c02fb[_0x12c9('0x33')],qs[_0x12c9('0x37')](_0xa53d40[_0x12c9('0x34')][_0x12c9('0x37')]));_0x222419['attributes']=_0x222419['attributes'][_0x12c9('0x38')]?_0x222419[_0x12c9('0x36')]:_0x5c02fb[_0x12c9('0x33')];if(!_0xa53d40[_0x12c9('0x34')][_0x12c9('0x39')](_0x12c9('0x3a'))){_0x222419[_0x12c9('0x20')]=qs['limit'](_0xa53d40[_0x12c9('0x34')][_0x12c9('0x20')]);_0x222419[_0x12c9('0x1e')]=qs['offset'](_0xa53d40[_0x12c9('0x34')][_0x12c9('0x1e')]);}_0x222419['order']=qs[_0x12c9('0x3b')](_0xa53d40[_0x12c9('0x34')][_0x12c9('0x3b')]);_0x222419['where']=qs[_0x12c9('0x3c')](_[_0x12c9('0x3d')](_0xa53d40[_0x12c9('0x34')],_0x5c02fb[_0x12c9('0x3c')]),_0x117284);if(_0xa53d40[_0x12c9('0x34')][_0x12c9('0x3e')]){_0x222419[_0x12c9('0x3f')]=_[_0x12c9('0x40')](_0x222419[_0x12c9('0x3f')],{'$or':_[_0x12c9('0x2e')](_0x117284,function(_0x5338d8){if(_0x5338d8[_0x12c9('0x41')]!==_0x12c9('0x42')){var _0x46c758={};_0x46c758[_0x5338d8[_0x12c9('0x2b')]]={'$like':'%'+_0xa53d40[_0x12c9('0x34')]['filter']+'%'};return _0x46c758;}})});}_0x222419=_[_0x12c9('0x40')]({},_0x222419,_0xa53d40['options']);var _0x372ae3={'where':_0x222419[_0x12c9('0x3f')]};return db[_0x12c9('0x2f')]['count'](_0x372ae3)['then'](function(_0x22b057){_0x44636d[_0x12c9('0x21')]=_0x22b057;if(_0xa53d40[_0x12c9('0x34')][_0x12c9('0x43')]){_0x222419[_0x12c9('0x44')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x12c9('0x45')](_0x222419);})[_0x12c9('0x28')](function(_0x5bda1e){_0x44636d[_0x12c9('0x46')]=_0x5bda1e;return _0x44636d;})[_0x12c9('0x28')](respondWithFilteredResult(_0x9a8f1e,_0x222419))[_0x12c9('0x47')](handleError(_0x9a8f1e,null));};exports['show']=function(_0x44cd4c,_0x179972){var _0x5687fb={'raw':!![],'where':{'id':_0x44cd4c[_0x12c9('0x48')]['id']}},_0x2f1a27={};_0x2f1a27[_0x12c9('0x33')]=_[_0x12c9('0x49')](db[_0x12c9('0x2f')][_0x12c9('0x30')]);_0x2f1a27[_0x12c9('0x34')]=_['keys'](_0x44cd4c[_0x12c9('0x34')]);_0x2f1a27[_0x12c9('0x3c')]=_['intersection'](_0x2f1a27[_0x12c9('0x33')],_0x2f1a27[_0x12c9('0x34')]);_0x5687fb[_0x12c9('0x36')]=_[_0x12c9('0x35')](_0x2f1a27[_0x12c9('0x33')],qs[_0x12c9('0x37')](_0x44cd4c[_0x12c9('0x34')]['fields']));_0x5687fb[_0x12c9('0x36')]=_0x5687fb['attributes'][_0x12c9('0x38')]?_0x5687fb['attributes']:_0x2f1a27['model'];if(_0x44cd4c[_0x12c9('0x34')][_0x12c9('0x43')]){_0x5687fb['include']=[{'all':!![]}];}_0x5687fb=_[_0x12c9('0x40')]({},_0x5687fb,_0x44cd4c[_0x12c9('0x4a')]);return db[_0x12c9('0x2f')][_0x12c9('0x4b')](_0x5687fb)[_0x12c9('0x28')](handleEntityNotFound(_0x179972,null))[_0x12c9('0x28')](respondWithResult(_0x179972,null))[_0x12c9('0x47')](handleError(_0x179972,null));};exports['create']=function(_0xf140da,_0x2af97c){return db[_0x12c9('0x2f')][_0x12c9('0x4c')](_0xf140da['body'],{})[_0x12c9('0x28')](respondWithResult(_0x2af97c,0xc9))['catch'](handleError(_0x2af97c,null));};exports[_0x12c9('0x27')]=function(_0x43f2ec,_0x3e312a){if(_0x43f2ec[_0x12c9('0x4d')]['id']){delete _0x43f2ec['body']['id'];}return db[_0x12c9('0x2f')][_0x12c9('0x4b')]({'where':{'id':_0x43f2ec[_0x12c9('0x48')]['id']}})['then'](handleEntityNotFound(_0x3e312a,null))[_0x12c9('0x28')](saveUpdates(_0x43f2ec['body'],null))[_0x12c9('0x28')](respondWithResult(_0x3e312a,null))[_0x12c9('0x47')](handleError(_0x3e312a,null));};exports['destroy']=function(_0x518335,_0x59fc17){return db[_0x12c9('0x2f')][_0x12c9('0x4b')]({'where':{'id':_0x518335[_0x12c9('0x48')]['id']}})['then'](handleEntityNotFound(_0x59fc17,null))['then'](removeEntity(_0x59fc17,null))[_0x12c9('0x47')](handleError(_0x59fc17,null));}; \ No newline at end of file +var _0x3c8e=['squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy','end','stack','name','send','index','map','WhatsappApplication','fieldName','type','key','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','intersection','length','find','catch','create','body','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x5972be,_0xcefc33){var _0x416d72=function(_0x5720e5){while(--_0x5720e5){_0x5972be['push'](_0x5972be['shift']());}};_0x416d72(++_0xcefc33);}(_0x3c8e,0x89));var _0xe3c8=function(_0x5c73fb,_0x2ac5d8){_0x5c73fb=_0x5c73fb-0x0;var _0x3b82be=_0x3c8e[_0x5c73fb];return _0x3b82be;};'use strict';var emlformat=require(_0xe3c8('0x0'));var rimraf=require(_0xe3c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe3c8('0x2'));var moment=require(_0xe3c8('0x3'));var BPromise=require(_0xe3c8('0x4'));var Mustache=require('mustache');var util=require(_0xe3c8('0x5'));var path=require(_0xe3c8('0x6'));var sox=require(_0xe3c8('0x7'));var csv=require(_0xe3c8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe3c8('0x9'));var _=require(_0xe3c8('0xa'));var squel=require(_0xe3c8('0xb'));var crypto=require(_0xe3c8('0xc'));var jsforce=require(_0xe3c8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe3c8('0x8'));var querystring=require('querystring');var Papa=require(_0xe3c8('0xe'));var Redis=require(_0xe3c8('0xf'));var authService=require(_0xe3c8('0x10'));var qs=require(_0xe3c8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3c8('0x12'));var logger=require(_0xe3c8('0x13'))(_0xe3c8('0x14'));var utils=require('../../config/utils');var config=require(_0xe3c8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe3c8('0x16'))['db'];function respondWithStatusCode(_0x4ef00c,_0x4e3c9c){_0x4e3c9c=_0x4e3c9c||0xcc;return function(_0x19067a){if(_0x19067a){return _0x4ef00c[_0xe3c8('0x17')](_0x4e3c9c);}return _0x4ef00c[_0xe3c8('0x18')](_0x4e3c9c)['end']();};}function respondWithResult(_0x41b01b,_0x14625f){_0x14625f=_0x14625f||0xc8;return function(_0x45c7c3){if(_0x45c7c3){return _0x41b01b[_0xe3c8('0x18')](_0x14625f)[_0xe3c8('0x19')](_0x45c7c3);}};}function respondWithFilteredResult(_0x264694,_0x4c9604){return function(_0x2b7c91){if(_0x2b7c91){var _0x138dc8=typeof _0x4c9604['offset']===_0xe3c8('0x1a')&&typeof _0x4c9604[_0xe3c8('0x1b')]===_0xe3c8('0x1a');var _0x4d94de=_0x2b7c91[_0xe3c8('0x1c')];var _0x1dc06e=_0x138dc8?0x0:_0x4c9604[_0xe3c8('0x1d')];var _0x1677ef=_0x138dc8?_0x2b7c91[_0xe3c8('0x1c')]:_0x4c9604[_0xe3c8('0x1d')]+_0x4c9604[_0xe3c8('0x1b')];var _0x588b6b;if(_0x1677ef>=_0x4d94de){_0x1677ef=_0x4d94de;_0x588b6b=0xc8;}else{_0x588b6b=0xce;}_0x264694[_0xe3c8('0x18')](_0x588b6b);return _0x264694[_0xe3c8('0x1e')](_0xe3c8('0x1f'),_0x1dc06e+'-'+_0x1677ef+'/'+_0x4d94de)[_0xe3c8('0x19')](_0x2b7c91);}return null;};}function patchUpdates(_0x3692c7){return function(_0x2fd61e){try{jsonpatch['apply'](_0x2fd61e,_0x3692c7,!![]);}catch(_0x1010a3){return BPromise[_0xe3c8('0x20')](_0x1010a3);}return _0x2fd61e['save']();};}function saveUpdates(_0x35f730,_0x44bf1d){return function(_0x5396ea){if(_0x5396ea){return _0x5396ea[_0xe3c8('0x21')](_0x35f730)[_0xe3c8('0x22')](function(_0x5efb85){return _0x5efb85;});}return null;};}function removeEntity(_0x3b1987,_0x3f9460){return function(_0x2558b8){if(_0x2558b8){return _0x2558b8[_0xe3c8('0x23')]()[_0xe3c8('0x22')](function(){_0x3b1987['status'](0xcc)[_0xe3c8('0x24')]();});}};}function handleEntityNotFound(_0x50a2ce,_0x4a0cfb){return function(_0x4b9fa5){if(!_0x4b9fa5){_0x50a2ce[_0xe3c8('0x17')](0x194);}return _0x4b9fa5;};}function handleError(_0x4f2d7f,_0x350134){_0x350134=_0x350134||0x1f4;return function(_0x27887a){logger['error'](_0x27887a[_0xe3c8('0x25')]);if(_0x27887a['name']){delete _0x27887a[_0xe3c8('0x26')];}_0x4f2d7f[_0xe3c8('0x18')](_0x350134)[_0xe3c8('0x27')](_0x27887a);};}exports[_0xe3c8('0x28')]=function(_0xca96ed,_0x182d57){var _0x9d9e45={},_0x497448={},_0x56b742={'count':0x0,'rows':[]};var _0x3cf2f8=_[_0xe3c8('0x29')](db[_0xe3c8('0x2a')]['rawAttributes'],function(_0x28cc46){return{'name':_0x28cc46[_0xe3c8('0x2b')],'type':_0x28cc46[_0xe3c8('0x2c')][_0xe3c8('0x2d')]};});_0x497448['model']=_[_0xe3c8('0x29')](_0x3cf2f8,'name');_0x497448[_0xe3c8('0x2e')]=_[_0xe3c8('0x2f')](_0xca96ed[_0xe3c8('0x2e')]);_0x497448[_0xe3c8('0x30')]=_['intersection'](_0x497448[_0xe3c8('0x31')],_0x497448[_0xe3c8('0x2e')]);_0x9d9e45[_0xe3c8('0x32')]=_['intersection'](_0x497448[_0xe3c8('0x31')],qs[_0xe3c8('0x33')](_0xca96ed[_0xe3c8('0x2e')][_0xe3c8('0x33')]));_0x9d9e45[_0xe3c8('0x32')]=_0x9d9e45[_0xe3c8('0x32')]['length']?_0x9d9e45[_0xe3c8('0x32')]:_0x497448['model'];if(!_0xca96ed[_0xe3c8('0x2e')][_0xe3c8('0x34')](_0xe3c8('0x35'))){_0x9d9e45[_0xe3c8('0x1b')]=qs[_0xe3c8('0x1b')](_0xca96ed[_0xe3c8('0x2e')][_0xe3c8('0x1b')]);_0x9d9e45[_0xe3c8('0x1d')]=qs['offset'](_0xca96ed[_0xe3c8('0x2e')]['offset']);}_0x9d9e45['order']=qs[_0xe3c8('0x36')](_0xca96ed[_0xe3c8('0x2e')][_0xe3c8('0x36')]);_0x9d9e45[_0xe3c8('0x37')]=qs['filters'](_[_0xe3c8('0x38')](_0xca96ed['query'],_0x497448[_0xe3c8('0x30')]),_0x3cf2f8);if(_0xca96ed[_0xe3c8('0x2e')][_0xe3c8('0x39')]){_0x9d9e45[_0xe3c8('0x37')]=_[_0xe3c8('0x3a')](_0x9d9e45[_0xe3c8('0x37')],{'$or':_[_0xe3c8('0x29')](_0x3cf2f8,function(_0x19f577){if(_0x19f577[_0xe3c8('0x2c')]!==_0xe3c8('0x3b')){var _0x1efb42={};_0x1efb42[_0x19f577['name']]={'$like':'%'+_0xca96ed['query'][_0xe3c8('0x39')]+'%'};return _0x1efb42;}})});}_0x9d9e45=_[_0xe3c8('0x3a')]({},_0x9d9e45,_0xca96ed[_0xe3c8('0x3c')]);var _0x68f3c0={'where':_0x9d9e45['where']};return db[_0xe3c8('0x2a')]['count'](_0x68f3c0)[_0xe3c8('0x22')](function(_0x3714d4){_0x56b742[_0xe3c8('0x1c')]=_0x3714d4;if(_0xca96ed['query'][_0xe3c8('0x3d')]){_0x9d9e45[_0xe3c8('0x3e')]=[{'all':!![]}];}return db[_0xe3c8('0x2a')][_0xe3c8('0x3f')](_0x9d9e45);})[_0xe3c8('0x22')](function(_0x31ee36){_0x56b742[_0xe3c8('0x40')]=_0x31ee36;return _0x56b742;})['then'](respondWithFilteredResult(_0x182d57,_0x9d9e45))['catch'](handleError(_0x182d57,null));};exports[_0xe3c8('0x41')]=function(_0x52e813,_0x30f63c){var _0x2bd33f={'raw':!![],'where':{'id':_0x52e813[_0xe3c8('0x42')]['id']}},_0x440858={};_0x440858[_0xe3c8('0x31')]=_[_0xe3c8('0x2f')](db['WhatsappApplication'][_0xe3c8('0x43')]);_0x440858[_0xe3c8('0x2e')]=_[_0xe3c8('0x2f')](_0x52e813[_0xe3c8('0x2e')]);_0x440858['filters']=_['intersection'](_0x440858['model'],_0x440858['query']);_0x2bd33f[_0xe3c8('0x32')]=_[_0xe3c8('0x44')](_0x440858[_0xe3c8('0x31')],qs['fields'](_0x52e813['query'][_0xe3c8('0x33')]));_0x2bd33f[_0xe3c8('0x32')]=_0x2bd33f[_0xe3c8('0x32')][_0xe3c8('0x45')]?_0x2bd33f[_0xe3c8('0x32')]:_0x440858[_0xe3c8('0x31')];if(_0x52e813[_0xe3c8('0x2e')]['includeAll']){_0x2bd33f[_0xe3c8('0x3e')]=[{'all':!![]}];}_0x2bd33f=_[_0xe3c8('0x3a')]({},_0x2bd33f,_0x52e813[_0xe3c8('0x3c')]);return db[_0xe3c8('0x2a')][_0xe3c8('0x46')](_0x2bd33f)[_0xe3c8('0x22')](handleEntityNotFound(_0x30f63c,null))['then'](respondWithResult(_0x30f63c,null))[_0xe3c8('0x47')](handleError(_0x30f63c,null));};exports[_0xe3c8('0x48')]=function(_0x55c080,_0x5cec7f){return db[_0xe3c8('0x2a')][_0xe3c8('0x48')](_0x55c080['body'],{})[_0xe3c8('0x22')](respondWithResult(_0x5cec7f,0xc9))[_0xe3c8('0x47')](handleError(_0x5cec7f,null));};exports['update']=function(_0x17c257,_0x3bbd2a){if(_0x17c257[_0xe3c8('0x49')]['id']){delete _0x17c257[_0xe3c8('0x49')]['id'];}return db[_0xe3c8('0x2a')][_0xe3c8('0x46')]({'where':{'id':_0x17c257[_0xe3c8('0x42')]['id']}})['then'](handleEntityNotFound(_0x3bbd2a,null))['then'](saveUpdates(_0x17c257[_0xe3c8('0x49')],null))[_0xe3c8('0x22')](respondWithResult(_0x3bbd2a,null))[_0xe3c8('0x47')](handleError(_0x3bbd2a,null));};exports[_0xe3c8('0x23')]=function(_0xa7ba8f,_0x5612c9){return db[_0xe3c8('0x2a')][_0xe3c8('0x46')]({'where':{'id':_0xa7ba8f[_0xe3c8('0x42')]['id']}})[_0xe3c8('0x22')](handleEntityNotFound(_0x5612c9,null))[_0xe3c8('0x22')](removeEntity(_0x5612c9,null))[_0xe3c8('0x47')](handleError(_0x5612c9,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 7aad975..da1e2b7 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 _0x8a9c=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4'];(function(_0x30c741,_0x49057b){var _0x10b0b9=function(_0x108459){while(--_0x108459){_0x30c741['push'](_0x30c741['shift']());}};_0x10b0b9(++_0x49057b);}(_0x8a9c,0x12d));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc8a9('0x0'));var util=require(_0xc8a9('0x1'));var logger=require(_0xc8a9('0x2'))(_0xc8a9('0x3'));var moment=require(_0xc8a9('0x4'));var BPromise=require('bluebird');var rp=require(_0xc8a9('0x5'));var fs=require('fs');var path=require(_0xc8a9('0x6'));var rimraf=require('rimraf');var config=require(_0xc8a9('0x7'));var attributes=require(_0xc8a9('0x8'));module[_0xc8a9('0x9')]=function(_0x4c1e04,_0xb4340b){return _0x4c1e04[_0xc8a9('0xa')](_0xc8a9('0xb'),attributes,{'tableName':_0xc8a9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc8a9('0xd'),'collate':_0xc8a9('0xe')});}; \ No newline at end of file +var _0x2fed=['path','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0xf789ca,_0x1c7340){var _0x5f378c=function(_0xc95db0){while(--_0xc95db0){_0xf789ca['push'](_0xf789ca['shift']());}};_0x5f378c(++_0x1c7340);}(_0x2fed,0x7c));var _0xd2fe=function(_0x1615e0,_0x5d054a){_0x1615e0=_0x1615e0-0x0;var _0xf329e6=_0x2fed[_0x1615e0];return _0xf329e6;};'use strict';var _=require(_0xd2fe('0x0'));var util=require(_0xd2fe('0x1'));var logger=require(_0xd2fe('0x2'))(_0xd2fe('0x3'));var moment=require(_0xd2fe('0x4'));var BPromise=require('bluebird');var rp=require(_0xd2fe('0x5'));var fs=require('fs');var path=require(_0xd2fe('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd2fe('0x7'));module[_0xd2fe('0x8')]=function(_0xd85f89,_0x5be4d3){return _0xd85f89[_0xd2fe('0x9')](_0xd2fe('0xa'),attributes,{'tableName':_0xd2fe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd2fe('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index fb0ce44..b6c1d26 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 _0xdace=['request\x20sent','debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0xdace,0xc5));var _0xedac=function(_0x179b53,_0x31f6fe){_0x179b53=_0x179b53-0x0;var _0x38a146=_0xdace[_0x179b53];return _0x38a146;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecbd3,_0x4081c6,_0x21440e){return new BPromise(function(_0x162eea,_0x53fa43){return client[_0xedac('0xb')](_0x5ecbd3,_0x21440e)[_0xedac('0xc')](function(_0xc98887){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x4081c6,'request\x20sent',JSON[_0xedac('0xf')](_0xc98887));if(_0xc98887[_0xedac('0x10')]){if(_0xc98887['error'][_0xedac('0x11')]===0x1f4){logger['error'](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);return _0x53fa43(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')]['message']);return _0x162eea(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}else{logger[_0xedac('0x14')](_0xedac('0x12'),_0x4081c6,_0xedac('0xd'));_0x162eea(_0xc98887['result'][_0xedac('0x13')]);}})['catch'](function(_0xddc7b8){logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xddc7b8);_0x53fa43(_0xddc7b8);});});} \ No newline at end of file +var _0x032e=['code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1007b9,_0x14ebe3){var _0x3b43d4=function(_0x474010){while(--_0x474010){_0x1007b9['push'](_0x1007b9['shift']());}};_0x3b43d4(++_0x14ebe3);}(_0x032e,0x124));var _0xe032=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x032e[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var moment=require(_0xe032('0x1'));var BPromise=require(_0xe032('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe032('0x3'))['db'];var utils=require(_0xe032('0x4'));var logger=require(_0xe032('0x5'))(_0xe032('0x6'));var config=require(_0xe032('0x7'));var jayson=require(_0xe032('0x8'));var client=jayson[_0xe032('0x9')][_0xe032('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37432f,_0x1576c8,_0x3289b0){return new BPromise(function(_0xd84027,_0xaf3907){return client[_0xe032('0xb')](_0x37432f,_0x3289b0)[_0xe032('0xc')](function(_0x2d8a14){logger[_0xe032('0xd')](_0xe032('0xe'),_0x1576c8,'request\x20sent');logger[_0xe032('0xf')](_0xe032('0x10'),_0x1576c8,_0xe032('0x11'),JSON[_0xe032('0x12')](_0x2d8a14));if(_0x2d8a14[_0xe032('0x13')]){if(_0x2d8a14[_0xe032('0x13')][_0xe032('0x14')]===0x1f4){logger['error'](_0xe032('0xe'),_0x1576c8,_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);return _0xaf3907(_0x2d8a14[_0xe032('0x13')]['message']);}logger[_0xe032('0x13')](_0xe032('0xe'),_0x1576c8,_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);return _0xd84027(_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);}else{logger[_0xe032('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x1576c8,_0xe032('0x11'));_0xd84027(_0x2d8a14[_0xe032('0x16')][_0xe032('0x15')]);}})[_0xe032('0x17')](function(_0x1938c4){logger[_0xe032('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x1576c8,_0x1938c4);_0xaf3907(_0x1938c4);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 64963d8..252cdcb 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 _0xc6ac=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','update','delete','whatsappinteraction:destroy','destroy','/:id/tags','exports','multer','util','path'];(function(_0x3ab905,_0x4aa297){var _0x1496c3=function(_0x31324a){while(--_0x31324a){_0x3ab905['push'](_0x3ab905['shift']());}};_0x1496c3(++_0x4aa297);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x585288,_0xc8275a){_0x585288=_0x585288-0x0;var _0x143579=_0xc6ac[_0x585288];return _0x143579;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require(_0xcc6a('0x6'));var auth=require(_0xcc6a('0x7'));var interaction=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var controller=require(_0xcc6a('0xa'));router[_0xcc6a('0xb')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router['get'](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router['get'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x11')]);router[_0xcc6a('0xb')](_0xcc6a('0x12'),auth['isAuthenticated'](),controller[_0xcc6a('0x13')]);router[_0xcc6a('0xb')](_0xcc6a('0x14'),auth['isAuthenticated'](),controller[_0xcc6a('0x15')]);router[_0xcc6a('0x16')]('/',auth[_0xcc6a('0xc')](),controller['create']);router['post'](_0xcc6a('0x12'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x17')]);router['post']('/:id/tags',auth[_0xcc6a('0xc')](),interaction[_0xcc6a('0x18')](_0xcc6a('0x19'),_0xcc6a('0x1a')),controller[_0xcc6a('0x1b')]);router[_0xcc6a('0x1c')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),interaction['tracked']('whatsapp','whatsappinteraction:update'),controller[_0xcc6a('0x1d')]);router[_0xcc6a('0x1e')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),interaction[_0xcc6a('0x18')](_0xcc6a('0x19'),_0xcc6a('0x1f')),controller[_0xcc6a('0x20')]);router[_0xcc6a('0x1e')](_0xcc6a('0x21'),auth[_0xcc6a('0xc')](),controller['removeTags']);module[_0xcc6a('0x22')]=router; \ No newline at end of file +var _0x6657=['/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','describe'];(function(_0xfd6416,_0x13cebb){var _0x447e20=function(_0x31b9fb){while(--_0x31b9fb){_0xfd6416['push'](_0xfd6416['shift']());}};_0x447e20(++_0x13cebb);}(_0x6657,0x17f));var _0x7665=function(_0x23b85e,_0x39b209){_0x23b85e=_0x23b85e-0x0;var _0x329756=_0x6657[_0x23b85e];return _0x329756;};'use strict';var multer=require(_0x7665('0x0'));var util=require('util');var path=require(_0x7665('0x1'));var timeout=require(_0x7665('0x2'));var express=require(_0x7665('0x3'));var router=express[_0x7665('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7665('0x5'));var interaction=require(_0x7665('0x6'));var config=require(_0x7665('0x7'));var controller=require(_0x7665('0x8'));router[_0x7665('0x9')]('/',auth[_0x7665('0xa')](),controller[_0x7665('0xb')]);router[_0x7665('0x9')]('/describe',auth[_0x7665('0xa')](),controller[_0x7665('0xc')]);router[_0x7665('0x9')](_0x7665('0xd'),auth[_0x7665('0xa')](),controller[_0x7665('0xe')]);router[_0x7665('0x9')](_0x7665('0xf'),auth['isAuthenticated'](),controller[_0x7665('0x10')]);router[_0x7665('0x9')](_0x7665('0x11'),auth['isAuthenticated'](),controller[_0x7665('0x12')]);router['post']('/',auth[_0x7665('0xa')](),controller[_0x7665('0x13')]);router['post'](_0x7665('0xf'),auth[_0x7665('0xa')](),controller['addMessage']);router[_0x7665('0x14')](_0x7665('0x15'),auth['isAuthenticated'](),interaction[_0x7665('0x16')](_0x7665('0x17'),_0x7665('0x18')),controller[_0x7665('0x19')]);router[_0x7665('0x1a')](_0x7665('0xd'),auth[_0x7665('0xa')](),interaction[_0x7665('0x16')](_0x7665('0x17'),_0x7665('0x1b')),controller[_0x7665('0x1c')]);router[_0x7665('0x1d')](_0x7665('0xd'),auth[_0x7665('0xa')](),interaction[_0x7665('0x16')](_0x7665('0x17'),'whatsappinteraction:destroy'),controller[_0x7665('0x1e')]);router[_0x7665('0x1d')]('/:id/tags',auth[_0x7665('0xa')](),controller[_0x7665('0x1f')]);module[_0x7665('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 99a61d5..6ae2614 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 _0x207c=['BOOLEAN','DATE','STRING','ENUM','out','moment','exports'];(function(_0x3c4162,_0x284c9a){var _0x2c1da4=function(_0x20a120){while(--_0x20a120){_0x3c4162['push'](_0x3c4162['shift']());}};_0x2c1da4(++_0x284c9a);}(_0x207c,0x1e8));var _0xc207=function(_0x4927dc,_0x54b3f6){_0x4927dc=_0x4927dc-0x0;var _0x45e1c3=_0x207c[_0x4927dc];return _0x45e1c3;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc207('0x0'));module[_0xc207('0x1')]={'closed':{'type':Sequelize[_0xc207('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc207('0x3')]},'disposition':{'type':Sequelize[_0xc207('0x4')]},'secondDisposition':{'type':Sequelize[_0xc207('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc207('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xc207('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc207('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc207('0x5')]('in',_0xc207('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb5bb=['BOOLEAN','sequelize','moment','exports','DATE','STRING','out'];(function(_0x245545,_0x4983b3){var _0x106a5f=function(_0x278277){while(--_0x278277){_0x245545['push'](_0x245545['shift']());}};_0x106a5f(++_0x4983b3);}(_0xb5bb,0x1ba));var _0xbb5b=function(_0x50a167,_0x3950cf){_0x50a167=_0x50a167-0x0;var _0x196c9c=_0xb5bb[_0x50a167];return _0x196c9c;};'use strict';var Sequelize=require(_0xbb5b('0x0'));var moment=require(_0xbb5b('0x1'));module[_0xbb5b('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbb5b('0x3')]},'disposition':{'type':Sequelize[_0xbb5b('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xbb5b('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbb5b('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbb5b('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xbb5b('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 5222c5b..00db4c8 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 _0xf0f1=['findAll','addTags','setTags','spread','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','Attachment','direction','secret','Account','get','mkdirSync','Whatsapp','Owner','N.A.','closedAt','basename','existsSync','createReadStream','pipe','createWriteStream','System','lastName','out','renderFile','views','transcript-','download','err','unlinkSync','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','apply','reject','then','destroy','error','stack','name','map','fullname','TagIds','Tags','split','push','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch','length','conditions','find','unreadMessages','`\x20=\x200','`\x20>\x200','operator','$substring','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','compact','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','isEmpty','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','WhatsappInteraction','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','WhatsappInteractionId','all','rows','show','params','includeAll','options','update','describe','addMessage','WhatsappMessage','ids','omit','format','YYYY-MM-DD\x20HH:mm:ss','include'];(function(_0x2c0c28,_0x394236){var _0x2e7a1d=function(_0x763fbf){while(--_0x763fbf){_0x2c0c28['push'](_0x2c0c28['shift']());}};_0x2e7a1d(++_0x394236);}(_0xf0f1,0x110));var _0x1f0f=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0xf0f1[_0x39e283];return _0x7de89f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1f0f('0x0'));var zipdir=require(_0x1f0f('0x1'));var jsonpatch=require(_0x1f0f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1f0f('0x3'));var Mustache=require('mustache');var util=require(_0x1f0f('0x4'));var path=require('path');var sox=require(_0x1f0f('0x5'));var csv=require(_0x1f0f('0x6'));var ejs=require(_0x1f0f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f0f('0x8'));var squel=require(_0x1f0f('0x9'));var crypto=require(_0x1f0f('0xa'));var jsforce=require(_0x1f0f('0xb'));var deskjs=require(_0x1f0f('0xc'));var toCsv=require(_0x1f0f('0x6'));var querystring=require(_0x1f0f('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1f0f('0xe'));var qs=require(_0x1f0f('0xf'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x1f0f('0x10'));var hardwareService=require(_0x1f0f('0x11'));var logger=require(_0x1f0f('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x1f0f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1f0f('0x14'))['db'];config[_0x1f0f('0x15')]=_[_0x1f0f('0x16')](config[_0x1f0f('0x15')],{'host':_0x1f0f('0x17'),'port':0x18eb});var socket=require(_0x1f0f('0x18'))(new Redis(config[_0x1f0f('0x15')]));require(_0x1f0f('0x19'))[_0x1f0f('0x1a')](socket);function respondWithStatusCode(_0xd7d436,_0x1cb810){_0x1cb810=_0x1cb810||0xcc;return function(_0x392ce2){if(_0x392ce2){return _0xd7d436[_0x1f0f('0x1b')](_0x1cb810);}return _0xd7d436[_0x1f0f('0x1c')](_0x1cb810)[_0x1f0f('0x1d')]();};}function respondWithResult(_0x4abdc4,_0x96bafe){_0x96bafe=_0x96bafe||0xc8;return function(_0x22d72c){if(_0x22d72c){return _0x4abdc4[_0x1f0f('0x1c')](_0x96bafe)[_0x1f0f('0x1e')](_0x22d72c);}};}function respondWithFilteredResult(_0x257f1a,_0x7a8297){return function(_0x1bd19e){if(_0x1bd19e){var _0x2b4fb3=typeof _0x7a8297['offset']==='undefined'&&typeof _0x7a8297[_0x1f0f('0x1f')]===_0x1f0f('0x20');var _0x52db3b=_0x1bd19e['count'];var _0x33d317=_0x2b4fb3?0x0:_0x7a8297[_0x1f0f('0x21')];var _0x326caf=_0x2b4fb3?_0x1bd19e['count']:_0x7a8297[_0x1f0f('0x21')]+_0x7a8297[_0x1f0f('0x1f')];var _0x1d9a45;if(_0x326caf>=_0x52db3b){_0x326caf=_0x52db3b;_0x1d9a45=0xc8;}else{_0x1d9a45=0xce;}_0x257f1a[_0x1f0f('0x1c')](_0x1d9a45);return _0x257f1a[_0x1f0f('0x22')](_0x1f0f('0x23'),_0x33d317+'-'+_0x326caf+'/'+_0x52db3b)[_0x1f0f('0x1e')](_0x1bd19e);}return null;};}function patchUpdates(_0x45cabd){return function(_0x286cd3){try{jsonpatch[_0x1f0f('0x24')](_0x286cd3,_0x45cabd,!![]);}catch(_0x152887){return BPromise[_0x1f0f('0x25')](_0x152887);}return _0x286cd3['save']();};}function saveUpdates(_0x7ab0cd,_0x44f460){return function(_0xca1b4a){if(_0xca1b4a){return _0xca1b4a['update'](_0x7ab0cd)[_0x1f0f('0x26')](function(_0x163ed2){return _0x163ed2;});}return null;};}function removeEntity(_0x415bad,_0x464c57){return function(_0x5ab5fc){if(_0x5ab5fc){return _0x5ab5fc[_0x1f0f('0x27')]()[_0x1f0f('0x26')](function(){_0x415bad[_0x1f0f('0x1c')](0xcc)[_0x1f0f('0x1d')]();});}};}function handleEntityNotFound(_0x3ce818,_0x17fa03){return function(_0x5c265f){if(!_0x5c265f){_0x3ce818[_0x1f0f('0x1b')](0x194);}return _0x5c265f;};}function handleError(_0x153d47,_0x380b36){_0x380b36=_0x380b36||0x1f4;return function(_0xc959a6){logger[_0x1f0f('0x28')](_0xc959a6[_0x1f0f('0x29')]);if(_0xc959a6[_0x1f0f('0x2a')]){delete _0xc959a6[_0x1f0f('0x2a')];}_0x153d47[_0x1f0f('0x1c')](_0x380b36)['send'](_0xc959a6);};}function getInteractionUsers(_0x36002c,_0xf6cb9d){return new BPromise(function(_0x19aee2,_0xd782cd){try{if(_0xf6cb9d[_0x36002c['id']]){_0x36002c['Users']=_[_0x1f0f('0x2b')](_0xf6cb9d[_0x36002c['id']],function(_0x470778){return{'id':_0x470778['id'],'fullname':_0x470778[_0x1f0f('0x2c')]};});}}catch(_0x1e45c0){_0xd782cd(_0x1e45c0);}_0x19aee2(_0x36002c);});}function getInteractionTags(_0x2d2599,_0xe8c133){return new BPromise(function(_0x4bcff0,_0x17bb6c){try{if(_0x2d2599[_0x1f0f('0x2d')]){_0x2d2599[_0x1f0f('0x2e')]=[];_0x2d2599[_0x1f0f('0x2d')][_0x1f0f('0x2f')](',')['forEach'](function(_0x40a645){_0x2d2599['Tags'][_0x1f0f('0x30')](_0xe8c133[_0x40a645]);});}delete _0x2d2599[_0x1f0f('0x2d')];}catch(_0x54d6c9){_0x17bb6c(_0x54d6c9);}_0x4bcff0(_0x2d2599);});}function updateWhatsappInteraction(_0x500121,_0x4d6975,_0x5941b5){return new BPromise(function(_0x463432,_0x145854){return getInteractionUsers(_0x500121,_0x5941b5)[_0x1f0f('0x26')](function(_0x5cbe80){return getInteractionTags(_0x5cbe80,_0x4d6975);})['then'](function(_0x1d9867){return getStateInteraction(_0x1d9867);})[_0x1f0f('0x26')](function(_0x3a4786){_0x463432(_0x3a4786);})[_0x1f0f('0x31')](function(_0x4a222a){_0x145854(_0x4a222a);});});}function getStateInteraction(_0x25022c){return new BPromise(function(_0x3f8877){_0x25022c[_0x1f0f('0x32')]=0x0;_0x25022c[_0x1f0f('0x33')]=0x0;_0x25022c[_0x1f0f('0x34')]=0x0;_0x25022c[_0x1f0f('0x35')]=0x0;_0x25022c[_0x1f0f('0x36')]=0x0;if(!_0x25022c[_0x1f0f('0x37')]&&!_0x25022c[_0x1f0f('0x38')]){_0x25022c[_0x1f0f('0x32')]+=0x1;}if(!_0x25022c['closed']&&_0x25022c[_0x1f0f('0x38')]){_0x25022c[_0x1f0f('0x33')]+=0x1;if(_0x25022c['waiting']){_0x25022c[_0x1f0f('0x32')]-=0x1;}}if(_0x25022c[_0x1f0f('0x37')]&&_0x25022c['UserId']){_0x25022c['answered']+=0x1;if(_0x25022c[_0x1f0f('0x33')]){_0x25022c[_0x1f0f('0x33')]-=0x1;}}if(_0x25022c['closed']&&!_0x25022c[_0x1f0f('0x38')]){_0x25022c[_0x1f0f('0x35')]+=0x1;if(_0x25022c[_0x1f0f('0x32')]){_0x25022c[_0x1f0f('0x32')]-=0x1;}}_0x25022c['total']+=0x1;_0x3f8877(_0x25022c);});}exports[_0x1f0f('0x39')]=function(_0x3584c9,_0x3c1102){var _0x2b45ae={},_0x34ef0a={},_0xbd3953={'count':0x0,'rows':[]};var _0x5c0f54=_['map'](db['WhatsappInteraction'][_0x1f0f('0x3a')],function(_0x48efc8){return{'name':_0x48efc8[_0x1f0f('0x3b')],'type':_0x48efc8[_0x1f0f('0x3c')]['key']};});_0x34ef0a[_0x1f0f('0x3d')]=_['map'](_0x5c0f54,_0x1f0f('0x2a'));_0x34ef0a[_0x1f0f('0x3e')]=_[_0x1f0f('0x3f')](_0x3584c9[_0x1f0f('0x3e')]);_0x34ef0a[_0x1f0f('0x40')]=_[_0x1f0f('0x41')](_0x34ef0a[_0x1f0f('0x3d')],_0x34ef0a[_0x1f0f('0x3e')]);_0x2b45ae[_0x1f0f('0x42')]=_['intersection'](_0x34ef0a[_0x1f0f('0x3d')],qs[_0x1f0f('0x43')](_0x3584c9[_0x1f0f('0x3e')][_0x1f0f('0x43')]));_0x2b45ae[_0x1f0f('0x42')]=_0x2b45ae['attributes']['length']?_0x2b45ae['attributes']:_0x34ef0a['model'];if(!_0x3584c9[_0x1f0f('0x3e')]['hasOwnProperty'](_0x1f0f('0x44'))){_0x2b45ae[_0x1f0f('0x1f')]=qs[_0x1f0f('0x1f')](_0x3584c9['query'][_0x1f0f('0x1f')]);_0x2b45ae[_0x1f0f('0x21')]=qs[_0x1f0f('0x21')](_0x3584c9['query'][_0x1f0f('0x21')]);}_0x2b45ae[_0x1f0f('0x45')]=qs[_0x1f0f('0x46')](_0x3584c9['query'][_0x1f0f('0x46')]);_0x2b45ae[_0x1f0f('0x47')]=qs[_0x1f0f('0x40')](_[_0x1f0f('0x48')](_0x3584c9[_0x1f0f('0x3e')],_0x34ef0a[_0x1f0f('0x40')]),_0x5c0f54);var _0xe567f=[];var _0x314359=squel[_0x1f0f('0x49')]()[_0x1f0f('0x4a')]('id')[_0x1f0f('0x4a')](_0x1f0f('0x2a'))[_0x1f0f('0x4a')](_0x1f0f('0x4b'))[_0x1f0f('0x4c')](_0x1f0f('0x4d'));var _0x5d8304=squel['select']()[_0x1f0f('0x4a')](_0x1f0f('0x4e'))[_0x1f0f('0x4a')](_0x1f0f('0x4f'))[_0x1f0f('0x4a')](_0x1f0f('0x50'))[_0x1f0f('0x4c')](_0x1f0f('0x51'),'ui')[_0x1f0f('0x52')](_0x1f0f('0x53'),'u',_0x1f0f('0x54'));var _0x164b2e=squel[_0x1f0f('0x49')]()[_0x1f0f('0x4c')](_0x1f0f('0x55'),'i')[_0x1f0f('0x52')](_0x1f0f('0x56'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x1f0f('0x52')]('users','o','o.id\x20=\x20i.UserId')['left_join'](_0x1f0f('0x57'),'a',_0x1f0f('0x58'))[_0x1f0f('0x52')](_0x1f0f('0x59'),'me',_0x1f0f('0x5a'))[_0x1f0f('0x52')](_0x1f0f('0x5b'),'it',_0x1f0f('0x5c'))[_0x1f0f('0x52')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x27f229=squel[_0x1f0f('0x5d')]();var _0x36201d=[];var _0x63a5ea=squel[_0x1f0f('0x5d')]();var _0x542189;if(_0x3584c9[_0x1f0f('0x3e')][_0x1f0f('0x5e')]){_0x542189=as[_0x1f0f('0x5f')](_0x3584c9[_0x1f0f('0x3e')][_0x1f0f('0x5e')]);var _0x308f17=_0x542189['sqlOperator'];for(var _0x37e96f=0x0;_0x37e96f<_0x542189['conditions'][_0x1f0f('0x60')];_0x37e96f++){var _0x4bb041=_0x542189[_0x1f0f('0x61')][_0x37e96f];var _0x2a9a9e='i';var _0x5a2ec1=_[_0x1f0f('0x62')](_0x5c0f54,[_0x1f0f('0x2a'),_0x4bb041[_0x1f0f('0x4a')]]);if(!_0x5a2ec1){switch(_0x4bb041[_0x1f0f('0x4a')]){case _0x1f0f('0x63'):if(_0x4bb041['value']==0x1){_0x164b2e['having']('`'+_0x4bb041[_0x1f0f('0x4a')]+_0x1f0f('0x64'));}else{_0x164b2e['having']('`'+_0x4bb041['field']+_0x1f0f('0x65'));}break;case'Contact':if(_0x4bb041[_0x1f0f('0x66')]===_0x1f0f('0x67')){if(_0x4bb041[_0x1f0f('0x68')]['split']('\x20')[_0x1f0f('0x60')]>0x1){_0x27f229[_0x308f17]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4bb041['value']),null);}else{var _0x4a1cc4='%'+_0x4bb041['value']+'%';_0x27f229[_0x308f17](_0x1f0f('0x69'),_0x4a1cc4,_0x4a1cc4,_0x4a1cc4);}}else{_0x5a2ec1=_['find'](_0x5c0f54,[_0x1f0f('0x2a'),_0x1f0f('0x6a')]);_0x4bb041[_0x1f0f('0x4a')]=_0x1f0f('0x6a');_0x45af7f=as[_0x1f0f('0x6b')](_0x2a9a9e,_0x5a2ec1[_0x1f0f('0x3c')],_0x4bb041);_0x27f229[_0x308f17](_0x45af7f[_0x1f0f('0x6c')],_0x45af7f[_0x1f0f('0x68')][_0x1f0f('0x6d')],_0x45af7f[_0x1f0f('0x68')][_0x1f0f('0x1d')]);}break;case _0x1f0f('0x6e'):var _0x5a8d5f=_0x4bb041[_0x1f0f('0x68')][_0x1f0f('0x2f')](',')['map'](function(_0x4db96e){return Number(_0x4db96e);});_0x5a8d5f[_0x1f0f('0x6f')](function(_0x43f690){_0x63a5ea['or'](_0x1f0f('0x70'),'%,'+_0x43f690+',%');});_0x36201d=_['union'](_0x36201d,_0x5a8d5f);break;case _0x1f0f('0x71'):if(_0x4bb041[_0x1f0f('0x66')]===_0x1f0f('0x67')){_0x27f229[_0x308f17](_0x1f0f('0x72'),'%'+_0x4bb041[_0x1f0f('0x68')]+'%',null);}else{_0x5a2ec1=_[_0x1f0f('0x62')](_0x5c0f54,['name',_0x1f0f('0x38')]);_0x4bb041[_0x1f0f('0x4a')]=_0x1f0f('0x38');_0x45af7f=as[_0x1f0f('0x6b')](_0x2a9a9e,_0x5a2ec1['type'],_0x4bb041);_0x27f229[_0x308f17](_0x45af7f[_0x1f0f('0x6c')],_0x45af7f['value']['start'],_0x45af7f['value'][_0x1f0f('0x1d')]);}break;case _0x1f0f('0x73'):_0x45af7f=as[_0x1f0f('0x6b')]('me',null,_0x4bb041);_0x27f229[_0x308f17](_0x45af7f[_0x1f0f('0x6c')],_0x45af7f[_0x1f0f('0x68')][_0x1f0f('0x6d')],_0x45af7f[_0x1f0f('0x68')]['end']);break;}}else{var _0x45af7f=as[_0x1f0f('0x6b')](_0x2a9a9e,_0x5a2ec1[_0x1f0f('0x3c')],_0x4bb041);_0x27f229[_0x308f17](_0x45af7f[_0x1f0f('0x6c')],_0x45af7f[_0x1f0f('0x68')][_0x1f0f('0x6d')],_0x45af7f['value'][_0x1f0f('0x1d')]);}}}else{var _0x302ed6=_(_0x3584c9[_0x1f0f('0x3e')])[_0x1f0f('0x3f')]()[_0x1f0f('0x2b')](function(_0x50a946){return _['some'](_0x5c0f54,[_0x1f0f('0x2a'),_0x50a946])?_0x50a946:undefined;})[_0x1f0f('0x74')]()[_0x1f0f('0x68')]();if(!_['isEmpty'](_0x302ed6)){_0x302ed6[_0x1f0f('0x6f')](function(_0x4ec691){if(_0x4ec691===_0x1f0f('0x75')){_0x164b2e['where'](_0x1f0f('0x76'),[][_0x1f0f('0x77')](_0x3584c9[_0x1f0f('0x3e')][_0x4ec691]));}else if(_0x4ec691===_0x1f0f('0x78')){var _0x1a2c71=JSON[_0x1f0f('0x79')](_0x3584c9['query'][_0x4ec691])[_0x1f0f('0x7a')];var _0x475699=JSON[_0x1f0f('0x79')](_0x3584c9[_0x1f0f('0x3e')][_0x4ec691])[_0x1f0f('0x7b')];_0x164b2e['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1a2c71,_0x475699);}else{if(_0x3584c9[_0x1f0f('0x3e')][_0x4ec691]===_0x1f0f('0x7c')){_0x164b2e[_0x1f0f('0x47')]('i.'+_0x4ec691+'\x20IS\x20NULL');}else{_0x164b2e[_0x1f0f('0x47')]('i.'+_0x4ec691+_0x1f0f('0x7d'),_0x3584c9[_0x1f0f('0x3e')][_0x4ec691]);}}});}if(_0x3584c9['query'][_0x1f0f('0x7e')]){if(_0x3584c9[_0x1f0f('0x3e')][_0x1f0f('0x7e')]==0x1){_0x164b2e[_0x1f0f('0x7f')](_0x1f0f('0x80'));}else{_0x164b2e[_0x1f0f('0x7f')]('`unreadMessages`\x20>\x200');}}if(_0x3584c9[_0x1f0f('0x3e')][_0x1f0f('0x81')]){_0x36201d=_[_0x1f0f('0x82')](_0x3584c9[_0x1f0f('0x3e')]['tag'])?_0x3584c9[_0x1f0f('0x3e')][_0x1f0f('0x81')]:new Array(_0x3584c9['query']['tag']);_0x36201d['forEach'](function(_0x6b2120){_0x63a5ea['or'](_0x1f0f('0x70'),'%,'+_0x6b2120+',%');});}if(_0x3584c9['query'][_0x1f0f('0x83')]){var _0x4fe92a=_0x3584c9[_0x1f0f('0x3e')][_0x1f0f('0x83')][_0x1f0f('0x84')]('\x5c','\x5c\x5c')[_0x1f0f('0x84')](/'/g,'\x27\x27');if(qs[_0x1f0f('0x85')](_0x4fe92a)){_0x27f229['or']('i.id\x20LIKE\x20?',_0x4fe92a+'%')['or'](_0x1f0f('0x86'),_0x4fe92a+'%');}else{_0x27f229['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1f0f('0x87')](_0x4fe92a))['or'](_0x1f0f('0x88'),_0x4fe92a+'%');}}}_0x164b2e[_0x1f0f('0x47')](_0x27f229);_0x164b2e['group'](_0x1f0f('0x89'));var _0x2c2b69={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};var _0x49e74c=_0x164b2e[_0x1f0f('0x8a')]();_0x49e74c[_0x1f0f('0x4a')](_0x1f0f('0x89'));_0x49e74c[_0x1f0f('0x4a')](_0x1f0f('0x8b'),_0x1f0f('0x63'));if(_0x2b45ae[_0x1f0f('0x45')]){_0x2b45ae['order'][_0x1f0f('0x6f')](function(_0x4ec457){var _0x1852fb=_0x4ec457[0x0]==='contactName'?_0x4ec457[0x0]:'i.'+_0x4ec457[0x0];_0x164b2e[_0x1f0f('0x45')](_0x1852fb,_0x4ec457[0x1]===_0x1f0f('0x8c')?![]:!![]);});}if(!_['isEmpty'](_0x36201d)){_0x164b2e['having'](_0x63a5ea);_0x49e74c['where'](_0x1f0f('0x8d'),_0x36201d);}BPromise[_0x1f0f('0x8e')]()[_0x1f0f('0x26')](function(){if(!_0x542189){if(_0x3584c9['query'][_0x1f0f('0x75')])return;_0x49e74c[_0x1f0f('0x47')](_0x1f0f('0x8f'));_0x164b2e['where'](_0x1f0f('0x8f'));return;}if(_0x3584c9[_0x1f0f('0x90')][_0x1f0f('0x91')]!=='agent')return;return _0x3584c9['user'][_0x1f0f('0x92')]({'attributes':['id'],'raw':!![]})[_0x1f0f('0x26')](function(_0x25c47){if(_[_0x1f0f('0x93')](_0x25c47)){_0x49e74c[_0x1f0f('0x47')]('i.WhatsappAccountId\x20IS\x20NULL');_0x164b2e[_0x1f0f('0x47')](_0x1f0f('0x94'));}else{_0x49e74c[_0x1f0f('0x47')](_0x1f0f('0x76'),_['map'](_0x25c47,'id'));_0x164b2e[_0x1f0f('0x47')](_0x1f0f('0x76'),_['map'](_0x25c47,'id'));}});})[_0x1f0f('0x26')](function(){if(_0x3584c9[_0x1f0f('0x90')][_0x1f0f('0x91')]==='agent'&&!_0x542189&&!_0x3584c9[_0x1f0f('0x3e')]['WhatsappAccountId'])return[];return db[_0x1f0f('0x95')][_0x1f0f('0x3e')](_0x49e74c[_0x1f0f('0x96')](),_0x2c2b69);})[_0x1f0f('0x26')](function(_0x363565){_0xbd3953[_0x1f0f('0x97')]=_0x363565[_0x1f0f('0x60')];if(_0xbd3953[_0x1f0f('0x97')]===0x0)return[];return db['sequelize'][_0x1f0f('0x3e')](_0x314359['toString'](),_0x2c2b69)['then'](function(_0x32e273){_0xe567f=_[_0x1f0f('0x98')](_0x32e273,'id');_0x2c2b69=_[_0x1f0f('0x99')](_0x2c2b69,{'model':db[_0x1f0f('0x9a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3584c9[_0x1f0f('0x3e')][_0x1f0f('0x43')]){_0x2b45ae[_0x1f0f('0x42')][_0x1f0f('0x6f')](function(_0x1e40de){_0x164b2e[_0x1f0f('0x4a')]('i.'+_0x1e40de);});}else{_0x164b2e[_0x1f0f('0x4a')](_0x1f0f('0x8b'),'unreadMessages');_0x164b2e[_0x1f0f('0x4a')](_0x1f0f('0x9b'),_0x1f0f('0x9c'));_0x164b2e[_0x1f0f('0x4a')]('a.mandatoryDisposition',_0x1f0f('0x9d'));_0x164b2e[_0x1f0f('0x4a')](_0x1f0f('0x9e'),'contactName');_0x164b2e[_0x1f0f('0x4a')](_0x1f0f('0x9f'));_0x164b2e['field'](_0x1f0f('0xa0'),_0x1f0f('0xa1'));_0x164b2e['field']('c.lastName',_0x1f0f('0xa2'));_0x164b2e['field'](_0x1f0f('0xa3'),_0x1f0f('0xa4'));_0x164b2e['field']('c.phone','Contact.phone');_0x164b2e[_0x1f0f('0x4a')](_0x1f0f('0xa5'),_0x1f0f('0xa6'));_0x164b2e[_0x1f0f('0x4a')](_0x1f0f('0xa7'),_0x1f0f('0xa8'));_0x164b2e[_0x1f0f('0x4a')]('o.fullname',_0x1f0f('0xa9'));_0x164b2e[_0x1f0f('0x4a')](_0x1f0f('0xaa'),_0x1f0f('0xab'));_0x164b2e[_0x1f0f('0x4a')](_0x1f0f('0xac'),'TagIds');}if(_0x2b45ae[_0x1f0f('0x1f')])_0x164b2e[_0x1f0f('0x1f')](_0x2b45ae['limit']);if(_0x2b45ae[_0x1f0f('0x21')])_0x164b2e[_0x1f0f('0x21')](_0x2b45ae[_0x1f0f('0x21')]);return db[_0x1f0f('0x95')][_0x1f0f('0x3e')](_0x164b2e[_0x1f0f('0x96')](),_0x2c2b69);})[_0x1f0f('0x26')](function(_0x335159){if(_0x335159[_0x1f0f('0x60')]>0x0)_0x5d8304[_0x1f0f('0x47')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0x1f0f('0x2b')](_0x335159,'id'));return db[_0x1f0f('0x95')]['query'](_0x5d8304[_0x1f0f('0x96')](),_0x2c2b69)['then'](function(_0xed3d19){var _0x108ea3=_[_0x1f0f('0xad')](_0xed3d19,_0x1f0f('0xae'));var _0x450603=[];_0x335159[_0x1f0f('0x6f')](function(_0x1a9061){_0x450603[_0x1f0f('0x30')](updateWhatsappInteraction(_0x1a9061,_0xe567f,_0x108ea3));});return BPromise[_0x1f0f('0xaf')](_0x450603);});});})[_0x1f0f('0x26')](function(_0x162244){_0xbd3953[_0x1f0f('0xb0')]=_0x162244;return _0xbd3953;})[_0x1f0f('0x26')](respondWithFilteredResult(_0x3c1102,_0x2b45ae))[_0x1f0f('0x31')](handleError(_0x3c1102,null));};exports[_0x1f0f('0xb1')]=function(_0x1fa42b,_0x1b57ec){var _0x2884c0={'raw':![],'where':{'id':_0x1fa42b[_0x1f0f('0xb2')]['id']}},_0x45108d={};_0x45108d['model']=_[_0x1f0f('0x3f')](db['WhatsappInteraction']['rawAttributes']);_0x45108d[_0x1f0f('0x3e')]=_[_0x1f0f('0x3f')](_0x1fa42b[_0x1f0f('0x3e')]);_0x45108d['filters']=_[_0x1f0f('0x41')](_0x45108d[_0x1f0f('0x3d')],_0x45108d['query']);_0x2884c0[_0x1f0f('0x42')]=_[_0x1f0f('0x41')](_0x45108d['model'],qs[_0x1f0f('0x43')](_0x1fa42b[_0x1f0f('0x3e')][_0x1f0f('0x43')]));_0x2884c0[_0x1f0f('0x42')]=_0x2884c0[_0x1f0f('0x42')][_0x1f0f('0x60')]?_0x2884c0[_0x1f0f('0x42')]:_0x45108d[_0x1f0f('0x3d')];if(_0x1fa42b[_0x1f0f('0x3e')][_0x1f0f('0xb3')]){_0x2884c0['include']=[{'all':!![]}];}_0x2884c0=_[_0x1f0f('0x99')]({},_0x2884c0,_0x1fa42b[_0x1f0f('0xb4')]);return db[_0x1f0f('0x9a')][_0x1f0f('0x62')](_0x2884c0)[_0x1f0f('0x26')](handleEntityNotFound(_0x1b57ec,null))[_0x1f0f('0x26')](respondWithResult(_0x1b57ec,null))[_0x1f0f('0x31')](handleError(_0x1b57ec,null));};exports['create']=function(_0x5bff12,_0x432dec){return db[_0x1f0f('0x9a')]['create'](_0x5bff12[_0x1f0f('0x73')],{})['then'](respondWithResult(_0x432dec,0xc9))[_0x1f0f('0x31')](handleError(_0x432dec,null));};exports[_0x1f0f('0xb5')]=function(_0x391211,_0x3ee49e){if(_0x391211[_0x1f0f('0x73')]['id']){delete _0x391211[_0x1f0f('0x73')]['id'];}return db[_0x1f0f('0x9a')]['find']({'where':{'id':_0x391211[_0x1f0f('0xb2')]['id']}})[_0x1f0f('0x26')](handleEntityNotFound(_0x3ee49e,null))[_0x1f0f('0x26')](saveUpdates(_0x391211[_0x1f0f('0x73')],null))[_0x1f0f('0x26')](respondWithResult(_0x3ee49e,null))[_0x1f0f('0x31')](handleError(_0x3ee49e,null));};exports[_0x1f0f('0x27')]=function(_0x1ff7c1,_0x1ae6e0){return db[_0x1f0f('0x9a')][_0x1f0f('0x62')]({'where':{'id':_0x1ff7c1[_0x1f0f('0xb2')]['id']}})['then'](handleEntityNotFound(_0x1ae6e0,null))[_0x1f0f('0x26')](removeEntity(_0x1ae6e0,null))[_0x1f0f('0x31')](handleError(_0x1ae6e0,null));};exports['describe']=function(_0x52102c,_0x133562){return db[_0x1f0f('0x9a')][_0x1f0f('0xb6')]()[_0x1f0f('0x26')](respondWithResult(_0x133562,null))[_0x1f0f('0x31')](handleError(_0x133562,null));};exports[_0x1f0f('0xb7')]=function(_0x359c84,_0x29f14c,_0xcd5f7f){return db[_0x1f0f('0xb8')][_0x1f0f('0x62')]({'where':{'id':_0x359c84[_0x1f0f('0xb2')]['id']}})['then'](handleEntityNotFound(_0x29f14c,null))['then'](function(_0x2a43d7){if(_0x2a43d7){return _0x2a43d7['addMessage'](_0x359c84[_0x1f0f('0x73')][_0x1f0f('0xb9')],_[_0x1f0f('0xba')](_0x359c84['body'],[_0x1f0f('0xb9'),'id'])||{});}})[_0x1f0f('0x26')](respondWithResult(_0x29f14c,null))[_0x1f0f('0x31')](handleError(_0x29f14c,null));};exports['getMessages']=function(_0x564799,_0x49b0d4,_0x368ed5){var _0xc1db01={'raw':![],'where':{}};var _0x268006={};var _0x247601={'count':0x0,'rows':[]};return db[_0x1f0f('0x9a')]['findOne']({'where':{'id':_0x564799['params']['id']}})['then'](handleEntityNotFound(_0x49b0d4,null))['then'](function(_0xdce5ae){if(_0xdce5ae){_0x268006[_0x1f0f('0x3d')]=_[_0x1f0f('0x3f')](db[_0x1f0f('0xb8')][_0x1f0f('0x3a')]);_0x268006[_0x1f0f('0x3e')]=_['keys'](_0x564799[_0x1f0f('0x3e')]);_0x268006[_0x1f0f('0x40')]=_[_0x1f0f('0x41')](_0x268006[_0x1f0f('0x3d')],_0x268006[_0x1f0f('0x3e')]);_0xc1db01[_0x1f0f('0x42')]=_[_0x1f0f('0x41')](_0x268006[_0x1f0f('0x3d')],qs[_0x1f0f('0x43')](_0x564799[_0x1f0f('0x3e')]['fields']));_0xc1db01['attributes']=_0xc1db01[_0x1f0f('0x42')][_0x1f0f('0x60')]?_0xc1db01['attributes']:_0x268006[_0x1f0f('0x3d')];if(!_0x564799[_0x1f0f('0x3e')]['hasOwnProperty'](_0x1f0f('0x44'))){_0xc1db01[_0x1f0f('0x1f')]=qs['limit'](_0x564799[_0x1f0f('0x3e')][_0x1f0f('0x1f')]);_0xc1db01[_0x1f0f('0x21')]=qs[_0x1f0f('0x21')](_0x564799[_0x1f0f('0x3e')][_0x1f0f('0x21')]);}_0xc1db01['order']=qs[_0x1f0f('0x46')](_0x564799['query'][_0x1f0f('0x46')]);_0xc1db01['where']=qs[_0x1f0f('0x40')](_[_0x1f0f('0x48')](_0x564799['query'],_0x268006[_0x1f0f('0x40')]));_0xc1db01[_0x1f0f('0x47')][_0x1f0f('0xae')]=_0xdce5ae['id'];if(_0x564799['query'][_0x1f0f('0x83')]){_0xc1db01[_0x1f0f('0x47')]=_[_0x1f0f('0x99')](_0xc1db01[_0x1f0f('0x47')],{'$or':_[_0x1f0f('0x2b')](_0xc1db01[_0x1f0f('0x42')],function(_0x42f692){var _0x3ef422={};_0x3ef422[_0x42f692]={'$like':'%'+_0x564799[_0x1f0f('0x3e')][_0x1f0f('0x83')]+'%'};return _0x3ef422;})});}if(_0x564799[_0x1f0f('0x3e')]['$gte']){var _0x2f9c32=_0x564799[_0x1f0f('0x3e')]['$gte'][_0x1f0f('0x2f')](',');var _0x37de92={};_0x37de92[_0x2f9c32[0x0]]={'$gte':moment(_0x2f9c32[0x1])[_0x1f0f('0xbb')](_0x1f0f('0xbc'))};_0xc1db01[_0x1f0f('0x47')]=_[_0x1f0f('0x99')](_0xc1db01['where'],_0x37de92);}_0xc1db01=_[_0x1f0f('0x99')]({},_0xc1db01,_0x564799[_0x1f0f('0xb4')]);return db[_0x1f0f('0xb8')][_0x1f0f('0x97')]({'where':_0xc1db01[_0x1f0f('0x47')]})[_0x1f0f('0x26')](function(_0x26b6e5){_0x247601[_0x1f0f('0x97')]=_0x26b6e5;if(_0x564799[_0x1f0f('0x3e')][_0x1f0f('0xb3')]){_0xc1db01[_0x1f0f('0xbd')]=[{'all':!![]}];}return db[_0x1f0f('0xb8')][_0x1f0f('0xbe')](_0xc1db01);})[_0x1f0f('0x26')](function(_0x5e2ea5){_0x247601['rows']=_0x5e2ea5;return _0x247601;});}})[_0x1f0f('0x26')](respondWithFilteredResult(_0x49b0d4,_0xc1db01))[_0x1f0f('0x31')](handleError(_0x49b0d4,null));};exports[_0x1f0f('0xbf')]=function(_0x265f20,_0x5c8c2e,_0x5aabe8){return db[_0x1f0f('0x9a')][_0x1f0f('0x62')]({'where':{'id':_0x265f20[_0x1f0f('0xb2')]['id']}})['then'](handleEntityNotFound(_0x5c8c2e,null))[_0x1f0f('0x26')](function(_0x509b63){if(_0x509b63){return _0x509b63[_0x1f0f('0xc0')](_0x265f20['body'][_0x1f0f('0xb9')],_['omit'](_0x265f20[_0x1f0f('0x73')],[_0x1f0f('0xb9'),'id'])||{})[_0x1f0f('0xc1')](function(){return db[_0x1f0f('0x6e')]['findAll']({'attributes':['id',_0x1f0f('0x2a'),_0x1f0f('0x4b')],'where':{'id':_0x265f20[_0x1f0f('0x73')][_0x1f0f('0xb9')]}});})[_0x1f0f('0x26')](function(_0x5a85c0){socket[_0x1f0f('0xc2')](_0x1f0f('0xc3'),{'id':Number(_0x265f20['params']['id']),'tags':_0x5a85c0||[]});return{'id':Number(_0x265f20[_0x1f0f('0xb2')]['id']),'tags':_0x5a85c0||[]};});}})[_0x1f0f('0x26')](respondWithResult(_0x5c8c2e,null))[_0x1f0f('0x31')](handleError(_0x5c8c2e,null));};exports[_0x1f0f('0xc4')]=function(_0x5db452,_0x18f458,_0x263d00){return db[_0x1f0f('0x9a')][_0x1f0f('0x62')]({'where':{'id':_0x5db452[_0x1f0f('0xb2')]['id']}})[_0x1f0f('0x26')](handleEntityNotFound(_0x18f458,null))[_0x1f0f('0x26')](function(_0x2aa0fa){if(_0x2aa0fa){return _0x2aa0fa['removeTags'](_0x5db452[_0x1f0f('0x3e')][_0x1f0f('0xb9')]);}})['then'](respondWithStatusCode(_0x18f458,null))[_0x1f0f('0x31')](handleError(_0x18f458,null));};exports['download']=function(_0x20d07e,_0x1b9437){var _0x45e5cb=moment()[_0x1f0f('0xc5')]()[_0x1f0f('0x96')]();var _0xeb463=path[_0x1f0f('0xc6')](config[_0x1f0f('0xc7')],_0x1f0f('0xc8'),_0x1f0f('0xc9'),_0x1f0f('0xca'));var _0x5dd6bf=path[_0x1f0f('0xc6')](config[_0x1f0f('0xc7')],_0x1f0f('0xc8'),_0x1f0f('0xc9'),_0x1f0f('0xcb'));var _0x4fa070=path[_0x1f0f('0xc6')](_0xeb463,_0x45e5cb);var _0x96ad37=util['format'](_0x1f0f('0xcc'),_0x20d07e['params']['id'],_0x45e5cb);var _0x27bfb1=path['join'](_0xeb463,_0x96ad37);var _0xb00863=[];_0xb00863[_0x1f0f('0x30')]({'model':db['User'],'as':_0x1f0f('0x71'),'attributes':['id',_0x1f0f('0x2c')],'raw':!![]});_0xb00863[_0x1f0f('0x30')]({'model':db['CmContact'],'as':_0x1f0f('0xcd'),'attributes':['id',_0x1f0f('0xce'),'lastName'],'raw':!![]});if(_0x20d07e[_0x1f0f('0x3e')][_0x1f0f('0xcb')]){_0xb00863[_0x1f0f('0x30')]({'model':db[_0x1f0f('0xcf')],'as':_0x1f0f('0xcf'),'raw':!![]});}var _0x2fdd81=[{'model':db[_0x1f0f('0xb8')],'as':'Messages','attributes':['id','body',_0x1f0f('0x78'),_0x1f0f('0xd0'),_0x1f0f('0xd1'),_0x1f0f('0x7e')],'include':_0xb00863}];_0x2fdd81['push']({'model':db['WhatsappAccount'],'as':_0x1f0f('0xd2'),'attributes':['id',_0x1f0f('0x2a')]});_0x2fdd81[_0x1f0f('0x30')]({'model':db[_0x1f0f('0x71')],'as':'Owner','attributes':['id',_0x1f0f('0x2c')]});return db[_0x1f0f('0x9a')]['find']({'where':{'id':_0x20d07e['params']['id']},'include':_0x2fdd81})[_0x1f0f('0x26')](handleEntityNotFound(_0x1b9437,null))['then'](function(_0x1b4bdc){if(_0x1b4bdc){var _0xc6da48=_0x1b4bdc[_0x1f0f('0xd3')]({'plain':!![]});fs[_0x1f0f('0xd4')](_0x4fa070);var _0xaef822={'channel':_0x1f0f('0xd5'),'account':_0xc6da48['Account']['name'],'agent':_0xc6da48[_0x1f0f('0xd6')]?_0xc6da48[_0x1f0f('0xd6')][_0x1f0f('0x2c')]:_0x1f0f('0xd7'),'createdAt':moment(_0xc6da48[_0x1f0f('0x78')])[_0x1f0f('0xbb')](_0x1f0f('0xbc'))['toString'](),'closedAt':_0xc6da48['closed']?moment(_0xc6da48[_0x1f0f('0xd8')])[_0x1f0f('0xbb')](_0x1f0f('0xbc'))['toString']():'','disposition':_0xc6da48['disposition'],'messages':_(_0xc6da48['Messages'])[_0x1f0f('0x83')]({'secret':![]})['map'](function(_0x41e6e4){if(_0x41e6e4[_0x1f0f('0xcf')]){var _0x5c1ae6=path[_0x1f0f('0xc6')](_0x5dd6bf,_0x41e6e4[_0x1f0f('0xcf')][_0x1f0f('0xd9')]);if(fs[_0x1f0f('0xda')](_0x5c1ae6)){fs[_0x1f0f('0xdb')](_0x5c1ae6)[_0x1f0f('0xdc')](fs[_0x1f0f('0xdd')](path[_0x1f0f('0xc6')](_0x4fa070,_0x41e6e4[_0x1f0f('0xcf')][_0x1f0f('0xd9')])));}}return{'date':moment(_0x41e6e4['createdAt'])[_0x1f0f('0xbb')](_0x1f0f('0xbc'))['toString'](),'sender':_0x41e6e4[_0x1f0f('0xd0')]==='out'?_0x41e6e4[_0x1f0f('0x71')]?_0x41e6e4[_0x1f0f('0x71')][_0x1f0f('0x2c')]:_0x1f0f('0xde'):_0x41e6e4['Contact'][_0x1f0f('0xce')]+(_0x41e6e4[_0x1f0f('0xcd')][_0x1f0f('0xdf')]?'\x20'+_0x41e6e4[_0x1f0f('0xcd')]['lastName']:''),'body':_0x41e6e4['Attachment']?_0x41e6e4[_0x1f0f('0xcf')][_0x1f0f('0xd9')]:_0x41e6e4[_0x1f0f('0x73')],'direction':_0x41e6e4[_0x1f0f('0xd0')]===_0x1f0f('0xe0')?'A':'C','secret':_0x41e6e4[_0x1f0f('0xd1')],'read':_0x41e6e4[_0x1f0f('0x7e')],'attachment':_0x41e6e4[_0x1f0f('0xcf')]};})['value']()};return ejs[_0x1f0f('0xe1')](path[_0x1f0f('0xc6')](config['root'],_0x1f0f('0xc8'),_0x1f0f('0xe2'),'downloadInteraction.ejs'),{'interaction':_0xaef822})[_0x1f0f('0x26')](function(_0x2843f3){var _0x3ca7a5=path[_0x1f0f('0xc6')](_0x4fa070,_0x1f0f('0xe3')+_0xc6da48['id']+'-'+_0x45e5cb+'.pdf');var _0x3066d9={'path':_0x3ca7a5,'channel':_0x1f0f('0xd5'),'interactionId':_0xc6da48['id']};return pdf['createPdfFromHTML'](_0x2843f3,_0x3066d9);})['then'](function(){return new BPromise(function(_0x4b5602,_0x4e6d09){zipdir(_0x4fa070,{'saveTo':_0x27bfb1},function(_0x13188b,_0x456e36){if(_0x13188b)return _0x4e6d09(_0x13188b);return _0x4b5602(_0x456e36);});})['then'](function(){return new BPromise(function(_0x121a61,_0x5ae4ac){rimraf(_0x4fa070,function(_0x367654){if(_0x367654)_0x5ae4ac(_0x367654);return _0x121a61();});});})[_0x1f0f('0x26')](function(){return _0x1b9437[_0x1f0f('0xe4')](_0x27bfb1,_0x96ad37,function(_0x2533c0){if(_0x2533c0){console['log'](_0x1f0f('0xe5'),_0x2533c0);}else{fs[_0x1f0f('0xe6')](_0x27bfb1);}});});});}else{return _0x1b9437[_0x1f0f('0x1b')](0xc8);}})[_0x1f0f('0x31')](handleError(_0x1b9437,null));}; \ No newline at end of file +var _0xe820=['register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','name','send','Users','Tags','TagIds','split','forEach','catch','waiting','talking','answered','total','closed','UserId','unmanaged','index','map','WhatsappInteraction','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','merge','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','Owner.fullname','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','push','rows','show','params','includeAll','include','create','body','destroy','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','sort','$gte','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','omit','spread','emit','whatsappInteractionTags:save','removeTags','unix','root','server','files','join','attachments','format','transcript-%d-%s.zip','User','fullname','CmContact','firstName','lastName','Attachment','Messages','secret','WhatsappAccount','Account','Owner','get','mkdirSync','N.A.','basename','createWriteStream','direction','out','System','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','err','eml-format','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0xe820,0xd2));var _0x0e82=function(_0x3a3e57,_0x2bb6c6){_0x3a3e57=_0x3a3e57-0x0;var _0x1cd117=_0xe820[_0x3a3e57];return _0x1cd117;};'use strict';var emlformat=require(_0x0e82('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0e82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0e82('0x2'));var BPromise=require(_0x0e82('0x3'));var Mustache=require(_0x0e82('0x4'));var util=require('util');var path=require(_0x0e82('0x5'));var sox=require('sox');var csv=require(_0x0e82('0x6'));var ejs=require(_0x0e82('0x7'));var fs=require('fs');var fs_extra=require(_0x0e82('0x8'));var _=require(_0x0e82('0x9'));var squel=require(_0x0e82('0xa'));var crypto=require('crypto');var jsforce=require(_0x0e82('0xb'));var deskjs=require(_0x0e82('0xc'));var toCsv=require(_0x0e82('0x6'));var querystring=require(_0x0e82('0xd'));var Papa=require(_0x0e82('0xe'));var Redis=require('ioredis');var authService=require(_0x0e82('0xf'));var qs=require(_0x0e82('0x10'));var as=require(_0x0e82('0x11'));var pdf=require(_0x0e82('0x12'));var hardwareService=require(_0x0e82('0x13'));var logger=require(_0x0e82('0x14'))(_0x0e82('0x15'));var utils=require('../../config/utils');var config=require(_0x0e82('0x16'));var licenseUtil=require(_0x0e82('0x17'));var db=require(_0x0e82('0x18'))['db'];config[_0x0e82('0x19')]=_[_0x0e82('0x1a')](config[_0x0e82('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x0e82('0x1b'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x0e82('0x1c')](socket);function respondWithStatusCode(_0x4b748a,_0x5b4ffd){_0x5b4ffd=_0x5b4ffd||0xcc;return function(_0x5a2d28){if(_0x5a2d28){return _0x4b748a[_0x0e82('0x1d')](_0x5b4ffd);}return _0x4b748a['status'](_0x5b4ffd)['end']();};}function respondWithResult(_0x1149b1,_0x582f45){_0x582f45=_0x582f45||0xc8;return function(_0x319303){if(_0x319303){return _0x1149b1[_0x0e82('0x1e')](_0x582f45)[_0x0e82('0x1f')](_0x319303);}};}function respondWithFilteredResult(_0x315ce4,_0x53622b){return function(_0x25ac21){if(_0x25ac21){var _0x310aac=typeof _0x53622b[_0x0e82('0x20')]===_0x0e82('0x21')&&typeof _0x53622b[_0x0e82('0x22')]===_0x0e82('0x21');var _0x278bcd=_0x25ac21[_0x0e82('0x23')];var _0xc9f7ac=_0x310aac?0x0:_0x53622b[_0x0e82('0x20')];var _0x5903c=_0x310aac?_0x25ac21['count']:_0x53622b['offset']+_0x53622b[_0x0e82('0x22')];var _0x2781de;if(_0x5903c>=_0x278bcd){_0x5903c=_0x278bcd;_0x2781de=0xc8;}else{_0x2781de=0xce;}_0x315ce4[_0x0e82('0x1e')](_0x2781de);return _0x315ce4[_0x0e82('0x24')](_0x0e82('0x25'),_0xc9f7ac+'-'+_0x5903c+'/'+_0x278bcd)[_0x0e82('0x1f')](_0x25ac21);}return null;};}function patchUpdates(_0x39fcbe){return function(_0x2688f9){try{jsonpatch['apply'](_0x2688f9,_0x39fcbe,!![]);}catch(_0x1b71b4){return BPromise[_0x0e82('0x26')](_0x1b71b4);}return _0x2688f9[_0x0e82('0x27')]();};}function saveUpdates(_0x24f883,_0x507f08){return function(_0xee85dd){if(_0xee85dd){return _0xee85dd[_0x0e82('0x28')](_0x24f883)[_0x0e82('0x29')](function(_0x16e11c){return _0x16e11c;});}return null;};}function removeEntity(_0x4900d3,_0x1ef751){return function(_0x51dbcd){if(_0x51dbcd){return _0x51dbcd['destroy']()[_0x0e82('0x29')](function(){_0x4900d3[_0x0e82('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19b96d,_0xe3c530){return function(_0x149e7e){if(!_0x149e7e){_0x19b96d['sendStatus'](0x194);}return _0x149e7e;};}function handleError(_0x93d2f1,_0x25fa4e){_0x25fa4e=_0x25fa4e||0x1f4;return function(_0x4ee65a){logger[_0x0e82('0x2a')](_0x4ee65a['stack']);if(_0x4ee65a[_0x0e82('0x2b')]){delete _0x4ee65a[_0x0e82('0x2b')];}_0x93d2f1['status'](_0x25fa4e)[_0x0e82('0x2c')](_0x4ee65a);};}function getInteractionUsers(_0x268af5,_0x661718){return new BPromise(function(_0x4d74d0,_0x50adb7){try{if(_0x661718[_0x268af5['id']]){_0x268af5[_0x0e82('0x2d')]=_['map'](_0x661718[_0x268af5['id']],function(_0x11211a){return{'id':_0x11211a['id'],'fullname':_0x11211a['fullname']};});}}catch(_0x1a3b2e){_0x50adb7(_0x1a3b2e);}_0x4d74d0(_0x268af5);});}function getInteractionTags(_0x264022,_0x44e177){return new BPromise(function(_0x56ca79,_0x45a40e){try{if(_0x264022['TagIds']){_0x264022[_0x0e82('0x2e')]=[];_0x264022[_0x0e82('0x2f')][_0x0e82('0x30')](',')[_0x0e82('0x31')](function(_0x44eefb){_0x264022[_0x0e82('0x2e')]['push'](_0x44e177[_0x44eefb]);});}delete _0x264022[_0x0e82('0x2f')];}catch(_0x132bc4){_0x45a40e(_0x132bc4);}_0x56ca79(_0x264022);});}function updateWhatsappInteraction(_0x34c914,_0x10d5ac,_0x3d222f){return new BPromise(function(_0x2a80e2,_0x399f16){return getInteractionUsers(_0x34c914,_0x3d222f)[_0x0e82('0x29')](function(_0xfd7924){return getInteractionTags(_0xfd7924,_0x10d5ac);})[_0x0e82('0x29')](function(_0x3ac1a5){return getStateInteraction(_0x3ac1a5);})[_0x0e82('0x29')](function(_0x244f3d){_0x2a80e2(_0x244f3d);})[_0x0e82('0x32')](function(_0x21dd97){_0x399f16(_0x21dd97);});});}function getStateInteraction(_0x5b95c8){return new BPromise(function(_0x18643f){_0x5b95c8[_0x0e82('0x33')]=0x0;_0x5b95c8[_0x0e82('0x34')]=0x0;_0x5b95c8[_0x0e82('0x35')]=0x0;_0x5b95c8['unmanaged']=0x0;_0x5b95c8[_0x0e82('0x36')]=0x0;if(!_0x5b95c8[_0x0e82('0x37')]&&!_0x5b95c8['UserId']){_0x5b95c8[_0x0e82('0x33')]+=0x1;}if(!_0x5b95c8['closed']&&_0x5b95c8['UserId']){_0x5b95c8[_0x0e82('0x34')]+=0x1;if(_0x5b95c8[_0x0e82('0x33')]){_0x5b95c8[_0x0e82('0x33')]-=0x1;}}if(_0x5b95c8[_0x0e82('0x37')]&&_0x5b95c8[_0x0e82('0x38')]){_0x5b95c8[_0x0e82('0x35')]+=0x1;if(_0x5b95c8[_0x0e82('0x34')]){_0x5b95c8['talking']-=0x1;}}if(_0x5b95c8['closed']&&!_0x5b95c8[_0x0e82('0x38')]){_0x5b95c8[_0x0e82('0x39')]+=0x1;if(_0x5b95c8[_0x0e82('0x33')]){_0x5b95c8[_0x0e82('0x33')]-=0x1;}}_0x5b95c8[_0x0e82('0x36')]+=0x1;_0x18643f(_0x5b95c8);});}exports[_0x0e82('0x3a')]=function(_0x2abed6,_0x339ffe){var _0x4e11b7={},_0x3ba181={},_0x8229ab={'count':0x0,'rows':[]};var _0x233a18=_[_0x0e82('0x3b')](db[_0x0e82('0x3c')][_0x0e82('0x3d')],function(_0x118e05){return{'name':_0x118e05['fieldName'],'type':_0x118e05[_0x0e82('0x3e')][_0x0e82('0x3f')]};});_0x3ba181[_0x0e82('0x40')]=_[_0x0e82('0x3b')](_0x233a18,_0x0e82('0x2b'));_0x3ba181[_0x0e82('0x41')]=_[_0x0e82('0x42')](_0x2abed6['query']);_0x3ba181['filters']=_['intersection'](_0x3ba181['model'],_0x3ba181['query']);_0x4e11b7['attributes']=_[_0x0e82('0x43')](_0x3ba181[_0x0e82('0x40')],qs[_0x0e82('0x44')](_0x2abed6[_0x0e82('0x41')][_0x0e82('0x44')]));_0x4e11b7[_0x0e82('0x45')]=_0x4e11b7[_0x0e82('0x45')][_0x0e82('0x46')]?_0x4e11b7['attributes']:_0x3ba181['model'];if(!_0x2abed6[_0x0e82('0x41')][_0x0e82('0x47')](_0x0e82('0x48'))){_0x4e11b7[_0x0e82('0x22')]=qs[_0x0e82('0x22')](_0x2abed6[_0x0e82('0x41')][_0x0e82('0x22')]);_0x4e11b7[_0x0e82('0x20')]=qs['offset'](_0x2abed6[_0x0e82('0x41')]['offset']);}_0x4e11b7[_0x0e82('0x49')]=qs['sort'](_0x2abed6[_0x0e82('0x41')]['sort']);_0x4e11b7[_0x0e82('0x4a')]=qs[_0x0e82('0x4b')](_[_0x0e82('0x4c')](_0x2abed6['query'],_0x3ba181['filters']),_0x233a18);var _0x331668=[];var _0x132c45=squel[_0x0e82('0x4d')]()['field']('id')[_0x0e82('0x4e')]('name')[_0x0e82('0x4e')](_0x0e82('0x4f'))[_0x0e82('0x50')](_0x0e82('0x51'));var _0x392608=squel[_0x0e82('0x4d')]()[_0x0e82('0x4e')](_0x0e82('0x52'))[_0x0e82('0x4e')](_0x0e82('0x53'))[_0x0e82('0x4e')](_0x0e82('0x54'))['from'](_0x0e82('0x55'),'ui')[_0x0e82('0x56')]('users','u',_0x0e82('0x57'));var _0x5f4fbc=squel['select']()[_0x0e82('0x50')]('whatsapp_interactions','i')[_0x0e82('0x56')](_0x0e82('0x58'),'c',_0x0e82('0x59'))[_0x0e82('0x56')](_0x0e82('0x5a'),'o','o.id\x20=\x20i.UserId')[_0x0e82('0x56')]('whatsapp_accounts','a',_0x0e82('0x5b'))[_0x0e82('0x56')](_0x0e82('0x5c'),'me',_0x0e82('0x5d'))[_0x0e82('0x56')]('whatsapp_interaction_has_tags','it',_0x0e82('0x5e'))[_0x0e82('0x56')](_0x0e82('0x51'),'t',_0x0e82('0x5f'));var _0x31b62f=squel['expr']();var _0x2274a0=[];var _0x348b00=squel[_0x0e82('0x60')]();var _0x1e6d69;if(_0x2abed6[_0x0e82('0x41')][_0x0e82('0x61')]){_0x1e6d69=as[_0x0e82('0x62')](_0x2abed6[_0x0e82('0x41')][_0x0e82('0x61')]);var _0x2852d4=_0x1e6d69['sqlOperator'];for(var _0x597ce7=0x0;_0x597ce7<_0x1e6d69['conditions'][_0x0e82('0x46')];_0x597ce7++){var _0x5c9313=_0x1e6d69[_0x0e82('0x63')][_0x597ce7];var _0x3b80aa='i';var _0x5d9632=_['find'](_0x233a18,[_0x0e82('0x2b'),_0x5c9313[_0x0e82('0x4e')]]);if(!_0x5d9632){switch(_0x5c9313[_0x0e82('0x4e')]){case _0x0e82('0x64'):if(_0x5c9313[_0x0e82('0x65')]==0x1){_0x5f4fbc[_0x0e82('0x66')]('`'+_0x5c9313[_0x0e82('0x4e')]+_0x0e82('0x67'));}else{_0x5f4fbc[_0x0e82('0x66')]('`'+_0x5c9313[_0x0e82('0x4e')]+'`\x20>\x200');}break;case _0x0e82('0x68'):if(_0x5c9313[_0x0e82('0x69')]===_0x0e82('0x6a')){if(_0x5c9313[_0x0e82('0x65')][_0x0e82('0x30')]('\x20')[_0x0e82('0x46')]>0x1){_0x31b62f[_0x2852d4](_0x0e82('0x6b'),qs[_0x0e82('0x6c')](_0x5c9313['value']),null);}else{var _0x19953f='%'+_0x5c9313[_0x0e82('0x65')]+'%';_0x31b62f[_0x2852d4](_0x0e82('0x6d'),_0x19953f,_0x19953f,_0x19953f);}}else{_0x5d9632=_[_0x0e82('0x6e')](_0x233a18,[_0x0e82('0x2b'),_0x0e82('0x6f')]);_0x5c9313[_0x0e82('0x4e')]=_0x0e82('0x6f');_0x3cf127=as[_0x0e82('0x70')](_0x3b80aa,_0x5d9632['type'],_0x5c9313);_0x31b62f[_0x2852d4](_0x3cf127[_0x0e82('0x71')],_0x3cf127['value'][_0x0e82('0x72')],_0x3cf127['value'][_0x0e82('0x73')]);}break;case _0x0e82('0x74'):var _0x5f3ec3=_0x5c9313[_0x0e82('0x65')][_0x0e82('0x30')](',')[_0x0e82('0x3b')](function(_0x2730fb){return Number(_0x2730fb);});_0x5f3ec3[_0x0e82('0x31')](function(_0x5a5a96){_0x348b00['or'](_0x0e82('0x75'),'%,'+_0x5a5a96+',%');});_0x2274a0=_['union'](_0x2274a0,_0x5f3ec3);break;case'User':if(_0x5c9313[_0x0e82('0x69')]===_0x0e82('0x6a')){_0x31b62f[_0x2852d4](_0x0e82('0x76'),'%'+_0x5c9313[_0x0e82('0x65')]+'%',null);}else{_0x5d9632=_[_0x0e82('0x6e')](_0x233a18,[_0x0e82('0x2b'),_0x0e82('0x38')]);_0x5c9313[_0x0e82('0x4e')]=_0x0e82('0x38');_0x3cf127=as[_0x0e82('0x70')](_0x3b80aa,_0x5d9632['type'],_0x5c9313);_0x31b62f[_0x2852d4](_0x3cf127['text'],_0x3cf127[_0x0e82('0x65')]['start'],_0x3cf127[_0x0e82('0x65')][_0x0e82('0x73')]);}break;case'body':_0x3cf127=as[_0x0e82('0x70')]('me',null,_0x5c9313);_0x31b62f[_0x2852d4](_0x3cf127[_0x0e82('0x71')],_0x3cf127['value'][_0x0e82('0x72')],_0x3cf127[_0x0e82('0x65')]['end']);break;}}else{var _0x3cf127=as['buildExpression'](_0x3b80aa,_0x5d9632[_0x0e82('0x3e')],_0x5c9313);_0x31b62f[_0x2852d4](_0x3cf127[_0x0e82('0x71')],_0x3cf127[_0x0e82('0x65')][_0x0e82('0x72')],_0x3cf127[_0x0e82('0x65')][_0x0e82('0x73')]);}}}else{var _0x1091af=_(_0x2abed6[_0x0e82('0x41')])[_0x0e82('0x42')]()[_0x0e82('0x3b')](function(_0x4b256f){return _[_0x0e82('0x77')](_0x233a18,['name',_0x4b256f])?_0x4b256f:undefined;})[_0x0e82('0x78')]()[_0x0e82('0x65')]();if(!_[_0x0e82('0x79')](_0x1091af)){_0x1091af['forEach'](function(_0x2818e0){if(_0x2818e0===_0x0e82('0x7a')){_0x5f4fbc[_0x0e82('0x4a')](_0x0e82('0x7b'),[][_0x0e82('0x7c')](_0x2abed6['query'][_0x2818e0]));}else if(_0x2818e0===_0x0e82('0x7d')){var _0x5e7655=JSON[_0x0e82('0x7e')](_0x2abed6[_0x0e82('0x41')][_0x2818e0])['$gte'];var _0x4fa290=JSON[_0x0e82('0x7e')](_0x2abed6[_0x0e82('0x41')][_0x2818e0])[_0x0e82('0x7f')];_0x5f4fbc[_0x0e82('0x4a')](_0x0e82('0x80'),_0x5e7655,_0x4fa290);}else{if(_0x2abed6[_0x0e82('0x41')][_0x2818e0]===_0x0e82('0x81')){_0x5f4fbc[_0x0e82('0x4a')]('i.'+_0x2818e0+_0x0e82('0x82'));}else{_0x5f4fbc['where']('i.'+_0x2818e0+_0x0e82('0x83'),_0x2abed6[_0x0e82('0x41')][_0x2818e0]);}}});}if(_0x2abed6['query']['read']){if(_0x2abed6['query'][_0x0e82('0x84')]==0x1){_0x5f4fbc[_0x0e82('0x66')](_0x0e82('0x85'));}else{_0x5f4fbc['having'](_0x0e82('0x86'));}}if(_0x2abed6['query'][_0x0e82('0x87')]){_0x2274a0=_[_0x0e82('0x88')](_0x2abed6[_0x0e82('0x41')][_0x0e82('0x87')])?_0x2abed6[_0x0e82('0x41')]['tag']:new Array(_0x2abed6[_0x0e82('0x41')][_0x0e82('0x87')]);_0x2274a0['forEach'](function(_0x2050b3){_0x348b00['or'](_0x0e82('0x75'),'%,'+_0x2050b3+',%');});}if(_0x2abed6[_0x0e82('0x41')]['filter']){var _0x2c6e71=_0x2abed6['query'][_0x0e82('0x89')][_0x0e82('0x8a')]('\x5c','\x5c\x5c')[_0x0e82('0x8a')](/'/g,'\x27\x27');if(qs[_0x0e82('0x8b')](_0x2c6e71)){_0x31b62f['or'](_0x0e82('0x8c'),_0x2c6e71+'%')['or'](_0x0e82('0x8d'),_0x2c6e71+'%');}else{_0x31b62f['or'](_0x0e82('0x8e'),qs[_0x0e82('0x6c')](_0x2c6e71))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2c6e71+'%');}}}_0x5f4fbc[_0x0e82('0x4a')](_0x31b62f);_0x5f4fbc[_0x0e82('0x8f')](_0x0e82('0x90'));var _0x23b069={'type':db[_0x0e82('0x91')]['QueryTypes'][_0x0e82('0x92')],'raw':!![]};var _0x4fadaa=_0x5f4fbc[_0x0e82('0x93')]();_0x4fadaa['field'](_0x0e82('0x90'));_0x4fadaa[_0x0e82('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0e82('0x64'));if(_0x4e11b7[_0x0e82('0x49')]){_0x4e11b7[_0x0e82('0x49')]['forEach'](function(_0x5777c2){var _0x593ab3=_0x5777c2[0x0]===_0x0e82('0x94')?_0x5777c2[0x0]:'i.'+_0x5777c2[0x0];_0x5f4fbc[_0x0e82('0x49')](_0x593ab3,_0x5777c2[0x1]===_0x0e82('0x95')?![]:!![]);});}if(!_['isEmpty'](_0x2274a0)){_0x5f4fbc[_0x0e82('0x66')](_0x348b00);_0x4fadaa[_0x0e82('0x4a')](_0x0e82('0x96'),_0x2274a0);}BPromise[_0x0e82('0x97')]()[_0x0e82('0x29')](function(){if(!_0x1e6d69){if(_0x2abed6[_0x0e82('0x41')][_0x0e82('0x7a')])return;_0x4fadaa[_0x0e82('0x4a')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x5f4fbc[_0x0e82('0x4a')](_0x0e82('0x98'));return;}if(_0x2abed6[_0x0e82('0x99')][_0x0e82('0x9a')]!==_0x0e82('0x9b'))return;return _0x2abed6[_0x0e82('0x99')][_0x0e82('0x9c')]({'attributes':['id'],'raw':!![]})[_0x0e82('0x29')](function(_0x5d09b2){if(_[_0x0e82('0x79')](_0x5d09b2)){_0x4fadaa['where']('i.WhatsappAccountId\x20IS\x20NULL');_0x5f4fbc['where'](_0x0e82('0x9d'));}else{_0x4fadaa[_0x0e82('0x4a')](_0x0e82('0x7b'),_[_0x0e82('0x3b')](_0x5d09b2,'id'));_0x5f4fbc['where'](_0x0e82('0x7b'),_['map'](_0x5d09b2,'id'));}});})[_0x0e82('0x29')](function(){if(_0x2abed6[_0x0e82('0x99')]['role']===_0x0e82('0x9b')&&!_0x1e6d69&&!_0x2abed6['query']['WhatsappAccountId'])return[];return db[_0x0e82('0x9e')][_0x0e82('0x41')](_0x4fadaa['toString'](),_0x23b069);})['then'](function(_0xaadfbe){_0x8229ab[_0x0e82('0x23')]=_0xaadfbe[_0x0e82('0x46')];if(_0x8229ab[_0x0e82('0x23')]===0x0)return[];return db[_0x0e82('0x9e')][_0x0e82('0x41')](_0x132c45[_0x0e82('0x9f')](),_0x23b069)[_0x0e82('0x29')](function(_0x579166){_0x331668=_['keyBy'](_0x579166,'id');_0x23b069=_[_0x0e82('0xa0')](_0x23b069,{'model':db[_0x0e82('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2abed6[_0x0e82('0x41')][_0x0e82('0x44')]){_0x4e11b7[_0x0e82('0x45')][_0x0e82('0x31')](function(_0x350b6c){_0x5f4fbc['field']('i.'+_0x350b6c);});}else{_0x5f4fbc[_0x0e82('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x5f4fbc[_0x0e82('0x4e')]('a.key',_0x0e82('0xa1'));_0x5f4fbc[_0x0e82('0x4e')]('a.mandatoryDisposition',_0x0e82('0xa2'));_0x5f4fbc[_0x0e82('0x4e')](_0x0e82('0xa3'),_0x0e82('0x94'));_0x5f4fbc[_0x0e82('0x4e')](_0x0e82('0xa4'));_0x5f4fbc[_0x0e82('0x4e')]('c.firstName',_0x0e82('0xa5'));_0x5f4fbc['field']('c.lastName','Contact.lastName');_0x5f4fbc[_0x0e82('0x4e')](_0x0e82('0xa6'),_0x0e82('0xa7'));_0x5f4fbc[_0x0e82('0x4e')](_0x0e82('0xa8'),_0x0e82('0xa9'));_0x5f4fbc['field'](_0x0e82('0xaa'),'Contact.mobile');_0x5f4fbc['field']('c.fax',_0x0e82('0xab'));_0x5f4fbc['field']('o.fullname',_0x0e82('0xac'));_0x5f4fbc[_0x0e82('0x4e')]('o.internal',_0x0e82('0xad'));_0x5f4fbc[_0x0e82('0x4e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x0e82('0x2f'));}if(_0x4e11b7[_0x0e82('0x22')])_0x5f4fbc[_0x0e82('0x22')](_0x4e11b7['limit']);if(_0x4e11b7[_0x0e82('0x20')])_0x5f4fbc[_0x0e82('0x20')](_0x4e11b7['offset']);return db[_0x0e82('0x9e')][_0x0e82('0x41')](_0x5f4fbc['toString'](),_0x23b069);})[_0x0e82('0x29')](function(_0x17a608){if(_0x17a608['length']>0x0)_0x392608[_0x0e82('0x4a')](_0x0e82('0xae'),_[_0x0e82('0x3b')](_0x17a608,'id'));return db[_0x0e82('0x9e')]['query'](_0x392608['toString'](),_0x23b069)[_0x0e82('0x29')](function(_0x1d6723){var _0x447250=_[_0x0e82('0xaf')](_0x1d6723,_0x0e82('0xb0'));var _0x2b1f99=[];_0x17a608[_0x0e82('0x31')](function(_0x39945e){_0x2b1f99[_0x0e82('0xb1')](updateWhatsappInteraction(_0x39945e,_0x331668,_0x447250));});return BPromise['all'](_0x2b1f99);});});})[_0x0e82('0x29')](function(_0x20cd56){_0x8229ab[_0x0e82('0xb2')]=_0x20cd56;return _0x8229ab;})[_0x0e82('0x29')](respondWithFilteredResult(_0x339ffe,_0x4e11b7))['catch'](handleError(_0x339ffe,null));};exports[_0x0e82('0xb3')]=function(_0x3a9746,_0x51b943){var _0x148a2f={'raw':![],'where':{'id':_0x3a9746[_0x0e82('0xb4')]['id']}},_0x35a618={};_0x35a618[_0x0e82('0x40')]=_[_0x0e82('0x42')](db[_0x0e82('0x3c')]['rawAttributes']);_0x35a618[_0x0e82('0x41')]=_['keys'](_0x3a9746[_0x0e82('0x41')]);_0x35a618[_0x0e82('0x4b')]=_[_0x0e82('0x43')](_0x35a618[_0x0e82('0x40')],_0x35a618[_0x0e82('0x41')]);_0x148a2f[_0x0e82('0x45')]=_[_0x0e82('0x43')](_0x35a618[_0x0e82('0x40')],qs['fields'](_0x3a9746[_0x0e82('0x41')][_0x0e82('0x44')]));_0x148a2f[_0x0e82('0x45')]=_0x148a2f['attributes'][_0x0e82('0x46')]?_0x148a2f['attributes']:_0x35a618[_0x0e82('0x40')];if(_0x3a9746['query'][_0x0e82('0xb5')]){_0x148a2f[_0x0e82('0xb6')]=[{'all':!![]}];}_0x148a2f=_[_0x0e82('0xa0')]({},_0x148a2f,_0x3a9746['options']);return db[_0x0e82('0x3c')][_0x0e82('0x6e')](_0x148a2f)[_0x0e82('0x29')](handleEntityNotFound(_0x51b943,null))[_0x0e82('0x29')](respondWithResult(_0x51b943,null))['catch'](handleError(_0x51b943,null));};exports[_0x0e82('0xb7')]=function(_0x24925c,_0x3dcec5){return db[_0x0e82('0x3c')][_0x0e82('0xb7')](_0x24925c['body'],{})[_0x0e82('0x29')](respondWithResult(_0x3dcec5,0xc9))[_0x0e82('0x32')](handleError(_0x3dcec5,null));};exports[_0x0e82('0x28')]=function(_0x2d81ee,_0x456bad){if(_0x2d81ee['body']['id']){delete _0x2d81ee['body']['id'];}return db[_0x0e82('0x3c')][_0x0e82('0x6e')]({'where':{'id':_0x2d81ee['params']['id']}})['then'](handleEntityNotFound(_0x456bad,null))[_0x0e82('0x29')](saveUpdates(_0x2d81ee[_0x0e82('0xb8')],null))[_0x0e82('0x29')](respondWithResult(_0x456bad,null))[_0x0e82('0x32')](handleError(_0x456bad,null));};exports[_0x0e82('0xb9')]=function(_0x30b3af,_0x56f0a6){return db[_0x0e82('0x3c')][_0x0e82('0x6e')]({'where':{'id':_0x30b3af[_0x0e82('0xb4')]['id']}})[_0x0e82('0x29')](handleEntityNotFound(_0x56f0a6,null))['then'](removeEntity(_0x56f0a6,null))['catch'](handleError(_0x56f0a6,null));};exports[_0x0e82('0xba')]=function(_0x38a73a,_0x3fbce0){return db[_0x0e82('0x3c')][_0x0e82('0xba')]()['then'](respondWithResult(_0x3fbce0,null))['catch'](handleError(_0x3fbce0,null));};exports[_0x0e82('0xbb')]=function(_0x4f8663,_0x1fca64,_0x55c9f4){return db[_0x0e82('0xbc')][_0x0e82('0x6e')]({'where':{'id':_0x4f8663[_0x0e82('0xb4')]['id']}})[_0x0e82('0x29')](handleEntityNotFound(_0x1fca64,null))[_0x0e82('0x29')](function(_0x1b272a){if(_0x1b272a){return _0x1b272a['addMessage'](_0x4f8663['body'][_0x0e82('0xbd')],_['omit'](_0x4f8663[_0x0e82('0xb8')],[_0x0e82('0xbd'),'id'])||{});}})[_0x0e82('0x29')](respondWithResult(_0x1fca64,null))[_0x0e82('0x32')](handleError(_0x1fca64,null));};exports[_0x0e82('0xbe')]=function(_0xcbf3c,_0x1d79b5,_0x1e305f){var _0x25c63b={'raw':![],'where':{}};var _0x5333bd={};var _0x3c3e50={'count':0x0,'rows':[]};return db[_0x0e82('0x3c')][_0x0e82('0xbf')]({'where':{'id':_0xcbf3c[_0x0e82('0xb4')]['id']}})[_0x0e82('0x29')](handleEntityNotFound(_0x1d79b5,null))[_0x0e82('0x29')](function(_0x532484){if(_0x532484){_0x5333bd[_0x0e82('0x40')]=_[_0x0e82('0x42')](db[_0x0e82('0xbc')]['rawAttributes']);_0x5333bd[_0x0e82('0x41')]=_[_0x0e82('0x42')](_0xcbf3c['query']);_0x5333bd[_0x0e82('0x4b')]=_[_0x0e82('0x43')](_0x5333bd['model'],_0x5333bd[_0x0e82('0x41')]);_0x25c63b[_0x0e82('0x45')]=_[_0x0e82('0x43')](_0x5333bd[_0x0e82('0x40')],qs[_0x0e82('0x44')](_0xcbf3c[_0x0e82('0x41')][_0x0e82('0x44')]));_0x25c63b[_0x0e82('0x45')]=_0x25c63b[_0x0e82('0x45')][_0x0e82('0x46')]?_0x25c63b['attributes']:_0x5333bd[_0x0e82('0x40')];if(!_0xcbf3c['query']['hasOwnProperty'](_0x0e82('0x48'))){_0x25c63b['limit']=qs[_0x0e82('0x22')](_0xcbf3c[_0x0e82('0x41')][_0x0e82('0x22')]);_0x25c63b[_0x0e82('0x20')]=qs[_0x0e82('0x20')](_0xcbf3c['query'][_0x0e82('0x20')]);}_0x25c63b[_0x0e82('0x49')]=qs['sort'](_0xcbf3c['query'][_0x0e82('0xc0')]);_0x25c63b['where']=qs[_0x0e82('0x4b')](_[_0x0e82('0x4c')](_0xcbf3c[_0x0e82('0x41')],_0x5333bd['filters']));_0x25c63b['where'][_0x0e82('0xb0')]=_0x532484['id'];if(_0xcbf3c['query'][_0x0e82('0x89')]){_0x25c63b['where']=_[_0x0e82('0xa0')](_0x25c63b[_0x0e82('0x4a')],{'$or':_['map'](_0x25c63b[_0x0e82('0x45')],function(_0x2c56da){var _0x4a00d2={};_0x4a00d2[_0x2c56da]={'$like':'%'+_0xcbf3c[_0x0e82('0x41')][_0x0e82('0x89')]+'%'};return _0x4a00d2;})});}if(_0xcbf3c['query']['$gte']){var _0x302626=_0xcbf3c['query'][_0x0e82('0xc1')][_0x0e82('0x30')](',');var _0x4cbd33={};_0x4cbd33[_0x302626[0x0]]={'$gte':moment(_0x302626[0x1])['format'](_0x0e82('0xc2'))};_0x25c63b['where']=_[_0x0e82('0xa0')](_0x25c63b[_0x0e82('0x4a')],_0x4cbd33);}_0x25c63b=_[_0x0e82('0xa0')]({},_0x25c63b,_0xcbf3c[_0x0e82('0xc3')]);return db['WhatsappMessage']['count']({'where':_0x25c63b[_0x0e82('0x4a')]})[_0x0e82('0x29')](function(_0x3f725e){_0x3c3e50[_0x0e82('0x23')]=_0x3f725e;if(_0xcbf3c['query'][_0x0e82('0xb5')]){_0x25c63b['include']=[{'all':!![]}];}return db[_0x0e82('0xbc')][_0x0e82('0xc4')](_0x25c63b);})['then'](function(_0x3ad2e7){_0x3c3e50['rows']=_0x3ad2e7;return _0x3c3e50;});}})['then'](respondWithFilteredResult(_0x1d79b5,_0x25c63b))[_0x0e82('0x32')](handleError(_0x1d79b5,null));};exports[_0x0e82('0xc5')]=function(_0x368ab0,_0x531498,_0x1ac9a8){return db[_0x0e82('0x3c')][_0x0e82('0x6e')]({'where':{'id':_0x368ab0['params']['id']}})['then'](handleEntityNotFound(_0x531498,null))['then'](function(_0x3d70d4){if(_0x3d70d4){return _0x3d70d4[_0x0e82('0xc6')](_0x368ab0['body'][_0x0e82('0xbd')],_[_0x0e82('0xc7')](_0x368ab0[_0x0e82('0xb8')],[_0x0e82('0xbd'),'id'])||{})[_0x0e82('0xc8')](function(){return db[_0x0e82('0x74')]['findAll']({'attributes':['id',_0x0e82('0x2b'),_0x0e82('0x4f')],'where':{'id':_0x368ab0[_0x0e82('0xb8')][_0x0e82('0xbd')]}});})[_0x0e82('0x29')](function(_0x252c19){socket[_0x0e82('0xc9')](_0x0e82('0xca'),{'id':Number(_0x368ab0[_0x0e82('0xb4')]['id']),'tags':_0x252c19||[]});return{'id':Number(_0x368ab0[_0x0e82('0xb4')]['id']),'tags':_0x252c19||[]};});}})[_0x0e82('0x29')](respondWithResult(_0x531498,null))['catch'](handleError(_0x531498,null));};exports[_0x0e82('0xcb')]=function(_0x32c978,_0x40a3ef,_0x255f8b){return db[_0x0e82('0x3c')][_0x0e82('0x6e')]({'where':{'id':_0x32c978['params']['id']}})[_0x0e82('0x29')](handleEntityNotFound(_0x40a3ef,null))['then'](function(_0x3dca6){if(_0x3dca6){return _0x3dca6['removeTags'](_0x32c978[_0x0e82('0x41')][_0x0e82('0xbd')]);}})['then'](respondWithStatusCode(_0x40a3ef,null))[_0x0e82('0x32')](handleError(_0x40a3ef,null));};exports['download']=function(_0x542dd1,_0x55970a){var _0x4e7eaf=moment()[_0x0e82('0xcc')]()[_0x0e82('0x9f')]();var _0x4245aa=path['join'](config[_0x0e82('0xcd')],_0x0e82('0xce'),_0x0e82('0xcf'),'tmp');var _0x531215=path[_0x0e82('0xd0')](config[_0x0e82('0xcd')],_0x0e82('0xce'),_0x0e82('0xcf'),_0x0e82('0xd1'));var _0x3e8b37=path['join'](_0x4245aa,_0x4e7eaf);var _0x452a77=util[_0x0e82('0xd2')](_0x0e82('0xd3'),_0x542dd1[_0x0e82('0xb4')]['id'],_0x4e7eaf);var _0x2f59ee=path[_0x0e82('0xd0')](_0x4245aa,_0x452a77);var _0x33d8ca=[];_0x33d8ca[_0x0e82('0xb1')]({'model':db['User'],'as':_0x0e82('0xd4'),'attributes':['id',_0x0e82('0xd5')],'raw':!![]});_0x33d8ca[_0x0e82('0xb1')]({'model':db[_0x0e82('0xd6')],'as':_0x0e82('0x68'),'attributes':['id',_0x0e82('0xd7'),_0x0e82('0xd8')],'raw':!![]});if(_0x542dd1['query']['attachments']){_0x33d8ca[_0x0e82('0xb1')]({'model':db[_0x0e82('0xd9')],'as':_0x0e82('0xd9'),'raw':!![]});}var _0xfeb7e9=[{'model':db['WhatsappMessage'],'as':_0x0e82('0xda'),'attributes':['id',_0x0e82('0xb8'),_0x0e82('0x7d'),'direction',_0x0e82('0xdb'),_0x0e82('0x84')],'include':_0x33d8ca}];_0xfeb7e9[_0x0e82('0xb1')]({'model':db[_0x0e82('0xdc')],'as':_0x0e82('0xdd'),'attributes':['id',_0x0e82('0x2b')]});_0xfeb7e9[_0x0e82('0xb1')]({'model':db[_0x0e82('0xd4')],'as':_0x0e82('0xde'),'attributes':['id',_0x0e82('0xd5')]});return db['WhatsappInteraction']['find']({'where':{'id':_0x542dd1[_0x0e82('0xb4')]['id']},'include':_0xfeb7e9})[_0x0e82('0x29')](handleEntityNotFound(_0x55970a,null))['then'](function(_0x1d360b){if(_0x1d360b){var _0x268ba1=_0x1d360b[_0x0e82('0xdf')]({'plain':!![]});fs[_0x0e82('0xe0')](_0x3e8b37);var _0x5ac258={'channel':'Whatsapp','account':_0x268ba1[_0x0e82('0xdd')][_0x0e82('0x2b')],'agent':_0x268ba1[_0x0e82('0xde')]?_0x268ba1[_0x0e82('0xde')][_0x0e82('0xd5')]:_0x0e82('0xe1'),'createdAt':moment(_0x268ba1[_0x0e82('0x7d')])[_0x0e82('0xd2')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0e82('0x9f')](),'closedAt':_0x268ba1[_0x0e82('0x37')]?moment(_0x268ba1['closedAt'])[_0x0e82('0xd2')](_0x0e82('0xc2'))['toString']():'','disposition':_0x268ba1['disposition'],'messages':_(_0x268ba1[_0x0e82('0xda')])[_0x0e82('0x89')]({'secret':![]})['map'](function(_0xf40c85){if(_0xf40c85['Attachment']){var _0x24bd84=path[_0x0e82('0xd0')](_0x531215,_0xf40c85['Attachment'][_0x0e82('0xe2')]);if(fs['existsSync'](_0x24bd84)){fs['createReadStream'](_0x24bd84)['pipe'](fs[_0x0e82('0xe3')](path[_0x0e82('0xd0')](_0x3e8b37,_0xf40c85[_0x0e82('0xd9')]['basename'])));}}return{'date':moment(_0xf40c85[_0x0e82('0x7d')])[_0x0e82('0xd2')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0xf40c85[_0x0e82('0xe4')]===_0x0e82('0xe5')?_0xf40c85[_0x0e82('0xd4')]?_0xf40c85[_0x0e82('0xd4')]['fullname']:_0x0e82('0xe6'):_0xf40c85[_0x0e82('0x68')]['firstName']+(_0xf40c85[_0x0e82('0x68')][_0x0e82('0xd8')]?'\x20'+_0xf40c85['Contact'][_0x0e82('0xd8')]:''),'body':_0xf40c85['Attachment']?_0xf40c85[_0x0e82('0xd9')][_0x0e82('0xe2')]:_0xf40c85[_0x0e82('0xb8')],'direction':_0xf40c85[_0x0e82('0xe4')]==='out'?'A':'C','secret':_0xf40c85['secret'],'read':_0xf40c85[_0x0e82('0x84')],'attachment':_0xf40c85[_0x0e82('0xd9')]};})[_0x0e82('0x65')]()};return ejs['renderFile'](path[_0x0e82('0xd0')](config[_0x0e82('0xcd')],_0x0e82('0xce'),_0x0e82('0xe7'),_0x0e82('0xe8')),{'interaction':_0x5ac258})[_0x0e82('0x29')](function(_0x35ad03){var _0x4a8977=path[_0x0e82('0xd0')](_0x3e8b37,_0x0e82('0xe9')+_0x268ba1['id']+'-'+_0x4e7eaf+_0x0e82('0xea'));var _0x410c73={'path':_0x4a8977,'channel':'Whatsapp','interactionId':_0x268ba1['id']};return pdf[_0x0e82('0xeb')](_0x35ad03,_0x410c73);})['then'](function(){return new BPromise(function(_0xbdac68,_0x7f3f4e){zipdir(_0x3e8b37,{'saveTo':_0x2f59ee},function(_0x265b36,_0x3133fe){if(_0x265b36)return _0x7f3f4e(_0x265b36);return _0xbdac68(_0x3133fe);});})['then'](function(){return new BPromise(function(_0x14d4eb,_0x169aef){rimraf(_0x3e8b37,function(_0x59c925){if(_0x59c925)_0x169aef(_0x59c925);return _0x14d4eb();});});})[_0x0e82('0x29')](function(){return _0x55970a[_0x0e82('0xec')](_0x2f59ee,_0x452a77,function(_0x228437){if(_0x228437){console['log'](_0x0e82('0xed'),_0x228437);}else{fs['unlinkSync'](_0x2f59ee);}});});});}else{return _0x55970a[_0x0e82('0x1d')](0xc8);}})[_0x0e82('0x32')](handleError(_0x55970a,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index cbbbd61..b0d7d70 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 _0xf089=['WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x23c73d,_0x357b21){var _0x36ba47=function(_0x317b8e){while(--_0x317b8e){_0x23c73d['push'](_0x23c73d['shift']());}};_0x36ba47(++_0x357b21);}(_0xf089,0xba));var _0x9f08=function(_0x5823b0,_0x2acfdc){_0x5823b0=_0x5823b0-0x0;var _0x383086=_0xf089[_0x5823b0];return _0x383086;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x9f08('0x0'))['db'][_0x9f08('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0x9f08('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x9f08('0x3')](0x0);var events={'afterCreate':_0x9f08('0x4'),'afterUpdate':_0x9f08('0x5'),'afterDestroy':'remove'};function emitEvent(_0x11d64c){return function(_0x1dced2,_0x352879,_0x13768c){_0x1dced2[_0x9f08('0x6')]({'attributes':['id'],'raw':!![]})[_0x9f08('0x7')](function(_0x5341c9){_0x1dced2[_0x9f08('0x8')](_0x9f08('0x9'),_0x5341c9[_0x9f08('0xa')](function(_0x4ce5b6){return{'id':_0x4ce5b6['id']};}));return WhatsappMessage[_0x9f08('0xb')]({'where':{'WhatsappInteractionId':_0x1dced2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9f08('0x7')](function(_0x3868b6){_0x1dced2['setDataValue'](_0x9f08('0xc'),_0x3868b6[_0x9f08('0xd')]);WhatsappInteractionEvents[_0x9f08('0xe')](_0x11d64c+':'+_0x1dced2['id'],_0x1dced2);WhatsappInteractionEvents['emit'](_0x11d64c,_0x1dced2);_0x13768c(null);})['catch'](_0x13768c(null));};}for(var e in events){if(events[_0x9f08('0xf')](e)){var event=events[e];WhatsappInteraction[_0x9f08('0x10')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x693f=['update','remove','getUsers','then','setDataValue','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners','save'];(function(_0x88b746,_0x51b698){var _0x4ed9ec=function(_0x13feef){while(--_0x13feef){_0x88b746['push'](_0x88b746['shift']());}};_0x4ed9ec(++_0x51b698);}(_0x693f,0x9d));var _0xf693=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x693f[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xf693('0x0'));var WhatsappInteraction=require(_0xf693('0x1'))['db'][_0xf693('0x2')];var WhatsappMessage=require(_0xf693('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xf693('0x3')](0x0);var events={'afterCreate':_0xf693('0x4'),'afterUpdate':_0xf693('0x5'),'afterDestroy':_0xf693('0x6')};function emitEvent(_0x3d2e05){return function(_0x6e749b,_0x42578c,_0x4b4d39){_0x6e749b[_0xf693('0x7')]({'attributes':['id'],'raw':!![]})[_0xf693('0x8')](function(_0x5b91c5){_0x6e749b[_0xf693('0x9')]('Users',_0x5b91c5[_0xf693('0xa')](function(_0x4ae88f){return{'id':_0x4ae88f['id']};}));return WhatsappMessage[_0xf693('0xb')]({'where':{'WhatsappInteractionId':_0x6e749b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf693('0x8')](function(_0x48984a){_0x6e749b['setDataValue']('unreadMessages',_0x48984a[_0xf693('0xc')]);WhatsappInteractionEvents['emit'](_0x3d2e05+':'+_0x6e749b['id'],_0x6e749b);WhatsappInteractionEvents[_0xf693('0xd')](_0x3d2e05,_0x6e749b);_0x4b4d39(null);})[_0xf693('0xe')](_0x4b4d39(null));};}for(var e in events){if(events[_0xf693('0xf')](e)){var event=events[e];WhatsappInteraction[_0xf693('0x10')](e,emitEvent(event));}}module[_0xf693('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 2aab6fa..eab92eb 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 _0xef4b=['whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','path','./whatsappInteraction.attributes','exports','define','WhatsappInteraction'];(function(_0x9c6e38,_0x1fc24e){var _0x148e08=function(_0x415b66){while(--_0x415b66){_0x9c6e38['push'](_0x9c6e38['shift']());}};_0x148e08(++_0x1fc24e);}(_0xef4b,0x96));var _0xbef4=function(_0x36e057,_0x52b965){_0x36e057=_0x36e057-0x0;var _0x4cbac8=_0xef4b[_0x36e057];return _0x4cbac8;};'use strict';var _=require('lodash');var util=require(_0xbef4('0x0'));var logger=require(_0xbef4('0x1'))(_0xbef4('0x2'));var moment=require(_0xbef4('0x3'));var BPromise=require(_0xbef4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbef4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbef4('0x6'));module[_0xbef4('0x7')]=function(_0x321923,_0x1da721){return _0x321923[_0xbef4('0x8')](_0xbef4('0x9'),attributes,{'tableName':_0xbef4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5ace84,_0x12e979,_0x4f7b48){if(_0x5ace84[_0xbef4('0xb')](_0xbef4('0xc'))){_0x5ace84[_0xbef4('0xd')]=moment()[_0xbef4('0xe')](_0xbef4('0xf'));}_0x4f7b48(null,_0x5ace84);}}});}; \ No newline at end of file +var _0x3905=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','changed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2815d7,_0x2cde75){var _0x248bf0=function(_0x4f4e07){while(--_0x4f4e07){_0x2815d7['push'](_0x2815d7['shift']());}};_0x248bf0(++_0x2cde75);}(_0x3905,0xc3));var _0x5390=function(_0x1057a3,_0x28d9b7){_0x1057a3=_0x1057a3-0x0;var _0x131cdb=_0x3905[_0x1057a3];return _0x131cdb;};'use strict';var _=require(_0x5390('0x0'));var util=require('util');var logger=require(_0x5390('0x1'))('api');var moment=require(_0x5390('0x2'));var BPromise=require(_0x5390('0x3'));var rp=require(_0x5390('0x4'));var fs=require('fs');var path=require(_0x5390('0x5'));var rimraf=require(_0x5390('0x6'));var config=require(_0x5390('0x7'));var attributes=require(_0x5390('0x8'));module[_0x5390('0x9')]=function(_0x503846,_0x328004){return _0x503846[_0x5390('0xa')](_0x5390('0xb'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1bbef5,_0xbcdb2d,_0x53567f){if(_0x1bbef5[_0x5390('0xc')]('closed')){_0x1bbef5['closedAt']=moment()[_0x5390('0xd')](_0x5390('0xe'));}_0x53567f(null,_0x1bbef5);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index e971d4d..944e235 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 _0xcf14=['request','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','WhatsappInteraction,\x20%s,\x20%s','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','where','attributes','limit','find','ids','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register'];(function(_0x698951,_0x331939){var _0x5e9e0d=function(_0x497e88){while(--_0x497e88){_0x698951['push'](_0x698951['shift']());}};_0x5e9e0d(++_0x331939);}(_0xcf14,0x1b2));var _0x4cf1=function(_0x575f33,_0x36e3ea){_0x575f33=_0x575f33-0x0;var _0x2b61e8=_0xcf14[_0x575f33];return _0x2b61e8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4cf1('0x0'));var BPromise=require(_0x4cf1('0x1'));var rs=require(_0x4cf1('0x2'));var fs=require('fs');var Redis=require(_0x4cf1('0x3'));var db=require(_0x4cf1('0x4'))['db'];var utils=require(_0x4cf1('0x5'));var logger=require(_0x4cf1('0x6'))('rpc');var config=require(_0x4cf1('0x7'));var jayson=require(_0x4cf1('0x8'));var client=jayson[_0x4cf1('0x9')][_0x4cf1('0xa')]({'port':0x232a});config[_0x4cf1('0xb')]=_[_0x4cf1('0xc')](config[_0x4cf1('0xb')],{'host':_0x4cf1('0xd'),'port':0x18eb});var socket=require(_0x4cf1('0xe'))(new Redis(config[_0x4cf1('0xb')]));require(_0x4cf1('0xf'))[_0x4cf1('0x10')](socket);function respondWithRpcPromise(_0x1a4bd7,_0x49c293,_0x2dcae0){return new BPromise(function(_0x150c67,_0x5bcd87){return client[_0x4cf1('0x11')](_0x1a4bd7,_0x2dcae0)[_0x4cf1('0x12')](function(_0x958820){logger[_0x4cf1('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x49c293,_0x4cf1('0x14'));logger[_0x4cf1('0x15')](_0x4cf1('0x16'),_0x49c293,_0x4cf1('0x14'),JSON[_0x4cf1('0x17')](_0x958820));if(_0x958820[_0x4cf1('0x18')]){if(_0x958820['error']['code']===0x1f4){logger[_0x4cf1('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x49c293,_0x958820[_0x4cf1('0x18')][_0x4cf1('0x19')]);return _0x5bcd87(_0x958820['error']['message']);}logger[_0x4cf1('0x18')](_0x4cf1('0x1a'),_0x49c293,_0x958820['error'][_0x4cf1('0x19')]);return _0x150c67(_0x958820[_0x4cf1('0x18')][_0x4cf1('0x19')]);}else{logger[_0x4cf1('0x13')](_0x4cf1('0x1a'),_0x49c293,_0x4cf1('0x14'));_0x150c67(_0x958820['result']['message']);}})[_0x4cf1('0x1b')](function(_0x46c629){logger[_0x4cf1('0x18')](_0x4cf1('0x1a'),_0x49c293,_0x46c629);_0x5bcd87(_0x46c629);});});}exports[_0x4cf1('0x1c')]=function(_0xa33b71){var _0x5820fa=this;return new Promise(function(_0x52f3c2,_0x38b86f){return db[_0x4cf1('0x1d')]['update'](_0xa33b71[_0x4cf1('0x1e')],{'raw':_0xa33b71['options']?_0xa33b71[_0x4cf1('0x1f')][_0x4cf1('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa33b71[_0x4cf1('0x1f')]?_0xa33b71[_0x4cf1('0x1f')][_0x4cf1('0x21')]||null:null,'attributes':_0xa33b71[_0x4cf1('0x1f')]?_0xa33b71[_0x4cf1('0x1f')][_0x4cf1('0x22')]||null:null,'limit':_0xa33b71['options']?_0xa33b71['options'][_0x4cf1('0x23')]||null:null})['then'](function(_0x3a5ca6){logger[_0x4cf1('0x13')](_0x4cf1('0x1c'),_0xa33b71);logger[_0x4cf1('0x15')](_0x4cf1('0x1c'),_0xa33b71,JSON[_0x4cf1('0x17')](_0x3a5ca6));_0x52f3c2(_0x3a5ca6);})[_0x4cf1('0x1b')](function(_0x153d52){logger[_0x4cf1('0x18')](_0x4cf1('0x1c'),_0x153d52[_0x4cf1('0x19')],_0xa33b71);_0x38b86f(_0x5820fa[_0x4cf1('0x18')](0x1f4,_0x153d52[_0x4cf1('0x19')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x57d5da){return new Promise(function(_0xadd03c,_0xd8b9f1){return db[_0x4cf1('0x1d')][_0x4cf1('0x24')]({'where':_0x57d5da[_0x4cf1('0x1f')]?_0x57d5da[_0x4cf1('0x1f')]['where']||null:null})[_0x4cf1('0x12')](function(_0x58a191){if(_0x58a191){return _0x58a191['addTags'](_0x57d5da[_0x4cf1('0x1e')][_0x4cf1('0x25')],_[_0x4cf1('0x26')](_0x57d5da['body'],[_0x4cf1('0x25'),'id'])||{});}})[_0x4cf1('0x27')](function(_0x4ac689){logger[_0x4cf1('0x13')](_0x4cf1('0x28'),_0x57d5da);logger[_0x4cf1('0x15')](_0x4cf1('0x28'),_0x57d5da,JSON[_0x4cf1('0x17')](_0x4ac689));_0xadd03c(_0x4ac689);})[_0x4cf1('0x1b')](function(_0xfa2299){logger[_0x4cf1('0x18')](_0x4cf1('0x28'),_0xfa2299[_0x4cf1('0x19')],_0x57d5da);_0xd8b9f1(_this[_0x4cf1('0x18')](0x1f4,_0xfa2299[_0x4cf1('0x19')]));});});}; \ No newline at end of file +var _0xedc0=['catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','then','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappInteraction.socket','register','info','WhatsappInteraction,\x20%s,\x20%s','debug','request\x20sent','error','message'];(function(_0x3fe8e9,_0x31318f){var _0xf44ac=function(_0x1bf2cc){while(--_0x1bf2cc){_0x3fe8e9['push'](_0x3fe8e9['shift']());}};_0xf44ac(++_0x31318f);}(_0xedc0,0x13f));var _0x0edc=function(_0x19a7cb,_0x1384f7){_0x19a7cb=_0x19a7cb-0x0;var _0x455ed2=_0xedc0[_0x19a7cb];return _0x455ed2;};'use strict';var _=require(_0x0edc('0x0'));var util=require(_0x0edc('0x1'));var moment=require(_0x0edc('0x2'));var BPromise=require(_0x0edc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0edc('0x4'));var db=require(_0x0edc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0edc('0x6'))(_0x0edc('0x7'));var config=require(_0x0edc('0x8'));var jayson=require(_0x0edc('0x9'));var client=jayson[_0x0edc('0xa')][_0x0edc('0xb')]({'port':0x232a});config[_0x0edc('0xc')]=_[_0x0edc('0xd')](config['redis'],{'host':_0x0edc('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0edc('0xc')]));require(_0x0edc('0xf'))[_0x0edc('0x10')](socket);function respondWithRpcPromise(_0x53637b,_0x108a6f,_0x37c439){return new BPromise(function(_0x58d256,_0x2305ee){return client['request'](_0x53637b,_0x37c439)['then'](function(_0x54cec0){logger[_0x0edc('0x11')](_0x0edc('0x12'),_0x108a6f,'request\x20sent');logger[_0x0edc('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x108a6f,_0x0edc('0x14'),JSON['stringify'](_0x54cec0));if(_0x54cec0['error']){if(_0x54cec0[_0x0edc('0x15')]['code']===0x1f4){logger[_0x0edc('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x108a6f,_0x54cec0['error'][_0x0edc('0x16')]);return _0x2305ee(_0x54cec0[_0x0edc('0x15')][_0x0edc('0x16')]);}logger[_0x0edc('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x108a6f,_0x54cec0[_0x0edc('0x15')][_0x0edc('0x16')]);return _0x58d256(_0x54cec0[_0x0edc('0x15')][_0x0edc('0x16')]);}else{logger['info'](_0x0edc('0x12'),_0x108a6f,_0x0edc('0x14'));_0x58d256(_0x54cec0['result'][_0x0edc('0x16')]);}})[_0x0edc('0x17')](function(_0x5735a6){logger['error'](_0x0edc('0x12'),_0x108a6f,_0x5735a6);_0x2305ee(_0x5735a6);});});}exports[_0x0edc('0x18')]=function(_0x580f8a){var _0x5dd97b=this;return new Promise(function(_0x50e32f,_0x575874){return db[_0x0edc('0x19')][_0x0edc('0x1a')](_0x580f8a[_0x0edc('0x1b')],{'raw':_0x580f8a[_0x0edc('0x1c')]?_0x580f8a[_0x0edc('0x1c')][_0x0edc('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x580f8a['options']?_0x580f8a['options'][_0x0edc('0x1e')]||null:null,'attributes':_0x580f8a['options']?_0x580f8a['options'][_0x0edc('0x1f')]||null:null,'limit':_0x580f8a[_0x0edc('0x1c')]?_0x580f8a[_0x0edc('0x1c')][_0x0edc('0x20')]||null:null})[_0x0edc('0x21')](function(_0x4dfe97){logger[_0x0edc('0x11')](_0x0edc('0x18'),_0x580f8a);logger[_0x0edc('0x13')](_0x0edc('0x18'),_0x580f8a,JSON['stringify'](_0x4dfe97));_0x50e32f(_0x4dfe97);})[_0x0edc('0x17')](function(_0xe6aefd){logger[_0x0edc('0x15')](_0x0edc('0x18'),_0xe6aefd[_0x0edc('0x16')],_0x580f8a);_0x575874(_0x5dd97b[_0x0edc('0x15')](0x1f4,_0xe6aefd[_0x0edc('0x16')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x4e0099){return new Promise(function(_0x2d1eef,_0x249de8){return db['WhatsappInteraction']['find']({'where':_0x4e0099[_0x0edc('0x1c')]?_0x4e0099['options'][_0x0edc('0x1e')]||null:null})[_0x0edc('0x21')](function(_0x325209){if(_0x325209){return _0x325209[_0x0edc('0x22')](_0x4e0099[_0x0edc('0x1b')][_0x0edc('0x23')],_['omit'](_0x4e0099[_0x0edc('0x1b')],['ids','id'])||{});}})[_0x0edc('0x24')](function(_0x4569c3){logger[_0x0edc('0x11')](_0x0edc('0x25'),_0x4e0099);logger[_0x0edc('0x13')](_0x0edc('0x25'),_0x4e0099,JSON['stringify'](_0x4569c3));_0x2d1eef(_0x4569c3);})['catch'](function(_0xea58e1){logger[_0x0edc('0x15')](_0x0edc('0x25'),_0xea58e1['message'],_0x4e0099);_0x249de8(_this[_0x0edc('0x15')](0x1f4,_0xea58e1['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index b83718f..8a63f0a 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 _0xe5d6=['emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update'];(function(_0xff1f09,_0x5278bd){var _0x5c3ac9=function(_0x1a42e7){while(--_0x1a42e7){_0xff1f09['push'](_0xff1f09['shift']());}};_0x5c3ac9(++_0x5278bd);}(_0xe5d6,0xe6));var _0x6e5d=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xe5d6[_0x618414];return _0x21c19a;};'use strict';var WhatsappInteractionEvents=require(_0x6e5d('0x0'));var events=[_0x6e5d('0x1'),_0x6e5d('0x2'),_0x6e5d('0x3')];function createListener(_0x256970,_0x4e9c45){return function(_0x3878f7){_0x4e9c45[_0x6e5d('0x4')](_0x256970,_0x3878f7);};}function removeListener(_0x18a808,_0x2de623){return function(){WhatsappInteractionEvents[_0x6e5d('0x5')](_0x18a808,_0x2de623);};}exports[_0x6e5d('0x6')]=function(_0x3cc53d){for(var _0x38ca79=0x0,_0x33bf61=events[_0x6e5d('0x7')];_0x38ca79<_0x33bf61;_0x38ca79++){var _0x569943=events[_0x38ca79];var _0x455c64=createListener(_0x6e5d('0x8')+_0x569943,_0x3cc53d);WhatsappInteractionEvents['on'](_0x569943,_0x455c64);}}; \ No newline at end of file +var _0xfc51=['save','remove','update','emit','removeListener','length','./whatsappInteraction.events'];(function(_0x13a644,_0x158fec){var _0x2df39a=function(_0x5e5d59){while(--_0x5e5d59){_0x13a644['push'](_0x13a644['shift']());}};_0x2df39a(++_0x158fec);}(_0xfc51,0x18e));var _0x1fc5=function(_0x5693c2,_0x544877){_0x5693c2=_0x5693c2-0x0;var _0x5134f6=_0xfc51[_0x5693c2];return _0x5134f6;};'use strict';var WhatsappInteractionEvents=require(_0x1fc5('0x0'));var events=[_0x1fc5('0x1'),_0x1fc5('0x2'),_0x1fc5('0x3')];function createListener(_0x27f18c,_0x4e0dd0){return function(_0x2dac5c){_0x4e0dd0[_0x1fc5('0x4')](_0x27f18c,_0x2dac5c);};}function removeListener(_0x36c3d7,_0x54ee52){return function(){WhatsappInteractionEvents[_0x1fc5('0x5')](_0x36c3d7,_0x54ee52);};}exports['register']=function(_0x1121ba){for(var _0x15474=0x0,_0x421faa=events[_0x1fc5('0x6')];_0x15474<_0x421faa;_0x15474++){var _0x8fd9e4=events[_0x15474];var _0x2221e6=createListener('whatsappInteraction:'+_0x8fd9e4,_0x1121ba);WhatsappInteractionEvents['on'](_0x8fd9e4,_0x2221e6);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 5271747..9d929a7 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 _0xfe37=['whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id/reject','reject','delete','/:id','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','get','describe','post','tracked'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xfe37,0x12a));var _0x7fe3=function(_0x4d45a8,_0x1b4e27){_0x4d45a8=_0x4d45a8-0x0;var _0x37f299=_0xfe37[_0x4d45a8];return _0x37f299;};'use strict';var multer=require('multer');var util=require(_0x7fe3('0x0'));var path=require(_0x7fe3('0x1'));var timeout=require(_0x7fe3('0x2'));var express=require('express');var router=express[_0x7fe3('0x3')]();var fs_extra=require(_0x7fe3('0x4'));var auth=require(_0x7fe3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7fe3('0x6'));var controller=require(_0x7fe3('0x7'));router['get']('/',auth[_0x7fe3('0x8')](),controller[_0x7fe3('0x9')]);router[_0x7fe3('0xa')]('/describe',auth[_0x7fe3('0x8')](),controller[_0x7fe3('0xb')]);router['get']('/:id',auth[_0x7fe3('0x8')](),controller['show']);router[_0x7fe3('0xc')]('/',auth['isAuthenticated'](),interaction[_0x7fe3('0xd')](_0x7fe3('0xe'),_0x7fe3('0xf')),controller[_0x7fe3('0x10')]);router[_0x7fe3('0xc')](_0x7fe3('0x11'),controller[_0x7fe3('0x12')]);router[_0x7fe3('0x13')]('/:id',auth[_0x7fe3('0x8')](),controller['update']);router[_0x7fe3('0x13')]('/:id/accept',auth[_0x7fe3('0x8')](),controller['accept']);router[_0x7fe3('0x13')](_0x7fe3('0x14'),auth[_0x7fe3('0x8')](),controller[_0x7fe3('0x15')]);router[_0x7fe3('0x16')](_0x7fe3('0x17'),auth[_0x7fe3('0x8')](),controller[_0x7fe3('0x18')]);module[_0x7fe3('0x19')]=router; \ No newline at end of file +var _0xe922=['whatsapp','whatsappmessage:create','create','/:id/status','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','tracked'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0xe922,0xc1));var _0x2e92=function(_0x2d10f7,_0x36abd0){_0x2d10f7=_0x2d10f7-0x0;var _0x94c2f7=_0xe922[_0x2d10f7];return _0x94c2f7;};'use strict';var multer=require(_0x2e92('0x0'));var util=require(_0x2e92('0x1'));var path=require(_0x2e92('0x2'));var timeout=require(_0x2e92('0x3'));var express=require('express');var router=express[_0x2e92('0x4')]();var fs_extra=require(_0x2e92('0x5'));var auth=require(_0x2e92('0x6'));var interaction=require(_0x2e92('0x7'));var config=require(_0x2e92('0x8'));var controller=require('./whatsappMessage.controller');router[_0x2e92('0x9')]('/',auth[_0x2e92('0xa')](),controller[_0x2e92('0xb')]);router[_0x2e92('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x2e92('0xa')](),controller['show']);router[_0x2e92('0xc')]('/',auth[_0x2e92('0xa')](),interaction[_0x2e92('0xd')](_0x2e92('0xe'),_0x2e92('0xf')),controller[_0x2e92('0x10')]);router[_0x2e92('0xc')](_0x2e92('0x11'),controller['status']);router[_0x2e92('0x12')](_0x2e92('0x13'),auth[_0x2e92('0xa')](),controller[_0x2e92('0x14')]);router[_0x2e92('0x12')]('/:id/accept',auth[_0x2e92('0xa')](),controller['accept']);router['put']('/:id/reject',auth[_0x2e92('0xa')](),controller['reject']);router[_0x2e92('0x15')](_0x2e92('0x13'),auth[_0x2e92('0xa')](),controller['destroy']);module[_0x2e92('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index dcc5916..b9d3a83 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 _0x25e1=['medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','TEXT'];(function(_0x138887,_0x58b7c1){var _0x211159=function(_0x7ad221){while(--_0x7ad221){_0x138887['push'](_0x138887['shift']());}};_0x211159(++_0x58b7c1);}(_0x25e1,0x146));var _0x125e=function(_0x552ddd,_0x1d3201){_0x552ddd=_0x552ddd-0x0;var _0x5d4422=_0x25e1[_0x552ddd];return _0x5d4422;};'use strict';var Sequelize=require(_0x125e('0x0'));module['exports']={'body':{'type':Sequelize[_0x125e('0x1')](_0x125e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x125e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x125e('0x4')]('in',_0x125e('0x5')),'defaultValue':_0x125e('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x125e('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x125e('0x7')]},'secret':{'type':Sequelize[_0x125e('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x125e('0x6')]},'providerResponse':{'type':Sequelize[_0x125e('0x1')]}}; \ No newline at end of file +var _0x2551=['STRING','DATE','BOOLEAN','TEXT','sequelize','exports','medium','ENUM','out'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x2551,0x9d));var _0x1255=function(_0x5eca50,_0xc1e3f8){_0x5eca50=_0x5eca50-0x0;var _0x41fb84=_0x2551[_0x5eca50];return _0x41fb84;};'use strict';var Sequelize=require(_0x1255('0x0'));module[_0x1255('0x1')]={'body':{'type':Sequelize['TEXT'](_0x1255('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x1255('0x3')]('in','out'),'defaultValue':_0x1255('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1255('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x1255('0x6')]},'secret':{'type':Sequelize[_0x1255('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1255('0x5')]},'providerResponse':{'type':Sequelize[_0x1255('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 2e72770..8813f7e 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 _0x8250=['stack','name','send','index','map','WhatsappMessage','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','options','create','body','find','params','destroy','describe','accept','readAt','format','UserId','user','agent','get','WhatsappInteraction','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','email','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','../../config/logger','whatsapp-interactions','whatsapp','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','fullname','internal','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./whatsappMessage.socket','http','client','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','sendStatus','json','offset','limit','count','status','apply','reject','save','update','end'];(function(_0x264246,_0x4cc82a){var _0x476ed5=function(_0x28ad56){while(--_0x28ad56){_0x264246['push'](_0x264246['shift']());}};_0x476ed5(++_0x4cc82a);}(_0x8250,0xdf));var _0x0825=function(_0x2a20c2,_0x34ec84){_0x2a20c2=_0x2a20c2-0x0;var _0x36ac9a=_0x8250[_0x2a20c2];return _0x36ac9a;};'use strict';var emlformat=require(_0x0825('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0825('0x1'));var jsonpatch=require(_0x0825('0x2'));var rp=require('request-promise');var moment=require(_0x0825('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0825('0x4'));var util=require(_0x0825('0x5'));var path=require('path');var sox=require(_0x0825('0x6'));var csv=require(_0x0825('0x7'));var ejs=require(_0x0825('0x8'));var fs=require('fs');var fs_extra=require(_0x0825('0x9'));var _=require(_0x0825('0xa'));var squel=require(_0x0825('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0825('0xc'));var Papa=require('papaparse');var Redis=require(_0x0825('0xd'));var authService=require(_0x0825('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0825('0xf'));var hardwareService=require(_0x0825('0x10'));var logger=require('../../config/logger')(_0x0825('0x11'));var utils=require(_0x0825('0x12'));var config=require(_0x0825('0x13'));var licenseUtil=require(_0x0825('0x14'));var db=require(_0x0825('0x15'))['db'];config[_0x0825('0x16')]=_[_0x0825('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0825('0x16')]));require(_0x0825('0x18'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x0825('0x19')]({'port':0x232c});var client9002=jayson[_0x0825('0x1a')][_0x0825('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2fbfa2,_0xa68596,_0x583e0b,_0x271fb8){return new BPromise(function(_0xb56a74,_0x3d9512){var _0x23c630=_0x271fb8||client;return _0x23c630[_0x0825('0x1b')](_0x2fbfa2,_0x583e0b)[_0x0825('0x1c')](function(_0x5c4be4){logger['info'](_0x0825('0x1d'),_0xa68596,_0x0825('0x1e'));logger[_0x0825('0x1f')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xa68596,_0x0825('0x1e'),JSON[_0x0825('0x20')](_0x5c4be4));if(_0x5c4be4[_0x0825('0x21')]){if(_0x5c4be4[_0x0825('0x21')]['code']===0x1f4){logger[_0x0825('0x21')](_0x0825('0x1d'),_0xa68596,_0x5c4be4[_0x0825('0x21')]['message']);return _0x3d9512(_0x5c4be4[_0x0825('0x21')][_0x0825('0x22')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0xa68596,_0x5c4be4[_0x0825('0x21')][_0x0825('0x22')]);return _0xb56a74(_0x5c4be4[_0x0825('0x21')][_0x0825('0x22')]);}else{logger[_0x0825('0x23')](_0x0825('0x1d'),_0xa68596,_0x0825('0x1e'));_0xb56a74(_0x5c4be4[_0x0825('0x24')][_0x0825('0x22')]);}})[_0x0825('0x25')](function(_0x53c8de){logger[_0x0825('0x21')](_0x0825('0x1d'),_0xa68596,_0x53c8de);_0x3d9512(_0x53c8de);});});}function respondWithStatusCode(_0x1ef2e4,_0x265f96){_0x265f96=_0x265f96||0xcc;return function(_0x430ef9){if(_0x430ef9){return _0x1ef2e4[_0x0825('0x26')](_0x265f96);}return _0x1ef2e4['status'](_0x265f96)['end']();};}function respondWithResult(_0x579f1f,_0x2d8eba){_0x2d8eba=_0x2d8eba||0xc8;return function(_0x35f8c5){if(_0x35f8c5){return _0x579f1f['status'](_0x2d8eba)[_0x0825('0x27')](_0x35f8c5);}};}function respondWithFilteredResult(_0x37d145,_0x3e7ceb){return function(_0x5a1596){if(_0x5a1596){var _0x138ba7=typeof _0x3e7ceb[_0x0825('0x28')]==='undefined'&&typeof _0x3e7ceb[_0x0825('0x29')]==='undefined';var _0x35c126=_0x5a1596['count'];var _0x2efdf1=_0x138ba7?0x0:_0x3e7ceb[_0x0825('0x28')];var _0x227df9=_0x138ba7?_0x5a1596[_0x0825('0x2a')]:_0x3e7ceb['offset']+_0x3e7ceb[_0x0825('0x29')];var _0x1bcd54;if(_0x227df9>=_0x35c126){_0x227df9=_0x35c126;_0x1bcd54=0xc8;}else{_0x1bcd54=0xce;}_0x37d145[_0x0825('0x2b')](_0x1bcd54);return _0x37d145['set']('Content-Range',_0x2efdf1+'-'+_0x227df9+'/'+_0x35c126)['json'](_0x5a1596);}return null;};}function patchUpdates(_0x5dcfd5){return function(_0x31efc2){try{jsonpatch[_0x0825('0x2c')](_0x31efc2,_0x5dcfd5,!![]);}catch(_0xf22e6a){return BPromise[_0x0825('0x2d')](_0xf22e6a);}return _0x31efc2[_0x0825('0x2e')]();};}function saveUpdates(_0x239bb6,_0x5222e8){return function(_0x2c91a9){if(_0x2c91a9){return _0x2c91a9[_0x0825('0x2f')](_0x239bb6)['then'](function(_0x403dff){return _0x403dff;});}return null;};}function removeEntity(_0x1d84dc,_0x49059f){return function(_0x2941e){if(_0x2941e){return _0x2941e['destroy']()[_0x0825('0x1c')](function(){_0x1d84dc[_0x0825('0x2b')](0xcc)[_0x0825('0x30')]();});}};}function handleEntityNotFound(_0x3a69ba,_0x21abf7){return function(_0x5712a3){if(!_0x5712a3){_0x3a69ba[_0x0825('0x26')](0x194);}return _0x5712a3;};}function handleError(_0x4b83bd,_0x4ef58d){_0x4ef58d=_0x4ef58d||0x1f4;return function(_0x5574b1){logger[_0x0825('0x21')](_0x5574b1[_0x0825('0x31')]);if(_0x5574b1[_0x0825('0x32')]){delete _0x5574b1[_0x0825('0x32')];}_0x4b83bd[_0x0825('0x2b')](_0x4ef58d)[_0x0825('0x33')](_0x5574b1);};}exports[_0x0825('0x34')]=function(_0xa27204,_0x4dd1dd){var _0x184c29={},_0x2c2745={},_0x40f234={'count':0x0,'rows':[]};var _0x1a671e=_[_0x0825('0x35')](db[_0x0825('0x36')][_0x0825('0x37')],function(_0x15eff4){return{'name':_0x15eff4['fieldName'],'type':_0x15eff4['type'][_0x0825('0x38')]};});_0x2c2745[_0x0825('0x39')]=_['map'](_0x1a671e,_0x0825('0x32'));_0x2c2745[_0x0825('0x3a')]=_[_0x0825('0x3b')](_0xa27204['query']);_0x2c2745[_0x0825('0x3c')]=_[_0x0825('0x3d')](_0x2c2745['model'],_0x2c2745[_0x0825('0x3a')]);_0x184c29['attributes']=_[_0x0825('0x3d')](_0x2c2745['model'],qs[_0x0825('0x3e')](_0xa27204[_0x0825('0x3a')]['fields']));_0x184c29[_0x0825('0x3f')]=_0x184c29[_0x0825('0x3f')][_0x0825('0x40')]?_0x184c29[_0x0825('0x3f')]:_0x2c2745[_0x0825('0x39')];if(!_0xa27204[_0x0825('0x3a')][_0x0825('0x41')](_0x0825('0x42'))){_0x184c29['limit']=qs[_0x0825('0x29')](_0xa27204[_0x0825('0x3a')][_0x0825('0x29')]);_0x184c29[_0x0825('0x28')]=qs[_0x0825('0x28')](_0xa27204[_0x0825('0x3a')][_0x0825('0x28')]);}_0x184c29['order']=qs[_0x0825('0x43')](_0xa27204['query'][_0x0825('0x43')]);_0x184c29[_0x0825('0x44')]=qs[_0x0825('0x3c')](_[_0x0825('0x45')](_0xa27204['query'],_0x2c2745[_0x0825('0x3c')]),_0x1a671e);if(_0xa27204[_0x0825('0x3a')][_0x0825('0x46')]){_0x184c29[_0x0825('0x44')]=_[_0x0825('0x47')](_0x184c29[_0x0825('0x44')],{'$or':_[_0x0825('0x35')](_0x1a671e,function(_0x37ded4){if(_0x37ded4[_0x0825('0x48')]!==_0x0825('0x49')){var _0x4d44c0={};_0x4d44c0[_0x37ded4['name']]={'$like':'%'+_0xa27204[_0x0825('0x3a')][_0x0825('0x46')]+'%'};return _0x4d44c0;}})});}_0x184c29=_[_0x0825('0x47')]({},_0x184c29,_0xa27204['options']);var _0x5612cc={'where':_0x184c29[_0x0825('0x44')]};return db[_0x0825('0x36')][_0x0825('0x2a')](_0x5612cc)[_0x0825('0x1c')](function(_0x837662){_0x40f234['count']=_0x837662;if(_0xa27204[_0x0825('0x3a')][_0x0825('0x4a')]){_0x184c29[_0x0825('0x4b')]=[{'all':!![]}];}return db[_0x0825('0x36')][_0x0825('0x4c')](_0x184c29);})[_0x0825('0x1c')](function(_0x34822b){_0x40f234[_0x0825('0x4d')]=_0x34822b;return _0x40f234;})[_0x0825('0x1c')](respondWithFilteredResult(_0x4dd1dd,_0x184c29))[_0x0825('0x25')](handleError(_0x4dd1dd,null));};exports[_0x0825('0x4e')]=function(_0x2ec373,_0x2d2916){var _0x569886={'raw':!![],'where':{'id':_0x2ec373['params']['id']}},_0x5b1b65={};_0x5b1b65[_0x0825('0x39')]=_[_0x0825('0x3b')](db[_0x0825('0x36')][_0x0825('0x37')]);_0x5b1b65[_0x0825('0x3a')]=_[_0x0825('0x3b')](_0x2ec373[_0x0825('0x3a')]);_0x5b1b65[_0x0825('0x3c')]=_['intersection'](_0x5b1b65[_0x0825('0x39')],_0x5b1b65[_0x0825('0x3a')]);_0x569886[_0x0825('0x3f')]=_[_0x0825('0x3d')](_0x5b1b65['model'],qs[_0x0825('0x3e')](_0x2ec373[_0x0825('0x3a')][_0x0825('0x3e')]));_0x569886[_0x0825('0x3f')]=_0x569886[_0x0825('0x3f')][_0x0825('0x40')]?_0x569886['attributes']:_0x5b1b65[_0x0825('0x39')];if(_0x2ec373[_0x0825('0x3a')][_0x0825('0x4a')]){_0x569886[_0x0825('0x4b')]=[{'all':!![]}];}_0x569886=_[_0x0825('0x47')]({},_0x569886,_0x2ec373[_0x0825('0x4f')]);return db[_0x0825('0x36')]['find'](_0x569886)[_0x0825('0x1c')](handleEntityNotFound(_0x2d2916,null))[_0x0825('0x1c')](respondWithResult(_0x2d2916,null))[_0x0825('0x25')](handleError(_0x2d2916,null));};exports[_0x0825('0x50')]=function(_0x44486e,_0x27c962){return db[_0x0825('0x36')][_0x0825('0x50')](_0x44486e['body'],{})['then'](respondWithResult(_0x27c962,0xc9))[_0x0825('0x25')](handleError(_0x27c962,null));};exports[_0x0825('0x2f')]=function(_0x3038c1,_0x17b7d1){if(_0x3038c1[_0x0825('0x51')]['id']){delete _0x3038c1[_0x0825('0x51')]['id'];}return db['WhatsappMessage'][_0x0825('0x52')]({'where':{'id':_0x3038c1[_0x0825('0x53')]['id']}})['then'](handleEntityNotFound(_0x17b7d1,null))['then'](saveUpdates(_0x3038c1[_0x0825('0x51')],null))[_0x0825('0x1c')](respondWithResult(_0x17b7d1,null))[_0x0825('0x25')](handleError(_0x17b7d1,null));};exports[_0x0825('0x54')]=function(_0x265c75,_0x3bb0ad){return db[_0x0825('0x36')][_0x0825('0x52')]({'where':{'id':_0x265c75[_0x0825('0x53')]['id']}})[_0x0825('0x1c')](handleEntityNotFound(_0x3bb0ad,null))['then'](removeEntity(_0x3bb0ad,null))[_0x0825('0x25')](handleError(_0x3bb0ad,null));};exports['describe']=function(_0x210d11,_0x16e62a){return db['WhatsappMessage'][_0x0825('0x55')]()[_0x0825('0x1c')](respondWithResult(_0x16e62a,null))[_0x0825('0x25')](handleError(_0x16e62a,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x0825('0x56')]=function(_0x422989,_0x3e1ade,_0x513b48){var _0x46e6ee={'agent':{},'channel':'whatsapp'};if(_0x422989[_0x0825('0x51')]['id']){delete _0x422989[_0x0825('0x51')]['id'];}_0x422989['body']['read']=!![];_0x422989[_0x0825('0x51')][_0x0825('0x57')]=moment()[_0x0825('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x422989['body']['UserId']=_0x422989[_0x0825('0x51')][_0x0825('0x59')]||_0x422989[_0x0825('0x5a')]['id'];_0x46e6ee[_0x0825('0x5b')]['id']=_0x422989[_0x0825('0x51')]['UserId'];return db[_0x0825('0x36')][_0x0825('0x52')]({'where':{'id':_0x422989[_0x0825('0x53')]['id'],'UserId':null}})[_0x0825('0x1c')](handleEntityNotFound(_0x3e1ade,null))[_0x0825('0x1c')](saveUpdates(_0x422989[_0x0825('0x51')],null))[_0x0825('0x1c')](function(_0xca48f7){if(_0xca48f7){_0x46e6ee[_0x0825('0x22')]=_0xca48f7[_0x0825('0x5c')]({'plain':!![]});return db[_0x0825('0x5d')][_0x0825('0x52')]({'where':{'id':_0xca48f7['WhatsappInteractionId']}});}return null;})[_0x0825('0x1c')](handleEntityNotFound(_0x3e1ade,null))[_0x0825('0x1c')](function(_0x45bfed){if(_0x45bfed){return _0x45bfed['update']({'UserId':_0x422989[_0x0825('0x51')][_0x0825('0x59')],'read1stAt':_[_0x0825('0x5e')](_0x45bfed[_0x0825('0x5f')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x2d940d){if(_0x2d940d){_0x46e6ee[_0x0825('0x60')]=_0x2d940d[_0x0825('0x5c')]({'plain':!![]});interaction_log[_0x0825('0x23')](_0x0825('0x61'),_0x422989[_0x0825('0x5a')]['id'],_0x422989[_0x0825('0x5a')][_0x0825('0x32')],_0x422989[_0x0825('0x5a')][_0x0825('0x62')],_0x46e6ee[_0x0825('0x60')]['id'],_0x422989['body']?JSON[_0x0825('0x20')](_0x422989['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x0825('0x63'),_0x46e6ee);}return null;})[_0x0825('0x1c')](function(_0x550b64){var _0x1335ef=_0x0825('0x64')+_0x550b64[_0x0825('0x22')][_0x0825('0x65')];return db[_0x0825('0x66')][_0x0825('0x3a')](_0x1335ef,{'type':db[_0x0825('0x67')][_0x0825('0x68')][_0x0825('0x69')],'raw':!![]})['then'](function(_0x19bb83){return _0x19bb83;});})[_0x0825('0x1c')](function(_0x5b1750){if(_0x5b1750){_0x46e6ee['message'][_0x0825('0x6a')]=_0x5b1750[0x0];if(!_0x422989[_0x0825('0x51')][_0x0825('0x59')])return;return db['User'][_0x0825('0x52')]({'where':{'id':_0x422989[_0x0825('0x51')]['UserId'],'role':_0x0825('0x5b')},'attributes':['id',_0x0825('0x32'),'fullname',_0x0825('0x6b'),'internal'],'raw':!![]});}return null;})[_0x0825('0x1c')](function(_0x5b3628){if(!_0x5b3628)return null;_0x46e6ee[_0x0825('0x22')]['agent']=_0x5b3628;return _0x46e6ee;})[_0x0825('0x1c')](function(_0x4510ca){if(_0x4510ca){if(_0x422989['body']['manual']){_0x46e6ee[_0x0825('0x22')][_0x0825('0x6c')]=util['format'](_0x0825('0x6d'),_0x422989[_0x0825('0x5a')][_0x0825('0x32')]);_0x46e6ee[_0x0825('0x22')][_0x0825('0x6e')]=_0x46e6ee[_0x0825('0x6e')];_0x46e6ee[_0x0825('0x22')][_0x0825('0x6f')]=_0x46e6ee[_0x0825('0x6e')];_0x46e6ee[_0x0825('0x22')][_0x0825('0x70')]=_0x0825('0x56');return respondWithRpcPromise(_0x0825('0x71'),_0x0825('0x71'),{'event':_0x0825('0x72'),'message':_0x46e6ee[_0x0825('0x22')]},client9002)[_0x0825('0x1c')](function(){return _0x46e6ee;});}return _0x46e6ee;}return null;})[_0x0825('0x1c')](respondWithResult(_0x3e1ade,null))[_0x0825('0x25')](handleError(_0x3e1ade,null));};var interaction_log=require(_0x0825('0x73'))(_0x0825('0x74'));exports[_0x0825('0x2d')]=function(_0x3512e0,_0x4aaf9c,_0x2624a1){var _0x2c07b4={'agent':{},'channel':_0x0825('0x75')};if(_0x3512e0[_0x0825('0x51')]['id']){delete _0x3512e0['body']['id'];}_0x3512e0[_0x0825('0x51')][_0x0825('0x59')]=_0x3512e0['body'][_0x0825('0x59')]||_0x3512e0[_0x0825('0x5a')]['id'];_0x2c07b4[_0x0825('0x5b')]['id']=_0x3512e0['body'][_0x0825('0x59')];return db['WhatsappMessage'][_0x0825('0x52')]({'where':{'id':_0x3512e0[_0x0825('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4aaf9c,null))['then'](function(_0x55c744){if(_0x55c744){_0x2c07b4[_0x0825('0x22')]=_0x55c744[_0x0825('0x5c')]({'plain':!![]});return db[_0x0825('0x5d')][_0x0825('0x52')]({'where':{'id':_0x55c744[_0x0825('0x76')]}});}return null;})[_0x0825('0x1c')](handleEntityNotFound(_0x4aaf9c,null))[_0x0825('0x1c')](function(_0x166e33){if(_0x166e33){_0x2c07b4['interaction']=_0x166e33[_0x0825('0x5c')]({'plain':!![]});interaction_log[_0x0825('0x23')](_0x0825('0x77'),_0x3512e0[_0x0825('0x5a')]['id'],_0x3512e0[_0x0825('0x5a')]['name'],_0x3512e0['user']['role'],_0x2c07b4[_0x0825('0x60')]['id'],_0x3512e0['body']?JSON[_0x0825('0x20')](_0x3512e0[_0x0825('0x51')]):'null');return respondWithRpcPromise(_0x0825('0x78'),_0x0825('0x79'),_0x2c07b4);}return null;})[_0x0825('0x1c')](function(_0x29d9e0){var _0x8cd2c3=_0x0825('0x64')+_0x29d9e0[_0x0825('0x22')]['ContactId'];return db[_0x0825('0x66')][_0x0825('0x3a')](_0x8cd2c3,{'type':db[_0x0825('0x67')][_0x0825('0x68')][_0x0825('0x69')],'raw':!![]})[_0x0825('0x1c')](function(_0x49e907){return _0x49e907;});})[_0x0825('0x1c')](function(_0x117265){if(_0x117265){_0x2c07b4[_0x0825('0x22')][_0x0825('0x6a')]=_0x117265[0x0];if(!_0x3512e0['body'][_0x0825('0x59')])return;return db[_0x0825('0x7a')][_0x0825('0x52')]({'where':{'id':_0x3512e0[_0x0825('0x51')][_0x0825('0x59')],'role':_0x0825('0x5b')},'attributes':['id',_0x0825('0x32'),_0x0825('0x7b'),'email',_0x0825('0x7c')],'raw':!![]});}return null;})['then'](function(_0x615243){if(!_0x615243)return null;_0x2c07b4[_0x0825('0x22')][_0x0825('0x5b')]=_0x615243;return _0x2c07b4;})['then'](function(_0x83b8b){if(_0x83b8b){_0x83b8b[_0x0825('0x22')][_0x0825('0x6c')]=util[_0x0825('0x58')](_0x0825('0x6d'),_0x3512e0[_0x0825('0x5a')][_0x0825('0x32')]);_0x83b8b[_0x0825('0x22')]['channel']=_0x2c07b4[_0x0825('0x6e')];_0x83b8b[_0x0825('0x22')][_0x0825('0x6f')]=_0x2c07b4['channel'];_0x83b8b['message'][_0x0825('0x70')]=_0x0825('0x2d');respondWithRpcPromise('EventManager',_0x0825('0x71'),{'event':_0x0825('0x7d'),'message':_0x83b8b[_0x0825('0x22')]},client9002);return _0x2c07b4;}return null;})[_0x0825('0x1c')](respondWithResult(_0x4aaf9c,null))[_0x0825('0x25')](handleError(_0x4aaf9c,null));};exports[_0x0825('0x2b')]=function(_0x300211,_0xf109ac,_0x406492){if(_0x300211[_0x0825('0x51')]['id']){delete _0x300211['body']['id'];}var _0xa32e7e;return db[_0x0825('0x36')][_0x0825('0x52')]({'where':{'id':_0x300211[_0x0825('0x53')]['id']}})[_0x0825('0x1c')](handleEntityNotFound(_0xf109ac,null))['then'](function(_0x59fe09){if(_0x59fe09){_0xa32e7e=_0x59fe09;return db[_0x0825('0x7e')]['find']({'where':{'id':_0x59fe09[_0x0825('0x7f')]}});}})['then'](handleEntityNotFound(_0xf109ac,null))[_0x0825('0x1c')](function(_0x163cc0){if(_0x163cc0){logger[_0x0825('0x1f')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x0825('0x2b'),_0x0825('0x80'),_0x163cc0['type'],util[_0x0825('0x81')](_0x300211[_0x0825('0x51')],{'showHidden':![],'depth':null}));switch(_0x163cc0[_0x0825('0x48')]){case _0x0825('0x82'):if(_0x300211[_0x0825('0x51')][_0x0825('0x83')]&&_0x300211[_0x0825('0x51')][_0x0825('0x83')]===_0xa32e7e[_0x0825('0x84')]&&_0x300211[_0x0825('0x51')]['MessageStatus']&&_0x300211['body'][_0x0825('0x85')]===_0x0825('0x86')){return _0xa32e7e[_0x0825('0x2f')]({'read':!![]});}else{logger[_0x0825('0x21')](_0x0825('0x87'),_0x0825('0x2b'),_0x0825('0x82'),util['inspect'](_0x300211['body'],{'showHidden':![],'depth':null}));}break;}return _0xa32e7e;}})[_0x0825('0x1c')](respondWithResult(_0xf109ac,null))['catch'](handleError(_0xf109ac,null));}; \ No newline at end of file +var _0x7bca=['key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','show','params','keys','include','options','find','create','body','destroy','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','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','QueryTypes','SELECT','contact','fullname','internal','agent','interface','SIP/%s','channel','event','EventManager','reject','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','sequelize','Sequelize','User','email','motionChannel','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','request','then','info','debug','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type'];(function(_0x5a65c1,_0xea1e75){var _0x346660=function(_0xa352ae){while(--_0xa352ae){_0x5a65c1['push'](_0x5a65c1['shift']());}};_0x346660(++_0xea1e75);}(_0x7bca,0x16c));var _0xa7bc=function(_0x21dc70,_0x287214){_0x21dc70=_0x21dc70-0x0;var _0x47e638=_0x7bca[_0x21dc70];return _0x47e638;};'use strict';var emlformat=require(_0xa7bc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa7bc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa7bc('0x2'));var moment=require(_0xa7bc('0x3'));var BPromise=require(_0xa7bc('0x4'));var Mustache=require(_0xa7bc('0x5'));var util=require('util');var path=require('path');var sox=require(_0xa7bc('0x6'));var csv=require('to-csv');var ejs=require(_0xa7bc('0x7'));var fs=require('fs');var fs_extra=require(_0xa7bc('0x8'));var _=require(_0xa7bc('0x9'));var squel=require(_0xa7bc('0xa'));var crypto=require(_0xa7bc('0xb'));var jsforce=require(_0xa7bc('0xc'));var deskjs=require(_0xa7bc('0xd'));var toCsv=require(_0xa7bc('0xe'));var querystring=require('querystring');var Papa=require(_0xa7bc('0xf'));var Redis=require(_0xa7bc('0x10'));var authService=require(_0xa7bc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa7bc('0x12'));var hardwareService=require(_0xa7bc('0x13'));var logger=require(_0xa7bc('0x14'))(_0xa7bc('0x15'));var utils=require(_0xa7bc('0x16'));var config=require(_0xa7bc('0x17'));var licenseUtil=require(_0xa7bc('0x18'));var db=require('../../mysqldb')['db'];config[_0xa7bc('0x19')]=_['defaults'](config[_0xa7bc('0x19')],{'host':_0xa7bc('0x1a'),'port':0x18eb});var socket=require(_0xa7bc('0x1b'))(new Redis(config[_0xa7bc('0x19')]));require(_0xa7bc('0x1c'))['register'](socket);var jayson=require(_0xa7bc('0x1d'));var client=jayson[_0xa7bc('0x1e')][_0xa7bc('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xa7bc('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x446251,_0x62c361,_0x4e43ed,_0x34df25){return new BPromise(function(_0x557618,_0x3e9ecd){var _0x5eb449=_0x34df25||client;return _0x5eb449[_0xa7bc('0x20')](_0x446251,_0x4e43ed)[_0xa7bc('0x21')](function(_0x25e1db){logger[_0xa7bc('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x62c361,'request\x20sent');logger[_0xa7bc('0x23')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x62c361,'request\x20sent',JSON[_0xa7bc('0x24')](_0x25e1db));if(_0x25e1db[_0xa7bc('0x25')]){if(_0x25e1db['error'][_0xa7bc('0x26')]===0x1f4){logger[_0xa7bc('0x25')](_0xa7bc('0x27'),_0x62c361,_0x25e1db[_0xa7bc('0x25')]['message']);return _0x3e9ecd(_0x25e1db[_0xa7bc('0x25')]['message']);}logger['error'](_0xa7bc('0x27'),_0x62c361,_0x25e1db['error'][_0xa7bc('0x28')]);return _0x557618(_0x25e1db[_0xa7bc('0x25')]['message']);}else{logger[_0xa7bc('0x22')](_0xa7bc('0x27'),_0x62c361,_0xa7bc('0x29'));_0x557618(_0x25e1db[_0xa7bc('0x2a')][_0xa7bc('0x28')]);}})[_0xa7bc('0x2b')](function(_0x51c53a){logger[_0xa7bc('0x25')](_0xa7bc('0x27'),_0x62c361,_0x51c53a);_0x3e9ecd(_0x51c53a);});});}function respondWithStatusCode(_0x46462c,_0xb57d84){_0xb57d84=_0xb57d84||0xcc;return function(_0x2e68e7){if(_0x2e68e7){return _0x46462c[_0xa7bc('0x2c')](_0xb57d84);}return _0x46462c[_0xa7bc('0x2d')](_0xb57d84)[_0xa7bc('0x2e')]();};}function respondWithResult(_0x435429,_0x5a79e7){_0x5a79e7=_0x5a79e7||0xc8;return function(_0xe57b72){if(_0xe57b72){return _0x435429[_0xa7bc('0x2d')](_0x5a79e7)[_0xa7bc('0x2f')](_0xe57b72);}};}function respondWithFilteredResult(_0x2889a8,_0x4ece3d){return function(_0x34bc37){if(_0x34bc37){var _0x587f2c=typeof _0x4ece3d[_0xa7bc('0x30')]==='undefined'&&typeof _0x4ece3d[_0xa7bc('0x31')]===_0xa7bc('0x32');var _0xfb6e9c=_0x34bc37['count'];var _0x4766ba=_0x587f2c?0x0:_0x4ece3d[_0xa7bc('0x30')];var _0x2105ab=_0x587f2c?_0x34bc37[_0xa7bc('0x33')]:_0x4ece3d[_0xa7bc('0x30')]+_0x4ece3d[_0xa7bc('0x31')];var _0x185e42;if(_0x2105ab>=_0xfb6e9c){_0x2105ab=_0xfb6e9c;_0x185e42=0xc8;}else{_0x185e42=0xce;}_0x2889a8['status'](_0x185e42);return _0x2889a8[_0xa7bc('0x34')](_0xa7bc('0x35'),_0x4766ba+'-'+_0x2105ab+'/'+_0xfb6e9c)[_0xa7bc('0x2f')](_0x34bc37);}return null;};}function patchUpdates(_0x53ad0b){return function(_0x525501){try{jsonpatch[_0xa7bc('0x36')](_0x525501,_0x53ad0b,!![]);}catch(_0x14a4ac){return BPromise['reject'](_0x14a4ac);}return _0x525501['save']();};}function saveUpdates(_0x3a62be,_0x567e7f){return function(_0x1a1c16){if(_0x1a1c16){return _0x1a1c16[_0xa7bc('0x37')](_0x3a62be)[_0xa7bc('0x21')](function(_0x4888e8){return _0x4888e8;});}return null;};}function removeEntity(_0x3cb823,_0xca8d00){return function(_0x33385f){if(_0x33385f){return _0x33385f['destroy']()[_0xa7bc('0x21')](function(){_0x3cb823[_0xa7bc('0x2d')](0xcc)[_0xa7bc('0x2e')]();});}};}function handleEntityNotFound(_0x127d2c,_0x1b9384){return function(_0x460f0b){if(!_0x460f0b){_0x127d2c['sendStatus'](0x194);}return _0x460f0b;};}function handleError(_0xf47fb,_0x501558){_0x501558=_0x501558||0x1f4;return function(_0x4a9b89){logger[_0xa7bc('0x25')](_0x4a9b89[_0xa7bc('0x38')]);if(_0x4a9b89[_0xa7bc('0x39')]){delete _0x4a9b89['name'];}_0xf47fb[_0xa7bc('0x2d')](_0x501558)[_0xa7bc('0x3a')](_0x4a9b89);};}exports[_0xa7bc('0x3b')]=function(_0x5a6445,_0x27d423){var _0x3dfe66={},_0x4126f4={},_0x100e61={'count':0x0,'rows':[]};var _0x2023b5=_[_0xa7bc('0x3c')](db[_0xa7bc('0x3d')][_0xa7bc('0x3e')],function(_0x4ab2f4){return{'name':_0x4ab2f4[_0xa7bc('0x3f')],'type':_0x4ab2f4[_0xa7bc('0x40')][_0xa7bc('0x41')]};});_0x4126f4['model']=_['map'](_0x2023b5,_0xa7bc('0x39'));_0x4126f4[_0xa7bc('0x42')]=_['keys'](_0x5a6445[_0xa7bc('0x42')]);_0x4126f4[_0xa7bc('0x43')]=_[_0xa7bc('0x44')](_0x4126f4[_0xa7bc('0x45')],_0x4126f4[_0xa7bc('0x42')]);_0x3dfe66[_0xa7bc('0x46')]=_[_0xa7bc('0x44')](_0x4126f4['model'],qs[_0xa7bc('0x47')](_0x5a6445[_0xa7bc('0x42')][_0xa7bc('0x47')]));_0x3dfe66['attributes']=_0x3dfe66['attributes'][_0xa7bc('0x48')]?_0x3dfe66['attributes']:_0x4126f4['model'];if(!_0x5a6445[_0xa7bc('0x42')][_0xa7bc('0x49')](_0xa7bc('0x4a'))){_0x3dfe66['limit']=qs['limit'](_0x5a6445[_0xa7bc('0x42')][_0xa7bc('0x31')]);_0x3dfe66[_0xa7bc('0x30')]=qs[_0xa7bc('0x30')](_0x5a6445[_0xa7bc('0x42')][_0xa7bc('0x30')]);}_0x3dfe66['order']=qs[_0xa7bc('0x4b')](_0x5a6445[_0xa7bc('0x42')][_0xa7bc('0x4b')]);_0x3dfe66[_0xa7bc('0x4c')]=qs['filters'](_[_0xa7bc('0x4d')](_0x5a6445[_0xa7bc('0x42')],_0x4126f4[_0xa7bc('0x43')]),_0x2023b5);if(_0x5a6445['query'][_0xa7bc('0x4e')]){_0x3dfe66['where']=_[_0xa7bc('0x4f')](_0x3dfe66['where'],{'$or':_[_0xa7bc('0x3c')](_0x2023b5,function(_0x4fc7df){if(_0x4fc7df[_0xa7bc('0x40')]!==_0xa7bc('0x50')){var _0x1aafd2={};_0x1aafd2[_0x4fc7df[_0xa7bc('0x39')]]={'$like':'%'+_0x5a6445[_0xa7bc('0x42')][_0xa7bc('0x4e')]+'%'};return _0x1aafd2;}})});}_0x3dfe66=_['merge']({},_0x3dfe66,_0x5a6445['options']);var _0x325c31={'where':_0x3dfe66[_0xa7bc('0x4c')]};return db[_0xa7bc('0x3d')]['count'](_0x325c31)[_0xa7bc('0x21')](function(_0x34ce8b){_0x100e61[_0xa7bc('0x33')]=_0x34ce8b;if(_0x5a6445[_0xa7bc('0x42')][_0xa7bc('0x51')]){_0x3dfe66['include']=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x3dfe66);})[_0xa7bc('0x21')](function(_0xb39df0){_0x100e61[_0xa7bc('0x52')]=_0xb39df0;return _0x100e61;})[_0xa7bc('0x21')](respondWithFilteredResult(_0x27d423,_0x3dfe66))[_0xa7bc('0x2b')](handleError(_0x27d423,null));};exports[_0xa7bc('0x53')]=function(_0x48b817,_0x4e4d96){var _0x30ccf5={'raw':!![],'where':{'id':_0x48b817[_0xa7bc('0x54')]['id']}},_0x5aa323={};_0x5aa323[_0xa7bc('0x45')]=_[_0xa7bc('0x55')](db['WhatsappMessage']['rawAttributes']);_0x5aa323['query']=_[_0xa7bc('0x55')](_0x48b817[_0xa7bc('0x42')]);_0x5aa323[_0xa7bc('0x43')]=_['intersection'](_0x5aa323['model'],_0x5aa323['query']);_0x30ccf5[_0xa7bc('0x46')]=_['intersection'](_0x5aa323[_0xa7bc('0x45')],qs[_0xa7bc('0x47')](_0x48b817['query'][_0xa7bc('0x47')]));_0x30ccf5[_0xa7bc('0x46')]=_0x30ccf5['attributes']['length']?_0x30ccf5['attributes']:_0x5aa323[_0xa7bc('0x45')];if(_0x48b817[_0xa7bc('0x42')][_0xa7bc('0x51')]){_0x30ccf5[_0xa7bc('0x56')]=[{'all':!![]}];}_0x30ccf5=_[_0xa7bc('0x4f')]({},_0x30ccf5,_0x48b817[_0xa7bc('0x57')]);return db[_0xa7bc('0x3d')][_0xa7bc('0x58')](_0x30ccf5)[_0xa7bc('0x21')](handleEntityNotFound(_0x4e4d96,null))['then'](respondWithResult(_0x4e4d96,null))['catch'](handleError(_0x4e4d96,null));};exports[_0xa7bc('0x59')]=function(_0x1a6086,_0x58f889){return db[_0xa7bc('0x3d')][_0xa7bc('0x59')](_0x1a6086[_0xa7bc('0x5a')],{})['then'](respondWithResult(_0x58f889,0xc9))[_0xa7bc('0x2b')](handleError(_0x58f889,null));};exports['update']=function(_0x5a0d7a,_0x5262ac){if(_0x5a0d7a[_0xa7bc('0x5a')]['id']){delete _0x5a0d7a[_0xa7bc('0x5a')]['id'];}return db[_0xa7bc('0x3d')][_0xa7bc('0x58')]({'where':{'id':_0x5a0d7a[_0xa7bc('0x54')]['id']}})[_0xa7bc('0x21')](handleEntityNotFound(_0x5262ac,null))[_0xa7bc('0x21')](saveUpdates(_0x5a0d7a[_0xa7bc('0x5a')],null))[_0xa7bc('0x21')](respondWithResult(_0x5262ac,null))[_0xa7bc('0x2b')](handleError(_0x5262ac,null));};exports[_0xa7bc('0x5b')]=function(_0x72cfae,_0x52adff){return db[_0xa7bc('0x3d')]['find']({'where':{'id':_0x72cfae[_0xa7bc('0x54')]['id']}})[_0xa7bc('0x21')](handleEntityNotFound(_0x52adff,null))[_0xa7bc('0x21')](removeEntity(_0x52adff,null))[_0xa7bc('0x2b')](handleError(_0x52adff,null));};exports[_0xa7bc('0x5c')]=function(_0x564e5c,_0x3d5f37){return db['WhatsappMessage'][_0xa7bc('0x5c')]()[_0xa7bc('0x21')](respondWithResult(_0x3d5f37,null))[_0xa7bc('0x2b')](handleError(_0x3d5f37,null));};var interaction_log=require('../../config/logger')(_0xa7bc('0x5d'));exports[_0xa7bc('0x5e')]=function(_0xb89fc0,_0x62b3ce,_0x5703a0){var _0x3e1053={'agent':{},'channel':_0xa7bc('0x5f')};if(_0xb89fc0['body']['id']){delete _0xb89fc0[_0xa7bc('0x5a')]['id'];}_0xb89fc0[_0xa7bc('0x5a')][_0xa7bc('0x60')]=!![];_0xb89fc0[_0xa7bc('0x5a')][_0xa7bc('0x61')]=moment()[_0xa7bc('0x62')](_0xa7bc('0x63'));_0xb89fc0[_0xa7bc('0x5a')][_0xa7bc('0x64')]=_0xb89fc0[_0xa7bc('0x5a')][_0xa7bc('0x64')]||_0xb89fc0['user']['id'];_0x3e1053['agent']['id']=_0xb89fc0['body'][_0xa7bc('0x64')];return db[_0xa7bc('0x3d')]['find']({'where':{'id':_0xb89fc0[_0xa7bc('0x54')]['id'],'UserId':null}})[_0xa7bc('0x21')](handleEntityNotFound(_0x62b3ce,null))[_0xa7bc('0x21')](saveUpdates(_0xb89fc0[_0xa7bc('0x5a')],null))[_0xa7bc('0x21')](function(_0x14c095){if(_0x14c095){_0x3e1053['message']=_0x14c095[_0xa7bc('0x65')]({'plain':!![]});return db['WhatsappInteraction'][_0xa7bc('0x58')]({'where':{'id':_0x14c095[_0xa7bc('0x66')]}});}return null;})[_0xa7bc('0x21')](handleEntityNotFound(_0x62b3ce,null))['then'](function(_0x52ab14){if(_0x52ab14){return _0x52ab14[_0xa7bc('0x37')]({'UserId':_0xb89fc0[_0xa7bc('0x5a')][_0xa7bc('0x64')],'read1stAt':_[_0xa7bc('0x67')](_0x52ab14['read1stAt'])?moment()[_0xa7bc('0x62')](_0xa7bc('0x63')):undefined});}return null;})[_0xa7bc('0x21')](function(_0x36cd00){if(_0x36cd00){_0x3e1053[_0xa7bc('0x68')]=_0x36cd00['get']({'plain':!![]});interaction_log[_0xa7bc('0x22')](_0xa7bc('0x69'),_0xb89fc0[_0xa7bc('0x6a')]['id'],_0xb89fc0[_0xa7bc('0x6a')][_0xa7bc('0x39')],_0xb89fc0[_0xa7bc('0x6a')][_0xa7bc('0x6b')],_0x3e1053[_0xa7bc('0x68')]['id'],_0xb89fc0[_0xa7bc('0x5a')]?JSON[_0xa7bc('0x24')](_0xb89fc0[_0xa7bc('0x5a')]):_0xa7bc('0x6c'));return respondWithRpcPromise(_0xa7bc('0x6d'),_0xa7bc('0x6e'),_0x3e1053);}return null;})['then'](function(_0x21278c){var _0x124713=_0xa7bc('0x6f')+_0x21278c[_0xa7bc('0x28')]['ContactId'];return db['sequelize'][_0xa7bc('0x42')](_0x124713,{'type':db['Sequelize'][_0xa7bc('0x70')][_0xa7bc('0x71')],'raw':!![]})[_0xa7bc('0x21')](function(_0x53d8e0){return _0x53d8e0;});})['then'](function(_0x522f9f){if(_0x522f9f){_0x3e1053[_0xa7bc('0x28')][_0xa7bc('0x72')]=_0x522f9f[0x0];if(!_0xb89fc0[_0xa7bc('0x5a')][_0xa7bc('0x64')])return;return db['User'][_0xa7bc('0x58')]({'where':{'id':_0xb89fc0['body'][_0xa7bc('0x64')],'role':'agent'},'attributes':['id',_0xa7bc('0x39'),_0xa7bc('0x73'),'email',_0xa7bc('0x74')],'raw':!![]});}return null;})['then'](function(_0x2eeb02){if(!_0x2eeb02)return null;_0x3e1053[_0xa7bc('0x28')][_0xa7bc('0x75')]=_0x2eeb02;return _0x3e1053;})[_0xa7bc('0x21')](function(_0x512225){if(_0x512225){if(_0xb89fc0['body']['manual']){_0x3e1053['message'][_0xa7bc('0x76')]=util[_0xa7bc('0x62')](_0xa7bc('0x77'),_0xb89fc0['user'][_0xa7bc('0x39')]);_0x3e1053['message'][_0xa7bc('0x78')]=_0x3e1053[_0xa7bc('0x78')];_0x3e1053[_0xa7bc('0x28')]['motionChannel']=_0x3e1053['channel'];_0x3e1053[_0xa7bc('0x28')][_0xa7bc('0x79')]=_0xa7bc('0x5e');return respondWithRpcPromise(_0xa7bc('0x7a'),'EventManager',{'event':'acceptmessage','message':_0x3e1053[_0xa7bc('0x28')]},client9002)[_0xa7bc('0x21')](function(){return _0x3e1053;});}return _0x3e1053;}return null;})[_0xa7bc('0x21')](respondWithResult(_0x62b3ce,null))[_0xa7bc('0x2b')](handleError(_0x62b3ce,null));};var interaction_log=require('../../config/logger')(_0xa7bc('0x5d'));exports[_0xa7bc('0x7b')]=function(_0x4f6fc6,_0x24696f,_0x15fc9d){var _0x3935c4={'agent':{},'channel':_0xa7bc('0x5f')};if(_0x4f6fc6[_0xa7bc('0x5a')]['id']){delete _0x4f6fc6[_0xa7bc('0x5a')]['id'];}_0x4f6fc6[_0xa7bc('0x5a')][_0xa7bc('0x64')]=_0x4f6fc6['body'][_0xa7bc('0x64')]||_0x4f6fc6['user']['id'];_0x3935c4[_0xa7bc('0x75')]['id']=_0x4f6fc6[_0xa7bc('0x5a')][_0xa7bc('0x64')];return db[_0xa7bc('0x3d')][_0xa7bc('0x58')]({'where':{'id':_0x4f6fc6[_0xa7bc('0x54')]['id'],'UserId':null}})[_0xa7bc('0x21')](handleEntityNotFound(_0x24696f,null))[_0xa7bc('0x21')](function(_0x4df2b8){if(_0x4df2b8){_0x3935c4[_0xa7bc('0x28')]=_0x4df2b8[_0xa7bc('0x65')]({'plain':!![]});return db[_0xa7bc('0x7c')][_0xa7bc('0x58')]({'where':{'id':_0x4df2b8[_0xa7bc('0x66')]}});}return null;})[_0xa7bc('0x21')](handleEntityNotFound(_0x24696f,null))['then'](function(_0x2c533b){if(_0x2c533b){_0x3935c4[_0xa7bc('0x68')]=_0x2c533b['get']({'plain':!![]});interaction_log[_0xa7bc('0x22')](_0xa7bc('0x7d'),_0x4f6fc6[_0xa7bc('0x6a')]['id'],_0x4f6fc6['user'][_0xa7bc('0x39')],_0x4f6fc6[_0xa7bc('0x6a')][_0xa7bc('0x6b')],_0x3935c4[_0xa7bc('0x68')]['id'],_0x4f6fc6[_0xa7bc('0x5a')]?JSON[_0xa7bc('0x24')](_0x4f6fc6[_0xa7bc('0x5a')]):_0xa7bc('0x6c'));return respondWithRpcPromise(_0xa7bc('0x7e'),_0xa7bc('0x7f'),_0x3935c4);}return null;})[_0xa7bc('0x21')](function(_0x17b43e){var _0x17dc29=_0xa7bc('0x6f')+_0x17b43e['message'][_0xa7bc('0x80')];return db[_0xa7bc('0x81')]['query'](_0x17dc29,{'type':db[_0xa7bc('0x82')][_0xa7bc('0x70')][_0xa7bc('0x71')],'raw':!![]})[_0xa7bc('0x21')](function(_0x58d0b6){return _0x58d0b6;});})['then'](function(_0x35901f){if(_0x35901f){_0x3935c4[_0xa7bc('0x28')]['contact']=_0x35901f[0x0];if(!_0x4f6fc6[_0xa7bc('0x5a')][_0xa7bc('0x64')])return;return db[_0xa7bc('0x83')]['find']({'where':{'id':_0x4f6fc6[_0xa7bc('0x5a')]['UserId'],'role':_0xa7bc('0x75')},'attributes':['id',_0xa7bc('0x39'),_0xa7bc('0x73'),_0xa7bc('0x84'),'internal'],'raw':!![]});}return null;})[_0xa7bc('0x21')](function(_0x15293a){if(!_0x15293a)return null;_0x3935c4[_0xa7bc('0x28')][_0xa7bc('0x75')]=_0x15293a;return _0x3935c4;})[_0xa7bc('0x21')](function(_0x47c9fe){if(_0x47c9fe){_0x47c9fe[_0xa7bc('0x28')]['interface']=util[_0xa7bc('0x62')]('SIP/%s',_0x4f6fc6['user'][_0xa7bc('0x39')]);_0x47c9fe[_0xa7bc('0x28')][_0xa7bc('0x78')]=_0x3935c4[_0xa7bc('0x78')];_0x47c9fe[_0xa7bc('0x28')][_0xa7bc('0x85')]=_0x3935c4[_0xa7bc('0x78')];_0x47c9fe[_0xa7bc('0x28')][_0xa7bc('0x79')]='reject';respondWithRpcPromise(_0xa7bc('0x7a'),_0xa7bc('0x7a'),{'event':'rejectmessage','message':_0x47c9fe[_0xa7bc('0x28')]},client9002);return _0x3935c4;}return null;})[_0xa7bc('0x21')](respondWithResult(_0x24696f,null))['catch'](handleError(_0x24696f,null));};exports[_0xa7bc('0x2d')]=function(_0x157253,_0x21668c,_0x170577){if(_0x157253[_0xa7bc('0x5a')]['id']){delete _0x157253[_0xa7bc('0x5a')]['id'];}var _0x20db8b;return db['WhatsappMessage'][_0xa7bc('0x58')]({'where':{'id':_0x157253[_0xa7bc('0x54')]['id']}})[_0xa7bc('0x21')](handleEntityNotFound(_0x21668c,null))[_0xa7bc('0x21')](function(_0x24844f){if(_0x24844f){_0x20db8b=_0x24844f;return db[_0xa7bc('0x86')][_0xa7bc('0x58')]({'where':{'id':_0x24844f['WhatsappAccountId']}});}})[_0xa7bc('0x21')](handleEntityNotFound(_0x21668c,null))['then'](function(_0x3f8ad0){if(_0x3f8ad0){logger['debug'](_0xa7bc('0x87'),_0xa7bc('0x2d'),_0xa7bc('0x88'),_0x3f8ad0[_0xa7bc('0x40')],util[_0xa7bc('0x89')](_0x157253[_0xa7bc('0x5a')],{'showHidden':![],'depth':null}));switch(_0x3f8ad0['type']){case _0xa7bc('0x8a'):if(_0x157253['body'][_0xa7bc('0x8b')]&&_0x157253['body'][_0xa7bc('0x8b')]===_0x20db8b[_0xa7bc('0x8c')]&&_0x157253[_0xa7bc('0x5a')][_0xa7bc('0x8d')]&&_0x157253[_0xa7bc('0x5a')][_0xa7bc('0x8d')]===_0xa7bc('0x60')){return _0x20db8b['update']({'read':!![]});}else{logger[_0xa7bc('0x25')](_0xa7bc('0x8e'),_0xa7bc('0x2d'),_0xa7bc('0x8a'),util[_0xa7bc('0x89')](_0x157253['body'],{'showHidden':![],'depth':null}));}break;}return _0x20db8b;}})[_0xa7bc('0x21')](respondWithResult(_0x21668c,null))[_0xa7bc('0x2b')](handleError(_0x21668c,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 1eb9f89..275d9d8 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 _0x0abf=['hook','events','WhatsappMessage','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x2bd903,_0x356812){var _0x5b4e7f=function(_0x4bee61){while(--_0x4bee61){_0x2bd903['push'](_0x2bd903['shift']());}};_0x5b4e7f(++_0x356812);}(_0x0abf,0xe8));var _0xf0ab=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x0abf[_0x4cf98e];return _0x1623ac;};'use strict';var EventEmitter=require(_0xf0ab('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xf0ab('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf0ab('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf0ab('0x3')};function emitEvent(_0x4889fb){return function(_0x7ea4e0,_0x3be05e,_0x2efe43){WhatsappMessageEvents[_0xf0ab('0x4')](_0x4889fb+':'+_0x7ea4e0['id'],_0x7ea4e0);WhatsappMessageEvents[_0xf0ab('0x4')](_0x4889fb,_0x7ea4e0);_0x2efe43(null);};}for(var e in events){if(events[_0xf0ab('0x5')](e)){var event=events[e];WhatsappMessage[_0xf0ab('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x0bb5=['events','../../mysqldb','save','update','remove','emit','hook','exports'];(function(_0x21f3bf,_0xfb0f59){var _0x249d08=function(_0x37e6c2){while(--_0x37e6c2){_0x21f3bf['push'](_0x21f3bf['shift']());}};_0x249d08(++_0xfb0f59);}(_0x0bb5,0x148));var _0x50bb=function(_0x3ea8f0,_0x31fd18){_0x3ea8f0=_0x3ea8f0-0x0;var _0x54cc63=_0x0bb5[_0x3ea8f0];return _0x54cc63;};'use strict';var EventEmitter=require(_0x50bb('0x0'));var WhatsappMessage=require(_0x50bb('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x50bb('0x2'),'afterUpdate':_0x50bb('0x3'),'afterDestroy':_0x50bb('0x4')};function emitEvent(_0x117e36){return function(_0x29c72b,_0xfdc9d4,_0x451b4c){WhatsappMessageEvents[_0x50bb('0x5')](_0x117e36+':'+_0x29c72b['id'],_0x29c72b);WhatsappMessageEvents['emit'](_0x117e36,_0x29c72b);_0x451b4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x50bb('0x6')](e,emitEvent(event));}}module[_0x50bb('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 19c3b74..3890c43 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 _0xc8b5=['models','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','whatsapp:','remote','/api/whatsapp/messages/','token','sid','catch','error','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','sinch','/messages/','POST','Bearer\x20','application/json','statuses','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT'];(function(_0xad57ee,_0x2823a6){var _0x3eaea9=function(_0x185650){while(--_0x185650){_0xad57ee['push'](_0xad57ee['shift']());}};_0x3eaea9(++_0x2823a6);}(_0xc8b5,0x1bf));var _0x5c8b=function(_0x55ca92,_0x20f44e){_0x55ca92=_0x55ca92-0x0;var _0x3a7daa=_0xc8b5[_0x55ca92];return _0x3a7daa;};'use strict';var _=require('lodash');var util=require(_0x5c8b('0x0'));var logger=require(_0x5c8b('0x1'))(_0x5c8b('0x2'));var moment=require(_0x5c8b('0x3'));var BPromise=require(_0x5c8b('0x4'));var rp=require('request-promise');var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x5c8b('0x5'));var rimraf=require(_0x5c8b('0x6'));var config=require(_0x5c8b('0x7'));var attributes=require(_0x5c8b('0x8'));module[_0x5c8b('0x9')]=function(_0xc1d723,_0x745d59){return _0xc1d723[_0x5c8b('0xa')](_0x5c8b('0xb'),attributes,{'tableName':_0x5c8b('0xc'),'paranoid':![],'indexes':[{'name':_0x5c8b('0xd'),'fields':['messageId']},{'name':_0x5c8b('0xe'),'fields':[_0x5c8b('0xf')],'type':_0x5c8b('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x42bd8c,_0xe82fe2,_0x3cf5ad){var _0xb7cc5a=_0xc1d723[_0x5c8b('0x11')];var _0x173036=_0x42bd8c['get']({'plain':!![]});if(_0x173036[_0x5c8b('0x12')][_0x5c8b('0x13')]()==='in'||_0x173036[_0x5c8b('0x12')][_0x5c8b('0x13')]()===_0x5c8b('0x14')&&!_0x173036[_0x5c8b('0x15')]&&!_['isNil'](_0x173036[_0x5c8b('0x16')])){_0xb7cc5a[_0x5c8b('0x17')][_0x5c8b('0x18')]({'where':{'id':_0x173036[_0x5c8b('0x19')]}})[_0x5c8b('0x1a')](function(_0x366e5e){if(_0x366e5e){_0x366e5e[_0x5c8b('0x1b')]({'lastMsgAt':_0x173036[_0x5c8b('0x1c')],'lastMsgDirection':_0x173036[_0x5c8b('0x12')][_0x5c8b('0x13')]()});}})['catch'](function(_0x55ba84){console['error'](_0x55ba84);});}if(_0x173036[_0x5c8b('0x12')]===_0x5c8b('0x14')&&!_0x173036[_0x5c8b('0x15')]){var _0x293286;_0xb7cc5a[_0x5c8b('0x1d')][_0x5c8b('0x1e')]({'where':{'id':_0x173036[_0x5c8b('0x1f')]},'raw':!![]})[_0x5c8b('0x1a')](function(_0x5c3cc5){_0x293286=_0x5c3cc5;if(_0x293286&&_0x293286[_0x5c8b('0x20')]){switch(_0x293286[_0x5c8b('0x20')]){case _0x5c8b('0x21'):var _0x380f21=require(_0x5c8b('0x21'));if(_0x293286[_0x5c8b('0x22')]&&_0x293286[_0x5c8b('0x23')]&&_0x293286[_0x5c8b('0x24')]){var _0x4f08e5=new _0x380f21(_0x293286[_0x5c8b('0x22')],_0x293286[_0x5c8b('0x23')]);_0x4f08e5[_0x5c8b('0x25')]['create']({'body':_0x173036[_0x5c8b('0xf')],'to':_0x5c8b('0x26')+_0x173036[_0x5c8b('0x24')],'from':_0x5c8b('0x26')+_0x293286[_0x5c8b('0x24')],'statusCallback':_0x293286[_0x5c8b('0x27')]+_0x5c8b('0x28')+_0x173036['id']+'/status?token='+_0x293286[_0x5c8b('0x29')]})['then'](function(_0x2c85e5){if(_0x2c85e5[_0x5c8b('0x2a')]){return _0x42bd8c[_0x5c8b('0x1b')]({'messageId':_0x2c85e5['sid']});}})[_0x5c8b('0x2b')](function(_0x4a72df){logger[_0x5c8b('0x2c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5c8b('0x2d'),_0x5c8b('0x21'),util[_0x5c8b('0x2e')](_0x4a72df,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5c8b('0x2f'),_0x5c8b('0x2d'),_0x5c8b('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x5c8b('0x30'):var _0x24888b=_0x293286[_0x5c8b('0x22')];var _0x163c3d=_0x293286[_0x5c8b('0x23')];var _0x3ba293=_0x293286['baseUrl']+'/whatsapp/v1/'+_0x24888b+_0x5c8b('0x31');var _0x353747={'to':[_0x173036[_0x5c8b('0x24')]],'message':{'type':'text','text':_0x173036[_0x5c8b('0xf')]}};var _0x2ec1dc={'method':_0x5c8b('0x32'),'uri':_0x3ba293,'headers':{'Authorization':_0x5c8b('0x33')+_0x163c3d,'Content-Type':_0x5c8b('0x34')},'body':_0x353747,'json':!![]};rp(_0x2ec1dc)[_0x5c8b('0x1a')](function(_0x751bc9){if(_0x751bc9[_0x5c8b('0x35')][0x0]['message_id']){return _0x42bd8c[_0x5c8b('0x1b')]({'messageId':_0x751bc9[_0x5c8b('0x35')][0x0]['message_id']});}})[_0x5c8b('0x2b')](function(_0x7bacb2){logger[_0x5c8b('0x36')](_0x5c8b('0x37'),_0x7bacb2);});break;}}})[_0x5c8b('0x38')](function(){_0x3cf5ad();});}else{_0x3cf5ad();}}},'charset':'utf8mb4','collate':_0x5c8b('0x39')});}; \ No newline at end of file +var _0x8363=['Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','WhatsappInteractionId','then','error','WhatsappAccount','WhatsappAccountId','type','twilio','authToken','accountSid','messages','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8363,0x1a2));var _0x3836=function(_0x3eff16,_0x260fd5){_0x3eff16=_0x3eff16-0x0;var _0x1bed6f=_0x8363[_0x3eff16];return _0x1bed6f;};'use strict';var _=require(_0x3836('0x0'));var util=require(_0x3836('0x1'));var logger=require(_0x3836('0x2'))(_0x3836('0x3'));var moment=require(_0x3836('0x4'));var BPromise=require(_0x3836('0x5'));var rp=require(_0x3836('0x6'));var fetch=require(_0x3836('0x7'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3836('0x8'));var config=require(_0x3836('0x9'));var attributes=require('./whatsappMessage.attributes');module[_0x3836('0xa')]=function(_0x3db0c9,_0x404afc){return _0x3db0c9[_0x3836('0xb')](_0x3836('0xc'),attributes,{'tableName':_0x3836('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':'fti_whatsapp_messages','fields':[_0x3836('0xe')],'type':_0x3836('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x426481,_0xd9571,_0x3b0d09){var _0x5d715a=_0x3db0c9[_0x3836('0x10')];var _0xd2777b=_0x426481[_0x3836('0x11')]({'plain':!![]});if(_0xd2777b[_0x3836('0x12')][_0x3836('0x13')]()==='in'||_0xd2777b[_0x3836('0x12')][_0x3836('0x13')]()===_0x3836('0x14')&&!_0xd2777b[_0x3836('0x15')]&&!_['isNil'](_0xd2777b[_0x3836('0x16')])){_0x5d715a[_0x3836('0x17')]['findOne']({'where':{'id':_0xd2777b[_0x3836('0x18')]}})[_0x3836('0x19')](function(_0x56fc29){if(_0x56fc29){_0x56fc29['update']({'lastMsgAt':_0xd2777b['createdAt'],'lastMsgDirection':_0xd2777b['direction']['toLowerCase']()});}})['catch'](function(_0x1c6ab1){console[_0x3836('0x1a')](_0x1c6ab1);});}if(_0xd2777b[_0x3836('0x12')]===_0x3836('0x14')&&!_0xd2777b[_0x3836('0x15')]){var _0x257fa1;_0x5d715a[_0x3836('0x1b')]['find']({'where':{'id':_0xd2777b[_0x3836('0x1c')]},'raw':!![]})['then'](function(_0x143acc){_0x257fa1=_0x143acc;if(_0x257fa1&&_0x257fa1[_0x3836('0x1d')]){switch(_0x257fa1[_0x3836('0x1d')]){case _0x3836('0x1e'):var _0x39b194=require(_0x3836('0x1e'));if(_0x257fa1['accountSid']&&_0x257fa1[_0x3836('0x1f')]&&_0x257fa1['phone']){var _0x404397=new _0x39b194(_0x257fa1[_0x3836('0x20')],_0x257fa1['authToken']);_0x404397[_0x3836('0x21')]['create']({'body':_0xd2777b[_0x3836('0xe')],'to':_0x3836('0x22')+_0xd2777b['phone'],'from':_0x3836('0x22')+_0x257fa1[_0x3836('0x23')],'statusCallback':_0x257fa1[_0x3836('0x24')]+_0x3836('0x25')+_0xd2777b['id']+_0x3836('0x26')+_0x257fa1[_0x3836('0x27')]})[_0x3836('0x19')](function(_0x1c61da){if(_0x1c61da[_0x3836('0x28')]){return _0x426481[_0x3836('0x29')]({'messageId':_0x1c61da['sid']});}})[_0x3836('0x2a')](function(_0x45bb5d){logger[_0x3836('0x1a')](_0x3836('0x2b'),_0x3836('0x2c'),_0x3836('0x1e'),util[_0x3836('0x2d')](_0x45bb5d,{'showHidden':![],'depth':null}));});}else{logger[_0x3836('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',_0x3836('0x2e'));}break;case _0x3836('0x2f'):var _0x402685=_0x257fa1[_0x3836('0x20')];var _0x10a067=_0x257fa1['authToken'];var _0x5ad7f8=_0x257fa1[_0x3836('0x30')]+'/whatsapp/v1/'+_0x402685+_0x3836('0x31');var _0x433c5b={'to':[_0xd2777b[_0x3836('0x23')]],'message':{'type':_0x3836('0x32'),'text':_0xd2777b[_0x3836('0xe')]}};var _0x145f91={'method':_0x3836('0x33'),'uri':_0x5ad7f8,'headers':{'Authorization':_0x3836('0x34')+_0x10a067,'Content-Type':_0x3836('0x35')},'body':_0x433c5b,'json':!![]};rp(_0x145f91)[_0x3836('0x19')](function(_0x25798e){if(_0x25798e[_0x3836('0x36')][0x0]['message_id']){return _0x426481[_0x3836('0x29')]({'messageId':_0x25798e[_0x3836('0x36')][0x0][_0x3836('0x37')]});}})[_0x3836('0x2a')](function(_0x34a735){logger['err']('WhatsappMessage,\x20%s',_0x34a735);});break;}}})[_0x3836('0x38')](function(){_0x3b0d09();});}else{_0x3b0d09();}}},'charset':'utf8mb4','collate':_0x3836('0x39')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 9600c37..394c284 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 _0xa19a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x104f0e,_0x207f2d){var _0x322790=function(_0x42c6ce){while(--_0x42c6ce){_0x104f0e['push'](_0x104f0e['shift']());}};_0x322790(++_0x207f2d);}(_0xa19a,0x159));var _0xaa19=function(_0x28d08d,_0x13f714){_0x28d08d=_0x28d08d-0x0;var _0x1b8c4a=_0xa19a[_0x28d08d];return _0x1b8c4a;};'use strict';var _=require(_0xaa19('0x0'));var util=require(_0xaa19('0x1'));var moment=require(_0xaa19('0x2'));var BPromise=require(_0xaa19('0x3'));var rs=require(_0xaa19('0x4'));var fs=require('fs');var Redis=require(_0xaa19('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa19('0x6'));var logger=require(_0xaa19('0x7'))(_0xaa19('0x8'));var config=require(_0xaa19('0x9'));var jayson=require(_0xaa19('0xa'));var client=jayson[_0xaa19('0xb')]['http']({'port':0x232a});config[_0xaa19('0xc')]=_['defaults'](config[_0xaa19('0xc')],{'host':_0xaa19('0xd'),'port':0x18eb});var socket=require(_0xaa19('0xe'))(new Redis(config[_0xaa19('0xc')]));require(_0xaa19('0xf'))[_0xaa19('0x10')](socket);function respondWithRpcPromise(_0x2e6ff0,_0x1323ad,_0x143860){return new BPromise(function(_0x35052b,_0x59a562){return client['request'](_0x2e6ff0,_0x143860)[_0xaa19('0x11')](function(_0x18a7e8){logger[_0xaa19('0x12')](_0xaa19('0x13'),_0x1323ad,_0xaa19('0x14'));logger[_0xaa19('0x15')](_0xaa19('0x16'),_0x1323ad,_0xaa19('0x14'),JSON[_0xaa19('0x17')](_0x18a7e8));if(_0x18a7e8[_0xaa19('0x18')]){if(_0x18a7e8['error']['code']===0x1f4){logger[_0xaa19('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x1323ad,_0x18a7e8[_0xaa19('0x18')][_0xaa19('0x19')]);return _0x59a562(_0x18a7e8[_0xaa19('0x18')][_0xaa19('0x19')]);}logger[_0xaa19('0x18')](_0xaa19('0x13'),_0x1323ad,_0x18a7e8[_0xaa19('0x18')][_0xaa19('0x19')]);return _0x35052b(_0x18a7e8[_0xaa19('0x18')]['message']);}else{logger['info'](_0xaa19('0x13'),_0x1323ad,_0xaa19('0x14'));_0x35052b(_0x18a7e8['result'][_0xaa19('0x19')]);}})['catch'](function(_0x1cb277){logger[_0xaa19('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x1323ad,_0x1cb277);_0x59a562(_0x1cb277);});});}exports[_0xaa19('0x1a')]=function(_0xbaea6a){var _0x35a4a7=this;return new Promise(function(_0x46395d,_0x1c5d8f){return db[_0xaa19('0x1b')][_0xaa19('0x1c')](_0xbaea6a[_0xaa19('0x1d')],{'raw':_0xbaea6a['options']?_0xbaea6a[_0xaa19('0x1e')][_0xaa19('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x337850){logger[_0xaa19('0x12')](_0xaa19('0x1a'),_0xbaea6a);logger[_0xaa19('0x15')](_0xaa19('0x1a'),_0xbaea6a,JSON['stringify'](_0x337850));_0x46395d(_0x337850);})['catch'](function(_0x4e70fe){logger[_0xaa19('0x18')](_0xaa19('0x1a'),_0x4e70fe['message'],_0xbaea6a);_0x1c5d8f(_0x35a4a7['error'](0x1f4,_0x4e70fe['message']));});});}; \ No newline at end of file +var _0xac46=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateWhatsappMessage','create','body','options','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0xac46,0xf0));var _0x6ac4=function(_0x4214b6,_0x20fc0e){_0x4214b6=_0x4214b6-0x0;var _0x3378a1=_0xac46[_0x4214b6];return _0x3378a1;};'use strict';var _=require(_0x6ac4('0x0'));var util=require('util');var moment=require(_0x6ac4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ac4('0x2'));var db=require(_0x6ac4('0x3'))['db'];var utils=require(_0x6ac4('0x4'));var logger=require(_0x6ac4('0x5'))(_0x6ac4('0x6'));var config=require(_0x6ac4('0x7'));var jayson=require(_0x6ac4('0x8'));var client=jayson['client'][_0x6ac4('0x9')]({'port':0x232a});config[_0x6ac4('0xa')]=_[_0x6ac4('0xb')](config[_0x6ac4('0xa')],{'host':_0x6ac4('0xc'),'port':0x18eb});var socket=require(_0x6ac4('0xd'))(new Redis(config[_0x6ac4('0xa')]));require(_0x6ac4('0xe'))[_0x6ac4('0xf')](socket);function respondWithRpcPromise(_0x2637a3,_0x2822bd,_0x5a0dfe){return new BPromise(function(_0xac44ae,_0x2d5d22){return client['request'](_0x2637a3,_0x5a0dfe)[_0x6ac4('0x10')](function(_0x3964d7){logger[_0x6ac4('0x11')](_0x6ac4('0x12'),_0x2822bd,_0x6ac4('0x13'));logger[_0x6ac4('0x14')](_0x6ac4('0x15'),_0x2822bd,'request\x20sent',JSON[_0x6ac4('0x16')](_0x3964d7));if(_0x3964d7[_0x6ac4('0x17')]){if(_0x3964d7[_0x6ac4('0x17')]['code']===0x1f4){logger[_0x6ac4('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x2822bd,_0x3964d7[_0x6ac4('0x17')][_0x6ac4('0x18')]);return _0x2d5d22(_0x3964d7[_0x6ac4('0x17')][_0x6ac4('0x18')]);}logger[_0x6ac4('0x17')](_0x6ac4('0x12'),_0x2822bd,_0x3964d7[_0x6ac4('0x17')][_0x6ac4('0x18')]);return _0xac44ae(_0x3964d7[_0x6ac4('0x17')][_0x6ac4('0x18')]);}else{logger[_0x6ac4('0x11')](_0x6ac4('0x12'),_0x2822bd,_0x6ac4('0x13'));_0xac44ae(_0x3964d7[_0x6ac4('0x19')][_0x6ac4('0x18')]);}})[_0x6ac4('0x1a')](function(_0x18ed45){logger[_0x6ac4('0x17')](_0x6ac4('0x12'),_0x2822bd,_0x18ed45);_0x2d5d22(_0x18ed45);});});}exports[_0x6ac4('0x1b')]=function(_0x36f538){var _0xf22b7b=this;return new Promise(function(_0x5ded8d,_0x560ddc){return db['WhatsappMessage'][_0x6ac4('0x1c')](_0x36f538[_0x6ac4('0x1d')],{'raw':_0x36f538[_0x6ac4('0x1e')]?_0x36f538[_0x6ac4('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x6ac4('0x10')](function(_0x24c5aa){logger['info'](_0x6ac4('0x1b'),_0x36f538);logger[_0x6ac4('0x14')]('CreateWhatsappMessage',_0x36f538,JSON[_0x6ac4('0x16')](_0x24c5aa));_0x5ded8d(_0x24c5aa);})[_0x6ac4('0x1a')](function(_0x17813c){logger['error']('CreateWhatsappMessage',_0x17813c[_0x6ac4('0x18')],_0x36f538);_0x560ddc(_0xf22b7b[_0x6ac4('0x17')](0x1f4,_0x17813c[_0x6ac4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 8bf771c..b2cddea 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 _0xf16a=['update','emit','register','length','whatsappMessage:','./whatsappMessage.events','save','remove'];(function(_0x208505,_0x241a77){var _0x1a985f=function(_0x4a5110){while(--_0x4a5110){_0x208505['push'](_0x208505['shift']());}};_0x1a985f(++_0x241a77);}(_0xf16a,0x13d));var _0xaf16=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0xf16a[_0x492535];return _0x256620;};'use strict';var WhatsappMessageEvents=require(_0xaf16('0x0'));var events=[_0xaf16('0x1'),_0xaf16('0x2'),_0xaf16('0x3')];function createListener(_0x33badb,_0x5baa7e){return function(_0x13a0d5){_0x5baa7e[_0xaf16('0x4')](_0x33badb,_0x13a0d5);};}function removeListener(_0x2ccbaa,_0x2a8bdc){return function(){WhatsappMessageEvents['removeListener'](_0x2ccbaa,_0x2a8bdc);};}exports[_0xaf16('0x5')]=function(_0xdf7e0){for(var _0x15e823=0x0,_0x5a424f=events[_0xaf16('0x6')];_0x15e823<_0x5a424f;_0x15e823++){var _0xb8982d=events[_0x15e823];var _0x46a6a5=createListener(_0xaf16('0x7')+_0xb8982d,_0xdf7e0);WhatsappMessageEvents['on'](_0xb8982d,_0x46a6a5);}}; \ No newline at end of file +var _0x8664=['removeListener','register','length','whatsappMessage:','./whatsappMessage.events','remove','emit'];(function(_0x545668,_0x2f3396){var _0x13c99f=function(_0x48e719){while(--_0x48e719){_0x545668['push'](_0x545668['shift']());}};_0x13c99f(++_0x2f3396);}(_0x8664,0x1af));var _0x4866=function(_0xa703ae,_0x10771a){_0xa703ae=_0xa703ae-0x0;var _0x256944=_0x8664[_0xa703ae];return _0x256944;};'use strict';var WhatsappMessageEvents=require(_0x4866('0x0'));var events=['save',_0x4866('0x1'),'update'];function createListener(_0x5d8ca9,_0x22f0dc){return function(_0x44f3c1){_0x22f0dc[_0x4866('0x2')](_0x5d8ca9,_0x44f3c1);};}function removeListener(_0x524fe8,_0x16887c){return function(){WhatsappMessageEvents[_0x4866('0x3')](_0x524fe8,_0x16887c);};}exports[_0x4866('0x4')]=function(_0x204eba){for(var _0x37533e=0x0,_0x52dbde=events[_0x4866('0x5')];_0x37533e<_0x52dbde;_0x37533e++){var _0x1bd29d=events[_0x37533e];var _0x57d319=createListener(_0x4866('0x6')+_0x1bd29d,_0x204eba);WhatsappMessageEvents['on'](_0x1bd29d,_0x57d319);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index ba16652..c0ed0db 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 _0x4547=['describe','/:id','get','/:id/members','getMembers','/:id/teams','/:id/users','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe'];(function(_0x1a2c3b,_0x5f4b2b){var _0x576348=function(_0x29e22b){while(--_0x29e22b){_0x1a2c3b['push'](_0x1a2c3b['shift']());}};_0x576348(++_0x5f4b2b);}(_0x4547,0xf0));var _0x7454=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0x4547[_0x5cc8b9];return _0x58892e;};'use strict';var multer=require('multer');var util=require(_0x7454('0x0'));var path=require(_0x7454('0x1'));var timeout=require(_0x7454('0x2'));var express=require(_0x7454('0x3'));var router=express[_0x7454('0x4')]();var fs_extra=require(_0x7454('0x5'));var auth=require(_0x7454('0x6'));var interaction=require(_0x7454('0x7'));var config=require(_0x7454('0x8'));var controller=require('./whatsappQueue.controller');router['get']('/',auth[_0x7454('0x9')](),controller[_0x7454('0xa')]);router['get'](_0x7454('0xb'),auth[_0x7454('0x9')](),controller[_0x7454('0xc')]);router['get'](_0x7454('0xd'),auth[_0x7454('0x9')](),controller['show']);router[_0x7454('0xe')](_0x7454('0xf'),auth[_0x7454('0x9')](),controller[_0x7454('0x10')]);router[_0x7454('0xe')](_0x7454('0x11'),auth[_0x7454('0x9')](),controller['getTeams']);router[_0x7454('0xe')](_0x7454('0x12'),auth[_0x7454('0x9')](),controller['getAgents']);router['post']('/',auth[_0x7454('0x9')](),controller['create']);router[_0x7454('0x13')](_0x7454('0x11'),auth[_0x7454('0x9')](),controller[_0x7454('0x14')]);router[_0x7454('0x13')](_0x7454('0x12'),auth['isAuthenticated'](),controller[_0x7454('0x15')]);router[_0x7454('0x16')](_0x7454('0xd'),auth[_0x7454('0x9')](),controller[_0x7454('0x17')]);router[_0x7454('0x18')](_0x7454('0xd'),auth[_0x7454('0x9')](),controller[_0x7454('0x19')]);router[_0x7454('0x18')](_0x7454('0x11'),auth[_0x7454('0x9')](),controller[_0x7454('0x1a')]);router[_0x7454('0x18')](_0x7454('0x12'),auth[_0x7454('0x9')](),controller[_0x7454('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x65b8=['../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','/describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','express','Router','../../components/auth/service'];(function(_0x4ab1f1,_0x9bf0a1){var _0x59c2dd=function(_0xfd5823){while(--_0xfd5823){_0x4ab1f1['push'](_0x4ab1f1['shift']());}};_0x59c2dd(++_0x9bf0a1);}(_0x65b8,0x67));var _0x865b=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x65b8[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x865b('0x0'));var util=require(_0x865b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x865b('0x2'));var router=express[_0x865b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x865b('0x4'));var interaction=require(_0x865b('0x5'));var config=require('../../config/environment');var controller=require(_0x865b('0x6'));router[_0x865b('0x7')]('/',auth[_0x865b('0x8')](),controller[_0x865b('0x9')]);router[_0x865b('0x7')](_0x865b('0xa'),auth[_0x865b('0x8')](),controller['describe']);router[_0x865b('0x7')]('/:id',auth[_0x865b('0x8')](),controller[_0x865b('0xb')]);router[_0x865b('0x7')](_0x865b('0xc'),auth[_0x865b('0x8')](),controller[_0x865b('0xd')]);router[_0x865b('0x7')](_0x865b('0xe'),auth[_0x865b('0x8')](),controller[_0x865b('0xf')]);router['get'](_0x865b('0x10'),auth['isAuthenticated'](),controller[_0x865b('0x11')]);router[_0x865b('0x12')]('/',auth[_0x865b('0x8')](),controller[_0x865b('0x13')]);router[_0x865b('0x12')](_0x865b('0xe'),auth['isAuthenticated'](),controller[_0x865b('0x14')]);router[_0x865b('0x12')](_0x865b('0x10'),auth[_0x865b('0x8')](),controller[_0x865b('0x15')]);router[_0x865b('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x865b('0x17')]);router[_0x865b('0x18')]('/:id',auth[_0x865b('0x8')](),controller['destroy']);router['delete'](_0x865b('0xe'),auth[_0x865b('0x8')](),controller[_0x865b('0x19')]);router[_0x865b('0x18')](_0x865b('0x10'),auth[_0x865b('0x8')](),controller[_0x865b('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index e41da12..c4e48d7 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 _0xf021=['sequelize','exports','STRING','name','INTEGER','rrmemory','roundrobin'];(function(_0x1efa5c,_0x4deafb){var _0x4f8376=function(_0x132a82){while(--_0x132a82){_0x1efa5c['push'](_0x1efa5c['shift']());}};_0x4f8376(++_0x4deafb);}(_0xf021,0x18f));var _0x1f02=function(_0x442214,_0x3a869f){_0x442214=_0x442214-0x0;var _0x2bddf9=_0xf021[_0x442214];return _0x2bddf9;};'use strict';var Sequelize=require(_0x1f02('0x0'));module[_0x1f02('0x1')]={'name':{'type':Sequelize[_0x1f02('0x2')],'unique':_0x1f02('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x1f02('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x1f02('0x5'),'beepall',_0x1f02('0x6'))},'description':{'type':Sequelize[_0x1f02('0x2')]}}; \ No newline at end of file +var _0x7af2=['roundrobin','exports','STRING','name','INTEGER','rrmemory','beepall'];(function(_0x271dda,_0x576e19){var _0x4023a1=function(_0x26d823){while(--_0x26d823){_0x271dda['push'](_0x271dda['shift']());}};_0x4023a1(++_0x576e19);}(_0x7af2,0x119));var _0x27af=function(_0x338d69,_0x5599f0){_0x338d69=_0x338d69-0x0;var _0x5a023f=_0x7af2[_0x338d69];return _0x5a023f;};'use strict';var Sequelize=require('sequelize');module[_0x27af('0x0')]={'name':{'type':Sequelize[_0x27af('0x1')],'unique':_0x27af('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x27af('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x27af('0x4'),_0x27af('0x5'),_0x27af('0x6'))},'description':{'type':Sequelize[_0x27af('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 42119e7..7ce8977 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 _0x643c=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','update','then','get','WhatsappQueues','UserProfileResource','error','name','index','map','WhatsappQueue','fieldName','key','model','query','filters','attributes','length','hasOwnProperty','sort','where','pick','type','VIRTUAL','filter','merge','includeAll','include','findAll','rows','show','params','keys','rawAttributes','intersection','fields','options','find','catch','create','body','user','role','UserProfileSection','destroy','describe','getMembers','findOne','UserWhatsappQueue','nolimit','order','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir'];(function(_0x428c66,_0x3ac903){var _0x3332cc=function(_0x18079d){while(--_0x18079d){_0x428c66['push'](_0x428c66['shift']());}};_0x3332cc(++_0x3ac903);}(_0x643c,0x113));var _0xc643=function(_0x5f02ba,_0x5c4427){_0x5f02ba=_0x5f02ba-0x0;var _0x45b6d9=_0x643c[_0x5f02ba];return _0x45b6d9;};'use strict';var emlformat=require(_0xc643('0x0'));var rimraf=require(_0xc643('0x1'));var zipdir=require(_0xc643('0x2'));var jsonpatch=require(_0xc643('0x3'));var rp=require(_0xc643('0x4'));var moment=require(_0xc643('0x5'));var BPromise=require(_0xc643('0x6'));var Mustache=require(_0xc643('0x7'));var util=require(_0xc643('0x8'));var path=require(_0xc643('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc643('0xa'));var fs=require('fs');var fs_extra=require(_0xc643('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc643('0xc'));var deskjs=require(_0xc643('0xd'));var toCsv=require(_0xc643('0xe'));var querystring=require('querystring');var Papa=require(_0xc643('0xf'));var Redis=require(_0xc643('0x10'));var authService=require(_0xc643('0x11'));var qs=require(_0xc643('0x12'));var as=require(_0xc643('0x13'));var hardwareService=require(_0xc643('0x14'));var logger=require(_0xc643('0x15'))(_0xc643('0x16'));var utils=require(_0xc643('0x17'));var config=require(_0xc643('0x18'));var licenseUtil=require(_0xc643('0x19'));var db=require(_0xc643('0x1a'))['db'];config[_0xc643('0x1b')]=_[_0xc643('0x1c')](config[_0xc643('0x1b')],{'host':_0xc643('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc643('0x1b')]));require(_0xc643('0x1e'))[_0xc643('0x1f')](socket);function respondWithStatusCode(_0x3ec2bc,_0x4f5ed9){_0x4f5ed9=_0x4f5ed9||0xcc;return function(_0x1e2f0c){if(_0x1e2f0c){return _0x3ec2bc[_0xc643('0x20')](_0x4f5ed9);}return _0x3ec2bc[_0xc643('0x21')](_0x4f5ed9)[_0xc643('0x22')]();};}function respondWithResult(_0x215a46,_0x1882a5){_0x1882a5=_0x1882a5||0xc8;return function(_0x37c1be){if(_0x37c1be){return _0x215a46[_0xc643('0x21')](_0x1882a5)['json'](_0x37c1be);}};}function respondWithFilteredResult(_0x598db7,_0x38ff0f){return function(_0x256c0e){if(_0x256c0e){var _0x494450=typeof _0x38ff0f[_0xc643('0x23')]===_0xc643('0x24')&&typeof _0x38ff0f[_0xc643('0x25')]===_0xc643('0x24');var _0xce14af=_0x256c0e['count'];var _0x265ba2=_0x494450?0x0:_0x38ff0f[_0xc643('0x23')];var _0x1712be=_0x494450?_0x256c0e[_0xc643('0x26')]:_0x38ff0f[_0xc643('0x23')]+_0x38ff0f[_0xc643('0x25')];var _0x53f367;if(_0x1712be>=_0xce14af){_0x1712be=_0xce14af;_0x53f367=0xc8;}else{_0x53f367=0xce;}_0x598db7[_0xc643('0x21')](_0x53f367);return _0x598db7[_0xc643('0x27')]('Content-Range',_0x265ba2+'-'+_0x1712be+'/'+_0xce14af)['json'](_0x256c0e);}return null;};}function patchUpdates(_0x1dd12a){return function(_0xca59a9){try{jsonpatch[_0xc643('0x28')](_0xca59a9,_0x1dd12a,!![]);}catch(_0x1e68ad){return BPromise[_0xc643('0x29')](_0x1e68ad);}return _0xca59a9['save']();};}function saveUpdates(_0x32cf77,_0x38881f){return function(_0x4b3e1a){if(_0x4b3e1a){return _0x4b3e1a[_0xc643('0x2a')](_0x32cf77)[_0xc643('0x2b')](function(_0x3d2ab8){return _0x3d2ab8;});}return null;};}function removeEntity(_0x3ffffa,_0x5c864d){return function(_0x3a862f){if(_0x3a862f){return _0x3a862f['destroy']()['then'](function(){var _0x3c7857=_0x3a862f[_0xc643('0x2c')]({'plain':!![]});var _0x265810=_0xc643('0x2d');return db[_0xc643('0x2e')]['destroy']({'where':{'type':_0x265810,'resourceId':_0x3c7857['id']}})[_0xc643('0x2b')](function(){return _0x3a862f;});})[_0xc643('0x2b')](function(){_0x3ffffa[_0xc643('0x21')](0xcc)[_0xc643('0x22')]();});}};}function handleEntityNotFound(_0x10fbff,_0x57b3ee){return function(_0x3ba93f){if(!_0x3ba93f){_0x10fbff[_0xc643('0x20')](0x194);}return _0x3ba93f;};}function handleError(_0x37635d,_0x26db85){_0x26db85=_0x26db85||0x1f4;return function(_0x1b7a50){logger[_0xc643('0x2f')](_0x1b7a50['stack']);if(_0x1b7a50[_0xc643('0x30')]){delete _0x1b7a50[_0xc643('0x30')];}_0x37635d['status'](_0x26db85)['send'](_0x1b7a50);};}exports[_0xc643('0x31')]=function(_0x3c447e,_0x1b4836){var _0x3a39dc={},_0x2ed8f1={},_0x38fd0a={'count':0x0,'rows':[]};var _0x588c38=_[_0xc643('0x32')](db[_0xc643('0x33')]['rawAttributes'],function(_0x2ad169){return{'name':_0x2ad169[_0xc643('0x34')],'type':_0x2ad169['type'][_0xc643('0x35')]};});_0x2ed8f1[_0xc643('0x36')]=_[_0xc643('0x32')](_0x588c38,_0xc643('0x30'));_0x2ed8f1[_0xc643('0x37')]=_['keys'](_0x3c447e[_0xc643('0x37')]);_0x2ed8f1[_0xc643('0x38')]=_['intersection'](_0x2ed8f1[_0xc643('0x36')],_0x2ed8f1[_0xc643('0x37')]);_0x3a39dc['attributes']=_['intersection'](_0x2ed8f1['model'],qs['fields'](_0x3c447e['query']['fields']));_0x3a39dc[_0xc643('0x39')]=_0x3a39dc['attributes'][_0xc643('0x3a')]?_0x3a39dc[_0xc643('0x39')]:_0x2ed8f1[_0xc643('0x36')];if(!_0x3c447e[_0xc643('0x37')][_0xc643('0x3b')]('nolimit')){_0x3a39dc['limit']=qs[_0xc643('0x25')](_0x3c447e[_0xc643('0x37')][_0xc643('0x25')]);_0x3a39dc['offset']=qs[_0xc643('0x23')](_0x3c447e[_0xc643('0x37')][_0xc643('0x23')]);}_0x3a39dc['order']=qs[_0xc643('0x3c')](_0x3c447e[_0xc643('0x37')][_0xc643('0x3c')]);_0x3a39dc[_0xc643('0x3d')]=qs[_0xc643('0x38')](_[_0xc643('0x3e')](_0x3c447e[_0xc643('0x37')],_0x2ed8f1[_0xc643('0x38')]),_0x588c38);if(_0x3c447e[_0xc643('0x37')]['filter']){_0x3a39dc['where']=_['merge'](_0x3a39dc[_0xc643('0x3d')],{'$or':_[_0xc643('0x32')](_0x588c38,function(_0x19ce2f){if(_0x19ce2f[_0xc643('0x3f')]!==_0xc643('0x40')){var _0x1e1981={};_0x1e1981[_0x19ce2f[_0xc643('0x30')]]={'$like':'%'+_0x3c447e['query'][_0xc643('0x41')]+'%'};return _0x1e1981;}})});}_0x3a39dc=_[_0xc643('0x42')]({},_0x3a39dc,_0x3c447e['options']);var _0x4ff48c={'where':_0x3a39dc[_0xc643('0x3d')]};return db[_0xc643('0x33')][_0xc643('0x26')](_0x4ff48c)[_0xc643('0x2b')](function(_0x263c6f){_0x38fd0a[_0xc643('0x26')]=_0x263c6f;if(_0x3c447e[_0xc643('0x37')][_0xc643('0x43')]){_0x3a39dc[_0xc643('0x44')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xc643('0x45')](_0x3a39dc);})[_0xc643('0x2b')](function(_0x30bd4b){_0x38fd0a[_0xc643('0x46')]=_0x30bd4b;return _0x38fd0a;})[_0xc643('0x2b')](respondWithFilteredResult(_0x1b4836,_0x3a39dc))['catch'](handleError(_0x1b4836,null));};exports[_0xc643('0x47')]=function(_0x146033,_0x27876f){var _0x57b275={'raw':!![],'where':{'id':_0x146033[_0xc643('0x48')]['id']}},_0x1b2a30={};_0x1b2a30[_0xc643('0x36')]=_[_0xc643('0x49')](db[_0xc643('0x33')][_0xc643('0x4a')]);_0x1b2a30[_0xc643('0x37')]=_[_0xc643('0x49')](_0x146033[_0xc643('0x37')]);_0x1b2a30[_0xc643('0x38')]=_[_0xc643('0x4b')](_0x1b2a30['model'],_0x1b2a30[_0xc643('0x37')]);_0x57b275[_0xc643('0x39')]=_[_0xc643('0x4b')](_0x1b2a30['model'],qs[_0xc643('0x4c')](_0x146033[_0xc643('0x37')][_0xc643('0x4c')]));_0x57b275[_0xc643('0x39')]=_0x57b275[_0xc643('0x39')][_0xc643('0x3a')]?_0x57b275[_0xc643('0x39')]:_0x1b2a30['model'];if(_0x146033[_0xc643('0x37')][_0xc643('0x43')]){_0x57b275[_0xc643('0x44')]=[{'all':!![]}];}_0x57b275=_[_0xc643('0x42')]({},_0x57b275,_0x146033[_0xc643('0x4d')]);return db[_0xc643('0x33')][_0xc643('0x4e')](_0x57b275)[_0xc643('0x2b')](handleEntityNotFound(_0x27876f,null))[_0xc643('0x2b')](respondWithResult(_0x27876f,null))[_0xc643('0x4f')](handleError(_0x27876f,null));};exports[_0xc643('0x50')]=function(_0x2e748f,_0x5aeed1){return db[_0xc643('0x33')][_0xc643('0x50')](_0x2e748f[_0xc643('0x51')],{})['then'](function(_0x2a87c3){var _0x3093a5=_0x2e748f[_0xc643('0x52')][_0xc643('0x2c')]({'plain':!![]});if(!_0x3093a5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3093a5[_0xc643('0x53')]===_0xc643('0x52')){var _0x17f3c0=_0x2a87c3['get']({'plain':!![]});var _0x29034c=_0xc643('0x2d');return db[_0xc643('0x54')][_0xc643('0x4e')]({'where':{'name':_0x29034c,'userProfileId':_0x3093a5['userProfileId']},'raw':!![]})[_0xc643('0x2b')](function(_0x40eda9){if(_0x40eda9&&_0x40eda9['autoAssociation']===0x0){return db[_0xc643('0x2e')]['create']({'name':_0x17f3c0['name'],'resourceId':_0x17f3c0['id'],'type':_0x40eda9['name'],'sectionId':_0x40eda9['id']},{})['then'](function(){return _0x2a87c3;});}else{return _0x2a87c3;}})['catch'](function(_0x15d981){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15d981);throw _0x15d981;});}return _0x2a87c3;})[_0xc643('0x2b')](respondWithResult(_0x5aeed1,0xc9))[_0xc643('0x4f')](handleError(_0x5aeed1,null));};exports[_0xc643('0x2a')]=function(_0x2f14f5,_0x3993ee){if(_0x2f14f5[_0xc643('0x51')]['id']){delete _0x2f14f5[_0xc643('0x51')]['id'];}return db[_0xc643('0x33')][_0xc643('0x4e')]({'where':{'id':_0x2f14f5[_0xc643('0x48')]['id']}})['then'](handleEntityNotFound(_0x3993ee,null))[_0xc643('0x2b')](saveUpdates(_0x2f14f5[_0xc643('0x51')],null))[_0xc643('0x2b')](respondWithResult(_0x3993ee,null))[_0xc643('0x4f')](handleError(_0x3993ee,null));};exports[_0xc643('0x55')]=function(_0x156623,_0x545cc5){return db[_0xc643('0x33')][_0xc643('0x4e')]({'where':{'id':_0x156623[_0xc643('0x48')]['id']}})[_0xc643('0x2b')](handleEntityNotFound(_0x545cc5,null))[_0xc643('0x2b')](removeEntity(_0x545cc5,null))[_0xc643('0x4f')](handleError(_0x545cc5,null));};exports[_0xc643('0x56')]=function(_0xe4747d,_0x5c41bf){return db[_0xc643('0x33')][_0xc643('0x56')]()['then'](respondWithResult(_0x5c41bf,null))['catch'](handleError(_0x5c41bf,null));};exports[_0xc643('0x57')]=function(_0x4bc706,_0x4d73a3,_0x59cb83){var _0x43a451={'raw':!![],'where':{}},_0x5f5263={},_0x4b4293;return db['WhatsappQueue'][_0xc643('0x58')]({'where':{'id':_0x4bc706[_0xc643('0x48')]['id']}})[_0xc643('0x2b')](handleEntityNotFound(_0x4d73a3,null))['then'](function(_0x39e986){if(_0x39e986){_0x4b4293=_0x39e986['get']({'plain':!![]});_0x5f5263[_0xc643('0x36')]=_[_0xc643('0x49')](db[_0xc643('0x59')][_0xc643('0x4a')]);_0x5f5263['query']=_[_0xc643('0x49')](_0x4bc706['query']);_0x5f5263[_0xc643('0x38')]=_[_0xc643('0x4b')](_0x5f5263[_0xc643('0x36')],_0x5f5263[_0xc643('0x37')]);_0x43a451[_0xc643('0x39')]=_[_0xc643('0x4b')](_0x5f5263[_0xc643('0x36')],qs[_0xc643('0x4c')](_0x4bc706[_0xc643('0x37')][_0xc643('0x4c')]));_0x43a451[_0xc643('0x39')]=_0x43a451[_0xc643('0x39')]['length']?_0x43a451['attributes']:_0x5f5263[_0xc643('0x36')];if(!_0x4bc706[_0xc643('0x37')][_0xc643('0x3b')](_0xc643('0x5a'))){_0x43a451[_0xc643('0x25')]=qs[_0xc643('0x25')](_0x4bc706[_0xc643('0x37')][_0xc643('0x25')]);_0x43a451[_0xc643('0x23')]=qs[_0xc643('0x23')](_0x4bc706[_0xc643('0x37')][_0xc643('0x23')]);}_0x43a451[_0xc643('0x5b')]=qs[_0xc643('0x3c')](_0x4bc706[_0xc643('0x37')][_0xc643('0x3c')]);_0x43a451[_0xc643('0x3d')]=qs[_0xc643('0x38')](_['pick'](_0x4bc706[_0xc643('0x37')],_0x5f5263[_0xc643('0x38')]));_0x43a451[_0xc643('0x3d')][_0xc643('0x5c')]=_0x39e986['id'];if(_0x4bc706['query'][_0xc643('0x41')]){_0x43a451[_0xc643('0x3d')]=_[_0xc643('0x42')](_0x43a451[_0xc643('0x3d')],{'$or':_['map'](_0x43a451[_0xc643('0x39')],function(_0x472072){var _0x622f59={};_0x622f59[_0x472072]={'$like':'%'+_0x4bc706[_0xc643('0x37')]['filter']+'%'};return _0x622f59;})});}_0x43a451=_[_0xc643('0x42')]({},_0x43a451,_0x4bc706[_0xc643('0x4d')]);return db['UserWhatsappQueue'][_0xc643('0x45')](_0x43a451);}})[_0xc643('0x2b')](function(_0x112123){if(_0x112123){return db[_0xc643('0x5d')][_0xc643('0x5e')]({'where':{'id':_[_0xc643('0x32')](_0x112123,_0xc643('0x5f')),'role':_0xc643('0x60')},'attributes':['id',_0xc643('0x30'),_0xc643('0x61'),_0xc643('0x62'),_0xc643('0x63')]});}})[_0xc643('0x2b')](function(_0x543247){if(_0x543247){return{'count':_0x543247[_0xc643('0x26')],'rows':_[_0xc643('0x32')](_0x543247[_0xc643('0x46')],function(_0x37875e){return{'membername':_0x37875e[_0xc643('0x30')],'UserId':_0x37875e['id'],'queue_name':_0x4b4293[_0xc643('0x30')],'WhatsappQueueId':_0x4b4293['id'],'interface':util[_0xc643('0x64')](_0xc643('0x65'),'SIP',_0x37875e[_0xc643('0x30')]),'penalty':0x0,'paused':_0x37875e['whatsappPause'],'createdAt':_0x37875e['createdAt'],'updatedAt':_0x37875e[_0xc643('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc643('0x2b')](respondWithFilteredResult(_0x4d73a3,_0x43a451))[_0xc643('0x4f')](handleError(_0x4d73a3,null));};exports[_0xc643('0x66')]=function(_0x333f84,_0x3003b6,_0x54f689){var _0x1b0c66={};var _0x1865b3={};var _0x820a54;var _0x47c90a;return db['WhatsappQueue'][_0xc643('0x58')]({'where':{'id':_0x333f84[_0xc643('0x48')]['id']}})[_0xc643('0x2b')](handleEntityNotFound(_0x3003b6,null))['then'](function(_0x405045){if(_0x405045){_0x820a54=_0x405045;_0x1865b3[_0xc643('0x36')]=_[_0xc643('0x49')](db[_0xc643('0x67')][_0xc643('0x4a')]);_0x1865b3[_0xc643('0x37')]=_[_0xc643('0x49')](_0x333f84[_0xc643('0x37')]);_0x1865b3[_0xc643('0x38')]=_['intersection'](_0x1865b3[_0xc643('0x36')],_0x1865b3[_0xc643('0x37')]);_0x1b0c66[_0xc643('0x39')]=_[_0xc643('0x4b')](_0x1865b3[_0xc643('0x36')],qs[_0xc643('0x4c')](_0x333f84[_0xc643('0x37')][_0xc643('0x4c')]));_0x1b0c66[_0xc643('0x39')]=_0x1b0c66[_0xc643('0x39')][_0xc643('0x3a')]?_0x1b0c66[_0xc643('0x39')]:_0x1865b3['model'];_0x1b0c66['order']=qs[_0xc643('0x3c')](_0x333f84[_0xc643('0x37')]['sort']);_0x1b0c66['where']=qs[_0xc643('0x38')](_['pick'](_0x333f84[_0xc643('0x37')],_0x1865b3[_0xc643('0x38')]));if(_0x333f84[_0xc643('0x37')][_0xc643('0x41')]){_0x1b0c66['where']=_[_0xc643('0x42')](_0x1b0c66[_0xc643('0x3d')],{'$or':_[_0xc643('0x32')](_0x1b0c66[_0xc643('0x39')],function(_0x4c1b19){var _0x58cc0f={};_0x58cc0f[_0x4c1b19]={'$like':'%'+_0x333f84[_0xc643('0x37')]['filter']+'%'};return _0x58cc0f;})});}_0x1b0c66=_[_0xc643('0x42')]({},_0x1b0c66,_0x333f84[_0xc643('0x4d')]);return _0x820a54[_0xc643('0x66')](_0x1b0c66);}})[_0xc643('0x2b')](function(_0x5d72e8){if(_0x5d72e8){_0x47c90a=_0x5d72e8['length'];if(!_0x333f84['query'][_0xc643('0x3b')](_0xc643('0x5a'))){_0x1b0c66[_0xc643('0x25')]=qs[_0xc643('0x25')](_0x333f84[_0xc643('0x37')]['limit']);_0x1b0c66[_0xc643('0x23')]=qs[_0xc643('0x23')](_0x333f84[_0xc643('0x37')][_0xc643('0x23')]);}return _0x820a54['getTeams'](_0x1b0c66);}})[_0xc643('0x2b')](function(_0x5180af){if(_0x5180af){return _0x5180af?{'count':_0x47c90a,'rows':_0x5180af}:null;}})[_0xc643('0x2b')](respondWithResult(_0x3003b6,null))[_0xc643('0x4f')](handleError(_0x3003b6,null));};exports[_0xc643('0x68')]=function(_0x451153,_0x49d5c3,_0xa3a08f){var _0x2b5cb6=_0x451153[_0xc643('0x51')][_0xc643('0x69')];return db[_0xc643('0x67')][_0xc643('0x45')]({'where':{'id':_0x2b5cb6},'attributes':['id'],'include':[{'model':db[_0xc643('0x5d')],'as':_0xc643('0x6a'),'attributes':['id',_0xc643('0x30'),_0xc643('0x6b'),_0xc643('0x6c'),'interface'],'raw':!![]}]})[_0xc643('0x2b')](function(_0x3254f2){if(_0x3254f2){var _0x28ea1e=_[_0xc643('0x6d')](_0x3254f2,function(_0x2e5575){var _0x5947ca=_0x2e5575[_0xc643('0x2c')]({'plain':!![]});return _0x5947ca[_0xc643('0x6a')];});return db[_0xc643('0x33')]['find']({'where':{'id':_0x451153[_0xc643('0x48')]['id']}})[_0xc643('0x2b')](function(_0x33e9be){return db[_0xc643('0x6e')][_0xc643('0x6f')](function(_0x3de379){return _0x33e9be[_0xc643('0x68')](_0x2b5cb6,{'transaction':_0x3de379})[_0xc643('0x2b')](function(){return BPromise['each'](_0x28ea1e,function(_0x1c449f){return db[_0xc643('0x59')]['findOrCreate']({'where':{'UserId':_0x1c449f['id'],'WhatsappQueueId':_0x451153['params']['id']},'transaction':_0x3de379});});})[_0xc643('0x2b')](function(){_0x28ea1e[_0xc643('0x70')](function(_0x3bdd36){socket[_0xc643('0x71')](_0xc643('0x72'),{'UserId':_0x3bdd36['id'],'WhatsappQueueId':_0x33e9be['id']});});});});});}})['then'](respondWithStatusCode(_0x49d5c3,null))['catch'](handleError(_0x49d5c3,null));};exports[_0xc643('0x73')]=function(_0x5e288d,_0xa50740,_0x52219d){return db[_0xc643('0x67')][_0xc643('0x45')]({'where':{'id':_0x5e288d[_0xc643('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0xc643('0x5d')],'as':_0xc643('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xc643('0x2b')](handleEntityNotFound(_0xa50740,null))['then'](function(_0x376d33){var _0x4910a9=_[_0xc643('0x32')](_0x376d33,'id');var _0x584126=[];var _0x557aa1=[];var _0x1031c0=squel[_0xc643('0x74')]();_0x1031c0[_0xc643('0x75')](_0xc643('0x76'))['from'](_0xc643('0x77'),'tq')[_0xc643('0x78')](_0xc643('0x79'),'ut',_0xc643('0x7a'))[_0xc643('0x3d')](_0xc643('0x7b'),_0x5e288d[_0xc643('0x48')]['id']);for(var _0x3e6d20=0x0;_0x3e6d20<_0x376d33[_0xc643('0x3a')];_0x3e6d20+=0x1){let _0xc1c640=_0x376d33[_0x3e6d20];for(var _0x29519d=0x0;_0x29519d<_0xc1c640[_0xc643('0x6a')][_0xc643('0x3a')];_0x29519d+=0x1){let _0x54b2c6=_0xc1c640[_0xc643('0x6a')][_0x29519d];var _0x28562c=_0x1031c0[_0xc643('0x7c')]();_0x28562c['where'](_0xc643('0x7d'),_0x54b2c6['id']);_0x557aa1[_0xc643('0x7e')](db['sequelize'][_0xc643('0x37')](_0x28562c[_0xc643('0x7f')](),{'type':db[_0xc643('0x6e')]['QueryTypes']['SELECT']})[_0xc643('0x2b')](function(_0x53f282){if(_0x53f282[_0xc643('0x3a')]===0x1){return _0x54b2c6['id'];}else{var _0x33ea18=_['every'](_[_0xc643('0x32')](_0x53f282,'TeamId'),function(_0x357554){return _['includes'](_0x4910a9,_0x357554);});if(_0x33ea18){return _0x54b2c6['id'];}}}));}}return BPromise[_0xc643('0x80')](_0x557aa1)[_0xc643('0x2b')](function(_0x3d6de4){_0x584126=_(_0x584126)[_0xc643('0x81')](_0x3d6de4)[_0xc643('0x82')]()[_0xc643('0x83')]();return db['WhatsappQueue'][_0xc643('0x4e')]({'where':{'id':_0x5e288d['params']['id']}})['then'](function(_0x1851b7){return db[_0xc643('0x6e')][_0xc643('0x6f')](function(_0x547ef5){return _0x1851b7['removeTeams'](_0x5e288d[_0xc643('0x37')][_0xc643('0x69')],{'transaction':_0x547ef5})[_0xc643('0x2b')](function(){if(!_[_0xc643('0x84')](_0x584126)){return _0x1851b7[_0xc643('0x85')](_0x584126,{'transaction':_0x547ef5});}})[_0xc643('0x2b')](function(){_0x584126[_0xc643('0x70')](function(_0x16f3f0){socket['emit'](_0xc643('0x86'),{'UserId':_0x16f3f0,'WhatsappQueueId':_0x1851b7['id']});});});});});});})['then'](respondWithStatusCode(_0xa50740,null))[_0xc643('0x4f')](handleError(_0xa50740,null));};exports[_0xc643('0x87')]=function(_0x3dc9eb,_0x65e8d,_0x43f2f0){return db[_0xc643('0x33')][_0xc643('0x4e')]({'where':{'id':_0x3dc9eb[_0xc643('0x48')]['id']}})[_0xc643('0x2b')](handleEntityNotFound(_0x65e8d,null))[_0xc643('0x2b')](function(_0x89ada8){if(_0x89ada8){return _0x89ada8['addAgents'](_0x3dc9eb['body'][_0xc643('0x69')],_['omit'](_0x3dc9eb[_0xc643('0x51')],[_0xc643('0x69'),'id'])||{})[_0xc643('0x88')](function(_0x428c53){for(var _0x40b367=0x0;_0x40b367<_0x3dc9eb[_0xc643('0x51')][_0xc643('0x69')][_0xc643('0x3a')];_0x40b367+=0x1){socket[_0xc643('0x71')](_0xc643('0x72'),{'UserId':Number(_0x3dc9eb[_0xc643('0x51')][_0xc643('0x69')][_0x40b367]),'WhatsappQueueId':Number(_0x3dc9eb[_0xc643('0x48')]['id'])});}return _0x428c53;});}})['then'](respondWithResult(_0x65e8d,null))['catch'](handleError(_0x65e8d,null));};exports['removeAgents']=function(_0x46d21d,_0x39e633,_0x2a6154){return db[_0xc643('0x33')][_0xc643('0x4e')]({'where':{'id':_0x46d21d[_0xc643('0x48')]['id']}})[_0xc643('0x2b')](handleEntityNotFound(_0x39e633,null))[_0xc643('0x2b')](function(_0x570e77){if(_0x570e77){return _0x570e77[_0xc643('0x85')](_0x46d21d[_0xc643('0x37')][_0xc643('0x69')])[_0xc643('0x2b')](function(){if(_[_0xc643('0x89')](_0x46d21d[_0xc643('0x37')]['ids'])){for(var _0xe81164=0x0;_0xe81164<_0x46d21d[_0xc643('0x37')][_0xc643('0x69')][_0xc643('0x3a')];_0xe81164+=0x1){socket[_0xc643('0x71')](_0xc643('0x86'),{'UserId':Number(_0x46d21d[_0xc643('0x37')][_0xc643('0x69')][_0xe81164]),'WhatsappQueueId':Number(_0x46d21d['params']['id'])});}}else{socket[_0xc643('0x71')](_0xc643('0x86'),{'UserId':Number(_0x46d21d[_0xc643('0x37')][_0xc643('0x69')]),'WhatsappQueueId':Number(_0x46d21d[_0xc643('0x48')]['id'])});}});}})[_0xc643('0x2b')](respondWithStatusCode(_0x39e633,null))['catch'](handleError(_0x39e633,null));};exports['getAgents']=function(_0x266ad7,_0x506984,_0x3d8b07){var _0x1cfece={};var _0x290701={};var _0x2e0011;var _0x3c7f57;return db[_0xc643('0x33')]['findOne']({'where':{'id':_0x266ad7[_0xc643('0x48')]['id']}})[_0xc643('0x2b')](handleEntityNotFound(_0x506984,null))[_0xc643('0x2b')](function(_0x2939db){if(_0x2939db){_0x2e0011=_0x2939db;_0x290701[_0xc643('0x36')]=_[_0xc643('0x49')](db[_0xc643('0x5d')][_0xc643('0x4a')]);_0x290701[_0xc643('0x37')]=_[_0xc643('0x49')](_0x266ad7[_0xc643('0x37')]);_0x290701[_0xc643('0x38')]=_[_0xc643('0x4b')](_0x290701['model'],_0x290701[_0xc643('0x37')]);_0x1cfece[_0xc643('0x39')]=_['intersection'](_0x290701['model'],qs[_0xc643('0x4c')](_0x266ad7[_0xc643('0x37')][_0xc643('0x4c')]));_0x1cfece[_0xc643('0x39')]=_0x1cfece[_0xc643('0x39')][_0xc643('0x3a')]?_0x1cfece['attributes']:_0x290701[_0xc643('0x36')];_0x1cfece[_0xc643('0x5b')]=qs['sort'](_0x266ad7[_0xc643('0x37')][_0xc643('0x3c')]);_0x1cfece['where']=qs[_0xc643('0x38')](_[_0xc643('0x3e')](_0x266ad7[_0xc643('0x37')],_0x290701[_0xc643('0x38')]));if(_0x266ad7[_0xc643('0x37')][_0xc643('0x41')]){_0x1cfece[_0xc643('0x3d')]=_['merge'](_0x1cfece['where'],{'$or':_['map'](_0x1cfece[_0xc643('0x39')],function(_0x372502){var _0x4a7312={};_0x4a7312[_0x372502]={'$like':'%'+_0x266ad7[_0xc643('0x37')][_0xc643('0x41')]+'%'};return _0x4a7312;})});}_0x1cfece=_[_0xc643('0x42')]({},_0x1cfece,_0x266ad7[_0xc643('0x4d')]);return _0x2e0011['getAgents'](_0x1cfece);}})[_0xc643('0x2b')](function(_0x3e41e4){if(_0x3e41e4){_0x3c7f57=_0x3e41e4[_0xc643('0x3a')];if(!_0x266ad7[_0xc643('0x37')][_0xc643('0x3b')]('nolimit')){_0x1cfece[_0xc643('0x25')]=qs[_0xc643('0x25')](_0x266ad7[_0xc643('0x37')]['limit']);_0x1cfece[_0xc643('0x23')]=qs[_0xc643('0x23')](_0x266ad7[_0xc643('0x37')][_0xc643('0x23')]);}return _0x2e0011[_0xc643('0x8a')](_0x1cfece);}})[_0xc643('0x2b')](function(_0x3c3556){if(_0x3c3556){return _0x3c3556?{'count':_0x3c7f57,'rows':_0x3c3556}:null;}})[_0xc643('0x2b')](respondWithResult(_0x506984,null))['catch'](handleError(_0x506984,null));}; \ No newline at end of file +var _0x5a05=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','WhatsappQueue','findAll','catch','show','params','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','nolimit','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','rows','format','SIP','createdAt','getTeams','addTeams','ids','Agents','online','interface','sequelize','transaction','UserWhatsappQueue','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','Team','field','tq.TeamId','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','WhatsappQueues','UserProfileResource','destroy','stack','name','index','map','rawAttributes','fieldName','type','model'];(function(_0x522942,_0x366630){var _0x54f062=function(_0x368664){while(--_0x368664){_0x522942['push'](_0x522942['shift']());}};_0x54f062(++_0x366630);}(_0x5a05,0x169));var _0x55a0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5a05[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x55a0('0x0'));var rimraf=require(_0x55a0('0x1'));var zipdir=require(_0x55a0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x55a0('0x3'));var moment=require(_0x55a0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x55a0('0x5'));var path=require(_0x55a0('0x6'));var sox=require(_0x55a0('0x7'));var csv=require('to-csv');var ejs=require(_0x55a0('0x8'));var fs=require('fs');var fs_extra=require(_0x55a0('0x9'));var _=require(_0x55a0('0xa'));var squel=require('squel');var crypto=require(_0x55a0('0xb'));var jsforce=require(_0x55a0('0xc'));var deskjs=require(_0x55a0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x55a0('0xe'));var Papa=require(_0x55a0('0xf'));var Redis=require(_0x55a0('0x10'));var authService=require(_0x55a0('0x11'));var qs=require(_0x55a0('0x12'));var as=require(_0x55a0('0x13'));var hardwareService=require(_0x55a0('0x14'));var logger=require(_0x55a0('0x15'))(_0x55a0('0x16'));var utils=require(_0x55a0('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x55a0('0x18'));var db=require(_0x55a0('0x19'))['db'];config[_0x55a0('0x1a')]=_[_0x55a0('0x1b')](config[_0x55a0('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x55a0('0x1c'))(new Redis(config[_0x55a0('0x1a')]));require(_0x55a0('0x1d'))[_0x55a0('0x1e')](socket);function respondWithStatusCode(_0x4fd731,_0x6297c7){_0x6297c7=_0x6297c7||0xcc;return function(_0x227ec8){if(_0x227ec8){return _0x4fd731[_0x55a0('0x1f')](_0x6297c7);}return _0x4fd731[_0x55a0('0x20')](_0x6297c7)[_0x55a0('0x21')]();};}function respondWithResult(_0x53e001,_0x2c826b){_0x2c826b=_0x2c826b||0xc8;return function(_0x32cdbb){if(_0x32cdbb){return _0x53e001[_0x55a0('0x20')](_0x2c826b)[_0x55a0('0x22')](_0x32cdbb);}};}function respondWithFilteredResult(_0x291e78,_0x1f67ab){return function(_0x51332c){if(_0x51332c){var _0x259502=typeof _0x1f67ab['offset']==='undefined'&&typeof _0x1f67ab[_0x55a0('0x23')]===_0x55a0('0x24');var _0x4aa9f0=_0x51332c[_0x55a0('0x25')];var _0x4eb140=_0x259502?0x0:_0x1f67ab[_0x55a0('0x26')];var _0x46aa97=_0x259502?_0x51332c[_0x55a0('0x25')]:_0x1f67ab[_0x55a0('0x26')]+_0x1f67ab['limit'];var _0x576bbc;if(_0x46aa97>=_0x4aa9f0){_0x46aa97=_0x4aa9f0;_0x576bbc=0xc8;}else{_0x576bbc=0xce;}_0x291e78[_0x55a0('0x20')](_0x576bbc);return _0x291e78[_0x55a0('0x27')](_0x55a0('0x28'),_0x4eb140+'-'+_0x46aa97+'/'+_0x4aa9f0)[_0x55a0('0x22')](_0x51332c);}return null;};}function patchUpdates(_0x33bd82){return function(_0x2739ce){try{jsonpatch[_0x55a0('0x29')](_0x2739ce,_0x33bd82,!![]);}catch(_0x556721){return BPromise[_0x55a0('0x2a')](_0x556721);}return _0x2739ce[_0x55a0('0x2b')]();};}function saveUpdates(_0x53b44b,_0x46c6a7){return function(_0x542ec7){if(_0x542ec7){return _0x542ec7['update'](_0x53b44b)[_0x55a0('0x2c')](function(_0x552ab4){return _0x552ab4;});}return null;};}function removeEntity(_0x19b5e4,_0xe8321a){return function(_0x2abaa2){if(_0x2abaa2){return _0x2abaa2['destroy']()[_0x55a0('0x2c')](function(){var _0x350c9c=_0x2abaa2['get']({'plain':!![]});var _0xbce415=_0x55a0('0x2d');return db[_0x55a0('0x2e')][_0x55a0('0x2f')]({'where':{'type':_0xbce415,'resourceId':_0x350c9c['id']}})[_0x55a0('0x2c')](function(){return _0x2abaa2;});})[_0x55a0('0x2c')](function(){_0x19b5e4[_0x55a0('0x20')](0xcc)[_0x55a0('0x21')]();});}};}function handleEntityNotFound(_0x17cf34,_0x2824b6){return function(_0x1c82d9){if(!_0x1c82d9){_0x17cf34[_0x55a0('0x1f')](0x194);}return _0x1c82d9;};}function handleError(_0x562be1,_0x2334bf){_0x2334bf=_0x2334bf||0x1f4;return function(_0x564166){logger['error'](_0x564166[_0x55a0('0x30')]);if(_0x564166[_0x55a0('0x31')]){delete _0x564166[_0x55a0('0x31')];}_0x562be1[_0x55a0('0x20')](_0x2334bf)['send'](_0x564166);};}exports[_0x55a0('0x32')]=function(_0x1836bf,_0x33fe48){var _0x521bfa={},_0x518fc5={},_0x52d787={'count':0x0,'rows':[]};var _0x504d8e=_[_0x55a0('0x33')](db['WhatsappQueue'][_0x55a0('0x34')],function(_0x3f36ce){return{'name':_0x3f36ce[_0x55a0('0x35')],'type':_0x3f36ce[_0x55a0('0x36')]['key']};});_0x518fc5[_0x55a0('0x37')]=_['map'](_0x504d8e,'name');_0x518fc5[_0x55a0('0x38')]=_[_0x55a0('0x39')](_0x1836bf[_0x55a0('0x38')]);_0x518fc5[_0x55a0('0x3a')]=_[_0x55a0('0x3b')](_0x518fc5[_0x55a0('0x37')],_0x518fc5['query']);_0x521bfa[_0x55a0('0x3c')]=_['intersection'](_0x518fc5['model'],qs[_0x55a0('0x3d')](_0x1836bf['query'][_0x55a0('0x3d')]));_0x521bfa[_0x55a0('0x3c')]=_0x521bfa[_0x55a0('0x3c')][_0x55a0('0x3e')]?_0x521bfa[_0x55a0('0x3c')]:_0x518fc5[_0x55a0('0x37')];if(!_0x1836bf[_0x55a0('0x38')][_0x55a0('0x3f')]('nolimit')){_0x521bfa[_0x55a0('0x23')]=qs['limit'](_0x1836bf[_0x55a0('0x38')][_0x55a0('0x23')]);_0x521bfa[_0x55a0('0x26')]=qs[_0x55a0('0x26')](_0x1836bf[_0x55a0('0x38')][_0x55a0('0x26')]);}_0x521bfa[_0x55a0('0x40')]=qs['sort'](_0x1836bf['query'][_0x55a0('0x41')]);_0x521bfa[_0x55a0('0x42')]=qs[_0x55a0('0x3a')](_[_0x55a0('0x43')](_0x1836bf[_0x55a0('0x38')],_0x518fc5[_0x55a0('0x3a')]),_0x504d8e);if(_0x1836bf[_0x55a0('0x38')]['filter']){_0x521bfa[_0x55a0('0x42')]=_[_0x55a0('0x44')](_0x521bfa['where'],{'$or':_['map'](_0x504d8e,function(_0x53a605){if(_0x53a605[_0x55a0('0x36')]!==_0x55a0('0x45')){var _0x5b645d={};_0x5b645d[_0x53a605[_0x55a0('0x31')]]={'$like':'%'+_0x1836bf[_0x55a0('0x38')][_0x55a0('0x46')]+'%'};return _0x5b645d;}})});}_0x521bfa=_[_0x55a0('0x44')]({},_0x521bfa,_0x1836bf[_0x55a0('0x47')]);var _0x3db56b={'where':_0x521bfa[_0x55a0('0x42')]};return db[_0x55a0('0x48')][_0x55a0('0x25')](_0x3db56b)['then'](function(_0x599d31){_0x52d787[_0x55a0('0x25')]=_0x599d31;if(_0x1836bf[_0x55a0('0x38')]['includeAll']){_0x521bfa['include']=[{'all':!![]}];}return db[_0x55a0('0x48')][_0x55a0('0x49')](_0x521bfa);})['then'](function(_0x4e2ee8){_0x52d787['rows']=_0x4e2ee8;return _0x52d787;})[_0x55a0('0x2c')](respondWithFilteredResult(_0x33fe48,_0x521bfa))[_0x55a0('0x4a')](handleError(_0x33fe48,null));};exports[_0x55a0('0x4b')]=function(_0x253cdc,_0x3acc15){var _0x4b6498={'raw':!![],'where':{'id':_0x253cdc[_0x55a0('0x4c')]['id']}},_0x23a726={};_0x23a726[_0x55a0('0x37')]=_['keys'](db['WhatsappQueue'][_0x55a0('0x34')]);_0x23a726['query']=_['keys'](_0x253cdc[_0x55a0('0x38')]);_0x23a726['filters']=_[_0x55a0('0x3b')](_0x23a726[_0x55a0('0x37')],_0x23a726[_0x55a0('0x38')]);_0x4b6498[_0x55a0('0x3c')]=_[_0x55a0('0x3b')](_0x23a726[_0x55a0('0x37')],qs[_0x55a0('0x3d')](_0x253cdc[_0x55a0('0x38')][_0x55a0('0x3d')]));_0x4b6498[_0x55a0('0x3c')]=_0x4b6498[_0x55a0('0x3c')][_0x55a0('0x3e')]?_0x4b6498[_0x55a0('0x3c')]:_0x23a726[_0x55a0('0x37')];if(_0x253cdc['query']['includeAll']){_0x4b6498[_0x55a0('0x4d')]=[{'all':!![]}];}_0x4b6498=_[_0x55a0('0x44')]({},_0x4b6498,_0x253cdc['options']);return db['WhatsappQueue'][_0x55a0('0x4e')](_0x4b6498)['then'](handleEntityNotFound(_0x3acc15,null))[_0x55a0('0x2c')](respondWithResult(_0x3acc15,null))[_0x55a0('0x4a')](handleError(_0x3acc15,null));};exports[_0x55a0('0x4f')]=function(_0x1f9426,_0x5c4bfa){return db[_0x55a0('0x48')][_0x55a0('0x4f')](_0x1f9426[_0x55a0('0x50')],{})[_0x55a0('0x2c')](function(_0x445d02){var _0x394152=_0x1f9426[_0x55a0('0x51')][_0x55a0('0x52')]({'plain':!![]});if(!_0x394152)throw new Error(_0x55a0('0x53'));if(_0x394152[_0x55a0('0x54')]===_0x55a0('0x51')){var _0x569f73=_0x445d02['get']({'plain':!![]});var _0x5b6b67=_0x55a0('0x2d');return db[_0x55a0('0x55')][_0x55a0('0x4e')]({'where':{'name':_0x5b6b67,'userProfileId':_0x394152['userProfileId']},'raw':!![]})[_0x55a0('0x2c')](function(_0x1b6a06){if(_0x1b6a06&&_0x1b6a06['autoAssociation']===0x0){return db['UserProfileResource'][_0x55a0('0x4f')]({'name':_0x569f73[_0x55a0('0x31')],'resourceId':_0x569f73['id'],'type':_0x1b6a06[_0x55a0('0x31')],'sectionId':_0x1b6a06['id']},{})[_0x55a0('0x2c')](function(){return _0x445d02;});}else{return _0x445d02;}})[_0x55a0('0x4a')](function(_0x5d77fe){logger['error'](_0x55a0('0x56'),_0x5d77fe);throw _0x5d77fe;});}return _0x445d02;})[_0x55a0('0x2c')](respondWithResult(_0x5c4bfa,0xc9))[_0x55a0('0x4a')](handleError(_0x5c4bfa,null));};exports[_0x55a0('0x57')]=function(_0x4699a0,_0x47dbf3){if(_0x4699a0['body']['id']){delete _0x4699a0[_0x55a0('0x50')]['id'];}return db[_0x55a0('0x48')][_0x55a0('0x4e')]({'where':{'id':_0x4699a0[_0x55a0('0x4c')]['id']}})[_0x55a0('0x2c')](handleEntityNotFound(_0x47dbf3,null))[_0x55a0('0x2c')](saveUpdates(_0x4699a0[_0x55a0('0x50')],null))[_0x55a0('0x2c')](respondWithResult(_0x47dbf3,null))['catch'](handleError(_0x47dbf3,null));};exports[_0x55a0('0x2f')]=function(_0x39391c,_0x2c5cea){return db[_0x55a0('0x48')][_0x55a0('0x4e')]({'where':{'id':_0x39391c[_0x55a0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2c5cea,null))[_0x55a0('0x2c')](removeEntity(_0x2c5cea,null))['catch'](handleError(_0x2c5cea,null));};exports['describe']=function(_0x10a687,_0x3d047b){return db[_0x55a0('0x48')][_0x55a0('0x58')]()[_0x55a0('0x2c')](respondWithResult(_0x3d047b,null))['catch'](handleError(_0x3d047b,null));};exports[_0x55a0('0x59')]=function(_0xa18808,_0x413370,_0x157378){var _0x4ad91f={'raw':!![],'where':{}},_0xbc7a5a={},_0x36af80;return db[_0x55a0('0x48')][_0x55a0('0x5a')]({'where':{'id':_0xa18808['params']['id']}})[_0x55a0('0x2c')](handleEntityNotFound(_0x413370,null))['then'](function(_0xdcbb31){if(_0xdcbb31){_0x36af80=_0xdcbb31[_0x55a0('0x52')]({'plain':!![]});_0xbc7a5a[_0x55a0('0x37')]=_[_0x55a0('0x39')](db['UserWhatsappQueue'][_0x55a0('0x34')]);_0xbc7a5a[_0x55a0('0x38')]=_[_0x55a0('0x39')](_0xa18808[_0x55a0('0x38')]);_0xbc7a5a[_0x55a0('0x3a')]=_['intersection'](_0xbc7a5a[_0x55a0('0x37')],_0xbc7a5a[_0x55a0('0x38')]);_0x4ad91f[_0x55a0('0x3c')]=_[_0x55a0('0x3b')](_0xbc7a5a['model'],qs[_0x55a0('0x3d')](_0xa18808[_0x55a0('0x38')][_0x55a0('0x3d')]));_0x4ad91f[_0x55a0('0x3c')]=_0x4ad91f[_0x55a0('0x3c')][_0x55a0('0x3e')]?_0x4ad91f[_0x55a0('0x3c')]:_0xbc7a5a[_0x55a0('0x37')];if(!_0xa18808[_0x55a0('0x38')][_0x55a0('0x3f')](_0x55a0('0x5b'))){_0x4ad91f['limit']=qs[_0x55a0('0x23')](_0xa18808['query'][_0x55a0('0x23')]);_0x4ad91f[_0x55a0('0x26')]=qs[_0x55a0('0x26')](_0xa18808[_0x55a0('0x38')][_0x55a0('0x26')]);}_0x4ad91f[_0x55a0('0x40')]=qs[_0x55a0('0x41')](_0xa18808[_0x55a0('0x38')][_0x55a0('0x41')]);_0x4ad91f[_0x55a0('0x42')]=qs[_0x55a0('0x3a')](_[_0x55a0('0x43')](_0xa18808[_0x55a0('0x38')],_0xbc7a5a[_0x55a0('0x3a')]));_0x4ad91f[_0x55a0('0x42')]['WhatsappQueueId']=_0xdcbb31['id'];if(_0xa18808['query']['filter']){_0x4ad91f[_0x55a0('0x42')]=_[_0x55a0('0x44')](_0x4ad91f['where'],{'$or':_[_0x55a0('0x33')](_0x4ad91f['attributes'],function(_0x1b3301){var _0x210c2b={};_0x210c2b[_0x1b3301]={'$like':'%'+_0xa18808[_0x55a0('0x38')][_0x55a0('0x46')]+'%'};return _0x210c2b;})});}_0x4ad91f=_['merge']({},_0x4ad91f,_0xa18808[_0x55a0('0x47')]);return db['UserWhatsappQueue'][_0x55a0('0x49')](_0x4ad91f);}})[_0x55a0('0x2c')](function(_0xcdd9af){if(_0xcdd9af){return db[_0x55a0('0x5c')][_0x55a0('0x5d')]({'where':{'id':_[_0x55a0('0x33')](_0xcdd9af,_0x55a0('0x5e')),'role':_0x55a0('0x5f')},'attributes':['id',_0x55a0('0x31'),_0x55a0('0x60'),_0x55a0('0x61'),'createdAt']});}})[_0x55a0('0x2c')](function(_0x6e19ef){if(_0x6e19ef){return{'count':_0x6e19ef['count'],'rows':_['map'](_0x6e19ef[_0x55a0('0x62')],function(_0x1c58a5){return{'membername':_0x1c58a5[_0x55a0('0x31')],'UserId':_0x1c58a5['id'],'queue_name':_0x36af80[_0x55a0('0x31')],'WhatsappQueueId':_0x36af80['id'],'interface':util[_0x55a0('0x63')]('%s/%s',_0x55a0('0x64'),_0x1c58a5[_0x55a0('0x31')]),'penalty':0x0,'paused':_0x1c58a5[_0x55a0('0x60')],'createdAt':_0x1c58a5[_0x55a0('0x65')],'updatedAt':_0x1c58a5[_0x55a0('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x55a0('0x2c')](respondWithFilteredResult(_0x413370,_0x4ad91f))[_0x55a0('0x4a')](handleError(_0x413370,null));};exports[_0x55a0('0x66')]=function(_0xa72e30,_0x167e61,_0x280d8c){var _0xd71fd8={};var _0x16f1de={};var _0x48ef8d;var _0x34a369;return db[_0x55a0('0x48')][_0x55a0('0x5a')]({'where':{'id':_0xa72e30[_0x55a0('0x4c')]['id']}})[_0x55a0('0x2c')](handleEntityNotFound(_0x167e61,null))[_0x55a0('0x2c')](function(_0x6bf0fb){if(_0x6bf0fb){_0x48ef8d=_0x6bf0fb;_0x16f1de[_0x55a0('0x37')]=_[_0x55a0('0x39')](db['Team']['rawAttributes']);_0x16f1de['query']=_[_0x55a0('0x39')](_0xa72e30[_0x55a0('0x38')]);_0x16f1de[_0x55a0('0x3a')]=_['intersection'](_0x16f1de['model'],_0x16f1de[_0x55a0('0x38')]);_0xd71fd8[_0x55a0('0x3c')]=_[_0x55a0('0x3b')](_0x16f1de['model'],qs['fields'](_0xa72e30['query'][_0x55a0('0x3d')]));_0xd71fd8[_0x55a0('0x3c')]=_0xd71fd8[_0x55a0('0x3c')][_0x55a0('0x3e')]?_0xd71fd8[_0x55a0('0x3c')]:_0x16f1de['model'];_0xd71fd8[_0x55a0('0x40')]=qs['sort'](_0xa72e30[_0x55a0('0x38')][_0x55a0('0x41')]);_0xd71fd8[_0x55a0('0x42')]=qs[_0x55a0('0x3a')](_[_0x55a0('0x43')](_0xa72e30[_0x55a0('0x38')],_0x16f1de[_0x55a0('0x3a')]));if(_0xa72e30['query']['filter']){_0xd71fd8[_0x55a0('0x42')]=_[_0x55a0('0x44')](_0xd71fd8[_0x55a0('0x42')],{'$or':_[_0x55a0('0x33')](_0xd71fd8['attributes'],function(_0x1de6d4){var _0x323637={};_0x323637[_0x1de6d4]={'$like':'%'+_0xa72e30[_0x55a0('0x38')][_0x55a0('0x46')]+'%'};return _0x323637;})});}_0xd71fd8=_['merge']({},_0xd71fd8,_0xa72e30[_0x55a0('0x47')]);return _0x48ef8d[_0x55a0('0x66')](_0xd71fd8);}})[_0x55a0('0x2c')](function(_0x2e2bb9){if(_0x2e2bb9){_0x34a369=_0x2e2bb9[_0x55a0('0x3e')];if(!_0xa72e30['query'][_0x55a0('0x3f')](_0x55a0('0x5b'))){_0xd71fd8[_0x55a0('0x23')]=qs[_0x55a0('0x23')](_0xa72e30[_0x55a0('0x38')]['limit']);_0xd71fd8['offset']=qs[_0x55a0('0x26')](_0xa72e30[_0x55a0('0x38')][_0x55a0('0x26')]);}return _0x48ef8d[_0x55a0('0x66')](_0xd71fd8);}})[_0x55a0('0x2c')](function(_0x10aedf){if(_0x10aedf){return _0x10aedf?{'count':_0x34a369,'rows':_0x10aedf}:null;}})['then'](respondWithResult(_0x167e61,null))['catch'](handleError(_0x167e61,null));};exports[_0x55a0('0x67')]=function(_0x2e9d4a,_0x3e46fe,_0xdf57a6){var _0x54507e=_0x2e9d4a[_0x55a0('0x50')][_0x55a0('0x68')];return db['Team']['findAll']({'where':{'id':_0x54507e},'attributes':['id'],'include':[{'model':db[_0x55a0('0x5c')],'as':_0x55a0('0x69'),'attributes':['id','name',_0x55a0('0x6a'),'voicePause',_0x55a0('0x6b')],'raw':!![]}]})[_0x55a0('0x2c')](function(_0x2d636d){if(_0x2d636d){var _0x3e3ce9=_['flatMap'](_0x2d636d,function(_0x519547){var _0x187faf=_0x519547['get']({'plain':!![]});return _0x187faf[_0x55a0('0x69')];});return db['WhatsappQueue'][_0x55a0('0x4e')]({'where':{'id':_0x2e9d4a[_0x55a0('0x4c')]['id']}})[_0x55a0('0x2c')](function(_0x206924){return db[_0x55a0('0x6c')][_0x55a0('0x6d')](function(_0x463833){return _0x206924['addTeams'](_0x54507e,{'transaction':_0x463833})[_0x55a0('0x2c')](function(){return BPromise['each'](_0x3e3ce9,function(_0x4613f8){return db[_0x55a0('0x6e')][_0x55a0('0x6f')]({'where':{'UserId':_0x4613f8['id'],'WhatsappQueueId':_0x2e9d4a['params']['id']},'transaction':_0x463833});});})[_0x55a0('0x2c')](function(){_0x3e3ce9[_0x55a0('0x70')](function(_0x20a8d3){socket[_0x55a0('0x71')](_0x55a0('0x72'),{'UserId':_0x20a8d3['id'],'WhatsappQueueId':_0x206924['id']});});});});});}})[_0x55a0('0x2c')](respondWithStatusCode(_0x3e46fe,null))[_0x55a0('0x4a')](handleError(_0x3e46fe,null));};exports[_0x55a0('0x73')]=function(_0x3a87c9,_0x3db031,_0x3e92f0){return db[_0x55a0('0x74')][_0x55a0('0x49')]({'where':{'id':_0x3a87c9[_0x55a0('0x38')][_0x55a0('0x68')]},'attributes':['id'],'include':[{'model':db[_0x55a0('0x5c')],'as':_0x55a0('0x69'),'attributes':['id'],'raw':!![]}]})[_0x55a0('0x2c')](handleEntityNotFound(_0x3db031,null))[_0x55a0('0x2c')](function(_0x42173d){var _0x3021f0=_['map'](_0x42173d,'id');var _0x307e92=[];var _0x159285=[];var _0x40eb33=squel['select']();_0x40eb33[_0x55a0('0x75')](_0x55a0('0x76'))['from'](_0x55a0('0x77'),'tq')['join'](_0x55a0('0x78'),'ut',_0x55a0('0x79'))[_0x55a0('0x42')](_0x55a0('0x7a'),_0x3a87c9[_0x55a0('0x4c')]['id']);for(var _0x377170=0x0;_0x377170<_0x42173d['length'];_0x377170+=0x1){let _0x72159b=_0x42173d[_0x377170];for(var _0x226c33=0x0;_0x226c33<_0x72159b[_0x55a0('0x69')]['length'];_0x226c33+=0x1){let _0x302172=_0x72159b[_0x55a0('0x69')][_0x226c33];var _0x136b74=_0x40eb33[_0x55a0('0x7b')]();_0x136b74[_0x55a0('0x42')](_0x55a0('0x7c'),_0x302172['id']);_0x159285['push'](db['sequelize'][_0x55a0('0x38')](_0x136b74['toString'](),{'type':db[_0x55a0('0x6c')][_0x55a0('0x7d')]['SELECT']})[_0x55a0('0x2c')](function(_0x1c9257){if(_0x1c9257['length']===0x1){return _0x302172['id'];}else{var _0x5e02a6=_[_0x55a0('0x7e')](_[_0x55a0('0x33')](_0x1c9257,_0x55a0('0x7f')),function(_0x10e2b6){return _[_0x55a0('0x80')](_0x3021f0,_0x10e2b6);});if(_0x5e02a6){return _0x302172['id'];}}}));}}return BPromise[_0x55a0('0x81')](_0x159285)['then'](function(_0x263220){_0x307e92=_(_0x307e92)[_0x55a0('0x82')](_0x263220)[_0x55a0('0x83')]()['value']();return db[_0x55a0('0x48')][_0x55a0('0x4e')]({'where':{'id':_0x3a87c9['params']['id']}})[_0x55a0('0x2c')](function(_0x853f52){return db[_0x55a0('0x6c')][_0x55a0('0x6d')](function(_0x3dd791){return _0x853f52[_0x55a0('0x73')](_0x3a87c9[_0x55a0('0x38')]['ids'],{'transaction':_0x3dd791})['then'](function(){if(!_[_0x55a0('0x84')](_0x307e92)){return _0x853f52[_0x55a0('0x85')](_0x307e92,{'transaction':_0x3dd791});}})[_0x55a0('0x2c')](function(){_0x307e92['forEach'](function(_0x36735c){socket[_0x55a0('0x71')](_0x55a0('0x86'),{'UserId':_0x36735c,'WhatsappQueueId':_0x853f52['id']});});});});});});})[_0x55a0('0x2c')](respondWithStatusCode(_0x3db031,null))[_0x55a0('0x4a')](handleError(_0x3db031,null));};exports['addAgents']=function(_0x432198,_0xa73324,_0x3b030d){return db[_0x55a0('0x48')][_0x55a0('0x4e')]({'where':{'id':_0x432198['params']['id']}})[_0x55a0('0x2c')](handleEntityNotFound(_0xa73324,null))['then'](function(_0x4dd7f7){if(_0x4dd7f7){return _0x4dd7f7[_0x55a0('0x87')](_0x432198['body'][_0x55a0('0x68')],_['omit'](_0x432198[_0x55a0('0x50')],[_0x55a0('0x68'),'id'])||{})[_0x55a0('0x88')](function(_0x4d4476){for(var _0x27b471=0x0;_0x27b471<_0x432198[_0x55a0('0x50')][_0x55a0('0x68')][_0x55a0('0x3e')];_0x27b471+=0x1){socket[_0x55a0('0x71')]('userWhatsappQueue:save',{'UserId':Number(_0x432198[_0x55a0('0x50')][_0x55a0('0x68')][_0x27b471]),'WhatsappQueueId':Number(_0x432198[_0x55a0('0x4c')]['id'])});}return _0x4d4476;});}})['then'](respondWithResult(_0xa73324,null))[_0x55a0('0x4a')](handleError(_0xa73324,null));};exports[_0x55a0('0x85')]=function(_0x223352,_0xb4a63c,_0x246cf4){return db[_0x55a0('0x48')][_0x55a0('0x4e')]({'where':{'id':_0x223352[_0x55a0('0x4c')]['id']}})[_0x55a0('0x2c')](handleEntityNotFound(_0xb4a63c,null))['then'](function(_0x27e760){if(_0x27e760){return _0x27e760[_0x55a0('0x85')](_0x223352[_0x55a0('0x38')][_0x55a0('0x68')])[_0x55a0('0x2c')](function(){if(_[_0x55a0('0x89')](_0x223352[_0x55a0('0x38')]['ids'])){for(var _0x5dae03=0x0;_0x5dae03<_0x223352['query'][_0x55a0('0x68')][_0x55a0('0x3e')];_0x5dae03+=0x1){socket[_0x55a0('0x71')](_0x55a0('0x86'),{'UserId':Number(_0x223352[_0x55a0('0x38')][_0x55a0('0x68')][_0x5dae03]),'WhatsappQueueId':Number(_0x223352['params']['id'])});}}else{socket[_0x55a0('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x223352['query'][_0x55a0('0x68')]),'WhatsappQueueId':Number(_0x223352['params']['id'])});}});}})[_0x55a0('0x2c')](respondWithStatusCode(_0xb4a63c,null))[_0x55a0('0x4a')](handleError(_0xb4a63c,null));};exports[_0x55a0('0x8a')]=function(_0x2e26ba,_0x1f4e68,_0x23f134){var _0x443ded={};var _0x102901={};var _0x9cfdd2;var _0x4d0d79;return db[_0x55a0('0x48')]['findOne']({'where':{'id':_0x2e26ba[_0x55a0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1f4e68,null))[_0x55a0('0x2c')](function(_0x4a5b49){if(_0x4a5b49){_0x9cfdd2=_0x4a5b49;_0x102901['model']=_['keys'](db[_0x55a0('0x5c')][_0x55a0('0x34')]);_0x102901[_0x55a0('0x38')]=_['keys'](_0x2e26ba['query']);_0x102901['filters']=_[_0x55a0('0x3b')](_0x102901['model'],_0x102901[_0x55a0('0x38')]);_0x443ded[_0x55a0('0x3c')]=_[_0x55a0('0x3b')](_0x102901[_0x55a0('0x37')],qs[_0x55a0('0x3d')](_0x2e26ba[_0x55a0('0x38')][_0x55a0('0x3d')]));_0x443ded['attributes']=_0x443ded[_0x55a0('0x3c')]['length']?_0x443ded[_0x55a0('0x3c')]:_0x102901[_0x55a0('0x37')];_0x443ded['order']=qs[_0x55a0('0x41')](_0x2e26ba['query'][_0x55a0('0x41')]);_0x443ded[_0x55a0('0x42')]=qs[_0x55a0('0x3a')](_[_0x55a0('0x43')](_0x2e26ba['query'],_0x102901[_0x55a0('0x3a')]));if(_0x2e26ba['query']['filter']){_0x443ded[_0x55a0('0x42')]=_[_0x55a0('0x44')](_0x443ded[_0x55a0('0x42')],{'$or':_['map'](_0x443ded[_0x55a0('0x3c')],function(_0x23e20b){var _0xd0ab76={};_0xd0ab76[_0x23e20b]={'$like':'%'+_0x2e26ba['query'][_0x55a0('0x46')]+'%'};return _0xd0ab76;})});}_0x443ded=_[_0x55a0('0x44')]({},_0x443ded,_0x2e26ba[_0x55a0('0x47')]);return _0x9cfdd2['getAgents'](_0x443ded);}})['then'](function(_0x563605){if(_0x563605){_0x4d0d79=_0x563605[_0x55a0('0x3e')];if(!_0x2e26ba[_0x55a0('0x38')]['hasOwnProperty'](_0x55a0('0x5b'))){_0x443ded['limit']=qs['limit'](_0x2e26ba[_0x55a0('0x38')][_0x55a0('0x23')]);_0x443ded[_0x55a0('0x26')]=qs['offset'](_0x2e26ba[_0x55a0('0x38')][_0x55a0('0x26')]);}return _0x9cfdd2[_0x55a0('0x8a')](_0x443ded);}})[_0x55a0('0x2c')](function(_0x346b76){if(_0x346b76){return _0x346b76?{'count':_0x4d0d79,'rows':_0x346b76}:null;}})[_0x55a0('0x2c')](respondWithResult(_0x1f4e68,null))['catch'](handleError(_0x1f4e68,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 19c30fc..8ccac5a 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 _0xd90f=['events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3a9815,_0x47eb16){var _0x188653=function(_0x203e84){while(--_0x203e84){_0x3a9815['push'](_0x3a9815['shift']());}};_0x188653(++_0x47eb16);}(_0xd90f,0xf0));var _0xfd90=function(_0x43250f,_0x3f902c){_0x43250f=_0x43250f-0x0;var _0x56d12f=_0xd90f[_0x43250f];return _0x56d12f;};'use strict';var EventEmitter=require(_0xfd90('0x0'));var WhatsappQueue=require(_0xfd90('0x1'))['db'][_0xfd90('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xfd90('0x3')](0x0);var events={'afterCreate':_0xfd90('0x4'),'afterUpdate':_0xfd90('0x5'),'afterDestroy':_0xfd90('0x6')};function emitEvent(_0xb1bf2b){return function(_0x418014,_0x1005ed,_0x2e0026){WhatsappQueueEvents['emit'](_0xb1bf2b+':'+_0x418014['id'],_0x418014);WhatsappQueueEvents[_0xfd90('0x7')](_0xb1bf2b,_0x418014);_0x2e0026(null);};}for(var e in events){if(events[_0xfd90('0x8')](e)){var event=events[e];WhatsappQueue[_0xfd90('0x9')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x26a9=['hasOwnProperty','hook','setMaxListeners','update','remove','emit'];(function(_0x188c8b,_0x2d0773){var _0x1f6465=function(_0x5b9527){while(--_0x5b9527){_0x188c8b['push'](_0x188c8b['shift']());}};_0x1f6465(++_0x2d0773);}(_0x26a9,0x13a));var _0x926a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x26a9[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x926a('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x926a('0x1'),'afterDestroy':_0x926a('0x2')};function emitEvent(_0x35efdd){return function(_0x1f576b,_0x2bd3a6,_0x194f8b){WhatsappQueueEvents[_0x926a('0x3')](_0x35efdd+':'+_0x1f576b['id'],_0x1f576b);WhatsappQueueEvents[_0x926a('0x3')](_0x35efdd,_0x1f576b);_0x194f8b(null);};}for(var e in events){if(events[_0x926a('0x4')](e)){var event=events[e];WhatsappQueue[_0x926a('0x5')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 649058c..e09b9a9 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 _0x60f5=['request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0x60f5,0x10c));var _0x560f=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x60f5[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x560f('0x0'));var util=require(_0x560f('0x1'));var logger=require(_0x560f('0x2'))(_0x560f('0x3'));var moment=require('moment');var BPromise=require(_0x560f('0x4'));var rp=require(_0x560f('0x5'));var fs=require('fs');var path=require(_0x560f('0x6'));var rimraf=require(_0x560f('0x7'));var config=require(_0x560f('0x8'));var attributes=require(_0x560f('0x9'));module[_0x560f('0xa')]=function(_0x31fcb2,_0x1e0a69){return _0x31fcb2['define'](_0x560f('0xb'),attributes,{'tableName':_0x560f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x040f=['exports','define','whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes'];(function(_0xf6f3b1,_0x44769d){var _0x1125a7=function(_0x1659b8){while(--_0x1659b8){_0xf6f3b1['push'](_0xf6f3b1['shift']());}};_0x1125a7(++_0x44769d);}(_0x040f,0xff));var _0xf040=function(_0x3aea6a,_0x51b0ec){_0x3aea6a=_0x3aea6a-0x0;var _0x5cb945=_0x040f[_0x3aea6a];return _0x5cb945;};'use strict';var _=require(_0xf040('0x0'));var util=require(_0xf040('0x1'));var logger=require(_0xf040('0x2'))('api');var moment=require(_0xf040('0x3'));var BPromise=require(_0xf040('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf040('0x5'));var rimraf=require(_0xf040('0x6'));var config=require(_0xf040('0x7'));var attributes=require(_0xf040('0x8'));module[_0xf040('0x9')]=function(_0x2e2f1e,_0x5cafa2){return _0x2e2f1e[_0xf040('0xa')]('WhatsappQueue',attributes,{'tableName':_0xf040('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 652b063..c71baa5 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 _0x40ae=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','WhatsappQueue','findAll','options','raw','where','attributes','limit','map','model','include','GetWhatsappQueue','stringify','ShowWhatsappQueue','find','then','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3dfeb6,_0x3fb4cd){var _0x418167=function(_0x14927a){while(--_0x14927a){_0x3dfeb6['push'](_0x3dfeb6['shift']());}};_0x418167(++_0x3fb4cd);}(_0x40ae,0x9f));var _0xe40a=function(_0x5442b4,_0x17b8b6){_0x5442b4=_0x5442b4-0x0;var _0xa05578=_0x40ae[_0x5442b4];return _0xa05578;};'use strict';var _=require(_0xe40a('0x0'));var util=require('util');var moment=require(_0xe40a('0x1'));var BPromise=require(_0xe40a('0x2'));var rs=require(_0xe40a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe40a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe40a('0x5'))(_0xe40a('0x6'));var config=require(_0xe40a('0x7'));var jayson=require(_0xe40a('0x8'));var client=jayson[_0xe40a('0x9')][_0xe40a('0xa')]({'port':0x232a});config['redis']=_[_0xe40a('0xb')](config[_0xe40a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe40a('0xd'))(new Redis(config[_0xe40a('0xc')]));require(_0xe40a('0xe'))[_0xe40a('0xf')](socket);function respondWithRpcPromise(_0xf3e71f,_0x131d52,_0x481088){return new BPromise(function(_0x524304,_0x4a7068){return client[_0xe40a('0x10')](_0xf3e71f,_0x481088)['then'](function(_0x49c050){logger[_0xe40a('0x11')](_0xe40a('0x12'),_0x131d52,'request\x20sent');logger[_0xe40a('0x13')](_0xe40a('0x14'),_0x131d52,'request\x20sent',JSON['stringify'](_0x49c050));if(_0x49c050['error']){if(_0x49c050[_0xe40a('0x15')][_0xe40a('0x16')]===0x1f4){logger[_0xe40a('0x15')](_0xe40a('0x12'),_0x131d52,_0x49c050[_0xe40a('0x15')][_0xe40a('0x17')]);return _0x4a7068(_0x49c050[_0xe40a('0x15')][_0xe40a('0x17')]);}logger[_0xe40a('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x131d52,_0x49c050[_0xe40a('0x15')][_0xe40a('0x17')]);return _0x524304(_0x49c050[_0xe40a('0x15')][_0xe40a('0x17')]);}else{logger[_0xe40a('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x131d52,'request\x20sent');_0x524304(_0x49c050[_0xe40a('0x18')][_0xe40a('0x17')]);}})[_0xe40a('0x19')](function(_0x3bdea8){logger[_0xe40a('0x15')](_0xe40a('0x12'),_0x131d52,_0x3bdea8);_0x4a7068(_0x3bdea8);});});}exports['GetWhatsappQueue']=function(_0x16092f){var _0x248687=this;return new Promise(function(_0x45db44,_0x17463a){return db[_0xe40a('0x1a')][_0xe40a('0x1b')]({'raw':_0x16092f['options']?_0x16092f[_0xe40a('0x1c')][_0xe40a('0x1d')]===undefined?!![]:![]:!![],'where':_0x16092f[_0xe40a('0x1c')]?_0x16092f[_0xe40a('0x1c')][_0xe40a('0x1e')]||null:null,'attributes':_0x16092f['options']?_0x16092f[_0xe40a('0x1c')][_0xe40a('0x1f')]||null:null,'limit':_0x16092f[_0xe40a('0x1c')]?_0x16092f['options'][_0xe40a('0x20')]||null:null,'include':_0x16092f['options']?_0x16092f[_0xe40a('0x1c')]['include']?_[_0xe40a('0x21')](_0x16092f[_0xe40a('0x1c')]['include'],function(_0x12b4b7){return{'model':db[_0x12b4b7[_0xe40a('0x22')]],'as':_0x12b4b7['as'],'attributes':_0x12b4b7[_0xe40a('0x1f')],'include':_0x12b4b7[_0xe40a('0x23')]?_[_0xe40a('0x21')](_0x12b4b7[_0xe40a('0x23')],function(_0x11733c){return{'model':db[_0x11733c['model']],'as':_0x11733c['as'],'attributes':_0x11733c[_0xe40a('0x1f')],'include':_0x11733c[_0xe40a('0x23')]?_[_0xe40a('0x21')](_0x11733c['include'],function(_0x40cf9f){return{'model':db[_0x40cf9f['model']],'as':_0x40cf9f['as'],'attributes':_0x40cf9f[_0xe40a('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44d80e){logger[_0xe40a('0x11')](_0xe40a('0x24'),_0x16092f);logger[_0xe40a('0x13')](_0xe40a('0x24'),_0x16092f,JSON[_0xe40a('0x25')](_0x44d80e));_0x45db44(_0x44d80e);})['catch'](function(_0x3c196d){logger[_0xe40a('0x15')]('GetWhatsappQueue',_0x3c196d['message'],_0x16092f);_0x17463a(_0x248687[_0xe40a('0x15')](0x1f4,_0x3c196d['message']));});});};exports[_0xe40a('0x26')]=function(_0x38836f){var _0x51b41e=this;return new Promise(function(_0x5d6bc9,_0x3f9510){return db[_0xe40a('0x1a')][_0xe40a('0x27')]({'raw':_0x38836f['options']?_0x38836f['options']['raw']===undefined?!![]:![]:!![],'where':_0x38836f[_0xe40a('0x1c')]?_0x38836f['options'][_0xe40a('0x1e')]||null:null,'attributes':_0x38836f[_0xe40a('0x1c')]?_0x38836f[_0xe40a('0x1c')][_0xe40a('0x1f')]||null:null,'include':_0x38836f[_0xe40a('0x1c')]?_0x38836f[_0xe40a('0x1c')]['include']?_['map'](_0x38836f['options']['include'],function(_0x2fa863){return{'model':db[_0x2fa863[_0xe40a('0x22')]],'as':_0x2fa863['as'],'attributes':_0x2fa863[_0xe40a('0x1f')],'include':_0x2fa863[_0xe40a('0x23')]?_[_0xe40a('0x21')](_0x2fa863['include'],function(_0x5e3263){return{'model':db[_0x5e3263[_0xe40a('0x22')]],'as':_0x5e3263['as'],'attributes':_0x5e3263[_0xe40a('0x1f')],'include':_0x5e3263[_0xe40a('0x23')]?_[_0xe40a('0x21')](_0x5e3263[_0xe40a('0x23')],function(_0x4bc0ca){return{'model':db[_0x4bc0ca[_0xe40a('0x22')]],'as':_0x4bc0ca['as'],'attributes':_0x4bc0ca[_0xe40a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe40a('0x28')](function(_0x5a0168){logger['info'](_0xe40a('0x26'),_0x38836f);logger['debug'](_0xe40a('0x26'),_0x38836f,JSON[_0xe40a('0x25')](_0x5a0168));_0x5d6bc9(_0x5a0168);})[_0xe40a('0x19')](function(_0x14c3d1){logger['error'](_0xe40a('0x26'),_0x14c3d1[_0xe40a('0x17')],_0x38836f);_0x3f9510(_0x51b41e[_0xe40a('0x15')](0x1f4,_0x14c3d1['message']));});});}; \ No newline at end of file +var _0xd8b5=['socket.io-emitter','./whatsappQueue.socket','request','info','request\x20sent','error','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','findAll','options','where','attributes','limit','map','include','model','then','stringify','ShowWhatsappQueue','find','raw','debug','lodash','util','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','redis','defaults','localhost'];(function(_0x54c5ed,_0x27c4a4){var _0x3eb7bd=function(_0xe29c65){while(--_0xe29c65){_0x54c5ed['push'](_0x54c5ed['shift']());}};_0x3eb7bd(++_0x27c4a4);}(_0xd8b5,0xcd));var _0x5d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b5[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5d8b('0x0'));var util=require(_0x5d8b('0x1'));var moment=require('moment');var BPromise=require(_0x5d8b('0x2'));var rs=require(_0x5d8b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d8b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5d8b('0x5'));var jayson=require(_0x5d8b('0x6'));var client=jayson[_0x5d8b('0x7')]['http']({'port':0x232a});config[_0x5d8b('0x8')]=_[_0x5d8b('0x9')](config[_0x5d8b('0x8')],{'host':_0x5d8b('0xa'),'port':0x18eb});var socket=require(_0x5d8b('0xb'))(new Redis(config[_0x5d8b('0x8')]));require(_0x5d8b('0xc'))['register'](socket);function respondWithRpcPromise(_0x3bf752,_0xbaa36e,_0x566e5b){return new BPromise(function(_0xecbc7,_0x310997){return client[_0x5d8b('0xd')](_0x3bf752,_0x566e5b)['then'](function(_0x3aa174){logger[_0x5d8b('0xe')]('WhatsappQueue,\x20%s,\x20%s',_0xbaa36e,_0x5d8b('0xf'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0xbaa36e,_0x5d8b('0xf'),JSON['stringify'](_0x3aa174));if(_0x3aa174['error']){if(_0x3aa174[_0x5d8b('0x10')]['code']===0x1f4){logger[_0x5d8b('0x10')](_0x5d8b('0x11'),_0xbaa36e,_0x3aa174[_0x5d8b('0x10')][_0x5d8b('0x12')]);return _0x310997(_0x3aa174[_0x5d8b('0x10')][_0x5d8b('0x12')]);}logger[_0x5d8b('0x10')](_0x5d8b('0x11'),_0xbaa36e,_0x3aa174['error']['message']);return _0xecbc7(_0x3aa174[_0x5d8b('0x10')][_0x5d8b('0x12')]);}else{logger['info'](_0x5d8b('0x11'),_0xbaa36e,'request\x20sent');_0xecbc7(_0x3aa174[_0x5d8b('0x13')][_0x5d8b('0x12')]);}})[_0x5d8b('0x14')](function(_0x41d2b9){logger['error'](_0x5d8b('0x11'),_0xbaa36e,_0x41d2b9);_0x310997(_0x41d2b9);});});}exports[_0x5d8b('0x15')]=function(_0x23b0e4){var _0x2b68a0=this;return new Promise(function(_0x18712b,_0x7ea2d4){return db['WhatsappQueue'][_0x5d8b('0x16')]({'raw':_0x23b0e4['options']?_0x23b0e4['options']['raw']===undefined?!![]:![]:!![],'where':_0x23b0e4[_0x5d8b('0x17')]?_0x23b0e4[_0x5d8b('0x17')][_0x5d8b('0x18')]||null:null,'attributes':_0x23b0e4[_0x5d8b('0x17')]?_0x23b0e4[_0x5d8b('0x17')][_0x5d8b('0x19')]||null:null,'limit':_0x23b0e4[_0x5d8b('0x17')]?_0x23b0e4[_0x5d8b('0x17')][_0x5d8b('0x1a')]||null:null,'include':_0x23b0e4[_0x5d8b('0x17')]?_0x23b0e4['options']['include']?_[_0x5d8b('0x1b')](_0x23b0e4[_0x5d8b('0x17')][_0x5d8b('0x1c')],function(_0x4fb21f){return{'model':db[_0x4fb21f[_0x5d8b('0x1d')]],'as':_0x4fb21f['as'],'attributes':_0x4fb21f[_0x5d8b('0x19')],'include':_0x4fb21f['include']?_['map'](_0x4fb21f[_0x5d8b('0x1c')],function(_0x3b7c2d){return{'model':db[_0x3b7c2d[_0x5d8b('0x1d')]],'as':_0x3b7c2d['as'],'attributes':_0x3b7c2d[_0x5d8b('0x19')],'include':_0x3b7c2d[_0x5d8b('0x1c')]?_[_0x5d8b('0x1b')](_0x3b7c2d[_0x5d8b('0x1c')],function(_0x591f7a){return{'model':db[_0x591f7a[_0x5d8b('0x1d')]],'as':_0x591f7a['as'],'attributes':_0x591f7a[_0x5d8b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5d8b('0x1e')](function(_0x21c4df){logger[_0x5d8b('0xe')](_0x5d8b('0x15'),_0x23b0e4);logger['debug'](_0x5d8b('0x15'),_0x23b0e4,JSON[_0x5d8b('0x1f')](_0x21c4df));_0x18712b(_0x21c4df);})[_0x5d8b('0x14')](function(_0x73f4d7){logger[_0x5d8b('0x10')](_0x5d8b('0x15'),_0x73f4d7[_0x5d8b('0x12')],_0x23b0e4);_0x7ea2d4(_0x2b68a0[_0x5d8b('0x10')](0x1f4,_0x73f4d7[_0x5d8b('0x12')]));});});};exports[_0x5d8b('0x20')]=function(_0x323a7){var _0x78b664=this;return new Promise(function(_0x501512,_0xb7ffde){return db['WhatsappQueue'][_0x5d8b('0x21')]({'raw':_0x323a7[_0x5d8b('0x17')]?_0x323a7[_0x5d8b('0x17')][_0x5d8b('0x22')]===undefined?!![]:![]:!![],'where':_0x323a7[_0x5d8b('0x17')]?_0x323a7[_0x5d8b('0x17')][_0x5d8b('0x18')]||null:null,'attributes':_0x323a7[_0x5d8b('0x17')]?_0x323a7['options'][_0x5d8b('0x19')]||null:null,'include':_0x323a7['options']?_0x323a7[_0x5d8b('0x17')][_0x5d8b('0x1c')]?_[_0x5d8b('0x1b')](_0x323a7['options']['include'],function(_0x4ac69f){return{'model':db[_0x4ac69f[_0x5d8b('0x1d')]],'as':_0x4ac69f['as'],'attributes':_0x4ac69f[_0x5d8b('0x19')],'include':_0x4ac69f[_0x5d8b('0x1c')]?_[_0x5d8b('0x1b')](_0x4ac69f['include'],function(_0x32e31e){return{'model':db[_0x32e31e['model']],'as':_0x32e31e['as'],'attributes':_0x32e31e[_0x5d8b('0x19')],'include':_0x32e31e[_0x5d8b('0x1c')]?_['map'](_0x32e31e[_0x5d8b('0x1c')],function(_0x241837){return{'model':db[_0x241837[_0x5d8b('0x1d')]],'as':_0x241837['as'],'attributes':_0x241837[_0x5d8b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5d8b('0x1e')](function(_0x5d2e2d){logger[_0x5d8b('0xe')](_0x5d8b('0x20'),_0x323a7);logger[_0x5d8b('0x23')](_0x5d8b('0x20'),_0x323a7,JSON[_0x5d8b('0x1f')](_0x5d2e2d));_0x501512(_0x5d2e2d);})[_0x5d8b('0x14')](function(_0x6bc763){logger[_0x5d8b('0x10')](_0x5d8b('0x20'),_0x6bc763[_0x5d8b('0x12')],_0x323a7);_0xb7ffde(_0x78b664[_0x5d8b('0x10')](0x1f4,_0x6bc763[_0x5d8b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index c7f5e40..e787841 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 _0x2aab=['emit','removeListener','register','length','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2aab,0x9a));var _0xb2aa=function(_0x27fa45,_0xe114d4){_0x27fa45=_0x27fa45-0x0;var _0x1f8f7a=_0x2aab[_0x27fa45];return _0x1f8f7a;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save',_0xb2aa('0x0'),'update'];function createListener(_0x298c06,_0x1a0d3f){return function(_0xbe1229){_0x1a0d3f[_0xb2aa('0x1')](_0x298c06,_0xbe1229);};}function removeListener(_0x37b24a,_0x3e2708){return function(){WhatsappQueueEvents[_0xb2aa('0x2')](_0x37b24a,_0x3e2708);};}exports[_0xb2aa('0x3')]=function(_0x3f7de6){for(var _0x2c0d82=0x0,_0x5c2171=events[_0xb2aa('0x4')];_0x2c0d82<_0x5c2171;_0x2c0d82++){var _0x24a960=events[_0x2c0d82];var _0x449d5c=createListener('whatsappQueue:'+_0x24a960,_0x3f7de6);WhatsappQueueEvents['on'](_0x24a960,_0x449d5c);}}; \ No newline at end of file +var _0x08be=['./whatsappQueue.events','remove','update','removeListener','register','length','whatsappQueue:'];(function(_0x4817a9,_0x584c19){var _0x52c052=function(_0x60dd01){while(--_0x60dd01){_0x4817a9['push'](_0x4817a9['shift']());}};_0x52c052(++_0x584c19);}(_0x08be,0x93));var _0xe08b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x08be[_0x2dafbe];return _0x58a45a;};'use strict';var WhatsappQueueEvents=require(_0xe08b('0x0'));var events=['save',_0xe08b('0x1'),_0xe08b('0x2')];function createListener(_0x373857,_0x4d4f00){return function(_0x464b3e){_0x4d4f00['emit'](_0x373857,_0x464b3e);};}function removeListener(_0x143206,_0x3d6e75){return function(){WhatsappQueueEvents[_0xe08b('0x3')](_0x143206,_0x3d6e75);};}exports[_0xe08b('0x4')]=function(_0x2c0260){for(var _0x4e840f=0x0,_0x37e03d=events[_0xe08b('0x5')];_0x4e840f<_0x37e03d;_0x4e840f++){var _0x2c761f=events[_0x4e840f];var _0x62741c=createListener(_0xe08b('0x6')+_0x2c761f,_0x2c0260);WhatsappQueueEvents['on'](_0x2c761f,_0x62741c);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 00a90c1..6056a3e 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 _0x85b0=['../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x580fd1,_0xc5d0b2){var _0x12facb=function(_0x5b5917){while(--_0x5b5917){_0x580fd1['push'](_0x580fd1['shift']());}};_0x12facb(++_0xc5d0b2);}(_0x85b0,0xdf));var _0x085b=function(_0x4c16a4,_0x2c79a9){_0x4c16a4=_0x4c16a4-0x0;var _0x2735f4=_0x85b0[_0x4c16a4];return _0x2735f4;};'use strict';var multer=require(_0x085b('0x0'));var util=require(_0x085b('0x1'));var path=require(_0x085b('0x2'));var timeout=require('connect-timeout');var express=require(_0x085b('0x3'));var router=express[_0x085b('0x4')]();var fs_extra=require(_0x085b('0x5'));var auth=require(_0x085b('0x6'));var interaction=require(_0x085b('0x7'));var config=require(_0x085b('0x8'));var controller=require(_0x085b('0x9'));router[_0x085b('0xa')]('/',auth[_0x085b('0xb')](),controller[_0x085b('0xc')]);router[_0x085b('0xa')]('/describe',auth[_0x085b('0xb')](),controller['describe']);router[_0x085b('0xa')](_0x085b('0xd'),auth[_0x085b('0xb')](),controller[_0x085b('0xe')]);router[_0x085b('0xf')]('/',auth[_0x085b('0xb')](),controller[_0x085b('0x10')]);router[_0x085b('0x11')](_0x085b('0xd'),auth[_0x085b('0xb')](),controller[_0x085b('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x085b('0x13')]);module[_0x085b('0x14')]=router; \ No newline at end of file +var _0xf041=['/:id','show','post','create','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2f7cf7,_0x46692e){var _0x33ba6d=function(_0x566c5a){while(--_0x566c5a){_0x2f7cf7['push'](_0x2f7cf7['shift']());}};_0x33ba6d(++_0x46692e);}(_0xf041,0x16b));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x1f04('0x0'));var util=require('util');var path=require(_0x1f04('0x1'));var timeout=require(_0x1f04('0x2'));var express=require(_0x1f04('0x3'));var router=express[_0x1f04('0x4')]();var fs_extra=require(_0x1f04('0x5'));var auth=require(_0x1f04('0x6'));var interaction=require(_0x1f04('0x7'));var config=require(_0x1f04('0x8'));var controller=require(_0x1f04('0x9'));router[_0x1f04('0xa')]('/',auth[_0x1f04('0xb')](),controller[_0x1f04('0xc')]);router[_0x1f04('0xa')](_0x1f04('0xd'),auth[_0x1f04('0xb')](),controller[_0x1f04('0xe')]);router['get'](_0x1f04('0xf'),auth[_0x1f04('0xb')](),controller[_0x1f04('0x10')]);router[_0x1f04('0x11')]('/',auth[_0x1f04('0xb')](),controller[_0x1f04('0x12')]);router['put'](_0x1f04('0xf'),auth[_0x1f04('0xb')](),controller[_0x1f04('0x13')]);router[_0x1f04('0x14')](_0x1f04('0xf'),auth[_0x1f04('0xb')](),controller['destroy']);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 41540bf..8cfc57e 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x3e9592,_0x5b5285){var _0x363044=function(_0x1dbc0d){while(--_0x1dbc0d){_0x3e9592['push'](_0x3e9592['shift']());}};_0x363044(++_0x5b5285);}(_0x7a54,0x106));var _0x47a5=function(_0x1a2194,_0x5c3e61){_0x1a2194=_0x1a2194-0x0;var _0x3d8342=_0x7a54[_0x1a2194];return _0x3d8342;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0xd66c78,_0x26b183){var _0x4035b9=function(_0x481164){while(--_0x481164){_0xd66c78['push'](_0xd66c78['shift']());}};_0x4035b9(++_0x26b183);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 21e081f..9b88670 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 _0x1775=['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','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','update','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x4f2930,_0x40ad4b){var _0x397db7=function(_0x2d9204){while(--_0x2d9204){_0x4f2930['push'](_0x4f2930['shift']());}};_0x397db7(++_0x40ad4b);}(_0x1775,0x1db));var _0x5177=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1775[_0x17d9e3];return _0x14192d;};'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'];function respondWithStatusCode(_0xc613b9,_0x3c4ced){_0x3c4ced=_0x3c4ced||0xcc;return function(_0x111e99){if(_0x111e99){return _0xc613b9[_0x5177('0x1c')](_0x3c4ced);}return _0xc613b9[_0x5177('0x1d')](_0x3c4ced)[_0x5177('0x1e')]();};}function respondWithResult(_0x3e6224,_0x1eb9dd){_0x1eb9dd=_0x1eb9dd||0xc8;return function(_0x41bef4){if(_0x41bef4){return _0x3e6224[_0x5177('0x1d')](_0x1eb9dd)[_0x5177('0x1f')](_0x41bef4);}};}function respondWithFilteredResult(_0x31aff8,_0x1b32e6){return function(_0x175ca6){if(_0x175ca6){var _0x2ab5e5=typeof _0x1b32e6[_0x5177('0x20')]===_0x5177('0x21')&&typeof _0x1b32e6['limit']===_0x5177('0x21');var _0x41e687=_0x175ca6[_0x5177('0x22')];var _0x1b4102=_0x2ab5e5?0x0:_0x1b32e6['offset'];var _0x3e6944=_0x2ab5e5?_0x175ca6[_0x5177('0x22')]:_0x1b32e6[_0x5177('0x20')]+_0x1b32e6['limit'];var _0x86f5f8;if(_0x3e6944>=_0x41e687){_0x3e6944=_0x41e687;_0x86f5f8=0xc8;}else{_0x86f5f8=0xce;}_0x31aff8['status'](_0x86f5f8);return _0x31aff8[_0x5177('0x23')](_0x5177('0x24'),_0x1b4102+'-'+_0x3e6944+'/'+_0x41e687)[_0x5177('0x1f')](_0x175ca6);}return null;};}function patchUpdates(_0x27b732){return function(_0x451e5c){try{jsonpatch[_0x5177('0x25')](_0x451e5c,_0x27b732,!![]);}catch(_0x174c4f){return BPromise[_0x5177('0x26')](_0x174c4f);}return _0x451e5c[_0x5177('0x27')]();};}function saveUpdates(_0x2a95cc,_0x23dad2){return function(_0x3b0c37){if(_0x3b0c37){return _0x3b0c37['update'](_0x2a95cc)[_0x5177('0x28')](function(_0x556f96){return _0x556f96;});}return null;};}function removeEntity(_0x30b60f,_0x2c68d8){return function(_0x3b39b5){if(_0x3b39b5){return _0x3b39b5[_0x5177('0x29')]()['then'](function(){_0x30b60f[_0x5177('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x564139,_0x19a0c2){return function(_0x15cb93){if(!_0x15cb93){_0x564139['sendStatus'](0x194);}return _0x15cb93;};}function handleError(_0x3285b3,_0x4eba3a){_0x4eba3a=_0x4eba3a||0x1f4;return function(_0x231d35){logger[_0x5177('0x2a')](_0x231d35['stack']);if(_0x231d35[_0x5177('0x2b')]){delete _0x231d35[_0x5177('0x2b')];}_0x3285b3[_0x5177('0x1d')](_0x4eba3a)[_0x5177('0x2c')](_0x231d35);};}exports[_0x5177('0x2d')]=function(_0x1cef5d,_0x5577bb){var _0x498fcd={},_0x45cf20={},_0x1c660e={'count':0x0,'rows':[]};var _0x7dae59=_[_0x5177('0x2e')](db[_0x5177('0x2f')][_0x5177('0x30')],function(_0x31eb9f){return{'name':_0x31eb9f[_0x5177('0x31')],'type':_0x31eb9f['type'][_0x5177('0x32')]};});_0x45cf20[_0x5177('0x33')]=_['map'](_0x7dae59,_0x5177('0x2b'));_0x45cf20['query']=_[_0x5177('0x34')](_0x1cef5d[_0x5177('0x35')]);_0x45cf20[_0x5177('0x36')]=_['intersection'](_0x45cf20['model'],_0x45cf20[_0x5177('0x35')]);_0x498fcd[_0x5177('0x37')]=_[_0x5177('0x38')](_0x45cf20[_0x5177('0x33')],qs[_0x5177('0x39')](_0x1cef5d[_0x5177('0x35')][_0x5177('0x39')]));_0x498fcd[_0x5177('0x37')]=_0x498fcd['attributes'][_0x5177('0x3a')]?_0x498fcd[_0x5177('0x37')]:_0x45cf20['model'];if(!_0x1cef5d[_0x5177('0x35')][_0x5177('0x3b')](_0x5177('0x3c'))){_0x498fcd[_0x5177('0x3d')]=qs[_0x5177('0x3d')](_0x1cef5d[_0x5177('0x35')]['limit']);_0x498fcd[_0x5177('0x20')]=qs[_0x5177('0x20')](_0x1cef5d[_0x5177('0x35')][_0x5177('0x20')]);}_0x498fcd[_0x5177('0x3e')]=qs[_0x5177('0x3f')](_0x1cef5d[_0x5177('0x35')]['sort']);_0x498fcd[_0x5177('0x40')]=qs[_0x5177('0x36')](_['pick'](_0x1cef5d['query'],_0x45cf20[_0x5177('0x36')]),_0x7dae59);if(_0x1cef5d[_0x5177('0x35')][_0x5177('0x41')]){_0x498fcd[_0x5177('0x40')]=_[_0x5177('0x42')](_0x498fcd[_0x5177('0x40')],{'$or':_[_0x5177('0x2e')](_0x7dae59,function(_0x24fd92){if(_0x24fd92[_0x5177('0x43')]!==_0x5177('0x44')){var _0x16fabc={};_0x16fabc[_0x24fd92[_0x5177('0x2b')]]={'$like':'%'+_0x1cef5d[_0x5177('0x35')]['filter']+'%'};return _0x16fabc;}})});}_0x498fcd=_[_0x5177('0x42')]({},_0x498fcd,_0x1cef5d[_0x5177('0x45')]);var _0x4e3677={'where':_0x498fcd[_0x5177('0x40')]};return db['WhatsappQueueReport'][_0x5177('0x22')](_0x4e3677)[_0x5177('0x28')](function(_0x3f02f1){_0x1c660e['count']=_0x3f02f1;if(_0x1cef5d['query'][_0x5177('0x46')]){_0x498fcd[_0x5177('0x47')]=[{'all':!![]}];}return db[_0x5177('0x2f')][_0x5177('0x48')](_0x498fcd);})[_0x5177('0x28')](function(_0x3e710d){_0x1c660e[_0x5177('0x49')]=_0x3e710d;return _0x1c660e;})[_0x5177('0x28')](respondWithFilteredResult(_0x5577bb,_0x498fcd))['catch'](handleError(_0x5577bb,null));};exports[_0x5177('0x4a')]=function(_0x51ecc0,_0x5e3d30){var _0x30e4f3={'raw':!![],'where':{'id':_0x51ecc0['params']['id']}},_0x17dc98={};_0x17dc98[_0x5177('0x33')]=_['keys'](db['WhatsappQueueReport'][_0x5177('0x30')]);_0x17dc98[_0x5177('0x35')]=_[_0x5177('0x34')](_0x51ecc0[_0x5177('0x35')]);_0x17dc98[_0x5177('0x36')]=_[_0x5177('0x38')](_0x17dc98[_0x5177('0x33')],_0x17dc98['query']);_0x30e4f3['attributes']=_[_0x5177('0x38')](_0x17dc98['model'],qs[_0x5177('0x39')](_0x51ecc0[_0x5177('0x35')][_0x5177('0x39')]));_0x30e4f3[_0x5177('0x37')]=_0x30e4f3['attributes'][_0x5177('0x3a')]?_0x30e4f3[_0x5177('0x37')]:_0x17dc98[_0x5177('0x33')];if(_0x51ecc0[_0x5177('0x35')][_0x5177('0x46')]){_0x30e4f3[_0x5177('0x47')]=[{'all':!![]}];}_0x30e4f3=_[_0x5177('0x42')]({},_0x30e4f3,_0x51ecc0[_0x5177('0x45')]);return db[_0x5177('0x2f')][_0x5177('0x4b')](_0x30e4f3)[_0x5177('0x28')](handleEntityNotFound(_0x5e3d30,null))['then'](respondWithResult(_0x5e3d30,null))[_0x5177('0x4c')](handleError(_0x5e3d30,null));};exports['create']=function(_0x58a4e6,_0x5bda8a){return db[_0x5177('0x2f')][_0x5177('0x4d')](_0x58a4e6['body'],{})[_0x5177('0x28')](respondWithResult(_0x5bda8a,0xc9))[_0x5177('0x4c')](handleError(_0x5bda8a,null));};exports[_0x5177('0x4e')]=function(_0x4891fe,_0x1d4ae4){if(_0x4891fe['body']['id']){delete _0x4891fe['body']['id'];}return db['WhatsappQueueReport'][_0x5177('0x4b')]({'where':{'id':_0x4891fe[_0x5177('0x4f')]['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x1d4ae4,null))['then'](saveUpdates(_0x4891fe['body'],null))[_0x5177('0x28')](respondWithResult(_0x1d4ae4,null))['catch'](handleError(_0x1d4ae4,null));};exports[_0x5177('0x29')]=function(_0x9dd7a2,_0x430e8e){return db[_0x5177('0x2f')][_0x5177('0x4b')]({'where':{'id':_0x9dd7a2[_0x5177('0x4f')]['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x430e8e,null))[_0x5177('0x28')](removeEntity(_0x430e8e,null))[_0x5177('0x4c')](handleError(_0x430e8e,null));};exports[_0x5177('0x50')]=function(_0x89fe3a,_0xb08267){return db[_0x5177('0x2f')]['describe']()['then'](respondWithResult(_0xb08267,null))[_0x5177('0x4c')](handleError(_0xb08267,null));}; \ No newline at end of file +var _0x58a4=['key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','include','create','body','update','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','sendStatus','error','name','index','map','WhatsappQueueReport','fieldName'];(function(_0x372ee1,_0x45c637){var _0x31ea06=function(_0x3aba6a){while(--_0x3aba6a){_0x372ee1['push'](_0x372ee1['shift']());}};_0x31ea06(++_0x45c637);}(_0x58a4,0xbf));var _0x458a=function(_0x2f42d3,_0x362e7a){_0x2f42d3=_0x2f42d3-0x0;var _0x25a67e=_0x58a4[_0x2f42d3];return _0x25a67e;};'use strict';var emlformat=require(_0x458a('0x0'));var rimraf=require(_0x458a('0x1'));var zipdir=require(_0x458a('0x2'));var jsonpatch=require(_0x458a('0x3'));var rp=require(_0x458a('0x4'));var moment=require(_0x458a('0x5'));var BPromise=require(_0x458a('0x6'));var Mustache=require(_0x458a('0x7'));var util=require(_0x458a('0x8'));var path=require(_0x458a('0x9'));var sox=require(_0x458a('0xa'));var csv=require(_0x458a('0xb'));var ejs=require(_0x458a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x458a('0x18'));var db=require(_0x458a('0x19'))['db'];function respondWithStatusCode(_0xee09c6,_0x2a4934){_0x2a4934=_0x2a4934||0xcc;return function(_0x2e788b){if(_0x2e788b){return _0xee09c6['sendStatus'](_0x2a4934);}return _0xee09c6['status'](_0x2a4934)[_0x458a('0x1a')]();};}function respondWithResult(_0x56436f,_0x2c7528){_0x2c7528=_0x2c7528||0xc8;return function(_0x44f683){if(_0x44f683){return _0x56436f[_0x458a('0x1b')](_0x2c7528)[_0x458a('0x1c')](_0x44f683);}};}function respondWithFilteredResult(_0xad80f9,_0x29acee){return function(_0x507b0f){if(_0x507b0f){var _0x4b26be=typeof _0x29acee['offset']===_0x458a('0x1d')&&typeof _0x29acee[_0x458a('0x1e')]===_0x458a('0x1d');var _0x5c5b41=_0x507b0f[_0x458a('0x1f')];var _0x260c87=_0x4b26be?0x0:_0x29acee[_0x458a('0x20')];var _0x392986=_0x4b26be?_0x507b0f[_0x458a('0x1f')]:_0x29acee['offset']+_0x29acee['limit'];var _0x178db9;if(_0x392986>=_0x5c5b41){_0x392986=_0x5c5b41;_0x178db9=0xc8;}else{_0x178db9=0xce;}_0xad80f9['status'](_0x178db9);return _0xad80f9[_0x458a('0x21')](_0x458a('0x22'),_0x260c87+'-'+_0x392986+'/'+_0x5c5b41)['json'](_0x507b0f);}return null;};}function patchUpdates(_0x468416){return function(_0x55a588){try{jsonpatch[_0x458a('0x23')](_0x55a588,_0x468416,!![]);}catch(_0x1c79cb){return BPromise['reject'](_0x1c79cb);}return _0x55a588[_0x458a('0x24')]();};}function saveUpdates(_0xead884,_0x5a2bcb){return function(_0xa6b8ff){if(_0xa6b8ff){return _0xa6b8ff['update'](_0xead884)[_0x458a('0x25')](function(_0x5bca42){return _0x5bca42;});}return null;};}function removeEntity(_0x4080fc,_0x5dfc6c){return function(_0x36b08e){if(_0x36b08e){return _0x36b08e[_0x458a('0x26')]()[_0x458a('0x25')](function(){_0x4080fc[_0x458a('0x1b')](0xcc)[_0x458a('0x1a')]();});}};}function handleEntityNotFound(_0x19bd5,_0x340375){return function(_0x3012c7){if(!_0x3012c7){_0x19bd5[_0x458a('0x27')](0x194);}return _0x3012c7;};}function handleError(_0xfc6b24,_0x52efed){_0x52efed=_0x52efed||0x1f4;return function(_0x327fcb){logger[_0x458a('0x28')](_0x327fcb['stack']);if(_0x327fcb[_0x458a('0x29')]){delete _0x327fcb[_0x458a('0x29')];}_0xfc6b24['status'](_0x52efed)['send'](_0x327fcb);};}exports[_0x458a('0x2a')]=function(_0x596fe2,_0x33c5d8){var _0x29f9b5={},_0x223f73={},_0x4a49e4={'count':0x0,'rows':[]};var _0xa6fdf=_[_0x458a('0x2b')](db[_0x458a('0x2c')]['rawAttributes'],function(_0x47e20d){return{'name':_0x47e20d[_0x458a('0x2d')],'type':_0x47e20d['type'][_0x458a('0x2e')]};});_0x223f73['model']=_[_0x458a('0x2b')](_0xa6fdf,_0x458a('0x29'));_0x223f73['query']=_[_0x458a('0x2f')](_0x596fe2[_0x458a('0x30')]);_0x223f73[_0x458a('0x31')]=_['intersection'](_0x223f73[_0x458a('0x32')],_0x223f73[_0x458a('0x30')]);_0x29f9b5[_0x458a('0x33')]=_[_0x458a('0x34')](_0x223f73[_0x458a('0x32')],qs['fields'](_0x596fe2[_0x458a('0x30')][_0x458a('0x35')]));_0x29f9b5[_0x458a('0x33')]=_0x29f9b5[_0x458a('0x33')][_0x458a('0x36')]?_0x29f9b5[_0x458a('0x33')]:_0x223f73['model'];if(!_0x596fe2[_0x458a('0x30')][_0x458a('0x37')](_0x458a('0x38'))){_0x29f9b5[_0x458a('0x1e')]=qs[_0x458a('0x1e')](_0x596fe2[_0x458a('0x30')][_0x458a('0x1e')]);_0x29f9b5[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x596fe2['query'][_0x458a('0x20')]);}_0x29f9b5[_0x458a('0x39')]=qs[_0x458a('0x3a')](_0x596fe2[_0x458a('0x30')][_0x458a('0x3a')]);_0x29f9b5[_0x458a('0x3b')]=qs[_0x458a('0x31')](_[_0x458a('0x3c')](_0x596fe2[_0x458a('0x30')],_0x223f73[_0x458a('0x31')]),_0xa6fdf);if(_0x596fe2[_0x458a('0x30')][_0x458a('0x3d')]){_0x29f9b5[_0x458a('0x3b')]=_[_0x458a('0x3e')](_0x29f9b5[_0x458a('0x3b')],{'$or':_['map'](_0xa6fdf,function(_0x226cf0){if(_0x226cf0[_0x458a('0x3f')]!==_0x458a('0x40')){var _0x12dad4={};_0x12dad4[_0x226cf0[_0x458a('0x29')]]={'$like':'%'+_0x596fe2[_0x458a('0x30')][_0x458a('0x3d')]+'%'};return _0x12dad4;}})});}_0x29f9b5=_[_0x458a('0x3e')]({},_0x29f9b5,_0x596fe2[_0x458a('0x41')]);var _0x44c5ba={'where':_0x29f9b5[_0x458a('0x3b')]};return db['WhatsappQueueReport'][_0x458a('0x1f')](_0x44c5ba)[_0x458a('0x25')](function(_0x5da57a){_0x4a49e4[_0x458a('0x1f')]=_0x5da57a;if(_0x596fe2[_0x458a('0x30')][_0x458a('0x42')]){_0x29f9b5['include']=[{'all':!![]}];}return db[_0x458a('0x2c')][_0x458a('0x43')](_0x29f9b5);})[_0x458a('0x25')](function(_0x1e51d2){_0x4a49e4[_0x458a('0x44')]=_0x1e51d2;return _0x4a49e4;})[_0x458a('0x25')](respondWithFilteredResult(_0x33c5d8,_0x29f9b5))[_0x458a('0x45')](handleError(_0x33c5d8,null));};exports[_0x458a('0x46')]=function(_0x5883ab,_0x296385){var _0x145e3c={'raw':!![],'where':{'id':_0x5883ab['params']['id']}},_0x2b9030={};_0x2b9030[_0x458a('0x32')]=_[_0x458a('0x2f')](db['WhatsappQueueReport'][_0x458a('0x47')]);_0x2b9030[_0x458a('0x30')]=_[_0x458a('0x2f')](_0x5883ab[_0x458a('0x30')]);_0x2b9030[_0x458a('0x31')]=_['intersection'](_0x2b9030['model'],_0x2b9030[_0x458a('0x30')]);_0x145e3c[_0x458a('0x33')]=_[_0x458a('0x34')](_0x2b9030[_0x458a('0x32')],qs['fields'](_0x5883ab[_0x458a('0x30')][_0x458a('0x35')]));_0x145e3c['attributes']=_0x145e3c[_0x458a('0x33')]['length']?_0x145e3c[_0x458a('0x33')]:_0x2b9030[_0x458a('0x32')];if(_0x5883ab[_0x458a('0x30')]['includeAll']){_0x145e3c[_0x458a('0x48')]=[{'all':!![]}];}_0x145e3c=_[_0x458a('0x3e')]({},_0x145e3c,_0x5883ab[_0x458a('0x41')]);return db['WhatsappQueueReport']['find'](_0x145e3c)[_0x458a('0x25')](handleEntityNotFound(_0x296385,null))[_0x458a('0x25')](respondWithResult(_0x296385,null))[_0x458a('0x45')](handleError(_0x296385,null));};exports['create']=function(_0x5e7a64,_0x3a7005){return db[_0x458a('0x2c')][_0x458a('0x49')](_0x5e7a64[_0x458a('0x4a')],{})[_0x458a('0x25')](respondWithResult(_0x3a7005,0xc9))[_0x458a('0x45')](handleError(_0x3a7005,null));};exports[_0x458a('0x4b')]=function(_0x30cdaf,_0xb22232){if(_0x30cdaf[_0x458a('0x4a')]['id']){delete _0x30cdaf[_0x458a('0x4a')]['id'];}return db[_0x458a('0x2c')][_0x458a('0x4c')]({'where':{'id':_0x30cdaf[_0x458a('0x4d')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0xb22232,null))[_0x458a('0x25')](saveUpdates(_0x30cdaf['body'],null))[_0x458a('0x25')](respondWithResult(_0xb22232,null))[_0x458a('0x45')](handleError(_0xb22232,null));};exports[_0x458a('0x26')]=function(_0x396bb3,_0x44670a){return db['WhatsappQueueReport']['find']({'where':{'id':_0x396bb3['params']['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x44670a,null))['then'](removeEntity(_0x44670a,null))[_0x458a('0x45')](handleError(_0x44670a,null));};exports[_0x458a('0x4e')]=function(_0x2a35a9,_0x649553){return db[_0x458a('0x2c')]['describe']()['then'](respondWithResult(_0x649553,null))[_0x458a('0x45')](handleError(_0x649553,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index f4dca0f..dd16260 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 _0x5f59=['moment','bluebird','request-promise','path','rimraf','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','util','../../config/logger'];(function(_0x44efc6,_0x4eb959){var _0x51bc1f=function(_0x2088f7){while(--_0x2088f7){_0x44efc6['push'](_0x44efc6['shift']());}};_0x51bc1f(++_0x4eb959);}(_0x5f59,0x15a));var _0x95f5=function(_0x1bd645,_0xe33a6a){_0x1bd645=_0x1bd645-0x0;var _0x3a50c9=_0x5f59[_0x1bd645];return _0x3a50c9;};'use strict';var _=require('lodash');var util=require(_0x95f5('0x0'));var logger=require(_0x95f5('0x1'))('api');var moment=require(_0x95f5('0x2'));var BPromise=require(_0x95f5('0x3'));var rp=require(_0x95f5('0x4'));var fs=require('fs');var path=require(_0x95f5('0x5'));var rimraf=require(_0x95f5('0x6'));var config=require('../../config/environment');var attributes=require(_0x95f5('0x7'));module[_0x95f5('0x8')]=function(_0x4be3de,_0x27833a){return _0x4be3de[_0x95f5('0x9')]('WhatsappQueueReport',attributes,{'tableName':_0x95f5('0xa'),'paranoid':![],'indexes':[{'name':_0x95f5('0xb'),'fields':[_0x95f5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x632b=['./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1cac43,_0x2b0667){var _0x532f99=function(_0x21d6fc){while(--_0x21d6fc){_0x1cac43['push'](_0x1cac43['shift']());}};_0x532f99(++_0x2b0667);}(_0x632b,0x1b8));var _0xb632=function(_0x3658c6,_0x3edbeb){_0x3658c6=_0x3658c6-0x0;var _0x2d76c9=_0x632b[_0x3658c6];return _0x2d76c9;};'use strict';var _=require(_0xb632('0x0'));var util=require(_0xb632('0x1'));var logger=require('../../config/logger')(_0xb632('0x2'));var moment=require(_0xb632('0x3'));var BPromise=require('bluebird');var rp=require(_0xb632('0x4'));var fs=require('fs');var path=require(_0xb632('0x5'));var rimraf=require(_0xb632('0x6'));var config=require(_0xb632('0x7'));var attributes=require(_0xb632('0x8'));module[_0xb632('0x9')]=function(_0x7d0d9a,_0x3c9df0){return _0x7d0d9a[_0xb632('0xa')](_0xb632('0xb'),attributes,{'tableName':_0xb632('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb632('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 8824017..fe2970e 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 _0x1943=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','WhatsappQueueReport,\x20%s,\x20%s','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','where','attributes','limit','UpdateWhatsappQueueReport'];(function(_0x3f4a8e,_0x507c39){var _0x7f68fd=function(_0x29890f){while(--_0x29890f){_0x3f4a8e['push'](_0x3f4a8e['shift']());}};_0x7f68fd(++_0x507c39);}(_0x1943,0x9b));var _0x3194=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0x1943[_0x30cd7e];return _0x462a02;};'use strict';var _=require(_0x3194('0x0'));var util=require(_0x3194('0x1'));var moment=require(_0x3194('0x2'));var BPromise=require(_0x3194('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3194('0x4'));var db=require(_0x3194('0x5'))['db'];var utils=require(_0x3194('0x6'));var logger=require(_0x3194('0x7'))(_0x3194('0x8'));var config=require('../../config/environment');var jayson=require(_0x3194('0x9'));var client=jayson['client'][_0x3194('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1214ee,_0x12fc6d,_0x1fce11){return new BPromise(function(_0x31ef4c,_0x104b78){return client['request'](_0x1214ee,_0x1fce11)[_0x3194('0xb')](function(_0x268f48){logger[_0x3194('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x12fc6d,'request\x20sent');logger[_0x3194('0xd')](_0x3194('0xe'),_0x12fc6d,'request\x20sent',JSON[_0x3194('0xf')](_0x268f48));if(_0x268f48['error']){if(_0x268f48['error']['code']===0x1f4){logger[_0x3194('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x12fc6d,_0x268f48[_0x3194('0x10')][_0x3194('0x11')]);return _0x104b78(_0x268f48[_0x3194('0x10')][_0x3194('0x11')]);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x12fc6d,_0x268f48[_0x3194('0x10')][_0x3194('0x11')]);return _0x31ef4c(_0x268f48[_0x3194('0x10')][_0x3194('0x11')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x12fc6d,'request\x20sent');_0x31ef4c(_0x268f48[_0x3194('0x12')][_0x3194('0x11')]);}})[_0x3194('0x13')](function(_0x183631){logger[_0x3194('0x10')](_0x3194('0x14'),_0x12fc6d,_0x183631);_0x104b78(_0x183631);});});}exports[_0x3194('0x15')]=function(_0x260d43){var _0x2d50a9=this;return new Promise(function(_0x360509,_0x1fcf26){return db[_0x3194('0x16')][_0x3194('0x17')](_0x260d43[_0x3194('0x18')],{'raw':_0x260d43[_0x3194('0x19')]?_0x260d43[_0x3194('0x19')][_0x3194('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x58c715){logger[_0x3194('0xc')](_0x3194('0x15'),_0x260d43);logger['debug'](_0x3194('0x15'),_0x260d43,JSON[_0x3194('0xf')](_0x58c715));_0x360509(_0x58c715);})[_0x3194('0x13')](function(_0x14683b){logger[_0x3194('0x10')](_0x3194('0x15'),_0x14683b[_0x3194('0x11')],_0x260d43);_0x1fcf26(_0x2d50a9[_0x3194('0x10')](0x1f4,_0x14683b[_0x3194('0x11')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x19205f){var _0x1c6b53=this;return new Promise(function(_0x384c55,_0x3eebfd){return db[_0x3194('0x16')]['update'](_0x19205f['body'],{'raw':_0x19205f[_0x3194('0x19')]?_0x19205f[_0x3194('0x19')][_0x3194('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19205f[_0x3194('0x19')]?_0x19205f[_0x3194('0x19')][_0x3194('0x1b')]||null:null,'attributes':_0x19205f[_0x3194('0x19')]?_0x19205f[_0x3194('0x19')][_0x3194('0x1c')]||null:null,'limit':_0x19205f[_0x3194('0x19')]?_0x19205f[_0x3194('0x19')][_0x3194('0x1d')]||null:null})['then'](function(_0x4918f0){logger[_0x3194('0xc')]('UpdateWhatsappQueueReport',_0x19205f);logger[_0x3194('0xd')](_0x3194('0x1e'),_0x19205f,JSON[_0x3194('0xf')](_0x4918f0));_0x384c55(_0x4918f0);})['catch'](function(_0x1f5014){logger[_0x3194('0x10')](_0x3194('0x1e'),_0x1f5014['message'],_0x19205f);_0x3eebfd(_0x1c6b53[_0x3194('0x10')](0x1f4,_0x1f5014[_0x3194('0x11')]));});});}; \ No newline at end of file +var _0xa97c=['WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa97c,0xfc));var _0xca97=function(_0x4c7d18,_0x425a37){_0x4c7d18=_0x4c7d18-0x0;var _0x6a9bab=_0xa97c[_0x4c7d18];return _0x6a9bab;};'use strict';var _=require(_0xca97('0x0'));var util=require(_0xca97('0x1'));var moment=require(_0xca97('0x2'));var BPromise=require(_0xca97('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca97('0x4'));var db=require(_0xca97('0x5'))['db'];var utils=require(_0xca97('0x6'));var logger=require(_0xca97('0x7'))('rpc');var config=require(_0xca97('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xca97('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x417f60,_0x33c244,_0x2a99ab){return new BPromise(function(_0x1323f7,_0x49efc2){return client[_0xca97('0xa')](_0x417f60,_0x2a99ab)[_0xca97('0xb')](function(_0xe7aebb){logger['info'](_0xca97('0xc'),_0x33c244,'request\x20sent');logger[_0xca97('0xd')](_0xca97('0xe'),_0x33c244,_0xca97('0xf'),JSON[_0xca97('0x10')](_0xe7aebb));if(_0xe7aebb[_0xca97('0x11')]){if(_0xe7aebb[_0xca97('0x11')][_0xca97('0x12')]===0x1f4){logger[_0xca97('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x33c244,_0xe7aebb[_0xca97('0x11')][_0xca97('0x13')]);return _0x49efc2(_0xe7aebb[_0xca97('0x11')][_0xca97('0x13')]);}logger['error'](_0xca97('0xc'),_0x33c244,_0xe7aebb[_0xca97('0x11')][_0xca97('0x13')]);return _0x1323f7(_0xe7aebb[_0xca97('0x11')][_0xca97('0x13')]);}else{logger[_0xca97('0x14')](_0xca97('0xc'),_0x33c244,'request\x20sent');_0x1323f7(_0xe7aebb['result'][_0xca97('0x13')]);}})[_0xca97('0x15')](function(_0x1007c9){logger[_0xca97('0x11')](_0xca97('0xc'),_0x33c244,_0x1007c9);_0x49efc2(_0x1007c9);});});}exports['CreateWhatsappQueueReport']=function(_0x1ac0e9){var _0x503ef1=this;return new Promise(function(_0x432e04,_0x20f5b9){return db[_0xca97('0x16')][_0xca97('0x17')](_0x1ac0e9[_0xca97('0x18')],{'raw':_0x1ac0e9[_0xca97('0x19')]?_0x1ac0e9[_0xca97('0x19')][_0xca97('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x380bdd){logger[_0xca97('0x14')]('CreateWhatsappQueueReport',_0x1ac0e9);logger[_0xca97('0xd')](_0xca97('0x1b'),_0x1ac0e9,JSON[_0xca97('0x10')](_0x380bdd));_0x432e04(_0x380bdd);})['catch'](function(_0x279908){logger[_0xca97('0x11')](_0xca97('0x1b'),_0x279908[_0xca97('0x13')],_0x1ac0e9);_0x20f5b9(_0x503ef1[_0xca97('0x11')](0x1f4,_0x279908[_0xca97('0x13')]));});});};exports[_0xca97('0x1c')]=function(_0x5aaa64){var _0x19b561=this;return new Promise(function(_0x5ee771,_0x20163d){return db['WhatsappQueueReport'][_0xca97('0x1d')](_0x5aaa64[_0xca97('0x18')],{'raw':_0x5aaa64[_0xca97('0x19')]?_0x5aaa64[_0xca97('0x19')][_0xca97('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5aaa64['options']?_0x5aaa64[_0xca97('0x19')][_0xca97('0x1e')]||null:null,'attributes':_0x5aaa64[_0xca97('0x19')]?_0x5aaa64[_0xca97('0x19')][_0xca97('0x1f')]||null:null,'limit':_0x5aaa64[_0xca97('0x19')]?_0x5aaa64[_0xca97('0x19')][_0xca97('0x20')]||null:null})[_0xca97('0xb')](function(_0x4f0cd8){logger[_0xca97('0x14')](_0xca97('0x1c'),_0x5aaa64);logger[_0xca97('0xd')](_0xca97('0x1c'),_0x5aaa64,JSON[_0xca97('0x10')](_0x4f0cd8));_0x5ee771(_0x4f0cd8);})[_0xca97('0x15')](function(_0x3becf9){logger['error'](_0xca97('0x1c'),_0x3becf9[_0xca97('0x13')],_0x5aaa64);_0x20163d(_0x19b561[_0xca97('0x11')](0x1f4,_0x3becf9[_0xca97('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 3cd3aed..055cc1c 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 _0xa78d=['./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x33aabc,_0x3d80da){var _0x38eff6=function(_0x40a37d){while(--_0x40a37d){_0x33aabc['push'](_0x33aabc['shift']());}};_0x38eff6(++_0x3d80da);}(_0xa78d,0x14c));var _0xda78=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xa78d[_0x45b034];return _0x509cb0;};'use strict';var multer=require(_0xda78('0x0'));var util=require(_0xda78('0x1'));var path=require(_0xda78('0x2'));var timeout=require(_0xda78('0x3'));var express=require(_0xda78('0x4'));var router=express['Router']();var fs_extra=require(_0xda78('0x5'));var auth=require(_0xda78('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xda78('0x7'));var controller=require(_0xda78('0x8'));router[_0xda78('0x9')]('/',auth[_0xda78('0xa')](),controller[_0xda78('0xb')]);router[_0xda78('0x9')](_0xda78('0xc'),auth[_0xda78('0xa')](),controller['describe']);router[_0xda78('0x9')](_0xda78('0xd'),auth['isAuthenticated'](),controller[_0xda78('0xe')]);router[_0xda78('0xf')]('/',auth[_0xda78('0xa')](),controller['create']);router['put'](_0xda78('0xd'),auth[_0xda78('0xa')](),controller[_0xda78('0x10')]);router[_0xda78('0x11')]('/:id',auth[_0xda78('0xa')](),controller[_0xda78('0x12')]);module[_0xda78('0x13')]=router; \ No newline at end of file +var _0x56e5=['multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x185629,_0x31ee6e){var _0x409e70=function(_0x5a4224){while(--_0x5a4224){_0x185629['push'](_0x185629['shift']());}};_0x409e70(++_0x31ee6e);}(_0x56e5,0x18f));var _0x556e=function(_0x42f318,_0x336c90){_0x42f318=_0x42f318-0x0;var _0x4aa72a=_0x56e5[_0x42f318];return _0x4aa72a;};'use strict';var multer=require(_0x556e('0x0'));var util=require(_0x556e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x556e('0x2')]();var fs_extra=require(_0x556e('0x3'));var auth=require(_0x556e('0x4'));var interaction=require(_0x556e('0x5'));var config=require(_0x556e('0x6'));var controller=require(_0x556e('0x7'));router['get']('/',auth[_0x556e('0x8')](),controller[_0x556e('0x9')]);router[_0x556e('0xa')](_0x556e('0xb'),auth[_0x556e('0x8')](),controller['describe']);router[_0x556e('0xa')](_0x556e('0xc'),auth[_0x556e('0x8')](),controller[_0x556e('0xd')]);router[_0x556e('0xe')]('/',auth['isAuthenticated'](),controller[_0x556e('0xf')]);router[_0x556e('0x10')]('/:id',auth[_0x556e('0x8')](),controller[_0x556e('0x11')]);router[_0x556e('0x12')](_0x556e('0xc'),auth[_0x556e('0x8')](),controller[_0x556e('0x13')]);module[_0x556e('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 36ac1b6..8efc863 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 _0x5a13=['agent','queue','DATE','sequelize','exports','ENUM','account'];(function(_0x359fff,_0xb93237){var _0x52ad8a=function(_0x1a2993){while(--_0x1a2993){_0x359fff['push'](_0x359fff['shift']());}};_0x52ad8a(++_0xb93237);}(_0x5a13,0x145));var _0x35a1=function(_0x4ddd3d,_0x32d194){_0x4ddd3d=_0x4ddd3d-0x0;var _0x1d28bc=_0x5a13[_0x4ddd3d];return _0x1d28bc;};'use strict';var Sequelize=require(_0x35a1('0x0'));module[_0x35a1('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x35a1('0x2')](_0x35a1('0x3'),_0x35a1('0x4'),_0x35a1('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x35a1('0x6')]}}; \ No newline at end of file +var _0xde6f=['queue','DATE','STRING','ENUM','account'];(function(_0x1ca6f7,_0x56b226){var _0x2a3623=function(_0x4c719f){while(--_0x4c719f){_0x1ca6f7['push'](_0x1ca6f7['shift']());}};_0x2a3623(++_0x56b226);}(_0xde6f,0x84));var _0xfde6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde6f[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xfde6('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x2'),'agent',_0xfde6('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xfde6('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 80a6591..e6999d6 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 _0xde53=['Content-Range','apply','reject','then','destroy','error','stack','name','send','map','WhatsappTransferReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','include','params','rawAttributes','find','catch','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xde53,0x199));var _0x3de5=function(_0x4b8912,_0x3a759d){_0x4b8912=_0x4b8912-0x0;var _0x5655ac=_0xde53[_0x4b8912];return _0x5655ac;};'use strict';var emlformat=require(_0x3de5('0x0'));var rimraf=require(_0x3de5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3de5('0x2'));var rp=require(_0x3de5('0x3'));var moment=require(_0x3de5('0x4'));var BPromise=require(_0x3de5('0x5'));var Mustache=require(_0x3de5('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3de5('0x7'));var csv=require('to-csv');var ejs=require(_0x3de5('0x8'));var fs=require('fs');var fs_extra=require(_0x3de5('0x9'));var _=require(_0x3de5('0xa'));var squel=require(_0x3de5('0xb'));var crypto=require('crypto');var jsforce=require(_0x3de5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3de5('0xd'));var querystring=require(_0x3de5('0xe'));var Papa=require(_0x3de5('0xf'));var Redis=require('ioredis');var authService=require(_0x3de5('0x10'));var qs=require(_0x3de5('0x11'));var as=require(_0x3de5('0x12'));var hardwareService=require(_0x3de5('0x13'));var logger=require(_0x3de5('0x14'))(_0x3de5('0x15'));var utils=require(_0x3de5('0x16'));var config=require(_0x3de5('0x17'));var licenseUtil=require(_0x3de5('0x18'));var db=require(_0x3de5('0x19'))['db'];function respondWithStatusCode(_0x2247cd,_0x58b4d8){_0x58b4d8=_0x58b4d8||0xcc;return function(_0xa96b64){if(_0xa96b64){return _0x2247cd[_0x3de5('0x1a')](_0x58b4d8);}return _0x2247cd[_0x3de5('0x1b')](_0x58b4d8)[_0x3de5('0x1c')]();};}function respondWithResult(_0x629b4b,_0x53d6fa){_0x53d6fa=_0x53d6fa||0xc8;return function(_0x81925){if(_0x81925){return _0x629b4b[_0x3de5('0x1b')](_0x53d6fa)[_0x3de5('0x1d')](_0x81925);}};}function respondWithFilteredResult(_0x15abc3,_0x54a5a0){return function(_0x37eceb){if(_0x37eceb){var _0x16443c=typeof _0x54a5a0['offset']===_0x3de5('0x1e')&&typeof _0x54a5a0[_0x3de5('0x1f')]===_0x3de5('0x1e');var _0x21124f=_0x37eceb[_0x3de5('0x20')];var _0x362402=_0x16443c?0x0:_0x54a5a0[_0x3de5('0x21')];var _0xfac0aa=_0x16443c?_0x37eceb[_0x3de5('0x20')]:_0x54a5a0['offset']+_0x54a5a0['limit'];var _0x542af5;if(_0xfac0aa>=_0x21124f){_0xfac0aa=_0x21124f;_0x542af5=0xc8;}else{_0x542af5=0xce;}_0x15abc3[_0x3de5('0x1b')](_0x542af5);return _0x15abc3[_0x3de5('0x22')](_0x3de5('0x23'),_0x362402+'-'+_0xfac0aa+'/'+_0x21124f)[_0x3de5('0x1d')](_0x37eceb);}return null;};}function patchUpdates(_0x81049c){return function(_0x5ef335){try{jsonpatch[_0x3de5('0x24')](_0x5ef335,_0x81049c,!![]);}catch(_0x12a315){return BPromise[_0x3de5('0x25')](_0x12a315);}return _0x5ef335['save']();};}function saveUpdates(_0x509d0e,_0x310227){return function(_0x20a274){if(_0x20a274){return _0x20a274['update'](_0x509d0e)[_0x3de5('0x26')](function(_0x195193){return _0x195193;});}return null;};}function removeEntity(_0x33a5c3,_0x23a8d5){return function(_0x5b6338){if(_0x5b6338){return _0x5b6338[_0x3de5('0x27')]()[_0x3de5('0x26')](function(){_0x33a5c3['status'](0xcc)[_0x3de5('0x1c')]();});}};}function handleEntityNotFound(_0x43242a,_0x2ed3fb){return function(_0x3af02c){if(!_0x3af02c){_0x43242a[_0x3de5('0x1a')](0x194);}return _0x3af02c;};}function handleError(_0x4f6a62,_0x106c50){_0x106c50=_0x106c50||0x1f4;return function(_0x332b2a){logger[_0x3de5('0x28')](_0x332b2a[_0x3de5('0x29')]);if(_0x332b2a[_0x3de5('0x2a')]){delete _0x332b2a[_0x3de5('0x2a')];}_0x4f6a62[_0x3de5('0x1b')](_0x106c50)[_0x3de5('0x2b')](_0x332b2a);};}exports['index']=function(_0x37ece0,_0x2d056a){var _0x51d50d={},_0x69c32b={},_0x536f5a={'count':0x0,'rows':[]};var _0x2f16a2=_[_0x3de5('0x2c')](db[_0x3de5('0x2d')]['rawAttributes'],function(_0x5da4b6){return{'name':_0x5da4b6[_0x3de5('0x2e')],'type':_0x5da4b6['type'][_0x3de5('0x2f')]};});_0x69c32b[_0x3de5('0x30')]=_[_0x3de5('0x2c')](_0x2f16a2,_0x3de5('0x2a'));_0x69c32b[_0x3de5('0x31')]=_[_0x3de5('0x32')](_0x37ece0['query']);_0x69c32b[_0x3de5('0x33')]=_[_0x3de5('0x34')](_0x69c32b['model'],_0x69c32b[_0x3de5('0x31')]);_0x51d50d[_0x3de5('0x35')]=_[_0x3de5('0x34')](_0x69c32b[_0x3de5('0x30')],qs[_0x3de5('0x36')](_0x37ece0['query'][_0x3de5('0x36')]));_0x51d50d[_0x3de5('0x35')]=_0x51d50d['attributes'][_0x3de5('0x37')]?_0x51d50d[_0x3de5('0x35')]:_0x69c32b[_0x3de5('0x30')];if(!_0x37ece0[_0x3de5('0x31')][_0x3de5('0x38')](_0x3de5('0x39'))){_0x51d50d[_0x3de5('0x1f')]=qs[_0x3de5('0x1f')](_0x37ece0[_0x3de5('0x31')][_0x3de5('0x1f')]);_0x51d50d['offset']=qs[_0x3de5('0x21')](_0x37ece0['query'][_0x3de5('0x21')]);}_0x51d50d['order']=qs[_0x3de5('0x3a')](_0x37ece0[_0x3de5('0x31')][_0x3de5('0x3a')]);_0x51d50d['where']=qs[_0x3de5('0x33')](_[_0x3de5('0x3b')](_0x37ece0[_0x3de5('0x31')],_0x69c32b[_0x3de5('0x33')]),_0x2f16a2);if(_0x37ece0[_0x3de5('0x31')][_0x3de5('0x3c')]){_0x51d50d[_0x3de5('0x3d')]=_[_0x3de5('0x3e')](_0x51d50d[_0x3de5('0x3d')],{'$or':_['map'](_0x2f16a2,function(_0x2b9f02){if(_0x2b9f02['type']!=='VIRTUAL'){var _0x2ef822={};_0x2ef822[_0x2b9f02['name']]={'$like':'%'+_0x37ece0[_0x3de5('0x31')][_0x3de5('0x3c')]+'%'};return _0x2ef822;}})});}_0x51d50d=_[_0x3de5('0x3e')]({},_0x51d50d,_0x37ece0[_0x3de5('0x3f')]);var _0x1a8166={'where':_0x51d50d[_0x3de5('0x3d')]};return db[_0x3de5('0x2d')][_0x3de5('0x20')](_0x1a8166)[_0x3de5('0x26')](function(_0x4e8203){_0x536f5a[_0x3de5('0x20')]=_0x4e8203;if(_0x37ece0['query'][_0x3de5('0x40')]){_0x51d50d[_0x3de5('0x41')]=[{'all':!![]}];}return db[_0x3de5('0x2d')]['findAll'](_0x51d50d);})[_0x3de5('0x26')](function(_0xa4550e){_0x536f5a['rows']=_0xa4550e;return _0x536f5a;})[_0x3de5('0x26')](respondWithFilteredResult(_0x2d056a,_0x51d50d))['catch'](handleError(_0x2d056a,null));};exports['show']=function(_0xb10384,_0x5e7c89){var _0x292e8d={'raw':!![],'where':{'id':_0xb10384[_0x3de5('0x42')]['id']}},_0x4e55e6={};_0x4e55e6[_0x3de5('0x30')]=_['keys'](db[_0x3de5('0x2d')][_0x3de5('0x43')]);_0x4e55e6[_0x3de5('0x31')]=_[_0x3de5('0x32')](_0xb10384[_0x3de5('0x31')]);_0x4e55e6[_0x3de5('0x33')]=_[_0x3de5('0x34')](_0x4e55e6[_0x3de5('0x30')],_0x4e55e6[_0x3de5('0x31')]);_0x292e8d[_0x3de5('0x35')]=_[_0x3de5('0x34')](_0x4e55e6['model'],qs['fields'](_0xb10384[_0x3de5('0x31')][_0x3de5('0x36')]));_0x292e8d[_0x3de5('0x35')]=_0x292e8d['attributes']['length']?_0x292e8d['attributes']:_0x4e55e6[_0x3de5('0x30')];if(_0xb10384[_0x3de5('0x31')][_0x3de5('0x40')]){_0x292e8d['include']=[{'all':!![]}];}_0x292e8d=_[_0x3de5('0x3e')]({},_0x292e8d,_0xb10384[_0x3de5('0x3f')]);return db['WhatsappTransferReport'][_0x3de5('0x44')](_0x292e8d)[_0x3de5('0x26')](handleEntityNotFound(_0x5e7c89,null))['then'](respondWithResult(_0x5e7c89,null))[_0x3de5('0x45')](handleError(_0x5e7c89,null));};exports[_0x3de5('0x46')]=function(_0x19004c,_0x454379){return db[_0x3de5('0x2d')][_0x3de5('0x46')](_0x19004c[_0x3de5('0x47')],{})['then'](respondWithResult(_0x454379,0xc9))[_0x3de5('0x45')](handleError(_0x454379,null));};exports[_0x3de5('0x48')]=function(_0x5329bb,_0x109a9d){if(_0x5329bb['body']['id']){delete _0x5329bb['body']['id'];}return db[_0x3de5('0x2d')]['find']({'where':{'id':_0x5329bb[_0x3de5('0x42')]['id']}})[_0x3de5('0x26')](handleEntityNotFound(_0x109a9d,null))[_0x3de5('0x26')](saveUpdates(_0x5329bb['body'],null))['then'](respondWithResult(_0x109a9d,null))[_0x3de5('0x45')](handleError(_0x109a9d,null));};exports['destroy']=function(_0x47618c,_0x529555){return db[_0x3de5('0x2d')][_0x3de5('0x44')]({'where':{'id':_0x47618c[_0x3de5('0x42')]['id']}})['then'](handleEntityNotFound(_0x529555,null))['then'](removeEntity(_0x529555,null))['catch'](handleError(_0x529555,null));};exports[_0x3de5('0x49')]=function(_0xc5c6c6,_0x5d8ff0){return db['WhatsappTransferReport'][_0x3de5('0x49')]()[_0x3de5('0x26')](respondWithResult(_0x5d8ff0,null))[_0x3de5('0x45')](handleError(_0x5d8ff0,null));}; \ No newline at end of file +var _0x7341=['then','end','stack','name','send','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','WhatsappTransferReport','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','describe','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','set','apply','reject','save','destroy'];(function(_0x28a64a,_0x209314){var _0x3f2971=function(_0xd66e51){while(--_0xd66e51){_0x28a64a['push'](_0x28a64a['shift']());}};_0x3f2971(++_0x209314);}(_0x7341,0x1d1));var _0x1734=function(_0x326a93,_0x3b5880){_0x326a93=_0x326a93-0x0;var _0x5b034f=_0x7341[_0x326a93];return _0x5b034f;};'use strict';var emlformat=require(_0x1734('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1734('0x1'));var rp=require('request-promise');var moment=require(_0x1734('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1734('0x3'));var util=require(_0x1734('0x4'));var path=require(_0x1734('0x5'));var sox=require(_0x1734('0x6'));var csv=require(_0x1734('0x7'));var ejs=require(_0x1734('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1734('0x9'));var crypto=require(_0x1734('0xa'));var jsforce=require(_0x1734('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1734('0x7'));var querystring=require(_0x1734('0xc'));var Papa=require(_0x1734('0xd'));var Redis=require(_0x1734('0xe'));var authService=require(_0x1734('0xf'));var qs=require(_0x1734('0x10'));var as=require(_0x1734('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1734('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x1734('0x13'));var licenseUtil=require(_0x1734('0x14'));var db=require(_0x1734('0x15'))['db'];function respondWithStatusCode(_0x7c141,_0x15b9f0){_0x15b9f0=_0x15b9f0||0xcc;return function(_0x49f072){if(_0x49f072){return _0x7c141['sendStatus'](_0x15b9f0);}return _0x7c141[_0x1734('0x16')](_0x15b9f0)['end']();};}function respondWithResult(_0x4c2a43,_0x546c46){_0x546c46=_0x546c46||0xc8;return function(_0x48536b){if(_0x48536b){return _0x4c2a43[_0x1734('0x16')](_0x546c46)['json'](_0x48536b);}};}function respondWithFilteredResult(_0x75cb5,_0x50e96a){return function(_0x55baaf){if(_0x55baaf){var _0x597ed5=typeof _0x50e96a[_0x1734('0x17')]==='undefined'&&typeof _0x50e96a[_0x1734('0x18')]===_0x1734('0x19');var _0x1f56c8=_0x55baaf[_0x1734('0x1a')];var _0x2203aa=_0x597ed5?0x0:_0x50e96a[_0x1734('0x17')];var _0x4dbefe=_0x597ed5?_0x55baaf[_0x1734('0x1a')]:_0x50e96a[_0x1734('0x17')]+_0x50e96a['limit'];var _0x58116d;if(_0x4dbefe>=_0x1f56c8){_0x4dbefe=_0x1f56c8;_0x58116d=0xc8;}else{_0x58116d=0xce;}_0x75cb5[_0x1734('0x16')](_0x58116d);return _0x75cb5[_0x1734('0x1b')]('Content-Range',_0x2203aa+'-'+_0x4dbefe+'/'+_0x1f56c8)['json'](_0x55baaf);}return null;};}function patchUpdates(_0x132d95){return function(_0x188858){try{jsonpatch[_0x1734('0x1c')](_0x188858,_0x132d95,!![]);}catch(_0xbb37f0){return BPromise[_0x1734('0x1d')](_0xbb37f0);}return _0x188858[_0x1734('0x1e')]();};}function saveUpdates(_0x3947a6,_0x3556f6){return function(_0xf77c2b){if(_0xf77c2b){return _0xf77c2b['update'](_0x3947a6)['then'](function(_0x51c190){return _0x51c190;});}return null;};}function removeEntity(_0x2012e7,_0x575802){return function(_0x457846){if(_0x457846){return _0x457846[_0x1734('0x1f')]()[_0x1734('0x20')](function(){_0x2012e7[_0x1734('0x16')](0xcc)[_0x1734('0x21')]();});}};}function handleEntityNotFound(_0x14a20d,_0x975641){return function(_0x59ef95){if(!_0x59ef95){_0x14a20d['sendStatus'](0x194);}return _0x59ef95;};}function handleError(_0x503c8b,_0x79a0e3){_0x79a0e3=_0x79a0e3||0x1f4;return function(_0x5574f7){logger['error'](_0x5574f7[_0x1734('0x22')]);if(_0x5574f7[_0x1734('0x23')]){delete _0x5574f7[_0x1734('0x23')];}_0x503c8b[_0x1734('0x16')](_0x79a0e3)[_0x1734('0x24')](_0x5574f7);};}exports['index']=function(_0x3540a7,_0x534a29){var _0x3abc83={},_0x3b651b={},_0x14b43f={'count':0x0,'rows':[]};var _0x3e6966=_[_0x1734('0x25')](db['WhatsappTransferReport'][_0x1734('0x26')],function(_0x420019){return{'name':_0x420019[_0x1734('0x27')],'type':_0x420019['type']['key']};});_0x3b651b[_0x1734('0x28')]=_[_0x1734('0x25')](_0x3e6966,'name');_0x3b651b[_0x1734('0x29')]=_[_0x1734('0x2a')](_0x3540a7[_0x1734('0x29')]);_0x3b651b[_0x1734('0x2b')]=_[_0x1734('0x2c')](_0x3b651b[_0x1734('0x28')],_0x3b651b['query']);_0x3abc83[_0x1734('0x2d')]=_[_0x1734('0x2c')](_0x3b651b[_0x1734('0x28')],qs[_0x1734('0x2e')](_0x3540a7[_0x1734('0x29')]['fields']));_0x3abc83[_0x1734('0x2d')]=_0x3abc83[_0x1734('0x2d')][_0x1734('0x2f')]?_0x3abc83[_0x1734('0x2d')]:_0x3b651b['model'];if(!_0x3540a7[_0x1734('0x29')][_0x1734('0x30')](_0x1734('0x31'))){_0x3abc83['limit']=qs['limit'](_0x3540a7[_0x1734('0x29')]['limit']);_0x3abc83['offset']=qs[_0x1734('0x17')](_0x3540a7[_0x1734('0x29')]['offset']);}_0x3abc83[_0x1734('0x32')]=qs[_0x1734('0x33')](_0x3540a7[_0x1734('0x29')]['sort']);_0x3abc83[_0x1734('0x34')]=qs['filters'](_['pick'](_0x3540a7[_0x1734('0x29')],_0x3b651b[_0x1734('0x2b')]),_0x3e6966);if(_0x3540a7[_0x1734('0x29')][_0x1734('0x35')]){_0x3abc83[_0x1734('0x34')]=_[_0x1734('0x36')](_0x3abc83[_0x1734('0x34')],{'$or':_[_0x1734('0x25')](_0x3e6966,function(_0x5d19aa){if(_0x5d19aa[_0x1734('0x37')]!==_0x1734('0x38')){var _0x2b13df={};_0x2b13df[_0x5d19aa[_0x1734('0x23')]]={'$like':'%'+_0x3540a7[_0x1734('0x29')]['filter']+'%'};return _0x2b13df;}})});}_0x3abc83=_['merge']({},_0x3abc83,_0x3540a7['options']);var _0x28ecde={'where':_0x3abc83[_0x1734('0x34')]};return db[_0x1734('0x39')][_0x1734('0x1a')](_0x28ecde)[_0x1734('0x20')](function(_0x5074c1){_0x14b43f[_0x1734('0x1a')]=_0x5074c1;if(_0x3540a7[_0x1734('0x29')][_0x1734('0x3a')]){_0x3abc83[_0x1734('0x3b')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x1734('0x3c')](_0x3abc83);})[_0x1734('0x20')](function(_0x1e47de){_0x14b43f[_0x1734('0x3d')]=_0x1e47de;return _0x14b43f;})['then'](respondWithFilteredResult(_0x534a29,_0x3abc83))[_0x1734('0x3e')](handleError(_0x534a29,null));};exports[_0x1734('0x3f')]=function(_0x2b720f,_0x535b6d){var _0x1dc003={'raw':!![],'where':{'id':_0x2b720f[_0x1734('0x40')]['id']}},_0x5f46d7={};_0x5f46d7['model']=_[_0x1734('0x2a')](db[_0x1734('0x39')][_0x1734('0x26')]);_0x5f46d7[_0x1734('0x29')]=_[_0x1734('0x2a')](_0x2b720f[_0x1734('0x29')]);_0x5f46d7['filters']=_[_0x1734('0x2c')](_0x5f46d7['model'],_0x5f46d7[_0x1734('0x29')]);_0x1dc003[_0x1734('0x2d')]=_[_0x1734('0x2c')](_0x5f46d7[_0x1734('0x28')],qs[_0x1734('0x2e')](_0x2b720f[_0x1734('0x29')]['fields']));_0x1dc003['attributes']=_0x1dc003[_0x1734('0x2d')][_0x1734('0x2f')]?_0x1dc003[_0x1734('0x2d')]:_0x5f46d7[_0x1734('0x28')];if(_0x2b720f[_0x1734('0x29')][_0x1734('0x3a')]){_0x1dc003['include']=[{'all':!![]}];}_0x1dc003=_[_0x1734('0x36')]({},_0x1dc003,_0x2b720f[_0x1734('0x41')]);return db[_0x1734('0x39')][_0x1734('0x42')](_0x1dc003)['then'](handleEntityNotFound(_0x535b6d,null))[_0x1734('0x20')](respondWithResult(_0x535b6d,null))['catch'](handleError(_0x535b6d,null));};exports[_0x1734('0x43')]=function(_0xa0fcad,_0x34f83e){return db[_0x1734('0x39')]['create'](_0xa0fcad[_0x1734('0x44')],{})['then'](respondWithResult(_0x34f83e,0xc9))['catch'](handleError(_0x34f83e,null));};exports[_0x1734('0x45')]=function(_0x47acf3,_0x501d49){if(_0x47acf3[_0x1734('0x44')]['id']){delete _0x47acf3['body']['id'];}return db[_0x1734('0x39')][_0x1734('0x42')]({'where':{'id':_0x47acf3[_0x1734('0x40')]['id']}})[_0x1734('0x20')](handleEntityNotFound(_0x501d49,null))[_0x1734('0x20')](saveUpdates(_0x47acf3['body'],null))[_0x1734('0x20')](respondWithResult(_0x501d49,null))[_0x1734('0x3e')](handleError(_0x501d49,null));};exports['destroy']=function(_0xc78b08,_0x493b91){return db['WhatsappTransferReport'][_0x1734('0x42')]({'where':{'id':_0xc78b08[_0x1734('0x40')]['id']}})[_0x1734('0x20')](handleEntityNotFound(_0x493b91,null))['then'](removeEntity(_0x493b91,null))[_0x1734('0x3e')](handleError(_0x493b91,null));};exports[_0x1734('0x46')]=function(_0x201cd2,_0x59a1e0){return db[_0x1734('0x39')][_0x1734('0x46')]()[_0x1734('0x20')](respondWithResult(_0x59a1e0,null))[_0x1734('0x3e')](handleError(_0x59a1e0,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 5311a64..8d8eaa3 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 _0xf6ac=['uniqueid','lodash','api','request-promise','path','rimraf','../../config/environment','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x34a247,_0x5a54de){var _0x443993=function(_0x35760a){while(--_0x35760a){_0x34a247['push'](_0x34a247['shift']());}};_0x443993(++_0x5a54de);}(_0xf6ac,0x191));var _0xcf6a=function(_0x499185,_0x9342ce){_0x499185=_0x499185-0x0;var _0x232a15=_0xf6ac[_0x499185];return _0x232a15;};'use strict';var _=require(_0xcf6a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcf6a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcf6a('0x2'));var fs=require('fs');var path=require(_0xcf6a('0x3'));var rimraf=require(_0xcf6a('0x4'));var config=require(_0xcf6a('0x5'));var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x366a97,_0x338183){return _0x366a97[_0xcf6a('0x6')](_0xcf6a('0x7'),attributes,{'tableName':_0xcf6a('0x8'),'paranoid':![],'indexes':[{'name':_0xcf6a('0x9'),'fields':[_0xcf6a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3b86=['report_whatsapp_transfer','uniqueid','lodash','util','api','moment','path','rimraf','../../config/environment','exports','WhatsappTransferReport'];(function(_0x32e84d,_0x101ea8){var _0x24e3ea=function(_0x590024){while(--_0x590024){_0x32e84d['push'](_0x32e84d['shift']());}};_0x24e3ea(++_0x101ea8);}(_0x3b86,0x91));var _0x63b8=function(_0x2ec58c,_0x1bd17d){_0x2ec58c=_0x2ec58c-0x0;var _0x11d0c2=_0x3b86[_0x2ec58c];return _0x11d0c2;};'use strict';var _=require(_0x63b8('0x0'));var util=require(_0x63b8('0x1'));var logger=require('../../config/logger')(_0x63b8('0x2'));var moment=require(_0x63b8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x63b8('0x4'));var rimraf=require(_0x63b8('0x5'));var config=require(_0x63b8('0x6'));var attributes=require('./whatsappTransferReport.attributes');module[_0x63b8('0x7')]=function(_0x6cd6d9,_0x221a1a){return _0x6cd6d9['define'](_0x63b8('0x8'),attributes,{'tableName':_0x63b8('0x9'),'paranoid':![],'indexes':[{'name':_0x63b8('0xa'),'fields':[_0x63b8('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index c3ee80c..b3e76fa 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 _0x3c71=['jayson/promise','client','http','request','WhatsappTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x3f38a6,_0x4e345c){var _0x9450ea=function(_0x1e575e){while(--_0x1e575e){_0x3f38a6['push'](_0x3f38a6['shift']());}};_0x9450ea(++_0x4e345c);}(_0x3c71,0x1db));var _0x13c7=function(_0x3f5cef,_0x5f26eb){_0x3f5cef=_0x3f5cef-0x0;var _0x25466e=_0x3c71[_0x3f5cef];return _0x25466e;};'use strict';var _=require(_0x13c7('0x0'));var util=require(_0x13c7('0x1'));var moment=require(_0x13c7('0x2'));var BPromise=require(_0x13c7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13c7('0x4'));var db=require(_0x13c7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x13c7('0x6'))(_0x13c7('0x7'));var config=require('../../config/environment');var jayson=require(_0x13c7('0x8'));var client=jayson[_0x13c7('0x9')][_0x13c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x581b9e,_0x26658f,_0x3cc5f6){return new BPromise(function(_0x1f2779,_0x4b46be){return client[_0x13c7('0xb')](_0x581b9e,_0x3cc5f6)['then'](function(_0x35b430){logger['info'](_0x13c7('0xc'),_0x26658f,'request\x20sent');logger[_0x13c7('0xd')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x26658f,_0x13c7('0xe'),JSON[_0x13c7('0xf')](_0x35b430));if(_0x35b430[_0x13c7('0x10')]){if(_0x35b430[_0x13c7('0x10')][_0x13c7('0x11')]===0x1f4){logger[_0x13c7('0x10')](_0x13c7('0xc'),_0x26658f,_0x35b430[_0x13c7('0x10')]['message']);return _0x4b46be(_0x35b430['error'][_0x13c7('0x12')]);}logger[_0x13c7('0x10')](_0x13c7('0xc'),_0x26658f,_0x35b430['error'][_0x13c7('0x12')]);return _0x1f2779(_0x35b430['error']['message']);}else{logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x26658f,_0x13c7('0xe'));_0x1f2779(_0x35b430[_0x13c7('0x13')][_0x13c7('0x12')]);}})[_0x13c7('0x14')](function(_0x3bd5d3){logger['error'](_0x13c7('0xc'),_0x26658f,_0x3bd5d3);_0x4b46be(_0x3bd5d3);});});} \ No newline at end of file +var _0x8542=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','catch'];(function(_0x583033,_0x37f452){var _0x4f94da=function(_0x14fd08){while(--_0x14fd08){_0x583033['push'](_0x583033['shift']());}};_0x4f94da(++_0x37f452);}(_0x8542,0x1e4));var _0x2854=function(_0x3ca1d2,_0x2f0750){_0x3ca1d2=_0x3ca1d2-0x0;var _0x2b3a10=_0x8542[_0x3ca1d2];return _0x2b3a10;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2854('0x0'));var BPromise=require(_0x2854('0x1'));var rs=require(_0x2854('0x2'));var fs=require('fs');var Redis=require(_0x2854('0x3'));var db=require(_0x2854('0x4'))['db'];var utils=require(_0x2854('0x5'));var logger=require(_0x2854('0x6'))(_0x2854('0x7'));var config=require(_0x2854('0x8'));var jayson=require(_0x2854('0x9'));var client=jayson[_0x2854('0xa')][_0x2854('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d5954,_0x7001b0,_0x1a1efb){return new BPromise(function(_0x49239a,_0x3508b2){return client[_0x2854('0xc')](_0x5d5954,_0x1a1efb)['then'](function(_0x8ecc51){logger[_0x2854('0xd')](_0x2854('0xe'),_0x7001b0,_0x2854('0xf'));logger[_0x2854('0x10')](_0x2854('0x11'),_0x7001b0,'request\x20sent',JSON['stringify'](_0x8ecc51));if(_0x8ecc51['error']){if(_0x8ecc51['error'][_0x2854('0x12')]===0x1f4){logger[_0x2854('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x7001b0,_0x8ecc51['error'][_0x2854('0x14')]);return _0x3508b2(_0x8ecc51[_0x2854('0x13')][_0x2854('0x14')]);}logger[_0x2854('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x7001b0,_0x8ecc51[_0x2854('0x13')][_0x2854('0x14')]);return _0x49239a(_0x8ecc51['error'][_0x2854('0x14')]);}else{logger[_0x2854('0xd')](_0x2854('0xe'),_0x7001b0,_0x2854('0xf'));_0x49239a(_0x8ecc51['result'][_0x2854('0x14')]);}})[_0x2854('0x15')](function(_0x17bdbc){logger[_0x2854('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x7001b0,_0x17bdbc);_0x3508b2(_0x17bdbc);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index feb3783..a76b924 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d82=['Online\x20apps:','map','filter','online','join','Offline\x20apps:','status','name','None','seedDB','default','./config/license','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sequelize','sync','then','listen','info','start'];(function(_0x342dcf,_0x5b523a){var _0x442c7e=function(_0x215494){while(--_0x215494){_0x342dcf['push'](_0x342dcf['shift']());}};_0x442c7e(++_0x5b523a);}(_0x8d82,0x7f));var _0x28d8=function(_0x254bdf,_0x305d8f){_0x254bdf=_0x254bdf-0x0;var _0x873760=_0x8d82[_0x254bdf];return _0x873760;};'use strict';var _=require(_0x28d8('0x0'));var mysqldb=require(_0x28d8('0x1'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require('./config/logger')(_0x28d8('0x2'));var pm2=require('./config/pm2');var pm2Config=require(_0x28d8('0x3'));var schedule=require(_0x28d8('0x4'));var chat=require(_0x28d8('0x5'));var whatsapp=require(_0x28d8('0x6'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x28d8('0x7')][_0x28d8('0x8')]()[_0x28d8('0x9')](function(){return rpc[_0x28d8('0xa')]();})[_0x28d8('0x9')](function(_0x17698c){logger[_0x28d8('0xb')](_0x17698c);return chat[_0x28d8('0xc')]();})[_0x28d8('0x9')](function(){return whatsapp[_0x28d8('0xc')]();})[_0x28d8('0x9')](function(){return schedule[_0x28d8('0xc')]();})['then'](function(){return transcribe[_0x28d8('0xc')]();})[_0x28d8('0x9')](function(_0x3d8848){logger[_0x28d8('0xb')](_0x3d8848);return pm2[_0x28d8('0xc')](pm2Config);})['then'](function(_0x5b1d7f){logger[_0x28d8('0xb')](_0x28d8('0xd'),_[_0x28d8('0xe')](_[_0x28d8('0xf')](_0x5b1d7f,{'status':_0x28d8('0x10')}),'name')[_0x28d8('0x11')]());logger[_0x28d8('0xb')](_0x28d8('0x12'),_[_0x28d8('0xe')](_[_0x28d8('0xf')](_0x5b1d7f,function(_0x122d1a){return _0x122d1a[_0x28d8('0x13')]!==_0x28d8('0x10');}),_0x28d8('0x14'))[_0x28d8('0x11')]()||_0x28d8('0x15'));config[_0x28d8('0x16')]&&require('./config/seedDB')[_0x28d8('0x17')]();require(_0x28d8('0x18'))[_0x28d8('0x17')]();})['catch'](function(_0x485ddb){logger[_0x28d8('0x19')](_0x28d8('0x1a'),_0x485ddb);process[_0x28d8('0x1b')](0x1);});}main(); \ No newline at end of file +var _0x1ca2=['then','listen','info','start','Online\x20apps:','online','join','Offline\x20apps:','map','filter','status','name','None','seedDB','default','./config/license','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync'];(function(_0x5ee15e,_0x1bcf7b){var _0x18ff00=function(_0x15bfae){while(--_0x15bfae){_0x5ee15e['push'](_0x5ee15e['shift']());}};_0x18ff00(++_0x1bcf7b);}(_0x1ca2,0x1e4));var _0x21ca=function(_0x3b534c,_0x2c614f){_0x3b534c=_0x3b534c-0x0;var _0x449ef9=_0x1ca2[_0x3b534c];return _0x449ef9;};'use strict';var _=require(_0x21ca('0x0'));var mysqldb=require(_0x21ca('0x1'));var rpc=require(_0x21ca('0x2'));var config=require(_0x21ca('0x3'));var logger=require(_0x21ca('0x4'))(_0x21ca('0x5'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0x21ca('0x6'));var chat=require(_0x21ca('0x7'));var whatsapp=require(_0x21ca('0x8'));var transcribe=require(_0x21ca('0x9'));function main(){return mysqldb['db'][_0x21ca('0xa')][_0x21ca('0xb')]()[_0x21ca('0xc')](function(){return rpc[_0x21ca('0xd')]();})[_0x21ca('0xc')](function(_0x4bc58d){logger[_0x21ca('0xe')](_0x4bc58d);return chat[_0x21ca('0xf')]();})[_0x21ca('0xc')](function(){return whatsapp['start']();})[_0x21ca('0xc')](function(){return schedule[_0x21ca('0xf')]();})['then'](function(){return transcribe[_0x21ca('0xf')]();})[_0x21ca('0xc')](function(_0x2ce339){logger[_0x21ca('0xe')](_0x2ce339);return pm2[_0x21ca('0xf')](pm2Config);})['then'](function(_0x223d10){logger['info'](_0x21ca('0x10'),_['map'](_['filter'](_0x223d10,{'status':_0x21ca('0x11')}),'name')[_0x21ca('0x12')]());logger[_0x21ca('0xe')](_0x21ca('0x13'),_[_0x21ca('0x14')](_[_0x21ca('0x15')](_0x223d10,function(_0x2375ff){return _0x2375ff[_0x21ca('0x16')]!=='online';}),_0x21ca('0x17'))[_0x21ca('0x12')]()||_0x21ca('0x18'));config[_0x21ca('0x19')]&&require('./config/seedDB')[_0x21ca('0x1a')]();require(_0x21ca('0x1b'))[_0x21ca('0x1a')]();})[_0x21ca('0x1c')](function(_0x36790e){logger['error'](_0x21ca('0x1d'),_0x36790e);process[_0x21ca('0x1e')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 145e684..840d80a 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 _0xc9cf=['name','internal','email','userpic','md5secret','chatPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','json','unmanaged','Unmanaged.','Forbidden.','catch','startsWith','headers','authorization','User','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','find','sub','allowedLoginAttempts','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blocked','blockDuration','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','Forbidden','webrtc','isMiddleware','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','length','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','crypto','bluebird','moment','secrets','session','role','fullname'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc9cf,0x166));var _0xfc9c=function(_0x2f1ac4,_0x236a72){_0x2f1ac4=_0x2f1ac4-0x0;var _0x18e1a5=_0xc9cf[_0x2f1ac4];return _0x18e1a5;};'use strict';var db=require(_0xfc9c('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0xfc9c('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xfc9c('0x2'));var _=require(_0xfc9c('0x3'));var jwt=require(_0xfc9c('0x4'));var expressJwt=require(_0xfc9c('0x5'));var compose=require(_0xfc9c('0x6'));var basicAuth=require('basic-auth');var crypto=require(_0xfc9c('0x7'));var BPromise=require(_0xfc9c('0x8'));var util=require('util');var moment=require(_0xfc9c('0x9'));var validateJwt=expressJwt({'secret':config[_0xfc9c('0xa')][_0xfc9c('0xb')]});var userAttributes=['id',_0xfc9c('0xc'),_0xfc9c('0xd'),_0xfc9c('0xe'),_0xfc9c('0xf'),_0xfc9c('0x10'),_0xfc9c('0x11'),'permissions',_0xfc9c('0x12'),'voicePause',_0xfc9c('0x13'),'mailPause','faxPause',_0xfc9c('0x14'),_0xfc9c('0x15'),_0xfc9c('0x16'),_0xfc9c('0x17'),'lastLoginAt',_0xfc9c('0x18'),_0xfc9c('0x19'),_0xfc9c('0x1a'),'passwordResetAt',_0xfc9c('0x1b'),_0xfc9c('0x1c'),_0xfc9c('0x1d'),'phoneBarDnd',_0xfc9c('0x1e'),'phoneBarEnableDtmfTone',_0xfc9c('0x1f'),'phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl',_0xfc9c('0x20'),_0xfc9c('0x21'),_0xfc9c('0x22'),'userProfileId',_0xfc9c('0x23'),'settingsEnabled',_0xfc9c('0x24'),_0xfc9c('0x25'),_0xfc9c('0x26'),_0xfc9c('0x27'),_0xfc9c('0x28'),'selectRecallMeCampaign'];exports[_0xfc9c('0x29')]=function(){return this[_0xfc9c('0x2a')](!![])[_0xfc9c('0x2b')](function(_0xe3b30c,_0x284813,_0x3c56a0){if(_0xe3b30c[_0xfc9c('0x2c')]){_0x3c56a0();}else{return db[_0xfc9c('0x2d')][_0xfc9c('0x2e')]({'where':{'id':_0xe3b30c[_0xfc9c('0x2f')]['id']},'attributes':['id',_0xfc9c('0x30'),_0xfc9c('0x31')],'raw':!![]})[_0xfc9c('0x32')](function(_0x4c8ef5){if(_0x4c8ef5&&_0x4c8ef5[_0xfc9c('0x30')]){return _0x284813[_0xfc9c('0x33')](_0x4c8ef5[_0xfc9c('0x31')]==='unmanaged'?0x195:0x193)[_0xfc9c('0x34')]({'message':_0x4c8ef5['disposition']===_0xfc9c('0x35')?_0xfc9c('0x36'):_0xfc9c('0x37')});}else{_0x3c56a0();}})[_0xfc9c('0x38')](function(_0x55805d){_0x3c56a0(_0x55805d);});}});};exports[_0xfc9c('0x2a')]=function isAuthenticated(_0x480bfc){return compose()[_0xfc9c('0x2b')](function(_0x402d0d,_0x1e2ee2,_0x31e761){var _0x233b90;if(_0x402d0d['headers']['authorization']){if(_[_0xfc9c('0x39')](_0x402d0d[_0xfc9c('0x3a')][_0xfc9c('0x3b')],'Basic')){var _0x57da55=basicAuth(_0x402d0d);db[_0xfc9c('0x3c')]['find']({'where':{'name':_0x57da55[_0xfc9c('0xe')]}})[_0xfc9c('0x32')](function(_0x2da916){if(!_0x2da916||!_0x2da916['authenticate'](_0x57da55[_0xfc9c('0x3d')])){return _0x1e2ee2[_0xfc9c('0x33')](0x191)[_0xfc9c('0x34')]({'message':_0xfc9c('0x3e')});}_0x402d0d[_0xfc9c('0x2c')]={'id':_0x2da916['id']};_0x31e761();})['catch'](function(_0x4b33a9){_0x31e761(_0x4b33a9);});}else if(_['startsWith'](_0x402d0d[_0xfc9c('0x3a')][_0xfc9c('0x3b')],_0xfc9c('0x3f'))){validateJwt(_0x402d0d,_0x1e2ee2,_0x31e761);}else{if(_0x480bfc){_0x31e761();}else{return _0x1e2ee2[_0xfc9c('0x33')](0x193)[_0xfc9c('0x34')]({'message':_0xfc9c('0x40')});}}}else if(_0x402d0d[_0xfc9c('0x41')][_0xfc9c('0x42')]){try{var _0x5c7e4f={'audience':hardwareConf[_0xfc9c('0x43')](),'issuer':hardwareConf[_0xfc9c('0x43')]()};verifyJwt(_0x402d0d[_0xfc9c('0x41')][_0xfc9c('0x42')],_0x5c7e4f)[_0xfc9c('0x32')](function(_0x52b1f5){return db['User'][_0xfc9c('0x44')]({'where':{'id':_0x52b1f5[_0xfc9c('0x45')]}})[_0xfc9c('0x32')](function(_0x5e6c79){_0x233b90=_0x5e6c79;return db['Setting'][_0xfc9c('0x2e')]({'where':{'id':0x1},'attributes':[_0xfc9c('0x46'),'blockDuration'],'raw':!![]});})[_0xfc9c('0x32')](function(_0x120826){if(!_0x233b90||!_['isEqual'](_0x233b90['apiKeyNonce'],_0x52b1f5[_0xfc9c('0x47')])){return _0x1e2ee2[_0xfc9c('0x33')](0x191)[_0xfc9c('0x34')]({'message':_0xfc9c('0x48')});}if(_0x233b90['disabled']){return _0x1e2ee2['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}if(_0x233b90[_0xfc9c('0x49')]){if(_0x120826[_0xfc9c('0x4a')]>0x0){if(moment(_0x233b90[_0xfc9c('0x4b')])[_0xfc9c('0x4c')](_0x120826[_0xfc9c('0x4a')],_0xfc9c('0x4d'))>moment()){return _0x1e2ee2[_0xfc9c('0x33')](0x191)['json']({'message':_0xfc9c('0x4e')});}}else{return _0x1e2ee2[_0xfc9c('0x33')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}_0x402d0d[_0xfc9c('0x2c')]={'id':_0x233b90['id']};_0x31e761();});})['catch'](function(){return _0x1e2ee2[_0xfc9c('0x33')](0x191)['json']({'message':_0xfc9c('0x4e')});});}catch(_0x4ff8f0){_0x31e761(_0x4ff8f0);}}else if(_0x480bfc){_0x31e761();}else{return _0x1e2ee2[_0xfc9c('0x33')](0x193)[_0xfc9c('0x34')]({'message':'Unknown\x20authorization\x20format'});}})[_0xfc9c('0x2b')](function(_0x4be191,_0x41eed5,_0x38b1b1){if(_0x4be191['user']){db[_0xfc9c('0x3c')]['find']({'where':{'id':_0x4be191[_0xfc9c('0x2c')]['id']},'attributes':userAttributes})[_0xfc9c('0x32')](function(_0x42435b){if(!_0x42435b){return _0x41eed5[_0xfc9c('0x33')](0x194)[_0xfc9c('0x34')]({'message':_0xfc9c('0x4f')});}_0x4be191['user']=_0x42435b;_0x38b1b1();})[_0xfc9c('0x38')](function(_0x43d36c){_0x38b1b1(_0x43d36c);});}else if(_0x480bfc){_0x38b1b1();}else{return _0x41eed5['status'](0x194)[_0xfc9c('0x34')]({'message':_0xfc9c('0x50')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x227ed6,_0x2699d1,_0x119d81){return licenseUtil[_0xfc9c('0x51')]()[_0xfc9c('0x32')](function(_0x27e117){if(_0x27e117['update']){_0x119d81();}else{return _0x2699d1['status'](0x193)[_0xfc9c('0x34')]({'message':_0xfc9c('0x52')});}})['catch'](function(_0x353232){_0x119d81(_0x353232);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0xfc9c('0x2b')](function(_0x57c592,_0x47de51,_0xd0068f){return licenseUtil[_0xfc9c('0x51')]()[_0xfc9c('0x32')](function(_0x432d1d){if(_0x432d1d[_0xfc9c('0x53')]){_0xd0068f();}else{return _0x47de51[_0xfc9c('0x33')](0x193)[_0xfc9c('0x34')]({'message':_0xfc9c('0x52')});}})[_0xfc9c('0x38')](function(_0x3467a0){_0xd0068f(_0x3467a0);});});};exports['isMiddleware']=function(_0x322ac5,_0x497899,_0x1e0f8b){_0x322ac5[_0xfc9c('0x54')]=!![];return _0x1e0f8b();};exports['signToken']=function signToken(_0x1e7846){return signJwt(_0x1e7846);};exports[_0xfc9c('0x55')]=function(_0x8fdbed,_0x44d5c5){if(!_0x8fdbed['user']){return _0x44d5c5[_0xfc9c('0x33')](0x194)[_0xfc9c('0x34')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x41f559={'payload':{'id':_0x8fdbed[_0xfc9c('0x2c')]['id'],'role':_0x8fdbed[_0xfc9c('0x2c')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x41f559)[_0xfc9c('0x32')](function(_0x646c88){_0x44d5c5[_0xfc9c('0x56')](_0xfc9c('0x57'),_0x646c88);_0x44d5c5[_0xfc9c('0x58')](_0xfc9c('0x59'));})[_0xfc9c('0x38')](function(_0x2cfb6c){return _0x44d5c5['status'](0x1f4)[_0xfc9c('0x5a')](_0x2cfb6c);});};exports[_0xfc9c('0x5b')]=function(_0x304f12){if(_[_0xfc9c('0x5c')](_0x304f12[_0xfc9c('0x5d')])||_[_0xfc9c('0x5c')](_0x304f12[_0xfc9c('0x5e')])){return null;}else{return createJwt(_0x304f12);}};exports[_0xfc9c('0x5f')]=function(_0x376b6c){_0x376b6c['apiKeyNonce']=generateNonce();_0x376b6c['apiKeyIat']=generateIssuedAt();return createJwt(_0x376b6c);};exports[_0xfc9c('0x60')]=function(_0x480a48,_0xde97a2){var _0x2acde6=_0x480a48['query']['apikey'];if(_0x2acde6){var _0x1eb83b={'nonce':_0xde97a2[_0xfc9c('0x5d')],'iat':_0xde97a2[_0xfc9c('0x5e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xfc9c('0x43')]()};return verifyJwt(_0x2acde6,_0x1eb83b)[_0xfc9c('0x32')](function(){return generateApiKey(_0xde97a2);});}else{throw{'message':_0xfc9c('0x61')};}};exports[_0xfc9c('0x62')]=function(_0x1dc16e){var _0x3cc8b8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3cc8b8['test'](_0x1dc16e))throw new db[(_0xfc9c('0x63'))]['ValidationError'](_0xfc9c('0x64'));return;};exports[_0xfc9c('0x65')]=function(_0x3f991a,_0x4b67f6,_0x250608){var _0x235061=encryptor[_0xfc9c('0x66')](_0x4b67f6)[_0xfc9c('0x67')](',');for(var _0x334b14=0x0;_0x334b14<_0x250608;_0x334b14++){if(!_0x235061[_0x334b14])break;if(_0x3f991a[_0xfc9c('0x68')]()===_0x235061[_0x334b14]['toLowerCase']()){var _0x220a37=util[_0xfc9c('0x69')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x250608);if(_0x250608===0x1){_0x220a37=_0xfc9c('0x6a');}throw new db[(_0xfc9c('0x63'))][(_0xfc9c('0x6b'))](_0x220a37);}}return;};exports['updatePasswordsHistory']=function(_0x5e64d2,_0x19428b){var _0x553976=_0x19428b?encryptor[_0xfc9c('0x66')](_0x19428b)[_0xfc9c('0x67')](','):[];if(_0x553976[_0xfc9c('0x6c')]===0x5){_0x553976['splice'](-0x1,0x1);}_0x553976[_0xfc9c('0x6d')](_0x5e64d2);return encryptor[_0xfc9c('0x6e')](_0x553976[_0xfc9c('0x6f')](','));};function signJwt(_0xfbaf44){var _0x4db012=BPromise[_0xfc9c('0x70')](jwt[_0xfc9c('0x71')],{'context':jwt});var _0x117df8=_0xfbaf44[_0xfc9c('0x72')]||config[_0xfc9c('0xa')][_0xfc9c('0xb')];return new BPromise(function(_0xbbbb0a,_0x12d6c2){_0x4db012(_0xfbaf44[_0xfc9c('0x73')],_0x117df8,_0xfbaf44[_0xfc9c('0x74')])['then'](function(_0x38f17a){_0xbbbb0a(_0x38f17a);})[_0xfc9c('0x38')](function(_0x210459){_0x12d6c2(_0x210459);});});}function verifyJwt(_0x3d1736,_0x3b57ab,_0x20ca47){var _0x4f6f2b=BPromise[_0xfc9c('0x70')](jwt[_0xfc9c('0x75')],{'context':jwt});var _0x42bba0=_0x20ca47||config['secrets'][_0xfc9c('0xb')];return new BPromise(function(_0x1651bc,_0x1d978d){_0x4f6f2b(_0x3d1736,_0x42bba0,_0x3b57ab)[_0xfc9c('0x32')](function(_0x497da0){_0x1651bc(_0x497da0);})[_0xfc9c('0x38')](function(_0x3f0073){_0x1d978d(_0x3f0073);});});}function generateNonce(){return crypto[_0xfc9c('0x76')](0x10)[_0xfc9c('0x77')](_0xfc9c('0x78'));}function generateIssuedAt(){return Math[_0xfc9c('0x79')](Date[_0xfc9c('0x7a')]()/0x3e8)[_0xfc9c('0x77')]();}function createJwt(_0x1937ea){var _0x4faaaa={'payload':{'iat':_0x1937ea[_0xfc9c('0x5e')],'nonce':_0x1937ea[_0xfc9c('0x5d')]},'options':{'algorithm':_0xfc9c('0x7b'),'subject':_0x1937ea['id']['toString'](),'issuer':hardwareConf[_0xfc9c('0x43')](),'audience':hardwareConf[_0xfc9c('0x43')]()}};return signJwt(_0x4faaaa)[_0xfc9c('0x32')](function(_0x95aa45){return{'iat':_0x1937ea[_0xfc9c('0x5e')],'nonce':_0x1937ea['apiKeyNonce'],'token':_0x95aa45};});} \ No newline at end of file +var _0x9dbd=['User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','getUuid','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','ValidationError','length','splice','unshift','promisify','sign','secret','options','verify','randomBytes','toString','floor','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','util','moment','secrets','session','role','internal','userpic','md5secret','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','use','user','params','closed','disposition','then','status','unmanaged','Unmanaged.','Forbidden.','catch','isAuthenticated','authorization','headers','User','find','pass','json','Wrong\x20credentials.','startsWith','Bearer','Unknown\x20authorization\x20format','query','apikey','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes'];(function(_0x28713e,_0x13793e){var _0x13498c=function(_0x235325){while(--_0x235325){_0x28713e['push'](_0x28713e['shift']());}};_0x13498c(++_0x13793e);}(_0x9dbd,0xa6));var _0xd9db=function(_0x8b6b14,_0x510321){_0x8b6b14=_0x8b6b14-0x0;var _0x35b1c4=_0x9dbd[_0x8b6b14];return _0x35b1c4;};'use strict';var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var hardwareConf=require(_0xd9db('0x0'));var licenseUtil=require(_0xd9db('0x1'));var encryptor=require(_0xd9db('0x2'));var _=require(_0xd9db('0x3'));var jwt=require(_0xd9db('0x4'));var expressJwt=require(_0xd9db('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0xd9db('0x6'));var crypto=require(_0xd9db('0x7'));var BPromise=require('bluebird');var util=require(_0xd9db('0x8'));var moment=require(_0xd9db('0x9'));var validateJwt=expressJwt({'secret':config[_0xd9db('0xa')][_0xd9db('0xb')]});var userAttributes=['id',_0xd9db('0xc'),'fullname','name',_0xd9db('0xd'),'email',_0xd9db('0xe'),'permissions',_0xd9db('0xf'),'voicePause','chatPause',_0xd9db('0x10'),_0xd9db('0x11'),'smsPause',_0xd9db('0x12'),_0xd9db('0x13'),_0xd9db('0x14'),_0xd9db('0x15'),_0xd9db('0x16'),_0xd9db('0x17'),_0xd9db('0x18'),'passwordResetAt',_0xd9db('0x19'),_0xd9db('0x1a'),_0xd9db('0x1b'),_0xd9db('0x1c'),_0xd9db('0x1d'),_0xd9db('0x1e'),_0xd9db('0x1f'),_0xd9db('0x20'),_0xd9db('0x21'),_0xd9db('0x22'),_0xd9db('0x23'),'hotdesk',_0xd9db('0x24'),_0xd9db('0x25'),'privacyEnabled',_0xd9db('0x26'),_0xd9db('0x27'),_0xd9db('0x28'),_0xd9db('0x29'),_0xd9db('0x2a'),_0xd9db('0x2b'),_0xd9db('0x2c')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0xd9db('0x2d')](function(_0xe58a3f,_0x2e0d3d,_0xf1547a){if(_0xe58a3f[_0xd9db('0x2e')]){_0xf1547a();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0xe58a3f[_0xd9db('0x2f')]['id']},'attributes':['id',_0xd9db('0x30'),_0xd9db('0x31')],'raw':!![]})[_0xd9db('0x32')](function(_0x10eb18){if(_0x10eb18&&_0x10eb18[_0xd9db('0x30')]){return _0x2e0d3d[_0xd9db('0x33')](_0x10eb18[_0xd9db('0x31')]===_0xd9db('0x34')?0x195:0x193)['json']({'message':_0x10eb18[_0xd9db('0x31')]===_0xd9db('0x34')?_0xd9db('0x35'):_0xd9db('0x36')});}else{_0xf1547a();}})[_0xd9db('0x37')](function(_0x2655d3){_0xf1547a(_0x2655d3);});}});};exports[_0xd9db('0x38')]=function isAuthenticated(_0x3db84b){return compose()[_0xd9db('0x2d')](function(_0x187476,_0x21d584,_0x390496){var _0x5f5bf3;if(_0x187476['headers'][_0xd9db('0x39')]){if(_['startsWith'](_0x187476[_0xd9db('0x3a')][_0xd9db('0x39')],'Basic')){var _0x17c533=basicAuth(_0x187476);db[_0xd9db('0x3b')][_0xd9db('0x3c')]({'where':{'name':_0x17c533['name']}})[_0xd9db('0x32')](function(_0x1bc702){if(!_0x1bc702||!_0x1bc702['authenticate'](_0x17c533[_0xd9db('0x3d')])){return _0x21d584[_0xd9db('0x33')](0x191)[_0xd9db('0x3e')]({'message':_0xd9db('0x3f')});}_0x187476[_0xd9db('0x2e')]={'id':_0x1bc702['id']};_0x390496();})[_0xd9db('0x37')](function(_0x209ec9){_0x390496(_0x209ec9);});}else if(_[_0xd9db('0x40')](_0x187476['headers'][_0xd9db('0x39')],_0xd9db('0x41'))){validateJwt(_0x187476,_0x21d584,_0x390496);}else{if(_0x3db84b){_0x390496();}else{return _0x21d584[_0xd9db('0x33')](0x193)['json']({'message':_0xd9db('0x42')});}}}else if(_0x187476[_0xd9db('0x43')]['apikey']){try{var _0x2e70e5={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x187476[_0xd9db('0x43')][_0xd9db('0x44')],_0x2e70e5)[_0xd9db('0x32')](function(_0x53bcf5){return db['User']['find']({'where':{'id':_0x53bcf5['sub']}})[_0xd9db('0x32')](function(_0x5e99f0){_0x5f5bf3=_0x5e99f0;return db[_0xd9db('0x45')]['findOne']({'where':{'id':0x1},'attributes':[_0xd9db('0x46'),_0xd9db('0x47')],'raw':!![]});})[_0xd9db('0x32')](function(_0x1ddd70){if(!_0x5f5bf3||!_[_0xd9db('0x48')](_0x5f5bf3[_0xd9db('0x49')],_0x53bcf5['nonce'])){return _0x21d584[_0xd9db('0x33')](0x191)[_0xd9db('0x3e')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x5f5bf3[_0xd9db('0x4a')]){return _0x21d584[_0xd9db('0x33')](0x191)[_0xd9db('0x3e')]({'message':_0xd9db('0x4b')});}if(_0x5f5bf3[_0xd9db('0x4c')]){if(_0x1ddd70[_0xd9db('0x47')]>0x0){if(moment(_0x5f5bf3[_0xd9db('0x4d')])[_0xd9db('0x4e')](_0x1ddd70['blockDuration'],_0xd9db('0x4f'))>moment()){return _0x21d584[_0xd9db('0x33')](0x191)[_0xd9db('0x3e')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x21d584['status'](0x191)['json']({'message':_0xd9db('0x4b')});}}_0x187476[_0xd9db('0x2e')]={'id':_0x5f5bf3['id']};_0x390496();});})[_0xd9db('0x37')](function(){return _0x21d584[_0xd9db('0x33')](0x191)[_0xd9db('0x3e')]({'message':_0xd9db('0x4b')});});}catch(_0xfb7c7b){_0x390496(_0xfb7c7b);}}else if(_0x3db84b){_0x390496();}else{return _0x21d584['status'](0x193)['json']({'message':_0xd9db('0x42')});}})[_0xd9db('0x2d')](function(_0x50e78d,_0x3bc496,_0x190463){if(_0x50e78d[_0xd9db('0x2e')]){db[_0xd9db('0x3b')][_0xd9db('0x3c')]({'where':{'id':_0x50e78d[_0xd9db('0x2e')]['id']},'attributes':userAttributes})[_0xd9db('0x32')](function(_0x3aedf5){if(!_0x3aedf5){return _0x3bc496[_0xd9db('0x33')](0x194)[_0xd9db('0x3e')]({'message':_0xd9db('0x50')});}_0x50e78d[_0xd9db('0x2e')]=_0x3aedf5;_0x190463();})[_0xd9db('0x37')](function(_0x257b57){_0x190463(_0x257b57);});}else if(_0x3db84b){_0x190463();}else{return _0x3bc496[_0xd9db('0x33')](0x194)[_0xd9db('0x3e')]({'message':_0xd9db('0x51')});}});};exports[_0xd9db('0x52')]=function canUpdate(){return compose()[_0xd9db('0x2d')](function(_0x343fb2,_0x1e8ee8,_0x49e96f){return licenseUtil[_0xd9db('0x53')]()[_0xd9db('0x32')](function(_0xeca99d){if(_0xeca99d[_0xd9db('0x54')]){_0x49e96f();}else{return _0x1e8ee8[_0xd9db('0x33')](0x193)['json']({'message':_0xd9db('0x55')});}})[_0xd9db('0x37')](function(_0x41a3d0){_0x49e96f(_0x41a3d0);});});};exports[_0xd9db('0x56')]=function isWebrtcLicence(){return compose()[_0xd9db('0x2d')](function(_0x21a87f,_0x5f3911,_0x330937){return licenseUtil[_0xd9db('0x53')]()[_0xd9db('0x32')](function(_0x3af294){if(_0x3af294[_0xd9db('0x57')]){_0x330937();}else{return _0x5f3911[_0xd9db('0x33')](0x193)[_0xd9db('0x3e')]({'message':_0xd9db('0x55')});}})[_0xd9db('0x37')](function(_0x4ac3f1){_0x330937(_0x4ac3f1);});});};exports['isMiddleware']=function(_0x28c386,_0x591733,_0x57ba5c){_0x28c386[_0xd9db('0x58')]=!![];return _0x57ba5c();};exports[_0xd9db('0x59')]=function signToken(_0x20600c){return signJwt(_0x20600c);};exports[_0xd9db('0x5a')]=function(_0x4b442c,_0x23a56f){if(!_0x4b442c[_0xd9db('0x2e')]){return _0x23a56f[_0xd9db('0x33')](0x194)[_0xd9db('0x3e')]({'message':_0xd9db('0x5b')});}var _0x5bb9b8={'payload':{'id':_0x4b442c[_0xd9db('0x2e')]['id'],'role':_0x4b442c[_0xd9db('0x2e')][_0xd9db('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5bb9b8)[_0xd9db('0x32')](function(_0x5c2f8c){_0x23a56f[_0xd9db('0x5c')](_0xd9db('0x5d'),_0x5c2f8c);_0x23a56f[_0xd9db('0x5e')](_0xd9db('0x5f'));})[_0xd9db('0x37')](function(_0xdd646d){return _0x23a56f[_0xd9db('0x33')](0x1f4)[_0xd9db('0x60')](_0xdd646d);});};exports[_0xd9db('0x61')]=function(_0x5efa67){if(_[_0xd9db('0x62')](_0x5efa67[_0xd9db('0x49')])||_[_0xd9db('0x62')](_0x5efa67['apiKeyIat'])){return null;}else{return createJwt(_0x5efa67);}};exports[_0xd9db('0x63')]=function(_0x147a82){_0x147a82[_0xd9db('0x49')]=generateNonce();_0x147a82[_0xd9db('0x64')]=generateIssuedAt();return createJwt(_0x147a82);};exports[_0xd9db('0x65')]=function(_0x5ad833,_0x1a8f39){var _0x13e2e9=_0x5ad833[_0xd9db('0x43')]['apikey'];if(_0x13e2e9){var _0x52b250={'nonce':_0x1a8f39[_0xd9db('0x49')],'iat':_0x1a8f39['apiKeyIat'],'audience':hardwareConf[_0xd9db('0x66')](),'issuer':hardwareConf[_0xd9db('0x66')]()};return verifyJwt(_0x13e2e9,_0x52b250)[_0xd9db('0x32')](function(){return generateApiKey(_0x1a8f39);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x279e81){var _0x17e5b4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x17e5b4[_0xd9db('0x67')](_0x279e81))throw new db[(_0xd9db('0x68'))]['ValidationError'](_0xd9db('0x69'));return;};exports[_0xd9db('0x6a')]=function(_0x354150,_0x96ab33,_0x1f3dd6){var _0x3564d9=encryptor[_0xd9db('0x6b')](_0x96ab33)[_0xd9db('0x6c')](',');for(var _0x4d7503=0x0;_0x4d7503<_0x1f3dd6;_0x4d7503++){if(!_0x3564d9[_0x4d7503])break;if(_0x354150[_0xd9db('0x6d')]()===_0x3564d9[_0x4d7503][_0xd9db('0x6d')]()){var _0x31dbd9=util['format'](_0xd9db('0x6e'),_0x1f3dd6);if(_0x1f3dd6===0x1){_0x31dbd9='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xd9db('0x68'))][(_0xd9db('0x6f'))](_0x31dbd9);}}return;};exports['updatePasswordsHistory']=function(_0x423b4e,_0x1da95f){var _0x2fa25f=_0x1da95f?encryptor[_0xd9db('0x6b')](_0x1da95f)[_0xd9db('0x6c')](','):[];if(_0x2fa25f[_0xd9db('0x70')]===0x5){_0x2fa25f[_0xd9db('0x71')](-0x1,0x1);}_0x2fa25f[_0xd9db('0x72')](_0x423b4e);return encryptor['encryptString'](_0x2fa25f['join'](','));};function signJwt(_0xa64f87){var _0xf2422=BPromise[_0xd9db('0x73')](jwt[_0xd9db('0x74')],{'context':jwt});var _0x52ca66=_0xa64f87[_0xd9db('0x75')]||config['secrets'][_0xd9db('0xb')];return new BPromise(function(_0x1f55b0,_0x507c1b){_0xf2422(_0xa64f87['payload'],_0x52ca66,_0xa64f87[_0xd9db('0x76')])[_0xd9db('0x32')](function(_0x361300){_0x1f55b0(_0x361300);})['catch'](function(_0x1fc26a){_0x507c1b(_0x1fc26a);});});}function verifyJwt(_0x197857,_0x4ad327,_0x5e69e9){var _0x3a9efd=BPromise[_0xd9db('0x73')](jwt[_0xd9db('0x77')],{'context':jwt});var _0x2507d2=_0x5e69e9||config['secrets']['session'];return new BPromise(function(_0x5017e5,_0x119ecb){_0x3a9efd(_0x197857,_0x2507d2,_0x4ad327)[_0xd9db('0x32')](function(_0x226fcd){_0x5017e5(_0x226fcd);})[_0xd9db('0x37')](function(_0xda37c){_0x119ecb(_0xda37c);});});}function generateNonce(){return crypto[_0xd9db('0x78')](0x10)[_0xd9db('0x79')]('hex');}function generateIssuedAt(){return Math[_0xd9db('0x7a')](Date['now']()/0x3e8)[_0xd9db('0x79')]();}function createJwt(_0x1e1410){var _0x44b5b0={'payload':{'iat':_0x1e1410[_0xd9db('0x64')],'nonce':_0x1e1410['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x1e1410['id'][_0xd9db('0x79')](),'issuer':hardwareConf[_0xd9db('0x66')](),'audience':hardwareConf[_0xd9db('0x66')]()}};return signJwt(_0x44b5b0)[_0xd9db('0x32')](function(_0x1d2abd){return{'iat':_0x1e1410[_0xd9db('0x64')],'nonce':_0x1e1410[_0xd9db('0x49')],'token':_0x1d2abd};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index eb88494..bf92e43 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 _0x028e=['decryptFile','createDecipher','encryptString','base64','decryptString','secret','crypto','bluebird','lodash','../../config/logger','session','aes-256-ctr','aes192','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','end','final','write','close','unlink'];(function(_0x48dd37,_0x4c4632){var _0x490d1c=function(_0x394de3){while(--_0x394de3){_0x48dd37['push'](_0x48dd37['shift']());}};_0x490d1c(++_0x4c4632);}(_0x028e,0x11d));var _0xe028=function(_0x37be7e,_0x538f6d){_0x37be7e=_0x37be7e-0x0;var _0x4cacb8=_0x028e[_0x37be7e];return _0x4cacb8;};'use strict';var crypto=require(_0xe028('0x0'));var fs=require('fs');var BPromise=require(_0xe028('0x1'));var _=require(_0xe028('0x2'));var config=require('../../config/environment');var logger=require(_0xe028('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xe028('0x4')],'algorithm':_0xe028('0x5')};const fileOptions={'algorithm':_0xe028('0x6')};if(config[_0xe028('0x7')]&&config[_0xe028('0x7')][_0xe028('0x8')]){var isSupported=isAlgorithmSupported(config[_0xe028('0x7')][_0xe028('0x8')]);if(isSupported){fileOptions['algorithm']=config[_0xe028('0x7')][_0xe028('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0xe028('0x7')][_0xe028('0x8')],_0xe028('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x1ff5fe){return AES_SUPPORTED_RX['test'](_0x1ff5fe);}function getSupportedCiphers(){return crypto[_0xe028('0xa')]()[_0xe028('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x5ef359){return getSupportedCiphers()['indexOf'](_0x5ef359)>-0x1;}function combineOptions(_0x265873){var _0x78b22d={};for(var _0x41aedb in fileOptions){if(fileOptions[_0xe028('0xc')](_0x41aedb)){_0x78b22d[_0x41aedb]=fileOptions[_0x41aedb];}}if(_0x265873){for(var _0x19425d in _0x265873){if(_0x265873[_0xe028('0xc')](_0x19425d)){_0x78b22d[_0x19425d]=_0x265873[_0x19425d];}}}return _0x78b22d;}exports[_0xe028('0xd')]=function(_0x25337c,_0x364152,_0xb4404c,_0x27e0f8){return new BPromise(function(_0x5cab80,_0x333f92){_0x27e0f8=combineOptions(_0x27e0f8);var _0x54e6f4=new Buffer(_0xb4404c);var _0x125177=fs[_0xe028('0xe')](_0x25337c);var _0x397bf9=fs[_0xe028('0xf')](_0x364152);var _0x2c0781=crypto[_0xe028('0x10')](_0x27e0f8['algorithm'],_0x54e6f4);_0x125177['on'](_0xe028('0x11'),function(_0x596b4e){var _0x43a629=new Buffer(_0x2c0781[_0xe028('0x12')](_0x596b4e),_0xe028('0x13'));_0x397bf9['write'](_0x43a629);});_0x125177['on'](_0xe028('0x14'),function(){try{var _0x30eb48=new Buffer(_0x2c0781[_0xe028('0x15')](_0xe028('0x13')),'binary');_0x397bf9[_0xe028('0x16')](_0x30eb48);_0x397bf9[_0xe028('0x14')]();_0x397bf9['on'](_0xe028('0x17'),function(){return _0x5cab80(_0x364152);});}catch(_0x22c5c5){fs[_0xe028('0x18')](_0x364152);return _0x333f92(_0x22c5c5);}});});};exports[_0xe028('0x19')]=function(_0x12728b,_0x34eec4,_0x279cc4,_0x4be070){return new BPromise(function(_0x5304bd,_0x79d301){_0x4be070=combineOptions(_0x4be070);var _0x571949=new Buffer(_0x279cc4);var _0x3828f0=fs[_0xe028('0xe')](_0x12728b);var _0x412b7c=fs[_0xe028('0xf')](_0x34eec4);var _0xd6006b=crypto[_0xe028('0x1a')](_0x4be070[_0xe028('0x8')],_0x571949);_0x3828f0['on'](_0xe028('0x11'),function(_0x24c17d){var _0x238bca=new Buffer(_0xd6006b[_0xe028('0x12')](_0x24c17d),'binary');_0x412b7c[_0xe028('0x16')](_0x238bca);});_0x3828f0['on']('end',function(){try{var _0x69bfa4=new Buffer(_0xd6006b[_0xe028('0x15')](_0xe028('0x13')),'binary');_0x412b7c['write'](_0x69bfa4);_0x412b7c[_0xe028('0x14')]();_0x412b7c['on'](_0xe028('0x17'),function(){return _0x5304bd(_0x34eec4);});}catch(_0x3b719f){fs[_0xe028('0x18')](_0x34eec4);return _0x79d301(_0x3b719f);}});});};exports[_0xe028('0x1b')]=function(_0x5cc7ca,_0x3d1041,_0x46bad8){var _0x5d77c4=_0x46bad8||stringOptions[_0xe028('0x8')];var _0x2d0a9a=_0x3d1041||stringOptions['secret'];var _0x7e73f9=crypto[_0xe028('0x10')](_0x5d77c4,_0x2d0a9a);var _0x1d74db=_0x7e73f9[_0xe028('0x12')](_0x5cc7ca,'utf8',_0xe028('0x1c'));_0x1d74db+=_0x7e73f9[_0xe028('0x15')](_0xe028('0x1c'));return _0x1d74db;};exports[_0xe028('0x1d')]=function(_0x3794c8,_0xe66d71,_0x168261){var _0x3c724b=_0x168261||stringOptions['algorithm'];var _0x25102b=_0xe66d71||stringOptions[_0xe028('0x1e')];var _0x552e4a=crypto[_0xe028('0x1a')](_0x3c724b,_0x25102b);var _0x3365d3=_0x552e4a[_0xe028('0x12')](_0x3794c8,_0xe028('0x1c'),'utf8');_0x3365d3+=_0x552e4a[_0xe028('0x15')]('utf8');return _0x3365d3;}; \ No newline at end of file +var _0xe526=['crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','test','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','binary','end','write','close','decryptFile','createDecipher','update','final','unlink','encryptString','secret','base64','decryptString'];(function(_0x341149,_0x37a599){var _0x47b889=function(_0x3c8412){while(--_0x3c8412){_0x341149['push'](_0x341149['shift']());}};_0x47b889(++_0x37a599);}(_0xe526,0x120));var _0x6e52=function(_0xff3259,_0x4dd832){_0xff3259=_0xff3259-0x0;var _0x3df525=_0xe526[_0xff3259];return _0x3df525;};'use strict';var crypto=require(_0x6e52('0x0'));var fs=require('fs');var BPromise=require(_0x6e52('0x1'));var _=require(_0x6e52('0x2'));var config=require(_0x6e52('0x3'));var logger=require(_0x6e52('0x4'))(_0x6e52('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x6e52('0x6')][_0x6e52('0x7')],'algorithm':_0x6e52('0x8')};const fileOptions={'algorithm':_0x6e52('0x9')};if(config['encrypt']&&config[_0x6e52('0xa')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x6e52('0xa')][_0x6e52('0xb')]);if(isSupported){fileOptions['algorithm']=config[_0x6e52('0xa')][_0x6e52('0xb')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x6e52('0xc')](',\x20');logger[_0x6e52('0xd')](config[_0x6e52('0xa')][_0x6e52('0xb')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x21bafc){return AES_SUPPORTED_RX[_0x6e52('0xe')](_0x21bafc);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x6e52('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x13ce0b){return getSupportedCiphers()[_0x6e52('0x10')](_0x13ce0b)>-0x1;}function combineOptions(_0x12c274){var _0x3b288e={};for(var _0x514442 in fileOptions){if(fileOptions['hasOwnProperty'](_0x514442)){_0x3b288e[_0x514442]=fileOptions[_0x514442];}}if(_0x12c274){for(var _0x58d338 in _0x12c274){if(_0x12c274[_0x6e52('0x11')](_0x58d338)){_0x3b288e[_0x58d338]=_0x12c274[_0x58d338];}}}return _0x3b288e;}exports[_0x6e52('0x12')]=function(_0x1cf510,_0x32532c,_0x55dc3a,_0xd28317){return new BPromise(function(_0x2d648c,_0x3d0409){_0xd28317=combineOptions(_0xd28317);var _0x194874=new Buffer(_0x55dc3a);var _0x5985a1=fs[_0x6e52('0x13')](_0x1cf510);var _0x1931f7=fs[_0x6e52('0x14')](_0x32532c);var _0x25c5d3=crypto[_0x6e52('0x15')](_0xd28317[_0x6e52('0xb')],_0x194874);_0x5985a1['on'](_0x6e52('0x16'),function(_0x12f44){var _0x18e85b=new Buffer(_0x25c5d3['update'](_0x12f44),_0x6e52('0x17'));_0x1931f7['write'](_0x18e85b);});_0x5985a1['on'](_0x6e52('0x18'),function(){try{var _0x167fae=new Buffer(_0x25c5d3['final'](_0x6e52('0x17')),'binary');_0x1931f7[_0x6e52('0x19')](_0x167fae);_0x1931f7['end']();_0x1931f7['on'](_0x6e52('0x1a'),function(){return _0x2d648c(_0x32532c);});}catch(_0x44732f){fs['unlink'](_0x32532c);return _0x3d0409(_0x44732f);}});});};exports[_0x6e52('0x1b')]=function(_0x3f1b81,_0x634ce4,_0x549f29,_0x7d2047){return new BPromise(function(_0x36ff3b,_0xc4f7c2){_0x7d2047=combineOptions(_0x7d2047);var _0x44e955=new Buffer(_0x549f29);var _0x5bfc93=fs['createReadStream'](_0x3f1b81);var _0x603450=fs['createWriteStream'](_0x634ce4);var _0x4882f7=crypto[_0x6e52('0x1c')](_0x7d2047[_0x6e52('0xb')],_0x44e955);_0x5bfc93['on'](_0x6e52('0x16'),function(_0xe9cc85){var _0x13a625=new Buffer(_0x4882f7[_0x6e52('0x1d')](_0xe9cc85),_0x6e52('0x17'));_0x603450[_0x6e52('0x19')](_0x13a625);});_0x5bfc93['on'](_0x6e52('0x18'),function(){try{var _0x3cc753=new Buffer(_0x4882f7[_0x6e52('0x1e')]('binary'),_0x6e52('0x17'));_0x603450[_0x6e52('0x19')](_0x3cc753);_0x603450[_0x6e52('0x18')]();_0x603450['on'](_0x6e52('0x1a'),function(){return _0x36ff3b(_0x634ce4);});}catch(_0x523bbc){fs[_0x6e52('0x1f')](_0x634ce4);return _0xc4f7c2(_0x523bbc);}});});};exports[_0x6e52('0x20')]=function(_0x2f680b,_0x2c7e02,_0xb95040){var _0x65d7fc=_0xb95040||stringOptions[_0x6e52('0xb')];var _0x48cf39=_0x2c7e02||stringOptions[_0x6e52('0x21')];var _0x42c3f3=crypto[_0x6e52('0x15')](_0x65d7fc,_0x48cf39);var _0x4fc2b4=_0x42c3f3['update'](_0x2f680b,'utf8',_0x6e52('0x22'));_0x4fc2b4+=_0x42c3f3[_0x6e52('0x1e')](_0x6e52('0x22'));return _0x4fc2b4;};exports[_0x6e52('0x23')]=function(_0x11fe9b,_0x3325d6,_0x2d1f83){var _0x69a118=_0x2d1f83||stringOptions['algorithm'];var _0x2c347a=_0x3325d6||stringOptions[_0x6e52('0x21')];var _0x4fadd9=crypto[_0x6e52('0x1c')](_0x69a118,_0x2c347a);var _0x40da73=_0x4fadd9['update'](_0x11fe9b,_0x6e52('0x22'),'utf8');_0x40da73+=_0x4fadd9[_0x6e52('0x1e')]('utf8');return _0x40da73;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 7c8ece0..2dbbd26 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 _0x25c1=['%s.%s','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash','to-csv','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','range','push','%s\x20limit\x20%d\x20OFFSET\x20%d','query','dirname','basename','length','mkdirSync','each','join','csv'];(function(_0x47d416,_0x473e8e){var _0x2e0e7c=function(_0x36232c){while(--_0x36232c){_0x47d416['push'](_0x47d416['shift']());}};_0x2e0e7c(++_0x473e8e);}(_0x25c1,0x11e));var _0x125c=function(_0x1d90cb,_0x1f2289){_0x1d90cb=_0x1d90cb-0x0;var _0x4424a7=_0x25c1[_0x1d90cb];return _0x4424a7;};'use strict';var util=require(_0x125c('0x0'));var path=require('path');var _=require(_0x125c('0x1'));var csv=require(_0x125c('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x125c('0x3'));var db=require(_0x125c('0x4'))['db'];var dbH=require(_0x125c('0x4'))[_0x125c('0x5')];var logger=require(_0x125c('0x6'))(_0x125c('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x125c('0x8')][0x2]);var QUERY=process[_0x125c('0x8')][0x3];var PATH=process[_0x125c('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1f9409,_0x554707){var _0x5a4d9e={'status':_0x1f9409};var _0x6afdaf={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x554707){_0x5a4d9e[_0x125c('0x9')]=_0x554707;}return db[_0x125c('0xa')]['update'](_0x5a4d9e,_0x6afdaf);}function main(){var _0x5c37c5=0x1388;var _0x5e4ea5;logger[_0x125c('0xb')](util['format'](_0x125c('0xc'),EXTRACTED_REPORT_ID,_0x125c('0xd')));return db[_0x125c('0xe')][_0x125c('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x125c('0x10'),'splitSizeCsv']})[_0x125c('0x11')](function(_0x3b2e82){if(_0x3b2e82){_0x5e4ea5=_0x3b2e82;_0x5c37c5=_0x5e4ea5['splitSizeCsv']||0x1388;}})[_0x125c('0x11')](function(){return dbH[_0x125c('0x12')]['query'](util[_0x125c('0x13')](_0x125c('0x14'),QUERY),{'type':dbH[_0x125c('0x12')][_0x125c('0x15')][_0x125c('0x16')]});})[_0x125c('0x11')](function(_0x4f08b1){if(!_0x4f08b1[0x0][_0x125c('0x17')]){return analyticExtractedReport(_0x125c('0x18'));}var _0x16b375=[];var _0x1ef011=0x0;if(_0x5e4ea5[_0x125c('0x10')]){if(_0x4f08b1&&_0x4f08b1['length']){var _0x43f866=_[_0x125c('0x19')](_0x4f08b1[0x0]['num']/_0x5c37c5);var _0x4f7114=Number['isInteger'](_0x4f08b1[0x0][_0x125c('0x17')]/_0x5c37c5)?_0x4f08b1[0x0][_0x125c('0x17')]%_0x5c37c5:0x0;_0x43f866['forEach'](function(_0x426b43){if(_0x426b43>0x0){_0x1ef011+=_0x5c37c5;}_0x16b375[_0x125c('0x1a')](dbH['sequelize']['query'](util[_0x125c('0x13')](_0x125c('0x1b'),QUERY,_0x5c37c5,_0x1ef011),{'type':dbH[_0x125c('0x12')][_0x125c('0x15')]['SELECT']}));});if(_0x4f7114>0x0){_0x1ef011+=_0x5c37c5;_0x16b375['push'](dbH[_0x125c('0x12')][_0x125c('0x1c')](util[_0x125c('0x13')](_0x125c('0x1b'),QUERY,_0x4f7114,_0x1ef011),{'type':dbH[_0x125c('0x12')][_0x125c('0x15')][_0x125c('0x16')]}));}}}else{_0x16b375[_0x125c('0x1a')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x125c('0x12')][_0x125c('0x15')][_0x125c('0x16')]}));}var _0xe411ee=path[_0x125c('0x1d')](PATH);var _0xb6323b=path[_0x125c('0x1e')](PATH,'.csv');var _0x212579=_0x5e4ea5[_0x125c('0x10')]&&_0x16b375[_0x125c('0x1f')]>0x1;var _0x4245bf=[];if(!fs['existsSync'](path['join'](_0xe411ee,_0xb6323b))&&_0x212579){fs[_0x125c('0x20')](path['join'](_0xe411ee,_0xb6323b));}return BPromise[_0x125c('0x21')](_0x16b375,function(_0x184a74){_0x4245bf['push'](_0x184a74);})['then'](function(){for(var _0x396266=0x0;_0x396266<_0x4245bf['length'];_0x396266+=0x1){var _0x5b98ef;var _0x48b1b0=_0x4245bf[_0x396266];if(_0x212579){_0x5b98ef=path[_0x125c('0x22')](_0xe411ee,_0xb6323b,util[_0x125c('0x13')]('%s%d.%s',_0xb6323b,_0x396266,_0x125c('0x23')));}else{_0x5b98ef=path[_0x125c('0x22')](_0xe411ee,util[_0x125c('0x13')](_0x125c('0x24'),_0xb6323b,_0x125c('0x23')));}fs[_0x125c('0x25')](_0x5b98ef,csv(_0x48b1b0));}})[_0x125c('0x11')](function(){if(_0x212579){return new Promise(function(_0x4ecb97){zipdir(path[_0x125c('0x22')](_0xe411ee,_0xb6323b),{'saveTo':path[_0x125c('0x22')](_0xe411ee,util[_0x125c('0x13')](_0x125c('0x24'),_0xb6323b,'zip'))},function(_0x4723d1,_0x53b131){rimraf(path['join'](_0xe411ee,_0xb6323b),function(){});_0x4ecb97(_0x125c('0x26'));});});}})[_0x125c('0x11')](function(){logger[_0x125c('0xb')](util['format'](_0x125c('0x27'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x212579?util[_0x125c('0x13')](_0x125c('0x24'),_0xb6323b,_0x212579?_0x125c('0x28'):_0x125c('0x23')):null);});})['catch'](function(_0x18aa0){logger['info'](util[_0x125c('0x13')](_0x125c('0x29'),EXTRACTED_REPORT_ID,_0x125c('0xd')),util[_0x125c('0x2a')](_0x18aa0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x125c('0x2b'));})[_0x125c('0x2c')](function(){process[_0x125c('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x2790=['exit','util','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','split','then','splitSizeCsv','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Empty','length','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','inspect','Failed'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2790,0x179));var _0x0279=function(_0x335a62,_0xfafea4){_0x335a62=_0x335a62-0x0;var _0x249a9a=_0x2790[_0x335a62];return _0x249a9a;};'use strict';var util=require(_0x0279('0x0'));var path=require('path');var _=require(_0x0279('0x1'));var csv=require(_0x0279('0x2'));var fs=require('fs');var BPromise=require(_0x0279('0x3'));var zipdir=require(_0x0279('0x4'));var rimraf=require(_0x0279('0x5'));var db=require(_0x0279('0x6'))['db'];var dbH=require(_0x0279('0x6'))[_0x0279('0x7')];var logger=require(_0x0279('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x0279('0x9')][0x2]);var QUERY=process[_0x0279('0x9')][0x3];var PATH=process[_0x0279('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x362a78,_0x3cf2d7){var _0x38c01a={'status':_0x362a78};var _0x3147dd={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3cf2d7){_0x38c01a['savename']=_0x3cf2d7;}return db['AnalyticExtractedReport'][_0x0279('0xa')](_0x38c01a,_0x3147dd);}function main(){var _0x3a5b94=0x1388;var _0x383731;logger[_0x0279('0xb')](util['format'](_0x0279('0xc'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0279('0xd'),'splitSizeCsv']})[_0x0279('0xe')](function(_0x13b690){if(_0x13b690){_0x383731=_0x13b690;_0x3a5b94=_0x383731[_0x0279('0xf')]||0x1388;}})[_0x0279('0xe')](function(){return dbH[_0x0279('0x10')][_0x0279('0x11')](util[_0x0279('0x12')](_0x0279('0x13'),QUERY),{'type':dbH[_0x0279('0x10')]['QueryTypes'][_0x0279('0x14')]});})[_0x0279('0xe')](function(_0x2d1a9a){if(!_0x2d1a9a[0x0]['num']){return analyticExtractedReport(_0x0279('0x15'));}var _0x3e743c=[];var _0x33f67f=0x0;if(_0x383731[_0x0279('0xd')]){if(_0x2d1a9a&&_0x2d1a9a[_0x0279('0x16')]){var _0x44a2de=_[_0x0279('0x17')](_0x2d1a9a[0x0][_0x0279('0x18')]/_0x3a5b94);var _0x588ca7=Number[_0x0279('0x19')](_0x2d1a9a[0x0][_0x0279('0x18')]/_0x3a5b94)?_0x2d1a9a[0x0][_0x0279('0x18')]%_0x3a5b94:0x0;_0x44a2de[_0x0279('0x1a')](function(_0x3595a6){if(_0x3595a6>0x0){_0x33f67f+=_0x3a5b94;}_0x3e743c[_0x0279('0x1b')](dbH[_0x0279('0x10')][_0x0279('0x11')](util[_0x0279('0x12')](_0x0279('0x1c'),QUERY,_0x3a5b94,_0x33f67f),{'type':dbH[_0x0279('0x10')][_0x0279('0x1d')]['SELECT']}));});if(_0x588ca7>0x0){_0x33f67f+=_0x3a5b94;_0x3e743c['push'](dbH[_0x0279('0x10')][_0x0279('0x11')](util[_0x0279('0x12')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x588ca7,_0x33f67f),{'type':dbH[_0x0279('0x10')][_0x0279('0x1d')][_0x0279('0x14')]}));}}}else{_0x3e743c['push'](dbH[_0x0279('0x10')][_0x0279('0x11')](QUERY,{'type':dbH[_0x0279('0x10')]['QueryTypes']['SELECT']}));}var _0x36f93f=path[_0x0279('0x1e')](PATH);var _0x311976=path[_0x0279('0x1f')](PATH,_0x0279('0x20'));var _0x3f5e09=_0x383731[_0x0279('0xd')]&&_0x3e743c[_0x0279('0x16')]>0x1;var _0x5da5f0=[];if(!fs[_0x0279('0x21')](path['join'](_0x36f93f,_0x311976))&&_0x3f5e09){fs['mkdirSync'](path[_0x0279('0x22')](_0x36f93f,_0x311976));}return BPromise[_0x0279('0x23')](_0x3e743c,function(_0x465809){_0x5da5f0['push'](_0x465809);})[_0x0279('0xe')](function(){for(var _0x41101c=0x0;_0x41101c<_0x5da5f0[_0x0279('0x16')];_0x41101c+=0x1){var _0x4c50a0;var _0x28ee26=_0x5da5f0[_0x41101c];if(_0x3f5e09){_0x4c50a0=path[_0x0279('0x22')](_0x36f93f,_0x311976,util[_0x0279('0x12')](_0x0279('0x24'),_0x311976,_0x41101c,_0x0279('0x25')));}else{_0x4c50a0=path[_0x0279('0x22')](_0x36f93f,util['format'](_0x0279('0x26'),_0x311976,'csv'));}fs[_0x0279('0x27')](_0x4c50a0,csv(_0x28ee26));}})[_0x0279('0xe')](function(){if(_0x3f5e09){return new Promise(function(_0x4311ff){zipdir(path[_0x0279('0x22')](_0x36f93f,_0x311976),{'saveTo':path[_0x0279('0x22')](_0x36f93f,util[_0x0279('0x12')](_0x0279('0x26'),_0x311976,'zip'))},function(_0x303bfc,_0x4c3a34){rimraf(path[_0x0279('0x22')](_0x36f93f,_0x311976),function(){});_0x4311ff(_0x0279('0x28'));});});}})['then'](function(){logger['info'](util[_0x0279('0x12')](_0x0279('0x29'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x0279('0x2a'),_0x3f5e09?util[_0x0279('0x12')](_0x0279('0x26'),_0x311976,_0x3f5e09?_0x0279('0x2b'):_0x0279('0x25')):null);});})['catch'](function(_0x2a1f22){logger[_0x0279('0xb')](util[_0x0279('0x12')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util[_0x0279('0x2c')](_0x2a1f22,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0279('0x2d'));})['finally'](function(){process[_0x0279('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 6495aa2..e0588fb 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 _0x0003=['zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','pipe','finish','error','end','lodash','util','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','tableHeader','pick','map','toString','fill','length','body','push','chunk','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','format','header','before','margin','\x20/\x20','footer','Arial','right','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','basename','.pdf','existsSync','createPdfKitDocument','join','%s%d.%s','pdf','%s.%s'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0003,0x1c5));var _0x3000=function(_0x2f330c,_0x2209f8){_0x2f330c=_0x2f330c-0x0;var _0x51f4dd=_0x0003[_0x2f330c];return _0x51f4dd;};'use strict';var _=require(_0x3000('0x0'));var fs=require('fs');var util=require(_0x3000('0x1'));var path=require(_0x3000('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0x3000('0x3'));var PdfPrinter=require(_0x3000('0x4'));var zipdir=require(_0x3000('0x5'));var rimraf=require(_0x3000('0x6'));var JSDOM=require(_0x3000('0x7'))[_0x3000('0x8')];var window=new JSDOM('')['window'];var BPromise=require(_0x3000('0x9'));var db=require(_0x3000('0xa'))['db'];var dbH=require(_0x3000('0xa'))[_0x3000('0xb')];var logger=require(_0x3000('0xc'))(_0x3000('0xd'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x3000('0xe')][0x3];var PATH=process[_0x3000('0xe')][0x4];var NAME=process[_0x3000('0xe')][0x5];var FORMAT=_0x3000('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5f1a41,_0x555763){var _0x371c8e={'status':_0x5f1a41};var _0xbf2a13={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x555763){_0x371c8e[_0x3000('0x10')]=_0x555763;}return db[_0x3000('0x11')][_0x3000('0x12')](_0x371c8e,_0xbf2a13);}function getHeaders(_0x12954b){return _['map'](_0x12954b,function(_0x2e3723){return{'text':_0x2e3723,'style':_0x3000('0x13')};});}function getRows(_0x2a9ccf,_0x5007e9){return _['map'](_0x5007e9,function(_0x31793a){return _(_0x31793a)[_0x3000('0x14')](_0x2a9ccf)[_0x3000('0x15')](function(_0x17cca4){return _0x17cca4?_[_0x3000('0x16')](_0x17cca4):'';})['value']();});}function createTable(_0x2bed11,_0x199188){var _0x3daa3c={'widths':_[_0x3000('0x17')](Array(_0x2bed11[_0x3000('0x18')]),0x91),'heights':function(_0x425735){return _0x425735===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5df26d=getHeaders(_0x2bed11);_0x3daa3c[_0x3000('0x19')][_0x3000('0x1a')](_0x5df26d);var _0x2d01ab=getRows(_0x2bed11,_0x199188);_0x3daa3c[_0x3000('0x19')]=_0x3daa3c[_0x3000('0x19')]['concat'](_0x2d01ab);return _0x3daa3c;}function createTables(_0x45b94c){var _0x5daa6e=[];var _0x24efca=_[_0x3000('0x1b')](Object['keys'](_0x45b94c[0x0]),0x5);_0x24efca[_0x3000('0x1c')](function(_0x3deaa2){_0x5daa6e['push'](createTable(_0x3deaa2,_0x45b94c));});return _0x5daa6e;}function getPDFDocDefinition(_0x427fa7){var _0x452501=util['format'](_0x3000('0x1d'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x3000('0x1e')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x3000('0x1f')])[_0x3000('0x20')](FORMAT));var _0x471955=[];for(var _0x4e8574=0x0;_0x4e8574<_0x427fa7['length'];_0x4e8574++){var _0x11d112=[];if(_0x4e8574===0x0){_0x11d112[_0x3000('0x1a')]({'text':_0x452501,'style':_0x3000('0x21')});}var _0x108bbf={'table':_0x427fa7[_0x4e8574]};if(_0x4e8574>0x0){_0x108bbf['pageBreak']=_0x3000('0x22');_0x108bbf[_0x3000('0x23')]=[0x0,0x46,0x0,0x0];}_0x11d112[_0x3000('0x1a')](_0x108bbf);_0x471955[_0x3000('0x1a')](_0x11d112);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x471955,'footer':function(_0x585900,_0x343b84){return{'text':_0x585900['toString']()+_0x3000('0x24')+_0x343b84,'style':_0x3000('0x25')};},'defaultStyle':{'font':_0x3000('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x3000('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x42f934){var _0x4806a5=0x1388;var _0x2d379f;if(!_0x42f934[0x0][_0x3000('0x28')]){return analyticExtractedReport(_0x3000('0x29'));}return db[_0x3000('0x2a')][_0x3000('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3000('0x2c'),_0x3000('0x2d')]})['then'](function(_0xb15841){if(_0xb15841){_0x2d379f=_0xb15841;_0x4806a5=_0x2d379f['splitSizePdf']||0x3e8;}})[_0x3000('0x2e')](function(){var _0x57bac8=[];var _0x56e218=0x0;if(_0x2d379f[_0x3000('0x2c')]){if(_0x42f934&&_0x42f934['length']){var _0xd19468=_[_0x3000('0x2f')](_0x42f934[0x0][_0x3000('0x28')]/_0x4806a5);var _0x165b75=Number[_0x3000('0x30')](_0x42f934[0x0]['num']/_0x4806a5)?_0x42f934[0x0][_0x3000('0x28')]%_0x4806a5:0x0;_0xd19468[_0x3000('0x1c')](function(_0xa772c4){if(_0xa772c4>0x0){_0x56e218+=_0x4806a5;}_0x57bac8['push'](dbH[_0x3000('0x31')][_0x3000('0x32')](util[_0x3000('0x20')](_0x3000('0x33'),QUERY,_0x4806a5,_0x56e218),{'type':dbH['sequelize']['QueryTypes'][_0x3000('0x34')]}));});if(_0x165b75>0x0){_0x56e218+=_0x4806a5;_0x57bac8['push'](dbH[_0x3000('0x31')][_0x3000('0x32')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x165b75,_0x56e218),{'type':dbH[_0x3000('0x31')]['QueryTypes'][_0x3000('0x34')]}));}}}else{_0x57bac8[_0x3000('0x1a')](dbH[_0x3000('0x31')][_0x3000('0x32')](QUERY,{'type':dbH[_0x3000('0x31')][_0x3000('0x35')][_0x3000('0x34')]}));}var _0x597b4e=path[_0x3000('0x36')](PATH);var _0x325118=path[_0x3000('0x37')](PATH,_0x3000('0x38'));var _0x3dbf97=_0x2d379f[_0x3000('0x2c')]&&_0x57bac8['length']>0x1;var _0x29cc24=[];if(!fs[_0x3000('0x39')](path['join'](_0x597b4e,_0x325118))&&_0x3dbf97){fs['mkdirSync'](path['join'](_0x597b4e,_0x325118));}return BPromise['each'](_0x57bac8,function(_0x9e62ce){_0x29cc24[_0x3000('0x1a')](_0x9e62ce);})[_0x3000('0x2e')](function(){var _0x420097=[];for(var _0x5cfd61=0x0;_0x5cfd61<_0x29cc24[_0x3000('0x18')];_0x5cfd61+=0x1){var _0x3f746a=_0x29cc24[_0x5cfd61];var _0x3fa23e=createTables(_['flatten'](_0x3f746a));var _0x3e51f3;var _0x556d66=getPDFDocDefinition(_0x3fa23e);var _0x2aee92=getPDFPrinter();var _0x203529=_0x2aee92[_0x3000('0x3a')](_0x556d66);if(_0x3dbf97){_0x3e51f3=path[_0x3000('0x3b')](_0x597b4e,_0x325118,util[_0x3000('0x20')](_0x3000('0x3c'),_0x325118,_0x5cfd61,_0x3000('0x3d')));}else{_0x3e51f3=path[_0x3000('0x3b')](_0x597b4e,util[_0x3000('0x20')](_0x3000('0x3e'),_0x325118,_0x3000('0x3d')));}_0x420097[_0x3000('0x1a')](writePDFDocument(_0x203529,_0x3e51f3));}return Promise['all'](_0x420097);})[_0x3000('0x2e')](function(){if(_0x3dbf97){return new Promise(function(_0x471a0a){zipdir(path[_0x3000('0x3b')](_0x597b4e,_0x325118),{'saveTo':path['join'](_0x597b4e,util[_0x3000('0x20')]('%s.%s',_0x325118,_0x3000('0x3f')))},function(){rimraf(path[_0x3000('0x3b')](_0x597b4e,_0x325118),function(){});_0x471a0a(_0x3000('0x40'));});});}})[_0x3000('0x2e')](function(){if(!_0x3dbf97)return;rimraf(path[_0x3000('0x3b')](_0x597b4e,_0x325118),function(){});})[_0x3000('0x2e')](function(){logger[_0x3000('0x41')](util[_0x3000('0x20')](_0x3000('0x42'),EXTRACTED_REPORT_ID,_0x3000('0x43')));return analyticExtractedReport(_0x3000('0x44'),_0x3dbf97?util[_0x3000('0x20')](_0x3000('0x3e'),_0x325118,_0x3dbf97?'zip':_0x3000('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x3000('0x41')](util[_0x3000('0x20')](_0x3000('0x45'),EXTRACTED_REPORT_ID,_0x3000('0x43')));return db[_0x3000('0x11')][_0x3000('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x180e7c){EXTRACTED_REPORT=_0x180e7c;return dbH['sequelize'][_0x3000('0x32')](util[_0x3000('0x20')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x3000('0x35')][_0x3000('0x34')]});})[_0x3000('0x2e')](extractReport)[_0x3000('0x47')](function(_0x15fe58){logger[_0x3000('0x41')](util[_0x3000('0x20')](_0x3000('0x48'),EXTRACTED_REPORT_ID,_0x3000('0x43')),util['inspect'](_0x15fe58,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x3000('0x49')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1a7350=new PdfPrinter({'Arial':{'normal':__dirname+_0x3000('0x4a'),'bold':__dirname+_0x3000('0x4b'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x3000('0x4c')}});return _0x1a7350;}function getPDFDocDefinitionFromHTML(_0x4e697a,_0x136e59){var _0x1f6028=util[_0x3000('0x20')]('%s\x20#%d',_0x136e59[_0x3000('0x4d')],_0x136e59[_0x3000('0x4e')]);var _0x3ddc38=moment()[_0x3000('0x20')](_0x3000('0x4f'))['toString']();var _0x5e65e6=htmlToPdfmake(_0x4e697a,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5e65e6],'defaultStyle':{'font':_0x3000('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x3000('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x3000('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x3000('0x50')}},'header':function(){return[{'text':_0x3000('0x51'),'style':_0x3000('0x21')}];},'footer':function(_0x499f9c,_0x24ccdb){return[{'text':util[_0x3000('0x20')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x1f6028,_0x499f9c,_0x24ccdb,_0x3ddc38),'style':_0x3000('0x25')}];}};}function writePDFDocument(_0x180d02,_0x4041d8){return new Promise(function(_0x4285ed,_0x42eb1a){var _0x4c8f0a=_0x180d02[_0x3000('0x52')](fs['createWriteStream'](_0x4041d8));_0x4c8f0a['on'](_0x3000('0x53'),function(){_0x4285ed('finish');});_0x4c8f0a['on'](_0x3000('0x54'),function(_0x57085b){_0x42eb1a(_0x57085b);});_0x180d02[_0x3000('0x55')]();});}exports['createPdfFromHTML']=function(_0x4caf6a,_0x4f4791){var _0xac4d1a=getPDFPrinter();var _0x2363e3=getPDFDocDefinitionFromHTML(_0x4caf6a,_0x4f4791);var _0x299ae6=_0xac4d1a[_0x3000('0x3a')](_0x2363e3);return writePDFDocument(_0x299ae6,_0x4f4791['path'])[_0x3000('0x47')](function(_0x4ae4db){throw _0x4ae4db;});}; \ No newline at end of file +var _0xd21d=['PDF','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','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','footer','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','rimraf','jsdom','JSDOM','window','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','length','body','push','concat','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','header','pageBreak','before','margin','\x20/\x20','Arial','black','right','num','Empty','Setting','find','split','then','splitSizePdf','range','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','query','SELECT','dirname','.pdf','existsSync','mkdirSync','join','each','flatten','createPdfKitDocument','%s%d.%s','%s.%s','pdf','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed'];(function(_0x26af37,_0x5cdcb9){var _0x45799c=function(_0x30fc2a){while(--_0x30fc2a){_0x26af37['push'](_0x26af37['shift']());}};_0x45799c(++_0x5cdcb9);}(_0xd21d,0xde));var _0xdd21=function(_0x14d233,_0x4289f7){_0x14d233=_0x14d233-0x0;var _0x2d4c76=_0xd21d[_0x14d233];return _0x2d4c76;};'use strict';var _=require(_0xdd21('0x0'));var fs=require('fs');var util=require(_0xdd21('0x1'));var path=require(_0xdd21('0x2'));var moment=require(_0xdd21('0x3'));var htmlToPdfmake=require(_0xdd21('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require(_0xdd21('0x5'));var JSDOM=require(_0xdd21('0x6'))[_0xdd21('0x7')];var window=new JSDOM('')[_0xdd21('0x8')];var BPromise=require('bluebird');var db=require(_0xdd21('0x9'))['db'];var dbH=require(_0xdd21('0x9'))['dbH'];var logger=require(_0xdd21('0xa'))(_0xdd21('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0xdd21('0xc')][0x2]);var QUERY=process[_0xdd21('0xc')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xdd21('0xc')][0x5];var FORMAT=_0xdd21('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x545e79,_0x20c276){var _0x1b6035={'status':_0x545e79};var _0x27a8bc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x20c276){_0x1b6035[_0xdd21('0xe')]=_0x20c276;}return db[_0xdd21('0xf')][_0xdd21('0x10')](_0x1b6035,_0x27a8bc);}function getHeaders(_0x42bdac){return _[_0xdd21('0x11')](_0x42bdac,function(_0xc7a76f){return{'text':_0xc7a76f,'style':_0xdd21('0x12')};});}function getRows(_0x31670e,_0x4b9b10){return _[_0xdd21('0x11')](_0x4b9b10,function(_0x559a07){return _(_0x559a07)[_0xdd21('0x13')](_0x31670e)[_0xdd21('0x11')](function(_0x1e7a45){return _0x1e7a45?_[_0xdd21('0x14')](_0x1e7a45):'';})[_0xdd21('0x15')]();});}function createTable(_0x41c76c,_0x405bba){var _0x1e0914={'widths':_[_0xdd21('0x16')](Array(_0x41c76c[_0xdd21('0x17')]),0x91),'heights':function(_0x46de79){return _0x46de79===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x34f92d=getHeaders(_0x41c76c);_0x1e0914[_0xdd21('0x18')][_0xdd21('0x19')](_0x34f92d);var _0x4022b7=getRows(_0x41c76c,_0x405bba);_0x1e0914[_0xdd21('0x18')]=_0x1e0914[_0xdd21('0x18')][_0xdd21('0x1a')](_0x4022b7);return _0x1e0914;}function createTables(_0x38b62a){var _0x52f5f3=[];var _0x7a8305=_['chunk'](Object[_0xdd21('0x1b')](_0x38b62a[0x0]),0x5);_0x7a8305[_0xdd21('0x1c')](function(_0x148eda){_0x52f5f3[_0xdd21('0x19')](createTable(_0x148eda,_0x38b62a));});return _0x52f5f3;}function getPDFDocDefinition(_0x2bb30a){var _0x24ec96=util['format'](_0xdd21('0x1d'),NAME,EXTRACTED_REPORT[_0xdd21('0x1e')],moment(EXTRACTED_REPORT[_0xdd21('0x1f')])[_0xdd21('0x20')](FORMAT),moment(EXTRACTED_REPORT[_0xdd21('0x21')])[_0xdd21('0x20')](FORMAT));var _0x29fcfe=[];for(var _0x495a74=0x0;_0x495a74<_0x2bb30a[_0xdd21('0x17')];_0x495a74++){var _0x34ed21=[];if(_0x495a74===0x0){_0x34ed21[_0xdd21('0x19')]({'text':_0x24ec96,'style':_0xdd21('0x22')});}var _0x12a724={'table':_0x2bb30a[_0x495a74]};if(_0x495a74>0x0){_0x12a724[_0xdd21('0x23')]=_0xdd21('0x24');_0x12a724[_0xdd21('0x25')]=[0x0,0x46,0x0,0x0];}_0x34ed21[_0xdd21('0x19')](_0x12a724);_0x29fcfe['push'](_0x34ed21);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x29fcfe,'footer':function(_0x4693b3,_0x1b46b1){return{'text':_0x4693b3[_0xdd21('0x14')]()+_0xdd21('0x26')+_0x1b46b1,'style':'footer'};},'defaultStyle':{'font':_0xdd21('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xdd21('0x28')},'footer':{'alignment':_0xdd21('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x224d4a){var _0x552f26=0x1388;var _0x3b92e5;if(!_0x224d4a[0x0][_0xdd21('0x2a')]){return analyticExtractedReport(_0xdd21('0x2b'));}return db[_0xdd21('0x2c')][_0xdd21('0x2d')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xdd21('0x2e'),'splitSizePdf']})[_0xdd21('0x2f')](function(_0x3d9494){if(_0x3d9494){_0x3b92e5=_0x3d9494;_0x552f26=_0x3b92e5[_0xdd21('0x30')]||0x3e8;}})[_0xdd21('0x2f')](function(){var _0x1575e7=[];var _0x320946=0x0;if(_0x3b92e5[_0xdd21('0x2e')]){if(_0x224d4a&&_0x224d4a[_0xdd21('0x17')]){var _0x157d0f=_[_0xdd21('0x31')](_0x224d4a[0x0][_0xdd21('0x2a')]/_0x552f26);var _0x384683=Number['isInteger'](_0x224d4a[0x0][_0xdd21('0x2a')]/_0x552f26)?_0x224d4a[0x0][_0xdd21('0x2a')]%_0x552f26:0x0;_0x157d0f[_0xdd21('0x1c')](function(_0x374e63){if(_0x374e63>0x0){_0x320946+=_0x552f26;}_0x1575e7[_0xdd21('0x19')](dbH[_0xdd21('0x32')]['query'](util[_0xdd21('0x20')](_0xdd21('0x33'),QUERY,_0x552f26,_0x320946),{'type':dbH['sequelize'][_0xdd21('0x34')]['SELECT']}));});if(_0x384683>0x0){_0x320946+=_0x552f26;_0x1575e7[_0xdd21('0x19')](dbH[_0xdd21('0x32')][_0xdd21('0x35')](util['format'](_0xdd21('0x33'),QUERY,_0x384683,_0x320946),{'type':dbH[_0xdd21('0x32')]['QueryTypes'][_0xdd21('0x36')]}));}}}else{_0x1575e7['push'](dbH[_0xdd21('0x32')][_0xdd21('0x35')](QUERY,{'type':dbH[_0xdd21('0x32')][_0xdd21('0x34')][_0xdd21('0x36')]}));}var _0x398fcc=path[_0xdd21('0x37')](PATH);var _0x2c6f57=path['basename'](PATH,_0xdd21('0x38'));var _0x5646c0=_0x3b92e5[_0xdd21('0x2e')]&&_0x1575e7[_0xdd21('0x17')]>0x1;var _0x55ba3d=[];if(!fs[_0xdd21('0x39')](path['join'](_0x398fcc,_0x2c6f57))&&_0x5646c0){fs[_0xdd21('0x3a')](path[_0xdd21('0x3b')](_0x398fcc,_0x2c6f57));}return BPromise[_0xdd21('0x3c')](_0x1575e7,function(_0x22873d){_0x55ba3d['push'](_0x22873d);})[_0xdd21('0x2f')](function(){var _0x999ec8=[];for(var _0x39e824=0x0;_0x39e824<_0x55ba3d[_0xdd21('0x17')];_0x39e824+=0x1){var _0x2cfc04=_0x55ba3d[_0x39e824];var _0x2c09f8=createTables(_[_0xdd21('0x3d')](_0x2cfc04));var _0x15cec1;var _0x3b4171=getPDFDocDefinition(_0x2c09f8);var _0x11ba75=getPDFPrinter();var _0x85d39d=_0x11ba75[_0xdd21('0x3e')](_0x3b4171);if(_0x5646c0){_0x15cec1=path[_0xdd21('0x3b')](_0x398fcc,_0x2c6f57,util[_0xdd21('0x20')](_0xdd21('0x3f'),_0x2c6f57,_0x39e824,'pdf'));}else{_0x15cec1=path[_0xdd21('0x3b')](_0x398fcc,util[_0xdd21('0x20')](_0xdd21('0x40'),_0x2c6f57,_0xdd21('0x41')));}_0x999ec8[_0xdd21('0x19')](writePDFDocument(_0x85d39d,_0x15cec1));}return Promise['all'](_0x999ec8);})[_0xdd21('0x2f')](function(){if(_0x5646c0){return new Promise(function(_0xb3788){zipdir(path[_0xdd21('0x3b')](_0x398fcc,_0x2c6f57),{'saveTo':path[_0xdd21('0x3b')](_0x398fcc,util[_0xdd21('0x20')](_0xdd21('0x40'),_0x2c6f57,_0xdd21('0x42')))},function(){rimraf(path[_0xdd21('0x3b')](_0x398fcc,_0x2c6f57),function(){});_0xb3788(_0xdd21('0x43'));});});}})[_0xdd21('0x2f')](function(){if(!_0x5646c0)return;rimraf(path['join'](_0x398fcc,_0x2c6f57),function(){});})[_0xdd21('0x2f')](function(){logger['info'](util['format'](_0xdd21('0x44'),EXTRACTED_REPORT_ID,_0xdd21('0x45')));return analyticExtractedReport(_0xdd21('0x46'),_0x5646c0?util[_0xdd21('0x20')](_0xdd21('0x40'),_0x2c6f57,_0x5646c0?'zip':_0xdd21('0x41')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xdd21('0x47')](util[_0xdd21('0x20')](_0xdd21('0x48'),EXTRACTED_REPORT_ID,'PDF'));return db[_0xdd21('0xf')][_0xdd21('0x49')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xdd21('0x2f')](function(_0x51d9c3){EXTRACTED_REPORT=_0x51d9c3;return dbH[_0xdd21('0x32')][_0xdd21('0x35')](util[_0xdd21('0x20')](_0xdd21('0x4a'),QUERY),{'type':dbH[_0xdd21('0x32')][_0xdd21('0x34')][_0xdd21('0x36')]});})[_0xdd21('0x2f')](extractReport)[_0xdd21('0x4b')](function(_0xa7b0cf){logger['info'](util[_0xdd21('0x20')](_0xdd21('0x4c'),EXTRACTED_REPORT_ID,_0xdd21('0x45')),util['inspect'](_0xa7b0cf,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xdd21('0x4d'));})[_0xdd21('0x4e')](function(){process[_0xdd21('0x4f')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x17973e=new PdfPrinter({'Arial':{'normal':__dirname+_0xdd21('0x50'),'bold':__dirname+_0xdd21('0x51'),'italics':__dirname+_0xdd21('0x52'),'bolditalics':__dirname+_0xdd21('0x53')}});return _0x17973e;}function getPDFDocDefinitionFromHTML(_0x179345,_0x32061e){var _0x2d4a16=util[_0xdd21('0x20')](_0xdd21('0x54'),_0x32061e[_0xdd21('0x55')],_0x32061e[_0xdd21('0x56')]);var _0x3847e8=moment()['format'](_0xdd21('0x57'))['toString']();var _0x1da347=htmlToPdfmake(_0x179345,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1da347],'defaultStyle':{'font':_0xdd21('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xdd21('0x58'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xdd21('0x58'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xdd21('0x58')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xdd21('0x22')}];},'footer':function(_0x475111,_0x536241){return[{'text':util[_0xdd21('0x20')](_0xdd21('0x59'),_0x2d4a16,_0x475111,_0x536241,_0x3847e8),'style':_0xdd21('0x5a')}];}};}function writePDFDocument(_0x261611,_0x6cc08e){return new Promise(function(_0x4d2a51,_0x59d0d8){var _0x157ede=_0x261611[_0xdd21('0x5b')](fs[_0xdd21('0x5c')](_0x6cc08e));_0x157ede['on'](_0xdd21('0x5d'),function(){_0x4d2a51(_0xdd21('0x5d'));});_0x157ede['on'](_0xdd21('0x5e'),function(_0x136eae){_0x59d0d8(_0x136eae);});_0x261611[_0xdd21('0x5f')]();});}exports[_0xdd21('0x60')]=function(_0x2f155a,_0x25b68c){var _0x126bf2=getPDFPrinter();var _0x1fde0a=getPDFDocDefinitionFromHTML(_0x2f155a,_0x25b68c);var _0x654f8d=_0x126bf2['createPdfKitDocument'](_0x1fde0a);return writePDFDocument(_0x654f8d,_0x25b68c[_0xdd21('0x2')])[_0xdd21('0x4b')](function(_0x248b5){throw _0x248b5;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 8dd5d2d..7284edf 100644 --- a/server/components/export/xlsx.js +++ b/server/components/export/xlsx.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd674=['SELECT','num','length','range','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','join','each','xlsx','%s.%s','binary','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','then','splitSizeXlsx','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes'];(function(_0x55882b,_0x3f5979){var _0x46e0e0=function(_0x3db356){while(--_0x3db356){_0x55882b['push'](_0x55882b['shift']());}};_0x46e0e0(++_0x3f5979);}(_0xd674,0xb9));var _0x4d67=function(_0x25e973,_0x41bfaf){_0x25e973=_0x25e973-0x0;var _0x300a98=_0xd674[_0x25e973];return _0x300a98;};'use strict';var util=require(_0x4d67('0x0'));var path=require(_0x4d67('0x1'));var _=require(_0x4d67('0x2'));var fs=require('fs');var json2xls=require(_0x4d67('0x3'));var BPromise=require(_0x4d67('0x4'));var zipdir=require(_0x4d67('0x5'));var rimraf=require(_0x4d67('0x6'));var db=require(_0x4d67('0x7'))['db'];var dbH=require(_0x4d67('0x7'))[_0x4d67('0x8')];var logger=require(_0x4d67('0x9'))(_0x4d67('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x4d67('0xb')][0x2]);var QUERY=process[_0x4d67('0xb')][0x3];var PATH=process[_0x4d67('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5cc1d0,_0x484baa){var _0x4a21b6={'status':_0x5cc1d0};var _0x9ccd71={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x484baa){_0x4a21b6[_0x4d67('0xc')]=_0x484baa;}return db[_0x4d67('0xd')][_0x4d67('0xe')](_0x4a21b6,_0x9ccd71);}function main(){var _0x15f9b8=0x1388;var _0xf77a04;logger[_0x4d67('0xf')](util['format'](_0x4d67('0x10'),EXTRACTED_REPORT_ID,_0x4d67('0x11')));return db[_0x4d67('0x12')][_0x4d67('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4d67('0x14'),'splitSizeXlsx']})[_0x4d67('0x15')](function(_0x41bf2a){if(_0x41bf2a){_0xf77a04=_0x41bf2a;_0x15f9b8=_0xf77a04[_0x4d67('0x16')]||0x1388;}})['then'](function(){return dbH[_0x4d67('0x17')]['query'](util[_0x4d67('0x18')](_0x4d67('0x19'),QUERY),{'type':dbH[_0x4d67('0x17')][_0x4d67('0x1a')][_0x4d67('0x1b')]});})['then'](function(_0xcabb9b){if(!_0xcabb9b[0x0][_0x4d67('0x1c')]){return analyticExtractedReport('Empty');}var _0x35f177=[];var _0x1deca8=0x0;if(_0xf77a04[_0x4d67('0x14')]){if(_0xcabb9b&&_0xcabb9b[_0x4d67('0x1d')]){var _0x1be977=_[_0x4d67('0x1e')](_0xcabb9b[0x0][_0x4d67('0x1c')]/_0x15f9b8);var _0x2369a0=Number[_0x4d67('0x1f')](_0xcabb9b[0x0]['num']/_0x15f9b8)?_0xcabb9b[0x0]['num']%_0x15f9b8:0x0;_0x1be977[_0x4d67('0x20')](function(_0x400de1){if(_0x400de1>0x0){_0x1deca8+=_0x15f9b8;}_0x35f177['push'](dbH[_0x4d67('0x17')][_0x4d67('0x21')](util[_0x4d67('0x18')](_0x4d67('0x22'),QUERY,_0x15f9b8,_0x1deca8),{'type':dbH[_0x4d67('0x17')]['QueryTypes'][_0x4d67('0x1b')]}));});if(_0x2369a0>0x0){_0x1deca8+=_0x15f9b8;_0x35f177[_0x4d67('0x23')](dbH[_0x4d67('0x17')][_0x4d67('0x21')](util['format'](_0x4d67('0x22'),QUERY,_0x2369a0,_0x1deca8),{'type':dbH[_0x4d67('0x17')][_0x4d67('0x1a')]['SELECT']}));}}}else{_0x35f177[_0x4d67('0x23')](dbH['sequelize'][_0x4d67('0x21')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x4d67('0x1b')]}));}var _0x25c5ca=path[_0x4d67('0x24')](PATH);var _0x36f3cc=path[_0x4d67('0x25')](PATH,_0x4d67('0x26'));var _0x338e9e=_0xf77a04['split']&&_0x35f177[_0x4d67('0x1d')]>0x1;var _0x328396=[];if(!fs['existsSync'](path[_0x4d67('0x27')](_0x25c5ca,_0x36f3cc))&&_0x338e9e){fs['mkdirSync'](path[_0x4d67('0x27')](_0x25c5ca,_0x36f3cc));}return BPromise[_0x4d67('0x28')](_0x35f177,function(_0x1e0cf1){_0x328396[_0x4d67('0x23')](_0x1e0cf1);})['then'](function(){for(var _0x1b7c37=0x0;_0x1b7c37<_0x328396[_0x4d67('0x1d')];_0x1b7c37+=0x1){var _0x439360;var _0x2bac9d=_0x328396[_0x1b7c37];if(_0x338e9e){_0x439360=path[_0x4d67('0x27')](_0x25c5ca,_0x36f3cc,util[_0x4d67('0x18')]('%s%d.%s',_0x36f3cc,_0x1b7c37,_0x4d67('0x29')));}else{_0x439360=path['join'](_0x25c5ca,util[_0x4d67('0x18')](_0x4d67('0x2a'),_0x36f3cc,_0x4d67('0x29')));}fs['writeFileSync'](_0x439360,json2xls(_0x2bac9d),_0x4d67('0x2b'));}})['then'](function(){if(_0x338e9e){return new Promise(function(_0x55ce8f){zipdir(path[_0x4d67('0x27')](_0x25c5ca,_0x36f3cc),{'saveTo':path[_0x4d67('0x27')](_0x25c5ca,util[_0x4d67('0x18')](_0x4d67('0x2a'),_0x36f3cc,'zip'))},function(_0x15c39c,_0x50b688){rimraf(path[_0x4d67('0x27')](_0x25c5ca,_0x36f3cc),function(){});_0x55ce8f(_0x4d67('0x2c'));});});}})['then'](function(){logger[_0x4d67('0xf')](util[_0x4d67('0x18')](_0x4d67('0x2d'),EXTRACTED_REPORT_ID,_0x4d67('0x11')));return analyticExtractedReport(_0x4d67('0x2e'),_0x338e9e?util[_0x4d67('0x18')](_0x4d67('0x2a'),_0x36f3cc,_0x338e9e?_0x4d67('0x2f'):_0x4d67('0x29')):null);});})[_0x4d67('0x30')](function(_0x182a85){logger[_0x4d67('0xf')](util[_0x4d67('0x18')](_0x4d67('0x31'),EXTRACTED_REPORT_ID,_0x4d67('0x11')),util[_0x4d67('0x32')](_0x182a85,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x4d67('0x33')](function(){process[_0x4d67('0x34')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x2de3=['SELECT','Empty','length','num','isInteger','query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','existsSync','mkdirSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','info','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','QueryTypes'];(function(_0x588f18,_0x47a6f4){var _0x5cf96b=function(_0x3d8f95){while(--_0x3d8f95){_0x588f18['push'](_0x588f18['shift']());}};_0x5cf96b(++_0x47a6f4);}(_0x2de3,0x150));var _0x32de=function(_0x2b50fc,_0x336f73){_0x2b50fc=_0x2b50fc-0x0;var _0x340ca9=_0x2de3[_0x2b50fc];return _0x340ca9;};'use strict';var util=require('util');var path=require(_0x32de('0x0'));var _=require(_0x32de('0x1'));var fs=require('fs');var json2xls=require(_0x32de('0x2'));var BPromise=require(_0x32de('0x3'));var zipdir=require(_0x32de('0x4'));var rimraf=require(_0x32de('0x5'));var db=require(_0x32de('0x6'))['db'];var dbH=require('../../mysqldb')[_0x32de('0x7')];var logger=require(_0x32de('0x8'))(_0x32de('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x32de('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3cb4ad,_0x5e4d89){var _0x5907f2={'status':_0x3cb4ad};var _0xd0a079={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5e4d89){_0x5907f2['savename']=_0x5e4d89;}return db[_0x32de('0xb')]['update'](_0x5907f2,_0xd0a079);}function main(){var _0x3baab5=0x1388;var _0x16ee44;logger[_0x32de('0xc')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x32de('0xd')));return db[_0x32de('0xe')][_0x32de('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x32de('0x10'),_0x32de('0x11')]})['then'](function(_0x34f2b4){if(_0x34f2b4){_0x16ee44=_0x34f2b4;_0x3baab5=_0x16ee44[_0x32de('0x11')]||0x1388;}})[_0x32de('0x12')](function(){return dbH[_0x32de('0x13')]['query'](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x32de('0x13')][_0x32de('0x14')][_0x32de('0x15')]});})[_0x32de('0x12')](function(_0x31e0de){if(!_0x31e0de[0x0]['num']){return analyticExtractedReport(_0x32de('0x16'));}var _0x9e2050=[];var _0x566973=0x0;if(_0x16ee44[_0x32de('0x10')]){if(_0x31e0de&&_0x31e0de[_0x32de('0x17')]){var _0x365119=_['range'](_0x31e0de[0x0][_0x32de('0x18')]/_0x3baab5);var _0x589b74=Number[_0x32de('0x19')](_0x31e0de[0x0]['num']/_0x3baab5)?_0x31e0de[0x0]['num']%_0x3baab5:0x0;_0x365119['forEach'](function(_0x3e276c){if(_0x3e276c>0x0){_0x566973+=_0x3baab5;}_0x9e2050['push'](dbH[_0x32de('0x13')][_0x32de('0x1a')](util[_0x32de('0x1b')](_0x32de('0x1c'),QUERY,_0x3baab5,_0x566973),{'type':dbH[_0x32de('0x13')][_0x32de('0x14')][_0x32de('0x15')]}));});if(_0x589b74>0x0){_0x566973+=_0x3baab5;_0x9e2050['push'](dbH['sequelize'][_0x32de('0x1a')](util[_0x32de('0x1b')](_0x32de('0x1c'),QUERY,_0x589b74,_0x566973),{'type':dbH[_0x32de('0x13')][_0x32de('0x14')][_0x32de('0x15')]}));}}}else{_0x9e2050[_0x32de('0x1d')](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize'][_0x32de('0x14')][_0x32de('0x15')]}));}var _0x1cfc05=path[_0x32de('0x1e')](PATH);var _0x22ed22=path[_0x32de('0x1f')](PATH,_0x32de('0x20'));var _0x5360d9=_0x16ee44[_0x32de('0x10')]&&_0x9e2050[_0x32de('0x17')]>0x1;var _0x29d0ef=[];if(!fs[_0x32de('0x21')](path['join'](_0x1cfc05,_0x22ed22))&&_0x5360d9){fs[_0x32de('0x22')](path[_0x32de('0x23')](_0x1cfc05,_0x22ed22));}return BPromise[_0x32de('0x24')](_0x9e2050,function(_0x5cf1d6){_0x29d0ef[_0x32de('0x1d')](_0x5cf1d6);})[_0x32de('0x12')](function(){for(var _0x8e1f84=0x0;_0x8e1f84<_0x29d0ef['length'];_0x8e1f84+=0x1){var _0x3eac53;var _0x349d65=_0x29d0ef[_0x8e1f84];if(_0x5360d9){_0x3eac53=path['join'](_0x1cfc05,_0x22ed22,util[_0x32de('0x1b')](_0x32de('0x25'),_0x22ed22,_0x8e1f84,_0x32de('0x26')));}else{_0x3eac53=path['join'](_0x1cfc05,util[_0x32de('0x1b')](_0x32de('0x27'),_0x22ed22,_0x32de('0x26')));}fs[_0x32de('0x28')](_0x3eac53,json2xls(_0x349d65),_0x32de('0x29'));}})[_0x32de('0x12')](function(){if(_0x5360d9){return new Promise(function(_0xba5801){zipdir(path[_0x32de('0x23')](_0x1cfc05,_0x22ed22),{'saveTo':path['join'](_0x1cfc05,util['format'](_0x32de('0x27'),_0x22ed22,_0x32de('0x2a')))},function(_0x15b35f,_0x4039e3){rimraf(path['join'](_0x1cfc05,_0x22ed22),function(){});_0xba5801(_0x32de('0x2b'));});});}})[_0x32de('0x12')](function(){logger[_0x32de('0xc')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x32de('0xd')));return analyticExtractedReport(_0x32de('0x2c'),_0x5360d9?util[_0x32de('0x1b')](_0x32de('0x27'),_0x22ed22,_0x5360d9?_0x32de('0x2a'):'xlsx'):null);});})[_0x32de('0x2d')](function(_0x46759f){logger[_0x32de('0xc')](util[_0x32de('0x1b')](_0x32de('0x2e'),EXTRACTED_REPORT_ID,_0x32de('0xd')),util[_0x32de('0x2f')](_0x46759f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x32de('0x30'));})[_0x32de('0x31')](function(){process[_0x32de('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 32bf590..16d02b1 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 _0x41a6=['ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','concat','Hangup','transaction','destroy','sortBy','error','rewrite','lodash','models','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','filter','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','outbound','cutdigits','${EXTEN}'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x41a6,0xec));var _0x641a=function(_0x403eb3,_0x327559){_0x403eb3=_0x403eb3-0x0;var _0x179e1f=_0x41a6[_0x403eb3];return _0x179e1f;};'use strict';var _=require(_0x641a('0x0'));var util=require('util');function rewrite(_0x487297,_0x37eb4d){var _0x316adb=this;return _0x487297[_0x641a('0x1')]['Interval'][_0x641a('0x2')]({'raw':!![]})[_0x641a('0x3')](function(_0x3f79d1){_0x316adb[_0x641a('0x4')]=_0x3f79d1;return _0x487297['models'][_0x641a('0x5')][_0x641a('0x2')]({'where':{'IntervalId':_0x37eb4d[_0x641a('0x6')]},'raw':!![]});})[_0x641a('0x3')](function(_0x3923fc){return _0x487297[_0x641a('0x1')][_0x641a('0x5')][_0x641a('0x2')]({'where':{'exten':{'$in':_[_0x641a('0x7')](_[_0x641a('0x8')](_0x3923fc,_0x641a('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x1aa0e4){var _0x5a01d1=_[_0x641a('0xa')](_0x1aa0e4,{'priority':'1'});var _0xf5618a=_['filter'](_0x1aa0e4,{'isApp':0x1});var _0x257d3=_['groupBy'](_0xf5618a,_0x641a('0x9'));var _0x557674=[_0x641a('0xb'),_0x641a('0xc')];var _0x5d7abc=[];var _0x347e05=[];for(var _0x6e7417 in _0x257d3){if(_0x257d3[_0x641a('0xd')](_0x6e7417)){_0x316adb[_0x641a('0xe')]=0x2;_0x316adb[_0x641a('0xf')]=[];_0x316adb[_0x641a('0x10')]=_[_0x641a('0x11')](_0x5a01d1,{'exten':_0x257d3[_0x6e7417][0x0][_0x641a('0x9')]});_0x316adb['extensions'][_0x641a('0x12')]({'type':_0x257d3[_0x6e7417][0x0][_0x641a('0x13')],'app':_0x641a('0x14'),'appdata':util[_0x641a('0x15')](_0x641a('0x16'),_0x257d3[_0x6e7417][0x0][_0x641a('0x13')]),'context':_0x257d3[_0x6e7417][0x0][_0x641a('0x17')],'exten':_0x257d3[_0x6e7417][0x0][_0x641a('0x9')],'priority':_0x316adb[_0x641a('0xe')]++,'VoiceExtensionId':_0x257d3[_0x6e7417][0x0][_0x641a('0x18')]});if(_0x257d3[_0x6e7417][0x0][_0x641a('0x13')]==='inbound'){_0x316adb[_0x641a('0xf')][_0x641a('0x12')]({'type':_0x257d3[_0x6e7417][0x0][_0x641a('0x13')],'app':_0x641a('0x14'),'appdata':'CDR(routeid)='+_0x257d3[_0x6e7417][0x0][_0x641a('0x18')],'context':_0x257d3[_0x6e7417][0x0][_0x641a('0x17')],'exten':_0x257d3[_0x6e7417][0x0][_0x641a('0x9')],'priority':_0x316adb['priority']++,'VoiceExtensionId':_0x257d3[_0x6e7417][0x0][_0x641a('0x18')]});}else if(_0x257d3[_0x6e7417][0x0][_0x641a('0x13')]===_0x641a('0x19')){if(_0x316adb['extension']){_0x316adb['extensions'][_0x641a('0x12')]({'type':_0x257d3[_0x6e7417][0x0][_0x641a('0x13')],'app':_0x641a('0x14'),'appdata':'CDR(destination)='+(_0x316adb[_0x641a('0x10')][_0x641a('0x1a')]?'${EXTEN:'+_0x316adb[_0x641a('0x10')][_0x641a('0x1a')]+'}':_0x641a('0x1b')),'context':_0x257d3[_0x6e7417][0x0]['context'],'exten':_0x257d3[_0x6e7417][0x0][_0x641a('0x9')],'priority':_0x316adb[_0x641a('0xe')]++,'VoiceExtensionId':_0x257d3[_0x6e7417][0x0][_0x641a('0x18')]});}_0x316adb['extensions'][_0x641a('0x12')]({'type':_0x257d3[_0x6e7417][0x0][_0x641a('0x13')],'app':'Set','appdata':'CDR(routeid)='+_0x257d3[_0x6e7417][0x0][_0x641a('0x18')],'context':_0x257d3[_0x6e7417][0x0]['context'],'exten':_0x257d3[_0x6e7417][0x0][_0x641a('0x9')],'priority':_0x316adb[_0x641a('0xe')]++,'VoiceExtensionId':_0x257d3[_0x6e7417][0x0][_0x641a('0x18')]});var _0x5080ec=_0x316adb['priority']++;_0x316adb[_0x641a('0xf')]['push']({'type':_0x257d3[_0x6e7417][0x0][_0x641a('0x13')],'app':_0x641a('0x1c'),'appdata':_0x641a('0x1d')+(_0x5080ec+0x2)+'):Goto('+(_0x5080ec+0x1)+')','context':_0x257d3[_0x6e7417][0x0][_0x641a('0x17')],'exten':_0x257d3[_0x6e7417][0x0][_0x641a('0x9')],'priority':_0x5080ec,'VoiceExtensionId':_0x257d3[_0x6e7417][0x0][_0x641a('0x18')]});if(_0x316adb['extension']){_0x316adb[_0x641a('0xf')][_0x641a('0x12')]({'type':_0x257d3[_0x6e7417][0x0]['type'],'app':'Set','appdata':_0x316adb[_0x641a('0x10')][_0x641a('0x1a')]?'CDR(prefix)=${EXTEN:0:'+_0x316adb[_0x641a('0x10')]['cutdigits']+'}':_0x641a('0x1e'),'context':_0x257d3[_0x6e7417][0x0][_0x641a('0x17')],'exten':_0x257d3[_0x6e7417][0x0][_0x641a('0x9')],'priority':_0x316adb[_0x641a('0xe')]++,'VoiceExtensionId':_0x257d3[_0x6e7417][0x0][_0x641a('0x18')]});}_0x316adb[_0x641a('0xf')]['push']({'type':_0x257d3[_0x6e7417][0x0][_0x641a('0x13')],'app':_0x641a('0x14'),'appdata':_0x641a('0x1f')+_0x257d3[_0x6e7417][0x0][_0x641a('0x18')],'context':_0x257d3[_0x6e7417][0x0][_0x641a('0x17')],'exten':_0x257d3[_0x6e7417][0x0][_0x641a('0x9')],'priority':_0x316adb[_0x641a('0xe')]++,'VoiceExtensionId':_0x257d3[_0x6e7417][0x0][_0x641a('0x18')]});if(_0x316adb[_0x641a('0x10')]&&_0x316adb[_0x641a('0x10')][_0x641a('0xd')](_0x641a('0x20'))&&_0x316adb['extension']['recordingFormat']!==_0x641a('0x21')){_0x316adb[_0x641a('0xf')][_0x641a('0x12')]({'type':_0x257d3[_0x6e7417][0x0]['type'],'app':_0x641a('0x14'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x257d3[_0x6e7417][0x0][_0x641a('0x17')],'exten':_0x257d3[_0x6e7417][0x0][_0x641a('0x9')],'priority':_0x316adb[_0x641a('0xe')]++,'VoiceExtensionId':_0x257d3[_0x6e7417][0x0][_0x641a('0x18')]});_0x316adb[_0x641a('0xf')][_0x641a('0x12')]({'type':_0x257d3[_0x6e7417][0x0]['type'],'app':_0x641a('0x14'),'appdata':_0x641a('0x22')+_0x316adb['extension'][_0x641a('0x20')]||_0x641a('0x23'),'context':_0x257d3[_0x6e7417][0x0][_0x641a('0x17')],'exten':_0x257d3[_0x6e7417][0x0][_0x641a('0x9')],'priority':_0x316adb[_0x641a('0xe')]++,'VoiceExtensionId':_0x257d3[_0x6e7417][0x0]['VoiceExtensionId']});}}_0x316adb['extensions']['push']({'type':_0x257d3[_0x6e7417][0x0][_0x641a('0x13')],'app':_0x641a('0x14'),'appdata':_0x641a('0x24'),'context':_0x257d3[_0x6e7417][0x0]['context'],'exten':_0x257d3[_0x6e7417][0x0]['exten'],'priority':_0x316adb[_0x641a('0xe')]++,'VoiceExtensionId':_0x257d3[_0x6e7417][0x0][_0x641a('0x18')]});_0x316adb[_0x641a('0xf')]['push']({'type':_0x257d3[_0x6e7417][0x0][_0x641a('0x13')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x257d3[_0x6e7417][0x0]['context'],'exten':_0x257d3[_0x6e7417][0x0]['exten'],'priority':_0x316adb[_0x641a('0xe')]++,'VoiceExtensionId':_0x257d3[_0x6e7417][0x0][_0x641a('0x18')]});_0x316adb[_0x641a('0xf')][_0x641a('0x12')]({'type':_0x257d3[_0x6e7417][0x0][_0x641a('0x13')],'app':_0x641a('0x14'),'appdata':_0x641a('0x25'),'context':_0x257d3[_0x6e7417][0x0][_0x641a('0x17')],'exten':_0x257d3[_0x6e7417][0x0]['exten'],'priority':_0x316adb['priority']++,'VoiceExtensionId':_0x257d3[_0x6e7417][0x0][_0x641a('0x18')]});for(var _0x33d561=0x0,_0x2124d6=0x0;_0x33d561<_0x257d3[_0x6e7417][_0x641a('0x26')];_0x33d561+=0x1,_0x2124d6=0x0){var _0x2b679f=_0x257d3[_0x6e7417][_0x33d561];if(_0x2b679f[_0x641a('0x13')]){_0x2b679f[_0x641a('0x13')]=_0x2b679f[_0x641a('0x13')]['toLowerCase']();}var _0x30f66a=[];var _0x183424=[];delete _0x2b679f['id'];delete _0x2b679f['createdAt'];delete _0x2b679f['updatedAt'];var _0x3b08ec=_0x2b679f[_0x641a('0x27')]!==_0x641a('0x28')?[_0x2b679f[_0x641a('0x27')]]:_0x2b679f[_0x641a('0x6')]?_[_0x641a('0x8')](_[_0x641a('0xa')](_0x316adb[_0x641a('0x4')],{'IntervalId':_0x2b679f[_0x641a('0x6')]}),_0x641a('0x27')):[];if(_0x2b679f['hasOwnProperty']('tag')){if(_0x2b679f[_0x641a('0x29')]&&_0x2b679f['tag']!=='--'){_0x30f66a[_0x641a('0x12')]({'type':_0x2b679f[_0x641a('0x13')],'app':_0x641a('0x14'),'appdata':_0x641a('0x2a')+_0x2b679f[_0x641a('0x29')],'context':_0x2b679f[_0x641a('0x17')],'exten':_0x2b679f[_0x641a('0x9')],'priority':_0x3b08ec['length']+_0x316adb[_0x641a('0xe')]+_0x2124d6++,'VoiceExtensionId':_0x2b679f[_0x641a('0x18')]});}}if(_0x2b679f[_0x641a('0x13')]==='outbound'&&_0x2b679f[_0x641a('0xd')]('callerID')){if(_0x2b679f[_0x641a('0x2b')]){_0x30f66a[_0x641a('0x12')]({'type':_0x2b679f[_0x641a('0x13')],'app':'ExecIf','appdata':_0x641a('0x2c')+_0x2b679f['callerID']+')','context':_0x2b679f[_0x641a('0x17')],'exten':_0x2b679f[_0x641a('0x9')],'priority':_0x3b08ec[_0x641a('0x26')]+_0x316adb[_0x641a('0xe')]+_0x2124d6++,'VoiceExtensionId':_0x2b679f[_0x641a('0x18')]});}else{_0x30f66a[_0x641a('0x12')]({'type':_0x2b679f['type'],'app':_0x641a('0x1c'),'appdata':_0x641a('0x2d'),'context':_0x2b679f[_0x641a('0x17')],'exten':_0x2b679f['exten'],'priority':_0x3b08ec[_0x641a('0x26')]+_0x316adb[_0x641a('0xe')]+_0x2124d6++,'VoiceExtensionId':_0x2b679f[_0x641a('0x18')]});}}if(_0x2b679f[_0x641a('0xd')](_0x641a('0x2e'))){if(_0x557674[_0x641a('0x2f')](_0x2b679f[_0x641a('0x30')][_0x641a('0x31')]())>=0x0&&_0x2b679f[_0x641a('0x32')]!==_0x641a('0x33')){if(_0x2b679f[_0x641a('0x2e')]){_0x30f66a[_0x641a('0x12')]({'type':_0x2b679f[_0x641a('0x13')],'app':_0x641a('0x1c'),'appdata':_0x641a('0x34'),'context':_0x2b679f[_0x641a('0x17')],'exten':_0x2b679f[_0x641a('0x9')],'priority':_0x3b08ec['length']+_0x316adb[_0x641a('0xe')]+_0x2124d6++,'VoiceExtensionId':_0x2b679f[_0x641a('0x18')]});_0x30f66a['push']({'type':_0x2b679f[_0x641a('0x13')],'app':'Set','appdata':_0x641a('0x35'),'context':_0x2b679f[_0x641a('0x17')],'exten':_0x2b679f['exten'],'priority':_0x3b08ec[_0x641a('0x26')]+_0x316adb[_0x641a('0xe')]+_0x2124d6++,'VoiceExtensionId':_0x2b679f['VoiceExtensionId']});}else{_0x30f66a['push']({'type':_0x2b679f[_0x641a('0x13')],'app':'ExecIf','appdata':_0x641a('0x36'),'context':_0x2b679f[_0x641a('0x17')],'exten':_0x2b679f[_0x641a('0x9')],'priority':_0x3b08ec['length']+_0x316adb['priority']+_0x2124d6++,'VoiceExtensionId':_0x2b679f[_0x641a('0x18')]});_0x30f66a[_0x641a('0x12')]({'type':_0x2b679f[_0x641a('0x13')],'app':'Set','appdata':_0x641a('0x37'),'context':_0x2b679f[_0x641a('0x17')],'exten':_0x2b679f[_0x641a('0x9')],'priority':_0x3b08ec['length']+_0x316adb[_0x641a('0xe')]+_0x2124d6++,'VoiceExtensionId':_0x2b679f[_0x641a('0x18')]});}}}for(var _0x44a37c=0x0;_0x44a37c<_0x3b08ec[_0x641a('0x26')];_0x44a37c+=0x1){var _0x17fa5e=_0x316adb['priority']+_0x3b08ec[_0x641a('0x26')];var _0x5de740=_0x44a37c===_0x3b08ec[_0x641a('0x26')]-0x1?_0x316adb[_0x641a('0xe')]+_0x30f66a[_0x641a('0x26')]+_0x183424[_0x641a('0x26')]+0x2:_0x316adb[_0x641a('0xe')]+_0x44a37c+0x1;_0x30f66a[_0x641a('0x38')](_0x44a37c,0x0,{'type':_0x2b679f['type'],'app':_0x641a('0x39'),'appdata':_0x3b08ec[_0x44a37c]+'?'+_0x2b679f[_0x641a('0x17')]+_0x641a('0x3a')+_0x17fa5e+':'+_0x2b679f['context']+_0x641a('0x3a')+_0x5de740,'exten':_0x2b679f['exten'],'context':_0x2b679f[_0x641a('0x17')],'priority':_0x316adb[_0x641a('0xe')]+_0x44a37c,'VoiceExtensionId':_0x257d3[_0x6e7417][0x0][_0x641a('0x18')]});}_0x2b679f[_0x641a('0xe')]=_0x30f66a['length']?_['last'](_0x30f66a)[_0x641a('0xe')]+0x1:_0x316adb[_0x641a('0xe')];_0x316adb[_0x641a('0xe')]=(_0x183424[_0x641a('0x26')]?_['last'](_0x183424)[_0x641a('0xe')]:_0x2b679f[_0x641a('0xe')])+0x1;_0x316adb[_0x641a('0xf')]=_[_0x641a('0x3b')](_0x316adb[_0x641a('0xf')],_0x30f66a,[_0x2b679f],_0x183424);}_0x316adb[_0x641a('0xf')][_0x641a('0x12')]({'type':_0x257d3[_0x6e7417][0x0]['type'],'app':_0x641a('0x3c'),'exten':_0x257d3[_0x6e7417][0x0]['exten'],'context':_0x257d3[_0x6e7417][0x0]['context'],'priority':_0x316adb[_0x641a('0xe')],'VoiceExtensionId':_0x257d3[_0x6e7417][0x0]['VoiceExtensionId']});_0x5d7abc[_0x641a('0x12')](_0x257d3[_0x6e7417][0x0][_0x641a('0x18')]);_0x347e05=_[_0x641a('0x3b')](_0x347e05,_0x316adb[_0x641a('0xf')]);}}return _0x487297[_0x641a('0x3d')](function(_0x5c2731){return _0x487297[_0x641a('0x1')][_0x641a('0x5')][_0x641a('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x5d7abc}},'transaction':_0x5c2731})['then'](function(_0x11aa02){return _0x487297[_0x641a('0x1')]['VoiceExtension']['bulkCreate'](_[_0x641a('0x3f')](_0x347e05,_0x641a('0xe')),{'transaction':_0x5c2731});});});})['catch'](function(_0x519035){console[_0x641a('0x40')](_0x519035);});}exports[_0x641a('0x41')]=rewrite; \ No newline at end of file +var _0xf16b=['CDR(destination)=','cutdigits','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','MONITOR_OPTIONS=ab','length','createdAt','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','appType','custom','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','filter','groupBy','queue','hasOwnProperty','priority','extensions','extension','push','Set','type','context','inbound','CDR(routeid)=','VoiceExtensionId','outbound'];(function(_0x450cf0,_0x183637){var _0x173655=function(_0xd5596d){while(--_0xd5596d){_0x450cf0['push'](_0x450cf0['shift']());}};_0x173655(++_0x183637);}(_0xf16b,0x66));var _0xbf16=function(_0x4cc789,_0x4d851a){_0x4cc789=_0x4cc789-0x0;var _0x126143=_0xf16b[_0x4cc789];return _0x126143;};'use strict';var _=require(_0xbf16('0x0'));var util=require('util');function rewrite(_0x9a9c09,_0x196bc1){var _0x8c4447=this;return _0x9a9c09[_0xbf16('0x1')][_0xbf16('0x2')][_0xbf16('0x3')]({'raw':!![]})[_0xbf16('0x4')](function(_0x12b645){_0x8c4447[_0xbf16('0x5')]=_0x12b645;return _0x9a9c09[_0xbf16('0x1')][_0xbf16('0x6')][_0xbf16('0x3')]({'where':{'IntervalId':_0x196bc1[_0xbf16('0x7')]},'raw':!![]});})[_0xbf16('0x4')](function(_0x31315a){return _0x9a9c09[_0xbf16('0x1')][_0xbf16('0x6')][_0xbf16('0x3')]({'where':{'exten':{'$in':_[_0xbf16('0x8')](_[_0xbf16('0x9')](_0x31315a,_0xbf16('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xbf16('0x4')](function(_0x5189f8){var _0x4a890b=_[_0xbf16('0xb')](_0x5189f8,{'priority':'1'});var _0x46d604=_[_0xbf16('0xb')](_0x5189f8,{'isApp':0x1});var _0x2a935e=_[_0xbf16('0xc')](_0x46d604,_0xbf16('0xa'));var _0x1abe01=[_0xbf16('0xd'),'playback'];var _0x50b3b3=[];var _0xcad3c0=[];for(var _0x4bca74 in _0x2a935e){if(_0x2a935e[_0xbf16('0xe')](_0x4bca74)){_0x8c4447[_0xbf16('0xf')]=0x2;_0x8c4447[_0xbf16('0x10')]=[];_0x8c4447[_0xbf16('0x11')]=_['find'](_0x4a890b,{'exten':_0x2a935e[_0x4bca74][0x0]['exten']});_0x8c4447['extensions'][_0xbf16('0x12')]({'type':_0x2a935e[_0x4bca74][0x0]['type'],'app':_0xbf16('0x13'),'appdata':util['format']('CDR(type)=%s',_0x2a935e[_0x4bca74][0x0][_0xbf16('0x14')]),'context':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x15')],'exten':_0x2a935e[_0x4bca74][0x0][_0xbf16('0xa')],'priority':_0x8c4447[_0xbf16('0xf')]++,'VoiceExtensionId':_0x2a935e[_0x4bca74][0x0]['VoiceExtensionId']});if(_0x2a935e[_0x4bca74][0x0][_0xbf16('0x14')]===_0xbf16('0x16')){_0x8c4447[_0xbf16('0x10')]['push']({'type':_0x2a935e[_0x4bca74][0x0]['type'],'app':_0xbf16('0x13'),'appdata':_0xbf16('0x17')+_0x2a935e[_0x4bca74][0x0][_0xbf16('0x18')],'context':_0x2a935e[_0x4bca74][0x0]['context'],'exten':_0x2a935e[_0x4bca74][0x0][_0xbf16('0xa')],'priority':_0x8c4447[_0xbf16('0xf')]++,'VoiceExtensionId':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x18')]});}else if(_0x2a935e[_0x4bca74][0x0][_0xbf16('0x14')]===_0xbf16('0x19')){if(_0x8c4447[_0xbf16('0x11')]){_0x8c4447[_0xbf16('0x10')]['push']({'type':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x14')],'app':_0xbf16('0x13'),'appdata':_0xbf16('0x1a')+(_0x8c4447['extension'][_0xbf16('0x1b')]?'${EXTEN:'+_0x8c4447['extension'][_0xbf16('0x1b')]+'}':'${EXTEN}'),'context':_0x2a935e[_0x4bca74][0x0]['context'],'exten':_0x2a935e[_0x4bca74][0x0][_0xbf16('0xa')],'priority':_0x8c4447[_0xbf16('0xf')]++,'VoiceExtensionId':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x18')]});}_0x8c4447['extensions']['push']({'type':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x14')],'app':_0xbf16('0x13'),'appdata':_0xbf16('0x17')+_0x2a935e[_0x4bca74][0x0][_0xbf16('0x18')],'context':_0x2a935e[_0x4bca74][0x0]['context'],'exten':_0x2a935e[_0x4bca74][0x0][_0xbf16('0xa')],'priority':_0x8c4447[_0xbf16('0xf')]++,'VoiceExtensionId':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x18')]});var _0x1362e8=_0x8c4447[_0xbf16('0xf')]++;_0x8c4447['extensions']['push']({'type':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x14')],'app':_0xbf16('0x1c'),'appdata':_0xbf16('0x1d')+(_0x1362e8+0x2)+_0xbf16('0x1e')+(_0x1362e8+0x1)+')','context':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x15')],'exten':_0x2a935e[_0x4bca74][0x0][_0xbf16('0xa')],'priority':_0x1362e8,'VoiceExtensionId':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x18')]});if(_0x8c4447[_0xbf16('0x11')]){_0x8c4447[_0xbf16('0x10')]['push']({'type':_0x2a935e[_0x4bca74][0x0]['type'],'app':'Set','appdata':_0x8c4447[_0xbf16('0x11')][_0xbf16('0x1b')]?_0xbf16('0x1f')+_0x8c4447[_0xbf16('0x11')][_0xbf16('0x1b')]+'}':'CDR(prefix)=noprefix','context':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x15')],'exten':_0x2a935e[_0x4bca74][0x0][_0xbf16('0xa')],'priority':_0x8c4447[_0xbf16('0xf')]++,'VoiceExtensionId':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x18')]});}_0x8c4447[_0xbf16('0x10')]['push']({'type':_0x2a935e[_0x4bca74][0x0]['type'],'app':_0xbf16('0x13'),'appdata':_0xbf16('0x20')+_0x2a935e[_0x4bca74][0x0][_0xbf16('0x18')],'context':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x15')],'exten':_0x2a935e[_0x4bca74][0x0][_0xbf16('0xa')],'priority':_0x8c4447[_0xbf16('0xf')]++,'VoiceExtensionId':_0x2a935e[_0x4bca74][0x0]['VoiceExtensionId']});if(_0x8c4447[_0xbf16('0x11')]&&_0x8c4447[_0xbf16('0x11')][_0xbf16('0xe')](_0xbf16('0x21'))&&_0x8c4447['extension'][_0xbf16('0x21')]!==_0xbf16('0x22')){_0x8c4447['extensions']['push']({'type':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x14')],'app':'Set','appdata':_0xbf16('0x23'),'context':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x15')],'exten':_0x2a935e[_0x4bca74][0x0][_0xbf16('0xa')],'priority':_0x8c4447[_0xbf16('0xf')]++,'VoiceExtensionId':_0x2a935e[_0x4bca74][0x0]['VoiceExtensionId']});_0x8c4447['extensions']['push']({'type':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x14')],'app':_0xbf16('0x13'),'appdata':_0xbf16('0x24')+_0x8c4447[_0xbf16('0x11')][_0xbf16('0x21')]||_0xbf16('0x25'),'context':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x15')],'exten':_0x2a935e[_0x4bca74][0x0][_0xbf16('0xa')],'priority':_0x8c4447[_0xbf16('0xf')]++,'VoiceExtensionId':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x18')]});}}_0x8c4447[_0xbf16('0x10')][_0xbf16('0x12')]({'type':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x14')],'app':_0xbf16('0x13'),'appdata':_0xbf16('0x26'),'context':_0x2a935e[_0x4bca74][0x0]['context'],'exten':_0x2a935e[_0x4bca74][0x0][_0xbf16('0xa')],'priority':_0x8c4447[_0xbf16('0xf')]++,'VoiceExtensionId':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x18')]});_0x8c4447[_0xbf16('0x10')][_0xbf16('0x12')]({'type':_0x2a935e[_0x4bca74][0x0]['type'],'app':_0xbf16('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x15')],'exten':_0x2a935e[_0x4bca74][0x0][_0xbf16('0xa')],'priority':_0x8c4447[_0xbf16('0xf')]++,'VoiceExtensionId':_0x2a935e[_0x4bca74][0x0]['VoiceExtensionId']});_0x8c4447[_0xbf16('0x10')]['push']({'type':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x14')],'app':_0xbf16('0x13'),'appdata':_0xbf16('0x27'),'context':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x15')],'exten':_0x2a935e[_0x4bca74][0x0][_0xbf16('0xa')],'priority':_0x8c4447[_0xbf16('0xf')]++,'VoiceExtensionId':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x18')]});for(var _0x589239=0x0,_0x19c5ba=0x0;_0x589239<_0x2a935e[_0x4bca74][_0xbf16('0x28')];_0x589239+=0x1,_0x19c5ba=0x0){var _0x1a4a29=_0x2a935e[_0x4bca74][_0x589239];if(_0x1a4a29[_0xbf16('0x14')]){_0x1a4a29['type']=_0x1a4a29[_0xbf16('0x14')]['toLowerCase']();}var _0x2a601b=[];var _0x2496ee=[];delete _0x1a4a29['id'];delete _0x1a4a29[_0xbf16('0x29')];delete _0x1a4a29['updatedAt'];var _0x1751a4=_0x1a4a29[_0xbf16('0x2a')]!=='*,*,*,*'?[_0x1a4a29[_0xbf16('0x2a')]]:_0x1a4a29[_0xbf16('0x7')]?_[_0xbf16('0x9')](_[_0xbf16('0xb')](_0x8c4447['intervals'],{'IntervalId':_0x1a4a29[_0xbf16('0x7')]}),_0xbf16('0x2a')):[];if(_0x1a4a29['hasOwnProperty'](_0xbf16('0x2b'))){if(_0x1a4a29[_0xbf16('0x2b')]&&_0x1a4a29['tag']!=='--'){_0x2a601b[_0xbf16('0x12')]({'type':_0x1a4a29[_0xbf16('0x14')],'app':_0xbf16('0x13'),'appdata':_0xbf16('0x2c')+_0x1a4a29['tag'],'context':_0x1a4a29[_0xbf16('0x15')],'exten':_0x1a4a29[_0xbf16('0xa')],'priority':_0x1751a4['length']+_0x8c4447[_0xbf16('0xf')]+_0x19c5ba++,'VoiceExtensionId':_0x1a4a29[_0xbf16('0x18')]});}}if(_0x1a4a29['type']==='outbound'&&_0x1a4a29[_0xbf16('0xe')]('callerID')){if(_0x1a4a29[_0xbf16('0x2d')]){_0x2a601b[_0xbf16('0x12')]({'type':_0x1a4a29['type'],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x1a4a29[_0xbf16('0x2d')]+')','context':_0x1a4a29[_0xbf16('0x15')],'exten':_0x1a4a29[_0xbf16('0xa')],'priority':_0x1751a4[_0xbf16('0x28')]+_0x8c4447[_0xbf16('0xf')]+_0x19c5ba++,'VoiceExtensionId':_0x1a4a29[_0xbf16('0x18')]});}else{_0x2a601b[_0xbf16('0x12')]({'type':_0x1a4a29['type'],'app':_0xbf16('0x1c'),'appdata':_0xbf16('0x2e'),'context':_0x1a4a29[_0xbf16('0x15')],'exten':_0x1a4a29[_0xbf16('0xa')],'priority':_0x1751a4[_0xbf16('0x28')]+_0x8c4447[_0xbf16('0xf')]+_0x19c5ba++,'VoiceExtensionId':_0x1a4a29[_0xbf16('0x18')]});}}if(_0x1a4a29[_0xbf16('0xe')](_0xbf16('0x2f'))){if(_0x1abe01['indexOf'](_0x1a4a29[_0xbf16('0x30')]['toLowerCase']())>=0x0&&_0x1a4a29[_0xbf16('0x31')]!==_0xbf16('0x32')){if(_0x1a4a29[_0xbf16('0x2f')]){_0x2a601b['push']({'type':_0x1a4a29['type'],'app':_0xbf16('0x1c'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x1a4a29[_0xbf16('0x15')],'exten':_0x1a4a29[_0xbf16('0xa')],'priority':_0x1751a4[_0xbf16('0x28')]+_0x8c4447[_0xbf16('0xf')]+_0x19c5ba++,'VoiceExtensionId':_0x1a4a29['VoiceExtensionId']});_0x2a601b[_0xbf16('0x12')]({'type':_0x1a4a29[_0xbf16('0x14')],'app':_0xbf16('0x13'),'appdata':_0xbf16('0x33'),'context':_0x1a4a29['context'],'exten':_0x1a4a29[_0xbf16('0xa')],'priority':_0x1751a4[_0xbf16('0x28')]+_0x8c4447['priority']+_0x19c5ba++,'VoiceExtensionId':_0x1a4a29[_0xbf16('0x18')]});}else{_0x2a601b[_0xbf16('0x12')]({'type':_0x1a4a29['type'],'app':_0xbf16('0x1c'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x1a4a29[_0xbf16('0x15')],'exten':_0x1a4a29[_0xbf16('0xa')],'priority':_0x1751a4[_0xbf16('0x28')]+_0x8c4447[_0xbf16('0xf')]+_0x19c5ba++,'VoiceExtensionId':_0x1a4a29[_0xbf16('0x18')]});_0x2a601b[_0xbf16('0x12')]({'type':_0x1a4a29[_0xbf16('0x14')],'app':_0xbf16('0x13'),'appdata':_0xbf16('0x34'),'context':_0x1a4a29[_0xbf16('0x15')],'exten':_0x1a4a29['exten'],'priority':_0x1751a4[_0xbf16('0x28')]+_0x8c4447[_0xbf16('0xf')]+_0x19c5ba++,'VoiceExtensionId':_0x1a4a29[_0xbf16('0x18')]});}}}for(var _0x25df9b=0x0;_0x25df9b<_0x1751a4[_0xbf16('0x28')];_0x25df9b+=0x1){var _0x24533f=_0x8c4447[_0xbf16('0xf')]+_0x1751a4['length'];var _0x2fe783=_0x25df9b===_0x1751a4[_0xbf16('0x28')]-0x1?_0x8c4447[_0xbf16('0xf')]+_0x2a601b[_0xbf16('0x28')]+_0x2496ee[_0xbf16('0x28')]+0x2:_0x8c4447[_0xbf16('0xf')]+_0x25df9b+0x1;_0x2a601b['splice'](_0x25df9b,0x0,{'type':_0x1a4a29[_0xbf16('0x14')],'app':_0xbf16('0x35'),'appdata':_0x1751a4[_0x25df9b]+'?'+_0x1a4a29[_0xbf16('0x15')]+_0xbf16('0x36')+_0x24533f+':'+_0x1a4a29[_0xbf16('0x15')]+_0xbf16('0x36')+_0x2fe783,'exten':_0x1a4a29[_0xbf16('0xa')],'context':_0x1a4a29['context'],'priority':_0x8c4447['priority']+_0x25df9b,'VoiceExtensionId':_0x2a935e[_0x4bca74][0x0]['VoiceExtensionId']});}_0x1a4a29[_0xbf16('0xf')]=_0x2a601b[_0xbf16('0x28')]?_['last'](_0x2a601b)[_0xbf16('0xf')]+0x1:_0x8c4447[_0xbf16('0xf')];_0x8c4447[_0xbf16('0xf')]=(_0x2496ee[_0xbf16('0x28')]?_[_0xbf16('0x37')](_0x2496ee)[_0xbf16('0xf')]:_0x1a4a29[_0xbf16('0xf')])+0x1;_0x8c4447[_0xbf16('0x10')]=_['concat'](_0x8c4447[_0xbf16('0x10')],_0x2a601b,[_0x1a4a29],_0x2496ee);}_0x8c4447[_0xbf16('0x10')][_0xbf16('0x12')]({'type':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x14')],'app':'Hangup','exten':_0x2a935e[_0x4bca74][0x0][_0xbf16('0xa')],'context':_0x2a935e[_0x4bca74][0x0][_0xbf16('0x15')],'priority':_0x8c4447[_0xbf16('0xf')],'VoiceExtensionId':_0x2a935e[_0x4bca74][0x0]['VoiceExtensionId']});_0x50b3b3['push'](_0x2a935e[_0x4bca74][0x0][_0xbf16('0x18')]);_0xcad3c0=_[_0xbf16('0x38')](_0xcad3c0,_0x8c4447[_0xbf16('0x10')]);}}return _0x9a9c09[_0xbf16('0x39')](function(_0x549817){return _0x9a9c09[_0xbf16('0x1')][_0xbf16('0x6')][_0xbf16('0x3a')]({'where':{'VoiceExtensionId':{'$in':_0x50b3b3}},'transaction':_0x549817})[_0xbf16('0x4')](function(_0x6e6a25){return _0x9a9c09['models'][_0xbf16('0x6')][_0xbf16('0x3b')](_[_0xbf16('0x3c')](_0xcad3c0,_0xbf16('0xf')),{'transaction':_0x549817});});});})[_0xbf16('0x3d')](function(_0x4d5616){console[_0xbf16('0x3e')](_0x4d5616);});}exports[_0xbf16('0x3f')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 0f46d25..7d998d0 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 _0xa85a=['../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','undefined','Missing\x20filepath\x20parameter!','null','split','Missing\x20ListId\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','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','ListId','CompanyId','length','find','duplicate','CmContact','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','into','cm_hopper','fromQuery','updatedAt','select','field','NOW()','scheduledAt','ContactId','toString','createdAt','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','insert','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','cm_contacts','VoiceQueue','findAll','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','CmList','BlackLists','all','Campaign','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','createReadStream','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','lodash','squel','papaparse','ioredis'];(function(_0x43f6e8,_0x2b585a){var _0xccd2cd=function(_0x3a7c2c){while(--_0x3a7c2c){_0x43f6e8['push'](_0x43f6e8['shift']());}};_0xccd2cd(++_0x2b585a);}(_0xa85a,0x1af));var _0xaa85=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xa85a[_0x51020b];return _0x371e47;};'use strict';var BPromise=require(_0xaa85('0x0'));var util=require('util');var _=require(_0xaa85('0x1'));var fs=require('fs');var squel=require(_0xaa85('0x2'));var Papa=require(_0xaa85('0x3'));var Redis=require(_0xaa85('0x4'));var db=require(_0xaa85('0x5'))['db'];var config=require(_0xaa85('0x6'));var logger=require(_0xaa85('0x7'))(_0xaa85('0x8'));config[_0xaa85('0x9')]=_[_0xaa85('0xa')](config[_0xaa85('0x9')],{'host':_0xaa85('0xb'),'port':0x18eb});var socket=require(_0xaa85('0xc'))(new Redis(config[_0xaa85('0x9')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0xaa85('0xd')][0x2]||process[_0xaa85('0xd')][0x2]===_0xaa85('0xe')||process['argv'][0x2]==='null'){throw new Error(_0xaa85('0xf'));}var FILEPATH=process[_0xaa85('0xd')][0x2];if(!process[_0xaa85('0xd')][0x3]||process[_0xaa85('0xd')][0x3]==='undefined'||process[_0xaa85('0xd')][0x3]===_0xaa85('0x10')||!process[_0xaa85('0xd')][0x4]||process[_0xaa85('0xd')][0x4]==='undefined'||process[_0xaa85('0xd')][0x4]===_0xaa85('0x10')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process['argv'][0x3][_0xaa85('0x11')](','),process[_0xaa85('0xd')][0x4][_0xaa85('0x11')](','));if(!process[_0xaa85('0xd')][0x5]||process['argv'][0x5]===_0xaa85('0xe')||process['argv'][0x5]===_0xaa85('0x10')){throw new Error(_0xaa85('0x12'));}var LISTID=process[_0xaa85('0xd')][0x5];var COMPANYID=process[_0xaa85('0xd')][0x6]&&process['argv'][0x6]!==_0xaa85('0xe')&&process[_0xaa85('0xd')][0x6]!==_0xaa85('0x10')?process[_0xaa85('0xd')][0x6]:null;var DUPLICATES=process[_0xaa85('0xd')][0x7]&&process[_0xaa85('0xd')][0x7]!==_0xaa85('0xe')&&process[_0xaa85('0xd')][0x7]!==_0xaa85('0x10')?process[_0xaa85('0xd')][0x7]:null;if(!process['argv'][0x8]||process[_0xaa85('0xd')][0x8]===_0xaa85('0xe')||process[_0xaa85('0xd')][0x8]===_0xaa85('0x10')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xaa85('0xd')][0x8];}catch(_0x4a03d3){logger['error'](_0x4a03d3);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(_0x330995,_0xc6e34c,_0x3c2e35,_0x3db958){var _0x5038d9={'message':_0xc6e34c};_0x5038d9[_0x330995]=!![];if(_0x3c2e35){_0x5038d9[_0xaa85('0x13')]=_0x3c2e35;}if(_0x3db958){_0x5038d9[_0xaa85('0x14')]=_0x3db958;}return _0x5038d9;}function isEmail(_0x1a6100){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))*$/[_0xaa85('0x15')](_0x1a6100);}function checkRow(_0x2a2ac4,_0x63f848,_0x1d7a97){return new BPromise(function(_0x441e91,_0x32ae5d){if(_[_0xaa85('0x16')](_0x2a2ac4)){return _0x32ae5d(handleCheckRowError(_0xaa85('0x17'),_0xaa85('0x18'),null,_0x1d7a97));}if(_0x2a2ac4['errors']&&_0x2a2ac4[_0xaa85('0x19')]['length']){var _0x241e23=_[_0xaa85('0x1a')](_0x2a2ac4[_0xaa85('0x19')],_0xaa85('0x1b'))[_0xaa85('0x1c')](';');return _0x32ae5d(handleCheckRowError(_0xaa85('0x17'),_0x241e23,null,_0x1d7a97));}var _0x398de6={};for(var _0x4199bc in FIELDS){if(FIELDS[_0xaa85('0x1d')](_0x4199bc)&&FIELDS[_0x4199bc]){_0x398de6[_0x4199bc]=_0x2a2ac4[_0xaa85('0x1e')][0x0][FIELDS[_0x4199bc]]||_0x2a2ac4[_0xaa85('0x1e')][0x0]['\ufeff'+FIELDS[_0x4199bc]];}}if(!_0x398de6[_0xaa85('0x1f')]){return _0x32ae5d(handleCheckRowError(_0xaa85('0x17'),_0xaa85('0x20'),null,_0x1d7a97));}if(!_0x398de6[_0xaa85('0x21')]){return _0x32ae5d(handleCheckRowError(_0xaa85('0x17'),_0xaa85('0x22'),null,_0x1d7a97));}if(_0x398de6[_0xaa85('0x23')]){var _0x1736c1=moment(_0x398de6[_0xaa85('0x23')],_0xaa85('0x24'));if(!_0x1736c1[_0xaa85('0x25')]()){return _0x32ae5d(handleCheckRowError(_0xaa85('0x17'),_0xaa85('0x26'),null,_0x1d7a97));}}if(_0x398de6['email']){if(!isEmail(_0x398de6[_0xaa85('0x27')])){return _0x32ae5d(handleCheckRowError('error','email\x20format\x20is\x20not\x20valid!',null,_0x1d7a97));}}_0x398de6[_0xaa85('0x28')]=LISTID;_0x398de6[_0xaa85('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xaa85('0x2a')]&&_0x63f848){var _0x1e2aef={};for(var _0x1cd8c=0x0,_0x54e394=DUPLICATES[_0xaa85('0x2a')];_0x1cd8c<_0x54e394;_0x1cd8c+=0x1){_0x1e2aef[DUPLICATES[_0x1cd8c]]=_0x398de6[DUPLICATES[_0x1cd8c]];}var _0x474a8d=_[_0xaa85('0x2b')](_0x63f848,_0x1e2aef);if(_0x474a8d){return _0x32ae5d(handleCheckRowError(_0xaa85('0x2c'),'Duplicate\x20Contact',_0x474a8d,_0x1d7a97));}}return db[_0xaa85('0x2d')]['create'](_0x398de6,{'raw':!![],'hooks':![],'fields':_[_0xaa85('0x2e')](_0x398de6)})[_0xaa85('0x2f')](function(_0x1b6dc9){if(DUPLICATES&&DUPLICATES[_0xaa85('0x2a')]&&_0x63f848){_0x63f848[_0xaa85('0x30')](_[_0xaa85('0x31')](_0x398de6,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1b6dc9['id'];return _0x441e91();})[_0xaa85('0x32')](function(_0x45da59){return _0x32ae5d(handleCheckRowError(_0xaa85('0x17'),_0xaa85('0x33')+(_0x45da59['message']||JSON[_0xaa85('0x34')](_0x45da59)),null,_0x1d7a97));});});}function checkHopper(){function _0x187437(){return function(_0x2d3b85){logger[_0xaa85('0x17')]('cmContact',_0xaa85('0x35'),util[_0xaa85('0x36')](_0x2d3b85,{'showHidden':![],'depth':null}));};}var _0x5b990f=function(_0x19259f,_0x14b5b6){var _0x44c439=squel['insert']()[_0xaa85('0x37')](_0xaa85('0x38'))[_0xaa85('0x39')]([_0xaa85('0x21'),'scheduledAt','ContactId','ListId',_0x14b5b6,'createdAt',_0xaa85('0x3a')],squel[_0xaa85('0x3b')]()[_0xaa85('0x3c')](_0xaa85('0x21'),_0xaa85('0x21'))[_0xaa85('0x3c')](_0xaa85('0x3d'),_0xaa85('0x3e'))['field']('id',_0xaa85('0x3f'))[_0xaa85('0x3c')](LISTID[_0xaa85('0x40')](),_0xaa85('0x28'))[_0xaa85('0x3c')](_0x19259f['id'][_0xaa85('0x40')](),_0x14b5b6)[_0xaa85('0x3c')](_0xaa85('0x3d'),_0xaa85('0x41'))[_0xaa85('0x3c')](_0xaa85('0x3d'),'updatedAt')[_0xaa85('0x42')]('cm_contacts')[_0xaa85('0x43')](_0xaa85('0x44'))[_0xaa85('0x43')](_0xaa85('0x45'),LISTID[_0xaa85('0x40')]())[_0xaa85('0x43')](_0xaa85('0x46'))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()['field']('phone')[_0xaa85('0x42')]('cm_hopper')[_0xaa85('0x43')](_0x14b5b6+_0xaa85('0x47'),_0x19259f['id'][_0xaa85('0x40')]())))[_0xaa85('0x40')]();return _0x44c439;};var _0x2663ea=function(_0xcfece8,_0x36ed10){var _0x3a98b0=squel[_0xaa85('0x48')]()[_0xaa85('0x37')]('cm_hopper')[_0xaa85('0x39')](['phone',_0xaa85('0x3e'),_0xaa85('0x3f'),_0xaa85('0x28'),_0x36ed10,_0xaa85('0x41'),'updatedAt'],squel[_0xaa85('0x3b')]()['field'](_0xaa85('0x21'),'phone')[_0xaa85('0x3c')](_0xaa85('0x3d'),_0xaa85('0x3e'))['field']('id','ContactId')[_0xaa85('0x3c')](LISTID[_0xaa85('0x40')](),_0xaa85('0x28'))['field'](_0xcfece8['id']['toString'](),_0x36ed10)[_0xaa85('0x3c')](_0xaa85('0x3d'),_0xaa85('0x41'))[_0xaa85('0x3c')](_0xaa85('0x3d'),'updatedAt')[_0xaa85('0x42')]('cm_contacts')[_0xaa85('0x43')](_0xaa85('0x44'))[_0xaa85('0x43')](_0xaa85('0x45'),LISTID[_0xaa85('0x40')]())[_0xaa85('0x43')](_0xaa85('0x49'),squel[_0xaa85('0x4a')](hopperContacts))[_0xaa85('0x43')](_0xaa85('0x46'))['where'](_0xaa85('0x4b'),squel['select']()[_0xaa85('0x3c')]('calleridnum')[_0xaa85('0x42')]('cm_hopper_final')[_0xaa85('0x43')](_0x36ed10+'\x20=\x20?',_0xcfece8['id'][_0xaa85('0x40')]()))[_0xaa85('0x43')](_0xaa85('0x4b'),squel[_0xaa85('0x3b')]()[_0xaa85('0x3c')](_0xaa85('0x21'))[_0xaa85('0x42')](_0xaa85('0x38'))[_0xaa85('0x43')](_0x36ed10+'\x20=\x20?',_0xcfece8['id'][_0xaa85('0x40')]())))[_0xaa85('0x40')]();return _0x3a98b0;};function _0x604a52(_0x527458,_0x122d9f){var _0x38b168=squel[_0xaa85('0x48')]()[_0xaa85('0x37')]('cm_hopper')[_0xaa85('0x39')](['phone',_0xaa85('0x3e'),_0xaa85('0x3f'),_0xaa85('0x28'),_0x122d9f,'createdAt',_0xaa85('0x3a')],squel[_0xaa85('0x3b')]()[_0xaa85('0x3c')](_0xaa85('0x21'),'phone')[_0xaa85('0x3c')](_0xaa85('0x3d'),'scheduledAt')[_0xaa85('0x3c')]('id',_0xaa85('0x3f'))[_0xaa85('0x3c')](LISTID[_0xaa85('0x40')](),'ListId')[_0xaa85('0x3c')](_0x527458['id'][_0xaa85('0x40')](),_0x122d9f)[_0xaa85('0x3c')](_0xaa85('0x3d'),_0xaa85('0x41'))[_0xaa85('0x3c')](_0xaa85('0x3d'),'updatedAt')[_0xaa85('0x42')](_0xaa85('0x4c'))[_0xaa85('0x43')](_0xaa85('0x44'))[_0xaa85('0x43')](_0xaa85('0x45'),LISTID[_0xaa85('0x40')]())[_0xaa85('0x43')](_0xaa85('0x49'),squel[_0xaa85('0x4a')](hopperContacts))[_0xaa85('0x43')](_0xaa85('0x46')))[_0xaa85('0x40')]();return _0x38b168;}function _0x2b28b1(_0x3649ab,_0x14b873){var _0x314779=squel['insert']()['into']('cm_hopper_black')[_0xaa85('0x39')]([_0xaa85('0x21'),_0xaa85('0x3f'),_0xaa85('0x28'),_0x14b873,_0xaa85('0x41'),_0xaa85('0x3a')],squel[_0xaa85('0x3b')]()[_0xaa85('0x3c')](_0xaa85('0x21'),_0xaa85('0x21'))[_0xaa85('0x3c')]('id','ContactId')[_0xaa85('0x3c')](LISTID[_0xaa85('0x40')](),_0xaa85('0x28'))[_0xaa85('0x3c')](_0x3649ab['id']['toString'](),_0x14b873)[_0xaa85('0x3c')](_0xaa85('0x3d'),_0xaa85('0x41'))[_0xaa85('0x3c')](_0xaa85('0x3d'),_0xaa85('0x3a'))[_0xaa85('0x42')](_0xaa85('0x4c'))['where']('deletedAt\x20IS\x20NULL')[_0xaa85('0x43')](_0xaa85('0x45'),LISTID['toString']())[_0xaa85('0x43')](_0xaa85('0x49'),squel['str'](hopperContacts))[_0xaa85('0x43')](_0xaa85('0x46')))[_0xaa85('0x40')]();return _0x314779;}return db[_0xaa85('0x4d')][_0xaa85('0x4e')]({'where':{'type':_0xaa85('0x4f')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0xaa85('0x50'),'where':{'id':LISTID}}]})[_0xaa85('0x2f')](function(_0x40a313){var _0x137b99=[];if(_0x40a313){var _0x9f4279;for(var _0x130517=0x0,_0xc97b1a;_0x130517<_0x40a313[_0xaa85('0x2a')];_0x130517+=0x1){_0xc97b1a=_0x40a313[_0x130517][_0xaa85('0x51')]({'plain':!![]});switch(_0xc97b1a[_0xaa85('0x52')]){case _0xaa85('0x53'):_0x137b99[_0xaa85('0x30')](db[_0xaa85('0x54')]['query'](_0x2663ea(_0xc97b1a,_0xaa85('0x55')))[_0xaa85('0x2f')](function(){})[_0xaa85('0x32')](_0x187437()));break;case _0xaa85('0x56'):_0x137b99[_0xaa85('0x30')](db[_0xaa85('0x54')]['query'](_0x5b990f(_0xc97b1a,'VoiceQueueId'))[_0xaa85('0x2f')](function(){})[_0xaa85('0x32')](_0x187437()));break;default:_0x137b99['push'](db[_0xaa85('0x54')][_0xaa85('0x57')](_0x604a52(_0xc97b1a,'VoiceQueueId'))[_0xaa85('0x2f')](function(){})[_0xaa85('0x32')](_0x187437()));}}}return _0x137b99;})['all']()[_0xaa85('0x2f')](function(){return db['VoiceQueue'][_0xaa85('0x4e')]({'where':{'type':_0xaa85('0x4f')},'attributes':['id'],'include':[{'model':db[_0xaa85('0x58')],'as':_0xaa85('0x59'),'where':{'id':LISTID}}]})[_0xaa85('0x2f')](function(_0x2dc9e3){var _0x11d9f3=[];if(_0x2dc9e3){var _0x314f62;for(var _0x2cc094=0x0,_0x14dacf;_0x2cc094<_0x2dc9e3[_0xaa85('0x2a')];_0x2cc094+=0x1){_0x14dacf=_0x2dc9e3[_0x2cc094][_0xaa85('0x51')]({'plain':!![]});_0x11d9f3[_0xaa85('0x30')](db[_0xaa85('0x54')][_0xaa85('0x57')](_0x2b28b1(_0x14dacf,_0xaa85('0x55')))[_0xaa85('0x2f')](function(){})['catch'](_0x187437()));}}return _0x11d9f3;})[_0xaa85('0x5a')]();})[_0xaa85('0x2f')](function(){return db[_0xaa85('0x5b')]['findAll']({'attributes':['id',_0xaa85('0x52')],'include':[{'model':db[_0xaa85('0x58')],'as':'Lists','where':{'id':LISTID}}]})[_0xaa85('0x2f')](function(_0x289f37){var _0x3d92c5=[];if(_0x289f37){for(var _0x4d2cb6=0x0,_0x47e996;_0x4d2cb6<_0x289f37[_0xaa85('0x2a')];_0x4d2cb6+=0x1){_0x47e996=_0x289f37[_0x4d2cb6]['get']({'plain':!![]});switch(_0x47e996['dialCheckDuplicateType']){case _0xaa85('0x53'):_0x3d92c5[_0xaa85('0x30')](db[_0xaa85('0x54')][_0xaa85('0x57')](_0x2663ea(_0x47e996,_0xaa85('0x5c')))['then'](function(){})['catch'](_0x187437()));break;case _0xaa85('0x56'):_0x3d92c5['push'](db[_0xaa85('0x54')][_0xaa85('0x57')](_0x5b990f(_0x47e996,_0xaa85('0x5c')))[_0xaa85('0x2f')](function(){})['catch'](_0x187437()));break;default:_0x3d92c5[_0xaa85('0x30')](db['sequelize']['query'](_0x604a52(_0x47e996,_0xaa85('0x5c')))[_0xaa85('0x2f')](function(){})[_0xaa85('0x32')](_0x187437()));}}}return _0x3d92c5;})['all']();})[_0xaa85('0x2f')](function(){return db['Campaign'][_0xaa85('0x4e')]({'attributes':['id'],'include':[{'model':db[_0xaa85('0x58')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xaa85('0x2f')](function(_0x355520){var _0xe8356f=[];if(_0x355520){for(var _0x1c51d1=0x0,_0x5201f9;_0x1c51d1<_0x355520['length'];_0x1c51d1+=0x1){_0x5201f9=_0x355520[_0x1c51d1][_0xaa85('0x51')]({'plain':!![]});_0xe8356f['push'](db[_0xaa85('0x54')][_0xaa85('0x57')](_0x2b28b1(_0x5201f9,'CampaignId'))[_0xaa85('0x2f')](function(){})['catch'](_0x187437()));}}return _0xe8356f;})['all']();})[_0xaa85('0x32')](function(_0x536a8e){logger[_0xaa85('0x17')](_0xaa85('0x5d'),'generalCheckHopper',_0x536a8e[_0xaa85('0x1b')]);});}var processPromises=function(_0x273aee){return BPromise[_0xaa85('0x5a')](promises)[_0xaa85('0x2f')](function(_0x5a9dd3){})['catch'](function(_0x3ceaf5){logger['error'](_0xaa85('0x5e'),JSON[_0xaa85('0x34')](_0x3ceaf5));})[_0xaa85('0x5f')](function(){socket['emit'](_0xaa85('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x273aee){return _0x273aee[_0xaa85('0x61')]();}});};var endCsv=function(){return BPromise[_0xaa85('0x62')]()['then'](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xaa85('0x63')](_0xaa85('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xaa85('0x64')](FILEPATH);}catch(_0x2e79cf){logger['error'](_0xaa85('0x65'),JSON['stringify'](_0x2e79cf));}finally{process[_0xaa85('0x66')](0x0);}});};process['on'](_0xaa85('0x67'),function(){logger[_0xaa85('0x68')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xaa85('0x62')]()[_0xaa85('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact'][_0xaa85('0x4e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xaa85('0x2f')](function(_0x31fd42){var _0x30c8ae=fs[_0xaa85('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x30c8ae,{'header':!![],'skipEmptyLines':!![],'step':function(_0x311a41,_0x8a907){total+=0x1;var _0x3c460d=total;promises[_0xaa85('0x30')](checkRow(_0x311a41,_0x31fd42,_0x3c460d)[_0xaa85('0x2f')](function(){success+=0x1;})[_0xaa85('0x32')](function(_0x4b0f8f){if(_0x4b0f8f['error']){errors+=0x1;delete _0x4b0f8f['error'];}else if(_0x4b0f8f[_0xaa85('0x2c')]){duplicates+=0x1;delete _0x4b0f8f[_0xaa85('0x2c')];}rows[_0xaa85('0x30')](_0x4b0f8f);}));if(total%0xc8===0x0){_0x8a907[_0xaa85('0x6a')]();return processPromises(_0x8a907);}},'complete':function(){return processPromises()['then'](function(){logger[_0xaa85('0x68')](_0xaa85('0x6b'));endCsv();});},'error':function(_0x3c14db,_0x1d87f7){logger[_0xaa85('0x68')](_0xaa85('0x6c'),JSON[_0xaa85('0x34')](_0x3c14db));endCsv();}});})[_0xaa85('0x32')](function(_0x40c101){logger[_0xaa85('0x17')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xaa85('0x34')](_0x40c101));});}main(); \ No newline at end of file +var _0xabe0=['where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','from','cm_hopper','\x20=\x20?','fromQuery','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','always','query','VoiceQueueId','then','sequelize','findAll','BlackLists','get','all','Campaign','onlyIfOpen','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','error','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','Duplicate\x20Contact','CmContact','keys','push','pick','catch','stringify','insert','into','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','cm_contacts'];(function(_0x3a023f,_0x3a0789){var _0x1de363=function(_0x239e8e){while(--_0x239e8e){_0x3a023f['push'](_0x3a023f['shift']());}};_0x1de363(++_0x3a0789);}(_0xabe0,0x180));var _0x0abe=function(_0x22b0ad,_0x3cafd4){_0x22b0ad=_0x22b0ad-0x0;var _0x37a35e=_0xabe0[_0x22b0ad];return _0x37a35e;};'use strict';var BPromise=require(_0x0abe('0x0'));var util=require(_0x0abe('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x0abe('0x2'));var Papa=require(_0x0abe('0x3'));var Redis=require(_0x0abe('0x4'));var db=require(_0x0abe('0x5'))['db'];var config=require(_0x0abe('0x6'));var logger=require(_0x0abe('0x7'))(_0x0abe('0x8'));config[_0x0abe('0x9')]=_[_0x0abe('0xa')](config[_0x0abe('0x9')],{'host':_0x0abe('0xb'),'port':0x18eb});var socket=require(_0x0abe('0xc'))(new Redis(config[_0x0abe('0x9')]));require(_0x0abe('0xd'))[_0x0abe('0xe')](socket);try{if(!process[_0x0abe('0xf')][0x2]||process[_0x0abe('0xf')][0x2]===_0x0abe('0x10')||process[_0x0abe('0xf')][0x2]==='null'){throw new Error(_0x0abe('0x11'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process[_0x0abe('0xf')][0x3]===_0x0abe('0x10')||process[_0x0abe('0xf')][0x3]===_0x0abe('0x12')||!process[_0x0abe('0xf')][0x4]||process[_0x0abe('0xf')][0x4]==='undefined'||process[_0x0abe('0xf')][0x4]===_0x0abe('0x12')){throw new Error(_0x0abe('0x13'));}var FIELDS=_[_0x0abe('0x14')](process[_0x0abe('0xf')][0x3][_0x0abe('0x15')](','),process[_0x0abe('0xf')][0x4][_0x0abe('0x15')](','));if(!process[_0x0abe('0xf')][0x5]||process['argv'][0x5]===_0x0abe('0x10')||process['argv'][0x5]===_0x0abe('0x12')){throw new Error(_0x0abe('0x16'));}var LISTID=process[_0x0abe('0xf')][0x5];var COMPANYID=process[_0x0abe('0xf')][0x6]&&process['argv'][0x6]!=='undefined'&&process[_0x0abe('0xf')][0x6]!=='null'?process[_0x0abe('0xf')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x0abe('0xf')][0x7]!==_0x0abe('0x10')&&process[_0x0abe('0xf')][0x7]!==_0x0abe('0x12')?process[_0x0abe('0xf')][0x7]:null;if(!process['argv'][0x8]||process[_0x0abe('0xf')][0x8]==='undefined'||process[_0x0abe('0xf')][0x8]===_0x0abe('0x12')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x0abe('0xf')][0x8];}catch(_0x4aed29){logger['error'](_0x4aed29);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(_0x5e315e,_0x59be55,_0x4c5b05,_0x947a8f){var _0x59d27c={'message':_0x59be55};_0x59d27c[_0x5e315e]=!![];if(_0x4c5b05){_0x59d27c['contact']=_0x4c5b05;}if(_0x947a8f){_0x59d27c[_0x0abe('0x17')]=_0x947a8f;}return _0x59d27c;}function isEmail(_0x5add19){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))*$/[_0x0abe('0x18')](_0x5add19);}function checkRow(_0x1f5331,_0x3d696d,_0x9e1e0){return new BPromise(function(_0xcd29bc,_0x4b53c){if(_[_0x0abe('0x19')](_0x1f5331)){return _0x4b53c(handleCheckRowError('error',_0x0abe('0x1a'),null,_0x9e1e0));}if(_0x1f5331[_0x0abe('0x1b')]&&_0x1f5331[_0x0abe('0x1b')][_0x0abe('0x1c')]){var _0x470be5=_[_0x0abe('0x1d')](_0x1f5331['errors'],_0x0abe('0x1e'))[_0x0abe('0x1f')](';');return _0x4b53c(handleCheckRowError('error',_0x470be5,null,_0x9e1e0));}var _0x40b37b={};for(var _0x3f9df2 in FIELDS){if(FIELDS[_0x0abe('0x20')](_0x3f9df2)&&FIELDS[_0x3f9df2]){_0x40b37b[_0x3f9df2]=_0x1f5331[_0x0abe('0x21')][0x0][FIELDS[_0x3f9df2]]||_0x1f5331[_0x0abe('0x21')][0x0]['\ufeff'+FIELDS[_0x3f9df2]];}}if(!_0x40b37b[_0x0abe('0x22')]){return _0x4b53c(handleCheckRowError(_0x0abe('0x23'),_0x0abe('0x24'),null,_0x9e1e0));}if(!_0x40b37b[_0x0abe('0x25')]){return _0x4b53c(handleCheckRowError(_0x0abe('0x23'),_0x0abe('0x26'),null,_0x9e1e0));}if(_0x40b37b[_0x0abe('0x27')]){var _0x475318=moment(_0x40b37b['birthDate'],'YYYY-MM-DD');if(!_0x475318['isValid']()){return _0x4b53c(handleCheckRowError(_0x0abe('0x23'),_0x0abe('0x28'),null,_0x9e1e0));}}if(_0x40b37b[_0x0abe('0x29')]){if(!isEmail(_0x40b37b[_0x0abe('0x29')])){return _0x4b53c(handleCheckRowError(_0x0abe('0x23'),_0x0abe('0x2a'),null,_0x9e1e0));}}_0x40b37b[_0x0abe('0x2b')]=LISTID;_0x40b37b[_0x0abe('0x2c')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0abe('0x1c')]&&_0x3d696d){var _0xfcf96={};for(var _0x449fad=0x0,_0xa7c346=DUPLICATES['length'];_0x449fad<_0xa7c346;_0x449fad+=0x1){_0xfcf96[DUPLICATES[_0x449fad]]=_0x40b37b[DUPLICATES[_0x449fad]];}var _0x541989=_['find'](_0x3d696d,_0xfcf96);if(_0x541989){return _0x4b53c(handleCheckRowError(_0x0abe('0x2d'),_0x0abe('0x2e'),_0x541989,_0x9e1e0));}}return db[_0x0abe('0x2f')]['create'](_0x40b37b,{'raw':!![],'hooks':![],'fields':_[_0x0abe('0x30')](_0x40b37b)})['then'](function(_0x402be9){if(DUPLICATES&&DUPLICATES[_0x0abe('0x1c')]&&_0x3d696d){_0x3d696d[_0x0abe('0x31')](_[_0x0abe('0x32')](_0x40b37b,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x402be9['id'];return _0xcd29bc();})[_0x0abe('0x33')](function(_0x4ed272){return _0x4b53c(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x4ed272['message']||JSON[_0x0abe('0x34')](_0x4ed272)),null,_0x9e1e0));});});}function checkHopper(){function _0x4357dd(){return function(_0x4f3825){logger[_0x0abe('0x23')]('cmContact','checkHopper',util['inspect'](_0x4f3825,{'showHidden':![],'depth':null}));};}var _0x5a4794=function(_0x49834b,_0x35a3dc){var _0x1179f1=squel[_0x0abe('0x35')]()[_0x0abe('0x36')]('cm_hopper')['fromQuery'](['phone',_0x0abe('0x37'),_0x0abe('0x38'),_0x0abe('0x2b'),_0x35a3dc,'createdAt',_0x0abe('0x39')],squel[_0x0abe('0x3a')]()[_0x0abe('0x3b')](_0x0abe('0x25'),'phone')[_0x0abe('0x3b')](_0x0abe('0x3c'),'scheduledAt')[_0x0abe('0x3b')]('id',_0x0abe('0x38'))['field'](LISTID['toString'](),_0x0abe('0x2b'))['field'](_0x49834b['id'][_0x0abe('0x3d')](),_0x35a3dc)[_0x0abe('0x3b')](_0x0abe('0x3c'),_0x0abe('0x3e'))[_0x0abe('0x3b')]('NOW()',_0x0abe('0x39'))['from'](_0x0abe('0x3f'))[_0x0abe('0x40')](_0x0abe('0x41'))[_0x0abe('0x40')](_0x0abe('0x42'),LISTID[_0x0abe('0x3d')]())[_0x0abe('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x0abe('0x40')](_0x0abe('0x43'),squel[_0x0abe('0x3a')]()[_0x0abe('0x3b')]('phone')[_0x0abe('0x44')](_0x0abe('0x45'))[_0x0abe('0x40')](_0x35a3dc+_0x0abe('0x46'),_0x49834b['id'][_0x0abe('0x3d')]())))[_0x0abe('0x3d')]();return _0x1179f1;};var _0x2a26a1=function(_0x3ba483,_0x1f7163){var _0x30daec=squel['insert']()[_0x0abe('0x36')](_0x0abe('0x45'))[_0x0abe('0x47')]([_0x0abe('0x25'),_0x0abe('0x37'),_0x0abe('0x38'),_0x0abe('0x2b'),_0x1f7163,_0x0abe('0x3e'),_0x0abe('0x39')],squel['select']()[_0x0abe('0x3b')](_0x0abe('0x25'),_0x0abe('0x25'))[_0x0abe('0x3b')](_0x0abe('0x3c'),_0x0abe('0x37'))[_0x0abe('0x3b')]('id',_0x0abe('0x38'))[_0x0abe('0x3b')](LISTID[_0x0abe('0x3d')](),_0x0abe('0x2b'))[_0x0abe('0x3b')](_0x3ba483['id'][_0x0abe('0x3d')](),_0x1f7163)[_0x0abe('0x3b')](_0x0abe('0x3c'),_0x0abe('0x3e'))['field']('NOW()',_0x0abe('0x39'))[_0x0abe('0x44')](_0x0abe('0x3f'))[_0x0abe('0x40')](_0x0abe('0x41'))['where'](_0x0abe('0x42'),LISTID[_0x0abe('0x3d')]())[_0x0abe('0x40')](_0x0abe('0x48'),squel[_0x0abe('0x49')](hopperContacts))[_0x0abe('0x40')](_0x0abe('0x4a'))[_0x0abe('0x40')](_0x0abe('0x43'),squel['select']()['field'](_0x0abe('0x4b'))[_0x0abe('0x44')](_0x0abe('0x4c'))[_0x0abe('0x40')](_0x1f7163+'\x20=\x20?',_0x3ba483['id'][_0x0abe('0x3d')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0abe('0x3a')]()['field'](_0x0abe('0x25'))[_0x0abe('0x44')]('cm_hopper')[_0x0abe('0x40')](_0x1f7163+_0x0abe('0x46'),_0x3ba483['id'][_0x0abe('0x3d')]())))[_0x0abe('0x3d')]();return _0x30daec;};function _0xc131b5(_0x36d735,_0x21815d){var _0x3df396=squel[_0x0abe('0x35')]()[_0x0abe('0x36')](_0x0abe('0x45'))['fromQuery']([_0x0abe('0x25'),'scheduledAt','ContactId',_0x0abe('0x2b'),_0x21815d,_0x0abe('0x3e'),_0x0abe('0x39')],squel[_0x0abe('0x3a')]()[_0x0abe('0x3b')](_0x0abe('0x25'),'phone')[_0x0abe('0x3b')](_0x0abe('0x3c'),_0x0abe('0x37'))[_0x0abe('0x3b')]('id',_0x0abe('0x38'))[_0x0abe('0x3b')](LISTID[_0x0abe('0x3d')](),_0x0abe('0x2b'))['field'](_0x36d735['id'][_0x0abe('0x3d')](),_0x21815d)['field'](_0x0abe('0x3c'),_0x0abe('0x3e'))[_0x0abe('0x3b')](_0x0abe('0x3c'),_0x0abe('0x39'))[_0x0abe('0x44')](_0x0abe('0x3f'))[_0x0abe('0x40')](_0x0abe('0x41'))[_0x0abe('0x40')]('ListId\x20=\x20?',LISTID['toString']())[_0x0abe('0x40')]('id\x20IN\x20?',squel[_0x0abe('0x49')](hopperContacts))[_0x0abe('0x40')](_0x0abe('0x4a')))[_0x0abe('0x3d')]();return _0x3df396;}function _0x5f30cf(_0x46ba43,_0x10e95f){var _0x578f3b=squel[_0x0abe('0x35')]()[_0x0abe('0x36')]('cm_hopper_black')[_0x0abe('0x47')](['phone',_0x0abe('0x38'),_0x0abe('0x2b'),_0x10e95f,'createdAt',_0x0abe('0x39')],squel['select']()[_0x0abe('0x3b')]('phone',_0x0abe('0x25'))[_0x0abe('0x3b')]('id',_0x0abe('0x38'))['field'](LISTID[_0x0abe('0x3d')](),_0x0abe('0x2b'))[_0x0abe('0x3b')](_0x46ba43['id'][_0x0abe('0x3d')](),_0x10e95f)[_0x0abe('0x3b')]('NOW()','createdAt')[_0x0abe('0x3b')]('NOW()',_0x0abe('0x39'))[_0x0abe('0x44')](_0x0abe('0x3f'))[_0x0abe('0x40')](_0x0abe('0x41'))[_0x0abe('0x40')](_0x0abe('0x42'),LISTID['toString']())[_0x0abe('0x40')](_0x0abe('0x48'),squel['str'](hopperContacts))[_0x0abe('0x40')](_0x0abe('0x4a')))['toString']();return _0x578f3b;}return db[_0x0abe('0x4d')]['findAll']({'where':{'type':_0x0abe('0x4e')},'attributes':['id',_0x0abe('0x4f')],'include':[{'model':db[_0x0abe('0x50')],'as':_0x0abe('0x51'),'where':{'id':LISTID}}]})['then'](function(_0x29710f){var _0x4f9370=[];if(_0x29710f){var _0x2427aa;for(var _0x1e51e9=0x0,_0x7494c2;_0x1e51e9<_0x29710f['length'];_0x1e51e9+=0x1){_0x7494c2=_0x29710f[_0x1e51e9]['get']({'plain':!![]});switch(_0x7494c2[_0x0abe('0x4f')]){case _0x0abe('0x52'):_0x4f9370[_0x0abe('0x31')](db['sequelize'][_0x0abe('0x53')](_0x2a26a1(_0x7494c2,_0x0abe('0x54')))[_0x0abe('0x55')](function(){})[_0x0abe('0x33')](_0x4357dd()));break;case'onlyIfOpen':_0x4f9370[_0x0abe('0x31')](db[_0x0abe('0x56')][_0x0abe('0x53')](_0x5a4794(_0x7494c2,_0x0abe('0x54')))[_0x0abe('0x55')](function(){})[_0x0abe('0x33')](_0x4357dd()));break;default:_0x4f9370[_0x0abe('0x31')](db[_0x0abe('0x56')]['query'](_0xc131b5(_0x7494c2,_0x0abe('0x54')))[_0x0abe('0x55')](function(){})[_0x0abe('0x33')](_0x4357dd()));}}}return _0x4f9370;})['all']()[_0x0abe('0x55')](function(){return db[_0x0abe('0x4d')][_0x0abe('0x57')]({'where':{'type':_0x0abe('0x4e')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0abe('0x58'),'where':{'id':LISTID}}]})[_0x0abe('0x55')](function(_0x10c4a0){var _0x117cff=[];if(_0x10c4a0){var _0x4c0a79;for(var _0x7d8e49=0x0,_0x389877;_0x7d8e49<_0x10c4a0[_0x0abe('0x1c')];_0x7d8e49+=0x1){_0x389877=_0x10c4a0[_0x7d8e49][_0x0abe('0x59')]({'plain':!![]});_0x117cff['push'](db[_0x0abe('0x56')][_0x0abe('0x53')](_0x5f30cf(_0x389877,_0x0abe('0x54')))[_0x0abe('0x55')](function(){})[_0x0abe('0x33')](_0x4357dd()));}}return _0x117cff;})[_0x0abe('0x5a')]();})[_0x0abe('0x55')](function(){return db[_0x0abe('0x5b')][_0x0abe('0x57')]({'attributes':['id',_0x0abe('0x4f')],'include':[{'model':db['CmList'],'as':_0x0abe('0x51'),'where':{'id':LISTID}}]})[_0x0abe('0x55')](function(_0x46bbc8){var _0x3c8408=[];if(_0x46bbc8){for(var _0x94f4d1=0x0,_0x9d5f20;_0x94f4d1<_0x46bbc8[_0x0abe('0x1c')];_0x94f4d1+=0x1){_0x9d5f20=_0x46bbc8[_0x94f4d1][_0x0abe('0x59')]({'plain':!![]});switch(_0x9d5f20[_0x0abe('0x4f')]){case'always':_0x3c8408['push'](db[_0x0abe('0x56')][_0x0abe('0x53')](_0x2a26a1(_0x9d5f20,'CampaignId'))[_0x0abe('0x55')](function(){})[_0x0abe('0x33')](_0x4357dd()));break;case _0x0abe('0x5c'):_0x3c8408[_0x0abe('0x31')](db[_0x0abe('0x56')][_0x0abe('0x53')](_0x5a4794(_0x9d5f20,'CampaignId'))[_0x0abe('0x55')](function(){})[_0x0abe('0x33')](_0x4357dd()));break;default:_0x3c8408[_0x0abe('0x31')](db[_0x0abe('0x56')]['query'](_0xc131b5(_0x9d5f20,_0x0abe('0x5d')))[_0x0abe('0x55')](function(){})[_0x0abe('0x33')](_0x4357dd()));}}}return _0x3c8408;})['all']();})[_0x0abe('0x55')](function(){return db[_0x0abe('0x5b')][_0x0abe('0x57')]({'attributes':['id'],'include':[{'model':db[_0x0abe('0x50')],'as':_0x0abe('0x58'),'where':{'id':LISTID}}]})[_0x0abe('0x55')](function(_0xc56264){var _0x5051fd=[];if(_0xc56264){for(var _0x389720=0x0,_0x11453b;_0x389720<_0xc56264[_0x0abe('0x1c')];_0x389720+=0x1){_0x11453b=_0xc56264[_0x389720][_0x0abe('0x59')]({'plain':!![]});_0x5051fd[_0x0abe('0x31')](db[_0x0abe('0x56')][_0x0abe('0x53')](_0x5f30cf(_0x11453b,'CampaignId'))[_0x0abe('0x55')](function(){})['catch'](_0x4357dd()));}}return _0x5051fd;})[_0x0abe('0x5a')]();})['catch'](function(_0x3acb08){logger['error'](_0x0abe('0x5e'),_0x0abe('0x5f'),_0x3acb08[_0x0abe('0x1e')]);});}var processPromises=function(_0x3d6a75){return BPromise[_0x0abe('0x5a')](promises)[_0x0abe('0x55')](function(_0x1e6220){})[_0x0abe('0x33')](function(_0x17f69f){logger['error'](_0x0abe('0x60'),JSON['stringify'](_0x17f69f));})[_0x0abe('0x61')](function(){socket['emit'](_0x0abe('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3d6a75){return _0x3d6a75[_0x0abe('0x63')]();}});};var endCsv=function(){return BPromise[_0x0abe('0x64')]()[_0x0abe('0x55')](function(){if(hopperContacts){return checkHopper();}})[_0x0abe('0x55')](function(){socket[_0x0abe('0x65')](_0x0abe('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0abe('0x66')](FILEPATH);}catch(_0xc8c743){logger[_0x0abe('0x23')](_0x0abe('0x67'),JSON[_0x0abe('0x34')](_0xc8c743));}finally{process[_0x0abe('0x68')](0x0);}});};process['on'](_0x0abe('0x69'),function(){logger['info'](_0x0abe('0x6a'));endCsv();});function main(){return BPromise[_0x0abe('0x64')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0abe('0x15')](',');return db['CmContact'][_0x0abe('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0abe('0x55')](function(_0x298dbc){var _0x7f7bf5=fs[_0x0abe('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0abe('0x6c')](_0x7f7bf5,{'header':!![],'skipEmptyLines':!![],'step':function(_0x48a300,_0x176f44){total+=0x1;var _0xad0293=total;promises[_0x0abe('0x31')](checkRow(_0x48a300,_0x298dbc,_0xad0293)[_0x0abe('0x55')](function(){success+=0x1;})[_0x0abe('0x33')](function(_0x288ba1){if(_0x288ba1[_0x0abe('0x23')]){errors+=0x1;delete _0x288ba1[_0x0abe('0x23')];}else if(_0x288ba1[_0x0abe('0x2d')]){duplicates+=0x1;delete _0x288ba1[_0x0abe('0x2d')];}rows['push'](_0x288ba1);}));if(total%0xc8===0x0){_0x176f44['pause']();return processPromises(_0x176f44);}},'complete':function(){return processPromises()[_0x0abe('0x55')](function(){logger[_0x0abe('0x6d')](_0x0abe('0x6e'));endCsv();});},'error':function(_0x7b7585,_0x2c0ee8){logger[_0x0abe('0x6d')](_0x0abe('0x6f'),JSON[_0x0abe('0x34')](_0x7b7585));endCsv();}});})[_0x0abe('0x33')](function(_0x10b890){logger[_0x0abe('0x23')]('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x10b890));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 7010afe..92c1563 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 _0xc7e7=['../../../config/logger','import','defaults','redis','socket.io-emitter','format','test','select','field','phone','from','\x20=\x20','where','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','insert','into','cm_hopper','scheduledat','ContactId','createdAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.updatedAt','fromQuery','updatedAt','.CmListId','\x20=\x20?','concat','ListId','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','spread','catch','main','stringify','start','binding','root','.csv','keys','header','writeFileSync','data','rows','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','push','isNaN','isNumber','includes','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','length','SystemRow','appendFileSync','emit','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','contact:import:','unlink','complete','argv','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','papaparse','util','bluebird','squel','ioredis','../../../config/environment'];(function(_0x1d6a4c,_0x4eec27){var _0x553b24=function(_0x27e5e9){while(--_0x27e5e9){_0x1d6a4c['push'](_0x1d6a4c['shift']());}};_0x553b24(++_0x4eec27);}(_0xc7e7,0x103));var _0x7c7e=function(_0x402a33,_0x5267dd){_0x402a33=_0x402a33-0x0;var _0x3772ad=_0xc7e7[_0x402a33];return _0x3772ad;};'use strict';var fs=require('fs');var path=require(_0x7c7e('0x0'));var _=require('lodash');var Papa=require(_0x7c7e('0x1'));var util=require(_0x7c7e('0x2'));var BPromise=require(_0x7c7e('0x3'));var moment=require('moment');var squel=require(_0x7c7e('0x4'));var Redis=require(_0x7c7e('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x7c7e('0x6'));var logger=require(_0x7c7e('0x7'))(_0x7c7e('0x8'));config['redis']=_[_0x7c7e('0x9')](config[_0x7c7e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7c7e('0xb'))(new Redis(config[_0x7c7e('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x7c7e('0xc')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x5bc887){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))*$/[_0x7c7e('0xd')](_0x5bc887);}function selectNotIn(_0x24e922,_0x3df771,_0x227517,_0x1fa5b3,_0x56f294){return squel[_0x7c7e('0xe')]()[_0x7c7e('0xf')](_0x7c7e('0x10'))[_0x7c7e('0x11')](_0x1fa5b3)['join'](_0x3df771,null,_0x3df771+'.id\x20=\x20'+_0x1fa5b3+'.'+_0x227517)['where'](_0x1fa5b3+'.'+_0x227517+_0x7c7e('0x12')+_0x24e922+'.'+_0x227517)[_0x7c7e('0x13')](_0x3df771+'.dialCheckDuplicateType\x20IN\x20('+_0x56f294[_0x7c7e('0x14')]()+')');}function insertCmHopper(_0x7cb421,_0x180aa0,_0x4e7509,_0x1004ea,_0x3d2613){var _0x3472de=[_0x7c7e('0x15'),_0x7c7e('0x16'),_0x7c7e('0x17'),_0x7c7e('0x18'),_0x180aa0+'.'+_0x1004ea,_0x7c7e('0x19'),'cm_contacts.updatedAt',_0x7c7e('0x1a'),'cm_contacts.UserId','\x22'+_0x3d2613+'\x22'];return squel[_0x7c7e('0x1b')]()[_0x7c7e('0x1c')](_0x7c7e('0x1d'))['fromQuery']([_0x7c7e('0x10'),_0x7c7e('0x1e'),_0x7c7e('0x1f'),'ListId',_0x1004ea,_0x7c7e('0x20'),'updatedAt',_0x7c7e('0x21'),_0x7c7e('0x22'),_0x7c7e('0x23')],squel[_0x7c7e('0xe')]()[_0x7c7e('0x24')](_0x3472de)[_0x7c7e('0x11')](_0x180aa0)[_0x7c7e('0x14')](_0x7c7e('0x25'),null,_0x7c7e('0x26')+_0x180aa0+'.CmListId')[_0x7c7e('0x14')](_0x4e7509,null,_0x4e7509+_0x7c7e('0x27')+_0x180aa0+'.'+_0x1004ea)[_0x7c7e('0x13')](_0x180aa0+_0x7c7e('0x28'),_0x7cb421)[_0x7c7e('0x13')](_0x7c7e('0x29'),NOW)['where'](_0x7c7e('0x2a'),selectNotIn(_0x180aa0,_0x4e7509,_0x1004ea,_0x7c7e('0x1d'),[_0x7c7e('0x2b'),_0x7c7e('0x2c')]))[_0x7c7e('0x13')](_0x7c7e('0x2a'),selectNotIn(_0x180aa0,_0x4e7509,_0x1004ea,_0x7c7e('0x1d'),[_0x7c7e('0x2b')])))[_0x7c7e('0x2d')]();}function insertCmHopperBlack(_0x57e133,_0x571667,_0x13a4ef,_0x3c7fe4){var _0x3bab32=['cm_contacts.phone',_0x7c7e('0x17'),'cm_contacts.ListId',_0x571667+'.'+_0x3c7fe4,_0x7c7e('0x19'),_0x7c7e('0x2e')];return squel[_0x7c7e('0x1b')]()[_0x7c7e('0x1c')]('cm_hopper_black')[_0x7c7e('0x2f')]([_0x7c7e('0x10'),_0x7c7e('0x1f'),'ListId',_0x3c7fe4,_0x7c7e('0x20'),_0x7c7e('0x30')],squel[_0x7c7e('0xe')]()['fields'](_0x3bab32)['from'](_0x571667)['join'](_0x7c7e('0x25'),null,_0x7c7e('0x26')+_0x571667+_0x7c7e('0x31'))['join'](_0x13a4ef,null,_0x13a4ef+'.id\x20=\x20'+_0x571667+'.'+_0x3c7fe4)[_0x7c7e('0x13')](_0x571667+_0x7c7e('0x28'),_0x57e133)[_0x7c7e('0x13')](_0x7c7e('0x29'),NOW)[_0x7c7e('0x13')](_0x7c7e('0x2a'),squel[_0x7c7e('0xe')]()[_0x7c7e('0xf')](_0x7c7e('0x10'))[_0x7c7e('0x11')]('cm_hopper_black')[_0x7c7e('0x13')]('ListId\x20=\x20?',_0x57e133)[_0x7c7e('0x13')](_0x3c7fe4+_0x7c7e('0x32'),_0x571667+'.'+_0x3c7fe4)))[_0x7c7e('0x2d')]();}function insertCmContact(_0x1e4cc6,_0x3bb499,_0x1b11b4,_0x579876){var _0x39ede2=_[_0x7c7e('0x33')](_['keys'](_0x579876),[_0x7c7e('0x34'),_0x7c7e('0x35'),_0x7c7e('0x20'),_0x7c7e('0x30')]);return squel[_0x7c7e('0x1b')]()['into'](_0x7c7e('0x25'))[_0x7c7e('0x2f')](_0x39ede2,squel[_0x7c7e('0xe')]()[_0x7c7e('0x24')](_0x39ede2)[_0x7c7e('0x11')](_0x3bb499)[_0x7c7e('0x13')]('('+_0x1b11b4[_0x7c7e('0x14')](',')+_0x7c7e('0x36'),squel['select']()[_0x7c7e('0x24')](_0x1b11b4)['from'](_0x7c7e('0x25'))[_0x7c7e('0x13')]('ListId\x20=\x20?',_0x1e4cc6)['where'](_0x7c7e('0x37')))[_0x7c7e('0x13')](_0x7c7e('0x38'),squel['select']()[_0x7c7e('0xf')](_0x7c7e('0x39'),_0x7c7e('0x3a'))[_0x7c7e('0x11')](_0x3bb499)[_0x7c7e('0x3b')](_0x1b11b4[_0x7c7e('0x14')](','))))[_0x7c7e('0x2d')]();}function handleStop(){logger[_0x7c7e('0x3c')](_0x7c7e('0x3d'));stopped=!![];}function handleUncaughtException(_0x560e2e){logger[_0x7c7e('0x3e')](_0x560e2e[_0x7c7e('0x3f')]);process[_0x7c7e('0x40')](0x1);}function handleError(_0x325180,_0x47ec21){stats[_0x7c7e('0x41')]['push']({'name':_0x47ec21[_0x7c7e('0x42')],'message':_0x47ec21[_0x7c7e('0x3f')],'row':_0x325180});}function handleQuery(_0x42ead3){logger[_0x7c7e('0x3c')](_0x42ead3);return db[_0x7c7e('0x43')]['query'](_0x42ead3)[_0x7c7e('0x44')](function(_0x38753e){results['push'](_0x38753e);})[_0x7c7e('0x45')](function(_0x458034){logger[_0x7c7e('0x3e')](_0x458034['message']);});}function main(_0x18771d,_0x5cbc3e,_0x1e59b3,_0x3d1ab6){logger['info'](_0x7c7e('0x46'),_0x18771d,JSON[_0x7c7e('0x47')](_0x5cbc3e));process['send'](_0x7c7e('0x48'));var _0x7bdd0d=_0x5cbc3e[_0x7c7e('0x49')];var _0x282bc6=_0x5cbc3e['socket_timestamp'];var _0x277e60=path[_0x7c7e('0x14')](config[_0x7c7e('0x4a')],'server/files/tmp',_0x282bc6+_0x7c7e('0x4b'));var _0x1a575c=_[_0x7c7e('0x4c')](_0x7bdd0d)[_0x7c7e('0x14')]();logger[_0x7c7e('0x3c')](_0x7c7e('0x4d'),_0x1a575c);fs[_0x7c7e('0x4e')](_0x277e60,_0x1a575c+'\x0a');Papa['parse'](fs['createReadStream'](_0x18771d),{'header':!![],'skipEmptyLines':!![],'step':function(_0xae66cf,_0x14f1dc){try{for(var _0x40f1e4=0x0,_0x23ca7c=[];_0x40f1e4<_0xae66cf[_0x7c7e('0x4f')]['length'];_0x40f1e4++){stats[_0x7c7e('0x50')]+=0x1;if(_0xae66cf[_0x7c7e('0x41')][_0x40f1e4]){handleError(_0xae66cf[_0x7c7e('0x4f')][_0x40f1e4],_0xae66cf[_0x7c7e('0x41')][_0x40f1e4]);}else{var _0x31c2d8=[];for(var _0x2da78a in _0x7bdd0d){if(_0x7bdd0d['hasOwnProperty'](_0x2da78a)){if(_0xae66cf[_0x7c7e('0x4f')][_0x40f1e4][_0x7bdd0d[_0x2da78a]]){var _0x5ac1c9=_['trim'](_0xae66cf[_0x7c7e('0x4f')][_0x40f1e4][_0x7bdd0d[_0x2da78a]][_0x7c7e('0x51')](/"/g,'\x27'));switch(_0x2da78a){case _0x7c7e('0x1e'):var _0x51a805=moment(_0x5ac1c9,_0x7c7e('0x52'),!![]);if(_0x51a805[_0x7c7e('0x53')]()){_0x23ca7c[_0x7c7e('0x54')]('\x22'+_0x5ac1c9+'\x22');}else{_0x31c2d8['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x7c7e('0x21'):var _0x365148=parseInt(_0x5ac1c9);_0x5ac1c9=_[_0x7c7e('0x55')](_0x365148)||_0x365148<0x0||_0x365148>0x4?_0x3d1ab6?0x3:0x2:_0x365148;_0x23ca7c[_0x7c7e('0x54')]('\x22'+_0x5ac1c9+'\x22');break;case _0x7c7e('0x22'):var _0x4df83e=parseInt(_0x5ac1c9);if(_[_0x7c7e('0x56')](_0x4df83e)&&_[_0x7c7e('0x57')](_0x1e59b3,_0x4df83e)){_0x23ca7c[_0x7c7e('0x54')]('\x22'+_0x4df83e+'\x22');}else{_0x31c2d8[_0x7c7e('0x54')]('agent\x20not\x20exists');}break;case _0x7c7e('0x58'):if(isEmail(_0x5ac1c9)){_0x23ca7c[_0x7c7e('0x54')]('\x22'+_0x5ac1c9+'\x22');}else{_0x31c2d8[_0x7c7e('0x54')](_0x7c7e('0x59'));}break;case _0x7c7e('0x5a'):var _0x47bdbf=moment(_0x5ac1c9,'YYYY-MM-DD',!![]);if(_0x47bdbf['isValid']()){_0x23ca7c[_0x7c7e('0x54')]('\x22'+_0x5ac1c9+'\x22');}else{_0x31c2d8[_0x7c7e('0x54')](_0x7c7e('0x5b'));}break;default:_0x23ca7c[_0x7c7e('0x54')]('\x22'+_0x5ac1c9+'\x22');}}else{switch(_0x2da78a){case _0x7c7e('0x5c'):case'phone':_0x31c2d8[_0x7c7e('0x54')](_0x2da78a+_0x7c7e('0x5d'));break;default:_0x23ca7c[_0x7c7e('0x54')]('\x22\x22');}}}}if(_0x31c2d8[_0x7c7e('0x5e')]){handleError(_0xae66cf[_0x7c7e('0x4f')][_0x40f1e4],{'code':_0x7c7e('0x5f'),'message':_0x31c2d8[_0x7c7e('0x14')]()});}else{fs[_0x7c7e('0x60')](_0x277e60,_0x23ca7c[_0x7c7e('0x14')]()+'\x0a');}_0x23ca7c=[];}if(!(stats[_0x7c7e('0x50')]%0xc8)){socket[_0x7c7e('0x61')]('contact:import:'+_0x282bc6,stats);stats[_0x7c7e('0x41')]=[];}}if(stopped){logger[_0x7c7e('0x3c')](_0x7c7e('0x62'));_0x14f1dc['abort']();}}catch(_0x420ef1){handleError(_0xae66cf['data'][_0x40f1e4],{'code':_0x7c7e('0x63'),'message':_0x420ef1[_0x7c7e('0x3f')]});logger['error'](_0x7c7e('0x64'),_0x420ef1[_0x7c7e('0x3f')]);}},'complete':function(){try{var _0x213ec8=[];var _0xa990c3='cm_contacts';if(_0x5cbc3e[_0x7c7e('0x65')]&&_0x5cbc3e['duplicates'][_0x7c7e('0x5e')]){_0xa990c3=_0x7c7e('0x66')+_0x282bc6;_0x213ec8[_0x7c7e('0x54')]('CREATE\x20TABLE\x20'+_0xa990c3+_0x7c7e('0x67'));}var _0x119161=util[_0x7c7e('0xc')](_0x7c7e('0x68'),_0x277e60,_0xa990c3,_0x1a575c,_0x5cbc3e['ListId'],_0x5cbc3e['CompanyId']||null,NOW,NOW);if(_[_0x7c7e('0x69')](_0x7bdd0d[_0x7c7e('0x1e')])){_0x119161+=_0x7c7e('0x6a');}_0x213ec8['push'](_0x119161);if(_0x5cbc3e[_0x7c7e('0x65')]&&_0x5cbc3e[_0x7c7e('0x65')]['length']){_0x213ec8[_0x7c7e('0x54')](insertCmContact(_0x5cbc3e[_0x7c7e('0x34')],_0xa990c3,_0x5cbc3e[_0x7c7e('0x65')],_0x7bdd0d));_0x213ec8['push'](_0x7c7e('0x6b')+_0xa990c3+';');}_0x213ec8['push'](insertCmHopper(_0x5cbc3e['ListId'],_0x7c7e('0x6c'),_0x7c7e('0x6d'),'VoiceQueueId',_0x3d1ab6));_0x213ec8[_0x7c7e('0x54')](insertCmHopperBlack(_0x5cbc3e[_0x7c7e('0x34')],_0x7c7e('0x6e'),_0x7c7e('0x6d'),_0x7c7e('0x6f')));_0x213ec8['push'](insertCmHopper(_0x5cbc3e[_0x7c7e('0x34')],_0x7c7e('0x70'),_0x7c7e('0x71'),_0x7c7e('0x72'),_0x3d1ab6));_0x213ec8[_0x7c7e('0x54')](insertCmHopperBlack(_0x5cbc3e[_0x7c7e('0x34')],_0x7c7e('0x73'),'campaigns',_0x7c7e('0x72')));BPromise['each'](_0x213ec8,handleQuery)['then'](function(_0x8fe45){stats[_0x7c7e('0x74')]=!![];stats[_0x7c7e('0x75')]=_0x5cbc3e['duplicates']&&_0x5cbc3e[_0x7c7e('0x65')][_0x7c7e('0x5e')]?results[0x2][_0x7c7e('0x75')]:results[0x0][_0x7c7e('0x75')];socket[_0x7c7e('0x61')](_0x7c7e('0x76')+_0x282bc6,stats);fs[_0x7c7e('0x77')](_0x18771d);fs[_0x7c7e('0x77')](_0x277e60);process[_0x7c7e('0x40')](0x0);})[_0x7c7e('0x45')](function(_0x3237b6){logger[_0x7c7e('0x3e')](_0x3237b6[_0x7c7e('0x3f')]);process['exit'](0x1);});}catch(_0x4fc12e){logger['error'](_0x7c7e('0x78'),_0x4fc12e[_0x7c7e('0x3f')]);process[_0x7c7e('0x40')](0x1);}},'error':function(_0x592789,_0x33012a,_0x539ff2,_0x38a615){throw new Error(_0x38a615);}});}function validate(){if(process[_0x7c7e('0x79')]&&process['argv'][_0x7c7e('0x5e')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x24fad9=path[_0x7c7e('0x14')](config[_0x7c7e('0x4a')],_0x7c7e('0x7a'),process[_0x7c7e('0x79')][0x2]);if(!fs[_0x7c7e('0x7b')](_0x24fad9)){throw new Error(_0x7c7e('0x7c'));}var _0x4e1ec5={};try{_0x4e1ec5=JSON[_0x7c7e('0x7d')](process[_0x7c7e('0x79')][0x3]);if(!_0x4e1ec5[_0x7c7e('0x49')]){throw new Error(_0x7c7e('0x7e'));}if(!_0x4e1ec5[_0x7c7e('0x49')][_0x7c7e('0x10')]){throw new Error(_0x7c7e('0x7f'));}if(!_0x4e1ec5[_0x7c7e('0x49')]['firstName']){throw new Error(_0x7c7e('0x80'));}var _0x3cbf03=0x0;if(_0x4e1ec5[_0x7c7e('0x49')]['UserId']){_0x3cbf03=0x1;}if(!_0x4e1ec5[_0x7c7e('0x34')]){throw new Error(_0x7c7e('0x81'));}}catch(_0x396881){throw new Error(_0x7c7e('0x82'));}var _0x23ecd7=[];try{_0x23ecd7=_['map'](JSON[_0x7c7e('0x7d')](process[_0x7c7e('0x79')][0x4]),'id');}catch(_0x4ee098){logger[_0x7c7e('0x3c')](_0x7c7e('0x83'));}main(_0x24fad9,_0x4e1ec5,_0x23ecd7,_0x3cbf03);}validate();process['on']('SIGINT',handleStop);process['on'](_0x7c7e('0x84'),handleUncaughtException); \ No newline at end of file +var _0x6bf9=['rows','errors','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','campaigns','each','then','finish','affectedRows','unlink','exit','complete','argv','server/files/tmp','file\x20doesn\x27t\x20exists','parse','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','SIGINT','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','defaults','localhost','redis','format','YYYY-MM-DD\x20HH:mm:ss','select','field','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','priority','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_hopper_black','phone','updatedAt','from','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','info','Received\x20SIGINT','error','message','push','sequelize','query','spread','catch','main','start','socket_timestamp','root','.csv','writeFileSync','createReadStream','data','length'];(function(_0x8a2d9b,_0xb14bcb){var _0x9d4780=function(_0x5deb33){while(--_0x5deb33){_0x8a2d9b['push'](_0x8a2d9b['shift']());}};_0x9d4780(++_0xb14bcb);}(_0x6bf9,0x1b2));var _0x96bf=function(_0x3e0b8f,_0x1cddeb){_0x3e0b8f=_0x3e0b8f-0x0;var _0x22f742=_0x6bf9[_0x3e0b8f];return _0x22f742;};'use strict';var fs=require('fs');var path=require(_0x96bf('0x0'));var _=require(_0x96bf('0x1'));var Papa=require(_0x96bf('0x2'));var util=require(_0x96bf('0x3'));var BPromise=require(_0x96bf('0x4'));var moment=require(_0x96bf('0x5'));var squel=require(_0x96bf('0x6'));var Redis=require(_0x96bf('0x7'));var db=require('../../../mysqldb')['db'];var config=require(_0x96bf('0x8'));var logger=require(_0x96bf('0x9'))(_0x96bf('0xa'));config['redis']=_[_0x96bf('0xb')](config['redis'],{'host':_0x96bf('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x96bf('0xd')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x96bf('0xe')](_0x96bf('0xf'));function isEmail(_0x1cf5ed){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'](_0x1cf5ed);}function selectNotIn(_0x2a1dcc,_0x26ae16,_0xe6830d,_0x4f71cd,_0x5f595e){return squel[_0x96bf('0x10')]()[_0x96bf('0x11')]('phone')['from'](_0x4f71cd)['join'](_0x26ae16,null,_0x26ae16+_0x96bf('0x12')+_0x4f71cd+'.'+_0xe6830d)[_0x96bf('0x13')](_0x4f71cd+'.'+_0xe6830d+_0x96bf('0x14')+_0x2a1dcc+'.'+_0xe6830d)[_0x96bf('0x13')](_0x26ae16+_0x96bf('0x15')+_0x5f595e[_0x96bf('0x16')]()+')');}function insertCmHopper(_0x5d1e28,_0x35fe00,_0x2f286f,_0x400aa8,_0x1ebb5c){var _0x5be7af=['cm_contacts.phone',_0x96bf('0x17'),_0x96bf('0x18'),_0x96bf('0x19'),_0x35fe00+'.'+_0x400aa8,_0x96bf('0x1a'),_0x96bf('0x1b'),_0x96bf('0x1c'),_0x96bf('0x1d'),'\x22'+_0x1ebb5c+'\x22'];return squel[_0x96bf('0x1e')]()[_0x96bf('0x1f')](_0x96bf('0x20'))[_0x96bf('0x21')](['phone',_0x96bf('0x22'),_0x96bf('0x23'),_0x96bf('0x24'),_0x400aa8,_0x96bf('0x25'),'updatedAt',_0x96bf('0x26'),_0x96bf('0x27'),'recallme'],squel[_0x96bf('0x10')]()[_0x96bf('0x28')](_0x5be7af)['from'](_0x35fe00)[_0x96bf('0x16')](_0x96bf('0x29'),null,_0x96bf('0x2a')+_0x35fe00+_0x96bf('0x2b'))[_0x96bf('0x16')](_0x2f286f,null,_0x2f286f+_0x96bf('0x12')+_0x35fe00+'.'+_0x400aa8)[_0x96bf('0x13')](_0x35fe00+'.CmListId\x20=\x20?',_0x5d1e28)[_0x96bf('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x96bf('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x35fe00,_0x2f286f,_0x400aa8,_0x96bf('0x20'),['\x22always\x22',_0x96bf('0x2c')]))[_0x96bf('0x13')](_0x96bf('0x2d'),selectNotIn(_0x35fe00,_0x2f286f,_0x400aa8,'cm_hopper',[_0x96bf('0x2e')])))[_0x96bf('0x2f')]();}function insertCmHopperBlack(_0x7c652f,_0xb7c7d9,_0x5a46b2,_0x4e7f88){var _0x5456f6=['cm_contacts.phone',_0x96bf('0x18'),_0x96bf('0x19'),_0xb7c7d9+'.'+_0x4e7f88,_0x96bf('0x1a'),_0x96bf('0x1b')];return squel[_0x96bf('0x1e')]()[_0x96bf('0x1f')](_0x96bf('0x30'))[_0x96bf('0x21')]([_0x96bf('0x31'),_0x96bf('0x23'),_0x96bf('0x24'),_0x4e7f88,_0x96bf('0x25'),_0x96bf('0x32')],squel[_0x96bf('0x10')]()[_0x96bf('0x28')](_0x5456f6)[_0x96bf('0x33')](_0xb7c7d9)['join'](_0x96bf('0x29'),null,_0x96bf('0x2a')+_0xb7c7d9+_0x96bf('0x2b'))[_0x96bf('0x16')](_0x5a46b2,null,_0x5a46b2+'.id\x20=\x20'+_0xb7c7d9+'.'+_0x4e7f88)[_0x96bf('0x13')](_0xb7c7d9+'.CmListId\x20=\x20?',_0x7c652f)[_0x96bf('0x13')](_0x96bf('0x34'),NOW)[_0x96bf('0x13')](_0x96bf('0x2d'),squel[_0x96bf('0x10')]()[_0x96bf('0x11')]('phone')['from']('cm_hopper_black')['where'](_0x96bf('0x35'),_0x7c652f)[_0x96bf('0x13')](_0x4e7f88+_0x96bf('0x36'),_0xb7c7d9+'.'+_0x4e7f88)))[_0x96bf('0x2f')]();}function insertCmContact(_0x481c3d,_0x5216e4,_0x33f5eb,_0xb2c93a){var _0x3e0faf=_['concat'](_[_0x96bf('0x37')](_0xb2c93a),[_0x96bf('0x24'),'CompanyId',_0x96bf('0x25'),_0x96bf('0x32')]);return squel['insert']()[_0x96bf('0x1f')](_0x96bf('0x29'))[_0x96bf('0x21')](_0x3e0faf,squel['select']()[_0x96bf('0x28')](_0x3e0faf)[_0x96bf('0x33')](_0x5216e4)[_0x96bf('0x13')]('('+_0x33f5eb[_0x96bf('0x16')](',')+_0x96bf('0x38'),squel[_0x96bf('0x10')]()[_0x96bf('0x28')](_0x33f5eb)[_0x96bf('0x33')](_0x96bf('0x29'))[_0x96bf('0x13')](_0x96bf('0x35'),_0x481c3d)[_0x96bf('0x13')](_0x96bf('0x39')))[_0x96bf('0x13')](_0x96bf('0x3a'),squel[_0x96bf('0x10')]()['field']('MIN(id)',_0x96bf('0x3b'))[_0x96bf('0x33')](_0x5216e4)['group'](_0x33f5eb[_0x96bf('0x16')](','))))['toString']();}function handleStop(){logger[_0x96bf('0x3c')](_0x96bf('0x3d'));stopped=!![];}function handleUncaughtException(_0x34acc9){logger[_0x96bf('0x3e')](_0x34acc9[_0x96bf('0x3f')]);process['exit'](0x1);}function handleError(_0x140a87,_0x468e95){stats['errors'][_0x96bf('0x40')]({'name':_0x468e95['code'],'message':_0x468e95[_0x96bf('0x3f')],'row':_0x140a87});}function handleQuery(_0x22e6aa){logger[_0x96bf('0x3c')](_0x22e6aa);return db[_0x96bf('0x41')][_0x96bf('0x42')](_0x22e6aa)[_0x96bf('0x43')](function(_0x5d4616){results[_0x96bf('0x40')](_0x5d4616);})[_0x96bf('0x44')](function(_0x260359){logger[_0x96bf('0x3e')](_0x260359['message']);});}function main(_0x5941c7,_0x2f4a6c,_0x4de424,_0x58b147){logger[_0x96bf('0x3c')](_0x96bf('0x45'),_0x5941c7,JSON['stringify'](_0x2f4a6c));process['send'](_0x96bf('0x46'));var _0xe671d9=_0x2f4a6c['binding'];var _0x21d3a4=_0x2f4a6c[_0x96bf('0x47')];var _0x7dcc58=path[_0x96bf('0x16')](config[_0x96bf('0x48')],'server/files/tmp',_0x21d3a4+_0x96bf('0x49'));var _0x58cdef=_[_0x96bf('0x37')](_0xe671d9)['join']();logger[_0x96bf('0x3c')]('header',_0x58cdef);fs[_0x96bf('0x4a')](_0x7dcc58,_0x58cdef+'\x0a');Papa['parse'](fs[_0x96bf('0x4b')](_0x5941c7),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4b32cf,_0x177a9a){try{for(var _0xf2ae18=0x0,_0x459942=[];_0xf2ae18<_0x4b32cf[_0x96bf('0x4c')][_0x96bf('0x4d')];_0xf2ae18++){stats[_0x96bf('0x4e')]+=0x1;if(_0x4b32cf['errors'][_0xf2ae18]){handleError(_0x4b32cf[_0x96bf('0x4c')][_0xf2ae18],_0x4b32cf[_0x96bf('0x4f')][_0xf2ae18]);}else{var _0x27e2b8=[];for(var _0x32c76f in _0xe671d9){if(_0xe671d9['hasOwnProperty'](_0x32c76f)){if(_0x4b32cf[_0x96bf('0x4c')][_0xf2ae18][_0xe671d9[_0x32c76f]]){var _0x2dc386=_['trim'](_0x4b32cf['data'][_0xf2ae18][_0xe671d9[_0x32c76f]][_0x96bf('0x50')](/"/g,'\x27'));switch(_0x32c76f){case _0x96bf('0x22'):var _0x30c646=moment(_0x2dc386,_0x96bf('0xf'),!![]);if(_0x30c646[_0x96bf('0x51')]()){_0x459942['push']('\x22'+_0x2dc386+'\x22');}else{_0x27e2b8[_0x96bf('0x40')](_0x96bf('0x52'));}break;case _0x96bf('0x26'):var _0xf85b03=parseInt(_0x2dc386);_0x2dc386=_['isNaN'](_0xf85b03)||_0xf85b03<0x0||_0xf85b03>0x4?_0x58b147?0x3:0x2:_0xf85b03;_0x459942[_0x96bf('0x40')]('\x22'+_0x2dc386+'\x22');break;case _0x96bf('0x27'):var _0x166de4=parseInt(_0x2dc386);if(_[_0x96bf('0x53')](_0x166de4)&&_[_0x96bf('0x54')](_0x4de424,_0x166de4)){_0x459942['push']('\x22'+_0x166de4+'\x22');}else{_0x27e2b8['push'](_0x96bf('0x55'));}break;case _0x96bf('0x56'):if(isEmail(_0x2dc386)){_0x459942[_0x96bf('0x40')]('\x22'+_0x2dc386+'\x22');}else{_0x27e2b8[_0x96bf('0x40')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0xbb5050=moment(_0x2dc386,'YYYY-MM-DD',!![]);if(_0xbb5050[_0x96bf('0x51')]()){_0x459942[_0x96bf('0x40')]('\x22'+_0x2dc386+'\x22');}else{_0x27e2b8[_0x96bf('0x40')](_0x96bf('0x57'));}break;default:_0x459942['push']('\x22'+_0x2dc386+'\x22');}}else{switch(_0x32c76f){case _0x96bf('0x58'):case _0x96bf('0x31'):_0x27e2b8[_0x96bf('0x40')](_0x32c76f+'\x20not\x20specified');break;default:_0x459942[_0x96bf('0x40')]('\x22\x22');}}}}if(_0x27e2b8[_0x96bf('0x4d')]){handleError(_0x4b32cf['data'][_0xf2ae18],{'code':'SystemRow','message':_0x27e2b8['join']()});}else{fs[_0x96bf('0x59')](_0x7dcc58,_0x459942[_0x96bf('0x16')]()+'\x0a');}_0x459942=[];}if(!(stats[_0x96bf('0x4e')]%0xc8)){socket[_0x96bf('0x5a')](_0x96bf('0x5b')+_0x21d3a4,stats);stats['errors']=[];}}if(stopped){logger[_0x96bf('0x3c')](_0x96bf('0x5c'));_0x177a9a[_0x96bf('0x5d')]();}}catch(_0x28d4d8){handleError(_0x4b32cf[_0x96bf('0x4c')][_0xf2ae18],{'code':_0x96bf('0x5e'),'message':_0x28d4d8['message']});logger[_0x96bf('0x3e')](_0x96bf('0x5f'),_0x28d4d8[_0x96bf('0x3f')]);}},'complete':function(){try{var _0x4d826d=[];var _0x45a078=_0x96bf('0x29');if(_0x2f4a6c[_0x96bf('0x60')]&&_0x2f4a6c['duplicates'][_0x96bf('0x4d')]){_0x45a078=_0x96bf('0x61')+_0x21d3a4;_0x4d826d['push'](_0x96bf('0x62')+_0x45a078+_0x96bf('0x63'));}var _0x512720=util['format'](_0x96bf('0x64'),_0x7dcc58,_0x45a078,_0x58cdef,_0x2f4a6c[_0x96bf('0x24')],_0x2f4a6c['CompanyId']||null,NOW,NOW);if(_[_0x96bf('0x65')](_0xe671d9['scheduledat'])){_0x512720+=_0x96bf('0x66');}_0x4d826d['push'](_0x512720);if(_0x2f4a6c[_0x96bf('0x60')]&&_0x2f4a6c[_0x96bf('0x60')][_0x96bf('0x4d')]){_0x4d826d['push'](insertCmContact(_0x2f4a6c['ListId'],_0x45a078,_0x2f4a6c[_0x96bf('0x60')],_0xe671d9));_0x4d826d[_0x96bf('0x40')]('DROP\x20TABLE\x20'+_0x45a078+';');}_0x4d826d[_0x96bf('0x40')](insertCmHopper(_0x2f4a6c[_0x96bf('0x24')],'voice_queues_has_cm_lists',_0x96bf('0x67'),_0x96bf('0x68'),_0x58b147));_0x4d826d[_0x96bf('0x40')](insertCmHopperBlack(_0x2f4a6c['ListId'],_0x96bf('0x69'),_0x96bf('0x67'),'VoiceQueueId'));_0x4d826d[_0x96bf('0x40')](insertCmHopper(_0x2f4a6c['ListId'],_0x96bf('0x6a'),'campaigns',_0x96bf('0x6b'),_0x58b147));_0x4d826d['push'](insertCmHopperBlack(_0x2f4a6c[_0x96bf('0x24')],_0x96bf('0x6c'),_0x96bf('0x6d'),_0x96bf('0x6b')));BPromise[_0x96bf('0x6e')](_0x4d826d,handleQuery)[_0x96bf('0x6f')](function(_0x308a95){stats[_0x96bf('0x70')]=!![];stats[_0x96bf('0x71')]=_0x2f4a6c[_0x96bf('0x60')]&&_0x2f4a6c['duplicates']['length']?results[0x2][_0x96bf('0x71')]:results[0x0]['affectedRows'];socket['emit']('contact:import:'+_0x21d3a4,stats);fs[_0x96bf('0x72')](_0x5941c7);fs[_0x96bf('0x72')](_0x7dcc58);process[_0x96bf('0x73')](0x0);})['catch'](function(_0x52fc86){logger[_0x96bf('0x3e')](_0x52fc86[_0x96bf('0x3f')]);process[_0x96bf('0x73')](0x1);});}catch(_0x20ef0a){logger[_0x96bf('0x3e')](_0x96bf('0x74'),_0x20ef0a[_0x96bf('0x3f')]);process[_0x96bf('0x73')](0x1);}},'error':function(_0x1efde3,_0xe9bc52,_0x327974,_0x4f73a4){throw new Error(_0x4f73a4);}});}function validate(){if(process['argv']&&process[_0x96bf('0x75')]['length']<0x4){throw new Error('arguments\x20\x20\x20');}var _0x3d72a5=path['join'](config[_0x96bf('0x48')],_0x96bf('0x76'),process['argv'][0x2]);if(!fs['existsSync'](_0x3d72a5)){throw new Error(_0x96bf('0x77'));}var _0xd68955={};try{_0xd68955=JSON[_0x96bf('0x78')](process[_0x96bf('0x75')][0x3]);if(!_0xd68955[_0x96bf('0x79')]){throw new Error(_0x96bf('0x7a'));}if(!_0xd68955[_0x96bf('0x79')][_0x96bf('0x31')]){throw new Error(_0x96bf('0x7b'));}if(!_0xd68955[_0x96bf('0x79')][_0x96bf('0x58')]){throw new Error(_0x96bf('0x7c'));}var _0x5ee4d9=0x0;if(_0xd68955[_0x96bf('0x79')]['UserId']){_0x5ee4d9=0x1;}if(!_0xd68955['ListId']){throw new Error(_0x96bf('0x7d'));}}catch(_0x6ce30){throw new Error('body\x20id\x20mandatory');}var _0x404416=[];try{_0x404416=_[_0x96bf('0x7e')](JSON[_0x96bf('0x78')](process['argv'][0x4]),'id');}catch(_0x434e01){logger[_0x96bf('0x3c')]('No\x20agent\x20available');}main(_0x3d72a5,_0xd68955,_0x404416,_0x5ee4d9);}validate();process['on'](_0x96bf('0x7f'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index dfae665..b646522 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3014=['uniqueid','starttime','Answer\x20Time','Complete\x20Time','endtime','duration','billableseconds','getSubjects','voice','inbound','push','variable','calleridnum','getDescriptions','toLowerCase','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','Queue','UniqueId','Date','agentcalledAt','Agent\x20Name','destcalleridname','Agent\x20Number','destcalleridnum','string','Agent\x20Connect','Agent\x20Complete','agentcompleteAt','holdtime','Talk\x20Time','talktime','outbound','Member\x20Name','membername'];(function(_0x1f99a0,_0x50b73d){var _0x1e0849=function(_0x41e764){while(--_0x41e764){_0x1f99a0['push'](_0x1f99a0['shift']());}};_0x1e0849(++_0x50b73d);}(_0x3014,0x1db));var _0x4301=function(_0x2a92b5,_0x1e5677){_0x2a92b5=_0x2a92b5-0x0;var _0x547c4a=_0x3014[_0x2a92b5];return _0x547c4a;};'use strict';exports[_0x4301('0x0')]=function(_0x3a9dcc,_0x445527){var _0x2aa5db=[{'type':'string','content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x3a9dcc['toLowerCase']()){case _0x4301('0x1'):switch(_0x445527['toLowerCase']()){case _0x4301('0x2'):_0x2aa5db[_0x4301('0x3')]({'type':_0x4301('0x4'),'content':'','variableName':'queue'});_0x2aa5db[_0x4301('0x3')]({'type':'variable','content':'','variableName':_0x4301('0x5')});break;case'outbound':_0x2aa5db[_0x4301('0x3')]({'type':'string','content':'Outbound\x20Call','variableName':null});_0x2aa5db[_0x4301('0x3')]({'type':'variable','content':'','variableName':'destcalleridnum'});break;}}return _0x2aa5db;};exports[_0x4301('0x6')]=function(_0x50af33,_0x59d76c){var _0xd7adbc=[];switch(_0x50af33[_0x4301('0x7')]()){case _0x4301('0x1'):switch(_0x59d76c[_0x4301('0x7')]()){case _0x4301('0x2'):_0xd7adbc=[{'type':'string','content':_0x4301('0x8'),'key':null,'keyType':null,'variableName':null},{'type':_0x4301('0x9'),'content':'','key':_0x4301('0xa'),'keyType':_0x4301('0x4'),'variableName':_0x4301('0x5')},{'type':'keyValue','content':'','key':_0x4301('0xb'),'keyType':'variable','variableName':_0x4301('0xc')},{'type':'keyValue','content':'','key':_0x4301('0xd'),'keyType':'variable','variableName':'destexten'},{'type':_0x4301('0x9'),'content':'','key':_0x4301('0xe'),'keyType':_0x4301('0x4'),'variableName':'queue'},{'type':_0x4301('0x9'),'content':'','key':_0x4301('0xf'),'keyType':_0x4301('0x4'),'variableName':'uniqueid'},{'type':_0x4301('0x9'),'content':'','key':_0x4301('0x10'),'keyType':_0x4301('0x4'),'variableName':_0x4301('0x11')},{'type':'string','content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x4301('0x9'),'content':'','key':_0x4301('0x12'),'keyType':_0x4301('0x4'),'variableName':_0x4301('0x13')},{'type':_0x4301('0x9'),'content':'','key':_0x4301('0x14'),'keyType':_0x4301('0x4'),'variableName':_0x4301('0x15')},{'type':_0x4301('0x16'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x4301('0x9'),'content':'','key':'Agent\x20Ring','keyType':_0x4301('0x4'),'variableName':'agentcalledAt'},{'type':_0x4301('0x9'),'content':'','key':_0x4301('0x17'),'keyType':_0x4301('0x4'),'variableName':'agentconnectAt'},{'type':_0x4301('0x9'),'content':'','key':_0x4301('0x18'),'keyType':_0x4301('0x4'),'variableName':_0x4301('0x19')},{'type':'keyValue','content':'','key':'Hold\x20Time','keyType':_0x4301('0x4'),'variableName':_0x4301('0x1a')},{'type':'keyValue','content':'','key':_0x4301('0x1b'),'keyType':_0x4301('0x4'),'variableName':_0x4301('0x1c')}];break;case _0x4301('0x1d'):_0xd7adbc=[{'type':_0x4301('0x16'),'content':_0x4301('0x8'),'variableName':null},{'type':_0x4301('0x9'),'content':'','key':'Called\x20Number','keyType':_0x4301('0x4'),'keyContent':'','variableName':_0x4301('0x15')},{'type':'keyValue','content':'','key':_0x4301('0x1e'),'keyType':_0x4301('0x4'),'keyContent':'','variableName':_0x4301('0x1f')},{'type':_0x4301('0x9'),'content':'','key':_0x4301('0xf'),'keyType':_0x4301('0x4'),'keyContent':'','variableName':_0x4301('0x20')},{'type':_0x4301('0x9'),'content':'','key':_0x4301('0x10'),'keyType':_0x4301('0x4'),'keyContent':'','variableName':_0x4301('0x21')},{'type':'string','content':'***\x20Time\x20Info\x20***'},{'type':_0x4301('0x9'),'content':'','key':_0x4301('0x22'),'keyType':_0x4301('0x4'),'keyContent':'','variableName':'answertime'},{'type':_0x4301('0x9'),'content':'','key':_0x4301('0x23'),'keyType':_0x4301('0x4'),'keyContent':'','variableName':_0x4301('0x24')},{'type':_0x4301('0x9'),'content':'','key':'Duration','keyType':_0x4301('0x4'),'keyContent':'','variableName':_0x4301('0x25')},{'type':_0x4301('0x9'),'content':'','key':'Billable\x20Time','keyType':_0x4301('0x4'),'keyContent':'','variableName':_0x4301('0x26')}];break;}}return _0xd7adbc;}; \ No newline at end of file +var _0x9b04=['Called\x20Number','membername','starttime','Answer\x20Time','answertime','Complete\x20Time','Duration','duration','Billable\x20Time','getSubjects','string','toLowerCase','voice','inbound','variable','push','outbound','destcalleridnum','getDescriptions','Caller\x20Number','calleridnum','keyValue','Queue','queue','UniqueId','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x9b04,0x81));var _0x49b0=function(_0xed9fea,_0x5ed774){_0xed9fea=_0xed9fea-0x0;var _0x198f12=_0x9b04[_0xed9fea];return _0x198f12;};'use strict';exports[_0x49b0('0x0')]=function(_0xade25,_0x21b9ca){var _0x1651f9=[{'type':_0x49b0('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0xade25[_0x49b0('0x2')]()){case _0x49b0('0x3'):switch(_0x21b9ca[_0x49b0('0x2')]()){case _0x49b0('0x4'):_0x1651f9['push']({'type':_0x49b0('0x5'),'content':'','variableName':'queue'});_0x1651f9[_0x49b0('0x6')]({'type':'variable','content':'','variableName':'calleridnum'});break;case _0x49b0('0x7'):_0x1651f9[_0x49b0('0x6')]({'type':_0x49b0('0x1'),'content':'Outbound\x20Call','variableName':null});_0x1651f9[_0x49b0('0x6')]({'type':_0x49b0('0x5'),'content':'','variableName':_0x49b0('0x8')});break;}}return _0x1651f9;};exports[_0x49b0('0x9')]=function(_0x5a32aa,_0xa3639){var _0x431819=[];switch(_0x5a32aa[_0x49b0('0x2')]()){case'voice':switch(_0xa3639[_0x49b0('0x2')]()){case'inbound':_0x431819=[{'type':_0x49b0('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x49b0('0xa'),'keyType':_0x49b0('0x5'),'variableName':_0x49b0('0xb')},{'type':_0x49b0('0xc'),'content':'','key':'Caller\x20Name','keyType':'variable','variableName':'calleridname'},{'type':'keyValue','content':'','key':'Call\x20To','keyType':_0x49b0('0x5'),'variableName':'destexten'},{'type':_0x49b0('0xc'),'content':'','key':_0x49b0('0xd'),'keyType':_0x49b0('0x5'),'variableName':_0x49b0('0xe')},{'type':_0x49b0('0xc'),'content':'','key':_0x49b0('0xf'),'keyType':_0x49b0('0x5'),'variableName':_0x49b0('0x10')},{'type':'keyValue','content':'','key':'Date','keyType':_0x49b0('0x5'),'variableName':_0x49b0('0x11')},{'type':_0x49b0('0x1'),'content':_0x49b0('0x12'),'key':null,'keyType':null,'variableName':null},{'type':_0x49b0('0xc'),'content':'','key':'Agent\x20Name','keyType':_0x49b0('0x5'),'variableName':_0x49b0('0x13')},{'type':_0x49b0('0xc'),'content':'','key':_0x49b0('0x14'),'keyType':'variable','variableName':'destcalleridnum'},{'type':_0x49b0('0x1'),'content':_0x49b0('0x15'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x49b0('0x16'),'keyType':'variable','variableName':'agentcalledAt'},{'type':_0x49b0('0xc'),'content':'','key':_0x49b0('0x17'),'keyType':_0x49b0('0x5'),'variableName':_0x49b0('0x18')},{'type':'keyValue','content':'','key':_0x49b0('0x19'),'keyType':_0x49b0('0x5'),'variableName':_0x49b0('0x1a')},{'type':_0x49b0('0xc'),'content':'','key':_0x49b0('0x1b'),'keyType':_0x49b0('0x5'),'variableName':_0x49b0('0x1c')},{'type':_0x49b0('0xc'),'content':'','key':_0x49b0('0x1d'),'keyType':'variable','variableName':_0x49b0('0x1e')}];break;case _0x49b0('0x7'):_0x431819=[{'type':_0x49b0('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x49b0('0xc'),'content':'','key':_0x49b0('0x1f'),'keyType':_0x49b0('0x5'),'keyContent':'','variableName':_0x49b0('0x8')},{'type':_0x49b0('0xc'),'content':'','key':'Member\x20Name','keyType':_0x49b0('0x5'),'keyContent':'','variableName':_0x49b0('0x20')},{'type':_0x49b0('0xc'),'content':'','key':_0x49b0('0xf'),'keyType':'variable','keyContent':'','variableName':'uniqueid'},{'type':_0x49b0('0xc'),'content':'','key':'Date','keyType':'variable','keyContent':'','variableName':_0x49b0('0x21')},{'type':'string','content':_0x49b0('0x15')},{'type':_0x49b0('0xc'),'content':'','key':_0x49b0('0x22'),'keyType':_0x49b0('0x5'),'keyContent':'','variableName':_0x49b0('0x23')},{'type':'keyValue','content':'','key':_0x49b0('0x24'),'keyType':_0x49b0('0x5'),'keyContent':'','variableName':'endtime'},{'type':_0x49b0('0xc'),'content':'','key':_0x49b0('0x25'),'keyType':'variable','keyContent':'','variableName':_0x49b0('0x26')},{'type':_0x49b0('0xc'),'content':'','key':_0x49b0('0x27'),'keyType':'variable','keyContent':'','variableName':'billableseconds'}];break;}}return _0x431819;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 6dd86d9..4dc6194 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55a6=['tracked','query','clone','body','omit','html','fax','mobile','lodash','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','Interaction','findOne','then','update','info','catch','error'];(function(_0x49a57f,_0x405f38){var _0x2fa2a5=function(_0x359a98){while(--_0x359a98){_0x49a57f['push'](_0x49a57f['shift']());}};_0x2fa2a5(++_0x405f38);}(_0x55a6,0x1e8));var _0x655a=function(_0x2caf40,_0x440706){_0x2caf40=_0x2caf40-0x0;var _0x30f06c=_0x55a6[_0x2caf40];return _0x30f06c;};'use strict';var _=require(_0x655a('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0x655a('0x1')),'mail':require(_0x655a('0x2'))(_0x655a('0x3')),'fax':require(_0x655a('0x2'))(_0x655a('0x4')),'sms':require('../../config/logger')(_0x655a('0x5')),'chat':require(_0x655a('0x2'))('chat-interactions'),'whatsapp':require('../../config/logger')(_0x655a('0x6'))};function getInteractionId(_0x29aa6a,_0x603aff,_0x430c4f){if(_0x29aa6a&&_0x29aa6a[_[_0x655a('0x7')](_0x430c4f)+_0x655a('0x8')]){return _0x29aa6a[_[_0x655a('0x7')](_0x430c4f)+_0x655a('0x8')];}else if(_0x29aa6a&&_0x29aa6a['id']){return _0x29aa6a['id'];}else if(_0x603aff&&_0x603aff['id']){return _0x603aff['id'];}else{return _0x655a('0x9');}}function log(_0x104167,_0x2c9444,_0x5144c3,_0x53f301,_0x547b0b,_0x319dc9){loggers[_0x547b0b['toLowerCase']()][_0x104167](_0x655a('0xa'),_0x319dc9[_0x655a('0xb')](),_0x2c9444?_0x2c9444['id']:null,_0x2c9444?_0x2c9444[_0x655a('0xc')]:null,_0x2c9444?_0x2c9444[_0x655a('0xd')]:null,getInteractionId(_0x5144c3,_0x53f301,_0x547b0b),_0x5144c3?JSON['stringify'](_0x5144c3):_0x655a('0xe'));}function updateUser(_0x4bdcd0,_0x43810a,_0x352b20,_0x505456,_0x4375b5){db[_[_0x655a('0x7')](_0x505456)+_0x655a('0xf')][_0x655a('0x10')]({'where':{'id':getInteractionId(_0x43810a,_0x352b20,_0x505456)}})[_0x655a('0x11')](function(_0x1f603e){if(_0x1f603e){return _0x1f603e[_0x655a('0x12')]({'UserId':_0x4bdcd0?_0x4bdcd0['id']:null});}})[_0x655a('0x11')](function(_0x214aa7){if(_0x214aa7){log(_0x655a('0x13'),_0x4bdcd0,_0x43810a,_0x352b20,_0x505456,_0x4375b5);}})[_0x655a('0x14')](function(){log(_0x655a('0x15'),_0x4bdcd0,_0x43810a,_0x352b20,_0x505456,_0x4375b5);});}exports[_0x655a('0x16')]=function(_0x3842e9,_0x25e63f){return function(_0x4593b7,_0x5e58b1,_0x59e1a5){var _0x4073d5=_0x4593b7['user'];var _0x51fdfc={};var _0x44f164=_0x4593b7[_0x655a('0x17')];if(_0x51fdfc){_0x51fdfc=_[_0x655a('0x18')](_0x4593b7[_0x655a('0x19')]);_0x51fdfc=_[_0x655a('0x1a')](_0x51fdfc,[_0x655a('0x19'),_0x655a('0x1b'),'phone',_0x655a('0x1c'),_0x655a('0x1d')]);}updateUser(_0x4073d5,_0x51fdfc,_0x44f164,_0x3842e9,_0x25e63f);_0x59e1a5(null);};}; \ No newline at end of file +var _0x44c4=['catch','error','tracked','user','query','clone','omit','body','html','phone','fax','../../mysqldb','../../config/logger','mail-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','Interaction','then','update'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0x44c4,0xe3));var _0x444c=function(_0xd11114,_0x2fcf92){_0xd11114=_0xd11114-0x0;var _0x1aca97=_0x44c4[_0xd11114];return _0x1aca97;};'use strict';var _=require('lodash');var db=require(_0x444c('0x0'))['db'];var loggers={'openchannel':require(_0x444c('0x1'))('openchannel-interactions'),'mail':require(_0x444c('0x1'))(_0x444c('0x2')),'fax':require(_0x444c('0x1'))('fax-interactions'),'sms':require(_0x444c('0x1'))('sms-interactions'),'chat':require(_0x444c('0x1'))(_0x444c('0x3')),'whatsapp':require(_0x444c('0x1'))(_0x444c('0x4'))};function getInteractionId(_0xa086e,_0x259e2e,_0x5b4bd7){if(_0xa086e&&_0xa086e[_[_0x444c('0x5')](_0x5b4bd7)+_0x444c('0x6')]){return _0xa086e[_[_0x444c('0x5')](_0x5b4bd7)+_0x444c('0x6')];}else if(_0xa086e&&_0xa086e['id']){return _0xa086e['id'];}else if(_0x259e2e&&_0x259e2e['id']){return _0x259e2e['id'];}else{return'unknown';}}function log(_0x4b83bf,_0x2169d4,_0x5a0bb7,_0x2407f5,_0x530bdf,_0x2d7b5f){loggers[_0x530bdf[_0x444c('0x7')]()][_0x4b83bf](_0x444c('0x8'),_0x2d7b5f['toUpperCase'](),_0x2169d4?_0x2169d4['id']:null,_0x2169d4?_0x2169d4[_0x444c('0x9')]:null,_0x2169d4?_0x2169d4[_0x444c('0xa')]:null,getInteractionId(_0x5a0bb7,_0x2407f5,_0x530bdf),_0x5a0bb7?JSON[_0x444c('0xb')](_0x5a0bb7):_0x444c('0xc'));}function updateUser(_0x193bcd,_0x2bdc8c,_0x469016,_0x265928,_0x52c491){db[_['upperFirst'](_0x265928)+_0x444c('0xd')]['findOne']({'where':{'id':getInteractionId(_0x2bdc8c,_0x469016,_0x265928)}})[_0x444c('0xe')](function(_0x1b2ae2){if(_0x1b2ae2){return _0x1b2ae2[_0x444c('0xf')]({'UserId':_0x193bcd?_0x193bcd['id']:null});}})[_0x444c('0xe')](function(_0x410222){if(_0x410222){log('info',_0x193bcd,_0x2bdc8c,_0x469016,_0x265928,_0x52c491);}})[_0x444c('0x10')](function(){log(_0x444c('0x11'),_0x193bcd,_0x2bdc8c,_0x469016,_0x265928,_0x52c491);});}exports[_0x444c('0x12')]=function(_0x2a0932,_0x72b5bc){return function(_0x47a569,_0x496758,_0x461248){var _0x939d92=_0x47a569[_0x444c('0x13')];var _0x4f0c8f={};var _0x5cbbcd=_0x47a569[_0x444c('0x14')];if(_0x4f0c8f){_0x4f0c8f=_[_0x444c('0x15')](_0x47a569['body']);_0x4f0c8f=_[_0x444c('0x16')](_0x4f0c8f,[_0x444c('0x17'),_0x444c('0x18'),_0x444c('0x19'),_0x444c('0x1a'),'mobile']);}updateUser(_0x939d92,_0x4f0c8f,_0x5cbbcd,_0x2a0932,_0x72b5bc);_0x461248(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index a105215..7d44e3f 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 _0x51b1=['then','count','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','composable-middleware','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','update','utf8','parse','use','License','findOne'];(function(_0x45ecc1,_0x3f218c){var _0x18d90a=function(_0x209597){while(--_0x209597){_0x45ecc1['push'](_0x45ecc1['shift']());}};_0x18d90a(++_0x3f218c);}(_0x51b1,0x78));var _0x151b=function(_0x393436,_0x2100f4){_0x393436=_0x393436-0x0;var _0x1a54a4=_0x51b1[_0x393436];return _0x1a54a4;};'use strict';var crypto=require(_0x151b('0x0'));var util=require('util');var compose=require(_0x151b('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x151b('0x2'));function getValueFromLicense(_0x168a0c,_0x5628ae){if(_0x168a0c&&_0x5628ae){if(_0x5628ae[_0x151b('0x3')]&&_0x5628ae[_0x151b('0x4')]){var _0x1f50a9=_0x5628ae[_0x151b('0x3')];var _0x388c95=_0x5628ae[_0x151b('0x4')];var _0x3493c3=_0x1f50a9['split']('-')[0x4];var _0x4d084b=_0x1f50a9[_0x151b('0x5')]('-')[0x0];var _0x3f4f9d=crypto[_0x151b('0x6')](_0x151b('0x7'),util['format'](_0x151b('0x8'),_0x3493c3,_0x1f50a9,_0x4d084b));var _0x348f7e=_0x3f4f9d[_0x151b('0x9')](_0x388c95,'base64',_0x151b('0xa'));_0x348f7e+=_0x3f4f9d['final'](_0x151b('0xa'));var _0x482ae2=JSON[_0x151b('0xb')](_0x348f7e);return _0x482ae2['hasOwnProperty'](_0x168a0c)?_0x482ae2[_0x168a0c]:null;}}return null;}function isLimit(_0x25831b,_0x39cdf3,_0x4fb2e2,_0x4ae12c){var _0x13876f=_0x39cdf3;return compose()[_0x151b('0xc')](function(_0x733ae1,_0x503a1c,_0x596a09){return db[_0x151b('0xd')][_0x151b('0xe')]({'where':{'id':0x1},'raw':!![]})[_0x151b('0xf')](function(_0x2ccd0a){var _0x5255ea=getValueFromLicense(_0x25831b,_0x2ccd0a);return _0x5255ea?_0x5255ea:_0x13876f;})['then'](function(_0x549803){_0x13876f=_0x549803;return _0x4fb2e2[_0x151b('0x10')](_0x4ae12c);})[_0x151b('0xf')](function(_0x48dae0){if(_0x48dae0>=_0x13876f){return _0x503a1c[_0x151b('0x11')](0x193)[_0x151b('0x12')]({'message':util[_0x151b('0x13')](_0x151b('0x14'),_0x25831b)});}_0x596a09();})[_0x151b('0x15')](function(_0x56f7c9){_0x596a09(_0x56f7c9);});});}function isUserLimit(){return isLimit(_0x151b('0x16'),0x1,db[_0x151b('0x17')],{'where':{'$or':[{'role':_0x151b('0x18')},{'role':_0x151b('0x19')}]}});}exports[_0x151b('0x1a')]=isUserLimit; \ No newline at end of file +var _0x2a9e=['status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','format','%s:%s:%s','utf8','final','parse','License','then','count'];(function(_0x5a4400,_0xfae3b6){var _0xf9b532=function(_0x39804e){while(--_0x39804e){_0x5a4400['push'](_0x5a4400['shift']());}};_0xf9b532(++_0xfae3b6);}(_0x2a9e,0x1b2));var _0xe2a9=function(_0x403032,_0x78cf65){_0x403032=_0x403032-0x0;var _0x49dec2=_0x2a9e[_0x403032];return _0x49dec2;};'use strict';var crypto=require(_0xe2a9('0x0'));var util=require('util');var compose=require(_0xe2a9('0x1'));var db=require(_0xe2a9('0x2'))['db'];var config=require(_0xe2a9('0x3'));function getValueFromLicense(_0x2d1d21,_0xd68584){if(_0x2d1d21&&_0xd68584){if(_0xd68584[_0xe2a9('0x4')]&&_0xd68584[_0xe2a9('0x5')]){var _0x1ced07=_0xd68584[_0xe2a9('0x4')];var _0x48a666=_0xd68584['license'];var _0x350761=_0x1ced07[_0xe2a9('0x6')]('-')[0x4];var _0x3cbc9c=_0x1ced07['split']('-')[0x0];var _0x40514c=crypto[_0xe2a9('0x7')]('aes-256-ctr',util[_0xe2a9('0x8')](_0xe2a9('0x9'),_0x350761,_0x1ced07,_0x3cbc9c));var _0x2d70ca=_0x40514c['update'](_0x48a666,'base64',_0xe2a9('0xa'));_0x2d70ca+=_0x40514c[_0xe2a9('0xb')](_0xe2a9('0xa'));var _0x4101d7=JSON[_0xe2a9('0xc')](_0x2d70ca);return _0x4101d7['hasOwnProperty'](_0x2d1d21)?_0x4101d7[_0x2d1d21]:null;}}return null;}function isLimit(_0x54a063,_0x1a3d7c,_0x255f35,_0x22621c){var _0x1c4d5b=_0x1a3d7c;return compose()['use'](function(_0x4f3c65,_0x3b3e48,_0x34800b){return db[_0xe2a9('0xd')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xe2a9('0xe')](function(_0x1efd8d){var _0x5711a0=getValueFromLicense(_0x54a063,_0x1efd8d);return _0x5711a0?_0x5711a0:_0x1c4d5b;})[_0xe2a9('0xe')](function(_0x5af801){_0x1c4d5b=_0x5af801;return _0x255f35[_0xe2a9('0xf')](_0x22621c);})['then'](function(_0x339dfb){if(_0x339dfb>=_0x1c4d5b){return _0x3b3e48[_0xe2a9('0x10')](0x193)[_0xe2a9('0x11')]({'message':util[_0xe2a9('0x8')](_0xe2a9('0x12'),_0x54a063)});}_0x34800b();})[_0xe2a9('0x13')](function(_0x4a547f){_0x34800b(_0x4a547f);});});}function isUserLimit(){return isLimit(_0xe2a9('0x14'),0x1,db[_0xe2a9('0x15')],{'where':{'$or':[{'role':_0xe2a9('0x16')},{'role':_0xe2a9('0x17')}]}});}exports[_0xe2a9('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 3a6fb3f..8b9a1a4 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 _0x1216=['$startsWith','LIKE\x20?','<\x20?','$gt','<=\x20?','$gte','>=\x20?','$in','start','$endsWith','pop','utcOffset','format','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','shift','match','forEach','filter','indexOf','map','push','DATE','operator','$eq','$between','value','includes','$lte','add','days','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring'];(function(_0x2a1cc8,_0x5e41f8){var _0xd70685=function(_0x304945){while(--_0x304945){_0x2a1cc8['push'](_0x2a1cc8['shift']());}};_0xd70685(++_0x5e41f8);}(_0x1216,0x86));var _0x6121=function(_0x67714a,_0x550d17){_0x67714a=_0x67714a-0x0;var _0x468499=_0x1216[_0x67714a];return _0x468499;};'use strict';var _=require(_0x6121('0x0'));var moment=require(_0x6121('0x1'));exports[_0x6121('0x2')]=function(_0x5ca538){var _0x4644fd={'conditions':[]};_0x4644fd[_0x6121('0x3')]=_[_0x6121('0x4')](_0x5ca538,_0x6121('0x5'))?'or':_0x6121('0x6');var _0x3e8f3e=_0x5ca538[_0x6121('0x7')](_0x6121('0x8'),'')[_0x6121('0x7')](_0x6121('0x5'),'')[_0x6121('0x9')]('||');for(var _0x10854f=0x0;_0x10854f<_0x3e8f3e[_0x6121('0xa')];_0x10854f++){var _0x4ce5cc=_0x3e8f3e[_0x10854f]['split'](':=');var _0x4370c7=_0x4ce5cc[0x0];var _0x52bccc=_0x4ce5cc[_0x6121('0xb')](0x1);_0x52bccc['forEach'](function(_0x15c941){var _0x1c222b=_0x15c941[_0x6121('0x9')]('[')[_0x6121('0xc')]();var _0x2cc7cb=_0x15c941[_0x6121('0xd')](/\[(.*?)\]/g);_0x2cc7cb[_0x6121('0xe')](function(_0x422010){var _0x591512=_0x422010[_0x6121('0x9')]('[')[_0x6121('0xf')](function(_0x4f3666){return _0x4f3666[_0x6121('0x10')](']')>-0x1;})[_0x6121('0x11')](function(_0x27e72f){return _0x27e72f['split'](']')[0x0];})[0x0];_0x4644fd['conditions'][_0x6121('0x12')]({'field':_0x4370c7,'operator':_0x1c222b,'value':_0x591512});});});}return _0x4644fd;};exports['buildExpression']=function(_0x3ffc16,_0x5aef82,_0x5ed029){var _0x562ec2={};if(_0x5aef82===_0x6121('0x13')){if(_0x5ed029[_0x6121('0x14')]===_0x6121('0x15')){_0x5ed029[_0x6121('0x14')]=_0x6121('0x16');_0x5ed029[_0x6121('0x17')]+=','+_0x5ed029[_0x6121('0x17')];}else if(_[_0x6121('0x18')](['$gt',_0x6121('0x19')],_0x5ed029[_0x6121('0x14')])){_0x5ed029['value']=moment(_0x5ed029[_0x6121('0x17')])[_0x6121('0x1a')](0x1,_0x6121('0x1b'))['format'](_0x6121('0x1c'));}}if(_0x5ed029['castTo']){_0x5aef82=_0x5ed029[_0x6121('0x1d')];_0x562ec2[_0x6121('0x1e')]=_0x6121('0x1f')+_0x3ffc16+'.'+_0x5ed029[_0x6121('0x20')]+_0x6121('0x21')+_0x5ed029[_0x6121('0x1d')]+')\x20'+parseOperator(_0x5ed029[_0x6121('0x14')]);}else{_0x562ec2[_0x6121('0x1e')]=_0x3ffc16+'.'+_0x5ed029[_0x6121('0x20')]+'\x20'+parseOperator(_0x5ed029['operator']);}if(_[_0x6121('0x18')]([_0x6121('0x22'),_0x6121('0x23')],_0x5ed029['operator']))_0x562ec2[_0x6121('0x1e')]='('+_0x562ec2[_0x6121('0x1e')]+_0x6121('0x24')+_0x3ffc16+'.'+_0x5ed029['field']+_0x6121('0x25');_0x562ec2[_0x6121('0x17')]=parseValue(_0x5aef82,_0x5ed029['operator'],_0x5ed029[_0x6121('0x17')]);return _0x562ec2;};function parseOperator(_0x2b18b5){var _0x4ed92b;switch(_0x2b18b5){case'$in':_0x4ed92b=_0x6121('0x26');break;case _0x6121('0x23'):_0x4ed92b=_0x6121('0x27');break;case _0x6121('0x15'):_0x4ed92b=_0x6121('0x28');break;case _0x6121('0x22'):_0x4ed92b=_0x6121('0x29');break;case _0x6121('0x2a'):case _0x6121('0x2b'):case'$endsWith':_0x4ed92b=_0x6121('0x2c');break;case'$lt':_0x4ed92b=_0x6121('0x2d');break;case _0x6121('0x2e'):_0x4ed92b='>\x20?';break;case _0x6121('0x19'):_0x4ed92b=_0x6121('0x2f');break;case _0x6121('0x30'):_0x4ed92b=_0x6121('0x31');break;case _0x6121('0x16'):_0x4ed92b='BETWEEN\x20?\x20AND\x20?';break;}return _0x4ed92b;}function parseValue(_0x35f1a1,_0x1a0440,_0x3daf4e){var _0x441d30={'start':undefined,'end':undefined};switch(_0x1a0440){case _0x6121('0x32'):case _0x6121('0x23'):_0x441d30['start']=_0x3daf4e[_0x6121('0x9')](',');break;case _0x6121('0x2a'):_0x441d30[_0x6121('0x33')]='%'+_0x3daf4e+'%';break;case'$startsWith':_0x441d30[_0x6121('0x33')]=_0x3daf4e+'%';break;case _0x6121('0x34'):_0x441d30[_0x6121('0x33')]='%'+_0x3daf4e;break;case _0x6121('0x16'):var _0x20880a=_0x3daf4e['split'](',');var _0x3daf4e=_0x20880a[_0x6121('0xc')]();var _0x3c6d24=_0x20880a[_0x6121('0x35')]();if(_0x35f1a1===_0x6121('0x13')){_0x3daf4e=moment(_0x3daf4e)[_0x6121('0x36')](0x0,!![])[_0x6121('0x37')]();_0x3c6d24=moment(_0x3c6d24)['utcOffset'](0x0,!![])[_0x6121('0x1a')](0x17,_0x6121('0x38'))['add'](0x3b,_0x6121('0x39'))[_0x6121('0x1a')](0x3b,_0x6121('0x3a'))[_0x6121('0x37')]();}_0x441d30={'start':_0x3daf4e,'end':_0x3c6d24};break;default:_0x441d30[_0x6121('0x33')]=_0x3daf4e;break;}return _0x441d30;} \ No newline at end of file +var _0x4dd3=['split','slice','forEach','shift','match','filter','indexOf','map','push','buildExpression','operator','$eq','$between','value','$lte','add','format','text','CAST(','field','\x20AS\x20','castTo','includes','$ne','$notIn','\x20OR\x20','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','pop','utcOffset','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]'];(function(_0x30bf9a,_0x3fb3f7){var _0x110a66=function(_0x339b7a){while(--_0x339b7a){_0x30bf9a['push'](_0x30bf9a['shift']());}};_0x110a66(++_0x3fb3f7);}(_0x4dd3,0x105));var _0x34dd=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0x4dd3[_0x30cd7e];return _0x462a02;};'use strict';var _=require(_0x34dd('0x0'));var moment=require(_0x34dd('0x1'));exports[_0x34dd('0x2')]=function(_0x5a83dc){var _0x4b6a21={'conditions':[]};_0x4b6a21[_0x34dd('0x3')]=_[_0x34dd('0x4')](_0x5a83dc,_0x34dd('0x5'))?'or':_0x34dd('0x6');var _0x5c41f6=_0x5a83dc[_0x34dd('0x7')](_0x34dd('0x8'),'')[_0x34dd('0x7')](_0x34dd('0x5'),'')[_0x34dd('0x9')]('||');for(var _0x2e6cc2=0x0;_0x2e6cc2<_0x5c41f6['length'];_0x2e6cc2++){var _0x571891=_0x5c41f6[_0x2e6cc2][_0x34dd('0x9')](':=');var _0x2d78d9=_0x571891[0x0];var _0x558de3=_0x571891[_0x34dd('0xa')](0x1);_0x558de3[_0x34dd('0xb')](function(_0x3fc2fc){var _0x33fe6a=_0x3fc2fc[_0x34dd('0x9')]('[')[_0x34dd('0xc')]();var _0x2e0ac4=_0x3fc2fc[_0x34dd('0xd')](/\[(.*?)\]/g);_0x2e0ac4[_0x34dd('0xb')](function(_0x4711e9){var _0x219ce5=_0x4711e9[_0x34dd('0x9')]('[')[_0x34dd('0xe')](function(_0x5b8f92){return _0x5b8f92[_0x34dd('0xf')](']')>-0x1;})[_0x34dd('0x10')](function(_0x4e42ee){return _0x4e42ee['split'](']')[0x0];})[0x0];_0x4b6a21['conditions'][_0x34dd('0x11')]({'field':_0x2d78d9,'operator':_0x33fe6a,'value':_0x219ce5});});});}return _0x4b6a21;};exports[_0x34dd('0x12')]=function(_0x5ba583,_0x334476,_0x1fb754){var _0x1d89db={};if(_0x334476==='DATE'){if(_0x1fb754[_0x34dd('0x13')]===_0x34dd('0x14')){_0x1fb754[_0x34dd('0x13')]=_0x34dd('0x15');_0x1fb754[_0x34dd('0x16')]+=','+_0x1fb754['value'];}else if(_['includes'](['$gt',_0x34dd('0x17')],_0x1fb754['operator'])){_0x1fb754[_0x34dd('0x16')]=moment(_0x1fb754[_0x34dd('0x16')])[_0x34dd('0x18')](0x1,'days')[_0x34dd('0x19')]('YYYY-MM-DD');}}if(_0x1fb754['castTo']){_0x334476=_0x1fb754['castTo'];_0x1d89db[_0x34dd('0x1a')]=_0x34dd('0x1b')+_0x5ba583+'.'+_0x1fb754[_0x34dd('0x1c')]+_0x34dd('0x1d')+_0x1fb754[_0x34dd('0x1e')]+')\x20'+parseOperator(_0x1fb754[_0x34dd('0x13')]);}else{_0x1d89db['text']=_0x5ba583+'.'+_0x1fb754[_0x34dd('0x1c')]+'\x20'+parseOperator(_0x1fb754['operator']);}if(_[_0x34dd('0x1f')]([_0x34dd('0x20'),_0x34dd('0x21')],_0x1fb754[_0x34dd('0x13')]))_0x1d89db['text']='('+_0x1d89db[_0x34dd('0x1a')]+_0x34dd('0x22')+_0x5ba583+'.'+_0x1fb754[_0x34dd('0x1c')]+'\x20IS\x20NULL)';_0x1d89db[_0x34dd('0x16')]=parseValue(_0x334476,_0x1fb754[_0x34dd('0x13')],_0x1fb754[_0x34dd('0x16')]);return _0x1d89db;};function parseOperator(_0x439509){var _0x4aa407;switch(_0x439509){case'$in':_0x4aa407=_0x34dd('0x23');break;case _0x34dd('0x21'):_0x4aa407='NOT\x20IN\x20?';break;case _0x34dd('0x14'):_0x4aa407=_0x34dd('0x24');break;case _0x34dd('0x20'):_0x4aa407=_0x34dd('0x25');break;case _0x34dd('0x26'):case _0x34dd('0x27'):case _0x34dd('0x28'):_0x4aa407=_0x34dd('0x29');break;case _0x34dd('0x2a'):_0x4aa407=_0x34dd('0x2b');break;case _0x34dd('0x2c'):_0x4aa407='>\x20?';break;case _0x34dd('0x17'):_0x4aa407=_0x34dd('0x2d');break;case'$gte':_0x4aa407=_0x34dd('0x2e');break;case'$between':_0x4aa407=_0x34dd('0x2f');break;}return _0x4aa407;}function parseValue(_0x4c3cf5,_0x26fb0a,_0x3adf1a){var _0x47dcf2={'start':undefined,'end':undefined};switch(_0x26fb0a){case _0x34dd('0x30'):case _0x34dd('0x21'):_0x47dcf2[_0x34dd('0x31')]=_0x3adf1a[_0x34dd('0x9')](',');break;case _0x34dd('0x26'):_0x47dcf2['start']='%'+_0x3adf1a+'%';break;case _0x34dd('0x27'):_0x47dcf2['start']=_0x3adf1a+'%';break;case _0x34dd('0x28'):_0x47dcf2[_0x34dd('0x31')]='%'+_0x3adf1a;break;case _0x34dd('0x15'):var _0x5ec2ac=_0x3adf1a['split'](',');var _0x3adf1a=_0x5ec2ac['shift']();var _0x57d749=_0x5ec2ac[_0x34dd('0x32')]();if(_0x4c3cf5==='DATE'){_0x3adf1a=moment(_0x3adf1a)[_0x34dd('0x33')](0x0,!![])[_0x34dd('0x19')]();_0x57d749=moment(_0x57d749)[_0x34dd('0x33')](0x0,!![])['add'](0x17,'hours')[_0x34dd('0x18')](0x3b,_0x34dd('0x34'))['add'](0x3b,_0x34dd('0x35'))[_0x34dd('0x19')]();}_0x47dcf2={'start':_0x3adf1a,'end':_0x57d749};break;default:_0x47dcf2['start']=_0x3adf1a;break;}return _0x47dcf2;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 8eaf78c..6504794 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 _0x1cb9=['push','join','getOptions','query','$id','map','intersection','attributes','model','length','nolimit','limit','where','pick','filter','object','includes','columns','name','value','merge','type','lower','options','lodash','moment','keys','parse','fields','filters','isEmpty','forOwn','find','DATE','isPlainObject','$gte','format','$lte','utc','subtract','uniqueid','isArray','split','offset','sort','priority','cast','col','substr','DESC','unsigned','ASC','omit','isString','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','forEach','replace'];(function(_0x51077a,_0x47bdd0){var _0x5ee4ae=function(_0x1cdff0){while(--_0x1cdff0){_0x51077a['push'](_0x51077a['shift']());}};_0x5ee4ae(++_0x47bdd0);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3c7a82,_0x5cd638){_0x3c7a82=_0x3c7a82-0x0;var _0x44d93f=_0x1cb9[_0x3c7a82];return _0x44d93f;};'use strict';var _=require(_0x91cb('0x0'));var sequelize=require('sequelize');var moment=require(_0x91cb('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x12b059){var _0x2b1894=['ne'];try{var _0x351bdb=JSON['parse'](_0x12b059);var _0x42910d=Object[_0x91cb('0x2')](_0x351bdb)[0x0];return _0x2b1894['includes'](_0x42910d);}catch(_0x17c21c){return![];}}function getOperatorValue(_0x3640f9){var _0x186dc3=JSON[_0x91cb('0x3')](_0x3640f9);var _0x3b9d98=Object[_0x91cb('0x2')](_0x186dc3)[0x0];var _0x4c1f56=_0x186dc3[_0x3b9d98];return{['$'+_0x3b9d98]:_0x4c1f56};}exports[_0x91cb('0x4')]=function(_0x5bda2f){var _0x2fdfce=null;if(_0x5bda2f){_0x2fdfce=_0x5bda2f['split'](',');}return _0x2fdfce;};exports[_0x91cb('0x5')]=function(_0x317df0,_0x45317f){var _0x4a631d={};if(!_[_0x91cb('0x6')](_0x317df0)){_[_0x91cb('0x7')](_0x317df0,function(_0x21a0a5,_0x22dcab){try{if(_0x45317f){var _0x2465be=_[_0x91cb('0x8')](_0x45317f,{'name':_0x22dcab})||{};if(hasSequelizeOperator(_0x21a0a5)){_0x4a631d[_0x22dcab]=getOperatorValue(_0x21a0a5);}else if(_0x2465be['type']===_0x91cb('0x9')&&_[_0x91cb('0xa')](_0x21a0a5)){var _0x4ba2f2=JSON[_0x91cb('0x3')](_0x21a0a5);var _0x3ea707={'$gte':moment(moment(_0x4ba2f2[_0x91cb('0xb')])[_0x91cb('0xc')]('YYYY-MM-DD'))['utc']()[_0x91cb('0xc')](),'$lte':moment(moment(_0x4ba2f2[_0x91cb('0xd')])['format']('YYYY-MM-DD'))[_0x91cb('0xe')]()[_0x91cb('0xf')](0x1,'s')[_0x91cb('0xc')]()};_0x4a631d[_0x22dcab]=_0x3ea707;}else if(_0x2465be['name']===_0x91cb('0x10')){_0x4a631d[_0x22dcab]=_0x21a0a5;}else{_0x4a631d[_0x22dcab]=_[_0x91cb('0x11')](_0x21a0a5)?_0x21a0a5:JSON['parse'](_0x21a0a5);}}else{_0x4a631d[_0x22dcab]=_[_0x91cb('0x11')](_0x21a0a5)?_0x21a0a5:JSON[_0x91cb('0x3')](_0x21a0a5);}}catch(_0x1cd34b){_0x4a631d[_0x22dcab]=_0x21a0a5[_0x91cb('0x12')](',');}});}return _0x4a631d;};exports['limit']=function(_0x3fba4f){_0x3fba4f=parseInt(_0x3fba4f,0xa);if(!_0x3fba4f||_0x3fba4f<0x0){_0x3fba4f=LIMIT_VALUE;}return _0x3fba4f;};exports[_0x91cb('0x13')]=function(_0x4ca8e8){_0x4ca8e8=parseInt(_0x4ca8e8,0xa);if(!_0x4ca8e8||_0x4ca8e8<0x0){_0x4ca8e8=0x0;}return _0x4ca8e8;};exports[_0x91cb('0x14')]=function(_0x4c9fb2){var _0x55042a,_0x281ff3=null;if(_0x4c9fb2){_0x55042a=_0x4c9fb2[_0x91cb('0x12')](',');_0x281ff3=_['map'](_0x55042a,function(_0x51a1d5){if(_0x51a1d5['indexOf']('-')===0x0){return[_0x51a1d5===_0x91cb('0x15')?sequelize[_0x91cb('0x16')](sequelize[_0x91cb('0x17')](_0x91cb('0x15')),'unsigned'):_0x51a1d5[_0x91cb('0x18')](0x1),_0x91cb('0x19')];}else{return[_0x51a1d5===_0x91cb('0x15')?sequelize['cast'](sequelize[_0x91cb('0x17')](_0x91cb('0x15')),_0x91cb('0x1a')):_0x51a1d5,_0x91cb('0x1b')];}});}return _0x281ff3;};exports[_0x91cb('0x1c')]=function(_0x7ad361,_0x414e60){if(_[_0x91cb('0x6')](_0x7ad361)){return _0x7ad361;}if(_[_0x91cb('0x11')](_0x7ad361)){for(var _0x4c8438=0x0;_0x4c8438<_0x7ad361['length'];_0x4c8438+=0x1){_0x7ad361[_0x4c8438]=this[_0x91cb('0x1c')](_0x7ad361[_0x4c8438],_0x414e60);}return _0x7ad361;}if(!_['isObject'](_0x7ad361)){return _0x7ad361;}if(_[_0x91cb('0x1d')](_0x414e60)){_0x414e60=[_0x414e60];}if(!_[_0x91cb('0x11')](_0x414e60)){return _0x7ad361;}for(var _0x318031=0x0;_0x318031<_0x414e60['length'];_0x318031+=0x1){_[_0x91cb('0x1e')](_0x7ad361,_0x414e60[_0x318031]);}for(var _0x4f5a7b in _0x7ad361){if(_0x7ad361[_0x91cb('0x1f')](_0x4f5a7b)){_0x7ad361[_0x4f5a7b]=this[_0x91cb('0x1c')](_0x7ad361[_0x4f5a7b],_0x414e60);}}return _0x7ad361;};exports[_0x91cb('0x20')]=function(_0x2fb473){return _0x2fb473[_0x91cb('0x21')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x91cb('0x22')]=function(_0x52670a){return _0x52670a[_0x91cb('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0x91cb('0x23')]=function(_0x445fe1){var _0x4944bd=[];_0x445fe1[_0x91cb('0x12')](/[ ,]+/)[_0x91cb('0x24')](function(_0x25bbf9){_0x25bbf9=_0x25bbf9[_0x91cb('0x25')](/([^:]")"+/g,'$1');_0x25bbf9='+'+_0x25bbf9+'*';var _0xf296bc=/[ `!@#$%^&*()_\-?~]/;if(_0x25bbf9[_0x91cb('0x21')](_0xf296bc))_0x25bbf9='\x22'+_0x25bbf9+'\x22';_0x4944bd[_0x91cb('0x26')](_0x25bbf9);});return _0x4944bd[_0x91cb('0x27')]('\x20');};exports[_0x91cb('0x28')]=function(_0x5e6ed3,_0x2ccf6e,_0x474a15){var _0x6a8cfc={},_0x2cbe1e={};if(_0x2ccf6e[_0x91cb('0x29')]['$id']){_0x2ccf6e[_0x91cb('0x29')]['id']=_0x2ccf6e[_0x91cb('0x29')][_0x91cb('0x2a')];delete _0x2ccf6e[_0x91cb('0x29')][_0x91cb('0x2a')];}_0x6a8cfc['model']=_[_0x91cb('0x2b')](_0x5e6ed3,'name');_0x6a8cfc['query']=_['keys'](_0x2ccf6e[_0x91cb('0x29')]);_0x6a8cfc['filters']=_[_0x91cb('0x2c')](_0x6a8cfc['model'],_0x6a8cfc['query']);_0x2cbe1e[_0x91cb('0x2d')]=_[_0x91cb('0x2c')](_0x6a8cfc[_0x91cb('0x2e')],this[_0x91cb('0x4')](_0x2ccf6e[_0x91cb('0x29')]['fields']));_0x2cbe1e[_0x91cb('0x2d')]=_0x2cbe1e[_0x91cb('0x2d')][_0x91cb('0x2f')]?_0x2cbe1e[_0x91cb('0x2d')]:_0x6a8cfc['model'];if(!_0x2ccf6e['query'][_0x91cb('0x1f')](_0x91cb('0x30'))){_0x2cbe1e['limit']=this[_0x91cb('0x31')](_0x2ccf6e[_0x91cb('0x29')]['limit']);_0x2cbe1e[_0x91cb('0x13')]=this[_0x91cb('0x13')](_0x2ccf6e['query'][_0x91cb('0x13')]);}_0x2cbe1e['order']=this[_0x91cb('0x14')](_0x2ccf6e[_0x91cb('0x29')][_0x91cb('0x14')]);_0x2cbe1e[_0x91cb('0x32')]=this[_0x91cb('0x5')](_[_0x91cb('0x33')](_0x2ccf6e['query'],_0x6a8cfc[_0x91cb('0x5')]),_0x5e6ed3);if(_0x2ccf6e[_0x91cb('0x29')]['filter']){var _0x312581=_0x5e6ed3;var _0x4ecbd7=_0x2ccf6e[_0x91cb('0x29')][_0x91cb('0x34')];if(typeof _0x4ecbd7===_0x91cb('0x35')){_0x312581=_[_0x91cb('0x34')](_0x5e6ed3,function(_0x5e98c4){return _[_0x91cb('0x36')](_0x4ecbd7[_0x91cb('0x37')],_0x5e98c4[_0x91cb('0x38')]);});_0x4ecbd7=_0x4ecbd7[_0x91cb('0x39')];}_0x2cbe1e[_0x91cb('0x32')]=_[_0x91cb('0x3a')](_0x2cbe1e[_0x91cb('0x32')],{'$or':_[_0x91cb('0x2b')](_0x312581,function(_0x325dca){if(_0x325dca[_0x91cb('0x3b')]!=='VIRTUAL'){if(_0x474a15){return sequelize[_0x91cb('0x32')](sequelize['fn']('lower',sequelize[_0x91cb('0x17')](_0x325dca['name'])),{'$like':sequelize['fn'](_0x91cb('0x3c'),'%'+_0x2ccf6e['query'][_0x91cb('0x34')]+'%')});}else{var _0x477131={};_0x477131[_0x325dca[_0x91cb('0x38')]]={'$like':'%'+_0x2ccf6e[_0x91cb('0x29')]['filter']+'%'};return _0x477131;}}})});}_0x2cbe1e=_[_0x91cb('0x3a')]({},_0x2cbe1e,_0x2ccf6e[_0x91cb('0x3d')]);return _0x2cbe1e;}; \ No newline at end of file +var _0xeec6=['includes','fields','split','filters','forOwn','find','DATE','isPlainObject','format','YYYY-MM-DD','utc','$lte','subtract','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','isEmpty','length','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','push','join','query','$id','model','intersection','attributes','hasOwnProperty','nolimit','order','pick','object','filter','columns','value','where','type','VIRTUAL','lower','name','lodash','sequelize','moment','parse','keys'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xeec6,0x1c2));var _0x6eec=function(_0x2ef251,_0x3687e5){_0x2ef251=_0x2ef251-0x0;var _0x5c931b=_0xeec6[_0x2ef251];return _0x5c931b;};'use strict';var _=require(_0x6eec('0x0'));var sequelize=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x33cc53){var _0x535568=['ne'];try{var _0x471d43=JSON[_0x6eec('0x3')](_0x33cc53);var _0x1699ce=Object[_0x6eec('0x4')](_0x471d43)[0x0];return _0x535568[_0x6eec('0x5')](_0x1699ce);}catch(_0x2e450c){return![];}}function getOperatorValue(_0x4fedce){var _0x185f31=JSON[_0x6eec('0x3')](_0x4fedce);var _0x48064a=Object[_0x6eec('0x4')](_0x185f31)[0x0];var _0x1c810e=_0x185f31[_0x48064a];return{['$'+_0x48064a]:_0x1c810e};}exports[_0x6eec('0x6')]=function(_0x834c2){var _0x56e849=null;if(_0x834c2){_0x56e849=_0x834c2[_0x6eec('0x7')](',');}return _0x56e849;};exports[_0x6eec('0x8')]=function(_0x1c774d,_0x49ad4c){var _0x595dd4={};if(!_['isEmpty'](_0x1c774d)){_[_0x6eec('0x9')](_0x1c774d,function(_0xfbcfa1,_0x51a9e3){try{if(_0x49ad4c){var _0x4b8de1=_[_0x6eec('0xa')](_0x49ad4c,{'name':_0x51a9e3})||{};if(hasSequelizeOperator(_0xfbcfa1)){_0x595dd4[_0x51a9e3]=getOperatorValue(_0xfbcfa1);}else if(_0x4b8de1['type']===_0x6eec('0xb')&&_[_0x6eec('0xc')](_0xfbcfa1)){var _0x162db1=JSON[_0x6eec('0x3')](_0xfbcfa1);var _0x3fe3bc={'$gte':moment(moment(_0x162db1['$gte'])[_0x6eec('0xd')](_0x6eec('0xe')))[_0x6eec('0xf')]()[_0x6eec('0xd')](),'$lte':moment(moment(_0x162db1[_0x6eec('0x10')])[_0x6eec('0xd')](_0x6eec('0xe')))[_0x6eec('0xf')]()[_0x6eec('0x11')](0x1,'s')[_0x6eec('0xd')]()};_0x595dd4[_0x51a9e3]=_0x3fe3bc;}else if(_0x4b8de1['name']===_0x6eec('0x12')){_0x595dd4[_0x51a9e3]=_0xfbcfa1;}else{_0x595dd4[_0x51a9e3]=_['isArray'](_0xfbcfa1)?_0xfbcfa1:JSON[_0x6eec('0x3')](_0xfbcfa1);}}else{_0x595dd4[_0x51a9e3]=_[_0x6eec('0x13')](_0xfbcfa1)?_0xfbcfa1:JSON['parse'](_0xfbcfa1);}}catch(_0x3ee353){_0x595dd4[_0x51a9e3]=_0xfbcfa1[_0x6eec('0x7')](',');}});}return _0x595dd4;};exports[_0x6eec('0x14')]=function(_0x56c78b){_0x56c78b=parseInt(_0x56c78b,0xa);if(!_0x56c78b||_0x56c78b<0x0){_0x56c78b=LIMIT_VALUE;}return _0x56c78b;};exports[_0x6eec('0x15')]=function(_0x1ed94c){_0x1ed94c=parseInt(_0x1ed94c,0xa);if(!_0x1ed94c||_0x1ed94c<0x0){_0x1ed94c=0x0;}return _0x1ed94c;};exports[_0x6eec('0x16')]=function(_0x3320a3){var _0xd86135,_0x1761f4=null;if(_0x3320a3){_0xd86135=_0x3320a3['split'](',');_0x1761f4=_[_0x6eec('0x17')](_0xd86135,function(_0x2f843e){if(_0x2f843e[_0x6eec('0x18')]('-')===0x0){return[_0x2f843e===_0x6eec('0x19')?sequelize[_0x6eec('0x1a')](sequelize[_0x6eec('0x1b')]('priority'),_0x6eec('0x1c')):_0x2f843e[_0x6eec('0x1d')](0x1),_0x6eec('0x1e')];}else{return[_0x2f843e===_0x6eec('0x19')?sequelize[_0x6eec('0x1a')](sequelize[_0x6eec('0x1b')]('priority'),_0x6eec('0x1c')):_0x2f843e,_0x6eec('0x1f')];}});}return _0x1761f4;};exports[_0x6eec('0x20')]=function(_0x33d580,_0x1d2be9){if(_[_0x6eec('0x21')](_0x33d580)){return _0x33d580;}if(_[_0x6eec('0x13')](_0x33d580)){for(var _0x20bed3=0x0;_0x20bed3<_0x33d580[_0x6eec('0x22')];_0x20bed3+=0x1){_0x33d580[_0x20bed3]=this['omit'](_0x33d580[_0x20bed3],_0x1d2be9);}return _0x33d580;}if(!_[_0x6eec('0x23')](_0x33d580)){return _0x33d580;}if(_[_0x6eec('0x24')](_0x1d2be9)){_0x1d2be9=[_0x1d2be9];}if(!_[_0x6eec('0x13')](_0x1d2be9)){return _0x33d580;}for(var _0x275fd0=0x0;_0x275fd0<_0x1d2be9['length'];_0x275fd0+=0x1){_[_0x6eec('0x25')](_0x33d580,_0x1d2be9[_0x275fd0]);}for(var _0x3b9b9f in _0x33d580){if(_0x33d580['hasOwnProperty'](_0x3b9b9f)){_0x33d580[_0x3b9b9f]=this['omit'](_0x33d580[_0x3b9b9f],_0x1d2be9);}}return _0x33d580;};exports[_0x6eec('0x26')]=function(_0x47ed95){return _0x47ed95[_0x6eec('0x27')](RegExp(_0x6eec('0x28')))?!![]:![];};exports[_0x6eec('0x29')]=function(_0x34bdea){return _0x34bdea[_0x6eec('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0x6eec('0x2a')]=function(_0x33d180){var _0x33e4a1=[];_0x33d180[_0x6eec('0x7')](/[ ,]+/)[_0x6eec('0x2b')](function(_0x48f66f){_0x48f66f=_0x48f66f[_0x6eec('0x2c')](/([^:]")"+/g,'$1');_0x48f66f='+'+_0x48f66f+'*';var _0x4ce793=/[ `!@#$%^&*()_\-?~]/;if(_0x48f66f[_0x6eec('0x27')](_0x4ce793))_0x48f66f='\x22'+_0x48f66f+'\x22';_0x33e4a1[_0x6eec('0x2d')](_0x48f66f);});return _0x33e4a1[_0x6eec('0x2e')]('\x20');};exports['getOptions']=function(_0x57b40b,_0x508735,_0x183ce3){var _0x26b0da={},_0x20f850={};if(_0x508735[_0x6eec('0x2f')][_0x6eec('0x30')]){_0x508735[_0x6eec('0x2f')]['id']=_0x508735[_0x6eec('0x2f')][_0x6eec('0x30')];delete _0x508735[_0x6eec('0x2f')][_0x6eec('0x30')];}_0x26b0da[_0x6eec('0x31')]=_[_0x6eec('0x17')](_0x57b40b,'name');_0x26b0da[_0x6eec('0x2f')]=_[_0x6eec('0x4')](_0x508735[_0x6eec('0x2f')]);_0x26b0da['filters']=_[_0x6eec('0x32')](_0x26b0da[_0x6eec('0x31')],_0x26b0da[_0x6eec('0x2f')]);_0x20f850[_0x6eec('0x33')]=_[_0x6eec('0x32')](_0x26b0da[_0x6eec('0x31')],this['fields'](_0x508735[_0x6eec('0x2f')][_0x6eec('0x6')]));_0x20f850[_0x6eec('0x33')]=_0x20f850['attributes']['length']?_0x20f850[_0x6eec('0x33')]:_0x26b0da[_0x6eec('0x31')];if(!_0x508735[_0x6eec('0x2f')][_0x6eec('0x34')](_0x6eec('0x35'))){_0x20f850['limit']=this[_0x6eec('0x14')](_0x508735[_0x6eec('0x2f')][_0x6eec('0x14')]);_0x20f850[_0x6eec('0x15')]=this[_0x6eec('0x15')](_0x508735[_0x6eec('0x2f')][_0x6eec('0x15')]);}_0x20f850[_0x6eec('0x36')]=this['sort'](_0x508735[_0x6eec('0x2f')][_0x6eec('0x16')]);_0x20f850['where']=this['filters'](_[_0x6eec('0x37')](_0x508735[_0x6eec('0x2f')],_0x26b0da[_0x6eec('0x8')]),_0x57b40b);if(_0x508735[_0x6eec('0x2f')]['filter']){var _0x5dfbac=_0x57b40b;var _0x35fd91=_0x508735['query']['filter'];if(typeof _0x35fd91===_0x6eec('0x38')){_0x5dfbac=_[_0x6eec('0x39')](_0x57b40b,function(_0x125bd4){return _[_0x6eec('0x5')](_0x35fd91[_0x6eec('0x3a')],_0x125bd4['name']);});_0x35fd91=_0x35fd91[_0x6eec('0x3b')];}_0x20f850[_0x6eec('0x3c')]=_['merge'](_0x20f850[_0x6eec('0x3c')],{'$or':_[_0x6eec('0x17')](_0x5dfbac,function(_0x5028a2){if(_0x5028a2[_0x6eec('0x3d')]!==_0x6eec('0x3e')){if(_0x183ce3){return sequelize['where'](sequelize['fn'](_0x6eec('0x3f'),sequelize[_0x6eec('0x1b')](_0x5028a2[_0x6eec('0x40')])),{'$like':sequelize['fn'](_0x6eec('0x3f'),'%'+_0x508735['query'][_0x6eec('0x39')]+'%')});}else{var _0x2f797d={};_0x2f797d[_0x5028a2[_0x6eec('0x40')]]={'$like':'%'+_0x508735[_0x6eec('0x2f')][_0x6eec('0x39')]+'%'};return _0x2f797d;}}})});}_0x20f850=_['merge']({},_0x20f850,_0x508735['options']);return _0x20f850;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 209df88..35c454c 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fd8=['/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','initialize','serve-favicon','body-parser','method-override','cookie-parser','passport','cors','moment','./environment','default','env','production','set','appPath','join','root','development','test','split','use','static','get'];(function(_0x1f0bea,_0x93433b){var _0xc1c2c=function(_0x464e6c){while(--_0x464e6c){_0x1f0bea['push'](_0x1f0bea['shift']());}};_0xc1c2c(++_0x93433b);}(_0x7fd8,0x153));var _0x87fd=function(_0x5e848f,_0x46eb0a){_0x5e848f=_0x5e848f-0x0;var _0x3f402a=_0x7fd8[_0x5e848f];return _0x3f402a;};'use strict';var express=require('express');var favicon=require(_0x87fd('0x0'));var bodyParser=require(_0x87fd('0x1'));var methodOverride=require(_0x87fd('0x2'));var cookieParser=require(_0x87fd('0x3'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x87fd('0x4'));var cors=require(_0x87fd('0x5'));var moment=require(_0x87fd('0x6'));var config=require(_0x87fd('0x7'));var db=require('../mysqldb')['db'];exports[_0x87fd('0x8')]=function(_0x4b8eb1){var _0xa8f8f0=_0x4b8eb1['get'](_0x87fd('0x9'));if(_0xa8f8f0===_0x87fd('0xa')){_0x4b8eb1[_0x87fd('0xb')](_0x87fd('0xc'),path[_0x87fd('0xd')](config[_0x87fd('0xe')],'public'));}if(_0xa8f8f0===_0x87fd('0xf')||_0xa8f8f0===_0x87fd('0x10')){_0x4b8eb1[_0x87fd('0xb')](_0x87fd('0xc'),path[_0x87fd('0xd')](config[_0x87fd('0xe')],'client'));_0x4b8eb1['use'](errorHandler());}_0x4b8eb1['set']('json\x20replacer',function(_0x177b9f,_0x3071c1){if(this[_0x177b9f]instanceof Date){_0x3071c1=this[_0x177b9f]['toISOString']()[_0x87fd('0x11')]('.')[0x0]+'Z';}return _0x3071c1;});_0x4b8eb1[_0x87fd('0x12')](express[_0x87fd('0x13')](_0x4b8eb1[_0x87fd('0x14')](_0x87fd('0xc'))));_0x4b8eb1[_0x87fd('0xb')]('views',config[_0x87fd('0xe')]+_0x87fd('0x15'));_0x4b8eb1[_0x87fd('0x16')](_0x87fd('0x17'),require(_0x87fd('0x18'))[_0x87fd('0x19')]);_0x4b8eb1[_0x87fd('0xb')](_0x87fd('0x1a'),'html');_0x4b8eb1[_0x87fd('0x12')](bodyParser[_0x87fd('0x1b')]({'limit':_0x87fd('0x1c'),'extended':!![]}));_0x4b8eb1[_0x87fd('0x12')](bodyParser['json']({'limit':'50mb'}));_0x4b8eb1['use'](cors());_0x4b8eb1[_0x87fd('0x12')](methodOverride());_0x4b8eb1['use'](cookieParser());_0x4b8eb1['use'](passport[_0x87fd('0x1d')]());}; \ No newline at end of file +var _0x4fc6=['body-parser','method-override','cookie-parser','path','passport','cors','moment','../mysqldb','get','production','appPath','join','public','test','set','root','use','json\x20replacer','toISOString','static','views','html','ejs','renderFile','view\x20engine','urlencoded','json','initialize','express','serve-favicon'];(function(_0x2e361f,_0x410dad){var _0x3cd6e5=function(_0xc3a31f){while(--_0xc3a31f){_0x2e361f['push'](_0x2e361f['shift']());}};_0x3cd6e5(++_0x410dad);}(_0x4fc6,0x1c0));var _0x64fc=function(_0x8751ef,_0x442daa){_0x8751ef=_0x8751ef-0x0;var _0x151b5f=_0x4fc6[_0x8751ef];return _0x151b5f;};'use strict';var express=require(_0x64fc('0x0'));var favicon=require(_0x64fc('0x1'));var bodyParser=require(_0x64fc('0x2'));var methodOverride=require(_0x64fc('0x3'));var cookieParser=require(_0x64fc('0x4'));var errorHandler=require('errorhandler');var path=require(_0x64fc('0x5'));var passport=require(_0x64fc('0x6'));var cors=require(_0x64fc('0x7'));var moment=require(_0x64fc('0x8'));var config=require('./environment');var db=require(_0x64fc('0x9'))['db'];exports['default']=function(_0x1d5988){var _0x4402c7=_0x1d5988[_0x64fc('0xa')]('env');if(_0x4402c7===_0x64fc('0xb')){_0x1d5988['set'](_0x64fc('0xc'),path[_0x64fc('0xd')](config['root'],_0x64fc('0xe')));}if(_0x4402c7==='development'||_0x4402c7===_0x64fc('0xf')){_0x1d5988[_0x64fc('0x10')](_0x64fc('0xc'),path[_0x64fc('0xd')](config[_0x64fc('0x11')],'client'));_0x1d5988[_0x64fc('0x12')](errorHandler());}_0x1d5988[_0x64fc('0x10')](_0x64fc('0x13'),function(_0x24115f,_0x5e1516){if(this[_0x24115f]instanceof Date){_0x5e1516=this[_0x24115f][_0x64fc('0x14')]()['split']('.')[0x0]+'Z';}return _0x5e1516;});_0x1d5988[_0x64fc('0x12')](express[_0x64fc('0x15')](_0x1d5988[_0x64fc('0xa')]('appPath')));_0x1d5988[_0x64fc('0x10')](_0x64fc('0x16'),config['root']+'/server/views');_0x1d5988['engine'](_0x64fc('0x17'),require(_0x64fc('0x18'))[_0x64fc('0x19')]);_0x1d5988[_0x64fc('0x10')](_0x64fc('0x1a'),_0x64fc('0x17'));_0x1d5988['use'](bodyParser[_0x64fc('0x1b')]({'limit':'50mb','extended':!![]}));_0x1d5988[_0x64fc('0x12')](bodyParser[_0x64fc('0x1c')]({'limit':'50mb'}));_0x1d5988[_0x64fc('0x12')](cors());_0x1d5988[_0x64fc('0x12')](methodOverride());_0x1d5988[_0x64fc('0x12')](cookieParser());_0x1d5988['use'](passport[_0x64fc('0x1d')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index ce212c5..1cfd278 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 _0x527a=['keys','length','filter','family','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','join','createHash','md5','update','digest','hex','getUuid','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy'];(function(_0x38f1ab,_0x5111a2){var _0x2da977=function(_0x12a7d3){while(--_0x12a7d3){_0x38f1ab['push'](_0x38f1ab['shift']());}};_0x2da977(++_0x5111a2);}(_0x527a,0x118));var _0xa527=function(_0x18657d,_0x454086){_0x18657d=_0x18657d-0x0;var _0x346d0d=_0x527a[_0x18657d];return _0x346d0d;};'use strict';var _=require(_0xa527('0x0'));var os=require('os');var crypto=require(_0xa527('0x1'));var machine=require(_0xa527('0x2'));var exec=require(_0xa527('0x3'))[_0xa527('0x4')];var config=require(_0xa527('0x5'));function getInterfaces(){var _0x1ef859=[];var _0x1f864c=os[_0xa527('0x6')]();var _0x49157a=_[_0xa527('0x7')](_[_0xa527('0x8')](_0x1f864c));for(var _0x3b5e4e=0x0;_0x3b5e4e<_0x49157a[_0xa527('0x9')];_0x3b5e4e++){var _0x48d320=_0x1f864c[_0x49157a[_0x3b5e4e]][_0xa527('0xa')](function(_0x30ef2f){return _0x30ef2f[_0xa527('0xb')]==='IPv4'&&_0x30ef2f['internal']===![];});_0x1ef859=_0x1ef859[_0xa527('0xc')](_0x48d320);}return _0x1ef859;}function getFirstInterface(){var _0x37f962=_['head'](getInterfaces());return{'macAddress':_0x37f962&&_0x37f962[_0xa527('0xd')]?_0x37f962[_0xa527('0xd')]:_0xa527('0xe'),'ipAddress':_0x37f962&&_0x37f962[_0xa527('0xf')]?_0x37f962['address']:_0xa527('0x10')};}exports[_0xa527('0x11')]=getFirstInterface;function getCPUhash(){var _0x12f419=_[_0xa527('0x7')](os[_0xa527('0x12')]()['map'](function(_0x9f75f6){return _0x9f75f6[_0xa527('0x13')];}))[_0xa527('0x14')](':');return crypto[_0xa527('0x15')](_0xa527('0x16'))[_0xa527('0x17')](_0x12f419)[_0xa527('0x18')](_0xa527('0x19'));}exports[_0xa527('0x1a')]=function(){var _0x279e62=os['platform']();var _0x4d763e=/[0-9a-f-]{36}/;if(config[_0xa527('0x1b')]&&_0x4d763e[_0xa527('0x1c')](config[_0xa527('0x1b')])){return config['licenseToken'];}else if(_0x279e62==='win32'){return exec(_0xa527('0x1d'),{'encoding':_0xa527('0x1e')})[_0xa527('0x1f')]('\x0d\x0a','');}else{var _0x1276ad=getFirstInterface();var _0x351a58=getCPUhash();var _0x543e60=_0x351a58+'|'+os[_0xa527('0x20')]()+'|'+_0x1276ad[_0xa527('0x21')]+'|'+_0x1276ad[_0xa527('0x22')];var _0xf134a1=crypto[_0xa527('0x15')]('md5')[_0xa527('0x17')](_0x543e60)[_0xa527('0x18')]('hex');return _0xf134a1[_0xa527('0x23')](0x0,0x8)+'-'+_0xf134a1['substring'](0x8,0xc)+'-'+_0xf134a1[_0xa527('0x23')](0xc,0x10)+'-'+_0xf134a1['substring'](0x10,0x14)+'-'+_0xf134a1[_0xa527('0x23')](0x14);}}; \ No newline at end of file +var _0x96f8=['getUuid','platform','licenseToken','win32','utf8','replace','hostname','macAddress','ipAddress','md5','substring','crypto','execSync','../environment','networkInterfaces','orderBy','keys','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','update','digest','hex'];(function(_0x4b08cc,_0x478683){var _0x21acba=function(_0x3da741){while(--_0x3da741){_0x4b08cc['push'](_0x4b08cc['shift']());}};_0x21acba(++_0x478683);}(_0x96f8,0x18c));var _0x896f=function(_0x244cd3,_0xce8356){_0x244cd3=_0x244cd3-0x0;var _0x355ada=_0x96f8[_0x244cd3];return _0x355ada;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x896f('0x0'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0x896f('0x1')];var config=require(_0x896f('0x2'));function getInterfaces(){var _0x591999=[];var _0xa60c8e=os[_0x896f('0x3')]();var _0x523cfc=_[_0x896f('0x4')](_[_0x896f('0x5')](_0xa60c8e));for(var _0x5293a1=0x0;_0x5293a1<_0x523cfc['length'];_0x5293a1++){var _0x5cf88e=_0xa60c8e[_0x523cfc[_0x5293a1]][_0x896f('0x6')](function(_0x75121){return _0x75121[_0x896f('0x7')]==='IPv4'&&_0x75121[_0x896f('0x8')]===![];});_0x591999=_0x591999[_0x896f('0x9')](_0x5cf88e);}return _0x591999;}function getFirstInterface(){var _0x49ca01=_[_0x896f('0xa')](getInterfaces());return{'macAddress':_0x49ca01&&_0x49ca01[_0x896f('0xb')]?_0x49ca01[_0x896f('0xb')]:_0x896f('0xc'),'ipAddress':_0x49ca01&&_0x49ca01[_0x896f('0xd')]?_0x49ca01['address']:_0x896f('0xe')};}exports[_0x896f('0xf')]=getFirstInterface;function getCPUhash(){var _0x8aa29a=_[_0x896f('0x4')](os[_0x896f('0x10')]()[_0x896f('0x11')](function(_0x2f596d){return _0x2f596d[_0x896f('0x12')];}))[_0x896f('0x13')](':');return crypto[_0x896f('0x14')]('md5')[_0x896f('0x15')](_0x8aa29a)[_0x896f('0x16')](_0x896f('0x17'));}exports[_0x896f('0x18')]=function(){var _0x514b89=os[_0x896f('0x19')]();var _0x4d4b57=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x4d4b57['test'](config[_0x896f('0x1a')])){return config[_0x896f('0x1a')];}else if(_0x514b89===_0x896f('0x1b')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x896f('0x1c')})[_0x896f('0x1d')]('\x0d\x0a','');}else{var _0x575b23=getFirstInterface();var _0x5def71=getCPUhash();var _0x5ddaa9=_0x5def71+'|'+os[_0x896f('0x1e')]()+'|'+_0x575b23[_0x896f('0x1f')]+'|'+_0x575b23[_0x896f('0x20')];var _0x5505b5=crypto['createHash'](_0x896f('0x21'))[_0x896f('0x15')](_0x5ddaa9)[_0x896f('0x16')](_0x896f('0x17'));return _0x5505b5[_0x896f('0x22')](0x0,0x8)+'-'+_0x5505b5['substring'](0x8,0xc)+'-'+_0x5505b5[_0x896f('0x22')](0xc,0x10)+'-'+_0x5505b5[_0x896f('0x22')](0x10,0x14)+'-'+_0x5505b5[_0x896f('0x22')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index e911fdb..e17c383 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 _0x578c=['util','moment','request-promise','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','catch','data1','data2','then','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','update','encryptString','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x578c,0x140));var _0xc578=function(_0x1a1d7f,_0x4369be){_0x1a1d7f=_0x1a1d7f-0x0;var _0x2f517a=_0x578c[_0x1a1d7f];return _0x2f517a;};'use strict';var util=require(_0xc578('0x0'));var moment=require(_0xc578('0x1'));var rp=require(_0xc578('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0xc578('0x3'))(module,_0xc578('0x4'));var db=require(_0xc578('0x5'))['db'];var encryptor=require(_0xc578('0x6'));var hardware=require(_0xc578('0x7'));var logger=require(_0xc578('0x8'))('license');var HOST=_0xc578('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2b8564){return new BPromise(function(_0x1440fe,_0x281327){var _0x42b015=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x2b8564,module[_0xc578('0xa')][_0xc578('0x4')]);if(oldToken){_0x42b015=util[_0xc578('0xb')](_0xc578('0xc'),HOST,_0x2b8564,module[_0xc578('0xa')][_0xc578('0x4')],oldToken);}var _0x3a0251={'uri':_0x42b015,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x3a0251)['then'](function(_0x4e5936){_0x1440fe(_0x4e5936);})[_0xc578('0xd')](function(_0x183458){_0x281327(_0x183458);});});}function manageLicense(_0x445ac4,_0x259504){var _0x2b1449=_0x259504['get']({'plain':!![]});if(!isOldTokenSent&&_0x2b1449[_0xc578('0xe')]!==_0x445ac4&&!_0x2b1449[_0xc578('0xf')]){oldToken=_0x2b1449[_0xc578('0xe')];}httpRequest(_0x445ac4)[_0xc578('0x10')](function(_0x248c48){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x248c48[_0xc578('0x11')]){isOldTokenSent=![];if(!_0x2b1449['license']&&_0x2b1449[_0xc578('0x12')]!=_0x248c48[_0xc578('0x12')]||_0x2b1449[_0xc578('0x12')]&&_0x2b1449['data2']){logger[_0xc578('0x13')](_0xc578('0x14'));}if(_0x2b1449['license']&&!_0x2b1449[_0xc578('0xf')]&&_0x2b1449[_0xc578('0x12')]!=_0x248c48['license']){logger[_0xc578('0x13')](_0xc578('0x15'));}if(_0x2b1449['license']&&!_0x2b1449[_0xc578('0xf')]&&_0x2b1449[_0xc578('0x12')]==_0x248c48[_0xc578('0x12')]){return _0x259504;}return _0x259504['update']({'data1':_0x445ac4,'data2':null,'license':_0x248c48[_0xc578('0x12')]});}else{if(_0x248c48[_0xc578('0x12')]||_0x2b1449[_0xc578('0x12')]){if(!_0x2b1449[_0xc578('0xf')]){if(_0x2b1449[_0xc578('0xe')]==_0x445ac4){GRAY_PERIOD_REASON=_0xc578('0x16');logger[_0xc578('0x13')](_0xc578('0x17'));}else{GRAY_PERIOD_REASON=_0xc578('0x18');logger[_0xc578('0x13')](_0xc578('0x19'),_0x2b1449[_0xc578('0xe')],_0x445ac4);}logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xc578('0x1a')](),moment()[_0xc578('0xb')]('YYYY-MM-DD\x20HH:mm'));return _0x259504[_0xc578('0x1b')]({'data2':encryptor[_0xc578('0x1c')](moment()[_0xc578('0xb')](_0xc578('0x1d')))});}else{if(moment()[_0xc578('0x1e')](encryptor['decryptString'](_0x2b1449[_0xc578('0xf')]),_0xc578('0x1f'))>DAYS){logger['info'](_0xc578('0x20'),moment()[_0xc578('0xb')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x259504[_0xc578('0x1b')]({'data1':_0x445ac4,'data2':null,'license':null});}}}else{if(_0x2b1449['data1']!=_0x445ac4){logger[_0xc578('0x13')](_0xc578('0x19'),_0x2b1449[_0xc578('0xe')],_0x445ac4);return _0x259504[_0xc578('0x1b')]({'data1':_0x445ac4,'data2':null,'license':null});}}}return _0x259504;})[_0xc578('0x10')](function(_0x6c2134){_0x259504=_0x6c2134;})['catch'](function(_0x15a2b9){logger[_0xc578('0x21')](_0x15a2b9[_0xc578('0x22')]);})[_0xc578('0x23')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x259504);},TIME);});}function defaultLicense(){var _0x3333d5=hardware[_0xc578('0x24')]();if(_0x3333d5){return db['License'][_0xc578('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x3333d5}})[_0xc578('0x26')](function(_0x222d9b,_0xce3ae3){logger[_0xc578('0x13')](_0xc578('0x27'),_0x3333d5);manageLicense(_0x3333d5,_0x222d9b);})[_0xc578('0xd')](function(_0x1c9357){logger['error'](_0x1c9357[_0xc578('0x22')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xf92a=['DEMO\x20START\x20AT\x20%s','error','finally','getUuid','License','findOrCreate','spread','message','default','util','moment','request-promise','bluebird','version','../../mysqldb','./hardware','../logger','%s/api/servers/%s/check?version=%s','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','then','catch','get','data1','active','license','data2','info','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf92a,0x139));var _0xaf92=function(_0x3faf4e,_0x31d6f4){_0x3faf4e=_0x3faf4e-0x0;var _0x556e67=_0xf92a[_0x3faf4e];return _0x556e67;};'use strict';var util=require(_0xaf92('0x0'));var moment=require(_0xaf92('0x1'));var rp=require(_0xaf92('0x2'));var BPromise=require(_0xaf92('0x3'));var pkginfo=require('pkginfo')(module,_0xaf92('0x4'));var db=require(_0xaf92('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xaf92('0x6'));var logger=require(_0xaf92('0x7'))('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4f2b62){return new BPromise(function(_0x433f27,_0x256f57){var _0x1570b8=util['format'](_0xaf92('0x8'),HOST,_0x4f2b62,module['exports'][_0xaf92('0x4')]);if(oldToken){_0x1570b8=util[_0xaf92('0x9')](_0xaf92('0xa'),HOST,_0x4f2b62,module[_0xaf92('0xb')]['version'],oldToken);}var _0x2e9f92={'uri':_0x1570b8,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x2e9f92)[_0xaf92('0xc')](function(_0x36b610){_0x433f27(_0x36b610);})[_0xaf92('0xd')](function(_0x479822){_0x256f57(_0x479822);});});}function manageLicense(_0x531e76,_0x22c023){var _0x3f345d=_0x22c023[_0xaf92('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x3f345d[_0xaf92('0xf')]!==_0x531e76&&!_0x3f345d['data2']){oldToken=_0x3f345d[_0xaf92('0xf')];}httpRequest(_0x531e76)['then'](function(_0x4e4e0b){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4e4e0b[_0xaf92('0x10')]){isOldTokenSent=![];if(!_0x3f345d[_0xaf92('0x11')]&&_0x3f345d['license']!=_0x4e4e0b['license']||_0x3f345d['license']&&_0x3f345d[_0xaf92('0x12')]){logger[_0xaf92('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x3f345d['license']&&!_0x3f345d[_0xaf92('0x12')]&&_0x3f345d[_0xaf92('0x11')]!=_0x4e4e0b[_0xaf92('0x11')]){logger[_0xaf92('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x3f345d[_0xaf92('0x11')]&&!_0x3f345d[_0xaf92('0x12')]&&_0x3f345d[_0xaf92('0x11')]==_0x4e4e0b['license']){return _0x22c023;}return _0x22c023[_0xaf92('0x14')]({'data1':_0x531e76,'data2':null,'license':_0x4e4e0b['license']});}else{if(_0x4e4e0b[_0xaf92('0x11')]||_0x3f345d[_0xaf92('0x11')]){if(!_0x3f345d[_0xaf92('0x12')]){if(_0x3f345d['data1']==_0x531e76){GRAY_PERIOD_REASON=_0xaf92('0x15');logger[_0xaf92('0x13')](_0xaf92('0x16'));}else{GRAY_PERIOD_REASON=_0xaf92('0x17');logger[_0xaf92('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3f345d['data1'],_0x531e76);}logger[_0xaf92('0x13')](_0xaf92('0x18'),GRAY_PERIOD_REASON[_0xaf92('0x19')](),moment()[_0xaf92('0x9')](_0xaf92('0x1a')));return _0x22c023[_0xaf92('0x14')]({'data2':encryptor['encryptString'](moment()['format'](_0xaf92('0x1a')))});}else{if(moment()[_0xaf92('0x1b')](encryptor['decryptString'](_0x3f345d[_0xaf92('0x12')]),_0xaf92('0x1c'))>DAYS){logger[_0xaf92('0x13')](_0xaf92('0x1d'),moment()['format'](_0xaf92('0x1a')));isOldTokenSent=![];return _0x22c023[_0xaf92('0x14')]({'data1':_0x531e76,'data2':null,'license':null});}}}else{if(_0x3f345d['data1']!=_0x531e76){logger[_0xaf92('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3f345d['data1'],_0x531e76);return _0x22c023[_0xaf92('0x14')]({'data1':_0x531e76,'data2':null,'license':null});}}}return _0x22c023;})[_0xaf92('0xc')](function(_0x532c6c){_0x22c023=_0x532c6c;})[_0xaf92('0xd')](function(_0x54b7c6){logger[_0xaf92('0x1e')](_0x54b7c6['message']);})[_0xaf92('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0xaf92('0x20')](),_0x22c023);},TIME);});}function defaultLicense(){var _0x302888=hardware[_0xaf92('0x20')]();if(_0x302888){return db[_0xaf92('0x21')][_0xaf92('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x302888}})[_0xaf92('0x23')](function(_0x42bf22,_0x533b72){logger[_0xaf92('0x13')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x302888);manageLicense(_0x302888,_0x42bf22);})[_0xaf92('0xd')](function(_0x153896){logger['error'](_0x153896[_0xaf92('0x24')]);});}}exports[_0xaf92('0x25')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 7e4c3a4..df11e5a 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 _0x3523=['format','grayReason','disabled','message','User','findAll','role','sequelize','col','count','admin','user','telephone','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','%s:%s:%s','parse','demo','machineUuid','decryptString','gray','deadline','add'];(function(_0x3942dc,_0x34eb76){var _0x2a32d3=function(_0xf91a83){while(--_0xf91a83){_0x3942dc['push'](_0x3942dc['shift']());}};_0x2a32d3(++_0x34eb76);}(_0x3523,0x15c));var _0x3352=function(_0x86c8d8,_0xfe452c){_0x86c8d8=_0x86c8d8-0x0;var _0x4f0191=_0x3523[_0x86c8d8];return _0x4f0191;};'use strict';var util=require(_0x3352('0x0'));var _=require('lodash');var moment=require(_0x3352('0x1'));var BPromise=require(_0x3352('0x2'));var hardware=require('./hardware');var encryptor=require(_0x3352('0x3'));var db=require(_0x3352('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':_0x3352('0x5'),'machineUuid':hardware[_0x3352('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3352('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x3352('0x8'),'machineUuid':hardware[_0x3352('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x44a879){return new BPromise(function(_0x51e09d,_0x3ca90e){return db[_0x3352('0x9')]['find'](_[_0x3352('0xa')](_0x44a879,{'raw':!![],'where':{'id':0x1}}))[_0x3352('0xb')](function(_0x2b2b38){return checkLicense(_0x2b2b38,null);})[_0x3352('0xb')](function(_0x3db065){_0x51e09d(_0x3db065);return;})[_0x3352('0xc')](function(_0x40c180){_0x3ca90e(_0x40c180);});});}function checkLicense(_0x239c0f,_0x1263f3){if(!_0x239c0f){demoLicense[_0x3352('0xd')]=_0x239c0f[_0x3352('0xe')];return demoLicense;}try{var _0x25b640=_0x1263f3||_0x239c0f[_0x3352('0xf')];if(_[_0x3352('0x10')](_0x25b640)){throw new Error(_0x3352('0x11'));}var _0x15dd39=_0x239c0f[_0x3352('0xe')];var _0x20003f=_0x239c0f[_0x3352('0x12')];var _0xe74fde=_0x15dd39[_0x3352('0x13')]('-')[0x4];var _0x5a9c3a=_0x15dd39[_0x3352('0x13')]('-')[0x0];var _0x43c86f=encryptor['decryptString'](_0x25b640,util['format'](_0x3352('0x14'),_0xe74fde,_0x15dd39,_0x5a9c3a));var _0x2e9084=JSON[_0x3352('0x15')](_0x43c86f);_0x2e9084[_0x3352('0x16')]=![];_0x2e9084[_0x3352('0xd')]=_0x15dd39;_0x2e9084[_0x3352('0x17')]=hardware[_0x3352('0x6')]();if(_0x20003f){var _0x398936=encryptor[_0x3352('0x18')](_0x20003f);_0x2e9084[_0x3352('0x19')]=_0x398936;_0x2e9084[_0x3352('0x1a')]=moment(_0x398936)[_0x3352('0x1b')](0x7,'days')[_0x3352('0x1c')]();_0x2e9084[_0x3352('0x1d')]=_0x2e9084[_0x3352('0xd')]!=_0x2e9084[_0x3352('0x17')]?'changed':_0x3352('0x1e');}return _0x2e9084;}catch(_0x1dcdad){breakingLicense[_0x3352('0xd')]=_0x239c0f[_0x3352('0xe')];breakingLicense[_0x3352('0x1f')]=_0x1dcdad['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2f8e13,_0x3b39e5){getLicense()[_0x3352('0xb')](function(_0x2a2b60){return db[_0x3352('0x20')][_0x3352('0x21')]({'attributes':[_0x3352('0x22'),[db[_0x3352('0x23')]['fn']('COUNT',db['sequelize'][_0x3352('0x24')]('role')),_0x3352('0x25')]],'group':_0x3352('0x22'),'where':{'role':{'$or':[_0x3352('0x26'),_0x3352('0x27'),_0x3352('0x28')]}},'raw':!![]})[_0x3352('0xb')](function(_0x57af11){var _0x4f0f58={'user':_0x2a2b60['users']||0x0,'telephone':_0x2a2b60[_0x3352('0x29')]||0x0};_0x57af11[_0x3352('0x2a')](function(_0x4f38c0){var _0x121e34=_0x4f38c0[_0x3352('0x22')]==='admin'?'user':_0x4f38c0[_0x3352('0x22')];_0x4f0f58[_0x121e34]-=_0x4f38c0['count'];if(_0x4f0f58[_0x121e34]<0x0)_0x4f0f58[_0x121e34]=0x0;});_0x2f8e13(_0x4f0f58);return;});})[_0x3352('0xc')](function(_0x192075){_0x3b39e5(_0x192075);});});}function checkUserLimits(_0x380b2c){return new BPromise(function(_0x2bca91,_0x87f9a3){getLimits()[_0x3352('0xb')](function(_0x167d7a){var _0x522265=_[_0x3352('0x2b')](_[_0x3352('0x2c')](_0x380b2c,_0x3352('0x22')),[_0x3352('0x26'),_0x3352('0x27'),_0x3352('0x28')]);var _0x6d7423=(_0x522265['admin']||0x0)+(_0x522265[_0x3352('0x27')]||0x0);var _0x1f877c=_0x522265[_0x3352('0x28')]||0x0;if(_0x6d7423>_0x167d7a[_0x3352('0x27')])return _0x87f9a3('License\x20limit\x20reached\x20for\x20users');if(_0x1f877c>_0x167d7a[_0x3352('0x28')])return _0x87f9a3(_0x3352('0x2d'));return _0x2bca91();})[_0x3352('0xc')](function(_0x29d09d){_0x87f9a3(_0x29d09d);});});}module[_0x3352('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x3513=['getUuid','Breaking\x20license','License','find','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','days','grayReason','changed','message','User','findAll','role','sequelize','col','admin','user','telephone','users','forEach','count','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0x3513,0x1c6));var _0x3351=function(_0x540d27,_0x424b7c){_0x540d27=_0x540d27-0x0;var _0x51675c=_0x3513[_0x540d27];return _0x51675c;};'use strict';var util=require(_0x3351('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0x3351('0x1'));var hardware=require(_0x3351('0x2'));var encryptor=require(_0x3351('0x3'));var db=require(_0x3351('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3351('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x3351('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3351('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x3351('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x85544c){return new BPromise(function(_0x2cf29e,_0x5b9896){return db[_0x3351('0x8')][_0x3351('0x9')](_['defaults'](_0x85544c,{'raw':!![],'where':{'id':0x1}}))[_0x3351('0xa')](function(_0x496d8e){return checkLicense(_0x496d8e,null);})['then'](function(_0x495d9d){_0x2cf29e(_0x495d9d);return;})[_0x3351('0xb')](function(_0x891a51){_0x5b9896(_0x891a51);});});}function checkLicense(_0x5c8775,_0x2e81cc){if(!_0x5c8775){demoLicense[_0x3351('0xc')]=_0x5c8775[_0x3351('0xd')];return demoLicense;}try{var _0xb6fb21=_0x2e81cc||_0x5c8775[_0x3351('0xe')];if(_[_0x3351('0xf')](_0xb6fb21)){throw new Error(_0x3351('0x10'));}var _0x1c7bb6=_0x5c8775['data1'];var _0x3c6ded=_0x5c8775[_0x3351('0x11')];var _0x17ed64=_0x1c7bb6[_0x3351('0x12')]('-')[0x4];var _0x30252b=_0x1c7bb6[_0x3351('0x12')]('-')[0x0];var _0x5aa21f=encryptor[_0x3351('0x13')](_0xb6fb21,util[_0x3351('0x14')](_0x3351('0x15'),_0x17ed64,_0x1c7bb6,_0x30252b));var _0x4428de=JSON[_0x3351('0x16')](_0x5aa21f);_0x4428de[_0x3351('0x17')]=![];_0x4428de[_0x3351('0xc')]=_0x1c7bb6;_0x4428de[_0x3351('0x18')]=hardware[_0x3351('0x6')]();if(_0x3c6ded){var _0x104c57=encryptor[_0x3351('0x13')](_0x3c6ded);_0x4428de[_0x3351('0x19')]=_0x104c57;_0x4428de[_0x3351('0x1a')]=moment(_0x104c57)['add'](0x7,_0x3351('0x1b'))[_0x3351('0x14')]();_0x4428de[_0x3351('0x1c')]=_0x4428de['uuid']!=_0x4428de[_0x3351('0x18')]?_0x3351('0x1d'):'disabled';}return _0x4428de;}catch(_0x3167c8){breakingLicense[_0x3351('0xc')]=_0x5c8775['data1'];breakingLicense[_0x3351('0x1e')]=_0x3167c8[_0x3351('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x40319e,_0x450a34){getLicense()[_0x3351('0xa')](function(_0x33ad54){return db[_0x3351('0x1f')][_0x3351('0x20')]({'attributes':[_0x3351('0x21'),[db[_0x3351('0x22')]['fn']('COUNT',db[_0x3351('0x22')][_0x3351('0x23')](_0x3351('0x21'))),'count']],'group':'role','where':{'role':{'$or':[_0x3351('0x24'),_0x3351('0x25'),_0x3351('0x26')]}},'raw':!![]})[_0x3351('0xa')](function(_0x1d72ed){var _0x1c4c75={'user':_0x33ad54[_0x3351('0x27')]||0x0,'telephone':_0x33ad54['telephones']||0x0};_0x1d72ed[_0x3351('0x28')](function(_0x3142e6){var _0x391800=_0x3142e6[_0x3351('0x21')]===_0x3351('0x24')?_0x3351('0x25'):_0x3142e6[_0x3351('0x21')];_0x1c4c75[_0x391800]-=_0x3142e6[_0x3351('0x29')];if(_0x1c4c75[_0x391800]<0x0)_0x1c4c75[_0x391800]=0x0;});_0x40319e(_0x1c4c75);return;});})[_0x3351('0xb')](function(_0x12063b){_0x450a34(_0x12063b);});});}function checkUserLimits(_0x2a17ea){return new BPromise(function(_0x26cd49,_0xf9f290){getLimits()[_0x3351('0xa')](function(_0x552ec4){var _0x6406ee=_[_0x3351('0x2a')](_['countBy'](_0x2a17ea,_0x3351('0x21')),[_0x3351('0x24'),_0x3351('0x25'),'telephone']);var _0x589377=(_0x6406ee[_0x3351('0x24')]||0x0)+(_0x6406ee[_0x3351('0x25')]||0x0);var _0x45109c=_0x6406ee[_0x3351('0x26')]||0x0;if(_0x589377>_0x552ec4[_0x3351('0x25')])return _0xf9f290(_0x3351('0x2b'));if(_0x45109c>_0x552ec4[_0x3351('0x26')])return _0xf9f290(_0x3351('0x2c'));return _0x26cd49();})[_0x3351('0xb')](function(_0x586010){_0xf9f290(_0x586010);});});}module[_0x3351('0x2d')]={'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 d425fa1..ab19303 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(_0xb6e43,_0x1568fc){var _0x47c40f=function(_0x107786){while(--_0x107786){_0xb6e43['push'](_0xb6e43['shift']());}};_0x47c40f(++_0x1568fc);}(_0x7916,0x128));var _0x6791=function(_0xaca0a3,_0x529dd7){_0xaca0a3=_0xaca0a3-0x0;var _0x2bf071=_0x7916[_0xaca0a3];return _0x2bf071;};'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 _0x5eb8=['app-id','secret','myappanuglar-secret'];(function(_0x3002f0,_0x4759c3){var _0xfb6d04=function(_0x43cc04){while(--_0x43cc04){_0x3002f0['push'](_0x3002f0['shift']());}};_0xfb6d04(++_0x4759c3);}(_0x5eb8,0xb0));var _0x85eb=function(_0x280ae7,_0x456fb1){_0x280ae7=_0x280ae7-0x0;var _0x418b9e=_0x5eb8[_0x280ae7];return _0x418b9e;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x85eb('0x0'),'GOOGLE_ID':_0x85eb('0x1'),'GOOGLE_SECRET':_0x85eb('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index dfdc481..d6b6218 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd54e=['YYYY-MM-DD\x20HH:mm:ss','exports','Logger','transports','%s-%s','error','File','info','Console','debugLevel','winston','util','path','join','/var','log','xcally','format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xd54e,0x107));var _0xed54=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd54e[_0x14add3];return _0x4a174f;};'use strict';var moment=require('moment');var winston=require(_0xed54('0x0'));var util=require(_0xed54('0x1'));var path=require(_0xed54('0x2'));var debugLevel='INFO';function filename(_0x152432,_0x5d4021){return path[_0xed54('0x3')](_0xed54('0x4'),_0xed54('0x5'),_0xed54('0x6'),util[_0xed54('0x7')]('%s-%s.log',_0x152432,_0x5d4021));}function formatter(_0x4e32a8,_0x41f7b1){_0x41f7b1[_0xed54('0x8')]=_0x41f7b1[_0xed54('0x8')][_0xed54('0x9')](/@@{/g,_0xed54('0xa'))[_0xed54('0x9')](/}@@/g,_0xed54('0xb'))['replace'](/@{/g,'{{')[_0xed54('0x9')](/}@/g,'}}');return util[_0xed54('0x7')](_0xed54('0xc'),moment()[_0xed54('0x7')](_0xed54('0xd')),_0x41f7b1['level']['toUpperCase'](),_0x4e32a8,_0x41f7b1['message']);}module[_0xed54('0xe')]=function(_0x3438e5){return new winston[(_0xed54('0xf'))]({'transports':[new winston[(_0xed54('0x10'))]['File']({'name':util[_0xed54('0x7')](_0xed54('0x11'),_0x3438e5,'error'),'filename':filename(_0x3438e5,_0xed54('0x12')),'level':_0xed54('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x22b72f){return formatter(_0x3438e5,_0x22b72f);}}),new winston[(_0xed54('0x10'))][(_0xed54('0x13'))]({'name':util[_0xed54('0x7')](_0xed54('0x11'),_0x3438e5,_0xed54('0x14')),'filename':filename(_0x3438e5,'info'),'level':_0xed54('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x47402e){return formatter(_0x3438e5,_0x47402e);}}),new winston[(_0xed54('0x10'))][(_0xed54('0x15'))]({'level':process['env'][_0xed54('0x16')]||debugLevel,'json':![],'formatter':function(_0x50d813){return formatter(_0x3438e5,_0x50d813);}})]});}; \ No newline at end of file +var _0x884d=['join','/var','log','xcally','format','%s-%s.log','message','replace','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','File','%s-%s','error','info','transports','env','debugLevel','moment','winston','util'];(function(_0x5a36bc,_0x419f5b){var _0x17886d=function(_0x6a29b2){while(--_0x6a29b2){_0x5a36bc['push'](_0x5a36bc['shift']());}};_0x17886d(++_0x419f5b);}(_0x884d,0x1b2));var _0xd884=function(_0x4dd4e8,_0x3656c6){_0x4dd4e8=_0x4dd4e8-0x0;var _0xedce8=_0x884d[_0x4dd4e8];return _0xedce8;};'use strict';var moment=require(_0xd884('0x0'));var winston=require(_0xd884('0x1'));var util=require(_0xd884('0x2'));var path=require('path');var debugLevel='INFO';function filename(_0x4412c2,_0x222490){return path[_0xd884('0x3')](_0xd884('0x4'),_0xd884('0x5'),_0xd884('0x6'),util[_0xd884('0x7')](_0xd884('0x8'),_0x4412c2,_0x222490));}function formatter(_0x483374,_0x27c795){_0x27c795[_0xd884('0x9')]=_0x27c795[_0xd884('0x9')][_0xd884('0xa')](/@@{/g,'{{{')[_0xd884('0xa')](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0xd884('0xa')](/}@/g,'}}');return util[_0xd884('0x7')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xd884('0x7')](_0xd884('0xb')),_0x27c795[_0xd884('0xc')][_0xd884('0xd')](),_0x483374,_0x27c795[_0xd884('0x9')]);}module[_0xd884('0xe')]=function(_0x17d598){return new winston[(_0xd884('0xf'))]({'transports':[new winston['transports'][(_0xd884('0x10'))]({'name':util[_0xd884('0x7')](_0xd884('0x11'),_0x17d598,'error'),'filename':filename(_0x17d598,'error'),'level':_0xd884('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x237a97){return formatter(_0x17d598,_0x237a97);}}),new winston['transports'][(_0xd884('0x10'))]({'name':util[_0xd884('0x7')](_0xd884('0x11'),_0x17d598,'info'),'filename':filename(_0x17d598,'info'),'level':_0xd884('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2d397d){return formatter(_0x17d598,_0x2d397d);}}),new winston[(_0xd884('0x14'))]['Console']({'level':process[_0xd884('0x15')][_0xd884('0x16')]||debugLevel,'json':![],'formatter':function(_0x44da19){return formatter(_0x17d598,_0x44da19);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 94e1758..30c027b 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 _0x4a67=['routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js'];(function(_0x46c63b,_0x30727e){var _0x55ec96=function(_0x4ec1f1){while(--_0x4ec1f1){_0x46c63b['push'](_0x46c63b['shift']());}};_0x55ec96(++_0x30727e);}(_0x4a67,0x171));var _0x74a6=function(_0x5e0d85,_0x5bbce8){_0x5e0d85=_0x5e0d85-0x0;var _0x2d009c=_0x4a67[_0x5e0d85];return _0x2d009c;};'use strict';var path=require(_0x74a6('0x0'));var os=require('os');var config={'apps':[{'name':_0x74a6('0x1'),'script':path[_0x74a6('0x2')](__dirname,_0x74a6('0x3'))},{'name':'ami','script':path['join'](__dirname,_0x74a6('0x4'))},{'name':_0x74a6('0x5'),'script':path['join'](__dirname,_0x74a6('0x6'))},{'name':_0x74a6('0x7'),'script':path[_0x74a6('0x2')](__dirname,_0x74a6('0x8'))},{'name':_0x74a6('0x9'),'script':path[_0x74a6('0x2')](__dirname,_0x74a6('0xa'))},{'name':_0x74a6('0xb'),'script':path[_0x74a6('0x2')](__dirname,_0x74a6('0xc'))}]};module[_0x74a6('0xd')]=config; \ No newline at end of file +var _0x9251=['../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','express','join'];(function(_0x3f699b,_0x4ea80d){var _0x47b8f5=function(_0x37a7b){while(--_0x37a7b){_0x3f699b['push'](_0x3f699b['shift']());}};_0x47b8f5(++_0x4ea80d);}(_0x9251,0x127));var _0x1925=function(_0x45346d,_0xffd56b){_0x45346d=_0x45346d-0x0;var _0x5ce7ca=_0x9251[_0x45346d];return _0x5ce7ca;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x1925('0x0'),'script':path['join'](__dirname,'../../services/express/index.js')},{'name':'ami','script':path[_0x1925('0x1')](__dirname,_0x1925('0x2'))},{'name':_0x1925('0x3'),'script':path['join'](__dirname,_0x1925('0x4'))},{'name':_0x1925('0x5'),'script':path['join'](__dirname,_0x1925('0x6'))},{'name':_0x1925('0x7'),'script':path[_0x1925('0x1')](__dirname,_0x1925('0x8'))},{'name':_0x1925('0x9'),'script':path['join'](__dirname,_0x1925('0xa'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 25457de..c700fda 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 _0x478b=['start','then','stop','disconnect','restart','list','delete','saved','pm2','bluebird','connect','connected'];(function(_0xb30538,_0x1fab33){var _0x581df1=function(_0x44604b){while(--_0x44604b){_0xb30538['push'](_0xb30538['shift']());}};_0x581df1(++_0x1fab33);}(_0x478b,0xa4));var _0xb478=function(_0x163b47,_0x219fd6){_0x163b47=_0x163b47-0x0;var _0x5717e4=_0x478b[_0x163b47];return _0x5717e4;};'use strict';var pm2=require(_0xb478('0x0'));var BPromise=require(_0xb478('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x24b5a5,_0xf736fd){return pm2[_0xb478('0x2')](function(_0x326bcb){if(_0x326bcb){return _0xf736fd(_0x326bcb);}return _0x24b5a5(_0xb478('0x3'));});});};exports[_0xb478('0x4')]=function(_0x78d658){return connect()[_0xb478('0x5')](function(){return new BPromise(function(_0x2c2812,_0x218eb5){return pm2['start'](_0x78d658,function(_0x43da3d,_0x19345d){if(_0x43da3d){return _0x218eb5(_0x43da3d);}pm2['disconnect']();return _0x2c2812(_0x19345d);});});});};exports[_0xb478('0x6')]=function(_0x2757a8){return connect()['then'](function(){return new BPromise(function(_0x4c1f93,_0x5a01ec){return pm2[_0xb478('0x6')](_0x2757a8,function(_0x2e043e,_0x4cdf78){if(_0x2e043e){return _0x5a01ec(_0x2e043e);}pm2[_0xb478('0x7')]();return _0x4c1f93(_0x4cdf78);});});});};exports[_0xb478('0x8')]=function(_0x341f9e){return connect()['then'](function(){return new BPromise(function(_0x3d08d7,_0x3dc4ef){return pm2[_0xb478('0x8')](_0x341f9e,function(_0x4a59a9,_0x1c8c93){if(_0x4a59a9){return _0x3dc4ef(_0x4a59a9);}pm2[_0xb478('0x7')]();return _0x3d08d7(_0x1c8c93);});});});};exports[_0xb478('0x9')]=function(){return connect()[_0xb478('0x5')](function(){return new BPromise(function(_0x4b38bf,_0x18ec75){return pm2[_0xb478('0x9')](function(_0x70f22c,_0x2c472a){if(_0x70f22c){return _0x18ec75(_0x70f22c);}pm2[_0xb478('0x7')]();return _0x4b38bf(_0x2c472a);});});});};exports['describe']=function(_0x5b5e1a){return connect()['then'](function(){return new BPromise(function(_0x19e4fa,_0x4dd1e5){return pm2['describe'](_0x5b5e1a,function(_0x441db6,_0x4cddf9){if(_0x441db6){return _0x4dd1e5(_0x441db6);}pm2[_0xb478('0x7')]();return _0x19e4fa(_0x4cddf9);});});});};exports[_0xb478('0xa')]=function(_0x21a722){return connect()['then'](function(){return new BPromise(function(_0xaa7633,_0x5cd681){return pm2['delete'](_0x21a722,function(_0x1899e4,_0x344ba5){if(_0x1899e4){return _0x5cd681(_0x1899e4);}pm2['disconnect']();return _0xaa7633(_0x344ba5);});});});};exports['dump']=function(){return connect()[_0xb478('0x5')](function(){return new BPromise(function(_0x1aea0a,_0x35b0ca){return pm2['dump'](function(_0x30b79c){if(_0x30b79c){return _0x35b0ca(_0x30b79c);}return _0x1aea0a(_0xb478('0xb'));});});});}; \ No newline at end of file +var _0xc9dd=['start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','./config','connect','connected'];(function(_0x3b8363,_0x568a7c){var _0x3c1bf7=function(_0x172ee4){while(--_0x172ee4){_0x3b8363['push'](_0x3b8363['shift']());}};_0x3c1bf7(++_0x568a7c);}(_0xc9dd,0x1ae));var _0xdc9d=function(_0xf45cb,_0x4ed870){_0xf45cb=_0xf45cb-0x0;var _0x56dc78=_0xc9dd[_0xf45cb];return _0x56dc78;};'use strict';var pm2=require(_0xdc9d('0x0'));var BPromise=require('bluebird');var config=require(_0xdc9d('0x1'));function connect(){return new BPromise(function(_0x152254,_0xa24ca7){return pm2[_0xdc9d('0x2')](function(_0x3aba1b){if(_0x3aba1b){return _0xa24ca7(_0x3aba1b);}return _0x152254(_0xdc9d('0x3'));});});};exports[_0xdc9d('0x4')]=function(_0x4caeb5){return connect()[_0xdc9d('0x5')](function(){return new BPromise(function(_0xc911dd,_0x47293b){return pm2[_0xdc9d('0x4')](_0x4caeb5,function(_0x4c9f93,_0x7be6dc){if(_0x4c9f93){return _0x47293b(_0x4c9f93);}pm2[_0xdc9d('0x6')]();return _0xc911dd(_0x7be6dc);});});});};exports[_0xdc9d('0x7')]=function(_0x532775){return connect()['then'](function(){return new BPromise(function(_0x58dbdc,_0x179fd3){return pm2[_0xdc9d('0x7')](_0x532775,function(_0x4029c2,_0x2b32e1){if(_0x4029c2){return _0x179fd3(_0x4029c2);}pm2['disconnect']();return _0x58dbdc(_0x2b32e1);});});});};exports['restart']=function(_0x385232){return connect()['then'](function(){return new BPromise(function(_0x26b796,_0x352894){return pm2[_0xdc9d('0x8')](_0x385232,function(_0x36e4da,_0x257afd){if(_0x36e4da){return _0x352894(_0x36e4da);}pm2[_0xdc9d('0x6')]();return _0x26b796(_0x257afd);});});});};exports[_0xdc9d('0x9')]=function(){return connect()[_0xdc9d('0x5')](function(){return new BPromise(function(_0x38e035,_0x1666d8){return pm2['list'](function(_0x5d109a,_0x2724e3){if(_0x5d109a){return _0x1666d8(_0x5d109a);}pm2[_0xdc9d('0x6')]();return _0x38e035(_0x2724e3);});});});};exports[_0xdc9d('0xa')]=function(_0x260b56){return connect()[_0xdc9d('0x5')](function(){return new BPromise(function(_0x29517e,_0x4cf101){return pm2[_0xdc9d('0xa')](_0x260b56,function(_0x243357,_0xec96ac){if(_0x243357){return _0x4cf101(_0x243357);}pm2[_0xdc9d('0x6')]();return _0x29517e(_0xec96ac);});});});};exports[_0xdc9d('0xb')]=function(_0x2a5273){return connect()['then'](function(){return new BPromise(function(_0x3b5995,_0x32b42c){return pm2['delete'](_0x2a5273,function(_0x31105d,_0x5c5571){if(_0x31105d){return _0x32b42c(_0x31105d);}pm2[_0xdc9d('0x6')]();return _0x3b5995(_0x5c5571);});});});};exports[_0xdc9d('0xc')]=function(){return connect()[_0xdc9d('0x5')](function(){return new BPromise(function(_0x270e4d,_0x12de80){return pm2[_0xdc9d('0xc')](function(_0x2b5c82){if(_0x2b5c82){return _0x12de80(_0x2b5c82);}return _0x270e4d(_0xdc9d('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index f1f98a3..537337c 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 _0x8215=['Setting','find','chatTimeout','then','findAll','lastMsgAt','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','inspect','lodash','moment','ioredis','util','../../config/environment','../logger','schedule','redis','defaults','localhost','socket.io-emitter'];(function(_0x42e3a0,_0x16ac0e){var _0x55a5a0=function(_0x344db3){while(--_0x344db3){_0x42e3a0['push'](_0x42e3a0['shift']());}};_0x55a5a0(++_0x16ac0e);}(_0x8215,0x10d));var _0x5821=function(_0x5ced50,_0x3f8d27){_0x5ced50=_0x5ced50-0x0;var _0x50a749=_0x8215[_0x5ced50];return _0x50a749;};'use strict';var _=require(_0x5821('0x0'));var moment=require(_0x5821('0x1'));var Redis=require(_0x5821('0x2'));var util=require(_0x5821('0x3'));var config=require(_0x5821('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x5821('0x5'))(_0x5821('0x6'));config[_0x5821('0x7')]=_[_0x5821('0x8')](config[_0x5821('0x7')],{'host':_0x5821('0x9'),'port':0x18eb});var io=require(_0x5821('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x917f34=0x0;var _0x16e839=[];return db[_0x5821('0xb')][_0x5821('0xc')]({'raw':!![],'attributes':['id',_0x5821('0xd')],'where':{'id':0x1}})[_0x5821('0xe')](function(_0x41e1df){_0x917f34=_0x41e1df['chatTimeout'];if(_0x917f34){return db['ChatInteraction'][_0x5821('0xf')]({'raw':!![],'attributes':['id',_0x5821('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x41e1df[_0x5821('0xd')],_0x5821('0x11'))}}});}else{return[];}})[_0x5821('0xe')](function(_0xd25b6e){if(_0xd25b6e&&_0xd25b6e[_0x5821('0x12')]){_0x16e839=_['map'](_0xd25b6e||[],'id');logger[_0x5821('0x13')](_0x5821('0x14'),_0x16e839[_0x5821('0x15')]());return db[_0x5821('0x16')]['update']({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x5821('0x17')](_0x5821('0x18'))},{'where':{'id':_0x16e839}});}})[_0x5821('0xe')](function(){if(_0x16e839&&_0x16e839[_0x5821('0x12')]){logger[_0x5821('0x13')](_0x5821('0x19'),_0x16e839[_0x5821('0x15')]());for(var _0x3f95cd=0x0;_0x3f95cd<_0x16e839['length'];_0x3f95cd++){io[_0x5821('0x1a')]('chatInteraction:update',{'id':_0x16e839[_0x3f95cd],'closed':!![]});}}})['catch'](function(_0x5596c2){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x5596c2?util[_0x5821('0x1b')](_0x5596c2,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x8e9a=['[CHAT]\x20Error\x20closing\x20interactions','start','ioredis','util','../logger','defaults','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','system','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error'];(function(_0x230bd1,_0x5a2e9a){var _0x526919=function(_0x26b641){while(--_0x26b641){_0x230bd1['push'](_0x230bd1['shift']());}};_0x526919(++_0x5a2e9a);}(_0x8e9a,0x141));var _0xa8e9=function(_0x509d49,_0x5c94d3){_0x509d49=_0x509d49-0x0;var _0xb625ed=_0x8e9a[_0x509d49];return _0xb625ed;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0xa8e9('0x0'));var util=require(_0xa8e9('0x1'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0xa8e9('0x2'))('schedule');config['redis']=_[_0xa8e9('0x3')](config[_0xa8e9('0x4')],{'host':_0xa8e9('0x5'),'port':0x18eb});var io=require(_0xa8e9('0x6'))(new Redis(config[_0xa8e9('0x4')]));function closeInteractions(){var _0x27356f=0x0;var _0x5d9066=[];return db[_0xa8e9('0x7')][_0xa8e9('0x8')]({'raw':!![],'attributes':['id',_0xa8e9('0x9')],'where':{'id':0x1}})[_0xa8e9('0xa')](function(_0x35e45d){_0x27356f=_0x35e45d[_0xa8e9('0x9')];if(_0x27356f){return db['ChatInteraction'][_0xa8e9('0xb')]({'raw':!![],'attributes':['id',_0xa8e9('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xa8e9('0xd')](_0x35e45d[_0xa8e9('0x9')],_0xa8e9('0xe'))}}});}else{return[];}})['then'](function(_0x21a843){if(_0x21a843&&_0x21a843[_0xa8e9('0xf')]){_0x5d9066=_['map'](_0x21a843||[],'id');logger[_0xa8e9('0x10')](_0xa8e9('0x11'),_0x5d9066[_0xa8e9('0x12')]());return db[_0xa8e9('0x13')]['update']({'closeReason':_0xa8e9('0x14'),'disposition':_0xa8e9('0x15'),'closed':!![],'closedAt':moment()[_0xa8e9('0x16')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x5d9066}});}})['then'](function(){if(_0x5d9066&&_0x5d9066[_0xa8e9('0xf')]){logger[_0xa8e9('0x10')](_0xa8e9('0x17'),_0x5d9066[_0xa8e9('0x12')]());for(var _0x672143=0x0;_0x672143<_0x5d9066[_0xa8e9('0xf')];_0x672143++){io[_0xa8e9('0x18')]('chatInteraction:update',{'id':_0x5d9066[_0x672143],'closed':!![]});}}})[_0xa8e9('0x19')](function(_0x1ccd5f){logger[_0xa8e9('0x1a')](_0xa8e9('0x1b'),_0x1ccd5f?util['inspect'](_0x1ccd5f,{'showHidden':![],'depth':null}):'');});}exports[_0xa8e9('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 18c86a6..3b24dea 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 _0x07eb=['MailServerOut','keys','map','toString','keyBy','intersection','length','exists','stop','deleteJob','toRun','index','my\x20id','run\x20job','cron','isBetween','startAt','endAt','add','start','add\x20cron','update','update\x20cron','stop\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','port','secure','authentication','auth','user','pass','format','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','error\x20mail','email\x20sent','catch','error','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','then','no\x20report\x20id'];(function(_0x4cd9da,_0x24b8a9){var _0x149463=function(_0x1baebe){while(--_0x1baebe){_0x4cd9da['push'](_0x4cd9da['shift']());}};_0x149463(++_0x24b8a9);}(_0x07eb,0x17d));var _0xb07e=function(_0x43e4b3,_0x1444de){_0x43e4b3=_0x43e4b3-0x0;var _0x10c655=_0x07eb[_0x43e4b3];return _0x10c655;};'use strict';var fs=require('fs');var util=require(_0xb07e('0x0'));var path=require(_0xb07e('0x1'));var _=require(_0xb07e('0x2'));var moment=require(_0xb07e('0x3'));var CronJobManager=require(_0xb07e('0x4'));var jayson=require(_0xb07e('0x5'));var BPromise=require(_0xb07e('0x6'));var logger=require(_0xb07e('0x7'))(_0xb07e('0x8'));var db=require(_0xb07e('0x9'))['db'];var analyticCustomReportController=require(_0xb07e('0xa'));var analyticDefaultReportController=require(_0xb07e('0xb'));var client=jayson[_0xb07e('0xc')][_0xb07e('0xd')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xa012c5,_0x568bc0){return function(){logger[_0xb07e('0xe')](_0xb07e('0xf'),_0xa012c5[_0xb07e('0x10')]);var _0x1f2dd7=!![];var _0x330d1d={'tls':{'rejectUnauthorized':![]}};if(_0xa012c5[_0xb07e('0x11')][_0xb07e('0x12')][_0xb07e('0x13')]){_0x330d1d[_0xb07e('0x13')]=_0xa012c5['MailAccount'][_0xb07e('0x12')]['service'];}else{_0x330d1d['host']=_0xa012c5['MailAccount'][_0xb07e('0x12')]['host'];_0x330d1d[_0xb07e('0x14')]=_0xa012c5[_0xb07e('0x11')]['Smtp'][_0xb07e('0x14')];_0x330d1d[_0xb07e('0x15')]=_0xa012c5[_0xb07e('0x11')][_0xb07e('0x12')]['secure'];}if(_0xa012c5[_0xb07e('0x11')]['Smtp'][_0xb07e('0x16')]){_0x330d1d[_0xb07e('0x17')]={'user':_0xa012c5[_0xb07e('0x11')]['Smtp'][_0xb07e('0x18')],'pass':_0xa012c5[_0xb07e('0x11')][_0xb07e('0x12')][_0xb07e('0x19')]};}var _0x2f4cd7={'account':_0x330d1d,'message':{'from':util[_0xb07e('0x1a')]('\x22%s\x22\x20<%s>',_0xa012c5['MailAccount'][_0xb07e('0x1b')],_0xa012c5[_0xb07e('0x11')][_0xb07e('0x10')]||_0xa012c5[_0xb07e('0x11')][_0xb07e('0x12')][_0xb07e('0x18')]),'to':_0xa012c5[_0xb07e('0x10')],'cc':_0xa012c5['cc'],'bcc':_0xa012c5[_0xb07e('0x1c')],'subject':util[_0xb07e('0x1a')](_0xb07e('0x1d'),_0x568bc0[_0xb07e('0x1b')],_0xa012c5[_0xb07e('0x1e')],_0xa012c5[_0xb07e('0x1f')])}};var _0x51c4d6=path['join'](__dirname,'../../files/reports');var _0x103b1d=_0x568bc0[_0xb07e('0x20')];var _0x471771=util[_0xb07e('0x1a')](_0xb07e('0x21'),path[_0xb07e('0x22')](_0x568bc0[_0xb07e('0x20')],path[_0xb07e('0x23')](_0x568bc0[_0xb07e('0x20')])),_0xb07e('0x24'));var _0x1569f9=path['join'](_0x51c4d6,_0x103b1d);var _0x14c0bc=path['join'](_0x51c4d6,_0x471771);if(fs[_0xb07e('0x25')](_0x1569f9)){_0x568bc0[_0xb07e('0x26')]=_0xb07e('0x27');_0x2f4cd7['message'][_0xb07e('0x28')]=[{'filename':_0x103b1d,'path':_0x1569f9}];_0x2f4cd7[_0xb07e('0x29')][_0xb07e('0x2a')]=util['format'](_0xb07e('0x2b'),JSON[_0xb07e('0x2c')](_0x568bc0,null,0x2));}else if(fs[_0xb07e('0x25')](_0x14c0bc)){_0x568bc0['status']=_0xb07e('0x27');_0x2f4cd7[_0xb07e('0x29')][_0xb07e('0x28')]=[{'filename':_0x471771,'path':_0x14c0bc}];}else{_0x2f4cd7[_0xb07e('0x29')][_0xb07e('0x2a')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0xa012c5[_0xb07e('0x2d')]){_0x1f2dd7=![];logger[_0xb07e('0xe')](_0xb07e('0x2e'));}}if(_0x1f2dd7){return client['request']('SendMail',_0x2f4cd7)['then'](function(_0x1c197c){if(_0x1c197c['error']){return logger['error'](_0xb07e('0x2f'),JSON[_0xb07e('0x2c')](_0x1c197c));}return logger[_0xb07e('0xe')](_0xb07e('0x30'));})[_0xb07e('0x31')](function(_0x436c57){return logger[_0xb07e('0x32')](_0xb07e('0x2f'),JSON[_0xb07e('0x2c')](_0x436c57));});}};}function handleError(){return function(_0x107b51){return logger['error'](JSON[_0xb07e('0x2c')](_0x107b51));};}function handleResult(_0x5d7829){return function(_0x4fe2a1){logger[_0xb07e('0xe')]('data',JSON[_0xb07e('0x2c')](_0x4fe2a1));if(_0x5d7829['MailAccount']&&_0x5d7829[_0xb07e('0x11')][_0xb07e('0x12')]&&!_[_0xb07e('0x33')](_0x5d7829[_0xb07e('0x10')])){setTimeout(handleSendEmail(_0x5d7829,_0x4fe2a1),0x3c*0x3e8);}};}function handleJob(_0x363f85){return function(){try{if(_[_0xb07e('0x33')](_0x363f85[_0xb07e('0x1e')])){return logger[_0xb07e('0xe')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xb07e('0x33')](_0x363f85[_0xb07e('0x1f')])){return logger[_0xb07e('0xe')](_0xb07e('0x34'));}var _0x16a898={'startDate':moment()[_0xb07e('0x35')](_0x363f85['subtractNumber'],_0x363f85[_0xb07e('0x1f')])[_0xb07e('0x1a')](_0xb07e('0x36')),'endDate':moment()[_0xb07e('0x1a')](_0xb07e('0x36')),'type':_0xb07e('0x37'),'output':_0x363f85[_0xb07e('0x38')],'name':_0x363f85[_0xb07e('0x1b')]};if(!_[_0xb07e('0x33')](_0x363f85[_0xb07e('0x39')])){logger[_0xb07e('0xe')](_0xb07e('0x3a'),_0x363f85[_0xb07e('0x39')]);return analyticDefaultReportController[_0xb07e('0x3b')]({'id':_0x363f85['DefaultReportId']},_0x16a898)['then'](handleResult(_0x363f85))[_0xb07e('0x31')](handleError());}if(!_[_0xb07e('0x33')](_0x363f85[_0xb07e('0x3c')])){logger['info'](_0xb07e('0x3d'),_0x363f85['CustomReportId']);return analyticCustomReportController[_0xb07e('0x3b')]({'id':_0x363f85[_0xb07e('0x3c')]},_0x16a898)[_0xb07e('0x3e')](handleResult(_0x363f85))[_0xb07e('0x31')](handleError());}}catch(_0x575449){logger['error'](JSON[_0xb07e('0x2c')](_0x575449));}return logger['info'](_0xb07e('0x3f'));};}function getJobs(_0x22b913){var _0x247d01={};if(_0x22b913){_0x247d01['id']=_0x22b913;}return db['Schedule']['findAll']({'where':_0x247d01,'include':[{'model':db[_0xb07e('0x11')],'attributes':['id',_0xb07e('0x1b'),_0xb07e('0x10')],'include':[{'model':db[_0xb07e('0x40')],'as':_0xb07e('0x12')}]}]})[_0xb07e('0x3e')](function(_0x8b4945){var _0x51cbfc=_[_0xb07e('0x41')](manager['jobs']);var _0x511ce1=_[_0xb07e('0x42')](_0x8b4945,function(_0x2318b6){return _0x2318b6['id'][_0xb07e('0x43')]();});var _0x2b4885=_[_0xb07e('0x44')](_0x8b4945,function(_0x3b4b15){return _0x3b4b15['id']['toString']();});var _0x23d802=_0x22b913?_0x511ce1:_['difference'](_0x511ce1,_0x51cbfc);var _0xb8ad8b=_[_0xb07e('0x45')](_0x511ce1,_0x51cbfc);var _0x9b2d15=_['difference'](_0x51cbfc,_0x511ce1);var _0x1029ba;var _0x67ebea;for(_0x1029ba=0x0;_0x1029ba<_0x9b2d15[_0xb07e('0x46')]&&!_0x22b913;_0x1029ba+=0x1){_0x67ebea=_0x9b2d15[_0x1029ba]['toString']();if(manager[_0xb07e('0x47')](_0x67ebea)){manager[_0xb07e('0x48')](_0x67ebea);manager[_0xb07e('0x49')](_0x67ebea);logger['info']('delete\x20cron',_0x67ebea);}}logger[_0xb07e('0xe')](_0xb07e('0x4a'),JSON['stringify'](_0x23d802));for(_0x1029ba=0x0;_0x1029ba<_0x23d802[_0xb07e('0x46')];_0x1029ba+=0x1){_0x67ebea=_0x23d802[_0x1029ba][_0xb07e('0x43')]();logger['info'](_0xb07e('0x4b'),_0x67ebea);if(_0x22b913){logger[_0xb07e('0xe')](_0xb07e('0x4c'),_0x22b913);logger[_0xb07e('0xe')](JSON['stringify'](_0x2b4885[_0x67ebea]));BPromise['resolve']()[_0xb07e('0x3e')](handleJob(_0x2b4885[_0x67ebea]));logger['info'](_0xb07e('0x4d'),_0x2b4885[_0x67ebea][_0xb07e('0x1b')],_0x2b4885[_0x67ebea][_0xb07e('0x4e')]);}else if(_0x2b4885[_0x67ebea]['cron']&&_0x2b4885[_0x67ebea]['active']&&moment()[_0xb07e('0x4f')](_0x2b4885[_0x67ebea][_0xb07e('0x50')],_0x2b4885[_0x67ebea][_0xb07e('0x51')])){manager[_0xb07e('0x52')](_0x67ebea,_0x2b4885[_0x67ebea]['cron'],handleJob(_0x2b4885[_0x67ebea]));manager[_0xb07e('0x53')](_0x67ebea);logger[_0xb07e('0xe')](_0xb07e('0x54'),_0x2b4885[_0x67ebea][_0xb07e('0x1b')],_0x2b4885[_0x67ebea][_0xb07e('0x4e')]);}else if(manager[_0xb07e('0x47')](_0x67ebea)){manager[_0xb07e('0x48')](_0x67ebea);manager[_0xb07e('0x49')](_0x67ebea);logger[_0xb07e('0xe')]('stop\x20cron',_0x2b4885[_0x67ebea][_0xb07e('0x1b')],_0x2b4885[_0x67ebea]['cron']);}}for(_0x1029ba=0x0,_0x67ebea;_0x1029ba<_0xb8ad8b[_0xb07e('0x46')]&&!_0x22b913;_0x1029ba+=0x1){_0x67ebea=_0xb8ad8b[_0x1029ba][_0xb07e('0x43')]();if(manager[_0xb07e('0x47')](_0x67ebea)){if(_0x2b4885[_0x67ebea][_0xb07e('0x4e')]&&_0x2b4885[_0x67ebea]['active']&&moment()[_0xb07e('0x4f')](_0x2b4885[_0x67ebea]['startAt'],_0x2b4885[_0x67ebea][_0xb07e('0x51')])){manager[_0xb07e('0x55')](_0x67ebea,_0x2b4885[_0x67ebea][_0xb07e('0x4e')],handleJob(_0x2b4885[_0x67ebea]));logger[_0xb07e('0xe')](_0xb07e('0x56'),_0x2b4885[_0x67ebea][_0xb07e('0x1b')],_0x2b4885[_0x67ebea][_0xb07e('0x4e')]);}else{manager[_0xb07e('0x48')](_0x67ebea);manager[_0xb07e('0x49')](_0x67ebea);logger[_0xb07e('0xe')](_0xb07e('0x57'),_0x2b4885[_0x67ebea][_0xb07e('0x1b')],_0x2b4885[_0x67ebea]['cron']);}}}})['catch'](function(_0x3180c5){logger[_0xb07e('0x32')](JSON[_0xb07e('0x2c')](_0x3180c5));});}exports[_0xb07e('0x58')]=function(_0xe9c3f8){return getJobs(_0xe9c3f8);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x53a2=['toRun','index','resolve','cron','active','startAt','endAt','add','add\x20cron','exists','stop\x20cron','isBetween','update','update\x20cron','run','start','path','moment','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','email','MailAccount','service','Smtp','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','savename','basename','zip','join','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','catch','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','Schedule','keys','jobs','map','toString','keyBy','intersection','length','stop','deleteJob'];(function(_0x1e6ca5,_0xfb9d62){var _0xf1e27=function(_0x5518a4){while(--_0x5518a4){_0x1e6ca5['push'](_0x1e6ca5['shift']());}};_0xf1e27(++_0xfb9d62);}(_0x53a2,0x16c));var _0x253a=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x53a2[_0x5bd426];return _0x23a7eb;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x253a('0x0'));var _=require('lodash');var moment=require(_0x253a('0x1'));var CronJobManager=require(_0x253a('0x2'));var jayson=require(_0x253a('0x3'));var BPromise=require('bluebird');var logger=require(_0x253a('0x4'))(_0x253a('0x5'));var db=require(_0x253a('0x6'))['db'];var analyticCustomReportController=require(_0x253a('0x7'));var analyticDefaultReportController=require(_0x253a('0x8'));var client=jayson[_0x253a('0x9')][_0x253a('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x131f21,_0x20e19c){return function(){logger[_0x253a('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x131f21[_0x253a('0xc')]);var _0x22368d=!![];var _0x3062c8={'tls':{'rejectUnauthorized':![]}};if(_0x131f21[_0x253a('0xd')]['Smtp'][_0x253a('0xe')]){_0x3062c8[_0x253a('0xe')]=_0x131f21['MailAccount'][_0x253a('0xf')][_0x253a('0xe')];}else{_0x3062c8['host']=_0x131f21['MailAccount'][_0x253a('0xf')][_0x253a('0x10')];_0x3062c8[_0x253a('0x11')]=_0x131f21[_0x253a('0xd')]['Smtp'][_0x253a('0x11')];_0x3062c8['secure']=_0x131f21[_0x253a('0xd')]['Smtp'][_0x253a('0x12')];}if(_0x131f21[_0x253a('0xd')]['Smtp'][_0x253a('0x13')]){_0x3062c8[_0x253a('0x14')]={'user':_0x131f21[_0x253a('0xd')][_0x253a('0xf')]['user'],'pass':_0x131f21['MailAccount']['Smtp'][_0x253a('0x15')]};}var _0x1abc92={'account':_0x3062c8,'message':{'from':util[_0x253a('0x16')](_0x253a('0x17'),_0x131f21[_0x253a('0xd')][_0x253a('0x18')],_0x131f21['MailAccount'][_0x253a('0xc')]||_0x131f21[_0x253a('0xd')][_0x253a('0xf')][_0x253a('0x19')]),'to':_0x131f21[_0x253a('0xc')],'cc':_0x131f21['cc'],'bcc':_0x131f21[_0x253a('0x1a')],'subject':util['format'](_0x253a('0x1b'),_0x20e19c[_0x253a('0x18')],_0x131f21[_0x253a('0x1c')],_0x131f21[_0x253a('0x1d')])}};var _0xdccdaa=path['join'](__dirname,'../../files/reports');var _0x1ba830=_0x20e19c[_0x253a('0x1e')];var _0x3f557e=util['format']('%s.%s',path[_0x253a('0x1f')](_0x20e19c[_0x253a('0x1e')],path['extname'](_0x20e19c['savename'])),_0x253a('0x20'));var _0x5bc7a0=path[_0x253a('0x21')](_0xdccdaa,_0x1ba830);var _0x5707ef=path['join'](_0xdccdaa,_0x3f557e);if(fs[_0x253a('0x22')](_0x5bc7a0)){_0x20e19c[_0x253a('0x23')]=_0x253a('0x24');_0x1abc92[_0x253a('0x25')][_0x253a('0x26')]=[{'filename':_0x1ba830,'path':_0x5bc7a0}];_0x1abc92[_0x253a('0x25')]['text']=util[_0x253a('0x16')](_0x253a('0x27'),JSON[_0x253a('0x28')](_0x20e19c,null,0x2));}else if(fs['existsSync'](_0x5707ef)){_0x20e19c['status']=_0x253a('0x24');_0x1abc92[_0x253a('0x25')]['attachments']=[{'filename':_0x3f557e,'path':_0x5707ef}];}else{_0x1abc92[_0x253a('0x25')][_0x253a('0x29')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x131f21[_0x253a('0x2a')]){_0x22368d=![];logger['info'](_0x253a('0x2b'));}}if(_0x22368d){return client[_0x253a('0x2c')](_0x253a('0x2d'),_0x1abc92)[_0x253a('0x2e')](function(_0x2a56a2){if(_0x2a56a2[_0x253a('0x2f')]){return logger[_0x253a('0x2f')](_0x253a('0x30'),JSON[_0x253a('0x28')](_0x2a56a2));}return logger[_0x253a('0xb')]('email\x20sent');})[_0x253a('0x31')](function(_0x670210){return logger['error'](_0x253a('0x30'),JSON[_0x253a('0x28')](_0x670210));});}};}function handleError(){return function(_0x1a680d){return logger[_0x253a('0x2f')](JSON[_0x253a('0x28')](_0x1a680d));};}function handleResult(_0x27856f){return function(_0x1564af){logger[_0x253a('0xb')](_0x253a('0x32'),JSON['stringify'](_0x1564af));if(_0x27856f['MailAccount']&&_0x27856f[_0x253a('0xd')][_0x253a('0xf')]&&!_['isNil'](_0x27856f[_0x253a('0xc')])){setTimeout(handleSendEmail(_0x27856f,_0x1564af),0x3c*0x3e8);}};}function handleJob(_0x39c426){return function(){try{if(_[_0x253a('0x33')](_0x39c426[_0x253a('0x1c')])){return logger[_0x253a('0xb')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x253a('0x33')](_0x39c426[_0x253a('0x1d')])){return logger['info'](_0x253a('0x34'));}var _0x55a2ed={'startDate':moment()[_0x253a('0x35')](_0x39c426[_0x253a('0x1c')],_0x39c426[_0x253a('0x1d')])[_0x253a('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x253a('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x253a('0x36'),'output':_0x39c426[_0x253a('0x37')],'name':_0x39c426[_0x253a('0x18')]};if(!_['isNil'](_0x39c426[_0x253a('0x38')])){logger[_0x253a('0xb')](_0x253a('0x39'),_0x39c426[_0x253a('0x38')]);return analyticDefaultReportController[_0x253a('0x3a')]({'id':_0x39c426[_0x253a('0x38')]},_0x55a2ed)[_0x253a('0x2e')](handleResult(_0x39c426))['catch'](handleError());}if(!_[_0x253a('0x33')](_0x39c426[_0x253a('0x3b')])){logger[_0x253a('0xb')]('exec\x20custom\x20report\x20id:%s',_0x39c426[_0x253a('0x3b')]);return analyticCustomReportController[_0x253a('0x3a')]({'id':_0x39c426[_0x253a('0x3b')]},_0x55a2ed)[_0x253a('0x2e')](handleResult(_0x39c426))[_0x253a('0x31')](handleError());}}catch(_0x260855){logger['error'](JSON['stringify'](_0x260855));}return logger[_0x253a('0xb')](_0x253a('0x3c'));};}function getJobs(_0x5776e5){var _0x12f0b9={};if(_0x5776e5){_0x12f0b9['id']=_0x5776e5;}return db[_0x253a('0x3d')]['findAll']({'where':_0x12f0b9,'include':[{'model':db[_0x253a('0xd')],'attributes':['id',_0x253a('0x18'),_0x253a('0xc')],'include':[{'model':db['MailServerOut'],'as':_0x253a('0xf')}]}]})[_0x253a('0x2e')](function(_0x25b919){var _0x204c7d=_[_0x253a('0x3e')](manager[_0x253a('0x3f')]);var _0x168afb=_[_0x253a('0x40')](_0x25b919,function(_0x309311){return _0x309311['id'][_0x253a('0x41')]();});var _0x358756=_[_0x253a('0x42')](_0x25b919,function(_0x36fc08){return _0x36fc08['id'][_0x253a('0x41')]();});var _0x4a5f1b=_0x5776e5?_0x168afb:_['difference'](_0x168afb,_0x204c7d);var _0x3e29cd=_[_0x253a('0x43')](_0x168afb,_0x204c7d);var _0x178c2d=_['difference'](_0x204c7d,_0x168afb);var _0x30d0c0;var _0xf7600c;for(_0x30d0c0=0x0;_0x30d0c0<_0x178c2d[_0x253a('0x44')]&&!_0x5776e5;_0x30d0c0+=0x1){_0xf7600c=_0x178c2d[_0x30d0c0][_0x253a('0x41')]();if(manager['exists'](_0xf7600c)){manager[_0x253a('0x45')](_0xf7600c);manager[_0x253a('0x46')](_0xf7600c);logger['info']('delete\x20cron',_0xf7600c);}}logger[_0x253a('0xb')](_0x253a('0x47'),JSON[_0x253a('0x28')](_0x4a5f1b));for(_0x30d0c0=0x0;_0x30d0c0<_0x4a5f1b[_0x253a('0x44')];_0x30d0c0+=0x1){_0xf7600c=_0x4a5f1b[_0x30d0c0][_0x253a('0x41')]();logger[_0x253a('0xb')](_0x253a('0x48'),_0xf7600c);if(_0x5776e5){logger['info']('my\x20id',_0x5776e5);logger['info'](JSON[_0x253a('0x28')](_0x358756[_0xf7600c]));BPromise[_0x253a('0x49')]()[_0x253a('0x2e')](handleJob(_0x358756[_0xf7600c]));logger[_0x253a('0xb')]('run\x20job',_0x358756[_0xf7600c][_0x253a('0x18')],_0x358756[_0xf7600c][_0x253a('0x4a')]);}else if(_0x358756[_0xf7600c][_0x253a('0x4a')]&&_0x358756[_0xf7600c][_0x253a('0x4b')]&&moment()['isBetween'](_0x358756[_0xf7600c][_0x253a('0x4c')],_0x358756[_0xf7600c][_0x253a('0x4d')])){manager[_0x253a('0x4e')](_0xf7600c,_0x358756[_0xf7600c]['cron'],handleJob(_0x358756[_0xf7600c]));manager['start'](_0xf7600c);logger[_0x253a('0xb')](_0x253a('0x4f'),_0x358756[_0xf7600c][_0x253a('0x18')],_0x358756[_0xf7600c]['cron']);}else if(manager[_0x253a('0x50')](_0xf7600c)){manager[_0x253a('0x45')](_0xf7600c);manager['deleteJob'](_0xf7600c);logger['info'](_0x253a('0x51'),_0x358756[_0xf7600c][_0x253a('0x18')],_0x358756[_0xf7600c][_0x253a('0x4a')]);}}for(_0x30d0c0=0x0,_0xf7600c;_0x30d0c0<_0x3e29cd[_0x253a('0x44')]&&!_0x5776e5;_0x30d0c0+=0x1){_0xf7600c=_0x3e29cd[_0x30d0c0][_0x253a('0x41')]();if(manager['exists'](_0xf7600c)){if(_0x358756[_0xf7600c][_0x253a('0x4a')]&&_0x358756[_0xf7600c][_0x253a('0x4b')]&&moment()[_0x253a('0x52')](_0x358756[_0xf7600c][_0x253a('0x4c')],_0x358756[_0xf7600c][_0x253a('0x4d')])){manager[_0x253a('0x53')](_0xf7600c,_0x358756[_0xf7600c][_0x253a('0x4a')],handleJob(_0x358756[_0xf7600c]));logger['info'](_0x253a('0x54'),_0x358756[_0xf7600c][_0x253a('0x18')],_0x358756[_0xf7600c]['cron']);}else{manager[_0x253a('0x45')](_0xf7600c);manager[_0x253a('0x46')](_0xf7600c);logger[_0x253a('0xb')](_0x253a('0x51'),_0x358756[_0xf7600c][_0x253a('0x18')],_0x358756[_0xf7600c][_0x253a('0x4a')]);}}}})[_0x253a('0x31')](function(_0x278f25){logger[_0x253a('0x2f')](JSON[_0x253a('0x28')](_0x278f25));});}exports[_0x253a('0x55')]=function(_0x49b92a){return getJobs(_0x49b92a);};exports[_0x253a('0x56')]=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 e70c42f..2207cce 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 _0x61a5=['substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','transcripts','results','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','fileText','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','length','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','all','inspect','start','lodash','request-promise','util','../../mysqldb','transcribe','getTranscriptionJob'];(function(_0x22d1ef,_0x4a5152){var _0x47c5a3=function(_0x9a2c48){while(--_0x9a2c48){_0x22d1ef['push'](_0x22d1ef['shift']());}};_0x47c5a3(++_0x4a5152);}(_0x61a5,0x19e));var _0x561a=function(_0x582f72,_0x886d8){_0x582f72=_0x582f72-0x0;var _0x4cd5fe=_0x61a5[_0x582f72];return _0x4cd5fe;};var _=require(_0x561a('0x0'));var AWS=require('aws-sdk');var rp=require(_0x561a('0x1'));var util=require(_0x561a('0x2'));var BPromise=require('bluebird');var db=require(_0x561a('0x3'))['db'];var logger=require('../../config/logger')(_0x561a('0x4'));function getTranscriptionJob(_0x526edf,_0x1d8bd8,_0x1bce83,_0x2261b3){return new Promise(function(_0x28ff42,_0x1e2ce1){var _0x2a763a=new AWS['TranscribeService']({'accessKeyId':_0x1d8bd8,'secretAccessKey':_0x526edf,'region':_0x1bce83});_0x2a763a[_0x561a('0x5')]({'TranscriptionJobName':_0x2261b3},function(_0x27e026,_0xe056b2){if(_0x27e026){return _0x1e2ce1(_0x27e026);}else{return _0x28ff42(_0xe056b2);}});});}function sentiment(_0x5cd4f6,_0x95e2a0,_0x2a0fdb,_0x5a4e9b,_0x44b705){return new Promise(function(_0x421369,_0x139208){var _0x41a34a=new AWS['Comprehend']({'accessKeyId':_0x95e2a0,'secretAccessKey':_0x5cd4f6,'region':_0x2a0fdb});_0x41a34a['detectSentiment']({'Text':_0x5a4e9b,'LanguageCode':_0x44b705[_0x561a('0x6')](0x0,0x2)},function(_0x448f83,_0x2b4705){if(_0x448f83){return _0x139208(_0x448f83);}else{return _0x421369(_0x2b4705);}});});}function checkTranscribeJob(_0x2ea318,_0x3763de,_0x256635){var _0x6ab4df;return new BPromise(function(_0x1dacd2,_0x4ef53f){logger[_0x561a('0x7')](util[_0x561a('0x8')](_0x561a('0x9'),_0x2ea318['id'],_0x2ea318[_0x561a('0xa')]));return getTranscriptionJob(_0x256635['data1'],_0x256635[_0x561a('0xb')],_0x3763de['transcribeRegion'],_0x2ea318[_0x561a('0xa')])[_0x561a('0xc')](function(_0x85faed){logger[_0x561a('0x7')](util[_0x561a('0x8')](_0x561a('0xd'),_0x2ea318['id'],_0x2ea318['transcribeName'],_0x85faed['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x2ea318['fileText']){switch(_0x85faed[_0x561a('0xe')][_0x561a('0xf')]){case _0x561a('0x10'):var _0x5562a1={'transcribeStatus':_0x85faed['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x85faed[_0x561a('0xe')][_0x561a('0x11')][_0x561a('0x12')]};logger[_0x561a('0x7')](util[_0x561a('0x8')]('[RECORDING:%d]\x20Get\x20transcript',_0x2ea318['id']));return rp({'uri':_0x85faed[_0x561a('0xe')][_0x561a('0x11')]['TranscriptFileUri'],'json':!![]})[_0x561a('0xc')](function(_0xbf17c6){logger['info'](util['format'](_0x561a('0x13'),_0x2ea318['id']));if(_0xbf17c6&&_0xbf17c6['results']&&_0xbf17c6['results']['transcripts']&&_0xbf17c6['results'][_0x561a('0x14')]['length']){_0x5562a1['fileText']='';for(var _0x437bab=0x0;_0x437bab<_0xbf17c6[_0x561a('0x15')]['transcripts']['length'];_0x437bab++){_0x5562a1['fileText']+=_0xbf17c6[_0x561a('0x15')][_0x561a('0x14')][_0x437bab]['transcript']+'';}}return _0x2ea318[_0x561a('0x16')](_0x5562a1);})['then'](function(){logger[_0x561a('0x7')](util[_0x561a('0x8')](_0x561a('0x17'),_0x2ea318['id']));if(!_0x2ea318[_0x561a('0x18')]){throw new db[(_0x561a('0x19'))][(_0x561a('0x1a'))](_0x561a('0x1b'));}if(!_0x3763de[_0x561a('0x1c')]||!_0x3763de[_0x561a('0x1d')]||!_0x3763de[_0x561a('0x1e')]||!_0x3763de[_0x561a('0x1f')]||!_0x3763de[_0x561a('0x20')]){throw new db['Sequelize'][(_0x561a('0x1a'))](_0x561a('0x21'));}if(!_0x5562a1[_0x561a('0x22')]){throw new Error(_0x561a('0x23'));}if(_0x3763de['sentimentAccountId']===_0x256635['id']){return _0x256635;}else{return db[_0x561a('0x24')][_0x561a('0x25')]({'where':{'id':_settings[_0x561a('0x1d')]}});}})[_0x561a('0xc')](function(_0x30981f){if(!_0x30981f){throw new db[(_0x561a('0x19'))]['ValidationError'](_0x561a('0x26'));}if(!_0x30981f[_0x561a('0x27')]||!_0x30981f[_0x561a('0xb')]){throw new db[(_0x561a('0x19'))][(_0x561a('0x1a'))](_0x561a('0x28'));}_0x6ab4df=_0x30981f;logger[_0x561a('0x7')](util[_0x561a('0x8')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x2ea318['id']));return sentiment(_0x6ab4df[_0x561a('0x27')],_0x6ab4df[_0x561a('0xb')],_0x3763de[_0x561a('0x1e')],_0x5562a1[_0x561a('0x22')],_0x3763de['language']);})['then'](function(_0x35e8cc){logger[_0x561a('0x7')](util['format'](_0x561a('0x29'),_0x2ea318['id']));return _0x2ea318[_0x561a('0x16')]({'sentiment':_0x35e8cc[_0x561a('0x2a')],'sPositive':_0x35e8cc[_0x561a('0x2b')][_0x561a('0x2c')],'sNegative':_0x35e8cc[_0x561a('0x2b')][_0x561a('0x2d')],'sMixed':_0x35e8cc[_0x561a('0x2b')][_0x561a('0x2e')],'sNeutral':_0x35e8cc['SentimentScore']['Neutral']});})['then'](function(){logger[_0x561a('0x7')](util[_0x561a('0x8')](_0x561a('0x17'),_0x2ea318['id']));_0x1dacd2();});case'FAILED':return _0x2ea318[_0x561a('0x16')]({'transcribeStatus':_0x561a('0x2f'),'failureReason':_0x85faed[_0x561a('0xe')][_0x561a('0x30')]})[_0x561a('0xc')](function(){logger[_0x561a('0x7')](util['format'](_0x561a('0x17'),_0x2ea318['id']));_0x1dacd2();});default:logger[_0x561a('0x7')](util[_0x561a('0x8')](_0x561a('0x31'),_0x2ea318['id']));break;}}else{return BPromise[_0x561a('0x32')]()[_0x561a('0xc')](function(){if(!_0x2ea318[_0x561a('0x18')]){throw new db[(_0x561a('0x19'))]['ValidationError'](_0x561a('0x1b'));}if(!_0x3763de['sentiment']||!_0x3763de[_0x561a('0x1d')]||!_0x3763de[_0x561a('0x1e')]||!_0x3763de[_0x561a('0x1f')]||!_0x3763de[_0x561a('0x20')]){throw new db[(_0x561a('0x19'))]['ValidationError'](_0x561a('0x21'));}if(!_0x2ea318[_0x561a('0x22')]){throw new Error('Transcript\x20not\x20available');}if(_0x3763de[_0x561a('0x1d')]===_0x256635['id']){return _0x256635;}else{return db['CloudProvider'][_0x561a('0x25')]({'where':{'id':_settings[_0x561a('0x1d')]}});}})[_0x561a('0xc')](function(_0x2720b0){if(!_0x2720b0){throw new db[(_0x561a('0x19'))][(_0x561a('0x1a'))](_0x561a('0x26'));}if(!_0x2720b0[_0x561a('0x27')]||!_0x2720b0['data2']){throw new db[(_0x561a('0x19'))][(_0x561a('0x1a'))](_0x561a('0x28'));}_0x6ab4df=_0x2720b0;logger[_0x561a('0x7')](util['format'](_0x561a('0x33'),_0x2ea318['id']));return sentiment(_0x6ab4df[_0x561a('0x27')],_0x6ab4df[_0x561a('0xb')],_0x3763de[_0x561a('0x1e')],_0x2ea318['fileText'],_0x3763de[_0x561a('0x1f')]);})['then'](function(_0x2665d5){logger['info'](util[_0x561a('0x8')](_0x561a('0x29'),_0x2ea318['id']));return _0x2ea318[_0x561a('0x16')]({'sentiment':_0x2665d5['Sentiment'],'sPositive':_0x2665d5['SentimentScore'][_0x561a('0x2c')],'sNegative':_0x2665d5[_0x561a('0x2b')][_0x561a('0x2d')],'sMixed':_0x2665d5[_0x561a('0x2b')][_0x561a('0x2e')],'sNeutral':_0x2665d5[_0x561a('0x2b')]['Neutral'],'transcribeStatus':_0x561a('0x10')});})['then'](function(){logger[_0x561a('0x7')](util[_0x561a('0x8')](_0x561a('0x17'),_0x2ea318['id']));_0x1dacd2();});}})[_0x561a('0x34')](function(_0x3717ef){if(_0x3717ef){if(!_0x3717ef['name']||_0x3717ef[_0x561a('0x35')]!==_0x561a('0x36')){logger[_0x561a('0x37')](util[_0x561a('0x8')](_0x561a('0x38'),_0x2ea318['id']),util['inspect'](_0x3717ef,{'showHidden':![],'depth':null}));}}_0x1dacd2();});});}function checkTranscribe(){var _0x186909;var _0x40a4b2;var _0x513389;return db[_0x561a('0x39')][_0x561a('0x3a')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x561a('0xc')](function(_0x5f5736){if(!_0x5f5736||!_0x5f5736[_0x561a('0x3b')]){throw new db[(_0x561a('0x19'))]['ValidationError'](_0x561a('0x3c'));}_0x186909=_0x5f5736;return db[_0x561a('0x3d')][_0x561a('0x25')]({'where':{'id':0x1}});})['then'](function(_0x17da43){if(!_0x17da43){throw new db['Sequelize'][(_0x561a('0x1a'))](_0x561a('0x3e'));}_0x40a4b2=_0x17da43;if(!_0x40a4b2[_0x561a('0x4')]||!_0x40a4b2['transcribeAccountId']||!_0x40a4b2[_0x561a('0x3f')]||!_0x40a4b2[_0x561a('0x1f')]||!_0x40a4b2[_0x561a('0x20')]){throw new db[(_0x561a('0x19'))][(_0x561a('0x1a'))](_0x561a('0x40'));}return db[_0x561a('0x24')][_0x561a('0x25')]({'where':{'id':_0x40a4b2['transcribeAccountId']}});})[_0x561a('0xc')](function(_0x157ff8){if(!_0x157ff8){throw new db['Sequelize'][(_0x561a('0x1a'))](_0x561a('0x26'));}if(!_0x157ff8['data1']||!_0x157ff8[_0x561a('0xb')]){throw new db[(_0x561a('0x19'))][(_0x561a('0x1a'))](_0x561a('0x28'));}_0x513389=_0x157ff8;var _0x24ea03=[];_0x186909[_0x561a('0x41')](function(_0x569ab7){_0x24ea03[_0x561a('0x42')](checkTranscribeJob(_0x569ab7,_0x40a4b2,_0x513389));});return BPromise[_0x561a('0x43')](_0x24ea03);})[_0x561a('0x34')](function(_0x33402e){if(_0x33402e){if(!_0x33402e['name']||_0x33402e[_0x561a('0x35')]!==_0x561a('0x36')){logger[_0x561a('0x37')](util[_0x561a('0x44')](_0x33402e,{'showHidden':![],'depth':null}));}}});}exports[_0x561a('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x4d5a=['[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment','Negative','Neutral','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','forEach','push','all','inspect','start','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x4d5a,0x15e));var _0xa4d5=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4d5a[_0x2dafbe];return _0x58a45a;};var _=require('lodash');var AWS=require(_0xa4d5('0x0'));var rp=require(_0xa4d5('0x1'));var util=require(_0xa4d5('0x2'));var BPromise=require('bluebird');var db=require(_0xa4d5('0x3'))['db'];var logger=require(_0xa4d5('0x4'))(_0xa4d5('0x5'));function getTranscriptionJob(_0x384fb0,_0x512629,_0x30a0d8,_0x56769c){return new Promise(function(_0x5e25a5,_0x32d194){var _0x1856aa=new AWS[(_0xa4d5('0x6'))]({'accessKeyId':_0x512629,'secretAccessKey':_0x384fb0,'region':_0x30a0d8});_0x1856aa[_0xa4d5('0x7')]({'TranscriptionJobName':_0x56769c},function(_0x408db0,_0x3bed6b){if(_0x408db0){return _0x32d194(_0x408db0);}else{return _0x5e25a5(_0x3bed6b);}});});}function sentiment(_0x155e4d,_0x5a5da1,_0x5586de,_0x22eb1f,_0x3600ea){return new Promise(function(_0x8e0171,_0x25bfeb){var _0x22dd6f=new AWS[(_0xa4d5('0x8'))]({'accessKeyId':_0x5a5da1,'secretAccessKey':_0x155e4d,'region':_0x5586de});_0x22dd6f[_0xa4d5('0x9')]({'Text':_0x22eb1f,'LanguageCode':_0x3600ea[_0xa4d5('0xa')](0x0,0x2)},function(_0x59b0b7,_0x54e1c7){if(_0x59b0b7){return _0x25bfeb(_0x59b0b7);}else{return _0x8e0171(_0x54e1c7);}});});}function checkTranscribeJob(_0x100182,_0x17a587,_0x1384d3){var _0x22df52;return new BPromise(function(_0x5db9ab,_0x5b3965){logger[_0xa4d5('0xb')](util[_0xa4d5('0xc')](_0xa4d5('0xd'),_0x100182['id'],_0x100182[_0xa4d5('0xe')]));return getTranscriptionJob(_0x1384d3[_0xa4d5('0xf')],_0x1384d3[_0xa4d5('0x10')],_0x17a587['transcribeRegion'],_0x100182['transcribeName'])[_0xa4d5('0x11')](function(_0x138112){logger['info'](util[_0xa4d5('0xc')](_0xa4d5('0x12'),_0x100182['id'],_0x100182[_0xa4d5('0xe')],_0x138112[_0xa4d5('0x13')][_0xa4d5('0x14')]));if(!_0x100182[_0xa4d5('0x15')]){switch(_0x138112['TranscriptionJob'][_0xa4d5('0x14')]){case'COMPLETED':var _0x59b63f={'transcribeStatus':_0x138112[_0xa4d5('0x13')]['TranscriptionJobStatus'],'fileUri':_0x138112[_0xa4d5('0x13')][_0xa4d5('0x16')][_0xa4d5('0x17')]};logger[_0xa4d5('0xb')](util[_0xa4d5('0xc')](_0xa4d5('0x18'),_0x100182['id']));return rp({'uri':_0x138112['TranscriptionJob'][_0xa4d5('0x16')][_0xa4d5('0x17')],'json':!![]})[_0xa4d5('0x11')](function(_0x519d3f){logger['info'](util['format'](_0xa4d5('0x19'),_0x100182['id']));if(_0x519d3f&&_0x519d3f[_0xa4d5('0x1a')]&&_0x519d3f['results']['transcripts']&&_0x519d3f[_0xa4d5('0x1a')][_0xa4d5('0x1b')][_0xa4d5('0x1c')]){_0x59b63f[_0xa4d5('0x15')]='';for(var _0x3edb76=0x0;_0x3edb76<_0x519d3f[_0xa4d5('0x1a')][_0xa4d5('0x1b')]['length'];_0x3edb76++){_0x59b63f['fileText']+=_0x519d3f['results'][_0xa4d5('0x1b')][_0x3edb76][_0xa4d5('0x1d')]+'';}}return _0x100182[_0xa4d5('0x1e')](_0x59b63f);})[_0xa4d5('0x11')](function(){logger[_0xa4d5('0xb')](util[_0xa4d5('0xc')](_0xa4d5('0x1f'),_0x100182['id']));if(!_0x100182[_0xa4d5('0x20')]){throw new db[(_0xa4d5('0x21'))][(_0xa4d5('0x22'))](_0xa4d5('0x23'));}if(!_0x17a587[_0xa4d5('0x24')]||!_0x17a587[_0xa4d5('0x25')]||!_0x17a587[_0xa4d5('0x26')]||!_0x17a587[_0xa4d5('0x27')]||!_0x17a587[_0xa4d5('0x28')]){throw new db['Sequelize'][(_0xa4d5('0x22'))](_0xa4d5('0x29'));}if(!_0x59b63f['fileText']){throw new Error(_0xa4d5('0x2a'));}if(_0x17a587[_0xa4d5('0x25')]===_0x1384d3['id']){return _0x1384d3;}else{return db[_0xa4d5('0x2b')][_0xa4d5('0x2c')]({'where':{'id':_settings[_0xa4d5('0x25')]}});}})[_0xa4d5('0x11')](function(_0xfc080a){if(!_0xfc080a){throw new db[(_0xa4d5('0x21'))][(_0xa4d5('0x22'))](_0xa4d5('0x2d'));}if(!_0xfc080a['data1']||!_0xfc080a['data2']){throw new db[(_0xa4d5('0x21'))][(_0xa4d5('0x22'))](_0xa4d5('0x2e'));}_0x22df52=_0xfc080a;logger[_0xa4d5('0xb')](util['format'](_0xa4d5('0x2f'),_0x100182['id']));return sentiment(_0x22df52['data1'],_0x22df52[_0xa4d5('0x10')],_0x17a587[_0xa4d5('0x26')],_0x59b63f[_0xa4d5('0x15')],_0x17a587[_0xa4d5('0x27')]);})[_0xa4d5('0x11')](function(_0x39b331){logger[_0xa4d5('0xb')](util[_0xa4d5('0xc')](_0xa4d5('0x30'),_0x100182['id']));return _0x100182[_0xa4d5('0x1e')]({'sentiment':_0x39b331['Sentiment'],'sPositive':_0x39b331[_0xa4d5('0x31')][_0xa4d5('0x32')],'sNegative':_0x39b331[_0xa4d5('0x31')]['Negative'],'sMixed':_0x39b331['SentimentScore'][_0xa4d5('0x33')],'sNeutral':_0x39b331[_0xa4d5('0x31')]['Neutral']});})[_0xa4d5('0x11')](function(){logger[_0xa4d5('0xb')](util[_0xa4d5('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x100182['id']));_0x5db9ab();});case _0xa4d5('0x34'):return _0x100182['update']({'transcribeStatus':_0xa4d5('0x34'),'failureReason':_0x138112['TranscriptionJob'][_0xa4d5('0x35')]})[_0xa4d5('0x11')](function(){logger[_0xa4d5('0xb')](util[_0xa4d5('0xc')](_0xa4d5('0x1f'),_0x100182['id']));_0x5db9ab();});default:logger[_0xa4d5('0xb')](util[_0xa4d5('0xc')](_0xa4d5('0x36'),_0x100182['id']));break;}}else{return BPromise['resolve']()[_0xa4d5('0x11')](function(){if(!_0x100182[_0xa4d5('0x20')]){throw new db[(_0xa4d5('0x21'))][(_0xa4d5('0x22'))](_0xa4d5('0x23'));}if(!_0x17a587['sentiment']||!_0x17a587['sentimentAccountId']||!_0x17a587['sentimentRegion']||!_0x17a587[_0xa4d5('0x27')]||!_0x17a587[_0xa4d5('0x28')]){throw new db[(_0xa4d5('0x21'))][(_0xa4d5('0x22'))](_0xa4d5('0x29'));}if(!_0x100182[_0xa4d5('0x15')]){throw new Error('Transcript\x20not\x20available');}if(_0x17a587['sentimentAccountId']===_0x1384d3['id']){return _0x1384d3;}else{return db['CloudProvider'][_0xa4d5('0x2c')]({'where':{'id':_settings[_0xa4d5('0x25')]}});}})[_0xa4d5('0x11')](function(_0x343cfe){if(!_0x343cfe){throw new db[(_0xa4d5('0x21'))][(_0xa4d5('0x22'))](_0xa4d5('0x2d'));}if(!_0x343cfe['data1']||!_0x343cfe['data2']){throw new db[(_0xa4d5('0x21'))][(_0xa4d5('0x22'))](_0xa4d5('0x2e'));}_0x22df52=_0x343cfe;logger[_0xa4d5('0xb')](util[_0xa4d5('0xc')](_0xa4d5('0x2f'),_0x100182['id']));return sentiment(_0x22df52[_0xa4d5('0xf')],_0x22df52[_0xa4d5('0x10')],_0x17a587[_0xa4d5('0x26')],_0x100182['fileText'],_0x17a587[_0xa4d5('0x27')]);})[_0xa4d5('0x11')](function(_0x1aa857){logger[_0xa4d5('0xb')](util['format'](_0xa4d5('0x30'),_0x100182['id']));return _0x100182[_0xa4d5('0x1e')]({'sentiment':_0x1aa857[_0xa4d5('0x37')],'sPositive':_0x1aa857[_0xa4d5('0x31')][_0xa4d5('0x32')],'sNegative':_0x1aa857[_0xa4d5('0x31')][_0xa4d5('0x38')],'sMixed':_0x1aa857[_0xa4d5('0x31')][_0xa4d5('0x33')],'sNeutral':_0x1aa857[_0xa4d5('0x31')][_0xa4d5('0x39')],'transcribeStatus':_0xa4d5('0x3a')});})[_0xa4d5('0x11')](function(){logger[_0xa4d5('0xb')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x100182['id']));_0x5db9ab();});}})[_0xa4d5('0x3b')](function(_0x392ab6){if(_0x392ab6){if(!_0x392ab6[_0xa4d5('0x3c')]||_0x392ab6[_0xa4d5('0x3c')]!==_0xa4d5('0x3d')){logger[_0xa4d5('0x3e')](util['format'](_0xa4d5('0x3f'),_0x100182['id']),util['inspect'](_0x392ab6,{'showHidden':![],'depth':null}));}}_0x5db9ab();});});}function checkTranscribe(){var _0x5deccd;var _0x51cf6e;var _0x2afc25;return db['VoiceRecording'][_0xa4d5('0x40')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x1efa4a){if(!_0x1efa4a||!_0x1efa4a[_0xa4d5('0x1c')]){throw new db[(_0xa4d5('0x21'))]['ValidationError'](_0xa4d5('0x41'));}_0x5deccd=_0x1efa4a;return db[_0xa4d5('0x42')][_0xa4d5('0x2c')]({'where':{'id':0x1}});})['then'](function(_0x2ff4ff){if(!_0x2ff4ff){throw new db[(_0xa4d5('0x21'))]['ValidationError'](_0xa4d5('0x43'));}_0x51cf6e=_0x2ff4ff;if(!_0x51cf6e[_0xa4d5('0x5')]||!_0x51cf6e[_0xa4d5('0x44')]||!_0x51cf6e[_0xa4d5('0x45')]||!_0x51cf6e[_0xa4d5('0x27')]||!_0x51cf6e[_0xa4d5('0x28')]){throw new db[(_0xa4d5('0x21'))][(_0xa4d5('0x22'))]('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0xa4d5('0x2c')]({'where':{'id':_0x51cf6e[_0xa4d5('0x44')]}});})[_0xa4d5('0x11')](function(_0x5e9af7){if(!_0x5e9af7){throw new db[(_0xa4d5('0x21'))][(_0xa4d5('0x22'))](_0xa4d5('0x2d'));}if(!_0x5e9af7[_0xa4d5('0xf')]||!_0x5e9af7['data2']){throw new db['Sequelize'][(_0xa4d5('0x22'))](_0xa4d5('0x2e'));}_0x2afc25=_0x5e9af7;var _0x2201fa=[];_0x5deccd[_0xa4d5('0x46')](function(_0x33de2b){_0x2201fa[_0xa4d5('0x47')](checkTranscribeJob(_0x33de2b,_0x51cf6e,_0x2afc25));});return BPromise[_0xa4d5('0x48')](_0x2201fa);})['catch'](function(_0x2c819b){if(_0x2c819b){if(!_0x2c819b[_0xa4d5('0x3c')]||_0x2c819b[_0xa4d5('0x3c')]!=='SequelizeValidationError'){logger[_0xa4d5('0x3e')](util[_0xa4d5('0x49')](_0x2c819b,{'showHidden':![],'depth':null}));}}});}exports[_0xa4d5('0x4a')]=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 d351c8c..1ae326b 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 _0xf0ab=['length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','../../config/environment','../../mysqldb','schedule','defaults','redis','findAll','hours'];(function(_0x542f75,_0x288844){var _0x4bd92d=function(_0x369ba9){while(--_0x369ba9){_0x542f75['push'](_0x542f75['shift']());}};_0x4bd92d(++_0x288844);}(_0xf0ab,0xd8));var _0xbf0a=function(_0x323006,_0x5b327b){_0x323006=_0x323006-0x0;var _0x460838=_0xf0ab[_0x323006];return _0x460838;};'use strict';var _=require(_0xbf0a('0x0'));var moment=require('moment');var Redis=require(_0xbf0a('0x1'));var util=require('util');var config=require(_0xbf0a('0x2'));var db=require(_0xbf0a('0x3'))['db'];var logger=require('../logger')(_0xbf0a('0x4'));config['redis']=_[_0xbf0a('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbf0a('0x6')]));function closeInteractions(){var _0x226b5a=[];return db['WhatsappInteraction'][_0xbf0a('0x7')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xbf0a('0x8'))}}})['then'](function(_0x5da689){if(_0x5da689&&_0x5da689[_0xbf0a('0x9')]){_0x226b5a=_[_0xbf0a('0xa')](_0x5da689||[],'id');logger['info'](_0xbf0a('0xb'),_0x226b5a[_0xbf0a('0xc')]());return db[_0xbf0a('0xd')][_0xbf0a('0xe')]({'closeReason':_0xbf0a('0xf'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xbf0a('0x10')](_0xbf0a('0x11'))},{'where':{'id':_0x226b5a}});}})[_0xbf0a('0x12')](function(){if(_0x226b5a&&_0x226b5a['length']){logger['info'](_0xbf0a('0x13'),_0x226b5a[_0xbf0a('0xc')]());for(var _0x37faf9=0x0;_0x37faf9<_0x226b5a[_0xbf0a('0x9')];_0x37faf9++){io[_0xbf0a('0x14')]('whatsappInteraction:update',{'id':_0x226b5a[_0x37faf9],'closed':!![]});}}})[_0xbf0a('0x15')](function(_0xa6ae2b){logger['error'](_0xbf0a('0x16'),_0xa6ae2b?util[_0xbf0a('0x17')](_0xa6ae2b,{'showHidden':![],'depth':null}):'');});}exports[_0xbf0a('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x5dae=['defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','subtract','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','util','../../config/environment','../../mysqldb','../logger','redis'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x5dae,0x1da));var _0xe5da=function(_0x24af9e,_0x3064d8){_0x24af9e=_0x24af9e-0x0;var _0x41139a=_0x5dae[_0x24af9e];return _0x41139a;};'use strict';var _=require(_0xe5da('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0xe5da('0x1'));var config=require(_0xe5da('0x2'));var db=require(_0xe5da('0x3'))['db'];var logger=require(_0xe5da('0x4'))('schedule');config[_0xe5da('0x5')]=_[_0xe5da('0x6')](config[_0xe5da('0x5')],{'host':_0xe5da('0x7'),'port':0x18eb});var io=require(_0xe5da('0x8'))(new Redis(config[_0xe5da('0x5')]));function closeInteractions(){var _0x2abe00=[];return db[_0xe5da('0x9')][_0xe5da('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xe5da('0xb')](0x18,_0xe5da('0xc'))}}})['then'](function(_0x4e064c){if(_0x4e064c&&_0x4e064c[_0xe5da('0xd')]){_0x2abe00=_[_0xe5da('0xe')](_0x4e064c||[],'id');logger[_0xe5da('0xf')](_0xe5da('0x10'),_0x2abe00[_0xe5da('0x11')]());return db[_0xe5da('0x9')]['update']({'closeReason':_0xe5da('0x12'),'disposition':_0xe5da('0x13'),'closed':!![],'closedAt':moment()[_0xe5da('0x14')](_0xe5da('0x15'))},{'where':{'id':_0x2abe00}});}})[_0xe5da('0x16')](function(){if(_0x2abe00&&_0x2abe00[_0xe5da('0xd')]){logger[_0xe5da('0xf')](_0xe5da('0x17'),_0x2abe00[_0xe5da('0x11')]());for(var _0x26d114=0x0;_0x26d114<_0x2abe00[_0xe5da('0xd')];_0x26d114++){io[_0xe5da('0x18')](_0xe5da('0x19'),{'id':_0x2abe00[_0x26d114],'closed':!![]});}}})[_0xe5da('0x1a')](function(_0x23db84){logger[_0xe5da('0x1b')](_0xe5da('0x1c'),_0x23db84?util['inspect'](_0x23db84,{'showHidden':![],'depth':null}):'');});}exports[_0xe5da('0x1d')]=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 0ade89f..53d72ee 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4cec=['hopper2','catch','util','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com','Biondo','now','CmContact','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2'];(function(_0x315661,_0xc7c48){var _0x33e7c9=function(_0x2b6a4a){while(--_0x2b6a4a){_0x315661['push'](_0x315661['shift']());}};_0x33e7c9(++_0xc7c48);}(_0x4cec,0x9a));var _0xc4ce=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x4cec[_0x51020b];return _0x371e47;};'use strict';var util=require(_0xc4ce('0x0'));var db=require(_0xc4ce('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xc4ce('0x2')]({'id':i,'firstName':_0xc4ce('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xc4ce('0x4')+i+_0xc4ce('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xc4ce('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xc4ce('0x2')]({'id':i,'firstName':_0xc4ce('0x3')+i,'lastName':_0xc4ce('0x6')+i,'phone':0xf879fb460+i,'email':_0xc4ce('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xc4ce('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}db[_0xc4ce('0x8')]['destroy']({'where':{}})['then'](function(){return db[_0xc4ce('0x8')][_0xc4ce('0x9')](contacts);})[_0xc4ce('0xa')](function(){console[_0xc4ce('0xb')](_0xc4ce('0xc'),_0xc4ce('0xd'));return db[_0xc4ce('0xe')]['destroy']({'where':{}});})[_0xc4ce('0xa')](function(){return db[_0xc4ce('0xe')]['bulkCreate'](hopper);})[_0xc4ce('0xa')](function(){console[_0xc4ce('0xb')]('finished\x20populating',_0xc4ce('0xf'));return db[_0xc4ce('0x8')][_0xc4ce('0x9')](contacts2);})[_0xc4ce('0xa')](function(){console[_0xc4ce('0xb')](_0xc4ce('0xc'),_0xc4ce('0x10'));return db[_0xc4ce('0xe')]['bulkCreate'](hopper2);})[_0xc4ce('0xa')](function(){console[_0xc4ce('0xb')](_0xc4ce('0xc'),_0xc4ce('0x11'));})[_0xc4ce('0x12')](function(_0x40e64d){console['log'](_0x40e64d);}); \ No newline at end of file +var _0xcad2=['destroy','then','bulkCreate','log','contacts1','CmHopper','finished\x20populating','hopper1','contacts2','hopper2','util','../mysqldb','Innocenzo','Biondo','@xcally.com','push','now','innocenzo.biondo','CmContact'];(function(_0x2685b2,_0x513f32){var _0x54b54e=function(_0x57ff7e){while(--_0x57ff7e){_0x2685b2['push'](_0x2685b2['shift']());}};_0x54b54e(++_0x513f32);}(_0xcad2,0x7c));var _0x2cad=function(_0x3262d3,_0x55cffb){_0x3262d3=_0x3262d3-0x0;var _0x11d1a5=_0xcad2[_0x3262d3];return _0x11d1a5;};'use strict';var util=require(_0x2cad('0x0'));var db=require(_0x2cad('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x2cad('0x2')+i,'lastName':_0x2cad('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x2cad('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2cad('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x2cad('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2cad('0x6')](),'updatedAt':Date[_0x2cad('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2cad('0x5')]({'id':i,'firstName':_0x2cad('0x2')+i,'lastName':_0x2cad('0x3')+i,'phone':0xf879fb460+i,'email':_0x2cad('0x7')+i+_0x2cad('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x2cad('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2cad('0x6')](),'updatedAt':Date[_0x2cad('0x6')]()});}db[_0x2cad('0x8')][_0x2cad('0x9')]({'where':{}})[_0x2cad('0xa')](function(){return db[_0x2cad('0x8')][_0x2cad('0xb')](contacts);})[_0x2cad('0xa')](function(){console[_0x2cad('0xc')]('finished\x20populating',_0x2cad('0xd'));return db['CmHopper']['destroy']({'where':{}});})[_0x2cad('0xa')](function(){return db[_0x2cad('0xe')]['bulkCreate'](hopper);})[_0x2cad('0xa')](function(){console[_0x2cad('0xc')](_0x2cad('0xf'),_0x2cad('0x10'));return db['CmContact'][_0x2cad('0xb')](contacts2);})['then'](function(){console[_0x2cad('0xc')](_0x2cad('0xf'),_0x2cad('0x11'));return db[_0x2cad('0xe')][_0x2cad('0xb')](hopper2);})['then'](function(){console['log'](_0x2cad('0xf'),_0x2cad('0x12'));})['catch'](function(_0x201b37){console[_0x2cad('0xc')](_0x201b37);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 3189b4c..a4c1f3f 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14ae=['%s%s','agent','%s%s@xcally.com','password','udp','wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','log','add\x20user','catch','util','../mysqldb','format'];(function(_0xefa44f,_0xb14ee6){var _0x4ed36d=function(_0x1860cc){while(--_0x1860cc){_0xefa44f['push'](_0xefa44f['shift']());}};_0x4ed36d(++_0xb14ee6);}(_0x14ae,0x1c9));var _0xe14a=function(_0x17c034,_0x2c96e0){_0x17c034=_0x17c034-0x0;var _0x26bbab=_0x14ae[_0x17c034];return _0x26bbab;};'use strict';var util=require(_0xe14a('0x0'));var db=require(_0xe14a('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xe14a('0x2')](_0xe14a('0x3'),_0xe14a('0x4'),i),'fullname':util['format'](_0xe14a('0x3'),'agent',i),'email':util[_0xe14a('0x2')](_0xe14a('0x5'),_0xe14a('0x4'),i),'role':'agent','password':_0xe14a('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0xe14a('0x7'),'ws',_0xe14a('0x8')],'disallow':[_0xe14a('0x9')],'allow':['ulaw'],'defaultuser':util[_0xe14a('0x2')]('%s%s','agent',i),'encryption':_0xe14a('0xa'),'avpf':_0xe14a('0xa'),'force_avp':_0xe14a('0xa'),'icesupport':_0xe14a('0xa'),'dtlsenable':_0xe14a('0xa'),'dtlsverify':'no','dtlscertfile':_0xe14a('0xb'),'dtlsprivatekey':_0xe14a('0xc'),'dtlssetup':_0xe14a('0xd'),'callerid':util['format'](_0xe14a('0xe'),util[_0xe14a('0x2')](_0xe14a('0x3'),'agent',i),0xfa0+i)});}db[_0xe14a('0xf')][_0xe14a('0x10')](users)['then'](function(){console[_0xe14a('0x11')](_0xe14a('0x12'));})[_0xe14a('0x13')](function(_0x5374a5){console[_0xe14a('0x11')](_0x5374a5);}); \ No newline at end of file +var _0x99e4=['udp','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','log','catch','util','../mysqldb','push','agent','%s%s','format','%s%s@xcally.com','password','friend'];(function(_0x458eef,_0x551783){var _0x2fb384=function(_0x28465e){while(--_0x28465e){_0x458eef['push'](_0x458eef['shift']());}};_0x2fb384(++_0x551783);}(_0x99e4,0xa2));var _0x499e=function(_0x2a8272,_0x5f3e38){_0x2a8272=_0x2a8272-0x0;var _0xe0fa73=_0x99e4[_0x2a8272];return _0xe0fa73;};'use strict';var util=require(_0x499e('0x0'));var db=require(_0x499e('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x499e('0x2')]({'name':util['format']('%s%s',_0x499e('0x3'),i),'fullname':util['format'](_0x499e('0x4'),'agent',i),'email':util[_0x499e('0x5')](_0x499e('0x6'),_0x499e('0x3'),i),'role':_0x499e('0x3'),'password':_0x499e('0x7'),'internal':0xfa0+i,'type':_0x499e('0x8'),'transport':[_0x499e('0x9'),'ws','wss'],'disallow':['all'],'allow':[_0x499e('0xa')],'defaultuser':util[_0x499e('0x5')](_0x499e('0x4'),_0x499e('0x3'),i),'encryption':_0x499e('0xb'),'avpf':'yes','force_avp':_0x499e('0xb'),'icesupport':_0x499e('0xb'),'dtlsenable':_0x499e('0xb'),'dtlsverify':'no','dtlscertfile':_0x499e('0xc'),'dtlsprivatekey':_0x499e('0xd'),'dtlssetup':_0x499e('0xe'),'callerid':util[_0x499e('0x5')](_0x499e('0xf'),util['format'](_0x499e('0x4'),_0x499e('0x3'),i),0xfa0+i)});}db[_0x499e('0x10')]['bulkCreate'](users)['then'](function(){console[_0x499e('0x11')]('add\x20user');})[_0x499e('0x12')](function(_0x2c8be9){console[_0x499e('0x11')](_0x2c8be9);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index a0ecf29..8c5a3c2 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa468=['WhatsappQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','all','voice','fax','sms','mail','telephone:%s','trunk:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remotePort','connectedAt','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','map','resourceId','User','where','Campaign','format','%s:queue:%s','Agents','length','handshake','query','find','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','SmsQueue','MailQueue','Trunk','user','userProfileId','OpenchannelQueues','OpenchannelQueue'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa468,0x1b1));var _0x8a46=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xa468[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x8a46('0x0'));var util=require(_0x8a46('0x1'));var BPromise=require(_0x8a46('0x2'));var db=require(_0x8a46('0x3'))['db'];var config=require(_0x8a46('0x4'));var queryQueues={'attributes':['id',_0x8a46('0x5')],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0x8a46('0x5'),_0x8a46('0x6')],'raw':!![],'where':{'role':_0x8a46('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x8a46('0x5')],'where':{'role':_0x8a46('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x8a46('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x8a46('0x5')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x8a46('0x9')],'where':{'type':_0x8a46('0xa')}};function getAssociatedResources(_0x5b6909,_0x411174,_0x1bd083){return db[_0x8a46('0xb')][_0x8a46('0xc')]({'where':{'name':_0x5b6909,'userProfileId':_0x411174},'raw':!![]})[_0x8a46('0xd')](function(_0x3c0560){if(_0x3c0560){if(_0x3c0560[_0x8a46('0xe')]){switch(_0x5b6909){case _0x8a46('0xf'):case _0x8a46('0x10'):case _0x8a46('0x11'):case _0x8a46('0x12'):case _0x8a46('0x13'):case'OpenchannelQueues':case _0x8a46('0x14'):return db[_0x1bd083][_0x8a46('0x15')](queryQueues);case _0x8a46('0x16'):return db[_0x1bd083]['findAll'](queryTelephones);case'Trunks':return db[_0x1bd083]['findAll'](queryTrunks);case _0x8a46('0x17'):return db[_0x1bd083][_0x8a46('0x15')](queryCampaigns);}}else{return db[_0x8a46('0x18')][_0x8a46('0x15')]({'attributes':['resourceId'],'where':{'sectionId':_0x3c0560['id']},'raw':!![]})[_0x8a46('0xd')](function(_0x4e39c2){if(_0x4e39c2){var _0x4884d7={'where':{'id':_[_0x8a46('0x19')](_0x4e39c2,_0x8a46('0x1a'))},'raw':!![]};switch(_0x1bd083){case _0x8a46('0x1b'):_0x4884d7[_0x8a46('0x1c')][_0x8a46('0x6')]='telephone';break;case _0x8a46('0x1d'):_0x4884d7[_0x8a46('0x1c')][_0x8a46('0x9')]=_0x8a46('0xa');break;}return db[_0x1bd083]['findAll'](_0x4884d7);}else{return[];}});}}else{return[];}})[_0x8a46('0xd')](function(_0x26b1a2){return _0x26b1a2;});}function joinOrLeaveQueues(_0x4dfd86,_0x159c70,_0x1cc473,_0x22febd){_0x4dfd86[_0x159c70](util[_0x8a46('0x1e')](_0x8a46('0x1f'),_0x1cc473,_0x22febd[_0x8a46('0x5')]));if(_0x22febd[_0x8a46('0x20')]){for(var _0x10a9de=0x0;_0x10a9de<_0x22febd[_0x8a46('0x20')][_0x8a46('0x21')];_0x10a9de+=0x1){_0x4dfd86[_0x159c70](util[_0x8a46('0x1e')]('user:%s',_0x22febd[_0x8a46('0x20')][_0x10a9de][_0x8a46('0x5')]));}}}function joinOrLeave(_0x1e9300,_0x10ae62,_0x126a3d){var _0x58b1ba;if(_0x1e9300[_0x8a46('0x22')][_0x8a46('0x23')]['id']){db['User'][_0x8a46('0x24')]({'attributes':['id','name',_0x8a46('0x6'),'userProfileId'],'where':{'id':_0x1e9300[_0x8a46('0x22')][_0x8a46('0x23')]['id']},'include':[{'model':db[_0x8a46('0x25')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x8a46('0x26')],'as':_0x8a46('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x8a46('0x28')],'as':_0x8a46('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x8a46('0x2a')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x8a46('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x8a46('0x2c')],'as':_0x8a46('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x8a46('0xd')](function(_0x23aa68){if(_0x23aa68){_0x58b1ba=_0x23aa68;_0x1e9300[_0x10ae62](util[_0x8a46('0x1e')](_0x8a46('0x2e'),_0x23aa68[_0x8a46('0x5')]));var _0x49b58b=[];switch(_0x23aa68[_0x8a46('0x6')]){case _0x8a46('0x2f'):_0x1e9300[_0x10ae62](_0x8a46('0x30'));_0x1e9300[_0x10ae62](_0x8a46('0x31'));if(queryQueues[_0x8a46('0x32')](_0x8a46('0x33'))){delete queryQueues[_0x8a46('0x33')];}_0x49b58b['push'](db[_0x8a46('0x34')]['findAll'](queryQueues));_0x49b58b[_0x8a46('0x35')](db[_0x8a46('0x36')]['findAll'](queryQueues));_0x49b58b[_0x8a46('0x35')](db['FaxQueue']['findAll'](queryQueues));_0x49b58b[_0x8a46('0x35')](db[_0x8a46('0x37')][_0x8a46('0x15')](queryQueues));_0x49b58b[_0x8a46('0x35')](db[_0x8a46('0x38')][_0x8a46('0x15')](queryQueues));_0x49b58b[_0x8a46('0x35')](db['OpenchannelQueue']['findAll'](queryQueues));_0x49b58b[_0x8a46('0x35')](db['WhatsappQueue'][_0x8a46('0x15')](queryQueues));_0x49b58b[_0x8a46('0x35')](db[_0x8a46('0x1b')][_0x8a46('0x15')](queryTelephones));_0x49b58b[_0x8a46('0x35')](db[_0x8a46('0x39')][_0x8a46('0x15')](queryTrunks));_0x49b58b[_0x8a46('0x35')](db['Campaign'][_0x8a46('0x15')](queryCampaigns));_0x49b58b[_0x8a46('0x35')](db['User'][_0x8a46('0x15')](queryAgents));break;case _0x8a46('0x3a'):_0x1e9300[_0x10ae62](_0x8a46('0x30'));_0x1e9300[_0x10ae62](_0x8a46('0x31'));_0x49b58b[_0x8a46('0x35')](getAssociatedResources('VoiceQueues',_0x23aa68[_0x8a46('0x3b')],_0x8a46('0x34')));_0x49b58b[_0x8a46('0x35')](getAssociatedResources(_0x8a46('0x10'),_0x23aa68['userProfileId'],'ChatQueue'));_0x49b58b[_0x8a46('0x35')](getAssociatedResources(_0x8a46('0x11'),_0x23aa68['userProfileId'],'FaxQueue'));_0x49b58b[_0x8a46('0x35')](getAssociatedResources('SmsQueues',_0x23aa68['userProfileId'],_0x8a46('0x37')));_0x49b58b[_0x8a46('0x35')](getAssociatedResources(_0x8a46('0x13'),_0x23aa68[_0x8a46('0x3b')],'MailQueue'));_0x49b58b[_0x8a46('0x35')](getAssociatedResources(_0x8a46('0x3c'),_0x23aa68[_0x8a46('0x3b')],_0x8a46('0x3d')));_0x49b58b[_0x8a46('0x35')](getAssociatedResources(_0x8a46('0x14'),_0x23aa68[_0x8a46('0x3b')],_0x8a46('0x3e')));_0x49b58b[_0x8a46('0x35')](getAssociatedResources(_0x8a46('0x16'),_0x23aa68[_0x8a46('0x3b')],_0x8a46('0x1b')));_0x49b58b['push'](getAssociatedResources('Trunks',_0x23aa68['userProfileId'],_0x8a46('0x39')));_0x49b58b['push'](getAssociatedResources(_0x8a46('0x17'),_0x23aa68['userProfileId'],_0x8a46('0x1d')));_0x49b58b[_0x8a46('0x35')](db[_0x8a46('0x1b')][_0x8a46('0x15')](queryAgents));break;case'agent':_0x1e9300[_0x10ae62](_0x8a46('0x30'));_0x1e9300[_0x10ae62]('voice:outbound');_0x49b58b['push'](_0x23aa68[_0x8a46('0x3f')]({'attributes':['id',_0x8a46('0x5')]}));_0x49b58b['push'](_0x23aa68[_0x8a46('0x40')]({'attributes':['id',_0x8a46('0x5')]}));_0x49b58b['push'](_0x23aa68[_0x8a46('0x41')]({'attributes':['id',_0x8a46('0x5')]}));_0x49b58b[_0x8a46('0x35')](_0x23aa68[_0x8a46('0x42')]({'attributes':['id','name']}));_0x49b58b['push'](_0x23aa68['getMailQueues']({'attributes':['id',_0x8a46('0x5')]}));_0x49b58b[_0x8a46('0x35')](_0x23aa68['getOpenchannelQueues']({'attributes':['id',_0x8a46('0x5')]}));_0x49b58b['push'](_0x23aa68['getWhatsappQueues']({'attributes':['id',_0x8a46('0x5')]}));break;}return BPromise[_0x8a46('0x43')](_0x49b58b);}})[_0x8a46('0xd')](function(_0x276fb8){if(_0x276fb8&&_0x276fb8[_0x8a46('0x21')]){for(var _0x1da0ae=0x0;_0x1da0ae<_0x276fb8['length'];_0x1da0ae+=0x1){for(var _0x1d22da=0x0;_0x1d22da<_0x276fb8[_0x1da0ae][_0x8a46('0x21')];_0x1d22da+=0x1){switch(_0x1da0ae){case 0x0:joinOrLeaveQueues(_0x1e9300,_0x10ae62,_0x8a46('0x44'),_0x276fb8[_0x1da0ae][_0x1d22da]);break;case 0x1:joinOrLeaveQueues(_0x1e9300,_0x10ae62,'chat',_0x276fb8[_0x1da0ae][_0x1d22da]);break;case 0x2:joinOrLeaveQueues(_0x1e9300,_0x10ae62,_0x8a46('0x45'),_0x276fb8[_0x1da0ae][_0x1d22da]);break;case 0x3:joinOrLeaveQueues(_0x1e9300,_0x10ae62,_0x8a46('0x46'),_0x276fb8[_0x1da0ae][_0x1d22da]);break;case 0x4:joinOrLeaveQueues(_0x1e9300,_0x10ae62,_0x8a46('0x47'),_0x276fb8[_0x1da0ae][_0x1d22da]);break;case 0x5:joinOrLeaveQueues(_0x1e9300,_0x10ae62,'openchannel',_0x276fb8[_0x1da0ae][_0x1d22da]);break;case 0x6:joinOrLeaveQueues(_0x1e9300,_0x10ae62,'whatsapp',_0x276fb8[_0x1da0ae][_0x1d22da]);break;case 0x7:if(_0x58b1ba[_0x8a46('0x6')]!==_0x8a46('0x7'))_0x1e9300[_0x10ae62](util['format'](_0x8a46('0x48'),_0x276fb8[_0x1da0ae][_0x1d22da][_0x8a46('0x5')]));break;case 0x8:if(_0x58b1ba[_0x8a46('0x6')]!==_0x8a46('0x7'))_0x1e9300[_0x10ae62](util[_0x8a46('0x1e')](_0x8a46('0x49'),_0x276fb8[_0x1da0ae][_0x1d22da][_0x8a46('0x5')]));break;case 0x9:if(_0x58b1ba['role']!==_0x8a46('0x7'))_0x1e9300[_0x10ae62](util[_0x8a46('0x1e')]('campaign:%s:%s',_0x276fb8[_0x1da0ae][_0x1d22da]['type'],_0x276fb8[_0x1da0ae][_0x1d22da]['name']));break;case 0xa:_0x1e9300[_0x10ae62](util[_0x8a46('0x1e')]('user:%s',_0x276fb8[_0x1da0ae][_0x1d22da][_0x8a46('0x5')]));break;}}}}})[_0x8a46('0xd')](function(){if(_0x10ae62===_0x8a46('0x4a')){var _0x44b0fb=_['map'](_0x58b1ba['ChatInteractions'],'id');return _0x58b1ba[_0x8a46('0x4b')](_0x44b0fb)[_0x8a46('0xd')](function(){for(var _0x4908c2=0x0;_0x4908c2<_0x44b0fb['length'];_0x4908c2+=0x1){_0x126a3d[_0x8a46('0x4c')](_0x8a46('0x4d'),{'ChatInteractionId':Number(_0x44b0fb[_0x4908c2]),'UserId':Number(_0x58b1ba['id'])});}});}})[_0x8a46('0xd')](function(){if(_0x10ae62===_0x8a46('0x4a')){var _0xd30a2c=_['map'](_0x58b1ba['MailInteractions'],'id');return _0x58b1ba[_0x8a46('0x4e')](_0xd30a2c)[_0x8a46('0xd')](function(){for(var _0xbf111f=0x0;_0xbf111f<_0xd30a2c[_0x8a46('0x21')];_0xbf111f+=0x1){_0x126a3d['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0xd30a2c[_0xbf111f]),'UserId':Number(_0x58b1ba['id'])});}});}})[_0x8a46('0xd')](function(){if(_0x10ae62==='leave'){var _0x430c83=_[_0x8a46('0x19')](_0x58b1ba['FaxInteractions'],'id');return _0x58b1ba['removeFaxInteractions'](_0x430c83)[_0x8a46('0xd')](function(){for(var _0xa4c6be=0x0;_0xa4c6be<_0x430c83[_0x8a46('0x21')];_0xa4c6be+=0x1){_0x126a3d[_0x8a46('0x4c')](_0x8a46('0x4f'),{'FaxInteractionId':Number(_0x430c83[_0xa4c6be]),'UserId':Number(_0x58b1ba['id'])});}});}})[_0x8a46('0xd')](function(){if(_0x10ae62==='leave'){var _0x2becdc=_[_0x8a46('0x19')](_0x58b1ba[_0x8a46('0x50')],'id');return _0x58b1ba[_0x8a46('0x51')](_0x2becdc)[_0x8a46('0xd')](function(){for(var _0x20f662=0x0;_0x20f662<_0x2becdc[_0x8a46('0x21')];_0x20f662+=0x1){_0x126a3d['emit'](_0x8a46('0x52'),{'SmsInteractionId':Number(_0x2becdc[_0x20f662]),'UserId':Number(_0x58b1ba['id'])});}});}})['then'](function(){if(_0x10ae62===_0x8a46('0x4a')){var _0x56e917=_['map'](_0x58b1ba[_0x8a46('0x2b')],'id');return _0x58b1ba[_0x8a46('0x53')](_0x56e917)[_0x8a46('0xd')](function(){for(var _0x283254=0x0;_0x283254<_0x56e917[_0x8a46('0x21')];_0x283254+=0x1){_0x126a3d['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x56e917[_0x283254]),'UserId':Number(_0x58b1ba['id'])});}});}})[_0x8a46('0xd')](function(){if(_0x10ae62==='leave'){var _0x2350fa=_[_0x8a46('0x19')](_0x58b1ba[_0x8a46('0x2d')],'id');return _0x58b1ba['removeWhatsappInteractions'](_0x2350fa)['then'](function(){for(var _0x2067cf=0x0;_0x2067cf<_0x2350fa['length'];_0x2067cf+=0x1){_0x126a3d[_0x8a46('0x4c')](_0x8a46('0x54'),{'WhatsappInteractionId':Number(_0x2350fa[_0x2067cf]),'UserId':Number(_0x58b1ba['id'])});}});}})[_0x8a46('0x55')](function(_0x486f45){_0x1e9300[_0x8a46('0x56')](_0x486f45);});}}function onDisconnect(_0x896f3a,_0x1d67ff){joinOrLeave(_0x896f3a,_0x8a46('0x4a'),_0x1d67ff);}function onConnect(_0x451a43){joinOrLeave(_0x451a43,_0x8a46('0x57'));}exports[_0x8a46('0x58')]=function(_0x1ebea7){_0x1ebea7['on'](_0x8a46('0x59'),function(_0xd5b54b){_0xd5b54b[_0x8a46('0x5a')](0x0);_0xd5b54b[_0x8a46('0x5b')]=_0xd5b54b[_0x8a46('0x5c')][_0x8a46('0x59')]['remoteAddress']+':'+_0xd5b54b[_0x8a46('0x5c')][_0x8a46('0x59')][_0x8a46('0x5d')];_0xd5b54b[_0x8a46('0x5e')]=new Date();_0xd5b54b['log']=function(_0x21f32f){console[_0x8a46('0x56')](_0x8a46('0x5f')+_0xd5b54b[_0x8a46('0x60')][_0x8a46('0x5')]+'['+_0xd5b54b[_0x8a46('0x5b')]+']',_0x21f32f);};_0xd5b54b['on']('disconnect',function(){onDisconnect(_0xd5b54b,_0x1ebea7);_0xd5b54b[_0x8a46('0x56')](_0x8a46('0x61'));});onConnect(_0xd5b54b);_0xd5b54b['log'](_0x8a46('0x62'));});}; \ No newline at end of file +var _0x7e74=['agent','telephone','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','User','where','Campaign','type','length','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','format','user:%s','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','WhatsappQueue','Telephones','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getWhatsappQueues','all','voice','fax','openchannel','whatsapp','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','log','nsp','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','./environment','name','Agents','role'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7e74,0xbd));var _0x47e7=function(_0x2853c4,_0x503d6d){_0x2853c4=_0x2853c4-0x0;var _0x150379=_0x7e74[_0x2853c4];return _0x150379;};'use strict';var _=require(_0x47e7('0x0'));var util=require('util');var BPromise=require(_0x47e7('0x1'));var db=require(_0x47e7('0x2'))['db'];var config=require(_0x47e7('0x3'));var queryQueues={'attributes':['id',_0x47e7('0x4')],'include':[{'as':_0x47e7('0x5'),'model':db['User'],'attributes':['id',_0x47e7('0x4'),_0x47e7('0x6')],'raw':!![],'where':{'role':_0x47e7('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x47e7('0x4')],'where':{'role':_0x47e7('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x47e7('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x47e7('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x47e7('0x4'),'type'],'where':{'type':_0x47e7('0x9')}};function getAssociatedResources(_0x7e9507,_0x35d472,_0x2f66c0){return db[_0x47e7('0xa')][_0x47e7('0xb')]({'where':{'name':_0x7e9507,'userProfileId':_0x35d472},'raw':!![]})[_0x47e7('0xc')](function(_0x10e968){if(_0x10e968){if(_0x10e968[_0x47e7('0xd')]){switch(_0x7e9507){case _0x47e7('0xe'):case _0x47e7('0xf'):case _0x47e7('0x10'):case _0x47e7('0x11'):case'MailQueues':case _0x47e7('0x12'):case _0x47e7('0x13'):return db[_0x2f66c0][_0x47e7('0x14')](queryQueues);case'Telephones':return db[_0x2f66c0][_0x47e7('0x14')](queryTelephones);case _0x47e7('0x15'):return db[_0x2f66c0][_0x47e7('0x14')](queryTrunks);case _0x47e7('0x16'):return db[_0x2f66c0]['findAll'](queryCampaigns);}}else{return db[_0x47e7('0x17')][_0x47e7('0x14')]({'attributes':[_0x47e7('0x18')],'where':{'sectionId':_0x10e968['id']},'raw':!![]})[_0x47e7('0xc')](function(_0x2fec9f){if(_0x2fec9f){var _0x5369d4={'where':{'id':_[_0x47e7('0x19')](_0x2fec9f,'resourceId')},'raw':!![]};switch(_0x2f66c0){case _0x47e7('0x1a'):_0x5369d4[_0x47e7('0x1b')][_0x47e7('0x6')]=_0x47e7('0x8');break;case _0x47e7('0x1c'):_0x5369d4[_0x47e7('0x1b')][_0x47e7('0x1d')]=_0x47e7('0x9');break;}return db[_0x2f66c0][_0x47e7('0x14')](_0x5369d4);}else{return[];}});}}else{return[];}})[_0x47e7('0xc')](function(_0x1e910c){return _0x1e910c;});}function joinOrLeaveQueues(_0x1659bf,_0x881457,_0x32e00e,_0x53ec62){_0x1659bf[_0x881457](util['format']('%s:queue:%s',_0x32e00e,_0x53ec62['name']));if(_0x53ec62[_0x47e7('0x5')]){for(var _0x3484cf=0x0;_0x3484cf<_0x53ec62[_0x47e7('0x5')][_0x47e7('0x1e')];_0x3484cf+=0x1){_0x1659bf[_0x881457](util['format']('user:%s',_0x53ec62[_0x47e7('0x5')][_0x3484cf]['name']));}}}function joinOrLeave(_0x3df9f3,_0x5b6d46,_0x33d5eb){var _0x8e7237;if(_0x3df9f3[_0x47e7('0x1f')][_0x47e7('0x20')]['id']){db['User']['find']({'attributes':['id',_0x47e7('0x4'),_0x47e7('0x6'),_0x47e7('0x21')],'where':{'id':_0x3df9f3[_0x47e7('0x1f')]['query']['id']},'include':[{'model':db[_0x47e7('0x22')],'as':_0x47e7('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x47e7('0x24')],'as':_0x47e7('0x25'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x47e7('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x47e7('0x27')],'as':_0x47e7('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x47e7('0x29')],'as':_0x47e7('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x47e7('0x2b')],'as':_0x47e7('0x2c'),'attributes':['id'],'raw':!![]}]})[_0x47e7('0xc')](function(_0x172c80){if(_0x172c80){_0x8e7237=_0x172c80;_0x3df9f3[_0x5b6d46](util[_0x47e7('0x2d')](_0x47e7('0x2e'),_0x172c80[_0x47e7('0x4')]));var _0x358cb6=[];switch(_0x172c80[_0x47e7('0x6')]){case'admin':_0x3df9f3[_0x5b6d46](_0x47e7('0x2f'));_0x3df9f3[_0x5b6d46](_0x47e7('0x30'));if(queryQueues[_0x47e7('0x31')](_0x47e7('0x32'))){delete queryQueues[_0x47e7('0x32')];}_0x358cb6['push'](db[_0x47e7('0x33')][_0x47e7('0x14')](queryQueues));_0x358cb6[_0x47e7('0x34')](db[_0x47e7('0x35')][_0x47e7('0x14')](queryQueues));_0x358cb6[_0x47e7('0x34')](db[_0x47e7('0x36')]['findAll'](queryQueues));_0x358cb6['push'](db[_0x47e7('0x37')]['findAll'](queryQueues));_0x358cb6[_0x47e7('0x34')](db[_0x47e7('0x38')]['findAll'](queryQueues));_0x358cb6[_0x47e7('0x34')](db[_0x47e7('0x39')][_0x47e7('0x14')](queryQueues));_0x358cb6['push'](db['WhatsappQueue'][_0x47e7('0x14')](queryQueues));_0x358cb6[_0x47e7('0x34')](db['User'][_0x47e7('0x14')](queryTelephones));_0x358cb6[_0x47e7('0x34')](db[_0x47e7('0x3a')]['findAll'](queryTrunks));_0x358cb6[_0x47e7('0x34')](db['Campaign'][_0x47e7('0x14')](queryCampaigns));_0x358cb6[_0x47e7('0x34')](db[_0x47e7('0x1a')]['findAll'](queryAgents));break;case _0x47e7('0x3b'):_0x3df9f3[_0x5b6d46](_0x47e7('0x2f'));_0x3df9f3[_0x5b6d46](_0x47e7('0x30'));_0x358cb6[_0x47e7('0x34')](getAssociatedResources(_0x47e7('0xe'),_0x172c80[_0x47e7('0x21')],'VoiceQueue'));_0x358cb6['push'](getAssociatedResources(_0x47e7('0xf'),_0x172c80['userProfileId'],_0x47e7('0x35')));_0x358cb6[_0x47e7('0x34')](getAssociatedResources(_0x47e7('0x10'),_0x172c80[_0x47e7('0x21')],_0x47e7('0x36')));_0x358cb6[_0x47e7('0x34')](getAssociatedResources(_0x47e7('0x11'),_0x172c80[_0x47e7('0x21')],_0x47e7('0x37')));_0x358cb6[_0x47e7('0x34')](getAssociatedResources('MailQueues',_0x172c80[_0x47e7('0x21')],'MailQueue'));_0x358cb6['push'](getAssociatedResources('OpenchannelQueues',_0x172c80[_0x47e7('0x21')],_0x47e7('0x39')));_0x358cb6['push'](getAssociatedResources(_0x47e7('0x13'),_0x172c80[_0x47e7('0x21')],_0x47e7('0x3c')));_0x358cb6[_0x47e7('0x34')](getAssociatedResources(_0x47e7('0x3d'),_0x172c80['userProfileId'],_0x47e7('0x1a')));_0x358cb6['push'](getAssociatedResources(_0x47e7('0x15'),_0x172c80[_0x47e7('0x21')],_0x47e7('0x3a')));_0x358cb6['push'](getAssociatedResources(_0x47e7('0x16'),_0x172c80[_0x47e7('0x21')],'Campaign'));_0x358cb6['push'](db[_0x47e7('0x1a')][_0x47e7('0x14')](queryAgents));break;case _0x47e7('0x7'):_0x3df9f3[_0x5b6d46]('voice:inbound');_0x3df9f3[_0x5b6d46](_0x47e7('0x30'));_0x358cb6[_0x47e7('0x34')](_0x172c80[_0x47e7('0x3e')]({'attributes':['id',_0x47e7('0x4')]}));_0x358cb6[_0x47e7('0x34')](_0x172c80[_0x47e7('0x3f')]({'attributes':['id',_0x47e7('0x4')]}));_0x358cb6[_0x47e7('0x34')](_0x172c80[_0x47e7('0x40')]({'attributes':['id',_0x47e7('0x4')]}));_0x358cb6[_0x47e7('0x34')](_0x172c80['getSmsQueues']({'attributes':['id',_0x47e7('0x4')]}));_0x358cb6['push'](_0x172c80[_0x47e7('0x41')]({'attributes':['id','name']}));_0x358cb6[_0x47e7('0x34')](_0x172c80['getOpenchannelQueues']({'attributes':['id','name']}));_0x358cb6[_0x47e7('0x34')](_0x172c80[_0x47e7('0x42')]({'attributes':['id','name']}));break;}return BPromise[_0x47e7('0x43')](_0x358cb6);}})[_0x47e7('0xc')](function(_0xa9ae82){if(_0xa9ae82&&_0xa9ae82[_0x47e7('0x1e')]){for(var _0x2bed32=0x0;_0x2bed32<_0xa9ae82[_0x47e7('0x1e')];_0x2bed32+=0x1){for(var _0x536849=0x0;_0x536849<_0xa9ae82[_0x2bed32][_0x47e7('0x1e')];_0x536849+=0x1){switch(_0x2bed32){case 0x0:joinOrLeaveQueues(_0x3df9f3,_0x5b6d46,_0x47e7('0x44'),_0xa9ae82[_0x2bed32][_0x536849]);break;case 0x1:joinOrLeaveQueues(_0x3df9f3,_0x5b6d46,'chat',_0xa9ae82[_0x2bed32][_0x536849]);break;case 0x2:joinOrLeaveQueues(_0x3df9f3,_0x5b6d46,_0x47e7('0x45'),_0xa9ae82[_0x2bed32][_0x536849]);break;case 0x3:joinOrLeaveQueues(_0x3df9f3,_0x5b6d46,'sms',_0xa9ae82[_0x2bed32][_0x536849]);break;case 0x4:joinOrLeaveQueues(_0x3df9f3,_0x5b6d46,'mail',_0xa9ae82[_0x2bed32][_0x536849]);break;case 0x5:joinOrLeaveQueues(_0x3df9f3,_0x5b6d46,_0x47e7('0x46'),_0xa9ae82[_0x2bed32][_0x536849]);break;case 0x6:joinOrLeaveQueues(_0x3df9f3,_0x5b6d46,_0x47e7('0x47'),_0xa9ae82[_0x2bed32][_0x536849]);break;case 0x7:if(_0x8e7237[_0x47e7('0x6')]!==_0x47e7('0x7'))_0x3df9f3[_0x5b6d46](util['format']('telephone:%s',_0xa9ae82[_0x2bed32][_0x536849][_0x47e7('0x4')]));break;case 0x8:if(_0x8e7237[_0x47e7('0x6')]!==_0x47e7('0x7'))_0x3df9f3[_0x5b6d46](util[_0x47e7('0x2d')]('trunk:%s',_0xa9ae82[_0x2bed32][_0x536849][_0x47e7('0x4')]));break;case 0x9:if(_0x8e7237['role']!=='agent')_0x3df9f3[_0x5b6d46](util[_0x47e7('0x2d')]('campaign:%s:%s',_0xa9ae82[_0x2bed32][_0x536849][_0x47e7('0x1d')],_0xa9ae82[_0x2bed32][_0x536849][_0x47e7('0x4')]));break;case 0xa:_0x3df9f3[_0x5b6d46](util[_0x47e7('0x2d')](_0x47e7('0x2e'),_0xa9ae82[_0x2bed32][_0x536849][_0x47e7('0x4')]));break;}}}}})[_0x47e7('0xc')](function(){if(_0x5b6d46===_0x47e7('0x48')){var _0x2c533c=_[_0x47e7('0x19')](_0x8e7237[_0x47e7('0x23')],'id');return _0x8e7237[_0x47e7('0x49')](_0x2c533c)[_0x47e7('0xc')](function(){for(var _0x592788=0x0;_0x592788<_0x2c533c[_0x47e7('0x1e')];_0x592788+=0x1){_0x33d5eb['emit'](_0x47e7('0x4a'),{'ChatInteractionId':Number(_0x2c533c[_0x592788]),'UserId':Number(_0x8e7237['id'])});}});}})[_0x47e7('0xc')](function(){if(_0x5b6d46===_0x47e7('0x48')){var _0x296dd3=_[_0x47e7('0x19')](_0x8e7237[_0x47e7('0x25')],'id');return _0x8e7237[_0x47e7('0x4b')](_0x296dd3)[_0x47e7('0xc')](function(){for(var _0x1753a6=0x0;_0x1753a6<_0x296dd3[_0x47e7('0x1e')];_0x1753a6+=0x1){_0x33d5eb[_0x47e7('0x4c')](_0x47e7('0x4d'),{'MailInteractionId':Number(_0x296dd3[_0x1753a6]),'UserId':Number(_0x8e7237['id'])});}});}})[_0x47e7('0xc')](function(){if(_0x5b6d46===_0x47e7('0x48')){var _0x2dcf88=_['map'](_0x8e7237['FaxInteractions'],'id');return _0x8e7237[_0x47e7('0x4e')](_0x2dcf88)[_0x47e7('0xc')](function(){for(var _0x506131=0x0;_0x506131<_0x2dcf88[_0x47e7('0x1e')];_0x506131+=0x1){_0x33d5eb[_0x47e7('0x4c')](_0x47e7('0x4f'),{'FaxInteractionId':Number(_0x2dcf88[_0x506131]),'UserId':Number(_0x8e7237['id'])});}});}})['then'](function(){if(_0x5b6d46===_0x47e7('0x48')){var _0x47d3fb=_[_0x47e7('0x19')](_0x8e7237[_0x47e7('0x28')],'id');return _0x8e7237['removeSmsInteractions'](_0x47d3fb)[_0x47e7('0xc')](function(){for(var _0x2c3d61=0x0;_0x2c3d61<_0x47d3fb[_0x47e7('0x1e')];_0x2c3d61+=0x1){_0x33d5eb[_0x47e7('0x4c')](_0x47e7('0x50'),{'SmsInteractionId':Number(_0x47d3fb[_0x2c3d61]),'UserId':Number(_0x8e7237['id'])});}});}})[_0x47e7('0xc')](function(){if(_0x5b6d46===_0x47e7('0x48')){var _0x4d6da7=_[_0x47e7('0x19')](_0x8e7237[_0x47e7('0x2a')],'id');return _0x8e7237[_0x47e7('0x51')](_0x4d6da7)[_0x47e7('0xc')](function(){for(var _0x4d770e=0x0;_0x4d770e<_0x4d6da7[_0x47e7('0x1e')];_0x4d770e+=0x1){_0x33d5eb['emit'](_0x47e7('0x52'),{'OpenchannelInteractionId':Number(_0x4d6da7[_0x4d770e]),'UserId':Number(_0x8e7237['id'])});}});}})['then'](function(){if(_0x5b6d46===_0x47e7('0x48')){var _0x5a953a=_[_0x47e7('0x19')](_0x8e7237[_0x47e7('0x2c')],'id');return _0x8e7237[_0x47e7('0x53')](_0x5a953a)[_0x47e7('0xc')](function(){for(var _0x15e20e=0x0;_0x15e20e<_0x5a953a[_0x47e7('0x1e')];_0x15e20e+=0x1){_0x33d5eb[_0x47e7('0x4c')](_0x47e7('0x54'),{'WhatsappInteractionId':Number(_0x5a953a[_0x15e20e]),'UserId':Number(_0x8e7237['id'])});}});}})[_0x47e7('0x55')](function(_0x5c8213){_0x3df9f3['log'](_0x5c8213);});}}function onDisconnect(_0x3788b8,_0x46abe0){joinOrLeave(_0x3788b8,'leave',_0x46abe0);}function onConnect(_0x10865){joinOrLeave(_0x10865,_0x47e7('0x56'));}exports[_0x47e7('0x57')]=function(_0x3ae349){_0x3ae349['on']('connection',function(_0x363934){_0x363934[_0x47e7('0x58')](0x0);_0x363934[_0x47e7('0x59')]=_0x363934[_0x47e7('0x5a')][_0x47e7('0x5b')][_0x47e7('0x5c')]+':'+_0x363934[_0x47e7('0x5a')][_0x47e7('0x5b')][_0x47e7('0x5d')];_0x363934['connectedAt']=new Date();_0x363934[_0x47e7('0x5e')]=function(_0x3064dc){console[_0x47e7('0x5e')]('SocketIO\x20'+_0x363934[_0x47e7('0x5f')][_0x47e7('0x4')]+'['+_0x363934['address']+']',_0x3064dc);};_0x363934['on']('disconnect',function(){onDisconnect(_0x363934,_0x3ae349);_0x363934[_0x47e7('0x5e')](_0x47e7('0x60'));});onConnect(_0x363934);_0x363934[_0x47e7('0x5e')](_0x47e7('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index ae42711..df0aded 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 _0x4739=['query','QueryTypes','SELECT','contact','interface','format','SIP/%s','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','motionChannel','UserId','changed','closed','substatus','Sequelize','AfterUpdate','User','find','fullname','email','internal','default','length','model','callback','toLowerCase','condition','util','../../mysqldb','../logger','triggers','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','SmsInteraction','Sms','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','event','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize'];(function(_0x585b25,_0x3b7d77){var _0x4f281c=function(_0x4b17c8){while(--_0x4b17c8){_0x585b25['push'](_0x585b25['shift']());}};_0x4f281c(++_0x3b7d77);}(_0x4739,0x1ce));var _0x9473=function(_0x15acc2,_0x2ec6f2){_0x15acc2=_0x15acc2-0x0;var _0x3c5450=_0x4739[_0x15acc2];return _0x3c5450;};'use strict';var util=require(_0x9473('0x0'));var db=require(_0x9473('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0x9473('0x2'))(_0x9473('0x3'));var client=jayson['client'][_0x9473('0x4')]({'port':0x232a});var triggers=[{'channel':_0x9473('0x5'),'model':_0x9473('0x6'),'event':_0x9473('0x7'),'condition':_0x9473('0x8'),'callback':afterCreate},{'channel':_0x9473('0x5'),'model':'ChatInteraction','event':_0x9473('0x9'),'condition':_0x9473('0xa'),'callback':afterUpdate},{'channel':_0x9473('0x5'),'model':_0x9473('0xb'),'event':_0x9473('0x7'),'condition':_0x9473('0xc'),'callback':afterCreateMessage},{'channel':'Sms','model':_0x9473('0xd'),'event':_0x9473('0x7'),'condition':_0x9473('0x8'),'callback':afterCreate},{'channel':'Sms','model':'SmsInteraction','event':_0x9473('0x9'),'condition':_0x9473('0xa'),'callback':afterUpdate},{'channel':_0x9473('0xe'),'model':_0x9473('0xf'),'event':_0x9473('0x7'),'condition':_0x9473('0xc'),'callback':afterCreateMessage},{'channel':_0x9473('0x10'),'model':'WhatsappInteraction','event':'afterCreate','condition':_0x9473('0x8'),'callback':afterCreate},{'channel':'Whatsapp','model':_0x9473('0x11'),'event':_0x9473('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x9473('0x10'),'model':_0x9473('0x12'),'event':_0x9473('0x7'),'condition':_0x9473('0xc'),'callback':afterCreateMessage},{'channel':'Fax','model':'FaxInteraction','event':_0x9473('0x7'),'condition':_0x9473('0x8'),'callback':afterCreate},{'channel':'Fax','model':_0x9473('0x13'),'event':_0x9473('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x9473('0x14'),'model':'FaxMessage','event':_0x9473('0x7'),'condition':_0x9473('0xc'),'callback':afterCreateMessage},{'channel':_0x9473('0x15'),'model':_0x9473('0x16'),'event':_0x9473('0x7'),'condition':_0x9473('0x8'),'callback':afterCreate},{'channel':_0x9473('0x15'),'model':'MailInteraction','event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x9473('0x15'),'model':_0x9473('0x17'),'event':_0x9473('0x7'),'condition':_0x9473('0xc'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0x9473('0x18'),'event':_0x9473('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x9473('0x19'),'model':'OpenchannelInteraction','event':_0x9473('0x9'),'condition':_0x9473('0xa'),'callback':afterUpdate},{'channel':_0x9473('0x19'),'model':_0x9473('0x1a'),'event':_0x9473('0x7'),'condition':_0x9473('0xc'),'callback':afterCreateMessage}];function request(_0x542231){return client['request'](_0x9473('0x1b'),_0x542231)[_0x9473('0x1c')](function(_0x5f5c41){logger[_0x9473('0x1d')](_0x9473('0x1e'),_0x9473('0x1b'),_0x5f5c41);if(_0x5f5c41[_0x9473('0x1f')]){if(_0x5f5c41[_0x9473('0x1f')][_0x9473('0x20')]===0x1f4){logger[_0x9473('0x1f')](_0x9473('0x1e'),'EventManager',_0x5f5c41[_0x9473('0x1f')]);}}})[_0x9473('0x21')](function(_0x5d33b2){logger[_0x9473('0x1f')](_0x9473('0x1e'),'EventManager',_0x5d33b2);});}function afterCreateMessage(_0x5a9c2f){return function(_0x59dea6){_0x59dea6=_0x59dea6[_0x9473('0x22')]({'plain':!![]});_0x59dea6[_0x9473('0x23')]=_0x5a9c2f;_0x59dea6['motionChannel']=_0x5a9c2f;_0x59dea6[_0x9473('0x24')]=_0x59dea6['direction'];Promise[_0x9473('0x25')]()[_0x9473('0x1c')](function(){if(typeof _0x59dea6[_0x9473('0x26')]===_0x9473('0x27'))return null;var _0x577e62=_0x9473('0x28')+_0x59dea6[_0x9473('0x26')];return db[_0x9473('0x29')][_0x9473('0x2a')](_0x577e62,{'type':db['Sequelize'][_0x9473('0x2b')][_0x9473('0x2c')],'raw':!![]});})[_0x9473('0x1c')](function(_0x3746e5){if(_0x3746e5){_0x59dea6[_0x9473('0x2d')]=_0x3746e5[0x0];}if(typeof _0x59dea6['UserId']===_0x9473('0x27'))return;return getAgent(_0x59dea6['UserId']);})[_0x9473('0x1c')](function(_0x25d21f){if(_0x25d21f){_0x59dea6[_0x9473('0x2e')]=util[_0x9473('0x2f')](_0x9473('0x30'),_0x25d21f[_0x9473('0x31')]);_0x59dea6[_0x9473('0x32')]=_0x25d21f;_0x59dea6[_0x9473('0x23')]=_0x5a9c2f;return request({'event':_0x9473('0x33'),'message':_0x59dea6});}else{return request({'event':_0x9473('0x34'),'message':_0x59dea6});}})['catch'](function(_0x3598d5){logger[_0x9473('0x1f')](_0x9473('0x1e'),_0x9473('0x35'),_0x3598d5);});};}function afterCreate(_0x151f4e,_0x2d027a){return function(_0x6208de){_0x6208de=_0x6208de['get']({'plain':!![]});_0x6208de[_0x9473('0x23')]=_0x151f4e;_0x6208de[_0x9473('0x36')]=_0x151f4e;_0x6208de[_0x9473('0x24')]='opened';Promise['resolve']()['then'](function(){var _0x30bda2=_0x9473('0x28')+_0x6208de['ContactId'];return db[_0x9473('0x29')][_0x9473('0x2a')](_0x30bda2,{'type':db['Sequelize'][_0x9473('0x2b')]['SELECT'],'raw':!![]});})[_0x9473('0x1c')](function(_0x129ed0){if(_0x129ed0){_0x6208de[_0x9473('0x2d')]=_0x129ed0[0x0];}if(typeof _0x6208de[_0x9473('0x37')]===_0x9473('0x27'))return;return getAgent(_0x6208de['UserId']);})[_0x9473('0x1c')](function(_0x84611a){if(_0x84611a){_0x6208de['interface']=util[_0x9473('0x2f')](_0x9473('0x30'),_0x84611a[_0x9473('0x31')]);_0x6208de[_0x9473('0x32')]=_0x84611a;}return request({'event':_0x2d027a,'message':_0x6208de});})['catch'](function(_0x5d902b){logger[_0x9473('0x1f')]('Trigger,\x20%s','AfterCreate',_0x5d902b);});};}function afterUpdate(_0x3442d4){return function(_0x25ced2){var _0xc0d43=_0x25ced2[_0x9473('0x38')](_0x9473('0x39'))&&_0x25ced2[_0x9473('0x39')];var _0x58fd18=_0x25ced2[_0x9473('0x38')]('substatus');if(_0xc0d43||_0x58fd18){var _0x47b2a6=_0xc0d43?_0x9473('0xa'):'substatus';var _0x247688=_0x25ced2[_0x9473('0x22')]({'plain':!![]});_0x247688[_0x9473('0x23')]=_0x3442d4;_0x247688[_0x9473('0x36')]=_0x3442d4;_0x247688[_0x9473('0x24')]=_0xc0d43?_0x9473('0x39'):_0x9473('0x3a');var _0x56253e=_0x9473('0x28')+_0x247688[_0x9473('0x26')];return db[_0x9473('0x29')]['query'](_0x56253e,{'type':db[_0x9473('0x3b')][_0x9473('0x2b')][_0x9473('0x2c')],'raw':!![]})[_0x9473('0x1c')](function(_0xa2d77c){if(_0xa2d77c){_0x247688[_0x9473('0x2d')]=_0xa2d77c[0x0];}if(typeof _0x247688[_0x9473('0x37')]===_0x9473('0x27'))return;return getAgent(_0x247688['UserId']);})[_0x9473('0x1c')](function(_0x4e2ad6){if(_0x4e2ad6){_0x247688[_0x9473('0x2e')]=util[_0x9473('0x2f')](_0x9473('0x30'),_0x4e2ad6[_0x9473('0x31')]);_0x247688[_0x9473('0x32')]=_0x4e2ad6;}return request({'event':_0x47b2a6,'message':_0x247688});})[_0x9473('0x21')](function(_0x2e76f9){logger[_0x9473('0x1f')](_0x9473('0x1e'),_0x9473('0x3c'),_0x2e76f9);});}};}function getAgent(_0x1d727f){return db[_0x9473('0x3d')][_0x9473('0x3e')]({'where':{'id':_0x1d727f},'attributes':['id',_0x9473('0x31'),_0x9473('0x3f'),_0x9473('0x40'),_0x9473('0x41')],'raw':!![]})[_0x9473('0x1c')](function(_0x439c80){return _0x439c80;});}exports[_0x9473('0x42')]=function(){for(var _0x8f5a4c=0x0;_0x8f5a4c=_0x294f9f[_0x68bf('0x12')]){throw Error(_0x68bf('0x13'));}_0xa8548c(_0x145d15);})['catch'](function(_0x3963c1){_0x95baa2(_0x3963c1);});});}; \ No newline at end of file +var _0xa372=['role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','mail','fax','whatsapp','openchannel','getChannels','isValidChannel','includes','isUndefined','blockedAt','updateAttributes','getLicense'];(function(_0x343dc1,_0x28ba24){var _0xa6722d=function(_0x405aa6){while(--_0x405aa6){_0x343dc1['push'](_0x343dc1['shift']());}};_0xa6722d(++_0x28ba24);}(_0xa372,0x110));var _0x2a37=function(_0x5339b7,_0x1adc31){_0x5339b7=_0x5339b7-0x0;var _0x3f737d=_0xa372[_0x5339b7];return _0x3f737d;};'use strict';var _=require(_0x2a37('0x0'));var BPromise=require(_0x2a37('0x1'));var db=require(_0x2a37('0x2'))['db'];var util=require(_0x2a37('0x3'));var channels=[_0x2a37('0x4'),_0x2a37('0x5'),'chat',_0x2a37('0x6'),'sms',_0x2a37('0x7'),_0x2a37('0x8')];exports[_0x2a37('0x9')]=function(){return channels;};exports[_0x2a37('0xa')]=function(_0x7cea95){_0x7cea95=_0x7cea95['toLowerCase']();return _[_0x2a37('0xb')](channels,_0x7cea95);};exports['clearBlockUser']=function(_0xaf1191,_0x1ec420,_0x4318de,_0x308ed9){var _0x51b4eb={'loginAttempts':_0x1ec420,'blocked':_0x4318de};if(!_[_0x2a37('0xc')](_0x308ed9)){_0x51b4eb[_0x2a37('0xd')]=_0x308ed9;}return _0xaf1191[_0x2a37('0xe')](_0x51b4eb);};exports[_0x2a37('0xf')]=function(_0x23a919){return new BPromise(function(_0x381cf2,_0x401db7){var _0x3fbc7e=0x0;if(_0x23a919[_0x2a37('0x10')]!==_0x2a37('0x11')){_0x381cf2(_0x23a919);}db[_0x2a37('0x12')][_0x2a37('0x13')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x23a919['id']}}})[_0x2a37('0x14')](function(_0x5135b4){_0x3fbc7e=_0x5135b4;return util[_0x2a37('0xf')]();})[_0x2a37('0x14')](function(_0x39e80e){if(_0x39e80e&&_0x39e80e[_0x2a37('0x15')]&&_0x3fbc7e>=_0x39e80e[_0x2a37('0x15')]){throw Error(_0x2a37('0x16'));}_0x381cf2(_0x23a919);})[_0x2a37('0x17')](function(_0x1d0f8f){_0x401db7(_0x1d0f8f);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 2b2df3e..1a084d7 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x73e4=['404','status','json','send','exports'];(function(_0x42080f,_0x5c0930){var _0x32e0d1=function(_0x40c477){while(--_0x40c477){_0x42080f['push'](_0x42080f['shift']());}};_0x32e0d1(++_0x5c0930);}(_0x73e4,0x149));var _0x473e=function(_0x5d88c0,_0x5d7d83){_0x5d88c0=_0x5d88c0-0x0;var _0x1b40f0=_0x73e4[_0x5d88c0];return _0x1b40f0;};'use strict';module[_0x473e('0x0')][0x194]=function pageNotFound(_0x56baa8,_0x16794a){var _0x3aef40=_0x473e('0x1');var _0x576a7b=0x194;var _0x466257={'status':_0x576a7b};_0x16794a[_0x473e('0x2')](_0x466257[_0x473e('0x2')]);_0x16794a['render'](_0x3aef40,{},function(_0x243cce,_0x25947a){if(_0x243cce){return _0x16794a[_0x473e('0x2')](_0x466257['status'])[_0x473e('0x3')](_0x466257);}_0x16794a[_0x473e('0x4')](_0x25947a);});}; \ No newline at end of file +var _0x24dd=['exports','404','status','render','json','send'];(function(_0x5dc4c5,_0x591a75){var _0x359954=function(_0x107cf3){while(--_0x107cf3){_0x5dc4c5['push'](_0x5dc4c5['shift']());}};_0x359954(++_0x591a75);}(_0x24dd,0x84));var _0xd24d=function(_0x532112,_0x37d94b){_0x532112=_0x532112-0x0;var _0x23e5fb=_0x24dd[_0x532112];return _0x23e5fb;};'use strict';module[_0xd24d('0x0')][0x194]=function pageNotFound(_0x46079a,_0x4b90a1){var _0x326d6c=_0xd24d('0x1');var _0x3fab58=0x194;var _0xd8a7a3={'status':_0x3fab58};_0x4b90a1[_0xd24d('0x2')](_0xd8a7a3['status']);_0x4b90a1[_0xd24d('0x3')](_0x326d6c,{},function(_0x14c749,_0x5d0924){if(_0x14c749){return _0x4b90a1[_0xd24d('0x2')](_0xd8a7a3['status'])[_0xd24d('0x4')](_0xd8a7a3);}_0x4b90a1[_0xd24d('0x5')](_0x5d0924);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index c46e580..3d363e7 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','hasOne','cascade','UserId','User','hasMany','Extensions','HopperFinals','OpenchannelInteractions','ChatInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotification','UserNotifications','SenderId','userProfileId','belongsToMany','Groups','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','ChatInteraction','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','UserVoicePrefix','MailQueues','UserFaxQueue','UserSmsQueue','OpenchannelQueues','WhatsappQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','SpiedAgents','ChanSpyId','Sounds','moh_has_sounds','Members','VoiceQueue','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','Trunk','TrunkBackup','TrunkBackupId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceQueueReport','QueueCalls','uniqueid','AgentReports','ContactId','MailAccountId','MailServerOut','Smtp','Disposition','Dispositions','Answers','Interactions','Applications','List','ListId','TemplateId','mandatoryDispositionPause','team_has_mail_queues','MailInteractionId','Account','Contact','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','IntervalId','TagId','Items','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','FaxMessage','team_has_fax_queues','SmsAccountId','SmsApplication','mandatoryDispositionPauseId','Interval','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','team_has_openchannel_queues','ProactiveActions','OpenchannelQueueReport','Agent','Website','chat_interaction_has_tags','ChatInteractionId','ChatQueue','ChatGroupId','chat_group_has_users','CompanyId','Company','cm_contact_has_tags','Queue','CampaignId','OwnerId','All','OneAll','AutomationAllId','AutomationAnyId','Action','Actions','ParentId','MailApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','VariableId','SugarcrmField','Field','DeskField','int_desk_configuration_has_tags','ZohoAccount','ZohoField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowAccount','Dynamics365Field','FreshsalesConfiguration','FreshsalesField','FromId','ToId','JscriptyQuestionReport','SessionId','ProjectId','team_has_chat_queues','ChatQueues','FaxQueues','team_has_whatsapp_queues','TrunkId','SquareProjectId','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromAccount','ToAgent','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','HopperHistory','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','exports','sequelize','lodash','defaultsDeep','motion2','xcall','127.0.0.1','mysql','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','utf8mb4','name','database','username','password','options','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','CannedAnswer','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Template','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','Setting','../api/squareOdbc/squareOdbc.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','Campaign','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model'];(function(_0x342681,_0x232df9){var _0x24b513=function(_0x183d0c){while(--_0x183d0c){_0x342681['push'](_0x342681['shift']());}};_0x24b513(++_0x232df9);}(_0xda3f,0xec));var _0xfda3=function(_0x31612c,_0x552ef4){_0x31612c=_0x31612c-0x0;var _0x40dbf3=_0xda3f[_0x31612c];return _0x40dbf3;};'use strict';var config=require('../config/environment');var Sequelize=require(_0xfda3('0x0'));var _=require(_0xfda3('0x1'));var jstz=require('jstz');var timezone=jstz['determine']();config['sequelize']=_[_0xfda3('0x2')](config['sequelize'],{'database':_0xfda3('0x3'),'username':_0xfda3('0x4'),'password':'xC@LL1234','options':{'host':_0xfda3('0x5'),'port':0xcea,'dialect':_0xfda3('0x6'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xfda3('0x7'),'collate':_0xfda3('0x8')}}});config[_0xfda3('0x9')]=_[_0xfda3('0x2')](config[_0xfda3('0x9')],{'database':_0xfda3('0x3'),'username':_0xfda3('0x4'),'password':_0xfda3('0xa'),'options':{'host':_0xfda3('0x5'),'port':0xcea,'dialect':_0xfda3('0x6'),'dialectOptions':{'charset':_0xfda3('0xb')},'logging':![],'timezone':timezone[_0xfda3('0xc')](),'define':{'charset':'utf8','collate':_0xfda3('0x8')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xfda3('0x0')][_0xfda3('0xd')],config[_0xfda3('0x0')][_0xfda3('0xe')],config['sequelize'][_0xfda3('0xf')],config['sequelize'][_0xfda3('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xfda3('0x9')]['database'],config['sequelizeHistory']['username'],config[_0xfda3('0x9')][_0xfda3('0xf')],config['sequelizeHistory']['options'])};db['User']=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x12'));db[_0xfda3('0x13')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x14'));db[_0xfda3('0x15')]=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/voiceContext/voiceContext.model');db[_0xfda3('0x16')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x17'));db['VoiceMusicOnHold']=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x18'));db['VoiceQueue']=db['sequelize'][_0xfda3('0x11')](_0xfda3('0x19'));db[_0xfda3('0x1a')]=db['sequelize'][_0xfda3('0x11')](_0xfda3('0x1b'));db[_0xfda3('0x1c')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x1d'));db[_0xfda3('0x1e')]=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/voiceMail/voiceMail.model');db[_0xfda3('0x1f')]=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xfda3('0x20')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x21'));db[_0xfda3('0x22')]=db[_0xfda3('0x0')]['import'](_0xfda3('0x23'));db[_0xfda3('0x24')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x25'));db['VoiceQueueReport']=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x26'));db[_0xfda3('0x27')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x28'));db['Trunk']=db['sequelize'][_0xfda3('0x11')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x29'));db[_0xfda3('0x2a')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x2b'));db[_0xfda3('0x2c')]=db[_0xfda3('0x0')]['import'](_0xfda3('0x2d'));db[_0xfda3('0x2e')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x2f'));db[_0xfda3('0x30')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x31'));db['UserFaxQueue']=db['sequelize'][_0xfda3('0x11')](_0xfda3('0x32'));db['UserSmsQueue']=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x33'));db['UserOpenchannelQueue']=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x34'));db[_0xfda3('0x35')]=db[_0xfda3('0x0')]['import'](_0xfda3('0x36'));db[_0xfda3('0x37')]=db[_0xfda3('0x0')]['import'](_0xfda3('0x38'));db['MailServerOut']=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x39'));db[_0xfda3('0x3a')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x3b'));db[_0xfda3('0x3c')]=db['sequelize'][_0xfda3('0x11')](_0xfda3('0x3d'));db[_0xfda3('0x3e')]=db[_0xfda3('0x0')]['import'](_0xfda3('0x3f'));db[_0xfda3('0x40')]=db[_0xfda3('0x0')]['import']('../api/mailInteraction/mailInteraction.model');db[_0xfda3('0x41')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x42'));db[_0xfda3('0x43')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x44'));db[_0xfda3('0x45')]=db[_0xfda3('0x0')]['import'](_0xfda3('0x46'));db[_0xfda3('0x47')]=db['sequelize'][_0xfda3('0x11')]('../api/dashboard/dashboard.model');db['DashboardItem']=db['sequelize'][_0xfda3('0x11')](_0xfda3('0x48'));db[_0xfda3('0x49')]=db[_0xfda3('0x0')]['import'](_0xfda3('0x4a'));db[_0xfda3('0x4b')]=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/faxApplication/faxApplication.model');db[_0xfda3('0x4c')]=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x4d'));db[_0xfda3('0x4e')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x4f'));db[_0xfda3('0x50')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x51'));db[_0xfda3('0x52')]=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x53'));db[_0xfda3('0x54')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x55'));db[_0xfda3('0x56')]=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/smsMessage/smsMessage.model');db[_0xfda3('0x57')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x58'));db[_0xfda3('0x59')]=db['sequelize'][_0xfda3('0x11')](_0xfda3('0x5a'));db[_0xfda3('0x5b')]=db['sequelize'][_0xfda3('0x11')](_0xfda3('0x5c'));db[_0xfda3('0x5d')]=db['sequelize'][_0xfda3('0x11')](_0xfda3('0x5e'));db[_0xfda3('0x5f')]=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/openchannelMessage/openchannelMessage.model');db[_0xfda3('0x60')]=db['sequelize'][_0xfda3('0x11')]('../api/openchannelQueue/openchannelQueue.model');db[_0xfda3('0x61')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x62'));db['OpenchannelQueueReport']=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x63'));db[_0xfda3('0x64')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x65'));db['ChatInteraction']=db['sequelize'][_0xfda3('0x11')](_0xfda3('0x66'));db[_0xfda3('0x67')]=db['sequelize']['import'](_0xfda3('0x68'));db[_0xfda3('0x69')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x6a'));db['ChatQueue']=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x6b'));db[_0xfda3('0x6c')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x6d'));db[_0xfda3('0x6e')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x6f'));db[_0xfda3('0x70')]=db['sequelize'][_0xfda3('0x11')](_0xfda3('0x71'));db[_0xfda3('0x72')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x73'));db[_0xfda3('0x74')]=db['sequelize']['import'](_0xfda3('0x75'));db[_0xfda3('0x76')]=db['sequelize'][_0xfda3('0x11')](_0xfda3('0x77'));db[_0xfda3('0x78')]=db[_0xfda3('0x0')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0xfda3('0x79')]=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0xfda3('0x7a')]=db['sequelize'][_0xfda3('0x11')](_0xfda3('0x7b'));db[_0xfda3('0x7c')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x7d'));db['Action']=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x7e'));db[_0xfda3('0x7f')]=db[_0xfda3('0x0')]['import']('../api/automation/automation.model');db[_0xfda3('0x80')]=db[_0xfda3('0x0')]['import']('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/disposition/disposition.model');db[_0xfda3('0x81')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x82'));db['Interval']=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x83'));db[_0xfda3('0x84')]=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/pause/pause.model');db['Cdr']=db[_0xfda3('0x0')]['import'](_0xfda3('0x85'));db[_0xfda3('0x86')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x87'));db[_0xfda3('0x88')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x89'));db[_0xfda3('0x8a')]=db['sequelize'][_0xfda3('0x11')]('../api/sound/sound.model');db['Tag']=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/tag/tag.model');db[_0xfda3('0x8b')]=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/template/template.model');db[_0xfda3('0x8c')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x8d'));db[_0xfda3('0x8e')]=db['sequelize']['import']('../api/variable/variable.model');db[_0xfda3('0x8f')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x90'));db[_0xfda3('0x91')]=db[_0xfda3('0x0')]['import'](_0xfda3('0x92'));db[_0xfda3('0x93')]=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0xfda3('0x94')]=db['sequelize'][_0xfda3('0x11')](_0xfda3('0x95'));db[_0xfda3('0x96')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x97'));db[_0xfda3('0x98')]=db['sequelize'][_0xfda3('0x11')](_0xfda3('0x99'));db[_0xfda3('0x9a')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x9b'));db['AnalyticTreeReport']=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x9c'));db[_0xfda3('0x9d')]=db[_0xfda3('0x0')]['import'](_0xfda3('0x9e'));db[_0xfda3('0x9f')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xa0'));db[_0xfda3('0xa1')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xa2'));db[_0xfda3('0xa3')]=db['sequelize'][_0xfda3('0x11')](_0xfda3('0xa4'));db[_0xfda3('0xa5')]=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db['SugarcrmField']=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xa6'));db[_0xfda3('0xa7')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xa8'));db[_0xfda3('0xa9')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xaa'));db['DeskField']=db[_0xfda3('0x0')]['import']('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db[_0xfda3('0x0')]['import'](_0xfda3('0xab'));db[_0xfda3('0xac')]=db['sequelize'][_0xfda3('0x11')](_0xfda3('0xad'));db['ZohoField']=db[_0xfda3('0x0')]['import'](_0xfda3('0xae'));db[_0xfda3('0xaf')]=db['sequelize'][_0xfda3('0x11')](_0xfda3('0xb0'));db[_0xfda3('0xb1')]=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xfda3('0xb2')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xb3'));db[_0xfda3('0xb4')]=db['sequelize']['import']('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xfda3('0xb5')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xb6'));db[_0xfda3('0xb7')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xb8'));db['VtigerAccount']=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xfda3('0xb9')]=db[_0xfda3('0x0')]['import'](_0xfda3('0xba'));db[_0xfda3('0xbb')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xbc'));db['ServicenowAccount']=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xbd'));db[_0xfda3('0xbe')]=db['sequelize'][_0xfda3('0x11')](_0xfda3('0xbf'));db[_0xfda3('0xc0')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xc1'));db[_0xfda3('0xc2')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xc3'));db[_0xfda3('0xc4')]=db['sequelize']['import'](_0xfda3('0xc5'));db['Dynamics365Field']=db[_0xfda3('0x0')]['import']('../api/intDynamics365Field/intDynamics365Field.model');db['FreshsalesAccount']=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db['sequelize']['import']('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0xfda3('0x0')]['import']('../api/intFreshsalesField/intFreshsalesField.model');db[_0xfda3('0x8f')]=db['sequelize']['import'](_0xfda3('0x90'));db[_0xfda3('0xc6')]=db[_0xfda3('0x0')]['import'](_0xfda3('0xc7'));db[_0xfda3('0xc8')]=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/chatQueueReport/chatQueueReport.model');db[_0xfda3('0xc9')]=db[_0xfda3('0x0')]['import'](_0xfda3('0xca'));db[_0xfda3('0xcb')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xcc'));db['JscriptyQuestionReport']=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xfda3('0xcd')]=db[_0xfda3('0x0')]['import'](_0xfda3('0xce'));db[_0xfda3('0xcf')]=db['sequelize']['import'](_0xfda3('0xd0'));db[_0xfda3('0xd1')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xd2'));db[_0xfda3('0xd3')]=db[_0xfda3('0x0')]['import']('../api/squareReportDetail/squareReportDetail.model');db[_0xfda3('0xd4')]=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/jscriptyProject/jscriptyProject.model');db[_0xfda3('0xd5')]=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/setting/setting.model');db['SquareOdbc']=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xd6'));db['SquareProject']=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/squareProject/squareProject.model');db[_0xfda3('0xd7')]=db[_0xfda3('0x0')]['import'](_0xfda3('0xd8'));db[_0xfda3('0xd9')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xda'));db[_0xfda3('0xdb')]=db[_0xfda3('0x0')]['import']('../api/team/team.model');db[_0xfda3('0xdc')]=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/license/license.model');db[_0xfda3('0xdd')]=db['sequelize']['import'](_0xfda3('0xde'));db[_0xfda3('0xdf')]=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/migration/migration.model');db[_0xfda3('0xe0')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xe1'));db['Plugin']=db['sequelize'][_0xfda3('0x11')](_0xfda3('0xe2'));db[_0xfda3('0xe3')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xe4'));db['ChatTransferReport']=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xe5'));db[_0xfda3('0xe6')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xe7'));db['OpenchannelTransferReport']=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xe8'));db[_0xfda3('0xe9')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xea'));db[_0xfda3('0xeb')]=db['sequelize'][_0xfda3('0x11')](_0xfda3('0xec'));db[_0xfda3('0xed')]=db['sequelize'][_0xfda3('0x11')](_0xfda3('0xee'));db[_0xfda3('0xef')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xf0'));db[_0xfda3('0xf1')]=db['sequelize']['import'](_0xfda3('0xf2'));db[_0xfda3('0xf3')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xf4'));db['UserNotification']=db['sequelize'][_0xfda3('0x11')]('../api/userNotification/userNotification.model');db[_0xfda3('0xf5')]=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xf6'));db[_0xfda3('0xf7')]=db[_0xfda3('0x0')]['import']('../api/whatsappApplication/whatsappApplication.model');db[_0xfda3('0xf8')]=db[_0xfda3('0x0')]['import'](_0xfda3('0xf9'));db[_0xfda3('0xfa')]=db['sequelize'][_0xfda3('0x11')]('../api/whatsappMessage/whatsappMessage.model');db[_0xfda3('0xfb')]=db[_0xfda3('0x0')]['import'](_0xfda3('0xfc'));db[_0xfda3('0xfd')]=db['sequelize'][_0xfda3('0x11')](_0xfda3('0xfe'));db['WhatsappQueue']=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0xff'));db[_0xfda3('0x100')]=db[_0xfda3('0x0')][_0xfda3('0x11')]('../api/cloudProvider/cloudProvider.model');db[_0xfda3('0x101')]=db[_0xfda3('0x0')]['import']('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0xfda3('0x102')]=db['sequelize']['import'](_0xfda3('0x103'));db['UserVoicePrefix']=db[_0xfda3('0x0')][_0xfda3('0x11')](_0xfda3('0x104'));db['User'][_0xfda3('0x105')](db['VoiceMail'],{'as':'VoiceMail','onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x107')});db[_0xfda3('0x108')][_0xfda3('0x109')](db[_0xfda3('0x1a')],{'as':'Recordings','foreignKey':_0xfda3('0x107')});db[_0xfda3('0x108')]['hasMany'](db[_0xfda3('0x2a')],{'as':'VoiceQueuesRt','foreignKey':_0xfda3('0x107')});db[_0xfda3('0x108')][_0xfda3('0x109')](db['VoiceExtension'],{'as':_0xfda3('0x10a'),'onDelete':'cascade','hooks':!![]});db['User'][_0xfda3('0x109')](db[_0xfda3('0x78')],{'as':_0xfda3('0x10b'),'foreignKey':'UserId'});db[_0xfda3('0x108')][_0xfda3('0x109')](db[_0xfda3('0x79')],{'as':'HopperHistory','foreignKey':_0xfda3('0x107')});db['User'][_0xfda3('0x109')](db[_0xfda3('0x7a')],{'as':_0xfda3('0x7a'),'foreignKey':_0xfda3('0x107')});db['User'][_0xfda3('0x109')](db['OpenchannelInteraction'],{'as':_0xfda3('0x10c'),'foreignKey':_0xfda3('0x107')});db[_0xfda3('0x108')]['hasMany'](db['ChatInteraction'],{'as':_0xfda3('0x10d'),'foreignKey':_0xfda3('0x107')});db[_0xfda3('0x108')][_0xfda3('0x109')](db[_0xfda3('0x54')],{'as':'SmsInteractions','foreignKey':'UserId'});db[_0xfda3('0x108')][_0xfda3('0x109')](db['FaxInteraction'],{'as':_0xfda3('0x10e'),'foreignKey':_0xfda3('0x107')});db[_0xfda3('0x108')][_0xfda3('0x109')](db[_0xfda3('0x40')],{'as':_0xfda3('0x10f'),'foreignKey':_0xfda3('0x107')});db[_0xfda3('0x108')][_0xfda3('0x109')](db['WhatsappInteraction'],{'as':_0xfda3('0x110'),'foreignKey':_0xfda3('0x107')});db[_0xfda3('0x108')]['hasMany'](db[_0xfda3('0x111')],{'as':_0xfda3('0x112'),'foreignKey':_0xfda3('0x113')});db[_0xfda3('0x108')]['belongsTo'](db['UserProfile'],{'as':'UserProfile','foreignKey':_0xfda3('0x114')});db[_0xfda3('0x108')][_0xfda3('0x115')](db[_0xfda3('0x6c')],{'as':_0xfda3('0x116'),'through':'chat_group_has_users'});db['User']['belongsToMany'](db[_0xfda3('0x72')],{'as':_0xfda3('0x117'),'through':_0xfda3('0x118')});db[_0xfda3('0x108')][_0xfda3('0x115')](db[_0xfda3('0xeb')],{'as':_0xfda3('0x119'),'through':_0xfda3('0x11a')});db[_0xfda3('0x108')][_0xfda3('0x115')](db[_0xfda3('0xdb')],{'through':'user_has_teams'});db[_0xfda3('0x108')][_0xfda3('0x115')](db[_0xfda3('0x40')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db[_0xfda3('0x108')][_0xfda3('0x115')](db[_0xfda3('0x11b')],{'as':'ChatInteractions','through':_0xfda3('0x11c')});db[_0xfda3('0x108')]['belongsToMany'](db['FaxInteraction'],{'as':_0xfda3('0x10e'),'through':_0xfda3('0x11d')});db['User'][_0xfda3('0x115')](db[_0xfda3('0x54')],{'as':_0xfda3('0x11e'),'through':'user_has_sms_interactions'});db[_0xfda3('0x108')][_0xfda3('0x115')](db[_0xfda3('0x5d')],{'as':_0xfda3('0x10c'),'through':_0xfda3('0x11f')});db[_0xfda3('0x108')][_0xfda3('0x115')](db['WhatsappInteraction'],{'as':_0xfda3('0x110'),'through':_0xfda3('0x120')});db[_0xfda3('0x108')][_0xfda3('0x115')](db['VoiceQueue'],{'as':_0xfda3('0x121'),'through':_0xfda3('0x2c'),'required':![]});db['User']['belongsToMany'](db[_0xfda3('0xed')],{'as':_0xfda3('0x122'),'through':_0xfda3('0x123'),'required':![]});db['User'][_0xfda3('0x115')](db[_0xfda3('0x3c')],{'as':_0xfda3('0x124'),'through':'UserMailQueue','required':![]});db[_0xfda3('0x108')]['belongsToMany'](db['ChatQueue'],{'as':'ChatQueues','through':_0xfda3('0x2e'),'required':![],'hooks':!![]});db[_0xfda3('0x108')][_0xfda3('0x115')](db[_0xfda3('0x4e')],{'as':'FaxQueues','through':_0xfda3('0x125'),'required':![]});db[_0xfda3('0x108')]['belongsToMany'](db[_0xfda3('0x57')],{'as':'SmsQueues','through':_0xfda3('0x126'),'required':![]});db[_0xfda3('0x108')][_0xfda3('0x115')](db[_0xfda3('0x60')],{'as':_0xfda3('0x127'),'through':'UserOpenchannelQueue','required':![]});db[_0xfda3('0x108')][_0xfda3('0x115')](db[_0xfda3('0x128')],{'as':_0xfda3('0x129'),'through':'UserWhatsappQueue','required':![]});db[_0xfda3('0x108')][_0xfda3('0x115')](db[_0xfda3('0xeb')],{'through':_0xfda3('0x11a')});db[_0xfda3('0x108')]['belongsToMany'](db[_0xfda3('0x61')],{'as':_0xfda3('0x12a'),'through':_0xfda3('0x12b')});db['User']['belongsToMany'](db[_0xfda3('0x49')],{'as':_0xfda3('0x12c'),'through':_0xfda3('0x12d')});db[_0xfda3('0x108')]['belongsToMany'](db[_0xfda3('0x3a')],{'as':_0xfda3('0x12e'),'through':_0xfda3('0x12f')});db[_0xfda3('0x108')][_0xfda3('0x115')](db[_0xfda3('0x59')],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db[_0xfda3('0x108')][_0xfda3('0x115')](db['SmsAccount'],{'as':_0xfda3('0x130'),'through':_0xfda3('0x131')});db[_0xfda3('0x108')][_0xfda3('0x115')](db[_0xfda3('0xf5')],{'as':_0xfda3('0x132'),'through':_0xfda3('0x133')});db[_0xfda3('0x108')]['belongsToMany'](db[_0xfda3('0x134')],{'as':_0xfda3('0x135'),'through':'user_has_square_projects'});db['VoiceChanSpy'][_0xfda3('0x109')](db[_0xfda3('0x16')],{'as':_0xfda3('0x136'),'onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x137')});db['VoiceContext'][_0xfda3('0x109')](db[_0xfda3('0x16')],{'onDelete':'cascade'});db['VoiceExtension'][_0xfda3('0x109')](db['VoiceExtension'],{'as':'Applications','onDelete':_0xfda3('0x106')});db['VoiceMusicOnHold']['belongsToMany'](db[_0xfda3('0x8a')],{'as':_0xfda3('0x138'),'through':_0xfda3('0x139')});db['VoiceQueue']['hasMany'](db[_0xfda3('0x2a')],{'as':_0xfda3('0x13a'),'foreignKey':'VoiceQueueId'});db[_0xfda3('0x13b')][_0xfda3('0x109')](db[_0xfda3('0x74')],{'as':_0xfda3('0x13c'),'foreignKey':_0xfda3('0x13d')});db[_0xfda3('0x13b')]['hasMany'](db[_0xfda3('0x78')],{'as':'HopperFinals','foreignKey':_0xfda3('0x13d')});db[_0xfda3('0x13b')][_0xfda3('0x109')](db[_0xfda3('0x79')],{'as':_0xfda3('0x13e'),'foreignKey':_0xfda3('0x13d')});db['VoiceQueue'][_0xfda3('0x109')](db[_0xfda3('0x7a')],{'as':_0xfda3('0x7a'),'foreignKey':_0xfda3('0x13d')});db[_0xfda3('0x13b')][_0xfda3('0x109')](db[_0xfda3('0x76')],{'as':_0xfda3('0x13f'),'foreignKey':_0xfda3('0x13d')});db[_0xfda3('0x13b')][_0xfda3('0x109')](db['JscriptySessionReport'],{'as':_0xfda3('0x140'),'foreignKey':_0xfda3('0x13d')});db[_0xfda3('0x13b')][_0xfda3('0x141')](db[_0xfda3('0x142')],{'as':_0xfda3('0x142'),'foreignKey':'TrunkId'});db[_0xfda3('0x13b')][_0xfda3('0x141')](db[_0xfda3('0x142')],{'as':_0xfda3('0x143'),'foreignKey':_0xfda3('0x144')});db['VoiceQueue']['belongsTo'](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db[_0xfda3('0x13b')]['belongsTo'](db[_0xfda3('0x84')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xfda3('0x13b')][_0xfda3('0x115')](db[_0xfda3('0xeb')],{'as':_0xfda3('0x119'),'through':_0xfda3('0x145')});db[_0xfda3('0x13b')][_0xfda3('0x115')](db[_0xfda3('0x108')],{'as':_0xfda3('0x146'),'through':_0xfda3('0x2c')});db['VoiceQueue'][_0xfda3('0x115')](db[_0xfda3('0xdb')],{'as':_0xfda3('0x147'),'through':_0xfda3('0x101')});db['VoiceQueue'][_0xfda3('0x115')](db[_0xfda3('0xeb')],{'as':_0xfda3('0x148'),'through':_0xfda3('0x149')});db[_0xfda3('0x1a')][_0xfda3('0x141')](db[_0xfda3('0x108')],{'as':'User','foreignKey':_0xfda3('0x107')});db[_0xfda3('0x1c')][_0xfda3('0x141')](db[_0xfda3('0x108')],{'as':_0xfda3('0x108'),'foreignKey':_0xfda3('0x107')});db[_0xfda3('0x1e')][_0xfda3('0x109')](db[_0xfda3('0x1f')],{'as':_0xfda3('0x14a'),'onDelete':_0xfda3('0x106'),'foreignKey':'mailboxuser','sourceKey':_0xfda3('0x14b')});db[_0xfda3('0x1f')][_0xfda3('0x141')](db[_0xfda3('0x1e')],{'foreignKey':_0xfda3('0x14c'),'targetKey':'mailbox'});db[_0xfda3('0x20')]['hasMany'](db[_0xfda3('0x14d')],{'as':_0xfda3('0x14e'),'foreignKey':_0xfda3('0x14f'),'constraints':![]});db['VoiceCallReport']['hasMany'](db[_0xfda3('0x24')],{'as':_0xfda3('0x150'),'foreignKey':_0xfda3('0x14f'),'constraints':![]});db[_0xfda3('0x20')]['belongsTo'](db[_0xfda3('0x108')],{'as':'User','foreignKey':_0xfda3('0x107')});db[_0xfda3('0x20')][_0xfda3('0x141')](db[_0xfda3('0x72')],{'as':'Contact','foreignKey':_0xfda3('0x151')});db[_0xfda3('0x37')][_0xfda3('0x141')](db[_0xfda3('0x3a')],{'as':_0xfda3('0x3a'),'foreignKey':_0xfda3('0x152')});db[_0xfda3('0x153')][_0xfda3('0x141')](db[_0xfda3('0x3a')],{'as':_0xfda3('0x3a'),'foreignKey':'MailAccountId'});db['MailAccount'][_0xfda3('0x105')](db['MailServerIn'],{'as':'Imap','onDelete':_0xfda3('0x106')});db['MailAccount'][_0xfda3('0x105')](db['MailServerOut'],{'as':_0xfda3('0x154'),'onDelete':'cascade'});db[_0xfda3('0x3a')]['hasMany'](db[_0xfda3('0x155')],{'as':_0xfda3('0x156'),'foreignKey':_0xfda3('0x152'),'onDelete':_0xfda3('0x106')});db[_0xfda3('0x3a')][_0xfda3('0x109')](db[_0xfda3('0x80')],{'as':_0xfda3('0x157'),'foreignKey':_0xfda3('0x152')});db[_0xfda3('0x3a')][_0xfda3('0x109')](db[_0xfda3('0x41')],{'as':_0xfda3('0x14a'),'foreignKey':'MailAccountId'});db[_0xfda3('0x3a')][_0xfda3('0x109')](db[_0xfda3('0x40')],{'as':_0xfda3('0x158')});db[_0xfda3('0x3a')][_0xfda3('0x109')](db[_0xfda3('0x43')],{'as':_0xfda3('0x159')});db[_0xfda3('0x3a')][_0xfda3('0x141')](db[_0xfda3('0xeb')],{'as':_0xfda3('0x15a'),'foreignKey':_0xfda3('0x15b')});db['MailAccount'][_0xfda3('0x141')](db['Template'],{'as':'Template','foreignKey':_0xfda3('0x15c')});db['MailAccount'][_0xfda3('0x141')](db['Pause'],{'as':_0xfda3('0x15d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xfda3('0x3a')][_0xfda3('0x115')](db[_0xfda3('0x108')],{'as':'Agents','through':_0xfda3('0x12f')});db[_0xfda3('0x3c')]['belongsToMany'](db['User'],{'as':_0xfda3('0x146'),'through':_0xfda3('0x30')});db[_0xfda3('0x3c')][_0xfda3('0x115')](db[_0xfda3('0xdb')],{'through':_0xfda3('0x15e'),'as':_0xfda3('0x147')});db['MailInteraction'][_0xfda3('0x109')](db[_0xfda3('0x41')],{'as':'Messages','onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x15f')});db[_0xfda3('0x40')][_0xfda3('0x141')](db[_0xfda3('0x3a')],{'as':_0xfda3('0x160'),'foreignKey':_0xfda3('0x152')});db[_0xfda3('0x40')][_0xfda3('0x141')](db[_0xfda3('0x72')],{'as':_0xfda3('0x161'),'foreignKey':_0xfda3('0x151')});db[_0xfda3('0x40')]['belongsTo'](db[_0xfda3('0x108')],{'as':_0xfda3('0x162'),'foreignKey':'UserId'});db[_0xfda3('0x40')][_0xfda3('0x115')](db[_0xfda3('0x163')],{'through':_0xfda3('0x164'),'as':_0xfda3('0x165')});db['MailInteraction']['belongsToMany'](db[_0xfda3('0x163')],{'through':_0xfda3('0x164'),'as':_0xfda3('0x166')});db['MailInteraction']['belongsToMany'](db[_0xfda3('0x108')],{'as':_0xfda3('0x167'),'through':_0xfda3('0x168'),'foreignKey':_0xfda3('0x15f')});db[_0xfda3('0x41')][_0xfda3('0x109')](db['Attachment'],{'as':_0xfda3('0x169'),'onDelete':_0xfda3('0x106')});db[_0xfda3('0x41')]['belongsTo'](db[_0xfda3('0x108')],{'as':'User'});db[_0xfda3('0x41')]['belongsTo'](db[_0xfda3('0x72')],{'onDelete':_0xfda3('0x106'),'as':_0xfda3('0x161')});db[_0xfda3('0x41')][_0xfda3('0x141')](db[_0xfda3('0x40')],{'as':_0xfda3('0x16a'),'foreignKey':_0xfda3('0x15f')});db[_0xfda3('0x41')][_0xfda3('0x141')](db['MailAccount'],{'as':_0xfda3('0x160'),'foreignKey':_0xfda3('0x152')});db[_0xfda3('0x41')][_0xfda3('0x141')](db[_0xfda3('0x61')],{'as':_0xfda3('0x61'),'foreignKey':_0xfda3('0x16b')});db[_0xfda3('0x41')]['belongsTo'](db[_0xfda3('0x69')],{'as':_0xfda3('0x69'),'foreignKey':_0xfda3('0x16c')});db[_0xfda3('0x43')][_0xfda3('0x141')](db[_0xfda3('0x108')],{'onDelete':'restrict'});db[_0xfda3('0x43')][_0xfda3('0x141')](db['MailQueue'],{'onDelete':_0xfda3('0x16d')});db[_0xfda3('0x43')][_0xfda3('0x141')](db['MailAccount'],{'onDelete':_0xfda3('0x16d')});db[_0xfda3('0x43')][_0xfda3('0x141')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xfda3('0x16e')});db[_0xfda3('0x43')][_0xfda3('0x141')](db[_0xfda3('0x163')],{'onDelete':'restrict','foreignKey':_0xfda3('0x16f')});db[_0xfda3('0x45')][_0xfda3('0x141')](db['MailAccount'],{});db[_0xfda3('0x45')][_0xfda3('0x141')](db[_0xfda3('0xeb')],{'as':_0xfda3('0x15a'),'foreignKey':_0xfda3('0x15b')});db[_0xfda3('0x45')]['belongsTo'](db[_0xfda3('0x72')],{'as':_0xfda3('0x161'),'foreignKey':'ContactId'});db['MailQueueReport'][_0xfda3('0x141')](db[_0xfda3('0x40')],{});db[_0xfda3('0x45')][_0xfda3('0x141')](db[_0xfda3('0x41')],{});db[_0xfda3('0x45')][_0xfda3('0x141')](db[_0xfda3('0x108')],{});db['MailQueueReport'][_0xfda3('0x141')](db['MailQueue'],{});db[_0xfda3('0x47')][_0xfda3('0x109')](db['DashboardItem'],{'as':_0xfda3('0x170'),'onDelete':_0xfda3('0x106')});db[_0xfda3('0x49')][_0xfda3('0x109')](db[_0xfda3('0x155')],{'as':'Dispositions','foreignKey':_0xfda3('0x171'),'onDelete':_0xfda3('0x106')});db[_0xfda3('0x49')]['hasMany'](db['CannedAnswer'],{'as':_0xfda3('0x157'),'foreignKey':_0xfda3('0x171')});db[_0xfda3('0x49')]['hasMany'](db[_0xfda3('0x4c')],{'as':_0xfda3('0x158')});db[_0xfda3('0x49')][_0xfda3('0x109')](db[_0xfda3('0x4b')],{'as':'Applications'});db[_0xfda3('0x49')]['hasMany'](db['VoiceExtension'],{'as':_0xfda3('0x172'),'onDelete':_0xfda3('0x106')});db[_0xfda3('0x49')][_0xfda3('0x109')](db['FaxMessage'],{'as':_0xfda3('0x14a')});db[_0xfda3('0x49')][_0xfda3('0x141')](db['Trunk'],{'as':'Trunk'});db[_0xfda3('0x49')][_0xfda3('0x141')](db[_0xfda3('0xeb')],{'as':'List','foreignKey':_0xfda3('0x15b')});db['FaxAccount']['belongsTo'](db[_0xfda3('0x84')],{'as':_0xfda3('0x15d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xfda3('0x49')][_0xfda3('0x115')](db['User'],{'as':_0xfda3('0x146'),'through':_0xfda3('0x12d')});db[_0xfda3('0x4b')][_0xfda3('0x141')](db[_0xfda3('0x108')],{'onDelete':_0xfda3('0x16d')});db[_0xfda3('0x4b')][_0xfda3('0x141')](db['FaxQueue'],{'onDelete':_0xfda3('0x16d')});db[_0xfda3('0x4b')][_0xfda3('0x141')](db[_0xfda3('0x49')],{'onDelete':_0xfda3('0x16d')});db[_0xfda3('0x4b')][_0xfda3('0x141')](db['Tag'],{'onDelete':_0xfda3('0x16d'),'foreignKey':_0xfda3('0x16f')});db[_0xfda3('0x4c')]['hasMany'](db['FaxMessage'],{'as':_0xfda3('0x14a'),'onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x173')});db[_0xfda3('0x4c')][_0xfda3('0x141')](db['FaxAccount'],{'as':'Account','foreignKey':_0xfda3('0x171')});db['FaxInteraction']['belongsTo'](db[_0xfda3('0x72')],{'as':'Contact','foreignKey':_0xfda3('0x151')});db[_0xfda3('0x4c')][_0xfda3('0x141')](db[_0xfda3('0x108')],{'as':'Owner','foreignKey':'UserId'});db['FaxInteraction'][_0xfda3('0x115')](db[_0xfda3('0x163')],{'through':_0xfda3('0x174'),'as':_0xfda3('0x165')});db[_0xfda3('0x4c')][_0xfda3('0x115')](db['Tag'],{'through':_0xfda3('0x174'),'as':_0xfda3('0x166')});db[_0xfda3('0x4c')][_0xfda3('0x115')](db[_0xfda3('0x108')],{'as':_0xfda3('0x167'),'through':_0xfda3('0x11d'),'foreignKey':_0xfda3('0x173')});db[_0xfda3('0x175')]['belongsTo'](db[_0xfda3('0x108')],{'onDelete':_0xfda3('0x106'),'as':'User'});db[_0xfda3('0x175')][_0xfda3('0x141')](db[_0xfda3('0x4c')],{'as':_0xfda3('0x16a'),'foreignKey':_0xfda3('0x173')});db['FaxMessage']['belongsTo'](db[_0xfda3('0x72')],{'onDelete':'cascade','as':_0xfda3('0x161')});db['FaxMessage'][_0xfda3('0x141')](db[_0xfda3('0xe0')],{'as':_0xfda3('0xe0'),'foreignKey':'AttachmentId'});db[_0xfda3('0x175')]['belongsTo'](db['FaxAccount'],{'as':'Account','foreignKey':'FaxAccountId'});db[_0xfda3('0x4e')][_0xfda3('0x115')](db[_0xfda3('0x108')],{'as':_0xfda3('0x146'),'through':_0xfda3('0x125')});db[_0xfda3('0x4e')]['belongsToMany'](db[_0xfda3('0xdb')],{'through':_0xfda3('0x176'),'as':_0xfda3('0x147')});db[_0xfda3('0x50')][_0xfda3('0x141')](db[_0xfda3('0x49')],{});db[_0xfda3('0x50')][_0xfda3('0x141')](db[_0xfda3('0xeb')],{'as':'List','foreignKey':_0xfda3('0x15b')});db[_0xfda3('0x50')][_0xfda3('0x141')](db[_0xfda3('0x72')],{'as':_0xfda3('0x161'),'foreignKey':_0xfda3('0x151')});db[_0xfda3('0x50')][_0xfda3('0x141')](db[_0xfda3('0x4c')],{});db[_0xfda3('0x50')][_0xfda3('0x141')](db[_0xfda3('0x175')],{});db[_0xfda3('0x50')][_0xfda3('0x141')](db[_0xfda3('0x108')],{});db['FaxQueueReport'][_0xfda3('0x141')](db[_0xfda3('0x4e')],{});db[_0xfda3('0x52')]['hasMany'](db[_0xfda3('0x155')],{'as':_0xfda3('0x156'),'foreignKey':'SmsAccountId','onDelete':_0xfda3('0x106')});db[_0xfda3('0x52')][_0xfda3('0x109')](db[_0xfda3('0x80')],{'as':_0xfda3('0x157'),'foreignKey':'SmsAccountId'});db[_0xfda3('0x52')][_0xfda3('0x109')](db[_0xfda3('0x56')],{'as':_0xfda3('0x14a'),'foreignKey':_0xfda3('0x177')});db['SmsAccount'][_0xfda3('0x109')](db['SmsInteraction'],{'as':_0xfda3('0x158')});db['SmsAccount'][_0xfda3('0x109')](db[_0xfda3('0x178')],{'as':'Applications'});db['SmsAccount'][_0xfda3('0x141')](db[_0xfda3('0xeb')],{'as':_0xfda3('0x15a'),'foreignKey':_0xfda3('0x15b')});db[_0xfda3('0x52')][_0xfda3('0x141')](db[_0xfda3('0x84')],{'as':_0xfda3('0x15d'),'foreignKey':_0xfda3('0x179')});db['SmsAccount'][_0xfda3('0x115')](db[_0xfda3('0x108')],{'as':_0xfda3('0x146'),'through':'user_has_sms_accounts'});db[_0xfda3('0x178')][_0xfda3('0x141')](db[_0xfda3('0x108')],{'onDelete':_0xfda3('0x16d')});db[_0xfda3('0x178')]['belongsTo'](db[_0xfda3('0x57')],{'onDelete':_0xfda3('0x16d')});db['SmsApplication'][_0xfda3('0x141')](db['SmsAccount'],{'onDelete':'restrict'});db[_0xfda3('0x178')][_0xfda3('0x141')](db[_0xfda3('0x17a')],{'onDelete':_0xfda3('0x16d'),'foreignKey':'IntervalId'});db['SmsApplication'][_0xfda3('0x141')](db[_0xfda3('0x163')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xfda3('0x54')]['hasMany'](db[_0xfda3('0x56')],{'as':_0xfda3('0x14a'),'onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x17b')});db['SmsInteraction'][_0xfda3('0x141')](db[_0xfda3('0x52')],{'as':'Account','foreignKey':_0xfda3('0x177')});db[_0xfda3('0x54')][_0xfda3('0x141')](db['CmContact'],{'as':_0xfda3('0x161'),'foreignKey':_0xfda3('0x151')});db['SmsInteraction'][_0xfda3('0x141')](db[_0xfda3('0x108')],{'as':'Owner','foreignKey':_0xfda3('0x107')});db['SmsInteraction'][_0xfda3('0x115')](db[_0xfda3('0x163')],{'through':_0xfda3('0x17c'),'as':_0xfda3('0x165')});db[_0xfda3('0x54')][_0xfda3('0x115')](db['Tag'],{'through':_0xfda3('0x17c'),'as':_0xfda3('0x166')});db[_0xfda3('0x54')]['belongsToMany'](db['User'],{'as':_0xfda3('0x167'),'through':'user_has_sms_interactions','foreignKey':_0xfda3('0x17b')});db['SmsMessage'][_0xfda3('0x141')](db[_0xfda3('0x108')],{'as':_0xfda3('0x108')});db[_0xfda3('0x56')]['belongsTo'](db[_0xfda3('0x72')],{'onDelete':_0xfda3('0x106'),'as':_0xfda3('0x161')});db[_0xfda3('0x56')][_0xfda3('0x141')](db[_0xfda3('0x54')],{'onDelete':'cascade','as':_0xfda3('0x16a'),'foreignKey':_0xfda3('0x17b')});db['SmsMessage'][_0xfda3('0x141')](db[_0xfda3('0x52')],{'as':_0xfda3('0x160'),'foreignKey':'SmsAccountId'});db[_0xfda3('0x57')][_0xfda3('0x115')](db[_0xfda3('0x108')],{'as':_0xfda3('0x146'),'through':_0xfda3('0x126'),'foreignKey':'SmsQueueId'});db[_0xfda3('0x57')]['belongsToMany'](db['Team'],{'through':_0xfda3('0x17d'),'as':_0xfda3('0x147')});db['OpenchannelAccount'][_0xfda3('0x109')](db['Disposition'],{'as':_0xfda3('0x156'),'foreignKey':_0xfda3('0x17e'),'onDelete':_0xfda3('0x106')});db[_0xfda3('0x59')][_0xfda3('0x109')](db[_0xfda3('0x80')],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db[_0xfda3('0x59')][_0xfda3('0x109')](db[_0xfda3('0x5d')],{'as':_0xfda3('0x158'),'foreignKey':_0xfda3('0x17e')});db[_0xfda3('0x59')][_0xfda3('0x109')](db[_0xfda3('0x5f')],{'as':_0xfda3('0x14a'),'foreignKey':_0xfda3('0x17e')});db[_0xfda3('0x59')][_0xfda3('0x109')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xfda3('0x141')](db['CmList'],{'as':_0xfda3('0x15a'),'foreignKey':'ListId'});db[_0xfda3('0x59')][_0xfda3('0x141')](db[_0xfda3('0x84')],{'as':_0xfda3('0x15d'),'foreignKey':_0xfda3('0x179')});db['OpenchannelAccount']['belongsToMany'](db['User'],{'as':'Agents','through':_0xfda3('0x17f')});db[_0xfda3('0x5b')][_0xfda3('0x141')](db[_0xfda3('0x108')],{'onDelete':_0xfda3('0x16d')});db['OpenchannelApplication'][_0xfda3('0x141')](db[_0xfda3('0x60')],{'onDelete':_0xfda3('0x16d'),'foreignKey':_0xfda3('0x180')});db[_0xfda3('0x5b')]['belongsTo'](db[_0xfda3('0x59')],{'onDelete':_0xfda3('0x16d'),'foreignKey':_0xfda3('0x17e')});db['OpenchannelApplication'][_0xfda3('0x141')](db[_0xfda3('0x17a')],{'onDelete':'restrict','foreignKey':_0xfda3('0x16e')});db[_0xfda3('0x5b')]['belongsTo'](db[_0xfda3('0x163')],{'onDelete':_0xfda3('0x16d'),'foreignKey':_0xfda3('0x16f')});db['OpenchannelInteraction'][_0xfda3('0x109')](db[_0xfda3('0x5f')],{'as':'Messages','onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x181')});db['OpenchannelInteraction'][_0xfda3('0x141')](db['OpenchannelAccount'],{'as':_0xfda3('0x160'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction'][_0xfda3('0x141')](db[_0xfda3('0x72')],{'as':'Contact','foreignKey':_0xfda3('0x151')});db[_0xfda3('0x5d')][_0xfda3('0x141')](db[_0xfda3('0x108')],{'as':_0xfda3('0x162'),'foreignKey':'UserId'});db['OpenchannelInteraction'][_0xfda3('0x115')](db[_0xfda3('0x163')],{'through':_0xfda3('0x182'),'as':'Tags'});db['OpenchannelInteraction'][_0xfda3('0x115')](db[_0xfda3('0x163')],{'through':_0xfda3('0x182'),'as':'ThroughTags'});db[_0xfda3('0x5d')]['belongsToMany'](db[_0xfda3('0x108')],{'as':_0xfda3('0x167'),'through':_0xfda3('0x11f'),'foreignKey':_0xfda3('0x181')});db[_0xfda3('0x5f')]['belongsTo'](db[_0xfda3('0x108')],{'onDelete':'cascade','as':_0xfda3('0x108')});db[_0xfda3('0x5f')]['belongsTo'](db['CmContact'],{'onDelete':_0xfda3('0x106'),'as':_0xfda3('0x161')});db[_0xfda3('0x5f')]['belongsTo'](db[_0xfda3('0x5d')],{'onDelete':_0xfda3('0x106'),'as':_0xfda3('0x16a'),'foreignKey':_0xfda3('0x181')});db['OpenchannelMessage']['belongsTo'](db[_0xfda3('0xe0')],{'as':_0xfda3('0xe0'),'foreignKey':_0xfda3('0x183')});db[_0xfda3('0x5f')][_0xfda3('0x141')](db[_0xfda3('0x59')],{'as':'Account','foreignKey':_0xfda3('0x17e')});db[_0xfda3('0x60')][_0xfda3('0x115')](db[_0xfda3('0x108')],{'as':_0xfda3('0x146'),'through':'UserOpenchannelQueue','foreignKey':_0xfda3('0x180')});db[_0xfda3('0x60')][_0xfda3('0x115')](db['Team'],{'through':_0xfda3('0x184'),'as':'Teams'});db['ChatWebsite'][_0xfda3('0x109')](db[_0xfda3('0x155')],{'as':_0xfda3('0x156'),'foreignKey':_0xfda3('0x16b'),'onDelete':_0xfda3('0x106')});db[_0xfda3('0x61')][_0xfda3('0x109')](db[_0xfda3('0x80')],{'as':_0xfda3('0x157'),'foreignKey':_0xfda3('0x16b')});db[_0xfda3('0x61')][_0xfda3('0x109')](db[_0xfda3('0x6e')],{'as':_0xfda3('0x185')});db['ChatWebsite']['hasMany'](db[_0xfda3('0x11b')],{'as':_0xfda3('0x158')});db[_0xfda3('0x61')][_0xfda3('0x109')](db['ChatApplication'],{'as':_0xfda3('0x159')});db[_0xfda3('0x61')][_0xfda3('0x109')](db[_0xfda3('0x67')],{'as':_0xfda3('0x14a')});db[_0xfda3('0x61')][_0xfda3('0x141')](db['CmList'],{'as':_0xfda3('0x15a'),'foreignKey':_0xfda3('0x15b')});db[_0xfda3('0x61')][_0xfda3('0x141')](db['Interval'],{'as':_0xfda3('0x17a'),'foreignKey':_0xfda3('0x16e')});db[_0xfda3('0x61')][_0xfda3('0x141')](db[_0xfda3('0x3a')],{'as':'MailAccount','foreignKey':_0xfda3('0x152')});db[_0xfda3('0x61')]['belongsTo'](db[_0xfda3('0x84')],{'as':_0xfda3('0x15d'),'foreignKey':_0xfda3('0x179')});db[_0xfda3('0x61')][_0xfda3('0x115')](db[_0xfda3('0x108')],{'as':_0xfda3('0x146'),'through':_0xfda3('0x12b')});db['OpenchannelQueueReport'][_0xfda3('0x141')](db[_0xfda3('0x59')],{});db['OpenchannelQueueReport'][_0xfda3('0x141')](db[_0xfda3('0xeb')],{'as':'List','foreignKey':_0xfda3('0x15b')});db[_0xfda3('0x186')][_0xfda3('0x141')](db[_0xfda3('0x72')],{'as':_0xfda3('0x161'),'foreignKey':_0xfda3('0x151')});db[_0xfda3('0x186')]['belongsTo'](db[_0xfda3('0x5d')],{});db[_0xfda3('0x186')][_0xfda3('0x141')](db['OpenchannelMessage'],{});db[_0xfda3('0x186')][_0xfda3('0x141')](db[_0xfda3('0x108')],{});db[_0xfda3('0x186')]['belongsTo'](db[_0xfda3('0x60')],{});db[_0xfda3('0x64')][_0xfda3('0x141')](db[_0xfda3('0x108')],{'as':_0xfda3('0x187'),'foreignKey':_0xfda3('0x107'),'onDelete':'restrict'});db[_0xfda3('0x64')][_0xfda3('0x141')](db['ChatQueue'],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0xfda3('0x16d')});db[_0xfda3('0x64')][_0xfda3('0x141')](db['ChatWebsite'],{'as':_0xfda3('0x188'),'foreignKey':_0xfda3('0x16b'),'onDelete':_0xfda3('0x16d')});db[_0xfda3('0x64')][_0xfda3('0x141')](db[_0xfda3('0x163')],{'onDelete':_0xfda3('0x16d'),'foreignKey':_0xfda3('0x16f')});db[_0xfda3('0x11b')][_0xfda3('0x109')](db['ChatMessage'],{'as':_0xfda3('0x14a'),'onDelete':_0xfda3('0x106'),'foreignKey':'ChatInteractionId'});db[_0xfda3('0x11b')][_0xfda3('0x141')](db['ChatWebsite'],{'as':'Account','foreignKey':_0xfda3('0x16b')});db[_0xfda3('0x11b')][_0xfda3('0x141')](db[_0xfda3('0x72')],{'as':'Contact','foreignKey':'ContactId'});db[_0xfda3('0x11b')][_0xfda3('0x141')](db['User'],{'as':_0xfda3('0x162'),'foreignKey':_0xfda3('0x107')});db[_0xfda3('0x11b')][_0xfda3('0x115')](db[_0xfda3('0x163')],{'through':_0xfda3('0x189'),'as':_0xfda3('0x165')});db[_0xfda3('0x11b')][_0xfda3('0x115')](db[_0xfda3('0x163')],{'through':_0xfda3('0x189'),'as':_0xfda3('0x166')});db[_0xfda3('0x11b')][_0xfda3('0x115')](db['User'],{'as':_0xfda3('0x167'),'through':_0xfda3('0x11c'),'foreignKey':_0xfda3('0x18a')});db[_0xfda3('0x67')][_0xfda3('0x141')](db[_0xfda3('0x108')],{'onDelete':'cascade','as':_0xfda3('0x108')});db[_0xfda3('0x67')][_0xfda3('0x141')](db[_0xfda3('0x72')],{'onDelete':_0xfda3('0x106'),'as':_0xfda3('0x161'),'foreignKey':'ContactId'});db[_0xfda3('0x67')][_0xfda3('0x141')](db[_0xfda3('0x11b')],{'onDelete':_0xfda3('0x106'),'as':'Interaction','foreignKey':_0xfda3('0x18a')});db['ChatMessage'][_0xfda3('0x141')](db[_0xfda3('0xe0')],{'as':_0xfda3('0xe0'),'foreignKey':_0xfda3('0x183')});db['ChatMessage'][_0xfda3('0x141')](db[_0xfda3('0x61')],{'as':_0xfda3('0x160'),'foreignKey':_0xfda3('0x16b')});db[_0xfda3('0x69')][_0xfda3('0x109')](db[_0xfda3('0xe0')],{'as':'Attachments','foreignKey':_0xfda3('0x16c'),'onDelete':_0xfda3('0x106'),'hooks':!![]});db['ChatOfflineMessage'][_0xfda3('0x141')](db[_0xfda3('0x72')],{'onDelete':_0xfda3('0x106'),'as':_0xfda3('0x161'),'foreignKey':_0xfda3('0x151')});db['ChatOfflineMessage'][_0xfda3('0x141')](db['ChatWebsite'],{'as':_0xfda3('0x160'),'foreignKey':_0xfda3('0x16b')});db[_0xfda3('0x18b')][_0xfda3('0x115')](db[_0xfda3('0x108')],{'as':_0xfda3('0x146'),'through':'UserChatQueue','hooks':!![]});db[_0xfda3('0x18b')][_0xfda3('0x115')](db['Team'],{'through':'team_has_chat_queues','as':'Teams'});db[_0xfda3('0x6c')][_0xfda3('0x109')](db[_0xfda3('0xc9')],{'as':_0xfda3('0x14a'),'foreignKey':_0xfda3('0x18c'),'onDelete':_0xfda3('0x106')});db[_0xfda3('0x6c')][_0xfda3('0x115')](db[_0xfda3('0x108')],{'as':_0xfda3('0x13a'),'through':_0xfda3('0x18d')});db[_0xfda3('0x6e')][_0xfda3('0x141')](db['ChatWebsite'],{'as':'Website','foreignKey':_0xfda3('0x16b')});db[_0xfda3('0x70')][_0xfda3('0x109')](db[_0xfda3('0x72')],{'as':_0xfda3('0x117'),'foreignKey':_0xfda3('0x18e')});db[_0xfda3('0x72')][_0xfda3('0x109')](db[_0xfda3('0x74')],{'as':'Hoppers','foreignKey':'ContactId'});db[_0xfda3('0x72')][_0xfda3('0x109')](db[_0xfda3('0x78')],{'as':_0xfda3('0x10b'),'foreignKey':_0xfda3('0x151')});db[_0xfda3('0x72')][_0xfda3('0x109')](db[_0xfda3('0x79')],{'as':'HopperHistories','foreignKey':_0xfda3('0x151')});db[_0xfda3('0x72')][_0xfda3('0x109')](db[_0xfda3('0x7a')],{'as':_0xfda3('0x7a'),'foreignKey':'ContactId'});db[_0xfda3('0x72')][_0xfda3('0x109')](db[_0xfda3('0xcd')],{'as':'JscriptySessions','foreignKey':_0xfda3('0x151')});db[_0xfda3('0x72')][_0xfda3('0x109')](db[_0xfda3('0x5d')],{'as':_0xfda3('0x10c'),'foreignKey':_0xfda3('0x151'),'onDelete':_0xfda3('0x16d')});db['CmContact'][_0xfda3('0x109')](db[_0xfda3('0x11b')],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':_0xfda3('0x16d')});db[_0xfda3('0x72')]['hasMany'](db['SmsInteraction'],{'as':_0xfda3('0x11e'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xfda3('0x72')][_0xfda3('0x109')](db[_0xfda3('0x4c')],{'as':'FaxInteractions','foreignKey':_0xfda3('0x151'),'onDelete':_0xfda3('0x16d')});db[_0xfda3('0x72')]['hasMany'](db['MailInteraction'],{'as':_0xfda3('0x10f'),'foreignKey':_0xfda3('0x151'),'onDelete':_0xfda3('0x16d')});db[_0xfda3('0x72')]['belongsTo'](db[_0xfda3('0x70')],{'as':_0xfda3('0x18f'),'foreignKey':_0xfda3('0x18e')});db['CmContact']['belongsTo'](db['CmList'],{'as':_0xfda3('0x15a'),'foreignKey':_0xfda3('0x15b'),'onDelete':_0xfda3('0x106')});db['CmContact']['belongsToMany'](db['User'],{'as':_0xfda3('0x167'),'through':_0xfda3('0x118')});db[_0xfda3('0x72')]['belongsToMany'](db[_0xfda3('0x163')],{'as':_0xfda3('0x165'),'through':_0xfda3('0x190')});db[_0xfda3('0x72')][_0xfda3('0x115')](db[_0xfda3('0x163')],{'through':_0xfda3('0x190'),'as':'ThroughTags'});db['CmHopper'][_0xfda3('0x141')](db[_0xfda3('0x72')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0xfda3('0x106')});db[_0xfda3('0x74')]['belongsTo'](db[_0xfda3('0xeb')],{'as':'List','foreignKey':_0xfda3('0x15b'),'onDelete':_0xfda3('0x106')});db[_0xfda3('0x74')][_0xfda3('0x141')](db[_0xfda3('0x108')],{'as':_0xfda3('0x187'),'foreignKey':_0xfda3('0x107')});db['CmHopper'][_0xfda3('0x141')](db[_0xfda3('0x13b')],{'as':_0xfda3('0x191'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db['CmHopper'][_0xfda3('0x141')](db['Campaign'],{'as':'Campaign','foreignKey':_0xfda3('0x192'),'onDelete':'cascade'});db[_0xfda3('0x74')][_0xfda3('0x141')](db['User'],{'as':'Owner','foreignKey':_0xfda3('0x193')});db['CmHopperBlack'][_0xfda3('0x141')](db[_0xfda3('0x72')],{'as':'Contact','foreignKey':_0xfda3('0x151'),'onDelete':_0xfda3('0x106')});db[_0xfda3('0x76')][_0xfda3('0x141')](db['CmList'],{'as':_0xfda3('0x15a'),'foreignKey':_0xfda3('0x15b'),'onDelete':'cascade'});db[_0xfda3('0x76')][_0xfda3('0x141')](db[_0xfda3('0x13b')],{'as':'Queue','foreignKey':_0xfda3('0x13d'),'onDelete':_0xfda3('0x106')});db['CmHopperBlack']['belongsTo'](db[_0xfda3('0xdd')],{'as':_0xfda3('0xdd'),'foreignKey':'CampaignId','onDelete':_0xfda3('0x106')});db[_0xfda3('0x7f')][_0xfda3('0x109')](db['Condition'],{'as':{'plural':_0xfda3('0x194'),'singular':_0xfda3('0x195')},'foreignKey':_0xfda3('0x196'),'onDelete':_0xfda3('0x106'),'hooks':!![]});db[_0xfda3('0x7f')]['hasMany'](db['Condition'],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':_0xfda3('0x197'),'onDelete':_0xfda3('0x106'),'hooks':!![]});db[_0xfda3('0x7f')][_0xfda3('0x109')](db[_0xfda3('0x198')],{'as':_0xfda3('0x199'),'foreignKey':'AutomationId','onDelete':_0xfda3('0x106'),'hooks':!![]});db['Disposition'][_0xfda3('0x109')](db[_0xfda3('0x155')],{'as':_0xfda3('0x156'),'foreignKey':_0xfda3('0x19a'),'onDelete':'cascade'});db[_0xfda3('0x17a')][_0xfda3('0x109')](db[_0xfda3('0x17a')],{'as':'Intervals','foreignKey':_0xfda3('0x16e'),'onDelete':_0xfda3('0x106'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0xfda3('0x16')],{'as':_0xfda3('0x10a'),'foreignKey':'IntervalId','onDelete':_0xfda3('0x16d')});db['Interval'][_0xfda3('0x109')](db[_0xfda3('0x43')],{'as':_0xfda3('0x19b'),'foreignKey':_0xfda3('0x16e')});db[_0xfda3('0x17a')][_0xfda3('0x109')](db[_0xfda3('0x64')],{'as':'ChatApplications','foreignKey':_0xfda3('0x16e')});db[_0xfda3('0x17a')]['hasMany'](db['FaxApplication'],{'as':_0xfda3('0x19c'),'foreignKey':_0xfda3('0x16e')});db['Interval']['hasMany'](db[_0xfda3('0x178')],{'as':_0xfda3('0x19d'),'foreignKey':'IntervalId'});db[_0xfda3('0x88')][_0xfda3('0x141')](db[_0xfda3('0x3a')],{});db['Schedule']['belongsTo'](db['AnalyticDefaultReport'],{'foreignKey':_0xfda3('0x19e')});db[_0xfda3('0x88')][_0xfda3('0x141')](db[_0xfda3('0x93')],{'foreignKey':_0xfda3('0x19f')});db[_0xfda3('0x8a')][_0xfda3('0x115')](db['VoiceMusicOnHold'],{'as':_0xfda3('0x1a0'),'through':'moh_has_sounds','onDelete':_0xfda3('0x16d')});db[_0xfda3('0x163')][_0xfda3('0x115')](db[_0xfda3('0x72')],{'through':_0xfda3('0x190')});db['Tag']['belongsToMany'](db[_0xfda3('0x11b')],{'through':_0xfda3('0x189')});db[_0xfda3('0x163')][_0xfda3('0x115')](db[_0xfda3('0x40')],{'through':'mail_interaction_has_tags'});db['Tag'][_0xfda3('0x115')](db[_0xfda3('0x54')],{'through':_0xfda3('0x17c')});db[_0xfda3('0x163')][_0xfda3('0x115')](db['FaxInteraction'],{'through':_0xfda3('0x174')});db[_0xfda3('0x163')][_0xfda3('0x115')](db['OpenchannelInteraction'],{'through':_0xfda3('0x182')});db[_0xfda3('0x163')][_0xfda3('0x115')](db[_0xfda3('0xf8')],{'through':_0xfda3('0x1a1')});db[_0xfda3('0x8c')][_0xfda3('0x109')](db['Condition'],{'as':{'plural':'AllConditions','singular':'AllCondition'},'foreignKey':_0xfda3('0x1a2'),'onDelete':'cascade','hooks':!![]});db[_0xfda3('0x8c')][_0xfda3('0x109')](db[_0xfda3('0x81')],{'as':{'plural':_0xfda3('0x1a3'),'singular':_0xfda3('0x1a4')},'foreignKey':_0xfda3('0x1a5'),'onDelete':_0xfda3('0x106'),'hooks':!![]});db['Trigger'][_0xfda3('0x109')](db[_0xfda3('0x198')],{'as':_0xfda3('0x199'),'foreignKey':_0xfda3('0x1a6'),'onDelete':_0xfda3('0x106'),'hooks':!![]});db[_0xfda3('0x93')]['hasMany'](db[_0xfda3('0x9a')],{'as':'Fields','onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x19f'),'hooks':!![]});db['AnalyticDefaultReport'][_0xfda3('0x109')](db[_0xfda3('0x9a')],{'as':_0xfda3('0x1a7'),'onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x19e')});db['AnalyticMetric'][_0xfda3('0x109')](db['AnalyticFieldReport'],{'as':_0xfda3('0x1a7'),'onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x1a8')});db[_0xfda3('0x9a')][_0xfda3('0x141')](db[_0xfda3('0x98')],{'foreignKey':'MetricId'});db['SalesforceAccount']['hasMany'](db[_0xfda3('0x9f')],{'as':_0xfda3('0x1a9'),'onDelete':'cascade','foreignKey':_0xfda3('0x1aa')});db[_0xfda3('0x9f')][_0xfda3('0x109')](db['SalesforceField'],{'as':_0xfda3('0x1ab'),'onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x1ac')});db[_0xfda3('0x9f')]['hasMany'](db[_0xfda3('0xa1')],{'as':_0xfda3('0x1ad'),'onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x1ae')});db['SalesforceConfiguration']['hasMany'](db['SalesforceField'],{'as':_0xfda3('0x1a7'),'onDelete':'cascade','foreignKey':_0xfda3('0x1af')});db[_0xfda3('0x9f')][_0xfda3('0x141')](db[_0xfda3('0x9d')],{'as':'Account','foreignKey':_0xfda3('0x1aa')});db[_0xfda3('0xa1')][_0xfda3('0x109')](db[_0xfda3('0xa1')],{'as':_0xfda3('0x1b0'),'foreignKey':_0xfda3('0x1ac')});db[_0xfda3('0xa1')][_0xfda3('0x109')](db['SalesforceField'],{'as':_0xfda3('0x1b1'),'foreignKey':'DescriptionId'});db[_0xfda3('0xa1')]['hasMany'](db['SalesforceField'],{'as':'Field','foreignKey':_0xfda3('0x1af')});db['SalesforceField'][_0xfda3('0x141')](db[_0xfda3('0x8e')],{'as':'Variable','foreignKey':_0xfda3('0x1b2')});db[_0xfda3('0xa3')][_0xfda3('0x109')](db[_0xfda3('0xa5')],{'as':_0xfda3('0x1a9'),'onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x1aa')});db[_0xfda3('0xa5')][_0xfda3('0x109')](db[_0xfda3('0x1b3')],{'as':_0xfda3('0x1ab'),'onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x1ac')});db['SugarcrmConfiguration']['hasMany'](db[_0xfda3('0x1b3')],{'as':_0xfda3('0x1ad'),'onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x1ae')});db[_0xfda3('0xa5')][_0xfda3('0x109')](db[_0xfda3('0x1b3')],{'as':_0xfda3('0x1a7'),'onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x1af')});db[_0xfda3('0xa5')]['belongsTo'](db['SugarcrmAccount'],{'as':_0xfda3('0x160'),'foreignKey':_0xfda3('0x1aa')});db['SugarcrmField'][_0xfda3('0x109')](db[_0xfda3('0x1b3')],{'as':'Subject','foreignKey':_0xfda3('0x1ac')});db[_0xfda3('0x1b3')][_0xfda3('0x109')](db['SugarcrmField'],{'as':_0xfda3('0x1b1'),'foreignKey':_0xfda3('0x1ae')});db[_0xfda3('0x1b3')]['hasMany'](db['SugarcrmField'],{'as':_0xfda3('0x1b4'),'foreignKey':'FieldId'});db['SugarcrmField'][_0xfda3('0x141')](db[_0xfda3('0x8e')],{'as':_0xfda3('0x8e'),'foreignKey':_0xfda3('0x1b2')});db[_0xfda3('0xa7')][_0xfda3('0x109')](db['DeskConfiguration'],{'as':'Configurations','onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x1aa')});db[_0xfda3('0xa9')][_0xfda3('0x109')](db[_0xfda3('0x1b5')],{'as':_0xfda3('0x1ab'),'onDelete':_0xfda3('0x106'),'foreignKey':'SubjectId'});db[_0xfda3('0xa9')][_0xfda3('0x109')](db[_0xfda3('0x1b5')],{'as':_0xfda3('0x1ad'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['DeskConfiguration'][_0xfda3('0x109')](db['DeskField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0xfda3('0x1af')});db[_0xfda3('0xa9')][_0xfda3('0x141')](db[_0xfda3('0xa7')],{'as':_0xfda3('0x160'),'foreignKey':'AccountId'});db[_0xfda3('0xa9')][_0xfda3('0x115')](db[_0xfda3('0x163')],{'through':_0xfda3('0x1b6')});db[_0xfda3('0x1b5')]['hasMany'](db[_0xfda3('0x1b5')],{'as':_0xfda3('0x1b0'),'foreignKey':_0xfda3('0x1ac')});db[_0xfda3('0x1b5')][_0xfda3('0x109')](db[_0xfda3('0x1b5')],{'as':_0xfda3('0x1b1'),'foreignKey':_0xfda3('0x1ae')});db['DeskField']['hasMany'](db[_0xfda3('0x1b5')],{'as':'Field','foreignKey':_0xfda3('0x1af')});db[_0xfda3('0x1b5')][_0xfda3('0x141')](db[_0xfda3('0x8e')],{'as':'Variable','foreignKey':'VariableId'});db[_0xfda3('0x1b7')][_0xfda3('0x109')](db[_0xfda3('0xac')],{'as':'Configurations','onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x1aa')});db[_0xfda3('0xac')][_0xfda3('0x109')](db[_0xfda3('0x1b8')],{'as':_0xfda3('0x1ab'),'onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x1ac')});db['ZohoConfiguration']['hasMany'](db[_0xfda3('0x1b8')],{'as':_0xfda3('0x1ad'),'onDelete':'cascade','foreignKey':_0xfda3('0x1ae')});db[_0xfda3('0xac')]['hasMany'](db['ZohoField'],{'as':'Fields','onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x1af')});db[_0xfda3('0xac')][_0xfda3('0x141')](db[_0xfda3('0x1b7')],{'as':'Account','foreignKey':_0xfda3('0x1aa')});db[_0xfda3('0x1b8')]['hasMany'](db[_0xfda3('0x1b8')],{'as':_0xfda3('0x1b0'),'foreignKey':'SubjectId'});db['ZohoField'][_0xfda3('0x109')](db[_0xfda3('0x1b8')],{'as':_0xfda3('0x1b1'),'foreignKey':_0xfda3('0x1ae')});db[_0xfda3('0x1b8')][_0xfda3('0x109')](db[_0xfda3('0x1b8')],{'as':_0xfda3('0x1b4'),'foreignKey':_0xfda3('0x1af')});db[_0xfda3('0x1b8')]['belongsTo'](db[_0xfda3('0x8e')],{'as':_0xfda3('0x8e'),'foreignKey':_0xfda3('0x1b2')});db[_0xfda3('0xaf')][_0xfda3('0x109')](db[_0xfda3('0xb1')],{'as':_0xfda3('0x1a9'),'onDelete':'cascade','foreignKey':'AccountId'});db['ZendeskConfiguration']['hasMany'](db[_0xfda3('0xb2')],{'as':_0xfda3('0x1ab'),'foreignKey':_0xfda3('0x1ac')});db[_0xfda3('0xb1')][_0xfda3('0x109')](db['ZendeskField'],{'as':_0xfda3('0x1ad'),'foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0xfda3('0x109')](db[_0xfda3('0xb2')],{'as':_0xfda3('0x1a7'),'foreignKey':_0xfda3('0x1af')});db[_0xfda3('0xb1')][_0xfda3('0x141')](db['ZendeskAccount'],{'as':_0xfda3('0x160'),'foreignKey':'AccountId'});db[_0xfda3('0xb1')][_0xfda3('0x115')](db[_0xfda3('0x163')],{'through':_0xfda3('0x1b9')});db['ZendeskField'][_0xfda3('0x109')](db['ZendeskField'],{'as':_0xfda3('0x1b0'),'foreignKey':_0xfda3('0x1ac')});db[_0xfda3('0xb2')][_0xfda3('0x109')](db[_0xfda3('0xb2')],{'as':_0xfda3('0x1b1'),'foreignKey':_0xfda3('0x1ae')});db['ZendeskField']['hasMany'](db[_0xfda3('0xb2')],{'as':'Field','foreignKey':_0xfda3('0x1af')});db[_0xfda3('0xb2')][_0xfda3('0x141')](db[_0xfda3('0x8e')],{'as':_0xfda3('0x8e'),'foreignKey':_0xfda3('0x1b2')});db[_0xfda3('0xb4')]['hasMany'](db[_0xfda3('0xb5')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xfda3('0x1aa')});db[_0xfda3('0xb5')][_0xfda3('0x109')](db['FreshdeskField'],{'as':_0xfda3('0x1ab'),'onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x1ac')});db[_0xfda3('0xb5')]['hasMany'](db[_0xfda3('0xb7')],{'as':'Descriptions','onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x1ae')});db[_0xfda3('0xb5')][_0xfda3('0x109')](db[_0xfda3('0xb7')],{'as':_0xfda3('0x1a7'),'onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x1af')});db[_0xfda3('0xb5')][_0xfda3('0x141')](db[_0xfda3('0xb4')],{'as':_0xfda3('0x160'),'foreignKey':_0xfda3('0x1aa')});db['FreshdeskConfiguration'][_0xfda3('0x115')](db[_0xfda3('0x163')],{'through':_0xfda3('0x1ba')});db[_0xfda3('0xb7')][_0xfda3('0x109')](db[_0xfda3('0xb7')],{'as':_0xfda3('0x1b0'),'foreignKey':_0xfda3('0x1ac')});db[_0xfda3('0xb7')]['hasMany'](db[_0xfda3('0xb7')],{'as':_0xfda3('0x1b1'),'foreignKey':_0xfda3('0x1ae')});db[_0xfda3('0xb7')][_0xfda3('0x109')](db['FreshdeskField'],{'as':_0xfda3('0x1b4'),'foreignKey':_0xfda3('0x1af')});db[_0xfda3('0xb7')][_0xfda3('0x141')](db[_0xfda3('0x8e')],{'as':_0xfda3('0x8e'),'foreignKey':_0xfda3('0x1b2')});db['VtigerAccount']['hasMany'](db[_0xfda3('0xb9')],{'as':_0xfda3('0x1a9'),'onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x1aa')});db[_0xfda3('0xb9')][_0xfda3('0x109')](db['VtigerField'],{'as':'Subjects','foreignKey':_0xfda3('0x1ac')});db[_0xfda3('0xb9')]['hasMany'](db[_0xfda3('0xbb')],{'as':_0xfda3('0x1ad'),'foreignKey':_0xfda3('0x1ae')});db['VtigerConfiguration'][_0xfda3('0x109')](db[_0xfda3('0xbb')],{'as':_0xfda3('0x1a7'),'foreignKey':_0xfda3('0x1af')});db[_0xfda3('0xb9')][_0xfda3('0x141')](db[_0xfda3('0x1bb')],{'as':_0xfda3('0x160'),'foreignKey':_0xfda3('0x1aa')});db[_0xfda3('0xbb')][_0xfda3('0x109')](db['VtigerField'],{'as':_0xfda3('0x1b0'),'foreignKey':'SubjectId'});db[_0xfda3('0xbb')][_0xfda3('0x109')](db[_0xfda3('0xbb')],{'as':'Description','foreignKey':_0xfda3('0x1ae')});db['VtigerField']['hasMany'](db['VtigerField'],{'as':_0xfda3('0x1b4'),'foreignKey':_0xfda3('0x1af')});db['VtigerField'][_0xfda3('0x141')](db['Variable'],{'as':_0xfda3('0x8e'),'foreignKey':_0xfda3('0x1b2')});db[_0xfda3('0x1bc')]['hasMany'](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xfda3('0x1aa')});db[_0xfda3('0xbe')][_0xfda3('0x109')](db['ServicenowField'],{'as':'Subjects','foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0xfda3('0x109')](db[_0xfda3('0xc0')],{'as':_0xfda3('0x1ad'),'foreignKey':'DescriptionId'});db[_0xfda3('0xbe')][_0xfda3('0x109')](db['ServicenowField'],{'as':'Fields','foreignKey':_0xfda3('0x1af')});db[_0xfda3('0xbe')][_0xfda3('0x141')](db[_0xfda3('0x1bc')],{'as':_0xfda3('0x160'),'foreignKey':_0xfda3('0x1aa')});db['ServicenowField']['hasMany'](db[_0xfda3('0xc0')],{'as':_0xfda3('0x1b0'),'foreignKey':'SubjectId'});db['ServicenowField'][_0xfda3('0x109')](db['ServicenowField'],{'as':_0xfda3('0x1b1'),'foreignKey':_0xfda3('0x1ae')});db[_0xfda3('0xc0')]['hasMany'](db['ServicenowField'],{'as':_0xfda3('0x1b4'),'foreignKey':_0xfda3('0x1af')});db[_0xfda3('0xc0')][_0xfda3('0x141')](db[_0xfda3('0x8e')],{'as':_0xfda3('0x8e'),'foreignKey':_0xfda3('0x1b2')});db[_0xfda3('0xc2')]['hasMany'](db[_0xfda3('0xc4')],{'as':_0xfda3('0x1a9'),'onDelete':_0xfda3('0x106'),'foreignKey':'AccountId'});db[_0xfda3('0xc4')][_0xfda3('0x109')](db[_0xfda3('0x1bd')],{'as':_0xfda3('0x1ab'),'onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x1ac')});db[_0xfda3('0xc4')][_0xfda3('0x109')](db[_0xfda3('0x1bd')],{'as':_0xfda3('0x1ad'),'onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x1ae')});db[_0xfda3('0xc4')][_0xfda3('0x109')](db[_0xfda3('0x1bd')],{'as':_0xfda3('0x1a7'),'onDelete':_0xfda3('0x106'),'foreignKey':'FieldId'});db[_0xfda3('0xc4')][_0xfda3('0x141')](db[_0xfda3('0xc2')],{'as':_0xfda3('0x160'),'foreignKey':'AccountId'});db[_0xfda3('0x1bd')][_0xfda3('0x109')](db[_0xfda3('0x1bd')],{'as':'Subject','foreignKey':_0xfda3('0x1ac')});db[_0xfda3('0x1bd')][_0xfda3('0x109')](db['Dynamics365Field'],{'as':'Description','foreignKey':_0xfda3('0x1ae')});db[_0xfda3('0x1bd')][_0xfda3('0x109')](db['Dynamics365Field'],{'as':'Field','foreignKey':_0xfda3('0x1af')});db[_0xfda3('0x1bd')][_0xfda3('0x141')](db[_0xfda3('0x8e')],{'as':_0xfda3('0x8e'),'foreignKey':'VariableId'});db['FreshsalesAccount'][_0xfda3('0x109')](db[_0xfda3('0x1be')],{'as':'Configurations','onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x1aa')});db['FreshsalesConfiguration'][_0xfda3('0x109')](db[_0xfda3('0x1bf')],{'as':_0xfda3('0x1ab'),'foreignKey':_0xfda3('0x1ac')});db[_0xfda3('0x1be')][_0xfda3('0x109')](db[_0xfda3('0x1bf')],{'as':_0xfda3('0x1ad'),'foreignKey':_0xfda3('0x1ae')});db[_0xfda3('0x1be')][_0xfda3('0x109')](db[_0xfda3('0x1bf')],{'as':'Fields','foreignKey':_0xfda3('0x1af')});db[_0xfda3('0x1be')][_0xfda3('0x141')](db['FreshsalesAccount'],{'as':_0xfda3('0x160'),'foreignKey':_0xfda3('0x1aa')});db[_0xfda3('0x1bf')]['hasMany'](db[_0xfda3('0x1bf')],{'as':_0xfda3('0x1b0'),'foreignKey':_0xfda3('0x1ac')});db[_0xfda3('0x1bf')][_0xfda3('0x109')](db['FreshsalesField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0xfda3('0x1bf')]['hasMany'](db[_0xfda3('0x1bf')],{'as':'Field','foreignKey':_0xfda3('0x1af')});db[_0xfda3('0x1bf')]['belongsTo'](db[_0xfda3('0x8e')],{'as':_0xfda3('0x8e'),'foreignKey':_0xfda3('0x1b2')});db[_0xfda3('0xc8')][_0xfda3('0x141')](db['ChatWebsite'],{});db[_0xfda3('0xc8')]['belongsTo'](db['CmList'],{'as':_0xfda3('0x15a'),'foreignKey':_0xfda3('0x15b')});db[_0xfda3('0xc8')][_0xfda3('0x141')](db[_0xfda3('0x72')],{'as':_0xfda3('0x161'),'foreignKey':_0xfda3('0x151')});db['ChatQueueReport'][_0xfda3('0x141')](db['ChatInteraction'],{});db[_0xfda3('0xc8')]['belongsTo'](db[_0xfda3('0x67')],{});db[_0xfda3('0xc8')][_0xfda3('0x141')](db['User'],{});db[_0xfda3('0xc8')][_0xfda3('0x141')](db[_0xfda3('0x18b')],{});db[_0xfda3('0xc9')][_0xfda3('0x141')](db[_0xfda3('0x108')],{'onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x1c0')});db[_0xfda3('0xc9')][_0xfda3('0x141')](db[_0xfda3('0x108')],{'onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x1c1')});db[_0xfda3('0xcd')][_0xfda3('0x109')](db[_0xfda3('0x1c2')],{'foreignKey':'SessionId','onDelete':_0xfda3('0x106')});db[_0xfda3('0xcd')][_0xfda3('0x109')](db['JscriptyAnswerReport'],{'foreignKey':_0xfda3('0x1c3'),'onDelete':_0xfda3('0x106')});db[_0xfda3('0xcf')]['belongsTo'](db[_0xfda3('0x52')],{});db[_0xfda3('0xcf')][_0xfda3('0x141')](db[_0xfda3('0xeb')],{'as':'List','foreignKey':'ListId'});db[_0xfda3('0xcf')]['belongsTo'](db[_0xfda3('0x72')],{'as':_0xfda3('0x161'),'foreignKey':_0xfda3('0x151')});db[_0xfda3('0xcf')][_0xfda3('0x141')](db[_0xfda3('0x54')],{});db[_0xfda3('0xcf')][_0xfda3('0x141')](db[_0xfda3('0x56')],{});db['SmsQueueReport'][_0xfda3('0x141')](db['User'],{});db[_0xfda3('0xcf')][_0xfda3('0x141')](db[_0xfda3('0x57')],{});db[_0xfda3('0xd4')][_0xfda3('0x109')](db[_0xfda3('0xcd')],{'foreignKey':_0xfda3('0x1c4')});db[_0xfda3('0xd4')]['hasMany'](db[_0xfda3('0x1c2')],{'foreignKey':'ProjectId'});db[_0xfda3('0xd4')][_0xfda3('0x109')](db[_0xfda3('0xcb')],{'foreignKey':_0xfda3('0x1c4')});db[_0xfda3('0x134')][_0xfda3('0x115')](db[_0xfda3('0x108')],{'as':_0xfda3('0x167'),'through':'user_has_square_projects'});db[_0xfda3('0xdb')]['belongsToMany'](db[_0xfda3('0x108')],{'as':_0xfda3('0x146'),'through':'user_has_teams'});db[_0xfda3('0xdb')][_0xfda3('0x115')](db['VoiceQueue'],{'through':_0xfda3('0x101'),'as':_0xfda3('0x121')});db[_0xfda3('0xdb')][_0xfda3('0x115')](db[_0xfda3('0x3c')],{'through':_0xfda3('0x15e'),'as':_0xfda3('0x124')});db['Team'][_0xfda3('0x115')](db[_0xfda3('0x18b')],{'through':_0xfda3('0x1c5'),'as':_0xfda3('0x1c6')});db['Team'][_0xfda3('0x115')](db['FaxQueue'],{'through':_0xfda3('0x176'),'as':_0xfda3('0x1c7')});db[_0xfda3('0xdb')][_0xfda3('0x115')](db[_0xfda3('0x57')],{'through':_0xfda3('0x17d'),'as':'SmsQueues'});db[_0xfda3('0xdb')]['belongsToMany'](db[_0xfda3('0x60')],{'through':_0xfda3('0x184'),'as':_0xfda3('0x127')});db[_0xfda3('0xdb')][_0xfda3('0x115')](db[_0xfda3('0x128')],{'through':_0xfda3('0x1c8'),'as':'WhatsappQueues'});db[_0xfda3('0xdb')][_0xfda3('0x115')](db[_0xfda3('0xed')],{'through':_0xfda3('0x102'),'as':_0xfda3('0x122')});db[_0xfda3('0xdd')][_0xfda3('0x109')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xfda3('0x192')});db[_0xfda3('0xdd')][_0xfda3('0x109')](db['CmHopperFinal'],{'as':_0xfda3('0x10b'),'foreignKey':_0xfda3('0x192')});db[_0xfda3('0xdd')]['hasMany'](db[_0xfda3('0x79')],{'as':'HopperHistories','foreignKey':_0xfda3('0x192')});db[_0xfda3('0xdd')]['hasMany'](db[_0xfda3('0x76')],{'as':_0xfda3('0x13f'),'foreignKey':'CampaignId'});db[_0xfda3('0xdd')]['belongsTo'](db[_0xfda3('0x142')],{'as':_0xfda3('0x142'),'foreignKey':_0xfda3('0x1c9')});db['Campaign'][_0xfda3('0x141')](db[_0xfda3('0x142')],{'as':_0xfda3('0x143'),'foreignKey':_0xfda3('0x144')});db['Campaign'][_0xfda3('0x141')](db[_0xfda3('0x17a')],{'as':_0xfda3('0x17a'),'foreignKey':_0xfda3('0x16e')});db[_0xfda3('0xdd')]['belongsTo'](db[_0xfda3('0x134')],{'as':_0xfda3('0x134'),'foreignKey':_0xfda3('0x1ca')});db[_0xfda3('0xdd')]['belongsToMany'](db[_0xfda3('0xeb')],{'as':_0xfda3('0x119'),'through':'campaigns_has_cm_lists'});db[_0xfda3('0xdd')][_0xfda3('0x115')](db[_0xfda3('0xeb')],{'as':_0xfda3('0x148'),'through':'campaigns_has_cm_blacklists'});db[_0xfda3('0xe0')][_0xfda3('0x141')](db['ChatOfflineMessage'],{'as':_0xfda3('0x69'),'foreignKey':_0xfda3('0x16c')});db['MailTransferReport'][_0xfda3('0x141')](db[_0xfda3('0x41')],{});db[_0xfda3('0xe3')]['belongsTo'](db['MailInteraction'],{});db[_0xfda3('0xe3')][_0xfda3('0x141')](db[_0xfda3('0x3a')],{'foreignKey':_0xfda3('0x1cb'),'as':'FromAccount'});db[_0xfda3('0xe3')][_0xfda3('0x141')](db['User'],{'foreignKey':_0xfda3('0x1cc'),'as':_0xfda3('0x1cd')});db[_0xfda3('0xe3')][_0xfda3('0x141')](db['User'],{'foreignKey':_0xfda3('0x1ce'),'as':'ToAgent'});db['MailTransferReport']['belongsTo'](db[_0xfda3('0x3c')],{'foreignKey':_0xfda3('0x1cf'),'as':'ToQueue'});db['MailTransferReport'][_0xfda3('0x141')](db['MailAccount'],{'foreignKey':_0xfda3('0x1d0'),'as':_0xfda3('0x1d1')});db[_0xfda3('0x1d2')]['belongsTo'](db['ChatMessage'],{});db[_0xfda3('0x1d2')][_0xfda3('0x141')](db[_0xfda3('0x11b')],{});db[_0xfda3('0x1d2')][_0xfda3('0x141')](db['ChatWebsite'],{'foreignKey':_0xfda3('0x1d3'),'as':_0xfda3('0x1d4')});db[_0xfda3('0x1d2')][_0xfda3('0x141')](db['User'],{'foreignKey':_0xfda3('0x1cc'),'as':_0xfda3('0x1cd')});db[_0xfda3('0x1d2')]['belongsTo'](db[_0xfda3('0x108')],{'foreignKey':_0xfda3('0x1ce'),'as':_0xfda3('0x1d5')});db[_0xfda3('0x1d2')][_0xfda3('0x141')](db[_0xfda3('0x18b')],{'foreignKey':_0xfda3('0x1d6'),'as':_0xfda3('0x1d7')});db[_0xfda3('0x1d2')][_0xfda3('0x141')](db[_0xfda3('0x61')],{'foreignKey':_0xfda3('0x1d8'),'as':_0xfda3('0x1d1')});db[_0xfda3('0xe6')]['belongsTo'](db[_0xfda3('0x175')],{});db[_0xfda3('0xe6')]['belongsTo'](db[_0xfda3('0x4c')],{});db[_0xfda3('0xe6')]['belongsTo'](db[_0xfda3('0x49')],{'foreignKey':_0xfda3('0x1d9'),'as':'FromAccount'});db[_0xfda3('0xe6')]['belongsTo'](db[_0xfda3('0x108')],{'foreignKey':'FromUserId','as':_0xfda3('0x1cd')});db[_0xfda3('0xe6')]['belongsTo'](db[_0xfda3('0x108')],{'foreignKey':_0xfda3('0x1ce'),'as':'ToAgent'});db[_0xfda3('0xe6')][_0xfda3('0x141')](db['FaxQueue'],{'foreignKey':_0xfda3('0x1da'),'as':_0xfda3('0x1d7')});db['FaxTransferReport'][_0xfda3('0x141')](db[_0xfda3('0x49')],{'foreignKey':_0xfda3('0x1db'),'as':_0xfda3('0x1d1')});db[_0xfda3('0x1dc')][_0xfda3('0x141')](db[_0xfda3('0x5f')],{});db['OpenchannelTransferReport'][_0xfda3('0x141')](db[_0xfda3('0x5d')],{});db['OpenchannelTransferReport'][_0xfda3('0x141')](db[_0xfda3('0x59')],{'foreignKey':_0xfda3('0x1dd'),'as':_0xfda3('0x1d4')});db[_0xfda3('0x1dc')][_0xfda3('0x141')](db[_0xfda3('0x108')],{'foreignKey':_0xfda3('0x1cc'),'as':_0xfda3('0x1cd')});db[_0xfda3('0x1dc')][_0xfda3('0x141')](db[_0xfda3('0x108')],{'foreignKey':_0xfda3('0x1ce'),'as':_0xfda3('0x1d5')});db['OpenchannelTransferReport'][_0xfda3('0x141')](db[_0xfda3('0x60')],{'foreignKey':'ToOpenchannelQueueId','as':_0xfda3('0x1d7')});db[_0xfda3('0x1dc')]['belongsTo'](db[_0xfda3('0x59')],{'foreignKey':_0xfda3('0x1de'),'as':_0xfda3('0x1d1')});db['SmsTransferReport'][_0xfda3('0x141')](db[_0xfda3('0x56')],{});db[_0xfda3('0xe9')]['belongsTo'](db[_0xfda3('0x54')],{});db['SmsTransferReport'][_0xfda3('0x141')](db[_0xfda3('0x52')],{'foreignKey':_0xfda3('0x1df'),'as':_0xfda3('0x1d4')});db['SmsTransferReport'][_0xfda3('0x141')](db[_0xfda3('0x108')],{'foreignKey':'FromUserId','as':_0xfda3('0x1cd')});db[_0xfda3('0xe9')][_0xfda3('0x141')](db[_0xfda3('0x108')],{'foreignKey':'ToUserId','as':'ToAgent'});db['SmsTransferReport']['belongsTo'](db['SmsQueue'],{'foreignKey':_0xfda3('0x1e0'),'as':_0xfda3('0x1d7')});db[_0xfda3('0xe9')][_0xfda3('0x141')](db[_0xfda3('0x52')],{'foreignKey':_0xfda3('0x1e1'),'as':_0xfda3('0x1d1')});db[_0xfda3('0xeb')][_0xfda3('0x109')](db[_0xfda3('0x155')],{'as':_0xfda3('0x156'),'foreignKey':_0xfda3('0x15b'),'onDelete':_0xfda3('0x106')});db[_0xfda3('0xeb')][_0xfda3('0x109')](db[_0xfda3('0x7c')],{'as':'CustomFields','foreignKey':'ListId'});db[_0xfda3('0xeb')][_0xfda3('0x109')](db[_0xfda3('0x72')],{'as':_0xfda3('0x117'),'onDelete':_0xfda3('0x106'),'foreignKey':_0xfda3('0x15b')});db[_0xfda3('0xeb')]['hasMany'](db[_0xfda3('0x78')],{'as':_0xfda3('0x10b'),'foreignKey':_0xfda3('0x15b')});db[_0xfda3('0xeb')]['hasMany'](db[_0xfda3('0x79')],{'as':_0xfda3('0x1e2'),'foreignKey':'ListId'});db[_0xfda3('0xeb')][_0xfda3('0x109')](db[_0xfda3('0x7a')],{'as':_0xfda3('0x7a'),'foreignKey':_0xfda3('0x15b')});db[_0xfda3('0xeb')][_0xfda3('0x115')](db[_0xfda3('0x13b')],{'as':'Queues','through':'voice_queues_has_cm_lists'});db['CmList'][_0xfda3('0x115')](db[_0xfda3('0x108')],{'as':_0xfda3('0x146'),'through':'cm_user_has_lists'});db[_0xfda3('0xed')]['hasMany'](db[_0xfda3('0x16')],{'as':_0xfda3('0x10a'),'onDelete':_0xfda3('0x106')});db[_0xfda3('0xed')][_0xfda3('0x115')](db[_0xfda3('0x108')],{'as':'Agents','through':_0xfda3('0x123')});db[_0xfda3('0xed')]['belongsToMany'](db[_0xfda3('0xdb')],{'through':_0xfda3('0x102'),'as':_0xfda3('0x147')});db[_0xfda3('0xef')]['hasMany'](db['User'],{'as':'Users','foreignKey':_0xfda3('0x114')});db[_0xfda3('0xef')][_0xfda3('0x109')](db[_0xfda3('0xf1')],{'as':_0xfda3('0x1e3'),'foreignKey':_0xfda3('0x114'),'onDelete':'cascade'});db['UserProfileSection'][_0xfda3('0x109')](db['UserProfileResource'],{'as':_0xfda3('0x1e4'),'foreignKey':_0xfda3('0x1e5'),'onDelete':_0xfda3('0x106')});db[_0xfda3('0xf5')][_0xfda3('0x109')](db['Disposition'],{'as':'Dispositions','foreignKey':'WhatsappAccountId','onDelete':_0xfda3('0x106')});db[_0xfda3('0xf5')][_0xfda3('0x109')](db[_0xfda3('0x80')],{'as':_0xfda3('0x157'),'foreignKey':_0xfda3('0x1e6')});db[_0xfda3('0xf5')][_0xfda3('0x109')](db[_0xfda3('0xfa')],{'as':_0xfda3('0x14a'),'foreignKey':'WhatsappAccountId'});db[_0xfda3('0xf5')][_0xfda3('0x109')](db[_0xfda3('0xf8')],{'as':_0xfda3('0x158')});db[_0xfda3('0xf5')][_0xfda3('0x109')](db[_0xfda3('0xf7')],{'as':_0xfda3('0x159')});db[_0xfda3('0xf5')]['belongsTo'](db[_0xfda3('0xeb')],{'as':'List','foreignKey':_0xfda3('0x15b')});db['WhatsappAccount']['belongsTo'](db[_0xfda3('0x84')],{'as':_0xfda3('0x15d'),'foreignKey':_0xfda3('0x179')});db['WhatsappAccount'][_0xfda3('0x115')](db[_0xfda3('0x108')],{'as':'Agents','through':_0xfda3('0x133')});db[_0xfda3('0xf7')]['belongsTo'](db[_0xfda3('0x108')],{'onDelete':_0xfda3('0x16d')});db[_0xfda3('0xf7')][_0xfda3('0x141')](db['WhatsappQueue'],{'onDelete':_0xfda3('0x16d')});db[_0xfda3('0xf7')][_0xfda3('0x141')](db[_0xfda3('0xf5')],{'onDelete':'restrict'});db['WhatsappApplication'][_0xfda3('0x141')](db['Interval'],{'onDelete':_0xfda3('0x16d'),'foreignKey':_0xfda3('0x16e')});db['WhatsappApplication'][_0xfda3('0x141')](db[_0xfda3('0x163')],{'onDelete':_0xfda3('0x16d'),'foreignKey':_0xfda3('0x16f')});db['WhatsappInteraction'][_0xfda3('0x109')](db['WhatsappMessage'],{'as':_0xfda3('0x14a'),'onDelete':'cascade','foreignKey':_0xfda3('0x1e7')});db[_0xfda3('0xf8')][_0xfda3('0x141')](db[_0xfda3('0xf5')],{'as':_0xfda3('0x160'),'foreignKey':'WhatsappAccountId'});db['WhatsappInteraction'][_0xfda3('0x141')](db[_0xfda3('0x72')],{'as':_0xfda3('0x161'),'foreignKey':_0xfda3('0x151')});db[_0xfda3('0xf8')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0xfda3('0x107')});db[_0xfda3('0xf8')][_0xfda3('0x115')](db[_0xfda3('0x163')],{'through':_0xfda3('0x1a1'),'as':_0xfda3('0x165')});db[_0xfda3('0xf8')][_0xfda3('0x115')](db[_0xfda3('0x163')],{'through':'whatsapp_interaction_has_tags','as':_0xfda3('0x166')});db[_0xfda3('0xf8')][_0xfda3('0x115')](db[_0xfda3('0x108')],{'as':'Users','through':_0xfda3('0x120'),'foreignKey':'WhatsappInteractionId'});db[_0xfda3('0xfa')][_0xfda3('0x141')](db[_0xfda3('0x108')],{'as':_0xfda3('0x108')});db['WhatsappMessage'][_0xfda3('0x141')](db[_0xfda3('0x72')],{'onDelete':_0xfda3('0x106'),'as':_0xfda3('0x161')});db[_0xfda3('0xfa')][_0xfda3('0x141')](db['WhatsappInteraction'],{'onDelete':_0xfda3('0x106'),'as':_0xfda3('0x16a'),'foreignKey':_0xfda3('0x1e7')});db[_0xfda3('0xfa')][_0xfda3('0x141')](db['WhatsappAccount'],{'as':_0xfda3('0x160'),'foreignKey':_0xfda3('0x1e6')});db['WhatsappQueueReport'][_0xfda3('0x141')](db['WhatsappAccount'],{});db[_0xfda3('0xfb')]['belongsTo'](db[_0xfda3('0xeb')],{'as':_0xfda3('0x15a'),'foreignKey':'ListId'});db[_0xfda3('0xfb')][_0xfda3('0x141')](db[_0xfda3('0x72')],{'as':'Contact','foreignKey':_0xfda3('0x151')});db[_0xfda3('0xfb')][_0xfda3('0x141')](db['WhatsappInteraction'],{});db['WhatsappQueueReport'][_0xfda3('0x141')](db[_0xfda3('0x128')],{});db[_0xfda3('0xfb')][_0xfda3('0x141')](db[_0xfda3('0xfa')],{});db[_0xfda3('0xfb')][_0xfda3('0x141')](db[_0xfda3('0x108')],{});db[_0xfda3('0xfd')][_0xfda3('0x141')](db[_0xfda3('0xfa')],{});db[_0xfda3('0xfd')][_0xfda3('0x141')](db['WhatsappInteraction'],{});db[_0xfda3('0xfd')][_0xfda3('0x141')](db['WhatsappAccount'],{'foreignKey':_0xfda3('0x1e8'),'as':_0xfda3('0x1d4')});db['WhatsappTransferReport']['belongsTo'](db[_0xfda3('0xf5')],{'foreignKey':_0xfda3('0x1e9'),'as':'ToAccount'});db[_0xfda3('0xfd')][_0xfda3('0x141')](db[_0xfda3('0x128')],{'foreignKey':'ToQueueId','as':_0xfda3('0x1d7')});db['WhatsappTransferReport'][_0xfda3('0x141')](db[_0xfda3('0x108')],{'foreignKey':_0xfda3('0x1cc'),'as':_0xfda3('0x1cd')});db[_0xfda3('0xfd')][_0xfda3('0x141')](db['User'],{'foreignKey':_0xfda3('0x1ce'),'as':'ToAgent'});db['WhatsappQueue'][_0xfda3('0x115')](db[_0xfda3('0x108')],{'as':'Agents','through':_0xfda3('0x35'),'foreignKey':'WhatsappQueueId'});db[_0xfda3('0x128')][_0xfda3('0x115')](db[_0xfda3('0xdb')],{'through':_0xfda3('0x1c8'),'as':_0xfda3('0x147')});module[_0xfda3('0x1ea')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xb4e6=['exports','../config/environment','lodash','jstz','determine','sequelize','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','name','sequelizeHistory','xcall','utf8mb4','utf8_general_ci','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','../api/action/action.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/tag/tag.model','Template','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','UserId','hasMany','VoiceQueuesRt','Extensions','cascade','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','belongsTo','UserProfile','belongsToMany','ChatGroup','Groups','Contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','MailQueue','ChatQueues','FaxQueues','OpenchannelQueues','WhatsappQueues','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccount','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_square_projects','SpiedAgents','Applications','moh_has_sounds','UserVoiceQueueRt','Members','VoiceQueueId','Hoppers','HopperFinals','HopperHistories','HopperBlacks','JscriptySessionReport','JscriptySessions','TrunkBackup','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','VoiceCallReport','Contact','ContactId','MailAccount','MailServerOut','MailAccountId','Imap','Dispositions','Interactions','MailApplication','List','ListId','TemplateId','team_has_mail_queues','MailInteractionId','Account','Tags','Tag','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','restrict','TagId','FaxAccountId','Answers','Exntensions','FaxInteractionId','Owner','fax_interaction_has_tags','user_has_fax_interactions','AttachmentId','team_has_fax_queues','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','ChatProactiveAction','ProactiveActions','Agent','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','ChatOfflineMessageId','team_has_chat_queues','chat_group_has_users','CmCompany','CompanyId','Company','cm_user_has_contacts','cm_contact_has_tags','Campaign','CampaignId','Queue','Automation','OneAll','AutomationAllId','AutomationAnyId','Action','Actions','AutomationId','ParentId','Intervals','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','AllConditions','AllCondition','TriggerAllId','Trigger','AnyConditions','TriggerAnyId','AnalyticCustomReport','Fields','AnalyticMetric','Configurations','AccountId','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','DescriptionId','Field','VariableId','SugarcrmConfiguration','DeskAccount','DeskField','int_desk_configuration_has_tags','ZohoField','int_zendesk_configuration_has_tags','FreshdeskField','ServicenowField','FreshsalesConfiguration','FromId','ToId','SessionId','SmsQueueReport','JscriptyProject','ProjectId','user_has_teams','MailQueues','SmsQueues','team_has_openchannel_queues','team_has_whatsapp_queues','VoicePrefixes','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','FromChatWebsiteId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToQueue','ToFaxAccountId','ToAccount','OpenchannelTransferReport','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CmCustomField','CustomFields','HopperHistory','Queues','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappMessage','user_has_whatsapp_accounts','whatsapp_interaction_has_tags','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId'];(function(_0x41efe4,_0x5f0886){var _0x237c8c=function(_0x3af99d){while(--_0x3af99d){_0x41efe4['push'](_0x41efe4['shift']());}};_0x237c8c(++_0x5f0886);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0xb4e6[_0x57486e];return _0x5f110b;};'use strict';var config=require(_0x6b4e('0x0'));var Sequelize=require('sequelize');var _=require(_0x6b4e('0x1'));var jstz=require(_0x6b4e('0x2'));var timezone=jstz[_0x6b4e('0x3')]();config[_0x6b4e('0x4')]=_[_0x6b4e('0x5')](config[_0x6b4e('0x4')],{'database':_0x6b4e('0x6'),'username':'xcall','password':_0x6b4e('0x7'),'options':{'host':_0x6b4e('0x8'),'port':0xcea,'dialect':_0x6b4e('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x6b4e('0xa')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0x6b4e('0xb')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0x6b4e('0x6'),'username':_0x6b4e('0xc'),'password':_0x6b4e('0x7'),'options':{'host':_0x6b4e('0x8'),'port':0xcea,'dialect':_0x6b4e('0x9'),'dialectOptions':{'charset':_0x6b4e('0xd')},'logging':![],'timezone':timezone[_0x6b4e('0xa')](),'define':{'charset':'utf8','collate':_0x6b4e('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6b4e('0x4')]['database'],config[_0x6b4e('0x4')][_0x6b4e('0xf')],config[_0x6b4e('0x4')][_0x6b4e('0x10')],config[_0x6b4e('0x4')][_0x6b4e('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6b4e('0xb')]['database'],config[_0x6b4e('0xb')][_0x6b4e('0xf')],config['sequelizeHistory'][_0x6b4e('0x10')],config['sequelizeHistory'][_0x6b4e('0x11')])};db[_0x6b4e('0x12')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x14'));db[_0x6b4e('0x15')]=db['sequelize']['import'](_0x6b4e('0x16'));db[_0x6b4e('0x17')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x18'));db[_0x6b4e('0x19')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x1a'));db[_0x6b4e('0x1b')]=db[_0x6b4e('0x4')]['import'](_0x6b4e('0x1c'));db[_0x6b4e('0x1d')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/voiceQueue/voiceQueue.model');db[_0x6b4e('0x1e')]=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0x1f'));db[_0x6b4e('0x20')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x21'));db[_0x6b4e('0x22')]=db['sequelize'][_0x6b4e('0x13')]('../api/voiceMail/voiceMail.model');db[_0x6b4e('0x23')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x24'));db['VoiceCallReport']=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/voiceCallReport/voiceCallReport.model');db[_0x6b4e('0x25')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x26'));db['VoiceAgentReport']=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x6b4e('0x27')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x28'));db['MemberReport']=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/memberReport/memberReport.model');db[_0x6b4e('0x29')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x2a'));db['UserVoiceQueueRt']=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x2b'));db['UserVoiceQueue']=db['sequelize'][_0x6b4e('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x6b4e('0x2c')]=db[_0x6b4e('0x4')]['import'](_0x6b4e('0x2d'));db[_0x6b4e('0x2e')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x2f'));db[_0x6b4e('0x30')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x31'));db[_0x6b4e('0x32')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x33'));db[_0x6b4e('0x34')]=db[_0x6b4e('0x4')]['import'](_0x6b4e('0x35'));db[_0x6b4e('0x36')]=db[_0x6b4e('0x4')]['import'](_0x6b4e('0x37'));db['MailServerOut']=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x38'));db['MailAccount']=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0x39'));db['MailQueue']=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0x3a'));db[_0x6b4e('0x3b')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x3c'));db[_0x6b4e('0x3d')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x3e'));db[_0x6b4e('0x3f')]=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0x40'));db['MailApplication']=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x41'));db[_0x6b4e('0x42')]=db[_0x6b4e('0x4')]['import']('../api/mailQueueReport/mailQueueReport.model');db[_0x6b4e('0x43')]=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0x44'));db['DashboardItem']=db[_0x6b4e('0x4')]['import'](_0x6b4e('0x45'));db['FaxAccount']=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x46'));db[_0x6b4e('0x47')]=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0x48'));db[_0x6b4e('0x49')]=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0x4a'));db[_0x6b4e('0x4b')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x4c'));db[_0x6b4e('0x4d')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/faxQueue/faxQueue.model');db[_0x6b4e('0x4e')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x4f'));db[_0x6b4e('0x50')]=db['sequelize'][_0x6b4e('0x13')]('../api/smsAccount/smsAccount.model');db[_0x6b4e('0x51')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x52'));db['SmsInteraction']=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x53'));db['SmsMessage']=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x54'));db[_0x6b4e('0x55')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x56'));db[_0x6b4e('0x57')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/openchannelAccount/openchannelAccount.model');db[_0x6b4e('0x58')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/openchannelApplication/openchannelApplication.model');db[_0x6b4e('0x59')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x5a'));db[_0x6b4e('0x5b')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x5c'));db[_0x6b4e('0x5d')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x5e'));db[_0x6b4e('0x5f')]=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0x60'));db[_0x6b4e('0x61')]=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0x62'));db[_0x6b4e('0x63')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0x6b4e('0x64')]=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0x65'));db['ChatOfflineMessage']=db[_0x6b4e('0x4')]['import'](_0x6b4e('0x66'));db[_0x6b4e('0x67')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x68'));db['ChatGroup']=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x69'));db['ChatProactiveAction']=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0x6a'));db['CmCompany']=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x6b'));db[_0x6b4e('0x6c')]=db[_0x6b4e('0x4')]['import']('../api/cmContact/cmContact.model');db[_0x6b4e('0x6d')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x6e'));db[_0x6b4e('0x6f')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x70'));db[_0x6b4e('0x71')]=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0x72'));db[_0x6b4e('0x73')]=db['sequelize']['import'](_0x6b4e('0x74'));db[_0x6b4e('0x75')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x76'));db['CmCustomField']=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x77'));db['Action']=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x78'));db['Automation']=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/automation/automation.model');db[_0x6b4e('0x79')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x7a'));db[_0x6b4e('0x7b')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/disposition/disposition.model');db[_0x6b4e('0x7c')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x7d'));db[_0x6b4e('0x7e')]=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0x7f'));db[_0x6b4e('0x80')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/pause/pause.model');db[_0x6b4e('0x81')]=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0x82'));db[_0x6b4e('0x83')]=db[_0x6b4e('0x4')]['import'](_0x6b4e('0x84'));db[_0x6b4e('0x85')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x86'));db[_0x6b4e('0x87')]=db[_0x6b4e('0x4')]['import']('../api/sound/sound.model');db['Tag']=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x88'));db[_0x6b4e('0x89')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/template/template.model');db['Trigger']=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x8a'));db[_0x6b4e('0x8b')]=db['sequelize'][_0x6b4e('0x13')]('../api/variable/variable.model');db[_0x6b4e('0x8c')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x8d'));db['IntegrationReport']=db[_0x6b4e('0x4')]['import'](_0x6b4e('0x8e'));db['AnalyticCustomReport']=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x6b4e('0x8f')]=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0x90'));db[_0x6b4e('0x91')]=db[_0x6b4e('0x4')]['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0x6b4e('0x92')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x93'));db[_0x6b4e('0x94')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x95'));db[_0x6b4e('0x96')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x6b4e('0x97')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x98'));db[_0x6b4e('0x99')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x9a'));db[_0x6b4e('0x9b')]=db['sequelize']['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x9c'));db[_0x6b4e('0x9d')]=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0x9e'));db['DeskAccount']=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x9f'));db[_0x6b4e('0xa0')]=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0xa1'));db['DeskField']=db['sequelize'][_0x6b4e('0x13')]('../api/intDeskField/intDeskField.model');db[_0x6b4e('0xa2')]=db[_0x6b4e('0x4')]['import'](_0x6b4e('0xa3'));db[_0x6b4e('0xa4')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xa5'));db['ZohoField']=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0xa6'));db[_0x6b4e('0xa7')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xa8'));db[_0x6b4e('0xa9')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x6b4e('0xaa')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xab'));db[_0x6b4e('0xac')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xad'));db[_0x6b4e('0xae')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xaf'));db['FreshdeskField']=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0xb0'));db[_0x6b4e('0xb1')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x6b4e('0xb2')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x6b4e('0xb3')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xb4'));db[_0x6b4e('0xb5')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x6b4e('0xb6')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db['ServicenowField']=db['sequelize'][_0x6b4e('0x13')]('../api/intServicenowField/intServicenowField.model');db[_0x6b4e('0xb7')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xb8'));db[_0x6b4e('0xb9')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x6b4e('0xba')]=db['sequelize']['import'](_0x6b4e('0xbb'));db[_0x6b4e('0xbc')]=db[_0x6b4e('0x4')]['import'](_0x6b4e('0xbd'));db['FreshsalesConfiguration']=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xbe'));db[_0x6b4e('0xbf')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xc0'));db[_0x6b4e('0x8c')]=db['sequelize'][_0x6b4e('0x13')]('../api/integration/integration.model');db[_0x6b4e('0xc1')]=db['sequelize'][_0x6b4e('0x13')]('../api/network/network.model');db[_0x6b4e('0xc2')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xc3'));db[_0x6b4e('0xc4')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xc5'));db[_0x6b4e('0xc6')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xc7'));db[_0x6b4e('0xc8')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xc9'));db['JscriptySessionReport']=db[_0x6b4e('0x4')]['import'](_0x6b4e('0xca'));db['SmsQueueReport']=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xcb'));db[_0x6b4e('0xcc')]=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0xcd'));db[_0x6b4e('0xce')]=db[_0x6b4e('0x4')]['import'](_0x6b4e('0xcf'));db['JscriptyProject']=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xd0'));db[_0x6b4e('0xd1')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xd2'));db[_0x6b4e('0xd3')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xd4'));db[_0x6b4e('0xd5')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xd6'));db[_0x6b4e('0xd7')]=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0xd8'));db[_0x6b4e('0xd9')]=db[_0x6b4e('0x4')]['import'](_0x6b4e('0xda'));db[_0x6b4e('0xdb')]=db[_0x6b4e('0x4')]['import'](_0x6b4e('0xdc'));db[_0x6b4e('0xdd')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/license/license.model');db['Campaign']=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/campaign/campaign.model');db[_0x6b4e('0xde')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xdf'));db[_0x6b4e('0xe0')]=db[_0x6b4e('0x4')]['import'](_0x6b4e('0xe1'));db[_0x6b4e('0xe2')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xe3'));db[_0x6b4e('0xe4')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xe5'));db[_0x6b4e('0xe6')]=db[_0x6b4e('0x4')]['import'](_0x6b4e('0xe7'));db['FaxTransferReport']=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0xe8'));db['OpenchannelTransferReport']=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0xe9'));db[_0x6b4e('0xea')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/smsTransferReport/smsTransferReport.model');db[_0x6b4e('0xeb')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xec'));db[_0x6b4e('0xed')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xee'));db['UserProfile']=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xef'));db[_0x6b4e('0xf0')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xf1'));db[_0x6b4e('0xf2')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')]('../api/userProfileResource/userProfileResource.model');db[_0x6b4e('0xf3')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xf4'));db['WhatsappAccount']=db[_0x6b4e('0x4')]['import'](_0x6b4e('0xf5'));db[_0x6b4e('0xf6')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xf7'));db[_0x6b4e('0xf8')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xf9'));db['WhatsappMessage']=db[_0x6b4e('0x4')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x6b4e('0xfa')]=db[_0x6b4e('0x4')]['import'](_0x6b4e('0xfb'));db[_0x6b4e('0xfc')]=db[_0x6b4e('0x4')]['import'](_0x6b4e('0xfd'));db[_0x6b4e('0xfe')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0xff'));db[_0x6b4e('0x100')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x101'));db[_0x6b4e('0x102')]=db['sequelize'][_0x6b4e('0x13')](_0x6b4e('0x103'));db[_0x6b4e('0x104')]=db[_0x6b4e('0x4')][_0x6b4e('0x13')](_0x6b4e('0x105'));db[_0x6b4e('0x106')]=db[_0x6b4e('0x4')]['import'](_0x6b4e('0x107'));db['User'][_0x6b4e('0x108')](db[_0x6b4e('0x22')],{'as':_0x6b4e('0x22'),'onDelete':'cascade','foreignKey':_0x6b4e('0x109')});db[_0x6b4e('0x12')][_0x6b4e('0x10a')](db[_0x6b4e('0x1e')],{'as':'Recordings','foreignKey':'UserId'});db['User'][_0x6b4e('0x10a')](db['UserVoiceQueueRt'],{'as':_0x6b4e('0x10b'),'foreignKey':_0x6b4e('0x109')});db[_0x6b4e('0x12')][_0x6b4e('0x10a')](db['VoiceExtension'],{'as':_0x6b4e('0x10c'),'onDelete':_0x6b4e('0x10d'),'hooks':!![]});db[_0x6b4e('0x12')][_0x6b4e('0x10a')](db[_0x6b4e('0x71')],{'as':'HopperFinals','foreignKey':_0x6b4e('0x109')});db['User'][_0x6b4e('0x10a')](db[_0x6b4e('0x73')],{'as':'HopperHistory','foreignKey':_0x6b4e('0x109')});db[_0x6b4e('0x12')]['hasMany'](db[_0x6b4e('0x75')],{'as':'ReportAgentPreview','foreignKey':_0x6b4e('0x109')});db['User'][_0x6b4e('0x10a')](db[_0x6b4e('0x59')],{'as':_0x6b4e('0x10e'),'foreignKey':'UserId'});db[_0x6b4e('0x12')]['hasMany'](db[_0x6b4e('0x63')],{'as':_0x6b4e('0x10f'),'foreignKey':_0x6b4e('0x109')});db[_0x6b4e('0x12')]['hasMany'](db[_0x6b4e('0x110')],{'as':_0x6b4e('0x111'),'foreignKey':_0x6b4e('0x109')});db[_0x6b4e('0x12')][_0x6b4e('0x10a')](db[_0x6b4e('0x49')],{'as':_0x6b4e('0x112'),'foreignKey':'UserId'});db['User'][_0x6b4e('0x10a')](db['MailInteraction'],{'as':_0x6b4e('0x113'),'foreignKey':_0x6b4e('0x109')});db['User'][_0x6b4e('0x10a')](db[_0x6b4e('0xf8')],{'as':_0x6b4e('0x114'),'foreignKey':_0x6b4e('0x109')});db[_0x6b4e('0x12')][_0x6b4e('0x10a')](db[_0x6b4e('0xf3')],{'as':_0x6b4e('0x115'),'foreignKey':'SenderId'});db[_0x6b4e('0x12')][_0x6b4e('0x116')](db[_0x6b4e('0x117')],{'as':_0x6b4e('0x117'),'foreignKey':'userProfileId'});db['User'][_0x6b4e('0x118')](db[_0x6b4e('0x119')],{'as':_0x6b4e('0x11a'),'through':'chat_group_has_users'});db[_0x6b4e('0x12')][_0x6b4e('0x118')](db[_0x6b4e('0x6c')],{'as':_0x6b4e('0x11b'),'through':'cm_user_has_contacts'});db[_0x6b4e('0x12')][_0x6b4e('0x118')](db[_0x6b4e('0xeb')],{'as':_0x6b4e('0x11c'),'through':_0x6b4e('0x11d')});db[_0x6b4e('0x12')][_0x6b4e('0x118')](db['Team'],{'through':'user_has_teams'});db[_0x6b4e('0x12')][_0x6b4e('0x118')](db['MailInteraction'],{'as':'MailInteractions','through':_0x6b4e('0x11e')});db['User'][_0x6b4e('0x118')](db[_0x6b4e('0x63')],{'as':_0x6b4e('0x10f'),'through':_0x6b4e('0x11f')});db[_0x6b4e('0x12')][_0x6b4e('0x118')](db[_0x6b4e('0x49')],{'as':_0x6b4e('0x112'),'through':'user_has_fax_interactions'});db[_0x6b4e('0x12')][_0x6b4e('0x118')](db[_0x6b4e('0x110')],{'as':_0x6b4e('0x111'),'through':_0x6b4e('0x120')});db[_0x6b4e('0x12')][_0x6b4e('0x118')](db[_0x6b4e('0x59')],{'as':_0x6b4e('0x10e'),'through':'user_has_openchannel_interactions'});db['User'][_0x6b4e('0x118')](db['WhatsappInteraction'],{'as':_0x6b4e('0x114'),'through':_0x6b4e('0x121')});db['User'][_0x6b4e('0x118')](db[_0x6b4e('0x1d')],{'as':_0x6b4e('0x122'),'through':_0x6b4e('0x123'),'required':![]});db[_0x6b4e('0x12')][_0x6b4e('0x118')](db['VoicePrefix'],{'as':'VoicePrefixes','through':_0x6b4e('0x106'),'required':![]});db[_0x6b4e('0x12')][_0x6b4e('0x118')](db[_0x6b4e('0x124')],{'as':'MailQueues','through':_0x6b4e('0x2e'),'required':![]});db[_0x6b4e('0x12')][_0x6b4e('0x118')](db[_0x6b4e('0x67')],{'as':_0x6b4e('0x125'),'through':_0x6b4e('0x2c'),'required':![],'hooks':!![]});db[_0x6b4e('0x12')][_0x6b4e('0x118')](db['FaxQueue'],{'as':_0x6b4e('0x126'),'through':'UserFaxQueue','required':![]});db[_0x6b4e('0x12')][_0x6b4e('0x118')](db['SmsQueue'],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db[_0x6b4e('0x12')][_0x6b4e('0x118')](db['OpenchannelQueue'],{'as':_0x6b4e('0x127'),'through':'UserOpenchannelQueue','required':![]});db[_0x6b4e('0x12')][_0x6b4e('0x118')](db[_0x6b4e('0xfe')],{'as':_0x6b4e('0x128'),'through':_0x6b4e('0x34'),'required':![]});db[_0x6b4e('0x12')]['belongsToMany'](db[_0x6b4e('0xeb')],{'through':_0x6b4e('0x11d')});db['User']['belongsToMany'](db[_0x6b4e('0x129')],{'as':_0x6b4e('0x12a'),'through':_0x6b4e('0x12b')});db['User']['belongsToMany'](db[_0x6b4e('0x12c')],{'as':'FaxAccounts','through':_0x6b4e('0x12d')});db[_0x6b4e('0x12')][_0x6b4e('0x118')](db['MailAccount'],{'as':_0x6b4e('0x12e'),'through':_0x6b4e('0x12f')});db[_0x6b4e('0x12')][_0x6b4e('0x118')](db['OpenchannelAccount'],{'as':_0x6b4e('0x130'),'through':_0x6b4e('0x131')});db[_0x6b4e('0x12')][_0x6b4e('0x118')](db[_0x6b4e('0x50')],{'as':_0x6b4e('0x132'),'through':_0x6b4e('0x133')});db['User'][_0x6b4e('0x118')](db[_0x6b4e('0x134')],{'as':_0x6b4e('0x135'),'through':'user_has_whatsapp_accounts'});db[_0x6b4e('0x12')][_0x6b4e('0x118')](db[_0x6b4e('0xd5')],{'as':'SquareProjects','through':_0x6b4e('0x136')});db[_0x6b4e('0x15')]['hasMany'](db['VoiceExtension'],{'as':_0x6b4e('0x137'),'onDelete':_0x6b4e('0x10d'),'foreignKey':'ChanSpyId'});db[_0x6b4e('0x17')]['hasMany'](db[_0x6b4e('0x19')],{'onDelete':'cascade'});db[_0x6b4e('0x19')][_0x6b4e('0x10a')](db['VoiceExtension'],{'as':_0x6b4e('0x138'),'onDelete':_0x6b4e('0x10d')});db['VoiceMusicOnHold'][_0x6b4e('0x118')](db[_0x6b4e('0x87')],{'as':'Sounds','through':_0x6b4e('0x139')});db[_0x6b4e('0x1d')][_0x6b4e('0x10a')](db[_0x6b4e('0x13a')],{'as':_0x6b4e('0x13b'),'foreignKey':_0x6b4e('0x13c')});db['VoiceQueue']['hasMany'](db[_0x6b4e('0x6d')],{'as':_0x6b4e('0x13d'),'foreignKey':_0x6b4e('0x13c')});db[_0x6b4e('0x1d')][_0x6b4e('0x10a')](db[_0x6b4e('0x71')],{'as':_0x6b4e('0x13e'),'foreignKey':'VoiceQueueId'});db[_0x6b4e('0x1d')][_0x6b4e('0x10a')](db['CmHopperHistory'],{'as':_0x6b4e('0x13f'),'foreignKey':'VoiceQueueId'});db[_0x6b4e('0x1d')][_0x6b4e('0x10a')](db[_0x6b4e('0x75')],{'as':_0x6b4e('0x75'),'foreignKey':'VoiceQueueId'});db[_0x6b4e('0x1d')]['hasMany'](db[_0x6b4e('0x6f')],{'as':_0x6b4e('0x140'),'foreignKey':_0x6b4e('0x13c')});db[_0x6b4e('0x1d')][_0x6b4e('0x10a')](db[_0x6b4e('0x141')],{'as':_0x6b4e('0x142'),'foreignKey':_0x6b4e('0x13c')});db['VoiceQueue']['belongsTo'](db[_0x6b4e('0x29')],{'as':_0x6b4e('0x29'),'foreignKey':'TrunkId'});db[_0x6b4e('0x1d')][_0x6b4e('0x116')](db[_0x6b4e('0x29')],{'as':_0x6b4e('0x143'),'foreignKey':'TrunkBackupId'});db[_0x6b4e('0x1d')][_0x6b4e('0x116')](db['Interval'],{'as':_0x6b4e('0x7e'),'foreignKey':_0x6b4e('0x144')});db[_0x6b4e('0x1d')][_0x6b4e('0x116')](db[_0x6b4e('0x80')],{'as':_0x6b4e('0x145'),'foreignKey':_0x6b4e('0x146')});db['VoiceQueue'][_0x6b4e('0x118')](db[_0x6b4e('0xeb')],{'as':_0x6b4e('0x11c'),'through':'voice_queues_has_cm_lists'});db[_0x6b4e('0x1d')][_0x6b4e('0x118')](db['User'],{'as':_0x6b4e('0x147'),'through':_0x6b4e('0x123')});db[_0x6b4e('0x1d')]['belongsToMany'](db[_0x6b4e('0xdb')],{'as':_0x6b4e('0x148'),'through':_0x6b4e('0x102')});db['VoiceQueue'][_0x6b4e('0x118')](db[_0x6b4e('0xeb')],{'as':_0x6b4e('0x149'),'through':_0x6b4e('0x14a')});db['VoiceRecording'][_0x6b4e('0x116')](db['User'],{'as':_0x6b4e('0x12'),'foreignKey':_0x6b4e('0x109')});db[_0x6b4e('0x20')][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x12'),'foreignKey':_0x6b4e('0x109')});db[_0x6b4e('0x22')]['hasMany'](db[_0x6b4e('0x23')],{'as':_0x6b4e('0x14b'),'onDelete':_0x6b4e('0x10d'),'foreignKey':_0x6b4e('0x14c'),'sourceKey':'mailbox'});db['VoiceMailMessage'][_0x6b4e('0x116')](db['VoiceMail'],{'foreignKey':_0x6b4e('0x14c'),'targetKey':'mailbox'});db['VoiceCallReport']['hasMany'](db[_0x6b4e('0x27')],{'as':_0x6b4e('0x14d'),'foreignKey':_0x6b4e('0x14e'),'constraints':![]});db['VoiceCallReport'][_0x6b4e('0x10a')](db[_0x6b4e('0x14f')],{'as':_0x6b4e('0x150'),'foreignKey':_0x6b4e('0x14e'),'constraints':![]});db[_0x6b4e('0x151')][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x12'),'foreignKey':_0x6b4e('0x109')});db['VoiceCallReport'][_0x6b4e('0x116')](db['CmContact'],{'as':_0x6b4e('0x152'),'foreignKey':_0x6b4e('0x153')});db[_0x6b4e('0x36')][_0x6b4e('0x116')](db[_0x6b4e('0x154')],{'as':_0x6b4e('0x154'),'foreignKey':'MailAccountId'});db[_0x6b4e('0x155')][_0x6b4e('0x116')](db[_0x6b4e('0x154')],{'as':_0x6b4e('0x154'),'foreignKey':_0x6b4e('0x156')});db[_0x6b4e('0x154')]['hasOne'](db[_0x6b4e('0x36')],{'as':_0x6b4e('0x157'),'onDelete':_0x6b4e('0x10d')});db[_0x6b4e('0x154')]['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x6b4e('0x10d')});db[_0x6b4e('0x154')][_0x6b4e('0x10a')](db[_0x6b4e('0x7b')],{'as':_0x6b4e('0x158'),'foreignKey':_0x6b4e('0x156'),'onDelete':'cascade'});db[_0x6b4e('0x154')][_0x6b4e('0x10a')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x6b4e('0x156')});db['MailAccount'][_0x6b4e('0x10a')](db['MailMessage'],{'as':_0x6b4e('0x14b'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x6b4e('0x10a')](db['MailInteraction'],{'as':_0x6b4e('0x159')});db['MailAccount'][_0x6b4e('0x10a')](db[_0x6b4e('0x15a')],{'as':_0x6b4e('0x138')});db[_0x6b4e('0x154')]['belongsTo'](db[_0x6b4e('0xeb')],{'as':_0x6b4e('0x15b'),'foreignKey':_0x6b4e('0x15c')});db['MailAccount']['belongsTo'](db[_0x6b4e('0x89')],{'as':'Template','foreignKey':_0x6b4e('0x15d')});db[_0x6b4e('0x154')]['belongsTo'](db['Pause'],{'as':_0x6b4e('0x145'),'foreignKey':_0x6b4e('0x146')});db[_0x6b4e('0x154')]['belongsToMany'](db['User'],{'as':_0x6b4e('0x147'),'through':_0x6b4e('0x12f')});db['MailQueue'][_0x6b4e('0x118')](db['User'],{'as':_0x6b4e('0x147'),'through':'UserMailQueue'});db[_0x6b4e('0x124')][_0x6b4e('0x118')](db['Team'],{'through':_0x6b4e('0x15e'),'as':'Teams'});db[_0x6b4e('0x3d')][_0x6b4e('0x10a')](db[_0x6b4e('0x3f')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x6b4e('0x15f')});db[_0x6b4e('0x3d')]['belongsTo'](db[_0x6b4e('0x154')],{'as':_0x6b4e('0x160'),'foreignKey':'MailAccountId'});db[_0x6b4e('0x3d')][_0x6b4e('0x116')](db[_0x6b4e('0x6c')],{'as':_0x6b4e('0x152'),'foreignKey':_0x6b4e('0x153')});db[_0x6b4e('0x3d')][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'as':'Owner','foreignKey':'UserId'});db[_0x6b4e('0x3d')][_0x6b4e('0x118')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x6b4e('0x161')});db[_0x6b4e('0x3d')][_0x6b4e('0x118')](db[_0x6b4e('0x162')],{'through':_0x6b4e('0x163'),'as':_0x6b4e('0x164')});db[_0x6b4e('0x3d')][_0x6b4e('0x118')](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x165'),'through':_0x6b4e('0x11e'),'foreignKey':'MailInteractionId'});db[_0x6b4e('0x3f')]['hasMany'](db[_0x6b4e('0xe0')],{'as':_0x6b4e('0x166'),'onDelete':_0x6b4e('0x10d')});db[_0x6b4e('0x3f')]['belongsTo'](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x12')});db[_0x6b4e('0x3f')][_0x6b4e('0x116')](db[_0x6b4e('0x6c')],{'onDelete':_0x6b4e('0x10d'),'as':_0x6b4e('0x152')});db[_0x6b4e('0x3f')][_0x6b4e('0x116')](db['MailInteraction'],{'as':_0x6b4e('0x167'),'foreignKey':'MailInteractionId'});db[_0x6b4e('0x3f')]['belongsTo'](db[_0x6b4e('0x154')],{'as':_0x6b4e('0x160'),'foreignKey':_0x6b4e('0x156')});db['MailMessage'][_0x6b4e('0x116')](db[_0x6b4e('0x129')],{'as':_0x6b4e('0x129'),'foreignKey':_0x6b4e('0x168')});db[_0x6b4e('0x3f')]['belongsTo'](db[_0x6b4e('0x169')],{'as':_0x6b4e('0x169'),'foreignKey':'ChatOfflineMessageId'});db['MailApplication'][_0x6b4e('0x116')](db['User'],{'onDelete':_0x6b4e('0x16a')});db[_0x6b4e('0x15a')]['belongsTo'](db[_0x6b4e('0x124')],{'onDelete':_0x6b4e('0x16a')});db['MailApplication'][_0x6b4e('0x116')](db[_0x6b4e('0x154')],{'onDelete':_0x6b4e('0x16a')});db[_0x6b4e('0x15a')][_0x6b4e('0x116')](db[_0x6b4e('0x7e')],{'onDelete':_0x6b4e('0x16a'),'foreignKey':_0x6b4e('0x144')});db[_0x6b4e('0x15a')]['belongsTo'](db['Tag'],{'onDelete':_0x6b4e('0x16a'),'foreignKey':_0x6b4e('0x16b')});db[_0x6b4e('0x42')]['belongsTo'](db[_0x6b4e('0x154')],{});db[_0x6b4e('0x42')][_0x6b4e('0x116')](db[_0x6b4e('0xeb')],{'as':_0x6b4e('0x15b'),'foreignKey':_0x6b4e('0x15c')});db[_0x6b4e('0x42')]['belongsTo'](db[_0x6b4e('0x6c')],{'as':_0x6b4e('0x152'),'foreignKey':_0x6b4e('0x153')});db[_0x6b4e('0x42')][_0x6b4e('0x116')](db[_0x6b4e('0x3d')],{});db[_0x6b4e('0x42')][_0x6b4e('0x116')](db[_0x6b4e('0x3f')],{});db[_0x6b4e('0x42')][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{});db[_0x6b4e('0x42')][_0x6b4e('0x116')](db[_0x6b4e('0x124')],{});db[_0x6b4e('0x43')][_0x6b4e('0x10a')](db['DashboardItem'],{'as':'Items','onDelete':_0x6b4e('0x10d')});db[_0x6b4e('0x12c')][_0x6b4e('0x10a')](db[_0x6b4e('0x7b')],{'as':_0x6b4e('0x158'),'foreignKey':_0x6b4e('0x16c'),'onDelete':_0x6b4e('0x10d')});db[_0x6b4e('0x12c')][_0x6b4e('0x10a')](db[_0x6b4e('0x79')],{'as':_0x6b4e('0x16d'),'foreignKey':_0x6b4e('0x16c')});db[_0x6b4e('0x12c')][_0x6b4e('0x10a')](db[_0x6b4e('0x49')],{'as':_0x6b4e('0x159')});db[_0x6b4e('0x12c')][_0x6b4e('0x10a')](db[_0x6b4e('0x47')],{'as':'Applications'});db['FaxAccount'][_0x6b4e('0x10a')](db[_0x6b4e('0x19')],{'as':_0x6b4e('0x16e'),'onDelete':'cascade'});db[_0x6b4e('0x12c')][_0x6b4e('0x10a')](db[_0x6b4e('0x4b')],{'as':_0x6b4e('0x14b')});db['FaxAccount'][_0x6b4e('0x116')](db['Trunk'],{'as':_0x6b4e('0x29')});db[_0x6b4e('0x12c')][_0x6b4e('0x116')](db[_0x6b4e('0xeb')],{'as':_0x6b4e('0x15b'),'foreignKey':_0x6b4e('0x15c')});db['FaxAccount'][_0x6b4e('0x116')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x6b4e('0x146')});db['FaxAccount'][_0x6b4e('0x118')](db['User'],{'as':_0x6b4e('0x147'),'through':_0x6b4e('0x12d')});db[_0x6b4e('0x47')][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'onDelete':_0x6b4e('0x16a')});db[_0x6b4e('0x47')][_0x6b4e('0x116')](db[_0x6b4e('0x4d')],{'onDelete':_0x6b4e('0x16a')});db[_0x6b4e('0x47')][_0x6b4e('0x116')](db[_0x6b4e('0x12c')],{'onDelete':'restrict'});db[_0x6b4e('0x47')][_0x6b4e('0x116')](db[_0x6b4e('0x162')],{'onDelete':'restrict','foreignKey':_0x6b4e('0x16b')});db[_0x6b4e('0x49')][_0x6b4e('0x10a')](db['FaxMessage'],{'as':_0x6b4e('0x14b'),'onDelete':_0x6b4e('0x10d'),'foreignKey':_0x6b4e('0x16f')});db['FaxInteraction'][_0x6b4e('0x116')](db[_0x6b4e('0x12c')],{'as':_0x6b4e('0x160'),'foreignKey':_0x6b4e('0x16c')});db[_0x6b4e('0x49')][_0x6b4e('0x116')](db[_0x6b4e('0x6c')],{'as':_0x6b4e('0x152'),'foreignKey':'ContactId'});db['FaxInteraction'][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x170'),'foreignKey':'UserId'});db['FaxInteraction'][_0x6b4e('0x118')](db['Tag'],{'through':_0x6b4e('0x171'),'as':'Tags'});db[_0x6b4e('0x49')]['belongsToMany'](db[_0x6b4e('0x162')],{'through':'fax_interaction_has_tags','as':_0x6b4e('0x164')});db[_0x6b4e('0x49')][_0x6b4e('0x118')](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x165'),'through':_0x6b4e('0x172'),'foreignKey':_0x6b4e('0x16f')});db[_0x6b4e('0x4b')][_0x6b4e('0x116')](db['User'],{'onDelete':'cascade','as':_0x6b4e('0x12')});db[_0x6b4e('0x4b')][_0x6b4e('0x116')](db[_0x6b4e('0x49')],{'as':'Interaction','foreignKey':_0x6b4e('0x16f')});db[_0x6b4e('0x4b')][_0x6b4e('0x116')](db[_0x6b4e('0x6c')],{'onDelete':_0x6b4e('0x10d'),'as':_0x6b4e('0x152')});db['FaxMessage']['belongsTo'](db[_0x6b4e('0xe0')],{'as':'Attachment','foreignKey':_0x6b4e('0x173')});db[_0x6b4e('0x4b')][_0x6b4e('0x116')](db['FaxAccount'],{'as':_0x6b4e('0x160'),'foreignKey':_0x6b4e('0x16c')});db['FaxQueue']['belongsToMany'](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x147'),'through':'UserFaxQueue'});db[_0x6b4e('0x4d')]['belongsToMany'](db[_0x6b4e('0xdb')],{'through':_0x6b4e('0x174'),'as':_0x6b4e('0x148')});db[_0x6b4e('0x4e')][_0x6b4e('0x116')](db[_0x6b4e('0x12c')],{});db[_0x6b4e('0x4e')]['belongsTo'](db[_0x6b4e('0xeb')],{'as':_0x6b4e('0x15b'),'foreignKey':_0x6b4e('0x15c')});db[_0x6b4e('0x4e')][_0x6b4e('0x116')](db[_0x6b4e('0x6c')],{'as':_0x6b4e('0x152'),'foreignKey':_0x6b4e('0x153')});db[_0x6b4e('0x4e')][_0x6b4e('0x116')](db[_0x6b4e('0x49')],{});db[_0x6b4e('0x4e')][_0x6b4e('0x116')](db[_0x6b4e('0x4b')],{});db[_0x6b4e('0x4e')][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{});db[_0x6b4e('0x4e')][_0x6b4e('0x116')](db[_0x6b4e('0x4d')],{});db[_0x6b4e('0x50')][_0x6b4e('0x10a')](db['Disposition'],{'as':_0x6b4e('0x158'),'foreignKey':_0x6b4e('0x175'),'onDelete':'cascade'});db['SmsAccount'][_0x6b4e('0x10a')](db[_0x6b4e('0x79')],{'as':'Answers','foreignKey':'SmsAccountId'});db[_0x6b4e('0x50')][_0x6b4e('0x10a')](db[_0x6b4e('0x176')],{'as':'Messages','foreignKey':_0x6b4e('0x175')});db[_0x6b4e('0x50')][_0x6b4e('0x10a')](db[_0x6b4e('0x110')],{'as':_0x6b4e('0x159')});db[_0x6b4e('0x50')][_0x6b4e('0x10a')](db['SmsApplication'],{'as':_0x6b4e('0x138')});db[_0x6b4e('0x50')][_0x6b4e('0x116')](db[_0x6b4e('0xeb')],{'as':_0x6b4e('0x15b'),'foreignKey':_0x6b4e('0x15c')});db[_0x6b4e('0x50')][_0x6b4e('0x116')](db[_0x6b4e('0x80')],{'as':'mandatoryDispositionPause','foreignKey':_0x6b4e('0x146')});db[_0x6b4e('0x50')][_0x6b4e('0x118')](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x147'),'through':_0x6b4e('0x133')});db['SmsApplication'][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'onDelete':_0x6b4e('0x16a')});db[_0x6b4e('0x51')][_0x6b4e('0x116')](db[_0x6b4e('0x55')],{'onDelete':_0x6b4e('0x16a')});db['SmsApplication'][_0x6b4e('0x116')](db['SmsAccount'],{'onDelete':_0x6b4e('0x16a')});db['SmsApplication'][_0x6b4e('0x116')](db[_0x6b4e('0x7e')],{'onDelete':_0x6b4e('0x16a'),'foreignKey':_0x6b4e('0x144')});db['SmsApplication'][_0x6b4e('0x116')](db[_0x6b4e('0x162')],{'onDelete':'restrict','foreignKey':_0x6b4e('0x16b')});db[_0x6b4e('0x110')][_0x6b4e('0x10a')](db[_0x6b4e('0x176')],{'as':_0x6b4e('0x14b'),'onDelete':'cascade','foreignKey':_0x6b4e('0x177')});db['SmsInteraction'][_0x6b4e('0x116')](db[_0x6b4e('0x50')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0x6b4e('0x110')][_0x6b4e('0x116')](db[_0x6b4e('0x6c')],{'as':_0x6b4e('0x152'),'foreignKey':_0x6b4e('0x153')});db['SmsInteraction'][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x170'),'foreignKey':_0x6b4e('0x109')});db[_0x6b4e('0x110')][_0x6b4e('0x118')](db[_0x6b4e('0x162')],{'through':'sms_interaction_has_tags','as':_0x6b4e('0x161')});db[_0x6b4e('0x110')][_0x6b4e('0x118')](db[_0x6b4e('0x162')],{'through':_0x6b4e('0x178'),'as':_0x6b4e('0x164')});db[_0x6b4e('0x110')]['belongsToMany'](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x165'),'through':'user_has_sms_interactions','foreignKey':_0x6b4e('0x177')});db[_0x6b4e('0x176')]['belongsTo'](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x12')});db[_0x6b4e('0x176')][_0x6b4e('0x116')](db[_0x6b4e('0x6c')],{'onDelete':_0x6b4e('0x10d'),'as':_0x6b4e('0x152')});db[_0x6b4e('0x176')]['belongsTo'](db[_0x6b4e('0x110')],{'onDelete':'cascade','as':_0x6b4e('0x167'),'foreignKey':_0x6b4e('0x177')});db[_0x6b4e('0x176')]['belongsTo'](db[_0x6b4e('0x50')],{'as':_0x6b4e('0x160'),'foreignKey':_0x6b4e('0x175')});db[_0x6b4e('0x55')][_0x6b4e('0x118')](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x147'),'through':_0x6b4e('0x30'),'foreignKey':_0x6b4e('0x179')});db[_0x6b4e('0x55')]['belongsToMany'](db[_0x6b4e('0xdb')],{'through':_0x6b4e('0x17a'),'as':'Teams'});db[_0x6b4e('0x57')][_0x6b4e('0x10a')](db[_0x6b4e('0x7b')],{'as':_0x6b4e('0x158'),'foreignKey':_0x6b4e('0x17b'),'onDelete':'cascade'});db[_0x6b4e('0x57')][_0x6b4e('0x10a')](db[_0x6b4e('0x79')],{'as':_0x6b4e('0x16d'),'foreignKey':_0x6b4e('0x17b')});db[_0x6b4e('0x57')][_0x6b4e('0x10a')](db['OpenchannelInteraction'],{'as':'Interactions','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x6b4e('0x10a')](db[_0x6b4e('0x5b')],{'as':_0x6b4e('0x14b'),'foreignKey':_0x6b4e('0x17b')});db[_0x6b4e('0x57')][_0x6b4e('0x10a')](db[_0x6b4e('0x58')],{'as':_0x6b4e('0x138'),'foreignKey':_0x6b4e('0x17b')});db[_0x6b4e('0x57')][_0x6b4e('0x116')](db[_0x6b4e('0xeb')],{'as':'List','foreignKey':_0x6b4e('0x15c')});db[_0x6b4e('0x57')]['belongsTo'](db[_0x6b4e('0x80')],{'as':_0x6b4e('0x145'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x6b4e('0x57')][_0x6b4e('0x118')](db[_0x6b4e('0x12')],{'as':'Agents','through':'user_has_openchannel_accounts'});db[_0x6b4e('0x58')][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'onDelete':_0x6b4e('0x16a')});db['OpenchannelApplication']['belongsTo'](db['OpenchannelQueue'],{'onDelete':_0x6b4e('0x16a'),'foreignKey':_0x6b4e('0x17c')});db['OpenchannelApplication'][_0x6b4e('0x116')](db[_0x6b4e('0x57')],{'onDelete':_0x6b4e('0x16a'),'foreignKey':'OpenchannelAccountId'});db[_0x6b4e('0x58')]['belongsTo'](db['Interval'],{'onDelete':_0x6b4e('0x16a'),'foreignKey':_0x6b4e('0x144')});db[_0x6b4e('0x58')][_0x6b4e('0x116')](db[_0x6b4e('0x162')],{'onDelete':_0x6b4e('0x16a'),'foreignKey':_0x6b4e('0x16b')});db['OpenchannelInteraction'][_0x6b4e('0x10a')](db['OpenchannelMessage'],{'as':_0x6b4e('0x14b'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0x6b4e('0x59')][_0x6b4e('0x116')](db[_0x6b4e('0x57')],{'as':_0x6b4e('0x160'),'foreignKey':_0x6b4e('0x17b')});db['OpenchannelInteraction'][_0x6b4e('0x116')](db[_0x6b4e('0x6c')],{'as':_0x6b4e('0x152'),'foreignKey':_0x6b4e('0x153')});db['OpenchannelInteraction'][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x170'),'foreignKey':_0x6b4e('0x109')});db[_0x6b4e('0x59')]['belongsToMany'](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x6b4e('0x161')});db['OpenchannelInteraction'][_0x6b4e('0x118')](db[_0x6b4e('0x162')],{'through':_0x6b4e('0x17d'),'as':_0x6b4e('0x164')});db[_0x6b4e('0x59')]['belongsToMany'](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x165'),'through':'user_has_openchannel_interactions','foreignKey':_0x6b4e('0x17e')});db[_0x6b4e('0x5b')][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'onDelete':_0x6b4e('0x10d'),'as':'User'});db[_0x6b4e('0x5b')][_0x6b4e('0x116')](db[_0x6b4e('0x6c')],{'onDelete':'cascade','as':_0x6b4e('0x152')});db[_0x6b4e('0x5b')][_0x6b4e('0x116')](db[_0x6b4e('0x59')],{'onDelete':'cascade','as':_0x6b4e('0x167'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage']['belongsTo'](db[_0x6b4e('0xe0')],{'as':_0x6b4e('0xe0'),'foreignKey':_0x6b4e('0x173')});db[_0x6b4e('0x5b')][_0x6b4e('0x116')](db[_0x6b4e('0x57')],{'as':'Account','foreignKey':_0x6b4e('0x17b')});db[_0x6b4e('0x5d')][_0x6b4e('0x118')](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x147'),'through':'UserOpenchannelQueue','foreignKey':_0x6b4e('0x17c')});db['OpenchannelQueue']['belongsToMany'](db[_0x6b4e('0xdb')],{'through':'team_has_openchannel_queues','as':_0x6b4e('0x148')});db[_0x6b4e('0x129')]['hasMany'](db[_0x6b4e('0x7b')],{'as':_0x6b4e('0x158'),'foreignKey':'ChatWebsiteId','onDelete':_0x6b4e('0x10d')});db['ChatWebsite'][_0x6b4e('0x10a')](db[_0x6b4e('0x79')],{'as':'Answers','foreignKey':_0x6b4e('0x168')});db['ChatWebsite']['hasMany'](db[_0x6b4e('0x17f')],{'as':_0x6b4e('0x180')});db[_0x6b4e('0x129')]['hasMany'](db[_0x6b4e('0x63')],{'as':_0x6b4e('0x159')});db[_0x6b4e('0x129')]['hasMany'](db[_0x6b4e('0x61')],{'as':_0x6b4e('0x138')});db[_0x6b4e('0x129')][_0x6b4e('0x10a')](db[_0x6b4e('0x64')],{'as':'Messages'});db['ChatWebsite'][_0x6b4e('0x116')](db[_0x6b4e('0xeb')],{'as':_0x6b4e('0x15b'),'foreignKey':_0x6b4e('0x15c')});db['ChatWebsite'][_0x6b4e('0x116')](db[_0x6b4e('0x7e')],{'as':_0x6b4e('0x7e'),'foreignKey':_0x6b4e('0x144')});db[_0x6b4e('0x129')]['belongsTo'](db[_0x6b4e('0x154')],{'as':_0x6b4e('0x154'),'foreignKey':_0x6b4e('0x156')});db['ChatWebsite']['belongsTo'](db[_0x6b4e('0x80')],{'as':'mandatoryDispositionPause','foreignKey':_0x6b4e('0x146')});db[_0x6b4e('0x129')][_0x6b4e('0x118')](db['User'],{'as':'Agents','through':_0x6b4e('0x12b')});db[_0x6b4e('0x5f')][_0x6b4e('0x116')](db[_0x6b4e('0x57')],{});db[_0x6b4e('0x5f')][_0x6b4e('0x116')](db[_0x6b4e('0xeb')],{'as':'List','foreignKey':_0x6b4e('0x15c')});db[_0x6b4e('0x5f')][_0x6b4e('0x116')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x6b4e('0x5f')][_0x6b4e('0x116')](db[_0x6b4e('0x59')],{});db[_0x6b4e('0x5f')][_0x6b4e('0x116')](db[_0x6b4e('0x5b')],{});db[_0x6b4e('0x5f')]['belongsTo'](db[_0x6b4e('0x12')],{});db['OpenchannelQueueReport'][_0x6b4e('0x116')](db[_0x6b4e('0x5d')],{});db['ChatApplication'][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x181'),'foreignKey':_0x6b4e('0x109'),'onDelete':_0x6b4e('0x16a')});db[_0x6b4e('0x61')][_0x6b4e('0x116')](db[_0x6b4e('0x67')],{'as':'Queue','foreignKey':_0x6b4e('0x182'),'onDelete':_0x6b4e('0x16a')});db[_0x6b4e('0x61')]['belongsTo'](db[_0x6b4e('0x129')],{'as':_0x6b4e('0x183'),'foreignKey':_0x6b4e('0x168'),'onDelete':_0x6b4e('0x16a')});db[_0x6b4e('0x61')][_0x6b4e('0x116')](db['Tag'],{'onDelete':_0x6b4e('0x16a'),'foreignKey':_0x6b4e('0x16b')});db[_0x6b4e('0x63')][_0x6b4e('0x10a')](db[_0x6b4e('0x64')],{'as':_0x6b4e('0x14b'),'onDelete':_0x6b4e('0x10d'),'foreignKey':'ChatInteractionId'});db[_0x6b4e('0x63')][_0x6b4e('0x116')](db[_0x6b4e('0x129')],{'as':'Account','foreignKey':_0x6b4e('0x168')});db[_0x6b4e('0x63')][_0x6b4e('0x116')](db[_0x6b4e('0x6c')],{'as':_0x6b4e('0x152'),'foreignKey':_0x6b4e('0x153')});db['ChatInteraction']['belongsTo'](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x170'),'foreignKey':_0x6b4e('0x109')});db[_0x6b4e('0x63')][_0x6b4e('0x118')](db[_0x6b4e('0x162')],{'through':_0x6b4e('0x184'),'as':_0x6b4e('0x161')});db[_0x6b4e('0x63')][_0x6b4e('0x118')](db['Tag'],{'through':_0x6b4e('0x184'),'as':_0x6b4e('0x164')});db['ChatInteraction'][_0x6b4e('0x118')](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x165'),'through':_0x6b4e('0x11f'),'foreignKey':_0x6b4e('0x185')});db[_0x6b4e('0x64')]['belongsTo'](db[_0x6b4e('0x12')],{'onDelete':'cascade','as':'User'});db[_0x6b4e('0x64')][_0x6b4e('0x116')](db[_0x6b4e('0x6c')],{'onDelete':_0x6b4e('0x10d'),'as':'Contact','foreignKey':'ContactId'});db['ChatMessage']['belongsTo'](db[_0x6b4e('0x63')],{'onDelete':'cascade','as':_0x6b4e('0x167'),'foreignKey':'ChatInteractionId'});db['ChatMessage']['belongsTo'](db[_0x6b4e('0xe0')],{'as':_0x6b4e('0xe0'),'foreignKey':_0x6b4e('0x173')});db[_0x6b4e('0x64')][_0x6b4e('0x116')](db[_0x6b4e('0x129')],{'as':'Account','foreignKey':_0x6b4e('0x168')});db[_0x6b4e('0x169')][_0x6b4e('0x10a')](db[_0x6b4e('0xe0')],{'as':_0x6b4e('0x166'),'foreignKey':_0x6b4e('0x186'),'onDelete':'cascade','hooks':!![]});db[_0x6b4e('0x169')][_0x6b4e('0x116')](db[_0x6b4e('0x6c')],{'onDelete':_0x6b4e('0x10d'),'as':_0x6b4e('0x152'),'foreignKey':'ContactId'});db['ChatOfflineMessage'][_0x6b4e('0x116')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x6b4e('0x168')});db['ChatQueue'][_0x6b4e('0x118')](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x147'),'through':_0x6b4e('0x2c'),'hooks':!![]});db[_0x6b4e('0x67')][_0x6b4e('0x118')](db[_0x6b4e('0xdb')],{'through':_0x6b4e('0x187'),'as':_0x6b4e('0x148')});db['ChatGroup']['hasMany'](db['ChatInternalMessage'],{'as':_0x6b4e('0x14b'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0x6b4e('0x119')]['belongsToMany'](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x13b'),'through':_0x6b4e('0x188')});db['ChatProactiveAction'][_0x6b4e('0x116')](db[_0x6b4e('0x129')],{'as':'Website','foreignKey':_0x6b4e('0x168')});db[_0x6b4e('0x189')][_0x6b4e('0x10a')](db[_0x6b4e('0x6c')],{'as':_0x6b4e('0x11b'),'foreignKey':_0x6b4e('0x18a')});db[_0x6b4e('0x6c')][_0x6b4e('0x10a')](db[_0x6b4e('0x6d')],{'as':'Hoppers','foreignKey':'ContactId'});db[_0x6b4e('0x6c')][_0x6b4e('0x10a')](db['CmHopperFinal'],{'as':_0x6b4e('0x13e'),'foreignKey':_0x6b4e('0x153')});db['CmContact'][_0x6b4e('0x10a')](db[_0x6b4e('0x73')],{'as':_0x6b4e('0x13f'),'foreignKey':'ContactId'});db[_0x6b4e('0x6c')][_0x6b4e('0x10a')](db[_0x6b4e('0x75')],{'as':'ReportAgentPreview','foreignKey':_0x6b4e('0x153')});db[_0x6b4e('0x6c')]['hasMany'](db[_0x6b4e('0x141')],{'as':_0x6b4e('0x142'),'foreignKey':'ContactId'});db[_0x6b4e('0x6c')][_0x6b4e('0x10a')](db['OpenchannelInteraction'],{'as':_0x6b4e('0x10e'),'foreignKey':'ContactId','onDelete':_0x6b4e('0x16a')});db[_0x6b4e('0x6c')]['hasMany'](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':_0x6b4e('0x16a')});db[_0x6b4e('0x6c')]['hasMany'](db[_0x6b4e('0x110')],{'as':_0x6b4e('0x111'),'foreignKey':_0x6b4e('0x153'),'onDelete':'restrict'});db[_0x6b4e('0x6c')]['hasMany'](db[_0x6b4e('0x49')],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':_0x6b4e('0x16a')});db[_0x6b4e('0x6c')][_0x6b4e('0x10a')](db[_0x6b4e('0x3d')],{'as':_0x6b4e('0x113'),'foreignKey':'ContactId','onDelete':_0x6b4e('0x16a')});db['CmContact']['belongsTo'](db[_0x6b4e('0x189')],{'as':_0x6b4e('0x18b'),'foreignKey':_0x6b4e('0x18a')});db['CmContact'][_0x6b4e('0x116')](db['CmList'],{'as':_0x6b4e('0x15b'),'foreignKey':_0x6b4e('0x15c'),'onDelete':_0x6b4e('0x10d')});db['CmContact']['belongsToMany'](db['User'],{'as':'Users','through':_0x6b4e('0x18c')});db[_0x6b4e('0x6c')][_0x6b4e('0x118')](db[_0x6b4e('0x162')],{'as':_0x6b4e('0x161'),'through':'cm_contact_has_tags'});db[_0x6b4e('0x6c')][_0x6b4e('0x118')](db['Tag'],{'through':_0x6b4e('0x18d'),'as':_0x6b4e('0x164')});db[_0x6b4e('0x6d')][_0x6b4e('0x116')](db['CmContact'],{'as':_0x6b4e('0x152'),'foreignKey':_0x6b4e('0x153'),'onDelete':_0x6b4e('0x10d')});db[_0x6b4e('0x6d')][_0x6b4e('0x116')](db[_0x6b4e('0xeb')],{'as':_0x6b4e('0x15b'),'foreignKey':_0x6b4e('0x15c'),'onDelete':_0x6b4e('0x10d')});db['CmHopper'][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x181'),'foreignKey':_0x6b4e('0x109')});db[_0x6b4e('0x6d')]['belongsTo'](db[_0x6b4e('0x1d')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x6b4e('0x10d')});db[_0x6b4e('0x6d')]['belongsTo'](db[_0x6b4e('0x18e')],{'as':_0x6b4e('0x18e'),'foreignKey':_0x6b4e('0x18f'),'onDelete':_0x6b4e('0x10d')});db[_0x6b4e('0x6d')]['belongsTo'](db['User'],{'as':_0x6b4e('0x170'),'foreignKey':'OwnerId'});db[_0x6b4e('0x6f')][_0x6b4e('0x116')](db[_0x6b4e('0x6c')],{'as':'Contact','foreignKey':_0x6b4e('0x153'),'onDelete':_0x6b4e('0x10d')});db[_0x6b4e('0x6f')][_0x6b4e('0x116')](db[_0x6b4e('0xeb')],{'as':_0x6b4e('0x15b'),'foreignKey':_0x6b4e('0x15c'),'onDelete':_0x6b4e('0x10d')});db[_0x6b4e('0x6f')][_0x6b4e('0x116')](db[_0x6b4e('0x1d')],{'as':_0x6b4e('0x190'),'foreignKey':'VoiceQueueId','onDelete':_0x6b4e('0x10d')});db['CmHopperBlack']['belongsTo'](db[_0x6b4e('0x18e')],{'as':_0x6b4e('0x18e'),'foreignKey':'CampaignId','onDelete':_0x6b4e('0x10d')});db[_0x6b4e('0x191')][_0x6b4e('0x10a')](db[_0x6b4e('0x7c')],{'as':{'plural':'All','singular':_0x6b4e('0x192')},'foreignKey':_0x6b4e('0x193'),'onDelete':_0x6b4e('0x10d'),'hooks':!![]});db[_0x6b4e('0x191')]['hasMany'](db[_0x6b4e('0x7c')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':_0x6b4e('0x194'),'onDelete':'cascade','hooks':!![]});db[_0x6b4e('0x191')][_0x6b4e('0x10a')](db[_0x6b4e('0x195')],{'as':_0x6b4e('0x196'),'foreignKey':_0x6b4e('0x197'),'onDelete':_0x6b4e('0x10d'),'hooks':!![]});db[_0x6b4e('0x7b')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x6b4e('0x198'),'onDelete':_0x6b4e('0x10d')});db[_0x6b4e('0x7e')][_0x6b4e('0x10a')](db['Interval'],{'as':_0x6b4e('0x199'),'foreignKey':'IntervalId','onDelete':_0x6b4e('0x10d'),'hooks':!![],'required':![]});db[_0x6b4e('0x7e')][_0x6b4e('0x10a')](db[_0x6b4e('0x19')],{'as':_0x6b4e('0x10c'),'foreignKey':'IntervalId','onDelete':_0x6b4e('0x16a')});db['Interval'][_0x6b4e('0x10a')](db[_0x6b4e('0x15a')],{'as':'MailApplications','foreignKey':_0x6b4e('0x144')});db[_0x6b4e('0x7e')][_0x6b4e('0x10a')](db[_0x6b4e('0x61')],{'as':_0x6b4e('0x19a'),'foreignKey':'IntervalId'});db['Interval'][_0x6b4e('0x10a')](db[_0x6b4e('0x47')],{'as':_0x6b4e('0x19b'),'foreignKey':_0x6b4e('0x144')});db[_0x6b4e('0x7e')][_0x6b4e('0x10a')](db['SmsApplication'],{'as':_0x6b4e('0x19c'),'foreignKey':_0x6b4e('0x144')});db[_0x6b4e('0x85')][_0x6b4e('0x116')](db[_0x6b4e('0x154')],{});db[_0x6b4e('0x85')][_0x6b4e('0x116')](db[_0x6b4e('0x8f')],{'foreignKey':_0x6b4e('0x19d')});db['Schedule'][_0x6b4e('0x116')](db['AnalyticCustomReport'],{'foreignKey':_0x6b4e('0x19e')});db[_0x6b4e('0x87')][_0x6b4e('0x118')](db['VoiceMusicOnHold'],{'as':_0x6b4e('0x19f'),'through':_0x6b4e('0x139'),'onDelete':_0x6b4e('0x16a')});db[_0x6b4e('0x162')][_0x6b4e('0x118')](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0x6b4e('0x162')][_0x6b4e('0x118')](db[_0x6b4e('0x63')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x6b4e('0x118')](db[_0x6b4e('0x3d')],{'through':_0x6b4e('0x163')});db[_0x6b4e('0x162')]['belongsToMany'](db[_0x6b4e('0x110')],{'through':_0x6b4e('0x178')});db[_0x6b4e('0x162')][_0x6b4e('0x118')](db[_0x6b4e('0x49')],{'through':'fax_interaction_has_tags'});db[_0x6b4e('0x162')][_0x6b4e('0x118')](db[_0x6b4e('0x59')],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0x6b4e('0x118')](db[_0x6b4e('0xf8')],{'through':'whatsapp_interaction_has_tags'});db['Trigger'][_0x6b4e('0x10a')](db['Condition'],{'as':{'plural':_0x6b4e('0x1a0'),'singular':_0x6b4e('0x1a1')},'foreignKey':_0x6b4e('0x1a2'),'onDelete':_0x6b4e('0x10d'),'hooks':!![]});db[_0x6b4e('0x1a3')][_0x6b4e('0x10a')](db[_0x6b4e('0x7c')],{'as':{'plural':_0x6b4e('0x1a4'),'singular':'AnyCondition'},'foreignKey':_0x6b4e('0x1a5'),'onDelete':_0x6b4e('0x10d'),'hooks':!![]});db[_0x6b4e('0x1a3')][_0x6b4e('0x10a')](db[_0x6b4e('0x195')],{'as':_0x6b4e('0x196'),'foreignKey':'TriggerId','onDelete':_0x6b4e('0x10d'),'hooks':!![]});db[_0x6b4e('0x1a6')][_0x6b4e('0x10a')](db['AnalyticFieldReport'],{'as':_0x6b4e('0x1a7'),'onDelete':_0x6b4e('0x10d'),'foreignKey':_0x6b4e('0x19e'),'hooks':!![]});db[_0x6b4e('0x8f')]['hasMany'](db[_0x6b4e('0x92')],{'as':_0x6b4e('0x1a7'),'onDelete':_0x6b4e('0x10d'),'foreignKey':'DefaultReportId'});db[_0x6b4e('0x1a8')]['hasMany'](db[_0x6b4e('0x92')],{'as':_0x6b4e('0x1a7'),'onDelete':_0x6b4e('0x10d'),'foreignKey':'MetricId'});db[_0x6b4e('0x92')][_0x6b4e('0x116')](db[_0x6b4e('0x1a8')],{'foreignKey':'MetricId'});db[_0x6b4e('0x96')]['hasMany'](db[_0x6b4e('0x97')],{'as':_0x6b4e('0x1a9'),'onDelete':_0x6b4e('0x10d'),'foreignKey':_0x6b4e('0x1aa')});db[_0x6b4e('0x97')][_0x6b4e('0x10a')](db[_0x6b4e('0x99')],{'as':_0x6b4e('0x1ab'),'onDelete':_0x6b4e('0x10d'),'foreignKey':_0x6b4e('0x1ac')});db[_0x6b4e('0x97')][_0x6b4e('0x10a')](db[_0x6b4e('0x99')],{'as':_0x6b4e('0x1ad'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x6b4e('0x97')][_0x6b4e('0x10a')](db[_0x6b4e('0x99')],{'as':'Fields','onDelete':_0x6b4e('0x10d'),'foreignKey':_0x6b4e('0x1ae')});db['SalesforceConfiguration'][_0x6b4e('0x116')](db[_0x6b4e('0x96')],{'as':_0x6b4e('0x160'),'foreignKey':'AccountId'});db[_0x6b4e('0x99')][_0x6b4e('0x10a')](db[_0x6b4e('0x99')],{'as':_0x6b4e('0x1af'),'foreignKey':'SubjectId'});db[_0x6b4e('0x99')][_0x6b4e('0x10a')](db[_0x6b4e('0x99')],{'as':_0x6b4e('0x1b0'),'foreignKey':_0x6b4e('0x1b1')});db[_0x6b4e('0x99')]['hasMany'](db[_0x6b4e('0x99')],{'as':_0x6b4e('0x1b2'),'foreignKey':'FieldId'});db[_0x6b4e('0x99')]['belongsTo'](db[_0x6b4e('0x8b')],{'as':_0x6b4e('0x8b'),'foreignKey':_0x6b4e('0x1b3')});db[_0x6b4e('0x9b')][_0x6b4e('0x10a')](db[_0x6b4e('0x1b4')],{'as':_0x6b4e('0x1a9'),'onDelete':_0x6b4e('0x10d'),'foreignKey':'AccountId'});db[_0x6b4e('0x1b4')][_0x6b4e('0x10a')](db[_0x6b4e('0x9d')],{'as':_0x6b4e('0x1ab'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x6b4e('0x1b4')][_0x6b4e('0x10a')](db[_0x6b4e('0x9d')],{'as':_0x6b4e('0x1ad'),'onDelete':_0x6b4e('0x10d'),'foreignKey':'DescriptionId'});db[_0x6b4e('0x1b4')][_0x6b4e('0x10a')](db[_0x6b4e('0x9d')],{'as':'Fields','onDelete':_0x6b4e('0x10d'),'foreignKey':_0x6b4e('0x1ae')});db[_0x6b4e('0x1b4')][_0x6b4e('0x116')](db[_0x6b4e('0x9b')],{'as':'Account','foreignKey':_0x6b4e('0x1aa')});db[_0x6b4e('0x9d')][_0x6b4e('0x10a')](db[_0x6b4e('0x9d')],{'as':'Subject','foreignKey':_0x6b4e('0x1ac')});db['SugarcrmField'][_0x6b4e('0x10a')](db['SugarcrmField'],{'as':_0x6b4e('0x1b0'),'foreignKey':_0x6b4e('0x1b1')});db[_0x6b4e('0x9d')][_0x6b4e('0x10a')](db[_0x6b4e('0x9d')],{'as':'Field','foreignKey':_0x6b4e('0x1ae')});db[_0x6b4e('0x9d')]['belongsTo'](db[_0x6b4e('0x8b')],{'as':'Variable','foreignKey':_0x6b4e('0x1b3')});db[_0x6b4e('0x1b5')][_0x6b4e('0x10a')](db['DeskConfiguration'],{'as':'Configurations','onDelete':_0x6b4e('0x10d'),'foreignKey':'AccountId'});db[_0x6b4e('0xa0')][_0x6b4e('0x10a')](db[_0x6b4e('0x1b6')],{'as':_0x6b4e('0x1ab'),'onDelete':_0x6b4e('0x10d'),'foreignKey':'SubjectId'});db['DeskConfiguration'][_0x6b4e('0x10a')](db[_0x6b4e('0x1b6')],{'as':_0x6b4e('0x1ad'),'onDelete':_0x6b4e('0x10d'),'foreignKey':_0x6b4e('0x1b1')});db['DeskConfiguration'][_0x6b4e('0x10a')](db[_0x6b4e('0x1b6')],{'as':'Fields','onDelete':_0x6b4e('0x10d'),'foreignKey':_0x6b4e('0x1ae')});db[_0x6b4e('0xa0')][_0x6b4e('0x116')](db[_0x6b4e('0x1b5')],{'as':_0x6b4e('0x160'),'foreignKey':_0x6b4e('0x1aa')});db[_0x6b4e('0xa0')][_0x6b4e('0x118')](db['Tag'],{'through':_0x6b4e('0x1b7')});db['DeskField'][_0x6b4e('0x10a')](db[_0x6b4e('0x1b6')],{'as':'Subject','foreignKey':_0x6b4e('0x1ac')});db['DeskField']['hasMany'](db['DeskField'],{'as':'Description','foreignKey':_0x6b4e('0x1b1')});db[_0x6b4e('0x1b6')][_0x6b4e('0x10a')](db[_0x6b4e('0x1b6')],{'as':'Field','foreignKey':_0x6b4e('0x1ae')});db['DeskField'][_0x6b4e('0x116')](db['Variable'],{'as':_0x6b4e('0x8b'),'foreignKey':_0x6b4e('0x1b3')});db[_0x6b4e('0xa2')][_0x6b4e('0x10a')](db[_0x6b4e('0xa4')],{'as':_0x6b4e('0x1a9'),'onDelete':_0x6b4e('0x10d'),'foreignKey':_0x6b4e('0x1aa')});db['ZohoConfiguration'][_0x6b4e('0x10a')](db[_0x6b4e('0x1b8')],{'as':'Subjects','onDelete':_0x6b4e('0x10d'),'foreignKey':_0x6b4e('0x1ac')});db['ZohoConfiguration'][_0x6b4e('0x10a')](db[_0x6b4e('0x1b8')],{'as':_0x6b4e('0x1ad'),'onDelete':_0x6b4e('0x10d'),'foreignKey':_0x6b4e('0x1b1')});db[_0x6b4e('0xa4')][_0x6b4e('0x10a')](db[_0x6b4e('0x1b8')],{'as':_0x6b4e('0x1a7'),'onDelete':_0x6b4e('0x10d'),'foreignKey':_0x6b4e('0x1ae')});db[_0x6b4e('0xa4')][_0x6b4e('0x116')](db[_0x6b4e('0xa2')],{'as':'Account','foreignKey':_0x6b4e('0x1aa')});db[_0x6b4e('0x1b8')][_0x6b4e('0x10a')](db[_0x6b4e('0x1b8')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x6b4e('0x1b8')][_0x6b4e('0x10a')](db[_0x6b4e('0x1b8')],{'as':_0x6b4e('0x1b0'),'foreignKey':'DescriptionId'});db['ZohoField'][_0x6b4e('0x10a')](db[_0x6b4e('0x1b8')],{'as':_0x6b4e('0x1b2'),'foreignKey':_0x6b4e('0x1ae')});db[_0x6b4e('0x1b8')][_0x6b4e('0x116')](db['Variable'],{'as':_0x6b4e('0x8b'),'foreignKey':_0x6b4e('0x1b3')});db['ZendeskAccount']['hasMany'](db['ZendeskConfiguration'],{'as':_0x6b4e('0x1a9'),'onDelete':_0x6b4e('0x10d'),'foreignKey':'AccountId'});db[_0x6b4e('0xa9')][_0x6b4e('0x10a')](db['ZendeskField'],{'as':_0x6b4e('0x1ab'),'foreignKey':_0x6b4e('0x1ac')});db[_0x6b4e('0xa9')][_0x6b4e('0x10a')](db[_0x6b4e('0xaa')],{'as':_0x6b4e('0x1ad'),'foreignKey':_0x6b4e('0x1b1')});db['ZendeskConfiguration'][_0x6b4e('0x10a')](db[_0x6b4e('0xaa')],{'as':_0x6b4e('0x1a7'),'foreignKey':_0x6b4e('0x1ae')});db[_0x6b4e('0xa9')]['belongsTo'](db[_0x6b4e('0xa7')],{'as':_0x6b4e('0x160'),'foreignKey':'AccountId'});db[_0x6b4e('0xa9')][_0x6b4e('0x118')](db[_0x6b4e('0x162')],{'through':_0x6b4e('0x1b9')});db['ZendeskField']['hasMany'](db[_0x6b4e('0xaa')],{'as':_0x6b4e('0x1af'),'foreignKey':_0x6b4e('0x1ac')});db['ZendeskField'][_0x6b4e('0x10a')](db['ZendeskField'],{'as':_0x6b4e('0x1b0'),'foreignKey':_0x6b4e('0x1b1')});db[_0x6b4e('0xaa')]['hasMany'](db[_0x6b4e('0xaa')],{'as':_0x6b4e('0x1b2'),'foreignKey':_0x6b4e('0x1ae')});db['ZendeskField'][_0x6b4e('0x116')](db[_0x6b4e('0x8b')],{'as':_0x6b4e('0x8b'),'foreignKey':_0x6b4e('0x1b3')});db[_0x6b4e('0xac')][_0x6b4e('0x10a')](db[_0x6b4e('0xae')],{'as':_0x6b4e('0x1a9'),'onDelete':_0x6b4e('0x10d'),'foreignKey':_0x6b4e('0x1aa')});db[_0x6b4e('0xae')][_0x6b4e('0x10a')](db[_0x6b4e('0x1ba')],{'as':_0x6b4e('0x1ab'),'onDelete':'cascade','foreignKey':_0x6b4e('0x1ac')});db[_0x6b4e('0xae')][_0x6b4e('0x10a')](db[_0x6b4e('0x1ba')],{'as':_0x6b4e('0x1ad'),'onDelete':_0x6b4e('0x10d'),'foreignKey':_0x6b4e('0x1b1')});db[_0x6b4e('0xae')][_0x6b4e('0x10a')](db[_0x6b4e('0x1ba')],{'as':'Fields','onDelete':_0x6b4e('0x10d'),'foreignKey':_0x6b4e('0x1ae')});db[_0x6b4e('0xae')][_0x6b4e('0x116')](db[_0x6b4e('0xac')],{'as':_0x6b4e('0x160'),'foreignKey':_0x6b4e('0x1aa')});db[_0x6b4e('0xae')][_0x6b4e('0x118')](db[_0x6b4e('0x162')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x6b4e('0x1ba')]['hasMany'](db[_0x6b4e('0x1ba')],{'as':_0x6b4e('0x1af'),'foreignKey':_0x6b4e('0x1ac')});db[_0x6b4e('0x1ba')]['hasMany'](db[_0x6b4e('0x1ba')],{'as':_0x6b4e('0x1b0'),'foreignKey':'DescriptionId'});db[_0x6b4e('0x1ba')][_0x6b4e('0x10a')](db['FreshdeskField'],{'as':_0x6b4e('0x1b2'),'foreignKey':_0x6b4e('0x1ae')});db[_0x6b4e('0x1ba')][_0x6b4e('0x116')](db[_0x6b4e('0x8b')],{'as':'Variable','foreignKey':_0x6b4e('0x1b3')});db[_0x6b4e('0xb1')][_0x6b4e('0x10a')](db[_0x6b4e('0xb2')],{'as':_0x6b4e('0x1a9'),'onDelete':_0x6b4e('0x10d'),'foreignKey':_0x6b4e('0x1aa')});db[_0x6b4e('0xb2')][_0x6b4e('0x10a')](db['VtigerField'],{'as':_0x6b4e('0x1ab'),'foreignKey':_0x6b4e('0x1ac')});db[_0x6b4e('0xb2')]['hasMany'](db[_0x6b4e('0xb3')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x6b4e('0xb2')][_0x6b4e('0x10a')](db[_0x6b4e('0xb3')],{'as':_0x6b4e('0x1a7'),'foreignKey':'FieldId'});db[_0x6b4e('0xb2')]['belongsTo'](db['VtigerAccount'],{'as':_0x6b4e('0x160'),'foreignKey':'AccountId'});db[_0x6b4e('0xb3')][_0x6b4e('0x10a')](db['VtigerField'],{'as':_0x6b4e('0x1af'),'foreignKey':_0x6b4e('0x1ac')});db['VtigerField'][_0x6b4e('0x10a')](db['VtigerField'],{'as':_0x6b4e('0x1b0'),'foreignKey':_0x6b4e('0x1b1')});db[_0x6b4e('0xb3')][_0x6b4e('0x10a')](db['VtigerField'],{'as':'Field','foreignKey':_0x6b4e('0x1ae')});db[_0x6b4e('0xb3')][_0x6b4e('0x116')](db['Variable'],{'as':'Variable','foreignKey':_0x6b4e('0x1b3')});db['ServicenowAccount'][_0x6b4e('0x10a')](db['ServicenowConfiguration'],{'as':_0x6b4e('0x1a9'),'onDelete':_0x6b4e('0x10d'),'foreignKey':'AccountId'});db[_0x6b4e('0xb6')][_0x6b4e('0x10a')](db[_0x6b4e('0x1bb')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x6b4e('0xb6')][_0x6b4e('0x10a')](db[_0x6b4e('0x1bb')],{'as':'Descriptions','foreignKey':_0x6b4e('0x1b1')});db[_0x6b4e('0xb6')][_0x6b4e('0x10a')](db[_0x6b4e('0x1bb')],{'as':_0x6b4e('0x1a7'),'foreignKey':_0x6b4e('0x1ae')});db['ServicenowConfiguration']['belongsTo'](db[_0x6b4e('0xb5')],{'as':_0x6b4e('0x160'),'foreignKey':_0x6b4e('0x1aa')});db['ServicenowField'][_0x6b4e('0x10a')](db['ServicenowField'],{'as':_0x6b4e('0x1af'),'foreignKey':'SubjectId'});db[_0x6b4e('0x1bb')][_0x6b4e('0x10a')](db[_0x6b4e('0x1bb')],{'as':_0x6b4e('0x1b0'),'foreignKey':'DescriptionId'});db[_0x6b4e('0x1bb')][_0x6b4e('0x10a')](db[_0x6b4e('0x1bb')],{'as':_0x6b4e('0x1b2'),'foreignKey':_0x6b4e('0x1ae')});db[_0x6b4e('0x1bb')][_0x6b4e('0x116')](db[_0x6b4e('0x8b')],{'as':_0x6b4e('0x8b'),'foreignKey':_0x6b4e('0x1b3')});db['Dynamics365Account']['hasMany'](db[_0x6b4e('0xb9')],{'as':_0x6b4e('0x1a9'),'onDelete':_0x6b4e('0x10d'),'foreignKey':_0x6b4e('0x1aa')});db['Dynamics365Configuration'][_0x6b4e('0x10a')](db[_0x6b4e('0xba')],{'as':_0x6b4e('0x1ab'),'onDelete':_0x6b4e('0x10d'),'foreignKey':_0x6b4e('0x1ac')});db[_0x6b4e('0xb9')][_0x6b4e('0x10a')](db[_0x6b4e('0xba')],{'as':_0x6b4e('0x1ad'),'onDelete':_0x6b4e('0x10d'),'foreignKey':_0x6b4e('0x1b1')});db['Dynamics365Configuration'][_0x6b4e('0x10a')](db[_0x6b4e('0xba')],{'as':_0x6b4e('0x1a7'),'onDelete':_0x6b4e('0x10d'),'foreignKey':_0x6b4e('0x1ae')});db[_0x6b4e('0xb9')]['belongsTo'](db[_0x6b4e('0xb7')],{'as':_0x6b4e('0x160'),'foreignKey':_0x6b4e('0x1aa')});db[_0x6b4e('0xba')][_0x6b4e('0x10a')](db[_0x6b4e('0xba')],{'as':_0x6b4e('0x1af'),'foreignKey':_0x6b4e('0x1ac')});db[_0x6b4e('0xba')][_0x6b4e('0x10a')](db[_0x6b4e('0xba')],{'as':_0x6b4e('0x1b0'),'foreignKey':_0x6b4e('0x1b1')});db['Dynamics365Field'][_0x6b4e('0x10a')](db['Dynamics365Field'],{'as':_0x6b4e('0x1b2'),'foreignKey':_0x6b4e('0x1ae')});db[_0x6b4e('0xba')][_0x6b4e('0x116')](db[_0x6b4e('0x8b')],{'as':_0x6b4e('0x8b'),'foreignKey':_0x6b4e('0x1b3')});db[_0x6b4e('0xbc')][_0x6b4e('0x10a')](db[_0x6b4e('0x1bc')],{'as':_0x6b4e('0x1a9'),'onDelete':_0x6b4e('0x10d'),'foreignKey':_0x6b4e('0x1aa')});db[_0x6b4e('0x1bc')][_0x6b4e('0x10a')](db[_0x6b4e('0xbf')],{'as':_0x6b4e('0x1ab'),'foreignKey':_0x6b4e('0x1ac')});db[_0x6b4e('0x1bc')]['hasMany'](db[_0x6b4e('0xbf')],{'as':'Descriptions','foreignKey':_0x6b4e('0x1b1')});db['FreshsalesConfiguration'][_0x6b4e('0x10a')](db[_0x6b4e('0xbf')],{'as':_0x6b4e('0x1a7'),'foreignKey':_0x6b4e('0x1ae')});db[_0x6b4e('0x1bc')][_0x6b4e('0x116')](db[_0x6b4e('0xbc')],{'as':'Account','foreignKey':'AccountId'});db['FreshsalesField']['hasMany'](db[_0x6b4e('0xbf')],{'as':'Subject','foreignKey':_0x6b4e('0x1ac')});db[_0x6b4e('0xbf')]['hasMany'](db['FreshsalesField'],{'as':_0x6b4e('0x1b0'),'foreignKey':_0x6b4e('0x1b1')});db[_0x6b4e('0xbf')][_0x6b4e('0x10a')](db['FreshsalesField'],{'as':_0x6b4e('0x1b2'),'foreignKey':_0x6b4e('0x1ae')});db[_0x6b4e('0xbf')]['belongsTo'](db[_0x6b4e('0x8b')],{'as':'Variable','foreignKey':'VariableId'});db[_0x6b4e('0xc2')][_0x6b4e('0x116')](db[_0x6b4e('0x129')],{});db[_0x6b4e('0xc2')]['belongsTo'](db['CmList'],{'as':_0x6b4e('0x15b'),'foreignKey':'ListId'});db['ChatQueueReport'][_0x6b4e('0x116')](db[_0x6b4e('0x6c')],{'as':'Contact','foreignKey':'ContactId'});db['ChatQueueReport'][_0x6b4e('0x116')](db[_0x6b4e('0x63')],{});db[_0x6b4e('0xc2')]['belongsTo'](db[_0x6b4e('0x64')],{});db[_0x6b4e('0xc2')][_0x6b4e('0x116')](db['User'],{});db[_0x6b4e('0xc2')][_0x6b4e('0x116')](db[_0x6b4e('0x67')],{});db[_0x6b4e('0xc4')][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'onDelete':_0x6b4e('0x10d'),'foreignKey':_0x6b4e('0x1bd')});db['ChatInternalMessage']['belongsTo'](db[_0x6b4e('0x12')],{'onDelete':'cascade','foreignKey':_0x6b4e('0x1be')});db['JscriptySessionReport'][_0x6b4e('0x10a')](db[_0x6b4e('0xc8')],{'foreignKey':_0x6b4e('0x1bf'),'onDelete':'cascade'});db[_0x6b4e('0x141')][_0x6b4e('0x10a')](db[_0x6b4e('0xc6')],{'foreignKey':_0x6b4e('0x1bf'),'onDelete':'cascade'});db[_0x6b4e('0x1c0')][_0x6b4e('0x116')](db[_0x6b4e('0x50')],{});db['SmsQueueReport'][_0x6b4e('0x116')](db[_0x6b4e('0xeb')],{'as':'List','foreignKey':_0x6b4e('0x15c')});db['SmsQueueReport'][_0x6b4e('0x116')](db[_0x6b4e('0x6c')],{'as':'Contact','foreignKey':_0x6b4e('0x153')});db[_0x6b4e('0x1c0')]['belongsTo'](db[_0x6b4e('0x110')],{});db['SmsQueueReport'][_0x6b4e('0x116')](db['SmsMessage'],{});db['SmsQueueReport'][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{});db[_0x6b4e('0x1c0')][_0x6b4e('0x116')](db['SmsQueue'],{});db[_0x6b4e('0x1c1')][_0x6b4e('0x10a')](db[_0x6b4e('0x141')],{'foreignKey':_0x6b4e('0x1c2')});db['JscriptyProject'][_0x6b4e('0x10a')](db[_0x6b4e('0xc8')],{'foreignKey':'ProjectId'});db[_0x6b4e('0x1c1')][_0x6b4e('0x10a')](db[_0x6b4e('0xc6')],{'foreignKey':_0x6b4e('0x1c2')});db[_0x6b4e('0xd5')]['belongsToMany'](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x165'),'through':'user_has_square_projects'});db[_0x6b4e('0xdb')][_0x6b4e('0x118')](db[_0x6b4e('0x12')],{'as':'Agents','through':_0x6b4e('0x1c3')});db[_0x6b4e('0xdb')][_0x6b4e('0x118')](db[_0x6b4e('0x1d')],{'through':'TeamVoiceQueue','as':_0x6b4e('0x122')});db[_0x6b4e('0xdb')][_0x6b4e('0x118')](db[_0x6b4e('0x124')],{'through':_0x6b4e('0x15e'),'as':_0x6b4e('0x1c4')});db['Team']['belongsToMany'](db[_0x6b4e('0x67')],{'through':_0x6b4e('0x187'),'as':_0x6b4e('0x125')});db[_0x6b4e('0xdb')][_0x6b4e('0x118')](db[_0x6b4e('0x4d')],{'through':'team_has_fax_queues','as':_0x6b4e('0x126')});db[_0x6b4e('0xdb')][_0x6b4e('0x118')](db[_0x6b4e('0x55')],{'through':_0x6b4e('0x17a'),'as':_0x6b4e('0x1c5')});db['Team'][_0x6b4e('0x118')](db[_0x6b4e('0x5d')],{'through':_0x6b4e('0x1c6'),'as':_0x6b4e('0x127')});db[_0x6b4e('0xdb')][_0x6b4e('0x118')](db[_0x6b4e('0xfe')],{'through':_0x6b4e('0x1c7'),'as':'WhatsappQueues'});db[_0x6b4e('0xdb')]['belongsToMany'](db['VoicePrefix'],{'through':_0x6b4e('0x104'),'as':_0x6b4e('0x1c8')});db['Campaign']['hasMany'](db[_0x6b4e('0x6d')],{'as':_0x6b4e('0x13d'),'foreignKey':_0x6b4e('0x18f')});db[_0x6b4e('0x18e')][_0x6b4e('0x10a')](db['CmHopperFinal'],{'as':_0x6b4e('0x13e'),'foreignKey':'CampaignId'});db[_0x6b4e('0x18e')][_0x6b4e('0x10a')](db['CmHopperHistory'],{'as':_0x6b4e('0x13f'),'foreignKey':_0x6b4e('0x18f')});db[_0x6b4e('0x18e')][_0x6b4e('0x10a')](db[_0x6b4e('0x6f')],{'as':_0x6b4e('0x140'),'foreignKey':_0x6b4e('0x18f')});db[_0x6b4e('0x18e')][_0x6b4e('0x116')](db[_0x6b4e('0x29')],{'as':_0x6b4e('0x29'),'foreignKey':'TrunkId'});db[_0x6b4e('0x18e')][_0x6b4e('0x116')](db['Trunk'],{'as':_0x6b4e('0x143'),'foreignKey':_0x6b4e('0x1c9')});db[_0x6b4e('0x18e')]['belongsTo'](db[_0x6b4e('0x7e')],{'as':_0x6b4e('0x7e'),'foreignKey':'IntervalId'});db['Campaign'][_0x6b4e('0x116')](db['SquareProject'],{'as':_0x6b4e('0xd5'),'foreignKey':_0x6b4e('0x1ca')});db[_0x6b4e('0x18e')][_0x6b4e('0x118')](db[_0x6b4e('0xeb')],{'as':'Lists','through':_0x6b4e('0x1cb')});db[_0x6b4e('0x18e')][_0x6b4e('0x118')](db[_0x6b4e('0xeb')],{'as':_0x6b4e('0x149'),'through':_0x6b4e('0x1cc')});db[_0x6b4e('0xe0')]['belongsTo'](db[_0x6b4e('0x169')],{'as':_0x6b4e('0x169'),'foreignKey':'ChatOfflineMessageId'});db[_0x6b4e('0xe4')][_0x6b4e('0x116')](db[_0x6b4e('0x3f')],{});db['MailTransferReport'][_0x6b4e('0x116')](db[_0x6b4e('0x3d')],{});db['MailTransferReport'][_0x6b4e('0x116')](db['MailAccount'],{'foreignKey':_0x6b4e('0x1cd'),'as':_0x6b4e('0x1ce')});db[_0x6b4e('0xe4')][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'foreignKey':_0x6b4e('0x1cf'),'as':_0x6b4e('0x1d0')});db[_0x6b4e('0xe4')][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'foreignKey':_0x6b4e('0x1d1'),'as':_0x6b4e('0x1d2')});db[_0x6b4e('0xe4')]['belongsTo'](db[_0x6b4e('0x124')],{'foreignKey':_0x6b4e('0x1d3'),'as':'ToQueue'});db[_0x6b4e('0xe4')][_0x6b4e('0x116')](db[_0x6b4e('0x154')],{'foreignKey':_0x6b4e('0x1d4'),'as':'ToAccount'});db[_0x6b4e('0xe6')][_0x6b4e('0x116')](db[_0x6b4e('0x64')],{});db['ChatTransferReport'][_0x6b4e('0x116')](db[_0x6b4e('0x63')],{});db['ChatTransferReport'][_0x6b4e('0x116')](db[_0x6b4e('0x129')],{'foreignKey':_0x6b4e('0x1d5'),'as':_0x6b4e('0x1ce')});db[_0x6b4e('0xe6')][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'foreignKey':_0x6b4e('0x1cf'),'as':_0x6b4e('0x1d0')});db[_0x6b4e('0xe6')][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'foreignKey':_0x6b4e('0x1d1'),'as':_0x6b4e('0x1d2')});db['ChatTransferReport'][_0x6b4e('0x116')](db[_0x6b4e('0x67')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db['ChatTransferReport'][_0x6b4e('0x116')](db[_0x6b4e('0x129')],{'foreignKey':_0x6b4e('0x1d6'),'as':'ToAccount'});db[_0x6b4e('0x1d7')][_0x6b4e('0x116')](db[_0x6b4e('0x4b')],{});db[_0x6b4e('0x1d7')][_0x6b4e('0x116')](db[_0x6b4e('0x49')],{});db['FaxTransferReport']['belongsTo'](db[_0x6b4e('0x12c')],{'foreignKey':_0x6b4e('0x1d8'),'as':_0x6b4e('0x1ce')});db[_0x6b4e('0x1d7')][_0x6b4e('0x116')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x6b4e('0x1d7')][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'foreignKey':_0x6b4e('0x1d1'),'as':'ToAgent'});db[_0x6b4e('0x1d7')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x6b4e('0x1d9'),'as':_0x6b4e('0x1da')});db[_0x6b4e('0x1d7')]['belongsTo'](db[_0x6b4e('0x12c')],{'foreignKey':_0x6b4e('0x1db'),'as':_0x6b4e('0x1dc')});db[_0x6b4e('0x1dd')][_0x6b4e('0x116')](db['OpenchannelMessage'],{});db[_0x6b4e('0x1dd')][_0x6b4e('0x116')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0x6b4e('0x116')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db[_0x6b4e('0x1dd')][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'foreignKey':_0x6b4e('0x1cf'),'as':_0x6b4e('0x1d0')});db[_0x6b4e('0x1dd')][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'foreignKey':'ToUserId','as':_0x6b4e('0x1d2')});db['OpenchannelTransferReport']['belongsTo'](db[_0x6b4e('0x5d')],{'foreignKey':_0x6b4e('0x1de'),'as':_0x6b4e('0x1da')});db[_0x6b4e('0x1dd')]['belongsTo'](db[_0x6b4e('0x57')],{'foreignKey':_0x6b4e('0x1df'),'as':_0x6b4e('0x1dc')});db['SmsTransferReport'][_0x6b4e('0x116')](db[_0x6b4e('0x176')],{});db[_0x6b4e('0xea')][_0x6b4e('0x116')](db[_0x6b4e('0x110')],{});db[_0x6b4e('0xea')]['belongsTo'](db[_0x6b4e('0x50')],{'foreignKey':_0x6b4e('0x1e0'),'as':_0x6b4e('0x1ce')});db[_0x6b4e('0xea')][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'foreignKey':_0x6b4e('0x1cf'),'as':_0x6b4e('0x1d0')});db[_0x6b4e('0xea')][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'foreignKey':'ToUserId','as':_0x6b4e('0x1d2')});db[_0x6b4e('0xea')][_0x6b4e('0x116')](db[_0x6b4e('0x55')],{'foreignKey':_0x6b4e('0x1e1'),'as':_0x6b4e('0x1da')});db[_0x6b4e('0xea')][_0x6b4e('0x116')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0x6b4e('0xeb')][_0x6b4e('0x10a')](db[_0x6b4e('0x7b')],{'as':_0x6b4e('0x158'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x6b4e('0xeb')]['hasMany'](db[_0x6b4e('0x1e2')],{'as':_0x6b4e('0x1e3'),'foreignKey':_0x6b4e('0x15c')});db['CmList'][_0x6b4e('0x10a')](db[_0x6b4e('0x6c')],{'as':'Contacts','onDelete':'cascade','foreignKey':_0x6b4e('0x15c')});db['CmList'][_0x6b4e('0x10a')](db['CmHopperFinal'],{'as':_0x6b4e('0x13e'),'foreignKey':_0x6b4e('0x15c')});db[_0x6b4e('0xeb')][_0x6b4e('0x10a')](db[_0x6b4e('0x73')],{'as':_0x6b4e('0x1e4'),'foreignKey':'ListId'});db['CmList'][_0x6b4e('0x10a')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x6b4e('0x15c')});db[_0x6b4e('0xeb')][_0x6b4e('0x118')](db[_0x6b4e('0x1d')],{'as':_0x6b4e('0x1e5'),'through':'voice_queues_has_cm_lists'});db['CmList'][_0x6b4e('0x118')](db['User'],{'as':_0x6b4e('0x147'),'through':_0x6b4e('0x11d')});db[_0x6b4e('0xed')][_0x6b4e('0x10a')](db['VoiceExtension'],{'as':'Extensions','onDelete':'cascade'});db[_0x6b4e('0xed')]['belongsToMany'](db['User'],{'as':_0x6b4e('0x147'),'through':_0x6b4e('0x106')});db[_0x6b4e('0xed')][_0x6b4e('0x118')](db[_0x6b4e('0xdb')],{'through':_0x6b4e('0x104'),'as':'Teams'});db['UserProfile'][_0x6b4e('0x10a')](db['User'],{'as':_0x6b4e('0x165'),'foreignKey':_0x6b4e('0x1e6')});db['UserProfile']['hasMany'](db[_0x6b4e('0xf0')],{'as':_0x6b4e('0x1e7'),'foreignKey':_0x6b4e('0x1e6'),'onDelete':_0x6b4e('0x10d')});db[_0x6b4e('0xf0')][_0x6b4e('0x10a')](db['UserProfileResource'],{'as':_0x6b4e('0x1e8'),'foreignKey':_0x6b4e('0x1e9'),'onDelete':_0x6b4e('0x10d')});db[_0x6b4e('0x134')]['hasMany'](db[_0x6b4e('0x7b')],{'as':_0x6b4e('0x158'),'foreignKey':_0x6b4e('0x1ea'),'onDelete':_0x6b4e('0x10d')});db[_0x6b4e('0x134')][_0x6b4e('0x10a')](db[_0x6b4e('0x79')],{'as':_0x6b4e('0x16d'),'foreignKey':_0x6b4e('0x1ea')});db[_0x6b4e('0x134')][_0x6b4e('0x10a')](db[_0x6b4e('0x1eb')],{'as':_0x6b4e('0x14b'),'foreignKey':_0x6b4e('0x1ea')});db[_0x6b4e('0x134')]['hasMany'](db[_0x6b4e('0xf8')],{'as':_0x6b4e('0x159')});db[_0x6b4e('0x134')][_0x6b4e('0x10a')](db[_0x6b4e('0xf6')],{'as':_0x6b4e('0x138')});db[_0x6b4e('0x134')]['belongsTo'](db['CmList'],{'as':_0x6b4e('0x15b'),'foreignKey':'ListId'});db[_0x6b4e('0x134')][_0x6b4e('0x116')](db[_0x6b4e('0x80')],{'as':_0x6b4e('0x145'),'foreignKey':_0x6b4e('0x146')});db['WhatsappAccount']['belongsToMany'](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x147'),'through':_0x6b4e('0x1ec')});db[_0x6b4e('0xf6')]['belongsTo'](db['User'],{'onDelete':_0x6b4e('0x16a')});db[_0x6b4e('0xf6')]['belongsTo'](db[_0x6b4e('0xfe')],{'onDelete':_0x6b4e('0x16a')});db[_0x6b4e('0xf6')][_0x6b4e('0x116')](db[_0x6b4e('0x134')],{'onDelete':_0x6b4e('0x16a')});db[_0x6b4e('0xf6')]['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':_0x6b4e('0x144')});db['WhatsappApplication'][_0x6b4e('0x116')](db[_0x6b4e('0x162')],{'onDelete':_0x6b4e('0x16a'),'foreignKey':_0x6b4e('0x16b')});db[_0x6b4e('0xf8')][_0x6b4e('0x10a')](db[_0x6b4e('0x1eb')],{'as':_0x6b4e('0x14b'),'onDelete':_0x6b4e('0x10d'),'foreignKey':'WhatsappInteractionId'});db[_0x6b4e('0xf8')]['belongsTo'](db[_0x6b4e('0x134')],{'as':'Account','foreignKey':_0x6b4e('0x1ea')});db[_0x6b4e('0xf8')][_0x6b4e('0x116')](db[_0x6b4e('0x6c')],{'as':_0x6b4e('0x152'),'foreignKey':_0x6b4e('0x153')});db[_0x6b4e('0xf8')][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x170'),'foreignKey':_0x6b4e('0x109')});db['WhatsappInteraction'][_0x6b4e('0x118')](db[_0x6b4e('0x162')],{'through':_0x6b4e('0x1ed'),'as':_0x6b4e('0x161')});db['WhatsappInteraction'][_0x6b4e('0x118')](db[_0x6b4e('0x162')],{'through':_0x6b4e('0x1ed'),'as':_0x6b4e('0x164')});db['WhatsappInteraction']['belongsToMany'](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x165'),'through':'user_has_whatsapp_interactions','foreignKey':'WhatsappInteractionId'});db[_0x6b4e('0x1eb')][_0x6b4e('0x116')](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x12')});db[_0x6b4e('0x1eb')][_0x6b4e('0x116')](db[_0x6b4e('0x6c')],{'onDelete':_0x6b4e('0x10d'),'as':_0x6b4e('0x152')});db[_0x6b4e('0x1eb')][_0x6b4e('0x116')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x6b4e('0x167'),'foreignKey':_0x6b4e('0x1ee')});db[_0x6b4e('0x1eb')][_0x6b4e('0x116')](db[_0x6b4e('0x134')],{'as':_0x6b4e('0x160'),'foreignKey':_0x6b4e('0x1ea')});db[_0x6b4e('0xfa')]['belongsTo'](db[_0x6b4e('0x134')],{});db[_0x6b4e('0xfa')][_0x6b4e('0x116')](db[_0x6b4e('0xeb')],{'as':'List','foreignKey':_0x6b4e('0x15c')});db[_0x6b4e('0xfa')][_0x6b4e('0x116')](db[_0x6b4e('0x6c')],{'as':_0x6b4e('0x152'),'foreignKey':_0x6b4e('0x153')});db[_0x6b4e('0xfa')]['belongsTo'](db[_0x6b4e('0xf8')],{});db[_0x6b4e('0xfa')][_0x6b4e('0x116')](db[_0x6b4e('0xfe')],{});db[_0x6b4e('0xfa')][_0x6b4e('0x116')](db[_0x6b4e('0x1eb')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x6b4e('0x12')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x6b4e('0x1eb')],{});db[_0x6b4e('0xfc')]['belongsTo'](db[_0x6b4e('0xf8')],{});db['WhatsappTransferReport'][_0x6b4e('0x116')](db[_0x6b4e('0x134')],{'foreignKey':_0x6b4e('0x1ef'),'as':_0x6b4e('0x1ce')});db[_0x6b4e('0xfc')][_0x6b4e('0x116')](db[_0x6b4e('0x134')],{'foreignKey':_0x6b4e('0x1f0'),'as':'ToAccount'});db['WhatsappTransferReport'][_0x6b4e('0x116')](db[_0x6b4e('0xfe')],{'foreignKey':_0x6b4e('0x1f1'),'as':'ToQueue'});db[_0x6b4e('0xfc')]['belongsTo'](db[_0x6b4e('0x12')],{'foreignKey':_0x6b4e('0x1cf'),'as':_0x6b4e('0x1d0')});db[_0x6b4e('0xfc')][_0x6b4e('0x116')](db['User'],{'foreignKey':_0x6b4e('0x1d1'),'as':_0x6b4e('0x1d2')});db['WhatsappQueue'][_0x6b4e('0x118')](db[_0x6b4e('0x12')],{'as':_0x6b4e('0x147'),'through':_0x6b4e('0x34'),'foreignKey':'WhatsappQueueId'});db[_0x6b4e('0xfe')][_0x6b4e('0x118')](db[_0x6b4e('0xdb')],{'through':'team_has_whatsapp_queues','as':'Teams'});module[_0x6b4e('0x1f2')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 4d4c578..57808be 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11d1=['static','/www','/demo','/snippet','snippet','3.0.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','username','password','apiKey','lastName','street','phone','mobile','fax','securityToken','code','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isArray','length','replace','@@{','}@@','includes','lodash','express','express-winston','util','./config/environment','./config/logger','api','auth','./safe-template','safeTemplate','default','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','user','name','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','statusCode','role','other','agent_name','test','use','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','/api/square/recordings','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/attachments','./api/attachment','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','./api/authGoogle','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','/api/webbar','/apidoc','join','root'];(function(_0x506f34,_0x35d8d0){var _0x1246a5=function(_0x5550e1){while(--_0x5550e1){_0x506f34['push'](_0x506f34['shift']());}};_0x1246a5(++_0x35d8d0);}(_0x11d1,0x184));var _0x111d=function(_0x163f92,_0x334278){_0x163f92=_0x163f92-0x0;var _0x1ead1b=_0x11d1[_0x163f92];return _0x1ead1b;};'use strict';var _=require(_0x111d('0x0'));var path=require('path');var express=require(_0x111d('0x1'));var ewinston=require(_0x111d('0x2'));var util=require(_0x111d('0x3'));var errors=require('./errors');var config=require(_0x111d('0x4'));var logger=require(_0x111d('0x5'))(_0x111d('0x6'));var authLogger=require('./config/logger')(_0x111d('0x7'));var safeTemplate=require(_0x111d('0x8'))[_0x111d('0x9')];exports[_0x111d('0xa')]=function(_0x12b249){_0x12b249['use'](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1ba64c,_0xdf4197){var _0x497127=_0x111d('0xb');if(!_[_0x111d('0xc')](_0x1ba64c['body'])){_0x497127+=_0x111d('0xd');var _0x1b58f0=_0x1ba64c[_0x111d('0xe')];maskSensitiveData(_0x1b58f0);}return safeTemplate(util[_0x111d('0xf')](_0x497127,_0x1ba64c[_0x111d('0x10')],_0x1ba64c[_0x111d('0x11')][_0x111d('0x12')]?_0x1ba64c[_0x111d('0x11')]['x-forwarded-for']:_0x1ba64c[_0x111d('0x13')][_0x111d('0x14')]||_0x1ba64c['ip'],_0x1ba64c[_0x111d('0x15')],_0xdf4197['statusCode'],_0xdf4197['responseTime'],_0x1ba64c[_0x111d('0x16')]?_0x1ba64c[_0x111d('0x16')]['id']:null,_0x1ba64c['user']?_0x1ba64c['user'][_0x111d('0x17')]:null,_0x1ba64c[_0x111d('0x16')]?_0x1ba64c['user']['role']:null,_0x1b58f0?util[_0x111d('0x18')](_0x1b58f0,![],null):''));}}));_0x12b249['use'](ewinston[_0x111d('0x19')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4862b7,_0xf58ec2){var _0x38b393=_0x111d('0x1a');if(_0x4862b7['body']&&_0x4862b7[_0x111d('0xe')][_0x111d('0x1b')]&&_0x4862b7['body'][_0x111d('0x1c')]){_0x38b393=_0x111d('0x1d');}return util['format'](_0x38b393,_0x4862b7[_0x111d('0x10')],_0x4862b7[_0x111d('0x11')][_0x111d('0x12')]?_0x4862b7[_0x111d('0x11')][_0x111d('0x12')]:_0x4862b7['connection'][_0x111d('0x14')]||_0x4862b7['ip'],_0x4862b7[_0x111d('0x15')],_0xf58ec2[_0x111d('0x1e')],_0xf58ec2['responseTime'],_0x4862b7['user']?_0x4862b7[_0x111d('0x16')]['id']:null,_0x4862b7['user']?_0x4862b7[_0x111d('0x16')]['name']:null,_0x4862b7['user']?_0x4862b7[_0x111d('0x16')][_0x111d('0x1f')]:null,_0x4862b7[_0x111d('0xe')]&&_0x4862b7[_0x111d('0xe')]['device']?_0x4862b7['body'][_0x111d('0x1b')]:_0x111d('0x20'),_0x4862b7[_0x111d('0xe')]&&_0x4862b7[_0x111d('0xe')][_0x111d('0x1c')]?_0x4862b7['body'][_0x111d('0x1c')]:'',_0x4862b7[_0x111d('0xe')]&&_0x4862b7[_0x111d('0xe')][_0x111d('0x21')]?_0x4862b7[_0x111d('0xe')][_0x111d('0x21')]:'');},'ignoreRoute':function(_0xf07608){var _0x55ca6f=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x55ca6f[_0x111d('0x22')](_0xf07608['url']);}}));_0x12b249[_0x111d('0x23')](_0x111d('0x24'),require(_0x111d('0x25')));_0x12b249[_0x111d('0x23')]('/api/voice/chanspy',require(_0x111d('0x26')));_0x12b249[_0x111d('0x23')](_0x111d('0x27'),require(_0x111d('0x28')));_0x12b249[_0x111d('0x23')]('/api/voice/extensions',require(_0x111d('0x29')));_0x12b249[_0x111d('0x23')]('/api/voice/mohs',require(_0x111d('0x2a')));_0x12b249[_0x111d('0x23')]('/api/voice/queues',require('./api/voiceQueue'));_0x12b249[_0x111d('0x23')](_0x111d('0x2b'),require('./api/voiceRecording'));_0x12b249[_0x111d('0x23')]('/api/screen/recordings',require(_0x111d('0x2c')));_0x12b249['use'](_0x111d('0x2d'),require('./api/voiceMail'));_0x12b249[_0x111d('0x23')](_0x111d('0x2e'),require(_0x111d('0x2f')));_0x12b249[_0x111d('0x23')](_0x111d('0x30'),require(_0x111d('0x31')));_0x12b249[_0x111d('0x23')](_0x111d('0x32'),require('./api/voiceDialReport'));_0x12b249[_0x111d('0x23')](_0x111d('0x33'),require(_0x111d('0x34')));_0x12b249[_0x111d('0x23')](_0x111d('0x35'),require(_0x111d('0x36')));_0x12b249[_0x111d('0x23')](_0x111d('0x37'),require(_0x111d('0x38')));_0x12b249[_0x111d('0x23')](_0x111d('0x39'),require(_0x111d('0x3a')));_0x12b249['use'](_0x111d('0x3b'),require(_0x111d('0x3c')));_0x12b249[_0x111d('0x23')](_0x111d('0x3d'),require('./api/mailServerOut'));_0x12b249[_0x111d('0x23')](_0x111d('0x3e'),require(_0x111d('0x3f')));_0x12b249['use'](_0x111d('0x40'),require(_0x111d('0x41')));_0x12b249[_0x111d('0x23')](_0x111d('0x42'),require('./api/mailSubstatus'));_0x12b249[_0x111d('0x23')](_0x111d('0x43'),require(_0x111d('0x44')));_0x12b249['use'](_0x111d('0x45'),require(_0x111d('0x46')));_0x12b249['use'](_0x111d('0x47'),require(_0x111d('0x48')));_0x12b249['use'](_0x111d('0x49'),require('./api/mailQueueReport'));_0x12b249[_0x111d('0x23')](_0x111d('0x4a'),require(_0x111d('0x4b')));_0x12b249[_0x111d('0x23')](_0x111d('0x4c'),require('./api/dashboardItem'));_0x12b249['use']('/api/fax/accounts',require(_0x111d('0x4d')));_0x12b249[_0x111d('0x23')]('/api/fax/applications',require(_0x111d('0x4e')));_0x12b249[_0x111d('0x23')](_0x111d('0x4f'),require(_0x111d('0x50')));_0x12b249[_0x111d('0x23')](_0x111d('0x51'),require(_0x111d('0x52')));_0x12b249[_0x111d('0x23')](_0x111d('0x53'),require('./api/faxQueue'));_0x12b249[_0x111d('0x23')](_0x111d('0x54'),require(_0x111d('0x55')));_0x12b249['use'](_0x111d('0x56'),require(_0x111d('0x57')));_0x12b249['use']('/api/sms/applications',require(_0x111d('0x58')));_0x12b249[_0x111d('0x23')]('/api/sms/interactions',require(_0x111d('0x59')));_0x12b249[_0x111d('0x23')](_0x111d('0x5a'),require(_0x111d('0x5b')));_0x12b249[_0x111d('0x23')](_0x111d('0x5c'),require(_0x111d('0x5d')));_0x12b249['use'](_0x111d('0x5e'),require(_0x111d('0x5f')));_0x12b249[_0x111d('0x23')](_0x111d('0x60'),require(_0x111d('0x61')));_0x12b249['use']('/api/openchannel/interactions',require(_0x111d('0x62')));_0x12b249[_0x111d('0x23')](_0x111d('0x63'),require(_0x111d('0x64')));_0x12b249[_0x111d('0x23')]('/api/openchannel/queues',require('./api/openchannelQueue'));_0x12b249['use'](_0x111d('0x65'),require(_0x111d('0x66')));_0x12b249[_0x111d('0x23')](_0x111d('0x67'),require(_0x111d('0x68')));_0x12b249['use'](_0x111d('0x69'),require(_0x111d('0x6a')));_0x12b249[_0x111d('0x23')](_0x111d('0x6b'),require(_0x111d('0x6c')));_0x12b249['use'](_0x111d('0x6d'),require(_0x111d('0x6e')));_0x12b249[_0x111d('0x23')](_0x111d('0x6f'),require(_0x111d('0x70')));_0x12b249['use'](_0x111d('0x71'),require('./api/chatQueue'));_0x12b249[_0x111d('0x23')](_0x111d('0x72'),require(_0x111d('0x73')));_0x12b249[_0x111d('0x23')](_0x111d('0x74'),require(_0x111d('0x75')));_0x12b249[_0x111d('0x23')]('/api/cm/companies',require(_0x111d('0x76')));_0x12b249['use'](_0x111d('0x77'),require(_0x111d('0x78')));_0x12b249['use']('/api/cm/hopper',require('./api/cmHopper'));_0x12b249[_0x111d('0x23')]('/api/cm/hopper_black',require('./api/cmHopperBlack'));_0x12b249['use'](_0x111d('0x79'),require('./api/cmHopperFinal'));_0x12b249['use'](_0x111d('0x7a'),require(_0x111d('0x7b')));_0x12b249[_0x111d('0x23')]('/api/cm/custom_fields',require(_0x111d('0x7c')));_0x12b249['use']('/api/actions',require(_0x111d('0x7d')));_0x12b249['use'](_0x111d('0x7e'),require(_0x111d('0x7f')));_0x12b249[_0x111d('0x23')](_0x111d('0x80'),require(_0x111d('0x81')));_0x12b249['use'](_0x111d('0x82'),require(_0x111d('0x83')));_0x12b249[_0x111d('0x23')](_0x111d('0x84'),require(_0x111d('0x85')));_0x12b249[_0x111d('0x23')](_0x111d('0x86'),require('./api/interval'));_0x12b249['use']('/api/pauses',require(_0x111d('0x87')));_0x12b249[_0x111d('0x23')](_0x111d('0x88'),require(_0x111d('0x89')));_0x12b249[_0x111d('0x23')]('/api/voiceQueuesLog',require(_0x111d('0x8a')));_0x12b249[_0x111d('0x23')](_0x111d('0x8b'),require(_0x111d('0x8c')));_0x12b249[_0x111d('0x23')](_0x111d('0x8d'),require(_0x111d('0x8e')));_0x12b249[_0x111d('0x23')](_0x111d('0x8f'),require('./api/tag'));_0x12b249['use'](_0x111d('0x90'),require(_0x111d('0x91')));_0x12b249[_0x111d('0x23')](_0x111d('0x92'),require(_0x111d('0x93')));_0x12b249[_0x111d('0x23')](_0x111d('0x94'),require(_0x111d('0x95')));_0x12b249['use'](_0x111d('0x96'),require(_0x111d('0x97')));_0x12b249[_0x111d('0x23')](_0x111d('0x98'),require(_0x111d('0x99')));_0x12b249[_0x111d('0x23')]('/api/analytics/custom_reports',require(_0x111d('0x9a')));_0x12b249['use'](_0x111d('0x9b'),require('./api/analyticDefaultReport'));_0x12b249[_0x111d('0x23')](_0x111d('0x9c'),require(_0x111d('0x9d')));_0x12b249[_0x111d('0x23')](_0x111d('0x9e'),require(_0x111d('0x9f')));_0x12b249['use'](_0x111d('0xa0'),require(_0x111d('0xa1')));_0x12b249[_0x111d('0x23')](_0x111d('0xa2'),require(_0x111d('0xa3')));_0x12b249[_0x111d('0x23')]('/api/integrations/salesforce/accounts',require(_0x111d('0xa4')));_0x12b249[_0x111d('0x23')]('/api/integrations/salesforce/configurations',require(_0x111d('0xa5')));_0x12b249[_0x111d('0x23')](_0x111d('0xa6'),require('./api/intSalesforceField'));_0x12b249[_0x111d('0x23')](_0x111d('0xa7'),require('./api/intSugarcrmAccount'));_0x12b249[_0x111d('0x23')](_0x111d('0xa8'),require(_0x111d('0xa9')));_0x12b249[_0x111d('0x23')](_0x111d('0xaa'),require('./api/intSugarcrmField'));_0x12b249[_0x111d('0x23')]('/api/integrations/desk/accounts',require(_0x111d('0xab')));_0x12b249['use']('/api/integrations/desk/configurations',require(_0x111d('0xac')));_0x12b249[_0x111d('0x23')](_0x111d('0xad'),require(_0x111d('0xae')));_0x12b249[_0x111d('0x23')](_0x111d('0xaf'),require(_0x111d('0xb0')));_0x12b249['use'](_0x111d('0xb1'),require(_0x111d('0xb2')));_0x12b249['use']('/api/integrations/zoho/fields',require(_0x111d('0xb3')));_0x12b249[_0x111d('0x23')](_0x111d('0xb4'),require('./api/intZendeskAccount'));_0x12b249[_0x111d('0x23')]('/api/integrations/zendesk/configurations',require(_0x111d('0xb5')));_0x12b249[_0x111d('0x23')](_0x111d('0xb6'),require(_0x111d('0xb7')));_0x12b249['use'](_0x111d('0xb8'),require(_0x111d('0xb9')));_0x12b249['use']('/api/integrations/freshdesk/configurations',require(_0x111d('0xba')));_0x12b249['use']('/api/integrations/freshdesk/fields',require(_0x111d('0xbb')));_0x12b249[_0x111d('0x23')](_0x111d('0xbc'),require(_0x111d('0xbd')));_0x12b249[_0x111d('0x23')](_0x111d('0xbe'),require('./api/intVtigerConfiguration'));_0x12b249['use'](_0x111d('0xbf'),require(_0x111d('0xc0')));_0x12b249[_0x111d('0x23')](_0x111d('0xc1'),require('./api/intServicenowAccount'));_0x12b249[_0x111d('0x23')](_0x111d('0xc2'),require(_0x111d('0xc3')));_0x12b249[_0x111d('0x23')](_0x111d('0xc4'),require(_0x111d('0xc5')));_0x12b249[_0x111d('0x23')](_0x111d('0xc6'),require(_0x111d('0xc7')));_0x12b249[_0x111d('0x23')](_0x111d('0xc8'),require(_0x111d('0xc9')));_0x12b249['use'](_0x111d('0xca'),require(_0x111d('0xcb')));_0x12b249[_0x111d('0x23')]('/api/integrations/freshsales/accounts',require(_0x111d('0xcc')));_0x12b249[_0x111d('0x23')](_0x111d('0xcd'),require(_0x111d('0xce')));_0x12b249[_0x111d('0x23')](_0x111d('0xcf'),require(_0x111d('0xd0')));_0x12b249['use'](_0x111d('0xd1'),require(_0x111d('0xd2')));_0x12b249[_0x111d('0x23')]('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x12b249[_0x111d('0x23')](_0x111d('0xd3'),require(_0x111d('0xd4')));_0x12b249[_0x111d('0x23')]('/api/jscripty/answers/reports',require(_0x111d('0xd5')));_0x12b249['use'](_0x111d('0xd6'),require(_0x111d('0xd7')));_0x12b249['use'](_0x111d('0xd8'),require('./api/jscriptySessionReport'));_0x12b249[_0x111d('0x23')]('/api/sms/reports/queue',require(_0x111d('0xd9')));_0x12b249['use'](_0x111d('0xda'),require('./api/squareReport'));_0x12b249[_0x111d('0x23')](_0x111d('0xdb'),require(_0x111d('0xdc')));_0x12b249[_0x111d('0x23')](_0x111d('0xdd'),require(_0x111d('0xde')));_0x12b249[_0x111d('0x23')](_0x111d('0xdf'),require(_0x111d('0xe0')));_0x12b249[_0x111d('0x23')]('/api/square/odbc',require(_0x111d('0xe1')));_0x12b249[_0x111d('0x23')](_0x111d('0xe2'),require('./api/squareProject'));_0x12b249[_0x111d('0x23')](_0x111d('0xe3'),require('./api/squareRecording'));_0x12b249[_0x111d('0x23')](_0x111d('0xe4'),require('./api/squareMessage'));_0x12b249['use'](_0x111d('0xe5'),require(_0x111d('0xe6')));_0x12b249[_0x111d('0x23')](_0x111d('0xe7'),require(_0x111d('0xe8')));_0x12b249[_0x111d('0x23')](_0x111d('0xe9'),require(_0x111d('0xea')));_0x12b249['use']('/api/migrations',require('./api/migration'));_0x12b249[_0x111d('0x23')](_0x111d('0xeb'),require(_0x111d('0xec')));_0x12b249['use']('/api/plugins',require('./api/plugin'));_0x12b249[_0x111d('0x23')]('/api/mail/reports/transfer',require(_0x111d('0xed')));_0x12b249[_0x111d('0x23')](_0x111d('0xee'),require(_0x111d('0xef')));_0x12b249[_0x111d('0x23')](_0x111d('0xf0'),require('./api/faxTransferReport'));_0x12b249['use'](_0x111d('0xf1'),require(_0x111d('0xf2')));_0x12b249['use'](_0x111d('0xf3'),require('./api/smsTransferReport'));_0x12b249[_0x111d('0x23')]('/api/cm/lists',require(_0x111d('0xf4')));_0x12b249[_0x111d('0x23')](_0x111d('0xf5'),require(_0x111d('0xf6')));_0x12b249[_0x111d('0x23')](_0x111d('0xf7'),require('./api/userProfile'));_0x12b249[_0x111d('0x23')](_0x111d('0xf8'),require(_0x111d('0xf9')));_0x12b249[_0x111d('0x23')](_0x111d('0xfa'),require(_0x111d('0xfb')));_0x12b249[_0x111d('0x23')]('/api/userNotifications',require(_0x111d('0xfc')));_0x12b249['use'](_0x111d('0xfd'),require(_0x111d('0xfe')));_0x12b249[_0x111d('0x23')](_0x111d('0xff'),require('./api/whatsappApplication'));_0x12b249[_0x111d('0x23')]('/api/whatsapp/interactions',require(_0x111d('0x100')));_0x12b249[_0x111d('0x23')]('/api/whatsapp/messages',require(_0x111d('0x101')));_0x12b249[_0x111d('0x23')](_0x111d('0x102'),require(_0x111d('0x103')));_0x12b249[_0x111d('0x23')](_0x111d('0x104'),require(_0x111d('0x105')));_0x12b249[_0x111d('0x23')](_0x111d('0x106'),require(_0x111d('0x107')));_0x12b249[_0x111d('0x23')](_0x111d('0x108'),require(_0x111d('0x109')));_0x12b249['use'](_0x111d('0x10a'),require(_0x111d('0x10b')));_0x12b249['use'](_0x111d('0x10c'),require('./api/authLocal'));_0x12b249['use']('/api/auth/google',require(_0x111d('0x10d')));_0x12b249[_0x111d('0x23')]('/api/auth/activedirectory',require(_0x111d('0x10e')));_0x12b249[_0x111d('0x23')](_0x111d('0x10f'),require(_0x111d('0x110')));_0x12b249['use'](_0x111d('0x111'),require(_0x111d('0x112')));_0x12b249['use'](_0x111d('0x113'),require(_0x111d('0x114')));_0x12b249['use'](_0x111d('0x115'),require(_0x111d('0x116')));_0x12b249['use']('/api/pm2',require(_0x111d('0x117')));_0x12b249[_0x111d('0x23')](_0x111d('0x118'),require('./api/webbar'));_0x12b249[_0x111d('0x23')](_0x111d('0x119'),express['static'](path[_0x111d('0x11a')](config[_0x111d('0x11b')],'/apidoc')));_0x12b249['use']('/www',express[_0x111d('0x11c')](path[_0x111d('0x11a')](config[_0x111d('0x11b')],_0x111d('0x11d'))));_0x12b249['use'](_0x111d('0x11e'),express[_0x111d('0x11c')](path[_0x111d('0x11a')](config['root'],_0x111d('0x11e'))));_0x12b249[_0x111d('0x23')](_0x111d('0x11f'),express[_0x111d('0x11c')](path['join'](config[_0x111d('0x11b')],_0x111d('0x120'),_0x111d('0x121'))));_0x12b249[_0x111d('0x23')]('/plugins',express[_0x111d('0x11c')](path['join'](config[_0x111d('0x11b')],_0x111d('0x122'))));_0x12b249[_0x111d('0x123')](_0x111d('0x124'))[_0x111d('0x125')](errors[0x194]);_0x12b249[_0x111d('0x123')]('/*')[_0x111d('0x125')](function(_0x4dcadf,_0x1200d5){_0x1200d5[_0x111d('0x126')](path[_0x111d('0x127')](_0x12b249[_0x111d('0x125')](_0x111d('0x128'))+_0x111d('0x129')));});};var sensitiveFields=[_0x111d('0x12a'),_0x111d('0x12b'),'newPassword',_0x111d('0x12c'),'firstName',_0x111d('0x12d'),_0x111d('0x12e'),_0x111d('0x12f'),_0x111d('0x130'),_0x111d('0x131'),'email','clientId','clientSecret',_0x111d('0x132'),_0x111d('0x133'),'accessKey',_0x111d('0x134'),_0x111d('0x135'),_0x111d('0x136'),_0x111d('0x137'),_0x111d('0x138'),_0x111d('0x139'),_0x111d('0x13a'),_0x111d('0x13b'),'membername','calleridname',_0x111d('0x13c'),_0x111d('0x13d'),_0x111d('0x13e'),_0x111d('0x13f'),'privateKey',_0x111d('0x140'),_0x111d('0x141'),_0x111d('0x142'),_0x111d('0x16'),_0x111d('0x143'),_0x111d('0x144'),_0x111d('0x145'),_0x111d('0x146'),_0x111d('0x147'),_0x111d('0x148'),_0x111d('0x149')];function maskSensitiveData(_0x59ba58){var _0x610177=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x59ba58))return;for(var _0x5accbb in _0x59ba58){if(_[_0x111d('0x14a')](_0x59ba58[_0x5accbb])){for(var _0x2d1c85=0x0;_0x2d1c85<_0x59ba58[_0x5accbb][_0x111d('0x14b')];_0x2d1c85++){maskSensitiveData(_0x59ba58[_0x5accbb][_0x2d1c85]);}}else if(_['isPlainObject'](_0x59ba58[_0x5accbb])){maskSensitiveData(_0x59ba58[_0x5accbb]);}else if(_['isString'](_0x59ba58[_0x5accbb])){_0x59ba58[_0x5accbb]=_0x59ba58[_0x5accbb][_0x111d('0x14c')](/{{{/g,_0x111d('0x14d'))[_0x111d('0x14c')](/}}}/g,_0x111d('0x14e'))['replace'](/{{/g,'@{')[_0x111d('0x14c')](/}}/g,'}@');if(_[_0x111d('0x14f')](sensitiveFields,_0x5accbb)){_0x59ba58[_0x5accbb]=_0x59ba58[_0x5accbb]['replace'](_0x610177,'*');}}}} \ No newline at end of file +var _0xd93e=['/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/chatQueueReport','/api/chat/internal/messages','/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/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','/api/license','/api/campaigns','./api/campaign','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','./api/system','/api/webbar','./api/webbar','/apidoc','static','root','/www','/demo','join','/snippet','snippet','3.0.0','/server/files/plugins','get','route','resolve','appPath','/index.html','username','password','lastName','street','fax','email','clientId','clientSecret','securityToken','code','accessKey','channelSecret','accessTokenSecret','authToken','consumerKey','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','key','pass','accountSid','dsn','registry','oldPassword','isPlainObject','replace','@@{','includes','lodash','path','express','util','./errors','./config/environment','./config/logger','api','auth','safeTemplate','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','device','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceContext','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','./api/voiceQueueReport','./api/memberReport','/api/trunks','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/queues','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/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/intSugarcrmConfiguration','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/fields','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount'];(function(_0x2efccf,_0x6d7311){var _0x433d78=function(_0xc68641){while(--_0xc68641){_0x2efccf['push'](_0x2efccf['shift']());}};_0x433d78(++_0x6d7311);}(_0xd93e,0x1d7));var _0xed93=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xd93e[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0xed93('0x0'));var path=require(_0xed93('0x1'));var express=require(_0xed93('0x2'));var ewinston=require('express-winston');var util=require(_0xed93('0x3'));var errors=require(_0xed93('0x4'));var config=require(_0xed93('0x5'));var logger=require(_0xed93('0x6'))(_0xed93('0x7'));var authLogger=require('./config/logger')(_0xed93('0x8'));var safeTemplate=require('./safe-template')[_0xed93('0x9')];exports[_0xed93('0xa')]=function(_0x462954){_0x462954[_0xed93('0xb')](ewinston[_0xed93('0xc')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x40ceef,_0x4697f6){var _0x4278ea=_0xed93('0xd');if(!_[_0xed93('0xe')](_0x40ceef[_0xed93('0xf')])){_0x4278ea+=_0xed93('0x10');var _0x233e88=_0x40ceef['body'];maskSensitiveData(_0x233e88);}return safeTemplate(util[_0xed93('0x11')](_0x4278ea,_0x40ceef[_0xed93('0x12')],_0x40ceef[_0xed93('0x13')][_0xed93('0x14')]?_0x40ceef[_0xed93('0x13')][_0xed93('0x14')]:_0x40ceef[_0xed93('0x15')][_0xed93('0x16')]||_0x40ceef['ip'],_0x40ceef[_0xed93('0x17')],_0x4697f6[_0xed93('0x18')],_0x4697f6[_0xed93('0x19')],_0x40ceef[_0xed93('0x1a')]?_0x40ceef[_0xed93('0x1a')]['id']:null,_0x40ceef[_0xed93('0x1a')]?_0x40ceef['user'][_0xed93('0x1b')]:null,_0x40ceef['user']?_0x40ceef[_0xed93('0x1a')][_0xed93('0x1c')]:null,_0x233e88?util[_0xed93('0x1d')](_0x233e88,![],null):''));}}));_0x462954[_0xed93('0xb')](ewinston[_0xed93('0xc')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x145bfe,_0x821301){var _0x5ccfe2=_0xed93('0x1e');if(_0x145bfe['body']&&_0x145bfe[_0xed93('0xf')]['device']&&_0x145bfe[_0xed93('0xf')][_0xed93('0x1f')]){_0x5ccfe2='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xed93('0x11')](_0x5ccfe2,_0x145bfe[_0xed93('0x12')],_0x145bfe[_0xed93('0x13')][_0xed93('0x14')]?_0x145bfe[_0xed93('0x13')][_0xed93('0x14')]:_0x145bfe[_0xed93('0x15')][_0xed93('0x16')]||_0x145bfe['ip'],_0x145bfe[_0xed93('0x17')],_0x821301['statusCode'],_0x821301[_0xed93('0x19')],_0x145bfe[_0xed93('0x1a')]?_0x145bfe[_0xed93('0x1a')]['id']:null,_0x145bfe[_0xed93('0x1a')]?_0x145bfe[_0xed93('0x1a')][_0xed93('0x1b')]:null,_0x145bfe[_0xed93('0x1a')]?_0x145bfe['user'][_0xed93('0x1c')]:null,_0x145bfe['body']&&_0x145bfe[_0xed93('0xf')]['device']?_0x145bfe['body'][_0xed93('0x20')]:_0xed93('0x21'),_0x145bfe[_0xed93('0xf')]&&_0x145bfe[_0xed93('0xf')][_0xed93('0x1f')]?_0x145bfe[_0xed93('0xf')][_0xed93('0x1f')]:'',_0x145bfe[_0xed93('0xf')]&&_0x145bfe[_0xed93('0xf')][_0xed93('0x22')]?_0x145bfe[_0xed93('0xf')][_0xed93('0x22')]:'');},'ignoreRoute':function(_0x39e934){var _0x426681=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x426681[_0xed93('0x23')](_0x39e934[_0xed93('0x17')]);}}));_0x462954['use'](_0xed93('0x24'),require(_0xed93('0x25')));_0x462954['use'](_0xed93('0x26'),require('./api/voiceChanSpy'));_0x462954[_0xed93('0xb')]('/api/voice/contexts',require(_0xed93('0x27')));_0x462954[_0xed93('0xb')]('/api/voice/extensions',require('./api/voiceExtension'));_0x462954[_0xed93('0xb')](_0xed93('0x28'),require(_0xed93('0x29')));_0x462954[_0xed93('0xb')](_0xed93('0x2a'),require(_0xed93('0x2b')));_0x462954[_0xed93('0xb')]('/api/voice/recordings',require(_0xed93('0x2c')));_0x462954[_0xed93('0xb')]('/api/screen/recordings',require(_0xed93('0x2d')));_0x462954['use'](_0xed93('0x2e'),require(_0xed93('0x2f')));_0x462954[_0xed93('0xb')](_0xed93('0x30'),require('./api/voiceMailMessage'));_0x462954['use'](_0xed93('0x31'),require('./api/voiceCallReport'));_0x462954['use'](_0xed93('0x32'),require(_0xed93('0x33')));_0x462954[_0xed93('0xb')]('/api/voice/agents/reports',require(_0xed93('0x34')));_0x462954[_0xed93('0xb')]('/api/voice/queues/reports',require(_0xed93('0x35')));_0x462954[_0xed93('0xb')]('/api/members/reports',require(_0xed93('0x36')));_0x462954[_0xed93('0xb')](_0xed93('0x37'),require('./api/trunk'));_0x462954[_0xed93('0xb')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x462954[_0xed93('0xb')](_0xed93('0x38'),require('./api/mailServerOut'));_0x462954[_0xed93('0xb')](_0xed93('0x39'),require(_0xed93('0x3a')));_0x462954[_0xed93('0xb')](_0xed93('0x3b'),require(_0xed93('0x3c')));_0x462954[_0xed93('0xb')](_0xed93('0x3d'),require('./api/mailSubstatus'));_0x462954[_0xed93('0xb')]('/api/mail/interactions',require('./api/mailInteraction'));_0x462954[_0xed93('0xb')](_0xed93('0x3e'),require(_0xed93('0x3f')));_0x462954['use'](_0xed93('0x40'),require(_0xed93('0x41')));_0x462954[_0xed93('0xb')]('/api/mail/reports/queue',require(_0xed93('0x42')));_0x462954[_0xed93('0xb')](_0xed93('0x43'),require('./api/dashboard'));_0x462954['use'](_0xed93('0x44'),require(_0xed93('0x45')));_0x462954[_0xed93('0xb')]('/api/fax/accounts',require(_0xed93('0x46')));_0x462954[_0xed93('0xb')](_0xed93('0x47'),require(_0xed93('0x48')));_0x462954[_0xed93('0xb')]('/api/fax/interactions',require(_0xed93('0x49')));_0x462954[_0xed93('0xb')](_0xed93('0x4a'),require(_0xed93('0x4b')));_0x462954['use'](_0xed93('0x4c'),require(_0xed93('0x4d')));_0x462954[_0xed93('0xb')](_0xed93('0x4e'),require(_0xed93('0x4f')));_0x462954[_0xed93('0xb')](_0xed93('0x50'),require('./api/smsAccount'));_0x462954[_0xed93('0xb')](_0xed93('0x51'),require(_0xed93('0x52')));_0x462954['use'](_0xed93('0x53'),require(_0xed93('0x54')));_0x462954[_0xed93('0xb')]('/api/sms/messages',require('./api/smsMessage'));_0x462954['use'](_0xed93('0x55'),require('./api/smsQueue'));_0x462954[_0xed93('0xb')]('/api/openchannel/accounts',require('./api/openchannelAccount'));_0x462954['use'](_0xed93('0x56'),require('./api/openchannelApplication'));_0x462954[_0xed93('0xb')](_0xed93('0x57'),require(_0xed93('0x58')));_0x462954[_0xed93('0xb')](_0xed93('0x59'),require(_0xed93('0x5a')));_0x462954[_0xed93('0xb')](_0xed93('0x5b'),require(_0xed93('0x5c')));_0x462954[_0xed93('0xb')](_0xed93('0x5d'),require('./api/chatWebsite'));_0x462954['use']('/api/openchannel/reports/queue',require(_0xed93('0x5e')));_0x462954[_0xed93('0xb')](_0xed93('0x5f'),require(_0xed93('0x60')));_0x462954[_0xed93('0xb')](_0xed93('0x61'),require(_0xed93('0x62')));_0x462954[_0xed93('0xb')](_0xed93('0x63'),require(_0xed93('0x64')));_0x462954[_0xed93('0xb')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x462954[_0xed93('0xb')](_0xed93('0x65'),require(_0xed93('0x66')));_0x462954[_0xed93('0xb')](_0xed93('0x67'),require(_0xed93('0x68')));_0x462954[_0xed93('0xb')](_0xed93('0x69'),require(_0xed93('0x6a')));_0x462954[_0xed93('0xb')]('/api/cm/companies',require(_0xed93('0x6b')));_0x462954[_0xed93('0xb')](_0xed93('0x6c'),require(_0xed93('0x6d')));_0x462954[_0xed93('0xb')]('/api/cm/hopper',require('./api/cmHopper'));_0x462954[_0xed93('0xb')](_0xed93('0x6e'),require(_0xed93('0x6f')));_0x462954[_0xed93('0xb')]('/api/cm/hopper_final',require(_0xed93('0x70')));_0x462954[_0xed93('0xb')](_0xed93('0x71'),require('./api/cmHopperHistory'));_0x462954['use'](_0xed93('0x72'),require(_0xed93('0x73')));_0x462954[_0xed93('0xb')](_0xed93('0x74'),require(_0xed93('0x75')));_0x462954[_0xed93('0xb')]('/api/automations',require('./api/automation'));_0x462954[_0xed93('0xb')](_0xed93('0x76'),require(_0xed93('0x77')));_0x462954['use']('/api/dispositions',require(_0xed93('0x78')));_0x462954[_0xed93('0xb')](_0xed93('0x79'),require(_0xed93('0x7a')));_0x462954[_0xed93('0xb')](_0xed93('0x7b'),require('./api/interval'));_0x462954[_0xed93('0xb')](_0xed93('0x7c'),require(_0xed93('0x7d')));_0x462954[_0xed93('0xb')](_0xed93('0x7e'),require(_0xed93('0x7f')));_0x462954['use'](_0xed93('0x80'),require(_0xed93('0x81')));_0x462954[_0xed93('0xb')](_0xed93('0x82'),require(_0xed93('0x83')));_0x462954[_0xed93('0xb')]('/api/sounds',require(_0xed93('0x84')));_0x462954[_0xed93('0xb')](_0xed93('0x85'),require(_0xed93('0x86')));_0x462954[_0xed93('0xb')](_0xed93('0x87'),require(_0xed93('0x88')));_0x462954[_0xed93('0xb')]('/api/triggers',require('./api/trigger'));_0x462954[_0xed93('0xb')]('/api/variables',require('./api/variable'));_0x462954[_0xed93('0xb')](_0xed93('0x89'),require(_0xed93('0x8a')));_0x462954[_0xed93('0xb')](_0xed93('0x8b'),require(_0xed93('0x8c')));_0x462954[_0xed93('0xb')](_0xed93('0x8d'),require(_0xed93('0x8e')));_0x462954[_0xed93('0xb')](_0xed93('0x8f'),require(_0xed93('0x90')));_0x462954[_0xed93('0xb')](_0xed93('0x91'),require('./api/analyticExtractedReport'));_0x462954[_0xed93('0xb')](_0xed93('0x92'),require(_0xed93('0x93')));_0x462954[_0xed93('0xb')](_0xed93('0x94'),require(_0xed93('0x95')));_0x462954[_0xed93('0xb')](_0xed93('0x96'),require('./api/analyticTreeReport'));_0x462954[_0xed93('0xb')](_0xed93('0x97'),require(_0xed93('0x98')));_0x462954[_0xed93('0xb')](_0xed93('0x99'),require(_0xed93('0x9a')));_0x462954['use'](_0xed93('0x9b'),require(_0xed93('0x9c')));_0x462954[_0xed93('0xb')](_0xed93('0x9d'),require(_0xed93('0x9e')));_0x462954[_0xed93('0xb')]('/api/integrations/sugarcrm/configurations',require(_0xed93('0x9f')));_0x462954[_0xed93('0xb')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x462954[_0xed93('0xb')](_0xed93('0xa0'),require(_0xed93('0xa1')));_0x462954[_0xed93('0xb')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x462954[_0xed93('0xb')](_0xed93('0xa2'),require('./api/intDeskField'));_0x462954[_0xed93('0xb')](_0xed93('0xa3'),require('./api/intZohoAccount'));_0x462954[_0xed93('0xb')](_0xed93('0xa4'),require(_0xed93('0xa5')));_0x462954[_0xed93('0xb')](_0xed93('0xa6'),require(_0xed93('0xa7')));_0x462954[_0xed93('0xb')](_0xed93('0xa8'),require('./api/intZendeskAccount'));_0x462954['use'](_0xed93('0xa9'),require(_0xed93('0xaa')));_0x462954['use'](_0xed93('0xab'),require(_0xed93('0xac')));_0x462954[_0xed93('0xb')](_0xed93('0xad'),require(_0xed93('0xae')));_0x462954['use'](_0xed93('0xaf'),require(_0xed93('0xb0')));_0x462954[_0xed93('0xb')](_0xed93('0xb1'),require(_0xed93('0xb2')));_0x462954[_0xed93('0xb')](_0xed93('0xb3'),require(_0xed93('0xb4')));_0x462954[_0xed93('0xb')](_0xed93('0xb5'),require(_0xed93('0xb6')));_0x462954['use'](_0xed93('0xb7'),require(_0xed93('0xb8')));_0x462954[_0xed93('0xb')](_0xed93('0xb9'),require('./api/intServicenowAccount'));_0x462954[_0xed93('0xb')]('/api/integrations/servicenow/configurations',require(_0xed93('0xba')));_0x462954['use'](_0xed93('0xbb'),require(_0xed93('0xbc')));_0x462954[_0xed93('0xb')]('/api/integrations/dynamics365/accounts',require(_0xed93('0xbd')));_0x462954[_0xed93('0xb')](_0xed93('0xbe'),require(_0xed93('0xbf')));_0x462954[_0xed93('0xb')](_0xed93('0xc0'),require(_0xed93('0xc1')));_0x462954[_0xed93('0xb')](_0xed93('0xc2'),require(_0xed93('0xc3')));_0x462954[_0xed93('0xb')](_0xed93('0xc4'),require(_0xed93('0xc5')));_0x462954[_0xed93('0xb')](_0xed93('0xc6'),require(_0xed93('0xc7')));_0x462954[_0xed93('0xb')](_0xed93('0xc8'),require('./api/network'));_0x462954['use']('/api/chat/reports/queue',require(_0xed93('0xc9')));_0x462954[_0xed93('0xb')](_0xed93('0xca'),require('./api/chatInternalMessage'));_0x462954[_0xed93('0xb')](_0xed93('0xcb'),require(_0xed93('0xcc')));_0x462954[_0xed93('0xb')](_0xed93('0xcd'),require(_0xed93('0xce')));_0x462954[_0xed93('0xb')](_0xed93('0xcf'),require(_0xed93('0xd0')));_0x462954[_0xed93('0xb')](_0xed93('0xd1'),require(_0xed93('0xd2')));_0x462954[_0xed93('0xb')](_0xed93('0xd3'),require(_0xed93('0xd4')));_0x462954[_0xed93('0xb')](_0xed93('0xd5'),require('./api/squareReportDetail'));_0x462954[_0xed93('0xb')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x462954[_0xed93('0xb')](_0xed93('0xd6'),require(_0xed93('0xd7')));_0x462954[_0xed93('0xb')](_0xed93('0xd8'),require(_0xed93('0xd9')));_0x462954[_0xed93('0xb')](_0xed93('0xda'),require(_0xed93('0xdb')));_0x462954[_0xed93('0xb')](_0xed93('0xdc'),require('./api/squareRecording'));_0x462954['use'](_0xed93('0xdd'),require(_0xed93('0xde')));_0x462954['use'](_0xed93('0xdf'),require('./api/team'));_0x462954[_0xed93('0xb')](_0xed93('0xe0'),require('./api/license'));_0x462954[_0xed93('0xb')](_0xed93('0xe1'),require(_0xed93('0xe2')));_0x462954[_0xed93('0xb')]('/api/migrations',require('./api/migration'));_0x462954[_0xed93('0xb')]('/api/attachments',require('./api/attachment'));_0x462954[_0xed93('0xb')]('/api/plugins',require(_0xed93('0xe3')));_0x462954[_0xed93('0xb')](_0xed93('0xe4'),require(_0xed93('0xe5')));_0x462954['use'](_0xed93('0xe6'),require(_0xed93('0xe7')));_0x462954[_0xed93('0xb')](_0xed93('0xe8'),require('./api/faxTransferReport'));_0x462954[_0xed93('0xb')](_0xed93('0xe9'),require(_0xed93('0xea')));_0x462954[_0xed93('0xb')](_0xed93('0xeb'),require('./api/smsTransferReport'));_0x462954[_0xed93('0xb')](_0xed93('0xec'),require('./api/cmList'));_0x462954[_0xed93('0xb')](_0xed93('0xed'),require(_0xed93('0xee')));_0x462954[_0xed93('0xb')](_0xed93('0xef'),require(_0xed93('0xf0')));_0x462954[_0xed93('0xb')](_0xed93('0xf1'),require(_0xed93('0xf2')));_0x462954[_0xed93('0xb')]('/api/userProfile/resources',require(_0xed93('0xf3')));_0x462954[_0xed93('0xb')](_0xed93('0xf4'),require(_0xed93('0xf5')));_0x462954[_0xed93('0xb')](_0xed93('0xf6'),require(_0xed93('0xf7')));_0x462954[_0xed93('0xb')](_0xed93('0xf8'),require(_0xed93('0xf9')));_0x462954[_0xed93('0xb')](_0xed93('0xfa'),require(_0xed93('0xfb')));_0x462954[_0xed93('0xb')](_0xed93('0xfc'),require(_0xed93('0xfd')));_0x462954[_0xed93('0xb')](_0xed93('0xfe'),require(_0xed93('0xff')));_0x462954[_0xed93('0xb')](_0xed93('0x100'),require(_0xed93('0x101')));_0x462954[_0xed93('0xb')](_0xed93('0x102'),require(_0xed93('0x103')));_0x462954['use'](_0xed93('0x104'),require('./api/cloudProvider'));_0x462954['use'](_0xed93('0x105'),require(_0xed93('0x106')));_0x462954['use'](_0xed93('0x107'),require(_0xed93('0x108')));_0x462954['use']('/api/auth/google',require('./api/authGoogle'));_0x462954[_0xed93('0xb')](_0xed93('0x109'),require(_0xed93('0x10a')));_0x462954[_0xed93('0xb')](_0xed93('0x10b'),require(_0xed93('0x10c')));_0x462954['use'](_0xed93('0x10d'),require('./api/rpc'));_0x462954[_0xed93('0xb')](_0xed93('0x10e'),require(_0xed93('0x10f')));_0x462954[_0xed93('0xb')]('/api/system',require(_0xed93('0x110')));_0x462954[_0xed93('0xb')]('/api/pm2',require('./api/pm2'));_0x462954['use'](_0xed93('0x111'),require(_0xed93('0x112')));_0x462954[_0xed93('0xb')](_0xed93('0x113'),express[_0xed93('0x114')](path['join'](config[_0xed93('0x115')],_0xed93('0x113'))));_0x462954[_0xed93('0xb')](_0xed93('0x116'),express[_0xed93('0x114')](path['join'](config[_0xed93('0x115')],_0xed93('0x116'))));_0x462954[_0xed93('0xb')](_0xed93('0x117'),express[_0xed93('0x114')](path[_0xed93('0x118')](config[_0xed93('0x115')],_0xed93('0x117'))));_0x462954[_0xed93('0xb')](_0xed93('0x119'),express[_0xed93('0x114')](path[_0xed93('0x118')](config[_0xed93('0x115')],_0xed93('0x11a'),_0xed93('0x11b'))));_0x462954[_0xed93('0xb')]('/plugins',express[_0xed93('0x114')](path['join'](config['root'],_0xed93('0x11c'))));_0x462954['route']('/:url(api|auth|components|app|bower_components|assets)/*')[_0xed93('0x11d')](errors[0x194]);_0x462954[_0xed93('0x11e')]('/*')[_0xed93('0x11d')](function(_0x2ab62f,_0x2c6780){_0x2c6780['sendFile'](path[_0xed93('0x11f')](_0x462954[_0xed93('0x11d')](_0xed93('0x120'))+_0xed93('0x121')));});};var sensitiveFields=[_0xed93('0x122'),_0xed93('0x123'),'newPassword','apiKey','firstName',_0xed93('0x124'),_0xed93('0x125'),'phone','mobile',_0xed93('0x126'),_0xed93('0x127'),_0xed93('0x128'),_0xed93('0x129'),_0xed93('0x12a'),_0xed93('0x12b'),_0xed93('0x12c'),'tenantId','token',_0xed93('0x12d'),'accessToken',_0xed93('0x12e'),_0xed93('0x12f'),_0xed93('0x130'),'consumerSecret',_0xed93('0x131'),_0xed93('0x132'),_0xed93('0x133'),_0xed93('0x134'),_0xed93('0x135'),_0xed93('0x136'),_0xed93('0x137'),_0xed93('0x138'),'secretaccesskey',_0xed93('0x139'),_0xed93('0x1a'),_0xed93('0x13a'),_0xed93('0x13b'),'localstationid',_0xed93('0x13c'),'secret',_0xed93('0x13d'),_0xed93('0x13e')];function maskSensitiveData(_0x4ca938){var _0x7d3c2f=/(?!^)[\s\S](?!$)/g;if(!_[_0xed93('0x13f')](_0x4ca938))return;for(var _0x3939c0 in _0x4ca938){if(_['isArray'](_0x4ca938[_0x3939c0])){for(var _0x54d005=0x0;_0x54d005<_0x4ca938[_0x3939c0]['length'];_0x54d005++){maskSensitiveData(_0x4ca938[_0x3939c0][_0x54d005]);}}else if(_[_0xed93('0x13f')](_0x4ca938[_0x3939c0])){maskSensitiveData(_0x4ca938[_0x3939c0]);}else if(_['isString'](_0x4ca938[_0x3939c0])){_0x4ca938[_0x3939c0]=_0x4ca938[_0x3939c0][_0xed93('0x140')](/{{{/g,_0xed93('0x141'))[_0xed93('0x140')](/}}}/g,'}@@')['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0xed93('0x142')](sensitiveFields,_0x3939c0)){_0x4ca938[_0x3939c0]=_0x4ca938[_0x3939c0][_0xed93('0x140')](_0x7d3c2f,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 46b63d4..f361dd9 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a9b=['../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/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','port','rpc','localhost','error','log','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc'];(function(_0x529784,_0x855091){var _0x176e17=function(_0x515139){while(--_0x515139){_0x529784['push'](_0x529784['shift']());}};_0x176e17(++_0x855091);}(_0x4a9b,0x1f0));var _0xb4a9=function(_0x32144d,_0x3bf972){_0x32144d=_0x32144d-0x0;var _0x47a0bf=_0x4a9b[_0x32144d];return _0x47a0bf;};'use strict';var jayson=require(_0xb4a9('0x0'));var BPromise=require('bluebird');var _=require(_0xb4a9('0x1'));var config=require(_0xb4a9('0x2'));exports[_0xb4a9('0x3')]=function(){return new BPromise(function(_0x44b98e,_0xddeb0b){var _0x4ee3fe={};_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x5')));_0x4ee3fe=_['merge'](_0x4ee3fe,require(_0xb4a9('0x6')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x7')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require('../api/voiceRecording/voiceRecording.rpc'));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x8')));_0x4ee3fe=_['merge'](_0x4ee3fe,require(_0xb4a9('0x9')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0xa')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x4ee3fe=_['merge'](_0x4ee3fe,require(_0xb4a9('0xb')));_0x4ee3fe=_['merge'](_0x4ee3fe,require(_0xb4a9('0xc')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0xd')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0xe')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0xf')));_0x4ee3fe=_['merge'](_0x4ee3fe,require(_0xb4a9('0x10')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x11')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x12')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x13')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x14')));_0x4ee3fe=_['merge'](_0x4ee3fe,require(_0xb4a9('0x15')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x16')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x17')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x18')));_0x4ee3fe=_['merge'](_0x4ee3fe,require(_0xb4a9('0x19')));_0x4ee3fe=_['merge'](_0x4ee3fe,require(_0xb4a9('0x1a')));_0x4ee3fe=_['merge'](_0x4ee3fe,require(_0xb4a9('0x1b')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x1c')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require('../api/smsInteraction/smsInteraction.rpc'));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x1d')));_0x4ee3fe=_['merge'](_0x4ee3fe,require('../api/smsQueue/smsQueue.rpc'));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x1e')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x1f')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x20')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x21')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x22')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x23')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x24')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x25')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x26')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x27')));_0x4ee3fe=_['merge'](_0x4ee3fe,require(_0xb4a9('0x28')));_0x4ee3fe=_['merge'](_0x4ee3fe,require(_0xb4a9('0x29')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x2a')));_0x4ee3fe=_['merge'](_0x4ee3fe,require(_0xb4a9('0x2b')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require('../api/pause/pause.rpc'));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x2c')));_0x4ee3fe=_['merge'](_0x4ee3fe,require(_0xb4a9('0x2d')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x2e')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x2f')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x30')));_0x4ee3fe=_['merge'](_0x4ee3fe,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x31')));_0x4ee3fe=_['merge'](_0x4ee3fe,require(_0xb4a9('0x32')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x33')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x34')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x35')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x36')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x37')));_0x4ee3fe=_['merge'](_0x4ee3fe,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x38')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x39')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x3a')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x3b')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x3c')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require('../api/squareOdbc/squareOdbc.rpc'));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x3d')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x3e')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require('../api/squareMessage/squareMessage.rpc'));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x3f')));_0x4ee3fe=_['merge'](_0x4ee3fe,require(_0xb4a9('0x40')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x41')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x42')));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require(_0xb4a9('0x43')));_0x4ee3fe=_['merge'](_0x4ee3fe,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x4ee3fe=_[_0xb4a9('0x4')](_0x4ee3fe,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x4ee3fe=_['merge'](_0x4ee3fe,require(_0xb4a9('0x44')));var _0x24bed6=jayson[_0xb4a9('0x45')](_0x4ee3fe)['http']();var _0x41b5db=config['rpc']['port']||config[_0xb4a9('0x46')]+0x1;var _0x5e7243=config[_0xb4a9('0x47')]['ip']||_0xb4a9('0x48');_0x24bed6['on'](_0xb4a9('0x49'),function(_0x1683c1){return _0xddeb0b(_0x1683c1);});_0x24bed6[_0xb4a9('0x3')](_0x41b5db,_0x5e7243,function(){console[_0xb4a9('0x4a')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x5e7243,_0x41b5db);require(_0xb4a9('0x4b'))[_0xb4a9('0x4c')]();return _0x44b98e(_0xb4a9('0x4d')+_0x5e7243+':'+_0x41b5db);});});}; \ No newline at end of file +var _0x15db=['../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','listen','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.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/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc'];(function(_0x1221dc,_0x10ff49){var _0x416e7c=function(_0x1202ef){while(--_0x1202ef){_0x1221dc['push'](_0x1221dc['shift']());}};_0x416e7c(++_0x10ff49);}(_0x15db,0x176));var _0xb15d=function(_0xe915de,_0x1cbdcd){_0xe915de=_0xe915de-0x0;var _0x3b61aa=_0x15db[_0xe915de];return _0x3b61aa;};'use strict';var jayson=require(_0xb15d('0x0'));var BPromise=require(_0xb15d('0x1'));var _=require(_0xb15d('0x2'));var config=require('../config/environment');exports['listen']=function(){return new BPromise(function(_0x1f0eb7,_0x216ea5){var _0x2a04c8={};_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x4')));_0x2a04c8=_['merge'](_0x2a04c8,require(_0xb15d('0x5')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x6')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x7')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x8')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x9')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0xa')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0xb')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0xc')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x2a04c8=_['merge'](_0x2a04c8,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require('../api/mailServerIn/mailServerIn.rpc'));_0x2a04c8=_['merge'](_0x2a04c8,require(_0xb15d('0xd')));_0x2a04c8=_['merge'](_0x2a04c8,require(_0xb15d('0xe')));_0x2a04c8=_['merge'](_0x2a04c8,require(_0xb15d('0xf')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require('../api/mailMessage/mailMessage.rpc'));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x10')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x11')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x12')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x13')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x14')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x15')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x16')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x17')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require('../api/smsAccount/smsAccount.rpc'));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x18')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require('../api/smsMessage/smsMessage.rpc'));_0x2a04c8=_['merge'](_0x2a04c8,require(_0xb15d('0x19')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x1a')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x1b')));_0x2a04c8=_['merge'](_0x2a04c8,require(_0xb15d('0x1c')));_0x2a04c8=_['merge'](_0x2a04c8,require(_0xb15d('0x1d')));_0x2a04c8=_['merge'](_0x2a04c8,require(_0xb15d('0x1e')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x1f')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x20')));_0x2a04c8=_['merge'](_0x2a04c8,require(_0xb15d('0x21')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require('../api/cmContact/cmContact.rpc'));_0x2a04c8=_['merge'](_0x2a04c8,require(_0xb15d('0x22')));_0x2a04c8=_['merge'](_0x2a04c8,require(_0xb15d('0x23')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x24')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x25')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x26')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x27')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require('../api/pause/pause.rpc'));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x28')));_0x2a04c8=_['merge'](_0x2a04c8,require(_0xb15d('0x29')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x2a')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x2b')));_0x2a04c8=_['merge'](_0x2a04c8,require(_0xb15d('0x2c')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x2a04c8=_['merge'](_0x2a04c8,require(_0xb15d('0x2d')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x2e')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x2f')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x30')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x31')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x32')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require('../api/setting/setting.rpc'));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x33')));_0x2a04c8=_['merge'](_0x2a04c8,require(_0xb15d('0x34')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x35')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x36')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require('../api/campaign/campaign.rpc'));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require('../api/attachment/attachment.rpc'));_0x2a04c8=_['merge'](_0x2a04c8,require('../api/plugin/plugin.rpc'));_0x2a04c8=_['merge'](_0x2a04c8,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x37')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x38')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x39')));_0x2a04c8=_[_0xb15d('0x3')](_0x2a04c8,require(_0xb15d('0x3a')));var _0x43c04e=jayson[_0xb15d('0x3b')](_0x2a04c8)['http']();var _0x4f8101=config[_0xb15d('0x3c')][_0xb15d('0x3d')]||config['port']+0x1;var _0x1c3865=config[_0xb15d('0x3c')]['ip']||_0xb15d('0x3e');_0x43c04e['on'](_0xb15d('0x3f'),function(_0x154653){return _0x216ea5(_0x154653);});_0x43c04e[_0xb15d('0x40')](_0x4f8101,_0x1c3865,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x1c3865,_0x4f8101);require(_0xb15d('0x41'))[_0xb15d('0x42')]();return _0x1f0eb7(_0xb15d('0x43')+_0x1c3865+':'+_0x4f8101);});});}; \ No newline at end of file diff --git a/server/safe-template.js b/server/safe-template.js index b26145d..4c60071 100644 --- a/server/safe-template.js +++ b/server/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea28=['isPlainObject','reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','map'];(function(_0x5f41bc,_0x5be1be){var _0x17a3cf=function(_0x2e35b3){while(--_0x2e35b3){_0x5f41bc['push'](_0x5f41bc['shift']());}};_0x17a3cf(++_0x5be1be);}(_0xea28,0x13a));var _0x8ea2=function(_0x3f364d,_0x595596){_0x3f364d=_0x3f364d-0x0;var _0x922790=_0xea28[_0x3f364d];return _0x922790;};var _=require(_0x8ea2('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2e031a){return _0x2e031a==='{{'?_0x8ea2('0x1'):_0x8ea2('0x2');}function safeTemplate(_0x459c4e){var _0x25e47e=_0x459c4e;if(typeof _0x459c4e===_0x8ea2('0x3')){_0x25e47e=_0x459c4e[_0x8ea2('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x459c4e)){_0x25e47e=_0x459c4e[_0x8ea2('0x5')](function(_0x23aaf1){return safeTemplate(_0x23aaf1);});}else if(_[_0x8ea2('0x6')](_0x459c4e)){_0x25e47e=Object['keys'](_0x459c4e)[_0x8ea2('0x7')](function(_0x435d78,_0xb7f278){_0x435d78[_0xb7f278]=safeTemplate(_0x459c4e[_0xb7f278]);return _0x435d78;},{});}return _0x25e47e;}module[_0x8ea2('0x8')][_0x8ea2('0x9')]=safeTemplate; \ No newline at end of file +var _0xbaf0=['exports','{\x20{\x20','\x20}\x20}','string','isArray','map','isPlainObject','keys','reduce'];(function(_0x254df2,_0x3fd27a){var _0x4c21c4=function(_0x329f78){while(--_0x329f78){_0x254df2['push'](_0x254df2['shift']());}};_0x4c21c4(++_0x3fd27a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x286ac2){return _0x286ac2==='{{'?_0x0baf('0x0'):_0x0baf('0x1');}function safeTemplate(_0x263f79){var _0x1688bc=_0x263f79;if(typeof _0x263f79===_0x0baf('0x2')){_0x1688bc=_0x263f79['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x0baf('0x3')](_0x263f79)){_0x1688bc=_0x263f79[_0x0baf('0x4')](function(_0x2d3fa5){return safeTemplate(_0x2d3fa5);});}else if(_[_0x0baf('0x5')](_0x263f79)){_0x1688bc=Object[_0x0baf('0x6')](_0x263f79)[_0x0baf('0x7')](function(_0x1a10b1,_0x2dcaac){_0x1a10b1[_0x2dcaac]=safeTemplate(_0x263f79[_0x2dcaac]);return _0x1a10b1;},{});}return _0x1688bc;}module[_0x0baf('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 40e6dc3..efa9430 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 _0x1e2f=['SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext','noop','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','result=','substr','indexOf','startsWith','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','pipe','function','inherits','sendRequest','sync','prototype','answer','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean'];(function(_0x308b6a,_0x1f4a59){var _0x681e7a=function(_0x43afb6){while(--_0x43afb6){_0x308b6a['push'](_0x308b6a['shift']());}};_0x681e7a(++_0x1f4a59);}(_0x1e2f,0x1ee));var _0xf1e2=function(_0x2999c7,_0x58747b){_0x2999c7=_0x2999c7-0x0;var _0x2e7652=_0x1e2f[_0x2999c7];return _0x2e7652;};'use strict';var util=require(_0xf1e2('0x0'));var _=require(_0xf1e2('0x1'));var EventEmitter=require(_0xf1e2('0x2'))[_0xf1e2('0x3')];var AGIReply=require(_0xf1e2('0x4'));var AGIError=require(_0xf1e2('0x5'));function AGIChannel(_0x573284){var _0x5d3d2a=this,_0x3e708c=new AGIReply(),_0x220919=![],_0x184a61={};EventEmitter[_0xf1e2('0x6')](_0x5d3d2a);_0x573284['setEncoding'](_0xf1e2('0x7'));_0x573284[_0xf1e2('0x8')](0x8*0x3c*0x3c*0x3e8);_0x3e708c[_0xf1e2('0x9')](_0xf1e2('0x7'));_0x3e708c['on']('headers',function(_0x4839bd){for(var _0x661862 in _0x4839bd){_0x5d3d2a[_0x661862]=_0x4839bd[_0x661862];}_0x5d3d2a[_0xf1e2('0xa')](_0xf1e2('0xb'));});_0x3e708c['on'](_0xf1e2('0xc'),function(_0x3da05b){if(_0x3da05b[_0xf1e2('0xd')]()==_0xf1e2('0xe')){_0x5d3d2a['emit']('hangup');return;}if(_0x3da05b[_0xf1e2('0xf')](0x0,0xb)==_0xf1e2('0x10')){_0x220919=!![];}if(_0x220919){_0x184a61['rx']+=_0x3da05b+'\x0a';if(_0x3da05b[_0xf1e2('0x11')](_0xf1e2('0x12'))!=-0x1){_0x220919=![];}}else{_0x184a61['rx']=_0x3da05b;}if(_0x220919){return;}if(typeof _0x184a61['cb']=='function'){var _0x531871=_0x184a61['rx'][_0xf1e2('0xf')](0x0,0x3),_0x8da730=null,_0x3d224b=null;_0x531871=parseInt(_0x531871);if(isNaN(_0x531871)){_0x184a61['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x531871!=0xc8){_0x184a61['cb'](null,{'code':_0x531871,'result':-0x1,'extra':'KO'});return;}_0x8da730=_0x184a61['rx'][_0xf1e2('0xf')](0x4)['replace'](_0xf1e2('0x13'),'');if(_0x8da730['indexOf']('\x20')!=-0x1){_0x8da730=_0x8da730[_0xf1e2('0x14')](0x0,_0x8da730[_0xf1e2('0x15')]('\x20'));}if(_[_0xf1e2('0x16')](_0x8da730,'-1')){_0x8da730=parseInt(_0x8da730);}_0x3d224b=_0x184a61['rx']['split']('\x20');if(_0x3d224b['length']==0x3){_0x3d224b=_0x3d224b[0x2]['substring'](0x1,_0x3d224b[0x2][_0xf1e2('0x17')]-0x1);}else if(_0x3d224b[_0xf1e2('0x17')]>0x3){var _0xe532a8=/\((.+)\)/;var _0x4a959f=_0x184a61['rx'][_0xf1e2('0x18')](_0xe532a8);if(_0x4a959f){_0x3d224b=_0x4a959f[0x1];}else{_0x3d224b=null;}}else{_0x3d224b=null;}_0x184a61['cb'](null,{'code':_0x531871,'result':_0x8da730,'extra':_0x3d224b});}});_0x573284['on'](_0xf1e2('0x19'),function(_0xe2c46d){_0x5d3d2a[_0xf1e2('0xa')]('error',new AGIError(_0xf1e2('0x1a'),_0xe2c46d['code']));});_0x573284['on'](_0xf1e2('0x1b'),function(){_0x5d3d2a[_0xf1e2('0xa')](_0xf1e2('0x1b'),new AGIError(_0xf1e2('0x1c')));});_0x573284['on']('timeout',function(){_0x5d3d2a['emit'](_0xf1e2('0x1d'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x573284['destroy']();});_0x573284[_0xf1e2('0x1e')](_0x3e708c);this['command']=function(_0x520418,_0x529a35){var _0x520418=_0x520418||'',_0x529a35=typeof _0x529a35==_0xf1e2('0x1f')?_0x529a35:new Function();_0x184a61={'tx':_0x520418,'rx':'','cb':_0x529a35};_0x573284['write'](_0x520418+'\x0a');},this[_0xf1e2('0x1b')]=function(){_0x573284['destroy']();};}util[_0xf1e2('0x20')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xf1e2('0x21')]=function(_0x2a7ada){return this['command'][_0xf1e2('0x22')](this,_0x2a7ada);};AGIChannel[_0xf1e2('0x23')][_0xf1e2('0x24')]=function(){return this[_0xf1e2('0x21')](_0xf1e2('0x25'));};AGIChannel[_0xf1e2('0x23')]['getData']=function(_0x399d97,_0x244f66,_0x1360c0){_0x399d97=_0x399d97===undefined?_0xf1e2('0x26'):_0x399d97;_0x244f66=_0x244f66===undefined?'5':_0x244f66;_0x1360c0=_0x1360c0===undefined?'1':_0x1360c0;return this[_0xf1e2('0x21')](util[_0xf1e2('0x27')](_0xf1e2('0x28'),_0x399d97,_0x244f66*0x3e8,_0x1360c0));};AGIChannel['prototype']['noop']=function(_0x4e4861){_0x4e4861=_0x4e4861||'NO\x20MESSAGE';return this['sendRequest'](util['format'](_0xf1e2('0x29'),_0x4e4861));};AGIChannel[_0xf1e2('0x23')]['exec']=function(_0x409308,_0x363059){if(_[_0xf1e2('0x2a')](_0x363059)){return this[_0xf1e2('0x21')](util[_0xf1e2('0x27')](_0xf1e2('0x2b'),_0x409308,_0x363059['join'](',')));}return this['sendRequest'](util[_0xf1e2('0x27')]('EXEC\x20%s\x20%s',_0x409308,_0x363059));};AGIChannel[_0xf1e2('0x23')]['setContext']=function(_0x5d3197){return this[_0xf1e2('0x21')](util[_0xf1e2('0x27')](_0xf1e2('0x2c'),_0x5d3197));};AGIChannel['prototype'][_0xf1e2('0x2d')]=function(_0x12aaa1){return this[_0xf1e2('0x21')](util[_0xf1e2('0x27')]('SET\x20EXTENSION\x20%s',_0x12aaa1));};AGIChannel[_0xf1e2('0x23')]['setPriority']=function(_0x23a7ae){return this['sendRequest'](util['format'](_0xf1e2('0x2e'),_0x23a7ae));};AGIChannel['prototype'][_0xf1e2('0xe')]=function(){return this[_0xf1e2('0x21')](_0xf1e2('0x2f'));};AGIChannel[_0xf1e2('0x23')][_0xf1e2('0x30')]=function(_0x3e1e47,_0x468c8f){var _0x576af2=_[_0xf1e2('0x31')](_0x468c8f)||_['isNumber'](_0x468c8f)?_0x468c8f['toString']():_0x468c8f;return this[_0xf1e2('0x21')](util[_0xf1e2('0x27')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x3e1e47,_0x576af2?_0x576af2['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xf1e2('0x23')]['sayNumber']=function(_0x396036,_0x35239a){return this[_0xf1e2('0x21')](util['format'](_0xf1e2('0x32'),_0x396036,_0x35239a));};AGIChannel[_0xf1e2('0x23')][_0xf1e2('0x33')]=function(_0x4c36d8,_0x565ee3){return this['sendRequest'](util['format']('SAY\x20DIGITS\x20%s\x20%s',_0x4c36d8,_0x565ee3));};AGIChannel[_0xf1e2('0x23')][_0xf1e2('0x34')]=function(_0x36cd66,_0x12d333){return this['sendRequest'](util[_0xf1e2('0x27')](_0xf1e2('0x35'),_0x36cd66,_0x12d333));};AGIChannel['prototype'][_0xf1e2('0x36')]=function(_0x103262,_0x3b523d,_0x5b9513){_0x3b523d=_0x3b523d||this['extension'];_0x5b9513=_0x5b9513||0x1;this[_0xf1e2('0x37')](_0x103262);this[_0xf1e2('0x2d')](_0x3b523d);this['setPriority'](_0x5b9513);return this[_0xf1e2('0x38')](util[_0xf1e2('0x27')](_0xf1e2('0x39'),_0x103262,_0x3b523d,_0x5b9513));};AGIChannel[_0xf1e2('0x23')]['getVariable']=function(_0x363761){return this[_0xf1e2('0x21')](util[_0xf1e2('0x27')](_0xf1e2('0x3a'),_0x363761));};AGIChannel['prototype'][_0xf1e2('0x3b')]=function(_0x1c1c48,_0x1fb8b3,_0x1dc103,_0x1298cf,_0x4f662c,_0x5bc7de){_0x1fb8b3=_0x1fb8b3||'wav';_0x1dc103=_0x1dc103||'';_0x1298cf=_0x1298cf===undefined?-0x1:_0x1298cf==='-1'?-0x1:_0x1298cf*0x3e8;_0x4f662c=_0x4f662c===undefined?'':'s='+_0x4f662c;_0x5bc7de=_0x5bc7de?'BEEP':'';return this[_0xf1e2('0x21')](util[_0xf1e2('0x27')](_0xf1e2('0x3c'),_0x1c1c48,_0x1fb8b3,_0x1dc103,_0x1298cf,_0x5bc7de,_0x4f662c));};AGIChannel[_0xf1e2('0x23')][_0xf1e2('0x3d')]=function(_0x2b64e9,_0x1d9426){_0x1d9426=_0x1d9426||'';return this[_0xf1e2('0x21')](util[_0xf1e2('0x27')](_0xf1e2('0x3e'),_0x2b64e9,_0x1d9426));};AGIChannel[_0xf1e2('0x23')][_0xf1e2('0x3f')]=function(_0x53a83e){return this['exec']('AGI',_0x53a83e);};AGIChannel[_0xf1e2('0x23')][_0xf1e2('0x40')]=function(_0x4d7061){return this['exec'](_0xf1e2('0x41'),_0x4d7061);};AGIChannel[_0xf1e2('0x23')]['error']=function(_0x1c18b1,_0x1cbb3d){this[_0xf1e2('0x38')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x1c18b1['id'],_0x1c18b1[_0xf1e2('0x42')],_0x1cbb3d));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xf1e2('0x43')]=AGIChannel; \ No newline at end of file +var _0x114b=['replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','result=','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','sendRequest','sync','prototype','answer','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22'];(function(_0x5be1db,_0x588f82){var _0x39d33a=function(_0x222102){while(--_0x222102){_0x5be1db['push'](_0x5be1db['shift']());}};_0x39d33a(++_0x588f82);}(_0x114b,0x1e9));var _0xb114=function(_0x14cadd,_0x4899cc){_0x14cadd=_0x14cadd-0x0;var _0x338642=_0x114b[_0x14cadd];return _0x338642;};'use strict';var util=require('util');var _=require(_0xb114('0x0'));var EventEmitter=require(_0xb114('0x1'))[_0xb114('0x2')];var AGIReply=require(_0xb114('0x3'));var AGIError=require(_0xb114('0x4'));function AGIChannel(_0x2440ee){var _0x23bdbf=this,_0x52e072=new AGIReply(),_0x2807fd=![],_0x237b56={};EventEmitter[_0xb114('0x5')](_0x23bdbf);_0x2440ee[_0xb114('0x6')]('utf8');_0x2440ee['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x52e072[_0xb114('0x6')](_0xb114('0x7'));_0x52e072['on'](_0xb114('0x8'),function(_0x3bd7b6){for(var _0x28d15f in _0x3bd7b6){_0x23bdbf[_0x28d15f]=_0x3bd7b6[_0x28d15f];}_0x23bdbf[_0xb114('0x9')](_0xb114('0xa'));});_0x52e072['on'](_0xb114('0xb'),function(_0x2815e7){if(_0x2815e7[_0xb114('0xc')]()=='hangup'){_0x23bdbf[_0xb114('0x9')](_0xb114('0xd'));return;}if(_0x2815e7[_0xb114('0xe')](0x0,0xb)=='520-Invalid'){_0x2807fd=!![];}if(_0x2807fd){_0x237b56['rx']+=_0x2815e7+'\x0a';if(_0x2815e7[_0xb114('0xf')](_0xb114('0x10'))!=-0x1){_0x2807fd=![];}}else{_0x237b56['rx']=_0x2815e7;}if(_0x2807fd){return;}if(typeof _0x237b56['cb']==_0xb114('0x11')){var _0x23d40e=_0x237b56['rx'][_0xb114('0xe')](0x0,0x3),_0x4a8410=null,_0x5a32c1=null;_0x23d40e=parseInt(_0x23d40e);if(isNaN(_0x23d40e)){_0x237b56['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xb114('0x12')});return;}if(_0x23d40e!=0xc8){_0x237b56['cb'](null,{'code':_0x23d40e,'result':-0x1,'extra':'KO'});return;}_0x4a8410=_0x237b56['rx'][_0xb114('0xe')](0x4)['replace'](_0xb114('0x13'),'');if(_0x4a8410['indexOf']('\x20')!=-0x1){_0x4a8410=_0x4a8410['substr'](0x0,_0x4a8410[_0xb114('0x14')]('\x20'));}if(_[_0xb114('0x15')](_0x4a8410,'-1')){_0x4a8410=parseInt(_0x4a8410);}_0x5a32c1=_0x237b56['rx'][_0xb114('0x16')]('\x20');if(_0x5a32c1[_0xb114('0x17')]==0x3){_0x5a32c1=_0x5a32c1[0x2][_0xb114('0xe')](0x1,_0x5a32c1[0x2][_0xb114('0x17')]-0x1);}else if(_0x5a32c1[_0xb114('0x17')]>0x3){var _0x293b1d=/\((.+)\)/;var _0x79ae88=_0x237b56['rx'][_0xb114('0x18')](_0x293b1d);if(_0x79ae88){_0x5a32c1=_0x79ae88[0x1];}else{_0x5a32c1=null;}}else{_0x5a32c1=null;}_0x237b56['cb'](null,{'code':_0x23d40e,'result':_0x4a8410,'extra':_0x5a32c1});}});_0x2440ee['on'](_0xb114('0x19'),function(_0x152f7d){_0x23bdbf[_0xb114('0x9')]('error',new AGIError(_0xb114('0x1a'),_0x152f7d[_0xb114('0x1b')]));});_0x2440ee['on'](_0xb114('0x1c'),function(){_0x23bdbf[_0xb114('0x9')](_0xb114('0x1c'),new AGIError(_0xb114('0x1d')));});_0x2440ee['on'](_0xb114('0x1e'),function(){_0x23bdbf[_0xb114('0x9')](_0xb114('0x1e'),new AGIError(_0xb114('0x1f')));_0x2440ee[_0xb114('0x20')]();});_0x2440ee[_0xb114('0x21')](_0x52e072);this[_0xb114('0x22')]=function(_0x2f5741,_0x41ae5a){var _0x2f5741=_0x2f5741||'',_0x41ae5a=typeof _0x41ae5a==_0xb114('0x11')?_0x41ae5a:new Function();_0x237b56={'tx':_0x2f5741,'rx':'','cb':_0x41ae5a};_0x2440ee[_0xb114('0x23')](_0x2f5741+'\x0a');},this[_0xb114('0x1c')]=function(){_0x2440ee[_0xb114('0x20')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xb114('0x24')]=function(_0x270682){return this[_0xb114('0x22')][_0xb114('0x25')](this,_0x270682);};AGIChannel[_0xb114('0x26')][_0xb114('0x27')]=function(){return this[_0xb114('0x24')]('ANSWER');};AGIChannel[_0xb114('0x26')][_0xb114('0x28')]=function(_0x212de9,_0x1c7365,_0x2a74e7){_0x212de9=_0x212de9===undefined?_0xb114('0x29'):_0x212de9;_0x1c7365=_0x1c7365===undefined?'5':_0x1c7365;_0x2a74e7=_0x2a74e7===undefined?'1':_0x2a74e7;return this['sendRequest'](util[_0xb114('0x2a')](_0xb114('0x2b'),_0x212de9,_0x1c7365*0x3e8,_0x2a74e7));};AGIChannel['prototype']['noop']=function(_0x2a9da5){_0x2a9da5=_0x2a9da5||_0xb114('0x2c');return this[_0xb114('0x24')](util[_0xb114('0x2a')](_0xb114('0x2d'),_0x2a9da5));};AGIChannel[_0xb114('0x26')][_0xb114('0x2e')]=function(_0x3f5f95,_0x234926){if(_[_0xb114('0x2f')](_0x234926)){return this[_0xb114('0x24')](util['format'](_0xb114('0x30'),_0x3f5f95,_0x234926['join'](',')));}return this['sendRequest'](util[_0xb114('0x2a')]('EXEC\x20%s\x20%s',_0x3f5f95,_0x234926));};AGIChannel[_0xb114('0x26')][_0xb114('0x31')]=function(_0x114f89){return this[_0xb114('0x24')](util[_0xb114('0x2a')]('SET\x20CONTEXT\x20%s',_0x114f89));};AGIChannel['prototype'][_0xb114('0x32')]=function(_0xc91e4e){return this[_0xb114('0x24')](util[_0xb114('0x2a')](_0xb114('0x33'),_0xc91e4e));};AGIChannel['prototype'][_0xb114('0x34')]=function(_0x1bed31){return this['sendRequest'](util[_0xb114('0x2a')]('SET\x20PRIORITY\x20%s',_0x1bed31));};AGIChannel[_0xb114('0x26')]['hangup']=function(){return this[_0xb114('0x24')](_0xb114('0x35'));};AGIChannel[_0xb114('0x26')]['setVariable']=function(_0x29e9f3,_0x4d22df){var _0x4fd7b5=_[_0xb114('0x36')](_0x4d22df)||_['isNumber'](_0x4d22df)?_0x4d22df[_0xb114('0x37')]():_0x4d22df;return this[_0xb114('0x24')](util[_0xb114('0x2a')](_0xb114('0x38'),_0x29e9f3,_0x4fd7b5?_0x4fd7b5[_0xb114('0x37')]()[_0xb114('0x39')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xb114('0x26')][_0xb114('0x3a')]=function(_0x1184d6,_0xb57b45){return this[_0xb114('0x24')](util['format'](_0xb114('0x3b'),_0x1184d6,_0xb57b45));};AGIChannel[_0xb114('0x26')][_0xb114('0x3c')]=function(_0xd48dcf,_0x3c388e){return this[_0xb114('0x24')](util['format'](_0xb114('0x3d'),_0xd48dcf,_0x3c388e));};AGIChannel[_0xb114('0x26')][_0xb114('0x3e')]=function(_0x376669,_0x553378){return this['sendRequest'](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x376669,_0x553378));};AGIChannel[_0xb114('0x26')][_0xb114('0x3f')]=function(_0x143a15,_0x5d8824,_0x2dd14a){_0x5d8824=_0x5d8824||this['extension'];_0x2dd14a=_0x2dd14a||0x1;this[_0xb114('0x31')](_0x143a15);this[_0xb114('0x32')](_0x5d8824);this[_0xb114('0x34')](_0x2dd14a);return this[_0xb114('0x40')](util[_0xb114('0x2a')](_0xb114('0x41'),_0x143a15,_0x5d8824,_0x2dd14a));};AGIChannel['prototype'][_0xb114('0x42')]=function(_0x2ecfe8){return this[_0xb114('0x24')](util[_0xb114('0x2a')](_0xb114('0x43'),_0x2ecfe8));};AGIChannel[_0xb114('0x26')][_0xb114('0x44')]=function(_0x4146b7,_0x309beb,_0x2bc2ff,_0x119127,_0x1f2572,_0x2f26e){_0x309beb=_0x309beb||'wav';_0x2bc2ff=_0x2bc2ff||'';_0x119127=_0x119127===undefined?-0x1:_0x119127==='-1'?-0x1:_0x119127*0x3e8;_0x1f2572=_0x1f2572===undefined?'':'s='+_0x1f2572;_0x2f26e=_0x2f26e?_0xb114('0x45'):'';return this['sendRequest'](util[_0xb114('0x2a')](_0xb114('0x46'),_0x4146b7,_0x309beb,_0x2bc2ff,_0x119127,_0x2f26e,_0x1f2572));};AGIChannel[_0xb114('0x26')][_0xb114('0x47')]=function(_0x3f8886,_0x23293c){_0x23293c=_0x23293c||'';return this[_0xb114('0x24')](util['format'](_0xb114('0x48'),_0x3f8886,_0x23293c));};AGIChannel[_0xb114('0x26')][_0xb114('0x49')]=function(_0x184809){return this[_0xb114('0x2e')]('AGI',_0x184809);};AGIChannel[_0xb114('0x26')]['wait']=function(_0x546ce6){return this[_0xb114('0x2e')](_0xb114('0x4a'),_0x546ce6);};AGIChannel[_0xb114('0x26')][_0xb114('0x19')]=function(_0x45b5bd,_0x2eee14){this[_0xb114('0x40')](util[_0xb114('0x2a')](_0xb114('0x4b'),_0x45b5bd['id'],_0x45b5bd[_0xb114('0x4c')],_0x2eee14));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xb114('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 7549088..9c56b4f 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 _0x67d2=['Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\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.','E_AGI_UNDEFINED','push','format','apply','message','exports','util'];(function(_0x50667a,_0x86eb28){var _0x4987e5=function(_0x4482b1){while(--_0x4482b1){_0x50667a['push'](_0x50667a['shift']());}};_0x4987e5(++_0x86eb28);}(_0x67d2,0x120));var _0x267d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x67d2[_0x432682];return _0x463d05;};'use strict';var util=require(_0x267d('0x0'));var error={'E_AGI_UNDEFINED':_0x267d('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x267d('0x2'),'E_AGI_SERVER_CLOSE':_0x267d('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x267d('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x267d('0x5'),'E_AGI_SOCKET_CLOSE':_0x267d('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x267d('0x7'),'E_AGI_COMMAND_EMPTY':_0x267d('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x267d('0x9'),'E_AGI_IVR_ENTRY':_0x267d('0xa')};function AGIError(_0x1c1044){var _0x1c1044=_0x1c1044||null,_0x74ebcf=_0x74ebcf||[],_0xc5df79=0x1,_0x5e6d98='';if(!error[_0x1c1044]){_0x1c1044=_0x267d('0xb');}_0x74ebcf[_0x267d('0xc')](error[_0x1c1044]);while(arguments[_0xc5df79]){_0x74ebcf[_0x267d('0xc')](arguments[_0xc5df79]);_0xc5df79++;}_0x5e6d98=util[_0x267d('0xd')][_0x267d('0xe')](util,_0x74ebcf);this[_0x267d('0xf')]=_0x5e6d98;this['name']=_0x1c1044;}module[_0x267d('0x10')]=AGIError; \ No newline at end of file +var _0x440a=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','format','apply','message','name','util'];(function(_0xbc3b7b,_0x647add){var _0x1638ed=function(_0x2a3d6c){while(--_0x2a3d6c){_0xbc3b7b['push'](_0xbc3b7b['shift']());}};_0x1638ed(++_0x647add);}(_0x440a,0x158));var _0xa440=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x440a[_0x17d9e3];return _0x14192d;};'use strict';var util=require(_0xa440('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xa440('0x1'),'E_AGI_SERVER_ERROR':_0xa440('0x2'),'E_AGI_SERVER_CLOSE':_0xa440('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xa440('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xa440('0x5'),'E_AGI_SOCKET_TIMEOUT':_0xa440('0x6'),'E_AGI_COMMAND_EMPTY':_0xa440('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xa440('0x8'),'E_AGI_IVR_ENTRY':_0xa440('0x9')};function AGIError(_0x435734){var _0x435734=_0x435734||null,_0x49e8a1=_0x49e8a1||[],_0x598dd1=0x1,_0xa464a='';if(!error[_0x435734]){_0x435734=_0xa440('0xa');}_0x49e8a1['push'](error[_0x435734]);while(arguments[_0x598dd1]){_0x49e8a1['push'](arguments[_0x598dd1]);_0x598dd1++;}_0xa464a=util[_0xa440('0xb')][_0xa440('0xc')](util,_0x49e8a1);this[_0xa440('0xd')]=_0xa464a;this[_0xa440('0xe')]=_0x435734;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index d23e711..f776e20 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 _0x5540=['invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','push','size','relations','getVertex','info','length','condition','split','agicommand','vswitch','default','target'];(function(_0x1b6364,_0x29f941){var _0x2ca014=function(_0x3b6ca1){while(--_0x3b6ca1){_0x1b6364['push'](_0x1b6364['shift']());}};_0x2ca014(++_0x29f941);}(_0x5540,0x101));var _0x0554=function(_0x1e9364,_0x16a2f1){_0x1e9364=_0x1e9364-0x0;var _0x17745a=_0x5540[_0x1e9364];return _0x17745a;};'use strict';var _=require(_0x0554('0x0'));var logger=require(_0x0554('0x1'))(_0x0554('0x2'));var verticesWithRetry=[_0x0554('0x3'),_0x0554('0x4'),_0x0554('0x5')];var Graph=function(){this[_0x0554('0x6')]={};this[_0x0554('0x7')]={};this[_0x0554('0x8')]=0x0;};Graph[_0x0554('0x9')][_0x0554('0xa')]=function(_0x403825){this[_0x0554('0x6')][_0x403825['id']]=_0x403825;this[_0x0554('0x7')][_0x403825['id']]=[];};Graph[_0x0554('0x9')]['addEdge']=function(_0x48487b,_0x21e697,_0x12d2be){this[_0x0554('0x7')][_0x48487b][_0x0554('0xb')]({'target':_0x21e697,'condition':_0x12d2be});this['numberOfEdges']+=0x1;};Graph[_0x0554('0x9')][_0x0554('0xc')]=function(){return _[_0x0554('0xc')](this[_0x0554('0x6')]);};Graph[_0x0554('0x9')][_0x0554('0xd')]=function(){return this[_0x0554('0x8')];};Graph['prototype'][_0x0554('0xe')]=function(_0x136100){return this[_0x0554('0x6')][_0x136100];};Graph[_0x0554('0x9')]['traverseBFS']=function(_0x22657d,_0x36e79f){if(!this[_0x0554('0x6')][_0x22657d]){return logger[_0x0554('0xf')]('no\x20vertex\x20found');}var _0xda5009=_0x36e79f(this['vertices'][_0x22657d]);if(!_0xda5009){return logger['info']('stop\x20traverse');}if(this[_0x0554('0x7')][_0x22657d][_0x0554('0x10')]===0x0){return logger[_0x0554('0xf')]('no\x20edge/s\x20available');}for(var _0x2d2f67=0x0,_0x3d42bb=[],_0xfac131=![];_0x2d2f67\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','arg_1','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','mxGraphModel','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','source','addEdge','target','value','getSquareProject','then','agi_','substring','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','start','clear','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','toString','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','callysquare'];(function(_0x5951e8,_0x42b9a7){var _0x20a1f5=function(_0x2bc968){while(--_0x2bc968){_0x5951e8['push'](_0x5951e8['shift']());}};_0x20a1f5(++_0x42b9a7);}(_0x6690,0x10b));var _0x0669=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x6690[_0x37c22c];return _0x119d79;};'use strict';var parser=require(_0x0669('0x0'));var _=require('lodash');var syncho=require(_0x0669('0x1'));var util=require(_0x0669('0x2'));var moment=require('moment');var config=require('../../config/environment');var logger=require('../../config/logger')(_0x0669('0x3'));var utilLicense=require(_0x0669('0x4'));var rpc=require(_0x0669('0x5'));var mailRpc=require(_0x0669('0x6'));var Graph=require(_0x0669('0x7'));var Vertices=require(_0x0669('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x0669('0x3')]=_[_0x0669('0x9')](config['agi'],{'ip':_0x0669('0xa'),'port':0x11dd});function connectionHandler(_0x31e99e){process[_0x0669('0xb')](function(){syncho(function(){try{setChannelVariables(_0x31e99e);agiHandler(_0x31e99e);}catch(_0x18acb1){logger[_0x0669('0xc')](_0x18acb1[_0x0669('0xd')]);}});});}function listeningHandler(){console['log'](_0x0669('0xe'),config[_0x0669('0x3')][_0x0669('0xf')]);logger[_0x0669('0x10')](util['format'](_0x0669('0x11'),config[_0x0669('0x3')]['ip'],config[_0x0669('0x3')]['port']));}function errorHandler(_0x1097e0){if(_0x1097e0&&_0x1097e0['name']&&_0x1097e0['message']){logger[_0x0669('0xc')](util[_0x0669('0x12')](_0x0669('0x13'),_0x1097e0[_0x0669('0x14')],_0x1097e0[_0x0669('0x15')]));}else{logger[_0x0669('0xc')](util[_0x0669('0x12')]('[ERROR]\x20%s',_0x1097e0[_0x0669('0xd')]));}}function closeHandler(){logger[_0x0669('0x10')](util['format'](_0x0669('0x16'),this['arg_1'],this[_0x0669('0x17')],this[_0x0669('0x18')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x234fa2){logger[_0x0669('0xc')](_0x234fa2[_0x0669('0xd')]);}}function timeoutHandler(){logger['info'](util[_0x0669('0x12')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x0669('0x19')],this[_0x0669('0x17')],this[_0x0669('0x18')],this[_0x0669('0x1a')],this[_0x0669('0x1b')]));}function hangupHandler(){logger[_0x0669('0x10')](util[_0x0669('0x12')](_0x0669('0x1c'),this[_0x0669('0x19')],this[_0x0669('0x17')],this['callerid'],this[_0x0669('0x1a')],this[_0x0669('0x1b')]));this['evtHangup']=!![];}function getRoot(_0x878c4a){return parser[_0x0669('0x1d')](_0x878c4a,{'object':!![]})[_0x0669('0x1e')]['root'];}function addVertex(_0xec7d54,_0x2c1f64,_0x228e19){_0x2c1f64[_0x0669('0x1f')]=_0x228e19;if(_0x2c1f64[_0x0669('0x20')](_0x0669('0x21'))){_0x2c1f64[_0x0669('0x22')]=parseInt(_0x2c1f64[_0x0669('0x21')],0xa);}_0xec7d54[_0x0669('0x23')](_[_0x0669('0x24')](_0x2c1f64,'mxCell'));}function initGraph(_0x47fce5,_0x359888){var _0x25563a=new Graph();for(var _0x3f2a85 in _0x47fce5){if(_0x47fce5[_0x0669('0x20')](_0x3f2a85)){if(_[_0x0669('0x25')](_0x47fce5[_0x3f2a85])){for(var _0x5dba44=0x0;_0x5dba44<_0x47fce5[_0x3f2a85][_0x0669('0x26')];_0x5dba44+=0x1){addVertex(_0x25563a,_0x47fce5[_0x3f2a85][_0x5dba44],_0x3f2a85);}}else{addVertex(_0x25563a,_0x47fce5[_0x3f2a85],_0x3f2a85);}}}for(var _0x460be2=0x0;_0x460be2<_0x359888[_0x0669('0x26')];_0x460be2+=0x1){if(_0x359888[_0x460be2][_0x0669('0x27')]&&_0x359888[_0x460be2]['target']){_0x25563a[_0x0669('0x28')](_0x359888[_0x460be2][_0x0669('0x27')],_0x359888[_0x460be2][_0x0669('0x29')],_0x359888[_0x460be2][_0x0669('0x2a')]);}}return _0x25563a;}function getSquareProject(_0x131467,_0x361632){rpc[_0x0669('0x2b')](_0x131467)[_0x0669('0x2c')](function(_0x3012ef){_0x361632(null,_0x3012ef);})['catch'](function(_0x53bac1){_0x361632(null,_0x53bac1);});}function createSquareReport(_0x32fe48,_0x59bb92){rpc['createSquareReport'](_0x32fe48)[_0x0669('0x2c')](function(_0x19f8f5){if(_0x59bb92){_0x59bb92(null,_0x19f8f5);}})['catch'](function(_0xdba8dd){if(_0x59bb92){_0x59bb92(null,_0xdba8dd);}});}function setChannelVariables(_0x2e7394){for(var _0x53b095 in _0x2e7394){if(_0x2e7394[_0x0669('0x20')](_0x53b095)){if(_0x53b095['indexOf'](_0x0669('0x2d'))===0x0){_0x2e7394[_0x53b095[_0x0669('0x2e')](0x4)]=_0x2e7394[_0x53b095];delete _0x2e7394[_0x53b095];}}}}function getLogFromObject(_0xcb9170){return util[_0x0669('0x2f')](_0xcb9170,{'showHidden':![],'depth':null});}function agiHandler(_0x2f9229){var _0x10457f,_0x7ed1ca,_0x547eb6,_0x4e0d1b,_0x55b614;logger[_0x0669('0x30')]('variables',JSON[_0x0669('0x31')](_0x2f9229,null,0x2));logger[_0x0669('0x10')](util['format'](_0x0669('0x32'),_0x2f9229['arg_1'],_0x2f9229[_0x0669('0x17')],_0x2f9229[_0x0669('0x18')],_0x2f9229[_0x0669('0x1a')],_0x2f9229[_0x0669('0x1b')]));_0x2f9229['on'](_0x0669('0xc'),errorHandler);_0x2f9229['on'](_0x0669('0x33'),closeHandler);_0x2f9229['on'](_0x0669('0x34'),timeoutHandler);_0x2f9229['evtHangup']=![];_0x2f9229['on'](_0x0669('0x35'),hangupHandler);var _0xa91a6e=getSquareProject[_0x0669('0x36')](null,_0x2f9229[_0x0669('0x19')]);if(_0xa91a6e){if(_0xa91a6e[_0x0669('0x37')]){_0x10457f=getRoot(_0xa91a6e[_0x0669('0x37')]);if(_0x10457f&&_0x10457f['start']){logger[_0x0669('0x30')]('root',JSON[_0x0669('0x31')](_0x10457f,null,0x2));_0x2f9229[_0x0669('0x38')]=moment()[_0x0669('0x12')](_0x0669('0x39'));_0x7ed1ca=initGraph(_[_0x0669('0x24')](_0x10457f,_0x0669('0x3a')),_0x10457f['mxCell']);_0x547eb6=new Vertices(_0x2f9229,rpc,mailRpc);logger['info'](util['format'](_0x0669('0x3b'),_0x2f9229[_0x0669('0x19')],_0x2f9229['calleridname'],_0x2f9229['callerid'],_0x2f9229[_0x0669('0x1a')],_0x2f9229['uniqueid']));_0x7ed1ca[_0x0669('0x3c')](_0x10457f[_0x0669('0x3d')]['id'],function(_0x292db1){try{_0x292db1=_0x547eb6[_0x0669('0x3e')](_0x292db1);logger[_0x0669('0x30')](_0x0669('0x3f'),JSON[_0x0669('0x31')](_0x292db1,null,0x2));if(_0x292db1[_0x0669('0x1f')]==='gotoc'){logger[_0x0669('0x10')](_0x0669('0x40'));_0x2f9229[_0x0669('0x41')]=_0x292db1[_0x0669('0x41')]||_0x2f9229['context'];_0x2f9229[_0x0669('0x42')]=_0x292db1['extension'];_0x2f9229[_0x0669('0x43')]=_0x292db1[_0x0669('0x43')]?_0x292db1[_0x0669('0x43')]-0x1:0x1;return null;}else if(_0x292db1&&_0x547eb6[_0x292db1[_0x0669('0x1f')]]){_0x55b614=_0x547eb6[_0x292db1[_0x0669('0x1f')]](_0x292db1);logger[_0x0669('0x10')](_0x0669('0x44'),JSON['stringify'](_0x55b614,null,0x2));if(_0x55b614&&_0x55b614[_0x0669('0x45')]===AGI_CODE_SUCCESS&&_0x55b614[_0x0669('0x46')]!==AGI_RESULT_ERROR&&!_0x2f9229[_0x0669('0x47')]){logger[_0x0669('0x30')](_0x0669('0x44'),getLogFromObject(_0x55b614));return _['isUndefined'](_0x55b614[_0x0669('0x46')])?null:_0x55b614[_0x0669('0x46')][_0x0669('0x48')]();}else{logger['error'](_0x0669('0x44'),getLogFromObject(_0x55b614));return null;}}else{logger[_0x0669('0xc')]('agicommand\x20not\x20found');return null;}}catch(_0x50a12e){logger[_0x0669('0xc')](_0x50a12e[_0x0669('0xd')]);return null;}});if(_0x10457f['finally']){logger[_0x0669('0x10')](util[_0x0669('0x12')](_0x0669('0x49'),_0x2f9229[_0x0669('0x19')],_0x2f9229['calleridname'],_0x2f9229[_0x0669('0x18')],_0x2f9229[_0x0669('0x1a')],_0x2f9229[_0x0669('0x1b')]));_0x7ed1ca['traverseBFS'](_0x10457f[_0x0669('0x4a')]['id'],function(_0x3fb5e1){try{_0x3fb5e1=_0x547eb6[_0x0669('0x3e')](_0x3fb5e1);logger['debug']('vertex',JSON['stringify'](_0x3fb5e1,null,0x2));if(_0x3fb5e1&&_0x547eb6[_0x3fb5e1[_0x0669('0x1f')]]){_0x55b614=_0x547eb6[_0x3fb5e1[_0x0669('0x1f')]](_0x3fb5e1);if(_0x55b614){logger['debug'](_0x0669('0x44'),getLogFromObject(_0x55b614));return _['isUndefined'](_0x55b614[_0x0669('0x46')])?null:_0x55b614[_0x0669('0x46')][_0x0669('0x48')]();}else{logger[_0x0669('0xc')](_0x0669('0x44'),getLogFromObject(_0x55b614));return null;}}else{logger[_0x0669('0xc')]('agicommand\x20not\x20found');return null;}}catch(_0x58e86e){logger['error'](_0x58e86e[_0x0669('0xd')]);return null;}});}logger[_0x0669('0x10')](util[_0x0669('0x12')](_0x0669('0x4b'),_0x2f9229[_0x0669('0x19')],_0x2f9229[_0x0669('0x17')],_0x2f9229[_0x0669('0x18')],_0x2f9229[_0x0669('0x1a')],_0x2f9229['uniqueid']));logger[_0x0669('0x10')](util[_0x0669('0x12')](_0x0669('0x4c'),_0x2f9229['context'],_0x2f9229['extension'],parseInt(_0x2f9229['priority'],0xa)+0x1));_0x2f9229[_0x0669('0x4d')](_0x2f9229[_0x0669('0x41')],_0x2f9229[_0x0669('0x42')],parseInt(_0x2f9229[_0x0669('0x43')],0xa)+0x1);_0x2f9229['close']();}}else{logger[_0x0669('0xc')](util[_0x0669('0x12')]('Project\x20%s\x20not\x20published',_0x2f9229[_0x0669('0x19')]));_0x2f9229[_0x0669('0x4d')](_0x2f9229[_0x0669('0x41')],_0x2f9229[_0x0669('0x42')],parseInt(_0x2f9229[_0x0669('0x43')],0xa)+0x1);_0x2f9229[_0x0669('0x33')]();}}else{logger['error'](util[_0x0669('0x12')](_0x0669('0x4e'),_0x2f9229[_0x0669('0x19')]));_0x2f9229[_0x0669('0x4d')](_0x2f9229[_0x0669('0x41')],_0x2f9229['extension'],parseInt(_0x2f9229[_0x0669('0x43')],0xa)+0x1);_0x2f9229[_0x0669('0x33')]();}}function main(){var _0x2879ed;return utilLicense[_0x0669('0x4f')]()[_0x0669('0x2c')](function(_0x5b84bd){if(_0x5b84bd){if(_0x5b84bd['voice']){if(_0x5b84bd['callysquare']&&_0x5b84bd[_0x0669('0x50')]>0x0){logger[_0x0669('0x10')](util[_0x0669('0x12')](_0x0669('0x51'),_0x5b84bd[_0x0669('0x50')]));_0x2879ed=_0x5b84bd[_0x0669('0x50')];}else{logger[_0x0669('0x10')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x0669('0x10')](_0x0669('0x52'));_0x2879ed=-0x1;}}})[_0x0669('0x53')](function(_0x15e3be){logger['error'](_0x0669('0x54'),_0x15e3be['stack']);})[_0x0669('0x4a')](function(){var _0x4521e8=require('./server')(config[_0x0669('0x3')][_0x0669('0xf')],config[_0x0669('0x3')]['ip'],_0x2879ed);_0x4521e8['on'](_0x0669('0xc'),errorHandler);_0x4521e8['on'](_0x0669('0x55'),listeningHandler);_0x4521e8['on'](_0x0669('0x56'),connectionHandler);_0x4521e8['on'](_0x0669('0x33'),closeHandler);});}main(); \ No newline at end of file +var _0x772a=['agi','../../config/license/util','./rpc','./mailRpc','./graph','defaults','nextTick','error','stack','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','mxGraphModel','root','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','mxCell','isArray','length','source','target','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','inspect','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','sync','production','start','stringify','joinAt','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','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','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','listening','lodash','util','../../config/environment','../../config/logger'];(function(_0x4dc5ca,_0x209e40){var _0x6ff6fb=function(_0x40321d){while(--_0x40321d){_0x4dc5ca['push'](_0x4dc5ca['shift']());}};_0x6ff6fb(++_0x209e40);}(_0x772a,0x1aa));var _0xa772=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x772a[_0x4c445a];return _0x2f611c;};'use strict';var parser=require('xml2json');var _=require(_0xa772('0x0'));var syncho=require('syncho');var util=require(_0xa772('0x1'));var moment=require('moment');var config=require(_0xa772('0x2'));var logger=require(_0xa772('0x3'))(_0xa772('0x4'));var utilLicense=require(_0xa772('0x5'));var rpc=require(_0xa772('0x6'));var mailRpc=require(_0xa772('0x7'));var Graph=require(_0xa772('0x8'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xa772('0x4')]=_[_0xa772('0x9')](config[_0xa772('0x4')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x4ec82c){process[_0xa772('0xa')](function(){syncho(function(){try{setChannelVariables(_0x4ec82c);agiHandler(_0x4ec82c);}catch(_0x58e0ea){logger[_0xa772('0xb')](_0x58e0ea[_0xa772('0xc')]);}});});}function listeningHandler(){console[_0xa772('0xd')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xa772('0x4')][_0xa772('0xe')]);logger[_0xa772('0xf')](util[_0xa772('0x10')](_0xa772('0x11'),config[_0xa772('0x4')]['ip'],config[_0xa772('0x4')][_0xa772('0xe')]));}function errorHandler(_0x221590){if(_0x221590&&_0x221590[_0xa772('0x12')]&&_0x221590['message']){logger[_0xa772('0xb')](util[_0xa772('0x10')](_0xa772('0x13'),_0x221590[_0xa772('0x12')],_0x221590['message']));}else{logger[_0xa772('0xb')](util[_0xa772('0x10')]('[ERROR]\x20%s',_0x221590[_0xa772('0xc')]));}}function closeHandler(){logger['info'](util[_0xa772('0x10')](_0xa772('0x14'),this[_0xa772('0x15')],this[_0xa772('0x16')],this[_0xa772('0x17')],this['dnid'],this[_0xa772('0x18')]));try{createSquareReport(this);}catch(_0x1339bd){logger[_0xa772('0xb')](_0x1339bd[_0xa772('0xc')]);}}function timeoutHandler(){logger['info'](util[_0xa772('0x10')](_0xa772('0x19'),this['arg_1'],this[_0xa772('0x16')],this[_0xa772('0x17')],this[_0xa772('0x1a')],this[_0xa772('0x18')]));}function hangupHandler(){logger[_0xa772('0xf')](util[_0xa772('0x10')](_0xa772('0x1b'),this[_0xa772('0x15')],this[_0xa772('0x16')],this[_0xa772('0x17')],this['dnid'],this[_0xa772('0x18')]));this[_0xa772('0x1c')]=!![];}function getRoot(_0x24df70){return parser['toJson'](_0x24df70,{'object':!![]})[_0xa772('0x1d')][_0xa772('0x1e')];}function addVertex(_0x4f640b,_0x98fa74,_0x4ca8c3){_0x98fa74[_0xa772('0x1f')]=_0x4ca8c3;if(_0x98fa74[_0xa772('0x20')]('retry')){_0x98fa74[_0xa772('0x21')]=parseInt(_0x98fa74[_0xa772('0x22')],0xa);}_0x4f640b[_0xa772('0x23')](_[_0xa772('0x24')](_0x98fa74,_0xa772('0x25')));}function initGraph(_0x415e70,_0x373e8f){var _0x19a69d=new Graph();for(var _0x8db241 in _0x415e70){if(_0x415e70[_0xa772('0x20')](_0x8db241)){if(_[_0xa772('0x26')](_0x415e70[_0x8db241])){for(var _0x5f52c2=0x0;_0x5f52c2<_0x415e70[_0x8db241]['length'];_0x5f52c2+=0x1){addVertex(_0x19a69d,_0x415e70[_0x8db241][_0x5f52c2],_0x8db241);}}else{addVertex(_0x19a69d,_0x415e70[_0x8db241],_0x8db241);}}}for(var _0x50df5b=0x0;_0x50df5b<_0x373e8f[_0xa772('0x27')];_0x50df5b+=0x1){if(_0x373e8f[_0x50df5b][_0xa772('0x28')]&&_0x373e8f[_0x50df5b][_0xa772('0x29')]){_0x19a69d['addEdge'](_0x373e8f[_0x50df5b][_0xa772('0x28')],_0x373e8f[_0x50df5b]['target'],_0x373e8f[_0x50df5b][_0xa772('0x2a')]);}}return _0x19a69d;}function getSquareProject(_0x4c9a48,_0x2c977d){rpc[_0xa772('0x2b')](_0x4c9a48)[_0xa772('0x2c')](function(_0x58a544){_0x2c977d(null,_0x58a544);})[_0xa772('0x2d')](function(_0x30c8f8){_0x2c977d(null,_0x30c8f8);});}function createSquareReport(_0x45ca14,_0x344478){rpc[_0xa772('0x2e')](_0x45ca14)[_0xa772('0x2c')](function(_0x1f20d8){if(_0x344478){_0x344478(null,_0x1f20d8);}})[_0xa772('0x2d')](function(_0x465bf5){if(_0x344478){_0x344478(null,_0x465bf5);}});}function setChannelVariables(_0x5ba664){for(var _0x3dc06a in _0x5ba664){if(_0x5ba664['hasOwnProperty'](_0x3dc06a)){if(_0x3dc06a[_0xa772('0x2f')](_0xa772('0x30'))===0x0){_0x5ba664[_0x3dc06a['substring'](0x4)]=_0x5ba664[_0x3dc06a];delete _0x5ba664[_0x3dc06a];}}}}function getLogFromObject(_0x1f21bc){return util[_0xa772('0x31')](_0x1f21bc,{'showHidden':![],'depth':null});}function agiHandler(_0x55d3db){var _0x573895,_0x4b5b1d,_0x1152fa,_0x2e1ce4,_0x51d8aa;logger[_0xa772('0x32')](_0xa772('0x33'),JSON['stringify'](_0x55d3db,null,0x2));logger[_0xa772('0xf')](util[_0xa772('0x10')](_0xa772('0x34'),_0x55d3db[_0xa772('0x15')],_0x55d3db[_0xa772('0x16')],_0x55d3db[_0xa772('0x17')],_0x55d3db['dnid'],_0x55d3db[_0xa772('0x18')]));_0x55d3db['on']('error',errorHandler);_0x55d3db['on'](_0xa772('0x35'),closeHandler);_0x55d3db['on'](_0xa772('0x36'),timeoutHandler);_0x55d3db[_0xa772('0x1c')]=![];_0x55d3db['on']('hangup',hangupHandler);var _0x432b5f=getSquareProject[_0xa772('0x37')](null,_0x55d3db[_0xa772('0x15')]);if(_0x432b5f){if(_0x432b5f['production']){_0x573895=getRoot(_0x432b5f[_0xa772('0x38')]);if(_0x573895&&_0x573895[_0xa772('0x39')]){logger[_0xa772('0x32')](_0xa772('0x1e'),JSON[_0xa772('0x3a')](_0x573895,null,0x2));_0x55d3db[_0xa772('0x3b')]=moment()[_0xa772('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x4b5b1d=initGraph(_['omit'](_0x573895,_0xa772('0x25')),_0x573895[_0xa772('0x25')]);_0x1152fa=new Vertices(_0x55d3db,rpc,mailRpc);logger[_0xa772('0xf')](util[_0xa772('0x10')](_0xa772('0x3c'),_0x55d3db[_0xa772('0x15')],_0x55d3db['calleridname'],_0x55d3db[_0xa772('0x17')],_0x55d3db['dnid'],_0x55d3db[_0xa772('0x18')]));_0x4b5b1d[_0xa772('0x3d')](_0x573895[_0xa772('0x39')]['id'],function(_0x2d0dfc){try{_0x2d0dfc=_0x1152fa[_0xa772('0x3e')](_0x2d0dfc);logger['debug'](_0xa772('0x3f'),JSON[_0xa772('0x3a')](_0x2d0dfc,null,0x2));if(_0x2d0dfc[_0xa772('0x1f')]===_0xa772('0x40')){logger[_0xa772('0xf')](_0xa772('0x41'));_0x55d3db[_0xa772('0x42')]=_0x2d0dfc[_0xa772('0x42')]||_0x55d3db['context'];_0x55d3db[_0xa772('0x43')]=_0x2d0dfc[_0xa772('0x43')];_0x55d3db[_0xa772('0x44')]=_0x2d0dfc[_0xa772('0x44')]?_0x2d0dfc[_0xa772('0x44')]-0x1:0x1;return null;}else if(_0x2d0dfc&&_0x1152fa[_0x2d0dfc[_0xa772('0x1f')]]){_0x51d8aa=_0x1152fa[_0x2d0dfc[_0xa772('0x1f')]](_0x2d0dfc);logger[_0xa772('0xf')](_0xa772('0x45'),JSON[_0xa772('0x3a')](_0x51d8aa,null,0x2));if(_0x51d8aa&&_0x51d8aa[_0xa772('0x46')]===AGI_CODE_SUCCESS&&_0x51d8aa['result']!==AGI_RESULT_ERROR&&!_0x55d3db[_0xa772('0x1c')]){logger[_0xa772('0x32')](_0xa772('0x45'),getLogFromObject(_0x51d8aa));return _[_0xa772('0x47')](_0x51d8aa[_0xa772('0x48')])?null:_0x51d8aa[_0xa772('0x48')][_0xa772('0x49')]();}else{logger['error'](_0xa772('0x45'),getLogFromObject(_0x51d8aa));return null;}}else{logger[_0xa772('0xb')](_0xa772('0x4a'));return null;}}catch(_0x589d19){logger[_0xa772('0xb')](_0x589d19[_0xa772('0xc')]);return null;}});if(_0x573895[_0xa772('0x4b')]){logger[_0xa772('0xf')](util[_0xa772('0x10')](_0xa772('0x4c'),_0x55d3db[_0xa772('0x15')],_0x55d3db[_0xa772('0x16')],_0x55d3db[_0xa772('0x17')],_0x55d3db[_0xa772('0x1a')],_0x55d3db[_0xa772('0x18')]));_0x4b5b1d[_0xa772('0x3d')](_0x573895[_0xa772('0x4b')]['id'],function(_0x35a53f){try{_0x35a53f=_0x1152fa[_0xa772('0x3e')](_0x35a53f);logger['debug'](_0xa772('0x3f'),JSON[_0xa772('0x3a')](_0x35a53f,null,0x2));if(_0x35a53f&&_0x1152fa[_0x35a53f[_0xa772('0x1f')]]){_0x51d8aa=_0x1152fa[_0x35a53f[_0xa772('0x1f')]](_0x35a53f);if(_0x51d8aa){logger[_0xa772('0x32')](_0xa772('0x45'),getLogFromObject(_0x51d8aa));return _[_0xa772('0x47')](_0x51d8aa[_0xa772('0x48')])?null:_0x51d8aa[_0xa772('0x48')][_0xa772('0x49')]();}else{logger[_0xa772('0xb')]('response',getLogFromObject(_0x51d8aa));return null;}}else{logger[_0xa772('0xb')]('agicommand\x20not\x20found');return null;}}catch(_0x2051e8){logger[_0xa772('0xb')](_0x2051e8[_0xa772('0xc')]);return null;}});}logger[_0xa772('0xf')](util[_0xa772('0x10')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x55d3db[_0xa772('0x15')],_0x55d3db[_0xa772('0x16')],_0x55d3db[_0xa772('0x17')],_0x55d3db[_0xa772('0x1a')],_0x55d3db[_0xa772('0x18')]));logger['info'](util[_0xa772('0x10')](_0xa772('0x4d'),_0x55d3db[_0xa772('0x42')],_0x55d3db['extension'],parseInt(_0x55d3db['priority'],0xa)+0x1));_0x55d3db[_0xa772('0x4e')](_0x55d3db[_0xa772('0x42')],_0x55d3db[_0xa772('0x43')],parseInt(_0x55d3db[_0xa772('0x44')],0xa)+0x1);_0x55d3db[_0xa772('0x35')]();}}else{logger[_0xa772('0xb')](util['format']('Project\x20%s\x20not\x20published',_0x55d3db['arg_1']));_0x55d3db[_0xa772('0x4e')](_0x55d3db[_0xa772('0x42')],_0x55d3db[_0xa772('0x43')],parseInt(_0x55d3db[_0xa772('0x44')],0xa)+0x1);_0x55d3db[_0xa772('0x35')]();}}else{logger['error'](util[_0xa772('0x10')](_0xa772('0x4f'),_0x55d3db[_0xa772('0x15')]));_0x55d3db[_0xa772('0x4e')](_0x55d3db[_0xa772('0x42')],_0x55d3db['extension'],parseInt(_0x55d3db[_0xa772('0x44')],0xa)+0x1);_0x55d3db[_0xa772('0x35')]();}}function main(){var _0x187352;return utilLicense[_0xa772('0x50')]()[_0xa772('0x2c')](function(_0x222edb){if(_0x222edb){if(_0x222edb[_0xa772('0x51')]){if(_0x222edb[_0xa772('0x52')]&&_0x222edb[_0xa772('0x52')]>0x0){logger[_0xa772('0xf')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x222edb[_0xa772('0x52')]));_0x187352=_0x222edb[_0xa772('0x52')];}else{logger['info'](_0xa772('0x53'));}}else{logger[_0xa772('0xf')](_0xa772('0x54'));_0x187352=-0x1;}}})[_0xa772('0x2d')](function(_0x2f871f){logger[_0xa772('0xb')]('[LICENSE]',_0x2f871f['stack']);})[_0xa772('0x4b')](function(){var _0x32af34=require('./server')(config[_0xa772('0x4')]['port'],config[_0xa772('0x4')]['ip'],_0x187352);_0x32af34['on'](_0xa772('0xb'),errorHandler);_0x32af34['on'](_0xa772('0x55'),listeningHandler);_0x32af34['on']('connection',connectionHandler);_0x32af34['on'](_0xa772('0x35'),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 a6f8200..5b45561 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 _0x8575=['catch','sendMailMessage','SendMail','jayson/promise','client','http','request','then','message'];(function(_0x1b60f9,_0x41b666){var _0x48ea2a=function(_0x13efcb){while(--_0x13efcb){_0x1b60f9['push'](_0x1b60f9['shift']());}};_0x48ea2a(++_0x41b666);}(_0x8575,0x11a));var _0x5857=function(_0x52773a,_0x5c8991){_0x52773a=_0x52773a-0x0;var _0x12e8c9=_0x8575[_0x52773a];return _0x12e8c9;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x5857('0x0'));var client=jayson[_0x5857('0x1')][_0x5857('0x2')]({'port':0x232b});function request(_0x5767c4,_0x155d02){return new BPromise(function(_0x480283,_0x22189b){return client[_0x5857('0x3')](_0x5767c4,_0x155d02)[_0x5857('0x4')](function(_0x2e493d){if(_0x2e493d['error']){return _0x22189b(_0x2e493d['error'][_0x5857('0x5')]);}else{return _0x480283(_0x2e493d['result']);}})[_0x5857('0x6')](function(_0x4d98ef){return _0x22189b(_0x4d98ef);});});}exports[_0x5857('0x7')]=function(_0x55bb94,_0x4e59d7){return request(_0x5857('0x8'),{'account':_0x55bb94,'message':_0x4e59d7});}; \ No newline at end of file +var _0x1a31=['message','result','catch','sendMailMessage','bluebird','jayson/promise','http','request','then','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1a31,0x1e4));var _0x11a3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1a31[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x11a3('0x0'));var jayson=require(_0x11a3('0x1'));var client=jayson['client'][_0x11a3('0x2')]({'port':0x232b});function request(_0x1dc5fd,_0x1fce23){return new BPromise(function(_0x31f366,_0x334003){return client[_0x11a3('0x3')](_0x1dc5fd,_0x1fce23)[_0x11a3('0x4')](function(_0x5c0068){if(_0x5c0068[_0x11a3('0x5')]){return _0x334003(_0x5c0068['error'][_0x11a3('0x6')]);}else{return _0x31f366(_0x5c0068[_0x11a3('0x7')]);}})[_0x11a3('0x8')](function(_0x5db24d){return _0x334003(_0x5db24d);});});}exports[_0x11a3('0x9')]=function(_0x43fd06,_0x2bc9bd){return request('SendMail',{'account':_0x43fd06,'message':_0x2bc9bd});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 53f6fdf..1ba599a 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 _0x7aad=['\x0d\x0a\x0d\x0a','toString','substring','length','indexOf','slice','trim','emit','exports','util','stream','Transform','_localBuffer','inherits','prototype'];(function(_0xb1c60b,_0x385134){var _0x4c391d=function(_0x34a8f3){while(--_0x34a8f3){_0xb1c60b['push'](_0xb1c60b['shift']());}};_0x4c391d(++_0x385134);}(_0x7aad,0x180));var _0xd7aa=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x7aad[_0x47b58b];return _0x46bebe;};'use strict';var util=require(_0xd7aa('0x0'));var Transform=require(_0xd7aa('0x1'))[_0xd7aa('0x2')];function AGIReply(_0x1541cd){Transform['call'](this,_0x1541cd);this[_0xd7aa('0x3')]='';this['_inBody']=![];}util[_0xd7aa('0x4')](AGIReply,Transform);AGIReply[_0xd7aa('0x5')]['_transform']=function(_0x1459f9,_0x5b009f,_0x5860f7){var _0x174767='\x0a',_0x9cf409=['\x0a\x0a',_0xd7aa('0x6')],_0x475852=-0x1,_0x2c264b=-0x1,_0x3382f8='',_0x4f3cf9=0x0,_0x2d62f1='',_0x4a8c9a='';this[_0xd7aa('0x3')]+=_0x1459f9[_0xd7aa('0x7')]();_0x2d62f1=this['_localBuffer'];if(!this['_inBody']){_0x4f3cf9=0x0;while(_0x9cf409[_0x4f3cf9]){while((_0x2c264b=_0x2d62f1['indexOf'](_0x9cf409[_0x4f3cf9]))!=-0x1){_0x3382f8=_0x9cf409[_0x4f3cf9];_0x4a8c9a=_0x2d62f1['substring'](0x0,_0x2c264b);_0x2d62f1=_0x2d62f1[_0xd7aa('0x8')](_0x2c264b+_0x3382f8[_0xd7aa('0x9')]);var _0x2ff9ad=_0x4a8c9a['split'](_0x174767),_0x3d8301=0x0,_0x29b850={},_0x49c88c='',_0x4580b0='',_0x46af5b=-0x1;while(_0x2ff9ad[_0x3d8301]){_0x46af5b=_0x2ff9ad[_0x3d8301][_0xd7aa('0xa')](':');if(_0x46af5b!=-0x1){_0x49c88c=_0x2ff9ad[_0x3d8301][_0xd7aa('0xb')](0x0,_0x46af5b)['trim']();_0x4580b0=_0x2ff9ad[_0x3d8301][_0xd7aa('0xb')](_0x46af5b+0x1)[_0xd7aa('0xc')]();if(_0x49c88c[_0xd7aa('0x9')]>0x0){_0x29b850[_0x49c88c]=_0x4580b0;}}else{}_0x3d8301++;}this['emit']('headers',_0x29b850);this['_inBody']=!![];}_0x4f3cf9++;}this[_0xd7aa('0x3')]=_0x2d62f1;}else{while((_0x475852=_0x2d62f1[_0xd7aa('0xa')](_0x174767))!=-0x1){_0x4a8c9a=_0x2d62f1[_0xd7aa('0x8')](0x0,_0x475852);this[_0xd7aa('0xd')]('line',_0x4a8c9a);_0x2d62f1=_0x2d62f1['substring'](_0x475852+_0x174767[_0xd7aa('0x9')]);}this[_0xd7aa('0x3')]=_0x2d62f1;}_0x5860f7();};module[_0xd7aa('0xe')]=AGIReply; \ No newline at end of file +var _0x131e=['line','exports','call','_localBuffer','_inBody','inherits','prototype','indexOf','substring','length','split','slice','trim','emit'];(function(_0x44f974,_0x4db616){var _0x805dbd=function(_0x1a56b7){while(--_0x1a56b7){_0x44f974['push'](_0x44f974['shift']());}};_0x805dbd(++_0x4db616);}(_0x131e,0x1ec));var _0xe131=function(_0x394cf5,_0x5a4999){_0x394cf5=_0x394cf5-0x0;var _0x443dd1=_0x131e[_0x394cf5];return _0x443dd1;};'use strict';var util=require('util');var Transform=require('stream')['Transform'];function AGIReply(_0x10fd23){Transform[_0xe131('0x0')](this,_0x10fd23);this[_0xe131('0x1')]='';this[_0xe131('0x2')]=![];}util[_0xe131('0x3')](AGIReply,Transform);AGIReply[_0xe131('0x4')]['_transform']=function(_0x2fc440,_0x344903,_0x2de969){var _0x1eb0df='\x0a',_0x1002a6=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x48a90e=-0x1,_0x5c4eb5=-0x1,_0x562617='',_0x4bf386=0x0,_0x241f05='',_0x210bb5='';this[_0xe131('0x1')]+=_0x2fc440['toString']();_0x241f05=this[_0xe131('0x1')];if(!this[_0xe131('0x2')]){_0x4bf386=0x0;while(_0x1002a6[_0x4bf386]){while((_0x5c4eb5=_0x241f05[_0xe131('0x5')](_0x1002a6[_0x4bf386]))!=-0x1){_0x562617=_0x1002a6[_0x4bf386];_0x210bb5=_0x241f05[_0xe131('0x6')](0x0,_0x5c4eb5);_0x241f05=_0x241f05[_0xe131('0x6')](_0x5c4eb5+_0x562617[_0xe131('0x7')]);var _0x12f2cf=_0x210bb5[_0xe131('0x8')](_0x1eb0df),_0x555b36=0x0,_0x55768a={},_0x554db6='',_0x5f0434='',_0x14ed9a=-0x1;while(_0x12f2cf[_0x555b36]){_0x14ed9a=_0x12f2cf[_0x555b36][_0xe131('0x5')](':');if(_0x14ed9a!=-0x1){_0x554db6=_0x12f2cf[_0x555b36][_0xe131('0x9')](0x0,_0x14ed9a)[_0xe131('0xa')]();_0x5f0434=_0x12f2cf[_0x555b36][_0xe131('0x9')](_0x14ed9a+0x1)[_0xe131('0xa')]();if(_0x554db6[_0xe131('0x7')]>0x0){_0x55768a[_0x554db6]=_0x5f0434;}}else{}_0x555b36++;}this[_0xe131('0xb')]('headers',_0x55768a);this['_inBody']=!![];}_0x4bf386++;}this['_localBuffer']=_0x241f05;}else{while((_0x48a90e=_0x241f05['indexOf'](_0x1eb0df))!=-0x1){_0x210bb5=_0x241f05['substring'](0x0,_0x48a90e);this[_0xe131('0xb')](_0xe131('0xc'),_0x210bb5);_0x241f05=_0x241f05[_0xe131('0x6')](_0x48a90e+_0x1eb0df['length']);}this['_localBuffer']=_0x241f05;}_0x2de969();};module[_0xe131('0xd')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index c3b8efc..a8dfa5c 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 _0xf68b=['client','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','email','getSquareProjectById','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','getPauseById','ShowPause','agentLogin','PauseUser','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','util'];(function(_0x29e7c9,_0xafc3e7){var _0x4c74e2=function(_0x32e8ba){while(--_0x32e8ba){_0x29e7c9['push'](_0x29e7c9['shift']());}};_0x4c74e2(++_0xafc3e7);}(_0xf68b,0x11a));var _0xbf68=function(_0x24eaa0,_0x5ad581){_0x24eaa0=_0x24eaa0-0x0;var _0x3ca962=_0xf68b[_0x24eaa0];return _0x3ca962;};'use strict';var BPromise=require(_0xbf68('0x0'));var moment=require(_0xbf68('0x1'));var _=require('lodash');var util=require(_0xbf68('0x2'));var jayson=require('jayson/promise');var client=jayson[_0xbf68('0x3')][_0xbf68('0x4')]({'port':0x2329});function request(_0x42689c,_0x5903e3){return new BPromise(function(_0x53e31e,_0x22e651){return client[_0xbf68('0x5')](_0x42689c,_0x5903e3)[_0xbf68('0x6')](function(_0x1fdcd6){if(_0x1fdcd6[_0xbf68('0x7')]){return _0x22e651(_0x1fdcd6[_0xbf68('0x7')][_0xbf68('0x8')]);}else{return _0x53e31e(_0x1fdcd6[_0xbf68('0x9')]);}})[_0xbf68('0xa')](function(_0x271942){return _0x22e651(_0x271942);});});}exports[_0xbf68('0xb')]=function(_0x574a85){return request(_0xbf68('0xc'),{'options':{'raw':![],'where':{'name':_0x574a85},'attributes':['production']}});};exports[_0xbf68('0xd')]=function(_0x30c83f){return request(_0xbf68('0xe'),{'options':{'raw':![],'where':{'id':_0x30c83f},'include':[{'model':_0xbf68('0xf'),'as':'Smtp'}],'attributes':['id','name',_0xbf68('0x10')]}});};exports[_0xbf68('0x11')]=function(_0x29dccc){return request(_0xbf68('0xc'),{'options':{'where':{'id':_0x29dccc},'attributes':[_0xbf68('0x12')]}});};exports[_0xbf68('0x13')]=function(_0x128437){return request(_0xbf68('0x14'),{'options':{'where':{'id':_0x128437},'attributes':[_0xbf68('0x12')]}});};exports[_0xbf68('0x15')]=function(_0x411e7f){return request('ShowVariable',{'options':{'where':{'id':_0x411e7f},'attributes':[_0xbf68('0x12')]}});};exports['getSquareOdbcById']=function(_0x5dac1c){return request(_0xbf68('0x16'),{'options':{'where':{'id':_0x5dac1c},'attributes':[_0xbf68('0x17')]}});};exports[_0xbf68('0x18')]=function(_0x245eca){return request(_0xbf68('0x19'),{'options':{'where':{'id':_0x245eca},'attributes':[_0xbf68('0x12')]}});};exports[_0xbf68('0x1a')]=function(_0x494e73){return request(_0xbf68('0x1b'),{'options':{'where':{'id':_0x494e73},'attributes':[_0xbf68('0x12')]}});};exports[_0xbf68('0x1c')]=function(_0x59eae3){return request(_0xbf68('0x1d'),{'options':{'where':{'id':_0x59eae3},'attributes':[_0xbf68('0x1e')]}});};exports[_0xbf68('0x1f')]=function(_0x3801b9){return request(_0xbf68('0x20'),{'options':{'raw':![],'where':{'id':_0x3801b9},'include':[{'model':_0xbf68('0x21'),'as':'Intervals'}]}});};exports[_0xbf68('0x22')]=function(_0x2d6cbe){return request(_0xbf68('0x23'),{'options':{'where':{'id':_0x2d6cbe},'attributes':['id',_0xbf68('0x12')]}});};exports[_0xbf68('0x24')]=function(_0x13160e){return request('CreateSmsMessage',{'body':_0x13160e});};exports[_0xbf68('0x25')]=function(_0x4f8521){return request(_0xbf68('0x26'),{'body':_0x4f8521});};exports[_0xbf68('0x27')]=function(_0x3302fb){return request(_0xbf68('0x28'),{'body':_[_0xbf68('0x29')](_0x3302fb,{'project_name':_0x3302fb[_0xbf68('0x2a')],'prev_project_name':_0x3302fb[_0xbf68('0x2b')]||'','is_subproject':_0x3302fb[_0xbf68('0x2b')]?!![]:![],'leaveAt':moment()[_0xbf68('0x2c')](_0xbf68('0x2d'))})});};exports[_0xbf68('0x2e')]=function(_0x105f0e){return request('CreateSquareRecording',{'body':_0x105f0e});};exports[_0xbf68('0x2f')]=function(_0x1da530){return request(_0xbf68('0x30'),{'body':_0x1da530});};exports[_0xbf68('0x31')]=function(_0x3f1974){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x3f1974['phone'],'ListId':_0x3f1974['ListId']}}})[_0xbf68('0x6')](function(_0x3c8932){if(_0x3c8932){return _0x3c8932;}return request('CreateCmContact',{'body':_0x3f1974});});};exports[_0xbf68('0x32')]=function(_0x5ebc99){return request(_0xbf68('0x33'),{'options':{'where':{'id':_0x5ebc99},'attributes':[_0xbf68('0x12')]}});};exports[_0xbf68('0x34')]=function(_0x42365e,_0x8857a6){return request('LoginUser',{'body':{'interface':_0x8857a6},'options':{'where':_0x42365e}});};exports['agentPause']=function(_0x18fbea,_0x274ac3,_0x24a8d4){return request(_0xbf68('0x35'),{'body':{'type':_0x274ac3,'uniqueid':_0x24a8d4},'options':{'where':_0x18fbea}});};exports['agentUnpause']=function(_0x348437){return request(_0xbf68('0x36'),{'body':{},'options':{'where':_0x348437}});};exports[_0xbf68('0x37')]=function(_0x63cd9f){return request(_0xbf68('0x38'),{'body':{},'options':{'where':_0x63cd9f}});}; \ No newline at end of file +var _0xa35a=['LogoutUser','moment','lodash','util','jayson/promise','client','http','request','then','error','message','result','getSquareProject','ShowSquareProject','production','ShowMailAccount','MailServerOut','Smtp','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','ShowCmHopper','phone','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause'];(function(_0x38ff1e,_0x3b9385){var _0x3755d4=function(_0x6e6692){while(--_0x6e6692){_0x38ff1e['push'](_0x38ff1e['shift']());}};_0x3755d4(++_0x3b9385);}(_0xa35a,0x1c9));var _0xaa35=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xa35a[_0x46e363];return _0x3fb059;};'use strict';var BPromise=require('bluebird');var moment=require(_0xaa35('0x0'));var _=require(_0xaa35('0x1'));var util=require(_0xaa35('0x2'));var jayson=require(_0xaa35('0x3'));var client=jayson[_0xaa35('0x4')][_0xaa35('0x5')]({'port':0x2329});function request(_0x2b54d2,_0x475b17){return new BPromise(function(_0x1cc823,_0x368694){return client[_0xaa35('0x6')](_0x2b54d2,_0x475b17)[_0xaa35('0x7')](function(_0x309814){if(_0x309814[_0xaa35('0x8')]){return _0x368694(_0x309814['error'][_0xaa35('0x9')]);}else{return _0x1cc823(_0x309814[_0xaa35('0xa')]);}})['catch'](function(_0x212b60){return _0x368694(_0x212b60);});});}exports[_0xaa35('0xb')]=function(_0x5bb442){return request(_0xaa35('0xc'),{'options':{'raw':![],'where':{'name':_0x5bb442},'attributes':[_0xaa35('0xd')]}});};exports['getMailAccountById']=function(_0x40d775){return request(_0xaa35('0xe'),{'options':{'raw':![],'where':{'id':_0x40d775},'include':[{'model':_0xaa35('0xf'),'as':_0xaa35('0x10')}],'attributes':['id',_0xaa35('0x11'),'email']}});};exports[_0xaa35('0x12')]=function(_0x203f9d){return request(_0xaa35('0xc'),{'options':{'where':{'id':_0x203f9d},'attributes':[_0xaa35('0x11')]}});};exports[_0xaa35('0x13')]=function(_0x124868){return request(_0xaa35('0x14'),{'options':{'where':{'id':_0x124868},'attributes':[_0xaa35('0x11')]}});};exports[_0xaa35('0x15')]=function(_0x484797){return request(_0xaa35('0x16'),{'options':{'where':{'id':_0x484797},'attributes':[_0xaa35('0x11')]}});};exports[_0xaa35('0x17')]=function(_0x39c3a0){return request(_0xaa35('0x18'),{'options':{'where':{'id':_0x39c3a0},'attributes':[_0xaa35('0x19')]}});};exports[_0xaa35('0x1a')]=function(_0x1cfb78){return request(_0xaa35('0x1b'),{'options':{'where':{'id':_0x1cfb78},'attributes':[_0xaa35('0x11')]}});};exports[_0xaa35('0x1c')]=function(_0xa4cfa0){return request('ShowTrunk',{'options':{'where':{'id':_0xa4cfa0},'attributes':[_0xaa35('0x11')]}});};exports['getSoundById']=function(_0xd0fdd1){return request(_0xaa35('0x1d'),{'options':{'where':{'id':_0xd0fdd1},'attributes':[_0xaa35('0x1e')]}});};exports[_0xaa35('0x1f')]=function(_0x1fcf18){return request(_0xaa35('0x20'),{'options':{'raw':![],'where':{'id':_0x1fcf18},'include':[{'model':_0xaa35('0x21'),'as':'Intervals'}]}});};exports[_0xaa35('0x22')]=function(_0x4b61d4){return request('ShowSmsAccount',{'options':{'where':{'id':_0x4b61d4},'attributes':['id','name']}});};exports[_0xaa35('0x23')]=function(_0x2fc8f7){return request(_0xaa35('0x24'),{'body':_0x2fc8f7});};exports[_0xaa35('0x25')]=function(_0xf6cd6c){return request(_0xaa35('0x26'),{'body':_0xf6cd6c});};exports['createSquareReport']=function(_0x1c1458){return request('CreateSquareReport',{'body':_[_0xaa35('0x27')](_0x1c1458,{'project_name':_0x1c1458[_0xaa35('0x28')],'prev_project_name':_0x1c1458[_0xaa35('0x29')]||'','is_subproject':_0x1c1458['arg_2']?!![]:![],'leaveAt':moment()[_0xaa35('0x2a')](_0xaa35('0x2b'))})});};exports[_0xaa35('0x2c')]=function(_0x24feba){return request(_0xaa35('0x2d'),{'body':_0x24feba});};exports[_0xaa35('0x2e')]=function(_0x2cfbcc){return request('CreateSquareMessage',{'body':_0x2cfbcc});};exports['createCmContact']=function(_0x386b1b){return request(_0xaa35('0x2f'),{'options':{'raw':![],'where':{'phone':_0x386b1b[_0xaa35('0x30')],'ListId':_0x386b1b[_0xaa35('0x31')]}}})[_0xaa35('0x7')](function(_0x4898ee){if(_0x4898ee){return _0x4898ee;}return request('CreateCmContact',{'body':_0x386b1b});});};exports[_0xaa35('0x32')]=function(_0x3822fb){return request(_0xaa35('0x33'),{'options':{'where':{'id':_0x3822fb},'attributes':[_0xaa35('0x11')]}});};exports[_0xaa35('0x34')]=function(_0xf380db,_0x5a83bb){return request(_0xaa35('0x35'),{'body':{'interface':_0x5a83bb},'options':{'where':_0xf380db}});};exports[_0xaa35('0x36')]=function(_0x5239fb,_0x4c3220,_0x4131f3){return request('PauseUser',{'body':{'type':_0x4c3220,'uniqueid':_0x4131f3},'options':{'where':_0x5239fb}});};exports[_0xaa35('0x37')]=function(_0x43fa0f){return request('UnpauseUser',{'body':{},'options':{'where':_0x43fa0f}});};exports['agentLogout']=function(_0x21b64e){return request(_0xaa35('0x38'),{'body':{},'options':{'where':_0x21b64e}});}; \ 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 f69d9cd..b7c0bef 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 _0x254a=['./polly','./lex','exports'];(function(_0x4bfc17,_0x1cde32){var _0x100a07=function(_0x5b26e4){while(--_0x5b26e4){_0x4bfc17['push'](_0x4bfc17['shift']());}};_0x100a07(++_0x1cde32);}(_0x254a,0x138));var _0xa254=function(_0x311e78,_0xbcf8ca){_0x311e78=_0x311e78-0x0;var _0x44fef6=_0x254a[_0x311e78];return _0x44fef6;};var polly=require(_0xa254('0x0'));var lex=require(_0xa254('0x1'));module[_0xa254('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x6eec=['./polly','./lex','exports'];(function(_0x3640b2,_0x355842){var _0x124b1b=function(_0x207f2d){while(--_0x207f2d){_0x3640b2['push'](_0x3640b2['shift']());}};_0x124b1b(++_0x355842);}(_0x6eec,0x1e0));var _0xc6ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6eec[_0x3dd15e];return _0x231fd0;};var polly=require(_0xc6ee('0x0'));var lex=require(_0xc6ee('0x1'));module[_0xc6ee('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index de7c746..1fbfc74 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa75b=['./lib/api'];(function(_0x20c69c,_0x5c2df5){var _0x4553e8=function(_0x2c8a9c){while(--_0x2c8a9c){_0x20c69c['push'](_0x20c69c['shift']());}};_0x4553e8(++_0x5c2df5);}(_0xa75b,0x170));var _0xba75=function(_0x24f2c1,_0x31ddf6){_0x24f2c1=_0x24f2c1-0x0;var _0x3b8759=_0xa75b[_0x24f2c1];return _0x3b8759;};'use strict';var lex=require(_0xba75('0x0'));module['exports']=function(_0x546e14,_0x10c0dd,_0x39dc19,_0x17b666,_0x3cde96,_0x1760c0){return lex(_0x546e14,_0x10c0dd,_0x39dc19,_0x17b666,_0x3cde96,_0x1760c0);}; \ No newline at end of file +var _0x878f=['exports'];(function(_0x3fde63,_0x4e2b8b){var _0x5ac5f3=function(_0x395357){while(--_0x395357){_0x3fde63['push'](_0x3fde63['shift']());}};_0x5ac5f3(++_0x4e2b8b);}(_0x878f,0x173));var _0xf878=function(_0x5bb539,_0xd6e226){_0x5bb539=_0x5bb539-0x0;var _0x204f18=_0x878f[_0x5bb539];return _0x204f18;};'use strict';var lex=require('./lib/api');module[_0xf878('0x0')]=function(_0x658976,_0x2e1d23,_0x12df2b,_0x1b3d0b,_0x3d74cf,_0x9e6783){return lex(_0x658976,_0x2e1d23,_0x12df2b,_0x1b3d0b,_0x3d74cf,_0x9e6783);}; \ 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 4e861b1..a5ed042 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(_0x5c0f42,_0x1468c8){var _0x1d05ad=function(_0x1dbab2){while(--_0x1dbab2){_0x5c0f42['push'](_0x5c0f42['shift']());}};_0x1d05ad(++_0x1468c8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x4db626,_0x4d520a){var _0x45859e=function(_0x5cef39){while(--_0x5cef39){_0x4db626['push'](_0x4db626['shift']());}};_0x45859e(++_0x4d520a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 8f02bac..094390b 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 _0xf813=['./lib/api','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf813,0x72));var _0x3f81=function(_0x50c154,_0x4e08a2){_0x50c154=_0x50c154-0x0;var _0x23aad4=_0xf813[_0x50c154];return _0x23aad4;};'use strict';var polly=require(_0x3f81('0x0'));module[_0x3f81('0x1')]=function(_0x31dede,_0x361e71,_0xbab36b,_0x4e0c18,_0x5ce932,_0x575ff2,_0x501b09){return polly(_0x31dede,_0x361e71,_0xbab36b,_0x4e0c18,_0x5ce932,_0x575ff2,_0x501b09);}; \ No newline at end of file +var _0x6023=['./lib/api','exports'];(function(_0x23af73,_0x1c7f49){var _0x3cd38c=function(_0x4cab20){while(--_0x4cab20){_0x23af73['push'](_0x23af73['shift']());}};_0x3cd38c(++_0x1c7f49);}(_0x6023,0x1ea));var _0x3602=function(_0x38f81d,_0x290069){_0x38f81d=_0x38f81d-0x0;var _0x2de01d=_0x6023[_0x38f81d];return _0x2de01d;};'use strict';var polly=require(_0x3602('0x0'));module[_0x3602('0x1')]=function(_0xe82c2e,_0x53d71f,_0x18f846,_0x5438a2,_0x1ead7b,_0x3d797e,_0x37e2d7){return polly(_0xe82c2e,_0x53d71f,_0x18f846,_0x5438a2,_0x1ead7b,_0x3d797e,_0x37e2d7);}; \ 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 e5415c7..0c10557 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 _0x5949=['exports','Polly','text','mp3','path','bluebird','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x4e6efe,_0x40d916){var _0xbe81d7=function(_0xcec098){while(--_0xcec098){_0x4e6efe['push'](_0x4e6efe['shift']());}};_0xbe81d7(++_0x40d916);}(_0x5949,0x100));var _0x9594=function(_0x919445,_0x5467dc){_0x919445=_0x919445-0x0;var _0x511b3e=_0x5949[_0x919445];return _0x511b3e;};'use strict';var fs=require('fs');var path=require(_0x9594('0x0'));var BPromise=require(_0x9594('0x1'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x316aef,_0x4d00c7,_0x33271){return new BPromise(function(_0x791506,_0x26ba6c){_0x316aef[_0x9594('0x2')](_0x4d00c7,function(_0x497db1,_0x48f060){if(_0x497db1){_0x26ba6c(_0x497db1);}else if(_0x48f060){if(_0x48f060[_0x9594('0x3')]instanceof Buffer){fs['writeFile'](_0x33271,_0x48f060[_0x9594('0x3')],function(_0x4e09f4){if(_0x4e09f4){_0x26ba6c(_0x4e09f4);}else{_0x791506();}});}else{_0x26ba6c(new Error(_0x9594('0x4')));}}else{_0x26ba6c(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x9594('0x5')]=function(_0x494207,_0x1779fa,_0x10847f,_0x2f4a39,_0x481ca4,_0x1811be,_0x27835d){var _0x401d71=new AWS[(_0x9594('0x6'))]({'accessKeyId':_0x494207,'secretAccessKey':_0x1779fa,'region':_0x10847f});var _0x38e625={'Text':_0x481ca4,'TextType':_0x1811be||_0x9594('0x7'),'OutputFormat':_0x9594('0x8'),'VoiceId':_0x2f4a39};return pollyResult(_0x401d71,_0x38e625,_0x27835d);}; \ No newline at end of file +var _0x89bc=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','bluebird','randomstring','aws-sdk','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x4bfb3f,_0x2f8211){var _0x122c66=function(_0x1a9107){while(--_0x1a9107){_0x4bfb3f['push'](_0x4bfb3f['shift']());}};_0x122c66(++_0x2f8211);}(_0x89bc,0xfe));var _0xc89b=function(_0x547ff4,_0x416fa1){_0x547ff4=_0x547ff4-0x0;var _0xe41057=_0x89bc[_0x547ff4];return _0xe41057;};'use strict';var fs=require('fs');var path=require(_0xc89b('0x0'));var BPromise=require(_0xc89b('0x1'));var rs=require(_0xc89b('0x2'));var AWS=require(_0xc89b('0x3'));function pollyResult(_0x53b1d7,_0x469ff4,_0x4ae88d){return new BPromise(function(_0x34d062,_0x2ef83c){_0x53b1d7['synthesizeSpeech'](_0x469ff4,function(_0x1811b1,_0xb4dae3){if(_0x1811b1){_0x2ef83c(_0x1811b1);}else if(_0xb4dae3){if(_0xb4dae3['AudioStream']instanceof Buffer){fs[_0xc89b('0x4')](_0x4ae88d,_0xb4dae3['AudioStream'],function(_0x347317){if(_0x347317){_0x2ef83c(_0x347317);}else{_0x34d062();}});}else{_0x2ef83c(new Error(_0xc89b('0x5')));}}else{_0x2ef83c(new Error(_0xc89b('0x6')));}});});}module[_0xc89b('0x7')]=function(_0x4946c3,_0x25a13d,_0x49ca48,_0xb99317,_0x167868,_0x59c1c4,_0x3723cb){var _0x4b2f25=new AWS['Polly']({'accessKeyId':_0x4946c3,'secretAccessKey':_0x25a13d,'region':_0x49ca48});var _0x585742={'Text':_0x167868,'TextType':_0x59c1c4||_0xc89b('0x8'),'OutputFormat':_0xc89b('0x9'),'VoiceId':_0xb99317};return pollyResult(_0x4b2f25,_0x585742,_0x3723cb);}; \ 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 e98390b..85a4013 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 _0x71de=['exports','./lib/api'];(function(_0x432391,_0xdd18b6){var _0x4fdc31=function(_0x5df515){while(--_0x5df515){_0x432391['push'](_0x432391['shift']());}};_0x4fdc31(++_0xdd18b6);}(_0x71de,0x1bd));var _0xe71d=function(_0x884a20,_0x10a089){_0x884a20=_0x884a20-0x0;var _0x11648f=_0x71de[_0x884a20];return _0x11648f;};'use strict';var asr=require(_0xe71d('0x0'));module[_0xe71d('0x1')]=function(_0x2421dc,_0x501fa1,_0x53ac4c,_0x52aee6){return asr(_0x2421dc,_0x501fa1,_0x53ac4c);}; \ No newline at end of file +var _0x1cea=['exports'];(function(_0x2bf01b,_0x35d5ab){var _0x291217=function(_0x5b11d5){while(--_0x5b11d5){_0x2bf01b['push'](_0x2bf01b['shift']());}};_0x291217(++_0x35d5ab);}(_0x1cea,0x80));var _0xa1ce=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x1cea[_0x2fc012];return _0x2891f9;};'use strict';var asr=require('./lib/api');module[_0xa1ce('0x0')]=function(_0x44a21a,_0x3f5342,_0x39f988,_0x13c420){return asr(_0x44a21a,_0x3f5342,_0x39f988);}; \ 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 d66d0ef..6232861 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 _0x688a=['filepath\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','base64','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','string','length'];(function(_0x597107,_0x36b608){var _0x3042db=function(_0x53f3b0){while(--_0x53f3b0){_0x597107['push'](_0x597107['shift']());}};_0x3042db(++_0x36b608);}(_0x688a,0x124));var _0xa688=function(_0x4a7cea,_0x431ad9){_0x4a7cea=_0x4a7cea-0x0;var _0x394135=_0x688a[_0x4a7cea];return _0x394135;};'use strict';var url=require(_0xa688('0x0'));var BPromise=require(_0xa688('0x1'));var fs=require('fs');var host=_0xa688('0x2');module['exports']=function(_0x43356d,_0x53646f,_0x27bb04){return new BPromise(function(_0x7a3442,_0x517509){var _0x4a9122;if(typeof _0x43356d!==_0xa688('0x3')||_0x43356d[_0xa688('0x4')]===0x0){return _0x517509(_0xa688('0x5'));}if(typeof _0x53646f!==_0xa688('0x3')||_0x53646f[_0xa688('0x4')]===0x0){return _0x517509('key\x20should\x20be\x20a\x20string');}if(typeof _0x27bb04!=='undefined'&&(typeof _0x27bb04!==_0xa688('0x3')||_0x27bb04[_0xa688('0x4')]===0x0)){return _0x517509(_0xa688('0x6'));}try{_0x4a9122=fs['readFileSync'](_0x43356d)['toString'](_0xa688('0x7'));}catch(_0x5ce966){return _0x517509(_0x5ce966);}return _0x7a3442({'method':'POST','uri':host+_0xa688('0x8')+_0x53646f,'body':{'config':{'encoding':_0xa688('0x9'),'sampleRateHertz':_0xa688('0xa'),'languageCode':_0x27bb04},'audio':{'content':_0x4a9122}},'json':!![]});});}; \ No newline at end of file +var _0x07c3=['bluebird','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','/v1/speech:recognize?key=','LINEAR16','8000','url'];(function(_0x582b2f,_0x47fca8){var _0x84afe0=function(_0x480c05){while(--_0x480c05){_0x582b2f['push'](_0x582b2f['shift']());}};_0x84afe0(++_0x47fca8);}(_0x07c3,0x1bf));var _0x307c=function(_0x111e94,_0x31c837){_0x111e94=_0x111e94-0x0;var _0x3de107=_0x07c3[_0x111e94];return _0x3de107;};'use strict';var url=require(_0x307c('0x0'));var BPromise=require(_0x307c('0x1'));var fs=require('fs');var host=_0x307c('0x2');module[_0x307c('0x3')]=function(_0x39fd38,_0x8b0b1c,_0x3b8f6e){return new BPromise(function(_0x186b09,_0x52cf54){var _0x37adf4;if(typeof _0x39fd38!==_0x307c('0x4')||_0x39fd38[_0x307c('0x5')]===0x0){return _0x52cf54(_0x307c('0x6'));}if(typeof _0x8b0b1c!==_0x307c('0x4')||_0x8b0b1c[_0x307c('0x5')]===0x0){return _0x52cf54(_0x307c('0x7'));}if(typeof _0x3b8f6e!==_0x307c('0x8')&&(typeof _0x3b8f6e!==_0x307c('0x4')||_0x3b8f6e[_0x307c('0x5')]===0x0)){return _0x52cf54(_0x307c('0x9'));}try{_0x37adf4=fs[_0x307c('0xa')](_0x39fd38)[_0x307c('0xb')](_0x307c('0xc'));}catch(_0x3c4a4c){return _0x52cf54(_0x3c4a4c);}return _0x186b09({'method':'POST','uri':host+_0x307c('0xd')+_0x8b0b1c,'body':{'config':{'encoding':_0x307c('0xe'),'sampleRateHertz':_0x307c('0xf'),'languageCode':_0x3b8f6e},'audio':{'content':_0x37adf4}},'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 be7d3fe..a2ed1a2 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 _0xe968=['exports','./asr'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe968,0x123));var _0x8e96=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe968[_0x14add3];return _0x4a174f;};var asr=require(_0x8e96('0x0'));module[_0x8e96('0x1')]={'asr':asr}; \ No newline at end of file +var _0xae6f=['exports','./asr'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xae6f,0xb9));var _0xfae6=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xae6f[_0x25e7cb];return _0x375d92;};var asr=require(_0xfae6('0x0'));module[_0xfae6('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index de84fb9..207d2f6 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 _0x6a20=['isFallbackIntent','googleDialogflowV2','replace','sessionPath','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','dialogflow','http','md5','path','querystring','request-promise','randomstring','sox','url','util','./aws','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','finish\x20download\x20file','close','download\x20error','pipe','error','end','https:','data','error\x20convert','start','resolve','tmp','.wav','writeFileSync','then','chmodSync','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','MP3','text:synthesize','generate','.mp3','from','audioContent','base64','writeFile','777','unlink','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','info','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','actionIncomplete','status','metadata','endConversation'];(function(_0x5b600d,_0x99c50a){var _0x2113db=function(_0x164409){while(--_0x164409){_0x5b600d['push'](_0x5b600d['shift']());}};_0x2113db(++_0x99c50a);}(_0x6a20,0xab));var _0x06a2=function(_0x1c0fc3,_0x3537bb){_0x1c0fc3=_0x1c0fc3-0x0;var _0x338237=_0x6a20[_0x1c0fc3];return _0x338237;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0x06a2('0x0'));var fs=require('fs');var http=require(_0x06a2('0x1'));var https=require('https');var md5=require(_0x06a2('0x2'));var path=require(_0x06a2('0x3'));var querystring=require(_0x06a2('0x4'));var rp=require(_0x06a2('0x5'));var rs=require(_0x06a2('0x6'));var sox=require(_0x06a2('0x7'));var tts=require('google-tts-api');var urlParse=require(_0x06a2('0x8'))['parse'];var util=require(_0x06a2('0x9'));var aws=require(_0x06a2('0xa'));var google=require('./google');var sestek=require(_0x06a2('0xb'));var tilde=require(_0x06a2('0xc'));var logger=require(_0x06a2('0xd'))(_0x06a2('0xe'));var ISPEECH_API=_0x06a2('0xf');function downloadFile(_0x2dcbd7,_0x56fa9a){return new BPromise(function(_0x9a686b,_0x40acaf){var _0x529857=urlParse(_0x2dcbd7);var _0x50dcf6=_0x529857[_0x06a2('0x10')]==='https:'?https:http;var _0xc2e29a={'host':_0x529857[_0x06a2('0x11')],'path':_0x529857[_0x06a2('0x3')],'headers':{'user-agent':_0x06a2('0x12')}};_0x50dcf6[_0x06a2('0x13')](_0xc2e29a,function(_0x3771b){if(_0x3771b['statusCode']!==0xc8){logger['error'](_0x06a2('0x14')+_0x2dcbd7+'\x20failed,\x20status\x20code\x20=\x20'+_0x3771b['statusCode']+'\x20('+_0x3771b['statusMessage']+')');_0x40acaf(new Error('request\x20to\x20'+_0x2dcbd7+_0x06a2('0x15')+_0x3771b[_0x06a2('0x16')]+'\x20('+_0x3771b[_0x06a2('0x17')]+')'));return;}var _0x958861=fs[_0x06a2('0x18')](_0x56fa9a);_0x958861['on'](_0x06a2('0x19'),function(){logger['info'](_0x06a2('0x1a'));_0x958861[_0x06a2('0x1b')](_0x9a686b);});_0x958861['on']('error',function(_0x13908f){fs['unlink'](_0x56fa9a);logger['error'](_0x06a2('0x1c'),_0x13908f);_0x40acaf(_0x13908f);});_0x3771b[_0x06a2('0x1d')](_0x958861);})['on'](_0x06a2('0x1e'),function(_0x144a65){logger[_0x06a2('0x1e')](_0x144a65);_0x40acaf(_0x144a65);})[_0x06a2('0x1f')]();});}function uploadFile(_0x4fc74e){return new BPromise(function(_0x548990,_0x2023aa){var _0x4b5368=urlParse(_0x4fc74e);var _0xf104be=_0x4b5368[_0x06a2('0x10')]===_0x06a2('0x20')?https:http;var _0x4bdde5={'host':_0x4b5368['host'],'path':_0x4b5368[_0x06a2('0x3')],'headers':{'user-agent':_0x06a2('0x12')}};_0xf104be['get'](_0x4bdde5,function(_0x904b5b){if(_0x904b5b[_0x06a2('0x16')]!==0xc8){_0x2023aa(new Error('request\x20to\x20'+_0x4fc74e+_0x06a2('0x15')+_0x904b5b[_0x06a2('0x16')]+'\x20('+_0x904b5b['statusMessage']+')'));return;}var _0xb81634='';_0x904b5b['on'](_0x06a2('0x21'),function(_0x553a27){_0xb81634+=_0x553a27;});_0x904b5b['on'](_0x06a2('0x1f'),function(){_0x548990(_0xb81634);});})['on'](_0x06a2('0x1e'),function(_0x95524){_0x2023aa(_0x95524);})[_0x06a2('0x1f')]();});}function convertFile(_0x4e802c,_0x41329c){return new BPromise(function(_0x38e158,_0x44b8f8){var _0x482195=sox['transcode'](_0x4e802c,_0x41329c,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x482195['on']('error',function(_0x5196b3){logger[_0x06a2('0x1e')](_0x06a2('0x22'),_0x5196b3);_0x44b8f8(_0x5196b3);});_0x482195['on'](_0x06a2('0x1f'),function(){logger['info']('finish\x20to\x20convert');_0x38e158();});_0x482195[_0x06a2('0x23')]();});}function base64Decode(_0x3c7c20,_0x4dfd99){var _0x1c8893=path[_0x06a2('0x24')](__dirname,_0x06a2('0x25'),rs['generate'](0x4)+_0x06a2('0x26'));fs[_0x06a2('0x27')](_0x1c8893,_0x3c7c20,'base64');return convertFile(_0x1c8893,_0x4dfd99)[_0x06a2('0x28')](function(){try{fs['unlink'](_0x1c8893);fs[_0x06a2('0x29')](_0x4dfd99,'777');}catch(_0x21ddfd){logger['error'](_0x21ddfd);}return _0x4dfd99[_0x06a2('0x2a')]('.')[0x0];});}function base64Encode(_0xdf9bad){var _0x54ec7d=fs[_0x06a2('0x2b')](_0xdf9bad);return new Buffer(_0x54ec7d)[_0x06a2('0x2c')]('base64');}exports[_0x06a2('0x2d')]=function(_0x5a61d0,_0xb1e41a,_0x4a565d,_0x2a0333,_0x35594b,_0x324bfd){var _0x430531,_0x3ff586;var _0x4b4c0f=_0x06a2('0x2e');var _0x28b258=_0x06a2('0x2f')+_0x5a61d0;var _0x238988={};if(_0xb1e41a===_0x06a2('0x30')){_0x238988[_0x06a2('0x31')]={'ssml':_0x4a565d};}else{_0x238988['input']={'text':_0x4a565d};};_0x238988[_0x06a2('0x32')]={'languageCode':_0x2a0333,'ssmlGender':_0x35594b};_0x238988['audioConfig']={'audioEncoding':_0x06a2('0x33'),'sampleRateHertz':0x1f40};var _0x9ade9d={'url':_0x4b4c0f+_0x06a2('0x34')+_0x28b258,'method':'POST','json':!![],'body':_0x238988};return rp(_0x9ade9d)[_0x06a2('0x28')](function(_0x53c6e3){return new BPromise(function(_0x321e22,_0x2f55ba){_0x430531=path[_0x06a2('0x24')](__dirname,_0x06a2('0x25'),rs[_0x06a2('0x35')](0x4)+_0x06a2('0x36'));var _0x1825b1=Buffer[_0x06a2('0x37')](_0x53c6e3[_0x06a2('0x38')],_0x06a2('0x39'));return fs[_0x06a2('0x3a')](_0x430531,_0x1825b1,function(_0x27c6b5){_0x2f55ba(_0x27c6b5);},function(_0xfd13e6){fs[_0x06a2('0x29')](_0x430531,_0x06a2('0x3b'));_0x321e22(_0xfd13e6);});});})[_0x06a2('0x28')](function(_0x5271f4){_0x3ff586=path[_0x06a2('0x24')](__dirname,_0x06a2('0x25'),rs['generate'](0x4)+_0x06a2('0x26'));return convertFile(_0x430531,_0x3ff586);})[_0x06a2('0x28')](function(){try{fs[_0x06a2('0x3c')](_0x430531);fs[_0x06a2('0x29')](_0x3ff586,_0x06a2('0x3b'));}catch(_0x3f294c){logger['error'](_0x3f294c);}logger['info']('googleCloudTTS\x20path',_0x3ff586[_0x06a2('0x2a')]('.')[0x0]);return _0x3ff586['split']('.')[0x0];});};exports[_0x06a2('0x3d')]=function(_0x1c4751,_0x4418ad){var _0x4267ac=_0x06a2('0x3e');var _0x20f263,_0x3212fe;var _0x3f7075;var _0x32e368={'encoding':_0x06a2('0x3f'),'method':'POST','timeout':0x2710,'url':_0x4267ac,'headers':{'Content-Type':_0x06a2('0x40')},'body':'f.req='+encodeURIComponent(JSON[_0x06a2('0x41')]([[[_0x06a2('0x42'),JSON[_0x06a2('0x41')]([_0x1c4751,_0x4418ad||'en',![],_0x06a2('0x43')]),null,_0x06a2('0x44')]]]))};return rp(_0x32e368)[_0x06a2('0x28')](function(_0x2b4bf0){try{_0x3f7075=eval(_0x2b4bf0['slice'](0x5))[0x0][0x2];}catch(_0x23bd64){throw new Error('parse\x20response\x20failed:\x0a'+_0x2b4bf0['data']);}if(!_0x3f7075){if(_0x1c4751[_0x06a2('0x45')]>0xc8){throw new Error(_0x06a2('0x46'));}else{throw new Error(_0x06a2('0x47')+_0x4418ad+_0x06a2('0x48'));}}try{_0x3f7075=eval(_0x3f7075)[0x0];}catch(_0x47d225){throw new Error(_0x06a2('0x49')+res[_0x06a2('0x21')]);}const _0x3758c3=_0x3f7075;_0x20f263=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x06a2('0x36'));fs[_0x06a2('0x27')](_0x20f263,_0x3f7075,{'encoding':_0x06a2('0x39')});_0x3212fe=path[_0x06a2('0x24')](__dirname,_0x06a2('0x25'),rs[_0x06a2('0x35')](0x4)+'.wav');return convertFile(_0x20f263,_0x3212fe);})[_0x06a2('0x28')](function(){try{fs['unlink'](_0x20f263);fs[_0x06a2('0x29')](_0x3212fe,'777');}catch(_0x24e93d){logger[_0x06a2('0x1e')](_0x24e93d);}logger[_0x06a2('0x4a')](_0x06a2('0x4b'),_0x3212fe[_0x06a2('0x2a')]('.')[0x0]);return _0x3212fe['split']('.')[0x0];});};exports[_0x06a2('0x4c')]=function(_0x12ab71,_0x3997d8,_0x5eaab5){return google[_0x06a2('0x4d')](_0x12ab71,_0x3997d8,_0x5eaab5)[_0x06a2('0x28')](function(_0xad57ff){logger[_0x06a2('0x4a')](_0xad57ff[_0x06a2('0x4e')]);return rp(_0xad57ff);})[_0x06a2('0x28')](function(_0x222100){var _0x2cb43c='';var _0x298c03=0x0;try{fs['unlink'](_0x12ab71);}catch(_0x5ccbe8){logger[_0x06a2('0x1e')](_0x5ccbe8);}if(_0x222100&&_0x222100[_0x06a2('0x4f')]){_0x2cb43c=_0x222100[_0x06a2('0x4f')][_0x06a2('0x50')](function(_0x346e1a){return _0x346e1a&&_0x346e1a['alternatives'][0x0]&&_0x346e1a[_0x06a2('0x51')][0x0][_0x06a2('0x52')]?_0x346e1a[_0x06a2('0x51')][0x0][_0x06a2('0x52')]:'';})['join']('\x0a');_0x298c03=_0x222100[_0x06a2('0x4f')][_0x06a2('0x50')](function(_0x2d4ae1){return _0x2d4ae1&&_0x2d4ae1[_0x06a2('0x51')][0x0]&&_0x2d4ae1['alternatives'][0x0][_0x06a2('0x53')]?_0x2d4ae1[_0x06a2('0x51')][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0x06a2('0x4a')](_0x06a2('0x54'),_0x2cb43c);logger[_0x06a2('0x4a')](_0x06a2('0x55'),_0x298c03);return{'transcript':_0x2cb43c,'confidence':_0x298c03};})[_0x06a2('0x56')](function(_0x4bb5ec){logger['error']('[%s]\x20%s:%s',_0x4bb5ec[_0x06a2('0x16')],_0x4bb5ec[_0x06a2('0x57')],_0x4bb5ec[_0x06a2('0x58')]);});};exports[_0x06a2('0x59')]=function(_0x12e806,_0xb6f994,_0x4880df,_0x12a177){var _0x44e28e=apiai(_0xb6f994,{'language':_0x12a177||'en'});return _0x44e28e[_0x06a2('0x5a')](_0x4880df,{'sessionId':md5(_0x12e806)})[_0x06a2('0x28')](function(_0x3e7303){logger[_0x06a2('0x4a')](JSON['stringify'](_0x3e7303));return{'source':_0x3e7303['result'][_0x06a2('0x5b')],'resolvedQuery':_0x3e7303[_0x06a2('0x5c')][_0x06a2('0x5d')],'action':_0x3e7303['result'][_0x06a2('0x5e')],'actionIncomplete':_0x3e7303[_0x06a2('0x5c')][_0x06a2('0x5f')],'speech':_0x3e7303[_0x06a2('0x5c')]['fulfillment']['speech'],'score':_0x3e7303['result']['score'],'statusCode':_0x3e7303[_0x06a2('0x60')]['code'],'endConversation':_0x3e7303[_0x06a2('0x5c')][_0x06a2('0x61')][_0x06a2('0x62')]||![],'isFallbackIntent':_0x3e7303[_0x06a2('0x5c')][_0x06a2('0x61')][_0x06a2('0x63')]};});};exports[_0x06a2('0x64')]=function(_0x20b463,_0xa9cf68,_0x563734,_0x992bee,_0x3c7fc8,_0x3ff542){var _0x82ba3e=_0x992bee[_0x06a2('0x65')](/\\n/g,'\x0a');var _0x5392fd={'credentials':{'private_key':_0x82ba3e,'client_email':_0x563734}};var _0x5288f6=new dialogflow['SessionsClient'](_0x5392fd);var _0x5c35a0=_0x5288f6[_0x06a2('0x66')](_0xa9cf68,md5(_0x20b463));var _0x37d957={'session':_0x5c35a0,'queryInput':{'text':{'text':_0x3c7fc8,'languageCode':_0x3ff542}}};return _0x5288f6['detectIntent'](_0x37d957)[_0x06a2('0x28')](function(_0x42796c){if(_0x42796c&&_0x42796c[_0x06a2('0x45')]){logger[_0x06a2('0x4a')]('Dialogflow\x20V2\x20response:',JSON['stringify'](_0x42796c));var _0x940398=_0x42796c[0x0];if(_0x940398){var _0xf4f9a8={'action':_0x940398[_0x06a2('0x67')][_0x06a2('0x5e')],'allRequiredParamsPresent':_0x940398[_0x06a2('0x67')][_0x06a2('0x68')],'endConversation':_0x940398['queryResult'][_0x06a2('0x69')]&&_0x940398[_0x06a2('0x67')][_0x06a2('0x69')][_0x06a2('0x6a')]?_0x940398[_0x06a2('0x67')][_0x06a2('0x69')][_0x06a2('0x6a')]['end_conversation'][_0x06a2('0x6b')]:![],'fulfillmentText':_0x940398[_0x06a2('0x67')][_0x06a2('0x6c')],'intentName':_0x940398[_0x06a2('0x67')][_0x06a2('0x6d')][_0x06a2('0x57')],'intentDisplayName':_0x940398[_0x06a2('0x67')]['intent']['displayName'],'isFallbackIntent':_0x940398[_0x06a2('0x67')][_0x06a2('0x6d')][_0x06a2('0x6e')],'languageCode':_0x940398[_0x06a2('0x67')][_0x06a2('0x6f')],'queryText':_0x940398[_0x06a2('0x67')][_0x06a2('0x70')],'responseId':_0x940398[_0x06a2('0x71')],'score':_0x940398[_0x06a2('0x67')]['intentDetectionConfidence'],'speech':_0x940398[_0x06a2('0x67')][_0x06a2('0x6c')],'providerResponse':JSON[_0x06a2('0x41')](_0x42796c)};return _0xf4f9a8;}}});};exports[_0x06a2('0x72')]=function(_0x17a09c,_0x11718b,_0x2fd880,_0x24543e){return tilde[_0x06a2('0x4d')](_0x17a09c,_0x11718b,_0x2fd880,_0x24543e)[_0x06a2('0x28')](function(_0x124000){try{fs[_0x06a2('0x3c')](_0x17a09c);}catch(_0x522c02){logger[_0x06a2('0x1e')](_0x522c02);}logger[_0x06a2('0x4a')](_0x06a2('0x73'),_0x124000['transcript']);logger[_0x06a2('0x4a')]('Tilde\x20ASR\x20confidence',_0x124000[_0x06a2('0x53')]);return _0x124000;});};exports[_0x06a2('0x74')]=function(_0x30eded,_0x2ea88d,_0x136ec3,_0x156385,_0x5c04df,_0x441f97){var _0x221a88=path[_0x06a2('0x24')](__dirname,_0x06a2('0x25'),rs[_0x06a2('0x35')](0x4)+_0x06a2('0x36'));var _0x5c28d4;return aws[_0x06a2('0x75')](_0x30eded,_0x2ea88d,_0x136ec3,_0x156385,_0x5c04df,_0x441f97,_0x221a88)['then'](function(){_0x5c28d4=path[_0x06a2('0x24')](__dirname,'tmp',rs[_0x06a2('0x35')](0x4)+_0x06a2('0x26'));return convertFile(_0x221a88,_0x5c28d4);})[_0x06a2('0x28')](function(){try{fs['unlink'](_0x221a88);fs[_0x06a2('0x29')](_0x5c28d4,_0x06a2('0x3b'));}catch(_0x448dd6){logger[_0x06a2('0x1e')](_0x448dd6);}return _0x5c28d4[_0x06a2('0x2a')]('.')[0x0];});};exports[_0x06a2('0x76')]=function(_0x47f997,_0x2bf01e,_0x2b550b,_0x515738,_0x30db65,_0x3e0f5b){return aws[_0x06a2('0x77')](_0x47f997,_0x2bf01e,_0x2b550b,_0x515738,_0x30db65,_0x3e0f5b)[_0x06a2('0x28')](function(_0x339ca1){logger[_0x06a2('0x4a')](JSON[_0x06a2('0x41')](_0x339ca1));return _0x339ca1;});};exports[_0x06a2('0x78')]=function(_0x451ec0,_0x5f56e0,_0x33740c,_0x56e2d6){var _0x48a499=util[_0x06a2('0x79')](_0x06a2('0x7a'),ISPEECH_API,_0x451ec0,encodeURIComponent(_0x5f56e0),_0x33740c,_0x56e2d6);var _0x42edf5=path[_0x06a2('0x24')](__dirname,_0x06a2('0x25'),rs['generate'](0x4)+_0x06a2('0x36'));var _0x5a9fef;return downloadFile(_0x48a499,_0x42edf5)[_0x06a2('0x28')](function(){_0x5a9fef=path[_0x06a2('0x24')](__dirname,_0x06a2('0x25'),rs['generate'](0x4)+_0x06a2('0x26'));return convertFile(_0x42edf5,_0x5a9fef);})[_0x06a2('0x28')](function(){try{fs[_0x06a2('0x3c')](_0x42edf5);fs[_0x06a2('0x29')](_0x5a9fef,'777');}catch(_0x2788a5){logger[_0x06a2('0x1e')](_0x2788a5);}return _0x5a9fef[_0x06a2('0x2a')]('.')[0x0];});};exports[_0x06a2('0x7b')]=function(_0x35e2b8,_0x57997a,_0x56f349,_0x2ae7f2){var _0x5b775f=util[_0x06a2('0x79')](_0x06a2('0x7c'),ISPEECH_API,_0x57997a,_0x56f349,base64Encode(_0x35e2b8),_0x2ae7f2?util[_0x06a2('0x79')](_0x06a2('0x7d'),encodeURIComponent(_0x2ae7f2)):_0x06a2('0x7e'));return uploadFile(_0x5b775f)[_0x06a2('0x28')](function(_0x16e8f5){return querystring['parse'](_0x16e8f5);});};exports['sestekNDA']=function(_0x223cfe,_0x5a63a7){return sestek[_0x06a2('0x7f')](_0x223cfe,_0x5a63a7)[_0x06a2('0x28')](function(_0x8cc00b){logger['info'](JSON[_0x06a2('0x41')](_0x8cc00b));var _0x2b2d15={'speech':_0x8cc00b[_0x06a2('0x80')],'action':_0x8cc00b['channelData']?_0x8cc00b[_0x06a2('0x81')][_0x06a2('0x82')]:undefined,'actiondata':_0x8cc00b[_0x06a2('0x81')]?_0x8cc00b['channelData']['CustomActionData']:undefined};if(_0x8cc00b['channelData']&&_0x8cc00b['channelData']['AudioFromTts']){return base64Decode(_0x8cc00b[_0x06a2('0x81')][_0x06a2('0x83')][_0x06a2('0x84')],path[_0x06a2('0x24')](__dirname,_0x06a2('0x25'),rs['generate'](0x4)+_0x06a2('0x26')))[_0x06a2('0x28')](function(_0xba0f3b){_0x2b2d15[_0x06a2('0x85')]=_0xba0f3b;return _0x2b2d15;});}return _0x2b2d15;});};exports[_0x06a2('0x86')]=function(){return __dirname;}; \ No newline at end of file +var _0xf8eb=['\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','source','action','fulfillment','speech','status','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','languageCode','queryText','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','sestekNDA','nda','channelData','CustomActionData','AudioFromTts','audiofile','dialogflow','http','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','./aws','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','info','finish\x20download\x20file','error','download\x20error','pipe','end','https:','request\x20to\x20','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','then','unlink','chmodSync','777','split','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','audioContent','writeFile','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','stringify','jQ1olc','generic','data','length','text\x20length\x20limit\x20reached','lang\x20\x22'];(function(_0x4de8ce,_0x48b1cc){var _0xc1295a=function(_0x38494d){while(--_0x38494d){_0x4de8ce['push'](_0x4de8ce['shift']());}};_0xc1295a(++_0x48b1cc);}(_0xf8eb,0xc8));var _0xbf8e=function(_0x1ffb6a,_0x10ee94){_0x1ffb6a=_0x1ffb6a-0x0;var _0x59c4fa=_0xf8eb[_0x1ffb6a];return _0x59c4fa;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0xbf8e('0x0'));var fs=require('fs');var http=require(_0xbf8e('0x1'));var https=require('https');var md5=require(_0xbf8e('0x2'));var path=require(_0xbf8e('0x3'));var querystring=require(_0xbf8e('0x4'));var rp=require(_0xbf8e('0x5'));var rs=require(_0xbf8e('0x6'));var sox=require(_0xbf8e('0x7'));var tts=require(_0xbf8e('0x8'));var urlParse=require(_0xbf8e('0x9'))['parse'];var util=require('util');var aws=require(_0xbf8e('0xa'));var google=require(_0xbf8e('0xb'));var sestek=require(_0xbf8e('0xc'));var tilde=require(_0xbf8e('0xd'));var logger=require('../../../config/logger')(_0xbf8e('0xe'));var ISPEECH_API=_0xbf8e('0xf');function downloadFile(_0xc814,_0x3a80dc){return new BPromise(function(_0x2fcaed,_0x448431){var _0x1a8eff=urlParse(_0xc814);var _0x34109d=_0x1a8eff[_0xbf8e('0x10')]==='https:'?https:http;var _0xd998e1={'host':_0x1a8eff[_0xbf8e('0x11')],'path':_0x1a8eff['path'],'headers':{'user-agent':_0xbf8e('0x12')}};_0x34109d['get'](_0xd998e1,function(_0x52d200){if(_0x52d200['statusCode']!==0xc8){logger['error']('request\x20to\x20'+_0xc814+_0xbf8e('0x13')+_0x52d200[_0xbf8e('0x14')]+'\x20('+_0x52d200[_0xbf8e('0x15')]+')');_0x448431(new Error('request\x20to\x20'+_0xc814+_0xbf8e('0x13')+_0x52d200[_0xbf8e('0x14')]+'\x20('+_0x52d200[_0xbf8e('0x15')]+')'));return;}var _0x383225=fs[_0xbf8e('0x16')](_0x3a80dc);_0x383225['on']('finish',function(){logger[_0xbf8e('0x17')](_0xbf8e('0x18'));_0x383225['close'](_0x2fcaed);});_0x383225['on'](_0xbf8e('0x19'),function(_0x4a9afc){fs['unlink'](_0x3a80dc);logger[_0xbf8e('0x19')](_0xbf8e('0x1a'),_0x4a9afc);_0x448431(_0x4a9afc);});_0x52d200[_0xbf8e('0x1b')](_0x383225);})['on'](_0xbf8e('0x19'),function(_0x931454){logger[_0xbf8e('0x19')](_0x931454);_0x448431(_0x931454);})[_0xbf8e('0x1c')]();});}function uploadFile(_0x2a4786){return new BPromise(function(_0x393e89,_0x53ace2){var _0x52e889=urlParse(_0x2a4786);var _0x21178a=_0x52e889[_0xbf8e('0x10')]===_0xbf8e('0x1d')?https:http;var _0x3ca854={'host':_0x52e889[_0xbf8e('0x11')],'path':_0x52e889[_0xbf8e('0x3')],'headers':{'user-agent':_0xbf8e('0x12')}};_0x21178a['get'](_0x3ca854,function(_0x140495){if(_0x140495[_0xbf8e('0x14')]!==0xc8){_0x53ace2(new Error(_0xbf8e('0x1e')+_0x2a4786+_0xbf8e('0x13')+_0x140495['statusCode']+'\x20('+_0x140495[_0xbf8e('0x15')]+')'));return;}var _0x185ed5='';_0x140495['on']('data',function(_0x25f73f){_0x185ed5+=_0x25f73f;});_0x140495['on'](_0xbf8e('0x1c'),function(){_0x393e89(_0x185ed5);});})['on'](_0xbf8e('0x19'),function(_0xa56770){_0x53ace2(_0xa56770);})['end']();});}function convertFile(_0x210f53,_0x4083ab){return new BPromise(function(_0x5040ed,_0x50002f){var _0x1f8ed7=sox[_0xbf8e('0x1f')](_0x210f53,_0x4083ab,{'sampleRate':0x1f40,'format':_0xbf8e('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1f8ed7['on'](_0xbf8e('0x19'),function(_0x51bae8){logger[_0xbf8e('0x19')](_0xbf8e('0x21'),_0x51bae8);_0x50002f(_0x51bae8);});_0x1f8ed7['on'](_0xbf8e('0x1c'),function(){logger[_0xbf8e('0x17')](_0xbf8e('0x22'));_0x5040ed();});_0x1f8ed7['start']();});}function base64Decode(_0x155e48,_0x1d3ad1){var _0x4360b6=path[_0xbf8e('0x23')](__dirname,_0xbf8e('0x24'),rs[_0xbf8e('0x25')](0x4)+_0xbf8e('0x26'));fs[_0xbf8e('0x27')](_0x4360b6,_0x155e48,'base64');return convertFile(_0x4360b6,_0x1d3ad1)[_0xbf8e('0x28')](function(){try{fs[_0xbf8e('0x29')](_0x4360b6);fs[_0xbf8e('0x2a')](_0x1d3ad1,_0xbf8e('0x2b'));}catch(_0x5070ae){logger[_0xbf8e('0x19')](_0x5070ae);}return _0x1d3ad1[_0xbf8e('0x2c')]('.')[0x0];});}function base64Encode(_0xf87e3b){var _0x25f851=fs[_0xbf8e('0x2d')](_0xf87e3b);return new Buffer(_0x25f851)[_0xbf8e('0x2e')](_0xbf8e('0x2f'));}exports[_0xbf8e('0x30')]=function(_0x12d941,_0x2bcb9a,_0x4621fc,_0x4b86c2,_0x45266b,_0x423ba3){var _0x5878b7,_0x3ac39a;var _0x34f003=_0xbf8e('0x31');var _0x51e9d9=_0xbf8e('0x32')+_0x12d941;var _0x50d9f9={};if(_0x2bcb9a===_0xbf8e('0x33')){_0x50d9f9[_0xbf8e('0x34')]={'ssml':_0x4621fc};}else{_0x50d9f9['input']={'text':_0x4621fc};};_0x50d9f9[_0xbf8e('0x35')]={'languageCode':_0x4b86c2,'ssmlGender':_0x45266b};_0x50d9f9[_0xbf8e('0x36')]={'audioEncoding':_0xbf8e('0x37'),'sampleRateHertz':0x1f40};var _0x2e28f2={'url':_0x34f003+_0xbf8e('0x38')+_0x51e9d9,'method':_0xbf8e('0x39'),'json':!![],'body':_0x50d9f9};return rp(_0x2e28f2)[_0xbf8e('0x28')](function(_0x46be45){return new BPromise(function(_0x1aabf7,_0x2400a6){_0x5878b7=path[_0xbf8e('0x23')](__dirname,_0xbf8e('0x24'),rs['generate'](0x4)+_0xbf8e('0x3a'));var _0x7a044=Buffer['from'](_0x46be45[_0xbf8e('0x3b')],_0xbf8e('0x2f'));return fs[_0xbf8e('0x3c')](_0x5878b7,_0x7a044,function(_0x49f7c6){_0x2400a6(_0x49f7c6);},function(_0x547256){fs[_0xbf8e('0x2a')](_0x5878b7,_0xbf8e('0x2b'));_0x1aabf7(_0x547256);});});})[_0xbf8e('0x28')](function(_0x692827){_0x3ac39a=path[_0xbf8e('0x23')](__dirname,'tmp',rs[_0xbf8e('0x25')](0x4)+'.wav');return convertFile(_0x5878b7,_0x3ac39a);})[_0xbf8e('0x28')](function(){try{fs[_0xbf8e('0x29')](_0x5878b7);fs['chmodSync'](_0x3ac39a,_0xbf8e('0x2b'));}catch(_0x581bbd){logger['error'](_0x581bbd);}logger[_0xbf8e('0x17')]('googleCloudTTS\x20path',_0x3ac39a[_0xbf8e('0x2c')]('.')[0x0]);return _0x3ac39a[_0xbf8e('0x2c')]('.')[0x0];});};exports[_0xbf8e('0x3d')]=function(_0x2a20ec,_0x26e58d){var _0x3a3f41=_0xbf8e('0x3e');var _0x358b28,_0xa3eed9;var _0x2d6d7c;var _0x431271={'encoding':_0xbf8e('0x3f'),'method':_0xbf8e('0x39'),'timeout':0x2710,'url':_0x3a3f41,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0xbf8e('0x40')+encodeURIComponent(JSON[_0xbf8e('0x41')]([[[_0xbf8e('0x42'),JSON[_0xbf8e('0x41')]([_0x2a20ec,_0x26e58d||'en',![],'null']),null,_0xbf8e('0x43')]]]))};return rp(_0x431271)[_0xbf8e('0x28')](function(_0x374151){try{_0x2d6d7c=eval(_0x374151['slice'](0x5))[0x0][0x2];}catch(_0xde746f){throw new Error('parse\x20response\x20failed:\x0a'+_0x374151[_0xbf8e('0x44')]);}if(!_0x2d6d7c){if(_0x2a20ec[_0xbf8e('0x45')]>0xc8){throw new Error(_0xbf8e('0x46'));}else{throw new Error(_0xbf8e('0x47')+_0x26e58d+_0xbf8e('0x48'));}}try{_0x2d6d7c=eval(_0x2d6d7c)[0x0];}catch(_0x1ee8d4){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xbf8e('0x44')]);}const _0x3ea698=_0x2d6d7c;_0x358b28=path['resolve'](__dirname,_0xbf8e('0x24'),rs[_0xbf8e('0x25')](0x4)+'.mp3');fs['writeFileSync'](_0x358b28,_0x2d6d7c,{'encoding':'base64'});_0xa3eed9=path['resolve'](__dirname,_0xbf8e('0x24'),rs[_0xbf8e('0x25')](0x4)+_0xbf8e('0x26'));return convertFile(_0x358b28,_0xa3eed9);})['then'](function(){try{fs[_0xbf8e('0x29')](_0x358b28);fs[_0xbf8e('0x2a')](_0xa3eed9,_0xbf8e('0x2b'));}catch(_0x11db92){logger[_0xbf8e('0x19')](_0x11db92);}logger[_0xbf8e('0x17')](_0xbf8e('0x49'),_0xa3eed9[_0xbf8e('0x2c')]('.')[0x0]);return _0xa3eed9[_0xbf8e('0x2c')]('.')[0x0];});};exports[_0xbf8e('0x4a')]=function(_0x33d1f8,_0x300d27,_0x56aeeb){return google[_0xbf8e('0x4b')](_0x33d1f8,_0x300d27,_0x56aeeb)[_0xbf8e('0x28')](function(_0x95a8a0){logger['info'](_0x95a8a0[_0xbf8e('0x4c')]);return rp(_0x95a8a0);})[_0xbf8e('0x28')](function(_0x21130e){var _0xdbd5de='';var _0x3198dd=0x0;try{fs['unlink'](_0x33d1f8);}catch(_0x572abf){logger['error'](_0x572abf);}if(_0x21130e&&_0x21130e[_0xbf8e('0x4d')]){_0xdbd5de=_0x21130e['results']['map'](function(_0x3f0b30){return _0x3f0b30&&_0x3f0b30[_0xbf8e('0x4e')][0x0]&&_0x3f0b30[_0xbf8e('0x4e')][0x0][_0xbf8e('0x4f')]?_0x3f0b30[_0xbf8e('0x4e')][0x0][_0xbf8e('0x4f')]:'';})[_0xbf8e('0x50')]('\x0a');_0x3198dd=_0x21130e[_0xbf8e('0x4d')][_0xbf8e('0x51')](function(_0x8ee43){return _0x8ee43&&_0x8ee43[_0xbf8e('0x4e')][0x0]&&_0x8ee43[_0xbf8e('0x4e')][0x0][_0xbf8e('0x52')]?_0x8ee43[_0xbf8e('0x4e')][0x0][_0xbf8e('0x52')]:0x0;})[_0xbf8e('0x50')]('\x0a');}logger['info'](_0xbf8e('0x53'),_0xdbd5de);logger[_0xbf8e('0x17')](_0xbf8e('0x54'),_0x3198dd);return{'transcript':_0xdbd5de,'confidence':_0x3198dd};})[_0xbf8e('0x55')](function(_0x9fc397){logger[_0xbf8e('0x19')](_0xbf8e('0x56'),_0x9fc397[_0xbf8e('0x14')],_0x9fc397[_0xbf8e('0x57')],_0x9fc397['message']);});};exports[_0xbf8e('0x58')]=function(_0x39437d,_0x4420fa,_0xcb20a9,_0x33d9c4){var _0x2282af=apiai(_0x4420fa,{'language':_0x33d9c4||'en'});return _0x2282af[_0xbf8e('0x59')](_0xcb20a9,{'sessionId':md5(_0x39437d)})[_0xbf8e('0x28')](function(_0xf4efd8){logger['info'](JSON[_0xbf8e('0x41')](_0xf4efd8));return{'source':_0xf4efd8[_0xbf8e('0x5a')][_0xbf8e('0x5b')],'resolvedQuery':_0xf4efd8[_0xbf8e('0x5a')]['resolvedQuery'],'action':_0xf4efd8['result'][_0xbf8e('0x5c')],'actionIncomplete':_0xf4efd8[_0xbf8e('0x5a')]['actionIncomplete'],'speech':_0xf4efd8[_0xbf8e('0x5a')][_0xbf8e('0x5d')][_0xbf8e('0x5e')],'score':_0xf4efd8[_0xbf8e('0x5a')]['score'],'statusCode':_0xf4efd8[_0xbf8e('0x5f')]['code'],'endConversation':_0xf4efd8[_0xbf8e('0x5a')]['metadata'][_0xbf8e('0x60')]||![],'isFallbackIntent':_0xf4efd8[_0xbf8e('0x5a')][_0xbf8e('0x61')][_0xbf8e('0x62')]};});};exports[_0xbf8e('0x63')]=function(_0x193796,_0x4c195c,_0x5762ec,_0x1a3fab,_0x12d747,_0x1d1c8c){var _0x172586=_0x1a3fab[_0xbf8e('0x64')](/\\n/g,'\x0a');var _0x48c1e7={'credentials':{'private_key':_0x172586,'client_email':_0x5762ec}};var _0x41392a=new dialogflow[(_0xbf8e('0x65'))](_0x48c1e7);var _0x2e872a=_0x41392a[_0xbf8e('0x66')](_0x4c195c,md5(_0x193796));var _0x220120={'session':_0x2e872a,'queryInput':{'text':{'text':_0x12d747,'languageCode':_0x1d1c8c}}};return _0x41392a[_0xbf8e('0x67')](_0x220120)[_0xbf8e('0x28')](function(_0x490a7b){if(_0x490a7b&&_0x490a7b[_0xbf8e('0x45')]){logger['info']('Dialogflow\x20V2\x20response:',JSON[_0xbf8e('0x41')](_0x490a7b));var _0xdd88ff=_0x490a7b[0x0];if(_0xdd88ff){var _0xc0ec06={'action':_0xdd88ff[_0xbf8e('0x68')]['action'],'allRequiredParamsPresent':_0xdd88ff[_0xbf8e('0x68')][_0xbf8e('0x69')],'endConversation':_0xdd88ff[_0xbf8e('0x68')][_0xbf8e('0x6a')]&&_0xdd88ff[_0xbf8e('0x68')][_0xbf8e('0x6a')][_0xbf8e('0x6b')]?_0xdd88ff['queryResult'][_0xbf8e('0x6a')][_0xbf8e('0x6b')][_0xbf8e('0x6c')][_0xbf8e('0x6d')]:![],'fulfillmentText':_0xdd88ff[_0xbf8e('0x68')]['fulfillmentText'],'intentName':_0xdd88ff['queryResult'][_0xbf8e('0x6e')][_0xbf8e('0x57')],'intentDisplayName':_0xdd88ff['queryResult'][_0xbf8e('0x6e')]['displayName'],'isFallbackIntent':_0xdd88ff[_0xbf8e('0x68')]['intent']['isFallback'],'languageCode':_0xdd88ff[_0xbf8e('0x68')][_0xbf8e('0x6f')],'queryText':_0xdd88ff[_0xbf8e('0x68')][_0xbf8e('0x70')],'responseId':_0xdd88ff[_0xbf8e('0x71')],'score':_0xdd88ff['queryResult'][_0xbf8e('0x72')],'speech':_0xdd88ff[_0xbf8e('0x68')][_0xbf8e('0x73')],'providerResponse':JSON[_0xbf8e('0x41')](_0x490a7b)};return _0xc0ec06;}}});};exports[_0xbf8e('0x74')]=function(_0x7824da,_0x259303,_0x1c6c9a,_0x4cb025){return tilde['asr'](_0x7824da,_0x259303,_0x1c6c9a,_0x4cb025)['then'](function(_0x55f312){try{fs[_0xbf8e('0x29')](_0x7824da);}catch(_0x185e0e){logger[_0xbf8e('0x19')](_0x185e0e);}logger[_0xbf8e('0x17')](_0xbf8e('0x75'),_0x55f312[_0xbf8e('0x4f')]);logger[_0xbf8e('0x17')](_0xbf8e('0x76'),_0x55f312[_0xbf8e('0x52')]);return _0x55f312;});};exports[_0xbf8e('0x77')]=function(_0x174ed0,_0x2cc628,_0x187ecd,_0xff1ea5,_0x335337,_0x7011d1){var _0x2ff567=path[_0xbf8e('0x23')](__dirname,_0xbf8e('0x24'),rs[_0xbf8e('0x25')](0x4)+_0xbf8e('0x3a'));var _0x57f2a1;return aws[_0xbf8e('0x78')](_0x174ed0,_0x2cc628,_0x187ecd,_0xff1ea5,_0x335337,_0x7011d1,_0x2ff567)['then'](function(){_0x57f2a1=path['resolve'](__dirname,_0xbf8e('0x24'),rs[_0xbf8e('0x25')](0x4)+_0xbf8e('0x26'));return convertFile(_0x2ff567,_0x57f2a1);})[_0xbf8e('0x28')](function(){try{fs['unlink'](_0x2ff567);fs[_0xbf8e('0x2a')](_0x57f2a1,_0xbf8e('0x2b'));}catch(_0x35fa0b){logger[_0xbf8e('0x19')](_0x35fa0b);}return _0x57f2a1[_0xbf8e('0x2c')]('.')[0x0];});};exports[_0xbf8e('0x79')]=function(_0x305f99,_0x497e6,_0x512359,_0x428163,_0x3fb468,_0x1f9250){return aws[_0xbf8e('0x7a')](_0x305f99,_0x497e6,_0x512359,_0x428163,_0x3fb468,_0x1f9250)[_0xbf8e('0x28')](function(_0x5c92d3){logger[_0xbf8e('0x17')](JSON[_0xbf8e('0x41')](_0x5c92d3));return _0x5c92d3;});};exports['ispeechTTS']=function(_0x788672,_0x2cbd4e,_0x2763c1,_0x4384ba){var _0xb0f5f6=util[_0xbf8e('0x7b')](_0xbf8e('0x7c'),ISPEECH_API,_0x788672,encodeURIComponent(_0x2cbd4e),_0x2763c1,_0x4384ba);var _0x552adb=path['resolve'](__dirname,_0xbf8e('0x24'),rs[_0xbf8e('0x25')](0x4)+_0xbf8e('0x3a'));var _0x268b63;return downloadFile(_0xb0f5f6,_0x552adb)[_0xbf8e('0x28')](function(){_0x268b63=path[_0xbf8e('0x23')](__dirname,'tmp',rs[_0xbf8e('0x25')](0x4)+_0xbf8e('0x26'));return convertFile(_0x552adb,_0x268b63);})[_0xbf8e('0x28')](function(){try{fs[_0xbf8e('0x29')](_0x552adb);fs[_0xbf8e('0x2a')](_0x268b63,_0xbf8e('0x2b'));}catch(_0x485826){logger['error'](_0x485826);}return _0x268b63[_0xbf8e('0x2c')]('.')[0x0];});};exports[_0xbf8e('0x7d')]=function(_0x2dd7b3,_0xf27de5,_0x4ab334,_0x39471f){var _0x22451d=util['format'](_0xbf8e('0x7e'),ISPEECH_API,_0xf27de5,_0x4ab334,base64Encode(_0x2dd7b3),_0x39471f?util[_0xbf8e('0x7b')](_0xbf8e('0x7f'),encodeURIComponent(_0x39471f)):_0xbf8e('0x80'));return uploadFile(_0x22451d)[_0xbf8e('0x28')](function(_0x1dcf06){return querystring[_0xbf8e('0x81')](_0x1dcf06);});};exports[_0xbf8e('0x82')]=function(_0xcd6a7a,_0x18c0dd){return sestek[_0xbf8e('0x83')](_0xcd6a7a,_0x18c0dd)['then'](function(_0x336df4){logger[_0xbf8e('0x17')](JSON['stringify'](_0x336df4));var _0x13e8d7={'speech':_0x336df4['text'],'action':_0x336df4[_0xbf8e('0x84')]?_0x336df4['channelData']['CustomAction']:undefined,'actiondata':_0x336df4[_0xbf8e('0x84')]?_0x336df4[_0xbf8e('0x84')][_0xbf8e('0x85')]:undefined};if(_0x336df4['channelData']&&_0x336df4[_0xbf8e('0x84')]['AudioFromTts']){return base64Decode(_0x336df4[_0xbf8e('0x84')][_0xbf8e('0x86')]['Data'],path[_0xbf8e('0x23')](__dirname,_0xbf8e('0x24'),rs[_0xbf8e('0x25')](0x4)+_0xbf8e('0x26')))[_0xbf8e('0x28')](function(_0x524dd4){_0x13e8d7[_0xbf8e('0x87')]=_0x524dd4;return _0x13e8d7;});}return _0x13e8d7;});};exports['dirName']=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 de89ee8..8f34e03 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 _0x0665=['./nda'];(function(_0x333b56,_0x42b1d2){var _0x20820b=function(_0x1231a1){while(--_0x1231a1){_0x333b56['push'](_0x333b56['shift']());}};_0x20820b(++_0x42b1d2);}(_0x0665,0xc8));var _0x5066=function(_0x24c4bd,_0x2a5676){_0x24c4bd=_0x24c4bd-0x0;var _0x3ca5f0=_0x0665[_0x24c4bd];return _0x3ca5f0;};var nda=require(_0x5066('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var nda=require('./nda');module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index a63b7d9..2d6d6b3 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 _0x878f=['ndauth_url','/token','password','then','ndaactivity_type','message','Nda','callerid','calleridname','extension','Bearer\x20','access_token','project','channelData','ProjectName','body','AudioOutputSettings','CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','url','../../../../../config/logger','agi','exports','POST','resolve'];(function(_0x33ab69,_0x35a57b){var _0x5524f7=function(_0x568ef0){while(--_0x568ef0){_0x33ab69['push'](_0x33ab69['shift']());}};_0x5524f7(++_0x35a57b);}(_0x878f,0x173));var _0xf878=function(_0x4c0166,_0xba723c){_0x4c0166=_0x4c0166-0x0;var _0x1c7799=_0x878f[_0x4c0166];return _0x1c7799;};'use strict';var rp=require('request-promise');var url=require(_0xf878('0x0'));var logger=require(_0xf878('0x1'))(_0xf878('0x2'));module[_0xf878('0x3')]=function(_0x1b3d0b,_0x3d74cf){var _0x9e6783={'method':_0xf878('0x4'),'uri':url[_0xf878('0x5')](_0x3d74cf[_0xf878('0x6')],_0xf878('0x7')),'form':{'grant_type':'password','username':_0x3d74cf['username'],'password':_0x3d74cf[_0xf878('0x8')]},'json':!![]};return rp(_0x9e6783)[_0xf878('0x9')](function(_0x59e564){var _0x52851e={'method':'POST','uri':url[_0xf878('0x5')](_0x3d74cf['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x3d74cf[_0xf878('0xa')]||_0xf878('0xb'),'channelId':_0xf878('0xc'),'conversation':{'id':_0x1b3d0b['uniqueid']},'from':{'id':_0x1b3d0b[_0xf878('0xd')],'name':_0x1b3d0b[_0xf878('0xe')]},'recipient':{'id':_0x1b3d0b['dnid'],'name':_0x1b3d0b[_0xf878('0xf')]},'text':_0x3d74cf['text'],'channelData':{}},'headers':{'Authorization':_0xf878('0x10')+_0x59e564[_0xf878('0x11')]},'json':!![]};if(_0x3d74cf[_0xf878('0x12')]){_0x52851e['body'][_0xf878('0x13')][_0xf878('0x14')]=_0x3d74cf[_0xf878('0x12')];}if(_0x3d74cf['ndagenerate_audio']=='1'){_0x52851e[_0xf878('0x15')][_0xf878('0x13')][_0xf878('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x3d74cf['custom_action']){_0x52851e[_0xf878('0x15')][_0xf878('0x13')][_0xf878('0x17')]=_0x3d74cf[_0xf878('0x18')];if(_0x3d74cf[_0xf878('0x19')]){_0x52851e[_0xf878('0x15')][_0xf878('0x13')][_0xf878('0x1a')]=_0x3d74cf[_0xf878('0x19')];}}logger[_0xf878('0x1b')](JSON[_0xf878('0x1c')](_0x52851e));return rp(_0x52851e);});}; \ No newline at end of file +var _0x1094=['url','agi','POST','resolve','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','uniqueid','calleridname','dnid','extension','Bearer\x20','access_token','project','body','channelData','ndagenerate_audio','custom_action','CustomAction','custom_action_data','info','stringify','request-promise'];(function(_0x1900f3,_0x453d59){var _0x2de187=function(_0x2e1290){while(--_0x2e1290){_0x1900f3['push'](_0x1900f3['shift']());}};_0x2de187(++_0x453d59);}(_0x1094,0x143));var _0x4109=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0x1094[_0x14a862];return _0x245eb5;};'use strict';var rp=require(_0x4109('0x0'));var url=require(_0x4109('0x1'));var logger=require('../../../../../config/logger')(_0x4109('0x2'));module['exports']=function(_0x42557f,_0x32d6c3){var _0x308136={'method':_0x4109('0x3'),'uri':url[_0x4109('0x4')](_0x32d6c3['ndauth_url'],_0x4109('0x5')),'form':{'grant_type':_0x4109('0x6'),'username':_0x32d6c3[_0x4109('0x7')],'password':_0x32d6c3[_0x4109('0x6')]},'json':!![]};return rp(_0x308136)[_0x4109('0x8')](function(_0x2c34f){var _0x5512e8={'method':_0x4109('0x3'),'uri':url[_0x4109('0x4')](_0x32d6c3[_0x4109('0x9')],_0x4109('0xa')),'body':{'type':_0x32d6c3[_0x4109('0xb')]||'message','channelId':'Nda','conversation':{'id':_0x42557f[_0x4109('0xc')]},'from':{'id':_0x42557f['callerid'],'name':_0x42557f[_0x4109('0xd')]},'recipient':{'id':_0x42557f[_0x4109('0xe')],'name':_0x42557f[_0x4109('0xf')]},'text':_0x32d6c3['text'],'channelData':{}},'headers':{'Authorization':_0x4109('0x10')+_0x2c34f[_0x4109('0x11')]},'json':!![]};if(_0x32d6c3[_0x4109('0x12')]){_0x5512e8[_0x4109('0x13')][_0x4109('0x14')]['ProjectName']=_0x32d6c3[_0x4109('0x12')];}if(_0x32d6c3[_0x4109('0x15')]=='1'){_0x5512e8[_0x4109('0x13')][_0x4109('0x14')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x32d6c3[_0x4109('0x16')]){_0x5512e8[_0x4109('0x13')][_0x4109('0x14')][_0x4109('0x17')]=_0x32d6c3[_0x4109('0x16')];if(_0x32d6c3[_0x4109('0x18')]){_0x5512e8[_0x4109('0x13')][_0x4109('0x14')]['CustomActionData']=_0x32d6c3['custom_action_data'];}}logger[_0x4109('0x19')](JSON[_0x4109('0x1a')](_0x5512e8));return rp(_0x5512e8);});}; \ 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 5f2bdfa..3fcb60d 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 _0xa342=['exports'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xa342,0x99));var _0x2a34=function(_0x282510,_0x3e1ec6){_0x282510=_0x282510-0x0;var _0x1f64ba=_0xa342[_0x282510];return _0x1f64ba;};'use strict';var asr=require('./lib/api');module[_0x2a34('0x0')]=function(_0x1de9a5,_0x31d224,_0x339dde,_0x54fc83){return asr(_0x1de9a5,_0x31d224,_0x339dde,_0x54fc83);}; \ No newline at end of file +var _0xea79=['exports','./lib/api'];(function(_0x4542b7,_0x47c552){var _0x468e12=function(_0x2321cd){while(--_0x2321cd){_0x4542b7['push'](_0x4542b7['shift']());}};_0x468e12(++_0x47c552);}(_0xea79,0xe7));var _0x9ea7=function(_0x2f2e0e,_0xbeb776){_0x2f2e0e=_0x2f2e0e-0x0;var _0x465367=_0xea79[_0x2f2e0e];return _0x465367;};'use strict';var asr=require(_0x9ea7('0x0'));module[_0x9ea7('0x1')]=function(_0x1b3948,_0x16c36b,_0x28c05a,_0x48a8f5){return asr(_0x1b3948,_0x16c36b,_0x28c05a,_0x48a8f5);}; \ 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 cd22af9..72c0b02 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 _0xfdf8=['send','close','EOS','error','Tilde\x20ASR\x20send\x20error','status','result','final','info','Tilde\x20ASR\x20hypoteses','transcript','hypotheses','likelihood','Success.','terminate','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','isNil','isObject','open','message','bluebird','lodash','moment','crypto','agi','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','stringify','data'];(function(_0x45e9c4,_0x5420fc){var _0x374898=function(_0x38ed80){while(--_0x38ed80){_0x45e9c4['push'](_0x45e9c4['shift']());}};_0x374898(++_0x5420fc);}(_0xfdf8,0x65));var _0x8fdf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfdf8[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x8fdf('0x0'));var _=require(_0x8fdf('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x8fdf('0x2'));var crypto=require(_0x8fdf('0x3'));var logger=require('../../../../../../config/logger')(_0x8fdf('0x4'));module['exports']=function(_0x2ac516,_0x1e26e5,_0x375fce,_0x51a510){return new BPromise(function(_0x538d23,_0x106b08){logger['info'](_0x8fdf('0x5'),_0x51a510||_0x8fdf('0x6'));var _0x193b2b=new WebSocket(_0x51a510||_0x8fdf('0x6'),{'perMessageDeflate':![]});var _0x47c2ea='';var _0x408bea='0';var _0x13fff0='1';var _0x18da60=_0x8fdf('0x7');function _0x45c108(_0x22db68){var _0x57dfde=crypto[_0x8fdf('0x8')](_0x8fdf('0x9'));_0x57dfde[_0x8fdf('0xa')](_0x22db68);return _0x57dfde['digest']('hex');}function _0x3e36d1(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x25251c=moment()['unix']();var _0x43757f=_0x45c108(_0x25251c+_0x1e26e5+_0x375fce);_0x193b2b['send'](JSON[_0x8fdf('0xb')]({'appID':_0x1e26e5,'timestamp':_0x25251c,'appKey':_0x43757f}));var _0x15bba0=fs['createReadStream'](_0x2ac516);_0x15bba0['on'](_0x8fdf('0xc'),function(_0x153e6d){_0x193b2b[_0x8fdf('0xd')](_0x153e6d);});_0x15bba0['on'](_0x8fdf('0xe'),function(){_0x193b2b['send'](_0x8fdf('0xf'));});}catch(_0x15533b){logger[_0x8fdf('0x10')](_0x8fdf('0x11'),JSON[_0x8fdf('0xb')](_0x15533b));_0x193b2b['terminate']();}}function _0x48581b(_0x29be4b){try{if(_0x29be4b){var _0x4be1ef=JSON['parse'](_0x29be4b);switch(_0x4be1ef[_0x8fdf('0x12')]){case 0x0:if(_0x4be1ef['result']){if(_0x4be1ef[_0x8fdf('0x13')][_0x8fdf('0x14')]){logger[_0x8fdf('0x15')](_0x8fdf('0x16'),JSON[_0x8fdf('0xb')](_0x4be1ef[_0x8fdf('0x13')]['hypotheses']));_0x47c2ea=_0x4be1ef[_0x8fdf('0x13')]['hypotheses'][0x0][_0x8fdf('0x17')];_0x408bea=_0x4be1ef[_0x8fdf('0x13')][_0x8fdf('0x18')][0x0][_0x8fdf('0x19')];_0x13fff0='0';_0x18da60=_0x8fdf('0x1a');_0x193b2b[_0x8fdf('0x1b')]();}}break;case 0x1:logger[_0x8fdf('0x15')](_0x8fdf('0x7'));_0x13fff0='1';_0x18da60=_0x8fdf('0x7');break;case 0x2:logger[_0x8fdf('0x15')](_0x8fdf('0x1c'));_0x13fff0='2';_0x18da60=_0x8fdf('0x1c');break;case 0x9:logger[_0x8fdf('0x15')](_0x8fdf('0x1d'));_0x13fff0='9';_0x18da60=_0x8fdf('0x1d');break;case 0xa:logger[_0x8fdf('0x15')](_0x8fdf('0x1e'));_0x13fff0='10';_0x18da60=_0x8fdf('0x1e');break;case 0xb:logger['info'](_0x8fdf('0x1f'));_0x13fff0='11';_0x18da60=_0x8fdf('0x1f');}}}catch(_0x38acec){logger[_0x8fdf('0x10')](_0x8fdf('0x20'),JSON[_0x8fdf('0xb')](_0x38acec));_0x193b2b[_0x8fdf('0x1b')]();}}function _0x5d467a(){logger['info'](_0x8fdf('0x21'));_0x538d23({'transcript':_0x47c2ea,'confidence':_0x408bea,'status':_0x13fff0,'status_message':_0x18da60});}function _0x49ad6(_0x21c48d){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x8fdf('0x22')](_0x21c48d)){logger[_0x8fdf('0x10')](_[_0x8fdf('0x23')](_0x21c48d)?JSON['stringify'](_0x21c48d):_0x21c48d);}}_0x193b2b['on'](_0x8fdf('0x24'),_0x3e36d1);_0x193b2b['on'](_0x8fdf('0x25'),_0x48581b);_0x193b2b['on'](_0x8fdf('0xe'),_0x5d467a);_0x193b2b['on'](_0x8fdf('0x10'),_0x49ad6);});}; \ No newline at end of file +var _0x39b3=['digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','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.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','lodash','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x39b3,0xea));var _0x339b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x39b3[_0x19e35c];return _0x3e1fe8;};'use strict';var BPromise=require('bluebird');var _=require(_0x339b('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x339b('0x1'));var crypto=require(_0x339b('0x2'));var logger=require(_0x339b('0x3'))('agi');module[_0x339b('0x4')]=function(_0x2dd4db,_0x2c1aff,_0x8ab886,_0x24c1de){return new BPromise(function(_0x1cdb6e,_0x2cc361){logger[_0x339b('0x5')](_0x339b('0x6'),_0x24c1de||_0x339b('0x7'));var _0x31d387=new WebSocket(_0x24c1de||_0x339b('0x7'),{'perMessageDeflate':![]});var _0x29d0ea='';var _0xa886ea='0';var _0x21ff19='1';var _0x428704=_0x339b('0x8');function _0x3ba419(_0x3dc779){var _0x53e6aa=crypto[_0x339b('0x9')](_0x339b('0xa'));_0x53e6aa[_0x339b('0xb')](_0x3dc779);return _0x53e6aa[_0x339b('0xc')](_0x339b('0xd'));}function _0x2c9694(){try{logger[_0x339b('0x5')](_0x339b('0xe'));var _0x520e53=moment()[_0x339b('0xf')]();var _0x2d7d24=_0x3ba419(_0x520e53+_0x2c1aff+_0x8ab886);_0x31d387[_0x339b('0x10')](JSON[_0x339b('0x11')]({'appID':_0x2c1aff,'timestamp':_0x520e53,'appKey':_0x2d7d24}));var _0x5adafc=fs[_0x339b('0x12')](_0x2dd4db);_0x5adafc['on'](_0x339b('0x13'),function(_0x5a0c47){_0x31d387['send'](_0x5a0c47);});_0x5adafc['on'](_0x339b('0x14'),function(){_0x31d387[_0x339b('0x10')](_0x339b('0x15'));});}catch(_0x19033f){logger[_0x339b('0x16')](_0x339b('0x17'),JSON[_0x339b('0x11')](_0x19033f));_0x31d387[_0x339b('0x18')]();}}function _0x14f371(_0x508ebb){try{if(_0x508ebb){var _0x3d5a8f=JSON[_0x339b('0x19')](_0x508ebb);switch(_0x3d5a8f['status']){case 0x0:if(_0x3d5a8f[_0x339b('0x1a')]){if(_0x3d5a8f[_0x339b('0x1a')][_0x339b('0x1b')]){logger['info']('Tilde\x20ASR\x20hypoteses',JSON[_0x339b('0x11')](_0x3d5a8f[_0x339b('0x1a')]['hypotheses']));_0x29d0ea=_0x3d5a8f[_0x339b('0x1a')][_0x339b('0x1c')][0x0][_0x339b('0x1d')];_0xa886ea=_0x3d5a8f[_0x339b('0x1a')][_0x339b('0x1c')][0x0][_0x339b('0x1e')];_0x21ff19='0';_0x428704=_0x339b('0x1f');_0x31d387[_0x339b('0x18')]();}}break;case 0x1:logger[_0x339b('0x5')](_0x339b('0x8'));_0x21ff19='1';_0x428704='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x339b('0x5')](_0x339b('0x20'));_0x21ff19='2';_0x428704='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x339b('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x21ff19='9';_0x428704=_0x339b('0x21');break;case 0xa:logger[_0x339b('0x5')](_0x339b('0x22'));_0x21ff19='10';_0x428704=_0x339b('0x22');break;case 0xb:logger[_0x339b('0x5')](_0x339b('0x23'));_0x21ff19='11';_0x428704='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x4b8e23){logger['error'](_0x339b('0x24'),JSON['stringify'](_0x4b8e23));_0x31d387[_0x339b('0x18')]();}}function _0x5f508c(){logger[_0x339b('0x5')](_0x339b('0x25'));_0x1cdb6e({'transcript':_0x29d0ea,'confidence':_0xa886ea,'status':_0x21ff19,'status_message':_0x428704});}function _0x327f2d(_0x587810){logger['error'](_0x339b('0x26'));if(!_[_0x339b('0x27')](_0x587810)){logger['error'](_['isObject'](_0x587810)?JSON[_0x339b('0x11')](_0x587810):_0x587810);}}_0x31d387['on'](_0x339b('0x28'),_0x2c9694);_0x31d387['on']('message',_0x14f371);_0x31d387['on']('close',_0x5f508c);_0x31d387['on'](_0x339b('0x16'),_0x327f2d);});}; \ 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 14fba1a..e544636 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 _0x0255=['./asr'];(function(_0x32b0cc,_0x60fc81){var _0x3b362a=function(_0x76fed1){while(--_0x76fed1){_0x32b0cc['push'](_0x32b0cc['shift']());}};_0x3b362a(++_0x60fc81);}(_0x0255,0xf8));var _0x5025=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0255[_0x321bb2];return _0x9c12ed;};var asr=require(_0x5025('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x6e59=['./asr'];(function(_0x4d45c1,_0x2beda1){var _0x244478=function(_0x11304c){while(--_0x11304c){_0x4d45c1['push'](_0x4d45c1['shift']());}};_0x244478(++_0x2beda1);}(_0x6e59,0x12a));var _0x96e5=function(_0x1a19e4,_0x380e47){_0x1a19e4=_0x1a19e4-0x0;var _0x489136=_0x6e59[_0x1a19e4];return _0x489136;};var asr=require(_0x96e5('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 912a10d..7954e03 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 _0xfcc2=['createServer','listen','listening','connection','getConnections','emit','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','EventEmitter','./error','./channel','127.0.0.1','error','E_AGI_ARGUMENT_PORT'];(function(_0x254087,_0x23cb31){var _0x3c2ff4=function(_0x1f6b1a){while(--_0x1f6b1a){_0x254087['push'](_0x254087['shift']());}};_0x3c2ff4(++_0x23cb31);}(_0xfcc2,0x70));var _0x2fcc=function(_0x28896a,_0x4dc100){_0x28896a=_0x28896a-0x0;var _0x5a4f2b=_0xfcc2[_0x28896a];return _0x5a4f2b;};'use strict';var util=require(_0x2fcc('0x0'));var net=require(_0x2fcc('0x1'));var EventEmitter=require('events')[_0x2fcc('0x2')];var AGIError=require(_0x2fcc('0x3'));var AGIChannel=require(_0x2fcc('0x4'));var AGIServer=function(_0x5a1c24,_0x1e8ff7,_0x397549){var _0x2f03ce=this,_0x5a1c24=_0x5a1c24||0x11dd,_0x1e8ff7=_0x1e8ff7||_0x2fcc('0x5'),_0x3ca8c9=null,_0x1f57e8=0x0;EventEmitter['call'](_0x2f03ce);function _0x5e60bd(){if(!_0x5a1c24){_0x2f03ce['emit'](_0x2fcc('0x6'),new AGIError(_0x2fcc('0x7')));return![];}_0x3ca8c9=net[_0x2fcc('0x8')]();_0x3ca8c9[_0x2fcc('0x9')](_0x5a1c24,_0x1e8ff7);_0x3ca8c9['on']('listening',function(){_0x2f03ce['emit'](_0x2fcc('0xa'));});_0x3ca8c9['on'](_0x2fcc('0xb'),function(_0x20a66e){_0x3ca8c9[_0x2fcc('0xc')](function(_0x555b73,_0x495c81){if(_0x555b73){_0x2f03ce[_0x2fcc('0xd')](_0x2fcc('0x6'),new AGIError('E_AGI_SERVER_ERROR',_0x555b73));}else if(_0x397549&&_0x397549<0x0){_0x2f03ce[_0x2fcc('0xd')](_0x2fcc('0x6'),new AGIError(_0x2fcc('0xe')));_0x20a66e[_0x2fcc('0xf')]();}else if(_0x397549&&_0x397549>0x0&&_0x397549<_0x495c81){_0x1f57e8+=0x1;_0x2f03ce[_0x2fcc('0xd')](_0x2fcc('0x6'),new AGIError(_0x2fcc('0x10'),_0x1f57e8));_0x20a66e[_0x2fcc('0xf')]();}else{var _0xf42e73=new AGIChannel(_0x20a66e);_0xf42e73['on'](_0x2fcc('0x11'),function(){_0x2f03ce['emit'](_0x2fcc('0xb'),_0xf42e73);});}});});_0x3ca8c9['on'](_0x2fcc('0x6'),function(_0x11e195){_0x2f03ce[_0x2fcc('0xd')](_0x2fcc('0x6'),new AGIError('E_AGI_SERVER_ERROR',_0x11e195[_0x2fcc('0x12')]));});_0x3ca8c9['on'](_0x2fcc('0x13'),function(){_0x2f03ce[_0x2fcc('0xd')](_0x2fcc('0x13'),new AGIError(_0x2fcc('0x14')));});}process[_0x2fcc('0x15')](function(){_0x5e60bd();});};util[_0x2fcc('0x16')](AGIServer,EventEmitter);module[_0x2fcc('0x17')]=function(_0x1465d1,_0x33e6e4,_0x1fe76c){return new AGIServer(_0x1465d1,_0x33e6e4,_0x1fe76c);}; \ No newline at end of file +var _0xd18e=['nextTick','inherits','util','events','EventEmitter','./channel','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listening','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','connection','code','close','E_AGI_SERVER_CLOSE'];(function(_0xd89bb6,_0x296bc9){var _0x15b345=function(_0xf7f265){while(--_0xf7f265){_0xd89bb6['push'](_0xd89bb6['shift']());}};_0x15b345(++_0x296bc9);}(_0xd18e,0xde));var _0xed18=function(_0x5338d0,_0x5177e3){_0x5338d0=_0x5338d0-0x0;var _0x385204=_0xd18e[_0x5338d0];return _0x385204;};'use strict';var util=require(_0xed18('0x0'));var net=require('net');var EventEmitter=require(_0xed18('0x1'))[_0xed18('0x2')];var AGIError=require('./error');var AGIChannel=require(_0xed18('0x3'));var AGIServer=function(_0x6c075f,_0x10595f,_0x2aa862){var _0x180a35=this,_0x6c075f=_0x6c075f||0x11dd,_0x10595f=_0x10595f||'127.0.0.1',_0x432b2d=null,_0x55a670=0x0;EventEmitter[_0xed18('0x4')](_0x180a35);function _0xb18a1a(){if(!_0x6c075f){_0x180a35[_0xed18('0x5')](_0xed18('0x6'),new AGIError(_0xed18('0x7')));return![];}_0x432b2d=net[_0xed18('0x8')]();_0x432b2d['listen'](_0x6c075f,_0x10595f);_0x432b2d['on'](_0xed18('0x9'),function(){_0x180a35['emit']('listening');});_0x432b2d['on']('connection',function(_0x278c79){_0x432b2d[_0xed18('0xa')](function(_0x2fe305,_0x4e806b){if(_0x2fe305){_0x180a35[_0xed18('0x5')](_0xed18('0x6'),new AGIError('E_AGI_SERVER_ERROR',_0x2fe305));}else if(_0x2aa862&&_0x2aa862<0x0){_0x180a35[_0xed18('0x5')](_0xed18('0x6'),new AGIError(_0xed18('0xb')));_0x278c79[_0xed18('0xc')]();}else if(_0x2aa862&&_0x2aa862>0x0&&_0x2aa862<_0x4e806b){_0x55a670+=0x1;_0x180a35[_0xed18('0x5')](_0xed18('0x6'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x55a670));_0x278c79[_0xed18('0xc')]();}else{var _0x275ff6=new AGIChannel(_0x278c79);_0x275ff6['on'](_0xed18('0xd'),function(){_0x180a35[_0xed18('0x5')](_0xed18('0xe'),_0x275ff6);});}});});_0x432b2d['on'](_0xed18('0x6'),function(_0xc164ae){_0x180a35['emit'](_0xed18('0x6'),new AGIError('E_AGI_SERVER_ERROR',_0xc164ae[_0xed18('0xf')]));});_0x432b2d['on'](_0xed18('0x10'),function(){_0x180a35[_0xed18('0x5')](_0xed18('0x10'),new AGIError(_0xed18('0x11')));});}process[_0xed18('0x12')](function(){_0xb18a1a();});};util[_0xed18('0x13')](AGIServer,EventEmitter);module['exports']=function(_0x53b385,_0x4c62f2,_0x2823ae){return new AGIServer(_0x53b385,_0x4c62f2,_0x2823ae);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 821d92b..3ee643c 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 _0x5523=['isPlainObject','length','saveRestApiResult','%s.%s','isArray','split','replaceAll','getAndSetVariable','extra','setVariable','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','exec','MRCPSynth','result','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','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\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','client_email','no\x20client_email\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','googleDialogflowV2','out','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','password','no\x20password\x20configured','ndassistant_url','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','getTrunk','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','getdigits','goal','GOAL\x20%s','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws_bot_name','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appsecret','no\x20appsecret\x20configured','recordFile','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','false','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','isEmpty','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','failure','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','macro','position','QUEUE','record','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','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','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','email','user','bcc','service','host','secure','authentication','pass','template_id','debug','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','Answer','subproject','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','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','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','menu','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getTrunkById','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','extension','accountcode','file','createSquareMessage','createCmContact','isNil','callback_','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agentUnpause','agentLogout','agent','agentLogin','internal','format','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','number','timeout','includes','POST','method','toUpperCase','body','rawBody','parse','headers','rawHeaders','computedVariables','uri','render','stringify','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','private_key','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','googleASR','tildeASR','appid','clear','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex'];(function(_0x3272f7,_0x1b53f6){var _0x43c87=function(_0x328c2f){while(--_0x328c2f){_0x3272f7['push'](_0x3272f7['shift']());}};_0x43c87(++_0x1b53f6);}(_0x5523,0x137));var _0x3552=function(_0x22c7b6,_0xad4291){_0x22c7b6=_0x22c7b6-0x0;var _0x39bb93=_0x5523[_0x22c7b6];return _0x39bb93;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require(_0x3552('0x0'));var sh=require(_0x3552('0x1'));var odbc=require(_0x3552('0x2'))();var rs=require(_0x3552('0x3'));var moment=require(_0x3552('0x4'));var Mustache=require(_0x3552('0x5'));var rp=require(_0x3552('0x6'));var logger=require(_0x3552('0x7'))(_0x3552('0x8'));var config=require(_0x3552('0x9'));var scripts=require(_0x3552('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=[_0x3552('0xb'),'getdigits',_0x3552('0xc')];var AGIVertices=function(_0x2dee37,_0xefb0d8,_0x518eba){this['channel']=_0x2dee37;this[_0x3552('0xd')]=_0xefb0d8;this[_0x3552('0xe')]=_0x518eba;};AGIVertices[_0x3552('0xf')][_0x3552('0x10')]=function(_0x2cc8dc,_0x1b06c8){this[_0x3552('0xd')][_0x3552('0x11')](_0x2cc8dc)[_0x3552('0x12')](function(_0x8fc5be){_0x1b06c8(null,_0x8fc5be?_0x8fc5be[_0x3552('0x13')]:![]);})['catch'](function(_0x295d0d){_0x1b06c8(_0x295d0d);});};AGIVertices[_0x3552('0xf')][_0x3552('0x14')]=function(_0x504b80,_0x538549){this[_0x3552('0xd')][_0x3552('0x15')](_0x504b80)[_0x3552('0x12')](function(_0x273e61){_0x538549(null,_0x273e61?_0x273e61['name']:![]);})[_0x3552('0x16')](function(_0x268d39){_0x538549(_0x268d39);});};AGIVertices[_0x3552('0xf')][_0x3552('0x17')]=function(_0x4a8f95,_0x28dd81){this[_0x3552('0xd')][_0x3552('0x18')](_0x4a8f95)['then'](function(_0x2375c9){_0x28dd81(null,_0x2375c9?_0x2375c9[_0x3552('0x13')]:![]);})['catch'](function(_0x42261c){_0x28dd81(_0x42261c);});};AGIVertices[_0x3552('0xf')][_0x3552('0x19')]=function(_0x42fe33,_0x4d4a6d){this[_0x3552('0xd')][_0x3552('0x1a')](_0x42fe33)['then'](function(_0x26984c){_0x4d4a6d(null,_0x26984c?_0x26984c[_0x3552('0x1b')]:![]);})[_0x3552('0x16')](function(_0x404b40){_0x4d4a6d(_0x404b40);});};AGIVertices[_0x3552('0xf')]['getUser']=function(_0x2fe62c,_0x4ea201){this[_0x3552('0xd')]['getUserById'](_0x2fe62c)[_0x3552('0x12')](function(_0x3ddfb3){_0x4ea201(null,_0x3ddfb3?_0x3ddfb3['name']:![]);})[_0x3552('0x16')](function(_0x534c68){_0x4ea201(_0x534c68);});};AGIVertices[_0x3552('0xf')]['getTrunk']=function(_0x1972b7,_0x555c2d){this[_0x3552('0xd')][_0x3552('0x1c')](_0x1972b7)[_0x3552('0x12')](function(_0x2ae00a){_0x555c2d(null,_0x2ae00a?_0x2ae00a[_0x3552('0x13')]:![]);})[_0x3552('0x16')](function(_0x3818c5){_0x555c2d(_0x3818c5);});};AGIVertices[_0x3552('0xf')]['getSound']=function(_0x5d93f6,_0x7d75aa){var _0x581e41=this;this[_0x3552('0xd')][_0x3552('0x1d')](_0x5d93f6)[_0x3552('0x12')](function(_0x3200fc){_0x7d75aa(null,_0x3200fc?_0x581e41[_0x3552('0x1e')](_0x3200fc['save_name']):![]);})[_0x3552('0x16')](function(_0x478390){_0x7d75aa(_0x478390);});};AGIVertices[_0x3552('0xf')][_0x3552('0x1f')]=function(_0x212185,_0x52220d){this[_0x3552('0xd')][_0x3552('0x20')](_0x212185)['then'](function(_0xa8952e){_0x52220d(null,_0xa8952e?_0xa8952e:![]);})['catch'](function(_0x4dc7e9){_0x52220d(_0x4dc7e9);});};AGIVertices[_0x3552('0xf')][_0x3552('0x21')]=function(_0x118534,_0x268dc3,_0x43e19c){this[_0x3552('0xe')][_0x3552('0x21')](_0x118534,_0x268dc3)[_0x3552('0x12')](function(){_0x43e19c(null);})['catch'](function(_0x4dc77c){_0x43e19c(_0x4dc77c);});};AGIVertices['prototype'][_0x3552('0x22')]=function(_0x3f5d77,_0x5b9a73){this['rpc'][_0x3552('0x23')](_0x3f5d77)[_0x3552('0x12')](function(_0xc4a8ab){if(_0xc4a8ab){if(_0xc4a8ab[_0x3552('0x24')]){_0x5b9a73(null,[_0xc4a8ab[_0x3552('0x25')]]);}else{_0x5b9a73(null,_[_0x3552('0x26')](_0xc4a8ab[_0x3552('0x27')],'interval'));}}else{_0x5b9a73(null,![]);}})[_0x3552('0x16')](function(_0x390d39){_0x5b9a73(_0x390d39);});};AGIVertices[_0x3552('0xf')][_0x3552('0x1e')]=function(_0x19b87d){return util['format'](_0x3552('0x28'),FILES_PATH,_0x19b87d);};AGIVertices['prototype'][_0x3552('0x29')]=function(_0x55e65c,_0x3949c3,_0x354d78){odbc[_0x3552('0x2a')](_0x55e65c,function(_0xe9ed77){if(_0xe9ed77){logger[_0x3552('0x2b')](_0x3552('0x2c'),_0xe9ed77);_0x354d78(_0xe9ed77);}else{logger[_0x3552('0x2d')](_0x3552('0x2e'));odbc[_0x3552('0x2f')](_0x3949c3,function(_0x5d4e53,_0x148067){if(_0x5d4e53){logger[_0x3552('0x2d')]('Error\x20executing\x20query\x20%s',_0x3949c3);_0x354d78(_0x5d4e53);}else{logger[_0x3552('0x2d')](_0x3552('0x30'),_0x3949c3);odbc[_0x3552('0x31')](function(_0x1b6064){if(_0x1b6064){logger[_0x3552('0x2b')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x1b6064);}_0x354d78(null,_0x148067);});}});}});};AGIVertices[_0x3552('0xf')]['getSmsAccount']=function(_0x279bc0,_0x1e8d10){this['rpc'][_0x3552('0x32')](_0x279bc0)[_0x3552('0x12')](function(_0x45e746){_0x1e8d10(null,_0x45e746?_0x45e746:![]);})[_0x3552('0x16')](function(_0xaab25d){_0x1e8d10(_0xaab25d);});};AGIVertices[_0x3552('0xf')][_0x3552('0x33')]=function(_0x380c5c,_0x2912b3){this[_0x3552('0xd')][_0x3552('0x33')](_0x380c5c)[_0x3552('0x12')](function(_0x4fd496){_0x2912b3(null,_0x4fd496);})[_0x3552('0x16')](function(_0x513170){_0x2912b3(_0x513170);});};AGIVertices[_0x3552('0xf')][_0x3552('0x34')]=function(_0x45973b,_0x4238bd,_0x1849f9){this[_0x3552('0xd')]['createSquareDetailsReport']({'uniqueid':this[_0x3552('0x35')][_0x3552('0x36')],'node':_0x45973b[_0x3552('0x37')],'application':_0x45973b[_0x3552('0x38')],'data':_0x4238bd||null,'project_name':this[_0x3552('0x35')][_0x3552('0x39')],'callerid':this[_0x3552('0x35')]['callerid']})[_0x3552('0x12')](function(_0x3d51f5){if(_0x1849f9){_0x1849f9(null,_0x3d51f5);}})[_0x3552('0x16')](function(_0x915279){if(_0x1849f9){_0x1849f9(_0x915279);}});};AGIVertices[_0x3552('0xf')][_0x3552('0x3a')]=function(_0x25250a,_0x1802cd,_0x52bf34,_0x856032){this[_0x3552('0xd')][_0x3552('0x3a')]({'uniqueid':this[_0x3552('0x35')][_0x3552('0x36')],'callerid':this[_0x3552('0x35')][_0x3552('0x3b')],'calleridname':this[_0x3552('0x35')][_0x3552('0x3c')],'context':this['channel'][_0x3552('0x3d')],'extension':this['channel'][_0x3552('0x3e')],'priority':this[_0x3552('0x35')]['priority'],'accountcode':this['channel'][_0x3552('0x3f')],'dnid':this[_0x3552('0x35')]['dnid'],'projectName':this[_0x3552('0x35')][_0x3552('0x39')],'saveName':_0x1802cd,'filename':_0x25250a[_0x3552('0x40')]||_0x1802cd,'savePath':_0x52bf34})[_0x3552('0x12')](function(_0x382b04){_0x856032(null,_0x382b04);})['catch'](function(_0x1a9b1a){_0x856032(_0x1a9b1a);});};AGIVertices[_0x3552('0xf')][_0x3552('0x41')]=function(_0x4eff7a,_0x2a3f99,_0x343cd6,_0x3a2e89,_0x3204e6){this[_0x3552('0xd')][_0x3552('0x41')]({'uniqueid':this[_0x3552('0x35')][_0x3552('0x36')],'body':_0x4eff7a,'direction':_0x2a3f99,'providerName':_0x343cd6,'providerResponse':_0x3a2e89})[_0x3552('0x12')](function(_0x337e10){if(_0x3204e6){_0x3204e6(null,_0x337e10);}})[_0x3552('0x16')](function(_0x367daa){if(_0x3204e6){_0x3204e6(_0x367daa);}});};AGIVertices['prototype'][_0x3552('0x42')]=function(_0x10ddce,_0x3e74d9){this[_0x3552('0xd')][_0x3552('0x42')]({'firstName':_['isEmpty'](_0x10ddce['name'])||_[_0x3552('0x43')](_0x10ddce[_0x3552('0x13')])?_0x3552('0x44')+Math['random']():_0x10ddce['name'],'lastName':_['isEmpty'](_0x10ddce[_0x3552('0x45')])||_['isNil'](_0x10ddce['lastName'])?null:_0x10ddce[_0x3552('0x45')],'phone':_0x10ddce[_0x3552('0x46')],'ListId':_0x10ddce[_0x3552('0x47')],'scheduledat':_0x10ddce[_0x3552('0x48')],'callbackUniqueid':this['channel'][_0x3552('0x36')],'tags':_0x3552('0x49'),'description':_0x3552('0x4a')+_0x10ddce[_0x3552('0x48')][_0x3552('0x4b')](),'priority':_0x10ddce[_0x3552('0x4c')]})['then'](function(_0x148c57){_0x3e74d9(null,_0x148c57);})[_0x3552('0x16')](function(_0xff80d){_0x3e74d9(_0xff80d);});};AGIVertices[_0x3552('0xf')]['getPause']=function(_0x384057,_0x32e55c){this[_0x3552('0xd')][_0x3552('0x4d')](_0x384057)[_0x3552('0x12')](function(_0x139014){_0x32e55c(null,_0x139014?_0x139014['name']:![]);})[_0x3552('0x16')](function(_0x4bdea4){_0x32e55c(_0x4bdea4);});};AGIVertices['prototype'][_0x3552('0x4e')]=function(_0x306e98,_0xc8e208,_0x5016e5){var _0x520443={'role':'agent'};_0x520443[_0x306e98]=this['channel']['callerid'];this[_0x3552('0xd')][_0x3552('0x4e')](_0x520443,_0xc8e208,this[_0x3552('0x35')][_0x3552('0x36')])[_0x3552('0x12')](function(_0x79ac30){_0x5016e5(null,_['isNil'](_0x79ac30)?![]:!![]);})['catch'](function(_0x5b7876){logger[_0x3552('0x2b')](_0x5b7876);_0x5016e5(null,![]);});};AGIVertices[_0x3552('0xf')]['agentUnpause']=function(_0x4c43f3,_0x369717){var _0x42eaaf={'role':'agent'};_0x42eaaf[_0x4c43f3]=this['channel'][_0x3552('0x3b')];this[_0x3552('0xd')][_0x3552('0x4f')](_0x42eaaf)['then'](function(_0x279939){_0x369717(null,_[_0x3552('0x43')](_0x279939)?![]:!![]);})['catch'](function(_0x5c0246){logger['error'](_0x5c0246);_0x369717(null,![]);});};AGIVertices['prototype'][_0x3552('0x50')]=function(_0x2742e9,_0xf9cd58){var _0x28d0a1={'role':_0x3552('0x51')};_0x28d0a1[_0x2742e9]=this['channel']['callerid'];this['rpc'][_0x3552('0x50')](_0x28d0a1)['then'](function(_0x1abaec){_0xf9cd58(null,_[_0x3552('0x43')](_0x1abaec)?![]:!![]);})[_0x3552('0x16')](function(_0x4bf9ff){logger[_0x3552('0x2b')](_0x4bf9ff);_0xf9cd58(null,![]);});};AGIVertices[_0x3552('0xf')][_0x3552('0x52')]=function(_0x5db0e5,_0x3bcb14){var _0x168666={'role':_0x3552('0x51')};_0x168666[_0x5db0e5]=this['channel'][_0x3552('0x3b')];var _0x543b09=_0x5db0e5!=_0x3552('0x53')?util[_0x3552('0x54')]('%s/%s@from-sip/n',_0x3552('0x55'),this['channel']['callerid']):undefined;this[_0x3552('0xd')][_0x3552('0x52')](_0x168666,_0x543b09)[_0x3552('0x12')](function(_0x262055){_0x3bcb14(null,_[_0x3552('0x43')](_0x262055)?![]:!![]);})[_0x3552('0x16')](function(_0x1d345c){logger[_0x3552('0x2b')](_0x1d345c);_0x3bcb14(null,![]);});};AGIVertices[_0x3552('0xf')][_0x3552('0x56')]=function(_0xe85549,_0x3be557){sh['exec'](_[_0x3552('0x57')](_0xe85549),function(_0x422c62,_0x185a1a){var _0x2f16b6=_0x185a1a[_0x3552('0x58')](/(\r\n|\n|\r)/gm,'');_0x3be557(null,_0x2f16b6);});};AGIVertices[_0x3552('0xf')]['googleCloudTTS']=function(_0x5d1916,_0x4434a3){scripts[_0x3552('0x59')](_0x5d1916[_0x3552('0x5a')],_0x5d1916[_0x3552('0x5b')]||_0x3552('0x5c'),_0x5d1916['text'],_0x5d1916[_0x3552('0x5d')]||_0x3552('0x5e'),_0x5d1916[_0x3552('0x5f')]||_0x3552('0x60'),_0x5d1916[_0x3552('0x61')]||_0x3552('0x62'))[_0x3552('0x12')](function(_0x892e38){_0x4434a3(null,_0x892e38);})[_0x3552('0x16')](function(_0x13a74f){_0x4434a3(_0x13a74f);});};AGIVertices[_0x3552('0xf')][_0x3552('0x63')]=function(_0x50d985,_0x3b4370){scripts[_0x3552('0x63')](_0x50d985[_0x3552('0x5c')],_0x50d985[_0x3552('0x64')]||'en',0x1)['then'](function(_0x268d3e){_0x3b4370(null,_0x268d3e);})['catch'](function(_0x16694a){_0x3b4370(_0x16694a);});};AGIVertices[_0x3552('0xf')]['restAPI']=function(_0x4a8eab,_0x19d413){var _0x4e368={'uri':_0x4a8eab[_0x3552('0x65')],'method':_0x4a8eab['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4a8eab['timeout'])===_0x3552('0x66')&&parseInt(_0x4a8eab[_0x3552('0x67')])>=0x1?parseInt(_0x4a8eab[_0x3552('0x67')])*0x3e8:0x5*0x3e8};if(_[_0x3552('0x68')]([_0x3552('0x69'),'PUT'],_0x4e368[_0x3552('0x6a')][_0x3552('0x6b')]())){try{_0x4e368[_0x3552('0x6c')]=_0x4a8eab[_0x3552('0x6d')]?JSON[_0x3552('0x6e')](_0x4a8eab[_0x3552('0x6d')]):{};}catch(_0x49f6ba){logger[_0x3552('0x2b')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x49f6ba);}}try{_0x4e368[_0x3552('0x6f')]=_0x4a8eab[_0x3552('0x70')]?JSON[_0x3552('0x6e')](_0x4a8eab['rawHeaders']):{};}catch(_0x1c2439){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1c2439);}if(_0x4a8eab[_0x3552('0x71')]){try{var _0x290507=require(_0x4a8eab['computedVariables'])['sync'](this,_0x4e368);_0x4e368[_0x3552('0x72')]=Mustache['render'](_0x4a8eab['url'],_0x290507,{},['$$','$$']);if(_0x4e368[_0x3552('0x6f')]){_0x4e368['headers']=JSON[_0x3552('0x6e')](Mustache[_0x3552('0x73')](JSON['stringify'](_0x4e368[_0x3552('0x6f')]),_0x290507,{},['$$','$$']));}if(_0x4e368['body']){_0x4e368[_0x3552('0x6c')]=JSON[_0x3552('0x6e')](Mustache[_0x3552('0x73')](JSON[_0x3552('0x74')](_0x4e368[_0x3552('0x6c')]),_0x290507,{},['$$','$$']));}}catch(_0x201568){logger[_0x3552('0x2b')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x201568);}}rp(_0x4e368)[_0x3552('0x12')](function(_0x336b58){var _0x4af7a5={'statusCode':_0x336b58['statusCode']||0xc8,'statusMessage':_0x336b58['statusMessage']||'OK','headers':_0x336b58[_0x3552('0x6f')]||{},'body':_0x336b58[_0x3552('0x6c')]||{}};_0x19d413(null,_0x4af7a5);})[_0x3552('0x16')](function(_0x130fc8){var _0x458087={'statusCode':_0x130fc8[_0x3552('0x75')]||0x1f4,'statusMessage':_0x130fc8[_0x3552('0x76')]||_0x3552('0x77'),'headers':_0x130fc8['options'][_0x3552('0x6f')]||{},'body':_0x130fc8[_0x3552('0x78')][_0x3552('0x6c')]||{}};_0x19d413(null,_0x458087);});};AGIVertices['prototype'][_0x3552('0x79')]=function(_0x462774,_0x2878dd){scripts[_0x3552('0x79')](this[_0x3552('0x35')]['uniqueid'],_0x462774['key'],_0x462774['text'],_0x462774[_0x3552('0x7a')]||'en')[_0x3552('0x12')](function(_0x24c62c){_0x2878dd(null,_0x24c62c);})[_0x3552('0x16')](function(_0x52f603){_0x2878dd(_0x52f603);});};AGIVertices[_0x3552('0xf')]['googleDialogflowV2']=function(_0x1d0357,_0x8e261b){scripts['googleDialogflowV2'](this[_0x3552('0x35')][_0x3552('0x36')],_0x1d0357['dialogflowV2_project_id'],_0x1d0357['client_email'],_0x1d0357[_0x3552('0x7b')],_0x1d0357[_0x3552('0x5c')],_0x1d0357['dialogflowV2_language']||'en')[_0x3552('0x12')](function(_0x23b7fa){_0x8e261b(null,_0x23b7fa);})[_0x3552('0x16')](function(_0x1c3943){_0x8e261b(_0x1c3943);});};AGIVertices[_0x3552('0xf')][_0x3552('0x7c')]=function(_0x50865f,_0x253ec1){scripts[_0x3552('0x7c')](this[_0x3552('0x35')],_0x50865f)[_0x3552('0x12')](function(_0x45f44a){_0x253ec1(null,_0x45f44a);})['catch'](function(_0x46f372){_0x253ec1(_0x46f372);});};AGIVertices[_0x3552('0xf')][_0x3552('0x7d')]=function(_0x20402e,_0x3dabcb){scripts[_0x3552('0x7d')](_0x20402e[_0x3552('0x7e')],_0x20402e[_0x3552('0x5c')],_0x20402e[_0x3552('0x7f')]||_0x3552('0x5e'),_0x20402e[_0x3552('0x80')])[_0x3552('0x12')](function(_0x54a71a){_0x3dabcb(null,_0x54a71a);})[_0x3552('0x16')](function(_0x636db){_0x3dabcb(_0x636db);});};AGIVertices[_0x3552('0xf')][_0x3552('0x81')]=function(_0x3ad608,_0x3f1df5,_0x373121){scripts[_0x3552('0x81')](_0x3f1df5,_0x3ad608[_0x3552('0x7e')],_0x3ad608[_0x3552('0x82')]||_0x3552('0x5e'),this[_0x3552('0x83')](_0x3ad608[_0x3552('0x84')])?_0x3ad608[_0x3552('0x84')]:undefined)[_0x3552('0x12')](function(_0x1904cc){_0x373121(null,_0x1904cc);})[_0x3552('0x16')](function(_0x4f8dc4){_0x373121(_0x4f8dc4);});};AGIVertices[_0x3552('0xf')][_0x3552('0x85')]=function(_0x46e1a5,_0x5b1502){scripts[_0x3552('0x85')](_0x46e1a5['aws_access_key_id'],_0x46e1a5[_0x3552('0x86')],_0x46e1a5[_0x3552('0x87')],_0x46e1a5[_0x3552('0x88')]||_0x3552('0x89'),_0x46e1a5['text'],_0x46e1a5[_0x3552('0x8a')]||'text')[_0x3552('0x12')](function(_0x579959){_0x5b1502(null,_0x579959);})[_0x3552('0x16')](function(_0xae3d5a){_0x5b1502(_0xae3d5a);});};AGIVertices[_0x3552('0xf')][_0x3552('0x8b')]=function(_0x51a978,_0x35bbca){scripts[_0x3552('0x8b')](this[_0x3552('0x35')][_0x3552('0x36')],_0x51a978[_0x3552('0x8c')],_0x51a978[_0x3552('0x86')],_0x51a978[_0x3552('0x8d')],_0x51a978[_0x3552('0x5c')],_0x51a978['aws_bot_name'])[_0x3552('0x12')](function(_0x45b425){_0x35bbca(null,_0x45b425);})['catch'](function(_0x5d8b96){_0x35bbca(_0x5d8b96);});};AGIVertices[_0x3552('0xf')][_0x3552('0x8e')]=function(_0x3541a5,_0x567cb6,_0x2708b6){scripts['googleASR'](_0x567cb6,_0x3541a5[_0x3552('0x7e')],_0x3541a5['google_asr_language']||_0x3552('0x5e'))[_0x3552('0x12')](function(_0x489050){_0x2708b6(null,_0x489050);})[_0x3552('0x16')](function(_0x21278b){_0x2708b6(_0x21278b);});};AGIVertices[_0x3552('0xf')][_0x3552('0x8f')]=function(_0x47ca2b,_0x34174f,_0xc6a064){scripts[_0x3552('0x8f')](_0x34174f,_0x47ca2b[_0x3552('0x90')],_0x47ca2b['appsecret'],_0x47ca2b[_0x3552('0x72')])[_0x3552('0x12')](function(_0x1a57ac){_0xc6a064(null,_0x1a57ac);})[_0x3552('0x16')](function(_0x195eba){_0xc6a064(_0x195eba);});};AGIVertices[_0x3552('0xf')][_0x3552('0x91')]=function(_0x57d87a){var _0x193c08=_[_0x3552('0x68')](verticesWithRetry,_0x57d87a['agicommand'])?_0x57d87a:_['clone'](_0x57d87a);for(var _0x53e9c9 in _0x193c08){if(_0x193c08[_0x3552('0x92')](_0x53e9c9)){if(_0x193c08[_0x53e9c9]&&_[_0x3552('0x93')](_0x193c08[_0x53e9c9])){if(_[_0x3552('0x68')](recursiveMapAttributes,_0x53e9c9)){_0x193c08[_0x53e9c9]=this[_0x3552('0x94')](_0x193c08[_0x53e9c9]);}else{_0x193c08[_0x53e9c9]=this[_0x3552('0x95')](_0x193c08[_0x53e9c9]);}}}}return _0x193c08;};AGIVertices[_0x3552('0xf')][_0x3552('0x96')]=function(_0x3d6b93){for(var _0x7f2bff in _0x3d6b93){if(_0x3d6b93[_0x3552('0x92')](_0x7f2bff)){if(_[_0x3552('0x97')](_0x3d6b93[_0x7f2bff])){this[_0x3552('0x96')](_0x3d6b93[_0x7f2bff]);}else if(_['isArray'](_0x3d6b93[_0x7f2bff])){for(var _0xfa805d=0x0;_0xfa805d<_0x3d6b93[_0x7f2bff][_0x3552('0x98')];_0xfa805d++){this['recursiveNodeIndex'](_0x3d6b93[_0x7f2bff][_0xfa805d]);}}else if(_['isString'](_0x3d6b93[_0x7f2bff])){_0x3d6b93[_0x7f2bff]=this[_0x3552('0x95')](_0x3d6b93[_0x7f2bff]);}}}};AGIVertices[_0x3552('0xf')]['saveRestApiResult']=function(_0x257175,_0x1a3965){for(var _0x2ed855 in _0x257175){if(_0x257175['hasOwnProperty'](_0x2ed855)){if(_[_0x3552('0x97')](_0x257175[_0x2ed855])){if(!_['isEmpty'](_0x257175[_0x2ed855])){this[_0x3552('0x99')](_0x257175[_0x2ed855],util['format'](_0x3552('0x9a'),_0x1a3965,_0x2ed855));}}else if(_[_0x3552('0x9b')](_0x257175[_0x2ed855])){for(var _0x6ed38a=0x0;_0x6ed38a<_0x257175[_0x2ed855][_0x3552('0x98')];_0x6ed38a++){this[_0x3552('0x99')](_0x257175[_0x2ed855][_0x6ed38a],util[_0x3552('0x54')](_0x3552('0x9a'),_0x1a3965,_0x2ed855+'['+_0x6ed38a+']'));}}else{if(!_[_0x3552('0x43')](_0x257175[_0x2ed855])){this['channel']['setVariable'](util[_0x3552('0x54')](_0x3552('0x9a'),_0x1a3965,_0x2ed855),_0x257175[_0x2ed855]);}}}}};AGIVertices[_0x3552('0xf')]['replaceObjectAllVariables']=function(_0x5a3694){try{var _0x5e46c6=JSON[_0x3552('0x6e')](_0x5a3694);this[_0x3552('0x96')](_0x5e46c6);return JSON[_0x3552('0x74')](_0x5e46c6);}catch(_0x467567){return this[_0x3552('0x95')](_0x5a3694);}};AGIVertices[_0x3552('0xf')]['replaceAllVariables']=function(_0x7e7723){var _0x570f03=_0x7e7723[_0x3552('0x9c')]('{');for(var _0xf06969=0x1;_0xf06969<_0x570f03[_0x3552('0x98')];_0xf06969+=0x1){var _0x8ae48a=_0x570f03[_0xf06969][_0x3552('0x9c')]('}');if(_0x8ae48a[_0x3552('0x98')]>0x1){_0x7e7723=_0x7e7723[_0x3552('0x9d')]('{'+_0x8ae48a[0x0]+'}',this[_0x3552('0x35')][_0x3552('0x10')](_0x8ae48a[0x0])['extra']||_0x8ae48a[0x0]);}}if(_0x570f03['length']===0x1){return _0x7e7723[_0x3552('0x4b')]();}return this[_0x3552('0x95')](_0x7e7723);};AGIVertices[_0x3552('0xf')][_0x3552('0x9e')]=function(_0x5c07f2,_0x355fa3){var _0x33fae8=this[_0x3552('0x35')]['getVariable'](_0x5c07f2);if(_0x33fae8['result']===-0x1){return _0x33fae8;}logger[_0x3552('0x2d')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x355fa3,_0x33fae8[_0x3552('0x9f')]));return this[_0x3552('0x35')][_0x3552('0xa0')](_0x355fa3,_0x33fae8[_0x3552('0x9f')]);};AGIVertices[_0x3552('0xf')][_0x3552('0x83')]=function(_0x1877a4){return _0x1877a4&&_0x1877a4!=='0'&&_0x1877a4!=='-1'&&_0x1877a4!=='';};AGIVertices[_0x3552('0xf')][_0x3552('0xa1')]=function(_0x365bc1){this['createSquareDetailsReport'][_0x3552('0xa2')](this,_0x365bc1,'-');_0x365bc1[_0x3552('0xa3')]=_0x365bc1['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x3552('0xf')][_0x3552('0xa4')]=function(_0xfff1c6){logger[_0x3552('0x2d')](util['format'](_0x3552('0xa5'),_0xfff1c6['label']));if(!this[_0x3552('0x83')](_0xfff1c6[_0x3552('0x5c')])){return this[_0x3552('0x35')]['noop'](_0x3552('0xa6'));}var _0x1c3598='\x22'+_0xfff1c6[_0x3552('0x5c')]+'\x22';if(this[_0x3552('0x83')](_0xfff1c6[_0x3552('0x78')])){_0x1c3598+=','+_0xfff1c6[_0x3552('0x78')];}var _0x46b2a1=this[_0x3552('0x35')][_0x3552('0xa7')](_0x3552('0xa8'),_0x1c3598);if(_0x46b2a1[_0x3552('0xa9')]===-0x1){return _0x46b2a1;}return this[_0x3552('0x35')][_0x3552('0xaa')](util['format'](_0x3552('0xab'),_0x1c3598));};AGIVertices[_0x3552('0xf')][_0x3552('0xac')]=function(_0x4a1b03){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0xad'),_0x4a1b03[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x4a1b03[_0x3552('0xae')])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xaf'));}var _0x52e2d3=_0x4a1b03[_0x3552('0xae')];if(this[_0x3552('0x83')](_0x4a1b03[_0x3552('0x78')])){_0x52e2d3+=','+_0x4a1b03[_0x3552('0x78')];}var _0x421df9=this[_0x3552('0x35')]['exec'](_0x3552('0xb0'),_0x52e2d3);if(_0x421df9[_0x3552('0xa9')]===-0x1){return _0x421df9;}var _0x367856=this['getAndSetVariable'](_0x3552('0xb1'),'MRCP_RECOG_CONFIDENCE');if(_0x367856['result']===-0x1){return _0x367856;}var _0x508fea=this['getAndSetVariable'](_0x3552('0xb2'),_0x3552('0xb3'));if(_0x508fea['result']===-0x1){return _0x508fea;}var _0x5a8316=this[_0x3552('0x9e')](_0x3552('0xb4'),_0x3552('0xb5'));if(_0x5a8316[_0x3552('0xa9')]===-0x1){return _0x5a8316;}return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0xb6'),_0x52e2d3));};AGIVertices[_0x3552('0xf')][_0x3552('0x8')]=function(_0x57b8c9){logger[_0x3552('0x2d')](util['format'](_0x3552('0xb7'),_0x57b8c9[_0x3552('0x37')]));return this[_0x3552('0x35')][_0x3552('0x8')]([_0x57b8c9[_0x3552('0xb8')],_0x57b8c9[_0x3552('0xb9')]]);};AGIVertices[_0x3552('0xf')][_0x3552('0xba')]=function(_0x5e6ded){logger[_0x3552('0x2d')](util[_0x3552('0x54')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x5e6ded[_0x3552('0x37')]));if(this[_0x3552('0x83')](_0x5e6ded[_0x3552('0x67')])){logger['info'](util[_0x3552('0x54')](_0x3552('0xbb'),_0x5e6ded['timeout']));var _0x35a2b5=this[_0x3552('0x35')][_0x3552('0xbc')](_0x5e6ded['timeout']);if(_0x35a2b5[_0x3552('0xa9')]===-0x1){return _0x35a2b5;}}return this[_0x3552('0x35')][_0x3552('0xba')]();};AGIVertices[_0x3552('0xf')]['callback']=function(_0x397e39){logger['info'](util[_0x3552('0x54')](_0x3552('0xbd'),_0x397e39[_0x3552('0x37')]));if(!this['isConfigured'](_0x397e39[_0x3552('0x47')])){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x397e39,_0x3552('0xbe'));}_0x397e39[_0x3552('0x48')]=moment();if(this[_0x3552('0x83')](_0x397e39['delay'])){_0x397e39['scheduledAt']=moment()[_0x3552('0xbf')](_0x397e39['delay'],_0x3552('0xc0'));}if(!this[_0x3552('0x83')](_0x397e39[_0x3552('0x4c')])){_0x397e39['callback_priority']=0x2;}this[_0x3552('0x42')][_0x3552('0xa2')](this,_0x397e39);return this[_0x3552('0x35')]['noop'](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x397e39[_0x3552('0x46')],_0x397e39[_0x3552('0x47')],_0x397e39[_0x3552('0x48')]));};AGIVertices['prototype'][_0x3552('0xc1')]=function(_0x5c224c){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0xc2'),_0x5c224c[_0x3552('0x37')]));var _0x597b3b=this['channel']['exec'](_0x5c224c[_0x3552('0xc3')],_0x5c224c['options']);if(_0x597b3b[_0x3552('0xa9')]===-0x1){return _0x597b3b;}return this['channel'][_0x3552('0xaa')](util['format'](_0x3552('0xc4'),_0x5c224c[_0x3552('0xc3')],_0x5c224c['options']));};AGIVertices[_0x3552('0xf')][_0x3552('0xc5')]=function(_0x13c498){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0xc6'),_0x13c498[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x13c498['text'])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xa6'));}var _0x570c6f='\x22'+_0x13c498[_0x3552('0x5c')]+'\x22';if(this[_0x3552('0x83')](_0x13c498[_0x3552('0x78')])){_0x570c6f+=','+_0x13c498[_0x3552('0x78')];}var _0x49c418=this[_0x3552('0x35')]['exec'](_0x3552('0xa8'),_0x570c6f);if(_0x49c418['result']===-0x1){return _0x49c418;}return this[_0x3552('0x35')][_0x3552('0xaa')](util['format'](_0x3552('0xab'),_0x570c6f));};AGIVertices[_0x3552('0xf')][_0x3552('0xc7')]=function(_0x247653){logger['info'](util[_0x3552('0x54')](_0x3552('0xc8'),_0x247653[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x247653[_0x3552('0x5c')])){return this[_0x3552('0x35')][_0x3552('0xaa')]('no\x20text\x20configured');}var _0x50ad47='\x22'+_0x247653[_0x3552('0x5c')]+'\x22';if(this[_0x3552('0x83')](_0x247653[_0x3552('0x78')])){_0x50ad47+=','+_0x247653['options'];}var _0x261185=this['channel']['exec'](_0x3552('0xa8'),_0x50ad47);if(_0x261185[_0x3552('0xa9')]===-0x1){return _0x261185;}return this['channel']['noop'](util[_0x3552('0x54')]('Executed\x20command\x20MRCPSynth\x20%s',_0x50ad47));};AGIVertices[_0x3552('0xf')]['lumenvoxasr']=function(_0x554c80){logger[_0x3552('0x2d')](util['format'](_0x3552('0xc9'),_0x554c80[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x554c80[_0x3552('0xae')])){return this['channel'][_0x3552('0xaa')](_0x3552('0xaf'));}var _0x6adbf3=_0x554c80['grammar'];if(this[_0x3552('0x83')](_0x554c80[_0x3552('0x78')])){_0x6adbf3+=','+_0x554c80[_0x3552('0x78')];}var _0x47b5af=this[_0x3552('0x35')][_0x3552('0xa7')](_0x3552('0xb0'),_0x6adbf3);if(_0x47b5af[_0x3552('0xa9')]===-0x1){return _0x47b5af;}var _0x1c5fb6=this[_0x3552('0x9e')](_0x3552('0xb1'),'LUMENVOX_ASR_CONFIDENCE');if(_0x1c5fb6[_0x3552('0xa9')]===-0x1){return _0x1c5fb6;}var _0x5a49d5=this[_0x3552('0x9e')](_0x3552('0xb2'),_0x3552('0xca'));if(_0x5a49d5[_0x3552('0xa9')]===-0x1){return _0x5a49d5;}var _0x2aa018=this[_0x3552('0x9e')]('RECOG_INSTANCE()',_0x3552('0xcb'));if(_0x2aa018[_0x3552('0xa9')]===-0x1){return _0x2aa018;}return this[_0x3552('0x35')][_0x3552('0xaa')](util['format'](_0x3552('0xb6'),_0x6adbf3));};AGIVertices[_0x3552('0xf')]['sestekasr']=function(_0x45ef35){logger[_0x3552('0x2d')](util[_0x3552('0x54')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x45ef35[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x45ef35[_0x3552('0xae')])){return this[_0x3552('0x35')]['noop'](_0x3552('0xaf'));}var _0x108fde=_0x45ef35[_0x3552('0xae')];if(this['isConfigured'](_0x45ef35['options'])){_0x108fde+=','+_0x45ef35['options'];}var _0x3f785d=this[_0x3552('0x35')][_0x3552('0xa7')](_0x3552('0xb0'),_0x108fde);if(_0x3f785d[_0x3552('0xa9')]===-0x1){return _0x3f785d;}var _0x2489a4=this[_0x3552('0x9e')](_0x3552('0xb1'),_0x3552('0xcc'));if(_0x2489a4[_0x3552('0xa9')]===-0x1){return _0x2489a4;}var _0x3e114a=this[_0x3552('0x9e')](_0x3552('0xb2'),_0x3552('0xcd'));if(_0x3e114a['result']===-0x1){return _0x3e114a;}var _0x13131b=this[_0x3552('0x9e')](_0x3552('0xb4'),'SESTEK_ASR_INSTANCE');if(_0x13131b[_0x3552('0xa9')]===-0x1){return _0x13131b;}return this[_0x3552('0x35')]['noop'](util[_0x3552('0x54')](_0x3552('0xb6'),_0x108fde));};AGIVertices['prototype']['database']=function(_0xd8c41a){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0xce'),_0xd8c41a['label']));if(!this[_0x3552('0x83')](_0xd8c41a[_0x3552('0xcf')])){return this['channel'][_0x3552('0x2b')](_0xd8c41a,_0x3552('0xd0'));}var _0x90d599=this[_0x3552('0x19')]['sync'](this,_0xd8c41a[_0x3552('0xcf')]);if(!_0x90d599){return this[_0x3552('0x35')][_0x3552('0x2b')](_0xd8c41a,_0x3552('0xd1'));}if(!this[_0x3552('0x83')](_0xd8c41a[_0x3552('0x2f')])){return this[_0x3552('0x35')][_0x3552('0x2b')](_0xd8c41a,_0x3552('0xd2'));}var _0xe3aebf=_0xd8c41a[_0x3552('0x2f')][_0x3552('0x58')](/(\r\n|\n|\r)/gm,'\x20');this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0xd3'),_0xe3aebf));var _0x1036d8=this[_0x3552('0x29')][_0x3552('0xa2')](this,_0x90d599,_0xe3aebf);this[_0x3552('0x34')][_0x3552('0xa2')](this,_0xd8c41a,_0xe3aebf);if(!this[_0x3552('0x83')](_0xd8c41a[_0x3552('0xd4')])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xd5'));}var _0x5886db=this[_0x3552('0x10')][_0x3552('0xa2')](this,_0xd8c41a[_0x3552('0xd4')]);if(!_0x5886db){return this[_0x3552('0x35')]['error'](_0xd8c41a,_0x3552('0xd6'));}var _0x481e70=this;_0x1036d8[_0x3552('0xd7')](function(_0x128862,_0xbbb66d){Object[_0x3552('0xd8')](_0x128862)['forEach'](function(_0x108a11){_0x481e70[_0x3552('0x35')]['setVariable'](util[_0x3552('0x54')]('%s[%s][%s]',_0x5886db,_0xbbb66d,_0x108a11),_0x128862[_0x108a11]);});});this[_0x3552('0x35')]['setVariable'](util[_0x3552('0x54')](_0x3552('0xd9'),_0x5886db),_0x1036d8[_0x3552('0x98')]);return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0xda'),_0x5886db));};AGIVertices[_0x3552('0xf')][_0x3552('0xdb')]=function(_0x5d05cb){logger['debug'](util['format'](_0x3552('0xdc'),_0x5d05cb[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x5d05cb[_0x3552('0xdd')])){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x5d05cb,_0x3552('0xde'));}var _0x3cca8e=this[_0x3552('0xdf')][_0x3552('0xa2')](this,_0x5d05cb['sip_id']);if(!_0x3cca8e){return this[_0x3552('0x35')]['error'](_0x5d05cb,_0x3552('0xe0'));}var _0x40eab6=this[_0x3552('0x35')][_0x3552('0xa7')](_0x3552('0xe1'),[util['format'](_0x3552('0xe2'),_0x3cca8e),_0x5d05cb[_0x3552('0x67')],_0x5d05cb['opts'],_0x5d05cb[_0x3552('0x65')]]);if(_0x40eab6[_0x3552('0xa9')]===-0x1){return _0x40eab6;}return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0xe3'),_0x3552('0xe1')));};AGIVertices['prototype'][_0x3552('0xe4')]=function(_0x18bced){logger[_0x3552('0x2d')](util[_0x3552('0x54')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x18bced['label']));if(!this[_0x3552('0x83')](_0x18bced['key'])){return this['channel'][_0x3552('0xaa')](_0x3552('0xe5'));}if(!this[_0x3552('0x83')](_0x18bced[_0x3552('0x5c')])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xa6'));}this[_0x3552('0x35')][_0x3552('0xe6')]=!![];this[_0x3552('0x34')](_0x18bced);this[_0x3552('0x41')](_0x18bced[_0x3552('0x5c')],'in','','');this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0xe7'),_0x18bced[_0x3552('0x5c')]));var _0x1d949e=this[_0x3552('0x79')][_0x3552('0xa2')](this,_0x18bced);if(_0x1d949e){for(var _0x3111ed in _0x1d949e){if(_0x1d949e['hasOwnProperty'](_0x3111ed)){this[_0x3552('0x35')][_0x3552('0xa0')](util[_0x3552('0x54')](_0x3552('0xe8'),_0x3111ed[_0x3552('0x6b')]()),_0x1d949e[_0x3111ed]);}}this[_0x3552('0x41')](_0x1d949e[_0x3552('0xe9')],'out',_0x3552('0xe4'),'');return this[_0x3552('0x35')][_0x3552('0xaa')](util['format'](_0x3552('0xea'),_0x1d949e[_0x3552('0xe9')]));}return this[_0x3552('0x35')][_0x3552('0x2b')](_0x18bced,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x3552('0xf')][_0x3552('0xeb')]=function(_0x776274){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0xec'),_0x776274[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x776274['dialogflowV2_project_id'])){return this[_0x3552('0x35')][_0x3552('0xaa')]('no\x20project_id\x20configured');}if(!this[_0x3552('0x83')](_0x776274[_0x3552('0xed')])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xee'));}if(!this[_0x3552('0x83')](_0x776274[_0x3552('0x7b')])){return this[_0x3552('0x35')][_0x3552('0xaa')]('no\x20private_key\x20configured');}if(!this[_0x3552('0x83')](_0x776274[_0x3552('0xef')])){return this['channel'][_0x3552('0xaa')](_0x3552('0xf0'));}if(!this[_0x3552('0x83')](_0x776274[_0x3552('0x5c')])){return this['channel']['noop'](_0x3552('0xa6'));}this[_0x3552('0x35')]['bot']=!![];this['createSquareDetailsReport'](_0x776274);this[_0x3552('0x41')](_0x776274[_0x3552('0x5c')],'in','','');this[_0x3552('0x35')][_0x3552('0xaa')](util['format'](_0x3552('0xf1'),_0x776274['text']));var _0xa46f42=this[_0x3552('0xf2')]['sync'](this,_0x776274);if(_0xa46f42){for(var _0x4e6c8e in _0xa46f42){if(_0xa46f42[_0x3552('0x92')](_0x4e6c8e)){if(_0x4e6c8e!=='providerResponse'){this[_0x3552('0x35')][_0x3552('0xa0')](util[_0x3552('0x54')]('DIALOGFLOW_%s',_0x4e6c8e[_0x3552('0x6b')]()),_0xa46f42[_0x4e6c8e]);}}}this[_0x3552('0x41')](_0xa46f42[_0x3552('0xe9')],_0x3552('0xf3'),_0x3552('0xeb'),_0xa46f42[_0x3552('0xf4')]);return this['channel'][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0xf5'),_0xa46f42[_0x3552('0xe9')]));}return this[_0x3552('0x35')][_0x3552('0x2b')](_0x776274,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x3552('0xf')][_0x3552('0xf6')]=function(_0x2a2241){logger['info'](util['format'](_0x3552('0xf7'),_0x2a2241[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x2a2241[_0x3552('0xf8')])){return this[_0x3552('0x35')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this[_0x3552('0x83')](_0x2a2241[_0x3552('0xf9')])){return this[_0x3552('0x35')][_0x3552('0xaa')]('no\x20username\x20configured');}if(!this[_0x3552('0x83')](_0x2a2241[_0x3552('0xfa')])){return this['channel'][_0x3552('0xaa')](_0x3552('0xfb'));}if(!this[_0x3552('0x83')](_0x2a2241[_0x3552('0xfc')])){return this[_0x3552('0x35')][_0x3552('0xaa')]('no\x20text\x20configured');}this[_0x3552('0x35')][_0x3552('0xe6')]=!![];this[_0x3552('0x34')](_0x2a2241);this[_0x3552('0x41')](_0x2a2241[_0x3552('0x5c')],'in','','');this['channel'][_0x3552('0xaa')](util[_0x3552('0x54')]('Trying\x20SestekNDA:\x20%s',_0x2a2241[_0x3552('0x5c')]));var _0x5ef2d3=this[_0x3552('0x7c')][_0x3552('0xa2')](this,_0x2a2241);if(_0x5ef2d3){for(var _0x4151a6 in _0x5ef2d3){if(_0x5ef2d3[_0x3552('0x92')](_0x4151a6)){this[_0x3552('0x35')][_0x3552('0xa0')](util[_0x3552('0x54')]('SESTEK_NDA_%s',_0x4151a6[_0x3552('0x6b')]()),_0x5ef2d3[_0x4151a6]);}}this['createSquareMessage'](_0x5ef2d3[_0x3552('0xe9')],_0x3552('0xf3'),_0x3552('0xf6'),'');if(_0x5ef2d3[_0x3552('0xfd')]){this[_0x3552('0x35')][_0x3552('0xaa')](util['format'](_0x3552('0xfe'),_0x5ef2d3[_0x3552('0xfd')]));var _0x4e30e6=this[_0x3552('0x35')][_0x3552('0xff')](_0x5ef2d3['audiofile']);try{fs[_0x3552('0x100')](_0x5ef2d3[_0x3552('0xfd')]+_0x3552('0x101'));}catch(_0x531f90){logger['error'](_0x531f90);}return _0x4e30e6;}else{return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x102'),_0x5ef2d3['speech']));}}return this[_0x3552('0x35')][_0x3552('0x2b')](_0x2a2241,_0x3552('0x103'));};AGIVertices['prototype'][_0x3552('0x104')]=function(_0x55f869){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x105'),_0x55f869['label']));return this['channel'][_0x3552('0xaa')](_0x3552('0x104'));};AGIVertices['prototype']['ext_dial']=function(_0x111ba8){logger[_0x3552('0x2d')](util['format'](_0x3552('0x106'),_0x111ba8[_0x3552('0x37')]));var _0x19022a='';if(_0x111ba8[_0x3552('0x107')]){if(!this[_0x3552('0x83')](_0x111ba8['trunk_id'])){return this[_0x3552('0x35')]['error'](_0x111ba8,'no\x20trunk\x20selected');}else{var _0x24b1aa=parseInt(_0x111ba8[_0x3552('0x107')],0xa);if(isNaN(_0x24b1aa)){_0x19022a=_0x111ba8[_0x3552('0x107')];}else{_0x19022a=this[_0x3552('0x108')][_0x3552('0xa2')](this,_0x111ba8[_0x3552('0x107')]);if(!_0x19022a){return this[_0x3552('0x35')]['error'](_0x111ba8,'no\x20trunk\x20found');}}}}else if(_0x111ba8[_0x3552('0x109')]){_0x19022a=_0x111ba8[_0x3552('0x109')];}else{return this[_0x3552('0x35')][_0x3552('0x2b')](_0x111ba8,_0x3552('0x10a'));}var _0x4fc515=this['channel']['exec']('DIAL',[util['format'](_0x3552('0x10b'),_0x19022a,_0x111ba8[_0x3552('0x46')]),_0x111ba8[_0x3552('0x67')],_0x111ba8[_0x3552('0x10c')],_0x111ba8[_0x3552('0x65')]]);if(_0x4fc515[_0x3552('0xa9')]===-0x1){return _0x4fc515;}return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')]('Executed\x20command\x20%s',_0x3552('0xe1')));};AGIVertices[_0x3552('0xf')][_0x3552('0x10d')]=function(_0x361560){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x10e'),_0x361560[_0x3552('0x37')]));return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0x10d'));};AGIVertices[_0x3552('0xf')]['getdigits']=function(_0x1cf174){logger[_0x3552('0x2d')](util[_0x3552('0x54')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x1cf174[_0x3552('0x37')]));if(_0x1cf174[_0x3552('0xa3')]===0x0){return this[_0x3552('0xa1')](_0x1cf174);}_0x1cf174[_0x3552('0xa3')]-=0x1;if(!this[_0x3552('0x83')](_0x1cf174[_0x3552('0x10f')])){return this[_0x3552('0x35')]['error'](_0x1cf174,_0x3552('0x110'));}var _0x26b2c6=this[_0x3552('0x111')][_0x3552('0xa2')](this,_0x1cf174[_0x3552('0x10f')]);if(!_0x26b2c6){return this['channel'][_0x3552('0x2b')](_0x1cf174,_0x3552('0x112'));}if(!this['isConfigured'](_0x1cf174['variable_id'])){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x3552('0xd5'));}var _0x5d0774=this[_0x3552('0x35')][_0x3552('0x113')](_0x26b2c6,_0x1cf174['response'],_0x1cf174[_0x3552('0x114')]);var _0x249eb1=_0x5d0774[_0x3552('0xa9')]?_0x5d0774[_0x3552('0xa9')][_0x3552('0x4b')]():'';logger[_0x3552('0x2d')](_0x3552('0x115'),JSON[_0x3552('0x74')](_0x5d0774));if(_0x5d0774[_0x3552('0xa9')]===-0x1){this['createSquareDetailsReport'][_0x3552('0xa2')](this,_0x1cf174,_0x249eb1);return _0x5d0774;}else if(_0x5d0774[_0x3552('0x9f')]===_0x3552('0x67')){_0x5d0774['result']=_0x249eb1[_0x3552('0x98')]>=parseInt(_0x1cf174[_0x3552('0x116')])?'x':'i';}else{_0x5d0774[_0x3552('0xa9')]=_0x249eb1['length']>=parseInt(_0x1cf174[_0x3552('0x116')])&&_0x249eb1[_0x3552('0x98')]<=parseInt(_0x1cf174[_0x3552('0x114')])?'x':'i';}var _0x3c71d8=this['getVariable'][_0x3552('0xa2')](this,_0x1cf174[_0x3552('0xd4')]);if(!_0x3c71d8){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x1cf174,_0x3552('0xd6'));}this['channel'][_0x3552('0xa0')](_0x3c71d8,_0x249eb1);if(this[_0x3552('0x83')](_0x1cf174[_0x3552('0x117')])){var _0xd9fade=parseInt(_0x1cf174[_0x3552('0x117')],0xa);var _0x588da1=rs[_0x3552('0x118')]({'charset':'*','length':_0xd9fade});var _0x2e765e=_0x249eb1['length'];if(_0x2e765e>0x0){if(_0x2e765e>_0xd9fade){this[_0x3552('0x34')]['sync'](this,_0x1cf174,_0x1cf174[_0x3552('0x119')]==='first'?_0x588da1+_0x249eb1['substr'](_0xd9fade):_0x249eb1[_0x3552('0x11a')](0x0,_0x2e765e-_0xd9fade)+_0x588da1);}else{this[_0x3552('0x34')][_0x3552('0xa2')](this,_0x1cf174,rs[_0x3552('0x118')]({'charset':'*','length':_0x2e765e}));}}else{this[_0x3552('0x34')][_0x3552('0xa2')](this,_0x1cf174,'');}}else{this[_0x3552('0x34')][_0x3552('0xa2')](this,_0x1cf174,_0x249eb1);}return _0x5d0774;};AGIVertices['prototype'][_0x3552('0xc')]=function(_0xae3534){logger[_0x3552('0x2d')](util['format'](_0x3552('0x11b'),_0xae3534[_0x3552('0x37')]));return this[_0x3552('0x11c')](_0xae3534);};AGIVertices[_0x3552('0xf')][_0x3552('0x11d')]=function(_0x4b66b8){logger[_0x3552('0x2d')](util[_0x3552('0x54')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x4b66b8['label']));this['createSquareDetailsReport'][_0x3552('0xa2')](this,_0x4b66b8,_0x4b66b8['goalname']);return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x11e'),_0x4b66b8[_0x3552('0x11f')]));};AGIVertices[_0x3552('0xf')]['awspolly']=function(_0x441227){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x120'),_0x441227[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x441227[_0x3552('0x8c')])||!this[_0x3552('0x83')](_0x441227[_0x3552('0x86')])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0x121'));}if(!this[_0x3552('0x83')](_0x441227['text'])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xa6'));}this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x122'),_0x441227[_0x3552('0x5c')]));var _0x2966f0=this['awsPolly']['sync'](this,_0x441227);if(_0x2966f0){this[_0x3552('0x35')]['noop'](util[_0x3552('0x54')](_0x3552('0x123'),_0x2966f0));var _0x39addb=this[_0x3552('0x35')][_0x3552('0xff')](_0x2966f0);try{fs[_0x3552('0x100')](_0x2966f0+_0x3552('0x101'));}catch(_0x1376b2){logger[_0x3552('0x2b')](_0x1376b2);}return _0x39addb;}return this[_0x3552('0x35')][_0x3552('0x2b')](_0x441227,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype']['awslex']=function(_0x10a48b){logger[_0x3552('0x2d')](util[_0x3552('0x54')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x10a48b['label']));if(!this['isConfigured'](_0x10a48b[_0x3552('0x8c')])||!this[_0x3552('0x83')](_0x10a48b['aws_secret_access_key'])){return this['channel'][_0x3552('0xaa')](_0x3552('0x121'));}if(!this[_0x3552('0x83')](_0x10a48b[_0x3552('0x124')])){return this[_0x3552('0x35')]['noop']('no\x20bot\x20name\x20configured');}if(!this[_0x3552('0x83')](_0x10a48b[_0x3552('0x5c')])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xa6'));}this['channel'][_0x3552('0xe6')]=!![];this['createSquareDetailsReport'](_0x10a48b);this[_0x3552('0x41')](_0x10a48b['text'],'in','','');this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x125'),_0x10a48b[_0x3552('0x5c')]));var _0x25b855=this[_0x3552('0x8b')][_0x3552('0xa2')](this,_0x10a48b);if(_0x25b855){for(var _0x1ad9ff in _0x25b855){if(_0x25b855[_0x3552('0x92')](_0x1ad9ff)&&_[_0x3552('0x93')](_0x25b855[_0x1ad9ff])){this[_0x3552('0x35')][_0x3552('0xa0')](util['format'](_0x3552('0x126'),_0x1ad9ff[_0x3552('0x6b')]()),_0x25b855[_0x1ad9ff]);}}if(_['isNil'](_0x25b855[_0x3552('0x76')])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0x127'));}else{this[_0x3552('0x41')](_0x25b855[_0x3552('0x76')],_0x3552('0xf3'),_0x3552('0x128'),'');return this['channel'][_0x3552('0xaa')](util[_0x3552('0x54')]('Amazon\x20Lex\x20Result\x20%s',_0x25b855['message']));}}return this[_0x3552('0x35')][_0x3552('0x2b')](_0x10a48b,_0x3552('0x129'));};AGIVertices['prototype'][_0x3552('0x12a')]=function(_0x1a5a79){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x12b'),_0x1a5a79[_0x3552('0x37')],_0x1a5a79[_0x3552('0x67')]));if(!this[_0x3552('0x83')](_0x1a5a79['key'])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xe5'));}var _0x1bd4e8=_0x3552('0x12c');var _0x380a8d=util[_0x3552('0x54')](_0x3552('0x12d'),FILES_PATH,rs['generate'](0x4));var _0x26b5c0=util[_0x3552('0x54')]('%s.%s',_0x380a8d,_0x1bd4e8);var _0x384e85=!![];if(_0x1a5a79[_0x3552('0x12e')]===_0x3552('0x12f')){_0x384e85=![];}var _0x2f1c6f=this[_0x3552('0x35')]['recordFile'](_0x380a8d,_0x1bd4e8,_0x1a5a79[_0x3552('0x130')],_0x1a5a79[_0x3552('0x67')],undefined,_0x384e85);if(_0x2f1c6f[_0x3552('0xa9')]!==-0x1){this['channel']['noop'](util[_0x3552('0x54')](_0x3552('0x131'),_0x26b5c0));var _0x42e59c=this[_0x3552('0x8e')][_0x3552('0xa2')](this,_0x1a5a79,_0x26b5c0);if(_0x42e59c){for(var _0x3a9a19 in _0x42e59c){if(_0x42e59c[_0x3552('0x92')](_0x3a9a19)){this[_0x3552('0x35')][_0x3552('0xa0')](util[_0x3552('0x54')](_0x3552('0x132'),_0x3a9a19[_0x3552('0x6b')]()),_0x42e59c[_0x3a9a19]);}}return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')]('GoogleASR\x20Result\x20%s',JSON[_0x3552('0x74')](_0x42e59c)));}}return _0x2f1c6f;};AGIVertices[_0x3552('0xf')][_0x3552('0x133')]=function(_0x40df2a){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x134'),_0x40df2a[_0x3552('0x37')]));if(!this['isConfigured'](_0x40df2a[_0x3552('0x90')])){return this[_0x3552('0x35')][_0x3552('0xaa')]('no\x20appid\x20configured');}if(!this[_0x3552('0x83')](_0x40df2a[_0x3552('0x135')])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0x136'));}var _0x16d465=_0x3552('0x12c');var _0x337ccf=util[_0x3552('0x54')](_0x3552('0x12d'),FILES_PATH,rs[_0x3552('0x118')](0x4));var _0x53af38=util[_0x3552('0x54')](_0x3552('0x9a'),_0x337ccf,_0x16d465);var _0x3e6a11=!![];if(_0x40df2a[_0x3552('0x12e')]===_0x3552('0x12f')){_0x3e6a11=![];}var _0x51cb19=this[_0x3552('0x35')][_0x3552('0x137')](_0x337ccf,_0x16d465,_0x40df2a['intKey'],_0x40df2a[_0x3552('0x67')],undefined,_0x3e6a11);if(_0x51cb19[_0x3552('0xa9')]!==-0x1){this[_0x3552('0x35')]['noop'](util['format']('tilde\x20%s\x20file\x20created',_0x53af38));var _0x592209=this[_0x3552('0x8f')][_0x3552('0xa2')](this,_0x40df2a,_0x53af38);if(_0x592209){for(var _0x49f7ff in _0x592209){if(_0x592209[_0x3552('0x92')](_0x49f7ff)){this[_0x3552('0x35')]['setVariable'](util[_0x3552('0x54')](_0x3552('0x138'),_0x49f7ff[_0x3552('0x6b')]()),_0x592209[_0x49f7ff]);}}return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x139'),JSON[_0x3552('0x74')](_0x592209)));}}return _0x51cb19;};AGIVertices[_0x3552('0xf')][_0x3552('0x13a')]=function(_0xd9c2ab){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x13b'),_0xd9c2ab[_0x3552('0x37')]));return this[_0x3552('0x35')][_0x3552('0x13c')](_0xd9c2ab[_0x3552('0x3d')],_0xd9c2ab[_0x3552('0x3e')],_0xd9c2ab['priority']);};AGIVertices[_0x3552('0xf')]['gotoif']=function(_0x148eca){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x13d'),_0x148eca[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x148eca[_0x3552('0x13e')])){return this[_0x3552('0x35')]['error'](_0x148eca,_0x3552('0x13f'));}try{var _0x595bc2=eval(_0x148eca[_0x3552('0x13e')])?_0x3552('0x140'):'false';this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x141'),_0x148eca['condition'],_0x595bc2));return{'code':0xc8,'result':_0x595bc2};}catch(_0x40e5a0){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x3552('0xf')][_0x3552('0x142')]=function(_0x465bd9){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x143'),_0x465bd9[_0x3552('0x37')]));if(!this['isConfigured'](_0x465bd9[_0x3552('0x144')])){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x465bd9,_0x3552('0x145'));}var _0x292a1e=this['getIntervals'][_0x3552('0xa2')](this,_0x465bd9['interval_id']);if(!_0x292a1e){return this[_0x3552('0x35')]['error'](_0x465bd9,_0x3552('0x146'));}for(var _0x26cb03=0x0;_0x26cb03<_0x292a1e[_0x3552('0x98')];_0x26cb03+=0x1){var _0x744a76=this[_0x3552('0x35')][_0x3552('0x10')](util['format']('IFTIME(%s?true:false)',_0x292a1e[_0x26cb03]));if(_0x744a76[_0x3552('0xa9')]===-0x1){return _0x744a76;}logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x147'),_0x292a1e[_0x26cb03],_0x744a76[_0x3552('0x9f')]));if(_0x744a76[_0x3552('0x9f')]===_0x3552('0x140')){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x147'),_0x292a1e[_0x26cb03],_0x3552('0x140')));this['channel']['noop'](util[_0x3552('0x54')]('IFTIME\x20%s\x20%s',_0x292a1e[_0x26cb03],'true'));return{'code':0xc8,'result':_0x3552('0x140')};}else{logger[_0x3552('0x2d')](util[_0x3552('0x54')]('IFTIME\x20%s\x20%s',_0x292a1e[_0x26cb03],_0x3552('0x148')));this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x147'),_0x292a1e[_0x26cb03],'false'));}}return{'code':0xc8,'result':_0x3552('0x148')};};AGIVertices[_0x3552('0xf')][_0x3552('0x149')]=function(_0x3a6d0b){logger['info'](util[_0x3552('0x54')](_0x3552('0x14a'),_0x3a6d0b[_0x3552('0x37')]));return this[_0x3552('0x35')][_0x3552('0x149')]();};AGIVertices['prototype'][_0x3552('0x14b')]=function(_0x113399){logger[_0x3552('0x2d')](util[_0x3552('0x54')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x113399[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x113399['key'])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xe5'));}var _0x42cec5=_0x3552('0x12c');var _0xee71d7=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x1edfec=util['format'](_0x3552('0x9a'),_0xee71d7,_0x42cec5);var _0x248f3e=!![];if(_0x113399[_0x3552('0x12e')]===_0x3552('0x12f')){_0x248f3e=![];}var _0x3e92b1=this[_0x3552('0x35')][_0x3552('0x137')](_0xee71d7,_0x42cec5,_0x113399['intKey'],_0x113399['timeout'],undefined,_0x248f3e);if(_0x3e92b1[_0x3552('0xa9')]!==-0x1){this[_0x3552('0x35')]['noop'](util[_0x3552('0x54')](_0x3552('0x14c'),_0x1edfec));var _0xc286eb=this['ispeechASR'][_0x3552('0xa2')](this,_0x113399,_0x1edfec);if(_0xc286eb){for(var _0xe9feb3 in _0xc286eb){if(_0xc286eb[_0x3552('0x92')](_0xe9feb3)){this[_0x3552('0x35')][_0x3552('0xa0')](util[_0x3552('0x54')](_0x3552('0x14d'),_0xe9feb3['toUpperCase']()),_0xc286eb[_0xe9feb3]);}}return this['channel'][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x14e'),JSON[_0x3552('0x74')](_0xc286eb)));}}return _0x3e92b1;};AGIVertices['prototype'][_0x3552('0x14f')]=function(_0x1d86a7){logger['info'](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x1d86a7[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x1d86a7[_0x3552('0x7e')])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xe5'));}if(!this[_0x3552('0x83')](_0x1d86a7['text'])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xa6'));}this['channel'][_0x3552('0xaa')](util[_0x3552('0x54')]('Trying\x20ispeech\x20TTS\x20%s',_0x1d86a7['text']));var _0x34ef65=this[_0x3552('0x7d')]['sync'](this,_0x1d86a7);if(_0x34ef65){this[_0x3552('0x35')]['noop'](util[_0x3552('0x54')](_0x3552('0x14c'),_0x34ef65));var _0x509add=this[_0x3552('0x35')][_0x3552('0xff')](_0x34ef65,_0x1d86a7['intKey']);try{fs['unlink'](_0x34ef65+'.wav');}catch(_0x29ff54){logger[_0x3552('0x2b')](_0x29ff54);}return _0x509add;}return this['channel'][_0x3552('0x2b')](_0x1d86a7,_0x3552('0x150'));};AGIVertices[_0x3552('0xf')]['login']=function(_0x3e8287){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x151'),_0x3e8287['label']));if(!this[_0x3552('0x83')](_0x3e8287[_0x3552('0x152')])){return this['channel'][_0x3552('0x2b')](_0x3e8287,_0x3552('0x153'));}logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x154'),this[_0x3552('0x35')][_0x3552('0x3b')],_0x3e8287[_0x3552('0x152')]));var _0x534b57=this[_0x3552('0x52')]['sync'](this,_0x3e8287[_0x3552('0x152')]);if(_0x534b57){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x155'),this[_0x3552('0x35')][_0x3552('0x3b')],_0x3e8287[_0x3552('0x152')]));this['channel'][_0x3552('0xaa')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x3552('0x35')][_0x3552('0x3b')],_0x3e8287['findBy']));return{'code':0xc8,'result':_0x3552('0x156')};}else{logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x157'),this[_0x3552('0x35')][_0x3552('0x3b')],_0x3e8287[_0x3552('0x152')]));this[_0x3552('0x35')][_0x3552('0xaa')](util['format'](_0x3552('0x157'),this['channel'][_0x3552('0x3b')],_0x3e8287[_0x3552('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x3552('0xf')][_0x3552('0x158')]=function(_0x26b7c6){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x159'),_0x26b7c6['label']));if(!this[_0x3552('0x83')](_0x26b7c6['findBy'])){return this[_0x3552('0x35')]['error'](_0x26b7c6,'no\x20find\x20by\x20configured');}logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x154'),this[_0x3552('0x35')][_0x3552('0x3b')],_0x26b7c6['findBy']));var _0x94e580=this['agentLogout']['sync'](this,_0x26b7c6[_0x3552('0x152')]);if(_0x94e580){logger['info'](util[_0x3552('0x54')](_0x3552('0x155'),this[_0x3552('0x35')]['callerid'],_0x26b7c6[_0x3552('0x152')]));this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x155'),this['channel'][_0x3552('0x3b')],_0x26b7c6[_0x3552('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x157'),this['channel']['callerid'],_0x26b7c6[_0x3552('0x152')]));this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x157'),this[_0x3552('0x35')][_0x3552('0x3b')],_0x26b7c6['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x3552('0xf')][_0x3552('0x15a')]=function(_0x56173e){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x15b'),_0x56173e[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x56173e[_0x3552('0x15c')])){return this['channel'][_0x3552('0x2b')](_0x56173e,_0x3552('0x15d'));}this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x15e'),_0x56173e[_0x3552('0x15c')]));var _0x520a47=eval(_0x56173e['operation']);if(!this[_0x3552('0x83')](_0x56173e['variable_id'])){return this['channel'][_0x3552('0xaa')](_0x3552('0xd5'));}var _0x53acba=this[_0x3552('0x10')][_0x3552('0xa2')](this,_0x56173e[_0x3552('0xd4')]);if(!_0x53acba){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x56173e,_0x3552('0xd6'));}if(_[_0x3552('0x9b')](_0x520a47)){var _0x20ee69=this;_0x520a47[_0x3552('0xd7')](function(_0x5abe54,_0x1d425c){_0x20ee69['channel'][_0x3552('0xa0')](util[_0x3552('0x54')](_0x3552('0x15f'),_0x53acba,_0x1d425c),_0x5abe54);});return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x160'),_0x53acba));}else{return this['channel'][_0x3552('0xa0')](_0x53acba,_0x520a47);}};AGIVertices[_0x3552('0xf')][_0x3552('0xb')]=function(_0x45cc9d){logger['info'](util[_0x3552('0x54')](_0x3552('0x161'),_0x45cc9d[_0x3552('0x37')]));if(_0x45cc9d[_0x3552('0xa3')]===0x0){return this[_0x3552('0xa1')](_0x45cc9d);}_0x45cc9d[_0x3552('0xa3')]-=0x1;if(!this[_0x3552('0x83')](_0x45cc9d['file_id'])){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x45cc9d,'no\x20file\x20audio\x20selected');}var _0x380735=this[_0x3552('0x111')][_0x3552('0xa2')](this,_0x45cc9d[_0x3552('0x10f')]);if(!_0x380735){return this['channel'][_0x3552('0x2b')](_0x45cc9d,_0x3552('0x112'));}var _0x14068a=this[_0x3552('0x35')][_0x3552('0x113')](_0x380735,_0x45cc9d[_0x3552('0x162')],_0x45cc9d[_0x3552('0x163')]);var _0x48a5bf=_0x14068a['result'];if(_0x14068a[_0x3552('0xa9')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x45cc9d,'-1');return _0x14068a;}else if(_0x14068a[_0x3552('0x9f')]===_0x3552('0x67')){_0x14068a[_0x3552('0xa9')]=_0x14068a[_0x3552('0xa9')][_0x3552('0x98')]>0x0?_0x14068a[_0x3552('0xa9')]:'t';}else if(_[_0x3552('0x164')](_0x14068a[_0x3552('0xa9')])){_0x14068a[_0x3552('0xa9')]='#';_0x48a5bf='#';}if(!this['isConfigured'](_0x45cc9d['variable_id'])){this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xd5'));}else{var _0x5017fb=this[_0x3552('0x10')][_0x3552('0xa2')](this,_0x45cc9d[_0x3552('0xd4')]);if(!_0x5017fb){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x45cc9d,_0x3552('0xd6'));}this[_0x3552('0x35')]['setVariable'](_0x5017fb,_0x48a5bf);}this['createSquareDetailsReport'][_0x3552('0xa2')](this,_0x45cc9d,_0x48a5bf);return _0x14068a;};AGIVertices['prototype']['noop']=function(_0x4c59d3){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x165'),_0x4c59d3[_0x3552('0x37')]));return this[_0x3552('0x35')][_0x3552('0xaa')](_0x4c59d3[_0x3552('0x166')]||_0x4c59d3[_0x3552('0x37')]);};AGIVertices['prototype'][_0x3552('0x167')]=function(_0x5cbdea){logger[_0x3552('0x2d')](util['format'](_0x3552('0x168'),_0x5cbdea[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x5cbdea[_0x3552('0x152')])){return this['channel'][_0x3552('0x2b')](_0x5cbdea,'no\x20find\x20by\x20configured');}logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x154'),this[_0x3552('0x35')][_0x3552('0x3b')],_0x5cbdea[_0x3552('0x152')]));var _0x59cd40=this[_0x3552('0x169')][_0x3552('0xa2')](this,_0x5cbdea[_0x3552('0x16a')]);var _0x35adbf=this['agentPause'][_0x3552('0xa2')](this,_0x5cbdea[_0x3552('0x152')],_0x59cd40);if(_0x35adbf){logger[_0x3552('0x2d')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x3552('0x35')]['callerid'],_0x5cbdea[_0x3552('0x152')]));this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3552('0x35')][_0x3552('0x3b')],_0x5cbdea['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3552('0x35')][_0x3552('0x3b')],_0x5cbdea[_0x3552('0x152')]));this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x155'),this[_0x3552('0x35')][_0x3552('0x3b')],_0x5cbdea[_0x3552('0x152')]));return{'code':0xc8,'result':_0x3552('0x16b')};}};AGIVertices[_0x3552('0xf')][_0x3552('0x16c')]=function(_0x18aefc){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x16d'),_0x18aefc[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x18aefc[_0x3552('0x10f')])){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x18aefc,_0x3552('0x110'));}var _0x5e3e1a=this[_0x3552('0x111')]['sync'](this,_0x18aefc[_0x3552('0x10f')]);if(!_0x5e3e1a){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x18aefc,'no\x20file\x20audio\x20found');}var _0x1b8ede=this[_0x3552('0x35')][_0x3552('0xa7')](_0x3552('0x16e'),[_0x5e3e1a,_0x18aefc['opts']]);if(_0x1b8ede[_0x3552('0xa9')]===-0x1){return _0x1b8ede;}return this[_0x3552('0x35')]['noop'](util['format'](_0x3552('0xc4'),_0x3552('0x16e'),_0x5e3e1a));};AGIVertices[_0x3552('0xf')]['queue']=function(_0x3c02d9){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x16f'),_0x3c02d9[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x3c02d9[_0x3552('0x170')])){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x3c02d9,'no\x20queue\x20selected');}var _0x1d0aca='';var _0x3cc596=parseInt(_0x3c02d9[_0x3552('0x170')],0xa);if(isNaN(_0x3cc596)){_0x1d0aca=_0x3c02d9[_0x3552('0x170')];}else{_0x1d0aca=this[_0x3552('0x14')]['sync'](this,_0x3c02d9[_0x3552('0x170')]);if(!_0x1d0aca){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x3c02d9,_0x3552('0x171'));}}var _0x506dc2='';if(this[_0x3552('0x83')](_0x3c02d9[_0x3552('0x10f')])){var _0x2a32b2=this['getSound']['sync'](this,_0x3c02d9[_0x3552('0x10f')]);if(_0x2a32b2){_0x506dc2=_0x2a32b2;}}this[_0x3552('0x34')]['sync'](this,_0x3c02d9,_0x1d0aca);if(_0x3c02d9[_0x3552('0x10c')][_0x3552('0x172')]('x')<0x0){_0x3c02d9[_0x3552('0x10c')]+='x';}if(_0x3c02d9['opts'][_0x3552('0x172')]('X')<0x0){_0x3c02d9[_0x3552('0x10c')]+='X';}this[_0x3552('0x35')][_0x3552('0xa0')](_0x3552('0x173'),_0x1d0aca?_0x1d0aca['toLowerCase']():'');var _0x5059df=this[_0x3552('0x35')][_0x3552('0xa7')]('QUEUE',[_0x1d0aca,_0x3c02d9[_0x3552('0x10c')],_0x3c02d9['url'],_0x506dc2,_0x3c02d9[_0x3552('0x67')],_0x3c02d9[_0x3552('0x8')],_0x3c02d9[_0x3552('0x174')],_0x3c02d9['gosub'],'',_0x3c02d9[_0x3552('0x175')]]);if(_0x5059df[_0x3552('0xa9')]===-0x1){return _0x5059df;}return this['channel']['noop'](util['format'](_0x3552('0xc4'),_0x3552('0x176'),_0x1d0aca));};AGIVertices[_0x3552('0xf')][_0x3552('0x177')]=function(_0x307f8d){logger['info'](util[_0x3552('0x54')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x307f8d[_0x3552('0x37')]));var _0x353a8b=_0x307f8d[_0x3552('0x178')]||_0x3552('0x12c');var _0x4c0bf9=util[_0x3552('0x54')](_0x3552('0x179'),this[_0x3552('0x35')][_0x3552('0x36')],rs[_0x3552('0x118')](0x5));var _0x37ae9c=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x4c0bf9,_0x353a8b);var _0x50c30c=util[_0x3552('0x54')](_0x3552('0x12d'),FILES_PATH,_0x4c0bf9);this[_0x3552('0x3a')]['sync'](this,_0x307f8d,_0x4c0bf9,_0x37ae9c);this['channel'][_0x3552('0xa0')](_0x3552('0x17a'),_0x4c0bf9);logger[_0x3552('0x2d')](_0x3552('0x17b'),_0x50c30c,_0x353a8b,_0x307f8d[_0x3552('0x17c')],_0x307f8d['timeout']);return this[_0x3552('0x35')]['recordFile'](_0x50c30c,_0x353a8b,_0x307f8d['escape_digits'],_0x307f8d['timeout'],undefined,!![]);};AGIVertices['prototype'][_0x3552('0x17d')]=function(_0x10a2f4){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x17e'),_0x10a2f4[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x10a2f4[_0x3552('0x65')])){return this[_0x3552('0x35')]['noop']('no\x20url\x20configured');}var _0x4324b5=this[_0x3552('0x17f')]['sync'](this,_0x10a2f4);logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x180'),util[_0x3552('0x181')](_0x4324b5,{'showHidden':![],'depth':null})));if(!this[_0x3552('0x83')](_0x10a2f4[_0x3552('0xd4')])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0x182'));}var _0x4c7b4e=this['getVariable']['sync'](this,_0x10a2f4[_0x3552('0xd4')]);if(!_0x4c7b4e){return this['channel']['error'](_0x10a2f4,_0x3552('0xd6'));}this['channel'][_0x3552('0xa0')](util[_0x3552('0x54')](_0x3552('0x183'),_0x4c7b4e),_0x4324b5[_0x3552('0x75')]?_0x4324b5[_0x3552('0x75')]:_0x3552('0x184'));this[_0x3552('0x35')][_0x3552('0xa0')](util['format'](_0x3552('0x185'),_0x4c7b4e),_0x4324b5[_0x3552('0x186')]?_0x4324b5[_0x3552('0x186')]:'OK');if(_0x4324b5[_0x3552('0x6c')]){try{this[_0x3552('0x99')](_0x4324b5[_0x3552('0x6c')],_0x4c7b4e);}catch(_0x2610f3){logger[_0x3552('0x2b')](util[_0x3552('0x54')](_0x3552('0x187'),_0x4c7b4e));}}return this[_0x3552('0x35')]['noop'](util[_0x3552('0x54')](_0x3552('0xda'),_0x4c7b4e));};AGIVertices['prototype'][_0x3552('0x188')]=function(_0x448192){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x189'),_0x448192[_0x3552('0x37')]));return this['channel'][_0x3552('0x18a')](_0x448192[_0x3552('0x18b')]['replace'](/\s+/g,''),_0x448192[_0x3552('0x17c')]);};AGIVertices['prototype'][_0x3552('0x18c')]=function(_0x52cea5){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x18d'),_0x52cea5['label']));return this['channel'][_0x3552('0x18e')](_0x52cea5[_0x3552('0x66')]['replace'](/\s+/g,''),_0x52cea5[_0x3552('0x17c')]);};AGIVertices[_0x3552('0xf')][_0x3552('0x18f')]=function(_0x3574b2){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x190'),_0x3574b2[_0x3552('0x37')]));return this['channel'][_0x3552('0x191')](_0x3574b2[_0x3552('0x5c')],_0x3574b2[_0x3552('0x17c')]);};AGIVertices[_0x3552('0xf')][_0x3552('0x192')]=function(_0x262c08){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x193'),_0x262c08['label']));if(!this[_0x3552('0x83')](_0x262c08[_0x3552('0x194')])){return this[_0x3552('0x35')][_0x3552('0xaa')]('no\x20mail\x20account\x20configured');}var _0x52a473=this[_0x3552('0x1f')][_0x3552('0xa2')](this,_0x262c08[_0x3552('0x194')]);if(!_0x52a473||!_0x52a473[_0x3552('0x195')]){return this['channel']['error'](_0x262c08,_0x3552('0x196'));}var _0x428722={'from':util[_0x3552('0x54')]('\x22%s\x22\x20<%s>',_0x52a473['name'],_0x52a473[_0x3552('0x197')]||_0x52a473[_0x3552('0x195')][_0x3552('0x198')]),'to':_0x262c08['to']||'','cc':_0x262c08['cc']||'','bcc':_0x262c08[_0x3552('0x199')]||'','subject':_0x262c08['subject'],'html':_0x262c08['text'],'text':_0x262c08[_0x3552('0x5c')]};var _0x3995be={'tls':{'rejectUnauthorized':![]}};if(_0x52a473['Smtp'][_0x3552('0x19a')]){_0x3995be[_0x3552('0x19a')]=_0x52a473['Smtp']['service'];}else{_0x3995be[_0x3552('0x19b')]=_0x52a473[_0x3552('0x195')][_0x3552('0x19b')];_0x3995be['port']=_0x52a473[_0x3552('0x195')]['port'];_0x3995be[_0x3552('0x19c')]=_0x52a473[_0x3552('0x195')]['secure'];}if(_0x52a473[_0x3552('0x195')][_0x3552('0x19d')]){_0x3995be['auth']={'user':_0x52a473[_0x3552('0x195')][_0x3552('0x198')],'pass':_0x52a473[_0x3552('0x195')][_0x3552('0x19e')]};}if(this[_0x3552('0x83')](_0x262c08[_0x3552('0x19f')])){}logger[_0x3552('0x1a0')]('sendMail\x20message',JSON['stringify'](_0x428722));this[_0x3552('0x34')][_0x3552('0xa2')](this,_0x262c08,_0x262c08['account_id']);this[_0x3552('0x35')][_0x3552('0xaa')](util['format'](_0x3552('0x1a1'),_0x52a473[_0x3552('0x13')]));this['sendMailMessage']['sync'](this,_0x3995be,_0x428722);return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0x1a2'));};AGIVertices[_0x3552('0xf')][_0x3552('0x1a3')]=function(_0x43f822){logger[_0x3552('0x2d')](util['format'](_0x3552('0x1a4'),_0x43f822[_0x3552('0x37')]));return this[_0x3552('0x35')]['noop'](_0x3552('0x1a5'));};AGIVertices[_0x3552('0xf')]['sendSMS']=function(_0x39ce96){logger[_0x3552('0x2d')](util['format'](_0x3552('0x1a6'),_0x39ce96[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x39ce96[_0x3552('0x1a7')])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0x1a8'));}var _0x4f5a6f=this['getSmsAccount'][_0x3552('0xa2')](this,_0x39ce96[_0x3552('0x1a7')]);if(!_0x4f5a6f){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x39ce96,_0x3552('0x1a9'));}var _0xefbad9={'body':_0x39ce96[_0x3552('0x1aa')],'phone':_0x39ce96['to']||'','SmsAccountId':_0x4f5a6f['id']};logger[_0x3552('0x1a0')](_0x3552('0x1ab'),JSON[_0x3552('0x74')](_0xefbad9));this[_0x3552('0x34')][_0x3552('0xa2')](this,_0x39ce96,_0x39ce96[_0x3552('0x1a7')]);this[_0x3552('0x35')]['noop'](util[_0x3552('0x54')](_0x3552('0x1ac'),_0x4f5a6f[_0x3552('0x13')]));this[_0x3552('0x33')][_0x3552('0xa2')](this,_0xefbad9);return this['channel']['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x3552('0xf')]['set']=function(_0x20a25c){logger[_0x3552('0x2d')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x20a25c['label']));if(!this['isConfigured'](_0x20a25c[_0x3552('0xd4')])){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x20a25c,_0x3552('0x1ad'));}var _0x2264aa=this['getVariable'][_0x3552('0xa2')](this,_0x20a25c['variable_id']);if(!_0x2264aa){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x20a25c,_0x3552('0xd6'));}return this[_0x3552('0x35')][_0x3552('0xa0')](_0x2264aa,_0x20a25c[_0x3552('0x1ae')]);};AGIVertices['prototype'][_0x3552('0x1af')]=function(_0x1192fc){logger['info'](util[_0x3552('0x54')]('Enter\x20in\x20START\x20(%s)\x20block',_0x1192fc['label']));this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0x1b0'));if(_0x1192fc[_0x3552('0xba')]==='yes'){this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0x1b1'));return this[_0x3552('0x35')][_0x3552('0xba')]();}return this[_0x3552('0x35')][_0x3552('0xaa')]('Skipped\x20Answer');};AGIVertices[_0x3552('0xf')][_0x3552('0x1b2')]=function(_0x39825e){logger['info'](util[_0x3552('0x54')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x39825e['label']));if(!this[_0x3552('0x83')](_0x39825e[_0x3552('0x1b3')])){return this['channel'][_0x3552('0x2b')](_0x39825e,_0x3552('0x1b4'));}var _0x413d79=this[_0x3552('0x17')][_0x3552('0xa2')](this,_0x39825e[_0x3552('0x1b3')]);if(!this[_0x3552('0x83')](_0x413d79)){return this[_0x3552('0x35')]['error'](_0x39825e,util[_0x3552('0x54')](_0x3552('0x1b5'),_0x39825e[_0x3552('0x1b3')]));}if(_0x413d79===this[_0x3552('0x35')]['arg_1']){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x39825e,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x3552('0x34')]['sync'](this,_0x39825e,_0x413d79);var _0x1ba80f=this[_0x3552('0x35')][_0x3552('0xa7')](_0x3552('0x1b6'),util[_0x3552('0x54')](_0x3552('0x1b7'),config[_0x3552('0x8')]['host']||_0x3552('0x1b8'),_0x413d79,this[_0x3552('0x35')][_0x3552('0x39')]));if(_0x1ba80f['result']===-0x1){return _0x1ba80f;}return this['channel']['noop'](util[_0x3552('0x54')]('Executed\x20command\x20%s\x20%s',_0x3552('0x1b6'),_0x413d79));};AGIVertices[_0x3552('0xf')][_0x3552('0x1b9')]=function(_0x307a3c){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x1ba'),_0x307a3c[_0x3552('0x37')]));var _0x4d2459=this[_0x3552('0x56')]['sync'](this,_0x307a3c[_0x3552('0xb8')]);this[_0x3552('0x34')][_0x3552('0xa2')](this,_0x307a3c,_0x307a3c[_0x3552('0xb8')]);if(this[_0x3552('0x83')](_0x307a3c[_0x3552('0xd4')])){var _0x5d9258=this[_0x3552('0x10')][_0x3552('0xa2')](this,_0x307a3c[_0x3552('0xd4')]);if(_0x5d9258){this[_0x3552('0x35')][_0x3552('0xa0')](_0x5d9258,_0x4d2459);return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x1bb'),_0x307a3c[_0x3552('0xb8')],_0x5d9258));}}return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x1bc'),_0x307a3c['command']));};AGIVertices[_0x3552('0xf')][_0x3552('0x1bd')]=function(_0x54f44a){logger[_0x3552('0x2d')](util['format'](_0x3552('0x1be'),_0x54f44a[_0x3552('0x37')]));_0x54f44a['text']=_0x54f44a[_0x3552('0x5c')][_0x3552('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x54f44a[_0x3552('0x5a')])){return this[_0x3552('0x35')][_0x3552('0xaa')]('no\x20apiKey\x20configured');}if(!this[_0x3552('0x83')](_0x54f44a[_0x3552('0x5c')])){return this[_0x3552('0x35')][_0x3552('0xaa')]('no\x20text\x20configured');}this['channel'][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x1bf'),_0x54f44a[_0x3552('0x5c')]));var _0x58c12c=this[_0x3552('0x59')][_0x3552('0xa2')](this,_0x54f44a);if(_0x58c12c){this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x1c0'),_0x58c12c));var _0x583b6f=this[_0x3552('0x35')]['streamFile'](_0x58c12c);try{fs['unlink'](_0x58c12c+'.wav');}catch(_0x942796){logger[_0x3552('0x2b')](_0x942796);}return _0x583b6f;}return this[_0x3552('0x35')][_0x3552('0x2b')](_0x54f44a,_0x3552('0x1c1'));};AGIVertices[_0x3552('0xf')][_0x3552('0x1c2')]=function(_0x3b5537){logger['info'](util[_0x3552('0x54')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x3b5537[_0x3552('0x37')]));_0x3b5537[_0x3552('0x5c')]=_0x3b5537[_0x3552('0x5c')][_0x3552('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3552('0x83')](_0x3b5537[_0x3552('0x5c')])){return this['channel']['noop'](_0x3552('0xa6'));}this[_0x3552('0x35')]['noop'](util['format'](_0x3552('0x1c3'),_0x3b5537[_0x3552('0x5c')]));var _0x3412e9=this[_0x3552('0x63')]['sync'](this,_0x3b5537);if(_0x3412e9){this[_0x3552('0x35')]['noop'](util[_0x3552('0x54')](_0x3552('0x1c4'),_0x3412e9));var _0x282e0e=this[_0x3552('0x35')][_0x3552('0xff')](_0x3412e9);try{fs[_0x3552('0x100')](_0x3412e9+'.wav');}catch(_0x1539dc){logger[_0x3552('0x2b')](_0x1539dc);}return _0x282e0e;}return this[_0x3552('0x35')][_0x3552('0x2b')](_0x3b5537,_0x3552('0x1c5'));};AGIVertices[_0x3552('0xf')]['unpause']=function(_0x346028){logger[_0x3552('0x2d')](util['format'](_0x3552('0x1c6'),_0x346028['label']));if(!this[_0x3552('0x83')](_0x346028[_0x3552('0x152')])){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x346028,'no\x20find\x20by\x20configured');}logger['info'](util[_0x3552('0x54')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x3552('0x35')][_0x3552('0x3b')],_0x346028[_0x3552('0x152')]));var _0x3a937=this[_0x3552('0x4f')][_0x3552('0xa2')](this,_0x346028[_0x3552('0x152')]);if(_0x3a937){logger[_0x3552('0x2d')](util[_0x3552('0x54')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3552('0x35')]['callerid'],_0x346028[_0x3552('0x152')]));this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x155'),this['channel'][_0x3552('0x3b')],_0x346028[_0x3552('0x152')]));return{'code':0xc8,'result':_0x3552('0x156')};}else{logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x157'),this['channel'][_0x3552('0x3b')],_0x346028[_0x3552('0x152')]));this[_0x3552('0x35')][_0x3552('0xaa')](util['format'](_0x3552('0x157'),this[_0x3552('0x35')]['callerid'],_0x346028[_0x3552('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['voicemail']=function(_0x471edc){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x1c7'),_0x471edc[_0x3552('0x37')]));var _0x143e23=this[_0x3552('0x35')][_0x3552('0xa7')](_0x3552('0x1c8'),[_0x471edc[_0x3552('0x1c9')],_0x471edc[_0x3552('0x78')]]);if(_0x143e23[_0x3552('0xa9')]===-0x1){return _0x143e23;}return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0xc4'),_0x3552('0x1c8'),_0x471edc[_0x3552('0x1c9')]));};AGIVertices[_0x3552('0xf')][_0x3552('0x1ca')]=function(_0xe7b23c){logger[_0x3552('0x2d')](util['format'](_0x3552('0x1cb'),_0xe7b23c['label']));if(!this['isConfigured'](_0xe7b23c['variable_id'])){return this[_0x3552('0x35')][_0x3552('0x2b')](_0xe7b23c,_0x3552('0x1ad'));}var _0x41038a=this[_0x3552('0x10')][_0x3552('0xa2')](this,_0xe7b23c[_0x3552('0xd4')]);if(!_0x41038a){return this[_0x3552('0x35')]['error'](_0xe7b23c,_0x3552('0xd6'));}var _0x512b7d=this[_0x3552('0x35')][_0x3552('0x10')](_0x41038a);return{'code':0xc8,'result':_0x512b7d['extra']?_0x512b7d[_0x3552('0x9f')]:'-'};};String['prototype'][_0x3552('0x9d')]=function(_0x57a054,_0x2982e8){return this[_0x3552('0x9c')](_0x57a054)[_0x3552('0x1cc')](_0x2982e8);};module[_0x3552('0x1cd')]=AGIVertices; \ No newline at end of file +var _0x464a=['noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','getAndSetVariable','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','speech','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','sesteknda','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','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','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','isString','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','googleasr','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','gotoc','gotoif','no\x20condition\x20configured','condition','true','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','false','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeechTTS','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','Enter\x20in\x20MATH\x20(%s)\x20block','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','macro','gosub','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusCode','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','pass','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','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','START\x20CALLY\x20SQUARE','yes','Answer','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','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','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','path','util','lodash','shelljs','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getsecretdigits','channel','rpc','mailRpc','prototype','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareOdbcById','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','Intervals','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','LOCAL','shellCommand','exec','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','url','method','timeout','number','POST','PUT','toUpperCase','parse','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','message','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','includes','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','saveRestApiResult','%s.%s','length','setVariable','split','getVariable','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block'];(function(_0x30584a,_0x43c31c){var _0x39532d=function(_0xeff0d4){while(--_0xeff0d4){_0x30584a['push'](_0x30584a['shift']());}};_0x39532d(++_0x43c31c);}(_0x464a,0x127));var _0xa464=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x464a[_0x2dafbe];return _0x58a45a;};'use strict';var fs=require('fs');var path=require(_0xa464('0x0'));var util=require(_0xa464('0x1'));var _=require(_0xa464('0x2'));var sh=require(_0xa464('0x3'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0xa464('0x4'));var Mustache=require(_0xa464('0x5'));var rp=require(_0xa464('0x6'));var logger=require(_0xa464('0x7'))(_0xa464('0x8'));var config=require(_0xa464('0x9'));var scripts=require(_0xa464('0xa'));var FILES_PATH=_0xa464('0xb');var recursiveMapAttributes=[_0xa464('0xc'),'rawBody'];var verticesWithRetry=[_0xa464('0xd'),'getdigits',_0xa464('0xe')];var AGIVertices=function(_0x45cd82,_0x2c1e6f,_0xa5e9a9){this[_0xa464('0xf')]=_0x45cd82;this[_0xa464('0x10')]=_0x2c1e6f;this[_0xa464('0x11')]=_0xa5e9a9;};AGIVertices[_0xa464('0x12')]['getVariable']=function(_0x1c5b98,_0x298116){this['rpc'][_0xa464('0x13')](_0x1c5b98)[_0xa464('0x14')](function(_0x15e4a8){_0x298116(null,_0x15e4a8?_0x15e4a8[_0xa464('0x15')]:![]);})['catch'](function(_0x87fe79){_0x298116(_0x87fe79);});};AGIVertices[_0xa464('0x12')][_0xa464('0x16')]=function(_0xe778d6,_0xaa15f){this[_0xa464('0x10')][_0xa464('0x17')](_0xe778d6)[_0xa464('0x14')](function(_0x1da3aa){_0xaa15f(null,_0x1da3aa?_0x1da3aa[_0xa464('0x15')]:![]);})[_0xa464('0x18')](function(_0x4558a9){_0xaa15f(_0x4558a9);});};AGIVertices['prototype'][_0xa464('0x19')]=function(_0x2c6627,_0x4661de){this[_0xa464('0x10')]['getSquareProjectById'](_0x2c6627)[_0xa464('0x14')](function(_0x3663ea){_0x4661de(null,_0x3663ea?_0x3663ea[_0xa464('0x15')]:![]);})[_0xa464('0x18')](function(_0xc122f){_0x4661de(_0xc122f);});};AGIVertices[_0xa464('0x12')]['getSquareOdbc']=function(_0x24c11a,_0x546345){this[_0xa464('0x10')][_0xa464('0x1a')](_0x24c11a)['then'](function(_0x2a6e5e){_0x546345(null,_0x2a6e5e?_0x2a6e5e['dsn']:![]);})[_0xa464('0x18')](function(_0x2883a4){_0x546345(_0x2883a4);});};AGIVertices[_0xa464('0x12')][_0xa464('0x1b')]=function(_0xdb379b,_0x505f8f){this[_0xa464('0x10')]['getUserById'](_0xdb379b)[_0xa464('0x14')](function(_0x70d2d){_0x505f8f(null,_0x70d2d?_0x70d2d[_0xa464('0x15')]:![]);})[_0xa464('0x18')](function(_0xd4650e){_0x505f8f(_0xd4650e);});};AGIVertices[_0xa464('0x12')][_0xa464('0x1c')]=function(_0x1000ad,_0x432bc8){this[_0xa464('0x10')][_0xa464('0x1d')](_0x1000ad)['then'](function(_0x1264e5){_0x432bc8(null,_0x1264e5?_0x1264e5[_0xa464('0x15')]:![]);})[_0xa464('0x18')](function(_0x146305){_0x432bc8(_0x146305);});};AGIVertices[_0xa464('0x12')][_0xa464('0x1e')]=function(_0x144f4f,_0x3ec3e9){var _0x1ece3e=this;this[_0xa464('0x10')][_0xa464('0x1f')](_0x144f4f)['then'](function(_0x22d5c6){_0x3ec3e9(null,_0x22d5c6?_0x1ece3e[_0xa464('0x20')](_0x22d5c6[_0xa464('0x21')]):![]);})[_0xa464('0x18')](function(_0x32266d){_0x3ec3e9(_0x32266d);});};AGIVertices['prototype'][_0xa464('0x22')]=function(_0x59adc2,_0x2bfe47){this[_0xa464('0x10')][_0xa464('0x23')](_0x59adc2)[_0xa464('0x14')](function(_0x12eb29){_0x2bfe47(null,_0x12eb29?_0x12eb29:![]);})[_0xa464('0x18')](function(_0x3a64b8){_0x2bfe47(_0x3a64b8);});};AGIVertices[_0xa464('0x12')][_0xa464('0x24')]=function(_0x29245a,_0x1ae3f4,_0x49a0ec){this['mailRpc'][_0xa464('0x24')](_0x29245a,_0x1ae3f4)['then'](function(){_0x49a0ec(null);})[_0xa464('0x18')](function(_0x5786b1){_0x49a0ec(_0x5786b1);});};AGIVertices['prototype'][_0xa464('0x25')]=function(_0x56d913,_0x12f731){this[_0xa464('0x10')][_0xa464('0x26')](_0x56d913)[_0xa464('0x14')](function(_0x27999a){if(_0x27999a){if(_0x27999a['IntervalId']){_0x12f731(null,[_0x27999a['interval']]);}else{_0x12f731(null,_['map'](_0x27999a[_0xa464('0x27')],'interval'));}}else{_0x12f731(null,![]);}})['catch'](function(_0x1059a0){_0x12f731(_0x1059a0);});};AGIVertices[_0xa464('0x12')]['getSoundPath']=function(_0x3d7dc8){return util[_0xa464('0x28')]('%s/sounds/converted/%s',FILES_PATH,_0x3d7dc8);};AGIVertices[_0xa464('0x12')][_0xa464('0x29')]=function(_0x13fac2,_0x502a00,_0x2fe0df){odbc[_0xa464('0x2a')](_0x13fac2,function(_0x47776f){if(_0x47776f){logger[_0xa464('0x2b')](_0xa464('0x2c'),_0x47776f);_0x2fe0df(_0x47776f);}else{logger[_0xa464('0x2d')](_0xa464('0x2e'));odbc[_0xa464('0x2f')](_0x502a00,function(_0x10b934,_0x2f713a){if(_0x10b934){logger[_0xa464('0x2d')](_0xa464('0x30'),_0x502a00);_0x2fe0df(_0x10b934);}else{logger[_0xa464('0x2d')](_0xa464('0x31'),_0x502a00);odbc['close'](function(_0x2f7dfb){if(_0x2f7dfb){logger[_0xa464('0x2b')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x2f7dfb);}_0x2fe0df(null,_0x2f713a);});}});}});};AGIVertices[_0xa464('0x12')]['getSmsAccount']=function(_0x6d9e95,_0x31858c){this['rpc']['getSmsAccountById'](_0x6d9e95)['then'](function(_0x2f855a){_0x31858c(null,_0x2f855a?_0x2f855a:![]);})[_0xa464('0x18')](function(_0x5994d5){_0x31858c(_0x5994d5);});};AGIVertices['prototype']['createSmsMessage']=function(_0x52239a,_0x26d1c8){this[_0xa464('0x10')][_0xa464('0x32')](_0x52239a)['then'](function(_0x41d468){_0x26d1c8(null,_0x41d468);})[_0xa464('0x18')](function(_0x400bf4){_0x26d1c8(_0x400bf4);});};AGIVertices[_0xa464('0x12')][_0xa464('0x33')]=function(_0x2a616e,_0xbfdc8,_0x4f1156){this[_0xa464('0x10')]['createSquareDetailsReport']({'uniqueid':this[_0xa464('0xf')][_0xa464('0x34')],'node':_0x2a616e[_0xa464('0x35')],'application':_0x2a616e[_0xa464('0x36')],'data':_0xbfdc8||null,'project_name':this[_0xa464('0xf')][_0xa464('0x37')],'callerid':this[_0xa464('0xf')][_0xa464('0x38')]})[_0xa464('0x14')](function(_0x54ee68){if(_0x4f1156){_0x4f1156(null,_0x54ee68);}})['catch'](function(_0x1c0be4){if(_0x4f1156){_0x4f1156(_0x1c0be4);}});};AGIVertices[_0xa464('0x12')][_0xa464('0x39')]=function(_0x58b19b,_0xadfc28,_0x1647e0,_0xa4eca5){this['rpc'][_0xa464('0x39')]({'uniqueid':this[_0xa464('0xf')][_0xa464('0x34')],'callerid':this['channel'][_0xa464('0x38')],'calleridname':this[_0xa464('0xf')][_0xa464('0x3a')],'context':this['channel'][_0xa464('0x3b')],'extension':this[_0xa464('0xf')][_0xa464('0x3c')],'priority':this[_0xa464('0xf')]['priority'],'accountcode':this['channel'][_0xa464('0x3d')],'dnid':this[_0xa464('0xf')]['dnid'],'projectName':this['channel']['arg_1'],'saveName':_0xadfc28,'filename':_0x58b19b[_0xa464('0x3e')]||_0xadfc28,'savePath':_0x1647e0})['then'](function(_0x20a072){_0xa4eca5(null,_0x20a072);})[_0xa464('0x18')](function(_0x160235){_0xa4eca5(_0x160235);});};AGIVertices[_0xa464('0x12')][_0xa464('0x3f')]=function(_0x17c8d4,_0x5a48ed,_0x129b73,_0x332159,_0x23e340){this[_0xa464('0x10')]['createSquareMessage']({'uniqueid':this[_0xa464('0xf')][_0xa464('0x34')],'body':_0x17c8d4,'direction':_0x5a48ed,'providerName':_0x129b73,'providerResponse':_0x332159})[_0xa464('0x14')](function(_0x4b464a){if(_0x23e340){_0x23e340(null,_0x4b464a);}})[_0xa464('0x18')](function(_0x542e7b){if(_0x23e340){_0x23e340(_0x542e7b);}});};AGIVertices[_0xa464('0x12')][_0xa464('0x40')]=function(_0x83a96f,_0x4f0acc){this[_0xa464('0x10')][_0xa464('0x40')]({'firstName':_[_0xa464('0x41')](_0x83a96f[_0xa464('0x15')])||_[_0xa464('0x42')](_0x83a96f[_0xa464('0x15')])?_0xa464('0x43')+Math['random']():_0x83a96f[_0xa464('0x15')],'lastName':_[_0xa464('0x41')](_0x83a96f[_0xa464('0x44')])||_[_0xa464('0x42')](_0x83a96f['lastName'])?null:_0x83a96f[_0xa464('0x44')],'phone':_0x83a96f[_0xa464('0x45')],'ListId':_0x83a96f[_0xa464('0x46')],'scheduledat':_0x83a96f[_0xa464('0x47')],'callbackUniqueid':this['channel'][_0xa464('0x34')],'tags':_0xa464('0x48'),'description':_0xa464('0x49')+_0x83a96f[_0xa464('0x47')][_0xa464('0x4a')](),'priority':_0x83a96f[_0xa464('0x4b')]})[_0xa464('0x14')](function(_0x559750){_0x4f0acc(null,_0x559750);})[_0xa464('0x18')](function(_0x4ff41a){_0x4f0acc(_0x4ff41a);});};AGIVertices[_0xa464('0x12')]['getPause']=function(_0x140021,_0xa278be){this['rpc'][_0xa464('0x4c')](_0x140021)[_0xa464('0x14')](function(_0x578009){_0xa278be(null,_0x578009?_0x578009['name']:![]);})[_0xa464('0x18')](function(_0x5a05bc){_0xa278be(_0x5a05bc);});};AGIVertices[_0xa464('0x12')]['agentPause']=function(_0x502397,_0x38575c,_0x422198){var _0x5edd6e={'role':_0xa464('0x4d')};_0x5edd6e[_0x502397]=this[_0xa464('0xf')][_0xa464('0x38')];this[_0xa464('0x10')][_0xa464('0x4e')](_0x5edd6e,_0x38575c,this[_0xa464('0xf')][_0xa464('0x34')])[_0xa464('0x14')](function(_0x2997f1){_0x422198(null,_[_0xa464('0x42')](_0x2997f1)?![]:!![]);})[_0xa464('0x18')](function(_0x43977d){logger[_0xa464('0x2b')](_0x43977d);_0x422198(null,![]);});};AGIVertices[_0xa464('0x12')]['agentUnpause']=function(_0x517a73,_0x33de92){var _0x4601b7={'role':_0xa464('0x4d')};_0x4601b7[_0x517a73]=this[_0xa464('0xf')][_0xa464('0x38')];this[_0xa464('0x10')][_0xa464('0x4f')](_0x4601b7)['then'](function(_0x1c487e){_0x33de92(null,_['isNil'](_0x1c487e)?![]:!![]);})[_0xa464('0x18')](function(_0x2d0b84){logger['error'](_0x2d0b84);_0x33de92(null,![]);});};AGIVertices[_0xa464('0x12')][_0xa464('0x50')]=function(_0x2e8b3b,_0x5e735a){var _0x4dadef={'role':_0xa464('0x4d')};_0x4dadef[_0x2e8b3b]=this[_0xa464('0xf')][_0xa464('0x38')];this[_0xa464('0x10')][_0xa464('0x50')](_0x4dadef)[_0xa464('0x14')](function(_0x5dd9c0){_0x5e735a(null,_['isNil'](_0x5dd9c0)?![]:!![]);})['catch'](function(_0xcdcd9e){logger['error'](_0xcdcd9e);_0x5e735a(null,![]);});};AGIVertices[_0xa464('0x12')][_0xa464('0x51')]=function(_0x5d3298,_0x208d34){var _0x14db75={'role':_0xa464('0x4d')};_0x14db75[_0x5d3298]=this['channel']['callerid'];var _0x35c759=_0x5d3298!=_0xa464('0x52')?util['format']('%s/%s@from-sip/n',_0xa464('0x53'),this[_0xa464('0xf')][_0xa464('0x38')]):undefined;this[_0xa464('0x10')]['agentLogin'](_0x14db75,_0x35c759)[_0xa464('0x14')](function(_0xffc982){_0x208d34(null,_['isNil'](_0xffc982)?![]:!![]);})['catch'](function(_0x4a840c){logger[_0xa464('0x2b')](_0x4a840c);_0x208d34(null,![]);});};AGIVertices[_0xa464('0x12')][_0xa464('0x54')]=function(_0x1aa662,_0x5d3696){sh[_0xa464('0x55')](_['trim'](_0x1aa662),function(_0x5849be,_0x2d823a){var _0x1e2fa7=_0x2d823a[_0xa464('0x56')](/(\r\n|\n|\r)/gm,'');_0x5d3696(null,_0x1e2fa7);});};AGIVertices[_0xa464('0x12')][_0xa464('0x57')]=function(_0x3996e2,_0x37fe13){scripts[_0xa464('0x57')](_0x3996e2['apiKey'],_0x3996e2[_0xa464('0x58')]||_0xa464('0x59'),_0x3996e2[_0xa464('0x59')],_0x3996e2[_0xa464('0x5a')]||_0xa464('0x5b'),_0x3996e2[_0xa464('0x5c')]||_0xa464('0x5d'),_0x3996e2[_0xa464('0x5e')]||'MP3')[_0xa464('0x14')](function(_0x305f66){_0x37fe13(null,_0x305f66);})[_0xa464('0x18')](function(_0x1751a6){_0x37fe13(_0x1751a6);});};AGIVertices[_0xa464('0x12')][_0xa464('0x5f')]=function(_0x4e786c,_0x419328){scripts[_0xa464('0x5f')](_0x4e786c[_0xa464('0x59')],_0x4e786c[_0xa464('0x60')]||'en',0x1)[_0xa464('0x14')](function(_0x49c98e){_0x419328(null,_0x49c98e);})[_0xa464('0x18')](function(_0x147c12){_0x419328(_0x147c12);});};AGIVertices[_0xa464('0x12')][_0xa464('0x61')]=function(_0x228148,_0x56e899){var _0x446574={'uri':_0x228148[_0xa464('0x62')],'method':_0x228148[_0xa464('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x228148[_0xa464('0x64')])===_0xa464('0x65')&&parseInt(_0x228148[_0xa464('0x64')])>=0x1?parseInt(_0x228148[_0xa464('0x64')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xa464('0x66'),_0xa464('0x67')],_0x446574[_0xa464('0x63')][_0xa464('0x68')]())){try{_0x446574['body']=_0x228148['rawBody']?JSON[_0xa464('0x69')](_0x228148[_0xa464('0x6a')]):{};}catch(_0x358506){logger[_0xa464('0x2b')](_0xa464('0x6b'),_0x358506);}}try{_0x446574[_0xa464('0x6c')]=_0x228148[_0xa464('0xc')]?JSON[_0xa464('0x69')](_0x228148['rawHeaders']):{};}catch(_0x5a585d){logger['error'](_0xa464('0x6d'),_0x5a585d);}if(_0x228148['computedVariables']){try{var _0x3b6001=require(_0x228148[_0xa464('0x6e')])[_0xa464('0x6f')](this,_0x446574);_0x446574[_0xa464('0x70')]=Mustache['render'](_0x228148[_0xa464('0x62')],_0x3b6001,{},['$$','$$']);if(_0x446574[_0xa464('0x6c')]){_0x446574[_0xa464('0x6c')]=JSON[_0xa464('0x69')](Mustache['render'](JSON[_0xa464('0x71')](_0x446574[_0xa464('0x6c')]),_0x3b6001,{},['$$','$$']));}if(_0x446574[_0xa464('0x72')]){_0x446574[_0xa464('0x72')]=JSON[_0xa464('0x69')](Mustache['render'](JSON[_0xa464('0x71')](_0x446574['body']),_0x3b6001,{},['$$','$$']));}}catch(_0x27552b){logger[_0xa464('0x2b')](_0xa464('0x73'),_0x27552b);}}rp(_0x446574)[_0xa464('0x14')](function(_0x4a7160){var _0x381414={'statusCode':_0x4a7160['statusCode']||0xc8,'statusMessage':_0x4a7160[_0xa464('0x74')]||'OK','headers':_0x4a7160[_0xa464('0x6c')]||{},'body':_0x4a7160[_0xa464('0x72')]||{}};_0x56e899(null,_0x381414);})['catch'](function(_0xa86f6e){var _0x2f2bc4={'statusCode':_0xa86f6e['statusCode']||0x1f4,'statusMessage':_0xa86f6e[_0xa464('0x75')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0xa86f6e[_0xa464('0x76')][_0xa464('0x6c')]||{},'body':_0xa86f6e[_0xa464('0x76')][_0xa464('0x72')]||{}};_0x56e899(null,_0x2f2bc4);});};AGIVertices[_0xa464('0x12')][_0xa464('0x77')]=function(_0x16499a,_0x322284){scripts[_0xa464('0x77')](this['channel'][_0xa464('0x34')],_0x16499a['key'],_0x16499a[_0xa464('0x59')],_0x16499a[_0xa464('0x78')]||'en')[_0xa464('0x14')](function(_0x24001a){_0x322284(null,_0x24001a);})[_0xa464('0x18')](function(_0x3f85a6){_0x322284(_0x3f85a6);});};AGIVertices[_0xa464('0x12')][_0xa464('0x79')]=function(_0x547906,_0x469aa1){scripts['googleDialogflowV2'](this[_0xa464('0xf')][_0xa464('0x34')],_0x547906[_0xa464('0x7a')],_0x547906[_0xa464('0x7b')],_0x547906[_0xa464('0x7c')],_0x547906[_0xa464('0x59')],_0x547906[_0xa464('0x7d')]||'en')['then'](function(_0x362bb3){_0x469aa1(null,_0x362bb3);})[_0xa464('0x18')](function(_0x21a901){_0x469aa1(_0x21a901);});};AGIVertices[_0xa464('0x12')][_0xa464('0x7e')]=function(_0x222afc,_0x53c630){scripts[_0xa464('0x7e')](this[_0xa464('0xf')],_0x222afc)[_0xa464('0x14')](function(_0x1a277e){_0x53c630(null,_0x1a277e);})[_0xa464('0x18')](function(_0x468cbb){_0x53c630(_0x468cbb);});};AGIVertices[_0xa464('0x12')]['ispeechTTS']=function(_0x59f5a0,_0x511cda){scripts['ispeechTTS'](_0x59f5a0[_0xa464('0x7f')],_0x59f5a0[_0xa464('0x59')],_0x59f5a0[_0xa464('0x80')]||_0xa464('0x5b'),_0x59f5a0[_0xa464('0x81')])[_0xa464('0x14')](function(_0x2bbab0){_0x511cda(null,_0x2bbab0);})[_0xa464('0x18')](function(_0x329335){_0x511cda(_0x329335);});};AGIVertices[_0xa464('0x12')][_0xa464('0x82')]=function(_0x3d4b03,_0x10c8de,_0x3b0cff){scripts[_0xa464('0x82')](_0x10c8de,_0x3d4b03[_0xa464('0x7f')],_0x3d4b03[_0xa464('0x83')]||_0xa464('0x5b'),this[_0xa464('0x84')](_0x3d4b03['model'])?_0x3d4b03['model']:undefined)['then'](function(_0x2709a4){_0x3b0cff(null,_0x2709a4);})[_0xa464('0x18')](function(_0x3c7815){_0x3b0cff(_0x3c7815);});};AGIVertices[_0xa464('0x12')][_0xa464('0x85')]=function(_0x378adb,_0x46334b){scripts['awsPolly'](_0x378adb[_0xa464('0x86')],_0x378adb['aws_secret_access_key'],_0x378adb[_0xa464('0x87')],_0x378adb[_0xa464('0x88')]||'Amy',_0x378adb[_0xa464('0x59')],_0x378adb[_0xa464('0x89')]||'text')[_0xa464('0x14')](function(_0x2c00a0){_0x46334b(null,_0x2c00a0);})[_0xa464('0x18')](function(_0x50a338){_0x46334b(_0x50a338);});};AGIVertices[_0xa464('0x12')][_0xa464('0x8a')]=function(_0x5c95b4,_0x67bc80){scripts[_0xa464('0x8a')](this[_0xa464('0xf')]['uniqueid'],_0x5c95b4[_0xa464('0x86')],_0x5c95b4[_0xa464('0x8b')],_0x5c95b4[_0xa464('0x8c')],_0x5c95b4[_0xa464('0x59')],_0x5c95b4[_0xa464('0x8d')])['then'](function(_0x14c981){_0x67bc80(null,_0x14c981);})['catch'](function(_0x4d8bc3){_0x67bc80(_0x4d8bc3);});};AGIVertices[_0xa464('0x12')][_0xa464('0x8e')]=function(_0x6aa0df,_0x32d137,_0x532438){scripts[_0xa464('0x8e')](_0x32d137,_0x6aa0df[_0xa464('0x7f')],_0x6aa0df[_0xa464('0x8f')]||_0xa464('0x5b'))[_0xa464('0x14')](function(_0x5c98f8){_0x532438(null,_0x5c98f8);})[_0xa464('0x18')](function(_0x408e42){_0x532438(_0x408e42);});};AGIVertices['prototype'][_0xa464('0x90')]=function(_0x5b26df,_0x112824,_0x3b1623){scripts[_0xa464('0x90')](_0x112824,_0x5b26df[_0xa464('0x91')],_0x5b26df[_0xa464('0x92')],_0x5b26df[_0xa464('0x70')])[_0xa464('0x14')](function(_0x24dd4d){_0x3b1623(null,_0x24dd4d);})[_0xa464('0x18')](function(_0x53310d){_0x3b1623(_0x53310d);});};AGIVertices[_0xa464('0x12')]['clear']=function(_0x577c2a){var _0x23f849=_[_0xa464('0x93')](verticesWithRetry,_0x577c2a[_0xa464('0x36')])?_0x577c2a:_[_0xa464('0x94')](_0x577c2a);for(var _0x14828d in _0x23f849){if(_0x23f849[_0xa464('0x95')](_0x14828d)){if(_0x23f849[_0x14828d]&&_['isString'](_0x23f849[_0x14828d])){if(_[_0xa464('0x93')](recursiveMapAttributes,_0x14828d)){_0x23f849[_0x14828d]=this[_0xa464('0x96')](_0x23f849[_0x14828d]);}else{_0x23f849[_0x14828d]=this[_0xa464('0x97')](_0x23f849[_0x14828d]);}}}}return _0x23f849;};AGIVertices['prototype']['recursiveNodeIndex']=function(_0x44de55){for(var _0xe24a67 in _0x44de55){if(_0x44de55[_0xa464('0x95')](_0xe24a67)){if(_[_0xa464('0x98')](_0x44de55[_0xe24a67])){this[_0xa464('0x99')](_0x44de55[_0xe24a67]);}else if(_[_0xa464('0x9a')](_0x44de55[_0xe24a67])){for(var _0x11296c=0x0;_0x11296c<_0x44de55[_0xe24a67]['length'];_0x11296c++){this[_0xa464('0x99')](_0x44de55[_0xe24a67][_0x11296c]);}}else if(_['isString'](_0x44de55[_0xe24a67])){_0x44de55[_0xe24a67]=this[_0xa464('0x97')](_0x44de55[_0xe24a67]);}}}};AGIVertices[_0xa464('0x12')][_0xa464('0x9b')]=function(_0x1730a5,_0x1992dc){for(var _0x303693 in _0x1730a5){if(_0x1730a5[_0xa464('0x95')](_0x303693)){if(_[_0xa464('0x98')](_0x1730a5[_0x303693])){if(!_[_0xa464('0x41')](_0x1730a5[_0x303693])){this[_0xa464('0x9b')](_0x1730a5[_0x303693],util[_0xa464('0x28')](_0xa464('0x9c'),_0x1992dc,_0x303693));}}else if(_[_0xa464('0x9a')](_0x1730a5[_0x303693])){for(var _0x47b8b3=0x0;_0x47b8b3<_0x1730a5[_0x303693][_0xa464('0x9d')];_0x47b8b3++){this[_0xa464('0x9b')](_0x1730a5[_0x303693][_0x47b8b3],util[_0xa464('0x28')](_0xa464('0x9c'),_0x1992dc,_0x303693+'['+_0x47b8b3+']'));}}else{if(!_['isNil'](_0x1730a5[_0x303693])){this['channel'][_0xa464('0x9e')](util[_0xa464('0x28')](_0xa464('0x9c'),_0x1992dc,_0x303693),_0x1730a5[_0x303693]);}}}}};AGIVertices['prototype'][_0xa464('0x96')]=function(_0x4daf10){try{var _0x362911=JSON[_0xa464('0x69')](_0x4daf10);this[_0xa464('0x99')](_0x362911);return JSON[_0xa464('0x71')](_0x362911);}catch(_0x3a392d){return this[_0xa464('0x97')](_0x4daf10);}};AGIVertices[_0xa464('0x12')][_0xa464('0x97')]=function(_0x1c0f9a){var _0x3ccd7d=_0x1c0f9a[_0xa464('0x9f')]('{');for(var _0x5c300c=0x1;_0x5c300c<_0x3ccd7d[_0xa464('0x9d')];_0x5c300c+=0x1){var _0x5e7087=_0x3ccd7d[_0x5c300c]['split']('}');if(_0x5e7087[_0xa464('0x9d')]>0x1){_0x1c0f9a=_0x1c0f9a['replaceAll']('{'+_0x5e7087[0x0]+'}',this[_0xa464('0xf')][_0xa464('0xa0')](_0x5e7087[0x0])[_0xa464('0xa1')]||_0x5e7087[0x0]);}}if(_0x3ccd7d[_0xa464('0x9d')]===0x1){return _0x1c0f9a['toString']();}return this[_0xa464('0x97')](_0x1c0f9a);};AGIVertices['prototype']['getAndSetVariable']=function(_0x5a7b73,_0x391cb8){var _0x2a79ab=this[_0xa464('0xf')]['getVariable'](_0x5a7b73);if(_0x2a79ab[_0xa464('0xa2')]===-0x1){return _0x2a79ab;}logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0xa3'),_0x391cb8,_0x2a79ab['extra']));return this[_0xa464('0xf')][_0xa464('0x9e')](_0x391cb8,_0x2a79ab[_0xa464('0xa1')]);};AGIVertices[_0xa464('0x12')][_0xa464('0x84')]=function(_0x333c69){return _0x333c69&&_0x333c69!=='0'&&_0x333c69!=='-1'&&_0x333c69!=='';};AGIVertices[_0xa464('0x12')][_0xa464('0xa4')]=function(_0x36c171){this[_0xa464('0x33')]['sync'](this,_0x36c171,'-');_0x36c171[_0xa464('0xa5')]=_0x36c171[_0xa464('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xa464('0xa6')]=function(_0x4dce82){logger['info'](util[_0xa464('0x28')](_0xa464('0xa7'),_0x4dce82[_0xa464('0x35')]));if(!this[_0xa464('0x84')](_0x4dce82['text'])){return this['channel'][_0xa464('0xa8')](_0xa464('0xa9'));}var _0x29d4e0='\x22'+_0x4dce82['text']+'\x22';if(this[_0xa464('0x84')](_0x4dce82[_0xa464('0x76')])){_0x29d4e0+=','+_0x4dce82[_0xa464('0x76')];}var _0x4bf4c=this['channel'][_0xa464('0x55')](_0xa464('0xaa'),_0x29d4e0);if(_0x4bf4c[_0xa464('0xa2')]===-0x1){return _0x4bf4c;}return this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0xab'),_0x29d4e0));};AGIVertices[_0xa464('0x12')][_0xa464('0xac')]=function(_0x1b5f80){logger[_0xa464('0x2d')](util['format'](_0xa464('0xad'),_0x1b5f80[_0xa464('0x35')]));if(!this[_0xa464('0x84')](_0x1b5f80[_0xa464('0xae')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x528ebd=_0x1b5f80[_0xa464('0xae')];if(this[_0xa464('0x84')](_0x1b5f80['options'])){_0x528ebd+=','+_0x1b5f80[_0xa464('0x76')];}var _0x4d6da5=this[_0xa464('0xf')][_0xa464('0x55')](_0xa464('0xaf'),_0x528ebd);if(_0x4d6da5[_0xa464('0xa2')]===-0x1){return _0x4d6da5;}var _0x28f6df=this[_0xa464('0xb0')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x28f6df[_0xa464('0xa2')]===-0x1){return _0x28f6df;}var _0x55bc41=this['getAndSetVariable'](_0xa464('0xb1'),_0xa464('0xb2'));if(_0x55bc41[_0xa464('0xa2')]===-0x1){return _0x55bc41;}var _0x293cd2=this['getAndSetVariable'](_0xa464('0xb3'),_0xa464('0xb4'));if(_0x293cd2['result']===-0x1){return _0x293cd2;}return this[_0xa464('0xf')][_0xa464('0xa8')](util['format'](_0xa464('0xb5'),_0x528ebd));};AGIVertices[_0xa464('0x12')][_0xa464('0x8')]=function(_0xeb4afd){logger['info'](util[_0xa464('0x28')](_0xa464('0xb6'),_0xeb4afd['label']));return this[_0xa464('0xf')][_0xa464('0x8')]([_0xeb4afd['command'],_0xeb4afd[_0xa464('0xb7')]]);};AGIVertices[_0xa464('0x12')]['answer']=function(_0x52c380){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0xb8'),_0x52c380[_0xa464('0x35')]));if(this[_0xa464('0x84')](_0x52c380[_0xa464('0x64')])){logger[_0xa464('0x2d')](util['format'](_0xa464('0xb9'),_0x52c380[_0xa464('0x64')]));var _0x2a70fb=this[_0xa464('0xf')]['wait'](_0x52c380['timeout']);if(_0x2a70fb[_0xa464('0xa2')]===-0x1){return _0x2a70fb;}}return this['channel'][_0xa464('0xba')]();};AGIVertices[_0xa464('0x12')][_0xa464('0x48')]=function(_0x3ee162){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0xbb'),_0x3ee162[_0xa464('0x35')]));if(!this[_0xa464('0x84')](_0x3ee162[_0xa464('0x46')])){return this['channel'][_0xa464('0x2b')](_0x3ee162,'no\x20list\x20selected');}_0x3ee162[_0xa464('0x47')]=moment();if(this['isConfigured'](_0x3ee162['delay'])){_0x3ee162[_0xa464('0x47')]=moment()['add'](_0x3ee162['delay'],_0xa464('0xbc'));}if(!this[_0xa464('0x84')](_0x3ee162[_0xa464('0x4b')])){_0x3ee162['callback_priority']=0x2;}this[_0xa464('0x40')][_0xa464('0x6f')](this,_0x3ee162);return this['channel'][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0xbd'),_0x3ee162[_0xa464('0x45')],_0x3ee162[_0xa464('0x46')],_0x3ee162[_0xa464('0x47')]));};AGIVertices[_0xa464('0x12')][_0xa464('0xbe')]=function(_0x59844c){logger['info'](util[_0xa464('0x28')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x59844c[_0xa464('0x35')]));var _0x174f28=this[_0xa464('0xf')][_0xa464('0x55')](_0x59844c[_0xa464('0xbf')],_0x59844c['options']);if(_0x174f28[_0xa464('0xa2')]===-0x1){return _0x174f28;}return this[_0xa464('0xf')]['noop'](util['format'](_0xa464('0xc0'),_0x59844c[_0xa464('0xbf')],_0x59844c['options']));};AGIVertices['prototype']['lumenvoxtts']=function(_0x599bf3){logger[_0xa464('0x2d')](util['format'](_0xa464('0xc1'),_0x599bf3[_0xa464('0x35')]));if(!this[_0xa464('0x84')](_0x599bf3['text'])){return this[_0xa464('0xf')]['noop']('no\x20text\x20configured');}var _0x497d39='\x22'+_0x599bf3[_0xa464('0x59')]+'\x22';if(this[_0xa464('0x84')](_0x599bf3[_0xa464('0x76')])){_0x497d39+=','+_0x599bf3[_0xa464('0x76')];}var _0x467d4c=this[_0xa464('0xf')][_0xa464('0x55')](_0xa464('0xaa'),_0x497d39);if(_0x467d4c[_0xa464('0xa2')]===-0x1){return _0x467d4c;}return this['channel'][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0xab'),_0x497d39));};AGIVertices['prototype']['sestektts']=function(_0x37b01e){logger[_0xa464('0x2d')](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x37b01e['label']));if(!this[_0xa464('0x84')](_0x37b01e[_0xa464('0x59')])){return this[_0xa464('0xf')][_0xa464('0xa8')](_0xa464('0xa9'));}var _0x4f7362='\x22'+_0x37b01e[_0xa464('0x59')]+'\x22';if(this[_0xa464('0x84')](_0x37b01e[_0xa464('0x76')])){_0x4f7362+=','+_0x37b01e['options'];}var _0x254c27=this[_0xa464('0xf')][_0xa464('0x55')](_0xa464('0xaa'),_0x4f7362);if(_0x254c27[_0xa464('0xa2')]===-0x1){return _0x254c27;}return this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0xab'),_0x4f7362));};AGIVertices[_0xa464('0x12')][_0xa464('0xc2')]=function(_0x2f827f){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0xc3'),_0x2f827f[_0xa464('0x35')]));if(!this[_0xa464('0x84')](_0x2f827f[_0xa464('0xae')])){return this['channel'][_0xa464('0xa8')]('no\x20grammar\x20configured');}var _0x5744ed=_0x2f827f['grammar'];if(this[_0xa464('0x84')](_0x2f827f[_0xa464('0x76')])){_0x5744ed+=','+_0x2f827f['options'];}var _0x1b4b13=this['channel'][_0xa464('0x55')](_0xa464('0xaf'),_0x5744ed);if(_0x1b4b13[_0xa464('0xa2')]===-0x1){return _0x1b4b13;}var _0x4901b7=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xa464('0xc4'));if(_0x4901b7[_0xa464('0xa2')]===-0x1){return _0x4901b7;}var _0x3224d3=this[_0xa464('0xb0')](_0xa464('0xb1'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x3224d3[_0xa464('0xa2')]===-0x1){return _0x3224d3;}var _0x102e2b=this[_0xa464('0xb0')](_0xa464('0xb3'),_0xa464('0xc5'));if(_0x102e2b[_0xa464('0xa2')]===-0x1){return _0x102e2b;}return this['channel'][_0xa464('0xa8')](util['format'](_0xa464('0xb5'),_0x5744ed));};AGIVertices[_0xa464('0x12')][_0xa464('0xc6')]=function(_0x1ade10){logger[_0xa464('0x2d')](util['format'](_0xa464('0xc7'),_0x1ade10[_0xa464('0x35')]));if(!this[_0xa464('0x84')](_0x1ade10['grammar'])){return this[_0xa464('0xf')]['noop']('no\x20grammar\x20configured');}var _0x29a07c=_0x1ade10[_0xa464('0xae')];if(this['isConfigured'](_0x1ade10[_0xa464('0x76')])){_0x29a07c+=','+_0x1ade10[_0xa464('0x76')];}var _0x285e44=this[_0xa464('0xf')][_0xa464('0x55')](_0xa464('0xaf'),_0x29a07c);if(_0x285e44['result']===-0x1){return _0x285e44;}var _0x2cce22=this[_0xa464('0xb0')](_0xa464('0xc8'),_0xa464('0xc9'));if(_0x2cce22[_0xa464('0xa2')]===-0x1){return _0x2cce22;}var _0x198cec=this[_0xa464('0xb0')](_0xa464('0xb1'),_0xa464('0xca'));if(_0x198cec['result']===-0x1){return _0x198cec;}var _0x44a084=this[_0xa464('0xb0')](_0xa464('0xb3'),'SESTEK_ASR_INSTANCE');if(_0x44a084[_0xa464('0xa2')]===-0x1){return _0x44a084;}return this['channel'][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0xb5'),_0x29a07c));};AGIVertices[_0xa464('0x12')][_0xa464('0xcb')]=function(_0xf95a9c){logger['info'](util[_0xa464('0x28')](_0xa464('0xcc'),_0xf95a9c['label']));if(!this[_0xa464('0x84')](_0xf95a9c['odbc_id'])){return this[_0xa464('0xf')][_0xa464('0x2b')](_0xf95a9c,_0xa464('0xcd'));}var _0x1acd03=this[_0xa464('0xce')]['sync'](this,_0xf95a9c['odbc_id']);if(!_0x1acd03){return this[_0xa464('0xf')]['error'](_0xf95a9c,_0xa464('0xcf'));}if(!this[_0xa464('0x84')](_0xf95a9c[_0xa464('0x2f')])){return this[_0xa464('0xf')][_0xa464('0x2b')](_0xf95a9c,_0xa464('0xd0'));}var _0x495292=_0xf95a9c[_0xa464('0x2f')][_0xa464('0x56')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0xd1'),_0x495292));var _0x3f7fa3=this[_0xa464('0x29')]['sync'](this,_0x1acd03,_0x495292);this[_0xa464('0x33')]['sync'](this,_0xf95a9c,_0x495292);if(!this[_0xa464('0x84')](_0xf95a9c['variable_id'])){return this['channel'][_0xa464('0xa8')](_0xa464('0xd2'));}var _0x55a2e0=this[_0xa464('0xa0')][_0xa464('0x6f')](this,_0xf95a9c[_0xa464('0xd3')]);if(!_0x55a2e0){return this[_0xa464('0xf')][_0xa464('0x2b')](_0xf95a9c,_0xa464('0xd4'));}var _0x58829c=this;_0x3f7fa3[_0xa464('0xd5')](function(_0x13043d,_0x3b7857){Object[_0xa464('0xd6')](_0x13043d)['forEach'](function(_0x4e9e99){_0x58829c[_0xa464('0xf')][_0xa464('0x9e')](util['format'](_0xa464('0xd7'),_0x55a2e0,_0x3b7857,_0x4e9e99),_0x13043d[_0x4e9e99]);});});this[_0xa464('0xf')]['setVariable'](util[_0xa464('0x28')](_0xa464('0xd8'),_0x55a2e0),_0x3f7fa3[_0xa464('0x9d')]);return this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0xd9'),_0x55a2e0));};AGIVertices[_0xa464('0x12')][_0xa464('0xda')]=function(_0x5a3668){logger['debug'](util[_0xa464('0x28')](_0xa464('0xdb'),_0x5a3668[_0xa464('0x35')]));if(!this['isConfigured'](_0x5a3668[_0xa464('0xdc')])){return this[_0xa464('0xf')][_0xa464('0x2b')](_0x5a3668,_0xa464('0xdd'));}var _0xf73784=this['getUser']['sync'](this,_0x5a3668[_0xa464('0xdc')]);if(!_0xf73784){return this[_0xa464('0xf')][_0xa464('0x2b')](_0x5a3668,_0xa464('0xde'));}var _0x47e548=this[_0xa464('0xf')][_0xa464('0x55')](_0xa464('0xdf'),[util[_0xa464('0x28')](_0xa464('0xe0'),_0xf73784),_0x5a3668[_0xa464('0x64')],_0x5a3668[_0xa464('0xe1')],_0x5a3668[_0xa464('0x62')]]);if(_0x47e548[_0xa464('0xa2')]===-0x1){return _0x47e548;}return this['channel']['noop'](util['format']('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0xa464('0x12')][_0xa464('0xe2')]=function(_0x4e6c18){logger['info'](util[_0xa464('0x28')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x4e6c18[_0xa464('0x35')]));if(!this[_0xa464('0x84')](_0x4e6c18[_0xa464('0x7f')])){return this[_0xa464('0xf')][_0xa464('0xa8')]('no\x20key\x20configured');}if(!this[_0xa464('0x84')](_0x4e6c18[_0xa464('0x59')])){return this['channel']['noop']('no\x20text\x20configured');}this['channel'][_0xa464('0xe3')]=!![];this['createSquareDetailsReport'](_0x4e6c18);this[_0xa464('0x3f')](_0x4e6c18[_0xa464('0x59')],'in','','');this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0xe4'),_0x4e6c18['text']));var _0x480b7f=this[_0xa464('0x77')][_0xa464('0x6f')](this,_0x4e6c18);if(_0x480b7f){for(var _0x35e738 in _0x480b7f){if(_0x480b7f[_0xa464('0x95')](_0x35e738)){this[_0xa464('0xf')]['setVariable'](util['format'](_0xa464('0xe5'),_0x35e738[_0xa464('0x68')]()),_0x480b7f[_0x35e738]);}}this[_0xa464('0x3f')](_0x480b7f['speech'],_0xa464('0xe6'),_0xa464('0xe2'),'');return this[_0xa464('0xf')]['noop'](util[_0xa464('0x28')](_0xa464('0xe7'),_0x480b7f['speech']));}return this['channel'][_0xa464('0x2b')](_0x4e6c18,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xa464('0x12')]['dialogflowV2']=function(_0x2c7734){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0xe8'),_0x2c7734[_0xa464('0x35')]));if(!this[_0xa464('0x84')](_0x2c7734[_0xa464('0x7a')])){return this[_0xa464('0xf')][_0xa464('0xa8')](_0xa464('0xe9'));}if(!this[_0xa464('0x84')](_0x2c7734['client_email'])){return this[_0xa464('0xf')][_0xa464('0xa8')](_0xa464('0xea'));}if(!this[_0xa464('0x84')](_0x2c7734[_0xa464('0x7c')])){return this[_0xa464('0xf')]['noop']('no\x20private_key\x20configured');}if(!this[_0xa464('0x84')](_0x2c7734['dialogflowV2_language'])){return this[_0xa464('0xf')][_0xa464('0xa8')](_0xa464('0xeb'));}if(!this['isConfigured'](_0x2c7734[_0xa464('0x59')])){return this[_0xa464('0xf')][_0xa464('0xa8')](_0xa464('0xa9'));}this[_0xa464('0xf')][_0xa464('0xe3')]=!![];this[_0xa464('0x33')](_0x2c7734);this['createSquareMessage'](_0x2c7734[_0xa464('0x59')],'in','','');this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0xec'),_0x2c7734[_0xa464('0x59')]));var _0x4df065=this['googleDialogflowV2']['sync'](this,_0x2c7734);if(_0x4df065){for(var _0x26aeed in _0x4df065){if(_0x4df065[_0xa464('0x95')](_0x26aeed)){if(_0x26aeed!==_0xa464('0xed')){this[_0xa464('0xf')][_0xa464('0x9e')](util['format'](_0xa464('0xe5'),_0x26aeed[_0xa464('0x68')]()),_0x4df065[_0x26aeed]);}}}this[_0xa464('0x3f')](_0x4df065[_0xa464('0xee')],_0xa464('0xe6'),_0xa464('0xef'),_0x4df065[_0xa464('0xed')]);return this[_0xa464('0xf')]['noop'](util[_0xa464('0x28')](_0xa464('0xf0'),_0x4df065[_0xa464('0xee')]));}return this[_0xa464('0xf')][_0xa464('0x2b')](_0x2c7734,_0xa464('0xf1'));};AGIVertices[_0xa464('0x12')]['sesteknda']=function(_0x2e826e){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0xf2'),_0x2e826e['label']));if(!this['isConfigured'](_0x2e826e[_0xa464('0xf3')])){return this[_0xa464('0xf')][_0xa464('0xa8')](_0xa464('0xf4'));}if(!this['isConfigured'](_0x2e826e[_0xa464('0xf5')])){return this[_0xa464('0xf')]['noop'](_0xa464('0xf6'));}if(!this['isConfigured'](_0x2e826e[_0xa464('0xf7')])){return this[_0xa464('0xf')][_0xa464('0xa8')](_0xa464('0xf8'));}if(!this['isConfigured'](_0x2e826e['ndassistant_url'])){return this[_0xa464('0xf')][_0xa464('0xa8')]('no\x20text\x20configured');}this[_0xa464('0xf')][_0xa464('0xe3')]=!![];this[_0xa464('0x33')](_0x2e826e);this[_0xa464('0x3f')](_0x2e826e['text'],'in','','');this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0xf9'),_0x2e826e[_0xa464('0x59')]));var _0xb474e3=this[_0xa464('0x7e')][_0xa464('0x6f')](this,_0x2e826e);if(_0xb474e3){for(var _0x2d5db8 in _0xb474e3){if(_0xb474e3[_0xa464('0x95')](_0x2d5db8)){this[_0xa464('0xf')][_0xa464('0x9e')](util[_0xa464('0x28')]('SESTEK_NDA_%s',_0x2d5db8['toUpperCase']()),_0xb474e3[_0x2d5db8]);}}this['createSquareMessage'](_0xb474e3['speech'],_0xa464('0xe6'),_0xa464('0xfa'),'');if(_0xb474e3['audiofile']){this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0xfb'),_0xb474e3[_0xa464('0xfc')]));var _0x1557a5=this[_0xa464('0xf')]['streamFile'](_0xb474e3[_0xa464('0xfc')]);try{fs[_0xa464('0xfd')](_0xb474e3[_0xa464('0xfc')]+_0xa464('0xfe'));}catch(_0x54bf80){logger[_0xa464('0x2b')](_0x54bf80);}return _0x1557a5;}else{return this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0xff'),_0xb474e3[_0xa464('0xee')]));}}return this[_0xa464('0xf')][_0xa464('0x2b')](_0x2e826e,_0xa464('0x100'));};AGIVertices['prototype'][_0xa464('0x101')]=function(_0x4f57d2){logger[_0xa464('0x2d')](util[_0xa464('0x28')]('Enter\x20in\x20END\x20(%s)\x20block',_0x4f57d2[_0xa464('0x35')]));return this[_0xa464('0xf')][_0xa464('0xa8')]('end');};AGIVertices[_0xa464('0x12')]['ext_dial']=function(_0x346c74){logger[_0xa464('0x2d')](util['format'](_0xa464('0x102'),_0x346c74[_0xa464('0x35')]));var _0x55a317='';if(_0x346c74[_0xa464('0x103')]){if(!this[_0xa464('0x84')](_0x346c74[_0xa464('0x103')])){return this['channel'][_0xa464('0x2b')](_0x346c74,_0xa464('0x104'));}else{var _0x190500=parseInt(_0x346c74[_0xa464('0x103')],0xa);if(isNaN(_0x190500)){_0x55a317=_0x346c74[_0xa464('0x103')];}else{_0x55a317=this[_0xa464('0x1c')][_0xa464('0x6f')](this,_0x346c74['trunk_id']);if(!_0x55a317){return this[_0xa464('0xf')][_0xa464('0x2b')](_0x346c74,_0xa464('0x105'));}}}}else if(_0x346c74[_0xa464('0x106')]){_0x55a317=_0x346c74[_0xa464('0x106')];}else{return this['channel'][_0xa464('0x2b')](_0x346c74,_0xa464('0x104'));}var _0xa2874=this['channel'][_0xa464('0x55')](_0xa464('0xdf'),[util['format']('SIP/%s/%s',_0x55a317,_0x346c74[_0xa464('0x45')]),_0x346c74[_0xa464('0x64')],_0x346c74[_0xa464('0xe1')],_0x346c74['url']]);if(_0xa2874[_0xa464('0xa2')]===-0x1){return _0xa2874;}return this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0x107'),'DIAL'));};AGIVertices[_0xa464('0x12')][_0xa464('0x108')]=function(_0x3f2f33){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x109'),_0x3f2f33['label']));return this[_0xa464('0xf')][_0xa464('0xa8')](_0xa464('0x108'));};AGIVertices[_0xa464('0x12')][_0xa464('0x10a')]=function(_0x322c77){logger['info'](util[_0xa464('0x28')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x322c77[_0xa464('0x35')]));if(_0x322c77['retry']===0x0){return this[_0xa464('0xa4')](_0x322c77);}_0x322c77[_0xa464('0xa5')]-=0x1;if(!this[_0xa464('0x84')](_0x322c77['file_id'])){return this[_0xa464('0xf')][_0xa464('0x2b')](_0x322c77,_0xa464('0x10b'));}var _0x27f79a=this[_0xa464('0x1e')][_0xa464('0x6f')](this,_0x322c77[_0xa464('0x10c')]);if(!_0x27f79a){return this['channel'][_0xa464('0x2b')](_0x322c77,_0xa464('0x10d'));}if(!this[_0xa464('0x84')](_0x322c77[_0xa464('0xd3')])){return this[_0xa464('0xf')]['error'](_0xa464('0xd2'));}var _0x20efb8=this[_0xa464('0xf')][_0xa464('0x10e')](_0x27f79a,_0x322c77['response'],_0x322c77[_0xa464('0x10f')]);var _0xad67e8=_0x20efb8[_0xa464('0xa2')]?_0x20efb8[_0xa464('0xa2')][_0xa464('0x4a')]():'';logger['info'](_0xa464('0x110'),JSON['stringify'](_0x20efb8));if(_0x20efb8[_0xa464('0xa2')]===-0x1){this[_0xa464('0x33')][_0xa464('0x6f')](this,_0x322c77,_0xad67e8);return _0x20efb8;}else if(_0x20efb8[_0xa464('0xa1')]===_0xa464('0x64')){_0x20efb8['result']=_0xad67e8[_0xa464('0x9d')]>=parseInt(_0x322c77['mindigit'])?'x':'i';}else{_0x20efb8[_0xa464('0xa2')]=_0xad67e8[_0xa464('0x9d')]>=parseInt(_0x322c77[_0xa464('0x111')])&&_0xad67e8[_0xa464('0x9d')]<=parseInt(_0x322c77[_0xa464('0x10f')])?'x':'i';}var _0x4e99fe=this['getVariable'][_0xa464('0x6f')](this,_0x322c77[_0xa464('0xd3')]);if(!_0x4e99fe){return this[_0xa464('0xf')]['error'](_0x322c77,'no\x20variable\x20found');}this['channel'][_0xa464('0x9e')](_0x4e99fe,_0xad67e8);if(this['isConfigured'](_0x322c77[_0xa464('0x112')])){var _0x29db0b=parseInt(_0x322c77[_0xa464('0x112')],0xa);var _0xa16572=rs[_0xa464('0x113')]({'charset':'*','length':_0x29db0b});var _0x12d8ac=_0xad67e8[_0xa464('0x9d')];if(_0x12d8ac>0x0){if(_0x12d8ac>_0x29db0b){this[_0xa464('0x33')][_0xa464('0x6f')](this,_0x322c77,_0x322c77[_0xa464('0x114')]===_0xa464('0x115')?_0xa16572+_0xad67e8[_0xa464('0x116')](_0x29db0b):_0xad67e8[_0xa464('0x116')](0x0,_0x12d8ac-_0x29db0b)+_0xa16572);}else{this['createSquareDetailsReport'][_0xa464('0x6f')](this,_0x322c77,rs['generate']({'charset':'*','length':_0x12d8ac}));}}else{this[_0xa464('0x33')][_0xa464('0x6f')](this,_0x322c77,'');}}else{this[_0xa464('0x33')][_0xa464('0x6f')](this,_0x322c77,_0xad67e8);}return _0x20efb8;};AGIVertices[_0xa464('0x12')][_0xa464('0xe')]=function(_0x41da91){logger[_0xa464('0x2d')](util[_0xa464('0x28')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x41da91[_0xa464('0x35')]));return this[_0xa464('0x10a')](_0x41da91);};AGIVertices['prototype']['goal']=function(_0x36e247){logger[_0xa464('0x2d')](util['format'](_0xa464('0x117'),_0x36e247['label']));this['createSquareDetailsReport'][_0xa464('0x6f')](this,_0x36e247,_0x36e247[_0xa464('0x118')]);return this['channel'][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0x119'),_0x36e247[_0xa464('0x118')]));};AGIVertices[_0xa464('0x12')][_0xa464('0x11a')]=function(_0x3cf87e){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x11b'),_0x3cf87e[_0xa464('0x35')]));if(!this[_0xa464('0x84')](_0x3cf87e[_0xa464('0x86')])||!this[_0xa464('0x84')](_0x3cf87e[_0xa464('0x8b')])){return this['channel'][_0xa464('0xa8')](_0xa464('0x11c'));}if(!this[_0xa464('0x84')](_0x3cf87e['text'])){return this['channel'][_0xa464('0xa8')](_0xa464('0xa9'));}this[_0xa464('0xf')]['noop'](util['format'](_0xa464('0x11d'),_0x3cf87e[_0xa464('0x59')]));var _0x5a2994=this[_0xa464('0x85')][_0xa464('0x6f')](this,_0x3cf87e);if(_0x5a2994){this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0x11e'),_0x5a2994));var _0x1ce80a=this[_0xa464('0xf')][_0xa464('0x11f')](_0x5a2994);try{fs[_0xa464('0xfd')](_0x5a2994+_0xa464('0xfe'));}catch(_0x33ccf6){logger['error'](_0x33ccf6);}return _0x1ce80a;}return this[_0xa464('0xf')][_0xa464('0x2b')](_0x3cf87e,_0xa464('0x120'));};AGIVertices[_0xa464('0x12')][_0xa464('0x121')]=function(_0x3382ed){logger[_0xa464('0x2d')](util[_0xa464('0x28')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x3382ed['label']));if(!this['isConfigured'](_0x3382ed[_0xa464('0x86')])||!this[_0xa464('0x84')](_0x3382ed['aws_secret_access_key'])){return this[_0xa464('0xf')][_0xa464('0xa8')](_0xa464('0x11c'));}if(!this['isConfigured'](_0x3382ed[_0xa464('0x8d')])){return this[_0xa464('0xf')]['noop'](_0xa464('0x122'));}if(!this[_0xa464('0x84')](_0x3382ed[_0xa464('0x59')])){return this[_0xa464('0xf')]['noop'](_0xa464('0xa9'));}this[_0xa464('0xf')]['bot']=!![];this[_0xa464('0x33')](_0x3382ed);this[_0xa464('0x3f')](_0x3382ed[_0xa464('0x59')],'in','','');this[_0xa464('0xf')]['noop'](util['format'](_0xa464('0x123'),_0x3382ed['text']));var _0x556929=this[_0xa464('0x8a')][_0xa464('0x6f')](this,_0x3382ed);if(_0x556929){for(var _0x226ebb in _0x556929){if(_0x556929['hasOwnProperty'](_0x226ebb)&&_[_0xa464('0x124')](_0x556929[_0x226ebb])){this[_0xa464('0xf')][_0xa464('0x9e')](util[_0xa464('0x28')](_0xa464('0x125'),_0x226ebb[_0xa464('0x68')]()),_0x556929[_0x226ebb]);}}if(_['isNil'](_0x556929[_0xa464('0x75')])){return this[_0xa464('0xf')][_0xa464('0xa8')](_0xa464('0x126'));}else{this[_0xa464('0x3f')](_0x556929[_0xa464('0x75')],_0xa464('0xe6'),_0xa464('0x127'),'');return this['channel'][_0xa464('0xa8')](util[_0xa464('0x28')]('Amazon\x20Lex\x20Result\x20%s',_0x556929['message']));}}return this[_0xa464('0xf')][_0xa464('0x2b')](_0x3382ed,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices['prototype'][_0xa464('0x128')]=function(_0x2e537e){logger[_0xa464('0x2d')](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x2e537e[_0xa464('0x35')],_0x2e537e[_0xa464('0x64')]));if(!this[_0xa464('0x84')](_0x2e537e[_0xa464('0x7f')])){return this[_0xa464('0xf')]['noop'](_0xa464('0x129'));}var _0x2818a1=_0xa464('0x12a');var _0x38fcc6=util['format'](_0xa464('0x12b'),FILES_PATH,rs[_0xa464('0x113')](0x4));var _0x52e3a7=util[_0xa464('0x28')](_0xa464('0x9c'),_0x38fcc6,_0x2818a1);var _0x538149=!![];if(_0x2e537e[_0xa464('0x12c')]===_0xa464('0x12d')){_0x538149=![];}var _0x1e2229=this[_0xa464('0xf')][_0xa464('0x12e')](_0x38fcc6,_0x2818a1,_0x2e537e[_0xa464('0x12f')],_0x2e537e[_0xa464('0x64')],undefined,_0x538149);if(_0x1e2229[_0xa464('0xa2')]!==-0x1){this['channel'][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0x130'),_0x52e3a7));var _0x5b3b53=this[_0xa464('0x8e')]['sync'](this,_0x2e537e,_0x52e3a7);if(_0x5b3b53){for(var _0xc7e6cb in _0x5b3b53){if(_0x5b3b53[_0xa464('0x95')](_0xc7e6cb)){this[_0xa464('0xf')]['setVariable'](util[_0xa464('0x28')](_0xa464('0x131'),_0xc7e6cb[_0xa464('0x68')]()),_0x5b3b53[_0xc7e6cb]);}}return this['channel'][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0x132'),JSON[_0xa464('0x71')](_0x5b3b53)));}}return _0x1e2229;};AGIVertices[_0xa464('0x12')][_0xa464('0x133')]=function(_0x18b44e){logger[_0xa464('0x2d')](util['format'](_0xa464('0x134'),_0x18b44e[_0xa464('0x35')]));if(!this[_0xa464('0x84')](_0x18b44e['appid'])){return this[_0xa464('0xf')][_0xa464('0xa8')](_0xa464('0x135'));}if(!this[_0xa464('0x84')](_0x18b44e[_0xa464('0x92')])){return this[_0xa464('0xf')][_0xa464('0xa8')](_0xa464('0x136'));}var _0x4d9fef=_0xa464('0x12a');var _0x17ad0f=util[_0xa464('0x28')]('%s/recordings/%s',FILES_PATH,rs[_0xa464('0x113')](0x4));var _0x18c17f=util['format'](_0xa464('0x9c'),_0x17ad0f,_0x4d9fef);var _0x277155=!![];if(_0x18b44e[_0xa464('0x12c')]===_0xa464('0x12d')){_0x277155=![];}var _0x3c355=this[_0xa464('0xf')][_0xa464('0x12e')](_0x17ad0f,_0x4d9fef,_0x18b44e['intKey'],_0x18b44e[_0xa464('0x64')],undefined,_0x277155);if(_0x3c355[_0xa464('0xa2')]!==-0x1){this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0x137'),_0x18c17f));var _0xc61c3c=this[_0xa464('0x90')][_0xa464('0x6f')](this,_0x18b44e,_0x18c17f);if(_0xc61c3c){for(var _0x55d9b1 in _0xc61c3c){if(_0xc61c3c['hasOwnProperty'](_0x55d9b1)){this[_0xa464('0xf')]['setVariable'](util[_0xa464('0x28')]('TILDE_ASR_%s',_0x55d9b1['toUpperCase']()),_0xc61c3c[_0x55d9b1]);}}return this[_0xa464('0xf')][_0xa464('0xa8')](util['format']('TildeASR\x20Result\x20%s',JSON[_0xa464('0x71')](_0xc61c3c)));}}return _0x3c355;};AGIVertices[_0xa464('0x12')][_0xa464('0x138')]=function(_0x2eab42){logger['info'](util[_0xa464('0x28')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x2eab42['label']));return this[_0xa464('0xf')]['continueAt'](_0x2eab42[_0xa464('0x3b')],_0x2eab42[_0xa464('0x3c')],_0x2eab42['priority']);};AGIVertices[_0xa464('0x12')][_0xa464('0x139')]=function(_0x339119){logger['info'](util[_0xa464('0x28')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x339119[_0xa464('0x35')]));if(!this[_0xa464('0x84')](_0x339119['condition'])){return this[_0xa464('0xf')]['error'](_0x339119,_0xa464('0x13a'));}try{var _0x1f8d54=eval(_0x339119[_0xa464('0x13b')])?_0xa464('0x13c'):'false';this[_0xa464('0xf')]['noop'](util[_0xa464('0x28')]('EVAL\x20CONDITION\x20%s\x20%s',_0x339119[_0xa464('0x13b')],_0x1f8d54));return{'code':0xc8,'result':_0x1f8d54};}catch(_0x76032f){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xa464('0x12')][_0xa464('0x13d')]=function(_0x559363){logger['info'](util['format'](_0xa464('0x13e'),_0x559363[_0xa464('0x35')]));if(!this['isConfigured'](_0x559363['interval_id'])){return this[_0xa464('0xf')][_0xa464('0x2b')](_0x559363,_0xa464('0x13f'));}var _0x1ce2e8=this['getIntervals'][_0xa464('0x6f')](this,_0x559363[_0xa464('0x140')]);if(!_0x1ce2e8){return this[_0xa464('0xf')][_0xa464('0x2b')](_0x559363,_0xa464('0x141'));}for(var _0x60258a=0x0;_0x60258a<_0x1ce2e8[_0xa464('0x9d')];_0x60258a+=0x1){var _0x11b35a=this[_0xa464('0xf')]['getVariable'](util[_0xa464('0x28')](_0xa464('0x142'),_0x1ce2e8[_0x60258a]));if(_0x11b35a[_0xa464('0xa2')]===-0x1){return _0x11b35a;}logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x143'),_0x1ce2e8[_0x60258a],_0x11b35a[_0xa464('0xa1')]));if(_0x11b35a[_0xa464('0xa1')]===_0xa464('0x13c')){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x143'),_0x1ce2e8[_0x60258a],'true'));this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0x143'),_0x1ce2e8[_0x60258a],_0xa464('0x13c')));return{'code':0xc8,'result':'true'};}else{logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x143'),_0x1ce2e8[_0x60258a],_0xa464('0x144')));this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')]('IFTIME\x20%s\x20%s',_0x1ce2e8[_0x60258a],'false'));}}return{'code':0xc8,'result':_0xa464('0x144')};};AGIVertices['prototype'][_0xa464('0x145')]=function(_0x930190){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x146'),_0x930190[_0xa464('0x35')]));return this['channel']['hangup']();};AGIVertices[_0xa464('0x12')]['ispeechasr']=function(_0x1f1c94){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x147'),_0x1f1c94[_0xa464('0x35')]));if(!this[_0xa464('0x84')](_0x1f1c94[_0xa464('0x7f')])){return this['channel'][_0xa464('0xa8')](_0xa464('0x129'));}var _0x56eb19=_0xa464('0x12a');var _0x2acd6c=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xa464('0x113')](0x4));var _0x3533cc=util['format']('%s.%s',_0x2acd6c,_0x56eb19);var _0x5e4fca=!![];if(_0x1f1c94[_0xa464('0x12c')]===_0xa464('0x12d')){_0x5e4fca=![];}var _0x1e98cc=this['channel'][_0xa464('0x12e')](_0x2acd6c,_0x56eb19,_0x1f1c94[_0xa464('0x12f')],_0x1f1c94[_0xa464('0x64')],undefined,_0x5e4fca);if(_0x1e98cc[_0xa464('0xa2')]!==-0x1){this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')]('ispeech\x20%s\x20file\x20created',_0x3533cc));var _0x5edd10=this['ispeechASR']['sync'](this,_0x1f1c94,_0x3533cc);if(_0x5edd10){for(var _0x19777d in _0x5edd10){if(_0x5edd10[_0xa464('0x95')](_0x19777d)){this[_0xa464('0xf')][_0xa464('0x9e')](util[_0xa464('0x28')](_0xa464('0x148'),_0x19777d[_0xa464('0x68')]()),_0x5edd10[_0x19777d]);}}return this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0x149'),JSON['stringify'](_0x5edd10)));}}return _0x1e98cc;};AGIVertices[_0xa464('0x12')][_0xa464('0x14a')]=function(_0xdb51a2){logger['info'](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0xdb51a2[_0xa464('0x35')]));if(!this[_0xa464('0x84')](_0xdb51a2[_0xa464('0x7f')])){return this['channel'][_0xa464('0xa8')](_0xa464('0x129'));}if(!this[_0xa464('0x84')](_0xdb51a2[_0xa464('0x59')])){return this[_0xa464('0xf')][_0xa464('0xa8')](_0xa464('0xa9'));}this['channel'][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0x14b'),_0xdb51a2[_0xa464('0x59')]));var _0x3a771a=this[_0xa464('0x14c')][_0xa464('0x6f')](this,_0xdb51a2);if(_0x3a771a){this['channel'][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0x14d'),_0x3a771a));var _0xe87601=this[_0xa464('0xf')]['streamFile'](_0x3a771a,_0xdb51a2['intKey']);try{fs['unlink'](_0x3a771a+_0xa464('0xfe'));}catch(_0x30dc5a){logger[_0xa464('0x2b')](_0x30dc5a);}return _0xe87601;}return this['channel'][_0xa464('0x2b')](_0xdb51a2,_0xa464('0x14e'));};AGIVertices[_0xa464('0x12')]['login']=function(_0x3239ad){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x14f'),_0x3239ad[_0xa464('0x35')]));if(!this[_0xa464('0x84')](_0x3239ad['findBy'])){return this[_0xa464('0xf')][_0xa464('0x2b')](_0x3239ad,_0xa464('0x150'));}logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x151'),this[_0xa464('0xf')][_0xa464('0x38')],_0x3239ad[_0xa464('0x152')]));var _0x60aff8=this[_0xa464('0x51')]['sync'](this,_0x3239ad[_0xa464('0x152')]);if(_0x60aff8){logger['info'](util[_0xa464('0x28')](_0xa464('0x153'),this[_0xa464('0xf')][_0xa464('0x38')],_0x3239ad['findBy']));this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0x153'),this[_0xa464('0xf')][_0xa464('0x38')],_0x3239ad[_0xa464('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x154'),this['channel'][_0xa464('0x38')],_0x3239ad[_0xa464('0x152')]));this[_0xa464('0xf')][_0xa464('0xa8')](util['format'](_0xa464('0x154'),this[_0xa464('0xf')][_0xa464('0x38')],_0x3239ad[_0xa464('0x152')]));return{'code':0xc8,'result':_0xa464('0x155')};}};AGIVertices[_0xa464('0x12')]['logout']=function(_0x1e22c9){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x156'),_0x1e22c9[_0xa464('0x35')]));if(!this[_0xa464('0x84')](_0x1e22c9[_0xa464('0x152')])){return this[_0xa464('0xf')][_0xa464('0x2b')](_0x1e22c9,'no\x20find\x20by\x20configured');}logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x151'),this['channel'][_0xa464('0x38')],_0x1e22c9['findBy']));var _0x19a516=this[_0xa464('0x50')][_0xa464('0x6f')](this,_0x1e22c9[_0xa464('0x152')]);if(_0x19a516){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x153'),this['channel'][_0xa464('0x38')],_0x1e22c9[_0xa464('0x152')]));this[_0xa464('0xf')][_0xa464('0xa8')](util['format'](_0xa464('0x153'),this[_0xa464('0xf')][_0xa464('0x38')],_0x1e22c9[_0xa464('0x152')]));return{'code':0xc8,'result':_0xa464('0x157')};}else{logger[_0xa464('0x2d')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xa464('0x38')],_0x1e22c9['findBy']));this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0x154'),this[_0xa464('0xf')][_0xa464('0x38')],_0x1e22c9[_0xa464('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xa464('0x12')]['math']=function(_0x107355){logger['info'](util['format'](_0xa464('0x158'),_0x107355[_0xa464('0x35')]));if(!this[_0xa464('0x84')](_0x107355[_0xa464('0x159')])){return this[_0xa464('0xf')][_0xa464('0x2b')](_0x107355,'no\x20operation\x20configured');}this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')]('math\x20%s',_0x107355[_0xa464('0x159')]));var _0x152d7a=eval(_0x107355[_0xa464('0x159')]);if(!this[_0xa464('0x84')](_0x107355[_0xa464('0xd3')])){return this[_0xa464('0xf')][_0xa464('0xa8')](_0xa464('0xd2'));}var _0x32c6fa=this[_0xa464('0xa0')]['sync'](this,_0x107355[_0xa464('0xd3')]);if(!_0x32c6fa){return this[_0xa464('0xf')][_0xa464('0x2b')](_0x107355,_0xa464('0xd4'));}if(_[_0xa464('0x9a')](_0x152d7a)){var _0x496d61=this;_0x152d7a[_0xa464('0xd5')](function(_0x4a4bd4,_0x1c6125){_0x496d61[_0xa464('0xf')]['setVariable'](util[_0xa464('0x28')](_0xa464('0x15a'),_0x32c6fa,_0x1c6125),_0x4a4bd4);});return this['channel']['noop'](util[_0xa464('0x28')](_0xa464('0x15b'),_0x32c6fa));}else{return this[_0xa464('0xf')][_0xa464('0x9e')](_0x32c6fa,_0x152d7a);}};AGIVertices[_0xa464('0x12')]['menu']=function(_0x2e1853){logger['info'](util['format'](_0xa464('0x15c'),_0x2e1853[_0xa464('0x35')]));if(_0x2e1853['retry']===0x0){return this[_0xa464('0xa4')](_0x2e1853);}_0x2e1853[_0xa464('0xa5')]-=0x1;if(!this[_0xa464('0x84')](_0x2e1853[_0xa464('0x10c')])){return this[_0xa464('0xf')][_0xa464('0x2b')](_0x2e1853,_0xa464('0x10b'));}var _0x7c80a5=this[_0xa464('0x1e')][_0xa464('0x6f')](this,_0x2e1853['file_id']);if(!_0x7c80a5){return this['channel'][_0xa464('0x2b')](_0x2e1853,_0xa464('0x10d'));}var _0x4b6c01=this[_0xa464('0xf')]['getData'](_0x7c80a5,_0x2e1853[_0xa464('0x15d')],_0x2e1853[_0xa464('0x15e')]);var _0x976e13=_0x4b6c01[_0xa464('0xa2')];if(_0x4b6c01[_0xa464('0xa2')]===-0x1){this[_0xa464('0x33')][_0xa464('0x6f')](this,_0x2e1853,'-1');return _0x4b6c01;}else if(_0x4b6c01[_0xa464('0xa1')]==='timeout'){_0x4b6c01[_0xa464('0xa2')]=_0x4b6c01[_0xa464('0xa2')][_0xa464('0x9d')]>0x0?_0x4b6c01[_0xa464('0xa2')]:'t';}else if(_['isEmpty'](_0x4b6c01[_0xa464('0xa2')])){_0x4b6c01[_0xa464('0xa2')]='#';_0x976e13='#';}if(!this[_0xa464('0x84')](_0x2e1853[_0xa464('0xd3')])){this[_0xa464('0xf')][_0xa464('0xa8')](_0xa464('0xd2'));}else{var _0x1f8295=this[_0xa464('0xa0')][_0xa464('0x6f')](this,_0x2e1853[_0xa464('0xd3')]);if(!_0x1f8295){return this[_0xa464('0xf')][_0xa464('0x2b')](_0x2e1853,'no\x20variable\x20found');}this['channel']['setVariable'](_0x1f8295,_0x976e13);}this[_0xa464('0x33')][_0xa464('0x6f')](this,_0x2e1853,_0x976e13);return _0x4b6c01;};AGIVertices[_0xa464('0x12')][_0xa464('0xa8')]=function(_0x2dc1fd){logger['info'](util[_0xa464('0x28')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x2dc1fd[_0xa464('0x35')]));return this[_0xa464('0xf')][_0xa464('0xa8')](_0x2dc1fd['output']||_0x2dc1fd[_0xa464('0x35')]);};AGIVertices[_0xa464('0x12')][_0xa464('0x15f')]=function(_0x597353){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x160'),_0x597353[_0xa464('0x35')]));if(!this[_0xa464('0x84')](_0x597353[_0xa464('0x152')])){return this[_0xa464('0xf')][_0xa464('0x2b')](_0x597353,_0xa464('0x150'));}logger['info'](util[_0xa464('0x28')](_0xa464('0x151'),this[_0xa464('0xf')][_0xa464('0x38')],_0x597353[_0xa464('0x152')]));var _0x5f090a=this[_0xa464('0x161')][_0xa464('0x6f')](this,_0x597353['pause_id']);var _0x5d1860=this[_0xa464('0x4e')]['sync'](this,_0x597353[_0xa464('0x152')],_0x5f090a);if(_0x5d1860){logger[_0xa464('0x2d')](util[_0xa464('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa464('0xf')][_0xa464('0x38')],_0x597353[_0xa464('0x152')]));this['channel'][_0xa464('0xa8')](util[_0xa464('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa464('0xf')][_0xa464('0x38')],_0x597353[_0xa464('0x152')]));return{'code':0xc8,'result':_0xa464('0x157')};}else{logger[_0xa464('0x2d')](util[_0xa464('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa464('0xf')][_0xa464('0x38')],_0x597353[_0xa464('0x152')]));this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0x153'),this['channel'][_0xa464('0x38')],_0x597353['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xa464('0x12')][_0xa464('0x162')]=function(_0x22a759){logger[_0xa464('0x2d')](util[_0xa464('0x28')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x22a759['label']));if(!this['isConfigured'](_0x22a759[_0xa464('0x10c')])){return this[_0xa464('0xf')][_0xa464('0x2b')](_0x22a759,_0xa464('0x10b'));}var _0x31658b=this[_0xa464('0x1e')][_0xa464('0x6f')](this,_0x22a759[_0xa464('0x10c')]);if(!_0x31658b){return this[_0xa464('0xf')]['error'](_0x22a759,_0xa464('0x10d'));}var _0x4a629e=this['channel'][_0xa464('0x55')](_0xa464('0x163'),[_0x31658b,_0x22a759['opts']]);if(_0x4a629e['result']===-0x1){return _0x4a629e;}return this[_0xa464('0xf')]['noop'](util[_0xa464('0x28')](_0xa464('0xc0'),_0xa464('0x163'),_0x31658b));};AGIVertices['prototype'][_0xa464('0x164')]=function(_0x396538){logger['info'](util[_0xa464('0x28')](_0xa464('0x165'),_0x396538[_0xa464('0x35')]));if(!this['isConfigured'](_0x396538[_0xa464('0x166')])){return this[_0xa464('0xf')]['error'](_0x396538,_0xa464('0x167'));}var _0x443df6='';var _0x237305=parseInt(_0x396538[_0xa464('0x166')],0xa);if(isNaN(_0x237305)){_0x443df6=_0x396538[_0xa464('0x166')];}else{_0x443df6=this[_0xa464('0x16')][_0xa464('0x6f')](this,_0x396538['queue_id']);if(!_0x443df6){return this[_0xa464('0xf')][_0xa464('0x2b')](_0x396538,_0xa464('0x168'));}}var _0x12e852='';if(this[_0xa464('0x84')](_0x396538[_0xa464('0x10c')])){var _0x2b104e=this[_0xa464('0x1e')][_0xa464('0x6f')](this,_0x396538['file_id']);if(_0x2b104e){_0x12e852=_0x2b104e;}}this[_0xa464('0x33')][_0xa464('0x6f')](this,_0x396538,_0x443df6);if(_0x396538[_0xa464('0xe1')][_0xa464('0x169')]('x')<0x0){_0x396538[_0xa464('0xe1')]+='x';}if(_0x396538[_0xa464('0xe1')][_0xa464('0x169')]('X')<0x0){_0x396538['opts']+='X';}this[_0xa464('0xf')][_0xa464('0x9e')](_0xa464('0x16a'),_0x443df6?_0x443df6['toLowerCase']():'');var _0x56430a=this[_0xa464('0xf')][_0xa464('0x55')]('QUEUE',[_0x443df6,_0x396538['opts'],_0x396538['url'],_0x12e852,_0x396538[_0xa464('0x64')],_0x396538[_0xa464('0x8')],_0x396538[_0xa464('0x16b')],_0x396538[_0xa464('0x16c')],'',_0x396538[_0xa464('0x16d')]]);if(_0x56430a[_0xa464('0xa2')]===-0x1){return _0x56430a;}return this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0xc0'),_0xa464('0x16e'),_0x443df6));};AGIVertices[_0xa464('0x12')][_0xa464('0x16f')]=function(_0x2d7f8a){logger[_0xa464('0x2d')](util['format'](_0xa464('0x170'),_0x2d7f8a[_0xa464('0x35')]));var _0x2540f6=_0x2d7f8a[_0xa464('0x171')]||_0xa464('0x12a');var _0x94b5a0=util[_0xa464('0x28')](_0xa464('0x172'),this['channel'][_0xa464('0x34')],rs['generate'](0x5));var _0x2bccd4=util[_0xa464('0x28')](_0xa464('0x173'),FILES_PATH,_0x94b5a0,_0x2540f6);var _0x2c75cc=util[_0xa464('0x28')](_0xa464('0x12b'),FILES_PATH,_0x94b5a0);this[_0xa464('0x39')][_0xa464('0x6f')](this,_0x2d7f8a,_0x94b5a0,_0x2bccd4);this['channel'][_0xa464('0x9e')](_0xa464('0x174'),_0x94b5a0);logger['info'](_0xa464('0x175'),_0x2c75cc,_0x2540f6,_0x2d7f8a[_0xa464('0x176')],_0x2d7f8a['timeout']);return this[_0xa464('0xf')][_0xa464('0x12e')](_0x2c75cc,_0x2540f6,_0x2d7f8a[_0xa464('0x176')],_0x2d7f8a['timeout'],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x39dd75){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x177'),_0x39dd75[_0xa464('0x35')]));if(!this[_0xa464('0x84')](_0x39dd75['url'])){return this[_0xa464('0xf')][_0xa464('0xa8')](_0xa464('0x178'));}var _0x401207=this['restAPI'][_0xa464('0x6f')](this,_0x39dd75);logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x179'),util['inspect'](_0x401207,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x39dd75[_0xa464('0xd3')])){return this[_0xa464('0xf')][_0xa464('0xa8')](_0xa464('0x17a'));}var _0x5e50ff=this['getVariable'][_0xa464('0x6f')](this,_0x39dd75[_0xa464('0xd3')]);if(!_0x5e50ff){return this[_0xa464('0xf')][_0xa464('0x2b')](_0x39dd75,_0xa464('0xd4'));}this['channel'][_0xa464('0x9e')](util[_0xa464('0x28')](_0xa464('0x17b'),_0x5e50ff),_0x401207[_0xa464('0x17c')]?_0x401207[_0xa464('0x17c')]:'200');this[_0xa464('0xf')]['setVariable'](util[_0xa464('0x28')]('%s_STATUS_MESSAGE',_0x5e50ff),_0x401207['statusMessage']?_0x401207['statusMessage']:'OK');if(_0x401207[_0xa464('0x72')]){try{this['saveRestApiResult'](_0x401207[_0xa464('0x72')],_0x5e50ff);}catch(_0x4c15e8){logger[_0xa464('0x2b')](util[_0xa464('0x28')](_0xa464('0x17d'),_0x5e50ff));}}return this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0xd9'),_0x5e50ff));};AGIVertices[_0xa464('0x12')][_0xa464('0x17e')]=function(_0x3f0feb){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x17f'),_0x3f0feb['label']));return this[_0xa464('0xf')][_0xa464('0x180')](_0x3f0feb[_0xa464('0x181')]['replace'](/\s+/g,''),_0x3f0feb['escape_digits']);};AGIVertices[_0xa464('0x12')][_0xa464('0x182')]=function(_0x19d8cd){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x183'),_0x19d8cd[_0xa464('0x35')]));return this[_0xa464('0xf')]['sayNumber'](_0x19d8cd[_0xa464('0x65')]['replace'](/\s+/g,''),_0x19d8cd[_0xa464('0x176')]);};AGIVertices[_0xa464('0x12')][_0xa464('0x184')]=function(_0x5a7d3d){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x185'),_0x5a7d3d[_0xa464('0x35')]));return this[_0xa464('0xf')]['sayPhonetic'](_0x5a7d3d[_0xa464('0x59')],_0x5a7d3d['escape_digits']);};AGIVertices[_0xa464('0x12')][_0xa464('0x186')]=function(_0x15d0a4){logger[_0xa464('0x2d')](util['format'](_0xa464('0x187'),_0x15d0a4[_0xa464('0x35')]));if(!this[_0xa464('0x84')](_0x15d0a4[_0xa464('0x188')])){return this['channel'][_0xa464('0xa8')](_0xa464('0x189'));}var _0x40c829=this[_0xa464('0x22')][_0xa464('0x6f')](this,_0x15d0a4[_0xa464('0x188')]);if(!_0x40c829||!_0x40c829[_0xa464('0x18a')]){return this[_0xa464('0xf')]['error'](_0x15d0a4,_0xa464('0x18b'));}var _0xa9aaf4={'from':util['format'](_0xa464('0x18c'),_0x40c829[_0xa464('0x15')],_0x40c829[_0xa464('0x18d')]||_0x40c829[_0xa464('0x18a')][_0xa464('0x18e')]),'to':_0x15d0a4['to']||'','cc':_0x15d0a4['cc']||'','bcc':_0x15d0a4[_0xa464('0x18f')]||'','subject':_0x15d0a4[_0xa464('0x190')],'html':_0x15d0a4['text'],'text':_0x15d0a4[_0xa464('0x59')]};var _0x276f85={'tls':{'rejectUnauthorized':![]}};if(_0x40c829[_0xa464('0x18a')]['service']){_0x276f85[_0xa464('0x191')]=_0x40c829[_0xa464('0x18a')][_0xa464('0x191')];}else{_0x276f85[_0xa464('0x192')]=_0x40c829[_0xa464('0x18a')][_0xa464('0x192')];_0x276f85[_0xa464('0x193')]=_0x40c829['Smtp']['port'];_0x276f85['secure']=_0x40c829['Smtp'][_0xa464('0x194')];}if(_0x40c829[_0xa464('0x18a')][_0xa464('0x195')]){_0x276f85['auth']={'user':_0x40c829['Smtp'][_0xa464('0x18e')],'pass':_0x40c829[_0xa464('0x18a')][_0xa464('0x196')]};}if(this[_0xa464('0x84')](_0x15d0a4[_0xa464('0x197')])){}logger[_0xa464('0x198')](_0xa464('0x199'),JSON['stringify'](_0xa9aaf4));this[_0xa464('0x33')]['sync'](this,_0x15d0a4,_0x15d0a4[_0xa464('0x188')]);this[_0xa464('0xf')][_0xa464('0xa8')](util['format'](_0xa464('0x19a'),_0x40c829['name']));this[_0xa464('0x24')][_0xa464('0x6f')](this,_0x276f85,_0xa9aaf4);return this[_0xa464('0xf')][_0xa464('0xa8')](_0xa464('0x19b'));};AGIVertices[_0xa464('0x12')][_0xa464('0x19c')]=function(_0x290d49){logger['info'](util[_0xa464('0x28')](_0xa464('0x19d'),_0x290d49['label']));return this[_0xa464('0xf')]['noop'](_0xa464('0x19e'));};AGIVertices[_0xa464('0x12')][_0xa464('0x19f')]=function(_0x5c7504){logger[_0xa464('0x2d')](util[_0xa464('0x28')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x5c7504[_0xa464('0x35')]));if(!this['isConfigured'](_0x5c7504[_0xa464('0x1a0')])){return this[_0xa464('0xf')][_0xa464('0xa8')](_0xa464('0x1a1'));}var _0x42badb=this[_0xa464('0x1a2')][_0xa464('0x6f')](this,_0x5c7504['sms_account_id']);if(!_0x42badb){return this[_0xa464('0xf')][_0xa464('0x2b')](_0x5c7504,_0xa464('0x1a3'));}var _0x51f621={'body':_0x5c7504['sms_text'],'phone':_0x5c7504['to']||'','SmsAccountId':_0x42badb['id']};logger['debug']('sendSMS\x20message',JSON[_0xa464('0x71')](_0x51f621));this[_0xa464('0x33')][_0xa464('0x6f')](this,_0x5c7504,_0x5c7504['sms_account_id']);this['channel']['noop'](util[_0xa464('0x28')](_0xa464('0x1a4'),_0x42badb[_0xa464('0x15')]));this[_0xa464('0x32')][_0xa464('0x6f')](this,_0x51f621);return this[_0xa464('0xf')][_0xa464('0xa8')](_0xa464('0x1a5'));};AGIVertices[_0xa464('0x12')][_0xa464('0x1a6')]=function(_0x3aecc4){logger['info'](util[_0xa464('0x28')](_0xa464('0x1a7'),_0x3aecc4[_0xa464('0x35')]));if(!this['isConfigured'](_0x3aecc4[_0xa464('0xd3')])){return this[_0xa464('0xf')][_0xa464('0x2b')](_0x3aecc4,_0xa464('0x1a8'));}var _0x31653e=this[_0xa464('0xa0')][_0xa464('0x6f')](this,_0x3aecc4['variable_id']);if(!_0x31653e){return this[_0xa464('0xf')][_0xa464('0x2b')](_0x3aecc4,_0xa464('0xd4'));}return this[_0xa464('0xf')][_0xa464('0x9e')](_0x31653e,_0x3aecc4[_0xa464('0x1a9')]);};AGIVertices['prototype'][_0xa464('0x1aa')]=function(_0x2a5358){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x1ab'),_0x2a5358[_0xa464('0x35')]));this[_0xa464('0xf')][_0xa464('0xa8')](_0xa464('0x1ac'));if(_0x2a5358[_0xa464('0xba')]===_0xa464('0x1ad')){this[_0xa464('0xf')][_0xa464('0xa8')](_0xa464('0x1ae'));return this['channel']['answer']();}return this[_0xa464('0xf')][_0xa464('0xa8')]('Skipped\x20Answer');};AGIVertices[_0xa464('0x12')][_0xa464('0x1af')]=function(_0xa0b7f5){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x1b0'),_0xa0b7f5[_0xa464('0x35')]));if(!this[_0xa464('0x84')](_0xa0b7f5[_0xa464('0x1b1')])){return this[_0xa464('0xf')][_0xa464('0x2b')](_0xa0b7f5,_0xa464('0x1b2'));}var _0x4c9fba=this[_0xa464('0x19')][_0xa464('0x6f')](this,_0xa0b7f5[_0xa464('0x1b1')]);if(!this[_0xa464('0x84')](_0x4c9fba)){return this['channel'][_0xa464('0x2b')](_0xa0b7f5,util[_0xa464('0x28')](_0xa464('0x1b3'),_0xa0b7f5[_0xa464('0x1b1')]));}if(_0x4c9fba===this[_0xa464('0xf')][_0xa464('0x37')]){return this['channel'][_0xa464('0x2b')](_0xa0b7f5,_0xa464('0x1b4'));}this['createSquareDetailsReport']['sync'](this,_0xa0b7f5,_0x4c9fba);var _0xe804b3=this['channel'][_0xa464('0x55')](_0xa464('0x1b5'),util['format'](_0xa464('0x1b6'),config[_0xa464('0x8')]['host']||'127.0.0.1',_0x4c9fba,this['channel'][_0xa464('0x37')]));if(_0xe804b3[_0xa464('0xa2')]===-0x1){return _0xe804b3;}return this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0xc0'),_0xa464('0x1b5'),_0x4c9fba));};AGIVertices[_0xa464('0x12')]['system']=function(_0x4c7f37){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x1b7'),_0x4c7f37[_0xa464('0x35')]));var _0x205c89=this['shellCommand']['sync'](this,_0x4c7f37['command']);this[_0xa464('0x33')][_0xa464('0x6f')](this,_0x4c7f37,_0x4c7f37['command']);if(this[_0xa464('0x84')](_0x4c7f37[_0xa464('0xd3')])){var _0x6ff0b=this[_0xa464('0xa0')][_0xa464('0x6f')](this,_0x4c7f37[_0xa464('0xd3')]);if(_0x6ff0b){this[_0xa464('0xf')][_0xa464('0x9e')](_0x6ff0b,_0x205c89);return this[_0xa464('0xf')][_0xa464('0xa8')](util['format']('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x4c7f37[_0xa464('0x1b8')],_0x6ff0b));}}return this['channel'][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0x1b9'),_0x4c7f37['command']));};AGIVertices[_0xa464('0x12')][_0xa464('0x1ba')]=function(_0xdde93b){logger[_0xa464('0x2d')](util[_0xa464('0x28')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0xdde93b[_0xa464('0x35')]));_0xdde93b[_0xa464('0x59')]=_0xdde93b[_0xa464('0x59')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0xdde93b[_0xa464('0x1bb')])){return this[_0xa464('0xf')]['noop'](_0xa464('0x1bc'));}if(!this['isConfigured'](_0xdde93b[_0xa464('0x59')])){return this[_0xa464('0xf')][_0xa464('0xa8')](_0xa464('0xa9'));}this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0x1bd'),_0xdde93b[_0xa464('0x59')]));var _0x12ae43=this[_0xa464('0x57')][_0xa464('0x6f')](this,_0xdde93b);if(_0x12ae43){this[_0xa464('0xf')]['noop'](util['format'](_0xa464('0x1be'),_0x12ae43));var _0x5f193c=this[_0xa464('0xf')][_0xa464('0x11f')](_0x12ae43);try{fs[_0xa464('0xfd')](_0x12ae43+_0xa464('0xfe'));}catch(_0x4bd92a){logger['error'](_0x4bd92a);}return _0x5f193c;}return this[_0xa464('0xf')][_0xa464('0x2b')](_0xdde93b,_0xa464('0x1bf'));};AGIVertices[_0xa464('0x12')][_0xa464('0x1c0')]=function(_0x15cdb4){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x1c1'),_0x15cdb4[_0xa464('0x35')]));_0x15cdb4[_0xa464('0x59')]=_0x15cdb4[_0xa464('0x59')][_0xa464('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa464('0x84')](_0x15cdb4['text'])){return this['channel'][_0xa464('0xa8')](_0xa464('0xa9'));}this['channel'][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0x1c2'),_0x15cdb4[_0xa464('0x59')]));var _0x3f59ae=this[_0xa464('0x5f')]['sync'](this,_0x15cdb4);if(_0x3f59ae){this[_0xa464('0xf')][_0xa464('0xa8')](util['format'](_0xa464('0x1c3'),_0x3f59ae));var _0xdbe105=this['channel'][_0xa464('0x11f')](_0x3f59ae);try{fs[_0xa464('0xfd')](_0x3f59ae+'.wav');}catch(_0x2337f7){logger[_0xa464('0x2b')](_0x2337f7);}return _0xdbe105;}return this[_0xa464('0xf')][_0xa464('0x2b')](_0x15cdb4,_0xa464('0x1c4'));};AGIVertices['prototype'][_0xa464('0x1c5')]=function(_0x13a93b){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x1c6'),_0x13a93b[_0xa464('0x35')]));if(!this[_0xa464('0x84')](_0x13a93b[_0xa464('0x152')])){return this[_0xa464('0xf')][_0xa464('0x2b')](_0x13a93b,_0xa464('0x150'));}logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x151'),this[_0xa464('0xf')][_0xa464('0x38')],_0x13a93b[_0xa464('0x152')]));var _0x5dfe81=this[_0xa464('0x4f')]['sync'](this,_0x13a93b[_0xa464('0x152')]);if(_0x5dfe81){logger['info'](util[_0xa464('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa464('0xf')][_0xa464('0x38')],_0x13a93b[_0xa464('0x152')]));this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa464('0xf')]['callerid'],_0x13a93b[_0xa464('0x152')]));return{'code':0xc8,'result':_0xa464('0x157')};}else{logger[_0xa464('0x2d')](util[_0xa464('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa464('0xf')]['callerid'],_0x13a93b[_0xa464('0x152')]));this[_0xa464('0xf')][_0xa464('0xa8')](util[_0xa464('0x28')](_0xa464('0x154'),this[_0xa464('0xf')][_0xa464('0x38')],_0x13a93b[_0xa464('0x152')]));return{'code':0xc8,'result':_0xa464('0x155')};}};AGIVertices[_0xa464('0x12')][_0xa464('0x1c7')]=function(_0x47d997){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x1c8'),_0x47d997[_0xa464('0x35')]));var _0x2a864c=this[_0xa464('0xf')]['exec'](_0xa464('0x1c9'),[_0x47d997[_0xa464('0x1ca')],_0x47d997[_0xa464('0x76')]]);if(_0x2a864c[_0xa464('0xa2')]===-0x1){return _0x2a864c;}return this[_0xa464('0xf')][_0xa464('0xa8')](util['format'](_0xa464('0xc0'),_0xa464('0x1c9'),_0x47d997[_0xa464('0x1ca')]));};AGIVertices[_0xa464('0x12')][_0xa464('0x1cb')]=function(_0x17617f){logger[_0xa464('0x2d')](util[_0xa464('0x28')](_0xa464('0x1cc'),_0x17617f[_0xa464('0x35')]));if(!this[_0xa464('0x84')](_0x17617f[_0xa464('0xd3')])){return this[_0xa464('0xf')][_0xa464('0x2b')](_0x17617f,_0xa464('0x1a8'));}var _0x5f24da=this[_0xa464('0xa0')]['sync'](this,_0x17617f[_0xa464('0xd3')]);if(!_0x5f24da){return this[_0xa464('0xf')][_0xa464('0x2b')](_0x17617f,_0xa464('0xd4'));}var _0x4b6db2=this[_0xa464('0xf')][_0xa464('0xa0')](_0x5f24da);return{'code':0xc8,'result':_0x4b6db2[_0xa464('0xa1')]?_0x4b6db2[_0xa464('0xa1')]:'-'};};String[_0xa464('0x12')]['replaceAll']=function(_0x29b0ab,_0x495cec){return this[_0xa464('0x9f')](_0x29b0ab)[_0xa464('0x1cd')](_0x495cec);};module[_0xa464('0x1ce')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 1dc92bc..6fd917b 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 _0x8a3e=['finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][TIMERS]','stringify','acw','message','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','util','lodash','moment','../ami','../../../config/logger','../rpc/user','voiceQueues','agents','timers','channels','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','name','mandatoryDispositionPause','Action','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','lastPauseAt','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]'];(function(_0x1e0278,_0x3b8f5f){var _0x4923ef=function(_0xe49b74){while(--_0xe49b74){_0x1e0278['push'](_0x1e0278['shift']());}};_0x4923ef(++_0x3b8f5f);}(_0x8a3e,0x16c));var _0xe8a3=function(_0x12054f,_0x5e966d){_0x12054f=_0x12054f-0x0;var _0x17b062=_0x8a3e[_0x12054f];return _0x17b062;};'use strict';var util=require(_0xe8a3('0x0'));var _=require(_0xe8a3('0x1'));var moment=require(_0xe8a3('0x2'));var ami=require(_0xe8a3('0x3'));var logger=require(_0xe8a3('0x4'))('acw');var RpcUser=require(_0xe8a3('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x443db6){this[_0xe8a3('0x6')]=_0x443db6[_0xe8a3('0x6')];this[_0xe8a3('0x7')]=_0x443db6['agents'];this[_0xe8a3('0x8')]=_0x443db6['timers'];this[_0xe8a3('0x9')]={};ami['on']('agentconnect',this[_0xe8a3('0xa')][_0xe8a3('0xb')](this));ami['on']('hanguprequest',this[_0xe8a3('0xc')][_0xe8a3('0xb')](this));ami['on'](_0xe8a3('0xd'),this[_0xe8a3('0xe')][_0xe8a3('0xb')](this));ami['on'](_0xe8a3('0xf'),this[_0xe8a3('0x10')][_0xe8a3('0xb')](this));ami['on'](_0xe8a3('0x11'),this[_0xe8a3('0x12')][_0xe8a3('0xb')](this));ami['on'](_0xe8a3('0x13'),this[_0xe8a3('0x14')][_0xe8a3('0xb')](this));ami['on'](_0xe8a3('0x15'),this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x1c7b12){var _0x59ecc2=moment()['milliseconds'](0x0);var _0x4fc695=moment(_0x1c7b12)[_0xe8a3('0x16')](0x0);return _0x59ecc2[_0xe8a3('0x17')](_0x4fc695,_0xe8a3('0x18'));}Acw[_0xe8a3('0x19')][_0xe8a3('0x1a')]=function(_0x4fdb31){try{var _0x3790cb=this;var _0x545115=this[_0xe8a3('0x9')][_0x4fdb31][_0xe8a3('0x1b')];var _0xf771b7=this['channels'][_0x4fdb31][_0xe8a3('0x1c')];var _0x29a866=this[_0xe8a3('0x6')][_0xf771b7];var _0x47f7bd=![];var _0x33386a=_0xe8a3('0x1d');if(_0x29a866['mandatoryDisposition']){if(_0x29a866['mandatoryDispositionPause'][_0xe8a3('0x1e')]){_0x47f7bd=!![];_0x33386a=_0x29a866[_0xe8a3('0x1f')][_0xe8a3('0x1e')];}}ami[_0xe8a3('0x20')]({'action':'QueuePause','interface':_0x545115,'paused':!![],'reason':_0x33386a})[_0xe8a3('0x21')](function(_0x31eb5d){if(_0x3790cb[_0xe8a3('0x7')][_0x545115]){return RpcUser[_0xe8a3('0x22')](_0x3790cb[_0xe8a3('0x7')][_0x545115]['id'])[_0xe8a3('0x21')](function(_0x37e9de){if(_0x37e9de&&!_0x37e9de[_0xe8a3('0x23')]){logger[_0xe8a3('0x24')](_0xe8a3('0x25'),_0x4fdb31,_0x545115,_0xf771b7);var _0x2d22a0=_0x3790cb[_0xe8a3('0x9')][_0x4fdb31]['attended']&&_0x3790cb[_0xe8a3('0x9')][_0x4fdb31]['destlinkedid']?_0x3790cb[_0xe8a3('0x9')][_0x4fdb31][_0xe8a3('0x26')]:_0x4fdb31;return RpcUser['savePause'](_0x3790cb[_0xe8a3('0x7')][_0x545115],_0x33386a,_0x2d22a0)[_0xe8a3('0x21')](function(_0x2abd3c){if(!_0x47f7bd){_0x3790cb[_0xe8a3('0x8')][_0x545115]={};logger[_0xe8a3('0x24')](_0xe8a3('0x27'),_0x4fdb31,_0x3790cb['voiceQueues'][_0xf771b7][_0xe8a3('0x28')],_0x545115,_0xf771b7);_0x3790cb[_0xe8a3('0x8')][_0x545115][_0xe8a3('0x29')]=setTimeout(_0x3790cb[_0xe8a3('0x2a')][_0xe8a3('0xb')](_0x3790cb,_0x545115),_0x3790cb[_0xe8a3('0x6')][_0xf771b7]['acwTimeout']*0x3e8);_0x3790cb[_0xe8a3('0x8')][_0x545115]['lastPauseAt']=moment()[_0xe8a3('0x2b')](_0xe8a3('0x2c'));_0x3790cb['timers'][_0x545115][_0xe8a3('0x2d')]=_0x4fdb31;_0x3790cb[_0xe8a3('0x8')][_0x545115]['queue']=_0xf771b7;_0x3790cb[_0xe8a3('0x8')][_0x545115]['updateAcw']=function(){var _0x415b0d=getDiff(_0x3790cb[_0xe8a3('0x8')][_0x545115][_0xe8a3('0x2e')]);clearTimeout(_0x3790cb[_0xe8a3('0x8')][_0x545115]['timer']);_0x3790cb[_0xe8a3('0x8')][_0x545115]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x415b0d},_0x3790cb[_0xe8a3('0x8')][_0x545115][_0xe8a3('0x2d')],_0x545115)[_0xe8a3('0x21')](function(_0xcf2bc3){logger[_0xe8a3('0x24')](_0xe8a3('0x2f'),_0x4fdb31,_0x415b0d,_0xcf2bc3);})[_0xe8a3('0x30')](function(_0x25395f){logger[_0xe8a3('0x31')](_0xe8a3('0x32'),_0x4fdb31,_0x25395f);});delete _0x3790cb[_0xe8a3('0x8')][_0x545115];};}});}else{logger[_0xe8a3('0x24')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x4fdb31,_0x545115,_0xf771b7);}});}})[_0xe8a3('0x30')](function(_0x548aa7){logger['error'](_0xe8a3('0x27'),_0x4fdb31,_0x3790cb[_0xe8a3('0x6')][_0xf771b7][_0xe8a3('0x28')],_0x545115,_0xf771b7);})[_0xe8a3('0x33')](function(){delete _0x3790cb[_0xe8a3('0x9')][_0x4fdb31];});}catch(_0x4eb3c0){logger[_0xe8a3('0x31')](_0xe8a3('0x34'),_0x4eb3c0['message']);}};Acw[_0xe8a3('0x19')]['stopAcw']=function(_0x11d950){try{var _0x2f29be=this;if(_0x2f29be[_0xe8a3('0x8')][_0x11d950]){_0x2f29be[_0xe8a3('0x8')][_0x11d950]['timer']=![];var _0x51ae2a=_0x2f29be[_0xe8a3('0x8')][_0x11d950]['uniqueid'];var _0x582977=_0x2f29be['timers'][_0x11d950][_0xe8a3('0x1c')];var _0xc3eef8=_0x2f29be[_0xe8a3('0x6')][_0x582977][_0xe8a3('0x28')];logger[_0xe8a3('0x24')](_0xe8a3('0x35'),_0x51ae2a,_0x11d950);RpcUser[_0xe8a3('0x36')](this[_0xe8a3('0x7')][_0x11d950]);RpcVoiceAgentReport[_0xe8a3('0x37')]({'acwtime':_0xc3eef8,'agentacw':!![]},_0x51ae2a,_0x11d950)[_0xe8a3('0x21')](function(_0x172fbf){logger[_0xe8a3('0x24')](_0xe8a3('0x2f'),_0x51ae2a,_0xc3eef8,_0x172fbf);})['catch'](function(_0x1af109){logger[_0xe8a3('0x31')](_0xe8a3('0x32'),_0x51ae2a,_0x1af109);});}else{logger[_0xe8a3('0x31')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x11d950);if(_0x2f29be[_0xe8a3('0x8')]){logger[_0xe8a3('0x24')](_0xe8a3('0x38'),JSON[_0xe8a3('0x39')](_0x2f29be['timers']));}}}catch(_0x583ace){logger[_0xe8a3('0x31')]('[ACW][STOP]\x20%s',_0x583ace['message']);}};Acw[_0xe8a3('0x19')][_0xe8a3('0xa')]=function(_0x19e57b){try{if(this[_0xe8a3('0x6')][_0x19e57b[_0xe8a3('0x1c')]]&&(this[_0xe8a3('0x6')][_0x19e57b[_0xe8a3('0x1c')]][_0xe8a3('0x3a')]||this['voiceQueues'][_0x19e57b[_0xe8a3('0x1c')]]['mandatoryDisposition'])){if(this[_0xe8a3('0x7')][_0x19e57b[_0xe8a3('0x1b')]]){this[_0xe8a3('0x9')][_0x19e57b[_0xe8a3('0x2d')]]={'queue':_0x19e57b[_0xe8a3('0x1c')],'interface':_0x19e57b[_0xe8a3('0x1b')],'destlinkedid':_0x19e57b['destlinkedid']};}}}catch(_0x4c15cb){logger[_0xe8a3('0x31')]('[ACW][syncAgentConnect]\x20%s',_0x4c15cb[_0xe8a3('0x3b')]);}};Acw[_0xe8a3('0x19')][_0xe8a3('0x3c')]=function(_0x25bd86){try{if(this[_0xe8a3('0x6')][_0x25bd86[_0xe8a3('0x1c')]]&&(this[_0xe8a3('0x6')][_0x25bd86['queue']][_0xe8a3('0x3a')]||this[_0xe8a3('0x6')][_0x25bd86['queue']]['mandatoryDisposition'])){if(this['agents'][_0x25bd86[_0xe8a3('0x1b')]]){this[_0xe8a3('0x9')][_0x25bd86[_0xe8a3('0x2d')]]={'queue':_0x25bd86[_0xe8a3('0x1c')],'interface':_0x25bd86['interface']};}}}catch(_0x43c0bc){logger[_0xe8a3('0x31')](_0xe8a3('0x3d'),_0x43c0bc['message']);}};Acw['prototype']['syncHangupRequest']=function(_0x4a9221){try{if(this[_0xe8a3('0x9')][_0x4a9221['uniqueid']]&&_[_0xe8a3('0x3e')](this[_0xe8a3('0x9')][_0x4a9221['uniqueid']][_0xe8a3('0x3f')])){logger[_0xe8a3('0x24')](_0xe8a3('0x40'),_0x4a9221['uniqueid']);this[_0xe8a3('0x1a')](_0x4a9221['uniqueid']);}else if(this['channels'][_0x4a9221['linkedid']]&&_[_0xe8a3('0x3e')](this[_0xe8a3('0x9')][_0x4a9221[_0xe8a3('0x41')]]['attended'])){logger[_0xe8a3('0x24')](_0xe8a3('0x42'),_0x4a9221[_0xe8a3('0x41')]);this['startAcw'](_0x4a9221[_0xe8a3('0x41')]);}}catch(_0x495a59){logger[_0xe8a3('0x31')](_0xe8a3('0x43'),_0x495a59[_0xe8a3('0x3b')]);}};Acw[_0xe8a3('0x19')][_0xe8a3('0xe')]=function(_0x51fefa){try{if(this[_0xe8a3('0x9')][_0x51fefa['uniqueid']]&&this['channels'][_0x51fefa[_0xe8a3('0x2d')]][_0xe8a3('0x3f')]){logger['info'](_0xe8a3('0x44'),_0x51fefa[_0xe8a3('0x2d')]);this[_0xe8a3('0x1a')](_0x51fefa[_0xe8a3('0x2d')]);}else if(this[_0xe8a3('0x9')][_0x51fefa['linkedid']]&&this[_0xe8a3('0x9')][_0x51fefa[_0xe8a3('0x41')]]['attended']){logger[_0xe8a3('0x24')](_0xe8a3('0x45'),_0x51fefa[_0xe8a3('0x41')]);this[_0xe8a3('0x1a')](_0x51fefa[_0xe8a3('0x41')]);}}catch(_0x389e03){logger[_0xe8a3('0x31')]('[ACW][syncHangup]\x20%s',_0x389e03['message']);}};Acw[_0xe8a3('0x19')][_0xe8a3('0x12')]=function(_0x4db767){try{if(!_['isNil'](this['channels'][_0x4db767[_0xe8a3('0x46')]])){this[_0xe8a3('0x1a')](_0x4db767[_0xe8a3('0x46')]);if(this[_0xe8a3('0x9')][_0x4db767[_0xe8a3('0x47')]]){this[_0xe8a3('0x9')][_0x4db767[_0xe8a3('0x47')]][_0xe8a3('0x3f')]=!![];this['channels'][_0x4db767[_0xe8a3('0x48')]]=this[_0xe8a3('0x9')][_0x4db767[_0xe8a3('0x47')]];delete this[_0xe8a3('0x9')][_0x4db767['secondtransfereruniqueid']];}}else if(!_[_0xe8a3('0x49')](this[_0xe8a3('0x9')][_0x4db767[_0xe8a3('0x48')]])){this[_0xe8a3('0x1a')](_0x4db767[_0xe8a3('0x48')]);if(this[_0xe8a3('0x9')][_0x4db767[_0xe8a3('0x4a')]]){this[_0xe8a3('0x9')][_0x4db767[_0xe8a3('0x4a')]][_0xe8a3('0x3f')]=!![];this[_0xe8a3('0x9')][_0x4db767[_0xe8a3('0x46')]]=this[_0xe8a3('0x9')][_0x4db767[_0xe8a3('0x4a')]];delete this[_0xe8a3('0x9')][_0x4db767[_0xe8a3('0x4a')]];}}}catch(_0x28f75b){logger['error'](_0xe8a3('0x4b'),_0x28f75b[_0xe8a3('0x3b')]);}};Acw[_0xe8a3('0x19')][_0xe8a3('0x14')]=function(_0x166d5e){try{if(this[_0xe8a3('0x9')][_0x166d5e[_0xe8a3('0x4c')]]){logger['info'](_0xe8a3('0x4d'),JSON[_0xe8a3('0x39')](_0x166d5e[_0xe8a3('0x4c')]));this[_0xe8a3('0x1a')](_0x166d5e['transfereruniqueid']);}else if(this[_0xe8a3('0x9')][_0x166d5e['transfererlinkedid']]){logger[_0xe8a3('0x24')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xe8a3('0x39')](_0x166d5e[_0xe8a3('0x4e')]));this[_0xe8a3('0x1a')](_0x166d5e[_0xe8a3('0x4e')]);}}catch(_0x5afe09){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x5afe09[_0xe8a3('0x3b')]);}};Acw[_0xe8a3('0x19')][_0xe8a3('0x10')]=function(_0x3f2727){try{if(this[_0xe8a3('0x6')][_0x3f2727[_0xe8a3('0x1c')]]&&this['voiceQueues'][_0x3f2727[_0xe8a3('0x1c')]]['autopause']===_0xe8a3('0x4f')){if(this[_0xe8a3('0x7')][_0x3f2727[_0xe8a3('0x1b')]]){logger[_0xe8a3('0x24')](_0xe8a3('0x50'),_0x3f2727['uniqueid'],_0x3f2727[_0xe8a3('0x1b')],_0x3f2727[_0xe8a3('0x1c')]);return RpcUser['savePause'](this[_0xe8a3('0x7')][_0x3f2727[_0xe8a3('0x1b')]],_0xe8a3('0x51'),_0x3f2727[_0xe8a3('0x2d')]);}}}catch(_0x4791eb){logger[_0xe8a3('0x31')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x4791eb['message']);}};module[_0xe8a3('0x52')]=Acw; \ No newline at end of file +var _0x260e=['[ACW][syncBlindTransfer]\x20%s','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','timers','channels','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','interface','queue','ACW','mandatoryDispositionPause','name','Action','QueuePause','then','agents','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','acwTimeout','format','updateAcw','lastPauseAt','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','prototype','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid'];(function(_0x40909f,_0xaad19e){var _0x31daed=function(_0x1af5b8){while(--_0x1af5b8){_0x40909f['push'](_0x40909f['shift']());}};_0x31daed(++_0xaad19e);}(_0x260e,0xa8));var _0xe260=function(_0x4172d3,_0x583e85){_0x4172d3=_0x4172d3-0x0;var _0xe4d522=_0x260e[_0x4172d3];return _0xe4d522;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');var ami=require(_0xe260('0x0'));var logger=require(_0xe260('0x1'))(_0xe260('0x2'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xe260('0x3'));function Acw(_0x3f64da){this['voiceQueues']=_0x3f64da[_0xe260('0x4')];this['agents']=_0x3f64da['agents'];this[_0xe260('0x5')]=_0x3f64da['timers'];this[_0xe260('0x6')]={};ami['on'](_0xe260('0x7'),this[_0xe260('0x8')]['bind'](this));ami['on'](_0xe260('0x9'),this[_0xe260('0xa')][_0xe260('0xb')](this));ami['on'](_0xe260('0xc'),this['syncHangup'][_0xe260('0xb')](this));ami['on'](_0xe260('0xd'),this[_0xe260('0xe')][_0xe260('0xb')](this));ami['on'](_0xe260('0xf'),this[_0xe260('0x10')][_0xe260('0xb')](this));ami['on'](_0xe260('0x11'),this[_0xe260('0x12')][_0xe260('0xb')](this));ami['on'](_0xe260('0x13'),this[_0xe260('0x14')][_0xe260('0xb')](this));}function getDiff(_0x5c37ca){var _0x6bcfc7=moment()[_0xe260('0x15')](0x0);var _0x126e25=moment(_0x5c37ca)[_0xe260('0x15')](0x0);return _0x6bcfc7[_0xe260('0x16')](_0x126e25,_0xe260('0x17'));}Acw['prototype'][_0xe260('0x18')]=function(_0x4c59a5){try{var _0x47ce9d=this;var _0x366a58=this[_0xe260('0x6')][_0x4c59a5][_0xe260('0x19')];var _0x5e9d65=this[_0xe260('0x6')][_0x4c59a5][_0xe260('0x1a')];var _0x57816a=this[_0xe260('0x4')][_0x5e9d65];var _0x269643=![];var _0x5e70ca=_0xe260('0x1b');if(_0x57816a['mandatoryDisposition']){if(_0x57816a[_0xe260('0x1c')][_0xe260('0x1d')]){_0x269643=!![];_0x5e70ca=_0x57816a[_0xe260('0x1c')]['name'];}}ami[_0xe260('0x1e')]({'action':_0xe260('0x1f'),'interface':_0x366a58,'paused':!![],'reason':_0x5e70ca})[_0xe260('0x20')](function(_0x3c8344){if(_0x47ce9d[_0xe260('0x21')][_0x366a58]){return RpcUser['getAgent'](_0x47ce9d['agents'][_0x366a58]['id'])[_0xe260('0x20')](function(_0x3b3daa){if(_0x3b3daa&&!_0x3b3daa[_0xe260('0x22')]){logger[_0xe260('0x23')](_0xe260('0x24'),_0x4c59a5,_0x366a58,_0x5e9d65);var _0x228c21=_0x47ce9d[_0xe260('0x6')][_0x4c59a5][_0xe260('0x25')]&&_0x47ce9d[_0xe260('0x6')][_0x4c59a5][_0xe260('0x26')]?_0x47ce9d[_0xe260('0x6')][_0x4c59a5][_0xe260('0x26')]:_0x4c59a5;return RpcUser[_0xe260('0x27')](_0x47ce9d[_0xe260('0x21')][_0x366a58],_0x5e70ca,_0x228c21)[_0xe260('0x20')](function(_0x1628eb){if(!_0x269643){_0x47ce9d[_0xe260('0x5')][_0x366a58]={};logger[_0xe260('0x23')](_0xe260('0x28'),_0x4c59a5,_0x47ce9d[_0xe260('0x4')][_0x5e9d65]['acwTimeout'],_0x366a58,_0x5e9d65);_0x47ce9d[_0xe260('0x5')][_0x366a58][_0xe260('0x29')]=setTimeout(_0x47ce9d['stopAcw'][_0xe260('0xb')](_0x47ce9d,_0x366a58),_0x47ce9d['voiceQueues'][_0x5e9d65][_0xe260('0x2a')]*0x3e8);_0x47ce9d[_0xe260('0x5')][_0x366a58]['lastPauseAt']=moment()[_0xe260('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');_0x47ce9d[_0xe260('0x5')][_0x366a58]['uniqueid']=_0x4c59a5;_0x47ce9d[_0xe260('0x5')][_0x366a58][_0xe260('0x1a')]=_0x5e9d65;_0x47ce9d[_0xe260('0x5')][_0x366a58][_0xe260('0x2c')]=function(){var _0x15cd25=getDiff(_0x47ce9d[_0xe260('0x5')][_0x366a58][_0xe260('0x2d')]);clearTimeout(_0x47ce9d[_0xe260('0x5')][_0x366a58][_0xe260('0x29')]);_0x47ce9d[_0xe260('0x5')][_0x366a58][_0xe260('0x29')]=![];RpcVoiceAgentReport[_0xe260('0x2e')]({'acwtime':_0x15cd25},_0x47ce9d[_0xe260('0x5')][_0x366a58][_0xe260('0x2f')],_0x366a58)[_0xe260('0x20')](function(_0x3e185f){logger[_0xe260('0x23')](_0xe260('0x30'),_0x4c59a5,_0x15cd25,_0x3e185f);})[_0xe260('0x31')](function(_0x3059c2){logger[_0xe260('0x32')](_0xe260('0x33'),_0x4c59a5,_0x3059c2);});delete _0x47ce9d['timers'][_0x366a58];};}});}else{logger[_0xe260('0x23')](_0xe260('0x34'),_0x4c59a5,_0x366a58,_0x5e9d65);}});}})[_0xe260('0x31')](function(_0x55a112){logger[_0xe260('0x32')](_0xe260('0x28'),_0x4c59a5,_0x47ce9d['voiceQueues'][_0x5e9d65][_0xe260('0x2a')],_0x366a58,_0x5e9d65);})['finally'](function(){delete _0x47ce9d['channels'][_0x4c59a5];});}catch(_0x1bb18f){logger[_0xe260('0x32')](_0xe260('0x35'),_0x1bb18f[_0xe260('0x36')]);}};Acw['prototype']['stopAcw']=function(_0x12cf33){try{var _0x11bb02=this;if(_0x11bb02['timers'][_0x12cf33]){_0x11bb02['timers'][_0x12cf33][_0xe260('0x29')]=![];var _0x170f4c=_0x11bb02[_0xe260('0x5')][_0x12cf33][_0xe260('0x2f')];var _0x87d315=_0x11bb02[_0xe260('0x5')][_0x12cf33][_0xe260('0x1a')];var _0xaf3081=_0x11bb02[_0xe260('0x4')][_0x87d315][_0xe260('0x2a')];logger['info'](_0xe260('0x37'),_0x170f4c,_0x12cf33);RpcUser[_0xe260('0x38')](this[_0xe260('0x21')][_0x12cf33]);RpcVoiceAgentReport[_0xe260('0x2e')]({'acwtime':_0xaf3081,'agentacw':!![]},_0x170f4c,_0x12cf33)[_0xe260('0x20')](function(_0xeab454){logger[_0xe260('0x23')](_0xe260('0x30'),_0x170f4c,_0xaf3081,_0xeab454);})[_0xe260('0x31')](function(_0x1dd929){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x170f4c,_0x1dd929);});}else{logger[_0xe260('0x32')](_0xe260('0x39'),_0x12cf33);if(_0x11bb02['timers']){logger[_0xe260('0x23')](_0xe260('0x3a'),JSON[_0xe260('0x3b')](_0x11bb02[_0xe260('0x5')]));}}}catch(_0x490f92){logger[_0xe260('0x32')]('[ACW][STOP]\x20%s',_0x490f92[_0xe260('0x36')]);}};Acw[_0xe260('0x3c')][_0xe260('0x8')]=function(_0x4cca99){try{if(this[_0xe260('0x4')][_0x4cca99[_0xe260('0x1a')]]&&(this['voiceQueues'][_0x4cca99['queue']][_0xe260('0x2')]||this[_0xe260('0x4')][_0x4cca99['queue']][_0xe260('0x3d')])){if(this[_0xe260('0x21')][_0x4cca99[_0xe260('0x19')]]){this['channels'][_0x4cca99[_0xe260('0x2f')]]={'queue':_0x4cca99['queue'],'interface':_0x4cca99['interface'],'destlinkedid':_0x4cca99['destlinkedid']};}}}catch(_0x1036c8){logger['error'](_0xe260('0x3e'),_0x1036c8['message']);}};Acw[_0xe260('0x3c')]['syncAgentConnectPreview']=function(_0x3d23b0){try{if(this[_0xe260('0x4')][_0x3d23b0[_0xe260('0x1a')]]&&(this['voiceQueues'][_0x3d23b0['queue']][_0xe260('0x2')]||this[_0xe260('0x4')][_0x3d23b0[_0xe260('0x1a')]][_0xe260('0x3d')])){if(this[_0xe260('0x21')][_0x3d23b0['interface']]){this[_0xe260('0x6')][_0x3d23b0[_0xe260('0x2f')]]={'queue':_0x3d23b0[_0xe260('0x1a')],'interface':_0x3d23b0[_0xe260('0x19')]};}}}catch(_0x50c3d0){logger[_0xe260('0x32')]('[ACW][syncAgentConnectPreview]\x20%s',_0x50c3d0[_0xe260('0x36')]);}};Acw[_0xe260('0x3c')]['syncHangupRequest']=function(_0x4e4f81){try{if(this[_0xe260('0x6')][_0x4e4f81['uniqueid']]&&_[_0xe260('0x3f')](this[_0xe260('0x6')][_0x4e4f81['uniqueid']]['attended'])){logger[_0xe260('0x23')]('[%s][HANGUP:UNIQUEID]',_0x4e4f81[_0xe260('0x2f')]);this[_0xe260('0x18')](_0x4e4f81[_0xe260('0x2f')]);}else if(this['channels'][_0x4e4f81['linkedid']]&&_[_0xe260('0x3f')](this[_0xe260('0x6')][_0x4e4f81[_0xe260('0x40')]]['attended'])){logger[_0xe260('0x23')](_0xe260('0x41'),_0x4e4f81[_0xe260('0x40')]);this[_0xe260('0x18')](_0x4e4f81['linkedid']);}}catch(_0x499f04){logger[_0xe260('0x32')](_0xe260('0x42'),_0x499f04[_0xe260('0x36')]);}};Acw[_0xe260('0x3c')]['syncHangup']=function(_0x201425){try{if(this[_0xe260('0x6')][_0x201425[_0xe260('0x2f')]]&&this[_0xe260('0x6')][_0x201425[_0xe260('0x2f')]][_0xe260('0x25')]){logger[_0xe260('0x23')](_0xe260('0x43'),_0x201425['uniqueid']);this[_0xe260('0x18')](_0x201425[_0xe260('0x2f')]);}else if(this[_0xe260('0x6')][_0x201425[_0xe260('0x40')]]&&this[_0xe260('0x6')][_0x201425[_0xe260('0x40')]][_0xe260('0x25')]){logger[_0xe260('0x23')](_0xe260('0x44'),_0x201425[_0xe260('0x40')]);this['startAcw'](_0x201425[_0xe260('0x40')]);}}catch(_0x6d640b){logger['error'](_0xe260('0x45'),_0x6d640b[_0xe260('0x36')]);}};Acw[_0xe260('0x3c')][_0xe260('0x10')]=function(_0x4c1b9c){try{if(!_['isNil'](this[_0xe260('0x6')][_0x4c1b9c[_0xe260('0x46')]])){this[_0xe260('0x18')](_0x4c1b9c[_0xe260('0x46')]);if(this[_0xe260('0x6')][_0x4c1b9c[_0xe260('0x47')]]){this[_0xe260('0x6')][_0x4c1b9c['secondtransfereruniqueid']][_0xe260('0x25')]=!![];this[_0xe260('0x6')][_0x4c1b9c[_0xe260('0x48')]]=this[_0xe260('0x6')][_0x4c1b9c['secondtransfereruniqueid']];delete this[_0xe260('0x6')][_0x4c1b9c[_0xe260('0x47')]];}}else if(!_['isNil'](this[_0xe260('0x6')][_0x4c1b9c[_0xe260('0x48')]])){this['startAcw'](_0x4c1b9c[_0xe260('0x48')]);if(this[_0xe260('0x6')][_0x4c1b9c[_0xe260('0x49')]]){this[_0xe260('0x6')][_0x4c1b9c[_0xe260('0x49')]][_0xe260('0x25')]=!![];this['channels'][_0x4c1b9c['transfereeuniqueid']]=this[_0xe260('0x6')][_0x4c1b9c[_0xe260('0x49')]];delete this[_0xe260('0x6')][_0x4c1b9c[_0xe260('0x49')]];}}}catch(_0x423dbb){logger[_0xe260('0x32')](_0xe260('0x4a'),_0x423dbb['message']);}};Acw[_0xe260('0x3c')][_0xe260('0x12')]=function(_0x2d0b8e){try{if(this[_0xe260('0x6')][_0x2d0b8e['transfereruniqueid']]){logger[_0xe260('0x23')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xe260('0x3b')](_0x2d0b8e[_0xe260('0x4b')]));this['startAcw'](_0x2d0b8e[_0xe260('0x4b')]);}else if(this[_0xe260('0x6')][_0x2d0b8e['transfererlinkedid']]){logger[_0xe260('0x23')](_0xe260('0x4c'),JSON['stringify'](_0x2d0b8e[_0xe260('0x4d')]));this[_0xe260('0x18')](_0x2d0b8e['transfererlinkedid']);}}catch(_0x512106){logger[_0xe260('0x32')](_0xe260('0x4e'),_0x512106[_0xe260('0x36')]);}};Acw[_0xe260('0x3c')][_0xe260('0xe')]=function(_0x5d2543){try{if(this[_0xe260('0x4')][_0x5d2543['queue']]&&this['voiceQueues'][_0x5d2543[_0xe260('0x1a')]]['autopause']===_0xe260('0x4f')){if(this[_0xe260('0x21')][_0x5d2543[_0xe260('0x19')]]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x5d2543[_0xe260('0x2f')],_0x5d2543[_0xe260('0x19')],_0x5d2543[_0xe260('0x1a')]);return RpcUser[_0xe260('0x27')](this[_0xe260('0x21')][_0x5d2543[_0xe260('0x19')]],_0xe260('0x50'),_0x5d2543[_0xe260('0x2f')]);}}}catch(_0x4b3e02){logger[_0xe260('0x32')](_0xe260('0x51'),_0x4b3e02[_0xe260('0x36')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index f8e44c5..804c04f 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 _0xb10b=['asterisk','port','password','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','username','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','[ami.js][fullybooted]','asterisk-manager','moment','util','lodash','ami','../../config/environment'];(function(_0x231f1d,_0x350e66){var _0x23671d=function(_0x23f199){while(--_0x23f199){_0x231f1d['push'](_0x231f1d['shift']());}};_0x23671d(++_0x350e66);}(_0xb10b,0x12a));var _0xbb10=function(_0x3a852a,_0xf3f1d3){_0x3a852a=_0x3a852a-0x0;var _0x48c902=_0xb10b[_0x3a852a];return _0x48c902;};'use strict';var Manager=require(_0xbb10('0x0'));var BPromise=require('bluebird');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var _=require(_0xbb10('0x3'));var logger=require('../../config/logger')(_0xbb10('0x4'));var config=require(_0xbb10('0x5'));var ami=new Manager(config[_0xbb10('0x6')][_0xbb10('0x7')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')]['username'],config[_0xbb10('0x6')][_0xbb10('0x8')],!![]);ami['keepConnected']();ami[_0xbb10('0x9')]=BPromise[_0xbb10('0xa')](ami[_0xbb10('0xb')]);function error(_0x1c3ee5){logger[_0xbb10('0xc')](util[_0xbb10('0xd')](_0xbb10('0xe'),config[_0xbb10('0x6')]['username'],config['asterisk']['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')],util[_0xbb10('0xf')](_0x1c3ee5,![],null)));}function close(){logger['error'](util[_0xbb10('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xbb10('0x6')][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')]));}ami[_0xbb10('0x11')]=function(){return function(){return ami['Action']({'action':_0xbb10('0x12')});};};ami[_0xbb10('0x13')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x14')});};};ami[_0xbb10('0x15')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x16')});};};ami[_0xbb10('0x17')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x18')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x19')});};};function connect(_0x133ac2){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')](_0xbb10('0x1b'),config[_0xbb10('0x6')][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')]['port']));ami[_0xbb10('0x1c')](_0xbb10('0xc'),error);ami[_0xbb10('0x1c')](_0xbb10('0x1d'),close);}ami['on'](_0xbb10('0x1e'),connect);ami['on'](_0xbb10('0x1f'),function(_0x4deb49){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')],util[_0xbb10('0xf')](_0x4deb49,![],null)));});ami['on'](_0xbb10('0x20'),function(_0x407cb4){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')](_0xbb10('0x21'),config[_0xbb10('0x6')][_0xbb10('0x10')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0xbb10('0x22')]()[_0xbb10('0x23')](ami[_0xbb10('0x11')]())['then'](ami[_0xbb10('0x13')]())[_0xbb10('0x23')](ami[_0xbb10('0x15')]())[_0xbb10('0x23')](ami[_0xbb10('0x17')]())[_0xbb10('0x23')](ami[_0xbb10('0x24')]())['catch'](function(_0x3796c7){logger[_0xbb10('0xc')](_0xbb10('0x25'),util[_0xbb10('0xf')](_0x3796c7,{'showHidden':![],'depth':null}));});});ami[_0xbb10('0x1c')](_0xbb10('0xc'),error);ami['once'](_0xbb10('0x1d'),close);module['exports']=ami; \ No newline at end of file +var _0x0b0e=['../../config/environment','asterisk','port','username','password','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','once','asterisk-manager','moment','lodash','../../config/logger','ami'];(function(_0x2b38ab,_0x17341f){var _0x44a655=function(_0x332b55){while(--_0x332b55){_0x2b38ab['push'](_0x2b38ab['shift']());}};_0x44a655(++_0x17341f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0x0b0e[_0x3712e2];return _0x1faff4;};'use strict';var Manager=require(_0xe0b0('0x0'));var BPromise=require('bluebird');var moment=require(_0xe0b0('0x1'));var util=require('util');var _=require(_0xe0b0('0x2'));var logger=require(_0xe0b0('0x3'))(_0xe0b0('0x4'));var config=require(_0xe0b0('0x5'));var ami=new Manager(config[_0xe0b0('0x6')][_0xe0b0('0x7')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')][_0xe0b0('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xe0b0('0xa')](ami[_0xe0b0('0xb')]);function error(_0xc4a085){logger[_0xe0b0('0xc')](util['format'](_0xe0b0('0xd'),config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')]['port'],util[_0xe0b0('0xe')](_0xc4a085,![],null)));}function close(){logger[_0xe0b0('0xc')](util[_0xe0b0('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x11')});};};ami[_0xe0b0('0x12')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'sippeerstatus'});};};ami[_0xe0b0('0x14')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'queuesummary'});};};ami[_0xe0b0('0x15')]=function(){return function(){return ami['Action']({'action':_0xe0b0('0x16')});};};function connect(_0x100204){logger['info'](util['format'](_0xe0b0('0x17'),config['asterisk']['username'],config['asterisk']['ip'],config[_0xe0b0('0x6')]['port']));ami['once'](_0xe0b0('0xc'),error);ami['once'](_0xe0b0('0x18'),close);}ami['on']('connect',connect);ami['on'](_0xe0b0('0x19'),function(_0x1cd7c4){logger[_0xe0b0('0x1a')](util[_0xe0b0('0xf')](_0xe0b0('0x1b'),config['asterisk']['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')],util[_0xe0b0('0xe')](_0x1cd7c4,![],null)));});ami['on']('fullybooted',function(_0x170ad8){logger['info'](util[_0xe0b0('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')]));return BPromise['resolve']()[_0xe0b0('0x1c')](ami['actionSipShowRegistry']())[_0xe0b0('0x1c')](ami[_0xe0b0('0x12')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x1d')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x14')]())['then'](ami[_0xe0b0('0x15')]())[_0xe0b0('0x1e')](function(_0x5b7a64){logger[_0xe0b0('0xc')](_0xe0b0('0x1f'),util[_0xe0b0('0xe')](_0x5b7a64,{'showHidden':![],'depth':null}));});});ami[_0xe0b0('0x20')](_0xe0b0('0xc'),error);ami[_0xe0b0('0x20')](_0xe0b0('0x18'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index aea2163..a13b44e 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 _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x2af71f,_0x856d92){var _0x184aaf=function(_0x3e2726){while(--_0x3e2726){_0x2af71f['push'](_0x2af71f['shift']());}};_0x184aaf(++_0x856d92);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2b0397,_0x524af8){_0x2b0397=_0x2b0397-0x0;var _0x1a0ac9=_0xbdb7[_0x2b0397];return _0x1a0ac9;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file +var _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x3f4891,_0x4e6f62){var _0x54f2d8=function(_0x2b11ee){while(--_0x2b11ee){_0x3f4891['push'](_0x3f4891['shift']());}};_0x54f2d8(++_0x4e6f62);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2c2980,_0x34282a){_0x2c2980=_0x2c2980-0x0;var _0x2a20a9=_0xcb91[_0x2c2980];return _0x2a20a9;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 428b33a..eec398e 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd68c=['uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','dialCutDigit','prototype','getQueue','exports','lodash','moment','string','voiceQueue'];(function(_0x16066e,_0x31e151){var _0x52a12e=function(_0x3e6bed){while(--_0x3e6bed){_0x16066e['push'](_0x16066e['shift']());}};_0x52a12e(++_0x31e151);}(_0xd68c,0xa8));var _0xcd68=function(_0x5ce15c,_0x19c917){_0x5ce15c=_0x5ce15c-0x0;var _0x36e4f5=_0xd68c[_0x5ce15c];return _0x36e4f5;};'use strict';var util=require('util');var _=require(_0xcd68('0x0'));var moment=require(_0xcd68('0x1'));function checkNameSurname(_0x4bc08e,_0x525432,_0x56be01){var _0x7d6224='';if(!_['isNil'](_0x525432)&&_0xcd68('0x2')===typeof _0x525432){_0x7d6224+=_0x525432;}if(!_['isNil'](_0x56be01)&&_0xcd68('0x2')===typeof _0x56be01){_0x7d6224+='\x20'+_0x56be01;}if(_0x7d6224!==''){return _0x7d6224;}return _0x4bc08e;}function Action(_0x1d087b,_0x22e1aa,_0x51b45e){this[_0xcd68('0x3')]=_0x1d087b;this[_0xcd68('0x4')]=_0x51b45e||undefined;this[_0xcd68('0x5')]=checkNameSurname(_0x22e1aa[_0xcd68('0x6')][_0xcd68('0x7')],_0x22e1aa['Contact'][_0xcd68('0x8')],_0x22e1aa[_0xcd68('0x6')][_0xcd68('0x9')]);this[_0xcd68('0xa')]=_0x22e1aa[_0xcd68('0x6')][_0xcd68('0x7')];this[_0xcd68('0xb')]=_0x1d087b[_0xcd68('0x5')];this[_0xcd68('0xc')]=_0x22e1aa[_0xcd68('0xc')]||![];this[_0xcd68('0xd')]=_0x1d087b['type'];this[_0xcd68('0xe')]=_0x1d087b['dialQueueTimeout']||0x3;this[_0xcd68('0xf')]=_0x22e1aa[_0xcd68('0xf')];this[_0xcd68('0x10')]=_0x22e1aa[_0xcd68('0x10')];this[_0xcd68('0x11')]=_0x22e1aa[_0xcd68('0x11')];this[_0xcd68('0x12')]=_0x22e1aa['countnoanswerretry'];this['countnosuchnumberretry']=_0x22e1aa[_0xcd68('0x13')];this[_0xcd68('0x14')]=_0x22e1aa[_0xcd68('0x14')];this[_0xcd68('0x15')]=_0x22e1aa[_0xcd68('0x15')];this['countmachineretry']=_0x22e1aa[_0xcd68('0x16')];this[_0xcd68('0x17')]=_0x22e1aa[_0xcd68('0x17')];this['ContactId']=_0x22e1aa[_0xcd68('0x18')];this[_0xcd68('0x19')]=_0x22e1aa[_0xcd68('0x19')];this[_0xcd68('0x1a')]=_0x22e1aa[_0xcd68('0x1a')];this[_0xcd68('0x1b')]=_0x22e1aa[_0xcd68('0x1b')];this[_0xcd68('0x1c')]=_0x22e1aa[_0xcd68('0x1c')];this[_0xcd68('0x1d')]=_0x22e1aa['id'];this['ContactFirstName']=_0x22e1aa[_0xcd68('0x6')]['firstName']||'';this[_0xcd68('0x1e')]=moment()[_0xcd68('0x1f')](_0xcd68('0x20'));this[_0xcd68('0x21')]=_0x22e1aa[_0xcd68('0x21')];this[_0xcd68('0x22')]=_0x22e1aa[_0xcd68('0x22')];this[_0xcd68('0x23')]=_0x22e1aa[_0xcd68('0x23')];this[_0xcd68('0x24')]=_0x22e1aa[_0xcd68('0x24')];this[_0xcd68('0x25')]='';this[_0xcd68('0x26')]='';}Action['prototype']['getCaller']=function(){return util[_0xcd68('0x1f')]('\x22%s\x22\x20<%s>',this[_0xcd68('0x5')],this[_0xcd68('0x3')][_0xcd68('0x27')]>0x0?this[_0xcd68('0xa')]['substring'](this[_0xcd68('0x3')][_0xcd68('0x27')]):this[_0xcd68('0xa')]);};Action[_0xcd68('0x28')][_0xcd68('0x29')]=function(){return this['queue'];};module[_0xcd68('0x2a')]=Action; \ No newline at end of file +var _0x2b58=['starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','voiceQueue','substring','dialCutDigit','util','lodash','moment','string','isNil','uniqueid','Contact','phone','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName'];(function(_0x3f32a5,_0x37489c){var _0x398767=function(_0x4760b8){while(--_0x4760b8){_0x3f32a5['push'](_0x3f32a5['shift']());}};_0x398767(++_0x37489c);}(_0x2b58,0x1d0));var _0x82b5=function(_0x2b70bf,_0x581712){_0x2b70bf=_0x2b70bf-0x0;var _0x34270a=_0x2b58[_0x2b70bf];return _0x34270a;};'use strict';var util=require(_0x82b5('0x0'));var _=require(_0x82b5('0x1'));var moment=require(_0x82b5('0x2'));function checkNameSurname(_0x445508,_0x14166a,_0x33f124){var _0x4c3a11='';if(!_['isNil'](_0x14166a)&&_0x82b5('0x3')===typeof _0x14166a){_0x4c3a11+=_0x14166a;}if(!_[_0x82b5('0x4')](_0x33f124)&&_0x82b5('0x3')===typeof _0x33f124){_0x4c3a11+='\x20'+_0x33f124;}if(_0x4c3a11!==''){return _0x4c3a11;}return _0x445508;}function Action(_0x17bc1c,_0x43dae9,_0x3d4434){this['voiceQueue']=_0x17bc1c;this[_0x82b5('0x5')]=_0x3d4434||undefined;this['name']=checkNameSurname(_0x43dae9[_0x82b5('0x6')][_0x82b5('0x7')],_0x43dae9[_0x82b5('0x6')]['firstName'],_0x43dae9['Contact'][_0x82b5('0x8')]);this[_0x82b5('0x9')]=_0x43dae9[_0x82b5('0x6')]['phone'];this[_0x82b5('0xa')]=_0x17bc1c[_0x82b5('0xb')];this[_0x82b5('0xc')]=_0x43dae9[_0x82b5('0xc')]||![];this['type']=_0x17bc1c[_0x82b5('0xd')];this[_0x82b5('0xe')]=_0x17bc1c['dialQueueTimeout']||0x3;this[_0x82b5('0xf')]=_0x43dae9[_0x82b5('0xf')];this[_0x82b5('0x10')]=_0x43dae9[_0x82b5('0x10')];this[_0x82b5('0x11')]=_0x43dae9['countcongestionretry'];this[_0x82b5('0x12')]=_0x43dae9['countnoanswerretry'];this[_0x82b5('0x13')]=_0x43dae9['countnosuchnumberretry'];this['countdropretry']=_0x43dae9['countdropretry'];this[_0x82b5('0x14')]=_0x43dae9['countabandonedretry'];this[_0x82b5('0x15')]=_0x43dae9[_0x82b5('0x15')];this['countagentrejectretry']=_0x43dae9[_0x82b5('0x16')];this[_0x82b5('0x17')]=_0x43dae9['ContactId'];this[_0x82b5('0x18')]=_0x43dae9[_0x82b5('0x18')];this[_0x82b5('0x19')]=_0x43dae9['UserId'];this[_0x82b5('0x1a')]=_0x43dae9[_0x82b5('0x1a')];this[_0x82b5('0x1b')]=_0x43dae9[_0x82b5('0x1b')];this[_0x82b5('0x1c')]=_0x43dae9['id'];this[_0x82b5('0x1d')]=_0x43dae9[_0x82b5('0x6')][_0x82b5('0x1e')]||'';this[_0x82b5('0x1f')]=moment()[_0x82b5('0x20')](_0x82b5('0x21'));this['callback']=_0x43dae9[_0x82b5('0x22')];this[_0x82b5('0x23')]=_0x43dae9[_0x82b5('0x23')];this[_0x82b5('0x24')]=_0x43dae9['callbackat'];this[_0x82b5('0x25')]=_0x43dae9[_0x82b5('0x25')];this[_0x82b5('0x26')]='';this[_0x82b5('0x27')]='';}Action[_0x82b5('0x28')]['getCaller']=function(){return util['format'](_0x82b5('0x29'),this[_0x82b5('0xb')],this[_0x82b5('0x2a')]['dialCutDigit']>0x0?this[_0x82b5('0x9')][_0x82b5('0x2b')](this[_0x82b5('0x2a')][_0x82b5('0x2c')]):this[_0x82b5('0x9')]);};Action[_0x82b5('0x28')]['getQueue']=function(){return this[_0x82b5('0xa')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 44ce221..31bfee7 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf459=['countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','starttime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','queue','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countmachineretry'];(function(_0x32fa9c,_0x173d77){var _0x2ff4f3=function(_0x5cbe04){while(--_0x5cbe04){_0x32fa9c['push'](_0x32fa9c['shift']());}};_0x2ff4f3(++_0x173d77);}(_0xf459,0x73));var _0x9f45=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf459[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x9f45('0x0'));var _=require(_0x9f45('0x1'));var moment=require(_0x9f45('0x2'));function getSeconds(_0x55d069,_0x2b5774){var _0x1ab187=moment(_0x55d069)['milliseconds'](0x0);var _0x4b4286=moment(_0x2b5774)[_0x9f45('0x3')](0x0);return _0x1ab187[_0x9f45('0x4')](_0x4b4286,_0x9f45('0x5'));}function AgentComplete(_0x46fbb7,_0x21556b){this[_0x9f45('0x6')]=0x4;this[_0x9f45('0x7')]=_0x9f45('0x8');this[_0x9f45('0x9')]=_0x46fbb7[_0x9f45('0x9')];this[_0x9f45('0xa')]=_0x46fbb7['type'];this[_0x9f45('0xb')]=_0x46fbb7[_0x9f45('0xa')]==='outbound'?'queue':_0x46fbb7['type'];this[_0x9f45('0xc')]=_0x46fbb7[_0x9f45('0xc')];this['countcongestionretry']=_0x46fbb7[_0x9f45('0xd')];this[_0x9f45('0xe')]=_0x46fbb7[_0x9f45('0xe')];this[_0x9f45('0xf')]=_0x46fbb7[_0x9f45('0xc')]+_0x46fbb7[_0x9f45('0xd')]+_0x46fbb7[_0x9f45('0xe')]+_0x46fbb7['countnosuchnumberretry']+_0x46fbb7['countdropretry']+_0x46fbb7['countabandonedretry']+_0x46fbb7[_0x9f45('0x10')]+_0x46fbb7['countagentrejectretry'];this[_0x9f45('0x11')]=_0x46fbb7[_0x9f45('0x11')];this[_0x9f45('0x12')]=_0x46fbb7[_0x9f45('0x12')];this[_0x9f45('0x13')]=_0x46fbb7[_0x9f45('0x13')];this[_0x9f45('0x10')]=_0x46fbb7['countmachineretry'];this[_0x9f45('0x14')]=_0x46fbb7[_0x9f45('0x14')];this[_0x9f45('0x15')]=_0x21556b[_0x9f45('0x15')];this[_0x9f45('0x16')]=_0x46fbb7[_0x9f45('0x17')];this['calleridnum']=_0x46fbb7['number'];this[_0x9f45('0x18')]=_0x46fbb7['starttime'];this['responsetime']=_0x46fbb7['responsetime'];this[_0x9f45('0x19')]=_0x46fbb7[_0x9f45('0x19')];this[_0x9f45('0x1a')]=moment()['format'](_0x9f45('0x1b'));this[_0x9f45('0x1c')]=getSeconds(_0x46fbb7[_0x9f45('0x1d')],_0x46fbb7[_0x9f45('0x18')]);this[_0x9f45('0x1e')]=getSeconds(_0x46fbb7['answertime'],_0x46fbb7[_0x9f45('0x1d')]);this['talktime']=getSeconds(this[_0x9f45('0x1a')],_0x46fbb7[_0x9f45('0x19')]);this['queue']=_0x21556b[_0x9f45('0x1f')];this[_0x9f45('0x20')]=_0x21556b[_0x9f45('0x20')];this[_0x9f45('0x21')]=_0x21556b[_0x9f45('0x21')];this[_0x9f45('0x22')]=_0x46fbb7[_0x9f45('0x22')];this[_0x9f45('0x23')]=_0x46fbb7['callbackuniqueid'];this[_0x9f45('0x24')]=_0x46fbb7['callbackat'];this['recallme']=_0x46fbb7['recallme'];this[_0x9f45('0x25')]=_0x46fbb7[_0x9f45('0x25')];this[_0x9f45('0x26')]=_0x46fbb7[_0x9f45('0x26')];this[_0x9f45('0x27')]=_0x46fbb7[_0x9f45('0x27')];this[_0x9f45('0x28')]=_0x46fbb7['VoiceQueueId'];this[_0x9f45('0x29')]=_0x46fbb7['CampaignId'];this[_0x9f45('0x2a')]=_0x46fbb7[_0x9f45('0x2a')]||'';this['originatecalleridname']=_0x46fbb7[_0x9f45('0x2b')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0xb7bb=['YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','holdtime','talktime','membername','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','calleridnum','number','responsetime','answertime','endtime','format'];(function(_0x31bfe0,_0x2fe2bb){var _0x87bd7d=function(_0x3d1e98){while(--_0x3d1e98){_0x31bfe0['push'](_0x31bfe0['shift']());}};_0x87bd7d(++_0x2fe2bb);}(_0xb7bb,0xf8));var _0xbb7b=function(_0x40d038,_0x4de23c){_0x40d038=_0x40d038-0x0;var _0x154f2b=_0xb7bb[_0x40d038];return _0x154f2b;};'use strict';var util=require('util');var _=require(_0xbb7b('0x0'));var moment=require(_0xbb7b('0x1'));function getSeconds(_0xafa390,_0x316cb8){var _0x27fdb7=moment(_0xafa390)['milliseconds'](0x0);var _0x52d136=moment(_0x316cb8)[_0xbb7b('0x2')](0x0);return _0x27fdb7['diff'](_0x52d136,_0xbb7b('0x3'));}function AgentComplete(_0xae3988,_0x5e79da){this[_0xbb7b('0x4')]=0x4;this[_0xbb7b('0x5')]=_0xbb7b('0x6');this['scheduledat']=_0xae3988[_0xbb7b('0x7')];this['type']=_0xae3988[_0xbb7b('0x8')];this[_0xbb7b('0x9')]=_0xae3988[_0xbb7b('0x8')]===_0xbb7b('0xa')?_0xbb7b('0xb'):_0xae3988[_0xbb7b('0x8')];this[_0xbb7b('0xc')]=_0xae3988[_0xbb7b('0xc')];this['countcongestionretry']=_0xae3988[_0xbb7b('0xd')];this[_0xbb7b('0xe')]=_0xae3988[_0xbb7b('0xe')];this['countglobal']=_0xae3988[_0xbb7b('0xc')]+_0xae3988[_0xbb7b('0xd')]+_0xae3988[_0xbb7b('0xe')]+_0xae3988[_0xbb7b('0xf')]+_0xae3988[_0xbb7b('0x10')]+_0xae3988['countabandonedretry']+_0xae3988[_0xbb7b('0x11')]+_0xae3988[_0xbb7b('0x12')];this[_0xbb7b('0xf')]=_0xae3988['countnosuchnumberretry'];this[_0xbb7b('0x10')]=_0xae3988[_0xbb7b('0x10')];this['countabandonedretry']=_0xae3988[_0xbb7b('0x13')];this[_0xbb7b('0x11')]=_0xae3988[_0xbb7b('0x11')];this[_0xbb7b('0x12')]=_0xae3988[_0xbb7b('0x12')];this[_0xbb7b('0x14')]=_0x5e79da[_0xbb7b('0x14')];this[_0xbb7b('0x15')]=_0xae3988['name'];this[_0xbb7b('0x16')]=_0xae3988[_0xbb7b('0x17')];this['starttime']=_0xae3988['starttime'];this[_0xbb7b('0x18')]=_0xae3988[_0xbb7b('0x18')];this[_0xbb7b('0x19')]=_0xae3988[_0xbb7b('0x19')];this[_0xbb7b('0x1a')]=moment()[_0xbb7b('0x1b')](_0xbb7b('0x1c'));this[_0xbb7b('0x1d')]=getSeconds(_0xae3988[_0xbb7b('0x18')],_0xae3988[_0xbb7b('0x1e')]);this[_0xbb7b('0x1f')]=getSeconds(_0xae3988[_0xbb7b('0x19')],_0xae3988[_0xbb7b('0x18')]);this[_0xbb7b('0x20')]=getSeconds(this[_0xbb7b('0x1a')],_0xae3988[_0xbb7b('0x19')]);this[_0xbb7b('0xb')]=_0x5e79da[_0xbb7b('0xb')];this[_0xbb7b('0x21')]=_0x5e79da[_0xbb7b('0x21')];this['reason']=_0x5e79da['reason'];this[_0xbb7b('0x22')]=_0xae3988[_0xbb7b('0x22')];this[_0xbb7b('0x23')]=_0xae3988[_0xbb7b('0x23')];this[_0xbb7b('0x24')]=_0xae3988['callbackat'];this['recallme']=_0xae3988[_0xbb7b('0x25')];this[_0xbb7b('0x26')]=_0xae3988[_0xbb7b('0x26')];this[_0xbb7b('0x27')]=_0xae3988[_0xbb7b('0x27')];this[_0xbb7b('0x28')]=_0xae3988[_0xbb7b('0x28')];this[_0xbb7b('0x29')]=_0xae3988[_0xbb7b('0x29')];this['CampaignId']=_0xae3988[_0xbb7b('0x2a')];this[_0xbb7b('0x2b')]=_0xae3988['originatecalleridnum']||'';this['originatecalleridname']=_0xae3988[_0xbb7b('0x2c')]||'';}module[_0xbb7b('0x2d')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 2c71ecc..6a86979 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25fa=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x189476,_0x873ef6){var _0xccb835=function(_0x4b918b){while(--_0x4b918b){_0x189476['push'](_0x189476['shift']());}};_0xccb835(++_0x873ef6);}(_0x25fa,0x109));var _0xa25f=function(_0x5175b0,_0x5745cd){_0x5175b0=_0x5175b0-0x0;var _0x486ae7=_0x25fa[_0x5175b0];return _0x486ae7;};'use strict';var util=require(_0xa25f('0x0'));var _=require('lodash');var moment=require(_0xa25f('0x1'));function getSeconds(_0x37129d,_0x57e272){var _0x408155=moment(_0x37129d)[_0xa25f('0x2')](0x0);var _0x256155=moment(_0x57e272)['milliseconds'](0x0);return _0x408155['diff'](_0x256155,_0xa25f('0x3'));}function Final(_0x50dafc){this[_0xa25f('0x4')]=_0x50dafc[_0xa25f('0x4')];this[_0xa25f('0x5')]=_0x50dafc[_0xa25f('0x5')];this[_0xa25f('0x6')]=_0x50dafc[_0xa25f('0x6')];this[_0xa25f('0x7')]=_0x50dafc[_0xa25f('0x6')]===_0xa25f('0x8')?'queue':_0x50dafc[_0xa25f('0x6')];this[_0xa25f('0x9')]=_0x50dafc['countbusyretry'];this[_0xa25f('0xa')]=_0x50dafc[_0xa25f('0xa')];this[_0xa25f('0xb')]=_0x50dafc[_0xa25f('0xb')];this['countglobal']=_0x50dafc[_0xa25f('0x9')]+_0x50dafc[_0xa25f('0xa')]+_0x50dafc['countnoanswerretry']+_0x50dafc[_0xa25f('0xc')]+_0x50dafc[_0xa25f('0xd')]+_0x50dafc['countabandonedretry']+_0x50dafc[_0xa25f('0xe')]+_0x50dafc[_0xa25f('0xf')];this[_0xa25f('0xc')]=_0x50dafc[_0xa25f('0xc')];this[_0xa25f('0xd')]=_0x50dafc[_0xa25f('0xd')];this[_0xa25f('0x10')]=_0x50dafc[_0xa25f('0x10')];this[_0xa25f('0xe')]=_0x50dafc[_0xa25f('0xe')];this[_0xa25f('0xf')]=_0x50dafc[_0xa25f('0xf')];this['queue']=_0x50dafc[_0xa25f('0x11')];this[_0xa25f('0x12')]=_0x50dafc[_0xa25f('0x12')];this[_0xa25f('0x13')]=_0x50dafc[_0xa25f('0x13')];this[_0xa25f('0x14')]=_0x50dafc['starttime'];this[_0xa25f('0x15')]=_0x50dafc['responsetime'];this[_0xa25f('0x16')]=_0x50dafc['responsetime'];this['ringtime']=_0x50dafc[_0xa25f('0x17')]||0x0;this['holdtime']=_0x50dafc[_0xa25f('0x18')]||0x0;this[_0xa25f('0x19')]=_0x50dafc[_0xa25f('0x19')]||0x0;this[_0xa25f('0x1a')]=_0x50dafc[_0xa25f('0x1a')];this['callbackuniqueid']=_0x50dafc[_0xa25f('0x1b')];this[_0xa25f('0x1c')]=_0x50dafc[_0xa25f('0x1c')];this[_0xa25f('0x1d')]=_0x50dafc['recallme'];this[_0xa25f('0x1e')]=_0x50dafc[_0xa25f('0x1e')];this[_0xa25f('0x1f')]=_0x50dafc[_0xa25f('0x1f')];this['UserId']=_0x50dafc[_0xa25f('0x20')];this[_0xa25f('0x21')]=_0x50dafc[_0xa25f('0x21')];this[_0xa25f('0x22')]=_0x50dafc['CampaignId'];this[_0xa25f('0x23')]=_0x50dafc[_0xa25f('0x23')]||'';this['originatecalleridname']=_0x50dafc[_0xa25f('0x24')]||'';}module['exports']=Final; \ No newline at end of file +var _0xbeea=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type'];(function(_0x34bc94,_0x74f0fd){var _0xee41e7=function(_0x424111){while(--_0x424111){_0x34bc94['push'](_0x34bc94['shift']());}};_0xee41e7(++_0x74f0fd);}(_0xbeea,0xb1));var _0xabee=function(_0x3b1606,_0x25135b){_0x3b1606=_0x3b1606-0x0;var _0x2f58af=_0xbeea[_0x3b1606];return _0x2f58af;};'use strict';var util=require(_0xabee('0x0'));var _=require('lodash');var moment=require(_0xabee('0x1'));function getSeconds(_0x3b377b,_0x35ca8b){var _0x48a420=moment(_0x3b377b)[_0xabee('0x2')](0x0);var _0x59e264=moment(_0x35ca8b)[_0xabee('0x2')](0x0);return _0x48a420[_0xabee('0x3')](_0x59e264,_0xabee('0x4'));}function Final(_0x49631e){this[_0xabee('0x5')]=_0x49631e['uniqueid'];this['scheduledat']=_0x49631e[_0xabee('0x6')];this[_0xabee('0x7')]=_0x49631e['type'];this[_0xabee('0x8')]=_0x49631e['type']===_0xabee('0x9')?_0xabee('0xa'):_0x49631e[_0xabee('0x7')];this[_0xabee('0xb')]=_0x49631e[_0xabee('0xb')];this[_0xabee('0xc')]=_0x49631e['countcongestionretry'];this[_0xabee('0xd')]=_0x49631e[_0xabee('0xd')];this[_0xabee('0xe')]=_0x49631e['countbusyretry']+_0x49631e[_0xabee('0xc')]+_0x49631e[_0xabee('0xd')]+_0x49631e[_0xabee('0xf')]+_0x49631e['countdropretry']+_0x49631e['countabandonedretry']+_0x49631e['countmachineretry']+_0x49631e['countagentrejectretry'];this['countnosuchnumberretry']=_0x49631e[_0xabee('0xf')];this[_0xabee('0x10')]=_0x49631e[_0xabee('0x10')];this[_0xabee('0x11')]=_0x49631e[_0xabee('0x11')];this['countmachineretry']=_0x49631e[_0xabee('0x12')];this[_0xabee('0x13')]=_0x49631e[_0xabee('0x13')];this[_0xabee('0xa')]=_0x49631e[_0xabee('0xa')];this[_0xabee('0x14')]=_0x49631e[_0xabee('0x14')];this['calleridnum']=_0x49631e[_0xabee('0x15')];this[_0xabee('0x16')]=_0x49631e[_0xabee('0x16')];this[_0xabee('0x17')]=_0x49631e[_0xabee('0x17')];this[_0xabee('0x18')]=_0x49631e['responsetime'];this['ringtime']=_0x49631e[_0xabee('0x19')]||0x0;this['holdtime']=_0x49631e['holdtime']||0x0;this[_0xabee('0x1a')]=_0x49631e[_0xabee('0x1a')]||0x0;this[_0xabee('0x1b')]=_0x49631e[_0xabee('0x1b')];this[_0xabee('0x1c')]=_0x49631e['callbackuniqueid'];this[_0xabee('0x1d')]=_0x49631e['callbackat'];this['recallme']=_0x49631e['recallme'];this[_0xabee('0x1e')]=_0x49631e['ContactId'];this[_0xabee('0x1f')]=_0x49631e[_0xabee('0x1f')];this[_0xabee('0x20')]=_0x49631e[_0xabee('0x20')];this[_0xabee('0x21')]=_0x49631e[_0xabee('0x21')];this[_0xabee('0x22')]=_0x49631e['CampaignId'];this[_0xabee('0x23')]=_0x49631e[_0xabee('0x23')]||'';this[_0xabee('0x24')]=_0x49631e[_0xabee('0x24')]||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 12ec060..c22d1db 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a90=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','IVR','callback','callbackuniqueid','callbackat'];(function(_0xaf025d,_0x586d7a){var _0x1c77cb=function(_0x560b3a){while(--_0x560b3a){_0xaf025d['push'](_0xaf025d['shift']());}};_0x1c77cb(++_0x586d7a);}(_0x7a90,0x10f));var _0x07a9=function(_0x1b4878,_0x246922){_0x1b4878=_0x1b4878-0x0;var _0x4d0639=_0x7a90[_0x1b4878];return _0x4d0639;};'use strict';var util=require(_0x07a9('0x0'));var _=require(_0x07a9('0x1'));var moment=require('moment');function getSeconds(_0x9694df,_0x5017d7){var _0x59c387=moment(_0x9694df)[_0x07a9('0x2')](0x0);var _0x173334=moment(_0x5017d7)[_0x07a9('0x2')](0x0);return _0x59c387[_0x07a9('0x3')](_0x173334,_0x07a9('0x4'));}function Hangup(_0x190fdd,_0x3af0d7){this[_0x07a9('0x5')]=0x4;this[_0x07a9('0x6')]=_0x07a9('0x7');this['scheduledat']=_0x190fdd[_0x07a9('0x8')];this[_0x07a9('0x9')]=_0x190fdd['type'];this[_0x07a9('0xa')]=_0x190fdd['type']===_0x07a9('0xb')?_0x07a9('0xc'):_0x190fdd[_0x07a9('0x9')];this[_0x07a9('0xd')]=_0x190fdd['countbusyretry'];this[_0x07a9('0xe')]=_0x190fdd[_0x07a9('0xe')];this[_0x07a9('0xf')]=_0x190fdd[_0x07a9('0xf')];this[_0x07a9('0x10')]=_0x190fdd[_0x07a9('0xd')]+_0x190fdd[_0x07a9('0xe')]+_0x190fdd[_0x07a9('0xf')]+_0x190fdd['countnosuchnumberretry']+_0x190fdd[_0x07a9('0x11')]+_0x190fdd[_0x07a9('0x12')]+_0x190fdd[_0x07a9('0x13')]+_0x190fdd['countagentrejectretry'];this[_0x07a9('0x14')]=_0x190fdd['countnosuchnumberretry'];this[_0x07a9('0x11')]=_0x190fdd[_0x07a9('0x11')];this[_0x07a9('0x12')]=_0x190fdd[_0x07a9('0x12')];this[_0x07a9('0x13')]=_0x190fdd[_0x07a9('0x13')];this[_0x07a9('0x15')]=_0x190fdd[_0x07a9('0x15')];this[_0x07a9('0x16')]=_0x3af0d7[_0x07a9('0x16')];this[_0x07a9('0x17')]=_0x190fdd[_0x07a9('0x18')];this[_0x07a9('0x19')]=_0x190fdd[_0x07a9('0x1a')];this['starttime']=_0x190fdd[_0x07a9('0x1b')];this['responsetime']=_0x190fdd[_0x07a9('0x1c')];this[_0x07a9('0x1d')]=moment()['format'](_0x07a9('0x1e'));this['ringtime']=getSeconds(_0x190fdd[_0x07a9('0x1c')],_0x190fdd[_0x07a9('0x1b')]);this[_0x07a9('0x1f')]=0x0;this[_0x07a9('0x20')]=getSeconds(this[_0x07a9('0x1d')],_0x190fdd[_0x07a9('0x1c')]);this['queue']=_0x190fdd['queue'];this['membername']=_0x07a9('0x21');this['reason']=_0x3af0d7['cause-txt'];this[_0x07a9('0x22')]=_0x190fdd[_0x07a9('0x22')];this[_0x07a9('0x23')]=_0x190fdd[_0x07a9('0x23')];this['callbackat']=_0x190fdd[_0x07a9('0x24')];this[_0x07a9('0x25')]=_0x190fdd[_0x07a9('0x25')];this[_0x07a9('0x26')]=_0x190fdd[_0x07a9('0x26')];this[_0x07a9('0x27')]=_0x190fdd[_0x07a9('0x27')];this[_0x07a9('0x28')]=_0x190fdd['UserId'];this[_0x07a9('0x29')]=_0x190fdd['VoiceQueueId'];this['CampaignId']=_0x190fdd[_0x07a9('0x2a')];}module[_0x07a9('0x2b')]=Hangup; \ No newline at end of file +var _0xfe6c=['callback','callbackuniqueid','callbackat','ContactId','ListId','VoiceQueueId','CampaignId','exports','util','moment','milliseconds','diff','seconds','state','statedesc','Answer','type','campaigntype','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason','cause-txt'];(function(_0x53f402,_0x326920){var _0x45a76d=function(_0x51f590){while(--_0x51f590){_0x53f402['push'](_0x53f402['shift']());}};_0x45a76d(++_0x326920);}(_0xfe6c,0x1ac));var _0xcfe6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfe6c[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xcfe6('0x0'));var _=require('lodash');var moment=require(_0xcfe6('0x1'));function getSeconds(_0x5eea0e,_0x3445e1){var _0x43b437=moment(_0x5eea0e)[_0xcfe6('0x2')](0x0);var _0x5660ed=moment(_0x3445e1)[_0xcfe6('0x2')](0x0);return _0x43b437[_0xcfe6('0x3')](_0x5660ed,_0xcfe6('0x4'));}function Hangup(_0x4233e0,_0x46e93b){this[_0xcfe6('0x5')]=0x4;this[_0xcfe6('0x6')]=_0xcfe6('0x7');this['scheduledat']=_0x4233e0['scheduledat'];this[_0xcfe6('0x8')]=_0x4233e0[_0xcfe6('0x8')];this[_0xcfe6('0x9')]=_0x4233e0[_0xcfe6('0x8')]==='outbound'?_0xcfe6('0xa'):_0x4233e0[_0xcfe6('0x8')];this[_0xcfe6('0xb')]=_0x4233e0[_0xcfe6('0xb')];this[_0xcfe6('0xc')]=_0x4233e0[_0xcfe6('0xc')];this['countnoanswerretry']=_0x4233e0['countnoanswerretry'];this[_0xcfe6('0xd')]=_0x4233e0[_0xcfe6('0xb')]+_0x4233e0[_0xcfe6('0xc')]+_0x4233e0[_0xcfe6('0xe')]+_0x4233e0[_0xcfe6('0xf')]+_0x4233e0['countdropretry']+_0x4233e0[_0xcfe6('0x10')]+_0x4233e0[_0xcfe6('0x11')]+_0x4233e0[_0xcfe6('0x12')];this['countnosuchnumberretry']=_0x4233e0[_0xcfe6('0xf')];this[_0xcfe6('0x13')]=_0x4233e0[_0xcfe6('0x13')];this['countabandonedretry']=_0x4233e0[_0xcfe6('0x10')];this['countmachineretry']=_0x4233e0['countmachineretry'];this['countagentrejectretry']=_0x4233e0[_0xcfe6('0x12')];this[_0xcfe6('0x14')]=_0x46e93b[_0xcfe6('0x14')];this[_0xcfe6('0x15')]=_0x4233e0[_0xcfe6('0x16')];this['calleridnum']=_0x4233e0['number'];this['starttime']=_0x4233e0[_0xcfe6('0x17')];this[_0xcfe6('0x18')]=_0x4233e0[_0xcfe6('0x18')];this[_0xcfe6('0x19')]=moment()['format'](_0xcfe6('0x1a'));this[_0xcfe6('0x1b')]=getSeconds(_0x4233e0[_0xcfe6('0x18')],_0x4233e0[_0xcfe6('0x17')]);this[_0xcfe6('0x1c')]=0x0;this[_0xcfe6('0x1d')]=getSeconds(this[_0xcfe6('0x19')],_0x4233e0[_0xcfe6('0x18')]);this[_0xcfe6('0xa')]=_0x4233e0[_0xcfe6('0xa')];this[_0xcfe6('0x1e')]=_0xcfe6('0x1f');this[_0xcfe6('0x20')]=_0x46e93b[_0xcfe6('0x21')];this[_0xcfe6('0x22')]=_0x4233e0[_0xcfe6('0x22')];this[_0xcfe6('0x23')]=_0x4233e0[_0xcfe6('0x23')];this[_0xcfe6('0x24')]=_0x4233e0[_0xcfe6('0x24')];this['recallme']=_0x4233e0['recallme'];this[_0xcfe6('0x25')]=_0x4233e0['ContactId'];this['ListId']=_0x4233e0[_0xcfe6('0x26')];this['UserId']=_0x4233e0['UserId'];this['VoiceQueueId']=_0x4233e0[_0xcfe6('0x27')];this[_0xcfe6('0x28')]=_0x4233e0[_0xcfe6('0x28')];}module[_0xcfe6('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index efb7d45..3860785 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d5f=['lodash','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countabandonedretry','countdropretry','countmachineretry','countagentrejectretry','calleridname','name','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x3d5f,0x1a1));var _0xf3d5=function(_0x44ff92,_0xc5f56f){_0x44ff92=_0x44ff92-0x0;var _0xeeffe8=_0x3d5f[_0x44ff92];return _0xeeffe8;};'use strict';var util=require(_0xf3d5('0x0'));var _=require(_0xf3d5('0x1'));var moment=require('moment');function getSeconds(_0x39609f,_0x364a2d){var _0x41933a=moment(_0x39609f)['milliseconds'](0x0);var _0x748762=moment(_0x364a2d)['milliseconds'](0x0);return _0x41933a[_0xf3d5('0x2')](_0x748762,'seconds');}function History(_0x5af539){this[_0xf3d5('0x3')]=_0x5af539[_0xf3d5('0x3')];this['scheduledat']=_0x5af539[_0xf3d5('0x4')]||undefined;this[_0xf3d5('0x5')]=_0x5af539[_0xf3d5('0x5')];this[_0xf3d5('0x6')]=_0x5af539[_0xf3d5('0x5')]===_0xf3d5('0x7')?_0xf3d5('0x8'):_0x5af539[_0xf3d5('0x5')];this['countbusyretry']=_0x5af539['countbusyretry'];this[_0xf3d5('0x9')]=_0x5af539[_0xf3d5('0x9')];this[_0xf3d5('0xa')]=_0x5af539[_0xf3d5('0xa')];this[_0xf3d5('0xb')]=_0x5af539[_0xf3d5('0xc')]+_0x5af539[_0xf3d5('0x9')]+_0x5af539['countnoanswerretry']+_0x5af539[_0xf3d5('0xd')]+_0x5af539['countdropretry']+_0x5af539[_0xf3d5('0xe')]+_0x5af539['countmachineretry']+_0x5af539['countagentrejectretry'];this['countnosuchnumberretry']=_0x5af539['countnosuchnumberretry'];this[_0xf3d5('0xf')]=_0x5af539[_0xf3d5('0xf')];this['countabandonedretry']=_0x5af539[_0xf3d5('0xe')];this['countmachineretry']=_0x5af539[_0xf3d5('0x10')];this[_0xf3d5('0x11')]=_0x5af539['countagentrejectretry'];this['queue']=_0x5af539['queue'];this[_0xf3d5('0x12')]=_0x5af539[_0xf3d5('0x13')];this['calleridnum']=_0x5af539[_0xf3d5('0x14')];this[_0xf3d5('0x15')]=_0x5af539[_0xf3d5('0x15')];this[_0xf3d5('0x16')]=_0x5af539[_0xf3d5('0x16')];this[_0xf3d5('0x17')]=_0x5af539['responsetime'];this[_0xf3d5('0x18')]=getSeconds(_0x5af539[_0xf3d5('0x16')],_0x5af539[_0xf3d5('0x15')]);this[_0xf3d5('0x19')]=0x0;this[_0xf3d5('0x1a')]=0x0;this[_0xf3d5('0x1b')]=_0x5af539['callback'];this[_0xf3d5('0x1c')]=_0x5af539['callbackuniqueid'];this[_0xf3d5('0x1d')]=_0x5af539[_0xf3d5('0x1d')];this[_0xf3d5('0x1e')]=_0x5af539[_0xf3d5('0x1e')];this[_0xf3d5('0x1f')]=_0x5af539[_0xf3d5('0x1f')];this[_0xf3d5('0x20')]=_0x5af539[_0xf3d5('0x20')];this[_0xf3d5('0x21')]=_0x5af539[_0xf3d5('0x21')];this[_0xf3d5('0x22')]=_0x5af539[_0xf3d5('0x22')];this['CampaignId']=_0x5af539[_0xf3d5('0x23')];this[_0xf3d5('0x24')]=_0x5af539[_0xf3d5('0x24')]||'';this[_0xf3d5('0x25')]=_0x5af539[_0xf3d5('0x25')]||'';}module['exports']=History; \ No newline at end of file +var _0x2703=['responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridnum','starttime'];(function(_0x30beb9,_0x38966b){var _0x588c1b=function(_0x44b7c5){while(--_0x44b7c5){_0x30beb9['push'](_0x30beb9['shift']());}};_0x588c1b(++_0x38966b);}(_0x2703,0x1a7));var _0x3270=function(_0x5d07e4,_0x161b3b){_0x5d07e4=_0x5d07e4-0x0;var _0x2883ab=_0x2703[_0x5d07e4];return _0x2883ab;};'use strict';var util=require(_0x3270('0x0'));var _=require(_0x3270('0x1'));var moment=require(_0x3270('0x2'));function getSeconds(_0x2046de,_0x16048d){var _0x194f7f=moment(_0x2046de)['milliseconds'](0x0);var _0x1e28bf=moment(_0x16048d)[_0x3270('0x3')](0x0);return _0x194f7f['diff'](_0x1e28bf,_0x3270('0x4'));}function History(_0xf48fb0){this[_0x3270('0x5')]=_0xf48fb0['uniqueid'];this[_0x3270('0x6')]=_0xf48fb0[_0x3270('0x6')]||undefined;this['type']=_0xf48fb0[_0x3270('0x7')];this['campaigntype']=_0xf48fb0[_0x3270('0x7')]===_0x3270('0x8')?_0x3270('0x9'):_0xf48fb0['type'];this[_0x3270('0xa')]=_0xf48fb0[_0x3270('0xa')];this[_0x3270('0xb')]=_0xf48fb0[_0x3270('0xb')];this['countnoanswerretry']=_0xf48fb0[_0x3270('0xc')];this[_0x3270('0xd')]=_0xf48fb0['countbusyretry']+_0xf48fb0[_0x3270('0xb')]+_0xf48fb0[_0x3270('0xc')]+_0xf48fb0[_0x3270('0xe')]+_0xf48fb0[_0x3270('0xf')]+_0xf48fb0[_0x3270('0x10')]+_0xf48fb0[_0x3270('0x11')]+_0xf48fb0[_0x3270('0x12')];this[_0x3270('0xe')]=_0xf48fb0[_0x3270('0xe')];this[_0x3270('0xf')]=_0xf48fb0['countdropretry'];this[_0x3270('0x10')]=_0xf48fb0['countabandonedretry'];this[_0x3270('0x11')]=_0xf48fb0[_0x3270('0x11')];this[_0x3270('0x12')]=_0xf48fb0[_0x3270('0x12')];this['queue']=_0xf48fb0[_0x3270('0x9')];this['calleridname']=_0xf48fb0['name'];this[_0x3270('0x13')]=_0xf48fb0['number'];this[_0x3270('0x14')]=_0xf48fb0[_0x3270('0x14')];this[_0x3270('0x15')]=_0xf48fb0['responsetime'];this[_0x3270('0x16')]=_0xf48fb0['responsetime'];this[_0x3270('0x17')]=getSeconds(_0xf48fb0[_0x3270('0x15')],_0xf48fb0[_0x3270('0x14')]);this[_0x3270('0x18')]=0x0;this['talktime']=0x0;this['callback']=_0xf48fb0[_0x3270('0x19')];this[_0x3270('0x1a')]=_0xf48fb0[_0x3270('0x1a')];this['callbackat']=_0xf48fb0[_0x3270('0x1b')];this[_0x3270('0x1c')]=_0xf48fb0[_0x3270('0x1c')];this[_0x3270('0x1d')]=_0xf48fb0[_0x3270('0x1d')];this[_0x3270('0x1e')]=_0xf48fb0[_0x3270('0x1e')];this[_0x3270('0x1f')]=_0xf48fb0[_0x3270('0x1f')];this[_0x3270('0x20')]=_0xf48fb0[_0x3270('0x20')];this[_0x3270('0x21')]=_0xf48fb0[_0x3270('0x21')];this[_0x3270('0x22')]=_0xf48fb0[_0x3270('0x22')]||'';this[_0x3270('0x23')]=_0xf48fb0['originatecalleridname']||'';}module[_0x3270('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 72caed3..77b9dc9 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 _0xa09a=['updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','trim','dialCutDigit','phone','substring','SIP/%s/%s%s','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','syncOriginateResponse','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialGlobalMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','handlePower','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimization','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','predictiveIntervalPauses','check\x20failure','[handlePredictive]','fail\x20to\x20scheduled\x20calls','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','Agent','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','dialOrderByScheduledAt','RUNNING','[actionOriginate]\x20','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','reachable','[countReScheduled]\x20','tryOriginatePredictive','[handlePredictive][limitChannel]','Contact.phone','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','./action','./history','./final','./agentComplete','./hangup','env','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','sequence','voiceQueues','agents','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','originateresponse','bind','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','queuemember','syncQueueMember','syncQueueStatusComplete','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','Interval','INTERVAL_IS_NULL','isEmpty','Intervals','\x20INTERVAL_IS_NULL','[ifTime][Action]','stringify','milliseconds','diff','seconds','type','outbound','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','md5','voice:queue:%s','ivr','format','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','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','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','error','inspect','length','[getContactDialer2][ReScheduled]','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','available','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','loopClearZombieChannels','clearZombieChannels','enqueue','isNil','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','campaigns','[Dialer][checkChannel][ivr]','countReScheduled','resolve','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','then','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','updateOriginated','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','saveInDb','pick','ContactId','ListId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','trunks','SIP/%s','status','syncVarSet','uniqueid','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','emit','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','countmachineretry','countglobal','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','[syncAgentComplete][createHistory][0]','countnosuchnumberretry','countabandonedretry','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','Unknow','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','responsetime','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','predictiveIntervalDroppedCallsCallersExit','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','strategy','locked','stateinterface','push','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','run','[Catch][Preview][syncQueueStatusComplete]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','command','interval','indexOf','true','Action','iftime\x20%s,%s','content','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','progressive','power','dialPowerLevel','predictive','handleIvr','dialGlobalInterval','dialTimezone','syncCampaigns','undefined','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','Contact','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialAgiAfterHangupAgent','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags'];(function(_0x5ede17,_0x336cd2){var _0xdd8c7b=function(_0x44add1){while(--_0x44add1){_0x5ede17['push'](_0x5ede17['shift']());}};_0xdd8c7b(++_0x336cd2);}(_0xa09a,0x90));var _0xaa09=function(_0xcf89dc,_0x5c60c4){_0xcf89dc=_0xcf89dc-0x0;var _0x4ad003=_0xa09a[_0xcf89dc];return _0x4ad003;};'use strict';var util=require(_0xaa09('0x0'));var _=require(_0xaa09('0x1'));var BPromise=require(_0xaa09('0x2'));var uuid=require(_0xaa09('0x3'));var moment=require(_0xaa09('0x4'));var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require(_0xaa09('0x5'));var config=require(_0xaa09('0x6'));var logger=require(_0xaa09('0x7'))(_0xaa09('0x8'));var loggerBooked=require(_0xaa09('0x7'))(_0xaa09('0x9'));var loggerPredictive=require(_0xaa09('0x7'))('predictive');var loggerPredictiveCalls=require(_0xaa09('0x7'))(_0xaa09('0xa'));var loggerSyncQueueSummary=require(_0xaa09('0x7'))(_0xaa09('0xb'));var ami=require('../ami');config[_0xaa09('0xc')]=_['defaults'](config[_0xaa09('0xc')],{'host':_0xaa09('0xd'),'port':0x18eb});var io=require(_0xaa09('0xe'))(new Redis(config['redis']));var cmHopper=require(_0xaa09('0xf'));var cmHopperHistory=require(_0xaa09('0x10'));var cmHopperBlack=require(_0xaa09('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0xaa09('0x12'));var History=require(_0xaa09('0x13'));var Final=require(_0xaa09('0x14'));var AgentComplete=require(_0xaa09('0x15'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0xaa09('0x16'));var ipAgi=process[_0xaa09('0x17')]['XCALLY_IP_AGI']||_0xaa09('0x18');var strategy={'rrmemory':_0xaa09('0x19'),'roundrobin':_0xaa09('0x1a')};var Sequence=function(){};Sequence[_0xaa09('0x1b')]['enqueue']=function(_0x2f98dd){this[_0xaa09('0x1c')]=this[_0xaa09('0x1c')]?this['tail'][_0xaa09('0x1d')](_0x2f98dd):_0x2f98dd();};function Dialer(_0x4c7dec,_0x2b3325){this[_0xaa09('0x1e')]=new Sequence();this['preview']=_0x2b3325;this[_0xaa09('0x1f')]=_0x4c7dec['voiceQueues'];this['campaigns']=_0x4c7dec['campaigns'];this[_0xaa09('0x20')]=_0x4c7dec[_0xaa09('0x20')];this['trunks']=_0x4c7dec['trunks'];this['maxNumberOriginate']=config[_0xaa09('0x21')]||0x2;this[_0xaa09('0x22')]={};this[_0xaa09('0x23')]={};this['contactsId']={};this[_0xaa09('0x24')]={};this[_0xaa09('0x25')]={};this[_0xaa09('0x26')]={};this['startProgressive']={};this[_0xaa09('0x27')]={};this[_0xaa09('0x28')]={};this['queueBookedRR']={};ami['on'](_0xaa09('0x29'),this[_0xaa09('0x2a')]['bind'](this));ami['on'](_0xaa09('0x2b'),this[_0xaa09('0x2c')]['bind'](this));ami['on'](_0xaa09('0x2d'),this['syncOriginateResponse'][_0xaa09('0x2e')](this));ami['on'](_0xaa09('0x2f'),this[_0xaa09('0x30')][_0xaa09('0x2e')](this));ami['on'](_0xaa09('0x31'),this[_0xaa09('0xb')][_0xaa09('0x2e')](this));ami['on'](_0xaa09('0x32'),this[_0xaa09('0x33')][_0xaa09('0x2e')](this));ami['on'](_0xaa09('0x34'),this['syncNewExten'][_0xaa09('0x2e')](this));ami['on']('varset',this['syncVarSet'][_0xaa09('0x2e')](this));ami['on'](_0xaa09('0x35'),this[_0xaa09('0x36')]['bind'](this));ami['on']('queuestatuscomplete',this[_0xaa09('0x37')][_0xaa09('0x2e')](this));this['loopCampaigns']();this['loopClearZombieChannels']();}function isNotNull(_0x34d341){return _0x34d341!==null&&!_[_0xaa09('0x38')](_0x34d341);}function checkIsLoggedIn(_0x17aee9,_0x5abc72){return function(){if(_0x5abc72<=0x0){_0x17aee9[_0xaa09('0x39')]=_0xaa09('0x3a');throw _0x17aee9['name']+_0xaa09('0x3b');}};}function isActive(_0x4424af){return _0x4424af;}function checkIsActive(_0x5db83d,_0x26d6c3){return function(){if(!isActive(_0x26d6c3)){_0x5db83d[_0xaa09('0x39')]=_0xaa09('0x3c');throw _0x5db83d[_0xaa09('0x3d')]+'\x20NOT\x20Active';}};}function checkInterval(_0x194c13){return function(){if(!isNotNull(_0x194c13[_0xaa09('0x3e')])){_0x194c13[_0xaa09('0x39')]=_0xaa09('0x3f');throw _0x194c13[_0xaa09('0x3d')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x194c13[_0xaa09('0x3e')]['Intervals'])){_0x194c13[_0xaa09('0x39')]=_0xaa09('0x3f');throw _0x194c13[_0xaa09('0x3d')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xaa09('0x40')](_0x194c13[_0xaa09('0x3e')][_0xaa09('0x41')]))){_0x194c13[_0xaa09('0x39')]='INTERVAL_IS_NULL';throw _0x194c13['name']+_0xaa09('0x42');}};}function msgResponse(_0x38bd34,_0x200242,_0x1283a1){return{'action':_0x38bd34,'response':_0x200242,'message':_0x1283a1,'stack':_0x1283a1};}function myreject(_0x520500){return function(_0x4c0540){return _0x520500(msgResponse(_0xaa09('0x43'),'Error',JSON[_0xaa09('0x44')](_0x4c0540)));};}function getSeconds(_0xad3c22,_0x408ce1){var _0x12493e=moment(_0xad3c22)[_0xaa09('0x45')](0x0);var _0x484e37=moment(_0x408ce1)['milliseconds'](0x0);return _0x12493e[_0xaa09('0x46')](_0x484e37,_0xaa09('0x47'));}function emit(_0x53ff30,_0x438f9c,_0x1f04e9){io['to'](_0x53ff30)['emit'](_0x438f9c,_0x1f04e9);}function emitVoiceQueueSummary(_0x24ff1e){if(_0x24ff1e[_0xaa09('0x48')]===_0xaa09('0x49')){var _0x3cd803={'id':_0x24ff1e['id'],'name':_0x24ff1e[_0xaa09('0x3d')],'strategy':_0x24ff1e['strategy'],'answered':_0x24ff1e[_0xaa09('0x4a')],'available':_0x24ff1e['available'],'loggedIn':_0x24ff1e[_0xaa09('0x4b')],'pTalking':_0x24ff1e[_0xaa09('0x4c')],'sumBillable':_0x24ff1e[_0xaa09('0x4d')],'sumDuration':_0x24ff1e[_0xaa09('0x4e')],'sumHoldTime':_0x24ff1e[_0xaa09('0x4f')]||0x0,'talking':_0x24ff1e[_0xaa09('0x50')],'total':_0x24ff1e['total'],'type':_0x24ff1e[_0xaa09('0x48')],'unmanaged':_0x24ff1e[_0xaa09('0x51')],'abandoned':_0x24ff1e['abandoned'],'waiting':_0x24ff1e[_0xaa09('0x52')],'loggedInDb':_0x24ff1e[_0xaa09('0x53')],'dialActive':_0x24ff1e[_0xaa09('0x54')],'dialMethod':_0x24ff1e['dialMethod'],'dialOriginateCallerIdName':_0x24ff1e[_0xaa09('0x55')],'dialOriginateCallerIdNumber':_0x24ff1e[_0xaa09('0x56')],'dialOriginateTimeout':_0x24ff1e[_0xaa09('0x57')],'dialPrefix':_0x24ff1e[_0xaa09('0x58')],'outboundAnswerAgiCallsDay':_0x24ff1e['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x24ff1e[_0xaa09('0x59')],'outboundBlacklistCallsDay':_0x24ff1e['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x24ff1e[_0xaa09('0x5a')],'outboundCongestionCallsDay':_0x24ff1e[_0xaa09('0x5b')],'outboundDropCallsDayACS':_0x24ff1e['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x24ff1e[_0xaa09('0x5c')],'outboundDropCallsDayTimeout':_0x24ff1e[_0xaa09('0x5d')],'outboundNoAnswerCallsDay':_0x24ff1e[_0xaa09('0x5e')],'outboundNoSuchCallsDay':_0x24ff1e[_0xaa09('0x5f')],'outboundOriginateFailureCallsDay':_0x24ff1e[_0xaa09('0x60')],'outboundReCallsDay':_0x24ff1e[_0xaa09('0x61')],'outboundRejectCallsDay':_0x24ff1e['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x24ff1e[_0xaa09('0x62')],'predictiveIntervalAnsweredCalls':_0x24ff1e[_0xaa09('0x63')],'predictiveIntervalAvgHoldtime':_0x24ff1e[_0xaa09('0x64')],'predictiveIntervalAvgTalktime':_0x24ff1e[_0xaa09('0x65')],'predictiveIntervalDroppedCallsCallersExit':_0x24ff1e['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x24ff1e['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x24ff1e[_0xaa09('0x66')],'predictiveIntervalErlangCallsDroppedCalls':_0x24ff1e[_0xaa09('0x67')],'predictiveIntervalHitRate':_0x24ff1e[_0xaa09('0x68')],'predictiveIntervalMultiplicativeFactor':_0x24ff1e[_0xaa09('0x69')],'predictiveIntervalPauses':_0x24ff1e['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x24ff1e[_0xaa09('0x6a')],'predictiveIntervalTotalCalls':_0x24ff1e[_0xaa09('0x6b')],'message':_0x24ff1e[_0xaa09('0x39')],'originated':_0x24ff1e[_0xaa09('0x6c')],'erlangCalls':_0x24ff1e[_0xaa09('0x6d')],'erlangCallToSecond':_0x24ff1e[_0xaa09('0x6e')],'erlangAbandonmentRate':_0x24ff1e[_0xaa09('0x6f')],'erlangBusyFactor':_0x24ff1e[_0xaa09('0x70')],'startPredictive':_0x24ff1e[_0xaa09('0x26')],'startProgressive':_0x24ff1e[_0xaa09('0x71')]};if(_0x24ff1e[_0xaa09('0x72')]){_0x3cd803[_0xaa09('0x72')]={'id':_0x24ff1e[_0xaa09('0x72')]['id'],'name':_0x24ff1e['Trunk']['name'],'active':_0x24ff1e[_0xaa09('0x72')][_0xaa09('0x73')],'callerid':_0x24ff1e[_0xaa09('0x72')][_0xaa09('0x74')]};}if(_0x24ff1e[_0xaa09('0x3e')]){_0x3cd803['Interval']={'id':_0x24ff1e['Interval']['id'],'name':_0x24ff1e[_0xaa09('0x3e')]['name']};}var _0x314f88=md5(JSON['stringify'](_0x3cd803));if(_0x24ff1e[_0xaa09('0x75')]!==_0x314f88){_0x24ff1e[_0xaa09('0x75')]=_0x314f88;emit(util['format'](_0xaa09('0x76'),_0x3cd803['name']),'voice_queue:save',_0x3cd803);}}}function emitCampaignSummary(_0x45e2c2){if(_0x45e2c2[_0xaa09('0x48')]===_0xaa09('0x77')){emit(util[_0xaa09('0x78')]('campaign:ivr:%s',_0x45e2c2[_0xaa09('0x3d')]),_0xaa09('0x79'),_0x45e2c2);}}function checkGetDataPredictive(_0x830e1e){if(isNotNull(_0x830e1e)&&!_[_0xaa09('0x40')](_0x830e1e)){loggerPredictive[_0xaa09('0x7a')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xaa09('0x7a')](_0xaa09('0x7b'),_0x830e1e[_0xaa09('0x6b')]);loggerPredictive[_0xaa09('0x7a')](_0xaa09('0x7c'),_0x830e1e[_0xaa09('0x63')]);loggerPredictive[_0xaa09('0x7a')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x830e1e[_0xaa09('0x7d')]);loggerPredictive[_0xaa09('0x7a')](_0xaa09('0x7e'),_0x830e1e['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xaa09('0x7a')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x830e1e[_0xaa09('0x64')]);loggerPredictive['info'](_0xaa09('0x7f'),_0x830e1e[_0xaa09('0x65')]);loggerPredictive['info'](_0xaa09('0x80'));if(_0x830e1e[_0xaa09('0x6b')]>0x0){if(!_[_0xaa09('0x38')](_0x830e1e[_0xaa09('0x65')])&&_0x830e1e['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xaa09('0x7a')](_0xaa09('0x81'));if(!_[_0xaa09('0x38')](_0x830e1e[_0xaa09('0x64')])&&_0x830e1e[_0xaa09('0x64')]>0x0){return!![];}loggerPredictive[_0xaa09('0x7a')](_0xaa09('0x82'));}else{loggerPredictive[_0xaa09('0x7a')](_0xaa09('0x83'));}}else{loggerPredictive[_0xaa09('0x7a')](_0xaa09('0x84'));}return![];}function mergeDataErlangB(_0x431704){return function(_0x1a41ac){loggerPredictive['info'](_0xaa09('0x85'));loggerPredictive[_0xaa09('0x7a')](_0xaa09('0x86'),_0x1a41ac['erlangCalls']);loggerPredictive[_0xaa09('0x7a')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1a41ac['erlangCallToSecond']);loggerPredictive[_0xaa09('0x7a')](_0xaa09('0x87'),_0x1a41ac[_0xaa09('0x6f')]);loggerPredictive[_0xaa09('0x7a')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1a41ac['erlangBusyFactor']);loggerPredictive[_0xaa09('0x7a')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1a41ac[_0xaa09('0x6f')]);loggerPredictive[_0xaa09('0x7a')](_0xaa09('0x80'));_[_0xaa09('0x88')](_0x431704,_0x1a41ac);};}function getDiff(_0x495ad9){var _0x28c967=moment()[_0xaa09('0x45')](0x0);var _0x1f3d30=moment(_0x495ad9)[_0xaa09('0x45')](0x0);return _0x28c967[_0xaa09('0x46')](_0x1f3d30,'seconds');}function ifInterval(_0x5cb063,_0x52cfa1){if(_[_0xaa09('0x38')](_0x52cfa1)){return![];}return getDiff(_0x52cfa1)<_0x5cb063*0x3c;}function freeVariablesPredictive(_0x47c955){if(isNotNull(_0x47c955)){if(!_['isUndefined'](_0x47c955['startProgressive'])){_0x47c955[_0xaa09('0x71')]=undefined;loggerPredictive[_0xaa09('0x7a')](_0x47c955[_0xaa09('0x3d')],_0xaa09('0x89'));}if(!_[_0xaa09('0x38')](_0x47c955[_0xaa09('0x26')])){_0x47c955[_0xaa09('0x26')]=undefined;loggerPredictive[_0xaa09('0x7a')](_0x47c955[_0xaa09('0x3d')],_0xaa09('0x8a'));}if(!_['isUndefined'](_0x47c955[_0xaa09('0x8b')])){clearInterval(_0x47c955[_0xaa09('0x8b')]);_0x47c955[_0xaa09('0x8b')]=undefined;loggerPredictive[_0xaa09('0x7a')](_0x47c955[_0xaa09('0x3d')],_0xaa09('0x8c'));}}}function erlangb(_0x1b697e,_0x22312c){if(_0x22312c===0x0){return 0x0;}var _0x494ba7=0x1;for(var _0x3f5e3d=0x1;_0x3f5e3d<=_0x22312c;_0x3f5e3d+=0x1){_0x494ba7=0x1+_0x494ba7*_0x3f5e3d/_0x1b697e;}return 0x1/_0x494ba7;}function isVoiceQueueOutbound(_0x4f9d0a){return _0x4f9d0a===_0xaa09('0x49');}function isNotPreview(_0x1de553){return _0x1de553!==_0xaa09('0x8d');}function isCampaignIvr(_0x45e56f){return _0x45e56f===_0xaa09('0x77');}function getCallerId(_0x15ab8a,_0x5a7b07,_0x31cef6){if(!_[_0xaa09('0x38')](_0x31cef6)&&typeof _0x31cef6===_0xaa09('0x8e')&&!_['isEmpty'](_0x31cef6)){if(!_['isUndefined'](_0x5a7b07)&&typeof _0x5a7b07===_0xaa09('0x8e')&&!_[_0xaa09('0x40')](_0x5a7b07)){return util[_0xaa09('0x78')](_0xaa09('0x8f'),_0x5a7b07,_0x31cef6);}return util[_0xaa09('0x78')](_0xaa09('0x8f'),_0x31cef6,_0x31cef6);}if(!_[_0xaa09('0x38')](_0x15ab8a)&&typeof _0x15ab8a==='string'&&!_[_0xaa09('0x40')](_0x15ab8a)){return _0x15ab8a;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x474b35,_0x319bd3){return function(_0x3a1de0){freeVariablesPredictive(_0x319bd3);emitVoiceQueueSummary(_0x319bd3);emitCampaignSummary(_0x319bd3);loggerSyncQueueSummary[_0xaa09('0x90')](_0x474b35,util[_0xaa09('0x91')](_0x3a1de0,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x59e55c,_0x41a69f){return function(_0x25c712){loggerPredictive['error'](_0x41a69f[_0xaa09('0x3d')],_0x59e55c);loggerPredictive[_0xaa09('0x90')](_0x25c712['stack']);freeVariablesPredictive(_0x41a69f);};}function loggerCatch(_0x49c261){return function(_0x50090f){logger['error'](_0x49c261,util[_0xaa09('0x91')](_0x50090f,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x14d85c){return _0x14d85c&&!_['isUndefined'](_0x14d85c)&&_0x14d85c[_0xaa09('0x92')]>0x0;}function decremetOriginate(_0x39f47b){if(!_[_0xaa09('0x38')](_0x39f47b)&&_0x39f47b!==null){if(typeof _0x39f47b[_0xaa09('0x6c')]!=='undefined'){if(_0x39f47b[_0xaa09('0x6c')]>0x0){_0x39f47b[_0xaa09('0x6c')]-=0x1;}else{logger[_0xaa09('0x90')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xaa09('0x90')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x410641,_0x5e1474,_0x4befb3){if(_0x5e1474>_0x4befb3){for(var _0x3e31df=0x0;_0x3e31df<_0x5e1474-_0x4befb3;_0x3e31df+=0x1){decremetOriginate(_0x410641);}}}function loggerGetContactDialer(_0x3e2a61,_0x560db3,_0x1ba320){return function(_0x3a9205){checkContactLowerLimitOriginate(_0x560db3,_0x1ba320,0x0);logger[_0xaa09('0x90')](_0x3e2a61,util[_0xaa09('0x91')](_0x3a9205,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x409b6c){return function(_0x3da406){if(isNotNull(_0x3da406)&&isNotNull(_0x3da406[0x0])){if(_0x3da406[0x0]['contactsRescheduled']>0x0){_0x409b6c['message']='RESCHEDULED_CONTACTS';logger[_0xaa09('0x7a')](_0xaa09('0x93')+_0x409b6c[_0xaa09('0x3d')],_0x3da406[0x0][_0xaa09('0x94')],'contacts');}else{_0x409b6c[_0xaa09('0x39')]=_0xaa09('0x95');logger['info'](_0xaa09('0x96')+_0x409b6c['name']);}}};}function notSendMessagesQueue(_0x1e5201){if(_0x1e5201[_0xaa09('0x97')]){freeVariablesPredictive(_0x1e5201);if(_0x1e5201[_0xaa09('0x6c')]===0x0&&_0x1e5201[_0xaa09('0x50')]===0x0&&_0x1e5201[_0xaa09('0x52')]===0x0&&(_0x1e5201[_0xaa09('0x4c')]||0x0)===0x0){_0x1e5201[_0xaa09('0x97')]=![];_0x1e5201[_0xaa09('0x98')]=0x0;_0x1e5201[_0xaa09('0x39')]=_0xaa09('0x3c');loggerSyncQueueSummary[_0xaa09('0x90')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x1e5201[_0xaa09('0x3d')],_0xaa09('0x99'));}else{_0x1e5201[_0xaa09('0x39')]=_0xaa09('0x9a');loggerSyncQueueSummary[_0xaa09('0x90')](_0xaa09('0x9b'),_0x1e5201[_0xaa09('0x3d')],_0xaa09('0x9c'));}emitVoiceQueueSummary(_0x1e5201);}}function notSendMessagesCampaign(_0x384b29){if(_0x384b29['sendMessageOneNotActive']){if(_0x384b29[_0xaa09('0x6c')]===0x0){_0x384b29['sendMessageOneNotActive']=![];_0x384b29['message']=_0xaa09('0x3c');loggerSyncQueueSummary[_0xaa09('0x90')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x384b29[_0xaa09('0x3d')],_0xaa09('0x99'));}else{_0x384b29[_0xaa09('0x39')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xaa09('0x90')](_0xaa09('0x9d'),_0x384b29[_0xaa09('0x3d')],_0xaa09('0x9c'));}emitCampaignSummary(_0x384b29);}}function createObjHistory(_0x3f5df5,_0x29ab59,_0x3006e2,_0x5d1fe0,_0x244534){_0x3f5df5[_0xaa09('0x39')]=_0x3006e2;var _0x5e6421=new Action(_0x3f5df5,_0x29ab59);var _0x1dcec3=new History(_0x5e6421);_0x1dcec3[_0xaa09('0x9e')]=_0x5d1fe0;_0x1dcec3[_0xaa09('0x9f')]=_0x244534;_0x1dcec3[_0xaa09('0xa0')]=_0x5e6421[_0xaa09('0xa1')];return _0x1dcec3;}Dialer[_0xaa09('0x1b')][_0xaa09('0xa2')]=function(){var _0x49cfc4=this;setInterval(function(){_0x49cfc4[_0xaa09('0xa3')](_0x49cfc4[_0xaa09('0x24')],'[uniqueid]');_0x49cfc4[_0xaa09('0xa3')](_0x49cfc4[_0xaa09('0x23')],'[actions]');},0x32c8);};Dialer[_0xaa09('0x1b')][_0xaa09('0xa3')]=function(_0x20fe0c,_0x83e9a){var _0x3465a6=this;for(var _0x4fef3b in _0x20fe0c){if(typeof _0x20fe0c[_0x4fef3b]!=='undefined'){this['sequence'][_0xaa09('0xa4')](function(){if(!_[_0xaa09('0xa5')](_0x20fe0c[_0x4fef3b])){return ami['Action']({'action':'status','channel':_0x20fe0c[_0x4fef3b]['channel']})[_0xaa09('0xa6')](function(_0x5878e5){if(_0x5878e5[_0xaa09('0x39')]===_0xaa09('0xa7')){setTimeout(function(){if(_0x20fe0c[_0x4fef3b]&&_0x20fe0c[_0x4fef3b]['type']!==_0xaa09('0x77')){_0x3465a6['updateOriginated'](_0x3465a6[_0xaa09('0x1f')][_0x20fe0c[_0x4fef3b][_0xaa09('0xa8')]]);logger['error'](_0xaa09('0xa9'),_0x83e9a,_0x4fef3b,_0x20fe0c[_0x4fef3b]['queue']);delete _0x20fe0c[_0x4fef3b];}if(_0x20fe0c[_0x4fef3b]&&_0x20fe0c[_0x4fef3b][_0xaa09('0x48')]===_0xaa09('0x77')){_0x3465a6['updateOriginated'](_0x3465a6[_0xaa09('0xaa')][_0x20fe0c[_0x4fef3b][_0xaa09('0xa8')]]);logger[_0xaa09('0x90')](_0xaa09('0xab'),_0x83e9a,_0x4fef3b,_0x20fe0c[_0x4fef3b][_0xaa09('0xa8')]);delete _0x20fe0c[_0x4fef3b];}},0x2328);}});}});}}};Dialer[_0xaa09('0x1b')][_0xaa09('0xac')]=function(_0x914d80){return BPromise[_0xaa09('0xad')]()['then'](cmHopper[_0xaa09('0xac')](_0x914d80))[_0xaa09('0xa6')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xaa09('0x1b')][_0xaa09('0xae')]=function(_0x13552c){return BPromise[_0xaa09('0xad')]()['then'](cmHopperBlack[_0xaa09('0xae')](_0x13552c))['catch'](loggerCatch(_0xaa09('0xaf')));};Dialer['prototype'][_0xaa09('0xb0')]=function(_0x19b3f6){return BPromise[_0xaa09('0xad')]()[_0xaa09('0xb1')](cmHopperBlack['checkIsBlackListIvr'](_0x19b3f6))[_0xaa09('0xa6')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xaa09('0x1b')][_0xaa09('0xb2')]=function(_0x20adf0){return BPromise[_0xaa09('0xad')]()[_0xaa09('0xb1')](cmHopperHistory[_0xaa09('0xb3')](_0x20adf0))['catch'](loggerCatch(_0xaa09('0xb4')));};Dialer[_0xaa09('0x1b')][_0xaa09('0xb5')]=function(_0x131c38){return BPromise['resolve']()[_0xaa09('0xb1')](cmHopper[_0xaa09('0xb5')](_0x131c38))[_0xaa09('0xa6')](loggerCatch(_0xaa09('0xb6')));};Dialer[_0xaa09('0x1b')]['unlockContact']=function(_0x59a449,_0x3bde63,_0x16dedc){return BPromise[_0xaa09('0xad')]()[_0xaa09('0xb1')](cmHopper[_0xaa09('0xb7')](_0x59a449,_0x3bde63,_0x16dedc))[_0xaa09('0xa6')](loggerCatch(_0xaa09('0xb8')));};Dialer['prototype'][_0xaa09('0xb9')]=function(_0x12a844,_0x2769d2,_0x3d309d,_0x21cfe1,_0x21adc2){return BPromise[_0xaa09('0xad')]()[_0xaa09('0xb1')](cmHopper[_0xaa09('0xb9')](_0x12a844,_0x2769d2,_0x3d309d,_0x21cfe1))['catch'](function(_0x305eb7){_0x21adc2['temp']-=_0x3d309d;_0x21adc2[_0xaa09('0xba')]=_0x21adc2[_0xaa09('0xba')]>0x0?_0x21adc2['temp']:0x0;loggerCatch('[getContactDialer]\x20')(_0x305eb7);});};Dialer[_0xaa09('0x1b')]['getContactDialerIvr']=function(_0x5e61d8,_0x19ccc1,_0x4cd5ed,_0x7782be){return BPromise[_0xaa09('0xad')]()['then'](cmHopper['getContactDialerIvr'](_0x5e61d8,_0x19ccc1,_0x4cd5ed))['catch'](function(_0x166a93){_0x7782be[_0xaa09('0xba')]-=_0x19ccc1;_0x7782be['temp']=_0x7782be['temp']>0x0?_0x7782be[_0xaa09('0xba')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x166a93);});};Dialer[_0xaa09('0x1b')][_0xaa09('0xbb')]=function(_0x388046){return BPromise[_0xaa09('0xad')]()[_0xaa09('0xb1')](voiceQueueRt['getVoiceQueueRtPauses'](_0x388046))[_0xaa09('0xa6')](loggerCatch(_0xaa09('0xbc')));};Dialer[_0xaa09('0x1b')]['moveContactManagedDialer']=function(_0x584021){return BPromise[_0xaa09('0xad')]()[_0xaa09('0xb1')](cmHopper[_0xaa09('0xbd')](_0x584021))['catch'](loggerCatch(_0xaa09('0xbe')));};Dialer[_0xaa09('0x1b')]['createHistory']=function(_0x589ae7){return BPromise[_0xaa09('0xad')]()[_0xaa09('0xb1')](cmHopperHistory[_0xaa09('0xbf')](_0x589ae7))['catch'](loggerCatch('[createHistory]\x20'));};Dialer[_0xaa09('0x1b')][_0xaa09('0xc0')]=function(_0x576d94){if(!_[_0xaa09('0x38')](_0x576d94)&&_0x576d94!==null){if(typeof _0x576d94[_0xaa09('0x6c')]!=='undefined'){if(_0x576d94['originated']>0x0){_0x576d94['originated']-=0x1;}else{logger[_0xaa09('0x90')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xaa09('0x90')](_0xaa09('0xc1'));}};Dialer[_0xaa09('0x1b')][_0xaa09('0xc2')]=function(_0x1fc07d,_0x3da02){var _0x4e8db2=this;return function(_0x114a43){_0x4e8db2[_0xaa09('0xc0')](_0x3da02);logger['error'](_0x1fc07d,util[_0xaa09('0x91')](_0x114a43,{'showHidden':![],'depth':null}));};};Dialer[_0xaa09('0x1b')][_0xaa09('0xc3')]=function(_0x4e6e2b,_0x185a68,_0x440506){var _0x129031={'state':0x19,'statedesc':'notFound'};this[_0xaa09('0xc0')](_0x185a68);this[_0xaa09('0xc4')](_['merge'](_0x129031,_[_0xaa09('0xc5')](_0x440506,[_0xaa09('0xc6'),_0xaa09('0xc7'),_0xaa09('0xc8'),'VoiceQueueId',_0xaa09('0xc9')])),_0xaa09('0xca'),_0xaa09('0xcb'));logger['error'](_0x4e6e2b);};Dialer[_0xaa09('0x1b')][_0xaa09('0xcc')]=function(_0x1f161d){return _0x1f161d===_0xaa09('0xcd');};Dialer[_0xaa09('0x1b')]['isTrunkReachable']=function(_0x304ea5){return!_[_0xaa09('0x38')](_0x304ea5)&&_0x304ea5&&!_[_0xaa09('0x38')](_0x304ea5['name'])&&!_[_0xaa09('0x38')](_0x304ea5[_0xaa09('0x73')])&&_0x304ea5[_0xaa09('0x73')]&&(this[_0xaa09('0xce')][util[_0xaa09('0x78')](_0xaa09('0xcf'),_0x304ea5[_0xaa09('0x3d')])][_0xaa09('0xd0')]==='reachable'||this[_0xaa09('0xce')][util['format'](_0xaa09('0xcf'),_0x304ea5[_0xaa09('0x3d')])]['status']==='unmonitored');};Dialer[_0xaa09('0x1b')][_0xaa09('0xc4')]=function(_0x2234a7,_0x337ef1,_0x179db9){this[_0xaa09('0xbf')](_0x2234a7)[_0xaa09('0xa6')](loggerCatch(_0x337ef1));this[_0xaa09('0xbd')](_0x2234a7)[_0xaa09('0xa6')](loggerCatch(_0x179db9));};Dialer[_0xaa09('0x1b')][_0xaa09('0xd1')]=function(_0x1bb887){var _0x511284=this[_0xaa09('0x24')][_0x1bb887[_0xaa09('0xd2')]];var _0x1334ca;if(!_['isNil'](_0x1bb887)&&!_['isNil'](_0x1bb887[_0xaa09('0xd3')])&&!_['isNil'](_0x1bb887['variable'][_0xaa09('0xd4')])&&_0x1bb887['exten']===_0xaa09('0xd5')&&_0x511284){if(_0x511284[_0xaa09('0x48')]!==_0xaa09('0x77')&&this[_0xaa09('0x1f')][_0x511284['queue']][_0xaa09('0xd6')]&&_0x1bb887[_0xaa09('0xd7')]===_0xaa09('0xd8')){delete this['uniqueId'][_0x1bb887[_0xaa09('0xd2')]];this[_0xaa09('0xc0')](this[_0xaa09('0x1f')][_0x511284[_0xaa09('0xa8')]]);this[_0xaa09('0x1f')][_0x511284[_0xaa09('0xa8')]][_0xaa09('0x59')]+=0x1;this['voiceQueues'][_0x511284[_0xaa09('0xa8')]][_0xaa09('0xd9')]+=0x1;_0x1334ca=new Hangup(_0x511284,_0x1bb887);_0x1334ca['state']=0x12;_0x1334ca[_0xaa09('0x9f')]=_0xaa09('0xda');_0x1334ca[_0xaa09('0xdb')]=_0xaa09('0xdc');ami[_0xaa09('0xdd')](_0xaa09('0xde'),ut[_0xaa09('0xdf')](_0x1334ca,_0xaa09('0xe0')));this[_0xaa09('0xc4')](_0x1334ca,_0xaa09('0xe1'),_0xaa09('0xe2'));}if(_0x511284['type']!=='ivr'&&this[_0xaa09('0x1f')][_0x511284['queue']][_0xaa09('0xd6')]&&_0x1bb887[_0xaa09('0xd7')]===_0xaa09('0xe3')){var _0x4d0679=this;return new BPromise(function(_0x54ae30,_0x34063a){delete _0x4d0679[_0xaa09('0x24')][_0x1bb887[_0xaa09('0xd2')]];_0x4d0679[_0xaa09('0xc0')](_0x4d0679[_0xaa09('0x1f')][_0x511284[_0xaa09('0xa8')]]);_0x4d0679[_0xaa09('0x1f')][_0x511284['queue']][_0xaa09('0x59')]+=0x1;_0x4d0679[_0xaa09('0x1f')][_0x511284['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x4ca5fc=_0x4d0679[_0xaa09('0x1f')][_0x511284[_0xaa09('0xa8')]];var _0x10f7a9=new Hangup(_0x511284,_0x1bb887);_0x10f7a9[_0xaa09('0x9e')]=0x13;_0x10f7a9[_0xaa09('0x9f')]='Machine';_0x10f7a9[_0xaa09('0xdb')]=_0xaa09('0xdc');_0x10f7a9[_0xaa09('0xe4')]+=0x1;_0x10f7a9[_0xaa09('0xe5')]+=0x1;_0x10f7a9[_0xaa09('0xe0')]=!![];ami['emit']('custom:amd',ut[_0xaa09('0xdf')](_0x10f7a9,_0xaa09('0xe0')));_0x4d0679[_0xaa09('0xbf')](_0x10f7a9)[_0xaa09('0xa6')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x10f7a9[_0xaa09('0xe6')]+_0x10f7a9[_0xaa09('0xe7')]+_0x10f7a9[_0xaa09('0xe8')]+_0x10f7a9['countnosuchnumberretry']+_0x10f7a9[_0xaa09('0xe9')]+_0x10f7a9['countabandonedretry']+_0x10f7a9[_0xaa09('0xe4')]+_0x10f7a9[_0xaa09('0xea')]>=_0x4ca5fc['dialGlobalMaxRetry']){_0x4d0679[_0xaa09('0xeb')](_0x10f7a9,_0x54ae30,_0x34063a,_0xaa09('0xec'));}else{if(_0x10f7a9[_0xaa09('0xe4')]>=_0x4ca5fc[_0xaa09('0xed')]){_0x4d0679[_0xaa09('0xee')](_0x10f7a9,_0x54ae30,_0x34063a,'reason\x2019\x20machine....');}else{_0x4d0679[_0xaa09('0xb5')]({'active':![],'countmachineretry':_0x10f7a9[_0xaa09('0xe4')],'scheduledat':moment()[_0xaa09('0xef')](_0x4ca5fc[_0xaa09('0xf0')],_0xaa09('0xf1'))[_0xaa09('0x78')](_0xaa09('0xf2')),'ContactId':_0x10f7a9[_0xaa09('0xc6')],'ListId':_0x10f7a9['ListId'],'VoiceQueueId':_0x10f7a9[_0xaa09('0xf3')]||undefined,'CampaignId':_0x10f7a9['CampaignId']||undefined})[_0xaa09('0xa6')](loggerCatch('[rescheduleContact][Machine]'));_0x54ae30({'reschedule':0x1});}}});}if(_0x511284[_0xaa09('0x48')]===_0xaa09('0x77')&&this[_0xaa09('0xaa')][_0x511284['queue']][_0xaa09('0xd6')]&&_0x1bb887['value']===_0xaa09('0xd8')){delete this[_0xaa09('0x24')][_0x1bb887['uniqueid']];this[_0xaa09('0xc0')](this[_0xaa09('0xaa')][_0x511284[_0xaa09('0xa8')]]);_0x1334ca=new Hangup(_0x511284,_0x1bb887);_0x1334ca[_0xaa09('0x9e')]=0x12;_0x1334ca[_0xaa09('0x9f')]=_0xaa09('0xda');_0x1334ca['membername']=_0xaa09('0xdc');ami['emit'](_0xaa09('0xde'),ut[_0xaa09('0xdf')](_0x1334ca,'amd'));this[_0xaa09('0xc4')](_0x1334ca,_0xaa09('0xf4'),_0xaa09('0xf5'));}if(_0x511284[_0xaa09('0x48')]===_0xaa09('0x77')&&this['campaigns'][_0x511284[_0xaa09('0xa8')]][_0xaa09('0xd6')]&&_0x1bb887[_0xaa09('0xd7')]===_0xaa09('0xe3')){var _0x4d0679=this;return new BPromise(function(_0x556979,_0x231108){delete _0x4d0679['uniqueId'][_0x1bb887[_0xaa09('0xd2')]];_0x4d0679['updateOriginated'](_0x4d0679[_0xaa09('0xaa')][_0x511284[_0xaa09('0xa8')]]);_0x4d0679[_0xaa09('0xaa')][_0x511284[_0xaa09('0xa8')]][_0xaa09('0x59')]+=0x1;_0x4d0679[_0xaa09('0xaa')][_0x511284['queue']][_0xaa09('0xd9')]+=0x1;var _0x4d3494=_0x4d0679[_0xaa09('0xaa')][_0x511284['queue']];var _0x520fc2=new Hangup(_0x511284,_0x1bb887);_0x520fc2[_0xaa09('0x9e')]=0x13;_0x520fc2[_0xaa09('0x9f')]=_0xaa09('0xf6');_0x520fc2['membername']=_0xaa09('0xdc');_0x520fc2['countmachineretry']+=0x1;_0x520fc2[_0xaa09('0xe5')]+=0x1;_0x520fc2[_0xaa09('0xe0')]=!![];ami[_0xaa09('0xdd')](_0xaa09('0xde'),ut['buildObj'](_0x520fc2,_0xaa09('0xe0')));_0x4d0679['createHistory'](_0x520fc2)[_0xaa09('0xa6')](loggerCatch(_0xaa09('0xf7')));if(_0x520fc2[_0xaa09('0xe6')]+_0x520fc2[_0xaa09('0xe7')]+_0x520fc2['countnoanswerretry']+_0x520fc2[_0xaa09('0xf8')]+_0x520fc2[_0xaa09('0xe9')]+_0x520fc2[_0xaa09('0xf9')]+_0x520fc2['countmachineretry']+_0x520fc2['countagentrejectretry']>=_0x4d3494['dialGlobalMaxRetry']){_0x4d0679[_0xaa09('0xeb')](_0x520fc2,_0x556979,_0x231108,'reason19\x20machine....');}else{if(_0x520fc2[_0xaa09('0xe4')]>=_0x4d3494['dialMachineMaxRetry']){_0x4d0679[_0xaa09('0xee')](_0x520fc2,_0x556979,_0x231108,_0xaa09('0xfa'));}else{_0x4d0679[_0xaa09('0xb5')]({'active':![],'countmachineretry':_0x520fc2[_0xaa09('0xe4')],'scheduledat':moment()[_0xaa09('0xef')](_0x4d3494[_0xaa09('0xf0')],_0xaa09('0xf1'))[_0xaa09('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x520fc2['ContactId'],'ListId':_0x520fc2[_0xaa09('0xc7')],'VoiceQueueId':_0x520fc2['VoiceQueueId']||undefined,'CampaignId':_0x520fc2[_0xaa09('0xc9')]||undefined})[_0xaa09('0xa6')](loggerCatch('[rescheduleContact][Machine]'));_0x556979({'reschedule':0x1});}}});}}};Dialer[_0xaa09('0x1b')][_0xaa09('0x33')]=function(_0x100dfb){var _0x4fe80d=this[_0xaa09('0x24')][_0x100dfb['uniqueid']];var _0x262e0c=this;var _0x51e067;if(_0x4fe80d&&_0x4fe80d[_0xaa09('0x48')]==='ivr'){delete this[_0xaa09('0x24')][_0x100dfb[_0xaa09('0xd2')]];this['updateOriginated'](this[_0xaa09('0xaa')][_0x4fe80d['queue']]);this[_0xaa09('0xaa')][_0x4fe80d['queue']][_0xaa09('0xfb')]+=0x1;_0x51e067=new Hangup(_0x4fe80d,_0x100dfb);this[_0xaa09('0xbf')](_0x51e067)[_0xaa09('0xa6')](loggerCatch(_0xaa09('0xfc')));this[_0xaa09('0xbd')](_0x51e067)[_0xaa09('0xa6')](loggerCatch(_0xaa09('0xfd')));}if(_0x4fe80d&&_0x4fe80d[_0xaa09('0x48')]!==_0xaa09('0x77')&&isNotNull(this['voiceQueues'][_0x4fe80d['queue']][_0xaa09('0xfe')])){delete this[_0xaa09('0x24')][_0x100dfb[_0xaa09('0xd2')]];this[_0xaa09('0xc0')](this[_0xaa09('0x1f')][_0x4fe80d['queue']]);this['voiceQueues'][_0x4fe80d[_0xaa09('0xa8')]][_0xaa09('0x59')]+=0x1;this['voiceQueues'][_0x4fe80d[_0xaa09('0xa8')]][_0xaa09('0xd9')]+=0x1;_0x51e067=new Hangup(_0x4fe80d,_0x100dfb);_0x51e067[_0xaa09('0x9e')]=0x10;_0x51e067[_0xaa09('0x9f')]='AnswerAGI';_0x51e067[_0xaa09('0xdb')]=_0xaa09('0xff');this[_0xaa09('0xbf')](_0x51e067)[_0xaa09('0xa6')](loggerCatch(_0xaa09('0xfc')));this['moveContactManagedDialer'](_0x51e067)[_0xaa09('0xa6')](loggerCatch(_0xaa09('0xfd')));}if(_0x4fe80d&&_0x4fe80d[_0xaa09('0x48')]!==_0xaa09('0x77')&&!isNotNull(this[_0xaa09('0x1f')][_0x4fe80d[_0xaa09('0xa8')]]['dialQueueProject'])){delete this[_0xaa09('0x24')][_0x100dfb[_0xaa09('0xd2')]];this[_0xaa09('0xc0')](this['voiceQueues'][_0x4fe80d[_0xaa09('0xa8')]]);this['voiceQueues'][_0x4fe80d['queue']][_0xaa09('0x62')]+=0x1;_0x51e067=new Hangup(_0x4fe80d,_0x100dfb);_0x51e067[_0xaa09('0x9e')]=0xc;_0x51e067[_0xaa09('0x9f')]=_0x100dfb['cause-txt'];_0x51e067[_0xaa09('0xdb')]=_0xaa09('0x100');this[_0xaa09('0xbf')](_0x51e067)[_0xaa09('0xa6')](loggerCatch(_0xaa09('0xfc')));this['moveContactManagedDialer'](_0x51e067)[_0xaa09('0xa6')](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype']['syncAgentComplete']=function(_0xacd0ba){var _0x15cf20=this[_0xaa09('0x24')][_0xacd0ba['uniqueid']];var _0x1f8f9c=this;if(this['voiceQueues'][_0xacd0ba['queue']]){if(_0x15cf20&&_0x15cf20[_0xaa09('0x48')]!==_0xaa09('0x77')){delete this['uniqueId'][_0xacd0ba[_0xaa09('0xd2')]];this['voiceQueues'][_0xacd0ba[_0xaa09('0xa8')]][_0xaa09('0x59')]+=0x1;var _0x1f70a1=new AgentComplete(_0x15cf20,_0xacd0ba);if(_0xacd0ba[_0xaa09('0x101')]===_0xaa09('0x102')){_0x1f70a1[_0xaa09('0x103')]=this[_0xaa09('0x1f')][_0xacd0ba[_0xaa09('0xa8')]][_0xaa09('0x104')]&&this[_0xaa09('0x1f')][_0xacd0ba['queue']]['dialAgiAfterHangupAgent']?moment()[_0xaa09('0x78')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xaa09('0xbf')](_0x1f70a1)[_0xaa09('0xa6')](loggerCatch(_0xaa09('0x105')));this[_0xaa09('0xbd')](_0x1f70a1)[_0xaa09('0xa6')](loggerCatch(_0xaa09('0x106')));}}};Dialer[_0xaa09('0x1b')]['syncAgentConnect']=function(_0x5839b1){if(this['voiceQueues'][_0x5839b1[_0xaa09('0xa8')]]){if(this[_0xaa09('0x24')][_0x5839b1[_0xaa09('0xd2')]]&&this[_0xaa09('0x24')][_0x5839b1['uniqueid']][_0xaa09('0x48')]!==_0xaa09('0x77')){this[_0xaa09('0xc0')](this[_0xaa09('0x1f')][_0x5839b1['queue']]);this[_0xaa09('0x24')][_0x5839b1['uniqueid']][_0xaa09('0x107')]=moment()[_0xaa09('0x78')](_0xaa09('0xf2'));}}};Dialer[_0xaa09('0x1b')][_0xaa09('0x108')]=function(_0x373e3e){this[_0xaa09('0xbf')](_0x373e3e)[_0xaa09('0xa6')](loggerCatch(_0xaa09('0x105')));this[_0xaa09('0xbd')](_0x373e3e)[_0xaa09('0xa6')](loggerCatch(_0xaa09('0x109')));};Dialer['prototype'][_0xaa09('0x2c')]=function(_0xa9370){var _0x606d7b=this[_0xaa09('0x24')][_0xa9370[_0xaa09('0xd2')]];var _0x299ba5=this;if(this['voiceQueues'][_0xa9370[_0xaa09('0xa8')]]){if(_0x606d7b&&_0x606d7b[_0xaa09('0x48')]!==_0xaa09('0x77')){delete this[_0xaa09('0x24')][_0xa9370[_0xaa09('0xd2')]];this[_0xaa09('0xc0')](this[_0xaa09('0x1f')][_0xa9370[_0xaa09('0xa8')]]);_0x606d7b['droptime']=moment()['format'](_0xaa09('0xf2'));var _0x5212b7=new QueueCallerAbandon(_0x606d7b,_0xa9370);if(getSeconds(_0x606d7b['droptime'],_0x606d7b[_0xaa09('0x10a')])>=_0x606d7b['dialQueueTimeout']){this[_0xaa09('0x1f')][_0xa9370['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xaa09('0x1f')][_0xa9370[_0xaa09('0xa8')]][_0xaa09('0x5d')]+=0x1;this['voiceQueues'][_0xa9370[_0xaa09('0xa8')]][_0xaa09('0x67')]+=0x1;_0x5212b7[_0xaa09('0x9e')]=0xa;_0x5212b7[_0xaa09('0x9f')]='Drop';_0x5212b7[_0xaa09('0x10b')]=_0xaa09('0x10c');_0x5212b7[_0xaa09('0x103')]=this['voiceQueues'][_0xa9370[_0xaa09('0xa8')]][_0xaa09('0x104')]?moment()[_0xaa09('0x78')](_0xaa09('0xf2')):undefined;_0x5212b7[_0xaa09('0xe9')]+=0x1;_0x5212b7[_0xaa09('0xe5')]+=0x1;if(_0x5212b7[_0xaa09('0xe9')]>=this['voiceQueues'][_0xa9370[_0xaa09('0xa8')]][_0xaa09('0x10d')]){this[_0xaa09('0x108')](_0x5212b7);}else{this[_0xaa09('0xb5')]({'active':![],'countdropretry':_0x5212b7['countdropretry'],'scheduledat':moment()['add'](this[_0xaa09('0x1f')][_0xa9370[_0xaa09('0xa8')]][_0xaa09('0x10e')],_0xaa09('0xf1'))['format'](_0xaa09('0xf2')),'ContactId':_0x606d7b[_0xaa09('0xc6')],'ListId':_0x606d7b[_0xaa09('0xc7')],'VoiceQueueId':_0x606d7b[_0xaa09('0xf3')]||undefined,'CampaignId':_0x606d7b[_0xaa09('0xc9')]||undefined})[_0xaa09('0xa6')](loggerCatch(_0xaa09('0x10f')));var _0x39101e=new History(_0x5212b7);_0x39101e['state']=0xa;_0x39101e[_0xaa09('0x9f')]=_0xaa09('0x110');_0x39101e[_0xaa09('0xa1')]=moment()[_0xaa09('0x78')](_0xaa09('0xf2'));_0x39101e[_0xaa09('0xa0')]=_0x39101e[_0xaa09('0xa1')];_0x39101e[_0xaa09('0x111')]=_0x5212b7[_0xaa09('0x111')];_0x39101e[_0xaa09('0x112')]=_0x5212b7[_0xaa09('0x112')];this[_0xaa09('0xbf')](_0x39101e)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xaa09('0x1f')][_0xa9370[_0xaa09('0xa8')]][_0xaa09('0x113')]+=0x1;this['voiceQueues'][_0xa9370[_0xaa09('0xa8')]][_0xaa09('0x5c')]+=0x1;_0x5212b7[_0xaa09('0x9e')]=0xb;_0x5212b7[_0xaa09('0x9f')]=_0xaa09('0x114');_0x5212b7[_0xaa09('0x10b')]=_0xaa09('0x115');_0x5212b7[_0xaa09('0xf9')]+=0x1;_0x5212b7['countglobal']+=0x1;if(_0x5212b7['countabandonedretry']>=this[_0xaa09('0x1f')][_0xa9370[_0xaa09('0xa8')]][_0xaa09('0x116')]){this[_0xaa09('0x108')](_0x5212b7);}else{this[_0xaa09('0xb5')]({'active':![],'countabandonedretry':_0x5212b7[_0xaa09('0xf9')],'scheduledat':moment()[_0xaa09('0xef')](this[_0xaa09('0x1f')][_0xa9370['queue']][_0xaa09('0x117')],_0xaa09('0xf1'))['format'](_0xaa09('0xf2')),'ContactId':_0x606d7b[_0xaa09('0xc6')],'ListId':_0x606d7b[_0xaa09('0xc7')],'VoiceQueueId':_0x606d7b['VoiceQueueId']||undefined,'CampaignId':_0x606d7b['CampaignId']||undefined})[_0xaa09('0xa6')](loggerCatch(_0xaa09('0x118')));var _0x39101e=new History(_0x5212b7);_0x39101e[_0xaa09('0x9e')]=0xb;_0x39101e['statedesc']=_0xaa09('0x114');_0x39101e[_0xaa09('0xa1')]=moment()[_0xaa09('0x78')]('YYYY-MM-DD\x20HH:mm:ss');_0x39101e['endtime']=_0x39101e[_0xaa09('0xa1')];_0x39101e['calleridname']=_0x5212b7['calleridname'];_0x39101e[_0xaa09('0x112')]=_0x5212b7[_0xaa09('0x112')];this[_0xaa09('0xbf')](_0x39101e)[_0xaa09('0xa6')](loggerCatch(_0xaa09('0x119')));}}}}};Dialer[_0xaa09('0x1b')][_0xaa09('0x11a')]=function(_0x4fed22){if(this['actions'][_0x4fed22[_0xaa09('0xd2')]]){this['actions'][_0x4fed22[_0xaa09('0xd2')]]['channel']=_0x4fed22[_0xaa09('0x11b')];}if(this[_0xaa09('0x24')][_0x4fed22[_0xaa09('0xd2')]]){this[_0xaa09('0x24')][_0x4fed22[_0xaa09('0xd2')]][_0xaa09('0x11b')]=_0x4fed22[_0xaa09('0x11b')];}};Dialer['prototype'][_0xaa09('0x36')]=function(_0x3044c4){if(strategy[this['voiceQueues'][this['actions'][_0x3044c4[_0xaa09('0x11c')]]['queue']][_0xaa09('0x11d')]]===_0xaa09('0x1a')){if(this['actions'][_0x3044c4[_0xaa09('0x11c')]]&&_[_0xaa09('0xa5')](this[_0xaa09('0x23')][_0x3044c4[_0xaa09('0x11c')]]['locked'])&&_0x3044c4['status']==='1'&&_0x3044c4['paused']==='0'){if(this[_0xaa09('0x20')][_0x3044c4['stateinterface']]){if(!this[_0xaa09('0x20')][_0x3044c4['stateinterface']][_0xaa09('0x11e')]){this[_0xaa09('0x20')][_0x3044c4[_0xaa09('0x11f')]][_0xaa09('0x11e')]=!![];this[_0xaa09('0x23')][_0x3044c4[_0xaa09('0x11c')]][_0xaa09('0x11e')]=!![];this[_0xaa09('0x23')][_0x3044c4[_0xaa09('0x11c')]][_0xaa09('0x11f')]=_0x3044c4[_0xaa09('0x11f')];}}}}else if((strategy[this[_0xaa09('0x1f')][this[_0xaa09('0x23')][_0x3044c4[_0xaa09('0x11c')]][_0xaa09('0xa8')]]['strategy']]||_0xaa09('0x19'))===_0xaa09('0x19')){if(this[_0xaa09('0x23')][_0x3044c4[_0xaa09('0x11c')]]){if(this[_0xaa09('0x20')][_0x3044c4[_0xaa09('0x11f')]]){this[_0xaa09('0x23')][_0x3044c4[_0xaa09('0x11c')]][_0xaa09('0x11f')]=_0x3044c4['stateinterface'];if(_[_0xaa09('0xa5')](this[_0xaa09('0x28')][this[_0xaa09('0x23')][_0x3044c4['actionid']]['queue']])){this[_0xaa09('0x28')][this['actions'][_0x3044c4['actionid']][_0xaa09('0xa8')]]=[];}this['queueBooked'][this[_0xaa09('0x23')][_0x3044c4[_0xaa09('0x11c')]]['queue']][_0xaa09('0x120')](_[_0xaa09('0x88')](_[_0xaa09('0xc5')](this[_0xaa09('0x23')][_0x3044c4[_0xaa09('0x11c')]],[_0xaa09('0x121'),'stateinterface']),{'status':_0x3044c4[_0xaa09('0xd0')],'paused':_0x3044c4[_0xaa09('0x122')]}));}}}};function unlockQueueStatus(_0x154a6e,_0x471987){setTimeout(function(){if(_[_0xaa09('0x38')](_0x154a6e[_0xaa09('0x123')])){loggerBooked[_0xaa09('0x90')](_0xaa09('0x124'),_0x471987);}_0x154a6e[_0xaa09('0x123')]=!![];loggerBooked[_0xaa09('0x7a')](_0xaa09('0x125'),_0x471987,JSON[_0xaa09('0x44')](_[_0xaa09('0xc5')](_0x154a6e,['name','queueStatusComplete'])));},0x1f3);}Dialer[_0xaa09('0x1b')][_0xaa09('0x37')]=function(_0x5bae2c){var _0x1323ad=this;var _0xb31ffa=_0x1323ad['voiceQueues'][_0x1323ad['actions'][_0x5bae2c[_0xaa09('0x11c')]][_0xaa09('0xa8')]];if(strategy[this[_0xaa09('0x1f')][this[_0xaa09('0x23')][_0x5bae2c['actionid']][_0xaa09('0xa8')]][_0xaa09('0x11d')]]==='roundrobin'){if(this['actions'][_0x5bae2c[_0xaa09('0x11c')]]&&this['actions'][_0x5bae2c['actionid']][_0xaa09('0x11f')]){this[_0xaa09('0x8d')]['run'](this['actions'][_0x5bae2c['actionid']][_0xaa09('0x121')],this['actions'][_0x5bae2c[_0xaa09('0x11c')]][_0xaa09('0x11f')])['catch'](function(_0x1e47d5){logger[_0xaa09('0x90')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xaa09('0x91')](_0x1e47d5,{'showHidden':![],'depth':null}));})[_0xaa09('0x1d')](function(){_0x1323ad[_0xaa09('0xc0')](_0x1323ad[_0xaa09('0x1f')][_0x1323ad[_0xaa09('0x23')][_0x5bae2c[_0xaa09('0x11c')]]['queue']]);_0x1323ad['agents'][_0x1323ad['actions'][_0x5bae2c[_0xaa09('0x11c')]][_0xaa09('0x11f')]][_0xaa09('0x11e')]=![];delete _0x1323ad[_0xaa09('0x23')][_0x5bae2c[_0xaa09('0x11c')]];unlockQueueStatus(_0xb31ffa);});}else{this[_0xaa09('0xc0')](this[_0xaa09('0x1f')][this[_0xaa09('0x23')][_0x5bae2c[_0xaa09('0x11c')]][_0xaa09('0xa8')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0xaa09('0x23')][_0x5bae2c[_0xaa09('0x11c')]]['ContactId'],'ListId':this[_0xaa09('0x23')][_0x5bae2c[_0xaa09('0x11c')]][_0xaa09('0xc7')],'VoiceQueueId':this['actions'][_0x5bae2c['actionid']]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x5bae2c[_0xaa09('0x11c')]]['CampaignId']||undefined})[_0xaa09('0xa6')](loggerCatch(_0xaa09('0x126')));delete this[_0xaa09('0x23')][_0x5bae2c[_0xaa09('0x11c')]];unlockQueueStatus(_0xb31ffa);}}else if((strategy[this['voiceQueues'][this[_0xaa09('0x23')][_0x5bae2c[_0xaa09('0x11c')]][_0xaa09('0xa8')]][_0xaa09('0x11d')]]||_0xaa09('0x19'))===_0xaa09('0x19')){var _0x38b343;if(this[_0xaa09('0x23')][_0x5bae2c[_0xaa09('0x11c')]]&&!_[_0xaa09('0x40')](this[_0xaa09('0x28')][this['actions'][_0x5bae2c[_0xaa09('0x11c')]][_0xaa09('0xa8')]])){if(this[_0xaa09('0x127')][_0x1323ad['actions'][_0x5bae2c[_0xaa09('0x11c')]][_0xaa09('0xa8')]]){this[_0xaa09('0x127')][_0x1323ad[_0xaa09('0x23')][_0x5bae2c[_0xaa09('0x11c')]][_0xaa09('0xa8')]]=this[_0xaa09('0x127')][this[_0xaa09('0x23')][_0x5bae2c[_0xaa09('0x11c')]][_0xaa09('0xa8')]]?this[_0xaa09('0x127')][this['actions'][_0x5bae2c['actionid']][_0xaa09('0xa8')]]:this[_0xaa09('0x28')][this[_0xaa09('0x23')][_0x5bae2c['actionid']][_0xaa09('0xa8')]]?this[_0xaa09('0x28')][this[_0xaa09('0x23')][_0x5bae2c['actionid']][_0xaa09('0xa8')]][_0xaa09('0x128')]||0x0:0x0;}this['queueBooked'][this[_0xaa09('0x23')][_0x5bae2c[_0xaa09('0x11c')]]['queue']][_0xaa09('0x128')]=this[_0xaa09('0x127')][this[_0xaa09('0x23')][_0x5bae2c[_0xaa09('0x11c')]][_0xaa09('0xa8')]];for(var _0x49d670=0x0;_0x49d670=0x0;})[_0xaa09('0xa6')](myreject(_0x40219d)));}}else{_0x400c51['push'](ami[_0xaa09('0x146')]({'action':_0xaa09('0x142'),'command':util[_0xaa09('0x78')](_0xaa09('0x147'),_0x2dc8c7,!_[_0xaa09('0x38')](config[_0xaa09('0x13f')][_0x5c114d])?_0x5c114d:'')})[_0xaa09('0xb1')](function(_0x45a236){return _0x45a236[_0xaa09('0x148')][_0xaa09('0x144')](_0xaa09('0x145'))>=0x0;})[_0xaa09('0xa6')](myreject(_0x40219d)));}BPromise[_0xaa09('0x149')](_0x400c51)[_0xaa09('0xb1')](function(_0x1231ca){var _0xc5ccd4=_[_0xaa09('0x14a')](_0x1231ca);if(_0xc5ccd4){return _0x44ca9d(_0xc5ccd4);}else{_0xf73026['message']=_0x156520?_0xaa09('0x14b'):_0xaa09('0x14c');return _0x40219d(msgResponse(_0xaa09('0x14d'),_0xaa09('0x13c'),'Global:\x20'+_0x156520+'\x20'+_0x14d94d+_0xaa09('0x14e')+util['inspect'](_0x2dc8c7,{'showHidden':![],'depth':null})+_0xaa09('0x14f')+_0x5c114d));}})[_0xaa09('0xa6')](function(_0x32873a){return _0x40219d(msgResponse(_0xaa09('0x13b'),_0xaa09('0x13c'),JSON[_0xaa09('0x44')](_0x32873a)));});});};Dialer[_0xaa09('0x1b')][_0xaa09('0x150')]=function(_0xec0ec8){var _0x56243e=this;return function(){switch(_0xec0ec8[_0xaa09('0x151')]){case _0xaa09('0x152'):freeVariablesPredictive(_0xec0ec8);_0x56243e['handlePower'](_0xec0ec8,0x1);break;case _0xaa09('0x153'):freeVariablesPredictive(_0xec0ec8);_0x56243e['handlePower'](_0xec0ec8,_0xec0ec8[_0xaa09('0x154')]);break;case _0xaa09('0x155'):_0x56243e[_0xaa09('0x155')](_0xec0ec8);break;case _0xaa09('0x9'):freeVariablesPredictive(_0xec0ec8);_0x56243e['handlePower'](_0xec0ec8,0x1);break;default:freeVariablesPredictive(_0xec0ec8);logger[_0xaa09('0x90')]('Queue',_0xec0ec8[_0xaa09('0x3d')],'method\x20not\x20recognized');}};};Dialer[_0xaa09('0x1b')]['launchHandleIvr']=function(_0x129510){var _0x5e6bfb=this;return function(){_0x5e6bfb[_0xaa09('0x156')](_0x129510);};};Dialer[_0xaa09('0x1b')][_0xaa09('0xb')]=function(_0x1e694a){var _0x28e7f5=this;if(isNotPreview(_0x1e694a[_0xaa09('0x151')])){if(isVoiceQueueOutbound(_0x1e694a[_0xaa09('0x48')])&&isActive(_0x1e694a[_0xaa09('0x54')])){_0x1e694a[_0xaa09('0x97')]=!![];BPromise['resolve']()[_0xaa09('0xb1')](checkIsLoggedIn(_0x1e694a,_0x1e694a[_0xaa09('0x4b')]))[_0xaa09('0xb1')](checkIsActive(_0x1e694a,_0x1e694a['dialActive']))[_0xaa09('0xb1')](checkInterval(_0x1e694a))[_0xaa09('0xb1')](_0x28e7f5['checkIsTrunkReachable'](_0x1e694a))[_0xaa09('0xb1')](_0x28e7f5[_0xaa09('0x139')](_0x1e694a[_0xaa09('0x157')],_0x1e694a[_0xaa09('0x158')],_0x1e694a[_0xaa09('0x3d')],_0x1e694a))[_0xaa09('0xb1')](_0x28e7f5[_0xaa09('0x13a')](_0x1e694a[_0xaa09('0x3e')],_0x1e694a[_0xaa09('0x158')],_0x1e694a['name'],_0x1e694a))[_0xaa09('0xb1')](_0x28e7f5[_0xaa09('0x150')](_0x1e694a))[_0xaa09('0xa6')](loggerCatchQueueSummary('[syncQueueSummary]',_0x1e694a));}else{notSendMessagesQueue(_0x1e694a);}}else{freeVariablesPredictive(_0x1e694a);}};Dialer[_0xaa09('0x1b')][_0xaa09('0x159')]=function(){var _0x287695=this;var _0x9c49af;for(var _0x18e01d in this[_0xaa09('0xaa')]){if(typeof this[_0xaa09('0xaa')][_0x18e01d]!==_0xaa09('0x15a')){_0x9c49af=this['campaigns'][_0x18e01d];if(isCampaignIvr(_0x9c49af[_0xaa09('0x48')])&&isActive(_0x9c49af[_0xaa09('0x73')])){_0x9c49af[_0xaa09('0x97')]=!![];BPromise[_0xaa09('0xad')]()['then'](checkIsActive(_0x9c49af,_0x9c49af[_0xaa09('0x73')]))[_0xaa09('0xb1')](checkInterval(_0x9c49af))[_0xaa09('0xb1')](_0x287695[_0xaa09('0x134')](_0x9c49af))[_0xaa09('0xb1')](_0x287695[_0xaa09('0x139')](_0x9c49af['dialGlobalInterval'],_0x9c49af[_0xaa09('0x158')],_0x9c49af[_0xaa09('0x3d')],_0x9c49af))[_0xaa09('0xb1')](_0x287695[_0xaa09('0x13a')](_0x9c49af[_0xaa09('0x3e')],_0x9c49af[_0xaa09('0x158')],_0x9c49af['name'],_0x9c49af))[_0xaa09('0xb1')](_0x287695[_0xaa09('0x15b')](_0x9c49af))['catch'](loggerCatchQueueSummary(_0xaa09('0x15c'),_0x9c49af));}else{notSendMessagesCampaign(_0x9c49af);}}}};function getCallerIdRandom(_0x17ba43,_0x1f43d8){var _0x30d863;var _0x58d252;var _0x247b2b;if(_0x1f43d8<=0x0){_0x1f43d8=0x1;}_0x30d863=new RegExp(_0xaa09('0x15d')+_0x1f43d8+'}$');_0x58d252=Math[_0xaa09('0x15e')](0xa,_0x1f43d8-0x1);_0x247b2b=Math[_0xaa09('0x15e')](0xa,_0x1f43d8)-0x1;return util[_0xaa09('0x78')]('%s',_[_0xaa09('0x15f')](_0x17ba43,_0x30d863,_[_0xaa09('0x160')](_0x58d252,_0x247b2b)));}function extractCalleridName(_0x23c8c4){var _0x4484e9=_0x23c8c4[_0xaa09('0x161')](/"(.*?)"/);return _0x4484e9?_0x4484e9[0x1]:_0x23c8c4;}function extractCalleridNumber(_0x228daa){var _0x217855=_0x228daa[_0xaa09('0x161')](/<(.*?)>/);return _0x217855?_0x217855[0x1]:_0x228daa;}Dialer[_0xaa09('0x1b')][_0xaa09('0x162')]=function(_0x355cae,_0x5a4fd6){var _0x59d295=this;var _0x526f89=uuid['v4']();this[_0xaa09('0x23')][_0x526f89]=new Action(_0x355cae,_0x5a4fd6,_0x526f89);return new BPromise(function(_0x3f8500,_0x17524a){if(_[_0xaa09('0x38')](_0x355cae)&&typeof _0x355cae!==_0xaa09('0x163')){return _0x17524a(msgResponse(_0xaa09('0x164'),'Failure','voiceQueue\x20is\x20undefine'));}if(_[_0xaa09('0x38')](_0x5a4fd6['Contact']['phone'])||_0x5a4fd6[_0xaa09('0x165')]['phone']===null){return _0x17524a(msgResponse(_0xaa09('0x164'),_0xaa09('0x13c'),'contact\x20is\x20undefine'));}var _0x32e014={'XMD-CALLERID':_0x59d295[_0xaa09('0x23')][_0x526f89][_0xaa09('0x166')](),'XMD-AGI':_0x355cae[_0xaa09('0xfe')]?util['format'](_0xaa09('0x167'),ipAgi,_0x355cae[_0xaa09('0xfe')]):_0xaa09('0x168'),'XMD-AGIAFTER':_0x355cae[_0xaa09('0x104')]?util[_0xaa09('0x78')](_0xaa09('0x167'),ipAgi,_0x355cae[_0xaa09('0x104')]):_0xaa09('0x168'),'XMD-QUEUE':_0x355cae['type']===_0xaa09('0x49')?util[_0xaa09('0x78')](_0xaa09('0x169'),_0x355cae[_0xaa09('0x3d')],_0x355cae['dialQueueOptions']||'',_0x355cae[_0xaa09('0x16a')]?'c':'',_0x355cae[_0xaa09('0x16b')]||0x3):_0xaa09('0x168'),'XMD-CONTACTID':_0x5a4fd6[_0xaa09('0xc6')],'XMD-CDRTYPE':_0xaa09('0x8'),'CALLERID(all)':_0x59d295[_0xaa09('0x23')][_0x526f89]['getCaller'](),'XMD-AMD':_0x355cae[_0xaa09('0xd6')]?_0xaa09('0x16c'):_0xaa09('0x168'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x355cae['dialAMDActive']){_0x32e014[_0xaa09('0x16d')]=_0x355cae[_0xaa09('0x16e')]||0x9c4;_0x32e014['XMD-AMDGREETING']=_0x355cae['dialAMDGreeting']||0x5dc;_0x32e014[_0xaa09('0x16f')]=_0x355cae['dialAMDAfterGreetingSilence']||0x320;_0x32e014[_0xaa09('0x170')]=_0x355cae[_0xaa09('0x171')]||0x1388;_0x32e014[_0xaa09('0x172')]=_0x355cae[_0xaa09('0x173')]||0x64;_0x32e014['XMD-AMDBETWEENWORDSSILENCE']=_0x355cae[_0xaa09('0x174')]||0x32;_0x32e014['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x355cae[_0xaa09('0x175')]||0x3;_0x32e014[_0xaa09('0x176')]=_0x355cae[_0xaa09('0x177')]||0x100;_0x32e014[_0xaa09('0x178')]=_0x355cae[_0xaa09('0x179')]||0x1388;}if(_0x355cae[_0xaa09('0x48')]===_0xaa09('0x49')){_0x32e014[_0xaa09('0x17a')]=_0x5a4fd6[_0xaa09('0xf3')];}else{_0x32e014[_0xaa09('0x17b')]=_0x5a4fd6[_0xaa09('0xc9')];}for(var _0x599a1f in _0x5a4fd6[_0xaa09('0x165')]){if(typeof _0x5a4fd6[_0xaa09('0x165')][_0x599a1f]!==_0xaa09('0x15a')){if(isNotNull(_0x5a4fd6[_0xaa09('0x165')][_0x599a1f])&&_0x599a1f!=='id'&&_0x599a1f!==_0xaa09('0x17c')&&_0x599a1f!=='createdAt'&&_0x599a1f!==_0xaa09('0x17d')){_0x32e014[util[_0xaa09('0x78')](_0xaa09('0x17e'),_0xaa09('0x17f'),_[_0xaa09('0x180')](_0x599a1f))]=_0x5a4fd6['Contact'][_0x599a1f];}}}var _0x20df7c=_0x59d295[_0xaa09('0x135')](_0x355cae[_0xaa09('0x72')])?getCallerId(_0x355cae[_0xaa09('0x72')][_0xaa09('0x74')],_0x355cae[_0xaa09('0x55')],_0x355cae['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x355cae[_0xaa09('0x56')],_0x355cae['dialRandomLastDigitCallerIdNumber']):_0x355cae[_0xaa09('0x56')]):getCallerId(_['isNil'](_0x355cae[_0xaa09('0x136')])?_0x355cae[_0xaa09('0x72')][_0xaa09('0x74')]:_0x355cae[_0xaa09('0x136')]['callerid'],_0x355cae['dialOriginateCallerIdName'],_0x355cae['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x355cae[_0xaa09('0x56')],_0x355cae[_0xaa09('0x181')]):_0x355cae[_0xaa09('0x56')]);if(_0x20df7c){_0x32e014[_0xaa09('0x182')]=_0x59d295['actions'][_0x526f89][_0xaa09('0x183')]=extractCalleridName(_0x20df7c);_0x32e014[_0xaa09('0x184')]=_0x59d295[_0xaa09('0x23')][_0x526f89]['originatecalleridnum']=extractCalleridNumber(_0x20df7c);}return ami[_0xaa09('0x146')]({'actionid':_0x526f89,'action':_0xaa09('0x164'),'channel':_0x59d295[_0xaa09('0x135')](_0x355cae[_0xaa09('0x72')])?util[_0xaa09('0x78')]('SIP/%s/%s%s',_0x355cae[_0xaa09('0x72')][_0xaa09('0x3d')],isNotNull(_0x355cae['dialPrefix'])?_0x355cae[_0xaa09('0x58')][_0xaa09('0x185')]()||'':'',_0x355cae[_0xaa09('0x186')]>0x0?_0x5a4fd6['Contact'][_0xaa09('0x187')][_0xaa09('0x188')](_0x355cae[_0xaa09('0x186')]):_0x5a4fd6[_0xaa09('0x165')][_0xaa09('0x187')]):util[_0xaa09('0x78')](_0xaa09('0x189'),_[_0xaa09('0xa5')](_0x355cae['TrunkBackup'])?_0x355cae['Trunk'][_0xaa09('0x3d')]:_0x355cae[_0xaa09('0x136')]['name'],isNotNull(_0x355cae[_0xaa09('0x58')])?_0x355cae[_0xaa09('0x58')][_0xaa09('0x185')]()||'':'',_0x355cae[_0xaa09('0x186')]>0x0?_0x5a4fd6[_0xaa09('0x165')][_0xaa09('0x187')][_0xaa09('0x188')](_0x355cae[_0xaa09('0x186')]):_0x5a4fd6[_0xaa09('0x165')][_0xaa09('0x187')]),'callerid':_0x20df7c,'Exten':_0xaa09('0xd5'),'Context':'from-sip','Priority':'1','variable':_0x32e014,'timeout':(_0x355cae[_0xaa09('0x57')]||0x1e)*0x3e8,'async':!![],'channelid':_0x526f89})[_0xaa09('0xb1')](function(_0x4d544d){return _0x3f8500(_0x4d544d);})['catch'](function(_0x394ade){_0x355cae[_0xaa09('0x60')]+=0x1;var _0xf40db5=new History(_0x59d295['actions'][_0x526f89]);logger[_0xaa09('0x90')](util['format'](_0xaa09('0x18a'),JSON['stringify'](_0x394ade)));_0xf40db5[_0xaa09('0x9e')]=0xe;_0xf40db5['statedesc']=_0xaa09('0x18b');_0xf40db5[_0xaa09('0xa1')]=moment()['format'](_0xaa09('0xf2'));_0xf40db5[_0xaa09('0xa0')]=_0xf40db5[_0xaa09('0xa1')];_0x59d295['createHistory'](_0xf40db5)['catch'](loggerCatch(_0xaa09('0x18c')));_0x59d295[_0xaa09('0xbd')](_0xf40db5)[_0xaa09('0xa6')](loggerCatch(_0xaa09('0x18c')))['finally'](function(){delete _0x59d295[_0xaa09('0x23')][_0x526f89];return _0x17524a(msgResponse(_0xaa09('0x164'),_0xaa09('0x18d'),_0xaa09('0x18e')));});});});};Dialer['prototype'][_0xaa09('0x18f')]=function(_0x1b5029){var _0x417dd8=this[_0xaa09('0x23')][_0x1b5029['actionid']];if(_0x417dd8){delete this['actions'][_0x1b5029['actionid']];_0x417dd8['responsetime']=moment()[_0xaa09('0x78')](_0xaa09('0xf2'));var _0x355e87=_0x417dd8[_0xaa09('0x48')]===_0xaa09('0x77')?this[_0xaa09('0xaa')][_0x417dd8[_0xaa09('0xa8')]]:this['voiceQueues'][_0x417dd8[_0xaa09('0x190')]()];if(!this[_0xaa09('0xcc')](_0x1b5029['response'])){this[_0xaa09('0xc0')](_0x355e87);return this[_0xaa09('0x191')](_0x417dd8,_0x355e87,_0x1b5029)[_0xaa09('0xa6')](loggerCatch(_0xaa09('0x192')));}this[_0xaa09('0x24')][_0x1b5029[_0xaa09('0xd2')]]=_0x417dd8;}};Dialer[_0xaa09('0x1b')][_0xaa09('0x193')]=function(_0x3215e8,_0x22f38f,_0x50bc8a){var _0x1dcba0=new History(_0x22f38f);if(_0x1dcba0[_0xaa09('0xe6')]+_0x1dcba0[_0xaa09('0xe7')]+_0x1dcba0[_0xaa09('0xe8')]+_0x1dcba0[_0xaa09('0xf8')]+_0x1dcba0[_0xaa09('0xe9')]+_0x1dcba0[_0xaa09('0xf9')]+_0x1dcba0[_0xaa09('0xe4')]+_0x1dcba0[_0xaa09('0xea')]>=_0x50bc8a[_0xaa09('0x194')]-0x1){return!![];}switch(_0x3215e8){case 0x3:if(_0x1dcba0[_0xaa09('0xe8')]>=_0x50bc8a['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0xaa09('0xb5')]({'active':![],'countnoanswerretry':_0x1dcba0['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xaa09('0xef')](_0x50bc8a['dialNoAnswerRetryFrequency'],_0xaa09('0xf1'))[_0xaa09('0x78')](_0xaa09('0xf2')),'ContactId':_0x1dcba0[_0xaa09('0xc6')],'ListId':_0x1dcba0[_0xaa09('0xc7')],'VoiceQueueId':_0x1dcba0[_0xaa09('0xf3')]||undefined,'CampaignId':_0x1dcba0[_0xaa09('0xc9')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x1dcba0[_0xaa09('0xe6')]>=_0x50bc8a['dialBusyMaxRetry']-0x1){return!![];}this[_0xaa09('0xb5')]({'active':![],'countbusyretry':_0x1dcba0[_0xaa09('0xe6')]+=0x1,'scheduledat':moment()['add'](_0x50bc8a['dialBusyRetryFrequency'],_0xaa09('0xf1'))[_0xaa09('0x78')](_0xaa09('0xf2')),'ContactId':_0x1dcba0['ContactId'],'ListId':_0x1dcba0[_0xaa09('0xc7')],'VoiceQueueId':_0x1dcba0[_0xaa09('0xf3')]||undefined,'CampaignId':_0x1dcba0[_0xaa09('0xc9')]||undefined})['catch'](loggerCatch(_0xaa09('0x195')));break;case 0x8:if(_0x1dcba0[_0xaa09('0xe7')]>=_0x50bc8a[_0xaa09('0x196')]-0x1){return!![];}this[_0xaa09('0xb5')]({'active':![],'countcongestionretry':_0x1dcba0[_0xaa09('0xe7')]+=0x1,'scheduledat':moment()[_0xaa09('0xef')](_0x50bc8a[_0xaa09('0x197')],_0xaa09('0xf1'))[_0xaa09('0x78')](_0xaa09('0xf2')),'ContactId':_0x1dcba0['ContactId'],'ListId':_0x1dcba0[_0xaa09('0xc7')],'VoiceQueueId':_0x1dcba0[_0xaa09('0xf3')]||undefined,'CampaignId':_0x1dcba0['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x1dcba0[_0xaa09('0xf8')]>=_0x50bc8a['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xaa09('0xb5')]({'active':![],'countnosuchnumberretry':_0x1dcba0[_0xaa09('0xf8')]+=0x1,'scheduledat':moment()[_0xaa09('0xef')](_0x50bc8a['dialNoSuchNumberRetryFrequency'],_0xaa09('0xf1'))[_0xaa09('0x78')](_0xaa09('0xf2')),'ContactId':_0x1dcba0[_0xaa09('0xc6')],'ListId':_0x1dcba0['ListId'],'VoiceQueueId':_0x1dcba0[_0xaa09('0xf3')]||undefined,'CampaignId':_0x1dcba0['CampaignId']||undefined})[_0xaa09('0xa6')](loggerCatch(_0xaa09('0x198')));}break;case 0xa:if(_0x1dcba0[_0xaa09('0xe9')]>=_0x50bc8a[_0xaa09('0x10d')]-0x1){return!![];}this[_0xaa09('0xb5')]({'active':![],'countdropretry':_0x1dcba0[_0xaa09('0xe9')]+=0x1,'scheduledat':moment()[_0xaa09('0xef')](_0x50bc8a[_0xaa09('0x10e')],'minutes')[_0xaa09('0x78')](_0xaa09('0xf2')),'ContactId':_0x1dcba0[_0xaa09('0xc6')],'ListId':_0x1dcba0['ListId'],'VoiceQueueId':_0x1dcba0[_0xaa09('0xf3')]||undefined,'CampaignId':_0x1dcba0[_0xaa09('0xc9')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x1dcba0[_0xaa09('0xf9')]>=_0x50bc8a[_0xaa09('0x116')]-0x1){return!![];}this[_0xaa09('0xb5')]({'active':![],'countabandonedretry':_0x1dcba0[_0xaa09('0xf9')]+=0x1,'scheduledat':moment()[_0xaa09('0xef')](_0x50bc8a[_0xaa09('0x117')],_0xaa09('0xf1'))[_0xaa09('0x78')](_0xaa09('0xf2')),'ContactId':_0x1dcba0[_0xaa09('0xc6')],'ListId':_0x1dcba0[_0xaa09('0xc7')],'VoiceQueueId':_0x1dcba0[_0xaa09('0xf3')]||undefined,'CampaignId':_0x1dcba0[_0xaa09('0xc9')]||undefined})['catch'](loggerCatch(_0xaa09('0x118')));break;case 0x13:if(_0x1dcba0[_0xaa09('0xe4')]>=_0x50bc8a[_0xaa09('0xed')]-0x1){return!![];}this[_0xaa09('0xb5')]({'active':![],'countmachineretry':_0x1dcba0[_0xaa09('0xe4')]+=0x1,'scheduledat':moment()[_0xaa09('0xef')](_0x50bc8a['dialMachineRetryFrequency'],'minutes')[_0xaa09('0x78')](_0xaa09('0xf2')),'ContactId':_0x1dcba0[_0xaa09('0xc6')],'ListId':_0x1dcba0[_0xaa09('0xc7')],'VoiceQueueId':_0x1dcba0[_0xaa09('0xf3')]||undefined,'CampaignId':_0x1dcba0['CampaignId']||undefined})[_0xaa09('0xa6')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x1dcba0[_0xaa09('0xea')]>=_0x50bc8a[_0xaa09('0x199')]-0x1){return!![];}this[_0xaa09('0xb5')]({'active':![],'countagentrejectretry':_0x1dcba0['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xaa09('0xef')](_0x50bc8a[_0xaa09('0x19a')],_0xaa09('0xf1'))[_0xaa09('0x78')](_0xaa09('0xf2')),'ContactId':_0x1dcba0[_0xaa09('0xc6')],'ListId':_0x1dcba0[_0xaa09('0xc7')],'VoiceQueueId':_0x1dcba0[_0xaa09('0xf3')]||undefined,'CampaignId':_0x1dcba0['CampaignId']||undefined})[_0xaa09('0xa6')](loggerCatch(_0xaa09('0x19b')));break;default:return!![];}};Dialer[_0xaa09('0x1b')][_0xaa09('0x191')]=function(_0x5344fd,_0xda4e5c,_0x627321){var _0x19d6d1=this;var _0x5b201e=new History(_0x5344fd);return new BPromise(function(_0xa99235,_0x5a2430){if(_[_0xaa09('0x38')](_0xda4e5c)&&typeof _0xda4e5c!==_0xaa09('0x163')){return _0x5a2430(msgResponse(_0xaa09('0x19c'),_0xaa09('0x13c'),'entity\x20is\x20undefine'));}if(_[_0xaa09('0x38')](_0x627321)&&typeof _0x627321!==_0xaa09('0x163')){return _0x5a2430(msgResponse(_0xaa09('0x19c'),_0xaa09('0x13c'),_0xaa09('0x19d')));}switch(_0x627321[_0xaa09('0x101')]){case'0':_0xda4e5c[_0xaa09('0x5f')]+=0x1;_0x5b201e[_0xaa09('0x9e')]=0x0;_0x5b201e[_0xaa09('0x9f')]='NoSuchNumber';_0x5b201e[_0xaa09('0xf8')]+=0x1;_0x5b201e['countglobal']+=0x1;ami[_0xaa09('0xdd')](_0xaa09('0x19e'),ut[_0xaa09('0xdf')](_0x5344fd,_0xaa09('0x19f')));_0x19d6d1[_0xaa09('0xbf')](_0x5b201e)[_0xaa09('0xa6')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x19d6d1[_0xaa09('0x193')](0x0,_0x5344fd,_0xda4e5c)){if(_0x5b201e['countnosuchnumberretry']>=_0xda4e5c['dialNoSuchNumberMaxRetry']){_0x19d6d1[_0xaa09('0xee')](_0x5b201e,_0xa99235,_0x5a2430,_0xaa09('0x1a0'));}else{_0x19d6d1[_0xaa09('0xeb')](_0x5b201e,_0xa99235,_0x5a2430,_0xaa09('0x1a0'));}}break;case'3':_0xda4e5c[_0xaa09('0x5e')]+=0x1;_0x5b201e['state']=0x3;_0x5b201e['statedesc']='NoAnswer';_0x5b201e[_0xaa09('0xe8')]+=0x1;_0x5b201e['countglobal']+=0x1;ami[_0xaa09('0xdd')](_0xaa09('0x1a1'),ut[_0xaa09('0xdf')](_0x5344fd,_0xaa09('0x1a2')));_0x19d6d1['createHistory'](_0x5b201e)[_0xaa09('0xa6')](loggerCatch(_0xaa09('0x1a3')));if(_0x19d6d1[_0xaa09('0x193')](0x3,_0x5344fd,_0xda4e5c)){if(_0x5b201e[_0xaa09('0xe8')]>=_0xda4e5c['dialNoAnswerMaxRetry']){_0x19d6d1[_0xaa09('0xee')](_0x5b201e,_0xa99235,_0x5a2430,'reason\x203\x20ringing\x20no\x20answer');}else{_0x19d6d1[_0xaa09('0xeb')](_0x5b201e,_0xa99235,_0x5a2430,_0xaa09('0x1a4'));}}break;case'5':_0xda4e5c[_0xaa09('0x5a')]+=0x1;_0x5b201e['state']=0x5;_0x5b201e[_0xaa09('0x9f')]='Busy';_0x5b201e[_0xaa09('0xe6')]+=0x1;_0x5b201e[_0xaa09('0xe5')]+=0x1;ami[_0xaa09('0xdd')](_0xaa09('0x1a5'),ut[_0xaa09('0xdf')](_0x5344fd,'busy'));_0x19d6d1[_0xaa09('0xbf')](_0x5b201e)[_0xaa09('0xa6')](loggerCatch(_0xaa09('0x1a6')));if(_0x19d6d1[_0xaa09('0x193')](0x5,_0x5344fd,_0xda4e5c)){if(_0x5b201e[_0xaa09('0xe6')]>=_0xda4e5c[_0xaa09('0x1a7')]){_0x19d6d1[_0xaa09('0xee')](_0x5b201e,_0xa99235,_0x5a2430,'reason\x205\x20busy');}else{_0x19d6d1[_0xaa09('0xeb')](_0x5b201e,_0xa99235,_0x5a2430,_0xaa09('0x1a8'));}}break;case'8':_0xda4e5c['outboundCongestionCallsDay']+=0x1;_0x5b201e[_0xaa09('0x9e')]=0x8;_0x5b201e['statedesc']=_0xaa09('0x1a9');_0x5b201e[_0xaa09('0xe7')]+=0x1;_0x5b201e[_0xaa09('0xe5')]+=0x1;ami[_0xaa09('0xdd')](_0xaa09('0x1aa'),ut[_0xaa09('0xdf')](_0x5344fd,_0xaa09('0x1ab')));_0x19d6d1['createHistory'](_0x5b201e)[_0xaa09('0xa6')](loggerCatch(_0xaa09('0x1ac')));if(_0x19d6d1[_0xaa09('0x193')](0x8,_0x5344fd,_0xda4e5c)){if(_0x5b201e[_0xaa09('0xe7')]>=_0xda4e5c[_0xaa09('0x196')]){_0x19d6d1[_0xaa09('0xee')](_0x5b201e,_0xa99235,_0x5a2430,'reason\x208\x20congestion');}else{_0x19d6d1[_0xaa09('0xeb')](_0x5b201e,_0xa99235,_0x5a2430,_0xaa09('0x1ad'));}}break;case'11':_0xda4e5c[_0xaa09('0x1ae')]+=0x1;_0x5b201e[_0xaa09('0x9e')]=0xb;_0x5b201e[_0xaa09('0x9f')]=_0xaa09('0x114');_0x5b201e[_0xaa09('0xf9')]+=0x1;_0x5b201e[_0xaa09('0xe5')]+=0x1;_0x19d6d1[_0xaa09('0xbf')](_0x5b201e)['catch'](loggerCatch(_0xaa09('0x119')));if(_0x19d6d1[_0xaa09('0x193')](0xb,_0x5344fd,_0xda4e5c)){if(_0x5b201e['countabandonedretry']>=_0xda4e5c[_0xaa09('0x116')]){_0x19d6d1[_0xaa09('0xee')](_0x5b201e,_0xa99235,_0x5a2430,_0xaa09('0x1af'));}else{_0x19d6d1['stateGlobal'](_0x5b201e,_0xa99235,_0x5a2430,'reason\x2011\x20abandoned');}}break;case'20':_0xda4e5c['outboundRejectCallsDay']+=0x1;_0x5b201e['state']=0x14;_0x5b201e['statedesc']='AgentReject';_0x5b201e['countagentrejectretry']+=0x1;_0x5b201e[_0xaa09('0xe5')]+=0x1;ami[_0xaa09('0xdd')](_0xaa09('0x1b0'),ut[_0xaa09('0xdf')](_0x5344fd,'agentreject'));_0x19d6d1[_0xaa09('0xbf')](_0x5b201e)[_0xaa09('0xa6')](loggerCatch(_0xaa09('0x1b1')));if(_0x19d6d1[_0xaa09('0x193')](0x14,_0x5344fd,_0xda4e5c)){if(_0x5b201e[_0xaa09('0xea')]>=_0xda4e5c[_0xaa09('0x199')]){_0x19d6d1[_0xaa09('0xee')](_0x5b201e,_0xa99235,_0x5a2430,_0xaa09('0x1b2'));}else{_0x19d6d1[_0xaa09('0xeb')](_0x5b201e,_0xa99235,_0x5a2430,'reason\x2020\x20agentreject');}}break;default:_0xda4e5c[_0xaa09('0x62')]+=0x1;_0x5b201e[_0xaa09('0x9e')]=0xc;_0x5b201e['statedesc']=_0x627321[_0xaa09('0x101')];_0x19d6d1['createHistory'](_0x5b201e)[_0xaa09('0xa6')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x19d6d1['checkRetriveMax'](_0x627321['reason'],_0x5344fd,_0xda4e5c)){if(_0x5b201e[_0xaa09('0xe6')]+_0x5b201e[_0xaa09('0xe7')]+_0x5b201e[_0xaa09('0xe8')]+_0x5b201e[_0xaa09('0xf8')]+_0x5b201e['countdropretry']+_0x5b201e[_0xaa09('0xf9')]+_0x5b201e[_0xaa09('0xe4')]+_0x5b201e[_0xaa09('0xea')]>=_0xda4e5c[_0xaa09('0x194')]){_0x19d6d1[_0xaa09('0xeb')](_0x5b201e,_0xa99235,_0x5a2430,_0x627321[_0xaa09('0x101')]);}else{_0x19d6d1['createStateFinal'](_0x5b201e,_0xa99235,_0x5a2430,_0x627321[_0xaa09('0x101')]);}}}});};Dialer[_0xaa09('0x1b')]['stateGlobal']=function(_0x4c9660,_0x48069d,_0x130481,_0x48229e){var _0x1b7d70=new Final(_0x4c9660);_0x1b7d70[_0xaa09('0x9e')]=0xf;_0x1b7d70[_0xaa09('0x9f')]=_0xaa09('0x1b3');this[_0xaa09('0xee')](_0x1b7d70,_0x48069d,_0x130481,_0x48229e);};Dialer[_0xaa09('0x1b')][_0xaa09('0xee')]=function(_0x191a34,_0x2d5fed,_0x1f19e0,_0x2fd284){this['moveContactManagedDialer'](_0x191a34)['then'](function(){return _0x2d5fed(msgResponse(_0xaa09('0x19c'),_0xaa09('0xcd'),_0x2fd284));})[_0xaa09('0xa6')](function(){return _0x1f19e0(msgResponse('[moveContactManagedDialer][0]','Failure',_0xaa09('0x1b4')));});};Dialer[_0xaa09('0x1b')][_0xaa09('0x155')]=function(_0x232d78){var _0x55a14d=_0x232d78[_0xaa09('0x1b5')]/0x64;var _0x579932=_0x232d78['outboundDropCallsDayTimeout']/(_0x232d78['outboundDropCallsDayTimeout']+_0x232d78[_0xaa09('0x59')]);var _0x23f938=Math[_0xaa09('0x1b6')](_0x232d78['predictiveIntervalAvailable']*(_0x232d78[_0xaa09('0x1b7')]/0x64));var _0x13617f=Math[_0xaa09('0x1b6')](_0x232d78[_0xaa09('0x6a')]*(_0x232d78[_0xaa09('0x1b8')]/0x64));var _0x5e996a=_0x232d78[_0xaa09('0x98')]+_0x232d78[_0xaa09('0x50')];var _0x2ffc78=Math[_0xaa09('0x1b9')](_0x232d78[_0xaa09('0x6d')]*_0x232d78['erlangAbandonmentRate']*_0x232d78[_0xaa09('0x68')]*_0x232d78[_0xaa09('0x69')]);if(_[_0xaa09('0x38')](_0x232d78['startProgressive'])){if(!_[_0xaa09('0x38')](_0x232d78['startPredictive'])){_0x232d78[_0xaa09('0x26')]=undefined;loggerPredictive[_0xaa09('0x90')](_0xaa09('0x1ba'),_0xaa09('0x1bb'));}if(!_[_0xaa09('0x38')](_0x232d78['handlePredictive'])){loggerPredictive['error'](_0xaa09('0x1ba'),_0xaa09('0x1bc'));clearInterval(_0x232d78[_0xaa09('0x8b')]);_0x232d78['handlePredictive']=undefined;}_0x232d78[_0xaa09('0x71')]=moment()[_0xaa09('0x78')](_0xaa09('0xf2'));loggerPredictive[_0xaa09('0x7a')](_0x232d78[_0xaa09('0x3d')],'collection\x20data\x20in\x20progressive\x20at',_0x232d78['startProgressive']);this[_0xaa09('0x1bd')](_0x232d78,0x1);}else if(ifInterval(_0x232d78[_0xaa09('0x1be')],_0x232d78['startProgressive'])){this[_0xaa09('0x1bd')](_0x232d78,0x1);loggerPredictiveCalls[_0xaa09('0x7a')](_0xaa09('0x1bf'),_0x232d78[_0xaa09('0x71')],_0x232d78[_0xaa09('0x3d')]);_0x232d78['erlangCalls']=0x0;_0x232d78['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x55a14d<_0x579932&&_0x232d78['dialPredictiveOptimization']===_0xaa09('0x1c0')){freeVariablesPredictive(_0x232d78);loggerPredictive['info'](_0xaa09('0x1c1'),_0xaa09('0x1c2'),_0x579932,_0xaa09('0x71'),_0x232d78['name']);}else if(_0x2ffc78<_0x232d78[_0xaa09('0x67')]&&_0x232d78['dialPredictiveOptimization']===_0xaa09('0x1c0')){freeVariablesPredictive(_0x232d78);loggerPredictive[_0xaa09('0x7a')](_0xaa09('0x1c3'),_0xaa09('0x1c4'),_0x2ffc78,_0xaa09('0x1c5'),_0x232d78[_0xaa09('0x67')],_0xaa09('0x71'),_0x232d78[_0xaa09('0x3d')]);}else if(!ifInterval(_0x232d78[_0xaa09('0x1be')],_0x232d78[_0xaa09('0x71')])&&_[_0xaa09('0x38')](_0x232d78['startPredictive'])&&!_[_0xaa09('0x38')](_0x232d78['startProgressive'])){_0x232d78[_0xaa09('0x26')]=moment()[_0xaa09('0x78')](_0xaa09('0xf2'));loggerPredictive[_0xaa09('0x7a')](_0x232d78[_0xaa09('0x3d')],_0xaa09('0x1c6'),_0x232d78[_0xaa09('0x26')]);this[_0xaa09('0xb2')](_0x232d78['dialPredictiveInterval'])['then'](this[_0xaa09('0x1c7')](_0x232d78))['then'](mergeDataErlangB(_0x232d78))[_0xaa09('0xb1')](this['startMethodPredictive'](_0x232d78))[_0xaa09('0xa6')](loggerCatchPredictive(_0xaa09('0x1c8'),_0x232d78));}else if(!ifInterval(_0x232d78['dialPredictiveInterval'],_0x232d78['startPredictive'])){_0x232d78[_0xaa09('0x67')]=0x0;_0x232d78['startPredictive']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x232d78['name'],_0xaa09('0x1c9'),_0x232d78[_0xaa09('0x26')]);clearInterval(_0x232d78[_0xaa09('0x8b')]);_0x232d78[_0xaa09('0x8b')]=undefined;this[_0xaa09('0xb2')](_0x232d78[_0xaa09('0x1be')])['then'](this[_0xaa09('0x1c7')](_0x232d78))['then'](mergeDataErlangB(_0x232d78))[_0xaa09('0xb1')](this['startMethodPredictive'](_0x232d78))['catch'](loggerCatchPredictive(_0xaa09('0x1ca'),_0x232d78));}else if(_0x232d78[_0xaa09('0x6a')]&&_0x5e996a<_0x232d78[_0xaa09('0x6a')]-_0x13617f){freeVariablesPredictive(_0x232d78);loggerPredictive['info'](_0x232d78[_0xaa09('0x3d')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x5e996a,_0xaa09('0x1cb'),_0x232d78[_0xaa09('0x6a')],'-',_0x13617f,'=',_0x232d78[_0xaa09('0x6a')]-_0x13617f,')');}else if(_0x232d78['predictiveIntervalAvailable']&&_0x5e996a>_0x232d78[_0xaa09('0x6a')]+_0x23f938){freeVariablesPredictive(_0x232d78);loggerPredictive[_0xaa09('0x7a')](_0x232d78[_0xaa09('0x3d')],_0xaa09('0x1cc'),_0x5e996a,_0xaa09('0x1cd'),_0x232d78[_0xaa09('0x6a')],'+',_0x23f938,'=',_0x232d78[_0xaa09('0x6a')]+_0x23f938,')');}};Dialer[_0xaa09('0x1b')][_0xaa09('0x1c7')]=function(_0x1539f9){var _0x3cb943=this;return function(_0x432f08){return new BPromise(function(_0x535780,_0x125a02){_['merge'](_0x1539f9,_0x432f08[0x0]);if(checkGetDataPredictive(_0x432f08[0x0])){var _0x3597b1=_0x1539f9[_0xaa09('0x6a')]=_0x1539f9['talking']+_0x1539f9['available'];var _0x302644=_0x1539f9['dialPredictiveInterval']*0x3c;var _0xa50283=_0x432f08[0x0][_0xaa09('0x65')]+_0x432f08[0x0][_0xaa09('0x64')];var _0x3986e6=(_0x432f08[0x0][_0xaa09('0x63')]+_0x432f08[0x0][_0xaa09('0x7d')]+_0x432f08[0x0][_0xaa09('0x113')])/_0x432f08[0x0]['predictiveIntervalTotalCalls'];_0x1539f9[_0xaa09('0x68')]=_0x3986e6>0x0?_0x3986e6:0x1;switch(_0x1539f9[_0xaa09('0x1ce')]){case _0xaa09('0x1c0'):var _0x2dabd2=_0x1539f9[_0xaa09('0x1b5')]/0x64;return _0x3cb943[_0xaa09('0x1cf')](_0x3597b1,_0x302644,_0xa50283,_0x3986e6,_0x2dabd2)[_0xaa09('0xb1')](function(_0xc3909c){return _0x535780(_0xc3909c);});case _0xaa09('0x1d0'):var _0x3483cc=_0x1539f9['dialPredictiveOptimizationPercentage']/0x64;return _0x3cb943[_0xaa09('0x1d1')](_0x3597b1,_0x302644,_0xa50283,_0x3986e6,_0x3483cc)[_0xaa09('0xb1')](function(_0x18b837){return _0x535780(_0x18b837);});default:return _0x125a02(msgResponse(_0xaa09('0x1d2'),_0xaa09('0x13c'),'Unknown\x20Predictive'));}}else{return _0x125a02(msgResponse(_0xaa09('0x1d2'),_0xaa09('0x13c'),'check\x20failure'));}});};};Dialer[_0xaa09('0x1b')][_0xaa09('0x1d3')]=function(_0x128332){var _0xdade7b=this;return function(_0x33183c){return new BPromise(function(_0x38c1e2,_0x2b7883){_['merge'](_0x128332,_0x33183c[0x0]);if(checkGetDataPredictive(_0x33183c[0x0])){loggerPredictive[_0xaa09('0x7a')](JSON[_0xaa09('0x44')](_0x33183c[0x0]));if(_0x128332[_0xaa09('0x1ce')]===_0xaa09('0x1c0')){return _0xdade7b[_0xaa09('0xbb')](_0x128332['id'])[_0xaa09('0xb1')](function(_0x7dd850){var _0x58595f=_0x128332[_0xaa09('0x4b')]-_0x7dd850[0x0][_0xaa09('0x1d4')];var _0x185f9b=_0x128332[_0xaa09('0x1be')]*0x3c;var _0x41c970=_0x33183c[0x0][_0xaa09('0x65')]+_0x33183c[0x0][_0xaa09('0x64')];var _0x14bf33=(_0x33183c[0x0]['predictiveIntervalAnsweredCalls']+_0x33183c[0x0][_0xaa09('0x7d')]+_0x33183c[0x0][_0xaa09('0x113')])/_0x33183c[0x0][_0xaa09('0x6b')];var _0x2e8b7d=_0x128332[_0xaa09('0x1b5')]/0x64;_0x128332['predictiveIntervalPauses']=_0x7dd850[0x0][_0xaa09('0x1d4')]||0x0;_0x128332['predictiveIntervalHitRate']=_0x14bf33>0x0?_0x14bf33:0x1;return _0xdade7b[_0xaa09('0x1cf')](_0x58595f,_0x185f9b,_0x41c970,_0x14bf33,_0x2e8b7d);})['then'](function(_0x2df340){return _0x38c1e2(_0x2df340);})[_0xaa09('0xa6')](function(_0x2fbfd0){return _0x2b7883(msgResponse(_0xaa09('0x1d5'),_0xaa09('0x13c'),JSON[_0xaa09('0x44')](_0x2fbfd0)));});}if(_0x128332[_0xaa09('0x1ce')]===_0xaa09('0x1d0')){return _0xdade7b['getVoiceQueueRtPauses'](_0x128332['id'])[_0xaa09('0xb1')](function(_0x22d209){var _0x3f3e7a=_0x128332[_0xaa09('0x4b')]-_0x22d209[0x0][_0xaa09('0x1d4')];var _0x23458d=_0x128332[_0xaa09('0x1be')]*0x3c;var _0x4a8afc=_0x33183c[0x0][_0xaa09('0x65')]+_0x33183c[0x0][_0xaa09('0x64')];var _0x34ec8a=(_0x33183c[0x0][_0xaa09('0x63')]+_0x33183c[0x0][_0xaa09('0x7d')]+_0x33183c[0x0][_0xaa09('0x113')])/_0x33183c[0x0][_0xaa09('0x6b')];var _0x449586=_0x128332[_0xaa09('0x1b5')]/0x64;_0x128332[_0xaa09('0x1d6')]=_0x22d209[0x0][_0xaa09('0x1d4')]||0x0;_0x128332[_0xaa09('0x68')]=_0x34ec8a>0x0?_0x34ec8a:0x1;return _0xdade7b['busyFactor'](_0x3f3e7a,_0x23458d,_0x4a8afc,_0x34ec8a,_0x449586);})[_0xaa09('0xb1')](function(_0x5af595){return _0x38c1e2(_0x5af595);})[_0xaa09('0xa6')](function(_0x42e318){return _0x2b7883(msgResponse(_0xaa09('0x1d5'),_0xaa09('0x13c'),JSON['stringify'](_0x42e318)));});}}else{return _0x2b7883(msgResponse(_0xaa09('0x1d2'),_0xaa09('0x13c'),_0xaa09('0x1d7')));}});};};Dialer[_0xaa09('0x1b')]['startMethodPredictive']=function(_0x3158e3){var _0x583dde=this;return function(){var _0x351c2f=0x0;var _0x1e9b3d=Math[_0xaa09('0x1b9')](_0x3158e3[_0xaa09('0x6e')]*0x3e8);if(_0x1e9b3d>0x0){_0x1e9b3d=_0x1e9b3d<0x64?0x64:_0x1e9b3d;loggerPredictive[_0xaa09('0x7a')](_0x3158e3[_0xaa09('0x3d')],'one\x20call\x20every:',_0x1e9b3d,_0xaa09('0x45'));_0x3158e3['handlePredictive']=setInterval(function(){_0x583dde[_0xaa09('0x8b')](_0x3158e3);loggerPredictiveCalls[_0xaa09('0x7a')](_0xaa09('0x1d8'),_0x351c2f+=0x1);},_0x1e9b3d);}else{loggerPredictive[_0xaa09('0x7a')](_0x3158e3[_0xaa09('0x3d')],_0xaa09('0x1d9'));}};};Dialer[_0xaa09('0x1b')]['checkContactBlack']=function(_0x4dd894,_0xe5de06){var _0x39c17f=this;return function(_0x3083b1){if(_['isEmpty'](_0x3083b1)){if(_[_0xaa09('0xa5')](_0xe5de06['UserId'])||!_0xe5de06['recallme']){if(_0x4dd894[_0xaa09('0x151')]==='booked'){_0x4dd894[_0xaa09('0x123')]=_[_0xaa09('0x38')](_0x4dd894['queueStatusComplete'])?!![]:_0x4dd894['queueStatusComplete'];var _0x154b92=uuid['v4']();_0x39c17f[_0xaa09('0x23')][_0x154b92]=new Action(_0x4dd894,_0xe5de06,_0x154b92);loggerBooked['info'](_0xaa09('0x1da'),_0x154b92,_0xaa09('0x1db'),JSON[_0xaa09('0x44')](_0x4dd894[_0xaa09('0x123')]),_0xaa09('0x1dc'),_0x4dd894[_0xaa09('0x3d')]);if(_0x4dd894[_0xaa09('0x123')]){_0x4dd894[_0xaa09('0x123')]=![];_0x39c17f[_0xaa09('0x28')][_0x39c17f[_0xaa09('0x23')][_0x154b92][_0xaa09('0xa8')]]=[];ami[_0xaa09('0x146')]({'actionid':_0x154b92,'action':_0xaa09('0x1dd'),'queue':_0x4dd894[_0xaa09('0x3d')]})[_0xaa09('0xa6')](function(){_0x39c17f['updateOriginated'](_0x4dd894);_0x39c17f[_0xaa09('0xb5')]({'active':![],'ContactId':_0x39c17f['actions'][_0x154b92][_0xaa09('0xc6')],'ListId':_0x39c17f[_0xaa09('0x23')][_0x154b92][_0xaa09('0xc7')],'VoiceQueueId':_0x39c17f['actions'][_0x154b92][_0xaa09('0xf3')]||undefined,'CampaignId':_0x39c17f[_0xaa09('0x23')][_0x154b92][_0xaa09('0xc9')]||undefined})[_0xaa09('0xa6')](loggerCatch(_0xaa09('0x1de')));delete _0x39c17f[_0xaa09('0x23')][_0x154b92];});}else{loggerBooked[_0xaa09('0x7a')](_0xaa09('0x1df'),JSON[_0xaa09('0x44')](_0x4dd894['queueStatusComplete']),_0xaa09('0x1dc'),_0x4dd894[_0xaa09('0x3d')]);_0x39c17f[_0xaa09('0xc0')](_0x4dd894);_0x39c17f['rescheduleContact']({'active':![],'ContactId':_0x39c17f['actions'][_0x154b92][_0xaa09('0xc6')],'ListId':_0x39c17f[_0xaa09('0x23')][_0x154b92][_0xaa09('0xc7')],'VoiceQueueId':_0x39c17f[_0xaa09('0x23')][_0x154b92][_0xaa09('0xf3')]||undefined,'CampaignId':_0x39c17f[_0xaa09('0x23')][_0x154b92][_0xaa09('0xc9')]||undefined})[_0xaa09('0xa6')](loggerCatch(_0xaa09('0x1de')));delete _0x39c17f[_0xaa09('0x23')][_0x154b92];}}else{return _0x39c17f[_0xaa09('0x162')](_0x4dd894,_0xe5de06);}}else{if(getDiff(_0xe5de06[_0xaa09('0x1e0')])<_0x4dd894['dialRecallMeTimeout']*0x3c){if(_0xe5de06['Agent']&&!_0xe5de06[_0xaa09('0x1e1')]['voicePause']){_0x39c17f[_0xaa09('0x8d')][_0xaa09('0x12c')](_0xe5de06['id'])[_0xaa09('0x1d')](function(){_0x39c17f[_0xaa09('0xc0')](_0x4dd894);});}else{_0x39c17f[_0xaa09('0xb7')]({'active':![]},_0xe5de06['id'],0x1)['finally'](function(){_0x39c17f['updateOriginated'](_0x4dd894);});}}else{_0x4dd894[_0xaa09('0x61')]+=0x1;_0x39c17f[_0xaa09('0xc0')](_0x4dd894);if(_0x4dd894['dialRecallInQueue']){_0x39c17f[_0xaa09('0xb5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xe5de06[_0xaa09('0xc6')],'ListId':_0xe5de06[_0xaa09('0xc7')],'VoiceQueueId':_0xe5de06[_0xaa09('0xf3')]||undefined,'CampaignId':_0xe5de06[_0xaa09('0xc9')]||undefined})[_0xaa09('0xa6')](loggerCatch(_0xaa09('0x1e2')));_0x39c17f[_0xaa09('0xbf')](createObjHistory(_0x4dd894,_0xe5de06,_0xaa09('0x1e3'),0x17,_0xaa09('0x1e4')))[_0xaa09('0xa6')](loggerCatch(_0xaa09('0x1e5')));}else{_0x39c17f[_0xaa09('0xc4')](createObjHistory(_0x4dd894,_0xe5de06,'RECALLFAILEDTIMEOUT',0x16,_0xaa09('0x1e6')),_0xaa09('0x1e7'),_0xaa09('0x1e8'));}}}}else{_0x4dd894[_0xaa09('0x1e9')]+=0x1;_0x39c17f[_0xaa09('0xc4')](createObjHistory(_0x4dd894,_0xe5de06,_0xaa09('0x1ea'),0xd,_0xaa09('0x1eb')),_0xaa09('0x1ec'),_0xaa09('0x1ed'));throw _0xaa09('0x1ee');}};};Dialer[_0xaa09('0x1b')][_0xaa09('0x156')]=function(_0x1e9985){var _0x38285a=this;var _0x11bed6=_0x1e9985[_0xaa09('0x1ef')]-_0x1e9985['originated']-_0x1e9985['temp'];emitCampaignSummary(_0x1e9985);if(_0x11bed6>0x0){if(_0x11bed6>this[_0xaa09('0x21')]){_0x11bed6=this[_0xaa09('0x21')];}_0x1e9985[_0xaa09('0xba')]+=_0x11bed6;this[_0xaa09('0x1f0')](_0x1e9985['id'],_0x11bed6,_0x1e9985[_0xaa09('0x1f1')],_0x1e9985)['then'](function(_0x579193){_0x1e9985[_0xaa09('0xba')]-=_0x11bed6;_0x1e9985['temp']=_0x1e9985[_0xaa09('0xba')]>0x0?_0x1e9985[_0xaa09('0xba')]:0x0;if(!checkContactEmpty(_0x579193)){_0x1e9985[_0xaa09('0x39')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xaa09('0x7a')]('[getContactCampaign2][Empty]'+_0x1e9985[_0xaa09('0x3d')]);}else{_0x1e9985[_0xaa09('0x6c')]+=_0x579193[_0xaa09('0x92')];_0x1e9985[_0xaa09('0x39')]=_0xaa09('0x1f2');for(var _0x12e07a=0x0;_0x12e07a<_0x579193[_0xaa09('0x92')];_0x12e07a+=0x1){_0x1e9985['ivrTotalCallsDays']+=0x1;if(_[_0xaa09('0xa5')](_0x579193[_0x12e07a])||_[_0xaa09('0xa5')](_0x579193[_0x12e07a]['Contact'])||_['isNil'](_0x579193[_0x12e07a][_0xaa09('0x165')]['phone'])){_0x38285a[_0xaa09('0xc3')](_0xaa09('0x1f3'),_0x1e9985,_0x579193[_0x12e07a]);}else{_0x38285a[_0xaa09('0xb0')](_[_0xaa09('0xc5')](_0x579193[_0x12e07a],[_0xaa09('0xc9'),'Contact.phone']))[_0xaa09('0xb1')](_0x38285a[_0xaa09('0x1f4')](_0x1e9985,_0x579193[_0x12e07a]))[_0xaa09('0xa6')](_0x38285a[_0xaa09('0xc2')](_0xaa09('0x1f5'),_0x1e9985));}}}})['catch'](loggerGetContactDialer(_0xaa09('0x1f6'),_0x1e9985,_0x11bed6));}};Dialer[_0xaa09('0x1b')]['handlePower']=function(_0x3c7625,_0x379f1d){var _0x1e2db7=this;var _0x2985f5=[];var _0x100a49=_0x379f1d>=0x1?_0x379f1d:0x1;if(_0x3c7625[_0xaa09('0x151')]===_0xaa09('0x9')){_0x100a49=0x1;}var _0x4ec937=Math[_0xaa09('0x1b9')](_0x3c7625[_0xaa09('0x98')]*_0x100a49)-_0x3c7625['originated']-_0x3c7625[_0xaa09('0xba')];emitVoiceQueueSummary(_0x3c7625);if(_0x3c7625[_0xaa09('0x1f7')]>0x0){var _0x3aaa64=_0x3c7625[_0xaa09('0x1f7')]-_0x3c7625[_0xaa09('0x6c')]-_0x3c7625[_0xaa09('0x50')]-_0x3c7625['temp']-_0x3c7625[_0xaa09('0x4c')];if(_0x4ec937>_0x3aaa64){_0x4ec937=_0x3aaa64;}}if(_0x4ec937>0x0){if(_0x3c7625[_0xaa09('0x151')]===_0xaa09('0x9')){_0x4ec937=0x1;}if(_0x4ec937>this[_0xaa09('0x21')]){_0x4ec937=this['maxNumberOriginate'];}_0x3c7625['temp']+=_0x4ec937;for(var _0x2a7df1 in this[_0xaa09('0x20')]){if(typeof this[_0xaa09('0x20')][_0x2a7df1]!==_0xaa09('0x15a')){if(this['agents'][_0x2a7df1]['state']==='not_inuse'&&this[_0xaa09('0x20')][_0x2a7df1][_0xaa09('0xd0')]===_0xaa09('0x1f8')){_0x2985f5['push'](this['agents'][_0x2a7df1]['id']);}}}this[_0xaa09('0xb9')](_0x3c7625['id'],_0x2985f5,_0x4ec937,_0x3c7625[_0xaa09('0x1f1')],_0x3c7625)[_0xaa09('0xb1')](function(_0x127baf){_0x3c7625[_0xaa09('0xba')]-=_0x4ec937;_0x3c7625[_0xaa09('0xba')]=_0x3c7625[_0xaa09('0xba')]>0x0?_0x3c7625[_0xaa09('0xba')]:0x0;if(!checkContactEmpty(_0x127baf)){_0x1e2db7['countReScheduled'](_0x3c7625)[_0xaa09('0xb1')](sendMessageReschedule(_0x3c7625))[_0xaa09('0xa6')](loggerCatch(_0xaa09('0x1f9')));}else{_0x3c7625[_0xaa09('0x6c')]+=_0x127baf[_0xaa09('0x92')];_0x3c7625[_0xaa09('0x39')]=_0x3c7625[_0xaa09('0x151')]==='booked'?'ACTIVE':_0xaa09('0x1f2');for(var _0x32ab23=0x0;_0x32ab23<_0x127baf[_0xaa09('0x92')];_0x32ab23+=0x1){if(_[_0xaa09('0xa5')](_0x127baf[_0x32ab23])||_[_0xaa09('0xa5')](_0x127baf[_0x32ab23][_0xaa09('0x165')])||_[_0xaa09('0xa5')](_0x127baf[_0x32ab23][_0xaa09('0x165')]['phone'])){_0x1e2db7[_0xaa09('0xc3')]('[actionOriginate]\x20',_0x3c7625,_0x127baf[_0x32ab23]);}else{_0x1e2db7[_0xaa09('0xae')](_['pick'](_0x127baf[_0x32ab23],['VoiceQueueId','Contact.phone']))[_0xaa09('0xb1')](_0x1e2db7[_0xaa09('0x1f4')](_0x3c7625,_0x127baf[_0x32ab23]))['catch'](_0x1e2db7[_0xaa09('0xc2')](_0xaa09('0x1f3'),_0x3c7625));}}}})[_0xaa09('0xa6')](loggerGetContactDialer('[getContactDialer2]',_0x3c7625,_0x4ec937));}};Dialer[_0xaa09('0x1b')][_0xaa09('0x8b')]=function(_0x32edc3){if(_0x32edc3[_0xaa09('0x1f7')]>0x0){var _0x5d0fff=_0x32edc3[_0xaa09('0x1f7')]-_0x32edc3[_0xaa09('0x6c')]-_0x32edc3[_0xaa09('0x50')];if(_0x5d0fff>0x0){this[_0xaa09('0x1fa')](_0x32edc3);}else{loggerPredictiveCalls[_0xaa09('0x7a')](_0xaa09('0x1fb'));}}else{this[_0xaa09('0x1fa')](_0x32edc3);}};Dialer[_0xaa09('0x1b')][_0xaa09('0x1fa')]=function(_0x35ae71){var _0x112b36=this;var _0x4c6994=[];_0x35ae71[_0xaa09('0x6c')]+=0x1;for(var _0xd72593 in this['agents']){if(typeof this['agents'][_0xd72593]!=='undefined'){if(this['agents'][_0xd72593]['state']==='not_inuse'&&this[_0xaa09('0x20')][_0xd72593][_0xaa09('0xd0')]==='reachable'){_0x4c6994['push'](this[_0xaa09('0x20')][_0xd72593]['id']);}}}this['getContactDialer'](_0x35ae71['id'],_0x4c6994,0x1,_0x35ae71[_0xaa09('0x1f1')],_0x35ae71)['then'](function(_0x294673){if(!checkContactEmpty(_0x294673)){checkContactLowerLimitOriginate(_0x35ae71,0x1,0x0);_0x112b36['countReScheduled'](_0x35ae71)[_0xaa09('0xb1')](sendMessageReschedule(_0x35ae71))[_0xaa09('0xa6')](loggerCatch(_0xaa09('0x1f9')));}else{_0x35ae71[_0xaa09('0x39')]='RUNNING';if(_[_0xaa09('0xa5')](_0x294673[0x0])||_[_0xaa09('0xa5')](_0x294673[0x0][_0xaa09('0x165')])||_[_0xaa09('0xa5')](_0x294673[0x0]['Contact']['phone'])){_0x112b36['emptyContact'](_0xaa09('0x1f3'),_0x35ae71,_0x294673[0x0]);}else{_0x112b36[_0xaa09('0xae')](_['pick'](_0x294673[0x0],['VoiceQueueId',_0xaa09('0x1fc')]))[_0xaa09('0xb1')](_0x112b36['checkContactBlack'](_0x35ae71,_0x294673[0x0]))['catch'](_0x112b36[_0xaa09('0xc2')]('[actionOriginatePredictive]\x20',_0x35ae71));}}})[_0xaa09('0xa6')](loggerGetContactDialer('[getContactDialerPredictive]',_0x35ae71,0x1));emitVoiceQueueSummary(_0x35ae71);};Dialer[_0xaa09('0x1b')][_0xaa09('0x1cf')]=function(_0x32279c,_0x2422cc,_0x368e93,_0x5c67fb,_0x31d0f2,_0x2de327){loggerPredictive[_0xaa09('0x7a')](_0xaa09('0x1fd'));loggerPredictive[_0xaa09('0x7a')]('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',_0x32279c);loggerPredictive[_0xaa09('0x7a')](_0xaa09('0x1fe'),_0x2422cc);loggerPredictive[_0xaa09('0x7a')](_0xaa09('0x1ff'),_0x368e93);loggerPredictive[_0xaa09('0x7a')](_0xaa09('0x200'),_0x5c67fb);loggerPredictive[_0xaa09('0x7a')](_0xaa09('0x201'),_0x31d0f2);loggerPredictive['info'](_0xaa09('0x80'));return new BPromise(function(_0xf629ae,_0x2b1064){if(_0x32279c<=0x0||isNaN(_0x32279c)){return _0x2b1064(msgResponse(_0xaa09('0x202'),_0xaa09('0x18d'),_0xaa09('0x203')+_0x32279c));}if(_0x368e93<=0x0||isNaN(_0x368e93)){return _0x2b1064(msgResponse(_0xaa09('0x202'),_0xaa09('0x18d'),_0xaa09('0x204')+_0x368e93));}if(_0x5c67fb<=0x0||isNaN(_0x5c67fb)){return _0x2b1064(msgResponse(_0xaa09('0x202'),_0xaa09('0x18d'),_0xaa09('0x205')+_0x5c67fb));}if(_0x2422cc<=0x0||isNaN(_0x2422cc)){return _0x2b1064(msgResponse(_0xaa09('0x202'),_0xaa09('0x18d'),_0xaa09('0x206')+_0x2422cc));}if(_0x31d0f2<=0x0||isNaN(_0x31d0f2)){return _0x2b1064(msgResponse(_0xaa09('0x202'),_0xaa09('0x18d'),_0xaa09('0x207')+_0x31d0f2));}_0x2de327=_0x2de327||0x0;var _0x269432=0x1/_0x368e93;var _0x113997=0x0;var _0x501a57=0x0;var _0x522013=0x0;var _0x213a60=0x0;for(var _0x5d5b6e=0x0;_0x522013<_0x31d0f2;_0x5d5b6e+=0x1){_0x501a57=_0x5d5b6e/_0x2422cc;_0x113997=(_0x5c67fb*_0x501a57+_0x2de327)/_0x269432;_0x522013=erlangb(_0x113997,_0x32279c);_0x213a60=_0x113997/_0x32279c*(0x1-erlangb(_0x113997,_0x32279c));}return _0xf629ae({'erlangCalls':_0x5d5b6e,'erlangCallToSecond':_0x2422cc/_0x5d5b6e,'erlangAbandonmentRate':_0x522013,'erlangBusyFactor':_0x213a60});});};Dialer[_0xaa09('0x1b')][_0xaa09('0x1d1')]=function(_0x5cdd83,_0x4b165d,_0x5c3c3b,_0xd77c5b,_0x4f1dcc,_0xa40669){loggerPredictive[_0xaa09('0x7a')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info'](_0xaa09('0x208'),_0x5cdd83);loggerPredictive[_0xaa09('0x7a')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4b165d);loggerPredictive['info'](_0xaa09('0x1ff'),_0x5c3c3b);loggerPredictive[_0xaa09('0x7a')](_0xaa09('0x200'),_0xd77c5b);loggerPredictive[_0xaa09('0x7a')](_0xaa09('0x209'),_0x4f1dcc);loggerPredictive[_0xaa09('0x7a')](_0xaa09('0x80'));return new BPromise(function(_0x5d5b0c,_0x4da9ed){if(_0x5cdd83<=0x0||isNaN(_0x5cdd83)){return _0x4da9ed(msgResponse('[busyFactor]',_0xaa09('0x18d'),_0xaa09('0x203')+_0x5cdd83));}if(_0x5c3c3b<=0x0||isNaN(_0x5c3c3b)){return _0x4da9ed(msgResponse(_0xaa09('0x20a'),_0xaa09('0x18d'),_0xaa09('0x204')+_0x5c3c3b));}if(_0xd77c5b<=0x0||isNaN(_0xd77c5b)){return _0x4da9ed(msgResponse(_0xaa09('0x20a'),_0xaa09('0x18d'),_0xaa09('0x205')+_0xd77c5b));}if(_0x4b165d<=0x0||isNaN(_0x4b165d)){return _0x4da9ed(msgResponse(_0xaa09('0x20a'),'Error',_0xaa09('0x206')+_0x4b165d));}if(_0x4f1dcc<=0x0||isNaN(_0x4f1dcc)){return _0x4da9ed(msgResponse(_0xaa09('0x20a'),'Error',_0xaa09('0x20b')+_0x4f1dcc));}_0xa40669=_0xa40669||0x0;var _0x17d548=0x1/_0x5c3c3b;var _0x250981=0x0;var _0x2fa89b=0x0;var _0x1ef495=0x0;var _0x31a67e=0x0;for(var _0x5d5e05=0x0;_0x31a67e<_0x4f1dcc;_0x5d5e05+=0x1){_0x2fa89b=_0x5d5e05/_0x4b165d;_0x250981=(_0xd77c5b*_0x2fa89b+_0xa40669)/_0x17d548;_0x1ef495=erlangb(_0x250981,_0x5cdd83);_0x31a67e=_0x250981/_0x5cdd83*(0x1-erlangb(_0x250981,_0x5cdd83));}return _0x5d5b0c({'erlangCalls':_0x5d5e05,'erlangCallToSecond':_0x4b165d/_0x5d5e05,'erlangAbandonmentRate':_0x1ef495,'erlangBusyFactor':_0x31a67e});});};module[_0xaa09('0x20c')]=Dialer; \ No newline at end of file +var _0x81fd=['strategy','answered','available','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','loggedInDb','dialActive','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','stringify','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','waiting','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','state','statedesc','starttime','loopClearZombieChannels','clearZombieChannels','enqueue','isNil','status','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','countReScheduled','then','[countReScheduled]\x20','checkIsBlackList','resolve','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','merge','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','outboundAnswerCallsDay','membername','AMD','emit','custom:amd','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','countglobal','buildObj','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','[rescheduleContact][Machine]','HangupInAMD','countbusyretry','stateGlobal','add','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','droptime','responsetime','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','endtime','calleridname','calleridnum','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','locked','paused','stateinterface','queueStatusComplete','[booked][unlockQueueStatus]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','push','Action','command','iftime\x20%s,%s','interval','content','true','indexOf','all','GLOBAL_INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','power','method\x20not\x20recognized','handleIvr','dialMethod','loggedIn','dialGlobalInterval','dialTimezone','launchHandleIvr','\x5cw{0,','pow','replace','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueTimeout','dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','OriginateError','[originate][error]','originate\x20action\x20Error','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialGlobalMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','averageHandleTime','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','erlangCallToSecond','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','ACTIVE','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','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]','m\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','booked','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','syncHangup','varset','syncVarSet','syncQueueMember','syncQueueStatusComplete','loopCampaigns','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','milliseconds','diff','seconds','type','outbound'];(function(_0x3cb003,_0x1518d9){var _0x105911=function(_0x4b9c39){while(--_0x4b9c39){_0x3cb003['push'](_0x3cb003['shift']());}};_0x105911(++_0x1518d9);}(_0x81fd,0x1cc));var _0xd81f=function(_0x59fa5c,_0x5457f6){_0x59fa5c=_0x59fa5c-0x0;var _0x5d9d46=_0x81fd[_0x59fa5c];return _0x5d9d46;};'use strict';var util=require(_0xd81f('0x0'));var _=require(_0xd81f('0x1'));var BPromise=require('bluebird');var uuid=require(_0xd81f('0x2'));var moment=require(_0xd81f('0x3'));var rr=require('rr');var md5=require(_0xd81f('0x4'));var Redis=require(_0xd81f('0x5'));var ut=require(_0xd81f('0x6'));var config=require(_0xd81f('0x7'));var logger=require('../../../config/logger')('dialer');var loggerBooked=require('../../../config/logger')(_0xd81f('0x8'));var loggerPredictive=require(_0xd81f('0x9'))(_0xd81f('0xa'));var loggerPredictiveCalls=require(_0xd81f('0x9'))(_0xd81f('0xb'));var loggerSyncQueueSummary=require(_0xd81f('0x9'))(_0xd81f('0xc'));var ami=require(_0xd81f('0xd'));config[_0xd81f('0xe')]=_[_0xd81f('0xf')](config[_0xd81f('0xe')],{'host':_0xd81f('0x10'),'port':0x18eb});var io=require(_0xd81f('0x11'))(new Redis(config[_0xd81f('0xe')]));var cmHopper=require(_0xd81f('0x12'));var cmHopperHistory=require(_0xd81f('0x13'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xd81f('0x14'));var Action=require(_0xd81f('0x15'));var History=require(_0xd81f('0x16'));var Final=require(_0xd81f('0x17'));var AgentComplete=require(_0xd81f('0x18'));var QueueCallerAbandon=require(_0xd81f('0x19'));var Hangup=require(_0xd81f('0x1a'));var ipAgi=process['env'][_0xd81f('0x1b')]||_0xd81f('0x1c');var strategy={'rrmemory':_0xd81f('0x1d'),'roundrobin':_0xd81f('0x1e')};var Sequence=function(){};Sequence[_0xd81f('0x1f')]['enqueue']=function(_0x396c1e){this[_0xd81f('0x20')]=this['tail']?this[_0xd81f('0x20')][_0xd81f('0x21')](_0x396c1e):_0x396c1e();};function Dialer(_0x544daa,_0x3ad6aa){this[_0xd81f('0x22')]=new Sequence();this['preview']=_0x3ad6aa;this[_0xd81f('0x23')]=_0x544daa[_0xd81f('0x23')];this[_0xd81f('0x24')]=_0x544daa[_0xd81f('0x24')];this[_0xd81f('0x25')]=_0x544daa['agents'];this['trunks']=_0x544daa[_0xd81f('0x26')];this[_0xd81f('0x27')]=config[_0xd81f('0x27')]||0x2;this[_0xd81f('0x28')]={};this[_0xd81f('0x29')]={};this[_0xd81f('0x2a')]={};this[_0xd81f('0x2b')]={};this[_0xd81f('0x2c')]={};this[_0xd81f('0x2d')]={};this[_0xd81f('0x2e')]={};this[_0xd81f('0x2f')]={};this[_0xd81f('0x30')]={};this[_0xd81f('0x31')]={};ami['on'](_0xd81f('0x32'),this[_0xd81f('0x33')][_0xd81f('0x34')](this));ami['on'](_0xd81f('0x35'),this[_0xd81f('0x36')][_0xd81f('0x34')](this));ami['on'](_0xd81f('0x37'),this[_0xd81f('0x38')][_0xd81f('0x34')](this));ami['on'](_0xd81f('0x39'),this[_0xd81f('0x3a')][_0xd81f('0x34')](this));ami['on']('custom:queuesummary',this[_0xd81f('0xc')][_0xd81f('0x34')](this));ami['on'](_0xd81f('0x3b'),this[_0xd81f('0x3c')][_0xd81f('0x34')](this));ami['on']('newexten',this['syncNewExten'][_0xd81f('0x34')](this));ami['on'](_0xd81f('0x3d'),this[_0xd81f('0x3e')][_0xd81f('0x34')](this));ami['on']('queuemember',this[_0xd81f('0x3f')][_0xd81f('0x34')](this));ami['on']('queuestatuscomplete',this[_0xd81f('0x40')][_0xd81f('0x34')](this));this[_0xd81f('0x41')]();this['loopClearZombieChannels']();}function isNotNull(_0x1c89b0){return _0x1c89b0!==null&&!_[_0xd81f('0x42')](_0x1c89b0);}function checkIsLoggedIn(_0x1bfa8a,_0x1d92f1){return function(){if(_0x1d92f1<=0x0){_0x1bfa8a[_0xd81f('0x43')]=_0xd81f('0x44');throw _0x1bfa8a[_0xd81f('0x45')]+_0xd81f('0x46');}};}function isActive(_0x4503fb){return _0x4503fb;}function checkIsActive(_0x35fd69,_0x1aacd0){return function(){if(!isActive(_0x1aacd0)){_0x35fd69['message']=_0xd81f('0x47');throw _0x35fd69[_0xd81f('0x45')]+_0xd81f('0x48');}};}function checkInterval(_0x23650a){return function(){if(!isNotNull(_0x23650a[_0xd81f('0x49')])){_0x23650a['message']=_0xd81f('0x4a');throw _0x23650a['name']+_0xd81f('0x4b');}if(!isNotNull(_0x23650a[_0xd81f('0x49')][_0xd81f('0x4c')])){_0x23650a[_0xd81f('0x43')]=_0xd81f('0x4a');throw _0x23650a[_0xd81f('0x45')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xd81f('0x4d')](_0x23650a['Interval'][_0xd81f('0x4c')]))){_0x23650a['message']=_0xd81f('0x4a');throw _0x23650a['name']+_0xd81f('0x4b');}};}function msgResponse(_0x482d45,_0x1497c1,_0x1bcee4){return{'action':_0x482d45,'response':_0x1497c1,'message':_0x1bcee4,'stack':_0x1bcee4};}function myreject(_0x5e4320){return function(_0x4cec8c){return _0x5e4320(msgResponse(_0xd81f('0x4e'),_0xd81f('0x4f'),JSON['stringify'](_0x4cec8c)));};}function getSeconds(_0x5aaeb9,_0x25ace5){var _0x15555c=moment(_0x5aaeb9)[_0xd81f('0x50')](0x0);var _0x325665=moment(_0x25ace5)[_0xd81f('0x50')](0x0);return _0x15555c[_0xd81f('0x51')](_0x325665,_0xd81f('0x52'));}function emit(_0x2766e5,_0xe07521,_0x50b5fa){io['to'](_0x2766e5)['emit'](_0xe07521,_0x50b5fa);}function emitVoiceQueueSummary(_0x2146d8){if(_0x2146d8[_0xd81f('0x53')]===_0xd81f('0x54')){var _0x4d9074={'id':_0x2146d8['id'],'name':_0x2146d8[_0xd81f('0x45')],'strategy':_0x2146d8[_0xd81f('0x55')],'answered':_0x2146d8[_0xd81f('0x56')],'available':_0x2146d8[_0xd81f('0x57')],'loggedIn':_0x2146d8['loggedIn'],'pTalking':_0x2146d8[_0xd81f('0x58')],'sumBillable':_0x2146d8[_0xd81f('0x59')],'sumDuration':_0x2146d8['sumDuration'],'sumHoldTime':_0x2146d8[_0xd81f('0x5a')]||0x0,'talking':_0x2146d8[_0xd81f('0x5b')],'total':_0x2146d8[_0xd81f('0x5c')],'type':_0x2146d8[_0xd81f('0x53')],'unmanaged':_0x2146d8[_0xd81f('0x5d')],'abandoned':_0x2146d8['abandoned'],'waiting':_0x2146d8['waiting'],'loggedInDb':_0x2146d8[_0xd81f('0x5e')],'dialActive':_0x2146d8[_0xd81f('0x5f')],'dialMethod':_0x2146d8['dialMethod'],'dialOriginateCallerIdName':_0x2146d8['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x2146d8[_0xd81f('0x60')],'dialOriginateTimeout':_0x2146d8[_0xd81f('0x61')],'dialPrefix':_0x2146d8[_0xd81f('0x62')],'outboundAnswerAgiCallsDay':_0x2146d8[_0xd81f('0x63')],'outboundAnswerCallsDay':_0x2146d8['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x2146d8[_0xd81f('0x64')],'outboundBusyCallsDay':_0x2146d8['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x2146d8[_0xd81f('0x65')],'outboundDropCallsDayACS':_0x2146d8[_0xd81f('0x66')],'outboundDropCallsDayCallersExit':_0x2146d8['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x2146d8[_0xd81f('0x67')],'outboundNoAnswerCallsDay':_0x2146d8[_0xd81f('0x68')],'outboundNoSuchCallsDay':_0x2146d8[_0xd81f('0x69')],'outboundOriginateFailureCallsDay':_0x2146d8[_0xd81f('0x6a')],'outboundReCallsDay':_0x2146d8['outboundReCallsDay'],'outboundRejectCallsDay':_0x2146d8['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x2146d8[_0xd81f('0x6b')],'predictiveIntervalAnsweredCalls':_0x2146d8[_0xd81f('0x6c')],'predictiveIntervalAvgHoldtime':_0x2146d8[_0xd81f('0x6d')],'predictiveIntervalAvgTalktime':_0x2146d8[_0xd81f('0x6e')],'predictiveIntervalDroppedCallsCallersExit':_0x2146d8[_0xd81f('0x6f')],'predictiveIntervalDroppedCallsTimeout':_0x2146d8['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x2146d8[_0xd81f('0x70')],'predictiveIntervalErlangCallsDroppedCalls':_0x2146d8['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x2146d8[_0xd81f('0x71')],'predictiveIntervalMultiplicativeFactor':_0x2146d8[_0xd81f('0x72')],'predictiveIntervalPauses':_0x2146d8['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x2146d8[_0xd81f('0x73')],'predictiveIntervalTotalCalls':_0x2146d8[_0xd81f('0x74')],'message':_0x2146d8[_0xd81f('0x43')],'originated':_0x2146d8[_0xd81f('0x75')],'erlangCalls':_0x2146d8[_0xd81f('0x76')],'erlangCallToSecond':_0x2146d8['erlangCallToSecond'],'erlangAbandonmentRate':_0x2146d8[_0xd81f('0x77')],'erlangBusyFactor':_0x2146d8[_0xd81f('0x78')],'startPredictive':_0x2146d8[_0xd81f('0x2d')],'startProgressive':_0x2146d8[_0xd81f('0x2e')]};if(_0x2146d8['Trunk']){_0x4d9074['Trunk']={'id':_0x2146d8['Trunk']['id'],'name':_0x2146d8[_0xd81f('0x79')]['name'],'active':_0x2146d8[_0xd81f('0x79')][_0xd81f('0x7a')],'callerid':_0x2146d8[_0xd81f('0x79')]['callerid']};}if(_0x2146d8[_0xd81f('0x49')]){_0x4d9074[_0xd81f('0x49')]={'id':_0x2146d8[_0xd81f('0x49')]['id'],'name':_0x2146d8['Interval'][_0xd81f('0x45')]};}var _0x2104a3=md5(JSON[_0xd81f('0x7b')](_0x4d9074));if(_0x2146d8[_0xd81f('0x4')]!==_0x2104a3){_0x2146d8[_0xd81f('0x4')]=_0x2104a3;emit(util[_0xd81f('0x7c')](_0xd81f('0x7d'),_0x4d9074[_0xd81f('0x45')]),_0xd81f('0x7e'),_0x4d9074);}}}function emitCampaignSummary(_0x5408dd){if(_0x5408dd[_0xd81f('0x53')]===_0xd81f('0x7f')){emit(util[_0xd81f('0x7c')](_0xd81f('0x80'),_0x5408dd[_0xd81f('0x45')]),'campaign:save',_0x5408dd);}}function checkGetDataPredictive(_0x3e4394){if(isNotNull(_0x3e4394)&&!_[_0xd81f('0x4d')](_0x3e4394)){loggerPredictive[_0xd81f('0x81')](_0xd81f('0x82'));loggerPredictive[_0xd81f('0x81')](_0xd81f('0x83'),_0x3e4394['predictiveIntervalTotalCalls']);loggerPredictive[_0xd81f('0x81')](_0xd81f('0x84'),_0x3e4394['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xd81f('0x81')](_0xd81f('0x85'),_0x3e4394[_0xd81f('0x86')]);loggerPredictive[_0xd81f('0x81')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e4394[_0xd81f('0x6f')]);loggerPredictive[_0xd81f('0x81')](_0xd81f('0x87'),_0x3e4394['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xd81f('0x81')](_0xd81f('0x88'),_0x3e4394[_0xd81f('0x6e')]);loggerPredictive['info'](_0xd81f('0x89'));if(_0x3e4394['predictiveIntervalTotalCalls']>0x0){if(!_[_0xd81f('0x42')](_0x3e4394['predictiveIntervalAvgTalktime'])&&_0x3e4394['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info'](_0xd81f('0x8a'));if(!_[_0xd81f('0x42')](_0x3e4394['predictiveIntervalAvgHoldtime'])&&_0x3e4394[_0xd81f('0x6d')]>0x0){return!![];}loggerPredictive[_0xd81f('0x81')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xd81f('0x81')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xd81f('0x81')](_0xd81f('0x8b'));}return![];}function mergeDataErlangB(_0x5cb658){return function(_0x398c27){loggerPredictive[_0xd81f('0x81')](_0xd81f('0x8c'));loggerPredictive[_0xd81f('0x81')](_0xd81f('0x8d'),_0x398c27[_0xd81f('0x76')]);loggerPredictive['info'](_0xd81f('0x8e'),_0x398c27['erlangCallToSecond']);loggerPredictive[_0xd81f('0x81')](_0xd81f('0x8f'),_0x398c27[_0xd81f('0x77')]);loggerPredictive['info'](_0xd81f('0x90'),_0x398c27[_0xd81f('0x78')]);loggerPredictive['info'](_0xd81f('0x8f'),_0x398c27[_0xd81f('0x77')]);loggerPredictive[_0xd81f('0x81')](_0xd81f('0x89'));_['merge'](_0x5cb658,_0x398c27);};}function getDiff(_0x3656e2){var _0x521353=moment()['milliseconds'](0x0);var _0x2c4236=moment(_0x3656e2)[_0xd81f('0x50')](0x0);return _0x521353['diff'](_0x2c4236,_0xd81f('0x52'));}function ifInterval(_0x42f0cd,_0x1c82b6){if(_[_0xd81f('0x42')](_0x1c82b6)){return![];}return getDiff(_0x1c82b6)<_0x42f0cd*0x3c;}function freeVariablesPredictive(_0x159dcf){if(isNotNull(_0x159dcf)){if(!_['isUndefined'](_0x159dcf[_0xd81f('0x2e')])){_0x159dcf[_0xd81f('0x2e')]=undefined;loggerPredictive['info'](_0x159dcf[_0xd81f('0x45')],_0xd81f('0x91'));}if(!_[_0xd81f('0x42')](_0x159dcf['startPredictive'])){_0x159dcf[_0xd81f('0x2d')]=undefined;loggerPredictive['info'](_0x159dcf[_0xd81f('0x45')],_0xd81f('0x92'));}if(!_[_0xd81f('0x42')](_0x159dcf[_0xd81f('0x93')])){clearInterval(_0x159dcf[_0xd81f('0x93')]);_0x159dcf[_0xd81f('0x93')]=undefined;loggerPredictive[_0xd81f('0x81')](_0x159dcf[_0xd81f('0x45')],_0xd81f('0x94'));}}}function erlangb(_0x11ebbc,_0x52b9d4){if(_0x52b9d4===0x0){return 0x0;}var _0x2688ab=0x1;for(var _0x4ff749=0x1;_0x4ff749<=_0x52b9d4;_0x4ff749+=0x1){_0x2688ab=0x1+_0x2688ab*_0x4ff749/_0x11ebbc;}return 0x1/_0x2688ab;}function isVoiceQueueOutbound(_0x17ef71){return _0x17ef71===_0xd81f('0x54');}function isNotPreview(_0x42c317){return _0x42c317!==_0xd81f('0x95');}function isCampaignIvr(_0x230e4d){return _0x230e4d==='ivr';}function getCallerId(_0x3244f9,_0x5b7293,_0x161b01){if(!_[_0xd81f('0x42')](_0x161b01)&&typeof _0x161b01==='string'&&!_[_0xd81f('0x4d')](_0x161b01)){if(!_['isUndefined'](_0x5b7293)&&typeof _0x5b7293===_0xd81f('0x96')&&!_[_0xd81f('0x4d')](_0x5b7293)){return util[_0xd81f('0x7c')](_0xd81f('0x97'),_0x5b7293,_0x161b01);}return util[_0xd81f('0x7c')](_0xd81f('0x97'),_0x161b01,_0x161b01);}if(!_['isUndefined'](_0x3244f9)&&typeof _0x3244f9==='string'&&!_[_0xd81f('0x4d')](_0x3244f9)){return _0x3244f9;}return _0xd81f('0x98');}function loggerCatchQueueSummary(_0x365037,_0x3c782f){return function(_0x1c4b91){freeVariablesPredictive(_0x3c782f);emitVoiceQueueSummary(_0x3c782f);emitCampaignSummary(_0x3c782f);loggerSyncQueueSummary[_0xd81f('0x99')](_0x365037,util[_0xd81f('0x9a')](_0x1c4b91,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x198b95,_0x44075c){return function(_0x38ca7b){loggerPredictive[_0xd81f('0x99')](_0x44075c[_0xd81f('0x45')],_0x198b95);loggerPredictive[_0xd81f('0x99')](_0x38ca7b[_0xd81f('0x9b')]);freeVariablesPredictive(_0x44075c);};}function loggerCatch(_0x3570e5){return function(_0x4a56c3){logger[_0xd81f('0x99')](_0x3570e5,util[_0xd81f('0x9a')](_0x4a56c3,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4fee49){return _0x4fee49&&!_[_0xd81f('0x42')](_0x4fee49)&&_0x4fee49[_0xd81f('0x9c')]>0x0;}function decremetOriginate(_0x2aacd2){if(!_[_0xd81f('0x42')](_0x2aacd2)&&_0x2aacd2!==null){if(typeof _0x2aacd2[_0xd81f('0x75')]!==_0xd81f('0x9d')){if(_0x2aacd2['originated']>0x0){_0x2aacd2['originated']-=0x1;}else{logger[_0xd81f('0x99')](_0xd81f('0x9e'));}}}else{logger[_0xd81f('0x99')](_0xd81f('0x9f'));}}function checkContactLowerLimitOriginate(_0x342b4d,_0x37d226,_0x333ce3){if(_0x37d226>_0x333ce3){for(var _0x5c044d=0x0;_0x5c044d<_0x37d226-_0x333ce3;_0x5c044d+=0x1){decremetOriginate(_0x342b4d);}}}function loggerGetContactDialer(_0x454b11,_0x303fb1,_0x189d14){return function(_0x2b7172){checkContactLowerLimitOriginate(_0x303fb1,_0x189d14,0x0);logger[_0xd81f('0x99')](_0x454b11,util[_0xd81f('0x9a')](_0x2b7172,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1f9b8c){return function(_0x3725f4){if(isNotNull(_0x3725f4)&&isNotNull(_0x3725f4[0x0])){if(_0x3725f4[0x0][_0xd81f('0xa0')]>0x0){_0x1f9b8c['message']=_0xd81f('0xa1');logger['info'](_0xd81f('0xa2')+_0x1f9b8c[_0xd81f('0x45')],_0x3725f4[0x0]['contactsRescheduled'],_0xd81f('0xa3'));}else{_0x1f9b8c[_0xd81f('0x43')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xd81f('0x81')](_0xd81f('0xa4')+_0x1f9b8c['name']);}}};}function notSendMessagesQueue(_0x1315be){if(_0x1315be[_0xd81f('0xa5')]){freeVariablesPredictive(_0x1315be);if(_0x1315be[_0xd81f('0x75')]===0x0&&_0x1315be[_0xd81f('0x5b')]===0x0&&_0x1315be[_0xd81f('0xa6')]===0x0&&(_0x1315be[_0xd81f('0x58')]||0x0)===0x0){_0x1315be[_0xd81f('0xa5')]=![];_0x1315be[_0xd81f('0x57')]=0x0;_0x1315be[_0xd81f('0x43')]=_0xd81f('0x47');loggerSyncQueueSummary['error'](_0xd81f('0xa7'),_0x1315be['name'],'is\x20not\x20active');}else{_0x1315be['message']=_0xd81f('0xa8');loggerSyncQueueSummary[_0xd81f('0x99')](_0xd81f('0xa7'),_0x1315be[_0xd81f('0x45')],_0xd81f('0xa9'));}emitVoiceQueueSummary(_0x1315be);}}function notSendMessagesCampaign(_0x2a67fb){if(_0x2a67fb[_0xd81f('0xa5')]){if(_0x2a67fb[_0xd81f('0x75')]===0x0){_0x2a67fb[_0xd81f('0xa5')]=![];_0x2a67fb['message']=_0xd81f('0x47');loggerSyncQueueSummary[_0xd81f('0x99')](_0xd81f('0xaa'),_0x2a67fb[_0xd81f('0x45')],_0xd81f('0xab'));}else{_0x2a67fb[_0xd81f('0x43')]=_0xd81f('0xa8');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x2a67fb['name'],_0xd81f('0xa9'));}emitCampaignSummary(_0x2a67fb);}}function createObjHistory(_0x7e27e4,_0x4d37e0,_0x297a8b,_0x313cbf,_0x5dda94){_0x7e27e4['message']=_0x297a8b;var _0x420273=new Action(_0x7e27e4,_0x4d37e0);var _0x30c3cd=new History(_0x420273);_0x30c3cd[_0xd81f('0xac')]=_0x313cbf;_0x30c3cd[_0xd81f('0xad')]=_0x5dda94;_0x30c3cd['endtime']=_0x420273[_0xd81f('0xae')];return _0x30c3cd;}Dialer[_0xd81f('0x1f')][_0xd81f('0xaf')]=function(){var _0x971797=this;setInterval(function(){_0x971797[_0xd81f('0xb0')](_0x971797[_0xd81f('0x2b')],'[uniqueid]');_0x971797[_0xd81f('0xb0')](_0x971797[_0xd81f('0x29')],'[actions]');},0x32c8);};Dialer[_0xd81f('0x1f')][_0xd81f('0xb0')]=function(_0x4712ff,_0x78ead2){var _0x739509=this;for(var _0x4ac027 in _0x4712ff){if(typeof _0x4712ff[_0x4ac027]!==_0xd81f('0x9d')){this[_0xd81f('0x22')][_0xd81f('0xb1')](function(){if(!_[_0xd81f('0xb2')](_0x4712ff[_0x4ac027])){return ami['Action']({'action':_0xd81f('0xb3'),'channel':_0x4712ff[_0x4ac027]['channel']})[_0xd81f('0xb4')](function(_0x19e84a){if(_0x19e84a[_0xd81f('0x43')]===_0xd81f('0xb5')){setTimeout(function(){if(_0x4712ff[_0x4ac027]&&_0x4712ff[_0x4ac027][_0xd81f('0x53')]!=='ivr'){_0x739509[_0xd81f('0xb6')](_0x739509[_0xd81f('0x23')][_0x4712ff[_0x4ac027]['queue']]);logger[_0xd81f('0x99')](_0xd81f('0xb7'),_0x78ead2,_0x4ac027,_0x4712ff[_0x4ac027][_0xd81f('0xb8')]);delete _0x4712ff[_0x4ac027];}if(_0x4712ff[_0x4ac027]&&_0x4712ff[_0x4ac027][_0xd81f('0x53')]===_0xd81f('0x7f')){_0x739509[_0xd81f('0xb6')](_0x739509[_0xd81f('0x24')][_0x4712ff[_0x4ac027][_0xd81f('0xb8')]]);logger[_0xd81f('0x99')]('[Dialer][checkChannel][ivr]',_0x78ead2,_0x4ac027,_0x4712ff[_0x4ac027]['queue']);delete _0x4712ff[_0x4ac027];}},0x2328);}});}});}}};Dialer[_0xd81f('0x1f')][_0xd81f('0xb9')]=function(_0x1aa923){return BPromise['resolve']()[_0xd81f('0xba')](cmHopper[_0xd81f('0xb9')](_0x1aa923))[_0xd81f('0xb4')](loggerCatch(_0xd81f('0xbb')));};Dialer['prototype'][_0xd81f('0xbc')]=function(_0x4fa784){return BPromise[_0xd81f('0xbd')]()[_0xd81f('0xba')](cmHopperBlack[_0xd81f('0xbc')](_0x4fa784))['catch'](loggerCatch(_0xd81f('0xbe')));};Dialer[_0xd81f('0x1f')][_0xd81f('0xbf')]=function(_0x44d0fa){return BPromise[_0xd81f('0xbd')]()[_0xd81f('0xba')](cmHopperBlack[_0xd81f('0xbf')](_0x44d0fa))[_0xd81f('0xb4')](loggerCatch(_0xd81f('0xc0')));};Dialer[_0xd81f('0x1f')]['averageHandleTime']=function(_0x1e4d29){return BPromise[_0xd81f('0xbd')]()[_0xd81f('0xba')](cmHopperHistory[_0xd81f('0xc1')](_0x1e4d29))[_0xd81f('0xb4')](loggerCatch(_0xd81f('0xc2')));};Dialer[_0xd81f('0x1f')][_0xd81f('0xc3')]=function(_0x521bc2){return BPromise[_0xd81f('0xbd')]()[_0xd81f('0xba')](cmHopper[_0xd81f('0xc3')](_0x521bc2))[_0xd81f('0xb4')](loggerCatch(_0xd81f('0xc4')));};Dialer['prototype'][_0xd81f('0xc5')]=function(_0x5029fd,_0x15fca1,_0x4a4ec3){return BPromise[_0xd81f('0xbd')]()['then'](cmHopper[_0xd81f('0xc5')](_0x5029fd,_0x15fca1,_0x4a4ec3))['catch'](loggerCatch(_0xd81f('0xc6')));};Dialer[_0xd81f('0x1f')][_0xd81f('0xc7')]=function(_0x610b49,_0x2d2b56,_0x508024,_0x383934,_0x2855c0){return BPromise['resolve']()[_0xd81f('0xba')](cmHopper[_0xd81f('0xc7')](_0x610b49,_0x2d2b56,_0x508024,_0x383934))[_0xd81f('0xb4')](function(_0x310e3e){_0x2855c0['temp']-=_0x508024;_0x2855c0[_0xd81f('0xc8')]=_0x2855c0[_0xd81f('0xc8')]>0x0?_0x2855c0[_0xd81f('0xc8')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x310e3e);});};Dialer['prototype'][_0xd81f('0xc9')]=function(_0x2d4b9b,_0x59865d,_0x5b6b3a,_0x4c3403){return BPromise['resolve']()[_0xd81f('0xba')](cmHopper[_0xd81f('0xc9')](_0x2d4b9b,_0x59865d,_0x5b6b3a))[_0xd81f('0xb4')](function(_0x4511b6){_0x4c3403[_0xd81f('0xc8')]-=_0x59865d;_0x4c3403['temp']=_0x4c3403[_0xd81f('0xc8')]>0x0?_0x4c3403['temp']:0x0;loggerCatch(_0xd81f('0xca'))(_0x4511b6);});};Dialer['prototype'][_0xd81f('0xcb')]=function(_0x27e272){return BPromise[_0xd81f('0xbd')]()[_0xd81f('0xba')](voiceQueueRt['getVoiceQueueRtPauses'](_0x27e272))['catch'](loggerCatch(_0xd81f('0xcc')));};Dialer[_0xd81f('0x1f')]['moveContactManagedDialer']=function(_0x5ed993){return BPromise[_0xd81f('0xbd')]()[_0xd81f('0xba')](cmHopper[_0xd81f('0xcd')](_0x5ed993))[_0xd81f('0xb4')](loggerCatch(_0xd81f('0xce')));};Dialer[_0xd81f('0x1f')][_0xd81f('0xcf')]=function(_0x2fa719){return BPromise[_0xd81f('0xbd')]()['then'](cmHopperHistory[_0xd81f('0xcf')](_0x2fa719))[_0xd81f('0xb4')](loggerCatch(_0xd81f('0xd0')));};Dialer[_0xd81f('0x1f')][_0xd81f('0xb6')]=function(_0x4d4fc6){if(!_['isUndefined'](_0x4d4fc6)&&_0x4d4fc6!==null){if(typeof _0x4d4fc6[_0xd81f('0x75')]!=='undefined'){if(_0x4d4fc6['originated']>0x0){_0x4d4fc6[_0xd81f('0x75')]-=0x1;}else{logger[_0xd81f('0x99')](_0xd81f('0xd1'));}}}else{logger['error'](_0xd81f('0xd2'));}};Dialer[_0xd81f('0x1f')][_0xd81f('0xd3')]=function(_0x435dbd,_0x3c3e87){var _0x31638c=this;return function(_0x20dfde){_0x31638c[_0xd81f('0xb6')](_0x3c3e87);logger[_0xd81f('0x99')](_0x435dbd,util[_0xd81f('0x9a')](_0x20dfde,{'showHidden':![],'depth':null}));};};Dialer[_0xd81f('0x1f')][_0xd81f('0xd4')]=function(_0x52381b,_0x5f0573,_0xb5d649){var _0x206720={'state':0x19,'statedesc':_0xd81f('0xd5')};this['updateOriginated'](_0x5f0573);this[_0xd81f('0xd6')](_[_0xd81f('0xd7')](_0x206720,_[_0xd81f('0xd8')](_0xb5d649,[_0xd81f('0xd9'),_0xd81f('0xda'),_0xd81f('0xdb'),_0xd81f('0xdc'),_0xd81f('0xdd')])),_0xd81f('0xde'),_0xd81f('0xdf'));logger[_0xd81f('0x99')](_0x52381b);};Dialer[_0xd81f('0x1f')][_0xd81f('0xe0')]=function(_0x3a22dd){return _0x3a22dd===_0xd81f('0xe1');};Dialer[_0xd81f('0x1f')][_0xd81f('0xe2')]=function(_0x472d40){return!_[_0xd81f('0x42')](_0x472d40)&&_0x472d40&&!_[_0xd81f('0x42')](_0x472d40[_0xd81f('0x45')])&&!_[_0xd81f('0x42')](_0x472d40[_0xd81f('0x7a')])&&_0x472d40[_0xd81f('0x7a')]&&(this[_0xd81f('0x26')][util[_0xd81f('0x7c')]('SIP/%s',_0x472d40[_0xd81f('0x45')])][_0xd81f('0xb3')]===_0xd81f('0xe3')||this[_0xd81f('0x26')][util[_0xd81f('0x7c')]('SIP/%s',_0x472d40[_0xd81f('0x45')])]['status']===_0xd81f('0xe4'));};Dialer[_0xd81f('0x1f')][_0xd81f('0xd6')]=function(_0x3c59a9,_0x5e136,_0x4b8f97){this['createHistory'](_0x3c59a9)['catch'](loggerCatch(_0x5e136));this[_0xd81f('0xcd')](_0x3c59a9)[_0xd81f('0xb4')](loggerCatch(_0x4b8f97));};Dialer['prototype'][_0xd81f('0x3e')]=function(_0x518050){var _0x559756=this[_0xd81f('0x2b')][_0x518050[_0xd81f('0xe5')]];var _0x4dd851;if(!_['isNil'](_0x518050)&&!_[_0xd81f('0xb2')](_0x518050[_0xd81f('0xe6')])&&!_[_0xd81f('0xb2')](_0x518050['variable'][_0xd81f('0xe7')])&&_0x518050[_0xd81f('0xe8')]===_0xd81f('0xe9')&&_0x559756){if(_0x559756['type']!==_0xd81f('0x7f')&&this['voiceQueues'][_0x559756[_0xd81f('0xb8')]]['dialAMDActive']&&_0x518050[_0xd81f('0xea')]===_0xd81f('0xeb')){delete this['uniqueId'][_0x518050[_0xd81f('0xe5')]];this[_0xd81f('0xb6')](this[_0xd81f('0x23')][_0x559756['queue']]);this[_0xd81f('0x23')][_0x559756[_0xd81f('0xb8')]][_0xd81f('0xec')]+=0x1;this[_0xd81f('0x23')][_0x559756['queue']][_0xd81f('0x63')]+=0x1;_0x4dd851=new Hangup(_0x559756,_0x518050);_0x4dd851[_0xd81f('0xac')]=0x12;_0x4dd851['statedesc']='HangupInAMD';_0x4dd851[_0xd81f('0xed')]=_0xd81f('0xee');ami[_0xd81f('0xef')](_0xd81f('0xf0'),ut['buildObj'](_0x4dd851,_0xd81f('0xf1')));this[_0xd81f('0xd6')](_0x4dd851,_0xd81f('0xf2'),_0xd81f('0xf3'));}if(_0x559756[_0xd81f('0x53')]!==_0xd81f('0x7f')&&this[_0xd81f('0x23')][_0x559756[_0xd81f('0xb8')]][_0xd81f('0xf4')]&&_0x518050[_0xd81f('0xea')]===_0xd81f('0xf5')){var _0xf75bb5=this;return new BPromise(function(_0x5383e6,_0xf74bbd){delete _0xf75bb5[_0xd81f('0x2b')][_0x518050[_0xd81f('0xe5')]];_0xf75bb5['updateOriginated'](_0xf75bb5['voiceQueues'][_0x559756['queue']]);_0xf75bb5[_0xd81f('0x23')][_0x559756[_0xd81f('0xb8')]]['outboundAnswerCallsDay']+=0x1;_0xf75bb5[_0xd81f('0x23')][_0x559756[_0xd81f('0xb8')]][_0xd81f('0x63')]+=0x1;var _0x40a5ce=_0xf75bb5[_0xd81f('0x23')][_0x559756[_0xd81f('0xb8')]];var _0x4ccc2a=new Hangup(_0x559756,_0x518050);_0x4ccc2a[_0xd81f('0xac')]=0x13;_0x4ccc2a[_0xd81f('0xad')]=_0xd81f('0xf6');_0x4ccc2a[_0xd81f('0xed')]='AMD';_0x4ccc2a['countmachineretry']+=0x1;_0x4ccc2a[_0xd81f('0xf7')]+=0x1;_0x4ccc2a[_0xd81f('0xf1')]=!![];ami[_0xd81f('0xef')](_0xd81f('0xf0'),ut[_0xd81f('0xf8')](_0x4ccc2a,_0xd81f('0xf1')));_0xf75bb5[_0xd81f('0xcf')](_0x4ccc2a)[_0xd81f('0xb4')](loggerCatch(_0xd81f('0xf9')));if(_0x4ccc2a['countbusyretry']+_0x4ccc2a[_0xd81f('0xfa')]+_0x4ccc2a[_0xd81f('0xfb')]+_0x4ccc2a[_0xd81f('0xfc')]+_0x4ccc2a[_0xd81f('0xfd')]+_0x4ccc2a[_0xd81f('0xfe')]+_0x4ccc2a[_0xd81f('0xff')]+_0x4ccc2a[_0xd81f('0x100')]>=_0x40a5ce['dialGlobalMaxRetry']){_0xf75bb5['stateGlobal'](_0x4ccc2a,_0x5383e6,_0xf74bbd,_0xd81f('0x101'));}else{if(_0x4ccc2a[_0xd81f('0xff')]>=_0x40a5ce[_0xd81f('0x102')]){_0xf75bb5[_0xd81f('0x103')](_0x4ccc2a,_0x5383e6,_0xf74bbd,_0xd81f('0x104'));}else{_0xf75bb5[_0xd81f('0xc3')]({'active':![],'countmachineretry':_0x4ccc2a[_0xd81f('0xff')],'scheduledat':moment()['add'](_0x40a5ce[_0xd81f('0x105')],_0xd81f('0x106'))[_0xd81f('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4ccc2a[_0xd81f('0xd9')],'ListId':_0x4ccc2a['ListId'],'VoiceQueueId':_0x4ccc2a[_0xd81f('0xdc')]||undefined,'CampaignId':_0x4ccc2a[_0xd81f('0xdd')]||undefined})['catch'](loggerCatch(_0xd81f('0x107')));_0x5383e6({'reschedule':0x1});}}});}if(_0x559756[_0xd81f('0x53')]===_0xd81f('0x7f')&&this[_0xd81f('0x24')][_0x559756[_0xd81f('0xb8')]]['dialAMDActive']&&_0x518050[_0xd81f('0xea')]===_0xd81f('0xeb')){delete this[_0xd81f('0x2b')][_0x518050['uniqueid']];this[_0xd81f('0xb6')](this[_0xd81f('0x24')][_0x559756[_0xd81f('0xb8')]]);_0x4dd851=new Hangup(_0x559756,_0x518050);_0x4dd851[_0xd81f('0xac')]=0x12;_0x4dd851[_0xd81f('0xad')]=_0xd81f('0x108');_0x4dd851[_0xd81f('0xed')]=_0xd81f('0xee');ami[_0xd81f('0xef')]('custom:amd',ut[_0xd81f('0xf8')](_0x4dd851,'amd'));this[_0xd81f('0xd6')](_0x4dd851,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x559756[_0xd81f('0x53')]===_0xd81f('0x7f')&&this[_0xd81f('0x24')][_0x559756[_0xd81f('0xb8')]][_0xd81f('0xf4')]&&_0x518050['value']===_0xd81f('0xf5')){var _0xf75bb5=this;return new BPromise(function(_0x5abf17,_0x3da74f){delete _0xf75bb5[_0xd81f('0x2b')][_0x518050[_0xd81f('0xe5')]];_0xf75bb5[_0xd81f('0xb6')](_0xf75bb5['campaigns'][_0x559756[_0xd81f('0xb8')]]);_0xf75bb5[_0xd81f('0x24')][_0x559756[_0xd81f('0xb8')]][_0xd81f('0xec')]+=0x1;_0xf75bb5[_0xd81f('0x24')][_0x559756['queue']][_0xd81f('0x63')]+=0x1;var _0x5cf60f=_0xf75bb5[_0xd81f('0x24')][_0x559756[_0xd81f('0xb8')]];var _0x37c34d=new Hangup(_0x559756,_0x518050);_0x37c34d[_0xd81f('0xac')]=0x13;_0x37c34d['statedesc']=_0xd81f('0xf6');_0x37c34d['membername']=_0xd81f('0xee');_0x37c34d[_0xd81f('0xff')]+=0x1;_0x37c34d[_0xd81f('0xf7')]+=0x1;_0x37c34d[_0xd81f('0xf1')]=!![];ami['emit'](_0xd81f('0xf0'),ut['buildObj'](_0x37c34d,'amd'));_0xf75bb5[_0xd81f('0xcf')](_0x37c34d)[_0xd81f('0xb4')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x37c34d[_0xd81f('0x109')]+_0x37c34d[_0xd81f('0xfa')]+_0x37c34d[_0xd81f('0xfb')]+_0x37c34d[_0xd81f('0xfc')]+_0x37c34d[_0xd81f('0xfd')]+_0x37c34d[_0xd81f('0xfe')]+_0x37c34d[_0xd81f('0xff')]+_0x37c34d[_0xd81f('0x100')]>=_0x5cf60f['dialGlobalMaxRetry']){_0xf75bb5[_0xd81f('0x10a')](_0x37c34d,_0x5abf17,_0x3da74f,_0xd81f('0x101'));}else{if(_0x37c34d[_0xd81f('0xff')]>=_0x5cf60f[_0xd81f('0x102')]){_0xf75bb5['createStateFinal'](_0x37c34d,_0x5abf17,_0x3da74f,_0xd81f('0x104'));}else{_0xf75bb5['rescheduleContact']({'active':![],'countmachineretry':_0x37c34d['countmachineretry'],'scheduledat':moment()[_0xd81f('0x10b')](_0x5cf60f[_0xd81f('0x105')],_0xd81f('0x106'))[_0xd81f('0x7c')](_0xd81f('0x10c')),'ContactId':_0x37c34d[_0xd81f('0xd9')],'ListId':_0x37c34d[_0xd81f('0xda')],'VoiceQueueId':_0x37c34d['VoiceQueueId']||undefined,'CampaignId':_0x37c34d['CampaignId']||undefined})[_0xd81f('0xb4')](loggerCatch('[rescheduleContact][Machine]'));_0x5abf17({'reschedule':0x1});}}});}}};Dialer[_0xd81f('0x1f')]['syncHangup']=function(_0x48d4a5){var _0x46e2fd=this[_0xd81f('0x2b')][_0x48d4a5[_0xd81f('0xe5')]];var _0x204f80=this;var _0x1755bf;if(_0x46e2fd&&_0x46e2fd[_0xd81f('0x53')]===_0xd81f('0x7f')){delete this['uniqueId'][_0x48d4a5['uniqueid']];this[_0xd81f('0xb6')](this[_0xd81f('0x24')][_0x46e2fd[_0xd81f('0xb8')]]);this['campaigns'][_0x46e2fd['queue']][_0xd81f('0x10d')]+=0x1;_0x1755bf=new Hangup(_0x46e2fd,_0x48d4a5);this[_0xd81f('0xcf')](_0x1755bf)[_0xd81f('0xb4')](loggerCatch(_0xd81f('0x10e')));this[_0xd81f('0xcd')](_0x1755bf)['catch'](loggerCatch(_0xd81f('0x10f')));}if(_0x46e2fd&&_0x46e2fd[_0xd81f('0x53')]!==_0xd81f('0x7f')&&isNotNull(this[_0xd81f('0x23')][_0x46e2fd['queue']][_0xd81f('0x110')])){delete this[_0xd81f('0x2b')][_0x48d4a5['uniqueid']];this[_0xd81f('0xb6')](this[_0xd81f('0x23')][_0x46e2fd['queue']]);this[_0xd81f('0x23')][_0x46e2fd[_0xd81f('0xb8')]][_0xd81f('0xec')]+=0x1;this[_0xd81f('0x23')][_0x46e2fd[_0xd81f('0xb8')]][_0xd81f('0x63')]+=0x1;_0x1755bf=new Hangup(_0x46e2fd,_0x48d4a5);_0x1755bf['state']=0x10;_0x1755bf['statedesc']=_0xd81f('0x111');_0x1755bf[_0xd81f('0xed')]='AGI';this[_0xd81f('0xcf')](_0x1755bf)[_0xd81f('0xb4')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x1755bf)[_0xd81f('0xb4')](loggerCatch('[syncHangupIvr]'));}if(_0x46e2fd&&_0x46e2fd['type']!==_0xd81f('0x7f')&&!isNotNull(this[_0xd81f('0x23')][_0x46e2fd[_0xd81f('0xb8')]][_0xd81f('0x110')])){delete this['uniqueId'][_0x48d4a5[_0xd81f('0xe5')]];this[_0xd81f('0xb6')](this[_0xd81f('0x23')][_0x46e2fd[_0xd81f('0xb8')]]);this[_0xd81f('0x23')][_0x46e2fd['queue']]['outboundUnknownCallsDay']+=0x1;_0x1755bf=new Hangup(_0x46e2fd,_0x48d4a5);_0x1755bf['state']=0xc;_0x1755bf[_0xd81f('0xad')]=_0x48d4a5[_0xd81f('0x112')];_0x1755bf[_0xd81f('0xed')]=_0xd81f('0x113');this['createHistory'](_0x1755bf)[_0xd81f('0xb4')](loggerCatch(_0xd81f('0x10e')));this[_0xd81f('0xcd')](_0x1755bf)['catch'](loggerCatch(_0xd81f('0x10f')));}};Dialer['prototype']['syncAgentComplete']=function(_0x21c4f1){var _0x684dc9=this[_0xd81f('0x2b')][_0x21c4f1[_0xd81f('0xe5')]];var _0x315eed=this;if(this[_0xd81f('0x23')][_0x21c4f1[_0xd81f('0xb8')]]){if(_0x684dc9&&_0x684dc9[_0xd81f('0x53')]!==_0xd81f('0x7f')){delete this['uniqueId'][_0x21c4f1[_0xd81f('0xe5')]];this[_0xd81f('0x23')][_0x21c4f1[_0xd81f('0xb8')]][_0xd81f('0xec')]+=0x1;var _0x38f6f6=new AgentComplete(_0x684dc9,_0x21c4f1);if(_0x21c4f1[_0xd81f('0x114')]===_0xd81f('0x115')){_0x38f6f6[_0xd81f('0x116')]=this[_0xd81f('0x23')][_0x21c4f1[_0xd81f('0xb8')]][_0xd81f('0x117')]&&this[_0xd81f('0x23')][_0x21c4f1[_0xd81f('0xb8')]][_0xd81f('0x118')]?moment()[_0xd81f('0x7c')](_0xd81f('0x10c')):undefined;}this['createHistory'](_0x38f6f6)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x38f6f6)[_0xd81f('0xb4')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xd81f('0x1f')][_0xd81f('0x33')]=function(_0x46912e){if(this['voiceQueues'][_0x46912e['queue']]){if(this[_0xd81f('0x2b')][_0x46912e[_0xd81f('0xe5')]]&&this[_0xd81f('0x2b')][_0x46912e[_0xd81f('0xe5')]][_0xd81f('0x53')]!==_0xd81f('0x7f')){this[_0xd81f('0xb6')](this[_0xd81f('0x23')][_0x46912e['queue']]);this[_0xd81f('0x2b')][_0x46912e[_0xd81f('0xe5')]][_0xd81f('0x119')]=moment()['format'](_0xd81f('0x10c'));}}};Dialer[_0xd81f('0x1f')][_0xd81f('0x11a')]=function(_0x3ea32d){this[_0xd81f('0xcf')](_0x3ea32d)[_0xd81f('0xb4')](loggerCatch(_0xd81f('0x11b')));this[_0xd81f('0xcd')](_0x3ea32d)[_0xd81f('0xb4')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0xd81f('0x1f')][_0xd81f('0x36')]=function(_0x3b438f){var _0x2f5aee=this['uniqueId'][_0x3b438f[_0xd81f('0xe5')]];var _0x52ca77=this;if(this['voiceQueues'][_0x3b438f['queue']]){if(_0x2f5aee&&_0x2f5aee[_0xd81f('0x53')]!==_0xd81f('0x7f')){delete this[_0xd81f('0x2b')][_0x3b438f[_0xd81f('0xe5')]];this[_0xd81f('0xb6')](this[_0xd81f('0x23')][_0x3b438f['queue']]);_0x2f5aee[_0xd81f('0x11c')]=moment()[_0xd81f('0x7c')](_0xd81f('0x10c'));var _0x42be93=new QueueCallerAbandon(_0x2f5aee,_0x3b438f);if(getSeconds(_0x2f5aee[_0xd81f('0x11c')],_0x2f5aee[_0xd81f('0x11d')])>=_0x2f5aee['dialQueueTimeout']){this[_0xd81f('0x23')][_0x3b438f[_0xd81f('0xb8')]][_0xd81f('0x86')]+=0x1;this[_0xd81f('0x23')][_0x3b438f[_0xd81f('0xb8')]][_0xd81f('0x67')]+=0x1;this[_0xd81f('0x23')][_0x3b438f['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x42be93['state']=0xa;_0x42be93[_0xd81f('0xad')]='Drop';_0x42be93[_0xd81f('0x11e')]=_0xd81f('0x11f');_0x42be93['agiafterat']=this[_0xd81f('0x23')][_0x3b438f['queue']][_0xd81f('0x117')]?moment()[_0xd81f('0x7c')](_0xd81f('0x10c')):undefined;_0x42be93['countdropretry']+=0x1;_0x42be93[_0xd81f('0xf7')]+=0x1;if(_0x42be93[_0xd81f('0xfd')]>=this[_0xd81f('0x23')][_0x3b438f[_0xd81f('0xb8')]][_0xd81f('0x120')]){this[_0xd81f('0x11a')](_0x42be93);}else{this[_0xd81f('0xc3')]({'active':![],'countdropretry':_0x42be93['countdropretry'],'scheduledat':moment()[_0xd81f('0x10b')](this['voiceQueues'][_0x3b438f[_0xd81f('0xb8')]][_0xd81f('0x121')],'minutes')['format'](_0xd81f('0x10c')),'ContactId':_0x2f5aee[_0xd81f('0xd9')],'ListId':_0x2f5aee[_0xd81f('0xda')],'VoiceQueueId':_0x2f5aee[_0xd81f('0xdc')]||undefined,'CampaignId':_0x2f5aee['CampaignId']||undefined})[_0xd81f('0xb4')](loggerCatch(_0xd81f('0x122')));var _0xf5d737=new History(_0x42be93);_0xf5d737['state']=0xa;_0xf5d737[_0xd81f('0xad')]=_0xd81f('0x123');_0xf5d737['starttime']=moment()[_0xd81f('0x7c')](_0xd81f('0x10c'));_0xf5d737[_0xd81f('0x124')]=_0xf5d737[_0xd81f('0xae')];_0xf5d737[_0xd81f('0x125')]=_0x42be93[_0xd81f('0x125')];_0xf5d737[_0xd81f('0x126')]=_0x42be93[_0xd81f('0x126')];this[_0xd81f('0xcf')](_0xf5d737)[_0xd81f('0xb4')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xd81f('0x23')][_0x3b438f[_0xd81f('0xb8')]][_0xd81f('0x6f')]+=0x1;this[_0xd81f('0x23')][_0x3b438f[_0xd81f('0xb8')]][_0xd81f('0x127')]+=0x1;_0x42be93[_0xd81f('0xac')]=0xb;_0x42be93['statedesc']=_0xd81f('0x128');_0x42be93[_0xd81f('0x11e')]=_0xd81f('0x129');_0x42be93[_0xd81f('0xfe')]+=0x1;_0x42be93['countglobal']+=0x1;if(_0x42be93[_0xd81f('0xfe')]>=this[_0xd81f('0x23')][_0x3b438f['queue']][_0xd81f('0x12a')]){this[_0xd81f('0x11a')](_0x42be93);}else{this[_0xd81f('0xc3')]({'active':![],'countabandonedretry':_0x42be93['countabandonedretry'],'scheduledat':moment()[_0xd81f('0x10b')](this['voiceQueues'][_0x3b438f[_0xd81f('0xb8')]][_0xd81f('0x12b')],_0xd81f('0x106'))[_0xd81f('0x7c')](_0xd81f('0x10c')),'ContactId':_0x2f5aee[_0xd81f('0xd9')],'ListId':_0x2f5aee[_0xd81f('0xda')],'VoiceQueueId':_0x2f5aee[_0xd81f('0xdc')]||undefined,'CampaignId':_0x2f5aee['CampaignId']||undefined})[_0xd81f('0xb4')](loggerCatch('[rescheduleContact][Abandoned]'));var _0xf5d737=new History(_0x42be93);_0xf5d737['state']=0xb;_0xf5d737[_0xd81f('0xad')]='Abandoned';_0xf5d737[_0xd81f('0xae')]=moment()[_0xd81f('0x7c')](_0xd81f('0x10c'));_0xf5d737[_0xd81f('0x124')]=_0xf5d737[_0xd81f('0xae')];_0xf5d737[_0xd81f('0x125')]=_0x42be93[_0xd81f('0x125')];_0xf5d737[_0xd81f('0x126')]=_0x42be93[_0xd81f('0x126')];this[_0xd81f('0xcf')](_0xf5d737)[_0xd81f('0xb4')](loggerCatch(_0xd81f('0x12c')));}}}}};Dialer['prototype'][_0xd81f('0x12d')]=function(_0xed2f0c){if(this[_0xd81f('0x29')][_0xed2f0c[_0xd81f('0xe5')]]){this[_0xd81f('0x29')][_0xed2f0c['uniqueid']][_0xd81f('0x12e')]=_0xed2f0c['channel'];}if(this[_0xd81f('0x2b')][_0xed2f0c[_0xd81f('0xe5')]]){this[_0xd81f('0x2b')][_0xed2f0c['uniqueid']][_0xd81f('0x12e')]=_0xed2f0c[_0xd81f('0x12e')];}};Dialer[_0xd81f('0x1f')][_0xd81f('0x3f')]=function(_0x5745db){if(strategy[this['voiceQueues'][this['actions'][_0x5745db[_0xd81f('0x12f')]]['queue']][_0xd81f('0x55')]]==='roundrobin'){if(this[_0xd81f('0x29')][_0x5745db['actionid']]&&_[_0xd81f('0xb2')](this[_0xd81f('0x29')][_0x5745db[_0xd81f('0x12f')]][_0xd81f('0x130')])&&_0x5745db[_0xd81f('0xb3')]==='1'&&_0x5745db[_0xd81f('0x131')]==='0'){if(this[_0xd81f('0x25')][_0x5745db[_0xd81f('0x132')]]){if(!this['agents'][_0x5745db[_0xd81f('0x132')]]['locked']){this[_0xd81f('0x25')][_0x5745db[_0xd81f('0x132')]][_0xd81f('0x130')]=!![];this[_0xd81f('0x29')][_0x5745db[_0xd81f('0x12f')]][_0xd81f('0x130')]=!![];this[_0xd81f('0x29')][_0x5745db[_0xd81f('0x12f')]][_0xd81f('0x132')]=_0x5745db[_0xd81f('0x132')];}}}}else if((strategy[this['voiceQueues'][this[_0xd81f('0x29')][_0x5745db['actionid']][_0xd81f('0xb8')]][_0xd81f('0x55')]]||'rrmemory')===_0xd81f('0x1d')){if(this['actions'][_0x5745db[_0xd81f('0x12f')]]){if(this[_0xd81f('0x25')][_0x5745db['stateinterface']]){this[_0xd81f('0x29')][_0x5745db['actionid']][_0xd81f('0x132')]=_0x5745db[_0xd81f('0x132')];if(_['isNil'](this[_0xd81f('0x30')][this['actions'][_0x5745db[_0xd81f('0x12f')]][_0xd81f('0xb8')]])){this[_0xd81f('0x30')][this['actions'][_0x5745db[_0xd81f('0x12f')]][_0xd81f('0xb8')]]=[];}this['queueBooked'][this[_0xd81f('0x29')][_0x5745db[_0xd81f('0x12f')]]['queue']]['push'](_[_0xd81f('0xd7')](_['pick'](this[_0xd81f('0x29')][_0x5745db[_0xd81f('0x12f')]],['idHopper',_0xd81f('0x132')]),{'status':_0x5745db[_0xd81f('0xb3')],'paused':_0x5745db[_0xd81f('0x131')]}));}}}};function unlockQueueStatus(_0x1c0064,_0x516dab){setTimeout(function(){if(_[_0xd81f('0x42')](_0x1c0064['queueStatusComplete'])){loggerBooked[_0xd81f('0x99')]('[unlockQueueStatus][undefined]',_0x516dab);}_0x1c0064[_0xd81f('0x133')]=!![];loggerBooked[_0xd81f('0x81')](_0xd81f('0x134'),_0x516dab,JSON['stringify'](_['pick'](_0x1c0064,[_0xd81f('0x45'),'queueStatusComplete'])));},0x1f3);}Dialer[_0xd81f('0x1f')][_0xd81f('0x40')]=function(_0x2058ad){var _0x1cc6da=this;var _0xea5ea0=_0x1cc6da[_0xd81f('0x23')][_0x1cc6da[_0xd81f('0x29')][_0x2058ad[_0xd81f('0x12f')]][_0xd81f('0xb8')]];if(strategy[this[_0xd81f('0x23')][this[_0xd81f('0x29')][_0x2058ad[_0xd81f('0x12f')]][_0xd81f('0xb8')]]['strategy']]===_0xd81f('0x1e')){if(this[_0xd81f('0x29')][_0x2058ad[_0xd81f('0x12f')]]&&this[_0xd81f('0x29')][_0x2058ad[_0xd81f('0x12f')]][_0xd81f('0x132')]){this[_0xd81f('0x95')][_0xd81f('0x135')](this[_0xd81f('0x29')][_0x2058ad['actionid']][_0xd81f('0x136')],this['actions'][_0x2058ad[_0xd81f('0x12f')]][_0xd81f('0x132')])[_0xd81f('0xb4')](function(_0x400835){logger[_0xd81f('0x99')](_0xd81f('0x137'),util[_0xd81f('0x9a')](_0x400835,{'showHidden':![],'depth':null}));})['finally'](function(){_0x1cc6da[_0xd81f('0xb6')](_0x1cc6da[_0xd81f('0x23')][_0x1cc6da['actions'][_0x2058ad[_0xd81f('0x12f')]]['queue']]);_0x1cc6da[_0xd81f('0x25')][_0x1cc6da[_0xd81f('0x29')][_0x2058ad[_0xd81f('0x12f')]][_0xd81f('0x132')]][_0xd81f('0x130')]=![];delete _0x1cc6da[_0xd81f('0x29')][_0x2058ad['actionid']];unlockQueueStatus(_0xea5ea0);});}else{this[_0xd81f('0xb6')](this[_0xd81f('0x23')][this[_0xd81f('0x29')][_0x2058ad[_0xd81f('0x12f')]][_0xd81f('0xb8')]]);this[_0xd81f('0xc3')]({'active':![],'ContactId':this[_0xd81f('0x29')][_0x2058ad['actionid']]['ContactId'],'ListId':this['actions'][_0x2058ad[_0xd81f('0x12f')]][_0xd81f('0xda')],'VoiceQueueId':this[_0xd81f('0x29')][_0x2058ad[_0xd81f('0x12f')]][_0xd81f('0xdc')]||undefined,'CampaignId':this[_0xd81f('0x29')][_0x2058ad[_0xd81f('0x12f')]][_0xd81f('0xdd')]||undefined})[_0xd81f('0xb4')](loggerCatch(_0xd81f('0x138')));delete this[_0xd81f('0x29')][_0x2058ad[_0xd81f('0x12f')]];unlockQueueStatus(_0xea5ea0);}}else if((strategy[this[_0xd81f('0x23')][this[_0xd81f('0x29')][_0x2058ad[_0xd81f('0x12f')]][_0xd81f('0xb8')]][_0xd81f('0x55')]]||_0xd81f('0x1d'))===_0xd81f('0x1d')){var _0x4b148c;if(this[_0xd81f('0x29')][_0x2058ad[_0xd81f('0x12f')]]&&!_['isEmpty'](this[_0xd81f('0x30')][this[_0xd81f('0x29')][_0x2058ad[_0xd81f('0x12f')]]['queue']])){if(this[_0xd81f('0x31')][_0x1cc6da['actions'][_0x2058ad['actionid']][_0xd81f('0xb8')]]){this[_0xd81f('0x31')][_0x1cc6da['actions'][_0x2058ad[_0xd81f('0x12f')]][_0xd81f('0xb8')]]=this[_0xd81f('0x31')][this[_0xd81f('0x29')][_0x2058ad[_0xd81f('0x12f')]][_0xd81f('0xb8')]]?this[_0xd81f('0x31')][this[_0xd81f('0x29')][_0x2058ad[_0xd81f('0x12f')]][_0xd81f('0xb8')]]:this['queueBooked'][this[_0xd81f('0x29')][_0x2058ad[_0xd81f('0x12f')]][_0xd81f('0xb8')]]?this['queueBooked'][this[_0xd81f('0x29')][_0x2058ad['actionid']][_0xd81f('0xb8')]][_0xd81f('0x139')]||0x0:0x0;}this['queueBooked'][this[_0xd81f('0x29')][_0x2058ad[_0xd81f('0x12f')]][_0xd81f('0xb8')]][_0xd81f('0x139')]=this['queueBookedRR'][this[_0xd81f('0x29')][_0x2058ad[_0xd81f('0x12f')]][_0xd81f('0xb8')]];for(var _0x16156b=0x0;_0x16156b=0x0;})['catch'](myreject(_0x4a8708)));}}else{_0x14bcd0[_0xd81f('0x14f')](ami[_0xd81f('0x150')]({'action':_0xd81f('0x151'),'command':util['format'](_0xd81f('0x152'),_0x2ec02d,!_['isUndefined'](config['timezones'][_0x3e79bc])?_0x3e79bc:'')})['then'](function(_0x4d8627){return _0x4d8627[_0xd81f('0x154')][_0xd81f('0x156')](_0xd81f('0x155'))>=0x0;})[_0xd81f('0xb4')](myreject(_0x4a8708)));}BPromise[_0xd81f('0x157')](_0x14bcd0)[_0xd81f('0xba')](function(_0x2c584f){var _0x5c560f=_['some'](_0x2c584f);if(_0x5c560f){return _0x57a0b5(_0x5c560f);}else{_0x560b29[_0xd81f('0x43')]=_0x1598c9?_0xd81f('0x158'):'INTERVAL_IS_OVERTIME';return _0x4a8708(msgResponse('[ifTime][promiseAll]',_0xd81f('0x14a'),_0xd81f('0x159')+_0x1598c9+'\x20'+_0x51e9a6+_0xd81f('0x15a')+util[_0xd81f('0x9a')](_0x2ec02d,{'showHidden':![],'depth':null})+_0xd81f('0x15b')+_0x3e79bc));}})[_0xd81f('0xb4')](function(_0x27d715){return _0x4a8708(msgResponse(_0xd81f('0x148'),_0xd81f('0x14a'),JSON['stringify'](_0x27d715)));});});};Dialer['prototype']['checkDialMethod']=function(_0x4c8f63){var _0x506188=this;return function(){switch(_0x4c8f63['dialMethod']){case _0xd81f('0x15c'):freeVariablesPredictive(_0x4c8f63);_0x506188[_0xd81f('0x15d')](_0x4c8f63,0x1);break;case _0xd81f('0x15e'):freeVariablesPredictive(_0x4c8f63);_0x506188[_0xd81f('0x15d')](_0x4c8f63,_0x4c8f63['dialPowerLevel']);break;case _0xd81f('0xa'):_0x506188['predictive'](_0x4c8f63);break;case _0xd81f('0x8'):freeVariablesPredictive(_0x4c8f63);_0x506188[_0xd81f('0x15d')](_0x4c8f63,0x1);break;default:freeVariablesPredictive(_0x4c8f63);logger[_0xd81f('0x99')]('Queue',_0x4c8f63['name'],_0xd81f('0x15f'));}};};Dialer['prototype']['launchHandleIvr']=function(_0x3730b3){var _0x121188=this;return function(){_0x121188[_0xd81f('0x160')](_0x3730b3);};};Dialer[_0xd81f('0x1f')][_0xd81f('0xc')]=function(_0x3ee663){var _0xf816e6=this;if(isNotPreview(_0x3ee663[_0xd81f('0x161')])){if(isVoiceQueueOutbound(_0x3ee663['type'])&&isActive(_0x3ee663[_0xd81f('0x5f')])){_0x3ee663[_0xd81f('0xa5')]=!![];BPromise[_0xd81f('0xbd')]()['then'](checkIsLoggedIn(_0x3ee663,_0x3ee663[_0xd81f('0x162')]))[_0xd81f('0xba')](checkIsActive(_0x3ee663,_0x3ee663['dialActive']))[_0xd81f('0xba')](checkInterval(_0x3ee663))[_0xd81f('0xba')](_0xf816e6[_0xd81f('0x144')](_0x3ee663))[_0xd81f('0xba')](_0xf816e6[_0xd81f('0x147')](_0x3ee663[_0xd81f('0x163')],_0x3ee663[_0xd81f('0x164')],_0x3ee663[_0xd81f('0x45')],_0x3ee663))[_0xd81f('0xba')](_0xf816e6[_0xd81f('0x149')](_0x3ee663[_0xd81f('0x49')],_0x3ee663[_0xd81f('0x164')],_0x3ee663[_0xd81f('0x45')],_0x3ee663))[_0xd81f('0xba')](_0xf816e6['checkDialMethod'](_0x3ee663))['catch'](loggerCatchQueueSummary('[syncQueueSummary]',_0x3ee663));}else{notSendMessagesQueue(_0x3ee663);}}else{freeVariablesPredictive(_0x3ee663);}};Dialer['prototype'][_0xd81f('0x143')]=function(){var _0x736525=this;var _0x15bdd2;for(var _0x533edc in this[_0xd81f('0x24')]){if(typeof this[_0xd81f('0x24')][_0x533edc]!=='undefined'){_0x15bdd2=this[_0xd81f('0x24')][_0x533edc];if(isCampaignIvr(_0x15bdd2[_0xd81f('0x53')])&&isActive(_0x15bdd2[_0xd81f('0x7a')])){_0x15bdd2['sendMessageOneNotActive']=!![];BPromise[_0xd81f('0xbd')]()['then'](checkIsActive(_0x15bdd2,_0x15bdd2[_0xd81f('0x7a')]))[_0xd81f('0xba')](checkInterval(_0x15bdd2))[_0xd81f('0xba')](_0x736525['checkIsTrunkReachable'](_0x15bdd2))[_0xd81f('0xba')](_0x736525['checkIfTime'](_0x15bdd2[_0xd81f('0x163')],_0x15bdd2[_0xd81f('0x164')],_0x15bdd2[_0xd81f('0x45')],_0x15bdd2))[_0xd81f('0xba')](_0x736525[_0xd81f('0x149')](_0x15bdd2[_0xd81f('0x49')],_0x15bdd2['dialTimezone'],_0x15bdd2[_0xd81f('0x45')],_0x15bdd2))[_0xd81f('0xba')](_0x736525[_0xd81f('0x165')](_0x15bdd2))[_0xd81f('0xb4')](loggerCatchQueueSummary('[syncCampaigns]',_0x15bdd2));}else{notSendMessagesCampaign(_0x15bdd2);}}}};function getCallerIdRandom(_0x3bac49,_0x569507){var _0x1606b8;var _0x2af990;var _0x261e64;if(_0x569507<=0x0){_0x569507=0x1;}_0x1606b8=new RegExp(_0xd81f('0x166')+_0x569507+'}$');_0x2af990=Math[_0xd81f('0x167')](0xa,_0x569507-0x1);_0x261e64=Math['pow'](0xa,_0x569507)-0x1;return util['format']('%s',_[_0xd81f('0x168')](_0x3bac49,_0x1606b8,_[_0xd81f('0x169')](_0x2af990,_0x261e64)));}function extractCalleridName(_0x1e463f){var _0x253611=_0x1e463f[_0xd81f('0x16a')](/"(.*?)"/);return _0x253611?_0x253611[0x1]:_0x1e463f;}function extractCalleridNumber(_0x40c32f){var _0xa5dcff=_0x40c32f[_0xd81f('0x16a')](/<(.*?)>/);return _0xa5dcff?_0xa5dcff[0x1]:_0x40c32f;}Dialer[_0xd81f('0x1f')][_0xd81f('0x16b')]=function(_0x495b67,_0x1f9004){var _0x5ece54=this;var _0x198f55=uuid['v4']();this[_0xd81f('0x29')][_0x198f55]=new Action(_0x495b67,_0x1f9004,_0x198f55);return new BPromise(function(_0x40ba42,_0x2a700a){if(_[_0xd81f('0x42')](_0x495b67)&&typeof _0x495b67!==_0xd81f('0x16c')){return _0x2a700a(msgResponse('originate','Failure',_0xd81f('0x16d')));}if(_[_0xd81f('0x42')](_0x1f9004[_0xd81f('0x16e')][_0xd81f('0x16f')])||_0x1f9004[_0xd81f('0x16e')]['phone']===null){return _0x2a700a(msgResponse(_0xd81f('0x170'),'Failure',_0xd81f('0x171')));}var _0x44b8f3={'XMD-CALLERID':_0x5ece54[_0xd81f('0x29')][_0x198f55][_0xd81f('0x172')](),'XMD-AGI':_0x495b67['dialQueueProject']?util[_0xd81f('0x7c')](_0xd81f('0x173'),ipAgi,_0x495b67[_0xd81f('0x110')]):_0xd81f('0x174'),'XMD-AGIAFTER':_0x495b67['dialQueueProject2']?util[_0xd81f('0x7c')](_0xd81f('0x173'),ipAgi,_0x495b67[_0xd81f('0x117')]):_0xd81f('0x174'),'XMD-QUEUE':_0x495b67['type']===_0xd81f('0x54')?util[_0xd81f('0x7c')](_0xd81f('0x175'),_0x495b67[_0xd81f('0x45')],_0x495b67['dialQueueOptions']||'',_0x495b67[_0xd81f('0x118')]?'c':'',_0x495b67[_0xd81f('0x176')]||0x3):_0xd81f('0x174'),'XMD-CONTACTID':_0x1f9004['ContactId'],'XMD-CDRTYPE':_0xd81f('0x177'),'CALLERID(all)':_0x5ece54['actions'][_0x198f55][_0xd81f('0x172')](),'XMD-AMD':_0x495b67['dialAMDActive']?'ACTIVE':'NONE','XMD-DESTINATION':_0xd81f('0xe9')};if(_0x495b67[_0xd81f('0xf4')]){_0x44b8f3[_0xd81f('0x178')]=_0x495b67[_0xd81f('0x179')]||0x9c4;_0x44b8f3[_0xd81f('0x17a')]=_0x495b67['dialAMDGreeting']||0x5dc;_0x44b8f3[_0xd81f('0x17b')]=_0x495b67[_0xd81f('0x17c')]||0x320;_0x44b8f3['XMD-AMDTOTALANALYSISTIME']=_0x495b67[_0xd81f('0x17d')]||0x1388;_0x44b8f3[_0xd81f('0x17e')]=_0x495b67[_0xd81f('0x17f')]||0x64;_0x44b8f3[_0xd81f('0x180')]=_0x495b67[_0xd81f('0x181')]||0x32;_0x44b8f3['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x495b67['dialAMDMaximumNumberOfWords']||0x3;_0x44b8f3[_0xd81f('0x182')]=_0x495b67['dialAMDSilenceThreshold']||0x100;_0x44b8f3[_0xd81f('0x183')]=_0x495b67['dialAMDMaximumWordLength']||0x1388;}if(_0x495b67[_0xd81f('0x53')]===_0xd81f('0x54')){_0x44b8f3[_0xd81f('0x184')]=_0x1f9004[_0xd81f('0xdc')];}else{_0x44b8f3[_0xd81f('0x185')]=_0x1f9004['CampaignId'];}for(var _0x2331e5 in _0x1f9004['Contact']){if(typeof _0x1f9004['Contact'][_0x2331e5]!==_0xd81f('0x9d')){if(isNotNull(_0x1f9004[_0xd81f('0x16e')][_0x2331e5])&&_0x2331e5!=='id'&&_0x2331e5!==_0xd81f('0x186')&&_0x2331e5!==_0xd81f('0x187')&&_0x2331e5!==_0xd81f('0x188')){_0x44b8f3[util[_0xd81f('0x7c')](_0xd81f('0x189'),'XMD-',_[_0xd81f('0x18a')](_0x2331e5))]=_0x1f9004[_0xd81f('0x16e')][_0x2331e5];}}}var _0x43802d=_0x5ece54['isTrunkReachable'](_0x495b67['Trunk'])?getCallerId(_0x495b67[_0xd81f('0x79')]['callerid'],_0x495b67[_0xd81f('0x18b')],_0x495b67[_0xd81f('0x18c')]>0x0?getCallerIdRandom(_0x495b67[_0xd81f('0x60')],_0x495b67[_0xd81f('0x18c')]):_0x495b67[_0xd81f('0x60')]):getCallerId(_[_0xd81f('0xb2')](_0x495b67['TrunkBackup'])?_0x495b67[_0xd81f('0x79')]['callerid']:_0x495b67['TrunkBackup'][_0xd81f('0x18d')],_0x495b67[_0xd81f('0x18b')],_0x495b67[_0xd81f('0x18c')]>0x0?getCallerIdRandom(_0x495b67['dialOriginateCallerIdNumber'],_0x495b67[_0xd81f('0x18c')]):_0x495b67[_0xd81f('0x60')]);if(_0x43802d){_0x44b8f3[_0xd81f('0x18e')]=_0x5ece54[_0xd81f('0x29')][_0x198f55]['originatecalleridname']=extractCalleridName(_0x43802d);_0x44b8f3[_0xd81f('0x18f')]=_0x5ece54[_0xd81f('0x29')][_0x198f55][_0xd81f('0x190')]=extractCalleridNumber(_0x43802d);}return ami[_0xd81f('0x150')]({'actionid':_0x198f55,'action':_0xd81f('0x170'),'channel':_0x5ece54['isTrunkReachable'](_0x495b67[_0xd81f('0x79')])?util[_0xd81f('0x7c')](_0xd81f('0x191'),_0x495b67[_0xd81f('0x79')][_0xd81f('0x45')],isNotNull(_0x495b67[_0xd81f('0x62')])?_0x495b67['dialPrefix'][_0xd81f('0x192')]()||'':'',_0x495b67['dialCutDigit']>0x0?_0x1f9004[_0xd81f('0x16e')][_0xd81f('0x16f')]['substring'](_0x495b67[_0xd81f('0x193')]):_0x1f9004[_0xd81f('0x16e')][_0xd81f('0x16f')]):util['format'](_0xd81f('0x191'),_['isNil'](_0x495b67[_0xd81f('0x145')])?_0x495b67['Trunk'][_0xd81f('0x45')]:_0x495b67[_0xd81f('0x145')][_0xd81f('0x45')],isNotNull(_0x495b67[_0xd81f('0x62')])?_0x495b67[_0xd81f('0x62')][_0xd81f('0x192')]()||'':'',_0x495b67[_0xd81f('0x193')]>0x0?_0x1f9004['Contact'][_0xd81f('0x16f')][_0xd81f('0x194')](_0x495b67[_0xd81f('0x193')]):_0x1f9004['Contact'][_0xd81f('0x16f')]),'callerid':_0x43802d,'Exten':_0xd81f('0xe9'),'Context':_0xd81f('0x195'),'Priority':'1','variable':_0x44b8f3,'timeout':(_0x495b67[_0xd81f('0x61')]||0x1e)*0x3e8,'async':!![],'channelid':_0x198f55})['then'](function(_0xb51018){return _0x40ba42(_0xb51018);})['catch'](function(_0x319146){_0x495b67[_0xd81f('0x6a')]+=0x1;var _0x4476d7=new History(_0x5ece54['actions'][_0x198f55]);logger[_0xd81f('0x99')](util[_0xd81f('0x7c')]('[originateError]:\x20%s',JSON[_0xd81f('0x7b')](_0x319146)));_0x4476d7[_0xd81f('0xac')]=0xe;_0x4476d7[_0xd81f('0xad')]=_0xd81f('0x196');_0x4476d7[_0xd81f('0xae')]=moment()['format'](_0xd81f('0x10c'));_0x4476d7[_0xd81f('0x124')]=_0x4476d7[_0xd81f('0xae')];_0x5ece54[_0xd81f('0xcf')](_0x4476d7)[_0xd81f('0xb4')](loggerCatch(_0xd81f('0x197')));_0x5ece54[_0xd81f('0xcd')](_0x4476d7)[_0xd81f('0xb4')](loggerCatch(_0xd81f('0x197')))['finally'](function(){delete _0x5ece54[_0xd81f('0x29')][_0x198f55];return _0x2a700a(msgResponse(_0xd81f('0x170'),'Error',_0xd81f('0x198')));});});});};Dialer['prototype'][_0xd81f('0x38')]=function(_0x54bbf8){var _0x3f0c49=this['actions'][_0x54bbf8[_0xd81f('0x12f')]];if(_0x3f0c49){delete this['actions'][_0x54bbf8[_0xd81f('0x12f')]];_0x3f0c49[_0xd81f('0x11d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x485038=_0x3f0c49[_0xd81f('0x53')]===_0xd81f('0x7f')?this[_0xd81f('0x24')][_0x3f0c49[_0xd81f('0xb8')]]:this['voiceQueues'][_0x3f0c49['getQueue']()];if(!this[_0xd81f('0xe0')](_0x54bbf8[_0xd81f('0x199')])){this[_0xd81f('0xb6')](_0x485038);return this[_0xd81f('0x19a')](_0x3f0c49,_0x485038,_0x54bbf8)['catch'](loggerCatch(_0xd81f('0x19b')));}this[_0xd81f('0x2b')][_0x54bbf8[_0xd81f('0xe5')]]=_0x3f0c49;}};Dialer[_0xd81f('0x1f')][_0xd81f('0x19c')]=function(_0x410e85,_0x544834,_0x1abfd3){var _0x4de123=new History(_0x544834);if(_0x4de123[_0xd81f('0x109')]+_0x4de123[_0xd81f('0xfa')]+_0x4de123[_0xd81f('0xfb')]+_0x4de123[_0xd81f('0xfc')]+_0x4de123[_0xd81f('0xfd')]+_0x4de123[_0xd81f('0xfe')]+_0x4de123[_0xd81f('0xff')]+_0x4de123[_0xd81f('0x100')]>=_0x1abfd3[_0xd81f('0x19d')]-0x1){return!![];}switch(_0x410e85){case 0x3:if(_0x4de123['countnoanswerretry']>=_0x1abfd3[_0xd81f('0x19e')]-0x1){return!![];}this[_0xd81f('0xc3')]({'active':![],'countnoanswerretry':_0x4de123[_0xd81f('0xfb')]+=0x1,'scheduledat':moment()[_0xd81f('0x10b')](_0x1abfd3[_0xd81f('0x19f')],_0xd81f('0x106'))[_0xd81f('0x7c')](_0xd81f('0x10c')),'ContactId':_0x4de123[_0xd81f('0xd9')],'ListId':_0x4de123[_0xd81f('0xda')],'VoiceQueueId':_0x4de123['VoiceQueueId']||undefined,'CampaignId':_0x4de123[_0xd81f('0xdd')]||undefined})[_0xd81f('0xb4')](loggerCatch(_0xd81f('0x1a0')));break;case 0x5:if(_0x4de123[_0xd81f('0x109')]>=_0x1abfd3[_0xd81f('0x1a1')]-0x1){return!![];}this[_0xd81f('0xc3')]({'active':![],'countbusyretry':_0x4de123[_0xd81f('0x109')]+=0x1,'scheduledat':moment()['add'](_0x1abfd3[_0xd81f('0x1a2')],'minutes')[_0xd81f('0x7c')](_0xd81f('0x10c')),'ContactId':_0x4de123[_0xd81f('0xd9')],'ListId':_0x4de123[_0xd81f('0xda')],'VoiceQueueId':_0x4de123[_0xd81f('0xdc')]||undefined,'CampaignId':_0x4de123['CampaignId']||undefined})[_0xd81f('0xb4')](loggerCatch(_0xd81f('0x1a3')));break;case 0x8:if(_0x4de123[_0xd81f('0xfa')]>=_0x1abfd3[_0xd81f('0x1a4')]-0x1){return!![];}this[_0xd81f('0xc3')]({'active':![],'countcongestionretry':_0x4de123[_0xd81f('0xfa')]+=0x1,'scheduledat':moment()['add'](_0x1abfd3['dialCongestionRetryFrequency'],'minutes')[_0xd81f('0x7c')](_0xd81f('0x10c')),'ContactId':_0x4de123['ContactId'],'ListId':_0x4de123[_0xd81f('0xda')],'VoiceQueueId':_0x4de123[_0xd81f('0xdc')]||undefined,'CampaignId':_0x4de123[_0xd81f('0xdd')]||undefined})[_0xd81f('0xb4')](loggerCatch(_0xd81f('0x1a5')));break;case 0x0:if(_0x4de123[_0xd81f('0xfc')]>=_0x1abfd3[_0xd81f('0x1a6')]-0x1){return!![];}else{this[_0xd81f('0xc3')]({'active':![],'countnosuchnumberretry':_0x4de123['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xd81f('0x10b')](_0x1abfd3[_0xd81f('0x1a7')],_0xd81f('0x106'))[_0xd81f('0x7c')](_0xd81f('0x10c')),'ContactId':_0x4de123[_0xd81f('0xd9')],'ListId':_0x4de123[_0xd81f('0xda')],'VoiceQueueId':_0x4de123[_0xd81f('0xdc')]||undefined,'CampaignId':_0x4de123[_0xd81f('0xdd')]||undefined})[_0xd81f('0xb4')](loggerCatch(_0xd81f('0x1a8')));}break;case 0xa:if(_0x4de123[_0xd81f('0xfd')]>=_0x1abfd3[_0xd81f('0x120')]-0x1){return!![];}this[_0xd81f('0xc3')]({'active':![],'countdropretry':_0x4de123[_0xd81f('0xfd')]+=0x1,'scheduledat':moment()[_0xd81f('0x10b')](_0x1abfd3[_0xd81f('0x121')],_0xd81f('0x106'))[_0xd81f('0x7c')](_0xd81f('0x10c')),'ContactId':_0x4de123[_0xd81f('0xd9')],'ListId':_0x4de123[_0xd81f('0xda')],'VoiceQueueId':_0x4de123[_0xd81f('0xdc')]||undefined,'CampaignId':_0x4de123[_0xd81f('0xdd')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x4de123['countabandonedretry']>=_0x1abfd3['dialAbandonedMaxRetry']-0x1){return!![];}this[_0xd81f('0xc3')]({'active':![],'countabandonedretry':_0x4de123[_0xd81f('0xfe')]+=0x1,'scheduledat':moment()[_0xd81f('0x10b')](_0x1abfd3[_0xd81f('0x12b')],'minutes')[_0xd81f('0x7c')](_0xd81f('0x10c')),'ContactId':_0x4de123['ContactId'],'ListId':_0x4de123[_0xd81f('0xda')],'VoiceQueueId':_0x4de123[_0xd81f('0xdc')]||undefined,'CampaignId':_0x4de123['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x4de123[_0xd81f('0xff')]>=_0x1abfd3['dialMachineMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x4de123['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x1abfd3[_0xd81f('0x105')],_0xd81f('0x106'))[_0xd81f('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4de123[_0xd81f('0xd9')],'ListId':_0x4de123[_0xd81f('0xda')],'VoiceQueueId':_0x4de123[_0xd81f('0xdc')]||undefined,'CampaignId':_0x4de123[_0xd81f('0xdd')]||undefined})[_0xd81f('0xb4')](loggerCatch(_0xd81f('0x107')));break;case 0x14:if(_0x4de123[_0xd81f('0x100')]>=_0x1abfd3[_0xd81f('0x1a9')]-0x1){return!![];}this[_0xd81f('0xc3')]({'active':![],'countagentrejectretry':_0x4de123[_0xd81f('0x100')]+=0x1,'scheduledat':moment()[_0xd81f('0x10b')](_0x1abfd3[_0xd81f('0x1aa')],_0xd81f('0x106'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4de123[_0xd81f('0xd9')],'ListId':_0x4de123[_0xd81f('0xda')],'VoiceQueueId':_0x4de123['VoiceQueueId']||undefined,'CampaignId':_0x4de123[_0xd81f('0xdd')]||undefined})[_0xd81f('0xb4')](loggerCatch(_0xd81f('0x1ab')));break;default:return!![];}};Dialer[_0xd81f('0x1f')][_0xd81f('0x19a')]=function(_0x2a001e,_0xda16a0,_0x4de87b){var _0x5ae7e3=this;var _0xf66ace=new History(_0x2a001e);return new BPromise(function(_0x42a67c,_0x2cd0ed){if(_[_0xd81f('0x42')](_0xda16a0)&&typeof _0xda16a0!==_0xd81f('0x16c')){return _0x2cd0ed(msgResponse('[callProgressDetecting]',_0xd81f('0x14a'),_0xd81f('0x1ac')));}if(_[_0xd81f('0x42')](_0x4de87b)&&typeof _0x4de87b!==_0xd81f('0x16c')){return _0x2cd0ed(msgResponse(_0xd81f('0x1ad'),'Failure',_0xd81f('0x1ae')));}switch(_0x4de87b[_0xd81f('0x114')]){case'0':_0xda16a0[_0xd81f('0x69')]+=0x1;_0xf66ace[_0xd81f('0xac')]=0x0;_0xf66ace[_0xd81f('0xad')]='NoSuchNumber';_0xf66ace['countnosuchnumberretry']+=0x1;_0xf66ace[_0xd81f('0xf7')]+=0x1;ami[_0xd81f('0xef')](_0xd81f('0x1af'),ut['buildObj'](_0x2a001e,_0xd81f('0x1b0')));_0x5ae7e3['createHistory'](_0xf66ace)[_0xd81f('0xb4')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5ae7e3['checkRetriveMax'](0x0,_0x2a001e,_0xda16a0)){if(_0xf66ace[_0xd81f('0xfc')]>=_0xda16a0[_0xd81f('0x1a6')]){_0x5ae7e3[_0xd81f('0x103')](_0xf66ace,_0x42a67c,_0x2cd0ed,_0xd81f('0x1b1'));}else{_0x5ae7e3[_0xd81f('0x10a')](_0xf66ace,_0x42a67c,_0x2cd0ed,_0xd81f('0x1b1'));}}break;case'3':_0xda16a0['outboundNoAnswerCallsDay']+=0x1;_0xf66ace[_0xd81f('0xac')]=0x3;_0xf66ace[_0xd81f('0xad')]=_0xd81f('0x1b2');_0xf66ace['countnoanswerretry']+=0x1;_0xf66ace[_0xd81f('0xf7')]+=0x1;ami[_0xd81f('0xef')](_0xd81f('0x1b3'),ut[_0xd81f('0xf8')](_0x2a001e,_0xd81f('0x1b4')));_0x5ae7e3['createHistory'](_0xf66ace)[_0xd81f('0xb4')](loggerCatch(_0xd81f('0x1b5')));if(_0x5ae7e3[_0xd81f('0x19c')](0x3,_0x2a001e,_0xda16a0)){if(_0xf66ace[_0xd81f('0xfb')]>=_0xda16a0[_0xd81f('0x19e')]){_0x5ae7e3['createStateFinal'](_0xf66ace,_0x42a67c,_0x2cd0ed,'reason\x203\x20ringing\x20no\x20answer');}else{_0x5ae7e3['stateGlobal'](_0xf66ace,_0x42a67c,_0x2cd0ed,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0xda16a0['outboundBusyCallsDay']+=0x1;_0xf66ace['state']=0x5;_0xf66ace[_0xd81f('0xad')]=_0xd81f('0x1b6');_0xf66ace[_0xd81f('0x109')]+=0x1;_0xf66ace[_0xd81f('0xf7')]+=0x1;ami[_0xd81f('0xef')](_0xd81f('0x1b7'),ut[_0xd81f('0xf8')](_0x2a001e,_0xd81f('0x1b8')));_0x5ae7e3['createHistory'](_0xf66ace)[_0xd81f('0xb4')](loggerCatch(_0xd81f('0x1b9')));if(_0x5ae7e3[_0xd81f('0x19c')](0x5,_0x2a001e,_0xda16a0)){if(_0xf66ace['countbusyretry']>=_0xda16a0[_0xd81f('0x1a1')]){_0x5ae7e3[_0xd81f('0x103')](_0xf66ace,_0x42a67c,_0x2cd0ed,_0xd81f('0x1ba'));}else{_0x5ae7e3[_0xd81f('0x10a')](_0xf66ace,_0x42a67c,_0x2cd0ed,_0xd81f('0x1ba'));}}break;case'8':_0xda16a0['outboundCongestionCallsDay']+=0x1;_0xf66ace[_0xd81f('0xac')]=0x8;_0xf66ace[_0xd81f('0xad')]=_0xd81f('0x1bb');_0xf66ace[_0xd81f('0xfa')]+=0x1;_0xf66ace[_0xd81f('0xf7')]+=0x1;ami[_0xd81f('0xef')](_0xd81f('0x1bc'),ut['buildObj'](_0x2a001e,_0xd81f('0x1bd')));_0x5ae7e3[_0xd81f('0xcf')](_0xf66ace)[_0xd81f('0xb4')](loggerCatch(_0xd81f('0x1be')));if(_0x5ae7e3[_0xd81f('0x19c')](0x8,_0x2a001e,_0xda16a0)){if(_0xf66ace[_0xd81f('0xfa')]>=_0xda16a0[_0xd81f('0x1a4')]){_0x5ae7e3['createStateFinal'](_0xf66ace,_0x42a67c,_0x2cd0ed,'reason\x208\x20congestion');}else{_0x5ae7e3[_0xd81f('0x10a')](_0xf66ace,_0x42a67c,_0x2cd0ed,_0xd81f('0x1bf'));}}break;case'11':_0xda16a0[_0xd81f('0x1c0')]+=0x1;_0xf66ace[_0xd81f('0xac')]=0xb;_0xf66ace[_0xd81f('0xad')]='Abandoned';_0xf66ace[_0xd81f('0xfe')]+=0x1;_0xf66ace[_0xd81f('0xf7')]+=0x1;_0x5ae7e3[_0xd81f('0xcf')](_0xf66ace)[_0xd81f('0xb4')](loggerCatch(_0xd81f('0x12c')));if(_0x5ae7e3[_0xd81f('0x19c')](0xb,_0x2a001e,_0xda16a0)){if(_0xf66ace['countabandonedretry']>=_0xda16a0[_0xd81f('0x12a')]){_0x5ae7e3[_0xd81f('0x103')](_0xf66ace,_0x42a67c,_0x2cd0ed,_0xd81f('0x1c1'));}else{_0x5ae7e3[_0xd81f('0x10a')](_0xf66ace,_0x42a67c,_0x2cd0ed,'reason\x2011\x20abandoned');}}break;case'20':_0xda16a0[_0xd81f('0x1c2')]+=0x1;_0xf66ace[_0xd81f('0xac')]=0x14;_0xf66ace[_0xd81f('0xad')]='AgentReject';_0xf66ace[_0xd81f('0x100')]+=0x1;_0xf66ace[_0xd81f('0xf7')]+=0x1;ami[_0xd81f('0xef')]('custom:agentreject',ut[_0xd81f('0xf8')](_0x2a001e,_0xd81f('0x1c3')));_0x5ae7e3[_0xd81f('0xcf')](_0xf66ace)[_0xd81f('0xb4')](loggerCatch(_0xd81f('0x1c4')));if(_0x5ae7e3[_0xd81f('0x19c')](0x14,_0x2a001e,_0xda16a0)){if(_0xf66ace[_0xd81f('0x100')]>=_0xda16a0[_0xd81f('0x1a9')]){_0x5ae7e3[_0xd81f('0x103')](_0xf66ace,_0x42a67c,_0x2cd0ed,_0xd81f('0x1c5'));}else{_0x5ae7e3[_0xd81f('0x10a')](_0xf66ace,_0x42a67c,_0x2cd0ed,_0xd81f('0x1c5'));}}break;default:_0xda16a0[_0xd81f('0x6b')]+=0x1;_0xf66ace[_0xd81f('0xac')]=0xc;_0xf66ace[_0xd81f('0xad')]=_0x4de87b['reason'];_0x5ae7e3[_0xd81f('0xcf')](_0xf66ace)[_0xd81f('0xb4')](loggerCatch(_0xd81f('0x1c6')));if(_0x5ae7e3[_0xd81f('0x19c')](_0x4de87b[_0xd81f('0x114')],_0x2a001e,_0xda16a0)){if(_0xf66ace[_0xd81f('0x109')]+_0xf66ace['countcongestionretry']+_0xf66ace[_0xd81f('0xfb')]+_0xf66ace[_0xd81f('0xfc')]+_0xf66ace['countdropretry']+_0xf66ace['countabandonedretry']+_0xf66ace[_0xd81f('0xff')]+_0xf66ace[_0xd81f('0x100')]>=_0xda16a0[_0xd81f('0x19d')]){_0x5ae7e3[_0xd81f('0x10a')](_0xf66ace,_0x42a67c,_0x2cd0ed,_0x4de87b['reason']);}else{_0x5ae7e3[_0xd81f('0x103')](_0xf66ace,_0x42a67c,_0x2cd0ed,_0x4de87b[_0xd81f('0x114')]);}}}});};Dialer['prototype']['stateGlobal']=function(_0x521990,_0x1f96f4,_0x5207c3,_0x117433){var _0x16abc1=new Final(_0x521990);_0x16abc1[_0xd81f('0xac')]=0xf;_0x16abc1[_0xd81f('0xad')]=_0xd81f('0x1c7');this[_0xd81f('0x103')](_0x16abc1,_0x1f96f4,_0x5207c3,_0x117433);};Dialer['prototype'][_0xd81f('0x103')]=function(_0x3678aa,_0xc8e329,_0x52d2b6,_0x1d0914){this[_0xd81f('0xcd')](_0x3678aa)[_0xd81f('0xba')](function(){return _0xc8e329(msgResponse(_0xd81f('0x1ad'),'Success',_0x1d0914));})[_0xd81f('0xb4')](function(){return _0x52d2b6(msgResponse(_0xd81f('0x1c8'),_0xd81f('0x14a'),_0xd81f('0x1c9')));});};Dialer['prototype'][_0xd81f('0xa')]=function(_0x456f30){var _0x3af46c=_0x456f30[_0xd81f('0x1ca')]/0x64;var _0x4d7ea9=_0x456f30['outboundDropCallsDayTimeout']/(_0x456f30[_0xd81f('0x67')]+_0x456f30[_0xd81f('0xec')]);var _0x345f73=Math[_0xd81f('0x1cb')](_0x456f30[_0xd81f('0x73')]*(_0x456f30[_0xd81f('0x1cc')]/0x64));var _0x104847=Math[_0xd81f('0x1cb')](_0x456f30[_0xd81f('0x73')]*(_0x456f30[_0xd81f('0x1cd')]/0x64));var _0x358e86=_0x456f30['available']+_0x456f30[_0xd81f('0x5b')];var _0x75cf1f=Math[_0xd81f('0x1ce')](_0x456f30[_0xd81f('0x76')]*_0x456f30[_0xd81f('0x77')]*_0x456f30[_0xd81f('0x71')]*_0x456f30[_0xd81f('0x72')]);if(_[_0xd81f('0x42')](_0x456f30[_0xd81f('0x2e')])){if(!_[_0xd81f('0x42')](_0x456f30[_0xd81f('0x2d')])){_0x456f30['startPredictive']=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0xd81f('0x1cf'));}if(!_[_0xd81f('0x42')](_0x456f30[_0xd81f('0x93')])){loggerPredictive[_0xd81f('0x99')]('[startMethodPredictive][StartProgressive]',_0xd81f('0x1d0'));clearInterval(_0x456f30['handlePredictive']);_0x456f30[_0xd81f('0x93')]=undefined;}_0x456f30['startProgressive']=moment()['format'](_0xd81f('0x10c'));loggerPredictive[_0xd81f('0x81')](_0x456f30['name'],'collection\x20data\x20in\x20progressive\x20at',_0x456f30[_0xd81f('0x2e')]);this[_0xd81f('0x15d')](_0x456f30,0x1);}else if(ifInterval(_0x456f30[_0xd81f('0x1d1')],_0x456f30[_0xd81f('0x2e')])){this[_0xd81f('0x15d')](_0x456f30,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x456f30[_0xd81f('0x2e')],_0x456f30[_0xd81f('0x45')]);_0x456f30['erlangCalls']=0x0;_0x456f30['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x3af46c<_0x4d7ea9&&_0x456f30['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x456f30);loggerPredictive[_0xd81f('0x81')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x4d7ea9,_0xd81f('0x2e'),_0x456f30['name']);}else if(_0x75cf1f<_0x456f30[_0xd81f('0x1d2')]&&_0x456f30[_0xd81f('0x1d3')]===_0xd81f('0x1d4')){freeVariablesPredictive(_0x456f30);loggerPredictive[_0xd81f('0x81')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xd81f('0x1d5'),_0x75cf1f,_0xd81f('0x1d6'),_0x456f30[_0xd81f('0x1d2')],_0xd81f('0x2e'),_0x456f30[_0xd81f('0x45')]);}else if(!ifInterval(_0x456f30['dialPredictiveInterval'],_0x456f30['startProgressive'])&&_[_0xd81f('0x42')](_0x456f30[_0xd81f('0x2d')])&&!_[_0xd81f('0x42')](_0x456f30['startProgressive'])){_0x456f30[_0xd81f('0x2d')]=moment()['format'](_0xd81f('0x10c'));loggerPredictive[_0xd81f('0x81')](_0x456f30[_0xd81f('0x45')],_0xd81f('0x1d7'),_0x456f30[_0xd81f('0x2d')]);this['averageHandleTime'](_0x456f30[_0xd81f('0x1d1')])[_0xd81f('0xba')](this[_0xd81f('0x1d8')](_0x456f30))['then'](mergeDataErlangB(_0x456f30))[_0xd81f('0xba')](this['startMethodPredictive'](_0x456f30))[_0xd81f('0xb4')](loggerCatchPredictive(_0xd81f('0x1d9'),_0x456f30));}else if(!ifInterval(_0x456f30['dialPredictiveInterval'],_0x456f30[_0xd81f('0x2d')])){_0x456f30[_0xd81f('0x1d2')]=0x0;_0x456f30[_0xd81f('0x2d')]=moment()[_0xd81f('0x7c')](_0xd81f('0x10c'));loggerPredictive['info'](_0x456f30['name'],_0xd81f('0x1da'),_0x456f30[_0xd81f('0x2d')]);clearInterval(_0x456f30[_0xd81f('0x93')]);_0x456f30[_0xd81f('0x93')]=undefined;this[_0xd81f('0x1db')](_0x456f30['dialPredictiveInterval'])[_0xd81f('0xba')](this[_0xd81f('0x1d8')](_0x456f30))[_0xd81f('0xba')](mergeDataErlangB(_0x456f30))[_0xd81f('0xba')](this['startMethodPredictive'](_0x456f30))[_0xd81f('0xb4')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x456f30));}else if(_0x456f30[_0xd81f('0x73')]&&_0x358e86<_0x456f30[_0xd81f('0x73')]-_0x104847){freeVariablesPredictive(_0x456f30);loggerPredictive[_0xd81f('0x81')](_0x456f30[_0xd81f('0x45')],_0xd81f('0x1dc'),_0x358e86,_0xd81f('0x1dd'),_0x456f30[_0xd81f('0x73')],'-',_0x104847,'=',_0x456f30[_0xd81f('0x73')]-_0x104847,')');}else if(_0x456f30[_0xd81f('0x73')]&&_0x358e86>_0x456f30[_0xd81f('0x73')]+_0x345f73){freeVariablesPredictive(_0x456f30);loggerPredictive[_0xd81f('0x81')](_0x456f30[_0xd81f('0x45')],_0xd81f('0x1dc'),_0x358e86,')\x20are\x20more\x20than\x20threshold\x20(',_0x456f30[_0xd81f('0x73')],'+',_0x345f73,'=',_0x456f30[_0xd81f('0x73')]+_0x345f73,')');}};Dialer[_0xd81f('0x1f')][_0xd81f('0x1d8')]=function(_0x4fb221){var _0x3fb34c=this;return function(_0xa3dbda){return new BPromise(function(_0x220453,_0x1d621e){_[_0xd81f('0xd7')](_0x4fb221,_0xa3dbda[0x0]);if(checkGetDataPredictive(_0xa3dbda[0x0])){var _0x34ceb2=_0x4fb221['predictiveIntervalAvailable']=_0x4fb221[_0xd81f('0x5b')]+_0x4fb221['available'];var _0x50ac03=_0x4fb221[_0xd81f('0x1d1')]*0x3c;var _0x4136d8=_0xa3dbda[0x0]['predictiveIntervalAvgTalktime']+_0xa3dbda[0x0][_0xd81f('0x6d')];var _0x100c64=(_0xa3dbda[0x0]['predictiveIntervalAnsweredCalls']+_0xa3dbda[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xa3dbda[0x0][_0xd81f('0x6f')])/_0xa3dbda[0x0][_0xd81f('0x74')];_0x4fb221[_0xd81f('0x71')]=_0x100c64>0x0?_0x100c64:0x1;switch(_0x4fb221[_0xd81f('0x1d3')]){case _0xd81f('0x1d4'):var _0x30a6ab=_0x4fb221[_0xd81f('0x1ca')]/0x64;return _0x3fb34c[_0xd81f('0x1de')](_0x34ceb2,_0x50ac03,_0x4136d8,_0x100c64,_0x30a6ab)[_0xd81f('0xba')](function(_0x56d77e){return _0x220453(_0x56d77e);});case'agentBusyFactor':var _0x4ccfce=_0x4fb221[_0xd81f('0x1ca')]/0x64;return _0x3fb34c['busyFactor'](_0x34ceb2,_0x50ac03,_0x4136d8,_0x100c64,_0x4ccfce)[_0xd81f('0xba')](function(_0x32eead){return _0x220453(_0x32eead);});default:return _0x1d621e(msgResponse(_0xd81f('0x1df'),_0xd81f('0x14a'),_0xd81f('0x1e0')));}}else{return _0x1d621e(msgResponse(_0xd81f('0x1df'),'Failure',_0xd81f('0x1e1')));}});};};Dialer[_0xd81f('0x1f')][_0xd81f('0x1e2')]=function(_0x1844f4){var _0x51eaf2=this;return function(_0x572ba0){return new BPromise(function(_0x1ff739,_0x5b660e){_[_0xd81f('0xd7')](_0x1844f4,_0x572ba0[0x0]);if(checkGetDataPredictive(_0x572ba0[0x0])){loggerPredictive[_0xd81f('0x81')](JSON[_0xd81f('0x7b')](_0x572ba0[0x0]));if(_0x1844f4[_0xd81f('0x1d3')]==='dropRate'){return _0x51eaf2['getVoiceQueueRtPauses'](_0x1844f4['id'])['then'](function(_0x548172){var _0x47bd5f=_0x1844f4[_0xd81f('0x162')]-_0x548172[0x0][_0xd81f('0x1e3')];var _0x1d9b44=_0x1844f4[_0xd81f('0x1d1')]*0x3c;var _0x396c27=_0x572ba0[0x0][_0xd81f('0x6e')]+_0x572ba0[0x0][_0xd81f('0x6d')];var _0x1825da=(_0x572ba0[0x0][_0xd81f('0x6c')]+_0x572ba0[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x572ba0[0x0][_0xd81f('0x6f')])/_0x572ba0[0x0][_0xd81f('0x74')];var _0x5041d9=_0x1844f4[_0xd81f('0x1ca')]/0x64;_0x1844f4[_0xd81f('0x1e4')]=_0x548172[0x0][_0xd81f('0x1e3')]||0x0;_0x1844f4[_0xd81f('0x71')]=_0x1825da>0x0?_0x1825da:0x1;return _0x51eaf2[_0xd81f('0x1de')](_0x47bd5f,_0x1d9b44,_0x396c27,_0x1825da,_0x5041d9);})['then'](function(_0xe528e0){return _0x1ff739(_0xe528e0);})['catch'](function(_0x2f4b46){return _0x5b660e(msgResponse(_0xd81f('0x1e5'),_0xd81f('0x14a'),JSON['stringify'](_0x2f4b46)));});}if(_0x1844f4['dialPredictiveOptimization']==='agentBusyFactor'){return _0x51eaf2[_0xd81f('0xcb')](_0x1844f4['id'])[_0xd81f('0xba')](function(_0x4a2d4c){var _0x300ceb=_0x1844f4[_0xd81f('0x162')]-_0x4a2d4c[0x0][_0xd81f('0x1e3')];var _0x1099d2=_0x1844f4[_0xd81f('0x1d1')]*0x3c;var _0x1a2f83=_0x572ba0[0x0][_0xd81f('0x6e')]+_0x572ba0[0x0][_0xd81f('0x6d')];var _0x1a3ab7=(_0x572ba0[0x0]['predictiveIntervalAnsweredCalls']+_0x572ba0[0x0][_0xd81f('0x86')]+_0x572ba0[0x0][_0xd81f('0x6f')])/_0x572ba0[0x0][_0xd81f('0x74')];var _0x5f0ad3=_0x1844f4['dialPredictiveOptimizationPercentage']/0x64;_0x1844f4['predictiveIntervalPauses']=_0x4a2d4c[0x0][_0xd81f('0x1e3')]||0x0;_0x1844f4['predictiveIntervalHitRate']=_0x1a3ab7>0x0?_0x1a3ab7:0x1;return _0x51eaf2['busyFactor'](_0x300ceb,_0x1099d2,_0x1a2f83,_0x1a3ab7,_0x5f0ad3);})[_0xd81f('0xba')](function(_0x49c0f2){return _0x1ff739(_0x49c0f2);})[_0xd81f('0xb4')](function(_0x1b94b6){return _0x5b660e(msgResponse('[CatchErlangB]',_0xd81f('0x14a'),JSON['stringify'](_0x1b94b6)));});}}else{return _0x5b660e(msgResponse('[getDataPredictive]',_0xd81f('0x14a'),'check\x20failure'));}});};};Dialer[_0xd81f('0x1f')]['startMethodPredictive']=function(_0x4f5ce9){var _0x29c8e1=this;return function(){var _0x5e8fb2=0x0;var _0x5aee29=Math['floor'](_0x4f5ce9[_0xd81f('0x1e6')]*0x3e8);if(_0x5aee29>0x0){_0x5aee29=_0x5aee29<0x64?0x64:_0x5aee29;loggerPredictive[_0xd81f('0x81')](_0x4f5ce9[_0xd81f('0x45')],_0xd81f('0x1e7'),_0x5aee29,_0xd81f('0x50'));_0x4f5ce9['handlePredictive']=setInterval(function(){_0x29c8e1[_0xd81f('0x93')](_0x4f5ce9);loggerPredictiveCalls[_0xd81f('0x81')]('[handlePredictive]',_0x5e8fb2+=0x1);},_0x5aee29);}else{loggerPredictive[_0xd81f('0x81')](_0x4f5ce9[_0xd81f('0x45')],_0xd81f('0x1e8'));}};};Dialer[_0xd81f('0x1f')][_0xd81f('0x1e9')]=function(_0x548479,_0x354312){var _0x1194b1=this;return function(_0x5968bd){if(_[_0xd81f('0x4d')](_0x5968bd)){if(_['isNil'](_0x354312[_0xd81f('0xdb')])||!_0x354312[_0xd81f('0x1ea')]){if(_0x548479[_0xd81f('0x161')]===_0xd81f('0x8')){_0x548479[_0xd81f('0x133')]=_[_0xd81f('0x42')](_0x548479[_0xd81f('0x133')])?!![]:_0x548479['queueStatusComplete'];var _0x3a95eb=uuid['v4']();_0x1194b1[_0xd81f('0x29')][_0x3a95eb]=new Action(_0x548479,_0x354312,_0x3a95eb);loggerBooked['info'](_0xd81f('0x1eb'),_0x3a95eb,_0xd81f('0x1ec'),JSON[_0xd81f('0x7b')](_0x548479[_0xd81f('0x133')]),_0xd81f('0x1ed'),_0x548479[_0xd81f('0x45')]);if(_0x548479[_0xd81f('0x133')]){_0x548479[_0xd81f('0x133')]=![];_0x1194b1[_0xd81f('0x30')][_0x1194b1['actions'][_0x3a95eb][_0xd81f('0xb8')]]=[];ami['Action']({'actionid':_0x3a95eb,'action':_0xd81f('0x1ee'),'queue':_0x548479[_0xd81f('0x45')]})[_0xd81f('0xb4')](function(){_0x1194b1[_0xd81f('0xb6')](_0x548479);_0x1194b1['rescheduleContact']({'active':![],'ContactId':_0x1194b1['actions'][_0x3a95eb][_0xd81f('0xd9')],'ListId':_0x1194b1['actions'][_0x3a95eb][_0xd81f('0xda')],'VoiceQueueId':_0x1194b1[_0xd81f('0x29')][_0x3a95eb][_0xd81f('0xdc')]||undefined,'CampaignId':_0x1194b1[_0xd81f('0x29')][_0x3a95eb][_0xd81f('0xdd')]||undefined})[_0xd81f('0xb4')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x1194b1[_0xd81f('0x29')][_0x3a95eb];});}else{loggerBooked[_0xd81f('0x81')](_0xd81f('0x1ef'),JSON[_0xd81f('0x7b')](_0x548479[_0xd81f('0x133')]),_0xd81f('0x1ed'),_0x548479[_0xd81f('0x45')]);_0x1194b1[_0xd81f('0xb6')](_0x548479);_0x1194b1[_0xd81f('0xc3')]({'active':![],'ContactId':_0x1194b1[_0xd81f('0x29')][_0x3a95eb]['ContactId'],'ListId':_0x1194b1[_0xd81f('0x29')][_0x3a95eb][_0xd81f('0xda')],'VoiceQueueId':_0x1194b1['actions'][_0x3a95eb][_0xd81f('0xdc')]||undefined,'CampaignId':_0x1194b1[_0xd81f('0x29')][_0x3a95eb][_0xd81f('0xdd')]||undefined})[_0xd81f('0xb4')](loggerCatch(_0xd81f('0x1f0')));delete _0x1194b1[_0xd81f('0x29')][_0x3a95eb];}}else{return _0x1194b1[_0xd81f('0x16b')](_0x548479,_0x354312);}}else{if(getDiff(_0x354312[_0xd81f('0x1f1')])<_0x548479[_0xd81f('0x1f2')]*0x3c){if(_0x354312[_0xd81f('0x1f3')]&&!_0x354312['Agent'][_0xd81f('0x1f4')]){_0x1194b1[_0xd81f('0x95')][_0xd81f('0x135')](_0x354312['id'])[_0xd81f('0x21')](function(){_0x1194b1[_0xd81f('0xb6')](_0x548479);});}else{_0x1194b1['unlockContact']({'active':![]},_0x354312['id'],0x1)[_0xd81f('0x21')](function(){_0x1194b1[_0xd81f('0xb6')](_0x548479);});}}else{_0x548479['outboundReCallsDay']+=0x1;_0x1194b1[_0xd81f('0xb6')](_0x548479);if(_0x548479[_0xd81f('0x1f5')]){_0x1194b1[_0xd81f('0xc3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x354312['ContactId'],'ListId':_0x354312[_0xd81f('0xda')],'VoiceQueueId':_0x354312['VoiceQueueId']||undefined,'CampaignId':_0x354312[_0xd81f('0xdd')]||undefined})[_0xd81f('0xb4')](loggerCatch(_0xd81f('0x1f6')));_0x1194b1[_0xd81f('0xcf')](createObjHistory(_0x548479,_0x354312,_0xd81f('0x1f7'),0x17,_0xd81f('0x1f8')))[_0xd81f('0xb4')](loggerCatch(_0xd81f('0x1f9')));}else{_0x1194b1[_0xd81f('0xd6')](createObjHistory(_0x548479,_0x354312,_0xd81f('0x1fa'),0x16,_0xd81f('0x1fb')),'[Originate][HistoryRecallClose][historyCatch]',_0xd81f('0x1fc'));}}}}else{_0x548479[_0xd81f('0x64')]+=0x1;_0x1194b1['saveInDb'](createObjHistory(_0x548479,_0x354312,_0xd81f('0x1fd'),0xd,_0xd81f('0x1fe')),_0xd81f('0x1ff'),_0xd81f('0x200'));throw _0xd81f('0x201');}};};Dialer[_0xd81f('0x1f')][_0xd81f('0x160')]=function(_0x4d6578){var _0x59a0bd=this;var _0x38e7f4=_0x4d6578[_0xd81f('0x202')]-_0x4d6578[_0xd81f('0x75')]-_0x4d6578[_0xd81f('0xc8')];emitCampaignSummary(_0x4d6578);if(_0x38e7f4>0x0){if(_0x38e7f4>this[_0xd81f('0x27')]){_0x38e7f4=this[_0xd81f('0x27')];}_0x4d6578[_0xd81f('0xc8')]+=_0x38e7f4;this[_0xd81f('0xc9')](_0x4d6578['id'],_0x38e7f4,_0x4d6578['dialOrderByScheduledAt'],_0x4d6578)[_0xd81f('0xba')](function(_0x42d4c6){_0x4d6578[_0xd81f('0xc8')]-=_0x38e7f4;_0x4d6578[_0xd81f('0xc8')]=_0x4d6578['temp']>0x0?_0x4d6578[_0xd81f('0xc8')]:0x0;if(!checkContactEmpty(_0x42d4c6)){_0x4d6578[_0xd81f('0x43')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xd81f('0x81')]('[getContactCampaign2][Empty]'+_0x4d6578[_0xd81f('0x45')]);}else{_0x4d6578[_0xd81f('0x75')]+=_0x42d4c6[_0xd81f('0x9c')];_0x4d6578[_0xd81f('0x43')]=_0xd81f('0x203');for(var _0x234558=0x0;_0x234558<_0x42d4c6[_0xd81f('0x9c')];_0x234558+=0x1){_0x4d6578[_0xd81f('0x204')]+=0x1;if(_[_0xd81f('0xb2')](_0x42d4c6[_0x234558])||_[_0xd81f('0xb2')](_0x42d4c6[_0x234558]['Contact'])||_[_0xd81f('0xb2')](_0x42d4c6[_0x234558][_0xd81f('0x16e')][_0xd81f('0x16f')])){_0x59a0bd[_0xd81f('0xd4')](_0xd81f('0x205'),_0x4d6578,_0x42d4c6[_0x234558]);}else{_0x59a0bd[_0xd81f('0xbf')](_[_0xd81f('0xd8')](_0x42d4c6[_0x234558],[_0xd81f('0xdd'),_0xd81f('0x206')]))['then'](_0x59a0bd['checkContactBlack'](_0x4d6578,_0x42d4c6[_0x234558]))[_0xd81f('0xb4')](_0x59a0bd[_0xd81f('0xd3')]('[actionOriginateIvr]\x20',_0x4d6578));}}}})[_0xd81f('0xb4')](loggerGetContactDialer(_0xd81f('0x207'),_0x4d6578,_0x38e7f4));}};Dialer['prototype'][_0xd81f('0x15d')]=function(_0x35f18f,_0x473f84){var _0xcd6945=this;var _0x4fb0db=[];var _0x4cf0e3=_0x473f84>=0x1?_0x473f84:0x1;if(_0x35f18f[_0xd81f('0x161')]===_0xd81f('0x8')){_0x4cf0e3=0x1;}var _0x50ac61=Math[_0xd81f('0x1ce')](_0x35f18f[_0xd81f('0x57')]*_0x4cf0e3)-_0x35f18f['originated']-_0x35f18f[_0xd81f('0xc8')];emitVoiceQueueSummary(_0x35f18f);if(_0x35f18f['dialLimitQueue']>0x0){var _0x42d6a6=_0x35f18f[_0xd81f('0x208')]-_0x35f18f[_0xd81f('0x75')]-_0x35f18f[_0xd81f('0x5b')]-_0x35f18f['temp']-_0x35f18f[_0xd81f('0x58')];if(_0x50ac61>_0x42d6a6){_0x50ac61=_0x42d6a6;}}if(_0x50ac61>0x0){if(_0x35f18f[_0xd81f('0x161')]===_0xd81f('0x8')){_0x50ac61=0x1;}if(_0x50ac61>this[_0xd81f('0x27')]){_0x50ac61=this[_0xd81f('0x27')];}_0x35f18f['temp']+=_0x50ac61;for(var _0x393813 in this[_0xd81f('0x25')]){if(typeof this[_0xd81f('0x25')][_0x393813]!==_0xd81f('0x9d')){if(this[_0xd81f('0x25')][_0x393813][_0xd81f('0xac')]===_0xd81f('0x209')&&this[_0xd81f('0x25')][_0x393813][_0xd81f('0xb3')]===_0xd81f('0xe3')){_0x4fb0db[_0xd81f('0x14f')](this[_0xd81f('0x25')][_0x393813]['id']);}}}this[_0xd81f('0xc7')](_0x35f18f['id'],_0x4fb0db,_0x50ac61,_0x35f18f[_0xd81f('0x20a')],_0x35f18f)[_0xd81f('0xba')](function(_0x88bcfe){_0x35f18f[_0xd81f('0xc8')]-=_0x50ac61;_0x35f18f['temp']=_0x35f18f[_0xd81f('0xc8')]>0x0?_0x35f18f[_0xd81f('0xc8')]:0x0;if(!checkContactEmpty(_0x88bcfe)){_0xcd6945[_0xd81f('0xb9')](_0x35f18f)[_0xd81f('0xba')](sendMessageReschedule(_0x35f18f))[_0xd81f('0xb4')](loggerCatch(_0xd81f('0xbb')));}else{_0x35f18f[_0xd81f('0x75')]+=_0x88bcfe[_0xd81f('0x9c')];_0x35f18f[_0xd81f('0x43')]=_0x35f18f[_0xd81f('0x161')]===_0xd81f('0x8')?_0xd81f('0x20b'):_0xd81f('0x203');for(var _0x5c60d4=0x0;_0x5c60d4<_0x88bcfe['length'];_0x5c60d4+=0x1){if(_[_0xd81f('0xb2')](_0x88bcfe[_0x5c60d4])||_[_0xd81f('0xb2')](_0x88bcfe[_0x5c60d4][_0xd81f('0x16e')])||_[_0xd81f('0xb2')](_0x88bcfe[_0x5c60d4][_0xd81f('0x16e')]['phone'])){_0xcd6945[_0xd81f('0xd4')](_0xd81f('0x205'),_0x35f18f,_0x88bcfe[_0x5c60d4]);}else{_0xcd6945[_0xd81f('0xbc')](_[_0xd81f('0xd8')](_0x88bcfe[_0x5c60d4],[_0xd81f('0xdc'),_0xd81f('0x206')]))[_0xd81f('0xba')](_0xcd6945[_0xd81f('0x1e9')](_0x35f18f,_0x88bcfe[_0x5c60d4]))[_0xd81f('0xb4')](_0xcd6945['loggerHandler'](_0xd81f('0x205'),_0x35f18f));}}}})['catch'](loggerGetContactDialer(_0xd81f('0x20c'),_0x35f18f,_0x50ac61));}};Dialer[_0xd81f('0x1f')]['handlePredictive']=function(_0x4d8b5d){if(_0x4d8b5d[_0xd81f('0x208')]>0x0){var _0x1e261d=_0x4d8b5d[_0xd81f('0x208')]-_0x4d8b5d[_0xd81f('0x75')]-_0x4d8b5d['talking'];if(_0x1e261d>0x0){this[_0xd81f('0x20d')](_0x4d8b5d);}else{loggerPredictiveCalls[_0xd81f('0x81')](_0xd81f('0x20e'));}}else{this[_0xd81f('0x20d')](_0x4d8b5d);}};Dialer[_0xd81f('0x1f')][_0xd81f('0x20d')]=function(_0x53d89b){var _0xfaff03=this;var _0x5bfc0d=[];_0x53d89b[_0xd81f('0x75')]+=0x1;for(var _0x414bcc in this[_0xd81f('0x25')]){if(typeof this['agents'][_0x414bcc]!==_0xd81f('0x9d')){if(this[_0xd81f('0x25')][_0x414bcc][_0xd81f('0xac')]===_0xd81f('0x209')&&this[_0xd81f('0x25')][_0x414bcc]['status']===_0xd81f('0xe3')){_0x5bfc0d[_0xd81f('0x14f')](this[_0xd81f('0x25')][_0x414bcc]['id']);}}}this[_0xd81f('0xc7')](_0x53d89b['id'],_0x5bfc0d,0x1,_0x53d89b[_0xd81f('0x20a')],_0x53d89b)['then'](function(_0x242ece){if(!checkContactEmpty(_0x242ece)){checkContactLowerLimitOriginate(_0x53d89b,0x1,0x0);_0xfaff03[_0xd81f('0xb9')](_0x53d89b)['then'](sendMessageReschedule(_0x53d89b))['catch'](loggerCatch(_0xd81f('0xbb')));}else{_0x53d89b['message']=_0xd81f('0x203');if(_[_0xd81f('0xb2')](_0x242ece[0x0])||_[_0xd81f('0xb2')](_0x242ece[0x0]['Contact'])||_[_0xd81f('0xb2')](_0x242ece[0x0][_0xd81f('0x16e')]['phone'])){_0xfaff03['emptyContact'](_0xd81f('0x205'),_0x53d89b,_0x242ece[0x0]);}else{_0xfaff03[_0xd81f('0xbc')](_['pick'](_0x242ece[0x0],[_0xd81f('0xdc'),'Contact.phone']))['then'](_0xfaff03[_0xd81f('0x1e9')](_0x53d89b,_0x242ece[0x0]))[_0xd81f('0xb4')](_0xfaff03[_0xd81f('0xd3')](_0xd81f('0x20f'),_0x53d89b));}}})[_0xd81f('0xb4')](loggerGetContactDialer(_0xd81f('0x210'),_0x53d89b,0x1));emitVoiceQueueSummary(_0x53d89b);};Dialer[_0xd81f('0x1f')][_0xd81f('0x1de')]=function(_0x249602,_0x2b1ff1,_0x4ae95b,_0x212d39,_0x9e706b,_0x40c182){loggerPredictive[_0xd81f('0x81')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xd81f('0x81')](_0xd81f('0x211'),_0x249602);loggerPredictive['info'](_0xd81f('0x212'),_0x2b1ff1);loggerPredictive['info'](_0xd81f('0x213'),_0x4ae95b);loggerPredictive[_0xd81f('0x81')](_0xd81f('0x214'),_0x212d39);loggerPredictive[_0xd81f('0x81')](_0xd81f('0x215'),_0x9e706b);loggerPredictive[_0xd81f('0x81')]('---------------------------');return new BPromise(function(_0x595df1,_0x5cbc5e){if(_0x249602<=0x0||isNaN(_0x249602)){return _0x5cbc5e(msgResponse(_0xd81f('0x216'),_0xd81f('0x4f'),'m\x20=\x20'+_0x249602));}if(_0x4ae95b<=0x0||isNaN(_0x4ae95b)){return _0x5cbc5e(msgResponse(_0xd81f('0x216'),_0xd81f('0x4f'),_0xd81f('0x217')+_0x4ae95b));}if(_0x212d39<=0x0||isNaN(_0x212d39)){return _0x5cbc5e(msgResponse(_0xd81f('0x216'),_0xd81f('0x4f'),_0xd81f('0x218')+_0x212d39));}if(_0x2b1ff1<=0x0||isNaN(_0x2b1ff1)){return _0x5cbc5e(msgResponse('[abandonmentRate]',_0xd81f('0x4f'),_0xd81f('0x219')+_0x2b1ff1));}if(_0x9e706b<=0x0||isNaN(_0x9e706b)){return _0x5cbc5e(msgResponse('[abandonmentRate]',_0xd81f('0x4f'),_0xd81f('0x21a')+_0x9e706b));}_0x40c182=_0x40c182||0x0;var _0x5d8a23=0x1/_0x4ae95b;var _0x40f97b=0x0;var _0x5525c3=0x0;var _0x403477=0x0;var _0x13e6d4=0x0;for(var _0x2e1631=0x0;_0x403477<_0x9e706b;_0x2e1631+=0x1){_0x5525c3=_0x2e1631/_0x2b1ff1;_0x40f97b=(_0x212d39*_0x5525c3+_0x40c182)/_0x5d8a23;_0x403477=erlangb(_0x40f97b,_0x249602);_0x13e6d4=_0x40f97b/_0x249602*(0x1-erlangb(_0x40f97b,_0x249602));}return _0x595df1({'erlangCalls':_0x2e1631,'erlangCallToSecond':_0x2b1ff1/_0x2e1631,'erlangAbandonmentRate':_0x403477,'erlangBusyFactor':_0x13e6d4});});};Dialer[_0xd81f('0x1f')]['busyFactor']=function(_0x29e85d,_0x5ceaf0,_0x1ed0f0,_0x4d233a,_0x5cc9e6,_0x20d3e2){loggerPredictive[_0xd81f('0x81')](_0xd81f('0x21b'));loggerPredictive['info'](_0xd81f('0x211'),_0x29e85d);loggerPredictive[_0xd81f('0x81')](_0xd81f('0x212'),_0x5ceaf0);loggerPredictive['info'](_0xd81f('0x213'),_0x1ed0f0);loggerPredictive['info'](_0xd81f('0x214'),_0x4d233a);loggerPredictive[_0xd81f('0x81')](_0xd81f('0x21c'),_0x5cc9e6);loggerPredictive[_0xd81f('0x81')](_0xd81f('0x89'));return new BPromise(function(_0x24d7b0,_0x15d90a){if(_0x29e85d<=0x0||isNaN(_0x29e85d)){return _0x15d90a(msgResponse(_0xd81f('0x21d'),_0xd81f('0x4f'),_0xd81f('0x21e')+_0x29e85d));}if(_0x1ed0f0<=0x0||isNaN(_0x1ed0f0)){return _0x15d90a(msgResponse(_0xd81f('0x21d'),_0xd81f('0x4f'),_0xd81f('0x217')+_0x1ed0f0));}if(_0x4d233a<=0x0||isNaN(_0x4d233a)){return _0x15d90a(msgResponse(_0xd81f('0x21d'),'Error',_0xd81f('0x218')+_0x4d233a));}if(_0x5ceaf0<=0x0||isNaN(_0x5ceaf0)){return _0x15d90a(msgResponse(_0xd81f('0x21d'),_0xd81f('0x4f'),'interval\x20=\x20'+_0x5ceaf0));}if(_0x5cc9e6<=0x0||isNaN(_0x5cc9e6)){return _0x15d90a(msgResponse(_0xd81f('0x21d'),_0xd81f('0x4f'),_0xd81f('0x21f')+_0x5cc9e6));}_0x20d3e2=_0x20d3e2||0x0;var _0x128cba=0x1/_0x1ed0f0;var _0x163ba6=0x0;var _0x1a646c=0x0;var _0x282a77=0x0;var _0x3f0c96=0x0;for(var _0xca0fef=0x0;_0x3f0c96<_0x5cc9e6;_0xca0fef+=0x1){_0x1a646c=_0xca0fef/_0x5ceaf0;_0x163ba6=(_0x4d233a*_0x1a646c+_0x20d3e2)/_0x128cba;_0x282a77=erlangb(_0x163ba6,_0x29e85d);_0x3f0c96=_0x163ba6/_0x29e85d*(0x1-erlangb(_0x163ba6,_0x29e85d));}return _0x24d7b0({'erlangCalls':_0xca0fef,'erlangCallToSecond':_0x5ceaf0/_0xca0fef,'erlangAbandonmentRate':_0x282a77,'erlangBusyFactor':_0x3f0c96});});};module[_0xd81f('0x220')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 39154eb..00f6af0 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4b3=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','milliseconds','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countnoanswerretry','countcongestionretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridname','calleridnum','responsetime','droptime','endtime','ringtime','starttime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xc4b3,0x179));var _0x3c4b=function(_0x873c39,_0x12380d){_0x873c39=_0x873c39-0x0;var _0x259368=_0xc4b3[_0x873c39];return _0x259368;};'use strict';var util=require(_0x3c4b('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x1f2326,_0x20fb8e){var _0x36ab93=moment(_0x1f2326)[_0x3c4b('0x1')](0x0);var _0x4b1d0e=moment(_0x20fb8e)[_0x3c4b('0x1')](0x0);return _0x36ab93['diff'](_0x4b1d0e,_0x3c4b('0x2'));}function QueueCallerAbandon(_0x258044,_0x38b689){this[_0x3c4b('0x3')]=_0x258044[_0x3c4b('0x3')];this[_0x3c4b('0x4')]=_0x258044[_0x3c4b('0x4')];this[_0x3c4b('0x5')]=_0x258044[_0x3c4b('0x4')]==='outbound'?_0x3c4b('0x6'):_0x258044[_0x3c4b('0x4')];this[_0x3c4b('0x7')]=_0x258044[_0x3c4b('0x7')];this['countcongestionretry']=_0x258044['countcongestionretry'];this[_0x3c4b('0x8')]=_0x258044[_0x3c4b('0x8')];this['countglobal']=_0x258044['countbusyretry']+_0x258044[_0x3c4b('0x9')]+_0x258044['countnoanswerretry']+_0x258044['countnosuchnumberretry']+_0x258044[_0x3c4b('0xa')]+_0x258044['countabandonedretry']+_0x258044[_0x3c4b('0xb')]+_0x258044[_0x3c4b('0xc')];this[_0x3c4b('0xd')]=_0x258044['countnosuchnumberretry'];this[_0x3c4b('0xa')]=_0x258044[_0x3c4b('0xa')];this[_0x3c4b('0xe')]=_0x258044[_0x3c4b('0xe')];this[_0x3c4b('0xb')]=_0x258044[_0x3c4b('0xb')];this['countagentrejectretry']=_0x258044[_0x3c4b('0xc')];this[_0x3c4b('0xf')]=_0x38b689['uniqueid'];this[_0x3c4b('0x10')]=_0x258044['name'];this[_0x3c4b('0x11')]=_0x258044['number'];this['starttime']=_0x258044['starttime'];this[_0x3c4b('0x12')]=_0x258044[_0x3c4b('0x12')];this[_0x3c4b('0x13')]=_0x258044[_0x3c4b('0x13')];this[_0x3c4b('0x14')]=this[_0x3c4b('0x13')];this[_0x3c4b('0x15')]=getSeconds(_0x258044[_0x3c4b('0x12')],_0x258044[_0x3c4b('0x16')]);this[_0x3c4b('0x17')]=getSeconds(this[_0x3c4b('0x13')],_0x258044[_0x3c4b('0x12')]);this[_0x3c4b('0x18')]=0x0;this['queue']=_0x38b689[_0x3c4b('0x6')];this[_0x3c4b('0x19')]=_0x38b689['connectedlinename'];this[_0x3c4b('0x1a')]=_0x38b689[_0x3c4b('0x1a')];this[_0x3c4b('0x1b')]=_0x258044['callback'];this[_0x3c4b('0x1c')]=_0x258044[_0x3c4b('0x1c')];this[_0x3c4b('0x1d')]=_0x258044['callbackat'];this[_0x3c4b('0x1e')]=_0x258044[_0x3c4b('0x1e')];this[_0x3c4b('0x1f')]=_0x258044[_0x3c4b('0x1f')];this['ListId']=_0x258044[_0x3c4b('0x20')];this[_0x3c4b('0x21')]=_0x258044[_0x3c4b('0x21')];this['VoiceQueueId']=_0x258044[_0x3c4b('0x22')];this[_0x3c4b('0x23')]=_0x258044[_0x3c4b('0x23')];this['originatecalleridnum']=_0x258044['originatecalleridnum']||'';this['originatecalleridname']=_0x258044['originatecalleridname']||'';}module[_0x3c4b('0x24')]=QueueCallerAbandon; \ No newline at end of file +var _0xf306=['outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','ringtime','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype'];(function(_0x356410,_0xc1673b){var _0x10f90c=function(_0x915640){while(--_0x915640){_0x356410['push'](_0x356410['shift']());}};_0x10f90c(++_0xc1673b);}(_0xf306,0x7e));var _0x6f30=function(_0x49bcc7,_0x5ae274){_0x49bcc7=_0x49bcc7-0x0;var _0x221c36=_0xf306[_0x49bcc7];return _0x221c36;};'use strict';var util=require(_0x6f30('0x0'));var _=require(_0x6f30('0x1'));var moment=require(_0x6f30('0x2'));function getSeconds(_0x4774cb,_0x54d67f){var _0x27605f=moment(_0x4774cb)[_0x6f30('0x3')](0x0);var _0x2daf96=moment(_0x54d67f)[_0x6f30('0x3')](0x0);return _0x27605f[_0x6f30('0x4')](_0x2daf96,_0x6f30('0x5'));}function QueueCallerAbandon(_0x2a27db,_0x5957b9){this['scheduledat']=_0x2a27db[_0x6f30('0x6')];this[_0x6f30('0x7')]=_0x2a27db['type'];this[_0x6f30('0x8')]=_0x2a27db['type']===_0x6f30('0x9')?'queue':_0x2a27db['type'];this[_0x6f30('0xa')]=_0x2a27db['countbusyretry'];this[_0x6f30('0xb')]=_0x2a27db[_0x6f30('0xb')];this[_0x6f30('0xc')]=_0x2a27db[_0x6f30('0xc')];this[_0x6f30('0xd')]=_0x2a27db['countbusyretry']+_0x2a27db['countcongestionretry']+_0x2a27db[_0x6f30('0xc')]+_0x2a27db['countnosuchnumberretry']+_0x2a27db[_0x6f30('0xe')]+_0x2a27db[_0x6f30('0xf')]+_0x2a27db['countmachineretry']+_0x2a27db[_0x6f30('0x10')];this[_0x6f30('0x11')]=_0x2a27db[_0x6f30('0x11')];this[_0x6f30('0xe')]=_0x2a27db[_0x6f30('0xe')];this['countabandonedretry']=_0x2a27db['countabandonedretry'];this[_0x6f30('0x12')]=_0x2a27db[_0x6f30('0x12')];this[_0x6f30('0x10')]=_0x2a27db[_0x6f30('0x10')];this[_0x6f30('0x13')]=_0x5957b9[_0x6f30('0x13')];this[_0x6f30('0x14')]=_0x2a27db[_0x6f30('0x15')];this[_0x6f30('0x16')]=_0x2a27db[_0x6f30('0x17')];this[_0x6f30('0x18')]=_0x2a27db[_0x6f30('0x18')];this[_0x6f30('0x19')]=_0x2a27db[_0x6f30('0x19')];this[_0x6f30('0x1a')]=_0x2a27db[_0x6f30('0x1a')];this['endtime']=this[_0x6f30('0x1a')];this[_0x6f30('0x1b')]=getSeconds(_0x2a27db[_0x6f30('0x19')],_0x2a27db[_0x6f30('0x18')]);this[_0x6f30('0x1c')]=getSeconds(this['droptime'],_0x2a27db['responsetime']);this[_0x6f30('0x1d')]=0x0;this[_0x6f30('0x1e')]=_0x5957b9[_0x6f30('0x1e')];this[_0x6f30('0x1f')]=_0x5957b9[_0x6f30('0x20')];this['reason']=_0x5957b9[_0x6f30('0x21')];this[_0x6f30('0x22')]=_0x2a27db[_0x6f30('0x22')];this[_0x6f30('0x23')]=_0x2a27db[_0x6f30('0x23')];this['callbackat']=_0x2a27db[_0x6f30('0x24')];this[_0x6f30('0x25')]=_0x2a27db['recallme'];this[_0x6f30('0x26')]=_0x2a27db[_0x6f30('0x26')];this['ListId']=_0x2a27db[_0x6f30('0x27')];this[_0x6f30('0x28')]=_0x2a27db[_0x6f30('0x28')];this[_0x6f30('0x29')]=_0x2a27db[_0x6f30('0x29')];this[_0x6f30('0x2a')]=_0x2a27db['CampaignId'];this['originatecalleridnum']=_0x2a27db[_0x6f30('0x2b')]||'';this[_0x6f30('0x2c')]=_0x2a27db[_0x6f30('0x2c')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 98ddf82..1e3078a 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(_0x215d08,_0x298d8c){var _0x491cb3=function(_0xd857e6){while(--_0xd857e6){_0x215d08['push'](_0x215d08['shift']());}};_0x491cb3(++_0x298d8c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x2ddfff,_0xfb0446){var _0x2e2008=function(_0x18c4c8){while(--_0x18c4c8){_0x2ddfff['push'](_0x2ddfff['shift']());}};_0x2e2008(++_0xfb0446);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 0f267a8..0b2a8ad 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 _0x1399=['Fax\x20failed','checkAfterSend','Trunk','isValid','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','format','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','uuid','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','faxAccounts','trunks','actions','bind','varset','syncVarSet','newstate','syncNewExten','faxstatus','syncFaxStatus','receivefax','originateresponse','syncOriginateResponse','prototype','syncNewchannel','exten','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','value','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','response','reason','update','AttachmentId','then','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]'];(function(_0x1fd633,_0x5de5d5){var _0x3903b5=function(_0x31e4b0){while(--_0x31e4b0){_0x1fd633['push'](_0x1fd633['shift']());}};_0x3903b5(++_0x5de5d5);}(_0x1399,0x16c));var _0x9139=function(_0x4bbb2f,_0x1d2540){_0x4bbb2f=_0x4bbb2f-0x0;var _0xd473a4=_0x1399[_0x4bbb2f];return _0xd473a4;};'use strict';var util=require(_0x9139('0x0'));var _=require(_0x9139('0x1'));var BPromise=require('bluebird');var uuid=require(_0x9139('0x2'));var moment=require('moment');var path=require(_0x9139('0x3'));var tiff2pdf=require(_0x9139('0x4'));var gs=require(_0x9139('0x5'));var logger=require(_0x9139('0x6'))(_0x9139('0x7'));var ami=require(_0x9139('0x8'));var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0x9139('0x9'));var Action=require(_0x9139('0xa'));var faxAccount=require(_0x9139('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x9139('0xc'));function Fax(_0x59aec5){this['channels']={};this[_0x9139('0xd')]=_0x59aec5[_0x9139('0xd')];this['trunks']=_0x59aec5[_0x9139('0xe')];this[_0x9139('0xf')]={};ami['on']('newchannel',this['syncNewchannel'][_0x9139('0x10')](this));ami['on'](_0x9139('0x11'),this[_0x9139('0x12')][_0x9139('0x10')](this));ami['on'](_0x9139('0x13'),this['syncNewState']['bind'](this));ami['on']('newexten',this[_0x9139('0x14')]['bind'](this));ami['on'](_0x9139('0x15'),this[_0x9139('0x16')][_0x9139('0x10')](this));ami['on'](_0x9139('0x17'),this['syncReceiveFax'][_0x9139('0x10')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0x9139('0x18'),this[_0x9139('0x19')][_0x9139('0x10')](this));}Fax[_0x9139('0x1a')][_0x9139('0x1b')]=function(_0x425be4){if(_0x425be4['context']==='from-voip-provider'){for(var _0x13cab8 in this[_0x9139('0xd')]){if(this['faxAccounts']['hasOwnProperty'](_0x13cab8)){if(_0x425be4[_0x9139('0x1c')]===this[_0x9139('0xd')][_0x13cab8]['localstationid']){this[_0x9139('0x1d')][_0x425be4[_0x9139('0x1e')]]={};this[_0x9139('0x1d')][_0x425be4[_0x9139('0x1e')]][_0x9139('0x1f')]=_0x425be4[_0x9139('0x1f')];this[_0x9139('0x1d')][_0x425be4[_0x9139('0x1e')]]['id']=this[_0x9139('0xd')][_0x13cab8]['id'];this[_0x9139('0x1d')][_0x425be4[_0x9139('0x1e')]][_0x9139('0x20')]=this[_0x9139('0xd')][_0x13cab8][_0x9139('0x20')];logger[_0x9139('0x21')](_0x425be4[_0x9139('0x1e')],_0x9139('0x22'));}}}}if(this[_0x9139('0xf')][_0x425be4[_0x9139('0x1e')]]){this['channels'][_0x425be4[_0x9139('0x1e')]]={};this[_0x9139('0x1d')][_0x425be4['uniqueid']][_0x9139('0x1f')]=_0x425be4[_0x9139('0x1f')];logger[_0x9139('0x21')](_0x425be4['uniqueid'],_0x9139('0x22'));}};Fax[_0x9139('0x1a')]['syncVarSet']=function(_0x1c9938){if(this[_0x9139('0x1d')][_0x1c9938[_0x9139('0x1e')]]){for(var _0x55e95f in _0x1c9938[_0x9139('0x23')]){if(_0x1c9938[_0x9139('0x23')][_0x9139('0x24')](_0x55e95f)){this[_0x9139('0x1d')][_0x1c9938[_0x9139('0x1e')]][_0x55e95f]=_0x1c9938[_0x9139('0x25')];}}}};Fax[_0x9139('0x1a')]['syncNewState']=function(_0x55cc6a){if(this[_0x9139('0x1d')][_0x55cc6a[_0x9139('0x1e')]]){this[_0x9139('0x1d')][_0x55cc6a['uniqueid']]['channelstate']=_0x55cc6a[_0x9139('0x26')];this[_0x9139('0x1d')][_0x55cc6a[_0x9139('0x1e')]][_0x9139('0x27')]=_0x55cc6a[_0x9139('0x27')];}};Fax['prototype']['syncNewExten']=function(_0x2f26de){if(this['channels'][_0x2f26de['uniqueid']]){for(var _0x222429 in _0x2f26de[_0x9139('0x23')]){if(_0x2f26de['variable'][_0x9139('0x24')](_0x222429)){this[_0x9139('0x1d')][_0x2f26de['uniqueid']][_0x222429]=_0x2f26de[_0x9139('0x25')];}}}};Fax[_0x9139('0x1a')][_0x9139('0x16')]=function(_0x11844b){if(this[_0x9139('0x1d')][_0x11844b[_0x9139('0x1e')]]){this[_0x9139('0x1d')][_0x11844b[_0x9139('0x1e')]][_0x9139('0x28')]=_0x11844b[_0x9139('0x28')];this[_0x9139('0x1d')][_0x11844b['uniqueid']][_0x9139('0x29')]=_0x11844b[_0x9139('0x29')];this['channels'][_0x11844b[_0x9139('0x1e')]][_0x9139('0x2a')]=_0x11844b[_0x9139('0x2a')];this['channels'][_0x11844b[_0x9139('0x1e')]][_0x9139('0x2b')]=_0x11844b[_0x9139('0x2b')];logger[_0x9139('0x21')](_0x11844b[_0x9139('0x1e')],_0x9139('0x2c'));}};Fax[_0x9139('0x1a')][_0x9139('0x2d')]=function(_0x24f7d0){var _0x22b074=this;if(this['channels'][_0x24f7d0[_0x9139('0x1e')]]){var _0x66193=this[_0x9139('0x1d')][_0x24f7d0[_0x9139('0x1e')]]['id'];this[_0x9139('0x1d')][_0x24f7d0[_0x9139('0x1e')]][_0x9139('0x2e')]=_0x24f7d0['remotestationid'];this[_0x9139('0x1d')][_0x24f7d0['uniqueid']][_0x9139('0x2f')]=_0x24f7d0[_0x9139('0x2f')];this[_0x9139('0x1d')][_0x24f7d0['uniqueid']][_0x9139('0x2a')]=_0x24f7d0[_0x9139('0x2a')];this[_0x9139('0x1d')][_0x24f7d0[_0x9139('0x1e')]][_0x9139('0x30')]=_0x24f7d0[_0x9139('0x30')];this[_0x9139('0x1d')][_0x24f7d0[_0x9139('0x1e')]][_0x9139('0x31')]=_0x24f7d0[_0x9139('0x31')];this['channels'][_0x24f7d0[_0x9139('0x1e')]][_0x9139('0x2b')]=_0x24f7d0[_0x9139('0x2b')];this['channels'][_0x24f7d0['uniqueid']]['calleridnum']=_0x24f7d0[_0x9139('0x32')];if(this[_0x9139('0x1d')][_0x24f7d0[_0x9139('0x1e')]][_0x9139('0x2f')]>0x0){tiff2pdf(_0x24f7d0[_0x9139('0x2b')],'/var/opt/motion2/server/files/attachments/',function(_0x20e8f5){logger[_0x9139('0x21')](_0x24f7d0[_0x9139('0x1e')],_0x9139('0x33'),_0x20e8f5[_0x9139('0x34')]);attachment['create']({'name':path[_0x9139('0x35')](_0x24f7d0[_0x9139('0x2b')])[_0x9139('0x20')],'basename':path[_0x9139('0x35')](_0x24f7d0['filename'])['name']+_0x9139('0x36'),'type':_0x9139('0x37')})['then'](function(_0x5003db){faxAccount[_0x9139('0x38')](_0x66193,{'from':_0x24f7d0[_0x9139('0x32')],'mapKey':'fax','body':path[_0x9139('0x35')](_0x24f7d0[_0x9139('0x2b')])['name']+_0x9139('0x36'),'AttachmentId':_0x5003db['id']})['catch'](function(_0x54c7fc){logger[_0x9139('0x39')](_0x24f7d0[_0x9139('0x1e')],_0x9139('0x3a'),JSON[_0x9139('0x3b')](_0x54c7fc));});})[_0x9139('0x3c')](function(_0x52cf68){logger[_0x9139('0x39')](_0x24f7d0[_0x9139('0x1e')],_0x9139('0x3d'),JSON['stringify'](_0x52cf68));});});}logger[_0x9139('0x21')](_0x24f7d0[_0x9139('0x1e')],_0x9139('0x3d'));}};Fax[_0x9139('0x1a')][_0x9139('0x19')]=function(_0x31395f){if(this[_0x9139('0xf')][_0x31395f[_0x9139('0x1e')]]){_[_0x9139('0x3e')](this[_0x9139('0x1d')][_0x31395f[_0x9139('0x1e')]],_['pick'](_0x31395f,[_0x9139('0x3f'),_0x9139('0x40')]));}};function updateStatus(_0x30aad3){if(_0x30aad3['AttachmentId']){faxMessage[_0x9139('0x41')](_0x30aad3[_0x9139('0x42')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x9139('0x43')](function(_0x27d337){ut[_0x9139('0x44')]('[Fax][Message][Error][Updated]',_0x27d337);})[_0x9139('0x3c')](function(_0xbce82d){ut[_0x9139('0x44')](_0x9139('0x45'),_0xbce82d);});}else{ut['logger'](_0x9139('0x46'));}}Fax[_0x9139('0x1a')][_0x9139('0x47')]=function(_0x502350,_0x3f8b69,_0x146201){var _0x2b5977=this;var _0x477d81={};if(_0x3f8b69){_0x477d81={'read':_0x3f8b69};}else{_0x477d81={'failMessage':_0x146201};}if(this[_0x9139('0xf')][_0x502350][_0x9139('0x42')]){faxMessage[_0x9139('0x41')](this['actions'][_0x502350][_0x9139('0x42')],_0x477d81)[_0x9139('0x43')](function(_0x5f3a48){ut[_0x9139('0x44')](_0x9139('0x48'),_0x5f3a48);})[_0x9139('0x3c')](function(_0x1a0841){ut[_0x9139('0x44')]('[Fax][Message][NoUpdate1]',_0x1a0841);})[_0x9139('0x49')](function(){delete _0x2b5977[_0x9139('0x1d')][_0x502350];delete _0x2b5977['actions'][_0x502350];});}else{ut['logger'](_0x9139('0x4a'));delete this[_0x9139('0x1d')][_0x502350];delete this[_0x9139('0xf')][_0x502350];}};Fax['prototype'][_0x9139('0x4b')]=function(_0x576b5a){var _0x59e08d=this;if(this[_0x9139('0x1d')][_0x576b5a[_0x9139('0x1e')]]){if(this[_0x9139('0xf')][_0x576b5a[_0x9139('0x1e')]]){this['channels'][_0x576b5a[_0x9139('0x1e')]]['id']=this[_0x9139('0xf')][_0x576b5a[_0x9139('0x1e')]]['id'];this['channels'][_0x576b5a[_0x9139('0x1e')]][_0x9139('0x20')]=this[_0x9139('0xf')][_0x576b5a[_0x9139('0x1e')]][_0x9139('0x20')];}logger[_0x9139('0x21')](_0x576b5a[_0x9139('0x1e')],this[_0x9139('0xf')][_0x576b5a[_0x9139('0x1e')]]?_0x9139('0x4c'):_0x9139('0x4d'),JSON[_0x9139('0x3b')](this[_0x9139('0x1d')][_0x576b5a[_0x9139('0x1e')]]));if(this['actions'][_0x576b5a[_0x9139('0x1e')]]){if(this[_0x9139('0x1d')][_0x576b5a[_0x9139('0x1e')]][_0x9139('0x4e')]>0x0&&this[_0x9139('0x1d')][_0x576b5a['uniqueid']][_0x9139('0x15')]===_0x9139('0x4f')){this[_0x9139('0x47')](_0x576b5a[_0x9139('0x1e')],!![]);}else{this[_0x9139('0x47')](_0x576b5a['uniqueid'],![],this['channels'][_0x576b5a[_0x9139('0x1e')]][_0x9139('0x50')]?'SENDING\x20FAILED:\x20'+this[_0x9139('0x1d')][_0x576b5a[_0x9139('0x1e')]][_0x9139('0x50')]:_0x9139('0x51'));}}}};Fax[_0x9139('0x1a')][_0x9139('0x52')]=function(_0x92cccb){var _0x2fc8d8=this;return new BPromise(function(_0x8a99f2,_0x53a27f){_0x2fc8d8[_0x9139('0x53')](_0x92cccb,_0x2fc8d8[_0x9139('0xd')][_0x92cccb[_0x9139('0x54')]])[_0x9139('0x43')](function(_0x4f6e7c){ut['logger'](_0x9139('0x55'),_0x4f6e7c);_0x8a99f2(ut[_0x9139('0x34')](_0x9139('0x56')));})[_0x9139('0x3c')](function(_0x4b17c1){ut[_0x9139('0x44')](_0x9139('0x57'),_0x4b17c1);updateStatus(_0x92cccb);_0x53a27f(ut['message'](_0x9139('0x58')));});});};Fax[_0x9139('0x1a')][_0x9139('0x59')]=function(_0x1096e6){var _0x198ddb=this;return new BPromise(function(_0x45eeda,_0x224e3d){var _0x18480e=_0x198ddb['checkTrunk'](_0x198ddb['faxAccounts'][_0x1096e6['FaxAccountId']][_0x9139('0x5a')],_0x1096e6);if(_0x18480e[_0x9139('0x5b')]){_0x45eeda(ut[_0x9139('0x34')]('Trunk\x20Reachable'));}else{_0x224e3d(ut[_0x9139('0x34')](_0x18480e[_0x9139('0x34')]));}});};function originate(_0x42d389,_0x235241,_0x2b76c5){return new BPromise(function(_0x3aacdb,_0x5d9ae8){if(_0x2b76c5){var _0x437d18=util['format'](_0x9139('0x5c'),path['parse'](_0x42d389[_0x9139('0x3')])[_0x9139('0x20')],_0x42d389['path']);gs['execute'](_0x437d18)[_0x9139('0x43')](function(){_0x42d389[_0x9139('0x3')]=util[_0x9139('0x5d')]('%s/%s.tif',path[_0x9139('0x35')](_0x42d389[_0x9139('0x3')])[_0x9139('0x5e')],path[_0x9139('0x35')](_0x42d389['path'])['name']);_0x235241[_0x9139('0x5f')]=_0x42d389[_0x9139('0x3')];ut['logger'](_0x9139('0x60'),'');ami[_0x9139('0x61')](ut[_0x9139('0x62')](_0x42d389,_0x235241))[_0x9139('0x43')](function(_0x12465a){_0x3aacdb(_0x12465a);})[_0x9139('0x3c')](function(_0x3c17fd){_0x5d9ae8(_0x3c17fd);});})[_0x9139('0x3c')](function(_0x17e386){_0x5d9ae8(_0x17e386);});}else{ami[_0x9139('0x61')](ut[_0x9139('0x62')](_0x42d389,_0x235241))[_0x9139('0x43')](function(_0x17a842){_0x3aacdb(_0x17a842);})['catch'](function(_0x1db805){_0x5d9ae8(_0x1db805);});}});}Fax[_0x9139('0x1a')][_0x9139('0x53')]=function(_0x283861,_0x144a02){var _0x58e0f5=this;return new BPromise(function(_0x406be8,_0x54cd2a){var _0x14868a=uuid['v4']();var _0x3fc4af=ut[_0x9139('0x63')](_0x283861,_0x144a02);_0x58e0f5['actions'][_0x14868a]=new Action(_0x14868a,_0x144a02,_0x283861);var _0x15a530=_0x58e0f5[_0x9139('0xf')][_0x14868a];if(path['parse'](_0x283861[_0x9139('0x3')])[_0x9139('0x64')]===_0x9139('0x36')){originate(_0x15a530,_0x3fc4af,!![])[_0x9139('0x43')](function(_0x16a1f6){_0x406be8(_0x16a1f6);})[_0x9139('0x3c')](function(_0x1abb10){_0x54cd2a(_0x1abb10);});}else{originate(_0x15a530,_0x3fc4af,![])[_0x9139('0x43')](function(_0x143841){_0x406be8(_0x143841);})['catch'](function(_0x2e321e){_0x54cd2a(_0x2e321e);});}});};Fax[_0x9139('0x1a')][_0x9139('0x65')]=function(_0x3c3474){return!_[_0x9139('0x66')](_0x3c3474)&&!_['isNil'](_0x3c3474[_0x9139('0x20')])&&!_[_0x9139('0x66')](_0x3c3474['active'])&&_0x3c3474['active']&&!_[_0x9139('0x66')](this[_0x9139('0xe')][util[_0x9139('0x5d')](_0x9139('0x67'),_0x3c3474['name'])])&&!_[_0x9139('0x66')](this[_0x9139('0xe')][util[_0x9139('0x5d')](_0x9139('0x67'),_0x3c3474[_0x9139('0x20')])][_0x9139('0x29')])&&(this[_0x9139('0xe')][util[_0x9139('0x5d')](_0x9139('0x67'),_0x3c3474[_0x9139('0x20')])][_0x9139('0x29')]===_0x9139('0x68')||this[_0x9139('0xe')][util[_0x9139('0x5d')](_0x9139('0x67'),_0x3c3474[_0x9139('0x20')])][_0x9139('0x29')]===_0x9139('0x69'));};Fax[_0x9139('0x1a')]['checkTrunk']=function(_0x4654a3,_0x1f0412){if(!this[_0x9139('0x65')](_0x4654a3)){ut[_0x9139('0x44')](_0x9139('0x6a'),_['isNil'](_0x4654a3)?'':_0x4654a3[_0x9139('0x20')]+_0x9139('0x6b'));return{'isValid':![],'message':_0x9139('0x6c')};}if(_[_0x9139('0x66')](_0x1f0412[_0x9139('0x7')])){ut[_0x9139('0x44')](_0x9139('0x6d'),JSON['stringify'](_0x1f0412));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x9139('0x66')](_0x1f0412[_0x9139('0x3')])){ut[_0x9139('0x44')](_0x9139('0x6e'),JSON['stringify'](_0x1f0412));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x9139('0x6f')};};module[_0x9139('0x70')]=Fax; \ No newline at end of file +var _0xe605=['XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','format','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment','faxAccounts','trunks','actions','newchannel','bind','syncVarSet','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncOriginateResponse','syncNewchannel','context','from-voip-provider','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','hasOwnProperty','syncNewState','channelstate','value','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','AttachmentId','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','execute','%s/%s.tif'];(function(_0xbe70dc,_0x2c0ec9){var _0xb132e8=function(_0x5dcffd){while(--_0x5dcffd){_0xbe70dc['push'](_0xbe70dc['shift']());}};_0xb132e8(++_0x2c0ec9);}(_0xe605,0x92));var _0x5e60=function(_0x494845,_0xb04d4b){_0x494845=_0x494845-0x0;var _0x20e596=_0xe605[_0x494845];return _0x20e596;};'use strict';var util=require(_0x5e60('0x0'));var _=require(_0x5e60('0x1'));var BPromise=require('bluebird');var uuid=require(_0x5e60('0x2'));var moment=require(_0x5e60('0x3'));var path=require(_0x5e60('0x4'));var tiff2pdf=require(_0x5e60('0x5'));var gs=require(_0x5e60('0x6'));var logger=require(_0x5e60('0x7'))(_0x5e60('0x8'));var ami=require(_0x5e60('0x9'));var rpcDb=require(_0x5e60('0xa'));var Channel=require(_0x5e60('0xb'));var ut=require(_0x5e60('0xc'));var Action=require(_0x5e60('0xd'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x5e60('0xe'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x593118){this['channels']={};this[_0x5e60('0xf')]=_0x593118[_0x5e60('0xf')];this[_0x5e60('0x10')]=_0x593118[_0x5e60('0x10')];this[_0x5e60('0x11')]={};ami['on'](_0x5e60('0x12'),this['syncNewchannel'][_0x5e60('0x13')](this));ami['on']('varset',this[_0x5e60('0x14')][_0x5e60('0x13')](this));ami['on'](_0x5e60('0x15'),this['syncNewState'][_0x5e60('0x13')](this));ami['on'](_0x5e60('0x16'),this[_0x5e60('0x17')][_0x5e60('0x13')](this));ami['on'](_0x5e60('0x18'),this[_0x5e60('0x19')]['bind'](this));ami['on'](_0x5e60('0x1a'),this[_0x5e60('0x1b')][_0x5e60('0x13')](this));ami['on'](_0x5e60('0x1c'),this['syncHangup'][_0x5e60('0x13')](this));ami['on']('originateresponse',this[_0x5e60('0x1d')][_0x5e60('0x13')](this));}Fax['prototype'][_0x5e60('0x1e')]=function(_0x3e1a44){if(_0x3e1a44[_0x5e60('0x1f')]===_0x5e60('0x20')){for(var _0x5c485d in this[_0x5e60('0xf')]){if(this[_0x5e60('0xf')]['hasOwnProperty'](_0x5c485d)){if(_0x3e1a44[_0x5e60('0x21')]===this[_0x5e60('0xf')][_0x5c485d][_0x5e60('0x22')]){this[_0x5e60('0x23')][_0x3e1a44[_0x5e60('0x24')]]={};this[_0x5e60('0x23')][_0x3e1a44[_0x5e60('0x24')]][_0x5e60('0x25')]=_0x3e1a44[_0x5e60('0x25')];this[_0x5e60('0x23')][_0x3e1a44[_0x5e60('0x24')]]['id']=this['faxAccounts'][_0x5c485d]['id'];this[_0x5e60('0x23')][_0x3e1a44['uniqueid']][_0x5e60('0x26')]=this[_0x5e60('0xf')][_0x5c485d][_0x5e60('0x26')];logger[_0x5e60('0x27')](_0x3e1a44[_0x5e60('0x24')],_0x5e60('0x28'));}}}}if(this[_0x5e60('0x11')][_0x3e1a44['uniqueid']]){this[_0x5e60('0x23')][_0x3e1a44[_0x5e60('0x24')]]={};this[_0x5e60('0x23')][_0x3e1a44['uniqueid']][_0x5e60('0x25')]=_0x3e1a44[_0x5e60('0x25')];logger[_0x5e60('0x27')](_0x3e1a44[_0x5e60('0x24')],'\x20syncNewchannel\x20');}};Fax[_0x5e60('0x29')]['syncVarSet']=function(_0x23d187){if(this[_0x5e60('0x23')][_0x23d187['uniqueid']]){for(var _0x46691f in _0x23d187[_0x5e60('0x2a')]){if(_0x23d187['variable'][_0x5e60('0x2b')](_0x46691f)){this[_0x5e60('0x23')][_0x23d187['uniqueid']][_0x46691f]=_0x23d187['value'];}}}};Fax['prototype'][_0x5e60('0x2c')]=function(_0x235cc7){if(this[_0x5e60('0x23')][_0x235cc7[_0x5e60('0x24')]]){this[_0x5e60('0x23')][_0x235cc7['uniqueid']][_0x5e60('0x2d')]=_0x235cc7[_0x5e60('0x2d')];this['channels'][_0x235cc7[_0x5e60('0x24')]]['channelstatedesc']=_0x235cc7['channelstatedesc'];}};Fax[_0x5e60('0x29')][_0x5e60('0x17')]=function(_0x1f474b){if(this[_0x5e60('0x23')][_0x1f474b[_0x5e60('0x24')]]){for(var _0xbf5b7a in _0x1f474b[_0x5e60('0x2a')]){if(_0x1f474b[_0x5e60('0x2a')][_0x5e60('0x2b')](_0xbf5b7a)){this[_0x5e60('0x23')][_0x1f474b['uniqueid']][_0xbf5b7a]=_0x1f474b[_0x5e60('0x2e')];}}}};Fax['prototype']['syncFaxStatus']=function(_0x478415){if(this[_0x5e60('0x23')][_0x478415['uniqueid']]){this[_0x5e60('0x23')][_0x478415['uniqueid']][_0x5e60('0x2f')]=_0x478415[_0x5e60('0x2f')];this[_0x5e60('0x23')][_0x478415[_0x5e60('0x24')]][_0x5e60('0x30')]=_0x478415[_0x5e60('0x30')];this[_0x5e60('0x23')][_0x478415[_0x5e60('0x24')]]['localstationid']=_0x478415[_0x5e60('0x22')];this[_0x5e60('0x23')][_0x478415[_0x5e60('0x24')]][_0x5e60('0x31')]=_0x478415[_0x5e60('0x31')];logger[_0x5e60('0x27')](_0x478415[_0x5e60('0x24')],'\x20syncFaxStatus\x20');}};Fax[_0x5e60('0x29')][_0x5e60('0x1b')]=function(_0x4cba18){var _0x532ab2=this;if(this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]]){var _0x1ae294=this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]]['id'];this['channels'][_0x4cba18[_0x5e60('0x24')]][_0x5e60('0x32')]=_0x4cba18[_0x5e60('0x32')];this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]][_0x5e60('0x33')]=_0x4cba18[_0x5e60('0x33')];this['channels'][_0x4cba18[_0x5e60('0x24')]][_0x5e60('0x22')]=_0x4cba18['localstationid'];this['channels'][_0x4cba18['uniqueid']][_0x5e60('0x34')]=_0x4cba18[_0x5e60('0x34')];this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]]['transferrate']=_0x4cba18[_0x5e60('0x35')];this[_0x5e60('0x23')][_0x4cba18['uniqueid']]['filename']=_0x4cba18[_0x5e60('0x31')];this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]][_0x5e60('0x36')]=_0x4cba18[_0x5e60('0x36')];if(this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]][_0x5e60('0x33')]>0x0){tiff2pdf(_0x4cba18[_0x5e60('0x31')],'/var/opt/motion2/server/files/attachments/',function(_0x284e66){logger[_0x5e60('0x27')](_0x4cba18['uniqueid'],_0x5e60('0x37'),_0x284e66[_0x5e60('0x38')]);attachment[_0x5e60('0x39')]({'name':path[_0x5e60('0x3a')](_0x4cba18[_0x5e60('0x31')])['name'],'basename':path[_0x5e60('0x3a')](_0x4cba18[_0x5e60('0x31')])[_0x5e60('0x26')]+_0x5e60('0x3b'),'type':'application/pdf'})['then'](function(_0x5b9f5a){faxAccount[_0x5e60('0x3c')](_0x1ae294,{'from':_0x4cba18[_0x5e60('0x36')],'mapKey':_0x5e60('0x8'),'body':path[_0x5e60('0x3a')](_0x4cba18[_0x5e60('0x31')])[_0x5e60('0x26')]+'.pdf','AttachmentId':_0x5b9f5a['id']})[_0x5e60('0x3d')](function(_0x1c48d0){logger[_0x5e60('0x3e')](_0x4cba18[_0x5e60('0x24')],_0x5e60('0x3f'),JSON[_0x5e60('0x40')](_0x1c48d0));});})[_0x5e60('0x3d')](function(_0x4acd96){logger[_0x5e60('0x3e')](_0x4cba18[_0x5e60('0x24')],_0x5e60('0x41'),JSON[_0x5e60('0x40')](_0x4acd96));});});}logger[_0x5e60('0x27')](_0x4cba18[_0x5e60('0x24')],_0x5e60('0x41'));}};Fax[_0x5e60('0x29')][_0x5e60('0x1d')]=function(_0x350d6d){if(this[_0x5e60('0x11')][_0x350d6d[_0x5e60('0x24')]]){_[_0x5e60('0x42')](this[_0x5e60('0x23')][_0x350d6d[_0x5e60('0x24')]],_[_0x5e60('0x43')](_0x350d6d,[_0x5e60('0x44'),_0x5e60('0x45')]));}};function updateStatus(_0x54479d){if(_0x54479d['AttachmentId']){faxMessage[_0x5e60('0x46')](_0x54479d['AttachmentId'],{'failMessage':_0x5e60('0x47')})[_0x5e60('0x48')](function(_0x20d6e6){ut[_0x5e60('0x49')](_0x5e60('0x4a'),_0x20d6e6);})[_0x5e60('0x3d')](function(_0x4b72a4){ut['logger'](_0x5e60('0x4b'),_0x4b72a4);});}else{ut[_0x5e60('0x49')](_0x5e60('0x4c'));}}Fax['prototype']['updateStatus']=function(_0x31ced8,_0x46f3ba,_0x179cc6){var _0x501b87=this;var _0x1a3ed9={};if(_0x46f3ba){_0x1a3ed9={'read':_0x46f3ba};}else{_0x1a3ed9={'failMessage':_0x179cc6};}if(this[_0x5e60('0x11')][_0x31ced8][_0x5e60('0x4d')]){faxMessage[_0x5e60('0x46')](this[_0x5e60('0x11')][_0x31ced8][_0x5e60('0x4d')],_0x1a3ed9)['then'](function(_0x412be1){ut[_0x5e60('0x49')]('[Fax][Message][Updated]',_0x412be1);})[_0x5e60('0x3d')](function(_0x3f6a1e){ut[_0x5e60('0x49')]('[Fax][Message][NoUpdate1]',_0x3f6a1e);})[_0x5e60('0x4e')](function(){delete _0x501b87[_0x5e60('0x23')][_0x31ced8];delete _0x501b87['actions'][_0x31ced8];});}else{ut[_0x5e60('0x49')](_0x5e60('0x4f'));delete this[_0x5e60('0x23')][_0x31ced8];delete this[_0x5e60('0x11')][_0x31ced8];}};Fax['prototype'][_0x5e60('0x50')]=function(_0x1abc43){var _0x4ded96=this;if(this[_0x5e60('0x23')][_0x1abc43['uniqueid']]){if(this[_0x5e60('0x11')][_0x1abc43['uniqueid']]){this[_0x5e60('0x23')][_0x1abc43[_0x5e60('0x24')]]['id']=this['actions'][_0x1abc43[_0x5e60('0x24')]]['id'];this['channels'][_0x1abc43[_0x5e60('0x24')]]['name']=this[_0x5e60('0x11')][_0x1abc43['uniqueid']][_0x5e60('0x26')];}logger[_0x5e60('0x27')](_0x1abc43[_0x5e60('0x24')],this[_0x5e60('0x11')][_0x1abc43[_0x5e60('0x24')]]?_0x5e60('0x51'):_0x5e60('0x52'),JSON['stringify'](this[_0x5e60('0x23')][_0x1abc43[_0x5e60('0x24')]]));if(this[_0x5e60('0x11')][_0x1abc43[_0x5e60('0x24')]]){if(this[_0x5e60('0x23')][_0x1abc43[_0x5e60('0x24')]]['faxpages']>0x0&&this['channels'][_0x1abc43['uniqueid']][_0x5e60('0x18')]===_0x5e60('0x53')){this['updateStatus'](_0x1abc43[_0x5e60('0x24')],!![]);}else{this[_0x5e60('0x54')](_0x1abc43['uniqueid'],![],this[_0x5e60('0x23')][_0x1abc43[_0x5e60('0x24')]][_0x5e60('0x55')]?_0x5e60('0x56')+this[_0x5e60('0x23')][_0x1abc43[_0x5e60('0x24')]][_0x5e60('0x55')]:_0x5e60('0x57'));}}}};Fax[_0x5e60('0x29')][_0x5e60('0x58')]=function(_0x157aad){var _0x15921d=this;return new BPromise(function(_0xc5f45,_0x2826f7){_0x15921d[_0x5e60('0x59')](_0x157aad,_0x15921d[_0x5e60('0xf')][_0x157aad[_0x5e60('0x5a')]])['then'](function(_0x922817){ut[_0x5e60('0x49')](_0x5e60('0x5b'),_0x922817);_0xc5f45(ut['message'](_0x5e60('0x5c')));})[_0x5e60('0x3d')](function(_0x58376d){ut[_0x5e60('0x49')](_0x5e60('0x5d'),_0x58376d);updateStatus(_0x157aad);_0x2826f7(ut['message'](_0x5e60('0x5e')));});});};Fax[_0x5e60('0x29')][_0x5e60('0x5f')]=function(_0xd9a0db){var _0x1db659=this;return new BPromise(function(_0x711888,_0x221f35){var _0x3b5493=_0x1db659[_0x5e60('0x60')](_0x1db659['faxAccounts'][_0xd9a0db[_0x5e60('0x5a')]][_0x5e60('0x61')],_0xd9a0db);if(_0x3b5493[_0x5e60('0x62')]){_0x711888(ut['message'](_0x5e60('0x63')));}else{_0x221f35(ut[_0x5e60('0x38')](_0x3b5493[_0x5e60('0x38')]));}});};function originate(_0x15d975,_0x3e85fe,_0x559f8c){return new BPromise(function(_0x4560e1,_0x213c7e){if(_0x559f8c){var _0x3463a7=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x5e60('0x3a')](_0x15d975[_0x5e60('0x4')])[_0x5e60('0x26')],_0x15d975[_0x5e60('0x4')]);gs[_0x5e60('0x64')](_0x3463a7)[_0x5e60('0x48')](function(){_0x15d975[_0x5e60('0x4')]=util['format'](_0x5e60('0x65'),path[_0x5e60('0x3a')](_0x15d975[_0x5e60('0x4')])['dir'],path['parse'](_0x15d975[_0x5e60('0x4')])[_0x5e60('0x26')]);_0x3e85fe[_0x5e60('0x66')]=_0x15d975['path'];ut['logger'](_0x5e60('0x67'),'');ami[_0x5e60('0x68')](ut[_0x5e60('0x69')](_0x15d975,_0x3e85fe))[_0x5e60('0x48')](function(_0x42c62d){_0x4560e1(_0x42c62d);})[_0x5e60('0x3d')](function(_0x4a1e15){_0x213c7e(_0x4a1e15);});})[_0x5e60('0x3d')](function(_0x406a74){_0x213c7e(_0x406a74);});}else{ami[_0x5e60('0x68')](ut[_0x5e60('0x69')](_0x15d975,_0x3e85fe))[_0x5e60('0x48')](function(_0x1750b5){_0x4560e1(_0x1750b5);})[_0x5e60('0x3d')](function(_0x92d9c5){_0x213c7e(_0x92d9c5);});}});}Fax[_0x5e60('0x29')]['execOriginate']=function(_0x34cfa7,_0x136464){var _0x48570a=this;return new BPromise(function(_0x306e7c,_0x26508b){var _0x530a21=uuid['v4']();var _0x312ae3=ut[_0x5e60('0x6a')](_0x34cfa7,_0x136464);_0x48570a[_0x5e60('0x11')][_0x530a21]=new Action(_0x530a21,_0x136464,_0x34cfa7);var _0x1b4aee=_0x48570a[_0x5e60('0x11')][_0x530a21];if(path[_0x5e60('0x3a')](_0x34cfa7['path'])[_0x5e60('0x6b')]===_0x5e60('0x3b')){originate(_0x1b4aee,_0x312ae3,!![])[_0x5e60('0x48')](function(_0x222d94){_0x306e7c(_0x222d94);})[_0x5e60('0x3d')](function(_0xd70e8f){_0x26508b(_0xd70e8f);});}else{originate(_0x1b4aee,_0x312ae3,![])[_0x5e60('0x48')](function(_0x3f6bb2){_0x306e7c(_0x3f6bb2);})[_0x5e60('0x3d')](function(_0x58e900){_0x26508b(_0x58e900);});}});};Fax[_0x5e60('0x29')][_0x5e60('0x6c')]=function(_0x71d909){return!_[_0x5e60('0x6d')](_0x71d909)&&!_[_0x5e60('0x6d')](_0x71d909[_0x5e60('0x26')])&&!_[_0x5e60('0x6d')](_0x71d909[_0x5e60('0x6e')])&&_0x71d909[_0x5e60('0x6e')]&&!_[_0x5e60('0x6d')](this['trunks'][util['format']('SIP/%s',_0x71d909[_0x5e60('0x26')])])&&!_[_0x5e60('0x6d')](this[_0x5e60('0x10')][util[_0x5e60('0x6f')](_0x5e60('0x70'),_0x71d909[_0x5e60('0x26')])][_0x5e60('0x30')])&&(this[_0x5e60('0x10')][util[_0x5e60('0x6f')]('SIP/%s',_0x71d909[_0x5e60('0x26')])][_0x5e60('0x30')]===_0x5e60('0x71')||this['trunks'][util[_0x5e60('0x6f')]('SIP/%s',_0x71d909['name'])]['status']===_0x5e60('0x72'));};Fax[_0x5e60('0x29')][_0x5e60('0x60')]=function(_0x148c53,_0x445e6a){if(!this[_0x5e60('0x6c')](_0x148c53)){ut[_0x5e60('0x49')](_0x5e60('0x73'),_[_0x5e60('0x6d')](_0x148c53)?'':_0x148c53['name']+_0x5e60('0x74'));return{'isValid':![],'message':_0x5e60('0x75')};}if(_[_0x5e60('0x6d')](_0x445e6a[_0x5e60('0x8')])){ut[_0x5e60('0x49')](_0x5e60('0x76'),JSON[_0x5e60('0x40')](_0x445e6a));return{'isValid':![],'message':_0x5e60('0x77')};}if(_[_0x5e60('0x6d')](_0x445e6a[_0x5e60('0x4')])){ut[_0x5e60('0x49')](_0x5e60('0x78'),JSON['stringify'](_0x445e6a));return{'isValid':![],'message':_0x5e60('0x79')};}return{'isValid':!![],'message':_0x5e60('0x7a')};};module[_0x5e60('0x7b')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index d3413b1..35886f3 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 _0x3d2a=['then','notify','catch','[Notify]\x20','util','../../../config/logger','../rpc/faxAccount','error'];(function(_0x496f20,_0x1d040b){var _0x5eb21b=function(_0x4d2d84){while(--_0x4d2d84){_0x496f20['push'](_0x496f20['shift']());}};_0x5eb21b(++_0x1d040b);}(_0x3d2a,0x1e4));var _0xa3d2=function(_0x321728,_0x1fbc48){_0x321728=_0x321728-0x0;var _0x211876=_0x3d2a[_0x321728];return _0x211876;};'use strict';var util=require(_0xa3d2('0x0'));var BPromise=require('bluebird');var logger=require(_0xa3d2('0x1'))('preview');var _=require('lodash');var faxAccount=require(_0xa3d2('0x2'));function loggerCatch(_0x2f40c7){return function(_0x250900){logger[_0xa3d2('0x3')](_0x2f40c7,util['inspect'](_0x250900,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x1ad68b,_0x55ad14){return BPromise['resolve']()[_0xa3d2('0x4')](faxAccount[_0xa3d2('0x5')](_0x1ad68b,_0x55ad14))[_0xa3d2('0x6')](loggerCatch(_0xa3d2('0x7')));}; \ No newline at end of file +var _0x071b=['lodash','../rpc/faxAccount','error','inspect','notify','resolve','then','[Notify]\x20','util','bluebird','../../../config/logger','preview'];(function(_0x53995f,_0x1b135c){var _0x1649a9=function(_0x4da99b){while(--_0x4da99b){_0x53995f['push'](_0x53995f['shift']());}};_0x1649a9(++_0x1b135c);}(_0x071b,0x188));var _0xb071=function(_0x7a53c6,_0x238554){_0x7a53c6=_0x7a53c6-0x0;var _0x229957=_0x071b[_0x7a53c6];return _0x229957;};'use strict';var util=require(_0xb071('0x0'));var BPromise=require(_0xb071('0x1'));var logger=require(_0xb071('0x2'))(_0xb071('0x3'));var _=require(_0xb071('0x4'));var faxAccount=require(_0xb071('0x5'));function loggerCatch(_0x3b958b){return function(_0x4b6594){logger[_0xb071('0x6')](_0x3b958b,util[_0xb071('0x7')](_0x4b6594,{'showHidden':![],'depth':null}));};}exports[_0xb071('0x8')]=function(_0x4c6f54,_0x57cecf){return BPromise[_0xb071('0x9')]()[_0xb071('0xa')](faxAccount[_0xb071('0x8')](_0x4c6f54,_0x57cecf))['catch'](loggerCatch(_0xb071('0xb')));}; \ 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 8f6bfb7..6b5f564 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 _0x9269=['exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','bluebird','child_process'];(function(_0x125a02,_0x220ddd){var _0x5a63da=function(_0x2e74bd){while(--_0x2e74bd){_0x125a02['push'](_0x125a02['shift']());}};_0x5a63da(++_0x220ddd);}(_0x9269,0x66));var _0x9926=function(_0x4cebcc,_0x56253e){_0x4cebcc=_0x4cebcc-0x0;var _0x4d1669=_0x9269[_0x4cebcc];return _0x4d1669;};'use strict';var util=require('util');var logger=require('../../../../config/logger')('fax');var BPromise=require(_0x9926('0x0'));var exec=require(_0x9926('0x1'))[_0x9926('0x2')];exports[_0x9926('0x3')]=function(_0x423d5c){return new BPromise(function(_0x14a4a1,_0x4de2fe){exec(_0x423d5c,function(_0x3e7ec9,_0x3efb83,_0x3242a5){logger[_0x9926('0x4')](_0x9926('0x5'),_0x3efb83);if(_0x3e7ec9){logger[_0x9926('0x4')](_0x9926('0x5'),_0x9926('0x6'),util[_0x9926('0x7')](_0x3e7ec9,{'showHidden':![],'depth':null}),_0x3efb83,_0x3242a5);_0x4de2fe(_0x3e7ec9);}_0x14a4a1(_0x3efb83);});});}; \ No newline at end of file +var _0x2ad1=['execute','Exec\x20gs','info','util','../../../../config/logger','fax','child_process','exec'];(function(_0x2cb179,_0x19e34b){var _0x2b0201=function(_0x2b72ac){while(--_0x2b72ac){_0x2cb179['push'](_0x2cb179['shift']());}};_0x2b0201(++_0x19e34b);}(_0x2ad1,0x113));var _0x12ad=function(_0xc89935,_0x34ba1f){_0xc89935=_0xc89935-0x0;var _0x333c2e=_0x2ad1[_0xc89935];return _0x333c2e;};'use strict';var util=require(_0x12ad('0x0'));var logger=require(_0x12ad('0x1'))(_0x12ad('0x2'));var BPromise=require('bluebird');var exec=require(_0x12ad('0x3'))[_0x12ad('0x4')];exports[_0x12ad('0x5')]=function(_0x37e922){return new BPromise(function(_0x295206,_0x1230b6){exec(_0x37e922,function(_0x540dc3,_0x2c39d3,_0x14706b){logger['info'](_0x12ad('0x6'),_0x2c39d3);if(_0x540dc3){logger[_0x12ad('0x7')](_0x12ad('0x6'),'\x20Error\x20:',util['inspect'](_0x540dc3,{'showHidden':![],'depth':null}),_0x2c39d3,_0x14706b);_0x1230b6(_0x540dc3);}_0x295206(_0x2c39d3);});});}; \ 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 efccfa2..bdc0ecc 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 _0xadc7=['util','lodash','../../../../config/logger','fax','message','logger','info','inspect','ecm','minrate','maxrate','format','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','uniqueid'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xadc7,0x138));var _0x7adc=function(_0x2d486b,_0x5f213c){_0x2d486b=_0x2d486b-0x0;var _0x4291d1=_0xadc7[_0x2d486b];return _0x4291d1;};'use strict';var util=require(_0x7adc('0x0'));var _=require(_0x7adc('0x1'));var moment=require('moment');var logger=require(_0x7adc('0x2'))(_0x7adc('0x3'));exports[_0x7adc('0x4')]=function(_0x263237){return{'message':_0x263237};};exports[_0x7adc('0x5')]=function(_0x23caf5,_0x1356b6){logger[_0x7adc('0x6')](_0x23caf5,util[_0x7adc('0x7')](_0x1356b6,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x1be41d,_0x1af628){var _0x3c865f={'XMF-ECM':_0x1af628[_0x7adc('0x8')],'XMF-HEADERINFO':_0x1af628['headerinfo'],'XMF-MINRATE':_0x1af628[_0x7adc('0x9')],'XMF-MAXRATE':_0x1af628[_0x7adc('0xa')],'XMF-MODEM':util[_0x7adc('0xb')]('\x22%s\x22',_0x1af628['modem']),'XMF-GATEWAY':_0x1af628[_0x7adc('0xc')],'XMF-FAXDETECT':_0x1af628[_0x7adc('0xd')],'XMF-T38TIMEOUT':_0x1af628[_0x7adc('0xe')],'XMF-LOCALSTATIONID':_0x1af628[_0x7adc('0xf')],'XMF-PATH':_0x1be41d[_0x7adc('0x10')]};return _0x3c865f;};exports[_0x7adc('0x11')]=function(_0x1b7031,_0xc3bb3c){return{'actionid':_0x1b7031['uniqueid'],'action':'originate','channel':_0x1b7031[_0x7adc('0x12')],'Exten':_0x7adc('0x13'),'Context':_0x7adc('0x14'),'Priority':'1','callerid':util['format'](_0x7adc('0x15'),_0x1b7031[_0x7adc('0x16')]?_0x1b7031['headerinfo']:'',_0x1b7031[_0x7adc('0xf')]),'variable':_0xc3bb3c,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1b7031[_0x7adc('0x17')]};}; \ No newline at end of file +var _0xa25a=['message','logger','inspect','addVariables','minrate','maxrate','\x22%s\x22','gateway','t38timeout','localstationid','variablesAction','uniqueid','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','../../../../config/logger','fax'];(function(_0xd79b5f,_0x79f6b0){var _0x4f71e5=function(_0xf54186){while(--_0xf54186){_0xd79b5f['push'](_0xd79b5f['shift']());}};_0x4f71e5(++_0x79f6b0);}(_0xa25a,0x160));var _0xaa25=function(_0xd309a4,_0x100f7b){_0xd309a4=_0xd309a4-0x0;var _0x164f91=_0xa25a[_0xd309a4];return _0x164f91;};'use strict';var util=require(_0xaa25('0x0'));var _=require(_0xaa25('0x1'));var moment=require(_0xaa25('0x2'));var logger=require(_0xaa25('0x3'))(_0xaa25('0x4'));exports[_0xaa25('0x5')]=function(_0x1bce14){return{'message':_0x1bce14};};exports[_0xaa25('0x6')]=function(_0x1aa8a8,_0x5da771){logger['info'](_0x1aa8a8,util[_0xaa25('0x7')](_0x5da771,{'showHidden':![],'depth':null}));};exports[_0xaa25('0x8')]=function(_0x51ce9a,_0x16a212){var _0x76f978={'XMF-ECM':_0x16a212['ecm'],'XMF-HEADERINFO':_0x16a212['headerinfo'],'XMF-MINRATE':_0x16a212[_0xaa25('0x9')],'XMF-MAXRATE':_0x16a212[_0xaa25('0xa')],'XMF-MODEM':util['format'](_0xaa25('0xb'),_0x16a212['modem']),'XMF-GATEWAY':_0x16a212[_0xaa25('0xc')],'XMF-FAXDETECT':_0x16a212['faxdetect'],'XMF-T38TIMEOUT':_0x16a212[_0xaa25('0xd')],'XMF-LOCALSTATIONID':_0x16a212[_0xaa25('0xe')],'XMF-PATH':_0x51ce9a['path']};return _0x76f978;};exports[_0xaa25('0xf')]=function(_0x29df0d,_0x5a80c6){return{'actionid':_0x29df0d[_0xaa25('0x10')],'action':'originate','channel':_0x29df0d['channel'],'Exten':_0xaa25('0x11'),'Context':_0xaa25('0x12'),'Priority':'1','callerid':util['format'](_0xaa25('0x13'),_0x29df0d['headerinfo']?_0x29df0d[_0xaa25('0x14')]:'',_0x29df0d['localstationid']),'variable':_0x5a80c6,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x29df0d[_0xaa25('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 0d20217..0e652e4 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 _0x9cdd=['./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','hour','get','resolve','then','getTelephones','initTelephones','initTrunks','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9cdd,0x13b));var _0xd9cd=function(_0x58236d,_0x365c03){_0x58236d=_0x58236d-0x0;var _0x322688=_0x9cdd[_0x58236d];return _0x322688;};'use strict';var BPromise=require('bluebird');var util=require(_0xd9cd('0x0'));var moment=require(_0xd9cd('0x1'));var server=require(_0xd9cd('0x2'));var Realtime=require(_0xd9cd('0x3'));var Report=require(_0xd9cd('0x4'));var Acw=require(_0xd9cd('0x5'));var Trigger=require('./trigger');var Dialer=require(_0xd9cd('0x6'));var Preview=require(_0xd9cd('0x7'));var Fax=require(_0xd9cd('0x8'));var user=require(_0xd9cd('0x9'));var voiceQueue=require(_0xd9cd('0xa'));var voiceQueueReport=require(_0xd9cd('0xb'));var voiceCallReport=require(_0xd9cd('0xc'));var trunk=require('./rpc/trunk');var trigger=require(_0xd9cd('0xd'));var template=require(_0xd9cd('0xe'));var cmHopperHistory=require(_0xd9cd('0xf'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xd9cd('0x10'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xd9cd('0x11'));var salesforce=require(_0xd9cd('0x12'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require(_0xd9cd('0x13'));var vtiger=require(_0xd9cd('0x14'));var freshsales=require(_0xd9cd('0x15'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xd9cd('0x16'));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(_0xd9cd('0x17'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xd9cd('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xd9cd('0x19')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xd9cd('0x1a')]()['then'](user['getAgents']())[_0xd9cd('0x1b')](realtime['initAgents']())[_0xd9cd('0x1b')](user[_0xd9cd('0x1c')]())['then'](realtime[_0xd9cd('0x1d')]())[_0xd9cd('0x1b')](trunk['getTrunks']())[_0xd9cd('0x1b')](realtime[_0xd9cd('0x1e')]())[_0xd9cd('0x1b')](voiceQueue['getVoiceQueues']())[_0xd9cd('0x1b')](realtime[_0xd9cd('0x1f')]())['then'](trigger[_0xd9cd('0x20')]())[_0xd9cd('0x1b')](realtime[_0xd9cd('0x21')]())[_0xd9cd('0x1b')](template['getTemplates']())[_0xd9cd('0x1b')](realtime[_0xd9cd('0x22')]())['then'](zendesk[_0xd9cd('0x23')]())[_0xd9cd('0x1b')](realtime[_0xd9cd('0x24')]())[_0xd9cd('0x1b')](salesforce[_0xd9cd('0x25')]())[_0xd9cd('0x1b')](realtime['initSalesforceAccounts']())[_0xd9cd('0x1b')](sugarcrm[_0xd9cd('0x26')]())[_0xd9cd('0x1b')](realtime[_0xd9cd('0x27')]())[_0xd9cd('0x1b')](freshdesk[_0xd9cd('0x28')]())[_0xd9cd('0x1b')](realtime[_0xd9cd('0x29')]())[_0xd9cd('0x1b')](desk[_0xd9cd('0x2a')]())[_0xd9cd('0x1b')](realtime[_0xd9cd('0x2b')]())[_0xd9cd('0x1b')](zoho[_0xd9cd('0x2c')]())[_0xd9cd('0x1b')](realtime[_0xd9cd('0x2d')]())[_0xd9cd('0x1b')](vtiger[_0xd9cd('0x2e')]())['then'](realtime['initVtigerAccounts']())[_0xd9cd('0x1b')](freshsales[_0xd9cd('0x2f')]())[_0xd9cd('0x1b')](realtime[_0xd9cd('0x30')]())[_0xd9cd('0x1b')](servicenow['getServicenowAccounts']())[_0xd9cd('0x1b')](realtime[_0xd9cd('0x31')]())[_0xd9cd('0x1b')](dynamics365['getDynamics365Accounts']())['then'](realtime['initDynamics365Accounts']())[_0xd9cd('0x1b')](campaign[_0xd9cd('0x32')]())['then'](realtime['initCampaigns']())[_0xd9cd('0x1b')](voiceExtension[_0xd9cd('0x33')]())[_0xd9cd('0x1b')](realtime['initVoiceExtensions']())[_0xd9cd('0x1b')](faxAccount[_0xd9cd('0x34')]())[_0xd9cd('0x1b')](realtime[_0xd9cd('0x35')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xd9cd('0x1a')]()['then'](voiceQueueReport[_0xd9cd('0x36')]())['then'](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0xd9cd('0x37')]())[_0xd9cd('0x1b')](realtime[_0xd9cd('0x38')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0xd9cd('0x1b')](realtime[_0xd9cd('0x39')]())[_0xd9cd('0x1b')](voiceCallReport['getVoiceCallReports']())['then'](realtime[_0xd9cd('0x3a')]())[_0xd9cd('0x3b')](function(_0x5e00fd){logger[_0xd9cd('0x3c')](_0xd9cd('0x3d'),util[_0xd9cd('0x3e')](_0x5e00fd,{'showHidden':![],'depth':null}));});}function main(){return server[_0xd9cd('0x3f')](realtime,preview,fax)[_0xd9cd('0x1b')](function(_0x2e4818){return initRealtime();})[_0xd9cd('0x1b')](function(){return initParams();})[_0xd9cd('0x1b')](function(){report[_0xd9cd('0x40')]();setInterval(initRealtime,0x1388);})[_0xd9cd('0x3b')](function(_0x5c64ba){logger[_0xd9cd('0x3c')](_0xd9cd('0x41'),util[_0xd9cd('0x3e')](_0x5c64ba,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xbe48=['getTelephones','initTelephones','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','listen','sync','catch','inspect','util','moment','./server','./realtime','./dialer','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','resolve','then','getAgents'];(function(_0x2cc711,_0x300328){var _0x31a52e=function(_0x588378){while(--_0x588378){_0x2cc711['push'](_0x2cc711['shift']());}};_0x31a52e(++_0x300328);}(_0xbe48,0x1cd));var _0x8be4=function(_0x5ecbcb,_0x1fa159){_0x5ecbcb=_0x5ecbcb-0x0;var _0x415343=_0xbe48[_0x5ecbcb];return _0x415343;};'use strict';var BPromise=require('bluebird');var util=require(_0x8be4('0x0'));var moment=require(_0x8be4('0x1'));var server=require(_0x8be4('0x2'));var Realtime=require(_0x8be4('0x3'));var Report=require('./report');var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0x8be4('0x4'));var Preview=require('./preview');var Fax=require('./fax');var user=require(_0x8be4('0x5'));var voiceQueue=require(_0x8be4('0x6'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x8be4('0x7'));var trunk=require(_0x8be4('0x8'));var trigger=require(_0x8be4('0x9'));var template=require(_0x8be4('0xa'));var cmHopperHistory=require(_0x8be4('0xb'));var campaign=require(_0x8be4('0xc'));var voiceExtension=require(_0x8be4('0xd'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x8be4('0xe'));var salesforce=require(_0x8be4('0xf'));var sugarcrm=require(_0x8be4('0x10'));var freshdesk=require(_0x8be4('0x11'));var desk=require(_0x8be4('0x12'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x8be4('0x13'));var freshsales=require(_0x8be4('0x14'));var servicenow=require(_0x8be4('0x15'));var dynamics365=require(_0x8be4('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x8be4('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x8be4('0x18')](_0x8be4('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x8be4('0x18')](_0x8be4('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x8be4('0x1a')]()[_0x8be4('0x1b')](user[_0x8be4('0x1c')]())[_0x8be4('0x1b')](realtime['initAgents']())[_0x8be4('0x1b')](user[_0x8be4('0x1d')]())[_0x8be4('0x1b')](realtime[_0x8be4('0x1e')]())[_0x8be4('0x1b')](trunk['getTrunks']())[_0x8be4('0x1b')](realtime[_0x8be4('0x1f')]())[_0x8be4('0x1b')](voiceQueue['getVoiceQueues']())['then'](realtime[_0x8be4('0x20')]())[_0x8be4('0x1b')](trigger[_0x8be4('0x21')]())['then'](realtime[_0x8be4('0x22')]())[_0x8be4('0x1b')](template[_0x8be4('0x23')]())[_0x8be4('0x1b')](realtime[_0x8be4('0x24')]())['then'](zendesk[_0x8be4('0x25')]())[_0x8be4('0x1b')](realtime[_0x8be4('0x26')]())[_0x8be4('0x1b')](salesforce['getSalesforceAccounts']())[_0x8be4('0x1b')](realtime[_0x8be4('0x27')]())[_0x8be4('0x1b')](sugarcrm[_0x8be4('0x28')]())[_0x8be4('0x1b')](realtime[_0x8be4('0x29')]())[_0x8be4('0x1b')](freshdesk[_0x8be4('0x2a')]())[_0x8be4('0x1b')](realtime[_0x8be4('0x2b')]())[_0x8be4('0x1b')](desk['getDeskAccounts']())[_0x8be4('0x1b')](realtime[_0x8be4('0x2c')]())[_0x8be4('0x1b')](zoho[_0x8be4('0x2d')]())['then'](realtime[_0x8be4('0x2e')]())['then'](vtiger[_0x8be4('0x2f')]())[_0x8be4('0x1b')](realtime[_0x8be4('0x30')]())[_0x8be4('0x1b')](freshsales['getFreshsalesAccounts']())['then'](realtime['initFreshsalesAccounts']())[_0x8be4('0x1b')](servicenow[_0x8be4('0x31')]())[_0x8be4('0x1b')](realtime[_0x8be4('0x32')]())[_0x8be4('0x1b')](dynamics365[_0x8be4('0x33')]())[_0x8be4('0x1b')](realtime[_0x8be4('0x34')]())[_0x8be4('0x1b')](campaign[_0x8be4('0x35')]())[_0x8be4('0x1b')](realtime[_0x8be4('0x36')]())['then'](voiceExtension[_0x8be4('0x37')]())[_0x8be4('0x1b')](realtime[_0x8be4('0x38')]())[_0x8be4('0x1b')](faxAccount[_0x8be4('0x39')]())[_0x8be4('0x1b')](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return BPromise['resolve']()['then'](voiceQueueReport[_0x8be4('0x3a')]())['then'](realtime[_0x8be4('0x3b')]())[_0x8be4('0x1b')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0x8be4('0x3c')]())[_0x8be4('0x1b')](cmHopperHistory[_0x8be4('0x3d')]())[_0x8be4('0x1b')](realtime['initCampaignHopperHistory']())[_0x8be4('0x1b')](voiceCallReport[_0x8be4('0x3e')]())[_0x8be4('0x1b')](realtime[_0x8be4('0x3f')]())['catch'](function(_0x114ce7){logger[_0x8be4('0x40')](_0x8be4('0x41'),util['inspect'](_0x114ce7,{'showHidden':![],'depth':null}));});}function main(){return server[_0x8be4('0x42')](realtime,preview,fax)[_0x8be4('0x1b')](function(_0x2a85db){return initRealtime();})['then'](function(){return initParams();})[_0x8be4('0x1b')](function(){report[_0x8be4('0x43')]();setInterval(initRealtime,0x1388);})[_0x8be4('0x44')](function(_0x1a8b26){logger[_0x8be4('0x40')]('[index.js][main]',util[_0x8be4('0x45')](_0x1a8b26,{'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 d567aa9..e9aecfd 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 _0xcb91=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','updateStatusRealtime','state','idle','inuse','talking','statePause','voiceStatusTime','toNumber','voiceStatusCallerIdNumber','stringify','format','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x45dbc8,_0x336b20){var _0x320605=function(_0x2d423f){while(--_0x2d423f){_0x45dbc8['push'](_0x45dbc8['shift']());}};_0x320605(++_0x336b20);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35d775,_0x25431e){_0x35d775=_0x35d775-0x0;var _0x59384d=_0xcb91[_0x35d775];return _0x59384d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var md5=require(_0x1cb9('0x1'));var Redis=require(_0x1cb9('0x2'));var config=require(_0x1cb9('0x3'));config['redis']=_[_0x1cb9('0x4')](config[_0x1cb9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1cb9('0x6'))(new Redis(config[_0x1cb9('0x5')]));function Agent(_0x53ffbd){this['id']=_0x53ffbd['id']||0x0;this[_0x1cb9('0x7')]=_0x53ffbd[_0x1cb9('0x7')]||'';this['email']=_0x53ffbd[_0x1cb9('0x8')]||'';this[_0x1cb9('0x9')]=_0x53ffbd['accountcode']||'';this[_0x1cb9('0xa')]=_0x53ffbd['fullname']||'';this['state']=_0x1cb9('0xb');this[_0x1cb9('0xc')]=0x0;this[_0x1cb9('0xd')]=_0x1cb9('0xb');this[_0x1cb9('0xe')]='';this['phone']='';this[_0x1cb9('0xf')]='';this[_0x1cb9('0x10')]='';this[_0x1cb9('0x11')]=_0x53ffbd[_0x1cb9('0x11')]||![];this[_0x1cb9('0x12')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x1cb9('0x13')]='';this[_0x1cb9('0x14')]=![];this[_0x1cb9('0x15')]=![];this[_0x1cb9('0x1')]='';}Agent['prototype'][_0x1cb9('0x16')]=function(_0x6ef389){var _0x1b3cd7;if(_0x6ef389&&_0x6ef389[_0x1cb9('0x17')]){_0x1b3cd7=_0x6ef389[_0x1cb9('0x17')]['toLowerCase']();switch(_0x1b3cd7){case'not_inuse':_0x1b3cd7=_0x1cb9('0x18');break;case _0x1cb9('0x19'):_0x1b3cd7=_0x1cb9('0x1a');break;}}if(_0x1b3cd7&&this[_0x1cb9('0x12')]!==_0x1b3cd7||_0x6ef389[_0x1cb9('0x1b')]){this[_0x1cb9('0x1c')]=_[_0x1cb9('0x1d')](moment()['format']('x'));}if(_0x1b3cd7){this['voiceStatus']=_0x1b3cd7;}var _0x1b2fa6={'id':this['id'],'name':this[_0x1cb9('0x7')],'email':this[_0x1cb9('0x8')],'accountcode':this[_0x1cb9('0x9')],'fullname':this[_0x1cb9('0xa')],'state':this[_0x1cb9('0x17')],'stateTime':this[_0x1cb9('0xc')],'status':this['status'],'address':this['address'],'online':this[_0x1cb9('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1cb9('0x1c')],'voiceStatusCallerIdNumber':this[_0x1cb9('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x1cb9('0x14')]};var _0x325637=md5(JSON[_0x1cb9('0x1f')](_0x1b2fa6));if(this[_0x1cb9('0x1')]!==_0x325637){this[_0x1cb9('0x1')]=_0x325637;io['to'](util[_0x1cb9('0x20')]('user:%s',_0x1b2fa6['name']))[_0x1cb9('0x21')]('user:save',_0x1b2fa6);io[_0x1cb9('0x21')](_0x1cb9('0x22'),_0x1b2fa6);}};module[_0x1cb9('0x23')]=Agent; \ No newline at end of file +var _0xcb91=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','updateStatusRealtime','state','idle','inuse','talking','statePause','voiceStatusTime','toNumber','voiceStatusCallerIdNumber','stringify','format','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x131889,_0x4a0e72){var _0x42885c=function(_0x358df1){while(--_0x358df1){_0x131889['push'](_0x131889['shift']());}};_0x42885c(++_0x4a0e72);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4d8a8f,_0x2afd4c){_0x4d8a8f=_0x4d8a8f-0x0;var _0xfc4adc=_0xcb91[_0x4d8a8f];return _0xfc4adc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var md5=require(_0x1cb9('0x1'));var Redis=require(_0x1cb9('0x2'));var config=require(_0x1cb9('0x3'));config['redis']=_[_0x1cb9('0x4')](config[_0x1cb9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1cb9('0x6'))(new Redis(config[_0x1cb9('0x5')]));function Agent(_0x53ffbd){this['id']=_0x53ffbd['id']||0x0;this[_0x1cb9('0x7')]=_0x53ffbd[_0x1cb9('0x7')]||'';this['email']=_0x53ffbd[_0x1cb9('0x8')]||'';this[_0x1cb9('0x9')]=_0x53ffbd['accountcode']||'';this[_0x1cb9('0xa')]=_0x53ffbd['fullname']||'';this['state']=_0x1cb9('0xb');this[_0x1cb9('0xc')]=0x0;this[_0x1cb9('0xd')]=_0x1cb9('0xb');this[_0x1cb9('0xe')]='';this['phone']='';this[_0x1cb9('0xf')]='';this[_0x1cb9('0x10')]='';this[_0x1cb9('0x11')]=_0x53ffbd[_0x1cb9('0x11')]||![];this[_0x1cb9('0x12')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x1cb9('0x13')]='';this[_0x1cb9('0x14')]=![];this[_0x1cb9('0x15')]=![];this[_0x1cb9('0x1')]='';}Agent['prototype'][_0x1cb9('0x16')]=function(_0x6ef389){var _0x1b3cd7;if(_0x6ef389&&_0x6ef389[_0x1cb9('0x17')]){_0x1b3cd7=_0x6ef389[_0x1cb9('0x17')]['toLowerCase']();switch(_0x1b3cd7){case'not_inuse':_0x1b3cd7=_0x1cb9('0x18');break;case _0x1cb9('0x19'):_0x1b3cd7=_0x1cb9('0x1a');break;}}if(_0x1b3cd7&&this[_0x1cb9('0x12')]!==_0x1b3cd7||_0x6ef389[_0x1cb9('0x1b')]){this[_0x1cb9('0x1c')]=_[_0x1cb9('0x1d')](moment()['format']('x'));}if(_0x1b3cd7){this['voiceStatus']=_0x1b3cd7;}var _0x1b2fa6={'id':this['id'],'name':this[_0x1cb9('0x7')],'email':this[_0x1cb9('0x8')],'accountcode':this[_0x1cb9('0x9')],'fullname':this[_0x1cb9('0xa')],'state':this[_0x1cb9('0x17')],'stateTime':this[_0x1cb9('0xc')],'status':this['status'],'address':this['address'],'online':this[_0x1cb9('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1cb9('0x1c')],'voiceStatusCallerIdNumber':this[_0x1cb9('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x1cb9('0x14')]};var _0x325637=md5(JSON[_0x1cb9('0x1f')](_0x1b2fa6));if(this[_0x1cb9('0x1')]!==_0x325637){this[_0x1cb9('0x1')]=_0x325637;io['to'](util[_0x1cb9('0x20')]('user:%s',_0x1b2fa6['name']))[_0x1cb9('0x21')]('user:save',_0x1b2fa6);io[_0x1cb9('0x21')](_0x1cb9('0x22'),_0x1b2fa6);}};module[_0x1cb9('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index b215c21..f1ab905 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 _0xefd4=['message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','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','ivrTotalCallsDays'];(function(_0x42083b,_0x2f9bb6){var _0x11a1ff=function(_0x4c367c){while(--_0x4c367c){_0x42083b['push'](_0x42083b['shift']());}};_0x11a1ff(++_0x2f9bb6);}(_0xefd4,0x199));var _0x4efd=function(_0x37023c,_0x298013){_0x37023c=_0x37023c-0x0;var _0x108052=_0xefd4[_0x37023c];return _0x108052;};'use strict';function Campaign(_0x308bbc){this['id']=_0x308bbc['id']||0x0;this[_0x4efd('0x0')]=_0x308bbc[_0x4efd('0x0')]||'';this[_0x4efd('0x1')]=_0x308bbc['type']||_0x4efd('0x2');this[_0x4efd('0x3')]=0x0;this[_0x4efd('0x4')]=0x0;this[_0x4efd('0x5')]=0x0;this[_0x4efd('0x6')]=0x0;this[_0x4efd('0x7')]='';this['sendMessageOneNotActive']=!![];this[_0x4efd('0x8')]=_0x308bbc['active'];this[_0x4efd('0x9')]=_0x308bbc[_0x4efd('0x9')];this[_0x4efd('0xa')]=_0x308bbc[_0x4efd('0xa')]||null;this[_0x4efd('0xb')]=_0x308bbc[_0x4efd('0xb')]?_0x308bbc[_0x4efd('0xb')]:null;this[_0x4efd('0xc')]=_0x308bbc[_0x4efd('0xc')];this['dialOriginateCallerIdNumber']=_0x308bbc[_0x4efd('0xd')];this[_0x4efd('0xe')]=_0x308bbc['dialOriginateTimeout']||0x1e;this[_0x4efd('0xf')]=_0x308bbc[_0x4efd('0xf')];this[_0x4efd('0x10')]=_0x308bbc[_0x4efd('0x10')];this[_0x4efd('0x11')]=_0x308bbc['dialBusyMaxRetry'];this[_0x4efd('0x12')]=_0x308bbc[_0x4efd('0x12')];this[_0x4efd('0x13')]=_0x308bbc[_0x4efd('0x13')];this[_0x4efd('0x14')]=_0x308bbc[_0x4efd('0x14')];this[_0x4efd('0x15')]=_0x308bbc[_0x4efd('0x15')];this[_0x4efd('0x16')]=_0x308bbc['dialNoSuchNumberMaxRetry']||0x3;this[_0x4efd('0x17')]=_0x308bbc['dialNoSuchNumberRetryFrequency']||0x96;this[_0x4efd('0x18')]=_0x308bbc[_0x4efd('0x18')]||0x3;this[_0x4efd('0x19')]=_0x308bbc[_0x4efd('0x19')]||0x96;this[_0x4efd('0x1a')]=_0x308bbc[_0x4efd('0x1a')]||0x3;this[_0x4efd('0x1b')]=_0x308bbc[_0x4efd('0x1b')]||0x96;this['dialMachineMaxRetry']=_0x308bbc['dialMachineMaxRetry']||0x3;this[_0x4efd('0x1c')]=_0x308bbc[_0x4efd('0x1c')]||0x96;this[_0x4efd('0x1d')]=_0x308bbc[_0x4efd('0x1d')]||0x3;this[_0x4efd('0x1e')]=_0x308bbc[_0x4efd('0x1e')]||0x96;this[_0x4efd('0x1f')]=_0x308bbc[_0x4efd('0x1f')]||_0x4efd('0x20');this[_0x4efd('0x21')]=_0x308bbc['dialPrefix']||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x308bbc[_0x4efd('0x22')]||undefined;this[_0x4efd('0x23')]=_0x308bbc[_0x4efd('0x23')]||undefined;this[_0x4efd('0x24')]=_0x308bbc[_0x4efd('0x24')]?_0x308bbc[_0x4efd('0x24')]:undefined;this[_0x4efd('0x25')]=_0x308bbc['Trunk']?_0x308bbc[_0x4efd('0x25')]:undefined;this[_0x4efd('0x26')]=_0x308bbc[_0x4efd('0x26')]?_0x308bbc[_0x4efd('0x26')]:undefined;this[_0x4efd('0x27')]=_0x308bbc[_0x4efd('0x27')]?_0x308bbc['SquareProject']:undefined;this[_0x4efd('0x28')]=_0x308bbc[_0x4efd('0x27')]?_0x308bbc['SquareProject'][_0x4efd('0x0')]:undefined;this[_0x4efd('0x29')]=_0x308bbc[_0x4efd('0x29')]||![];this[_0x4efd('0x2a')]=_0x308bbc[_0x4efd('0x2a')];this[_0x4efd('0x2b')]=_0x308bbc[_0x4efd('0x2b')];this['dialAMDAfterGreetingSilence']=_0x308bbc[_0x4efd('0x2c')];this[_0x4efd('0x2d')]=_0x308bbc[_0x4efd('0x2d')];this['dialAMDMinWordLength']=_0x308bbc[_0x4efd('0x2e')];this[_0x4efd('0x2f')]=_0x308bbc[_0x4efd('0x2f')];this[_0x4efd('0x30')]=_0x308bbc['dialAMDMaximumNumberOfWords'];this[_0x4efd('0x31')]=_0x308bbc[_0x4efd('0x31')];this[_0x4efd('0x32')]=_0x308bbc[_0x4efd('0x32')];}module[_0x4efd('0x33')]=Campaign; \ No newline at end of file +var _0x4e83=['campaign','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','exports','name','type'];(function(_0x36716f,_0x5bcaa4){var _0x16d03c=function(_0x7591fa){while(--_0x7591fa){_0x36716f['push'](_0x36716f['shift']());}};_0x16d03c(++_0x5bcaa4);}(_0x4e83,0x147));var _0x34e8=function(_0x116c04,_0x4963da){_0x116c04=_0x116c04-0x0;var _0x9e011d=_0x4e83[_0x116c04];return _0x9e011d;};'use strict';function Campaign(_0x459f98){this['id']=_0x459f98['id']||0x0;this['name']=_0x459f98[_0x34e8('0x0')]||'';this[_0x34e8('0x1')]=_0x459f98['type']||_0x34e8('0x2');this[_0x34e8('0x3')]=0x0;this[_0x34e8('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x34e8('0x5')]=0x0;this[_0x34e8('0x6')]='';this[_0x34e8('0x7')]=!![];this['active']=_0x459f98[_0x34e8('0x8')];this['limitCalls']=_0x459f98[_0x34e8('0x9')];this[_0x34e8('0xa')]=_0x459f98['dialTimezone']||null;this[_0x34e8('0xb')]=_0x459f98[_0x34e8('0xb')]?_0x459f98[_0x34e8('0xb')]:null;this[_0x34e8('0xc')]=_0x459f98['dialOriginateCallerIdName'];this[_0x34e8('0xd')]=_0x459f98[_0x34e8('0xd')];this[_0x34e8('0xe')]=_0x459f98[_0x34e8('0xe')]||0x1e;this['dialCongestionMaxRetry']=_0x459f98[_0x34e8('0xf')];this[_0x34e8('0x10')]=_0x459f98[_0x34e8('0x10')];this[_0x34e8('0x11')]=_0x459f98[_0x34e8('0x11')];this[_0x34e8('0x12')]=_0x459f98[_0x34e8('0x12')];this[_0x34e8('0x13')]=_0x459f98[_0x34e8('0x13')];this[_0x34e8('0x14')]=_0x459f98[_0x34e8('0x14')];this[_0x34e8('0x15')]=_0x459f98[_0x34e8('0x15')];this[_0x34e8('0x16')]=_0x459f98[_0x34e8('0x16')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x459f98[_0x34e8('0x17')]||0x96;this[_0x34e8('0x18')]=_0x459f98[_0x34e8('0x18')]||0x3;this['dialDropRetryFrequency']=_0x459f98[_0x34e8('0x19')]||0x96;this[_0x34e8('0x1a')]=_0x459f98[_0x34e8('0x1a')]||0x3;this[_0x34e8('0x1b')]=_0x459f98[_0x34e8('0x1b')]||0x96;this['dialMachineMaxRetry']=_0x459f98['dialMachineMaxRetry']||0x3;this[_0x34e8('0x1c')]=_0x459f98[_0x34e8('0x1c')]||0x96;this[_0x34e8('0x1d')]=_0x459f98[_0x34e8('0x1d')]||0x3;this[_0x34e8('0x1e')]=_0x459f98[_0x34e8('0x1e')]||0x96;this[_0x34e8('0x1f')]=_0x459f98[_0x34e8('0x1f')]||'DESC';this[_0x34e8('0x20')]=_0x459f98[_0x34e8('0x20')]||undefined;this[_0x34e8('0x21')]=_0x459f98[_0x34e8('0x21')]||undefined;this[_0x34e8('0x22')]=_0x459f98[_0x34e8('0x22')]||undefined;this[_0x34e8('0x23')]=_0x459f98['TrunkBackup']?_0x459f98[_0x34e8('0x23')]:undefined;this[_0x34e8('0x24')]=_0x459f98[_0x34e8('0x24')]?_0x459f98[_0x34e8('0x24')]:undefined;this['Interval']=_0x459f98[_0x34e8('0x25')]?_0x459f98['Interval']:undefined;this[_0x34e8('0x26')]=_0x459f98['SquareProject']?_0x459f98[_0x34e8('0x26')]:undefined;this[_0x34e8('0x27')]=_0x459f98[_0x34e8('0x26')]?_0x459f98[_0x34e8('0x26')][_0x34e8('0x0')]:undefined;this['dialAMDActive']=_0x459f98[_0x34e8('0x28')]||![];this['dialAMDInitialSilence']=_0x459f98['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x459f98[_0x34e8('0x29')];this['dialAMDAfterGreetingSilence']=_0x459f98['dialAMDAfterGreetingSilence'];this[_0x34e8('0x2a')]=_0x459f98[_0x34e8('0x2a')];this['dialAMDMinWordLength']=_0x459f98['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x459f98[_0x34e8('0x2b')];this[_0x34e8('0x2c')]=_0x459f98[_0x34e8('0x2c')];this['dialAMDSilenceThreshold']=_0x459f98['dialAMDSilenceThreshold'];this[_0x34e8('0x2d')]=_0x459f98[_0x34e8('0x2d')];}module[_0x34e8('0x2e')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 806bbf1..4288bb3 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 _0xd90a=['transferconnectedlinenum','mohtime','exports','starttime','destinationchannel','calleridname','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','duration','billableseconds','type','tag','disposition','monitorFilename','queue','transfercalleridnum'];(function(_0x590d76,_0x3da5b2){var _0x25ea42=function(_0x1d788c){while(--_0x1d788c){_0x590d76['push'](_0x590d76['shift']());}};_0x25ea42(++_0x3da5b2);}(_0xd90a,0x6b));var _0xad90=function(_0x58958b,_0x16613b){_0x58958b=_0x58958b-0x0;var _0x210715=_0xd90a[_0x58958b];return _0x210715;};'use strict';function Channel(){this[_0xad90('0x0')]=null;this['channel']='';this[_0xad90('0x1')]='';this['calleridnum']=0x0;this[_0xad90('0x2')]='';this['connectedlinenum']=undefined;this[_0xad90('0x3')]=undefined;this[_0xad90('0x4')]=0x0;this[_0xad90('0x5')]='';this[_0xad90('0x6')]=0x0;this[_0xad90('0x7')]=0x0;this[_0xad90('0x8')]=0x0;this[_0xad90('0x9')]=![];this[_0xad90('0xa')]=null;this[_0xad90('0xb')]=null;this[_0xad90('0xc')]=![];this[_0xad90('0xd')]=![];this[_0xad90('0xe')]='';this['lastdata']='';this[_0xad90('0xf')]=0x0;this[_0xad90('0x10')]=0x0;this['holdtime']=0x0;this[_0xad90('0x11')]=null;this[_0xad90('0x12')]=null;this[_0xad90('0x13')]=null;this['monitor']=![];this[_0xad90('0x14')]=null;this[_0xad90('0x15')]=null;this['monitors']=[];this[_0xad90('0x16')]=undefined;this[_0xad90('0x17')]=undefined;this['transferType']=undefined;this[_0xad90('0x18')]=0x0;}module[_0xad90('0x19')]=Channel; \ No newline at end of file +var _0xb2f2=['monitors','transferconnectedlinenum','mohtime','exports','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answered','answertime','endtime','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','queue'];(function(_0x1afabf,_0x56fdcc){var _0x497ff1=function(_0x2f6104){while(--_0x2f6104){_0x1afabf['push'](_0x1afabf['shift']());}};_0x497ff1(++_0x56fdcc);}(_0xb2f2,0xc8));var _0x2b2f=function(_0x399795,_0x2f2354){_0x399795=_0x399795-0x0;var _0x387f69=_0xb2f2[_0x399795];return _0x387f69;};'use strict';function Channel(){this[_0x2b2f('0x0')]=null;this[_0x2b2f('0x1')]='';this['destinationchannel']='';this[_0x2b2f('0x2')]=0x0;this[_0x2b2f('0x3')]='';this[_0x2b2f('0x4')]=undefined;this[_0x2b2f('0x5')]=undefined;this[_0x2b2f('0x6')]=0x0;this[_0x2b2f('0x7')]='';this[_0x2b2f('0x8')]=0x0;this['linkedid']=0x0;this[_0x2b2f('0x9')]=0x0;this[_0x2b2f('0xa')]=![];this[_0x2b2f('0xb')]=null;this[_0x2b2f('0xc')]=null;this['unmanaged']=![];this[_0x2b2f('0xd')]=![];this[_0x2b2f('0xe')]='';this[_0x2b2f('0xf')]='';this[_0x2b2f('0x10')]=0x0;this[_0x2b2f('0x11')]=0x0;this[_0x2b2f('0x12')]=0x0;this[_0x2b2f('0x13')]=null;this[_0x2b2f('0x14')]=null;this[_0x2b2f('0x15')]=null;this[_0x2b2f('0x16')]=![];this['monitorFilename']=null;this[_0x2b2f('0x17')]=null;this[_0x2b2f('0x18')]=[];this['transfercalleridnum']=undefined;this[_0x2b2f('0x19')]=undefined;this['transferType']=undefined;this[_0x2b2f('0x1a')]=0x0;}module[_0x2b2f('0x1b')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 2e1c4d9..25f83a8 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 _0xa912=['authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x389f57,_0x57b6e0){var _0x15c578=function(_0x2bb201){while(--_0x2bb201){_0x389f57['push'](_0x389f57['shift']());}};_0x15c578(++_0x57b6e0);}(_0xa912,0x7f));var _0x2a91=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xa912[_0x5f1391];return _0x50ebe3;};'use strict';function DeskAccount(_0x242bf8){this['id']=_0x242bf8['id']||0x0;this[_0x2a91('0x0')]=_0x242bf8[_0x2a91('0x0')]||'';this[_0x2a91('0x1')]=_0x242bf8[_0x2a91('0x1')]||'';this[_0x2a91('0x2')]=_0x242bf8[_0x2a91('0x2')]||'';this['authType']=_0x242bf8[_0x2a91('0x3')]||'';this['password']=_0x242bf8[_0x2a91('0x4')]||'';this[_0x2a91('0x5')]=_0x242bf8['consumerKey']||'';this['consumerSecret']=_0x242bf8[_0x2a91('0x6')]||'';this['token']=_0x242bf8[_0x2a91('0x7')]||'';this[_0x2a91('0x8')]=_0x242bf8[_0x2a91('0x8')]||'';this[_0x2a91('0x9')]=_0x242bf8['type']||'';this[_0x2a91('0xa')]=_0x242bf8[_0x2a91('0xa')]||'';this[_0x2a91('0xb')]=_0x242bf8[_0x2a91('0xb')]||{};}module[_0x2a91('0xc')]=DeskAccount; \ No newline at end of file +var _0x49f7=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0x19338e,_0x1cbb19){var _0x595ae6=function(_0x4f4385){while(--_0x4f4385){_0x19338e['push'](_0x19338e['shift']());}};_0x595ae6(++_0x1cbb19);}(_0x49f7,0xd9));var _0x749f=function(_0x4da74c,_0x445583){_0x4da74c=_0x4da74c-0x0;var _0x545ce1=_0x49f7[_0x4da74c];return _0x545ce1;};'use strict';function DeskAccount(_0x4c9244){this['id']=_0x4c9244['id']||0x0;this[_0x749f('0x0')]=_0x4c9244['name']||'';this[_0x749f('0x1')]=_0x4c9244['username']||'';this['remoteUri']=_0x4c9244[_0x749f('0x2')]||'';this[_0x749f('0x3')]=_0x4c9244[_0x749f('0x3')]||'';this[_0x749f('0x4')]=_0x4c9244[_0x749f('0x4')]||'';this[_0x749f('0x5')]=_0x4c9244[_0x749f('0x5')]||'';this[_0x749f('0x6')]=_0x4c9244['consumerSecret']||'';this[_0x749f('0x7')]=_0x4c9244[_0x749f('0x7')]||'';this[_0x749f('0x8')]=_0x4c9244['tokenSecret']||'';this[_0x749f('0x9')]=_0x4c9244[_0x749f('0x9')]||'';this['serverUrl']=_0x4c9244[_0x749f('0xa')]||'';this[_0x749f('0xb')]=_0x4c9244[_0x749f('0xb')]||{};}module[_0x749f('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 324e577..3aa2aca 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 _0xe605=['clientSecret','serverUrl','name','username','password','remoteUri','tenantId','clientId'];(function(_0xe779,_0x1a1b29){var _0x5201de=function(_0x26044f){while(--_0x26044f){_0xe779['push'](_0xe779['shift']());}};_0x5201de(++_0x1a1b29);}(_0xe605,0x92));var _0x5e60=function(_0xd91055,_0x3da876){_0xd91055=_0xd91055-0x0;var _0x196539=_0xe605[_0xd91055];return _0x196539;};'use strict';function Dynamics365Account(_0x4cf32c){this['id']=_0x4cf32c['id']||0x0;this[_0x5e60('0x0')]=_0x4cf32c['name']||'';this[_0x5e60('0x1')]=_0x4cf32c[_0x5e60('0x1')]||'';this[_0x5e60('0x2')]=_0x4cf32c[_0x5e60('0x2')]||'';this[_0x5e60('0x3')]=_0x4cf32c[_0x5e60('0x3')]||'';this[_0x5e60('0x4')]=_0x4cf32c[_0x5e60('0x4')]||'';this[_0x5e60('0x5')]=_0x4cf32c[_0x5e60('0x5')]||'';this[_0x5e60('0x6')]=_0x4cf32c[_0x5e60('0x6')]||{};this['serverUrl']=_0x4cf32c[_0x5e60('0x7')]||'';this['Configurations']=_0x4cf32c['Configurations']||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x153f=['remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','password'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x153f,0x15b));var _0xf153=function(_0x299fc8,_0x1663c9){_0x299fc8=_0x299fc8-0x0;var _0x1d343b=_0x153f[_0x299fc8];return _0x1d343b;};'use strict';function Dynamics365Account(_0x2bbc4c){this['id']=_0x2bbc4c['id']||0x0;this[_0xf153('0x0')]=_0x2bbc4c[_0xf153('0x0')]||'';this[_0xf153('0x1')]=_0x2bbc4c[_0xf153('0x1')]||'';this[_0xf153('0x2')]=_0x2bbc4c[_0xf153('0x2')]||'';this['remoteUri']=_0x2bbc4c[_0xf153('0x3')]||'';this['tenantId']=_0x2bbc4c[_0xf153('0x4')]||'';this[_0xf153('0x5')]=_0x2bbc4c[_0xf153('0x5')]||'';this[_0xf153('0x6')]=_0x2bbc4c[_0xf153('0x6')]||{};this['serverUrl']=_0x2bbc4c[_0xf153('0x7')]||'';this[_0xf153('0x8')]=_0x2bbc4c[_0xf153('0x8')]||{};}module[_0xf153('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index d916105..6adbc64 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 _0xde07=['gateway','t38timeout','tech','SIP','Trunk','key','name','description','ecm','headerinfo','minrate','maxrate','modem'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xde07,0xa2));var _0x7de0=function(_0x5eb6b9,_0x144aa2){_0x5eb6b9=_0x5eb6b9-0x0;var _0x1c9e1a=_0xde07[_0x5eb6b9];return _0x1c9e1a;};'use strict';function FaxAccount(_0x3e1e14){this['id']=_0x3e1e14['id']||0x0;this[_0x7de0('0x0')]=_0x3e1e14['name']||'';this[_0x7de0('0x1')]=_0x3e1e14[_0x7de0('0x1')];this[_0x7de0('0x2')]=_0x3e1e14[_0x7de0('0x2')];this[_0x7de0('0x3')]=_0x3e1e14[_0x7de0('0x3')];this['localstationid']=_0x3e1e14['localstationid'];this[_0x7de0('0x4')]=_0x3e1e14[_0x7de0('0x4')]||0x960;this[_0x7de0('0x5')]=_0x3e1e14[_0x7de0('0x5')]||0x3840;this['modem']=_0x3e1e14[_0x7de0('0x6')]||'v17,v27,v29';this[_0x7de0('0x7')]=_0x3e1e14[_0x7de0('0x7')]||'no';this['faxdetect']=_0x3e1e14['faxdetect']||'no';this[_0x7de0('0x8')]=_0x3e1e14['t38timeout']||0x1388;this['tech']=_0x3e1e14[_0x7de0('0x9')]||_0x7de0('0xa');this[_0x7de0('0xb')]=_0x3e1e14[_0x7de0('0xb')]?_0x3e1e14['Trunk']:undefined;this['ListId']=_0x3e1e14['ListId'];this['key']=_0x3e1e14[_0x7de0('0xc')];}module['exports']=FaxAccount; \ No newline at end of file +var _0xf30f=['key','exports','name','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId'];(function(_0x17856b,_0x5852b3){var _0x14e44a=function(_0x3a3f4d){while(--_0x3a3f4d){_0x17856b['push'](_0x17856b['shift']());}};_0x14e44a(++_0x5852b3);}(_0xf30f,0x1a2));var _0xff30=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xf30f[_0x1694f5];return _0x5b4321;};'use strict';function FaxAccount(_0x2958c5){this['id']=_0x2958c5['id']||0x0;this[_0xff30('0x0')]=_0x2958c5[_0xff30('0x0')]||'';this['description']=_0x2958c5['description'];this['ecm']=_0x2958c5['ecm'];this[_0xff30('0x1')]=_0x2958c5[_0xff30('0x1')];this['localstationid']=_0x2958c5[_0xff30('0x2')];this[_0xff30('0x3')]=_0x2958c5[_0xff30('0x3')]||0x960;this[_0xff30('0x4')]=_0x2958c5[_0xff30('0x4')]||0x3840;this[_0xff30('0x5')]=_0x2958c5[_0xff30('0x5')]||_0xff30('0x6');this[_0xff30('0x7')]=_0x2958c5[_0xff30('0x7')]||'no';this[_0xff30('0x8')]=_0x2958c5[_0xff30('0x8')]||'no';this['t38timeout']=_0x2958c5[_0xff30('0x9')]||0x1388;this['tech']=_0x2958c5[_0xff30('0xa')]||_0xff30('0xb');this[_0xff30('0xc')]=_0x2958c5[_0xff30('0xc')]?_0x2958c5[_0xff30('0xc')]:undefined;this[_0xff30('0xd')]=_0x2958c5['ListId'];this[_0xff30('0xe')]=_0x2958c5[_0xff30('0xe')];}module[_0xff30('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 3d85b88..4a6579d 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 _0x44b4=['exports','name','username','apiKey','remoteUri','serverUrl','Configurations'];(function(_0xe2e576,_0x5206e9){var _0x1000f5=function(_0x196be6){while(--_0x196be6){_0xe2e576['push'](_0xe2e576['shift']());}};_0x1000f5(++_0x5206e9);}(_0x44b4,0xbe));var _0x444b=function(_0x24236c,_0x51b207){_0x24236c=_0x24236c-0x0;var _0x554460=_0x44b4[_0x24236c];return _0x554460;};'use strict';function FreshdeskAccount(_0x2a6123){this['id']=_0x2a6123['id']||0x0;this[_0x444b('0x0')]=_0x2a6123[_0x444b('0x0')]||'';this[_0x444b('0x1')]=_0x2a6123[_0x444b('0x1')]||'';this[_0x444b('0x2')]=_0x2a6123['token']||'';this[_0x444b('0x3')]=_0x2a6123[_0x444b('0x3')]||'';this[_0x444b('0x4')]=_0x2a6123[_0x444b('0x4')]||'';this[_0x444b('0x5')]=_0x2a6123['Configurations']||{};}module[_0x444b('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x1969=['Configurations','exports','username','apiKey','remoteUri','serverUrl'];(function(_0x363c04,_0x42e498){var _0x286c40=function(_0x4dc2ed){while(--_0x4dc2ed){_0x363c04['push'](_0x363c04['shift']());}};_0x286c40(++_0x42e498);}(_0x1969,0x110));var _0x9196=function(_0x1c7ea0,_0x8dbf69){_0x1c7ea0=_0x1c7ea0-0x0;var _0x29a8ff=_0x1969[_0x1c7ea0];return _0x29a8ff;};'use strict';function FreshdeskAccount(_0xbc4e81){this['id']=_0xbc4e81['id']||0x0;this['name']=_0xbc4e81['name']||'';this[_0x9196('0x0')]=_0xbc4e81[_0x9196('0x0')]||'';this[_0x9196('0x1')]=_0xbc4e81['token']||'';this[_0x9196('0x2')]=_0xbc4e81[_0x9196('0x2')]||'';this['serverUrl']=_0xbc4e81[_0x9196('0x3')]||'';this[_0x9196('0x4')]=_0xbc4e81[_0x9196('0x4')]||{};}module[_0x9196('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 6f82c48..56bf3c9 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 _0x2975=['apiKey','token','serverUrl','Configurations','exports','name','username'];(function(_0x54d58a,_0x2dd75c){var _0x15bc4b=function(_0x59f437){while(--_0x59f437){_0x54d58a['push'](_0x54d58a['shift']());}};_0x15bc4b(++_0x2dd75c);}(_0x2975,0x1c5));var _0x5297=function(_0x58c44e,_0x40cf96){_0x58c44e=_0x58c44e-0x0;var _0x1849d0=_0x2975[_0x58c44e];return _0x1849d0;};'use strict';function FreshsalesAccount(_0xda2e11){this['id']=_0xda2e11['id']||0x0;this[_0x5297('0x0')]=_0xda2e11[_0x5297('0x0')]||'';this[_0x5297('0x1')]=_0xda2e11[_0x5297('0x1')]||'';this[_0x5297('0x2')]=_0xda2e11[_0x5297('0x3')]||'';this['remoteUri']=_0xda2e11['remoteUri']||'';this['serverUrl']=_0xda2e11[_0x5297('0x4')]||'';this[_0x5297('0x5')]=_0xda2e11[_0x5297('0x5')]||{};}module[_0x5297('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x5292=['serverUrl','name','username','apiKey','token','remoteUri'];(function(_0x85d56d,_0x37f5c1){var _0x51f613=function(_0x4927df){while(--_0x4927df){_0x85d56d['push'](_0x85d56d['shift']());}};_0x51f613(++_0x37f5c1);}(_0x5292,0xf7));var _0x2529=function(_0x388ccc,_0x2a24fd){_0x388ccc=_0x388ccc-0x0;var _0x570c20=_0x5292[_0x388ccc];return _0x570c20;};'use strict';function FreshsalesAccount(_0x2697a8){this['id']=_0x2697a8['id']||0x0;this[_0x2529('0x0')]=_0x2697a8['name']||'';this[_0x2529('0x1')]=_0x2697a8['username']||'';this[_0x2529('0x2')]=_0x2697a8[_0x2529('0x3')]||'';this[_0x2529('0x4')]=_0x2697a8[_0x2529('0x4')]||'';this['serverUrl']=_0x2697a8[_0x2529('0x5')]||'';this['Configurations']=_0x2697a8['Configurations']||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 383179e..53cfc6b 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 _0x08cb=['connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','variables','exports','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum'];(function(_0x4474fa,_0xa90a35){var _0x285379=function(_0xf1c831){while(--_0xf1c831){_0x4474fa['push'](_0x4474fa['shift']());}};_0x285379(++_0xa90a35);}(_0x08cb,0x106));var _0xb08c=function(_0x2b9e73,_0x3d50b6){_0x2b9e73=_0x2b9e73-0x0;var _0x20a764=_0x08cb[_0x2b9e73];return _0x20a764;};'use strict';function QueueReport(){this['type']='inbound';this['uniqueid']='';this[_0xb08c('0x0')]='';this[_0xb08c('0x1')]='';this['queue']='';this[_0xb08c('0x2')]=null;this[_0xb08c('0x3')]=null;this[_0xb08c('0x4')]=0x1;this['count']=0x1;this[_0xb08c('0x5')]=![];this[_0xb08c('0x6')]=null;this[_0xb08c('0x7')]=![];this[_0xb08c('0x8')]=null;this[_0xb08c('0x9')]=![];this[_0xb08c('0xa')]=null;this[_0xb08c('0xb')]=0x1;this['channel']='';this[_0xb08c('0xc')]='';this[_0xb08c('0xd')]='';this[_0xb08c('0xe')]='';this[_0xb08c('0xf')]='';this[_0xb08c('0x10')]='';this[_0xb08c('0x11')]='';this[_0xb08c('0x12')]=0x0;this[_0xb08c('0x13')]=![];this[_0xb08c('0x14')]='';this[_0xb08c('0x15')]=_0xb08c('0x16');this['mohtime']=0x0;this[_0xb08c('0x17')]={};}module[_0xb08c('0x18')]=QueueReport; \ No newline at end of file +var _0x9f4e=['exten','assigned','mohtime','variables','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context'];(function(_0x450b5d,_0x18a4bb){var _0x55ce78=function(_0x5999c1){while(--_0x5999c1){_0x450b5d['push'](_0x450b5d['shift']());}};_0x55ce78(++_0x18a4bb);}(_0x9f4e,0x1e4));var _0xe9f4=function(_0x32c012,_0xe3c576){_0x32c012=_0x32c012-0x0;var _0x48562e=_0x9f4e[_0x32c012];return _0x48562e;};'use strict';function QueueReport(){this[_0xe9f4('0x0')]=_0xe9f4('0x1');this[_0xe9f4('0x2')]='';this[_0xe9f4('0x3')]='';this[_0xe9f4('0x4')]='';this[_0xe9f4('0x5')]='';this['queuecallerjoinAt']=null;this[_0xe9f4('0x6')]=null;this[_0xe9f4('0x7')]=0x1;this[_0xe9f4('0x8')]=0x1;this[_0xe9f4('0x9')]=![];this[_0xe9f4('0xa')]=null;this[_0xe9f4('0xb')]=![];this[_0xe9f4('0xc')]=null;this[_0xe9f4('0xd')]=![];this['queuecallerexitAt']=null;this[_0xe9f4('0xe')]=0x1;this[_0xe9f4('0xf')]='';this[_0xe9f4('0x10')]='';this[_0xe9f4('0x11')]='';this[_0xe9f4('0x12')]='';this[_0xe9f4('0x13')]='';this[_0xe9f4('0x14')]='';this['priority']='';this['holdtime']=0x0;this[_0xe9f4('0x15')]=![];this['lastAssignedTo']='';this['motionChannel']='voice';this[_0xe9f4('0x16')]=0x0;this[_0xe9f4('0x17')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 5d9e9f3..c9e1391 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 _0x3ed1=['type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3ed1,0x13d));var _0x13ed=function(_0x5ce33c,_0x5c75a9){_0x5ce33c=_0x5ce33c-0x0;var _0x40c7d4=_0x3ed1[_0x5ce33c];return _0x40c7d4;};'use strict';function SalesforceAccount(_0x5e8a76){this['id']=_0x5e8a76['id']||0x0;this[_0x13ed('0x0')]=_0x5e8a76[_0x13ed('0x0')]||'';this[_0x13ed('0x1')]=_0x5e8a76[_0x13ed('0x1')]||'';this['remoteUri']=_0x5e8a76[_0x13ed('0x2')]||'';this[_0x13ed('0x3')]=_0x5e8a76[_0x13ed('0x3')]||'';this[_0x13ed('0x4')]=_0x5e8a76[_0x13ed('0x4')]||'';this[_0x13ed('0x5')]=_0x5e8a76[_0x13ed('0x5')]||'';this[_0x13ed('0x6')]=_0x5e8a76[_0x13ed('0x6')]||'';this[_0x13ed('0x7')]=_0x5e8a76[_0x13ed('0x7')]||_0x13ed('0x8');this[_0x13ed('0x9')]=_0x5e8a76['serverUrl']||'';this[_0x13ed('0xa')]=_0x5e8a76[_0x13ed('0xa')]||{};}module[_0x13ed('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x0ca8=['name','username','remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl','Configurations'];(function(_0x2bf888,_0x374f0b){var _0x3038d6=function(_0xe1b6d9){while(--_0xe1b6d9){_0x2bf888['push'](_0x2bf888['shift']());}};_0x3038d6(++_0x374f0b);}(_0x0ca8,0xe6));var _0x80ca=function(_0x3e3cdd,_0x37f0ac){_0x3e3cdd=_0x3e3cdd-0x0;var _0x5206ac=_0x0ca8[_0x3e3cdd];return _0x5206ac;};'use strict';function SalesforceAccount(_0x3621b6){this['id']=_0x3621b6['id']||0x0;this[_0x80ca('0x0')]=_0x3621b6['name']||'';this[_0x80ca('0x1')]=_0x3621b6[_0x80ca('0x1')]||'';this['remoteUri']=_0x3621b6[_0x80ca('0x2')]||'';this[_0x80ca('0x3')]=_0x3621b6[_0x80ca('0x3')]||'';this[_0x80ca('0x4')]=_0x3621b6[_0x80ca('0x4')]||'';this[_0x80ca('0x5')]=_0x3621b6[_0x80ca('0x5')]||'';this['securityToken']=_0x3621b6[_0x80ca('0x6')]||'';this['type']=_0x3621b6[_0x80ca('0x7')]||'integrationTab';this['serverUrl']=_0x3621b6[_0x80ca('0x8')]||'';this[_0x80ca('0x9')]=_0x3621b6['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 6c1e7bd..418c61a 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 _0x311d=['exports','name','username','remoteUri','serverUrl','Configurations'];(function(_0x482611,_0x33356d){var _0x4aeb3a=function(_0x44feae){while(--_0x44feae){_0x482611['push'](_0x482611['shift']());}};_0x4aeb3a(++_0x33356d);}(_0x311d,0xf1));var _0xd311=function(_0xad469a,_0x3d9fe6){_0xad469a=_0xad469a-0x0;var _0x207ec0=_0x311d[_0xad469a];return _0x207ec0;};'use strict';function ServicenowAccount(_0x521ef8){this['id']=_0x521ef8['id']||0x0;this[_0xd311('0x0')]=_0x521ef8['name']||'';this[_0xd311('0x1')]=_0x521ef8[_0xd311('0x1')]||'';this['password']=_0x521ef8['password']||'';this[_0xd311('0x2')]=_0x521ef8[_0xd311('0x2')]||'';this[_0xd311('0x3')]=_0x521ef8[_0xd311('0x3')]||'';this['Configurations']=_0x521ef8[_0xd311('0x4')]||{};}module[_0xd311('0x5')]=ServicenowAccount; \ No newline at end of file +var _0xe4b1=['username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x2f8125,_0x260435){var _0x332dfb=function(_0x12a258){while(--_0x12a258){_0x2f8125['push'](_0x2f8125['shift']());}};_0x332dfb(++_0x260435);}(_0xe4b1,0x186));var _0x1e4b=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0xe4b1[_0x247fa1];return _0x244f35;};'use strict';function ServicenowAccount(_0x10d2a0){this['id']=_0x10d2a0['id']||0x0;this['name']=_0x10d2a0['name']||'';this[_0x1e4b('0x0')]=_0x10d2a0['username']||'';this[_0x1e4b('0x1')]=_0x10d2a0[_0x1e4b('0x1')]||'';this[_0x1e4b('0x2')]=_0x10d2a0[_0x1e4b('0x2')]||'';this[_0x1e4b('0x3')]=_0x10d2a0[_0x1e4b('0x3')]||'';this[_0x1e4b('0x4')]=_0x10d2a0[_0x1e4b('0x4')]||{};}module[_0x1e4b('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 f4d2753..6895776 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 _0xa4b7=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0xbf25a4,_0x1cf487){var _0x4ed96c=function(_0x166dc0){while(--_0x166dc0){_0xbf25a4['push'](_0xbf25a4['shift']());}};_0x4ed96c(++_0x1cf487);}(_0xa4b7,0x1d9));var _0x7a4b=function(_0x36893e,_0xc62be6){_0x36893e=_0x36893e-0x0;var _0x14c709=_0xa4b7[_0x36893e];return _0x14c709;};'use strict';function SugarcrmAccount(_0x149531){this['id']=_0x149531['id']||0x0;this[_0x7a4b('0x0')]=_0x149531[_0x7a4b('0x0')]||'';this[_0x7a4b('0x1')]=_0x149531[_0x7a4b('0x1')]||'';this[_0x7a4b('0x2')]=_0x149531[_0x7a4b('0x2')]||'';this[_0x7a4b('0x3')]=_0x149531['remoteUri']||'';this[_0x7a4b('0x4')]=_0x149531[_0x7a4b('0x4')]||'';this[_0x7a4b('0x5')]=_0x149531[_0x7a4b('0x5')]||{};}module[_0x7a4b('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x4e92=['remoteUri','serverUrl','exports','name','username','password'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x4e92,0xed));var _0x24e9=function(_0x4dae00,_0x15b194){_0x4dae00=_0x4dae00-0x0;var _0x16bf42=_0x4e92[_0x4dae00];return _0x16bf42;};'use strict';function SugarcrmAccount(_0x13dfdc){this['id']=_0x13dfdc['id']||0x0;this[_0x24e9('0x0')]=_0x13dfdc['name']||'';this['username']=_0x13dfdc[_0x24e9('0x1')]||'';this[_0x24e9('0x2')]=_0x13dfdc[_0x24e9('0x2')]||'';this[_0x24e9('0x3')]=_0x13dfdc['remoteUri']||'';this[_0x24e9('0x4')]=_0x13dfdc[_0x24e9('0x4')]||'';this['Configurations']=_0x13dfdc['Configurations']||{};}module[_0x24e9('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index d768692..0c9387f 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 _0xe1bf=['state','unknown','status','address','exports','name','accountcode'];(function(_0x1077f0,_0x11dde9){var _0x25670d=function(_0xf56673){while(--_0xf56673){_0x1077f0['push'](_0x1077f0['shift']());}};_0x25670d(++_0x11dde9);}(_0xe1bf,0x67));var _0xfe1b=function(_0x6dd18e,_0x2bc455){_0x6dd18e=_0x6dd18e-0x0;var _0x3a6c08=_0xe1bf[_0x6dd18e];return _0x3a6c08;};'use strict';function Telephone(_0x29dd29){this['id']=_0x29dd29['id']||0x0;this[_0xfe1b('0x0')]=_0x29dd29['name']||'';this[_0xfe1b('0x1')]=_0x29dd29[_0xfe1b('0x1')]||'';this[_0xfe1b('0x2')]=_0xfe1b('0x3');this['stateTime']=0x0;this[_0xfe1b('0x4')]=_0xfe1b('0x3');this[_0xfe1b('0x5')]='';}module[_0xfe1b('0x6')]=Telephone; \ No newline at end of file +var _0x7a69=['address','exports','name','accountcode','state','unknown','status'];(function(_0x1f2f8c,_0x1f3556){var _0x4bc226=function(_0x3a0244){while(--_0x3a0244){_0x1f2f8c['push'](_0x1f2f8c['shift']());}};_0x4bc226(++_0x1f3556);}(_0x7a69,0x1c9));var _0x97a6=function(_0x5a6b0a,_0x123fc7){_0x5a6b0a=_0x5a6b0a-0x0;var _0x123196=_0x7a69[_0x5a6b0a];return _0x123196;};'use strict';function Telephone(_0x17629c){this['id']=_0x17629c['id']||0x0;this['name']=_0x17629c[_0x97a6('0x0')]||'';this[_0x97a6('0x1')]=_0x17629c['accountcode']||'';this[_0x97a6('0x2')]=_0x97a6('0x3');this['stateTime']=0x0;this[_0x97a6('0x4')]=_0x97a6('0x3');this[_0x97a6('0x5')]='';}module[_0x97a6('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 855c43b..92ef888 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x14eb4e,_0xf8be27){var _0x318847=function(_0x11798f){while(--_0x11798f){_0x14eb4e['push'](_0x14eb4e['shift']());}};_0x318847(++_0xf8be27);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0xa4be11,_0x49b1d8){var _0x3a31c9=function(_0x29ec3b){while(--_0x29ec3b){_0xa4be11['push'](_0xa4be11['shift']());}};_0x3a31c9(++_0x49b1d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index a09600f..0a6287e 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 _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x5100bc,_0x35e471){var _0x1d6ec6=function(_0x24795f){while(--_0x24795f){_0x5100bc['push'](_0x5100bc['shift']());}};_0x1d6ec6(++_0x35e471);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xb7e7[_0x3e5086];return _0xfeb102;};'use strict';function Trigger(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['channel']=_0x2e5e07[_0x7b7e('0x1')]||'voice';this[_0x7b7e('0x2')]=_0x2e5e07['status']||![];this[_0x7b7e('0x3')]=_0x2e5e07[_0x7b7e('0x3')]||[];this[_0x7b7e('0x4')]=_0x2e5e07['AnyConditions']||[];this['Actions']=_0x2e5e07[_0x7b7e('0x5')]||[];}module[_0x7b7e('0x6')]=Trigger; \ No newline at end of file +var _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0xc9fe31,_0x491b89){var _0x465463=function(_0x1e3a74){while(--_0x1e3a74){_0xc9fe31['push'](_0xc9fe31['shift']());}};_0x465463(++_0x491b89);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x452393,_0x31c5bc){_0x452393=_0x452393-0x0;var _0xaceec6=_0x9ffd[_0x452393];return _0xaceec6;};'use strict';function Trigger(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['channel']=_0x4c26a1[_0xd9ff('0x1')]||_0xd9ff('0x2');this[_0xd9ff('0x3')]=_0x4c26a1[_0xd9ff('0x3')]||![];this['AllConditions']=_0x4c26a1[_0xd9ff('0x4')]||[];this[_0xd9ff('0x5')]=_0x4c26a1['AnyConditions']||[];this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||[];}module[_0xd9ff('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 9e2cfa9..31c2c3c 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 _0x02bf=['port','domain','domainport','refresh','stateRegistry','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split'];(function(_0x56f2c0,_0x313bb6){var _0x15621c=function(_0x18fc1e){while(--_0x18fc1e){_0x56f2c0['push'](_0x56f2c0['shift']());}};_0x15621c(++_0x313bb6);}(_0x02bf,0xa7));var _0xf02b=function(_0x593752,_0xfc3827){_0x593752=_0x593752-0x0;var _0x4612be=_0x02bf[_0x593752];return _0x4612be;};'use strict';function Trunk(_0x291604){this['id']=_0x291604['id']||0x0;this[_0xf02b('0x0')]=_0x291604[_0xf02b('0x0')]||![];this[_0xf02b('0x1')]=_0x291604[_0xf02b('0x1')]||'';this[_0xf02b('0x2')]=_0xf02b('0x3');this[_0xf02b('0x4')]=0x0;this[_0xf02b('0x5')]=_0xf02b('0x3');this[_0xf02b('0x6')]=_0x291604[_0xf02b('0x6')]&&_0x291604[_0xf02b('0x6')][_0xf02b('0x7')](':')?_0x291604[_0xf02b('0x6')][_0xf02b('0x8')](':')[0x0]:'';this['host']='';this[_0xf02b('0x9')]='';this[_0xf02b('0xa')]='';this[_0xf02b('0xb')]='';this[_0xf02b('0xc')]='';this[_0xf02b('0xd')]=_0xf02b('0x3');this['registrationtime']='';this['address']='';this['defaultuser']=_0x291604[_0xf02b('0xe')]||'';}module[_0xf02b('0xf')]=Trunk; \ No newline at end of file +var _0x43ba=['domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','stateTime','status','unknown','registry','indexOf','split','host','port'];(function(_0x5a3bbb,_0x1e8fb2){var _0x53e201=function(_0x2997ed){while(--_0x2997ed){_0x5a3bbb['push'](_0x5a3bbb['shift']());}};_0x53e201(++_0x1e8fb2);}(_0x43ba,0xa0));var _0xa43b=function(_0x42e639,_0x26b020){_0x42e639=_0x42e639-0x0;var _0x4caf1d=_0x43ba[_0x42e639];return _0x4caf1d;};'use strict';function Trunk(_0xaa2a3a){this['id']=_0xaa2a3a['id']||0x0;this[_0xa43b('0x0')]=_0xaa2a3a[_0xa43b('0x0')]||![];this[_0xa43b('0x1')]=_0xaa2a3a[_0xa43b('0x1')]||'';this[_0xa43b('0x2')]='unknown';this[_0xa43b('0x3')]=0x0;this[_0xa43b('0x4')]=_0xa43b('0x5');this[_0xa43b('0x6')]=_0xaa2a3a[_0xa43b('0x6')]&&_0xaa2a3a['registry'][_0xa43b('0x7')](':')?_0xaa2a3a[_0xa43b('0x6')][_0xa43b('0x8')](':')[0x0]:'';this[_0xa43b('0x9')]='';this[_0xa43b('0xa')]='';this[_0xa43b('0xb')]='';this[_0xa43b('0xc')]='';this[_0xa43b('0xd')]='';this[_0xa43b('0xe')]=_0xa43b('0x5');this[_0xa43b('0xf')]='';this[_0xa43b('0x10')]='';this[_0xa43b('0x11')]=_0xaa2a3a[_0xa43b('0x11')]||'';}module[_0xa43b('0x12')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 989d36a..e221379 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 _0x4cf0=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4cf0,0x1ca));var _0x04cf=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4cf0[_0x167cc1];return _0x10bc4b;};'use strict';function voiceExtension(_0x21b9c8){this['id']=_0x21b9c8['id']||0x0;this[_0x04cf('0x0')]=_0x21b9c8[_0x04cf('0x0')]||'';this[_0x04cf('0x1')]=_0x21b9c8[_0x04cf('0x1')]||_0x04cf('0x2');this[_0x04cf('0x3')]=_0x21b9c8['mandatoryDisposition']||![];}module[_0x04cf('0x4')]=voiceExtension; \ No newline at end of file +var _0xa107=['recordingFormat','none','mandatoryDisposition'];(function(_0x5ef634,_0x3ab4d9){var _0x36fa2e=function(_0x14841b){while(--_0x14841b){_0x5ef634['push'](_0x5ef634['shift']());}};_0x36fa2e(++_0x3ab4d9);}(_0xa107,0x111));var _0x7a10=function(_0x17ba4d,_0x1f7035){_0x17ba4d=_0x17ba4d-0x0;var _0x5c787e=_0xa107[_0x17ba4d];return _0x5c787e;};'use strict';function voiceExtension(_0x43a759){this['id']=_0x43a759['id']||0x0;this['exten']=_0x43a759['exten']||'';this[_0x7a10('0x0')]=_0x43a759[_0x7a10('0x0')]||_0x7a10('0x1');this[_0x7a10('0x2')]=_0x43a759[_0x7a10('0x2')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 6b40980..0318bc5 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 _0x9223=['gsm','rrmemory','name','monitor_format','type','waiting','talking','answered','sumDuration','sumBillable','unmanaged','abandoned','available','acw','acwTimeout','autopause','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','invalid','unavailable','ringing','wav','wav49'];(function(_0x1d70db,_0x142b63){var _0x3060c6=function(_0x347866){while(--_0x347866){_0x1d70db['push'](_0x1d70db['shift']());}};_0x3060c6(++_0x142b63);}(_0x9223,0xdf));var _0x3922=function(_0x179e11,_0xf65436){_0x179e11=_0x179e11-0x0;var _0x549f04=_0x9223[_0x179e11];return _0x549f04;};'use strict';var statusDesc=[_0x3922('0x0'),_0x3922('0x1'),'inuse','busy',_0x3922('0x2'),_0x3922('0x3'),_0x3922('0x4'),'ringinuse','onhold'];var monitorFormat={'wav':_0x3922('0x5'),'wav49':_0x3922('0x6'),'gsm':_0x3922('0x7')};var strategy={'rrmemory':_0x3922('0x8'),'roundrobin':'roundrobin'};function VoiceQueue(_0x2ac7d9){this['id']=_0x2ac7d9['id']||0x0;this['name']=_0x2ac7d9[_0x3922('0x9')]||'';this['monitor_format']=_0x2ac7d9[_0x3922('0xa')]||'';this[_0x3922('0xb')]=_0x2ac7d9[_0x3922('0xb')]||'inbound';this[_0x3922('0xc')]=0x0;this[_0x3922('0xd')]=0x0;this['total']=0x0;this[_0x3922('0xe')]=0x0;this[_0x3922('0xf')]=0x0;this['sumHoldTime']=0x0;this[_0x3922('0x10')]=0x0;this[_0x3922('0x11')]=0x0;this[_0x3922('0x12')]=0x0;this['loggedIn']=0x0;this[_0x3922('0x13')]=0x0;this[_0x3922('0x14')]=_0x2ac7d9['acw']||![];this[_0x3922('0x15')]=_0x2ac7d9[_0x3922('0x15')]||0xa;this[_0x3922('0x16')]=_0x2ac7d9[_0x3922('0x16')]||'no';this['sendMessageOneNotActive']=!![];this[_0x3922('0x17')]='';this[_0x3922('0x18')]=0x0;this['temp']=0x0;this[_0x3922('0x19')]=_0x2ac7d9[_0x3922('0x19')]||null;this['dialGlobalInterval']=_0x2ac7d9[_0x3922('0x1a')]?_0x2ac7d9[_0x3922('0x1a')]:null;this[_0x3922('0x1b')]=_0x2ac7d9['dialActive'];this[_0x3922('0x1c')]=_0x2ac7d9[_0x3922('0x1c')]||_0x3922('0x1d');this['dialLimitChannel']=_0x2ac7d9[_0x3922('0x1e')]||0x0;this['dialLimitQueue']=_0x2ac7d9[_0x3922('0x1f')]||0x0;this[_0x3922('0x20')]=_0x2ac7d9[_0x3922('0x20')]||0x1;this[_0x3922('0x21')]=_0x2ac7d9['dialPredictiveOptimization']||'dropRate';this[_0x3922('0x22')]=_0x2ac7d9[_0x3922('0x22')]||0.03;this[_0x3922('0x23')]=_0x2ac7d9['dialPredictiveInterval']||0x258;this[_0x3922('0x24')]=_0x2ac7d9[_0x3922('0x24')]||_0x3922('0x25');this[_0x3922('0x26')]=_0x2ac7d9[_0x3922('0x26')]||_0x3922('0x25');this[_0x3922('0x27')]=_0x2ac7d9[_0x3922('0x27')]||0x1e;this[_0x3922('0x28')]=_0x2ac7d9[_0x3922('0x28')]||_0x3922('0x29');this[_0x3922('0x2a')]=_0x2ac7d9[_0x3922('0x2a')]||0x3;this[_0x3922('0x2b')]=_0x2ac7d9[_0x3922('0x2b')]||undefined;this[_0x3922('0x2c')]=_0x2ac7d9[_0x3922('0x2c')]||0x3;this['dialCongestionRetryFrequency']=_0x2ac7d9[_0x3922('0x2d')]||0x96;this['dialBusyMaxRetry']=_0x2ac7d9[_0x3922('0x2e')]||0x3;this[_0x3922('0x2f')]=_0x2ac7d9[_0x3922('0x2f')]||0x96;this[_0x3922('0x30')]=_0x2ac7d9[_0x3922('0x30')]||0x3;this[_0x3922('0x31')]=_0x2ac7d9['dialNoAnswerRetryFrequency']||0x96;this[_0x3922('0x32')]=_0x2ac7d9[_0x3922('0x32')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x2ac7d9[_0x3922('0x33')]||0x96;this[_0x3922('0x34')]=_0x2ac7d9[_0x3922('0x34')]||0x3;this[_0x3922('0x35')]=_0x2ac7d9[_0x3922('0x35')]||0x96;this[_0x3922('0x36')]=_0x2ac7d9[_0x3922('0x36')]||0x3;this[_0x3922('0x37')]=_0x2ac7d9[_0x3922('0x37')]||0x96;this['dialMachineMaxRetry']=_0x2ac7d9[_0x3922('0x38')]||0x3;this[_0x3922('0x39')]=_0x2ac7d9[_0x3922('0x39')]||0x96;this[_0x3922('0x3a')]=_0x2ac7d9[_0x3922('0x3a')]||0x3;this[_0x3922('0x3b')]=_0x2ac7d9[_0x3922('0x3b')]||0x96;this[_0x3922('0x3c')]=_0x2ac7d9[_0x3922('0x3c')]||0x4;this[_0x3922('0x3d')]=_0x2ac7d9[_0x3922('0x3d')]?_0x2ac7d9['Trunk']:undefined;this['TrunkBackup']=_0x2ac7d9[_0x3922('0x3e')]?_0x2ac7d9[_0x3922('0x3e')]:undefined;this[_0x3922('0x3f')]=_0x2ac7d9['dialPrefix']||undefined;this[_0x3922('0x40')]=_0x2ac7d9[_0x3922('0x40')]?_0x2ac7d9[_0x3922('0x40')]:undefined;this[_0x3922('0x41')]=_0x2ac7d9[_0x3922('0x41')]||_0x3922('0x42');this[_0x3922('0x43')]=_0x2ac7d9['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x3922('0x44')]=_0x2ac7d9['dialCutDigit']||undefined;this[_0x3922('0x45')]=strategy[_0x2ac7d9['strategy']]||_0x3922('0x8');this[_0x3922('0x46')]=!![];this[_0x3922('0x47')]=_0x2ac7d9[_0x3922('0x47')]||![];this['dialAMDInitialSilence']=_0x2ac7d9[_0x3922('0x48')];this[_0x3922('0x49')]=_0x2ac7d9[_0x3922('0x49')];this[_0x3922('0x4a')]=_0x2ac7d9[_0x3922('0x4a')];this['dialAMDTotalAnalysisTime']=_0x2ac7d9[_0x3922('0x4b')];this[_0x3922('0x4c')]=_0x2ac7d9[_0x3922('0x4c')];this['dialAMDBetweenWordsSilence']=_0x2ac7d9[_0x3922('0x4d')];this[_0x3922('0x4e')]=_0x2ac7d9['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x2ac7d9[_0x3922('0x4f')];this[_0x3922('0x50')]=_0x2ac7d9[_0x3922('0x50')];this[_0x3922('0x51')]=0x0;this['pTalking']=0x0;this[_0x3922('0x52')]=_0x2ac7d9[_0x3922('0x52')];this[_0x3922('0x53')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x3922('0x54')]=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x3922('0x55')]=0x0;this[_0x3922('0x56')]=0x0;this[_0x3922('0x57')]=0x0;this[_0x3922('0x58')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x3922('0x59')]=0x0;this[_0x3922('0x5a')]=0x0;this[_0x3922('0x5b')]=undefined;this[_0x3922('0x5c')]=undefined;this[_0x3922('0x5d')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x3922('0x5e')]=0x0;this[_0x3922('0x5f')]=0x0;this[_0x3922('0x60')]=0x0;this[_0x3922('0x61')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x3922('0x62')]=0x0;this[_0x3922('0x63')]=0x0;this[_0x3922('0x64')]=_0x2ac7d9[_0x3922('0x65')]||0x14;this[_0x3922('0x66')]=_0x2ac7d9[_0x3922('0x65')]||0xa;this[_0x3922('0x67')]=0x0;this[_0x3922('0x68')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x3922('0x69')]=0x0;this[_0x3922('0x6a')]=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0x3922('0x6b')]=_0x2ac7d9['dialRecallMeTimeout']||0x1e;this[_0x3922('0x6c')]=_0x2ac7d9[_0x3922('0x6c')]||![];this[_0x3922('0x6d')]=!!_0x2ac7d9[_0x3922('0x6d')]||![];this['dialQueueProject2']=_0x2ac7d9['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x2ac7d9[_0x3922('0x6e')]||![];this[_0x3922('0x6f')]=_0x2ac7d9[_0x3922('0x6f')]||![];this[_0x3922('0xa')]=monitorFormat[_0x2ac7d9[_0x3922('0xa')]]?monitorFormat[_0x2ac7d9[_0x3922('0xa')]]:undefined;this['mandatoryDisposition']=_0x2ac7d9[_0x3922('0x70')]||![];this['mandatoryDispositionPause']=_0x2ac7d9[_0x3922('0x71')]?_0x2ac7d9[_0x3922('0x71')]:undefined;}module[_0x3922('0x72')]=VoiceQueue; \ No newline at end of file +var _0x2320=['outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','name','monitor_format','type','inbound','waiting','sumHoldTime','sumBillable','unmanaged','abandoned','acw','acwTimeout','message','originated','dialTimezone','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay'];(function(_0x5f3de3,_0x40f0f5){var _0x287e0d=function(_0x3189dc){while(--_0x3189dc){_0x5f3de3['push'](_0x5f3de3['shift']());}};_0x287e0d(++_0x40f0f5);}(_0x2320,0x189));var _0x0232=function(_0x5937fd,_0x4deb81){_0x5937fd=_0x5937fd-0x0;var _0x3d1a93=_0x2320[_0x5937fd];return _0x3d1a93;};'use strict';var statusDesc=[_0x0232('0x0'),_0x0232('0x1'),_0x0232('0x2'),'busy',_0x0232('0x3'),_0x0232('0x4'),_0x0232('0x5'),_0x0232('0x6'),_0x0232('0x7')];var monitorFormat={'wav':_0x0232('0x8'),'wav49':_0x0232('0x9'),'gsm':_0x0232('0xa')};var strategy={'rrmemory':_0x0232('0xb'),'roundrobin':'roundrobin'};function VoiceQueue(_0x6cb436){this['id']=_0x6cb436['id']||0x0;this[_0x0232('0xc')]=_0x6cb436['name']||'';this[_0x0232('0xd')]=_0x6cb436[_0x0232('0xd')]||'';this[_0x0232('0xe')]=_0x6cb436[_0x0232('0xe')]||_0x0232('0xf');this[_0x0232('0x10')]=0x0;this['talking']=0x0;this['total']=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0x0232('0x11')]=0x0;this[_0x0232('0x12')]=0x0;this[_0x0232('0x13')]=0x0;this[_0x0232('0x14')]=0x0;this['loggedIn']=0x0;this['available']=0x0;this[_0x0232('0x15')]=_0x6cb436[_0x0232('0x15')]||![];this[_0x0232('0x16')]=_0x6cb436[_0x0232('0x16')]||0xa;this['autopause']=_0x6cb436['autopause']||'no';this['sendMessageOneNotActive']=!![];this[_0x0232('0x17')]='';this[_0x0232('0x18')]=0x0;this['temp']=0x0;this[_0x0232('0x19')]=_0x6cb436[_0x0232('0x19')]||null;this['dialGlobalInterval']=_0x6cb436['dialGlobalInterval']?_0x6cb436['dialGlobalInterval']:null;this['dialActive']=_0x6cb436['dialActive'];this[_0x0232('0x1a')]=_0x6cb436['dialMethod']||_0x0232('0x1b');this[_0x0232('0x1c')]=_0x6cb436['dialLimitChannel']||0x0;this[_0x0232('0x1d')]=_0x6cb436['dialLimitQueue']||0x0;this[_0x0232('0x1e')]=_0x6cb436[_0x0232('0x1e')]||0x1;this['dialPredictiveOptimization']=_0x6cb436['dialPredictiveOptimization']||_0x0232('0x1f');this[_0x0232('0x20')]=_0x6cb436[_0x0232('0x20')]||0.03;this[_0x0232('0x21')]=_0x6cb436[_0x0232('0x21')]||0x258;this[_0x0232('0x22')]=_0x6cb436[_0x0232('0x22')]||'anonymous';this[_0x0232('0x23')]=_0x6cb436[_0x0232('0x23')]||_0x0232('0x24');this[_0x0232('0x25')]=_0x6cb436[_0x0232('0x25')]||0x1e;this[_0x0232('0x26')]=_0x6cb436['dialQueueOptions']||_0x0232('0x27');this['dialQueueTimeout']=_0x6cb436['dialQueueTimeout']||0x3;this[_0x0232('0x28')]=_0x6cb436[_0x0232('0x28')]||undefined;this[_0x0232('0x29')]=_0x6cb436['dialCongestionMaxRetry']||0x3;this[_0x0232('0x2a')]=_0x6cb436[_0x0232('0x2a')]||0x96;this[_0x0232('0x2b')]=_0x6cb436['dialBusyMaxRetry']||0x3;this[_0x0232('0x2c')]=_0x6cb436[_0x0232('0x2c')]||0x96;this[_0x0232('0x2d')]=_0x6cb436[_0x0232('0x2d')]||0x3;this['dialNoAnswerRetryFrequency']=_0x6cb436['dialNoAnswerRetryFrequency']||0x96;this[_0x0232('0x2e')]=_0x6cb436[_0x0232('0x2e')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x6cb436[_0x0232('0x2f')]||0x96;this[_0x0232('0x30')]=_0x6cb436[_0x0232('0x30')]||0x3;this[_0x0232('0x31')]=_0x6cb436[_0x0232('0x31')]||0x96;this[_0x0232('0x32')]=_0x6cb436[_0x0232('0x32')]||0x3;this[_0x0232('0x33')]=_0x6cb436[_0x0232('0x33')]||0x96;this[_0x0232('0x34')]=_0x6cb436[_0x0232('0x34')]||0x3;this[_0x0232('0x35')]=_0x6cb436[_0x0232('0x35')]||0x96;this[_0x0232('0x36')]=_0x6cb436[_0x0232('0x36')]||0x3;this['dialAgentRejectRetryFrequency']=_0x6cb436['dialAgentRejectRetryFrequency']||0x96;this[_0x0232('0x37')]=_0x6cb436[_0x0232('0x37')]||0x4;this[_0x0232('0x38')]=_0x6cb436['Trunk']?_0x6cb436[_0x0232('0x38')]:undefined;this[_0x0232('0x39')]=_0x6cb436[_0x0232('0x39')]?_0x6cb436[_0x0232('0x39')]:undefined;this[_0x0232('0x3a')]=_0x6cb436[_0x0232('0x3a')]||undefined;this['Interval']=_0x6cb436[_0x0232('0x3b')]?_0x6cb436[_0x0232('0x3b')]:undefined;this[_0x0232('0x3c')]=_0x6cb436[_0x0232('0x3c')]||_0x0232('0x3d');this[_0x0232('0x3e')]=_0x6cb436[_0x0232('0x3e')]||undefined;this[_0x0232('0x3f')]=_0x6cb436[_0x0232('0x3f')]||undefined;this['strategy']=strategy[_0x6cb436['strategy']]||_0x0232('0xb');this[_0x0232('0x40')]=!![];this[_0x0232('0x41')]=_0x6cb436['dialAMDActive']||![];this[_0x0232('0x42')]=_0x6cb436[_0x0232('0x42')];this['dialAMDGreeting']=_0x6cb436[_0x0232('0x43')];this[_0x0232('0x44')]=_0x6cb436[_0x0232('0x44')];this['dialAMDTotalAnalysisTime']=_0x6cb436[_0x0232('0x45')];this[_0x0232('0x46')]=_0x6cb436[_0x0232('0x46')];this['dialAMDBetweenWordsSilence']=_0x6cb436[_0x0232('0x47')];this[_0x0232('0x48')]=_0x6cb436['dialAMDMaximumNumberOfWords'];this[_0x0232('0x49')]=_0x6cb436[_0x0232('0x49')];this[_0x0232('0x4a')]=_0x6cb436[_0x0232('0x4a')];this['outboundRejectCallsDay']=0x0;this[_0x0232('0x4b')]=0x0;this['timeout']=_0x6cb436['timeout'];this[_0x0232('0x4c')]=0x0;this[_0x0232('0x4d')]=0x0;this[_0x0232('0x4e')]=0x0;this[_0x0232('0x4f')]=0x0;this[_0x0232('0x50')]=0x0;this[_0x0232('0x51')]=0x0;this[_0x0232('0x52')]=0x0;this[_0x0232('0x53')]=0x0;this[_0x0232('0x54')]=0x0;this[_0x0232('0x55')]=0x0;this[_0x0232('0x56')]=0x0;this[_0x0232('0x57')]=0x0;this['outboundReCallsDay']=0x0;this[_0x0232('0x58')]=0x0;this['startProgressive']=undefined;this[_0x0232('0x59')]=undefined;this[_0x0232('0x5a')]=undefined;this[_0x0232('0x5b')]=1.05;this[_0x0232('0x5c')]=0x0;this[_0x0232('0x5d')]=0x0;this[_0x0232('0x5e')]=0x0;this[_0x0232('0x5f')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x0232('0x60')]=0x0;this[_0x0232('0x61')]=0x0;this[_0x0232('0x62')]=0x0;this[_0x0232('0x63')]=_0x6cb436[_0x0232('0x64')]||0x14;this[_0x0232('0x65')]=_0x6cb436['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x0232('0x66')]=0x0;this[_0x0232('0x67')]=0x0;this[_0x0232('0x68')]=0x1;this[_0x0232('0x69')]=0x0;this[_0x0232('0x6a')]=0x0;this[_0x0232('0x6b')]=0x0;this[_0x0232('0x6c')]=0x0;this[_0x0232('0x6d')]=_0x6cb436[_0x0232('0x6d')]||0x1e;this[_0x0232('0x6e')]=_0x6cb436[_0x0232('0x6e')]||![];this[_0x0232('0x6f')]=!!_0x6cb436[_0x0232('0x6f')]||![];this[_0x0232('0x70')]=_0x6cb436[_0x0232('0x70')]||undefined;this[_0x0232('0x71')]=_0x6cb436[_0x0232('0x71')]||![];this[_0x0232('0x72')]=_0x6cb436[_0x0232('0x72')]||![];this['monitor_format']=monitorFormat[_0x6cb436[_0x0232('0xd')]]?monitorFormat[_0x6cb436[_0x0232('0xd')]]:undefined;this['mandatoryDisposition']=_0x6cb436[_0x0232('0x73')]||![];this[_0x0232('0x74')]=_0x6cb436[_0x0232('0x74')]?_0x6cb436['mandatoryDispositionPause']:undefined;}module[_0x0232('0x75')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 1c94d20..9c8d352 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 _0xbaa6=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3dff4e,_0x38010b){var _0x3ff68b=function(_0x1cd96e){while(--_0x1cd96e){_0x3dff4e['push'](_0x3dff4e['shift']());}};_0x3ff68b(++_0x38010b);}(_0xbaa6,0x155));var _0x6baa=function(_0x31fb16,_0x3a4f55){_0x31fb16=_0x31fb16-0x0;var _0x50f4b7=_0xbaa6[_0x31fb16];return _0x50f4b7;};'use strict';function VtigerAccount(_0x1e2ba7){this['id']=_0x1e2ba7['id']||0x0;this[_0x6baa('0x0')]=_0x1e2ba7[_0x6baa('0x0')]||'';this[_0x6baa('0x1')]=_0x1e2ba7[_0x6baa('0x1')]||'';this[_0x6baa('0x2')]=_0x1e2ba7[_0x6baa('0x2')]||'';this['remoteUri']=_0x1e2ba7[_0x6baa('0x3')]||'';this[_0x6baa('0x4')]=_0x1e2ba7[_0x6baa('0x4')]||'';this['Configurations']=_0x1e2ba7[_0x6baa('0x5')]||{};}module[_0x6baa('0x6')]=VtigerAccount; \ No newline at end of file +var _0xd6fe=['username','accessKey','remoteUri','serverUrl','Configurations','name'];(function(_0xc18ce1,_0x329f9b){var _0x12ea8b=function(_0x1cac01){while(--_0x1cac01){_0xc18ce1['push'](_0xc18ce1['shift']());}};_0x12ea8b(++_0x329f9b);}(_0xd6fe,0x143));var _0xed6f=function(_0x224b8d,_0x408cc1){_0x224b8d=_0x224b8d-0x0;var _0x10c7f1=_0xd6fe[_0x224b8d];return _0x10c7f1;};'use strict';function VtigerAccount(_0x1b2d97){this['id']=_0x1b2d97['id']||0x0;this[_0xed6f('0x0')]=_0x1b2d97['name']||'';this[_0xed6f('0x1')]=_0x1b2d97[_0xed6f('0x1')]||'';this[_0xed6f('0x2')]=_0x1b2d97['accessKey']||'';this[_0xed6f('0x3')]=_0x1b2d97['remoteUri']||'';this[_0xed6f('0x4')]=_0x1b2d97['serverUrl']||'';this[_0xed6f('0x5')]=_0x1b2d97[_0xed6f('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 17e2ec4..cb528e1 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 _0xc5b3=['type','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0x2b7ba3,_0x3eb26a){var _0x2d189f=function(_0x29678e){while(--_0x29678e){_0x2b7ba3['push'](_0x2b7ba3['shift']());}};_0x2d189f(++_0x3eb26a);}(_0xc5b3,0x1d0));var _0x3c5b=function(_0x277af0,_0x1f0361){_0x277af0=_0x277af0-0x0;var _0x43bd7c=_0xc5b3[_0x277af0];return _0x43bd7c;};'use strict';function ZendeskAccount(_0x2528ad){this['id']=_0x2528ad['id']||0x0;this[_0x3c5b('0x0')]=_0x2528ad[_0x3c5b('0x0')]||'';this[_0x3c5b('0x1')]=_0x2528ad[_0x3c5b('0x1')]||'';this[_0x3c5b('0x2')]=_0x2528ad['password']||'';this['token']=_0x2528ad[_0x3c5b('0x3')]||'';this[_0x3c5b('0x4')]=_0x2528ad[_0x3c5b('0x4')]||'';this[_0x3c5b('0x5')]=_0x2528ad[_0x3c5b('0x5')]||'';this['type']=_0x2528ad[_0x3c5b('0x6')]||'integrationTab';this[_0x3c5b('0x7')]=_0x2528ad[_0x3c5b('0x7')]||'';this[_0x3c5b('0x8')]=_0x2528ad[_0x3c5b('0x8')]||{};}module[_0x3c5b('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xb9ae=['Configurations','exports','name','username','password','token','remoteUri','authType','type','serverUrl'];(function(_0x390a0d,_0x1d2cd9){var _0x1c1e0a=function(_0x1b4505){while(--_0x1b4505){_0x390a0d['push'](_0x390a0d['shift']());}};_0x1c1e0a(++_0x1d2cd9);}(_0xb9ae,0x174));var _0xeb9a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xb9ae[_0x4a9fb1];return _0x348672;};'use strict';function ZendeskAccount(_0x15e4d0){this['id']=_0x15e4d0['id']||0x0;this[_0xeb9a('0x0')]=_0x15e4d0[_0xeb9a('0x0')]||'';this[_0xeb9a('0x1')]=_0x15e4d0['username']||'';this[_0xeb9a('0x2')]=_0x15e4d0['password']||'';this[_0xeb9a('0x3')]=_0x15e4d0[_0xeb9a('0x3')]||'';this[_0xeb9a('0x4')]=_0x15e4d0[_0xeb9a('0x4')]||'';this[_0xeb9a('0x5')]=_0x15e4d0[_0xeb9a('0x5')]||'';this['type']=_0x15e4d0[_0xeb9a('0x6')]||'integrationTab';this[_0xeb9a('0x7')]=_0x15e4d0[_0xeb9a('0x7')]||'';this['Configurations']=_0x15e4d0[_0xeb9a('0x8')]||{};}module[_0xeb9a('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 98b08c5..829d1bf 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 _0x8d73=['description','host','zone','clientId','clientSecret','serverUrl','refreshToken','Configurations','exports','name'];(function(_0x1621b3,_0x5f129f){var _0x2f5255=function(_0x39ec38){while(--_0x39ec38){_0x1621b3['push'](_0x1621b3['shift']());}};_0x2f5255(++_0x5f129f);}(_0x8d73,0x8b));var _0x38d7=function(_0x158f5a,_0xaacc25){_0x158f5a=_0x158f5a-0x0;var _0xb3722e=_0x8d73[_0x158f5a];return _0xb3722e;};'use strict';function ZohoAccount(_0x3f51e4){this['id']=_0x3f51e4['id']||0x0;this['name']=_0x3f51e4[_0x38d7('0x0')]||'';this[_0x38d7('0x1')]=_0x3f51e4[_0x38d7('0x1')]||'';this[_0x38d7('0x2')]=_0x3f51e4[_0x38d7('0x2')]||'';this[_0x38d7('0x3')]=_0x3f51e4[_0x38d7('0x3')]||'';this[_0x38d7('0x4')]=_0x3f51e4['clientId']||'';this[_0x38d7('0x5')]=_0x3f51e4[_0x38d7('0x5')]||'';this['serverUrl']=_0x3f51e4[_0x38d7('0x6')]||'';this['code']=_0x3f51e4['code']||'';this[_0x38d7('0x7')]=_0x3f51e4[_0x38d7('0x7')]||'';this['Configurations']=_0x3f51e4[_0x38d7('0x8')]||{};}module[_0x38d7('0x9')]=ZohoAccount; \ No newline at end of file +var _0x5b9d=['exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0xf88629,_0x170f07){var _0x4b6536=function(_0x51e7a0){while(--_0x51e7a0){_0xf88629['push'](_0xf88629['shift']());}};_0x4b6536(++_0x170f07);}(_0x5b9d,0x177));var _0xd5b9=function(_0x2d4647,_0x457cdf){_0x2d4647=_0x2d4647-0x0;var _0x244448=_0x5b9d[_0x2d4647];return _0x244448;};'use strict';function ZohoAccount(_0x4fcedb){this['id']=_0x4fcedb['id']||0x0;this[_0xd5b9('0x0')]=_0x4fcedb[_0xd5b9('0x0')]||'';this['description']=_0x4fcedb[_0xd5b9('0x1')]||'';this[_0xd5b9('0x2')]=_0x4fcedb[_0xd5b9('0x2')]||'';this[_0xd5b9('0x3')]=_0x4fcedb[_0xd5b9('0x3')]||'';this[_0xd5b9('0x4')]=_0x4fcedb['clientId']||'';this[_0xd5b9('0x5')]=_0x4fcedb[_0xd5b9('0x5')]||'';this[_0xd5b9('0x6')]=_0x4fcedb[_0xd5b9('0x6')]||'';this[_0xd5b9('0x7')]=_0x4fcedb[_0xd5b9('0x7')]||'';this['refreshToken']=_0x4fcedb[_0xd5b9('0x8')]||'';this[_0xd5b9('0x9')]=_0x4fcedb[_0xd5b9('0x9')]||{};}module[_0xd5b9('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 632b24c..dbedbe0 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 _0x1571=['campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','getCaller','number','exports','isNil','string','idContact','name','type'];(function(_0x91a1ed,_0x42451a){var _0x496b03=function(_0x58b033){while(--_0x58b033){_0x91a1ed['push'](_0x91a1ed['shift']());}};_0x496b03(++_0x42451a);}(_0x1571,0xeb));var _0x1157=function(_0x14f586,_0x5280e8){_0x14f586=_0x14f586-0x0;var _0x1d6d98=_0x1571[_0x14f586];return _0x1d6d98;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x31936a,_0x2ad0ea,_0x37ff60){var _0x6c094f='';if(!_[_0x1157('0x0')](_0x2ad0ea)&&_0x1157('0x1')===typeof _0x2ad0ea){_0x6c094f+=_0x2ad0ea;}if(!_[_0x1157('0x0')](_0x37ff60)&&_0x1157('0x1')===typeof _0x37ff60){_0x6c094f+='\x20'+_0x37ff60;}if(_0x6c094f!==''){return _0x6c094f;}return _0x31936a;}function Action(_0x631167,_0x14406c,_0x47c007,_0x495e97,_0x2a7ac0){this['uniqueid']=_0x47c007||undefined;this[_0x1157('0x2')]=_0x631167['id'];this['queue']=_0x14406c[_0x1157('0x3')];this[_0x1157('0x4')]=_0x14406c[_0x1157('0x4')];this[_0x1157('0x5')]='queue';this[_0x1157('0x6')]=![];this[_0x1157('0x7')]=_['isNil'](_0x631167[_0x1157('0x8')])?undefined:_0x631167[_0x1157('0x8')][_0x1157('0x3')];this[_0x1157('0x9')]=this[_0x1157('0x7')]?util[_0x1157('0xa')](_0x1157('0xb'),this['membername']):_0x495e97||undefined;this[_0x1157('0xc')]=checkNameSurname(_0x631167[_0x1157('0xd')][_0x1157('0xe')],_0x631167[_0x1157('0xd')]['firstName'],_0x631167['Contact'][_0x1157('0xf')]);this['active']=_0x631167[_0x1157('0x10')]||![];this[_0x1157('0x11')]=_0x631167['Contact'][_0x1157('0xe')];this[_0x1157('0x12')]=_0x631167[_0x1157('0x12')];this[_0x1157('0x13')]=_0x631167[_0x1157('0x13')]||0x0;this[_0x1157('0x14')]=_0x631167['countcongestionretry']||0x0;this[_0x1157('0x15')]=_0x631167[_0x1157('0x15')]||0x0;this[_0x1157('0x16')]=(_0x631167[_0x1157('0x13')]||0x0)+(_0x631167['countcongestionretry']||0x0)+(_0x631167['countnoanswerretry']||0x0)+(_0x631167[_0x1157('0x17')]||0x0)+(_0x631167[_0x1157('0x18')]||0x0)+(_0x631167[_0x1157('0x19')]||0x0)+(_0x631167[_0x1157('0x1a')]||0x0)+(_0x631167['countagentrejectretry']||0x0);this['countnosuchnumberretry']=_0x631167[_0x1157('0x17')]||0x0;this[_0x1157('0x18')]=_0x631167[_0x1157('0x18')]||0x0;this[_0x1157('0x19')]=_0x631167['countabandonedretry']||0x0;this[_0x1157('0x1a')]=_0x631167[_0x1157('0x1a')]||0x0;this[_0x1157('0x1b')]=_0x631167[_0x1157('0x1b')]||0x0;this[_0x1157('0x1c')]=_0x631167[_0x1157('0x1c')];this['callbackuniqueid']=_0x631167[_0x1157('0x1d')];this[_0x1157('0x1e')]=_0x631167[_0x1157('0x1e')];this[_0x1157('0x1f')]=_0x631167['recallme'];this[_0x1157('0x20')]=_0x631167[_0x1157('0x20')];this[_0x1157('0x21')]=_0x631167[_0x1157('0x21')];this[_0x1157('0x22')]=_[_0x1157('0x0')](_0x631167[_0x1157('0x8')])?_0x631167[_0x1157('0x22')]:_0x631167['Agent']['id'];this[_0x1157('0x23')]=_0x631167['VoiceQueueId'];this[_0x1157('0x24')]='';this['originatecalleridname']='';}Action['prototype'][_0x1157('0x25')]=function(){return util[_0x1157('0xa')]('\x22%s\x22\x20<%s>',this[_0x1157('0xc')],this[_0x1157('0x26')]);};module[_0x1157('0x27')]=Action; \ No newline at end of file +var _0xdf7d=['number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','Contact','firstName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackat','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>'];(function(_0x4d7ab0,_0x4fe64f){var _0x1e9c9a=function(_0x496177){while(--_0x496177){_0x4d7ab0['push'](_0x4d7ab0['shift']());}};_0x1e9c9a(++_0x4fe64f);}(_0xdf7d,0x152));var _0xddf7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdf7d[_0x2641f9];return _0x585741;};'use strict';var util=require(_0xddf7('0x0'));var _=require(_0xddf7('0x1'));var moment=require(_0xddf7('0x2'));function checkNameSurname(_0x5ee9be,_0x2e6f0e,_0x577b91){var _0x7373='';if(!_[_0xddf7('0x3')](_0x2e6f0e)&&_0xddf7('0x4')===typeof _0x2e6f0e){_0x7373+=_0x2e6f0e;}if(!_[_0xddf7('0x3')](_0x577b91)&&_0xddf7('0x4')===typeof _0x577b91){_0x7373+='\x20'+_0x577b91;}if(_0x7373!==''){return _0x7373;}return _0x5ee9be;}function Action(_0x1e4f2b,_0x3af661,_0x5a98bd,_0x4026b4,_0x3c4ea1){this[_0xddf7('0x5')]=_0x5a98bd||undefined;this[_0xddf7('0x6')]=_0x1e4f2b['id'];this[_0xddf7('0x7')]=_0x3af661[_0xddf7('0x8')];this['type']=_0x3af661[_0xddf7('0x9')];this[_0xddf7('0xa')]=_0xddf7('0x7');this[_0xddf7('0xb')]=![];this[_0xddf7('0xc')]=_[_0xddf7('0x3')](_0x1e4f2b[_0xddf7('0xd')])?undefined:_0x1e4f2b[_0xddf7('0xd')][_0xddf7('0x8')];this[_0xddf7('0xe')]=this[_0xddf7('0xc')]?util[_0xddf7('0xf')]('SIP/%s',this[_0xddf7('0xc')]):_0x4026b4||undefined;this['calleridname']=checkNameSurname(_0x1e4f2b[_0xddf7('0x10')]['phone'],_0x1e4f2b[_0xddf7('0x10')][_0xddf7('0x11')],_0x1e4f2b['Contact']['lastName']);this[_0xddf7('0x12')]=_0x1e4f2b[_0xddf7('0x12')]||![];this[_0xddf7('0x13')]=_0x1e4f2b[_0xddf7('0x10')][_0xddf7('0x14')];this['scheduledat']=_0x1e4f2b[_0xddf7('0x15')];this[_0xddf7('0x16')]=_0x1e4f2b['countbusyretry']||0x0;this[_0xddf7('0x17')]=_0x1e4f2b[_0xddf7('0x17')]||0x0;this['countnoanswerretry']=_0x1e4f2b['countnoanswerretry']||0x0;this[_0xddf7('0x18')]=(_0x1e4f2b[_0xddf7('0x16')]||0x0)+(_0x1e4f2b[_0xddf7('0x17')]||0x0)+(_0x1e4f2b[_0xddf7('0x19')]||0x0)+(_0x1e4f2b['countnosuchnumberretry']||0x0)+(_0x1e4f2b[_0xddf7('0x1a')]||0x0)+(_0x1e4f2b[_0xddf7('0x1b')]||0x0)+(_0x1e4f2b[_0xddf7('0x1c')]||0x0)+(_0x1e4f2b[_0xddf7('0x1d')]||0x0);this[_0xddf7('0x1e')]=_0x1e4f2b[_0xddf7('0x1e')]||0x0;this[_0xddf7('0x1a')]=_0x1e4f2b['countdropretry']||0x0;this[_0xddf7('0x1b')]=_0x1e4f2b[_0xddf7('0x1b')]||0x0;this['countmachineretry']=_0x1e4f2b['countmachineretry']||0x0;this[_0xddf7('0x1d')]=_0x1e4f2b[_0xddf7('0x1d')]||0x0;this[_0xddf7('0x1f')]=_0x1e4f2b[_0xddf7('0x1f')];this['callbackuniqueid']=_0x1e4f2b['callbackuniqueid'];this[_0xddf7('0x20')]=_0x1e4f2b['callbackat'];this['recallme']=_0x1e4f2b['recallme'];this[_0xddf7('0x21')]=_0x1e4f2b['ContactId'];this['ListId']=_0x1e4f2b[_0xddf7('0x22')];this['UserId']=_[_0xddf7('0x3')](_0x1e4f2b[_0xddf7('0xd')])?_0x1e4f2b['UserId']:_0x1e4f2b[_0xddf7('0xd')]['id'];this[_0xddf7('0x23')]=_0x1e4f2b[_0xddf7('0x23')];this[_0xddf7('0x24')]='';this[_0xddf7('0x25')]='';}Action['prototype'][_0xddf7('0x26')]=function(){return util[_0xddf7('0xf')](_0xddf7('0x27'),this['calleridname'],this[_0xddf7('0x28')]);};module[_0xddf7('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 7a03f9e..9a8a705 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 _0xa41a=['[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','uniqueid','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','clone','response','idContact','custom:agentringnoanswer','rejected','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','error','[syncVarSet][Preview]','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','../ami','./rpcDb','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','campaignsPreview','emit','type','outbound','name','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','waiting','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','message','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','Interval','stringify','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','loopCampaigns','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','dialActive','setMessage','clearZombieChannel','isNil','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','unlockAgent','activeContact','linkedid','responsetime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','total','answered','[16]','countglobal','Answer','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','Busy','busy','createCustomerHistory','dialBusyMaxRetry','scheduledAt','countbusyretry','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','custom:agentreject','agentreject','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','outboundUnknownCallsDay','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','dialstatus','[callProgressDetectingCustomer][machine]','[default]'];(function(_0x3ae9d3,_0x2ff057){var _0xef9a91=function(_0x867e1e){while(--_0x867e1e){_0x3ae9d3['push'](_0x3ae9d3['shift']());}};_0xef9a91(++_0x2ff057);}(_0xa41a,0x6b));var _0xaa41=function(_0x261d99,_0x4549b2){_0x261d99=_0x261d99-0x0;var _0x48c62d=_0xa41a[_0x261d99];return _0x48c62d;};'use strict';var util=require(_0xaa41('0x0'));var _=require(_0xaa41('0x1'));var BPromise=require('bluebird');var uuid=require(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var md5=require(_0xaa41('0x4'));var Redis=require(_0xaa41('0x5'));var config=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var loggerAction=require(_0xaa41('0x7'))('actionPreview');var ami=require(_0xaa41('0x9'));var rpcDb=require(_0xaa41('0xa'));var Action=require('./action');var ut=require('./util/util');config[_0xaa41('0xb')]=_[_0xaa41('0xc')](config['redis'],{'host':_0xaa41('0xd'),'port':0x18eb});var io=require(_0xaa41('0xe'))(new Redis(config[_0xaa41('0xb')]));var Sequence=function(){};Sequence[_0xaa41('0xf')][_0xaa41('0x10')]=function(_0x38d930){this[_0xaa41('0x11')]=this[_0xaa41('0x11')]?this[_0xaa41('0x11')]['finally'](_0x38d930):_0x38d930();};function Preview(_0x1d3aac){this[_0xaa41('0x12')]=new Sequence();this['campaignsPreview']=_0x1d3aac['voiceQueues'];this[_0xaa41('0x13')]=_0x1d3aac['trunks'];this[_0xaa41('0x14')]={};this[_0xaa41('0x15')]=_0x1d3aac[_0xaa41('0x15')];this[_0xaa41('0x16')]=0x0;ami['on'](_0xaa41('0x17'),this['syncOriginateResponse'][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x19'),this[_0xaa41('0x1a')][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x1b'),this[_0xaa41('0x1c')][_0xaa41('0x18')](this));ami['on']('dialend',this[_0xaa41('0x1d')][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x1e'),this[_0xaa41('0x1f')][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x20'),this[_0xaa41('0x21')][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x22'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xaa41('0x23'),this[_0xaa41('0x24')][_0xaa41('0x18')](this));this['loopCampaigns'](this[_0xaa41('0x25')]);}function emit(_0x1f692b,_0x4e768e,_0x513c61){io['to'](_0x1f692b)[_0xaa41('0x26')](_0x4e768e,_0x513c61);}function emitCampaignPreview(_0x5d4374){if(_0x5d4374[_0xaa41('0x27')]===_0xaa41('0x28')){var _0x3e2175={'id':_0x5d4374['id'],'name':_0x5d4374[_0xaa41('0x29')],'strategy':_0x5d4374[_0xaa41('0x2a')],'answered':_0x5d4374['answered'],'available':_0x5d4374[_0xaa41('0x2b')],'loggedIn':_0x5d4374[_0xaa41('0x2c')],'pTalking':_0x5d4374[_0xaa41('0x2d')],'sumBillable':_0x5d4374[_0xaa41('0x2e')],'sumDuration':_0x5d4374[_0xaa41('0x2f')],'sumHoldTime':_0x5d4374[_0xaa41('0x30')]||0x0,'talking':_0x5d4374['talking'],'total':_0x5d4374['total'],'type':_0x5d4374[_0xaa41('0x27')],'unmanaged':_0x5d4374['unmanaged'],'abandoned':_0x5d4374['abandoned'],'waiting':_0x5d4374[_0xaa41('0x31')],'loggedInDb':_0x5d4374['loggedInDb'],'dialActive':_0x5d4374['dialActive'],'dialMethod':_0x5d4374[_0xaa41('0x32')],'dialOriginateCallerIdName':_0x5d4374[_0xaa41('0x33')],'dialOriginateCallerIdNumber':_0x5d4374[_0xaa41('0x34')],'dialOriginateTimeout':_0x5d4374[_0xaa41('0x35')],'dialPrefix':_0x5d4374[_0xaa41('0x36')],'outboundAnswerAgiCallsDay':_0x5d4374[_0xaa41('0x37')],'outboundAnswerCallsDay':_0x5d4374['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x5d4374[_0xaa41('0x38')],'outboundBusyCallsDay':_0x5d4374[_0xaa41('0x39')],'outboundCongestionCallsDay':_0x5d4374[_0xaa41('0x3a')],'outboundDropCallsDayACS':_0x5d4374[_0xaa41('0x3b')],'outboundDropCallsDayCallersExit':_0x5d4374[_0xaa41('0x3c')],'outboundDropCallsDayTimeout':_0x5d4374[_0xaa41('0x3d')],'outboundNoAnswerCallsDay':_0x5d4374[_0xaa41('0x3e')],'outboundNoSuchCallsDay':_0x5d4374[_0xaa41('0x3f')],'outboundOriginateFailureCallsDay':_0x5d4374['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x5d4374[_0xaa41('0x40')],'outboundRejectCallsDay':_0x5d4374['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x5d4374['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x5d4374[_0xaa41('0x41')],'predictiveIntervalAnsweredCalls':_0x5d4374[_0xaa41('0x42')],'predictiveIntervalAvgHoldtime':_0x5d4374['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x5d4374[_0xaa41('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x5d4374[_0xaa41('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x5d4374['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x5d4374['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x5d4374['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x5d4374[_0xaa41('0x45')],'predictiveIntervalMultiplicativeFactor':_0x5d4374[_0xaa41('0x46')],'predictiveIntervalPauses':_0x5d4374[_0xaa41('0x47')],'predictiveIntervalAvailable':_0x5d4374[_0xaa41('0x48')],'predictiveIntervalTotalCalls':_0x5d4374['predictiveIntervalTotalCalls'],'message':_0x5d4374[_0xaa41('0x49')],'originated':_0x5d4374[_0xaa41('0x4a')],'erlangCalls':_0x5d4374[_0xaa41('0x4b')],'erlangCallToSecond':_0x5d4374['erlangCallToSecond'],'erlangAbandonmentRate':_0x5d4374[_0xaa41('0x4c')],'erlangBusyFactor':_0x5d4374[_0xaa41('0x4d')],'startPredictive':_0x5d4374[_0xaa41('0x4e')],'startProgressive':_0x5d4374['startProgressive']};if(_0x5d4374[_0xaa41('0x4f')]){_0x3e2175[_0xaa41('0x4f')]={'id':_0x5d4374['Trunk']['id'],'name':_0x5d4374[_0xaa41('0x4f')][_0xaa41('0x29')],'active':_0x5d4374[_0xaa41('0x4f')]['active'],'callerid':_0x5d4374[_0xaa41('0x4f')]['callerid']};}if(_0x5d4374[_0xaa41('0x50')]){_0x3e2175[_0xaa41('0x50')]={'id':_0x5d4374[_0xaa41('0x50')]['id'],'name':_0x5d4374['Interval']['name']};}var _0x4cdd42=md5(JSON[_0xaa41('0x51')](_0x3e2175));if(_0x5d4374[_0xaa41('0x4')]!==_0x4cdd42){_0x5d4374[_0xaa41('0x4')]=_0x4cdd42;emit(util[_0xaa41('0x52')]('voice:queue:%s',_0x3e2175['name']),_0xaa41('0x53'),_0x3e2175);}}}function emitVoiceQueueChannelRemove(_0x5673c){logger[_0xaa41('0x54')](_0xaa41('0x55'),JSON[_0xaa41('0x51')](_0x5673c));emit(util[_0xaa41('0x52')](_0xaa41('0x56'),_0x5673c['name']),_0xaa41('0x57'),_0x5673c);io[_0xaa41('0x26')](_0xaa41('0x58'),_0x5673c);}function notSendMessagesQueue(_0x27817f){if(_0x27817f['sendMessageOneNotActive']){if(_0x27817f['originated']===0x0&&_0x27817f[_0xaa41('0x2d')]===0x0){_0x27817f[_0xaa41('0x59')]=![];_0x27817f['available']=0x0;_0x27817f[_0xaa41('0x5a')]=0x0;_0x27817f['message']=_0xaa41('0x5b');ut[_0xaa41('0x5c')](_0xaa41('0x5d'),_0x27817f[_0xaa41('0x29')]+_0xaa41('0x5e'));}else{_0x27817f[_0xaa41('0x49')]=_0xaa41('0x5f');ut[_0xaa41('0x5c')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x27817f[_0xaa41('0x29')]+_0xaa41('0x60'));}emitCampaignPreview(_0x27817f);}}Preview[_0xaa41('0xf')][_0xaa41('0x61')]=function(){var _0xc84fb8=this;setInterval(function(){_0xc84fb8[_0xaa41('0x62')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x87e2f4=this['campaignsPreview'];this[_0xaa41('0x16')]+=0x1;for(var _0x215896 in _0x87e2f4){if(_0x87e2f4[_0xaa41('0x63')](_0x215896)&&(_0x87e2f4[_0x215896][_0xaa41('0x32')]===_0xaa41('0x8')||_0x87e2f4[_0x215896][_0xaa41('0x32')]===_0xaa41('0x64'))&&_0x87e2f4[_0x215896]['type']===_0xaa41('0x28')){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this[_0xaa41('0x65')]();}}if(_0x87e2f4['hasOwnProperty'](_0x215896)&&_0x87e2f4[_0x215896]['dialMethod']==='preview'&&_0x87e2f4[_0x215896][_0xaa41('0x27')]==='outbound'){if(_0x87e2f4[_0x215896][_0xaa41('0x66')]){this[_0xaa41('0x67')](_0x87e2f4[_0x215896]);if(_0x87e2f4[_0x215896]['dialPreviewAutoRecallMe'])this['recallMe'](_0x87e2f4[_0x215896]);}else{notSendMessagesQueue(_0x87e2f4[_0x215896]);}}}};Preview[_0xaa41('0xf')][_0xaa41('0x68')]=function(_0x1bb973){var _0x2af8ba=this;this[_0xaa41('0x12')][_0xaa41('0x10')](function(){if(!_[_0xaa41('0x69')](_0x2af8ba[_0xaa41('0x14')][_0x1bb973])){loggerAction[_0xaa41('0x54')]('[clearZombieChannels][talking]',_0x1bb973,_0xaa41('0x6a'),_0x2af8ba[_0xaa41('0x14')][_0x1bb973][_0xaa41('0x6b')],_0xaa41('0x6c'),JSON[_0xaa41('0x51')](_0x2af8ba[_0xaa41('0x25')][_0x2af8ba['actions'][_0x1bb973][_0xaa41('0x6b')]][_0xaa41('0x4a')]),_0xaa41('0x6d'),JSON[_0xaa41('0x51')](_0x2af8ba['campaignsPreview'][_0x2af8ba[_0xaa41('0x14')][_0x1bb973]['queue']]['pTalking']),JSON[_0xaa41('0x51')](_0x2af8ba[_0xaa41('0x14')][_0x1bb973][_0xaa41('0x6e')]),JSON['stringify'](_[_0xaa41('0x6f')](_0x2af8ba[_0xaa41('0x14')][_0x1bb973],[_0xaa41('0x70'),'UserId',_0xaa41('0x71'),_0xaa41('0x72')])));return ami[_0xaa41('0x73')]({'action':_0xaa41('0x74'),'channel':_0x2af8ba[_0xaa41('0x14')][_0x1bb973][_0xaa41('0x75')]})[_0xaa41('0x76')](function(_0x16caf9){if(_0x16caf9['message']===_0xaa41('0x77')){setTimeout(function(){if(_0x2af8ba['actions'][_0x1bb973]){ut['updateOriginated'](_0x2af8ba[_0xaa41('0x25')][_0x2af8ba[_0xaa41('0x14')][_0x1bb973][_0xaa41('0x6b')]],_0xaa41('0x78'));if(_0x2af8ba[_0xaa41('0x14')][_0x1bb973][_0xaa41('0x6e')]===!![]){ut[_0xaa41('0x79')](_0x2af8ba[_0xaa41('0x25')][_0x2af8ba['actions'][_0x1bb973][_0xaa41('0x6b')]],_0xaa41('0x78'));ut[_0xaa41('0x7a')]('[Dialer][checkChannel][pTalking][Preview]'+_0x1bb973,_0x2af8ba[_0xaa41('0x14')][_0x1bb973][_0xaa41('0x6b')]);}ut['loggerError'](_0xaa41('0x7b')+_0x1bb973,_0x2af8ba[_0xaa41('0x14')][_0x1bb973][_0xaa41('0x6b')]);delete _0x2af8ba['actions'][_0x1bb973];}},0x2328);}});}});};Preview[_0xaa41('0xf')][_0xaa41('0x65')]=function(){var _0x4e3b13=this;loggerAction['info'](_0xaa41('0x7c'),_[_0xaa41('0x7d')](this[_0xaa41('0x14')]));for(var _0x4d20c6 in this[_0xaa41('0x14')]){if(_0x4e3b13[_0xaa41('0x14')][_0xaa41('0x63')](_0x4d20c6)){_0x4e3b13[_0xaa41('0x68')](_0x4d20c6);}}};Preview[_0xaa41('0xf')]['recallMe']=function(_0x2ae70c){var _0x57cb70=this;rpcDb['getContactRecallMe'](_0x2ae70c['id'],ut[_0xaa41('0x7e')](this['agents']))[_0xaa41('0x7f')](function(_0xbbf261){if(!_[_0xaa41('0x69')](_0xbbf261)){for(var _0x5e83e1=0x0;_0x5e83e1<_0xbbf261[_0xaa41('0x80')];_0x5e83e1+=0x1){if(ut[_0xaa41('0x81')](_0xbbf261[_0x5e83e1][_0xaa41('0x82')])<_0x2ae70c[_0xaa41('0x83')]*0x3c){if(_0xbbf261[_0x5e83e1][_0xaa41('0x84')]&&!_0xbbf261[_0x5e83e1][_0xaa41('0x84')][_0xaa41('0x85')]){_0x57cb70[_0xaa41('0x86')](_0xbbf261[_0x5e83e1]['id'])[_0xaa41('0x7f')](ut['logger2'](_0xaa41('0x87')))[_0xaa41('0x76')](ut[_0xaa41('0x88')]('[RecallMe]'));}else{rpcDb[_0xaa41('0x89')](_0xbbf261[_0x5e83e1]['id']);}}else{var _0x2caf5c=new Action(_0xbbf261[_0x5e83e1],_0x2ae70c);_0x2caf5c[_0xaa41('0x8a')]=moment()[_0xaa41('0x52')](_0xaa41('0x8b'));_0x2ae70c[_0xaa41('0x40')]+=0x1;ut[_0xaa41('0x8c')](_0x2caf5c,0x17,'RecallInQueue');if(_0x2ae70c['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0xbbf261[_0x5e83e1]));rpcDb['createCustomerHistory'](_0x2caf5c,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xaa41('0x8c')](_0x2caf5c,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x2caf5c,_0xaa41('0x8d'));rpcDb[_0xaa41('0x8e')](_0x2caf5c,_0xaa41('0x8d'));}}}}})[_0xaa41('0x76')](ut['logger2'](_0xaa41('0x8f')));};Preview[_0xaa41('0xf')][_0xaa41('0x67')]=function(_0x46822f){_0x46822f[_0xaa41('0x59')]=!![];if(ut[_0xaa41('0x90')](_0x46822f[_0xaa41('0x2c')])){_0x46822f[_0xaa41('0x49')]=_0xaa41('0x91');}else if(!ut['isActive'](_0x46822f[_0xaa41('0x66')])){_0x46822f[_0xaa41('0x49')]='NOT_ACTIVE';}else if(!this['isTrunkReachable'](_0x46822f['Trunk'])){if(!this[_0xaa41('0x92')](_0x46822f['TrunkBackup'])){_0x46822f[_0xaa41('0x49')]='TRUNK_IS_NOT_REACHABLE';}else{_0x46822f[_0xaa41('0x49')]=_0xaa41('0x93');}}else{_0x46822f['message']=_0xaa41('0x93');}emitCampaignPreview(_0x46822f);};Preview[_0xaa41('0xf')][_0xaa41('0x94')]=function(_0x33f5c2,_0x5a2683,_0x5be61b){var _0x339db3=this;var _0x22bae6=this['actions'][_0x5a2683];var _0x5954ba=this[_0xaa41('0x25')][_0x22bae6[_0xaa41('0x6b')]];var _0x304694;if(_0x5954ba){switch(_0x5be61b){case'1':_0x5954ba[_0xaa41('0x3f')]+=0x1;_0x22bae6[_0xaa41('0x95')]+=0x1;_0x22bae6['countglobal']=ut[_0xaa41('0x96')](_0x22bae6);ut['logCustomer'](_0x22bae6,0x0,'NoSuchNumber');ami['emit'](_0xaa41('0x97'),ut[_0xaa41('0x98')](_0x22bae6,_0xaa41('0x99')));rpcDb['createCustomerHistory'](_0x22bae6,_0xaa41('0x9a'));if(ut[_0xaa41('0x96')](_0x22bae6)>=_0x5954ba[_0xaa41('0x9b')]){_0x304694=ut[_0xaa41('0x9c')](_0x22bae6,0xf,_0xaa41('0x9d'));rpcDb[_0xaa41('0x8e')](_0x304694,_0xaa41('0x9e'));}else{if(_0x22bae6['countnosuchnumberretry']>=_0x5954ba[_0xaa41('0x9f')]){rpcDb[_0xaa41('0x8e')](_0x22bae6,_0xaa41('0x9e'));}else{rpcDb[_0xaa41('0xa0')](ut['scheduledAt'](_0x22bae6,_0xaa41('0x95'),_0x5954ba['dialNoSuchNumberRetryFrequency']),_0x22bae6[_0xaa41('0xa1')],_0x22bae6[_0xaa41('0xa2')]);}}delete this[_0xaa41('0x14')][_0x33f5c2[_0xaa41('0xa3')]];break;case'ANSWER':var _0xf456c1=moment()[_0xaa41('0x52')](_0xaa41('0x8b'));_0x22bae6[_0xaa41('0xa4')]=_0xf456c1;_0x22bae6['answertime']=_0xf456c1;_0x22bae6[_0xaa41('0x6e')]=!![];_0x5954ba['pTalking']+=0x1;logger[_0xaa41('0x54')](_0xaa41('0xa5'),_0x22bae6['uniqueid'],_0xaa41('0xa6'),_0x5954ba[_0xaa41('0x29')],_0xaa41('0x6d'),_0x5954ba[_0xaa41('0x2d')]);ami[_0xaa41('0x26')](_0xaa41('0xa7'),ut[_0xaa41('0x98')](_0x22bae6,_0xaa41('0xa8'),this[_0xaa41('0x25')][_0x22bae6[_0xaa41('0x6b')]]));if(_0x5954ba[_0xaa41('0xa9')]){ami['emit'](_0xaa41('0xaa'),ut[_0xaa41('0xab')](_0x22bae6));}break;case'16':ami[_0xaa41('0x26')]('custom:agentcomplete',ut['buildObj'](_0x22bae6,_0xaa41('0xac'),this[_0xaa41('0x25')][_0x22bae6['queue']]));emitVoiceQueueChannelRemove(ut[_0xaa41('0x98')](_0x22bae6,_0xaa41('0xac')));_0x5954ba['outboundAnswerCallsDay']+=0x1;_0x5954ba[_0xaa41('0xad')]+=0x1;_0x5954ba[_0xaa41('0xae')]+=0x1;ut[_0xaa41('0x79')](_0x5954ba,_0xaa41('0xaf'));_0x22bae6[_0xaa41('0xb0')]=ut[_0xaa41('0x96')](_0x22bae6);ut[_0xaa41('0x8c')](_0x22bae6,0x4,_0xaa41('0xb1'));rpcDb['createCustomerHistory'](_0x22bae6,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xaa41('0x8e')](_0x22bae6,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xaa41('0xb2')](_0x22bae6);_0x5954ba[_0xaa41('0x2f')]+=_0x22bae6[_0xaa41('0xb3')];_0x5954ba['sumBillable']+=_0x22bae6[_0xaa41('0xb3')];logger[_0xaa41('0x54')](_0xaa41('0xb4'),_0x22bae6['uniqueid'],_0xaa41('0xa6'),_0x5954ba[_0xaa41('0x29')],'pTalking:\x20',_0x5954ba[_0xaa41('0x2d')]);delete this['actions'][_0x33f5c2['linkedid']];break;case _0xaa41('0xb5'):_0x5954ba[_0xaa41('0x39')]+=0x1;_0x22bae6['countbusyretry']+=0x1;_0x22bae6['countglobal']=ut[_0xaa41('0x96')](_0x22bae6);ut[_0xaa41('0x8c')](_0x22bae6,0x5,_0xaa41('0xb6'));ami[_0xaa41('0x26')]('custom:agentbusy',ut[_0xaa41('0x98')](_0x22bae6,_0xaa41('0xb7')));rpcDb[_0xaa41('0xb8')](_0x22bae6,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xaa41('0x96')](_0x22bae6)>=_0x5954ba[_0xaa41('0x9b')]){_0x304694=ut[_0xaa41('0x9c')](_0x22bae6,0xf,'Global');rpcDb[_0xaa41('0x8e')](_0x304694,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x22bae6['countbusyretry']>=_0x5954ba[_0xaa41('0xb9')]){rpcDb[_0xaa41('0x8e')](_0x22bae6,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xaa41('0xa0')](ut[_0xaa41('0xba')](_0x22bae6,_0xaa41('0xbb'),_0x5954ba['dialBusyRetryFrequency']),_0x22bae6[_0xaa41('0xa1')],_0x22bae6[_0xaa41('0xa2')]);}}break;case _0xaa41('0xbc'):_0x5954ba[_0xaa41('0x3e')]+=0x1;_0x22bae6[_0xaa41('0xbd')]+=0x1;_0x22bae6['countglobal']=ut[_0xaa41('0x96')](_0x22bae6);ut['logCustomer'](_0x22bae6,0x3,_0xaa41('0xbe'));ami[_0xaa41('0x26')](_0xaa41('0xbf'),ut[_0xaa41('0x98')](_0x22bae6,_0xaa41('0xc0')));rpcDb[_0xaa41('0xb8')](_0x22bae6,_0xaa41('0xc1'));if(ut[_0xaa41('0x96')](_0x22bae6)>=_0x5954ba[_0xaa41('0x9b')]){_0x304694=ut[_0xaa41('0x9c')](_0x22bae6,0xf,_0xaa41('0x9d'));rpcDb['createCustomerFinal'](_0x304694,_0xaa41('0xc2'));}else{if(_0x22bae6[_0xaa41('0xbd')]>=_0x5954ba['dialNoAnswerMaxRetry']){rpcDb[_0xaa41('0x8e')](_0x22bae6,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xaa41('0xa0')](ut[_0xaa41('0xba')](_0x22bae6,_0xaa41('0xbd'),_0x5954ba[_0xaa41('0xc3')]),_0x22bae6[_0xaa41('0xa1')],_0x22bae6[_0xaa41('0xa2')]);}}break;case _0xaa41('0xc4'):_0x5954ba['outboundCongestionCallsDay']+=0x1;_0x22bae6[_0xaa41('0xc5')]+=0x1;_0x22bae6[_0xaa41('0xb0')]=ut[_0xaa41('0x96')](_0x22bae6);ut[_0xaa41('0x8c')](_0x22bae6,0x8,'Congestion');ami[_0xaa41('0x26')]('custom:agentcongestion',ut[_0xaa41('0x98')](_0x22bae6,_0xaa41('0xc6')));rpcDb[_0xaa41('0xb8')](_0x22bae6,_0xaa41('0xc7'));if(ut[_0xaa41('0x96')](_0x22bae6)>=_0x5954ba['dialGlobalMaxRetry']){_0x304694=ut[_0xaa41('0x9c')](_0x22bae6,0xf,_0xaa41('0x9d'));rpcDb['createCustomerFinal'](_0x304694,_0xaa41('0xc8'));}else{if(_0x22bae6[_0xaa41('0xc5')]>=_0x5954ba[_0xaa41('0xc9')]){rpcDb[_0xaa41('0x8e')](_0x22bae6,_0xaa41('0xc7'));}else{rpcDb[_0xaa41('0xa0')](ut[_0xaa41('0xba')](_0x22bae6,_0xaa41('0xc5'),_0x5954ba['dialBusyRetryFrequency']),_0x22bae6[_0xaa41('0xa1')],_0x22bae6[_0xaa41('0xa2')]);}}break;case _0xaa41('0xca'):_0x5954ba[_0xaa41('0xcb')]+=0x1;_0x22bae6[_0xaa41('0xcc')]+=0x1;_0x22bae6[_0xaa41('0xb0')]=ut['totalGlobal'](_0x22bae6);ut['logCustomer'](_0x22bae6,0x14,'AgentReject');ami[_0xaa41('0x26')](_0xaa41('0xcd'),ut['buildObj'](_0x22bae6,_0xaa41('0xce')));rpcDb[_0xaa41('0xb8')](_0x22bae6,'[syncHangupRequest][logAgentReject]');if(ut[_0xaa41('0x96')](_0x22bae6)>=_0x5954ba[_0xaa41('0x9b')]){_0x304694=ut[_0xaa41('0x9c')](_0x22bae6,0x14,_0xaa41('0xcf'));rpcDb['createCustomerFinal'](_0x304694,_0xaa41('0xd0'));}else{if(_0x22bae6['countagentrejectretry']>=_0x5954ba[_0xaa41('0xd1')]){rpcDb[_0xaa41('0x8e')](_0x22bae6,_0xaa41('0xd0'));}else{rpcDb[_0xaa41('0xa0')](ut[_0xaa41('0xba')](_0x22bae6,_0xaa41('0xcc'),_0x5954ba[_0xaa41('0xd2')]),_0x22bae6[_0xaa41('0xa1')],_0x22bae6[_0xaa41('0xa2')]);}}break;case'ABANDONED':_0x5954ba[_0xaa41('0x41')]+=0x1;_0x22bae6[_0xaa41('0xd3')]+=0x1;_0x22bae6[_0xaa41('0xb0')]=ut['totalGlobal'](_0x22bae6);ut[_0xaa41('0x8c')](_0x22bae6,0xb,_0xaa41('0xd4'));rpcDb[_0xaa41('0xb8')](_0x22bae6,_0xaa41('0xd5'));if(ut[_0xaa41('0x96')](_0x22bae6)>=_0x5954ba[_0xaa41('0x9b')]){_0x304694=ut[_0xaa41('0x9c')](_0x22bae6,0xf,_0xaa41('0x9d'));rpcDb[_0xaa41('0x8e')](_0x304694,_0xaa41('0xd5'));}else{if(_0x22bae6[_0xaa41('0xd6')]>=_0x5954ba['dialAbandonedMaxRety']){rpcDb[_0xaa41('0x8e')](_0x22bae6,_0xaa41('0xd5'));}else{rpcDb[_0xaa41('0xa0')](ut[_0xaa41('0xba')](_0x22bae6,_0xaa41('0xd3'),_0x5954ba['dialAbandonedRetryFrequency']),_0x22bae6['unlockAgent'],_0x22bae6[_0xaa41('0xa2')]);}}break;case'18':_0x5954ba[_0xaa41('0xd7')]+=0x1;_0x22bae6['countmachineretry']+=0x1;_0x22bae6[_0xaa41('0xb0')]=ut[_0xaa41('0x96')](_0x22bae6);ut['logCustomer'](_0x22bae6,0x12,_0x33f5c2['cause-txt']||_0x33f5c2['dialstatus']);ami[_0xaa41('0x26')](_0xaa41('0xd8'),ut[_0xaa41('0x98')](_0x22bae6,_0xaa41('0xd9')));rpcDb[_0xaa41('0xb8')](_0x22bae6,_0xaa41('0xda'));if(ut[_0xaa41('0x96')](_0x22bae6)>=_0x5954ba[_0xaa41('0x9b')]){_0x304694=ut[_0xaa41('0x9c')](_0x22bae6,0xf,_0xaa41('0x9d'));rpcDb[_0xaa41('0x8e')](_0x304694,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x22bae6,_0xaa41('0xda'));}delete this[_0xaa41('0x14')][_0x33f5c2['linkedid']];break;case'19':_0x5954ba[_0xaa41('0xd7')]+=0x1;_0x22bae6['countglobal']=ut[_0xaa41('0x96')](_0x22bae6);ut[_0xaa41('0x8c')](_0x22bae6,0x13,_0x33f5c2[_0xaa41('0xdb')]||_0x33f5c2[_0xaa41('0xdc')]);ami[_0xaa41('0x26')](_0xaa41('0xd8'),ut[_0xaa41('0x98')](_0x22bae6,_0xaa41('0xd9')));rpcDb[_0xaa41('0xb8')](_0x22bae6,'[callProgressDetectingCustomer][machine]');if(ut['totalGlobal'](_0x22bae6)>=_0x5954ba['dialGlobalMaxRetry']){_0x304694=ut[_0xaa41('0x9c')](_0x22bae6,0xf,_0xaa41('0x9d'));rpcDb['createCustomerFinal'](_0x304694,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xaa41('0x8e')](_0x22bae6,_0xaa41('0xdd'));}delete this['actions'][_0x33f5c2['linkedid']];break;default:if(_0x22bae6[_0xaa41('0x6e')]){ut['decrementTalkink'](_0x5954ba,_0xaa41('0xde'));ut[_0xaa41('0x7a')](_0xaa41('0xdf')+_0x5954ba[_0xaa41('0x29')],_0x33f5c2);}_0x5954ba[_0xaa41('0xd7')]+=0x1;_0x22bae6[_0xaa41('0xb0')]=ut[_0xaa41('0x96')](_0x22bae6);ut[_0xaa41('0x8c')](_0x22bae6,0xc,_0x33f5c2[_0xaa41('0xdb')]||_0x33f5c2['dialstatus']);rpcDb['createCustomerHistory'](_0x22bae6,_0xaa41('0xe0'));if(ut[_0xaa41('0x96')](_0x22bae6)>=_0x5954ba[_0xaa41('0x9b')]){_0x304694=ut[_0xaa41('0x9c')](_0x22bae6,0xf,_0xaa41('0x9d'));rpcDb[_0xaa41('0x8e')](_0x304694,_0xaa41('0xe1'));}else{rpcDb[_0xaa41('0x8e')](_0x22bae6,_0xaa41('0xe1'));}delete this[_0xaa41('0x14')][_0x33f5c2[_0xaa41('0xa3')]];}if(!(_0x22bae6[_0xaa41('0x6e')]&&_0x5be61b==='16')){ut[_0xaa41('0xe2')](_0x5954ba,_0xaa41('0xe3'));logger[_0xaa41('0x54')]('[originated][decrement][callProgressDetectingCustomer]',_0x22bae6[_0xaa41('0xe4')],'\x20Queue',_0x5954ba[_0xaa41('0x29')],_0xaa41('0x6c'),_0x5954ba[_0xaa41('0x4a')]);}if(_0x5be61b!==_0xaa41('0xe5')){delete this[_0xaa41('0x14')][_0x33f5c2[_0xaa41('0xa3')]];delete this[_0xaa41('0x14')][_0x33f5c2[_0xaa41('0xe6')]];}}};Preview['prototype'][_0xaa41('0xe7')]=function(_0x1a71e2,_0x1ea27c,_0x439c15){if(_[_0xaa41('0xe8')](_0x1ea27c)&&_0xaa41('0xe9')!==typeof _0x1ea27c){return;}if(_[_0xaa41('0xe8')](_0x439c15)&&_0xaa41('0xe9')!==typeof _0x439c15){return;}switch(_0x439c15[_0xaa41('0xea')]){case'0':ut[_0xaa41('0xeb')](_0x1a71e2,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x1a71e2,_0xaa41('0xec'));break;case'3':ut[_0xaa41('0xeb')](_0x1a71e2,0x3,_0xaa41('0xbe'));rpcDb[_0xaa41('0xed')](_0x1a71e2,_0xaa41('0xee'));break;case'5':ut[_0xaa41('0xeb')](_0x1a71e2,0x5,_0xaa41('0xb6'));rpcDb[_0xaa41('0xed')](_0x1a71e2,_0xaa41('0xef'));break;case'8':ut[_0xaa41('0xeb')](_0x1a71e2,0x8,'Congestion');rpcDb['createAgentHistory'](_0x1a71e2,_0xaa41('0xf0'));break;case'22':ut[_0xaa41('0xeb')](_0x1a71e2,0x16,'AnswerAGI');rpcDb[_0xaa41('0xed')](_0x1a71e2,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xaa41('0xeb')](_0x1a71e2,0xc,_0x439c15[_0xaa41('0xea')]);rpcDb['createAgentHistory'](_0x1a71e2,'[callProgressDetectingAgent][logCongestion]');}ut[_0xaa41('0xe2')](_0x1ea27c,_0xaa41('0xf1'));logger[_0xaa41('0x54')]('[originated][decrement][callProgressDetectingAgent]',_0x1a71e2['uniqueid'],_0xaa41('0xa6'),_0x1ea27c['name'],_0xaa41('0x6c'),_0x1ea27c['originated']);delete this[_0xaa41('0x14')][_0x1a71e2[_0xaa41('0xe4')]];};Preview[_0xaa41('0xf')][_0xaa41('0xf2')]=function(_0x182b0b,_0xb012f6,_0xf615eb,_0x4f92d9,_0x4363b5){var _0x1fa1f5=this;return new BPromise(function(_0x50883c,_0x467e2f){if(_[_0xaa41('0x69')](_0xb012f6)||_[_0xaa41('0x69')](_0xb012f6[_0xaa41('0xf3')])||_['isNil'](_0xb012f6[_0xaa41('0xf3')][_0xaa41('0xf4')])||_[_0xaa41('0x69')](_0xb012f6[_0xaa41('0x71')])){_0x467e2f(ut[_0xaa41('0x49')](_0xaa41('0xf5'),_0x4f92d9,_0x4363b5));return;}var _0x1e5116=uuid['v4']();var _0xa61116=_0x1fa1f5[_0xaa41('0x25')][_0xb012f6['Queue']['name']];var _0x214ebe=_0xf615eb?_0x1fa1f5[_0xaa41('0x15')][_0xf615eb]['id']:undefined;_0x1fa1f5[_0xaa41('0x14')][_0x1e5116]=new Action(_0xb012f6,_0xa61116,_0x1e5116,_0xf615eb,_0x214ebe);var _0x26e6b1=_0x1fa1f5[_0xaa41('0x14')][_0x1e5116];_0x26e6b1[_0xaa41('0xa1')]=_0x4f92d9;_0x26e6b1['activeContact']=_0x4363b5;_0x26e6b1[_0xaa41('0xf6')]=_0xf615eb;if(_[_0xaa41('0xf7')](_0x182b0b)){_0x1fa1f5[_0xaa41('0xf8')](_0x26e6b1,_0xa61116,_0xb012f6,_0xf615eb)[_0xaa41('0x7f')](function(_0x360606){logger[_0xaa41('0x54')]('[Preview][execCall][success]',_0xaa41('0xf9')+_0x26e6b1[_0xaa41('0x6b')]+_0xaa41('0xfa')+_0x26e6b1['idContact'],JSON[_0xaa41('0x51')](_0x360606));ami[_0xaa41('0x26')](_0xaa41('0xfb'),ut[_0xaa41('0x98')](_0x26e6b1,_0xaa41('0xfc'),_0x1fa1f5[_0xaa41('0x25')][_0x26e6b1[_0xaa41('0x6b')]]));_0x50883c(ut[_0xaa41('0x49')](_0xaa41('0xfd')));})[_0xaa41('0x76')](function(_0x19a42c){ut[_0xaa41('0x5c')](_0xaa41('0xfe'),_0x19a42c);_0x467e2f(ut['message']('Call\x20failed',_0x4f92d9,_0x4363b5));});}else{_0xa61116[_0xaa41('0x38')]+=0x1;ut[_0xaa41('0xff')](_0x26e6b1);rpcDb[_0xaa41('0x100')](_0x26e6b1,_0xaa41('0x101'));delete _0x1fa1f5[_0xaa41('0x14')][_0x1e5116];_0x467e2f(ut[_0xaa41('0x49')](_0xaa41('0x102'),_0x4f92d9,_0x4363b5));}});};Preview['prototype'][_0xaa41('0x92')]=function(_0x19cba1){return!_[_0xaa41('0x69')](_0x19cba1)&&!_[_0xaa41('0x69')](_0x19cba1[_0xaa41('0x29')])&&!_[_0xaa41('0x69')](_0x19cba1[_0xaa41('0x103')])&&_0x19cba1[_0xaa41('0x103')]&&!_[_0xaa41('0x69')](this[_0xaa41('0x13')][util[_0xaa41('0x52')](_0xaa41('0x104'),_0x19cba1['name'])])&&!_[_0xaa41('0x69')](this[_0xaa41('0x13')][util['format'](_0xaa41('0x104'),_0x19cba1[_0xaa41('0x29')])][_0xaa41('0x74')])&&(this[_0xaa41('0x13')][util['format'](_0xaa41('0x104'),_0x19cba1[_0xaa41('0x29')])][_0xaa41('0x74')]===_0xaa41('0x105')||this[_0xaa41('0x13')][util['format'](_0xaa41('0x104'),_0x19cba1['name'])]['status']===_0xaa41('0x106'));};Preview['prototype']['run']=function(_0x2a925e,_0x449d11){var _0x5b241e=this;return new BPromise(function(_0x5808b0,_0x1983f3){_0x5b241e[_0xaa41('0x107')](_0x2a925e,_0x449d11)[_0xaa41('0x7f')](function(_0x2dab29){_0x5808b0(_[_0xaa41('0x6f')](_0x2dab29,[_0xaa41('0x49')]));})[_0xaa41('0x76')](function(_0x3efa92){if(_0x3efa92['unlock']){rpcDb[_0xaa41('0x108')](_0x2a925e);}if(_0x3efa92[_0xaa41('0x103')]){rpcDb[_0xaa41('0x89')](_0x2a925e);}_0x1983f3(_[_0xaa41('0x6f')](_0x3efa92,[_0xaa41('0x49')]));});});};Preview['prototype']['execRun']=function(_0x348c77,_0x1444bb){var _0x248ae8=this;return new BPromise(function(_0x14fcf6,_0x10512a){var _0x3a11f1,_0x58eeb2;rpcDb[_0xaa41('0x109')](_0x348c77)[_0xaa41('0x7f')](function(_0x50e0bd){if(!_[_0xaa41('0x69')](_0x50e0bd[0x0])){_0x58eeb2=_0x50e0bd[0x0][_0xaa41('0x10a')]?![]:!![];_0x3a11f1=_0x50e0bd[0x0][_0xaa41('0x10a')]?!![]:![];_0x3a11f1=_0x1444bb?!![]:_0x3a11f1;}var _0x27149e=_0x248ae8[_0xaa41('0x10b')](_0x50e0bd);if(_0x27149e[_0xaa41('0x10c')]){rpcDb[_0xaa41('0x10d')](_['pick'](_0x50e0bd[0x0],[_0xaa41('0x71'),_0xaa41('0x10e')]))['then'](function(_0x31fd1d){_0x248ae8[_0xaa41('0xf2')](_0x31fd1d,_0x50e0bd[0x0],_0x1444bb,_0x58eeb2,_0x3a11f1)[_0xaa41('0x7f')](function(_0x4446ab){_0x14fcf6(_0x4446ab);})['catch'](function(_0x7a21c3){_0x10512a(_0x7a21c3);});})[_0xaa41('0x76')](function(_0x339537){ut[_0xaa41('0x5c')](_0xaa41('0x10f'),_0x339537);_0x10512a(ut['message'](_0xaa41('0x110'),_0x58eeb2,_0x3a11f1));});}else{_0x10512a(ut[_0xaa41('0x49')](_0x27149e['message'],_0x58eeb2,_0x3a11f1));}})['catch'](function(_0x456c57){ut[_0xaa41('0x5c')](_0xaa41('0x111'),_0x456c57);_0x10512a(ut[_0xaa41('0x49')](_0xaa41('0x110'),![],!![]));});});};Preview[_0xaa41('0xf')]['validateContact']=function(_0x59ea7b){if(_[_0xaa41('0x69')](_0x59ea7b)||_[_0xaa41('0xf7')](_0x59ea7b)||!_['isNil'](_0x59ea7b[0x0]['Agent'])&&_[_0xaa41('0x69')](_0x59ea7b[0x0][_0xaa41('0x84')][_0xaa41('0x29')])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0x59ea7b);return{'isValid':![],'message':_0xaa41('0x112')};}var _0xf1aa42=this[_0xaa41('0x25')][_0x59ea7b[0x0]['Queue'][_0xaa41('0x29')]];_0xf1aa42[_0xaa41('0x49')]='ACTIVE';if(_['isNil'](_0xf1aa42)){ut[_0xaa41('0x5c')]('[Preview][validateContact][Empty\x20Campaign]',_0xf1aa42);return{'isValid':![],'message':_0xaa41('0x113')};}if(!this[_0xaa41('0x92')](_0xf1aa42[_0xaa41('0x4f')])){ut[_0xaa41('0x5c')](_0xaa41('0x114'),_0xaa41('0x115')+_0xf1aa42[_0xaa41('0x29')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xaa41('0x92')](_0xf1aa42[_0xaa41('0x116')])){ut['logger'](_0xaa41('0x114'),_0xf1aa42[_0xaa41('0x29')]+_0xaa41('0x117'));return{'isValid':![],'message':_0xaa41('0x118')};}}if(!ut[_0xaa41('0x119')](_0xf1aa42[_0xaa41('0x66')])){ut['logger'](_0xaa41('0x11a'),_0xf1aa42[_0xaa41('0x29')]+_0xaa41('0x11b'));return{'isValid':![],'message':_0xaa41('0x115')+_0xf1aa42[_0xaa41('0x29')]+_0xaa41('0x11b')};}return{'isValid':!![],'message':_0xaa41('0x11c')};};Preview['prototype'][_0xaa41('0xf8')]=function(_0x3c4e89,_0x415acc,_0x55a95c,_0x4dc392){var _0x4ecaee=this;return new BPromise(function(_0x2a503a,_0x1331f8){var _0x1013a9=_0x3c4e89[_0xaa41('0xe4')];var _0x46974c=_0x4ecaee['isTrunkReachable'](_0x415acc[_0xaa41('0x4f')])?util[_0xaa41('0x52')](_0xaa41('0x11d'),_0x415acc[_0xaa41('0x4f')][_0xaa41('0x29')],_[_0xaa41('0x69')](_0x415acc[_0xaa41('0x36')])?'':_0x415acc['dialPrefix'][_0xaa41('0x11e')]()||'',_0x415acc[_0xaa41('0x11f')]>0x0?_0x55a95c[_0xaa41('0xf3')]['phone'][_0xaa41('0x120')](_0x415acc['dialCutDigit']):_0x55a95c['Contact'][_0xaa41('0xf4')]):util['format'](_0xaa41('0x11d'),_[_0xaa41('0x69')](_0x415acc[_0xaa41('0x116')])?_0x415acc[_0xaa41('0x4f')][_0xaa41('0x29')]:_0x415acc[_0xaa41('0x116')][_0xaa41('0x29')],_['isNil'](_0x415acc[_0xaa41('0x36')])?'':_0x415acc[_0xaa41('0x36')][_0xaa41('0x11e')]()||'',_0x415acc[_0xaa41('0x11f')]>0x0?_0x55a95c[_0xaa41('0xf3')][_0xaa41('0xf4')][_0xaa41('0x120')](_0x415acc[_0xaa41('0x11f')]):_0x55a95c[_0xaa41('0xf3')][_0xaa41('0xf4')]);var _0x10c53d=_0x4ecaee[_0xaa41('0x92')](_0x415acc[_0xaa41('0x4f')])?ut[_0xaa41('0x121')](_0x415acc[_0xaa41('0x4f')][_0xaa41('0x122')],_0x415acc['dialOriginateCallerIdName'],_0x415acc[_0xaa41('0x123')]>0x0?ut['getCallerIdRandom'](_0x415acc['dialOriginateCallerIdNumber'],_0x415acc['dialRandomLastDigitCallerIdNumber']):_0x415acc[_0xaa41('0x34')]):ut[_0xaa41('0x121')](_['isNil'](_0x415acc[_0xaa41('0x116')])?_0x415acc[_0xaa41('0x4f')][_0xaa41('0x122')]:_0x415acc[_0xaa41('0x116')][_0xaa41('0x122')],_0x415acc[_0xaa41('0x33')],_0x415acc[_0xaa41('0x123')]>0x0?ut[_0xaa41('0x124')](_0x415acc[_0xaa41('0x34')],_0x415acc[_0xaa41('0x123')]):_0x415acc[_0xaa41('0x34')]);if(_0x10c53d){_0x3c4e89[_0xaa41('0x125')]=ut[_0xaa41('0x126')](_0x10c53d);_0x3c4e89[_0xaa41('0x127')]=ut[_0xaa41('0x128')](_0x10c53d);}var _0x104183=ut[_0xaa41('0x129')](_0x415acc,_0x55a95c,_0x46974c,_0x10c53d,_0x1013a9,_0x3c4e89);_['merge'](_0x3c4e89,ut[_0xaa41('0x12a')](_0x104183));_0x3c4e89[_0xaa41('0x8a')]=moment()[_0xaa41('0x52')](_0xaa41('0x8b'));ami['Action'](ut[_0xaa41('0x12b')](_0x3c4e89,_0x415acc,_0x104183,_0x3c4e89[_0xaa41('0xa2')],_0x4dc392))['then'](function(_0x43e3cd){_0x415acc[_0xaa41('0x4a')]+=0x1;logger[_0xaa41('0x54')](_0xaa41('0x12c'),_0x1013a9,_0xaa41('0xa6'),_0x415acc[_0xaa41('0x29')],_0xaa41('0x6c'),_0x415acc[_0xaa41('0x4a')]);_0x2a503a(_0x43e3cd);})[_0xaa41('0x76')](function(_0x16867b){ut['logAgent'](_0x3c4e89,0xe,_0xaa41('0x12d'));rpcDb[_0xaa41('0xed')](_0x3c4e89,_0xaa41('0x12e'));_0x1331f8(_0x16867b);});});};Preview[_0xaa41('0xf')][_0xaa41('0x1f')]=function(_0x2c7ceb){if(this['actions'][_0x2c7ceb[_0xaa41('0xa3')]]){this['actions'][_0x2c7ceb[_0xaa41('0xa3')]][_0xaa41('0x75')]=_0x2c7ceb[_0xaa41('0x75')];}};Preview[_0xaa41('0xf')][_0xaa41('0x12f')]=function(_0x58dafb){var _0x12f4a1=this;var _0x345002=this['actions'][_0x58dafb[_0xaa41('0x130')]];if(_0x345002){if(_0x345002[_0xaa41('0xf6')]&&this[_0xaa41('0x15')][_0x345002[_0xaa41('0xf6')]]){ut[_0xaa41('0x131')](_0x345002,this[_0xaa41('0x15')][_0x345002[_0xaa41('0xf6')]][_0xaa41('0x29')],this[_0xaa41('0x15')][_0x345002[_0xaa41('0xf6')]]['id']);}var _0x56a829=_[_0xaa41('0x132')](_0x345002);_0x56a829[_0xaa41('0xa4')]=moment()[_0xaa41('0x52')]('YYYY-MM-DD\x20HH:mm:ss');var _0x48976d=_0x12f4a1[_0xaa41('0x25')][_0x345002['queue']];if(ut['isFailure'](_0x58dafb[_0xaa41('0x133')])){if(_0x345002[_0xaa41('0xa1')]){rpcDb[_0xaa41('0x108')](_0x345002[_0xaa41('0x134')]);}if(_0x345002['activeContact']){rpcDb['disableContact'](_0x345002[_0xaa41('0x134')]);}ami[_0xaa41('0x26')](_0xaa41('0x135'),ut[_0xaa41('0x98')](_0x345002,_0xaa41('0x136'),this['campaignsPreview'][_0x345002[_0xaa41('0x6b')]]));this[_0xaa41('0xe7')](_0x56a829,_0x48976d,_0x58dafb);}else{_0x345002['starttime']=moment()[_0xaa41('0x52')](_0xaa41('0x8b'));ut['logAgent'](_0x56a829,0x4,_0xaa41('0xb1'));rpcDb[_0xaa41('0xed')](_0x56a829,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xaa41('0xf')][_0xaa41('0x1a')]=function(_0x48a2b1){var _0xd21bc4=this;var _0x4ab6a9=this['actions'][_0x48a2b1[_0xaa41('0xa3')]];var _0x45f6ae;if(_0x4ab6a9){_0x45f6ae=this[_0xaa41('0x25')][_0x4ab6a9[_0xaa41('0x6b')]];logger[_0xaa41('0x54')]('[syncHangup][talking]',_0x48a2b1[_0xaa41('0xa3')],'\x20Queue',_0x45f6ae['name'],_0xaa41('0x6d'),_0x45f6ae[_0xaa41('0x2d')]);}if(this[_0xaa41('0x14')][_0x48a2b1[_0xaa41('0xa3')]]&&_0x48a2b1[_0xaa41('0xa3')]!==_0x48a2b1[_0xaa41('0xe4')]){if(_0x48a2b1[_0xaa41('0x137')]==='16'&&this['actions'][_0x48a2b1[_0xaa41('0xa3')]][_0xaa41('0x6e')]){this[_0xaa41('0x94')](_0x48a2b1,_0x48a2b1[_0xaa41('0xa3')],_0x48a2b1[_0xaa41('0x137')]);}else if(this[_0xaa41('0x14')][_0x48a2b1[_0xaa41('0xa3')]][_0xaa41('0x6e')]){logger[_0xaa41('0x54')](_0xaa41('0x138'),_0x48a2b1[_0xaa41('0xa3')],_0x48a2b1[_0xaa41('0x137')],'\x20Queue',_0x45f6ae['name'],_0xaa41('0x6d'),_0x45f6ae[_0xaa41('0x2d')]);this[_0xaa41('0x94')](_0x48a2b1,_0x48a2b1['linkedid'],_0x48a2b1[_0xaa41('0x137')]);}}else if(_0x4ab6a9&&_[_0xaa41('0x69')](_0x4ab6a9[_0xaa41('0x139')])&&_0x45f6ae[_0xaa41('0x13a')]&&_0x48a2b1[_0xaa41('0xa3')]===_0x48a2b1[_0xaa41('0xe4')]&&_[_0xaa41('0x69')](_0x48a2b1[_0xaa41('0xea')])&&_0x48a2b1[_0xaa41('0x137')]==='16'&&_0x48a2b1[_0xaa41('0x13b')]==='6'&&_[_0xaa41('0xe8')](_0x4ab6a9[_0xaa41('0x13c')])){if(_0x4ab6a9[_0xaa41('0xa1')]){rpcDb[_0xaa41('0x108')](_0x4ab6a9[_0xaa41('0x134')]);}if(_0x4ab6a9['activeContact']){rpcDb[_0xaa41('0x89')](_0x4ab6a9[_0xaa41('0x134')]);}_0x48a2b1[_0xaa41('0xea')]='22';this['callProgressDetectingAgent'](_0x4ab6a9,_0x45f6ae,_0x48a2b1);}else if(_0x4ab6a9&&_0x4ab6a9[_0xaa41('0x13c')]){if(_0x48a2b1[_0xaa41('0x137')]==='16'&&this[_0xaa41('0x14')][_0x48a2b1[_0xaa41('0xa3')]][_0xaa41('0x6e')]){logger[_0xaa41('0x54')](_0xaa41('0x13d'),_0x48a2b1[_0xaa41('0xa3')],_0x48a2b1['cause'],_0xaa41('0xa6'),_0x45f6ae[_0xaa41('0x29')],_0xaa41('0x6d'),_0x45f6ae[_0xaa41('0x2d')]);this[_0xaa41('0x94')](_0x48a2b1,_0x48a2b1['linkedid'],_0x48a2b1[_0xaa41('0x137')]);}else if(this['actions'][_0x48a2b1[_0xaa41('0xa3')]][_0xaa41('0x6e')]){logger[_0xaa41('0x54')](_0xaa41('0x138'),_0x48a2b1[_0xaa41('0xa3')],_0x48a2b1[_0xaa41('0x137')],_0xaa41('0xa6'),_0x45f6ae[_0xaa41('0x29')],_0xaa41('0x6d'),_0x45f6ae[_0xaa41('0x2d')]);this[_0xaa41('0x94')](_0x48a2b1,_0x48a2b1[_0xaa41('0xa3')],_0x48a2b1['cause']);}}};Preview['prototype'][_0xaa41('0x1d')]=function(_0x129a63){if(this[_0xaa41('0x14')][_0x129a63[_0xaa41('0xe6')]]&&_0x129a63[_0xaa41('0xe6')]!==_0x129a63[_0xaa41('0x13e')]){this['callProgressDetectingCustomer'](_0x129a63,_0x129a63[_0xaa41('0xe6')],_0x129a63['dialstatus']);}};Preview[_0xaa41('0xf')][_0xaa41('0x1c')]=function(_0x2c0489){if(this[_0xaa41('0x14')][_0x2c0489[_0xaa41('0xa3')]]&&_0x2c0489[_0xaa41('0xa3')]!==_0x2c0489['uniqueid']&&!this['actions'][_0x2c0489[_0xaa41('0xa3')]]['dialAnswer']){if(_0x2c0489[_0xaa41('0x137')]==='1'){this[_0xaa41('0x94')](_0x2c0489,_0x2c0489[_0xaa41('0xa3')],_0x2c0489[_0xaa41('0x137')]);}}};Preview[_0xaa41('0xf')][_0xaa41('0x13f')]=function(_0x422838,_0x21c46d,_0x12b5b0){if(this[_0xaa41('0x14')][_0x422838]){if(_[_0xaa41('0x69')](this[_0xaa41('0x14')][_0x422838][_0xaa41('0x140')])){this[_0xaa41('0x14')][_0x422838]['variables']={};}this[_0xaa41('0x14')][_0x422838]['variables'][_0x21c46d]=_0x12b5b0;}};Preview[_0xaa41('0xf')]['syncVarSet']=function(_0x6eece1){try{if(!_[_0xaa41('0x69')](_0x6eece1)){if(ut[_0xaa41('0x141')](_[_0xaa41('0x142')](_0x6eece1[_0xaa41('0x143')])[0x0])){this[_0xaa41('0x13f')](_0x6eece1[_0xaa41('0xe4')],_['keys'](_0x6eece1[_0xaa41('0x143')])[0x0],_0x6eece1['value']);}}}catch(_0x47ca9d){logger[_0xaa41('0x144')](_0xaa41('0x145'),util['inspect'](_0x47ca9d,{'showHidden':![],'depth':null}));}};Preview[_0xaa41('0xf')][_0xaa41('0x146')]=function(_0x57b75c){if(_0x57b75c){if(this[_0xaa41('0x14')][_0x57b75c[_0xaa41('0x147')]]){this[_0xaa41('0x14')][_0x57b75c['transfertargetlinkedid']][_0xaa41('0x13c')]=!![];}}};Preview['prototype'][_0xaa41('0x24')]=function(_0x1f0450){if(_0x1f0450){if(this[_0xaa41('0x14')][_0x1f0450[_0xaa41('0x148')]]){this['actions'][_0x1f0450[_0xaa41('0x148')]][_0xaa41('0x13c')]=!![];}}};module[_0xaa41('0x149')]=Preview; \ No newline at end of file +var _0x826a=['createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','unlock','unlockContact','pick','execRun','getContactPreview','recallme','isValid','checkIsBlackList','Contact.phone','checkInBlack','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialCutDigit','phone','trim','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','toLowerVariables','starttime','Action','variablesAction','[originated][increment]','OriginateError','actionid','logLookAgent','responsetime','isFailure','response','idContact','custom:agentringnoanswer','rejected','syncHangup','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','syncHangupRequest','addVariable','variables','filterKey','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','lodash','uuid','md5','ioredis','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','bind','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','loopCampaigns','emit','type','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','clockClearZombieChannels','hasOwnProperty','preview','booked','outbound','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','recallMe','isNil','Queue','queue','pTalking:\x20','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','linkedid','ANSWER','answertime','uniqueid','custom:agentconnect','buildObj','connect','buildAcw','custom:agentcomplete','complete','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','\x20Queue','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','activeContact','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','countcongestionretry','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialGlobalMaxRetry','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','countabandonedetry','dialAbandonedMaxRety','cause-txt','amd','dialstatus','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','Congestion','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','isEmpty','Queue:\x20','custom:agentcalled','called','Call\x20failed','logBlacklist'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x826a,0x1aa));var _0xa826=function(_0x155666,_0x381416){_0x155666=_0x155666-0x0;var _0x54f419=_0x826a[_0x155666];return _0x54f419;};'use strict';var util=require('util');var _=require(_0xa826('0x0'));var BPromise=require('bluebird');var uuid=require(_0xa826('0x1'));var moment=require('moment');var md5=require(_0xa826('0x2'));var Redis=require(_0xa826('0x3'));var config=require(_0xa826('0x4'));var logger=require(_0xa826('0x5'))('preview');var loggerAction=require(_0xa826('0x5'))(_0xa826('0x6'));var ami=require(_0xa826('0x7'));var rpcDb=require(_0xa826('0x8'));var Action=require(_0xa826('0x9'));var ut=require(_0xa826('0xa'));config[_0xa826('0xb')]=_[_0xa826('0xc')](config[_0xa826('0xb')],{'host':_0xa826('0xd'),'port':0x18eb});var io=require(_0xa826('0xe'))(new Redis(config[_0xa826('0xb')]));var Sequence=function(){};Sequence[_0xa826('0xf')][_0xa826('0x10')]=function(_0x37d4a){this[_0xa826('0x11')]=this['tail']?this[_0xa826('0x11')]['finally'](_0x37d4a):_0x37d4a();};function Preview(_0x18b609){this[_0xa826('0x12')]=new Sequence();this[_0xa826('0x13')]=_0x18b609[_0xa826('0x14')];this[_0xa826('0x15')]=_0x18b609[_0xa826('0x15')];this[_0xa826('0x16')]={};this['agents']=_0x18b609[_0xa826('0x17')];this['clockClearZombieChannels']=0x0;ami['on'](_0xa826('0x18'),this[_0xa826('0x19')]['bind'](this));ami['on']('hangup',this['syncHangup'][_0xa826('0x1a')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0xa826('0x1a')](this));ami['on'](_0xa826('0x1b'),this[_0xa826('0x1c')]['bind'](this));ami['on'](_0xa826('0x1d'),this[_0xa826('0x1e')][_0xa826('0x1a')](this));ami['on'](_0xa826('0x1f'),this[_0xa826('0x20')]['bind'](this));ami['on'](_0xa826('0x21'),this[_0xa826('0x22')][_0xa826('0x1a')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xa826('0x1a')](this));this[_0xa826('0x23')](this[_0xa826('0x13')]);}function emit(_0x8d1650,_0x124564,_0x4e0f43){io['to'](_0x8d1650)[_0xa826('0x24')](_0x124564,_0x4e0f43);}function emitCampaignPreview(_0x2e7e90){if(_0x2e7e90[_0xa826('0x25')]==='outbound'){var _0x5ddeef={'id':_0x2e7e90['id'],'name':_0x2e7e90[_0xa826('0x26')],'strategy':_0x2e7e90[_0xa826('0x27')],'answered':_0x2e7e90[_0xa826('0x28')],'available':_0x2e7e90['available'],'loggedIn':_0x2e7e90[_0xa826('0x29')],'pTalking':_0x2e7e90[_0xa826('0x2a')],'sumBillable':_0x2e7e90[_0xa826('0x2b')],'sumDuration':_0x2e7e90[_0xa826('0x2c')],'sumHoldTime':_0x2e7e90[_0xa826('0x2d')]||0x0,'talking':_0x2e7e90['talking'],'total':_0x2e7e90[_0xa826('0x2e')],'type':_0x2e7e90['type'],'unmanaged':_0x2e7e90[_0xa826('0x2f')],'abandoned':_0x2e7e90[_0xa826('0x30')],'waiting':_0x2e7e90['waiting'],'loggedInDb':_0x2e7e90[_0xa826('0x31')],'dialActive':_0x2e7e90[_0xa826('0x32')],'dialMethod':_0x2e7e90[_0xa826('0x33')],'dialOriginateCallerIdName':_0x2e7e90[_0xa826('0x34')],'dialOriginateCallerIdNumber':_0x2e7e90[_0xa826('0x35')],'dialOriginateTimeout':_0x2e7e90[_0xa826('0x36')],'dialPrefix':_0x2e7e90[_0xa826('0x37')],'outboundAnswerAgiCallsDay':_0x2e7e90[_0xa826('0x38')],'outboundAnswerCallsDay':_0x2e7e90[_0xa826('0x39')],'outboundBlacklistCallsDay':_0x2e7e90[_0xa826('0x3a')],'outboundBusyCallsDay':_0x2e7e90[_0xa826('0x3b')],'outboundCongestionCallsDay':_0x2e7e90[_0xa826('0x3c')],'outboundDropCallsDayACS':_0x2e7e90[_0xa826('0x3d')],'outboundDropCallsDayCallersExit':_0x2e7e90[_0xa826('0x3e')],'outboundDropCallsDayTimeout':_0x2e7e90[_0xa826('0x3f')],'outboundNoAnswerCallsDay':_0x2e7e90[_0xa826('0x40')],'outboundNoSuchCallsDay':_0x2e7e90['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x2e7e90[_0xa826('0x41')],'outboundReCallsDay':_0x2e7e90['outboundReCallsDay'],'outboundRejectCallsDay':_0x2e7e90[_0xa826('0x42')],'outboundUnknownCallsDay':_0x2e7e90[_0xa826('0x43')],'outboundAbandonedCallsDay':_0x2e7e90[_0xa826('0x44')],'predictiveIntervalAnsweredCalls':_0x2e7e90[_0xa826('0x45')],'predictiveIntervalAvgHoldtime':_0x2e7e90[_0xa826('0x46')],'predictiveIntervalAvgTalktime':_0x2e7e90['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x2e7e90['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x2e7e90[_0xa826('0x47')],'predictiveIntervalErlangCalls':_0x2e7e90[_0xa826('0x48')],'predictiveIntervalErlangCallsDroppedCalls':_0x2e7e90[_0xa826('0x49')],'predictiveIntervalHitRate':_0x2e7e90[_0xa826('0x4a')],'predictiveIntervalMultiplicativeFactor':_0x2e7e90['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x2e7e90[_0xa826('0x4b')],'predictiveIntervalAvailable':_0x2e7e90[_0xa826('0x4c')],'predictiveIntervalTotalCalls':_0x2e7e90['predictiveIntervalTotalCalls'],'message':_0x2e7e90[_0xa826('0x4d')],'originated':_0x2e7e90['originated'],'erlangCalls':_0x2e7e90[_0xa826('0x4e')],'erlangCallToSecond':_0x2e7e90[_0xa826('0x4f')],'erlangAbandonmentRate':_0x2e7e90[_0xa826('0x50')],'erlangBusyFactor':_0x2e7e90[_0xa826('0x51')],'startPredictive':_0x2e7e90[_0xa826('0x52')],'startProgressive':_0x2e7e90['startProgressive']};if(_0x2e7e90[_0xa826('0x53')]){_0x5ddeef[_0xa826('0x53')]={'id':_0x2e7e90[_0xa826('0x53')]['id'],'name':_0x2e7e90[_0xa826('0x53')][_0xa826('0x26')],'active':_0x2e7e90[_0xa826('0x53')][_0xa826('0x54')],'callerid':_0x2e7e90[_0xa826('0x53')][_0xa826('0x55')]};}if(_0x2e7e90[_0xa826('0x56')]){_0x5ddeef[_0xa826('0x56')]={'id':_0x2e7e90['Interval']['id'],'name':_0x2e7e90[_0xa826('0x56')]['name']};}var _0x3828a6=md5(JSON['stringify'](_0x5ddeef));if(_0x2e7e90[_0xa826('0x2')]!==_0x3828a6){_0x2e7e90[_0xa826('0x2')]=_0x3828a6;emit(util[_0xa826('0x57')](_0xa826('0x58'),_0x5ddeef[_0xa826('0x26')]),_0xa826('0x59'),_0x5ddeef);}}}function emitVoiceQueueChannelRemove(_0xf1e041){logger[_0xa826('0x5a')](_0xa826('0x5b'),JSON[_0xa826('0x5c')](_0xf1e041));emit(util[_0xa826('0x57')](_0xa826('0x58'),_0xf1e041['name']),_0xa826('0x5d'),_0xf1e041);io[_0xa826('0x24')](_0xa826('0x5e'),_0xf1e041);}function notSendMessagesQueue(_0x5899d0){if(_0x5899d0[_0xa826('0x5f')]){if(_0x5899d0[_0xa826('0x60')]===0x0&&_0x5899d0['pTalking']===0x0){_0x5899d0[_0xa826('0x5f')]=![];_0x5899d0['available']=0x0;_0x5899d0['paused']=0x0;_0x5899d0[_0xa826('0x4d')]=_0xa826('0x61');ut[_0xa826('0x62')](_0xa826('0x63'),_0x5899d0[_0xa826('0x26')]+_0xa826('0x64'));}else{_0x5899d0['message']=_0xa826('0x65');ut[_0xa826('0x62')](_0xa826('0x63'),_0x5899d0[_0xa826('0x26')]+_0xa826('0x66'));}emitCampaignPreview(_0x5899d0);}}Preview[_0xa826('0xf')]['loopCampaigns']=function(){var _0x35376c=this;setInterval(function(){_0x35376c[_0xa826('0x67')]();},0x7cf);};Preview[_0xa826('0xf')][_0xa826('0x67')]=function(){var _0x258e57=this['campaignsPreview'];this[_0xa826('0x68')]+=0x1;for(var _0x317682 in _0x258e57){if(_0x258e57[_0xa826('0x69')](_0x317682)&&(_0x258e57[_0x317682][_0xa826('0x33')]===_0xa826('0x6a')||_0x258e57[_0x317682][_0xa826('0x33')]===_0xa826('0x6b'))&&_0x258e57[_0x317682][_0xa826('0x25')]===_0xa826('0x6c')){if(this[_0xa826('0x68')]>0x7){this[_0xa826('0x68')]=0x0;this[_0xa826('0x6d')]();}}if(_0x258e57['hasOwnProperty'](_0x317682)&&_0x258e57[_0x317682][_0xa826('0x33')]===_0xa826('0x6a')&&_0x258e57[_0x317682][_0xa826('0x25')]==='outbound'){if(_0x258e57[_0x317682][_0xa826('0x32')]){this[_0xa826('0x6e')](_0x258e57[_0x317682]);if(_0x258e57[_0x317682][_0xa826('0x6f')])this[_0xa826('0x70')](_0x258e57[_0x317682]);}else{notSendMessagesQueue(_0x258e57[_0x317682]);}}}};Preview[_0xa826('0xf')]['clearZombieChannel']=function(_0x922dec){var _0x450774=this;this[_0xa826('0x12')][_0xa826('0x10')](function(){if(!_[_0xa826('0x71')](_0x450774[_0xa826('0x16')][_0x922dec])){loggerAction[_0xa826('0x5a')]('[clearZombieChannels][talking]',_0x922dec,_0xa826('0x72'),_0x450774['actions'][_0x922dec]['queue'],'originated:\x20',JSON[_0xa826('0x5c')](_0x450774[_0xa826('0x13')][_0x450774[_0xa826('0x16')][_0x922dec][_0xa826('0x73')]]['originated']),_0xa826('0x74'),JSON['stringify'](_0x450774['campaignsPreview'][_0x450774[_0xa826('0x16')][_0x922dec][_0xa826('0x73')]]['pTalking']),JSON[_0xa826('0x5c')](_0x450774[_0xa826('0x16')][_0x922dec]['dialAnswer']),JSON['stringify'](_['pick'](_0x450774['actions'][_0x922dec],['contactId','UserId','VoiceQueueId',_0xa826('0x75')])));return ami['Action']({'action':_0xa826('0x76'),'channel':_0x450774['actions'][_0x922dec][_0xa826('0x77')]})[_0xa826('0x78')](function(_0x407e8b){if(_0x407e8b[_0xa826('0x4d')]===_0xa826('0x79')){setTimeout(function(){if(_0x450774['actions'][_0x922dec]){ut[_0xa826('0x7a')](_0x450774['campaignsPreview'][_0x450774['actions'][_0x922dec][_0xa826('0x73')]],_0xa826('0x7b'));if(_0x450774['actions'][_0x922dec][_0xa826('0x7c')]===!![]){ut[_0xa826('0x7d')](_0x450774[_0xa826('0x13')][_0x450774['actions'][_0x922dec][_0xa826('0x73')]],_0xa826('0x7b'));ut[_0xa826('0x7e')](_0xa826('0x7f')+_0x922dec,_0x450774[_0xa826('0x16')][_0x922dec][_0xa826('0x73')]);}ut[_0xa826('0x7e')](_0xa826('0x80')+_0x922dec,_0x450774['actions'][_0x922dec][_0xa826('0x73')]);delete _0x450774[_0xa826('0x16')][_0x922dec];}},0x2328);}});}});};Preview[_0xa826('0xf')][_0xa826('0x6d')]=function(){var _0x3f3e8b=this;loggerAction['info'](_0xa826('0x81'),_[_0xa826('0x82')](this[_0xa826('0x16')]));for(var _0x5a1362 in this[_0xa826('0x16')]){if(_0x3f3e8b[_0xa826('0x16')]['hasOwnProperty'](_0x5a1362)){_0x3f3e8b[_0xa826('0x83')](_0x5a1362);}}};Preview[_0xa826('0xf')][_0xa826('0x70')]=function(_0x1cd13d){var _0x334bd2=this;rpcDb[_0xa826('0x84')](_0x1cd13d['id'],ut[_0xa826('0x85')](this[_0xa826('0x17')]))[_0xa826('0x86')](function(_0x2287ea){if(!_[_0xa826('0x71')](_0x2287ea)){for(var _0x4a7ba6=0x0;_0x4a7ba6<_0x2287ea[_0xa826('0x87')];_0x4a7ba6+=0x1){if(ut[_0xa826('0x88')](_0x2287ea[_0x4a7ba6][_0xa826('0x89')])<_0x1cd13d[_0xa826('0x8a')]*0x3c){if(_0x2287ea[_0x4a7ba6][_0xa826('0x8b')]&&!_0x2287ea[_0x4a7ba6][_0xa826('0x8b')][_0xa826('0x8c')]){_0x334bd2[_0xa826('0x8d')](_0x2287ea[_0x4a7ba6]['id'])['then'](ut[_0xa826('0x8e')](_0xa826('0x8f')))[_0xa826('0x78')](ut['logger2'](_0xa826('0x8f')));}else{rpcDb[_0xa826('0x90')](_0x2287ea[_0x4a7ba6]['id']);}}else{var _0x2827cc=new Action(_0x2287ea[_0x4a7ba6],_0x1cd13d);_0x2827cc['starttime']=moment()['format'](_0xa826('0x91'));_0x1cd13d[_0xa826('0x92')]+=0x1;ut[_0xa826('0x93')](_0x2827cc,0x17,_0xa826('0x94'));if(_0x1cd13d['dialRecallInQueue']){rpcDb[_0xa826('0x95')](ut[_0xa826('0x96')](_0x2287ea[_0x4a7ba6]));rpcDb[_0xa826('0x97')](_0x2827cc,_0xa826('0x98'));}else{ut[_0xa826('0x93')](_0x2827cc,0x16,_0xa826('0x99'));rpcDb[_0xa826('0x97')](_0x2827cc,_0xa826('0x9a'));rpcDb[_0xa826('0x9b')](_0x2827cc,'[HistoryRecallClose]');}}}}})['catch'](ut['logger2']('[getContactRecallMe]'));};Preview[_0xa826('0xf')][_0xa826('0x6e')]=function(_0x8149d7){_0x8149d7[_0xa826('0x5f')]=!![];if(ut[_0xa826('0x9c')](_0x8149d7[_0xa826('0x29')])){_0x8149d7['message']=_0xa826('0x9d');}else if(!ut[_0xa826('0x9e')](_0x8149d7[_0xa826('0x32')])){_0x8149d7['message']=_0xa826('0x61');}else if(!this[_0xa826('0x9f')](_0x8149d7[_0xa826('0x53')])){if(!this[_0xa826('0x9f')](_0x8149d7[_0xa826('0xa0')])){_0x8149d7[_0xa826('0x4d')]=_0xa826('0xa1');}else{_0x8149d7[_0xa826('0x4d')]=_0xa826('0xa2');}}else{_0x8149d7[_0xa826('0x4d')]=_0xa826('0xa2');}emitCampaignPreview(_0x8149d7);};Preview[_0xa826('0xf')][_0xa826('0xa3')]=function(_0x35cc4e,_0x114603,_0x5a18b0){var _0x14f82f=this;var _0x4cc3ae=this[_0xa826('0x16')][_0x114603];var _0x52f377=this[_0xa826('0x13')][_0x4cc3ae['queue']];var _0xdaf863;if(_0x52f377){switch(_0x5a18b0){case'1':_0x52f377[_0xa826('0xa4')]+=0x1;_0x4cc3ae[_0xa826('0xa5')]+=0x1;_0x4cc3ae['countglobal']=ut['totalGlobal'](_0x4cc3ae);ut['logCustomer'](_0x4cc3ae,0x0,_0xa826('0xa6'));ami[_0xa826('0x24')](_0xa826('0xa7'),ut['buildObj'](_0x4cc3ae,_0xa826('0xa8')));rpcDb[_0xa826('0x97')](_0x4cc3ae,_0xa826('0xa9'));if(ut[_0xa826('0xaa')](_0x4cc3ae)>=_0x52f377['dialGlobalMaxRetry']){_0xdaf863=ut[_0xa826('0xab')](_0x4cc3ae,0xf,_0xa826('0xac'));rpcDb[_0xa826('0x9b')](_0xdaf863,_0xa826('0xad'));}else{if(_0x4cc3ae[_0xa826('0xa5')]>=_0x52f377['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x4cc3ae,_0xa826('0xad'));}else{rpcDb[_0xa826('0xae')](ut[_0xa826('0xaf')](_0x4cc3ae,_0xa826('0xa5'),_0x52f377[_0xa826('0xb0')]),_0x4cc3ae['unlockAgent'],_0x4cc3ae['activeContact']);}}delete this[_0xa826('0x16')][_0x35cc4e[_0xa826('0xb1')]];break;case _0xa826('0xb2'):var _0x3912af=moment()[_0xa826('0x57')](_0xa826('0x91'));_0x4cc3ae['responsetime']=_0x3912af;_0x4cc3ae[_0xa826('0xb3')]=_0x3912af;_0x4cc3ae['dialAnswer']=!![];_0x52f377[_0xa826('0x2a')]+=0x1;logger[_0xa826('0x5a')]('[syncHangup][talking][increment]',_0x4cc3ae[_0xa826('0xb4')],'\x20Queue',_0x52f377[_0xa826('0x26')],'pTalking:\x20',_0x52f377[_0xa826('0x2a')]);ami[_0xa826('0x24')](_0xa826('0xb5'),ut[_0xa826('0xb6')](_0x4cc3ae,_0xa826('0xb7'),this[_0xa826('0x13')][_0x4cc3ae['queue']]));if(_0x52f377['acw']){ami[_0xa826('0x24')]('custom:agentConnectPreview',ut[_0xa826('0xb8')](_0x4cc3ae));}break;case'16':ami[_0xa826('0x24')](_0xa826('0xb9'),ut['buildObj'](_0x4cc3ae,_0xa826('0xba'),this[_0xa826('0x13')][_0x4cc3ae[_0xa826('0x73')]]));emitVoiceQueueChannelRemove(ut[_0xa826('0xb6')](_0x4cc3ae,_0xa826('0xba')));_0x52f377['outboundAnswerCallsDay']+=0x1;_0x52f377[_0xa826('0x2e')]+=0x1;_0x52f377[_0xa826('0x28')]+=0x1;ut[_0xa826('0x7d')](_0x52f377,_0xa826('0xbb'));_0x4cc3ae[_0xa826('0xbc')]=ut[_0xa826('0xaa')](_0x4cc3ae);ut[_0xa826('0x93')](_0x4cc3ae,0x4,_0xa826('0xbd'));rpcDb[_0xa826('0x97')](_0x4cc3ae,_0xa826('0xbe'));rpcDb['createCustomerFinal'](_0x4cc3ae,_0xa826('0xbf'));rpcDb[_0xa826('0xc0')](_0x4cc3ae);_0x52f377['sumDuration']+=_0x4cc3ae['talktime'];_0x52f377[_0xa826('0x2b')]+=_0x4cc3ae[_0xa826('0xc1')];logger['info'](_0xa826('0xc2'),_0x4cc3ae[_0xa826('0xb4')],_0xa826('0xc3'),_0x52f377[_0xa826('0x26')],'pTalking:\x20',_0x52f377['pTalking']);delete this[_0xa826('0x16')][_0x35cc4e[_0xa826('0xb1')]];break;case'BUSY':_0x52f377[_0xa826('0x3b')]+=0x1;_0x4cc3ae[_0xa826('0xc4')]+=0x1;_0x4cc3ae[_0xa826('0xbc')]=ut[_0xa826('0xaa')](_0x4cc3ae);ut[_0xa826('0x93')](_0x4cc3ae,0x5,_0xa826('0xc5'));ami[_0xa826('0x24')](_0xa826('0xc6'),ut['buildObj'](_0x4cc3ae,_0xa826('0xc7')));rpcDb[_0xa826('0x97')](_0x4cc3ae,_0xa826('0xc8'));if(ut[_0xa826('0xaa')](_0x4cc3ae)>=_0x52f377['dialGlobalMaxRetry']){_0xdaf863=ut[_0xa826('0xab')](_0x4cc3ae,0xf,_0xa826('0xac'));rpcDb[_0xa826('0x9b')](_0xdaf863,_0xa826('0xc9'));}else{if(_0x4cc3ae[_0xa826('0xc4')]>=_0x52f377[_0xa826('0xca')]){rpcDb[_0xa826('0x9b')](_0x4cc3ae,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xa826('0xae')](ut[_0xa826('0xaf')](_0x4cc3ae,_0xa826('0xc4'),_0x52f377[_0xa826('0xcb')]),_0x4cc3ae[_0xa826('0xcc')],_0x4cc3ae[_0xa826('0xcd')]);}}break;case'NOANSWER':_0x52f377[_0xa826('0x40')]+=0x1;_0x4cc3ae[_0xa826('0xce')]+=0x1;_0x4cc3ae[_0xa826('0xbc')]=ut['totalGlobal'](_0x4cc3ae);ut[_0xa826('0x93')](_0x4cc3ae,0x3,_0xa826('0xcf'));ami[_0xa826('0x24')](_0xa826('0xd0'),ut['buildObj'](_0x4cc3ae,_0xa826('0xd1')));rpcDb[_0xa826('0x97')](_0x4cc3ae,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0xa826('0xaa')](_0x4cc3ae)>=_0x52f377['dialGlobalMaxRetry']){_0xdaf863=ut[_0xa826('0xab')](_0x4cc3ae,0xf,_0xa826('0xac'));rpcDb[_0xa826('0x9b')](_0xdaf863,_0xa826('0xd2'));}else{if(_0x4cc3ae[_0xa826('0xce')]>=_0x52f377[_0xa826('0xd3')]){rpcDb['createCustomerFinal'](_0x4cc3ae,_0xa826('0xd4'));}else{rpcDb[_0xa826('0xae')](ut[_0xa826('0xaf')](_0x4cc3ae,_0xa826('0xce'),_0x52f377['dialNoAnswerRetryFrequency']),_0x4cc3ae[_0xa826('0xcc')],_0x4cc3ae[_0xa826('0xcd')]);}}break;case _0xa826('0xd5'):_0x52f377[_0xa826('0x3c')]+=0x1;_0x4cc3ae[_0xa826('0xd6')]+=0x1;_0x4cc3ae[_0xa826('0xbc')]=ut[_0xa826('0xaa')](_0x4cc3ae);ut[_0xa826('0x93')](_0x4cc3ae,0x8,'Congestion');ami['emit'](_0xa826('0xd7'),ut[_0xa826('0xb6')](_0x4cc3ae,_0xa826('0xd8')));rpcDb[_0xa826('0x97')](_0x4cc3ae,_0xa826('0xd9'));if(ut['totalGlobal'](_0x4cc3ae)>=_0x52f377['dialGlobalMaxRetry']){_0xdaf863=ut[_0xa826('0xab')](_0x4cc3ae,0xf,'Global');rpcDb['createCustomerFinal'](_0xdaf863,_0xa826('0xda'));}else{if(_0x4cc3ae[_0xa826('0xd6')]>=_0x52f377[_0xa826('0xdb')]){rpcDb[_0xa826('0x9b')](_0x4cc3ae,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0xa826('0xaf')](_0x4cc3ae,_0xa826('0xd6'),_0x52f377[_0xa826('0xcb')]),_0x4cc3ae[_0xa826('0xcc')],_0x4cc3ae[_0xa826('0xcd')]);}}break;case _0xa826('0xdc'):_0x52f377['outboundRejectCallsDay']+=0x1;_0x4cc3ae[_0xa826('0xdd')]+=0x1;_0x4cc3ae[_0xa826('0xbc')]=ut[_0xa826('0xaa')](_0x4cc3ae);ut[_0xa826('0x93')](_0x4cc3ae,0x14,_0xa826('0xde'));ami['emit'](_0xa826('0xdf'),ut['buildObj'](_0x4cc3ae,_0xa826('0xe0')));rpcDb[_0xa826('0x97')](_0x4cc3ae,_0xa826('0xe1'));if(ut[_0xa826('0xaa')](_0x4cc3ae)>=_0x52f377[_0xa826('0xe2')]){_0xdaf863=ut[_0xa826('0xab')](_0x4cc3ae,0x14,_0xa826('0xde'));rpcDb[_0xa826('0x9b')](_0xdaf863,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x4cc3ae[_0xa826('0xdd')]>=_0x52f377[_0xa826('0xe3')]){rpcDb[_0xa826('0x9b')](_0x4cc3ae,_0xa826('0xe4'));}else{rpcDb[_0xa826('0xae')](ut[_0xa826('0xaf')](_0x4cc3ae,_0xa826('0xdd'),_0x52f377[_0xa826('0xe5')]),_0x4cc3ae[_0xa826('0xcc')],_0x4cc3ae[_0xa826('0xcd')]);}}break;case _0xa826('0xe6'):_0x52f377['outboundAbandonedCallsDay']+=0x1;_0x4cc3ae[_0xa826('0xe7')]+=0x1;_0x4cc3ae[_0xa826('0xbc')]=ut[_0xa826('0xaa')](_0x4cc3ae);ut[_0xa826('0x93')](_0x4cc3ae,0xb,_0xa826('0xe8'));rpcDb[_0xa826('0x97')](_0x4cc3ae,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0xa826('0xaa')](_0x4cc3ae)>=_0x52f377[_0xa826('0xe2')]){_0xdaf863=ut[_0xa826('0xab')](_0x4cc3ae,0xf,'Global');rpcDb[_0xa826('0x9b')](_0xdaf863,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x4cc3ae[_0xa826('0xe9')]>=_0x52f377[_0xa826('0xea')]){rpcDb['createCustomerFinal'](_0x4cc3ae,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xa826('0xae')](ut[_0xa826('0xaf')](_0x4cc3ae,'countabandonedretry',_0x52f377['dialAbandonedRetryFrequency']),_0x4cc3ae[_0xa826('0xcc')],_0x4cc3ae['activeContact']);}}break;case'18':_0x52f377[_0xa826('0x43')]+=0x1;_0x4cc3ae['countmachineretry']+=0x1;_0x4cc3ae['countglobal']=ut[_0xa826('0xaa')](_0x4cc3ae);ut['logCustomer'](_0x4cc3ae,0x12,_0x35cc4e[_0xa826('0xeb')]||_0x35cc4e['dialstatus']);ami[_0xa826('0x24')]('custom:amd',ut['buildObj'](_0x4cc3ae,_0xa826('0xec')));rpcDb[_0xa826('0x97')](_0x4cc3ae,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0xa826('0xaa')](_0x4cc3ae)>=_0x52f377['dialGlobalMaxRetry']){_0xdaf863=ut[_0xa826('0xab')](_0x4cc3ae,0xf,_0xa826('0xac'));rpcDb['createCustomerFinal'](_0xdaf863,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x4cc3ae,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0xa826('0x16')][_0x35cc4e['linkedid']];break;case'19':_0x52f377[_0xa826('0x43')]+=0x1;_0x4cc3ae[_0xa826('0xbc')]=ut[_0xa826('0xaa')](_0x4cc3ae);ut['logCustomer'](_0x4cc3ae,0x13,_0x35cc4e[_0xa826('0xeb')]||_0x35cc4e[_0xa826('0xed')]);ami[_0xa826('0x24')](_0xa826('0xee'),ut['buildObj'](_0x4cc3ae,_0xa826('0xec')));rpcDb['createCustomerHistory'](_0x4cc3ae,_0xa826('0xef'));if(ut[_0xa826('0xaa')](_0x4cc3ae)>=_0x52f377[_0xa826('0xe2')]){_0xdaf863=ut[_0xa826('0xab')](_0x4cc3ae,0xf,_0xa826('0xac'));rpcDb[_0xa826('0x9b')](_0xdaf863,_0xa826('0xef'));}else{rpcDb[_0xa826('0x9b')](_0x4cc3ae,_0xa826('0xef'));}delete this[_0xa826('0x16')][_0x35cc4e[_0xa826('0xb1')]];break;default:if(_0x4cc3ae[_0xa826('0x7c')]){ut[_0xa826('0x7d')](_0x52f377,_0xa826('0xf0'));ut['loggerError'](_0xa826('0xf1')+_0x52f377['name'],_0x35cc4e);}_0x52f377[_0xa826('0x43')]+=0x1;_0x4cc3ae[_0xa826('0xbc')]=ut[_0xa826('0xaa')](_0x4cc3ae);ut[_0xa826('0x93')](_0x4cc3ae,0xc,_0x35cc4e[_0xa826('0xeb')]||_0x35cc4e[_0xa826('0xed')]);rpcDb[_0xa826('0x97')](_0x4cc3ae,_0xa826('0xf2'));if(ut[_0xa826('0xaa')](_0x4cc3ae)>=_0x52f377[_0xa826('0xe2')]){_0xdaf863=ut[_0xa826('0xab')](_0x4cc3ae,0xf,_0xa826('0xac'));rpcDb['createCustomerFinal'](_0xdaf863,_0xa826('0xf3'));}else{rpcDb[_0xa826('0x9b')](_0x4cc3ae,_0xa826('0xf3'));}delete this['actions'][_0x35cc4e[_0xa826('0xb1')]];}if(!(_0x4cc3ae[_0xa826('0x7c')]&&_0x5a18b0==='16')){ut[_0xa826('0x7a')](_0x52f377,'[callProgressDetectingCustomer]');logger[_0xa826('0x5a')](_0xa826('0xf4'),_0x4cc3ae[_0xa826('0xb4')],_0xa826('0xc3'),_0x52f377[_0xa826('0x26')],_0xa826('0xf5'),_0x52f377[_0xa826('0x60')]);}if(_0x5a18b0!=='ANSWER'){delete this[_0xa826('0x16')][_0x35cc4e[_0xa826('0xb1')]];delete this[_0xa826('0x16')][_0x35cc4e[_0xa826('0xf6')]];}}};Preview[_0xa826('0xf')][_0xa826('0xf7')]=function(_0x3d10a6,_0x24660b,_0x2e8c5c){if(_[_0xa826('0xf8')](_0x24660b)&&'object'!==typeof _0x24660b){return;}if(_[_0xa826('0xf8')](_0x2e8c5c)&&_0xa826('0xf9')!==typeof _0x2e8c5c){return;}switch(_0x2e8c5c['reason']){case'0':ut[_0xa826('0xfa')](_0x3d10a6,0x0,_0xa826('0xa6'));rpcDb[_0xa826('0xfb')](_0x3d10a6,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xa826('0xfa')](_0x3d10a6,0x3,_0xa826('0xcf'));rpcDb[_0xa826('0xfb')](_0x3d10a6,_0xa826('0xfc'));break;case'5':ut[_0xa826('0xfa')](_0x3d10a6,0x5,_0xa826('0xc5'));rpcDb['createAgentHistory'](_0x3d10a6,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x3d10a6,0x8,_0xa826('0xfd'));rpcDb[_0xa826('0xfb')](_0x3d10a6,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0x3d10a6,0x16,_0xa826('0xfe'));rpcDb[_0xa826('0xfb')](_0x3d10a6,_0xa826('0xff'));break;default:ut[_0xa826('0xfa')](_0x3d10a6,0xc,_0x2e8c5c[_0xa826('0x100')]);rpcDb[_0xa826('0xfb')](_0x3d10a6,_0xa826('0x101'));}ut[_0xa826('0x7a')](_0x24660b,_0xa826('0x102'));logger['info'](_0xa826('0x103'),_0x3d10a6[_0xa826('0xb4')],_0xa826('0xc3'),_0x24660b[_0xa826('0x26')],_0xa826('0xf5'),_0x24660b['originated']);delete this['actions'][_0x3d10a6[_0xa826('0xb4')]];};Preview[_0xa826('0xf')]['checkInBlack']=function(_0x358845,_0x265609,_0x569194,_0x2105d4,_0x500ecc){var _0x4e55a3=this;return new BPromise(function(_0x5d207d,_0x485112){if(_[_0xa826('0x71')](_0x265609)||_[_0xa826('0x71')](_0x265609[_0xa826('0x104')])||_[_0xa826('0x71')](_0x265609[_0xa826('0x104')]['phone'])||_['isNil'](_0x265609[_0xa826('0x105')])){_0x485112(ut[_0xa826('0x4d')](_0xa826('0x106'),_0x2105d4,_0x500ecc));return;}var _0x4a3821=uuid['v4']();var _0x561ded=_0x4e55a3[_0xa826('0x13')][_0x265609[_0xa826('0x72')]['name']];var _0x48a02c=_0x569194?_0x4e55a3[_0xa826('0x17')][_0x569194]['id']:undefined;_0x4e55a3[_0xa826('0x16')][_0x4a3821]=new Action(_0x265609,_0x561ded,_0x4a3821,_0x569194,_0x48a02c);var _0x53e503=_0x4e55a3[_0xa826('0x16')][_0x4a3821];_0x53e503['unlockAgent']=_0x2105d4;_0x53e503[_0xa826('0xcd')]=_0x500ecc;_0x53e503[_0xa826('0x107')]=_0x569194;if(_[_0xa826('0x108')](_0x358845)){_0x4e55a3['execCall'](_0x53e503,_0x561ded,_0x265609,_0x569194)[_0xa826('0x86')](function(_0x56ee30){logger[_0xa826('0x5a')]('[Preview][execCall][success]',_0xa826('0x109')+_0x53e503[_0xa826('0x73')]+'\x20IdHopper:\x20'+_0x53e503['idContact'],JSON[_0xa826('0x5c')](_0x56ee30));ami['emit'](_0xa826('0x10a'),ut[_0xa826('0xb6')](_0x53e503,_0xa826('0x10b'),_0x4e55a3[_0xa826('0x13')][_0x53e503[_0xa826('0x73')]]));_0x5d207d(ut[_0xa826('0x4d')]('Calling'));})[_0xa826('0x78')](function(_0x5f3d6f){ut[_0xa826('0x62')]('[Preview][execCall][failure]',_0x5f3d6f);_0x485112(ut[_0xa826('0x4d')](_0xa826('0x10c'),_0x2105d4,_0x500ecc));});}else{_0x561ded[_0xa826('0x3a')]+=0x1;ut[_0xa826('0x10d')](_0x53e503);rpcDb[_0xa826('0x10e')](_0x53e503,_0xa826('0x10f'));delete _0x4e55a3[_0xa826('0x16')][_0x4a3821];_0x485112(ut[_0xa826('0x4d')](_0xa826('0x110'),_0x2105d4,_0x500ecc));}});};Preview[_0xa826('0xf')][_0xa826('0x9f')]=function(_0x456322){return!_[_0xa826('0x71')](_0x456322)&&!_[_0xa826('0x71')](_0x456322[_0xa826('0x26')])&&!_[_0xa826('0x71')](_0x456322[_0xa826('0x54')])&&_0x456322[_0xa826('0x54')]&&!_[_0xa826('0x71')](this[_0xa826('0x15')][util[_0xa826('0x57')]('SIP/%s',_0x456322[_0xa826('0x26')])])&&!_[_0xa826('0x71')](this[_0xa826('0x15')][util[_0xa826('0x57')](_0xa826('0x111'),_0x456322[_0xa826('0x26')])][_0xa826('0x76')])&&(this[_0xa826('0x15')][util['format'](_0xa826('0x111'),_0x456322[_0xa826('0x26')])][_0xa826('0x76')]===_0xa826('0x112')||this[_0xa826('0x15')][util['format']('SIP/%s',_0x456322['name'])][_0xa826('0x76')]===_0xa826('0x113'));};Preview[_0xa826('0xf')][_0xa826('0x8d')]=function(_0x48733d,_0x53bdb9){var _0x23fc60=this;return new BPromise(function(_0x13c381,_0x36076e){_0x23fc60['execRun'](_0x48733d,_0x53bdb9)[_0xa826('0x86')](function(_0x435071){_0x13c381(_['pick'](_0x435071,[_0xa826('0x4d')]));})[_0xa826('0x78')](function(_0x1fc9bf){if(_0x1fc9bf[_0xa826('0x114')]){rpcDb[_0xa826('0x115')](_0x48733d);}if(_0x1fc9bf[_0xa826('0x54')]){rpcDb[_0xa826('0x90')](_0x48733d);}_0x36076e(_[_0xa826('0x116')](_0x1fc9bf,[_0xa826('0x4d')]));});});};Preview[_0xa826('0xf')][_0xa826('0x117')]=function(_0x6f379d,_0x90f7b8){var _0x207160=this;return new BPromise(function(_0x3bed73,_0x4b24f3){var _0x54ec42,_0x27c948;rpcDb[_0xa826('0x118')](_0x6f379d)[_0xa826('0x86')](function(_0x573e58){if(!_[_0xa826('0x71')](_0x573e58[0x0])){_0x27c948=_0x573e58[0x0][_0xa826('0x119')]?![]:!![];_0x54ec42=_0x573e58[0x0]['recallme']?!![]:![];_0x54ec42=_0x90f7b8?!![]:_0x54ec42;}var _0x357d23=_0x207160['validateContact'](_0x573e58);if(_0x357d23[_0xa826('0x11a')]){rpcDb[_0xa826('0x11b')](_['pick'](_0x573e58[0x0],[_0xa826('0x105'),_0xa826('0x11c')]))[_0xa826('0x86')](function(_0x26418e){_0x207160[_0xa826('0x11d')](_0x26418e,_0x573e58[0x0],_0x90f7b8,_0x27c948,_0x54ec42)['then'](function(_0x5defe6){_0x3bed73(_0x5defe6);})[_0xa826('0x78')](function(_0x407c8d){_0x4b24f3(_0x407c8d);});})['catch'](function(_0x1892d6){ut[_0xa826('0x62')](_0xa826('0x11e'),_0x1892d6);_0x4b24f3(ut[_0xa826('0x4d')]('Call\x20unsuccessful',_0x27c948,_0x54ec42));});}else{_0x4b24f3(ut['message'](_0x357d23[_0xa826('0x4d')],_0x27c948,_0x54ec42));}})[_0xa826('0x78')](function(_0xb4c950){ut[_0xa826('0x62')](_0xa826('0x11f'),_0xb4c950);_0x4b24f3(ut[_0xa826('0x4d')](_0xa826('0x120'),![],!![]));});});};Preview[_0xa826('0xf')][_0xa826('0x121')]=function(_0x51a40b){if(_[_0xa826('0x71')](_0x51a40b)||_[_0xa826('0x108')](_0x51a40b)||!_[_0xa826('0x71')](_0x51a40b[0x0][_0xa826('0x8b')])&&_[_0xa826('0x71')](_0x51a40b[0x0][_0xa826('0x8b')]['name'])){ut[_0xa826('0x62')](_0xa826('0x122'),_0x51a40b);return{'isValid':![],'message':_0xa826('0x123')};}var _0xa79702=this[_0xa826('0x13')][_0x51a40b[0x0][_0xa826('0x72')]['name']];_0xa79702[_0xa826('0x4d')]=_0xa826('0xa2');if(_[_0xa826('0x71')](_0xa79702)){ut[_0xa826('0x62')]('[Preview][validateContact][Empty\x20Campaign]',_0xa79702);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0xa79702[_0xa826('0x53')])){ut[_0xa826('0x62')](_0xa826('0x124'),_0xa826('0x125')+_0xa79702['name']+_0xa826('0x126'));if(!this[_0xa826('0x9f')](_0xa79702['TrunkBackup'])){ut[_0xa826('0x62')](_0xa826('0x124'),_0xa79702[_0xa826('0x26')]+_0xa826('0x127'));return{'isValid':![],'message':_0xa826('0x128')};}}if(!ut[_0xa826('0x9e')](_0xa79702[_0xa826('0x32')])){ut[_0xa826('0x62')]('[Preview][validateContact][Campaign\x20Active]',_0xa79702[_0xa826('0x26')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xa826('0x125')+_0xa79702[_0xa826('0x26')]+_0xa826('0x129')};}return{'isValid':!![],'message':_0xa826('0x12a')};};Preview[_0xa826('0xf')][_0xa826('0x12b')]=function(_0x3160d6,_0x280eba,_0x33b6ca,_0x4a86c8){var _0x24f63b=this;return new BPromise(function(_0x445973,_0x2a38b2){var _0x389893=_0x3160d6['uniqueid'];var _0x504357=_0x24f63b['isTrunkReachable'](_0x280eba[_0xa826('0x53')])?util[_0xa826('0x57')](_0xa826('0x12c'),_0x280eba[_0xa826('0x53')][_0xa826('0x26')],_[_0xa826('0x71')](_0x280eba[_0xa826('0x37')])?'':_0x280eba[_0xa826('0x37')]['trim']()||'',_0x280eba[_0xa826('0x12d')]>0x0?_0x33b6ca['Contact'][_0xa826('0x12e')]['substring'](_0x280eba[_0xa826('0x12d')]):_0x33b6ca['Contact'][_0xa826('0x12e')]):util[_0xa826('0x57')]('SIP/%s/%s%s',_[_0xa826('0x71')](_0x280eba['TrunkBackup'])?_0x280eba[_0xa826('0x53')]['name']:_0x280eba[_0xa826('0xa0')][_0xa826('0x26')],_[_0xa826('0x71')](_0x280eba[_0xa826('0x37')])?'':_0x280eba[_0xa826('0x37')][_0xa826('0x12f')]()||'',_0x280eba['dialCutDigit']>0x0?_0x33b6ca[_0xa826('0x104')]['phone']['substring'](_0x280eba[_0xa826('0x12d')]):_0x33b6ca['Contact']['phone']);var _0x53eab7=_0x24f63b[_0xa826('0x9f')](_0x280eba[_0xa826('0x53')])?ut[_0xa826('0x130')](_0x280eba[_0xa826('0x53')][_0xa826('0x55')],_0x280eba['dialOriginateCallerIdName'],_0x280eba[_0xa826('0x131')]>0x0?ut[_0xa826('0x132')](_0x280eba['dialOriginateCallerIdNumber'],_0x280eba[_0xa826('0x131')]):_0x280eba[_0xa826('0x35')]):ut['getCallerId'](_[_0xa826('0x71')](_0x280eba[_0xa826('0xa0')])?_0x280eba[_0xa826('0x53')][_0xa826('0x55')]:_0x280eba['TrunkBackup'][_0xa826('0x55')],_0x280eba[_0xa826('0x34')],_0x280eba[_0xa826('0x131')]>0x0?ut['getCallerIdRandom'](_0x280eba[_0xa826('0x35')],_0x280eba[_0xa826('0x131')]):_0x280eba[_0xa826('0x35')]);if(_0x53eab7){_0x3160d6[_0xa826('0x133')]=ut[_0xa826('0x134')](_0x53eab7);_0x3160d6[_0xa826('0x135')]=ut[_0xa826('0x136')](_0x53eab7);}var _0x4f92cc=ut['addVariables'](_0x280eba,_0x33b6ca,_0x504357,_0x53eab7,_0x389893,_0x3160d6);_['merge'](_0x3160d6,ut[_0xa826('0x137')](_0x4f92cc));_0x3160d6[_0xa826('0x138')]=moment()['format'](_0xa826('0x91'));ami[_0xa826('0x139')](ut[_0xa826('0x13a')](_0x3160d6,_0x280eba,_0x4f92cc,_0x3160d6['activeContact'],_0x4a86c8))[_0xa826('0x86')](function(_0x2455c3){_0x280eba['originated']+=0x1;logger['info'](_0xa826('0x13b'),_0x389893,_0xa826('0xc3'),_0x280eba['name'],_0xa826('0xf5'),_0x280eba[_0xa826('0x60')]);_0x445973(_0x2455c3);})[_0xa826('0x78')](function(_0xe5a929){ut[_0xa826('0xfa')](_0x3160d6,0xe,_0xa826('0x13c'));rpcDb[_0xa826('0xfb')](_0x3160d6,'[originateFailure][logOriginateFailure]');_0x2a38b2(_0xe5a929);});});};Preview[_0xa826('0xf')][_0xa826('0x1e')]=function(_0x9aa0a4){if(this[_0xa826('0x16')][_0x9aa0a4[_0xa826('0xb1')]]){this[_0xa826('0x16')][_0x9aa0a4[_0xa826('0xb1')]]['channel']=_0x9aa0a4[_0xa826('0x77')];}};Preview[_0xa826('0xf')][_0xa826('0x19')]=function(_0x179f34){var _0x5d7e94=this;var _0x4bbc96=this[_0xa826('0x16')][_0x179f34[_0xa826('0x13d')]];if(_0x4bbc96){if(_0x4bbc96['lookAgent']&&this['agents'][_0x4bbc96[_0xa826('0x107')]]){ut[_0xa826('0x13e')](_0x4bbc96,this[_0xa826('0x17')][_0x4bbc96[_0xa826('0x107')]]['name'],this[_0xa826('0x17')][_0x4bbc96[_0xa826('0x107')]]['id']);}var _0x32ef84=_['clone'](_0x4bbc96);_0x32ef84[_0xa826('0x13f')]=moment()[_0xa826('0x57')](_0xa826('0x91'));var _0x581e5b=_0x5d7e94[_0xa826('0x13')][_0x4bbc96[_0xa826('0x73')]];if(ut[_0xa826('0x140')](_0x179f34[_0xa826('0x141')])){if(_0x4bbc96['unlockAgent']){rpcDb[_0xa826('0x115')](_0x4bbc96['idContact']);}if(_0x4bbc96[_0xa826('0xcd')]){rpcDb[_0xa826('0x90')](_0x4bbc96[_0xa826('0x142')]);}ami[_0xa826('0x24')](_0xa826('0x143'),ut[_0xa826('0xb6')](_0x4bbc96,_0xa826('0x144'),this[_0xa826('0x13')][_0x4bbc96[_0xa826('0x73')]]));this['callProgressDetectingAgent'](_0x32ef84,_0x581e5b,_0x179f34);}else{_0x4bbc96[_0xa826('0x138')]=moment()[_0xa826('0x57')](_0xa826('0x91'));ut[_0xa826('0xfa')](_0x32ef84,0x4,_0xa826('0xbd'));rpcDb[_0xa826('0xfb')](_0x32ef84,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xa826('0xf')][_0xa826('0x145')]=function(_0x31efdb){var _0xb248b9=this;var _0x3db329=this[_0xa826('0x16')][_0x31efdb[_0xa826('0xb1')]];var _0x31343a;if(_0x3db329){_0x31343a=this[_0xa826('0x13')][_0x3db329[_0xa826('0x73')]];logger[_0xa826('0x5a')](_0xa826('0x146'),_0x31efdb[_0xa826('0xb1')],'\x20Queue',_0x31343a[_0xa826('0x26')],'pTalking:\x20',_0x31343a[_0xa826('0x2a')]);}if(this[_0xa826('0x16')][_0x31efdb[_0xa826('0xb1')]]&&_0x31efdb['linkedid']!==_0x31efdb[_0xa826('0xb4')]){if(_0x31efdb[_0xa826('0x147')]==='16'&&this[_0xa826('0x16')][_0x31efdb[_0xa826('0xb1')]][_0xa826('0x7c')]){this[_0xa826('0xa3')](_0x31efdb,_0x31efdb['linkedid'],_0x31efdb[_0xa826('0x147')]);}else if(this[_0xa826('0x16')][_0x31efdb[_0xa826('0xb1')]][_0xa826('0x7c')]){logger[_0xa826('0x5a')]('[syncHangup][talking][cause]',_0x31efdb[_0xa826('0xb1')],_0x31efdb[_0xa826('0x147')],_0xa826('0xc3'),_0x31343a['name'],_0xa826('0x74'),_0x31343a[_0xa826('0x2a')]);this['callProgressDetectingCustomer'](_0x31efdb,_0x31efdb[_0xa826('0xb1')],_0x31efdb[_0xa826('0x147')]);}}else if(_0x3db329&&_[_0xa826('0x71')](_0x3db329[_0xa826('0x148')])&&_0x31343a[_0xa826('0x149')]&&_0x31efdb[_0xa826('0xb1')]===_0x31efdb[_0xa826('0xb4')]&&_[_0xa826('0x71')](_0x31efdb[_0xa826('0x100')])&&_0x31efdb[_0xa826('0x147')]==='16'&&_0x31efdb[_0xa826('0x14a')]==='6'&&_[_0xa826('0xf8')](_0x3db329[_0xa826('0x14b')])){if(_0x3db329[_0xa826('0xcc')]){rpcDb[_0xa826('0x115')](_0x3db329[_0xa826('0x142')]);}if(_0x3db329['activeContact']){rpcDb[_0xa826('0x90')](_0x3db329[_0xa826('0x142')]);}_0x31efdb['reason']='22';this['callProgressDetectingAgent'](_0x3db329,_0x31343a,_0x31efdb);}else if(_0x3db329&&_0x3db329[_0xa826('0x14b')]){if(_0x31efdb[_0xa826('0x147')]==='16'&&this['actions'][_0x31efdb[_0xa826('0xb1')]][_0xa826('0x7c')]){logger['info'](_0xa826('0x14c'),_0x31efdb[_0xa826('0xb1')],_0x31efdb[_0xa826('0x147')],_0xa826('0xc3'),_0x31343a[_0xa826('0x26')],_0xa826('0x74'),_0x31343a['pTalking']);this['callProgressDetectingCustomer'](_0x31efdb,_0x31efdb['linkedid'],_0x31efdb[_0xa826('0x147')]);}else if(this[_0xa826('0x16')][_0x31efdb[_0xa826('0xb1')]][_0xa826('0x7c')]){logger['info'](_0xa826('0x14d'),_0x31efdb[_0xa826('0xb1')],_0x31efdb['cause'],_0xa826('0xc3'),_0x31343a[_0xa826('0x26')],_0xa826('0x74'),_0x31343a[_0xa826('0x2a')]);this[_0xa826('0xa3')](_0x31efdb,_0x31efdb[_0xa826('0xb1')],_0x31efdb['cause']);}}};Preview[_0xa826('0xf')]['syncDialEnd']=function(_0x28a654){if(this[_0xa826('0x16')][_0x28a654[_0xa826('0xf6')]]&&_0x28a654[_0xa826('0xf6')]!==_0x28a654[_0xa826('0x14e')]){this[_0xa826('0xa3')](_0x28a654,_0x28a654[_0xa826('0xf6')],_0x28a654[_0xa826('0xed')]);}};Preview[_0xa826('0xf')][_0xa826('0x14f')]=function(_0x801363){if(this[_0xa826('0x16')][_0x801363[_0xa826('0xb1')]]&&_0x801363[_0xa826('0xb1')]!==_0x801363[_0xa826('0xb4')]&&!this[_0xa826('0x16')][_0x801363[_0xa826('0xb1')]]['dialAnswer']){if(_0x801363[_0xa826('0x147')]==='1'){this[_0xa826('0xa3')](_0x801363,_0x801363[_0xa826('0xb1')],_0x801363[_0xa826('0x147')]);}}};Preview['prototype'][_0xa826('0x150')]=function(_0x527cc4,_0x3c1fb7,_0x2865f1){if(this[_0xa826('0x16')][_0x527cc4]){if(_[_0xa826('0x71')](this[_0xa826('0x16')][_0x527cc4][_0xa826('0x151')])){this[_0xa826('0x16')][_0x527cc4]['variables']={};}this[_0xa826('0x16')][_0x527cc4]['variables'][_0x3c1fb7]=_0x2865f1;}};Preview['prototype'][_0xa826('0x20')]=function(_0xeb829b){try{if(!_[_0xa826('0x71')](_0xeb829b)){if(ut[_0xa826('0x152')](_['keys'](_0xeb829b['variable'])[0x0])){this['addVariable'](_0xeb829b[_0xa826('0xb4')],_['keys'](_0xeb829b[_0xa826('0x153')])[0x0],_0xeb829b[_0xa826('0x154')]);}}}catch(_0x5e34a6){logger[_0xa826('0x155')](_0xa826('0x156'),util[_0xa826('0x157')](_0x5e34a6,{'showHidden':![],'depth':null}));}};Preview[_0xa826('0xf')]['syncAttendedTransfer']=function(_0x11ae2e){if(_0x11ae2e){if(this['actions'][_0x11ae2e[_0xa826('0x158')]]){this[_0xa826('0x16')][_0x11ae2e[_0xa826('0x158')]][_0xa826('0x14b')]=!![];}}};Preview[_0xa826('0xf')][_0xa826('0x159')]=function(_0x2ef89a){if(_0x2ef89a){if(this['actions'][_0x2ef89a['transfererlinkedid']]){this[_0xa826('0x16')][_0x2ef89a[_0xa826('0x15a')]][_0xa826('0x14b')]=!![];}}};module[_0xa826('0x15b')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 0901997..555c51e 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 _0xc5b6=['type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue'];(function(_0xbcefe2,_0x29badc){var _0x50b056=function(_0x401564){while(--_0x401564){_0xbcefe2['push'](_0xbcefe2['shift']());}};_0x50b056(++_0x29badc);}(_0xc5b6,0x1e9));var _0x6c5b=function(_0x42072e,_0x2cdf2d){_0x42072e=_0x42072e-0x0;var _0x43babe=_0xc5b6[_0x42072e];return _0x43babe;};'use strict';var util=require('util');var BPromise=require(_0x6c5b('0x0'));var logger=require(_0x6c5b('0x1'))(_0x6c5b('0x2'));var _=require(_0x6c5b('0x3'));var cmHopper=require(_0x6c5b('0x4'));var cmHopperFinal=require(_0x6c5b('0x5'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x6c5b('0x6'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x6c5b('0x7'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x15b490){return function(_0x5d5062){logger[_0x6c5b('0x8')](_0x15b490,util['inspect'](_0x5d5062,{'showHidden':![],'depth':null}));};}function create(_0x2b92f4){return BPromise[_0x6c5b('0x9')]()[_0x6c5b('0xa')](cmHopperHistory[_0x6c5b('0xb')](_0x2b92f4))[_0x6c5b('0xc')](loggerCatch(_0x6c5b('0xd')));}function createAgent(_0x3fee8e){return BPromise[_0x6c5b('0x9')]()[_0x6c5b('0xa')](agentReportPreview[_0x6c5b('0xb')](_0x3fee8e))['catch'](loggerCatch(_0x6c5b('0xd')));}function moveContact(_0x5a03b3){return BPromise[_0x6c5b('0x9')]()['then'](cmHopper[_0x6c5b('0xe')](_0x5a03b3,!![]))[_0x6c5b('0xc')](loggerCatch(_0x6c5b('0xf')));}exports[_0x6c5b('0x10')]=function(_0x40a4a3){return BPromise['resolve']()['then'](cmHopperBlack[_0x6c5b('0x10')](_0x40a4a3))[_0x6c5b('0xc')](loggerCatch(_0x6c5b('0x11')));};exports[_0x6c5b('0x12')]=function(_0x131bee){return BPromise[_0x6c5b('0x9')]()[_0x6c5b('0xa')](cmHopper[_0x6c5b('0x12')](_0x131bee))[_0x6c5b('0xc')](loggerCatch(_0x6c5b('0x13')));};exports['createHistory']=function(_0x1fd46c,_0xc89ae1){create(_0x1fd46c)[_0x6c5b('0xc')](loggerCatch(_0xc89ae1));moveContact(_0x1fd46c)['catch'](loggerCatch(_0xc89ae1));};exports[_0x6c5b('0x14')]=function(_0x51885e,_0x365164){createAgent(_0x51885e)[_0x6c5b('0xc')](loggerCatch(_0x365164));};exports[_0x6c5b('0x15')]=function(_0x31e11b,_0x2aa753){create(_0x31e11b)['catch'](loggerCatch(_0x2aa753));};exports[_0x6c5b('0x16')]=function(_0x345d7d,_0x1159c5){moveContact(_0x345d7d)[_0x6c5b('0xc')](loggerCatch(_0x1159c5));};exports[_0x6c5b('0x17')]=function(_0x133094,_0x1cde2f,_0x1b371e){if(_0x1cde2f){_0x133094[_0x6c5b('0x18')]=null;}if(_0x1b371e){_0x133094[_0x6c5b('0x19')]=![];}return BPromise[_0x6c5b('0x9')]()[_0x6c5b('0xa')](cmHopper['rescheduleContact'](_0x133094))[_0x6c5b('0xc')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x38dc66){return BPromise[_0x6c5b('0x9')]()[_0x6c5b('0xa')](cmHopper[_0x6c5b('0x1a')](_0x38dc66))[_0x6c5b('0xc')](loggerCatch(_0x6c5b('0x1b')));};exports[_0x6c5b('0x1c')]=function(_0x59048e){return BPromise[_0x6c5b('0x9')]()[_0x6c5b('0xa')](cmHopper['unlockContact']({'UserId':null},_0x59048e,0x1))['catch'](loggerCatch(_0x6c5b('0x1d')));};exports[_0x6c5b('0x1e')]=function(_0x5278a7){return BPromise[_0x6c5b('0x9')]()[_0x6c5b('0xa')](cmHopper[_0x6c5b('0x1c')]({'active':![]},_0x5278a7,0x1))[_0x6c5b('0xc')](loggerCatch(_0x6c5b('0x1f')));};exports[_0x6c5b('0x20')]=function(_0x5d4fa8){var _0x550652={};_0x550652[_0x6c5b('0x21')]=_0x5d4fa8[_0x6c5b('0x21')];_0x550652[_0x6c5b('0x22')]=_0x5d4fa8[_0x6c5b('0x22')];_0x550652[_0x6c5b('0x23')]=_0x5d4fa8['calleridnum'];_0x550652['calleridname']=_0x5d4fa8[_0x6c5b('0x24')];_0x550652['queue']=_0x5d4fa8[_0x6c5b('0x25')];_0x550652[_0x6c5b('0x26')]=_0x5d4fa8['answertime'];_0x550652[_0x6c5b('0x27')]=_0x5d4fa8[_0x6c5b('0x28')];_0x550652[_0x6c5b('0x29')]=0x1;_0x550652[_0x6c5b('0x2a')]=_0x5d4fa8[_0x6c5b('0x2b')];_0x550652[_0x6c5b('0x2c')]=_0x5d4fa8[_0x6c5b('0x2d')];_0x550652[_0x6c5b('0x2e')]='from-sip';_0x550652[_0x6c5b('0x2f')]=_0x6c5b('0x30');_0x550652[_0x6c5b('0x31')]=0x0;_0x550652['assigned']=0x1;_0x550652[_0x6c5b('0x32')]=_0x5d4fa8[_0x6c5b('0x2d')];_0x550652[_0x6c5b('0x33')]='COMPLETED';return BPromise[_0x6c5b('0x9')]()[_0x6c5b('0xa')](voiceQueueReport[_0x6c5b('0x34')](_0x550652))['catch'](loggerCatch(_0x6c5b('0x35')));};exports[_0x6c5b('0x36')]=function(_0xa30f9b,_0x3b064e){return BPromise[_0x6c5b('0x9')]()[_0x6c5b('0xa')](cmHopper['getContactRecallMe'](_0xa30f9b,_0x3b064e))[_0x6c5b('0xc')](loggerCatch(_0x6c5b('0x37')));};exports[_0x6c5b('0x38')]=function(_0x2e1554){return BPromise[_0x6c5b('0x9')]()[_0x6c5b('0xa')](cmHopper[_0x6c5b('0x17')](_0x2e1554,!![],!![]))[_0x6c5b('0xc')](loggerCatch(_0x6c5b('0x39')));}; \ No newline at end of file +var _0xfb00=['createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','COMPLETED','create','getContactRecallMe','util','bluebird','../../../config/logger','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','catch','[createHistory]\x20','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20'];(function(_0x1e86e2,_0x4263cd){var _0x4a7cea=function(_0x50c1b0){while(--_0x50c1b0){_0x1e86e2['push'](_0x1e86e2['shift']());}};_0x4a7cea(++_0x4263cd);}(_0xfb00,0xd1));var _0x0fb0=function(_0x400c67,_0x1a61e0){_0x400c67=_0x400c67-0x0;var _0xd69340=_0xfb00[_0x400c67];return _0xd69340;};'use strict';var util=require(_0x0fb0('0x0'));var BPromise=require(_0x0fb0('0x1'));var logger=require(_0x0fb0('0x2'))('preview');var _=require(_0x0fb0('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x0fb0('0x4'));var cmHopperHistory=require(_0x0fb0('0x5'));var cmHopperBlack=require(_0x0fb0('0x6'));var voiceQueueRt=require(_0x0fb0('0x7'));var agentReportPreview=require(_0x0fb0('0x8'));var voiceQueueReport=require(_0x0fb0('0x9'));function loggerCatch(_0x15618b){return function(_0x305eb){logger[_0x0fb0('0xa')](_0x15618b,util[_0x0fb0('0xb')](_0x305eb,{'showHidden':![],'depth':null}));};}function create(_0x49bd23){return BPromise[_0x0fb0('0xc')]()[_0x0fb0('0xd')](cmHopperHistory['createHistory'](_0x49bd23))[_0x0fb0('0xe')](loggerCatch(_0x0fb0('0xf')));}function createAgent(_0x1b3d70){return BPromise['resolve']()[_0x0fb0('0xd')](agentReportPreview[_0x0fb0('0x10')](_0x1b3d70))[_0x0fb0('0xe')](loggerCatch(_0x0fb0('0xf')));}function moveContact(_0x47b2c6){return BPromise[_0x0fb0('0xc')]()[_0x0fb0('0xd')](cmHopper[_0x0fb0('0x11')](_0x47b2c6,!![]))[_0x0fb0('0xe')](loggerCatch(_0x0fb0('0x12')));}exports[_0x0fb0('0x13')]=function(_0x404b88){return BPromise[_0x0fb0('0xc')]()['then'](cmHopperBlack[_0x0fb0('0x13')](_0x404b88))[_0x0fb0('0xe')](loggerCatch(_0x0fb0('0x14')));};exports[_0x0fb0('0x15')]=function(_0x2d0633){return BPromise[_0x0fb0('0xc')]()['then'](cmHopper['getContactPreview'](_0x2d0633))[_0x0fb0('0xe')](loggerCatch(_0x0fb0('0x16')));};exports[_0x0fb0('0x10')]=function(_0x1ede06,_0x2d3daf){create(_0x1ede06)[_0x0fb0('0xe')](loggerCatch(_0x2d3daf));moveContact(_0x1ede06)[_0x0fb0('0xe')](loggerCatch(_0x2d3daf));};exports[_0x0fb0('0x17')]=function(_0x161ecb,_0x4af9bd){createAgent(_0x161ecb)[_0x0fb0('0xe')](loggerCatch(_0x4af9bd));};exports[_0x0fb0('0x18')]=function(_0x37df27,_0x3a1772){create(_0x37df27)[_0x0fb0('0xe')](loggerCatch(_0x3a1772));};exports[_0x0fb0('0x19')]=function(_0x50826b,_0x3d89e3){moveContact(_0x50826b)[_0x0fb0('0xe')](loggerCatch(_0x3d89e3));};exports[_0x0fb0('0x1a')]=function(_0x572700,_0x4b4a25,_0x5b4d57){if(_0x4b4a25){_0x572700[_0x0fb0('0x1b')]=null;}if(_0x5b4d57){_0x572700[_0x0fb0('0x1c')]=![];}return BPromise['resolve']()[_0x0fb0('0xd')](cmHopper[_0x0fb0('0x1a')](_0x572700))[_0x0fb0('0xe')](loggerCatch(_0x0fb0('0x1d')));};exports[_0x0fb0('0x1e')]=function(_0x1fc397){return BPromise[_0x0fb0('0xc')]()[_0x0fb0('0xd')](cmHopper['countReScheduled'](_0x1fc397))[_0x0fb0('0xe')](loggerCatch(_0x0fb0('0x1f')));};exports[_0x0fb0('0x20')]=function(_0x3f99fb){return BPromise[_0x0fb0('0xc')]()[_0x0fb0('0xd')](cmHopper['unlockContact']({'UserId':null},_0x3f99fb,0x1))['catch'](loggerCatch(_0x0fb0('0x21')));};exports[_0x0fb0('0x22')]=function(_0x50d031){return BPromise['resolve']()[_0x0fb0('0xd')](cmHopper[_0x0fb0('0x20')]({'active':![]},_0x50d031,0x1))[_0x0fb0('0xe')](loggerCatch(_0x0fb0('0x23')));};exports[_0x0fb0('0x24')]=function(_0x430ed0){var _0x41cdd6={};_0x41cdd6['type']=_0x430ed0[_0x0fb0('0x25')];_0x41cdd6[_0x0fb0('0x26')]=_0x430ed0[_0x0fb0('0x26')];_0x41cdd6[_0x0fb0('0x27')]=_0x430ed0[_0x0fb0('0x27')];_0x41cdd6[_0x0fb0('0x28')]=_0x430ed0[_0x0fb0('0x28')];_0x41cdd6[_0x0fb0('0x29')]=_0x430ed0[_0x0fb0('0x29')];_0x41cdd6[_0x0fb0('0x2a')]=_0x430ed0[_0x0fb0('0x2b')];_0x41cdd6[_0x0fb0('0x2c')]=_0x430ed0['answertime'];_0x41cdd6[_0x0fb0('0x2d')]=0x1;_0x41cdd6['queuecallercompleteAt']=_0x430ed0[_0x0fb0('0x2e')];_0x41cdd6[_0x0fb0('0x2f')]=_0x430ed0[_0x0fb0('0x30')];_0x41cdd6[_0x0fb0('0x31')]=_0x0fb0('0x32');_0x41cdd6[_0x0fb0('0x33')]=_0x0fb0('0x34');_0x41cdd6[_0x0fb0('0x35')]=0x0;_0x41cdd6['assigned']=0x1;_0x41cdd6[_0x0fb0('0x36')]=_0x430ed0[_0x0fb0('0x30')];_0x41cdd6['queuecallerexitreason']=_0x0fb0('0x37');return BPromise[_0x0fb0('0xc')]()['then'](voiceQueueReport[_0x0fb0('0x38')](_0x41cdd6))[_0x0fb0('0xe')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x0fb0('0x39')]=function(_0x29a5e5,_0x4e431b){return BPromise[_0x0fb0('0xc')]()[_0x0fb0('0xd')](cmHopper[_0x0fb0('0x39')](_0x29a5e5,_0x4e431b))[_0x0fb0('0xe')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x1bef32){return BPromise[_0x0fb0('0xc')]()[_0x0fb0('0xd')](cmHopper[_0x0fb0('0x1a')](_0x1bef32,!![],!![]))[_0x0fb0('0xe')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 0cb97d9..01f5f08 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 _0xbc46=['originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','variablesAction','RECALL','BOOKED','originate','channelAgent','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countnoanswerretry','Global','scheduledAt','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','motionChannel','voice','mandatoryDisposition','buildAcw','interface','not_inuse','status','reachable','push','diff','createBody','CampaignId','idContact','campaigntype','dialAnswer','active','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','logger','info','loggerError','message','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isNil','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','Contact','hasOwnProperty','updatedAt','XMD-','toLowerVariables','toLower','updateOriginated'];(function(_0x47b53b,_0x4ec4a3){var _0x103b47=function(_0x4d5e98){while(--_0x4d5e98){_0x47b53b['push'](_0x47b53b['shift']());}};_0x103b47(++_0x4ec4a3);}(_0xbc46,0x17f));var _0x6bc4=function(_0x4717ef,_0x33d525){_0x4717ef=_0x4717ef-0x0;var _0xd5cfc0=_0xbc46[_0x4717ef];return _0xd5cfc0;};'use strict';var util=require(_0x6bc4('0x0'));var _=require(_0x6bc4('0x1'));var moment=require(_0x6bc4('0x2'));var logger=require(_0x6bc4('0x3'))('preview');var ipAgi=process[_0x6bc4('0x4')][_0x6bc4('0x5')]||_0x6bc4('0x6');function getSeconds(_0x43e2bf,_0xdb2feb){var _0xb6745c=moment(_0x43e2bf)[_0x6bc4('0x7')](0x0);var _0x422c88=moment(_0xdb2feb)['milliseconds'](0x0);return _0xb6745c['diff'](_0x422c88,_0x6bc4('0x8'));}exports[_0x6bc4('0x9')]=function(_0x2b2ce9){return function(_0xc46f98){logger[_0x6bc4('0xa')](_0x2b2ce9,util[_0x6bc4('0xb')](_0xc46f98,{'showHidden':![],'depth':null}));};};exports[_0x6bc4('0xc')]=function(_0x5b7c3b,_0x57bf38){logger[_0x6bc4('0xd')](_0x5b7c3b,util[_0x6bc4('0xb')](_0x57bf38,{'showHidden':![],'depth':null}));};exports[_0x6bc4('0xe')]=function(_0x1cd599,_0x4366df){logger[_0x6bc4('0xa')](_0x1cd599,util[_0x6bc4('0xb')](_0x4366df,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x2d67dc){return function(_0x5311ba){logger[_0x6bc4('0xd')](_0x2d67dc,util['inspect'](_0x5311ba,{'showHidden':![],'depth':null}));};};exports[_0x6bc4('0xf')]=function(_0x313da6,_0x1dc639,_0x17f71a){return{'message':_0x313da6,'unlock':_0x1dc639,'active':_0x17f71a};};exports['getCallerId']=function(_0x4bdf34,_0x3bf23c,_0x30a648){if(!_[_0x6bc4('0x10')](_0x30a648)&&_0x6bc4('0x11')===typeof _0x30a648&&!_[_0x6bc4('0x12')](_0x30a648)){if(!_[_0x6bc4('0x10')](_0x3bf23c)&&_0x6bc4('0x11')===typeof _0x3bf23c&&!_[_0x6bc4('0x12')](_0x3bf23c)){return util['format'](_0x6bc4('0x13'),_0x3bf23c,_0x30a648);}return util[_0x6bc4('0x14')]('\x22%s\x22\x20<%s>',_0x30a648,_0x30a648);}if(!_[_0x6bc4('0x10')](_0x4bdf34)&&_0x6bc4('0x11')===typeof _0x4bdf34&&!_[_0x6bc4('0x12')](_0x4bdf34)){return _0x4bdf34;}return _0x6bc4('0x15');};exports['isActive']=function(_0x1bd322){if(_[_0x6bc4('0x16')](_0x1bd322)){return![];}return _0x1bd322;};exports['addVariables']=function(_0x566085,_0x4c56f3,_0x2f16ec,_0x1a8bac,_0x4b2986,_0x460e54){var _0x2e2e97={'XMD-QUEUE':_0x4c56f3[_0x6bc4('0x17')]?_0x4c56f3[_0x6bc4('0x17')][_0x6bc4('0x18')]:'','XMD-CALLERID':_0x1a8bac,'XMD-CALLERID-PREVIEW':_0x460e54?util[_0x6bc4('0x14')](_0x6bc4('0x13'),_0x460e54[_0x6bc4('0x19')],_0x460e54[_0x6bc4('0x1a')]):_0x1a8bac,'XMD-DIALID':_0x4b2986,'XMD-CONTACTID':_0x4c56f3[_0x6bc4('0x1b')],'XMD-CDRTYPE':_0x6bc4('0x1c'),'CALLERID(all)':_0x1a8bac,'XMD-VOICEQUEUEID':_0x4c56f3[_0x6bc4('0x1d')],'XMD-DIALCHANNEL':_0x2f16ec,'XMD-DIALTIMEOUT':_0x566085[_0x6bc4('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x6bc4('0x14')](_0x6bc4('0x1f'),_0x566085[_0x6bc4('0x20')]?'g':'',_['isEmpty'](_0x566085[_0x6bc4('0x21')])?'':_0x6bc4('0x22')),'XMD-DIALURL':_0x566085['dialPreviewUrl']||'','XMD-AGI':_0x566085[_0x6bc4('0x23')]?util['format'](_0x6bc4('0x24'),ipAgi,_0x566085[_0x6bc4('0x23')]):_0x6bc4('0x25'),'XMD-AGIAFTER':_0x566085[_0x6bc4('0x20')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x566085[_0x6bc4('0x20')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x460e54?_0x460e54[_0x6bc4('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x460e54?_0x460e54[_0x6bc4('0x27')]:'','XMD-DESTINATION':_0x6bc4('0x28'),'SIPADDHEADER':_0x6bc4('0x29')};if(!_['isEmpty'](_0x566085[_0x6bc4('0x21')])){_0x2e2e97[util[_0x6bc4('0x14')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x566085[_0x6bc4('0x21')];_0x2e2e97[util[_0x6bc4('0x14')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x4b2986;}if(_0x4c56f3&&_0x4c56f3[_0x6bc4('0x2a')]){for(var _0x48c652 in _0x4c56f3[_0x6bc4('0x2a')]){if(_0x4c56f3[_0x6bc4('0x2a')][_0x6bc4('0x2b')](_0x48c652)){if(!_[_0x6bc4('0x16')](_0x4c56f3[_0x6bc4('0x2a')][_0x48c652])&&_0x48c652!=='id'&&_0x48c652!=='tags'&&_0x48c652!=='createdAt'&&_0x48c652!==_0x6bc4('0x2c')){_0x2e2e97[util['format']('%s%s',_0x6bc4('0x2d'),_['toUpper'](_0x48c652))]=_0x4c56f3[_0x6bc4('0x2a')][_0x48c652];}}}}return _0x2e2e97;};exports[_0x6bc4('0x2e')]=function(_0x323771){var _0x555fbd={};for(var _0x18941f in _0x323771){if(_0x323771[_0x6bc4('0x2b')](_0x18941f)){_0x555fbd[util['format']('%s',_[_0x6bc4('0x2f')](_0x18941f))]=_0x323771[_0x18941f];}}return{'variables':_0x555fbd};};exports[_0x6bc4('0x30')]=function(_0x208c8e,_0x30d0ae){if(!_[_0x6bc4('0x16')](_0x208c8e)){if(_0x208c8e[_0x6bc4('0x2b')](_0x6bc4('0x31'))){if(_0x208c8e[_0x6bc4('0x31')]>0x0){_0x208c8e[_0x6bc4('0x31')]-=0x1;}else{logger[_0x6bc4('0xa')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x30d0ae);}}}else{logger[_0x6bc4('0xa')](_0x6bc4('0x32'),_0x30d0ae);}};exports[_0x6bc4('0x33')]=function(_0x273db7){var _0xe11ac=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x273db7[_0x6bc4('0x34')]=0xd;_0x273db7[_0x6bc4('0x35')]=_0x6bc4('0x36');_0x273db7[_0x6bc4('0x37')]=_0xe11ac;_0x273db7[_0x6bc4('0x38')]=_0xe11ac;_0x273db7[_0x6bc4('0x39')]=_0xe11ac;};exports['logAgent']=function(_0x3481e8,_0x8fd21,_0x23dd4c){var _0xb04785=moment()['format'](_0x6bc4('0x3a'));_0x3481e8['state']=_0x8fd21;_0x3481e8[_0x6bc4('0x35')]=_0x23dd4c;_0x3481e8['responsetime']=_0xb04785;_0x3481e8[_0x6bc4('0x3b')]=getSeconds(_0x3481e8[_0x6bc4('0x38')],_0x3481e8[_0x6bc4('0x37')]);};exports[_0x6bc4('0x3c')]=function(_0x49d72e,_0xcf4f2,_0x5a553e){_0x49d72e[_0x6bc4('0x3d')]=_0xcf4f2;_0x49d72e[_0x6bc4('0x3e')]=_0x5a553e;};exports[_0x6bc4('0x3f')]=function(_0x119944,_0x5b8073,_0x5e6692){var _0x236306=moment()['format'](_0x6bc4('0x3a'));_0x119944[_0x6bc4('0x34')]=_0x5b8073;_0x119944[_0x6bc4('0x35')]=_0x5e6692;_0x119944[_0x6bc4('0x38')]=_0x119944[_0x6bc4('0x38')]?_0x119944[_0x6bc4('0x38')]:_0x236306;_0x119944[_0x6bc4('0x39')]=_0x119944[_0x6bc4('0x39')]?_0x119944['endtime']:_0x236306;_0x119944[_0x6bc4('0x3b')]=getSeconds(_0x119944[_0x6bc4('0x38')]||0x0,_0x119944[_0x6bc4('0x37')]||0x0);_0x119944[_0x6bc4('0x40')]=_0x119944[_0x6bc4('0x41')]?getSeconds(_0x119944['endtime'],_0x119944[_0x6bc4('0x41')]):0x0;};exports[_0x6bc4('0x42')]=function(_0x5d27f4){return _0x5d27f4==='Failure';};exports[_0x6bc4('0x43')]=function(_0x26335d,_0xcc976e,_0x46a22f,_0x308ec3,_0x515520){var _0x301b9a=_0x308ec3?_0x6bc4('0x44'):_0x26335d[_0x6bc4('0x19')];_0x301b9a=_0x515520?_0x6bc4('0x45'):_0x301b9a;return{'actionid':_0x26335d['uniqueid'],'action':_0x6bc4('0x46'),'channel':_0x26335d[_0x6bc4('0x47')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x301b9a,_0x26335d[_0x6bc4('0x1a')]),'Exten':_0x6bc4('0x28'),'Context':_0x6bc4('0x48'),'Priority':'1','variable':_0x46a22f,'timeout':(_0xcc976e[_0x6bc4('0x49')]||0x1e)*0x3e8,'async':!![],'channelid':_0x26335d[_0x6bc4('0x4a')]};};exports[_0x6bc4('0x4b')]=function(_0x4eac0a){return _0x4eac0a[_0x6bc4('0x4c')]+_0x4eac0a['countcongestionretry']+_0x4eac0a[_0x6bc4('0x4d')]+_0x4eac0a['countagentrejectretry']+_0x4eac0a['countnosuchnumberretry'];};exports['cloneAction']=function(_0x3fcbba){var _0x532934=_['clone'](_0x3fcbba);_0x532934[_0x6bc4('0x34')]=0xf;_0x532934['statedesc']=_0x6bc4('0x4e');return _0x532934;};exports[_0x6bc4('0x4f')]=function(_0x4a4a35,_0x3a5dcd,_0x211673){var _0x1c8df6={};_0x1c8df6[_0x3a5dcd]=_0x4a4a35[_0x3a5dcd];_0x1c8df6['active']=![];_0x1c8df6[_0x6bc4('0x50')]=moment()[_0x6bc4('0x51')](_0x211673,'minutes')[_0x6bc4('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x1c8df6[_0x6bc4('0x1b')]=_0x4a4a35[_0x6bc4('0x1b')];_0x1c8df6[_0x6bc4('0x52')]=_0x4a4a35[_0x6bc4('0x52')];_0x1c8df6[_0x6bc4('0x1d')]=_0x4a4a35['VoiceQueueId']||undefined;return _0x1c8df6;};exports[_0x6bc4('0x53')]=function(_0x2c609b,_0x5a7020){if(!_['isNil'](_0x2c609b)){if(_0x2c609b[_0x6bc4('0x54')]>0x0){_0x2c609b[_0x6bc4('0x54')]-=0x1;}else{logger['error'](_0x5a7020,_0x6bc4('0x55'));}}else{logger['error'](_0x5a7020,_0x6bc4('0x56'));}};exports[_0x6bc4('0x57')]=function(_0x1ab227){if(_0x1ab227<=0x0){return!![];}return![];};exports[_0x6bc4('0x58')]=function(_0x2e146e,_0x365364,_0x2bec7a){_0x2e146e[_0x6bc4('0x59')]=_0x365364;_0x2e146e[_0x6bc4('0x18')]=_0x2e146e[_0x6bc4('0x5a')];_0x2e146e['interface']=_0x2e146e[_0x6bc4('0x47')];_0x2e146e[_0x6bc4('0x5b')]=_0x6bc4('0x5c');if(_0x2bec7a){_0x2e146e[_0x6bc4('0x5d')]=_0x2bec7a[_0x6bc4('0x5d')];}return _0x2e146e;};exports[_0x6bc4('0x5e')]=function(_0x124d2e){var _0x4d7eac={};_0x4d7eac[_0x6bc4('0x5a')]=_0x124d2e[_0x6bc4('0x5a')];_0x4d7eac[_0x6bc4('0x5f')]=_0x124d2e[_0x6bc4('0x47')];_0x4d7eac[_0x6bc4('0x4a')]=_0x124d2e[_0x6bc4('0x4a')];return _0x4d7eac;};exports['agentReadyId']=function(_0x3dc348){var _0x4d48c4=[];for(var _0x53ebed in _0x3dc348){if(_0x3dc348[_0x6bc4('0x2b')](_0x53ebed)){if(!_[_0x6bc4('0x16')](_0x3dc348[_0x53ebed])&&_0x3dc348[_0x53ebed]['state']===_0x6bc4('0x60')&&_0x3dc348[_0x53ebed][_0x6bc4('0x61')]===_0x6bc4('0x62')){_0x4d48c4[_0x6bc4('0x63')](_0x3dc348[_0x53ebed]['id']);}}}return _0x4d48c4;};exports['getDiff']=function(_0xda0de3){var _0x3b7ecc=moment()['milliseconds'](0x0);var _0x62e8f5=moment(_0xda0de3)[_0x6bc4('0x7')](0x0);return _0x3b7ecc[_0x6bc4('0x64')](_0x62e8f5,_0x6bc4('0x8'));};exports[_0x6bc4('0x65')]=function(_0x1b7a98){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1b7a98[_0x6bc4('0x1b')],'ListId':_0x1b7a98['ListId'],'VoiceQueueId':_0x1b7a98['VoiceQueueId']||undefined,'CampaignId':_0x1b7a98[_0x6bc4('0x66')]||undefined};};exports['filterKey']=function(_0x15c399){if(_0x15c399===_0x6bc4('0x4a')||_0x15c399===_0x6bc4('0x67')||_0x15c399===_0x6bc4('0x5a')||_0x15c399==='type'||_0x15c399===_0x6bc4('0x68')||_0x15c399===_0x6bc4('0x69')||_0x15c399==='membername'||_0x15c399===_0x6bc4('0x47')||_0x15c399===_0x6bc4('0x19')||_0x15c399===_0x6bc4('0x6a')||_0x15c399===_0x6bc4('0x1a')||_0x15c399===_0x6bc4('0x50')||_0x15c399===_0x6bc4('0x4c')||_0x15c399===_0x6bc4('0x6b')||_0x15c399===_0x6bc4('0x4d')||_0x15c399===_0x6bc4('0x6c')||_0x15c399===_0x6bc4('0x6d')||_0x15c399===_0x6bc4('0x6e')||_0x15c399===_0x6bc4('0x6f')||_0x15c399===_0x6bc4('0x70')||_0x15c399===_0x6bc4('0x1b')||_0x15c399==='ListId'||_0x15c399==='UserId'||_0x15c399===_0x6bc4('0x1d')||_0x15c399===_0x6bc4('0x71')||_0x15c399===_0x6bc4('0x72')||_0x15c399===_0x6bc4('0x73')||_0x15c399===_0x6bc4('0x74')||_0x15c399==='xmd-listid'||_0x15c399===_0x6bc4('0x75')||_0x15c399===_0x6bc4('0x76')||_0x15c399===_0x6bc4('0x77')||_0x15c399===_0x6bc4('0x78')||_0x15c399===_0x6bc4('0x79')||_0x15c399===_0x6bc4('0x7a')||_0x15c399===_0x6bc4('0x7b')||_0x15c399==='xmd-callerid'||_0x15c399===_0x6bc4('0x7c')||_0x15c399===_0x6bc4('0x7d')||_0x15c399===_0x6bc4('0x7e')||_0x15c399===_0x6bc4('0x7f')||_0x15c399===_0x6bc4('0x80')||_0x15c399===_0x6bc4('0x81')||_0x15c399===_0x6bc4('0x82')||_0x15c399==='rtpaudioqoslossbridged'||_0x15c399===_0x6bc4('0x83')||_0x15c399===_0x6bc4('0x84')||_0x15c399===_0x6bc4('0x7e')||_0x15c399===_0x6bc4('0x7f')||_0x15c399===_0x6bc4('0x80')||_0x15c399==='rtpaudioqosjitterbridged'||_0x15c399===_0x6bc4('0x82')||_0x15c399===_0x6bc4('0x85')||_0x15c399===_0x6bc4('0x83')||_0x15c399===_0x6bc4('0x84')||_0x15c399===_0x6bc4('0x86')||_0x15c399===_0x6bc4('0x87')||_0x15c399===_0x6bc4('0x34')||_0x15c399==='statedesc'){return![];}return!![];};exports[_0x6bc4('0x88')]=function(_0x4d0229,_0x3f4960){var _0x716a69,_0x3e1e0c,_0x1a4eb9;if(_0x3f4960<=0x0){_0x3f4960=0x1;}_0x716a69=new RegExp(_0x6bc4('0x89')+_0x3f4960+'}$');_0x3e1e0c=Math['pow'](0xa,_0x3f4960-0x1);_0x1a4eb9=Math[_0x6bc4('0x8a')](0xa,_0x3f4960)-0x1;return util[_0x6bc4('0x14')]('%s',_[_0x6bc4('0x8b')](_0x4d0229,_0x716a69,_[_0x6bc4('0x8c')](_0x3e1e0c,_0x1a4eb9)));};exports[_0x6bc4('0x8d')]=function(_0x29f15b){var _0xa82d92=_0x29f15b[_0x6bc4('0x8e')](/"(.*?)"/);return _0xa82d92?_0xa82d92[0x1]:_0x29f15b;};exports[_0x6bc4('0x8f')]=function(_0x184a03){var _0x34df60=_0x184a03[_0x6bc4('0x8e')](/<(.*?)>/);return _0x34df60?_0x34df60[0x1]:_0x184a03;}; \ No newline at end of file +var _0x3f20=['extractCalleridNumber','util','moment','../../../../config/logger','preview','env','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','logger','info','inspect','loggerError','logger2','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','addVariables','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','dialPreviewUrl','dialQueueProject','dialQueueProject2','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','Contact','isNil','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','starttime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','responsetime','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','variablesAction','calleridname','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','motionChannel','voice','mandatoryDisposition','buildAcw','interface','agentReadyId','not_inuse','status','push','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','match'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x3f20,0x93));var _0x03f2=function(_0x3450af,_0x56beae){_0x3450af=_0x3450af-0x0;var _0x489a90=_0x3f20[_0x3450af];return _0x489a90;};'use strict';var util=require(_0x03f2('0x0'));var _=require('lodash');var moment=require(_0x03f2('0x1'));var logger=require(_0x03f2('0x2'))(_0x03f2('0x3'));var ipAgi=process[_0x03f2('0x4')]['XCALLY_IP_AGI']||_0x03f2('0x5');function getSeconds(_0xa97f1b,_0x138e17){var _0x4afea3=moment(_0xa97f1b)[_0x03f2('0x6')](0x0);var _0x2e0525=moment(_0x138e17)[_0x03f2('0x6')](0x0);return _0x4afea3[_0x03f2('0x7')](_0x2e0525,_0x03f2('0x8'));}exports[_0x03f2('0x9')]=function(_0x545bf6){return function(_0x46eed9){logger[_0x03f2('0xa')](_0x545bf6,util['inspect'](_0x46eed9,{'showHidden':![],'depth':null}));};};exports[_0x03f2('0xb')]=function(_0xf1d800,_0x827a80){logger[_0x03f2('0xc')](_0xf1d800,util[_0x03f2('0xd')](_0x827a80,{'showHidden':![],'depth':null}));};exports[_0x03f2('0xe')]=function(_0x46584b,_0x930e55){logger['error'](_0x46584b,util[_0x03f2('0xd')](_0x930e55,{'showHidden':![],'depth':null}));};exports[_0x03f2('0xf')]=function(_0x565d0c){return function(_0x18f2b6){logger[_0x03f2('0xc')](_0x565d0c,util[_0x03f2('0xd')](_0x18f2b6,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x11565c,_0x453794,_0x4dca64){return{'message':_0x11565c,'unlock':_0x453794,'active':_0x4dca64};};exports['getCallerId']=function(_0x5c7fbe,_0x294805,_0x2ec118){if(!_['isUndefined'](_0x2ec118)&&_0x03f2('0x10')===typeof _0x2ec118&&!_[_0x03f2('0x11')](_0x2ec118)){if(!_[_0x03f2('0x12')](_0x294805)&&_0x03f2('0x10')===typeof _0x294805&&!_[_0x03f2('0x11')](_0x294805)){return util[_0x03f2('0x13')](_0x03f2('0x14'),_0x294805,_0x2ec118);}return util['format'](_0x03f2('0x14'),_0x2ec118,_0x2ec118);}if(!_['isUndefined'](_0x5c7fbe)&&_0x03f2('0x10')===typeof _0x5c7fbe&&!_[_0x03f2('0x11')](_0x5c7fbe)){return _0x5c7fbe;}return _0x03f2('0x15');};exports['isActive']=function(_0x18edf9){if(_['isNil'](_0x18edf9)){return![];}return _0x18edf9;};exports[_0x03f2('0x16')]=function(_0x45e513,_0x398b34,_0xac607b,_0x8807b5,_0xc6fcbe,_0x3099f1){var _0x305c98={'XMD-QUEUE':_0x398b34['Queue']?_0x398b34['Queue'][_0x03f2('0x17')]:'','XMD-CALLERID':_0x8807b5,'XMD-CALLERID-PREVIEW':_0x3099f1?util['format'](_0x03f2('0x14'),_0x3099f1['calleridname'],_0x3099f1[_0x03f2('0x18')]):_0x8807b5,'XMD-DIALID':_0xc6fcbe,'XMD-CONTACTID':_0x398b34[_0x03f2('0x19')],'XMD-CDRTYPE':_0x03f2('0x1a'),'CALLERID(all)':_0x8807b5,'XMD-VOICEQUEUEID':_0x398b34[_0x03f2('0x1b')],'XMD-DIALCHANNEL':_0xac607b,'XMD-DIALTIMEOUT':_0x45e513[_0x03f2('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x03f2('0x13')](_0x03f2('0x1d'),_0x45e513['dialQueueProject2']?'g':'',_[_0x03f2('0x11')](_0x45e513[_0x03f2('0x1e')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x45e513[_0x03f2('0x1f')]||'','XMD-AGI':_0x45e513[_0x03f2('0x20')]?util[_0x03f2('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x45e513[_0x03f2('0x20')]):'NONE','XMD-AGIAFTER':_0x45e513[_0x03f2('0x21')]?util[_0x03f2('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x45e513[_0x03f2('0x21')]):_0x03f2('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x3099f1?_0x3099f1[_0x03f2('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x3099f1?_0x3099f1[_0x03f2('0x24')]:'','XMD-DESTINATION':_0x03f2('0x25'),'SIPADDHEADER':_0x03f2('0x26')};if(!_[_0x03f2('0x11')](_0x45e513['monitor_format'])){_0x305c98[util[_0x03f2('0x13')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x45e513[_0x03f2('0x1e')];_0x305c98[util[_0x03f2('0x13')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0xc6fcbe;}if(_0x398b34&&_0x398b34[_0x03f2('0x27')]){for(var _0x42f021 in _0x398b34[_0x03f2('0x27')]){if(_0x398b34[_0x03f2('0x27')]['hasOwnProperty'](_0x42f021)){if(!_[_0x03f2('0x28')](_0x398b34[_0x03f2('0x27')][_0x42f021])&&_0x42f021!=='id'&&_0x42f021!=='tags'&&_0x42f021!==_0x03f2('0x29')&&_0x42f021!==_0x03f2('0x2a')){_0x305c98[util[_0x03f2('0x13')](_0x03f2('0x2b'),_0x03f2('0x2c'),_[_0x03f2('0x2d')](_0x42f021))]=_0x398b34[_0x03f2('0x27')][_0x42f021];}}}}return _0x305c98;};exports[_0x03f2('0x2e')]=function(_0x4891bc){var _0x5b9335={};for(var _0x5db388 in _0x4891bc){if(_0x4891bc[_0x03f2('0x2f')](_0x5db388)){_0x5b9335[util[_0x03f2('0x13')]('%s',_[_0x03f2('0x30')](_0x5db388))]=_0x4891bc[_0x5db388];}}return{'variables':_0x5b9335};};exports[_0x03f2('0x31')]=function(_0x6f7a36,_0x2020b9){if(!_[_0x03f2('0x28')](_0x6f7a36)){if(_0x6f7a36[_0x03f2('0x2f')](_0x03f2('0x32'))){if(_0x6f7a36['originated']>0x0){_0x6f7a36[_0x03f2('0x32')]-=0x1;}else{logger[_0x03f2('0xa')](_0x03f2('0x33'),_0x2020b9);}}}else{logger['error'](_0x03f2('0x34'),_0x2020b9);}};exports[_0x03f2('0x35')]=function(_0x37d549){var _0x469fb8=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x37d549[_0x03f2('0x36')]=0xd;_0x37d549[_0x03f2('0x37')]=_0x03f2('0x38');_0x37d549[_0x03f2('0x39')]=_0x469fb8;_0x37d549['responsetime']=_0x469fb8;_0x37d549[_0x03f2('0x3a')]=_0x469fb8;};exports[_0x03f2('0x3b')]=function(_0x391701,_0x4d7a91,_0x403d05){var _0x34a6f9=moment()['format'](_0x03f2('0x3c'));_0x391701[_0x03f2('0x36')]=_0x4d7a91;_0x391701['statedesc']=_0x403d05;_0x391701[_0x03f2('0x3d')]=_0x34a6f9;_0x391701[_0x03f2('0x3e')]=getSeconds(_0x391701[_0x03f2('0x3d')],_0x391701[_0x03f2('0x39')]);};exports[_0x03f2('0x3f')]=function(_0x498077,_0x34890e,_0x2718aa){_0x498077[_0x03f2('0x40')]=_0x34890e;_0x498077[_0x03f2('0x41')]=_0x2718aa;};exports[_0x03f2('0x42')]=function(_0x1bb552,_0x2e1525,_0x1a1ba4){var _0x4700ef=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1bb552['state']=_0x2e1525;_0x1bb552[_0x03f2('0x37')]=_0x1a1ba4;_0x1bb552['responsetime']=_0x1bb552['responsetime']?_0x1bb552[_0x03f2('0x3d')]:_0x4700ef;_0x1bb552[_0x03f2('0x3a')]=_0x1bb552[_0x03f2('0x3a')]?_0x1bb552[_0x03f2('0x3a')]:_0x4700ef;_0x1bb552[_0x03f2('0x3e')]=getSeconds(_0x1bb552[_0x03f2('0x3d')]||0x0,_0x1bb552[_0x03f2('0x39')]||0x0);_0x1bb552[_0x03f2('0x43')]=_0x1bb552[_0x03f2('0x44')]?getSeconds(_0x1bb552['endtime'],_0x1bb552['answertime']):0x0;};exports[_0x03f2('0x45')]=function(_0x37fe9b){return _0x37fe9b==='Failure';};exports[_0x03f2('0x46')]=function(_0x8dca2b,_0x5452e4,_0x422be7,_0x575fb9,_0xc5f28f){var _0x14ebf7=_0x575fb9?'RECALL':_0x8dca2b[_0x03f2('0x47')];_0x14ebf7=_0xc5f28f?_0x03f2('0x48'):_0x14ebf7;return{'actionid':_0x8dca2b[_0x03f2('0x49')],'action':_0x03f2('0x4a'),'channel':_0x8dca2b[_0x03f2('0x4b')],'callerid':util[_0x03f2('0x13')]('\x22%s\x22\x20<%s>',_0x14ebf7,_0x8dca2b[_0x03f2('0x18')]),'Exten':_0x03f2('0x25'),'Context':_0x03f2('0x4c'),'Priority':'1','variable':_0x422be7,'timeout':(_0x5452e4[_0x03f2('0x4d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x8dca2b[_0x03f2('0x49')]};};exports[_0x03f2('0x4e')]=function(_0x3961a3){return _0x3961a3[_0x03f2('0x4f')]+_0x3961a3[_0x03f2('0x50')]+_0x3961a3[_0x03f2('0x51')]+_0x3961a3[_0x03f2('0x52')]+_0x3961a3[_0x03f2('0x53')];};exports['cloneAction']=function(_0x58a5a0){var _0x1af0aa=_[_0x03f2('0x54')](_0x58a5a0);_0x1af0aa[_0x03f2('0x36')]=0xf;_0x1af0aa[_0x03f2('0x37')]=_0x03f2('0x55');return _0x1af0aa;};exports[_0x03f2('0x56')]=function(_0x472952,_0x3ea553,_0x5f518b){var _0x23ae03={};_0x23ae03[_0x3ea553]=_0x472952[_0x3ea553];_0x23ae03[_0x03f2('0x57')]=![];_0x23ae03[_0x03f2('0x58')]=moment()[_0x03f2('0x59')](_0x5f518b,_0x03f2('0x5a'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x23ae03[_0x03f2('0x19')]=_0x472952['ContactId'];_0x23ae03['ListId']=_0x472952[_0x03f2('0x5b')];_0x23ae03['VoiceQueueId']=_0x472952['VoiceQueueId']||undefined;return _0x23ae03;};exports[_0x03f2('0x5c')]=function(_0x8304db,_0xcbfb74){if(!_[_0x03f2('0x28')](_0x8304db)){if(_0x8304db[_0x03f2('0x5d')]>0x0){_0x8304db[_0x03f2('0x5d')]-=0x1;}else{logger['error'](_0xcbfb74,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x03f2('0xa')](_0xcbfb74,_0x03f2('0x5e'));}};exports[_0x03f2('0x5f')]=function(_0x43fd32){if(_0x43fd32<=0x0){return!![];}return![];};exports[_0x03f2('0x60')]=function(_0x5919d8,_0x284801,_0x218794){_0x5919d8[_0x03f2('0x61')]=_0x284801;_0x5919d8[_0x03f2('0x17')]=_0x5919d8[_0x03f2('0x62')];_0x5919d8['interface']=_0x5919d8['channelAgent'];_0x5919d8[_0x03f2('0x63')]=_0x03f2('0x64');if(_0x218794){_0x5919d8[_0x03f2('0x65')]=_0x218794[_0x03f2('0x65')];}return _0x5919d8;};exports[_0x03f2('0x66')]=function(_0x4cbd82){var _0x19017e={};_0x19017e[_0x03f2('0x62')]=_0x4cbd82[_0x03f2('0x62')];_0x19017e[_0x03f2('0x67')]=_0x4cbd82[_0x03f2('0x4b')];_0x19017e[_0x03f2('0x49')]=_0x4cbd82[_0x03f2('0x49')];return _0x19017e;};exports[_0x03f2('0x68')]=function(_0x1ca4aa){var _0x4910c2=[];for(var _0x4cf4a4 in _0x1ca4aa){if(_0x1ca4aa['hasOwnProperty'](_0x4cf4a4)){if(!_[_0x03f2('0x28')](_0x1ca4aa[_0x4cf4a4])&&_0x1ca4aa[_0x4cf4a4][_0x03f2('0x36')]===_0x03f2('0x69')&&_0x1ca4aa[_0x4cf4a4][_0x03f2('0x6a')]==='reachable'){_0x4910c2[_0x03f2('0x6b')](_0x1ca4aa[_0x4cf4a4]['id']);}}}return _0x4910c2;};exports[_0x03f2('0x6c')]=function(_0xac4544){var _0x171c2d=moment()[_0x03f2('0x6')](0x0);var _0x13c2fc=moment(_0xac4544)[_0x03f2('0x6')](0x0);return _0x171c2d['diff'](_0x13c2fc,_0x03f2('0x8'));};exports[_0x03f2('0x6d')]=function(_0x118de0){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x118de0[_0x03f2('0x19')],'ListId':_0x118de0[_0x03f2('0x5b')],'VoiceQueueId':_0x118de0[_0x03f2('0x1b')]||undefined,'CampaignId':_0x118de0[_0x03f2('0x6e')]||undefined};};exports[_0x03f2('0x6f')]=function(_0x1d15c5){if(_0x1d15c5==='uniqueid'||_0x1d15c5===_0x03f2('0x70')||_0x1d15c5==='queue'||_0x1d15c5===_0x03f2('0x71')||_0x1d15c5===_0x03f2('0x72')||_0x1d15c5===_0x03f2('0x73')||_0x1d15c5===_0x03f2('0x40')||_0x1d15c5===_0x03f2('0x4b')||_0x1d15c5===_0x03f2('0x47')||_0x1d15c5===_0x03f2('0x57')||_0x1d15c5===_0x03f2('0x18')||_0x1d15c5===_0x03f2('0x58')||_0x1d15c5===_0x03f2('0x4f')||_0x1d15c5===_0x03f2('0x50')||_0x1d15c5===_0x03f2('0x51')||_0x1d15c5===_0x03f2('0x74')||_0x1d15c5==='callback'||_0x1d15c5===_0x03f2('0x75')||_0x1d15c5===_0x03f2('0x76')||_0x1d15c5===_0x03f2('0x77')||_0x1d15c5===_0x03f2('0x19')||_0x1d15c5==='ListId'||_0x1d15c5===_0x03f2('0x41')||_0x1d15c5===_0x03f2('0x1b')||_0x1d15c5==='sipcallid'||_0x1d15c5===_0x03f2('0x78')||_0x1d15c5===_0x03f2('0x79')||_0x1d15c5===_0x03f2('0x7a')||_0x1d15c5==='xmd-listid'||_0x1d15c5===_0x03f2('0x7b')||_0x1d15c5===_0x03f2('0x7c')||_0x1d15c5==='xmd-dialoptions'||_0x1d15c5==='xmd-dialid'||_0x1d15c5==='xmd-dialchannel'||_0x1d15c5===_0x03f2('0x7d')||_0x1d15c5===_0x03f2('0x7e')||_0x1d15c5===_0x03f2('0x7f')||_0x1d15c5===_0x03f2('0x80')||_0x1d15c5==='xmd-agi'||_0x1d15c5===_0x03f2('0x81')||_0x1d15c5===_0x03f2('0x82')||_0x1d15c5===_0x03f2('0x83')||_0x1d15c5===_0x03f2('0x84')||_0x1d15c5==='rtpaudioqosloss'||_0x1d15c5===_0x03f2('0x85')||_0x1d15c5==='rtpaudioqosrtt'||_0x1d15c5==='rtpaudioqosrttbridged'||_0x1d15c5===_0x03f2('0x81')||_0x1d15c5==='rtpaudioqosbridged'||_0x1d15c5===_0x03f2('0x83')||_0x1d15c5===_0x03f2('0x84')||_0x1d15c5===_0x03f2('0x86')||_0x1d15c5===_0x03f2('0x85')||_0x1d15c5===_0x03f2('0x87')||_0x1d15c5===_0x03f2('0x88')||_0x1d15c5===_0x03f2('0x89')||_0x1d15c5===_0x03f2('0x8a')||_0x1d15c5===_0x03f2('0x36')||_0x1d15c5===_0x03f2('0x37')){return![];}return!![];};exports[_0x03f2('0x8b')]=function(_0x3f5b3a,_0x16498f){var _0x5c2f4f,_0x21f4cc,_0x4e31e9;if(_0x16498f<=0x0){_0x16498f=0x1;}_0x5c2f4f=new RegExp('\x5cw{0,'+_0x16498f+'}$');_0x21f4cc=Math[_0x03f2('0x8c')](0xa,_0x16498f-0x1);_0x4e31e9=Math[_0x03f2('0x8c')](0xa,_0x16498f)-0x1;return util[_0x03f2('0x13')]('%s',_[_0x03f2('0x8d')](_0x3f5b3a,_0x5c2f4f,_[_0x03f2('0x8e')](_0x21f4cc,_0x4e31e9)));};exports[_0x03f2('0x8f')]=function(_0x2b5017){var _0xd1c182=_0x2b5017[_0x03f2('0x90')](/"(.*?)"/);return _0xd1c182?_0xd1c182[0x1]:_0x2b5017;};exports[_0x03f2('0x91')]=function(_0x219ba5){var _0x84d6e3=_0x219ba5[_0x03f2('0x90')](/<(.*?)>/);return _0x84d6e3?_0x84d6e3[0x1]:_0x219ba5;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 481b03c..a44e396 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 _0xff69=['queueadd','string','reload'];(function(_0x367257,_0x5e0004){var _0x4acfd4=function(_0x227f90){while(--_0x227f90){_0x367257['push'](_0x367257['shift']());}};_0x4acfd4(++_0x5e0004);}(_0xff69,0x1b9));var _0x9ff6=function(_0x37756b,_0x24db76){_0x37756b=_0x37756b-0x0;var _0x46efec=_0xff69[_0x37756b];return _0x46efec;};'use strict';exports[_0x9ff6('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x9ff6('0x1'),'required':!![]},'membername':{'type':_0x9ff6('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':_0x9ff6('0x1'),'required':!![]},'interface':{'type':_0x9ff6('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x9ff6('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x9ff6('0x1'),'required':![]}};exports[_0x9ff6('0x2')]={'module':{'type':_0x9ff6('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x9ff6('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x9ff6('0x1'),'required':!![]},'filename':{'type':_0x9ff6('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x9ff6('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x9ff6('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x9ff6('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x9ff6('0x1')}}; \ No newline at end of file +var _0x1b71=['string','number','boolean','queueremove','queuepause','reload','voicechannel','voicequeuechannelredirect','queueadd'];(function(_0x5d2c6a,_0x196724){var _0x4420af=function(_0x44dc0a){while(--_0x44dc0a){_0x5d2c6a['push'](_0x5d2c6a['shift']());}};_0x4420af(++_0x196724);}(_0x1b71,0x86));var _0x11b7=function(_0x251a19,_0xa8a10f){_0x251a19=_0x251a19-0x0;var _0x4edc3e=_0x1b71[_0x251a19];return _0x4edc3e;};'use strict';exports[_0x11b7('0x0')]={'queue':{'type':_0x11b7('0x1'),'required':!![]},'interface':{'type':_0x11b7('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x11b7('0x2'),'required':![]},'paused':{'type':_0x11b7('0x3'),'required':![]}};exports[_0x11b7('0x4')]={'queue':{'type':_0x11b7('0x1'),'required':!![]},'interface':{'type':_0x11b7('0x1'),'required':!![]}};exports[_0x11b7('0x5')]={'interface':{'type':_0x11b7('0x1'),'required':!![]},'paused':{'type':_0x11b7('0x3')},'reason':{'type':_0x11b7('0x1'),'required':![]}};exports[_0x11b7('0x6')]={'module':{'type':_0x11b7('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':'string','required':!![]}};exports[_0x11b7('0x7')]={'uniqueid':{'type':_0x11b7('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x11b7('0x1')},'mixmonitorid':{'type':_0x11b7('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x11b7('0x1'),'required':!![]}};exports[_0x11b7('0x8')]={'uniqueid':{'type':_0x11b7('0x1'),'required':!![]},'exten':{'type':_0x11b7('0x1'),'required':!![]},'context':{'type':_0x11b7('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 90c9ba3..02f4751 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 _0x6c3c=['trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','format','name','hasOwnProperty','isNil','interface','SIP/%s','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','initAgents','agents','isUndefined','mergeFromDatabase','initTelephones','length','initTrunks','initVoiceQueues','initTriggers','initZendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initFaxAccounts','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','telephones'];(function(_0x40a77f,_0x1d5f8d){var _0x415aa1=function(_0x1e45bc){while(--_0x1e45bc){_0x40a77f['push'](_0x40a77f['shift']());}};_0x415aa1(++_0x1d5f8d);}(_0x6c3c,0x128));var _0xc6c3=function(_0x594e61,_0x4e9cc4){_0x594e61=_0x594e61-0x0;var _0xc8477f=_0x6c3c[_0x594e61];return _0xc8477f;};'use strict';var BPromise=require('bluebird');var util=require(_0xc6c3('0x0'));var _=require(_0xc6c3('0x1'));var moment=require(_0xc6c3('0x2'));var Agent=require(_0xc6c3('0x3'));var Telephone=require(_0xc6c3('0x4'));var Trunk=require(_0xc6c3('0x5'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require('../model/trigger');var Template=require(_0xc6c3('0x6'));var Campaign=require(_0xc6c3('0x7'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xc6c3('0x8'));var SalesforceAccount=require(_0xc6c3('0x9'));var FreshdeskAccount=require(_0xc6c3('0xa'));var SugarcrmAccount=require(_0xc6c3('0xb'));var ZohoAccount=require(_0xc6c3('0xc'));var DeskAccount=require(_0xc6c3('0xd'));var VtigerAccount=require(_0xc6c3('0xe'));var ServicenowAccount=require(_0xc6c3('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0xc6c3('0x10'));var FaxAccount=require(_0xc6c3('0x11'));var Realtime=function(){this['agents']={};this[_0xc6c3('0x12')]={};this[_0xc6c3('0x13')]={};this[_0xc6c3('0x14')]={};this[_0xc6c3('0x15')]={};this[_0xc6c3('0x16')]={};this[_0xc6c3('0x17')]={};this[_0xc6c3('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xc6c3('0x19')]={};this['channels']={};this[_0xc6c3('0x1a')]={};this[_0xc6c3('0x1b')]={};this[_0xc6c3('0x1c')]={};this['settings']={};this[_0xc6c3('0x1d')]={};this[_0xc6c3('0x1e')]={};this[_0xc6c3('0x1f')]={};this[_0xc6c3('0x20')]={};this['zohoAccounts']={};this[_0xc6c3('0x21')]={};this['vtigerAccounts']={};this[_0xc6c3('0x22')]={};this[_0xc6c3('0x23')]={};this['freshsalesAccounts']={};this[_0xc6c3('0x24')]={};};function freeIsNotKey(_0x225bba,_0x50a58e,_0x10e316){var _0x1e2037=_[_0xc6c3('0x25')](_0x225bba,function(_0x3ed2c7,_0x2e993d){return _0x3ed2c7[_0x10e316];});for(var _0x48057f in _0x50a58e){if(_0x50a58e['hasOwnProperty'](_0x48057f)){if(!_0x1e2037[_0x48057f]){delete _0x50a58e[_0x48057f];}}}}function freeIsNotKeySip(_0x3bd2b3,_0x136d9a){var _0xdffdb6=_[_0xc6c3('0x25')](_0x3bd2b3,function(_0x352044,_0x337044){return util[_0xc6c3('0x26')]('SIP/%s',_0x352044[_0xc6c3('0x27')]);});for(var _0x190f2e in _0x136d9a){if(_0x136d9a[_0xc6c3('0x28')](_0x190f2e)){if(!_0xdffdb6[_0x190f2e]){delete _0x136d9a[_0x190f2e];}}}}function freeIsNotKeyAgent(_0x19bc93,_0x166104){var _0x230218=_['mapKeys'](_0x19bc93,function(_0x199f5c,_0x45e2c5){var _0x4b3c63=_[_0xc6c3('0x29')](_0x199f5c[_0xc6c3('0x2a')])?util[_0xc6c3('0x26')](_0xc6c3('0x2b'),_0x199f5c[_0xc6c3('0x27')]):_0x199f5c['interface'];return _0x4b3c63;});for(var _0xef5130 in _0x166104){if(_0x166104['hasOwnProperty'](_0xef5130)){if(!_0x230218[_0xef5130]){delete _0x166104[_0xef5130];}}}}function clearVoiceCallReports(_0x813376){_0x813376[_0xc6c3('0x2c')]=0x0;_0x813376[_0xc6c3('0x2d')]=0x0;_0x813376[_0xc6c3('0x2e')]=0x0;_0x813376[_0xc6c3('0x2f')]=0x0;_0x813376[_0xc6c3('0x30')]=0x0;}function clearCampaigns(_0x5898d1){if(!_[_0xc6c3('0x31')](_0x5898d1)){for(var _0x40a3f3 in _0x5898d1){if(_0x5898d1[_0xc6c3('0x28')](_0x40a3f3)){_0x5898d1[_0x40a3f3][_0xc6c3('0x32')]=0x0;_0x5898d1[_0x40a3f3]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x167d05){if(!_[_0xc6c3('0x31')](_0x167d05)){for(var _0x239182 in _0x167d05){if(_0x167d05['hasOwnProperty'](_0x239182)){_0x167d05[_0x239182]['total']=0x0;_0x167d05[_0x239182][_0xc6c3('0x2d')]=0x0;_0x167d05[_0x239182]['unmanaged']=0x0;_0x167d05[_0x239182]['abandoned']=0x0;_0x167d05[_0x239182][_0xc6c3('0x2e')]=0x0;_0x167d05[_0x239182][_0xc6c3('0x2f')]=0x0;_0x167d05[_0x239182][_0xc6c3('0x30')]=0x0;_0x167d05[_0x239182][_0xc6c3('0x33')]=0x0;_0x167d05[_0x239182][_0xc6c3('0x34')]=0x0;_0x167d05[_0x239182][_0xc6c3('0x35')]=0x0;_0x167d05[_0x239182]['outboundCongestionCallsDay']=0x0;_0x167d05[_0x239182]['outboundNoSuchCallsDay']=0x0;_0x167d05[_0x239182]['outboundUnknownCallsDay']=0x0;_0x167d05[_0x239182][_0xc6c3('0x36')]=0x0;_0x167d05[_0x239182][_0xc6c3('0x37')]=0x0;_0x167d05[_0x239182][_0xc6c3('0x38')]=0x0;_0x167d05[_0x239182]['outboundOriginateFailureCallsDay']=0x0;_0x167d05[_0x239182][_0xc6c3('0x39')]=0x0;_0x167d05[_0x239182][_0xc6c3('0x3a')]=0x0;_0x167d05[_0x239182][_0xc6c3('0x33')]=0x0;_0x167d05[_0x239182]['outboundAnswerCallsDay']=0x0;_0x167d05[_0x239182][_0xc6c3('0x3b')]=!![];}}}}Realtime[_0xc6c3('0x3c')]['mergeFromDatabase']=function(_0x1add2d,_0x53b9d4){for(var _0x2defd9 in _0x53b9d4){if(_0x1add2d[_0xc6c3('0x28')](_0x2defd9)){_0x1add2d[_0x2defd9]=_0x53b9d4[_0x2defd9];}}};Realtime[_0xc6c3('0x3c')][_0xc6c3('0x3d')]=function(){var _0xf7113a=this;return function(_0x3d4c8c){if(_0x3d4c8c){freeIsNotKeyAgent(_0x3d4c8c,_0xf7113a[_0xc6c3('0x3e')]);for(var _0x24d757=0x0,_0x1ab9bd={},_0x3eb459={};_0x24d757<_0x3d4c8c['length'];_0x24d757+=0x1){_0x1ab9bd=_0x3d4c8c[_0x24d757];var _0xa9da8c=_[_0xc6c3('0x29')](_0x1ab9bd[_0xc6c3('0x2a')])?util[_0xc6c3('0x26')](_0xc6c3('0x2b'),_0x1ab9bd[_0xc6c3('0x27')]):_0x1ab9bd[_0xc6c3('0x2a')];if(_[_0xc6c3('0x3f')](_0xf7113a[_0xc6c3('0x3e')][_0xa9da8c])){_0xf7113a[_0xc6c3('0x3e')][_0xa9da8c]=new Agent(_0x1ab9bd);}else{_0xf7113a[_0xc6c3('0x40')](_0xf7113a['agents'][_0xa9da8c],_0x1ab9bd);}}}return _0xf7113a[_0xc6c3('0x3e')];};};Realtime[_0xc6c3('0x3c')][_0xc6c3('0x41')]=function(){var _0x346b03=this;return function(_0x5c672c){if(_0x5c672c){freeIsNotKeySip(_0x5c672c,_0x346b03['telephones']);for(var _0xd9cd6a=0x0,_0x49a94d={},_0x20bfd3={};_0xd9cd6a<_0x5c672c[_0xc6c3('0x42')];_0xd9cd6a+=0x1){_0x49a94d=_0x5c672c[_0xd9cd6a];if(_['isUndefined'](_0x346b03['telephones'][util[_0xc6c3('0x26')](_0xc6c3('0x2b'),_0x49a94d['name'])])){_0x346b03['telephones'][util['format'](_0xc6c3('0x2b'),_0x49a94d[_0xc6c3('0x27')])]=new Telephone(_0x49a94d);}else{_0x346b03[_0xc6c3('0x40')](_0x346b03[_0xc6c3('0x12')][util[_0xc6c3('0x26')]('SIP/%s',_0x49a94d[_0xc6c3('0x27')])],_0x49a94d);}}}return _0x346b03[_0xc6c3('0x12')];};};Realtime[_0xc6c3('0x3c')][_0xc6c3('0x43')]=function(){var _0x156565=this;return function(_0x1c0aab){if(_0x1c0aab){freeIsNotKeySip(_0x1c0aab,_0x156565[_0xc6c3('0x13')]);for(var _0x154f51=0x0,_0x551302={},_0x31f3ee={};_0x154f51<_0x1c0aab[_0xc6c3('0x42')];_0x154f51+=0x1){_0x551302=_0x1c0aab[_0x154f51];if(_[_0xc6c3('0x3f')](_0x156565[_0xc6c3('0x13')][util[_0xc6c3('0x26')](_0xc6c3('0x2b'),_0x551302['name'])])){_0x156565[_0xc6c3('0x13')][util['format']('SIP/%s',_0x551302[_0xc6c3('0x27')])]=new Trunk(_0x551302);}else{_0x156565[_0xc6c3('0x40')](_0x156565[_0xc6c3('0x13')][util[_0xc6c3('0x26')](_0xc6c3('0x2b'),_0x551302[_0xc6c3('0x27')])],_0x551302);}}}return _0x156565['trunks'];};};Realtime[_0xc6c3('0x3c')][_0xc6c3('0x44')]=function(){var _0x2921d8=this;return function(_0x46bf40){if(_0x46bf40){freeIsNotKey(_0x46bf40,_0x2921d8[_0xc6c3('0x14')],_0xc6c3('0x27'));for(var _0x257212=0x0,_0x5200f8={},_0x4af76a={};_0x257212<_0x46bf40[_0xc6c3('0x42')];_0x257212+=0x1){_0x5200f8=_0x46bf40[_0x257212];if(_['isUndefined'](_0x2921d8['voiceQueues'][_0x5200f8[_0xc6c3('0x27')]])){_0x2921d8[_0xc6c3('0x14')][_0x5200f8[_0xc6c3('0x27')]]=new VoiceQueue(_0x5200f8);}else{_0x2921d8[_0xc6c3('0x40')](_0x2921d8[_0xc6c3('0x14')][_0x5200f8[_0xc6c3('0x27')]],_0x5200f8);}}}return _0x2921d8[_0xc6c3('0x14')];};};Realtime[_0xc6c3('0x3c')][_0xc6c3('0x45')]=function(){var _0x4dc361=this;return function(_0x444437){if(_0x444437){freeIsNotKey(_0x444437,_0x4dc361[_0xc6c3('0x15')],'id');for(var _0x2afbe8=0x0,_0xc93632={},_0x448855={};_0x2afbe8<_0x444437[_0xc6c3('0x42')];_0x2afbe8+=0x1){_0xc93632=_0x444437[_0x2afbe8];if(_[_0xc6c3('0x3f')](_0x4dc361[_0xc6c3('0x15')][_0xc93632['id']])){_0x4dc361[_0xc6c3('0x15')][_0xc93632['id']]=new Trigger(_0xc93632);}else{_0x4dc361['mergeFromDatabase'](_0x4dc361['triggers'][_0xc93632['id']],_0xc93632);}}}return _0x4dc361[_0xc6c3('0x15')];};};Realtime[_0xc6c3('0x3c')]['initTemplates']=function(){var _0x5a7151=this;return function(_0x14edf0){if(_0x14edf0){freeIsNotKey(_0x14edf0,_0x5a7151['templates'],'id');for(var _0x46e5b2=0x0,_0x48b99e={},_0x405a7e={};_0x46e5b2<_0x14edf0[_0xc6c3('0x42')];_0x46e5b2+=0x1){_0x48b99e=_0x14edf0[_0x46e5b2];if(_[_0xc6c3('0x3f')](_0x5a7151[_0xc6c3('0x17')][_0x48b99e['id']])){_0x5a7151['templates'][_0x48b99e['id']]=new Template(_0x48b99e);}else{_0x5a7151['mergeFromDatabase'](_0x5a7151['templates'][_0x48b99e['id']],_0x48b99e);}}}return _0x5a7151[_0xc6c3('0x17')];};};Realtime[_0xc6c3('0x3c')][_0xc6c3('0x46')]=function(){var _0x30d350=this;return function(_0x1a2928){if(_0x1a2928){freeIsNotKey(_0x1a2928,_0x30d350[_0xc6c3('0x1d')],'id');for(var _0x12c442=0x0,_0x4c90e3={},_0x46779b={};_0x12c442<_0x1a2928[_0xc6c3('0x42')];_0x12c442+=0x1){_0x4c90e3=_0x1a2928[_0x12c442];if(_['isUndefined'](_0x30d350[_0xc6c3('0x1d')][_0x4c90e3['id']])){_0x30d350[_0xc6c3('0x1d')][_0x4c90e3['id']]=new ZendeskAccount(_0x4c90e3);}else{_0x30d350[_0xc6c3('0x40')](_0x30d350[_0xc6c3('0x1d')][_0x4c90e3['id']],_0x4c90e3);}}}return _0x30d350[_0xc6c3('0x1d')];};};Realtime[_0xc6c3('0x3c')]['initSalesforceAccounts']=function(){var _0x4255a8=this;return function(_0x34a6e7){if(_0x34a6e7){freeIsNotKey(_0x34a6e7,_0x4255a8[_0xc6c3('0x1e')],'id');for(var _0x471238=0x0,_0x5bd969={},_0x42692c={};_0x471238<_0x34a6e7[_0xc6c3('0x42')];_0x471238+=0x1){_0x5bd969=_0x34a6e7[_0x471238];if(_[_0xc6c3('0x3f')](_0x4255a8[_0xc6c3('0x1e')][_0x5bd969['id']])){_0x4255a8[_0xc6c3('0x1e')][_0x5bd969['id']]=new SalesforceAccount(_0x5bd969);}else{_0x4255a8[_0xc6c3('0x40')](_0x4255a8[_0xc6c3('0x1e')][_0x5bd969['id']],_0x5bd969);}}}return _0x4255a8['salesforceAccounts'];};};Realtime[_0xc6c3('0x3c')][_0xc6c3('0x47')]=function(){var _0x37ac31=this;return function(_0x1eaf10){if(_0x1eaf10){freeIsNotKey(_0x1eaf10,_0x37ac31[_0xc6c3('0x20')],'id');for(var _0x538855=0x0,_0x306167={},_0xd8a19={};_0x538855<_0x1eaf10[_0xc6c3('0x42')];_0x538855+=0x1){_0x306167=_0x1eaf10[_0x538855];if(_[_0xc6c3('0x3f')](_0x37ac31['freshdeskAccounts'][_0x306167['id']])){_0x37ac31[_0xc6c3('0x20')][_0x306167['id']]=new FreshdeskAccount(_0x306167);}else{_0x37ac31[_0xc6c3('0x40')](_0x37ac31[_0xc6c3('0x20')][_0x306167['id']],_0x306167);}}}return _0x37ac31[_0xc6c3('0x20')];};};Realtime[_0xc6c3('0x3c')][_0xc6c3('0x48')]=function(){var _0x596dc8=this;return function(_0x8afdc5){if(_0x8afdc5){freeIsNotKey(_0x8afdc5,_0x596dc8['zohoAccounts'],'id');for(var _0x2785aa=0x0,_0x2c4761={},_0x5e6000={};_0x2785aa<_0x8afdc5[_0xc6c3('0x42')];_0x2785aa+=0x1){_0x2c4761=_0x8afdc5[_0x2785aa];if(_[_0xc6c3('0x3f')](_0x596dc8['zohoAccounts'][_0x2c4761['id']])){_0x596dc8['zohoAccounts'][_0x2c4761['id']]=new ZohoAccount(_0x2c4761);}else{_0x596dc8[_0xc6c3('0x40')](_0x596dc8['zohoAccounts'][_0x2c4761['id']],_0x2c4761);}}}return _0x596dc8['zohoAccounts'];};};Realtime['prototype'][_0xc6c3('0x49')]=function(){var _0x45b96d=this;return function(_0x7ecd0a){if(_0x7ecd0a){freeIsNotKey(_0x7ecd0a,_0x45b96d[_0xc6c3('0x21')],'id');for(var _0x2a9c3b=0x0,_0x26c5ae={},_0x595eec={};_0x2a9c3b<_0x7ecd0a[_0xc6c3('0x42')];_0x2a9c3b+=0x1){_0x26c5ae=_0x7ecd0a[_0x2a9c3b];if(_[_0xc6c3('0x3f')](_0x45b96d['deskAccounts'][_0x26c5ae['id']])){_0x45b96d[_0xc6c3('0x21')][_0x26c5ae['id']]=new DeskAccount(_0x26c5ae);}else{_0x45b96d[_0xc6c3('0x40')](_0x45b96d[_0xc6c3('0x21')][_0x26c5ae['id']],_0x26c5ae);}}}return _0x45b96d[_0xc6c3('0x21')];};};Realtime['prototype'][_0xc6c3('0x4a')]=function(){var _0x1b8406=this;return function(_0xaaf767){if(_0xaaf767){freeIsNotKey(_0xaaf767,_0x1b8406['sugarcrmAccounts'],'id');for(var _0x50e848=0x0,_0x34e6ae={},_0x37b26d={};_0x50e848<_0xaaf767[_0xc6c3('0x42')];_0x50e848+=0x1){_0x34e6ae=_0xaaf767[_0x50e848];if(_['isUndefined'](_0x1b8406[_0xc6c3('0x1f')][_0x34e6ae['id']])){_0x1b8406[_0xc6c3('0x1f')][_0x34e6ae['id']]=new SugarcrmAccount(_0x34e6ae);}else{_0x1b8406[_0xc6c3('0x40')](_0x1b8406[_0xc6c3('0x1f')][_0x34e6ae['id']],_0x34e6ae);}}}return _0x1b8406[_0xc6c3('0x1f')];};};Realtime[_0xc6c3('0x3c')][_0xc6c3('0x4b')]=function(){var _0x2688c1=this;return function(_0x17899b){if(_0x17899b){freeIsNotKey(_0x17899b,_0x2688c1[_0xc6c3('0x4c')],'id');for(var _0x28d4d2=0x0,_0x4857fc={},_0x4a839b={};_0x28d4d2<_0x17899b['length'];_0x28d4d2+=0x1){_0x4857fc=_0x17899b[_0x28d4d2];if(_['isUndefined'](_0x2688c1[_0xc6c3('0x4c')][_0x4857fc['id']])){_0x2688c1[_0xc6c3('0x4c')][_0x4857fc['id']]=new VtigerAccount(_0x4857fc);}else{_0x2688c1['mergeFromDatabase'](_0x2688c1[_0xc6c3('0x4c')][_0x4857fc['id']],_0x4857fc);}}}return _0x2688c1[_0xc6c3('0x4c')];};};Realtime[_0xc6c3('0x3c')][_0xc6c3('0x4d')]=function(){var _0x5ae939=this;return function(_0x7ca89f){if(_0x7ca89f){freeIsNotKey(_0x7ca89f,_0x5ae939[_0xc6c3('0x22')],'id');for(var _0x3fe934=0x0,_0x3a55a0={},_0x405ef7={};_0x3fe934<_0x7ca89f[_0xc6c3('0x42')];_0x3fe934+=0x1){_0x3a55a0=_0x7ca89f[_0x3fe934];if(_[_0xc6c3('0x3f')](_0x5ae939[_0xc6c3('0x22')][_0x3a55a0['id']])){_0x5ae939[_0xc6c3('0x22')][_0x3a55a0['id']]=new ServicenowAccount(_0x3a55a0);}else{_0x5ae939['mergeFromDatabase'](_0x5ae939[_0xc6c3('0x22')][_0x3a55a0['id']],_0x3a55a0);}}}return _0x5ae939['servicenowAccounts'];};};Realtime[_0xc6c3('0x3c')]['initDynamics365Accounts']=function(){var _0x2db564=this;return function(_0x50ee30){if(_0x50ee30){freeIsNotKey(_0x50ee30,_0x2db564['dynamics365Accounts'],'id');for(var _0x25e404=0x0,_0x81fdc6={},_0x27626c={};_0x25e404<_0x50ee30[_0xc6c3('0x42')];_0x25e404+=0x1){_0x81fdc6=_0x50ee30[_0x25e404];if(_[_0xc6c3('0x3f')](_0x2db564[_0xc6c3('0x23')][_0x81fdc6['id']])){_0x2db564[_0xc6c3('0x23')][_0x81fdc6['id']]=new Dynamics365Account(_0x81fdc6);}else{_0x2db564[_0xc6c3('0x40')](_0x2db564['dynamics365Accounts'][_0x81fdc6['id']],_0x81fdc6);}}}return _0x2db564[_0xc6c3('0x23')];};};Realtime['prototype'][_0xc6c3('0x4e')]=function(){var _0x5eac56=this;return function(_0x182e2b){if(_0x182e2b){freeIsNotKey(_0x182e2b,_0x5eac56['freshsalesAccounts'],'id');for(var _0x1af107=0x0,_0x4e85b0={},_0x51d4da={};_0x1af107<_0x182e2b['length'];_0x1af107+=0x1){_0x4e85b0=_0x182e2b[_0x1af107];if(_[_0xc6c3('0x3f')](_0x5eac56[_0xc6c3('0x4f')][_0x4e85b0['id']])){_0x5eac56[_0xc6c3('0x4f')][_0x4e85b0['id']]=new FreshsalesAccount(_0x4e85b0);}else{_0x5eac56[_0xc6c3('0x40')](_0x5eac56['freshsalesAccounts'][_0x4e85b0['id']],_0x4e85b0);}}}return _0x5eac56[_0xc6c3('0x4f')];};};Realtime[_0xc6c3('0x3c')][_0xc6c3('0x50')]=function(){var _0xc26bee=this;return function(_0x452593){for(var _0x5cef46=0x0;_0x5cef46<_0x452593[_0xc6c3('0x42')];_0x5cef46+=0x1){_[_0xc6c3('0x51')](_0xc26bee[_0xc6c3('0x14')][_0x452593[_0x5cef46][_0xc6c3('0x27')]],_0x452593[_0x5cef46]);}return _0xc26bee[_0xc6c3('0x14')];};};Realtime[_0xc6c3('0x3c')][_0xc6c3('0x52')]=function(){var _0x11192f=this;return function(_0x2a478c){clearVoiceQueues(_0x11192f[_0xc6c3('0x14')]);if(_0x2a478c){_0x2a478c=_['groupBy'](_0x2a478c,_0xc6c3('0x53'));for(var _0x544629 in _0x2a478c){if(_0x2a478c[_0xc6c3('0x28')](_0x544629)){var _0x1e4321={};for(var _0x4e9236=0x0;_0x4e9236<_0x2a478c[_0x544629][_0xc6c3('0x42')];_0x4e9236+=0x1){var _0x51074e=_0x2a478c[_0x544629][_0x4e9236][_0xc6c3('0x54')];if(_0x11192f[_0xc6c3('0x14')][_0x51074e]){if(_0x2a478c[_0x544629][_0x4e9236][_0xc6c3('0x55')]){_0x11192f['voiceQueues'][_0x51074e][_0xc6c3('0x56')]+=0x1;}if(_0x2a478c[_0x544629][_0x4e9236][_0xc6c3('0x57')]){_0x11192f[_0xc6c3('0x14')][_0x51074e]['abandoned']+=0x1;}_0x11192f[_0xc6c3('0x14')][_0x51074e][_0xc6c3('0x2e')]+=moment(_0x2a478c[_0x544629][_0x4e9236][_0xc6c3('0x58')])[_0xc6c3('0x59')](moment(_0x2a478c[_0x544629][_0x4e9236]['queuecallerjoinAt']),_0xc6c3('0x5a'))||0x0;if(_0x4e9236===_0x2a478c[_0x544629][_0xc6c3('0x42')]-0x1){_0x11192f[_0xc6c3('0x14')][_0x51074e]['sumDuration']+=moment(_0x2a478c[_0x544629][_0x4e9236][_0xc6c3('0x5b')]||_0x2a478c[_0x544629][_0x4e9236][_0xc6c3('0x5c')]||_0x2a478c[_0x544629][_0x4e9236][_0xc6c3('0x5d')])['diff'](moment(_0x2a478c[_0x544629][_0x4e9236][_0xc6c3('0x5e')]),_0xc6c3('0x5a'))||0x0;_0x11192f[_0xc6c3('0x14')][_0x51074e][_0xc6c3('0x2c')]+=0x1;if(_0x2a478c[_0x544629][_0x4e9236][_0xc6c3('0x5f')]){_0x11192f[_0xc6c3('0x14')][_0x51074e][_0xc6c3('0x2d')]+=0x1;_0x11192f[_0xc6c3('0x14')][_0x51074e][_0xc6c3('0x30')]+=moment(_0x2a478c[_0x544629][_0x4e9236]['queuecallercompleteAt'])['diff'](moment(_0x2a478c[_0x544629][_0x4e9236]['queuecallerleaveAt']),_0xc6c3('0x5a'))||0x0;}}else{_0x11192f[_0xc6c3('0x14')][_0x51074e][_0xc6c3('0x2f')]+=_0x11192f[_0xc6c3('0x14')][_0x51074e][_0xc6c3('0x2e')]||0x0;}}}}}}return _0x11192f[_0xc6c3('0x14')];};};Realtime[_0xc6c3('0x3c')][_0xc6c3('0x60')]=function(){var _0x2a2eaf=this;return function(_0x3eea3){clearVoiceCallReports(_0x2a2eaf[_0xc6c3('0x18')]);if(_0x3eea3){for(var _0x9ecb7f=0x0;_0x9ecb7f<_0x3eea3['length'];_0x9ecb7f+=0x1){_0x2a2eaf[_0xc6c3('0x18')][_0xc6c3('0x2c')]+=0x1;_0x2a2eaf[_0xc6c3('0x18')][_0xc6c3('0x2f')]+=_0x3eea3[_0x9ecb7f][_0xc6c3('0x61')];if(_0x3eea3[_0x9ecb7f][_0xc6c3('0x62')]===_0xc6c3('0x63')){_0x2a2eaf[_0xc6c3('0x18')][_0xc6c3('0x2d')]+=0x1;_0x2a2eaf[_0xc6c3('0x18')][_0xc6c3('0x2e')]+=_0x3eea3[_0x9ecb7f][_0xc6c3('0x61')]-_0x3eea3[_0x9ecb7f]['billableseconds']||0x0;_0x2a2eaf[_0xc6c3('0x18')][_0xc6c3('0x30')]+=_0x3eea3[_0x9ecb7f]['billableseconds'];}}}return _0x2a2eaf[_0xc6c3('0x18')];};};Realtime[_0xc6c3('0x3c')][_0xc6c3('0x64')]=function(){var _0x155515=this;return function(_0x577d73){if(_0x577d73){freeIsNotKey(_0x577d73,_0x155515['campaigns'],'name');for(var _0x56b51f=0x0,_0x4e090f={};_0x56b51f<_0x577d73['length'];_0x56b51f+=0x1){_0x4e090f=_0x577d73[_0x56b51f];if(_[_0xc6c3('0x3f')](_0x155515[_0xc6c3('0x16')][_0x4e090f[_0xc6c3('0x27')]])){_0x155515[_0xc6c3('0x16')][_0x4e090f[_0xc6c3('0x27')]]=new Campaign(_0x4e090f);}else{_0x155515[_0xc6c3('0x40')](_0x155515[_0xc6c3('0x16')][_0x4e090f['name']],_0x4e090f);_0x155515[_0xc6c3('0x16')][_0x4e090f['name']][_0xc6c3('0x65')]=_0x4e090f['SquareProject']?_0x4e090f[_0xc6c3('0x66')][_0xc6c3('0x27')]:undefined;}}}return _0x155515[_0xc6c3('0x16')];};};Realtime[_0xc6c3('0x3c')][_0xc6c3('0x67')]=function(){var _0x573cff=this;return function(_0x374a4d){if(_0x374a4d){freeIsNotKey(_0x374a4d,_0x573cff[_0xc6c3('0x19')],'id');for(var _0xa66a1d=0x0,_0x5751c9={};_0xa66a1d<_0x374a4d['length'];_0xa66a1d+=0x1){_0x5751c9=_0x374a4d[_0xa66a1d];if(_[_0xc6c3('0x3f')](_0x573cff[_0xc6c3('0x19')][_0x5751c9['id']])){_0x573cff['voiceExtensions'][_0x5751c9['id']]=new VoiceExtension(_0x5751c9);}else{_0x573cff['mergeFromDatabase'](_0x573cff[_0xc6c3('0x19')][_0x5751c9['id']],_0x5751c9);}}}return _0x573cff['voiceExtensions'];};};Realtime[_0xc6c3('0x3c')]['initCampaignHopperHistory']=function(){var _0x2fc847=this;return function(_0x3caadf){clearCampaigns(_0x2fc847['campaigns']);for(var _0x570d04=0x0;_0x570d04<_0x3caadf[_0xc6c3('0x42')];_0x570d04+=0x1){_[_0xc6c3('0x51')](_0x2fc847['campaigns'][_0x3caadf[_0x570d04][_0xc6c3('0x27')]],_0x3caadf[_0x570d04]);}return _0x2fc847[_0xc6c3('0x16')];};};Realtime[_0xc6c3('0x3c')][_0xc6c3('0x68')]=function(){var _0x100002=this;return function(_0x2ed93c){if(_0x2ed93c){freeIsNotKey(_0x2ed93c,_0x100002[_0xc6c3('0x24')],'id');for(var _0x1d5f32=0x0,_0x34e929={},_0x123708={};_0x1d5f32<_0x2ed93c[_0xc6c3('0x42')];_0x1d5f32+=0x1){_0x34e929=_0x2ed93c[_0x1d5f32];if(_[_0xc6c3('0x3f')](_0x100002[_0xc6c3('0x24')][_0x34e929['id']])){_0x100002[_0xc6c3('0x24')][_0x34e929['id']]=new FaxAccount(_0x34e929);}else{_0x100002[_0xc6c3('0x40')](_0x100002[_0xc6c3('0x24')][_0x34e929['id']],_0x34e929);}}}return _0x100002[_0xc6c3('0x24')];};};module['exports']=Realtime; \ No newline at end of file +var _0x9b0c=['initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','groupBy','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerjoinAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','SquareProject','voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','bluebird','util','moment','../model/agent','../model/telephone','../model/trunk','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','channels','outboundChannels','timers','settings','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','interface','SIP/%s','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','prototype','mergeFromDatabase','initAgents','length','isNil','initTelephones','initTrunks','isUndefined','initVoiceQueues','voiceQueues','initTriggers','triggers','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts'];(function(_0x388106,_0x48d739){var _0x4fba2a=function(_0x51a4c6){while(--_0x51a4c6){_0x388106['push'](_0x388106['shift']());}};_0x4fba2a(++_0x48d739);}(_0x9b0c,0x82));var _0xc9b0=function(_0x14d144,_0x49d942){_0x14d144=_0x14d144-0x0;var _0x2616a8=_0x9b0c[_0x14d144];return _0x2616a8;};'use strict';var BPromise=require(_0xc9b0('0x0'));var util=require(_0xc9b0('0x1'));var _=require('lodash');var moment=require(_0xc9b0('0x2'));var Agent=require(_0xc9b0('0x3'));var Telephone=require(_0xc9b0('0x4'));var Trunk=require(_0xc9b0('0x5'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require('../model/trigger');var Template=require(_0xc9b0('0x6'));var Campaign=require(_0xc9b0('0x7'));var VoiceExtension=require(_0xc9b0('0x8'));var ZendeskAccount=require(_0xc9b0('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xc9b0('0xa'));var SugarcrmAccount=require(_0xc9b0('0xb'));var ZohoAccount=require(_0xc9b0('0xc'));var DeskAccount=require(_0xc9b0('0xd'));var VtigerAccount=require(_0xc9b0('0xe'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xc9b0('0xf'));var FreshsalesAccount=require(_0xc9b0('0x10'));var FaxAccount=require(_0xc9b0('0x11'));var Realtime=function(){this[_0xc9b0('0x12')]={};this[_0xc9b0('0x13')]={};this[_0xc9b0('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0xc9b0('0x15')]={};this[_0xc9b0('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xc9b0('0x17')]={};this['queueChannels']={};this[_0xc9b0('0x18')]={};this[_0xc9b0('0x19')]={};this[_0xc9b0('0x1a')]={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0xc9b0('0x1b')]={};this[_0xc9b0('0x1c')]={};this[_0xc9b0('0x1d')]={};this[_0xc9b0('0x1e')]={};this[_0xc9b0('0x1f')]={};this[_0xc9b0('0x20')]={};this['dynamics365Accounts']={};this['freshsalesAccounts']={};this[_0xc9b0('0x21')]={};};function freeIsNotKey(_0x4a9c06,_0x1b543f,_0x3710fd){var _0x30042e=_[_0xc9b0('0x22')](_0x4a9c06,function(_0x180c09,_0x3a63c4){return _0x180c09[_0x3710fd];});for(var _0x5c8483 in _0x1b543f){if(_0x1b543f[_0xc9b0('0x23')](_0x5c8483)){if(!_0x30042e[_0x5c8483]){delete _0x1b543f[_0x5c8483];}}}}function freeIsNotKeySip(_0x14b146,_0x35ac8c){var _0x36df8d=_[_0xc9b0('0x22')](_0x14b146,function(_0x122136,_0x237887){return util[_0xc9b0('0x24')]('SIP/%s',_0x122136[_0xc9b0('0x25')]);});for(var _0x226b92 in _0x35ac8c){if(_0x35ac8c['hasOwnProperty'](_0x226b92)){if(!_0x36df8d[_0x226b92]){delete _0x35ac8c[_0x226b92];}}}}function freeIsNotKeyAgent(_0x5a5277,_0x54c649){var _0x1f9af7=_[_0xc9b0('0x22')](_0x5a5277,function(_0x3b10be,_0x39699f){var _0x3f342e=_['isNil'](_0x3b10be[_0xc9b0('0x26')])?util[_0xc9b0('0x24')](_0xc9b0('0x27'),_0x3b10be[_0xc9b0('0x25')]):_0x3b10be['interface'];return _0x3f342e;});for(var _0xcfa538 in _0x54c649){if(_0x54c649[_0xc9b0('0x23')](_0xcfa538)){if(!_0x1f9af7[_0xcfa538]){delete _0x54c649[_0xcfa538];}}}}function clearVoiceCallReports(_0x19ecdc){_0x19ecdc[_0xc9b0('0x28')]=0x0;_0x19ecdc[_0xc9b0('0x29')]=0x0;_0x19ecdc[_0xc9b0('0x2a')]=0x0;_0x19ecdc[_0xc9b0('0x2b')]=0x0;_0x19ecdc[_0xc9b0('0x2c')]=0x0;}function clearCampaigns(_0x2882a5){if(!_[_0xc9b0('0x2d')](_0x2882a5)){for(var _0xea7b9d in _0x2882a5){if(_0x2882a5[_0xc9b0('0x23')](_0xea7b9d)){_0x2882a5[_0xea7b9d][_0xc9b0('0x2e')]=0x0;_0x2882a5[_0xea7b9d][_0xc9b0('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x1ce135){if(!_[_0xc9b0('0x2d')](_0x1ce135)){for(var _0x1f58c2 in _0x1ce135){if(_0x1ce135['hasOwnProperty'](_0x1f58c2)){_0x1ce135[_0x1f58c2]['total']=0x0;_0x1ce135[_0x1f58c2][_0xc9b0('0x29')]=0x0;_0x1ce135[_0x1f58c2][_0xc9b0('0x30')]=0x0;_0x1ce135[_0x1f58c2][_0xc9b0('0x31')]=0x0;_0x1ce135[_0x1f58c2][_0xc9b0('0x2a')]=0x0;_0x1ce135[_0x1f58c2][_0xc9b0('0x2b')]=0x0;_0x1ce135[_0x1f58c2][_0xc9b0('0x2c')]=0x0;_0x1ce135[_0x1f58c2][_0xc9b0('0x32')]=0x0;_0x1ce135[_0x1f58c2]['outboundNoAnswerCallsDay']=0x0;_0x1ce135[_0x1f58c2][_0xc9b0('0x33')]=0x0;_0x1ce135[_0x1f58c2][_0xc9b0('0x34')]=0x0;_0x1ce135[_0x1f58c2]['outboundNoSuchCallsDay']=0x0;_0x1ce135[_0x1f58c2]['outboundUnknownCallsDay']=0x0;_0x1ce135[_0x1f58c2][_0xc9b0('0x35')]=0x0;_0x1ce135[_0x1f58c2][_0xc9b0('0x36')]=0x0;_0x1ce135[_0x1f58c2][_0xc9b0('0x37')]=0x0;_0x1ce135[_0x1f58c2][_0xc9b0('0x38')]=0x0;_0x1ce135[_0x1f58c2][_0xc9b0('0x39')]=0x0;_0x1ce135[_0x1f58c2][_0xc9b0('0x3a')]=0x0;_0x1ce135[_0x1f58c2][_0xc9b0('0x32')]=0x0;_0x1ce135[_0x1f58c2]['outboundAnswerCallsDay']=0x0;_0x1ce135[_0x1f58c2]['queueStatusComplete']=!![];}}}}Realtime[_0xc9b0('0x3b')][_0xc9b0('0x3c')]=function(_0x513c1b,_0xc67b8){for(var _0x3edbdb in _0xc67b8){if(_0x513c1b[_0xc9b0('0x23')](_0x3edbdb)){_0x513c1b[_0x3edbdb]=_0xc67b8[_0x3edbdb];}}};Realtime[_0xc9b0('0x3b')][_0xc9b0('0x3d')]=function(){var _0x59c8be=this;return function(_0x2fc15d){if(_0x2fc15d){freeIsNotKeyAgent(_0x2fc15d,_0x59c8be[_0xc9b0('0x12')]);for(var _0x47d3b0=0x0,_0x3b8817={},_0x5e0edd={};_0x47d3b0<_0x2fc15d[_0xc9b0('0x3e')];_0x47d3b0+=0x1){_0x3b8817=_0x2fc15d[_0x47d3b0];var _0x36cf8f=_[_0xc9b0('0x3f')](_0x3b8817[_0xc9b0('0x26')])?util[_0xc9b0('0x24')](_0xc9b0('0x27'),_0x3b8817[_0xc9b0('0x25')]):_0x3b8817[_0xc9b0('0x26')];if(_['isUndefined'](_0x59c8be[_0xc9b0('0x12')][_0x36cf8f])){_0x59c8be[_0xc9b0('0x12')][_0x36cf8f]=new Agent(_0x3b8817);}else{_0x59c8be['mergeFromDatabase'](_0x59c8be[_0xc9b0('0x12')][_0x36cf8f],_0x3b8817);}}}return _0x59c8be[_0xc9b0('0x12')];};};Realtime[_0xc9b0('0x3b')][_0xc9b0('0x40')]=function(){var _0x23d950=this;return function(_0x2f0bdb){if(_0x2f0bdb){freeIsNotKeySip(_0x2f0bdb,_0x23d950['telephones']);for(var _0x358c0f=0x0,_0x4dab78={},_0x4d7778={};_0x358c0f<_0x2f0bdb[_0xc9b0('0x3e')];_0x358c0f+=0x1){_0x4dab78=_0x2f0bdb[_0x358c0f];if(_['isUndefined'](_0x23d950[_0xc9b0('0x13')][util[_0xc9b0('0x24')](_0xc9b0('0x27'),_0x4dab78['name'])])){_0x23d950[_0xc9b0('0x13')][util[_0xc9b0('0x24')]('SIP/%s',_0x4dab78[_0xc9b0('0x25')])]=new Telephone(_0x4dab78);}else{_0x23d950['mergeFromDatabase'](_0x23d950[_0xc9b0('0x13')][util[_0xc9b0('0x24')]('SIP/%s',_0x4dab78['name'])],_0x4dab78);}}}return _0x23d950[_0xc9b0('0x13')];};};Realtime[_0xc9b0('0x3b')][_0xc9b0('0x41')]=function(){var _0x14ee2c=this;return function(_0x3f9328){if(_0x3f9328){freeIsNotKeySip(_0x3f9328,_0x14ee2c['trunks']);for(var _0x2bad13=0x0,_0x59044e={},_0x2ff898={};_0x2bad13<_0x3f9328[_0xc9b0('0x3e')];_0x2bad13+=0x1){_0x59044e=_0x3f9328[_0x2bad13];if(_[_0xc9b0('0x42')](_0x14ee2c[_0xc9b0('0x14')][util['format'](_0xc9b0('0x27'),_0x59044e[_0xc9b0('0x25')])])){_0x14ee2c[_0xc9b0('0x14')][util[_0xc9b0('0x24')](_0xc9b0('0x27'),_0x59044e['name'])]=new Trunk(_0x59044e);}else{_0x14ee2c['mergeFromDatabase'](_0x14ee2c['trunks'][util[_0xc9b0('0x24')]('SIP/%s',_0x59044e[_0xc9b0('0x25')])],_0x59044e);}}}return _0x14ee2c[_0xc9b0('0x14')];};};Realtime['prototype'][_0xc9b0('0x43')]=function(){var _0x176c31=this;return function(_0x49ff73){if(_0x49ff73){freeIsNotKey(_0x49ff73,_0x176c31[_0xc9b0('0x44')],_0xc9b0('0x25'));for(var _0x3ee105=0x0,_0x7697ea={},_0x341a99={};_0x3ee105<_0x49ff73[_0xc9b0('0x3e')];_0x3ee105+=0x1){_0x7697ea=_0x49ff73[_0x3ee105];if(_[_0xc9b0('0x42')](_0x176c31[_0xc9b0('0x44')][_0x7697ea[_0xc9b0('0x25')]])){_0x176c31[_0xc9b0('0x44')][_0x7697ea[_0xc9b0('0x25')]]=new VoiceQueue(_0x7697ea);}else{_0x176c31['mergeFromDatabase'](_0x176c31[_0xc9b0('0x44')][_0x7697ea['name']],_0x7697ea);}}}return _0x176c31[_0xc9b0('0x44')];};};Realtime[_0xc9b0('0x3b')][_0xc9b0('0x45')]=function(){var _0x26020c=this;return function(_0x5adebe){if(_0x5adebe){freeIsNotKey(_0x5adebe,_0x26020c['triggers'],'id');for(var _0x63e3d=0x0,_0xded9c9={},_0x385b84={};_0x63e3d<_0x5adebe[_0xc9b0('0x3e')];_0x63e3d+=0x1){_0xded9c9=_0x5adebe[_0x63e3d];if(_['isUndefined'](_0x26020c[_0xc9b0('0x46')][_0xded9c9['id']])){_0x26020c[_0xc9b0('0x46')][_0xded9c9['id']]=new Trigger(_0xded9c9);}else{_0x26020c[_0xc9b0('0x3c')](_0x26020c[_0xc9b0('0x46')][_0xded9c9['id']],_0xded9c9);}}}return _0x26020c[_0xc9b0('0x46')];};};Realtime[_0xc9b0('0x3b')]['initTemplates']=function(){var _0xee1910=this;return function(_0x17d2d8){if(_0x17d2d8){freeIsNotKey(_0x17d2d8,_0xee1910['templates'],'id');for(var _0xec831e=0x0,_0x3f5eab={},_0x3eafb8={};_0xec831e<_0x17d2d8[_0xc9b0('0x3e')];_0xec831e+=0x1){_0x3f5eab=_0x17d2d8[_0xec831e];if(_['isUndefined'](_0xee1910['templates'][_0x3f5eab['id']])){_0xee1910[_0xc9b0('0x16')][_0x3f5eab['id']]=new Template(_0x3f5eab);}else{_0xee1910['mergeFromDatabase'](_0xee1910['templates'][_0x3f5eab['id']],_0x3f5eab);}}}return _0xee1910['templates'];};};Realtime['prototype'][_0xc9b0('0x47')]=function(){var _0x49e309=this;return function(_0x539026){if(_0x539026){freeIsNotKey(_0x539026,_0x49e309[_0xc9b0('0x48')],'id');for(var _0x1af121=0x0,_0x53914a={},_0x41c94f={};_0x1af121<_0x539026['length'];_0x1af121+=0x1){_0x53914a=_0x539026[_0x1af121];if(_['isUndefined'](_0x49e309[_0xc9b0('0x48')][_0x53914a['id']])){_0x49e309['zendeskAccounts'][_0x53914a['id']]=new ZendeskAccount(_0x53914a);}else{_0x49e309['mergeFromDatabase'](_0x49e309[_0xc9b0('0x48')][_0x53914a['id']],_0x53914a);}}}return _0x49e309['zendeskAccounts'];};};Realtime['prototype'][_0xc9b0('0x49')]=function(){var _0x43098e=this;return function(_0xcee456){if(_0xcee456){freeIsNotKey(_0xcee456,_0x43098e[_0xc9b0('0x4a')],'id');for(var _0x3cbe43=0x0,_0xf72245={},_0x5dd521={};_0x3cbe43<_0xcee456[_0xc9b0('0x3e')];_0x3cbe43+=0x1){_0xf72245=_0xcee456[_0x3cbe43];if(_['isUndefined'](_0x43098e[_0xc9b0('0x4a')][_0xf72245['id']])){_0x43098e[_0xc9b0('0x4a')][_0xf72245['id']]=new SalesforceAccount(_0xf72245);}else{_0x43098e[_0xc9b0('0x3c')](_0x43098e['salesforceAccounts'][_0xf72245['id']],_0xf72245);}}}return _0x43098e[_0xc9b0('0x4a')];};};Realtime[_0xc9b0('0x3b')][_0xc9b0('0x4b')]=function(){var _0x26f66d=this;return function(_0x4a8f2c){if(_0x4a8f2c){freeIsNotKey(_0x4a8f2c,_0x26f66d[_0xc9b0('0x1c')],'id');for(var _0x44471a=0x0,_0x24bc9f={},_0xd531de={};_0x44471a<_0x4a8f2c['length'];_0x44471a+=0x1){_0x24bc9f=_0x4a8f2c[_0x44471a];if(_[_0xc9b0('0x42')](_0x26f66d[_0xc9b0('0x1c')][_0x24bc9f['id']])){_0x26f66d['freshdeskAccounts'][_0x24bc9f['id']]=new FreshdeskAccount(_0x24bc9f);}else{_0x26f66d['mergeFromDatabase'](_0x26f66d['freshdeskAccounts'][_0x24bc9f['id']],_0x24bc9f);}}}return _0x26f66d['freshdeskAccounts'];};};Realtime[_0xc9b0('0x3b')][_0xc9b0('0x4c')]=function(){var _0x5e5852=this;return function(_0x99c8b5){if(_0x99c8b5){freeIsNotKey(_0x99c8b5,_0x5e5852['zohoAccounts'],'id');for(var _0x6f8760=0x0,_0x255d9c={},_0x5a5a09={};_0x6f8760<_0x99c8b5[_0xc9b0('0x3e')];_0x6f8760+=0x1){_0x255d9c=_0x99c8b5[_0x6f8760];if(_['isUndefined'](_0x5e5852[_0xc9b0('0x1d')][_0x255d9c['id']])){_0x5e5852[_0xc9b0('0x1d')][_0x255d9c['id']]=new ZohoAccount(_0x255d9c);}else{_0x5e5852['mergeFromDatabase'](_0x5e5852[_0xc9b0('0x1d')][_0x255d9c['id']],_0x255d9c);}}}return _0x5e5852[_0xc9b0('0x1d')];};};Realtime[_0xc9b0('0x3b')]['initDeskAccounts']=function(){var _0x1eb7f7=this;return function(_0x594e6a){if(_0x594e6a){freeIsNotKey(_0x594e6a,_0x1eb7f7[_0xc9b0('0x1e')],'id');for(var _0x1bfff4=0x0,_0x3d8727={},_0x3e381e={};_0x1bfff4<_0x594e6a['length'];_0x1bfff4+=0x1){_0x3d8727=_0x594e6a[_0x1bfff4];if(_[_0xc9b0('0x42')](_0x1eb7f7[_0xc9b0('0x1e')][_0x3d8727['id']])){_0x1eb7f7[_0xc9b0('0x1e')][_0x3d8727['id']]=new DeskAccount(_0x3d8727);}else{_0x1eb7f7[_0xc9b0('0x3c')](_0x1eb7f7[_0xc9b0('0x1e')][_0x3d8727['id']],_0x3d8727);}}}return _0x1eb7f7[_0xc9b0('0x1e')];};};Realtime['prototype'][_0xc9b0('0x4d')]=function(){var _0x1bd889=this;return function(_0x35c911){if(_0x35c911){freeIsNotKey(_0x35c911,_0x1bd889[_0xc9b0('0x1b')],'id');for(var _0xd8445d=0x0,_0x80c44d={},_0x1d070a={};_0xd8445d<_0x35c911[_0xc9b0('0x3e')];_0xd8445d+=0x1){_0x80c44d=_0x35c911[_0xd8445d];if(_[_0xc9b0('0x42')](_0x1bd889[_0xc9b0('0x1b')][_0x80c44d['id']])){_0x1bd889[_0xc9b0('0x1b')][_0x80c44d['id']]=new SugarcrmAccount(_0x80c44d);}else{_0x1bd889[_0xc9b0('0x3c')](_0x1bd889['sugarcrmAccounts'][_0x80c44d['id']],_0x80c44d);}}}return _0x1bd889[_0xc9b0('0x1b')];};};Realtime['prototype'][_0xc9b0('0x4e')]=function(){var _0x385212=this;return function(_0x1df578){if(_0x1df578){freeIsNotKey(_0x1df578,_0x385212['vtigerAccounts'],'id');for(var _0x2bf51e=0x0,_0x1df24c={},_0x17c9fa={};_0x2bf51e<_0x1df578[_0xc9b0('0x3e')];_0x2bf51e+=0x1){_0x1df24c=_0x1df578[_0x2bf51e];if(_[_0xc9b0('0x42')](_0x385212['vtigerAccounts'][_0x1df24c['id']])){_0x385212[_0xc9b0('0x1f')][_0x1df24c['id']]=new VtigerAccount(_0x1df24c);}else{_0x385212['mergeFromDatabase'](_0x385212[_0xc9b0('0x1f')][_0x1df24c['id']],_0x1df24c);}}}return _0x385212[_0xc9b0('0x1f')];};};Realtime[_0xc9b0('0x3b')][_0xc9b0('0x4f')]=function(){var _0x169b80=this;return function(_0x13f967){if(_0x13f967){freeIsNotKey(_0x13f967,_0x169b80['servicenowAccounts'],'id');for(var _0x10ecef=0x0,_0x10e8ea={},_0x2bfa4b={};_0x10ecef<_0x13f967['length'];_0x10ecef+=0x1){_0x10e8ea=_0x13f967[_0x10ecef];if(_[_0xc9b0('0x42')](_0x169b80['servicenowAccounts'][_0x10e8ea['id']])){_0x169b80['servicenowAccounts'][_0x10e8ea['id']]=new ServicenowAccount(_0x10e8ea);}else{_0x169b80['mergeFromDatabase'](_0x169b80['servicenowAccounts'][_0x10e8ea['id']],_0x10e8ea);}}}return _0x169b80[_0xc9b0('0x20')];};};Realtime['prototype'][_0xc9b0('0x50')]=function(){var _0x4d290d=this;return function(_0x357d2e){if(_0x357d2e){freeIsNotKey(_0x357d2e,_0x4d290d[_0xc9b0('0x51')],'id');for(var _0x2eeef1=0x0,_0x1288cb={},_0xc0c1d0={};_0x2eeef1<_0x357d2e[_0xc9b0('0x3e')];_0x2eeef1+=0x1){_0x1288cb=_0x357d2e[_0x2eeef1];if(_[_0xc9b0('0x42')](_0x4d290d['dynamics365Accounts'][_0x1288cb['id']])){_0x4d290d['dynamics365Accounts'][_0x1288cb['id']]=new Dynamics365Account(_0x1288cb);}else{_0x4d290d[_0xc9b0('0x3c')](_0x4d290d[_0xc9b0('0x51')][_0x1288cb['id']],_0x1288cb);}}}return _0x4d290d[_0xc9b0('0x51')];};};Realtime[_0xc9b0('0x3b')][_0xc9b0('0x52')]=function(){var _0x974f8e=this;return function(_0xe32aa8){if(_0xe32aa8){freeIsNotKey(_0xe32aa8,_0x974f8e[_0xc9b0('0x53')],'id');for(var _0x22f310=0x0,_0x11ce46={},_0x31b8e7={};_0x22f310<_0xe32aa8[_0xc9b0('0x3e')];_0x22f310+=0x1){_0x11ce46=_0xe32aa8[_0x22f310];if(_[_0xc9b0('0x42')](_0x974f8e[_0xc9b0('0x53')][_0x11ce46['id']])){_0x974f8e[_0xc9b0('0x53')][_0x11ce46['id']]=new FreshsalesAccount(_0x11ce46);}else{_0x974f8e['mergeFromDatabase'](_0x974f8e[_0xc9b0('0x53')][_0x11ce46['id']],_0x11ce46);}}}return _0x974f8e[_0xc9b0('0x53')];};};Realtime[_0xc9b0('0x3b')][_0xc9b0('0x54')]=function(){var _0x869aaf=this;return function(_0x4f8887){for(var _0x1445c4=0x0;_0x1445c4<_0x4f8887['length'];_0x1445c4+=0x1){_['merge'](_0x869aaf[_0xc9b0('0x44')][_0x4f8887[_0x1445c4][_0xc9b0('0x25')]],_0x4f8887[_0x1445c4]);}return _0x869aaf[_0xc9b0('0x44')];};};Realtime[_0xc9b0('0x3b')]['initVoiceQueueReports']=function(){var _0x33ba39=this;return function(_0x1ce79f){clearVoiceQueues(_0x33ba39[_0xc9b0('0x44')]);if(_0x1ce79f){_0x1ce79f=_[_0xc9b0('0x55')](_0x1ce79f,'uniqueid');for(var _0x134091 in _0x1ce79f){if(_0x1ce79f[_0xc9b0('0x23')](_0x134091)){var _0x25fe94={};for(var _0x1c57be=0x0;_0x1c57be<_0x1ce79f[_0x134091][_0xc9b0('0x3e')];_0x1c57be+=0x1){var _0x3f8b39=_0x1ce79f[_0x134091][_0x1c57be][_0xc9b0('0x56')];if(_0x33ba39[_0xc9b0('0x44')][_0x3f8b39]){if(_0x1ce79f[_0x134091][_0x1c57be][_0xc9b0('0x57')]){_0x33ba39['voiceQueues'][_0x3f8b39][_0xc9b0('0x30')]+=0x1;}if(_0x1ce79f[_0x134091][_0x1c57be][_0xc9b0('0x58')]){_0x33ba39['voiceQueues'][_0x3f8b39][_0xc9b0('0x31')]+=0x1;}_0x33ba39[_0xc9b0('0x44')][_0x3f8b39]['sumHoldTime']+=moment(_0x1ce79f[_0x134091][_0x1c57be][_0xc9b0('0x59')])[_0xc9b0('0x5a')](moment(_0x1ce79f[_0x134091][_0x1c57be]['queuecallerjoinAt']),_0xc9b0('0x5b'))||0x0;if(_0x1c57be===_0x1ce79f[_0x134091][_0xc9b0('0x3e')]-0x1){_0x33ba39['voiceQueues'][_0x3f8b39][_0xc9b0('0x2b')]+=moment(_0x1ce79f[_0x134091][_0x1c57be][_0xc9b0('0x5c')]||_0x1ce79f[_0x134091][_0x1c57be][_0xc9b0('0x5d')]||_0x1ce79f[_0x134091][_0x1c57be]['queuecallerexitAt'])['diff'](moment(_0x1ce79f[_0x134091][_0x1c57be][_0xc9b0('0x5e')]),_0xc9b0('0x5b'))||0x0;_0x33ba39['voiceQueues'][_0x3f8b39]['total']+=0x1;if(_0x1ce79f[_0x134091][_0x1c57be]['queuecallercomplete']){_0x33ba39[_0xc9b0('0x44')][_0x3f8b39][_0xc9b0('0x29')]+=0x1;_0x33ba39[_0xc9b0('0x44')][_0x3f8b39][_0xc9b0('0x2c')]+=moment(_0x1ce79f[_0x134091][_0x1c57be]['queuecallercompleteAt'])[_0xc9b0('0x5a')](moment(_0x1ce79f[_0x134091][_0x1c57be][_0xc9b0('0x59')]),_0xc9b0('0x5b'))||0x0;}}else{_0x33ba39[_0xc9b0('0x44')][_0x3f8b39][_0xc9b0('0x2b')]+=_0x33ba39[_0xc9b0('0x44')][_0x3f8b39]['sumHoldTime']||0x0;}}}}}}return _0x33ba39[_0xc9b0('0x44')];};};Realtime[_0xc9b0('0x3b')][_0xc9b0('0x5f')]=function(){var _0xd03f60=this;return function(_0x1f406d){clearVoiceCallReports(_0xd03f60[_0xc9b0('0x60')]);if(_0x1f406d){for(var _0x2028ac=0x0;_0x2028ac<_0x1f406d[_0xc9b0('0x3e')];_0x2028ac+=0x1){_0xd03f60[_0xc9b0('0x60')][_0xc9b0('0x28')]+=0x1;_0xd03f60[_0xc9b0('0x60')]['sumDuration']+=_0x1f406d[_0x2028ac][_0xc9b0('0x61')];if(_0x1f406d[_0x2028ac][_0xc9b0('0x62')]===_0xc9b0('0x63')){_0xd03f60[_0xc9b0('0x60')][_0xc9b0('0x29')]+=0x1;_0xd03f60[_0xc9b0('0x60')]['sumHoldTime']+=_0x1f406d[_0x2028ac][_0xc9b0('0x61')]-_0x1f406d[_0x2028ac]['billableseconds']||0x0;_0xd03f60['outbound'][_0xc9b0('0x2c')]+=_0x1f406d[_0x2028ac][_0xc9b0('0x64')];}}}return _0xd03f60[_0xc9b0('0x60')];};};Realtime['prototype']['initCampaigns']=function(){var _0x441196=this;return function(_0x517443){if(_0x517443){freeIsNotKey(_0x517443,_0x441196[_0xc9b0('0x15')],_0xc9b0('0x25'));for(var _0x895f17=0x0,_0x236bd0={};_0x895f17<_0x517443[_0xc9b0('0x3e')];_0x895f17+=0x1){_0x236bd0=_0x517443[_0x895f17];if(_[_0xc9b0('0x42')](_0x441196[_0xc9b0('0x15')][_0x236bd0[_0xc9b0('0x25')]])){_0x441196[_0xc9b0('0x15')][_0x236bd0[_0xc9b0('0x25')]]=new Campaign(_0x236bd0);}else{_0x441196[_0xc9b0('0x3c')](_0x441196[_0xc9b0('0x15')][_0x236bd0[_0xc9b0('0x25')]],_0x236bd0);_0x441196[_0xc9b0('0x15')][_0x236bd0['name']]['dialQueueProject']=_0x236bd0[_0xc9b0('0x65')]?_0x236bd0[_0xc9b0('0x65')]['name']:undefined;}}}return _0x441196[_0xc9b0('0x15')];};};Realtime[_0xc9b0('0x3b')]['initVoiceExtensions']=function(){var _0x3408c3=this;return function(_0x45b691){if(_0x45b691){freeIsNotKey(_0x45b691,_0x3408c3[_0xc9b0('0x66')],'id');for(var _0x402a82=0x0,_0x4a347d={};_0x402a82<_0x45b691[_0xc9b0('0x3e')];_0x402a82+=0x1){_0x4a347d=_0x45b691[_0x402a82];if(_[_0xc9b0('0x42')](_0x3408c3[_0xc9b0('0x66')][_0x4a347d['id']])){_0x3408c3['voiceExtensions'][_0x4a347d['id']]=new VoiceExtension(_0x4a347d);}else{_0x3408c3['mergeFromDatabase'](_0x3408c3[_0xc9b0('0x66')][_0x4a347d['id']],_0x4a347d);}}}return _0x3408c3[_0xc9b0('0x66')];};};Realtime[_0xc9b0('0x3b')][_0xc9b0('0x67')]=function(){var _0x5e2e2e=this;return function(_0x12087e){clearCampaigns(_0x5e2e2e[_0xc9b0('0x15')]);for(var _0x9b57e6=0x0;_0x9b57e6<_0x12087e[_0xc9b0('0x3e')];_0x9b57e6+=0x1){_[_0xc9b0('0x68')](_0x5e2e2e['campaigns'][_0x12087e[_0x9b57e6][_0xc9b0('0x25')]],_0x12087e[_0x9b57e6]);}return _0x5e2e2e['campaigns'];};};Realtime['prototype'][_0xc9b0('0x69')]=function(){var _0x167a75=this;return function(_0x1a5cdd){if(_0x1a5cdd){freeIsNotKey(_0x1a5cdd,_0x167a75[_0xc9b0('0x21')],'id');for(var _0x101cd3=0x0,_0x478b8f={},_0x1fcacd={};_0x101cd3<_0x1a5cdd[_0xc9b0('0x3e')];_0x101cd3+=0x1){_0x478b8f=_0x1a5cdd[_0x101cd3];if(_[_0xc9b0('0x42')](_0x167a75['faxAccounts'][_0x478b8f['id']])){_0x167a75[_0xc9b0('0x21')][_0x478b8f['id']]=new FaxAccount(_0x478b8f);}else{_0x167a75[_0xc9b0('0x3c')](_0x167a75[_0xc9b0('0x21')][_0x478b8f['id']],_0x478b8f);}}}return _0x167a75[_0xc9b0('0x21')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index e6a8905..09c247d 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 _0x4288=['voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','prototype','findAgent','find','accountcode','isNil','interface','SIP/%s','name','length','connectedlinenum','assigned','format','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','getAgentByInternal','keys','channel','calleridnum','outbound','internal','destination','exten','type','dialer','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','originatecalleridnum','disposition','transfers','linkedid','UserId','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','isArray','forEach','Local','substring','indexOf','phone','lastIndexOf','transfererlinkedid','exports','lodash','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./userReport','realtime','agents','telephones','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport'];(function(_0x2be6d9,_0xd31df5){var _0x45e38b=function(_0x1237b0){while(--_0x1237b0){_0x2be6d9['push'](_0x2be6d9['shift']());}};_0x45e38b(++_0xd31df5);}(_0x4288,0x196));var _0x8428=function(_0x2f9c8a,_0x15f868){_0x2f9c8a=_0x2f9c8a-0x0;var _0x1999a1=_0x4288[_0x2f9c8a];return _0x1999a1;};'use strict';var _=require(_0x8428('0x0'));var moment=require('moment');var util=require('util');var config=require(_0x8428('0x1'));var ami=require(_0x8428('0x2'));var RpcVoiceAgentReport=require(_0x8428('0x3'));var RpcVoiceCallReport=require(_0x8428('0x4'));var RpcVoiceDialReport=require(_0x8428('0x5'));var RpcMemberReport=require(_0x8428('0x6'));var RpcVoiceQueueReport=require(_0x8428('0x7'));var RpcVoiceRecording=require(_0x8428('0x8'));var RpcVoiceTransferReport=require(_0x8428('0x9'));var VoiceQueueReport=require(_0x8428('0xa'));var VoiceCallReport=require(_0x8428('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x8428('0xc'));function Report(_0x4506c6){this[_0x8428('0xd')]=_0x4506c6;this[_0x8428('0xe')]=_0x4506c6[_0x8428('0xe')];this['telephones']=_0x4506c6[_0x8428('0xf')];}Report['prototype'][_0x8428('0x10')]=function(_0x37fce8){var _0x3572d8=new VoiceQueueReport(this[_0x8428('0xd')]);var _0x18c2ab=new VoiceAgentReport(this['realtime']);var _0x3db5d8=new VoiceDialReport(this[_0x8428('0xd')]);var _0xf33f35=new VoiceCallReport(this[_0x8428('0xd')]);var _0x5ca4f2=new UserReport(this[_0x8428('0xd')]);if(config['xdr']&&config[_0x8428('0x11')][_0x8428('0x12')]){ami['on']('custom:voiceQueueReport',this[_0x8428('0x13')][_0x8428('0x14')](this));ami['on'](_0x8428('0x15'),this[_0x8428('0x16')]['bind'](this));ami['on'](_0x8428('0x17'),this[_0x8428('0x18')][_0x8428('0x14')](this));ami['on'](_0x8428('0x19'),this[_0x8428('0x1a')][_0x8428('0x14')](this));ami['on'](_0x8428('0x1b'),this[_0x8428('0x1c')][_0x8428('0x14')](this));ami['on']('attendedtransfer',this[_0x8428('0x1d')]['bind'](this));}};Report[_0x8428('0x1e')][_0x8428('0x1f')]=function(_0x4634dd){var _0x1e2fa1;_0x1e2fa1=_[_0x8428('0x20')](this[_0x8428('0xe')],function(_0x218ec0){return _0x218ec0[_0x8428('0x21')]==_0x4634dd||_0x218ec0['name']==_0x4634dd;});if(_[_0x8428('0x22')](_0x1e2fa1)){var _0x1c539f=_[_0x8428('0x20')](this[_0x8428('0xf')],function(_0x45f53f){return _0x45f53f['accountcode']==_0x4634dd||_0x45f53f['name']==_0x4634dd;});if(_0x1c539f){_0x1e2fa1=_[_0x8428('0x20')](this['agents'],function(_0x112a48){return _0x112a48[_0x8428('0x23')]==util['format'](_0x8428('0x24'),_0x1c539f[_0x8428('0x25')]);});}}return _0x1e2fa1;};Report['prototype'][_0x8428('0x13')]=function(_0x53a011){for(var _0x5a5522=0x0;_0x5a5522<_0x53a011[_0x8428('0x26')];_0x5a5522+=0x1){var _0x2f6ae4=this[_0x8428('0x1f')](_0x53a011[_0x5a5522][_0x8428('0x27')]);if(_0x2f6ae4){_0x53a011[_0x5a5522][_0x8428('0x21')]=_0x2f6ae4[_0x8428('0x21')];_0x53a011[_0x5a5522][_0x8428('0x28')]=!![];_0x53a011[_0x5a5522]['lastAssignedTo']=_0x2f6ae4[_0x8428('0x25')];_0x53a011[_0x5a5522][_0x8428('0x23')]=_[_0x8428('0x22')](_0x2f6ae4[_0x8428('0x23')])?util[_0x8428('0x29')](_0x8428('0x24'),_0x2f6ae4[_0x8428('0x25')]):_0x2f6ae4[_0x8428('0x23')];if(_0x53a011[_0x5a5522][_0x8428('0x2a')]){_0x53a011[_0x5a5522][_0x8428('0x2b')]=moment()[_0x8428('0x29')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x53a011[_0x5a5522][_0x8428('0x2c')]){_0x53a011[_0x5a5522][_0x8428('0x2d')]=moment()['format'](_0x8428('0x2e'));}RpcMemberReport[_0x8428('0x13')](_0x53a011[_0x5a5522]);}RpcVoiceQueueReport[_0x8428('0x2f')](_0x53a011[_0x5a5522]);}};function extractCalleridNumber(_0x431e13){var _0x22e68a=_0x431e13['match'](/<(.*?)>/);return _0x22e68a?_0x22e68a[0x1]:_0x431e13;}Report[_0x8428('0x1e')][_0x8428('0x30')]=function(_0x5a9604){for(var _0x56a19d=0x0;_0x56a19d',_0xf0d01d['calleridname'],_0xf0d01d[_0x8428('0x33')]);}if(RpcVoiceTransferReport[_0x8428('0x43')][_0xf0d01d[_0x8428('0x44')]]){var _0x557903=RpcVoiceTransferReport[_0x8428('0x43')][_0xf0d01d[_0x8428('0x44')]];_0x557903['transfereelinkedid']=_0xf0d01d['uniqueid'];RpcVoiceTransferReport[_0x8428('0x1c')](_0x557903);delete RpcVoiceTransferReport[_0x8428('0x43')][_0xf0d01d[_0x8428('0x44')]];}if(_[_0x8428('0x22')](_0xf0d01d['type'])){_0xf0d01d[_0x8428('0x38')]=this['getCallType'](_0xf0d01d);}if(_[_0x8428('0x22')](_0xf0d01d['UserId'])){var _0x232fb2=_0xf0d01d[_0x8428('0x32')]['split']('-')[0x0];var _0x45888f=this[_0x8428('0xe')][_0x232fb2];if(!_0x45888f)_0x45888f=this[_0x8428('0x30')](_0xf0d01d[_0x8428('0x21')]);if(_0x45888f){_0xf0d01d[_0x8428('0x45')]=_0x45888f['id'];_0xf0d01d['membername']=_0x45888f['name'];}}RpcVoiceCallReport['create'](_0xf0d01d);if(_0xf0d01d[_0x8428('0x46')]){for(var _0x21e25b=0x0;_0x21e25b<_0xf0d01d[_0x8428('0x47')][_0x8428('0x26')];_0x21e25b+=0x1){_0xf0d01d[_0x8428('0x48')]=_0xf0d01d['monitors'][_0x21e25b][_0x8428('0x49')];_0xf0d01d[_0x8428('0x4a')]=_0xf0d01d[_0x8428('0x47')][_0x21e25b]['createdAt'];if(_0xf0d01d[_0x8428('0x37')]==_0x8428('0x40')){_0xf0d01d[_0x8428('0x33')]=_0xf0d01d[_0x8428('0x27')];_0xf0d01d['calleridname']=_0xf0d01d[_0x8428('0x4b')];_0xf0d01d[_0x8428('0x27')]=_0xf0d01d['accountcode'];_0xf0d01d[_0x8428('0x4b')]=_0xf0d01d[_0x8428('0x4c')];_0xf0d01d['exten']=_0xf0d01d[_0x8428('0x41')];}else if(_0xf0d01d[_0x8428('0x37')]=='xcally-motion-dialer'){_0xf0d01d['calleridnum']=_0xf0d01d[_0x8428('0x36')];_0xf0d01d[_0x8428('0x37')]=_0xf0d01d[_0x8428('0x41')];}RpcVoiceRecording['create'](_0xf0d01d);}}};Report['prototype'][_0x8428('0x18')]=function(_0xe4ecae){if(_[_0x8428('0x4d')](_0xe4ecae)){_0xe4ecae[_0x8428('0x4e')](function(_0xc66173){RpcVoiceAgentReport['create'](_0xc66173);});}else{RpcVoiceAgentReport['create'](_0xe4ecae);}};Report[_0x8428('0x1e')][_0x8428('0x1a')]=function(_0x41a2e1){RpcVoiceDialReport[_0x8428('0x2f')](_0x41a2e1);var _0x46ae74;var _0x343b45;var _0x521d51=_0x41a2e1[_0x8428('0x32')];if(_['startsWith'](_0x521d51,_0x8428('0x4f'))){_0x343b45=_0x521d51[_0x8428('0x50')](_0x521d51[_0x8428('0x51')]('/')+0x1,_0x521d51['indexOf']('@'));_0x46ae74=_[_0x8428('0x20')](this[_0x8428('0xe')],function(_0x4c8b85){return _0x4c8b85['mobile']==_0x343b45||_0x4c8b85[_0x8428('0x52')]==_0x343b45||_0x4c8b85['accountcode']==_0x343b45;});}else{_0x343b45=_0x521d51[_0x8428('0x50')](_0x521d51[_0x8428('0x51')]('/')+0x1,_0x521d51[_0x8428('0x53')]('-'));_0x46ae74=this[_0x8428('0x1f')](_0x343b45);}if(_0x46ae74){_0x41a2e1['interface']=_['isNil'](_0x46ae74['interface'])?util[_0x8428('0x29')]('SIP/%s',_0x46ae74['name']):_0x46ae74['interface'];_0x41a2e1[_0x8428('0x4c')]=_0x46ae74[_0x8428('0x25')];_0x41a2e1[_0x8428('0x21')]=_0x46ae74['accountcode'];RpcMemberReport['voiceDialReport'](_0x41a2e1);}};Report[_0x8428('0x1e')][_0x8428('0x1c')]=function(_0x167cf6){RpcVoiceTransferReport[_0x8428('0x43')][_0x167cf6[_0x8428('0x54')]]=_0x167cf6;};Report[_0x8428('0x1e')][_0x8428('0x1d')]=function(_0x1e9b82){RpcVoiceTransferReport[_0x8428('0x1d')](_0x1e9b82);};module[_0x8428('0x55')]=Report; \ No newline at end of file +var _0xbe61=['../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','format','SIP/%s','length','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','queuecallerexit','YYYY-MM-DD\x20HH:mm:ss','voiceQueueReport','match','keys','getCallType','channel','split','getAgentByInternal','outbound','destination','exten','dialer','lastapplication','lastdata','queue','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','calleridnum','originatecalleridnum','destinationchannel','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','linkedid','transfers','transfereelinkedid','type','UserId','membername','create','monitor','monitorFilename','filename','createdAt','monitors','connectedlinenum','connectedlinename','isArray','startsWith','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','util','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport'];(function(_0x59b149,_0x49256e){var _0x3faa99=function(_0xf8d997){while(--_0xf8d997){_0x59b149['push'](_0x59b149['shift']());}};_0x3faa99(++_0x49256e);}(_0xbe61,0x1d1));var _0x1be6=function(_0x345695,_0x2ba140){_0x345695=_0x345695-0x0;var _0x5002d3=_0xbe61[_0x345695];return _0x5002d3;};'use strict';var _=require(_0x1be6('0x0'));var moment=require('moment');var util=require(_0x1be6('0x1'));var config=require('../../../config/environment');var ami=require(_0x1be6('0x2'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x1be6('0x3'));var RpcVoiceDialReport=require(_0x1be6('0x4'));var RpcMemberReport=require(_0x1be6('0x5'));var RpcVoiceQueueReport=require(_0x1be6('0x6'));var RpcVoiceRecording=require(_0x1be6('0x7'));var RpcVoiceTransferReport=require(_0x1be6('0x8'));var VoiceQueueReport=require(_0x1be6('0x9'));var VoiceCallReport=require(_0x1be6('0xa'));var VoiceAgentReport=require(_0x1be6('0xb'));var VoiceDialReport=require(_0x1be6('0xc'));var UserReport=require('./userReport');function Report(_0x12e56c){this[_0x1be6('0xd')]=_0x12e56c;this[_0x1be6('0xe')]=_0x12e56c[_0x1be6('0xe')];this[_0x1be6('0xf')]=_0x12e56c[_0x1be6('0xf')];}Report[_0x1be6('0x10')][_0x1be6('0x11')]=function(_0x371b11){var _0xec4679=new VoiceQueueReport(this[_0x1be6('0xd')]);var _0x4b22d3=new VoiceAgentReport(this[_0x1be6('0xd')]);var _0x4734a2=new VoiceDialReport(this[_0x1be6('0xd')]);var _0x403949=new VoiceCallReport(this[_0x1be6('0xd')]);var _0x1746dd=new UserReport(this[_0x1be6('0xd')]);if(config[_0x1be6('0x12')]&&config[_0x1be6('0x12')]['disabled']){ami['on'](_0x1be6('0x13'),this['voiceQueueReport'][_0x1be6('0x14')](this));ami['on'](_0x1be6('0x15'),this[_0x1be6('0x16')][_0x1be6('0x14')](this));ami['on'](_0x1be6('0x17'),this[_0x1be6('0x18')][_0x1be6('0x14')](this));ami['on'](_0x1be6('0x19'),this[_0x1be6('0x1a')][_0x1be6('0x14')](this));ami['on']('blindtransfer',this[_0x1be6('0x1b')][_0x1be6('0x14')](this));ami['on'](_0x1be6('0x1c'),this[_0x1be6('0x1d')]['bind'](this));}};Report[_0x1be6('0x10')][_0x1be6('0x1e')]=function(_0x18db41){var _0x874aaf;_0x874aaf=_[_0x1be6('0x1f')](this[_0x1be6('0xe')],function(_0x24d82d){return _0x24d82d[_0x1be6('0x20')]==_0x18db41||_0x24d82d[_0x1be6('0x21')]==_0x18db41;});if(_[_0x1be6('0x22')](_0x874aaf)){var _0x3b558b=_[_0x1be6('0x1f')](this[_0x1be6('0xf')],function(_0x46a805){return _0x46a805[_0x1be6('0x20')]==_0x18db41||_0x46a805[_0x1be6('0x21')]==_0x18db41;});if(_0x3b558b){_0x874aaf=_['find'](this[_0x1be6('0xe')],function(_0x210c7d){return _0x210c7d['interface']==util[_0x1be6('0x23')](_0x1be6('0x24'),_0x3b558b[_0x1be6('0x21')]);});}}return _0x874aaf;};Report[_0x1be6('0x10')]['voiceQueueReport']=function(_0x53ff96){for(var _0x1da8e3=0x0;_0x1da8e3<_0x53ff96[_0x1be6('0x25')];_0x1da8e3+=0x1){var _0x1f20af=this['findAgent'](_0x53ff96[_0x1da8e3]['connectedlinenum']);if(_0x1f20af){_0x53ff96[_0x1da8e3][_0x1be6('0x20')]=_0x1f20af[_0x1be6('0x20')];_0x53ff96[_0x1da8e3]['assigned']=!![];_0x53ff96[_0x1da8e3][_0x1be6('0x26')]=_0x1f20af['name'];_0x53ff96[_0x1da8e3]['interface']=_[_0x1be6('0x22')](_0x1f20af['interface'])?util[_0x1be6('0x23')](_0x1be6('0x24'),_0x1f20af[_0x1be6('0x21')]):_0x1f20af[_0x1be6('0x27')];if(_0x53ff96[_0x1da8e3][_0x1be6('0x28')]){_0x53ff96[_0x1da8e3][_0x1be6('0x29')]=moment()[_0x1be6('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x53ff96[_0x1da8e3][_0x1be6('0x2a')]){_0x53ff96[_0x1da8e3]['queuecallerexitAt']=moment()[_0x1be6('0x23')](_0x1be6('0x2b'));}RpcMemberReport[_0x1be6('0x2c')](_0x53ff96[_0x1da8e3]);}RpcVoiceQueueReport['create'](_0x53ff96[_0x1da8e3]);}};function extractCalleridNumber(_0x11ef40){var _0x273e4b=_0x11ef40[_0x1be6('0x2d')](/<(.*?)>/);return _0x273e4b?_0x273e4b[0x1]:_0x11ef40;}Report[_0x1be6('0x10')]['getAgentByInternal']=function(_0x591d16){for(var _0x53ace0=0x0;_0x53ace00x0?_0x43b2b5:0x0;this[_0xb92d('0x11')][_0x2a23b7[_0xb92d('0x66')]][_0xb92d('0x2e')]=this['voiceQueues'][_0x2a23b7[_0xb92d('0x66')]][_0xb92d('0x2e')]>_[_0xb92d('0x6a')](_0x2a23b7[_0xb92d('0x6b')])?_[_0xb92d('0x6a')](_0x2a23b7[_0xb92d('0x6b')]):this[_0xb92d('0x11')][_0x2a23b7['queue']]['talking'];this[_0xb92d('0x4d')](this[_0xb92d('0x11')][_0x2a23b7[_0xb92d('0x66')]],'queuesummary');}logger[_0xb92d('0x42')](_0xb92d('0x6c'),util['inspect'](this[_0xb92d('0x11')][_0x2a23b7[_0xb92d('0x66')]],{'showHidden':![],'depth':null}));ami[_0xb92d('0x45')](_0xb92d('0x6d'),this[_0xb92d('0x11')][_0x2a23b7['queue']]);}}}catch(_0x564209){logger[_0xb92d('0x3c')](_0xb92d('0x65'),util[_0xb92d('0x3a')](_0x564209,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb92d('0x32')][_0xb92d('0x17')]=function(_0x16d72a){logger[_0xb92d('0x42')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0xb92d('0x3a')](_0x16d72a,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0xb92d('0x32')][_0xb92d('0x19')]=function(_0x14543d){try{if(this[_0xb92d('0x5c')](_0x14543d)){logger[_0xb92d('0x42')](_0xb92d('0x6e'),_0x14543d['uniqueid'],util['inspect'](_0x14543d,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xb92d('0x3b')][_0x14543d['uniqueid']]))this[_0xb92d('0x3b')][_0x14543d[_0xb92d('0x4c')]]=[];if(_[_0xb92d('0x5d')](this['channels'][_0x14543d[_0xb92d('0x4c')]]))this[_0xb92d('0xf')][_0x14543d['uniqueid']]={};var _0x2601df=new QueueReport();_0x2601df[_0xb92d('0x48')]=_0x14543d['queue'];_0x2601df['type']=this[_0xb92d('0x11')][_0x2601df[_0xb92d('0x48')]]&&this[_0xb92d('0x11')][_0x2601df['name']][_0xb92d('0x4e')]?this[_0xb92d('0x11')][_0x2601df[_0xb92d('0x48')]][_0xb92d('0x4e')]||_0xb92d('0x4f'):_0xb92d('0x4f');_0x2601df[_0xb92d('0x66')]=_0x14543d['queue'];_0x2601df[_0xb92d('0x6f')]=moment()[_0xb92d('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x2601df['position']=_0x14543d[_0xb92d('0x70')];_0x2601df[_0xb92d('0x71')]=_0x14543d['count'];_0x2601df[_0xb92d('0x4c')]=_0x14543d[_0xb92d('0x4c')];_0x2601df[_0xb92d('0x72')]=this[_0xb92d('0xf')][_0x14543d[_0xb92d('0x4c')]][_0xb92d('0x72')];logger[_0xb92d('0x73')](_0xb92d('0x74'),_0x2601df[_0xb92d('0x48')],_0x2601df[_0xb92d('0x4e')]);_[_0xb92d('0x75')](_0x2601df,_[_0xb92d('0x76')](_0x14543d,_[_0xb92d('0x77')](_0x2601df)));this[_0xb92d('0x3b')][_0x14543d[_0xb92d('0x4c')]][_0xb92d('0x78')](_0x2601df);this[_0xb92d('0xf')][_0x14543d[_0xb92d('0x4c')]]=_0x2601df;this['emitVoiceQueueChannelSave'](_0x2601df,_0xb92d('0x18'));}}catch(_0x9f0cdc){logger[_0xb92d('0x3c')](_0xb92d('0x6e'),_0x14543d[_0xb92d('0x4c')],util['inspect'](_0x9f0cdc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb92d('0x32')][_0xb92d('0x1a')]=function(_0x473526){try{if(this[_0xb92d('0x5c')](_0x473526)){logger[_0xb92d('0x42')](_0xb92d('0x79'),_0x473526[_0xb92d('0x4c')],util['inspect'](_0x473526,{'showHidden':![],'depth':null}));if(this[_0xb92d('0x3b')][_0x473526[_0xb92d('0x4c')]]){var _0x217c4f=_[_0xb92d('0x7a')](this[_0xb92d('0x3b')][_0x473526[_0xb92d('0x4c')]]);_0x217c4f[_0xb92d('0x7b')]=![];_0x217c4f[_0xb92d('0x7c')]=null;_0x217c4f[_0xb92d('0x7d')]=_0x473526['holdtime'];_0x217c4f[_0xb92d('0x7e')]=_0x473526[_0xb92d('0x7e')];_0x217c4f[_0xb92d('0x7f')]=!![];_0x217c4f['queuecallerabandonAt']=moment()[_0xb92d('0x46')](_0xb92d('0x80'));_0x217c4f[_0xb92d('0x81')]=_0xb92d('0x82');_0x217c4f[_0xb92d('0x83')]=null;logger[_0xb92d('0x73')](_0xb92d('0x84'),_0x217c4f['name'],_0x217c4f[_0xb92d('0x4e')]);this[_0xb92d('0xf')][_0x473526[_0xb92d('0x4c')]]=_0x217c4f;this['emitVoiceQueueChannelRemove'](_0x217c4f,_0xb92d('0x7f'));}}}catch(_0x3f3b80){logger[_0xb92d('0x3c')](_0xb92d('0x79'),_0x473526['uniqueid'],util['inspect'](_0x3f3b80,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb92d('0x32')]['syncQueueCallerLeave']=function(_0x46224e){try{if(this[_0xb92d('0x5c')](_0x46224e)){logger[_0xb92d('0x42')](_0xb92d('0x85'),_0x46224e['uniqueid'],util[_0xb92d('0x3a')](_0x46224e,{'showHidden':![],'depth':null}));if(this[_0xb92d('0x3b')][_0x46224e[_0xb92d('0x4c')]]){var _0x24310e=_[_0xb92d('0x7a')](this[_0xb92d('0x3b')][_0x46224e[_0xb92d('0x4c')]]);_0x24310e[_0xb92d('0x86')]=moment()[_0xb92d('0x46')](_0xb92d('0x80'));_0x24310e['connectedlinenum']=_0x46224e[_0xb92d('0x87')];_0x24310e[_0xb92d('0x88')]=_0x46224e[_0xb92d('0x88')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x24310e['name'],_0x24310e[_0xb92d('0x4e')],_0x46224e['connectedlinenum'],_0x46224e[_0xb92d('0x88')]);this['channels'][_0x46224e[_0xb92d('0x4c')]]=_0x24310e;this[_0xb92d('0x41')](_0x24310e,'queuecallerleave');}}}catch(_0x43697a){logger[_0xb92d('0x3c')]('[%s][voiceQueueReport][queuecallerleave]',_0x46224e['uniqueid'],util[_0xb92d('0x3a')](_0x43697a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x5075a3){try{if(this[_0xb92d('0x5c')](_0x5075a3)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x5075a3[_0xb92d('0x4c')],util[_0xb92d('0x3a')](_0x5075a3,{'showHidden':![],'depth':null}));if(this[_0xb92d('0x3b')][_0x5075a3[_0xb92d('0x4c')]]){var _0xc1eedd=_[_0xb92d('0x7a')](this['queueReports'][_0x5075a3[_0xb92d('0x4c')]]);_0xc1eedd['queuecallercomplete']=!![];_0xc1eedd[_0xb92d('0x81')]=_0xb92d('0x89');logger[_0xb92d('0x73')](_0xb92d('0x8a'),_0xc1eedd[_0xb92d('0x48')],_0xc1eedd['type']);}}}catch(_0x315cba){logger[_0xb92d('0x3c')](_0xb92d('0x8b'),_0x5075a3[_0xb92d('0x4c')],util[_0xb92d('0x3a')](_0x315cba,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb92d('0x32')][_0xb92d('0x1d')]=function(_0x577525){try{if(this[_0xb92d('0x5c')](_0x577525)){logger[_0xb92d('0x42')]('[%s][voiceQueueReport][agentcomplete]',_0x577525[_0xb92d('0x4c')],util[_0xb92d('0x3a')](_0x577525,{'showHidden':![],'depth':null}));if(this[_0xb92d('0x3b')][_0x577525[_0xb92d('0x4c')]]){var _0x258663=_['last'](this[_0xb92d('0x3b')][_0x577525[_0xb92d('0x4c')]]);_0x258663[_0xb92d('0x7f')]=![];_0x258663[_0xb92d('0x8c')]=null;_0x258663[_0xb92d('0x8d')]=!![];_0x258663[_0xb92d('0x83')]=_0x577525['membername'];_0x258663[_0xb92d('0x7d')]=_0x577525[_0xb92d('0x7d')];_0x258663[_0xb92d('0x7b')]=!![];_0x258663[_0xb92d('0x8e')]=![];_0x258663[_0xb92d('0x8f')]=null;if(!_0x258663[_0xb92d('0x90')]){if(_0x577525[_0xb92d('0x91')]==_0xb92d('0x90')){_0x258663[_0xb92d('0x81')]=_0xb92d('0x92');logger[_0xb92d('0x73')](_0xb92d('0x93'),_0x258663[_0xb92d('0x48')],_0x258663[_0xb92d('0x4e')]);}else{if(_['startsWith'](_0x577525['channel'][_0xb92d('0x94')](),_0xb92d('0x95'))){if(this[_0xb92d('0x3b')][_0x577525[_0xb92d('0x96')]]){var _0x38ab1b=_[_0xb92d('0x7a')](this[_0xb92d('0x3b')][_0x577525[_0xb92d('0x96')]]);_0x38ab1b[_0xb92d('0x7b')]=![];_0x38ab1b[_0xb92d('0x8e')]=!![];_0x38ab1b[_0xb92d('0x8f')]=moment(_0x258663[_0xb92d('0x6f')])['add'](_0x577525[_0xb92d('0x7d')],'seconds')[_0xb92d('0x46')](_0xb92d('0x80'));_0x38ab1b[_0xb92d('0x81')]=_0xb92d('0x97');_0x38ab1b[_0xb92d('0x90')]=!![];_0x38ab1b['transfertype']=_0xb92d('0x98');_0x38ab1b[_0xb92d('0x99')]=_0x577525[_0xb92d('0x9a')];_0x38ab1b['transferuniqueid']=_0x577525[_0xb92d('0x4c')];logger[_0xb92d('0x73')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x38ab1b[_0xb92d('0x48')],_0x38ab1b[_0xb92d('0x4e')]);var _0x1e3a37=this[_0xb92d('0x3b')][_0x577525['linkedid']];this[_0xb92d('0x3b')][_0x577525['linkedid']]=this['queueReports'][_0x577525[_0xb92d('0x4c')]];this[_0xb92d('0x3b')][_0x577525[_0xb92d('0x4c')]]=_0x1e3a37;}}else{_0x258663['queuecallerexitreason']=_0xb92d('0x9b')+_0x577525[_0xb92d('0x91')]['toUpperCase']();logger[_0xb92d('0x73')](_0xb92d('0x9c'),_0x258663[_0xb92d('0x48')],_0x258663[_0xb92d('0x4e')],_0x258663[_0xb92d('0x81')]);}}}this['channels'][_0x577525['uniqueid']]=_0x258663;this[_0xb92d('0x4b')](_0x258663,'agentcomplete');}}}catch(_0x97690c){logger[_0xb92d('0x3c')](_0xb92d('0x9d'),_0x577525['uniqueid'],util['inspect'](_0x97690c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb92d('0x32')][_0xb92d('0x9e')]=function(_0x16d1b7){try{if(this[_0xb92d('0x5c')](_0x16d1b7)){logger['debug']('[%s][voiceQueueReport][varset]',_0x16d1b7[_0xb92d('0x4c')],util[_0xb92d('0x3a')](_0x16d1b7,{'showHidden':![],'depth':null}));this[_0xb92d('0x9f')](_0x16d1b7[_0xb92d('0x4c')],_[_0xb92d('0x77')](_0x16d1b7[_0xb92d('0xa0')])[0x0],_0x16d1b7[_0xb92d('0xa1')]);if(this[_0xb92d('0x3b')][_0x16d1b7[_0xb92d('0x4c')]]){var _0x3c2676=_[_0xb92d('0x7a')](this[_0xb92d('0x3b')][_0x16d1b7[_0xb92d('0x4c')]]);if(_0x3c2676){if(this[_0xb92d('0x5c')](_0x16d1b7[_0xb92d('0xa0')])&&this[_0xb92d('0x5c')](_0x16d1b7['variable'][_0xb92d('0xa2')])){switch(_0x16d1b7[_0xb92d('0xa1')]){case _0xb92d('0xa3'):_0x3c2676[_0xb92d('0x8e')]=![];_0x3c2676[_0xb92d('0x8f')]=null;break;case'TIMEOUT':_0x3c2676[_0xb92d('0xa4')]='timeout';_0x3c2676[_0xb92d('0x8e')]=!![];_0x3c2676[_0xb92d('0x8f')]=moment()[_0xb92d('0x46')](_0xb92d('0x80'));_0x3c2676[_0xb92d('0x86')]=moment()['format'](_0xb92d('0x80'));logger[_0xb92d('0x42')](_0xb92d('0xa5'),_0x16d1b7[_0xb92d('0x4c')],util[_0xb92d('0x3a')](_0x3c2676,{'showHidden':![],'depth':null}));ami[_0xb92d('0x45')](_0xb92d('0xa6'),_0x3c2676);break;default:_0x3c2676[_0xb92d('0x8e')]=!![];_0x3c2676[_0xb92d('0x8f')]=moment()[_0xb92d('0x46')](_0xb92d('0x80'));_0x3c2676[_0xb92d('0x86')]=moment()[_0xb92d('0x46')](_0xb92d('0x80'));}_0x3c2676[_0xb92d('0x7f')]=![];_0x3c2676[_0xb92d('0x8c')]=null;_0x3c2676[_0xb92d('0x81')]=_0x16d1b7[_0xb92d('0xa1')];this[_0xb92d('0xf')][_0x16d1b7[_0xb92d('0x4c')]]=_0x3c2676;this[_0xb92d('0x4b')](_0x3c2676,_0xb92d('0x1f'));}else if(this['isNotNull'](_0x16d1b7[_0xb92d('0xa0')])&&this[_0xb92d('0x5c')](_0x16d1b7[_0xb92d('0xa0')][_0xb92d('0xa7')])){if(!_0x3c2676[_0xb92d('0x7f')]){_0x3c2676[_0xb92d('0x8e')]=!![];_0x3c2676['queuecallerexitAt']=moment()[_0xb92d('0x46')](_0xb92d('0x80'));_0x3c2676[_0xb92d('0x81')]=_0xb92d('0xa8');_0x3c2676[_0xb92d('0x86')]=moment()[_0xb92d('0x46')](_0xb92d('0x80'));this[_0xb92d('0xf')][_0x16d1b7[_0xb92d('0x4c')]]=_0x3c2676;}}logger['info'](_0xb92d('0xa9'),_0x16d1b7[_0xb92d('0x4c')],_0x3c2676['name'],_0x3c2676['type'],_['keys'](_0x16d1b7[_0xb92d('0xa0')])[0x0],_0x16d1b7[_0xb92d('0xa1')]);_0x3c2676['variables']=this['variables'][_0x16d1b7[_0xb92d('0x4c')]];}}}}catch(_0x23d9b9){logger[_0xb92d('0x3c')](_0xb92d('0xaa'),_0x16d1b7[_0xb92d('0x4c')],util[_0xb92d('0x3a')](_0x23d9b9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x1dc484,_0x375944,_0x55279e){var _0x261f93=[_0xb92d('0xab'),'rtpaudioqosbridged',_0xb92d('0xac'),_0xb92d('0xad'),'rtpaudioqosloss',_0xb92d('0xae'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0xb92d('0xaf'),'sipuri',_0xb92d('0xb0'),_0xb92d('0xb1'),_0xb92d('0xb2'),_0xb92d('0xb3'),_0xb92d('0xb4'),_0xb92d('0xb5'),_0xb92d('0xb6'),'memberpenalty',_0xb92d('0xb7')];if(!_[_0xb92d('0xb8')](_0x375944)&&!_[_0xb92d('0xb9')](_0x261f93,_0x375944)){if(_[_0xb92d('0x5d')](this[_0xb92d('0x13')][_0x1dc484])){this[_0xb92d('0x13')][_0x1dc484]={};}this[_0xb92d('0x13')][_0x1dc484][_0x375944]=_0x55279e;}};VoiceQueueReport[_0xb92d('0x32')][_0xb92d('0x20')]=function(_0x30a544){try{if(this[_0xb92d('0x5c')](_0x30a544)){logger['debug'](_0xb92d('0xba'),_0x30a544[_0xb92d('0x4c')],util['inspect'](_0x30a544,{'showHidden':![],'depth':null}));if(this[_0xb92d('0x3b')][_0x30a544[_0xb92d('0x4c')]]){for(var _0x3ec1d5=0x0,_0x54e5be={};_0x3ec1d50x0?_0x5d3c59:0x0;this[_0x528a('0x14')][_0x5a4a29[_0x528a('0x6a')]][_0x528a('0x70')]=this[_0x528a('0x14')][_0x5a4a29[_0x528a('0x6a')]][_0x528a('0x70')]>_[_0x528a('0x6d')](_0x5a4a29[_0x528a('0x72')])?_[_0x528a('0x6d')](_0x5a4a29[_0x528a('0x72')]):this[_0x528a('0x14')][_0x5a4a29[_0x528a('0x6a')]][_0x528a('0x70')];this[_0x528a('0x52')](this['voiceQueues'][_0x5a4a29[_0x528a('0x6a')]],_0x528a('0x17'));}logger[_0x528a('0x60')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util['inspect'](this['voiceQueues'][_0x5a4a29[_0x528a('0x6a')]],{'showHidden':![],'depth':null}));ami[_0x528a('0x45')](_0x528a('0x73'),this[_0x528a('0x14')][_0x5a4a29[_0x528a('0x6a')]]);}}}catch(_0x3aa52c){logger[_0x528a('0x3f')]('[voiceQueueReport][queuesummary]',util[_0x528a('0x3d')](_0x3aa52c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x528a('0x18')]=function(_0x1b8b3a){logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x1b8b3a,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0x528a('0xd')][_0x528a('0x19')]=function(_0x177e8a){try{if(this[_0x528a('0x63')](_0x177e8a)){logger[_0x528a('0x60')](_0x528a('0x74'),_0x177e8a[_0x528a('0x48')],util[_0x528a('0x3d')](_0x177e8a,{'showHidden':![],'depth':null}));if(_[_0x528a('0x64')](this[_0x528a('0x11')][_0x177e8a[_0x528a('0x48')]]))this[_0x528a('0x11')][_0x177e8a[_0x528a('0x48')]]=[];if(_['isUndefined'](this[_0x528a('0x34')][_0x177e8a[_0x528a('0x48')]]))this[_0x528a('0x34')][_0x177e8a[_0x528a('0x48')]]={};var _0x15862d=new QueueReport();_0x15862d[_0x528a('0x55')]=_0x177e8a['queue'];_0x15862d[_0x528a('0x53')]=this[_0x528a('0x14')][_0x15862d[_0x528a('0x55')]]&&this[_0x528a('0x14')][_0x15862d['name']][_0x528a('0x53')]?this[_0x528a('0x14')][_0x15862d[_0x528a('0x55')]]['type']||_0x528a('0x54'):_0x528a('0x54');_0x15862d[_0x528a('0x6a')]=_0x177e8a[_0x528a('0x6a')];_0x15862d[_0x528a('0x75')]=moment()[_0x528a('0x49')](_0x528a('0x76'));_0x15862d[_0x528a('0x77')]=_0x177e8a[_0x528a('0x77')];_0x15862d[_0x528a('0x78')]=_0x177e8a[_0x528a('0x78')];_0x15862d[_0x528a('0x48')]=_0x177e8a['uniqueid'];_0x15862d[_0x528a('0x79')]=this[_0x528a('0x34')][_0x177e8a[_0x528a('0x48')]][_0x528a('0x79')];logger['info'](_0x528a('0x7a'),_0x15862d[_0x528a('0x55')],_0x15862d[_0x528a('0x53')]);_[_0x528a('0x7b')](_0x15862d,_[_0x528a('0x7c')](_0x177e8a,_[_0x528a('0x7d')](_0x15862d)));this['queueReports'][_0x177e8a[_0x528a('0x48')]]['push'](_0x15862d);this['channels'][_0x177e8a[_0x528a('0x48')]]=_0x15862d;this[_0x528a('0x46')](_0x15862d,_0x528a('0x7e'));}}catch(_0x93f7db){logger['error'](_0x528a('0x74'),_0x177e8a[_0x528a('0x48')],util['inspect'](_0x93f7db,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x528a('0xd')][_0x528a('0x1c')]=function(_0x4b12b2){try{if(this[_0x528a('0x63')](_0x4b12b2)){logger['debug'](_0x528a('0x7f'),_0x4b12b2[_0x528a('0x48')],util[_0x528a('0x3d')](_0x4b12b2,{'showHidden':![],'depth':null}));if(this[_0x528a('0x11')][_0x4b12b2['uniqueid']]){var _0x35af17=_[_0x528a('0x80')](this[_0x528a('0x11')][_0x4b12b2['uniqueid']]);_0x35af17['queuecallercomplete']=![];_0x35af17[_0x528a('0x81')]=null;_0x35af17['holdtime']=_0x4b12b2[_0x528a('0x82')];_0x35af17[_0x528a('0x83')]=_0x4b12b2[_0x528a('0x83')];_0x35af17['queuecallerabandon']=!![];_0x35af17[_0x528a('0x84')]=moment()['format'](_0x528a('0x76'));_0x35af17[_0x528a('0x4f')]='ABANDONED';_0x35af17[_0x528a('0x85')]=null;logger[_0x528a('0x6b')](_0x528a('0x86'),_0x35af17['name'],_0x35af17[_0x528a('0x53')]);this[_0x528a('0x34')][_0x4b12b2['uniqueid']]=_0x35af17;this[_0x528a('0x43')](_0x35af17,_0x528a('0x1b'));}}}catch(_0x42c93c){logger[_0x528a('0x3f')](_0x528a('0x7f'),_0x4b12b2[_0x528a('0x48')],util[_0x528a('0x3d')](_0x42c93c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x528a('0x1e')]=function(_0x23badc){try{if(this['isNotNull'](_0x23badc)){logger[_0x528a('0x60')](_0x528a('0x87'),_0x23badc['uniqueid'],util[_0x528a('0x3d')](_0x23badc,{'showHidden':![],'depth':null}));if(this[_0x528a('0x11')][_0x23badc[_0x528a('0x48')]]){var _0x1ec7ec=_['last'](this[_0x528a('0x11')][_0x23badc[_0x528a('0x48')]]);_0x1ec7ec[_0x528a('0x88')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1ec7ec[_0x528a('0x89')]=_0x23badc['connectedlinenum'];_0x1ec7ec[_0x528a('0x8a')]=_0x23badc[_0x528a('0x8a')];logger[_0x528a('0x6b')](_0x528a('0x8b'),_0x1ec7ec[_0x528a('0x55')],_0x1ec7ec[_0x528a('0x53')],_0x23badc['connectedlinenum'],_0x23badc[_0x528a('0x8a')]);this[_0x528a('0x34')][_0x23badc[_0x528a('0x48')]]=_0x1ec7ec;this[_0x528a('0x46')](_0x1ec7ec,_0x528a('0x1d'));}}}catch(_0x1cfa74){logger[_0x528a('0x3f')](_0x528a('0x87'),_0x23badc[_0x528a('0x48')],util[_0x528a('0x3d')](_0x1cfa74,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x528a('0xd')][_0x528a('0x21')]=function(_0x28c3bb){try{if(this[_0x528a('0x63')](_0x28c3bb)){logger[_0x528a('0x60')](_0x528a('0x8c'),_0x28c3bb[_0x528a('0x48')],util['inspect'](_0x28c3bb,{'showHidden':![],'depth':null}));if(this[_0x528a('0x11')][_0x28c3bb[_0x528a('0x48')]]){var _0x17f81a=_[_0x528a('0x80')](this[_0x528a('0x11')][_0x28c3bb[_0x528a('0x48')]]);_0x17f81a[_0x528a('0x8d')]=!![];_0x17f81a['queuecallerexitreason']=_0x528a('0x8e');logger[_0x528a('0x6b')](_0x528a('0x8f'),_0x17f81a[_0x528a('0x55')],_0x17f81a[_0x528a('0x53')]);}}}catch(_0x9f7b09){logger['error'](_0x528a('0x8c'),_0x28c3bb['uniqueid'],util[_0x528a('0x3d')](_0x9f7b09,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x528a('0xd')][_0x528a('0x90')]=function(_0x4affbb){try{if(this[_0x528a('0x63')](_0x4affbb)){logger[_0x528a('0x60')](_0x528a('0x91'),_0x4affbb[_0x528a('0x48')],util[_0x528a('0x3d')](_0x4affbb,{'showHidden':![],'depth':null}));if(this[_0x528a('0x11')][_0x4affbb['uniqueid']]){var _0x3ca355=_[_0x528a('0x80')](this[_0x528a('0x11')][_0x4affbb[_0x528a('0x48')]]);_0x3ca355[_0x528a('0x1b')]=![];_0x3ca355['queuecallerabandonAt']=null;_0x3ca355['assigned']=!![];_0x3ca355[_0x528a('0x85')]=_0x4affbb[_0x528a('0x92')];_0x3ca355[_0x528a('0x82')]=_0x4affbb[_0x528a('0x82')];_0x3ca355[_0x528a('0x8d')]=!![];_0x3ca355[_0x528a('0x93')]=![];_0x3ca355[_0x528a('0x94')]=null;if(!_0x3ca355['transfer']){if(_0x4affbb[_0x528a('0x95')]=='transfer'){_0x3ca355[_0x528a('0x4f')]=_0x528a('0x96');logger['info'](_0x528a('0x97'),_0x3ca355[_0x528a('0x55')],_0x3ca355[_0x528a('0x53')]);}else{if(_[_0x528a('0x98')](_0x4affbb['channel']['toLowerCase'](),_0x528a('0x99'))){if(this['queueReports'][_0x4affbb[_0x528a('0x9a')]]){var _0x3e838a=_['last'](this[_0x528a('0x11')][_0x4affbb['linkedid']]);_0x3e838a[_0x528a('0x8d')]=![];_0x3e838a[_0x528a('0x93')]=!![];_0x3e838a[_0x528a('0x94')]=moment(_0x3ca355[_0x528a('0x75')])[_0x528a('0x9b')](_0x4affbb[_0x528a('0x82')],'seconds')[_0x528a('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x3e838a[_0x528a('0x4f')]=_0x528a('0x9c');_0x3e838a[_0x528a('0x9d')]=!![];_0x3e838a[_0x528a('0x9e')]='FORWARD';_0x3e838a[_0x528a('0x9f')]=_0x4affbb['destexten'];_0x3e838a[_0x528a('0xa0')]=_0x4affbb[_0x528a('0x48')];logger[_0x528a('0x6b')](_0x528a('0xa1'),_0x3e838a[_0x528a('0x55')],_0x3e838a[_0x528a('0x53')]);var _0x138868=this[_0x528a('0x11')][_0x4affbb['linkedid']];this['queueReports'][_0x4affbb['linkedid']]=this[_0x528a('0x11')][_0x4affbb[_0x528a('0x48')]];this['queueReports'][_0x4affbb[_0x528a('0x48')]]=_0x138868;}}else{_0x3ca355['queuecallerexitreason']=_0x528a('0xa2')+_0x4affbb[_0x528a('0x95')][_0x528a('0xa3')]();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x3ca355[_0x528a('0x55')],_0x3ca355['type'],_0x3ca355[_0x528a('0x4f')]);}}}this[_0x528a('0x34')][_0x4affbb['uniqueid']]=_0x3ca355;this[_0x528a('0x43')](_0x3ca355,_0x528a('0x1f'));}}}catch(_0x1faf49){logger[_0x528a('0x3f')]('[%s][voiceQueueReport][agentcomplete]',_0x4affbb[_0x528a('0x48')],util[_0x528a('0x3d')](_0x1faf49,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x528a('0xd')]['syncVarSet']=function(_0x2c24cc){try{if(this['isNotNull'](_0x2c24cc)){logger['debug'](_0x528a('0xa4'),_0x2c24cc[_0x528a('0x48')],util['inspect'](_0x2c24cc,{'showHidden':![],'depth':null}));this[_0x528a('0xa5')](_0x2c24cc[_0x528a('0x48')],_[_0x528a('0x7d')](_0x2c24cc[_0x528a('0xa6')])[0x0],_0x2c24cc[_0x528a('0xa7')]);if(this[_0x528a('0x11')][_0x2c24cc[_0x528a('0x48')]]){var _0x2d06d1=_['last'](this[_0x528a('0x11')][_0x2c24cc['uniqueid']]);if(_0x2d06d1){if(this['isNotNull'](_0x2c24cc[_0x528a('0xa6')])&&this[_0x528a('0x63')](_0x2c24cc['variable'][_0x528a('0xa8')])){switch(_0x2c24cc[_0x528a('0xa7')]){case _0x528a('0xa9'):_0x2d06d1[_0x528a('0x93')]=![];_0x2d06d1[_0x528a('0x94')]=null;break;case'TIMEOUT':_0x2d06d1[_0x528a('0xaa')]=_0x528a('0xab');_0x2d06d1[_0x528a('0x93')]=!![];_0x2d06d1['queuecallerexitAt']=moment()['format'](_0x528a('0x76'));_0x2d06d1[_0x528a('0x88')]=moment()[_0x528a('0x49')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x528a('0x60')](_0x528a('0xac'),_0x2c24cc[_0x528a('0x48')],util[_0x528a('0x3d')](_0x2d06d1,{'showHidden':![],'depth':null}));ami[_0x528a('0x45')](_0x528a('0xad'),_0x2d06d1);break;default:_0x2d06d1['queuecallerexit']=!![];_0x2d06d1[_0x528a('0x94')]=moment()['format'](_0x528a('0x76'));_0x2d06d1[_0x528a('0x88')]=moment()[_0x528a('0x49')](_0x528a('0x76'));}_0x2d06d1[_0x528a('0x1b')]=![];_0x2d06d1[_0x528a('0x84')]=null;_0x2d06d1[_0x528a('0x4f')]=_0x2c24cc[_0x528a('0xa7')];this[_0x528a('0x34')][_0x2c24cc[_0x528a('0x48')]]=_0x2d06d1;this[_0x528a('0x43')](_0x2d06d1,'varset');}else if(this[_0x528a('0x63')](_0x2c24cc[_0x528a('0xa6')])&&this[_0x528a('0x63')](_0x2c24cc[_0x528a('0xa6')][_0x528a('0xae')])){if(!_0x2d06d1[_0x528a('0x1b')]){_0x2d06d1[_0x528a('0x93')]=!![];_0x2d06d1[_0x528a('0x94')]=moment()[_0x528a('0x49')](_0x528a('0x76'));_0x2d06d1[_0x528a('0x4f')]=_0x528a('0xaf');_0x2d06d1[_0x528a('0x88')]=moment()[_0x528a('0x49')](_0x528a('0x76'));this[_0x528a('0x34')][_0x2c24cc['uniqueid']]=_0x2d06d1;}}logger['info'](_0x528a('0xb0'),_0x2c24cc[_0x528a('0x48')],_0x2d06d1[_0x528a('0x55')],_0x2d06d1[_0x528a('0x53')],_[_0x528a('0x7d')](_0x2c24cc[_0x528a('0xa6')])[0x0],_0x2c24cc[_0x528a('0xa7')]);_0x2d06d1[_0x528a('0x3e')]=this['variables'][_0x2c24cc['uniqueid']];}}}}catch(_0x1001ed){logger[_0x528a('0x3f')](_0x528a('0xa4'),_0x2c24cc[_0x528a('0x48')],util[_0x528a('0x3d')](_0x1001ed,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x528a('0xd')][_0x528a('0xa5')]=function(_0x4b6fdb,_0x5534ea,_0x271450){var _0x191910=[_0x528a('0xb1'),'rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x528a('0xb2'),_0x528a('0xb3'),'rtpaudioqosrtt',_0x528a('0xb4'),'sipcallid',_0x528a('0xb5'),_0x528a('0xb6'),_0x528a('0xb7'),_0x528a('0xb8'),_0x528a('0xb9'),_0x528a('0xba'),_0x528a('0xbb'),_0x528a('0x92'),_0x528a('0xbc'),'memberrealtime'];if(!_['isNil'](_0x5534ea)&&!_[_0x528a('0xbd')](_0x191910,_0x5534ea)){if(_[_0x528a('0x64')](this[_0x528a('0x3e')][_0x4b6fdb])){this[_0x528a('0x3e')][_0x4b6fdb]={};}this[_0x528a('0x3e')][_0x4b6fdb][_0x5534ea]=_0x271450;}};VoiceQueueReport[_0x528a('0xd')][_0x528a('0x25')]=function(_0x2afdf2){try{if(this[_0x528a('0x63')](_0x2afdf2)){logger[_0x528a('0x60')](_0x528a('0xbe'),_0x2afdf2[_0x528a('0x48')],util[_0x528a('0x3d')](_0x2afdf2,{'showHidden':![],'depth':null}));if(this[_0x528a('0x11')][_0x2afdf2[_0x528a('0x48')]]){for(var _0x122eed=0x0,_0x31a545={};_0x122eed=0x0?moment(_0x49788c[_0x25d2('0x1c')])[_0x25d2('0x10')](_0x49788c[_0x25d2('0x1b')],_0x25d2('0x11')):null,'data1':_0x25d2('0x1d'),'data2':_0x49788c[_0x25d2('0x15')],'data3':_0x49788c['exten'],'data4':_0x49788c['dialstring']||null,'role':'agent','internal':_0x49788c[_0x25d2('0x15')]?_[_0x25d2('0x16')](_0x49788c['accountcode']):undefined,'uniqueid':_0x49788c['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xac63=['uniqueid','voiceDialReport','membername','endtime','starttime','seconds','outbound','exten','dialstring','moment','lodash','util','../client','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','inbound','queue','agent','accountcode','toNumber'];(function(_0x4acb36,_0xf23390){var _0x1da9fa=function(_0x3aec4b){while(--_0x3aec4b){_0x4acb36['push'](_0x4acb36['shift']());}};_0x1da9fa(++_0xf23390);}(_0xac63,0x121));var _0x3ac6=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xac63[_0x20c9b2];return _0x2c6030;};'use strict';var moment=require(_0x3ac6('0x0'));var _=require(_0x3ac6('0x1'));var util=require(_0x3ac6('0x2'));var client=require(_0x3ac6('0x3'));exports['voiceQueueReport']=function(_0x48d5c4){var _0x3394d8=_0x48d5c4['queuecallercompleteAt']||_0x48d5c4['queuecallerexitAt'];return client['Request'](_0x3ac6('0x4'),{'body':{'channel':_0x3ac6('0x5'),'membername':_0x48d5c4[_0x3ac6('0x6')],'interface':_[_0x3ac6('0x7')](_0x48d5c4[_0x3ac6('0x8')])?util[_0x3ac6('0x9')](_0x3ac6('0xa'),_0x48d5c4[_0x3ac6('0x6')]):_0x48d5c4[_0x3ac6('0x8')],'type':_0x3ac6('0xb'),'enterAt':_0x48d5c4[_0x3ac6('0xc')],'exitAt':_0x3394d8,'duration':moment(_0x3394d8)[_0x3ac6('0xd')](_0x48d5c4['queuecallerleaveAt'],'seconds'),'data1':_0x3ac6('0xe'),'data2':_0x48d5c4['calleridnum'],'data3':_0x48d5c4['exten'],'data4':null,'data5':_0x48d5c4[_0x3ac6('0xf')],'role':_0x3ac6('0x10'),'internal':_0x48d5c4[_0x3ac6('0x11')]?_[_0x3ac6('0x12')](_0x48d5c4[_0x3ac6('0x11')]):undefined,'uniqueid':_0x48d5c4[_0x3ac6('0x13')]},'log':'CreateMemberReport'});};exports[_0x3ac6('0x14')]=function(_0x1e825c){return client['Request'](_0x3ac6('0x4'),{'body':{'channel':_0x3ac6('0x5'),'membername':_0x1e825c[_0x3ac6('0x15')],'interface':_0x1e825c[_0x3ac6('0x8')],'type':_0x3ac6('0xb'),'enterAt':_0x1e825c['starttime'],'exitAt':_0x1e825c['endtime'],'duration':moment(_0x1e825c[_0x3ac6('0x16')])[_0x3ac6('0xd')](_0x1e825c['starttime'],'seconds')>=0x0?moment(_0x1e825c[_0x3ac6('0x16')])[_0x3ac6('0xd')](_0x1e825c[_0x3ac6('0x17')],_0x3ac6('0x18')):null,'data1':_0x3ac6('0x19'),'data2':_0x1e825c[_0x3ac6('0x11')],'data3':_0x1e825c[_0x3ac6('0x1a')],'data4':_0x1e825c[_0x3ac6('0x1b')]||null,'role':_0x3ac6('0x10'),'internal':_0x1e825c[_0x3ac6('0x11')]?_[_0x3ac6('0x12')](_0x1e825c[_0x3ac6('0x11')]):undefined,'uniqueid':_0x1e825c[_0x3ac6('0x13')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 8627089..c1037d1 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 _0x66f4=['GetSettings','getSettings','stopRecordingOnTransfer'];(function(_0x55c334,_0x24db25){var _0x5a21e4=function(_0xce407b){while(--_0xce407b){_0x55c334['push'](_0x55c334['shift']());}};_0x5a21e4(++_0x24db25);}(_0x66f4,0x7f));var _0x466f=function(_0x2b1356,_0x43afdd){_0x2b1356=_0x2b1356-0x0;var _0x1113d9=_0x66f4[_0x2b1356];return _0x1113d9;};'use strict';var client=require('../client');exports[_0x466f('0x0')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x466f('0x1')]},'log':_0x466f('0x2')});}; \ No newline at end of file +var _0x8f9f=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','GetSettings','../client'];(function(_0x26393b,_0x449a84){var _0x57230a=function(_0x583888){while(--_0x583888){_0x26393b['push'](_0x26393b['shift']());}};_0x57230a(++_0x449a84);}(_0x8f9f,0xbf));var _0xf8f9=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x8f9f[_0x403c20];return _0x2b271a;};'use strict';var client=require(_0xf8f9('0x0'));exports[_0xf8f9('0x1')]=function(){return client[_0xf8f9('0x2')](_0xf8f9('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xf8f9('0x4')]},'log':_0xf8f9('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 69df43a..7ed1ce3 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 _0xceef=['GetTemplate','html'];(function(_0x4b3d13,_0x1993d5){var _0xf64dd8=function(_0x2304ed){while(--_0x2304ed){_0x4b3d13['push'](_0x4b3d13['shift']());}};_0xf64dd8(++_0x1993d5);}(_0xceef,0xf6));var _0xfcee=function(_0x20ceec,_0x5d61e6){_0x20ceec=_0x20ceec-0x0;var _0x567ceb=_0xceef[_0x20ceec];return _0x567ceb;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x1a0527){return function(_0x41dec2){return client['Request'](_0xfcee('0x0'),{'options':{'raw':!![],'attributes':['id','name',_0xfcee('0x1')]},'log':_0xfcee('0x0')});};}; \ No newline at end of file +var _0xc27f=['html','../client','getTemplates','Request','GetTemplate','name'];(function(_0x45ce08,_0x59dcc7){var _0x23dff2=function(_0x1ad0e5){while(--_0x1ad0e5){_0x45ce08['push'](_0x45ce08['shift']());}};_0x23dff2(++_0x59dcc7);}(_0xc27f,0x85));var _0xfc27=function(_0x372c31,_0x214d0b){_0x372c31=_0x372c31-0x0;var _0x4da9b9=_0xc27f[_0x372c31];return _0x4da9b9;};'use strict';var client=require(_0xfc27('0x0'));exports[_0xfc27('0x1')]=function(_0x12cdcf){return function(_0x550f86){return client[_0xfc27('0x2')](_0xfc27('0x3'),{'options':{'raw':!![],'attributes':['id',_0xfc27('0x4'),_0xfc27('0x5')]},'log':_0xfc27('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index e12d540..f83ed49 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 _0x6256=['data3','data4','data6','data7','../client','getTriggers','GetTrigger','name','channel','status','Condition','AllConditions','field','value','operator','action','data1','data2'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x6256,0x148));var _0x6625=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x6256[_0x4a747d];return _0x3a5b5c;};'use strict';var client=require(_0x6625('0x0'));exports[_0x6625('0x1')]=function(_0x89b498){return function(_0x378756){return client['Request'](_0x6625('0x2'),{'options':{'raw':![],'attributes':['id',_0x6625('0x3'),_0x6625('0x4'),_0x6625('0x5')],'include':[{'model':_0x6625('0x6'),'as':_0x6625('0x7'),'attributes':['id',_0x6625('0x8'),'operator',_0x6625('0x9')]},{'model':_0x6625('0x6'),'as':'AnyConditions','attributes':['id',_0x6625('0x8'),_0x6625('0xa'),_0x6625('0x9')]},{'model':'Action','as':'Actions','attributes':['id',_0x6625('0xb'),_0x6625('0xc'),_0x6625('0xd'),_0x6625('0xe'),_0x6625('0xf'),'data5',_0x6625('0x10'),_0x6625('0x11')]}]},'log':_0x6625('0x2')});};}; \ No newline at end of file +var _0x3e01=['data3','data5','data6','GetTrigger','../client','Request','name','channel','status','AllConditions','operator','value','Condition','field','Action','action','data1','data2'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e01,0xb8));var _0x13e0=function(_0x1a6503,_0x451688){_0x1a6503=_0x1a6503-0x0;var _0x290147=_0x3e01[_0x1a6503];return _0x290147;};'use strict';var client=require(_0x13e0('0x0'));exports['getTriggers']=function(_0x662a92){return function(_0x33d9e6){return client[_0x13e0('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x13e0('0x2'),_0x13e0('0x3'),_0x13e0('0x4')],'include':[{'model':'Condition','as':_0x13e0('0x5'),'attributes':['id','field',_0x13e0('0x6'),_0x13e0('0x7')]},{'model':_0x13e0('0x8'),'as':'AnyConditions','attributes':['id',_0x13e0('0x9'),'operator','value']},{'model':_0x13e0('0xa'),'as':'Actions','attributes':['id',_0x13e0('0xb'),_0x13e0('0xc'),_0x13e0('0xd'),_0x13e0('0xe'),'data4',_0x13e0('0xf'),_0x13e0('0x10'),'data7']}]},'log':_0x13e0('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 8665600..932aed9 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 _0x2b3e=['Request','GetTrunk','registry','getTrunks'];(function(_0x3a8bb8,_0x5aae01){var _0x13a3e3=function(_0x1aefa6){while(--_0x1aefa6){_0x3a8bb8['push'](_0x3a8bb8['shift']());}};_0x13a3e3(++_0x5aae01);}(_0x2b3e,0x83));var _0xe2b3=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x2b3e[_0x5b561d];return _0x431060;};'use strict';var client=require('../client');exports[_0xe2b3('0x0')]=function(_0x5888a2){return function(_0x33d79d){return client[_0xe2b3('0x1')](_0xe2b3('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xe2b3('0x3'),'defaultuser']},'log':_0xe2b3('0x2')});};}; \ No newline at end of file +var _0xdb13=['GetTrunk','name','defaultuser','getTrunks','Request'];(function(_0x535bb0,_0x37f957){var _0x7f6904=function(_0x52431d){while(--_0x52431d){_0x535bb0['push'](_0x535bb0['shift']());}};_0x7f6904(++_0x37f957);}(_0xdb13,0x10c));var _0x3db1=function(_0x339783,_0x3e0255){_0x339783=_0x339783-0x0;var _0x8c4d86=_0xdb13[_0x339783];return _0x8c4d86;};'use strict';var client=require('../client');exports[_0x3db1('0x0')]=function(_0x366725){return function(_0x38d692){return client[_0x3db1('0x1')](_0x3db1('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x3db1('0x3'),'registry',_0x3db1('0x4')]},'log':_0x3db1('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index f10a28c..617ce3c 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x264040,_0x4f456a){var _0xc0f19d=function(_0xf796e1){while(--_0xf796e1){_0x264040['push'](_0x264040['shift']());}};_0xc0f19d(++_0x4f456a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x53b8e0,_0x55d46e){_0x53b8e0=_0x53b8e0-0x0;var _0x10630c=_0xcb91[_0x53b8e0];return _0x10630c;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xe706,0xa3));var _0x6e70=function(_0x3a33ff,_0x431390){_0x3a33ff=_0x3a33ff-0x0;var _0x214ba7=_0xe706[_0x3a33ff];return _0x214ba7;};'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 aa19e32..b910c90 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 _0xdd62=['update','UpdateVoiceAgentReport','../client','Request','CreateVoiceAgentReport'];(function(_0x1cba18,_0x4a19e3){var _0x4381ef=function(_0x4f435b){while(--_0x4f435b){_0x1cba18['push'](_0x1cba18['shift']());}};_0x4381ef(++_0x4a19e3);}(_0xdd62,0x160));var _0x2dd6=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xdd62[_0x433a86];return _0x23000c;};'use strict';var client=require(_0x2dd6('0x0'));exports['create']=function(_0x7ac5de){return client[_0x2dd6('0x1')](_0x2dd6('0x2'),{'body':_0x7ac5de,'log':'CreateVoiceAgentReport'});};exports[_0x2dd6('0x3')]=function(_0x4d2ff3,_0x54acd1,_0x1fae3e){return client[_0x2dd6('0x1')](_0x2dd6('0x4'),{'body':_0x4d2ff3,'options':{'where':{'uniqueid':_0x54acd1,'interface':_0x1fae3e,'agentcomplete':!![]}},'log':_0x2dd6('0x4')});}; \ No newline at end of file +var _0x58b7=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x46c6b0,_0x532866){var _0x5b63a1=function(_0x3af19d){while(--_0x3af19d){_0x46c6b0['push'](_0x46c6b0['shift']());}};_0x5b63a1(++_0x532866);}(_0x58b7,0x1bb));var _0x758b=function(_0x2ade0d,_0x43e77e){_0x2ade0d=_0x2ade0d-0x0;var _0x4fb8c6=_0x58b7[_0x2ade0d];return _0x4fb8c6;};'use strict';var client=require(_0x758b('0x0'));exports[_0x758b('0x1')]=function(_0x6671c6){return client[_0x758b('0x2')]('CreateVoiceAgentReport',{'body':_0x6671c6,'log':_0x758b('0x3')});};exports[_0x758b('0x4')]=function(_0x53f034,_0x317803,_0x4d9d3c){return client[_0x758b('0x2')](_0x758b('0x5'),{'body':_0x53f034,'options':{'where':{'uniqueid':_0x317803,'interface':_0x4d9d3c,'agentcomplete':!![]}},'log':_0x758b('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index a8d93db..fbbf5a2 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 _0x97bc=['calleridnum','context','callerid','getVoiceCallReports','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','duration','billableseconds','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge'];(function(_0x363cab,_0x4e6b52){var _0x3bace2=function(_0x4e7f07){while(--_0x4e7f07){_0x363cab['push'](_0x363cab['shift']());}};_0x3bace2(++_0x4e6b52);}(_0x97bc,0x8b));var _0xc97b=function(_0x53ba62,_0x4dd6ac){_0x53ba62=_0x53ba62-0x0;var _0x48ede5=_0x97bc[_0x53ba62];return _0x48ede5;};'use strict';var moment=require(_0xc97b('0x0'));var util=require(_0xc97b('0x1'));var _=require(_0xc97b('0x2'));var client=require(_0xc97b('0x3'));exports[_0xc97b('0x4')]=function(_0x46a54d){return client[_0xc97b('0x5')](_0xc97b('0x6'),{'body':_[_0xc97b('0x7')](_0x46a54d,{'source':_0x46a54d[_0xc97b('0x8')],'destinationcontext':_0x46a54d[_0xc97b('0x9')],'callerid':_0x46a54d[_0xc97b('0xa')],'amaflags':'DOCUMENTATION'}),'log':_0xc97b('0x6')});};exports[_0xc97b('0xb')]=function(){return function(){return client[_0xc97b('0x5')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xc97b('0xc')],'createdAt':{'$between':[moment()[_0xc97b('0xd')](_0xc97b('0xe'))[_0xc97b('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xc97b('0x10')](_0xc97b('0xe'))[_0xc97b('0xf')](_0xc97b('0x11'))]}},'attributes':[_0xc97b('0x12'),'disposition',_0xc97b('0x13'),_0xc97b('0x14')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x715e=['../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','YYYY-MM-DD\x20HH:mm:ss','day','format','type','disposition','billableseconds','GetVoiceCallReports','util'];(function(_0x576424,_0x243610){var _0x1160ef=function(_0x4aea4b){while(--_0x4aea4b){_0x576424['push'](_0x576424['shift']());}};_0x1160ef(++_0x243610);}(_0x715e,0x92));var _0xe715=function(_0x2dbce7,_0x57cb8d){_0x2dbce7=_0x2dbce7-0x0;var _0x3a3ed0=_0x715e[_0x2dbce7];return _0x3a3ed0;};'use strict';var moment=require('moment');var util=require(_0xe715('0x0'));var _=require('lodash');var client=require(_0xe715('0x1'));exports[_0xe715('0x2')]=function(_0x3ced40){return client[_0xe715('0x3')](_0xe715('0x4'),{'body':_[_0xe715('0x5')](_0x3ced40,{'source':_0x3ced40[_0xe715('0x6')],'destinationcontext':_0x3ced40[_0xe715('0x7')],'callerid':_0x3ced40[_0xe715('0x8')],'amaflags':_0xe715('0x9')}),'log':_0xe715('0x4')});};exports[_0xe715('0xa')]=function(){return function(){return client['Request'](_0xe715('0xb'),{'options':{'where':{'type':[_0xe715('0xc')],'createdAt':{'$between':[moment()[_0xe715('0xd')]('day')['format'](_0xe715('0xe')),moment()['endOf'](_0xe715('0xf'))[_0xe715('0x10')](_0xe715('0xe'))]}},'attributes':[_0xe715('0x11'),_0xe715('0x12'),'duration',_0xe715('0x13')]},'log':_0xe715('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 067fb34..c0ac513 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 _0x02ec=['../client','Request','CreateVoiceDialReport'];(function(_0x1e3fe2,_0x246483){var _0x2655f1=function(_0x384fd1){while(--_0x384fd1){_0x1e3fe2['push'](_0x1e3fe2['shift']());}};_0x2655f1(++_0x246483);}(_0x02ec,0x96));var _0xc02e=function(_0x5c7bab,_0x12a0be){_0x5c7bab=_0x5c7bab-0x0;var _0x30cdf3=_0x02ec[_0x5c7bab];return _0x30cdf3;};'use strict';var client=require(_0xc02e('0x0'));exports['create']=function(_0x26f4a4){return client[_0xc02e('0x1')](_0xc02e('0x2'),{'body':_0x26f4a4,'log':_0xc02e('0x2')});}; \ No newline at end of file +var _0xede5=['CreateVoiceDialReport','../client','create','Request'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xede5,0x115));var _0x5ede=function(_0x50c6a7,_0x37c251){_0x50c6a7=_0x50c6a7-0x0;var _0xf3bdab=_0xede5[_0x50c6a7];return _0xf3bdab;};'use strict';var client=require(_0x5ede('0x0'));exports[_0x5ede('0x1')]=function(_0x4d331b){return client[_0x5ede('0x2')](_0x5ede('0x3'),{'body':_0x4d331b,'log':_0x5ede('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index db5e581..5f0ad8f 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 _0xae2b=['getVoiceExtensions','GetVoiceExtension','exten','recordingFormat','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae2b,0xb3));var _0xbae2=function(_0x4d68e1,_0x417c73){_0x4d68e1=_0x4d68e1-0x0;var _0x336bea=_0xae2b[_0x4d68e1];return _0x336bea;};'use strict';var client=require(_0xbae2('0x0'));exports[_0xbae2('0x1')]=function(){return function(){return client['Request'](_0xbae2('0x2'),{'options':{'raw':!![],'attributes':['id',_0xbae2('0x3'),_0xbae2('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xbae2('0x1')});};}; \ No newline at end of file +var _0x1152=['exten','recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x35d3a8,_0x44406a){var _0x182378=function(_0x298e0b){while(--_0x298e0b){_0x35d3a8['push'](_0x35d3a8['shift']());}};_0x182378(++_0x44406a);}(_0x1152,0x182));var _0x2115=function(_0xea1bcd,_0x465e08){_0xea1bcd=_0xea1bcd-0x0;var _0xfbe4c6=_0x1152[_0xea1bcd];return _0xfbe4c6;};'use strict';var client=require(_0x2115('0x0'));exports[_0x2115('0x1')]=function(){return function(){return client[_0x2115('0x2')](_0x2115('0x3'),{'options':{'raw':!![],'attributes':['id',_0x2115('0x4'),_0x2115('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x2115('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 4bbb869..a603fda 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 _0xc7a3=['Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x4fe520,_0x20e36c){_0x4fe520=_0x4fe520-0x0;var _0x33a7f3=_0xc7a3[_0x4fe520];return _0x33a7f3;};'use strict';var client=require('../client');exports[_0x3c7a('0x0')]=function(){return function(){return client[_0x3c7a('0x1')](_0x3c7a('0x2'),{'options':{'raw':![],'attributes':['id',_0x3c7a('0x3'),_0x3c7a('0x4'),_0x3c7a('0x5'),'autopause',_0x3c7a('0x6'),_0x3c7a('0x7'),'dialActive',_0x3c7a('0x8'),_0x3c7a('0x9'),_0x3c7a('0xa'),'dialPowerLevel',_0x3c7a('0xb'),'dialPredictiveOptimizationPercentage',_0x3c7a('0xc'),'dialOriginateCallerIdName',_0x3c7a('0xd'),_0x3c7a('0xe'),_0x3c7a('0xf'),'dialQueueTimeout',_0x3c7a('0x10'),_0x3c7a('0x11'),'dialCongestionRetryFrequency',_0x3c7a('0x12'),'dialBusyRetryFrequency',_0x3c7a('0x13'),'dialNoAnswerRetryFrequency',_0x3c7a('0x14'),_0x3c7a('0x15'),_0x3c7a('0x16'),_0x3c7a('0x17'),_0x3c7a('0x18'),'dialAMDActive',_0x3c7a('0x19'),_0x3c7a('0x1a'),_0x3c7a('0x1b'),_0x3c7a('0x1c'),_0x3c7a('0x1d'),'dialAMDBetweenWordsSilence',_0x3c7a('0x1e'),_0x3c7a('0x1f'),'dialAMDMaximumWordLength','timeout',_0x3c7a('0x20'),_0x3c7a('0x21'),_0x3c7a('0x22'),'dialAgiAfterHangupAgent',_0x3c7a('0x23'),'dialQueueProject2',_0x3c7a('0x6'),_0x3c7a('0x24'),_0x3c7a('0x25'),_0x3c7a('0x26'),_0x3c7a('0x27'),_0x3c7a('0x28'),'dialDropMaxRetry',_0x3c7a('0x29'),_0x3c7a('0x2a'),_0x3c7a('0x2b'),_0x3c7a('0x2c'),_0x3c7a('0x2d'),_0x3c7a('0x2e'),_0x3c7a('0x2f'),_0x3c7a('0x30'),_0x3c7a('0x31'),'dialPredictiveIntervalMinThreshold',_0x3c7a('0x32')],'include':[{'model':'Trunk','as':_0x3c7a('0x33'),'attributes':['id','name',_0x3c7a('0x34'),_0x3c7a('0x35')]},{'model':_0x3c7a('0x36'),'as':_0x3c7a('0x37'),'attributes':['id',_0x3c7a('0x3')]},{'model':_0x3c7a('0x33'),'as':_0x3c7a('0x38'),'attributes':['id',_0x3c7a('0x3'),_0x3c7a('0x34'),_0x3c7a('0x35')]},{'model':_0x3c7a('0x39'),'as':_0x3c7a('0x39'),'attributes':['id','name'],'include':[{'model':_0x3c7a('0x39'),'as':_0x3c7a('0x3a'),'attributes':['id',_0x3c7a('0x3'),_0x3c7a('0x3b')]}]}]},'log':_0x3c7a('0x0')});};}; \ No newline at end of file +var _0xa381=['Pause','TrunkBackup','Interval','../client','getVoiceQueues','name','acw','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xa381,0x79));var _0x1a38=function(_0xa10a3f,_0x24ad3c){_0xa10a3f=_0xa10a3f-0x0;var _0x2a5321=_0xa381[_0xa10a3f];return _0x2a5321;};'use strict';var client=require(_0x1a38('0x0'));exports[_0x1a38('0x1')]=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x1a38('0x2'),_0x1a38('0x3'),_0x1a38('0x4'),'autopause',_0x1a38('0x5'),_0x1a38('0x6'),_0x1a38('0x7'),_0x1a38('0x8'),'dialLimitChannel',_0x1a38('0x9'),'dialPowerLevel','dialPredictiveOptimization',_0x1a38('0xa'),'dialPredictiveInterval',_0x1a38('0xb'),_0x1a38('0xc'),_0x1a38('0xd'),_0x1a38('0xe'),'dialQueueTimeout',_0x1a38('0xf'),_0x1a38('0x10'),_0x1a38('0x11'),_0x1a38('0x12'),_0x1a38('0x13'),_0x1a38('0x14'),_0x1a38('0x15'),_0x1a38('0x16'),_0x1a38('0x17'),_0x1a38('0x18'),_0x1a38('0x19'),_0x1a38('0x1a'),_0x1a38('0x1b'),_0x1a38('0x1c'),_0x1a38('0x1d'),_0x1a38('0x1e'),_0x1a38('0x1f'),_0x1a38('0x20'),_0x1a38('0x21'),_0x1a38('0x22'),_0x1a38('0x23'),_0x1a38('0x24'),_0x1a38('0x25'),'dialRecallMeTimeout','dialRecallInQueue',_0x1a38('0x26'),'dialAgiAfterHangupAgent',_0x1a38('0x27'),_0x1a38('0x28'),_0x1a38('0x5'),_0x1a38('0x29'),_0x1a38('0x2a'),_0x1a38('0x2b'),_0x1a38('0x2c'),_0x1a38('0x2d'),_0x1a38('0x2e'),'dialDropRetryFrequency',_0x1a38('0x2f'),'dialAbandonedRetryFrequency',_0x1a38('0x30'),_0x1a38('0x31'),'dialAgentRejectMaxRetry',_0x1a38('0x32'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x1a38('0x33'),_0x1a38('0x34')],'include':[{'model':_0x1a38('0x35'),'as':_0x1a38('0x35'),'attributes':['id','name',_0x1a38('0x36'),_0x1a38('0x37')]},{'model':_0x1a38('0x38'),'as':'mandatoryDispositionPause','attributes':['id',_0x1a38('0x2')]},{'model':_0x1a38('0x35'),'as':_0x1a38('0x39'),'attributes':['id',_0x1a38('0x2'),_0x1a38('0x36'),_0x1a38('0x37')]},{'model':_0x1a38('0x3a'),'as':_0x1a38('0x3a'),'attributes':['id',_0x1a38('0x2')],'include':[{'model':_0x1a38('0x3a'),'as':'Intervals','attributes':['id',_0x1a38('0x2'),'interval']}]}]},'log':_0x1a38('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index e565e59..a83b165 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(_0x2a930d,_0xabb30){var _0xa394de=function(_0x26be09){while(--_0x26be09){_0x2a930d['push'](_0x2a930d['shift']());}};_0xa394de(++_0xabb30);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0x15a199,_0x51aeeb){var _0x52ee8e=function(_0x34d0f6){while(--_0x34d0f6){_0x15a199['push'](_0x15a199['shift']());}};_0x52ee8e(++_0x51aeeb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 0ba5a8a..57e3e7f 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 _0x258a=['getVoiceQueueRtPauses','../client','Request','GetVoiceQueueRtPauses'];(function(_0x5ec7a6,_0x1500c6){var _0x19f55d=function(_0x49d66f){while(--_0x49d66f){_0x5ec7a6['push'](_0x5ec7a6['shift']());}};_0x19f55d(++_0x1500c6);}(_0x258a,0xe9));var _0xa258=function(_0xb5732e,_0x206ded){_0xb5732e=_0xb5732e-0x0;var _0x1a9f76=_0x258a[_0xb5732e];return _0x1a9f76;};'use strict';var client=require(_0xa258('0x0'));exports['getVoiceQueueRtPauses']=function(_0x457ef1){return function(){return client[_0xa258('0x1')](_0xa258('0x2'),{'options':{'where':{'VoiceQueueId':_0x457ef1,'paused':!![]},'raw':!![]},'log':_0xa258('0x3')});};}; \ No newline at end of file +var _0xd2c6=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x27c25f,_0x4ff5fe){var _0x2da4c4=function(_0x1f3c9a){while(--_0x1f3c9a){_0x27c25f['push'](_0x27c25f['shift']());}};_0x2da4c4(++_0x4ff5fe);}(_0xd2c6,0x187));var _0x6d2c=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xd2c6[_0x5a95fa];return _0x1a61b8;};'use strict';var client=require('../client');exports[_0x6d2c('0x0')]=function(_0x47d838){return function(){return client['Request'](_0x6d2c('0x1'),{'options':{'where':{'VoiceQueueId':_0x47d838,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 0f33c92..93793a8 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(_0x4c4ad9,_0x2e3a34){var _0x3cf2a4=function(_0x1ae284){while(--_0x1ae284){_0x4c4ad9['push'](_0x4c4ad9['shift']());}};_0x3cf2a4(++_0x2e3a34);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x4576c3,_0x451c24){var _0x279ff4=function(_0x56db9b){while(--_0x56db9b){_0x4576c3['push'](_0x4576c3['shift']());}};_0x279ff4(++_0x451c24);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 77d6f96..7c32e08 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 _0xffe5=['transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','attendedTransfer','result','origtransfererchannel','origtransferercalleridname','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode'];(function(_0x4053cf,_0x14397f){var _0x3bf960=function(_0x59ede5){while(--_0x59ede5){_0x4053cf['push'](_0x4053cf['shift']());}};_0x3bf960(++_0x14397f);}(_0xffe5,0x1ea));var _0x5ffe=function(_0x4fb7b0,_0x28a6f8){_0x4fb7b0=_0x4fb7b0-0x0;var _0x3bac65=_0xffe5[_0x4fb7b0];return _0x3bac65;};'use strict';var client=require(_0x5ffe('0x0'));exports[_0x5ffe('0x1')]={};exports[_0x5ffe('0x2')]=function(_0x5e6dd1){return client[_0x5ffe('0x3')](_0x5ffe('0x4'),{'body':{'result':_0x5e6dd1['result'],'transfererchannel':_0x5e6dd1[_0x5ffe('0x5')],'transferercalleridnum':_0x5e6dd1[_0x5ffe('0x6')],'transferercalleridname':_0x5e6dd1['transferercalleridname'],'transfererconnectedlinenum':_0x5e6dd1[_0x5ffe('0x7')],'transfererconnectedlinename':_0x5e6dd1[_0x5ffe('0x8')],'transfereraccountcode':_0x5e6dd1[_0x5ffe('0x9')],'transferercontext':_0x5e6dd1[_0x5ffe('0xa')],'transfererexten':_0x5e6dd1[_0x5ffe('0xb')],'transfererlinkedid':_0x5e6dd1['transfererlinkedid'],'transfereechannel':_0x5e6dd1[_0x5ffe('0xc')],'transfereecalleridnum':_0x5e6dd1[_0x5ffe('0xd')],'transfereecalleridname':_0x5e6dd1[_0x5ffe('0xe')],'transfereeconnectedlinenum':_0x5e6dd1['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x5e6dd1[_0x5ffe('0xf')],'transfereeaccountcode':_0x5e6dd1[_0x5ffe('0x10')],'transfereecontext':_0x5e6dd1[_0x5ffe('0x11')],'transfereeexten':_0x5e6dd1[_0x5ffe('0x12')],'transfereelinkedid':_0x5e6dd1[_0x5ffe('0x13')],'isexternal':_0x5e6dd1[_0x5ffe('0x14')],'context':_0x5e6dd1['context'],'extension':_0x5e6dd1[_0x5ffe('0x15')],'type':_0x5ffe('0x16')},'log':_0x5ffe('0x4')});};exports[_0x5ffe('0x17')]=function(_0x4bfdf3){return client[_0x5ffe('0x3')](_0x5ffe('0x4'),{'body':{'result':_0x4bfdf3[_0x5ffe('0x18')],'transfererchannel':_0x4bfdf3[_0x5ffe('0x19')],'transferercalleridnum':_0x4bfdf3['origtransferercalleridnum'],'transferercalleridname':_0x4bfdf3[_0x5ffe('0x1a')],'transfererconnectedlinenum':_0x4bfdf3['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x4bfdf3['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4bfdf3[_0x5ffe('0x1b')],'transferercontext':_0x4bfdf3[_0x5ffe('0x1c')],'transfererexten':_0x4bfdf3[_0x5ffe('0x1d')],'transfererlinkedid':_0x4bfdf3[_0x5ffe('0x1e')],'transfereechannel':_0x4bfdf3[_0x5ffe('0x1f')],'transfereecalleridnum':_0x4bfdf3[_0x5ffe('0x20')],'transfereecalleridname':_0x4bfdf3['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x4bfdf3['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x4bfdf3[_0x5ffe('0x21')],'transfereeaccountcode':_0x4bfdf3[_0x5ffe('0x22')],'transfereecontext':_0x4bfdf3['transfertargetcontext'],'transfereeexten':_0x4bfdf3[_0x5ffe('0x23')],'transfereelinkedid':_0x4bfdf3[_0x5ffe('0x24')],'isexternal':_0x4bfdf3[_0x5ffe('0x14')],'context':_0x4bfdf3[_0x5ffe('0x25')],'extension':_0x4bfdf3[_0x5ffe('0x26')],'type':'attended'},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xab9c=['transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransferercontext','secondtransfererexten','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','Request','result','transfererchannel','transferercalleridnum'];(function(_0x3ff063,_0x40c021){var _0xeb0820=function(_0x575706){while(--_0x575706){_0x3ff063['push'](_0x3ff063['shift']());}};_0xeb0820(++_0x40c021);}(_0xab9c,0x1f2));var _0xcab9=function(_0x241488,_0x2e587a){_0x241488=_0x241488-0x0;var _0x33feaf=_0xab9c[_0x241488];return _0x33feaf;};'use strict';var client=require(_0xcab9('0x0'));exports['transfers']={};exports[_0xcab9('0x1')]=function(_0x20593f){return client[_0xcab9('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x20593f[_0xcab9('0x3')],'transfererchannel':_0x20593f[_0xcab9('0x4')],'transferercalleridnum':_0x20593f[_0xcab9('0x5')],'transferercalleridname':_0x20593f[_0xcab9('0x6')],'transfererconnectedlinenum':_0x20593f[_0xcab9('0x7')],'transfererconnectedlinename':_0x20593f[_0xcab9('0x8')],'transfereraccountcode':_0x20593f[_0xcab9('0x9')],'transferercontext':_0x20593f[_0xcab9('0xa')],'transfererexten':_0x20593f[_0xcab9('0xb')],'transfererlinkedid':_0x20593f['transfererlinkedid'],'transfereechannel':_0x20593f[_0xcab9('0xc')],'transfereecalleridnum':_0x20593f[_0xcab9('0xd')],'transfereecalleridname':_0x20593f[_0xcab9('0xe')],'transfereeconnectedlinenum':_0x20593f[_0xcab9('0xf')],'transfereeconnectedlinename':_0x20593f[_0xcab9('0x10')],'transfereeaccountcode':_0x20593f[_0xcab9('0x11')],'transfereecontext':_0x20593f[_0xcab9('0x12')],'transfereeexten':_0x20593f[_0xcab9('0x13')],'transfereelinkedid':_0x20593f[_0xcab9('0x14')],'isexternal':_0x20593f['isexternal'],'context':_0x20593f['context'],'extension':_0x20593f[_0xcab9('0x15')],'type':_0xcab9('0x16')},'log':_0xcab9('0x17')});};exports[_0xcab9('0x18')]=function(_0x3e08ea){return client[_0xcab9('0x2')](_0xcab9('0x17'),{'body':{'result':_0x3e08ea['result'],'transfererchannel':_0x3e08ea[_0xcab9('0x19')],'transferercalleridnum':_0x3e08ea[_0xcab9('0x1a')],'transferercalleridname':_0x3e08ea[_0xcab9('0x1b')],'transfererconnectedlinenum':_0x3e08ea[_0xcab9('0x1c')],'transfererconnectedlinename':_0x3e08ea['secondtransfererconnectedlinename'],'transfereraccountcode':_0x3e08ea['origtransfereraccountcode'],'transferercontext':_0x3e08ea[_0xcab9('0x1d')],'transfererexten':_0x3e08ea[_0xcab9('0x1e')],'transfererlinkedid':_0x3e08ea['origtransfererlinkedid'],'transfereechannel':_0x3e08ea['transfertargetchannel'],'transfereecalleridnum':_0x3e08ea[_0xcab9('0x1f')],'transfereecalleridname':_0x3e08ea[_0xcab9('0x20')],'transfereeconnectedlinenum':_0x3e08ea[_0xcab9('0x21')],'transfereeconnectedlinename':_0x3e08ea[_0xcab9('0x22')],'transfereeaccountcode':_0x3e08ea[_0xcab9('0x23')],'transfereecontext':_0x3e08ea[_0xcab9('0x24')],'transfereeexten':_0x3e08ea[_0xcab9('0x25')],'transfereelinkedid':_0x3e08ea[_0xcab9('0x26')],'isexternal':_0x3e08ea['isexternal'],'context':_0x3e08ea[_0xcab9('0x27')],'extension':_0x3e08ea[_0xcab9('0x28')],'type':_0xcab9('0x29')},'log':_0xcab9('0x17')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index ae8c352..f48392d 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 _0xae30=['Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','find','undefined','channels','length','voicechannel','validate','map','uniqueid','channel','filename','wav','ai(mixmonitorid)','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','values','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','moment','../../../config/environment','../properties','listen','format','%s/%s','name','timers','timer','updateAcw','agents','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','keys','action','Reload'];(function(_0x18d4d4,_0x573587){var _0x437c85=function(_0x163706){while(--_0x163706){_0x18d4d4['push'](_0x18d4d4['shift']());}};_0x437c85(++_0x573587);}(_0xae30,0x10a));var _0x0ae3=function(_0x4e8d75,_0x400022){_0x4e8d75=_0x4e8d75-0x0;var _0x3329d6=_0xae30[_0x4e8d75];return _0x3329d6;};'use strict';var _=require(_0x0ae3('0x0'));var util=require(_0x0ae3('0x1'));var jayson=require(_0x0ae3('0x2'));var schema=require('validate');var BPromise=require(_0x0ae3('0x3'));var moment=require(_0x0ae3('0x4'));var config=require(_0x0ae3('0x5'));var properties=require(_0x0ae3('0x6'));var ami=require('../ami');exports[_0x0ae3('0x7')]=function(_0xcf497c,_0x38fce8,_0x7ce33e){return new BPromise(function(_0x2b8c53,_0xda3853){var _0x2b81f4={'QueuePause':function(_0x15b7e2){return new Promise(function(_0x32ea6e,_0x34e783){var _0x1bae69=util[_0x0ae3('0x8')](_0x0ae3('0x9'),'SIP',_0x15b7e2[_0x0ae3('0xa')]);if(_0xcf497c[_0x0ae3('0xb')]&&_0xcf497c['timers'][_0x1bae69]&&_0xcf497c['timers'][_0x1bae69][_0x0ae3('0xc')]){_0xcf497c[_0x0ae3('0xb')][_0x1bae69][_0x0ae3('0xd')]();}if(_0xcf497c[_0x0ae3('0xe')][_0x1bae69]){_0xcf497c['agents'][_0x1bae69]['updateStatusRealtime']({'statePause':_0x15b7e2[_0x0ae3('0xf')]?!![]:![]});}_0x32ea6e({'code':0xc8,'message':_0x0ae3('0x10')});});},'Reload':function(_0x50cee6){var _0x588a65=this;return new Promise(function(_0xa33411,_0x4993c5){if(ami[_0x0ae3('0x11')]()==![]){return _0x4993c5(_0x588a65[_0x0ae3('0x12')](0x1f4,[config[_0x0ae3('0x13')]['ip'],config[_0x0ae3('0x13')][_0x0ae3('0x14')],_0x0ae3('0x15')][_0x0ae3('0x16')]('\x20')));}_0x50cee6=_['pick'](_0x50cee6,_[_0x0ae3('0x17')](properties['module']));_0x50cee6[_0x0ae3('0x18')]=_0x0ae3('0x19');return ami[_0x0ae3('0x1a')](_0x50cee6)[_0x0ae3('0x1b')](function(_0x3fd4be){_0xa33411({'code':0xc8,'message':_0x3fd4be[_0x0ae3('0x1c')]});})[_0x0ae3('0x1d')](function(_0x1bf406){_0x4993c5(_0x588a65[_0x0ae3('0x12')](0x1f5,_0x1bf406['message']));});});},'Command':function(_0x6084a0){var _0x4b8949=this;return new Promise(function(_0x49d4b7,_0x571135){if(ami['isConnected']()==![]){return _0x571135(_0x4b8949['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x0ae3('0x14')],_0x0ae3('0x15')][_0x0ae3('0x16')]('\x20')));}_0x6084a0=_['pick'](_0x6084a0,_0x0ae3('0x1e'));_0x6084a0['action']=_0x0ae3('0x1f');return ami['Action'](_0x6084a0)['then'](function(_0x5ab18d){_0x49d4b7({'code':0xc8,'message':_0x5ab18d[_0x0ae3('0x20')]});})[_0x0ae3('0x1d')](function(_0x51e7d1){_0x571135(_0x4b8949['error'](0x1f5,_0x51e7d1['message']));});});},'VoiceQueues':function(_0x3178a4){return new Promise(function(_0x2c5fa0,_0x5a76e5){var _0x36ce4e=[];for(var _0x1613c3 in _0xcf497c[_0x0ae3('0x21')]){if(_0xcf497c['voiceQueues'][_0x0ae3('0x22')](_0x1613c3)){var _0x1f9cde=_0xcf497c[_0x0ae3('0x21')][_0x1613c3];var _0x5303f6={'id':_0x1f9cde['id'],'name':_0x1f9cde[_0x0ae3('0xa')],'strategy':_0x1f9cde[_0x0ae3('0x23')],'answered':_0x1f9cde[_0x0ae3('0x24')],'available':_0x1f9cde['available'],'loggedIn':_0x1f9cde[_0x0ae3('0x25')],'pTalking':_0x1f9cde[_0x0ae3('0x26')],'sumBillable':_0x1f9cde[_0x0ae3('0x27')],'sumDuration':_0x1f9cde[_0x0ae3('0x28')],'sumHoldTime':_0x1f9cde[_0x0ae3('0x29')]||0x0,'talking':_0x1f9cde[_0x0ae3('0x2a')],'total':_0x1f9cde[_0x0ae3('0x2b')],'type':_0x1f9cde[_0x0ae3('0x2c')],'unmanaged':_0x1f9cde[_0x0ae3('0x2d')],'abandoned':_0x1f9cde[_0x0ae3('0x2e')],'waiting':_0x1f9cde[_0x0ae3('0x2f')],'loggedInDb':_0x1f9cde[_0x0ae3('0x30')]};if(_0x1f9cde[_0x0ae3('0x2c')]===_0x0ae3('0x31')){_0x5303f6[_0x0ae3('0x32')]=_0x1f9cde['dialActive'];_0x5303f6[_0x0ae3('0x33')]=_0x1f9cde[_0x0ae3('0x33')];_0x5303f6[_0x0ae3('0x34')]=_0x1f9cde[_0x0ae3('0x34')];_0x5303f6['dialOriginateCallerIdNumber']=_0x1f9cde[_0x0ae3('0x35')];_0x5303f6[_0x0ae3('0x36')]=_0x1f9cde[_0x0ae3('0x36')];_0x5303f6[_0x0ae3('0x37')]=_0x1f9cde[_0x0ae3('0x37')];_0x5303f6[_0x0ae3('0x38')]=_0x1f9cde['temp'];_0x5303f6[_0x0ae3('0x39')]=_0x1f9cde[_0x0ae3('0x39')];_0x5303f6[_0x0ae3('0x3a')]=_0x1f9cde[_0x0ae3('0x3a')];_0x5303f6[_0x0ae3('0x3b')]=_0x1f9cde[_0x0ae3('0x3b')];_0x5303f6[_0x0ae3('0x3c')]=_0x1f9cde['outboundBusyCallsDay'];_0x5303f6['outboundCongestionCallsDay']=_0x1f9cde[_0x0ae3('0x3d')];_0x5303f6[_0x0ae3('0x3e')]=_0x1f9cde[_0x0ae3('0x3e')];_0x5303f6['outboundDropCallsDayCallersExit']=_0x1f9cde['outboundDropCallsDayCallersExit'];_0x5303f6[_0x0ae3('0x3f')]=_0x1f9cde[_0x0ae3('0x3f')];_0x5303f6[_0x0ae3('0x40')]=_0x1f9cde[_0x0ae3('0x40')];_0x5303f6[_0x0ae3('0x41')]=_0x1f9cde[_0x0ae3('0x41')];_0x5303f6[_0x0ae3('0x42')]=_0x1f9cde['outboundOriginateFailureCallsDay'];_0x5303f6[_0x0ae3('0x43')]=_0x1f9cde[_0x0ae3('0x43')];_0x5303f6[_0x0ae3('0x44')]=_0x1f9cde['outboundRejectCallsDay'];_0x5303f6['outboundUnknownCallsDay']=_0x1f9cde['outboundUnknownCallsDay'];_0x5303f6[_0x0ae3('0x45')]=_0x1f9cde[_0x0ae3('0x45')];_0x5303f6['predictiveIntervalAvgHoldtime']=_0x1f9cde[_0x0ae3('0x46')];_0x5303f6[_0x0ae3('0x47')]=_0x1f9cde[_0x0ae3('0x47')];_0x5303f6['predictiveIntervalDroppedCallsCallersExit']=_0x1f9cde[_0x0ae3('0x48')];_0x5303f6['predictiveIntervalDroppedCallsTimeout']=_0x1f9cde[_0x0ae3('0x49')];_0x5303f6[_0x0ae3('0x4a')]=_0x1f9cde['predictiveIntervalErlangCalls'];_0x5303f6[_0x0ae3('0x4b')]=_0x1f9cde[_0x0ae3('0x4b')];_0x5303f6[_0x0ae3('0x4c')]=_0x1f9cde[_0x0ae3('0x4c')];_0x5303f6[_0x0ae3('0x4d')]=_0x1f9cde['predictiveIntervalMultiplicativeFactor'];_0x5303f6['predictiveIntervalPauses']=_0x1f9cde[_0x0ae3('0x4e')];_0x5303f6[_0x0ae3('0x4f')]=_0x1f9cde['predictiveIntervalAvailable'];_0x5303f6['predictiveIntervalTotalCalls']=_0x1f9cde['predictiveIntervalTotalCalls'];_0x5303f6['message']=_0x1f9cde[_0x0ae3('0x1c')];_0x5303f6[_0x0ae3('0x50')]=_0x1f9cde[_0x0ae3('0x50')];_0x5303f6[_0x0ae3('0x51')]=_0x1f9cde[_0x0ae3('0x51')];_0x5303f6[_0x0ae3('0x52')]=_0x1f9cde[_0x0ae3('0x52')];_0x5303f6[_0x0ae3('0x53')]=_0x1f9cde[_0x0ae3('0x53')];_0x5303f6[_0x0ae3('0x54')]=_0x1f9cde['erlangBusyFactor'];_0x5303f6[_0x0ae3('0x55')]=_0x1f9cde[_0x0ae3('0x55')];_0x5303f6['startProgressive']=_0x1f9cde[_0x0ae3('0x56')];}if(_0x1f9cde[_0x0ae3('0x57')]){_0x5303f6[_0x0ae3('0x57')]={'id':_0x1f9cde[_0x0ae3('0x57')]['id'],'name':_0x1f9cde[_0x0ae3('0x57')]['name'],'active':_0x1f9cde[_0x0ae3('0x57')][_0x0ae3('0x58')],'callerid':_0x1f9cde[_0x0ae3('0x57')][_0x0ae3('0x59')]};}if(_0x1f9cde['Interval']){_0x5303f6[_0x0ae3('0x5a')]={'id':_0x1f9cde[_0x0ae3('0x5a')]['id'],'name':_0x1f9cde['Interval'][_0x0ae3('0xa')]};}_0x36ce4e[_0x0ae3('0x5b')](_0x5303f6);}}_0x2c5fa0({'count':_0x36ce4e['length'],'rows':_0x36ce4e});});},'UpdateVoiceQueue':function(_0x57d667){return new Promise(function(_0x54f628,_0x21b49f){var _0x6c24d4=_[_0x0ae3('0x5c')](_0xcf497c[_0x0ae3('0x21')],{'id':parseInt(_0x57d667['id'])});var _0x4c88fa=_['omit'](_0x57d667,['id']);if(_0x6c24d4){for(var _0xc23bb0 in _0x4c88fa){if(typeof _0x4c88fa[_0xc23bb0]!=='undefined'&&typeof _0x6c24d4[_0xc23bb0]!==_0x0ae3('0x5d')){_0x6c24d4[_0xc23bb0]=_0x4c88fa[_0xc23bb0];}}_0x54f628(_0x6c24d4);}else{_0x21b49f();}});},'VoiceChannels':function(_0x1829fa){return new Promise(function(_0x5388cf,_0x29e158){var _0x3e4bfb=_['values'](_0xcf497c[_0x0ae3('0x5e')]);_0x5388cf({'count':_0x3e4bfb[_0x0ae3('0x5f')],'rows':_0x3e4bfb});});},'VoiceChannelMixMonitor':function(_0x310956){var _0x9717b=this;return new Promise(function(_0x21853f,_0x48b52c){if(ami[_0x0ae3('0x11')]()==![]){return _0x48b52c(_0x9717b['error'](0x1f4,[config[_0x0ae3('0x13')]['ip'],config[_0x0ae3('0x13')][_0x0ae3('0x14')],_0x0ae3('0x15')][_0x0ae3('0x16')]('\x20')));}var _0x2879b8=schema(properties[_0x0ae3('0x60')])[_0x0ae3('0x61')](_0x310956);if(_0x2879b8['length']>0x0){return _0x48b52c(_0x9717b[_0x0ae3('0x12')](0x1f4,_[_0x0ae3('0x62')](_0x2879b8,_0x0ae3('0x1c'))[_0x0ae3('0x16')](',\x20')));}var _0x28e496=_[_0x0ae3('0x5c')](_0xcf497c[_0x0ae3('0x5e')],{'uniqueid':_0x310956[_0x0ae3('0x63')]});if(_0x28e496&&_0x28e496[_0x0ae3('0x64')]){var _0x21c86e=util[_0x0ae3('0x8')]('%s.%s',_0x310956[_0x0ae3('0x65')]||_0x310956['uniqueid'],_0x310956[_0x0ae3('0x8')]||_0x0ae3('0x66'));return ami[_0x0ae3('0x1a')]({'action':'MixMonitor','channel':_0x28e496['channel'],'file':_0x21c86e,'options':_0x0ae3('0x67')})['then'](function(_0x46910f){var _0x5b1543=_[_0x0ae3('0x5c')](_0x28e496[_0x0ae3('0x68')],{'filename':'/var/spool/asterisk/monitor/'+_0x21c86e[_0x0ae3('0x69')]()});if(_[_0x0ae3('0x6a')](_0x5b1543)){_0x28e496[_0x0ae3('0x68')][_0x0ae3('0x5b')]({'filename':_0x0ae3('0x6b')+_0x21c86e['toLowerCase'](),'createdAt':moment()[_0x0ae3('0x8')](_0x0ae3('0x6c')),'mixmonitorid':_0x46910f['mixmonitorid'],'status':_0x0ae3('0x6d')});}else{_0x5b1543[_0x0ae3('0x6e')]=_0x46910f['mixmonitorid'];_0x5b1543[_0x0ae3('0x6f')]=_0x0ae3('0x6d');}_0x21853f({'code':0xc8,'message':[_0x310956[_0x0ae3('0x63')],_0x0ae3('0x70'),_0x46910f[_0x0ae3('0x6e')]]['join']('\x20'),'mixmonitorid':_0x46910f[_0x0ae3('0x6e')]});})[_0x0ae3('0x1d')](function(_0x297280){_0x48b52c(_0x9717b[_0x0ae3('0x12')](0x1f5,[_0x310956[_0x0ae3('0x63')],_0x297280[_0x0ae3('0x1c')][_0x0ae3('0x69')]()]['join']('\x20')));});}else{return _0x48b52c(_0x9717b[_0x0ae3('0x12')](0x1f5,_0x0ae3('0x71')));}});},'VoiceChannelStopMixMonitor':function(_0xe32ce8){var _0x57503a=this;return new Promise(function(_0x3a99c3,_0x431c29){if(ami[_0x0ae3('0x11')]()==![]){return _0x431c29(_0x57503a[_0x0ae3('0x12')](0x1f4,[config[_0x0ae3('0x13')]['ip'],config[_0x0ae3('0x13')][_0x0ae3('0x14')],'ami\x20disconnected'][_0x0ae3('0x16')]('\x20')));}var _0x4fee8e=schema(properties['voicechannel'])['validate'](_0xe32ce8);if(_0x4fee8e[_0x0ae3('0x5f')]>0x0){return _0x431c29(_0x57503a[_0x0ae3('0x12')](0x1f4,_[_0x0ae3('0x62')](_0x4fee8e,_0x0ae3('0x1c'))[_0x0ae3('0x16')](',\x20')));}var _0x3fa612=_['find'](_0xcf497c[_0x0ae3('0x5e')],{'uniqueid':_0xe32ce8[_0x0ae3('0x63')]});if(_0x3fa612){return BPromise[_0x0ae3('0x72')]()[_0x0ae3('0x1b')](function(){if(_0x3fa612[_0x0ae3('0x64')]){return ami['Action']({'action':_0x0ae3('0x73'),'channel':_0x3fa612[_0x0ae3('0x64')],'mixmonitorid':_0xe32ce8[_0x0ae3('0x6e')]})[_0x0ae3('0x1d')](function(_0x46d905){});}})[_0x0ae3('0x1b')](function(){if(_0x3fa612['destinationchannel']){return ami['Action']({'action':'StopMixMonitor','channel':_0x3fa612[_0x0ae3('0x74')],'mixmonitorid':_0xe32ce8[_0x0ae3('0x6e')]})[_0x0ae3('0x1d')](function(_0x35402b){});}})['then'](function(_0x2f80f2){var _0x3e8ae7=_[_0x0ae3('0x5c')](_0x3fa612[_0x0ae3('0x68')],{'mixmonitorid':_0xe32ce8[_0x0ae3('0x6e')]});if(_0x3e8ae7){_0x3e8ae7[_0x0ae3('0x6f')]=_0x0ae3('0x75');}})[_0x0ae3('0x1b')](function(){var _0x3c55bd=util[_0x0ae3('0x8')](_0x0ae3('0x76'),_0xe32ce8[_0x0ae3('0x65')]||_0xe32ce8[_0x0ae3('0x63')],_0xe32ce8['format']||_0x0ae3('0x66'));var _0x30b74b=_[_0x0ae3('0x5c')](_0x3fa612[_0x0ae3('0x68')],{'filename':_0x0ae3('0x6b')+_0x3c55bd['toLowerCase']()});if(_0x30b74b){_0x30b74b[_0x0ae3('0x6f')]=_0x0ae3('0x75');}})[_0x0ae3('0x1b')](function(){_0x3a99c3({'code':0xc8,'message':[_0xe32ce8['uniqueid'],_0x0ae3('0x77')][_0x0ae3('0x16')]('\x20')});})[_0x0ae3('0x1d')](function(_0x5427b5){_0x431c29(_0x57503a['error'](0x1f5,[_0xe32ce8[_0x0ae3('0x63')],_0x5427b5[_0x0ae3('0x1c')][_0x0ae3('0x69')]()]['join']('\x20')));});}else{return _0x431c29(_0x57503a['error'](0x1f5,_0x0ae3('0x71')));}});},'VoiceQueuesChannels':function(_0x5fd458){return new Promise(function(_0x1c40f9,_0x5b6a6a){var _0xf669ae=_['values'](_0xcf497c[_0x0ae3('0x78')]);_0x1c40f9({'count':_0xf669ae[_0x0ae3('0x5f')],'rows':_0xf669ae});});},'VoiceQueuesChannel':function(_0x58e738){var _0x70df70=this;return new Promise(function(_0xa767aa,_0x45fa16){var _0x2f82be=schema(properties[_0x0ae3('0x79')])[_0x0ae3('0x61')](_0x58e738);if(_0x2f82be[_0x0ae3('0x5f')]>0x0){return _0x45fa16(_0x70df70[_0x0ae3('0x12')](0x1f4,_['map'](_0x2f82be,_0x0ae3('0x1c'))[_0x0ae3('0x16')](',\x20')));}var _0x51f0c2=_[_0x0ae3('0x5c')](_0xcf497c[_0x0ae3('0x78')],{'uniqueid':_0x58e738[_0x0ae3('0x63')]});if(_0x51f0c2){_0xa767aa(_0x51f0c2);}else{return _0x45fa16(_0x70df70[_0x0ae3('0x12')](0x1f5,_0x0ae3('0x71')));}});},'VoiceQueuesChannelHangup':function(_0x5dc6d1){var _0x7648ce=this;return new Promise(function(_0x24db7f,_0x30ceec){if(ami[_0x0ae3('0x11')]()==![]){return _0x30ceec(_0x7648ce['error'](0x1f4,[config[_0x0ae3('0x13')]['ip'],config[_0x0ae3('0x13')][_0x0ae3('0x14')],_0x0ae3('0x15')][_0x0ae3('0x16')]('\x20')));}var _0x54eed9=schema(properties[_0x0ae3('0x7a')])['validate'](_0x5dc6d1);if(_0x54eed9['length']>0x0){return _0x30ceec(_0x7648ce[_0x0ae3('0x12')](0x1f4,_[_0x0ae3('0x62')](_0x54eed9,_0x0ae3('0x1c'))[_0x0ae3('0x16')](',\x20')));}var _0x2c28d5=_['find'](_0xcf497c[_0x0ae3('0x78')],{'uniqueid':_0x5dc6d1[_0x0ae3('0x63')]});if(_0x2c28d5&&_0x2c28d5[_0x0ae3('0x64')]){return ami[_0x0ae3('0x1a')]({'action':_0x0ae3('0x7b'),'channel':_0x2c28d5[_0x0ae3('0x64')]})[_0x0ae3('0x1b')](function(_0x203507){_0x24db7f({'code':0xc8,'message':[_0x5dc6d1[_0x0ae3('0x63')],_0x203507[_0x0ae3('0x1c')][_0x0ae3('0x69')]()][_0x0ae3('0x16')]('\x20')});})[_0x0ae3('0x1d')](function(_0x573f3f){_0x30ceec(_0x7648ce[_0x0ae3('0x12')](0x1f5,[_0x5dc6d1[_0x0ae3('0x63')],_0x573f3f[_0x0ae3('0x1c')]['toLowerCase']()][_0x0ae3('0x16')]('\x20')));});}else{return _0x30ceec(_0x7648ce[_0x0ae3('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x2f2cb9){var _0x5d200a=this;return new Promise(function(_0x52734e,_0x2b80ef){if(ami[_0x0ae3('0x11')]()==![]){return _0x2b80ef(_0x5d200a[_0x0ae3('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x0ae3('0x13')][_0x0ae3('0x14')],_0x0ae3('0x15')]['join']('\x20')));}var _0x4a7d25=schema(properties[_0x0ae3('0x7c')])['validate'](_0x2f2cb9);if(_0x4a7d25['length']>0x0){return _0x2b80ef(_0x5d200a[_0x0ae3('0x12')](0x1f4,_[_0x0ae3('0x62')](_0x4a7d25,'message')[_0x0ae3('0x16')](',\x20')));}var _0x7b5612=_[_0x0ae3('0x5c')](_0xcf497c[_0x0ae3('0x78')],{'uniqueid':_0x2f2cb9[_0x0ae3('0x63')]});if(_0x7b5612&&_0x7b5612[_0x0ae3('0x64')]){return ami[_0x0ae3('0x1a')]({'action':_0x0ae3('0x7d'),'channel':_0x7b5612[_0x0ae3('0x64')],'exten':_0x2f2cb9[_0x0ae3('0x7e')],'context':_0x2f2cb9[_0x0ae3('0x7f')]||_0x7b5612['context'],'priority':0x1})[_0x0ae3('0x1b')](function(_0x4c5a53){_0x52734e({'code':0xc8,'message':[_0x2f2cb9[_0x0ae3('0x63')],_0x4c5a53[_0x0ae3('0x1c')]['toLowerCase']()]['join']('\x20')});})['catch'](function(_0x112a38){_0x2b80ef(_0x5d200a['error'](0x1f5,[_0x2f2cb9[_0x0ae3('0x63')],_0x112a38[_0x0ae3('0x1c')]['toLowerCase']()][_0x0ae3('0x16')]('\x20')));});}else{return _0x2b80ef(_0x5d200a[_0x0ae3('0x12')](0x1f5,_0x0ae3('0x71')));}});},'Agents':function(_0x984e6d){return new Promise(function(_0xe082aa,_0x6c3a5e){var _0x2fd22e=_['values'](_0xcf497c[_0x0ae3('0xe')]);_0xe082aa({'count':_0x2fd22e[_0x0ae3('0x5f')],'rows':_0x2fd22e});});},'Telephones':function(_0x5830b9){return new Promise(function(_0x45b1c3,_0x312e50){var _0x2b7476=_[_0x0ae3('0x80')](_0xcf497c[_0x0ae3('0x81')]);_0x45b1c3({'count':_0x2b7476[_0x0ae3('0x5f')],'rows':_0x2b7476});});},'Trunks':function(_0x3bb7d7){return new Promise(function(_0x515a8a,_0x511997){var _0x1578f5=_[_0x0ae3('0x80')](_0xcf497c[_0x0ae3('0x82')]);_0x515a8a({'count':_0x1578f5[_0x0ae3('0x5f')],'rows':_0x1578f5});});},'OutboundChannels':function(_0x2f1501){return new Promise(function(_0x62db9,_0x22bb41){var _0x1f7791=_[_0x0ae3('0x80')](_0xcf497c[_0x0ae3('0x83')]);_0x62db9({'count':_0x1f7791[_0x0ae3('0x5f')],'rows':_0x1f7791});});},'Outbound':function(_0x32c76f){return new Promise(function(_0x5d0ab7,_0x39f58a){_0x5d0ab7(_0xcf497c[_0x0ae3('0x31')]);});},'Campaigns':function(_0x2f22e0){return new Promise(function(_0x41a1f4,_0x1254db){var _0x21ae82=_[_0x0ae3('0x80')](_0xcf497c[_0x0ae3('0x84')]);_0x41a1f4({'count':_0x21ae82[_0x0ae3('0x5f')],'rows':_0x21ae82});});},'VoiceQueuesPreview':function(_0x58c78a){var _0x48a879=this;return new Promise(function(_0x18eab7,_0x73844){_0x38fce8[_0x0ae3('0x85')](_0x58c78a['id'])[_0x0ae3('0x1b')](function(_0x208481){_0x18eab7({'code':0xc8,'message':_0x208481[_0x0ae3('0x1c')]});})[_0x0ae3('0x1d')](function(_0x6ba898){_0x73844(_0x48a879[_0x0ae3('0x12')](0x1f4,_0x6ba898[_0x0ae3('0x1c')]));});});},'EventManager':function(_0x58c975){var _0x43be2b=this;return new Promise(function(_0x285509,_0x5a3536){if(!_0x58c975[_0x0ae3('0x86')]){return _0x5a3536(_0x43be2b[_0x0ae3('0x12')](0x1f4,_0x0ae3('0x87')));}ami[_0x0ae3('0x88')](_0x0ae3('0x89')+_0x58c975[_0x0ae3('0x86')],_0x58c975[_0x0ae3('0x1c')]);_0x285509({'code':0xc8,'message':_0x58c975});});},'FaxAccounts':function(_0x31c5e4){return new Promise(function(_0x85b38,_0x3f1ff8){var _0x599f09=_[_0x0ae3('0x80')](_0xcf497c[_0x0ae3('0x8a')]);_0x85b38({'count':_0x599f09[_0x0ae3('0x5f')],'rows':_0x599f09});});},'SendFax':function(_0x5f3b39){var _0x238925=this;return new Promise(function(_0x4de9c1,_0xe3d114){_0x7ce33e[_0x0ae3('0x8b')](_0x5f3b39)['then'](function(_0x316f50){_0x4de9c1({'code':0xc8,'message':_0x316f50['message']});})[_0x0ae3('0x1d')](function(_0x40c8ed){_0xe3d114(_0x238925[_0x0ae3('0x12')](0x1f4,_0x40c8ed[_0x0ae3('0x1c')]));});});},'CheckAfterSend':function(_0x132fdb){var _0x43e6e6=this;return new Promise(function(_0x1376dc,_0x501d9e){_0x7ce33e['checkAfterSend'](_0x132fdb)[_0x0ae3('0x1b')](function(_0x2f53ef){_0x1376dc({'code':0xc8,'message':_0x2f53ef[_0x0ae3('0x1c')]});})[_0x0ae3('0x1d')](function(_0x460354){_0x501d9e(_0x43e6e6[_0x0ae3('0x12')](0x1f4,_0x460354['message']));});});}};var _0x47f8a0=jayson[_0x0ae3('0x8c')](_0x2b81f4)[_0x0ae3('0x8d')]();_0x47f8a0['on']('error',function(_0x43cd29){return _0xda3853(_0x43cd29);});_0x47f8a0[_0x0ae3('0x7')](0x232a,_0x0ae3('0x8e'),function(){console[_0x0ae3('0x8f')](_0x0ae3('0x90'),0x232a);return _0x2b8c53(_0x0ae3('0x91')+0x232a);});});}; \ No newline at end of file +var _0xdf55=['util','validate','bluebird','../../../config/environment','../properties','../ami','format','%s/%s','timers','timer','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','join','pick','keys','action','Reload','then','message','catch','error','command','Action','content','voiceQueues','hasOwnProperty','strategy','available','loggedIn','sumBillable','sumHoldTime','total','unmanaged','waiting','loggedInDb','type','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','Interval','push','length','omit','undefined','map','channels','channel','filename','uniqueid','wav','MixMonitor','ai(mixmonitorid)','find','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','mixmonitorid','rec','status','voicechannel','resolve','StopMixMonitor','destinationchannel','stop','Channel\x20doesn\x27t\x20exist','values','voicequeuechannel','queueChannels','Redirect','exten','telephones','trunks','outboundChannels','outbound','campaigns','run','Event\x20name\x20mandatory','emit','event','checkAfterSend','http','listen','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash'];(function(_0x4976eb,_0x4b09d1){var _0x5dd7b2=function(_0x4556a2){while(--_0x4556a2){_0x4976eb['push'](_0x4976eb['shift']());}};_0x5dd7b2(++_0x4b09d1);}(_0xdf55,0x83));var _0x5df5=function(_0x4c1eec,_0x515aa1){_0x4c1eec=_0x4c1eec-0x0;var _0x5d8475=_0xdf55[_0x4c1eec];return _0x5d8475;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var jayson=require('jayson/promise');var schema=require(_0x5df5('0x2'));var BPromise=require(_0x5df5('0x3'));var moment=require('moment');var config=require(_0x5df5('0x4'));var properties=require(_0x5df5('0x5'));var ami=require(_0x5df5('0x6'));exports['listen']=function(_0x289af4,_0x417341,_0x27ec86){return new BPromise(function(_0x476e21,_0x9b8756){var _0x2b7ed9={'QueuePause':function(_0x4722a2){return new Promise(function(_0x3743f3,_0x4d43a3){var _0x338f2b=util[_0x5df5('0x7')](_0x5df5('0x8'),'SIP',_0x4722a2['name']);if(_0x289af4[_0x5df5('0x9')]&&_0x289af4['timers'][_0x338f2b]&&_0x289af4[_0x5df5('0x9')][_0x338f2b][_0x5df5('0xa')]){_0x289af4['timers'][_0x338f2b]['updateAcw']();}if(_0x289af4[_0x5df5('0xb')][_0x338f2b]){_0x289af4[_0x5df5('0xb')][_0x338f2b][_0x5df5('0xc')]({'statePause':_0x4722a2[_0x5df5('0xd')]?!![]:![]});}_0x3743f3({'code':0xc8,'message':_0x5df5('0xe')});});},'Reload':function(_0xb4a4fe){var _0x37a747=this;return new Promise(function(_0x463990,_0x52bf75){if(ami[_0x5df5('0xf')]()==![]){return _0x52bf75(_0x37a747['error'](0x1f4,[config[_0x5df5('0x10')]['ip'],config['asterisk'][_0x5df5('0x11')],_0x5df5('0x12')][_0x5df5('0x13')]('\x20')));}_0xb4a4fe=_[_0x5df5('0x14')](_0xb4a4fe,_[_0x5df5('0x15')](properties['module']));_0xb4a4fe[_0x5df5('0x16')]=_0x5df5('0x17');return ami['Action'](_0xb4a4fe)[_0x5df5('0x18')](function(_0x45813f){_0x463990({'code':0xc8,'message':_0x45813f[_0x5df5('0x19')]});})[_0x5df5('0x1a')](function(_0x215d59){_0x52bf75(_0x37a747['error'](0x1f5,_0x215d59['message']));});});},'Command':function(_0x48c824){var _0x5d8dfd=this;return new Promise(function(_0x58152a,_0x40a8f5){if(ami[_0x5df5('0xf')]()==![]){return _0x40a8f5(_0x5d8dfd[_0x5df5('0x1b')](0x1f4,[config[_0x5df5('0x10')]['ip'],config['asterisk'][_0x5df5('0x11')],_0x5df5('0x12')][_0x5df5('0x13')]('\x20')));}_0x48c824=_[_0x5df5('0x14')](_0x48c824,_0x5df5('0x1c'));_0x48c824[_0x5df5('0x16')]='Command';return ami[_0x5df5('0x1d')](_0x48c824)[_0x5df5('0x18')](function(_0x8742a7){_0x58152a({'code':0xc8,'message':_0x8742a7[_0x5df5('0x1e')]});})['catch'](function(_0x4358ba){_0x40a8f5(_0x5d8dfd[_0x5df5('0x1b')](0x1f5,_0x4358ba[_0x5df5('0x19')]));});});},'VoiceQueues':function(_0x4a544b){return new Promise(function(_0x52206d,_0x532923){var _0x357fb0=[];for(var _0x3ff82e in _0x289af4[_0x5df5('0x1f')]){if(_0x289af4[_0x5df5('0x1f')][_0x5df5('0x20')](_0x3ff82e)){var _0x1fd83c=_0x289af4[_0x5df5('0x1f')][_0x3ff82e];var _0x28723e={'id':_0x1fd83c['id'],'name':_0x1fd83c['name'],'strategy':_0x1fd83c[_0x5df5('0x21')],'answered':_0x1fd83c['answered'],'available':_0x1fd83c[_0x5df5('0x22')],'loggedIn':_0x1fd83c[_0x5df5('0x23')],'pTalking':_0x1fd83c['pTalking'],'sumBillable':_0x1fd83c[_0x5df5('0x24')],'sumDuration':_0x1fd83c['sumDuration'],'sumHoldTime':_0x1fd83c[_0x5df5('0x25')]||0x0,'talking':_0x1fd83c['talking'],'total':_0x1fd83c[_0x5df5('0x26')],'type':_0x1fd83c['type'],'unmanaged':_0x1fd83c[_0x5df5('0x27')],'abandoned':_0x1fd83c['abandoned'],'waiting':_0x1fd83c[_0x5df5('0x28')],'loggedInDb':_0x1fd83c[_0x5df5('0x29')]};if(_0x1fd83c[_0x5df5('0x2a')]==='outbound'){_0x28723e[_0x5df5('0x2b')]=_0x1fd83c[_0x5df5('0x2b')];_0x28723e[_0x5df5('0x2c')]=_0x1fd83c[_0x5df5('0x2c')];_0x28723e[_0x5df5('0x2d')]=_0x1fd83c[_0x5df5('0x2d')];_0x28723e[_0x5df5('0x2e')]=_0x1fd83c['dialOriginateCallerIdNumber'];_0x28723e['dialOriginateTimeout']=_0x1fd83c[_0x5df5('0x2f')];_0x28723e[_0x5df5('0x30')]=_0x1fd83c[_0x5df5('0x30')];_0x28723e[_0x5df5('0x31')]=_0x1fd83c[_0x5df5('0x31')];_0x28723e[_0x5df5('0x32')]=_0x1fd83c['outboundAnswerAgiCallsDay'];_0x28723e[_0x5df5('0x33')]=_0x1fd83c[_0x5df5('0x33')];_0x28723e[_0x5df5('0x34')]=_0x1fd83c[_0x5df5('0x34')];_0x28723e['outboundBusyCallsDay']=_0x1fd83c[_0x5df5('0x35')];_0x28723e['outboundCongestionCallsDay']=_0x1fd83c[_0x5df5('0x36')];_0x28723e[_0x5df5('0x37')]=_0x1fd83c['outboundDropCallsDayACS'];_0x28723e[_0x5df5('0x38')]=_0x1fd83c['outboundDropCallsDayCallersExit'];_0x28723e[_0x5df5('0x39')]=_0x1fd83c[_0x5df5('0x39')];_0x28723e[_0x5df5('0x3a')]=_0x1fd83c[_0x5df5('0x3a')];_0x28723e['outboundNoSuchCallsDay']=_0x1fd83c[_0x5df5('0x3b')];_0x28723e[_0x5df5('0x3c')]=_0x1fd83c[_0x5df5('0x3c')];_0x28723e[_0x5df5('0x3d')]=_0x1fd83c['outboundReCallsDay'];_0x28723e[_0x5df5('0x3e')]=_0x1fd83c[_0x5df5('0x3e')];_0x28723e[_0x5df5('0x3f')]=_0x1fd83c[_0x5df5('0x3f')];_0x28723e[_0x5df5('0x40')]=_0x1fd83c[_0x5df5('0x40')];_0x28723e[_0x5df5('0x41')]=_0x1fd83c['predictiveIntervalAvgHoldtime'];_0x28723e[_0x5df5('0x42')]=_0x1fd83c[_0x5df5('0x42')];_0x28723e['predictiveIntervalDroppedCallsCallersExit']=_0x1fd83c[_0x5df5('0x43')];_0x28723e[_0x5df5('0x44')]=_0x1fd83c['predictiveIntervalDroppedCallsTimeout'];_0x28723e[_0x5df5('0x45')]=_0x1fd83c[_0x5df5('0x45')];_0x28723e[_0x5df5('0x46')]=_0x1fd83c[_0x5df5('0x46')];_0x28723e[_0x5df5('0x47')]=_0x1fd83c[_0x5df5('0x47')];_0x28723e[_0x5df5('0x48')]=_0x1fd83c[_0x5df5('0x48')];_0x28723e['predictiveIntervalPauses']=_0x1fd83c['predictiveIntervalPauses'];_0x28723e[_0x5df5('0x49')]=_0x1fd83c['predictiveIntervalAvailable'];_0x28723e[_0x5df5('0x4a')]=_0x1fd83c[_0x5df5('0x4a')];_0x28723e['message']=_0x1fd83c[_0x5df5('0x19')];_0x28723e[_0x5df5('0x4b')]=_0x1fd83c[_0x5df5('0x4b')];_0x28723e[_0x5df5('0x4c')]=_0x1fd83c[_0x5df5('0x4c')];_0x28723e[_0x5df5('0x4d')]=_0x1fd83c[_0x5df5('0x4d')];_0x28723e[_0x5df5('0x4e')]=_0x1fd83c['erlangAbandonmentRate'];_0x28723e[_0x5df5('0x4f')]=_0x1fd83c['erlangBusyFactor'];_0x28723e[_0x5df5('0x50')]=_0x1fd83c[_0x5df5('0x50')];_0x28723e[_0x5df5('0x51')]=_0x1fd83c[_0x5df5('0x51')];}if(_0x1fd83c[_0x5df5('0x52')]){_0x28723e['Trunk']={'id':_0x1fd83c[_0x5df5('0x52')]['id'],'name':_0x1fd83c[_0x5df5('0x52')][_0x5df5('0x53')],'active':_0x1fd83c['Trunk'][_0x5df5('0x54')],'callerid':_0x1fd83c[_0x5df5('0x52')]['callerid']};}if(_0x1fd83c[_0x5df5('0x55')]){_0x28723e[_0x5df5('0x55')]={'id':_0x1fd83c[_0x5df5('0x55')]['id'],'name':_0x1fd83c[_0x5df5('0x55')]['name']};}_0x357fb0[_0x5df5('0x56')](_0x28723e);}}_0x52206d({'count':_0x357fb0[_0x5df5('0x57')],'rows':_0x357fb0});});},'UpdateVoiceQueue':function(_0x514fd8){return new Promise(function(_0x18d22c,_0xaf1598){var _0x35927b=_['find'](_0x289af4[_0x5df5('0x1f')],{'id':parseInt(_0x514fd8['id'])});var _0x3842d0=_[_0x5df5('0x58')](_0x514fd8,['id']);if(_0x35927b){for(var _0x2724e3 in _0x3842d0){if(typeof _0x3842d0[_0x2724e3]!=='undefined'&&typeof _0x35927b[_0x2724e3]!==_0x5df5('0x59')){_0x35927b[_0x2724e3]=_0x3842d0[_0x2724e3];}}_0x18d22c(_0x35927b);}else{_0xaf1598();}});},'VoiceChannels':function(_0xcdf101){return new Promise(function(_0x2eb30e,_0x3bbb73){var _0x14f9ca=_['values'](_0x289af4['channels']);_0x2eb30e({'count':_0x14f9ca[_0x5df5('0x57')],'rows':_0x14f9ca});});},'VoiceChannelMixMonitor':function(_0x5b12f1){var _0x35ad9d=this;return new Promise(function(_0x207498,_0x2f43bf){if(ami[_0x5df5('0xf')]()==![]){return _0x2f43bf(_0x35ad9d['error'](0x1f4,[config[_0x5df5('0x10')]['ip'],config[_0x5df5('0x10')][_0x5df5('0x11')],_0x5df5('0x12')][_0x5df5('0x13')]('\x20')));}var _0x2a25fe=schema(properties['voicechannel'])[_0x5df5('0x2')](_0x5b12f1);if(_0x2a25fe['length']>0x0){return _0x2f43bf(_0x35ad9d[_0x5df5('0x1b')](0x1f4,_[_0x5df5('0x5a')](_0x2a25fe,_0x5df5('0x19'))['join'](',\x20')));}var _0x8622f4=_['find'](_0x289af4[_0x5df5('0x5b')],{'uniqueid':_0x5b12f1['uniqueid']});if(_0x8622f4&&_0x8622f4[_0x5df5('0x5c')]){var _0x2e9b93=util[_0x5df5('0x7')]('%s.%s',_0x5b12f1[_0x5df5('0x5d')]||_0x5b12f1[_0x5df5('0x5e')],_0x5b12f1['format']||_0x5df5('0x5f'));return ami[_0x5df5('0x1d')]({'action':_0x5df5('0x60'),'channel':_0x8622f4[_0x5df5('0x5c')],'file':_0x2e9b93,'options':_0x5df5('0x61')})[_0x5df5('0x18')](function(_0x16fc86){var _0x48087d=_[_0x5df5('0x62')](_0x8622f4['monitors'],{'filename':_0x5df5('0x63')+_0x2e9b93[_0x5df5('0x64')]()});if(_[_0x5df5('0x65')](_0x48087d)){_0x8622f4[_0x5df5('0x66')][_0x5df5('0x56')]({'filename':_0x5df5('0x63')+_0x2e9b93[_0x5df5('0x64')](),'createdAt':moment()[_0x5df5('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x16fc86[_0x5df5('0x67')],'status':_0x5df5('0x68')});}else{_0x48087d[_0x5df5('0x67')]=_0x16fc86[_0x5df5('0x67')];_0x48087d[_0x5df5('0x69')]='rec';}_0x207498({'code':0xc8,'message':[_0x5b12f1[_0x5df5('0x5e')],'MixMonitor\x20Success',_0x16fc86['mixmonitorid']][_0x5df5('0x13')]('\x20'),'mixmonitorid':_0x16fc86[_0x5df5('0x67')]});})[_0x5df5('0x1a')](function(_0x210ad2){_0x2f43bf(_0x35ad9d[_0x5df5('0x1b')](0x1f5,[_0x5b12f1[_0x5df5('0x5e')],_0x210ad2['message'][_0x5df5('0x64')]()][_0x5df5('0x13')]('\x20')));});}else{return _0x2f43bf(_0x35ad9d['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x7fdce7){var _0x2e6d4d=this;return new Promise(function(_0x9a168c,_0x4672c5){if(ami[_0x5df5('0xf')]()==![]){return _0x4672c5(_0x2e6d4d[_0x5df5('0x1b')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x5df5('0x12')][_0x5df5('0x13')]('\x20')));}var _0x57e3ea=schema(properties[_0x5df5('0x6a')])[_0x5df5('0x2')](_0x7fdce7);if(_0x57e3ea[_0x5df5('0x57')]>0x0){return _0x4672c5(_0x2e6d4d[_0x5df5('0x1b')](0x1f4,_[_0x5df5('0x5a')](_0x57e3ea,_0x5df5('0x19'))[_0x5df5('0x13')](',\x20')));}var _0x95e12=_[_0x5df5('0x62')](_0x289af4['channels'],{'uniqueid':_0x7fdce7[_0x5df5('0x5e')]});if(_0x95e12){return BPromise[_0x5df5('0x6b')]()[_0x5df5('0x18')](function(){if(_0x95e12[_0x5df5('0x5c')]){return ami[_0x5df5('0x1d')]({'action':_0x5df5('0x6c'),'channel':_0x95e12[_0x5df5('0x5c')],'mixmonitorid':_0x7fdce7[_0x5df5('0x67')]})[_0x5df5('0x1a')](function(_0xf3e0ac){});}})[_0x5df5('0x18')](function(){if(_0x95e12[_0x5df5('0x6d')]){return ami['Action']({'action':_0x5df5('0x6c'),'channel':_0x95e12[_0x5df5('0x6d')],'mixmonitorid':_0x7fdce7['mixmonitorid']})[_0x5df5('0x1a')](function(_0x24702a){});}})[_0x5df5('0x18')](function(_0x26e2aa){var _0x5137fb=_[_0x5df5('0x62')](_0x95e12[_0x5df5('0x66')],{'mixmonitorid':_0x7fdce7['mixmonitorid']});if(_0x5137fb){_0x5137fb['status']=_0x5df5('0x6e');}})[_0x5df5('0x18')](function(){var _0x9e61ef=util['format']('%s.%s',_0x7fdce7[_0x5df5('0x5d')]||_0x7fdce7[_0x5df5('0x5e')],_0x7fdce7['format']||_0x5df5('0x5f'));var _0x1b3785=_[_0x5df5('0x62')](_0x95e12[_0x5df5('0x66')],{'filename':_0x5df5('0x63')+_0x9e61ef['toLowerCase']()});if(_0x1b3785){_0x1b3785[_0x5df5('0x69')]=_0x5df5('0x6e');}})[_0x5df5('0x18')](function(){_0x9a168c({'code':0xc8,'message':[_0x7fdce7[_0x5df5('0x5e')],'StopMixMonitor\x20Success'][_0x5df5('0x13')]('\x20')});})['catch'](function(_0x10f893){_0x4672c5(_0x2e6d4d[_0x5df5('0x1b')](0x1f5,[_0x7fdce7['uniqueid'],_0x10f893[_0x5df5('0x19')]['toLowerCase']()][_0x5df5('0x13')]('\x20')));});}else{return _0x4672c5(_0x2e6d4d['error'](0x1f5,_0x5df5('0x6f')));}});},'VoiceQueuesChannels':function(_0x3b8aaf){return new Promise(function(_0x37a40c,_0x21332d){var _0x2a90aa=_[_0x5df5('0x70')](_0x289af4['queueChannels']);_0x37a40c({'count':_0x2a90aa[_0x5df5('0x57')],'rows':_0x2a90aa});});},'VoiceQueuesChannel':function(_0x643ee9){var _0x30a019=this;return new Promise(function(_0x554de4,_0x33c7d7){var _0x32114d=schema(properties[_0x5df5('0x71')])[_0x5df5('0x2')](_0x643ee9);if(_0x32114d[_0x5df5('0x57')]>0x0){return _0x33c7d7(_0x30a019[_0x5df5('0x1b')](0x1f4,_['map'](_0x32114d,'message')[_0x5df5('0x13')](',\x20')));}var _0x23159c=_[_0x5df5('0x62')](_0x289af4[_0x5df5('0x72')],{'uniqueid':_0x643ee9[_0x5df5('0x5e')]});if(_0x23159c){_0x554de4(_0x23159c);}else{return _0x33c7d7(_0x30a019['error'](0x1f5,_0x5df5('0x6f')));}});},'VoiceQueuesChannelHangup':function(_0x2cf2d1){var _0x14e068=this;return new Promise(function(_0x54e5e0,_0x247022){if(ami[_0x5df5('0xf')]()==![]){return _0x247022(_0x14e068[_0x5df5('0x1b')](0x1f4,[config[_0x5df5('0x10')]['ip'],config[_0x5df5('0x10')][_0x5df5('0x11')],_0x5df5('0x12')][_0x5df5('0x13')]('\x20')));}var _0x2675cc=schema(properties['voicequeuechannelhangup'])[_0x5df5('0x2')](_0x2cf2d1);if(_0x2675cc[_0x5df5('0x57')]>0x0){return _0x247022(_0x14e068[_0x5df5('0x1b')](0x1f4,_['map'](_0x2675cc,_0x5df5('0x19'))[_0x5df5('0x13')](',\x20')));}var _0x49f2da=_[_0x5df5('0x62')](_0x289af4[_0x5df5('0x72')],{'uniqueid':_0x2cf2d1[_0x5df5('0x5e')]});if(_0x49f2da&&_0x49f2da['channel']){return ami[_0x5df5('0x1d')]({'action':'Hangup','channel':_0x49f2da[_0x5df5('0x5c')]})[_0x5df5('0x18')](function(_0x17c836){_0x54e5e0({'code':0xc8,'message':[_0x2cf2d1[_0x5df5('0x5e')],_0x17c836[_0x5df5('0x19')][_0x5df5('0x64')]()]['join']('\x20')});})[_0x5df5('0x1a')](function(_0x7b85c6){_0x247022(_0x14e068['error'](0x1f5,[_0x2cf2d1[_0x5df5('0x5e')],_0x7b85c6['message']['toLowerCase']()][_0x5df5('0x13')]('\x20')));});}else{return _0x247022(_0x14e068['error'](0x1f5,_0x5df5('0x6f')));}});},'VoiceQueuesChannelRedirect':function(_0x19c839){var _0x311dc0=this;return new Promise(function(_0x1f3f81,_0x453238){if(ami[_0x5df5('0xf')]()==![]){return _0x453238(_0x311dc0['error'](0x1f4,[config[_0x5df5('0x10')]['ip'],config[_0x5df5('0x10')][_0x5df5('0x11')],'ami\x20disconnected'][_0x5df5('0x13')]('\x20')));}var _0x2d065b=schema(properties['voicequeuechannelredirect'])[_0x5df5('0x2')](_0x19c839);if(_0x2d065b[_0x5df5('0x57')]>0x0){return _0x453238(_0x311dc0[_0x5df5('0x1b')](0x1f4,_[_0x5df5('0x5a')](_0x2d065b,_0x5df5('0x19'))['join'](',\x20')));}var _0x2e2830=_['find'](_0x289af4[_0x5df5('0x72')],{'uniqueid':_0x19c839['uniqueid']});if(_0x2e2830&&_0x2e2830[_0x5df5('0x5c')]){return ami[_0x5df5('0x1d')]({'action':_0x5df5('0x73'),'channel':_0x2e2830[_0x5df5('0x5c')],'exten':_0x19c839[_0x5df5('0x74')],'context':_0x19c839['context']||_0x2e2830['context'],'priority':0x1})[_0x5df5('0x18')](function(_0x179b78){_0x1f3f81({'code':0xc8,'message':[_0x19c839[_0x5df5('0x5e')],_0x179b78[_0x5df5('0x19')][_0x5df5('0x64')]()]['join']('\x20')});})[_0x5df5('0x1a')](function(_0xdceef4){_0x453238(_0x311dc0[_0x5df5('0x1b')](0x1f5,[_0x19c839[_0x5df5('0x5e')],_0xdceef4[_0x5df5('0x19')][_0x5df5('0x64')]()][_0x5df5('0x13')]('\x20')));});}else{return _0x453238(_0x311dc0[_0x5df5('0x1b')](0x1f5,_0x5df5('0x6f')));}});},'Agents':function(_0x285281){return new Promise(function(_0x1bff6c,_0x535fee){var _0x581a59=_['values'](_0x289af4[_0x5df5('0xb')]);_0x1bff6c({'count':_0x581a59[_0x5df5('0x57')],'rows':_0x581a59});});},'Telephones':function(_0x496790){return new Promise(function(_0x1bb992,_0x11bb45){var _0x1e1d34=_[_0x5df5('0x70')](_0x289af4[_0x5df5('0x75')]);_0x1bb992({'count':_0x1e1d34[_0x5df5('0x57')],'rows':_0x1e1d34});});},'Trunks':function(_0x36d8ee){return new Promise(function(_0x4f8f84,_0x331afb){var _0x36c355=_[_0x5df5('0x70')](_0x289af4[_0x5df5('0x76')]);_0x4f8f84({'count':_0x36c355[_0x5df5('0x57')],'rows':_0x36c355});});},'OutboundChannels':function(_0x259f6a){return new Promise(function(_0x3d8c32,_0x535fe6){var _0x34dd22=_[_0x5df5('0x70')](_0x289af4[_0x5df5('0x77')]);_0x3d8c32({'count':_0x34dd22[_0x5df5('0x57')],'rows':_0x34dd22});});},'Outbound':function(_0x24b27c){return new Promise(function(_0x41110a,_0x226636){_0x41110a(_0x289af4[_0x5df5('0x78')]);});},'Campaigns':function(_0x523a89){return new Promise(function(_0x4594d2,_0x2a1916){var _0x508bc6=_[_0x5df5('0x70')](_0x289af4[_0x5df5('0x79')]);_0x4594d2({'count':_0x508bc6[_0x5df5('0x57')],'rows':_0x508bc6});});},'VoiceQueuesPreview':function(_0x25229d){var _0x177b00=this;return new Promise(function(_0x5907b8,_0x19d854){_0x417341[_0x5df5('0x7a')](_0x25229d['id'])[_0x5df5('0x18')](function(_0x4cb7d9){_0x5907b8({'code':0xc8,'message':_0x4cb7d9['message']});})[_0x5df5('0x1a')](function(_0x3f0579){_0x19d854(_0x177b00[_0x5df5('0x1b')](0x1f4,_0x3f0579[_0x5df5('0x19')]));});});},'EventManager':function(_0x19d901){var _0x2a4fef=this;return new Promise(function(_0x584a16,_0x53217e){if(!_0x19d901['event']){return _0x53217e(_0x2a4fef[_0x5df5('0x1b')](0x1f4,_0x5df5('0x7b')));}ami[_0x5df5('0x7c')]('custom:'+_0x19d901[_0x5df5('0x7d')],_0x19d901['message']);_0x584a16({'code':0xc8,'message':_0x19d901});});},'FaxAccounts':function(_0xc53f8d){return new Promise(function(_0x172f01,_0x530de6){var _0x18281b=_[_0x5df5('0x70')](_0x289af4['faxAccounts']);_0x172f01({'count':_0x18281b[_0x5df5('0x57')],'rows':_0x18281b});});},'SendFax':function(_0x19a281){var _0x4367f5=this;return new Promise(function(_0x9fffdb,_0x5372c8){_0x27ec86['send'](_0x19a281)[_0x5df5('0x18')](function(_0x2484ee){_0x9fffdb({'code':0xc8,'message':_0x2484ee[_0x5df5('0x19')]});})['catch'](function(_0x30231a){_0x5372c8(_0x4367f5[_0x5df5('0x1b')](0x1f4,_0x30231a[_0x5df5('0x19')]));});});},'CheckAfterSend':function(_0xfa3cde){var _0x8be225=this;return new Promise(function(_0x5857a1,_0x6b6ddb){_0x27ec86[_0x5df5('0x7e')](_0xfa3cde)[_0x5df5('0x18')](function(_0x10a013){_0x5857a1({'code':0xc8,'message':_0x10a013[_0x5df5('0x19')]});})[_0x5df5('0x1a')](function(_0x2683ec){_0x6b6ddb(_0x8be225[_0x5df5('0x1b')](0x1f4,_0x2683ec[_0x5df5('0x19')]));});});}};var _0x3eb955=jayson['server'](_0x2b7ed9)[_0x5df5('0x7f')]();_0x3eb955['on'](_0x5df5('0x1b'),function(_0x4efacf){return _0x9b8756(_0x4efacf);});_0x3eb955[_0x5df5('0x80')](0x232a,_0x5df5('0x81'),function(){console['log'](_0x5df5('0x82'),0x232a);return _0x476e21(_0x5df5('0x83')+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 5b86580..87c85e8 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 _0x8d0e=['destcalleridnum','calleridname','','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','Unknown','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','info','[CM][%s][%s]','emit','exec','data1','data2','data5','xmd-contactid','ListId','data3','split','$or','map','calleridnum','firstName','lastName','phone','fax','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','routeId'];(function(_0x225c0b,_0x1cbbc5){var _0x37c039=function(_0x519219){while(--_0x519219){_0x225c0b['push'](_0x225c0b['shift']());}};_0x37c039(++_0x1cbbc5);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x6e8294,_0x192634){_0x6e8294=_0x6e8294-0x0;var _0x125b5b=_0x8d0e[_0x6e8294];return _0x125b5b;};'use strict';var _=require(_0xe8d0('0x0'));var BPromise=require(_0xe8d0('0x1'));var Redis=require(_0xe8d0('0x2'));var util=require(_0xe8d0('0x3'));var config=require(_0xe8d0('0x4'));var logger=require(_0xe8d0('0x5'))(_0xe8d0('0x6'));var cmContactRpc=require(_0xe8d0('0x7'));config[_0xe8d0('0x8')]=_['defaults'](config[_0xe8d0('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe8d0('0x8')]));function emit(_0x92483d,_0x469d37,_0xcc03d0,_0x2b6dce,_0x13aa63){logger[_0xe8d0('0x9')](_0xe8d0('0xa'),_0x92483d,_0x469d37['id'],_0xcc03d0,_0x2b6dce,JSON['stringify'](_0x13aa63));io['to'](_0xcc03d0)[_0xe8d0('0xb')](_0x2b6dce,_0x13aa63);}exports[_0xe8d0('0xc')]=function(_0x463159,_0x599bc3,_0x580aab,_0x42e0c2){var _0x25e6b8,_0x3da047;var _0x10b345={};var _0x314657=Number(_0x580aab[_0xe8d0('0xd')]);var _0x5934b2=_0x580aab[_0xe8d0('0xe')]?Boolean(Number(_0x580aab[_0xe8d0('0xe')])):![];var _0x533b42;var _0x2b640d=![];if(!_['isNil'](_0x580aab['data5'])){if(_0x580aab[_0xe8d0('0xf')]=='1')_0x2b640d=!![];}if(!_0x2b640d){if(_0x42e0c2[_0xe8d0('0x10')]){_0x10b345['id']=_0x42e0c2[_0xe8d0('0x10')];}}if(!_0x10b345['id']){_0x10b345[_0xe8d0('0x11')]=_0x314657;_0x533b42=_0x580aab[_0xe8d0('0x12')]&&_0x580aab[_0xe8d0('0x12')]!=='0'?_0x580aab['data3'][_0xe8d0('0x13')](','):['phone'];_0x10b345[_0xe8d0('0x14')]=_[_0xe8d0('0x15')](_0x533b42,function(_0xfe8a4){var _0x4d1db4={};_0x4d1db4[_0xfe8a4]=_0x42e0c2['routeId']?_0x42e0c2['destcalleridnum']:_0x42e0c2[_0xe8d0('0x16')];return _0x4d1db4;});}var _0x384854=['id',_0xe8d0('0x17'),_0xe8d0('0x18'),_0xe8d0('0x19'),'mobile',_0xe8d0('0x1a'),_0xe8d0('0x11'),'createdAt','scheduledAt','updatedAt'];var _0x384a60=_[_0xe8d0('0x1b')](_0x384854,_0x533b42);BPromise[_0xe8d0('0x1c')]()[_0xe8d0('0x1d')](cmContactRpc[_0xe8d0('0x1e')]({'attributes':_0x384a60,'where':_0x10b345}))[_0xe8d0('0x1d')](function(_0x1bd25c){_0x3da047=_0x1bd25c;if(!_[_0xe8d0('0x1f')](_0x3da047)){if(_0x3da047[_0xe8d0('0x20')]===0x1){_0x25e6b8=_0x3da047[0x0];logger['info'](_0xe8d0('0x21'),_0x42e0c2[_0xe8d0('0x22')],_0x599bc3['id'],_0x25e6b8['id']);}else{logger['info'](_0xe8d0('0x23'),_0x42e0c2[_0xe8d0('0x22')],_0x599bc3['id'],_[_0xe8d0('0x15')](_0x3da047,'id')[_0xe8d0('0x24')](','));}return;}else{logger[_0xe8d0('0x9')](_0xe8d0('0x25'),_0x42e0c2[_0xe8d0('0x22')],_0x599bc3['id']);var _0x32f0c1={'ListId':_0x314657};var _0xfa3527=_0x580aab[_0xe8d0('0x26')]&&_0x580aab[_0xe8d0('0x26')]!=='0'?_0x580aab['data4']:_0xe8d0('0x19');if(_0x5934b2){logger[_0xe8d0('0x9')](_0xe8d0('0x27'),_0x42e0c2['uniqueid'],_0x599bc3['id']);_0x32f0c1[_0xfa3527]=_[_0xe8d0('0x28')](_0x42e0c2[_0xe8d0('0x29')])?_0x42e0c2['calleridnum']:_0x42e0c2[_0xe8d0('0x2a')];if(_[_0xe8d0('0x28')](_0x42e0c2[_0xe8d0('0x29')])){_0x32f0c1[_0xe8d0('0x17')]=_0x42e0c2[_0xe8d0('0x2b')]&&_0x42e0c2['calleridname']!==_0xe8d0('0x2c')?_0x42e0c2['calleridname']:'Unknown';}else{_0x32f0c1['firstName']=_0x42e0c2[_0xe8d0('0x2d')]&&_0x42e0c2[_0xe8d0('0x2d')]!==_0xe8d0('0x2c')?_0x42e0c2['destcalleridname']:'Unknown';}return BPromise[_0xe8d0('0x1c')]()['then'](cmContactRpc[_0xe8d0('0x2e')](_0x32f0c1))[_0xe8d0('0x1d')](function(_0x327004){_0x25e6b8=_0x327004;_0x3da047[_0xe8d0('0x2f')](_0x327004);if(_0x25e6b8){logger[_0xe8d0('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x42e0c2[_0xe8d0('0x22')],_0x599bc3['id'],_0x25e6b8['id']);}return;});}else{logger[_0xe8d0('0x9')](_0xe8d0('0x30'),_0x42e0c2[_0xe8d0('0x22')],_0x599bc3['id']);_0x32f0c1[_0xfa3527]=_['isNil'](_0x42e0c2[_0xe8d0('0x29')])?_0x42e0c2[_0xe8d0('0x16')]:_0x42e0c2['destcalleridnum'];if(_[_0xe8d0('0x28')](_0x42e0c2['routeId'])){_0x32f0c1[_0xe8d0('0x17')]=_0x42e0c2['calleridname']&&_0x42e0c2[_0xe8d0('0x2b')]!==''?_0x42e0c2[_0xe8d0('0x2b')]:_0xe8d0('0x31');}else{_0x32f0c1[_0xe8d0('0x17')]=_0x42e0c2[_0xe8d0('0x2d')]&&_0x42e0c2['destcalleridname']!==_0xe8d0('0x2c')?_0x42e0c2[_0xe8d0('0x2d')]:_0xe8d0('0x31');}_0x25e6b8=_0x32f0c1;_0x3da047['push'](_0x32f0c1);return;}}})[_0xe8d0('0x1d')](function(){if(_0x463159){emit(_0x42e0c2[_0xe8d0('0x22')],_0x599bc3,util[_0xe8d0('0x32')](_0xe8d0('0x33'),_0x463159[_0xe8d0('0x34')]),util['format'](_0xe8d0('0x35'),_0x580aab[_0xe8d0('0x36')][_0xe8d0('0x37')]()),{'evt':_[_0xe8d0('0x38')](_0x42e0c2,{'autoCreate':_0x5934b2}),'contact':_0x25e6b8===undefined?{}:_0x25e6b8,'contacts':_0x3da047[_0xe8d0('0x20')]===0x0?undefined:_0x3da047});}});}; \ No newline at end of file +var _0x9957=['updatedAt','resolve','then','getContacts','isEmpty','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','firstName','calleridname','destcalleridname','','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data1','data2','data5','xmd-contactid','ListId','data3','split','$or','routeId','destcalleridnum','calleridnum','phone','createdAt'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var BPromise=require(_0x7995('0x1'));var Redis=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var config=require('../../../../config/environment');var logger=require(_0x7995('0x4'))(_0x7995('0x5'));var cmContactRpc=require(_0x7995('0x6'));config[_0x7995('0x7')]=_['defaults'](config[_0x7995('0x7')],{'host':_0x7995('0x8'),'port':0x18eb});var io=require(_0x7995('0x9'))(new Redis(config[_0x7995('0x7')]));function emit(_0xbda126,_0x326741,_0x4996ca,_0x465276,_0x1cad37){logger['info'](_0x7995('0xa'),_0xbda126,_0x326741['id'],_0x4996ca,_0x465276,JSON[_0x7995('0xb')](_0x1cad37));io['to'](_0x4996ca)[_0x7995('0xc')](_0x465276,_0x1cad37);}exports[_0x7995('0xd')]=function(_0x3c1d19,_0x1e400a,_0x341672,_0x524f7b){var _0x245143,_0x41c652;var _0x581f22={};var _0xb0c872=Number(_0x341672[_0x7995('0xe')]);var _0x19a27e=_0x341672[_0x7995('0xf')]?Boolean(Number(_0x341672[_0x7995('0xf')])):![];var _0x23999f;var _0x2bbe7a=![];if(!_['isNil'](_0x341672['data5'])){if(_0x341672[_0x7995('0x10')]=='1')_0x2bbe7a=!![];}if(!_0x2bbe7a){if(_0x524f7b[_0x7995('0x11')]){_0x581f22['id']=_0x524f7b[_0x7995('0x11')];}}if(!_0x581f22['id']){_0x581f22[_0x7995('0x12')]=_0xb0c872;_0x23999f=_0x341672[_0x7995('0x13')]&&_0x341672[_0x7995('0x13')]!=='0'?_0x341672[_0x7995('0x13')][_0x7995('0x14')](','):['phone'];_0x581f22[_0x7995('0x15')]=_['map'](_0x23999f,function(_0x2f832e){var _0x37f297={};_0x37f297[_0x2f832e]=_0x524f7b[_0x7995('0x16')]?_0x524f7b[_0x7995('0x17')]:_0x524f7b[_0x7995('0x18')];return _0x37f297;});}var _0x37a7d4=['id','firstName','lastName',_0x7995('0x19'),'mobile','fax',_0x7995('0x12'),_0x7995('0x1a'),'scheduledAt',_0x7995('0x1b')];var _0x51f276=_['union'](_0x37a7d4,_0x23999f);BPromise[_0x7995('0x1c')]()[_0x7995('0x1d')](cmContactRpc[_0x7995('0x1e')]({'attributes':_0x51f276,'where':_0x581f22}))[_0x7995('0x1d')](function(_0x460924){_0x41c652=_0x460924;if(!_[_0x7995('0x1f')](_0x41c652)){if(_0x41c652['length']===0x1){_0x245143=_0x41c652[0x0];logger[_0x7995('0x20')](_0x7995('0x21'),_0x524f7b[_0x7995('0x22')],_0x1e400a['id'],_0x245143['id']);}else{logger[_0x7995('0x20')](_0x7995('0x23'),_0x524f7b[_0x7995('0x22')],_0x1e400a['id'],_[_0x7995('0x24')](_0x41c652,'id')[_0x7995('0x25')](','));}return;}else{logger['info'](_0x7995('0x26'),_0x524f7b[_0x7995('0x22')],_0x1e400a['id']);var _0x401dc3={'ListId':_0xb0c872};var _0x268ce7=_0x341672[_0x7995('0x27')]&&_0x341672[_0x7995('0x27')]!=='0'?_0x341672['data4']:_0x7995('0x19');if(_0x19a27e){logger['info'](_0x7995('0x28'),_0x524f7b[_0x7995('0x22')],_0x1e400a['id']);_0x401dc3[_0x268ce7]=_[_0x7995('0x29')](_0x524f7b[_0x7995('0x16')])?_0x524f7b[_0x7995('0x18')]:_0x524f7b['destcalleridnum'];if(_[_0x7995('0x29')](_0x524f7b['routeId'])){_0x401dc3[_0x7995('0x2a')]=_0x524f7b[_0x7995('0x2b')]&&_0x524f7b[_0x7995('0x2b')]!==''?_0x524f7b['calleridname']:'Unknown';}else{_0x401dc3[_0x7995('0x2a')]=_0x524f7b[_0x7995('0x2c')]&&_0x524f7b[_0x7995('0x2c')]!==_0x7995('0x2d')?_0x524f7b[_0x7995('0x2c')]:_0x7995('0x2e');}return BPromise['resolve']()['then'](cmContactRpc[_0x7995('0x2f')](_0x401dc3))['then'](function(_0x553671){_0x245143=_0x553671;_0x41c652[_0x7995('0x30')](_0x553671);if(_0x245143){logger[_0x7995('0x20')](_0x7995('0x31'),_0x524f7b[_0x7995('0x22')],_0x1e400a['id'],_0x245143['id']);}return;});}else{logger['info'](_0x7995('0x32'),_0x524f7b[_0x7995('0x22')],_0x1e400a['id']);_0x401dc3[_0x268ce7]=_['isNil'](_0x524f7b['routeId'])?_0x524f7b['calleridnum']:_0x524f7b[_0x7995('0x17')];if(_[_0x7995('0x29')](_0x524f7b['routeId'])){_0x401dc3[_0x7995('0x2a')]=_0x524f7b['calleridname']&&_0x524f7b[_0x7995('0x2b')]!==_0x7995('0x2d')?_0x524f7b[_0x7995('0x2b')]:'Unknown';}else{_0x401dc3['firstName']=_0x524f7b[_0x7995('0x2c')]&&_0x524f7b['destcalleridname']!==''?_0x524f7b[_0x7995('0x2c')]:_0x7995('0x2e');}_0x245143=_0x401dc3;_0x41c652['push'](_0x401dc3);return;}}})[_0x7995('0x1d')](function(){if(_0x3c1d19){emit(_0x524f7b[_0x7995('0x22')],_0x1e400a,util[_0x7995('0x33')](_0x7995('0x34'),_0x3c1d19[_0x7995('0x35')]),util['format'](_0x7995('0x36'),_0x341672[_0x7995('0x37')][_0x7995('0x38')]()),{'evt':_[_0x7995('0x39')](_0x524f7b,{'autoCreate':_0x19a27e}),'contact':_0x245143===undefined?{}:_0x245143,'contacts':_0x41c652['length']===0x0?undefined:_0x41c652});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 23d3f84..d9520a1 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 _0x4e90=['AnyConditions','some','checkConditions','field','account','chat','operator','value','ChatWebsiteId','upperFirst','AccountId','interaction','message','membername','lastevent','mailSubstatus','substatus','lodash','url','mustache','./urlforward','./integration','./cmContact','../../../config/environment','trigger','../ami','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','voiceExtensions','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentcongestion','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:dialend','custom:closedinteraction','custom:incomingmessage','custom:acceptmessage','prototype','info','motionChannel','undefined','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','toLowerCase','contactmanager','motionbar','data1','TemplateId','html','templates','data2','render','template\x20not\x20found','uri','isNil','data3','location','uriLocation','windowWidth','data5','800','windowHeight','data6','600','emit','user:%s','format','trigger:%s:%s','action','jscripty','name','trigger:%s','exec','integration','queue','routeId','urlforward','script','buildUri','parse','query','search','replace','AllConditions','channel'];(function(_0x567065,_0x158fe7){var _0x3f879d=function(_0x47c142){while(--_0x47c142){_0x567065['push'](_0x567065['shift']());}};_0x3f879d(++_0x158fe7);}(_0x4e90,0x1e1));var _0x04e9=function(_0x94ba2,_0x2b3641){_0x94ba2=_0x94ba2-0x0;var _0x45e8e6=_0x4e90[_0x94ba2];return _0x45e8e6;};'use strict';var util=require('util');var _=require(_0x04e9('0x0'));var url=require(_0x04e9('0x1'));var Mustache=require(_0x04e9('0x2'));var Redis=require('ioredis');var urlforward=require(_0x04e9('0x3'));var integration=require(_0x04e9('0x4'));var cmContact=require(_0x04e9('0x5'));var script=require('./script');var config=require(_0x04e9('0x6'));var logger=require('../../../config/logger')(_0x04e9('0x7'));var ami=require(_0x04e9('0x8'));config[_0x04e9('0x9')]=_['defaults'](config[_0x04e9('0x9')],{'host':_0x04e9('0xa'),'port':0x18eb});var io=require(_0x04e9('0xb'))(new Redis(config[_0x04e9('0x9')]));var operators={'equals':function(_0x25ca72,_0x200719){return _0x25ca72==_0x200719;},'not_equals':function(_0x591dc9,_0x1e30f9){return _0x591dc9!=_0x1e30f9;}};var barAndWebActions=[_0x04e9('0xc'),_0x04e9('0x1'),_0x04e9('0xd')];function Trigger(_0x53996a){this[_0x04e9('0xe')]=_0x53996a[_0x04e9('0xe')];this[_0x04e9('0xf')]=_0x53996a[_0x04e9('0xf')];this[_0x04e9('0x10')]=_0x53996a[_0x04e9('0x10')];this['templates']=_0x53996a['templates'];this['voiceExtensions']=_0x53996a[_0x04e9('0x11')];this[_0x04e9('0x12')]=_0x53996a[_0x04e9('0x12')];this['freshdeskAccounts']=_0x53996a['freshdeskAccounts'];this['salesforceAccounts']=_0x53996a[_0x04e9('0x13')];this[_0x04e9('0x14')]=_0x53996a['sugarcrmAccounts'];this[_0x04e9('0x15')]=_0x53996a[_0x04e9('0x15')];this['deskAccounts']=_0x53996a[_0x04e9('0x16')];this['vtigerAccounts']=_0x53996a[_0x04e9('0x17')];this[_0x04e9('0x18')]=_0x53996a['servicenowAccounts'];this['dynamics365Accounts']=_0x53996a[_0x04e9('0x19')];this[_0x04e9('0x1a')]=_0x53996a[_0x04e9('0x1a')];this[_0x04e9('0x1b')]={'zendesk':this[_0x04e9('0x12')],'salesforce':this[_0x04e9('0x13')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x04e9('0x15')],'desk':this[_0x04e9('0x16')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x04e9('0x19')],'freshsales':this[_0x04e9('0x1a')],'servicenow':this['servicenowAccounts']};ami['on'](_0x04e9('0x1c'),this[_0x04e9('0x1d')][_0x04e9('0x1e')](this));ami['on'](_0x04e9('0x1f'),this[_0x04e9('0x1d')][_0x04e9('0x1e')](this));ami['on'](_0x04e9('0x20'),this[_0x04e9('0x1d')][_0x04e9('0x1e')](this));ami['on'](_0x04e9('0x21'),this[_0x04e9('0x1d')][_0x04e9('0x1e')](this));ami['on'](_0x04e9('0x22'),this[_0x04e9('0x1d')][_0x04e9('0x1e')](this));ami['on'](_0x04e9('0x23'),this['syncCustomEvent'][_0x04e9('0x1e')](this));ami['on']('custom:agentbusy',this[_0x04e9('0x1d')]['bind'](this));ami['on'](_0x04e9('0x24'),this[_0x04e9('0x1d')][_0x04e9('0x1e')](this));ami['on']('custom:agentreject',this[_0x04e9('0x1d')][_0x04e9('0x1e')](this));ami['on']('custom:amd',this['syncCustomEvent'][_0x04e9('0x1e')](this));ami['on'](_0x04e9('0x25'),this[_0x04e9('0x1d')][_0x04e9('0x1e')](this));ami['on'](_0x04e9('0x26'),this[_0x04e9('0x1d')]['bind'](this));ami['on']('custom:dialbegin',this[_0x04e9('0x27')]['bind'](this));ami['on']('custom:dialconnect',this[_0x04e9('0x27')]['bind'](this));ami['on'](_0x04e9('0x28'),this[_0x04e9('0x27')][_0x04e9('0x1e')](this));ami['on']('custom:newinteraction',this[_0x04e9('0x1d')]['bind'](this));ami['on'](_0x04e9('0x29'),this[_0x04e9('0x1d')][_0x04e9('0x1e')](this));ami['on']('custom:substatus',this['syncCustomEvent'][_0x04e9('0x1e')](this));ami['on'](_0x04e9('0x2a'),this['syncCustomEvent'][_0x04e9('0x1e')](this));ami['on']('custom:outgoingmessage',this[_0x04e9('0x1d')][_0x04e9('0x1e')](this));ami['on'](_0x04e9('0x2b'),this[_0x04e9('0x1d')]['bind'](this));ami['on']('custom:rejectmessage',this[_0x04e9('0x1d')][_0x04e9('0x1e')](this));}Trigger[_0x04e9('0x2c')]['emit']=function(_0x4bd669,_0x2cd6f7,_0x4253eb){logger[_0x04e9('0x2d')](_0x4bd669,_0x2cd6f7,JSON['stringify'](_0x4253eb));io['to'](_0x4bd669)['emit'](_0x2cd6f7,_0x4253eb);};Trigger[_0x04e9('0x2c')]['syncCustomEvent']=function(_0x5cc034){var _0x5f2462=_['clone'](_0x5cc034);if(typeof _0x5f2462[_0x04e9('0x2e')]===_0x04e9('0x2f')){_0x5f2462['motionChannel']='voice';}this[_0x04e9('0x30')](_0x5f2462);};Trigger[_0x04e9('0x2c')]['syncAgentDial']=function(_0x1fc3be){if(this[_0x04e9('0xf')][_0x1fc3be[_0x04e9('0x31')]]){this[_0x04e9('0x1d')](_0x1fc3be);}};Trigger[_0x04e9('0x2c')]['checkTriggers']=function(_0x46ae45){var _0x27e968;for(var _0x34d75e in this[_0x04e9('0xe')]){if(this['triggers'][_0x04e9('0x32')](_0x34d75e)){if(this['triggers'][_0x34d75e][_0x04e9('0x33')]){_0x27e968=this[_0x04e9('0x34')](this['triggers'][_0x34d75e],_0x46ae45);if(_0x27e968){_[_0x04e9('0x35')](_0x46ae45,_0x46ae45[_0x04e9('0x36')]);for(var _0x170948=0x0,_0x153b32,_0x5d1179,_0xb5cd2c;_0x1709480x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file +var _0x7217=['format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','length','map','forEach','string','picklist','nameField','customField','content','toString','includes','idField','custom_fields','variable','variableName','type','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','new','xCALLY','Motion','CTI','Tags','Descriptions','user','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x50a575,_0x49490c){var _0x1321a1=function(_0x360e47){while(--_0x360e47){_0x50a575['push'](_0x50a575['shift']());}};_0x1321a1(++_0x49490c);}(_0x7217,0x19e));var _0x7721=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x7217[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require(_0x7721('0x0'));var rp=require('request-promise');var md5=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var Redis=require(_0x7721('0x3'));var intUtil=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('desk');config[_0x7721('0x6')]=_[_0x7721('0x7')](config[_0x7721('0x6')],{'host':_0x7721('0x8'),'port':0x18eb});var io=require(_0x7721('0x9'))(new Redis(config[_0x7721('0x6')]));function emit(_0x18ab6b,_0x21f680,_0x225610){io['to'](_0x18ab6b)[_0x7721('0xa')](_0x21f680,_0x225610);}var headers={'Content-Type':_0x7721('0xb'),'Accept':_0x7721('0xb')};function getUser(_0xfa8835,_0x138740){if(intUtil[_0x7721('0xc')](_0x138740)===!![]){logger['info'](_0x7721('0xd'),_0x138740);return request({'uri':util[_0x7721('0xe')](_0x7721('0xf'),_0xfa8835[_0x7721('0x10')])})[_0x7721('0x11')](function(_0x409b37){if(_0x409b37[_0x7721('0x12')]){return _[_0x7721('0x13')](_0x409b37['_embedded'][_0x7721('0x14')],{'email':_0x138740});}})[_0x7721('0x11')](function(_0x57ff6d){if(_0x57ff6d){logger[_0x7721('0x15')](_0x7721('0x16'));return _0x57ff6d;}else{logger[_0x7721('0x15')](_0x7721('0x17'));return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}}function request(_0x3cc909){logger[_0x7721('0x19')]('[HTTP]',JSON[_0x7721('0x1a')](_0x3cc909));return rp(_['defaults'](_0x3cc909,{'method':_0x7721('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5cb0e6){var _0xfec626;if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x1d')){_0xfec626=util[_0x7721('0xe')](_0x7721('0x1e'),_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x20')]);}else if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x21')){_0xfec626=util[_0x7721('0xe')]('%s/token:%s',_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x21')]);}return util[_0x7721('0xe')](_0x7721('0x22'),new Buffer(_0xfec626)['toString'](_0x7721('0x23')));}function getEndUser(_0x512f31,_0xb9e9dd,_0x288e3a){logger[_0x7721('0x15')](_0x7721('0x24'),_0x288e3a);return request({'uri':util[_0x7721('0xe')](_0x7721('0x25'),_0x512f31[_0x7721('0x10')]),'qs':{'phone':_0x288e3a}})['then'](function(_0x216f20){if(_0x216f20[_0x7721('0x12')]){logger[_0x7721('0x15')](_0x7721('0x26'));return _0x216f20[_0x7721('0x27')][_0x7721('0x14')][0x0];}else{logger[_0x7721('0x15')](_0x7721('0x28'));return request({'uri':util[_0x7721('0xe')]('%s/customers',_0x512f31[_0x7721('0x10')]),'method':'POST','body':{'first_name':_0xb9e9dd,'title':_0xb9e9dd,'phone_numbers':[{'type':'work','value':_0x288e3a}]}});}});}function getTags(_0x315202,_0x343c19){var _0x53c904=[];if(_0x315202&&_0x315202[_0x7721('0x29')]>0x0){_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 diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index c445f82..7990d5d 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 _0xd3a5=['Fields','callDirection','queue','/contacts(','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\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','inspect','bluebird','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','userEmail','email','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','calleridnum','contacts','/systemusers(','4.0','odata-entityid','lastIndexOf','enduserId','outbound','destcalleridnum','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','includes','string','customField','toLowerCase','substring','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions'];(function(_0x36651d,_0x3e3128){var _0x5864ea=function(_0x372d38){while(--_0x372d38){_0x36651d['push'](_0x36651d['shift']());}};_0x5864ea(++_0x3e3128);}(_0xd3a5,0xed));var _0x5d3a=function(_0x56fbb6,_0x570f05){_0x56fbb6=_0x56fbb6-0x0;var _0x4e9a77=_0xd3a5[_0x56fbb6];return _0x4e9a77;};'use strict';var _=require('lodash');var BPromise=require(_0x5d3a('0x0'));var rp=require('request-promise');var util=require(_0x5d3a('0x1'));var intUtil=require(_0x5d3a('0x2'));var md5=require(_0x5d3a('0x3'));var Redis=require(_0x5d3a('0x4'));var logger=require(_0x5d3a('0x5'))(_0x5d3a('0x6'));var config=require(_0x5d3a('0x7'));config[_0x5d3a('0x8')]=_[_0x5d3a('0x9')](config[_0x5d3a('0x8')],{'host':_0x5d3a('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAuthToken(_0x12ca12,_0xf384ca,_0x322e2e){var _0x244f8a={'method':_0x5d3a('0xb'),'uri':_0xf384ca,'form':{'client_id':_0x12ca12[_0x5d3a('0xc')],'resource':_0x12ca12[_0x5d3a('0xd')],'username':_0x12ca12[_0x5d3a('0xe')],'password':_0x12ca12['password'],'grant_type':_0x5d3a('0xf'),'client_secret':_0x12ca12[_0x5d3a('0x10')]},'json':!![]};return rp(_0x244f8a)[_0x5d3a('0x11')](function(_0x20f9d8){return _0x20f9d8[_0x5d3a('0x12')];})[_0x5d3a('0x13')](function(_0x28cf8a){logger['error']('['+[_0x322e2e[_0x5d3a('0x14')]()]+_0x5d3a('0x15'));return _0x28cf8a[_0x5d3a('0x16')];});}function getUser(_0x3d7d66,_0x327299,_0x18f93f,_0x2779de,_0x10365a,_0xb60d82){return new BPromise(function(_0x384ae2,_0x2f5c3e){return getAuthToken(_0x327299,_0x2779de,_0xb60d82)[_0x5d3a('0x11')](function(_0x401caa){var _0x315494={'method':'GET','uri':_0x10365a+_0x5d3a('0x17'),'headers':{'Authorization':_0x5d3a('0x18')+_0x401caa,'OData-Version':'4.0'},'json':!![]};return rp(_0x315494);})[_0x5d3a('0x11')](function(_0x2ebd8d){var _0x4d58b9=_0x2ebd8d[_0x5d3a('0x19')];var _0x2963e3=![];var _0x27f332=null;if(!_[_0x5d3a('0x1a')](_0x18f93f)){if(intUtil[_0x5d3a('0x1b')](_0x18f93f['email'])){_0x3d7d66[_0x5d3a('0x1c')]=_0x18f93f[_0x5d3a('0x1d')];for(_0x27f332=0x0;_0x27f332<_0x4d58b9['length'];_0x27f332++){if(_0x4d58b9[_0x27f332][_0x5d3a('0x1e')]===_0x18f93f[_0x5d3a('0x1d')]&&!_0x4d58b9[_0x27f332][_0x5d3a('0x1f')]){_0x2963e3=!![];logger['info']('['+[_0xb60d82[_0x5d3a('0x14')]()]+_0x5d3a('0x20')+_0x4d58b9[_0x27f332][_0x5d3a('0x21')]+'!');_0x3d7d66[_0x5d3a('0x22')]=_0x4d58b9[_0x27f332][_0x5d3a('0x21')];}}}}if(!_0x2963e3){logger[_0x5d3a('0x23')]('['+[_0xb60d82['toUpperCase']()]+_0x5d3a('0x24'));_0x3d7d66[_0x5d3a('0x1c')]=_0x327299[_0x5d3a('0xe')];for(_0x27f332=0x0;_0x27f332<_0x4d58b9[_0x5d3a('0x25')];_0x27f332++){if(_0x4d58b9[_0x27f332][_0x5d3a('0x1e')]===_0x327299[_0x5d3a('0xe')]){_0x3d7d66['userId']=_0x4d58b9[_0x27f332][_0x5d3a('0x21')];}}}_0x384ae2(_0x3d7d66);})[_0x5d3a('0x13')](function(_0x5f4d1a){_0x2f5c3e(_0x5f4d1a[_0x5d3a('0x16')]);});});}function createEndUser(_0x31a43e,_0xb5de75,_0x537e85,_0x4c0967,_0x22b619,_0x5b256c){return new BPromise(function(_0x3469ed,_0x3e059f){return getAuthToken(_0xb5de75,_0x537e85,_0x5b256c)[_0x5d3a('0x11')](function(_0x5f06cb){var _0x2751b5=_0x5b256c['toLowerCase']()==='outbound'?_0x22b619['destcalleridnum']:_0x22b619[_0x5d3a('0x26')];var _0x1d1105={'method':_0x5d3a('0xb'),'uri':_0x4c0967+_0x5d3a('0x27'),'body':{'telephone1':_0x2751b5,'fullname':_0x2751b5,'firstname':_0x2751b5,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5d3a('0x28')+_0x31a43e['userId']+')'},'headers':{'Authorization':_0x5d3a('0x18')+_0x5f06cb,'OData-Version':_0x5d3a('0x29')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x1d1105);})[_0x5d3a('0x11')](function(_0x26160c){var _0x30494e=_0x26160c['headers'][_0x5d3a('0x2a')];var _0x52e06c=_0x30494e['substring'](_0x30494e[_0x5d3a('0x2b')]('(')+0x1,_0x30494e[_0x5d3a('0x2b')](')'));_0x31a43e[_0x5d3a('0x2c')]=_0x52e06c;_0x3469ed(_0x31a43e);})[_0x5d3a('0x13')](function(_0x25c96c){_0x3e059f(_0x25c96c[_0x5d3a('0x16')]);});});}function getEndUser(_0x38aed0,_0x48bb23,_0x4bfffa,_0x56cd88,_0x4495b5,_0x12df1c,_0x504109){var _0x5ebbac=_0x12df1c['toLowerCase']()===_0x5d3a('0x2d')?_0x4495b5[_0x5d3a('0x2e')]:_0x4495b5['calleridnum'];return getAuthToken(_0x48bb23,_0x4bfffa,_0x12df1c)[_0x5d3a('0x11')](function(_0x39cd93){var _0x2c4c79={'method':_0x5d3a('0x2f'),'uri':_0x56cd88+_0x5d3a('0x30')+_0x5ebbac[_0x5d3a('0x31')]('+',_0x5d3a('0x32'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x39cd93,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2c4c79);})[_0x5d3a('0x11')](function(_0x3767a2){var _0x285028=![];if(!_0x3767a2)return _0x285028;var _0x4aa899=_0x3767a2['value'];for(var _0x5e5adf=0x0;_0x5e5adf<_0x4aa899['length'];_0x5e5adf++){if(_0x4aa899[_0x5e5adf][_0x5d3a('0x33')]===_0x5ebbac){_0x285028=!![];_0x38aed0['enduserId']=_0x4aa899[_0x5e5adf][_0x5d3a('0x34')];}}return _0x285028;})['then'](function(_0x64b8e7){if(_0x64b8e7)return _0x38aed0;if(_0x504109===_0x5d3a('0x35')){logger[_0x5d3a('0x23')]('['+[_0x12df1c[_0x5d3a('0x14')]()]+_0x5d3a('0x36'));return _0x38aed0;}return createEndUser(_0x38aed0,_0x48bb23,_0x4bfffa,_0x56cd88,_0x4495b5,_0x12df1c)[_0x5d3a('0x11')](function(_0x5d89c9){logger[_0x5d3a('0x23')]('['+[_0x12df1c[_0x5d3a('0x14')]()]+']\x20Enduser\x20created!',_0x5d89c9[_0x5d3a('0x2c')]);return _0x5d89c9;});});}function getCustomFields(_0x4ee412,_0x2b197b,_0x4caaa4){var _0x3976ed={};if(_0x4ee412[_0x5d3a('0x25')]>0x0){_['forEach'](_0x4ee412,function(_0x5464cd){if(_[_0x5d3a('0x37')]([_0x5d3a('0x38'),'picklist'],_0x5464cd['type'])&&_0x5464cd['nameField']&&!_0x5464cd[_0x5d3a('0x39')]){var _0x16ebb1=_0x5464cd['idField'][_0x5d3a('0x3a')]();var _0x1364f7=_0x16ebb1[_0x5d3a('0x3b')](0x0,_0x16ebb1[_0x5d3a('0x3c')]('_'));var _0x5bb93c=_0x16ebb1[_0x5d3a('0x3b')](_0x16ebb1[_0x5d3a('0x3c')]('_')+0x1);if(_0x1364f7===_0x4caaa4){_0x3976ed[_0x5bb93c]=_0x5464cd[_0x5d3a('0x3d')];}}});}return _0x3976ed;}function getTicket(_0x56a55e,_0x5ea606,_0x147361,_0xf779e,_0x2b5df5,_0x453988,_0x5ee8eb){return new BPromise(function(_0x454504,_0x52c600){var _0x2ef6bc;return getAuthToken(_0x5ea606,_0x147361,_0x5ee8eb)['then'](function(_0x161086){if(_0x453988[_0x5d3a('0x3e')]===_0x5d3a('0x3f')){_0x2ef6bc={'method':'POST','uri':_0xf779e+_0x5d3a('0x40'),'body':Object[_0x5d3a('0x41')]({},{'title':intUtil[_0x5d3a('0x42')](_0x453988[_0x5d3a('0x43')],_0x2b5df5,'\x20'),'description':intUtil[_0x5d3a('0x42')](_0x453988[_0x5d3a('0x44')],_0x2b5df5,'\x0a'),'customerid_contact@odata.bind':_0x56a55e[_0x5d3a('0x2c')]?'/contacts('+_0x56a55e['enduserId']+')':undefined,'ownerid@odata.bind':_0x5d3a('0x28')+_0x56a55e['userId']+')','caseorigincode':'1'},getCustomFields(_0x453988[_0x5d3a('0x45')],_0x2b5df5,_0x453988[_0x5d3a('0x3e')])),'headers':{'Authorization':_0x5d3a('0x18')+_0x161086,'OData-Version':_0x5d3a('0x29')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x453988[_0x5d3a('0x3e')]==='phonecall'){var _0x42f9e1=_0x56a55e['enduserId']?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x56a55e[_0x5d3a('0x22')]+')','participationtypemask':_0x56a55e[_0x5d3a('0x46')]===_0x5d3a('0x47')?0x2:0x1},{'partyid_contact@odata.bind':_0x5d3a('0x48')+_0x56a55e['enduserId']+')','participationtypemask':_0x56a55e['callDirection']===_0x5d3a('0x47')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x5d3a('0x28')+_0x56a55e['userId']+')','participationtypemask':_0x56a55e['callDirection']===_0x5d3a('0x47')?0x2:0x1}];_0x2ef6bc={'method':_0x5d3a('0xb'),'uri':_0xf779e+'phonecalls','body':Object[_0x5d3a('0x41')]({},{'subject':intUtil[_0x5d3a('0x42')](_0x453988['Subjects'],_0x2b5df5,'\x20'),'phonenumber':String(_0x2b5df5[_0x5d3a('0x26')]),'description':intUtil[_0x5d3a('0x42')](_0x453988[_0x5d3a('0x44')],_0x2b5df5,'\x0a'),'regardingobjectid_contact@odata.bind':_0x56a55e[_0x5d3a('0x2c')]?_0x5d3a('0x48')+_0x56a55e[_0x5d3a('0x2c')]+')':undefined,'ownerid@odata.bind':_0x5d3a('0x28')+_0x56a55e[_0x5d3a('0x22')]+')','directioncode':_0x56a55e[_0x5d3a('0x46')]==='queue'?![]:!![],'phonecall_activity_parties':_0x42f9e1},getCustomFields(_0x453988['Fields'],_0x2b5df5,_0x453988[_0x5d3a('0x3e')])),'headers':{'Authorization':_0x5d3a('0x18')+_0x161086,'OData-Version':_0x5d3a('0x29')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2ef6bc);})['then'](function(_0x10bc12){var _0x12a2b0=_0x10bc12[_0x5d3a('0x49')][_0x5d3a('0x2a')];var _0x228ff6=_0x12a2b0[_0x5d3a('0x3b')](_0x12a2b0['lastIndexOf']('(')+0x1,_0x12a2b0[_0x5d3a('0x2b')](')'));_0x56a55e[_0x5d3a('0x4a')]=_0x228ff6;_0x454504(_0x56a55e);})['catch'](function(_0x2c3f72){_0x52c600(_0x2c3f72[_0x5d3a('0x16')]);});});}function emit(_0x31dca0,_0x28e2c8,_0x326bd0,_0x8a3b42){var _0x3786e2={'uri':util[_0x5d3a('0x4b')](_0x5d3a('0x4c'),_0x31dca0,_0x326bd0,_0x8a3b42)};io['to'](util['format'](_0x5d3a('0x4d'),_0x28e2c8))[_0x5d3a('0x4e')](_0x5d3a('0x4f'),_0x3786e2);}exports['cs']=function(_0x30cb94,_0x4d68d1,_0x3ec264,_0x14b9ac,_0x319695,_0x4b9dd6,_0x94385,_0xb770b){var _0x1cb935={};_0x4b9dd6[_0x5d3a('0xd')]=intUtil[_0x5d3a('0x50')](_0x4b9dd6[_0x5d3a('0xd')]);_0x4b9dd6[_0x5d3a('0x51')]=intUtil[_0x5d3a('0x50')](_0x4b9dd6[_0x5d3a('0x51')]);_0x1cb935['callDirection']=_0xb770b===_0x5d3a('0x47')||_0xb770b===_0x5d3a('0x52')?_0x5d3a('0x47'):_0x5d3a('0x2d');var _0x12ca78=util[_0x5d3a('0x4b')]('%s/api/data/v9.0/',_0x4b9dd6[_0x5d3a('0xd')]);var _0x21ebb3=util[_0x5d3a('0x4b')](_0x5d3a('0x53'),_0x4b9dd6[_0x5d3a('0x54')]);var _0x2b16c3=util[_0x5d3a('0x4b')](_0x5d3a('0x55'),_0x4b9dd6[_0x5d3a('0x51')],_0x4d68d1[_0x5d3a('0x56')],md5(_0x4d68d1[_0x5d3a('0x56')]));if(_0x319695&&_0x319695[_0x5d3a('0x57')]){logger['info'](_0x5d3a('0x58'),_0x5d3a('0x59'));_0x4d68d1[_0x5d3a('0x5a')]=_0x2b16c3;}else if(_0x94385&&_0x94385['recordingFormat']&&_0x94385['recordingFormat']!==_0x5d3a('0x5b')){logger[_0x5d3a('0x23')]('[OUTBOUND]',_0x5d3a('0x59'));_0x4d68d1[_0x5d3a('0x5a')]=_0x2b16c3;}else{_0x4d68d1[_0x5d3a('0x5a')]='';}return getUser(_0x1cb935,_0x4b9dd6,_0x14b9ac,_0x21ebb3,_0x12ca78,_0xb770b)['then'](function(_0x2f95d5){logger[_0x5d3a('0x23')]('['+_0xb770b[_0x5d3a('0x14')]()+_0x5d3a('0x5c'),_0x2f95d5['userId']);logger[_0x5d3a('0x23')]('['+_0xb770b[_0x5d3a('0x14')]()+_0x5d3a('0x5d'),_0x2f95d5['userEmail']);return getEndUser(_0x2f95d5,_0x4b9dd6,_0x21ebb3,_0x12ca78,_0x4d68d1,_0xb770b,_0x3ec264['moduleCreate']);})[_0x5d3a('0x11')](function(_0x1e99a3){logger[_0x5d3a('0x23')]('['+_0xb770b[_0x5d3a('0x14')]()+_0x5d3a('0x5e'),_0x1e99a3['enduserId']);logger[_0x5d3a('0x23')]('['+_0xb770b[_0x5d3a('0x14')]()+_0x5d3a('0x5f'),_0x4d68d1['calleridnum']);return getTicket(_0x1e99a3,_0x4b9dd6,_0x21ebb3,_0x12ca78,_0x4d68d1,_0x3ec264,_0xb770b);})[_0x5d3a('0x11')](function(_0x2b3676){logger['info'](util[_0x5d3a('0x4b')]('['+_0xb770b[_0x5d3a('0x14')]()+_0x5d3a('0x60'),_0x3ec264[_0x5d3a('0x3e')],_0x2b3676['ticketId']));logger[_0x5d3a('0x23')](util[_0x5d3a('0x4b')]('['+_0xb770b[_0x5d3a('0x14')]()+_0x5d3a('0x61'),_0xb770b));if(_0xb770b!==_0x5d3a('0x52')){logger[_0x5d3a('0x23')]('['+_0xb770b[_0x5d3a('0x14')]()+']',_0x5d3a('0x62'));emit(_0x4b9dd6[_0x5d3a('0xd')],_0x14b9ac[_0x5d3a('0x63')],_0x3ec264[_0x5d3a('0x3e')],_0x2b3676[_0x5d3a('0x4a')]);}})[_0x5d3a('0x13')](function(_0x5662e5){logger[_0x5d3a('0x64')]('['+_0xb770b[_0x5d3a('0x14')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x5d3a('0x65')](_0x5662e5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x53cf=['username','password','then','access_token','catch','error','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','calleridnum','contacts','Bearer\x20','4.0','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','customField','idField','incident','incidents','getString','Descriptions','/contacts(','/systemusers(','Fields','ticketType','phonecall','callDirection','queue','phonecalls','assign','headers','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20Call\x20direction:\x20%s',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri'];(function(_0x565dc8,_0x4261e5){var _0x46d643=function(_0x90b2f7){while(--_0x90b2f7){_0x565dc8['push'](_0x565dc8['shift']());}};_0x46d643(++_0x4261e5);}(_0x53cf,0x11f));var _0xf53c=function(_0x5640a0,_0x1c622a){_0x5640a0=_0x5640a0-0x0;var _0x202366=_0x53cf[_0x5640a0];return _0x202366;};'use strict';var _=require(_0xf53c('0x0'));var BPromise=require(_0xf53c('0x1'));var rp=require(_0xf53c('0x2'));var util=require('util');var intUtil=require(_0xf53c('0x3'));var md5=require(_0xf53c('0x4'));var Redis=require(_0xf53c('0x5'));var logger=require(_0xf53c('0x6'))(_0xf53c('0x7'));var config=require(_0xf53c('0x8'));config[_0xf53c('0x9')]=_[_0xf53c('0xa')](config[_0xf53c('0x9')],{'host':_0xf53c('0xb'),'port':0x18eb});var io=require(_0xf53c('0xc'))(new Redis(config[_0xf53c('0x9')]));function getAuthToken(_0x175576,_0x207261,_0x5c0fc0){var _0x37dce8={'method':_0xf53c('0xd'),'uri':_0x207261,'form':{'client_id':_0x175576[_0xf53c('0xe')],'resource':_0x175576[_0xf53c('0xf')],'username':_0x175576[_0xf53c('0x10')],'password':_0x175576[_0xf53c('0x11')],'grant_type':_0xf53c('0x11'),'client_secret':_0x175576['clientSecret']},'json':!![]};return rp(_0x37dce8)[_0xf53c('0x12')](function(_0x53914e){return _0x53914e[_0xf53c('0x13')];})[_0xf53c('0x14')](function(_0x1e9a7e){logger[_0xf53c('0x15')]('['+[_0x5c0fc0[_0xf53c('0x16')]()]+']\x20Wrong\x20credentials!');return _0x1e9a7e[_0xf53c('0x17')];});}function getUser(_0x3cd046,_0x6a953,_0x28d529,_0x3e0b5c,_0x466202,_0x25b8ea){return new BPromise(function(_0x8bcf13,_0x490823){return getAuthToken(_0x6a953,_0x3e0b5c,_0x25b8ea)[_0xf53c('0x12')](function(_0x5bffcd){var _0x114617={'method':_0xf53c('0x18'),'uri':_0x466202+_0xf53c('0x19'),'headers':{'Authorization':'Bearer\x20'+_0x5bffcd,'OData-Version':'4.0'},'json':!![]};return rp(_0x114617);})['then'](function(_0x4320f2){var _0x4583fc=_0x4320f2[_0xf53c('0x1a')];var _0x57660c=![];var _0x116e22=null;if(!_[_0xf53c('0x1b')](_0x28d529)){if(intUtil[_0xf53c('0x1c')](_0x28d529[_0xf53c('0x1d')])){_0x3cd046[_0xf53c('0x1e')]=_0x28d529[_0xf53c('0x1d')];for(_0x116e22=0x0;_0x116e22<_0x4583fc[_0xf53c('0x1f')];_0x116e22++){if(_0x4583fc[_0x116e22][_0xf53c('0x20')]===_0x28d529['email']&&!_0x4583fc[_0x116e22][_0xf53c('0x21')]){_0x57660c=!![];logger[_0xf53c('0x22')]('['+[_0x25b8ea[_0xf53c('0x16')]()]+']\x20Agent\x20found\x20'+_0x4583fc[_0x116e22][_0xf53c('0x23')]+'!');_0x3cd046[_0xf53c('0x24')]=_0x4583fc[_0x116e22][_0xf53c('0x23')];}}}}if(!_0x57660c){logger['info']('['+[_0x25b8ea[_0xf53c('0x16')]()]+_0xf53c('0x25'));_0x3cd046[_0xf53c('0x1e')]=_0x6a953[_0xf53c('0x10')];for(_0x116e22=0x0;_0x116e22<_0x4583fc[_0xf53c('0x1f')];_0x116e22++){if(_0x4583fc[_0x116e22]['internalemailaddress']===_0x6a953[_0xf53c('0x10')]){_0x3cd046['userId']=_0x4583fc[_0x116e22][_0xf53c('0x23')];}}}_0x8bcf13(_0x3cd046);})[_0xf53c('0x14')](function(_0x4c4cce){_0x490823(_0x4c4cce['message']);});});}function createEndUser(_0x2f4980,_0x20c795,_0x93e535,_0x1544c1,_0x27b641,_0x4ab41f){return new BPromise(function(_0x298f8e,_0x37d1f7){return getAuthToken(_0x20c795,_0x93e535,_0x4ab41f)[_0xf53c('0x12')](function(_0x933acb){var _0x9bbfe9=_0x4ab41f[_0xf53c('0x26')]()===_0xf53c('0x27')?_0x27b641['destcalleridnum']:_0x27b641[_0xf53c('0x28')];var _0x1a48c8={'method':_0xf53c('0xd'),'uri':_0x1544c1+_0xf53c('0x29'),'body':{'telephone1':_0x9bbfe9,'fullname':_0x9bbfe9,'firstname':_0x9bbfe9,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x2f4980[_0xf53c('0x24')]+')'},'headers':{'Authorization':_0xf53c('0x2a')+_0x933acb,'OData-Version':_0xf53c('0x2b')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x1a48c8);})['then'](function(_0x4fc566){var _0x5e3ccc=_0x4fc566['headers'][_0xf53c('0x2c')];var _0x14cb76=_0x5e3ccc[_0xf53c('0x2d')](_0x5e3ccc[_0xf53c('0x2e')]('(')+0x1,_0x5e3ccc[_0xf53c('0x2e')](')'));_0x2f4980[_0xf53c('0x2f')]=_0x14cb76;_0x298f8e(_0x2f4980);})[_0xf53c('0x14')](function(_0x20f50b){_0x37d1f7(_0x20f50b['message']);});});}function getEndUser(_0x37cd2b,_0x35113e,_0x40e0a4,_0x445c47,_0x345026,_0x5ee357,_0x47dcb8){var _0xd21036=_0x5ee357['toLowerCase']()==='outbound'?_0x345026[_0xf53c('0x30')]:_0x345026[_0xf53c('0x28')];return getAuthToken(_0x35113e,_0x40e0a4,_0x5ee357)['then'](function(_0x1bac8b){var _0x18b229={'method':_0xf53c('0x18'),'uri':_0x445c47+_0xf53c('0x31')+_0xd21036[_0xf53c('0x32')]('+',_0xf53c('0x33'))+'\x27','headers':{'Authorization':_0xf53c('0x2a')+_0x1bac8b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x18b229);})[_0xf53c('0x12')](function(_0x3cd2dc){var _0x2ba955=![];if(!_0x3cd2dc)return _0x2ba955;var _0x4587ba=_0x3cd2dc[_0xf53c('0x1a')];for(var _0x47bc84=0x0;_0x47bc84<_0x4587ba[_0xf53c('0x1f')];_0x47bc84++){if(_0x4587ba[_0x47bc84][_0xf53c('0x34')]===_0xd21036){_0x2ba955=!![];_0x37cd2b[_0xf53c('0x2f')]=_0x4587ba[_0x47bc84]['contactid'];}}return _0x2ba955;})[_0xf53c('0x12')](function(_0x48e599){if(_0x48e599)return _0x37cd2b;if(_0x47dcb8===_0xf53c('0x35')){logger[_0xf53c('0x22')]('['+[_0x5ee357[_0xf53c('0x16')]()]+_0xf53c('0x36'));return _0x37cd2b;}return createEndUser(_0x37cd2b,_0x35113e,_0x40e0a4,_0x445c47,_0x345026,_0x5ee357)['then'](function(_0x558d4b){logger[_0xf53c('0x22')]('['+[_0x5ee357[_0xf53c('0x16')]()]+_0xf53c('0x37'),_0x558d4b[_0xf53c('0x2f')]);return _0x558d4b;});});}function getCustomFields(_0x350d24,_0xce038e,_0x5c3e8c){var _0x501a92={};if(_0x350d24[_0xf53c('0x1f')]>0x0){_[_0xf53c('0x38')](_0x350d24,function(_0x29cfba){if(_[_0xf53c('0x39')]([_0xf53c('0x3a'),_0xf53c('0x3b')],_0x29cfba[_0xf53c('0x3c')])&&_0x29cfba['nameField']&&!_0x29cfba[_0xf53c('0x3d')]){var _0x2411af=_0x29cfba[_0xf53c('0x3e')][_0xf53c('0x26')]();var _0x22add5=_0x2411af[_0xf53c('0x2d')](0x0,_0x2411af['indexOf']('_'));var _0x5c2573=_0x2411af[_0xf53c('0x2d')](_0x2411af['indexOf']('_')+0x1);if(_0x22add5===_0x5c3e8c){_0x501a92[_0x5c2573]=_0x29cfba['content'];}}});}return _0x501a92;}function getTicket(_0x525ab5,_0x179267,_0x31dae1,_0x4b8e10,_0x4e6d27,_0x53fc3e,_0x523044){return new BPromise(function(_0x2cd972,_0x44a2a1){var _0x325c80;return getAuthToken(_0x179267,_0x31dae1,_0x523044)[_0xf53c('0x12')](function(_0x34b6c1){if(_0x53fc3e['ticketType']===_0xf53c('0x3f')){_0x325c80={'method':_0xf53c('0xd'),'uri':_0x4b8e10+_0xf53c('0x40'),'body':Object['assign']({},{'title':intUtil[_0xf53c('0x41')](_0x53fc3e['Subjects'],_0x4e6d27,'\x20'),'description':intUtil[_0xf53c('0x41')](_0x53fc3e[_0xf53c('0x42')],_0x4e6d27,'\x0a'),'customerid_contact@odata.bind':_0x525ab5[_0xf53c('0x2f')]?_0xf53c('0x43')+_0x525ab5['enduserId']+')':undefined,'ownerid@odata.bind':_0xf53c('0x44')+_0x525ab5[_0xf53c('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x53fc3e[_0xf53c('0x45')],_0x4e6d27,_0x53fc3e[_0xf53c('0x46')])),'headers':{'Authorization':'Bearer\x20'+_0x34b6c1,'OData-Version':_0xf53c('0x2b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x53fc3e[_0xf53c('0x46')]===_0xf53c('0x47')){var _0x428a31=_0x525ab5[_0xf53c('0x2f')]?[{'partyid_systemuser@odata.bind':_0xf53c('0x44')+_0x525ab5[_0xf53c('0x24')]+')','participationtypemask':_0x525ab5[_0xf53c('0x48')]===_0xf53c('0x49')?0x2:0x1},{'partyid_contact@odata.bind':_0xf53c('0x43')+_0x525ab5['enduserId']+')','participationtypemask':_0x525ab5[_0xf53c('0x48')]===_0xf53c('0x49')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xf53c('0x44')+_0x525ab5['userId']+')','participationtypemask':_0x525ab5[_0xf53c('0x48')]===_0xf53c('0x49')?0x2:0x1}];_0x325c80={'method':_0xf53c('0xd'),'uri':_0x4b8e10+_0xf53c('0x4a'),'body':Object[_0xf53c('0x4b')]({},{'subject':intUtil[_0xf53c('0x41')](_0x53fc3e['Subjects'],_0x4e6d27,'\x20'),'phonenumber':String(_0x4e6d27[_0xf53c('0x28')]),'description':intUtil[_0xf53c('0x41')](_0x53fc3e[_0xf53c('0x42')],_0x4e6d27,'\x0a'),'regardingobjectid_contact@odata.bind':_0x525ab5[_0xf53c('0x2f')]?_0xf53c('0x43')+_0x525ab5['enduserId']+')':undefined,'ownerid@odata.bind':_0xf53c('0x44')+_0x525ab5['userId']+')','directioncode':_0x525ab5[_0xf53c('0x48')]===_0xf53c('0x49')?![]:!![],'phonecall_activity_parties':_0x428a31},getCustomFields(_0x53fc3e[_0xf53c('0x45')],_0x4e6d27,_0x53fc3e[_0xf53c('0x46')])),'headers':{'Authorization':'Bearer\x20'+_0x34b6c1,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x325c80);})[_0xf53c('0x12')](function(_0x220071){var _0x53e003=_0x220071[_0xf53c('0x4c')][_0xf53c('0x2c')];var _0x2d6031=_0x53e003[_0xf53c('0x2d')](_0x53e003[_0xf53c('0x2e')]('(')+0x1,_0x53e003[_0xf53c('0x2e')](')'));_0x525ab5[_0xf53c('0x4d')]=_0x2d6031;_0x2cd972(_0x525ab5);})[_0xf53c('0x14')](function(_0x1c6f13){_0x44a2a1(_0x1c6f13[_0xf53c('0x17')]);});});}function emit(_0x5b2416,_0x1322f5,_0x31d6cd,_0x378b5c){var _0x6853f1={'uri':util['format'](_0xf53c('0x4e'),_0x5b2416,_0x31d6cd,_0x378b5c)};io['to'](util[_0xf53c('0x4f')](_0xf53c('0x50'),_0x1322f5))['emit']('trigger:browser:url',_0x6853f1);}exports['cs']=function(_0x599499,_0x2e7a82,_0x8b57c7,_0x5c57aa,_0x86afd6,_0x49e57b,_0x11e09f,_0x5ffa52){var _0x19b6ac={};_0x49e57b[_0xf53c('0xf')]=intUtil[_0xf53c('0x51')](_0x49e57b[_0xf53c('0xf')]);_0x49e57b[_0xf53c('0x52')]=intUtil[_0xf53c('0x51')](_0x49e57b[_0xf53c('0x52')]);_0x19b6ac['callDirection']=_0x5ffa52===_0xf53c('0x49')||_0x5ffa52===_0xf53c('0x53')?_0xf53c('0x49'):_0xf53c('0x27');var _0x2e7faf=util['format'](_0xf53c('0x54'),_0x49e57b[_0xf53c('0xf')]);var _0x5e798a=util[_0xf53c('0x4f')](_0xf53c('0x55'),_0x49e57b[_0xf53c('0x56')]);var _0x70ac62=util['format'](_0xf53c('0x57'),_0x49e57b[_0xf53c('0x52')],_0x2e7a82[_0xf53c('0x58')],md5(_0x2e7a82['uniqueid']));if(_0x86afd6&&_0x86afd6[_0xf53c('0x59')]){logger['info']('[QUEUE]',_0xf53c('0x5a'));_0x2e7a82[_0xf53c('0x5b')]=_0x70ac62;}else if(_0x11e09f&&_0x11e09f[_0xf53c('0x5c')]&&_0x11e09f['recordingFormat']!=='none'){logger[_0xf53c('0x22')](_0xf53c('0x5d'),_0xf53c('0x5a'));_0x2e7a82[_0xf53c('0x5b')]=_0x70ac62;}else{_0x2e7a82[_0xf53c('0x5b')]='';}return getUser(_0x19b6ac,_0x49e57b,_0x5c57aa,_0x5e798a,_0x2e7faf,_0x5ffa52)['then'](function(_0x3b1435){logger['info']('['+_0x5ffa52[_0xf53c('0x16')]()+_0xf53c('0x5e'),_0x3b1435[_0xf53c('0x24')]);logger[_0xf53c('0x22')]('['+_0x5ffa52[_0xf53c('0x16')]()+_0xf53c('0x5f'),_0x3b1435['userEmail']);return getEndUser(_0x3b1435,_0x49e57b,_0x5e798a,_0x2e7faf,_0x2e7a82,_0x5ffa52,_0x8b57c7[_0xf53c('0x60')]);})['then'](function(_0x159045){logger[_0xf53c('0x22')]('['+_0x5ffa52['toUpperCase']()+_0xf53c('0x61'),_0x159045[_0xf53c('0x2f')]);logger[_0xf53c('0x22')]('['+_0x5ffa52[_0xf53c('0x16')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x2e7a82[_0xf53c('0x28')]);return getTicket(_0x159045,_0x49e57b,_0x5e798a,_0x2e7faf,_0x2e7a82,_0x8b57c7,_0x5ffa52);})[_0xf53c('0x12')](function(_0x1a415e){logger[_0xf53c('0x22')](util[_0xf53c('0x4f')]('['+_0x5ffa52[_0xf53c('0x16')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x8b57c7[_0xf53c('0x46')],_0x1a415e[_0xf53c('0x4d')]));logger[_0xf53c('0x22')](util[_0xf53c('0x4f')]('['+_0x5ffa52[_0xf53c('0x16')]()+_0xf53c('0x62'),_0x5ffa52));if(_0x5ffa52!=='unmanaged'){logger[_0xf53c('0x22')]('['+_0x5ffa52[_0xf53c('0x16')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x49e57b[_0xf53c('0xf')],_0x5c57aa['name'],_0x8b57c7[_0xf53c('0x46')],_0x1a415e['ticketId']);}})[_0xf53c('0x14')](function(_0x8ef8a0){logger['error']('['+_0x5ffa52[_0xf53c('0x16')]()+_0xf53c('0x63'),util[_0xf53c('0x64')](_0x8ef8a0,{'showHidden':!![],'depth':null}));});}; \ 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 346d541..5d52122 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 _0x9952=['then','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','stringify','GET','forEach','includes','string','picklist','type','nameField','toLowerCase','content','idField','customField','variable','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','%s/helpdesk/tickets/%d','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/environment','freshdesk','redis','defaults','socket.io-emitter','application/json','info','merge','calleridnum','Subjects','getString','Tags','name','custom_fields','mapValues','keyBy','format','%s/api/v2/tickets','remoteUri','Ticket\x20created!','validateEmail','%s/api/v2/agents'];(function(_0x2e18a9,_0x2ae8c2){var _0x39d8d7=function(_0x4729ef){while(--_0x4729ef){_0x2e18a9['push'](_0x2e18a9['shift']());}};_0x39d8d7(++_0x2ae8c2);}(_0x9952,0x97));var _0x2995=function(_0x102f97,_0x5bda2f){_0x102f97=_0x102f97-0x0;var _0xd22058=_0x9952[_0x102f97];return _0xd22058;};'use strict';var _=require(_0x2995('0x0'));var rp=require(_0x2995('0x1'));var md5=require(_0x2995('0x2'));var util=require(_0x2995('0x3'));var Redis=require(_0x2995('0x4'));var intUtil=require('./util');var config=require(_0x2995('0x5'));var logger=require('../../../../config/logger')(_0x2995('0x6'));config[_0x2995('0x7')]=_[_0x2995('0x8')](config[_0x2995('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x2995('0x9'))(new Redis(config[_0x2995('0x7')]));var headers={'Content-Type':_0x2995('0xa'),'Accept':_0x2995('0xa')};function emit(_0x35be0b,_0x8e93fc,_0x490822){io['to'](_0x35be0b)['emit'](_0x8e93fc,_0x490822);}function getTicket(_0x1a1cd7,_0x150ac8,_0x565cc5,_0x3bc256,_0x5f0781){logger[_0x2995('0xb')]('Creating\x20new\x20ticket...');var _0x5ca078=_[_0x2995('0xc')]({'responder_id':_0x150ac8['id'],'requester_id':_0x565cc5['id'],'name':util['format']('Caller\x20-\x20%s',_0x5f0781['calleridname']),'phone':_0x5f0781[_0x2995('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x3bc256[_0x2995('0xe')],_0x5f0781,'\x20'),'description':intUtil[_0x2995('0xf')](_0x3bc256['Descriptions'],_0x5f0781,'
'),'tags':getTags(_0x3bc256[_0x2995('0x10')],_0x2995('0x11'))},getCustomFields(_0x3bc256['Fields'],_0x5f0781));_0x5ca078[_0x2995('0x12')]=_[_0x2995('0x13')](_[_0x2995('0x14')](_0x5ca078[_0x2995('0x12')],'id'),'value');return request({'uri':util[_0x2995('0x15')](_0x2995('0x16'),_0x1a1cd7[_0x2995('0x17')]),'method':'POST','body':_0x5ca078})['then'](function(_0xdda060){logger[_0x2995('0xb')](_0x2995('0x18'));return _0xdda060;});}function getUser(_0x374871,_0x541275){if(intUtil[_0x2995('0x19')](_0x541275)){return request({'uri':util[_0x2995('0x15')](_0x2995('0x1a'),_0x374871[_0x2995('0x17')]),'qs':{'email':_0x541275}})[_0x2995('0x1b')](function(_0x278135){if(_0x278135['length']){logger[_0x2995('0xb')](_0x2995('0x1c'));return _[_0x2995('0x1d')](_0x278135,function(_0x133b1a){return _0x133b1a[_0x2995('0x1e')][_0x2995('0x1f')]===_0x541275;});}else{logger[_0x2995('0xb')](_0x2995('0x20'));return request({'uri':util[_0x2995('0x15')](_0x2995('0x21'),_0x374871[_0x2995('0x17')])})['then'](function(_0x1835dd){logger[_0x2995('0xb')]('Admin\x20account\x20selected.');return _0x1835dd;});}});}else{logger[_0x2995('0xb')](_0x2995('0x22'));return request({'uri':util[_0x2995('0x15')](_0x2995('0x21'),_0x374871[_0x2995('0x17')])})[_0x2995('0x1b')](function(_0x58824e){logger[_0x2995('0xb')](_0x2995('0x23'));return _0x58824e;});}}function getEndUser(_0x2a9eae,_0x489e5d,_0xa2d86d){logger[_0x2995('0xb')]('Searching\x20enduser\x20with\x20phone',_0xa2d86d);return request({'uri':util[_0x2995('0x15')]('%s/api/v2/contacts',_0x2a9eae['remoteUri']),'qs':{'phone':_0xa2d86d}})['then'](function(_0x555303){if(_0x555303[_0x2995('0x24')]){logger[_0x2995('0xb')](_0x2995('0x25'));return _[_0x2995('0x1d')](_0x555303,{'phone':_0xa2d86d});}else{logger['info'](_0x2995('0x26'));return request({'uri':util['format']('%s/api/v2/contacts',_0x2a9eae[_0x2995('0x17')]),'method':_0x2995('0x27'),'body':{'name':_0x489e5d,'phone':_0xa2d86d}})[_0x2995('0x1b')](function(_0x5406a8){logger['info'](_0x2995('0x28'));return _0x5406a8;});}});}function getAuth(_0x79f66a){return util[_0x2995('0x15')](_0x2995('0x29'),new Buffer(_0x79f66a[_0x2995('0x2a')]+':X')[_0x2995('0x2b')](_0x2995('0x2c')));}function request(_0x96ebd5){logger[_0x2995('0x2d')]('[HTTP]',JSON[_0x2995('0x2e')](_0x96ebd5));return rp(_['defaults'](_0x96ebd5,{'method':_0x2995('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0xc6cacb,_0x1c6b75){var _0x59e9c9=[];if(_0xc6cacb&&_0xc6cacb[_0x2995('0x24')]>0x0){_0x59e9c9=_['map'](_0xc6cacb,_0x1c6b75);}return _0x59e9c9;}function getCustomFields(_0x31a687,_0xfbbd69){var _0x41622a=[];var _0x1f3289={'custom_fields':[]};if(_0x31a687[_0x2995('0x24')]>0x0){_[_0x2995('0x30')](_0x31a687,function(_0x73e4a8){if(_[_0x2995('0x31')]([_0x2995('0x32'),_0x2995('0x33')],_0x73e4a8[_0x2995('0x34')])&&_0x73e4a8[_0x2995('0x35')]&&!_0x73e4a8['customField']){_0x1f3289[_0x73e4a8['nameField'][_0x2995('0x36')]()]=_0x73e4a8[_0x2995('0x37')]['toString']();}else if(_[_0x2995('0x31')]([_0x2995('0x32'),'picklist'],_0x73e4a8[_0x2995('0x34')])&&_0x73e4a8[_0x2995('0x38')]&&_0x73e4a8[_0x2995('0x39')]){_0x1f3289[_0x2995('0x12')]['push']({'id':_0x73e4a8[_0x2995('0x38')],'value':_0x73e4a8['content'][_0x2995('0x2b')]()});}else if(_0x73e4a8[_0x2995('0x34')]===_0x2995('0x3a')&&_0x73e4a8[_0x2995('0x3b')]&&_0x73e4a8['idField']&&_0x73e4a8[_0x2995('0x39')]){_0xfbbd69[_0x73e4a8[_0x2995('0x3b')]]&&_0x1f3289[_0x2995('0x12')]['push']({'id':_0x73e4a8[_0x2995('0x38')],'value':_0xfbbd69[_0x73e4a8[_0x2995('0x3b')]][_0x2995('0x2b')]()});}else if(_0x73e4a8[_0x2995('0x34')]===_0x2995('0x3c')&&_0x73e4a8[_0x2995('0x3d')]&&_0x73e4a8[_0x2995('0x3d')][_0x2995('0x11')]&&_0x73e4a8[_0x2995('0x38')]&&_0x73e4a8[_0x2995('0x39')]){_0xfbbd69[_0x73e4a8[_0x2995('0x3d')][_0x2995('0x11')][_0x2995('0x36')]()]&&_0x1f3289[_0x2995('0x12')]['push']({'id':_0x73e4a8[_0x2995('0x38')],'value':_0xfbbd69[_0x73e4a8['Variable'][_0x2995('0x11')][_0x2995('0x36')]()]['toString']()});}});}return _0x1f3289;}exports[_0x2995('0x3e')]=function(_0x5884cb,_0x339011,_0x31e151,_0x46f0e5,_0x54ea32,_0x1a0884){var _0x387cb4,_0x516254;_0x1a0884[_0x2995('0x17')]=intUtil['stripTrailingSlash'](_0x1a0884['remoteUri']);_0x1a0884[_0x2995('0x3f')]=intUtil[_0x2995('0x40')](_0x1a0884[_0x2995('0x3f')]);if(_0x54ea32&&_0x54ea32['monitor_format']){logger[_0x2995('0xb')](_0x2995('0x41'),_0x2995('0x42'));_0x339011[_0x2995('0x43')]=util['format'](_0x2995('0x44'),_0x1a0884[_0x2995('0x3f')],_0x339011['uniqueid'],md5(_0x339011[_0x2995('0x45')]));}else{_0x339011[_0x2995('0x43')]='';}headers[_0x2995('0x46')]=getAuth(_0x1a0884);return getUser(_0x1a0884,_0x46f0e5[_0x2995('0x1f')])[_0x2995('0x1b')](function(_0x59a09){_0x387cb4=_0x59a09;logger['info'](_0x2995('0x47'),_0x387cb4['id']);return getEndUser(_0x1a0884,_0x339011[_0x2995('0x48')],_0x339011[_0x2995('0xd')]);})['then'](function(_0x6da835){_0x516254=_0x6da835;logger[_0x2995('0xb')](_0x2995('0x49'),_0x516254['id']);return getTicket(_0x1a0884,_0x387cb4,_0x516254,_0x31e151,_0x339011);})[_0x2995('0x1b')](function(_0xd1e451){if(_0xd1e451&&_0xd1e451['id']){logger[_0x2995('0xb')]('Ticket\x20created!');logger[_0x2995('0xb')](_0x2995('0x4a'),_0xd1e451['id']);logger[_0x2995('0xb')](_0x2995('0x41'),_0x2995('0x4b'));emit(util['format'](_0x2995('0x4c'),_0x46f0e5[_0x2995('0x11')]),_0x2995('0x4d'),{'uri':util[_0x2995('0x15')]('%s/helpdesk/tickets/%d',_0x1a0884[_0x2995('0x17')],_0xd1e451['id'])});}})[_0x2995('0x4e')](function(_0x98f274){logger['error'](_0x2995('0x41'),JSON[_0x2995('0x2e')](_0x98f274));});};exports[_0x2995('0x4f')]=function(_0x3ca35d,_0x19c83d,_0x1966ec,_0x535b8e,_0x1828fd,_0x5dace1,_0x387d71){var _0x5b300f,_0x452ea1;_0x5dace1[_0x2995('0x17')]=intUtil['stripTrailingSlash'](_0x5dace1[_0x2995('0x17')]);_0x5dace1[_0x2995('0x3f')]=intUtil[_0x2995('0x40')](_0x5dace1['serverUrl']);if(_0x387d71&&_0x387d71[_0x2995('0x50')]&&_0x387d71[_0x2995('0x50')]!==_0x2995('0x51')){logger[_0x2995('0xb')](_0x2995('0x52'),'Recording\x20is\x20enabled!');_0x19c83d[_0x2995('0x43')]=util[_0x2995('0x15')](_0x2995('0x44'),_0x5dace1[_0x2995('0x3f')],_0x19c83d[_0x2995('0x45')],md5(_0x19c83d['uniqueid']));}headers['Authorization']=getAuth(_0x5dace1);return getUser(_0x5dace1,_0x535b8e[_0x2995('0x1f')])['then'](function(_0x24546a){_0x5b300f=_0x24546a;logger[_0x2995('0xb')](_0x2995('0x47'),_0x5b300f['id']);return getEndUser(_0x5dace1,_0x19c83d['destcalleridname'],_0x19c83d[_0x2995('0x53')]);})['then'](function(_0x306575){_0x452ea1=_0x306575;logger[_0x2995('0xb')](_0x2995('0x49'),_0x452ea1['id']);return getTicket(_0x5dace1,_0x5b300f,_0x452ea1,_0x1966ec,_0x19c83d);})[_0x2995('0x1b')](function(_0x41ede9){if(_0x41ede9&&_0x41ede9['id']){logger[_0x2995('0xb')](_0x2995('0x18'));logger[_0x2995('0xb')](_0x2995('0x4a'),_0x41ede9['id']);logger[_0x2995('0xb')](_0x2995('0x52'),_0x2995('0x4b'));emit(util[_0x2995('0x15')](_0x2995('0x4c'),_0x535b8e['name']),_0x2995('0x4d'),{'uri':util['format'](_0x2995('0x54'),_0x5dace1['remoteUri'],_0x41ede9['id'])});}})[_0x2995('0x4e')](function(_0x5a24e0){logger[_0x2995('0x55')](_0x2995('0x52'),JSON[_0x2995('0x2e')](_0x5a24e0));});};exports[_0x2995('0x56')]=function(_0x12aed3,_0x20dec4,_0x34a01a,_0x473e19,_0x12d792,_0x2419a8){var _0x4734e0,_0x5012f0;_0x2419a8['remoteUri']=intUtil['stripTrailingSlash'](_0x2419a8[_0x2995('0x17')]);_0x2419a8[_0x2995('0x3f')]=intUtil['stripTrailingSlash'](_0x2419a8[_0x2995('0x3f')]);if(_0x12d792&&_0x12d792['monitor_format']){logger[_0x2995('0xb')]('['+_0x20dec4[_0x2995('0x57')][_0x2995('0x58')]()+']',_0x2995('0x42'));_0x20dec4['recordingURL']=util[_0x2995('0x15')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2419a8['serverUrl'],_0x20dec4[_0x2995('0x45')],md5(_0x20dec4[_0x2995('0x45')]));}else{_0x20dec4[_0x2995('0x43')]='';}headers['Authorization']=getAuth(_0x2419a8);return getUser(_0x2419a8,'')[_0x2995('0x1b')](function(_0x1f5951){_0x4734e0=_0x1f5951;logger[_0x2995('0xb')](_0x2995('0x47'),_0x4734e0['id']);return getEndUser(_0x2419a8,_0x20dec4[_0x2995('0x48')],_0x20dec4[_0x2995('0xd')]);})[_0x2995('0x1b')](function(_0x15d754){_0x5012f0=_0x15d754;logger[_0x2995('0xb')]('The\x20Enduser\x20ID\x20is:',_0x5012f0['id']);return getTicket(_0x2419a8,_0x4734e0,_0x5012f0,_0x34a01a,_0x20dec4);})['then'](function(_0x3ae851){if(_0x3ae851){logger[_0x2995('0xb')](_0x2995('0x18'));logger[_0x2995('0xb')](_0x2995('0x4a'),_0x3ae851['id']);}})[_0x2995('0x4e')](function(_0x10d414){logger[_0x2995('0x55')]('['+_0x20dec4[_0x2995('0x57')][_0x2995('0x58')]()+']',JSON[_0x2995('0x2e')](_0x10d414));});}; \ No newline at end of file +var _0x3662=['format','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','%s/api/v2/agents','length','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','then','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Basic\x20%s','apiKey','base64','debug','stringify','GET','forEach','includes','string','nameField','customField','toLowerCase','toString','picklist','type','push','idField','content','variable','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','error','unmanaged','toUpperCase','Recording\x20is\x20enabled!','Authorization','lastevent','request-promise','md5','util','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','custom_fields','mapValues','keyBy'];(function(_0x1e0a4a,_0x3abb56){var _0x4f9842=function(_0x58b15a){while(--_0x58b15a){_0x1e0a4a['push'](_0x1e0a4a['shift']());}};_0x4f9842(++_0x3abb56);}(_0x3662,0x156));var _0x2366=function(_0x5813c8,_0x529f07){_0x5813c8=_0x5813c8-0x0;var _0x1f3aa0=_0x3662[_0x5813c8];return _0x1f3aa0;};'use strict';var _=require('lodash');var rp=require(_0x2366('0x0'));var md5=require(_0x2366('0x1'));var util=require(_0x2366('0x2'));var Redis=require(_0x2366('0x3'));var intUtil=require(_0x2366('0x4'));var config=require('../../../../config/environment');var logger=require(_0x2366('0x5'))(_0x2366('0x6'));config[_0x2366('0x7')]=_[_0x2366('0x8')](config['redis'],{'host':_0x2366('0x9'),'port':0x18eb});var io=require(_0x2366('0xa'))(new Redis(config['redis']));var headers={'Content-Type':_0x2366('0xb'),'Accept':_0x2366('0xb')};function emit(_0x2a9b21,_0x118a7e,_0x1bd667){io['to'](_0x2a9b21)['emit'](_0x118a7e,_0x1bd667);}function getTicket(_0x907181,_0x2aecb2,_0x16cf95,_0xbc563a,_0x4a052b){logger[_0x2366('0xc')](_0x2366('0xd'));var _0x45dd2d=_[_0x2366('0xe')]({'responder_id':_0x2aecb2['id'],'requester_id':_0x16cf95['id'],'name':util['format']('Caller\x20-\x20%s',_0x4a052b[_0x2366('0xf')]),'phone':_0x4a052b[_0x2366('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x2366('0x11')](_0xbc563a[_0x2366('0x12')],_0x4a052b,'\x20'),'description':intUtil[_0x2366('0x11')](_0xbc563a[_0x2366('0x13')],_0x4a052b,_0x2366('0x14')),'tags':getTags(_0xbc563a[_0x2366('0x15')],_0x2366('0x16'))},getCustomFields(_0xbc563a['Fields'],_0x4a052b));_0x45dd2d[_0x2366('0x17')]=_[_0x2366('0x18')](_[_0x2366('0x19')](_0x45dd2d['custom_fields'],'id'),'value');return request({'uri':util[_0x2366('0x1a')](_0x2366('0x1b'),_0x907181[_0x2366('0x1c')]),'method':_0x2366('0x1d'),'body':_0x45dd2d})['then'](function(_0x21d61f){logger[_0x2366('0xc')](_0x2366('0x1e'));return _0x21d61f;});}function getUser(_0x5cfc06,_0x59c27c){if(intUtil['validateEmail'](_0x59c27c)){return request({'uri':util[_0x2366('0x1a')](_0x2366('0x1f'),_0x5cfc06[_0x2366('0x1c')]),'qs':{'email':_0x59c27c}})['then'](function(_0x287953){if(_0x287953[_0x2366('0x20')]){logger['info']('Agent\x20found!');return _[_0x2366('0x21')](_0x287953,function(_0x12cde9){return _0x12cde9['contact']['email']===_0x59c27c;});}else{logger[_0x2366('0xc')](_0x2366('0x22'));return request({'uri':util[_0x2366('0x1a')](_0x2366('0x23'),_0x5cfc06[_0x2366('0x1c')])})[_0x2366('0x24')](function(_0x59de51){logger[_0x2366('0xc')](_0x2366('0x25'));return _0x59de51;});}});}else{logger[_0x2366('0xc')](_0x2366('0x26'));return request({'uri':util['format'](_0x2366('0x23'),_0x5cfc06[_0x2366('0x1c')])})['then'](function(_0x53232f){logger[_0x2366('0xc')](_0x2366('0x25'));return _0x53232f;});}}function getEndUser(_0x18583b,_0x57c970,_0x4d7c00){logger[_0x2366('0xc')](_0x2366('0x27'),_0x4d7c00);return request({'uri':util[_0x2366('0x1a')]('%s/api/v2/contacts',_0x18583b['remoteUri']),'qs':{'phone':_0x4d7c00}})['then'](function(_0x2c6447){if(_0x2c6447[_0x2366('0x20')]){logger[_0x2366('0xc')](_0x2366('0x28'));return _[_0x2366('0x21')](_0x2c6447,{'phone':_0x4d7c00});}else{logger[_0x2366('0xc')](_0x2366('0x29'));return request({'uri':util[_0x2366('0x1a')](_0x2366('0x2a'),_0x18583b[_0x2366('0x1c')]),'method':_0x2366('0x1d'),'body':{'name':_0x57c970,'phone':_0x4d7c00}})[_0x2366('0x24')](function(_0x3e71ea){logger[_0x2366('0xc')]('Enduser\x20created.');return _0x3e71ea;});}});}function getAuth(_0x1eef36){return util['format'](_0x2366('0x2b'),new Buffer(_0x1eef36[_0x2366('0x2c')]+':X')['toString'](_0x2366('0x2d')));}function request(_0x37010f){logger[_0x2366('0x2e')]('[HTTP]',JSON[_0x2366('0x2f')](_0x37010f));return rp(_[_0x2366('0x8')](_0x37010f,{'method':_0x2366('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x4a7e93,_0x391ac5){var _0x494df8=[];if(_0x4a7e93&&_0x4a7e93['length']>0x0){_0x494df8=_['map'](_0x4a7e93,_0x391ac5);}return _0x494df8;}function getCustomFields(_0x54e68b,_0x3004ca){var _0x3554aa=[];var _0x4770d5={'custom_fields':[]};if(_0x54e68b[_0x2366('0x20')]>0x0){_[_0x2366('0x31')](_0x54e68b,function(_0x4ac68e){if(_[_0x2366('0x32')]([_0x2366('0x33'),'picklist'],_0x4ac68e['type'])&&_0x4ac68e[_0x2366('0x34')]&&!_0x4ac68e[_0x2366('0x35')]){_0x4770d5[_0x4ac68e[_0x2366('0x34')][_0x2366('0x36')]()]=_0x4ac68e['content'][_0x2366('0x37')]();}else if(_['includes'](['string',_0x2366('0x38')],_0x4ac68e[_0x2366('0x39')])&&_0x4ac68e['idField']&&_0x4ac68e[_0x2366('0x35')]){_0x4770d5[_0x2366('0x17')][_0x2366('0x3a')]({'id':_0x4ac68e[_0x2366('0x3b')],'value':_0x4ac68e[_0x2366('0x3c')][_0x2366('0x37')]()});}else if(_0x4ac68e[_0x2366('0x39')]===_0x2366('0x3d')&&_0x4ac68e[_0x2366('0x3e')]&&_0x4ac68e[_0x2366('0x3b')]&&_0x4ac68e['customField']){_0x3004ca[_0x4ac68e[_0x2366('0x3e')]]&&_0x4770d5['custom_fields'][_0x2366('0x3a')]({'id':_0x4ac68e[_0x2366('0x3b')],'value':_0x3004ca[_0x4ac68e[_0x2366('0x3e')]][_0x2366('0x37')]()});}else if(_0x4ac68e[_0x2366('0x39')]===_0x2366('0x3f')&&_0x4ac68e[_0x2366('0x40')]&&_0x4ac68e[_0x2366('0x40')][_0x2366('0x16')]&&_0x4ac68e[_0x2366('0x3b')]&&_0x4ac68e['customField']){_0x3004ca[_0x4ac68e[_0x2366('0x40')]['name'][_0x2366('0x36')]()]&&_0x4770d5[_0x2366('0x17')][_0x2366('0x3a')]({'id':_0x4ac68e[_0x2366('0x3b')],'value':_0x3004ca[_0x4ac68e['Variable'][_0x2366('0x16')][_0x2366('0x36')]()][_0x2366('0x37')]()});}});}return _0x4770d5;}exports[_0x2366('0x41')]=function(_0x3567d6,_0x59cd21,_0x198cd1,_0x2a2f0a,_0x13d3b9,_0x1eaa51){var _0x29f659,_0x5969d0;_0x1eaa51[_0x2366('0x1c')]=intUtil['stripTrailingSlash'](_0x1eaa51[_0x2366('0x1c')]);_0x1eaa51[_0x2366('0x42')]=intUtil[_0x2366('0x43')](_0x1eaa51[_0x2366('0x42')]);if(_0x13d3b9&&_0x13d3b9[_0x2366('0x44')]){logger[_0x2366('0xc')](_0x2366('0x45'),'Recording\x20is\x20enabled!');_0x59cd21[_0x2366('0x46')]=util[_0x2366('0x1a')](_0x2366('0x47'),_0x1eaa51[_0x2366('0x42')],_0x59cd21[_0x2366('0x48')],md5(_0x59cd21['uniqueid']));}else{_0x59cd21[_0x2366('0x46')]='';}headers['Authorization']=getAuth(_0x1eaa51);return getUser(_0x1eaa51,_0x2a2f0a[_0x2366('0x49')])[_0x2366('0x24')](function(_0x49d054){_0x29f659=_0x49d054;logger[_0x2366('0xc')](_0x2366('0x4a'),_0x29f659['id']);return getEndUser(_0x1eaa51,_0x59cd21['calleridname'],_0x59cd21['calleridnum']);})[_0x2366('0x24')](function(_0x2d72cd){_0x5969d0=_0x2d72cd;logger[_0x2366('0xc')](_0x2366('0x4b'),_0x5969d0['id']);return getTicket(_0x1eaa51,_0x29f659,_0x5969d0,_0x198cd1,_0x59cd21);})['then'](function(_0x15bcae){if(_0x15bcae&&_0x15bcae['id']){logger['info'](_0x2366('0x1e'));logger[_0x2366('0xc')](_0x2366('0x4c'),_0x15bcae['id']);logger[_0x2366('0xc')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2366('0x1a')](_0x2366('0x4d'),_0x2a2f0a[_0x2366('0x16')]),_0x2366('0x4e'),{'uri':util[_0x2366('0x1a')](_0x2366('0x4f'),_0x1eaa51['remoteUri'],_0x15bcae['id'])});}})[_0x2366('0x50')](function(_0x50fd0f){logger['error'](_0x2366('0x45'),JSON[_0x2366('0x2f')](_0x50fd0f));});};exports['outbound']=function(_0x1ced06,_0x2264da,_0x104701,_0x2ea9b7,_0x2626e6,_0x483c65,_0x235b1b){var _0x5695c4,_0x3a24b9;_0x483c65[_0x2366('0x1c')]=intUtil[_0x2366('0x43')](_0x483c65['remoteUri']);_0x483c65[_0x2366('0x42')]=intUtil[_0x2366('0x43')](_0x483c65[_0x2366('0x42')]);if(_0x235b1b&&_0x235b1b[_0x2366('0x51')]&&_0x235b1b[_0x2366('0x51')]!==_0x2366('0x52')){logger[_0x2366('0xc')](_0x2366('0x53'),'Recording\x20is\x20enabled!');_0x2264da[_0x2366('0x46')]=util[_0x2366('0x1a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x483c65['serverUrl'],_0x2264da[_0x2366('0x48')],md5(_0x2264da['uniqueid']));}headers['Authorization']=getAuth(_0x483c65);return getUser(_0x483c65,_0x2ea9b7[_0x2366('0x49')])[_0x2366('0x24')](function(_0x285399){_0x5695c4=_0x285399;logger[_0x2366('0xc')](_0x2366('0x4a'),_0x5695c4['id']);return getEndUser(_0x483c65,_0x2264da[_0x2366('0x54')],_0x2264da[_0x2366('0x55')]);})['then'](function(_0x5b5919){_0x3a24b9=_0x5b5919;logger[_0x2366('0xc')](_0x2366('0x4b'),_0x3a24b9['id']);return getTicket(_0x483c65,_0x5695c4,_0x3a24b9,_0x104701,_0x2264da);})[_0x2366('0x24')](function(_0x1b6f77){if(_0x1b6f77&&_0x1b6f77['id']){logger[_0x2366('0xc')]('Ticket\x20created!');logger[_0x2366('0xc')](_0x2366('0x4c'),_0x1b6f77['id']);logger[_0x2366('0xc')](_0x2366('0x53'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2366('0x1a')](_0x2366('0x4d'),_0x2ea9b7[_0x2366('0x16')]),'trigger:browser:url',{'uri':util[_0x2366('0x1a')](_0x2366('0x4f'),_0x483c65[_0x2366('0x1c')],_0x1b6f77['id'])});}})[_0x2366('0x50')](function(_0x39b779){logger[_0x2366('0x56')](_0x2366('0x53'),JSON['stringify'](_0x39b779));});};exports[_0x2366('0x57')]=function(_0x59177a,_0x566e75,_0x16f943,_0x5f59a3,_0x331fe6,_0x28965e){var _0x367e26,_0x3a4af3;_0x28965e[_0x2366('0x1c')]=intUtil[_0x2366('0x43')](_0x28965e[_0x2366('0x1c')]);_0x28965e['serverUrl']=intUtil[_0x2366('0x43')](_0x28965e['serverUrl']);if(_0x331fe6&&_0x331fe6[_0x2366('0x44')]){logger[_0x2366('0xc')]('['+_0x566e75['lastevent'][_0x2366('0x58')]()+']',_0x2366('0x59'));_0x566e75[_0x2366('0x46')]=util[_0x2366('0x1a')](_0x2366('0x47'),_0x28965e[_0x2366('0x42')],_0x566e75[_0x2366('0x48')],md5(_0x566e75[_0x2366('0x48')]));}else{_0x566e75[_0x2366('0x46')]='';}headers[_0x2366('0x5a')]=getAuth(_0x28965e);return getUser(_0x28965e,'')[_0x2366('0x24')](function(_0x136ebc){_0x367e26=_0x136ebc;logger[_0x2366('0xc')]('The\x20User\x20ID\x20is:',_0x367e26['id']);return getEndUser(_0x28965e,_0x566e75[_0x2366('0xf')],_0x566e75[_0x2366('0x10')]);})[_0x2366('0x24')](function(_0x4c3069){_0x3a4af3=_0x4c3069;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3a4af3['id']);return getTicket(_0x28965e,_0x367e26,_0x3a4af3,_0x16f943,_0x566e75);})[_0x2366('0x24')](function(_0x3f2087){if(_0x3f2087){logger[_0x2366('0xc')](_0x2366('0x1e'));logger[_0x2366('0xc')](_0x2366('0x4c'),_0x3f2087['id']);}})[_0x2366('0x50')](function(_0xa6f43f){logger['error']('['+_0x566e75[_0x2366('0x5b')]['toUpperCase']()+']',JSON[_0x2366('0x2f')](_0xa6f43f));});}; \ 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 cbb5b28..65376d6 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 _0xb611=['find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Contact','ticketId','task','Task\x20created:','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','moment','ioredis','./util','../../../../config/environment','freshsales','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','GET','headers','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userId','User\x20found:','Admin\x20selected','message','&f=','&entities=contact'];(function(_0x32703c,_0x47c18d){var _0x5cc904=function(_0x479ba3){while(--_0x479ba3){_0x32703c['push'](_0x32703c['shift']());}};_0x5cc904(++_0x47c18d);}(_0xb611,0x7f));var _0x1b61=function(_0x29f9af,_0x4f3d10){_0x29f9af=_0x29f9af-0x0;var _0x56e4a8=_0xb611[_0x29f9af];return _0x56e4a8;};'use strict';var _=require(_0x1b61('0x0'));var rp=require(_0x1b61('0x1'));var md5=require('md5');var util=require(_0x1b61('0x2'));var moment=require(_0x1b61('0x3'));var Promise=require('bluebird');var Redis=require(_0x1b61('0x4'));var intUtil=require(_0x1b61('0x5'));var config=require(_0x1b61('0x6'));var logger=require('../../../../config/logger')(_0x1b61('0x7'));config[_0x1b61('0x8')]=_[_0x1b61('0x9')](config[_0x1b61('0x8')],{'host':_0x1b61('0xa'),'port':0x18eb});var io=require(_0x1b61('0xb'))(new Redis(config['redis']));function getAdminId(_0x188c2c,_0x255b59,_0x4e4b64,_0x18ef67){return new Promise(function(_0x4d15ee,_0x269d55){var _0x5596f4=![];var _0xea520c={'method':'GET','uri':_0x18ef67+_0x1b61('0xc'),'json':!![]};_0xea520c['headers']=_0x4e4b64;logger[_0x1b61('0xd')](_0x1b61('0xe'));return rp(_0xea520c)[_0x1b61('0xf')](function(_0x1c1c06){if(_0x1c1c06){var _0x31bbd8=_0x1c1c06[_0x1b61('0x10')];var _0x45f885=null;for(_0x45f885=0x0;_0x45f885<_0x31bbd8[_0x1b61('0x11')];_0x45f885++){if(_0x31bbd8[_0x45f885][_0x1b61('0x12')]===_0x188c2c[_0x1b61('0x13')]){_0x188c2c[_0x1b61('0x14')]=_0x31bbd8[_0x45f885]['id'];_0x5596f4=!![];}}if(_0x5596f4){logger[_0x1b61('0xd')](_0x1b61('0x15'),_0x188c2c[_0x1b61('0x14')]);_0x4d15ee(_0x188c2c);}else{_0x269d55({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x269d55({'statusCode':0x194,'message':_0x1b61('0x16')});}})[_0x1b61('0x17')](function(_0x4b730d){logger[_0x1b61('0x18')]('['+[_0x255b59[_0x1b61('0x19')]()]+']',_0x4b730d['message']);_0x269d55(_0x4b730d);});});}function getUser(_0xb1728f,_0x2568e3,_0x244880){return function(_0x4e24c2){return new Promise(function(_0x1dbbf7,_0x37bd68){var _0x11a865={'method':_0x1b61('0x1a'),'uri':_0x244880+_0x1b61('0xc'),'json':!![]};_0x11a865[_0x1b61('0x1b')]=_0x2568e3;logger['info'](_0x1b61('0x1c'));return rp(_0x11a865)[_0x1b61('0xf')](function(_0x5037b5){if(_0x5037b5){var _0x14074c=_0x5037b5[_0x1b61('0x10')];var _0xd9f32a=![];var _0x457d44=null;if(_0x4e24c2['agentEmail']!==null){logger['info'](_0x1b61('0x1d'),_0x4e24c2[_0x1b61('0x1e')]);_0x4e24c2['userEmail']=_0x4e24c2[_0x1b61('0x1e')];for(_0x457d44=0x0;_0x457d44<_0x14074c[_0x1b61('0x11')];_0x457d44++){if(_0x14074c[_0x457d44][_0x1b61('0x12')]===_0x4e24c2['agentEmail']){_0xd9f32a=!![];_0x4e24c2[_0x1b61('0x1f')]=_0x14074c[_0x457d44]['id'];logger[_0x1b61('0xd')](_0x1b61('0x20'),_0x4e24c2[_0x1b61('0x1f')]);}}}if(!_0xd9f32a){logger[_0x1b61('0xd')](_0x1b61('0x21'));_0x4e24c2['userEmail']=_0x4e24c2[_0x1b61('0x13')];_0x4e24c2['userId']=_0x4e24c2[_0x1b61('0x14')];_0xd9f32a=!![];}if(_0xd9f32a){_0x1dbbf7(_0x4e24c2);}else{_0x37bd68({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x37bd68({'statusCode':0x194,'message':_0x1b61('0x16')});}})[_0x1b61('0x17')](function(_0x2bcd90){logger[_0x1b61('0x18')]('['+[_0xb1728f[_0x1b61('0x19')]()]+']',_0x2bcd90[_0x1b61('0x22')]);_0x37bd68(_0x2bcd90);});});};}function searchContact(_0x27df67,_0x46fc51,_0x432bd7,_0x1a9760){return new Promise(function(_0x2d1243,_0x14d70a){var _0xb3b9ae={'method':_0x1b61('0x1a'),'headers':_0x46fc51,'uri':_0x27df67+'/api/lookup?q='+_0x1a9760+_0x1b61('0x23')+_0x432bd7+_0x1b61('0x24'),'json':!![]};rp(_0xb3b9ae)['then'](function(_0x4234f4){var _0x5bef81=_[_0x1b61('0x25')](_0x4234f4[_0x1b61('0x26')][_0x1b61('0x26')],[_0x432bd7,_0x1a9760]);_0x2d1243(_0x5bef81);})[_0x1b61('0x17')](function(_0x770b73){_0x14d70a(_0x770b73);});});}function getEndUser(_0x3b5e0d,_0xceebdf,_0xa23098){return function(_0x5ac91e){return new Promise(function(_0x28eca1,_0x265d46){logger[_0x1b61('0xd')](util[_0x1b61('0x27')](_0x1b61('0x28'),_0x5ac91e[_0x1b61('0x29')]));searchContact(_0xa23098,_0xceebdf,_0x1b61('0x2a'),_0x5ac91e[_0x1b61('0x29')])[_0x1b61('0xf')](function(_0x335df1){if(_0x335df1){_0x5ac91e['endUserId']=_0x335df1['id'];logger[_0x1b61('0xd')](_0x1b61('0x2b'),_0x5ac91e[_0x1b61('0x2c')]);return _0x28eca1(_0x5ac91e);}searchContact(_0xa23098,_0xceebdf,'work_number',_0x5ac91e[_0x1b61('0x29')])['then'](function(_0x67ec36){if(_0x67ec36){_0x5ac91e[_0x1b61('0x2c')]=_0x67ec36['id'];logger[_0x1b61('0xd')](_0x1b61('0x2d'),_0x5ac91e['endUserId']);return _0x28eca1(_0x5ac91e);}createEndUser(_0x5ac91e,_0x3b5e0d,_0xceebdf,_0xa23098)['then'](function(_0x1b9587){logger[_0x1b61('0xd')](_0x1b61('0x2e'),_0x1b9587[_0x1b61('0x2c')]);return _0x28eca1(_0x1b9587);});});})['catch'](function(_0x295836){_0x265d46(_0x295836);});});};}function createEndUser(_0x4127bf,_0x136a5c,_0x9629f0,_0x3a30e5){return new Promise(function(_0x15acd8,_0x5b539f){var _0x586d7d=moment();var _0x4ca6de={'method':_0x1b61('0x2f'),'uri':_0x3a30e5+_0x1b61('0x30'),'body':{'contact':{'last_name':_0x4127bf[_0x1b61('0x29')],'work_number':_0x4127bf['contactNumber'],'mobile_number':_0x4127bf['contactNumber'],'owner_id':_0x4127bf[_0x1b61('0x1f')],'created_at':_0x586d7d[_0x1b61('0x27')](_0x1b61('0x31'))}},'json':!![]};_0x4ca6de[_0x1b61('0x1b')]=_0x9629f0;logger['info'](_0x1b61('0x32'));return rp(_0x4ca6de)[_0x1b61('0xf')](function(_0x35b6c8){_0x4127bf[_0x1b61('0x2c')]=_0x35b6c8[_0x1b61('0x33')]['id'];_0x15acd8(_0x4127bf);})[_0x1b61('0x17')](function(_0xf1537c){logger[_0x1b61('0x18')]('['+[_0x136a5c[_0x1b61('0x19')]()]+']',_0xf1537c[_0x1b61('0x22')]);_0x5b539f(_0xf1537c['message']);});});}function getTicket(_0xe8b1bb,_0x45e66d,_0x2dada5,_0x4cb96b,_0x358fdc){return function(_0x54af12){logger[_0x1b61('0xd')](_0x1b61('0x34'));return new Promise(function(_0x542e9d,_0x12f575){var _0x3711e0=moment();var _0x50c2d8={'method':_0x1b61('0x2f'),'uri':_0x2dada5+_0x1b61('0x35'),'body':{'title':intUtil['getString'](_0x4cb96b[_0x1b61('0x36')],_0x358fdc,'\x20'),'description':intUtil[_0x1b61('0x37')](_0x4cb96b['Descriptions'],_0x358fdc,'\x0a'),'owner_id':_0x54af12[_0x1b61('0x1f')],'creater_id':_0x54af12[_0x1b61('0x14')],'targetable_id':_0x54af12[_0x1b61('0x2c')],'targetable_type':_0x1b61('0x38'),'created_at':_0x3711e0[_0x1b61('0x27')](_0x1b61('0x31')),'due_date':_0x3711e0['add'](0x1e,'m')[_0x1b61('0x27')](_0x1b61('0x31'))},'json':!![]};_0x50c2d8['headers']=_0x45e66d;return rp(_0x50c2d8)[_0x1b61('0xf')](function(_0x269fe9){_0x54af12[_0x1b61('0x39')]=_0x269fe9[_0x1b61('0x3a')]['id'];logger[_0x1b61('0xd')](_0x1b61('0x3b'),_0x54af12[_0x1b61('0x39')]);_0x542e9d(_0x54af12);})[_0x1b61('0x17')](function(_0x449632){logger[_0x1b61('0x18')]('['+[_0xe8b1bb['toUpperCase']()]+']',_0x449632[_0x1b61('0x22')]);_0x12f575(_0x449632[_0x1b61('0x22')]);});});};}function emit(_0x1a1a42,_0x1430d9,_0x41ad3d){var _0x23e614={'uri':_0x1a1a42+'/contacts/'+_0x41ad3d};io['to'](util[_0x1b61('0x27')]('user:%s',_0x1430d9))['emit']('trigger:browser:url',_0x23e614);}exports['cs']=function(_0xa69b9e,_0x45daf7,_0xd99293,_0x3b84a4,_0xb00a7e,_0x4b730f,_0xbfdd5,_0xb9e68d){var _0x1f0ba4={};var _0x49549a={'Authorization':'Token\x20token='+_0x4b730f[_0x1b61('0x3c')]};_0x4b730f[_0x1b61('0x3d')]=intUtil[_0x1b61('0x3e')](_0x4b730f['remoteUri']);_0x4b730f[_0x1b61('0x3f')]=intUtil[_0x1b61('0x3e')](_0x4b730f[_0x1b61('0x3f')]);var _0x9e1e82=_0x4b730f[_0x1b61('0x3d')];_0x1f0ba4['adminEmail']=_0x4b730f[_0x1b61('0x40')];_0x1f0ba4[_0x1b61('0x29')]=_0xb9e68d['toLowerCase']()===_0x1b61('0x41')?_0x45daf7[_0x1b61('0x42')]:_0x45daf7[_0x1b61('0x43')];_0x1f0ba4[_0x1b61('0x44')]=_0xb9e68d===_0x1b61('0x45')||_0xb9e68d===_0x1b61('0x46')?_0x1b61('0x45'):_0x1b61('0x41');if(_0x3b84a4){_0x1f0ba4['agentEmail']=_0x3b84a4[_0x1b61('0x12')];}var _0xc418fa=util[_0x1b61('0x27')](_0x1b61('0x47'),_0x4b730f[_0x1b61('0x3f')],_0x45daf7[_0x1b61('0x48')],md5(_0x45daf7['uniqueid']));if(_0xb00a7e&&_0xb00a7e['monitor_format']){logger[_0x1b61('0xd')](_0x1b61('0x49'),'Recording\x20is\x20enabled!');_0x45daf7[_0x1b61('0x4a')]=_0xc418fa;}else if(_0xbfdd5&&_0xbfdd5['recordingFormat']&&_0xbfdd5[_0x1b61('0x4b')]!==_0x1b61('0x4c')){logger[_0x1b61('0xd')]('[OUTBOUND]',_0x1b61('0x4d'));_0x45daf7[_0x1b61('0x4a')]=_0xc418fa;}else{_0x45daf7[_0x1b61('0x4a')]='';}return getAdminId(_0x1f0ba4,_0xb9e68d,_0x49549a,_0x9e1e82)[_0x1b61('0xf')](getUser(_0xb9e68d,_0x49549a,_0x9e1e82))[_0x1b61('0xf')](getEndUser(_0xb9e68d,_0x49549a,_0x9e1e82))[_0x1b61('0xf')](getTicket(_0xb9e68d,_0x49549a,_0x9e1e82,_0xd99293,_0x45daf7))[_0x1b61('0xf')](function(_0x480d96){logger[_0x1b61('0xd')](util['format'](_0x1b61('0x4e'),_0x480d96[_0x1b61('0x39')]));if(_0xb9e68d!==_0x1b61('0x46')){logger[_0x1b61('0xd')]('['+[_0xb9e68d[_0x1b61('0x19')]()]+']',_0x1b61('0x4f'));emit(_0x9e1e82,_0x3b84a4['name'],_0x480d96[_0x1b61('0x2c')]);}})[_0x1b61('0x17')](function(_0x3d3527){logger['error']('['+[_0xb9e68d[_0x1b61('0x19')]()]+_0x1b61('0x50'),util[_0x1b61('0x51')](_0x3d3527,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe518=['GET','headers','info','Getting\x20admin\x20information','then','length','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','/api/selector/owners','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','userId','User\x20found:','Admin\x20selected','message','/api/lookup?q=','&entities=contact','find','contacts','format','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter'];(function(_0x1a8caa,_0x195483){var _0x9021fe=function(_0x2eef64){while(--_0x2eef64){_0x1a8caa['push'](_0x1a8caa['shift']());}};_0x9021fe(++_0x195483);}(_0xe518,0xe3));var _0x8e51=function(_0x39074e,_0x280bc7){_0x39074e=_0x39074e-0x0;var _0x5d8c51=_0xe518[_0x39074e];return _0x5d8c51;};'use strict';var _=require('lodash');var rp=require(_0x8e51('0x0'));var md5=require(_0x8e51('0x1'));var util=require(_0x8e51('0x2'));var moment=require('moment');var Promise=require('bluebird');var Redis=require(_0x8e51('0x3'));var intUtil=require('./util');var config=require(_0x8e51('0x4'));var logger=require(_0x8e51('0x5'))(_0x8e51('0x6'));config[_0x8e51('0x7')]=_[_0x8e51('0x8')](config[_0x8e51('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x8e51('0x9'))(new Redis(config[_0x8e51('0x7')]));function getAdminId(_0x2f5a7a,_0x9f31c7,_0x127982,_0x2d1775){return new Promise(function(_0x430d21,_0x4f1c16){var _0x5ac17c=![];var _0x125346={'method':_0x8e51('0xa'),'uri':_0x2d1775+'/api/selector/owners','json':!![]};_0x125346[_0x8e51('0xb')]=_0x127982;logger[_0x8e51('0xc')](_0x8e51('0xd'));return rp(_0x125346)[_0x8e51('0xe')](function(_0x5d6b1c){if(_0x5d6b1c){var _0x168c72=_0x5d6b1c['users'];var _0x18f9f6=null;for(_0x18f9f6=0x0;_0x18f9f6<_0x168c72[_0x8e51('0xf')];_0x18f9f6++){if(_0x168c72[_0x18f9f6]['email']===_0x2f5a7a[_0x8e51('0x10')]){_0x2f5a7a[_0x8e51('0x11')]=_0x168c72[_0x18f9f6]['id'];_0x5ac17c=!![];}}if(_0x5ac17c){logger[_0x8e51('0xc')]('Admin\x20found:',_0x2f5a7a['adminId']);_0x430d21(_0x2f5a7a);}else{_0x4f1c16({'statusCode':0x194,'message':_0x8e51('0x12')});}}else{_0x4f1c16({'statusCode':0x194,'message':_0x8e51('0x12')});}})[_0x8e51('0x13')](function(_0x1abc05){logger[_0x8e51('0x14')]('['+[_0x9f31c7[_0x8e51('0x15')]()]+']',_0x1abc05['message']);_0x4f1c16(_0x1abc05);});});}function getUser(_0x27a99d,_0x2ae600,_0x73943c){return function(_0x149595){return new Promise(function(_0x3b8c8d,_0x13cc39){var _0x868954={'method':_0x8e51('0xa'),'uri':_0x73943c+_0x8e51('0x16'),'json':!![]};_0x868954[_0x8e51('0xb')]=_0x2ae600;logger[_0x8e51('0xc')](_0x8e51('0x17'));return rp(_0x868954)['then'](function(_0x429329){if(_0x429329){var _0x5645df=_0x429329['users'];var _0x2401a8=![];var _0x35b483=null;if(_0x149595[_0x8e51('0x18')]!==null){logger[_0x8e51('0xc')](_0x8e51('0x19'),_0x149595[_0x8e51('0x18')]);_0x149595[_0x8e51('0x1a')]=_0x149595[_0x8e51('0x18')];for(_0x35b483=0x0;_0x35b483<_0x5645df['length'];_0x35b483++){if(_0x5645df[_0x35b483][_0x8e51('0x1b')]===_0x149595[_0x8e51('0x18')]){_0x2401a8=!![];_0x149595[_0x8e51('0x1c')]=_0x5645df[_0x35b483]['id'];logger['info'](_0x8e51('0x1d'),_0x149595[_0x8e51('0x1c')]);}}}if(!_0x2401a8){logger[_0x8e51('0xc')](_0x8e51('0x1e'));_0x149595[_0x8e51('0x1a')]=_0x149595[_0x8e51('0x10')];_0x149595[_0x8e51('0x1c')]=_0x149595['adminId'];_0x2401a8=!![];}if(_0x2401a8){_0x3b8c8d(_0x149595);}else{_0x13cc39({'statusCode':0x194,'message':_0x8e51('0x12')});}}else{_0x13cc39({'statusCode':0x194,'message':_0x8e51('0x12')});}})[_0x8e51('0x13')](function(_0xb30648){logger[_0x8e51('0x14')]('['+[_0x27a99d['toUpperCase']()]+']',_0xb30648[_0x8e51('0x1f')]);_0x13cc39(_0xb30648);});});};}function searchContact(_0x24f9df,_0x295d2d,_0x3ded46,_0x5102a2){return new Promise(function(_0x2e45d2,_0x97f6e3){var _0x2484f9={'method':_0x8e51('0xa'),'headers':_0x295d2d,'uri':_0x24f9df+_0x8e51('0x20')+_0x5102a2+'&f='+_0x3ded46+_0x8e51('0x21'),'json':!![]};rp(_0x2484f9)[_0x8e51('0xe')](function(_0x5d7f58){var _0x4e8317=_[_0x8e51('0x22')](_0x5d7f58[_0x8e51('0x23')][_0x8e51('0x23')],[_0x3ded46,_0x5102a2]);_0x2e45d2(_0x4e8317);})['catch'](function(_0x31c6c1){_0x97f6e3(_0x31c6c1);});});}function getEndUser(_0xe162d2,_0x32d908,_0x2433af){return function(_0x3c5079){return new Promise(function(_0x2a36a4,_0x551a40){logger[_0x8e51('0xc')](util[_0x8e51('0x24')]('Searching\x20contact\x20with\x20phone\x20%s',_0x3c5079['contactNumber']));searchContact(_0x2433af,_0x32d908,_0x8e51('0x25'),_0x3c5079[_0x8e51('0x26')])[_0x8e51('0xe')](function(_0x274097){if(_0x274097){_0x3c5079[_0x8e51('0x27')]=_0x274097['id'];logger['info'](_0x8e51('0x28'),_0x3c5079[_0x8e51('0x27')]);return _0x2a36a4(_0x3c5079);}searchContact(_0x2433af,_0x32d908,_0x8e51('0x29'),_0x3c5079[_0x8e51('0x26')])['then'](function(_0x1a2c48){if(_0x1a2c48){_0x3c5079[_0x8e51('0x27')]=_0x1a2c48['id'];logger[_0x8e51('0xc')](_0x8e51('0x2a'),_0x3c5079[_0x8e51('0x27')]);return _0x2a36a4(_0x3c5079);}createEndUser(_0x3c5079,_0xe162d2,_0x32d908,_0x2433af)[_0x8e51('0xe')](function(_0x5f0c11){logger[_0x8e51('0xc')]('Contact\x20created:',_0x5f0c11[_0x8e51('0x27')]);return _0x2a36a4(_0x5f0c11);});});})[_0x8e51('0x13')](function(_0x571a86){_0x551a40(_0x571a86);});});};}function createEndUser(_0x4d8ee7,_0xc3dabd,_0x3020fe,_0x59a448){return new Promise(function(_0xe020b8,_0x53f114){var _0x4f0c7a=moment();var _0xdcc7eb={'method':_0x8e51('0x2b'),'uri':_0x59a448+_0x8e51('0x2c'),'body':{'contact':{'last_name':_0x4d8ee7[_0x8e51('0x26')],'work_number':_0x4d8ee7[_0x8e51('0x26')],'mobile_number':_0x4d8ee7[_0x8e51('0x26')],'owner_id':_0x4d8ee7['userId'],'created_at':_0x4f0c7a[_0x8e51('0x24')](_0x8e51('0x2d'))}},'json':!![]};_0xdcc7eb[_0x8e51('0xb')]=_0x3020fe;logger[_0x8e51('0xc')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0xdcc7eb)[_0x8e51('0xe')](function(_0x40cf08){_0x4d8ee7[_0x8e51('0x27')]=_0x40cf08[_0x8e51('0x2e')]['id'];_0xe020b8(_0x4d8ee7);})[_0x8e51('0x13')](function(_0x5d8800){logger[_0x8e51('0x14')]('['+[_0xc3dabd[_0x8e51('0x15')]()]+']',_0x5d8800[_0x8e51('0x1f')]);_0x53f114(_0x5d8800[_0x8e51('0x1f')]);});});}function getTicket(_0x4e9eb0,_0x179970,_0x37f127,_0xfd6198,_0x526e01){return function(_0x10e94a){logger[_0x8e51('0xc')]('Creating\x20new\x20task');return new Promise(function(_0x288620,_0xfa4f43){var _0x60a270=moment();var _0x131469={'method':_0x8e51('0x2b'),'uri':_0x37f127+_0x8e51('0x2f'),'body':{'title':intUtil[_0x8e51('0x30')](_0xfd6198[_0x8e51('0x31')],_0x526e01,'\x20'),'description':intUtil['getString'](_0xfd6198[_0x8e51('0x32')],_0x526e01,'\x0a'),'owner_id':_0x10e94a[_0x8e51('0x1c')],'creater_id':_0x10e94a[_0x8e51('0x11')],'targetable_id':_0x10e94a[_0x8e51('0x27')],'targetable_type':_0x8e51('0x33'),'created_at':_0x60a270['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x60a270[_0x8e51('0x34')](0x1e,'m')[_0x8e51('0x24')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x131469[_0x8e51('0xb')]=_0x179970;return rp(_0x131469)[_0x8e51('0xe')](function(_0x3d8ae4){_0x10e94a[_0x8e51('0x35')]=_0x3d8ae4[_0x8e51('0x36')]['id'];logger[_0x8e51('0xc')](_0x8e51('0x37'),_0x10e94a['ticketId']);_0x288620(_0x10e94a);})[_0x8e51('0x13')](function(_0xab982d){logger[_0x8e51('0x14')]('['+[_0x4e9eb0[_0x8e51('0x15')]()]+']',_0xab982d[_0x8e51('0x1f')]);_0xfa4f43(_0xab982d['message']);});});};}function emit(_0x7e2ba3,_0x458bbc,_0x535167){var _0x171f78={'uri':_0x7e2ba3+'/contacts/'+_0x535167};io['to'](util[_0x8e51('0x24')](_0x8e51('0x38'),_0x458bbc))[_0x8e51('0x39')](_0x8e51('0x3a'),_0x171f78);}exports['cs']=function(_0x460fe6,_0x5bf86d,_0x149561,_0x17ad74,_0x3a9cc9,_0x349a7b,_0x38d403,_0x508bf3){var _0x5792fa={};var _0x3d13b2={'Authorization':_0x8e51('0x3b')+_0x349a7b[_0x8e51('0x3c')]};_0x349a7b[_0x8e51('0x3d')]=intUtil['stripTrailingSlash'](_0x349a7b[_0x8e51('0x3d')]);_0x349a7b[_0x8e51('0x3e')]=intUtil[_0x8e51('0x3f')](_0x349a7b[_0x8e51('0x3e')]);var _0x54f841=_0x349a7b[_0x8e51('0x3d')];_0x5792fa['adminEmail']=_0x349a7b['username'];_0x5792fa[_0x8e51('0x26')]=_0x508bf3[_0x8e51('0x40')]()===_0x8e51('0x41')?_0x5bf86d[_0x8e51('0x42')]:_0x5bf86d['calleridnum'];_0x5792fa[_0x8e51('0x43')]=_0x508bf3===_0x8e51('0x44')||_0x508bf3===_0x8e51('0x45')?_0x8e51('0x44'):_0x8e51('0x41');if(_0x17ad74){_0x5792fa[_0x8e51('0x18')]=_0x17ad74[_0x8e51('0x1b')];}var _0x523b96=util[_0x8e51('0x24')](_0x8e51('0x46'),_0x349a7b[_0x8e51('0x3e')],_0x5bf86d[_0x8e51('0x47')],md5(_0x5bf86d['uniqueid']));if(_0x3a9cc9&&_0x3a9cc9[_0x8e51('0x48')]){logger[_0x8e51('0xc')](_0x8e51('0x49'),'Recording\x20is\x20enabled!');_0x5bf86d[_0x8e51('0x4a')]=_0x523b96;}else if(_0x38d403&&_0x38d403['recordingFormat']&&_0x38d403[_0x8e51('0x4b')]!==_0x8e51('0x4c')){logger[_0x8e51('0xc')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5bf86d['recordingURL']=_0x523b96;}else{_0x5bf86d[_0x8e51('0x4a')]='';}return getAdminId(_0x5792fa,_0x508bf3,_0x3d13b2,_0x54f841)[_0x8e51('0xe')](getUser(_0x508bf3,_0x3d13b2,_0x54f841))[_0x8e51('0xe')](getEndUser(_0x508bf3,_0x3d13b2,_0x54f841))[_0x8e51('0xe')](getTicket(_0x508bf3,_0x3d13b2,_0x54f841,_0x149561,_0x5bf86d))['then'](function(_0x5b61e3){logger[_0x8e51('0xc')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x5b61e3[_0x8e51('0x35')]));if(_0x508bf3!==_0x8e51('0x45')){logger['info']('['+[_0x508bf3[_0x8e51('0x15')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x54f841,_0x17ad74['name'],_0x5b61e3[_0x8e51('0x27')]);}})['catch'](function(_0x2ae371){logger[_0x8e51('0x14')]('['+[_0x508bf3[_0x8e51('0x15')]()]+_0x8e51('0x4d'),util[_0x8e51('0x4e')](_0x2ae371,{'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 e64a0c6..872464f 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 _0x73be=['unmanaged','data1','salesforce','zoho','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','data2','util','./zendesk','./salesforce','./freshdesk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','desk','vtiger','dynamics365','includes','toLowerCase','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x73be,0x15f));var _0xe73b=function(_0x2a9715,_0x127ca4){_0x2a9715=_0x2a9715-0x0;var _0x1dbaa4=_0x73be[_0x2a9715];return _0x1dbaa4;};'use strict';var _=require('lodash');var util=require(_0xe73b('0x0'));var zendesk=require(_0xe73b('0x1'));var salesforce=require(_0xe73b('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xe73b('0x3'));var zoho=require('./zoho');var desk=require('./desk');var vtiger=require(_0xe73b('0x4'));var servicenow=require(_0xe73b('0x5'));var dynamics365=require(_0xe73b('0x6'));var freshsales=require(_0xe73b('0x7'));var integrations=[_0xe73b('0x8'),'salesforce',_0xe73b('0x9'),_0xe73b('0xa'),'zoho',_0xe73b('0xb'),_0xe73b('0xc'),_0xe73b('0xd'),'freshsales','servicenow'];exports['exec']=function(_0x41dac5,_0x4fa2f4,_0xdd52b0,_0x34338f,_0x3ccd87,_0x571718){if(_0xdd52b0){if(_[_0xe73b('0xe')](integrations,_0x41dac5['data1']['toLowerCase']())){try{var _0x123218=null;var _0x456f3b='';var _0x2a498f=_0xdd52b0[_0x41dac5['data1'][_0xe73b('0xf')]()];if(_0x2a498f){var _0xa0e4a2=_0x2a498f[_0x41dac5['data2']];if(_0xa0e4a2){var _0x5097b3=_['find'](_0xa0e4a2[_0xe73b('0x10')],{'id':parseInt(_0x41dac5[_0xe73b('0x11')],0xa)});if(_0x5097b3){if(_0x34338f){if(_0x3ccd87&&_0x4fa2f4[_0xe73b('0x12')]){_0x456f3b=_0xe73b('0x12');}else if(_0x4fa2f4[_0xe73b('0x13')]){_0x456f3b=_0xe73b('0x14');}else{console[_0xe73b('0x15')](_0xe73b('0x16'),_0x4fa2f4);}}else{_0x456f3b=_0xe73b('0x17');}switch(_0x41dac5[_0xe73b('0x18')][_0xe73b('0xf')]()){case'zendesk':zendesk[_0x456f3b](_0x41dac5,_0x4fa2f4,_0x5097b3,_0x34338f,_0x3ccd87,_0xa0e4a2,_0x571718);break;case _0xe73b('0x19'):salesforce[_0x456f3b](_0x41dac5,_0x4fa2f4,_0x5097b3,_0x34338f,_0x3ccd87,_0xa0e4a2,_0x571718);break;case _0xe73b('0x9'):sugarcrm[_0x456f3b](_0x41dac5,_0x4fa2f4,_0x5097b3,_0x34338f,_0x3ccd87,_0xa0e4a2,_0x571718);break;case'freshdesk':freshdesk[_0x456f3b](_0x41dac5,_0x4fa2f4,_0x5097b3,_0x34338f,_0x3ccd87,_0xa0e4a2,_0x571718);break;case _0xe73b('0x1a'):zoho[_0x456f3b](_0x41dac5,_0x4fa2f4,_0x5097b3,_0x34338f,_0x3ccd87,_0xa0e4a2,_0x571718);break;case _0xe73b('0xb'):desk[_0x456f3b](_0x41dac5,_0x4fa2f4,_0x5097b3,_0x34338f,_0x3ccd87,_0xa0e4a2,_0x571718);break;case _0xe73b('0xc'):vtiger[_0x456f3b](_0x41dac5,_0x4fa2f4,_0x5097b3,_0x34338f,_0x3ccd87,_0xa0e4a2,_0x571718);break;case'freshsales':freshsales['cs'](_0x41dac5,_0x4fa2f4,_0x5097b3,_0x34338f,_0x3ccd87,_0xa0e4a2,_0x571718,_0x456f3b);break;case'servicenow':servicenow['cs'](_0x41dac5,_0x4fa2f4,_0x5097b3,_0x34338f,_0x3ccd87,_0xa0e4a2,_0x571718,_0x456f3b);break;case _0xe73b('0xd'):dynamics365['cs'](_0x41dac5,_0x4fa2f4,_0x5097b3,_0x34338f,_0x3ccd87,_0xa0e4a2,_0x571718,_0x456f3b);break;default:console[_0xe73b('0x15')](_0xe73b('0x1b'));}}else{_0x123218=require(_0xe73b('0x1c'))(_0x41dac5['data1'][_0xe73b('0xf')]());_0x123218[_0xe73b('0x1d')](_0xe73b('0x1e'),util[_0xe73b('0x1f')]('%s\x20configuration\x20#%s\x20not\x20found',_0x41dac5[_0xe73b('0x18')][_0xe73b('0xf')](),_0x41dac5[_0xe73b('0x11')]));}}else{_0x123218=require(_0xe73b('0x1c'))(_0x41dac5[_0xe73b('0x18')][_0xe73b('0xf')]());_0x123218[_0xe73b('0x1d')](_0xe73b('0x1e'),util[_0xe73b('0x1f')](_0xe73b('0x20'),_0x41dac5[_0xe73b('0x18')]['toLowerCase'](),_0x41dac5[_0xe73b('0x21')]));}}else{}}catch(_0x286cac){console[_0xe73b('0x1d')](_0x286cac);}}}}; \ No newline at end of file +var _0x260c=['[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','vtiger','servicenow','data1','toLowerCase','data3','queue','routeId','outbound','log','unmanaged','desk','freshsales','dynamics365','unknown\x20integration','../../../../config/logger','error'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0x260c,0x6d));var _0xc260=function(_0xb4f026,_0x406002){_0xb4f026=_0xb4f026-0x0;var _0x228329=_0x260c[_0xb4f026];return _0x228329;};'use strict';var _=require(_0xc260('0x0'));var util=require(_0xc260('0x1'));var zendesk=require(_0xc260('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0xc260('0x3'));var freshdesk=require(_0xc260('0x4'));var zoho=require(_0xc260('0x5'));var desk=require('./desk');var vtiger=require(_0xc260('0x6'));var servicenow=require(_0xc260('0x7'));var dynamics365=require(_0xc260('0x8'));var freshsales=require(_0xc260('0x9'));var integrations=[_0xc260('0xa'),_0xc260('0xb'),_0xc260('0xc'),_0xc260('0xd'),_0xc260('0xe'),'desk',_0xc260('0xf'),'dynamics365','freshsales',_0xc260('0x10')];exports['exec']=function(_0x540324,_0x3a1920,_0x29499e,_0x5229b7,_0x24fc0b,_0x157436){if(_0x29499e){if(_['includes'](integrations,_0x540324[_0xc260('0x11')]['toLowerCase']())){try{var _0x3f550c=null;var _0x537b43='';var _0x2d4747=_0x29499e[_0x540324[_0xc260('0x11')][_0xc260('0x12')]()];if(_0x2d4747){var _0x3300e5=_0x2d4747[_0x540324['data2']];if(_0x3300e5){var _0x49d00d=_['find'](_0x3300e5['Configurations'],{'id':parseInt(_0x540324[_0xc260('0x13')],0xa)});if(_0x49d00d){if(_0x5229b7){if(_0x24fc0b&&_0x3a1920[_0xc260('0x14')]){_0x537b43=_0xc260('0x14');}else if(_0x3a1920[_0xc260('0x15')]){_0x537b43=_0xc260('0x16');}else{console[_0xc260('0x17')]('EVENT\x20UNKNOWN',_0x3a1920);}}else{_0x537b43=_0xc260('0x18');}switch(_0x540324[_0xc260('0x11')][_0xc260('0x12')]()){case'zendesk':zendesk[_0x537b43](_0x540324,_0x3a1920,_0x49d00d,_0x5229b7,_0x24fc0b,_0x3300e5,_0x157436);break;case _0xc260('0xb'):salesforce[_0x537b43](_0x540324,_0x3a1920,_0x49d00d,_0x5229b7,_0x24fc0b,_0x3300e5,_0x157436);break;case _0xc260('0xc'):sugarcrm[_0x537b43](_0x540324,_0x3a1920,_0x49d00d,_0x5229b7,_0x24fc0b,_0x3300e5,_0x157436);break;case _0xc260('0xd'):freshdesk[_0x537b43](_0x540324,_0x3a1920,_0x49d00d,_0x5229b7,_0x24fc0b,_0x3300e5,_0x157436);break;case _0xc260('0xe'):zoho[_0x537b43](_0x540324,_0x3a1920,_0x49d00d,_0x5229b7,_0x24fc0b,_0x3300e5,_0x157436);break;case _0xc260('0x19'):desk[_0x537b43](_0x540324,_0x3a1920,_0x49d00d,_0x5229b7,_0x24fc0b,_0x3300e5,_0x157436);break;case _0xc260('0xf'):vtiger[_0x537b43](_0x540324,_0x3a1920,_0x49d00d,_0x5229b7,_0x24fc0b,_0x3300e5,_0x157436);break;case _0xc260('0x1a'):freshsales['cs'](_0x540324,_0x3a1920,_0x49d00d,_0x5229b7,_0x24fc0b,_0x3300e5,_0x157436,_0x537b43);break;case _0xc260('0x10'):servicenow['cs'](_0x540324,_0x3a1920,_0x49d00d,_0x5229b7,_0x24fc0b,_0x3300e5,_0x157436,_0x537b43);break;case _0xc260('0x1b'):dynamics365['cs'](_0x540324,_0x3a1920,_0x49d00d,_0x5229b7,_0x24fc0b,_0x3300e5,_0x157436,_0x537b43);break;default:console[_0xc260('0x17')](_0xc260('0x1c'));}}else{_0x3f550c=require(_0xc260('0x1d'))(_0x540324[_0xc260('0x11')][_0xc260('0x12')]());_0x3f550c[_0xc260('0x1e')](_0xc260('0x1f'),util[_0xc260('0x20')](_0xc260('0x21'),_0x540324[_0xc260('0x11')][_0xc260('0x12')](),_0x540324[_0xc260('0x13')]));}}else{_0x3f550c=require(_0xc260('0x1d'))(_0x540324['data1']['toLowerCase']());_0x3f550c[_0xc260('0x1e')]('[EXEC]',util['format'](_0xc260('0x22'),_0x540324[_0xc260('0x11')]['toLowerCase'](),_0x540324['data2']));}}else{}}catch(_0x5165f8){console['error'](_0x5165f8);}}}}; \ 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 c4418b8..caab820 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 _0x110a=['isNil','User','find','Agent\x20%s\x20found.','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','then','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','Contact','length','additionalSearchLead','merge','$or','Lead','account_contact_lead','additionalSearchAccount','Account','execute','first','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','upperFirst','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','Connection','remoteUri','https://login.salesforce.com','clientSecret','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','unmanaged','Recording\x20is\x20enabled!','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lastevent','lodash','moment','md5','util','ioredis','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','assign','getString','Subjects','ticketType','Task','ActivityDate','IsRecurrence','endUserType','contact','lead','account','WhatId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x110a,0x148));var _0xa110=function(_0x437e08,_0x1cab6c){_0x437e08=_0x437e08-0x0;var _0xcf57f2=_0x110a[_0x437e08];return _0xcf57f2;};'use strict';var _=require(_0xa110('0x0'));var rp=require('request-promise');var moment=require(_0xa110('0x1'));var BPromise=require('bluebird');var md5=require(_0xa110('0x2'));var jsforce=require('jsforce');var util=require(_0xa110('0x3'));var Redis=require(_0xa110('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xa110('0x5'))(_0xa110('0x6'));config[_0xa110('0x7')]=_['defaults'](config[_0xa110('0x7')],{'host':_0xa110('0x8'),'port':0x18eb});var io=require(_0xa110('0x9'))(new Redis(config[_0xa110('0x7')]));function emit(_0x177a58,_0x41d448,_0x29673c){io['to'](_0x177a58)['emit'](_0x41d448,_0x29673c);}function getTicket(_0xf210d5,_0x5173a5,_0x43459f,_0x394073,_0x576407,_0x1472a0,_0x251f9a,_0x4e50eb){var _0x1d828f=Object[_0xa110('0xa')]({},{'OwnerId':_0x5173a5['id'],'Subject':intUtil[_0xa110('0xb')](_0x394073[_0xa110('0xc')],_0x576407,'\x20'),'Description':intUtil[_0xa110('0xb')](_0x394073['Descriptions'],_0x576407,'\x0a')},getCustomFields(_0x1472a0,_0x576407));if(_0x43459f){if(_0x394073[_0xa110('0xd')]===_0xa110('0xe')){_0x1d828f[_0xa110('0xf')]=moment['utc']();_0x1d828f['IsReminderSet']=![];_0x1d828f[_0xa110('0x10')]=![];if(_0x43459f[_0xa110('0x11')]===_0xa110('0x12')||_0x43459f[_0xa110('0x11')]===_0xa110('0x13')){_0x1d828f['WhoId']=_0x43459f['id'];}else if(_0x43459f[_0xa110('0x11')]===_0xa110('0x14')){_0x1d828f[_0xa110('0x15')]=_0x43459f['id'];}}else if(_0x394073[_0xa110('0xd')]==='Case'){if(_0x43459f['endUserType']==='contact'){_0x1d828f['ContactId']=_0x43459f['id'];}else if(_0x43459f[_0xa110('0x11')]===_0xa110('0x14')){_0x1d828f['AccountId']=_0x43459f['id'];}else if(_0x43459f[_0xa110('0x11')]===_0xa110('0x13')&&_0x394073[_0xa110('0x16')]){_0x1d828f[_0x394073[_0xa110('0x16')]]=_0x43459f['id'];}else{logger['info'](_0xa110('0x17'));}}}return _0x251f9a[_0xa110('0x18')](_0x394073['ticketType'])[_0xa110('0x19')](_0x1d828f);}function getUser(_0x2ecc6c,_0x423f02,_0x48690e){if(!_[_0xa110('0x1a')](_0x423f02)&&intUtil['validateEmail'](_0x423f02)){var _0x42b465={'Email':_0x423f02};var _0x5b1388={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x48690e['sobject'](_0xa110('0x1b'))[_0xa110('0x1c')](_0x42b465,_0x5b1388)['execute']()['then'](function(_0x2c4421){if(_0x2c4421['length']){var _0x141615=_[_0xa110('0x1c')](_0x2c4421,function(_0x4d3d0f){return _0x4d3d0f['Email']===_0x423f02;});if(_0x141615){logger['info'](_0xa110('0x1d'),_0x423f02);return BPromise[_0xa110('0x1e')]({'id':_0x141615['Id'],'name':_0x141615[_0xa110('0x1f')]});}}else{logger[_0xa110('0x20')](_0xa110('0x21'),_0x423f02);return _0x48690e[_0xa110('0x22')]()['then'](function(_0x1ca798){return BPromise[_0xa110('0x1e')]({'id':_0x1ca798[_0xa110('0x23')],'name':_0x1ca798[_0xa110('0x24')]});});}});}else{logger['info'](_0xa110('0x21'),_0x423f02);return _0x48690e[_0xa110('0x22')]()[_0xa110('0x25')](function(_0xdb7550){return BPromise[_0xa110('0x1e')]({'id':_0xdb7550[_0xa110('0x23')],'name':_0xdb7550[_0xa110('0x24')]});});}}function getEndUser(_0x284388,_0x462da2,_0x2fc0de,_0x57040c,_0x3ded07){var _0xc1e5e7={'$or':{'Phone':_0x57040c}};var _0x45b5b5={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xa110('0x25')](function(){logger['info'](_0xa110('0x26'),_0x57040c,_0x462da2['moduleSearch']);switch(_0x462da2[_0xa110('0x27')]){case _0xa110('0x28'):var _0x1cfc1c=_[_0xa110('0x29')](_0xc1e5e7);if(_0x462da2[_0xa110('0x2a')]){var _0x3171d9={};_0x3171d9[_0x462da2[_0xa110('0x2a')]]=_0x57040c;_['merge'](_0x1cfc1c['$or'],_0x3171d9);}return _0x3ded07[_0xa110('0x18')](_0xa110('0x2b'))[_0xa110('0x1c')](_0x1cfc1c,_0x45b5b5)['execute']()[_0xa110('0x25')](function(_0x58f88e){if(_0x58f88e&&_0x58f88e[_0xa110('0x2c')]){return _0x58f88e;}else{var _0x399a53=_[_0xa110('0x29')](_0xc1e5e7);if(_0x462da2[_0xa110('0x2d')]){var _0x28029d={};_0x28029d[_0x462da2[_0xa110('0x2d')]]=_0x57040c;_[_0xa110('0x2e')](_0x399a53[_0xa110('0x2f')],_0x28029d);}return _0x3ded07[_0xa110('0x18')](_0xa110('0x30'))['find'](_0x399a53,_0x45b5b5);}});case _0xa110('0x31'):var _0x16f5a4=_[_0xa110('0x29')](_0xc1e5e7);if(_0x462da2[_0xa110('0x32')]){var _0x3171d9={};_0x3171d9[_0x462da2['additionalSearchAccount']]=_0x57040c;_['merge'](_0x16f5a4[_0xa110('0x2f')],_0x3171d9);}return _0x3ded07[_0xa110('0x18')](_0xa110('0x33'))[_0xa110('0x1c')](_0x16f5a4,_0x45b5b5)[_0xa110('0x34')]()[_0xa110('0x25')](function(_0x53c8ab){if(_0x53c8ab&&_0x53c8ab[_0xa110('0x2c')]){return _0x53c8ab;}else{var _0x1517bd=_[_0xa110('0x29')](_0xc1e5e7);if(_0x462da2[_0xa110('0x2a')]){var _0x4fe663={};_0x4fe663[_0x462da2[_0xa110('0x2a')]]=_0x57040c;_[_0xa110('0x2e')](_0x1517bd['$or'],_0x4fe663);}return _0x3ded07['sobject']('Contact')[_0xa110('0x1c')](_0x1517bd,_0x45b5b5)[_0xa110('0x25')](function(_0x2c9aeb){if(_0x2c9aeb&&_0x2c9aeb[_0xa110('0x2c')]){return _0x2c9aeb;}else{var _0x2fb143=_[_0xa110('0x29')](_0xc1e5e7);if(_0x462da2[_0xa110('0x2d')]){var _0x2b01e2={};_0x2b01e2[_0x462da2[_0xa110('0x2d')]]=_0x57040c;_[_0xa110('0x2e')](_0x2fb143['$or'],_0x2b01e2);}return _0x3ded07['sobject'](_0xa110('0x30'))['find'](_0x2fb143,_0x45b5b5);}});}});case _0xa110('0x12'):var _0x1cfc1c=_[_0xa110('0x29')](_0xc1e5e7);if(_0x462da2[_0xa110('0x2a')]){var _0x3171d9={};_0x3171d9[_0x462da2[_0xa110('0x2a')]]=_0x57040c;_[_0xa110('0x2e')](_0x1cfc1c['$or'],_0x3171d9);}return _0x3ded07[_0xa110('0x18')]('Contact')[_0xa110('0x1c')](_0x1cfc1c,_0x45b5b5)[_0xa110('0x34')]();case _0xa110('0x13'):var _0x140cb7=_['cloneDeep'](_0xc1e5e7);if(_0x462da2['additionalSearchLead']){var _0x3171d9={};_0x3171d9[_0x462da2[_0xa110('0x2d')]]=_0x57040c;_[_0xa110('0x2e')](_0x140cb7[_0xa110('0x2f')],_0x3171d9);}return _0x3ded07[_0xa110('0x18')](_0xa110('0x30'))[_0xa110('0x1c')](_0x140cb7,_0x45b5b5);case _0xa110('0x14'):var _0x16f5a4=_[_0xa110('0x29')](_0xc1e5e7);if(_0x462da2['additionalSearchAccount']){var _0x3171d9={};_0x3171d9[_0x462da2[_0xa110('0x32')]]=_0x57040c;_['merge'](_0x16f5a4[_0xa110('0x2f')],_0x3171d9);}return _0x3ded07[_0xa110('0x18')]('Account')[_0xa110('0x1c')](_0x16f5a4,_0x45b5b5);default:return null;}})[_0xa110('0x25')](function(_0x368d19){if(_0x368d19&&_0x368d19[_0xa110('0x2c')]){var _0xa0a497=_[_0xa110('0x35')](_0x368d19);if(_0xa0a497){return BPromise['resolve']({'id':_0xa0a497['Id'],'name':_0xa0a497[_0xa110('0x1f')],'phone':_0xa0a497['Phone'],'endUserType':_0xa0a497['attributes'][_0xa110('0x36')][_0xa110('0x37')]()});}}})[_0xa110('0x25')](function(_0x55284d){if(_0x55284d){logger[_0xa110('0x20')](_0xa110('0x38'),_0x55284d[_0xa110('0x11')],_0x57040c);return BPromise[_0xa110('0x1e')](_0x55284d);}else{logger[_0xa110('0x20')](_0xa110('0x39'),_0x57040c);var _0x3e0996={'Phone':_0x57040c};if(_0x462da2['moduleCreate']){if(_0x462da2[_0xa110('0x3a')]==='contact'){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x57040c,_0x462da2[_0xa110('0x3a')]);_0x3e0996[_0xa110('0x3b')]=_0x2fc0de!==''?_0x2fc0de:util[_0xa110('0x3c')]('Caller\x20-\x20%s',_0x57040c);}else if(_0x462da2[_0xa110('0x3a')]===_0xa110('0x13')){logger[_0xa110('0x20')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x57040c,_0x462da2[_0xa110('0x3a')]);_0x3e0996['LastName']=_0x2fc0de!==''?_0x2fc0de:util[_0xa110('0x3c')](_0xa110('0x3d'),_0x57040c);_0x3e0996['Company']='No\x20Company';}else if(_0x462da2[_0xa110('0x3a')]==='account'){logger['info'](_0xa110('0x3e'),_0x57040c,_0x462da2[_0xa110('0x3a')]);_0x3e0996[_0xa110('0x1f')]=_0x2fc0de!==_0xa110('0x3f')?_0x2fc0de:util[_0xa110('0x3c')](_0xa110('0x3d'),_0x57040c);}else{return null;}}return _0x3ded07[_0xa110('0x18')](_[_0xa110('0x40')](_0x462da2['moduleCreate']))[_0xa110('0x19')](_0x3e0996)['then'](function(_0x4ac0d1){return BPromise[_0xa110('0x1e')]({'id':_0x4ac0d1['id'],'endUserType':_0x462da2[_0xa110('0x3a')]});});}});}function getCustomFields(_0x1459ec,_0x4c3253){var _0x5aa7fb={};if(_0x1459ec[_0xa110('0x2c')]>0x0){_['forEach'](_0x1459ec,function(_0x2c9997){if(_['includes']([_0xa110('0x41'),_0xa110('0x42')],_0x2c9997[_0xa110('0x36')])&&_0x2c9997[_0xa110('0x43')]){_0x5aa7fb[_0x2c9997[_0xa110('0x43')]]=_0x2c9997[_0xa110('0x44')][_0xa110('0x45')]();}else if(_0x2c9997[_0xa110('0x36')]===_0xa110('0x46')&&_0x2c9997['variableName']&&_0x2c9997[_0xa110('0x43')]){_0x4c3253[_0x2c9997[_0xa110('0x47')]]&&(_0x5aa7fb[_0x2c9997['idField']]=_0x4c3253[_0x2c9997[_0xa110('0x47')]][_0xa110('0x45')]());}else if(_0x2c9997[_0xa110('0x36')]===_0xa110('0x48')&&_0x2c9997[_0xa110('0x49')]&&_0x2c9997['Variable'][_0xa110('0x4a')]&&_0x2c9997[_0xa110('0x43')]){_0x4c3253[_0x2c9997[_0xa110('0x49')][_0xa110('0x4a')][_0xa110('0x37')]()]&&(_0x5aa7fb[_0x2c9997[_0xa110('0x43')]]=_0x4c3253[_0x2c9997[_0xa110('0x49')][_0xa110('0x4a')]['toLowerCase']()]['toString']());}});}return _0x5aa7fb;}function getConnection(_0x47fcb6){var _0x8da7e=_0x47fcb6[_0xa110('0x4b')][_0xa110('0x4c')](_0x47fcb6['securityToken']);var _0x37dc62=new jsforce[(_0xa110('0x4d'))]({'oauth2':{'loginUrl':_0x47fcb6[_0xa110('0x4e')]||_0xa110('0x4f'),'clientId':_0x47fcb6['clientId'],'clientSecret':_0x47fcb6[_0xa110('0x50')]}});return _0x37dc62['login'](_0x47fcb6['username'],_0x8da7e)[_0xa110('0x25')](function(){logger[_0xa110('0x20')]('Connection\x20established.');return _0x37dc62;});}exports[_0xa110('0x51')]=function(_0x281048,_0x505070,_0x4e9312,_0x133201,_0x4b401a,_0x330c0e){var _0x3a7de8,_0x20c84f,_0x2b1170,_0x36323a;_0x330c0e[_0xa110('0x52')]=intUtil['stripTrailingSlash'](_0x330c0e[_0xa110('0x52')]);_0x330c0e['remoteUri']=intUtil[_0xa110('0x53')](_0x330c0e[_0xa110('0x4e')]);if(_0x4b401a&&_0x4b401a[_0xa110('0x54')]){logger[_0xa110('0x20')](_0xa110('0x55'),'Recording\x20is\x20enabled!');_0x505070[_0xa110('0x56')]=util[_0xa110('0x3c')](_0xa110('0x57'),_0x330c0e[_0xa110('0x52')],_0x505070[_0xa110('0x58')],md5(_0x505070[_0xa110('0x58')]));}else{_0x505070['recordingURL']='';}return getConnection(_0x330c0e)[_0xa110('0x25')](function(_0x548f29){_0x36323a=_0x548f29;return getUser(_0x330c0e,_0x133201[_0xa110('0x59')],_0x36323a);})[_0xa110('0x25')](function(_0x27d702){_0x3a7de8=_0x27d702;return getEndUser(_0x330c0e,_0x4e9312,_0x505070[_0xa110('0x5a')],_0x505070[_0xa110('0x5b')],_0x36323a);})[_0xa110('0x25')](function(_0x3022d8){_0x20c84f=_0x3022d8;return getTicket(_0x330c0e,_0x3a7de8,_0x20c84f,_0x4e9312,_0x505070,_0x4e9312['Fields'],_0x36323a,_0xa110('0x51'));})['then'](function(_0x428bad){_0x2b1170=_0x428bad;logger[_0xa110('0x20')](_0xa110('0x5c'),_0x2b1170['id']);logger[_0xa110('0x20')](_0xa110('0x5d'),_0x2b1170['id'],_0x133201[_0xa110('0x4a')],_0x330c0e[_0xa110('0x36')]);switch(_0x330c0e[_0xa110('0x36')]){case _0xa110('0x5e'):emit(util['format'](_0xa110('0x5f'),_0x133201[_0xa110('0x4a')]),'trigger:salesforce:display',{'recordId':_0x2b1170['id']});break;case _0xa110('0x60'):emit(util['format'](_0xa110('0x5f'),_0x133201[_0xa110('0x4a')]),_0xa110('0x61'),{'uri':util[_0xa110('0x3c')](_0xa110('0x62'),_0x36323a[_0xa110('0x63')],_0x2b1170['id'])});break;default:logger['error'](_0xa110('0x64'));}})[_0xa110('0x65')](function(_0x2e36b2){logger[_0xa110('0x66')](_0xa110('0x55'),_0x2e36b2);});};exports[_0xa110('0x67')]=function(_0x1a8e22,_0x454a18,_0x41a841,_0x22613f,_0x53768a,_0x4cd60f,_0x266d6c){var _0x5339ba,_0x5c23d6,_0x4f8e68,_0x539e5c;_0x4cd60f[_0xa110('0x52')]=intUtil['stripTrailingSlash'](_0x4cd60f[_0xa110('0x52')]);_0x4cd60f[_0xa110('0x4e')]=intUtil['stripTrailingSlash'](_0x4cd60f['remoteUri']);if(_0x266d6c&&_0x266d6c[_0xa110('0x68')]&&_0x266d6c[_0xa110('0x68')]!==_0xa110('0x69')){logger[_0xa110('0x20')](_0xa110('0x6a'),'Recording\x20is\x20enabled!');_0x454a18[_0xa110('0x56')]=util[_0xa110('0x3c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4cd60f[_0xa110('0x52')],_0x454a18[_0xa110('0x58')],md5(_0x454a18['uniqueid']));}return getConnection(_0x4cd60f)['then'](function(_0x37d8f1){_0x539e5c=_0x37d8f1;return getUser(_0x4cd60f,_0x22613f[_0xa110('0x59')],_0x539e5c);})[_0xa110('0x25')](function(_0x3404f3){_0x5339ba=_0x3404f3;return getEndUser(_0x4cd60f,_0x41a841,_0x454a18['destcalleridname'],_0x454a18[_0xa110('0x6b')],_0x539e5c);})['then'](function(_0x31dec2){_0x5c23d6=_0x31dec2;return getTicket(_0x4cd60f,_0x5339ba,_0x5c23d6,_0x41a841,_0x454a18,_0x41a841[_0xa110('0x6c')],_0x539e5c,'outbound');})[_0xa110('0x25')](function(_0x44fa7b){_0x4f8e68=_0x44fa7b;logger[_0xa110('0x20')](_0xa110('0x6d'),_0x4f8e68['id']);logger[_0xa110('0x20')](_0xa110('0x6e'),_0x4f8e68['id'],_0x22613f[_0xa110('0x4a')],_0x4cd60f['type']);switch(_0x4cd60f[_0xa110('0x36')]){case _0xa110('0x5e'):emit(util[_0xa110('0x3c')](_0xa110('0x5f'),_0x22613f['name']),_0xa110('0x6f'),{'recordId':_0x4f8e68['id']});break;case'newTab':emit(util[_0xa110('0x3c')](_0xa110('0x5f'),_0x22613f[_0xa110('0x4a')]),'trigger:browser:url',{'uri':util[_0xa110('0x3c')]('%s/%s/e',_0x539e5c['instanceUrl'],_0x4f8e68['id'])});break;default:logger[_0xa110('0x66')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x59b17c){logger[_0xa110('0x66')]('[OUTBOUND]',_0x59b17c);});};exports[_0xa110('0x70')]=function(_0x7a261c,_0x2e2d91,_0x138aa3,_0x42a528,_0x5c5392,_0x2f885e){var _0x3a0c0a,_0x1026a7,_0x26b787,_0x2ee4f7;_0x2f885e[_0xa110('0x52')]=intUtil['stripTrailingSlash'](_0x2f885e['serverUrl']);_0x2f885e['remoteUri']=intUtil[_0xa110('0x53')](_0x2f885e['remoteUri']);if(_0x5c5392&&_0x5c5392[_0xa110('0x54')]){logger[_0xa110('0x20')]('['+_0x2e2d91['lastevent']['toUpperCase']()+']',_0xa110('0x71'));_0x2e2d91[_0xa110('0x56')]=util[_0xa110('0x3c')](_0xa110('0x57'),_0x2f885e['serverUrl'],_0x2e2d91[_0xa110('0x58')],md5(_0x2e2d91['uniqueid']));}else{_0x2e2d91[_0xa110('0x56')]='';}return getConnection(_0x2f885e)[_0xa110('0x25')](function(_0x241024){_0x2ee4f7=_0x241024;if(!_[_0xa110('0x1a')](_0x42a528)){return getUser(_0x2f885e,_0x42a528[_0xa110('0x4a')],_0x2ee4f7);}else{return getUser(_0x2f885e,null,_0x2ee4f7);}})[_0xa110('0x25')](function(_0x16d4e8){_0x3a0c0a=_0x16d4e8;return getEndUser(_0x2f885e,_0x138aa3,_0x2e2d91[_0xa110('0x5a')],_0x2e2d91['calleridnum'],_0x2ee4f7);})[_0xa110('0x25')](function(_0xbbd19e){_0x1026a7=_0xbbd19e;return getTicket(_0x2f885e,_0x3a0c0a,_0x1026a7,_0x138aa3,_0x2e2d91,_0x138aa3[_0xa110('0x6c')],_0x2ee4f7);})[_0xa110('0x25')](function(_0x58993b){_0x26b787=_0x58993b;logger[_0xa110('0x20')]('['+_0x2e2d91['lastevent'][_0xa110('0x72')]()+_0xa110('0x73'),_0x26b787['id']);logger[_0xa110('0x20')]('['+_0x2e2d91['lastevent']['toUpperCase']()+_0xa110('0x74'),_0x2f885e['type']);})[_0xa110('0x65')](function(_0x3a6d9d){logger[_0xa110('0x66')]('['+_0x2e2d91[_0xa110('0x75')][_0xa110('0x72')]()+']',_0x3a6d9d);});}; \ No newline at end of file +var _0x218f=['','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','toLowerCase','concat','securityToken','Connection','remoteUri','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','name','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','newTab','Salesforce\x20account\x20type\x20not\x20recognized','toUpperCase','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','md5','jsforce','util','./util','../../../../config/environment','salesforce','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','contact','endUserType','WhoId','account','WhatId','Case','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','execute','then','length','find','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','$or','Lead','additionalSearchAccount','Account','first','Phone','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x218f,0x14c));var _0xf218=function(_0x5903f6,_0x28d9e6){_0x5903f6=_0x5903f6-0x0;var _0xbe7b11=_0x218f[_0x5903f6];return _0xbe7b11;};'use strict';var _=require(_0xf218('0x0'));var rp=require(_0xf218('0x1'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0xf218('0x2'));var jsforce=require(_0xf218('0x3'));var util=require(_0xf218('0x4'));var Redis=require('ioredis');var intUtil=require(_0xf218('0x5'));var config=require(_0xf218('0x6'));var logger=require('../../../../config/logger')(_0xf218('0x7'));config['redis']=_[_0xf218('0x8')](config['redis'],{'host':_0xf218('0x9'),'port':0x18eb});var io=require(_0xf218('0xa'))(new Redis(config['redis']));function emit(_0x5cbc20,_0x1a21f1,_0x9b9494){io['to'](_0x5cbc20)[_0xf218('0xb')](_0x1a21f1,_0x9b9494);}function getTicket(_0x2afe38,_0x307990,_0x53ecbc,_0x404b74,_0x3c2732,_0x27ccda,_0x6ca55e,_0x106c2c){var _0x326051=Object[_0xf218('0xc')]({},{'OwnerId':_0x307990['id'],'Subject':intUtil[_0xf218('0xd')](_0x404b74[_0xf218('0xe')],_0x3c2732,'\x20'),'Description':intUtil['getString'](_0x404b74[_0xf218('0xf')],_0x3c2732,'\x0a')},getCustomFields(_0x27ccda,_0x3c2732));if(_0x53ecbc){if(_0x404b74[_0xf218('0x10')]===_0xf218('0x11')){_0x326051[_0xf218('0x12')]=moment[_0xf218('0x13')]();_0x326051[_0xf218('0x14')]=![];_0x326051[_0xf218('0x15')]=![];if(_0x53ecbc['endUserType']===_0xf218('0x16')||_0x53ecbc[_0xf218('0x17')]==='lead'){_0x326051[_0xf218('0x18')]=_0x53ecbc['id'];}else if(_0x53ecbc[_0xf218('0x17')]===_0xf218('0x19')){_0x326051[_0xf218('0x1a')]=_0x53ecbc['id'];}}else if(_0x404b74[_0xf218('0x10')]===_0xf218('0x1b')){if(_0x53ecbc[_0xf218('0x17')]==='contact'){_0x326051[_0xf218('0x1c')]=_0x53ecbc['id'];}else if(_0x53ecbc[_0xf218('0x17')]===_0xf218('0x19')){_0x326051[_0xf218('0x1d')]=_0x53ecbc['id'];}else if(_0x53ecbc[_0xf218('0x17')]===_0xf218('0x1e')&&_0x404b74[_0xf218('0x1f')]){_0x326051[_0x404b74[_0xf218('0x1f')]]=_0x53ecbc['id'];}else{logger[_0xf218('0x20')](_0xf218('0x21'));}}}return _0x6ca55e[_0xf218('0x22')](_0x404b74[_0xf218('0x10')])[_0xf218('0x23')](_0x326051);}function getUser(_0x10e730,_0x1bcd3d,_0x3e6eec){if(!_[_0xf218('0x24')](_0x1bcd3d)&&intUtil[_0xf218('0x25')](_0x1bcd3d)){var _0x4f025a={'Email':_0x1bcd3d};var _0x1ac78e={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3e6eec[_0xf218('0x22')]('User')['find'](_0x4f025a,_0x1ac78e)[_0xf218('0x26')]()[_0xf218('0x27')](function(_0x286c4c){if(_0x286c4c[_0xf218('0x28')]){var _0x18831a=_[_0xf218('0x29')](_0x286c4c,function(_0x386909){return _0x386909[_0xf218('0x2a')]===_0x1bcd3d;});if(_0x18831a){logger[_0xf218('0x20')]('Agent\x20%s\x20found.',_0x1bcd3d);return BPromise[_0xf218('0x2b')]({'id':_0x18831a['Id'],'name':_0x18831a[_0xf218('0x2c')]});}}else{logger[_0xf218('0x20')](_0xf218('0x2d'),_0x1bcd3d);return _0x3e6eec[_0xf218('0x2e')]()['then'](function(_0x4badb4){return BPromise['resolve']({'id':_0x4badb4['user_id'],'name':_0x4badb4[_0xf218('0x2f')]});});}});}else{logger['info'](_0xf218('0x2d'),_0x1bcd3d);return _0x3e6eec['identity']()[_0xf218('0x27')](function(_0x32bbc9){return BPromise[_0xf218('0x2b')]({'id':_0x32bbc9[_0xf218('0x30')],'name':_0x32bbc9[_0xf218('0x2f')]});});}}function getEndUser(_0x427771,_0x570b5b,_0x439bd0,_0x22e584,_0x164f42){var _0x351bce={'$or':{'Phone':_0x22e584}};var _0xaedcda={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xf218('0x2b')]()[_0xf218('0x27')](function(){logger[_0xf218('0x20')](_0xf218('0x31'),_0x22e584,_0x570b5b[_0xf218('0x32')]);switch(_0x570b5b[_0xf218('0x32')]){case _0xf218('0x33'):var _0x4f94d5=_[_0xf218('0x34')](_0x351bce);if(_0x570b5b[_0xf218('0x35')]){var _0x474a89={};_0x474a89[_0x570b5b[_0xf218('0x35')]]=_0x22e584;_[_0xf218('0x36')](_0x4f94d5['$or'],_0x474a89);}return _0x164f42[_0xf218('0x22')](_0xf218('0x37'))[_0xf218('0x29')](_0x4f94d5,_0xaedcda)[_0xf218('0x26')]()['then'](function(_0x6c60e0){if(_0x6c60e0&&_0x6c60e0[_0xf218('0x28')]){return _0x6c60e0;}else{var _0x3a636b=_['cloneDeep'](_0x351bce);if(_0x570b5b[_0xf218('0x38')]){var _0x114828={};_0x114828[_0x570b5b[_0xf218('0x38')]]=_0x22e584;_[_0xf218('0x36')](_0x3a636b[_0xf218('0x39')],_0x114828);}return _0x164f42[_0xf218('0x22')](_0xf218('0x3a'))[_0xf218('0x29')](_0x3a636b,_0xaedcda);}});case'account_contact_lead':var _0x5475ad=_[_0xf218('0x34')](_0x351bce);if(_0x570b5b[_0xf218('0x3b')]){var _0x474a89={};_0x474a89[_0x570b5b[_0xf218('0x3b')]]=_0x22e584;_[_0xf218('0x36')](_0x5475ad[_0xf218('0x39')],_0x474a89);}return _0x164f42[_0xf218('0x22')](_0xf218('0x3c'))[_0xf218('0x29')](_0x5475ad,_0xaedcda)[_0xf218('0x26')]()[_0xf218('0x27')](function(_0x1dc98c){if(_0x1dc98c&&_0x1dc98c['length']){return _0x1dc98c;}else{var _0x14d3f7=_[_0xf218('0x34')](_0x351bce);if(_0x570b5b['additionalSearchContact']){var _0x168c9f={};_0x168c9f[_0x570b5b[_0xf218('0x35')]]=_0x22e584;_[_0xf218('0x36')](_0x14d3f7[_0xf218('0x39')],_0x168c9f);}return _0x164f42[_0xf218('0x22')]('Contact')['find'](_0x14d3f7,_0xaedcda)[_0xf218('0x27')](function(_0xca041){if(_0xca041&&_0xca041[_0xf218('0x28')]){return _0xca041;}else{var _0x1ad8e7=_['cloneDeep'](_0x351bce);if(_0x570b5b[_0xf218('0x38')]){var _0x4e6f00={};_0x4e6f00[_0x570b5b[_0xf218('0x38')]]=_0x22e584;_['merge'](_0x1ad8e7['$or'],_0x4e6f00);}return _0x164f42['sobject'](_0xf218('0x3a'))['find'](_0x1ad8e7,_0xaedcda);}});}});case _0xf218('0x16'):var _0x4f94d5=_['cloneDeep'](_0x351bce);if(_0x570b5b['additionalSearchContact']){var _0x474a89={};_0x474a89[_0x570b5b[_0xf218('0x35')]]=_0x22e584;_[_0xf218('0x36')](_0x4f94d5[_0xf218('0x39')],_0x474a89);}return _0x164f42[_0xf218('0x22')](_0xf218('0x37'))[_0xf218('0x29')](_0x4f94d5,_0xaedcda)[_0xf218('0x26')]();case _0xf218('0x1e'):var _0x16f447=_[_0xf218('0x34')](_0x351bce);if(_0x570b5b[_0xf218('0x38')]){var _0x474a89={};_0x474a89[_0x570b5b[_0xf218('0x38')]]=_0x22e584;_[_0xf218('0x36')](_0x16f447[_0xf218('0x39')],_0x474a89);}return _0x164f42[_0xf218('0x22')](_0xf218('0x3a'))['find'](_0x16f447,_0xaedcda);case _0xf218('0x19'):var _0x5475ad=_['cloneDeep'](_0x351bce);if(_0x570b5b[_0xf218('0x3b')]){var _0x474a89={};_0x474a89[_0x570b5b[_0xf218('0x3b')]]=_0x22e584;_[_0xf218('0x36')](_0x5475ad[_0xf218('0x39')],_0x474a89);}return _0x164f42[_0xf218('0x22')]('Account')[_0xf218('0x29')](_0x5475ad,_0xaedcda);default:return null;}})['then'](function(_0x424775){if(_0x424775&&_0x424775[_0xf218('0x28')]){var _0x24c463=_[_0xf218('0x3d')](_0x424775);if(_0x24c463){return BPromise[_0xf218('0x2b')]({'id':_0x24c463['Id'],'name':_0x24c463[_0xf218('0x2c')],'phone':_0x24c463[_0xf218('0x3e')],'endUserType':_0x24c463[_0xf218('0x3f')][_0xf218('0x40')]['toLowerCase']()});}}})[_0xf218('0x27')](function(_0x39bf61){if(_0x39bf61){logger[_0xf218('0x20')](_0xf218('0x41'),_0x39bf61[_0xf218('0x17')],_0x22e584);return BPromise[_0xf218('0x2b')](_0x39bf61);}else{logger['info'](_0xf218('0x42'),_0x22e584);var _0x1c136e={'Phone':_0x22e584};if(_0x570b5b[_0xf218('0x43')]){if(_0x570b5b[_0xf218('0x43')]===_0xf218('0x16')){logger[_0xf218('0x20')](_0xf218('0x44'),_0x22e584,_0x570b5b['moduleCreate']);_0x1c136e[_0xf218('0x45')]=_0x439bd0!==_0xf218('0x46')?_0x439bd0:util[_0xf218('0x47')](_0xf218('0x48'),_0x22e584);}else if(_0x570b5b[_0xf218('0x43')]===_0xf218('0x1e')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x22e584,_0x570b5b[_0xf218('0x43')]);_0x1c136e[_0xf218('0x45')]=_0x439bd0!==_0xf218('0x46')?_0x439bd0:util['format'](_0xf218('0x48'),_0x22e584);_0x1c136e[_0xf218('0x49')]=_0xf218('0x4a');}else if(_0x570b5b[_0xf218('0x43')]===_0xf218('0x19')){logger[_0xf218('0x20')](_0xf218('0x44'),_0x22e584,_0x570b5b[_0xf218('0x43')]);_0x1c136e[_0xf218('0x2c')]=_0x439bd0!==_0xf218('0x46')?_0x439bd0:util[_0xf218('0x47')]('Caller\x20-\x20%s',_0x22e584);}else{return null;}}return _0x164f42[_0xf218('0x22')](_[_0xf218('0x4b')](_0x570b5b[_0xf218('0x43')]))[_0xf218('0x23')](_0x1c136e)[_0xf218('0x27')](function(_0x5ac82d){return BPromise[_0xf218('0x2b')]({'id':_0x5ac82d['id'],'endUserType':_0x570b5b[_0xf218('0x43')]});});}});}function getCustomFields(_0x58fe0b,_0x4bfd16){var _0x3cec5c={};if(_0x58fe0b['length']>0x0){_[_0xf218('0x4c')](_0x58fe0b,function(_0x7e62c9){if(_[_0xf218('0x4d')]([_0xf218('0x4e'),_0xf218('0x4f')],_0x7e62c9[_0xf218('0x40')])&&_0x7e62c9[_0xf218('0x50')]){_0x3cec5c[_0x7e62c9[_0xf218('0x50')]]=_0x7e62c9[_0xf218('0x51')][_0xf218('0x52')]();}else if(_0x7e62c9['type']===_0xf218('0x53')&&_0x7e62c9['variableName']&&_0x7e62c9[_0xf218('0x50')]){_0x4bfd16[_0x7e62c9[_0xf218('0x54')]]&&(_0x3cec5c[_0x7e62c9[_0xf218('0x50')]]=_0x4bfd16[_0x7e62c9['variableName']][_0xf218('0x52')]());}else if(_0x7e62c9[_0xf218('0x40')]===_0xf218('0x55')&&_0x7e62c9[_0xf218('0x56')]&&_0x7e62c9[_0xf218('0x56')]['name']&&_0x7e62c9[_0xf218('0x50')]){_0x4bfd16[_0x7e62c9[_0xf218('0x56')]['name'][_0xf218('0x57')]()]&&(_0x3cec5c[_0x7e62c9[_0xf218('0x50')]]=_0x4bfd16[_0x7e62c9[_0xf218('0x56')]['name']['toLowerCase']()]['toString']());}});}return _0x3cec5c;}function getConnection(_0x49712c){var _0x225929=_0x49712c['password'][_0xf218('0x58')](_0x49712c[_0xf218('0x59')]);var _0x1f5721=new jsforce[(_0xf218('0x5a'))]({'oauth2':{'loginUrl':_0x49712c[_0xf218('0x5b')]||'https://login.salesforce.com','clientId':_0x49712c['clientId'],'clientSecret':_0x49712c[_0xf218('0x5c')]}});return _0x1f5721[_0xf218('0x5d')](_0x49712c[_0xf218('0x5e')],_0x225929)[_0xf218('0x27')](function(){logger[_0xf218('0x20')](_0xf218('0x5f'));return _0x1f5721;});}exports[_0xf218('0x60')]=function(_0x57bd2d,_0x39b0e8,_0x480e65,_0x56709f,_0x590c79,_0x366d28){var _0x2ad241,_0x4a52ab,_0xfbaefa,_0x23b029;_0x366d28[_0xf218('0x61')]=intUtil[_0xf218('0x62')](_0x366d28[_0xf218('0x61')]);_0x366d28[_0xf218('0x5b')]=intUtil[_0xf218('0x62')](_0x366d28[_0xf218('0x5b')]);if(_0x590c79&&_0x590c79[_0xf218('0x63')]){logger['info'](_0xf218('0x64'),_0xf218('0x65'));_0x39b0e8['recordingURL']=util[_0xf218('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x366d28['serverUrl'],_0x39b0e8[_0xf218('0x66')],md5(_0x39b0e8['uniqueid']));}else{_0x39b0e8['recordingURL']='';}return getConnection(_0x366d28)[_0xf218('0x27')](function(_0x4e222a){_0x23b029=_0x4e222a;return getUser(_0x366d28,_0x56709f[_0xf218('0x67')],_0x23b029);})[_0xf218('0x27')](function(_0x25d03a){_0x2ad241=_0x25d03a;return getEndUser(_0x366d28,_0x480e65,_0x39b0e8['calleridname'],_0x39b0e8[_0xf218('0x68')],_0x23b029);})[_0xf218('0x27')](function(_0x545ae2){_0x4a52ab=_0x545ae2;return getTicket(_0x366d28,_0x2ad241,_0x4a52ab,_0x480e65,_0x39b0e8,_0x480e65[_0xf218('0x69')],_0x23b029,_0xf218('0x60'));})[_0xf218('0x27')](function(_0x4431f9){_0xfbaefa=_0x4431f9;logger[_0xf218('0x20')](_0xf218('0x6a'),_0xfbaefa['id']);logger[_0xf218('0x20')](_0xf218('0x6b'),_0xfbaefa['id'],_0x56709f[_0xf218('0x6c')],_0x366d28[_0xf218('0x40')]);switch(_0x366d28['type']){case'integrationTab':emit(util[_0xf218('0x47')](_0xf218('0x6d'),_0x56709f[_0xf218('0x6c')]),_0xf218('0x6e'),{'recordId':_0xfbaefa['id']});break;case'newTab':emit(util[_0xf218('0x47')](_0xf218('0x6d'),_0x56709f[_0xf218('0x6c')]),_0xf218('0x6f'),{'uri':util[_0xf218('0x47')](_0xf218('0x70'),_0x23b029[_0xf218('0x71')],_0xfbaefa['id'])});break;default:logger[_0xf218('0x72')](_0xf218('0x73'));}})[_0xf218('0x74')](function(_0x42cf85){logger[_0xf218('0x72')](_0xf218('0x64'),_0x42cf85);});};exports[_0xf218('0x75')]=function(_0x3d3cab,_0x1ef225,_0xfd6786,_0x5dfa72,_0x36a12f,_0x5bc9bf,_0x3eef73){var _0x1fb29a,_0xd02de7,_0x16e287,_0x41aa05;_0x5bc9bf[_0xf218('0x61')]=intUtil['stripTrailingSlash'](_0x5bc9bf[_0xf218('0x61')]);_0x5bc9bf['remoteUri']=intUtil[_0xf218('0x62')](_0x5bc9bf[_0xf218('0x5b')]);if(_0x3eef73&&_0x3eef73['recordingFormat']&&_0x3eef73[_0xf218('0x76')]!==_0xf218('0x77')){logger['info'](_0xf218('0x78'),_0xf218('0x65'));_0x1ef225[_0xf218('0x79')]=util[_0xf218('0x47')](_0xf218('0x7a'),_0x5bc9bf['serverUrl'],_0x1ef225[_0xf218('0x66')],md5(_0x1ef225[_0xf218('0x66')]));}return getConnection(_0x5bc9bf)[_0xf218('0x27')](function(_0x2768cb){_0x41aa05=_0x2768cb;return getUser(_0x5bc9bf,_0x5dfa72[_0xf218('0x67')],_0x41aa05);})[_0xf218('0x27')](function(_0x38d173){_0x1fb29a=_0x38d173;return getEndUser(_0x5bc9bf,_0xfd6786,_0x1ef225[_0xf218('0x7b')],_0x1ef225[_0xf218('0x7c')],_0x41aa05);})[_0xf218('0x27')](function(_0x214a67){_0xd02de7=_0x214a67;return getTicket(_0x5bc9bf,_0x1fb29a,_0xd02de7,_0xfd6786,_0x1ef225,_0xfd6786[_0xf218('0x69')],_0x41aa05,_0xf218('0x75'));})[_0xf218('0x27')](function(_0x370c6a){_0x16e287=_0x370c6a;logger[_0xf218('0x20')](_0xf218('0x7d'),_0x16e287['id']);logger[_0xf218('0x20')](_0xf218('0x7e'),_0x16e287['id'],_0x5dfa72[_0xf218('0x6c')],_0x5bc9bf[_0xf218('0x40')]);switch(_0x5bc9bf['type']){case _0xf218('0x7f'):emit(util[_0xf218('0x47')]('user:%s',_0x5dfa72[_0xf218('0x6c')]),_0xf218('0x6e'),{'recordId':_0x16e287['id']});break;case _0xf218('0x80'):emit(util[_0xf218('0x47')](_0xf218('0x6d'),_0x5dfa72[_0xf218('0x6c')]),_0xf218('0x6f'),{'uri':util[_0xf218('0x47')](_0xf218('0x70'),_0x41aa05[_0xf218('0x71')],_0x16e287['id'])});break;default:logger[_0xf218('0x72')](_0xf218('0x78'),_0xf218('0x81'));}})[_0xf218('0x74')](function(_0x2ce0bd){logger['error'](_0xf218('0x78'),_0x2ce0bd);});};exports['unmanaged']=function(_0x2166ab,_0x19c6ea,_0x10451a,_0x1cef5d,_0x418784,_0x1eb69a){var _0xce3364,_0x36b72f,_0x572ee0,_0x45aff4;_0x1eb69a['serverUrl']=intUtil[_0xf218('0x62')](_0x1eb69a[_0xf218('0x61')]);_0x1eb69a['remoteUri']=intUtil[_0xf218('0x62')](_0x1eb69a['remoteUri']);if(_0x418784&&_0x418784[_0xf218('0x63')]){logger[_0xf218('0x20')]('['+_0x19c6ea['lastevent'][_0xf218('0x82')]()+']',_0xf218('0x65'));_0x19c6ea[_0xf218('0x79')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1eb69a[_0xf218('0x61')],_0x19c6ea[_0xf218('0x66')],md5(_0x19c6ea[_0xf218('0x66')]));}else{_0x19c6ea[_0xf218('0x79')]='';}return getConnection(_0x1eb69a)[_0xf218('0x27')](function(_0x1ceaa8){_0x45aff4=_0x1ceaa8;if(!_[_0xf218('0x24')](_0x1cef5d)){return getUser(_0x1eb69a,_0x1cef5d[_0xf218('0x6c')],_0x45aff4);}else{return getUser(_0x1eb69a,null,_0x45aff4);}})[_0xf218('0x27')](function(_0x796a61){_0xce3364=_0x796a61;return getEndUser(_0x1eb69a,_0x10451a,_0x19c6ea['calleridname'],_0x19c6ea[_0xf218('0x68')],_0x45aff4);})['then'](function(_0x35b4c0){_0x36b72f=_0x35b4c0;return getTicket(_0x1eb69a,_0xce3364,_0x36b72f,_0x10451a,_0x19c6ea,_0x10451a[_0xf218('0x69')],_0x45aff4);})[_0xf218('0x27')](function(_0x2c1cc1){_0x572ee0=_0x2c1cc1;logger[_0xf218('0x20')]('['+_0x19c6ea[_0xf218('0x83')]['toUpperCase']()+_0xf218('0x84'),_0x572ee0['id']);logger[_0xf218('0x20')]('['+_0x19c6ea[_0xf218('0x83')]['toUpperCase']()+_0xf218('0x85'),_0x1eb69a[_0xf218('0x40')]);})[_0xf218('0x74')](function(_0x29e817){logger[_0xf218('0x72')]('['+_0x19c6ea['lastevent']['toUpperCase']()+']',_0x29e817);});}; \ 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 3ba3579..da2a4f9 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 _0x0a13=['%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','./util','../../../../config/logger','servicenow','redis','defaults','localhost','sys_user?sysparm_query=user_name%3Dadmin','then','length','sys_id','info','toUpperCase','error','message','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','result','active','true','userId','adminEmail','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','adminId','endUserNumber','user','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','picklist','type','customField','nameField','content','includes','idField','toLowerCase','toString','variableName','customVariable','Variable','name','outbound','POST','incident','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','label_entry','Incident','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map'];(function(_0x12916b,_0x3ba82d){var _0x58d533=function(_0xd83c7c){while(--_0xd83c7c){_0x12916b['push'](_0x12916b['shift']());}};_0x58d533(++_0x3ba82d);}(_0x0a13,0x161));var _0x30a1=function(_0x142ec2,_0x5bb03d){_0x142ec2=_0x142ec2-0x0;var _0x45ef4e=_0x0a13[_0x142ec2];return _0x45ef4e;};'use strict';var _=require(_0x30a1('0x0'));var Promise=require(_0x30a1('0x1'));var rp=require(_0x30a1('0x2'));var util=require(_0x30a1('0x3'));var md5=require(_0x30a1('0x4'));var Redis=require('ioredis');var intUtil=require(_0x30a1('0x5'));var config=require('../../../../config/environment');var logger=require(_0x30a1('0x6'))(_0x30a1('0x7'));config[_0x30a1('0x8')]=_[_0x30a1('0x9')](config[_0x30a1('0x8')],{'host':_0x30a1('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x30a1('0x8')]));function getAdminUser(_0x5d7035,_0x3f57d5,_0x5c190b,_0x7431cf,_0xa6ef1c,_0x385638){return new Promise(function(_0x514fa3,_0x1ff217){var _0x20ba8b={'method':'GET','uri':_0x7431cf+_0x30a1('0xb')+'&'+_0xa6ef1c+'&'+_0x385638,'auth':_0x3f57d5,'json':!![]};return rp(_0x20ba8b)[_0x30a1('0xc')](function(_0x108c61){if(_0x108c61['result'][_0x30a1('0xd')]>0x0){_0x5c190b['adminId']=_0x108c61['result'][0x0][_0x30a1('0xe')];}logger[_0x30a1('0xf')]('['+[_0x5d7035[_0x30a1('0x10')]()]+'],\x20getAdminUser\x20crm',_0x5c190b);_0x514fa3(_0x5c190b);})['catch'](function(_0x52cd1c){logger[_0x30a1('0x11')]('['+[_0x5d7035[_0x30a1('0x10')]()]+']',_0x52cd1c[_0x30a1('0x12')]);_0x1ff217(_0x52cd1c['message']);});});}function getUser(_0x24a8f3,_0x2adc5b,_0x3e01ae,_0xf66e93,_0x438076){return function(_0x59d0d4){logger['info']('['+[_0x24a8f3[_0x30a1('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x59d0d4);return new Promise(function(_0x2e9ae3,_0x53c7c7){if(intUtil[_0x30a1('0x13')](_0x59d0d4[_0x30a1('0x14')])){var _0x5a0a13={'method':_0x30a1('0x15'),'uri':_0x3e01ae+_0x30a1('0x16')+_0x59d0d4[_0x30a1('0x14')]+'&'+_0xf66e93+'&'+_0x438076,'auth':_0x2adc5b,'json':!![]};logger['info']('['+[_0x24a8f3[_0x30a1('0x10')]()]+_0x30a1('0x17'),_0x5a0a13);return rp(_0x5a0a13)[_0x30a1('0xc')](function(_0x1aaf3d){logger[_0x30a1('0xf')]('['+[_0x24a8f3['toUpperCase']()]+_0x30a1('0x18'),_0x1aaf3d);if(_0x1aaf3d[_0x30a1('0x19')]['length']>0x0&&String(_0x1aaf3d['result'][0x0][_0x30a1('0x1a')])===_0x30a1('0x1b')){_0x59d0d4['userId']=_0x1aaf3d[_0x30a1('0x19')][0x0][_0x30a1('0xe')];}else{_0x59d0d4[_0x30a1('0x1c')]=_0x59d0d4['adminId'];_0x59d0d4['userEmail']=_0x59d0d4[_0x30a1('0x1d')];}logger[_0x30a1('0xf')]('['+[_0x24a8f3[_0x30a1('0x10')]()]+_0x30a1('0x1e'),_0x59d0d4);_0x2e9ae3(_0x59d0d4);})[_0x30a1('0x1f')](function(_0x1f1bf3){logger[_0x30a1('0x11')]('['+[_0x24a8f3[_0x30a1('0x10')]()]+']',_0x1f1bf3['message']);_0x53c7c7(_0x1f1bf3['message']);});}else{logger[_0x30a1('0xf')]('['+[_0x24a8f3[_0x30a1('0x10')]()]+_0x30a1('0x20'));_0x59d0d4[_0x30a1('0x1c')]=_0x59d0d4[_0x30a1('0x21')];_0x59d0d4[_0x30a1('0x14')]=_0x59d0d4[_0x30a1('0x1d')];_0x2e9ae3(_0x59d0d4);}});};}function createEndUser(_0x17fbf3,_0x1bfd1a,_0x291c57,_0x3fcb63,_0x464462){logger[_0x30a1('0xf')]('['+[_0x17fbf3[_0x30a1('0x10')]()]+'],\x20createEndUser\x20input\x20crm',_0x291c57);return new Promise(function(_0x1dde5f,_0x50040e){var _0x186fd5={'method':'POST','uri':_0x3fcb63+'sys_user?'+_0x464462,'body':{'user_name':_0x291c57[_0x30a1('0x22')],'roles':_0x30a1('0x23'),'first_name':_0x291c57[_0x30a1('0x22')],'active':_0x30a1('0x1b'),'date_format':_0x30a1('0x24'),'phone':_0x291c57['endUserNumber']},'auth':_0x1bfd1a,'json':!![]};return rp(_0x186fd5)['then'](function(_0x2acf5f){logger[_0x30a1('0xf')]('['+[_0x17fbf3[_0x30a1('0x10')]()]+_0x30a1('0x25'),_0x2acf5f['result']);_0x291c57['endUserId']=_0x2acf5f['result'][_0x30a1('0xe')];_0x1dde5f(_0x291c57);})['catch'](function(_0xe4622f){logger[_0x30a1('0x11')]('['+[_0x17fbf3['toUpperCase']()]+']',_0xe4622f[_0x30a1('0x12')]);_0x50040e(_0xe4622f[_0x30a1('0x12')]);});});}function getEndUser(_0xb804,_0x4d0add,_0x5d5091,_0x3d6fc2,_0x11cce1){return function(_0x37e928){logger['info']('['+[_0xb804['toUpperCase']()]+_0x30a1('0x26'),_0x37e928);return new Promise(function(_0x42118c,_0xa0e26f){var _0xa66faf={'method':_0x30a1('0x15'),'uri':_0x5d5091+_0x30a1('0x27')+_0x37e928[_0x30a1('0x22')]+'&'+_0x3d6fc2+'&'+_0x11cce1,'auth':_0x4d0add,'json':!![]};return rp(_0xa66faf)['then'](function(_0x573501){if(_0x573501[_0x30a1('0x19')]['length']>0x0){_0x37e928[_0x30a1('0x28')]=_0x573501[_0x30a1('0x19')][0x0][_0x30a1('0xe')];logger[_0x30a1('0xf')]('['+[_0xb804[_0x30a1('0x10')]()]+_0x30a1('0x29'),_0x37e928);_0x42118c(_0x37e928);}else{return createEndUser(_0xb804,_0x4d0add,_0x37e928,_0x5d5091,_0x3d6fc2)['then'](function(_0x6dadb2){logger[_0x30a1('0xf')]('['+[_0xb804[_0x30a1('0x10')]()]+_0x30a1('0x2a'),_0x6dadb2);_0x42118c(_0x6dadb2);});}})['catch'](function(_0x34fe18){logger['error']('['+[_0xb804[_0x30a1('0x10')]()]+']',_0x34fe18[_0x30a1('0x12')]);_0xa0e26f(_0x34fe18[_0x30a1('0x12')]);});});};}function getCustomFields(_0xffbab6,_0x1150fe){var _0x5342ee={};if(_0xffbab6[_0x30a1('0xd')]>0x0){_[_0x30a1('0x2b')](_0xffbab6,function(_0x5836a2){if(_['includes']([_0x30a1('0x2c'),_0x30a1('0x2d')],_0x5836a2[_0x30a1('0x2e')])&&_0x5836a2['nameField']&&!_0x5836a2[_0x30a1('0x2f')]){_0x5342ee[_0x5836a2[_0x30a1('0x30')]['toLowerCase']()]=_0x5836a2[_0x30a1('0x31')]['toString']();}else if(_[_0x30a1('0x32')]([_0x30a1('0x2c'),_0x30a1('0x2d')],_0x5836a2[_0x30a1('0x2e')])&&_0x5836a2[_0x30a1('0x33')]&&_0x5836a2[_0x30a1('0x2f')]){_0x5342ee[_0x5836a2[_0x30a1('0x33')][_0x30a1('0x34')]()]=_0x5836a2[_0x30a1('0x31')][_0x30a1('0x35')]();}else if(_0x5836a2[_0x30a1('0x2e')]==='variable'&&_0x5836a2[_0x30a1('0x36')]&&_0x5836a2[_0x30a1('0x33')]&&_0x5836a2[_0x30a1('0x2f')]){_0x5342ee[_0x5836a2[_0x30a1('0x33')][_0x30a1('0x34')]()]=_0x1150fe[_0x5836a2[_0x30a1('0x36')]][_0x30a1('0x35')]();}else if(_0x5836a2['type']===_0x30a1('0x37')&&_0x5836a2['Variable']&&_0x5836a2[_0x30a1('0x38')][_0x30a1('0x39')]&&_0x5836a2[_0x30a1('0x33')]&&_0x5836a2[_0x30a1('0x2f')]){_0x5342ee[_0x5836a2[_0x30a1('0x33')][_0x30a1('0x34')]()]=_0x1150fe[_0x5836a2[_0x30a1('0x38')][_0x30a1('0x39')][_0x30a1('0x34')]()][_0x30a1('0x35')]();}});}return _0x5342ee;}function getTicket(_0x3760d5,_0x586f5c,_0x6dc50,_0x53f3f8,_0x3da9c5,_0x20f0a6){return function(_0x51fe2d){logger[_0x30a1('0xf')]('['+[_0x3760d5[_0x30a1('0x10')]()]+']\x20getTicket\x20input\x20crm',_0x51fe2d);return new Promise(function(_0x164ef9,_0x5cab9a){var _0x5bf360=_0x3760d5[_0x30a1('0x34')]()===_0x30a1('0x3a')?_0x51fe2d[_0x30a1('0x1c')]:_0x51fe2d[_0x30a1('0x28')];var _0x6fae68={'method':_0x30a1('0x3b'),'uri':_0x6dc50+_0x30a1('0x3c')+'?'+_0x20f0a6,'body':Object[_0x30a1('0x3d')]({},{'active':'true','caller_id':_0x5bf360,'assigned_to':_0x51fe2d[_0x30a1('0x1c')],'short_description':intUtil[_0x30a1('0x3e')](_0x53f3f8[_0x30a1('0x3f')],_0x3da9c5,'\x20'),'description':intUtil['getString'](_0x53f3f8['Descriptions'],_0x3da9c5,'\x0a')},getCustomFields(_0x53f3f8[_0x30a1('0x40')],_0x3da9c5)),'auth':_0x586f5c,'json':!![]};return rp(_0x6fae68)[_0x30a1('0xc')](function(_0x495ad3){logger[_0x30a1('0xf')]('['+[_0x3760d5['toUpperCase']()]+_0x30a1('0x41'),_0x495ad3[_0x30a1('0x19')]);_0x51fe2d[_0x30a1('0x42')]=_0x495ad3['result'][_0x30a1('0xe')];_0x51fe2d['ticketNumber']=_0x495ad3['result'][_0x30a1('0x43')];logger[_0x30a1('0xf')]('['+[_0x3760d5[_0x30a1('0x10')]()]+_0x30a1('0x44'),_0x51fe2d);_0x164ef9(_0x51fe2d);})[_0x30a1('0x1f')](function(_0x190894){logger[_0x30a1('0x11')]('['+[_0x3760d5[_0x30a1('0x10')]()]+']',_0x190894['message']);_0x5cab9a(_0x190894[_0x30a1('0x12')]);});});};}function createRemoteTag(_0x53d543,_0x1642e3,_0x30bf6c,_0x37e432){return new Promise(function(_0x21b0db,_0x56a193){var _0x390374={'method':_0x30a1('0x3b'),'uri':_0x30bf6c+_0x30a1('0x45')+'?'+_0x37e432,'body':{'short_description':_0x53d543,'global':!![],'active':!![],'name':_0x53d543},'auth':_0x1642e3,'json':!![]};return rp(_0x390374)[_0x30a1('0xc')](function(_0x5729fe){var _0x3dc5ae=_0x5729fe[_0x30a1('0x19')][_0x30a1('0xe')];_0x21b0db(_0x3dc5ae);});});}function getRemoteTag(_0x18b977,_0x22c679,_0x88d7f,_0x45637c,_0x2bd9d4){return new Promise(function(_0x308267,_0x3ce15d){var _0x3d90da={'method':_0x30a1('0x15'),'uri':_0x88d7f+_0x30a1('0x45')+'?sysparm_query=name%3D'+_0x18b977+'&'+_0x45637c,'auth':_0x22c679,'json':!![]};return rp(_0x3d90da)[_0x30a1('0xc')](function(_0x308a9c){if(_0x308a9c['result'][_0x30a1('0xd')]>0x0){var _0xd97ace=_0x308a9c[_0x30a1('0x19')][0x0][_0x30a1('0xe')];_0x308267(_0xd97ace);}else{return createRemoteTag(_0x18b977,_0x22c679,_0x88d7f,_0x45637c)[_0x30a1('0xc')](function(_0x2d790d){_0x308267(_0x2d790d);});}});});}function assignTagToIncident(_0x357353,_0x47246e,_0x9a50b0,_0x17fc3d,_0x500403){return new Promise(function(_0x30edbc,_0x4bbc8e){var _0x3a7824={'method':_0x30a1('0x3b'),'uri':_0x9a50b0+_0x30a1('0x46')+'?'+_0x500403,'body':{'label':_0x357353,'table':_0x30a1('0x3c'),'id_type':_0x30a1('0x47'),'table_key':_0x17fc3d['ticketId'],'title':_0x30a1('0x48')+_0x17fc3d[_0x30a1('0x49')],'id_display':_0x17fc3d[_0x30a1('0x49')]},'auth':_0x47246e,'json':!![]};return rp(_0x3a7824)['then'](function(_0x180720){_0x30edbc();})[_0x30a1('0x1f')](function(){_0x30edbc();});});}function manageTags(_0x2b9af7,_0x2d40dd,_0x5364a2,_0x585216,_0x1b7462,_0xe05d5b,_0x3a1c5c){return new Promise(function(_0x52cb0d,_0x1eca0d){var _0x51ea69=[];_0x2d40dd['forEach'](function(_0xe6138c){_0x51ea69[_0x30a1('0x4a')](getRemoteTag(_0xe6138c,_0x5364a2,_0x585216,_0xe05d5b,_0x3a1c5c));});return Promise[_0x30a1('0x4b')](_0x51ea69)['then'](function(_0x301711){if(_0x301711['length']){logger[_0x30a1('0xf')]('['+[_0x2b9af7[_0x30a1('0x10')]()]+_0x30a1('0x4c'),_0x301711);var _0x1dcfb0=[];_0x301711[_0x30a1('0x2b')](function(_0x10c76a){_0x1dcfb0[_0x30a1('0x4a')](assignTagToIncident(_0x10c76a,_0x5364a2,_0x585216,_0x1b7462,_0xe05d5b));});return Promise['all'](_0x1dcfb0)['then'](function(){_0x52cb0d();})[_0x30a1('0x1f')](function(){_0x52cb0d();});}else{_0x52cb0d();}});});}function getTags(_0x31a41d,_0x2f7ec0,_0x2043a7,_0x58549f,_0x6c91da,_0x26b1e3){return function(_0x5eb9e1){return new Promise(function(_0x749a17,_0x4122f6){var _0x4df8db=[];var _0x54c605=_0x58549f[_0x30a1('0x4d')];if(_0x54c605&&_0x54c605[_0x30a1('0xd')]>0x0){_0x4df8db=_[_0x30a1('0x4e')](_0x54c605,_0x30a1('0x39'));}if(_0x4df8db[_0x30a1('0xd')]>0x0){return manageTags(_0x31a41d,_0x4df8db,_0x2f7ec0,_0x2043a7,_0x5eb9e1,_0x6c91da,_0x26b1e3)['then'](function(){_0x749a17(_0x5eb9e1);});}else{_0x749a17(_0x5eb9e1);}});};}function emit(_0x331e41,_0x14f199,_0x567ff3){var _0x59ceae='%26sysparm_record_target%3Dincident'+_0x30a1('0x4f')+'%26sysparm_record_list%3Dactive%253Dtrue'+'%255EORDERBYDESCnumber';var _0x16f27d={'uri':_0x331e41+_0x30a1('0x50')+_0x567ff3+_0x59ceae};io['to'](util[_0x30a1('0x51')]('user:%s',_0x14f199))[_0x30a1('0x52')](_0x30a1('0x53'),_0x16f27d);}exports['cs']=function(_0x2d4111,_0x23654a,_0x47dbe7,_0x430191,_0x59a034,_0x88e885,_0x1aa3af,_0x1aa27f){var _0x53853d={};var _0x8deb9b={'user':_0x88e885[_0x30a1('0x54')],'pass':_0x88e885[_0x30a1('0x55')]};var _0x41866e='sysparm_limit=1';var _0x426370=_0x30a1('0x56');_0x88e885[_0x30a1('0x57')]=intUtil['stripTrailingSlash'](_0x88e885[_0x30a1('0x57')]);_0x88e885['serverUrl']=intUtil[_0x30a1('0x58')](_0x88e885[_0x30a1('0x59')]);var _0x4358e8=util[_0x30a1('0x51')]('%s/api/now/table/',_0x88e885[_0x30a1('0x57')]);_0x53853d[_0x30a1('0x14')]=!_[_0x30a1('0x5a')](_0x430191)?_0x430191[_0x30a1('0x5b')]:null;_0x53853d['adminEmail']=_0x88e885[_0x30a1('0x5b')];_0x53853d[_0x30a1('0x22')]=_0x1aa27f[_0x30a1('0x34')]()===_0x30a1('0x3a')?_0x23654a[_0x30a1('0x5c')]:_0x23654a[_0x30a1('0x5d')];_0x53853d[_0x30a1('0x5e')]=_0x1aa27f===_0x30a1('0x5f')||_0x1aa27f===_0x30a1('0x60')?'queue':_0x30a1('0x3a');var _0x129ce1=util[_0x30a1('0x51')](_0x30a1('0x61'),_0x88e885['serverUrl'],_0x23654a['uniqueid'],md5(_0x23654a[_0x30a1('0x62')]));if(_0x59a034&&_0x59a034[_0x30a1('0x63')]){logger[_0x30a1('0xf')]('[QUEUE]',_0x30a1('0x64'));_0x23654a['recordingURL']=_0x129ce1;}else if(_0x1aa3af&&_0x1aa3af['recordingFormat']&&_0x1aa3af['recordingFormat']!==_0x30a1('0x65')){logger[_0x30a1('0xf')](_0x30a1('0x66'),_0x30a1('0x64'));_0x23654a[_0x30a1('0x67')]=_0x129ce1;}else{_0x23654a['recordingURL']='';}return getAdminUser(_0x1aa27f,_0x8deb9b,_0x53853d,_0x4358e8,_0x426370,_0x41866e)[_0x30a1('0xc')](getUser(_0x1aa27f,_0x8deb9b,_0x4358e8,_0x426370,_0x41866e))['then'](getEndUser(_0x1aa27f,_0x8deb9b,_0x4358e8,_0x426370,_0x41866e))[_0x30a1('0xc')](getTicket(_0x1aa27f,_0x8deb9b,_0x4358e8,_0x47dbe7,_0x23654a,_0x426370))[_0x30a1('0xc')](function(_0x1cdbc2){logger[_0x30a1('0xf')](util[_0x30a1('0x51')](_0x30a1('0x68'),_0x1cdbc2['ticketId']));logger[_0x30a1('0xf')](util['format'](_0x30a1('0x69'),_0x1aa27f));if(_0x1aa27f!==_0x30a1('0x60')){logger[_0x30a1('0xf')]('['+[_0x1aa27f[_0x30a1('0x10')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x88e885[_0x30a1('0x57')],_0x430191[_0x30a1('0x39')],_0x1cdbc2[_0x30a1('0x42')]);}})['catch'](function(_0x4691e5){logger[_0x30a1('0x11')]('['+[_0x1aa27f[_0x30a1('0x10')]()]+_0x30a1('0x6a'),util[_0x30a1('0x6b')](_0x4691e5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb1ec=['content','toString','idField','type','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','Subjects','getString','Descriptions','Fields','ticketId','ticketNumber',']\x20getTicket\x20crm','GET','label','?sysparm_query=name%3D','label_entry','Incident',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','adminEmail','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','string','customField','nameField','toLowerCase'];(function(_0x93af3e,_0x2d8ad0){var _0xeed070=function(_0x29354e){while(--_0x29354e){_0x93af3e['push'](_0x93af3e['shift']());}};_0xeed070(++_0x2d8ad0);}(_0xb1ec,0xa4));var _0xcb1e=function(_0x134577,_0x24c281){_0x134577=_0x134577-0x0;var _0x476c90=_0xb1ec[_0x134577];return _0x476c90;};'use strict';var _=require(_0xcb1e('0x0'));var Promise=require(_0xcb1e('0x1'));var rp=require(_0xcb1e('0x2'));var util=require(_0xcb1e('0x3'));var md5=require(_0xcb1e('0x4'));var Redis=require(_0xcb1e('0x5'));var intUtil=require(_0xcb1e('0x6'));var config=require(_0xcb1e('0x7'));var logger=require(_0xcb1e('0x8'))(_0xcb1e('0x9'));config[_0xcb1e('0xa')]=_['defaults'](config[_0xcb1e('0xa')],{'host':_0xcb1e('0xb'),'port':0x18eb});var io=require(_0xcb1e('0xc'))(new Redis(config[_0xcb1e('0xa')]));function getAdminUser(_0x11024e,_0x120709,_0xf6d06b,_0x377956,_0x1a9da6,_0x25d2b0){return new Promise(function(_0x394160,_0x555ecd){var _0x2643ec={'method':'GET','uri':_0x377956+_0xcb1e('0xd')+'&'+_0x1a9da6+'&'+_0x25d2b0,'auth':_0x120709,'json':!![]};return rp(_0x2643ec)[_0xcb1e('0xe')](function(_0x573c35){if(_0x573c35[_0xcb1e('0xf')]['length']>0x0){_0xf6d06b[_0xcb1e('0x10')]=_0x573c35[_0xcb1e('0xf')][0x0][_0xcb1e('0x11')];}logger[_0xcb1e('0x12')]('['+[_0x11024e['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0xf6d06b);_0x394160(_0xf6d06b);})['catch'](function(_0x47e52f){logger[_0xcb1e('0x13')]('['+[_0x11024e[_0xcb1e('0x14')]()]+']',_0x47e52f[_0xcb1e('0x15')]);_0x555ecd(_0x47e52f[_0xcb1e('0x15')]);});});}function getUser(_0xa2df0c,_0x164f0e,_0x591c78,_0x2e2e4c,_0x3a2092){return function(_0x3e0309){logger[_0xcb1e('0x12')]('['+[_0xa2df0c[_0xcb1e('0x14')]()]+_0xcb1e('0x16'),_0x3e0309);return new Promise(function(_0x8f62d,_0x12b3bd){if(intUtil[_0xcb1e('0x17')](_0x3e0309[_0xcb1e('0x18')])){var _0x5cfc6a={'method':'GET','uri':_0x591c78+_0xcb1e('0x19')+_0x3e0309[_0xcb1e('0x18')]+'&'+_0x2e2e4c+'&'+_0x3a2092,'auth':_0x164f0e,'json':!![]};logger['info']('['+[_0xa2df0c['toUpperCase']()]+_0xcb1e('0x1a'),_0x5cfc6a);return rp(_0x5cfc6a)[_0xcb1e('0xe')](function(_0x1f447e){logger[_0xcb1e('0x12')]('['+[_0xa2df0c[_0xcb1e('0x14')]()]+_0xcb1e('0x1b'),_0x1f447e);if(_0x1f447e[_0xcb1e('0xf')][_0xcb1e('0x1c')]>0x0&&String(_0x1f447e[_0xcb1e('0xf')][0x0][_0xcb1e('0x1d')])===_0xcb1e('0x1e')){_0x3e0309[_0xcb1e('0x1f')]=_0x1f447e[_0xcb1e('0xf')][0x0][_0xcb1e('0x11')];}else{_0x3e0309[_0xcb1e('0x1f')]=_0x3e0309[_0xcb1e('0x10')];_0x3e0309[_0xcb1e('0x18')]=_0x3e0309[_0xcb1e('0x20')];}logger[_0xcb1e('0x12')]('['+[_0xa2df0c[_0xcb1e('0x14')]()]+_0xcb1e('0x21'),_0x3e0309);_0x8f62d(_0x3e0309);})[_0xcb1e('0x22')](function(_0x5939bf){logger[_0xcb1e('0x13')]('['+[_0xa2df0c['toUpperCase']()]+']',_0x5939bf[_0xcb1e('0x15')]);_0x12b3bd(_0x5939bf['message']);});}else{logger[_0xcb1e('0x12')]('['+[_0xa2df0c['toUpperCase']()]+_0xcb1e('0x23'));_0x3e0309['userId']=_0x3e0309[_0xcb1e('0x10')];_0x3e0309[_0xcb1e('0x18')]=_0x3e0309[_0xcb1e('0x20')];_0x8f62d(_0x3e0309);}});};}function createEndUser(_0x49ae80,_0x3fd5aa,_0x1d247c,_0xfdeebf,_0x3185ba){logger['info']('['+[_0x49ae80[_0xcb1e('0x14')]()]+_0xcb1e('0x24'),_0x1d247c);return new Promise(function(_0x241c2f,_0x1e6196){var _0x5b8bc2={'method':_0xcb1e('0x25'),'uri':_0xfdeebf+'sys_user?'+_0x3185ba,'body':{'user_name':_0x1d247c[_0xcb1e('0x26')],'roles':'user','first_name':_0x1d247c[_0xcb1e('0x26')],'active':_0xcb1e('0x1e'),'date_format':'System','phone':_0x1d247c[_0xcb1e('0x26')]},'auth':_0x3fd5aa,'json':!![]};return rp(_0x5b8bc2)[_0xcb1e('0xe')](function(_0x5087a3){logger[_0xcb1e('0x12')]('['+[_0x49ae80['toUpperCase']()]+_0xcb1e('0x27'),_0x5087a3[_0xcb1e('0xf')]);_0x1d247c[_0xcb1e('0x28')]=_0x5087a3[_0xcb1e('0xf')]['sys_id'];_0x241c2f(_0x1d247c);})[_0xcb1e('0x22')](function(_0x5693eb){logger[_0xcb1e('0x13')]('['+[_0x49ae80[_0xcb1e('0x14')]()]+']',_0x5693eb[_0xcb1e('0x15')]);_0x1e6196(_0x5693eb[_0xcb1e('0x15')]);});});}function getEndUser(_0x1c371d,_0x2deb91,_0x32b0a3,_0x56edd3,_0x50309e){return function(_0x3e0a45){logger['info']('['+[_0x1c371d[_0xcb1e('0x14')]()]+_0xcb1e('0x29'),_0x3e0a45);return new Promise(function(_0x52c398,_0x55a30c){var _0x3f2891={'method':'GET','uri':_0x32b0a3+_0xcb1e('0x2a')+_0x3e0a45[_0xcb1e('0x26')]+'&'+_0x56edd3+'&'+_0x50309e,'auth':_0x2deb91,'json':!![]};return rp(_0x3f2891)[_0xcb1e('0xe')](function(_0x174996){if(_0x174996[_0xcb1e('0xf')][_0xcb1e('0x1c')]>0x0){_0x3e0a45[_0xcb1e('0x28')]=_0x174996[_0xcb1e('0xf')][0x0][_0xcb1e('0x11')];logger[_0xcb1e('0x12')]('['+[_0x1c371d[_0xcb1e('0x14')]()]+'],\x20getEndUser\x20crm',_0x3e0a45);_0x52c398(_0x3e0a45);}else{return createEndUser(_0x1c371d,_0x2deb91,_0x3e0a45,_0x32b0a3,_0x56edd3)[_0xcb1e('0xe')](function(_0x3bc968){logger['info']('['+[_0x1c371d[_0xcb1e('0x14')]()]+_0xcb1e('0x2b'),_0x3bc968);_0x52c398(_0x3bc968);});}})[_0xcb1e('0x22')](function(_0x2c4248){logger['error']('['+[_0x1c371d[_0xcb1e('0x14')]()]+']',_0x2c4248[_0xcb1e('0x15')]);_0x55a30c(_0x2c4248[_0xcb1e('0x15')]);});});};}function getCustomFields(_0x2f96f3,_0x47f13b){var _0x586d51={};if(_0x2f96f3[_0xcb1e('0x1c')]>0x0){_[_0xcb1e('0x2c')](_0x2f96f3,function(_0x23c36c){if(_[_0xcb1e('0x2d')]([_0xcb1e('0x2e'),'picklist'],_0x23c36c['type'])&&_0x23c36c['nameField']&&!_0x23c36c[_0xcb1e('0x2f')]){_0x586d51[_0x23c36c[_0xcb1e('0x30')][_0xcb1e('0x31')]()]=_0x23c36c[_0xcb1e('0x32')][_0xcb1e('0x33')]();}else if(_[_0xcb1e('0x2d')]([_0xcb1e('0x2e'),'picklist'],_0x23c36c['type'])&&_0x23c36c['idField']&&_0x23c36c[_0xcb1e('0x2f')]){_0x586d51[_0x23c36c[_0xcb1e('0x34')][_0xcb1e('0x31')]()]=_0x23c36c[_0xcb1e('0x32')][_0xcb1e('0x33')]();}else if(_0x23c36c[_0xcb1e('0x35')]===_0xcb1e('0x36')&&_0x23c36c['variableName']&&_0x23c36c['idField']&&_0x23c36c['customField']){_0x586d51[_0x23c36c[_0xcb1e('0x34')][_0xcb1e('0x31')]()]=_0x47f13b[_0x23c36c[_0xcb1e('0x37')]]['toString']();}else if(_0x23c36c[_0xcb1e('0x35')]==='customVariable'&&_0x23c36c[_0xcb1e('0x38')]&&_0x23c36c['Variable'][_0xcb1e('0x39')]&&_0x23c36c[_0xcb1e('0x34')]&&_0x23c36c[_0xcb1e('0x2f')]){_0x586d51[_0x23c36c[_0xcb1e('0x34')][_0xcb1e('0x31')]()]=_0x47f13b[_0x23c36c['Variable'][_0xcb1e('0x39')][_0xcb1e('0x31')]()][_0xcb1e('0x33')]();}});}return _0x586d51;}function getTicket(_0x237b0a,_0x430dfa,_0x51029f,_0x1e97cd,_0x55f9b4,_0x47d5b4){return function(_0x5849d8){logger[_0xcb1e('0x12')]('['+[_0x237b0a[_0xcb1e('0x14')]()]+_0xcb1e('0x3a'),_0x5849d8);return new Promise(function(_0x4a2247,_0xfffb81){var _0x2f222e=_0x237b0a[_0xcb1e('0x31')]()===_0xcb1e('0x3b')?_0x5849d8[_0xcb1e('0x1f')]:_0x5849d8[_0xcb1e('0x28')];var _0x3ad4b5={'method':_0xcb1e('0x25'),'uri':_0x51029f+_0xcb1e('0x3c')+'?'+_0x47d5b4,'body':Object[_0xcb1e('0x3d')]({},{'active':_0xcb1e('0x1e'),'caller_id':_0x2f222e,'assigned_to':_0x5849d8[_0xcb1e('0x1f')],'short_description':intUtil['getString'](_0x1e97cd[_0xcb1e('0x3e')],_0x55f9b4,'\x20'),'description':intUtil[_0xcb1e('0x3f')](_0x1e97cd[_0xcb1e('0x40')],_0x55f9b4,'\x0a')},getCustomFields(_0x1e97cd[_0xcb1e('0x41')],_0x55f9b4)),'auth':_0x430dfa,'json':!![]};return rp(_0x3ad4b5)[_0xcb1e('0xe')](function(_0x5413b8){logger[_0xcb1e('0x12')]('['+[_0x237b0a[_0xcb1e('0x14')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x5413b8[_0xcb1e('0xf')]);_0x5849d8[_0xcb1e('0x42')]=_0x5413b8['result'][_0xcb1e('0x11')];_0x5849d8[_0xcb1e('0x43')]=_0x5413b8[_0xcb1e('0xf')]['number'];logger['info']('['+[_0x237b0a[_0xcb1e('0x14')]()]+_0xcb1e('0x44'),_0x5849d8);_0x4a2247(_0x5849d8);})[_0xcb1e('0x22')](function(_0x539557){logger['error']('['+[_0x237b0a['toUpperCase']()]+']',_0x539557['message']);_0xfffb81(_0x539557[_0xcb1e('0x15')]);});});};}function createRemoteTag(_0x2612cd,_0x20efb9,_0x8bb9e8,_0x4f860d){return new Promise(function(_0x54ca7d,_0x55e069){var _0x36a5ac={'method':_0xcb1e('0x25'),'uri':_0x8bb9e8+'label'+'?'+_0x4f860d,'body':{'short_description':_0x2612cd,'global':!![],'active':!![],'name':_0x2612cd},'auth':_0x20efb9,'json':!![]};return rp(_0x36a5ac)[_0xcb1e('0xe')](function(_0x56d7cd){var _0x3e5d79=_0x56d7cd['result'][_0xcb1e('0x11')];_0x54ca7d(_0x3e5d79);});});}function getRemoteTag(_0x28af79,_0x46512a,_0x16f485,_0x5a0d45,_0x2dc2b1){return new Promise(function(_0x2a966a,_0x26dc85){var _0x10ae64={'method':_0xcb1e('0x45'),'uri':_0x16f485+_0xcb1e('0x46')+_0xcb1e('0x47')+_0x28af79+'&'+_0x5a0d45,'auth':_0x46512a,'json':!![]};return rp(_0x10ae64)[_0xcb1e('0xe')](function(_0x187953){if(_0x187953[_0xcb1e('0xf')][_0xcb1e('0x1c')]>0x0){var _0x1fe8cf=_0x187953['result'][0x0][_0xcb1e('0x11')];_0x2a966a(_0x1fe8cf);}else{return createRemoteTag(_0x28af79,_0x46512a,_0x16f485,_0x5a0d45)['then'](function(_0x201b92){_0x2a966a(_0x201b92);});}});});}function assignTagToIncident(_0x467f17,_0xb37388,_0x53cd41,_0x47c3e9,_0xe165e1){return new Promise(function(_0x5b96f0,_0x487555){var _0x2944a1={'method':_0xcb1e('0x25'),'uri':_0x53cd41+_0xcb1e('0x48')+'?'+_0xe165e1,'body':{'label':_0x467f17,'table':'incident','id_type':_0xcb1e('0x49'),'table_key':_0x47c3e9[_0xcb1e('0x42')],'title':'Incident\x20-\x20'+_0x47c3e9[_0xcb1e('0x43')],'id_display':_0x47c3e9[_0xcb1e('0x43')]},'auth':_0xb37388,'json':!![]};return rp(_0x2944a1)['then'](function(_0x37209e){_0x5b96f0();})[_0xcb1e('0x22')](function(){_0x5b96f0();});});}function manageTags(_0x409388,_0x150384,_0x59edda,_0x40f68c,_0x66074e,_0x19a4e6,_0x4ddd0b){return new Promise(function(_0x25269f,_0x1069fa){var _0x52cbfd=[];_0x150384['forEach'](function(_0x1a7335){_0x52cbfd['push'](getRemoteTag(_0x1a7335,_0x59edda,_0x40f68c,_0x19a4e6,_0x4ddd0b));});return Promise['all'](_0x52cbfd)[_0xcb1e('0xe')](function(_0x28ce1b){if(_0x28ce1b[_0xcb1e('0x1c')]){logger[_0xcb1e('0x12')]('['+[_0x409388[_0xcb1e('0x14')]()]+_0xcb1e('0x4a'),_0x28ce1b);var _0x18fe62=[];_0x28ce1b[_0xcb1e('0x2c')](function(_0x43667e){_0x18fe62[_0xcb1e('0x4b')](assignTagToIncident(_0x43667e,_0x59edda,_0x40f68c,_0x66074e,_0x19a4e6));});return Promise[_0xcb1e('0x4c')](_0x18fe62)[_0xcb1e('0xe')](function(){_0x25269f();})[_0xcb1e('0x22')](function(){_0x25269f();});}else{_0x25269f();}});});}function getTags(_0x5890ea,_0x3219f9,_0x4c3fc8,_0x5271c7,_0x2788fc,_0x203104){return function(_0x2bbe06){return new Promise(function(_0x37c62f,_0x4f1b01){var _0x12078e=[];var _0x2b3ffd=_0x5271c7[_0xcb1e('0x4d')];if(_0x2b3ffd&&_0x2b3ffd[_0xcb1e('0x1c')]>0x0){_0x12078e=_[_0xcb1e('0x4e')](_0x2b3ffd,_0xcb1e('0x39'));}if(_0x12078e[_0xcb1e('0x1c')]>0x0){return manageTags(_0x5890ea,_0x12078e,_0x3219f9,_0x4c3fc8,_0x2bbe06,_0x2788fc,_0x203104)[_0xcb1e('0xe')](function(){_0x37c62f(_0x2bbe06);});}else{_0x37c62f(_0x2bbe06);}});};}function emit(_0x457b38,_0x249b2c,_0x11761a){var _0x3e2c0b='%26sysparm_record_target%3Dincident'+_0xcb1e('0x4f')+_0xcb1e('0x50')+'%255EORDERBYDESCnumber';var _0xa79831={'uri':_0x457b38+_0xcb1e('0x51')+_0x11761a+_0x3e2c0b};io['to'](util[_0xcb1e('0x52')]('user:%s',_0x249b2c))['emit'](_0xcb1e('0x53'),_0xa79831);}exports['cs']=function(_0xa1cbbf,_0x5d1e10,_0x10f802,_0x258195,_0x3ce9ae,_0x235f39,_0x55a56a,_0x379f31){var _0xa3258d={};var _0x198c07={'user':_0x235f39[_0xcb1e('0x54')],'pass':_0x235f39[_0xcb1e('0x55')]};var _0xf5d518=_0xcb1e('0x56');var _0x878972=_0xcb1e('0x57');_0x235f39[_0xcb1e('0x58')]=intUtil[_0xcb1e('0x59')](_0x235f39[_0xcb1e('0x58')]);_0x235f39[_0xcb1e('0x5a')]=intUtil[_0xcb1e('0x59')](_0x235f39['serverUrl']);var _0x23223e=util['format'](_0xcb1e('0x5b'),_0x235f39[_0xcb1e('0x58')]);_0xa3258d[_0xcb1e('0x18')]=!_[_0xcb1e('0x5c')](_0x258195)?_0x258195[_0xcb1e('0x5d')]:null;_0xa3258d['adminEmail']=_0x235f39[_0xcb1e('0x5d')];_0xa3258d[_0xcb1e('0x26')]=_0x379f31[_0xcb1e('0x31')]()==='outbound'?_0x5d1e10[_0xcb1e('0x5e')]:_0x5d1e10[_0xcb1e('0x5f')];_0xa3258d[_0xcb1e('0x60')]=_0x379f31===_0xcb1e('0x61')||_0x379f31===_0xcb1e('0x62')?_0xcb1e('0x61'):_0xcb1e('0x3b');var _0x1a504a=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x235f39[_0xcb1e('0x5a')],_0x5d1e10[_0xcb1e('0x63')],md5(_0x5d1e10[_0xcb1e('0x63')]));if(_0x3ce9ae&&_0x3ce9ae[_0xcb1e('0x64')]){logger[_0xcb1e('0x12')]('[QUEUE]','Recording\x20is\x20enabled!');_0x5d1e10[_0xcb1e('0x65')]=_0x1a504a;}else if(_0x55a56a&&_0x55a56a[_0xcb1e('0x66')]&&_0x55a56a[_0xcb1e('0x66')]!=='none'){logger[_0xcb1e('0x12')](_0xcb1e('0x67'),_0xcb1e('0x68'));_0x5d1e10['recordingURL']=_0x1a504a;}else{_0x5d1e10[_0xcb1e('0x65')]='';}return getAdminUser(_0x379f31,_0x198c07,_0xa3258d,_0x23223e,_0x878972,_0xf5d518)[_0xcb1e('0xe')](getUser(_0x379f31,_0x198c07,_0x23223e,_0x878972,_0xf5d518))['then'](getEndUser(_0x379f31,_0x198c07,_0x23223e,_0x878972,_0xf5d518))['then'](getTicket(_0x379f31,_0x198c07,_0x23223e,_0x10f802,_0x5d1e10,_0x878972))[_0xcb1e('0xe')](function(_0x567a5b){logger['info'](util[_0xcb1e('0x52')](_0xcb1e('0x69'),_0x567a5b[_0xcb1e('0x42')]));logger['info'](util[_0xcb1e('0x52')]('call\x20direction:\x20%s',_0x379f31));if(_0x379f31!==_0xcb1e('0x62')){logger[_0xcb1e('0x12')]('['+[_0x379f31[_0xcb1e('0x14')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x235f39['remoteUri'],_0x258195['name'],_0x567a5b['ticketId']);}})[_0xcb1e('0x22')](function(_0x1a59ea){logger[_0xcb1e('0x13')]('['+[_0x379f31['toUpperCase']()]+_0xcb1e('0x6a'),util['inspect'](_0x1a59ea,{'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 b73c5d3..6ea6be5 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 _0x427e=['nameField','toLowerCase','content','customField','variable','custom_fields','push','toString','customVariable','Variable','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','users','contacts','version','%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]','user:%s','trigger:browser:url','catch','error','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','lastevent','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','date_start','slice','parent_type','parent_name','direction','length','forEach','idField','variableName','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','base64','isNil','Getting\x20agent\x20with\x20name','Employees','user_name','then','entry_list','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','type','string'];(function(_0x31e181,_0x2acd2d){var _0x14a4f8=function(_0x460201){while(--_0x460201){_0x31e181['push'](_0x31e181['shift']());}};_0x14a4f8(++_0x2acd2d);}(_0x427e,0xab));var _0xe427=function(_0xa3d957,_0x5cefc3){_0xa3d957=_0xa3d957-0x0;var _0x1f2f67=_0x427e[_0xa3d957];return _0x1f2f67;};'use strict';var _=require(_0xe427('0x0'));var rp=require(_0xe427('0x1'));var BPromise=require(_0xe427('0x2'));var md5=require(_0xe427('0x3'));var util=require(_0xe427('0x4'));var Redis=require(_0xe427('0x5'));var intUtil=require(_0xe427('0x6'));var config=require('../../../../config/environment');var logger=require(_0xe427('0x7'))(_0xe427('0x8'));config[_0xe427('0x9')]=_['defaults'](config[_0xe427('0x9')],{'host':_0xe427('0xa'),'port':0x18eb});var io=require(_0xe427('0xb'))(new Redis(config['redis']));var def={'method':_0xe427('0xc'),'json':!![]};function emit(_0x667856,_0x254879,_0x34aeed){io['to'](_0x667856)[_0xe427('0xd')](_0x254879,_0x34aeed);}function getTicket(_0x4d4836,_0x69909f,_0x281c97,_0x58778e,_0x2507d3,_0x480fdd,_0x455b41,_0x3318bf){logger[_0xe427('0xe')](_0xe427('0xf'));var _0x8f7786=new Date();var _0xca22a3=[{'name':_0xe427('0x10'),'value':intUtil[_0xe427('0x11')](_0x58778e[_0xe427('0x12')],_0x2507d3,'\x20')},{'name':_0xe427('0x13'),'value':_0x69909f['id']},{'name':_0xe427('0x14'),'value':_0x69909f['id']},{'name':'description','value':intUtil[_0xe427('0x11')](_0x58778e['Descriptions'],_0x2507d3,'\x0a')},{'name':_0xe427('0x15'),'value':_0x8f7786['toISOString']()[_0xe427('0x16')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x281c97['id']},{'name':_0xe427('0x17'),'value':'Contacts'},{'name':_0xe427('0x18'),'value':_0x281c97['name']},{'name':_0xe427('0x19'),'value':_0x3318bf}];if(_0x480fdd[_0xe427('0x1a')]){_[_0xe427('0x1b')](_0x480fdd,function(_0x33579e){if(_0x2507d3[_0x33579e['variableName']]){_0xca22a3['push']({'name':_0x33579e[_0xe427('0x1c')],'value':_0x2507d3[_0x33579e[_0xe427('0x1d')]]});}});}return request({'form':{'method':_0xe427('0x1e'),'input_type':'JSON','response_type':_0xe427('0x1f'),'rest_data':JSON[_0xe427('0x20')]({'session':_0x455b41['id'],'module_name':_0xe427('0x21'),'name_value_list':_0xca22a3})}});}function getAuth(_0x125cb4){return util[_0xe427('0x22')](_0xe427('0x23'),new Buffer(_0x125cb4[_0xe427('0x24')]+':X')['toString'](_0xe427('0x25')));}function getServerInfo(_0x2e2e46){return request({'form':{'method':'get_server_info','input_type':_0xe427('0x1f'),'response_type':_0xe427('0x1f'),'rest_data':JSON[_0xe427('0x20')]({'session':_0x2e2e46['id']})}});}function getUser(_0x4049e4,_0x31fe03,_0x2e69dc){if(!_[_0xe427('0x26')](_0x31fe03)){logger[_0xe427('0xe')](_0xe427('0x27'),_0x31fe03);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x2e69dc['id'],'module_name':_0xe427('0x28'),'query':util[_0xe427('0x22')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x31fe03),'order_by':'','offset':'0','select_fields':['id',_0xe427('0x10'),_0xe427('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe427('0x2a')](function(_0x5cf905){if(_0x5cf905[_0xe427('0x2b')][_0xe427('0x1a')]){var _0x4ee262=_[_0xe427('0x2c')](_0x5cf905['entry_list'],function(_0x2cb8e0){return _0x2cb8e0[_0xe427('0x2d')][_0xe427('0x29')][_0xe427('0x2e')]===_0x31fe03;});if(_0x4ee262){logger[_0xe427('0xe')]('Agent\x20found!');return BPromise[_0xe427('0x2f')]({'id':_0x4ee262[_0xe427('0x2d')]['id'][_0xe427('0x2e')],'name':_0x4ee262['name_value_list'][_0xe427('0x10')]['value']});}}logger[_0xe427('0xe')](_0xe427('0x30'));return BPromise['resolve']({'id':_0x2e69dc['name_value_list']['user_id'][_0xe427('0x2e')],'name':_0x2e69dc[_0xe427('0x2d')][_0xe427('0x29')][_0xe427('0x2e')]});});}else{logger[_0xe427('0xe')](_0xe427('0x31'));return BPromise['resolve']({'id':_0x2e69dc[_0xe427('0x2d')][_0xe427('0x32')][_0xe427('0x2e')],'name':_0x2e69dc['name_value_list'][_0xe427('0x29')][_0xe427('0x2e')]});}}function getEndUser(_0x56d1f3,_0x3d41fa,_0x66199b,_0x46a6d3){logger['info'](_0xe427('0x33'),_0x66199b);return request({'form':{'method':_0xe427('0x34'),'input_type':_0xe427('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x46a6d3['id'],'module_name':_0xe427('0x35'),'query':util['format'](_0xe427('0x36'),_0x66199b),'order_by':'','offset':'0','select_fields':['id','name',_0xe427('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe427('0x2a')](function(_0x15014a){if(_0x15014a[_0xe427('0x2b')][_0xe427('0x1a')]){var _0x482c09=_[_0xe427('0x2c')](_0x15014a[_0xe427('0x2b')],function(_0x4c211c){return _0x4c211c[_0xe427('0x2d')]['phone_home'][_0xe427('0x2e')]===_0x66199b;});if(_0x482c09){logger[_0xe427('0xe')](_0xe427('0x38'));return BPromise[_0xe427('0x2f')]({'id':_0x482c09[_0xe427('0x2d')]['id'][_0xe427('0x2e')],'name':_0x482c09[_0xe427('0x2d')][_0xe427('0x10')][_0xe427('0x2e')],'phone':_0x482c09[_0xe427('0x2d')]['phone_home'][_0xe427('0x2e')]});}}else{logger[_0xe427('0xe')](_0xe427('0x39'));return request({'form':{'method':_0xe427('0x1e'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xe427('0x20')]({'session':_0x46a6d3['id'],'module_name':_0xe427('0x35'),'name_value_list':[{'name':_0xe427('0x3a'),'value':_0x3d41fa!==_0xe427('0x3b')?_0x3d41fa:util[_0xe427('0x22')](_0xe427('0x3c'),_0x66199b)},{'name':_0xe427('0x37'),'value':_0x66199b}]})}})[_0xe427('0x2a')](function(_0x2b34c7){logger[_0xe427('0xe')](_0xe427('0x3d'));return BPromise[_0xe427('0x2f')]({'id':_0x2b34c7['id'],'name':_0x2b34c7[_0xe427('0x2b')][_0xe427('0x3a')]['value'],'phone':_0x2b34c7[_0xe427('0x2b')][_0xe427('0x37')][_0xe427('0x2e')]});});}});}function request(_0x1a0526){logger[_0xe427('0x3e')]('[HTTP]',JSON[_0xe427('0x20')](_0x1a0526));return rp(_['merge'](def,_0x1a0526));}function getTags(_0x577744,_0x5d9dbb){var _0x3c2dad=[];if(_0x577744&&_0x577744[_0xe427('0x1a')]>0x0){_0x3c2dad=_['map'](_0x577744,_0x5d9dbb);}return _0x3c2dad;}function getCustomFields(_0x4faf59,_0x2ccd36){var _0xc3a9cf=[];var _0x238fe1={'custom_fields':[]};if(_0x4faf59[_0xe427('0x1a')]>0x0){_[_0xe427('0x1b')](_0x4faf59,function(_0x455cc4){if(_0x455cc4[_0xe427('0x3f')]===_0xe427('0x40')&&_0x455cc4[_0xe427('0x41')]&&!_0x455cc4['customField']){_0x238fe1[_0x455cc4['nameField'][_0xe427('0x42')]()]=_0x455cc4[_0xe427('0x43')]['toString']();}else if(_0x455cc4['type']===_0xe427('0x40')&&_0x455cc4[_0xe427('0x1c')]&&_0x455cc4[_0xe427('0x44')]){_0x238fe1['custom_fields']['push']({'id':_0x455cc4[_0xe427('0x1c')],'value':_0x455cc4[_0xe427('0x43')]['toString']()});}else if(_0x455cc4['type']===_0xe427('0x45')&&_0x455cc4['variableName']&&_0x455cc4[_0xe427('0x1c')]&&_0x455cc4[_0xe427('0x44')]){_0x2ccd36[_0x455cc4[_0xe427('0x1d')]]&&_0x238fe1[_0xe427('0x46')][_0xe427('0x47')]({'id':_0x455cc4['idField'],'value':_0x2ccd36[_0x455cc4[_0xe427('0x1d')]][_0xe427('0x48')]()});}else if(_0x455cc4['type']===_0xe427('0x49')&&_0x455cc4[_0xe427('0x4a')]&&_0x455cc4[_0xe427('0x4a')]['name']&&_0x455cc4['idField']&&_0x455cc4[_0xe427('0x44')]){_0x2ccd36[_0x455cc4[_0xe427('0x4a')]['name'][_0xe427('0x42')]()]&&_0x238fe1['custom_fields'][_0xe427('0x47')]({'id':_0x455cc4[_0xe427('0x1c')],'value':_0x2ccd36[_0x455cc4[_0xe427('0x4a')]['name'][_0xe427('0x42')]()][_0xe427('0x48')]()});}});}return _0x238fe1;}function getConnection(_0xdde888){return request({'method':_0xe427('0xc'),'form':{'method':'login','input_type':_0xe427('0x1f'),'response_type':_0xe427('0x1f'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0xdde888['username'],'password':_0xdde888[_0xe427('0x4b')],'encryption':_0xe427('0x4c')},'application':'xCALLY\x20Motion\x20integration'})}})[_0xe427('0x2a')](function(_0x4d0809){var _0x4e68d1=_0x4d0809;if(_0x4e68d1['id']){def[_0xe427('0x4d')]=_0x4e68d1['id'];return BPromise[_0xe427('0x2f')](_0x4e68d1);}else{throw new Error(util[_0xe427('0x22')](_0xe427('0x4e'),_0xdde888['id']));}});}function setRelationship(_0x43cdd4,_0x5c6246,_0x12b927,_0x42628c){return request({'form':{'method':_0xe427('0x4f'),'input_type':_0xe427('0x1f'),'response_type':_0xe427('0x1f'),'rest_data':JSON[_0xe427('0x20')]({'session':_0x43cdd4['id'],'module_name':_0xe427('0x21'),'module_id':_0x12b927['id'],'link_field_name':_0x42628c,'related_ids':[_0x5c6246['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xe427('0x50')]=function(_0x340b0c,_0xcbe2d9,_0x5b2baf,_0x3cd163,_0x33f18a,_0x563d53){var _0xc95b5b,_0x45647b,_0x394ca0,_0x55e0f8;_0x563d53[_0xe427('0x51')]=intUtil[_0xe427('0x52')](_0x563d53[_0xe427('0x51')]);_0x563d53[_0xe427('0x53')]=intUtil[_0xe427('0x52')](_0x563d53[_0xe427('0x53')]);def[_0xe427('0x54')]=util[_0xe427('0x22')](_0xe427('0x55'),_0x563d53[_0xe427('0x51')]);if(_0x33f18a&&_0x33f18a['monitor_format']){logger['info']('[QUEUE]',_0xe427('0x56'));_0xcbe2d9['recordingURL']=util[_0xe427('0x22')](_0xe427('0x57'),_0x563d53[_0xe427('0x53')],_0xcbe2d9['uniqueid'],md5(_0xcbe2d9[_0xe427('0x58')]));}else{_0xcbe2d9[_0xe427('0x59')]='';}return getConnection(_0x563d53)[_0xe427('0x2a')](function(_0x1f3689){_0x55e0f8=_0x1f3689;return getUser(_0x563d53,_0x3cd163['name'],_0x55e0f8);})[_0xe427('0x2a')](function(_0x3efdfe){_0xc95b5b=_0x3efdfe;logger[_0xe427('0xe')]('The\x20User\x20ID\x20is:',_0xc95b5b['id']);return getEndUser(_0x563d53,_0xcbe2d9[_0xe427('0x5a')],_0xcbe2d9[_0xe427('0x5b')],_0x55e0f8);})[_0xe427('0x2a')](function(_0x579186){_0x45647b=_0x579186;logger[_0xe427('0xe')]('The\x20Enduser\x20ID\x20is:',_0x45647b['id']);return getTicket(_0x563d53,_0xc95b5b,_0x45647b,_0x5b2baf,_0xcbe2d9,_0x5b2baf[_0xe427('0x5c')],_0x55e0f8,_0xe427('0x5d'));})[_0xe427('0x2a')](function(_0x1ede53){_0x394ca0=_0x1ede53;logger['info'](_0xe427('0x5e'));logger[_0xe427('0xe')]('The\x20Ticket\x20ID\x20is:',_0x394ca0['id']);return setRelationship(_0x55e0f8,_0xc95b5b,_0x394ca0,_0xe427('0x5f'));})['then'](function(){return setRelationship(_0x55e0f8,_0x45647b,_0x394ca0,_0xe427('0x60'));})[_0xe427('0x2a')](function(){return getServerInfo(_0x55e0f8);})['then'](function(_0x127bcb){var _0x2de603=parseInt(_0x127bcb[_0xe427('0x61')]['charAt'](0x0));var _0x5dcfd1=util[_0xe427('0x22')](_0xe427('0x62'),_0x563d53[_0xe427('0x51')],_0x394ca0['id']);if(_0x2de603>0x6){_0x5dcfd1=util[_0xe427('0x22')](_0xe427('0x63'),_0x563d53['remoteUri'],_0x394ca0['id']);}logger[_0xe427('0xe')](_0xe427('0x64'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe427('0x22')](_0xe427('0x65'),_0x3cd163[_0xe427('0x10')]),_0xe427('0x66'),{'uri':_0x5dcfd1});})[_0xe427('0x67')](function(_0x510e48){logger[_0xe427('0x68')](_0xe427('0x64'),JSON[_0xe427('0x20')](_0x510e48));});};exports['outbound']=function(_0x330646,_0x99e6bf,_0x2f7bab,_0x11e543,_0x44814b,_0x5e1d0b,_0x16adba){var _0x501ef3,_0x289615,_0x5d15ec,_0x5920e4;_0x5e1d0b[_0xe427('0x51')]=intUtil[_0xe427('0x52')](_0x5e1d0b[_0xe427('0x51')]);_0x5e1d0b['serverUrl']=intUtil[_0xe427('0x52')](_0x5e1d0b[_0xe427('0x53')]);def[_0xe427('0x54')]=util[_0xe427('0x22')](_0xe427('0x55'),_0x5e1d0b['remoteUri']);if(_0x16adba&&_0x16adba['recordingFormat']&&_0x16adba[_0xe427('0x69')]!==_0xe427('0x6a')){logger[_0xe427('0xe')](_0xe427('0x6b'),'Recording\x20is\x20enabled!');_0x99e6bf[_0xe427('0x59')]=util[_0xe427('0x22')](_0xe427('0x57'),_0x5e1d0b['serverUrl'],_0x99e6bf[_0xe427('0x58')],md5(_0x99e6bf[_0xe427('0x58')]));}return getConnection(_0x5e1d0b)[_0xe427('0x2a')](function(_0x508888){_0x5920e4=_0x508888;return getUser(_0x5e1d0b,_0x11e543[_0xe427('0x10')],_0x5920e4);})[_0xe427('0x2a')](function(_0x39e8fc){_0x501ef3=_0x39e8fc;logger[_0xe427('0xe')](_0xe427('0x6c'),_0x501ef3['id']);return getEndUser(_0x5e1d0b,_0x99e6bf[_0xe427('0x6d')],_0x99e6bf[_0xe427('0x6e')],_0x5920e4);})[_0xe427('0x2a')](function(_0x4c7055){_0x289615=_0x4c7055;logger['info'](_0xe427('0x6f'),_0x289615['id']);return getTicket(_0x5e1d0b,_0x501ef3,_0x289615,_0x2f7bab,_0x99e6bf,_0x2f7bab[_0xe427('0x5c')],_0x5920e4,'Outbound');})[_0xe427('0x2a')](function(_0x4820df){_0x5d15ec=_0x4820df;logger[_0xe427('0xe')]('Ticket\x20created!');logger[_0xe427('0xe')](_0xe427('0x70'),_0x5d15ec['id']);return setRelationship(_0x5920e4,_0x501ef3,_0x5d15ec,_0xe427('0x5f'));})[_0xe427('0x2a')](function(){return setRelationship(_0x5920e4,_0x289615,_0x5d15ec,_0xe427('0x60'));})[_0xe427('0x2a')](function(){return getServerInfo(_0x5920e4);})[_0xe427('0x2a')](function(_0x39a4cd){var _0x4c27df=parseInt(_0x39a4cd['version'][_0xe427('0x71')](0x0));var _0x2080c5=util[_0xe427('0x22')](_0xe427('0x62'),_0x5e1d0b[_0xe427('0x51')],_0x5d15ec['id']);if(_0x4c27df>0x6){_0x2080c5=util[_0xe427('0x22')](_0xe427('0x63'),_0x5e1d0b[_0xe427('0x51')],_0x5d15ec['id']);}logger['info'](_0xe427('0x6b'),_0xe427('0x72'));emit(util[_0xe427('0x22')](_0xe427('0x65'),_0x11e543[_0xe427('0x10')]),_0xe427('0x66'),{'uri':_0x2080c5});})['catch'](function(_0x5f2099){logger[_0xe427('0x68')](_0xe427('0x6b'),JSON[_0xe427('0x20')](_0x5f2099));});};exports[_0xe427('0x73')]=function(_0x21efb5,_0x16c899,_0x152f27,_0x3665c3,_0x58d38c,_0x50dae7){var _0x96509,_0x28a227,_0x644171,_0x4a3853;_0x50dae7[_0xe427('0x51')]=intUtil[_0xe427('0x52')](_0x50dae7[_0xe427('0x51')]);_0x50dae7['serverUrl']=intUtil[_0xe427('0x52')](_0x50dae7['serverUrl']);def['uri']=util[_0xe427('0x22')](_0xe427('0x55'),_0x50dae7[_0xe427('0x51')]);if(_0x58d38c&&_0x58d38c['monitor_format']){logger['info']('['+_0x16c899['lastevent'][_0xe427('0x74')]()+']',_0xe427('0x56'));_0x16c899[_0xe427('0x59')]=util['format'](_0xe427('0x57'),_0x50dae7[_0xe427('0x53')],_0x16c899[_0xe427('0x58')],md5(_0x16c899[_0xe427('0x58')]));}else{_0x16c899[_0xe427('0x59')]='';}return getConnection(_0x50dae7)[_0xe427('0x2a')](function(_0x4a028a){_0x4a3853=_0x4a028a;if(!_[_0xe427('0x26')](_0x3665c3)){return getUser(_0x50dae7,_0x3665c3[_0xe427('0x10')],_0x4a3853);}else{return getUser(_0x50dae7,null,_0x4a3853);}})[_0xe427('0x2a')](function(_0x34f402){_0x96509=_0x34f402;logger['info']('The\x20User\x20ID\x20is:',_0x96509['id']);return getEndUser(_0x50dae7,_0x16c899[_0xe427('0x5a')],_0x16c899['calleridnum'],_0x4a3853);})[_0xe427('0x2a')](function(_0x371263){_0x28a227=_0x371263;logger['info'](_0xe427('0x6f'),_0x28a227['id']);return getTicket(_0x50dae7,_0x96509,_0x28a227,_0x152f27,_0x16c899,_0x152f27['Fields'],_0x4a3853,'Inbound');})[_0xe427('0x2a')](function(_0x304f2b){_0x644171=_0x304f2b;logger[_0xe427('0xe')](_0xe427('0x5e'));logger[_0xe427('0xe')](_0xe427('0x70'),_0x644171['id']);return setRelationship(_0x4a3853,_0x96509,_0x644171,_0xe427('0x5f'));})['then'](function(){return setRelationship(_0x4a3853,_0x28a227,_0x644171,_0xe427('0x60'));})[_0xe427('0x2a')](function(){return getServerInfo(_0x4a3853);})[_0xe427('0x67')](function(_0x3e625f){logger[_0xe427('0x68')]('['+_0x16c899[_0xe427('0x75')][_0xe427('0x74')]()+']',JSON[_0xe427('0x20')](_0x3e625f));});}; \ No newline at end of file +var _0x3156=['slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','push','idField','set_entry','JSON','stringify','Calls','format','apiKey','base64','get_server_info','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','find','entry_list','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','forEach','type','string','nameField','toLowerCase','toString','custom_fields','content','variable','variableName','customField','customVariable','Variable','login','username','password','PLAIN','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Outbound','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','sugarcrm','defaults','redis','localhost','socket.io-emitter','POST','info','name','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString'];(function(_0x448f9a,_0xc4f46){var _0x1ff030=function(_0x1b80da){while(--_0x1b80da){_0x448f9a['push'](_0x448f9a['shift']());}};_0x1ff030(++_0xc4f46);}(_0x3156,0xe1));var _0x6315=function(_0x2aa431,_0x4a6c7a){_0x2aa431=_0x2aa431-0x0;var _0x1e1434=_0x3156[_0x2aa431];return _0x1e1434;};'use strict';var _=require(_0x6315('0x0'));var rp=require(_0x6315('0x1'));var BPromise=require(_0x6315('0x2'));var md5=require(_0x6315('0x3'));var util=require(_0x6315('0x4'));var Redis=require(_0x6315('0x5'));var intUtil=require(_0x6315('0x6'));var config=require('../../../../config/environment');var logger=require(_0x6315('0x7'))(_0x6315('0x8'));config['redis']=_[_0x6315('0x9')](config[_0x6315('0xa')],{'host':_0x6315('0xb'),'port':0x18eb});var io=require(_0x6315('0xc'))(new Redis(config[_0x6315('0xa')]));var def={'method':_0x6315('0xd'),'json':!![]};function emit(_0x3f4543,_0x408fb1,_0x44df0f){io['to'](_0x3f4543)['emit'](_0x408fb1,_0x44df0f);}function getTicket(_0x59964c,_0x429e0e,_0xb1b76,_0x1c753e,_0x418efd,_0x3d0f37,_0x297711,_0x3cbe01){logger[_0x6315('0xe')]('Creating\x20new\x20ticket...');var _0x5785ae=new Date();var _0x3b128d=[{'name':_0x6315('0xf'),'value':intUtil[_0x6315('0x10')](_0x1c753e[_0x6315('0x11')],_0x418efd,'\x20')},{'name':_0x6315('0x12'),'value':_0x429e0e['id']},{'name':_0x6315('0x13'),'value':_0x429e0e['id']},{'name':_0x6315('0x14'),'value':intUtil[_0x6315('0x10')](_0x1c753e['Descriptions'],_0x418efd,'\x0a')},{'name':_0x6315('0x15'),'value':_0x5785ae[_0x6315('0x16')]()[_0x6315('0x17')](0x0,0x13)[_0x6315('0x18')]('T','\x20')},{'name':_0x6315('0x19'),'value':'0'},{'name':_0x6315('0x1a'),'value':'15'},{'name':_0x6315('0x1b'),'value':_0xb1b76['id']},{'name':_0x6315('0x1c'),'value':_0x6315('0x1d')},{'name':_0x6315('0x1e'),'value':_0xb1b76[_0x6315('0xf')]},{'name':_0x6315('0x1f'),'value':_0x3cbe01}];if(_0x3d0f37[_0x6315('0x20')]){_['forEach'](_0x3d0f37,function(_0x35936e){if(_0x418efd[_0x35936e['variableName']]){_0x3b128d[_0x6315('0x21')]({'name':_0x35936e[_0x6315('0x22')],'value':_0x418efd[_0x35936e['variableName']]});}});}return request({'form':{'method':_0x6315('0x23'),'input_type':_0x6315('0x24'),'response_type':_0x6315('0x24'),'rest_data':JSON[_0x6315('0x25')]({'session':_0x297711['id'],'module_name':_0x6315('0x26'),'name_value_list':_0x3b128d})}});}function getAuth(_0x2187e3){return util[_0x6315('0x27')]('Basic\x20%s',new Buffer(_0x2187e3[_0x6315('0x28')]+':X')['toString'](_0x6315('0x29')));}function getServerInfo(_0x39e61d){return request({'form':{'method':_0x6315('0x2a'),'input_type':_0x6315('0x24'),'response_type':_0x6315('0x24'),'rest_data':JSON[_0x6315('0x25')]({'session':_0x39e61d['id']})}});}function getUser(_0x587419,_0x1e6867,_0x2e8efe){if(!_[_0x6315('0x2b')](_0x1e6867)){logger[_0x6315('0xe')]('Getting\x20agent\x20with\x20name',_0x1e6867);return request({'form':{'method':_0x6315('0x2c'),'input_type':'JSON','response_type':_0x6315('0x24'),'rest_data':JSON[_0x6315('0x25')]({'session':_0x2e8efe['id'],'module_name':_0x6315('0x2d'),'query':util[_0x6315('0x27')](_0x6315('0x2e'),_0x1e6867),'order_by':'','offset':'0','select_fields':['id',_0x6315('0xf'),_0x6315('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x17aeb4){if(_0x17aeb4['entry_list']['length']){var _0x1605e8=_[_0x6315('0x30')](_0x17aeb4[_0x6315('0x31')],function(_0x3ad5c5){return _0x3ad5c5['name_value_list'][_0x6315('0x2f')][_0x6315('0x32')]===_0x1e6867;});if(_0x1605e8){logger[_0x6315('0xe')](_0x6315('0x33'));return BPromise[_0x6315('0x34')]({'id':_0x1605e8[_0x6315('0x35')]['id']['value'],'name':_0x1605e8[_0x6315('0x35')][_0x6315('0xf')][_0x6315('0x32')]});}}logger['info'](_0x6315('0x36'));return BPromise[_0x6315('0x34')]({'id':_0x2e8efe[_0x6315('0x35')][_0x6315('0x37')][_0x6315('0x32')],'name':_0x2e8efe[_0x6315('0x35')][_0x6315('0x2f')][_0x6315('0x32')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x6315('0x34')]({'id':_0x2e8efe['name_value_list'][_0x6315('0x37')][_0x6315('0x32')],'name':_0x2e8efe['name_value_list'][_0x6315('0x2f')][_0x6315('0x32')]});}}function getEndUser(_0x5167c6,_0x227112,_0x2dbe54,_0x5b094c){logger[_0x6315('0xe')](_0x6315('0x38'),_0x2dbe54);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x6315('0x24'),'rest_data':JSON[_0x6315('0x25')]({'session':_0x5b094c['id'],'module_name':_0x6315('0x1d'),'query':util[_0x6315('0x27')](_0x6315('0x39'),_0x2dbe54),'order_by':'','offset':'0','select_fields':['id',_0x6315('0xf'),_0x6315('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6315('0x3b')](function(_0x3f70bf){if(_0x3f70bf['entry_list'][_0x6315('0x20')]){var _0x16b463=_['find'](_0x3f70bf[_0x6315('0x31')],function(_0x23c6e2){return _0x23c6e2[_0x6315('0x35')][_0x6315('0x3a')][_0x6315('0x32')]===_0x2dbe54;});if(_0x16b463){logger[_0x6315('0xe')](_0x6315('0x3c'));return BPromise['resolve']({'id':_0x16b463[_0x6315('0x35')]['id'][_0x6315('0x32')],'name':_0x16b463[_0x6315('0x35')][_0x6315('0xf')]['value'],'phone':_0x16b463['name_value_list'][_0x6315('0x3a')][_0x6315('0x32')]});}}else{logger[_0x6315('0xe')](_0x6315('0x3d'));return request({'form':{'method':'set_entry','input_type':_0x6315('0x24'),'response_type':_0x6315('0x24'),'rest_data':JSON[_0x6315('0x25')]({'session':_0x5b094c['id'],'module_name':_0x6315('0x1d'),'name_value_list':[{'name':_0x6315('0x3e'),'value':_0x227112!==_0x6315('0x3f')?_0x227112:util['format'](_0x6315('0x40'),_0x2dbe54)},{'name':_0x6315('0x3a'),'value':_0x2dbe54}]})}})[_0x6315('0x3b')](function(_0x4767da){logger[_0x6315('0xe')](_0x6315('0x41'));return BPromise[_0x6315('0x34')]({'id':_0x4767da['id'],'name':_0x4767da[_0x6315('0x31')][_0x6315('0x3e')][_0x6315('0x32')],'phone':_0x4767da[_0x6315('0x31')][_0x6315('0x3a')][_0x6315('0x32')]});});}});}function request(_0x109ccd){logger[_0x6315('0x42')](_0x6315('0x43'),JSON[_0x6315('0x25')](_0x109ccd));return rp(_['merge'](def,_0x109ccd));}function getTags(_0x5b9d17,_0x286761){var _0x20a38e=[];if(_0x5b9d17&&_0x5b9d17['length']>0x0){_0x20a38e=_['map'](_0x5b9d17,_0x286761);}return _0x20a38e;}function getCustomFields(_0x4df165,_0x51b47b){var _0x50dd24=[];var _0xc7d335={'custom_fields':[]};if(_0x4df165[_0x6315('0x20')]>0x0){_[_0x6315('0x44')](_0x4df165,function(_0x1c004d){if(_0x1c004d[_0x6315('0x45')]===_0x6315('0x46')&&_0x1c004d[_0x6315('0x47')]&&!_0x1c004d['customField']){_0xc7d335[_0x1c004d['nameField'][_0x6315('0x48')]()]=_0x1c004d['content'][_0x6315('0x49')]();}else if(_0x1c004d[_0x6315('0x45')]===_0x6315('0x46')&&_0x1c004d[_0x6315('0x22')]&&_0x1c004d['customField']){_0xc7d335[_0x6315('0x4a')]['push']({'id':_0x1c004d['idField'],'value':_0x1c004d[_0x6315('0x4b')][_0x6315('0x49')]()});}else if(_0x1c004d['type']===_0x6315('0x4c')&&_0x1c004d[_0x6315('0x4d')]&&_0x1c004d['idField']&&_0x1c004d[_0x6315('0x4e')]){_0x51b47b[_0x1c004d[_0x6315('0x4d')]]&&_0xc7d335[_0x6315('0x4a')][_0x6315('0x21')]({'id':_0x1c004d['idField'],'value':_0x51b47b[_0x1c004d[_0x6315('0x4d')]][_0x6315('0x49')]()});}else if(_0x1c004d['type']===_0x6315('0x4f')&&_0x1c004d[_0x6315('0x50')]&&_0x1c004d['Variable'][_0x6315('0xf')]&&_0x1c004d[_0x6315('0x22')]&&_0x1c004d[_0x6315('0x4e')]){_0x51b47b[_0x1c004d[_0x6315('0x50')][_0x6315('0xf')][_0x6315('0x48')]()]&&_0xc7d335[_0x6315('0x4a')][_0x6315('0x21')]({'id':_0x1c004d[_0x6315('0x22')],'value':_0x51b47b[_0x1c004d[_0x6315('0x50')][_0x6315('0xf')][_0x6315('0x48')]()][_0x6315('0x49')]()});}});}return _0xc7d335;}function getConnection(_0x319a8d){return request({'method':_0x6315('0xd'),'form':{'method':_0x6315('0x51'),'input_type':_0x6315('0x24'),'response_type':_0x6315('0x24'),'rest_data':JSON[_0x6315('0x25')]({'user_auth':{'user_name':_0x319a8d[_0x6315('0x52')],'password':_0x319a8d[_0x6315('0x53')],'encryption':_0x6315('0x54')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x6315('0x3b')](function(_0xf0419d){var _0x493bba=_0xf0419d;if(_0x493bba['id']){def['sessionID']=_0x493bba['id'];return BPromise[_0x6315('0x34')](_0x493bba);}else{throw new Error(util[_0x6315('0x27')]('Account\x20%d\x20is\x20not\x20valid',_0x319a8d['id']));}});}function setRelationship(_0x86d15a,_0x29db2b,_0x1530a5,_0x436a84){return request({'form':{'method':_0x6315('0x55'),'input_type':'JSON','response_type':_0x6315('0x24'),'rest_data':JSON[_0x6315('0x25')]({'session':_0x86d15a['id'],'module_name':_0x6315('0x26'),'module_id':_0x1530a5['id'],'link_field_name':_0x436a84,'related_ids':[_0x29db2b['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x6315('0x56')]=function(_0x2dbd84,_0x27b122,_0x409b26,_0x19fb6b,_0x103cb0,_0x2e58e2){var _0x42d32f,_0x491d88,_0x427df3,_0x42955;_0x2e58e2[_0x6315('0x57')]=intUtil[_0x6315('0x58')](_0x2e58e2[_0x6315('0x57')]);_0x2e58e2[_0x6315('0x59')]=intUtil[_0x6315('0x58')](_0x2e58e2[_0x6315('0x59')]);def[_0x6315('0x5a')]=util[_0x6315('0x27')](_0x6315('0x5b'),_0x2e58e2[_0x6315('0x57')]);if(_0x103cb0&&_0x103cb0['monitor_format']){logger[_0x6315('0xe')](_0x6315('0x5c'),_0x6315('0x5d'));_0x27b122['recordingURL']=util[_0x6315('0x27')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2e58e2[_0x6315('0x59')],_0x27b122[_0x6315('0x5e')],md5(_0x27b122[_0x6315('0x5e')]));}else{_0x27b122[_0x6315('0x5f')]='';}return getConnection(_0x2e58e2)['then'](function(_0x2d6f89){_0x42955=_0x2d6f89;return getUser(_0x2e58e2,_0x19fb6b['name'],_0x42955);})[_0x6315('0x3b')](function(_0x3e12e4){_0x42d32f=_0x3e12e4;logger[_0x6315('0xe')](_0x6315('0x60'),_0x42d32f['id']);return getEndUser(_0x2e58e2,_0x27b122[_0x6315('0x61')],_0x27b122[_0x6315('0x62')],_0x42955);})[_0x6315('0x3b')](function(_0x33a263){_0x491d88=_0x33a263;logger['info'](_0x6315('0x63'),_0x491d88['id']);return getTicket(_0x2e58e2,_0x42d32f,_0x491d88,_0x409b26,_0x27b122,_0x409b26[_0x6315('0x64')],_0x42955,_0x6315('0x65'));})[_0x6315('0x3b')](function(_0x46414f){_0x427df3=_0x46414f;logger['info'](_0x6315('0x66'));logger[_0x6315('0xe')](_0x6315('0x67'),_0x427df3['id']);return setRelationship(_0x42955,_0x42d32f,_0x427df3,_0x6315('0x68'));})['then'](function(){return setRelationship(_0x42955,_0x491d88,_0x427df3,_0x6315('0x69'));})[_0x6315('0x3b')](function(){return getServerInfo(_0x42955);})[_0x6315('0x3b')](function(_0x930cdb){var _0x3c7e1c=parseInt(_0x930cdb[_0x6315('0x6a')][_0x6315('0x6b')](0x0));var _0x4b92d4=util['format'](_0x6315('0x6c'),_0x2e58e2['remoteUri'],_0x427df3['id']);if(_0x3c7e1c>0x6){_0x4b92d4=util[_0x6315('0x27')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x2e58e2[_0x6315('0x57')],_0x427df3['id']);}logger[_0x6315('0xe')](_0x6315('0x5c'),_0x6315('0x6d'));emit(util['format'](_0x6315('0x6e'),_0x19fb6b[_0x6315('0xf')]),_0x6315('0x6f'),{'uri':_0x4b92d4});})[_0x6315('0x70')](function(_0xcbdb23){logger[_0x6315('0x71')]('[QUEUE]',JSON[_0x6315('0x25')](_0xcbdb23));});};exports['outbound']=function(_0x52c166,_0xe7a411,_0x142c9f,_0x4faf43,_0x426d92,_0x3f4b0f,_0x2124d9){var _0xe58fc6,_0x283d11,_0x2c1179,_0x14a52a;_0x3f4b0f[_0x6315('0x57')]=intUtil[_0x6315('0x58')](_0x3f4b0f[_0x6315('0x57')]);_0x3f4b0f['serverUrl']=intUtil['stripTrailingSlash'](_0x3f4b0f[_0x6315('0x59')]);def[_0x6315('0x5a')]=util[_0x6315('0x27')](_0x6315('0x5b'),_0x3f4b0f['remoteUri']);if(_0x2124d9&&_0x2124d9[_0x6315('0x72')]&&_0x2124d9['recordingFormat']!==_0x6315('0x73')){logger[_0x6315('0xe')](_0x6315('0x74'),'Recording\x20is\x20enabled!');_0xe7a411[_0x6315('0x5f')]=util[_0x6315('0x27')](_0x6315('0x75'),_0x3f4b0f['serverUrl'],_0xe7a411[_0x6315('0x5e')],md5(_0xe7a411[_0x6315('0x5e')]));}return getConnection(_0x3f4b0f)[_0x6315('0x3b')](function(_0x3ee929){_0x14a52a=_0x3ee929;return getUser(_0x3f4b0f,_0x4faf43[_0x6315('0xf')],_0x14a52a);})[_0x6315('0x3b')](function(_0x39ec77){_0xe58fc6=_0x39ec77;logger[_0x6315('0xe')](_0x6315('0x60'),_0xe58fc6['id']);return getEndUser(_0x3f4b0f,_0xe7a411['destcalleridname'],_0xe7a411[_0x6315('0x76')],_0x14a52a);})[_0x6315('0x3b')](function(_0x395e99){_0x283d11=_0x395e99;logger[_0x6315('0xe')]('The\x20Enduser\x20ID\x20is:',_0x283d11['id']);return getTicket(_0x3f4b0f,_0xe58fc6,_0x283d11,_0x142c9f,_0xe7a411,_0x142c9f['Fields'],_0x14a52a,_0x6315('0x77'));})[_0x6315('0x3b')](function(_0x4de8f4){_0x2c1179=_0x4de8f4;logger['info'](_0x6315('0x66'));logger[_0x6315('0xe')](_0x6315('0x67'),_0x2c1179['id']);return setRelationship(_0x14a52a,_0xe58fc6,_0x2c1179,'users');})['then'](function(){return setRelationship(_0x14a52a,_0x283d11,_0x2c1179,_0x6315('0x69'));})['then'](function(){return getServerInfo(_0x14a52a);})[_0x6315('0x3b')](function(_0x56f1af){var _0xbc8d6a=parseInt(_0x56f1af[_0x6315('0x6a')][_0x6315('0x6b')](0x0));var _0x93bd3a=util[_0x6315('0x27')](_0x6315('0x6c'),_0x3f4b0f[_0x6315('0x57')],_0x2c1179['id']);if(_0xbc8d6a>0x6){_0x93bd3a=util[_0x6315('0x27')](_0x6315('0x78'),_0x3f4b0f['remoteUri'],_0x2c1179['id']);}logger['info'](_0x6315('0x74'),_0x6315('0x6d'));emit(util[_0x6315('0x27')](_0x6315('0x6e'),_0x4faf43['name']),_0x6315('0x6f'),{'uri':_0x93bd3a});})[_0x6315('0x70')](function(_0x5e856b){logger[_0x6315('0x71')](_0x6315('0x74'),JSON[_0x6315('0x25')](_0x5e856b));});};exports[_0x6315('0x79')]=function(_0x1eeaa4,_0x3dead0,_0x590d44,_0x58fe98,_0x36ef98,_0xd34bf7){var _0x159c0c,_0x53c7b1,_0x447a64,_0x122933;_0xd34bf7[_0x6315('0x57')]=intUtil[_0x6315('0x58')](_0xd34bf7[_0x6315('0x57')]);_0xd34bf7[_0x6315('0x59')]=intUtil[_0x6315('0x58')](_0xd34bf7[_0x6315('0x59')]);def[_0x6315('0x5a')]=util[_0x6315('0x27')]('%s/service/v4_1/rest.php',_0xd34bf7[_0x6315('0x57')]);if(_0x36ef98&&_0x36ef98['monitor_format']){logger[_0x6315('0xe')]('['+_0x3dead0[_0x6315('0x7a')][_0x6315('0x7b')]()+']',_0x6315('0x5d'));_0x3dead0['recordingURL']=util[_0x6315('0x27')](_0x6315('0x75'),_0xd34bf7['serverUrl'],_0x3dead0[_0x6315('0x5e')],md5(_0x3dead0['uniqueid']));}else{_0x3dead0[_0x6315('0x5f')]='';}return getConnection(_0xd34bf7)['then'](function(_0x36488b){_0x122933=_0x36488b;if(!_[_0x6315('0x2b')](_0x58fe98)){return getUser(_0xd34bf7,_0x58fe98[_0x6315('0xf')],_0x122933);}else{return getUser(_0xd34bf7,null,_0x122933);}})[_0x6315('0x3b')](function(_0x3de254){_0x159c0c=_0x3de254;logger[_0x6315('0xe')](_0x6315('0x60'),_0x159c0c['id']);return getEndUser(_0xd34bf7,_0x3dead0[_0x6315('0x61')],_0x3dead0[_0x6315('0x62')],_0x122933);})['then'](function(_0x53e285){_0x53c7b1=_0x53e285;logger[_0x6315('0xe')](_0x6315('0x63'),_0x53c7b1['id']);return getTicket(_0xd34bf7,_0x159c0c,_0x53c7b1,_0x590d44,_0x3dead0,_0x590d44['Fields'],_0x122933,'Inbound');})[_0x6315('0x3b')](function(_0x50cfc6){_0x447a64=_0x50cfc6;logger[_0x6315('0xe')](_0x6315('0x66'));logger['info'](_0x6315('0x67'),_0x447a64['id']);return setRelationship(_0x122933,_0x159c0c,_0x447a64,_0x6315('0x68'));})['then'](function(){return setRelationship(_0x122933,_0x53c7b1,_0x447a64,_0x6315('0x69'));})[_0x6315('0x3b')](function(){return getServerInfo(_0x122933);})[_0x6315('0x70')](function(_0x106f12){logger['error']('['+_0x3dead0[_0x6315('0x7a')][_0x6315('0x7b')]()+']',JSON['stringify'](_0x106f12));});}; \ 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 f4a3e20..23e7a44 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 _0xee3c=['content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','key','format','%s:\x20%s','keyContent','join','slice','substring','lastIndexOf','validateEmail','test','util','length','type','string','push'];(function(_0x4da48b,_0x464df7){var _0x57f7df=function(_0x11746c){while(--_0x11746c){_0x4da48b['push'](_0x4da48b['shift']());}};_0x57f7df(++_0x464df7);}(_0xee3c,0x1f3));var _0xcee3=function(_0x1baaa0,_0x3effcc){_0x1baaa0=_0x1baaa0-0x0;var _0x1d63bd=_0xee3c[_0x1baaa0];return _0x1d63bd;};'use strict';var _=require('lodash');var util=require(_0xcee3('0x0'));exports['getString']=function(_0x3d8a64,_0x5d37f3,_0x48721b){var _0x2b98e4=[];if(_0x3d8a64[_0xcee3('0x1')]>0x0){var _0x506fa1=_['sortBy'](_0x3d8a64,['id']);for(var _0x2dfff3=0x0;_0x2dfff3<_0x506fa1['length'];_0x2dfff3++){var _0x2e577f=_0x506fa1[_0x2dfff3];if(_0x2e577f[_0xcee3('0x2')]===_0xcee3('0x3')){_0x2b98e4[_0xcee3('0x4')](_0x2e577f[_0xcee3('0x5')]);}else if(_0x2e577f[_0xcee3('0x2')]===_0xcee3('0x6')&&_0x2e577f['variableName']){_0x5d37f3[_0x2e577f[_0xcee3('0x7')]]&&_0x2b98e4[_0xcee3('0x4')](_0x5d37f3[_0x2e577f[_0xcee3('0x7')]][_0xcee3('0x8')]());}else if(_0x2e577f[_0xcee3('0x2')]===_0xcee3('0x9')&&_0x2e577f[_0xcee3('0xa')]&&_0x2e577f[_0xcee3('0xa')][_0xcee3('0xb')]){_0x5d37f3[_0x2e577f[_0xcee3('0xa')][_0xcee3('0xb')][_0xcee3('0xc')]()]&&_0x2b98e4['push'](_0x5d37f3[_0x2e577f['Variable'][_0xcee3('0xb')]['toLowerCase']()][_0xcee3('0x8')]());}else if(_0x2e577f['type']===_0xcee3('0xd')){if(_0x2e577f['keyType']==='string'&&_0x2e577f[_0xcee3('0xe')]){_0x2b98e4[_0xcee3('0x4')](util[_0xcee3('0xf')](_0xcee3('0x10'),_0x2e577f[_0xcee3('0xe')],_0x2e577f[_0xcee3('0x11')]));}else if(_0x2e577f['keyType']===_0xcee3('0x6')&&_0x2e577f[_0xcee3('0x7')]&&_0x2e577f[_0xcee3('0xe')]){_0x5d37f3[_0x2e577f[_0xcee3('0x7')]]&&_0x2b98e4[_0xcee3('0x4')](util[_0xcee3('0xf')]('%s:\x20%s',_0x2e577f[_0xcee3('0xe')],_0x5d37f3[_0x2e577f[_0xcee3('0x7')]]));}else if(_0x2e577f['keyType']===_0xcee3('0x9')&&_0x2e577f[_0xcee3('0xa')]&&_0x2e577f[_0xcee3('0xa')][_0xcee3('0xb')]&&_0x2e577f['key']){_0x5d37f3[_0x2e577f[_0xcee3('0xa')]['name'][_0xcee3('0xc')]()]&&_0x2b98e4['push'](util['format'](_0xcee3('0x10'),_0x2e577f[_0xcee3('0xe')],_0x5d37f3[_0x2e577f[_0xcee3('0xa')]['name'][_0xcee3('0xc')]()]));}}}}return _0x2b98e4[_0xcee3('0x12')](_0x48721b);};exports['stripTrailingSlash']=function(_0x5af604){var _0x34fca1=_0x5af604[_0xcee3('0x13')](-0x1);if(_0x34fca1==='/'){_0x5af604=_0x5af604[_0xcee3('0x14')](0x0,_0x5af604[_0xcee3('0x15')](_0x34fca1));}return _0x5af604;};exports[_0xcee3('0x16')]=function(_0x58f42b){if(!_['isNil'](_0x58f42b)&&_0x58f42b!==''){var _0x2dfcfe=/^(([^<>()\[\]\\.,;:\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 _0x2dfcfe[_0xcee3('0x17')](String(_0x58f42b)[_0xcee3('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x1c8d=['test','lodash','util','getString','length','sortBy','type','string','push','content','variableName','customVariable','Variable','name','toLowerCase','toString','keyType','key','format','%s:\x20%s','keyContent','variable','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil'];(function(_0x7f675c,_0x78ba29){var _0x580a60=function(_0x23ae10){while(--_0x23ae10){_0x7f675c['push'](_0x7f675c['shift']());}};_0x580a60(++_0x78ba29);}(_0x1c8d,0x16d));var _0xd1c8=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x1c8d[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xd1c8('0x0'));var util=require(_0xd1c8('0x1'));exports[_0xd1c8('0x2')]=function(_0xf90edd,_0x559296,_0x27b5ce){var _0x3d4e3a=[];if(_0xf90edd[_0xd1c8('0x3')]>0x0){var _0x178fc2=_[_0xd1c8('0x4')](_0xf90edd,['id']);for(var _0x17055e=0x0;_0x17055e<_0x178fc2[_0xd1c8('0x3')];_0x17055e++){var _0x32c486=_0x178fc2[_0x17055e];if(_0x32c486[_0xd1c8('0x5')]===_0xd1c8('0x6')){_0x3d4e3a[_0xd1c8('0x7')](_0x32c486[_0xd1c8('0x8')]);}else if(_0x32c486[_0xd1c8('0x5')]==='variable'&&_0x32c486['variableName']){_0x559296[_0x32c486[_0xd1c8('0x9')]]&&_0x3d4e3a['push'](_0x559296[_0x32c486[_0xd1c8('0x9')]]['toString']());}else if(_0x32c486[_0xd1c8('0x5')]===_0xd1c8('0xa')&&_0x32c486[_0xd1c8('0xb')]&&_0x32c486['Variable'][_0xd1c8('0xc')]){_0x559296[_0x32c486[_0xd1c8('0xb')]['name'][_0xd1c8('0xd')]()]&&_0x3d4e3a[_0xd1c8('0x7')](_0x559296[_0x32c486[_0xd1c8('0xb')][_0xd1c8('0xc')][_0xd1c8('0xd')]()][_0xd1c8('0xe')]());}else if(_0x32c486[_0xd1c8('0x5')]==='keyValue'){if(_0x32c486[_0xd1c8('0xf')]===_0xd1c8('0x6')&&_0x32c486[_0xd1c8('0x10')]){_0x3d4e3a[_0xd1c8('0x7')](util[_0xd1c8('0x11')](_0xd1c8('0x12'),_0x32c486[_0xd1c8('0x10')],_0x32c486[_0xd1c8('0x13')]));}else if(_0x32c486[_0xd1c8('0xf')]===_0xd1c8('0x14')&&_0x32c486[_0xd1c8('0x9')]&&_0x32c486[_0xd1c8('0x10')]){_0x559296[_0x32c486[_0xd1c8('0x9')]]&&_0x3d4e3a[_0xd1c8('0x7')](util['format'](_0xd1c8('0x12'),_0x32c486['key'],_0x559296[_0x32c486['variableName']]));}else if(_0x32c486[_0xd1c8('0xf')]===_0xd1c8('0xa')&&_0x32c486[_0xd1c8('0xb')]&&_0x32c486['Variable'][_0xd1c8('0xc')]&&_0x32c486[_0xd1c8('0x10')]){_0x559296[_0x32c486[_0xd1c8('0xb')][_0xd1c8('0xc')][_0xd1c8('0xd')]()]&&_0x3d4e3a[_0xd1c8('0x7')](util[_0xd1c8('0x11')](_0xd1c8('0x12'),_0x32c486[_0xd1c8('0x10')],_0x559296[_0x32c486['Variable'][_0xd1c8('0xc')][_0xd1c8('0xd')]()]));}}}}return _0x3d4e3a[_0xd1c8('0x15')](_0x27b5ce);};exports[_0xd1c8('0x16')]=function(_0x44885d){var _0x115342=_0x44885d['slice'](-0x1);if(_0x115342==='/'){_0x44885d=_0x44885d[_0xd1c8('0x17')](0x0,_0x44885d[_0xd1c8('0x18')](_0x115342));}return _0x44885d;};exports[_0xd1c8('0x19')]=function(_0x3a4618){if(!_[_0xd1c8('0x1a')](_0x3a4618)&&_0x3a4618!==''){var _0x55eaef=/^(([^<>()\[\]\\.,;:\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 _0x55eaef[_0xd1c8('0x1b')](String(_0x3a4618)[_0xd1c8('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index aaa2bd5..a0df2a6 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x3f0cb4,_0x49ec71){var _0x5f33b0=function(_0x13b753){while(--_0x13b753){_0x3f0cb4['push'](_0x3f0cb4['shift']());}};_0x5f33b0(++_0x49ec71);}(_0xe706,0xa3));var _0x6e70=function(_0x191c44,_0x20a896){_0x191c44=_0x191c44-0x0;var _0x1086cd=_0xe706[_0x191c44];return _0x1086cd;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x3579a9,_0x4728cb){var _0x9a342b=function(_0x55dd07){while(--_0x55dd07){_0x3579a9['push'](_0x3579a9['shift']());}};_0x9a342b(++_0x4728cb);}(_0xe706,0xa3));var _0x6e70=function(_0x2a5bb7,_0x3a0bf3){_0x2a5bb7=_0x2a5bb7-0x0;var _0x503330=_0xe706[_0x2a5bb7];return _0x503330;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 9af0df0..d351931 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 _0x3a6a=['md5','util','ioredis','./util','../../../../config/environment','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','remoteUri','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','toString','base64','map','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','content','idField','variable','variableName','custom_fields','customVariable','Variable','push','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','newTab','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash'];(function(_0x372e08,_0x4e809c){var _0x13984b=function(_0x2360db){while(--_0x2360db){_0x372e08['push'](_0x372e08['shift']());}};_0x13984b(++_0x4e809c);}(_0x3a6a,0xe5));var _0xa3a6=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0x3a6a[_0x120376];return _0x28c529;};'use strict';var _=require(_0xa3a6('0x0'));var rp=require('request-promise');var md5=require(_0xa3a6('0x1'));var util=require(_0xa3a6('0x2'));var Redis=require(_0xa3a6('0x3'));var intUtil=require(_0xa3a6('0x4'));var config=require(_0xa3a6('0x5'));var logger=require('../../../../config/logger')(_0xa3a6('0x6'));config[_0xa3a6('0x7')]=_[_0xa3a6('0x8')](config[_0xa3a6('0x7')],{'host':_0xa3a6('0x9'),'port':0x18eb});var io=require(_0xa3a6('0xa'))(new Redis(config['redis']));function emit(_0x475d60,_0x38ab7a,_0x5bdc51){io['to'](_0x475d60)[_0xa3a6('0xb')](_0x38ab7a,_0x5bdc51);}var headers={'Content-Type':'application/json','Accept':_0xa3a6('0xc')};function getTicket(_0x553f60,_0x146074,_0x32f5cd,_0x2df754,_0x16d92e){logger[_0xa3a6('0xd')](_0xa3a6('0xe'));return request({'uri':util['format']('%s/tickets.json',_0x553f60['remoteUri']),'method':_0xa3a6('0xf'),'body':{'ticket':_[_0xa3a6('0x10')]({'requester_id':_0x32f5cd['id'],'submitter_id':_0x146074?_0x146074['id']:undefined,'assignee_id':_0x146074?_0x146074['id']:undefined,'tags':getTags(_0x2df754[_0xa3a6('0x11')],_0xa3a6('0x12')),'subject':intUtil[_0xa3a6('0x13')](_0x2df754[_0xa3a6('0x14')],_0x16d92e,'\x20'),'description':intUtil[_0xa3a6('0x13')](_0x2df754[_0xa3a6('0x15')],_0x16d92e,'\x0a'),'comment':{'public':![],'body':intUtil[_0xa3a6('0x13')](_0x2df754[_0xa3a6('0x15')],_0x16d92e,'\x0a')}},getCustomFields(_0x2df754[_0xa3a6('0x16')],_0x16d92e))}})[_0xa3a6('0x17')](function(_0x244ece){logger[_0xa3a6('0xd')](_0xa3a6('0x18'));return _0x244ece[_0xa3a6('0x19')];});}function getUser(_0x51be4a,_0x1e3371){if(intUtil['validateEmail'](_0x1e3371)){logger[_0xa3a6('0xd')](_0xa3a6('0x1a'),_0x1e3371);return request({'uri':util[_0xa3a6('0x1b')](_0xa3a6('0x1c'),_0x51be4a['remoteUri']),'qs':{'query':util['format'](_0xa3a6('0x1d'),_0x1e3371)}})[_0xa3a6('0x17')](function(_0x4e641c){if(_0x4e641c[_0xa3a6('0x1e')]){logger['info'](_0xa3a6('0x1f'));return _[_0xa3a6('0x20')](_0x4e641c[_0xa3a6('0x21')],{'email':_0x1e3371,'role':_0xa3a6('0x22')});}else{logger['info'](_0xa3a6('0x23'));return request({'uri':util[_0xa3a6('0x1b')](_0xa3a6('0x24'),_0x51be4a[_0xa3a6('0x25')])})[_0xa3a6('0x17')](function(_0x3ea4d6){logger[_0xa3a6('0xd')](_0xa3a6('0x26'));return _0x3ea4d6['user'];});}});}else{logger[_0xa3a6('0xd')](_0xa3a6('0x23'));return request({'uri':util[_0xa3a6('0x1b')](_0xa3a6('0x24'),_0x51be4a[_0xa3a6('0x25')])})[_0xa3a6('0x17')](function(_0x592395){logger[_0xa3a6('0xd')](_0xa3a6('0x26'));return _0x592395[_0xa3a6('0x27')];});}}function getEndUser(_0x4c8706,_0x1d0e4f,_0x3e0d39){logger[_0xa3a6('0xd')](_0xa3a6('0x28'),_0x3e0d39);return request({'uri':util[_0xa3a6('0x1b')](_0xa3a6('0x1c'),_0x4c8706[_0xa3a6('0x25')]),'qs':{'query':util[_0xa3a6('0x1b')](_0xa3a6('0x29'),_0x3e0d39)}})[_0xa3a6('0x17')](function(_0x415b2){var _0x120e5c;if(_0x415b2[_0xa3a6('0x21')][_0xa3a6('0x2a')]){_0x415b2[_0xa3a6('0x21')]=_[_0xa3a6('0x2b')](_0x415b2[_0xa3a6('0x21')],{'suspended':![],'role':'end-user'});if(_0x415b2[_0xa3a6('0x21')][_0xa3a6('0x2a')]){_0x120e5c=_[_0xa3a6('0x2c')](_0x415b2[_0xa3a6('0x21')]);}}if(_0x120e5c){logger[_0xa3a6('0xd')]('Enduser\x20found!');return _0x120e5c;}else{logger['info'](_0xa3a6('0x2d'));return request({'uri':util['format'](_0xa3a6('0x2e'),_0x4c8706[_0xa3a6('0x25')]),'method':_0xa3a6('0xf'),'body':{'user':{'role':_0xa3a6('0x2f'),'name':util[_0xa3a6('0x1b')]('Caller\x20-\x20%s',_0x1d0e4f||_0x3e0d39),'phone':_0x3e0d39}}})['then'](function(_0x2598e8){logger[_0xa3a6('0xd')](_0xa3a6('0x30'));return _0x2598e8[_0xa3a6('0x27')];});}});}function getAuth(_0xdb4789){var _0x5dde34;if(_0xdb4789[_0xa3a6('0x31')]===_0xa3a6('0x32')){_0x5dde34=util[_0xa3a6('0x1b')](_0xa3a6('0x33'),_0xdb4789[_0xa3a6('0x34')],_0xdb4789['password']);}else if(_0xdb4789['authType']===_0xa3a6('0x35')){_0x5dde34=util[_0xa3a6('0x1b')]('%s/token:%s',_0xdb4789[_0xa3a6('0x34')],_0xdb4789[_0xa3a6('0x35')]);}return util[_0xa3a6('0x1b')](_0xa3a6('0x36'),new Buffer(_0x5dde34)[_0xa3a6('0x37')](_0xa3a6('0x38')));}function request(_0x44fcb3){logger['debug']('[HTTP]',JSON['stringify'](_0x44fcb3));return rp(_['defaults'](_0x44fcb3,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x53619c,_0x446be5){var _0x12bcd9=[];if(_0x53619c&&_0x53619c[_0xa3a6('0x2a')]>0x0){_0x12bcd9=_[_0xa3a6('0x39')](_0x53619c,_0x446be5);}return _0x12bcd9;}function getCustomFields(_0x410495,_0x475fa9){var _0x276aec=[];var _0x41a6a4={'custom_fields':[]};if(_0x410495['length']>0x0){_[_0xa3a6('0x3a')](_0x410495,function(_0x1df37a){if(_[_0xa3a6('0x3b')]([_0xa3a6('0x3c'),_0xa3a6('0x3d')],_0x1df37a[_0xa3a6('0x3e')])&&_0x1df37a['nameField']&&!_0x1df37a[_0xa3a6('0x3f')]){_0x41a6a4[_0x1df37a[_0xa3a6('0x40')][_0xa3a6('0x41')]()]=_0x1df37a[_0xa3a6('0x42')]['toString']();}else if(_[_0xa3a6('0x3b')]([_0xa3a6('0x3c'),_0xa3a6('0x3d')],_0x1df37a[_0xa3a6('0x3e')])&&_0x1df37a['idField']&&_0x1df37a[_0xa3a6('0x3f')]){_0x41a6a4['custom_fields']['push']({'id':_0x1df37a[_0xa3a6('0x43')],'value':_0x1df37a['content'][_0xa3a6('0x37')]()});}else if(_0x1df37a[_0xa3a6('0x3e')]===_0xa3a6('0x44')&&_0x1df37a[_0xa3a6('0x45')]&&_0x1df37a[_0xa3a6('0x43')]&&_0x1df37a[_0xa3a6('0x3f')]){_0x475fa9[_0x1df37a['variableName']]&&_0x41a6a4[_0xa3a6('0x46')]['push']({'id':_0x1df37a[_0xa3a6('0x43')],'value':_0x475fa9[_0x1df37a[_0xa3a6('0x45')]][_0xa3a6('0x37')]()});}else if(_0x1df37a[_0xa3a6('0x3e')]===_0xa3a6('0x47')&&_0x1df37a[_0xa3a6('0x48')]&&_0x1df37a[_0xa3a6('0x48')][_0xa3a6('0x12')]&&_0x1df37a[_0xa3a6('0x43')]&&_0x1df37a[_0xa3a6('0x3f')]){_0x475fa9[_0x1df37a[_0xa3a6('0x48')][_0xa3a6('0x12')][_0xa3a6('0x41')]()]&&_0x41a6a4[_0xa3a6('0x46')][_0xa3a6('0x49')]({'id':_0x1df37a[_0xa3a6('0x43')],'value':_0x475fa9[_0x1df37a[_0xa3a6('0x48')][_0xa3a6('0x12')][_0xa3a6('0x41')]()]['toString']()});}});}return _0x41a6a4;}exports[_0xa3a6('0x4a')]=function(_0x55e45d,_0x14d03a,_0x53f03d,_0x1d88f1,_0x5e273a,_0x27ee9b){var _0x31ab70,_0x5f2e8b;_0x27ee9b[_0xa3a6('0x25')]=intUtil[_0xa3a6('0x4b')](_0x27ee9b[_0xa3a6('0x25')]);_0x27ee9b[_0xa3a6('0x4c')]=intUtil[_0xa3a6('0x4b')](_0x27ee9b[_0xa3a6('0x4c')]);if(_0x5e273a&&_0x5e273a[_0xa3a6('0x4d')]){logger[_0xa3a6('0xd')]('[QUEUE]',_0xa3a6('0x4e'));_0x14d03a[_0xa3a6('0x4f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x27ee9b[_0xa3a6('0x4c')],_0x14d03a['uniqueid'],md5(_0x14d03a['uniqueid']));}else{_0x14d03a[_0xa3a6('0x4f')]='';}headers[_0xa3a6('0x50')]=getAuth(_0x27ee9b);return getUser(_0x27ee9b,_0x1d88f1[_0xa3a6('0x51')])[_0xa3a6('0x17')](function(_0x44dd09){_0x31ab70=_0x44dd09;logger['info'](_0xa3a6('0x52'),_0x31ab70['id']);return getEndUser(_0x27ee9b,_0x14d03a['calleridname'],_0x14d03a[_0xa3a6('0x53')]);})['then'](function(_0x3d2034){_0x5f2e8b=_0x3d2034;logger[_0xa3a6('0xd')](_0xa3a6('0x54'),_0x5f2e8b['id']);return getTicket(_0x27ee9b,_0x31ab70,_0x5f2e8b,_0x53f03d,_0x14d03a);})[_0xa3a6('0x17')](function(_0x13cf0d){if(_0x13cf0d){logger[_0xa3a6('0xd')](_0xa3a6('0x55'),_0x13cf0d['id']);switch(_0x27ee9b['type']){case _0xa3a6('0x56'):logger[_0xa3a6('0xd')](_0xa3a6('0x57'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0xa3a6('0x58'),_0x27ee9b[_0xa3a6('0x25')],_0x31ab70['id'],_0x13cf0d['id']),'method':'POST'});case'newTab':logger['info'](_0xa3a6('0x57'),_0xa3a6('0x59'));emit(util['format'](_0xa3a6('0x5a'),_0x1d88f1[_0xa3a6('0x12')]),_0xa3a6('0x5b'),{'uri':util[_0xa3a6('0x1b')](_0xa3a6('0x5c'),_0x27ee9b[_0xa3a6('0x25')][_0xa3a6('0x5d')]('/api/v2',''),_0x13cf0d['id'])});break;default:logger[_0xa3a6('0x5e')](_0xa3a6('0x57'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xa3a6('0x5f')](function(_0xaaf200){logger[_0xa3a6('0x5e')](_0xa3a6('0x60'),util[_0xa3a6('0x61')](_0xaaf200,{'showHidden':!![],'depth':null}));});};exports[_0xa3a6('0x62')]=function(_0x1a3da2,_0x26c060,_0x4df70e,_0x26eaa4,_0x2de078,_0x3517cf,_0xb6463b){var _0x1c1974,_0x38db17;_0x3517cf[_0xa3a6('0x25')]=intUtil[_0xa3a6('0x4b')](_0x3517cf[_0xa3a6('0x25')]);_0x3517cf[_0xa3a6('0x4c')]=intUtil['stripTrailingSlash'](_0x3517cf[_0xa3a6('0x4c')]);if(_0xb6463b&&_0xb6463b[_0xa3a6('0x63')]&&_0xb6463b[_0xa3a6('0x63')]!==_0xa3a6('0x64')){logger[_0xa3a6('0xd')](_0xa3a6('0x65'),_0xa3a6('0x4e'));_0x26c060['recordingURL']=util[_0xa3a6('0x1b')](_0xa3a6('0x66'),_0x3517cf[_0xa3a6('0x4c')],_0x26c060['uniqueid'],md5(_0x26c060[_0xa3a6('0x67')]));}headers[_0xa3a6('0x50')]=getAuth(_0x3517cf);return getUser(_0x3517cf,_0x26eaa4[_0xa3a6('0x51')])['then'](function(_0xf6539d){_0x1c1974=_0xf6539d;logger[_0xa3a6('0xd')](_0xa3a6('0x52'),_0x1c1974['id']);return getEndUser(_0x3517cf,_0x26c060[_0xa3a6('0x68')],_0x26c060[_0xa3a6('0x69')]);})[_0xa3a6('0x17')](function(_0x3e1ef8){_0x38db17=_0x3e1ef8;logger[_0xa3a6('0xd')](_0xa3a6('0x54'),_0x38db17['id']);return getTicket(_0x3517cf,_0x1c1974,_0x38db17,_0x4df70e,_0x26c060);})[_0xa3a6('0x17')](function(_0x10fd2d){if(_0x10fd2d){logger['info'](_0xa3a6('0x55'),_0x10fd2d['id']);switch(_0x3517cf['type']){case _0xa3a6('0x56'):logger[_0xa3a6('0xd')]('[OUTBOUND]',_0xa3a6('0x6a'));return request({'uri':util[_0xa3a6('0x1b')](_0xa3a6('0x58'),_0x3517cf['remoteUri'],_0x1c1974['id'],_0x10fd2d['id']),'method':_0xa3a6('0xf')});case _0xa3a6('0x6b'):logger[_0xa3a6('0xd')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa3a6('0x1b')](_0xa3a6('0x5a'),_0x26eaa4[_0xa3a6('0x12')]),'trigger:browser:url',{'uri':util[_0xa3a6('0x1b')](_0xa3a6('0x5c'),_0x3517cf[_0xa3a6('0x25')][_0xa3a6('0x5d')](_0xa3a6('0x6c'),''),_0x10fd2d['id'])});break;default:logger['error'](_0xa3a6('0x65'),_0xa3a6('0x6d'));}}})[_0xa3a6('0x5f')](function(_0x2ea82e){logger[_0xa3a6('0x5e')](_0xa3a6('0x6e'),util[_0xa3a6('0x61')](_0x2ea82e,{'showHidden':!![],'depth':null}));});};exports[_0xa3a6('0x6f')]=function(_0xe185ba,_0x568fc0,_0xfa77f5,_0x47781e,_0x4b1033,_0xa60d95){var _0x5c5f1c,_0x341fde;_0xa60d95[_0xa3a6('0x25')]=intUtil[_0xa3a6('0x4b')](_0xa60d95['remoteUri']);_0xa60d95['serverUrl']=intUtil[_0xa3a6('0x4b')](_0xa60d95[_0xa3a6('0x4c')]);if(_0x4b1033&&_0x4b1033[_0xa3a6('0x4d')]){logger[_0xa3a6('0xd')]('['+_0x568fc0[_0xa3a6('0x70')]['toUpperCase']()+']',_0xa3a6('0x4e'));_0x568fc0[_0xa3a6('0x4f')]=util[_0xa3a6('0x1b')](_0xa3a6('0x66'),_0xa60d95[_0xa3a6('0x4c')],_0x568fc0['uniqueid'],md5(_0x568fc0[_0xa3a6('0x67')]));}else{_0x568fc0[_0xa3a6('0x4f')]='';}headers[_0xa3a6('0x50')]=getAuth(_0xa60d95);return getUser(_0xa60d95)[_0xa3a6('0x17')](function(_0x1cd154){_0x5c5f1c=_0x1cd154;logger[_0xa3a6('0xd')](_0xa3a6('0x52'),_0x5c5f1c['id']);return getEndUser(_0xa60d95,_0x568fc0['calleridname'],_0x568fc0['calleridnum']);})[_0xa3a6('0x17')](function(_0x316b2a){_0x341fde=_0x316b2a;logger[_0xa3a6('0xd')](_0xa3a6('0x54'),_0x341fde['id']);return getTicket(_0xa60d95,_0x5c5f1c,_0x341fde,_0xfa77f5,_0x568fc0);})[_0xa3a6('0x17')](function(_0x12e00e){if(_0x12e00e){logger[_0xa3a6('0xd')]('The\x20Ticket\x20ID\x20is:',_0x12e00e['id']);}})[_0xa3a6('0x5f')](function(_0x53cb1a){logger[_0xa3a6('0x5e')]('['+_0x568fc0[_0xa3a6('0x70')][_0xa3a6('0x71')]()+']'+_0xa3a6('0x72'),util[_0xa3a6('0x61')](_0x53cb1a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x865f=['variable','variableName','custom_fields','push','Variable','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','Authorization','\x20Error\x20running\x20Zendesk\x20integration','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','Fields','info','Ticket\x20created!','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','then','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','authType','password','%s/token:%s','username','token','Basic\x20%s','toString','debug','[HTTP]','GET','map','forEach','picklist','nameField','customField','toLowerCase','includes','type','idField','content'];(function(_0xf2440f,_0x3c6cdd){var _0x978a96=function(_0x17a593){while(--_0x17a593){_0xf2440f['push'](_0xf2440f['shift']());}};_0x978a96(++_0x3c6cdd);}(_0x865f,0x106));var _0xf865=function(_0x489045,_0x497075){_0x489045=_0x489045-0x0;var _0x20cbab=_0x865f[_0x489045];return _0x20cbab;};'use strict';var _=require(_0xf865('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xf865('0x1'));var Redis=require(_0xf865('0x2'));var intUtil=require(_0xf865('0x3'));var config=require(_0xf865('0x4'));var logger=require(_0xf865('0x5'))(_0xf865('0x6'));config['redis']=_[_0xf865('0x7')](config['redis'],{'host':_0xf865('0x8'),'port':0x18eb});var io=require(_0xf865('0x9'))(new Redis(config['redis']));function emit(_0xaa6b4a,_0x31dfb8,_0x16de84){io['to'](_0xaa6b4a)[_0xf865('0xa')](_0x31dfb8,_0x16de84);}var headers={'Content-Type':_0xf865('0xb'),'Accept':_0xf865('0xb')};function getTicket(_0x2da9ba,_0x4aacc0,_0x28a0ca,_0x2316c4,_0x2b9fb4){logger['info'](_0xf865('0xc'));return request({'uri':util[_0xf865('0xd')](_0xf865('0xe'),_0x2da9ba[_0xf865('0xf')]),'method':_0xf865('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x28a0ca['id'],'submitter_id':_0x4aacc0?_0x4aacc0['id']:undefined,'assignee_id':_0x4aacc0?_0x4aacc0['id']:undefined,'tags':getTags(_0x2316c4[_0xf865('0x11')],_0xf865('0x12')),'subject':intUtil[_0xf865('0x13')](_0x2316c4[_0xf865('0x14')],_0x2b9fb4,'\x20'),'description':intUtil['getString'](_0x2316c4[_0xf865('0x15')],_0x2b9fb4,'\x0a'),'comment':{'public':![],'body':intUtil[_0xf865('0x13')](_0x2316c4[_0xf865('0x15')],_0x2b9fb4,'\x0a')}},getCustomFields(_0x2316c4[_0xf865('0x16')],_0x2b9fb4))}})['then'](function(_0x88a22b){logger[_0xf865('0x17')](_0xf865('0x18'));return _0x88a22b['ticket'];});}function getUser(_0x5d70fc,_0x42e9d7){if(intUtil['validateEmail'](_0x42e9d7)){logger['info'](_0xf865('0x19'),_0x42e9d7);return request({'uri':util[_0xf865('0xd')]('%s/search.json',_0x5d70fc[_0xf865('0xf')]),'qs':{'query':util[_0xf865('0xd')](_0xf865('0x1a'),_0x42e9d7)}})['then'](function(_0x2ab301){if(_0x2ab301[_0xf865('0x1b')]){logger[_0xf865('0x17')](_0xf865('0x1c'));return _[_0xf865('0x1d')](_0x2ab301[_0xf865('0x1e')],{'email':_0x42e9d7,'role':'agent'});}else{logger[_0xf865('0x17')](_0xf865('0x1f'));return request({'uri':util[_0xf865('0xd')](_0xf865('0x20'),_0x5d70fc[_0xf865('0xf')])})[_0xf865('0x21')](function(_0xf6bb5f){logger[_0xf865('0x17')](_0xf865('0x22'));return _0xf6bb5f[_0xf865('0x23')];});}});}else{logger[_0xf865('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xf865('0x20'),_0x5d70fc[_0xf865('0xf')])})['then'](function(_0x5ecd91){logger[_0xf865('0x17')](_0xf865('0x22'));return _0x5ecd91[_0xf865('0x23')];});}}function getEndUser(_0x55296f,_0x2c2b86,_0x6de58){logger['info'](_0xf865('0x24'),_0x6de58);return request({'uri':util[_0xf865('0xd')](_0xf865('0x25'),_0x55296f[_0xf865('0xf')]),'qs':{'query':util[_0xf865('0xd')]('type:user\x20role:end-user\x20phone:%s',_0x6de58)}})[_0xf865('0x21')](function(_0x744422){var _0x3bd5ef;if(_0x744422['results'][_0xf865('0x26')]){_0x744422['results']=_[_0xf865('0x27')](_0x744422['results'],{'suspended':![],'role':_0xf865('0x28')});if(_0x744422[_0xf865('0x1e')][_0xf865('0x26')]){_0x3bd5ef=_[_0xf865('0x29')](_0x744422[_0xf865('0x1e')]);}}if(_0x3bd5ef){logger[_0xf865('0x17')](_0xf865('0x2a'));return _0x3bd5ef;}else{logger['info'](_0xf865('0x2b'));return request({'uri':util[_0xf865('0xd')]('%s/users.json',_0x55296f['remoteUri']),'method':_0xf865('0x10'),'body':{'user':{'role':'end-user','name':util[_0xf865('0xd')](_0xf865('0x2c'),_0x2c2b86||_0x6de58),'phone':_0x6de58}}})[_0xf865('0x21')](function(_0x1a045b){logger[_0xf865('0x17')]('Enduser\x20created.');return _0x1a045b[_0xf865('0x23')];});}});}function getAuth(_0x441e82){var _0x28d195;if(_0x441e82[_0xf865('0x2d')]===_0xf865('0x2e')){_0x28d195=util[_0xf865('0xd')]('%s:%s',_0x441e82['username'],_0x441e82[_0xf865('0x2e')]);}else if(_0x441e82[_0xf865('0x2d')]==='token'){_0x28d195=util[_0xf865('0xd')](_0xf865('0x2f'),_0x441e82[_0xf865('0x30')],_0x441e82[_0xf865('0x31')]);}return util['format'](_0xf865('0x32'),new Buffer(_0x28d195)[_0xf865('0x33')]('base64'));}function request(_0x1286c0){logger[_0xf865('0x34')](_0xf865('0x35'),JSON['stringify'](_0x1286c0));return rp(_[_0xf865('0x7')](_0x1286c0,{'method':_0xf865('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x2796cc,_0x1168eb){var _0x8ecaeb=[];if(_0x2796cc&&_0x2796cc['length']>0x0){_0x8ecaeb=_[_0xf865('0x37')](_0x2796cc,_0x1168eb);}return _0x8ecaeb;}function getCustomFields(_0x30560c,_0x283779){var _0x2c2d15=[];var _0x581fb6={'custom_fields':[]};if(_0x30560c[_0xf865('0x26')]>0x0){_[_0xf865('0x38')](_0x30560c,function(_0x1a541d){if(_['includes'](['string',_0xf865('0x39')],_0x1a541d['type'])&&_0x1a541d[_0xf865('0x3a')]&&!_0x1a541d[_0xf865('0x3b')]){_0x581fb6[_0x1a541d[_0xf865('0x3a')][_0xf865('0x3c')]()]=_0x1a541d['content']['toString']();}else if(_[_0xf865('0x3d')](['string',_0xf865('0x39')],_0x1a541d[_0xf865('0x3e')])&&_0x1a541d[_0xf865('0x3f')]&&_0x1a541d[_0xf865('0x3b')]){_0x581fb6['custom_fields']['push']({'id':_0x1a541d[_0xf865('0x3f')],'value':_0x1a541d[_0xf865('0x40')][_0xf865('0x33')]()});}else if(_0x1a541d[_0xf865('0x3e')]===_0xf865('0x41')&&_0x1a541d[_0xf865('0x42')]&&_0x1a541d['idField']&&_0x1a541d[_0xf865('0x3b')]){_0x283779[_0x1a541d[_0xf865('0x42')]]&&_0x581fb6[_0xf865('0x43')][_0xf865('0x44')]({'id':_0x1a541d['idField'],'value':_0x283779[_0x1a541d[_0xf865('0x42')]]['toString']()});}else if(_0x1a541d[_0xf865('0x3e')]==='customVariable'&&_0x1a541d['Variable']&&_0x1a541d[_0xf865('0x45')][_0xf865('0x12')]&&_0x1a541d[_0xf865('0x3f')]&&_0x1a541d[_0xf865('0x3b')]){_0x283779[_0x1a541d['Variable'][_0xf865('0x12')][_0xf865('0x3c')]()]&&_0x581fb6[_0xf865('0x43')][_0xf865('0x44')]({'id':_0x1a541d[_0xf865('0x3f')],'value':_0x283779[_0x1a541d[_0xf865('0x45')][_0xf865('0x12')]['toLowerCase']()][_0xf865('0x33')]()});}});}return _0x581fb6;}exports['queue']=function(_0x57fd23,_0x148a0c,_0x38e81c,_0x4f8595,_0x477e24,_0x5d3936){var _0x521ae8,_0x5c0e29;_0x5d3936['remoteUri']=intUtil['stripTrailingSlash'](_0x5d3936[_0xf865('0xf')]);_0x5d3936[_0xf865('0x46')]=intUtil['stripTrailingSlash'](_0x5d3936[_0xf865('0x46')]);if(_0x477e24&&_0x477e24[_0xf865('0x47')]){logger['info'](_0xf865('0x48'),'Recording\x20is\x20enabled!');_0x148a0c[_0xf865('0x49')]=util[_0xf865('0xd')](_0xf865('0x4a'),_0x5d3936[_0xf865('0x46')],_0x148a0c[_0xf865('0x4b')],md5(_0x148a0c[_0xf865('0x4b')]));}else{_0x148a0c[_0xf865('0x49')]='';}headers['Authorization']=getAuth(_0x5d3936);return getUser(_0x5d3936,_0x4f8595[_0xf865('0x4c')])['then'](function(_0x106716){_0x521ae8=_0x106716;logger[_0xf865('0x17')](_0xf865('0x4d'),_0x521ae8['id']);return getEndUser(_0x5d3936,_0x148a0c[_0xf865('0x4e')],_0x148a0c[_0xf865('0x4f')]);})[_0xf865('0x21')](function(_0x1ac6b2){_0x5c0e29=_0x1ac6b2;logger['info'](_0xf865('0x50'),_0x5c0e29['id']);return getTicket(_0x5d3936,_0x521ae8,_0x5c0e29,_0x38e81c,_0x148a0c);})[_0xf865('0x21')](function(_0x562ace){if(_0x562ace){logger['info'](_0xf865('0x51'),_0x562ace['id']);switch(_0x5d3936[_0xf865('0x3e')]){case'integrationTab':logger[_0xf865('0x17')](_0xf865('0x48'),_0xf865('0x52'));return request({'uri':util[_0xf865('0xd')](_0xf865('0x53'),_0x5d3936[_0xf865('0xf')],_0x521ae8['id'],_0x562ace['id']),'method':_0xf865('0x10')});case _0xf865('0x54'):logger[_0xf865('0x17')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf865('0xd')](_0xf865('0x55'),_0x4f8595[_0xf865('0x12')]),_0xf865('0x56'),{'uri':util['format'](_0xf865('0x57'),_0x5d3936[_0xf865('0xf')][_0xf865('0x58')](_0xf865('0x59'),''),_0x562ace['id'])});break;default:logger['error'](_0xf865('0x48'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xf865('0x5a')](function(_0x253cac){logger['error'](_0xf865('0x5b'),util[_0xf865('0x5c')](_0x253cac,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x309536,_0x50ce49,_0x25923c,_0x546ff7,_0x2ac738,_0x2dab85,_0xe830a8){var _0x5a1541,_0x25d9ec;_0x2dab85[_0xf865('0xf')]=intUtil[_0xf865('0x5d')](_0x2dab85[_0xf865('0xf')]);_0x2dab85['serverUrl']=intUtil[_0xf865('0x5d')](_0x2dab85[_0xf865('0x46')]);if(_0xe830a8&&_0xe830a8[_0xf865('0x5e')]&&_0xe830a8[_0xf865('0x5e')]!==_0xf865('0x5f')){logger['info'](_0xf865('0x60'),_0xf865('0x61'));_0x50ce49[_0xf865('0x49')]=util[_0xf865('0xd')](_0xf865('0x4a'),_0x2dab85['serverUrl'],_0x50ce49[_0xf865('0x4b')],md5(_0x50ce49[_0xf865('0x4b')]));}headers['Authorization']=getAuth(_0x2dab85);return getUser(_0x2dab85,_0x546ff7['email'])[_0xf865('0x21')](function(_0x12f55d){_0x5a1541=_0x12f55d;logger[_0xf865('0x17')](_0xf865('0x4d'),_0x5a1541['id']);return getEndUser(_0x2dab85,_0x50ce49[_0xf865('0x62')],_0x50ce49[_0xf865('0x63')]);})['then'](function(_0x52c029){_0x25d9ec=_0x52c029;logger[_0xf865('0x17')](_0xf865('0x50'),_0x25d9ec['id']);return getTicket(_0x2dab85,_0x5a1541,_0x25d9ec,_0x25923c,_0x50ce49);})['then'](function(_0x4d61a7){if(_0x4d61a7){logger[_0xf865('0x17')]('The\x20Ticket\x20ID\x20is:',_0x4d61a7['id']);switch(_0x2dab85['type']){case _0xf865('0x64'):logger[_0xf865('0x17')]('[OUTBOUND]',_0xf865('0x52'));return request({'uri':util[_0xf865('0xd')](_0xf865('0x53'),_0x2dab85['remoteUri'],_0x5a1541['id'],_0x4d61a7['id']),'method':'POST'});case _0xf865('0x54'):logger[_0xf865('0x17')]('[OUTBOUND]',_0xf865('0x65'));emit(util[_0xf865('0xd')]('user:%s',_0x546ff7[_0xf865('0x12')]),_0xf865('0x56'),{'uri':util[_0xf865('0xd')](_0xf865('0x57'),_0x2dab85[_0xf865('0xf')][_0xf865('0x58')]('/api/v2',''),_0x4d61a7['id'])});break;default:logger[_0xf865('0x66')](_0xf865('0x60'),_0xf865('0x67'));}}})[_0xf865('0x5a')](function(_0xc91e06){logger[_0xf865('0x66')](_0xf865('0x68'),util[_0xf865('0x5c')](_0xc91e06,{'showHidden':!![],'depth':null}));});};exports[_0xf865('0x69')]=function(_0x457aba,_0xf841d9,_0x3d0e4f,_0x23617a,_0x5c5c9c,_0x562ea7){var _0x12396b,_0x2c95a4;_0x562ea7[_0xf865('0xf')]=intUtil[_0xf865('0x5d')](_0x562ea7[_0xf865('0xf')]);_0x562ea7[_0xf865('0x46')]=intUtil[_0xf865('0x5d')](_0x562ea7[_0xf865('0x46')]);if(_0x5c5c9c&&_0x5c5c9c[_0xf865('0x47')]){logger['info']('['+_0xf841d9[_0xf865('0x6a')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0xf841d9[_0xf865('0x49')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x562ea7['serverUrl'],_0xf841d9[_0xf865('0x4b')],md5(_0xf841d9['uniqueid']));}else{_0xf841d9[_0xf865('0x49')]='';}headers[_0xf865('0x6b')]=getAuth(_0x562ea7);return getUser(_0x562ea7)[_0xf865('0x21')](function(_0x228d3e){_0x12396b=_0x228d3e;logger[_0xf865('0x17')](_0xf865('0x4d'),_0x12396b['id']);return getEndUser(_0x562ea7,_0xf841d9[_0xf865('0x4e')],_0xf841d9[_0xf865('0x4f')]);})['then'](function(_0xd91573){_0x2c95a4=_0xd91573;logger[_0xf865('0x17')](_0xf865('0x50'),_0x2c95a4['id']);return getTicket(_0x562ea7,_0x12396b,_0x2c95a4,_0x3d0e4f,_0xf841d9);})[_0xf865('0x21')](function(_0x1ca6f5){if(_0x1ca6f5){logger[_0xf865('0x17')](_0xf865('0x51'),_0x1ca6f5['id']);}})[_0xf865('0x5a')](function(_0x440489){logger[_0xf865('0x66')]('['+_0xf841d9[_0xf865('0x6a')]['toUpperCase']()+']'+_0xf865('0x6c'),util[_0xf865('0x5c')](_0x440489,{'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 e79d6a0..96bf8b1 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 _0xb28a=['connect','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','Call_Type','Inbound','merge','Call\x20created!','err','log','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','https://crm.','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','request-promise','md5','./util','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','length','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','refresh_token','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','Administrator','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','then','data','enduserType','catch','https://www.zohoapis.','startCase','role','last_name','code','SUCCESS','details','moduleCreate','Error:\x20','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','first_name','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','talktime','endtime','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete'];(function(_0xe46f22,_0x1d463d){var _0x33112c=function(_0x47a8bf){while(--_0x47a8bf){_0xe46f22['push'](_0xe46f22['shift']());}};_0x33112c(++_0x1d463d);}(_0xb28a,0x166));var _0xab28=function(_0x5f3108,_0x167399){_0x5f3108=_0x5f3108-0x0;var _0x377107=_0xb28a[_0x5f3108];return _0x377107;};'use strict';var _=require('lodash');var rp=require(_0xab28('0x0'));var md5=require(_0xab28('0x1'));var util=require('util');var intUtil=require(_0xab28('0x2'));var moment=require('moment');var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0xab28('0x3'));var logger=require(_0xab28('0x4'))(_0xab28('0x5'));config[_0xab28('0x6')]=_[_0xab28('0x7')](config[_0xab28('0x6')],{'host':_0xab28('0x8'),'port':0x18eb});var io=require(_0xab28('0x9'))(new Redis(config['redis']));function emit(_0x479267,_0x294e36,_0x32635b){io['to'](_0x479267)[_0xab28('0xa')](_0x294e36,_0x32635b);}function request(_0x2508ef){logger[_0xab28('0xb')](_0xab28('0xc'),JSON['stringify'](_0x2508ef));return rp(_0x2508ef);}function getCustomFields(_0x2291dc,_0x49771b){var _0x3e5b85={};if(_0x2291dc[_0xab28('0xd')]>0x0){_[_0xab28('0xe')](_0x2291dc,function(_0x188661){if(_[_0xab28('0xf')]([_0xab28('0x10'),_0xab28('0x11')],_0x188661[_0xab28('0x12')])&&_0x188661['idField']){_0x3e5b85[_0x188661[_0xab28('0x13')]]=_0x188661[_0xab28('0x14')][_0xab28('0x15')]();}else if(_0x188661[_0xab28('0x12')]===_0xab28('0x16')&&_0x188661[_0xab28('0x17')]&&_0x188661['idField']&&_0x49771b[_0x188661['variableName']]){_0x3e5b85[_0x188661[_0xab28('0x13')]]=_0x49771b[_0x188661[_0xab28('0x17')]][_0xab28('0x15')]();}else if(_0x188661[_0xab28('0x12')]==='customVariable'&&_0x188661[_0xab28('0x18')]&&_0x188661['Variable'][_0xab28('0x19')]&&_0x188661['idField']&&_0x49771b[_0x188661[_0xab28('0x18')][_0xab28('0x19')][_0xab28('0x1a')]()]){_0x3e5b85[_0x188661[_0xab28('0x13')]]=_0x49771b[_0x188661[_0xab28('0x18')][_0xab28('0x19')][_0xab28('0x1a')]()][_0xab28('0x15')]();}});}return _0x3e5b85;}function getName(_0x480454){if(_0x480454[_0xab28('0x1b')]('\x20')>0x0){var _0x18af35=_0x480454[_0xab28('0x1c')](/ (.+)/);if(_0x18af35[0x1]){return _0x18af35;}}return[_0x480454,_0x480454];}var accountsTokens={};function getAccessToken(_0x170a80){return new Promise(function(_0x2f6541,_0x1d1690){if(!_[_0xab28('0x1d')](accountsTokens[_0x170a80['id']])&&!_['isNil'](accountsTokens[_0x170a80['id']][_0xab28('0x1e')])){if(moment()['isBefore'](accountsTokens[_0x170a80['id']][_0xab28('0x1f')])){_0x2f6541(accountsTokens[_0x170a80['id']][_0xab28('0x1e')]);}}var _0x4a9c6d;switch(_0x170a80[_0xab28('0x20')]){case'US':_0x4a9c6d=_0xab28('0x21');break;case'AU':_0x4a9c6d=_0xab28('0x22');break;case'EU':_0x4a9c6d=_0xab28('0x23');break;case'IN':_0x4a9c6d=_0xab28('0x24');break;case'CN':_0x4a9c6d=_0xab28('0x25');break;default:_0x4a9c6d=_0xab28('0x23');break;}var _0x56c6ef={'method':_0xab28('0x26'),'uri':_0x4a9c6d+'/oauth/v2/token','qs':{'refresh_token':_0x170a80[_0xab28('0x27')],'client_id':_0x170a80[_0xab28('0x28')],'client_secret':_0x170a80['clientSecret'],'grant_type':_0xab28('0x29')},'json':!![]};return rp(_0x56c6ef)['then'](function(_0x2fd3aa){accountsTokens[_0x170a80['id']]={'access_token':_0x2fd3aa[_0xab28('0x1e')],'expires_in':moment()[_0xab28('0x2a')](_0x2fd3aa['expires_in'],_0xab28('0x2b'))};_0x2f6541(_0x2fd3aa[_0xab28('0x1e')]);})['catch'](function(_0x6a494e){logger[_0xab28('0x2c')](_0xab28('0x2d'),_0x6a494e[_0xab28('0x2e')]);_0x1d1690(_0x6a494e);});});}function getUser(_0x537f64,_0x163f1b,_0x299da7,_0x33e5ce){logger[_0xab28('0x2f')](_0xab28('0x30'));return request({'method':_0xab28('0x31'),'uri':util[_0xab28('0x32')](_0xab28('0x33'),_0x163f1b),'qs':{'type':_0xab28('0x34')},'headers':{'Authorization':_0xab28('0x35')+_0x537f64},'json':!![]})['then'](function(_0x520bc2){if(_0x520bc2[_0xab28('0x36')]){var _0x4cbc0b=-0x1;if(_['isArrayLikeObject'](_0x520bc2[_0xab28('0x36')])){if(!_[_0xab28('0x1d')](_0x33e5ce)){_0x4cbc0b=_[_0xab28('0x37')](_0x520bc2[_0xab28('0x36')],function(_0x3639e1){return _0x3639e1[_0xab28('0x38')]===_0x33e5ce;});}if(_0x4cbc0b>=0x0){logger['info'](_0xab28('0x39'));}else{logger[_0xab28('0x2f')](_0xab28('0x3a'));_0x4cbc0b=_['findIndex'](_0x520bc2[_0xab28('0x36')],function(_0x59430f){return _0x59430f[_0xab28('0x3b')][_0xab28('0x19')]==='Administrator';});}return _0x520bc2[_0xab28('0x36')][_0x4cbc0b];}else{if(_0x520bc2[_0xab28('0x3c')][_0xab28('0x3b')][_0xab28('0x19')]===_0xab28('0x3d')){logger[_0xab28('0x2f')]('Using\x20the\x20admin\x20account!');user=_0x520bc2[_0xab28('0x3c')];return user;}else{logger[_0xab28('0x2c')]('The\x20failing\x20result\x20is',JSON[_0xab28('0x3e')](_0x520bc2));throw new Error(_0xab28('0x3f')+JSON[_0xab28('0x3e')](_0x520bc2));}}}else{logger[_0xab28('0x2c')](_0xab28('0x40'),JSON[_0xab28('0x3e')](_0x520bc2));throw new Error(_0xab28('0x3f')+JSON[_0xab28('0x3e')](_0x520bc2));}})['catch'](function(_0x207ac3){console[_0xab28('0x2c')](_0x207ac3);});}function getZohoUser(_0x5e826c,_0x45ac88){return new BPromise(function(_0x3a6588,_0x581f24){request(_0x5e826c)[_0xab28('0x41')](function(_0x2a69d0){var _0x93d634=null;if(_0x2a69d0){_0x93d634=_0x2a69d0[_0xab28('0x42')][0x0];_0x93d634[_0xab28('0x43')]=_0x45ac88;}_0x3a6588(_0x93d634);})[_0xab28('0x44')](function(_0x359ff9){_0x581f24(_0x359ff9);});});}function createEndUser(_0x57bb8e,_0x3a1a78,_0x38e846,_0x538ec3,_0x1e59b8,_0x2e7c96){var _0x38e846=getName(_0x38e846);return request({'method':_0xab28('0x26'),'uri':_0xab28('0x45')+_0x3a1a78+'/crm/v2/'+_[_0xab28('0x46')](_0x2e7c96['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x38e846[0x1],'First_Name':_0x38e846[0x0],'Phone':_0x538ec3,'Owner':{'name':!_['isNil'](_0x1e59b8[_0xab28('0x47')][_0xab28('0x19')])?_0x1e59b8[_0xab28('0x47')][_0xab28('0x19')]:!_[_0xab28('0x1d')](_0x1e59b8['first_name'])?_0x1e59b8['first_name']+'\x20'+_0x1e59b8[_0xab28('0x48')]:_0x1e59b8['last_name'],'id':_0x1e59b8['id']}}]},'headers':{'Authorization':_0xab28('0x35')+_0x57bb8e},'json':!![]})['then'](function(_0x5c29d6){if(_0x5c29d6&&_0x5c29d6[_0xab28('0x42')][0x0][_0xab28('0x49')]===_0xab28('0x4a')){var _0xb437c5=_0x5c29d6[_0xab28('0x42')][0x0][_0xab28('0x4b')];_0xb437c5['enduserType']=_['startCase'](_0x2e7c96[_0xab28('0x4c')])+'s';return _0xb437c5;}logger['error'](_0xab28('0x40'),JSON['stringify'](data));throw new Error(_0xab28('0x4d')+JSON['stringify'](data));})['catch'](function(_0x3181fb){console['log']('CREATE\x20ERROR',_0x3181fb);});}function getEndUser(_0x4becdd,_0x21bd9,_0x55b220,_0xaf3796,_0x31bf66,_0x3f1da9,_0x1016c3){var _0x51243e={'method':_0xab28('0x31'),'uri':'','headers':{'Authorization':_0xab28('0x35')+_0x4becdd},'json':!![]};switch(_0x1016c3[_0xab28('0x4e')]){case _0xab28('0x4f'):_0x51243e[_0xab28('0x50')]='https://www.zohoapis.'+_0x21bd9+_0xab28('0x51')+_0x31bf66+'))';return getZohoUser(_0x51243e,_0xab28('0x52'))['then'](function(_0x37c727){if(_0x37c727)return _0x37c727;_0x51243e['uri']='https://www.zohoapis.'+_0x21bd9+_0xab28('0x53')+_0x31bf66+'))';return getZohoUser(_0x51243e,_0xab28('0x54'))['then'](function(_0x39a4ef){if(_0x39a4ef)return _0x39a4ef;if(_0x1016c3['moduleCreate']!=_0xab28('0x55')){return createEndUser(_0x4becdd,_0x21bd9,_0xaf3796,_0x31bf66,_0x3f1da9,_0x1016c3);}else{return{};}});});break;case _0xab28('0x56'):_0x51243e[_0xab28('0x50')]=_0xab28('0x45')+_0x21bd9+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x31bf66+'))';return getZohoUser(_0x51243e,_0xab28('0x52'))['then'](function(_0x4cbce1){if(_0x4cbce1)return _0x4cbce1;if(_0x1016c3[_0xab28('0x4c')]!='nothing'){return createEndUser(_0x4becdd,_0x21bd9,_0xaf3796,_0x31bf66,_0x3f1da9,_0x1016c3);}else{return{};}});break;case _0xab28('0x57'):_0x51243e[_0xab28('0x50')]='https://www.zohoapis.'+_0x21bd9+_0xab28('0x53')+_0x31bf66+'))';return getZohoUser(_0x51243e,_0xab28('0x54'))[_0xab28('0x41')](function(_0x41dd3d){if(_0x41dd3d)return _0x41dd3d;if(_0x1016c3['moduleCreate']!=_0xab28('0x55')){return createEndUser(_0x4becdd,_0x21bd9,_0xaf3796,_0x31bf66,_0x3f1da9,_0x1016c3);}else{return{};}});break;}}function getCall(_0x19a791,_0x41c0b8,_0x1beec0,_0x27fb7a,_0x237be6,_0x401216,_0x1da81c,_0x4949ab){logger[_0xab28('0x2f')](_0xab28('0x58'));var _0x12ebde={};_0x12ebde[_0xab28('0x59')]={'name':!_[_0xab28('0x1d')](_0x27fb7a[_0xab28('0x47')][_0xab28('0x19')])&&!_[_0xab28('0x1d')](_0x27fb7a[_0xab28('0x3b')][_0xab28('0x19')])&&_0x27fb7a[_0xab28('0x3b')]['name']===_0xab28('0x5a')?_0x27fb7a['role']['name']:!_[_0xab28('0x1d')](_0x27fb7a[_0xab28('0x5b')])?_0x27fb7a[_0xab28('0x5b')]+'\x20'+_0x27fb7a['last_name']:_0x27fb7a['last_name'],'id':_0x27fb7a['id']};_0x12ebde[_0xab28('0x5c')]=intUtil[_0xab28('0x5d')](_0x401216[_0xab28('0x5e')],_0x1da81c,'\x20');_0x12ebde[_0xab28('0x5f')]=intUtil[_0xab28('0x5d')](_0x401216[_0xab28('0x60')],_0x1da81c,'\x0a');if(_0x237be6[_0xab28('0x43')]===_0xab28('0x52')){_0x12ebde[_0xab28('0x61')]={'name':!_[_0xab28('0x1d')](_0x237be6[_0xab28('0x62')])?_0x237be6[_0xab28('0x62')]:!_[_0xab28('0x1d')](_0x237be6[_0xab28('0x63')])?_0x237be6[_0xab28('0x63')]+'\x20'+_0x237be6[_0xab28('0x64')]:_0x237be6[_0xab28('0x64')],'id':_0x237be6['id']};}if(_0x237be6[_0xab28('0x43')]===_0xab28('0x54')){_0x12ebde[_0xab28('0x65')]={'name':!_[_0xab28('0x1d')](_0x237be6[_0xab28('0x62')])?_0x237be6[_0xab28('0x62')]:!_[_0xab28('0x1d')](_0x237be6[_0xab28('0x63')])?_0x237be6[_0xab28('0x63')]+'\x20'+_0x237be6[_0xab28('0x64')]:_0x237be6['Last_Name'],'id':_0x237be6['id']};_0x12ebde[_0xab28('0x66')]=_[_0xab28('0x46')](_0x237be6[_0xab28('0x43')]);}if(_0x1da81c['talktime']){_0x12ebde[_0xab28('0x67')]=moment['utc'](parseInt(_0x1da81c[_0xab28('0x68')])*0x3e8)[_0xab28('0x32')]('mm:ss');}else if(_0x1da81c['answertime']&&_0x1da81c[_0xab28('0x69')]){_0x12ebde[_0xab28('0x67')]=moment['utc'](moment(_0x1da81c[_0xab28('0x69')],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0x1da81c[_0xab28('0x6a')],_0xab28('0x6b'))))[_0xab28('0x32')]('mm:ss');}switch(_0x1da81c[_0xab28('0x6c')]){case _0xab28('0x6d'):_0x12ebde[_0xab28('0x6e')]=_0xab28('0x6f');break;case _0xab28('0x70'):case _0xab28('0x71'):_0x12ebde[_0xab28('0x6e')]='Answered';break;case _0xab28('0x72'):_0x12ebde[_0xab28('0x6e')]=_0xab28('0x73');break;case _0xab28('0x74'):_0x12ebde[_0xab28('0x6e')]=_0xab28('0x75');break;case _0xab28('0x76'):_0x12ebde['Call_Result']=_0xab28('0x77');default:}_0x12ebde[_0xab28('0x78')]=(_0x4949ab==='outbound'?moment(_0x1da81c[_0xab28('0x6a')])['format'](_0xab28('0x6b')):moment(_0x1da81c['agentcalledAt'])[_0xab28('0x32')](_0xab28('0x6b')))||moment()[_0xab28('0x32')]('YYYY-MM-DDTHH:mm:ss');_0x12ebde[_0xab28('0x79')]=_0x4949ab||_0xab28('0x7a');_0x12ebde=_[_0xab28('0x7b')](_0x12ebde,getCustomFields(_0x401216['Fields'],_0x1da81c));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x41c0b8+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x19a791},'body':{'data':[_0x12ebde]},'json':!![]})[_0xab28('0x41')](function(_0x25f342){if(_0x25f342&&_0x25f342[_0xab28('0x42')][0x0][_0xab28('0x49')]===_0xab28('0x4a')){logger['info'](_0xab28('0x7c'));return{'id':_0x25f342[_0xab28('0x42')][0x0][_0xab28('0x4b')]['id']};}})[_0xab28('0x44')](function(_0x4168fb){logger['info'](_0xab28('0x7d'),_0x4168fb['stack']);console[_0xab28('0x7e')]('err',_0x4168fb);});}exports[_0xab28('0x7f')]=function(_0x212b87,_0x43aede,_0x79e8a5,_0x3c6fea,_0x3c9d1f,_0x75c7f6){var _0x345252,_0x51ab43,_0x43f7ad;_0x75c7f6[_0xab28('0x80')]=intUtil['stripTrailingSlash'](_0x75c7f6[_0xab28('0x80')]);_0x75c7f6[_0xab28('0x81')]=intUtil[_0xab28('0x82')](_0x75c7f6[_0xab28('0x81')]);if(_0x3c9d1f&&_0x3c9d1f[_0xab28('0x83')]){logger[_0xab28('0x2f')](_0xab28('0x84'),_0xab28('0x85'));_0x43aede['recordingURL']=_0x75c7f6['serverUrl']+'/api/voice/recordings/'+_0x43aede[_0xab28('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x43aede['uniqueid']);}else{_0x43aede[_0xab28('0x87')]='';}var _0x237b07=_0x75c7f6[_0xab28('0x80')]===_0xab28('0x88')?'eu':_0xab28('0x89');return getAccessToken(_0x75c7f6)[_0xab28('0x41')](function(_0xe536f3){_0x43f7ad=_0xe536f3;return getUser(_0x43f7ad,_0x237b07,_0x75c7f6,_0x3c6fea[_0xab28('0x38')]);})[_0xab28('0x41')](function(_0x2a3a16){_0x345252=_0x2a3a16;logger[_0xab28('0x2f')](_0xab28('0x8a'),_0x345252['id']);return getEndUser(_0x43f7ad,_0x237b07,_0x75c7f6,_0x43aede[_0xab28('0x8b')],_0x43aede[_0xab28('0x8c')],_0x345252,_0x79e8a5);})[_0xab28('0x41')](function(_0x513e4e){_0x51ab43=_0x513e4e;return getCall(_0x43f7ad,_0x237b07,_0x75c7f6,_0x345252,_0x51ab43,_0x79e8a5,_0x43aede,_0xab28('0x7a'));})[_0xab28('0x41')](function(_0x283eaa){if(_0x283eaa){logger[_0xab28('0x2f')]('The\x20Call\x20ID\x20is:',_0x283eaa['id']);logger['info'](_0xab28('0x84'),_0xab28('0x8d'));emit(util['format'](_0xab28('0x8e'),_0x3c6fea[_0xab28('0x19')]),_0xab28('0x8f'),{'uri':'https://crm.'+_0x75c7f6['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x283eaa['id']});}})[_0xab28('0x44')](function(_0x2882f4){logger['error']('[QUEUE]',JSON[_0xab28('0x3e')](_0x2882f4));});};exports[_0xab28('0x90')]=function(_0x795882,_0x217ecd,_0x4198a4,_0x3cc368,_0x594644,_0x191ed8,_0x17d5c0){var _0x30c881,_0x16c45b,_0x43ae2c;_0x191ed8[_0xab28('0x80')]=intUtil[_0xab28('0x82')](_0x191ed8['host']);_0x191ed8[_0xab28('0x81')]=intUtil['stripTrailingSlash'](_0x191ed8[_0xab28('0x81')]);if(_0x17d5c0&&_0x17d5c0['recordingFormat']&&_0x17d5c0[_0xab28('0x91')]!==_0xab28('0x92')){logger[_0xab28('0x2f')](_0xab28('0x93'),'Recording\x20is\x20enabled!');_0x217ecd['recordingURL']=_0x191ed8['serverUrl']+'/api/voice/recordings/'+_0x217ecd[_0xab28('0x86')]+_0xab28('0x94')+md5(_0x217ecd[_0xab28('0x86')]);}var _0x108dc1=_0x191ed8[_0xab28('0x80')]===_0xab28('0x88')?'eu':'com';return getAccessToken(_0x191ed8)[_0xab28('0x41')](function(_0x44ffef){_0x43ae2c=_0x44ffef;return getUser(_0x43ae2c,_0x108dc1,_0x191ed8,_0x3cc368[_0xab28('0x38')]);})[_0xab28('0x41')](function(_0x411022){_0x30c881=_0x411022;logger[_0xab28('0x2f')](_0xab28('0x8a'),_0x30c881['id']);return getEndUser(_0x43ae2c,_0x108dc1,_0x191ed8,_0x217ecd[_0xab28('0x95')],_0x217ecd[_0xab28('0x96')],_0x30c881,_0x4198a4);})[_0xab28('0x41')](function(_0x2a71c3){_0x16c45b=_0x2a71c3;return getCall(_0x43ae2c,_0x108dc1,_0x191ed8,_0x30c881,_0x16c45b,_0x4198a4,_0x217ecd,_0xab28('0x97'));})[_0xab28('0x41')](function(_0xf83acf){if(_0xf83acf){logger[_0xab28('0x2f')](_0xab28('0x98'),_0xf83acf['id']);logger[_0xab28('0x2f')]('[OUTBOUND]',_0xab28('0x8d'));emit(util['format'](_0xab28('0x8e'),_0x3cc368[_0xab28('0x19')]),_0xab28('0x8f'),{'uri':_0xab28('0x99')+_0x191ed8['host']+_0xab28('0x9a')+_0xf83acf['id']});}})[_0xab28('0x44')](function(_0x2e43ec){logger[_0xab28('0x2c')](_0xab28('0x93'),JSON[_0xab28('0x3e')](_0x2e43ec));});};exports[_0xab28('0x9b')]=function(_0x337c30,_0x1eaa53,_0x3dba27,_0x5a2dab,_0x4a972d,_0x49f4d7){var _0x483daf,_0x36a86d,_0x58ac31;_0x49f4d7['host']=intUtil[_0xab28('0x82')](_0x49f4d7['host']);_0x49f4d7['serverUrl']=intUtil[_0xab28('0x82')](_0x49f4d7[_0xab28('0x81')]);if(_0x4a972d&&_0x4a972d[_0xab28('0x83')]){logger[_0xab28('0x2f')]('['+_0x1eaa53[_0xab28('0x6c')][_0xab28('0x9c')]()+']','Recording\x20is\x20enabled!');_0x1eaa53[_0xab28('0x87')]=_0x49f4d7[_0xab28('0x81')]+'/api/voice/recordings/'+_0x1eaa53[_0xab28('0x86')]+_0xab28('0x94')+md5(_0x1eaa53[_0xab28('0x86')]);}else{_0x1eaa53[_0xab28('0x87')]='';}var _0x41eb84=_0x49f4d7[_0xab28('0x80')]===_0xab28('0x88')?'eu':_0xab28('0x89');return getAccessToken(_0x49f4d7)['then'](function(_0x11a6c8){_0x58ac31=_0x11a6c8;return getUser(_0x58ac31,_0x41eb84,_0x49f4d7);})['then'](function(_0x185e4f){_0x483daf=_0x185e4f;logger[_0xab28('0x2f')](_0xab28('0x8a'),_0x483daf['id']);return getEndUser(_0x58ac31,_0x41eb84,_0x49f4d7,_0x1eaa53[_0xab28('0x8b')],_0x1eaa53[_0xab28('0x8c')],_0x483daf,_0x3dba27);})[_0xab28('0x41')](function(_0x269507){_0x36a86d=_0x269507;return getCall(_0x58ac31,_0x41eb84,_0x49f4d7,_0x483daf,_0x36a86d,_0x3dba27,_0x1eaa53,'Inbound');})[_0xab28('0x41')](function(_0x5cea95){if(_0x5cea95){logger['info']('The\x20Call\x20ID\x20is:',_0x5cea95['id']);}})[_0xab28('0x44')](function(_0x1c04bf){logger[_0xab28('0x2c')]('['+_0x1eaa53[_0xab28('0x6c')][_0xab28('0x9c')]()+']',JSON['stringify'](_0x1c04bf));});}; \ No newline at end of file +var _0x5271=['The\x20Call\x20ID\x20is:','[OUTBOUND]','user:%s','/crm/EntityInfo.do?module=Calls&id=','unmanaged','monitor_format','toUpperCase','lodash','md5','util','moment','ioredis','bluebird','../../../../config/environment','zoho','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','idField','content','toString','type','variable','variableName','Variable','toLowerCase','name','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','then','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','first_name','last_name','code','SUCCESS','details','enduserType','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','role','administrator','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','format','mm:ss','lastevent','Call_Result','Called','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','err','stripTrailingSlash','host','serverUrl','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','recordingFormat','none','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','Outbound'];(function(_0xcda377,_0x1e2678){var _0x1c024f=function(_0x1aeb61){while(--_0x1aeb61){_0xcda377['push'](_0xcda377['shift']());}};_0x1c024f(++_0x1e2678);}(_0x5271,0xa0));var _0x1527=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x5271[_0x47fd36];return _0x21a0fc;};'use strict';var _=require(_0x1527('0x0'));var rp=require('request-promise');var md5=require(_0x1527('0x1'));var util=require(_0x1527('0x2'));var intUtil=require('./util');var moment=require(_0x1527('0x3'));var Redis=require(_0x1527('0x4'));var BPromise=require(_0x1527('0x5'));var config=require(_0x1527('0x6'));var logger=require('../../../../config/logger')(_0x1527('0x7'));config['redis']=_[_0x1527('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1527('0x9'))(new Redis(config['redis']));function emit(_0x3c6cbf,_0xe62229,_0x117068){io['to'](_0x3c6cbf)[_0x1527('0xa')](_0xe62229,_0x117068);}function request(_0x68f9ce){logger[_0x1527('0xb')](_0x1527('0xc'),JSON[_0x1527('0xd')](_0x68f9ce));return rp(_0x68f9ce);}function getCustomFields(_0x525fea,_0x240909){var _0x5023f2={};if(_0x525fea[_0x1527('0xe')]>0x0){_[_0x1527('0xf')](_0x525fea,function(_0x31fd26){if(_[_0x1527('0x10')]([_0x1527('0x11'),_0x1527('0x12')],_0x31fd26['type'])&&_0x31fd26[_0x1527('0x13')]){_0x5023f2[_0x31fd26[_0x1527('0x13')]]=_0x31fd26[_0x1527('0x14')][_0x1527('0x15')]();}else if(_0x31fd26[_0x1527('0x16')]===_0x1527('0x17')&&_0x31fd26[_0x1527('0x18')]&&_0x31fd26[_0x1527('0x13')]&&_0x240909[_0x31fd26[_0x1527('0x18')]]){_0x5023f2[_0x31fd26[_0x1527('0x13')]]=_0x240909[_0x31fd26[_0x1527('0x18')]][_0x1527('0x15')]();}else if(_0x31fd26[_0x1527('0x16')]==='customVariable'&&_0x31fd26[_0x1527('0x19')]&&_0x31fd26[_0x1527('0x19')]['name']&&_0x31fd26[_0x1527('0x13')]&&_0x240909[_0x31fd26['Variable']['name'][_0x1527('0x1a')]()]){_0x5023f2[_0x31fd26[_0x1527('0x13')]]=_0x240909[_0x31fd26['Variable'][_0x1527('0x1b')][_0x1527('0x1a')]()]['toString']();}});}return _0x5023f2;}function getName(_0x1762ab){if(_0x1762ab[_0x1527('0x1c')]('\x20')>0x0){var _0x4e4184=_0x1762ab[_0x1527('0x1d')](/ (.+)/);if(_0x4e4184[0x1]){return _0x4e4184;}}return[_0x1762ab,_0x1762ab];}var accountsTokens={};function getAccessToken(_0x40d846){return new Promise(function(_0x5abb83,_0x5a679b){if(!_[_0x1527('0x1e')](accountsTokens[_0x40d846['id']])&&!_[_0x1527('0x1e')](accountsTokens[_0x40d846['id']][_0x1527('0x1f')])){if(moment()[_0x1527('0x20')](accountsTokens[_0x40d846['id']][_0x1527('0x21')])){_0x5abb83(accountsTokens[_0x40d846['id']][_0x1527('0x1f')]);}}var _0x41c3fa;switch(_0x40d846[_0x1527('0x22')]){case'US':_0x41c3fa='https://accounts.zoho.com';break;case'AU':_0x41c3fa=_0x1527('0x23');break;case'EU':_0x41c3fa=_0x1527('0x24');break;case'IN':_0x41c3fa=_0x1527('0x25');break;case'CN':_0x41c3fa=_0x1527('0x26');break;default:_0x41c3fa='https://accounts.zoho.eu';break;}var _0x5730eb={'method':_0x1527('0x27'),'uri':_0x41c3fa+'/oauth/v2/token','qs':{'refresh_token':_0x40d846[_0x1527('0x28')],'client_id':_0x40d846[_0x1527('0x29')],'client_secret':_0x40d846[_0x1527('0x2a')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5730eb)[_0x1527('0x2b')](function(_0x55cbb6){accountsTokens[_0x40d846['id']]={'access_token':_0x55cbb6[_0x1527('0x1f')],'expires_in':moment()['add'](_0x55cbb6[_0x1527('0x21')],'seconds')};_0x5abb83(_0x55cbb6[_0x1527('0x1f')]);})[_0x1527('0x2c')](function(_0x2b4b50){logger[_0x1527('0x2d')](_0x1527('0x2e'),_0x2b4b50[_0x1527('0x2f')]);_0x5a679b(_0x2b4b50);});});}function getUser(_0x1a02e5,_0x4f24f0,_0x3a716c,_0x2e0f0b){logger[_0x1527('0x30')](_0x1527('0x31'));return request({'method':_0x1527('0x32'),'uri':util['format'](_0x1527('0x33'),_0x4f24f0),'qs':{'type':_0x1527('0x34')},'headers':{'Authorization':_0x1527('0x35')+_0x1a02e5},'json':!![]})['then'](function(_0x54e3fa){if(_0x54e3fa[_0x1527('0x36')]){var _0x2815ea=-0x1;if(_[_0x1527('0x37')](_0x54e3fa[_0x1527('0x36')])){if(!_[_0x1527('0x1e')](_0x2e0f0b)){_0x2815ea=_[_0x1527('0x38')](_0x54e3fa[_0x1527('0x36')],function(_0x593711){return _0x593711[_0x1527('0x39')]===_0x2e0f0b;});}if(_0x2815ea>=0x0){logger[_0x1527('0x30')](_0x1527('0x3a'));}else{logger[_0x1527('0x30')](_0x1527('0x3b'));_0x2815ea=_['findIndex'](_0x54e3fa[_0x1527('0x36')],function(_0x47c7c1){return _0x47c7c1[_0x1527('0x3c')][_0x1527('0x1b')]===_0x1527('0x3d');});}return _0x54e3fa['users'][_0x2815ea];}else{if(_0x54e3fa[_0x1527('0x3e')]['profile'][_0x1527('0x1b')]===_0x1527('0x3d')){logger[_0x1527('0x30')]('Using\x20the\x20admin\x20account!');user=_0x54e3fa[_0x1527('0x3e')];return user;}else{logger[_0x1527('0x2d')](_0x1527('0x3f'),JSON['stringify'](_0x54e3fa));throw new Error(_0x1527('0x40')+JSON['stringify'](_0x54e3fa));}}}else{logger[_0x1527('0x2d')](_0x1527('0x3f'),JSON[_0x1527('0xd')](_0x54e3fa));throw new Error(_0x1527('0x40')+JSON[_0x1527('0xd')](_0x54e3fa));}})[_0x1527('0x2c')](function(_0x180bfd){console['error'](_0x180bfd);});}function getZohoUser(_0x1b05b8,_0x405e31){return new BPromise(function(_0x2e19f3,_0x52c79c){request(_0x1b05b8)[_0x1527('0x2b')](function(_0x6e3f19){var _0x2b922b=null;if(_0x6e3f19){_0x2b922b=_0x6e3f19[_0x1527('0x41')][0x0];_0x2b922b['enduserType']=_0x405e31;}_0x2e19f3(_0x2b922b);})[_0x1527('0x2c')](function(_0x343ab9){_0x52c79c(_0x343ab9);});});}function createEndUser(_0x156015,_0x436e4e,_0x4a8888,_0x2918f4,_0x1340c7,_0x108b5f){var _0x4a8888=getName(_0x4a8888);return request({'method':_0x1527('0x27'),'uri':_0x1527('0x42')+_0x436e4e+_0x1527('0x43')+_[_0x1527('0x44')](_0x108b5f[_0x1527('0x45')])+'s','body':{'data':[{'Last_Name':_0x4a8888[0x1],'First_Name':_0x4a8888[0x0],'Phone':_0x2918f4,'Owner':{'name':!_[_0x1527('0x1e')](_0x1340c7['role'][_0x1527('0x1b')])?_0x1340c7['role'][_0x1527('0x1b')]:!_[_0x1527('0x1e')](_0x1340c7[_0x1527('0x46')])?_0x1340c7[_0x1527('0x46')]+'\x20'+_0x1340c7[_0x1527('0x47')]:_0x1340c7[_0x1527('0x47')],'id':_0x1340c7['id']}}]},'headers':{'Authorization':_0x1527('0x35')+_0x156015},'json':!![]})[_0x1527('0x2b')](function(_0x20b803){if(_0x20b803&&_0x20b803['data'][0x0][_0x1527('0x48')]===_0x1527('0x49')){var _0x5e4137=_0x20b803[_0x1527('0x41')][0x0][_0x1527('0x4a')];_0x5e4137[_0x1527('0x4b')]=_[_0x1527('0x44')](_0x108b5f[_0x1527('0x45')])+'s';return _0x5e4137;}logger[_0x1527('0x2d')](_0x1527('0x3f'),JSON[_0x1527('0xd')](data));throw new Error(_0x1527('0x4c')+JSON['stringify'](data));})[_0x1527('0x2c')](function(_0x50673d){console[_0x1527('0x4d')](_0x1527('0x4e'),_0x50673d);});}function getEndUser(_0x181a57,_0x568f2c,_0x16feb1,_0x45ee8d,_0x262912,_0x31f7a3,_0xe3aad6){var _0x2eb951={'method':_0x1527('0x32'),'uri':'','headers':{'Authorization':_0x1527('0x35')+_0x181a57},'json':!![]};switch(_0xe3aad6['moduleSearch']){case _0x1527('0x4f'):_0x2eb951['uri']=_0x1527('0x42')+_0x568f2c+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x262912+'))';return getZohoUser(_0x2eb951,'Contacts')[_0x1527('0x2b')](function(_0x265f3e){if(_0x265f3e)return _0x265f3e;_0x2eb951[_0x1527('0x50')]=_0x1527('0x42')+_0x568f2c+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x262912+'))';return getZohoUser(_0x2eb951,_0x1527('0x51'))[_0x1527('0x2b')](function(_0x23f104){if(_0x23f104)return _0x23f104;if(_0xe3aad6['moduleCreate']!=_0x1527('0x52')){return createEndUser(_0x181a57,_0x568f2c,_0x45ee8d,_0x262912,_0x31f7a3,_0xe3aad6);}else{return{};}});});break;case _0x1527('0x53'):_0x2eb951[_0x1527('0x50')]=_0x1527('0x42')+_0x568f2c+_0x1527('0x54')+_0x262912+'))';return getZohoUser(_0x2eb951,_0x1527('0x55'))[_0x1527('0x2b')](function(_0x43a0d4){if(_0x43a0d4)return _0x43a0d4;if(_0xe3aad6['moduleCreate']!=_0x1527('0x52')){return createEndUser(_0x181a57,_0x568f2c,_0x45ee8d,_0x262912,_0x31f7a3,_0xe3aad6);}else{return{};}});break;case'lead':_0x2eb951['uri']='https://www.zohoapis.'+_0x568f2c+_0x1527('0x56')+_0x262912+'))';return getZohoUser(_0x2eb951,_0x1527('0x51'))[_0x1527('0x2b')](function(_0x42d0fb){if(_0x42d0fb)return _0x42d0fb;if(_0xe3aad6[_0x1527('0x45')]!=_0x1527('0x52')){return createEndUser(_0x181a57,_0x568f2c,_0x45ee8d,_0x262912,_0x31f7a3,_0xe3aad6);}else{return{};}});break;}}function getCall(_0x5f26f0,_0x190723,_0x5ba15c,_0x39e3a7,_0xd1486f,_0x4cbbcc,_0x4b94d8,_0x3c49a9){logger[_0x1527('0x30')](_0x1527('0x57'));var _0x22810a={};_0x22810a['Owner']={'name':!_[_0x1527('0x1e')](_0x39e3a7[_0x1527('0x58')][_0x1527('0x1b')])&&!_[_0x1527('0x1e')](_0x39e3a7[_0x1527('0x3c')][_0x1527('0x1b')])&&_0x39e3a7[_0x1527('0x3c')][_0x1527('0x1b')]===_0x1527('0x59')?_0x39e3a7[_0x1527('0x58')]['name']:!_[_0x1527('0x1e')](_0x39e3a7[_0x1527('0x46')])?_0x39e3a7['first_name']+'\x20'+_0x39e3a7[_0x1527('0x47')]:_0x39e3a7[_0x1527('0x47')],'id':_0x39e3a7['id']};_0x22810a['Subject']=intUtil[_0x1527('0x5a')](_0x4cbbcc[_0x1527('0x5b')],_0x4b94d8,'\x20');_0x22810a[_0x1527('0x5c')]=intUtil[_0x1527('0x5a')](_0x4cbbcc[_0x1527('0x5d')],_0x4b94d8,'\x0a');if(_0xd1486f[_0x1527('0x4b')]===_0x1527('0x55')){_0x22810a['Who_Id']={'name':!_[_0x1527('0x1e')](_0xd1486f[_0x1527('0x5e')])?_0xd1486f[_0x1527('0x5e')]:!_['isNil'](_0xd1486f['First_Name'])?_0xd1486f[_0x1527('0x5f')]+'\x20'+_0xd1486f[_0x1527('0x60')]:_0xd1486f[_0x1527('0x60')],'id':_0xd1486f['id']};}if(_0xd1486f[_0x1527('0x4b')]===_0x1527('0x51')){_0x22810a[_0x1527('0x61')]={'name':!_[_0x1527('0x1e')](_0xd1486f['Full_Name'])?_0xd1486f['Full_Name']:!_[_0x1527('0x1e')](_0xd1486f[_0x1527('0x5f')])?_0xd1486f[_0x1527('0x5f')]+'\x20'+_0xd1486f['Last_Name']:_0xd1486f[_0x1527('0x60')],'id':_0xd1486f['id']};_0x22810a[_0x1527('0x62')]=_[_0x1527('0x44')](_0xd1486f[_0x1527('0x4b')]);}if(_0x4b94d8[_0x1527('0x63')]){_0x22810a[_0x1527('0x64')]=moment[_0x1527('0x65')](parseInt(_0x4b94d8['talktime'])*0x3e8)['format']('mm:ss');}else if(_0x4b94d8[_0x1527('0x66')]&&_0x4b94d8['endtime']){_0x22810a['Call_Duration']=moment[_0x1527('0x65')](moment(_0x4b94d8[_0x1527('0x67')],'YYYY-MM-DDTHH:mm:ss')[_0x1527('0x68')](moment(_0x4b94d8[_0x1527('0x69')],_0x1527('0x6a'))))[_0x1527('0x6b')](_0x1527('0x6c'));}switch(_0x4b94d8[_0x1527('0x6d')]){case'called':_0x22810a[_0x1527('0x6e')]=_0x1527('0x6f');break;case'complete':case'connect':_0x22810a['Call_Result']='Answered';break;case'rejected':_0x22810a['Call_Result']='Rejected';break;case _0x1527('0x70'):_0x22810a[_0x1527('0x6e')]=_0x1527('0x71');break;case _0x1527('0x72'):_0x22810a['Call_Result']=_0x1527('0x73');default:}_0x22810a[_0x1527('0x74')]=(_0x3c49a9===_0x1527('0x75')?moment(_0x4b94d8['starttime'])[_0x1527('0x6b')](_0x1527('0x6a')):moment(_0x4b94d8[_0x1527('0x76')])[_0x1527('0x6b')](_0x1527('0x6a')))||moment()[_0x1527('0x6b')](_0x1527('0x6a'));_0x22810a[_0x1527('0x77')]=_0x3c49a9||_0x1527('0x78');_0x22810a=_[_0x1527('0x79')](_0x22810a,getCustomFields(_0x4cbbcc[_0x1527('0x7a')],_0x4b94d8));return request({'method':_0x1527('0x27'),'uri':_0x1527('0x42')+_0x190723+_0x1527('0x7b'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5f26f0},'body':{'data':[_0x22810a]},'json':!![]})[_0x1527('0x2b')](function(_0x2dafdb){if(_0x2dafdb&&_0x2dafdb[_0x1527('0x41')][0x0][_0x1527('0x48')]===_0x1527('0x49')){logger[_0x1527('0x30')]('Call\x20created!');return{'id':_0x2dafdb[_0x1527('0x41')][0x0]['details']['id']};}})[_0x1527('0x2c')](function(_0x1e8125){logger[_0x1527('0x30')](_0x1527('0x7c'),_0x1e8125[_0x1527('0x2f')]);console[_0x1527('0x4d')](_0x1527('0x7c'),_0x1e8125);});}exports['queue']=function(_0x353a49,_0x4bb3c9,_0x4f8e59,_0x248912,_0x504a1f,_0x3b5d28){var _0x5ae325,_0x31b1a9,_0xe1453f;_0x3b5d28['host']=intUtil[_0x1527('0x7d')](_0x3b5d28[_0x1527('0x7e')]);_0x3b5d28[_0x1527('0x7f')]=intUtil[_0x1527('0x7d')](_0x3b5d28[_0x1527('0x7f')]);if(_0x504a1f&&_0x504a1f['monitor_format']){logger[_0x1527('0x30')]('[QUEUE]',_0x1527('0x80'));_0x4bb3c9[_0x1527('0x81')]=_0x3b5d28[_0x1527('0x7f')]+_0x1527('0x82')+_0x4bb3c9[_0x1527('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x4bb3c9[_0x1527('0x83')]);}else{_0x4bb3c9[_0x1527('0x81')]='';}var _0x55bda4=_0x3b5d28[_0x1527('0x7e')]===_0x1527('0x84')?'eu':_0x1527('0x85');return getAccessToken(_0x3b5d28)[_0x1527('0x2b')](function(_0x27fbe8){_0xe1453f=_0x27fbe8;return getUser(_0xe1453f,_0x55bda4,_0x3b5d28,_0x248912['email']);})[_0x1527('0x2b')](function(_0x268db3){_0x5ae325=_0x268db3;logger['info'](_0x1527('0x86'),_0x5ae325['id']);return getEndUser(_0xe1453f,_0x55bda4,_0x3b5d28,_0x4bb3c9['calleridname'],_0x4bb3c9[_0x1527('0x87')],_0x5ae325,_0x4f8e59);})['then'](function(_0xb38ed3){_0x31b1a9=_0xb38ed3;return getCall(_0xe1453f,_0x55bda4,_0x3b5d28,_0x5ae325,_0x31b1a9,_0x4f8e59,_0x4bb3c9,'Inbound');})[_0x1527('0x2b')](function(_0x430c88){if(_0x430c88){logger[_0x1527('0x30')]('The\x20Call\x20ID\x20is:',_0x430c88['id']);logger['info'](_0x1527('0x88'),_0x1527('0x89'));emit(util[_0x1527('0x6b')]('user:%s',_0x248912['name']),_0x1527('0x8a'),{'uri':_0x1527('0x8b')+_0x3b5d28[_0x1527('0x7e')]+'/crm/EntityInfo.do?module=Calls&id='+_0x430c88['id']});}})['catch'](function(_0x565584){logger['error']('[QUEUE]',JSON[_0x1527('0xd')](_0x565584));});};exports['outbound']=function(_0x509cd1,_0x136713,_0x524684,_0x341b81,_0x2a76e0,_0x3fea2e,_0x55b1f8){var _0x3d7327,_0xd0fd6d,_0x3bda07;_0x3fea2e[_0x1527('0x7e')]=intUtil[_0x1527('0x7d')](_0x3fea2e[_0x1527('0x7e')]);_0x3fea2e[_0x1527('0x7f')]=intUtil[_0x1527('0x7d')](_0x3fea2e[_0x1527('0x7f')]);if(_0x55b1f8&&_0x55b1f8[_0x1527('0x8c')]&&_0x55b1f8['recordingFormat']!==_0x1527('0x8d')){logger[_0x1527('0x30')]('[OUTBOUND]',_0x1527('0x80'));_0x136713['recordingURL']=_0x3fea2e[_0x1527('0x7f')]+'/api/voice/recordings/'+_0x136713['uniqueid']+_0x1527('0x8e')+md5(_0x136713['uniqueid']);}var _0x48f8d9=_0x3fea2e[_0x1527('0x7e')]===_0x1527('0x84')?'eu':_0x1527('0x85');return getAccessToken(_0x3fea2e)[_0x1527('0x2b')](function(_0x5bf6dc){_0x3bda07=_0x5bf6dc;return getUser(_0x3bda07,_0x48f8d9,_0x3fea2e,_0x341b81['email']);})[_0x1527('0x2b')](function(_0x159ef0){_0x3d7327=_0x159ef0;logger['info'](_0x1527('0x86'),_0x3d7327['id']);return getEndUser(_0x3bda07,_0x48f8d9,_0x3fea2e,_0x136713[_0x1527('0x8f')],_0x136713[_0x1527('0x90')],_0x3d7327,_0x524684);})[_0x1527('0x2b')](function(_0x55a0df){_0xd0fd6d=_0x55a0df;return getCall(_0x3bda07,_0x48f8d9,_0x3fea2e,_0x3d7327,_0xd0fd6d,_0x524684,_0x136713,_0x1527('0x91'));})[_0x1527('0x2b')](function(_0x4cb24c){if(_0x4cb24c){logger[_0x1527('0x30')](_0x1527('0x92'),_0x4cb24c['id']);logger[_0x1527('0x30')](_0x1527('0x93'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1527('0x6b')](_0x1527('0x94'),_0x341b81[_0x1527('0x1b')]),'trigger:browser:url',{'uri':_0x1527('0x8b')+_0x3fea2e[_0x1527('0x7e')]+_0x1527('0x95')+_0x4cb24c['id']});}})['catch'](function(_0xe62d26){logger[_0x1527('0x2d')]('[OUTBOUND]',JSON[_0x1527('0xd')](_0xe62d26));});};exports[_0x1527('0x96')]=function(_0x1eee37,_0x40a755,_0x1b1e84,_0x2a7ca1,_0x4060a5,_0x533088){var _0x446480,_0x4d6f92,_0x1f7ea2;_0x533088[_0x1527('0x7e')]=intUtil['stripTrailingSlash'](_0x533088[_0x1527('0x7e')]);_0x533088['serverUrl']=intUtil[_0x1527('0x7d')](_0x533088['serverUrl']);if(_0x4060a5&&_0x4060a5[_0x1527('0x97')]){logger['info']('['+_0x40a755[_0x1527('0x6d')][_0x1527('0x98')]()+']',_0x1527('0x80'));_0x40a755['recordingURL']=_0x533088[_0x1527('0x7f')]+_0x1527('0x82')+_0x40a755[_0x1527('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x40a755[_0x1527('0x83')]);}else{_0x40a755[_0x1527('0x81')]='';}var _0x1998a3=_0x533088[_0x1527('0x7e')]==='zoho.eu'?'eu':_0x1527('0x85');return getAccessToken(_0x533088)['then'](function(_0x293fb8){_0x1f7ea2=_0x293fb8;return getUser(_0x1f7ea2,_0x1998a3,_0x533088);})['then'](function(_0x8da139){_0x446480=_0x8da139;logger[_0x1527('0x30')](_0x1527('0x86'),_0x446480['id']);return getEndUser(_0x1f7ea2,_0x1998a3,_0x533088,_0x40a755['calleridname'],_0x40a755['calleridnum'],_0x446480,_0x1b1e84);})[_0x1527('0x2b')](function(_0x9ed29c){_0x4d6f92=_0x9ed29c;return getCall(_0x1f7ea2,_0x1998a3,_0x533088,_0x446480,_0x4d6f92,_0x1b1e84,_0x40a755,'Inbound');})['then'](function(_0x53d21d){if(_0x53d21d){logger[_0x1527('0x30')](_0x1527('0x92'),_0x53d21d['id']);}})['catch'](function(_0x326c63){logger[_0x1527('0x2d')]('['+_0x40a755['lastevent'][_0x1527('0x98')]()+']',JSON[_0x1527('0xd')](_0x326c63));});}; \ 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 aa2925d..de02e38 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 _0xab0f=['%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','Script','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info'];(function(_0xa89d86,_0x370632){var _0x298469=function(_0x572e6b){while(--_0x572e6b){_0xa89d86['push'](_0xa89d86['shift']());}};_0x298469(++_0x370632);}(_0xab0f,0xaa));var _0xfab0=function(_0x586906,_0x1db8f1){_0x586906=_0x586906-0x0;var _0x4015a5=_0xab0f[_0x586906];return _0x4015a5;};'use strict';var util=require(_0xfab0('0x0'));var sh=require(_0xfab0('0x1'));var Mustache=require(_0xfab0('0x2'));var logger=require(_0xfab0('0x3'))(_0xfab0('0x4'));exports[_0xfab0('0x5')]=function(_0x974015,_0x324a45){var _0xcf9232=_0x974015['data2']?_0x974015['data2']:_0xfab0('0x6');var _0x2c8241=_0x974015[_0xfab0('0x7')]?Mustache['render'](_0x974015[_0xfab0('0x7')],_0x324a45):_0x324a45;sh[_0xfab0('0x5')](_0x2c8241,function(_0x598f1f,_0x1c1d9a,_0x69d764){if(_0x598f1f!==0x0){logger[_0xfab0('0x8')](util[_0xfab0('0x9')](_0xfab0('0xa'),_0xcf9232,_0x2c8241,_0x598f1f,_0x69d764));}else{logger[_0xfab0('0xb')](util[_0xfab0('0x9')](_0xfab0('0xc'),_0xcf9232,_0x2c8241,_0x1c1d9a));}});}; \ No newline at end of file +var _0x5cb9=['%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info'];(function(_0x2aedd8,_0x1583f9){var _0x4720ed=function(_0xf25db2){while(--_0xf25db2){_0x2aedd8['push'](_0x2aedd8['shift']());}};_0x4720ed(++_0x1583f9);}(_0x5cb9,0x12d));var _0x95cb=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x5cb9[_0x3070dc];return _0x431489;};'use strict';var util=require(_0x95cb('0x0'));var sh=require(_0x95cb('0x1'));var Mustache=require(_0x95cb('0x2'));var logger=require(_0x95cb('0x3'))(_0x95cb('0x4'));exports[_0x95cb('0x5')]=function(_0x57dfa0,_0x30231e){var _0x12babe=_0x57dfa0[_0x95cb('0x6')]?_0x57dfa0[_0x95cb('0x6')]:_0x95cb('0x7');var _0x3f1c2d=_0x57dfa0[_0x95cb('0x8')]?Mustache[_0x95cb('0x9')](_0x57dfa0['data3'],_0x30231e):_0x30231e;sh[_0x95cb('0x5')](_0x3f1c2d,function(_0x56e099,_0x1a6b6d,_0x38c440){if(_0x56e099!==0x0){logger[_0x95cb('0xa')](util[_0x95cb('0xb')](_0x95cb('0xc'),_0x12babe,_0x3f1c2d,_0x56e099,_0x38c440));}else{logger[_0x95cb('0xd')](util[_0x95cb('0xb')](_0x95cb('0xe'),_0x12babe,_0x3f1c2d,_0x1a6b6d));}});}; \ 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 881575e..3729782 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 _0xccff=['toUpperCase','data2','data5','headers','parse','render','data6','stack','GET','DELETE','PUT','data7','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','body','object','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','request-promise','util','lodash','../../../../config/logger','trigger','data1'];(function(_0x374870,_0x82a474){var _0x4de8f4=function(_0xc42b7){while(--_0xc42b7){_0x374870['push'](_0x374870['shift']());}};_0x4de8f4(++_0x82a474);}(_0xccff,0x17a));var _0xfccf=function(_0x26ac72,_0x482803){_0x26ac72=_0x26ac72-0x0;var _0x25fc90=_0xccff[_0x26ac72];return _0x25fc90;};'use strict';var rp=require(_0xfccf('0x0'));var util=require(_0xfccf('0x1'));var _=require(_0xfccf('0x2'));var Mustache=require('mustache');var logger=require(_0xfccf('0x3'))(_0xfccf('0x4'));exports['exec']=function(_0xa0342a,_0x32f9a9){var _0x263ee7,_0x4d49d0;var _0x33ad63={'method':_0xa0342a[_0xfccf('0x5')][_0xfccf('0x6')](),'uri':Mustache['render'](_0xa0342a[_0xfccf('0x7')],_0x32f9a9),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xa0342a[_0xfccf('0x8')])==='number'&&parseInt(_0xa0342a[_0xfccf('0x8')])>=0x1&&parseInt(_0xa0342a['data5'])<=0xa?parseInt(_0xa0342a['data5'])*0x3e8:0x5*0x3e8};try{_0x33ad63[_0xfccf('0x9')]=_0xa0342a['data6']?JSON[_0xfccf('0xa')](Mustache[_0xfccf('0xb')](_0xa0342a[_0xfccf('0xc')],_0x32f9a9)):{};}catch(_0x8b073a){logger['error'](_0x8b073a[_0xfccf('0xd')]);}switch(_0xa0342a[_0xfccf('0x5')]['toUpperCase']()){case _0xfccf('0xe'):case _0xfccf('0xf'):_0x263ee7=null;_0x33ad63['qs']=_0x32f9a9;break;case'POST':case _0xfccf('0x10'):if(_0xa0342a[_0xfccf('0x11')]){try{_0x263ee7=JSON[_0xfccf('0xa')](Mustache['render'](_0xa0342a[_0xfccf('0x11')],_0x32f9a9));_0x33ad63['body']=_0x263ee7;}catch(_0xe6fc61){logger[_0xfccf('0x12')](_0xe6fc61['stack']);logger[_0xfccf('0x12')](_0xfccf('0x13'));}}else{_0x263ee7=_0x32f9a9;_0x33ad63['body']=_0x263ee7;}break;}logger[_0xfccf('0x14')](util[_0xfccf('0x15')](_0xfccf('0x16'),_0xa0342a[_0xfccf('0x5')],_0xa0342a[_0xfccf('0x7')],JSON[_0xfccf('0x17')](_0x33ad63)));rp(_0x33ad63)[_0xfccf('0x18')](function(_0x40cd64){_0x263ee7=!_['isNil'](_0x263ee7)?_0xfccf('0x19')+_0x263ee7:'';_0x4d49d0=typeof _0x40cd64[_0xfccf('0x1a')]===_0xfccf('0x1b')?JSON[_0xfccf('0x17')](_0x40cd64['body']):_0x40cd64['body'];logger[_0xfccf('0x14')](util[_0xfccf('0x15')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0xa0342a[_0xfccf('0x5')],_0xa0342a[_0xfccf('0x7')],_0x40cd64[_0xfccf('0x1c')],_0x4d49d0));})[_0xfccf('0x1d')](function(_0x2251dd){logger[_0xfccf('0x12')](util[_0xfccf('0x15')](_0xfccf('0x1e'),_0xa0342a[_0xfccf('0x5')],_0xa0342a[_0xfccf('0x7')],_0x2251dd[_0xfccf('0x1c')],_0x2251dd[_0xfccf('0x1f')],_0x2251dd['message']));});}; \ No newline at end of file +var _0x39d7=['message','request-promise','lodash','trigger','exec','toUpperCase','data2','data5','headers','data6','parse','render','error','stack','data1','GET','DELETE','PUT','data7','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil',',\x20request\x20body:\x20','object','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name'];(function(_0x174c12,_0x4ea5e1){var _0xe9411e=function(_0x557ca1){while(--_0x557ca1){_0x174c12['push'](_0x174c12['shift']());}};_0xe9411e(++_0x4ea5e1);}(_0x39d7,0x194));var _0x739d=function(_0x4b1272,_0x4f3e0d){_0x4b1272=_0x4b1272-0x0;var _0x2c9908=_0x39d7[_0x4b1272];return _0x2c9908;};'use strict';var rp=require(_0x739d('0x0'));var util=require('util');var _=require(_0x739d('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x739d('0x2'));exports[_0x739d('0x3')]=function(_0x9f23ec,_0x4490c3){var _0x53e0e7,_0x2f462c;var _0x1a15f0={'method':_0x9f23ec['data1'][_0x739d('0x4')](),'uri':Mustache['render'](_0x9f23ec[_0x739d('0x5')],_0x4490c3),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9f23ec[_0x739d('0x6')])==='number'&&parseInt(_0x9f23ec[_0x739d('0x6')])>=0x1&&parseInt(_0x9f23ec[_0x739d('0x6')])<=0xa?parseInt(_0x9f23ec[_0x739d('0x6')])*0x3e8:0x5*0x3e8};try{_0x1a15f0[_0x739d('0x7')]=_0x9f23ec[_0x739d('0x8')]?JSON[_0x739d('0x9')](Mustache[_0x739d('0xa')](_0x9f23ec[_0x739d('0x8')],_0x4490c3)):{};}catch(_0x32f044){logger[_0x739d('0xb')](_0x32f044[_0x739d('0xc')]);}switch(_0x9f23ec[_0x739d('0xd')][_0x739d('0x4')]()){case _0x739d('0xe'):case _0x739d('0xf'):_0x53e0e7=null;_0x1a15f0['qs']=_0x4490c3;break;case'POST':case _0x739d('0x10'):if(_0x9f23ec['data7']){try{_0x53e0e7=JSON[_0x739d('0x9')](Mustache[_0x739d('0xa')](_0x9f23ec[_0x739d('0x11')],_0x4490c3));_0x1a15f0[_0x739d('0x12')]=_0x53e0e7;}catch(_0x114f67){logger['error'](_0x114f67[_0x739d('0xc')]);logger[_0x739d('0xb')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x53e0e7=_0x4490c3;_0x1a15f0[_0x739d('0x12')]=_0x53e0e7;}break;}logger[_0x739d('0x13')](util[_0x739d('0x14')](_0x739d('0x15'),_0x9f23ec[_0x739d('0xd')],_0x9f23ec['data2'],JSON[_0x739d('0x16')](_0x1a15f0)));rp(_0x1a15f0)['then'](function(_0x4e9443){_0x53e0e7=!_[_0x739d('0x17')](_0x53e0e7)?_0x739d('0x18')+_0x53e0e7:'';_0x2f462c=typeof _0x4e9443[_0x739d('0x12')]===_0x739d('0x19')?JSON['stringify'](_0x4e9443[_0x739d('0x12')]):_0x4e9443[_0x739d('0x12')];logger[_0x739d('0x13')](util[_0x739d('0x14')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x9f23ec[_0x739d('0xd')],_0x9f23ec[_0x739d('0x5')],_0x4e9443[_0x739d('0x1a')],_0x2f462c));})[_0x739d('0x1b')](function(_0x2b1220){logger[_0x739d('0xb')](util['format'](_0x739d('0x1c'),_0x9f23ec['data1'],_0x9f23ec[_0x739d('0x5')],_0x2b1220[_0x739d('0x1a')],_0x2b1220[_0x739d('0x1d')],_0x2b1220[_0x739d('0x1e')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index c8735bb..136fd3a 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 _0x572d=['rpc','error','message','catch','exports','bluebird','../../config/logger','routing','client','http','Request','request','then','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x572d,0x1a9));var _0xd572=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0x572d[_0x2053ea];return _0x2232c4;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xd572('0x0'));var logger=require(_0xd572('0x1'))(_0xd572('0x2'));var client=jayson[_0xd572('0x3')][_0xd572('0x4')]({'port':0x2329});client[_0xd572('0x5')]=function(_0x468d9f,_0x15f66d){return new BPromise(function(_0x265445,_0x318600){return client[_0xd572('0x6')](_0x468d9f,_0x15f66d)[_0xd572('0x7')](function(_0x56181e){logger[_0xd572('0x8')](_0xd572('0x9'),_0xd572('0x2'),_0x468d9f,_0x15f66d,_0x56181e);if(_0x56181e[_0xd572('0xa')]){logger['error'](_0xd572('0x9'),_0xd572('0x2'),_0x468d9f,_0x56181e[_0xd572('0xa')][_0xd572('0xb')],_0x15f66d);return _0x318600(_0x56181e['error'][_0xd572('0xb')]);}else{return _0x265445(_0x56181e['result']);}})[_0xd572('0xc')](function(_0x423e79){logger[_0xd572('0xa')](_0xd572('0x9'),_0xd572('0x2'),_0x468d9f,_0x423e79,_0x15f66d);return _0x318600(_0x423e79);});});};module[_0xd572('0xd')]=client; \ No newline at end of file +var _0xd9c3=['client','Request','request','then','debug','rpc','error','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x2d2337,_0x33cec4){var _0x464c53=function(_0x31ef6f){while(--_0x31ef6f){_0x2d2337['push'](_0x2d2337['shift']());}};_0x464c53(++_0x33cec4);}(_0xd9c3,0x1ca));var _0x3d9c=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xd9c3[_0x2b7764];return _0x848dcb;};'use strict';var jayson=require(_0x3d9c('0x0'));var BPromise=require(_0x3d9c('0x1'));var logger=require(_0x3d9c('0x2'))(_0x3d9c('0x3'));var client=jayson[_0x3d9c('0x4')]['http']({'port':0x2329});client[_0x3d9c('0x5')]=function(_0x572a68,_0x82f32c){return new BPromise(function(_0x4a906b,_0x3a6f2e){return client[_0x3d9c('0x6')](_0x572a68,_0x82f32c)[_0x3d9c('0x7')](function(_0x4f323e){logger[_0x3d9c('0x8')](_0x3d9c('0x9'),'routing',_0x572a68,_0x82f32c,_0x4f323e);if(_0x4f323e[_0x3d9c('0xa')]){logger[_0x3d9c('0xa')](_0x3d9c('0x9'),'routing',_0x572a68,_0x4f323e[_0x3d9c('0xa')]['message'],_0x82f32c);return _0x3a6f2e(_0x4f323e[_0x3d9c('0xa')]['message']);}else{return _0x4a906b(_0x4f323e[_0x3d9c('0xb')]);}})[_0x3d9c('0xc')](function(_0x531553){logger['error']('rpc',_0x3d9c('0x3'),_0x572a68,_0x531553,_0x82f32c);return _0x3a6f2e(_0x531553);});});};module[_0x3d9c('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 18de2fc..6448260 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 _0xcf54=['./rpc/setting','resolve','then','initMailAccounts','refresh','mailAccounts','catch','./server','./realtime','./lib/email','./rpc/mailAccount'];(function(_0x23e4c8,_0x32d27c){var _0x39b803=function(_0x277dd1){while(--_0x277dd1){_0x23e4c8['push'](_0x23e4c8['shift']());}};_0x39b803(++_0x32d27c);}(_0xcf54,0x125));var _0x4cf5=function(_0x10b317,_0x2adf32){_0x10b317=_0x10b317-0x0;var _0x1e3054=_0xcf54[_0x10b317];return _0x1e3054;};'use strict';var BPromise=require('bluebird');var server=require(_0x4cf5('0x0'));var Realtime=require(_0x4cf5('0x1'));var EmailChannel=require(_0x4cf5('0x2'));var mailAccount=require(_0x4cf5('0x3'));var setting=require(_0x4cf5('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x4cf5('0x5')]()[_0x4cf5('0x6')](mailAccount['getMailAccounts']())[_0x4cf5('0x6')](realtime[_0x4cf5('0x7')]())[_0x4cf5('0x6')](function(){email[_0x4cf5('0x8')](realtime[_0x4cf5('0x9')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x4cf5('0x6')](function(){return initRealtime();})[_0x4cf5('0x6')](function(){return setting['getSettings']();})['then'](function(_0x16a089){return setInterval(initRealtime,_0x16a089['loginMailFrequency']*0x3e8);})[_0x4cf5('0xa')](function(_0xe25cc7){console['log'](_0xe25cc7);});}main(); \ No newline at end of file +var _0xa1d0=['bluebird','./realtime','./rpc/mailAccount','./rpc/setting','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','log'];(function(_0x6d6d44,_0x24c937){var _0x2d738a=function(_0x55d14d){while(--_0x55d14d){_0x6d6d44['push'](_0x6d6d44['shift']());}};_0x2d738a(++_0x24c937);}(_0xa1d0,0x1a4));var _0x0a1d=function(_0x22a300,_0x90444){_0x22a300=_0x22a300-0x0;var _0x3499a5=_0xa1d0[_0x22a300];return _0x3499a5;};'use strict';var BPromise=require(_0x0a1d('0x0'));var server=require('./server');var Realtime=require(_0x0a1d('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x0a1d('0x2'));var setting=require(_0x0a1d('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x0a1d('0x4')]()[_0x0a1d('0x5')](mailAccount[_0x0a1d('0x6')]())[_0x0a1d('0x5')](realtime[_0x0a1d('0x7')]())[_0x0a1d('0x5')](function(){email[_0x0a1d('0x8')](realtime[_0x0a1d('0x9')]);return realtime;});}function main(){return server[_0x0a1d('0xa')](realtime,email)[_0x0a1d('0x5')](function(){return initRealtime();})[_0x0a1d('0x5')](function(){return setting[_0x0a1d('0xb')]();})[_0x0a1d('0x5')](function(_0x57aad6){return setInterval(initRealtime,_0x57aad6[_0x0a1d('0xc')]*0x3e8);})[_0x0a1d('0xd')](function(_0x2c3a1d){console[_0x0a1d('0xe')](_0x2c3a1d);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 7e23ab2..2272098 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 _0x8be0=['from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','sendMail','send','verifySmtp','Smtp','smtp','verify','verified','exports','bluebird','md5','ioredis','../../../config/environment','email','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','name','key','active','Imap','messageStatus','total','mailAccount:update','prototype','refresh','hasOwnProperty','handleImapBox','handleImapEmail','bind','end','handleImapEnd','error','handleImapError','isNil','status','emit','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName'];(function(_0x45b1ba,_0x5a6a21){var _0x145ddb=function(_0x650d42){while(--_0x650d42){_0x45b1ba['push'](_0x45b1ba['shift']());}};_0x145ddb(++_0x5a6a21);}(_0x8be0,0x18a));var _0x08be=function(_0x5dcf70,_0x46dffb){_0x5dcf70=_0x5dcf70-0x0;var _0x43792e=_0x8be0[_0x5dcf70];return _0x43792e;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x08be('0x0'));var md5=require(_0x08be('0x1'));var Redis=require(_0x08be('0x2'));var config=require(_0x08be('0x3'));var logger=require('../../../config/logger')(_0x08be('0x4'));config[_0x08be('0x5')]=_['defaults'](config[_0x08be('0x5')],{'host':_0x08be('0x6'),'port':0x18eb});var io=require(_0x08be('0x7'))(new Redis(config[_0x08be('0x5')]));var EmailImap=require(_0x08be('0x8'));var EmailSmtp=require(_0x08be('0x9'));var mailAccount=require(_0x08be('0xa'));var md5Accounts={};function EmailChannel(_0x3c976f){logger[_0x08be('0xb')](_0x08be('0xc'));this[_0x08be('0xd')]=_0x3c976f[_0x08be('0xd')];this[_0x08be('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x3bae9b){var _0x584aed=this[_0x08be('0xd')][_0x3bae9b];var _0x5e69c4={'id':_0x584aed['id'],'name':_0x584aed[_0x08be('0xf')],'key':_0x584aed[_0x08be('0x10')],'active':_0x584aed[_0x08be('0x11')],'Imap':{'status':_0x584aed['Imap']['status'],'messageStatus':_0x584aed[_0x08be('0x12')][_0x08be('0x13')],'total':_0x584aed[_0x08be('0x12')][_0x08be('0x14')]}};if(_['isNil'](md5Accounts[_0x3bae9b])){md5Accounts[_0x3bae9b]={};}var _0x5bebe3=md5(JSON['stringify'](_0x5e69c4));if(md5Accounts[_0x3bae9b][_0x08be('0x1')]!==_0x5bebe3){md5Accounts[_0x3bae9b][_0x08be('0x1')]=_0x5bebe3;io['emit'](_0x08be('0x15'),_0x5e69c4);}};EmailChannel[_0x08be('0x16')][_0x08be('0x17')]=function(_0x236e60){for(var _0x3192f4 in _0x236e60){if(_0x236e60[_0x08be('0x18')](_0x3192f4)){if(_0x236e60[_0x3192f4][_0x08be('0x12')]&&_0x236e60[_0x3192f4]['active']){var _0x4fbc80=_0x236e60[_0x3192f4][_0x08be('0x12')];if(!this[_0x08be('0xe')]['hasOwnProperty'](_0x4fbc80['id'])){this[_0x08be('0xe')][_0x4fbc80['id']]=new EmailImap(_0x4fbc80,_0x236e60[_0x3192f4][_0x08be('0x4')]);this[_0x08be('0xe')][_0x4fbc80['id']]['on']('box',this[_0x08be('0x19')]['bind'](this,_0x3192f4));this[_0x08be('0xe')][_0x4fbc80['id']]['on'](_0x08be('0x4'),this[_0x08be('0x1a')][_0x08be('0x1b')](this,_0x3192f4));this[_0x08be('0xe')][_0x4fbc80['id']]['on'](_0x08be('0x1c'),this[_0x08be('0x1d')][_0x08be('0x1b')](this,_0x3192f4));this[_0x08be('0xe')][_0x4fbc80['id']]['on'](_0x08be('0x1e'),this[_0x08be('0x1f')]['bind'](this,_0x3192f4));}}else{if(_[_0x08be('0x20')](this[_0x08be('0xd')][_0x3192f4][_0x08be('0x12')])){this[_0x08be('0xd')][_0x3192f4]['Imap']={};}this['mailAccounts'][_0x3192f4][_0x08be('0x12')][_0x08be('0x21')]='disabled';this['mailAccounts'][_0x3192f4]['Imap']['messageStatus']='';this[_0x08be('0x22')](_0x3192f4);}}}};EmailChannel['prototype'][_0x08be('0x19')]=function(_0x5cc738,_0x5a3ccc){if(this[_0x08be('0xd')][_0x5cc738]){this[_0x08be('0xd')][_0x5cc738][_0x08be('0x12')][_0x08be('0x21')]='connected';this[_0x08be('0xd')][_0x5cc738][_0x08be('0x12')][_0x08be('0x13')]=_0x5a3ccc[_0x08be('0xf')];if(_0x5a3ccc[_0x08be('0x23')]){this[_0x08be('0xd')][_0x5cc738]['Imap']['total']=_0x5a3ccc[_0x08be('0x23')][_0x08be('0x14')];}return this[_0x08be('0x22')](_0x5cc738);}};EmailChannel[_0x08be('0x16')]['handleImapEmail']=function(_0x2cf5c3,_0x339a18){logger[_0x08be('0xb')](_0x08be('0x24'),_0x339a18['firstName'],_0x339a18[_0x08be('0x25')],_0x339a18[_0x08be('0x26')],_0x2cf5c3);if(this[_0x08be('0xd')][_0x2cf5c3]){return mailAccount[_0x08be('0x27')](_0x2cf5c3,_0x339a18)[_0x08be('0x28')](function(_0x1a1bb3){if(_0x1a1bb3){logger['info'](_0x08be('0x29'));}})[_0x08be('0x2a')](function(_0x19e7c9){logger[_0x08be('0x1e')](_0x08be('0x2b'),JSON[_0x08be('0x2c')](_0x19e7c9));});}};EmailChannel[_0x08be('0x16')][_0x08be('0x1d')]=function(_0x2c88cd){if(this[_0x08be('0xd')][_0x2c88cd]&&this[_0x08be('0xd')][_0x2c88cd]['Imap']){if(this['imapAccounts'][this[_0x08be('0xd')][_0x2c88cd][_0x08be('0x12')]['id']]){delete this[_0x08be('0xe')][this[_0x08be('0xd')][_0x2c88cd][_0x08be('0x12')]['id']];}this[_0x08be('0xd')][_0x2c88cd][_0x08be('0x12')][_0x08be('0x2d')]=moment();this[_0x08be('0x22')](_0x2c88cd);}};EmailChannel[_0x08be('0x16')][_0x08be('0x1f')]=function(_0x63724,_0x165dfd){if(this[_0x08be('0xd')][_0x63724]){this['mailAccounts'][_0x63724][_0x08be('0x12')][_0x08be('0x21')]=_0x08be('0x1e');this[_0x08be('0xd')][_0x63724]['Imap']['messageStatus']=_0x165dfd;return this[_0x08be('0x22')](_0x63724);}};EmailChannel[_0x08be('0x16')][_0x08be('0x2e')]=function(_0x59003f,_0x38551c){return this['smtp'][_0x08be('0x2f')](_0x59003f,_0x38551c);};EmailChannel[_0x08be('0x16')][_0x08be('0x30')]=function(_0x155228){var _0x185914=this;if(this[_0x08be('0xd')][_0x155228['id']]){if(_[_0x08be('0x20')](this[_0x08be('0xd')][_0x155228['id']][_0x08be('0x31')])){this[_0x08be('0xd')][_0x155228['id']]['Smtp']={};}this[_0x08be('0xd')][_0x155228['id']]['Smtp'][_0x08be('0x2d')]=moment();return new BPromise(function(_0x2aa38a,_0x5bb92f){return _0x185914[_0x08be('0x32')][_0x08be('0x33')](_0x155228)['then'](function(_0x323751){_0x185914[_0x08be('0xd')][_0x155228['id']][_0x08be('0x31')]['status']=_0x08be('0x34');_0x185914[_0x08be('0xd')][_0x155228['id']]['Smtp']['messageStatus']='';_0x185914[_0x08be('0x22')](_0x155228['id']);_0x2aa38a(_0x323751);})['catch'](function(_0x5eb720){_0x185914[_0x08be('0xd')][_0x155228['id']][_0x08be('0x31')][_0x08be('0x21')]=_0x08be('0x1e');_0x185914[_0x08be('0xd')][_0x155228['id']][_0x08be('0x31')][_0x08be('0x13')]=_0x5eb720;_0x185914[_0x08be('0x22')](_0x155228['id']);_0x5bb92f(_0x5eb720);});});}return this[_0x08be('0x32')][_0x08be('0x33')](_0x155228);};module[_0x08be('0x35')]=EmailChannel; \ No newline at end of file +var _0x6d20=['./smtp','../rpc/mailAccount','info','mailAccounts','prototype','name','key','active','Imap','status','messageStatus','total','stringify','emit','mailAccount:update','refresh','hasOwnProperty','imapAccounts','box','handleImapBox','bind','email','handleImapEmail','end','handleImapEnd','error','handleImapError','isNil','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','smtp','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./imap'];(function(_0x46b22a,_0x5bf83a){var _0x44c2e8=function(_0x21b6fc){while(--_0x21b6fc){_0x46b22a['push'](_0x46b22a['shift']());}};_0x44c2e8(++_0x5bf83a);}(_0x6d20,0x18b));var _0x06d2=function(_0x23d957,_0x5d2176){_0x23d957=_0x23d957-0x0;var _0x568ff2=_0x6d20[_0x23d957];return _0x568ff2;};'use strict';var _=require(_0x06d2('0x0'));var moment=require(_0x06d2('0x1'));var BPromise=require(_0x06d2('0x2'));var md5=require(_0x06d2('0x3'));var Redis=require('ioredis');var config=require(_0x06d2('0x4'));var logger=require(_0x06d2('0x5'))('email');config[_0x06d2('0x6')]=_[_0x06d2('0x7')](config['redis'],{'host':_0x06d2('0x8'),'port':0x18eb});var io=require(_0x06d2('0x9'))(new Redis(config[_0x06d2('0x6')]));var EmailImap=require(_0x06d2('0xa'));var EmailSmtp=require(_0x06d2('0xb'));var mailAccount=require(_0x06d2('0xc'));var md5Accounts={};function EmailChannel(_0x220943){logger[_0x06d2('0xd')]('start\x20email\x20channel');this['mailAccounts']=_0x220943[_0x06d2('0xe')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel[_0x06d2('0xf')]['emit']=function(_0xdf438a){var _0x19193c=this[_0x06d2('0xe')][_0xdf438a];var _0x4f672c={'id':_0x19193c['id'],'name':_0x19193c[_0x06d2('0x10')],'key':_0x19193c[_0x06d2('0x11')],'active':_0x19193c[_0x06d2('0x12')],'Imap':{'status':_0x19193c[_0x06d2('0x13')][_0x06d2('0x14')],'messageStatus':_0x19193c['Imap'][_0x06d2('0x15')],'total':_0x19193c[_0x06d2('0x13')][_0x06d2('0x16')]}};if(_['isNil'](md5Accounts[_0xdf438a])){md5Accounts[_0xdf438a]={};}var _0x17274f=md5(JSON[_0x06d2('0x17')](_0x4f672c));if(md5Accounts[_0xdf438a][_0x06d2('0x3')]!==_0x17274f){md5Accounts[_0xdf438a]['md5']=_0x17274f;io[_0x06d2('0x18')](_0x06d2('0x19'),_0x4f672c);}};EmailChannel[_0x06d2('0xf')][_0x06d2('0x1a')]=function(_0x1de85c){for(var _0x2800c7 in _0x1de85c){if(_0x1de85c[_0x06d2('0x1b')](_0x2800c7)){if(_0x1de85c[_0x2800c7]['Imap']&&_0x1de85c[_0x2800c7][_0x06d2('0x12')]){var _0x3042fb=_0x1de85c[_0x2800c7][_0x06d2('0x13')];if(!this['imapAccounts'][_0x06d2('0x1b')](_0x3042fb['id'])){this['imapAccounts'][_0x3042fb['id']]=new EmailImap(_0x3042fb,_0x1de85c[_0x2800c7]['email']);this[_0x06d2('0x1c')][_0x3042fb['id']]['on'](_0x06d2('0x1d'),this[_0x06d2('0x1e')][_0x06d2('0x1f')](this,_0x2800c7));this[_0x06d2('0x1c')][_0x3042fb['id']]['on'](_0x06d2('0x20'),this[_0x06d2('0x21')][_0x06d2('0x1f')](this,_0x2800c7));this[_0x06d2('0x1c')][_0x3042fb['id']]['on'](_0x06d2('0x22'),this[_0x06d2('0x23')][_0x06d2('0x1f')](this,_0x2800c7));this[_0x06d2('0x1c')][_0x3042fb['id']]['on'](_0x06d2('0x24'),this[_0x06d2('0x25')][_0x06d2('0x1f')](this,_0x2800c7));}}else{if(_[_0x06d2('0x26')](this[_0x06d2('0xe')][_0x2800c7]['Imap'])){this[_0x06d2('0xe')][_0x2800c7][_0x06d2('0x13')]={};}this['mailAccounts'][_0x2800c7][_0x06d2('0x13')][_0x06d2('0x14')]=_0x06d2('0x27');this[_0x06d2('0xe')][_0x2800c7][_0x06d2('0x13')]['messageStatus']='';this[_0x06d2('0x18')](_0x2800c7);}}}};EmailChannel[_0x06d2('0xf')][_0x06d2('0x1e')]=function(_0x5748e2,_0x370eb7){if(this[_0x06d2('0xe')][_0x5748e2]){this[_0x06d2('0xe')][_0x5748e2]['Imap'][_0x06d2('0x14')]=_0x06d2('0x28');this[_0x06d2('0xe')][_0x5748e2][_0x06d2('0x13')][_0x06d2('0x15')]=_0x370eb7['name'];if(_0x370eb7[_0x06d2('0x29')]){this[_0x06d2('0xe')][_0x5748e2][_0x06d2('0x13')][_0x06d2('0x16')]=_0x370eb7['messages'][_0x06d2('0x16')];}return this['emit'](_0x5748e2);}};EmailChannel[_0x06d2('0xf')][_0x06d2('0x21')]=function(_0x100207,_0x164dd1){logger[_0x06d2('0xd')](_0x06d2('0x2a'),_0x164dd1[_0x06d2('0x2b')],_0x164dd1[_0x06d2('0x2c')],_0x164dd1[_0x06d2('0x2d')],_0x100207);if(this['mailAccounts'][_0x100207]){return mailAccount['notify'](_0x100207,_0x164dd1)[_0x06d2('0x2e')](function(_0x48d193){if(_0x48d193){logger['info']('Mail\x20accepted\x20from\x20routing');}})[_0x06d2('0x2f')](function(_0xf2b92c){logger['error'](_0x06d2('0x30'),JSON[_0x06d2('0x17')](_0xf2b92c));});}};EmailChannel['prototype'][_0x06d2('0x23')]=function(_0x49bfe4){if(this[_0x06d2('0xe')][_0x49bfe4]&&this[_0x06d2('0xe')][_0x49bfe4][_0x06d2('0x13')]){if(this['imapAccounts'][this[_0x06d2('0xe')][_0x49bfe4][_0x06d2('0x13')]['id']]){delete this[_0x06d2('0x1c')][this['mailAccounts'][_0x49bfe4][_0x06d2('0x13')]['id']];}this[_0x06d2('0xe')][_0x49bfe4][_0x06d2('0x13')][_0x06d2('0x31')]=moment();this['emit'](_0x49bfe4);}};EmailChannel[_0x06d2('0xf')][_0x06d2('0x25')]=function(_0x406aee,_0x291bff){if(this['mailAccounts'][_0x406aee]){this[_0x06d2('0xe')][_0x406aee][_0x06d2('0x13')][_0x06d2('0x14')]=_0x06d2('0x24');this[_0x06d2('0xe')][_0x406aee]['Imap'][_0x06d2('0x15')]=_0x291bff;return this[_0x06d2('0x18')](_0x406aee);}};EmailChannel[_0x06d2('0xf')][_0x06d2('0x32')]=function(_0x309398,_0x58eaba){return this[_0x06d2('0x33')][_0x06d2('0x34')](_0x309398,_0x58eaba);};EmailChannel['prototype'][_0x06d2('0x35')]=function(_0x2eb6f3){var _0x442f65=this;if(this[_0x06d2('0xe')][_0x2eb6f3['id']]){if(_['isNil'](this[_0x06d2('0xe')][_0x2eb6f3['id']][_0x06d2('0x36')])){this[_0x06d2('0xe')][_0x2eb6f3['id']][_0x06d2('0x36')]={};}this[_0x06d2('0xe')][_0x2eb6f3['id']]['Smtp'][_0x06d2('0x31')]=moment();return new BPromise(function(_0xc0c57b,_0x5feb5c){return _0x442f65['smtp'][_0x06d2('0x37')](_0x2eb6f3)[_0x06d2('0x2e')](function(_0x3fc937){_0x442f65['mailAccounts'][_0x2eb6f3['id']][_0x06d2('0x36')]['status']=_0x06d2('0x38');_0x442f65[_0x06d2('0xe')][_0x2eb6f3['id']][_0x06d2('0x36')][_0x06d2('0x15')]='';_0x442f65[_0x06d2('0x18')](_0x2eb6f3['id']);_0xc0c57b(_0x3fc937);})[_0x06d2('0x2f')](function(_0x4071ad){_0x442f65['mailAccounts'][_0x2eb6f3['id']]['Smtp'][_0x06d2('0x14')]=_0x06d2('0x24');_0x442f65['mailAccounts'][_0x2eb6f3['id']][_0x06d2('0x36')][_0x06d2('0x15')]=_0x4071ad;_0x442f65[_0x06d2('0x18')](_0x2eb6f3['id']);_0x5feb5c(_0x4071ad);});});}return this[_0x06d2('0x33')]['verify'](_0x2eb6f3);};module[_0x06d2('0x39')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 80d87b2..08a82d1 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 _0x1e43=['readUnseen','handleError','search','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','parser','emit','handleCloseBox','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','randomstring','mailparser','Iconv','events','EventEmitter','./utils','../../../config/logger','email','INBOX','getAccount','imap','account','once','ready','handleReady','bind','end','handleEnd','error','connect','inherits','prototype','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','service','anonymous@xcally.com','openBox','mailbox','handleOpenBox','box'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1e43,0x1d1));var _0x31e4=function(_0x45ec0b,_0x260c5d){_0x45ec0b=_0x45ec0b-0x0;var _0x99a3d8=_0x1e43[_0x45ec0b];return _0x99a3d8;};'use strict';var fs=require('fs');var path=require(_0x31e4('0x0'));var util=require(_0x31e4('0x1'));var Imap=require('imap');var _=require('lodash');var rs=require(_0x31e4('0x2'));var simpleParser=require(_0x31e4('0x3'))['simpleParser'];var Iconv=require('iconv')[_0x31e4('0x4')];var EventEmitter=require(_0x31e4('0x5'))[_0x31e4('0x6')];var utils=require(_0x31e4('0x7'));var logger=require(_0x31e4('0x8'))(_0x31e4('0x9'));function EmailImap(_0x15aaf4,_0x2d5e43){this['mailbox']=_0x31e4('0xa');this['account']=this[_0x31e4('0xb')](_0x15aaf4,_0x2d5e43);this[_0x31e4('0xc')]=new Imap(this[_0x31e4('0xd')]);this[_0x31e4('0xc')][_0x31e4('0xe')](_0x31e4('0xf'),this[_0x31e4('0x10')][_0x31e4('0x11')](this));this[_0x31e4('0xc')][_0x31e4('0xe')](_0x31e4('0x12'),this[_0x31e4('0x13')][_0x31e4('0x11')](this));this[_0x31e4('0xc')]['on'](_0x31e4('0x14'),this['handleError']['bind'](this));this[_0x31e4('0xc')][_0x31e4('0x15')]();}util[_0x31e4('0x16')](EmailImap,EventEmitter);EmailImap[_0x31e4('0x17')][_0x31e4('0xb')]=function(_0x2af530,_0x1d3c64){var _0x47b9b6={'connTimeout':_0x2af530['connTimeout']?_0x2af530[_0x31e4('0x18')]*0x3e8:0x2710,'authTimeout':_0x2af530['authTimeout']?_0x2af530[_0x31e4('0x19')]*0x3e8:0x1388};if(_[_0x31e4('0x1a')](_0x2af530['service'])){if(_0x2af530[_0x31e4('0x1b')]){_0x47b9b6['user']=_0x2af530[_0x31e4('0x1c')];_0x47b9b6[_0x31e4('0x1d')]=_0x2af530[_0x31e4('0x1d')];}_0x47b9b6[_0x31e4('0x1e')]=_0x2af530[_0x31e4('0x1e')];_0x47b9b6[_0x31e4('0x1f')]=_0x2af530[_0x31e4('0x1f')]||0x3e1;if(_0x2af530[_0x31e4('0x20')]){_0x47b9b6[_0x31e4('0x20')]=!![];}else{_0x47b9b6['tls']=![];_0x47b9b6['autotls']='required';}}else{_0x47b9b6[_0x31e4('0x1c')]=_0x2af530[_0x31e4('0x1c')];_0x47b9b6[_0x31e4('0x1d')]=_0x2af530['password'];_0x47b9b6[_0x31e4('0x1e')]=utils['getHost'](_0x2af530[_0x31e4('0x21')]);_0x47b9b6[_0x31e4('0x1f')]=0x3e1;_0x47b9b6[_0x31e4('0x20')]=!![];}_0x47b9b6[_0x31e4('0x9')]=_0x1d3c64||_0x2af530[_0x31e4('0x1c')]||_0x31e4('0x22');return _0x47b9b6;};EmailImap[_0x31e4('0x17')][_0x31e4('0x10')]=function(){this[_0x31e4('0xc')][_0x31e4('0x23')](this[_0x31e4('0x24')],![],this['handleOpenBox'][_0x31e4('0x11')](this));};EmailImap[_0x31e4('0x17')][_0x31e4('0x25')]=function(_0x7f7e18,_0x1da1ec){if(_0x7f7e18){this['handleError'](_0x7f7e18,!![]);}else{this['emit'](_0x31e4('0x26'),_0x1da1ec);this[_0x31e4('0x27')]();}};EmailImap[_0x31e4('0x17')]['handleCloseBox']=function(_0x1b11f9){if(_0x1b11f9){this[_0x31e4('0x28')](_0x1b11f9,!![]);}else{this['imap'][_0x31e4('0x12')]();}};EmailImap['prototype'][_0x31e4('0x27')]=function(){this[_0x31e4('0xc')][_0x31e4('0x29')]([_0x31e4('0x2a')],this[_0x31e4('0x2b')][_0x31e4('0x11')](this));};EmailImap[_0x31e4('0x17')][_0x31e4('0x2b')]=function(_0x21f87c,_0x13ccde){if(_0x21f87c){this[_0x31e4('0x28')](_0x21f87c,!![]);}else{if(_0x13ccde[_0x31e4('0x2c')]){try{var _0x45ff29=this[_0x31e4('0xc')]['fetch'](_0x13ccde,{'bodies':'','markSeen':!![]});_0x45ff29['on'](_0x31e4('0x2d'),this[_0x31e4('0x2e')][_0x31e4('0x11')](this));_0x45ff29[_0x31e4('0xe')](_0x31e4('0x14'),this[_0x31e4('0x2f')]['bind'](this));_0x45ff29['once'](_0x31e4('0x12'),this[_0x31e4('0x30')]['bind'](this));}catch(_0x220e6d){logger[_0x31e4('0x14')](_0x220e6d);}}else{this[_0x31e4('0xc')][_0x31e4('0x31')](!![],this['handleCloseBox'][_0x31e4('0x11')](this));}}};EmailImap[_0x31e4('0x17')][_0x31e4('0x2e')]=function(_0x186531,_0x267ee2){_0x186531['on'](_0x31e4('0x32'),this[_0x31e4('0x33')][_0x31e4('0x11')](this));_0x186531[_0x31e4('0xe')](_0x31e4('0x34'),this[_0x31e4('0x35')]['bind'](this));_0x186531[_0x31e4('0xe')]('end',this['handleMessageEnd'][_0x31e4('0x11')](this));};EmailImap[_0x31e4('0x17')][_0x31e4('0x33')]=function(_0x112e76,_0x482705){simpleParser(_0x112e76,{'Iconv':Iconv},this['handleSimpleParser'][_0x31e4('0x11')](this));};EmailImap[_0x31e4('0x17')]['handleMessageAttributes']=function(_0x4fc9bf){};EmailImap[_0x31e4('0x17')][_0x31e4('0x36')]=function(){};EmailImap[_0x31e4('0x17')]['handleSimpleParser']=function(_0x9577ad,_0x57aca2){if(_0x9577ad){logger[_0x31e4('0x14')](_0x9577ad);}else{var _0x3fe065=this;utils[_0x31e4('0x37')](this[_0x31e4('0xd')],_0x57aca2,function(_0x1a2ce4){_0x3fe065[_0x31e4('0x38')](_0x31e4('0x9'),_0x1a2ce4);});}};EmailImap[_0x31e4('0x17')][_0x31e4('0x30')]=function(){this[_0x31e4('0xc')][_0x31e4('0x31')](!![],this[_0x31e4('0x39')][_0x31e4('0x11')](this));};EmailImap[_0x31e4('0x17')][_0x31e4('0x2f')]=function(_0x8b233a){this[_0x31e4('0x28')](_0x8b233a);this[_0x31e4('0xc')]['closeBox'](!![],this[_0x31e4('0x39')][_0x31e4('0x11')](this));};EmailImap[_0x31e4('0x17')][_0x31e4('0x13')]=function(){this[_0x31e4('0x38')]('end');};EmailImap[_0x31e4('0x17')][_0x31e4('0x28')]=function(_0x5d05b6,_0x39ca23){logger['error']('handleError',this[_0x31e4('0xd')][_0x31e4('0x9')],JSON[_0x31e4('0x3a')](_0x5d05b6));var _0x1fc62a='';if(_0x5d05b6){if(_0x5d05b6[_0x31e4('0x3b')]){_0x1fc62a=_0x5d05b6[_0x31e4('0x3b')];}else{for(var _0x4e89a1 in _0x5d05b6){if(_0x5d05b6[_0x31e4('0x3c')](_0x4e89a1)){_0x1fc62a+=_[_0x31e4('0x3d')](_0x4e89a1)+':\x20'+_0x5d05b6[_0x4e89a1]+'\x0a';}}}}if(_0x39ca23){this[_0x31e4('0xc')][_0x31e4('0x12')]();}else{this[_0x31e4('0x38')](_0x31e4('0x14'),_0x1fc62a);this[_0x31e4('0x38')](_0x31e4('0x12'));}};module[_0x31e4('0x3e')]=EmailImap; \ No newline at end of file +var _0xab44=['handleReady','bind','end','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','email','closeBox','handleEnd','stringify','hasOwnProperty','exports','path','util','randomstring','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','mailbox','INBOX','account','getAccount','imap','once'];(function(_0x430728,_0x29618e){var _0x41453c=function(_0x48d190){while(--_0x48d190){_0x430728['push'](_0x430728['shift']());}};_0x41453c(++_0x29618e);}(_0xab44,0x1aa));var _0x4ab4=function(_0x2c0d8c,_0x2a73fa){_0x2c0d8c=_0x2c0d8c-0x0;var _0x331f1d=_0xab44[_0x2c0d8c];return _0x331f1d;};'use strict';var fs=require('fs');var path=require(_0x4ab4('0x0'));var util=require(_0x4ab4('0x1'));var Imap=require('imap');var _=require('lodash');var rs=require(_0x4ab4('0x2'));var simpleParser=require(_0x4ab4('0x3'))[_0x4ab4('0x4')];var Iconv=require(_0x4ab4('0x5'))[_0x4ab4('0x6')];var EventEmitter=require(_0x4ab4('0x7'))[_0x4ab4('0x8')];var utils=require('./utils');var logger=require('../../../config/logger')('email');function EmailImap(_0x119b42,_0x17113c){this[_0x4ab4('0x9')]=_0x4ab4('0xa');this[_0x4ab4('0xb')]=this[_0x4ab4('0xc')](_0x119b42,_0x17113c);this[_0x4ab4('0xd')]=new Imap(this[_0x4ab4('0xb')]);this['imap'][_0x4ab4('0xe')]('ready',this[_0x4ab4('0xf')][_0x4ab4('0x10')](this));this[_0x4ab4('0xd')][_0x4ab4('0xe')](_0x4ab4('0x11'),this['handleEnd']['bind'](this));this[_0x4ab4('0xd')]['on'](_0x4ab4('0x12'),this[_0x4ab4('0x13')][_0x4ab4('0x10')](this));this['imap'][_0x4ab4('0x14')]();}util[_0x4ab4('0x15')](EmailImap,EventEmitter);EmailImap[_0x4ab4('0x16')][_0x4ab4('0xc')]=function(_0x362a45,_0x109b27){var _0x4b2d01={'connTimeout':_0x362a45[_0x4ab4('0x17')]?_0x362a45['connTimeout']*0x3e8:0x2710,'authTimeout':_0x362a45[_0x4ab4('0x18')]?_0x362a45[_0x4ab4('0x18')]*0x3e8:0x1388};if(_[_0x4ab4('0x19')](_0x362a45[_0x4ab4('0x1a')])){if(_0x362a45[_0x4ab4('0x1b')]){_0x4b2d01[_0x4ab4('0x1c')]=_0x362a45['user'];_0x4b2d01[_0x4ab4('0x1d')]=_0x362a45[_0x4ab4('0x1d')];}_0x4b2d01[_0x4ab4('0x1e')]=_0x362a45['host'];_0x4b2d01[_0x4ab4('0x1f')]=_0x362a45[_0x4ab4('0x1f')]||0x3e1;if(_0x362a45[_0x4ab4('0x20')]){_0x4b2d01[_0x4ab4('0x20')]=!![];}else{_0x4b2d01[_0x4ab4('0x20')]=![];_0x4b2d01[_0x4ab4('0x21')]=_0x4ab4('0x22');}}else{_0x4b2d01[_0x4ab4('0x1c')]=_0x362a45['user'];_0x4b2d01[_0x4ab4('0x1d')]=_0x362a45[_0x4ab4('0x1d')];_0x4b2d01[_0x4ab4('0x1e')]=utils[_0x4ab4('0x23')](_0x362a45[_0x4ab4('0x1a')]);_0x4b2d01[_0x4ab4('0x1f')]=0x3e1;_0x4b2d01[_0x4ab4('0x20')]=!![];}_0x4b2d01['email']=_0x109b27||_0x362a45['user']||_0x4ab4('0x24');return _0x4b2d01;};EmailImap[_0x4ab4('0x16')][_0x4ab4('0xf')]=function(){this[_0x4ab4('0xd')][_0x4ab4('0x25')](this[_0x4ab4('0x9')],![],this[_0x4ab4('0x26')][_0x4ab4('0x10')](this));};EmailImap['prototype'][_0x4ab4('0x26')]=function(_0x392844,_0x26bc2d){if(_0x392844){this[_0x4ab4('0x13')](_0x392844,!![]);}else{this[_0x4ab4('0x27')](_0x4ab4('0x28'),_0x26bc2d);this[_0x4ab4('0x29')]();}};EmailImap[_0x4ab4('0x16')][_0x4ab4('0x2a')]=function(_0x2cb246){if(_0x2cb246){this[_0x4ab4('0x13')](_0x2cb246,!![]);}else{this[_0x4ab4('0xd')]['end']();}};EmailImap['prototype'][_0x4ab4('0x29')]=function(){this['imap'][_0x4ab4('0x2b')]([_0x4ab4('0x2c')],this['handleReadUnseen'][_0x4ab4('0x10')](this));};EmailImap['prototype'][_0x4ab4('0x2d')]=function(_0x25a68f,_0x1c9d12){if(_0x25a68f){this[_0x4ab4('0x13')](_0x25a68f,!![]);}else{if(_0x1c9d12[_0x4ab4('0x2e')]){try{var _0x545df9=this[_0x4ab4('0xd')][_0x4ab4('0x2f')](_0x1c9d12,{'bodies':'','markSeen':!![]});_0x545df9['on']('message',this[_0x4ab4('0x30')][_0x4ab4('0x10')](this));_0x545df9[_0x4ab4('0xe')](_0x4ab4('0x12'),this[_0x4ab4('0x31')][_0x4ab4('0x10')](this));_0x545df9[_0x4ab4('0xe')]('end',this[_0x4ab4('0x32')][_0x4ab4('0x10')](this));}catch(_0x1eeb63){logger[_0x4ab4('0x12')](_0x1eeb63);}}else{this['imap']['closeBox'](!![],this['handleCloseBox'][_0x4ab4('0x10')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x36310f,_0x4c204d){_0x36310f['on'](_0x4ab4('0x33'),this['handleMessageBody'][_0x4ab4('0x10')](this));_0x36310f[_0x4ab4('0xe')](_0x4ab4('0x34'),this[_0x4ab4('0x35')][_0x4ab4('0x10')](this));_0x36310f[_0x4ab4('0xe')](_0x4ab4('0x11'),this[_0x4ab4('0x36')][_0x4ab4('0x10')](this));};EmailImap[_0x4ab4('0x16')][_0x4ab4('0x37')]=function(_0x22acad,_0x1da92b){simpleParser(_0x22acad,{'Iconv':Iconv},this[_0x4ab4('0x38')][_0x4ab4('0x10')](this));};EmailImap[_0x4ab4('0x16')][_0x4ab4('0x35')]=function(_0x1e72d5){};EmailImap[_0x4ab4('0x16')][_0x4ab4('0x36')]=function(){};EmailImap[_0x4ab4('0x16')][_0x4ab4('0x38')]=function(_0x46012e,_0x57a1fa){if(_0x46012e){logger[_0x4ab4('0x12')](_0x46012e);}else{var _0x1e9365=this;utils['parser'](this[_0x4ab4('0xb')],_0x57a1fa,function(_0x4e70a4){_0x1e9365[_0x4ab4('0x27')](_0x4ab4('0x39'),_0x4e70a4);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0x4ab4('0xd')]['closeBox'](!![],this[_0x4ab4('0x2a')][_0x4ab4('0x10')](this));};EmailImap[_0x4ab4('0x16')][_0x4ab4('0x31')]=function(_0x22d48c){this['handleError'](_0x22d48c);this[_0x4ab4('0xd')][_0x4ab4('0x3a')](!![],this[_0x4ab4('0x2a')][_0x4ab4('0x10')](this));};EmailImap[_0x4ab4('0x16')][_0x4ab4('0x3b')]=function(){this[_0x4ab4('0x27')](_0x4ab4('0x11'));};EmailImap[_0x4ab4('0x16')][_0x4ab4('0x13')]=function(_0x43468e,_0x56548c){logger['error']('handleError',this[_0x4ab4('0xb')][_0x4ab4('0x39')],JSON[_0x4ab4('0x3c')](_0x43468e));var _0x3a3da3='';if(_0x43468e){if(_0x43468e['textCode']){_0x3a3da3=_0x43468e['textCode'];}else{for(var _0x32e198 in _0x43468e){if(_0x43468e[_0x4ab4('0x3d')](_0x32e198)){_0x3a3da3+=_['upperFirst'](_0x32e198)+':\x20'+_0x43468e[_0x32e198]+'\x0a';}}}}if(_0x56548c){this['imap'][_0x4ab4('0x11')]();}else{this[_0x4ab4('0x27')](_0x4ab4('0x12'),_0x3a3da3);this['emit'](_0x4ab4('0x11'));}};module[_0x4ab4('0x3e')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 4957368..4841651 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 _0x3dd0=['sendMail','verify','Not\x20verifired','exports','nodemailer','prototype','send','createTransport','use','compile'];(function(_0xa7c094,_0x212983){var _0x51d1f1=function(_0x5b40e1){while(--_0x5b40e1){_0xa7c094['push'](_0xa7c094['shift']());}};_0x51d1f1(++_0x212983);}(_0x3dd0,0xae));var _0x03dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3dd0[_0x3dd15e];return _0x231fd0;};'use strict';var nodemailer=require(_0x03dd('0x0'));var BPromise=require('bluebird');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x03dd('0x1')][_0x03dd('0x2')]=function(_0x6e0ad8,_0x2e9c4d){return new BPromise(function(_0x2eccc1,_0x33a1be){var _0x101435=nodemailer[_0x03dd('0x3')](_0x6e0ad8);_0x101435[_0x03dd('0x4')](_0x03dd('0x5'),inlineBase64());_0x101435[_0x03dd('0x6')](_0x2e9c4d,function(_0x80538c,_0x5094a0){if(_0x80538c){_0x33a1be(_0x80538c['toString']());}else{_0x2eccc1(_0x5094a0);}});});};EmailSmtp[_0x03dd('0x1')][_0x03dd('0x7')]=function(_0x4fa03d){return new BPromise(function(_0x2b51bf,_0x3b5337){var _0x369c3b=nodemailer[_0x03dd('0x3')](_0x4fa03d);_0x369c3b[_0x03dd('0x7')](function(_0x4d7cd6,_0x3bfc5a){if(_0x4d7cd6){_0x3b5337(_0x4d7cd6['toString']());}else{if(_0x3bfc5a){_0x2b51bf(_0x3bfc5a);}else{_0x3b5337(_0x03dd('0x8'));}}});});};module[_0x03dd('0x9')]=EmailSmtp; \ No newline at end of file +var _0x43ac=['exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','send','use','compile','toString','prototype','verify','createTransport','Not\x20verifired'];(function(_0x328fc2,_0x1fe6f3){var _0x136815=function(_0x558b1b){while(--_0x558b1b){_0x328fc2['push'](_0x328fc2['shift']());}};_0x136815(++_0x1fe6f3);}(_0x43ac,0x115));var _0xc43a=function(_0x839b4c,_0x115c64){_0x839b4c=_0x839b4c-0x0;var _0x4cc424=_0x43ac[_0x839b4c];return _0x4cc424;};'use strict';var nodemailer=require(_0xc43a('0x0'));var BPromise=require(_0xc43a('0x1'));var inlineBase64=require(_0xc43a('0x2'));function EmailSmtp(){}EmailSmtp['prototype'][_0xc43a('0x3')]=function(_0x5b3337,_0x46647e){return new BPromise(function(_0x41a972,_0x6ffde4){var _0x1c6d83=nodemailer['createTransport'](_0x5b3337);_0x1c6d83[_0xc43a('0x4')](_0xc43a('0x5'),inlineBase64());_0x1c6d83['sendMail'](_0x46647e,function(_0x5c3786,_0x968846){if(_0x5c3786){_0x6ffde4(_0x5c3786[_0xc43a('0x6')]());}else{_0x41a972(_0x968846);}});});};EmailSmtp[_0xc43a('0x7')][_0xc43a('0x8')]=function(_0x25d9dd){return new BPromise(function(_0x3d39fd,_0xd8c6ee){var _0x528640=nodemailer[_0xc43a('0x9')](_0x25d9dd);_0x528640[_0xc43a('0x8')](function(_0x531638,_0x53e8b7){if(_0x531638){_0xd8c6ee(_0x531638['toString']());}else{if(_0x53e8b7){_0x3d39fd(_0x53e8b7);}else{_0xd8c6ee(_0xc43a('0xa'));}}});});};module[_0xc43a('0xb')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index f6a3b9b..da385d7 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 _0x89fb=['subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook.office365.com','127.0.0.1','moment','randomstring','path','util','node-tnef','email','../../../config/environment','head','address','anonymous','@xcally.com','value','name','indexOf','split','length','join','Anonymous','pop','isEmpty','generate','test','html','replace','includes','\x20[Attachment:\x20','body','textAsHtml','0x1?_0x36b3f8['slice'](0x0,-0x1)[_0xb89f('0x10')]('\x20'):_0x300c7c[_0xb89f('0xc')];}return _0xb89f('0x11');}function getLastName(_0x2c236b){var _0x1175f3=_[_0xb89f('0x7')](_0x2c236b['value']);if(_0x1175f3&&_0x1175f3[_0xb89f('0xc')]){var _0x349122=_0x1175f3[_0xb89f('0xc')][_0xb89f('0xe')](/\s+/);return _0x349122[_0xb89f('0xf')]>0x1?_0x349122[_0xb89f('0x12')]():'';}return'';}function getMails(_0xb33497,_0x4d7a92){var _0x243388='';for(var _0xfc48d=0x0;_0xfc48d<_0x4d7a92[_0xb89f('0xb')][_0xb89f('0xf')];_0xfc48d+=0x1){if(_0x4d7a92['value'][_0xfc48d]['address']!==_0xb33497){if(!_[_0xb89f('0x13')](_0x243388)){_0x243388+=',';}_0x243388+=_0x4d7a92[_0xb89f('0xb')][_0xfc48d][_0xb89f('0xc')]||_0x4d7a92['value'][_0xfc48d]['address']||'';_0x243388+='\x20<';_0x243388+=_0x4d7a92[_0xb89f('0xb')][_0xfc48d][_0xb89f('0x8')]?_0x4d7a92[_0xb89f('0xb')][_0xfc48d][_0xb89f('0x8')]:_0xb89f('0x9')+random[_0xb89f('0x14')](0x6)+_0xb89f('0xa');_0x243388+='>';}}return _0x243388;}function parseEmail(_0x5b82a7,_0x59e898,_0x4b795e){if(_0x59e898['html']){var _0x5ee95f=/)<[^<]*)*<\/script>/gi;while(_0x5ee95f[_0xb89f('0x15')](_0x59e898['html'])){_0x59e898[_0xb89f('0x16')]=_0x59e898[_0xb89f('0x16')][_0xb89f('0x17')](_0x5ee95f,'');}if(_0x59e898[_0xb89f('0x16')][_0xb89f('0x18')](_0xb89f('0x19'))){var _0x49ec5c=[];_0x59e898[_0xb89f('0x1a')][_0xb89f('0x1b')](_0xe71e63=>{_0x49ec5c[_0xb89f('0x1c')](_0xe71e63[_0xb89f('0x1d')]);});var _0x2a22b6=/]+>/g;var _0x1934e8=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x177db8=_0x59e898['html'][_0xb89f('0x17')](_0x1934e8,_0xb89f('0x1e'));var _0x723479=_0x177db8[_0xb89f('0x17')](_0x2a22b6,_0xb89f('0x1f'));for(let _0x22195c=0x0;_0x22195c<_0x49ec5c['length'];_0x22195c++){var _0x447dd1=_0x723479[_0xb89f('0x17')](_0xb89f('0x1f'),_0xb89f('0x20')+_0x49ec5c[_0x22195c]+'\x20]');_0x723479=_0x447dd1;}_0x59e898['html']=_0x723479;}_0x4b795e['body']=_0x59e898[_0xb89f('0x16')];}else{_0x4b795e[_0xb89f('0x21')]=_0x59e898[_0xb89f('0x22')];}if(_0x4b795e[_0xb89f('0x21')]){_0x4b795e[_0xb89f('0x21')]=_0x4b795e[_0xb89f('0x21')][_0xb89f('0x17')](/0x0){var _0x35c6a1=[_0xb89f('0x33'),_0xb89f('0x34'),'Precedence:\x20auto_reply'];for(var _0x43c478=0x0;_0x43c478<_0x59e898[_0xb89f('0x32')][_0xb89f('0xf')];_0x43c478++){var _0x5570b1=_[_0xb89f('0xd')](_0x35c6a1,_0x59e898[_0xb89f('0x32')][_0x43c478]['line']);if(_0x5570b1>=0x0){_0x4b795e['isAutoreply']=!![];}}}return _0x4b795e;}exports['parser']=function(_0x5eb555,_0x8cf572,_0x546e7d){var _0x19ce4a={'from':getAddress(_0x8cf572[_0xb89f('0x35')]),'firstName':getFirstName(_0x8cf572[_0xb89f('0x35')]),'lastName':getLastName(_0x8cf572[_0xb89f('0x35')]),'mapKey':'email','message':{'from':getMails(_0x5eb555[_0xb89f('0x5')],_0x8cf572[_0xb89f('0x35')]),'to':_0x5eb555[_0xb89f('0x5')],'cc':'','subject':_0x8cf572[_0xb89f('0x36')]||'','messageId':_0x8cf572[_0xb89f('0x37')],'inReplyTo':_0x8cf572[_0xb89f('0x38')],'sentAt':moment(_0x8cf572[_0xb89f('0x39')])[_0xb89f('0x2b')](_0xb89f('0x3a')),'attach':![],'attachments':[]}};if(!_0x8cf572[_0xb89f('0x16')]&&!_0x8cf572[_0xb89f('0x22')]){var _0x14d6ff=_[_0xb89f('0x3b')](_0x8cf572['attachments'],{'contentType':_0xb89f('0x3c')});if(_0x14d6ff[_0xb89f('0xf')]){logger[_0xb89f('0x3d')](util[_0xb89f('0x2b')](_0xb89f('0x3e'),_0x8cf572[_0xb89f('0x37')]));tnef[_0xb89f('0x3f')](_['first'](_0x14d6ff)[_0xb89f('0x30')],function(_0x56aaf1,_0x2477c7){if(_0x2477c7){_0x8cf572['html']=_0x2477c7[_0xb89f('0x40')]||_0xb89f('0x41');if(_0x2477c7[_0xb89f('0x42')]){for(var _0x59d194=0x0;_0x59d194<_0x2477c7[_0xb89f('0x42')][_0xb89f('0xf')];_0x59d194++){var _0x32b7e1=_0x2477c7[_0xb89f('0x42')][_0x59d194];_0x19ce4a[_0xb89f('0x24')]['attachments'][_0xb89f('0x1c')]({'filename':_0x32b7e1[_0xb89f('0x43')],'content':Buffer['from'](_0x32b7e1[_0xb89f('0x44')])});}}}_0x546e7d(parseEmail(_0x5eb555,_0x8cf572,_0x19ce4a));});}else{_0x8cf572[_0xb89f('0x16')]=_0xb89f('0x41');_0x546e7d(parseEmail(_0x5eb555,_0x8cf572,_0x19ce4a));}}else{_0x546e7d(parseEmail(_0x5eb555,_0x8cf572,_0x19ce4a));}};exports[_0xb89f('0x45')]=function(_0x4ec5e){switch(_0x4ec5e){case _0xb89f('0x46'):return _0xb89f('0x47');case _0xb89f('0x48'):return _0xb89f('0x49');case _0xb89f('0x4a'):return'imap-mail.outlook.com';case'outlook365':return _0xb89f('0x4b');}return _0xb89f('0x4c');}; \ No newline at end of file +var _0xa498=['replace','includes','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','util','node-tnef','email','../../../config/environment','head','value','address','@xcally.com','name','substring','indexOf','length','join','split','pop','isEmpty','anonymous','generate','html','test'];(function(_0x3d537b,_0x5d2728){var _0x5d2e69=function(_0x7e90c6){while(--_0x7e90c6){_0x3d537b['push'](_0x3d537b['shift']());}};_0x5d2e69(++_0x5d2728);}(_0xa498,0x179));var _0x8a49=function(_0xa8f24a,_0x48d7d3){_0xa8f24a=_0xa8f24a-0x0;var _0x3a1471=_0xa498[_0xa8f24a];return _0x3a1471;};'use strict';var _=require(_0x8a49('0x0'));var moment=require(_0x8a49('0x1'));var random=require(_0x8a49('0x2'));var fs=require('fs');var path=require('path');var util=require(_0x8a49('0x3'));var tnef=require(_0x8a49('0x4'));var logger=require('../../../config/logger')(_0x8a49('0x5'));var config=require(_0x8a49('0x6'));function getAddress(_0xecc049){var _0x2e7948=_[_0x8a49('0x7')](_0xecc049[_0x8a49('0x8')]);return _0x2e7948&&_0x2e7948['address']?_0x2e7948[_0x8a49('0x9')]:'anonymous'+random['generate'](0x6)+_0x8a49('0xa');}function getFirstName(_0x41d364){var _0x3f8837=_[_0x8a49('0x7')](_0x41d364[_0x8a49('0x8')]);if(_0x3f8837&&_0x3f8837[_0x8a49('0xb')]){if(_0x3f8837['name']==_0x3f8837[_0x8a49('0x9')]){return _0x3f8837[_0x8a49('0xb')][_0x8a49('0xc')](0x0,_0x3f8837[_0x8a49('0xb')][_0x8a49('0xd')]('@'));}var _0x59885a=_0x3f8837['name']['split'](/\s+/);return _0x59885a[_0x8a49('0xe')]>0x1?_0x59885a['slice'](0x0,-0x1)[_0x8a49('0xf')]('\x20'):_0x3f8837['name'];}return'Anonymous';}function getLastName(_0x6c9f58){var _0x3091b5=_['head'](_0x6c9f58[_0x8a49('0x8')]);if(_0x3091b5&&_0x3091b5[_0x8a49('0xb')]){var _0x5dfabc=_0x3091b5[_0x8a49('0xb')][_0x8a49('0x10')](/\s+/);return _0x5dfabc['length']>0x1?_0x5dfabc[_0x8a49('0x11')]():'';}return'';}function getMails(_0x50a72d,_0x22535d){var _0x53de72='';for(var _0x4db44c=0x0;_0x4db44c<_0x22535d['value'][_0x8a49('0xe')];_0x4db44c+=0x1){if(_0x22535d[_0x8a49('0x8')][_0x4db44c]['address']!==_0x50a72d){if(!_[_0x8a49('0x12')](_0x53de72)){_0x53de72+=',';}_0x53de72+=_0x22535d[_0x8a49('0x8')][_0x4db44c][_0x8a49('0xb')]||_0x22535d[_0x8a49('0x8')][_0x4db44c][_0x8a49('0x9')]||'';_0x53de72+='\x20<';_0x53de72+=_0x22535d[_0x8a49('0x8')][_0x4db44c]['address']?_0x22535d[_0x8a49('0x8')][_0x4db44c]['address']:_0x8a49('0x13')+random[_0x8a49('0x14')](0x6)+'@xcally.com';_0x53de72+='>';}}return _0x53de72;}function parseEmail(_0x526110,_0x14bfb2,_0x301051){if(_0x14bfb2[_0x8a49('0x15')]){var _0x3659da=/)<[^<]*)*<\/script>/gi;while(_0x3659da[_0x8a49('0x16')](_0x14bfb2['html'])){_0x14bfb2[_0x8a49('0x15')]=_0x14bfb2[_0x8a49('0x15')][_0x8a49('0x17')](_0x3659da,'');}if(_0x14bfb2[_0x8a49('0x15')][_0x8a49('0x18')](_0x8a49('0x19'))){var _0xf8705d=[];_0x14bfb2[_0x8a49('0x1a')][_0x8a49('0x1b')](_0x3f9ea6=>{_0xf8705d['push'](_0x3f9ea6['filename']);});var _0x4304d4=/]+>/g;var _0x2ab78a=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5de9a2=_0x14bfb2[_0x8a49('0x15')][_0x8a49('0x17')](_0x2ab78a,_0x8a49('0x1c'));var _0xe1efda=_0x5de9a2['replace'](_0x4304d4,_0x8a49('0x1d'));for(let _0x1db3f5=0x0;_0x1db3f5<_0xf8705d[_0x8a49('0xe')];_0x1db3f5++){var _0x468bb6=_0xe1efda[_0x8a49('0x17')](_0x8a49('0x1d'),_0x8a49('0x1e')+_0xf8705d[_0x1db3f5]+_0x8a49('0x1f'));_0xe1efda=_0x468bb6;}_0x14bfb2[_0x8a49('0x15')]=_0xe1efda;}_0x301051[_0x8a49('0x20')]=_0x14bfb2[_0x8a49('0x15')];}else{_0x301051[_0x8a49('0x20')]=_0x14bfb2['textAsHtml'];}if(_0x301051['body']){_0x301051[_0x8a49('0x20')]=_0x301051[_0x8a49('0x20')][_0x8a49('0x17')](/0x0){var _0x46f868=[_0x8a49('0x32'),_0x8a49('0x33'),_0x8a49('0x34')];for(var _0x2ac71d=0x0;_0x2ac71d<_0x14bfb2[_0x8a49('0x31')][_0x8a49('0xe')];_0x2ac71d++){var _0x28cf0b=_[_0x8a49('0xd')](_0x46f868,_0x14bfb2[_0x8a49('0x31')][_0x2ac71d][_0x8a49('0x35')]);if(_0x28cf0b>=0x0){_0x301051[_0x8a49('0x36')]=!![];}}}return _0x301051;}exports[_0x8a49('0x37')]=function(_0x42225f,_0x5d1d55,_0x4acafe){var _0x316953={'from':getAddress(_0x5d1d55[_0x8a49('0x38')]),'firstName':getFirstName(_0x5d1d55[_0x8a49('0x38')]),'lastName':getLastName(_0x5d1d55['from']),'mapKey':_0x8a49('0x5'),'message':{'from':getMails(_0x42225f['email'],_0x5d1d55[_0x8a49('0x38')]),'to':_0x42225f[_0x8a49('0x5')],'cc':'','subject':_0x5d1d55[_0x8a49('0x39')]||'','messageId':_0x5d1d55[_0x8a49('0x3a')],'inReplyTo':_0x5d1d55[_0x8a49('0x3b')],'sentAt':moment(_0x5d1d55[_0x8a49('0x3c')])[_0x8a49('0x2a')](_0x8a49('0x3d')),'attach':![],'attachments':[]}};if(!_0x5d1d55[_0x8a49('0x15')]&&!_0x5d1d55[_0x8a49('0x3e')]){var _0x40d7f6=_['filter'](_0x5d1d55[_0x8a49('0x1a')],{'contentType':_0x8a49('0x3f')});if(_0x40d7f6[_0x8a49('0xe')]){logger[_0x8a49('0x40')](util[_0x8a49('0x2a')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x5d1d55[_0x8a49('0x3a')]));tnef[_0x8a49('0x41')](_[_0x8a49('0x42')](_0x40d7f6)['content'],function(_0x540879,_0x62fcbb){if(_0x62fcbb){_0x5d1d55[_0x8a49('0x15')]=_0x62fcbb['BodyHTML']||_0x8a49('0x43');if(_0x62fcbb[_0x8a49('0x44')]){for(var _0x3c7b36=0x0;_0x3c7b36<_0x62fcbb[_0x8a49('0x44')][_0x8a49('0xe')];_0x3c7b36++){var _0x46925a=_0x62fcbb[_0x8a49('0x44')][_0x3c7b36];_0x316953[_0x8a49('0x23')][_0x8a49('0x1a')][_0x8a49('0x30')]({'filename':_0x46925a['Title'],'content':Buffer['from'](_0x46925a[_0x8a49('0x45')])});}}}_0x4acafe(parseEmail(_0x42225f,_0x5d1d55,_0x316953));});}else{_0x5d1d55[_0x8a49('0x15')]=_0x8a49('0x43');_0x4acafe(parseEmail(_0x42225f,_0x5d1d55,_0x316953));}}else{_0x4acafe(parseEmail(_0x42225f,_0x5d1d55,_0x316953));}};exports[_0x8a49('0x46')]=function(_0x1d472c){switch(_0x1d472c){case _0x8a49('0x47'):return _0x8a49('0x48');case _0x8a49('0x49'):return _0x8a49('0x4a');case _0x8a49('0x4b'):return _0x8a49('0x4c');case _0x8a49('0x4d'):return _0x8a49('0x4e');}return _0x8a49('0x4f');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 2cc10ce..ce5feb2 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 _0xc257=['active','Smtp','exports','lodash','name','Service','key','SERV'];(function(_0x1c2185,_0x2c3370){var _0xa0bb42=function(_0x32b5d1){while(--_0x32b5d1){_0x1c2185['push'](_0x1c2185['shift']());}};_0xa0bb42(++_0x2c3370);}(_0xc257,0x173));var _0x7c25=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc257[_0x432682];return _0x463d05;};'use strict';var _=require(_0x7c25('0x0'));function MailAccount(_0x55892c){this['id']=_0x55892c['id']||0x0;this[_0x7c25('0x1')]=_0x55892c['name']||_0x7c25('0x2');this['key']=_0x55892c[_0x7c25('0x3')]||_0x7c25('0x4');this[_0x7c25('0x5')]=_0x55892c[_0x7c25('0x5')]||![];this['Imap']=_0x55892c['Imap']||[];this[_0x7c25('0x6')]=_0x55892c[_0x7c25('0x6')]||[];}module[_0x7c25('0x7')]=MailAccount; \ No newline at end of file +var _0xdcf1=['Service','SERV','active','Imap','Smtp','exports','lodash','name'];(function(_0x1f603a,_0x2d9abc){var _0x529aec=function(_0x38b64b){while(--_0x38b64b){_0x1f603a['push'](_0x1f603a['shift']());}};_0x529aec(++_0x2d9abc);}(_0xdcf1,0x176));var _0x1dcf=function(_0x47bd2f,_0x3e42ac){_0x47bd2f=_0x47bd2f-0x0;var _0x582e65=_0xdcf1[_0x47bd2f];return _0x582e65;};'use strict';var _=require(_0x1dcf('0x0'));function MailAccount(_0x23e73f){this['id']=_0x23e73f['id']||0x0;this['name']=_0x23e73f[_0x1dcf('0x1')]||_0x1dcf('0x2');this['key']=_0x23e73f['key']||_0x1dcf('0x3');this[_0x1dcf('0x4')]=_0x23e73f['active']||![];this[_0x1dcf('0x5')]=_0x23e73f[_0x1dcf('0x5')]||[];this[_0x1dcf('0x6')]=_0x23e73f[_0x1dcf('0x6')]||[];}module[_0x1dcf('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 57c5765..4ebf633 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 _0x8bf0=['merge','exports','lodash','mailAccounts','mapKeys','prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','length','isUndefined'];(function(_0x1991e4,_0x5c0db8){var _0x2d5f48=function(_0x5a0435){while(--_0x5a0435){_0x1991e4['push'](_0x1991e4['shift']());}};_0x2d5f48(++_0x5c0db8);}(_0x8bf0,0x1a4));var _0x08bf=function(_0x2f7bb9,_0x3c2ae3){_0x2f7bb9=_0x2f7bb9-0x0;var _0x36aaff=_0x8bf0[_0x2f7bb9];return _0x36aaff;};'use strict';var _=require(_0x08bf('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x08bf('0x1')]={};};function freeIsNotKey(_0x41f388,_0x4c98fb,_0x182336){var _0x52d285=_[_0x08bf('0x2')](_0x41f388,function(_0x3080cf,_0x310cdc){return _0x3080cf[_0x182336];});for(var _0x2dfc95 in _0x4c98fb){if(_0x4c98fb['hasOwnProperty'](_0x2dfc95)){if(!_0x52d285[_0x2dfc95]){delete _0x4c98fb[_0x2dfc95];}}}}Realtime[_0x08bf('0x3')][_0x08bf('0x4')]=function(_0x5dec94,_0x39a013){for(var _0x2c3e04 in _0x39a013){if(_0x5dec94[_0x08bf('0x5')](_0x2c3e04)){_0x5dec94[_0x2c3e04]=_0x39a013[_0x2c3e04];}}};Realtime['prototype'][_0x08bf('0x6')]=function(){var _0x1e0240=this;return function(_0x4ba9a0){if(_0x4ba9a0){freeIsNotKey(_0x4ba9a0,_0x1e0240['mailAccounts'],'id');for(var _0xd10478=0x0,_0x50ee7a={},_0x520fa4={};_0xd10478<_0x4ba9a0[_0x08bf('0x7')];_0xd10478+=0x1){_0x50ee7a=_0x4ba9a0[_0xd10478];if(_[_0x08bf('0x8')](_0x1e0240['mailAccounts'][_0x50ee7a['id']])){_0x1e0240[_0x08bf('0x1')][_0x50ee7a['id']]=new MailAccount(_0x50ee7a);}else{_[_0x08bf('0x9')](_0x1e0240['mailAccounts'][_0x50ee7a['id']],_0x50ee7a);}}}return _0x1e0240['mailAccounts'];};};module[_0x08bf('0xa')]=Realtime; \ No newline at end of file +var _0xc0e8=['exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xc0e8,0x198));var _0x8c0e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc0e8[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x8c0e('0x0'));var MailAccount=require(_0x8c0e('0x1'));var Realtime=function(){this[_0x8c0e('0x2')]={};};function freeIsNotKey(_0x4e2df5,_0x4e9b87,_0x27f4d6){var _0x4e1543=_[_0x8c0e('0x3')](_0x4e2df5,function(_0xdd30f9,_0x3239f0){return _0xdd30f9[_0x27f4d6];});for(var _0x28f76a in _0x4e9b87){if(_0x4e9b87[_0x8c0e('0x4')](_0x28f76a)){if(!_0x4e1543[_0x28f76a]){delete _0x4e9b87[_0x28f76a];}}}}Realtime[_0x8c0e('0x5')][_0x8c0e('0x6')]=function(_0x400c88,_0x853585){for(var _0x2a7d5c in _0x853585){if(_0x400c88[_0x8c0e('0x4')](_0x2a7d5c)){_0x400c88[_0x2a7d5c]=_0x853585[_0x2a7d5c];}}};Realtime['prototype'][_0x8c0e('0x7')]=function(){var _0x2ec74e=this;return function(_0x55c1d2){if(_0x55c1d2){freeIsNotKey(_0x55c1d2,_0x2ec74e[_0x8c0e('0x2')],'id');for(var _0x13ef4b=0x0,_0x571ad6={},_0x5be4aa={};_0x13ef4b<_0x55c1d2[_0x8c0e('0x8')];_0x13ef4b+=0x1){_0x571ad6=_0x55c1d2[_0x13ef4b];if(_[_0x8c0e('0x9')](_0x2ec74e[_0x8c0e('0x2')][_0x571ad6['id']])){_0x2ec74e[_0x8c0e('0x2')][_0x571ad6['id']]=new MailAccount(_0x571ad6);}else{_['merge'](_0x2ec74e['mailAccounts'][_0x571ad6['id']],_0x571ad6);}}}return _0x2ec74e[_0x8c0e('0x2')];};};module[_0x8c0e('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index bdfc9e1..9982840 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 _0x4745=['ListId','TemplateId','MailServerIn','MailServerOut','Smtp','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','service','email','active','key'];(function(_0x48f7cf,_0x4baa04){var _0xc201c0=function(_0x23ff34){while(--_0x23ff34){_0x48f7cf['push'](_0x48f7cf['shift']());}};_0xc201c0(++_0x4baa04);}(_0x4745,0x1e7));var _0x5474=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x4745[_0x110c3d];return _0x226d67;};'use strict';var client=require(_0x5474('0x0'));exports[_0x5474('0x1')]=function(){return function(){return client[_0x5474('0x2')](_0x5474('0x3'),{'options':{'attributes':['id',_0x5474('0x4'),_0x5474('0x5'),_0x5474('0x6'),_0x5474('0x7'),_0x5474('0x8'),_0x5474('0x9'),_0x5474('0xa')],'raw':![],'include':[{'model':_0x5474('0xb'),'as':'Imap'},{'model':_0x5474('0xc'),'as':_0x5474('0xd')}]},'log':'getMailAccount'});};};exports[_0x5474('0xe')]=function(_0x5d778b,_0x902ba8){return client[_0x5474('0x2')]('NotifyMailAccount',{'account':{'id':_0x5d778b},'body':_0x902ba8,'log':_0x5474('0xf')});}; \ No newline at end of file +var _0xe944=['../client','GetMailAccount','email','ListId','TemplateId','MailServerIn','Imap','Smtp','getMailAccount','notify','Request','NotifyMailAccount'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0xe944,0x174));var _0x4e94=function(_0x241f04,_0x38f8d9){_0x241f04=_0x241f04-0x0;var _0x391a64=_0xe944[_0x241f04];return _0x391a64;};'use strict';var client=require(_0x4e94('0x0'));exports['getMailAccounts']=function(){return function(){return client['Request'](_0x4e94('0x1'),{'options':{'attributes':['id','name','service',_0x4e94('0x2'),'active','key',_0x4e94('0x3'),_0x4e94('0x4')],'raw':![],'include':[{'model':_0x4e94('0x5'),'as':_0x4e94('0x6')},{'model':'MailServerOut','as':_0x4e94('0x7')}]},'log':_0x4e94('0x8')});};};exports[_0x4e94('0x9')]=function(_0x32bb46,_0x5a5823){return client[_0x4e94('0xa')]('NotifyMailAccount',{'account':{'id':_0x32bb46},'body':_0x5a5823,'log':_0x4e94('0xb')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 31235f0..a6cb09d 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 _0xb7ac=['ShowSetting','GetSettings','../client','getSettings','Request'];(function(_0x331c19,_0xcf4a98){var _0x11257c=function(_0x284ba){while(--_0x284ba){_0x331c19['push'](_0x331c19['shift']());}};_0x11257c(++_0xcf4a98);}(_0xb7ac,0x147));var _0xcb7a=function(_0x30852d,_0x4f5649){_0x30852d=_0x30852d-0x0;var _0x3b85bb=_0xb7ac[_0x30852d];return _0x3b85bb;};'use strict';var client=require(_0xcb7a('0x0'));exports[_0xcb7a('0x1')]=function(){return client[_0xcb7a('0x2')](_0xcb7a('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xcb7a('0x4')});}; \ No newline at end of file +var _0xe5a0=['getSettings','Request','ShowSetting','loginMailFrequency','../client'];(function(_0x4873f1,_0x3a4e95){var _0x386599=function(_0x1d0018){while(--_0x1d0018){_0x4873f1['push'](_0x4873f1['shift']());}};_0x386599(++_0x3a4e95);}(_0xe5a0,0x112));var _0x0e5a=function(_0x2819e1,_0x1c8376){_0x2819e1=_0x2819e1-0x0;var _0x59a504=_0xe5a0[_0x2819e1];return _0x59a504;};'use strict';var client=require(_0x0e5a('0x0'));exports[_0x0e5a('0x1')]=function(){return client[_0x0e5a('0x2')](_0x0e5a('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0e5a('0x4')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 8943a88..e275935 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 e099248..1c8ecde 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 _0xd1e0=['localhost','adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../config/express','../../routes','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','express','sticky-session','../../config/environment','createServer','listen','port','socket.io','websocket','polling','redis'];(function(_0x2e8a6c,_0x823d66){var _0x47b096=function(_0x24dc05){while(--_0x24dc05){_0x2e8a6c['push'](_0x2e8a6c['shift']());}};_0x47b096(++_0x823d66);}(_0xd1e0,0x1d8));var _0x0d1e=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0xd1e0[_0x15c421];return _0x5e5ed5;};'use strict';var _=require('lodash');var http=require(_0x0d1e('0x0'));var express=require(_0x0d1e('0x1'));var sticky=require(_0x0d1e('0x2'));var Redis=require('ioredis');var config=require(_0x0d1e('0x3'));var app=express();var server=http[_0x0d1e('0x4')](app);server['timeout']=0xdbba0;if(sticky[_0x0d1e('0x5')](server,config[_0x0d1e('0x6')])){var socketio=require(_0x0d1e('0x7'))(server,{'transports':[_0x0d1e('0x8'),_0x0d1e('0x9')]});config[_0x0d1e('0xa')]=_['defaults'](config['redis'],{'host':_0x0d1e('0xb'),'port':0x18eb});socketio[_0x0d1e('0xc')](require(_0x0d1e('0xd'))({'pubClient':new Redis(config[_0x0d1e('0xa')]),'subClient':new Redis(config['redis'])}));require(_0x0d1e('0xe'))['default']();require(_0x0d1e('0xf'))[_0x0d1e('0x10')](socketio);require(_0x0d1e('0x11'))[_0x0d1e('0x10')](app);require(_0x0d1e('0x12'))[_0x0d1e('0x10')](app);}else{server[_0x0d1e('0x13')](_0x0d1e('0x14'),function(){console['log'](_0x0d1e('0x15'),config[_0x0d1e('0x6')]);});}exports=module[_0x0d1e('0x16')]=app; \ No newline at end of file +var _0xc2a0=['ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','express','sticky-session'];(function(_0x26ec13,_0x1a49bb){var _0x50bb3a=function(_0x5e582f){while(--_0x5e582f){_0x26ec13['push'](_0x26ec13['shift']());}};_0x50bb3a(++_0x1a49bb);}(_0xc2a0,0x19b));var _0x0c2a=function(_0xefc2e,_0x40b92a){_0xefc2e=_0xefc2e-0x0;var _0x2d0818=_0xc2a0[_0xefc2e];return _0x2d0818;};'use strict';var _=require(_0x0c2a('0x0'));var http=require('http');var express=require(_0x0c2a('0x1'));var sticky=require(_0x0c2a('0x2'));var Redis=require(_0x0c2a('0x3'));var config=require(_0x0c2a('0x4'));var app=express();var server=http[_0x0c2a('0x5')](app);server[_0x0c2a('0x6')]=0xdbba0;if(sticky[_0x0c2a('0x7')](server,config[_0x0c2a('0x8')])){var socketio=require(_0x0c2a('0x9'))(server,{'transports':['websocket',_0x0c2a('0xa')]});config[_0x0c2a('0xb')]=_[_0x0c2a('0xc')](config[_0x0c2a('0xb')],{'host':_0x0c2a('0xd'),'port':0x18eb});socketio[_0x0c2a('0xe')](require(_0x0c2a('0xf'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require(_0x0c2a('0x10'))['default']();require(_0x0c2a('0x11'))[_0x0c2a('0x12')](socketio);require('../../config/express')[_0x0c2a('0x12')](app);require('../../routes')[_0x0c2a('0x12')](app);}else{server[_0x0c2a('0x13')](_0x0c2a('0x14'),function(){console[_0x0c2a('0x15')](_0x0c2a('0x16'),config['port']);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index eaefadf..61b0266 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 _0x98b8=['client','http','Request','then','debug','rpc','error','message','result','catch','exports','bluebird','../../config/logger','routing'];(function(_0x4def54,_0x36de1d){var _0x137bee=function(_0x1dd6f4){while(--_0x1dd6f4){_0x4def54['push'](_0x4def54['shift']());}};_0x137bee(++_0x36de1d);}(_0x98b8,0x1d9));var _0x898b=function(_0x30628c,_0x3f7251){_0x30628c=_0x30628c-0x0;var _0x15002d=_0x98b8[_0x30628c];return _0x15002d;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x898b('0x0'));var logger=require(_0x898b('0x1'))(_0x898b('0x2'));var client=jayson[_0x898b('0x3')][_0x898b('0x4')]({'port':0x2329});client[_0x898b('0x5')]=function(_0x2f90d3,_0x2dc281){return new BPromise(function(_0x3aed54,_0x46b427){return client['request'](_0x2f90d3,_0x2dc281)[_0x898b('0x6')](function(_0xff7d1a){logger[_0x898b('0x7')](_0x898b('0x8'),'routing',_0x2f90d3,_0x2dc281,_0xff7d1a);if(_0xff7d1a[_0x898b('0x9')]){logger[_0x898b('0x9')](_0x898b('0x8'),_0x898b('0x2'),_0x2f90d3,_0xff7d1a[_0x898b('0x9')][_0x898b('0xa')],_0x2dc281);return _0x46b427(_0xff7d1a[_0x898b('0x9')][_0x898b('0xa')]);}else{return _0x3aed54(_0xff7d1a[_0x898b('0xb')]);}})[_0x898b('0xc')](function(_0x94c819){logger[_0x898b('0x9')]('rpc',_0x898b('0x2'),_0x2f90d3,_0x94c819,_0x2dc281);return _0x46b427(_0x94c819);});});};module[_0x898b('0xd')]=client; \ No newline at end of file +var _0x9cab=['result','catch','exports','jayson/promise','routing','client','http','Request','request','then','debug','rpc','error','message'];(function(_0x223807,_0x21a490){var _0x4b16e3=function(_0x41dcd8){while(--_0x41dcd8){_0x223807['push'](_0x223807['shift']());}};_0x4b16e3(++_0x21a490);}(_0x9cab,0x1a7));var _0xb9ca=function(_0x333704,_0x32bd07){_0x333704=_0x333704-0x0;var _0x38ed32=_0x9cab[_0x333704];return _0x38ed32;};'use strict';var jayson=require(_0xb9ca('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0xb9ca('0x1'));var client=jayson[_0xb9ca('0x2')][_0xb9ca('0x3')]({'port':0x2329});client[_0xb9ca('0x4')]=function(_0x14a9e0,_0x174c61){return new BPromise(function(_0x1bcac0,_0x4a3e60){return client[_0xb9ca('0x5')](_0x14a9e0,_0x174c61)[_0xb9ca('0x6')](function(_0x2d1240){logger[_0xb9ca('0x7')](_0xb9ca('0x8'),_0xb9ca('0x1'),_0x14a9e0,_0x174c61,_0x2d1240);if(_0x2d1240[_0xb9ca('0x9')]){logger[_0xb9ca('0x9')]('rpc',_0xb9ca('0x1'),_0x14a9e0,_0x2d1240[_0xb9ca('0x9')]['message'],_0x174c61);return _0x4a3e60(_0x2d1240[_0xb9ca('0x9')][_0xb9ca('0xa')]);}else{return _0x1bcac0(_0x2d1240[_0xb9ca('0xb')]);}})[_0xb9ca('0xc')](function(_0x29d92d){logger[_0xb9ca('0x9')](_0xb9ca('0x8'),'routing',_0x14a9e0,_0x29d92d,_0x174c61);return _0x4a3e60(_0x29d92d);});});};module[_0xb9ca('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 1f45a05..c5b4485 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 _0x32fb=['listen','catch','log','./server','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x32fb,0x1b3));var _0xb32f=function(_0x5bdd99,_0x52ab3b){_0x5bdd99=_0x5bdd99-0x0;var _0x586b6c=_0x32fb[_0x5bdd99];return _0x586b6c;};'use strict';var BPromise=require('bluebird');var server=require(_0xb32f('0x0'));var Realtime=require('./realtime');var user=require(_0xb32f('0x1'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xb32f('0x2'));var chatQueue=require(_0xb32f('0x3'));var smsQueue=require(_0xb32f('0x4'));var mailQueue=require(_0xb32f('0x5'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xb32f('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xb32f('0x7')]()[_0xb32f('0x8')](user[_0xb32f('0x9')]())[_0xb32f('0x8')](realtime[_0xb32f('0xa')]())['then'](interval['getIntervals']())[_0xb32f('0x8')](realtime[_0xb32f('0xb')]())[_0xb32f('0x8')](openchannelQueue[_0xb32f('0xc')]())[_0xb32f('0x8')](realtime['initOpenchannelQueues']())['then'](chatQueue[_0xb32f('0xd')]())['then'](realtime[_0xb32f('0xe')]())['then'](smsQueue[_0xb32f('0xf')]())[_0xb32f('0x8')](realtime[_0xb32f('0x10')]())[_0xb32f('0x8')](mailQueue['getMailQueues']())[_0xb32f('0x8')](realtime[_0xb32f('0x11')]())['then'](faxQueue[_0xb32f('0x12')]())[_0xb32f('0x8')](realtime[_0xb32f('0x13')]())[_0xb32f('0x8')](whatsappQueue['getWhatsappQueues']())[_0xb32f('0x8')](realtime[_0xb32f('0x14')]())[_0xb32f('0x8')](function(){return realtime;});}function main(){return server[_0xb32f('0x15')](realtime)[_0xb32f('0x8')](function(_0x216f03){return initRealtime();})[_0xb32f('0x8')](function(_0x3c3f92){return setInterval(initRealtime,0x1388);})[_0xb32f('0x16')](function(_0x441755){console[_0xb32f('0x17')](_0x441755);});}main(); \ No newline at end of file +var _0x2a8b=['./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','initAgents','then','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','./realtime','./rpc/user','./rpc/openchannelQueue'];(function(_0x3f36ed,_0x38124c){var _0x402a89=function(_0x4d8924){while(--_0x4d8924){_0x3f36ed['push'](_0x3f36ed['shift']());}};_0x402a89(++_0x38124c);}(_0x2a8b,0x1b2));var _0xb2a8=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x2a8b[_0x42245d];return _0x4b211a;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0xb2a8('0x0'));var user=require(_0xb2a8('0x1'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xb2a8('0x2'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xb2a8('0x3'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xb2a8('0x4'));var whatsappQueue=require(_0xb2a8('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xb2a8('0x6')]()['then'](user[_0xb2a8('0x7')]())['then'](realtime[_0xb2a8('0x8')]())[_0xb2a8('0x9')](interval[_0xb2a8('0xa')]())[_0xb2a8('0x9')](realtime[_0xb2a8('0xb')]())[_0xb2a8('0x9')](openchannelQueue['getOpenchannelQueues']())['then'](realtime[_0xb2a8('0xc')]())[_0xb2a8('0x9')](chatQueue[_0xb2a8('0xd')]())[_0xb2a8('0x9')](realtime[_0xb2a8('0xe')]())[_0xb2a8('0x9')](smsQueue[_0xb2a8('0xf')]())[_0xb2a8('0x9')](realtime[_0xb2a8('0x10')]())['then'](mailQueue['getMailQueues']())[_0xb2a8('0x9')](realtime['initMailQueues']())['then'](faxQueue[_0xb2a8('0x11')]())[_0xb2a8('0x9')](realtime['initFaxQueues']())['then'](whatsappQueue[_0xb2a8('0x12')]())['then'](realtime[_0xb2a8('0x13')]())[_0xb2a8('0x9')](function(){return realtime;});}function main(){return server[_0xb2a8('0x14')](realtime)[_0xb2a8('0x9')](function(_0x5dcd3e){return initRealtime();})[_0xb2a8('0x9')](function(_0x34993e){return setInterval(initRealtime,0x1388);})[_0xb2a8('0x15')](function(_0xd7167c){console[_0xb2a8('0x16')](_0xd7167c);});}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 aab041d..bdc5a1d 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x4557dc,_0x3687b2){var _0x1377aa=function(_0x41c62a){while(--_0x41c62a){_0x4557dc['push'](_0x4557dc['shift']());}};_0x1377aa(++_0x3687b2);}(_0x326f,0xd1));var _0xf326=function(_0x3db8ac,_0x1556d0){_0x3db8ac=_0x3db8ac-0x0;var _0x432c4e=_0x326f[_0x3db8ac];return _0x432c4e;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0xd48019,_0x59b3d4){var _0x1e3491=function(_0x1ba795){while(--_0x1ba795){_0xd48019['push'](_0xd48019['shift']());}};_0x1e3491(++_0x59b3d4);}(_0xe14b,0x93));var _0xbe14=function(_0x4d1e1f,_0x257a69){_0x4d1e1f=_0x4d1e1f-0x0;var _0x1fd04e=_0xe14b[_0x4d1e1f];return _0x1fd04e;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 772580d..def5673 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 _0x0f95=['jayson/promise','http','request','then','error','catch','sendMailMessage','SendMail','bluebird'];(function(_0x515844,_0xf6f7e1){var _0x482df0=function(_0x3ec3d8){while(--_0x3ec3d8){_0x515844['push'](_0x515844['shift']());}};_0x482df0(++_0xf6f7e1);}(_0x0f95,0x14c));var _0x50f9=function(_0x26e727,_0x3e65be){_0x26e727=_0x26e727-0x0;var _0x563800=_0x0f95[_0x26e727];return _0x563800;};'use strict';var BPromise=require(_0x50f9('0x0'));var jayson=require(_0x50f9('0x1'));var client=jayson['client'][_0x50f9('0x2')]({'port':0x232b});function request(_0x468b73,_0x4cc57c){return new BPromise(function(_0x18424f,_0xa5b2cd){return client[_0x50f9('0x3')](_0x468b73,_0x4cc57c)[_0x50f9('0x4')](function(_0x4229d2){if(_0x4229d2[_0x50f9('0x5')]){return _0xa5b2cd(_0x4229d2['error']['message']);}else{return _0x18424f(_0x4229d2['result']);}})[_0x50f9('0x6')](function(_0x4e3efa){return _0xa5b2cd(_0x4e3efa);});});}exports[_0x50f9('0x7')]=function(_0x3efc6d,_0x98392e){return request(_0x50f9('0x8'),{'account':_0x3efc6d,'message':_0x98392e});}; \ No newline at end of file +var _0x3708=['sendMailMessage','SendMail','bluebird','jayson/promise','http','then','error','result'];(function(_0x10fe24,_0x101b10){var _0x3efa2e=function(_0x38365f){while(--_0x38365f){_0x10fe24['push'](_0x10fe24['shift']());}};_0x3efa2e(++_0x101b10);}(_0x3708,0x1a2));var _0x8370=function(_0x529680,_0x2d810d){_0x529680=_0x529680-0x0;var _0x18ff8a=_0x3708[_0x529680];return _0x18ff8a;};'use strict';var BPromise=require(_0x8370('0x0'));var jayson=require(_0x8370('0x1'));var client=jayson['client'][_0x8370('0x2')]({'port':0x232b});function request(_0x4aebf1,_0x5af823){return new BPromise(function(_0xef111,_0x6248ad){return client['request'](_0x4aebf1,_0x5af823)[_0x8370('0x3')](function(_0x5bab58){if(_0x5bab58[_0x8370('0x4')]){return _0x6248ad(_0x5bab58[_0x8370('0x4')]['message']);}else{return _0xef111(_0x5bab58[_0x8370('0x5')]);}})['catch'](function(_0x5b990e){return _0x6248ad(_0x5b990e);});});}exports[_0x8370('0x6')]=function(_0x558adf,_0xe9ccb4){return request(_0x8370('0x7'),{'account':_0x558adf,'message':_0xe9ccb4});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 4b28fcf..9fe2012 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 _0xdc4c=['whatsappCurrentCapacity','openchannelCurrentCapacity','stringify','emit','user:save','exports','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','idle','prototype','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','whatsappStatus'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xdc4c,0xc0));var _0xcdc4=function(_0x2779f6,_0x5eb45c){_0x2779f6=_0x2779f6-0x0;var _0x4c3a4b=_0xdc4c[_0x2779f6];return _0x4c3a4b;};'use strict';var _=require('lodash');var moment=require(_0xcdc4('0x0'));var md5=require(_0xcdc4('0x1'));var Redis=require(_0xcdc4('0x2'));var config=require('../../../config/environment');config[_0xcdc4('0x3')]=_[_0xcdc4('0x4')](config[_0xcdc4('0x3')],{'host':_0xcdc4('0x5'),'port':0x18eb});var io=require(_0xcdc4('0x6'))(new Redis(config[_0xcdc4('0x3')]));function Agent(_0x58e310){this['id']=_0x58e310['id']||0x0;this[_0xcdc4('0x7')]=_0x58e310['name']||'';this[_0xcdc4('0x8')]=_0x58e310[_0xcdc4('0x8')]||!![];this[_0xcdc4('0x9')]=_0x58e310['voicePause']||![];this['chatPause']=_0x58e310[_0xcdc4('0xa')]||![];this['mailPause']=_0x58e310[_0xcdc4('0xb')]||![];this[_0xcdc4('0xc')]=_0x58e310[_0xcdc4('0xc')]||![];this['smsPause']=_0x58e310[_0xcdc4('0xd')]||![];this[_0xcdc4('0xe')]=_0x58e310['openchannelPause']||![];this[_0xcdc4('0xf')]=_0xcdc4('0x10');this[_0xcdc4('0x11')]=0x0;this[_0xcdc4('0x12')]=_0x58e310[_0xcdc4('0x12')]||0x0;this[_0xcdc4('0x13')]=0x0;this[_0xcdc4('0x14')]=_0xcdc4('0x10');this['mailStatusTime']=0x0;this[_0xcdc4('0x15')]=_0x58e310['mailCapacity']||0x0;this[_0xcdc4('0x16')]=0x0;this[_0xcdc4('0x17')]=_0xcdc4('0x10');this[_0xcdc4('0x18')]=0x0;this[_0xcdc4('0x19')]=_0x58e310['faxCapacity']||0x0;this[_0xcdc4('0x1a')]=0x0;this[_0xcdc4('0x1b')]='unknown';this[_0xcdc4('0x1c')]=0x0;this[_0xcdc4('0x1d')]=_0x58e310[_0xcdc4('0x1d')]||0x0;this[_0xcdc4('0x1e')]=0x0;this['whatsappStatus']=_0xcdc4('0x10');this[_0xcdc4('0x1f')]=0x0;this[_0xcdc4('0x20')]=_0x58e310[_0xcdc4('0x20')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xcdc4('0x21')]=_0xcdc4('0x10');this[_0xcdc4('0x22')]=0x0;this[_0xcdc4('0x23')]=_0x58e310['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xcdc4('0x24')]=![];this[_0xcdc4('0x25')]=undefined;this[_0xcdc4('0x1')]='';this[_0xcdc4('0x26')]();}Agent['prototype'][_0xcdc4('0x27')]=function(_0x24f96d){if(this[_0x24f96d+_0xcdc4('0x28')]>0x0){if(this[_0x24f96d+'Capacity']>0x0&&this[_0x24f96d+'CurrentCapacity']>=this[_0x24f96d+_0xcdc4('0x29')]){return'maxcapacity';}else{return'working';}}else{return _0xcdc4('0x2a');}};Agent[_0xcdc4('0x2b')][_0xcdc4('0x26')]=function(){var _0xf00935=[_0xcdc4('0x2c'),_0xcdc4('0x2d'),_0xcdc4('0x2e'),_0xcdc4('0x2f'),_0xcdc4('0x30'),_0xcdc4('0x31')];for(var _0x22bb58=0x0;_0x22bb58<_0xf00935[_0xcdc4('0x32')];_0x22bb58+=0x1){var _0x5408be=this[_0xcdc4('0x27')](_0xf00935[_0x22bb58]);if(this[_0xf00935[_0x22bb58]+_0xcdc4('0x33')]!==_0x5408be){this[_0xf00935[_0x22bb58]+_0xcdc4('0x34')]=_[_0xcdc4('0x35')](moment()[_0xcdc4('0x36')]('x'));}this[_0xf00935[_0x22bb58]+_0xcdc4('0x33')]=_0x5408be;}var _0x5346cc={'id':this['id'],'name':this[_0xcdc4('0x7')],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0xcdc4('0xa')],'mailPause':this[_0xcdc4('0xb')],'smsPause':this[_0xcdc4('0xd')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xcdc4('0xf')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xcdc4('0x12')],'chatCurrentCapacity':this[_0xcdc4('0x13')],'mailStatus':this[_0xcdc4('0x14')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xcdc4('0x15')],'mailCurrentCapacity':this[_0xcdc4('0x16')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xcdc4('0x1c')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xcdc4('0x1e')],'whatsappStatus':this[_0xcdc4('0x37')],'whatsappStatusTime':this[_0xcdc4('0x1f')],'whatsappCapacity':this[_0xcdc4('0x20')],'whatsappCurrentCapacity':this[_0xcdc4('0x38')],'openchannelStatus':this[_0xcdc4('0x21')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xcdc4('0x23')],'openchannelCurrentCapacity':this[_0xcdc4('0x39')],'busy':this['busy'],'busyQueue':this['busyQueue']};var _0x590e6f=md5(JSON[_0xcdc4('0x3a')](_0x5346cc));if(this[_0xcdc4('0x1')]!==_0x590e6f){this[_0xcdc4('0x1')]=_0x590e6f;io[_0xcdc4('0x3b')](_0xcdc4('0x3c'),_0x5346cc);}};module[_0xcdc4('0x3d')]=Agent; \ No newline at end of file +var _0x7996=['openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','prototype','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','format','faxStatus','smsStatus','whatsappCurrentCapacity','busyQueue','stringify','emit','user:save','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus'];(function(_0x165b86,_0x88f749){var _0x497cf2=function(_0x26beb2){while(--_0x26beb2){_0x165b86['push'](_0x165b86['shift']());}};_0x497cf2(++_0x88f749);}(_0x7996,0x14d));var _0x6799=function(_0x284885,_0x34b143){_0x284885=_0x284885-0x0;var _0x3a9710=_0x7996[_0x284885];return _0x3a9710;};'use strict';var _=require('lodash');var moment=require(_0x6799('0x0'));var md5=require(_0x6799('0x1'));var Redis=require(_0x6799('0x2'));var config=require(_0x6799('0x3'));config[_0x6799('0x4')]=_[_0x6799('0x5')](config[_0x6799('0x4')],{'host':_0x6799('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6799('0x4')]));function Agent(_0x5b1fe6){this['id']=_0x5b1fe6['id']||0x0;this[_0x6799('0x7')]=_0x5b1fe6['name']||'';this[_0x6799('0x8')]=_0x5b1fe6['online']||!![];this[_0x6799('0x9')]=_0x5b1fe6[_0x6799('0x9')]||![];this[_0x6799('0xa')]=_0x5b1fe6[_0x6799('0xa')]||![];this[_0x6799('0xb')]=_0x5b1fe6[_0x6799('0xb')]||![];this[_0x6799('0xc')]=_0x5b1fe6['faxPause']||![];this[_0x6799('0xd')]=_0x5b1fe6['smsPause']||![];this[_0x6799('0xe')]=_0x5b1fe6['openchannelPause']||![];this[_0x6799('0xf')]=_0x6799('0x10');this[_0x6799('0x11')]=0x0;this[_0x6799('0x12')]=_0x5b1fe6[_0x6799('0x12')]||0x0;this[_0x6799('0x13')]=0x0;this[_0x6799('0x14')]=_0x6799('0x10');this[_0x6799('0x15')]=0x0;this[_0x6799('0x16')]=_0x5b1fe6[_0x6799('0x16')]||0x0;this[_0x6799('0x17')]=0x0;this['faxStatus']=_0x6799('0x10');this[_0x6799('0x18')]=0x0;this[_0x6799('0x19')]=_0x5b1fe6[_0x6799('0x19')]||0x0;this[_0x6799('0x1a')]=0x0;this['smsStatus']=_0x6799('0x10');this[_0x6799('0x1b')]=0x0;this[_0x6799('0x1c')]=_0x5b1fe6[_0x6799('0x1c')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x6799('0x1d')]=_0x6799('0x10');this[_0x6799('0x1e')]=0x0;this[_0x6799('0x1f')]=_0x5b1fe6['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x6799('0x20')]=_0x6799('0x10');this[_0x6799('0x21')]=0x0;this['openchannelCapacity']=_0x5b1fe6[_0x6799('0x22')]||0x0;this[_0x6799('0x23')]=0x0;this[_0x6799('0x24')]=![];this['busyQueue']=undefined;this[_0x6799('0x1')]='';this[_0x6799('0x25')]();}Agent['prototype'][_0x6799('0x26')]=function(_0x3f2e71){if(this[_0x3f2e71+_0x6799('0x27')]>0x0){if(this[_0x3f2e71+_0x6799('0x28')]>0x0&&this[_0x3f2e71+_0x6799('0x27')]>=this[_0x3f2e71+_0x6799('0x28')]){return _0x6799('0x29');}else{return _0x6799('0x2a');}}else{return'idle';}};Agent[_0x6799('0x2b')]['updateRealtime']=function(){var _0x219fae=[_0x6799('0x2c'),_0x6799('0x2d'),_0x6799('0x2e'),_0x6799('0x2f'),_0x6799('0x30'),_0x6799('0x31')];for(var _0x44bdb0=0x0;_0x44bdb0<_0x219fae[_0x6799('0x32')];_0x44bdb0+=0x1){var _0x166dd2=this['getChannelStatus'](_0x219fae[_0x44bdb0]);if(this[_0x219fae[_0x44bdb0]+_0x6799('0x33')]!==_0x166dd2){this[_0x219fae[_0x44bdb0]+_0x6799('0x34')]=_['toNumber'](moment()[_0x6799('0x35')]('x'));}this[_0x219fae[_0x44bdb0]+_0x6799('0x33')]=_0x166dd2;}var _0xa03314={'id':this['id'],'name':this[_0x6799('0x7')],'online':this[_0x6799('0x8')],'voicePause':this[_0x6799('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0x6799('0xb')],'smsPause':this[_0x6799('0xd')],'faxPause':this[_0x6799('0xc')],'openchannelPause':this[_0x6799('0xe')],'chatStatus':this[_0x6799('0xf')],'chatStatusTime':this[_0x6799('0x11')],'chatCapacity':this[_0x6799('0x12')],'chatCurrentCapacity':this[_0x6799('0x13')],'mailStatus':this[_0x6799('0x14')],'mailStatusTime':this[_0x6799('0x15')],'mailCapacity':this[_0x6799('0x16')],'mailCurrentCapacity':this[_0x6799('0x17')],'faxStatus':this[_0x6799('0x36')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x6799('0x1a')],'smsStatus':this[_0x6799('0x37')],'smsStatusTime':this[_0x6799('0x1b')],'smsCapacity':this[_0x6799('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x6799('0x1d')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x6799('0x1f')],'whatsappCurrentCapacity':this[_0x6799('0x38')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x6799('0x21')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x6799('0x23')],'busy':this[_0x6799('0x24')],'busyQueue':this[_0x6799('0x39')]};var _0xe80ca7=md5(JSON[_0x6799('0x3a')](_0xa03314));if(this[_0x6799('0x1')]!==_0xe80ca7){this[_0x6799('0x1')]=_0xe80ca7;io[_0x6799('0x3b')](_0x6799('0x3c'),_0xa03314);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 2dd6aed..eb89219 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 _0x5bf9=['stringify','format','chat:queue:%s','chat_queue:save','lodash','md5','util','ioredis','../../../config/environment','defaults','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','map','updateRealtime','length','online','chatPause','paused','available','loggedIn'];(function(_0x356bdc,_0x1cdf56){var _0x3cca1f=function(_0x31463e){while(--_0x31463e){_0x356bdc['push'](_0x356bdc['shift']());}};_0x3cca1f(++_0x1cdf56);}(_0x5bf9,0xb2));var _0x95bf=function(_0x121e8b,_0x3b246d){_0x121e8b=_0x121e8b-0x0;var _0x2d8094=_0x5bf9[_0x121e8b];return _0x2d8094;};'use strict';var _=require(_0x95bf('0x0'));var md5=require(_0x95bf('0x1'));var util=require(_0x95bf('0x2'));var Redis=require(_0x95bf('0x3'));var config=require(_0x95bf('0x4'));config['redis']=_[_0x95bf('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x95bf('0x6'))(new Redis(config[_0x95bf('0x7')]));function ChatQueue(_0x37e454){this['id']=_0x37e454['id']||0x0;this[_0x95bf('0x8')]=_0x37e454['name']||'';this[_0x95bf('0x9')]=_0x37e454['timeout']||0xa;this[_0x95bf('0xa')]=_0x37e454[_0x95bf('0xa')]||_0x95bf('0xb');this['Agents']=_0x37e454[_0x95bf('0xc')];this[_0x95bf('0xd')]={};this[_0x95bf('0xe')]=0x0;this[_0x95bf('0x1')]='';this[_0x95bf('0xf')]();this['updateRealtime']();}ChatQueue[_0x95bf('0x10')][_0x95bf('0xf')]=function(){var _0x2c1262=this[_0x95bf('0xd')]['_rr'];this[_0x95bf('0xd')]=_[_0x95bf('0x11')](this[_0x95bf('0xc')],'id');this[_0x95bf('0xd')]['_rr']=_0x2c1262;};ChatQueue[_0x95bf('0x10')][_0x95bf('0x12')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x28bb05=0x0;_0x28bb05=0x0?this['available']:0x0;var _0x541027={'id':this['id'],'available':this[_0x95bf('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x95bf('0x8')],'paused':this['paused'],'waiting':this[_0x95bf('0xe')]};var _0x16032f=md5(JSON[_0x95bf('0x19')](_0x541027));if(this['md5']!==_0x16032f){this[_0x95bf('0x1')]=_0x16032f;io['to'](util[_0x95bf('0x1a')](_0x95bf('0x1b'),_0x541027['name']))['emit'](_0x95bf('0x1c'),_0x541027);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x9d7f=['loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr'];(function(_0x2067e9,_0x5e6a97){var _0x280ce4=function(_0x2eca23){while(--_0x2eca23){_0x2067e9['push'](_0x2067e9['shift']());}};_0x280ce4(++_0x5e6a97);}(_0x9d7f,0x173));var _0xf9d7=function(_0x485ca5,_0x3d6684){_0x485ca5=_0x485ca5-0x0;var _0x275721=_0x9d7f[_0x485ca5];return _0x275721;};'use strict';var _=require(_0xf9d7('0x0'));var md5=require(_0xf9d7('0x1'));var util=require(_0xf9d7('0x2'));var Redis=require('ioredis');var config=require(_0xf9d7('0x3'));config[_0xf9d7('0x4')]=_[_0xf9d7('0x5')](config['redis'],{'host':_0xf9d7('0x6'),'port':0x18eb});var io=require(_0xf9d7('0x7'))(new Redis(config[_0xf9d7('0x4')]));function ChatQueue(_0x4af2c1){this['id']=_0x4af2c1['id']||0x0;this['name']=_0x4af2c1[_0xf9d7('0x8')]||'';this[_0xf9d7('0x9')]=_0x4af2c1['timeout']||0xa;this[_0xf9d7('0xa')]=_0x4af2c1[_0xf9d7('0xa')]||_0xf9d7('0xb');this[_0xf9d7('0xc')]=_0x4af2c1[_0xf9d7('0xc')];this[_0xf9d7('0xd')]={};this[_0xf9d7('0xe')]=0x0;this[_0xf9d7('0x1')]='';this[_0xf9d7('0xf')]();this[_0xf9d7('0x10')]();}ChatQueue[_0xf9d7('0x11')][_0xf9d7('0xf')]=function(){var _0x12a03f=this['mapAgentsId']['_rr'];this[_0xf9d7('0xd')]=_['map'](this[_0xf9d7('0xc')],'id');this['mapAgentsId'][_0xf9d7('0x12')]=_0x12a03f;};ChatQueue['prototype'][_0xf9d7('0x10')]=function(){this[_0xf9d7('0x13')]=0x0;this[_0xf9d7('0x14')]=0x0;for(var _0x53599a=0x0;_0x53599a=0x0?this[_0xf9d7('0x18')]:0x0;var _0x280885={'id':this['id'],'available':this[_0xf9d7('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xf9d7('0x8')],'paused':this[_0xf9d7('0x14')],'waiting':this[_0xf9d7('0xe')]};var _0x53439b=md5(JSON[_0xf9d7('0x19')](_0x280885));if(this[_0xf9d7('0x1')]!==_0x53439b){this[_0xf9d7('0x1')]=_0x53439b;io['to'](util[_0xf9d7('0x1a')](_0xf9d7('0x1b'),_0x280885[_0xf9d7('0x8')]))[_0xf9d7('0x1c')](_0xf9d7('0x1d'),_0x280885);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 471905e..cad560e 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 _0xf9b2=['online','faxPause','available','stringify','format','fax:queue:%s','emit','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','paused','length'];(function(_0x9172e3,_0x454bff){var _0x345601=function(_0x50d060){while(--_0x50d060){_0x9172e3['push'](_0x9172e3['shift']());}};_0x345601(++_0x454bff);}(_0xf9b2,0x19b));var _0x2f9b=function(_0x522d56,_0x595fdc){_0x522d56=_0x522d56-0x0;var _0x2b87f0=_0xf9b2[_0x522d56];return _0x2b87f0;};'use strict';var _=require('lodash');var md5=require(_0x2f9b('0x0'));var util=require(_0x2f9b('0x1'));var Redis=require(_0x2f9b('0x2'));var config=require(_0x2f9b('0x3'));config[_0x2f9b('0x4')]=_[_0x2f9b('0x5')](config[_0x2f9b('0x4')],{'host':_0x2f9b('0x6'),'port':0x18eb});var io=require(_0x2f9b('0x7'))(new Redis(config['redis']));function FaxQueue(_0x46ecb7){this['id']=_0x46ecb7['id']||0x0;this['name']=_0x46ecb7[_0x2f9b('0x8')]||'';this[_0x2f9b('0x9')]=_0x46ecb7[_0x2f9b('0x9')]||0xa;this[_0x2f9b('0xa')]=_0x46ecb7[_0x2f9b('0xa')]||_0x2f9b('0xb');this['Agents']=_0x46ecb7[_0x2f9b('0xc')];this['mapAgentsId']={};this[_0x2f9b('0xd')]=0x0;this['md5']='';this[_0x2f9b('0xe')]();this[_0x2f9b('0xf')]();}FaxQueue[_0x2f9b('0x10')][_0x2f9b('0xe')]=function(){var _0x10b4ca=this['mapAgentsId'][_0x2f9b('0x11')];this[_0x2f9b('0x12')]=_[_0x2f9b('0x13')](this[_0x2f9b('0xc')],'id');this[_0x2f9b('0x12')][_0x2f9b('0x11')]=_0x10b4ca;};FaxQueue[_0x2f9b('0x10')][_0x2f9b('0xf')]=function(){this[_0x2f9b('0x14')]=0x0;this[_0x2f9b('0x15')]=0x0;for(var _0x514cfb=0x0;_0x514cfb=0x0?this['available']:0x0;var _0x3fc451={'id':this['id'],'available':this[_0x2f9b('0x19')],'loggedIn':this['loggedIn'],'name':this[_0x2f9b('0x8')],'paused':this[_0x2f9b('0x15')],'waiting':this[_0x2f9b('0xd')]};var _0x520c96=md5(JSON[_0x2f9b('0x1a')](_0x3fc451));if(this[_0x2f9b('0x0')]!==_0x520c96){this['md5']=_0x520c96;io['to'](util[_0x2f9b('0x1b')](_0x2f9b('0x1c'),_0x3fc451['name']))[_0x2f9b('0x1d')]('fax_queue:save',_0x3fc451);}};module[_0x2f9b('0x1e')]=FaxQueue; \ No newline at end of file +var _0xa555=['paused','length','online','available','loggedIn','waiting','stringify','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype'];(function(_0x31d0cb,_0xfd72d6){var _0x56f2ad=function(_0x5cc56c){while(--_0x5cc56c){_0x31d0cb['push'](_0x31d0cb['shift']());}};_0x56f2ad(++_0xfd72d6);}(_0xa555,0x110));var _0x5a55=function(_0xd1b4d7,_0x28b2c1){_0xd1b4d7=_0xd1b4d7-0x0;var _0x3002ec=_0xa555[_0xd1b4d7];return _0x3002ec;};'use strict';var _=require(_0x5a55('0x0'));var md5=require(_0x5a55('0x1'));var util=require(_0x5a55('0x2'));var Redis=require(_0x5a55('0x3'));var config=require(_0x5a55('0x4'));config['redis']=_['defaults'](config[_0x5a55('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x5a55('0x6'))(new Redis(config[_0x5a55('0x5')]));function FaxQueue(_0x5b73e8){this['id']=_0x5b73e8['id']||0x0;this['name']=_0x5b73e8[_0x5a55('0x7')]||'';this[_0x5a55('0x8')]=_0x5b73e8[_0x5a55('0x8')]||0xa;this[_0x5a55('0x9')]=_0x5b73e8[_0x5a55('0x9')]||_0x5a55('0xa');this[_0x5a55('0xb')]=_0x5b73e8[_0x5a55('0xb')];this[_0x5a55('0xc')]={};this['waiting']=0x0;this[_0x5a55('0x1')]='';this[_0x5a55('0xd')]();this[_0x5a55('0xe')]();}FaxQueue['prototype'][_0x5a55('0xd')]=function(){var _0x1943e9=this[_0x5a55('0xc')]['_rr'];this[_0x5a55('0xc')]=_[_0x5a55('0xf')](this['Agents'],'id');this[_0x5a55('0xc')][_0x5a55('0x10')]=_0x1943e9;};FaxQueue[_0x5a55('0x11')][_0x5a55('0xe')]=function(){this['loggedIn']=0x0;this[_0x5a55('0x12')]=0x0;for(var _0x1794f2=0x0;_0x1794f2=0x0?this[_0x5a55('0x15')]:0x0;var _0x260599={'id':this['id'],'available':this[_0x5a55('0x15')],'loggedIn':this[_0x5a55('0x16')],'name':this[_0x5a55('0x7')],'paused':this[_0x5a55('0x12')],'waiting':this[_0x5a55('0x17')]};var _0x57a7e6=md5(JSON[_0x5a55('0x18')](_0x260599));if(this[_0x5a55('0x1')]!==_0x57a7e6){this[_0x5a55('0x1')]=_0x57a7e6;io['to'](util['format'](_0x5a55('0x19'),_0x260599['name']))[_0x5a55('0x1a')](_0x5a55('0x1b'),_0x260599);}};module[_0x5a55('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index a02a81f..d235fd4 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 _0x5cbf=['exports','name','Intervals'];(function(_0x5e6333,_0x7401d){var _0x315b08=function(_0x4b429d){while(--_0x4b429d){_0x5e6333['push'](_0x5e6333['shift']());}};_0x315b08(++_0x7401d);}(_0x5cbf,0x7c));var _0xf5cb=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x5cbf[_0x24259d];return _0x5a701;};'use strict';function Interval(_0x2b9428){this['id']=_0x2b9428['id']||0x0;this[_0xf5cb('0x0')]=_0x2b9428[_0xf5cb('0x0')]||'';this[_0xf5cb('0x1')]=_0x2b9428[_0xf5cb('0x1')]||{};}module[_0xf5cb('0x2')]=Interval; \ No newline at end of file +var _0x904b=['name','Intervals','exports'];(function(_0x3eddee,_0x4fa960){var _0x465e8a=function(_0x452681){while(--_0x452681){_0x3eddee['push'](_0x3eddee['shift']());}};_0x465e8a(++_0x4fa960);}(_0x904b,0x1b0));var _0xb904=function(_0x3091a9,_0xc1f52c){_0x3091a9=_0x3091a9-0x0;var _0x365735=_0x904b[_0x3091a9];return _0x365735;};'use strict';function Interval(_0x3087a5){this['id']=_0x3087a5['id']||0x0;this[_0xb904('0x0')]=_0x3087a5[_0xb904('0x0')]||'';this[_0xb904('0x1')]=_0x3087a5['Intervals']||{};}module[_0xb904('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 de8cb4e..db56996 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 _0x1cad=['name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','updateRealtime','loggedIn','length','online','available','paused','stringify','format','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter'];(function(_0x236801,_0x1868b6){var _0x32d366=function(_0x16adea){while(--_0x16adea){_0x236801['push'](_0x236801['shift']());}};_0x32d366(++_0x1868b6);}(_0x1cad,0xd8));var _0xd1ca=function(_0x1977d4,_0x5ccd49){_0x1977d4=_0x1977d4-0x0;var _0x38518d=_0x1cad[_0x1977d4];return _0x38518d;};'use strict';var _=require(_0xd1ca('0x0'));var md5=require(_0xd1ca('0x1'));var util=require(_0xd1ca('0x2'));var Redis=require(_0xd1ca('0x3'));var config=require(_0xd1ca('0x4'));config[_0xd1ca('0x5')]=_['defaults'](config['redis'],{'host':_0xd1ca('0x6'),'port':0x18eb});var io=require(_0xd1ca('0x7'))(new Redis(config[_0xd1ca('0x5')]));function MailQueue(_0x3c586e){this['id']=_0x3c586e['id']||0x0;this[_0xd1ca('0x8')]=_0x3c586e['name']||'';this[_0xd1ca('0x9')]=_0x3c586e[_0xd1ca('0x9')]||0xa;this[_0xd1ca('0xa')]=_0x3c586e[_0xd1ca('0xa')]||_0xd1ca('0xb');this[_0xd1ca('0xc')]=_0x3c586e['Agents'];this['mapAgentsId']={};this[_0xd1ca('0xd')]=0x0;this[_0xd1ca('0x1')]='';this[_0xd1ca('0xe')]();this['updateRealtime']();}MailQueue[_0xd1ca('0xf')][_0xd1ca('0xe')]=function(){var _0x5b9624=this[_0xd1ca('0x10')][_0xd1ca('0x11')];this[_0xd1ca('0x10')]=_[_0xd1ca('0x12')](this[_0xd1ca('0xc')],'id');this[_0xd1ca('0x10')]['_rr']=_0x5b9624;};MailQueue['prototype'][_0xd1ca('0x13')]=function(){this[_0xd1ca('0x14')]=0x0;this['paused']=0x0;for(var _0x2f77a5=0x0;_0x2f77a5=0x0?this[_0xd1ca('0x17')]:0x0;var _0x48b538={'id':this['id'],'available':this[_0xd1ca('0x17')],'loggedIn':this[_0xd1ca('0x14')],'name':this[_0xd1ca('0x8')],'paused':this[_0xd1ca('0x18')],'waiting':this[_0xd1ca('0xd')]};var _0x41c78e=md5(JSON[_0xd1ca('0x19')](_0x48b538));if(this[_0xd1ca('0x1')]!==_0x41c78e){this[_0xd1ca('0x1')]=_0x41c78e;io['to'](util[_0xd1ca('0x1a')]('mail:queue:%s',_0x48b538[_0xd1ca('0x8')]))['emit']('mail_queue:save',_0x48b538);}};module[_0xd1ca('0x1b')]=MailQueue; \ No newline at end of file +var _0x019a=['_rr','updateRealtime','loggedIn','paused','length','online','mailPause','available','mail:queue:%s','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','prototype','updateRouting','map'];(function(_0x279fed,_0x1f6eea){var _0x5531c6=function(_0x503dc0){while(--_0x503dc0){_0x279fed['push'](_0x279fed['shift']());}};_0x5531c6(++_0x1f6eea);}(_0x019a,0xd2));var _0xa019=function(_0x3d3d45,_0x4e883d){_0x3d3d45=_0x3d3d45-0x0;var _0x1c9efa=_0x019a[_0x3d3d45];return _0x1c9efa;};'use strict';var _=require(_0xa019('0x0'));var md5=require(_0xa019('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xa019('0x2'));config[_0xa019('0x3')]=_[_0xa019('0x4')](config[_0xa019('0x3')],{'host':_0xa019('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa019('0x3')]));function MailQueue(_0x48e0a0){this['id']=_0x48e0a0['id']||0x0;this['name']=_0x48e0a0[_0xa019('0x6')]||'';this[_0xa019('0x7')]=_0x48e0a0[_0xa019('0x7')]||0xa;this[_0xa019('0x8')]=_0x48e0a0['strategy']||'beepall';this[_0xa019('0x9')]=_0x48e0a0[_0xa019('0x9')];this[_0xa019('0xa')]={};this[_0xa019('0xb')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0xa019('0xc')][_0xa019('0xd')]=function(){var _0x2580d8=this[_0xa019('0xa')]['_rr'];this[_0xa019('0xa')]=_[_0xa019('0xe')](this[_0xa019('0x9')],'id');this[_0xa019('0xa')][_0xa019('0xf')]=_0x2580d8;};MailQueue[_0xa019('0xc')][_0xa019('0x10')]=function(){this[_0xa019('0x11')]=0x0;this[_0xa019('0x12')]=0x0;for(var _0x563b9a=0x0;_0x563b9a=0x0?this[_0xa019('0x16')]:0x0;var _0x5b7518={'id':this['id'],'available':this[_0xa019('0x16')],'loggedIn':this[_0xa019('0x11')],'name':this[_0xa019('0x6')],'paused':this['paused'],'waiting':this['waiting']};var _0x2b965b=md5(JSON['stringify'](_0x5b7518));if(this['md5']!==_0x2b965b){this[_0xa019('0x1')]=_0x2b965b;io['to'](util['format'](_0xa019('0x17'),_0x5b7518[_0xa019('0x6')]))['emit']('mail_queue:save',_0x5b7518);}};module[_0xa019('0x18')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 53d35c7..aaaa443 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 _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(_0x443fda,_0xb06d0a){var _0x58360d=function(_0xfb6e21){while(--_0xfb6e21){_0x443fda['push'](_0x443fda['shift']());}};_0x58360d(++_0xb06d0a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x397f37,_0x3cf86d){_0x397f37=_0x397f37-0x0;var _0x31cae6=_0x5fc3[_0x397f37];return _0x31cae6;};'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 +var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0x2ef3,0xba));var _0x32ef=function(_0x51c523,_0x43f585){_0x51c523=_0x51c523-0x0;var _0xdbf305=_0x2ef3[_0x51c523];return _0xdbf305;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index bc7b0e5..ec4f8e2 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 _0xf725=['loggedIn','smsPause','available','paused','waiting','stringify','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','prototype','_rr','map','updateRealtime'];(function(_0x6efd85,_0x504bd9){var _0x2714ed=function(_0x190c51){while(--_0x190c51){_0x6efd85['push'](_0x6efd85['shift']());}};_0x2714ed(++_0x504bd9);}(_0xf725,0x7e));var _0x5f72=function(_0xcfc81b,_0x55d7f0){_0xcfc81b=_0xcfc81b-0x0;var _0x3fa4d9=_0xf725[_0xcfc81b];return _0x3fa4d9;};'use strict';var _=require(_0x5f72('0x0'));var md5=require(_0x5f72('0x1'));var util=require(_0x5f72('0x2'));var Redis=require(_0x5f72('0x3'));var config=require(_0x5f72('0x4'));config[_0x5f72('0x5')]=_[_0x5f72('0x6')](config[_0x5f72('0x5')],{'host':_0x5f72('0x7'),'port':0x18eb});var io=require(_0x5f72('0x8'))(new Redis(config['redis']));function SmsQueue(_0x453992){this['id']=_0x453992['id']||0x0;this[_0x5f72('0x9')]=_0x453992[_0x5f72('0x9')]||'';this[_0x5f72('0xa')]=_0x453992[_0x5f72('0xa')]||0xa;this[_0x5f72('0xb')]=_0x453992[_0x5f72('0xb')]||'beepall';this['Agents']=_0x453992[_0x5f72('0xc')];this[_0x5f72('0xd')]={};this['waiting']=0x0;this[_0x5f72('0x1')]='';this[_0x5f72('0xe')]();this['updateRealtime']();}SmsQueue[_0x5f72('0xf')][_0x5f72('0xe')]=function(){var _0x115372=this[_0x5f72('0xd')][_0x5f72('0x10')];this[_0x5f72('0xd')]=_[_0x5f72('0x11')](this['Agents'],'id');this[_0x5f72('0xd')][_0x5f72('0x10')]=_0x115372;};SmsQueue[_0x5f72('0xf')][_0x5f72('0x12')]=function(){this[_0x5f72('0x13')]=0x0;this['paused']=0x0;for(var _0x43d1fd=0x0;_0x43d1fd=0x0?this[_0x5f72('0x15')]:0x0;var _0x4af7d3={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x5f72('0x9')],'paused':this[_0x5f72('0x16')],'waiting':this[_0x5f72('0x17')]};var _0x32f487=md5(JSON[_0x5f72('0x18')](_0x4af7d3));if(this[_0x5f72('0x1')]!==_0x32f487){this[_0x5f72('0x1')]=_0x32f487;io['to'](util['format'](_0x5f72('0x19'),_0x4af7d3[_0x5f72('0x9')]))[_0x5f72('0x1a')](_0x5f72('0x1b'),_0x4af7d3);}};module[_0x5f72('0x1c')]=SmsQueue; \ No newline at end of file +var _0xa75b=['stringify','format','sms:queue:%s','sms_queue:save','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr','map','Agents','paused','length','online','loggedIn','smsPause','available'];(function(_0x1bdea8,_0x14e1a8){var _0x15b8ac=function(_0x192314){while(--_0x192314){_0x1bdea8['push'](_0x1bdea8['shift']());}};_0x15b8ac(++_0x14e1a8);}(_0xa75b,0x170));var _0xba75=function(_0x14a701,_0x5249b4){_0x14a701=_0x14a701-0x0;var _0x10e619=_0xa75b[_0x14a701];return _0x10e619;};'use strict';var _=require(_0xba75('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xba75('0x1'));var config=require(_0xba75('0x2'));config[_0xba75('0x3')]=_[_0xba75('0x4')](config[_0xba75('0x3')],{'host':_0xba75('0x5'),'port':0x18eb});var io=require(_0xba75('0x6'))(new Redis(config[_0xba75('0x3')]));function SmsQueue(_0x32a1e9){this['id']=_0x32a1e9['id']||0x0;this[_0xba75('0x7')]=_0x32a1e9[_0xba75('0x7')]||'';this[_0xba75('0x8')]=_0x32a1e9[_0xba75('0x8')]||0xa;this['strategy']=_0x32a1e9['strategy']||_0xba75('0x9');this['Agents']=_0x32a1e9['Agents'];this[_0xba75('0xa')]={};this['waiting']=0x0;this[_0xba75('0xb')]='';this[_0xba75('0xc')]();this[_0xba75('0xd')]();}SmsQueue[_0xba75('0xe')][_0xba75('0xc')]=function(){var _0xc50bda=this[_0xba75('0xa')][_0xba75('0xf')];this[_0xba75('0xa')]=_[_0xba75('0x10')](this[_0xba75('0x11')],'id');this[_0xba75('0xa')]['_rr']=_0xc50bda;};SmsQueue['prototype'][_0xba75('0xd')]=function(){this['loggedIn']=0x0;this[_0xba75('0x12')]=0x0;for(var _0x2df615=0x0;_0x2df615=0x0?this[_0xba75('0x17')]:0x0;var _0xd8850f={'id':this['id'],'available':this[_0xba75('0x17')],'loggedIn':this[_0xba75('0x15')],'name':this[_0xba75('0x7')],'paused':this[_0xba75('0x12')],'waiting':this['waiting']};var _0x23c2ec=md5(JSON[_0xba75('0x18')](_0xd8850f));if(this['md5']!==_0x23c2ec){this['md5']=_0x23c2ec;io['to'](util[_0xba75('0x19')](_0xba75('0x1a'),_0xd8850f['name']))['emit'](_0xba75('0x1b'),_0xd8850f);}};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 3ce8377..8faf696 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 _0xf587=['waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','length','online','whatsappPause','available','stringify','whatsapp_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','localhost','name','timeout','strategy','beepall','Agents'];(function(_0x22cdae,_0x2ee404){var _0xf99120=function(_0x211fc6){while(--_0x211fc6){_0x22cdae['push'](_0x22cdae['shift']());}};_0xf99120(++_0x2ee404);}(_0xf587,0x1ec));var _0x7f58=function(_0x500577,_0x534f6a){_0x500577=_0x500577-0x0;var _0x11cdee=_0xf587[_0x500577];return _0x11cdee;};'use strict';var _=require(_0x7f58('0x0'));var md5=require(_0x7f58('0x1'));var util=require(_0x7f58('0x2'));var Redis=require(_0x7f58('0x3'));var config=require('../../../config/environment');config[_0x7f58('0x4')]=_[_0x7f58('0x5')](config[_0x7f58('0x4')],{'host':_0x7f58('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7f58('0x4')]));function WhatsappQueue(_0x51bf9e){this['id']=_0x51bf9e['id']||0x0;this['name']=_0x51bf9e[_0x7f58('0x7')]||'';this[_0x7f58('0x8')]=_0x51bf9e[_0x7f58('0x8')]||0xa;this[_0x7f58('0x9')]=_0x51bf9e[_0x7f58('0x9')]||_0x7f58('0xa');this[_0x7f58('0xb')]=_0x51bf9e[_0x7f58('0xb')];this['mapAgentsId']={};this[_0x7f58('0xc')]=0x0;this[_0x7f58('0x1')]='';this[_0x7f58('0xd')]();this[_0x7f58('0xe')]();}WhatsappQueue[_0x7f58('0xf')][_0x7f58('0xd')]=function(){var _0x3a07fe=this[_0x7f58('0x10')]['_rr'];this[_0x7f58('0x10')]=_[_0x7f58('0x11')](this['Agents'],'id');this[_0x7f58('0x10')][_0x7f58('0x12')]=_0x3a07fe;};WhatsappQueue[_0x7f58('0xf')][_0x7f58('0xe')]=function(){this[_0x7f58('0x13')]=0x0;this[_0x7f58('0x14')]=0x0;for(var _0x5c73e1=0x0;_0x5c73e1=0x0?this[_0x7f58('0x18')]:0x0;var _0xfc2303={'id':this['id'],'available':this[_0x7f58('0x18')],'loggedIn':this[_0x7f58('0x13')],'name':this['name'],'paused':this[_0x7f58('0x14')],'waiting':this['waiting']};var _0x5418e2=md5(JSON[_0x7f58('0x19')](_0xfc2303));if(this[_0x7f58('0x1')]!==_0x5418e2){this[_0x7f58('0x1')]=_0x5418e2;io['to'](util['format']('whatsapp:queue:%s',_0xfc2303[_0x7f58('0x7')]))['emit'](_0x7f58('0x1a'),_0xfc2303);}};module[_0x7f58('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x7a79=['whatsapp_queue:save','exports','lodash','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','map','Agents','updateRealtime','paused','length','online','loggedIn','available','stringify','format','emit'];(function(_0x26fa22,_0x2e8c2c){var _0x5515b3=function(_0x1b0240){while(--_0x1b0240){_0x26fa22['push'](_0x26fa22['shift']());}};_0x5515b3(++_0x2e8c2c);}(_0x7a79,0x1d2));var _0x97a7=function(_0xf0f7ba,_0x48be70){_0xf0f7ba=_0xf0f7ba-0x0;var _0x44382c=_0x7a79[_0xf0f7ba];return _0x44382c;};'use strict';var _=require(_0x97a7('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x97a7('0x1'));var config=require(_0x97a7('0x2'));config[_0x97a7('0x3')]=_['defaults'](config['redis'],{'host':_0x97a7('0x4'),'port':0x18eb});var io=require(_0x97a7('0x5'))(new Redis(config['redis']));function WhatsappQueue(_0x52e877){this['id']=_0x52e877['id']||0x0;this[_0x97a7('0x6')]=_0x52e877['name']||'';this[_0x97a7('0x7')]=_0x52e877['timeout']||0xa;this[_0x97a7('0x8')]=_0x52e877[_0x97a7('0x8')]||_0x97a7('0x9');this['Agents']=_0x52e877['Agents'];this[_0x97a7('0xa')]={};this[_0x97a7('0xb')]=0x0;this[_0x97a7('0xc')]='';this[_0x97a7('0xd')]();this['updateRealtime']();}WhatsappQueue[_0x97a7('0xe')][_0x97a7('0xd')]=function(){var _0x3f283b=this[_0x97a7('0xa')][_0x97a7('0xf')];this['mapAgentsId']=_[_0x97a7('0x10')](this[_0x97a7('0x11')],'id');this[_0x97a7('0xa')][_0x97a7('0xf')]=_0x3f283b;};WhatsappQueue[_0x97a7('0xe')][_0x97a7('0x12')]=function(){this['loggedIn']=0x0;this[_0x97a7('0x13')]=0x0;for(var _0x1f4b33=0x0;_0x1f4b33=0x0?this[_0x97a7('0x17')]:0x0;var _0x453058={'id':this['id'],'available':this[_0x97a7('0x17')],'loggedIn':this[_0x97a7('0x16')],'name':this[_0x97a7('0x6')],'paused':this['paused'],'waiting':this[_0x97a7('0xb')]};var _0x43c643=md5(JSON[_0x97a7('0x18')](_0x453058));if(this[_0x97a7('0xc')]!==_0x43c643){this['md5']=_0x43c643;io['to'](util[_0x97a7('0x19')]('whatsapp:queue:%s',_0x453058['name']))[_0x97a7('0x1a')](_0x97a7('0x1b'),_0x453058);}};module[_0x97a7('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 ba8b810..485885e 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(_0x32e9ee,_0x4f0305){var _0x188a99=function(_0x5b598d){while(--_0x5b598d){_0x32e9ee['push'](_0x32e9ee['shift']());}};_0x188a99(++_0x4f0305);}(_0xb10b,0x12a));var _0xbb10=function(_0x41f7b2,_0x58547b){_0x41f7b2=_0x41f7b2-0x0;var _0x19ec6d=_0xb10b[_0x41f7b2];return _0x19ec6d;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x405625,_0x477169){var _0x1c6b00=function(_0x18e028){while(--_0x18e028){_0x405625['push'](_0x405625['shift']());}};_0x1c6b00(++_0x477169);}(_0xb10b,0x12a));var _0xbb10=function(_0xc08f00,_0x28067f){_0xc08f00=_0xc08f00-0x0;var _0x8649f7=_0xb10b[_0xc08f00];return _0x8649f7;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 9dbe4fb..878a4f8 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 _0x3bfa=['addTags','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x3bfa,0xe1));var _0xa3bf=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x3bfa[_0x3511d3];return _0x5d6321;};'use strict';var client=require('../client');exports['update']=function(_0x519b5f,_0x3cddee){return client[_0xa3bf('0x0')](_0xa3bf('0x1'),{'body':_0x3cddee,'options':{'where':{'id':_0x519b5f}},'log':_0xa3bf('0x2')});};exports[_0xa3bf('0x3')]=function(_0x1dc89e,_0x5d64bf){return client[_0xa3bf('0x0')]('AddTagsToChatInteraction',{'body':_0x5d64bf,'options':{'where':{'id':_0x1dc89e}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xee55=['updateChatInteraction','addTagsToChatInteraction','../client','Request','UpdateChatInteraction'];(function(_0x29cf05,_0x4e801f){var _0x2470c4=function(_0x2b2c32){while(--_0x2b2c32){_0x29cf05['push'](_0x29cf05['shift']());}};_0x2470c4(++_0x4e801f);}(_0xee55,0x1a1));var _0x5ee5=function(_0x496738,_0x3f1a9f){_0x496738=_0x496738-0x0;var _0xee1381=_0xee55[_0x496738];return _0xee1381;};'use strict';var client=require(_0x5ee5('0x0'));exports['update']=function(_0x5a5727,_0x23a4e4){return client[_0x5ee5('0x1')](_0x5ee5('0x2'),{'body':_0x23a4e4,'options':{'where':{'id':_0x5a5727}},'log':_0x5ee5('0x3')});};exports['addTags']=function(_0x3555b2,_0x962ed5){return client[_0x5ee5('0x1')]('AddTagsToChatInteraction',{'body':_0x962ed5,'options':{'where':{'id':_0x3555b2}},'log':_0x5ee5('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 19ac86c..60ae10e 100644 --- a/server/services/routing/rpc/chatMessage.js +++ b/server/services/routing/rpc/chatMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda13=['createChatMessage','../client','create','Request','CreateChatMessage'];(function(_0x5824c4,_0x2c915b){var _0x1387fe=function(_0x4e460f){while(--_0x4e460f){_0x5824c4['push'](_0x5824c4['shift']());}};_0x1387fe(++_0x2c915b);}(_0xda13,0xc9));var _0x3da1=function(_0x1f34d3,_0x3e2bb7){_0x1f34d3=_0x1f34d3-0x0;var _0x42313a=_0xda13[_0x1f34d3];return _0x42313a;};'use strict';var client=require(_0x3da1('0x0'));exports[_0x3da1('0x1')]=function(_0x585c2f){return client[_0x3da1('0x2')](_0x3da1('0x3'),{'body':_0x585c2f,'log':_0x3da1('0x4')});}; \ No newline at end of file +var _0x488b=['../client','create','CreateChatMessage','createChatMessage'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x488b,0xc4));var _0xb488=function(_0x516b2c,_0x19dffb){_0x516b2c=_0x516b2c-0x0;var _0x5c425e=_0x488b[_0x516b2c];return _0x5c425e;};'use strict';var client=require(_0xb488('0x0'));exports[_0xb488('0x1')]=function(_0x5be4f7){return client['Request'](_0xb488('0x2'),{'body':_0x5be4f7,'log':_0xb488('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 8126fb7..00eda50 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 _0xeea0=['strategy','User','Agents','online','chatPause','../client','getChatQueues','Request','GetChatQueue','name'];(function(_0x52eaf9,_0x483625){var _0x2a552e=function(_0x20da63){while(--_0x20da63){_0x52eaf9['push'](_0x52eaf9['shift']());}};_0x2a552e(++_0x483625);}(_0xeea0,0x91));var _0x0eea=function(_0x117bc6,_0x24f264){_0x117bc6=_0x117bc6-0x0;var _0x4dc175=_0xeea0[_0x117bc6];return _0x4dc175;};'use strict';var client=require(_0x0eea('0x0'));exports[_0x0eea('0x1')]=function(){return function(){return client[_0x0eea('0x2')](_0x0eea('0x3'),{'options':{'raw':![],'attributes':['id',_0x0eea('0x4'),'timeout',_0x0eea('0x5')],'include':[{'model':_0x0eea('0x6'),'as':_0x0eea('0x7'),'attributes':['id',_0x0eea('0x4'),_0x0eea('0x8'),_0x0eea('0x9')]}]},'log':_0x0eea('0x1')});};}; \ No newline at end of file +var _0xc73a=['online','chatPause','getChatQueues','Request','GetChatQueue','strategy','User','Agents'];(function(_0x4243a7,_0x3d56ae){var _0x22058d=function(_0x21624c){while(--_0x21624c){_0x4243a7['push'](_0x4243a7['shift']());}};_0x22058d(++_0x3d56ae);}(_0xc73a,0x72));var _0xac73=function(_0x1486a0,_0x1782de){_0x1486a0=_0x1486a0-0x0;var _0x6e880e=_0xc73a[_0x1486a0];return _0x6e880e;};'use strict';var client=require('../client');exports[_0xac73('0x0')]=function(){return function(){return client[_0xac73('0x1')](_0xac73('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xac73('0x3')],'include':[{'model':_0xac73('0x4'),'as':_0xac73('0x5'),'attributes':['id','name',_0xac73('0x6'),_0xac73('0x7')]}]},'log':_0xac73('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 0a4312b..52c63f4 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 _0x0a9a=['update','DESC','UpdateChatQueueReport','create','Request','CreateChatQueueReport'];(function(_0x327534,_0x2d70aa){var _0xd828e6=function(_0x1018c5){while(--_0x1018c5){_0x327534['push'](_0x327534['shift']());}};_0xd828e6(++_0x2d70aa);}(_0x0a9a,0x183));var _0xa0a9=function(_0x58d14d,_0x26e388){_0x58d14d=_0x58d14d-0x0;var _0xae835f=_0x0a9a[_0x58d14d];return _0xae835f;};'use strict';var client=require('../client');exports[_0xa0a9('0x0')]=function(_0x51baa8){return client[_0xa0a9('0x1')](_0xa0a9('0x2'),{'body':_0x51baa8,'log':_0xa0a9('0x2')});};exports[_0xa0a9('0x3')]=function(_0x4ba993,_0x317a94){return client[_0xa0a9('0x1')]('UpdateChatQueueReport',{'body':_0x317a94,'options':{'where':{'uniqueid':_0x4ba993},'order':[['id',_0xa0a9('0x4')]],'limit':0x1},'log':_0xa0a9('0x5')});}; \ No newline at end of file +var _0x9234=['../client','Request','CreateChatQueueReport','UpdateChatQueueReport','DESC'];(function(_0xe4c575,_0x5ad9fc){var _0x1e28db=function(_0x2ab42e){while(--_0x2ab42e){_0xe4c575['push'](_0xe4c575['shift']());}};_0x1e28db(++_0x5ad9fc);}(_0x9234,0x1bd));var _0x4923=function(_0x4a96d2,_0x689504){_0x4a96d2=_0x4a96d2-0x0;var _0x38af04=_0x9234[_0x4a96d2];return _0x38af04;};'use strict';var client=require(_0x4923('0x0'));exports['create']=function(_0x1ece6e){return client[_0x4923('0x1')](_0x4923('0x2'),{'body':_0x1ece6e,'log':_0x4923('0x2')});};exports['update']=function(_0x1ca221,_0x436ce1){return client['Request'](_0x4923('0x3'),{'body':_0x436ce1,'options':{'where':{'uniqueid':_0x1ca221},'order':[['id',_0x4923('0x4')]],'limit':0x1},'log':_0x4923('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index aff9c6e..ea7c43e 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x127a60,_0x37f33a){var _0xc1f6a3=function(_0x8ed035){while(--_0x8ed035){_0x127a60['push'](_0x127a60['shift']());}};_0xc1f6a3(++_0x37f33a);}(_0x7a54,0x106));var _0x47a5=function(_0x31f0cc,_0x2d5dcb){_0x31f0cc=_0x31f0cc-0x0;var _0x4a3f54=_0x7a54[_0x31f0cc];return _0x4a3f54;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x464052,_0x23b92b){var _0x139a07=function(_0x434f34){while(--_0x434f34){_0x464052['push'](_0x464052['shift']());}};_0x139a07(++_0x23b92b);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 679b418..5f85f60 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 _0x9db7=['Request','../client'];(function(_0x5345ee,_0x33b048){var _0x1e166f=function(_0x12befb){while(--_0x12befb){_0x5345ee['push'](_0x5345ee['shift']());}};_0x1e166f(++_0x33b048);}(_0x9db7,0x97));var _0x79db=function(_0x2ff833,_0x22e54b){_0x2ff833=_0x2ff833-0x0;var _0xa3f6ab=_0x9db7[_0x2ff833];return _0xa3f6ab;};'use strict';var client=require(_0x79db('0x0'));exports['create']=function(_0x2af669){return client[_0x79db('0x1')]('CreateFaxMessage',{'body':_0x2af669,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x6fe0=['Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6fe0,0x193));var _0x06fe=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0x6fe0[_0x1e500e];return _0x10dc5e;};'use strict';var client=require(_0x06fe('0x0'));exports['create']=function(_0x1e05f4){return client[_0x06fe('0x1')](_0x06fe('0x2'),{'body':_0x1e05f4,'log':_0x06fe('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 3eb1df9..8f01c3d 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 _0x154b=['faxPause','../client','getFaxQueues','GetFaxQueue','name','timeout','User','Agents','online'];(function(_0x2070cd,_0x52ae90){var _0x18f44f=function(_0x1babbb){while(--_0x1babbb){_0x2070cd['push'](_0x2070cd['shift']());}};_0x18f44f(++_0x52ae90);}(_0x154b,0x1c3));var _0xb154=function(_0x2e2271,_0xf6b08b){_0x2e2271=_0x2e2271-0x0;var _0x3bb951=_0x154b[_0x2e2271];return _0x3bb951;};'use strict';var client=require(_0xb154('0x0'));exports[_0xb154('0x1')]=function(){return function(){return client['Request'](_0xb154('0x2'),{'options':{'raw':![],'attributes':['id',_0xb154('0x3'),_0xb154('0x4'),'strategy'],'include':[{'model':_0xb154('0x5'),'as':_0xb154('0x6'),'attributes':['id','name',_0xb154('0x7'),_0xb154('0x8')]}]},'log':_0xb154('0x1')});};}; \ No newline at end of file +var _0x42e4=['name','timeout','strategy','User','Agents','online','getFaxQueues','../client','Request','GetFaxQueue'];(function(_0x4d9a8d,_0x14808f){var _0x31324b=function(_0x559123){while(--_0x559123){_0x4d9a8d['push'](_0x4d9a8d['shift']());}};_0x31324b(++_0x14808f);}(_0x42e4,0x1b5));var _0x442e=function(_0xd7c191,_0x4abb17){_0xd7c191=_0xd7c191-0x0;var _0x1197f9=_0x42e4[_0xd7c191];return _0x1197f9;};'use strict';var client=require(_0x442e('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x442e('0x1')](_0x442e('0x2'),{'options':{'raw':![],'attributes':['id',_0x442e('0x3'),_0x442e('0x4'),_0x442e('0x5')],'include':[{'model':_0x442e('0x6'),'as':_0x442e('0x7'),'attributes':['id',_0x442e('0x3'),_0x442e('0x8'),'faxPause']}]},'log':_0x442e('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 14c6fa1..87044e2 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 _0xc361=['Request','CreateFaxQueueReport','DESC','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc361,0x189));var _0x1c36=function(_0x485f35,_0x45a0fc){_0x485f35=_0x485f35-0x0;var _0x2ad118=_0xc361[_0x485f35];return _0x2ad118;};'use strict';var client=require(_0x1c36('0x0'));exports[_0x1c36('0x1')]=function(_0x46ce3f){return client[_0x1c36('0x2')](_0x1c36('0x3'),{'body':_0x46ce3f,'log':_0x1c36('0x3')});};exports['update']=function(_0x48f06f,_0x49e5e5){return client[_0x1c36('0x2')]('UpdateFaxQueueReport',{'body':_0x49e5e5,'options':{'where':{'uniqueid':_0x48f06f},'order':[['id',_0x1c36('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xcecd=['UpdateFaxQueueReport','DESC','../client','Request','CreateFaxQueueReport','update'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0xcecd,0x1be));var _0xdcec=function(_0x38955d,_0x19e598){_0x38955d=_0x38955d-0x0;var _0x203e33=_0xcecd[_0x38955d];return _0x203e33;};'use strict';var client=require(_0xdcec('0x0'));exports['create']=function(_0xba455){return client[_0xdcec('0x1')](_0xdcec('0x2'),{'body':_0xba455,'log':_0xdcec('0x2')});};exports[_0xdcec('0x3')]=function(_0x432fdd,_0x46fa73){return client[_0xdcec('0x1')](_0xdcec('0x4'),{'body':_0x46fa73,'options':{'where':{'uniqueid':_0x432fdd},'order':[['id',_0xdcec('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 5365561..0699723 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 _0xd68e=['GetInterval','name','Interval','interval','getIntervals'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xd68e,0x1a3));var _0xed68=function(_0x75267d,_0x5d286c){_0x75267d=_0x75267d-0x0;var _0x21ccec=_0xd68e[_0x75267d];return _0x21ccec;};'use strict';var client=require('../client');exports[_0xed68('0x0')]=function(){return function(){return client['Request'](_0xed68('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xed68('0x2')],'include':[{'model':_0xed68('0x3'),'as':'Intervals','attributes':['id',_0xed68('0x2'),_0xed68('0x4')]}]},'log':_0xed68('0x0')});};}; \ No newline at end of file +var _0x10b6=['getIntervals','Request','GetInterval','name','Interval','interval','../client'];(function(_0x26da5e,_0x2f4830){var _0x19932c=function(_0x681c95){while(--_0x681c95){_0x26da5e['push'](_0x26da5e['shift']());}};_0x19932c(++_0x2f4830);}(_0x10b6,0xa7));var _0x610b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x10b6[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0x610b('0x0'));exports[_0x610b('0x1')]=function(){return function(){return client[_0x610b('0x2')](_0x610b('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x610b('0x4')],'include':[{'model':_0x610b('0x5'),'as':'Intervals','attributes':['id',_0x610b('0x4'),_0x610b('0x6')]}]},'log':_0x610b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index f51261e..0546120 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 _0x33af=['addTags','AddTagsToMailInteraction','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x58db4e,_0x439d8d){var _0x40139a=function(_0x34cae4){while(--_0x34cae4){_0x58db4e['push'](_0x58db4e['shift']());}};_0x40139a(++_0x439d8d);}(_0x33af,0xec));var _0xf33a=function(_0xd158dc,_0x128608){_0xd158dc=_0xd158dc-0x0;var _0x12d25f=_0x33af[_0xd158dc];return _0x12d25f;};'use strict';var client=require('../client');exports[_0xf33a('0x0')]=function(_0x54b114,_0x2137be){return client[_0xf33a('0x1')](_0xf33a('0x2'),{'body':_0x2137be,'options':{'where':{'id':_0x54b114}},'log':_0xf33a('0x3')});};exports[_0xf33a('0x4')]=function(_0x25f156,_0x4c734e){return client[_0xf33a('0x1')](_0xf33a('0x5'),{'body':_0x4c734e,'options':{'where':{'id':_0x25f156}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x9f0e=['Request','addTags','AddTagsToMailInteraction','../client','update'];(function(_0x1d5ff8,_0x1ae2e7){var _0x19445a=function(_0x40d51d){while(--_0x40d51d){_0x1d5ff8['push'](_0x1d5ff8['shift']());}};_0x19445a(++_0x1ae2e7);}(_0x9f0e,0x116));var _0xe9f0=function(_0x4d31d0,_0x32966d){_0x4d31d0=_0x4d31d0-0x0;var _0x3567ae=_0x9f0e[_0x4d31d0];return _0x3567ae;};'use strict';var client=require(_0xe9f0('0x0'));exports[_0xe9f0('0x1')]=function(_0x28c33d,_0x1a7796){return client[_0xe9f0('0x2')]('UpdateMailInteraction',{'body':_0x1a7796,'options':{'where':{'id':_0x28c33d}},'log':'updateMailInteraction'});};exports[_0xe9f0('0x3')]=function(_0x150a03,_0x3c589d){return client[_0xe9f0('0x2')](_0xe9f0('0x4'),{'body':_0x3c589d,'options':{'where':{'id':_0x150a03}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 4aad5c7..4283e65 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 _0x233d=['../client','CreateMailMessage','createMailMessage'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x233d,0x123));var _0xd233=function(_0x39f34f,_0x298f45){_0x39f34f=_0x39f34f-0x0;var _0x59fee1=_0x233d[_0x39f34f];return _0x59fee1;};'use strict';var client=require(_0xd233('0x0'));exports['create']=function(_0x426e9f){return client['Request'](_0xd233('0x1'),{'body':_0x426e9f,'log':_0xd233('0x2')});}; \ No newline at end of file +var _0xe63d=['CreateMailMessage','createMailMessage','create','Request'];(function(_0x545b71,_0x4f44eb){var _0x26e587=function(_0x293b81){while(--_0x293b81){_0x545b71['push'](_0x545b71['shift']());}};_0x26e587(++_0x4f44eb);}(_0xe63d,0x172));var _0xde63=function(_0x185832,_0x53aeea){_0x185832=_0x185832-0x0;var _0x253dda=_0xe63d[_0x185832];return _0x253dda;};'use strict';var client=require('../client');exports[_0xde63('0x0')]=function(_0x4e6636){return client[_0xde63('0x1')](_0xde63('0x2'),{'body':_0x4e6636,'log':_0xde63('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 4ad0b03..ef37232 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 _0x1eec=['timeout','strategy','User','Agents','online','mailPause','../client','getMailQueues','Request','name'];(function(_0x5e918f,_0x35641b){var _0x4194fd=function(_0x1c311){while(--_0x1c311){_0x5e918f['push'](_0x5e918f['shift']());}};_0x4194fd(++_0x35641b);}(_0x1eec,0x74));var _0xc1ee=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x1eec[_0x2235bf];return _0x4c3a64;};'use strict';var client=require(_0xc1ee('0x0'));exports[_0xc1ee('0x1')]=function(){return function(){return client[_0xc1ee('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xc1ee('0x3'),_0xc1ee('0x4'),_0xc1ee('0x5')],'include':[{'model':_0xc1ee('0x6'),'as':_0xc1ee('0x7'),'attributes':['id','name',_0xc1ee('0x8'),_0xc1ee('0x9')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x62a8=['../client','getMailQueues','Request','GetMailQueue','name','timeout','User','online','mailPause'];(function(_0x5d8766,_0x24fbb5){var _0x166e9e=function(_0x20f037){while(--_0x20f037){_0x5d8766['push'](_0x5d8766['shift']());}};_0x166e9e(++_0x24fbb5);}(_0x62a8,0x132));var _0x862a=function(_0x2acbba,_0x41b7a4){_0x2acbba=_0x2acbba-0x0;var _0x239ad1=_0x62a8[_0x2acbba];return _0x239ad1;};'use strict';var client=require(_0x862a('0x0'));exports[_0x862a('0x1')]=function(){return function(){return client[_0x862a('0x2')](_0x862a('0x3'),{'options':{'raw':![],'attributes':['id',_0x862a('0x4'),_0x862a('0x5'),'strategy'],'include':[{'model':_0x862a('0x6'),'as':'Agents','attributes':['id',_0x862a('0x4'),_0x862a('0x7'),_0x862a('0x8')]}]},'log':_0x862a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 27bf0a9..90b432e 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 _0x03da=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create'];(function(_0x478150,_0x46b73a){var _0x303e3d=function(_0x2301e9){while(--_0x2301e9){_0x478150['push'](_0x478150['shift']());}};_0x303e3d(++_0x46b73a);}(_0x03da,0x124));var _0xa03d=function(_0x5d4db8,_0x4ad01b){_0x5d4db8=_0x5d4db8-0x0;var _0x415548=_0x03da[_0x5d4db8];return _0x415548;};'use strict';var client=require(_0xa03d('0x0'));exports[_0xa03d('0x1')]=function(_0x559b24){return client[_0xa03d('0x2')](_0xa03d('0x3'),{'body':_0x559b24,'log':_0xa03d('0x3')});};exports[_0xa03d('0x4')]=function(_0x413ad8,_0x49a529){return client[_0xa03d('0x2')](_0xa03d('0x5'),{'body':_0x49a529,'options':{'where':{'uniqueid':_0x413ad8},'order':[['id',_0xa03d('0x6')]],'limit':0x1},'log':_0xa03d('0x5')});}; \ No newline at end of file +var _0xb23f=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','create','Request'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0xb23f,0xbe));var _0xfb23=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb23f[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports[_0xfb23('0x0')]=function(_0xb4b75b){return client[_0xfb23('0x1')](_0xfb23('0x2'),{'body':_0xb4b75b,'log':_0xfb23('0x2')});};exports[_0xfb23('0x3')]=function(_0x15327d,_0x2ca661){return client['Request'](_0xfb23('0x4'),{'body':_0x2ca661,'options':{'where':{'uniqueid':_0x15327d},'order':[['id',_0xfb23('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 973e173..acbdd7c 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 _0x2b9b=['addTagsToChatInteraction','../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction'];(function(_0x37e342,_0x160c8f){var _0x1768f9=function(_0x413c98){while(--_0x413c98){_0x37e342['push'](_0x37e342['shift']());}};_0x1768f9(++_0x160c8f);}(_0x2b9b,0x131));var _0xb2b9=function(_0x18f4d6,_0x4d973f){_0x18f4d6=_0x18f4d6-0x0;var _0x5c5de1=_0x2b9b[_0x18f4d6];return _0x5c5de1;};'use strict';var client=require(_0xb2b9('0x0'));exports[_0xb2b9('0x1')]=function(_0x262415,_0x2f0547){return client['Request'](_0xb2b9('0x2'),{'body':_0x2f0547,'options':{'where':{'id':_0x262415}},'log':_0xb2b9('0x3')});};exports[_0xb2b9('0x4')]=function(_0x49204d,_0x1aa9ea){return client[_0xb2b9('0x5')](_0xb2b9('0x6'),{'body':_0x1aa9ea,'options':{'where':{'id':_0x49204d}},'log':_0xb2b9('0x7')});}; \ No newline at end of file +var _0x0373=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x3f47b6,_0x15b436){var _0x85f4bc=function(_0x2b1d90){while(--_0x2b1d90){_0x3f47b6['push'](_0x3f47b6['shift']());}};_0x85f4bc(++_0x15b436);}(_0x0373,0x1c2));var _0x3037=function(_0x1da778,_0x39d34c){_0x1da778=_0x1da778-0x0;var _0x87ed15=_0x0373[_0x1da778];return _0x87ed15;};'use strict';var client=require(_0x3037('0x0'));exports[_0x3037('0x1')]=function(_0x4651d6,_0x321a5f){return client[_0x3037('0x2')](_0x3037('0x3'),{'body':_0x321a5f,'options':{'where':{'id':_0x4651d6}},'log':_0x3037('0x4')});};exports['addTags']=function(_0x4b446c,_0x230b65){return client[_0x3037('0x2')](_0x3037('0x5'),{'body':_0x230b65,'options':{'where':{'id':_0x4b446c}},'log':_0x3037('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 2072927..41520a4 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 _0x6473=['create','Request'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0x6473,0x8c));var _0x3647=function(_0x63e690,_0x522dfa){_0x63e690=_0x63e690-0x0;var _0x36191e=_0x6473[_0x63e690];return _0x36191e;};'use strict';var client=require('../client');exports[_0x3647('0x0')]=function(_0x430690){return client[_0x3647('0x1')]('CreateOpenchannelMessage',{'body':_0x430690,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x8204=['Request','createOpenchannelMessage','../client','create'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x8204,0x126));var _0x4820=function(_0x487998,_0x49154b){_0x487998=_0x487998-0x0;var _0x241d96=_0x8204[_0x487998];return _0x241d96;};'use strict';var client=require(_0x4820('0x0'));exports[_0x4820('0x1')]=function(_0x2ab0be){return client[_0x4820('0x2')]('CreateOpenchannelMessage',{'body':_0x2ab0be,'log':_0x4820('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 2a8c4cb..53ba430 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 _0xaa9b=['online','openchannelPause','../client','getOpenchannelQueues','name','strategy','Agents'];(function(_0x535240,_0x45b177){var _0x9964f7=function(_0x557504){while(--_0x557504){_0x535240['push'](_0x535240['shift']());}};_0x9964f7(++_0x45b177);}(_0xaa9b,0x16e));var _0xbaa9=function(_0x16339f,_0xf77183){_0x16339f=_0x16339f-0x0;var _0x136b78=_0xaa9b[_0x16339f];return _0x136b78;};'use strict';var client=require(_0xbaa9('0x0'));exports[_0xbaa9('0x1')]=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xbaa9('0x2'),'timeout',_0xbaa9('0x3')],'include':[{'model':'User','as':_0xbaa9('0x4'),'attributes':['id',_0xbaa9('0x2'),_0xbaa9('0x5'),_0xbaa9('0x6')]}]},'log':_0xbaa9('0x1')});};}; \ No newline at end of file +var _0x7e73=['strategy','User','online','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout'];(function(_0x225c8d,_0x4ce3f0){var _0x501db9=function(_0xfc78b8){while(--_0xfc78b8){_0x225c8d['push'](_0x225c8d['shift']());}};_0x501db9(++_0x4ce3f0);}(_0x7e73,0x187));var _0x37e7=function(_0x21ff3f,_0x24b67f){_0x21ff3f=_0x21ff3f-0x0;var _0x3b2bf0=_0x7e73[_0x21ff3f];return _0x3b2bf0;};'use strict';var client=require('../client');exports[_0x37e7('0x0')]=function(){return function(){return client[_0x37e7('0x1')](_0x37e7('0x2'),{'options':{'raw':![],'attributes':['id',_0x37e7('0x3'),_0x37e7('0x4'),_0x37e7('0x5')],'include':[{'model':_0x37e7('0x6'),'as':'Agents','attributes':['id',_0x37e7('0x3'),_0x37e7('0x7'),_0x37e7('0x8')]}]},'log':_0x37e7('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 75036da..73b204d 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 _0x8845=['CreateOpenchannelQueueReport','Request','DESC','../client','create'];(function(_0x5bb236,_0x4d3e57){var _0x5b237e=function(_0x54072c){while(--_0x54072c){_0x5bb236['push'](_0x5bb236['shift']());}};_0x5b237e(++_0x4d3e57);}(_0x8845,0x8a));var _0x5884=function(_0x31229e,_0x4f015c){_0x31229e=_0x31229e-0x0;var _0x53f4e1=_0x8845[_0x31229e];return _0x53f4e1;};'use strict';var client=require(_0x5884('0x0'));exports[_0x5884('0x1')]=function(_0x2b4ca1){return client['Request'](_0x5884('0x2'),{'body':_0x2b4ca1,'log':_0x5884('0x2')});};exports['update']=function(_0x425b80,_0x1f3e6c){return client[_0x5884('0x3')]('UpdateOpenchannelQueueReport',{'body':_0x1f3e6c,'options':{'where':{'uniqueid':_0x425b80},'order':[['id',_0x5884('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xceb5=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client','create','Request'];(function(_0x10c6ee,_0x3155f2){var _0x48e3dc=function(_0x4fcf73){while(--_0x4fcf73){_0x10c6ee['push'](_0x10c6ee['shift']());}};_0x48e3dc(++_0x3155f2);}(_0xceb5,0x81));var _0x5ceb=function(_0x35485a,_0x91cdd4){_0x35485a=_0x35485a-0x0;var _0x5148e6=_0xceb5[_0x35485a];return _0x5148e6;};'use strict';var client=require(_0x5ceb('0x0'));exports[_0x5ceb('0x1')]=function(_0x4890d3){return client[_0x5ceb('0x2')]('CreateOpenchannelQueueReport',{'body':_0x4890d3,'log':_0x5ceb('0x3')});};exports[_0x5ceb('0x4')]=function(_0x4e8a8b,_0x591a50){return client[_0x5ceb('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x591a50,'options':{'where':{'uniqueid':_0x4e8a8b},'order':[['id','DESC']],'limit':0x1},'log':_0x5ceb('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 92cced2..a1e8fc4 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 _0xbc82=['../client','Request','addTags'];(function(_0x2c24b8,_0x168e0b){var _0x563ed6=function(_0x7c1aa9){while(--_0x7c1aa9){_0x2c24b8['push'](_0x2c24b8['shift']());}};_0x563ed6(++_0x168e0b);}(_0xbc82,0x13e));var _0x2bc8=function(_0x24f74a,_0x1685cc){_0x24f74a=_0x24f74a-0x0;var _0x477478=_0xbc82[_0x24f74a];return _0x477478;};'use strict';var client=require(_0x2bc8('0x0'));exports['update']=function(_0x5cd5de,_0x548271){return client[_0x2bc8('0x1')]('UpdateSmsInteraction',{'body':_0x548271,'options':{'where':{'id':_0x5cd5de}},'log':'updateSmsInteraction'});};exports[_0x2bc8('0x2')]=function(_0x5c8329,_0x528bc4){return client[_0x2bc8('0x1')]('AddTagsToSmsInteraction',{'body':_0x528bc4,'options':{'where':{'id':_0x5c8329}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x57cf=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x3e6729,_0x16d4af){var _0x535bcd=function(_0x5e6c5f){while(--_0x5e6c5f){_0x3e6729['push'](_0x3e6729['shift']());}};_0x535bcd(++_0x16d4af);}(_0x57cf,0x11b));var _0xf57c=function(_0x52e363,_0x48062a){_0x52e363=_0x52e363-0x0;var _0x3fc2b5=_0x57cf[_0x52e363];return _0x3fc2b5;};'use strict';var client=require(_0xf57c('0x0'));exports[_0xf57c('0x1')]=function(_0x41b0b8,_0x182ad5){return client[_0xf57c('0x2')](_0xf57c('0x3'),{'body':_0x182ad5,'options':{'where':{'id':_0x41b0b8}},'log':_0xf57c('0x4')});};exports[_0xf57c('0x5')]=function(_0x41391c,_0x16d54f){return client['Request'](_0xf57c('0x6'),{'body':_0x16d54f,'options':{'where':{'id':_0x41391c}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 94884b0..9b52521 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 _0x8441=['CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x8441,0x136));var _0x1844=function(_0x2759f3,_0x235870){_0x2759f3=_0x2759f3-0x0;var _0x4a71df=_0x8441[_0x2759f3];return _0x4a71df;};'use strict';var client=require(_0x1844('0x0'));exports[_0x1844('0x1')]=function(_0x26f14d){return client['Request'](_0x1844('0x2'),{'body':_0x26f14d,'log':_0x1844('0x3')});}; \ No newline at end of file +var _0x0c2f=['create','Request','createSmsMessage'];(function(_0x11089b,_0x4a2b17){var _0x3a4b62=function(_0x272578){while(--_0x272578){_0x11089b['push'](_0x11089b['shift']());}};_0x3a4b62(++_0x4a2b17);}(_0x0c2f,0x1b6));var _0xf0c2=function(_0x4953c9,_0x24591d){_0x4953c9=_0x4953c9-0x0;var _0x263a5e=_0x0c2f[_0x4953c9];return _0x263a5e;};'use strict';var client=require('../client');exports[_0xf0c2('0x0')]=function(_0x3fb9c5){return client[_0xf0c2('0x1')]('CreateSmsMessage',{'body':_0x3fb9c5,'log':_0xf0c2('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index cbe0202..a25da53 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x2977e1,_0x4eae88){var _0x56d236=function(_0x45fe55){while(--_0x45fe55){_0x2977e1['push'](_0x2977e1['shift']());}};_0x56d236(++_0x4eae88);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x535976,_0x403e2f){var _0x3a0879=function(_0x36f7ab){while(--_0x36f7ab){_0x535976['push'](_0x535976['shift']());}};_0x3a0879(++_0x403e2f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x47adb8,_0x591ccc){_0x47adb8=_0x47adb8-0x0;var _0x4689a8=_0xcb91[_0x47adb8];return _0x4689a8;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 9b82f6d..aa7f9a0 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x14540b,_0x85d32d){var _0x394822=function(_0x2e9b0e){while(--_0x2e9b0e){_0x14540b['push'](_0x14540b['shift']());}};_0x394822(++_0x85d32d);}(_0x70e0,0x17b));var _0x070e=function(_0x309758,_0x2e01fb){_0x309758=_0x309758-0x0;var _0x223489=_0x70e0[_0x309758];return _0x223489;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x2aa272,_0x1b808a){var _0x428b51=function(_0x503b13){while(--_0x503b13){_0x2aa272['push'](_0x2aa272['shift']());}};_0x428b51(++_0x1b808a);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index a4cd82e..0fe4665 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(_0x3bec47,_0x406844){var _0x444da3=function(_0x3c6555){while(--_0x3c6555){_0x3bec47['push'](_0x3bec47['shift']());}};_0x444da3(++_0x406844);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0xb5d2b9,_0x282dd9){var _0x196593=function(_0x57f5d9){while(--_0x57f5d9){_0xb5d2b9['push'](_0xb5d2b9['shift']());}};_0x196593(++_0x282dd9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 5597754..71e731c 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 _0xed5c=['addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x3eff23,_0x2417cf){var _0x20ccbf=function(_0x553b4d){while(--_0x553b4d){_0x3eff23['push'](_0x3eff23['shift']());}};_0x20ccbf(++_0x2417cf);}(_0xed5c,0x81));var _0xced5=function(_0x1b03f7,_0x5bac1a){_0x1b03f7=_0x1b03f7-0x0;var _0x403524=_0xed5c[_0x1b03f7];return _0x403524;};'use strict';var client=require(_0xced5('0x0'));exports[_0xced5('0x1')]=function(_0x2c59c3,_0x21fae7){return client[_0xced5('0x2')](_0xced5('0x3'),{'body':_0x21fae7,'options':{'where':{'id':_0x2c59c3}},'log':_0xced5('0x4')});};exports[_0xced5('0x5')]=function(_0x2b8184,_0x2ec4f9){return client['Request'](_0xced5('0x6'),{'body':_0x2ec4f9,'options':{'where':{'id':_0x2b8184}},'log':_0xced5('0x7')});}; \ No newline at end of file +var _0x7b84=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x44dea6,_0x21a1d5){var _0x5ea66a=function(_0x313405){while(--_0x313405){_0x44dea6['push'](_0x44dea6['shift']());}};_0x5ea66a(++_0x21a1d5);}(_0x7b84,0x17c));var _0x47b8=function(_0x11b50d,_0x5d1039){_0x11b50d=_0x11b50d-0x0;var _0x142fe6=_0x7b84[_0x11b50d];return _0x142fe6;};'use strict';var client=require(_0x47b8('0x0'));exports[_0x47b8('0x1')]=function(_0x186f89,_0xda244a){return client[_0x47b8('0x2')](_0x47b8('0x3'),{'body':_0xda244a,'options':{'where':{'id':_0x186f89}},'log':_0x47b8('0x4')});};exports['addTags']=function(_0x445a5f,_0x1fa41a){return client[_0x47b8('0x2')](_0x47b8('0x5'),{'body':_0x1fa41a,'options':{'where':{'id':_0x445a5f}},'log':_0x47b8('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index b838bdc..177fd00 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 _0xc359=['Request','CreateWhatsappMessage','createWhatsappMessage','create'];(function(_0x1ef2d7,_0x49a7d6){var _0x549841=function(_0x254370){while(--_0x254370){_0x1ef2d7['push'](_0x1ef2d7['shift']());}};_0x549841(++_0x49a7d6);}(_0xc359,0xd7));var _0x9c35=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0xc359[_0x2ca2d0];return _0x521c23;};'use strict';var client=require('../client');exports[_0x9c35('0x0')]=function(_0x2a04e6){return client[_0x9c35('0x1')](_0x9c35('0x2'),{'body':_0x2a04e6,'log':_0x9c35('0x3')});}; \ No newline at end of file +var _0x3a5c=['create','CreateWhatsappMessage','createWhatsappMessage'];(function(_0xedc114,_0x5d3f07){var _0x2b63f2=function(_0xea4d3e){while(--_0xea4d3e){_0xedc114['push'](_0xedc114['shift']());}};_0x2b63f2(++_0x5d3f07);}(_0x3a5c,0x1aa));var _0xc3a5=function(_0x958ec3,_0xcf5fc){_0x958ec3=_0x958ec3-0x0;var _0x57fb46=_0x3a5c[_0x958ec3];return _0x57fb46;};'use strict';var client=require('../client');exports[_0xc3a5('0x0')]=function(_0x4bdf07){return client['Request'](_0xc3a5('0x1'),{'body':_0x4bdf07,'log':_0xc3a5('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index f89b97e..e6fc412 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 _0x4a26=['User','Agents','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','strategy'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x4a26,0x130));var _0x64a2=function(_0x385f7f,_0x29ca05){_0x385f7f=_0x385f7f-0x0;var _0x1230aa=_0x4a26[_0x385f7f];return _0x1230aa;};'use strict';var client=require(_0x64a2('0x0'));exports[_0x64a2('0x1')]=function(){return function(){return client[_0x64a2('0x2')](_0x64a2('0x3'),{'options':{'raw':![],'attributes':['id',_0x64a2('0x4'),'timeout',_0x64a2('0x5')],'include':[{'model':_0x64a2('0x6'),'as':_0x64a2('0x7'),'attributes':['id',_0x64a2('0x4'),_0x64a2('0x8'),_0x64a2('0x9')]}]},'log':_0x64a2('0x1')});};}; \ No newline at end of file +var _0x87f3=['strategy','Agents','online','../client','getWhatsappQueues','Request','GetWhatsappQueue','timeout'];(function(_0x2ab3a1,_0x54ebb3){var _0x545d0b=function(_0x3c2fef){while(--_0x3c2fef){_0x2ab3a1['push'](_0x2ab3a1['shift']());}};_0x545d0b(++_0x54ebb3);}(_0x87f3,0x133));var _0x387f=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0x87f3[_0x511bd1];return _0x4c48ec;};'use strict';var client=require(_0x387f('0x0'));exports[_0x387f('0x1')]=function(){return function(){return client[_0x387f('0x2')](_0x387f('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x387f('0x4'),_0x387f('0x5')],'include':[{'model':'User','as':_0x387f('0x6'),'attributes':['id','name',_0x387f('0x7'),'whatsappPause']}]},'log':_0x387f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 0e48407..45a96ac 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 _0xea86=['CreateWhatsappQueueReport','Request','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x490475,_0x3e65bd){var _0x2ce876=function(_0x550653){while(--_0x550653){_0x490475['push'](_0x490475['shift']());}};_0x2ce876(++_0x3e65bd);}(_0xea86,0xe0));var _0x6ea8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xea86[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x6ea8('0x0'));exports['create']=function(_0x2ce680){return client['Request']('CreateWhatsappQueueReport',{'body':_0x2ce680,'log':_0x6ea8('0x1')});};exports['update']=function(_0x3cc16b,_0x5655bb){return client[_0x6ea8('0x2')](_0x6ea8('0x3'),{'body':_0x5655bb,'options':{'where':{'uniqueid':_0x3cc16b},'order':[['id',_0x6ea8('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xcd3d=['create','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x4af2de,_0x1b8349){var _0x5e45ca=function(_0x32bcea){while(--_0x32bcea){_0x4af2de['push'](_0x4af2de['shift']());}};_0x5e45ca(++_0x1b8349);}(_0xcd3d,0xb9));var _0xdcd3=function(_0x4d4f0e,_0xf24be2){_0x4d4f0e=_0x4d4f0e-0x0;var _0x5a5318=_0xcd3d[_0x4d4f0e];return _0x5a5318;};'use strict';var client=require(_0xdcd3('0x0'));exports[_0xdcd3('0x1')]=function(_0x4d94b9){return client[_0xdcd3('0x2')](_0xdcd3('0x3'),{'body':_0x4d94b9,'log':_0xdcd3('0x3')});};exports['update']=function(_0x4c1430,_0x2aa1eb){return client[_0xdcd3('0x2')](_0xdcd3('0x4'),{'body':_0x2aa1eb,'options':{'where':{'uniqueid':_0x4c1430},'order':[['id',_0xdcd3('0x5')]],'limit':0x1},'log':_0xdcd3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 37c597e..95de2ba 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 _0xe383=['error','[%s][AGENT]\x20%s','map','message','stop','agents','createQueue','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','next','agent','log','[%s][QUEUE]\x20%s','stack','lodash','seq-queue','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate'];(function(_0x402148,_0x106090){var _0x2f0578=function(_0x411678){while(--_0x411678){_0x402148['push'](_0x402148['shift']());}};_0x2f0578(++_0x106090);}(_0xe383,0xe3));var _0x3e38=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xe383[_0x3e5086];return _0xfeb102;};'use strict';var schema=require('validate');var _=require(_0x3e38('0x0'));var util=require('util');var seqqueue=require(_0x3e38('0x1'));var logger=require('../../../../config/logger')(_0x3e38('0x2'));var strategy=require(_0x3e38('0x3'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x3e38('0x4')},'timeout':{'type':_0x3e38('0x5'),'message':_0x3e38('0x6')}});function writeLog(_0x51143d,_0x17ce61,_0x10828f){return logger[_0x3e38('0x7')](util['format'](_0x3e38('0x8'),_0x51143d,_0x17ce61['name'],_0x10828f));}function handleFindAgent(_0x201c86){return function(_0x494d02){return _0x494d02[_0x3e38('0x9')][_0x3e38('0xa')]()===_0x201c86[_0x3e38('0xa')]();};}exports[_0x3e38('0xb')]=function(_0x469fa0,_0x5d503d,_0x478c8f,_0x340342){return function(_0x5df840){try{var _0x3abf63={'name':_0x5d503d[0x0],'timeout':_0x5d503d[0x1]};var _0x50eddc=queue[_0x3e38('0xc')](_0x3abf63,{'typecast':!![]});if(_0x50eddc['length']){logger[_0x3e38('0xd')](_0x3e38('0xe'),_0x469fa0,_[_0x3e38('0xf')](_0x50eddc,_0x3e38('0x10'))['join'](',\x20'));_0x5df840[_0x3e38('0x11')]();}else{var _0x420625=_['find'](_0x478c8f[_0x3e38('0x12')],handleFindAgent(_0x3abf63[_0x3e38('0x9')]));if(_0x420625){var _0x5f5026=(_0x3abf63['timeout']||0xa)*0x3e8;var _0x2c3a53,_0x4fe9bc;var _0x19e316=seqqueue[_0x3e38('0x13')](_0x5f5026);_0x19e316['id']=_0x469fa0;_0x19e316['atimeout']=_0x5f5026;_0x19e316[_0x3e38('0x14')]=_0x340342[_0x3e38('0x14')];writeLog(_0x469fa0,_0x420625,util['format'](_0x3e38('0x15'),_0x5f5026));_0x478c8f[_0x3e38('0x16')][_0x469fa0]['on']('end',function(){logger[_0x3e38('0x7')](_0x3e38('0x17'),_0x469fa0);clearTimeout(_0x4fe9bc);_0x4fe9bc=undefined;_0x19e316[_0x3e38('0x18')]();if(_0x478c8f[_0x3e38('0x16')][_0x469fa0]){delete _0x478c8f[_0x3e38('0x16')][_0x469fa0];}_0x5df840[_0x3e38('0x11')]();});_0x478c8f['rules'][_0x469fa0]['on']('complete',function(){if(_0x478c8f[_0x3e38('0x16')][_0x469fa0]){delete _0x478c8f['rules'][_0x469fa0];}});_0x4fe9bc=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x469fa0);clearTimeout(_0x4fe9bc);_0x19e316[_0x3e38('0x18')]();_0x5df840[_0x3e38('0x19')]();},_0x5f5026);strategy[_0x3e38('0x1a')](_0x19e316,_0x420625,_0x478c8f,_0x340342);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x469fa0,_0x3abf63[_0x3e38('0x9')]);_0x5df840[_0x3e38('0x11')]();}}}catch(_0x17d587){console[_0x3e38('0x1b')](_0x17d587);logger[_0x3e38('0xd')](_0x3e38('0x1c'),_0x469fa0,_0x17d587[_0x3e38('0x1d')]);_0x5df840[_0x3e38('0x11')]();}};}; \ No newline at end of file +var _0xd552=['error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','atimeout','channel','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','info','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length'];(function(_0x430426,_0x5a4638){var _0x35dd9b=function(_0x506645){while(--_0x506645){_0x430426['push'](_0x430426['shift']());}};_0x35dd9b(++_0x5a4638);}(_0xd552,0x13d));var _0x2d55=function(_0xc525e7,_0x1f942f){_0xc525e7=_0xc525e7-0x0;var _0xd4e2fc=_0xd552[_0xc525e7];return _0xd4e2fc;};'use strict';var schema=require(_0x2d55('0x0'));var _=require(_0x2d55('0x1'));var util=require(_0x2d55('0x2'));var seqqueue=require(_0x2d55('0x3'));var logger=require(_0x2d55('0x4'))(_0x2d55('0x5'));var strategy=require(_0x2d55('0x6'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x2d55('0x7')},'timeout':{'type':_0x2d55('0x8'),'message':_0x2d55('0x9')}});function writeLog(_0x31bb55,_0x25686b,_0x2ba3dd){return logger['info'](util[_0x2d55('0xa')](_0x2d55('0xb'),_0x31bb55,_0x25686b[_0x2d55('0xc')],_0x2ba3dd));}function handleFindAgent(_0x268ba9){return function(_0x93e6ec){return _0x93e6ec[_0x2d55('0xc')][_0x2d55('0xd')]()===_0x268ba9['toLowerCase']();};}exports[_0x2d55('0xe')]=function(_0x1259ce,_0x3b1c97,_0x20b4c7,_0x592392){return function(_0x498056){try{var _0x38b26b={'name':_0x3b1c97[0x0],'timeout':_0x3b1c97[0x1]};var _0x24847c=queue['validate'](_0x38b26b,{'typecast':!![]});if(_0x24847c[_0x2d55('0xf')]){logger[_0x2d55('0x10')](_0x2d55('0x11'),_0x1259ce,_[_0x2d55('0x12')](_0x24847c,_0x2d55('0x13'))[_0x2d55('0x14')](',\x20'));_0x498056[_0x2d55('0x15')]();}else{var _0x317ad1=_[_0x2d55('0x16')](_0x20b4c7[_0x2d55('0x17')],handleFindAgent(_0x38b26b['name']));if(_0x317ad1){var _0x5628de=(_0x38b26b[_0x2d55('0x18')]||0xa)*0x3e8;var _0x1db287,_0x1c3d69;var _0x4547d4=seqqueue['createQueue'](_0x5628de);_0x4547d4['id']=_0x1259ce;_0x4547d4[_0x2d55('0x19')]=_0x5628de;_0x4547d4[_0x2d55('0x1a')]=_0x592392[_0x2d55('0x1a')];writeLog(_0x1259ce,_0x317ad1,util['format']('START:%s',_0x5628de));_0x20b4c7[_0x2d55('0x1b')][_0x1259ce]['on']('end',function(){logger['info'](_0x2d55('0x1c'),_0x1259ce);clearTimeout(_0x1c3d69);_0x1c3d69=undefined;_0x4547d4[_0x2d55('0x1d')]();if(_0x20b4c7[_0x2d55('0x1b')][_0x1259ce]){delete _0x20b4c7[_0x2d55('0x1b')][_0x1259ce];}_0x498056[_0x2d55('0x15')]();});_0x20b4c7[_0x2d55('0x1b')][_0x1259ce]['on'](_0x2d55('0x1e'),function(){if(_0x20b4c7[_0x2d55('0x1b')][_0x1259ce]){delete _0x20b4c7[_0x2d55('0x1b')][_0x1259ce];}});_0x1c3d69=setTimeout(function(){logger[_0x2d55('0x1f')](_0x2d55('0x20'),_0x1259ce);clearTimeout(_0x1c3d69);_0x4547d4['close']();_0x498056[_0x2d55('0x21')]();},_0x5628de);strategy[_0x2d55('0x22')](_0x4547d4,_0x317ad1,_0x20b4c7,_0x592392);}else{logger[_0x2d55('0x10')](_0x2d55('0x23'),_0x1259ce,_0x38b26b[_0x2d55('0xc')]);_0x498056['stop']();}}}catch(_0x26d0ac){console[_0x2d55('0x24')](_0x26d0ac);logger['error']('[%s][QUEUE]\x20%s',_0x1259ce,_0x26d0ac['stack']);_0x498056[_0x2d55('0x15')]();}};}; \ 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 e358caa..0f8d2fa 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 _0xdf25=['Failed','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','interaction','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','account','AccountId','upperFirst','InteractionId','created','isEmpty','getMustacheRender','Message','then','info','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','body','toString','providerName','providerResponse','stringify','create','dialogState'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdf25,0xe7));var _0x5df2=function(_0x5e89e2,_0x2dd5ac){_0x5e89e2=_0x5e89e2-0x0;var _0x1a96f2=_0xdf25[_0x5e89e2];return _0x1a96f2;};'use strict';var _=require('lodash');var moment=require(_0x5df2('0x0'));var AWS=require(_0x5df2('0x1'));var utils=require(_0x5df2('0x2'));var logger=require(_0x5df2('0x3'))(_0x5df2('0x4'));var rpc={'chatMessage':require(_0x5df2('0x5')),'openchannelMessage':require(_0x5df2('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x5df2('0x7')),'whatsappMessage':require(_0x5df2('0x8'))};exports['consequence']=function(_0x47519f,_0x40bba5){return function(_0x532c88){try{if(!_['isNil'](this[_0x5df2('0x9')]['UserId'])){logger['info'](_0x5df2('0xa'),_0x47519f,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x532c88[_0x5df2('0xb')]();}var _0x2cc425={'ContactId':this[_0x5df2('0xc')]['id'],'sentAt':moment()[_0x5df2('0xd')](_0x5df2('0xe')),'direction':_0x5df2('0xf')};if(this[_0x5df2('0x10')]===_0x5df2('0x11')||this[_0x5df2('0x10')]===_0x5df2('0x12')){_0x2cc425[_0x5df2('0x13')]=this[_0x5df2('0x9')]['phone'];}var _0x3ea677=this[_0x5df2('0x10')];if(_0x3ea677==='chat'){_0x2cc425['ChatWebsiteId']=this[_0x5df2('0x14')]['id'];}else{_0x2cc425[_['upperFirst'](_0x3ea677)+_0x5df2('0x15')]=this[_0x5df2('0x14')]['id'];}_0x2cc425[_[_0x5df2('0x16')](_0x3ea677)+_0x5df2('0x17')]=this[_0x5df2('0x9')]['id'];if(this['interaction'][_0x5df2('0x18')]){var _0x214df7=_0x40bba5[0x4];if(!_[_0x5df2('0x19')](_0x214df7)){_0x2cc425['body']=utils[_0x5df2('0x1a')](_0x214df7,this);return rpc[_0x3ea677+_0x5df2('0x1b')]['create'](_0x2cc425)[_0x5df2('0x1c')](function(_0x11a435){logger[_0x5df2('0x1d')](_0x5df2('0xa'),_0x47519f,_0x2cc425['body']);})['catch'](function(_0xf69126){logger[_0x5df2('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x47519f,JSON['stringify'](_0xf69126));})[_0x5df2('0x1f')](function(){logger[_0x5df2('0x1d')](_0x5df2('0x20'),_0x47519f);_0x532c88[_0x5df2('0x21')]();});}else{logger[_0x5df2('0x1d')](_0x5df2('0x22'),_0x47519f);_0x532c88[_0x5df2('0x21')]();}}else{var _0xfdce6e=this;var _0x24b237=new AWS[(_0x5df2('0x23'))]({'accessKeyId':_0x40bba5[0x0],'secretAccessKey':_0x40bba5[0x1],'region':_0x40bba5[0x2]});var _0x3c7d71={'botAlias':_0x5df2('0x24'),'botName':_0x40bba5[0x3],'inputText':this[_0x5df2('0x25')][_0x5df2('0x26')],'userId':this['channel']+':'+this['interaction']['id'][_0x5df2('0x27')]()};_0x24b237['postText'](_0x3c7d71,function(_0x5f4f26,_0x4e1d78){if(_0x5f4f26){logger['error'](_0x5df2('0xa'),_0x47519f,_0x5f4f26[_0x5df2('0x25')]);_0x532c88['next']();}else if(_0x4e1d78&&_0x4e1d78['message']){_0xfdce6e[_0x5df2('0x26')]['amazonlex']=_0x4e1d78;_0x2cc425[_0x5df2('0x26')]=_0x4e1d78['message'];_0x2cc425[_0x5df2('0x28')]='amazonlex';_0x2cc425[_0x5df2('0x29')]=JSON[_0x5df2('0x2a')](_0x4e1d78);return rpc[_0x3ea677+'Message'][_0x5df2('0x2b')](_0x2cc425)[_0x5df2('0x1c')](function(_0x2f243a){logger[_0x5df2('0x1d')](_0x5df2('0xa'),_0x47519f,_0x2cc425[_0x5df2('0x26')]);if(_0x4e1d78[_0x5df2('0x2c')]==_0x5df2('0x2d')){_0x532c88['next']();}else{_0x532c88[_0x5df2('0x21')]();}})['catch'](function(_0x5035d3){logger[_0x5df2('0x1e')](_0x5df2('0xa'),_0x47519f,JSON['stringify'](_0x5035d3));_0x532c88[_0x5df2('0xb')]();});}else{_0x532c88[_0x5df2('0xb')]();}});}}catch(_0x49a76b){logger[_0x5df2('0x1e')](_0x5df2('0xa'),_0x47519f,JSON[_0x5df2('0x2a')](_0x49a76b));_0x532c88['stop']();}};}; \ No newline at end of file +var _0x82b1=['format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','error','stringify','finally','stop','LexRuntime','$LATEST','message','postText','amazonlex','providerName','providerResponse','dialogState','lodash','moment','aws-sdk','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact'];(function(_0xcd7f4f,_0x284c73){var _0x17c2f9=function(_0x210050){while(--_0x210050){_0xcd7f4f['push'](_0xcd7f4f['shift']());}};_0x17c2f9(++_0x284c73);}(_0x82b1,0xa6));var _0x182b=function(_0x3165c8,_0x2c1d93){_0x3165c8=_0x3165c8-0x0;var _0x316067=_0x82b1[_0x3165c8];return _0x316067;};'use strict';var _=require(_0x182b('0x0'));var moment=require(_0x182b('0x1'));var AWS=require(_0x182b('0x2'));var utils=require(_0x182b('0x3'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x182b('0x4')),'mailMessage':require(_0x182b('0x5')),'smsMessage':require(_0x182b('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x182b('0x7'))};exports['consequence']=function(_0x3b682b,_0x39add6){return function(_0x1d9ac2){try{if(!_['isNil'](this['interaction'][_0x182b('0x8')])){logger[_0x182b('0x9')](_0x182b('0xa'),_0x3b682b,_0x182b('0xb'));return _0x1d9ac2[_0x182b('0xc')]();}var _0x4d998c={'ContactId':this[_0x182b('0xd')]['id'],'sentAt':moment()[_0x182b('0xe')](_0x182b('0xf')),'direction':'out'};if(this[_0x182b('0x10')]===_0x182b('0x11')||this['channel']==='whatsapp'){_0x4d998c[_0x182b('0x12')]=this[_0x182b('0x13')][_0x182b('0x12')];}var _0x1f277b=this[_0x182b('0x10')];if(_0x1f277b===_0x182b('0x14')){_0x4d998c[_0x182b('0x15')]=this[_0x182b('0x16')]['id'];}else{_0x4d998c[_[_0x182b('0x17')](_0x1f277b)+_0x182b('0x18')]=this[_0x182b('0x16')]['id'];}_0x4d998c[_[_0x182b('0x17')](_0x1f277b)+_0x182b('0x19')]=this[_0x182b('0x13')]['id'];if(this['interaction'][_0x182b('0x1a')]){var _0x1baa60=_0x39add6[0x4];if(!_[_0x182b('0x1b')](_0x1baa60)){_0x4d998c[_0x182b('0x1c')]=utils[_0x182b('0x1d')](_0x1baa60,this);return rpc[_0x1f277b+_0x182b('0x1e')][_0x182b('0x1f')](_0x4d998c)[_0x182b('0x20')](function(_0x1178f9){logger[_0x182b('0x9')](_0x182b('0xa'),_0x3b682b,_0x4d998c['body']);})['catch'](function(_0x22c78d){logger[_0x182b('0x21')](_0x182b('0xa'),_0x3b682b,JSON[_0x182b('0x22')](_0x22c78d));})[_0x182b('0x23')](function(){logger[_0x182b('0x9')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3b682b);_0x1d9ac2[_0x182b('0x24')]();});}else{logger[_0x182b('0x9')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3b682b);_0x1d9ac2['stop']();}}else{var _0x5ef415=this;var _0x3d39fd=new AWS[(_0x182b('0x25'))]({'accessKeyId':_0x39add6[0x0],'secretAccessKey':_0x39add6[0x1],'region':_0x39add6[0x2]});var _0x4d215b={'botAlias':_0x182b('0x26'),'botName':_0x39add6[0x3],'inputText':this[_0x182b('0x27')][_0x182b('0x1c')],'userId':this[_0x182b('0x10')]+':'+this[_0x182b('0x13')]['id']['toString']()};_0x3d39fd[_0x182b('0x28')](_0x4d215b,function(_0x16f5fd,_0x325b50){if(_0x16f5fd){logger[_0x182b('0x21')](_0x182b('0xa'),_0x3b682b,_0x16f5fd['message']);_0x1d9ac2[_0x182b('0xc')]();}else if(_0x325b50&&_0x325b50[_0x182b('0x27')]){_0x5ef415[_0x182b('0x1c')][_0x182b('0x29')]=_0x325b50;_0x4d998c[_0x182b('0x1c')]=_0x325b50[_0x182b('0x27')];_0x4d998c[_0x182b('0x2a')]=_0x182b('0x29');_0x4d998c[_0x182b('0x2b')]=JSON[_0x182b('0x22')](_0x325b50);return rpc[_0x1f277b+_0x182b('0x1e')][_0x182b('0x1f')](_0x4d998c)[_0x182b('0x20')](function(_0x15e7e3){logger[_0x182b('0x9')](_0x182b('0xa'),_0x3b682b,_0x4d998c['body']);if(_0x325b50[_0x182b('0x2c')]=='Failed'){_0x1d9ac2['next']();}else{_0x1d9ac2[_0x182b('0x24')]();}})['catch'](function(_0x2191ad){logger['error'](_0x182b('0xa'),_0x3b682b,JSON['stringify'](_0x2191ad));_0x1d9ac2[_0x182b('0xc')]();});}else{_0x1d9ac2[_0x182b('0xc')]();}});}}catch(_0x25aac5){logger[_0x182b('0x21')](_0x182b('0xa'),_0x3b682b,JSON[_0x182b('0x22')](_0x25aac5));_0x1d9ac2[_0x182b('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 1bf87ad..be2e036 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 _0x981a=['../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','channel','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','Autoreply\x20already\x20sent','next','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','format','out','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','Smtp','service','host','port','authentication','auth','user','pass','inReplyTo','messageId','replace','','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','routing'];(function(_0x4baa11,_0x7c6290){var _0x219273=function(_0x4a3887){while(--_0x4a3887){_0x4baa11['push'](_0x4baa11['shift']());}};_0x219273(++_0x7c6290);}(_0x981a,0x172));var _0xa981=function(_0x51d131,_0x4722b6){_0x51d131=_0x51d131-0x0;var _0x1c7c85=_0x981a[_0x51d131];return _0x1c7c85;};'use strict';var _=require(_0xa981('0x0'));var moment=require(_0xa981('0x1'));var utils=require(_0xa981('0x2'));var logger=require(_0xa981('0x3'))(_0xa981('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xa981('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xa981('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0xa981('0x7')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0xa981('0x8')),'smsInteraction':require(_0xa981('0x9')),'faxInteraction':require(_0xa981('0xa')),'whatsappInteraction':require(_0xa981('0xb'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0xc5860e,_0x56b0db,_0x3d9c16,_0x512d41){return function(_0x4ebd0d){try{var _0x3f1a55=this[_0xa981('0xc')];if(_0x3f1a55===_0xa981('0xd')&&_0x512d41['body'][_0xa981('0xe')]){logger[_0xa981('0xf')](_0xa981('0x10'),_0xc5860e,_0xa981('0x11'));return _0x4ebd0d['next']();}if(_0x56b0db[0x0]==='1'&&(_[_0xa981('0x12')](this[_0xa981('0x13')]['created'])||!this[_0xa981('0x13')][_0xa981('0x14')])){logger[_0xa981('0xf')](_0xa981('0x10'),_0xc5860e,_0xa981('0x15'));return _0x4ebd0d[_0xa981('0x16')]();}if(_0x56b0db[0x0]==='2'&&this[_0xa981('0x13')][_0xa981('0x17')]){logger[_0xa981('0xf')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xc5860e,_0xa981('0x18'));return _0x4ebd0d[_0xa981('0x16')]();}var _0xb6de0={'ContactId':this[_0xa981('0x19')]['id'],'sentAt':moment()[_0xa981('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xa981('0x1b')};if(this[_0xa981('0xc')]==='mail'){_0xb6de0[_0xa981('0x1c')]=utils[_0xa981('0x1d')](_0x56b0db[0x2],this);}else{_0xb6de0[_0xa981('0x1c')]=utils[_0xa981('0x1d')](_0x56b0db[0x1],this);}if(this['message']){_0xb6de0['to']=this[_0xa981('0x1e')][_0xa981('0x1f')]||'';if(this[_0xa981('0xc')]===_0xa981('0xd')&&_0x56b0db[0x1]==='1'){_0xb6de0['cc']=this[_0xa981('0x1e')]['cc']||'';}_0xb6de0[_0xa981('0x1f')]=this[_0xa981('0x1e')]['to']||'';_0xb6de0[_0xa981('0x20')]=this['message'][_0xa981('0x20')]||'';_0xb6de0[_0xa981('0x21')]=!![];if(this[_0xa981('0x1e')]['subject']){_0xb6de0[_0xa981('0x22')]='';_0xb6de0[_0xa981('0x22')]+=_[_0xa981('0x23')](this[_0xa981('0x1e')][_0xa981('0x22')],'Re:')?'':_0xa981('0x24');_0xb6de0[_0xa981('0x22')]+=this[_0xa981('0x1e')]['subject'];}}if(this[_0xa981('0xc')]===_0xa981('0x25')){_0xb6de0[_0xa981('0x26')]=this[_0xa981('0x27')]['id'];}else{_0xb6de0[_[_0xa981('0x28')](this['channel'])+_0xa981('0x29')]=this['account']['id'];}_0xb6de0[_[_0xa981('0x28')](this[_0xa981('0xc')])+_0xa981('0x2a')]=this[_0xa981('0x13')]['id'];var _0x1e05ff=this[_0xa981('0x13')];if(rpc[this[_0xa981('0xc')]+_0xa981('0x2b')]){if(this[_0xa981('0xc')]==='mail'){var _0x2b0107={'tls':{'rejectUnauthorized':![]}};if(this[_0xa981('0x27')][_0xa981('0x2c')][_0xa981('0x2d')]){_0x2b0107[_0xa981('0x2d')]=this['account'][_0xa981('0x2c')][_0xa981('0x2d')];}else{_0x2b0107[_0xa981('0x2e')]=this['account'][_0xa981('0x2c')]['host'];_0x2b0107[_0xa981('0x2f')]=this[_0xa981('0x27')][_0xa981('0x2c')][_0xa981('0x2f')];_0x2b0107['secure']=this[_0xa981('0x27')][_0xa981('0x2c')]['secure'];}if(this[_0xa981('0x27')][_0xa981('0x2c')][_0xa981('0x30')]){_0x2b0107[_0xa981('0x31')]={'user':this[_0xa981('0x27')][_0xa981('0x2c')][_0xa981('0x32')],'pass':this['account']['Smtp'][_0xa981('0x33')]};}_0xb6de0[_0xa981('0x34')]=this[_0xa981('0x1e')][_0xa981('0x35')];_0xb6de0['html']=''+_[_0xa981('0x36')](_0xb6de0[_0xa981('0x1c')],'','replace','','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','Message','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally'];(function(_0x2a6ac0,_0x1beb5a){var _0x58b5db=function(_0x41519f){while(--_0x41519f){_0x2a6ac0['push'](_0x2a6ac0['shift']());}};_0x58b5db(++_0x1beb5a);}(_0xe365,0x124));var _0x5e36=function(_0x222859,_0x35afee){_0x222859=_0x222859-0x0;var _0x29dce0=_0xe365[_0x222859];return _0x29dce0;};'use strict';var _=require(_0x5e36('0x0'));var moment=require('moment');var utils=require(_0x5e36('0x1'));var logger=require('../../../../config/logger')(_0x5e36('0x2'));var rpc={'chatMessage':require(_0x5e36('0x3')),'openchannelMessage':require(_0x5e36('0x4')),'mailMessage':require(_0x5e36('0x5')),'smsMessage':require(_0x5e36('0x6')),'faxMessage':require(_0x5e36('0x7')),'whatsappMessage':require(_0x5e36('0x8')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x5e36('0x9')),'mailInteraction':require(_0x5e36('0xa')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x5e36('0xb')),'whatsappInteraction':require(_0x5e36('0xc'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x43d1f2,_0x14d086,_0x52f6d3,_0x597aae){return function(_0xbf97ce){try{var _0x4fb836=this[_0x5e36('0xd')];if(_0x4fb836===_0x5e36('0xe')&&_0x597aae[_0x5e36('0xf')]['isAutoreply']){logger[_0x5e36('0x10')](_0x5e36('0x11'),_0x43d1f2,_0x5e36('0x12'));return _0xbf97ce['next']();}if(_0x14d086[0x0]==='1'&&(_[_0x5e36('0x13')](this[_0x5e36('0x14')]['created'])||!this['interaction']['created'])){logger['info'](_0x5e36('0x11'),_0x43d1f2,_0x5e36('0x15'));return _0xbf97ce['next']();}if(_0x14d086[0x0]==='2'&&this['interaction'][_0x5e36('0x16')]){logger[_0x5e36('0x10')](_0x5e36('0x17'),_0x43d1f2,'One\x20Time\x20already\x20sent');return _0xbf97ce['next']();}var _0x38638e={'ContactId':this[_0x5e36('0x18')]['id'],'sentAt':moment()[_0x5e36('0x19')](_0x5e36('0x1a')),'direction':'out'};if(this[_0x5e36('0xd')]===_0x5e36('0xe')){_0x38638e['body']=utils[_0x5e36('0x1b')](_0x14d086[0x2],this);}else{_0x38638e[_0x5e36('0xf')]=utils[_0x5e36('0x1b')](_0x14d086[0x1],this);}if(this[_0x5e36('0x1c')]){_0x38638e['to']=this['message'][_0x5e36('0x1d')]||'';if(this[_0x5e36('0xd')]==='mail'&&_0x14d086[0x1]==='1'){_0x38638e['cc']=this[_0x5e36('0x1c')]['cc']||'';}_0x38638e['from']=this[_0x5e36('0x1c')]['to']||'';_0x38638e['phone']=this[_0x5e36('0x1c')][_0x5e36('0x1e')]||'';_0x38638e['read']=!![];if(this['message']['subject']){_0x38638e['subject']='';_0x38638e['subject']+=_[_0x5e36('0x1f')](this[_0x5e36('0x1c')][_0x5e36('0x20')],_0x5e36('0x21'))?'':'Re:\x20';_0x38638e['subject']+=this[_0x5e36('0x1c')][_0x5e36('0x20')];}}if(this[_0x5e36('0xd')]===_0x5e36('0x22')){_0x38638e[_0x5e36('0x23')]=this[_0x5e36('0x24')]['id'];}else{_0x38638e[_[_0x5e36('0x25')](this[_0x5e36('0xd')])+_0x5e36('0x26')]=this['account']['id'];}_0x38638e[_[_0x5e36('0x25')](this['channel'])+'InteractionId']=this[_0x5e36('0x14')]['id'];var _0xb746ce=this[_0x5e36('0x14')];if(rpc[this[_0x5e36('0xd')]+'Message']){if(this['channel']===_0x5e36('0xe')){var _0x299cf8={'tls':{'rejectUnauthorized':![]}};if(this['account']['Smtp'][_0x5e36('0x27')]){_0x299cf8['service']=this[_0x5e36('0x24')][_0x5e36('0x28')][_0x5e36('0x27')];}else{_0x299cf8['host']=this[_0x5e36('0x24')][_0x5e36('0x28')][_0x5e36('0x29')];_0x299cf8[_0x5e36('0x2a')]=this[_0x5e36('0x24')][_0x5e36('0x28')][_0x5e36('0x2a')];_0x299cf8[_0x5e36('0x2b')]=this[_0x5e36('0x24')]['Smtp'][_0x5e36('0x2b')];}if(this[_0x5e36('0x24')][_0x5e36('0x28')][_0x5e36('0x2c')]){_0x299cf8[_0x5e36('0x2d')]={'user':this[_0x5e36('0x24')][_0x5e36('0x28')][_0x5e36('0x2e')],'pass':this[_0x5e36('0x24')][_0x5e36('0x28')]['pass']};}_0x38638e[_0x5e36('0x2f')]=this[_0x5e36('0x1c')]['messageId'];_0x38638e[_0x5e36('0x30')]=_0x5e36('0x31')+_[_0x5e36('0x32')](_0x38638e[_0x5e36('0xf')],_0x5e36('0x33'),_0x5e36('0x34'))+_0x5e36('0x35');_0x38638e['headers']={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':'All','Precedence':_0x5e36('0x36')};return mailRpc['sendMailMessage'](_0x299cf8,_0x38638e)[_0x5e36('0x37')](function(_0xb0ffa1){logger['info'](_0x5e36('0x38'),_0x43d1f2);_0x38638e['messageId']=_0xb0ffa1[_0x5e36('0x1c')][_0x5e36('0x39')];return rpc[_0x4fb836+_0x5e36('0x3a')]['create'](_0x38638e);})[_0x5e36('0x37')](function(_0x49cda1){logger['info'](_0x5e36('0x11'),_0x43d1f2,JSON['stringify'](_0x49cda1));})['catch'](function(_0x4bf649){logger[_0x5e36('0x3b')](_0x5e36('0x3c'),_0x43d1f2,JSON[_0x5e36('0x3d')](_0x4bf649));})[_0x5e36('0x3e')](function(){Promise[_0x5e36('0x3f')]()[_0x5e36('0x37')](function(){if(_0x14d086[0x0]!=='2'||_0xb746ce['autoreplyExecuted'])return;return rpc[_0x4fb836+_0x5e36('0x40')]['update'](_0xb746ce['id'],{'autoreplyExecuted':!![]})['then'](function(_0x88594c){logger[_0x5e36('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x43d1f2,JSON[_0x5e36('0x3d')](_0x88594c));})['catch'](function(_0xf0ab2c){logger[_0x5e36('0x3b')](_0x5e36('0x41'),_0x43d1f2,JSON[_0x5e36('0x3d')](_0xf0ab2c));});})['then'](function(){_0xbf97ce[_0x5e36('0x42')]();});});}else{return rpc[this[_0x5e36('0xd')]+_0x5e36('0x3a')][_0x5e36('0x43')](_0x38638e)[_0x5e36('0x37')](function(_0x12a49f){logger[_0x5e36('0x10')](_0x5e36('0x11'),_0x43d1f2,_0x38638e[_0x5e36('0xf')]);})[_0x5e36('0x44')](function(_0x2425f9){logger[_0x5e36('0x3b')](_0x5e36('0x11'),_0x43d1f2,JSON[_0x5e36('0x3d')](_0x2425f9));})[_0x5e36('0x3e')](function(){Promise[_0x5e36('0x3f')]()[_0x5e36('0x37')](function(){if(_0x14d086[0x0]!=='2'||_0xb746ce['autoreplyExecuted'])return;return rpc[_0x4fb836+_0x5e36('0x40')][_0x5e36('0x45')](_0xb746ce['id'],{'autoreplyExecuted':!![]})[_0x5e36('0x37')](function(_0x2b3361){logger[_0x5e36('0x10')](_0x5e36('0x17'),_0x43d1f2,JSON['stringify'](_0x2b3361));})['catch'](function(_0x19c6bb){logger['error'](_0x5e36('0x41'),_0x43d1f2,JSON[_0x5e36('0x3d')](_0x19c6bb));});})['then'](function(){_0xbf97ce[_0x5e36('0x42')]();});});}}}catch(_0x17515e){logger['error'](_0x5e36('0x11'),_0x43d1f2,JSON['stringify'](_0x17515e));_0xbf97ce[_0x5e36('0x46')]();}};}; \ 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 905e3ab..a97c4cf 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 _0x7f29=['system','Interaction','channel','update','then','interaction','catch','error','[%s][CLOSE]\x20%s','stringify','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x469852,_0x532e8c){var _0xa844b9=function(_0x511046){while(--_0x511046){_0x469852['push'](_0x469852['shift']());}};_0xa844b9(++_0x532e8c);}(_0x7f29,0xda));var _0x97f2=function(_0x49f1c3,_0x17ea4e){_0x49f1c3=_0x49f1c3-0x0;var _0x3f0e93=_0x7f29[_0x49f1c3];return _0x3f0e93;};'use strict';var moment=require(_0x97f2('0x0'));var logger=require(_0x97f2('0x1'))(_0x97f2('0x2'));var rpc={'chatInteraction':require(_0x97f2('0x3')),'openchannelInteraction':require(_0x97f2('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x97f2('0x5')),'faxInteraction':require(_0x97f2('0x6')),'whatsappInteraction':require(_0x97f2('0x7'))};exports[_0x97f2('0x8')]=function(_0x722c9a,_0x36d922,_0x295914,_0x44eb8f){return function(_0x500b44){try{logger[_0x97f2('0x9')]('[%s][CLOSE]\x20reason\x20%s',_0x722c9a,_0x36d922[0x0]);var _0x113671={'closed':0x1,'closedAt':moment()[_0x97f2('0xa')](_0x97f2('0xb')),'closeReason':_0x97f2('0xc'),'disposition':_0x36d922[0x0]};if(rpc[_0x44eb8f['channel']+_0x97f2('0xd')]){rpc[_0x44eb8f[_0x97f2('0xe')]+_0x97f2('0xd')][_0x97f2('0xf')](_0x44eb8f['interaction']['id'],_0x113671)[_0x97f2('0x10')](function(_0x36b36c){logger[_0x97f2('0x9')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x722c9a,_0x44eb8f[_0x97f2('0x11')]['id']);})[_0x97f2('0x12')](function(_0x1f4c51){logger[_0x97f2('0x13')](_0x97f2('0x14'),_0x722c9a,JSON[_0x97f2('0x15')](_0x1f4c51));})['finally'](function(){_0x500b44[_0x97f2('0x16')]();});}}catch(_0x2929a6){logger[_0x97f2('0x13')](_0x97f2('0x14'),_0x722c9a,JSON[_0x97f2('0x15')](_0x2929a6));_0x500b44[_0x97f2('0x16')]();}};}; \ No newline at end of file +var _0x5f90=['moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','stringify','finally','stop','[%s][CLOSE]\x20%s'];(function(_0x467488,_0x38c7ae){var _0x56107f=function(_0x4992b3){while(--_0x4992b3){_0x467488['push'](_0x467488['shift']());}};_0x56107f(++_0x38c7ae);}(_0x5f90,0xdc));var _0x05f9=function(_0xd2383,_0x41c996){_0xd2383=_0xd2383-0x0;var _0x2753d6=_0x5f90[_0xd2383];return _0x2753d6;};'use strict';var moment=require(_0x05f9('0x0'));var logger=require(_0x05f9('0x1'))(_0x05f9('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x05f9('0x3')),'smsInteraction':require(_0x05f9('0x4')),'mailInteraction':require(_0x05f9('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x05f9('0x6'))};exports[_0x05f9('0x7')]=function(_0x41c22e,_0xad625d,_0x3acb10,_0x27a6f9){return function(_0x5aa414){try{logger[_0x05f9('0x8')](_0x05f9('0x9'),_0x41c22e,_0xad625d[0x0]);var _0x38568a={'closed':0x1,'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x05f9('0xa'),'disposition':_0xad625d[0x0]};if(rpc[_0x27a6f9[_0x05f9('0xb')]+'Interaction']){rpc[_0x27a6f9[_0x05f9('0xb')]+_0x05f9('0xc')][_0x05f9('0xd')](_0x27a6f9[_0x05f9('0xe')]['id'],_0x38568a)[_0x05f9('0xf')](function(_0x23aeeb){logger[_0x05f9('0x8')](_0x05f9('0x10'),_0x41c22e,_0x27a6f9[_0x05f9('0xe')]['id']);})['catch'](function(_0x37fdff){logger[_0x05f9('0x11')]('[%s][CLOSE]\x20%s',_0x41c22e,JSON[_0x05f9('0x12')](_0x37fdff));})[_0x05f9('0x13')](function(){_0x5aa414[_0x05f9('0x14')]();});}}catch(_0x13c830){logger[_0x05f9('0x11')](_0x05f9('0x15'),_0x41c22e,JSON[_0x05f9('0x12')](_0x13c830));_0x5aa414[_0x05f9('0x14')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 65f3e18..8eb66b6 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 _0x78e0=['stringify','metadata','endConversation','next','error','message','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','ChatWebsiteId','account','upperFirst','AccountId','created','body','getMustacheRender','Message','create','then','catch','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','dialogflow','result','fulfillment','providerName','providerResponse'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x78e0,0x13e));var _0x078e=function(_0x1a7e4b,_0x2fbd40){_0x1a7e4b=_0x1a7e4b-0x0;var _0x37a8fd=_0x78e0[_0x1a7e4b];return _0x37a8fd;};'use strict';var _=require(_0x078e('0x0'));var moment=require(_0x078e('0x1'));var apiai=require(_0x078e('0x2'));var md5=require(_0x078e('0x3'));var utils=require(_0x078e('0x4'));var logger=require(_0x078e('0x5'))(_0x078e('0x6'));var rpc={'chatMessage':require(_0x078e('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x078e('0x8')),'faxMessage':require(_0x078e('0x9')),'whatsappMessage':require(_0x078e('0xa'))};exports[_0x078e('0xb')]=function(_0x117087,_0x5e67ea){return function(_0x2e5eed){try{if(!_[_0x078e('0xc')](this[_0x078e('0xd')][_0x078e('0xe')])){logger[_0x078e('0xf')](_0x078e('0x10'),_0x117087,_0x078e('0x11'));return _0x2e5eed['next']();}var _0x3c144e={'ContactId':this[_0x078e('0x12')]['id'],'sentAt':moment()[_0x078e('0x13')](_0x078e('0x14')),'direction':_0x078e('0x15')};if(this[_0x078e('0x16')]===_0x078e('0x17')||this[_0x078e('0x16')]===_0x078e('0x18')){_0x3c144e['phone']=this[_0x078e('0xd')]['phone'];}var _0x4a0097=this[_0x078e('0x16')];if(_0x4a0097==='chat'){_0x3c144e[_0x078e('0x19')]=this[_0x078e('0x1a')]['id'];}else{_0x3c144e[_[_0x078e('0x1b')](_0x4a0097)+_0x078e('0x1c')]=this[_0x078e('0x1a')]['id'];}_0x3c144e[_[_0x078e('0x1b')](_0x4a0097)+'InteractionId']=this['interaction']['id'];if(this['interaction'][_0x078e('0x1d')]){var _0x150529=_0x5e67ea[0x2];if(!_['isEmpty'](_0x150529)){_0x3c144e[_0x078e('0x1e')]=utils[_0x078e('0x1f')](_0x150529,this);return rpc[_0x4a0097+_0x078e('0x20')][_0x078e('0x21')](_0x3c144e)[_0x078e('0x22')](function(_0x45de3f){logger[_0x078e('0xf')](_0x078e('0x10'),_0x117087,_0x3c144e[_0x078e('0x1e')]);})[_0x078e('0x23')](function(_0x36f683){logger['error'](_0x078e('0x10'),_0x117087,JSON['stringify'](_0x36f683));})[_0x078e('0x24')](function(){logger[_0x078e('0xf')](_0x078e('0x25'),_0x117087);_0x2e5eed[_0x078e('0x26')]();});}else{logger['info'](_0x078e('0x27'),_0x117087);_0x2e5eed['stop']();}}else{var _0x4d5ef7=this;var _0x30b6b0=apiai(_0x5e67ea[0x0],{'language':_0x5e67ea[0x1]||'en'});return _0x30b6b0[_0x078e('0x28')](this['message'][_0x078e('0x1e')],{'sessionId':md5(this['interaction']['id'])})[_0x078e('0x22')](function(_0x20421a){_0x4d5ef7[_0x078e('0x1e')][_0x078e('0x29')]=_0x20421a;_0x3c144e[_0x078e('0x1e')]=_0x20421a[_0x078e('0x2a')][_0x078e('0x2b')]['speech'];_0x3c144e[_0x078e('0x2c')]='dialogflow';_0x3c144e[_0x078e('0x2d')]=JSON[_0x078e('0x2e')](_0x20421a);return rpc[_0x4a0097+_0x078e('0x20')][_0x078e('0x21')](_0x3c144e)[_0x078e('0x22')](function(_0x5e6d26){logger[_0x078e('0xf')](_0x078e('0x10'),_0x117087,_0x3c144e[_0x078e('0x1e')]);if(_0x20421a[_0x078e('0x2a')][_0x078e('0x2f')][_0x078e('0x30')]){_0x2e5eed[_0x078e('0x31')]();}else{_0x2e5eed[_0x078e('0x26')]();}})[_0x078e('0x23')](function(_0x5e5bac){logger['error'](_0x078e('0x10'),_0x117087,JSON[_0x078e('0x2e')](_0x5e5bac));_0x2e5eed['next']();});})[_0x078e('0x23')](function(_0x5b3c18){logger[_0x078e('0x32')](_0x078e('0x10'),_0x117087,_0x5b3c18[_0x078e('0x33')]);_0x2e5eed[_0x078e('0x31')]();});}}catch(_0xd2698e){logger['error'](_0x078e('0x10'),_0x117087,JSON[_0x078e('0x2e')](_0xd2698e));_0x2e5eed[_0x078e('0x26')]();}};}; \ No newline at end of file +var _0xe1d3=['create','then','info','error','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','Message','catch','lodash','moment','apiai-promise','md5','./utils','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','[%s][DIALOGFLOW]\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','account','AccountId','upperFirst','InteractionId','created','body','getMustacheRender'];(function(_0x4ea955,_0x1eda76){var _0x558561=function(_0x5b20f4){while(--_0x5b20f4){_0x4ea955['push'](_0x4ea955['shift']());}};_0x558561(++_0x1eda76);}(_0xe1d3,0x159));var _0x3e1d=function(_0x49b2ef,_0x4d95d6){_0x49b2ef=_0x49b2ef-0x0;var _0x316ec5=_0xe1d3[_0x49b2ef];return _0x316ec5;};'use strict';var _=require(_0x3e1d('0x0'));var moment=require(_0x3e1d('0x1'));var apiai=require(_0x3e1d('0x2'));var md5=require(_0x3e1d('0x3'));var utils=require(_0x3e1d('0x4'));var logger=require('../../../../config/logger')(_0x3e1d('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x3e1d('0x6')),'mailMessage':require(_0x3e1d('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x3e1d('0x8'))};exports[_0x3e1d('0x9')]=function(_0x2caae6,_0x2b58a1){return function(_0x2b5c34){try{if(!_['isNil'](this[_0x3e1d('0xa')][_0x3e1d('0xb')])){logger['info'](_0x3e1d('0xc'),_0x2caae6,_0x3e1d('0xd'));return _0x2b5c34[_0x3e1d('0xe')]();}var _0x3c49f0={'ContactId':this[_0x3e1d('0xf')]['id'],'sentAt':moment()[_0x3e1d('0x10')](_0x3e1d('0x11')),'direction':_0x3e1d('0x12')};if(this[_0x3e1d('0x13')]===_0x3e1d('0x14')||this[_0x3e1d('0x13')]===_0x3e1d('0x15')){_0x3c49f0[_0x3e1d('0x16')]=this[_0x3e1d('0xa')]['phone'];}var _0x307c37=this[_0x3e1d('0x13')];if(_0x307c37==='chat'){_0x3c49f0[_0x3e1d('0x17')]=this[_0x3e1d('0x18')]['id'];}else{_0x3c49f0[_['upperFirst'](_0x307c37)+_0x3e1d('0x19')]=this[_0x3e1d('0x18')]['id'];}_0x3c49f0[_[_0x3e1d('0x1a')](_0x307c37)+_0x3e1d('0x1b')]=this[_0x3e1d('0xa')]['id'];if(this['interaction'][_0x3e1d('0x1c')]){var _0x2721e5=_0x2b58a1[0x2];if(!_['isEmpty'](_0x2721e5)){_0x3c49f0[_0x3e1d('0x1d')]=utils[_0x3e1d('0x1e')](_0x2721e5,this);return rpc[_0x307c37+'Message'][_0x3e1d('0x1f')](_0x3c49f0)[_0x3e1d('0x20')](function(_0x2e0007){logger[_0x3e1d('0x21')](_0x3e1d('0xc'),_0x2caae6,_0x3c49f0[_0x3e1d('0x1d')]);})['catch'](function(_0x20bfdd){logger[_0x3e1d('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x2caae6,JSON[_0x3e1d('0x23')](_0x20bfdd));})[_0x3e1d('0x24')](function(){logger[_0x3e1d('0x21')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2caae6);_0x2b5c34[_0x3e1d('0x25')]();});}else{logger['info'](_0x3e1d('0x26'),_0x2caae6);_0x2b5c34[_0x3e1d('0x25')]();}}else{var _0x296d3b=this;var _0x34b191=apiai(_0x2b58a1[0x0],{'language':_0x2b58a1[0x1]||'en'});return _0x34b191[_0x3e1d('0x27')](this[_0x3e1d('0x28')][_0x3e1d('0x1d')],{'sessionId':md5(this[_0x3e1d('0xa')]['id'])})[_0x3e1d('0x20')](function(_0x5291c4){_0x296d3b[_0x3e1d('0x1d')][_0x3e1d('0x29')]=_0x5291c4;_0x3c49f0[_0x3e1d('0x1d')]=_0x5291c4[_0x3e1d('0x2a')][_0x3e1d('0x2b')][_0x3e1d('0x2c')];_0x3c49f0['providerName']='dialogflow';_0x3c49f0['providerResponse']=JSON[_0x3e1d('0x23')](_0x5291c4);return rpc[_0x307c37+_0x3e1d('0x2d')][_0x3e1d('0x1f')](_0x3c49f0)[_0x3e1d('0x20')](function(_0x49c9b3){logger[_0x3e1d('0x21')](_0x3e1d('0xc'),_0x2caae6,_0x3c49f0[_0x3e1d('0x1d')]);if(_0x5291c4['result']['metadata']['endConversation']){_0x2b5c34[_0x3e1d('0xe')]();}else{_0x2b5c34[_0x3e1d('0x25')]();}})[_0x3e1d('0x2e')](function(_0x468c3a){logger['error'](_0x3e1d('0xc'),_0x2caae6,JSON[_0x3e1d('0x23')](_0x468c3a));_0x2b5c34[_0x3e1d('0xe')]();});})[_0x3e1d('0x2e')](function(_0x5c425f){logger[_0x3e1d('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x2caae6,_0x5c425f[_0x3e1d('0x28')]);_0x2b5c34['next']();});}}catch(_0x4d033b){logger[_0x3e1d('0x22')](_0x3e1d('0xc'),_0x2caae6,JSON[_0x3e1d('0x23')](_0x4d033b));_0x2b5c34[_0x3e1d('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 4fab934..1630836 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 _0x87c3=['routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','[%s][DIALOGFLOWV2]\x20%s','catch','error','consequence','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','whatsapp','interaction','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','info','stringify','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','message','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerName','length','fulfillmentText','push','all','lodash','dialogflow','bluebird','../../../../config/logger'];(function(_0x19fc2f,_0x2509a1){var _0x24a68f=function(_0x544062){while(--_0x544062){_0x19fc2f['push'](_0x19fc2f['shift']());}};_0x24a68f(++_0x2509a1);}(_0x87c3,0x120));var _0x387c=function(_0x16e702,_0x2c569c){_0x16e702=_0x16e702-0x0;var _0x60be17=_0x87c3[_0x16e702];return _0x60be17;};'use strict';var _=require(_0x387c('0x0'));var dialogflow=require(_0x387c('0x1'));var md5=require('md5');var moment=require('moment');var Promise=require(_0x387c('0x2'));var logger=require(_0x387c('0x3'))(_0x387c('0x4'));var utils=require(_0x387c('0x5'));var rpc={'chatMessage':require(_0x387c('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x387c('0x7')),'smsMessage':require(_0x387c('0x8')),'faxMessage':require(_0x387c('0x9')),'whatsappMessage':require(_0x387c('0xa'))};function createMessage(_0xe22763,_0x339c8c,_0x18c482,_0x585698){return new Promise(function(_0x3fe347,_0x3c9019){var _0x16d973=_[_0x387c('0xb')](_0x18c482);_0x16d973[_0x387c('0xc')]=_0x585698;return rpc[_0x339c8c+_0x387c('0xd')][_0x387c('0xe')](_0x16d973)[_0x387c('0xf')](function(){logger['info'](_0x387c('0x10'),_0xe22763,_0x16d973['body']);_0x3fe347();})[_0x387c('0x11')](function(_0x1c22f5){logger[_0x387c('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0xe22763,JSON['stringify'](_0x1c22f5));_0x3c9019(_0x1c22f5);});});}exports[_0x387c('0x13')]=function(_0x187632,_0x3d7f44){return function(_0x4a08ff){try{if(!_[_0x387c('0x14')](this['interaction'][_0x387c('0x15')])){logger['info'](_0x387c('0x10'),_0x187632,_0x387c('0x16'));return _0x4a08ff[_0x387c('0x17')]();}var _0x259706={'ContactId':this[_0x387c('0x18')]['id'],'sentAt':moment()[_0x387c('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x387c('0x1a')};if(this[_0x387c('0x1b')]===_0x387c('0x1c')||this['channel']===_0x387c('0x1d')){_0x259706['phone']=this[_0x387c('0x1e')][_0x387c('0x1f')];}var _0x5dc4d7=this[_0x387c('0x1b')];if(_0x5dc4d7===_0x387c('0x20')){_0x259706[_0x387c('0x21')]=this[_0x387c('0x22')]['id'];}else{_0x259706[_[_0x387c('0x23')](_0x5dc4d7)+_0x387c('0x24')]=this[_0x387c('0x22')]['id'];}_0x259706[_[_0x387c('0x23')](_0x5dc4d7)+_0x387c('0x25')]=this[_0x387c('0x1e')]['id'];if(this['interaction'][_0x387c('0x26')]){var _0x4cc356=_0x3d7f44[0x4];if(!_[_0x387c('0x27')](_0x4cc356)){_0x259706[_0x387c('0xc')]=utils[_0x387c('0x28')](_0x4cc356,this);return rpc[_0x5dc4d7+_0x387c('0xd')][_0x387c('0xe')](_0x259706)[_0x387c('0xf')](function(_0x132a86){logger[_0x387c('0x29')]('[%s][DIALOGFLOWV2]\x20%s',_0x187632,_0x259706[_0x387c('0xc')]);})['catch'](function(_0x5ab1a3){logger['error'](_0x387c('0x10'),_0x187632,JSON[_0x387c('0x2a')](_0x5ab1a3));})['finally'](function(){logger[_0x387c('0x29')](_0x387c('0x2b'),_0x187632);_0x4a08ff[_0x387c('0x2c')]();});}else{logger['info'](_0x387c('0x2d'),_0x187632);_0x4a08ff[_0x387c('0x2c')]();}}else{var _0x56c33d=this;var _0x68f46a=_0x3d7f44[0x2][_0x387c('0x2e')](/\\n/g,'\x0a');var _0x321968={'credentials':{'private_key':_0x68f46a,'client_email':_0x3d7f44[0x1]}};var _0x2e3c57=new dialogflow[(_0x387c('0x2f'))](_0x321968);var _0x2a15d1=_0x2e3c57['sessionPath'](_0x3d7f44[0x0],md5(_0x56c33d[_0x387c('0x1e')]['id']));var _0xb3a2df={'session':_0x2a15d1,'queryInput':{'text':{'text':_0x56c33d[_0x387c('0x30')][_0x387c('0xc')],'languageCode':_0x3d7f44[0x3]||'en'}}};return _0x2e3c57[_0x387c('0x31')](_0xb3a2df)[_0x387c('0xf')](function(_0x2ecdcf){if(_0x2ecdcf&&_0x2ecdcf['length']){_0x56c33d[_0x387c('0xc')][_0x387c('0x32')]=_0x2ecdcf;var _0x3c1842=_0x2ecdcf[0x0];var _0x1f7fc7=_0x3c1842[_0x387c('0x33')][_0x387c('0x34')]&&_0x3c1842[_0x387c('0x33')][_0x387c('0x34')][_0x387c('0x35')]?_0x3c1842[_0x387c('0x33')][_0x387c('0x34')][_0x387c('0x35')][_0x387c('0x36')][_0x387c('0x37')]:![];_0x56c33d[_0x387c('0xc')]['DIALOGFLOWV2_ACTION']=_0x3c1842[_0x387c('0x33')][_0x387c('0x38')];_0x56c33d[_0x387c('0xc')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x3c1842['queryResult'][_0x387c('0x39')];_0x56c33d['body'][_0x387c('0x3a')]=_0x3c1842['queryResult'][_0x387c('0x34')]&&_0x3c1842[_0x387c('0x33')][_0x387c('0x34')][_0x387c('0x35')]?_0x3c1842[_0x387c('0x33')][_0x387c('0x34')][_0x387c('0x35')][_0x387c('0x36')]['boolValue']:![];_0x56c33d[_0x387c('0xc')]['DIALOGFLOWV2_INTENTNAME']=_0x3c1842[_0x387c('0x33')][_0x387c('0x3b')][_0x387c('0x3c')];_0x56c33d[_0x387c('0xc')][_0x387c('0x3d')]=_0x3c1842[_0x387c('0x33')][_0x387c('0x3b')]['displayName'];_0x56c33d['body']['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x3c1842[_0x387c('0x33')]['intent'][_0x387c('0x3e')];_0x56c33d[_0x387c('0xc')][_0x387c('0x3f')]=_0x3c1842['queryResult'][_0x387c('0x40')];_0x56c33d[_0x387c('0xc')][_0x387c('0x41')]=_0x3c1842[_0x387c('0x33')][_0x387c('0x42')];_0x56c33d[_0x387c('0xc')]['DIALOGFLOWV2_SCORE']=_0x3c1842['queryResult'][_0x387c('0x43')];_0x259706[_0x387c('0x44')]=_0x387c('0x32');_0x259706['providerResponse']=JSON[_0x387c('0x2a')](_0x2ecdcf);var _0x44a6e3=[];for(var _0x2fff0b=0x0;_0x2fff0b<_0x2ecdcf[_0x387c('0x45')];_0x2fff0b++){var _0x5ee224=_0x2ecdcf[_0x2fff0b];if(_0x5ee224&&_0x5ee224[_0x387c('0x33')]&&_0x5ee224[_0x387c('0x33')][_0x387c('0x46')]){_0x44a6e3[_0x387c('0x47')](createMessage(_0x187632,_0x5dc4d7,_0x259706,_0x5ee224['queryResult'][_0x387c('0x46')]));}}return Promise[_0x387c('0x48')](_0x44a6e3)['then'](function(){if(_0x1f7fc7){_0x4a08ff['next']();}else{_0x4a08ff[_0x387c('0x2c')]();}})[_0x387c('0x11')](function(_0x319e32){logger[_0x387c('0x12')](_0x387c('0x10'),_0x187632,JSON[_0x387c('0x2a')](_0x319e32));_0x4a08ff[_0x387c('0x17')]();});}})['catch'](function(_0x4d3605){logger[_0x387c('0x12')](_0x387c('0x10'),_0x187632,_0x4d3605['message']);_0x4a08ff['next']();});}}catch(_0x520269){logger['error'](_0x387c('0x10'),_0x187632,JSON[_0x387c('0x2a')](_0x520269));_0x4a08ff[_0x387c('0x2c')]();}};}; \ No newline at end of file +var _0xd01a=['interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','isEmpty','getMustacheRender','create','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','DIALOGFLOWV2_SCORE','providerResponse','fulfillmentText','push','next','lodash','md5','moment','../../../../config/logger','routing','./utils','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','body','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','consequence','isNil'];(function(_0x15bb74,_0x1ae7df){var _0x14c0b2=function(_0x4b61f3){while(--_0x4b61f3){_0x15bb74['push'](_0x15bb74['shift']());}};_0x14c0b2(++_0x1ae7df);}(_0xd01a,0x1ae));var _0xad01=function(_0xaedbf3,_0x38513b){_0xaedbf3=_0xaedbf3-0x0;var _0x45fa0f=_0xd01a[_0xaedbf3];return _0x45fa0f;};'use strict';var _=require(_0xad01('0x0'));var dialogflow=require('dialogflow');var md5=require(_0xad01('0x1'));var moment=require(_0xad01('0x2'));var Promise=require('bluebird');var logger=require(_0xad01('0x3'))(_0xad01('0x4'));var utils=require(_0xad01('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xad01('0x6')),'smsMessage':require(_0xad01('0x7')),'faxMessage':require(_0xad01('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x539c9e,_0xa3854c,_0x128ceb,_0x30add1){return new Promise(function(_0x1ce11d,_0x346da4){var _0x18a59f=_['clone'](_0x128ceb);_0x18a59f[_0xad01('0x9')]=_0x30add1;return rpc[_0xa3854c+_0xad01('0xa')]['create'](_0x18a59f)[_0xad01('0xb')](function(){logger[_0xad01('0xc')](_0xad01('0xd'),_0x539c9e,_0x18a59f[_0xad01('0x9')]);_0x1ce11d();})[_0xad01('0xe')](function(_0x308a5f){logger[_0xad01('0xf')](_0xad01('0xd'),_0x539c9e,JSON['stringify'](_0x308a5f));_0x346da4(_0x308a5f);});});}exports[_0xad01('0x10')]=function(_0x42b20e,_0x227afa){return function(_0x46fb4d){try{if(!_[_0xad01('0x11')](this[_0xad01('0x12')]['UserId'])){logger[_0xad01('0xc')](_0xad01('0xd'),_0x42b20e,_0xad01('0x13'));return _0x46fb4d['next']();}var _0x34b56e={'ContactId':this['contact']['id'],'sentAt':moment()[_0xad01('0x14')](_0xad01('0x15')),'direction':_0xad01('0x16')};if(this['channel']==='sms'||this[_0xad01('0x17')]===_0xad01('0x18')){_0x34b56e[_0xad01('0x19')]=this[_0xad01('0x12')][_0xad01('0x19')];}var _0x3074d0=this[_0xad01('0x17')];if(_0x3074d0==='chat'){_0x34b56e[_0xad01('0x1a')]=this['account']['id'];}else{_0x34b56e[_[_0xad01('0x1b')](_0x3074d0)+_0xad01('0x1c')]=this[_0xad01('0x1d')]['id'];}_0x34b56e[_['upperFirst'](_0x3074d0)+_0xad01('0x1e')]=this[_0xad01('0x12')]['id'];if(this[_0xad01('0x12')]['created']){var _0x1d9fff=_0x227afa[0x4];if(!_[_0xad01('0x1f')](_0x1d9fff)){_0x34b56e[_0xad01('0x9')]=utils[_0xad01('0x20')](_0x1d9fff,this);return rpc[_0x3074d0+_0xad01('0xa')][_0xad01('0x21')](_0x34b56e)['then'](function(_0x4e054b){logger[_0xad01('0xc')](_0xad01('0xd'),_0x42b20e,_0x34b56e[_0xad01('0x9')]);})['catch'](function(_0x23323c){logger[_0xad01('0xf')](_0xad01('0xd'),_0x42b20e,JSON[_0xad01('0x22')](_0x23323c));})[_0xad01('0x23')](function(){logger['info'](_0xad01('0x24'),_0x42b20e);_0x46fb4d[_0xad01('0x25')]();});}else{logger['info'](_0xad01('0x26'),_0x42b20e);_0x46fb4d['stop']();}}else{var _0x446b4f=this;var _0x24c9cd=_0x227afa[0x2][_0xad01('0x27')](/\\n/g,'\x0a');var _0x424bf2={'credentials':{'private_key':_0x24c9cd,'client_email':_0x227afa[0x1]}};var _0x254523=new dialogflow[(_0xad01('0x28'))](_0x424bf2);var _0x283afc=_0x254523[_0xad01('0x29')](_0x227afa[0x0],md5(_0x446b4f['interaction']['id']));var _0x315236={'session':_0x283afc,'queryInput':{'text':{'text':_0x446b4f[_0xad01('0x2a')][_0xad01('0x9')],'languageCode':_0x227afa[0x3]||'en'}}};return _0x254523[_0xad01('0x2b')](_0x315236)[_0xad01('0xb')](function(_0xc92582){if(_0xc92582&&_0xc92582[_0xad01('0x2c')]){_0x446b4f['body'][_0xad01('0x2d')]=_0xc92582;var _0x16dbc7=_0xc92582[0x0];var _0x4313f1=_0x16dbc7[_0xad01('0x2e')][_0xad01('0x2f')]&&_0x16dbc7[_0xad01('0x2e')][_0xad01('0x2f')][_0xad01('0x30')]?_0x16dbc7['queryResult']['diagnosticInfo'][_0xad01('0x30')]['end_conversation'][_0xad01('0x31')]:![];_0x446b4f[_0xad01('0x9')][_0xad01('0x32')]=_0x16dbc7[_0xad01('0x2e')]['action'];_0x446b4f[_0xad01('0x9')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x16dbc7['queryResult'][_0xad01('0x33')];_0x446b4f[_0xad01('0x9')][_0xad01('0x34')]=_0x16dbc7[_0xad01('0x2e')]['diagnosticInfo']&&_0x16dbc7['queryResult'][_0xad01('0x2f')][_0xad01('0x30')]?_0x16dbc7[_0xad01('0x2e')][_0xad01('0x2f')][_0xad01('0x30')][_0xad01('0x35')][_0xad01('0x31')]:![];_0x446b4f[_0xad01('0x9')]['DIALOGFLOWV2_INTENTNAME']=_0x16dbc7[_0xad01('0x2e')]['intent']['name'];_0x446b4f[_0xad01('0x9')][_0xad01('0x36')]=_0x16dbc7[_0xad01('0x2e')]['intent']['displayName'];_0x446b4f['body'][_0xad01('0x37')]=_0x16dbc7[_0xad01('0x2e')]['intent']['isFallback'];_0x446b4f[_0xad01('0x9')][_0xad01('0x38')]=_0x16dbc7[_0xad01('0x2e')][_0xad01('0x39')];_0x446b4f[_0xad01('0x9')]['DIALOGFLOWV2_QUERYTEXT']=_0x16dbc7['queryResult'][_0xad01('0x3a')];_0x446b4f[_0xad01('0x9')][_0xad01('0x3b')]=_0x16dbc7['queryResult']['intentDetectionConfidence'];_0x34b56e['providerName']='dialogflowV2';_0x34b56e[_0xad01('0x3c')]=JSON[_0xad01('0x22')](_0xc92582);var _0x4a5e32=[];for(var _0x335eac=0x0;_0x335eac<_0xc92582['length'];_0x335eac++){var _0x221b72=_0xc92582[_0x335eac];if(_0x221b72&&_0x221b72[_0xad01('0x2e')]&&_0x221b72[_0xad01('0x2e')][_0xad01('0x3d')]){_0x4a5e32[_0xad01('0x3e')](createMessage(_0x42b20e,_0x3074d0,_0x34b56e,_0x221b72[_0xad01('0x2e')][_0xad01('0x3d')]));}}return Promise['all'](_0x4a5e32)[_0xad01('0xb')](function(){if(_0x4313f1){_0x46fb4d['next']();}else{_0x46fb4d[_0xad01('0x25')]();}})[_0xad01('0xe')](function(_0xc028d8){logger[_0xad01('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x42b20e,JSON[_0xad01('0x22')](_0xc028d8));_0x46fb4d[_0xad01('0x3f')]();});}})['catch'](function(_0x2ae500){logger[_0xad01('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x42b20e,_0x2ae500[_0xad01('0x2a')]);_0x46fb4d['next']();});}}catch(_0x42e5b6){logger[_0xad01('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x42b20e,JSON[_0xad01('0x22')](_0x42e5b6));_0x46fb4d[_0xad01('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 2ae3063..44fa379 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 _0x0271=['next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s'];(function(_0x454ea9,_0x4f9868){var _0x5dbe48=function(_0x37ea31){while(--_0x37ea31){_0x454ea9['push'](_0x454ea9['shift']());}};_0x5dbe48(++_0x4f9868);}(_0x0271,0x19b));var _0x1027=function(_0xb7988e,_0x573ffe){_0xb7988e=_0xb7988e-0x0;var _0x3cfc93=_0x0271[_0xb7988e];return _0x3cfc93;};'use strict';var schema=require(_0x1027('0x0'));var _=require(_0x1027('0x1'));var htmlToText=require(_0x1027('0x2'));var utils=require('./utils');var logger=require(_0x1027('0x3'))(_0x1027('0x4'));var gotoif=schema({'condition':{'type':_0x1027('0x5'),'required':!![],'message':_0x1027('0x6')},'priorityTrue':{'type':_0x1027('0x7'),'message':_0x1027('0x8')},'priorityFalse':{'type':_0x1027('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x1027('0x9')]=function(_0xb12c3a,_0x4ca034){return function(_0x5417fe){try{var _0xb0317a={'condition':htmlToText[_0x1027('0xa')](utils[_0x1027('0xb')](_0x4ca034[0x0],this),{'wordwrap':![]})[_0x1027('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4ca034[0x1],'priorityFalse':_0x4ca034[0x2]};var _0x150ab0=gotoif[_0x1027('0x0')](_0xb0317a,{'typecast':!![]});if(_0x150ab0[_0x1027('0xd')]){logger[_0x1027('0xe')](_0x1027('0xf'),_0xb12c3a,_[_0x1027('0x10')](_0x150ab0,_0x1027('0x11'))['join'](',\x20'));_0x5417fe[_0x1027('0x12')]();}else{try{var _0x102e44=eval('('+_0xb0317a[_0x1027('0x13')]+')');var _0xf472e3=_0x102e44?_0xb0317a[_0x1027('0x14')]:_0xb0317a[_0x1027('0x15')];logger[_0x1027('0x16')](_0x1027('0x17'),_0xb12c3a,_0xb0317a[_0x1027('0x13')],_0x102e44,_0xf472e3||_0x1027('0x18'));if(_0xf472e3){var _0x983174=_['findIndex'](_0x5417fe[_0x1027('0x19')](),{'p':_0xf472e3});if(_0x983174>=0x0){logger[_0x1027('0x16')](_0x1027('0x1a'),_0xb12c3a,_0xf472e3||_0x1027('0x18'),_0x983174);_0x5417fe[_0x1027('0x18')](_0x983174);}else{logger[_0x1027('0x16')](_0x1027('0x1b'),_0xb12c3a,_0xf472e3||_0x1027('0x18'));_0x5417fe[_0x1027('0x12')]();}}else{_0x5417fe[_0x1027('0x18')]();}}catch(_0x2380ea){logger[_0x1027('0xe')](_0x1027('0x1c'),_0xb12c3a,_0x2380ea[_0x1027('0x11')]);_0x5417fe[_0x1027('0x12')]();}}}catch(_0x420ac1){logger['error']('[%s][GOTOIF]\x20%s',_0xb12c3a,JSON['stringify'](_0x420ac1));_0x5417fe[_0x1027('0x12')]();}};}; \ No newline at end of file +var _0x2738=['rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','./utils','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','next'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0x2738,0x1db));var _0x8273=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x2738[_0xfa634c];return _0x73e478;};'use strict';var schema=require(_0x8273('0x0'));var _=require(_0x8273('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x8273('0x2'));var logger=require('../../../../config/logger')(_0x8273('0x3'));var gotoif=schema({'condition':{'type':_0x8273('0x4'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x8273('0x5'),'message':_0x8273('0x6')},'priorityFalse':{'type':_0x8273('0x5'),'message':_0x8273('0x7')}});exports[_0x8273('0x8')]=function(_0x4f0f7b,_0x41f37c){return function(_0xde69b2){try{var _0x30827f={'condition':htmlToText[_0x8273('0x9')](utils[_0x8273('0xa')](_0x41f37c[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x41f37c[0x1],'priorityFalse':_0x41f37c[0x2]};var _0x21d266=gotoif[_0x8273('0x0')](_0x30827f,{'typecast':!![]});if(_0x21d266['length']){logger['error'](_0x8273('0xb'),_0x4f0f7b,_[_0x8273('0xc')](_0x21d266,_0x8273('0xd'))[_0x8273('0xe')](',\x20'));_0xde69b2[_0x8273('0xf')]();}else{try{var _0x26553f=eval('('+_0x30827f[_0x8273('0x10')]+')');var _0x219287=_0x26553f?_0x30827f[_0x8273('0x11')]:_0x30827f['priorityFalse'];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x4f0f7b,_0x30827f['condition'],_0x26553f,_0x219287||_0x8273('0x12'));if(_0x219287){var _0x528970=_['findIndex'](_0xde69b2[_0x8273('0x13')](),{'p':_0x219287});if(_0x528970>=0x0){logger[_0x8273('0x14')](_0x8273('0x15'),_0x4f0f7b,_0x219287||_0x8273('0x12'),_0x528970);_0xde69b2['next'](_0x528970);}else{logger[_0x8273('0x14')](_0x8273('0x16'),_0x4f0f7b,_0x219287||'next');_0xde69b2[_0x8273('0xf')]();}}else{_0xde69b2[_0x8273('0x12')]();}}catch(_0x5e7b3e){logger[_0x8273('0x17')](_0x8273('0x18'),_0x4f0f7b,_0x5e7b3e['message']);_0xde69b2[_0x8273('0xf')]();}}}catch(_0x122173){logger['error'](_0x8273('0xb'),_0x4f0f7b,JSON[_0x8273('0x19')](_0x122173));_0xde69b2[_0x8273('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 99ba62d..01349d6 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 _0xb9b0=['rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','error','stringify','validate','../../../../config/logger','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex'];(function(_0x153ff7,_0x47f2ed){var _0x3ce628=function(_0x5daf3){while(--_0x5daf3){_0x153ff7['push'](_0x153ff7['shift']());}};_0x3ce628(++_0x47f2ed);}(_0xb9b0,0x137));var _0x0b9b=function(_0x24878c,_0xb76fde){_0x24878c=_0x24878c-0x0;var _0x3da9e9=_0xb9b0[_0x24878c];return _0x3da9e9;};'use strict';var schema=require(_0x0b9b('0x0'));var _=require('lodash');var logger=require(_0x0b9b('0x1'))('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x0b9b('0x2')}});exports[_0x0b9b('0x3')]=function(_0x407439,_0x853871){return function(_0x195440){try{var _0x19a095={'priority':_0x853871[0x0]};var _0x120d13=gotop[_0x0b9b('0x0')](_0x19a095,{'typecast':!![]});if(_0x120d13[_0x0b9b('0x4')]){logger['error'](_0x0b9b('0x5'),_0x407439,_['map'](_0x120d13,_0x0b9b('0x6'))[_0x0b9b('0x7')](',\x20'));_0x195440['stop']();}else{logger[_0x0b9b('0x8')](_0x0b9b('0x9'),_0x407439,_0x19a095[_0x0b9b('0xa')]);if(_0x19a095[_0x0b9b('0xa')]){var _0x5769e6=_[_0x0b9b('0xb')](_0x195440[_0x0b9b('0xc')](),{'p':_0x19a095[_0x0b9b('0xa')]});if(_0x5769e6>=0x0){logger[_0x0b9b('0x8')](_0x0b9b('0xd'),_0x407439,_0x19a095[_0x0b9b('0xa')]||_0x0b9b('0xe'),_0x5769e6);_0x195440[_0x0b9b('0xe')](_0x5769e6);}else{logger['info'](_0x0b9b('0xf'),_0x407439,_0x19a095[_0x0b9b('0xa')]||'next');_0x195440[_0x0b9b('0x10')]();}}else{_0x195440[_0x0b9b('0xe')]();}}}catch(_0x5866ae){logger[_0x0b9b('0x11')](_0x0b9b('0x5'),_0x407439,JSON[_0x0b9b('0x12')](_0x5866ae));_0x195440['stop']();}};}; \ No newline at end of file +var _0xa877=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','routing','number'];(function(_0x550bf0,_0x5a4383){var _0x187c24=function(_0x55ca82){while(--_0x55ca82){_0x550bf0['push'](_0x550bf0['shift']());}};_0x187c24(++_0x5a4383);}(_0xa877,0x162));var _0x7a87=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa877[_0x57b54c];return _0x59cc19;};'use strict';var schema=require('validate');var _=require(_0x7a87('0x0'));var logger=require('../../../../config/logger')(_0x7a87('0x1'));var gotop=schema({'priority':{'type':_0x7a87('0x2'),'required':!![],'message':_0x7a87('0x3')}});exports[_0x7a87('0x4')]=function(_0x2bcae8,_0x24a250){return function(_0x55cc10){try{var _0x114b2d={'priority':_0x24a250[0x0]};var _0x5ae662=gotop['validate'](_0x114b2d,{'typecast':!![]});if(_0x5ae662[_0x7a87('0x5')]){logger[_0x7a87('0x6')](_0x7a87('0x7'),_0x2bcae8,_[_0x7a87('0x8')](_0x5ae662,_0x7a87('0x9'))[_0x7a87('0xa')](',\x20'));_0x55cc10[_0x7a87('0xb')]();}else{logger['info'](_0x7a87('0xc'),_0x2bcae8,_0x114b2d['priority']);if(_0x114b2d[_0x7a87('0xd')]){var _0x35e017=_[_0x7a87('0xe')](_0x55cc10[_0x7a87('0xf')](),{'p':_0x114b2d['priority']});if(_0x35e017>=0x0){logger[_0x7a87('0x10')](_0x7a87('0x11'),_0x2bcae8,_0x114b2d[_0x7a87('0xd')]||_0x7a87('0x12'),_0x35e017);_0x55cc10[_0x7a87('0x12')](_0x35e017);}else{logger[_0x7a87('0x10')](_0x7a87('0x13'),_0x2bcae8,_0x114b2d[_0x7a87('0xd')]||_0x7a87('0x12'));_0x55cc10['stop']();}}else{_0x55cc10['next']();}}}catch(_0x362482){logger[_0x7a87('0x6')]('[%s][GOTOP]\x20%s',_0x2bcae8,JSON[_0x7a87('0x14')](_0x362482));_0x55cc10[_0x7a87('0xb')]();}};}; \ 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 2e4b12e..bc3e7f3 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 _0xb77b=['create','info','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','account','InteractionId','Message'];(function(_0x3d86f1,_0x351bf9){var _0x16d215=function(_0x475605){while(--_0x475605){_0x3d86f1['push'](_0x3d86f1['shift']());}};_0x16d215(++_0x351bf9);}(_0xb77b,0x80));var _0xbb77=function(_0x3de0d9,_0x2ccb8f){_0x3de0d9=_0x3de0d9-0x0;var _0x161cd9=_0xb77b[_0x3de0d9];return _0x161cd9;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0xbb77('0x0'))(_0xbb77('0x1'));var rpc={'chatMessage':require(_0xbb77('0x2')),'openchannelMessage':require(_0xbb77('0x3')),'mailMessage':require(_0xbb77('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xbb77('0x5')),'whatsappMessage':require(_0xbb77('0x6'))};exports['consequence']=function(_0x82fb25,_0x31a612){return function(_0x10b172){try{var _0x5f2015={'body':utils[_0xbb77('0x7')](_0x31a612[0x0],this),'ContactId':this[_0xbb77('0x8')]['id']};if(this[_0xbb77('0x9')]===_0xbb77('0xa')){_0x5f2015[_0xbb77('0xb')]=this['account']['id'];}else{_0x5f2015[_[_0xbb77('0xc')](this[_0xbb77('0x9')])+'AccountId']=this[_0xbb77('0xd')]['id'];}_0x5f2015[_[_0xbb77('0xc')](this[_0xbb77('0x9')])+_0xbb77('0xe')]=this['interaction']['id'];if(rpc[this[_0xbb77('0x9')]+'Message']){return rpc[this['channel']+_0xbb77('0xf')][_0xbb77('0x10')](_0x5f2015)['then'](function(_0x109c4e){logger[_0xbb77('0x11')](_0xbb77('0x12'),_0x82fb25,_0x5f2015[_0xbb77('0x13')]);_0x10b172['next']();})[_0xbb77('0x14')](function(_0x507499){logger[_0xbb77('0x15')](_0xbb77('0x12'),_0x82fb25,JSON[_0xbb77('0x16')](_0x507499));_0x10b172['stop']();});}}catch(_0x5b1ed6){logger[_0xbb77('0x15')](_0xbb77('0x12'),_0x82fb25,JSON['stringify'](_0x5b1ed6));_0x10b172[_0xbb77('0x17')]();}};}; \ No newline at end of file +var _0x59c4=['getMustacheRender','contact','chat','ChatWebsiteId','account','upperFirst','channel','AccountId','InteractionId','Message','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence'];(function(_0x180e57,_0x393367){var _0x3392a8=function(_0x469e6d){while(--_0x469e6d){_0x180e57['push'](_0x180e57['shift']());}};_0x3392a8(++_0x393367);}(_0x59c4,0x79));var _0x459c=function(_0x55e257,_0x444609){_0x55e257=_0x55e257-0x0;var _0x23acae=_0x59c4[_0x55e257];return _0x23acae;};'use strict';var _=require(_0x459c('0x0'));var utils=require('./utils');var logger=require(_0x459c('0x1'))(_0x459c('0x2'));var rpc={'chatMessage':require(_0x459c('0x3')),'openchannelMessage':require(_0x459c('0x4')),'mailMessage':require(_0x459c('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x459c('0x6')),'whatsappMessage':require(_0x459c('0x7'))};exports[_0x459c('0x8')]=function(_0x21627c,_0x313c02){return function(_0x335f12){try{var _0x3846e1={'body':utils[_0x459c('0x9')](_0x313c02[0x0],this),'ContactId':this[_0x459c('0xa')]['id']};if(this['channel']===_0x459c('0xb')){_0x3846e1[_0x459c('0xc')]=this[_0x459c('0xd')]['id'];}else{_0x3846e1[_[_0x459c('0xe')](this[_0x459c('0xf')])+_0x459c('0x10')]=this[_0x459c('0xd')]['id'];}_0x3846e1[_[_0x459c('0xe')](this['channel'])+_0x459c('0x11')]=this['interaction']['id'];if(rpc[this[_0x459c('0xf')]+_0x459c('0x12')]){return rpc[this[_0x459c('0xf')]+_0x459c('0x12')]['create'](_0x3846e1)['then'](function(_0x4fcff2){logger[_0x459c('0x13')](_0x459c('0x14'),_0x21627c,_0x3846e1[_0x459c('0x15')]);_0x335f12[_0x459c('0x16')]();})[_0x459c('0x17')](function(_0x52cc6b){logger[_0x459c('0x18')](_0x459c('0x14'),_0x21627c,JSON[_0x459c('0x19')](_0x52cc6b));_0x335f12['stop']();});}}catch(_0x5aa10a){logger[_0x459c('0x18')](_0x459c('0x14'),_0x21627c,JSON[_0x459c('0x19')](_0x5aa10a));_0x335f12['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 652c6ce..fbfcad5 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 _0x1be6=['error','stringify','stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next'];(function(_0x5e4910,_0x4cfe8f){var _0x46761c=function(_0x1fb169){while(--_0x1fb169){_0x5e4910['push'](_0x5e4910['shift']());}};_0x46761c(++_0x4cfe8f);}(_0x1be6,0x10b));var _0x61be=function(_0x206195,_0x218840){_0x206195=_0x206195-0x0;var _0x3bdd7d=_0x1be6[_0x206195];return _0x3bdd7d;};'use strict';var utils=require(_0x61be('0x0'));var logger=require(_0x61be('0x1'))(_0x61be('0x2'));exports[_0x61be('0x3')]=function(_0x49e170,_0x220adf){return function(_0x2f4dc1){try{logger[_0x61be('0x4')](_0x61be('0x5'),_0x49e170,utils[_0x61be('0x6')](_0x220adf[0x0],this));_0x2f4dc1[_0x61be('0x7')]();}catch(_0xdb83e7){logger[_0x61be('0x8')](_0x61be('0x5'),_0x49e170,JSON[_0x61be('0x9')](_0xdb83e7));_0x2f4dc1[_0x61be('0xa')]();}};}; \ No newline at end of file +var _0x491f=['routing','consequence','info','[%s][NOOP]\x20%s','next','error','stringify','stop','../../../../config/logger'];(function(_0x5de040,_0x56fd63){var _0x19aa78=function(_0x1df910){while(--_0x1df910){_0x5de040['push'](_0x5de040['shift']());}};_0x19aa78(++_0x56fd63);}(_0x491f,0x1b8));var _0xf491=function(_0x3a831f,_0x31c8a4){_0x3a831f=_0x3a831f-0x0;var _0x26786c=_0x491f[_0x3a831f];return _0x26786c;};'use strict';var utils=require('./utils');var logger=require(_0xf491('0x0'))(_0xf491('0x1'));exports[_0xf491('0x2')]=function(_0x51078d,_0x247a18){return function(_0x548775){try{logger[_0xf491('0x3')](_0xf491('0x4'),_0x51078d,utils['getMustacheRender'](_0x247a18[0x0],this));_0x548775[_0xf491('0x5')]();}catch(_0x200356){logger[_0xf491('0x6')](_0xf491('0x4'),_0x51078d,JSON[_0xf491('0x7')](_0x200356));_0x548775[_0xf491('0x8')]();}};}; \ 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 37cbf2a..fc19905 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 _0x9043=['body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','InteractionId','interaction','MessageId','message','AccountId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','info','[%s][STOP:QUEUE][NAME:%s]','update','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','[%s][QUEUE]\x20%s','join','stop','find','Queues','createQueue','atimeout','qtimeout','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','account','from','joinAt','emit','queue_id','queue','pick','format','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting'];(function(_0x75efa,_0x29d9f6){var _0x3a3ddd=function(_0x3a2566){while(--_0x3a2566){_0x75efa['push'](_0x75efa['shift']());}};_0x3a3ddd(++_0x29d9f6);}(_0x9043,0x116));var _0x3904=function(_0x3ff415,_0x30d937){_0x3ff415=_0x3ff415-0x0;var _0x3215ec=_0x9043[_0x3ff415];return _0x3215ec;};'use strict';var schema=require(_0x3904('0x0'));var _=require(_0x3904('0x1'));var util=require(_0x3904('0x2'));var seqqueue=require(_0x3904('0x3'));var moment=require(_0x3904('0x4'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x3904('0x5'))(_0x3904('0x6'));var strategy=require(_0x3904('0x7'));config[_0x3904('0x8')]=_[_0x3904('0x9')](config[_0x3904('0x8')],{'host':_0x3904('0xa'),'port':0x18eb});var io=require(_0x3904('0xb'))(new Redis(config['redis']));var attributes=['id','queue_id',_0x3904('0xc'),'queue',_0x3904('0xd'),_0x3904('0xe')];function emit(_0x33ef04,_0x1ae3b6,_0x548672){io['to'](_0x33ef04)[_0x3904('0xf')](_0x1ae3b6,_0x548672);}function emitChannelQueueInteraction(_0x3da243,_0x4dfba9,_0x142065,_0x143ea4,_0x56c8a7,_0x93235c,_0x4ac141,_0x1c084e){var _0x4d65fc=_['clone'](_0x142065);_0x4d65fc[_0x3904('0x10')]=_0x1c084e;_0x4d65fc[_0x3904('0x11')]=_0x4dfba9;_0x4d65fc[_0x3904('0xc')]=_0x143ea4;_0x4d65fc['id']=_0x56c8a7;if(_0x93235c){_0x4ac141[util['format']('%sQueuesWaitingInteractions',_0x3da243)][_0x56c8a7]=_[_0x3904('0x12')](_0x4d65fc,attributes);}else{delete _0x4ac141[util[_0x3904('0x13')](_0x3904('0x14'),_0x3da243)][_0x56c8a7];}emit(util['format']('%s:queue:%s',_0x3da243,_0x4dfba9),util['format'](_0x3904('0x15'),_0x3da243,_0x93235c?_0x3904('0x16'):_0x3904('0x17')),_[_0x3904('0x12')](_0x4d65fc,attributes));}var rpc={'openchannelQueueReport':require(_0x3904('0x18')),'mailQueueReport':require(_0x3904('0x19')),'chatQueueReport':require(_0x3904('0x1a')),'smsQueueReport':require(_0x3904('0x1b')),'faxQueueReport':require(_0x3904('0x1c')),'whatsappQueueReport':require(_0x3904('0x1d'))};var queue=schema({'name':{'type':_0x3904('0x1e'),'required':!![],'message':_0x3904('0x1f')},'timeout':{'type':'number','message':_0x3904('0x20')}});function startRouting(_0x85c8e0,_0x3c7816,_0x4d48be,_0x1858f0){if(_0x85c8e0&&_0x3c7816&&_0x4d48be){_0x3c7816[_0x3904('0x21')]+=0x1;var _0x19b99a={'uniqueid':_0x85c8e0,'from':_0x4d48be[_0x3904('0x22')]?_0x4d48be[_0x3904('0x22')][_0x3904('0xd')]:'','joinAt':moment()[_0x3904('0x13')](_0x3904('0x23')),'ContactId':_0x4d48be[_0x3904('0x24')]?_0x4d48be[_0x3904('0x24')]['id']:null,'ListId':_0x4d48be[_0x3904('0x25')]?_0x4d48be[_0x3904('0x25')]['id']:null};_0x19b99a[_[_0x3904('0x26')](_0x4d48be[_0x3904('0x27')])+'QueueId']=_0x3c7816['id']||null;_0x19b99a[_[_0x3904('0x26')](_0x4d48be[_0x3904('0x27')])+_0x3904('0x28')]=_0x4d48be[_0x3904('0x29')]?_0x4d48be['interaction']['id']:null;_0x19b99a[_[_0x3904('0x26')](_0x4d48be[_0x3904('0x27')])+_0x3904('0x2a')]=_0x4d48be[_0x3904('0x2b')]?_0x4d48be['message']['id']:null;_0x19b99a[_[_0x3904('0x26')](_0x4d48be['channel'])+(_0x4d48be[_0x3904('0x27')]!=='chat'?_0x3904('0x2c'):'WebsiteId')]=_0x4d48be[_0x3904('0xc')]?_0x4d48be['account']['id']:null;logger['info'](util['format'](_0x3904('0x2d'),_0x85c8e0,_0x3c7816[_0x3904('0x2e')]));emitChannelQueueInteraction(_0x4d48be[_0x3904('0x27')],_0x3c7816[_0x3904('0x2e')],_0x19b99a,_0x4d48be[_0x3904('0xc')][_0x3904('0x2e')],_0x4d48be[_0x3904('0x2b')]['id'],!![],_0x1858f0,_0x3c7816['id']);if(rpc[_0x4d48be['channel']+_0x3904('0x2f')]){return rpc[_0x4d48be[_0x3904('0x27')]+_0x3904('0x2f')][_0x3904('0x30')](_0x19b99a)[_0x3904('0x31')](function(_0x59cf83){logger[_0x3904('0x32')](_0x3904('0x33'));});}}}function stopRouting(_0x52ffdf,_0x415d77,_0x3ec125,_0x534edf){if(_0x52ffdf&&_0x415d77){_0x415d77[_0x3904('0x21')]-=0x1;var _0x3a8050={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format'](_0x3904('0x23')),'reason':'accepted'};logger[_0x3904('0x34')](util[_0x3904('0x13')](_0x3904('0x35'),_0x52ffdf,_0x415d77[_0x3904('0x2e')]));emitChannelQueueInteraction(_0x3ec125[_0x3904('0x27')],_0x415d77[_0x3904('0x2e')],_0x3ec125[_0x3904('0x22')],_0x3ec125[_0x3904('0xc')][_0x3904('0x2e')],_0x3ec125[_0x3904('0x2b')]['id'],![],_0x534edf,_0x415d77['id']);if(rpc[_0x3ec125['channel']+_0x3904('0x2f')]){return rpc[_0x3ec125[_0x3904('0x27')]+_0x3904('0x2f')][_0x3904('0x36')](_0x52ffdf,_0x3a8050)['catch'](function(_0x23a6fa){logger[_0x3904('0x32')]('update\x20queue\x20report');});}}}function endRouting(_0x405671,_0x192b31,_0x47b503,_0x38b49b){if(_0x405671&&_0x192b31){_0x192b31['waiting']-=0x1;var _0x505a7f={'leaveAt':moment()[_0x3904('0x13')](_0x3904('0x23')),'exitAt':moment()['format'](_0x3904('0x23')),'reason':_0x3904('0x37')};logger['info'](util['format'](_0x3904('0x38'),_0x405671,_0x192b31[_0x3904('0x2e')]));emitChannelQueueInteraction(_0x47b503[_0x3904('0x27')],_0x192b31[_0x3904('0x2e')],_0x47b503['body'],_0x47b503[_0x3904('0xc')][_0x3904('0x2e')],_0x47b503['message']['id'],![],_0x38b49b);if(rpc[_0x47b503['channel']+_0x3904('0x2f')]){return rpc[_0x47b503[_0x3904('0x27')]+'QueueReport'][_0x3904('0x36')](_0x405671,_0x505a7f)[_0x3904('0x31')](function(_0x56c17c){logger['error'](_0x3904('0x39'));});}}}function handleFindQueue(_0x18b9d9){return function(_0x331bc0){return _0x331bc0[_0x3904('0x2e')][_0x3904('0x3a')]()===_0x18b9d9[_0x3904('0x3a')]();};}exports[_0x3904('0x3b')]=function(_0x2c227b,_0x1d5b7c,_0x2f82aa,_0x555c32){return function(_0x5b7c73){try{var _0x2ee8b8={'name':_0x1d5b7c[0x0],'timeout':_0x1d5b7c[0x1]};var _0x138ee2=queue[_0x3904('0x0')](_0x2ee8b8,{'typecast':!![]});if(_0x138ee2['length']){logger[_0x3904('0x32')](_0x3904('0x3c'),_0x2c227b,_['map'](_0x138ee2,'message')[_0x3904('0x3d')](',\x20'));_0x5b7c73[_0x3904('0x3e')]();}else{var _0x6b170e=_[_0x3904('0x3f')](_0x2f82aa[_0x555c32[_0x3904('0x27')]+_0x3904('0x40')],handleFindQueue(_0x2ee8b8['name']));if(_0x6b170e){startRouting(_0x2c227b,_0x6b170e,_0x555c32,_0x2f82aa);var _0xe145f0=(_0x6b170e['timeout']||0xa)*0x3e8;var _0xa2112c=(_0x2ee8b8[_0x3904('0x37')]||0x14)*0x3e8;var _0x65891,_0x424193;if(_0xe145f0>_0xa2112c){_0xa2112c=_0xe145f0;}var _0x3a9e8a=seqqueue[_0x3904('0x41')](_0xe145f0);_0x3a9e8a['id']=_0x2c227b;_0x3a9e8a[_0x3904('0x42')]=_0xe145f0;_0x3a9e8a[_0x3904('0x43')]=_0xa2112c;_0x3a9e8a[_0x3904('0x27')]=_0x555c32[_0x3904('0x27')];_0x2f82aa['rules'][_0x2c227b]['on']('end',function(){logger[_0x3904('0x34')](_0x3904('0x44'),_0x2c227b);stopRouting(_0x2c227b,_0x6b170e,_0x555c32,_0x2f82aa);clearTimeout(_0x65891);_0x65891=undefined;_0x3a9e8a[_0x3904('0x45')](!![]);if(_0x2f82aa[_0x3904('0x46')][_0x2c227b]){delete _0x2f82aa[_0x3904('0x46')][_0x2c227b];}_0x5b7c73[_0x3904('0x3e')]();});_0x2f82aa[_0x3904('0x46')][_0x2c227b]['on'](_0x3904('0x47'),function(){if(_0x2f82aa[_0x3904('0x46')][_0x2c227b]){delete _0x2f82aa[_0x3904('0x46')][_0x2c227b];}});_0x65891=setTimeout(function(){logger[_0x3904('0x34')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x2c227b);endRouting(_0x2c227b,_0x6b170e,_0x555c32,_0x2f82aa);clearTimeout(_0x65891);_0x3a9e8a['close'](!![]);_0x5b7c73[_0x3904('0x48')]();},_0xa2112c);switch(_0x6b170e['strategy']){case _0x3904('0x49'):strategy['rrmemory'](_0x3a9e8a,_0x6b170e,_0x2f82aa,_0x555c32);break;default:strategy[_0x3904('0x4a')](_0x3a9e8a,_0x6b170e,_0x2f82aa,_0x555c32);}}else{logger[_0x3904('0x32')](_0x3904('0x4b'),_0x2c227b,_0x2ee8b8[_0x3904('0x2e')]);_0x5b7c73[_0x3904('0x3e')]();}}}catch(_0x738c1c){console[_0x3904('0x4c')](_0x738c1c);logger[_0x3904('0x32')](_0x3904('0x3c'),_0x2c227b,_0x738c1c[_0x3904('0x4d')]);_0x5b7c73[_0x3904('0x3e')]();}};}; \ No newline at end of file +var _0xeb00=['moment','ioredis','../../../../config/environment','./strategy','redis','defaults','socket.io-emitter','queue_id','account','queue','from','joinAt','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','catch','error','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','map','stop','find','timeout','createQueue','atimeout','qtimeout','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','util','seq-queue'];(function(_0x550224,_0x4610e0){var _0x582237=function(_0x46f3a0){while(--_0x46f3a0){_0x550224['push'](_0x550224['shift']());}};_0x582237(++_0x4610e0);}(_0xeb00,0x129));var _0x0eb0=function(_0x2fecae,_0xd2e1b6){_0x2fecae=_0x2fecae-0x0;var _0x5206ea=_0xeb00[_0x2fecae];return _0x5206ea;};'use strict';var schema=require(_0x0eb0('0x0'));var _=require('lodash');var util=require(_0x0eb0('0x1'));var seqqueue=require(_0x0eb0('0x2'));var moment=require(_0x0eb0('0x3'));var Redis=require(_0x0eb0('0x4'));var config=require(_0x0eb0('0x5'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x0eb0('0x6'));config[_0x0eb0('0x7')]=_[_0x0eb0('0x8')](config[_0x0eb0('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x0eb0('0x9'))(new Redis(config[_0x0eb0('0x7')]));var attributes=['id',_0x0eb0('0xa'),_0x0eb0('0xb'),_0x0eb0('0xc'),_0x0eb0('0xd'),_0x0eb0('0xe')];function emit(_0x409f32,_0x291f69,_0x4c591b){io['to'](_0x409f32)['emit'](_0x291f69,_0x4c591b);}function emitChannelQueueInteraction(_0x30ac31,_0x2be799,_0x33d076,_0x364b9d,_0x5da58a,_0x175c33,_0x100f71,_0x30e307){var _0x5e41ff=_['clone'](_0x33d076);_0x5e41ff['queue_id']=_0x30e307;_0x5e41ff[_0x0eb0('0xc')]=_0x2be799;_0x5e41ff['account']=_0x364b9d;_0x5e41ff['id']=_0x5da58a;if(_0x175c33){_0x100f71[util['format'](_0x0eb0('0xf'),_0x30ac31)][_0x5da58a]=_[_0x0eb0('0x10')](_0x5e41ff,attributes);}else{delete _0x100f71[util['format'](_0x0eb0('0xf'),_0x30ac31)][_0x5da58a];}emit(util[_0x0eb0('0x11')](_0x0eb0('0x12'),_0x30ac31,_0x2be799),util['format']('%s_queue_waiting_interaction:%s',_0x30ac31,_0x175c33?_0x0eb0('0x13'):_0x0eb0('0x14')),_['pick'](_0x5e41ff,attributes));}var rpc={'openchannelQueueReport':require(_0x0eb0('0x15')),'mailQueueReport':require(_0x0eb0('0x16')),'chatQueueReport':require(_0x0eb0('0x17')),'smsQueueReport':require(_0x0eb0('0x18')),'faxQueueReport':require(_0x0eb0('0x19')),'whatsappQueueReport':require(_0x0eb0('0x1a'))};var queue=schema({'name':{'type':_0x0eb0('0x1b'),'required':!![],'message':_0x0eb0('0x1c')},'timeout':{'type':_0x0eb0('0x1d'),'message':_0x0eb0('0x1e')}});function startRouting(_0x347ec4,_0x26d8da,_0x199187,_0x492c39){if(_0x347ec4&&_0x26d8da&&_0x199187){_0x26d8da[_0x0eb0('0x1f')]+=0x1;var _0x147160={'uniqueid':_0x347ec4,'from':_0x199187['body']?_0x199187[_0x0eb0('0x20')][_0x0eb0('0xd')]:'','joinAt':moment()[_0x0eb0('0x11')](_0x0eb0('0x21')),'ContactId':_0x199187[_0x0eb0('0x22')]?_0x199187[_0x0eb0('0x22')]['id']:null,'ListId':_0x199187['list']?_0x199187['list']['id']:null};_0x147160[_[_0x0eb0('0x23')](_0x199187[_0x0eb0('0x24')])+_0x0eb0('0x25')]=_0x26d8da['id']||null;_0x147160[_[_0x0eb0('0x23')](_0x199187[_0x0eb0('0x24')])+_0x0eb0('0x26')]=_0x199187['interaction']?_0x199187[_0x0eb0('0x27')]['id']:null;_0x147160[_[_0x0eb0('0x23')](_0x199187[_0x0eb0('0x24')])+_0x0eb0('0x28')]=_0x199187[_0x0eb0('0x29')]?_0x199187[_0x0eb0('0x29')]['id']:null;_0x147160[_[_0x0eb0('0x23')](_0x199187['channel'])+(_0x199187[_0x0eb0('0x24')]!=='chat'?'AccountId':'WebsiteId')]=_0x199187[_0x0eb0('0xb')]?_0x199187['account']['id']:null;logger[_0x0eb0('0x2a')](util[_0x0eb0('0x11')](_0x0eb0('0x2b'),_0x347ec4,_0x26d8da['name']));emitChannelQueueInteraction(_0x199187['channel'],_0x26d8da[_0x0eb0('0x2c')],_0x147160,_0x199187[_0x0eb0('0xb')][_0x0eb0('0x2c')],_0x199187[_0x0eb0('0x29')]['id'],!![],_0x492c39,_0x26d8da['id']);if(rpc[_0x199187[_0x0eb0('0x24')]+_0x0eb0('0x2d')]){return rpc[_0x199187['channel']+_0x0eb0('0x2d')][_0x0eb0('0x2e')](_0x147160)['catch'](function(_0x184020){logger['error'](_0x0eb0('0x2f'));});}}}function stopRouting(_0xf8a85f,_0x37b95c,_0x30dc3d,_0x2eae83){if(_0xf8a85f&&_0x37b95c){_0x37b95c[_0x0eb0('0x1f')]-=0x1;var _0x382489={'leaveAt':moment()[_0x0eb0('0x11')](_0x0eb0('0x21')),'acceptAt':moment()[_0x0eb0('0x11')](_0x0eb0('0x21')),'reason':_0x0eb0('0x30')};logger[_0x0eb0('0x2a')](util[_0x0eb0('0x11')](_0x0eb0('0x31'),_0xf8a85f,_0x37b95c[_0x0eb0('0x2c')]));emitChannelQueueInteraction(_0x30dc3d[_0x0eb0('0x24')],_0x37b95c[_0x0eb0('0x2c')],_0x30dc3d[_0x0eb0('0x20')],_0x30dc3d['account'][_0x0eb0('0x2c')],_0x30dc3d[_0x0eb0('0x29')]['id'],![],_0x2eae83,_0x37b95c['id']);if(rpc[_0x30dc3d[_0x0eb0('0x24')]+'QueueReport']){return rpc[_0x30dc3d[_0x0eb0('0x24')]+_0x0eb0('0x2d')][_0x0eb0('0x32')](_0xf8a85f,_0x382489)[_0x0eb0('0x33')](function(_0xc67c22){logger[_0x0eb0('0x34')](_0x0eb0('0x35'));});}}}function endRouting(_0x1d8c2f,_0xc21225,_0x4dffe5,_0x1227a5){if(_0x1d8c2f&&_0xc21225){_0xc21225[_0x0eb0('0x1f')]-=0x1;var _0x319a43={'leaveAt':moment()['format'](_0x0eb0('0x21')),'exitAt':moment()[_0x0eb0('0x11')](_0x0eb0('0x21')),'reason':'timeout'};logger[_0x0eb0('0x2a')](util[_0x0eb0('0x11')](_0x0eb0('0x36'),_0x1d8c2f,_0xc21225[_0x0eb0('0x2c')]));emitChannelQueueInteraction(_0x4dffe5['channel'],_0xc21225['name'],_0x4dffe5[_0x0eb0('0x20')],_0x4dffe5[_0x0eb0('0xb')][_0x0eb0('0x2c')],_0x4dffe5['message']['id'],![],_0x1227a5);if(rpc[_0x4dffe5[_0x0eb0('0x24')]+_0x0eb0('0x2d')]){return rpc[_0x4dffe5[_0x0eb0('0x24')]+_0x0eb0('0x2d')][_0x0eb0('0x32')](_0x1d8c2f,_0x319a43)['catch'](function(_0x18ace7){logger[_0x0eb0('0x34')](_0x0eb0('0x35'));});}}}function handleFindQueue(_0x176d27){return function(_0x3b83ba){return _0x3b83ba['name'][_0x0eb0('0x37')]()===_0x176d27['toLowerCase']();};}exports['consequence']=function(_0x4d1e06,_0x726e58,_0x405796,_0x26799d){return function(_0x10adff){try{var _0x13235a={'name':_0x726e58[0x0],'timeout':_0x726e58[0x1]};var _0x5c6b2f=queue[_0x0eb0('0x0')](_0x13235a,{'typecast':!![]});if(_0x5c6b2f[_0x0eb0('0x38')]){logger[_0x0eb0('0x34')]('[%s][QUEUE]\x20%s',_0x4d1e06,_[_0x0eb0('0x39')](_0x5c6b2f,_0x0eb0('0x29'))['join'](',\x20'));_0x10adff[_0x0eb0('0x3a')]();}else{var _0x2908b3=_[_0x0eb0('0x3b')](_0x405796[_0x26799d['channel']+'Queues'],handleFindQueue(_0x13235a[_0x0eb0('0x2c')]));if(_0x2908b3){startRouting(_0x4d1e06,_0x2908b3,_0x26799d,_0x405796);var _0x265763=(_0x2908b3[_0x0eb0('0x3c')]||0xa)*0x3e8;var _0x54ed04=(_0x13235a[_0x0eb0('0x3c')]||0x14)*0x3e8;var _0x28964b,_0xbfa07;if(_0x265763>_0x54ed04){_0x54ed04=_0x265763;}var _0x4a0e3d=seqqueue[_0x0eb0('0x3d')](_0x265763);_0x4a0e3d['id']=_0x4d1e06;_0x4a0e3d[_0x0eb0('0x3e')]=_0x265763;_0x4a0e3d[_0x0eb0('0x3f')]=_0x54ed04;_0x4a0e3d[_0x0eb0('0x24')]=_0x26799d[_0x0eb0('0x24')];_0x405796['rules'][_0x4d1e06]['on']('end',function(){logger[_0x0eb0('0x2a')](_0x0eb0('0x40'),_0x4d1e06);stopRouting(_0x4d1e06,_0x2908b3,_0x26799d,_0x405796);clearTimeout(_0x28964b);_0x28964b=undefined;_0x4a0e3d[_0x0eb0('0x41')](!![]);if(_0x405796[_0x0eb0('0x42')][_0x4d1e06]){delete _0x405796['rules'][_0x4d1e06];}_0x10adff[_0x0eb0('0x3a')]();});_0x405796['rules'][_0x4d1e06]['on']('complete',function(){if(_0x405796[_0x0eb0('0x42')][_0x4d1e06]){delete _0x405796['rules'][_0x4d1e06];}});_0x28964b=setTimeout(function(){logger[_0x0eb0('0x2a')](_0x0eb0('0x43'),_0x4d1e06);endRouting(_0x4d1e06,_0x2908b3,_0x26799d,_0x405796);clearTimeout(_0x28964b);_0x4a0e3d[_0x0eb0('0x41')](!![]);_0x10adff[_0x0eb0('0x44')]();},_0x54ed04);switch(_0x2908b3[_0x0eb0('0x45')]){case _0x0eb0('0x46'):strategy['rrmemory'](_0x4a0e3d,_0x2908b3,_0x405796,_0x26799d);break;default:strategy[_0x0eb0('0x47')](_0x4a0e3d,_0x2908b3,_0x405796,_0x26799d);}}else{logger[_0x0eb0('0x34')](_0x0eb0('0x48'),_0x4d1e06,_0x13235a['name']);_0x10adff[_0x0eb0('0x3a')]();}}}catch(_0xb3cacf){console[_0x0eb0('0x49')](_0xb3cacf);logger['error'](_0x0eb0('0x4a'),_0x4d1e06,_0xb3cacf['stack']);_0x10adff[_0x0eb0('0x3a')]();}};}; \ 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 58c5838..2f5b0f1 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 _0xfe84=['./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','bind','timeout','handleTimeout','drained','handleDrained','prototype','push','handleRun','isNil','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','agents','channel','busy','busyQueue','RINGING',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','STOP','TIMEOUT','exports','lodash','uuid'];(function(_0x51d3ee,_0x57ccb6){var _0x145757=function(_0x21b559){while(--_0x21b559){_0x51d3ee['push'](_0x51d3ee['shift']());}};_0x145757(++_0x57ccb6);}(_0xfe84,0x106));var _0x4fe8=function(_0x3559c4,_0x47580b){_0x3559c4=_0x3559c4-0x0;var _0x124053=_0xfe84[_0x3559c4];return _0x124053;};'use strict';var _=require(_0x4fe8('0x0'));var uuid=require(_0x4fe8('0x1'));var util=require(_0x4fe8('0x2'));var logger=require(_0x4fe8('0x3'))(_0x4fe8('0x4'));var Agent=function(_0x43ab68,_0x2a0959,_0x4d3058,_0x375683){this[_0x4fe8('0x5')]=uuid['v4']();this[_0x4fe8('0x6')]=_0x43ab68;this[_0x4fe8('0x7')]=_0x2a0959;this[_0x4fe8('0x8')]=_0x4d3058;this[_0x4fe8('0x4')]=_0x375683;this[_0x4fe8('0x6')]['push'](this['handleRun'][_0x4fe8('0x9')](this),this['handleTimeout'][_0x4fe8('0x9')](this));this[_0x4fe8('0x6')]['on'](_0x4fe8('0xa'),this[_0x4fe8('0xb')][_0x4fe8('0x9')](this));this[_0x4fe8('0x6')]['on'](_0x4fe8('0xc'),this[_0x4fe8('0xd')][_0x4fe8('0x9')](this));};Agent[_0x4fe8('0xe')][_0x4fe8('0xf')]=function(){this[_0x4fe8('0x6')][_0x4fe8('0xf')](this[_0x4fe8('0x10')][_0x4fe8('0x9')](this),this[_0x4fe8('0xb')][_0x4fe8('0x9')](this));};Agent[_0x4fe8('0xe')][_0x4fe8('0xd')]=function(){this[_0x4fe8('0xb')](!![]);};Agent[_0x4fe8('0xe')][_0x4fe8('0x10')]=function(_0x4152df){logger['info']('[%s][AGENT]\x20try\x20with\x20%s',this[_0x4fe8('0x6')]['id'],this['agent']['id']);if(_[_0x4fe8('0x11')](this[_0x4fe8('0x8')]['agents'][this[_0x4fe8('0x7')]['id']])){logger[_0x4fe8('0x12')](_0x4fe8('0x13'),this[_0x4fe8('0x6')]['id'],this[_0x4fe8('0x7')]['id']);setTimeout(this[_0x4fe8('0xf')][_0x4fe8('0x9')](this),0x3e8);}else{if(this[_0x4fe8('0x4')][_0x4fe8('0x14')]||util['isAgentAvailable'](this[_0x4fe8('0x6')]['id'],this['realtime'][_0x4fe8('0x15')][this[_0x4fe8('0x7')]['id']],this[_0x4fe8('0x6')][_0x4fe8('0x16')],![])){this['realtime'][_0x4fe8('0x15')][this['agent']['id']][_0x4fe8('0x17')]=!![];this[_0x4fe8('0x8')][_0x4fe8('0x15')][this[_0x4fe8('0x7')]['id']][_0x4fe8('0x18')]=undefined;util['showNotification'](this[_0x4fe8('0x5')],this[_0x4fe8('0x6')]['id'],this[_0x4fe8('0x8')][_0x4fe8('0x15')][this[_0x4fe8('0x7')]['id']],null,this[_0x4fe8('0x4')]);util['writeLog'](this[_0x4fe8('0x6')]['id'],this[_0x4fe8('0x8')][_0x4fe8('0x15')][this[_0x4fe8('0x7')]['id']],_0x4fe8('0x19')+(this[_0x4fe8('0x4')][_0x4fe8('0x14')]?_0x4fe8('0x1a'):''));}else{logger[_0x4fe8('0x12')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0x4fe8('0x7')]['id']);setTimeout(this['push'][_0x4fe8('0x9')](this),0x3e8);}}};Agent[_0x4fe8('0xe')][_0x4fe8('0xb')]=function(_0x424419){if(_['isNil'](this['realtime'][_0x4fe8('0x15')][this['agent']['id']])){return logger[_0x4fe8('0x12')](_0x4fe8('0x13'),this['squeue']['id'],this[_0x4fe8('0x7')]['id']);}else{logger[_0x4fe8('0x12')](_0x4fe8('0x1b'),this[_0x4fe8('0x6')]['id'],this['agent']['id']);util[_0x4fe8('0x1c')](this[_0x4fe8('0x5')],this[_0x4fe8('0x6')]['id'],this[_0x4fe8('0x8')]['agents'][this[_0x4fe8('0x7')]['id']],null,this[_0x4fe8('0x4')]);this[_0x4fe8('0x8')]['agents'][this['agent']['id']][_0x4fe8('0x17')]=![];this[_0x4fe8('0x8')][_0x4fe8('0x15')][this[_0x4fe8('0x7')]['id']][_0x4fe8('0x18')]=undefined;util[_0x4fe8('0x1d')](this[_0x4fe8('0x6')]['id'],this['realtime'][_0x4fe8('0x15')][this[_0x4fe8('0x7')]['id']],_0x424419?_0x4fe8('0x1e'):_0x4fe8('0x1f'));}if(!_0x424419){setTimeout(this[_0x4fe8('0xf')][_0x4fe8('0x9')](this),0x3e8);}};function agent(_0x10200c,_0x223d98,_0x141dfd,_0x34f728){return new Agent(_0x10200c,_0x223d98,_0x141dfd,_0x34f728);}module[_0x4fe8('0x20')]=agent; \ No newline at end of file +var _0x0b18=['bind','timeout','handleTimeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','agents','channel','busy','busyQueue','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x0b18,0x199));var _0x80b1=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x0b18[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0x80b1('0x0'));var uuid=require(_0x80b1('0x1'));var util=require(_0x80b1('0x2'));var logger=require(_0x80b1('0x3'))(_0x80b1('0x4'));var Agent=function(_0x5554fd,_0x124799,_0x265538,_0x272e3a){this[_0x80b1('0x5')]=uuid['v4']();this[_0x80b1('0x6')]=_0x5554fd;this[_0x80b1('0x7')]=_0x124799;this[_0x80b1('0x8')]=_0x265538;this['routing']=_0x272e3a;this['squeue'][_0x80b1('0x9')](this[_0x80b1('0xa')][_0x80b1('0xb')](this),this['handleTimeout'][_0x80b1('0xb')](this));this[_0x80b1('0x6')]['on'](_0x80b1('0xc'),this[_0x80b1('0xd')][_0x80b1('0xb')](this));this[_0x80b1('0x6')]['on'](_0x80b1('0xe'),this[_0x80b1('0xf')][_0x80b1('0xb')](this));};Agent[_0x80b1('0x10')]['push']=function(){this[_0x80b1('0x6')]['push'](this[_0x80b1('0xa')][_0x80b1('0xb')](this),this[_0x80b1('0xd')][_0x80b1('0xb')](this));};Agent[_0x80b1('0x10')]['handleDrained']=function(){this[_0x80b1('0xd')](!![]);};Agent[_0x80b1('0x10')][_0x80b1('0xa')]=function(_0x167942){logger[_0x80b1('0x11')](_0x80b1('0x12'),this[_0x80b1('0x6')]['id'],this[_0x80b1('0x7')]['id']);if(_['isNil'](this[_0x80b1('0x8')]['agents'][this[_0x80b1('0x7')]['id']])){logger[_0x80b1('0x11')](_0x80b1('0x13'),this[_0x80b1('0x6')]['id'],this[_0x80b1('0x7')]['id']);setTimeout(this[_0x80b1('0x9')][_0x80b1('0xb')](this),0x3e8);}else{if(this[_0x80b1('0x4')][_0x80b1('0x14')]||util['isAgentAvailable'](this[_0x80b1('0x6')]['id'],this['realtime'][_0x80b1('0x15')][this[_0x80b1('0x7')]['id']],this[_0x80b1('0x6')][_0x80b1('0x16')],![])){this[_0x80b1('0x8')][_0x80b1('0x15')][this[_0x80b1('0x7')]['id']][_0x80b1('0x17')]=!![];this[_0x80b1('0x8')][_0x80b1('0x15')][this[_0x80b1('0x7')]['id']][_0x80b1('0x18')]=undefined;util[_0x80b1('0x19')](this[_0x80b1('0x5')],this[_0x80b1('0x6')]['id'],this[_0x80b1('0x8')][_0x80b1('0x15')][this[_0x80b1('0x7')]['id']],null,this[_0x80b1('0x4')]);util[_0x80b1('0x1a')](this[_0x80b1('0x6')]['id'],this[_0x80b1('0x8')][_0x80b1('0x15')][this[_0x80b1('0x7')]['id']],'RINGING'+(this['routing'][_0x80b1('0x14')]?_0x80b1('0x1b'):''));}else{logger[_0x80b1('0x11')](_0x80b1('0x1c'),this[_0x80b1('0x6')]['id'],this[_0x80b1('0x7')]['id']);setTimeout(this[_0x80b1('0x9')][_0x80b1('0xb')](this),0x3e8);}}};Agent['prototype'][_0x80b1('0xd')]=function(_0x31b485){if(_[_0x80b1('0x1d')](this[_0x80b1('0x8')][_0x80b1('0x15')][this[_0x80b1('0x7')]['id']])){return logger[_0x80b1('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x80b1('0x6')]['id'],this['agent']['id']);}else{logger[_0x80b1('0x11')](_0x80b1('0x1e'),this['squeue']['id'],this[_0x80b1('0x7')]['id']);util[_0x80b1('0x1f')](this[_0x80b1('0x5')],this[_0x80b1('0x6')]['id'],this[_0x80b1('0x8')][_0x80b1('0x15')][this[_0x80b1('0x7')]['id']],null,this[_0x80b1('0x4')]);this['realtime']['agents'][this['agent']['id']][_0x80b1('0x17')]=![];this['realtime'][_0x80b1('0x15')][this[_0x80b1('0x7')]['id']]['busyQueue']=undefined;util['writeLog'](this['squeue']['id'],this[_0x80b1('0x8')][_0x80b1('0x15')][this[_0x80b1('0x7')]['id']],_0x31b485?_0x80b1('0x20'):_0x80b1('0x21'));}if(!_0x31b485){setTimeout(this[_0x80b1('0x9')][_0x80b1('0xb')](this),0x3e8);}};function agent(_0x1f538b,_0x1b10f6,_0x180e2c,_0x49de78){return new Agent(_0x1f538b,_0x1b10f6,_0x180e2c,_0x49de78);}module[_0x80b1('0x22')]=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 ee8e238..96f8141 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 _0x8ece=['writeLog','busy','busyQueue','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','realtime','routing','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','isNil','queue','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8ece,0x195));var _0xe8ec=function(_0x2e62de,_0xf21abf){_0x2e62de=_0x2e62de-0x0;var _0xa0062e=_0x8ece[_0x2e62de];return _0xa0062e;};'use strict';var _=require(_0xe8ec('0x0'));var uuid=require(_0xe8ec('0x1'));var util=require(_0xe8ec('0x2'));var logger=require(_0xe8ec('0x3'))('routing');var Beepall=function(_0x47b1c1,_0xe18b82,_0x30c05a,_0x5047e7){this[_0xe8ec('0x4')]=uuid['v4']();this[_0xe8ec('0x5')]=_0x47b1c1;this['queue']=_0xe18b82;this[_0xe8ec('0x6')]=_0x30c05a;this[_0xe8ec('0x7')]=_0x5047e7;this[_0xe8ec('0x5')][_0xe8ec('0x8')](this[_0xe8ec('0x9')][_0xe8ec('0xa')](this),this[_0xe8ec('0xb')]['bind'](this));this[_0xe8ec('0x5')]['on']('timeout',this[_0xe8ec('0xb')]['bind'](this));this[_0xe8ec('0x5')]['on'](_0xe8ec('0xc'),this[_0xe8ec('0xd')][_0xe8ec('0xa')](this));};Beepall[_0xe8ec('0xe')][_0xe8ec('0x8')]=function(){this[_0xe8ec('0x5')][_0xe8ec('0x8')](this[_0xe8ec('0x9')][_0xe8ec('0xa')](this),this[_0xe8ec('0xb')][_0xe8ec('0xa')](this));};Beepall[_0xe8ec('0xe')]['handleDrained']=function(_0x15de29){this[_0xe8ec('0xb')](!![]);};Beepall[_0xe8ec('0xe')][_0xe8ec('0x9')]=function(_0x2921c8){var _0xdb2565=!![];if(!_[_0xe8ec('0xf')](this[_0xe8ec('0x10')])&&!_['isNil'](this[_0xe8ec('0x10')][_0xe8ec('0x11')])&&this[_0xe8ec('0x10')]['Agents'][_0xe8ec('0x12')]>0x0){for(var _0x20e847=0x0,_0x2a3b73;_0x20e8470x0){for(var _0x8c0803=0x0,_0x2b9eec;_0x8c08030x0&&_0x2a6248[_0x20dcb4+'CurrentCapacity']>=_0x2a6248[_0x20dcb4+_0xced1('0x1e')]){writeLog(_0x41ee91,_0x2a6248,_0x20dcb4[_0xced1('0x20')]()+_0xced1('0x21'));return![];}}return!![];};exports[_0xced1('0x22')]=function(_0x34dd2e,_0x8b3ffb,_0xaa36d6,_0x4e9a37,_0x15c4f4){return sendNotification(!![],_0x34dd2e,_0x8b3ffb,_0xaa36d6,_0x4e9a37,_0x15c4f4);};exports['hideNotification']=function(_0x45cb03,_0x2c2269,_0x6dc558,_0x176215,_0x5f03cc){return sendNotification(![],_0x45cb03,_0x2c2269,_0x6dc558,_0x176215,_0x5f03cc);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x583c=['BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','hideNotification','writeLog','lodash','util','../utils','mustache','../../../../../config/environment','../../../../../config/logger','defaults','redis','socket.io-emitter','emit','format','name','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]'];(function(_0x187de9,_0x5da8c8){var _0x52684c=function(_0x537450){while(--_0x537450){_0x187de9['push'](_0x187de9['shift']());}};_0x52684c(++_0x5da8c8);}(_0x583c,0x12b));var _0xc583=function(_0x552fce,_0x3f24bc){_0x552fce=_0x552fce-0x0;var _0x3e27a2=_0x583c[_0x552fce];return _0x3e27a2;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var utils=require(_0xc583('0x2'));var Mustache=require(_0xc583('0x3'));var Redis=require('ioredis');var config=require(_0xc583('0x4'));var logger=require(_0xc583('0x5'))('routing');config['redis']=_[_0xc583('0x6')](config[_0xc583('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xc583('0x8'))(new Redis(config[_0xc583('0x7')]));function emit(_0x2719df,_0x1dd37c,_0x48a8d4){io['to'](_0x2719df)[_0xc583('0x9')](_0x1dd37c,_0x48a8d4);}function sendNotification(_0x26cec0,_0x5b456e,_0x163ab2,_0x24ab4f,_0x25f8d3,_0xb23f07){io['to'](util[_0xc583('0xa')]('user:%s',_0x24ab4f[_0xc583('0xb')]))[_0xc583('0x9')]('user:save',_0x24ab4f);var _0x23c51a=_0xb23f07||{};var _0x2994c5=_0x163ab2['split']('.');var _0x2c2424={'uniqueid':_0x5b456e,'channel':_0x2994c5[0x0],'id':_0x2994c5[0x1],'title':_0x2994c5[0x0]+_0xc583('0xc'),'interactionId':_0x2994c5[0x2],'queue':_0x25f8d3?_0x25f8d3[_0xc583('0xb')]:null,'sound':_0x23c51a[_0xc583('0xd')][_0xc583('0xe')],'shake':_0x23c51a[_0xc583('0xd')][_0xc583('0xf')]};try{if(!_0x23c51a[_0xc583('0x10')]){_0x23c51a[_0xc583('0x10')]={};}if(_0x25f8d3){_0x23c51a['body'][_0xc583('0x11')]=_0x25f8d3;}else if(_0x23c51a['body'][_0xc583('0x11')]){delete _0x23c51a[_0xc583('0x10')]['queue'];}_0x2c2424[_0xc583('0x12')]=utils[_0xc583('0x13')](_0x23c51a['account'][_0xc583('0x14')],_0x23c51a);}catch(_0x4ca776){_0x2c2424['msg']=_0xc583('0x15');logger[_0xc583('0x16')](util[_0xc583('0xa')](_0xc583('0x17'),_0x5b456e,_0x4ca776['message']));}io['to'](util[_0xc583('0xa')]('user:%s',_0x24ab4f[_0xc583('0xb')]))[_0xc583('0x9')](util[_0xc583('0xa')](_0xc583('0x18'),_0x26cec0?_0xc583('0x19'):_0xc583('0x1a')),_0x2c2424);}function writeLog(_0x3ce81b,_0x26756c,_0x37fcd4){return logger[_0xc583('0x1b')](util[_0xc583('0xa')](_0xc583('0x1c'),_0x3ce81b,_0x26756c[_0xc583('0xb')],_0x37fcd4));}exports['isAgentAvailable']=function(_0x542256,_0x34b353,_0x3e075c,_0x8443dc){if(_0x34b353['busy']){writeLog(_0x542256,_0x34b353,_0xc583('0x1d'));return![];}if(!_0x34b353[_0xc583('0x1e')]){writeLog(_0x542256,_0x34b353,_0xc583('0x1f'));return![];}if(_0x34b353[_0x3e075c+_0xc583('0x20')]){writeLog(_0x542256,_0x34b353,_0xc583('0x21'));return![];}if(_0x8443dc&&_0x34b353['hasOwnProperty'](_0x3e075c+'Capacity')&&_0x34b353[_0xc583('0x22')](_0x3e075c+'CurrentCapacity')){if(_0x34b353[_0x3e075c+_0xc583('0x23')]>0x0&&_0x34b353[_0x3e075c+_0xc583('0x24')]>=_0x34b353[_0x3e075c+_0xc583('0x23')]){writeLog(_0x542256,_0x34b353,_0x3e075c[_0xc583('0x25')]()+_0xc583('0x26'));return![];}}return!![];};exports['showNotification']=function(_0x2dafb4,_0x44f76a,_0x4adde3,_0x162c85,_0x483357){return sendNotification(!![],_0x2dafb4,_0x44f76a,_0x4adde3,_0x162c85,_0x483357);};exports[_0xc583('0x27')]=function(_0x8d4ecb,_0x1c80b1,_0x3ed083,_0x1b2b49,_0x19079b){return sendNotification(![],_0x8d4ecb,_0x1c80b1,_0x3ed083,_0x1b2b49,_0x19079b);};exports[_0xc583('0x28')]=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 4e123ff..99a20c4 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 _0x837b=['./utils','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join','info','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','next','[%s][SYSTEM]\x20%s','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash'];(function(_0x4811a5,_0x48fadc){var _0x1c6a8a=function(_0x2435e2){while(--_0x2435e2){_0x4811a5['push'](_0x4811a5['shift']());}};_0x1c6a8a(++_0x48fadc);}(_0x837b,0xd5));var _0xb837=function(_0x4a12a1,_0x23f85a){_0x4a12a1=_0x4a12a1-0x0;var _0xba5e85=_0x837b[_0x4a12a1];return _0xba5e85;};'use strict';var schema=require(_0xb837('0x0'));var sh=require(_0xb837('0x1'));var _=require(_0xb837('0x2'));var utils=require(_0xb837('0x3'));var logger=require('../../../../config/logger')(_0xb837('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0xb837('0x5')}});exports[_0xb837('0x6')]=function(_0x21fd8f,_0x4dc7a3){return function(_0x1806a5){try{var _0x262028={'command':_0x4dc7a3[0x0]};var _0x5c32f4=system[_0xb837('0x0')](_0x262028,{'typecast':!![]});if(_0x5c32f4[_0xb837('0x7')]){logger[_0xb837('0x8')]('[%s][SYSTEM]\x20%s',_0x21fd8f,_[_0xb837('0x9')](_0x5c32f4,_0xb837('0xa'))[_0xb837('0xb')](',\x20'));logger[_0xb837('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x21fd8f);_0x1806a5['next']();}else{var _0x51acb8=this;var _0x196dcb=utils[_0xb837('0xd')](_0x4dc7a3[0x0],this);logger[_0xb837('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x21fd8f,_0x196dcb);sh[_0xb837('0xe')](_[_0xb837('0xf')](_0x196dcb),function(_0x598da3,_0x4520a4){logger[_0xb837('0xc')](_0xb837('0x10'),_0x21fd8f,_0x598da3);if(_0x598da3==0x0){var _0x2757e1=_0x4520a4[_0xb837('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0xb837('0x12')](_0x4dc7a3[0x1])||_[_0xb837('0x13')](_0x4dc7a3[0x1])){logger['info'](_0xb837('0x14'),_0x21fd8f);_0x51acb8[_0xb837('0x15')][_0x4dc7a3[0x1]]=_0x2757e1;}else{logger[_0xb837('0xc')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x21fd8f,_0x4dc7a3[0x1],_0x2757e1);_0x51acb8[_0xb837('0x15')][_0x4dc7a3[0x1]]=_0x2757e1;}}_0x1806a5[_0xb837('0x16')]();});}}catch(_0x30d4fc){logger['error'](_0xb837('0x17'),_0x21fd8f,_[_0xb837('0x18')](_0x30d4fc)?JSON[_0xb837('0x19')](_0x30d4fc):_0x30d4fc);logger[_0xb837('0xc')](_0xb837('0x1a'),_0x21fd8f);_0x1806a5['next']();}};}; \ No newline at end of file +var _0x56ff=['[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','[%s][SYSTEM]\x20%s','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','map','message','join','info','getMustacheRender'];(function(_0x5bbb86,_0x31386a){var _0x41f61d=function(_0x4a29d4){while(--_0x4a29d4){_0x5bbb86['push'](_0x5bbb86['shift']());}};_0x41f61d(++_0x31386a);}(_0x56ff,0xb9));var _0xf56f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x56ff[_0x321bb2];return _0x9c12ed;};'use strict';var schema=require(_0xf56f('0x0'));var sh=require(_0xf56f('0x1'));var _=require(_0xf56f('0x2'));var utils=require(_0xf56f('0x3'));var logger=require(_0xf56f('0x4'))(_0xf56f('0x5'));var system=schema({'command':{'type':_0xf56f('0x6'),'required':!![],'message':_0xf56f('0x7')}});exports[_0xf56f('0x8')]=function(_0x6bb1a5,_0x420e53){return function(_0x40a97d){try{var _0x5db3fc={'command':_0x420e53[0x0]};var _0x1b4a7d=system[_0xf56f('0x0')](_0x5db3fc,{'typecast':!![]});if(_0x1b4a7d['length']){logger[_0xf56f('0x9')]('[%s][SYSTEM]\x20%s',_0x6bb1a5,_[_0xf56f('0xa')](_0x1b4a7d,_0xf56f('0xb'))[_0xf56f('0xc')](',\x20'));logger[_0xf56f('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x6bb1a5);_0x40a97d['next']();}else{var _0x5a98d7=this;var _0x1d8531=utils[_0xf56f('0xe')](_0x420e53[0x0],this);logger[_0xf56f('0xd')](_0xf56f('0xf'),_0x6bb1a5,_0x1d8531);sh['exec'](_['trim'](_0x1d8531),function(_0x4a1e5c,_0xe01ab2){logger[_0xf56f('0xd')](_0xf56f('0x10'),_0x6bb1a5,_0x4a1e5c);if(_0x4a1e5c==0x0){var _0x223f87=_0xe01ab2[_0xf56f('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0xf56f('0x12')](_0x420e53[0x1])||_['isEmpty'](_0x420e53[0x1])){logger['info'](_0xf56f('0x13'),_0x6bb1a5);_0x5a98d7[_0xf56f('0x14')][_0x420e53[0x1]]=_0x223f87;}else{logger[_0xf56f('0xd')](_0xf56f('0x15'),_0x6bb1a5,_0x420e53[0x1],_0x223f87);_0x5a98d7[_0xf56f('0x14')][_0x420e53[0x1]]=_0x223f87;}}_0x40a97d[_0xf56f('0x16')]();});}}catch(_0x12cea5){logger[_0xf56f('0x9')](_0xf56f('0x17'),_0x6bb1a5,_['isObject'](_0x12cea5)?JSON['stringify'](_0x12cea5):_0x12cea5);logger[_0xf56f('0xd')](_0xf56f('0x18'),_0x6bb1a5);_0x40a97d[_0xf56f('0x16')]();}};}; \ 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 e6f754f..8bf8190 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 _0x58e5=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','finally','stringify','validate','lodash','../../rpc/openchannelInteraction'];(function(_0x12c280,_0x51dd07){var _0x3638d3=function(_0x53b273){while(--_0x53b273){_0x12c280['push'](_0x12c280['shift']());}};_0x3638d3(++_0x51dd07);}(_0x58e5,0x1a1));var _0x558e=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x58e5[_0x5627e1];return _0x2f013f;};'use strict';var schema=require(_0x558e('0x0'));var _=require(_0x558e('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x558e('0x2')),'smsInteraction':require(_0x558e('0x3')),'mailInteraction':require(_0x558e('0x4')),'faxInteraction':require(_0x558e('0x5')),'whatsappInteraction':require(_0x558e('0x6'))};var logger=require(_0x558e('0x7'))(_0x558e('0x8'));var tag=schema({'tag':{'type':_0x558e('0x9'),'required':!![],'message':_0x558e('0xa')}});exports[_0x558e('0xb')]=function(_0x23521d,_0x12a47c,_0x123c59,_0x218b6d){return function(_0x3979e8){try{var _0x22dcd7={'tag':_0x12a47c[0x0]};var _0x214260=tag[_0x558e('0x0')](_0x22dcd7,{'typecast':!![]});if(_0x214260[_0x558e('0xc')]){logger[_0x558e('0xd')](_0x558e('0xe'),_0x23521d,_[_0x558e('0xf')](_0x214260,_0x558e('0x10'))[_0x558e('0x11')](',\x20'));logger[_0x558e('0x12')](_0x558e('0x13'),_0x23521d);_0x3979e8[_0x558e('0x14')]();}else{var _0xe4d52e={'ids':[_0x12a47c[0x0]]};if(rpc[_0x218b6d['channel']+'Interaction']){rpc[_0x218b6d[_0x558e('0x15')]+_0x558e('0x16')][_0x558e('0x17')](_0x218b6d[_0x558e('0x18')]['id'],_0xe4d52e)[_0x558e('0x19')](function(_0x54fef1){logger[_0x558e('0x12')](_0x558e('0x1a'),_0x23521d,_0x12a47c[0x1],_0x218b6d['channel'],_0x218b6d['interaction']['id']);})[_0x558e('0x1b')](function(_0x39ec24){logger['error'](_0x558e('0xe'),_0x23521d,JSON['stringify'](_0x39ec24));logger['info'](_0x558e('0x13'),_0x23521d);})[_0x558e('0x1c')](function(){_0x3979e8[_0x558e('0x14')]();});}}}catch(_0x69d0be){logger['error'](_0x558e('0xe'),_0x23521d,_['isObject'](_0x69d0be)?JSON[_0x558e('0x1d')](_0x69d0be):_0x69d0be);logger[_0x558e('0x12')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x23521d);_0x3979e8[_0x558e('0x14')]();}};}; \ No newline at end of file +var _0x6027=['../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','consequence','length','error','[%s][TAG]\x20%s','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','next','validate','../../rpc/chatInteraction','../../rpc/smsInteraction'];(function(_0x5d2343,_0xb0d0d0){var _0x39a74d=function(_0x6b6d0d){while(--_0x6b6d0d){_0x5d2343['push'](_0x5d2343['shift']());}};_0x39a74d(++_0xb0d0d0);}(_0x6027,0x135));var _0x7602=function(_0x2d3206,_0x434cf5){_0x2d3206=_0x2d3206-0x0;var _0x18702d=_0x6027[_0x2d3206];return _0x18702d;};'use strict';var schema=require(_0x7602('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x7602('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x7602('0x2')),'mailInteraction':require(_0x7602('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x7602('0x4'))};var logger=require(_0x7602('0x5'))(_0x7602('0x6'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x7602('0x7')]=function(_0x5dfaf3,_0x1ca424,_0x2e0a20,_0xeec150){return function(_0x25c77c){try{var _0x41bcf6={'tag':_0x1ca424[0x0]};var _0x2dd5be=tag[_0x7602('0x0')](_0x41bcf6,{'typecast':!![]});if(_0x2dd5be[_0x7602('0x8')]){logger[_0x7602('0x9')](_0x7602('0xa'),_0x5dfaf3,_[_0x7602('0xb')](_0x2dd5be,_0x7602('0xc'))[_0x7602('0xd')](',\x20'));logger['info'](_0x7602('0xe'),_0x5dfaf3);_0x25c77c['next']();}else{var _0x2ec982={'ids':[_0x1ca424[0x0]]};if(rpc[_0xeec150[_0x7602('0xf')]+'Interaction']){rpc[_0xeec150['channel']+_0x7602('0x10')][_0x7602('0x11')](_0xeec150[_0x7602('0x12')]['id'],_0x2ec982)['then'](function(_0x2ea2cf){logger[_0x7602('0x13')](_0x7602('0x14'),_0x5dfaf3,_0x1ca424[0x1],_0xeec150[_0x7602('0xf')],_0xeec150['interaction']['id']);})[_0x7602('0x15')](function(_0x3a5bd0){logger[_0x7602('0x9')](_0x7602('0xa'),_0x5dfaf3,JSON[_0x7602('0x16')](_0x3a5bd0));logger[_0x7602('0x13')](_0x7602('0xe'),_0x5dfaf3);})[_0x7602('0x17')](function(){_0x25c77c['next']();});}}}catch(_0xafba64){logger['error'](_0x7602('0xa'),_0x5dfaf3,_[_0x7602('0x18')](_0xafba64)?JSON['stringify'](_0xafba64):_0xafba64);logger[_0x7602('0x13')](_0x7602('0xe'),_0x5dfaf3);_0x25c77c[_0x7602('0x19')]();}};}; \ 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 e85f94f..eed2b43 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 _0xc4b1=['urlOnRing','?params=','title','jsonrpc','2.0','method','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','channelId=','&serviceId=','&sessionId=','&data=','stop','catch','error','isObject','next','request-promise','../../../../config/logger','routing','lodash','consequence','\x20-\x20','replace','push','urlOnAnswer'];(function(_0x1730c0,_0x216404){var _0x5f47ce=function(_0x46c207){while(--_0x46c207){_0x1730c0['push'](_0x1730c0['shift']());}};_0x5f47ce(++_0x216404);}(_0xc4b1,0x197));var _0x1c4b=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xc4b1[_0x3ab9ee];return _0x82ee88;};'use strict';var rp=require(_0x1c4b('0x0'));var logger=require(_0x1c4b('0x1'))(_0x1c4b('0x2'));var _=require(_0x1c4b('0x3'));var arr=[];exports[_0x1c4b('0x4')]=function(_0x527379,_0x5d8773){return function(_0x1937d3){var _0x4367df=_0x5d8773[0xa];var _0x39172c=_0x5d8773[0xb];var _0x39cbb5=_0x5d8773[0xc];var _0x12f7ce=_0x5d8773[0xd];var _0x364cc8=_0x5d8773[0xe];var _0x5c5dc5=_0x5d8773[0xf]['replace'](/\n/g,_0x1c4b('0x5'));var _0x1db8d1=_0x5d8773[0x10][_0x1c4b('0x6')](/\n/g,'\x20');if(!arr['includes'](_0x39172c)){arr[_0x1c4b('0x7')](_0x39172c);var _0x47aed9=_0x5d8773[0x3];var _0x30171c=_0x5d8773[0x4];var _0x8673d3=_0x5d8773[0x1];var _0x80939=_0x5d8773[0x0];var _0x4aef90={};_0x4aef90[_0x1c4b('0x8')]=_0x5d8773[0x8]+'?params='+_0x39cbb5+'|'+_0x4367df+'|'+_0x12f7ce+'|'+_0x39172c+'|'+_0x364cc8;_0x4aef90[_0x1c4b('0x9')]=_0x5d8773[0x7]+_0x1c4b('0xa')+_0x39cbb5+'|'+_0x4367df+'|'+_0x12f7ce+'|'+_0x39172c+'|'+_0x364cc8+'|'+_0x5c5dc5+'|'+_0x1db8d1;_0x4aef90[_0x1c4b('0xb')]=_0x5d8773[0x9];var _0x2c6718={};_0x2c6718[_0x1c4b('0xc')]=_0x1c4b('0xd');_0x2c6718[_0x1c4b('0xe')]='login';var _0x274471=[];_0x274471['push'](_0x5d8773[0x2]);_0x274471[_0x1c4b('0x7')](_0x5d8773[0x5]);_0x274471['push'](_0x5d8773[0x6]);_0x2c6718['params']=_0x274471;_0x2c6718['id']=0x1;var _0x164ecf=JSON[_0x1c4b('0xf')](_0x2c6718);var _0x47c7eb={'encoding':_0x1c4b('0x10'),'method':_0x1c4b('0x11'),'timeout':0x2710,'url':_0x47aed9,'headers':{'Content-Type':_0x1c4b('0x12')},'body':_0x164ecf};return rp(_0x47c7eb)[_0x1c4b('0x13')](function(_0x4b3d58){const _0x3c1deb=JSON[_0x1c4b('0x14')](_0x4b3d58);if(!_0x3c1deb[_0x1c4b('0x15')][_0x1c4b('0x16')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x9aeda=_0x39172c;var _0xf0f650=_0x1c4b('0x17')+_0x8673d3+_0x1c4b('0x18')+_0x80939+_0x1c4b('0x19')+_0x9aeda+_0x1c4b('0x1a')+JSON[_0x1c4b('0xf')](_0x4aef90);var _0x2189d4=_0x30171c+'?'+_0xf0f650;return rp(_0x2189d4);})['then'](function(_0x5d5957){logger['info']('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x527379,_0x5d5957);_0x1937d3[_0x1c4b('0x1b')]();})[_0x1c4b('0x1c')](function(_0x19ebd0){logger[_0x1c4b('0x1d')]('[%s][TVOX]\x20%s',_0x527379,_[_0x1c4b('0x1e')](_0x19ebd0)?JSON[_0x1c4b('0xf')](_0x19ebd0):_0x19ebd0);_0x1937d3[_0x1c4b('0x1b')]();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x527379);_0x1937d3[_0x1c4b('0x1f')]();}};}; \ No newline at end of file +var _0xdb4c=['push','urlOnAnswer','?params=','title','jsonrpc','2.0','method','login','params','stringify','POST','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&data=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','[%s][TVOX]\x20%s','isObject','next','request-promise','../../../../config/logger','consequence','\x20-\x20','replace','includes'];(function(_0x1bb812,_0x23eacc){var _0x372adb=function(_0x5ad456){while(--_0x5ad456){_0x1bb812['push'](_0x1bb812['shift']());}};_0x372adb(++_0x23eacc);}(_0xdb4c,0x16e));var _0xcdb4=function(_0x45658a,_0x1076a0){_0x45658a=_0x45658a-0x0;var _0x54f9ed=_0xdb4c[_0x45658a];return _0x54f9ed;};'use strict';var rp=require(_0xcdb4('0x0'));var logger=require(_0xcdb4('0x1'))('routing');var _=require('lodash');var arr=[];exports[_0xcdb4('0x2')]=function(_0x1af2b0,_0x2ccfa8){return function(_0x5eb836){var _0x1f9d1c=_0x2ccfa8[0xa];var _0xd65666=_0x2ccfa8[0xb];var _0x15efb1=_0x2ccfa8[0xc];var _0x362e83=_0x2ccfa8[0xd];var _0x5a83ee=_0x2ccfa8[0xe];var _0x2ca610=_0x2ccfa8[0xf]['replace'](/\n/g,_0xcdb4('0x3'));var _0x129d9a=_0x2ccfa8[0x10][_0xcdb4('0x4')](/\n/g,'\x20');if(!arr[_0xcdb4('0x5')](_0xd65666)){arr[_0xcdb4('0x6')](_0xd65666);var _0x50c419=_0x2ccfa8[0x3];var _0x11208d=_0x2ccfa8[0x4];var _0x3bb241=_0x2ccfa8[0x1];var _0x57f07e=_0x2ccfa8[0x0];var _0x15ba66={};_0x15ba66[_0xcdb4('0x7')]=_0x2ccfa8[0x8]+_0xcdb4('0x8')+_0x15efb1+'|'+_0x1f9d1c+'|'+_0x362e83+'|'+_0xd65666+'|'+_0x5a83ee;_0x15ba66['urlOnRing']=_0x2ccfa8[0x7]+'?params='+_0x15efb1+'|'+_0x1f9d1c+'|'+_0x362e83+'|'+_0xd65666+'|'+_0x5a83ee+'|'+_0x2ca610+'|'+_0x129d9a;_0x15ba66[_0xcdb4('0x9')]=_0x2ccfa8[0x9];var _0x57abcc={};_0x57abcc[_0xcdb4('0xa')]=_0xcdb4('0xb');_0x57abcc[_0xcdb4('0xc')]=_0xcdb4('0xd');var _0x3130d2=[];_0x3130d2['push'](_0x2ccfa8[0x2]);_0x3130d2[_0xcdb4('0x6')](_0x2ccfa8[0x5]);_0x3130d2[_0xcdb4('0x6')](_0x2ccfa8[0x6]);_0x57abcc[_0xcdb4('0xe')]=_0x3130d2;_0x57abcc['id']=0x1;var _0x246202=JSON[_0xcdb4('0xf')](_0x57abcc);var _0x57551c={'encoding':'utf8','method':_0xcdb4('0x10'),'timeout':0x2710,'url':_0x50c419,'headers':{'Content-Type':'application/json-rpc'},'body':_0x246202};return rp(_0x57551c)['then'](function(_0x53aa7d){const _0x331920=JSON[_0xcdb4('0x11')](_0x53aa7d);if(!_0x331920[_0xcdb4('0x12')][_0xcdb4('0x13')]){throw new Error(_0xcdb4('0x14'));}var _0x11496e=_0xd65666;var _0x5133e3=_0xcdb4('0x15')+_0x3bb241+'&serviceId='+_0x57f07e+'&sessionId='+_0x11496e+_0xcdb4('0x16')+JSON['stringify'](_0x15ba66);var _0x4c48d9=_0x11208d+'?'+_0x5133e3;return rp(_0x4c48d9);})[_0xcdb4('0x17')](function(_0x2fa4b3){logger[_0xcdb4('0x18')](_0xcdb4('0x19'),_0x1af2b0,_0x2fa4b3);_0x5eb836[_0xcdb4('0x1a')]();})['catch'](function(_0x28b63c){logger[_0xcdb4('0x1b')](_0xcdb4('0x1c'),_0x1af2b0,_[_0xcdb4('0x1d')](_0x28b63c)?JSON[_0xcdb4('0xf')](_0x28b63c):_0x28b63c);_0x5eb836[_0xcdb4('0x1a')]();});}else{logger[_0xcdb4('0x18')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x1af2b0);_0x5eb836[_0xcdb4('0x1e')]();}};}; \ 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 c3c9e71..5a01cdc 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 _0x9c44=['merge','body','account','list','exports','render'];(function(_0x38b20d,_0x2c6b58){var _0x3da1a3=function(_0x1609c6){while(--_0x1609c6){_0x38b20d['push'](_0x38b20d['shift']());}};_0x3da1a3(++_0x2c6b58);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x322f58,_0x2d0e74){var _0x273bd3=function(_0x19d1e8){while(--_0x19d1e8){_0x322f58['push'](_0x322f58['shift']());}};_0x273bd3(++_0x2d0e74);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index d6160ef..6268a7e 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 _0x235a=['../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','interaction','applications','length','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','message','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','stack','routing\x20is\x20empty','agent','agents','end','QueueReport','update','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','name','mailQueues','loggedIn','paused','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport'];(function(_0x355707,_0x336e70){var _0x28c0e2=function(_0x407025){while(--_0x407025){_0x355707['push'](_0x355707['shift']());}};_0x28c0e2(++_0x336e70);}(_0x235a,0x1ef));var _0xa235=function(_0x54a0f5,_0x4289ba){_0x54a0f5=_0x54a0f5-0x0;var _0x4346dc=_0x235a[_0x54a0f5];return _0x4346dc;};'use strict';var _=require(_0xa235('0x0'));var util=require(_0xa235('0x1'));var path=require(_0xa235('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xa235('0x3'));var uuid=require('uuid');var utils=require(_0xa235('0x4'));var config=require(_0xa235('0x5'));var logger=require(_0xa235('0x6'))(_0xa235('0x7'));var rpc={'openchannelQueueReport':require(_0xa235('0x8')),'mailQueueReport':require(_0xa235('0x9')),'chatQueueReport':require(_0xa235('0xa')),'smsQueueReport':require(_0xa235('0xb')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xa235('0xc'))};var RuleEngine=require(_0xa235('0xd'));function getId(_0x450e27,_0x2f3403,_0x5c60d9){return util[_0xa235('0xe')]('%s.%s.%s',_0x450e27,_0x2f3403||0x0,_0x5c60d9||0x0);}function getIntervals(_0x560eb1,_0x10bb4f){var _0x504b60=[];if(!_[_0xa235('0xf')](_0x10bb4f['IntervalId'])&&!_['isNil'](_0x560eb1[_0x10bb4f['IntervalId']])&&!_[_0xa235('0xf')](_0x560eb1[_0x10bb4f[_0xa235('0x10')]][_0xa235('0x11')])){_0x504b60=_[_0xa235('0x12')](_0x560eb1[_0x10bb4f['IntervalId']]['Intervals'],'interval');}else if(!_[_0xa235('0xf')](_0x10bb4f[_0xa235('0x13')])){_0x504b60=[_0x10bb4f[_0xa235('0x13')]];}return _0x504b60;}exports[_0xa235('0x14')]=function(_0x36b4b1){_0x36b4b1[_0xa235('0x15')]={};return new BPromise(function(_0x2eb1ff,_0x1e03a8){var _0x1369de={'Start':function(_0x4aceee){var _0x352463=this;return new Promise(function(_0x20cd67,_0x26fd63){if(_0x4aceee){try{var _0x128244=[];var _0x16dbe9=getId(_0x4aceee[_0xa235('0x16')],_0x4aceee['message']?_0x4aceee['message']['id']:0x0,_0x4aceee[_0xa235('0x17')]?_0x4aceee[_0xa235('0x17')]['id']:0x0);if(_0x4aceee[_0xa235('0x18')]&&_['isArray'](_0x4aceee[_0xa235('0x18')])&&_0x4aceee[_0xa235('0x18')][_0xa235('0x19')]){for(var _0x3b115=0x0;_0x3b115<_0x4aceee[_0xa235('0x18')][_0xa235('0x19')];_0x3b115+=0x1){var _0x37faca=_0x4aceee['applications'][_0x3b115];if(fs['existsSync'](path[_0xa235('0x1a')](__dirname,_0xa235('0x18'),_0x37faca[_0xa235('0x1b')]+_0xa235('0x1c')))){var _0x2e38e=[];switch(_0x37faca[_0xa235('0x1b')][_0xa235('0x1d')]()){case _0xa235('0x1e'):var _0x42e367=_0x37faca[_0xa235('0x1f')][_0xa235('0x20')](',');if(_0x4aceee[_0xa235('0x16')]===_0xa235('0x21')){_0x2e38e[_0xa235('0x22')](_0x42e367[0x0]);_0x2e38e[_0xa235('0x22')](_0x42e367[0x1]);_0x2e38e[_0xa235('0x22')](_0x42e367[_0xa235('0x23')](0x2,_0x42e367[_0xa235('0x19')])[_0xa235('0x1a')](','));}else{_0x2e38e[_0xa235('0x22')](_0x42e367[0x0]);_0x2e38e[_0xa235('0x22')](_0x42e367['slice'](0x1,_0x42e367[_0xa235('0x19')])['join'](','));}break;case _0xa235('0x24'):var _0x53ec70=_0x37faca[_0xa235('0x1f')][_0xa235('0x20')](',');_0x2e38e[_0xa235('0x22')](_0x53ec70[0x0]);_0x2e38e[_0xa235('0x22')](_0x53ec70[0x1]);_0x2e38e[_0xa235('0x22')](_0x53ec70['slice'](0x2,_0x53ec70[_0xa235('0x19')])[_0xa235('0x1a')](','));break;case'dialogflowv2':var _0x4b33ef=_0x37faca['appdata']['split'](',');_0x2e38e[_0xa235('0x22')](_0x4b33ef[0x0]);_0x2e38e[_0xa235('0x22')](_0x4b33ef[0x1]);_0x2e38e[_0xa235('0x22')](_0x4b33ef[0x2]);_0x2e38e[_0xa235('0x22')](_0x4b33ef[0x3]);_0x2e38e[_0xa235('0x22')](_0x4b33ef[_0xa235('0x23')](0x4,_0x4b33ef[_0xa235('0x19')])['join'](','));break;case'amazonlex':var _0x2832be=_0x37faca[_0xa235('0x1f')]['split'](',');_0x2e38e[_0xa235('0x22')](_0x2832be[0x0]);_0x2e38e[_0xa235('0x22')](_0x2832be[0x1]);_0x2e38e[_0xa235('0x22')](_0x2832be[0x2]);_0x2e38e[_0xa235('0x22')](_0x2832be[0x3]);_0x2e38e[_0xa235('0x22')](_0x2832be[_0xa235('0x23')](0x4,_0x2832be[_0xa235('0x19')])[_0xa235('0x1a')](','));break;case'message':_0x2e38e[_0xa235('0x22')](_0x37faca['appdata']);break;case _0xa235('0x25'):_0x2e38e[_0xa235('0x22')](_0x37faca[_0xa235('0x26')]);_0x2e38e[_0xa235('0x22')](_0x37faca[_0xa235('0x1f')]);break;case _0xa235('0x27'):var _0x43752f=utils[_0xa235('0x28')](_0x4aceee[_0xa235('0x29')][_0xa235('0x2a')],_0x4aceee);var _0x291fb3=_0x37faca[_0xa235('0x1f')][_0xa235('0x20')](',');_0x2e38e['push'](_0x291fb3[0x0]);_0x2e38e['push'](_0x291fb3[0x1]);_0x2e38e['push'](_0x291fb3[0x2]);_0x2e38e[_0xa235('0x22')](_0x291fb3[0x3]);_0x2e38e['push'](_0x291fb3[0x4]);_0x2e38e[_0xa235('0x22')](_0x291fb3[0x5]);_0x2e38e[_0xa235('0x22')](_0x291fb3[0x6]);_0x2e38e[_0xa235('0x22')](_0x291fb3[0x7]);_0x2e38e[_0xa235('0x22')](_0x291fb3[0x8]);_0x2e38e[_0xa235('0x22')](_0x291fb3[0x9]);_0x2e38e[_0xa235('0x22')](_0x291fb3[0xa]);_0x2e38e[_0xa235('0x22')](_0x4aceee['interaction']['id']);_0x2e38e[_0xa235('0x22')](_0x4aceee[_0xa235('0x2b')]['id']);_0x2e38e['push'](_0x37faca[_0xa235('0x2c')]);_0x2e38e[_0xa235('0x22')](_0x4aceee[_0xa235('0x17')][_0xa235('0x2d')]);_0x2e38e[_0xa235('0x22')](_0x4aceee[_0xa235('0x2e')][_0xa235('0x2e')]);_0x2e38e[_0xa235('0x22')](_0x43752f);break;default:_0x2e38e=_[_0xa235('0xf')](_0x37faca['appdata'])?[]:_0x37faca[_0xa235('0x1f')][_0xa235('0x20')](',');}var _0xd2a85e={'id':util[_0xa235('0xe')](_0xa235('0x2f'),_0x16dbe9,_0x37faca['id'],_0x37faca['app']),'condition':require(_0xa235('0x30'))[_0xa235('0x31')](_0x16dbe9,getIntervals(_0x36b4b1[_0xa235('0x32')],_0x37faca),_0x36b4b1),'consequence':require(_0xa235('0x33')+_0x37faca['app'])[_0xa235('0x34')](_0x16dbe9,_0x2e38e,_0x36b4b1,_0x4aceee),'p':_0x37faca[_0xa235('0x35')]||0x0};logger[_0xa235('0x36')](_0xa235('0x37'),_0xd2a85e['id'],_0xa235('0x38'),getIntervals(_0x36b4b1[_0xa235('0x32')],_0x37faca)[_0xa235('0x1a')]('\x20|\x20'));_0x128244[_0xa235('0x22')](_0xd2a85e);}else{logger[_0xa235('0x39')](_0xa235('0x3a'),path[_0xa235('0x1a')](__dirname,_0xa235('0x18'),_0x37faca['app']+_0xa235('0x1c')));}}_0x36b4b1[_0xa235('0x15')][_0x16dbe9]=new RuleEngine(_0x128244);_0x36b4b1[_0xa235('0x15')][_0x16dbe9][_0xa235('0x3b')](_0x4aceee,function(_0x2de91a){logger['info'](_0xa235('0x3c'),JSON[_0xa235('0x3d')](_0x2de91a[_0xa235('0x3e')]));if(_0x36b4b1[_0xa235('0x15')][_0x16dbe9]){_0x36b4b1[_0xa235('0x15')][_0x16dbe9][_0xa235('0x3f')](_0xa235('0x40'));}});return _0x20cd67({'code':0xc8,'message':_0x4aceee});}else{logger[_0xa235('0x36')]('No\x20applications\x20to\x20execute');return _0x20cd67({'code':0xc8,'message':_0x4aceee});}}catch(_0x1837b3){logger[_0xa235('0x39')](_0x1837b3[_0xa235('0x41')]);return _0x26fd63(_0x352463[_0xa235('0x39')](0x1f4,_0x1837b3));}}return _0x26fd63(_0xa235('0x42'));});},'AcceptMessage':function(_0x461fa3){var _0x248692=this;return new Promise(function(_0x2ec301,_0xec860f){if(_0x461fa3['agent']&&_0x461fa3[_0xa235('0x43')]['id']){if(_0x36b4b1[_0xa235('0x44')][_0x461fa3[_0xa235('0x43')]['id']]){_0x36b4b1[_0xa235('0x44')][_0x461fa3[_0xa235('0x43')]['id']]['busy']=![];_0x36b4b1[_0xa235('0x44')][_0x461fa3[_0xa235('0x43')]['id']]['busyQueue']=undefined;}}if(_0x461fa3[_0xa235('0x2b')]&&_0x461fa3[_0xa235('0x2b')]['id']){try{var _0x2ba694=getId(_0x461fa3[_0xa235('0x16')],_0x461fa3['message']?_0x461fa3[_0xa235('0x2b')]['id']:0x0,_0x461fa3['interaction']?_0x461fa3[_0xa235('0x17')]['id']:0x0);if(_0x36b4b1[_0xa235('0x15')][_0x2ba694]){_0x36b4b1['rules'][_0x2ba694][_0xa235('0x3f')](_0xa235('0x45'));if(rpc[_0x461fa3[_0xa235('0x16')]+_0xa235('0x46')]){rpc[_0x461fa3[_0xa235('0x16')]+_0xa235('0x46')][_0xa235('0x47')](_0x2ba694,{'UserId':_0x461fa3[_0xa235('0x2b')]['UserId']})['catch'](function(_0x508473){logger[_0xa235('0x39')](_0xa235('0x48'));});}}return _0x2ec301({'code':0xc8,'message':_0x461fa3});}catch(_0x476401){logger[_0xa235('0x39')](_0x476401['stack']);return _0xec860f(_0x248692[_0xa235('0x39')](0x1f4,_0x476401));}}logger['error'](_0xa235('0x49'));return _0xec860f(_0x248692[_0xa235('0x39')](0x1f4,_0xa235('0x49')));});},'RejectMessage':function(_0x1c9f2b){var _0x54edb0=this;return new Promise(function(_0x5041f5,_0x51144e){if(_0x1c9f2b[_0xa235('0x43')]&&_0x1c9f2b[_0xa235('0x43')]['id']){try{if(_0x36b4b1['agents'][_0x1c9f2b[_0xa235('0x43')]['id']]){_0x36b4b1[_0xa235('0x44')][_0x1c9f2b[_0xa235('0x43')]['id']][_0xa235('0x4a')]=![];_0x36b4b1['agents'][_0x1c9f2b['agent']['id']]['busyQueue']=undefined;}return _0x5041f5({'code':0xc8,'message':_0x1c9f2b});}catch(_0x386ba7){logger[_0xa235('0x39')](_0x386ba7['stack']);return _0x51144e(_0x54edb0['error'](0x1f4,_0x386ba7));}}logger[_0xa235('0x39')]('message\x20is\x20empty');return _0x51144e(_0x54edb0['error'](0x1f4,_0xa235('0x49')));});},'AbandonInteraction':function(_0x16b035){var _0x873161=this;return new Promise(function(_0x2b7e0e,_0x50bfa4){if(_0x16b035[_0xa235('0x16')]&&_0x16b035[_0xa235('0x17')]&&_0x16b035[_0xa235('0x17')]['id']){try{var _0x2e1667=getId(_0x16b035[_0xa235('0x16')],_0x16b035[_0xa235('0x2b')]?_0x16b035[_0xa235('0x2b')]['id']:0x0,_0x16b035[_0xa235('0x17')]?_0x16b035[_0xa235('0x17')]['id']:0x0);if(_0x36b4b1[_0xa235('0x15')][_0x2e1667]){_0x36b4b1['rules'][_0x2e1667][_0xa235('0x3f')](_0xa235('0x45'));}return _0x2b7e0e({'code':0xc8,'message':_0x16b035});}catch(_0x9604a5){logger[_0xa235('0x39')](_0x9604a5[_0xa235('0x41')]);return _0x50bfa4(_0x873161['error'](0x1f4,_0x9604a5));}}logger[_0xa235('0x39')](_0xa235('0x49'));return _0x50bfa4(_0x873161['error'](0x1f4,_0xa235('0x49')));});},'AgentCapacity':function(_0xe80ed0){var _0x479861=this;return new Promise(function(_0x4e05fa,_0x5c6dd2){if(_0x36b4b1[_0xa235('0x44')][_0xa235('0x4b')](_0xe80ed0['id'])){for(var _0x55392a in _0xe80ed0[_0xa235('0x4c')]){if(_0xe80ed0['capacity']['hasOwnProperty'](_0x55392a)){if(_0x36b4b1[_0xa235('0x44')][_0xe80ed0['id']]['hasOwnProperty'](_0x55392a+_0xa235('0x4d'))){_0x36b4b1[_0xa235('0x44')][_0xe80ed0['id']][_0x55392a+_0xa235('0x4d')]=parseInt(_0xe80ed0[_0xa235('0x4c')][_0x55392a],0xa);}}}_0x36b4b1[_0xa235('0x44')][_0xe80ed0['id']][_0xa235('0x4e')]();return _0x4e05fa({'code':0xc8,'message':_0x36b4b1[_0xa235('0x44')][_0xe80ed0['id']]});}else{return _0x5c6dd2(_0x479861[_0xa235('0x39')](0x1f4,_0xa235('0x4f')));}});},'Agents':function(_0xa7749a){return new Promise(function(_0x1b19f2,_0x17cb61){var _0x972dba=_[_0xa235('0x50')](_0x36b4b1[_0xa235('0x44')]);_0x1b19f2({'count':_0x972dba[_0xa235('0x19')],'rows':_0x972dba});});},'ChatQueues':function(_0x4576c8){return new Promise(function(_0x5dbc35,_0xbd740e){var _0xe9cc76=[];for(var _0x8ead7 in _0x36b4b1['chatQueues']){if(_0x36b4b1['chatQueues'][_0xa235('0x4b')](_0x8ead7)){var _0x1851db=_0x36b4b1[_0xa235('0x51')][_0x8ead7];var _0x5798e9={'id':_0x1851db['id'],'available':_0x1851db[_0xa235('0x52')],'loggedIn':_0x1851db['loggedIn'],'name':_0x1851db[_0xa235('0x53')],'paused':_0x1851db['paused'],'waiting':_0x1851db['waiting']};_0xe9cc76[_0xa235('0x22')](_0x5798e9);}}_0x5dbc35({'count':_0xe9cc76['length'],'rows':_0xe9cc76});});},'MailQueues':function(_0x52298e){return new Promise(function(_0x53cbbb,_0x532353){var _0x582e39=[];for(var _0x30003c in _0x36b4b1[_0xa235('0x54')]){if(_0x36b4b1[_0xa235('0x54')]['hasOwnProperty'](_0x30003c)){var _0x3adc13=_0x36b4b1[_0xa235('0x54')][_0x30003c];var _0x2ad01a={'id':_0x3adc13['id'],'available':_0x3adc13[_0xa235('0x52')],'loggedIn':_0x3adc13[_0xa235('0x55')],'name':_0x3adc13['name'],'paused':_0x3adc13[_0xa235('0x56')],'waiting':_0x3adc13[_0xa235('0x57')]};_0x582e39[_0xa235('0x22')](_0x2ad01a);}}_0x53cbbb({'count':_0x582e39[_0xa235('0x19')],'rows':_0x582e39});});},'OpenchannelQueues':function(_0x33146a){return new Promise(function(_0x1f3988,_0x6f1489){var _0x488dd0=[];for(var _0x5bde03 in _0x36b4b1[_0xa235('0x58')]){if(_0x36b4b1[_0xa235('0x58')][_0xa235('0x4b')](_0x5bde03)){var _0x51ee05=_0x36b4b1[_0xa235('0x58')][_0x5bde03];var _0x582d4d={'id':_0x51ee05['id'],'available':_0x51ee05[_0xa235('0x52')],'loggedIn':_0x51ee05[_0xa235('0x55')],'name':_0x51ee05['name'],'paused':_0x51ee05[_0xa235('0x56')],'waiting':_0x51ee05[_0xa235('0x57')]};_0x488dd0[_0xa235('0x22')](_0x582d4d);}}_0x1f3988({'count':_0x488dd0[_0xa235('0x19')],'rows':_0x488dd0});});},'SmsQueues':function(_0x2043ae){return new Promise(function(_0x3bf214,_0x4f1576){var _0x154f45=[];for(var _0x35b07b in _0x36b4b1[_0xa235('0x59')]){if(_0x36b4b1[_0xa235('0x59')][_0xa235('0x4b')](_0x35b07b)){var _0x541d3e=_0x36b4b1[_0xa235('0x59')][_0x35b07b];var _0x25ee35={'id':_0x541d3e['id'],'available':_0x541d3e[_0xa235('0x52')],'loggedIn':_0x541d3e[_0xa235('0x55')],'name':_0x541d3e[_0xa235('0x53')],'paused':_0x541d3e['paused'],'waiting':_0x541d3e[_0xa235('0x57')]};_0x154f45[_0xa235('0x22')](_0x25ee35);}}_0x3bf214({'count':_0x154f45[_0xa235('0x19')],'rows':_0x154f45});});},'FaxQueues':function(_0x11df6f){return new Promise(function(_0x3620bb,_0xcd7efd){var _0x5dc85e=[];for(var _0x1af3bc in _0x36b4b1[_0xa235('0x5a')]){if(_0x36b4b1['faxQueues'][_0xa235('0x4b')](_0x1af3bc)){var _0x4f3b5b=_0x36b4b1[_0xa235('0x5a')][_0x1af3bc];var _0x33ad4b={'id':_0x4f3b5b['id'],'available':_0x4f3b5b['available'],'loggedIn':_0x4f3b5b[_0xa235('0x55')],'name':_0x4f3b5b['name'],'paused':_0x4f3b5b['paused'],'waiting':_0x4f3b5b[_0xa235('0x57')]};_0x5dc85e[_0xa235('0x22')](_0x33ad4b);}}_0x3620bb({'count':_0x5dc85e[_0xa235('0x19')],'rows':_0x5dc85e});});},'WhatsappQueues':function(_0xec784d){return new Promise(function(_0x14046f,_0x2b7725){var _0x371176=[];for(var _0x295664 in _0x36b4b1[_0xa235('0x5b')]){if(_0x36b4b1['whatsappQueues'][_0xa235('0x4b')](_0x295664)){var _0x541251=_0x36b4b1[_0xa235('0x5b')][_0x295664];var _0x38b8b8={'id':_0x541251['id'],'available':_0x541251[_0xa235('0x52')],'loggedIn':_0x541251['loggedIn'],'name':_0x541251[_0xa235('0x53')],'paused':_0x541251[_0xa235('0x56')],'waiting':_0x541251[_0xa235('0x57')]};_0x371176[_0xa235('0x22')](_0x38b8b8);}}_0x14046f({'count':_0x371176['length'],'rows':_0x371176});});},'ChatQueuesWaitingInteractions':function(_0x490da0){return new Promise(function(_0x384358,_0x5d2960){var _0x1fd843=_[_0xa235('0x50')](_0x36b4b1[_0xa235('0x5c')]);_0x384358({'count':_0x1fd843['length'],'rows':_0x1fd843});});},'MailQueuesWaitingInteractions':function(_0x4243fd){return new Promise(function(_0x36902d,_0xc862f3){var _0x2c67a4=_[_0xa235('0x50')](_0x36b4b1[_0xa235('0x5d')]);_0x36902d({'count':_0x2c67a4['length'],'rows':_0x2c67a4});});},'OpenchannelQueuesWaitingInteractions':function(_0x3dcc89){return new Promise(function(_0x1e91fe,_0x23917c){var _0x24e95a=_[_0xa235('0x50')](_0x36b4b1[_0xa235('0x5e')]);_0x1e91fe({'count':_0x24e95a[_0xa235('0x19')],'rows':_0x24e95a});});},'SmsQueuesWaitingInteractions':function(_0x14a129){return new Promise(function(_0x510ca7,_0x4ccffe){var _0x39a2b7=_[_0xa235('0x50')](_0x36b4b1[_0xa235('0x5f')]);_0x510ca7({'count':_0x39a2b7[_0xa235('0x19')],'rows':_0x39a2b7});});},'FaxQueuesWaitingInteractions':function(_0x4cecb9){return new Promise(function(_0x462398,_0x25c836){var _0x353b14=_[_0xa235('0x50')](_0x36b4b1['faxQueuesWaitingInteractions']);_0x462398({'count':_0x353b14[_0xa235('0x19')],'rows':_0x353b14});});},'WhatsappQueuesWaitingInteractions':function(_0x307048){return new Promise(function(_0x1a007f,_0x165f3e){var _0x4f759c=_[_0xa235('0x50')](_0x36b4b1[_0xa235('0x60')]);_0x1a007f({'count':_0x4f759c[_0xa235('0x19')],'rows':_0x4f759c});});}};var _0x2ed830=jayson['server'](_0x1369de)[_0xa235('0x61')]();_0x2ed830['on']('error',function(_0x31053e){logger[_0xa235('0x39')](JSON[_0xa235('0x3d')](_0x31053e));return _0x1e03a8(_0x31053e);});_0x2ed830[_0xa235('0x14')](0x232c,_0xa235('0x62'),function(){console['log'](_0xa235('0x63'),0x232c);return _0x2eb1ff(_0xa235('0x64')+0x232c);});});}; \ No newline at end of file +var _0x5d70=['complete','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','agent','agents','busy','busyQueue','emit','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','mailQueues','openchannelQueues','waiting','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','lodash','util','jayson/promise','bluebird','uuid','./applications/utils','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','interaction','applications','isArray','length','join','.js','app','toLowerCase','autoreply','appdata','split','channel','mail','push','slice','dialogflow','dialogflowv2','message','tvox','getMustacheRender','account','ChatWebsiteId','format','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','stringify'];(function(_0x137f9,_0x6cb698){var _0x27f894=function(_0x3e142c){while(--_0x3e142c){_0x137f9['push'](_0x137f9['shift']());}};_0x27f894(++_0x6cb698);}(_0x5d70,0x8d));var _0x05d7=function(_0x28e537,_0x1d36fa){_0x28e537=_0x28e537-0x0;var _0x3c47f8=_0x5d70[_0x28e537];return _0x3c47f8;};'use strict';var _=require(_0x05d7('0x0'));var util=require(_0x05d7('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x05d7('0x2'));var BPromise=require(_0x05d7('0x3'));var uuid=require(_0x05d7('0x4'));var utils=require(_0x05d7('0x5'));var config=require(_0x05d7('0x6'));var logger=require(_0x05d7('0x7'))('routing');var rpc={'openchannelQueueReport':require(_0x05d7('0x8')),'mailQueueReport':require(_0x05d7('0x9')),'chatQueueReport':require(_0x05d7('0xa')),'smsQueueReport':require(_0x05d7('0xb')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x05d7('0xc'));function getId(_0x29a5e0,_0x147340,_0x50d2b6){return util['format'](_0x05d7('0xd'),_0x29a5e0,_0x147340||0x0,_0x50d2b6||0x0);}function getIntervals(_0x40a1f6,_0x2d3d67){var _0x2ae2ea=[];if(!_[_0x05d7('0xe')](_0x2d3d67[_0x05d7('0xf')])&&!_[_0x05d7('0xe')](_0x40a1f6[_0x2d3d67[_0x05d7('0xf')]])&&!_[_0x05d7('0xe')](_0x40a1f6[_0x2d3d67[_0x05d7('0xf')]][_0x05d7('0x10')])){_0x2ae2ea=_[_0x05d7('0x11')](_0x40a1f6[_0x2d3d67[_0x05d7('0xf')]][_0x05d7('0x10')],_0x05d7('0x12'));}else if(!_[_0x05d7('0xe')](_0x2d3d67[_0x05d7('0x12')])){_0x2ae2ea=[_0x2d3d67[_0x05d7('0x12')]];}return _0x2ae2ea;}exports[_0x05d7('0x13')]=function(_0x34cd5b){_0x34cd5b[_0x05d7('0x14')]={};return new BPromise(function(_0x14bf0b,_0x2dafd7){var _0x586306={'Start':function(_0x38b3c7){var _0x5ba163=this;return new Promise(function(_0x42c95f,_0x252ab3){if(_0x38b3c7){try{var _0x51d854=[];var _0x559545=getId(_0x38b3c7['channel'],_0x38b3c7['message']?_0x38b3c7['message']['id']:0x0,_0x38b3c7[_0x05d7('0x15')]?_0x38b3c7[_0x05d7('0x15')]['id']:0x0);if(_0x38b3c7[_0x05d7('0x16')]&&_[_0x05d7('0x17')](_0x38b3c7[_0x05d7('0x16')])&&_0x38b3c7[_0x05d7('0x16')][_0x05d7('0x18')]){for(var _0x24e4df=0x0;_0x24e4df<_0x38b3c7[_0x05d7('0x16')][_0x05d7('0x18')];_0x24e4df+=0x1){var _0x2cd1bb=_0x38b3c7[_0x05d7('0x16')][_0x24e4df];if(fs['existsSync'](path[_0x05d7('0x19')](__dirname,'applications',_0x2cd1bb['app']+_0x05d7('0x1a')))){var _0x356fe7=[];switch(_0x2cd1bb[_0x05d7('0x1b')][_0x05d7('0x1c')]()){case _0x05d7('0x1d'):var _0x7266ed=_0x2cd1bb[_0x05d7('0x1e')][_0x05d7('0x1f')](',');if(_0x38b3c7[_0x05d7('0x20')]===_0x05d7('0x21')){_0x356fe7[_0x05d7('0x22')](_0x7266ed[0x0]);_0x356fe7[_0x05d7('0x22')](_0x7266ed[0x1]);_0x356fe7[_0x05d7('0x22')](_0x7266ed[_0x05d7('0x23')](0x2,_0x7266ed[_0x05d7('0x18')])[_0x05d7('0x19')](','));}else{_0x356fe7['push'](_0x7266ed[0x0]);_0x356fe7['push'](_0x7266ed['slice'](0x1,_0x7266ed[_0x05d7('0x18')])[_0x05d7('0x19')](','));}break;case _0x05d7('0x24'):var _0xc8e961=_0x2cd1bb[_0x05d7('0x1e')][_0x05d7('0x1f')](',');_0x356fe7[_0x05d7('0x22')](_0xc8e961[0x0]);_0x356fe7['push'](_0xc8e961[0x1]);_0x356fe7[_0x05d7('0x22')](_0xc8e961[_0x05d7('0x23')](0x2,_0xc8e961[_0x05d7('0x18')])[_0x05d7('0x19')](','));break;case _0x05d7('0x25'):var _0x13464d=_0x2cd1bb[_0x05d7('0x1e')][_0x05d7('0x1f')](',');_0x356fe7[_0x05d7('0x22')](_0x13464d[0x0]);_0x356fe7['push'](_0x13464d[0x1]);_0x356fe7[_0x05d7('0x22')](_0x13464d[0x2]);_0x356fe7[_0x05d7('0x22')](_0x13464d[0x3]);_0x356fe7[_0x05d7('0x22')](_0x13464d[_0x05d7('0x23')](0x4,_0x13464d[_0x05d7('0x18')])[_0x05d7('0x19')](','));break;case'amazonlex':var _0x139e32=_0x2cd1bb[_0x05d7('0x1e')][_0x05d7('0x1f')](',');_0x356fe7['push'](_0x139e32[0x0]);_0x356fe7[_0x05d7('0x22')](_0x139e32[0x1]);_0x356fe7[_0x05d7('0x22')](_0x139e32[0x2]);_0x356fe7[_0x05d7('0x22')](_0x139e32[0x3]);_0x356fe7['push'](_0x139e32['slice'](0x4,_0x139e32[_0x05d7('0x18')])[_0x05d7('0x19')](','));break;case _0x05d7('0x26'):_0x356fe7[_0x05d7('0x22')](_0x2cd1bb[_0x05d7('0x1e')]);break;case'tag':_0x356fe7[_0x05d7('0x22')](_0x2cd1bb['TagId']);_0x356fe7[_0x05d7('0x22')](_0x2cd1bb[_0x05d7('0x1e')]);break;case _0x05d7('0x27'):var _0xfb5986=utils[_0x05d7('0x28')](_0x38b3c7[_0x05d7('0x29')]['notificationTemplate'],_0x38b3c7);var _0x546890=_0x2cd1bb[_0x05d7('0x1e')]['split'](',');_0x356fe7[_0x05d7('0x22')](_0x546890[0x0]);_0x356fe7[_0x05d7('0x22')](_0x546890[0x1]);_0x356fe7[_0x05d7('0x22')](_0x546890[0x2]);_0x356fe7[_0x05d7('0x22')](_0x546890[0x3]);_0x356fe7[_0x05d7('0x22')](_0x546890[0x4]);_0x356fe7[_0x05d7('0x22')](_0x546890[0x5]);_0x356fe7[_0x05d7('0x22')](_0x546890[0x6]);_0x356fe7['push'](_0x546890[0x7]);_0x356fe7[_0x05d7('0x22')](_0x546890[0x8]);_0x356fe7['push'](_0x546890[0x9]);_0x356fe7[_0x05d7('0x22')](_0x546890[0xa]);_0x356fe7[_0x05d7('0x22')](_0x38b3c7[_0x05d7('0x15')]['id']);_0x356fe7['push'](_0x38b3c7[_0x05d7('0x26')]['id']);_0x356fe7[_0x05d7('0x22')](_0x2cd1bb[_0x05d7('0x2a')]);_0x356fe7['push'](_0x38b3c7[_0x05d7('0x15')]['ContactId']);_0x356fe7['push'](_0x38b3c7['body']['body']);_0x356fe7[_0x05d7('0x22')](_0xfb5986);break;default:_0x356fe7=_[_0x05d7('0xe')](_0x2cd1bb[_0x05d7('0x1e')])?[]:_0x2cd1bb[_0x05d7('0x1e')][_0x05d7('0x1f')](',');}var _0x445b65={'id':util[_0x05d7('0x2b')](_0x05d7('0x2c'),_0x559545,_0x2cd1bb['id'],_0x2cd1bb[_0x05d7('0x1b')]),'condition':require(_0x05d7('0x2d'))[_0x05d7('0x2e')](_0x559545,getIntervals(_0x34cd5b[_0x05d7('0x2f')],_0x2cd1bb),_0x34cd5b),'consequence':require(_0x05d7('0x30')+_0x2cd1bb[_0x05d7('0x1b')])[_0x05d7('0x31')](_0x559545,_0x356fe7,_0x34cd5b,_0x38b3c7),'p':_0x2cd1bb[_0x05d7('0x32')]||0x0};logger[_0x05d7('0x33')]('Push\x20new\x20rule',_0x445b65['id'],_0x05d7('0x34'),getIntervals(_0x34cd5b[_0x05d7('0x2f')],_0x2cd1bb)['join'](_0x05d7('0x35')));_0x51d854[_0x05d7('0x22')](_0x445b65);}else{logger['error'](_0x05d7('0x36'),path['join'](__dirname,_0x05d7('0x16'),_0x2cd1bb['app']+_0x05d7('0x1a')));}}_0x34cd5b[_0x05d7('0x14')][_0x559545]=new RuleEngine(_0x51d854);_0x34cd5b['rules'][_0x559545]['execute'](_0x38b3c7,function(_0x2bebc3){logger[_0x05d7('0x33')](_0x05d7('0x37'),JSON[_0x05d7('0x38')](_0x2bebc3['matchPath']));if(_0x34cd5b['rules'][_0x559545]){_0x34cd5b['rules'][_0x559545]['emit'](_0x05d7('0x39'));}});return _0x42c95f({'code':0xc8,'message':_0x38b3c7});}else{logger['info'](_0x05d7('0x3a'));return _0x42c95f({'code':0xc8,'message':_0x38b3c7});}}catch(_0x4eb3a9){logger[_0x05d7('0x3b')](_0x4eb3a9['stack']);return _0x252ab3(_0x5ba163['error'](0x1f4,_0x4eb3a9));}}return _0x252ab3(_0x05d7('0x3c'));});},'AcceptMessage':function(_0x3e01ca){var _0x2a3dcb=this;return new Promise(function(_0x293453,_0x18a29b){if(_0x3e01ca[_0x05d7('0x3d')]&&_0x3e01ca[_0x05d7('0x3d')]['id']){if(_0x34cd5b[_0x05d7('0x3e')][_0x3e01ca[_0x05d7('0x3d')]['id']]){_0x34cd5b[_0x05d7('0x3e')][_0x3e01ca[_0x05d7('0x3d')]['id']][_0x05d7('0x3f')]=![];_0x34cd5b[_0x05d7('0x3e')][_0x3e01ca['agent']['id']][_0x05d7('0x40')]=undefined;}}if(_0x3e01ca['message']&&_0x3e01ca[_0x05d7('0x26')]['id']){try{var _0x516a52=getId(_0x3e01ca['channel'],_0x3e01ca[_0x05d7('0x26')]?_0x3e01ca[_0x05d7('0x26')]['id']:0x0,_0x3e01ca[_0x05d7('0x15')]?_0x3e01ca[_0x05d7('0x15')]['id']:0x0);if(_0x34cd5b[_0x05d7('0x14')][_0x516a52]){_0x34cd5b[_0x05d7('0x14')][_0x516a52][_0x05d7('0x41')]('end');if(rpc[_0x3e01ca[_0x05d7('0x20')]+_0x05d7('0x42')]){rpc[_0x3e01ca[_0x05d7('0x20')]+_0x05d7('0x42')][_0x05d7('0x43')](_0x516a52,{'UserId':_0x3e01ca[_0x05d7('0x26')][_0x05d7('0x44')]})[_0x05d7('0x45')](function(_0x212d39){logger[_0x05d7('0x3b')](_0x05d7('0x46'));});}}return _0x293453({'code':0xc8,'message':_0x3e01ca});}catch(_0x252b2d){logger[_0x05d7('0x3b')](_0x252b2d[_0x05d7('0x47')]);return _0x18a29b(_0x2a3dcb[_0x05d7('0x3b')](0x1f4,_0x252b2d));}}logger[_0x05d7('0x3b')](_0x05d7('0x48'));return _0x18a29b(_0x2a3dcb['error'](0x1f4,_0x05d7('0x48')));});},'RejectMessage':function(_0x5ba65e){var _0x142d1e=this;return new Promise(function(_0x85309b,_0x4efd41){if(_0x5ba65e[_0x05d7('0x3d')]&&_0x5ba65e[_0x05d7('0x3d')]['id']){try{if(_0x34cd5b[_0x05d7('0x3e')][_0x5ba65e['agent']['id']]){_0x34cd5b[_0x05d7('0x3e')][_0x5ba65e['agent']['id']][_0x05d7('0x3f')]=![];_0x34cd5b[_0x05d7('0x3e')][_0x5ba65e[_0x05d7('0x3d')]['id']][_0x05d7('0x40')]=undefined;}return _0x85309b({'code':0xc8,'message':_0x5ba65e});}catch(_0x56e2fe){logger[_0x05d7('0x3b')](_0x56e2fe[_0x05d7('0x47')]);return _0x4efd41(_0x142d1e[_0x05d7('0x3b')](0x1f4,_0x56e2fe));}}logger[_0x05d7('0x3b')](_0x05d7('0x48'));return _0x4efd41(_0x142d1e['error'](0x1f4,_0x05d7('0x48')));});},'AbandonInteraction':function(_0x314456){var _0x45ac39=this;return new Promise(function(_0x44ed17,_0x593be7){if(_0x314456['channel']&&_0x314456[_0x05d7('0x15')]&&_0x314456[_0x05d7('0x15')]['id']){try{var _0x31a7ca=getId(_0x314456[_0x05d7('0x20')],_0x314456[_0x05d7('0x26')]?_0x314456['message']['id']:0x0,_0x314456['interaction']?_0x314456[_0x05d7('0x15')]['id']:0x0);if(_0x34cd5b[_0x05d7('0x14')][_0x31a7ca]){_0x34cd5b[_0x05d7('0x14')][_0x31a7ca]['emit'](_0x05d7('0x49'));}return _0x44ed17({'code':0xc8,'message':_0x314456});}catch(_0x5028e1){logger[_0x05d7('0x3b')](_0x5028e1[_0x05d7('0x47')]);return _0x593be7(_0x45ac39[_0x05d7('0x3b')](0x1f4,_0x5028e1));}}logger[_0x05d7('0x3b')](_0x05d7('0x48'));return _0x593be7(_0x45ac39[_0x05d7('0x3b')](0x1f4,_0x05d7('0x48')));});},'AgentCapacity':function(_0x235378){var _0xff4d75=this;return new Promise(function(_0x3fd315,_0x4a4b40){if(_0x34cd5b[_0x05d7('0x3e')][_0x05d7('0x4a')](_0x235378['id'])){for(var _0x5d1490 in _0x235378['capacity']){if(_0x235378[_0x05d7('0x4b')][_0x05d7('0x4a')](_0x5d1490)){if(_0x34cd5b['agents'][_0x235378['id']][_0x05d7('0x4a')](_0x5d1490+_0x05d7('0x4c'))){_0x34cd5b[_0x05d7('0x3e')][_0x235378['id']][_0x5d1490+_0x05d7('0x4c')]=parseInt(_0x235378[_0x05d7('0x4b')][_0x5d1490],0xa);}}}_0x34cd5b['agents'][_0x235378['id']][_0x05d7('0x4d')]();return _0x3fd315({'code':0xc8,'message':_0x34cd5b[_0x05d7('0x3e')][_0x235378['id']]});}else{return _0x4a4b40(_0xff4d75['error'](0x1f4,_0x05d7('0x4e')));}});},'Agents':function(_0x5732f9){return new Promise(function(_0x20725b,_0x54f009){var _0xef70e7=_[_0x05d7('0x4f')](_0x34cd5b['agents']);_0x20725b({'count':_0xef70e7[_0x05d7('0x18')],'rows':_0xef70e7});});},'ChatQueues':function(_0x22ae59){return new Promise(function(_0x342580,_0x3178e2){var _0xce73b9=[];for(var _0x387848 in _0x34cd5b[_0x05d7('0x50')]){if(_0x34cd5b[_0x05d7('0x50')][_0x05d7('0x4a')](_0x387848)){var _0x3a6081=_0x34cd5b[_0x05d7('0x50')][_0x387848];var _0x18c8d7={'id':_0x3a6081['id'],'available':_0x3a6081[_0x05d7('0x51')],'loggedIn':_0x3a6081[_0x05d7('0x52')],'name':_0x3a6081[_0x05d7('0x53')],'paused':_0x3a6081[_0x05d7('0x54')],'waiting':_0x3a6081['waiting']};_0xce73b9['push'](_0x18c8d7);}}_0x342580({'count':_0xce73b9[_0x05d7('0x18')],'rows':_0xce73b9});});},'MailQueues':function(_0x3524b9){return new Promise(function(_0x47918b,_0x75d06){var _0x471ea1=[];for(var _0x5c73eb in _0x34cd5b['mailQueues']){if(_0x34cd5b[_0x05d7('0x55')][_0x05d7('0x4a')](_0x5c73eb)){var _0x6e945c=_0x34cd5b[_0x05d7('0x55')][_0x5c73eb];var _0x58b441={'id':_0x6e945c['id'],'available':_0x6e945c[_0x05d7('0x51')],'loggedIn':_0x6e945c[_0x05d7('0x52')],'name':_0x6e945c[_0x05d7('0x53')],'paused':_0x6e945c[_0x05d7('0x54')],'waiting':_0x6e945c['waiting']};_0x471ea1['push'](_0x58b441);}}_0x47918b({'count':_0x471ea1['length'],'rows':_0x471ea1});});},'OpenchannelQueues':function(_0x2c06ca){return new Promise(function(_0x2e39d8,_0x26d489){var _0x5b6fee=[];for(var _0x11e4cd in _0x34cd5b[_0x05d7('0x56')]){if(_0x34cd5b[_0x05d7('0x56')]['hasOwnProperty'](_0x11e4cd)){var _0x2b0192=_0x34cd5b[_0x05d7('0x56')][_0x11e4cd];var _0x2f20c3={'id':_0x2b0192['id'],'available':_0x2b0192['available'],'loggedIn':_0x2b0192[_0x05d7('0x52')],'name':_0x2b0192['name'],'paused':_0x2b0192[_0x05d7('0x54')],'waiting':_0x2b0192[_0x05d7('0x57')]};_0x5b6fee[_0x05d7('0x22')](_0x2f20c3);}}_0x2e39d8({'count':_0x5b6fee[_0x05d7('0x18')],'rows':_0x5b6fee});});},'SmsQueues':function(_0x3a4a4b){return new Promise(function(_0x8b36cd,_0x345482){var _0x55c094=[];for(var _0x308ecb in _0x34cd5b[_0x05d7('0x58')]){if(_0x34cd5b[_0x05d7('0x58')]['hasOwnProperty'](_0x308ecb)){var _0x32e09b=_0x34cd5b[_0x05d7('0x58')][_0x308ecb];var _0x4509ad={'id':_0x32e09b['id'],'available':_0x32e09b[_0x05d7('0x51')],'loggedIn':_0x32e09b[_0x05d7('0x52')],'name':_0x32e09b['name'],'paused':_0x32e09b[_0x05d7('0x54')],'waiting':_0x32e09b[_0x05d7('0x57')]};_0x55c094['push'](_0x4509ad);}}_0x8b36cd({'count':_0x55c094[_0x05d7('0x18')],'rows':_0x55c094});});},'FaxQueues':function(_0x4dc0d6){return new Promise(function(_0x55b213,_0x106b6a){var _0x43126b=[];for(var _0x14c57c in _0x34cd5b[_0x05d7('0x59')]){if(_0x34cd5b[_0x05d7('0x59')]['hasOwnProperty'](_0x14c57c)){var _0x3be4bd=_0x34cd5b['faxQueues'][_0x14c57c];var _0x21fedc={'id':_0x3be4bd['id'],'available':_0x3be4bd[_0x05d7('0x51')],'loggedIn':_0x3be4bd['loggedIn'],'name':_0x3be4bd[_0x05d7('0x53')],'paused':_0x3be4bd[_0x05d7('0x54')],'waiting':_0x3be4bd['waiting']};_0x43126b[_0x05d7('0x22')](_0x21fedc);}}_0x55b213({'count':_0x43126b[_0x05d7('0x18')],'rows':_0x43126b});});},'WhatsappQueues':function(_0x19eeb3){return new Promise(function(_0xfb39bc,_0x2e929c){var _0x12d84f=[];for(var _0x4cd17f in _0x34cd5b['whatsappQueues']){if(_0x34cd5b[_0x05d7('0x5a')][_0x05d7('0x4a')](_0x4cd17f)){var _0x220932=_0x34cd5b['whatsappQueues'][_0x4cd17f];var _0x5b5dce={'id':_0x220932['id'],'available':_0x220932[_0x05d7('0x51')],'loggedIn':_0x220932[_0x05d7('0x52')],'name':_0x220932[_0x05d7('0x53')],'paused':_0x220932['paused'],'waiting':_0x220932['waiting']};_0x12d84f['push'](_0x5b5dce);}}_0xfb39bc({'count':_0x12d84f['length'],'rows':_0x12d84f});});},'ChatQueuesWaitingInteractions':function(_0xf6163){return new Promise(function(_0x2eb997,_0x4ab711){var _0x10eedb=_['values'](_0x34cd5b['chatQueuesWaitingInteractions']);_0x2eb997({'count':_0x10eedb[_0x05d7('0x18')],'rows':_0x10eedb});});},'MailQueuesWaitingInteractions':function(_0x31f8e6){return new Promise(function(_0xb4d7f4,_0x5cad96){var _0x2ad68a=_[_0x05d7('0x4f')](_0x34cd5b[_0x05d7('0x5b')]);_0xb4d7f4({'count':_0x2ad68a[_0x05d7('0x18')],'rows':_0x2ad68a});});},'OpenchannelQueuesWaitingInteractions':function(_0x396e70){return new Promise(function(_0x13ca87,_0x341f41){var _0x3025b=_[_0x05d7('0x4f')](_0x34cd5b[_0x05d7('0x5c')]);_0x13ca87({'count':_0x3025b[_0x05d7('0x18')],'rows':_0x3025b});});},'SmsQueuesWaitingInteractions':function(_0x27b3ea){return new Promise(function(_0x3c1103,_0x3cfcab){var _0x115e0d=_[_0x05d7('0x4f')](_0x34cd5b['smsQueuesWaitingInteractions']);_0x3c1103({'count':_0x115e0d[_0x05d7('0x18')],'rows':_0x115e0d});});},'FaxQueuesWaitingInteractions':function(_0x59a77f){return new Promise(function(_0x10b5fd,_0x477f9c){var _0x30d28e=_[_0x05d7('0x4f')](_0x34cd5b[_0x05d7('0x5d')]);_0x10b5fd({'count':_0x30d28e[_0x05d7('0x18')],'rows':_0x30d28e});});},'WhatsappQueuesWaitingInteractions':function(_0x15cba1){return new Promise(function(_0x3f4f39,_0x4c31a9){var _0x22a825=_[_0x05d7('0x4f')](_0x34cd5b[_0x05d7('0x5e')]);_0x3f4f39({'count':_0x22a825[_0x05d7('0x18')],'rows':_0x22a825});});}};var _0x4725e2=jayson[_0x05d7('0x5f')](_0x586306)[_0x05d7('0x60')]();_0x4725e2['on'](_0x05d7('0x3b'),function(_0x5554e0){logger['error'](JSON[_0x05d7('0x38')](_0x5554e0));return _0x2dafd7(_0x5554e0);});_0x4725e2['listen'](0x232c,_0x05d7('0x61'),function(){console[_0x05d7('0x62')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x14bf0b('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 6668b43..6f7fffc 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 _0xb1c3=['bluebird','jayson/promise','../../../config/logger','routing','client','http','request','then','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','log','stack','util'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0xb1c3,0x9f));var _0x3b1c=function(_0x465596,_0x17aace){_0x465596=_0x465596-0x0;var _0xffc40d=_0xb1c3[_0x465596];return _0xffc40d;};'use strict';var util=require(_0x3b1c('0x0'));var BPromise=require(_0x3b1c('0x1'));var jayson=require(_0x3b1c('0x2'));var _=require('lodash');var logger=require(_0x3b1c('0x3'))(_0x3b1c('0x4'));var client=jayson[_0x3b1c('0x5')][_0x3b1c('0x6')]({'port':0x232a});function request(_0x5ece4a,_0x3543c8){return new BPromise(function(_0x534109,_0x4c5d75){return client[_0x3b1c('0x7')](_0x5ece4a,_0x3543c8)[_0x3b1c('0x8')](function(_0x44c0a4){if(_0x44c0a4[_0x3b1c('0x9')]){return _0x4c5d75(_0x44c0a4[_0x3b1c('0x9')]['message']);}else{return _0x534109(_0x44c0a4[_0x3b1c('0xa')]);}})[_0x3b1c('0xb')](function(_0x4af43a){return _0x4c5d75(_0x4af43a);});});}exports[_0x3b1c('0xc')]=function(_0x2faa0f,_0x20674e,_0x326c1e){return function(_0x547344){if(_0x326c1e[_0x3b1c('0xd')]&&!_0x326c1e[_0x3b1c('0xd')][_0x2faa0f]){logger[_0x3b1c('0xe')](_0x3b1c('0xf'),_0x2faa0f);return _0x547344[_0x3b1c('0x10')]();}var _0x28fa3a=[];for(var _0xfdcd0f=0x0;_0xfdcd0f<_0x20674e[_0x3b1c('0x11')];_0xfdcd0f+=0x1){_0x28fa3a[_0x3b1c('0x12')](request(_0x3b1c('0x13'),{'command':util[_0x3b1c('0x14')]('iftime\x20%s',_0x20674e[_0xfdcd0f])})[_0x3b1c('0x8')](function(_0x4deecb){return _0x4deecb&&_0x4deecb[_0x3b1c('0x15')]&&_0x4deecb[_0x3b1c('0x15')][_0x3b1c('0x16')](_0x3b1c('0x17'))>=0x0?!![]:![];})[_0x3b1c('0xb')](function(_0x9bd528){logger['error'](_0x3b1c('0x18'),_0x2faa0f,_0x20674e[_0xfdcd0f]);}));}BPromise[_0x3b1c('0x19')](_0x28fa3a)[_0x3b1c('0x8')](function(_0x2edbd4){var _0x280100=_[_0x3b1c('0x1a')](_0x2edbd4);logger[_0x3b1c('0xe')](_0x3b1c('0x1b'),_0x2faa0f,_0x20674e[_0x3b1c('0x1c')](_0x3b1c('0x1d')),_0x280100);_0x547344['when'](_0x280100);})[_0x3b1c('0xb')](function(_0x5783f0){console[_0x3b1c('0x1e')](_0x5783f0);logger[_0x3b1c('0x9')](_0x3b1c('0x1b'),_0x2faa0f,_0x20674e[_0x3b1c('0x1c')]('\x20|\x20'),_0x5783f0[_0x3b1c('0x1f')]);_0x547344[_0x3b1c('0x10')]();});};}; \ No newline at end of file +var _0x5bbf=['rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','format','iftime\x20%s','indexOf','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join','stack','bluebird','lodash','../../../config/logger','routing','client','http','then','error','message','catch','condition'];(function(_0x2fad0d,_0x4803f3){var _0x55fd2a=function(_0x423a93){while(--_0x423a93){_0x2fad0d['push'](_0x2fad0d['shift']());}};_0x55fd2a(++_0x4803f3);}(_0x5bbf,0x69));var _0xf5bb=function(_0x3d0b38,_0x5b4bda){_0x3d0b38=_0x3d0b38-0x0;var _0x5f19fb=_0x5bbf[_0x3d0b38];return _0x5f19fb;};'use strict';var util=require('util');var BPromise=require(_0xf5bb('0x0'));var jayson=require('jayson/promise');var _=require(_0xf5bb('0x1'));var logger=require(_0xf5bb('0x2'))(_0xf5bb('0x3'));var client=jayson[_0xf5bb('0x4')][_0xf5bb('0x5')]({'port':0x232a});function request(_0x2fa07e,_0x5005d3){return new BPromise(function(_0x5c01ec,_0x45dfd8){return client['request'](_0x2fa07e,_0x5005d3)[_0xf5bb('0x6')](function(_0x3a0205){if(_0x3a0205[_0xf5bb('0x7')]){return _0x45dfd8(_0x3a0205[_0xf5bb('0x7')][_0xf5bb('0x8')]);}else{return _0x5c01ec(_0x3a0205['result']);}})[_0xf5bb('0x9')](function(_0x2b19a6){return _0x45dfd8(_0x2b19a6);});});}exports[_0xf5bb('0xa')]=function(_0x577938,_0x2151da,_0x8b1a2d){return function(_0x246bc3){if(_0x8b1a2d[_0xf5bb('0xb')]&&!_0x8b1a2d[_0xf5bb('0xb')][_0x577938]){logger[_0xf5bb('0xc')](_0xf5bb('0xd'),_0x577938);return _0x246bc3[_0xf5bb('0xe')]();}var _0xe9865a=[];for(var _0x4a79ab=0x0;_0x4a79ab<_0x2151da[_0xf5bb('0xf')];_0x4a79ab+=0x1){_0xe9865a[_0xf5bb('0x10')](request('Command',{'command':util[_0xf5bb('0x11')](_0xf5bb('0x12'),_0x2151da[_0x4a79ab])})['then'](function(_0x31e805){return _0x31e805&&_0x31e805[_0xf5bb('0x8')]&&_0x31e805[_0xf5bb('0x8')][_0xf5bb('0x13')]('true')>=0x0?!![]:![];})[_0xf5bb('0x9')](function(_0x3efe2a){logger['error'](_0xf5bb('0x14'),_0x577938,_0x2151da[_0x4a79ab]);}));}BPromise[_0xf5bb('0x15')](_0xe9865a)[_0xf5bb('0x6')](function(_0x149853){var _0x29750b=_[_0xf5bb('0x16')](_0x149853);logger[_0xf5bb('0xc')](_0xf5bb('0x17'),_0x577938,_0x2151da['join'](_0xf5bb('0x18')),_0x29750b);_0x246bc3[_0xf5bb('0x19')](_0x29750b);})[_0xf5bb('0x9')](function(_0x4be962){console[_0xf5bb('0x1a')](_0x4be962);logger[_0xf5bb('0x7')]('[%s][INTERVAL]\x20%s\x20%s',_0x577938,_0x2151da[_0xf5bb('0x1b')](_0xf5bb('0x18')),_0x4be962[_0xf5bb('0x1c')]);_0x246bc3['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 2d4dc15..540576a 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 _0x351d=['[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','ringtime','push','error','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','talktime','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinenum','connectedlinename','connect','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','extension','transferuniqueid','[%s][agents][blindtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','ATTENDED','transferexten','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','complete','lodash','./utils','format','uniqueid','channel','membername','interface','calleridnum','lastevent','queue','then','type','agentcomplete','acw','agentacw','acwTimeout','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','agentcalledAt','now','called','info'];(function(_0x53d03f,_0x15e208){var _0x4cdfc8=function(_0x371fc1){while(--_0x371fc1){_0x53d03f['push'](_0x53d03f['shift']());}};_0x4cdfc8(++_0x15e208);}(_0x351d,0x90));var _0xd351=function(_0xe82102,_0x4f79af){_0xe82102=_0xe82102-0x0;var _0x4c539b=_0x351d[_0xe82102];return _0x4c539b;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var utils=require(_0xd351('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2aa5fd,_0x340931){utils['info'](util[_0xd351('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x2aa5fd[_0xd351('0x3')],_0x2aa5fd[_0xd351('0x4')],_0x2aa5fd['queue'],_0x2aa5fd[_0xd351('0x5')],_0x2aa5fd[_0xd351('0x6')],_0x2aa5fd[_0xd351('0x7')],_0x2aa5fd['connectedlinenum'],_0x2aa5fd[_0xd351('0x8')]));if(_0x2aa5fd[_0xd351('0x9')]){utils['getVoiceQueueByName'](_0x2aa5fd[_0xd351('0x9')])[_0xd351('0xa')](function(_0x51c5f4){if(_0x51c5f4){_0x2aa5fd['type']=_0x51c5f4[_0xd351('0xb')];_0x2aa5fd['agentacw']=_0x2aa5fd[_0xd351('0xc')]?_0x51c5f4[_0xd351('0xd')]:![];_0x2aa5fd['acwtime']=_0x2aa5fd[_0xd351('0xe')]?_0x51c5f4[_0xd351('0xf')]:0x0;}utils['request'](_0xd351('0x10'),_0x2aa5fd);});}else{utils['request']('CreateVoiceAgentReport',_0x2aa5fd);}if(_0x340931){delete transfers[_0x2aa5fd[_0xd351('0x3')]];}else{delete agents[_0x2aa5fd[_0xd351('0x11')]];}}exports[_0xd351('0x12')]=function(_0x1eb2a9){try{utils['debug'](util[_0xd351('0x2')](_0xd351('0x13'),_0x1eb2a9['uniqueid']),_0x1eb2a9);agents[_0x1eb2a9[_0xd351('0x11')]]=_0x1eb2a9;agents[_0x1eb2a9[_0xd351('0x11')]][_0xd351('0x14')]=utils[_0xd351('0x15')]();agents[_0x1eb2a9[_0xd351('0x11')]]['lastevent']=_0xd351('0x16');agents[_0x1eb2a9['destuniqueid']]['connectedlinenum']=null;agents[_0x1eb2a9[_0xd351('0x11')]]['connectedlinename']=null;utils[_0xd351('0x17')](util[_0xd351('0x2')](_0xd351('0x18'),_0x1eb2a9['uniqueid'],agents[_0x1eb2a9[_0xd351('0x11')]][_0xd351('0x5')],_0x1eb2a9[_0xd351('0x11')]));}catch(_0x12b5aa){utils['error'](util[_0xd351('0x2')]('[%s][agents][agentcalled]',_0x1eb2a9['uniqueid']),_0x12b5aa);}};exports[_0xd351('0x19')]=function(_0x4a427b){try{if(!_[_0xd351('0x1a')](agents[_0x4a427b[_0xd351('0x11')]])){utils[_0xd351('0x1b')](util[_0xd351('0x2')](_0xd351('0x1c'),_0x4a427b['uniqueid']),_0x4a427b);utils[_0xd351('0x17')](util[_0xd351('0x2')](_0xd351('0x1d'),_0x4a427b['uniqueid'],agents[_0x4a427b[_0xd351('0x11')]][_0xd351('0x5')],_0x4a427b[_0xd351('0x11')]));agents[_0x4a427b['destuniqueid']][_0xd351('0x19')]=!![];agents[_0x4a427b[_0xd351('0x11')]][_0xd351('0x1e')]=utils[_0xd351('0x15')]();agents[_0x4a427b['destuniqueid']][_0xd351('0x8')]='timeout';agents[_0x4a427b[_0xd351('0x11')]][_0xd351('0x1f')]='timeout';agents[_0x4a427b[_0xd351('0x11')]]['holdtime']=_0x4a427b['ringtime']?parseInt(_0x4a427b[_0xd351('0x20')])/0x3e8:0x0;agents[_0x4a427b['destuniqueid']]['talktime']=0x0;unanswered[_0xd351('0x21')](_0x4a427b['destuniqueid']);}}catch(_0x38471c){utils[_0xd351('0x22')](util[_0xd351('0x2')]('[%s][agents][agentringnoanswer]',_0x4a427b[_0xd351('0x3')]),_0x38471c);}};exports['queuecallerabandon']=function(_0x1c826b){try{_['forIn'](agents,function(_0x5f07b1,_0xeb4da9){if(_0x5f07b1[_0xd351('0x3')]==_0x1c826b[_0xd351('0x3')]&&!_[_0xd351('0x23')](unanswered,_0x5f07b1['destuniqueid'])){utils[_0xd351('0x1b')](util[_0xd351('0x2')](_0xd351('0x24'),_0x1c826b[_0xd351('0x3')]),_0x1c826b);utils[_0xd351('0x17')](util[_0xd351('0x2')](_0xd351('0x25'),_0x1c826b[_0xd351('0x3')],_0x5f07b1[_0xd351('0x5')],_0x5f07b1['destuniqueid']));_0x5f07b1[_0xd351('0x19')]=!![];_0x5f07b1[_0xd351('0x1e')]=utils[_0xd351('0x15')]();_0x5f07b1[_0xd351('0x8')]='abandoned';_0x5f07b1[_0xd351('0x1f')]=_0xd351('0x26');_0x5f07b1[_0xd351('0x27')]=_0x1c826b[_0xd351('0x27')];_0x5f07b1[_0xd351('0x28')]=0x0;writeDB(_0x5f07b1);}});}catch(_0x37fbb8){utils[_0xd351('0x22')](util[_0xd351('0x2')](_0xd351('0x24'),_0x1c826b['uniqueid']),_0x37fbb8);}};exports['agentconnect']=function(_0x1fae11){try{if(agents[_0x1fae11[_0xd351('0x11')]]){utils[_0xd351('0x1b')](util[_0xd351('0x2')](_0xd351('0x29'),_0x1fae11[_0xd351('0x3')]),_0x1fae11);utils['info'](util['format'](_0xd351('0x2a'),_0x1fae11['uniqueid'],agents[_0x1fae11[_0xd351('0x11')]][_0xd351('0x5')],_0x1fae11[_0xd351('0x11')]));agents[_0x1fae11[_0xd351('0x11')]][_0xd351('0x2b')]=utils[_0xd351('0x15')]();agents[_0x1fae11[_0xd351('0x11')]][_0xd351('0x2c')]=_0x1fae11[_0xd351('0x2c')];agents[_0x1fae11[_0xd351('0x11')]][_0xd351('0x2d')]=_0x1fae11['connectedlinename'];agents[_0x1fae11[_0xd351('0x11')]]['holdtime']=_0x1fae11[_0xd351('0x20')];agents[_0x1fae11[_0xd351('0x11')]][_0xd351('0x8')]=_0xd351('0x2e');_[_0xd351('0x2f')](agents,function(_0x3db72a,_0x545bfc){if(_0x3db72a[_0xd351('0x11')]!=_0x1fae11[_0xd351('0x11')]&&_0x3db72a['uniqueid']==_0x1fae11[_0xd351('0x3')]){_0x3db72a[_0xd351('0x28')]=0x0;_0x3db72a[_0xd351('0x27')]=_0x1fae11[_0xd351('0x20')];_0x3db72a[_0xd351('0x19')]=!![];_0x3db72a['agentringnoanswerAt']=utils['now']();_0x3db72a[_0xd351('0x8')]=_0xd351('0x30');_0x3db72a['reason']='answered_elsewhere';_0x3db72a[_0xd351('0x31')]=_0x1fae11[_0xd351('0x11')];_0x3db72a['answeredelsewheremembername']=_0x1fae11['membername'];writeDB(_0x3db72a);}});}}catch(_0x46af23){utils[_0xd351('0x22')](util[_0xd351('0x2')](_0xd351('0x29'),_0x1fae11[_0xd351('0x3')]),_0x46af23);}};exports[_0xd351('0xc')]=function(_0x6192c3){try{if(!_[_0xd351('0x1a')](agents[_0x6192c3[_0xd351('0x11')]])){utils['debug'](util['format'](_0xd351('0x32'),_0x6192c3[_0xd351('0x3')]),_0x6192c3);utils[_0xd351('0x17')](util[_0xd351('0x2')](_0xd351('0x33'),_0x6192c3[_0xd351('0x3')],agents[_0x6192c3[_0xd351('0x11')]][_0xd351('0x5')],_0x6192c3[_0xd351('0x11')]));agents[_0x6192c3[_0xd351('0x11')]][_0xd351('0xc')]=!![];agents[_0x6192c3[_0xd351('0x11')]][_0xd351('0x34')]=utils[_0xd351('0x15')]();agents[_0x6192c3[_0xd351('0x11')]][_0xd351('0x28')]=utils['diffTime'](agents[_0x6192c3[_0xd351('0x11')]][_0xd351('0x34')],agents[_0x6192c3[_0xd351('0x11')]]['agentconnectAt']);agents[_0x6192c3[_0xd351('0x11')]][_0xd351('0x1f')]=_0x6192c3[_0xd351('0x1f')];agents[_0x6192c3[_0xd351('0x11')]][_0xd351('0x8')]='complete';writeDB(agents[_0x6192c3[_0xd351('0x11')]]);}}catch(_0x575ea0){utils[_0xd351('0x22')](util[_0xd351('0x2')]('[%s][agents][agentcomplete]',_0x6192c3['uniqueid']),_0x575ea0);}};exports[_0xd351('0x35')]=function(_0x444206){try{if(!_[_0xd351('0x1a')](agents[_0x444206['transfereruniqueid']])){utils[_0xd351('0x1b')](util[_0xd351('0x2')]('[%s][agents][blindtransfer]',_0x444206[_0xd351('0x3')]),_0x444206);utils['info'](util[_0xd351('0x2')](_0xd351('0x36'),_0x444206['uniqueid'],agents[_0x444206['transfereruniqueid']][_0xd351('0x5')],agents[_0x444206['transfereruniqueid']][_0xd351('0x3')]));agents[_0x444206[_0xd351('0x37')]][_0xd351('0x38')]=!![];agents[_0x444206['transfereruniqueid']][_0xd351('0x39')]='blind';agents[_0x444206['transfereruniqueid']]['transferexten']=_0x444206[_0xd351('0x3a')];agents[_0x444206[_0xd351('0x37')]][_0xd351('0x3b')]=agents[_0x444206['transfereruniqueid']]['uniqueid'];}}catch(_0x1748f0){utils[_0xd351('0x22')](util['format'](_0xd351('0x3c'),_0x444206[_0xd351('0x3')]),_0x1748f0);}};exports['attendedtransfer']=function(_0x24ee0f){try{utils['debug'](util[_0xd351('0x2')]('[%s][agents][attendedtransfer]',_0x24ee0f[_0xd351('0x3d')]),_0x24ee0f);if(_0x24ee0f[_0xd351('0x3d')]==_0x24ee0f[_0xd351('0x3e')]){if(!_[_0xd351('0x1a')](agents[_0x24ee0f[_0xd351('0x3f')]])){utils[_0xd351('0x17')](util[_0xd351('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x24ee0f['origtransfereruniqueid'],agents[_0x24ee0f[_0xd351('0x3f')]][_0xd351('0x5')]));agents[_0x24ee0f['secondtransfereruniqueid']][_0xd351('0x38')]=!![];agents[_0x24ee0f[_0xd351('0x3f')]][_0xd351('0x39')]='ATTENDED';agents[_0x24ee0f[_0xd351('0x3f')]]['transferexten']=_0x24ee0f['origtransfererexten'];agents[_0x24ee0f[_0xd351('0x3f')]][_0xd351('0x3b')]=_0x24ee0f['origtransfereruniqueid'];}if(_0x24ee0f[_0xd351('0x40')]&&agents[_0x24ee0f[_0xd351('0x40')]]){agents[_0x24ee0f[_0xd351('0x40')]][_0xd351('0x41')]=0x1;transfers[_0x24ee0f[_0xd351('0x40')]]=_[_0xd351('0x42')](agents[_0x24ee0f['transfereeuniqueid']]);transfers[_0x24ee0f[_0xd351('0x40')]][_0xd351('0x7')]=agents[_0x24ee0f[_0xd351('0x3f')]][_0xd351('0x7')];transfers[_0x24ee0f[_0xd351('0x40')]][_0xd351('0x43')]=agents[_0x24ee0f[_0xd351('0x3f')]]['calleridname'];transfers[_0x24ee0f[_0xd351('0x40')]]['agentcalledAt']=utils[_0xd351('0x15')]();transfers[_0x24ee0f[_0xd351('0x40')]][_0xd351('0x2b')]=utils[_0xd351('0x15')]();transfers[_0x24ee0f[_0xd351('0x40')]]['holdtime']=0x0;transfers[_0x24ee0f[_0xd351('0x40')]]['agententerreason']=0x2;}}else if(_0x24ee0f[_0xd351('0x3f')]==_0x24ee0f[_0xd351('0x44')]){if(!_[_0xd351('0x1a')](agents[_0x24ee0f[_0xd351('0x3d')]])){utils[_0xd351('0x17')](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x24ee0f[_0xd351('0x3d')],agents[_0x24ee0f[_0xd351('0x3d')]]['membername']));agents[_0x24ee0f[_0xd351('0x3d')]][_0xd351('0x38')]=!![];agents[_0x24ee0f[_0xd351('0x3d')]]['transfertype']=_0xd351('0x45');agents[_0x24ee0f[_0xd351('0x3d')]][_0xd351('0x46')]=_0x24ee0f[_0xd351('0x47')];agents[_0x24ee0f['origtransfereruniqueid']]['transferuniqueid']=_0x24ee0f[_0xd351('0x3f')];}if(_0x24ee0f[_0xd351('0x48')]&&agents[_0x24ee0f[_0xd351('0x48')]]){agents[_0x24ee0f[_0xd351('0x48')]][_0xd351('0x41')]=0x1;transfers[_0x24ee0f[_0xd351('0x48')]]=_[_0xd351('0x42')](agents[_0x24ee0f['transfertargetuniqueid']]);transfers[_0x24ee0f[_0xd351('0x48')]]['calleridnum']=agents[_0x24ee0f['origtransfereruniqueid']][_0xd351('0x7')];transfers[_0x24ee0f[_0xd351('0x48')]]['calleridname']=agents[_0x24ee0f[_0xd351('0x3d')]]['calleridname'];transfers[_0x24ee0f['transfertargetuniqueid']]['agentcalledAt']=utils[_0xd351('0x15')]();transfers[_0x24ee0f[_0xd351('0x48')]][_0xd351('0x2b')]=utils['now']();transfers[_0x24ee0f[_0xd351('0x48')]][_0xd351('0x27')]=0x0;transfers[_0x24ee0f[_0xd351('0x48')]][_0xd351('0x41')]=0x2;}}}catch(_0x2375db){utils[_0xd351('0x22')](util[_0xd351('0x2')](_0xd351('0x49'),_0x24ee0f[_0xd351('0x3d')]),_0x2375db);}};exports[_0xd351('0x4a')]=function(_0x18c261){try{utils['debug'](util[_0xd351('0x2')](_0xd351('0x4b'),_0x18c261[_0xd351('0x3')]),_0x18c261);if(agents[_0x18c261[_0xd351('0x3')]]&&agents[_0x18c261[_0xd351('0x3')]][_0xd351('0x1f')]==='timeout'){if(_0x18c261[_0xd351('0x4c')]==='21'){agents[_0x18c261[_0xd351('0x3')]]['reason']='rejected';agents[_0x18c261[_0xd351('0x3')]][_0xd351('0x8')]=_0xd351('0x4d');}utils[_0xd351('0x17')](util[_0xd351('0x2')](_0xd351('0x4e'),_0x18c261[_0xd351('0x3')],agents[_0x18c261[_0xd351('0x3')]][_0xd351('0x5')],agents[_0x18c261['uniqueid']][_0xd351('0x1f')],agents[_0x18c261[_0xd351('0x3')]]['lastevent']));writeDB(agents[_0x18c261[_0xd351('0x3')]]);var _0x58eed5=unanswered[_0xd351('0x4f')](_0x18c261['uniqueid']);if(_0x58eed5>-0x1){unanswered[_0xd351('0x50')](_0x58eed5,0x1);}}if(transfers[_0x18c261[_0xd351('0x3')]]){transfers[_0x18c261[_0xd351('0x3')]][_0xd351('0xc')]=!![];transfers[_0x18c261[_0xd351('0x3')]][_0xd351('0x34')]=utils[_0xd351('0x15')]();transfers[_0x18c261['uniqueid']][_0xd351('0x28')]=utils[_0xd351('0x51')](transfers[_0x18c261[_0xd351('0x3')]][_0xd351('0x34')],transfers[_0x18c261[_0xd351('0x3')]]['agentconnectAt']);transfers[_0x18c261[_0xd351('0x3')]][_0xd351('0x1f')]=_0xd351('0x52');transfers[_0x18c261['uniqueid']][_0xd351('0x8')]=_0xd351('0x53');utils[_0xd351('0x17')](util[_0xd351('0x2')](_0xd351('0x4e'),_0x18c261[_0xd351('0x3')],transfers[_0x18c261[_0xd351('0x3')]][_0xd351('0x5')],transfers[_0x18c261[_0xd351('0x3')]]['reason'],transfers[_0x18c261[_0xd351('0x3')]][_0xd351('0x8')]));writeDB(transfers[_0x18c261['uniqueid']],!![]);}if(agents[_0x18c261[_0xd351('0x3')]]&&agents[_0x18c261['uniqueid']]['agentconnectAt']){agents[_0x18c261['uniqueid']][_0xd351('0xc')]=!![];agents[_0x18c261[_0xd351('0x3')]][_0xd351('0x34')]=utils['now']();agents[_0x18c261[_0xd351('0x3')]]['talktime']=utils[_0xd351('0x51')](agents[_0x18c261['uniqueid']][_0xd351('0x34')],agents[_0x18c261[_0xd351('0x3')]][_0xd351('0x2b')]);agents[_0x18c261[_0xd351('0x3')]][_0xd351('0x1f')]=agents[_0x18c261[_0xd351('0x3')]][_0xd351('0x38')]?_0xd351('0x38'):_0xd351('0x52');agents[_0x18c261[_0xd351('0x3')]][_0xd351('0x8')]=_0xd351('0x53');utils['info'](util[_0xd351('0x2')](_0xd351('0x4e'),_0x18c261[_0xd351('0x3')],agents[_0x18c261[_0xd351('0x3')]][_0xd351('0x5')],agents[_0x18c261['uniqueid']][_0xd351('0x1f')],agents[_0x18c261[_0xd351('0x3')]][_0xd351('0x8')]));writeDB(agents[_0x18c261[_0xd351('0x3')]]);}}catch(_0x4a4b25){utils[_0xd351('0x22')](util[_0xd351('0x2')]('[%s][agents][hangup]',_0x18c261[_0xd351('0x3')]),_0x4a4b25);}}; \ No newline at end of file +var _0xf7b4=['acw','acwtime','agentacw','acwTimeout','CreateVoiceAgentReport','destuniqueid','agentcalled','format','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','info','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','ringtime','push','queuecallerabandon','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','holdtime','talktime','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','forIn','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','agentcompleteAt','agentconnectAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfertype','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','complete','lodash','[%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','then','type','agentcomplete'];(function(_0x5adbb4,_0x5092e0){var _0x48e176=function(_0x2af1c8){while(--_0x2af1c8){_0x5adbb4['push'](_0x5adbb4['shift']());}};_0x48e176(++_0x5092e0);}(_0xf7b4,0x152));var _0x4f7b=function(_0x2c50b7,_0x7604fb){_0x2c50b7=_0x2c50b7-0x0;var _0x46b5a9=_0xf7b4[_0x2c50b7];return _0x46b5a9;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x5ccf30,_0x103165){utils['info'](util['format'](_0x4f7b('0x1'),_0x5ccf30[_0x4f7b('0x2')],_0x5ccf30[_0x4f7b('0x3')],_0x5ccf30[_0x4f7b('0x4')],_0x5ccf30[_0x4f7b('0x5')],_0x5ccf30[_0x4f7b('0x6')],_0x5ccf30[_0x4f7b('0x7')],_0x5ccf30[_0x4f7b('0x8')],_0x5ccf30[_0x4f7b('0x9')]));if(_0x5ccf30[_0x4f7b('0x4')]){utils[_0x4f7b('0xa')](_0x5ccf30[_0x4f7b('0x4')])[_0x4f7b('0xb')](function(_0x5c714d){if(_0x5c714d){_0x5ccf30[_0x4f7b('0xc')]=_0x5c714d[_0x4f7b('0xc')];_0x5ccf30['agentacw']=_0x5ccf30[_0x4f7b('0xd')]?_0x5c714d[_0x4f7b('0xe')]:![];_0x5ccf30[_0x4f7b('0xf')]=_0x5ccf30[_0x4f7b('0x10')]?_0x5c714d[_0x4f7b('0x11')]:0x0;}utils['request'](_0x4f7b('0x12'),_0x5ccf30);});}else{utils['request']('CreateVoiceAgentReport',_0x5ccf30);}if(_0x103165){delete transfers[_0x5ccf30[_0x4f7b('0x2')]];}else{delete agents[_0x5ccf30[_0x4f7b('0x13')]];}}exports[_0x4f7b('0x14')]=function(_0x41a050){try{utils['debug'](util[_0x4f7b('0x15')](_0x4f7b('0x16'),_0x41a050[_0x4f7b('0x2')]),_0x41a050);agents[_0x41a050[_0x4f7b('0x13')]]=_0x41a050;agents[_0x41a050[_0x4f7b('0x13')]][_0x4f7b('0x17')]=utils[_0x4f7b('0x18')]();agents[_0x41a050[_0x4f7b('0x13')]][_0x4f7b('0x9')]=_0x4f7b('0x19');agents[_0x41a050[_0x4f7b('0x13')]][_0x4f7b('0x8')]=null;agents[_0x41a050['destuniqueid']][_0x4f7b('0x1a')]=null;utils['info'](util['format'](_0x4f7b('0x1b'),_0x41a050[_0x4f7b('0x2')],agents[_0x41a050['destuniqueid']][_0x4f7b('0x5')],_0x41a050[_0x4f7b('0x13')]));}catch(_0x13a0f5){utils[_0x4f7b('0x1c')](util['format'](_0x4f7b('0x16'),_0x41a050['uniqueid']),_0x13a0f5);}};exports[_0x4f7b('0x1d')]=function(_0x12374b){try{if(!_[_0x4f7b('0x1e')](agents[_0x12374b[_0x4f7b('0x13')]])){utils[_0x4f7b('0x1f')](util[_0x4f7b('0x15')](_0x4f7b('0x20'),_0x12374b[_0x4f7b('0x2')]),_0x12374b);utils[_0x4f7b('0x21')](util['format'](_0x4f7b('0x22'),_0x12374b[_0x4f7b('0x2')],agents[_0x12374b[_0x4f7b('0x13')]]['membername'],_0x12374b[_0x4f7b('0x13')]));agents[_0x12374b[_0x4f7b('0x13')]]['agentringnoanswer']=!![];agents[_0x12374b[_0x4f7b('0x13')]]['agentringnoanswerAt']=utils[_0x4f7b('0x18')]();agents[_0x12374b[_0x4f7b('0x13')]][_0x4f7b('0x9')]=_0x4f7b('0x23');agents[_0x12374b[_0x4f7b('0x13')]][_0x4f7b('0x24')]=_0x4f7b('0x23');agents[_0x12374b[_0x4f7b('0x13')]]['holdtime']=_0x12374b[_0x4f7b('0x25')]?parseInt(_0x12374b[_0x4f7b('0x25')])/0x3e8:0x0;agents[_0x12374b[_0x4f7b('0x13')]]['talktime']=0x0;unanswered[_0x4f7b('0x26')](_0x12374b[_0x4f7b('0x13')]);}}catch(_0x1db684){utils[_0x4f7b('0x1c')](util[_0x4f7b('0x15')]('[%s][agents][agentringnoanswer]',_0x12374b[_0x4f7b('0x2')]),_0x1db684);}};exports[_0x4f7b('0x27')]=function(_0x9a675c){try{_['forIn'](agents,function(_0x7de561,_0x5d13a1){if(_0x7de561['uniqueid']==_0x9a675c[_0x4f7b('0x2')]&&!_['includes'](unanswered,_0x7de561[_0x4f7b('0x13')])){utils[_0x4f7b('0x1f')](util[_0x4f7b('0x15')](_0x4f7b('0x28'),_0x9a675c[_0x4f7b('0x2')]),_0x9a675c);utils[_0x4f7b('0x21')](util[_0x4f7b('0x15')](_0x4f7b('0x29'),_0x9a675c[_0x4f7b('0x2')],_0x7de561[_0x4f7b('0x5')],_0x7de561[_0x4f7b('0x13')]));_0x7de561[_0x4f7b('0x1d')]=!![];_0x7de561[_0x4f7b('0x2a')]=utils[_0x4f7b('0x18')]();_0x7de561[_0x4f7b('0x9')]=_0x4f7b('0x2b');_0x7de561[_0x4f7b('0x24')]=_0x4f7b('0x2b');_0x7de561[_0x4f7b('0x2c')]=_0x9a675c[_0x4f7b('0x2c')];_0x7de561[_0x4f7b('0x2d')]=0x0;writeDB(_0x7de561);}});}catch(_0x172235){utils['error'](util[_0x4f7b('0x15')]('[%s][agents][queuecallerabandon]',_0x9a675c[_0x4f7b('0x2')]),_0x172235);}};exports[_0x4f7b('0x2e')]=function(_0x579ad4){try{if(agents[_0x579ad4[_0x4f7b('0x13')]]){utils[_0x4f7b('0x1f')](util[_0x4f7b('0x15')]('[%s][agents][agentconnect]',_0x579ad4[_0x4f7b('0x2')]),_0x579ad4);utils[_0x4f7b('0x21')](util[_0x4f7b('0x15')](_0x4f7b('0x2f'),_0x579ad4[_0x4f7b('0x2')],agents[_0x579ad4[_0x4f7b('0x13')]][_0x4f7b('0x5')],_0x579ad4['destuniqueid']));agents[_0x579ad4[_0x4f7b('0x13')]]['agentconnectAt']=utils[_0x4f7b('0x18')]();agents[_0x579ad4[_0x4f7b('0x13')]][_0x4f7b('0x8')]=_0x579ad4['connectedlinenum'];agents[_0x579ad4[_0x4f7b('0x13')]]['connectedlinename']=_0x579ad4[_0x4f7b('0x1a')];agents[_0x579ad4[_0x4f7b('0x13')]]['holdtime']=_0x579ad4['ringtime'];agents[_0x579ad4[_0x4f7b('0x13')]]['lastevent']=_0x4f7b('0x30');_[_0x4f7b('0x31')](agents,function(_0x54f9e8,_0x1d0746){if(_0x54f9e8['destuniqueid']!=_0x579ad4['destuniqueid']&&_0x54f9e8['uniqueid']==_0x579ad4[_0x4f7b('0x2')]){_0x54f9e8[_0x4f7b('0x2d')]=0x0;_0x54f9e8[_0x4f7b('0x2c')]=_0x579ad4[_0x4f7b('0x25')];_0x54f9e8['agentringnoanswer']=!![];_0x54f9e8[_0x4f7b('0x2a')]=utils['now']();_0x54f9e8[_0x4f7b('0x9')]='answered_elsewhere';_0x54f9e8[_0x4f7b('0x24')]='answered_elsewhere';_0x54f9e8[_0x4f7b('0x32')]=_0x579ad4[_0x4f7b('0x13')];_0x54f9e8[_0x4f7b('0x33')]=_0x579ad4[_0x4f7b('0x5')];writeDB(_0x54f9e8);}});}}catch(_0x2986cd){utils[_0x4f7b('0x1c')](util[_0x4f7b('0x15')](_0x4f7b('0x34'),_0x579ad4[_0x4f7b('0x2')]),_0x2986cd);}};exports[_0x4f7b('0xd')]=function(_0x2d0be3){try{if(!_[_0x4f7b('0x1e')](agents[_0x2d0be3[_0x4f7b('0x13')]])){utils[_0x4f7b('0x1f')](util[_0x4f7b('0x15')](_0x4f7b('0x35'),_0x2d0be3[_0x4f7b('0x2')]),_0x2d0be3);utils[_0x4f7b('0x21')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2d0be3[_0x4f7b('0x2')],agents[_0x2d0be3[_0x4f7b('0x13')]][_0x4f7b('0x5')],_0x2d0be3[_0x4f7b('0x13')]));agents[_0x2d0be3['destuniqueid']]['agentcomplete']=!![];agents[_0x2d0be3[_0x4f7b('0x13')]][_0x4f7b('0x36')]=utils[_0x4f7b('0x18')]();agents[_0x2d0be3[_0x4f7b('0x13')]]['talktime']=utils['diffTime'](agents[_0x2d0be3[_0x4f7b('0x13')]][_0x4f7b('0x36')],agents[_0x2d0be3[_0x4f7b('0x13')]][_0x4f7b('0x37')]);agents[_0x2d0be3[_0x4f7b('0x13')]]['reason']=_0x2d0be3[_0x4f7b('0x24')];agents[_0x2d0be3[_0x4f7b('0x13')]][_0x4f7b('0x9')]='complete';writeDB(agents[_0x2d0be3[_0x4f7b('0x13')]]);}}catch(_0x104e7f){utils[_0x4f7b('0x1c')](util[_0x4f7b('0x15')](_0x4f7b('0x35'),_0x2d0be3[_0x4f7b('0x2')]),_0x104e7f);}};exports[_0x4f7b('0x38')]=function(_0x2e563f){try{if(!_[_0x4f7b('0x1e')](agents[_0x2e563f[_0x4f7b('0x39')]])){utils['debug'](util[_0x4f7b('0x15')](_0x4f7b('0x3a'),_0x2e563f[_0x4f7b('0x2')]),_0x2e563f);utils['info'](util[_0x4f7b('0x15')](_0x4f7b('0x3b'),_0x2e563f[_0x4f7b('0x2')],agents[_0x2e563f[_0x4f7b('0x39')]][_0x4f7b('0x5')],agents[_0x2e563f[_0x4f7b('0x39')]][_0x4f7b('0x2')]));agents[_0x2e563f[_0x4f7b('0x39')]][_0x4f7b('0x3c')]=!![];agents[_0x2e563f[_0x4f7b('0x39')]]['transfertype']=_0x4f7b('0x3d');agents[_0x2e563f[_0x4f7b('0x39')]][_0x4f7b('0x3e')]=_0x2e563f['extension'];agents[_0x2e563f[_0x4f7b('0x39')]][_0x4f7b('0x3f')]=agents[_0x2e563f[_0x4f7b('0x39')]][_0x4f7b('0x2')];}}catch(_0x3437a8){utils[_0x4f7b('0x1c')](util['format'](_0x4f7b('0x3a'),_0x2e563f[_0x4f7b('0x2')]),_0x3437a8);}};exports[_0x4f7b('0x40')]=function(_0x4c9496){try{utils[_0x4f7b('0x1f')](util[_0x4f7b('0x15')](_0x4f7b('0x41'),_0x4c9496[_0x4f7b('0x42')]),_0x4c9496);if(_0x4c9496[_0x4f7b('0x42')]==_0x4c9496[_0x4f7b('0x43')]){if(!_['isNil'](agents[_0x4c9496[_0x4f7b('0x44')]])){utils['info'](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x4c9496[_0x4f7b('0x42')],agents[_0x4c9496[_0x4f7b('0x44')]][_0x4f7b('0x5')]));agents[_0x4c9496['secondtransfereruniqueid']]['transfer']=!![];agents[_0x4c9496[_0x4f7b('0x44')]][_0x4f7b('0x45')]='ATTENDED';agents[_0x4c9496[_0x4f7b('0x44')]][_0x4f7b('0x3e')]=_0x4c9496[_0x4f7b('0x46')];agents[_0x4c9496[_0x4f7b('0x44')]]['transferuniqueid']=_0x4c9496[_0x4f7b('0x42')];}if(_0x4c9496[_0x4f7b('0x47')]&&agents[_0x4c9496[_0x4f7b('0x47')]]){agents[_0x4c9496[_0x4f7b('0x47')]][_0x4f7b('0x48')]=0x1;transfers[_0x4c9496[_0x4f7b('0x47')]]=_[_0x4f7b('0x49')](agents[_0x4c9496['transfereeuniqueid']]);transfers[_0x4c9496['transfereeuniqueid']]['calleridnum']=agents[_0x4c9496[_0x4f7b('0x44')]]['calleridnum'];transfers[_0x4c9496['transfereeuniqueid']]['calleridname']=agents[_0x4c9496['secondtransfereruniqueid']][_0x4f7b('0x4a')];transfers[_0x4c9496[_0x4f7b('0x47')]][_0x4f7b('0x17')]=utils[_0x4f7b('0x18')]();transfers[_0x4c9496[_0x4f7b('0x47')]][_0x4f7b('0x37')]=utils[_0x4f7b('0x18')]();transfers[_0x4c9496[_0x4f7b('0x47')]][_0x4f7b('0x2c')]=0x0;transfers[_0x4c9496[_0x4f7b('0x47')]][_0x4f7b('0x48')]=0x2;}}else if(_0x4c9496[_0x4f7b('0x44')]==_0x4c9496[_0x4f7b('0x4b')]){if(!_[_0x4f7b('0x1e')](agents[_0x4c9496[_0x4f7b('0x42')]])){utils[_0x4f7b('0x21')](util[_0x4f7b('0x15')](_0x4f7b('0x4c'),_0x4c9496['origtransfereruniqueid'],agents[_0x4c9496[_0x4f7b('0x42')]][_0x4f7b('0x5')]));agents[_0x4c9496[_0x4f7b('0x42')]][_0x4f7b('0x3c')]=!![];agents[_0x4c9496[_0x4f7b('0x42')]]['transfertype']='ATTENDED';agents[_0x4c9496[_0x4f7b('0x42')]]['transferexten']=_0x4c9496[_0x4f7b('0x4d')];agents[_0x4c9496[_0x4f7b('0x42')]][_0x4f7b('0x3f')]=_0x4c9496[_0x4f7b('0x44')];}if(_0x4c9496['transfertargetuniqueid']&&agents[_0x4c9496[_0x4f7b('0x4e')]]){agents[_0x4c9496[_0x4f7b('0x4e')]][_0x4f7b('0x48')]=0x1;transfers[_0x4c9496['transfertargetuniqueid']]=_['clone'](agents[_0x4c9496['transfertargetuniqueid']]);transfers[_0x4c9496[_0x4f7b('0x4e')]]['calleridnum']=agents[_0x4c9496['origtransfereruniqueid']]['calleridnum'];transfers[_0x4c9496[_0x4f7b('0x4e')]][_0x4f7b('0x4a')]=agents[_0x4c9496[_0x4f7b('0x42')]]['calleridname'];transfers[_0x4c9496[_0x4f7b('0x4e')]][_0x4f7b('0x17')]=utils['now']();transfers[_0x4c9496['transfertargetuniqueid']][_0x4f7b('0x37')]=utils[_0x4f7b('0x18')]();transfers[_0x4c9496[_0x4f7b('0x4e')]][_0x4f7b('0x2c')]=0x0;transfers[_0x4c9496['transfertargetuniqueid']][_0x4f7b('0x48')]=0x2;}}}catch(_0x40534d){utils[_0x4f7b('0x1c')](util[_0x4f7b('0x15')](_0x4f7b('0x41'),_0x4c9496[_0x4f7b('0x42')]),_0x40534d);}};exports['hangup']=function(_0x1fa0fd){try{utils[_0x4f7b('0x1f')](util[_0x4f7b('0x15')](_0x4f7b('0x4f'),_0x1fa0fd[_0x4f7b('0x2')]),_0x1fa0fd);if(agents[_0x1fa0fd['uniqueid']]&&agents[_0x1fa0fd['uniqueid']]['reason']===_0x4f7b('0x23')){if(_0x1fa0fd[_0x4f7b('0x50')]==='21'){agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x24')]=_0x4f7b('0x51');agents[_0x1fa0fd['uniqueid']][_0x4f7b('0x9')]=_0x4f7b('0x51');}utils[_0x4f7b('0x21')](util[_0x4f7b('0x15')](_0x4f7b('0x52'),_0x1fa0fd[_0x4f7b('0x2')],agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x5')],agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x24')],agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x9')]));writeDB(agents[_0x1fa0fd[_0x4f7b('0x2')]]);var _0x19e4ab=unanswered[_0x4f7b('0x53')](_0x1fa0fd[_0x4f7b('0x2')]);if(_0x19e4ab>-0x1){unanswered[_0x4f7b('0x54')](_0x19e4ab,0x1);}}if(transfers[_0x1fa0fd[_0x4f7b('0x2')]]){transfers[_0x1fa0fd['uniqueid']]['agentcomplete']=!![];transfers[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x36')]=utils[_0x4f7b('0x18')]();transfers[_0x1fa0fd[_0x4f7b('0x2')]]['talktime']=utils[_0x4f7b('0x55')](transfers[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x36')],transfers[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x37')]);transfers[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x24')]=_0x4f7b('0x56');transfers[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x9')]=_0x4f7b('0x57');utils[_0x4f7b('0x21')](util[_0x4f7b('0x15')](_0x4f7b('0x52'),_0x1fa0fd[_0x4f7b('0x2')],transfers[_0x1fa0fd['uniqueid']][_0x4f7b('0x5')],transfers[_0x1fa0fd[_0x4f7b('0x2')]]['reason'],transfers[_0x1fa0fd['uniqueid']][_0x4f7b('0x9')]));writeDB(transfers[_0x1fa0fd[_0x4f7b('0x2')]],!![]);}if(agents[_0x1fa0fd[_0x4f7b('0x2')]]&&agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x37')]){agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0xd')]=!![];agents[_0x1fa0fd['uniqueid']]['agentcompleteAt']=utils[_0x4f7b('0x18')]();agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x2d')]=utils[_0x4f7b('0x55')](agents[_0x1fa0fd['uniqueid']][_0x4f7b('0x36')],agents[_0x1fa0fd[_0x4f7b('0x2')]]['agentconnectAt']);agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x24')]=agents[_0x1fa0fd['uniqueid']]['transfer']?_0x4f7b('0x3c'):'agent';agents[_0x1fa0fd['uniqueid']]['lastevent']=_0x4f7b('0x57');utils['info'](util[_0x4f7b('0x15')](_0x4f7b('0x52'),_0x1fa0fd[_0x4f7b('0x2')],agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x5')],agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x24')],agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x9')]));writeDB(agents[_0x1fa0fd['uniqueid']]);}}catch(_0x476637){utils[_0x4f7b('0x1c')](util[_0x4f7b('0x15')](_0x4f7b('0x4f'),_0x1fa0fd[_0x4f7b('0x2')]),_0x476637);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 8cc4327..5d5691f 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 _0x5fdc=['now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','callerid','cause-txt','endtime','diffTime','attendedtransfer','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','origtransfererchannel','userfield','_attended','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','cdr','split','substring','lastIndexOf','noop','execif','set','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','blinds','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','calleridnum'];(function(_0x3c19d0,_0x1d2e2b){var _0x35a591=function(_0x1afd6e){while(--_0x1afd6e){_0x3c19d0['push'](_0x3c19d0['shift']());}};_0x35a591(++_0x1d2e2b);}(_0x5fdc,0x127));var _0xc5fd=function(_0x1d974c,_0x456928){_0x1d974c=_0x1d974c-0x0;var _0x41e7be=_0x5fdc[_0x1d974c];return _0x41e7be;};'use strict';var _=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var utils=require(_0xc5fd('0x2'));var transfers=require(_0xc5fd('0x3'));var dispositions=[_0xc5fd('0x4'),_0xc5fd('0x5'),_0xc5fd('0x5'),_0xc5fd('0x4'),_0xc5fd('0x4'),_0xc5fd('0x4'),_0xc5fd('0x6'),_0xc5fd('0x7'),_0xc5fd('0x5'),_0xc5fd('0x5'),_0xc5fd('0x5')];var channels={};function writeDB(_0x5a2eb4){var _0x5d86e5;if(transfers['blinds'][_0x5a2eb4[_0xc5fd('0x8')]]){_0x5d86e5=_0x5a2eb4[_0xc5fd('0x8')];_0x5a2eb4[_0xc5fd('0x8')]=transfers[_0xc5fd('0x9')][_0x5a2eb4['uniqueid']]['transfereeuniqueid'];}utils[_0xc5fd('0xa')](util[_0xc5fd('0xb')](_0xc5fd('0xc'),_0x5a2eb4[_0xc5fd('0x8')],_0x5a2eb4[_0xc5fd('0xd')],_0x5a2eb4[_0xc5fd('0xe')],_0x5a2eb4['membername'],_0x5a2eb4[_0xc5fd('0xf')],_0x5a2eb4['calleridnum'],_0x5a2eb4['connectedlinenum'],_0x5a2eb4[_0xc5fd('0x10')]));if(_0x5a2eb4[_0xc5fd('0x11')]){utils[_0xc5fd('0x12')](_0x5a2eb4[_0xc5fd('0x11')])[_0xc5fd('0x13')](function(_0x40b0f8){if(_0x40b0f8){_0x5a2eb4[_0xc5fd('0x14')]=_0x40b0f8['id'];}utils[_0xc5fd('0x15')]('CreateVoiceCallReport',_0x5a2eb4);});}else{utils[_0xc5fd('0x15')](_0xc5fd('0x16'),_0x5a2eb4);}if(channels[_0x5a2eb4[_0xc5fd('0x8')]]){delete channels[_0x5a2eb4[_0xc5fd('0x8')]];}else if(_0x5d86e5&&channels[_0x5d86e5]){if(!transfers['blinds'][_0x5d86e5]['recording'])delete transfers['blinds'][_0x5d86e5];delete channels[_0x5d86e5];}}exports['newchannel']=function(_0x508539){try{utils[_0xc5fd('0x17')](util[_0xc5fd('0xb')](_0xc5fd('0x18'),_0x508539[_0xc5fd('0x8')]),_0x508539);if(_0x508539[_0xc5fd('0x8')]==_0x508539[_0xc5fd('0x19')]&&_0x508539[_0xc5fd('0xd')]!='OutgoingSpoolFailed'){utils[_0xc5fd('0xa')](util[_0xc5fd('0xb')](_0xc5fd('0x1a'),_0x508539[_0xc5fd('0x8')],_0x508539[_0xc5fd('0x1b')],_0x508539['exten']));channels[_0x508539[_0xc5fd('0x8')]]={'uniqueid':_0x508539[_0xc5fd('0x8')],'accountcode':_0x508539[_0xc5fd('0x11')],'source':_0x508539[_0xc5fd('0x1c')],'destination':_0x508539['exten'],'destinationcontext':_0x508539['context'],'channel':_0x508539[_0xc5fd('0xd')],'starttime':utils[_0xc5fd('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xc5fd('0x4'),'amaflags':_0xc5fd('0x1e')};}}catch(_0x334401){utils[_0xc5fd('0x1f')](util['format'](_0xc5fd('0x18'),_0x508539[_0xc5fd('0x8')]),_0x334401);}};exports[_0xc5fd('0x20')]=function(_0x18c9c7){try{utils[_0xc5fd('0x17')](util[_0xc5fd('0xb')](_0xc5fd('0x21'),_0x18c9c7['uniqueid']),_0x18c9c7);if(!_[_0xc5fd('0x22')](channels[_0x18c9c7['uniqueid']])&&_0x18c9c7[_0xc5fd('0x23')]==0x6){utils[_0xc5fd('0xa')](util[_0xc5fd('0xb')](_0xc5fd('0x24'),_0x18c9c7['uniqueid'],_0x18c9c7[_0xc5fd('0x1b')],_0x18c9c7[_0xc5fd('0xd')]));if(_[_0xc5fd('0x22')](channels[_0x18c9c7[_0xc5fd('0x8')]][_0xc5fd('0x25')])){channels[_0x18c9c7[_0xc5fd('0x8')]]['systemanswertime']=utils[_0xc5fd('0x1d')]();}}else if(!_['isNil'](channels[_0x18c9c7['linkedid']])&&_0x18c9c7[_0xc5fd('0x23')]==0x6&&_0x18c9c7[_0xc5fd('0x1b')]!=_0xc5fd('0x26')){utils[_0xc5fd('0xa')](util[_0xc5fd('0xb')](_0xc5fd('0x27'),_0x18c9c7[_0xc5fd('0x8')],_0x18c9c7[_0xc5fd('0x19')],_0x18c9c7['context'],_0x18c9c7[_0xc5fd('0xd')]));channels[_0x18c9c7[_0xc5fd('0x19')]][_0xc5fd('0x11')]=_0x18c9c7[_0xc5fd('0x11')];channels[_0x18c9c7[_0xc5fd('0x19')]][_0xc5fd('0x28')]=_0x18c9c7[_0xc5fd('0xd')];if(_[_0xc5fd('0x22')](channels[_0x18c9c7[_0xc5fd('0x19')]][_0xc5fd('0x29')])){channels[_0x18c9c7[_0xc5fd('0x19')]][_0xc5fd('0x29')]=utils['now']();}channels[_0x18c9c7[_0xc5fd('0x19')]][_0xc5fd('0x2a')]=dispositions[_[_0xc5fd('0x2b')](_0x18c9c7[_0xc5fd('0x23')])]||_0xc5fd('0x6');}}catch(_0x3a003b){utils[_0xc5fd('0x1f')](util[_0xc5fd('0xb')](_0xc5fd('0x21'),_0x18c9c7['uniqueid']),_0x3a003b);}};exports[_0xc5fd('0x2c')]=function(_0x14d1c7){try{if(!_[_0xc5fd('0x22')](channels[_0x14d1c7[_0xc5fd('0x8')]])){utils[_0xc5fd('0x17')](util[_0xc5fd('0xb')](_0xc5fd('0x2d'),_0x14d1c7['uniqueid']),_0x14d1c7);if(_[_0xc5fd('0x22')](channels[_0x14d1c7[_0xc5fd('0x8')]]['callerid'])){channels[_0x14d1c7[_0xc5fd('0x8')]]['callerid']=_0x14d1c7[_0xc5fd('0x2e')]+'\x20<'+_0x14d1c7[_0xc5fd('0x1c')]+'>';}utils[_0xc5fd('0xa')](util['format'](_0xc5fd('0x2f'),_0x14d1c7[_0xc5fd('0x8')],channels[_0x14d1c7['uniqueid']][_0xc5fd('0x30')],_0x14d1c7[_0xc5fd('0x31')]));channels[_0x14d1c7[_0xc5fd('0x8')]][_0xc5fd('0x32')]=utils[_0xc5fd('0x1d')]();channels[_0x14d1c7[_0xc5fd('0x8')]]['duration']=utils[_0xc5fd('0x33')](channels[_0x14d1c7[_0xc5fd('0x8')]][_0xc5fd('0x32')],channels[_0x14d1c7[_0xc5fd('0x8')]]['starttime']);channels[_0x14d1c7['uniqueid']]['billableseconds']=channels[_0x14d1c7[_0xc5fd('0x8')]][_0xc5fd('0x29')]?utils[_0xc5fd('0x33')](channels[_0x14d1c7[_0xc5fd('0x8')]][_0xc5fd('0x32')],channels[_0x14d1c7[_0xc5fd('0x8')]][_0xc5fd('0x29')]):0x0;writeDB(channels[_0x14d1c7[_0xc5fd('0x8')]]);}}catch(_0x792ed6){utils['error'](util['format'](_0xc5fd('0x2d'),_0x14d1c7['uniqueid']),_0x792ed6);}};exports[_0xc5fd('0x34')]=function(_0x1e444b){try{if(!_[_0xc5fd('0x22')](channels[_0x1e444b['localtwolinkedid']])){utils[_0xc5fd('0x17')](util[_0xc5fd('0xb')]('[%s][calls][attendedtransfer]',_0x1e444b[_0xc5fd('0x35')]),_0x1e444b);if(channels[_0x1e444b[_0xc5fd('0x36')]]['channel']==_0x1e444b[_0xc5fd('0x37')]){utils['info'](util[_0xc5fd('0xb')](_0xc5fd('0x38'),_0x1e444b['origtransfereruniqueid'],_0x1e444b[_0xc5fd('0x36')],_0x1e444b[_0xc5fd('0x39')]));channels[_0x1e444b[_0xc5fd('0x36')]]['destinationchannel']=_0x1e444b[_0xc5fd('0x39')];channels[_0x1e444b[_0xc5fd('0x36')]]['userfield']='_attended';}else if(channels[_0x1e444b[_0xc5fd('0x36')]]['channel']=_0x1e444b['transfertargetchannel']){utils['info'](util[_0xc5fd('0xb')](_0xc5fd('0x38'),_0x1e444b[_0xc5fd('0x35')],_0x1e444b[_0xc5fd('0x36')],_0x1e444b[_0xc5fd('0x3a')]));channels[_0x1e444b[_0xc5fd('0x36')]]['destinationchannel']=_0x1e444b['origtransfererchannel'];channels[_0x1e444b['localtwolinkedid']][_0xc5fd('0x3b')]=_0xc5fd('0x3c');}}}catch(_0x31ccc1){utils['error'](util[_0xc5fd('0xb')]('[%s][calls][attendedtransfer]',_0x1e444b[_0xc5fd('0x35')]),_0x31ccc1);}};exports[_0xc5fd('0x3d')]=function(_0x39fba5){try{if(!_[_0xc5fd('0x22')](channels[_0x39fba5[_0xc5fd('0x8')]])){utils[_0xc5fd('0x17')](util['format'](_0xc5fd('0x3e'),_0x39fba5[_0xc5fd('0x8')]),_0x39fba5);channels[_0x39fba5['uniqueid']]['musiconholdstartAt']=utils[_0xc5fd('0x1d')]();utils['info'](util['format'](_0xc5fd('0x3f'),_0x39fba5[_0xc5fd('0x8')],channels[_0x39fba5['uniqueid']][_0xc5fd('0x40')]));}}catch(_0x53fd29){utils['error'](util[_0xc5fd('0xb')](_0xc5fd('0x3e'),_0x39fba5[_0xc5fd('0x8')]),_0x53fd29);}};exports[_0xc5fd('0x41')]=function(_0x1940e3){try{if(!_[_0xc5fd('0x22')](channels[_0x1940e3[_0xc5fd('0x8')]])){utils[_0xc5fd('0x17')](util[_0xc5fd('0xb')](_0xc5fd('0x42'),_0x1940e3[_0xc5fd('0x8')]),_0x1940e3);if(!_['isNil'](channels[_0x1940e3[_0xc5fd('0x8')]][_0xc5fd('0x40')])){channels[_0x1940e3[_0xc5fd('0x8')]]['mohtime']+=utils[_0xc5fd('0x33')](utils[_0xc5fd('0x1d')](),channels[_0x1940e3[_0xc5fd('0x8')]][_0xc5fd('0x40')]);utils['info'](util[_0xc5fd('0xb')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x1940e3['uniqueid'],channels[_0x1940e3[_0xc5fd('0x8')]][_0xc5fd('0x43')]));delete channels[_0x1940e3[_0xc5fd('0x8')]][_0xc5fd('0x40')];}}}catch(_0x275e18){utils['error'](util['format'](_0xc5fd('0x42'),_0x1940e3[_0xc5fd('0x8')]),_0x275e18);}};exports['varset']=function(_0x4e9495){try{if(!_['isNil'](channels[_0x4e9495[_0xc5fd('0x8')]])){utils['debug'](util[_0xc5fd('0xb')](_0xc5fd('0x44'),_0x4e9495[_0xc5fd('0x8')]),_0x4e9495);if(!_[_0xc5fd('0x22')](_0x4e9495[_0xc5fd('0x45')][_0xc5fd('0x46')])){utils[_0xc5fd('0xa')](util['format'](_0xc5fd('0x47'),_0x4e9495[_0xc5fd('0x8')],_0x4e9495[_0xc5fd('0x48')]));channels[_0x4e9495['uniqueid']]['source']=_0x4e9495[_0xc5fd('0x48')];}if(!_[_0xc5fd('0x22')](_0x4e9495[_0xc5fd('0x45')][_0xc5fd('0x49')])){utils[_0xc5fd('0xa')](util[_0xc5fd('0xb')](_0xc5fd('0x4a'),_0x4e9495[_0xc5fd('0x8')],_0x4e9495[_0xc5fd('0x48')]));channels[_0x4e9495[_0xc5fd('0x8')]][_0xc5fd('0x4b')]=_0x4e9495[_0xc5fd('0x48')];channels[_0x4e9495[_0xc5fd('0x8')]][_0xc5fd('0x30')]='\x22'+_0x4e9495[_0xc5fd('0x48')]+_0xc5fd('0x4c')+_0x4e9495['value']+'>';}if(!_[_0xc5fd('0x22')](_0x4e9495[_0xc5fd('0x45')][_0xc5fd('0x4d')])||!_['isNil'](_0x4e9495[_0xc5fd('0x45')][_0xc5fd('0x4e')])){utils[_0xc5fd('0xa')](util[_0xc5fd('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4e9495[_0xc5fd('0x8')],!_[_0xc5fd('0x22')](_0x4e9495['variable'][_0xc5fd('0x4d')])?'xmd-callerid-preview':_0xc5fd('0x4e'),_0x4e9495[_0xc5fd('0x48')]));channels[_0x4e9495[_0xc5fd('0x8')]][_0xc5fd('0x30')]=_0x4e9495[_0xc5fd('0x48')];}if(!_[_0xc5fd('0x22')](_0x4e9495['variable']['xmd-queue'])||!_[_0xc5fd('0x22')](_0x4e9495[_0xc5fd('0x45')][_0xc5fd('0x4f')])){utils[_0xc5fd('0xa')](util[_0xc5fd('0xb')](_0xc5fd('0x50'),_0x4e9495[_0xc5fd('0x8')],!_[_0xc5fd('0x22')](_0x4e9495['variable'][_0xc5fd('0x51')])?_0xc5fd('0x51'):'xmcs-queue',_0x4e9495['value']));channels[_0x4e9495[_0xc5fd('0x8')]][_0xc5fd('0x52')]=_0xc5fd('0x53');channels[_0x4e9495[_0xc5fd('0x8')]][_0xc5fd('0x54')]=_0x4e9495[_0xc5fd('0x48')];channels[_0x4e9495[_0xc5fd('0x8')]][_0xc5fd('0xe')]=!![];}if(!_['isNil'](_0x4e9495[_0xc5fd('0x45')][_0xc5fd('0x55')])){utils['info'](util[_0xc5fd('0xb')](_0xc5fd('0x56'),_0x4e9495['uniqueid'],_0x4e9495[_0xc5fd('0x48')]));channels[_0x4e9495[_0xc5fd('0x8')]][_0xc5fd('0x57')]=_0x4e9495[_0xc5fd('0x48')];}if(!_[_0xc5fd('0x22')](_0x4e9495[_0xc5fd('0x45')][_0xc5fd('0x58')])){utils[_0xc5fd('0xa')](util[_0xc5fd('0xb')](_0xc5fd('0x59'),_0x4e9495['uniqueid'],_0x4e9495['value']));channels[_0x4e9495[_0xc5fd('0x8')]][_0xc5fd('0x5a')]=_0x4e9495[_0xc5fd('0x48')];}if(!_['isNil'](_0x4e9495[_0xc5fd('0x45')][_0xc5fd('0x5b')])){utils[_0xc5fd('0xa')](util['format'](_0xc5fd('0x5c'),_0x4e9495[_0xc5fd('0x8')],_0x4e9495[_0xc5fd('0x48')]));channels[_0x4e9495['uniqueid']]['routeid']=_0x4e9495[_0xc5fd('0x48')];}if(!_[_0xc5fd('0x22')](_0x4e9495['variable'][_0xc5fd('0x5d')])){utils['info'](util[_0xc5fd('0xb')](_0xc5fd('0x5e'),_0x4e9495['uniqueid'],_0x4e9495['value']));channels[_0x4e9495[_0xc5fd('0x8')]][_0xc5fd('0x5d')]=_0x4e9495[_0xc5fd('0x48')];}}}catch(_0x152212){utils[_0xc5fd('0x1f')](util[_0xc5fd('0xb')]('[%s][calls][varset]',_0x4e9495[_0xc5fd('0x8')]),_0x152212);}};exports[_0xc5fd('0x5f')]=function(_0x418e12){try{if(!_[_0xc5fd('0x22')](channels[_0x418e12[_0xc5fd('0x8')]])){utils[_0xc5fd('0x17')](util[_0xc5fd('0xb')](_0xc5fd('0x60'),_0x418e12[_0xc5fd('0x8')]),_0x418e12);utils['info'](util[_0xc5fd('0xb')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x418e12[_0xc5fd('0x8')],_0x418e12[_0xc5fd('0x61')],_0x418e12[_0xc5fd('0x62')]));if(_0x418e12['application'][_0xc5fd('0x63')]()=='set'&&_['startsWith'](_0x418e12[_0xc5fd('0x62')][_0xc5fd('0x63')](),_0xc5fd('0x64'))){var _0x34ef9d=_0x418e12[_0xc5fd('0x62')][_0xc5fd('0x65')]('=');var _0x4b43fc=_0x34ef9d[0x0][_0xc5fd('0x66')](_0x34ef9d[0x0][_0xc5fd('0x67')]('(')+0x1,_0x34ef9d[0x0][_0xc5fd('0x67')](')'));var _0x2e36a4=_0x34ef9d[0x1];channels[_0x418e12[_0xc5fd('0x8')]][_0x4b43fc]=_0x2e36a4;}if(!_['includes']([_0xc5fd('0x2c'),_0xc5fd('0x68'),_0xc5fd('0x69'),_0xc5fd('0x6a'),_0xc5fd('0x6b')],_0x418e12[_0xc5fd('0x61')][_0xc5fd('0x63')]())){channels[_0x418e12['uniqueid']][_0xc5fd('0x52')]=_0x418e12[_0xc5fd('0x61')];channels[_0x418e12[_0xc5fd('0x8')]][_0xc5fd('0x54')]=_0x418e12['appdata'];}}}catch(_0x487725){utils['error'](util[_0xc5fd('0xb')](_0xc5fd('0x60'),_0x418e12[_0xc5fd('0x8')]),_0x487725);}}; \ No newline at end of file +var _0x0ef4=['[%s][calls][newchannel]','OutgoingSpoolFailed','context','exten','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','info','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','destinationchannel','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','starttime','billableseconds','answertime','endtime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','split','substring','lastIndexOf','includes','execif','gotoif','util','./utils','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','blinds','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug'];(function(_0x3b1459,_0x3fbded){var _0x134fac=function(_0x30bc2d){while(--_0x30bc2d){_0x3b1459['push'](_0x3b1459['shift']());}};_0x134fac(++_0x3fbded);}(_0x0ef4,0xc7));var _0x40ef=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x0ef4[_0x29d94e];return _0x106237;};'use strict';var _=require('lodash');var util=require(_0x40ef('0x0'));var utils=require(_0x40ef('0x1'));var transfers=require(_0x40ef('0x2'));var dispositions=['NO\x20ANSWER','FAILED',_0x40ef('0x3'),_0x40ef('0x4'),_0x40ef('0x4'),'NO\x20ANSWER',_0x40ef('0x5'),'BUSY','FAILED',_0x40ef('0x3'),_0x40ef('0x3')];var channels={};function writeDB(_0x3f5a83){var _0x7d0e82;if(transfers[_0x40ef('0x6')][_0x3f5a83[_0x40ef('0x7')]]){_0x7d0e82=_0x3f5a83[_0x40ef('0x7')];_0x3f5a83[_0x40ef('0x7')]=transfers[_0x40ef('0x6')][_0x3f5a83['uniqueid']][_0x40ef('0x8')];}utils['info'](util[_0x40ef('0x9')](_0x40ef('0xa'),_0x3f5a83[_0x40ef('0x7')],_0x3f5a83[_0x40ef('0xb')],_0x3f5a83['queue'],_0x3f5a83[_0x40ef('0xc')],_0x3f5a83[_0x40ef('0xd')],_0x3f5a83[_0x40ef('0xe')],_0x3f5a83[_0x40ef('0xf')],_0x3f5a83[_0x40ef('0x10')]));if(_0x3f5a83[_0x40ef('0x11')]){utils[_0x40ef('0x12')](_0x3f5a83[_0x40ef('0x11')])[_0x40ef('0x13')](function(_0x3d5a16){if(_0x3d5a16){_0x3f5a83[_0x40ef('0x14')]=_0x3d5a16['id'];}utils[_0x40ef('0x15')]('CreateVoiceCallReport',_0x3f5a83);});}else{utils['request'](_0x40ef('0x16'),_0x3f5a83);}if(channels[_0x3f5a83['uniqueid']]){delete channels[_0x3f5a83[_0x40ef('0x7')]];}else if(_0x7d0e82&&channels[_0x7d0e82]){if(!transfers[_0x40ef('0x6')][_0x7d0e82]['recording'])delete transfers[_0x40ef('0x6')][_0x7d0e82];delete channels[_0x7d0e82];}}exports[_0x40ef('0x17')]=function(_0x5bd750){try{utils[_0x40ef('0x18')](util['format'](_0x40ef('0x19'),_0x5bd750[_0x40ef('0x7')]),_0x5bd750);if(_0x5bd750[_0x40ef('0x7')]==_0x5bd750['linkedid']&&_0x5bd750['channel']!=_0x40ef('0x1a')){utils['info'](util[_0x40ef('0x9')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x5bd750[_0x40ef('0x7')],_0x5bd750[_0x40ef('0x1b')],_0x5bd750['exten']));channels[_0x5bd750[_0x40ef('0x7')]]={'uniqueid':_0x5bd750[_0x40ef('0x7')],'accountcode':_0x5bd750[_0x40ef('0x11')],'source':_0x5bd750['calleridnum'],'destination':_0x5bd750[_0x40ef('0x1c')],'destinationcontext':_0x5bd750['context'],'channel':_0x5bd750[_0x40ef('0xb')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x40ef('0x4'),'amaflags':_0x40ef('0x1d')};}}catch(_0x33ffdf){utils[_0x40ef('0x1e')](util[_0x40ef('0x9')](_0x40ef('0x19'),_0x5bd750[_0x40ef('0x7')]),_0x33ffdf);}};exports[_0x40ef('0x1f')]=function(_0xcb7712){try{utils[_0x40ef('0x18')](util[_0x40ef('0x9')](_0x40ef('0x20'),_0xcb7712[_0x40ef('0x7')]),_0xcb7712);if(!_[_0x40ef('0x21')](channels[_0xcb7712['uniqueid']])&&_0xcb7712[_0x40ef('0x22')]==0x6){utils[_0x40ef('0x23')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0xcb7712[_0x40ef('0x7')],_0xcb7712[_0x40ef('0x1b')],_0xcb7712['channel']));if(_['isNil'](channels[_0xcb7712['uniqueid']][_0x40ef('0x24')])){channels[_0xcb7712[_0x40ef('0x7')]]['systemanswertime']=utils[_0x40ef('0x25')]();}}else if(!_[_0x40ef('0x21')](channels[_0xcb7712['linkedid']])&&_0xcb7712[_0x40ef('0x22')]==0x6&&_0xcb7712['context']!=_0x40ef('0x26')){utils[_0x40ef('0x23')](util[_0x40ef('0x9')](_0x40ef('0x27'),_0xcb7712[_0x40ef('0x7')],_0xcb7712[_0x40ef('0x28')],_0xcb7712[_0x40ef('0x1b')],_0xcb7712[_0x40ef('0xb')]));channels[_0xcb7712[_0x40ef('0x28')]][_0x40ef('0x11')]=_0xcb7712['accountcode'];channels[_0xcb7712['linkedid']][_0x40ef('0x29')]=_0xcb7712[_0x40ef('0xb')];if(_['isNil'](channels[_0xcb7712['linkedid']]['answertime'])){channels[_0xcb7712[_0x40ef('0x28')]]['answertime']=utils['now']();}channels[_0xcb7712[_0x40ef('0x28')]][_0x40ef('0x2a')]=dispositions[_[_0x40ef('0x2b')](_0xcb7712['channelstate'])]||_0x40ef('0x5');}}catch(_0x211e42){utils[_0x40ef('0x1e')](util[_0x40ef('0x9')]('[%s][calls][newstate]',_0xcb7712['uniqueid']),_0x211e42);}};exports[_0x40ef('0x2c')]=function(_0x4c23a3){try{if(!_['isNil'](channels[_0x4c23a3[_0x40ef('0x7')]])){utils[_0x40ef('0x18')](util['format'](_0x40ef('0x2d'),_0x4c23a3['uniqueid']),_0x4c23a3);if(_[_0x40ef('0x21')](channels[_0x4c23a3['uniqueid']][_0x40ef('0x2e')])){channels[_0x4c23a3[_0x40ef('0x7')]][_0x40ef('0x2e')]=_0x4c23a3[_0x40ef('0x2f')]+'\x20<'+_0x4c23a3['calleridnum']+'>';}utils[_0x40ef('0x23')](util['format'](_0x40ef('0x30'),_0x4c23a3['uniqueid'],channels[_0x4c23a3['uniqueid']][_0x40ef('0x2e')],_0x4c23a3[_0x40ef('0x31')]));channels[_0x4c23a3[_0x40ef('0x7')]]['endtime']=utils[_0x40ef('0x25')]();channels[_0x4c23a3['uniqueid']][_0x40ef('0x32')]=utils[_0x40ef('0x33')](channels[_0x4c23a3['uniqueid']]['endtime'],channels[_0x4c23a3['uniqueid']][_0x40ef('0x34')]);channels[_0x4c23a3[_0x40ef('0x7')]][_0x40ef('0x35')]=channels[_0x4c23a3[_0x40ef('0x7')]][_0x40ef('0x36')]?utils[_0x40ef('0x33')](channels[_0x4c23a3[_0x40ef('0x7')]][_0x40ef('0x37')],channels[_0x4c23a3[_0x40ef('0x7')]][_0x40ef('0x36')]):0x0;writeDB(channels[_0x4c23a3[_0x40ef('0x7')]]);}}catch(_0x22cbcd){utils[_0x40ef('0x1e')](util['format']('[%s][calls][hangup]',_0x4c23a3[_0x40ef('0x7')]),_0x22cbcd);}};exports[_0x40ef('0x38')]=function(_0x2590da){try{if(!_[_0x40ef('0x21')](channels[_0x2590da[_0x40ef('0x39')]])){utils['debug'](util[_0x40ef('0x9')](_0x40ef('0x3a'),_0x2590da[_0x40ef('0x3b')]),_0x2590da);if(channels[_0x2590da[_0x40ef('0x39')]][_0x40ef('0xb')]==_0x2590da['transfereechannel']){utils[_0x40ef('0x23')](util[_0x40ef('0x9')](_0x40ef('0x3c'),_0x2590da[_0x40ef('0x3b')],_0x2590da[_0x40ef('0x39')],_0x2590da[_0x40ef('0x3d')]));channels[_0x2590da[_0x40ef('0x39')]][_0x40ef('0x29')]=_0x2590da['secondtransfererchannel'];channels[_0x2590da[_0x40ef('0x39')]][_0x40ef('0x3e')]=_0x40ef('0x3f');}else if(channels[_0x2590da['localtwolinkedid']][_0x40ef('0xb')]=_0x2590da[_0x40ef('0x40')]){utils[_0x40ef('0x23')](util['format'](_0x40ef('0x3c'),_0x2590da[_0x40ef('0x3b')],_0x2590da['localtwolinkedid'],_0x2590da[_0x40ef('0x41')]));channels[_0x2590da[_0x40ef('0x39')]][_0x40ef('0x29')]=_0x2590da[_0x40ef('0x41')];channels[_0x2590da['localtwolinkedid']][_0x40ef('0x3e')]='_attended';}}}catch(_0x377732){utils[_0x40ef('0x1e')](util[_0x40ef('0x9')](_0x40ef('0x3a'),_0x2590da[_0x40ef('0x3b')]),_0x377732);}};exports['musiconholdstart']=function(_0x2458fc){try{if(!_[_0x40ef('0x21')](channels[_0x2458fc[_0x40ef('0x7')]])){utils['debug'](util[_0x40ef('0x9')](_0x40ef('0x42'),_0x2458fc[_0x40ef('0x7')]),_0x2458fc);channels[_0x2458fc[_0x40ef('0x7')]][_0x40ef('0x43')]=utils['now']();utils[_0x40ef('0x23')](util[_0x40ef('0x9')](_0x40ef('0x44'),_0x2458fc[_0x40ef('0x7')],channels[_0x2458fc[_0x40ef('0x7')]][_0x40ef('0x43')]));}}catch(_0x46c5bf){utils[_0x40ef('0x1e')](util[_0x40ef('0x9')](_0x40ef('0x42'),_0x2458fc['uniqueid']),_0x46c5bf);}};exports[_0x40ef('0x45')]=function(_0x173d8b){try{if(!_[_0x40ef('0x21')](channels[_0x173d8b[_0x40ef('0x7')]])){utils['debug'](util[_0x40ef('0x9')](_0x40ef('0x46'),_0x173d8b['uniqueid']),_0x173d8b);if(!_[_0x40ef('0x21')](channels[_0x173d8b['uniqueid']][_0x40ef('0x43')])){channels[_0x173d8b[_0x40ef('0x7')]][_0x40ef('0x47')]+=utils['diffTime'](utils['now'](),channels[_0x173d8b[_0x40ef('0x7')]][_0x40ef('0x43')]);utils['info'](util['format']('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x173d8b[_0x40ef('0x7')],channels[_0x173d8b['uniqueid']][_0x40ef('0x47')]));delete channels[_0x173d8b[_0x40ef('0x7')]][_0x40ef('0x43')];}}}catch(_0x55c5c6){utils[_0x40ef('0x1e')](util[_0x40ef('0x9')](_0x40ef('0x46'),_0x173d8b['uniqueid']),_0x55c5c6);}};exports[_0x40ef('0x48')]=function(_0x176e27){try{if(!_['isNil'](channels[_0x176e27[_0x40ef('0x7')]])){utils[_0x40ef('0x18')](util['format']('[%s][calls][varset]',_0x176e27[_0x40ef('0x7')]),_0x176e27);if(!_[_0x40ef('0x21')](_0x176e27[_0x40ef('0x49')][_0x40ef('0x4a')])){utils[_0x40ef('0x23')](util['format'](_0x40ef('0x4b'),_0x176e27['uniqueid'],_0x176e27[_0x40ef('0x4c')]));channels[_0x176e27[_0x40ef('0x7')]][_0x40ef('0x4d')]=_0x176e27[_0x40ef('0x4c')];}if(!_[_0x40ef('0x21')](_0x176e27[_0x40ef('0x49')][_0x40ef('0x4e')])){utils[_0x40ef('0x23')](util['format'](_0x40ef('0x4f'),_0x176e27[_0x40ef('0x7')],_0x176e27[_0x40ef('0x4c')]));channels[_0x176e27[_0x40ef('0x7')]][_0x40ef('0x50')]=_0x176e27[_0x40ef('0x4c')];channels[_0x176e27[_0x40ef('0x7')]][_0x40ef('0x2e')]='\x22'+_0x176e27['value']+_0x40ef('0x51')+_0x176e27[_0x40ef('0x4c')]+'>';}if(!_[_0x40ef('0x21')](_0x176e27[_0x40ef('0x49')][_0x40ef('0x52')])||!_[_0x40ef('0x21')](_0x176e27[_0x40ef('0x49')]['xmd-callerid'])){utils[_0x40ef('0x23')](util[_0x40ef('0x9')](_0x40ef('0x53'),_0x176e27[_0x40ef('0x7')],!_['isNil'](_0x176e27['variable'][_0x40ef('0x52')])?_0x40ef('0x52'):'xmd-callerid',_0x176e27[_0x40ef('0x4c')]));channels[_0x176e27[_0x40ef('0x7')]][_0x40ef('0x2e')]=_0x176e27['value'];}if(!_[_0x40ef('0x21')](_0x176e27[_0x40ef('0x49')]['xmd-queue'])||!_[_0x40ef('0x21')](_0x176e27[_0x40ef('0x49')][_0x40ef('0x54')])){utils[_0x40ef('0x23')](util[_0x40ef('0x9')](_0x40ef('0x53'),_0x176e27['uniqueid'],!_[_0x40ef('0x21')](_0x176e27[_0x40ef('0x49')][_0x40ef('0x55')])?'xmd-queue':_0x40ef('0x54'),_0x176e27['value']));channels[_0x176e27[_0x40ef('0x7')]][_0x40ef('0x56')]=_0x40ef('0x57');channels[_0x176e27['uniqueid']][_0x40ef('0x58')]=_0x176e27[_0x40ef('0x4c')];channels[_0x176e27['uniqueid']][_0x40ef('0x59')]=!![];}if(!_[_0x40ef('0x21')](_0x176e27[_0x40ef('0x49')]['xmd-contactid'])){utils[_0x40ef('0x23')](util[_0x40ef('0x9')](_0x40ef('0x5a'),_0x176e27[_0x40ef('0x7')],_0x176e27[_0x40ef('0x4c')]));channels[_0x176e27[_0x40ef('0x7')]][_0x40ef('0x5b')]=_0x176e27[_0x40ef('0x4c')];}if(!_[_0x40ef('0x21')](_0x176e27['variable'][_0x40ef('0x5c')])){utils[_0x40ef('0x23')](util[_0x40ef('0x9')](_0x40ef('0x5d'),_0x176e27[_0x40ef('0x7')],_0x176e27['value']));channels[_0x176e27[_0x40ef('0x7')]][_0x40ef('0x5e')]=_0x176e27['value'];}if(!_[_0x40ef('0x21')](_0x176e27[_0x40ef('0x49')][_0x40ef('0x5f')])){utils[_0x40ef('0x23')](util[_0x40ef('0x9')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x176e27[_0x40ef('0x7')],_0x176e27['value']));channels[_0x176e27[_0x40ef('0x7')]]['routeid']=_0x176e27[_0x40ef('0x4c')];}if(!_[_0x40ef('0x21')](_0x176e27[_0x40ef('0x49')]['sipcallid'])){utils[_0x40ef('0x23')](util['format'](_0x40ef('0x60'),_0x176e27['uniqueid'],_0x176e27[_0x40ef('0x4c')]));channels[_0x176e27[_0x40ef('0x7')]][_0x40ef('0x61')]=_0x176e27[_0x40ef('0x4c')];}}}catch(_0x8e7390){utils[_0x40ef('0x1e')](util[_0x40ef('0x9')]('[%s][calls][varset]',_0x176e27[_0x40ef('0x7')]),_0x8e7390);}};exports[_0x40ef('0x62')]=function(_0x16c774){try{if(!_[_0x40ef('0x21')](channels[_0x16c774[_0x40ef('0x7')]])){utils['debug'](util[_0x40ef('0x9')](_0x40ef('0x63'),_0x16c774['uniqueid']),_0x16c774);utils['info'](util[_0x40ef('0x9')](_0x40ef('0x64'),_0x16c774[_0x40ef('0x7')],_0x16c774['application'],_0x16c774[_0x40ef('0x65')]));if(_0x16c774[_0x40ef('0x66')][_0x40ef('0x67')]()==_0x40ef('0x68')&&_[_0x40ef('0x69')](_0x16c774[_0x40ef('0x65')][_0x40ef('0x67')](),'cdr')){var _0x2578b0=_0x16c774[_0x40ef('0x65')][_0x40ef('0x6a')]('=');var _0x39eba8=_0x2578b0[0x0][_0x40ef('0x6b')](_0x2578b0[0x0][_0x40ef('0x6c')]('(')+0x1,_0x2578b0[0x0]['lastIndexOf'](')'));var _0x43678e=_0x2578b0[0x1];channels[_0x16c774['uniqueid']][_0x39eba8]=_0x43678e;}if(!_[_0x40ef('0x6d')]([_0x40ef('0x2c'),'noop',_0x40ef('0x6e'),_0x40ef('0x68'),_0x40ef('0x6f')],_0x16c774[_0x40ef('0x66')][_0x40ef('0x67')]())){channels[_0x16c774['uniqueid']][_0x40ef('0x56')]=_0x16c774[_0x40ef('0x66')];channels[_0x16c774['uniqueid']][_0x40ef('0x58')]=_0x16c774[_0x40ef('0x65')];}}}catch(_0x5890ab){utils[_0x40ef('0x1e')](util[_0x40ef('0x9')](_0x40ef('0x63'),_0x16c774[_0x40ef('0x7')]),_0x5890ab);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 02d78f3..95def8a 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 _0x7a15=['[core]\x20fullybooted','error','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted'];(function(_0x374d74,_0x28a455){var _0x48d720=function(_0x46d3d1){while(--_0x46d3d1){_0x374d74['push'](_0x374d74['shift']());}};_0x48d720(++_0x28a455);}(_0x7a15,0x1c7));var _0x57a1=function(_0x3fb5e9,_0x91ac0f){_0x3fb5e9=_0x3fb5e9-0x0;var _0x2e4114=_0x7a15[_0x3fb5e9];return _0x2e4114;};'use strict';var utils=require(_0x57a1('0x0'));exports[_0x57a1('0x1')]=function(){utils[_0x57a1('0x2')](_0x57a1('0x3'));};exports[_0x57a1('0x4')]=function(){utils['info'](_0x57a1('0x5'));};exports[_0x57a1('0x6')]=function(){utils[_0x57a1('0x2')](_0x57a1('0x7'));};exports['error']=function(_0x4850ee){utils[_0x57a1('0x8')]('[core]\x20error',_0x4850ee);};exports['close']=function(){utils[_0x57a1('0x2')](_0x57a1('0x9'));};exports[_0x57a1('0xa')]=function(_0x1a106e){}; \ No newline at end of file +var _0x76dc=['[core]\x20close','managerevent','connect','[core]\x20connected','shutdown','info','[core]\x20shutdown','[core]\x20fullybooted','error','[core]\x20error','close'];(function(_0xc8de2f,_0x49bd30){var _0x46d1f0=function(_0x75a2bc){while(--_0x75a2bc){_0xc8de2f['push'](_0xc8de2f['shift']());}};_0x46d1f0(++_0x49bd30);}(_0x76dc,0xe9));var _0xc76d=function(_0x382f20,_0x22cadd){_0x382f20=_0x382f20-0x0;var _0x321e38=_0x76dc[_0x382f20];return _0x321e38;};'use strict';var utils=require('./utils');exports[_0xc76d('0x0')]=function(){utils['info'](_0xc76d('0x1'));};exports[_0xc76d('0x2')]=function(){utils[_0xc76d('0x3')](_0xc76d('0x4'));};exports['fullybooted']=function(){utils['info'](_0xc76d('0x5'));};exports[_0xc76d('0x6')]=function(_0x434c22){utils['error'](_0xc76d('0x7'),_0x434c22);};exports[_0xc76d('0x8')]=function(){utils[_0xc76d('0x3')](_0xc76d('0x9'));};exports[_0xc76d('0xa')]=function(_0xb52c10){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 08bbbf3..1ba3203 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 _0x089f=['dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration','diffTime','endtime','billableseconds','lodash','util','./utils','format','uniqueid','channel','calleridnum','connectedlinenum','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','info','application','toLowerCase','set','startsWith','cdr(routeid)','appdata','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','[%s][dials][varset]'];(function(_0x46564e,_0x4e6e0f){var _0x1a682e=function(_0x56d3b9){while(--_0x56d3b9){_0x46564e['push'](_0x46564e['shift']());}};_0x1a682e(++_0x4e6e0f);}(_0x089f,0xe0));var _0xf089=function(_0x2baaf5,_0x3ff892){_0x2baaf5=_0x2baaf5-0x0;var _0x3b5741=_0x089f[_0x2baaf5];return _0x3b5741;};'use strict';var _=require(_0xf089('0x0'));var util=require(_0xf089('0x1'));var utils=require(_0xf089('0x2'));var dials={};function writeDB(_0x56d323){utils['info'](util[_0xf089('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x56d323[_0xf089('0x4')],_0x56d323[_0xf089('0x5')],_0x56d323['dialstring'],_0x56d323[_0xf089('0x6')],_0x56d323[_0xf089('0x7')],_0x56d323['dialstatus']));utils[_0xf089('0x8')](_0xf089('0x9'),_0x56d323);delete dials[_0x56d323['uniqueid']];}exports['newexten']=function(_0x1f1deb){try{utils[_0xf089('0xa')](util['format'](_0xf089('0xb'),_0x1f1deb[_0xf089('0x4')]),_0x1f1deb);utils[_0xf089('0xc')](util[_0xf089('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x1f1deb[_0xf089('0x4')],_0x1f1deb[_0xf089('0xd')],_0x1f1deb['appdata']));if(_0x1f1deb[_0xf089('0xd')][_0xf089('0xe')]()==_0xf089('0xf')&&_[_0xf089('0x10')](_0x1f1deb['appdata'][_0xf089('0xe')](),_0xf089('0x11'))){var _0x358dd1=_0x1f1deb[_0xf089('0x12')]['split']('=');dials[_0x1f1deb[_0xf089('0x4')]]={'routeId':_0x358dd1[0x1]};}}catch(_0x5491b4){utils['error'](util['format'](_0xf089('0xb'),_0x1f1deb[_0xf089('0x4')]),_0x5491b4);}};exports['varset']=function(_0x56f1a2){try{utils[_0xf089('0xa')](util[_0xf089('0x3')]('[%s][dials][varset]',_0x56f1a2[_0xf089('0x4')]),_0x56f1a2);if(!_[_0xf089('0x13')](_0x56f1a2[_0xf089('0x14')][_0xf089('0x15')])){utils['info'](util[_0xf089('0x3')](_0xf089('0x16'),_0x56f1a2[_0xf089('0x4')],_0x56f1a2[_0xf089('0x17')]));dials[_0x56f1a2[_0xf089('0x4')]]={'routeId':_0x56f1a2[_0xf089('0x17')]};}}catch(_0x3b4488){utils[_0xf089('0x18')](util[_0xf089('0x3')](_0xf089('0x19'),_0x56f1a2[_0xf089('0x4')]),_0x3b4488);}};exports[_0xf089('0x1a')]=function(_0x2a7517){try{if(!_[_0xf089('0x13')](dials[_0x2a7517[_0xf089('0x4')]])){utils[_0xf089('0xa')](util[_0xf089('0x3')](_0xf089('0x1b'),_0x2a7517[_0xf089('0x4')]),_0x2a7517);dials[_0x2a7517[_0xf089('0x4')]]=_[_0xf089('0x1c')](dials[_0x2a7517[_0xf089('0x4')]],_0x2a7517);dials[_0x2a7517[_0xf089('0x4')]][_0xf089('0x1d')]=utils[_0xf089('0x1e')]();dials[_0x2a7517[_0xf089('0x4')]][_0xf089('0x1f')]=_0xf089('0x20');utils[_0xf089('0xc')](util[_0xf089('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x2a7517[_0xf089('0x4')],dials[_0x2a7517[_0xf089('0x4')]][_0xf089('0x1d')]));}}catch(_0x566967){utils[_0xf089('0x18')](util[_0xf089('0x3')]('[%s][dials][dialbegin]',_0x2a7517['uniqueid']),_0x566967);}};exports[_0xf089('0x21')]=function(_0x949348){try{if(!_[_0xf089('0x13')](dials[_0x949348[_0xf089('0x4')]])){utils[_0xf089('0xa')](util[_0xf089('0x3')](_0xf089('0x22'),_0x949348['uniqueid']),_0x949348);dials[_0x949348[_0xf089('0x4')]]['dialstatus']=_0x949348['dialstatus'];if(_0x949348[_0xf089('0x23')]==_0xf089('0x24')){dials[_0x949348['uniqueid']]=_['assign'](dials[_0x949348[_0xf089('0x4')]],_0x949348);dials[_0x949348[_0xf089('0x4')]][_0xf089('0x25')]=utils[_0xf089('0x1e')]();dials[_0x949348[_0xf089('0x4')]][_0xf089('0x1f')]=_0xf089('0x26');utils['info'](util[_0xf089('0x3')](_0xf089('0x27'),_0x949348[_0xf089('0x4')],_0x949348['dialstatus'],dials[_0x949348[_0xf089('0x4')]][_0xf089('0x25')]));}else{utils[_0xf089('0xc')](util[_0xf089('0x3')](_0xf089('0x28'),_0x949348[_0xf089('0x4')],_0x949348['dialstatus']));}}}catch(_0x22f26b){utils['error'](util[_0xf089('0x3')](_0xf089('0x22'),_0x949348[_0xf089('0x4')]),_0x22f26b);}};exports[_0xf089('0x29')]=function(_0x30fa6d){try{if(!_[_0xf089('0x13')](dials[_0x30fa6d[_0xf089('0x4')]])){utils['debug'](util[_0xf089('0x3')](_0xf089('0x2a'),_0x30fa6d[_0xf089('0x4')]),_0x30fa6d);utils[_0xf089('0xc')](util[_0xf089('0x3')](_0xf089('0x2b'),_0x30fa6d[_0xf089('0x4')],_0x30fa6d[_0xf089('0x6')],_0x30fa6d[_0xf089('0x2c')],_0x30fa6d[_0xf089('0x2d')]));dials[_0x30fa6d['uniqueid']]=_[_0xf089('0x1c')](dials[_0x30fa6d[_0xf089('0x4')]],{'endtime':utils[_0xf089('0x1e')](),'lastevent':'complete'});dials[_0x30fa6d['uniqueid']][_0xf089('0x2e')]=utils[_0xf089('0x2f')](dials[_0x30fa6d['uniqueid']]['endtime'],dials[_0x30fa6d[_0xf089('0x4')]][_0xf089('0x1d')]);dials[_0x30fa6d[_0xf089('0x4')]]['holdtime']=utils[_0xf089('0x2f')](dials[_0x30fa6d[_0xf089('0x4')]][_0xf089('0x25')]||dials[_0x30fa6d[_0xf089('0x4')]][_0xf089('0x30')],dials[_0x30fa6d[_0xf089('0x4')]][_0xf089('0x1d')]);dials[_0x30fa6d[_0xf089('0x4')]][_0xf089('0x31')]=dials[_0x30fa6d[_0xf089('0x4')]]['answertime']?utils[_0xf089('0x2f')](dials[_0x30fa6d['uniqueid']]['endtime'],dials[_0x30fa6d[_0xf089('0x4')]][_0xf089('0x25')]):0x0;writeDB(dials[_0x30fa6d[_0xf089('0x4')]]);}}catch(_0x26c3d1){utils['error'](util[_0xf089('0x3')](_0xf089('0x2a'),_0x30fa6d[_0xf089('0x4')]),_0x26c3d1);}}; \ No newline at end of file +var _0x6225=['./utils','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','format','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','[%s][dials][newexten]','[%s][dials][varset]','variable','outboundrouteid','value','dialbegin','isNil','[%s][dials][dialbegin]','assign','starttime','called','info','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','calleridname','cause-txt','now','complete','duration','diffTime','endtime','billableseconds','lodash','util'];(function(_0x366564,_0x49d6aa){var _0x522e8b=function(_0x1e5fec){while(--_0x1e5fec){_0x366564['push'](_0x366564['shift']());}};_0x522e8b(++_0x49d6aa);}(_0x6225,0x12a));var _0x5622=function(_0x2e561f,_0x1b1660){_0x2e561f=_0x2e561f-0x0;var _0x4160ea=_0x6225[_0x2e561f];return _0x4160ea;};'use strict';var _=require(_0x5622('0x0'));var util=require(_0x5622('0x1'));var utils=require(_0x5622('0x2'));var dials={};function writeDB(_0xaf2e67){utils['info'](util['format']('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0xaf2e67[_0x5622('0x3')],_0xaf2e67[_0x5622('0x4')],_0xaf2e67[_0x5622('0x5')],_0xaf2e67[_0x5622('0x6')],_0xaf2e67[_0x5622('0x7')],_0xaf2e67['dialstatus']));utils[_0x5622('0x8')](_0x5622('0x9'),_0xaf2e67);delete dials[_0xaf2e67[_0x5622('0x3')]];}exports[_0x5622('0xa')]=function(_0x2441cd){try{utils[_0x5622('0xb')](util[_0x5622('0xc')]('[%s][dials][newexten]',_0x2441cd[_0x5622('0x3')]),_0x2441cd);utils['info'](util[_0x5622('0xc')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x2441cd['uniqueid'],_0x2441cd[_0x5622('0xd')],_0x2441cd['appdata']));if(_0x2441cd[_0x5622('0xd')][_0x5622('0xe')]()==_0x5622('0xf')&&_[_0x5622('0x10')](_0x2441cd[_0x5622('0x11')][_0x5622('0xe')](),_0x5622('0x12'))){var _0xdf15d6=_0x2441cd[_0x5622('0x11')][_0x5622('0x13')]('=');dials[_0x2441cd[_0x5622('0x3')]]={'routeId':_0xdf15d6[0x1]};}}catch(_0x168e4e){utils[_0x5622('0x14')](util[_0x5622('0xc')](_0x5622('0x15'),_0x2441cd['uniqueid']),_0x168e4e);}};exports['varset']=function(_0x3f34c4){try{utils[_0x5622('0xb')](util['format'](_0x5622('0x16'),_0x3f34c4[_0x5622('0x3')]),_0x3f34c4);if(!_['isNil'](_0x3f34c4[_0x5622('0x17')][_0x5622('0x18')])){utils['info'](util[_0x5622('0xc')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x3f34c4[_0x5622('0x3')],_0x3f34c4[_0x5622('0x19')]));dials[_0x3f34c4[_0x5622('0x3')]]={'routeId':_0x3f34c4[_0x5622('0x19')]};}}catch(_0x4336a9){utils[_0x5622('0x14')](util[_0x5622('0xc')](_0x5622('0x16'),_0x3f34c4['uniqueid']),_0x4336a9);}};exports[_0x5622('0x1a')]=function(_0x5afd4c){try{if(!_[_0x5622('0x1b')](dials[_0x5afd4c[_0x5622('0x3')]])){utils['debug'](util['format'](_0x5622('0x1c'),_0x5afd4c[_0x5622('0x3')]),_0x5afd4c);dials[_0x5afd4c['uniqueid']]=_[_0x5622('0x1d')](dials[_0x5afd4c[_0x5622('0x3')]],_0x5afd4c);dials[_0x5afd4c[_0x5622('0x3')]][_0x5622('0x1e')]=utils['now']();dials[_0x5afd4c['uniqueid']]['lastevent']=_0x5622('0x1f');utils[_0x5622('0x20')](util[_0x5622('0xc')](_0x5622('0x21'),_0x5afd4c['uniqueid'],dials[_0x5afd4c[_0x5622('0x3')]]['starttime']));}}catch(_0x570f2c){utils['error'](util['format'](_0x5622('0x1c'),_0x5afd4c[_0x5622('0x3')]),_0x570f2c);}};exports[_0x5622('0x22')]=function(_0x5c672e){try{if(!_[_0x5622('0x1b')](dials[_0x5c672e['uniqueid']])){utils['debug'](util[_0x5622('0xc')](_0x5622('0x23'),_0x5c672e['uniqueid']),_0x5c672e);dials[_0x5c672e[_0x5622('0x3')]][_0x5622('0x24')]=_0x5c672e[_0x5622('0x24')];if(_0x5c672e[_0x5622('0x24')]=='ANSWER'){dials[_0x5c672e['uniqueid']]=_['assign'](dials[_0x5c672e[_0x5622('0x3')]],_0x5c672e);dials[_0x5c672e[_0x5622('0x3')]][_0x5622('0x25')]=utils['now']();dials[_0x5c672e['uniqueid']][_0x5622('0x26')]=_0x5622('0x27');utils[_0x5622('0x20')](util['format']('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x5c672e[_0x5622('0x3')],_0x5c672e[_0x5622('0x24')],dials[_0x5c672e[_0x5622('0x3')]][_0x5622('0x25')]));}else{utils[_0x5622('0x20')](util[_0x5622('0xc')](_0x5622('0x28'),_0x5c672e[_0x5622('0x3')],_0x5c672e[_0x5622('0x24')]));}}}catch(_0x5dc338){utils[_0x5622('0x14')](util[_0x5622('0xc')](_0x5622('0x23'),_0x5c672e['uniqueid']),_0x5dc338);}};exports['hangup']=function(_0x56a331){try{if(!_[_0x5622('0x1b')](dials[_0x56a331['uniqueid']])){utils[_0x5622('0xb')](util[_0x5622('0xc')](_0x5622('0x29'),_0x56a331[_0x5622('0x3')]),_0x56a331);utils[_0x5622('0x20')](util[_0x5622('0xc')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x56a331[_0x5622('0x3')],_0x56a331[_0x5622('0x6')],_0x56a331[_0x5622('0x2a')],_0x56a331[_0x5622('0x2b')]));dials[_0x56a331[_0x5622('0x3')]]=_[_0x5622('0x1d')](dials[_0x56a331['uniqueid']],{'endtime':utils[_0x5622('0x2c')](),'lastevent':_0x5622('0x2d')});dials[_0x56a331['uniqueid']][_0x5622('0x2e')]=utils[_0x5622('0x2f')](dials[_0x56a331['uniqueid']][_0x5622('0x30')],dials[_0x56a331[_0x5622('0x3')]][_0x5622('0x1e')]);dials[_0x56a331[_0x5622('0x3')]]['holdtime']=utils[_0x5622('0x2f')](dials[_0x56a331[_0x5622('0x3')]]['answertime']||dials[_0x56a331[_0x5622('0x3')]][_0x5622('0x30')],dials[_0x56a331[_0x5622('0x3')]][_0x5622('0x1e')]);dials[_0x56a331[_0x5622('0x3')]][_0x5622('0x31')]=dials[_0x56a331[_0x5622('0x3')]][_0x5622('0x25')]?utils['diffTime'](dials[_0x56a331['uniqueid']][_0x5622('0x30')],dials[_0x56a331[_0x5622('0x3')]]['answertime']):0x0;writeDB(dials[_0x56a331[_0x5622('0x3')]]);}}catch(_0x32c23d){utils[_0x5622('0x14')](util['format']('[%s][dials][hangup]',_0x56a331[_0x5622('0x3')]),_0x32c23d);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index e329bee..858289d 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 _0x85c6=['shutdown','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','uniqueid','agentcalled','[%s][index][agentcalled]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','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][index][dialbegin]','[%s]dialbegin','dialend','asterisk-manager','asterisk','port','username','password','xdr','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./core.controller','connect'];(function(_0x33ab66,_0x20f59f){var _0x2fbc26=function(_0x37f1de){while(--_0x37f1de){_0x33ab66['push'](_0x33ab66['shift']());}};_0x2fbc26(++_0x20f59f);}(_0x85c6,0x16b));var _0x685c=function(_0x7ed32a,_0x4f2ed1){_0x7ed32a=_0x7ed32a-0x0;var _0x5dec6f=_0x85c6[_0x7ed32a];return _0x5dec6f;};var AsteriskManager=require(_0x685c('0x0'));var config=require('../../config/environment');var utils=require('./utils');var util=require('util');var ami=new AsteriskManager(config[_0x685c('0x1')][_0x685c('0x2')],config['asterisk']['ip'],config[_0x685c('0x1')][_0x685c('0x3')],config[_0x685c('0x1')][_0x685c('0x4')],!![]);ami['keepConnected']();if(config[_0x685c('0x5')]&&config['xdr']['disabled']){utils[_0x685c('0x6')](_0x685c('0x7'));}else{var agents=require(_0x685c('0x8'));var calls=require(_0x685c('0x9'));var queues=require(_0x685c('0xa'));var recordings=require(_0x685c('0xb'));var members=require(_0x685c('0xc'));var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require(_0x685c('0xd'));ami['on'](_0x685c('0xe'),core['connect']);ami['on'](_0x685c('0xf'),core[_0x685c('0xf')]);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0x685c('0x10'),core[_0x685c('0x10')]);ami['on'](_0x685c('0x11'),core[_0x685c('0x11')]);ami['on'](_0x685c('0x12'),core[_0x685c('0x12')]);ami['on'](_0x685c('0x13'),function(_0x3a77e6){try{utils[_0x685c('0x14')](util[_0x685c('0x15')](_0x685c('0x16'),_0x3a77e6[_0x685c('0x17')]),_0x3a77e6);members[_0x685c('0x13')](_0x3a77e6);}catch(_0xbe2ec7){utils['error'](util['format'](_0x685c('0x16'),_0x3a77e6[_0x685c('0x17')]),_0xbe2ec7);}});ami['on']('agentcalled',function(_0x4f1035){try{utils[_0x685c('0x14')](util[_0x685c('0x15')]('[%s][index][agentcalled]',_0x4f1035[_0x685c('0x18')]),_0x4f1035);agents[_0x685c('0x19')](_0x4f1035);}catch(_0x530cdf){utils[_0x685c('0x10')](util[_0x685c('0x15')](_0x685c('0x1a'),_0x4f1035[_0x685c('0x18')]),_0x530cdf);}});ami['on']('agentringnoanswer',function(_0x5b28df){try{utils[_0x685c('0x14')](util['format']('[%s][index][agentringnoanswer]',_0x5b28df['uniqueid']),_0x5b28df);agents[_0x685c('0x1b')](_0x5b28df);}catch(_0x557203){utils['error'](util[_0x685c('0x15')]('[%s][index][agentringnoanswer]',_0x5b28df['uniqueid']),_0x557203);}});ami['on'](_0x685c('0x1c'),function(_0x1fca04){try{utils[_0x685c('0x14')](util['format'](_0x685c('0x1d'),_0x1fca04[_0x685c('0x18')]),_0x1fca04);agents[_0x685c('0x1c')](_0x1fca04);queues[_0x685c('0x1c')](_0x1fca04);}catch(_0x2b574e){utils[_0x685c('0x10')](util[_0x685c('0x15')](_0x685c('0x1d'),_0x1fca04[_0x685c('0x18')]),_0x2b574e);}});ami['on'](_0x685c('0x1e'),function(_0x378351){try{utils[_0x685c('0x14')](util[_0x685c('0x15')](_0x685c('0x1f'),_0x378351[_0x685c('0x18')]),_0x378351);agents[_0x685c('0x1e')](_0x378351);queues['agentcomplete'](_0x378351);members[_0x685c('0x1e')](_0x378351);}catch(_0x4fe48f){utils[_0x685c('0x10')](util[_0x685c('0x15')](_0x685c('0x1f'),_0x378351[_0x685c('0x18')]),_0x4fe48f);}});ami['on'](_0x685c('0x20'),function(_0x1c94ba){try{utils[_0x685c('0x14')](util[_0x685c('0x15')](_0x685c('0x21'),_0x1c94ba[_0x685c('0x18')]),_0x1c94ba);agents[_0x685c('0x20')](_0x1c94ba);queues['queuecallerabandon'](_0x1c94ba);}catch(_0x33f3f7){utils[_0x685c('0x10')](util[_0x685c('0x15')](_0x685c('0x21'),_0x1c94ba[_0x685c('0x18')]),_0x33f3f7);}});ami['on'](_0x685c('0x22'),function(_0x1a9546){try{utils[_0x685c('0x14')](util[_0x685c('0x15')](_0x685c('0x23'),_0x1a9546[_0x685c('0x18')]),_0x1a9546);queues[_0x685c('0x22')](_0x1a9546);recordings['queuecallerjoin'](_0x1a9546);}catch(_0x597d8b){utils[_0x685c('0x10')](util[_0x685c('0x15')](_0x685c('0x23'),_0x1a9546[_0x685c('0x18')]),_0x597d8b);}});ami['on'](_0x685c('0x24'),function(_0x4a787a){try{utils[_0x685c('0x14')](util['format'](_0x685c('0x25'),_0x4a787a[_0x685c('0x18')]),_0x4a787a);queues[_0x685c('0x24')](_0x4a787a);}catch(_0xf494ff){utils[_0x685c('0x10')](util[_0x685c('0x15')](_0x685c('0x25'),_0x4a787a['uniqueid']),_0xf494ff);}});ami['on'](_0x685c('0x26'),function(_0x5abbc0){try{utils[_0x685c('0x14')](util[_0x685c('0x15')](_0x685c('0x27'),_0x5abbc0[_0x685c('0x18')]),_0x5abbc0);queues[_0x685c('0x26')](_0x5abbc0);calls[_0x685c('0x26')](_0x5abbc0);}catch(_0x3b89cf){utils['error'](util[_0x685c('0x15')](_0x685c('0x27'),_0x5abbc0[_0x685c('0x18')]),_0x3b89cf);}});ami['on'](_0x685c('0x28'),function(_0x460499){try{utils[_0x685c('0x14')](util['format'](_0x685c('0x29'),_0x460499['uniqueid']),_0x460499);queues['musiconholdstop'](_0x460499);calls[_0x685c('0x28')](_0x460499);}catch(_0x3252b6){utils['error'](util[_0x685c('0x15')]('[%s][index][musiconholdstop]',_0x460499[_0x685c('0x18')]),_0x3252b6);}});ami['on']('newstate',function(_0x2c32e8){try{utils['debug'](util[_0x685c('0x15')](_0x685c('0x2a'),_0x2c32e8[_0x685c('0x18')]),_0x2c32e8);calls[_0x685c('0x2b')](_0x2c32e8);recordings[_0x685c('0x2b')](_0x2c32e8);}catch(_0x374995){utils[_0x685c('0x10')](util['format']('[%s][index][newstate]',_0x2c32e8[_0x685c('0x18')]),_0x374995);}});ami['on'](_0x685c('0x2c'),function(_0x340c7e){try{utils['debug'](util[_0x685c('0x15')]('[%s][index][hangup]',_0x340c7e[_0x685c('0x18')]),_0x340c7e);calls[_0x685c('0x2c')](_0x340c7e);recordings[_0x685c('0x2c')](_0x340c7e);dials[_0x685c('0x2c')](_0x340c7e);agents['hangup'](_0x340c7e);queues['hangup'](_0x340c7e);}catch(_0x321042){utils['error'](util['format'](_0x685c('0x2d'),_0x340c7e[_0x685c('0x18')]),_0x321042);}});ami['on']('cdr',function(_0x13ac82){try{utils[_0x685c('0x14')](util[_0x685c('0x15')]('[%s][index][cdr]',_0x13ac82[_0x685c('0x18')]),_0x13ac82);members[_0x685c('0x2e')](_0x13ac82);}catch(_0xb1f056){utils[_0x685c('0x10')](util[_0x685c('0x15')](_0x685c('0x2f'),_0x13ac82[_0x685c('0x18')]),_0xb1f056);}});ami['on'](_0x685c('0x30'),function(_0x13a6db){try{utils[_0x685c('0x14')](util[_0x685c('0x15')](_0x685c('0x31'),_0x13a6db[_0x685c('0x18')]),_0x13a6db);queues['blindtransfer'](_0x13a6db);agents[_0x685c('0x30')](_0x13a6db);transfers['blindtransfer'](_0x13a6db);recordings[_0x685c('0x30')](_0x13a6db);}catch(_0x33ffa2){utils['error'](util[_0x685c('0x15')](_0x685c('0x31'),_0x13a6db['uniqueid']),_0x33ffa2);}});ami['on']('attendedtransfer',function(_0x212a2a){try{utils['debug'](util[_0x685c('0x15')](_0x685c('0x32'),_0x212a2a[_0x685c('0x33')]),_0x212a2a);queues[_0x685c('0x34')](_0x212a2a);transfers[_0x685c('0x34')](_0x212a2a);agents['attendedtransfer'](_0x212a2a);calls[_0x685c('0x34')](_0x212a2a);}catch(_0xda6deb){utils['error'](util[_0x685c('0x15')](_0x685c('0x32'),_0x212a2a[_0x685c('0x33')]),_0xda6deb);}});ami['on'](_0x685c('0x35'),function(_0xd2d790){try{utils[_0x685c('0x14')](util[_0x685c('0x15')](_0x685c('0x36'),_0xd2d790[_0x685c('0x18')]),_0xd2d790);queues[_0x685c('0x35')](_0xd2d790);recordings[_0x685c('0x35')](_0xd2d790);calls['varset'](_0xd2d790);dials['varset'](_0xd2d790);}catch(_0x1f2b7e){utils[_0x685c('0x10')](util['format'](_0x685c('0x36'),_0xd2d790[_0x685c('0x18')]),_0x1f2b7e);}});ami['on'](_0x685c('0x37'),function(_0x476cbd){try{utils[_0x685c('0x14')](util[_0x685c('0x15')]('[%s][index][newexten]',_0x476cbd[_0x685c('0x18')]),_0x476cbd);calls[_0x685c('0x37')](_0x476cbd);recordings[_0x685c('0x37')](_0x476cbd);dials[_0x685c('0x37')](_0x476cbd);}catch(_0x39f68b){utils['error'](util[_0x685c('0x15')](_0x685c('0x38'),_0x476cbd[_0x685c('0x18')]),_0x39f68b);}});ami['on'](_0x685c('0x39'),function(_0x80b6f6){try{utils[_0x685c('0x14')](util['format'](_0x685c('0x3a'),_0x80b6f6[_0x685c('0x18')]),_0x80b6f6);calls[_0x685c('0x39')](_0x80b6f6);recordings[_0x685c('0x39')](_0x80b6f6);}catch(_0x1d6bbe){utils[_0x685c('0x10')](util[_0x685c('0x15')](_0x685c('0x3a'),_0x80b6f6[_0x685c('0x18')]),_0x1d6bbe);}});ami['on'](_0x685c('0x3b'),function(_0x429890){try{utils[_0x685c('0x14')](util[_0x685c('0x15')](_0x685c('0x3c'),_0x429890[_0x685c('0x18')]),_0x429890);dials[_0x685c('0x3b')](_0x429890);}catch(_0x171064){utils[_0x685c('0x10')](util[_0x685c('0x15')](_0x685c('0x3d'),_0x429890[_0x685c('0x18')]),_0x171064);}});ami['on'](_0x685c('0x3e'),function(_0x142d94){try{utils[_0x685c('0x14')](util['format']('[%s][index][dialend]',_0x142d94[_0x685c('0x18')]),_0x142d94);dials[_0x685c('0x3e')](_0x142d94);}catch(_0x150d81){utils[_0x685c('0x10')](util[_0x685c('0x15')]('[%s][index][dialend]',_0x142d94[_0x685c('0x18')]),_0x150d81);}});} \ No newline at end of file +var _0x5863=['xdr','disabled','info','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','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]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','asterisk','port','username','keepConnected'];(function(_0x9257a8,_0x16651d){var _0x40e674=function(_0x30f5aa){while(--_0x30f5aa){_0x9257a8['push'](_0x9257a8['shift']());}};_0x40e674(++_0x16651d);}(_0x5863,0xf6));var _0x3586=function(_0xa00426,_0x5da273){_0xa00426=_0xa00426-0x0;var _0x19ad21=_0x5863[_0xa00426];return _0x19ad21;};var AsteriskManager=require(_0x3586('0x0'));var config=require('../../config/environment');var utils=require(_0x3586('0x1'));var util=require('util');var ami=new AsteriskManager(config[_0x3586('0x2')][_0x3586('0x3')],config['asterisk']['ip'],config[_0x3586('0x2')][_0x3586('0x4')],config[_0x3586('0x2')]['password'],!![]);ami[_0x3586('0x5')]();if(config[_0x3586('0x6')]&&config[_0x3586('0x6')][_0x3586('0x7')]){utils[_0x3586('0x8')]('XDR\x20DISABLED');}else{var agents=require(_0x3586('0x9'));var calls=require(_0x3586('0xa'));var queues=require(_0x3586('0xb'));var recordings=require(_0x3586('0xc'));var members=require(_0x3586('0xd'));var dials=require(_0x3586('0xe'));var transfers=require('./transfers.controller');var core=require(_0x3586('0xf'));ami['on'](_0x3586('0x10'),core[_0x3586('0x10')]);ami['on'](_0x3586('0x11'),core[_0x3586('0x11')]);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0x3586('0x12'),core['error']);ami['on'](_0x3586('0x13'),core[_0x3586('0x13')]);ami['on'](_0x3586('0x14'),core[_0x3586('0x14')]);ami['on'](_0x3586('0x15'),function(_0x54ab89){try{utils['debug'](util[_0x3586('0x16')](_0x3586('0x17'),_0x54ab89[_0x3586('0x18')]),_0x54ab89);members[_0x3586('0x15')](_0x54ab89);}catch(_0x1e8daa){utils[_0x3586('0x12')](util['format'](_0x3586('0x17'),_0x54ab89[_0x3586('0x18')]),_0x1e8daa);}});ami['on']('agentcalled',function(_0xda3b3){try{utils[_0x3586('0x19')](util[_0x3586('0x16')](_0x3586('0x1a'),_0xda3b3['uniqueid']),_0xda3b3);agents['agentcalled'](_0xda3b3);}catch(_0x153e20){utils['error'](util['format'](_0x3586('0x1a'),_0xda3b3[_0x3586('0x1b')]),_0x153e20);}});ami['on'](_0x3586('0x1c'),function(_0x2eee0f){try{utils[_0x3586('0x19')](util[_0x3586('0x16')](_0x3586('0x1d'),_0x2eee0f[_0x3586('0x1b')]),_0x2eee0f);agents[_0x3586('0x1c')](_0x2eee0f);}catch(_0x29600c){utils[_0x3586('0x12')](util['format'](_0x3586('0x1d'),_0x2eee0f[_0x3586('0x1b')]),_0x29600c);}});ami['on'](_0x3586('0x1e'),function(_0x41f7d6){try{utils[_0x3586('0x19')](util[_0x3586('0x16')](_0x3586('0x1f'),_0x41f7d6['uniqueid']),_0x41f7d6);agents[_0x3586('0x1e')](_0x41f7d6);queues['agentconnect'](_0x41f7d6);}catch(_0x1cb537){utils[_0x3586('0x12')](util[_0x3586('0x16')](_0x3586('0x1f'),_0x41f7d6[_0x3586('0x1b')]),_0x1cb537);}});ami['on'](_0x3586('0x20'),function(_0x5f39b8){try{utils[_0x3586('0x19')](util['format']('[%s][index][agentcomplete]',_0x5f39b8[_0x3586('0x1b')]),_0x5f39b8);agents[_0x3586('0x20')](_0x5f39b8);queues[_0x3586('0x20')](_0x5f39b8);members[_0x3586('0x20')](_0x5f39b8);}catch(_0x39c801){utils['error'](util[_0x3586('0x16')]('[%s][index][agentcomplete]',_0x5f39b8[_0x3586('0x1b')]),_0x39c801);}});ami['on'](_0x3586('0x21'),function(_0x59f6d8){try{utils['debug'](util[_0x3586('0x16')]('[%s][index][queuecallerabandon]',_0x59f6d8[_0x3586('0x1b')]),_0x59f6d8);agents['queuecallerabandon'](_0x59f6d8);queues[_0x3586('0x21')](_0x59f6d8);}catch(_0x5e8a26){utils['error'](util['format'](_0x3586('0x22'),_0x59f6d8[_0x3586('0x1b')]),_0x5e8a26);}});ami['on'](_0x3586('0x23'),function(_0x4e912a){try{utils['debug'](util[_0x3586('0x16')](_0x3586('0x24'),_0x4e912a[_0x3586('0x1b')]),_0x4e912a);queues[_0x3586('0x23')](_0x4e912a);recordings[_0x3586('0x23')](_0x4e912a);}catch(_0x227d47){utils[_0x3586('0x12')](util['format'](_0x3586('0x24'),_0x4e912a['uniqueid']),_0x227d47);}});ami['on']('queuecallerleave',function(_0x6812ea){try{utils[_0x3586('0x19')](util[_0x3586('0x16')](_0x3586('0x25'),_0x6812ea[_0x3586('0x1b')]),_0x6812ea);queues[_0x3586('0x26')](_0x6812ea);}catch(_0x27102c){utils[_0x3586('0x12')](util[_0x3586('0x16')](_0x3586('0x25'),_0x6812ea[_0x3586('0x1b')]),_0x27102c);}});ami['on']('musiconholdstart',function(_0x1f20ed){try{utils[_0x3586('0x19')](util[_0x3586('0x16')]('[%s][index][musiconholdstart]',_0x1f20ed['uniqueid']),_0x1f20ed);queues['musiconholdstart'](_0x1f20ed);calls[_0x3586('0x27')](_0x1f20ed);}catch(_0x3c1a54){utils[_0x3586('0x12')](util[_0x3586('0x16')]('[%s][index][musiconholdstart]',_0x1f20ed['uniqueid']),_0x3c1a54);}});ami['on'](_0x3586('0x28'),function(_0x2f4e4d){try{utils[_0x3586('0x19')](util[_0x3586('0x16')](_0x3586('0x29'),_0x2f4e4d[_0x3586('0x1b')]),_0x2f4e4d);queues[_0x3586('0x28')](_0x2f4e4d);calls[_0x3586('0x28')](_0x2f4e4d);}catch(_0x25fcae){utils[_0x3586('0x12')](util['format'](_0x3586('0x29'),_0x2f4e4d[_0x3586('0x1b')]),_0x25fcae);}});ami['on']('newstate',function(_0x17da6d){try{utils[_0x3586('0x19')](util[_0x3586('0x16')]('[%s][index][newstate]',_0x17da6d[_0x3586('0x1b')]),_0x17da6d);calls['newstate'](_0x17da6d);recordings[_0x3586('0x2a')](_0x17da6d);}catch(_0x2759a3){utils[_0x3586('0x12')](util['format']('[%s][index][newstate]',_0x17da6d[_0x3586('0x1b')]),_0x2759a3);}});ami['on'](_0x3586('0x2b'),function(_0x125293){try{utils['debug'](util['format'](_0x3586('0x2c'),_0x125293[_0x3586('0x1b')]),_0x125293);calls['hangup'](_0x125293);recordings[_0x3586('0x2b')](_0x125293);dials[_0x3586('0x2b')](_0x125293);agents['hangup'](_0x125293);queues[_0x3586('0x2b')](_0x125293);}catch(_0x238096){utils[_0x3586('0x12')](util[_0x3586('0x16')](_0x3586('0x2c'),_0x125293[_0x3586('0x1b')]),_0x238096);}});ami['on'](_0x3586('0x2d'),function(_0x214664){try{utils[_0x3586('0x19')](util['format'](_0x3586('0x2e'),_0x214664[_0x3586('0x1b')]),_0x214664);members[_0x3586('0x2d')](_0x214664);}catch(_0xe71328){utils[_0x3586('0x12')](util['format'](_0x3586('0x2e'),_0x214664['uniqueid']),_0xe71328);}});ami['on'](_0x3586('0x2f'),function(_0x24aab6){try{utils[_0x3586('0x19')](util[_0x3586('0x16')]('[%s][index][blindtransfer]',_0x24aab6[_0x3586('0x1b')]),_0x24aab6);queues[_0x3586('0x2f')](_0x24aab6);agents[_0x3586('0x2f')](_0x24aab6);transfers[_0x3586('0x2f')](_0x24aab6);recordings[_0x3586('0x2f')](_0x24aab6);}catch(_0x5a141a){utils[_0x3586('0x12')](util[_0x3586('0x16')](_0x3586('0x30'),_0x24aab6[_0x3586('0x1b')]),_0x5a141a);}});ami['on']('attendedtransfer',function(_0x4811a2){try{utils[_0x3586('0x19')](util[_0x3586('0x16')](_0x3586('0x31'),_0x4811a2[_0x3586('0x32')]),_0x4811a2);queues[_0x3586('0x33')](_0x4811a2);transfers[_0x3586('0x33')](_0x4811a2);agents['attendedtransfer'](_0x4811a2);calls[_0x3586('0x33')](_0x4811a2);}catch(_0x394c10){utils[_0x3586('0x12')](util[_0x3586('0x16')]('[%s][index][attendedtransfer]',_0x4811a2[_0x3586('0x32')]),_0x394c10);}});ami['on'](_0x3586('0x34'),function(_0x39314d){try{utils[_0x3586('0x19')](util[_0x3586('0x16')](_0x3586('0x35'),_0x39314d[_0x3586('0x1b')]),_0x39314d);queues[_0x3586('0x34')](_0x39314d);recordings['varset'](_0x39314d);calls[_0x3586('0x34')](_0x39314d);dials[_0x3586('0x34')](_0x39314d);}catch(_0x1371c0){utils[_0x3586('0x12')](util['format'](_0x3586('0x35'),_0x39314d[_0x3586('0x1b')]),_0x1371c0);}});ami['on'](_0x3586('0x36'),function(_0xd55640){try{utils['debug'](util['format'](_0x3586('0x37'),_0xd55640[_0x3586('0x1b')]),_0xd55640);calls['newexten'](_0xd55640);recordings[_0x3586('0x36')](_0xd55640);dials[_0x3586('0x36')](_0xd55640);}catch(_0x10550e){utils[_0x3586('0x12')](util[_0x3586('0x16')](_0x3586('0x37'),_0xd55640[_0x3586('0x1b')]),_0x10550e);}});ami['on'](_0x3586('0x38'),function(_0x3231ab){try{utils['debug'](util['format']('[%s][index][newchannel]',_0x3231ab[_0x3586('0x1b')]),_0x3231ab);calls['newchannel'](_0x3231ab);recordings[_0x3586('0x38')](_0x3231ab);}catch(_0x508d7b){utils[_0x3586('0x12')](util['format'](_0x3586('0x39'),_0x3231ab[_0x3586('0x1b')]),_0x508d7b);}});ami['on']('dialbegin',function(_0x1482ab){try{utils[_0x3586('0x19')](util[_0x3586('0x16')](_0x3586('0x3a'),_0x1482ab[_0x3586('0x1b')]),_0x1482ab);dials[_0x3586('0x3b')](_0x1482ab);}catch(_0x5d4a40){utils[_0x3586('0x12')](util['format'](_0x3586('0x3c'),_0x1482ab['uniqueid']),_0x5d4a40);}});ami['on'](_0x3586('0x3d'),function(_0x16c202){try{utils['debug'](util['format'](_0x3586('0x3e'),_0x16c202[_0x3586('0x1b')]),_0x16c202);dials[_0x3586('0x3d')](_0x16c202);}catch(_0x2f9252){utils[_0x3586('0x12')](util['format']('[%s][index][dialend]',_0x16c202[_0x3586('0x1b')]),_0x2f9252);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index be49913..48b061f 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 _0xf3fb=['[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','debug','[%s][members][cdr]','isNil','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','assign','lodash','./utils','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','uniqueid','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','agent','NOT_INUSE','exitAt','now','duration','agentcomplete'];(function(_0x13f7fe,_0x694584){var _0x662449=function(_0x2cf065){while(--_0x2cf065){_0x13f7fe['push'](_0x13f7fe['shift']());}};_0x662449(++_0x694584);}(_0xf3fb,0x13e));var _0xbf3f=function(_0x1ed579,_0x206ebc){_0x1ed579=_0x1ed579-0x0;var _0x793273=_0xf3fb[_0x1ed579];return _0x793273;};'use strict';var _=require(_0xbf3f('0x0'));var util=require('util');var utils=require(_0xbf3f('0x1'));var members={};var exclude=[_0xbf3f('0x2'),'Queue:'];function writeDB(_0x30d8e1){utils[_0xbf3f('0x3')](util[_0xbf3f('0x4')](_0xbf3f('0x5'),_0x30d8e1['uniqueid'],_0x30d8e1[_0xbf3f('0x6')],_0x30d8e1['channel'],_0x30d8e1[_0xbf3f('0x7')],_0x30d8e1[_0xbf3f('0x8')],_0x30d8e1[_0xbf3f('0x9')]));if(_0x30d8e1[_0xbf3f('0x6')]){utils[_0xbf3f('0xa')](_0x30d8e1[_0xbf3f('0x6')])[_0xbf3f('0xb')](function(_0x50e6b9){if(_0x50e6b9){_0x30d8e1[_0xbf3f('0x8')]=_0x50e6b9[_0xbf3f('0xc')];_0x30d8e1['internal']=_0x50e6b9[_0xbf3f('0xd')];utils[_0xbf3f('0xe')](_0xbf3f('0xf'),_0x30d8e1);}else{utils[_0xbf3f('0x10')](_0x30d8e1[_0xbf3f('0x6')][_0xbf3f('0x11')]('/')[0x1])['then'](function(_0x536c64){if(_0x536c64){_0x30d8e1[_0xbf3f('0x8')]=_0x536c64[_0xbf3f('0xc')];_0x30d8e1['internal']=_0x536c64[_0xbf3f('0xd')];utils[_0xbf3f('0xe')]('CreateMemberReport',_0x30d8e1);}});}})[_0xbf3f('0x12')](function(_0x1f4921){utils[_0xbf3f('0x13')](util[_0xbf3f('0x4')](_0xbf3f('0x14'),_0x30d8e1['uniqueid']),_0x1f4921);});}delete members[_0x30d8e1['interface']];}function startsWith(_0x57267e,_0x2482a0){return _[_0xbf3f('0x15')](_0x57267e,function(_0x23447f){return _[_0xbf3f('0x16')](_0x2482a0,_0x23447f);});}exports[_0xbf3f('0x17')]=function(_0x29c22){try{utils['debug'](util[_0xbf3f('0x4')](_0xbf3f('0x18'),members[_0x29c22[_0xbf3f('0x19')]]?members[_0x29c22['device']][_0xbf3f('0x1a')]:_0x29c22['device']),_0x29c22);utils[_0xbf3f('0x3')](util[_0xbf3f('0x4')](_0xbf3f('0x1b'),members[_0x29c22[_0xbf3f('0x19')]]?members[_0x29c22['device']]['uniqueid']:_0x29c22['device'],_0x29c22[_0xbf3f('0x1c')],_0x29c22[_0xbf3f('0x19')]));switch(_0x29c22[_0xbf3f('0x1c')]){case _0xbf3f('0x1d'):case _0xbf3f('0x1e'):if(!startsWith(exclude,_0x29c22[_0xbf3f('0x19')])){members[_0x29c22['device']]={'channel':_0xbf3f('0x1f'),'interface':_0x29c22['device'],'type':_0xbf3f('0x20'),'enterAt':utils['now'](),'role':_0xbf3f('0x21')};}break;case _0xbf3f('0x22'):if(!_['isNil'](members[_0x29c22[_0xbf3f('0x19')]])){members[_0x29c22[_0xbf3f('0x19')]][_0xbf3f('0x23')]=utils[_0xbf3f('0x24')]();members[_0x29c22[_0xbf3f('0x19')]][_0xbf3f('0x25')]=utils['diffTime'](members[_0x29c22['device']][_0xbf3f('0x23')],members[_0x29c22[_0xbf3f('0x19')]]['enterAt']);if(members[_0x29c22[_0xbf3f('0x19')]][_0xbf3f('0x1a')]){writeDB(members[_0x29c22[_0xbf3f('0x19')]]);}}break;default:break;}}catch(_0x5640e4){utils['error'](util[_0xbf3f('0x4')](_0xbf3f('0x18'),members[_0x29c22[_0xbf3f('0x19')]]?members[_0x29c22[_0xbf3f('0x19')]][_0xbf3f('0x1a')]:_0x29c22[_0xbf3f('0x19')]),_0x5640e4);}};exports[_0xbf3f('0x26')]=function(_0x48ad13){try{if(!_['isNil'](members[_0x48ad13[_0xbf3f('0x6')]])){utils['debug'](util[_0xbf3f('0x4')](_0xbf3f('0x27'),_0x48ad13[_0xbf3f('0x1a')]),_0x48ad13);utils[_0xbf3f('0x3')](util['format'](_0xbf3f('0x28'),_0x48ad13['uniqueid'],_0x48ad13[_0xbf3f('0x6')],_0x48ad13[_0xbf3f('0x29')]));members[_0x48ad13[_0xbf3f('0x6')]]=_['assign'](members[_0x48ad13['interface']],{'data4':_0x48ad13[_0xbf3f('0x29')],'uniqueid':_0x48ad13['uniqueid']});}}catch(_0x4af26e){utils[_0xbf3f('0x13')](util[_0xbf3f('0x4')](_0xbf3f('0x27'),_0x48ad13['uniqueid']),_0x4af26e);}};exports['cdr']=function(_0xadfa2a){try{utils[_0xbf3f('0x2a')](util[_0xbf3f('0x4')](_0xbf3f('0x2b'),_0xadfa2a[_0xbf3f('0x1a')]),_0xadfa2a);if(_0xadfa2a['channel']){var _0x1dec4a=_0xadfa2a['channel'][_0xbf3f('0x11')]('-')[0x0];if(!_[_0xbf3f('0x2c')](members[_0x1dec4a])){members[_0x1dec4a]=_['assign'](members[_0x1dec4a],{'data1':members[_0x1dec4a][_0xbf3f('0x2d')]||_0xadfa2a['type'],'data2':members[_0x1dec4a]['data2']||_0xadfa2a[_0xbf3f('0x2e')],'data3':members[_0x1dec4a][_0xbf3f('0x2f')]||_0xadfa2a[_0xbf3f('0x30')],'uniqueid':members[_0x1dec4a][_0xbf3f('0x1a')]||_0xadfa2a[_0xbf3f('0x1a')]});utils[_0xbf3f('0x3')](util[_0xbf3f('0x4')](_0xbf3f('0x31'),_0xadfa2a['uniqueid'],members[_0x1dec4a][_0xbf3f('0x2d')],members[_0x1dec4a][_0xbf3f('0x7')],members[_0x1dec4a][_0xbf3f('0x2f')]));if(members[_0x1dec4a][_0xbf3f('0x23')]){writeDB(members[_0x1dec4a]);}}}if(_0xadfa2a['destinationchannel']){var _0x58d523=_0xadfa2a['destinationchannel'][_0xbf3f('0x11')]('-')[0x0];if(!_[_0xbf3f('0x2c')](members[_0x58d523])){members[_0x58d523]=_[_0xbf3f('0x32')](members[_0x58d523],{'data1':members[_0x58d523][_0xbf3f('0x2d')]||_0xadfa2a[_0xbf3f('0x9')],'data2':members[_0x58d523][_0xbf3f('0x7')]||_0xadfa2a[_0xbf3f('0x2e')],'data3':members[_0x58d523][_0xbf3f('0x2f')]||_0xadfa2a[_0xbf3f('0x30')],'uniqueid':members[_0x58d523][_0xbf3f('0x1a')]||_0xadfa2a[_0xbf3f('0x1a')]});utils[_0xbf3f('0x3')](util[_0xbf3f('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xadfa2a[_0xbf3f('0x1a')],members[_0x58d523][_0xbf3f('0x2d')],members[_0x58d523][_0xbf3f('0x7')],members[_0x58d523][_0xbf3f('0x2f')]));if(members[_0x58d523][_0xbf3f('0x23')]){writeDB(members[_0x58d523]);}}}}catch(_0x52a760){utils['error'](util[_0xbf3f('0x4')](_0xbf3f('0x2b'),_0xadfa2a[_0xbf3f('0x1a')]),_0x52a760);}}; \ No newline at end of file +var _0x3cb3=['split','name','catch','uniqueid','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE','isNil','exitAt','duration','diffTime','error','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','channel','data2','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','interface','membername','type','getUserByInterface','then','internal','CreateMemberReport','getUserByName'];(function(_0x352069,_0x63d4f4){var _0x174507=function(_0x586479){while(--_0x586479){_0x352069['push'](_0x352069['shift']());}};_0x174507(++_0x63d4f4);}(_0x3cb3,0x156));var _0x33cb=function(_0x153fae,_0x104506){_0x153fae=_0x153fae-0x0;var _0x5e5f1a=_0x3cb3[_0x153fae];return _0x5e5f1a;};'use strict';var _=require(_0x33cb('0x0'));var util=require(_0x33cb('0x1'));var utils=require(_0x33cb('0x2'));var members={};var exclude=[_0x33cb('0x3'),_0x33cb('0x4')];function writeDB(_0x40a625){utils[_0x33cb('0x5')](util[_0x33cb('0x6')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x40a625['uniqueid'],_0x40a625[_0x33cb('0x7')],_0x40a625['channel'],_0x40a625['data2'],_0x40a625[_0x33cb('0x8')],_0x40a625[_0x33cb('0x9')]));if(_0x40a625['interface']){utils[_0x33cb('0xa')](_0x40a625['interface'])[_0x33cb('0xb')](function(_0xc697a9){if(_0xc697a9){_0x40a625[_0x33cb('0x8')]=_0xc697a9['name'];_0x40a625[_0x33cb('0xc')]=_0xc697a9[_0x33cb('0xc')];utils['request'](_0x33cb('0xd'),_0x40a625);}else{utils[_0x33cb('0xe')](_0x40a625[_0x33cb('0x7')][_0x33cb('0xf')]('/')[0x1])[_0x33cb('0xb')](function(_0x24b308){if(_0x24b308){_0x40a625['membername']=_0x24b308[_0x33cb('0x10')];_0x40a625[_0x33cb('0xc')]=_0x24b308[_0x33cb('0xc')];utils['request'](_0x33cb('0xd'),_0x40a625);}});}})[_0x33cb('0x11')](function(_0x1a581d){utils['error'](util[_0x33cb('0x6')]('[%s][members][writeDB]',_0x40a625[_0x33cb('0x12')]),_0x1a581d);});}delete members[_0x40a625['interface']];}function startsWith(_0x37c497,_0x50a812){return _['some'](_0x37c497,function(_0xa5ac7d){return _[_0x33cb('0x13')](_0x50a812,_0xa5ac7d);});}exports[_0x33cb('0x14')]=function(_0xf43ddb){try{utils[_0x33cb('0x15')](util[_0x33cb('0x6')](_0x33cb('0x16'),members[_0xf43ddb[_0x33cb('0x17')]]?members[_0xf43ddb[_0x33cb('0x17')]][_0x33cb('0x12')]:_0xf43ddb[_0x33cb('0x17')]),_0xf43ddb);utils[_0x33cb('0x5')](util[_0x33cb('0x6')](_0x33cb('0x18'),members[_0xf43ddb[_0x33cb('0x17')]]?members[_0xf43ddb[_0x33cb('0x17')]]['uniqueid']:_0xf43ddb[_0x33cb('0x17')],_0xf43ddb['state'],_0xf43ddb[_0x33cb('0x17')]));switch(_0xf43ddb[_0x33cb('0x19')]){case _0x33cb('0x1a'):case _0x33cb('0x1b'):if(!startsWith(exclude,_0xf43ddb[_0x33cb('0x17')])){members[_0xf43ddb['device']]={'channel':_0x33cb('0x1c'),'interface':_0xf43ddb['device'],'type':_0x33cb('0x1d'),'enterAt':utils[_0x33cb('0x1e')](),'role':'agent'};}break;case _0x33cb('0x1f'):if(!_[_0x33cb('0x20')](members[_0xf43ddb[_0x33cb('0x17')]])){members[_0xf43ddb[_0x33cb('0x17')]][_0x33cb('0x21')]=utils[_0x33cb('0x1e')]();members[_0xf43ddb[_0x33cb('0x17')]][_0x33cb('0x22')]=utils[_0x33cb('0x23')](members[_0xf43ddb[_0x33cb('0x17')]][_0x33cb('0x21')],members[_0xf43ddb[_0x33cb('0x17')]]['enterAt']);if(members[_0xf43ddb[_0x33cb('0x17')]]['uniqueid']){writeDB(members[_0xf43ddb[_0x33cb('0x17')]]);}}break;default:break;}}catch(_0x423b17){utils[_0x33cb('0x24')](util[_0x33cb('0x6')](_0x33cb('0x16'),members[_0xf43ddb[_0x33cb('0x17')]]?members[_0xf43ddb[_0x33cb('0x17')]][_0x33cb('0x12')]:_0xf43ddb[_0x33cb('0x17')]),_0x423b17);}};exports[_0x33cb('0x25')]=function(_0x5f5173){try{if(!_[_0x33cb('0x20')](members[_0x5f5173['interface']])){utils['debug'](util[_0x33cb('0x6')](_0x33cb('0x26'),_0x5f5173[_0x33cb('0x12')]),_0x5f5173);utils[_0x33cb('0x5')](util[_0x33cb('0x6')](_0x33cb('0x27'),_0x5f5173[_0x33cb('0x12')],_0x5f5173[_0x33cb('0x7')],_0x5f5173['queue']));members[_0x5f5173[_0x33cb('0x7')]]=_[_0x33cb('0x28')](members[_0x5f5173[_0x33cb('0x7')]],{'data4':_0x5f5173[_0x33cb('0x29')],'uniqueid':_0x5f5173['uniqueid']});}}catch(_0x25d49c){utils[_0x33cb('0x24')](util['format'](_0x33cb('0x26'),_0x5f5173['uniqueid']),_0x25d49c);}};exports[_0x33cb('0x2a')]=function(_0x11885f){try{utils['debug'](util[_0x33cb('0x6')](_0x33cb('0x2b'),_0x11885f[_0x33cb('0x12')]),_0x11885f);if(_0x11885f[_0x33cb('0x2c')]){var _0x300efd=_0x11885f[_0x33cb('0x2c')][_0x33cb('0xf')]('-')[0x0];if(!_[_0x33cb('0x20')](members[_0x300efd])){members[_0x300efd]=_['assign'](members[_0x300efd],{'data1':members[_0x300efd]['data1']||_0x11885f[_0x33cb('0x9')],'data2':members[_0x300efd][_0x33cb('0x2d')]||_0x11885f[_0x33cb('0x2e')],'data3':members[_0x300efd][_0x33cb('0x2f')]||_0x11885f['destination'],'uniqueid':members[_0x300efd][_0x33cb('0x12')]||_0x11885f[_0x33cb('0x12')]});utils['info'](util['format'](_0x33cb('0x30'),_0x11885f['uniqueid'],members[_0x300efd][_0x33cb('0x31')],members[_0x300efd]['data2'],members[_0x300efd]['data3']));if(members[_0x300efd][_0x33cb('0x21')]){writeDB(members[_0x300efd]);}}}if(_0x11885f[_0x33cb('0x32')]){var _0x22ffb9=_0x11885f[_0x33cb('0x32')][_0x33cb('0xf')]('-')[0x0];if(!_[_0x33cb('0x20')](members[_0x22ffb9])){members[_0x22ffb9]=_[_0x33cb('0x28')](members[_0x22ffb9],{'data1':members[_0x22ffb9][_0x33cb('0x31')]||_0x11885f['type'],'data2':members[_0x22ffb9][_0x33cb('0x2d')]||_0x11885f[_0x33cb('0x2e')],'data3':members[_0x22ffb9]['data3']||_0x11885f['destination'],'uniqueid':members[_0x22ffb9][_0x33cb('0x12')]||_0x11885f[_0x33cb('0x12')]});utils[_0x33cb('0x5')](util[_0x33cb('0x6')](_0x33cb('0x30'),_0x11885f[_0x33cb('0x12')],members[_0x22ffb9][_0x33cb('0x31')],members[_0x22ffb9]['data2'],members[_0x22ffb9]['data3']));if(members[_0x22ffb9][_0x33cb('0x21')]){writeDB(members[_0x22ffb9]);}}}}catch(_0x5436b1){utils['error'](util[_0x33cb('0x6')](_0x33cb('0x2b'),_0x11885f['uniqueid']),_0x5436b1);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 5997e62..639e8d8 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 _0x19cb=['COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','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','secondtransfereruniqueid','transfertargetlinkedid','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','lodash','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','uniqueid','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','queue','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','transfereduniqueid','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','toUpperCase','CONTINUE','queuecallerexit','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','value','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','membername','assigned','queuecallercomplete','reason','transfer'];(function(_0xe68ca0,_0x200a2e){var _0x2c4c3e=function(_0x177289){while(--_0x177289){_0xe68ca0['push'](_0xe68ca0['shift']());}};_0x2c4c3e(++_0x200a2e);}(_0x19cb,0x15a));var _0xb19c=function(_0x37ecce,_0x5373cb){_0x37ecce=_0x37ecce-0x0;var _0x1ff3ee=_0x19cb[_0x37ecce];return _0x1ff3ee;};'use strict';var _=require(_0xb19c('0x0'));var util=require('util');var utils=require(_0xb19c('0x1'));var queues={};function writeDB(_0x28bb00){utils['info'](util[_0xb19c('0x2')](_0xb19c('0x3'),_0x28bb00['uniqueid'],_0x28bb00[_0xb19c('0x4')],_0x28bb00['queue'],_0x28bb00[_0xb19c('0x5')],_0x28bb00[_0xb19c('0x6')],_0x28bb00['accountcode'],_0x28bb00[_0xb19c('0x7')]));if(_0x28bb00['queue']){utils[_0xb19c('0x8')](_0x28bb00['queue'])['then'](function(_0x43dc46){if(_0x43dc46){_0x28bb00['type']=_0x43dc46[_0xb19c('0x9')];}utils['request']('CreateVoiceQueueReport',_0x28bb00);});}else{utils[_0xb19c('0xa')](_0xb19c('0xb'),_0x28bb00);}if(_0x28bb00['transfereduniqueid']){delete queues[_0x28bb00['transfereduniqueid']];}else{delete queues[_0x28bb00['uniqueid']];}}exports[_0xb19c('0xc')]=function(_0x559c6b){try{utils[_0xb19c('0xd')](util[_0xb19c('0x2')](_0xb19c('0xe'),_0x559c6b[_0xb19c('0xf')]),_0x559c6b);utils[_0xb19c('0x10')](util[_0xb19c('0x2')](_0xb19c('0x11'),_0x559c6b[_0xb19c('0xf')],_0x559c6b[_0xb19c('0x12')],_0x559c6b[_0xb19c('0x13')]));queues[_0x559c6b[_0xb19c('0xf')]]=_[_0xb19c('0x14')](_0x559c6b,{'originalposition':_0x559c6b[_0xb19c('0x13')],'queuecallerjoinAt':utils[_0xb19c('0x15')](),'mohtime':0x0});}catch(_0x2041c9){utils[_0xb19c('0x16')](util[_0xb19c('0x2')](_0xb19c('0xe'),_0x559c6b[_0xb19c('0xf')]),_0x2041c9);}};exports[_0xb19c('0x17')]=function(_0x978ca9){try{if(!_[_0xb19c('0x18')](queues[_0x978ca9[_0xb19c('0xf')]])){utils[_0xb19c('0xd')](util['format'](_0xb19c('0x19'),_0x978ca9['uniqueid']),_0x978ca9);if(queues[_0x978ca9[_0xb19c('0xf')]][_0xb19c('0x1a')]){if(!queues[_0x978ca9[_0xb19c('0xf')]][_0xb19c('0x1b')]&&!queues[_0x978ca9[_0xb19c('0xf')]]['queuecallerexit']){queues[_0x978ca9[_0xb19c('0xf')]]['queuecallercomplete']=!![];queues[_0x978ca9[_0xb19c('0xf')]][_0xb19c('0x1c')]=utils[_0xb19c('0x15')]();queues[_0x978ca9['uniqueid']]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils[_0xb19c('0x10')](util[_0xb19c('0x2')](_0xb19c('0x1d'),_0x978ca9[_0xb19c('0xf')],queues[_0x978ca9[_0xb19c('0xf')]][_0xb19c('0x1e')],queues[_0x978ca9[_0xb19c('0xf')]]['queuecallerexitreason']));writeDB(queues[_0x978ca9[_0xb19c('0xf')]]);}else if(queues[_0x978ca9['uniqueid']][_0xb19c('0x1f')]){utils[_0xb19c('0x10')](util[_0xb19c('0x2')](_0xb19c('0x20'),_0x978ca9[_0xb19c('0xf')],queues[_0x978ca9[_0xb19c('0xf')]][_0xb19c('0x1e')],queues[_0x978ca9[_0xb19c('0xf')]][_0xb19c('0x1f')]));queues[queues[_0x978ca9[_0xb19c('0xf')]][_0xb19c('0x1f')]]=queues[_0x978ca9['uniqueid']];queues[queues[_0x978ca9[_0xb19c('0xf')]][_0xb19c('0x1f')]][_0xb19c('0x21')]=0x2;delete queues[_0x978ca9[_0xb19c('0xf')]];}}}catch(_0x54a16a){utils['error'](util[_0xb19c('0x2')](_0xb19c('0x19'),_0x978ca9[_0xb19c('0xf')]),_0x54a16a);}};exports[_0xb19c('0x22')]=function(_0x22d80a){try{utils[_0xb19c('0xd')](util['format'](_0xb19c('0x23'),_0x22d80a[_0xb19c('0xf')]),_0x22d80a);if(!_[_0xb19c('0x18')](_0x22d80a[_0xb19c('0x24')][_0xb19c('0x25')])&&_0x22d80a['value'][_0xb19c('0x26')]()!==_0xb19c('0x27')){if(!_['isNil'](queues[_0x22d80a[_0xb19c('0xf')]])){queues[_0x22d80a[_0xb19c('0xf')]][_0xb19c('0x1b')]=![];queues[_0x22d80a[_0xb19c('0xf')]]['queuecallerabandonAt']=null;queues[_0x22d80a[_0xb19c('0xf')]][_0xb19c('0x28')]=!![];queues[_0x22d80a[_0xb19c('0xf')]][_0xb19c('0x29')]=utils[_0xb19c('0x15')]();queues[_0x22d80a[_0xb19c('0xf')]][_0xb19c('0x7')]=_0x22d80a['value']['toUpperCase']();utils[_0xb19c('0x10')](util['format'](_0xb19c('0x2a'),_0x22d80a['uniqueid'],queues[_0x22d80a['uniqueid']][_0xb19c('0x1e')],_0x22d80a[_0xb19c('0x2b')],queues[_0x22d80a['uniqueid']][_0xb19c('0x7')]));writeDB(queues[_0x22d80a[_0xb19c('0xf')]]);}}else if(!_[_0xb19c('0x18')](_0x22d80a[_0xb19c('0x24')][_0xb19c('0x2c')])){if(!_[_0xb19c('0x18')](queues[_0x22d80a[_0xb19c('0xf')]])&&!queues[_0x22d80a[_0xb19c('0xf')]][_0xb19c('0x1b')]){queues[_0x22d80a['uniqueid']][_0xb19c('0x1b')]=![];queues[_0x22d80a[_0xb19c('0xf')]][_0xb19c('0x2d')]=null;queues[_0x22d80a[_0xb19c('0xf')]][_0xb19c('0x28')]=!![];queues[_0x22d80a[_0xb19c('0xf')]][_0xb19c('0x29')]=utils[_0xb19c('0x15')]();queues[_0x22d80a[_0xb19c('0xf')]][_0xb19c('0x7')]=_0xb19c('0x2e');utils['info'](util[_0xb19c('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x22d80a[_0xb19c('0xf')],queues[_0x22d80a[_0xb19c('0xf')]][_0xb19c('0x1e')],_0x22d80a['value'],queues[_0x22d80a['uniqueid']][_0xb19c('0x7')]));}}}catch(_0x2c8b75){utils[_0xb19c('0x16')](util[_0xb19c('0x2')](_0xb19c('0x23'),_0x22d80a[_0xb19c('0xf')]),_0x2c8b75);}};exports['queuecallerabandon']=function(_0x113064){try{if(!_[_0xb19c('0x18')](queues[_0x113064['uniqueid']])){utils[_0xb19c('0xd')](util[_0xb19c('0x2')](_0xb19c('0x2f'),_0x113064[_0xb19c('0xf')]),_0x113064);queues[_0x113064['uniqueid']][_0xb19c('0x28')]=![];queues[_0x113064[_0xb19c('0xf')]][_0xb19c('0x29')]=null;queues[_0x113064[_0xb19c('0xf')]][_0xb19c('0x1b')]=!![];queues[_0x113064[_0xb19c('0xf')]][_0xb19c('0x2d')]=utils[_0xb19c('0x15')]();queues[_0x113064['uniqueid']][_0xb19c('0x7')]='ABANDONED';utils['info'](util[_0xb19c('0x2')](_0xb19c('0x30'),_0x113064[_0xb19c('0xf')],queues[_0x113064['uniqueid']][_0xb19c('0x1e')],queues[_0x113064[_0xb19c('0xf')]][_0xb19c('0x7')]));}}catch(_0x25db0f){utils[_0xb19c('0x16')](util[_0xb19c('0x2')](_0xb19c('0x2f'),_0x113064[_0xb19c('0xf')]),_0x25db0f);}};exports[_0xb19c('0x31')]=function(_0x1d266f){try{if(!_[_0xb19c('0x18')](queues[_0x1d266f['uniqueid']])){utils[_0xb19c('0xd')](util[_0xb19c('0x2')](_0xb19c('0x32'),_0x1d266f['uniqueid']),_0x1d266f);utils[_0xb19c('0x10')](util[_0xb19c('0x2')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x1d266f['uniqueid'],queues[_0x1d266f[_0xb19c('0xf')]]['name'],_0x1d266f[_0xb19c('0x33')],_0x1d266f[_0xb19c('0x34')]));queues[_0x1d266f[_0xb19c('0xf')]]['queuecallerleave']=!![];queues[_0x1d266f[_0xb19c('0xf')]][_0xb19c('0x1a')]=utils['now']();queues[_0x1d266f[_0xb19c('0xf')]][_0xb19c('0x35')]=utils[_0xb19c('0x36')](queues[_0x1d266f['uniqueid']][_0xb19c('0x1a')],queues[_0x1d266f[_0xb19c('0xf')]][_0xb19c('0x37')]);queues[_0x1d266f[_0xb19c('0xf')]][_0xb19c('0x13')]=_0x1d266f[_0xb19c('0x13')];queues[_0x1d266f[_0xb19c('0xf')]][_0xb19c('0x38')]=_0x1d266f[_0xb19c('0x38')];queues[_0x1d266f[_0xb19c('0xf')]][_0xb19c('0x33')]=_0x1d266f[_0xb19c('0x33')];queues[_0x1d266f['uniqueid']]['connectedlinename']=_0x1d266f['connectedlinename'];}}catch(_0x5c1e2e){utils[_0xb19c('0x16')](util[_0xb19c('0x2')](_0xb19c('0x32'),_0x1d266f[_0xb19c('0xf')]),_0x5c1e2e);}};exports[_0xb19c('0x39')]=function(_0x49cf35){try{if(!_[_0xb19c('0x18')](queues[_0x49cf35[_0xb19c('0xf')]])){utils['debug'](util['format'](_0xb19c('0x3a'),_0x49cf35['uniqueid']),_0x49cf35);utils['info'](util[_0xb19c('0x2')](_0xb19c('0x3b'),_0x49cf35[_0xb19c('0xf')],queues[_0x49cf35[_0xb19c('0xf')]][_0xb19c('0x1e')],_0x49cf35['membername'],_0x49cf35['destaccountcode']));queues[_0x49cf35[_0xb19c('0xf')]]['queuecallerabandon']=![];queues[_0x49cf35[_0xb19c('0xf')]][_0xb19c('0x1b')]=![];queues[_0x49cf35[_0xb19c('0xf')]]['queuecallerabandonAt']=null;queues[_0x49cf35['uniqueid']]['queuecallerexit']=![];queues[_0x49cf35[_0xb19c('0xf')]][_0xb19c('0x7')]=null;queues[_0x49cf35['uniqueid']][_0xb19c('0x29')]=null;queues[_0x49cf35['uniqueid']]['assigned']=!![];queues[_0x49cf35[_0xb19c('0xf')]]['accountcode']=_0x49cf35[_0xb19c('0x3c')];queues[_0x49cf35['uniqueid']]['lastAssignedTo']=_0x49cf35[_0xb19c('0x3d')];}}catch(_0x95a6ed){utils[_0xb19c('0x16')](util[_0xb19c('0x2')]('[%s][queues][agentconnect]',_0x49cf35[_0xb19c('0xf')]),_0x95a6ed);}};exports['agentcomplete']=function(_0x2bd87e){try{if(!_['isNil'](queues[_0x2bd87e['uniqueid']])){if(queues[_0x2bd87e['uniqueid']]['queuecallerleaveAt']){utils[_0xb19c('0xd')](util[_0xb19c('0x2')]('[%s][queues][agentcomplete]',_0x2bd87e[_0xb19c('0xf')]),_0x2bd87e);queues[_0x2bd87e['uniqueid']][_0xb19c('0x1b')]=![];queues[_0x2bd87e[_0xb19c('0xf')]][_0xb19c('0x1b')]=![];queues[_0x2bd87e[_0xb19c('0xf')]]['queuecallerabandonAt']=null;queues[_0x2bd87e[_0xb19c('0xf')]][_0xb19c('0x28')]=![];queues[_0x2bd87e['uniqueid']]['queuecallerexitAt']=null;queues[_0x2bd87e[_0xb19c('0xf')]][_0xb19c('0x3e')]=!![];queues[_0x2bd87e[_0xb19c('0xf')]][_0xb19c('0x5')]=_0x2bd87e[_0xb19c('0x3d')];queues[_0x2bd87e[_0xb19c('0xf')]][_0xb19c('0x3f')]=!![];queues[_0x2bd87e[_0xb19c('0xf')]][_0xb19c('0x1c')]=utils['now']();if(_0x2bd87e[_0xb19c('0x40')]==_0xb19c('0x41')){if(!queues[_0x2bd87e[_0xb19c('0xf')]][_0xb19c('0x41')]){queues[_0x2bd87e['uniqueid']][_0xb19c('0x7')]='TRANSFER';}}else{queues[_0x2bd87e[_0xb19c('0xf')]][_0xb19c('0x7')]=_0xb19c('0x42')+_0x2bd87e[_0xb19c('0x40')][_0xb19c('0x26')]();}utils[_0xb19c('0x10')](util[_0xb19c('0x2')](_0xb19c('0x43'),_0x2bd87e['uniqueid'],queues[_0x2bd87e[_0xb19c('0xf')]][_0xb19c('0x1e')],_0x2bd87e['membername'],queues[_0x2bd87e[_0xb19c('0xf')]][_0xb19c('0x7')]));writeDB(queues[_0x2bd87e[_0xb19c('0xf')]]);}}}catch(_0x2e21e7){utils[_0xb19c('0x16')](util[_0xb19c('0x2')](_0xb19c('0x44'),_0x2bd87e['uniqueid']),_0x2e21e7);}};exports[_0xb19c('0x45')]=function(_0x29dc2a){try{if(!_[_0xb19c('0x18')](queues[_0x29dc2a[_0xb19c('0x46')]])){utils[_0xb19c('0xd')](util[_0xb19c('0x2')]('[%s][queues][blindtransfer]',_0x29dc2a[_0xb19c('0xf')]),_0x29dc2a);queues[_0x29dc2a['transfereeuniqueid']][_0xb19c('0x41')]=!![];queues[_0x29dc2a[_0xb19c('0x46')]][_0xb19c('0x47')]=_0xb19c('0x48');queues[_0x29dc2a[_0xb19c('0x46')]][_0xb19c('0x49')]=_0x29dc2a[_0xb19c('0x4a')];queues[_0x29dc2a['transfereeuniqueid']]['transferuniqueid']=_0x29dc2a[_0xb19c('0x46')];queues[_0x29dc2a[_0xb19c('0x46')]]['queuecallerexitreason']='BLINDTRANSFER';utils[_0xb19c('0x10')](util['format'](_0xb19c('0x4b'),_0x29dc2a['uniqueid'],queues[_0x29dc2a['transfereeuniqueid']]['name'],_0x29dc2a[_0xb19c('0x46')],_0x29dc2a['extension']));}}catch(_0x4b7f5b){utils['error'](util['format'](_0xb19c('0x4c'),_0x29dc2a[_0xb19c('0xf')]),_0x4b7f5b);}};exports[_0xb19c('0x4d')]=function(_0x194584){try{utils['debug'](util[_0xb19c('0x2')]('[%s][queues][attendedtransfer]',_0x194584[_0xb19c('0x4e')]),_0x194584);if(_0x194584[_0xb19c('0x4e')]==_0x194584[_0xb19c('0x4f')]){if(!_[_0xb19c('0x18')](queues[_0x194584[_0xb19c('0x50')]])){utils[_0xb19c('0x10')](util[_0xb19c('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x194584[_0xb19c('0x4e')],queues[_0x194584[_0xb19c('0x50')]]['name'],_0x194584['origtransfererexten']));queues[_0x194584[_0xb19c('0x50')]]['transfer']=!![];queues[_0x194584['secondtransfererlinkedid']][_0xb19c('0x47')]=_0xb19c('0x51');queues[_0x194584[_0xb19c('0x50')]][_0xb19c('0x49')]=_0x194584[_0xb19c('0x52')];queues[_0x194584[_0xb19c('0x50')]][_0xb19c('0x53')]=_0x194584[_0xb19c('0x4e')];queues[_0x194584[_0xb19c('0x50')]][_0xb19c('0x7')]=_0xb19c('0x54');}if(!_[_0xb19c('0x18')](queues[_0x194584[_0xb19c('0x4f')]])){if(_0x194584[_0xb19c('0x55')]&&queues[_0x194584['transfereelinkedid']]){queues[_0x194584[_0xb19c('0x55')]][_0xb19c('0x21')]=0x1;queues[_0x194584[_0xb19c('0x46')]]=_[_0xb19c('0x56')](queues[_0x194584[_0xb19c('0x55')]]);queues[_0x194584[_0xb19c('0x46')]][_0xb19c('0x1f')]=_0x194584[_0xb19c('0x57')];queues[_0x194584[_0xb19c('0x46')]][_0xb19c('0x21')]=0x2;queues[_0x194584[_0xb19c('0x46')]]['calleridnum']=queues[_0x194584[_0xb19c('0x50')]][_0xb19c('0x6')];queues[_0x194584[_0xb19c('0x46')]][_0xb19c('0x58')]=queues[_0x194584[_0xb19c('0x50')]][_0xb19c('0x58')];queues[_0x194584['transfereeuniqueid']][_0xb19c('0x37')]=utils['now']();queues[_0x194584[_0xb19c('0x46')]][_0xb19c('0x1a')]=utils[_0xb19c('0x15')]();queues[_0x194584[_0xb19c('0x46')]][_0xb19c('0x35')]=0x0;queues[_0x194584['transfereeuniqueid']][_0xb19c('0x59')]=0x0;utils['info'](util['format'](_0xb19c('0x5a'),_0x194584[_0xb19c('0x4e')],queues[_0x194584['transfereeuniqueid']][_0xb19c('0x1e')],queues[_0x194584['transfereeuniqueid']][_0xb19c('0x6')],queues[_0x194584[_0xb19c('0x46')]]['calleridname']));}else{utils[_0xb19c('0x10')](util[_0xb19c('0x2')](_0xb19c('0x5b'),_0x194584[_0xb19c('0x4e')],queues[_0x194584['origtransfererlinkedid']][_0xb19c('0x1e')],_0x194584[_0xb19c('0x50')]));queues[_0x194584[_0xb19c('0x4f')]][_0xb19c('0x1f')]=_0x194584[_0xb19c('0x50')];}}}else if(_0x194584['secondtransfereruniqueid']==_0x194584[_0xb19c('0x50')]){if(!_[_0xb19c('0x18')](queues[_0x194584[_0xb19c('0x4f')]])){utils['info'](util[_0xb19c('0x2')](_0xb19c('0x5c'),_0x194584[_0xb19c('0x4e')],queues[_0x194584[_0xb19c('0x4f')]][_0xb19c('0x1e')],_0x194584['secondtransfereruniqueid'],_0x194584[_0xb19c('0x5d')]));queues[_0x194584[_0xb19c('0x4f')]]['transfer']=!![];queues[_0x194584[_0xb19c('0x4f')]][_0xb19c('0x47')]=_0xb19c('0x51');queues[_0x194584[_0xb19c('0x4f')]][_0xb19c('0x49')]=_0x194584[_0xb19c('0x5d')];queues[_0x194584[_0xb19c('0x4f')]][_0xb19c('0x53')]=_0x194584[_0xb19c('0x5e')];queues[_0x194584[_0xb19c('0x4f')]]['queuecallerexitreason']=_0xb19c('0x54');}if(!_['isNil'](queues[_0x194584[_0xb19c('0x50')]])){if(_0x194584[_0xb19c('0x5f')]&&queues[_0x194584['transfertargetlinkedid']]){queues[_0x194584[_0xb19c('0x5f')]]['queuecallerenterreason']=0x1;queues[_0x194584[_0xb19c('0x57')]]=_[_0xb19c('0x56')](queues[_0x194584['transfertargetlinkedid']]);queues[_0x194584[_0xb19c('0x57')]]['transfereduniqueid']=_0x194584[_0xb19c('0x57')];queues[_0x194584[_0xb19c('0x57')]][_0xb19c('0x21')]=0x2;queues[_0x194584[_0xb19c('0x57')]]['calleridnum']=queues[_0x194584['origtransfererlinkedid']]['calleridnum'];queues[_0x194584['transfertargetuniqueid']][_0xb19c('0x58')]=queues[_0x194584[_0xb19c('0x4f')]][_0xb19c('0x58')];queues[_0x194584[_0xb19c('0x57')]][_0xb19c('0x37')]=utils['now']();queues[_0x194584[_0xb19c('0x57')]][_0xb19c('0x1a')]=utils[_0xb19c('0x15')]();queues[_0x194584[_0xb19c('0x57')]][_0xb19c('0x35')]=0x0;queues[_0x194584[_0xb19c('0x57')]][_0xb19c('0x59')]=0x0;utils[_0xb19c('0x10')](util[_0xb19c('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x194584['origtransfereruniqueid'],queues[_0x194584[_0xb19c('0x57')]]['name'],queues[_0x194584[_0xb19c('0x57')]][_0xb19c('0x1f')],queues[_0x194584[_0xb19c('0x57')]][_0xb19c('0x6')],queues[_0x194584[_0xb19c('0x57')]][_0xb19c('0x58')]));}else{utils[_0xb19c('0x10')](util[_0xb19c('0x2')](_0xb19c('0x5b'),_0x194584[_0xb19c('0x4e')],queues[_0x194584[_0xb19c('0x50')]][_0xb19c('0x1e')],_0x194584[_0xb19c('0x4f')]));queues[_0x194584[_0xb19c('0x50')]][_0xb19c('0x1f')]=_0x194584[_0xb19c('0x4f')];}}}}catch(_0x58e31a){utils[_0xb19c('0x16')](util[_0xb19c('0x2')](_0xb19c('0x60'),_0x194584[_0xb19c('0x4e')]),_0x58e31a);}};exports[_0xb19c('0x61')]=function(_0x3a97f1){try{if(!_[_0xb19c('0x18')](queues[_0x3a97f1[_0xb19c('0xf')]])){utils['debug'](util[_0xb19c('0x2')](_0xb19c('0x62'),_0x3a97f1['uniqueid']),_0x3a97f1);queues[_0x3a97f1[_0xb19c('0xf')]][_0xb19c('0x63')]=utils[_0xb19c('0x15')]();utils[_0xb19c('0x10')](util[_0xb19c('0x2')](_0xb19c('0x64'),_0x3a97f1[_0xb19c('0xf')],queues[_0x3a97f1[_0xb19c('0xf')]]['name'],queues[_0x3a97f1[_0xb19c('0xf')]]['musiconholdstartAt']));}}catch(_0x4371a5){utils[_0xb19c('0x16')](util[_0xb19c('0x2')](_0xb19c('0x62'),_0x3a97f1[_0xb19c('0xf')]),_0x4371a5);}};exports[_0xb19c('0x65')]=function(_0x36b393){try{if(!_[_0xb19c('0x18')](queues[_0x36b393[_0xb19c('0xf')]])){if(!_['isNil'](queues[_0x36b393[_0xb19c('0xf')]][_0xb19c('0x63')])){utils[_0xb19c('0xd')](util[_0xb19c('0x2')](_0xb19c('0x66'),_0x36b393[_0xb19c('0xf')]),_0x36b393);queues[_0x36b393[_0xb19c('0xf')]][_0xb19c('0x59')]+=utils['diffTime'](utils[_0xb19c('0x15')](),queues[_0x36b393[_0xb19c('0xf')]][_0xb19c('0x63')]);utils[_0xb19c('0x10')](util[_0xb19c('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x36b393['uniqueid'],queues[_0x36b393['uniqueid']][_0xb19c('0x1e')],queues[_0x36b393[_0xb19c('0xf')]]['mohtime']));delete queues[_0x36b393[_0xb19c('0xf')]]['musiconholdstartAt'];}}}catch(_0xc926b7){utils['error'](util['format'](_0xb19c('0x66'),_0x36b393[_0xb19c('0xf')]),_0xc926b7);}}; \ No newline at end of file +var _0x35d0=['queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','transferexten','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','calleridnum','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','mohtime','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','type','transfereduniqueid','uniqueid','debug','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','name','varset','variable'];(function(_0x5e6d8f,_0x146a47){var _0x827d46=function(_0xab8adb){while(--_0xab8adb){_0x5e6d8f['push'](_0x5e6d8f['shift']());}};_0x827d46(++_0x146a47);}(_0x35d0,0x114));var _0x035d=function(_0x3e478c,_0x152670){_0x3e478c=_0x3e478c-0x0;var _0x29ef89=_0x35d0[_0x3e478c];return _0x29ef89;};'use strict';var _=require(_0x035d('0x0'));var util=require(_0x035d('0x1'));var utils=require('./utils');var queues={};function writeDB(_0xf68ee1){utils[_0x035d('0x2')](util['format'](_0x035d('0x3'),_0xf68ee1['uniqueid'],_0xf68ee1[_0x035d('0x4')],_0xf68ee1[_0x035d('0x5')],_0xf68ee1[_0x035d('0x6')],_0xf68ee1['calleridnum'],_0xf68ee1[_0x035d('0x7')],_0xf68ee1[_0x035d('0x8')]));if(_0xf68ee1[_0x035d('0x5')]){utils[_0x035d('0x9')](_0xf68ee1[_0x035d('0x5')])['then'](function(_0x54e570){if(_0x54e570){_0xf68ee1['type']=_0x54e570[_0x035d('0xa')];}utils['request']('CreateVoiceQueueReport',_0xf68ee1);});}else{utils['request']('CreateVoiceQueueReport',_0xf68ee1);}if(_0xf68ee1['transfereduniqueid']){delete queues[_0xf68ee1[_0x035d('0xb')]];}else{delete queues[_0xf68ee1[_0x035d('0xc')]];}}exports['queuecallerjoin']=function(_0x142cb0){try{utils[_0x035d('0xd')](util[_0x035d('0xe')](_0x035d('0xf'),_0x142cb0[_0x035d('0xc')]),_0x142cb0);utils[_0x035d('0x2')](util['format'](_0x035d('0x10'),_0x142cb0['uniqueid'],_0x142cb0[_0x035d('0x5')],_0x142cb0[_0x035d('0x11')]));queues[_0x142cb0[_0x035d('0xc')]]=_['assign'](_0x142cb0,{'originalposition':_0x142cb0[_0x035d('0x11')],'queuecallerjoinAt':utils[_0x035d('0x12')](),'mohtime':0x0});}catch(_0x3799d5){utils[_0x035d('0x13')](util['format']('[%s][queues][queuecallerjoin]',_0x142cb0[_0x035d('0xc')]),_0x3799d5);}};exports[_0x035d('0x14')]=function(_0x46cf8a){try{if(!_[_0x035d('0x15')](queues[_0x46cf8a['uniqueid']])){utils[_0x035d('0xd')](util[_0x035d('0xe')](_0x035d('0x16'),_0x46cf8a[_0x035d('0xc')]),_0x46cf8a);if(queues[_0x46cf8a[_0x035d('0xc')]][_0x035d('0x17')]){if(!queues[_0x46cf8a[_0x035d('0xc')]]['queuecallerabandon']&&!queues[_0x46cf8a[_0x035d('0xc')]][_0x035d('0x18')]){queues[_0x46cf8a[_0x035d('0xc')]][_0x035d('0x19')]=!![];queues[_0x46cf8a[_0x035d('0xc')]][_0x035d('0x1a')]=utils['now']();queues[_0x46cf8a[_0x035d('0xc')]][_0x035d('0x8')]='COMPLETEDBYAGENT';}utils[_0x035d('0x2')](util[_0x035d('0xe')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x46cf8a['uniqueid'],queues[_0x46cf8a[_0x035d('0xc')]][_0x035d('0x1b')],queues[_0x46cf8a[_0x035d('0xc')]]['queuecallerexitreason']));writeDB(queues[_0x46cf8a['uniqueid']]);}else if(queues[_0x46cf8a[_0x035d('0xc')]]['transfereduniqueid']){utils[_0x035d('0x2')](util[_0x035d('0xe')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x46cf8a[_0x035d('0xc')],queues[_0x46cf8a[_0x035d('0xc')]][_0x035d('0x1b')],queues[_0x46cf8a['uniqueid']]['transfereduniqueid']));queues[queues[_0x46cf8a[_0x035d('0xc')]][_0x035d('0xb')]]=queues[_0x46cf8a['uniqueid']];queues[queues[_0x46cf8a[_0x035d('0xc')]][_0x035d('0xb')]]['queuecallerenterreason']=0x2;delete queues[_0x46cf8a['uniqueid']];}}}catch(_0x1feeb3){utils[_0x035d('0x13')](util[_0x035d('0xe')](_0x035d('0x16'),_0x46cf8a[_0x035d('0xc')]),_0x1feeb3);}};exports[_0x035d('0x1c')]=function(_0x5a1100){try{utils[_0x035d('0xd')](util[_0x035d('0xe')]('[%s][queues][varset]',_0x5a1100[_0x035d('0xc')]),_0x5a1100);if(!_[_0x035d('0x15')](_0x5a1100[_0x035d('0x1d')][_0x035d('0x1e')])&&_0x5a1100[_0x035d('0x1f')][_0x035d('0x20')]()!==_0x035d('0x21')){if(!_['isNil'](queues[_0x5a1100[_0x035d('0xc')]])){queues[_0x5a1100[_0x035d('0xc')]][_0x035d('0x22')]=![];queues[_0x5a1100['uniqueid']][_0x035d('0x23')]=null;queues[_0x5a1100['uniqueid']][_0x035d('0x18')]=!![];queues[_0x5a1100['uniqueid']]['queuecallerexitAt']=utils[_0x035d('0x12')]();queues[_0x5a1100['uniqueid']][_0x035d('0x8')]=_0x5a1100[_0x035d('0x1f')][_0x035d('0x20')]();utils['info'](util[_0x035d('0xe')](_0x035d('0x24'),_0x5a1100['uniqueid'],queues[_0x5a1100['uniqueid']]['name'],_0x5a1100[_0x035d('0x1f')],queues[_0x5a1100[_0x035d('0xc')]][_0x035d('0x8')]));writeDB(queues[_0x5a1100[_0x035d('0xc')]]);}}else if(!_[_0x035d('0x15')](_0x5a1100['variable']['queueposition'])){if(!_[_0x035d('0x15')](queues[_0x5a1100['uniqueid']])&&!queues[_0x5a1100[_0x035d('0xc')]]['queuecallerabandon']){queues[_0x5a1100[_0x035d('0xc')]]['queuecallerabandon']=![];queues[_0x5a1100['uniqueid']][_0x035d('0x23')]=null;queues[_0x5a1100[_0x035d('0xc')]][_0x035d('0x18')]=!![];queues[_0x5a1100[_0x035d('0xc')]][_0x035d('0x25')]=utils[_0x035d('0x12')]();queues[_0x5a1100[_0x035d('0xc')]][_0x035d('0x8')]='EXITWITHKEY';utils[_0x035d('0x2')](util[_0x035d('0xe')](_0x035d('0x26'),_0x5a1100[_0x035d('0xc')],queues[_0x5a1100[_0x035d('0xc')]][_0x035d('0x1b')],_0x5a1100[_0x035d('0x1f')],queues[_0x5a1100['uniqueid']][_0x035d('0x8')]));}}}catch(_0x223e56){utils[_0x035d('0x13')](util[_0x035d('0xe')](_0x035d('0x27'),_0x5a1100[_0x035d('0xc')]),_0x223e56);}};exports[_0x035d('0x22')]=function(_0x5b66a2){try{if(!_[_0x035d('0x15')](queues[_0x5b66a2[_0x035d('0xc')]])){utils[_0x035d('0xd')](util[_0x035d('0xe')]('[%s][queues][queuecallerabandon]',_0x5b66a2[_0x035d('0xc')]),_0x5b66a2);queues[_0x5b66a2[_0x035d('0xc')]][_0x035d('0x18')]=![];queues[_0x5b66a2[_0x035d('0xc')]][_0x035d('0x25')]=null;queues[_0x5b66a2[_0x035d('0xc')]][_0x035d('0x22')]=!![];queues[_0x5b66a2[_0x035d('0xc')]][_0x035d('0x23')]=utils[_0x035d('0x12')]();queues[_0x5b66a2['uniqueid']]['queuecallerexitreason']=_0x035d('0x28');utils[_0x035d('0x2')](util[_0x035d('0xe')](_0x035d('0x29'),_0x5b66a2['uniqueid'],queues[_0x5b66a2[_0x035d('0xc')]][_0x035d('0x1b')],queues[_0x5b66a2['uniqueid']][_0x035d('0x8')]));}}catch(_0x802d56){utils[_0x035d('0x13')](util[_0x035d('0xe')](_0x035d('0x2a'),_0x5b66a2[_0x035d('0xc')]),_0x802d56);}};exports['queuecallerleave']=function(_0x47d0ae){try{if(!_[_0x035d('0x15')](queues[_0x47d0ae[_0x035d('0xc')]])){utils[_0x035d('0xd')](util[_0x035d('0xe')]('[%s][queues][queuecallerleave]',_0x47d0ae[_0x035d('0xc')]),_0x47d0ae);utils[_0x035d('0x2')](util[_0x035d('0xe')](_0x035d('0x2b'),_0x47d0ae[_0x035d('0xc')],queues[_0x47d0ae['uniqueid']]['name'],_0x47d0ae[_0x035d('0x2c')],_0x47d0ae['connectedlinename']));queues[_0x47d0ae[_0x035d('0xc')]][_0x035d('0x2d')]=!![];queues[_0x47d0ae[_0x035d('0xc')]][_0x035d('0x17')]=utils['now']();queues[_0x47d0ae[_0x035d('0xc')]][_0x035d('0x2e')]=utils[_0x035d('0x2f')](queues[_0x47d0ae['uniqueid']]['queuecallerleaveAt'],queues[_0x47d0ae[_0x035d('0xc')]][_0x035d('0x30')]);queues[_0x47d0ae[_0x035d('0xc')]][_0x035d('0x11')]=_0x47d0ae['position'];queues[_0x47d0ae[_0x035d('0xc')]][_0x035d('0x31')]=_0x47d0ae['count'];queues[_0x47d0ae[_0x035d('0xc')]][_0x035d('0x2c')]=_0x47d0ae['connectedlinenum'];queues[_0x47d0ae['uniqueid']][_0x035d('0x32')]=_0x47d0ae[_0x035d('0x32')];}}catch(_0x1d6bd1){utils[_0x035d('0x13')](util['format'](_0x035d('0x33'),_0x47d0ae[_0x035d('0xc')]),_0x1d6bd1);}};exports[_0x035d('0x34')]=function(_0x6162d9){try{if(!_['isNil'](queues[_0x6162d9[_0x035d('0xc')]])){utils['debug'](util[_0x035d('0xe')](_0x035d('0x35'),_0x6162d9[_0x035d('0xc')]),_0x6162d9);utils[_0x035d('0x2')](util[_0x035d('0xe')](_0x035d('0x36'),_0x6162d9[_0x035d('0xc')],queues[_0x6162d9[_0x035d('0xc')]][_0x035d('0x1b')],_0x6162d9[_0x035d('0x37')],_0x6162d9[_0x035d('0x38')]));queues[_0x6162d9[_0x035d('0xc')]][_0x035d('0x22')]=![];queues[_0x6162d9[_0x035d('0xc')]][_0x035d('0x22')]=![];queues[_0x6162d9[_0x035d('0xc')]][_0x035d('0x23')]=null;queues[_0x6162d9[_0x035d('0xc')]][_0x035d('0x18')]=![];queues[_0x6162d9[_0x035d('0xc')]][_0x035d('0x8')]=null;queues[_0x6162d9[_0x035d('0xc')]][_0x035d('0x25')]=null;queues[_0x6162d9[_0x035d('0xc')]][_0x035d('0x39')]=!![];queues[_0x6162d9[_0x035d('0xc')]][_0x035d('0x7')]=_0x6162d9['destaccountcode'];queues[_0x6162d9['uniqueid']][_0x035d('0x6')]=_0x6162d9[_0x035d('0x37')];}}catch(_0xa086d4){utils[_0x035d('0x13')](util[_0x035d('0xe')](_0x035d('0x35'),_0x6162d9[_0x035d('0xc')]),_0xa086d4);}};exports[_0x035d('0x3a')]=function(_0x298ef6){try{if(!_[_0x035d('0x15')](queues[_0x298ef6['uniqueid']])){if(queues[_0x298ef6[_0x035d('0xc')]]['queuecallerleaveAt']){utils['debug'](util[_0x035d('0xe')](_0x035d('0x3b'),_0x298ef6[_0x035d('0xc')]),_0x298ef6);queues[_0x298ef6[_0x035d('0xc')]][_0x035d('0x22')]=![];queues[_0x298ef6[_0x035d('0xc')]][_0x035d('0x22')]=![];queues[_0x298ef6[_0x035d('0xc')]][_0x035d('0x23')]=null;queues[_0x298ef6[_0x035d('0xc')]][_0x035d('0x18')]=![];queues[_0x298ef6[_0x035d('0xc')]][_0x035d('0x25')]=null;queues[_0x298ef6[_0x035d('0xc')]]['assigned']=!![];queues[_0x298ef6['uniqueid']][_0x035d('0x6')]=_0x298ef6['membername'];queues[_0x298ef6['uniqueid']][_0x035d('0x19')]=!![];queues[_0x298ef6[_0x035d('0xc')]][_0x035d('0x1a')]=utils[_0x035d('0x12')]();if(_0x298ef6['reason']==_0x035d('0x3c')){if(!queues[_0x298ef6[_0x035d('0xc')]][_0x035d('0x3c')]){queues[_0x298ef6[_0x035d('0xc')]][_0x035d('0x8')]=_0x035d('0x3d');}}else{queues[_0x298ef6[_0x035d('0xc')]]['queuecallerexitreason']=_0x035d('0x3e')+_0x298ef6[_0x035d('0x3f')][_0x035d('0x20')]();}utils[_0x035d('0x2')](util[_0x035d('0xe')](_0x035d('0x40'),_0x298ef6[_0x035d('0xc')],queues[_0x298ef6[_0x035d('0xc')]]['name'],_0x298ef6['membername'],queues[_0x298ef6['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x298ef6[_0x035d('0xc')]]);}}}catch(_0x530cad){utils['error'](util['format']('[%s][queues][agentcomplete]',_0x298ef6[_0x035d('0xc')]),_0x530cad);}};exports[_0x035d('0x41')]=function(_0x114286){try{if(!_['isNil'](queues[_0x114286[_0x035d('0x42')]])){utils[_0x035d('0xd')](util[_0x035d('0xe')](_0x035d('0x43'),_0x114286[_0x035d('0xc')]),_0x114286);queues[_0x114286[_0x035d('0x42')]][_0x035d('0x3c')]=!![];queues[_0x114286[_0x035d('0x42')]][_0x035d('0x44')]='BLIND';queues[_0x114286['transfereeuniqueid']]['transferexten']=_0x114286['extension'];queues[_0x114286['transfereeuniqueid']][_0x035d('0x45')]=_0x114286[_0x035d('0x42')];queues[_0x114286[_0x035d('0x42')]]['queuecallerexitreason']=_0x035d('0x46');utils[_0x035d('0x2')](util[_0x035d('0xe')](_0x035d('0x47'),_0x114286[_0x035d('0xc')],queues[_0x114286[_0x035d('0x42')]][_0x035d('0x1b')],_0x114286[_0x035d('0x42')],_0x114286[_0x035d('0x48')]));}}catch(_0x4d4d1c){utils[_0x035d('0x13')](util[_0x035d('0xe')](_0x035d('0x43'),_0x114286[_0x035d('0xc')]),_0x4d4d1c);}};exports[_0x035d('0x49')]=function(_0x1acf40){try{utils['debug'](util['format']('[%s][queues][attendedtransfer]',_0x1acf40[_0x035d('0x4a')]),_0x1acf40);if(_0x1acf40[_0x035d('0x4a')]==_0x1acf40[_0x035d('0x4b')]){if(!_[_0x035d('0x15')](queues[_0x1acf40[_0x035d('0x4c')]])){utils[_0x035d('0x2')](util['format'](_0x035d('0x4d'),_0x1acf40[_0x035d('0x4a')],queues[_0x1acf40[_0x035d('0x4c')]]['name'],_0x1acf40['origtransfererexten']));queues[_0x1acf40[_0x035d('0x4c')]][_0x035d('0x3c')]=!![];queues[_0x1acf40[_0x035d('0x4c')]]['transfertype']=_0x035d('0x4e');queues[_0x1acf40[_0x035d('0x4c')]][_0x035d('0x4f')]=_0x1acf40[_0x035d('0x50')];queues[_0x1acf40[_0x035d('0x4c')]][_0x035d('0x45')]=_0x1acf40[_0x035d('0x4a')];queues[_0x1acf40[_0x035d('0x4c')]]['queuecallerexitreason']=_0x035d('0x51');}if(!_[_0x035d('0x15')](queues[_0x1acf40[_0x035d('0x4b')]])){if(_0x1acf40[_0x035d('0x52')]&&queues[_0x1acf40[_0x035d('0x52')]]){queues[_0x1acf40[_0x035d('0x52')]][_0x035d('0x53')]=0x1;queues[_0x1acf40[_0x035d('0x42')]]=_[_0x035d('0x54')](queues[_0x1acf40[_0x035d('0x52')]]);queues[_0x1acf40[_0x035d('0x42')]]['transfereduniqueid']=_0x1acf40['transfertargetuniqueid'];queues[_0x1acf40['transfereeuniqueid']][_0x035d('0x53')]=0x2;queues[_0x1acf40['transfereeuniqueid']][_0x035d('0x55')]=queues[_0x1acf40[_0x035d('0x4c')]]['calleridnum'];queues[_0x1acf40[_0x035d('0x42')]][_0x035d('0x56')]=queues[_0x1acf40[_0x035d('0x4c')]][_0x035d('0x56')];queues[_0x1acf40[_0x035d('0x42')]][_0x035d('0x30')]=utils[_0x035d('0x12')]();queues[_0x1acf40['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0x035d('0x12')]();queues[_0x1acf40[_0x035d('0x42')]][_0x035d('0x2e')]=0x0;queues[_0x1acf40['transfereeuniqueid']]['mohtime']=0x0;utils['info'](util[_0x035d('0xe')](_0x035d('0x57'),_0x1acf40[_0x035d('0x4a')],queues[_0x1acf40[_0x035d('0x42')]][_0x035d('0x1b')],queues[_0x1acf40[_0x035d('0x42')]][_0x035d('0x55')],queues[_0x1acf40[_0x035d('0x42')]]['calleridname']));}else{utils[_0x035d('0x2')](util['format'](_0x035d('0x58'),_0x1acf40[_0x035d('0x4a')],queues[_0x1acf40[_0x035d('0x4b')]][_0x035d('0x1b')],_0x1acf40[_0x035d('0x4c')]));queues[_0x1acf40[_0x035d('0x4b')]][_0x035d('0xb')]=_0x1acf40[_0x035d('0x4c')];}}}else if(_0x1acf40[_0x035d('0x59')]==_0x1acf40[_0x035d('0x4c')]){if(!_[_0x035d('0x15')](queues[_0x1acf40[_0x035d('0x4b')]])){utils[_0x035d('0x2')](util[_0x035d('0xe')](_0x035d('0x5a'),_0x1acf40['origtransfereruniqueid'],queues[_0x1acf40[_0x035d('0x4b')]][_0x035d('0x1b')],_0x1acf40[_0x035d('0x59')],_0x1acf40[_0x035d('0x5b')]));queues[_0x1acf40[_0x035d('0x4b')]][_0x035d('0x3c')]=!![];queues[_0x1acf40[_0x035d('0x4b')]][_0x035d('0x44')]='ATTENDED';queues[_0x1acf40[_0x035d('0x4b')]][_0x035d('0x4f')]=_0x1acf40[_0x035d('0x5b')];queues[_0x1acf40[_0x035d('0x4b')]]['transferuniqueid']=_0x1acf40['secondtransfereruniqueid'];queues[_0x1acf40[_0x035d('0x4b')]][_0x035d('0x8')]=_0x035d('0x51');}if(!_[_0x035d('0x15')](queues[_0x1acf40[_0x035d('0x4c')]])){if(_0x1acf40[_0x035d('0x5c')]&&queues[_0x1acf40[_0x035d('0x5c')]]){queues[_0x1acf40[_0x035d('0x5c')]][_0x035d('0x53')]=0x1;queues[_0x1acf40[_0x035d('0x5d')]]=_[_0x035d('0x54')](queues[_0x1acf40[_0x035d('0x5c')]]);queues[_0x1acf40[_0x035d('0x5d')]][_0x035d('0xb')]=_0x1acf40[_0x035d('0x5d')];queues[_0x1acf40[_0x035d('0x5d')]][_0x035d('0x53')]=0x2;queues[_0x1acf40['transfertargetuniqueid']][_0x035d('0x55')]=queues[_0x1acf40[_0x035d('0x4b')]][_0x035d('0x55')];queues[_0x1acf40[_0x035d('0x5d')]][_0x035d('0x56')]=queues[_0x1acf40[_0x035d('0x4b')]]['calleridname'];queues[_0x1acf40[_0x035d('0x5d')]][_0x035d('0x30')]=utils['now']();queues[_0x1acf40[_0x035d('0x5d')]]['queuecallerleaveAt']=utils[_0x035d('0x12')]();queues[_0x1acf40['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x1acf40['transfertargetuniqueid']][_0x035d('0x5e')]=0x0;utils[_0x035d('0x2')](util[_0x035d('0xe')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x1acf40['origtransfereruniqueid'],queues[_0x1acf40['transfertargetuniqueid']]['name'],queues[_0x1acf40[_0x035d('0x5d')]]['transfereduniqueid'],queues[_0x1acf40[_0x035d('0x5d')]][_0x035d('0x55')],queues[_0x1acf40[_0x035d('0x5d')]][_0x035d('0x56')]));}else{utils[_0x035d('0x2')](util[_0x035d('0xe')](_0x035d('0x58'),_0x1acf40[_0x035d('0x4a')],queues[_0x1acf40['secondtransfererlinkedid']]['name'],_0x1acf40[_0x035d('0x4b')]));queues[_0x1acf40[_0x035d('0x4c')]][_0x035d('0xb')]=_0x1acf40[_0x035d('0x4b')];}}}}catch(_0x32ed4d){utils[_0x035d('0x13')](util[_0x035d('0xe')]('[%s][queues][attendedtransfer]',_0x1acf40[_0x035d('0x4a')]),_0x32ed4d);}};exports[_0x035d('0x5f')]=function(_0x360abb){try{if(!_['isNil'](queues[_0x360abb['uniqueid']])){utils['debug'](util[_0x035d('0xe')](_0x035d('0x60'),_0x360abb['uniqueid']),_0x360abb);queues[_0x360abb[_0x035d('0xc')]]['musiconholdstartAt']=utils[_0x035d('0x12')]();utils[_0x035d('0x2')](util[_0x035d('0xe')](_0x035d('0x61'),_0x360abb[_0x035d('0xc')],queues[_0x360abb[_0x035d('0xc')]][_0x035d('0x1b')],queues[_0x360abb[_0x035d('0xc')]]['musiconholdstartAt']));}}catch(_0x4f5b69){utils[_0x035d('0x13')](util[_0x035d('0xe')]('[%s][queues][musiconholdstart]',_0x360abb['uniqueid']),_0x4f5b69);}};exports[_0x035d('0x62')]=function(_0x5729c0){try{if(!_['isNil'](queues[_0x5729c0[_0x035d('0xc')]])){if(!_[_0x035d('0x15')](queues[_0x5729c0[_0x035d('0xc')]][_0x035d('0x63')])){utils['debug'](util[_0x035d('0xe')]('[%s][queues][musiconholdstop]',_0x5729c0[_0x035d('0xc')]),_0x5729c0);queues[_0x5729c0['uniqueid']][_0x035d('0x5e')]+=utils[_0x035d('0x2f')](utils[_0x035d('0x12')](),queues[_0x5729c0[_0x035d('0xc')]]['musiconholdstartAt']);utils[_0x035d('0x2')](util[_0x035d('0xe')](_0x035d('0x64'),_0x5729c0['uniqueid'],queues[_0x5729c0[_0x035d('0xc')]][_0x035d('0x1b')],queues[_0x5729c0[_0x035d('0xc')]][_0x035d('0x5e')]));delete queues[_0x5729c0['uniqueid']][_0x035d('0x63')];}}}catch(_0x131d3c){utils['error'](util[_0x035d('0xe')](_0x035d('0x65'),_0x5729c0[_0x035d('0xc')]),_0x131d3c);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 77da7b7..aa0f8d1 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 _0x200b=['[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','newstate','debug','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','linkedid','[%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','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','[%s][recordings][blindtransfer]','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','then','membername','name','UserId','CreateVoiceRecording','newchannel'];(function(_0x582274,_0x2cbd9c){var _0x8f14d3=function(_0x1cfe08){while(--_0x1cfe08){_0x582274['push'](_0x582274['shift']());}};_0x8f14d3(++_0x2cbd9c);}(_0x200b,0x1e9));var _0xb200=function(_0x4b9339,_0x1db296){_0x4b9339=_0x4b9339-0x0;var _0x182745=_0x200b[_0x4b9339];return _0x182745;};'use strict';var _=require('lodash');var util=require(_0xb200('0x0'));var utils=require(_0xb200('0x1'));var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x1ebdf0){var _0x5e51a7;utils[_0xb200('0x2')](util[_0xb200('0x3')](_0xb200('0x4'),_0x1ebdf0[_0xb200('0x5')]));if(transfers['blinds'][_0x1ebdf0['uniqueid']]){_0x5e51a7=_0x1ebdf0['uniqueid'];_0x1ebdf0[_0xb200('0x5')]=transfers[_0xb200('0x6')][_0x1ebdf0[_0xb200('0x5')]][_0xb200('0x7')];}if(_0x1ebdf0[_0xb200('0x8')]){utils['getUserByInternal'](_0x1ebdf0[_0xb200('0x8')])[_0xb200('0x9')](function(_0x3212ef){if(_0x3212ef){_0x1ebdf0[_0xb200('0xa')]=_0x3212ef[_0xb200('0xb')];_0x1ebdf0[_0xb200('0xc')]=_0x3212ef['id'];}utils['request'](_0xb200('0xd'),_0x1ebdf0);});}else{utils['request'](_0xb200('0xd'),_0x1ebdf0);}if(_0x5e51a7)delete transfers['blinds'][_0x5e51a7];}exports[_0xb200('0xe')]=function(_0x23462c){try{utils['debug'](util[_0xb200('0x3')](_0xb200('0xf'),_0x23462c['uniqueid']),_0x23462c);if(_0x23462c[_0xb200('0x5')]==_0x23462c['linkedid']){utils['info'](util[_0xb200('0x3')](_0xb200('0x10'),_0x23462c['uniqueid'],_0x23462c[_0xb200('0x11')],_0x23462c['exten']));recordings[_0x23462c[_0xb200('0x5')]]={'uniqueid':_0x23462c[_0xb200('0x5')],'accountcode':_0x23462c[_0xb200('0x8')],'exten':_0x23462c[_0xb200('0x12')],'context':_0x23462c[_0xb200('0x11')],'channel':_0x23462c['channel'],'monitors':[]};}}catch(_0x3129b1){utils['error'](util[_0xb200('0x3')]('[%s][recordings][newchannel]',_0x23462c[_0xb200('0x5')]),_0x3129b1);}};exports[_0xb200('0x13')]=function(_0x3198ec){try{utils[_0xb200('0x14')](util[_0xb200('0x3')](_0xb200('0x15'),_0x3198ec['uniqueid']),_0x3198ec);if(!_[_0xb200('0x16')](recordings[_0x3198ec[_0xb200('0x5')]])&&_0x3198ec[_0xb200('0x17')]==0x6){utils[_0xb200('0x2')](util[_0xb200('0x3')](_0xb200('0x18'),_0x3198ec[_0xb200('0x5')],_0x3198ec['context'],_0x3198ec[_0xb200('0x19')]));}else if(!_[_0xb200('0x16')](recordings[_0x3198ec[_0xb200('0x1a')]])&&_0x3198ec[_0xb200('0x17')]==0x6&&_0x3198ec[_0xb200('0x11')]!='transfer'){utils[_0xb200('0x2')](util[_0xb200('0x3')](_0xb200('0x1b'),_0x3198ec[_0xb200('0x5')],_0x3198ec[_0xb200('0x1a')],_0x3198ec[_0xb200('0x11')],_0x3198ec[_0xb200('0x19')]));recordings[_0x3198ec[_0xb200('0x1a')]][_0xb200('0x8')]=_0x3198ec[_0xb200('0x8')];}}catch(_0x26ad1b){utils[_0xb200('0x1c')](util[_0xb200('0x3')](_0xb200('0x15'),_0x3198ec[_0xb200('0x5')]),_0x26ad1b);}};exports[_0xb200('0x1d')]=function(_0x2fd9a7){try{if(!_[_0xb200('0x16')](_0x2fd9a7[_0xb200('0x1e')])&&!_[_0xb200('0x16')](_0x2fd9a7[_0xb200('0x1e')][_0xb200('0x1f')])){utils[_0xb200('0x14')](util[_0xb200('0x3')](_0xb200('0x20'),_0x2fd9a7[_0xb200('0x5')]),_0x2fd9a7);utils[_0xb200('0x2')](util[_0xb200('0x3')](_0xb200('0x21'),_0x2fd9a7['uniqueid'],_0x2fd9a7[_0xb200('0x1e')],_0x2fd9a7[_0xb200('0x22')]));if(_[_0xb200('0x23')](_0x2fd9a7['value'],_0xb200('0x24'))){_0x2fd9a7[_0xb200('0x22')]=_0x2fd9a7[_0xb200('0x22')][_0xb200('0x25')](_0xb200('0x24'),'.WAV');}if(recordings[_0x2fd9a7[_0xb200('0x1a')]]){var _0x378232=_[_0xb200('0x26')](recordings[_0x2fd9a7[_0xb200('0x1a')]]['monitors'],{'value':_0x2fd9a7['value']});if(_['isNil'](_0x378232)){recordings[_0x2fd9a7[_0xb200('0x1a')]][_0xb200('0x27')][_0xb200('0x28')]({'value':_0x2fd9a7[_0xb200('0x22')]});}}}}catch(_0x4f3460){utils[_0xb200('0x1c')](util[_0xb200('0x3')]('[%s][recordings][varset]',_0x2fd9a7[_0xb200('0x5')]),_0x4f3460);}};exports[_0xb200('0x29')]=function(_0x31f5f5){try{if(!_['isNil'](recordings[_0x31f5f5['uniqueid']])){utils[_0xb200('0x14')](util['format'](_0xb200('0x2a'),_0x31f5f5[_0xb200('0x5')]),_0x31f5f5);utils[_0xb200('0x2')](util[_0xb200('0x3')](_0xb200('0x2b'),_0x31f5f5['uniqueid'],_0x31f5f5[_0xb200('0x2c')],_0x31f5f5['calleridname'],_0x31f5f5['cause-txt']));recordings[_0x31f5f5[_0xb200('0x5')]][_0xb200('0x2c')]=_0x31f5f5[_0xb200('0x2c')];recordings[_0x31f5f5['uniqueid']]['calleridname']=_0x31f5f5[_0xb200('0x2d')];recordings[_0x31f5f5['uniqueid']][_0xb200('0x2e')]=_0x31f5f5[_0xb200('0x2e')];recordings[_0x31f5f5['uniqueid']][_0xb200('0x2f')]=_0x31f5f5[_0xb200('0x2f')];if(recordings[_0x31f5f5[_0xb200('0x5')]][_0xb200('0x30')]=='outbound'&&recordings[_0x31f5f5['uniqueid']][_0xb200('0x8')]){recordings[_0x31f5f5[_0xb200('0x5')]][_0xb200('0x2e')]=recordings[_0x31f5f5[_0xb200('0x5')]][_0xb200('0x8')];recordings[_0x31f5f5['uniqueid']][_0xb200('0x2f')]='';}recordings[_0x31f5f5['uniqueid']][_0xb200('0x27')][_0xb200('0x31')](function(_0x14925a){var _0x2c1b4d=_[_0xb200('0x32')](recordings[_0x31f5f5[_0xb200('0x5')]]);_0x2c1b4d[_0xb200('0x22')]=_0x14925a['value'];writeDB(_0x2c1b4d);});delete recordings[_0x31f5f5[_0xb200('0x5')]];}}catch(_0x31aa3f){utils[_0xb200('0x1c')](util[_0xb200('0x3')](_0xb200('0x2a'),_0x31f5f5[_0xb200('0x5')]),_0x31aa3f);}};exports[_0xb200('0x33')]=function(_0x4aac5e){try{if(!_[_0xb200('0x16')](recordings[_0x4aac5e[_0xb200('0x5')]])){utils['debug'](util['format'](_0xb200('0x34'),_0x4aac5e[_0xb200('0x5')]),_0x4aac5e);utils[_0xb200('0x2')](util[_0xb200('0x3')](_0xb200('0x35'),_0x4aac5e['uniqueid'],_0x4aac5e[_0xb200('0x36')],_0x4aac5e[_0xb200('0x37')]));if(_0x4aac5e[_0xb200('0x36')]['toLowerCase']()==_0xb200('0x38')&&_['startsWith'](_0x4aac5e[_0xb200('0x37')][_0xb200('0x39')](),_0xb200('0x3a'))){var _0x19c5bd=_0x4aac5e[_0xb200('0x37')][_0xb200('0x3b')]('=');var _0x1ba9ce=_0x19c5bd[0x0][_0xb200('0x3c')](_0x19c5bd[0x0]['lastIndexOf']('(')+0x1,_0x19c5bd[0x0][_0xb200('0x3d')](')'));var _0x4ae54c=_0x19c5bd[0x1];recordings[_0x4aac5e[_0xb200('0x5')]][_0x1ba9ce]=_0x4ae54c;}}}catch(_0x3850be){utils[_0xb200('0x1c')](util[_0xb200('0x3')](_0xb200('0x34'),_0x4aac5e[_0xb200('0x5')]),_0x3850be);}};exports['queuecallerjoin']=function(_0x5e5b4f){try{if(!_[_0xb200('0x16')](recordings[_0x5e5b4f['uniqueid']])){utils['debug'](util[_0xb200('0x3')](_0xb200('0x3e'),_0x5e5b4f['uniqueid']),_0x5e5b4f);utils[_0xb200('0x2')](util['format'](_0xb200('0x3f'),_0x5e5b4f[_0xb200('0x5')],_0x5e5b4f['queue']));recordings[_0x5e5b4f['uniqueid']]['queue']=_0x5e5b4f[_0xb200('0x40')];}}catch(_0x329edd){utils[_0xb200('0x1c')](util[_0xb200('0x3')](_0xb200('0x3e'),_0x5e5b4f['uniqueid']),_0x329edd);}};exports['blindtransfer']=function(_0x300784){try{utils['debug'](util[_0xb200('0x3')]('[%s][recordings][blindtransfer]',_0x300784['uniqueid']),_0x300784);utils[_0xb200('0x2')](util[_0xb200('0x3')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x300784[_0xb200('0x5')],_0x300784[_0xb200('0x41')],_0x300784[_0xb200('0x42')],_0x300784[_0xb200('0x43')],_0x300784[_0xb200('0x44')]));if(recordings[_0x300784[_0xb200('0x45')]]&&transfers['blinds'][_0x300784[_0xb200('0x45')]]){transfers['blinds'][_0x300784[_0xb200('0x45')]][_0xb200('0x46')]=!![];}}catch(_0x3deb71){utils[_0xb200('0x1c')](util[_0xb200('0x3')](_0xb200('0x47'),_0x300784[_0xb200('0x5')]),_0x3deb71);}}; \ No newline at end of file +var _0x4647=['substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','[%s][recordings][writeDB]','blinds','uniqueid','transfereeuniqueid','accountcode','getUserByInternal','then','name','UserId','CreateVoiceRecording','request','[%s][recordings][newchannel]','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','debug','isNil','channelstate','info','transfer','linkedid','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','find','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr'];(function(_0x3187b0,_0x4cee2a){var _0x12c691=function(_0x25f27c){while(--_0x25f27c){_0x3187b0['push'](_0x3187b0['shift']());}};_0x12c691(++_0x4cee2a);}(_0x4647,0x15f));var _0x7464=function(_0x55ab4d,_0x49589a){_0x55ab4d=_0x55ab4d-0x0;var _0x16edcb=_0x4647[_0x55ab4d];return _0x16edcb;};'use strict';var _=require(_0x7464('0x0'));var util=require(_0x7464('0x1'));var utils=require(_0x7464('0x2'));var transfers=require(_0x7464('0x3'));var recordings={};function writeDB(_0x277d0c){var _0x9f736a;utils['info'](util['format'](_0x7464('0x4'),_0x277d0c['uniqueid']));if(transfers[_0x7464('0x5')][_0x277d0c['uniqueid']]){_0x9f736a=_0x277d0c[_0x7464('0x6')];_0x277d0c['uniqueid']=transfers[_0x7464('0x5')][_0x277d0c[_0x7464('0x6')]][_0x7464('0x7')];}if(_0x277d0c[_0x7464('0x8')]){utils[_0x7464('0x9')](_0x277d0c[_0x7464('0x8')])[_0x7464('0xa')](function(_0x2a4924){if(_0x2a4924){_0x277d0c['membername']=_0x2a4924[_0x7464('0xb')];_0x277d0c[_0x7464('0xc')]=_0x2a4924['id'];}utils['request'](_0x7464('0xd'),_0x277d0c);});}else{utils[_0x7464('0xe')](_0x7464('0xd'),_0x277d0c);}if(_0x9f736a)delete transfers[_0x7464('0x5')][_0x9f736a];}exports['newchannel']=function(_0xb6008e){try{utils['debug'](util['format'](_0x7464('0xf'),_0xb6008e['uniqueid']),_0xb6008e);if(_0xb6008e['uniqueid']==_0xb6008e['linkedid']){utils['info'](util[_0x7464('0x10')](_0x7464('0x11'),_0xb6008e[_0x7464('0x6')],_0xb6008e[_0x7464('0x12')],_0xb6008e[_0x7464('0x13')]));recordings[_0xb6008e[_0x7464('0x6')]]={'uniqueid':_0xb6008e[_0x7464('0x6')],'accountcode':_0xb6008e[_0x7464('0x8')],'exten':_0xb6008e[_0x7464('0x13')],'context':_0xb6008e[_0x7464('0x12')],'channel':_0xb6008e[_0x7464('0x14')],'monitors':[]};}}catch(_0x1e8a90){utils[_0x7464('0x15')](util[_0x7464('0x10')](_0x7464('0xf'),_0xb6008e['uniqueid']),_0x1e8a90);}};exports[_0x7464('0x16')]=function(_0xd82e36){try{utils[_0x7464('0x17')](util[_0x7464('0x10')]('[%s][recordings][newstate]',_0xd82e36[_0x7464('0x6')]),_0xd82e36);if(!_[_0x7464('0x18')](recordings[_0xd82e36[_0x7464('0x6')]])&&_0xd82e36[_0x7464('0x19')]==0x6){utils[_0x7464('0x1a')](util[_0x7464('0x10')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0xd82e36[_0x7464('0x6')],_0xd82e36[_0x7464('0x12')],_0xd82e36[_0x7464('0x14')]));}else if(!_[_0x7464('0x18')](recordings[_0xd82e36['linkedid']])&&_0xd82e36[_0x7464('0x19')]==0x6&&_0xd82e36[_0x7464('0x12')]!=_0x7464('0x1b')){utils[_0x7464('0x1a')](util[_0x7464('0x10')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0xd82e36[_0x7464('0x6')],_0xd82e36[_0x7464('0x1c')],_0xd82e36[_0x7464('0x12')],_0xd82e36[_0x7464('0x14')]));recordings[_0xd82e36[_0x7464('0x1c')]][_0x7464('0x8')]=_0xd82e36[_0x7464('0x8')];}}catch(_0x4e522c){utils['error'](util[_0x7464('0x10')](_0x7464('0x1d'),_0xd82e36[_0x7464('0x6')]),_0x4e522c);}};exports[_0x7464('0x1e')]=function(_0x49c027){try{if(!_[_0x7464('0x18')](_0x49c027[_0x7464('0x1f')])&&!_['isNil'](_0x49c027['variable'][_0x7464('0x20')])){utils[_0x7464('0x17')](util[_0x7464('0x10')](_0x7464('0x21'),_0x49c027['uniqueid']),_0x49c027);utils[_0x7464('0x1a')](util[_0x7464('0x10')](_0x7464('0x22'),_0x49c027[_0x7464('0x6')],_0x49c027[_0x7464('0x1f')],_0x49c027[_0x7464('0x23')]));if(_[_0x7464('0x24')](_0x49c027['value'],'.wav49')){_0x49c027['value']=_0x49c027[_0x7464('0x23')]['replace'](_0x7464('0x25'),'.WAV');}if(recordings[_0x49c027[_0x7464('0x1c')]]){var _0x2efffa=_[_0x7464('0x26')](recordings[_0x49c027[_0x7464('0x1c')]][_0x7464('0x27')],{'value':_0x49c027[_0x7464('0x23')]});if(_[_0x7464('0x18')](_0x2efffa)){recordings[_0x49c027[_0x7464('0x1c')]][_0x7464('0x27')][_0x7464('0x28')]({'value':_0x49c027[_0x7464('0x23')]});}}}}catch(_0x1ab326){utils['error'](util[_0x7464('0x10')](_0x7464('0x21'),_0x49c027['uniqueid']),_0x1ab326);}};exports[_0x7464('0x29')]=function(_0x3d9cd0){try{if(!_['isNil'](recordings[_0x3d9cd0[_0x7464('0x6')]])){utils[_0x7464('0x17')](util[_0x7464('0x10')](_0x7464('0x2a'),_0x3d9cd0[_0x7464('0x6')]),_0x3d9cd0);utils[_0x7464('0x1a')](util[_0x7464('0x10')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x3d9cd0['uniqueid'],_0x3d9cd0[_0x7464('0x2b')],_0x3d9cd0[_0x7464('0x2c')],_0x3d9cd0[_0x7464('0x2d')]));recordings[_0x3d9cd0[_0x7464('0x6')]]['calleridnum']=_0x3d9cd0[_0x7464('0x2b')];recordings[_0x3d9cd0['uniqueid']][_0x7464('0x2c')]=_0x3d9cd0[_0x7464('0x2c')];recordings[_0x3d9cd0[_0x7464('0x6')]][_0x7464('0x2e')]=_0x3d9cd0[_0x7464('0x2e')];recordings[_0x3d9cd0['uniqueid']][_0x7464('0x2f')]=_0x3d9cd0[_0x7464('0x2f')];if(recordings[_0x3d9cd0['uniqueid']]['type']==_0x7464('0x30')&&recordings[_0x3d9cd0['uniqueid']]['accountcode']){recordings[_0x3d9cd0['uniqueid']][_0x7464('0x2e')]=recordings[_0x3d9cd0[_0x7464('0x6')]][_0x7464('0x8')];recordings[_0x3d9cd0[_0x7464('0x6')]][_0x7464('0x2f')]='';}recordings[_0x3d9cd0[_0x7464('0x6')]][_0x7464('0x27')]['forEach'](function(_0x2b367c){var _0x19577a=_[_0x7464('0x31')](recordings[_0x3d9cd0[_0x7464('0x6')]]);_0x19577a[_0x7464('0x23')]=_0x2b367c['value'];writeDB(_0x19577a);});delete recordings[_0x3d9cd0[_0x7464('0x6')]];}}catch(_0x5214a7){utils[_0x7464('0x15')](util[_0x7464('0x10')](_0x7464('0x2a'),_0x3d9cd0[_0x7464('0x6')]),_0x5214a7);}};exports['newexten']=function(_0x2f9b00){try{if(!_[_0x7464('0x18')](recordings[_0x2f9b00[_0x7464('0x6')]])){utils['debug'](util[_0x7464('0x10')](_0x7464('0x32'),_0x2f9b00[_0x7464('0x6')]),_0x2f9b00);utils[_0x7464('0x1a')](util[_0x7464('0x10')](_0x7464('0x33'),_0x2f9b00['uniqueid'],_0x2f9b00[_0x7464('0x34')],_0x2f9b00[_0x7464('0x35')]));if(_0x2f9b00[_0x7464('0x34')][_0x7464('0x36')]()=='set'&&_[_0x7464('0x37')](_0x2f9b00[_0x7464('0x35')][_0x7464('0x36')](),_0x7464('0x38'))){var _0x3cc2c9=_0x2f9b00[_0x7464('0x35')]['split']('=');var _0x1e78ad=_0x3cc2c9[0x0][_0x7464('0x39')](_0x3cc2c9[0x0][_0x7464('0x3a')]('(')+0x1,_0x3cc2c9[0x0][_0x7464('0x3a')](')'));var _0x1a5476=_0x3cc2c9[0x1];recordings[_0x2f9b00[_0x7464('0x6')]][_0x1e78ad]=_0x1a5476;}}}catch(_0x5075e2){utils[_0x7464('0x15')](util[_0x7464('0x10')](_0x7464('0x32'),_0x2f9b00[_0x7464('0x6')]),_0x5075e2);}};exports['queuecallerjoin']=function(_0x5e9fc1){try{if(!_[_0x7464('0x18')](recordings[_0x5e9fc1['uniqueid']])){utils['debug'](util[_0x7464('0x10')](_0x7464('0x3b'),_0x5e9fc1[_0x7464('0x6')]),_0x5e9fc1);utils[_0x7464('0x1a')](util[_0x7464('0x10')](_0x7464('0x3c'),_0x5e9fc1[_0x7464('0x6')],_0x5e9fc1[_0x7464('0x3d')]));recordings[_0x5e9fc1[_0x7464('0x6')]][_0x7464('0x3d')]=_0x5e9fc1[_0x7464('0x3d')];}}catch(_0x1f88fc){utils['error'](util[_0x7464('0x10')](_0x7464('0x3b'),_0x5e9fc1[_0x7464('0x6')]),_0x1f88fc);}};exports['blindtransfer']=function(_0x507fc1){try{utils[_0x7464('0x17')](util[_0x7464('0x10')](_0x7464('0x3e'),_0x507fc1[_0x7464('0x6')]),_0x507fc1);utils[_0x7464('0x1a')](util[_0x7464('0x10')](_0x7464('0x3f'),_0x507fc1[_0x7464('0x6')],_0x507fc1['transferercalleridnum'],_0x507fc1[_0x7464('0x40')],_0x507fc1[_0x7464('0x41')],_0x507fc1['transfereecalleridname']));if(recordings[_0x507fc1[_0x7464('0x42')]]&&transfers['blinds'][_0x507fc1[_0x7464('0x42')]]){transfers['blinds'][_0x507fc1[_0x7464('0x42')]][_0x7464('0x43')]=!![];}}catch(_0x3bfb4b){utils[_0x7464('0x15')](util[_0x7464('0x10')]('[%s][recordings][blindtransfer]',_0x507fc1[_0x7464('0x6')]),_0x3bfb4b);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index fadb693..3a135d3 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 _0xa7c5=['transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','origtransfereruniqueid','origtransferercalleridnum','transfertargetcalleridnum','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname'];(function(_0x37e974,_0x539f6f){var _0x5c0d1c=function(_0x3d24e4){while(--_0x3d24e4){_0x37e974['push'](_0x37e974['shift']());}};_0x5c0d1c(++_0x539f6f);}(_0xa7c5,0x194));var _0x5a7c=function(_0xd81aae,_0x3f8baf){_0xd81aae=_0xd81aae-0x0;var _0x5eee3c=_0xa7c5[_0xd81aae];return _0x5eee3c;};'use strict';var _=require(_0x5a7c('0x0'));var util=require(_0x5a7c('0x1'));var utils=require(_0x5a7c('0x2'));function writeDB(_0x12dace){utils[_0x5a7c('0x3')](util[_0x5a7c('0x4')](_0x5a7c('0x5'),_0x12dace[_0x5a7c('0x6')]===_0x5a7c('0x7')?_0x12dace['origtransfereruniqueid']:_0x12dace[_0x5a7c('0x8')],_0x12dace['type']));utils[_0x5a7c('0x9')](_0x5a7c('0xa'),_0x12dace);}exports['blinds']={};exports[_0x5a7c('0xb')]=function(_0x1f77c1){try{utils[_0x5a7c('0xc')](util[_0x5a7c('0x4')](_0x5a7c('0xd'),_0x1f77c1[_0x5a7c('0x8')]),_0x1f77c1);utils[_0x5a7c('0x3')](util['format'](_0x5a7c('0xe'),_0x1f77c1[_0x5a7c('0x8')],_0x1f77c1['transferercalleridnum'],_0x1f77c1[_0x5a7c('0xf')],_0x1f77c1[_0x5a7c('0x10')],_0x1f77c1[_0x5a7c('0x11')]));_0x1f77c1['type']=_0x5a7c('0x12');exports['blinds'][_0x1f77c1[_0x5a7c('0x13')]]=_0x1f77c1;writeDB(_0x1f77c1);}catch(_0x2b0c4a){utils[_0x5a7c('0x14')](util['format'](_0x5a7c('0xd'),_0x1f77c1[_0x5a7c('0x8')]),_0x2b0c4a);}};exports[_0x5a7c('0x15')]=function(_0x483a63){try{utils[_0x5a7c('0xc')](util[_0x5a7c('0x4')]('[%s][transfers][attendedtransfer]',_0x483a63[_0x5a7c('0x16')]),_0x483a63);utils[_0x5a7c('0x3')](util[_0x5a7c('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x483a63[_0x5a7c('0x16')],_0x483a63[_0x5a7c('0x17')],_0x483a63['origtransferercalleridname'],_0x483a63[_0x5a7c('0x18')],_0x483a63['transfertargetcalleridname']));_0x483a63=_['assign'](_0x483a63,{'transfererchannel':_0x483a63[_0x5a7c('0x19')],'transferercalleridnum':_0x483a63[_0x5a7c('0x17')],'transferercalleridname':_0x483a63[_0x5a7c('0x1a')],'transfererconnectedlinenum':_0x483a63['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x483a63[_0x5a7c('0x1b')],'transfereraccountcode':_0x483a63[_0x5a7c('0x1c')],'transferercontext':_0x483a63['secondtransferercontext'],'transfererexten':_0x483a63[_0x5a7c('0x1d')],'transfererlinkedid':_0x483a63[_0x5a7c('0x1e')],'context':_0x483a63[_0x5a7c('0x1f')],'extension':_0x483a63[_0x5a7c('0x20')],'type':'attended'});if(_[_0x5a7c('0x21')](_0x483a63[_0x5a7c('0x22')])){_0x483a63=_['assign'](_0x483a63,{'transfereechannel':_0x483a63[_0x5a7c('0x23')],'transfereecalleridnum':_0x483a63['transfertargetcalleridnum'],'transfereecalleridname':_0x483a63[_0x5a7c('0x24')],'transfereeconnectedlinenum':_0x483a63[_0x5a7c('0x25')],'transfereeconnectedlinename':_0x483a63[_0x5a7c('0x26')],'transfereeaccountcode':_0x483a63['transfertargetaccountcode'],'transfereecontext':_0x483a63['transfertargetcontext'],'transfereeexten':_0x483a63[_0x5a7c('0x27')],'transfereelinkedid':_0x483a63[_0x5a7c('0x28')]});}writeDB(_0x483a63);}catch(_0x4385be){utils[_0x5a7c('0x14')](util['format'](_0x5a7c('0x29'),_0x483a63[_0x5a7c('0x16')]),_0x4385be);}}; \ No newline at end of file +var _0x450d=['transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','request','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','uniqueid','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0x450d,0x1d3));var _0xd450=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x450d[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xd450('0x0'));var util=require(_0xd450('0x1'));var utils=require(_0xd450('0x2'));function writeDB(_0x40c8c4){utils[_0xd450('0x3')](util[_0xd450('0x4')](_0xd450('0x5'),_0x40c8c4[_0xd450('0x6')]===_0xd450('0x7')?_0x40c8c4[_0xd450('0x8')]:_0x40c8c4['uniqueid'],_0x40c8c4['type']));utils[_0xd450('0x9')](_0xd450('0xa'),_0x40c8c4);}exports['blinds']={};exports['blindtransfer']=function(_0x5d43e6){try{utils[_0xd450('0xb')](util[_0xd450('0x4')]('[%s][transfers][blindtransfer]',_0x5d43e6['uniqueid']),_0x5d43e6);utils[_0xd450('0x3')](util[_0xd450('0x4')](_0xd450('0xc'),_0x5d43e6[_0xd450('0xd')],_0x5d43e6['transferercalleridnum'],_0x5d43e6[_0xd450('0xe')],_0x5d43e6[_0xd450('0xf')],_0x5d43e6[_0xd450('0x10')]));_0x5d43e6[_0xd450('0x6')]=_0xd450('0x11');exports['blinds'][_0x5d43e6[_0xd450('0x12')]]=_0x5d43e6;writeDB(_0x5d43e6);}catch(_0x2cd310){utils['error'](util[_0xd450('0x4')](_0xd450('0x13'),_0x5d43e6[_0xd450('0xd')]),_0x2cd310);}};exports[_0xd450('0x14')]=function(_0x11ee41){try{utils[_0xd450('0xb')](util[_0xd450('0x4')](_0xd450('0x15'),_0x11ee41[_0xd450('0x8')]),_0x11ee41);utils['info'](util[_0xd450('0x4')](_0xd450('0x16'),_0x11ee41['origtransfereruniqueid'],_0x11ee41['origtransferercalleridnum'],_0x11ee41[_0xd450('0x17')],_0x11ee41[_0xd450('0x18')],_0x11ee41['transfertargetcalleridname']));_0x11ee41=_[_0xd450('0x19')](_0x11ee41,{'transfererchannel':_0x11ee41[_0xd450('0x1a')],'transferercalleridnum':_0x11ee41[_0xd450('0x1b')],'transferercalleridname':_0x11ee41[_0xd450('0x17')],'transfererconnectedlinenum':_0x11ee41[_0xd450('0x1c')],'transfererconnectedlinename':_0x11ee41[_0xd450('0x1d')],'transfereraccountcode':_0x11ee41[_0xd450('0x1e')],'transferercontext':_0x11ee41['secondtransferercontext'],'transfererexten':_0x11ee41[_0xd450('0x1f')],'transfererlinkedid':_0x11ee41['origtransfererlinkedid'],'context':_0x11ee41['origtransferercontext'],'extension':_0x11ee41[_0xd450('0x20')],'type':'attended'});if(_[_0xd450('0x21')](_0x11ee41[_0xd450('0x22')])){_0x11ee41=_['assign'](_0x11ee41,{'transfereechannel':_0x11ee41[_0xd450('0x23')],'transfereecalleridnum':_0x11ee41[_0xd450('0x18')],'transfereecalleridname':_0x11ee41['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x11ee41[_0xd450('0x24')],'transfereeconnectedlinename':_0x11ee41[_0xd450('0x25')],'transfereeaccountcode':_0x11ee41['transfertargetaccountcode'],'transfereecontext':_0x11ee41[_0xd450('0x26')],'transfereeexten':_0x11ee41[_0xd450('0x27')],'transfereelinkedid':_0x11ee41[_0xd450('0x28')]});}writeDB(_0x11ee41);}catch(_0x35b89b){utils[_0xd450('0x29')](util['format']('[%s][transfers][attendedtransfer]',_0x11ee41[_0xd450('0x8')]),_0x35b89b);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 00663a7..b81d971 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 _0xfea2=['[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','isBefore','bluebird','jayson/promise','moment','client','http','../../config/logger','xdr','info','inspect','debug','error','then','[utils][request]\x20name:%s','request','GetUser','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','found','catch','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout'];(function(_0x100dd9,_0x5d540e){var _0x4db132=function(_0x5ad83b){while(--_0x5ad83b){_0x100dd9['push'](_0x100dd9['shift']());}};_0x4db132(++_0x5d540e);}(_0xfea2,0x156));var _0x2fea=function(_0xbb6fb5,_0x4db9fb){_0xbb6fb5=_0xbb6fb5-0x0;var _0x2f9501=_0xfea2[_0xbb6fb5];return _0x2f9501;};'use strict';var BPromise=require(_0x2fea('0x0'));var jayson=require(_0x2fea('0x1'));var moment=require(_0x2fea('0x2'));var util=require('util');var client=jayson[_0x2fea('0x3')][_0x2fea('0x4')]({'port':0x2329});var logger=require(_0x2fea('0x5'))(_0x2fea('0x6'));exports[_0x2fea('0x7')]=function(_0x1db390,_0x23818b){logger['info'](_0x1db390,_0x23818b?util[_0x2fea('0x8')](_0x23818b,{'showHidden':![],'depth':null}):'');};exports[_0x2fea('0x9')]=function(_0x4c84ae,_0x42d45e){logger[_0x2fea('0x9')](_0x4c84ae,_0x42d45e?util[_0x2fea('0x8')](_0x42d45e,{'showHidden':![],'depth':null}):'');};exports[_0x2fea('0xa')]=function(_0x14f962,_0x15e6c2){logger[_0x2fea('0xa')](_0x14f962,_0x15e6c2?util[_0x2fea('0x8')](_0x15e6c2,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x2a3fd9,_0x33b252){return client['request'](_0x2a3fd9,{'body':_0x33b252})[_0x2fea('0xb')](function(_0x490a67){logger[_0x2fea('0x9')](_0x2fea('0xc'),_0x2a3fd9,_0x490a67?util[_0x2fea('0x8')](_0x490a67,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x481c90){logger[_0x2fea('0xa')](_0x2fea('0xc'),_0x2a3fd9,_0x481c90?util[_0x2fea('0x8')](_0x481c90,{'showHidden':![],'depth':null}):'');});};function getUser(_0x445224){return client[_0x2fea('0xd')](_0x2fea('0xe'),{'options':{'raw':!![],'attributes':['id','internal',_0x2fea('0xf'),_0x2fea('0x10')],'where':_0x445224,'limit':0x1}})[_0x2fea('0xb')](function(_0x561fdd){logger[_0x2fea('0x9')](_0x2fea('0x11'),JSON[_0x2fea('0x12')](_0x445224),_0x561fdd?util[_0x2fea('0x8')](_0x561fdd,{'showHidden':![],'depth':null}):'');return _0x561fdd[_0x2fea('0x13')][_0x2fea('0x14')]?_0x561fdd[_0x2fea('0x13')][0x0]:null;});}exports[_0x2fea('0x15')]=function(_0x915b48){return new BPromise(function(_0x1bf918,_0x8e3ff4){if(_0x915b48){return getUser({'internal':_0x915b48})[_0x2fea('0xb')](function(_0x448950){logger[_0x2fea('0x7')](_0x2fea('0x16'),_0x915b48,_0x448950?'found':_0x2fea('0x17'));return _0x1bf918(_0x448950);})['catch'](function(_0x59de1e){logger['error']('[utils][getUserByInternal]',_0x59de1e?util[_0x2fea('0x8')](_0x59de1e,{'showHidden':![],'depth':null}):'');return _0x1bf918(null);});}return _0x1bf918(null);});};exports['getUserByInterface']=function(_0xec0ca6){return new BPromise(function(_0x32bce8,_0x14e204){if(_0xec0ca6){return getUser({'interface':_0xec0ca6})[_0x2fea('0xb')](function(_0xfff44e){logger[_0x2fea('0x7')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0xec0ca6,_0xfff44e?_0x2fea('0x18'):_0x2fea('0x17'));return _0x32bce8(_0xfff44e);})[_0x2fea('0x19')](function(_0x3eaa47){logger[_0x2fea('0xa')](_0x2fea('0x1a'),_0x3eaa47?util[_0x2fea('0x8')](_0x3eaa47,{'showHidden':![],'depth':null}):'');return _0x32bce8(null);});}return _0x32bce8(null);});};exports[_0x2fea('0x1b')]=function(_0x2eaaf9){return new BPromise(function(_0x3fd632,_0x34fbea){if(_0x2eaaf9){return getUser({'name':_0x2eaaf9})[_0x2fea('0xb')](function(_0x78dd4c){logger[_0x2fea('0x7')](_0x2fea('0x1c'),_0x2eaaf9,_0x78dd4c?_0x2fea('0x18'):_0x2fea('0x17'));return _0x3fd632(_0x78dd4c);})[_0x2fea('0x19')](function(_0x274df7){logger['error']('[utils][getUserByName]',_0x274df7?util['inspect'](_0x274df7,{'showHidden':![],'depth':null}):'');return _0x3fd632(null);});}return _0x3fd632(null);});};exports[_0x2fea('0x1d')]=function(_0xcb9c81){return new BPromise(function(_0x247096,_0x548106){if(_0xcb9c81){return client[_0x2fea('0xd')](_0x2fea('0x1e'),{'options':{'raw':!![],'attributes':['id','name',_0x2fea('0x1f'),_0x2fea('0x20'),_0x2fea('0x21')],'where':{'name':_0xcb9c81},'limit':0x1}})[_0x2fea('0xb')](function(_0x2ceb75){logger[_0x2fea('0x9')](_0x2fea('0x22'),_0xcb9c81,_0x2ceb75?util[_0x2fea('0x8')](_0x2ceb75,{'showHidden':![],'depth':null}):'');logger[_0x2fea('0x7')](_0x2fea('0x23'),_0xcb9c81,_0x2ceb75?_0x2fea('0x18'):_0x2fea('0x17'));return _0x247096(_0x2ceb75[_0x2fea('0x13')][_0x2fea('0x14')]?_0x2ceb75['result'][0x0]:null);})[_0x2fea('0x19')](function(_0xa256ae){logger[_0x2fea('0xa')]('[utils][getVoiceQueueByName]',_0xa256ae?util[_0x2fea('0x8')](_0xa256ae,{'showHidden':![],'depth':null}):'');return _0x247096(null);});}return _0x247096(null);});};exports[_0x2fea('0x24')]=function(_0x2f9fa6,_0x5a7dff){return moment(_0x2f9fa6)[_0x2fea('0x25')](_0x5a7dff,_0x2fea('0x26'))[_0x2fea('0x27')](_0x2fea('0x28'));};exports[_0x2fea('0x29')]=function(_0x4b1c41,_0x6f790c){return moment(_0x4b1c41)[_0x2fea('0x2a')](_0x6f790c,'seconds')[_0x2fea('0x27')](_0x2fea('0x28'));};exports[_0x2fea('0x2b')]=function(_0x485a76,_0x15d31c){return moment(_0x485a76)[_0x2fea('0x2c')](moment(_0x15d31c),_0x2fea('0x26'));};exports[_0x2fea('0x2d')]=function(_0x41e89a,_0x2d74c2){return parseInt(_0x41e89a,0xa)+parseInt(_0x2d74c2,0xa);};exports['now']=function(){return moment()[_0x2fea('0x27')](_0x2fea('0x28'));};exports['isAfter']=function(_0x1ecd2a,_0x1f9c64){if(_0x1f9c64){return moment(_0x1ecd2a)['isAfter'](_0x1f9c64);}return!![];};exports[_0x2fea('0x2e')]=function(_0x4ec994,_0x5edd12){if(_0x5edd12){return moment(_0x4ec994)[_0x2fea('0x2e')](_0x5edd12);}else if(_0x4ec994){return!![];}return![];}; \ No newline at end of file +var _0xf15b=['[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','moment','util','client','http','../../config/logger','xdr','info','inspect','error','request','catch','[utils][request]\x20name:%s','GetUser','internal','name','interface','then','debug','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s'];(function(_0x2ebcc9,_0x3bd5a3){var _0x425cf3=function(_0x43e790){while(--_0x43e790){_0x2ebcc9['push'](_0x2ebcc9['shift']());}};_0x425cf3(++_0x3bd5a3);}(_0xf15b,0x7f));var _0xbf15=function(_0x425d3e,_0x331f7c){_0x425d3e=_0x425d3e-0x0;var _0x2d1bf2=_0xf15b[_0x425d3e];return _0x2d1bf2;};'use strict';var BPromise=require(_0xbf15('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbf15('0x1'));var util=require(_0xbf15('0x2'));var client=jayson[_0xbf15('0x3')][_0xbf15('0x4')]({'port':0x2329});var logger=require(_0xbf15('0x5'))(_0xbf15('0x6'));exports[_0xbf15('0x7')]=function(_0x105221,_0xeb8a3d){logger[_0xbf15('0x7')](_0x105221,_0xeb8a3d?util['inspect'](_0xeb8a3d,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x5b46fa,_0x4ef07f){logger['debug'](_0x5b46fa,_0x4ef07f?util[_0xbf15('0x8')](_0x4ef07f,{'showHidden':![],'depth':null}):'');};exports[_0xbf15('0x9')]=function(_0x4e7d7f,_0x40781e){logger['error'](_0x4e7d7f,_0x40781e?util['inspect'](_0x40781e,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x209e70,_0x96e1ad){return client[_0xbf15('0xa')](_0x209e70,{'body':_0x96e1ad})['then'](function(_0x2f703c){logger['debug']('[utils][request]\x20name:%s',_0x209e70,_0x2f703c?util[_0xbf15('0x8')](_0x2f703c,{'showHidden':![],'depth':null}):'');})[_0xbf15('0xb')](function(_0x2bb471){logger['error'](_0xbf15('0xc'),_0x209e70,_0x2bb471?util[_0xbf15('0x8')](_0x2bb471,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1db5f2){return client[_0xbf15('0xa')](_0xbf15('0xd'),{'options':{'raw':!![],'attributes':['id',_0xbf15('0xe'),_0xbf15('0xf'),_0xbf15('0x10')],'where':_0x1db5f2,'limit':0x1}})[_0xbf15('0x11')](function(_0x2d5035){logger[_0xbf15('0x12')](_0xbf15('0x13'),JSON[_0xbf15('0x14')](_0x1db5f2),_0x2d5035?util['inspect'](_0x2d5035,{'showHidden':![],'depth':null}):'');return _0x2d5035[_0xbf15('0x15')]['length']?_0x2d5035[_0xbf15('0x15')][0x0]:null;});}exports[_0xbf15('0x16')]=function(_0x4fe053){return new BPromise(function(_0x1d098a,_0x2af496){if(_0x4fe053){return getUser({'internal':_0x4fe053})[_0xbf15('0x11')](function(_0x5d0605){logger[_0xbf15('0x7')](_0xbf15('0x17'),_0x4fe053,_0x5d0605?_0xbf15('0x18'):_0xbf15('0x19'));return _0x1d098a(_0x5d0605);})[_0xbf15('0xb')](function(_0x1295ea){logger['error'](_0xbf15('0x1a'),_0x1295ea?util[_0xbf15('0x8')](_0x1295ea,{'showHidden':![],'depth':null}):'');return _0x1d098a(null);});}return _0x1d098a(null);});};exports[_0xbf15('0x1b')]=function(_0x392f40){return new BPromise(function(_0x5df824,_0x44a24c){if(_0x392f40){return getUser({'interface':_0x392f40})['then'](function(_0x14496d){logger[_0xbf15('0x7')](_0xbf15('0x1c'),_0x392f40,_0x14496d?'found':_0xbf15('0x19'));return _0x5df824(_0x14496d);})[_0xbf15('0xb')](function(_0x2b11e2){logger[_0xbf15('0x9')](_0xbf15('0x1d'),_0x2b11e2?util['inspect'](_0x2b11e2,{'showHidden':![],'depth':null}):'');return _0x5df824(null);});}return _0x5df824(null);});};exports[_0xbf15('0x1e')]=function(_0x3e504b){return new BPromise(function(_0x17e4da,_0x3d8cb4){if(_0x3e504b){return getUser({'name':_0x3e504b})[_0xbf15('0x11')](function(_0x2773e9){logger[_0xbf15('0x7')](_0xbf15('0x1f'),_0x3e504b,_0x2773e9?_0xbf15('0x18'):'notfound');return _0x17e4da(_0x2773e9);})[_0xbf15('0xb')](function(_0x139223){logger[_0xbf15('0x9')](_0xbf15('0x20'),_0x139223?util[_0xbf15('0x8')](_0x139223,{'showHidden':![],'depth':null}):'');return _0x17e4da(null);});}return _0x17e4da(null);});};exports[_0xbf15('0x21')]=function(_0x1650c5){return new BPromise(function(_0x1833c5,_0x3b6d59){if(_0x1650c5){return client[_0xbf15('0xa')](_0xbf15('0x22'),{'options':{'raw':!![],'attributes':['id','name',_0xbf15('0x23'),_0xbf15('0x24'),_0xbf15('0x25')],'where':{'name':_0x1650c5},'limit':0x1}})['then'](function(_0x4de730){logger[_0xbf15('0x12')](_0xbf15('0x26'),_0x1650c5,_0x4de730?util[_0xbf15('0x8')](_0x4de730,{'showHidden':![],'depth':null}):'');logger['info'](_0xbf15('0x27'),_0x1650c5,_0x4de730?'found':_0xbf15('0x19'));return _0x1833c5(_0x4de730[_0xbf15('0x15')][_0xbf15('0x28')]?_0x4de730[_0xbf15('0x15')][0x0]:null);})['catch'](function(_0x37b3e3){logger[_0xbf15('0x9')](_0xbf15('0x29'),_0x37b3e3?util['inspect'](_0x37b3e3,{'showHidden':![],'depth':null}):'');return _0x1833c5(null);});}return _0x1833c5(null);});};exports['addTime']=function(_0x2bdd16,_0x6d014f){return moment(_0x2bdd16)[_0xbf15('0x2a')](_0x6d014f,_0xbf15('0x2b'))[_0xbf15('0x2c')](_0xbf15('0x2d'));};exports['subtractTime']=function(_0x46db08,_0x2296fe){return moment(_0x46db08)[_0xbf15('0x2e')](_0x2296fe,_0xbf15('0x2b'))[_0xbf15('0x2c')](_0xbf15('0x2d'));};exports[_0xbf15('0x2f')]=function(_0x4c33c2,_0x296bbe){return moment(_0x4c33c2)[_0xbf15('0x30')](moment(_0x296bbe),'seconds');};exports[_0xbf15('0x31')]=function(_0x4ef412,_0x1ad4ca){return parseInt(_0x4ef412,0xa)+parseInt(_0x1ad4ca,0xa);};exports[_0xbf15('0x32')]=function(){return moment()[_0xbf15('0x2c')](_0xbf15('0x2d'));};exports[_0xbf15('0x33')]=function(_0x963665,_0x3c440e){if(_0x3c440e){return moment(_0x963665)[_0xbf15('0x33')](_0x3c440e);}return!![];};exports[_0xbf15('0x34')]=function(_0x5b1691,_0x36d570){if(_0x36d570){return moment(_0x5b1691)[_0xbf15('0x34')](_0x36d570);}else if(_0x5b1691){return!![];}return![];}; \ No newline at end of file